diff --git a/.changeset/calm-rabbits-smell.md b/.changeset/calm-rabbits-smell.md new file mode 100644 index 000000000..6a9eb8188 --- /dev/null +++ b/.changeset/calm-rabbits-smell.md @@ -0,0 +1,5 @@ +--- +"bits-ui": patch +--- + +Pass controlled `ids` as slot props to each `Component.Root` diff --git a/src/components/demos/popover-demo.svelte b/src/components/demos/popover-demo.svelte index b6a314c70..db7c29cef 100644 --- a/src/components/demos/popover-demo.svelte +++ b/src/components/demos/popover-demo.svelte @@ -3,14 +3,27 @@ import * as Label from "@/components/ui/label"; import * as Button from "@/components/ui/button"; import * as Input from "@/components/ui/input"; + import { tick } from "svelte"; + + let open = false; - + Open
+

Dimensions

Set the dimensions for the layer.

diff --git a/src/lib/bits/accordion/components/Accordion.svelte b/src/lib/bits/accordion/components/Accordion.svelte index cd561ac5e..366ac1c9d 100644 --- a/src/lib/bits/accordion/components/Accordion.svelte +++ b/src/lib/bits/accordion/components/Accordion.svelte @@ -15,7 +15,8 @@ const { elements: { root }, states: { value: localValue }, - updateOption + updateOption, + ids } = setCtx({ multiple, disabled, @@ -43,9 +44,9 @@ {#if asChild} - + {:else}
- +
{/if} diff --git a/src/lib/bits/alert-dialog/components/AlertDialog.svelte b/src/lib/bits/alert-dialog/components/AlertDialog.svelte index 264f5e83b..f74823796 100644 --- a/src/lib/bits/alert-dialog/components/AlertDialog.svelte +++ b/src/lib/bits/alert-dialog/components/AlertDialog.svelte @@ -22,7 +22,8 @@ const { states: { open: localOpen }, - updateOption + updateOption, + ids } = setCtx({ closeOnEscape, preventScroll, @@ -73,4 +74,4 @@ $: updateOption("forceVisible", forceVisible); - + diff --git a/src/lib/bits/dialog/components/Dialog.svelte b/src/lib/bits/dialog/components/Dialog.svelte index 66a1b63ba..efe6c6f8f 100644 --- a/src/lib/bits/dialog/components/Dialog.svelte +++ b/src/lib/bits/dialog/components/Dialog.svelte @@ -22,7 +22,8 @@ let timeout = 0; const { states: { open: localOpen }, - updateOption + updateOption, + ids } = setCtx({ closeOnEscape, preventScroll, @@ -80,4 +81,4 @@ $: updateOption("closeFocus", closeFocus); - + diff --git a/src/lib/bits/link-preview/components/LinkPreview.svelte b/src/lib/bits/link-preview/components/LinkPreview.svelte index 297b553bd..865f3a96c 100644 --- a/src/lib/bits/link-preview/components/LinkPreview.svelte +++ b/src/lib/bits/link-preview/components/LinkPreview.svelte @@ -15,7 +15,8 @@ const { states: { open: localOpen }, - updateOption + updateOption, + ids } = setCtx({ defaultOpen: open, positioning, @@ -44,4 +45,4 @@ $: updateOption("portal", portal); - + diff --git a/src/lib/bits/popover/components/Popover.svelte b/src/lib/bits/popover/components/Popover.svelte index 24a83ebad..658dcbfcf 100644 --- a/src/lib/bits/popover/components/Popover.svelte +++ b/src/lib/bits/popover/components/Popover.svelte @@ -1,8 +1,6 @@ - + diff --git a/src/lib/bits/popover/types.ts b/src/lib/bits/popover/types.ts index a013a2171..ee963c02e 100644 --- a/src/lib/bits/popover/types.ts +++ b/src/lib/bits/popover/types.ts @@ -15,14 +15,6 @@ type Props = Expand< OmitOpen & { open?: boolean; onOpenChange?: OnChangeFn; - /** - * Focus the trigger when `open` is programmatically set to false. - * This is in addition to the automatic focus that occurs when you - * don't programmatically set `open` to false. - * - * @default false; - */ - focusTriggerOnClose?: boolean; } >; diff --git a/src/lib/bits/select/components/Select.svelte b/src/lib/bits/select/components/Select.svelte index 10a1d4ed3..76673fdeb 100644 --- a/src/lib/bits/select/components/Select.svelte +++ b/src/lib/bits/select/components/Select.svelte @@ -23,7 +23,8 @@ const { states: { open: localOpen, selected: localSelected }, - updateOption + updateOption, + ids } = setCtx({ required, disabled, @@ -72,4 +73,4 @@ $: updateOption("forceVisible", forceVisible); - + diff --git a/src/lib/bits/slider/components/Slider.svelte b/src/lib/bits/slider/components/Slider.svelte index 9000e1a5c..5235e53ec 100644 --- a/src/lib/bits/slider/components/Slider.svelte +++ b/src/lib/bits/slider/components/Slider.svelte @@ -17,7 +17,8 @@ const { elements: { root }, states: { value: localValue }, - updateOption + updateOption, + ids } = setCtx({ disabled, min, @@ -46,9 +47,9 @@ {#if asChild} - + {:else} - + {/if} diff --git a/src/lib/bits/tooltip/components/Tooltip.svelte b/src/lib/bits/tooltip/components/Tooltip.svelte index 069d9b86b..27b22eb5a 100644 --- a/src/lib/bits/tooltip/components/Tooltip.svelte +++ b/src/lib/bits/tooltip/components/Tooltip.svelte @@ -18,7 +18,8 @@ const { states: { open: localOpen }, - updateOption + updateOption, + ids } = setCtx({ positioning, arrowSize, @@ -53,4 +54,4 @@ $: updateOption("disableHoverableContent", disableHoverableContent); - +