bits-ui 1.0.0-next.76 → 1.0.0-next.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/bits/accordion/components/accordion.svelte +3 -9
  2. package/dist/bits/accordion/types.d.ts +0 -9
  3. package/dist/bits/alert-dialog/components/alert-dialog.svelte +3 -12
  4. package/dist/bits/button/components/button.svelte +13 -3
  5. package/dist/bits/button/types.d.ts +2 -0
  6. package/dist/bits/calendar/components/calendar.svelte +8 -31
  7. package/dist/bits/calendar/types.d.ts +0 -18
  8. package/dist/bits/checkbox/components/checkbox.svelte +4 -14
  9. package/dist/bits/checkbox/types.d.ts +0 -27
  10. package/dist/bits/collapsible/components/collapsible.svelte +2 -7
  11. package/dist/bits/collapsible/types.d.ts +0 -8
  12. package/dist/bits/combobox/components/combobox.svelte +6 -22
  13. package/dist/bits/command/components/command.svelte +2 -7
  14. package/dist/bits/command/types.d.ts +0 -8
  15. package/dist/bits/context-menu/components/context-menu.svelte +4 -13
  16. package/dist/bits/date-field/components/date-field.svelte +5 -19
  17. package/dist/bits/date-field/types.d.ts +2 -19
  18. package/dist/bits/date-picker/components/date-picker.svelte +8 -31
  19. package/dist/bits/date-picker/types.d.ts +0 -26
  20. package/dist/bits/date-range-field/components/date-range-field.svelte +7 -24
  21. package/dist/bits/date-range-field/types.d.ts +3 -20
  22. package/dist/bits/date-range-picker/components/date-range-picker.svelte +10 -36
  23. package/dist/bits/date-range-picker/types.d.ts +0 -26
  24. package/dist/bits/dialog/components/dialog.svelte +3 -12
  25. package/dist/bits/dialog/dialog.svelte.d.ts +5 -3
  26. package/dist/bits/dialog/dialog.svelte.js +11 -6
  27. package/dist/bits/dialog/types.d.ts +0 -8
  28. package/dist/bits/link-preview/components/link-preview.svelte +2 -7
  29. package/dist/bits/link-preview/types.d.ts +0 -8
  30. package/dist/bits/menu/components/menu-checkbox-item.svelte +4 -14
  31. package/dist/bits/menu/components/menu-radio-group.svelte +2 -7
  32. package/dist/bits/menu/components/menu-sub.svelte +3 -12
  33. package/dist/bits/menu/components/menu.svelte +4 -13
  34. package/dist/bits/menu/components/menu.svelte.d.ts +0 -1
  35. package/dist/bits/menu/types.d.ts +0 -42
  36. package/dist/bits/menubar/components/menubar.svelte +2 -7
  37. package/dist/bits/menubar/types.d.ts +0 -8
  38. package/dist/bits/navigation-menu/components/navigation-menu.svelte +2 -7
  39. package/dist/bits/navigation-menu/types.d.ts +0 -6
  40. package/dist/bits/pagination/components/pagination.svelte +2 -7
  41. package/dist/bits/pagination/types.d.ts +0 -8
  42. package/dist/bits/pin-input/components/pin-input.svelte +2 -7
  43. package/dist/bits/pin-input/types.d.ts +0 -9
  44. package/dist/bits/popover/components/popover.svelte +3 -12
  45. package/dist/bits/popover/types.d.ts +0 -8
  46. package/dist/bits/radio-group/components/radio-group.svelte +2 -7
  47. package/dist/bits/radio-group/types.d.ts +0 -8
  48. package/dist/bits/range-calendar/components/range-calendar.svelte +6 -25
  49. package/dist/bits/range-calendar/types.d.ts +0 -17
  50. package/dist/bits/select/components/select.svelte +10 -25
  51. package/dist/bits/select/types.d.ts +0 -16
  52. package/dist/bits/slider/components/slider.svelte +3 -9
  53. package/dist/bits/slider/types.d.ts +0 -9
  54. package/dist/bits/switch/components/switch.svelte +2 -7
  55. package/dist/bits/switch/types.d.ts +0 -9
  56. package/dist/bits/tabs/components/tabs.svelte +2 -7
  57. package/dist/bits/tabs/types.d.ts +0 -8
  58. package/dist/bits/toggle/components/toggle.svelte +2 -7
  59. package/dist/bits/toggle/types.d.ts +0 -9
  60. package/dist/bits/toggle-group/components/toggle-group.svelte +5 -15
  61. package/dist/bits/toggle-group/types.d.ts +0 -8
  62. package/dist/bits/toolbar/components/toolbar-group.svelte +4 -15
  63. package/dist/bits/tooltip/components/tooltip.svelte +2 -7
  64. package/dist/bits/tooltip/types.d.ts +0 -8
  65. package/package.json +1 -1
@@ -16,7 +16,6 @@
16
16
  onValueChange = noop,
17
17
  loop = true,
18
18
  orientation = "vertical",
19
- controlledValue = false,
20
19
  ...restProps
21
20
  }: AccordionRootProps = $props();
22
21
 
@@ -27,14 +26,9 @@
27
26
  value: box.with(
28
27
  () => value!,
29
28
  (v) => {
30
- if (controlledValue) {
31
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
- onValueChange(v as any);
33
- } else {
34
- value = v;
35
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
- onValueChange(v as any);
37
- }
29
+ value = v;
30
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+ onValueChange(v as any);
38
32
  }
39
33
  ) as WritableBox<string> | WritableBox<string[]>,
40
34
  id: box.with(() => id),
@@ -21,15 +21,6 @@ export type BaseAccordionRootPropsWithoutHTML = {
21
21
  * @defaultValue "vertical"
22
22
  */
23
23
  orientation?: Orientation;
24
- /**
25
- * Whether the value of the accordion is controlled or not.
26
- * If `true`, the accordion will not update the value internally, instead
27
- * it will call `onValueChange` when it would have otherwise, and it is up to you
28
- * to update the `value` prop.
29
- *
30
- * @defaultValue false
31
- */
32
- controlledValue?: boolean;
33
24
  };
34
25
  export type AccordionRootSinglePropsWithoutHTML = BaseAccordionRootPropsWithoutHTML & {
35
26
  /**
@@ -4,24 +4,15 @@
4
4
  import { noop } from "../../../internal/noop.js";
5
5
  import { useDialogRoot } from "../../dialog/dialog.svelte.js";
6
6
 
7
- let {
8
- open = $bindable(false),
9
- onOpenChange = noop,
10
- controlledOpen = false,
11
- children,
12
- }: AlertDialogRootProps = $props();
7
+ let { open = $bindable(false), onOpenChange = noop, children }: AlertDialogRootProps = $props();
13
8
 
14
9
  useDialogRoot({
15
10
  variant: box.with(() => "alert-dialog"),
16
11
  open: box.with(
17
12
  () => open,
18
13
  (v) => {
19
- if (controlledOpen) {
20
- onOpenChange(v);
21
- } else {
22
- open = v;
23
- onOpenChange(v);
24
- }
14
+ open = v;
15
+ onOpenChange(v);
25
16
  }
26
17
  ),
27
18
  });
@@ -1,14 +1,24 @@
1
1
  <script lang="ts">
2
2
  import type { ButtonRootProps } from "../types.js";
3
3
 
4
- let { href, type, children, ref = $bindable(), ...restProps }: ButtonRootProps = $props();
4
+ let {
5
+ href,
6
+ type,
7
+ children,
8
+ disabled = false,
9
+ ref = $bindable(),
10
+ ...restProps
11
+ }: ButtonRootProps = $props();
5
12
  </script>
6
13
 
7
14
  <svelte:element
8
15
  this={href ? "a" : "button"}
9
16
  type={href ? undefined : type}
10
- {href}
11
- tabindex="0"
17
+ href={href && !disabled ? href : undefined}
18
+ disabled={href ? undefined : disabled}
19
+ aria-disabled={href ? disabled : undefined}
20
+ role={href && disabled ? "link" : undefined}
21
+ tabindex={href && disabled ? -1 : 0}
12
22
  bind:this={ref}
13
23
  {...restProps}
14
24
  >
@@ -7,10 +7,12 @@ export type ButtonRootPropsWithoutHTML = WithChildren<{
7
7
  type AnchorElement = ButtonRootPropsWithoutHTML & WithoutChildren<Omit<HTMLAnchorAttributes, "href" | "type">> & {
8
8
  href: HTMLAnchorAttributes["href"];
9
9
  type?: never;
10
+ disabled?: HTMLButtonAttributes["disabled"];
10
11
  };
11
12
  type ButtonElement = ButtonRootPropsWithoutHTML & WithoutChildren<Omit<HTMLButtonAttributes, "type" | "href">> & {
12
13
  type?: HTMLButtonAttributes["type"];
13
14
  href?: never;
15
+ disabled?: HTMLButtonAttributes["disabled"];
14
16
  };
15
17
  export type ButtonRootProps = AnchorElement | ButtonElement;
16
18
  export {};
@@ -33,8 +33,6 @@
33
33
  type,
34
34
  disableDaysOutsideMonth = true,
35
35
  initialFocus = false,
36
- controlledValue = false,
37
- controlledPlaceholder = false,
38
36
  ...restProps
39
37
  }: CalendarRootProps = $props();
40
38
 
@@ -43,27 +41,15 @@
43
41
  defaultPlaceholder: undefined,
44
42
  defaultValue: value,
45
43
  });
46
-
47
- if (controlledPlaceholder) {
48
- onPlaceholderChange(defaultPlaceholder);
49
- } else {
50
- placeholder = defaultPlaceholder;
51
- }
44
+ placeholder = defaultPlaceholder;
52
45
  }
53
46
 
54
47
  if (value === undefined) {
55
48
  const defaultValue = type === "single" ? "" : [];
56
- if (controlledValue) {
57
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
- onValueChange(defaultValue as any);
59
- } else {
60
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
- value = defaultValue as any;
62
- }
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
+ value = defaultValue as any;
63
51
  }
64
52
 
65
- value === undefined && (value = type === "single" ? undefined : []);
66
-
67
53
  const rootState = useCalendarRoot({
68
54
  id: box.with(() => id),
69
55
  ref: box.with(
@@ -88,26 +74,17 @@
88
74
  placeholder: box.with(
89
75
  () => placeholder as DateValue,
90
76
  (v) => {
91
- if (controlledPlaceholder) {
92
- onPlaceholderChange(v as DateValue);
93
- } else {
94
- placeholder = v;
95
- onPlaceholderChange(v as DateValue);
96
- }
77
+ placeholder = v;
78
+ onPlaceholderChange(v as DateValue);
97
79
  }
98
80
  ),
99
81
  preventDeselect: box.with(() => preventDeselect),
100
82
  value: box.with(
101
83
  () => value,
102
84
  (v) => {
103
- if (controlledValue) {
104
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
105
- onValueChange(v as any);
106
- } else {
107
- value = v;
108
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
109
- onValueChange(v as any);
110
- }
85
+ value = v;
86
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
87
+ onValueChange(v as any);
111
88
  }
112
89
  ),
113
90
  type: box.with(() => type),
@@ -159,24 +159,6 @@ type CalendarBaseRootPropsWithoutHTML = {
159
159
  * @defaultValue false
160
160
  */
161
161
  disableDaysOutsideMonth?: boolean;
162
- /**
163
- * Whether or not the calendar is controlled or not. If `true`, the calendar will not update
164
- * the value internally, instead it will call `onValueChange` when it would have otherwise,
165
- * and it is up to you to update the `value` prop that is passed to the `Calendar.Root`
166
- * component.
167
- *
168
- * @defaultValue false
169
- */
170
- controlledValue?: boolean;
171
- /**
172
- * Whether or not the calendar placeholder is controlled or not. If `true`, the calendar will
173
- * not update the placeholder internally, instead it will call `onPlaceholderChange` when it
174
- * would have otherwise, and it is up to you to update the `placeholder` prop that is passed to the
175
- * component.
176
- *
177
- * @defaultValue false
178
- */
179
- controlledPlaceholder?: boolean;
180
162
  };
181
163
  export type CalendarSingleRootPropsWithoutHTML = {
182
164
  /**
@@ -15,9 +15,7 @@
15
15
  name = undefined,
16
16
  value = "on",
17
17
  id = useId(),
18
- controlledChecked = false,
19
18
  indeterminate = $bindable(false),
20
- controlledIndeterminate = false,
21
19
  onIndeterminateChange,
22
20
  child,
23
21
  type = "button",
@@ -28,12 +26,8 @@
28
26
  checked: box.with(
29
27
  () => checked,
30
28
  (v) => {
31
- if (controlledChecked) {
32
- onCheckedChange?.(v);
33
- } else {
34
- checked = v;
35
- onCheckedChange?.(v);
36
- }
29
+ checked = v;
30
+ onCheckedChange?.(v);
37
31
  }
38
32
  ),
39
33
  disabled: box.with(() => disabled ?? false),
@@ -48,12 +42,8 @@
48
42
  indeterminate: box.with(
49
43
  () => indeterminate,
50
44
  (v) => {
51
- if (controlledIndeterminate) {
52
- onIndeterminateChange?.(v);
53
- } else {
54
- indeterminate = v;
55
- onIndeterminateChange?.(v);
56
- }
45
+ indeterminate = v;
46
+ onIndeterminateChange?.(v);
57
47
  }
58
48
  ),
59
49
  type: box.with(() => type),
@@ -44,15 +44,6 @@ export type CheckboxRootPropsWithoutHTML = WithChild<{
44
44
  * A callback function called when the checked state changes.
45
45
  */
46
46
  onCheckedChange?: OnChangeFn<boolean>;
47
- /**
48
- * Whether or not the checkbox is controlled or not. If `true`, the checkbox will not update
49
- * the checked state internally, instead it will call `onCheckedChange` when it would have
50
- * otherwise, and it is up to you to update the `checked` prop that is passed to the
51
- * component.
52
- *
53
- * @defaultValue false
54
- */
55
- controlledChecked?: boolean;
56
47
  /**
57
48
  * Whether the checkbox is in an indeterminate state or not.
58
49
  *
@@ -63,15 +54,6 @@ export type CheckboxRootPropsWithoutHTML = WithChild<{
63
54
  * A callback function called when the indeterminate state changes.
64
55
  */
65
56
  onIndeterminateChange?: OnChangeFn<boolean>;
66
- /**
67
- * Whether the indeterminate state is controlled or not. If `true`, the checkbox will
68
- * not update the indeterminate state internally, instead it will call
69
- * `onIndeterminateChange` when it would have otherwise, and it is up to you to update
70
- * the `indeterminate` prop that is passed to the component.
71
- *
72
- * @defaultValue false
73
- */
74
- controlledIndeterminate?: boolean;
75
57
  }, CheckboxRootSnippetProps>;
76
58
  export type CheckboxRootProps = CheckboxRootPropsWithoutHTML & Without<BitsPrimitiveButtonAttributes, CheckboxRootPropsWithoutHTML>;
77
59
  export type CheckboxGroupPropsWithoutHTML = WithChild<{
@@ -109,15 +91,6 @@ export type CheckboxGroupPropsWithoutHTML = WithChild<{
109
91
  * A callback function called when the value changes.
110
92
  */
111
93
  onValueChange?: OnChangeFn<string[]>;
112
- /**
113
- * Whether or not the checkbox group value is controlled or not. If `true`, the
114
- * checkbox group will not update the value internally, instead it will call
115
- * `onValueChange` when it would have otherwise, and it is up to you to update
116
- * the `value` prop that is passed to the component.
117
- *
118
- * @defaultValue false
119
- */
120
- controlledValue?: boolean;
121
94
  }>;
122
95
  export type CheckboxGroupProps = CheckboxGroupPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, CheckboxGroupPropsWithoutHTML>;
123
96
  export type CheckboxGroupLabelPropsWithoutHTML = WithChild;
@@ -12,7 +12,6 @@
12
12
  ref = $bindable(null),
13
13
  open = $bindable(false),
14
14
  disabled = false,
15
- controlledOpen = false,
16
15
  onOpenChange = noop,
17
16
  ...restProps
18
17
  }: CollapsibleRootProps = $props();
@@ -21,12 +20,8 @@
21
20
  open: box.with(
22
21
  () => open,
23
22
  (v) => {
24
- if (controlledOpen) {
25
- onOpenChange(v);
26
- } else {
27
- open = v;
28
- onOpenChange(v);
29
- }
23
+ open = v;
24
+ onOpenChange(v);
30
25
  }
31
26
  ),
32
27
  disabled: box.with(() => disabled),
@@ -17,14 +17,6 @@ export type CollapsibleRootPropsWithoutHTML = WithChild<{
17
17
  * A callback function called when the open state changes.
18
18
  */
19
19
  onOpenChange?: OnChangeFn<boolean>;
20
- /**
21
- * Whether or not the collapsible is controlled or not. If `true`, the collapsible will not
22
- * update the open state internally, instead it will call `onOpenChange` when it would have
23
- * otherwise, and it is up to you to update the `value` prop that is passed to the component.
24
- *
25
- * @defaultValue false
26
- */
27
- controlledOpen?: boolean;
28
20
  }>;
29
21
  export type CollapsibleRootProps = CollapsibleRootPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, CollapsibleRootPropsWithoutHTML>;
30
22
  export type CollapsibleContentSnippetProps = {
@@ -17,8 +17,6 @@
17
17
  loop = false,
18
18
  scrollAlignment = "nearest",
19
19
  required = false,
20
- controlledOpen = false,
21
- controlledValue = false,
22
20
  items = [],
23
21
  allowDeselect = true,
24
22
  children,
@@ -26,12 +24,7 @@
26
24
 
27
25
  if (value === undefined) {
28
26
  const defaultValue = type === "single" ? "" : [];
29
- if (controlledValue) {
30
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
- onValueChange(defaultValue as any);
32
- } else {
33
- value = defaultValue;
34
- }
27
+ value = defaultValue;
35
28
  }
36
29
 
37
30
  const rootState = useSelectRoot({
@@ -39,14 +32,9 @@
39
32
  value: box.with(
40
33
  () => value!,
41
34
  (v) => {
42
- if (controlledValue) {
43
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
- onValueChange(v as any);
45
- } else {
46
- value = v;
47
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
- onValueChange(v as any);
49
- }
35
+ value = v;
36
+ // @ts-expect-error - we know
37
+ onValueChange(v);
50
38
  }
51
39
  ) as WritableBox<string> | WritableBox<string[]>,
52
40
  disabled: box.with(() => disabled),
@@ -54,12 +42,8 @@
54
42
  open: box.with(
55
43
  () => open,
56
44
  (v) => {
57
- if (controlledOpen) {
58
- onOpenChange(v);
59
- } else {
60
- open = v;
61
- onOpenChange(v);
62
- }
45
+ open = v;
46
+ onOpenChange(v);
63
47
  }
64
48
  ),
65
49
  loop: box.with(() => loop),
@@ -18,7 +18,6 @@
18
18
  label = "",
19
19
  vimBindings = true,
20
20
  disablePointerSelection = false,
21
- controlledValue = false,
22
21
  children,
23
22
  child,
24
23
  ...restProps
@@ -36,12 +35,8 @@
36
35
  value: box.with(
37
36
  () => value,
38
37
  (v) => {
39
- if (controlledValue) {
40
- onValueChange(v);
41
- } else {
42
- value = v;
43
- onValueChange(v);
44
- }
38
+ value = v;
39
+ onValueChange(v);
45
40
  }
46
41
  ),
47
42
  vimBindings: box.with(() => vimBindings),
@@ -63,14 +63,6 @@ export type CommandRootPropsWithoutHTML = WithChild<{
63
63
  * @defaultValue true
64
64
  */
65
65
  vimBindings?: boolean;
66
- /**
67
- * Whether or not the command is controlled or not. If `true`, the command will not update
68
- * the value state internally, instead it will call `onValueChange` when it would have
69
- * otherwise, and it is up to you to update the `value` prop that is passed to the component.
70
- *
71
- * @defaultValue false
72
- */
73
- controlledValue?: boolean;
74
66
  }>;
75
67
  export type CommandRootProps = CommandRootPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, CommandRootPropsWithoutHTML>;
76
68
  export type CommandEmptyPropsWithoutHTML = WithChild<{
@@ -9,7 +9,6 @@
9
9
  open = $bindable(false),
10
10
  dir = "ltr",
11
11
  onOpenChange = noop,
12
- controlledOpen = false,
13
12
  children,
14
13
  }: ContextMenuRootProps = $props();
15
14
 
@@ -17,12 +16,8 @@
17
16
  variant: box.with(() => "context-menu"),
18
17
  dir: box.with(() => dir),
19
18
  onClose: () => {
20
- if (controlledOpen) {
21
- onOpenChange(false);
22
- } else {
23
- open = false;
24
- onOpenChange?.(false);
25
- }
19
+ open = false;
20
+ onOpenChange?.(false);
26
21
  },
27
22
  });
28
23
 
@@ -30,12 +25,8 @@
30
25
  open: box.with(
31
26
  () => open,
32
27
  (v) => {
33
- if (controlledOpen) {
34
- onOpenChange(v);
35
- } else {
36
- open = v;
37
- onOpenChange(v);
38
- }
28
+ open = v;
29
+ onOpenChange(v);
39
30
  }
40
31
  ),
41
32
  });
@@ -23,8 +23,6 @@
23
23
  readonly = false,
24
24
  readonlySegments = [],
25
25
  required = false,
26
- controlledPlaceholder = false,
27
- controlledValue = false,
28
26
  errorMessageId,
29
27
  children,
30
28
  }: DateFieldRootProps = $props();
@@ -36,34 +34,22 @@
36
34
  defaultValue: value,
37
35
  });
38
36
 
39
- if (controlledPlaceholder) {
40
- onPlaceholderChange(defaultPlaceholder);
41
- } else {
42
- placeholder = defaultPlaceholder;
43
- }
37
+ placeholder = defaultPlaceholder;
44
38
  }
45
39
 
46
40
  useDateFieldRoot({
47
41
  value: box.with(
48
42
  () => value,
49
43
  (v) => {
50
- if (controlledValue) {
51
- onValueChange(v);
52
- } else {
53
- value = v;
54
- onValueChange(v);
55
- }
44
+ value = v;
45
+ onValueChange(v);
56
46
  }
57
47
  ),
58
48
  placeholder: box.with(
59
49
  () => placeholder as DateValue,
60
50
  (v) => {
61
- if (controlledPlaceholder) {
62
- onPlaceholderChange(v);
63
- } else {
64
- placeholder = v;
65
- onPlaceholderChange(v);
66
- }
51
+ placeholder = v;
52
+ onPlaceholderChange(v);
67
53
  }
68
54
  ),
69
55
  disabled: box.with(() => disabled),
@@ -9,7 +9,7 @@ export type DateFieldRootPropsWithoutHTML = WithChildren<{
9
9
  *
10
10
  * @bindable
11
11
  */
12
- value?: DateValue | undefined;
12
+ value?: DateValue;
13
13
  /**
14
14
  * A callback that is called when the date field value changes.
15
15
  *
@@ -21,7 +21,7 @@ export type DateFieldRootPropsWithoutHTML = WithChildren<{
21
21
  *
22
22
  * @bindable
23
23
  */
24
- placeholder?: DateValue | undefined;
24
+ placeholder?: DateValue;
25
25
  /**
26
26
  * A callback that is called when the date field's placeholder value changes.
27
27
  */
@@ -110,23 +110,6 @@ export type DateFieldRootPropsWithoutHTML = WithChildren<{
110
110
  * @defaultValue false
111
111
  */
112
112
  required?: boolean;
113
- /**
114
- * Whether or not the value is controlled or not. If `true`, the component will not update
115
- * the value state internally, instead it will call `onValueChange` when it would have
116
- * otherwise, and it is up to you to update the `value` prop that is passed to the component.
117
- *
118
- * @defaultValue false
119
- */
120
- controlledValue?: boolean;
121
- /**
122
- * Whether or not the placeholder is controlled or not. If `true`, the component will not update
123
- * the placeholder state internally, instead it will call `onPlaceholderChange` when it would
124
- * have otherwise, and it is up to you to update the `value` prop that is passed to the
125
- * component.
126
- *
127
- * @defaultValue false
128
- */
129
- controlledPlaceholder?: boolean;
130
113
  /**
131
114
  * The `id` of the element which contains the error messages for the date field when the
132
115
  * date is invalid.
@@ -41,9 +41,6 @@
41
41
  numberOfMonths = 1,
42
42
  closeOnDateSelect = true,
43
43
  initialFocus = false,
44
- controlledPlaceholder = false,
45
- controlledValue = false,
46
- controlledOpen = false,
47
44
  errorMessageId,
48
45
  children,
49
46
  }: DatePickerRootProps = $props();
@@ -55,20 +52,12 @@
55
52
  defaultValue: value,
56
53
  });
57
54
 
58
- if (controlledPlaceholder) {
59
- onPlaceholderChange(defaultPlaceholder);
60
- } else {
61
- placeholder = defaultPlaceholder;
62
- }
55
+ placeholder = defaultPlaceholder;
63
56
  }
64
57
 
65
58
  function onDateSelect() {
66
59
  if (closeOnDateSelect) {
67
- if (controlledOpen) {
68
- onOpenChange(false);
69
- } else {
70
- open = false;
71
- }
60
+ open = false;
72
61
  }
73
62
  }
74
63
 
@@ -76,34 +65,22 @@
76
65
  open: box.with(
77
66
  () => open,
78
67
  (v) => {
79
- if (controlledOpen) {
80
- onOpenChange(v);
81
- } else {
82
- open = v;
83
- onOpenChange(v);
84
- }
68
+ open = v;
69
+ onOpenChange(v);
85
70
  }
86
71
  ),
87
72
  value: box.with(
88
73
  () => value,
89
74
  (v) => {
90
- if (controlledValue) {
91
- onValueChange(v);
92
- } else {
93
- value = v;
94
- onValueChange(v);
95
- }
75
+ value = v;
76
+ onValueChange(v);
96
77
  }
97
78
  ),
98
79
  placeholder: box.with(
99
80
  () => placeholder as DateValue,
100
81
  (v) => {
101
- if (controlledPlaceholder) {
102
- onPlaceholderChange(v as DateValue);
103
- } else {
104
- placeholder = v;
105
- onPlaceholderChange(v as DateValue);
106
- }
82
+ placeholder = v;
83
+ onPlaceholderChange(v as DateValue);
107
84
  }
108
85
  ),
109
86
  isDateUnavailable: box.with(() => isDateUnavailable),
@@ -220,32 +220,6 @@ export type DatePickerRootPropsWithoutHTML = WithChildren<{
220
220
  * Whether to focus a date when the picker is first opened.
221
221
  */
222
222
  initialFocus?: boolean;
223
- /**
224
- * Whether or not the value is controlled or not. If `true`, the component will not update
225
- * the value state internally, instead it will call `onValueChange` when it would have
226
- * otherwise, and it is up to you to update the `value` prop that is passed to the component.
227
- *
228
- * @defaultValue false
229
- */
230
- controlledValue?: boolean;
231
- /**
232
- * Whether or not the placeholder is controlled or not. If `true`, the component will not update
233
- * the placeholder state internally, instead it will call `onPlaceholderChange` when it would
234
- * have otherwise, and it is up to you to update the `placeholder` prop that is passed to the
235
- * component.
236
- *
237
- * @defaultValue false
238
- */
239
- controlledPlaceholder?: boolean;
240
- /**
241
- * Whether or not the open state is controlled or not. If `true`, the component will not update
242
- * the open state internally, instead it will call `onOpenChange` when it would
243
- * have otherwise, and it is up to you to update the `open` prop that is passed to the
244
- * component.
245
- *
246
- * @defaultValue false
247
- */
248
- controlledOpen?: boolean;
249
223
  /**
250
224
  * The `id` of the element which contains the error messages for the date field when the
251
225
  * date is invalid.