diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md
index 5e5b9934..d9bfa1be 100644
--- a/COMPONENT_INDEX.md
+++ b/COMPONENT_INDEX.md
@@ -1,6 +1,6 @@
# Component Index
-> 166 components exported from carbon-components-svelte@0.31.1.
+> 167 components exported from carbon-components-svelte@0.31.1.
## Components
@@ -167,6 +167,7 @@
- [`ToolbarSearch`](#toolbarsearch)
- [`Tooltip`](#tooltip)
- [`TooltipDefinition`](#tooltipdefinition)
+- [`TooltipFooter`](#tooltipfooter)
- [`TooltipIcon`](#tooltipicon)
- [`Truncate`](#truncate)
- [`UnorderedList`](#unorderedlist)
@@ -4470,6 +4471,24 @@ None.
| mouseleave | forwarded | -- |
| focus | forwarded | -- |
+## `TooltipFooter`
+
+### Props
+
+| Prop name | Kind | Reactive | Type | Default value | Description |
+| :------------------- | :--------------- | :------- | :------------------ | ---------------------------------------------- | --------------------------------------------------------------------------- |
+| selectorPrimaryFocus | let
| No | string
| "a[href], button:not([disabled])"
| Specify a selector to be focused inside the footer when opening the tooltip |
+
+### Slots
+
+| Slot name | Default | Props | Fallback |
+| :-------- | :------ | :---- | :------- |
+| -- | Yes | -- | -- |
+
+### Events
+
+None.
+
## `TooltipIcon`
### Props
diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json
index cd636053..291edbf3 100644
--- a/docs/src/COMPONENT_API.json
+++ b/docs/src/COMPONENT_API.json
@@ -1,5 +1,5 @@
{
- "total": 166,
+ "total": 167,
"components": [
{
"moduleName": "Accordion",
@@ -11202,6 +11202,25 @@
"typedefs": [],
"rest_props": { "type": "Element", "name": "div" }
},
+ {
+ "moduleName": "TooltipFooter",
+ "filePath": "src/Tooltip/TooltipFooter.svelte",
+ "props": [
+ {
+ "name": "selectorPrimaryFocus",
+ "kind": "let",
+ "description": "Specify a selector to be focused inside the footer when opening the tooltip",
+ "type": "string",
+ "value": "\"a[href], button:not([disabled])\"",
+ "isFunction": false,
+ "constant": false,
+ "reactive": false
+ }
+ ],
+ "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }],
+ "events": [],
+ "typedefs": []
+ },
{
"moduleName": "TooltipIcon",
"filePath": "src/TooltipIcon/TooltipIcon.svelte",
diff --git a/docs/src/pages/components/Tooltip.svx b/docs/src/pages/components/Tooltip.svx
index 2ea0bbf9..b3c81d51 100644
--- a/docs/src/pages/components/Tooltip.svx
+++ b/docs/src/pages/components/Tooltip.svx
@@ -1,5 +1,5 @@
@@ -45,10 +45,10 @@ By default, the tooltip is triggered by an information icon.
Resources are provisioned based on your account's organization.
- + + ### Custom icon (component) diff --git a/src/Tooltip/Tooltip.svelte b/src/Tooltip/Tooltip.svelte index b659a2c1..fb65a140 100644 --- a/src/Tooltip/Tooltip.svelte +++ b/src/Tooltip/Tooltip.svelte @@ -63,10 +63,14 @@ /** Obtain a reference to the icon HTML element */ export let refIcon = null; - import { createEventDispatcher, afterUpdate } from "svelte"; + import { createEventDispatcher, afterUpdate, setContext } from "svelte"; + import { writable } from "svelte/store"; import Information16 from "carbon-icons-svelte/lib/Information16/Information16.svelte"; const dispatch = createEventDispatcher(); + const tooltipOpen = writable(open); + + setContext("Tooltip", { tooltipOpen }); function onKeydown(e) { if (e.key === "Escape") { @@ -143,6 +147,7 @@ } }); + $: tooltipOpen.set(open); $: dispatch(open ? "open" : "close"); $: buttonProps = { role: "button", diff --git a/src/Tooltip/TooltipFooter.svelte b/src/Tooltip/TooltipFooter.svelte new file mode 100644 index 00000000..946bbef3 --- /dev/null +++ b/src/Tooltip/TooltipFooter.svelte @@ -0,0 +1,29 @@ + + +