ui-ingredients 0.0.23 → 0.0.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +1 -0
  4. package/dist/tree-view/branch-content.svelte +21 -0
  5. package/dist/tree-view/branch-content.svelte.d.ts +18 -0
  6. package/dist/tree-view/branch-control.svelte +21 -0
  7. package/dist/tree-view/branch-control.svelte.d.ts +18 -0
  8. package/dist/tree-view/branch-indicator.svelte +21 -0
  9. package/dist/tree-view/branch-indicator.svelte.d.ts +18 -0
  10. package/dist/tree-view/branch-text.svelte +21 -0
  11. package/dist/tree-view/branch-text.svelte.d.ts +18 -0
  12. package/dist/tree-view/branch-trigger.svelte +21 -0
  13. package/dist/tree-view/branch-trigger.svelte.d.ts +18 -0
  14. package/dist/tree-view/branch.svelte +40 -0
  15. package/dist/tree-view/branch.svelte.d.ts +18 -0
  16. package/dist/tree-view/context.svelte.d.ts +6 -0
  17. package/dist/tree-view/context.svelte.js +4 -0
  18. package/dist/tree-view/create-tree-view.svelte.d.ts +7 -0
  19. package/dist/tree-view/create-tree-view.svelte.js +17 -0
  20. package/dist/tree-view/index.d.ts +13 -0
  21. package/dist/tree-view/index.js +1 -0
  22. package/dist/tree-view/item-indicator.svelte +21 -0
  23. package/dist/tree-view/item-indicator.svelte.d.ts +18 -0
  24. package/dist/tree-view/item-text.svelte +21 -0
  25. package/dist/tree-view/item-text.svelte.d.ts +18 -0
  26. package/dist/tree-view/item.svelte +39 -0
  27. package/dist/tree-view/item.svelte.d.ts +18 -0
  28. package/dist/tree-view/label.svelte +20 -0
  29. package/dist/tree-view/label.svelte.d.ts +18 -0
  30. package/dist/tree-view/root.svelte +54 -0
  31. package/dist/tree-view/root.svelte.d.ts +18 -0
  32. package/dist/tree-view/tree-view.d.ts +13 -0
  33. package/dist/tree-view/tree-view.js +13 -0
  34. package/dist/tree-view/tree.svelte +20 -0
  35. package/dist/tree-view/tree.svelte.d.ts +18 -0
  36. package/package.json +1 -1
  37. package/dist/tree-view/.gitkeep +0 -0
package/README.md CHANGED
@@ -75,6 +75,6 @@ npm install ui-ingredients
75
75
  - 🟢 ToggleGroup
76
76
  - 🟢 Tooltip
77
77
  - ⚪ Tour
78
- - 🟡 TreeView
78
+ - 🟢 TreeView
79
79
 
80
80
  View components demo [here](https://ui-ingredients.vercel.app/)
package/dist/index.d.ts CHANGED
@@ -35,3 +35,4 @@ export * from './timer/index.js';
35
35
  export * from './toast/index.js';
36
36
  export * from './toggle-group/index.js';
37
37
  export * from './tooltip/index.js';
38
+ export * from './tree-view/index.js';
package/dist/index.js CHANGED
@@ -35,3 +35,4 @@ export * from './timer/index.js';
35
35
  export * from './toast/index.js';
36
36
  export * from './toggle-group/index.js';
37
37
  export * from './tooltip/index.js';
38
+ export * from './tree-view/index.js';
@@ -0,0 +1,21 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlProps} from '../types.js';
3
+
4
+ export interface TreeViewBranchContentProps extends HtmlProps<'div'> {}
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import {mergeProps} from '@zag-js/svelte';
9
+ import {treeViewBranchPropsContext, treeViewContext} from './context.svelte.js';
10
+
11
+ let {children, ...props}: TreeViewBranchContentProps = $props();
12
+
13
+ let treeView = treeViewContext.get();
14
+ let branchProps = treeViewBranchPropsContext.get();
15
+
16
+ let attrs = $derived(mergeProps(props, treeView.getBranchContentProps(branchProps)));
17
+ </script>
18
+
19
+ <div {...attrs}>
20
+ {@render children?.()}
21
+ </div>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const BranchContent: $$__sveltets_2_IsomorphicComponent<TreeViewBranchContentProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type BranchContent = InstanceType<typeof BranchContent>;
18
+ export default BranchContent;
@@ -0,0 +1,21 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlProps} from '../types.js';
3
+
4
+ export interface TreeViewBranchControlProps extends HtmlProps<'div'> {}
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import {mergeProps} from '@zag-js/svelte';
9
+ import {treeViewBranchPropsContext, treeViewContext} from './context.svelte.js';
10
+
11
+ let {children, ...props}: TreeViewBranchControlProps = $props();
12
+
13
+ let treeView = treeViewContext.get();
14
+ let branchProps = treeViewBranchPropsContext.get();
15
+
16
+ let attrs = $derived(mergeProps(props, treeView.getBranchControlProps(branchProps)));
17
+ </script>
18
+
19
+ <div {...attrs}>
20
+ {@render children?.()}
21
+ </div>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const BranchControl: $$__sveltets_2_IsomorphicComponent<TreeViewBranchControlProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type BranchControl = InstanceType<typeof BranchControl>;
18
+ export default BranchControl;
@@ -0,0 +1,21 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlProps} from '../types.js';
3
+
4
+ export interface TreeViewBranchIndicatorProps extends HtmlProps<'span'> {}
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import {mergeProps} from '@zag-js/svelte';
9
+ import {treeViewBranchPropsContext, treeViewContext} from './context.svelte.js';
10
+
11
+ let {children, ...props}: TreeViewBranchIndicatorProps = $props();
12
+
13
+ let treeView = treeViewContext.get();
14
+ let branchProps = treeViewBranchPropsContext.get();
15
+
16
+ let attrs = $derived(mergeProps(props, treeView.getBranchIndicatorProps(branchProps)));
17
+ </script>
18
+
19
+ <span {...attrs}>
20
+ {@render children?.()}
21
+ </span>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const BranchIndicator: $$__sveltets_2_IsomorphicComponent<TreeViewBranchIndicatorProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type BranchIndicator = InstanceType<typeof BranchIndicator>;
18
+ export default BranchIndicator;
@@ -0,0 +1,21 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlProps} from '../types.js';
3
+
4
+ export interface TreeViewBranchTextProps extends HtmlProps<'span'> {}
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import {mergeProps} from '@zag-js/svelte';
9
+ import {treeViewBranchPropsContext, treeViewContext} from './context.svelte.js';
10
+
11
+ let {children, ...props}: TreeViewBranchTextProps = $props();
12
+
13
+ let treeView = treeViewContext.get();
14
+ let branchProps = treeViewBranchPropsContext.get();
15
+
16
+ let attrs = $derived(mergeProps(props, treeView.getBranchTextProps(branchProps)));
17
+ </script>
18
+
19
+ <span {...attrs}>
20
+ {@render children?.()}
21
+ </span>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const BranchText: $$__sveltets_2_IsomorphicComponent<TreeViewBranchTextProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type BranchText = InstanceType<typeof BranchText>;
18
+ export default BranchText;
@@ -0,0 +1,21 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlProps} from '../types.js';
3
+
4
+ export interface TreeViewBranchTriggerProps extends HtmlProps<'div'> {}
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import {mergeProps} from '@zag-js/svelte';
9
+ import {treeViewBranchPropsContext, treeViewContext} from './context.svelte.js';
10
+
11
+ let {children, ...props}: TreeViewBranchTriggerProps = $props();
12
+
13
+ let treeView = treeViewContext.get();
14
+ let branchProps = treeViewBranchPropsContext.get();
15
+
16
+ let attrs = $derived(mergeProps(props, treeView.getBranchTriggerProps(branchProps)));
17
+ </script>
18
+
19
+ <div {...attrs}>
20
+ {@render children?.()}
21
+ </div>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const BranchTrigger: $$__sveltets_2_IsomorphicComponent<TreeViewBranchTriggerProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type BranchTrigger = InstanceType<typeof BranchTrigger>;
18
+ export default BranchTrigger;
@@ -0,0 +1,40 @@
1
+ <script lang="ts" module>
2
+ import type {Assign, HtmlProps} from '../types.js';
3
+ import type {BranchProps, BranchState} from '@zag-js/tree-view';
4
+ import type {Snippet} from 'svelte';
5
+
6
+ export interface TreeViewBranchProps
7
+ extends Assign<Omit<HtmlProps<'div'>, 'children'>, BranchProps> {
8
+ children?: Snippet<[state: BranchState]>;
9
+ }
10
+ </script>
11
+
12
+ <script lang="ts">
13
+ import {mergeProps} from '@zag-js/svelte';
14
+ import {treeViewBranchPropsContext, treeViewContext} from './context.svelte.js';
15
+
16
+ let {
17
+ /**/
18
+ depth,
19
+ value,
20
+ disabled,
21
+ children,
22
+ ...props
23
+ }: TreeViewBranchProps = $props();
24
+
25
+ let treeView = treeViewContext.get();
26
+ let branchProps: BranchProps = $derived({
27
+ depth,
28
+ value,
29
+ disabled,
30
+ });
31
+
32
+ let attrs = $derived(mergeProps(props, treeView.getBranchProps(branchProps)));
33
+ let state = $derived(treeView.getBranchState(branchProps));
34
+
35
+ treeViewBranchPropsContext.set(() => branchProps);
36
+ </script>
37
+
38
+ <div {...attrs}>
39
+ {@render children?.(state)}
40
+ </div>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Branch: $$__sveltets_2_IsomorphicComponent<TreeViewBranchProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type Branch = InstanceType<typeof Branch>;
18
+ export default Branch;
@@ -0,0 +1,6 @@
1
+ import { Context } from '../utils.svelte.js';
2
+ import type { BranchProps, ItemProps } from '@zag-js/tree-view';
3
+ import type { CreateTreeViewReturn } from './create-tree-view.svelte.js';
4
+ export declare const treeViewContext: Context<CreateTreeViewReturn>;
5
+ export declare const treeViewItemPropsContext: Context<ItemProps>;
6
+ export declare const treeViewBranchPropsContext: Context<BranchProps>;
@@ -0,0 +1,4 @@
1
+ import { Context } from '../utils.svelte.js';
2
+ export const treeViewContext = new Context('TreeView');
3
+ export const treeViewItemPropsContext = new Context('TreeViewItem');
4
+ export const treeViewBranchPropsContext = new Context('TreeViewBranch');
@@ -0,0 +1,7 @@
1
+ import * as treeView from '@zag-js/tree-view';
2
+ export interface CreateTreeViewProps extends Omit<treeView.Context, 'id' | 'dir' | 'getRootNode'> {
3
+ id?: string | null;
4
+ }
5
+ export interface CreateTreeViewReturn extends treeView.Api {
6
+ }
7
+ export declare function createTreeView(props: CreateTreeViewProps): any;
@@ -0,0 +1,17 @@
1
+ import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
2
+ import { getLocaleContext } from '../locale-provider/context.svelte.js';
3
+ import { createUniqueId } from '../utils.svelte.js';
4
+ import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
5
+ import * as treeView from '@zag-js/tree-view';
6
+ export function createTreeView(props) {
7
+ const locale = getLocaleContext();
8
+ const environment = getEnvironmentContext();
9
+ const [state, send] = useMachine(treeView.machine({
10
+ ...props,
11
+ id: props.id ?? createUniqueId(),
12
+ dir: locale?.dir,
13
+ getRootNode: environment?.getRootNode,
14
+ }));
15
+ const api = $derived(reflect(() => treeView.connect(state, send, normalizeProps)));
16
+ return api;
17
+ }
@@ -0,0 +1,13 @@
1
+ export * as TreeView from './tree-view.js';
2
+ export type { TreeViewBranchContentProps } from './branch-content.svelte';
3
+ export type { TreeViewBranchControlProps } from './branch-control.svelte';
4
+ export type { TreeViewBranchIndicatorProps } from './branch-indicator.svelte';
5
+ export type { TreeViewBranchTextProps } from './branch-text.svelte';
6
+ export type { TreeViewBranchTriggerProps } from './branch-trigger.svelte';
7
+ export type { TreeViewBranchProps } from './branch.svelte';
8
+ export type { TreeViewItemIndicatorProps } from './item-indicator.svelte';
9
+ export type { TreeViewItemTextProps } from './item-text.svelte';
10
+ export type { TreeViewItemProps } from './item.svelte';
11
+ export type { TreeViewLabelProps } from './label.svelte';
12
+ export type { TreeViewProps } from './root.svelte';
13
+ export type { TreeViewTreeProps } from './tree.svelte';
@@ -0,0 +1 @@
1
+ export * as TreeView from './tree-view.js';
@@ -0,0 +1,21 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlProps} from '../types.js';
3
+
4
+ export interface TreeViewItemIndicatorProps extends HtmlProps<'span'> {}
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import {mergeProps} from '@zag-js/svelte';
9
+ import {treeViewContext, treeViewItemPropsContext} from './context.svelte.js';
10
+
11
+ let {children, ...props}: TreeViewItemIndicatorProps = $props();
12
+
13
+ let treeView = treeViewContext.get();
14
+ let itemProps = treeViewItemPropsContext.get();
15
+
16
+ let attrs = $derived(mergeProps(props, treeView.getItemIndicatorProps(itemProps)));
17
+ </script>
18
+
19
+ <span {...attrs}>
20
+ {@render children?.()}
21
+ </span>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const ItemIndicator: $$__sveltets_2_IsomorphicComponent<TreeViewItemIndicatorProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type ItemIndicator = InstanceType<typeof ItemIndicator>;
18
+ export default ItemIndicator;
@@ -0,0 +1,21 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlProps} from '../types.js';
3
+
4
+ export interface TreeViewItemTextProps extends HtmlProps<'span'> {}
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import {mergeProps} from '@zag-js/svelte';
9
+ import {treeViewContext, treeViewItemPropsContext} from './context.svelte.js';
10
+
11
+ let {children, ...props}: TreeViewItemTextProps = $props();
12
+
13
+ let treeView = treeViewContext.get();
14
+ let itemProps = treeViewItemPropsContext.get();
15
+
16
+ let attrs = $derived(mergeProps(props, treeView.getItemTextProps(itemProps)));
17
+ </script>
18
+
19
+ <span {...attrs}>
20
+ {@render children?.()}
21
+ </span>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const ItemText: $$__sveltets_2_IsomorphicComponent<TreeViewItemTextProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type ItemText = InstanceType<typeof ItemText>;
18
+ export default ItemText;
@@ -0,0 +1,39 @@
1
+ <script lang="ts" module>
2
+ import type {Assign, HtmlProps} from '../types.js';
3
+ import type {ItemProps, ItemState} from '@zag-js/tree-view';
4
+ import type {Snippet} from 'svelte';
5
+
6
+ export interface TreeViewItemProps extends Assign<Omit<HtmlProps<'div'>, 'children'>, ItemProps> {
7
+ children?: Snippet<[state: ItemState]>;
8
+ }
9
+ </script>
10
+
11
+ <script lang="ts">
12
+ import {mergeProps} from '@zag-js/svelte';
13
+ import {treeViewContext, treeViewItemPropsContext} from './context.svelte.js';
14
+
15
+ let {
16
+ /**/
17
+ depth,
18
+ value,
19
+ disabled,
20
+ children,
21
+ ...props
22
+ }: TreeViewItemProps = $props();
23
+
24
+ let treeView = treeViewContext.get();
25
+ let itemProps: ItemProps = $derived({
26
+ depth,
27
+ value,
28
+ disabled,
29
+ });
30
+
31
+ let attrs = $derived(mergeProps(props, treeView.getItemProps(itemProps)));
32
+ let state = $derived(treeView.getItemState(itemProps));
33
+
34
+ treeViewItemPropsContext.set(() => itemProps);
35
+ </script>
36
+
37
+ <div {...attrs}>
38
+ {@render children?.(state)}
39
+ </div>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Item: $$__sveltets_2_IsomorphicComponent<TreeViewItemProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type Item = InstanceType<typeof Item>;
18
+ export default Item;
@@ -0,0 +1,20 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlProps} from '../types.js';
3
+
4
+ export interface TreeViewLabelProps extends HtmlProps<'span'> {}
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import {mergeProps} from '@zag-js/svelte';
9
+ import {treeViewContext} from './context.svelte.js';
10
+
11
+ let {children, ...props}: TreeViewLabelProps = $props();
12
+
13
+ let treeView = treeViewContext.get();
14
+
15
+ let attrs = $derived(mergeProps(props, treeView.getLabelProps()));
16
+ </script>
17
+
18
+ <span {...attrs}>
19
+ {@render children?.()}
20
+ </span>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Label: $$__sveltets_2_IsomorphicComponent<TreeViewLabelProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type Label = InstanceType<typeof Label>;
18
+ export default Label;
@@ -0,0 +1,54 @@
1
+ <script lang="ts" module>
2
+ import type {Assign, HtmlProps} from '../types.js';
3
+ import type {Snippet} from 'svelte';
4
+ import type {CreateTreeViewProps, CreateTreeViewReturn} from './create-tree-view.svelte.js';
5
+
6
+ export interface TreeViewProps
7
+ extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreateTreeViewProps> {
8
+ children?: Snippet<[treeView: CreateTreeViewReturn]>;
9
+ }
10
+ </script>
11
+
12
+ <script lang="ts">
13
+ import {mergeProps} from '@zag-js/svelte';
14
+ import {treeViewContext} from './context.svelte.js';
15
+ import {createTreeView} from './create-tree-view.svelte.js';
16
+
17
+ let {
18
+ id,
19
+ ids,
20
+ typeahead,
21
+ focusedValue,
22
+ expandedValue,
23
+ expandOnClick,
24
+ selectedValue,
25
+ selectionMode,
26
+ onFocusChange,
27
+ onExpandedChange,
28
+ onSelectionChange,
29
+ children,
30
+ ...props
31
+ }: TreeViewProps = $props();
32
+
33
+ let treeView = createTreeView({
34
+ id,
35
+ ids,
36
+ typeahead,
37
+ focusedValue,
38
+ expandedValue,
39
+ expandOnClick,
40
+ selectedValue,
41
+ selectionMode,
42
+ onFocusChange,
43
+ onExpandedChange,
44
+ onSelectionChange,
45
+ });
46
+
47
+ let attrs = $derived(mergeProps(props, treeView.getRootProps()));
48
+
49
+ treeViewContext.set(treeView);
50
+ </script>
51
+
52
+ <div {...attrs}>
53
+ {@render children?.(treeView)}
54
+ </div>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Root: $$__sveltets_2_IsomorphicComponent<TreeViewProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type Root = InstanceType<typeof Root>;
18
+ export default Root;
@@ -0,0 +1,13 @@
1
+ export { anatomy } from '@zag-js/tree-view';
2
+ export { default as BranchContent } from './branch-content.svelte';
3
+ export { default as BranchControl } from './branch-control.svelte';
4
+ export { default as BranchIndicator } from './branch-indicator.svelte';
5
+ export { default as BranchText } from './branch-text.svelte';
6
+ export { default as BranchTrigger } from './branch-trigger.svelte';
7
+ export { default as Branch } from './branch.svelte';
8
+ export { default as ItemIndicator } from './item-indicator.svelte';
9
+ export { default as ItemText } from './item-text.svelte';
10
+ export { default as Item } from './item.svelte';
11
+ export { default as Label } from './label.svelte';
12
+ export { default as Root } from './root.svelte';
13
+ export { default as Tree } from './tree.svelte';
@@ -0,0 +1,13 @@
1
+ export { anatomy } from '@zag-js/tree-view';
2
+ export { default as BranchContent } from './branch-content.svelte';
3
+ export { default as BranchControl } from './branch-control.svelte';
4
+ export { default as BranchIndicator } from './branch-indicator.svelte';
5
+ export { default as BranchText } from './branch-text.svelte';
6
+ export { default as BranchTrigger } from './branch-trigger.svelte';
7
+ export { default as Branch } from './branch.svelte';
8
+ export { default as ItemIndicator } from './item-indicator.svelte';
9
+ export { default as ItemText } from './item-text.svelte';
10
+ export { default as Item } from './item.svelte';
11
+ export { default as Label } from './label.svelte';
12
+ export { default as Root } from './root.svelte';
13
+ export { default as Tree } from './tree.svelte';
@@ -0,0 +1,20 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlProps} from '../types.js';
3
+
4
+ export interface TreeViewTreeProps extends HtmlProps<'div'> {}
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import {mergeProps} from '@zag-js/svelte';
9
+ import {treeViewContext} from './context.svelte.js';
10
+
11
+ let {children, ...props}: TreeViewTreeProps = $props();
12
+
13
+ let treeView = treeViewContext.get();
14
+
15
+ let attrs = $derived(mergeProps(props, treeView.getTreeProps()));
16
+ </script>
17
+
18
+ <div {...attrs}>
19
+ {@render children?.()}
20
+ </div>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Tree: $$__sveltets_2_IsomorphicComponent<TreeViewTreeProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type Tree = InstanceType<typeof Tree>;
18
+ export default Tree;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui-ingredients",
3
3
  "type": "module",
4
- "version": "0.0.23",
4
+ "version": "0.0.24",
5
5
  "packageManager": "pnpm@9.7.0",
6
6
  "svelte": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
File without changes