ui-ingredients 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +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
3
  id?: string | null;
4
+ defaultOpen?: boolean;
4
5
  }
5
6
  export interface CreateCollapsibleReturn extends collapsible.Api {
6
7
  }
@@ -10,6 +10,7 @@ export function createCollapsible(props) {
10
10
  ...props,
11
11
  id: props.id ?? createUniqueId(),
12
12
  dir: localeContext?.dir,
13
+ open: props.defaultOpen,
13
14
  getRootNode: environmentContext?.getRootNode,
14
15
  'open.controlled': props.open != null,
15
16
  }));
@@ -22,6 +22,7 @@
22
22
  ids,
23
23
  open,
24
24
  disabled,
25
+ defaultOpen,
25
26
  onOpenChange,
26
27
  onExitComplete,
27
28
  children,
@@ -33,6 +34,7 @@
33
34
  ids,
34
35
  open,
35
36
  disabled,
37
+ defaultOpen,
36
38
  onOpenChange,
37
39
  onExitComplete,
38
40
  });
@@ -5,6 +5,7 @@ export interface CreateComboboxProps<T> extends Omit<combobox.Context, 'id' | 'd
5
5
  itemToString?: (item: T) => string;
6
6
  itemToValue?: (item: T) => string;
7
7
  isItemDisabled?: (item: T) => boolean;
8
+ defaultOpen?: boolean;
8
9
  }
9
10
  export interface CreateComboboxReturn extends combobox.Api {
10
11
  }
@@ -16,6 +16,7 @@ export function createCombobox(props) {
16
16
  ...props,
17
17
  id: props.id ?? createUniqueId(),
18
18
  dir: localeContext?.dir,
19
+ open: props.defaultOpen,
19
20
  getRootNode: environmentContext?.getRootNode,
20
21
  'open.controlled': props.open != null,
21
22
  collection,
@@ -20,6 +20,7 @@
20
20
  name,
21
21
  form,
22
22
  open,
23
+ defaultOpen,
23
24
  items,
24
25
  value,
25
26
  invalid,
@@ -65,6 +66,7 @@
65
66
  name,
66
67
  form,
67
68
  open,
69
+ defaultOpen,
68
70
  items,
69
71
  value: $state.snapshot(value),
70
72
  invalid,
@@ -1,6 +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
3
  id?: string | null;
4
+ defaultOpen?: boolean;
4
5
  }
5
6
  export interface CreateDialogReturn extends dialog.Api {
6
7
  }
@@ -10,6 +10,7 @@ export function createDialog(props) {
10
10
  ...props,
11
11
  id: props.id ?? createUniqueId(),
12
12
  dir: localeContext?.dir,
13
+ open: props.defaultOpen,
13
14
  getRootNode: environmentContext?.getRootNode,
14
15
  'open.controlled': props.open != null,
15
16
  }));
@@ -1,6 +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
3
  id?: string | null;
4
+ defaultEdit?: boolean;
4
5
  }
5
6
  export interface CreateEditableReturn extends editable.Api {
6
7
  }
@@ -10,6 +10,7 @@ export function createEditable(props) {
10
10
  ...props,
11
11
  id: props.id ?? createUniqueId(),
12
12
  dir: localeContext?.dir,
13
+ edit: props.defaultEdit,
13
14
  getRootNode: environmentContext?.getRootNode,
14
15
  'edit.controlled': props.edit != null,
15
16
  }));
@@ -1,6 +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
3
  id?: string | null;
4
+ defaultOpen?: boolean;
4
5
  }
5
6
  export interface CreateHoverCardReturn extends hoverCard.Api {
6
7
  }
@@ -10,6 +10,7 @@ export function createHoverCard(props) {
10
10
  ...props,
11
11
  id: props.id ?? createUniqueId(),
12
12
  dir: localeContext?.dir,
13
+ open: props.defaultOpen,
13
14
  getRootNode: environmentContext?.getRootNode,
14
15
  'open.controlled': props.open != null,
15
16
  }));
@@ -1,6 +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
3
  id?: string | null;
4
+ defaultOpen?: boolean;
4
5
  }
5
6
  export interface CreateMenuReturn extends menu.Api {
6
7
  }
@@ -10,6 +10,7 @@ export function createMenu(props) {
10
10
  ...props,
11
11
  id: props.id ?? createUniqueId(),
12
12
  dir: localeContext?.dir,
13
+ open: props.defaultOpen,
13
14
  getRootNode: environmentContext?.getRootNode,
14
15
  'open.controlled': props.open != null,
15
16
  }));
@@ -1,13 +1,10 @@
1
1
  <script lang="ts" module>
2
- import type {Assign, HtmlProps, PickPartial} from '../types.js';
2
+ import type {Assign, HtmlProps} from '../types.js';
3
3
  import type {OptionItemProps, OptionItemState} from '@zag-js/menu';
4
4
  import type {Snippet} from 'svelte';
5
5
 
6
6
  export interface MenuOptionItemProps
7
- extends Assign<
8
- Omit<HtmlProps<'div'>, 'children'>,
9
- PickPartial<OptionItemProps, 'type' | 'checked'>
10
- > {
7
+ extends Assign<Omit<HtmlProps<'div'>, 'children'>, OptionItemProps> {
11
8
  children?: Snippet<[state: OptionItemState]>;
12
9
  }
13
10
  </script>
@@ -17,9 +14,9 @@
17
14
  import {menuContext, menuOptionItemPropsContext} from './context.svelte.js';
18
15
 
19
16
  let {
20
- type = 'checkbox',
17
+ type,
21
18
  value,
22
- checked = false,
19
+ checked,
23
20
  disabled,
24
21
  valueText,
25
22
  closeOnSelect,
@@ -30,7 +27,7 @@
30
27
 
31
28
  let context = menuContext.get();
32
29
 
33
- let itemProps = $derived({
30
+ let itemProps: OptionItemProps = $derived({
34
31
  type,
35
32
  value,
36
33
  checked,
@@ -1,6 +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
3
  id?: string | null;
4
+ defaultOpen?: boolean;
4
5
  }
5
6
  export interface CreatePopoverReturn extends popover.Api {
6
7
  }
@@ -10,6 +10,7 @@ export function createPopover(props) {
10
10
  ...props,
11
11
  id: props.id ?? createUniqueId(),
12
12
  dir: localeContext?.dir,
13
+ open: props.defaultOpen,
13
14
  getRootNode: environmentContext?.getRootNode,
14
15
  'open.controlled': props.open != null,
15
16
  }));
@@ -5,6 +5,7 @@ export interface CreateSelectProps<T> extends Omit<select.Context, 'id' | 'dir'
5
5
  itemToString?: (item: T) => string;
6
6
  itemToValue?: (item: T) => string;
7
7
  isItemDisabled?: (item: T) => boolean;
8
+ defaultOpen?: boolean;
8
9
  }
9
10
  export interface CreateSelectReturn extends select.Api {
10
11
  }
@@ -16,6 +16,7 @@ export function createSelect(props) {
16
16
  ...props,
17
17
  id: props.id ?? createUniqueId(),
18
18
  dir: localeContext?.dir,
19
+ open: props.defaultOpen,
19
20
  getRootNode: environmentContext?.getRootNode,
20
21
  collection,
21
22
  'open.controlled': props.open != null,
@@ -20,6 +20,7 @@
20
20
  form,
21
21
  name,
22
22
  open,
23
+ defaultOpen,
23
24
  value,
24
25
  items,
25
26
  invalid,
@@ -52,6 +53,7 @@
52
53
  form,
53
54
  name,
54
55
  open,
56
+ defaultOpen,
55
57
  value: $state.snapshot(value),
56
58
  items,
57
59
  invalid,
@@ -1,6 +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
3
  id?: string | null;
4
+ defaultOpen?: boolean;
4
5
  }
5
6
  export interface CreateTooltipReturn extends tooltip.Api {
6
7
  }
@@ -10,6 +10,7 @@ export function createTooltip(props) {
10
10
  ...props,
11
11
  id: props.id ?? createUniqueId(),
12
12
  dir: localeContext?.dir,
13
+ open: props.defaultOpen,
13
14
  getRootNode: environmentContext?.getRootNode,
14
15
  'open.controlled': props.open != null,
15
16
  }));
package/dist/types.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import type { SvelteHTMLElements } from 'svelte/elements';
2
2
  export type Assign<Target, Source> = Omit<Target, keyof Source> & Source;
3
- type KnownKeys<T> = keyof {
4
- [K in keyof T as string extends K ? never : number extends K ? never : K]: string;
3
+ type IntrinsicElements = keyof {
4
+ [K in keyof SvelteHTMLElements as string extends K ? never : number extends K ? never : K]: string;
5
5
  };
6
- type IntrinsicElements = KnownKeys<SvelteHTMLElements>;
7
6
  export type HtmlProps<T extends IntrinsicElements> = SvelteHTMLElements[T];
8
- export type PickPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
9
7
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui-ingredients",
3
3
  "type": "module",
4
- "version": "0.0.18",
4
+ "version": "0.0.19",
5
5
  "packageManager": "pnpm@9.7.0",
6
6
  "svelte": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -140,7 +140,7 @@
140
140
  "postcss": "8.4.41",
141
141
  "publint": "0.2.10",
142
142
  "release-it": "17.6.0",
143
- "svelte": "5.0.0-next.236",
143
+ "svelte": "5.0.0-next.238",
144
144
  "svelte-check": "3.8.6",
145
145
  "tailwindcss": "3.4.10",
146
146
  "typescript": "5.5.4",