diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md
index 843fd102..dbdb568e 100644
--- a/COMPONENT_INDEX.md
+++ b/COMPONENT_INDEX.md
@@ -4579,21 +4579,20 @@ None.
### Props
-| Prop name | Required | Kind | Reactive | Type | Default value | Description |
-| :---------- | :------- | :--------------- | :------- | ------------------------------------------------- | ------------------------------------------------ | ----------------------------------------------------- |
-| ref | No | let
| Yes | null | HTMLButtonElement
| null
| Obtain a reference to the button HTML element |
-| open | No | let
| Yes | boolean
| false
| Set to `true` to open the tooltip |
-| tooltipText | No | let
| No | string
| ""
| Specify the tooltip text |
-| align | No | let
| No | "start" | "center" | "end"
| "center"
| Set the alignment of the tooltip relative to the icon |
-| direction | No | let
| No | "top" | "bottom"
| "bottom"
| Set the direction of the tooltip relative to the icon |
-| id | No | let
| No | string
| "ccs-" + Math.random().toString(36)
| Set an id for the tooltip div element |
+| Prop name | Required | Kind | Reactive | Type | Default value | Description |
+| :--------- | :------- | :--------------- | :------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------------------------- |
+| ref | No | let
| Yes | null | HTMLButtonElement
| null
| Obtain a reference to the button HTML element |
+| open | No | let
| Yes | boolean
| false
| Set to `true` to open the tooltip |
+| definition | No | let
| No | string
| ""
| Specify the term definition. |
+| align | No | let
| No | "top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right" | "left" | "left-bottom" | "left-top" | "right" | "right-bottom" | "right-top"
| "bottom-left"
| Set the alignment of the tooltip relative to the icon |
+| id | No | let
| No | string
| "ccs-" + Math.random().toString(36)
| Set an id for the tooltip div element |
### Slots
-| Slot name | Default | Props | Fallback |
-| :-------- | :------ | :---- | :------------------------- |
-| -- | Yes | -- | -- |
-| tooltip | No | -- | {tooltipText}
|
+| Slot name | Default | Props | Fallback |
+| :--------- | :------ | :---- | :------------------------ |
+| -- | Yes | -- | -- |
+| definition | No | -- | {definition}
|
### Events
diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json
index 4bf660c7..222ed167 100644
--- a/docs/src/COMPONENT_API.json
+++ b/docs/src/COMPONENT_API.json
@@ -14184,9 +14184,9 @@
"filePath": "src/TooltipDefinition/TooltipDefinition.svelte",
"props": [
{
- "name": "tooltipText",
+ "name": "definition",
"kind": "let",
- "description": "Specify the tooltip text",
+ "description": "Specify the term definition.",
"type": "string",
"value": "\"\"",
"isFunction": false,
@@ -14211,20 +14211,8 @@
"name": "align",
"kind": "let",
"description": "Set the alignment of the tooltip relative to the icon",
- "type": "\"start\" | \"center\" | \"end\"",
- "value": "\"center\"",
- "isFunction": false,
- "isFunctionDeclaration": false,
- "isRequired": false,
- "constant": false,
- "reactive": false
- },
- {
- "name": "direction",
- "kind": "let",
- "description": "Set the direction of the tooltip relative to the icon",
- "type": "\"top\" | \"bottom\"",
- "value": "\"bottom\"",
+ "type": "\"top\" | \"top-left\" | \"top-right\" | \"bottom\" | \"bottom-left\" | \"bottom-right\" | \"left\" | \"left-bottom\" | \"left-top\" | \"right\" | \"right-bottom\" | \"right-top\"",
+ "value": "\"bottom-left\"",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
@@ -14260,9 +14248,9 @@
"slots": [
{ "name": "__default__", "default": true, "slot_props": "{}" },
{
- "name": "tooltip",
+ "name": "definition",
"default": false,
- "fallback": "{tooltipText}",
+ "fallback": "{definition}",
"slot_props": "{}"
}
],
@@ -14275,8 +14263,7 @@
{ "type": "forwarded", "name": "mouseleave", "element": "button" },
{ "type": "forwarded", "name": "focus", "element": "button" }
],
- "typedefs": [],
- "rest_props": { "type": "Element", "name": "span" }
+ "typedefs": []
},
{
"moduleName": "TooltipFooter",
diff --git a/docs/src/pages/components/TooltipDefinition.svx b/docs/src/pages/components/TooltipDefinition.svx
index 7ff316b9..ce36d3df 100644
--- a/docs/src/pages/components/TooltipDefinition.svx
+++ b/docs/src/pages/components/TooltipDefinition.svx
@@ -5,25 +5,25 @@
## Default
-
+
Armonk
-## Custom tooltip direction and alignment
+## Custom tooltip alignment
-Customize the tooltip menu direction and alignment through the `direction` and `align` props.
+Customize the tooltip alignment through the `align` prop.
-By default, `direction` is `"bottom"` and `align` is `"center"`.
+By default, `align` is `"bottom-left"`.
-
+
Armonk
-## Custom tooltip slot
+## Custom definition slot
Armonk
-
+
IBM Corporate Headquarters is based in Armonk, New York.
diff --git a/src/TooltipDefinition/TooltipDefinition.svelte b/src/TooltipDefinition/TooltipDefinition.svelte
index 5c310aa4..f8b9bf32 100644
--- a/src/TooltipDefinition/TooltipDefinition.svelte
+++ b/src/TooltipDefinition/TooltipDefinition.svelte
@@ -4,8 +4,8 @@
* @event {null} close
*/
- /** Specify the tooltip text */
- export let tooltipText = "";
+ /** Specify the term definition. */
+ export let definition = "";
/**
* Set to `true` to open the tooltip
@@ -14,15 +14,9 @@
/**
* Set the alignment of the tooltip relative to the icon
- * @type {"start" | "center" | "end"}
+ * @type {"top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right" | "left" | "left-bottom" | "left-top" | "right" | "right-bottom" | "right-top"}
*/
- export let align = "center";
-
- /**
- * Set the direction of the tooltip relative to the icon
- * @type {"top" | "bottom"}
- */
- export let direction = "bottom";
+ export let align = "bottom-left";
/** Set an id for the tooltip div element */
export let id = "ccs-" + Math.random().toString(36);
@@ -31,6 +25,8 @@
export let ref = null;
import { createEventDispatcher } from "svelte";
+ import Popover from "../Popover/Popover.svelte";
+ import PopoverContent from "../Popover/PopoverContent.svelte";
const dispatch = createEventDispatcher();
@@ -48,27 +44,12 @@
/>
-
+
-
- {tooltipText}
-
-
+
+ {definition}
+
+
diff --git a/tests/TooltipDefinition.test.svelte b/tests/TooltipDefinition.test.svelte
index d922d703..29e5a596 100644
--- a/tests/TooltipDefinition.test.svelte
+++ b/tests/TooltipDefinition.test.svelte
@@ -8,22 +8,21 @@
bind:open
on:open
on:close
- tooltipText="IBM Corporate Headquarters is based in Armonk, New York."
+ definition="IBM Corporate Headquarters is based in Armonk, New York."
>
Armonk
Armonk
Armonk
-
+
IBM Corporate Headquarters is based in Armonk, New York.
diff --git a/types/TooltipDefinition/TooltipDefinition.svelte.d.ts b/types/TooltipDefinition/TooltipDefinition.svelte.d.ts
index 254848be..9475c5a3 100644
--- a/types/TooltipDefinition/TooltipDefinition.svelte.d.ts
+++ b/types/TooltipDefinition/TooltipDefinition.svelte.d.ts
@@ -1,14 +1,11 @@
import type { SvelteComponentTyped } from "svelte";
-import type { SvelteHTMLElements } from "svelte/elements";
-type RestProps = SvelteHTMLElements["span"];
-
-export interface TooltipDefinitionProps extends RestProps {
+export interface TooltipDefinitionProps {
/**
- * Specify the tooltip text
+ * Specify the term definition.
* @default ""
*/
- tooltipText?: string;
+ definition?: string;
/**
* Set to `true` to open the tooltip
@@ -18,15 +15,21 @@ export interface TooltipDefinitionProps extends RestProps {
/**
* Set the alignment of the tooltip relative to the icon
- * @default "center"
+ * @default "bottom-left"
*/
- align?: "start" | "center" | "end";
-
- /**
- * Set the direction of the tooltip relative to the icon
- * @default "bottom"
- */
- direction?: "top" | "bottom";
+ align?:
+ | "top"
+ | "top-left"
+ | "top-right"
+ | "bottom"
+ | "bottom-left"
+ | "bottom-right"
+ | "left"
+ | "left-bottom"
+ | "left-top"
+ | "right"
+ | "right-bottom"
+ | "right-top";
/**
* Set an id for the tooltip div element
@@ -39,8 +42,6 @@ export interface TooltipDefinitionProps extends RestProps {
* @default null
*/
ref?: null | HTMLButtonElement;
-
- [key: `data-${string}`]: any;
}
export default class TooltipDefinition extends SvelteComponentTyped<
@@ -54,5 +55,5 @@ export default class TooltipDefinition extends SvelteComponentTyped<
mouseleave: WindowEventMap["mouseleave"];
focus: WindowEventMap["focus"];
},
- { default: {}; tooltip: {} }
+ { default: {}; definition: {} }
> {}