From ffb6ec035d9e0b6832955969fda81888fef23daf Mon Sep 17 00:00:00 2001 From: Abdoulaye NDOYE Date: Tue, 3 Sep 2024 12:41:22 +0000 Subject: [PATCH 1/3] fix: add missing props for `DateRangePicker` closes #650 --- .../components/date-range-picker.svelte | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 013c9bf00..f6b8ff557 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 value: $$Props["value"] = undefined; export let onValueChange: $$Props["onValueChange"] = undefined; export let placeholder: $$Props["placeholder"] = undefined; @@ -33,6 +35,7 @@ const { states: { + open: localOpen, value: localValue, placeholder: localPlaceholder, isInvalid: localIsInvalid, @@ -42,6 +45,7 @@ updateOption, ids, } = setCtx({ + defaultOpen: open, defaultValue: value, defaultPlaceholder: placeholder, preventDeselect, @@ -76,6 +80,13 @@ } return next; }, + onOpenChange: ({ next }) => { + if (open !== next) { + onOpenChange?.(next); + open = next; + } + return next; + }, }); const startFieldIds = derived( @@ -197,6 +208,7 @@ localValue.set(nextValue); } $: placeholder !== undefined && localPlaceholder.set(placeholder); + $: open !== undefined && localOpen.set(open); $: updateOption("disabled", disabled); $: updateOption("isDateUnavailable", isDateUnavailable); From 423453879715d2410eaf538698c1c8b2328a1087 Mon Sep 17 00:00:00 2001 From: Abdoulaye NDOYE Date: Tue, 3 Sep 2024 13:57:09 +0000 Subject: [PATCH 2/3] chore: prettier format --- .../bits/date-range-picker/components/date-range-picker.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f6b8ff557..a3174555f 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 @@ -45,7 +45,7 @@ updateOption, ids, } = setCtx({ - defaultOpen: open, + defaultOpen: open, defaultValue: value, defaultPlaceholder: placeholder, preventDeselect, From 8d405e2393902b7b32465fac6449f93cebeb898e Mon Sep 17 00:00:00 2001 From: Hunter Johnston <64506580+huntabyte@users.noreply.github.com> Date: Thu, 12 Sep 2024 09:52:15 -0400 Subject: [PATCH 3/3] add changeset --- .changeset/unlucky-lemons-pump.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/unlucky-lemons-pump.md 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