bits-ui 0.11.3 → 0.11.5

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 (47) hide show
  1. package/dist/bits/accordion/components/accordion.svelte +9 -1
  2. package/dist/bits/calendar/components/calendar-day.svelte +7 -8
  3. package/dist/bits/calendar/components/calendar-heading.svelte +2 -7
  4. package/dist/bits/calendar/components/calendar.svelte +16 -9
  5. package/dist/bits/calendar/components/calendar.svelte.d.ts +4 -2
  6. package/dist/bits/checkbox/components/checkbox-indicator.svelte +2 -8
  7. package/dist/bits/checkbox/components/checkbox-indicator.svelte.d.ts +2 -2
  8. package/dist/bits/date-field/components/date-field-input.svelte +2 -7
  9. package/dist/bits/date-field/components/date-field.svelte +1 -6
  10. package/dist/bits/date-picker/components/date-picker-calendar.svelte +5 -8
  11. package/dist/bits/date-picker/components/date-picker-calendar.svelte.d.ts +3 -1
  12. package/dist/bits/date-picker/components/date-picker-day.svelte +7 -8
  13. package/dist/bits/date-picker/components/date-picker-field.svelte +1 -6
  14. package/dist/bits/date-picker/components/date-picker-field.svelte.d.ts +1 -1
  15. package/dist/bits/date-picker/components/date-picker-heading.svelte +2 -7
  16. package/dist/bits/date-picker/components/date-picker-input.svelte +2 -7
  17. package/dist/bits/date-picker/components/date-picker-input.svelte.d.ts +0 -16
  18. package/dist/bits/date-picker/components/date-picker.svelte +4 -5
  19. package/dist/bits/date-picker/components/date-picker.svelte.d.ts +1 -1
  20. package/dist/bits/date-range-field/components/date-range-field-input.svelte +5 -8
  21. package/dist/bits/date-range-field/components/date-range-field.svelte +5 -8
  22. package/dist/bits/date-range-picker/components/date-range-picker-calendar.svelte +5 -8
  23. package/dist/bits/date-range-picker/components/date-range-picker-calendar.svelte.d.ts +3 -1
  24. package/dist/bits/date-range-picker/components/date-range-picker-day.svelte +5 -7
  25. package/dist/bits/date-range-picker/components/date-range-picker-field.svelte +1 -5
  26. package/dist/bits/date-range-picker/components/date-range-picker-heading.svelte +2 -7
  27. package/dist/bits/date-range-picker/components/date-range-picker-input.svelte +2 -7
  28. package/dist/bits/date-range-picker/components/date-range-picker.svelte +9 -7
  29. package/dist/bits/date-range-picker/components/date-range-picker.svelte.d.ts +1 -1
  30. package/dist/bits/menu/components/menu-checkbox-indicator.svelte +2 -7
  31. package/dist/bits/menu/components/menu-radio-indicator.svelte +4 -7
  32. package/dist/bits/menu/components/menu-radio-indicator.svelte.d.ts +1 -1
  33. package/dist/bits/menubar/components/menubar.svelte +2 -7
  34. package/dist/bits/radio-group/components/radio-group-item-indicator.svelte +4 -7
  35. package/dist/bits/range-calendar/components/range-calendar-day.svelte +5 -7
  36. package/dist/bits/range-calendar/components/range-calendar-heading.svelte +2 -7
  37. package/dist/bits/range-calendar/components/range-calendar.svelte +21 -10
  38. package/dist/bits/range-calendar/components/range-calendar.svelte.d.ts +5 -3
  39. package/dist/bits/select/components/select-item-indicator.svelte +2 -7
  40. package/dist/bits/select/components/select-item-indicator.svelte.d.ts +1 -1
  41. package/dist/bits/select/components/select-value.svelte +1 -3
  42. package/dist/bits/slider/components/slider.svelte +2 -4
  43. package/dist/bits/switch/components/switch-thumb.svelte +1 -3
  44. package/dist/bits/switch/components/switch-thumb.svelte.d.ts +1 -1
  45. package/dist/bits/tabs/components/tabs.svelte +2 -7
  46. package/dist/bits/toggle-group/components/toggle-group.svelte +5 -3
  47. package/package.json +1 -1
@@ -14,6 +14,13 @@ const {
14
14
  disabled,
15
15
  defaultValue: value,
16
16
  onValueChange: ({ next }) => {
17
+ if (Array.isArray(next)) {
18
+ if (JSON.stringify(next) !== JSON.stringify(value)) {
19
+ onValueChange?.(next);
20
+ value = next;
21
+ }
22
+ return next;
23
+ }
17
24
  if (value !== next) {
18
25
  onValueChange?.(next);
19
26
  value = next;
@@ -23,7 +30,8 @@ const {
23
30
  });
24
31
  const attrs = getAttrs("root");
25
32
  $:
26
- localValue.set(value);
33
+ value !== void 0 && // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ localValue.set(Array.isArray(value) ? [...value] : value);
27
35
  $:
28
36
  updateOption("multiple", multiple);
29
37
  $:
@@ -15,19 +15,18 @@ $:
15
15
  $:
16
16
  Object.assign(builder, attrs);
17
17
  $:
18
- slotProps = {
19
- builder,
20
- disabled: $isDateDisabled(date),
21
- unavailable: $isDateUnavailable(date),
22
- selected: $isDateSelected(date)
23
- };
18
+ disabled = $isDateDisabled(date);
19
+ $:
20
+ unavailable = $isDateUnavailable(date);
21
+ $:
22
+ selected = $isDateSelected(date);
24
23
  </script>
25
24
 
26
25
  {#if asChild}
27
- <slot {...slotProps} />
26
+ <slot {builder} {disabled} {unavailable} {selected} />
28
27
  {:else}
29
28
  <div {...builder} use:builder.action {...$$restProps} on:m-click={dispatch}>
30
- <slot {...slotProps}>
29
+ <slot {builder} {disabled} {unavailable} {selected}>
31
30
  {date.day}
32
31
  </slot>
33
32
  </div>
@@ -10,18 +10,13 @@ $:
10
10
  builder = $heading;
11
11
  $:
12
12
  Object.assign(builder, attrs);
13
- $:
14
- slotProps = {
15
- builder,
16
- headingValue: $headingValue
17
- };
18
13
  </script>
19
14
 
20
15
  {#if asChild}
21
- <slot {...slotProps} />
16
+ <slot {builder} headingValue={$headingValue} />
22
17
  {:else}
23
18
  <div {...builder} use:builder.action {...$$restProps}>
24
- <slot {...slotProps}>
19
+ <slot {builder} headingValue={$headingValue}>
25
20
  {$headingValue}
26
21
  </slot>
27
22
  </div>
@@ -36,7 +36,7 @@ const {
36
36
  states: {
37
37
  value: localValue,
38
38
  placeholder: localPlaceholder,
39
- months,
39
+ months: localMonths,
40
40
  weekdays
41
41
  },
42
42
  updateOption,
@@ -67,6 +67,13 @@ const {
67
67
  return next;
68
68
  },
69
69
  onValueChange: ({ next }) => {
70
+ if (Array.isArray(next)) {
71
+ if (JSON.stringify(next) !== JSON.stringify(value)) {
72
+ onValueChange?.(next);
73
+ value = next;
74
+ }
75
+ return next;
76
+ }
70
77
  if (value !== next) {
71
78
  onValueChange?.(next);
72
79
  value = next;
@@ -79,7 +86,10 @@ $:
79
86
  ids.calendar.set(id);
80
87
  }
81
88
  $:
82
- value !== void 0 && localValue.set(value);
89
+ value !== void 0 && localValue.set(
90
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
91
+ Array.isArray(value) ? [...value] : value
92
+ );
83
93
  $:
84
94
  placeholder !== void 0 && localPlaceholder.set(placeholder);
85
95
  $:
@@ -116,16 +126,13 @@ $:
116
126
  $:
117
127
  Object.assign(builder, attrs);
118
128
  const dispatch = createDispatcher();
129
+ let months = $localMonths;
119
130
  $:
120
- slotProps = {
121
- builder,
122
- months: $months,
123
- weekdays: $weekdays
124
- };
131
+ months = $localMonths;
125
132
  </script>
126
133
 
127
134
  {#if asChild}
128
- <slot {...slotProps} />
135
+ <slot {months} weekdays={$weekdays} {builder} />
129
136
  {:else}
130
137
  <div
131
138
  {...builder} use:builder.action
@@ -133,6 +140,6 @@ $:
133
140
  on:m-keydown={dispatch}
134
141
  bind:this={el}
135
142
  >
136
- <slot {...slotProps} />
143
+ <slot {months} weekdays={$weekdays} {builder} />
137
144
  </div>
138
145
  {/if}
@@ -1,4 +1,6 @@
1
1
  import { SvelteComponent } from "svelte";
2
+ import type { DateValue } from "@internationalized/date";
3
+ import { type Month } from "@melt-ui/svelte";
2
4
  import type { Props } from "../types.js";
3
5
  declare class __sveltets_Render<Multiple extends boolean> {
4
6
  props(): Props<Multiple>;
@@ -7,6 +9,8 @@ declare class __sveltets_Render<Multiple extends boolean> {
7
9
  };
8
10
  slots(): {
9
11
  default: {
12
+ months: Month<DateValue>[];
13
+ weekdays: string[];
10
14
  builder: {
11
15
  id: string;
12
16
  role: string;
@@ -19,8 +23,6 @@ declare class __sveltets_Render<Multiple extends boolean> {
19
23
  } & {
20
24
  action: (node: HTMLElement) => import("@melt-ui/svelte/internal/types").MeltActionReturn<"keydown">;
21
25
  };
22
- months: import("@melt-ui/svelte/index.js").Month<import("@internationalized/date").DateValue>[];
23
- weekdays: string[];
24
26
  };
25
27
  };
26
28
  }
@@ -16,18 +16,12 @@ $:
16
16
  ...getAttrs("indicator"),
17
17
  "data-state": getStateAttr($checked)
18
18
  };
19
- $:
20
- slotProps = {
21
- isChecked: $isChecked,
22
- isIndeterminate: $isIndeterminate,
23
- attrs
24
- };
25
19
  </script>
26
20
 
27
21
  {#if asChild}
28
- <slot {...slotProps} />
22
+ <slot {attrs} isChecked={$isChecked} isIndeterminate={$isIndeterminate} />
29
23
  {:else}
30
24
  <div {...$$restProps} {...attrs}>
31
- <slot {...slotProps} />
25
+ <slot {attrs} isChecked={$isChecked} isIndeterminate={$isIndeterminate} />
32
26
  </div>
33
27
  {/if}
@@ -7,11 +7,11 @@ declare const __propDef: {
7
7
  };
8
8
  slots: {
9
9
  default: {
10
- isChecked: boolean;
11
- isIndeterminate: boolean;
12
10
  attrs: {
13
11
  "data-state": string;
14
12
  };
13
+ isChecked: boolean;
14
+ isIndeterminate: boolean;
15
15
  };
16
16
  };
17
17
  };
@@ -16,17 +16,12 @@ $:
16
16
  builder = $field;
17
17
  $:
18
18
  Object.assign(builder, attrs);
19
- $:
20
- slotProps = {
21
- builder,
22
- segments: $segmentContents
23
- };
24
19
  </script>
25
20
 
26
21
  {#if asChild}
27
- <slot {...slotProps} />
22
+ <slot {builder} segments={$segmentContents} />
28
23
  {:else}
29
24
  <div {...builder} use:builder.action {...$$restProps}>
30
- <slot {...slotProps} />
25
+ <slot {builder} segments={$segmentContents} />
31
26
  </div>
32
27
  {/if}
@@ -123,11 +123,6 @@ $:
123
123
  updateOption("minValue", minValue);
124
124
  $:
125
125
  updateOption("readonly", readonly);
126
- $:
127
- slotProps = {
128
- isInvalid: $localIsInvalid,
129
- ids: $idValues
130
- };
131
126
  </script>
132
127
 
133
- <slot {...slotProps} />
128
+ <slot isInvalid={$localIsInvalid} ids={$idValues} />
@@ -5,7 +5,7 @@ export let asChild = false;
5
5
  export let id = void 0;
6
6
  const {
7
7
  elements: { calendar },
8
- states: { months, weekdays },
8
+ states: { months: localMonths, weekdays },
9
9
  ids
10
10
  } = getCtx();
11
11
  $:
@@ -18,18 +18,15 @@ $:
18
18
  builder = $calendar;
19
19
  $:
20
20
  Object.assign(builder, attrs);
21
+ let months = $localMonths;
21
22
  $:
22
- slotProps = {
23
- builder,
24
- months: $months,
25
- weekdays: $weekdays
26
- };
23
+ months = $localMonths;
27
24
  </script>
28
25
 
29
26
  {#if asChild}
30
- <slot {...slotProps} />
27
+ <slot {builder} {months} weekdays={$weekdays} />
31
28
  {:else}
32
29
  <div {...builder} use:builder.action {...$$restProps} on:m-keydown={dispatch}>
33
- <slot {...slotProps} />
30
+ <slot {builder} {months} weekdays={$weekdays} />
34
31
  </div>
35
32
  {/if}
@@ -1,5 +1,7 @@
1
1
  import { SvelteComponent } from "svelte";
2
+ import { type Month } from "@melt-ui/svelte";
2
3
  import type { CalendarEvents, CalendarProps } from "../types.js";
4
+ import type { DateValue } from "@internationalized/date";
3
5
  declare const __propDef: {
4
6
  props: CalendarProps;
5
7
  slots: {
@@ -16,7 +18,7 @@ declare const __propDef: {
16
18
  } & {
17
19
  action: (node: HTMLElement) => import("@melt-ui/svelte/internal/types").MeltActionReturn<"keydown">;
18
20
  };
19
- months: import("@melt-ui/svelte/index.js").Month<import("@internationalized/date").DateValue>[];
21
+ months: Month<DateValue>[];
20
22
  weekdays: string[];
21
23
  };
22
24
  };
@@ -15,19 +15,18 @@ $:
15
15
  $:
16
16
  Object.assign(builder, attrs);
17
17
  $:
18
- slotProps = {
19
- builder,
20
- disabled: $isDateDisabled(date),
21
- unavailable: $isDateUnavailable(date),
22
- selected: $isDateSelected(date)
23
- };
18
+ disabled = $isDateDisabled(date);
19
+ $:
20
+ unavailable = $isDateUnavailable(date);
21
+ $:
22
+ selected = $isDateSelected(date);
24
23
  </script>
25
24
 
26
25
  {#if asChild}
27
- <slot {...slotProps} />
26
+ <slot {builder} {disabled} {unavailable} {selected} />
28
27
  {:else}
29
28
  <div {...builder} use:builder.action {...$$restProps} on:m-click={dispatch}>
30
- <slot {...slotProps}>
29
+ <slot {builder} {disabled} {unavailable} {selected}>
31
30
  {date.day}
32
31
  </slot>
33
32
  </div>
@@ -123,11 +123,6 @@ $:
123
123
  updateOption("minValue", minValue);
124
124
  $:
125
125
  updateOption("readonly", readonly);
126
- $:
127
- slotProps = {
128
- isInvalid: $localIsInvalid,
129
- ids: $idValues
130
- };
131
126
  </script>
132
127
 
133
- <slot {...slotProps} />
128
+ <slot ids={$idValues} isInvalid={$localIsInvalid} />
@@ -41,7 +41,6 @@ declare const __propDef: {
41
41
  };
42
42
  slots: {
43
43
  default: {
44
- isInvalid: boolean;
45
44
  ids: {
46
45
  day: string;
47
46
  description: string;
@@ -56,6 +55,7 @@ declare const __propDef: {
56
55
  label: string;
57
56
  timeZoneName: string;
58
57
  };
58
+ isInvalid: boolean;
59
59
  };
60
60
  };
61
61
  };
@@ -10,18 +10,13 @@ $:
10
10
  builder = $heading;
11
11
  $:
12
12
  Object.assign(builder, attrs);
13
- $:
14
- slotProps = {
15
- builder,
16
- headingValue: $headingValue
17
- };
18
13
  </script>
19
14
 
20
15
  {#if asChild}
21
- <slot {...slotProps} />
16
+ <slot {builder} headingValue={$headingValue} />
22
17
  {:else}
23
18
  <div {...builder} use:builder.action {...$$restProps}>
24
- <slot {...slotProps}>
19
+ <slot {builder} headingValue={$headingValue}>
25
20
  {$headingValue}
26
21
  </slot>
27
22
  </div>
@@ -16,17 +16,12 @@ $:
16
16
  builder = $field;
17
17
  $:
18
18
  Object.assign(builder, attrs);
19
- $:
20
- slotProps = {
21
- builder,
22
- segments: $segmentContents
23
- };
24
19
  </script>
25
20
 
26
21
  {#if asChild}
27
- <slot {...slotProps} />
22
+ <slot builder segments={$segmentContents} />
28
23
  {:else}
29
24
  <div {...builder} use:builder.action {...$$restProps}>
30
- <slot {...slotProps} />
25
+ <slot builder segments={$segmentContents} />
31
26
  </div>
32
27
  {/if}
@@ -7,22 +7,6 @@ declare const __propDef: {
7
7
  };
8
8
  slots: {
9
9
  default: {
10
- builder: {
11
- role: string;
12
- id: string;
13
- 'aria-labelledby': string;
14
- 'aria-describedby': string;
15
- 'aria-disabled': string | undefined;
16
- 'aria-readonly': string | undefined;
17
- 'data-invalid': string | undefined;
18
- 'data-disabled': string | undefined;
19
- } & {
20
- [x: `data-melt-${string}`]: "";
21
- } & {
22
- action: <Node_2 extends unknown>() => {
23
- destroy(): void;
24
- };
25
- };
26
10
  segments: {
27
11
  part: import("@melt-ui/svelte/index.js").SegmentPart;
28
12
  value: string;
@@ -22,6 +22,7 @@ export let isDateDisabled = void 0;
22
22
  export let fixedWeeks = void 0;
23
23
  export let calendarLabel = void 0;
24
24
  export let weekdayFormat = void 0;
25
+ export let numberOfMonths = void 0;
25
26
  const {
26
27
  states: {
27
28
  value: localValue,
@@ -48,6 +49,7 @@ const {
48
49
  minValue,
49
50
  readonly,
50
51
  weekdayFormat,
52
+ numberOfMonths,
51
53
  isDateUnavailable,
52
54
  onValueChange: ({ next }) => {
53
55
  if (value !== next) {
@@ -159,10 +161,7 @@ $:
159
161
  $:
160
162
  updateOption("weekdayFormat", weekdayFormat);
161
163
  $:
162
- slotProps = {
163
- isInvalid: $localIsInvalid,
164
- ids: $idValues
165
- };
164
+ updateOption("numberOfMonths", numberOfMonths);
166
165
  </script>
167
166
 
168
- <slot {...slotProps} />
167
+ <slot ids={$idValues} isInvalid={$localIsInvalid} />
@@ -41,7 +41,6 @@ declare const __propDef: {
41
41
  };
42
42
  slots: {
43
43
  default: {
44
- isInvalid: boolean;
45
44
  ids: {
46
45
  day: string;
47
46
  description: string;
@@ -58,6 +57,7 @@ declare const __propDef: {
58
57
  calendar: string;
59
58
  content: string;
60
59
  };
60
+ isInvalid: boolean;
61
61
  };
62
62
  };
63
63
  };
@@ -17,19 +17,16 @@ $:
17
17
  $:
18
18
  Object.assign(builder, attrs);
19
19
  $:
20
- slotProps = {
21
- builder,
22
- segments: {
23
- start: $segmentContents.start,
24
- end: $segmentContents.end
25
- }
20
+ segments = {
21
+ start: $segmentContents.start,
22
+ end: $segmentContents.end
26
23
  };
27
24
  </script>
28
25
 
29
26
  {#if asChild}
30
- <slot {...slotProps} />
27
+ <slot {builder} {segments} />
31
28
  {:else}
32
29
  <div {...builder} use:builder.action {...$$restProps}>
33
- <slot {...slotProps} />
30
+ <slot {builder} {segments} />
34
31
  </div>
35
32
  {/if}
@@ -175,14 +175,11 @@ $:
175
175
  $:
176
176
  updateOption("readonly", readonly);
177
177
  $:
178
- slotProps = {
179
- isInvalid: $localIsInvalid,
180
- ids: {
181
- start: $startIdValues,
182
- end: $endIdValues,
183
- field: $fieldIdValues
184
- }
178
+ idSlotProp = {
179
+ start: $startIdValues,
180
+ end: $endIdValues,
181
+ field: $fieldIdValues
185
182
  };
186
183
  </script>
187
184
 
188
- <slot {...slotProps} />
185
+ <slot isInvalid={$localIsInvalid} ids={idSlotProp} />
@@ -4,7 +4,7 @@ export let asChild = false;
4
4
  export let id = void 0;
5
5
  const {
6
6
  elements: { calendar },
7
- states: { months, weekdays },
7
+ states: { months: localMonths, weekdays },
8
8
  ids
9
9
  } = getCtx();
10
10
  $:
@@ -16,18 +16,15 @@ $:
16
16
  builder = $calendar;
17
17
  $:
18
18
  Object.assign(builder, attrs);
19
+ let months = $localMonths;
19
20
  $:
20
- slotProps = {
21
- builder,
22
- months: $months,
23
- weekdays: $weekdays
24
- };
21
+ months = $localMonths;
25
22
  </script>
26
23
 
27
24
  {#if asChild}
28
- <slot {...slotProps} />
25
+ <slot {builder} {months} weekdays={$weekdays} />
29
26
  {:else}
30
27
  <div {...builder} use:builder.action {...$$restProps}>
31
- <slot {...slotProps} />
28
+ <slot {builder} {months} weekdays={$weekdays} />
32
29
  </div>
33
30
  {/if}
@@ -1,5 +1,7 @@
1
1
  import { SvelteComponent } from "svelte";
2
+ import { type Month } from "@melt-ui/svelte";
2
3
  import type { CalendarProps } from "../types.js";
4
+ import type { DateValue } from "@internationalized/date";
3
5
  declare const __propDef: {
4
6
  props: CalendarProps;
5
7
  events: {
@@ -19,7 +21,7 @@ declare const __propDef: {
19
21
  } & {
20
22
  action: (node: HTMLElement) => import("@melt-ui/svelte/internal/types").MeltActionReturn<"keydown">;
21
23
  };
22
- months: import("@melt-ui/svelte/index.js").Month<import("@internationalized/date").DateValue>[];
24
+ months: Month<DateValue>[];
23
25
  weekdays: string[];
24
26
  };
25
27
  };
@@ -13,18 +13,16 @@ $:
13
13
  $:
14
14
  Object.assign(builder, attrs);
15
15
  $:
16
- slotProps = {
17
- builder,
18
- disabled: $isDateDisabled(date),
19
- unavailable: $isDateUnavailable(date)
20
- };
16
+ disabled = $isDateDisabled(date);
17
+ $:
18
+ unavailable = $isDateUnavailable(date);
21
19
  </script>
22
20
 
23
21
  {#if asChild}
24
- <slot {...slotProps} />
22
+ <slot {builder} {disabled} {unavailable} />
25
23
  {:else}
26
24
  <div {...builder} use:builder.action {...$$restProps}>
27
- <slot {...slotProps}>
25
+ <slot {builder} {disabled} {unavailable}>
28
26
  {date.day}
29
27
  </slot>
30
28
  </div>
@@ -68,10 +68,6 @@ $:
68
68
  updateOption("minValue", minValue);
69
69
  $:
70
70
  updateOption("readonly", readonly);
71
- $:
72
- slotProps = {
73
- isInvalid: $localIsInvalid
74
- };
75
71
  </script>
76
72
 
77
- <slot {...slotProps} />
73
+ <slot isInvalid={$localIsInvalid} />
@@ -10,18 +10,13 @@ $:
10
10
  builder = $heading;
11
11
  $:
12
12
  Object.assign(builder, attrs);
13
- $:
14
- slotProps = {
15
- builder,
16
- headingValue: $headingValue
17
- };
18
13
  </script>
19
14
 
20
15
  {#if asChild}
21
- <slot {...slotProps} />
16
+ <slot {builder} headingValue={$headingValue} />
22
17
  {:else}
23
18
  <div {...builder} use:builder.action {...$$restProps}>
24
- <slot {...slotProps}>
19
+ <slot {builder} headingValue={$headingValue}>
25
20
  {$headingValue}
26
21
  </slot>
27
22
  </div>
@@ -16,17 +16,12 @@ $:
16
16
  builder = $field;
17
17
  $:
18
18
  Object.assign(builder, attrs);
19
- $:
20
- slotProps = {
21
- builder,
22
- segments: $segmentContents
23
- };
24
19
  </script>
25
20
 
26
21
  {#if asChild}
27
- <slot {...slotProps} />
22
+ <slot {builder} segments={$segmentContents} />
28
23
  {:else}
29
24
  <div {...builder} use:builder.action {...$$restProps}>
30
- <slot {...slotProps} />
25
+ <slot {builder} segments={$segmentContents} />
31
26
  </div>
32
27
  {/if}
@@ -23,6 +23,7 @@ export let fixedWeeks = void 0;
23
23
  export let calendarLabel = void 0;
24
24
  export let weekdayFormat = void 0;
25
25
  export let startValue = void 0;
26
+ export let numberOfMonths = void 0;
26
27
  const {
27
28
  states: {
28
29
  value: localValue,
@@ -51,6 +52,7 @@ const {
51
52
  minValue,
52
53
  readonly,
53
54
  weekdayFormat,
55
+ numberOfMonths,
54
56
  isDateUnavailable,
55
57
  onValueChange: ({ next }) => {
56
58
  if (value !== next) {
@@ -212,12 +214,12 @@ $:
212
214
  $:
213
215
  updateOption("weekdayFormat", weekdayFormat);
214
216
  $:
215
- slotProps = {
216
- isInvalid: $localIsInvalid,
217
- ids: $idValues,
218
- startValue: $localStartValue,
219
- endValue: $endValue
220
- };
217
+ updateOption("numberOfMonths", numberOfMonths);
221
218
  </script>
222
219
 
223
- <slot {...slotProps} />
220
+ <slot
221
+ ids={$idValues}
222
+ isInvalid={$localIsInvalid}
223
+ startValue={$localStartValue}
224
+ endValue={$endValue}
225
+ />
@@ -41,7 +41,6 @@ declare const __propDef: {
41
41
  };
42
42
  slots: {
43
43
  default: {
44
- isInvalid: boolean;
45
44
  ids: {
46
45
  field: string;
47
46
  description: string;
@@ -71,6 +70,7 @@ declare const __propDef: {
71
70
  timeZoneName: string;
72
71
  };
73
72
  };
73
+ isInvalid: boolean;
74
74
  startValue: import("@internationalized/date").DateValue | undefined;
75
75
  endValue: import("@internationalized/date").DateValue | undefined;
76
76
  };
@@ -2,19 +2,14 @@
2
2
  export let asChild = false;
3
3
  const checked = getCheckboxIndicator();
4
4
  const attrs = getAttrs("checkbox-indicator");
5
- $:
6
- slotProps = {
7
- attrs,
8
- checked: $checked
9
- };
10
5
  </script>
11
6
 
12
7
  {#if asChild}
13
- <slot {...slotProps} />
8
+ <slot {attrs} checked={$checked} />
14
9
  {:else}
15
10
  <div {...$$restProps} {...attrs}>
16
11
  {#if $checked}
17
- <slot {...slotProps} />
12
+ <slot {attrs} checked={$checked} />
18
13
  {/if}
19
14
  </div>
20
15
  {/if}
@@ -3,18 +3,15 @@ export let asChild = false;
3
3
  const { isChecked, value } = getRadioIndicator();
4
4
  const attrs = getAttrs("radio-indicator");
5
5
  $:
6
- slotProps = {
7
- checked: $isChecked(value),
8
- attrs
9
- };
6
+ checked = $isChecked(value);
10
7
  </script>
11
8
 
12
9
  {#if asChild}
13
- <slot {...slotProps} />
10
+ <slot {attrs} {checked} />
14
11
  {:else}
15
12
  <div {...$$restProps} {...attrs}>
16
- {#if $isChecked(value)}
17
- <slot {...slotProps} />
13
+ {#if checked}
14
+ <slot {attrs} {checked} />
18
15
  {/if}
19
16
  </div>
20
17
  {/if}
@@ -7,8 +7,8 @@ declare const __propDef: {
7
7
  };
8
8
  slots: {
9
9
  default: {
10
- checked: boolean;
11
10
  attrs: Record<string, string>;
11
+ checked: boolean;
12
12
  };
13
13
  };
14
14
  };
@@ -26,17 +26,12 @@ $:
26
26
  builder = $menubar;
27
27
  $:
28
28
  Object.assign(builder, attrs);
29
- $:
30
- slotProps = {
31
- builder,
32
- ids: $idValues
33
- };
34
29
  </script>
35
30
 
36
31
  {#if asChild}
37
- <slot {...slotProps} />
32
+ <slot {builder} ids={$idValues} />
38
33
  {:else}
39
34
  <div {...builder} use:builder.action {...$$restProps}>
40
- <slot {...slotProps} />
35
+ <slot {builder} ids={$idValues} />
41
36
  </div>
42
37
  {/if}
@@ -3,18 +3,15 @@ export let asChild = false;
3
3
  const { isChecked, value } = getRadioIndicator();
4
4
  const attrs = getAttrs("item-indicator");
5
5
  $:
6
- slotProps = {
7
- checked: $isChecked(value),
8
- attrs
9
- };
6
+ checked = $isChecked(value);
10
7
  </script>
11
8
 
12
9
  {#if asChild}
13
- <slot {...slotProps} />
10
+ <slot {checked} {attrs} />
14
11
  {:else}
15
12
  <div {...attrs} {...$$restProps}>
16
- {#if $isChecked(value)}
17
- <slot {...slotProps} />
13
+ {#if checked}
14
+ <slot {checked} {attrs} />
18
15
  {/if}
19
16
  </div>
20
17
  {/if}
@@ -15,15 +15,13 @@ $:
15
15
  $:
16
16
  Object.assign(builder, attrs);
17
17
  $:
18
- slotProps = {
19
- builder,
20
- disabled: $isDateDisabled(date),
21
- unavailable: $isDateUnavailable(date)
22
- };
18
+ disabled = $isDateDisabled(date);
19
+ $:
20
+ unavailable = $isDateUnavailable(date);
23
21
  </script>
24
22
 
25
23
  {#if asChild}
26
- <slot {...slotProps} />
24
+ <slot {builder} {disabled} {unavailable} />
27
25
  {:else}
28
26
  <div
29
27
  {...builder} use:builder.action
@@ -32,7 +30,7 @@ $:
32
30
  on:m-focusin={dispatch}
33
31
  on:m-mouseenter={dispatch}
34
32
  >
35
- <slot {...slotProps}>
33
+ <slot {builder} {disabled} {unavailable}>
36
34
  {date.day}
37
35
  </slot>
38
36
  </div>
@@ -10,18 +10,13 @@ $:
10
10
  builder = $heading;
11
11
  $:
12
12
  Object.assign(builder, attrs);
13
- $:
14
- slotProps = {
15
- builder,
16
- headingValue: $headingValue
17
- };
18
13
  </script>
19
14
 
20
15
  {#if asChild}
21
- <slot {...slotProps} />
16
+ <slot {builder} headingValue={$headingValue} />
22
17
  {:else}
23
18
  <div {...builder} use:builder.action {...$$restProps}>
24
- <slot {...slotProps}>
19
+ <slot {builder} headingValue={$headingValue}>
25
20
  {$headingValue}
26
21
  </slot>
27
22
  </div>
@@ -24,6 +24,7 @@ export let id = void 0;
24
24
  export let weekdayFormat = void 0;
25
25
  export let initialFocus = false;
26
26
  export let startValue = void 0;
27
+ export let numberOfMonths = void 0;
27
28
  let el = void 0;
28
29
  onMount(() => {
29
30
  if (!initialFocus || !el)
@@ -35,7 +36,7 @@ const {
35
36
  states: {
36
37
  value: localValue,
37
38
  placeholder: localPlaceholder,
38
- months,
39
+ months: localMonths,
39
40
  weekdays,
40
41
  startValue: localStartValue,
41
42
  endValue
@@ -58,6 +59,7 @@ const {
58
59
  fixedWeeks,
59
60
  calendarLabel,
60
61
  weekdayFormat,
62
+ numberOfMonths,
61
63
  onPlaceholderChange: ({ next }) => {
62
64
  if (placeholder !== next) {
63
65
  onPlaceholderChange?.(next);
@@ -109,24 +111,27 @@ $:
109
111
  updateOption("calendarLabel", calendarLabel);
110
112
  $:
111
113
  updateOption("weekdayFormat", weekdayFormat);
114
+ $:
115
+ updateOption("numberOfMonths", numberOfMonths);
112
116
  const attrs = getAttrs("root");
113
117
  const dispatch = createDispatcher();
114
118
  $:
115
119
  builder = $calendar;
116
120
  $:
117
121
  Object.assign(builder, attrs);
122
+ let months = $localMonths;
118
123
  $:
119
- slotProps = {
120
- builder,
121
- months: $months,
122
- weekdays: $weekdays,
123
- startValue: $localStartValue,
124
- endValue: $endValue
125
- };
124
+ months = $localMonths;
126
125
  </script>
127
126
 
128
127
  {#if asChild}
129
- <slot {...slotProps} />
128
+ <slot
129
+ {builder}
130
+ {months}
131
+ weekdays={$weekdays}
132
+ startValue={$localStartValue}
133
+ endValue={$endValue}
134
+ />
130
135
  {:else}
131
136
  <div
132
137
  {...builder} use:builder.action
@@ -134,6 +139,12 @@ $:
134
139
  on:m-keydown={dispatch}
135
140
  bind:this={el}
136
141
  >
137
- <slot {...slotProps} />
142
+ <slot
143
+ {builder}
144
+ {months}
145
+ weekdays={$weekdays}
146
+ startValue={$localStartValue}
147
+ endValue={$endValue}
148
+ />
138
149
  </div>
139
150
  {/if}
@@ -1,5 +1,7 @@
1
1
  import { SvelteComponent } from "svelte";
2
+ import { type Month } from "@melt-ui/svelte";
2
3
  import type { Events, Props } from "../types.js";
4
+ import type { DateValue } from "@internationalized/date";
3
5
  declare const __propDef: {
4
6
  props: Props;
5
7
  slots: {
@@ -16,10 +18,10 @@ declare const __propDef: {
16
18
  } & {
17
19
  action: (node: HTMLElement) => import("@melt-ui/svelte/internal/types").MeltActionReturn<"keydown">;
18
20
  };
19
- months: import("@melt-ui/svelte/index.js").Month<import("@internationalized/date").DateValue>[];
21
+ months: Month<DateValue>[];
20
22
  weekdays: string[];
21
- startValue: import("@internationalized/date").DateValue | undefined;
22
- endValue: import("@internationalized/date").DateValue | undefined;
23
+ startValue: DateValue | undefined;
24
+ endValue: DateValue | undefined;
23
25
  };
24
26
  };
25
27
  events: Events;
@@ -2,19 +2,14 @@
2
2
  export let asChild = false;
3
3
  const { isSelected, value } = getItemIndicator();
4
4
  const attrs = getAttrs("indicator");
5
- $:
6
- slotProps = {
7
- isSelected: $isSelected(value),
8
- attrs
9
- };
10
5
  </script>
11
6
 
12
7
  {#if asChild}
13
- <slot {...slotProps} />
8
+ <slot {attrs} isSelected={$isSelected(value)} />
14
9
  {:else}
15
10
  <div {...$$restProps} {...attrs}>
16
11
  {#if $isSelected(value)}
17
- <slot {...slotProps} />
12
+ <slot {attrs} isSelected={$isSelected(value)} />
18
13
  {/if}
19
14
  </div>
20
15
  {/if}
@@ -7,8 +7,8 @@ declare const __propDef: {
7
7
  };
8
8
  slots: {
9
9
  default: {
10
- isSelected: boolean;
11
10
  attrs: Record<string, string>;
11
+ isSelected: boolean;
12
12
  };
13
13
  };
14
14
  };
@@ -7,12 +7,10 @@ const {
7
7
  const attrs = getAttrs("value");
8
8
  $:
9
9
  label = $selectedLabel;
10
- $:
11
- slotProps = { label, attrs };
12
10
  </script>
13
11
 
14
12
  {#if asChild}
15
- <slot {...slotProps} />
13
+ <slot {label} {attrs} />
16
14
  {:else}
17
15
  <span {...$$restProps} {...attrs}>
18
16
  {label ? label : placeholder}
@@ -44,14 +44,12 @@ $:
44
44
  builder = $root;
45
45
  $:
46
46
  Object.assign(builder, attrs);
47
- $:
48
- slotProps = { builder, ticks: $ticks };
49
47
  </script>
50
48
 
51
49
  {#if asChild}
52
- <slot {...slotProps} />
50
+ <slot {builder} ticks={$ticks} />
53
51
  {:else}
54
52
  <span {...builder} use:builder.action {...$$restProps}>
55
- <slot {...slotProps} />
53
+ <slot {builder} ticks={$ticks} />
56
54
  </span>
57
55
  {/if}
@@ -9,12 +9,10 @@ $:
9
9
  "data-state": $checked ? "checked" : "unchecked",
10
10
  "data-checked": $checked ? "" : void 0
11
11
  };
12
- $:
13
- slotProps = { checked: $checked, attrs };
14
12
  </script>
15
13
 
16
14
  {#if asChild}
17
- <slot {...slotProps} />
15
+ <slot {attrs} checked={$checked} />
18
16
  {:else}
19
17
  <span {...$$restProps} {...attrs} />
20
18
  {/if}
@@ -7,11 +7,11 @@ declare const __propDef: {
7
7
  };
8
8
  slots: {
9
9
  default: {
10
- checked: boolean;
11
10
  attrs: {
12
11
  "data-state": string;
13
12
  "data-checked": string | undefined;
14
13
  };
14
+ checked: boolean;
15
15
  };
16
16
  };
17
17
  };
@@ -40,17 +40,12 @@ $:
40
40
  builder = $root;
41
41
  $:
42
42
  Object.assign(builder, attrs);
43
- $:
44
- slotProps = {
45
- builder,
46
- value: $localValue
47
- };
48
43
  </script>
49
44
 
50
45
  {#if asChild}
51
- <slot {...slotProps} />
46
+ <slot {builder} value={$localValue} />
52
47
  {:else}
53
48
  <div {...builder} use:builder.action {...$$restProps}>
54
- <slot {...slotProps} />
49
+ <slot {builder} value={$localValue} />
55
50
  </div>
56
51
  {/if}
@@ -19,8 +19,10 @@ const {
19
19
  orientation,
20
20
  onValueChange: ({ next }) => {
21
21
  if (Array.isArray(next)) {
22
- onValueChange?.(next);
23
- value = next;
22
+ if (JSON.stringify(next) !== JSON.stringify(value)) {
23
+ onValueChange?.(next);
24
+ value = next;
25
+ }
24
26
  return next;
25
27
  }
26
28
  if (value !== next) {
@@ -32,7 +34,7 @@ const {
32
34
  });
33
35
  const attrs = getAttrs("root");
34
36
  $:
35
- value !== void 0 && localValue.set(value);
37
+ value !== void 0 && localValue.set(Array.isArray(value) ? [...value] : value);
36
38
  $:
37
39
  updateOption("disabled", disabled);
38
40
  $:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bits-ui",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "license": "MIT",
5
5
  "repository": "github:huntabyte/bits-ui",
6
6
  "exports": {