ui-ingredients 0.0.64 → 0.0.65

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/dist/collapsible/collapsible-root.svelte +1 -1
  2. package/dist/collapsible/create-collapsible.svelte.d.ts +2 -2
  3. package/dist/collapsible/create-collapsible.svelte.js +3 -4
  4. package/dist/color-picker/color-picker-root.svelte +1 -1
  5. package/dist/color-picker/create-color-picker.svelte.d.ts +2 -2
  6. package/dist/color-picker/create-color-picker.svelte.js +3 -4
  7. package/dist/combobox/combobox-root.svelte +1 -1
  8. package/dist/combobox/create-combobox.svelte.d.ts +2 -2
  9. package/dist/combobox/create-combobox.svelte.js +4 -4
  10. package/dist/date-picker/create-date-picker.svelte.d.ts +2 -2
  11. package/dist/date-picker/create-date-picker.svelte.js +4 -5
  12. package/dist/date-picker/date-picker-root.svelte +1 -1
  13. package/dist/dialog/create-dialog.svelte.d.ts +2 -2
  14. package/dist/dialog/create-dialog.svelte.js +3 -4
  15. package/dist/editable/create-editable.svelte.d.ts +2 -2
  16. package/dist/editable/create-editable.svelte.js +3 -4
  17. package/dist/editable/editable-root.svelte +1 -1
  18. package/dist/hover-card/create-hover-card.svelte.d.ts +2 -2
  19. package/dist/hover-card/create-hover-card.svelte.js +3 -4
  20. package/dist/hover-card/hover-card-root.svelte +1 -1
  21. package/dist/menu/create-menu.svelte.d.ts +2 -2
  22. package/dist/menu/create-menu.svelte.js +3 -4
  23. package/dist/menu/menu-root.svelte +12 -12
  24. package/dist/popover/create-popover.svelte.d.ts +2 -2
  25. package/dist/popover/create-popover.svelte.js +3 -4
  26. package/dist/popover/popover-root.svelte +11 -11
  27. package/dist/select/create-select.svelte.d.ts +2 -2
  28. package/dist/select/create-select.svelte.js +3 -4
  29. package/dist/select/select-root.svelte +1 -1
  30. package/dist/time-picker/create-time-picker.svelte.d.ts +2 -2
  31. package/dist/time-picker/create-time-picker.svelte.js +4 -5
  32. package/dist/time-picker/time-picker-root.svelte +1 -1
  33. package/dist/tooltip/create-tooltip.svelte.d.ts +2 -2
  34. package/dist/tooltip/create-tooltip.svelte.js +3 -4
  35. package/package.json +1 -1
@@ -31,8 +31,8 @@
31
31
  'id',
32
32
  'ids',
33
33
  'open',
34
+ 'openControlled',
34
35
  'disabled',
35
- 'defaultOpen',
36
36
  'onOpenChange',
37
37
  'onExitComplete',
38
38
  ])(props),
@@ -1,7 +1,7 @@
1
1
  import * as collapsible from '@zag-js/collapsible';
2
2
  export interface CreateCollapsibleProps extends Omit<collapsible.Context, 'id' | 'dir' | 'getRootNode' | 'open.controlled'> {
3
- id?: string | null;
4
- defaultOpen?: boolean;
3
+ id?: string;
4
+ openControlled?: boolean;
5
5
  }
6
6
  export interface CreateCollapsibleReturn extends collapsible.Api {
7
7
  }
@@ -8,12 +8,11 @@ export function createCollapsible(props) {
8
8
  const environment = getEnvironmentContext();
9
9
  const id = uid();
10
10
  const context = reflect(() => ({
11
- ...props,
12
- id: props.id ?? id,
11
+ id,
13
12
  dir: locale?.dir,
14
- open: props.defaultOpen ?? props.open,
13
+ ...props,
15
14
  getRootNode: environment?.getRootNode,
16
- 'open.controlled': props.open != null,
15
+ 'open.controlled': props.openControlled,
17
16
  }));
18
17
  const [state, send] = useMachine(collapsible.machine(context), { context });
19
18
  return reflect(() => collapsible.connect(state, send, normalizeProps));
@@ -41,13 +41,13 @@
41
41
  'id',
42
42
  'ids',
43
43
  'open',
44
+ 'openControlled',
44
45
  'name',
45
46
  'value',
46
47
  'format',
47
48
  'disabled',
48
49
  'required',
49
50
  'readOnly',
50
- 'defaultOpen',
51
51
  'positioning',
52
52
  'onOpenChange',
53
53
  'closeOnSelect',
@@ -2,9 +2,9 @@ import type { GenericObject } from '../types.js';
2
2
  import * as colorPicker from '@zag-js/color-picker';
3
3
  type Omitted = 'id' | 'dir' | 'value' | 'getRootNode' | 'open.controlled';
4
4
  export interface CreateColorPickerProps extends Omit<colorPicker.Context, Omitted> {
5
- id?: string | null;
5
+ id?: string;
6
6
  value?: string;
7
- defaultOpen?: boolean;
7
+ openControlled?: boolean;
8
8
  }
9
9
  export interface CreateColorPickerReturn extends colorPicker.Api {
10
10
  getViewProps(props: {
@@ -9,13 +9,12 @@ export function createColorPicker(props) {
9
9
  const environment = getEnvironmentContext();
10
10
  const id = uid();
11
11
  const context = $derived.by(() => ({
12
- ...props,
13
- id: props.id ?? id,
12
+ id,
14
13
  dir: locale?.dir,
15
- open: props.defaultOpen ?? props.open,
14
+ ...props,
16
15
  value: props.value ? colorPicker.parse(props.value) : undefined,
17
16
  getRootNode: environment?.getRootNode,
18
- 'open.controlled': props.open != null,
17
+ 'open.controlled': props.openControlled,
19
18
  }));
20
19
  const [state, send] = useMachine(colorPicker.machine(context), { context });
21
20
  return reflect(() => {
@@ -43,7 +43,7 @@
43
43
  'name',
44
44
  'form',
45
45
  'open',
46
- 'defaultOpen',
46
+ 'openControlled',
47
47
  'items',
48
48
  'value',
49
49
  'invalid',
@@ -1,8 +1,8 @@
1
1
  import * as combobox from '@zag-js/combobox';
2
2
  type Omitted = 'id' | 'dir' | 'collection' | 'getRootNode' | 'open.controlled';
3
3
  export interface CreateComboboxProps<T> extends combobox.CollectionOptions<T>, Omit<combobox.Context, Omitted> {
4
- id?: string | null;
5
- defaultOpen?: boolean;
4
+ id?: string;
5
+ openControlled?: boolean;
6
6
  }
7
7
  export interface CreateComboboxReturn extends combobox.Api {
8
8
  }
@@ -18,22 +18,22 @@ export function createCombobox(props) {
18
18
  const environment = getEnvironmentContext();
19
19
  const id = uid();
20
20
  const context = reflect(() => ({
21
+ id,
21
22
  ids: {
22
23
  label: field?.ids.label,
23
24
  input: field?.ids.control,
24
25
  },
26
+ dir: locale?.dir,
25
27
  invalid: field?.invalid,
26
28
  disabled: field?.disabled,
27
29
  readOnly: field?.readOnly,
28
30
  required: field?.required,
29
31
  ...comboboxProps,
30
- id: props.id ?? id,
31
- dir: locale?.dir,
32
- open: props.defaultOpen ?? props.open,
33
- 'open.controlled': props.open != null,
34
32
  getRootNode: environment?.getRootNode,
33
+ 'open.controlled': props.openControlled,
35
34
  collection,
36
35
  }));
36
+ /* FIXME: pass controlled context */
37
37
  const [state, send] = useMachine(combobox.machine(context));
38
38
  return reflect(() => {
39
39
  const o = combobox.connect(state, send, normalizeProps);
@@ -2,12 +2,12 @@ import type { GenericObject } from '../types.js';
2
2
  import * as datePicker from '@zag-js/date-picker';
3
3
  type Omitted = 'id' | 'dir' | 'min' | 'max' | 'value' | 'focusedValue' | 'getRootNode' | 'open.controlled';
4
4
  export interface CreateDatePickerProps extends Omit<datePicker.Context, Omitted> {
5
- id?: string | null;
5
+ id?: string;
6
6
  min?: string | Date;
7
7
  max?: string | Date;
8
8
  value?: string[] | Date[];
9
9
  focusedValue?: string | Date;
10
- defaultOpen?: boolean;
10
+ openControlled?: boolean;
11
11
  }
12
12
  export interface CreateDatePickerReturn extends datePicker.Api {
13
13
  getViewProps(props: datePicker.ViewProps): GenericObject;
@@ -10,19 +10,18 @@ export function createDatePicker(props) {
10
10
  const id = uid();
11
11
  /* FIXME: use reflect */
12
12
  const context = $derived.by(() => ({
13
- ...props,
14
- id: props.id ?? id,
13
+ id,
15
14
  dir: locale?.dir,
15
+ locale: locale?.locale,
16
+ ...props,
16
17
  min: props.min ? datePicker.parse(props.min) : undefined,
17
18
  max: props.max ? datePicker.parse(props.max) : undefined,
18
19
  value: props.value ? datePicker.parse(props.value) : undefined,
19
20
  focusedValue: props.focusedValue
20
21
  ? datePicker.parse(props.focusedValue)
21
22
  : undefined,
22
- open: props.defaultOpen ?? props.open,
23
- 'open.controlled': props.open != null,
24
- locale: props.locale ?? locale?.locale,
25
23
  getRootNode: environment?.getRootNode,
24
+ 'open.controlled': props.openControlled,
26
25
  }));
27
26
  const [state, send] = useMachine(datePicker.machine(context), { context });
28
27
  return reflect(() => {
@@ -42,6 +42,7 @@
42
42
  'max',
43
43
  'name',
44
44
  'open',
45
+ 'openControlled',
45
46
  'view',
46
47
  'value',
47
48
  'modal',
@@ -52,7 +53,6 @@
52
53
  'timeZone',
53
54
  'fixedWeeks',
54
55
  'startOfWeek',
55
- 'defaultOpen',
56
56
  'positioning',
57
57
  'numOfMonths',
58
58
  'translations',
@@ -1,7 +1,7 @@
1
1
  import * as dialog from '@zag-js/dialog';
2
2
  export interface CreateDialogProps extends Omit<dialog.Context, 'id' | 'dir' | 'getRootNode' | 'open.controlled'> {
3
- id?: string | null;
4
- defaultOpen?: boolean;
3
+ id?: string;
4
+ openControlled?: boolean;
5
5
  }
6
6
  export interface CreateDialogReturn extends dialog.Api {
7
7
  }
@@ -8,12 +8,11 @@ export function createDialog(props) {
8
8
  const environment = getEnvironmentContext();
9
9
  const id = uid();
10
10
  const context = reflect(() => ({
11
- ...props,
12
- id: props.id ?? id,
11
+ id,
13
12
  dir: locale?.dir,
14
- open: props.defaultOpen ?? props.open,
13
+ ...props,
15
14
  getRootNode: environment?.getRootNode,
16
- 'open.controlled': props.open != null,
15
+ 'open.controlled': props.openControlled,
17
16
  }));
18
17
  const [state, send] = useMachine(dialog.machine(context), { context });
19
18
  return reflect(() => dialog.connect(state, send, normalizeProps));
@@ -1,7 +1,7 @@
1
1
  import * as editable from '@zag-js/editable';
2
2
  export interface CreateEditableProps extends Omit<editable.Context, 'id' | 'dir' | 'getRootNode' | 'edit.controlled'> {
3
- id?: string | null;
4
- defaultEdit?: boolean;
3
+ id?: string;
4
+ editControlled?: boolean;
5
5
  }
6
6
  export interface CreateEditableReturn extends editable.Api {
7
7
  }
@@ -10,20 +10,19 @@ export function createEditable(props) {
10
10
  const environment = getEnvironmentContext();
11
11
  const id = uid();
12
12
  const context = reflect(() => ({
13
+ id,
13
14
  ids: {
14
15
  label: field?.ids.label,
15
16
  input: field?.ids.control,
16
17
  },
18
+ dir: locale?.dir,
17
19
  invalid: field?.invalid,
18
20
  disabled: field?.disabled,
19
21
  readOnly: field?.readOnly,
20
22
  required: field?.required,
21
23
  ...props,
22
- id: props.id ?? id,
23
- dir: locale?.dir,
24
- edit: props.defaultEdit ?? props.edit,
25
24
  getRootNode: environment?.getRootNode,
26
- 'edit.controlled': props.edit != null,
25
+ 'edit.controlled': props.editControlled,
27
26
  }));
28
27
  const [state, send] = useMachine(editable.machine(context), { context });
29
28
  return reflect(() => {
@@ -33,6 +33,7 @@
33
33
  'name',
34
34
  'form',
35
35
  'edit',
36
+ 'editControlled',
36
37
  'value',
37
38
  'invalid',
38
39
  'readOnly',
@@ -41,7 +42,6 @@
41
42
  'maxLength',
42
43
  'submitMode',
43
44
  'autoResize',
44
- 'defaultEdit',
45
45
  'placeholder',
46
46
  'finalFocusEl',
47
47
  'translations',
@@ -1,7 +1,7 @@
1
1
  import * as hoverCard from '@zag-js/hover-card';
2
2
  export interface CreateHoverCardProps extends Omit<hoverCard.Context, 'id' | 'dir' | 'getRootNode' | 'open.controlled'> {
3
- id?: string | null;
4
- defaultOpen?: boolean;
3
+ id?: string;
4
+ openControlled?: boolean;
5
5
  }
6
6
  export interface CreateHoverCardReturn extends hoverCard.Api {
7
7
  }
@@ -8,12 +8,11 @@ export function createHoverCard(props) {
8
8
  const environment = getEnvironmentContext();
9
9
  const id = uid();
10
10
  const context = reflect(() => ({
11
- ...props,
12
- id: props.id ?? id,
11
+ id,
13
12
  dir: locale?.dir,
14
- open: props.defaultOpen ?? props.open,
13
+ ...props,
15
14
  getRootNode: environment?.getRootNode,
16
- 'open.controlled': props.open != null,
15
+ 'open.controlled': props.openControlled,
17
16
  }));
18
17
  const [state, send] = useMachine(hoverCard.machine(context), { context });
19
18
  return reflect(() => hoverCard.connect(state, send, normalizeProps));
@@ -28,9 +28,9 @@
28
28
  'id',
29
29
  'ids',
30
30
  'open',
31
+ 'openControlled',
31
32
  'openDelay',
32
33
  'closeDelay',
33
- 'defaultOpen',
34
34
  'positioning',
35
35
  'onOpenChange',
36
36
  ])(props),
@@ -1,7 +1,7 @@
1
1
  import * as menu from '@zag-js/menu';
2
2
  export interface CreateMenuProps extends Omit<menu.Context, 'id' | 'dir' | 'getRootNode' | 'open.controlled'> {
3
- id?: string | null;
4
- defaultOpen?: boolean;
3
+ id?: string;
4
+ openControlled?: boolean;
5
5
  }
6
6
  export interface CreateMenuReturn extends menu.Api {
7
7
  machine: menu.Service;
@@ -8,12 +8,11 @@ export function createMenu(props) {
8
8
  const environment = getEnvironmentContext();
9
9
  const id = uid();
10
10
  const context = reflect(() => ({
11
- ...props,
12
- id: props.id ?? id,
11
+ id,
13
12
  dir: locale?.dir,
14
- open: props.defaultOpen ?? props.open,
13
+ ...props,
15
14
  getRootNode: environment?.getRootNode,
16
- 'open.controlled': props.open != null,
15
+ 'open.controlled': props.openControlled,
17
16
  }));
18
17
  const [state, send, machine] = useMachine(menu.machine(context), { context });
19
18
  return reflect(() => ({
@@ -29,25 +29,25 @@
29
29
 
30
30
  let [createMenuProps, presenceStrategyProps] = $derived(
31
31
  createSplitProps<CreateMenuProps>([
32
- 'anchorPoint',
33
- 'aria-label',
34
- 'closeOnSelect',
35
- 'composite',
36
- 'defaultOpen',
37
- 'highlightedValue',
38
32
  'id',
39
33
  'ids',
34
+ 'open',
35
+ 'openControlled',
40
36
  'loopFocus',
41
- 'onEscapeKeyDown',
37
+ 'composite',
38
+ 'typeahead',
39
+ 'positioning',
40
+ 'anchorPoint',
41
+ 'closeOnSelect',
42
+ 'highlightedValue',
43
+ 'aria-label',
44
+ 'onSelect',
45
+ 'onOpenChange',
42
46
  'onFocusOutside',
47
+ 'onEscapeKeyDown',
43
48
  'onHighlightChange',
44
49
  'onInteractOutside',
45
- 'onOpenChange',
46
50
  'onPointerDownOutside',
47
- 'onSelect',
48
- 'open',
49
- 'positioning',
50
- 'typeahead',
51
51
  ])(props),
52
52
  );
53
53
 
@@ -1,7 +1,7 @@
1
1
  import * as popover from '@zag-js/popover';
2
2
  export interface CreatePopoverProps extends Omit<popover.Context, 'id' | 'dir' | 'getRootNode' | 'open.controlled'> {
3
- id?: string | null;
4
- defaultOpen?: boolean;
3
+ id?: string;
4
+ openControlled?: boolean;
5
5
  }
6
6
  export interface CreatePopoverReturn extends popover.Api {
7
7
  }
@@ -8,12 +8,11 @@ export function createPopover(props) {
8
8
  const environment = getEnvironmentContext();
9
9
  const id = uid();
10
10
  const context = reflect(() => ({
11
- ...props,
12
- id: props.id ?? id,
11
+ id,
13
12
  dir: locale?.dir,
14
- open: props.defaultOpen ?? props.open,
13
+ ...props,
15
14
  getRootNode: environment?.getRootNode,
16
- 'open.controlled': props.open != null,
15
+ 'open.controlled': props.openControlled,
17
16
  }));
18
17
  const [state, send] = useMachine(popover.machine(context), { context });
19
18
  return reflect(() => popover.connect(state, send, normalizeProps));
@@ -25,23 +25,23 @@
25
25
 
26
26
  let [createPopoverProps, presenceStrategyProps] = $derived(
27
27
  createSplitProps<CreatePopoverProps>([
28
- 'autoFocus',
29
- 'closeOnEscape',
30
- 'closeOnInteractOutside',
31
- 'defaultOpen',
32
28
  'id',
33
29
  'ids',
34
- 'initialFocusEl',
30
+ 'open',
31
+ 'openControlled',
35
32
  'modal',
36
- 'onEscapeKeyDown',
33
+ 'autoFocus',
34
+ 'portalled',
35
+ 'positioning',
36
+ 'closeOnEscape',
37
+ 'initialFocusEl',
38
+ 'persistentElements',
39
+ 'closeOnInteractOutside',
40
+ 'onOpenChange',
37
41
  'onFocusOutside',
42
+ 'onEscapeKeyDown',
38
43
  'onInteractOutside',
39
- 'onOpenChange',
40
44
  'onPointerDownOutside',
41
- 'open',
42
- 'persistentElements',
43
- 'portalled',
44
- 'positioning',
45
45
  ])(props),
46
46
  );
47
47
 
@@ -1,8 +1,8 @@
1
1
  import * as select from '@zag-js/select';
2
2
  type Omitted = 'id' | 'dir' | 'getRootNode' | 'collection' | 'open.controlled';
3
3
  export interface CreateSelectProps<T> extends select.CollectionOptions<T>, Omit<select.Context, Omitted> {
4
- id?: string | null;
5
- defaultOpen?: boolean;
4
+ id?: string;
5
+ openControlled?: boolean;
6
6
  }
7
7
  export interface CreateSelectReturn extends select.Api {
8
8
  }
@@ -18,20 +18,19 @@ export function createSelect(props) {
18
18
  const environment = getEnvironmentContext();
19
19
  const id = uid();
20
20
  const context = reflect(() => ({
21
+ id,
21
22
  ids: {
22
23
  label: field?.ids.label,
23
24
  hiddenSelect: field?.ids.control,
24
25
  },
26
+ dir: locale?.dir,
25
27
  invalid: field?.invalid,
26
28
  disabled: field?.disabled,
27
29
  readOnly: field?.readOnly,
28
30
  required: field?.required,
29
31
  ...selectProps,
30
- id: props.id ?? id,
31
- dir: locale?.dir,
32
- open: props.defaultOpen ?? props.open,
33
- 'open.controlled': props.open != null,
34
32
  getRootNode: environment?.getRootNode,
33
+ 'open.controlled': props.openControlled,
35
34
  collection,
36
35
  }));
37
36
  const [state, send] = useMachine(select.machine(context), { context });
@@ -37,7 +37,7 @@
37
37
  'form',
38
38
  'name',
39
39
  'open',
40
- 'defaultOpen',
40
+ 'openControlled',
41
41
  'value',
42
42
  'items',
43
43
  'invalid',
@@ -1,7 +1,7 @@
1
1
  import * as timePicker from '@zag-js/time-picker';
2
2
  export interface CreateTimePickerProps extends Omit<timePicker.Context, 'id' | 'dir' | 'getRootNode' | 'open.controlled'> {
3
- id?: string | null;
4
- defaultOpen?: boolean;
3
+ id?: string;
4
+ openControlled?: boolean;
5
5
  }
6
6
  export interface CreateTimePickerReturn extends timePicker.Api {
7
7
  }
@@ -8,13 +8,12 @@ export function createTimePicker(props) {
8
8
  const environment = getEnvironmentContext();
9
9
  const id = uid();
10
10
  const context = reflect(() => ({
11
- ...props,
12
- id: props.id ?? id,
11
+ id,
13
12
  dir: locale?.dir,
14
- open: props.defaultOpen ?? props.open,
15
- locale: props.locale ?? locale?.locale,
13
+ locale: locale?.locale,
14
+ ...props,
16
15
  getRootNode: environment?.getRootNode,
17
- 'open.controlled': props.defaultOpen != null,
16
+ 'open.controlled': props.openControlled,
18
17
  }));
19
18
  const [state, send] = useMachine(timePicker.machine(context), { context });
20
19
  return reflect(() => timePicker.connect(state, send, normalizeProps));
@@ -38,12 +38,12 @@
38
38
  'max',
39
39
  'name',
40
40
  'open',
41
+ 'openControlled',
41
42
  'steps',
42
43
  'value',
43
44
  'locale',
44
45
  'readOnly',
45
46
  'disabled',
46
- 'defaultOpen',
47
47
  'placeholder',
48
48
  'positioning',
49
49
  'allowSeconds',
@@ -1,7 +1,7 @@
1
1
  import * as tooltip from '@zag-js/tooltip';
2
2
  export interface CreateTooltipProps extends Omit<tooltip.Context, 'id' | 'dir' | 'getRootNode' | 'open.controlled'> {
3
- id?: string | null;
4
- defaultOpen?: boolean;
3
+ id?: string;
4
+ openControlled?: boolean;
5
5
  }
6
6
  export interface CreateTooltipReturn extends tooltip.Api {
7
7
  }
@@ -8,12 +8,11 @@ export function createTooltip(props) {
8
8
  const environment = getEnvironmentContext();
9
9
  const id = uid();
10
10
  const context = reflect(() => ({
11
- ...props,
12
- id: props.id ?? id,
11
+ id,
13
12
  dir: locale?.dir,
14
- open: props.defaultOpen ?? props.open,
13
+ ...props,
15
14
  getRootNode: environment?.getRootNode,
16
- 'open.controlled': props.open != null,
15
+ 'open.controlled': props.openControlled,
17
16
  }));
18
17
  const [state, send] = useMachine(tooltip.machine(context), { context });
19
18
  return reflect(() => tooltip.connect(state, send, normalizeProps));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui-ingredients",
3
3
  "type": "module",
4
- "version": "0.0.64",
4
+ "version": "0.0.65",
5
5
  "packageManager": "pnpm@9.7.0",
6
6
  "svelte": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",