diff --git a/docs/src/PUBLIC_API.json b/docs/src/PUBLIC_API.json index 32f5ed65..506a3ea2 100644 --- a/docs/src/PUBLIC_API.json +++ b/docs/src/PUBLIC_API.json @@ -15506,14 +15506,61 @@ "default": true, "default_value": "" } + ], + [ + "tooltip", + { + "attributes": [ + { + "start": 1681, + "end": 1695, + "type": "Attribute", + "name": "name", + "value": [ + { + "start": 1687, + "end": 1694, + "type": "Text", + "raw": "tooltip", + "data": "tooltip" + } + ] + } + ], + "children": [ + { + "start": 1696, + "end": 1709, + "type": "MustacheTag", + "expression": { + "type": "Identifier", + "start": 1697, + "end": 1708, + "loc": { + "start": { + "line": 76, + "column": 26 + }, + "end": { + "line": 76, + "column": 37 + } + }, + "name": "tooltipText" + } + } + ], + "default": false, + "default_value": "{tooltipText}\n" + } ] ], "forwarded_events": [ [ "click", { - "start": 1480, - "end": 1488, + "start": 1457, + "end": 1465, "type": "EventHandler", "name": "click", "modifiers": [], @@ -15523,8 +15570,8 @@ [ "mouseover", { - "start": 1493, - "end": 1505, + "start": 1470, + "end": 1482, "type": "EventHandler", "name": "mouseover", "modifiers": [], @@ -15534,8 +15581,8 @@ [ "mouseenter", { - "start": 1510, - "end": 1523, + "start": 1487, + "end": 1500, "type": "EventHandler", "name": "mouseenter", "modifiers": [], @@ -15545,8 +15592,8 @@ [ "mouseleave", { - "start": 1528, - "end": 1541, + "start": 1505, + "end": 1518, "type": "EventHandler", "name": "mouseleave", "modifiers": [], @@ -15556,8 +15603,8 @@ [ "focus", { - "start": 1546, - "end": 1554, + "start": 1523, + "end": 1531, "type": "EventHandler", "name": "focus", "modifiers": [], diff --git a/docs/src/pages/components/TooltipDefinition.svx b/docs/src/pages/components/TooltipDefinition.svx index 2633be67..c71332ae 100644 --- a/docs/src/pages/components/TooltipDefinition.svx +++ b/docs/src/pages/components/TooltipDefinition.svx @@ -3,14 +3,27 @@ import Preview from "../../components/Preview.svelte"; -### Default ("bottom" direction, "center" aligned) +### Default Armonk -### Custom direction, alignment +### Custom tooltip direction and alignment + +Customize the tooltip menu direction and alignment through the `direction` and `align` props. + +By default, `direction` is `"bottom"` and `align` is `"center"`. Armonk + +### Custom tooltip slot + + + Armonk + + IBM Corporate Headquarters is based in Armonk, New York. + + diff --git a/src/TooltipDefinition/TooltipDefinition.svelte b/src/TooltipDefinition/TooltipDefinition.svelte index b2486ec3..8478c939 100644 --- a/src/TooltipDefinition/TooltipDefinition.svelte +++ b/src/TooltipDefinition/TooltipDefinition.svelte @@ -29,28 +29,28 @@ */ export let ref = null; - $: hidden = false; - $: visible = false; + let visible = false; + + function hide() { + visible = false; + } + + function show() { + visible = true; + }
diff --git a/types/index.d.ts b/types/index.d.ts index 1cc622e0..f9b3943c 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -5180,7 +5180,7 @@ export class TooltipDefinition extends CarbonSvelteComponent { ref?: null | HTMLButtonElement; }; - $$slot_def: { default: {} }; + $$slot_def: { default: {}; tooltip: {} }; } export class TooltipIcon extends CarbonSvelteComponent {