diff --git a/.changeset/unlucky-lemons-pump.md b/.changeset/unlucky-lemons-pump.md new file mode 100644 index 000000000..ae3a69cf1 --- /dev/null +++ b/.changeset/unlucky-lemons-pump.md @@ -0,0 +1,5 @@ +--- +"bits-ui": patch +--- + +fix(Date Range Picker): expose missing props diff --git a/packages/bits-ui/src/lib/bits/date-range-picker/components/date-range-picker.svelte b/packages/bits-ui/src/lib/bits/date-range-picker/components/date-range-picker.svelte index db0a5bd3e..f65cdfd1b 100644 --- a/packages/bits-ui/src/lib/bits/date-range-picker/components/date-range-picker.svelte +++ b/packages/bits-ui/src/lib/bits/date-range-picker/components/date-range-picker.svelte @@ -5,6 +5,8 @@ type $$Props = Props; + export let open: $$Props["open"] = undefined; + export let onOpenChange: $$Props["onOpenChange"] = undefined; export let portal: $$Props["portal"] = undefined; export let value: $$Props["value"] = undefined; export let onValueChange: $$Props["onValueChange"] = undefined; @@ -34,6 +36,7 @@ const { states: { + open: localOpen, value: localValue, placeholder: localPlaceholder, isInvalid: localIsInvalid, @@ -43,6 +46,7 @@ updateOption, ids, } = setCtx({ + defaultOpen: open, defaultValue: value, defaultPlaceholder: placeholder, preventDeselect, @@ -78,6 +82,13 @@ } return next; }, + onOpenChange: ({ next }) => { + if (open !== next) { + onOpenChange?.(next); + open = next; + } + return next; + }, }); const startFieldIds = derived( @@ -199,6 +210,7 @@ localValue.set(nextValue); } $: placeholder !== undefined && localPlaceholder.set(placeholder); + $: open !== undefined && localOpen.set(open); $: updateOption("disabled", disabled); $: updateOption("isDateUnavailable", isDateUnavailable);