@ark-ui/svelte 5.1.1 → 5.3.0

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 (64) hide show
  1. package/dist/components/checkbox/checkbox-group-provider.svelte +24 -0
  2. package/dist/components/checkbox/checkbox-group-provider.svelte.d.ts +10 -0
  3. package/dist/components/checkbox/checkbox-group.svelte +2 -2
  4. package/dist/components/checkbox/checkbox.d.ts +1 -0
  5. package/dist/components/checkbox/checkbox.js +1 -0
  6. package/dist/components/checkbox/index.d.ts +2 -1
  7. package/dist/components/checkbox/index.js +2 -1
  8. package/dist/components/checkbox/use-checkbox-group-context.d.ts +1 -1
  9. package/dist/components/checkbox/use-checkbox-group-context.js +1 -1
  10. package/dist/components/collection/index.d.ts +2 -1
  11. package/dist/components/collection/index.js +2 -1
  12. package/dist/components/collection/use-list-selection.svelte.d.ts +104 -0
  13. package/dist/components/collection/use-list-selection.svelte.js +91 -0
  14. package/dist/components/combobox/combobox-context.svelte.d.ts +10 -3
  15. package/dist/components/combobox/combobox-root-provider.svelte.d.ts +10 -3
  16. package/dist/components/combobox/combobox-root.svelte.d.ts +10 -3
  17. package/dist/components/factory/factory.svelte.d.ts +11 -4
  18. package/dist/components/factory/svg-factory.svelte.d.ts +11 -4
  19. package/dist/components/file-upload/file-upload-root.svelte +8 -1
  20. package/dist/components/file-upload/file-upload-root.svelte.d.ts +1 -1
  21. package/dist/components/file-upload/file-upload.d.ts +1 -1
  22. package/dist/components/file-upload/index.d.ts +1 -1
  23. package/dist/components/index.d.ts +1 -0
  24. package/dist/components/index.js +1 -0
  25. package/dist/components/json-tree-view/get-branch-value.d.ts +3 -0
  26. package/dist/components/json-tree-view/get-branch-value.js +13 -0
  27. package/dist/components/json-tree-view/index.d.ts +5 -0
  28. package/dist/components/json-tree-view/index.js +5 -0
  29. package/dist/components/json-tree-view/json-tree-view-key-node.svelte +23 -0
  30. package/dist/components/json-tree-view/json-tree-view-key-node.svelte.d.ts +14 -0
  31. package/dist/components/json-tree-view/json-tree-view-node.svelte +102 -0
  32. package/dist/components/json-tree-view/json-tree-view-node.svelte.d.ts +24 -0
  33. package/dist/components/json-tree-view/json-tree-view-props-context.d.ts +8 -0
  34. package/dist/components/json-tree-view/json-tree-view-props-context.js +6 -0
  35. package/dist/components/json-tree-view/json-tree-view-root-provider.svelte +12 -0
  36. package/dist/components/json-tree-view/json-tree-view-root-provider.svelte.d.ts +7 -0
  37. package/dist/components/json-tree-view/json-tree-view-root.svelte +54 -0
  38. package/dist/components/json-tree-view/json-tree-view-root.svelte.d.ts +18 -0
  39. package/dist/components/json-tree-view/json-tree-view-tree.svelte +23 -0
  40. package/dist/components/json-tree-view/json-tree-view-tree.svelte.d.ts +9 -0
  41. package/dist/components/json-tree-view/json-tree-view-value-node.svelte +31 -0
  42. package/dist/components/json-tree-view/json-tree-view-value-node.svelte.d.ts +10 -0
  43. package/dist/components/json-tree-view/json-tree-view.d.ts +3 -0
  44. package/dist/components/json-tree-view/json-tree-view.js +3 -0
  45. package/dist/components/json-tree-view/use-json-tree-view.svelte.d.ts +10 -0
  46. package/dist/components/json-tree-view/use-json-tree-view.svelte.js +23 -0
  47. package/dist/components/listbox/listbox-context.svelte.d.ts +10 -3
  48. package/dist/components/listbox/listbox-root-provider.svelte.d.ts +10 -3
  49. package/dist/components/listbox/listbox-root.svelte.d.ts +10 -3
  50. package/dist/components/portal/portal.svelte +38 -3
  51. package/dist/components/portal/portal.svelte.d.ts +10 -0
  52. package/dist/components/select/select-context.svelte.d.ts +10 -3
  53. package/dist/components/select/select-item.svelte.d.ts +10 -3
  54. package/dist/components/select/select-root-provider.svelte.d.ts +10 -3
  55. package/dist/components/select/select-root.svelte.d.ts +10 -3
  56. package/dist/components/signature-pad/signature-pad-root.svelte +10 -3
  57. package/dist/components/signature-pad/signature-pad-root.svelte.d.ts +1 -1
  58. package/dist/components/tour/tour.anatomy.d.ts +1 -1
  59. package/dist/components/tree-view/tree-view-node-context.svelte.d.ts +10 -3
  60. package/dist/components/tree-view/tree-view-node-provider.svelte.d.ts +10 -3
  61. package/dist/components/tree-view/tree-view-root-provider.svelte.d.ts +10 -3
  62. package/dist/components/tree-view/tree-view-root.svelte.d.ts +10 -3
  63. package/dist/components/tree-view/tree-view-split-props.d.ts +1 -1
  64. package/package.json +69 -68
@@ -0,0 +1,24 @@
1
+ <script module lang="ts">
2
+ import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
3
+ import type { UseCheckboxGroupReturn } from './use-checkbox-group.svelte'
4
+
5
+ export interface CheckboxGroupProviderBaseProps extends PolymorphicProps<'div'>, RefAttribute {
6
+ value: UseCheckboxGroupReturn
7
+ }
8
+ export interface CheckboxGroupProviderProps extends Assign<HTMLProps<'div'>, CheckboxGroupProviderBaseProps> {}
9
+ </script>
10
+
11
+ <script lang="ts">
12
+ import { mergeProps } from '@zag-js/svelte'
13
+ import { Ark } from '../factory'
14
+ import { CheckboxGroupContextProvider } from './use-checkbox-group-context'
15
+ import { checkboxAnatomy } from './checkbox.anatomy'
16
+
17
+ let { ref = $bindable(null), value, ...props }: CheckboxGroupProviderProps = $props()
18
+
19
+ const mergedProps = $derived(mergeProps({ role: 'group', ...checkboxAnatomy.build().group.attrs }, props))
20
+
21
+ CheckboxGroupContextProvider(value)
22
+ </script>
23
+
24
+ <Ark as="div" bind:ref {...mergedProps} />
@@ -0,0 +1,10 @@
1
+ import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
2
+ import type { UseCheckboxGroupReturn } from './use-checkbox-group.svelte';
3
+ export interface CheckboxGroupProviderBaseProps extends PolymorphicProps<'div'>, RefAttribute {
4
+ value: UseCheckboxGroupReturn;
5
+ }
6
+ export interface CheckboxGroupProviderProps extends Assign<HTMLProps<'div'>, CheckboxGroupProviderBaseProps> {
7
+ }
8
+ declare const CheckboxGroupProvider: import("svelte").Component<CheckboxGroupProviderProps, {}, "ref">;
9
+ type CheckboxGroupProvider = ReturnType<typeof CheckboxGroupProvider>;
10
+ export default CheckboxGroupProvider;
@@ -9,7 +9,7 @@
9
9
  <script lang="ts">
10
10
  import { Ark } from '../factory'
11
11
  import { checkboxAnatomy } from './checkbox.anatomy'
12
- import { CheckboxGroupProvider } from './use-checkbox-group-context'
12
+ import { CheckboxGroupContextProvider } from './use-checkbox-group-context'
13
13
  import { splitCheckboxGroupProps } from './split-checkbox-group-props.svelte'
14
14
  import { useCheckboxGroup } from './use-checkbox-group.svelte'
15
15
 
@@ -28,7 +28,7 @@
28
28
 
29
29
  const checkboxGroup = useCheckboxGroup(() => resolvedProps)
30
30
 
31
- CheckboxGroupProvider(checkboxGroup)
31
+ CheckboxGroupContextProvider(checkboxGroup)
32
32
  </script>
33
33
 
34
34
  <Ark as="div" bind:ref role="group" {...checkboxAnatomy.build().group.attrs} {...localProps} />
@@ -2,6 +2,7 @@ export type { CheckedChangeDetails, CheckedState } from '@zag-js/checkbox';
2
2
  export { default as Context, type CheckboxContextProps as ContextProps } from './checkbox-context.svelte';
3
3
  export { default as Control, type CheckboxControlBaseProps as ControlBaseProps, type CheckboxControlProps as ControlProps, } from './checkbox-control.svelte';
4
4
  export { default as Group, type CheckboxGroupBaseProps as GroupBaseProps, type CheckboxGroupProps as GroupProps, } from './checkbox-group.svelte';
5
+ export { default as GroupProvider, type CheckboxGroupProviderBaseProps as GroupProviderBaseProps, type CheckboxGroupProviderProps as GroupProviderProps, } from './checkbox-group-provider.svelte';
5
6
  export { default as HiddenInput, type CheckboxHiddenInputBaseProps as HiddenInputBaseProps, type CheckboxHiddenInputProps as HiddenInputProps, } from './checkbox-hidden-input.svelte';
6
7
  export { default as Indicator, type CheckboxIndicatorBaseProps as IndicatorBaseProps, type CheckboxIndicatorProps as IndicatorProps, } from './checkbox-indicator.svelte';
7
8
  export { default as Label, type CheckboxLabelBaseProps as LabelBaseProps, type CheckboxLabelProps as LabelProps, } from './checkbox-label.svelte';
@@ -1,6 +1,7 @@
1
1
  export { default as Context } from './checkbox-context.svelte';
2
2
  export { default as Control, } from './checkbox-control.svelte';
3
3
  export { default as Group, } from './checkbox-group.svelte';
4
+ export { default as GroupProvider, } from './checkbox-group-provider.svelte';
4
5
  export { default as HiddenInput, } from './checkbox-hidden-input.svelte';
5
6
  export { default as Indicator, } from './checkbox-indicator.svelte';
6
7
  export { default as Label, } from './checkbox-label.svelte';
@@ -2,6 +2,7 @@ export type { CheckedChangeDetails as CheckboxCheckedChangeDetails, CheckedState
2
2
  export { default as CheckboxContext, type CheckboxContextProps } from './checkbox-context.svelte';
3
3
  export { default as CheckboxControl, type CheckboxControlBaseProps, type CheckboxControlProps, } from './checkbox-control.svelte';
4
4
  export { default as CheckboxGroup, type CheckboxGroupBaseProps, type CheckboxGroupProps } from './checkbox-group.svelte';
5
+ export { default as CheckboxGroupProvider, type CheckboxGroupProviderBaseProps, type CheckboxGroupProviderProps, } from './checkbox-group-provider.svelte';
5
6
  export { default as CheckboxHiddenInput, type CheckboxHiddenInputBaseProps, type CheckboxHiddenInputProps, } from './checkbox-hidden-input.svelte';
6
7
  export { default as CheckboxIndicator, type CheckboxIndicatorBaseProps, type CheckboxIndicatorProps, } from './checkbox-indicator.svelte';
7
8
  export { default as CheckboxLabel, type CheckboxLabelBaseProps, type CheckboxLabelProps } from './checkbox-label.svelte';
@@ -10,7 +11,7 @@ export { default as CheckboxRoot, type CheckboxRootBaseProps, type CheckboxRootP
10
11
  export { checkboxAnatomy } from './checkbox.anatomy';
11
12
  export { CheckboxProvider, useCheckboxContext } from './use-checkbox-context';
12
13
  export type { UseCheckboxContext } from './use-checkbox-context';
13
- export { CheckboxGroupProvider, useCheckboxGroupContext } from './use-checkbox-group-context';
14
+ export { useCheckboxGroupContext } from './use-checkbox-group-context';
14
15
  export type { UseCheckboxGroupContext } from './use-checkbox-group-context';
15
16
  export { useCheckboxGroup } from './use-checkbox-group.svelte';
16
17
  export type { UseCheckboxGroupProps, UseCheckboxGroupReturn } from './use-checkbox-group.svelte';
@@ -1,6 +1,7 @@
1
1
  export { default as CheckboxContext } from './checkbox-context.svelte';
2
2
  export { default as CheckboxControl, } from './checkbox-control.svelte';
3
3
  export { default as CheckboxGroup } from './checkbox-group.svelte';
4
+ export { default as CheckboxGroupProvider, } from './checkbox-group-provider.svelte';
4
5
  export { default as CheckboxHiddenInput, } from './checkbox-hidden-input.svelte';
5
6
  export { default as CheckboxIndicator, } from './checkbox-indicator.svelte';
6
7
  export { default as CheckboxLabel } from './checkbox-label.svelte';
@@ -8,7 +9,7 @@ export { default as CheckboxRootProvider, } from './checkbox-root-provider.svelt
8
9
  export { default as CheckboxRoot } from './checkbox-root.svelte';
9
10
  export { checkboxAnatomy } from './checkbox.anatomy';
10
11
  export { CheckboxProvider, useCheckboxContext } from './use-checkbox-context';
11
- export { CheckboxGroupProvider, useCheckboxGroupContext } from './use-checkbox-group-context';
12
+ export { useCheckboxGroupContext } from './use-checkbox-group-context';
12
13
  export { useCheckboxGroup } from './use-checkbox-group.svelte';
13
14
  export { useCheckbox } from './use-checkbox.svelte';
14
15
  export * as Checkbox from './checkbox';
@@ -1,4 +1,4 @@
1
1
  import type { UseCheckboxGroupReturn } from './use-checkbox-group.svelte';
2
2
  export interface UseCheckboxGroupContext extends UseCheckboxGroupReturn {
3
3
  }
4
- export declare const CheckboxGroupProvider: (opts: UseCheckboxGroupContext) => void, useCheckboxGroupContext: (fallback?: UseCheckboxGroupContext | undefined) => UseCheckboxGroupContext;
4
+ export declare const CheckboxGroupContextProvider: (opts: UseCheckboxGroupContext) => void, useCheckboxGroupContext: (fallback?: UseCheckboxGroupContext | undefined) => UseCheckboxGroupContext;
@@ -1,5 +1,5 @@
1
1
  import { createContext } from '../../utils/create-context';
2
- export const [CheckboxGroupProvider, useCheckboxGroupContext] = createContext({
2
+ export const [CheckboxGroupContextProvider, useCheckboxGroupContext] = createContext({
3
3
  name: 'CheckboxGroupContext',
4
4
  strict: false,
5
5
  });
@@ -1,4 +1,5 @@
1
1
  export { createGridCollection, type GridCollection, type GridCollectionOptions } from './grid-collection';
2
2
  export { createListCollection, type CollectionItem, type CollectionOptions, type ListCollection, } from './list-collection';
3
3
  export { createFileTreeCollection, createTreeCollection, type FilePathTreeNode, type FlatTreeNode, type TreeCollection, type TreeCollectionOptions, type TreeNode, } from './tree-collection';
4
- export { useListCollection, type UseListCollectionProps } from './use-list-collection.svelte';
4
+ export { useListCollection, type UseListCollectionProps, type UseListCollectionReturn, } from './use-list-collection.svelte';
5
+ export { useListSelection, type UseListSelectionProps, type UseListSelectionReturn } from './use-list-selection.svelte';
@@ -1,4 +1,5 @@
1
1
  export { createGridCollection } from './grid-collection';
2
2
  export { createListCollection, } from './list-collection';
3
3
  export { createFileTreeCollection, createTreeCollection, } from './tree-collection';
4
- export { useListCollection } from './use-list-collection.svelte';
4
+ export { useListCollection, } from './use-list-collection.svelte';
5
+ export { useListSelection } from './use-list-selection.svelte';
@@ -0,0 +1,104 @@
1
+ import { type SelectionMode } from '@zag-js/collection';
2
+ import { type MaybeFunction } from '@zag-js/utils';
3
+ import type { CollectionItem, ListCollection } from './list-collection';
4
+ export interface UseListSelectionProps<T extends CollectionItem> {
5
+ /**
6
+ * The selection mode.
7
+ */
8
+ selectionMode?: SelectionMode;
9
+ /**
10
+ * Whether the selection is deselectable.
11
+ */
12
+ deselectable?: boolean;
13
+ /**
14
+ * The initial selected values.
15
+ */
16
+ initialSelectedValues?: string[];
17
+ /**
18
+ * Whether to reset the selection when the collection changes.
19
+ */
20
+ resetOnCollectionChange?: boolean;
21
+ /**
22
+ * The collection to use.
23
+ */
24
+ collection: ListCollection<T>;
25
+ }
26
+ export declare function useListSelection<T extends CollectionItem>(props: MaybeFunction<UseListSelectionProps<T>>): UseListSelectionReturn;
27
+ export interface UseListSelectionReturn {
28
+ /**
29
+ * The selected values as an array.
30
+ */
31
+ selectedValues: () => string[];
32
+ /**
33
+ * Whether the selection is empty.
34
+ */
35
+ isEmpty: () => boolean;
36
+ /**
37
+ * The first selected value.
38
+ */
39
+ firstSelectedValue: () => string | null;
40
+ /**
41
+ * The last selected value.
42
+ */
43
+ lastSelectedValue: () => string | null;
44
+ /**
45
+ * Check if a value is selected.
46
+ */
47
+ isSelected: (value: string | null) => boolean;
48
+ /**
49
+ * Check if a value can be selected.
50
+ */
51
+ canSelect: (value: string) => boolean;
52
+ /**
53
+ * Select a value.
54
+ */
55
+ select: (value: string, forceToggle?: boolean) => void;
56
+ /**
57
+ * Deselect a value.
58
+ */
59
+ deselect: (value: string) => void;
60
+ /**
61
+ * Toggle selection of a value.
62
+ */
63
+ toggle: (value: string) => void;
64
+ /**
65
+ * Replace the selection with a single value.
66
+ */
67
+ replace: (value: string | null) => void;
68
+ /**
69
+ * Extend the selection from anchor to target.
70
+ */
71
+ extend: (anchorValue: string, targetValue: string) => void;
72
+ /**
73
+ * Set the selected values.
74
+ */
75
+ setSelectedValues: (values: string[]) => void;
76
+ /**
77
+ * Clear the selection.
78
+ */
79
+ clear: () => void;
80
+ /**
81
+ * Clear all selections.
82
+ */
83
+ resetSelection: () => void;
84
+ /**
85
+ * Returns true if all items from the collection are selected.
86
+ */
87
+ isAllSelected: () => boolean;
88
+ /**
89
+ * Returns true if at least one item from the collection is selected.
90
+ */
91
+ isSomeSelected: () => boolean;
92
+ /**
93
+ * Set the selection to a specific array of items.
94
+ */
95
+ setSelection: (selection: string[]) => void;
96
+ /**
97
+ * Set the selection mode.
98
+ */
99
+ setSelectionMode: (mode: SelectionMode) => void;
100
+ /**
101
+ * Set whether the selection is deselectable.
102
+ */
103
+ setDeselectable: (deselectable: boolean) => void;
104
+ }
@@ -0,0 +1,91 @@
1
+ import { Selection } from '@zag-js/collection';
2
+ import { runIfFn } from '@zag-js/utils';
3
+ export function useListSelection(props) {
4
+ const localProps = $derived.by(() => {
5
+ const { collection, selectionMode = 'single', deselectable = true, initialSelectedValues = [], resetOnCollectionChange = false, } = runIfFn(props);
6
+ return {
7
+ collection,
8
+ selectionMode,
9
+ deselectable,
10
+ initialSelectedValues,
11
+ resetOnCollectionChange,
12
+ };
13
+ });
14
+ const createSelection = (values = []) => {
15
+ const selection = new Selection(values);
16
+ selection.selectionMode = localProps.selectionMode;
17
+ selection.deselectable = localProps.deselectable;
18
+ return selection;
19
+ };
20
+ let selection = $state(createSelection(localProps.initialSelectedValues));
21
+ // Watch for collection changes and reset selection if needed
22
+ $effect(() => {
23
+ const { collection, resetOnCollectionChange } = localProps;
24
+ // Trigger effect when collection values change
25
+ collection.getValues();
26
+ if (resetOnCollectionChange) {
27
+ selection = createSelection();
28
+ }
29
+ });
30
+ const selectedValues = $derived(Array.from(selection));
31
+ const isEmpty = $derived(selection.isEmpty());
32
+ const firstSelectedValue = $derived(selection.firstSelectedValue(localProps.collection));
33
+ const lastSelectedValue = $derived(selection.lastSelectedValue(localProps.collection));
34
+ return {
35
+ selectedValues: () => selectedValues,
36
+ isEmpty: () => isEmpty,
37
+ firstSelectedValue: () => firstSelectedValue,
38
+ lastSelectedValue: () => lastSelectedValue,
39
+ isSelected: (value) => {
40
+ return selection.isSelected(value);
41
+ },
42
+ isAllSelected: () => {
43
+ const allValues = localProps.collection.getValues();
44
+ return allValues.length > 0 && allValues.every((value) => selection.isSelected(value));
45
+ },
46
+ isSomeSelected: () => {
47
+ const allValues = localProps.collection.getValues();
48
+ return allValues.some((value) => selection.isSelected(value));
49
+ },
50
+ canSelect: (value) => {
51
+ return selection.canSelect(localProps.collection, value);
52
+ },
53
+ select: (value, forceToggle) => {
54
+ selection = selection.select(localProps.collection, value, forceToggle);
55
+ },
56
+ deselect: (value) => {
57
+ selection = selection.deselect(value);
58
+ },
59
+ toggle: (value) => {
60
+ selection = selection.toggleSelection(localProps.collection, value);
61
+ },
62
+ replace: (value) => {
63
+ selection = selection.replaceSelection(localProps.collection, value);
64
+ },
65
+ extend: (anchorValue, targetValue) => {
66
+ selection = selection.extendSelection(localProps.collection, anchorValue, targetValue);
67
+ },
68
+ setSelectedValues: (values) => {
69
+ selection = selection.setSelection(values);
70
+ },
71
+ clear: () => {
72
+ selection = selection.clearSelection();
73
+ },
74
+ resetSelection: () => {
75
+ selection = createSelection();
76
+ },
77
+ setSelection: (newSelection) => {
78
+ selection = selection.setSelection(newSelection);
79
+ },
80
+ setSelectionMode: (mode) => {
81
+ const newSelection = selection.copy();
82
+ newSelection.selectionMode = mode;
83
+ selection = newSelection;
84
+ },
85
+ setDeselectable: (deselectable) => {
86
+ const newSelection = selection.copy();
87
+ newSelection.deselectable = deselectable;
88
+ selection = newSelection;
89
+ },
90
+ };
91
+ }
@@ -4,10 +4,17 @@ import type { UseComboboxContext } from './use-combobox-context';
4
4
  export interface ComboboxContextProps<T extends CollectionItem> {
5
5
  render: Snippet<[UseComboboxContext<T>]>;
6
6
  }
7
+ declare function $$render<T extends CollectionItem>(): {
8
+ props: ComboboxContextProps<T>;
9
+ exports: {};
10
+ bindings: "";
11
+ slots: {};
12
+ events: {};
13
+ };
7
14
  declare class __sveltets_Render<T extends CollectionItem> {
8
- props(): ComboboxContextProps<T>;
9
- events(): {};
10
- slots(): {};
15
+ props(): ReturnType<typeof $$render<T>>['props'];
16
+ events(): ReturnType<typeof $$render<T>>['events'];
17
+ slots(): ReturnType<typeof $$render<T>>['slots'];
11
18
  bindings(): "";
12
19
  exports(): {};
13
20
  }
@@ -11,10 +11,17 @@ export interface ComboboxRootProviderBaseProps<T extends CollectionItem> extends
11
11
  }
12
12
  export interface ComboboxRootProviderProps<T extends CollectionItem> extends Assign<HTMLProps<'div'>, ComboboxRootProviderBaseProps<T>> {
13
13
  }
14
+ declare function $$render<T extends CollectionItem>(): {
15
+ props: ComboboxRootProviderProps<T>;
16
+ exports: {};
17
+ bindings: "ref";
18
+ slots: {};
19
+ events: {};
20
+ };
14
21
  declare class __sveltets_Render<T extends CollectionItem> {
15
- props(): ComboboxRootProviderProps<T>;
16
- events(): {};
17
- slots(): {};
22
+ props(): ReturnType<typeof $$render<T>>['props'];
23
+ events(): ReturnType<typeof $$render<T>>['events'];
24
+ slots(): ReturnType<typeof $$render<T>>['slots'];
18
25
  bindings(): "ref";
19
26
  exports(): {};
20
27
  }
@@ -6,10 +6,17 @@ export interface ComboboxRootBaseProps<T extends CollectionItem> extends UseComb
6
6
  }
7
7
  export interface ComboboxRootProps<T extends CollectionItem> extends Assign<HTMLProps<'div'>, ComboboxRootBaseProps<T>> {
8
8
  }
9
+ declare function $$render<T extends CollectionItem>(): {
10
+ props: ComboboxRootProps<T>;
11
+ exports: {};
12
+ bindings: "ref" | "value" | "open" | "inputValue";
13
+ slots: {};
14
+ events: {};
15
+ };
9
16
  declare class __sveltets_Render<T extends CollectionItem> {
10
- props(): ComboboxRootProps<T>;
11
- events(): {};
12
- slots(): {};
17
+ props(): ReturnType<typeof $$render<T>>['props'];
18
+ events(): ReturnType<typeof $$render<T>>['events'];
19
+ slots(): ReturnType<typeof $$render<T>>['slots'];
13
20
  bindings(): "ref" | "value" | "open" | "inputValue";
14
21
  exports(): {};
15
22
  }
@@ -1,7 +1,7 @@
1
1
  import type { HTMLProps, PolymorphicProps } from '../../types';
2
2
  import type { SvelteHTMLElements } from 'svelte/elements';
3
- declare class __sveltets_Render<T extends keyof SvelteHTMLElements> {
4
- props(): HTMLProps<T> & PolymorphicProps<T> & {
3
+ declare function $$render<T extends keyof SvelteHTMLElements>(): {
4
+ props: HTMLProps<T> & PolymorphicProps<T> & {
5
5
  /**
6
6
  * The HTML tag of the component.
7
7
  */
@@ -11,8 +11,15 @@ declare class __sveltets_Render<T extends keyof SvelteHTMLElements> {
11
11
  */
12
12
  ref?: Element | null;
13
13
  };
14
- events(): {};
15
- slots(): {};
14
+ exports: {};
15
+ bindings: "ref";
16
+ slots: {};
17
+ events: {};
18
+ };
19
+ declare class __sveltets_Render<T extends keyof SvelteHTMLElements> {
20
+ props(): ReturnType<typeof $$render<T>>['props'];
21
+ events(): ReturnType<typeof $$render<T>>['events'];
22
+ slots(): ReturnType<typeof $$render<T>>['slots'];
16
23
  bindings(): "ref";
17
24
  exports(): {};
18
25
  }
@@ -1,12 +1,19 @@
1
1
  import type { HTMLProps, PolymorphicProps } from '../../types';
2
2
  import type { SvelteHTMLElements } from 'svelte/elements';
3
- declare class __sveltets_Render<T extends keyof SvelteHTMLElements> {
4
- props(): HTMLProps<T> & PolymorphicProps<T> & {
3
+ declare function $$render<T extends keyof SvelteHTMLElements>(): {
4
+ props: HTMLProps<T> & PolymorphicProps<T> & {
5
5
  as: T;
6
6
  ref?: Element | null;
7
7
  };
8
- events(): {};
9
- slots(): {};
8
+ exports: {};
9
+ bindings: "ref";
10
+ slots: {};
11
+ events: {};
12
+ };
13
+ declare class __sveltets_Render<T extends keyof SvelteHTMLElements> {
14
+ props(): ReturnType<typeof $$render<T>>['props'];
15
+ events(): ReturnType<typeof $$render<T>>['events'];
16
+ slots(): ReturnType<typeof $$render<T>>['slots'];
10
17
  bindings(): "ref";
11
18
  exports(): {};
12
19
  }
@@ -13,14 +13,16 @@
13
13
  import { FileUploadProvider } from './use-file-upload-context'
14
14
  import { useFileUpload } from './use-file-upload.svelte'
15
15
 
16
- let { ref = $bindable(null), ...props }: FileUploadRootProps = $props()
16
+ let { ref = $bindable(null), acceptedFiles = $bindable(), ...props }: FileUploadRootProps = $props()
17
17
  const providedId = $props.id()
18
18
 
19
19
  const [useFileUploadProps, localProps] = $derived(
20
20
  createSplitProps<UseFileUploadProps>()(props, [
21
21
  'accept',
22
+ 'acceptedFiles',
22
23
  'allowDrop',
23
24
  'capture',
25
+ 'defaultAcceptedFiles',
24
26
  'directory',
25
27
  'disabled',
26
28
  'id',
@@ -45,6 +47,11 @@
45
47
  const resolvedProps = $derived<UseFileUploadProps>({
46
48
  ...useFileUploadProps,
47
49
  id: useFileUploadProps.id ?? providedId,
50
+ acceptedFiles,
51
+ onFileChange: (details) => {
52
+ useFileUploadProps.onFileChange?.(details)
53
+ if (acceptedFiles !== undefined) acceptedFiles = details.acceptedFiles
54
+ },
48
55
  })
49
56
 
50
57
  const fileUpload = useFileUpload(() => resolvedProps)
@@ -4,6 +4,6 @@ export interface FileUploadRootBaseProps extends UseFileUploadProps, Polymorphic
4
4
  }
5
5
  export interface FileUploadRootProps extends Assign<HTMLProps<'div'>, FileUploadRootBaseProps> {
6
6
  }
7
- declare const FileUploadRoot: import("svelte").Component<FileUploadRootProps, {}, "ref">;
7
+ declare const FileUploadRoot: import("svelte").Component<FileUploadRootProps, {}, "ref" | "acceptedFiles">;
8
8
  type FileUploadRoot = ReturnType<typeof FileUploadRoot>;
9
9
  export default FileUploadRoot;
@@ -1,4 +1,4 @@
1
- export type { FileAcceptDetails, FileChangeDetails, FileRejectDetails, FileValidateDetails } from '@zag-js/file-upload';
1
+ export type { FileAcceptDetails, FileChangeDetails, FileRejectDetails, FileValidateDetails, FileError, FileMimeType, FileRejection, } from '@zag-js/file-upload';
2
2
  export { default as ClearTrigger, type FileUploadClearTriggerBaseProps as ClearTriggerBaseProps, type FileUploadClearTriggerProps as ClearTriggerProps, } from './file-upload-clear-trigger.svelte';
3
3
  export { default as Context, type FileUploadContextProps as ContextProps } from './file-upload-context.svelte';
4
4
  export { default as Dropzone, type FileUploadDropzoneBaseProps as DropzoneBaseProps, type FileUploadDropzoneProps as DropzoneProps, } from './file-upload-dropzone.svelte';
@@ -1,4 +1,4 @@
1
- export type { FileAcceptDetails as FileUploadFileAcceptDetails, FileChangeDetails as FileUploadFileChangeDetails, FileRejectDetails as FileUploadFileRejectDetails, FileValidateDetails as FileUploadFileValidateDetails, } from '@zag-js/file-upload';
1
+ export type { FileAcceptDetails as FileUploadFileAcceptDetails, FileChangeDetails as FileUploadFileChangeDetails, FileRejectDetails as FileUploadFileRejectDetails, FileValidateDetails as FileUploadFileValidateDetails, FileError as FileUploadFileError, FileMimeType as FileUploadFileMimeType, FileRejection as FileUploadFileRejection, } from '@zag-js/file-upload';
2
2
  export { default as FileUploadClearTrigger, type FileUploadClearTriggerBaseProps, type FileUploadClearTriggerProps, } from './file-upload-clear-trigger.svelte';
3
3
  export { default as FileUploadContext, type FileUploadContextProps } from './file-upload-context.svelte';
4
4
  export { default as FileUploadDropzone, type FileUploadDropzoneBaseProps, type FileUploadDropzoneProps, } from './file-upload-dropzone.svelte';
@@ -23,6 +23,7 @@ export * from './format';
23
23
  export * from './frame';
24
24
  export * from './highlight';
25
25
  export * from './hover-card';
26
+ export * from './json-tree-view';
26
27
  export * from './listbox';
27
28
  export * from './menu';
28
29
  export * from './number-input';
@@ -23,6 +23,7 @@ export * from './format';
23
23
  export * from './frame';
24
24
  export * from './highlight';
25
25
  export * from './hover-card';
26
+ export * from './json-tree-view';
26
27
  export * from './listbox';
27
28
  export * from './menu';
28
29
  export * from './number-input';
@@ -0,0 +1,3 @@
1
+ import type { TreeCollection } from '@zag-js/collection';
2
+ import type { JsonNode } from '@zag-js/json-tree-utils';
3
+ export declare function getBranchValues(tree: TreeCollection<JsonNode>, depth: number): string[];
@@ -0,0 +1,13 @@
1
+ export function getBranchValues(tree, depth) {
2
+ let values = [];
3
+ tree.visit({
4
+ onEnter: (node, indexPath) => {
5
+ if (indexPath.length === 0)
6
+ return;
7
+ if (tree.isBranchNode(node) && indexPath.length <= depth) {
8
+ values.push(tree.getNodeValue(node));
9
+ }
10
+ },
11
+ });
12
+ return values;
13
+ }
@@ -0,0 +1,5 @@
1
+ export { default as JsonTreeViewRoot, type JsonTreeViewRootBaseProps, type JsonTreeViewRootProps, } from './json-tree-view-root.svelte';
2
+ export { default as JsonTreeViewRootProvider, type JsonTreeViewRootProviderProps, } from './json-tree-view-root-provider.svelte';
3
+ export { default as JsonTreeViewTree, type JsonTreeViewTreeBaseProps, type JsonTreeViewTreeProps, } from './json-tree-view-tree.svelte';
4
+ export { useJsonTreeView, type UseJsonTreeViewProps, type UseJsonTreeViewReturn } from './use-json-tree-view.svelte';
5
+ export * as JsonTreeView from './json-tree-view';
@@ -0,0 +1,5 @@
1
+ export { default as JsonTreeViewRoot, } from './json-tree-view-root.svelte';
2
+ export { default as JsonTreeViewRootProvider, } from './json-tree-view-root-provider.svelte';
3
+ export { default as JsonTreeViewTree, } from './json-tree-view-tree.svelte';
4
+ export { useJsonTreeView } from './use-json-tree-view.svelte';
5
+ export * as JsonTreeView from './json-tree-view';
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import { type JsonNode, keyPathToKey } from '@zag-js/json-tree-utils'
3
+
4
+ interface JsonTreeViewKeyNodeProps {
5
+ /**
6
+ * The node to render.
7
+ */
8
+ node: JsonNode
9
+ /**
10
+ * Whether to show quotes on the key.
11
+ */
12
+ showQuotes?: boolean
13
+ }
14
+
15
+ let { node, showQuotes }: JsonTreeViewKeyNodeProps = $props()
16
+
17
+ const key = $derived(keyPathToKey(node.keyPath))
18
+ </script>
19
+
20
+ <span data-kind="key" data-non-enumerable={node.isNonEnumerable ? '' : undefined}>
21
+ {showQuotes ? `"${key}"` : key}
22
+ </span>
23
+ <span data-kind="colon">:</span>
@@ -0,0 +1,14 @@
1
+ import { type JsonNode } from '@zag-js/json-tree-utils';
2
+ interface JsonTreeViewKeyNodeProps {
3
+ /**
4
+ * The node to render.
5
+ */
6
+ node: JsonNode;
7
+ /**
8
+ * Whether to show quotes on the key.
9
+ */
10
+ showQuotes?: boolean;
11
+ }
12
+ declare const JsonTreeViewKeyNode: import("svelte").Component<JsonTreeViewKeyNodeProps, {}, "">;
13
+ type JsonTreeViewKeyNode = ReturnType<typeof JsonTreeViewKeyNode>;
14
+ export default JsonTreeViewKeyNode;