ui-ingredients 0.0.70 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/dist/combobox/combobox-input.svelte +3 -1
  2. package/dist/editable/editable-preview.svelte +4 -1
  3. package/dist/highlight/highlight.svelte +1 -1
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +1 -0
  6. package/dist/number-input/index.d.ts +1 -0
  7. package/dist/number-input/number-input-value-text.svelte +36 -0
  8. package/dist/number-input/number-input-value-text.svelte.d.ts +21 -0
  9. package/dist/number-input/number-input.d.ts +1 -0
  10. package/dist/number-input/number-input.js +1 -0
  11. package/dist/pagination/pagination-ellipsis.svelte +5 -1
  12. package/dist/pagination/pagination-item.svelte +5 -1
  13. package/dist/pin-input/index.d.ts +1 -0
  14. package/dist/pin-input/pin-input-control.svelte +30 -0
  15. package/dist/pin-input/pin-input-control.svelte.d.ts +21 -0
  16. package/dist/pin-input/pin-input.d.ts +1 -0
  17. package/dist/pin-input/pin-input.js +1 -0
  18. package/dist/popover/index.d.ts +2 -0
  19. package/dist/popover/popover-anchor.svelte +30 -0
  20. package/dist/popover/popover-anchor.svelte.d.ts +21 -0
  21. package/dist/popover/popover-indicator.svelte +30 -0
  22. package/dist/popover/popover-indicator.svelte.d.ts +21 -0
  23. package/dist/popover/popover.d.ts +2 -0
  24. package/dist/popover/popover.js +2 -0
  25. package/dist/rating-group/rating-group-item.svelte +5 -1
  26. package/dist/select/select-trigger.svelte +3 -1
  27. package/dist/tabs/index.d.ts +1 -0
  28. package/dist/tabs/tabs-indicator.svelte +30 -0
  29. package/dist/tabs/tabs-indicator.svelte.d.ts +21 -0
  30. package/dist/tabs/tabs.d.ts +1 -0
  31. package/dist/tabs/tabs.js +1 -0
  32. package/dist/tree-view/tree-view-branch.svelte +11 -3
  33. package/dist/tree-view/tree-view-branch.svelte.d.ts +1 -1
  34. package/dist/tree-view/tree-view-context.svelte.d.ts +7 -0
  35. package/dist/tree-view/tree-view-context.svelte.js +1 -0
  36. package/dist/tree-view/tree-view-item.svelte +11 -3
  37. package/dist/tree-view/tree-view-item.svelte.d.ts +1 -1
  38. package/dist/tree-view/tree-view-tree.svelte +10 -2
  39. package/dist/tree-view/tree-view-tree.svelte.d.ts +1 -0
  40. package/package.json +2 -2
@@ -13,7 +13,9 @@
13
13
 
14
14
  let combobox = getComboboxContext();
15
15
 
16
- let mergedProps = $derived(mergeProps(combobox.getInputProps(), props));
16
+ let mergedProps = $derived(
17
+ mergeProps({'aria-expanded': false}, combobox.getInputProps(), props),
18
+ );
17
19
  </script>
18
20
 
19
21
  {#if asChild}
@@ -18,7 +18,10 @@
18
18
 
19
19
  let editable = getEditableContext();
20
20
 
21
- let mergedProps = $derived(mergeProps(editable.getPreviewProps(), props));
21
+ let mergedProps = $derived({
22
+ ...mergeProps(editable.getPreviewProps(), props),
23
+ 'aria-label': props['aria-label'] ?? undefined,
24
+ });
22
25
  </script>
23
26
 
24
27
  {#if asChild}
@@ -30,7 +30,7 @@
30
30
  {#if asChild}
31
31
  {@render asChild(localProps)}
32
32
  {:else}
33
- <div bind:this={ref} {...localProps}>
33
+ <div bind:this={ref} data-scope="highlight" data-part="root" {...localProps}>
34
34
  {#each chunks as chunk}
35
35
  {#if chunk.match}
36
36
  <mark>{chunk.text}</mark>
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export * from './highlight/index.js';
17
17
  export * from './hover-card/index.js';
18
18
  export * from './locale-provider/index.js';
19
19
  export * from './menu/index.js';
20
+ export * from './merge-props.js';
20
21
  export * from './number-input/index.js';
21
22
  export * from './pagination/index.js';
22
23
  export * from './pin-input/index.js';
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ export * from './highlight/index.js';
17
17
  export * from './hover-card/index.js';
18
18
  export * from './locale-provider/index.js';
19
19
  export * from './menu/index.js';
20
+ export * from './merge-props.js';
20
21
  export * from './number-input/index.js';
21
22
  export * from './pagination/index.js';
22
23
  export * from './pin-input/index.js';
@@ -6,5 +6,6 @@ export type { NumberInputInputProps } from './number-input-input.svelte';
6
6
  export type { NumberInputLabelProps } from './number-input-label.svelte';
7
7
  export type { NumberInputProps } from './number-input-root.svelte';
8
8
  export type { NumberInputScrubberProps } from './number-input-scrubber.svelte';
9
+ export type { NumberInputValueTextProps } from './number-input-value-text.svelte';
9
10
  export { anatomy as numberInputAnatomy } from '@zag-js/number-input';
10
11
  export { getNumberInputContext } from './number-input-context.svelte.js';
@@ -0,0 +1,36 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+
4
+ export interface NumberInputValueTextProps
5
+ extends HtmlIngredientProps<'span', HTMLSpanElement> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '../merge-props.js';
10
+ import {getNumberInputContext} from './number-input-context.svelte.js';
11
+
12
+ let {
13
+ ref = $bindable(null),
14
+ asChild,
15
+ children,
16
+ ...props
17
+ }: NumberInputValueTextProps = $props();
18
+
19
+ let numberInput = getNumberInputContext();
20
+
21
+ let mergedProps = $derived(
22
+ mergeProps(numberInput.getValueTextProps(), props),
23
+ );
24
+ </script>
25
+
26
+ {#if asChild}
27
+ {@render asChild(mergedProps)}
28
+ {:else}
29
+ <span bind:this={ref} {...mergedProps}>
30
+ {#if children}
31
+ {@render children?.()}
32
+ {:else}
33
+ {numberInput.valueAsNumber}
34
+ {/if}
35
+ </span>
36
+ {/if}
@@ -0,0 +1,21 @@
1
+ import type { HtmlIngredientProps } from '../types.js';
2
+ export interface NumberInputValueTextProps extends HtmlIngredientProps<'span', HTMLSpanElement> {
3
+ }
4
+ 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> {
5
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
6
+ $$bindings?: Bindings;
7
+ } & Exports;
8
+ (internal: unknown, props: Props & {
9
+ $$events?: Events;
10
+ $$slots?: Slots;
11
+ }): Exports & {
12
+ $set?: any;
13
+ $on?: any;
14
+ };
15
+ z_$$bindings?: Bindings;
16
+ }
17
+ declare const NumberInputValueText: $$__sveltets_2_IsomorphicComponent<NumberInputValueTextProps, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, "ref">;
20
+ type NumberInputValueText = InstanceType<typeof NumberInputValueText>;
21
+ export default NumberInputValueText;
@@ -5,3 +5,4 @@ export { default as Input } from './number-input-input.svelte';
5
5
  export { default as Label } from './number-input-label.svelte';
6
6
  export { default as Root } from './number-input-root.svelte';
7
7
  export { default as Scrubber } from './number-input-scrubber.svelte';
8
+ export { default as ValueText } from './number-input-value-text.svelte';
@@ -5,3 +5,4 @@ export { default as Input } from './number-input-input.svelte';
5
5
  export { default as Label } from './number-input-label.svelte';
6
6
  export { default as Root } from './number-input-root.svelte';
7
7
  export { default as Scrubber } from './number-input-scrubber.svelte';
8
+ export { default as ValueText } from './number-input-value-text.svelte';
@@ -32,6 +32,10 @@
32
32
  {@render asChild(mergedProps)}
33
33
  {:else}
34
34
  <span bind:this={ref} {...mergedProps}>
35
- {@render children?.()}
35
+ {#if children}
36
+ {@render children?.()}
37
+ {:else}
38
+ ...
39
+ {/if}
36
40
  </span>
37
41
  {/if}
@@ -38,6 +38,10 @@
38
38
  {@render asChild(mergedProps)}
39
39
  {:else}
40
40
  <button bind:this={ref} type="button" {...mergedProps}>
41
- {@render children?.()}
41
+ {#if children}
42
+ {@render children?.()}
43
+ {:else}
44
+ {value}
45
+ {/if}
42
46
  </button>
43
47
  {/if}
@@ -1,5 +1,6 @@
1
1
  export * as PinInput from './pin-input.js';
2
2
  export type { PinInputClearTriggerProps } from './pin-input-clear-trigger.svelte';
3
+ export type { PinInputControlProps } from './pin-input-control.svelte';
3
4
  export type { PinInputHiddenInputProps } from './pin-input-hidden-input.svelte';
4
5
  export type { PinInputInputProps } from './pin-input-input.svelte';
5
6
  export type { PinInputLabelProps } from './pin-input-label.svelte';
@@ -0,0 +1,30 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+
4
+ export interface PinInputControlProps
5
+ extends HtmlIngredientProps<'div', HTMLDivElement> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '../merge-props.js';
10
+ import {getPinInputContext} from './pin-input-context.svelte.js';
11
+
12
+ let {
13
+ ref = $bindable(null),
14
+ asChild,
15
+ children,
16
+ ...props
17
+ }: PinInputControlProps = $props();
18
+
19
+ let pinInput = getPinInputContext();
20
+
21
+ let mergedProps = $derived(mergeProps(pinInput.getControlProps(), props));
22
+ </script>
23
+
24
+ {#if asChild}
25
+ {@render asChild(mergedProps)}
26
+ {:else}
27
+ <div bind:this={ref} {...mergedProps}>
28
+ {@render children?.()}
29
+ </div>
30
+ {/if}
@@ -0,0 +1,21 @@
1
+ import type { HtmlIngredientProps } from '../types.js';
2
+ export interface PinInputControlProps extends HtmlIngredientProps<'div', HTMLDivElement> {
3
+ }
4
+ 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> {
5
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
6
+ $$bindings?: Bindings;
7
+ } & Exports;
8
+ (internal: unknown, props: Props & {
9
+ $$events?: Events;
10
+ $$slots?: Slots;
11
+ }): Exports & {
12
+ $set?: any;
13
+ $on?: any;
14
+ };
15
+ z_$$bindings?: Bindings;
16
+ }
17
+ declare const PinInputControl: $$__sveltets_2_IsomorphicComponent<PinInputControlProps, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, "ref">;
20
+ type PinInputControl = InstanceType<typeof PinInputControl>;
21
+ export default PinInputControl;
@@ -1,4 +1,5 @@
1
1
  export { default as ClearTrigger } from './pin-input-clear-trigger.svelte';
2
+ export { default as Control } from './pin-input-control.svelte';
2
3
  export { default as HiddenInput } from './pin-input-hidden-input.svelte';
3
4
  export { default as Input } from './pin-input-input.svelte';
4
5
  export { default as Label } from './pin-input-label.svelte';
@@ -1,4 +1,5 @@
1
1
  export { default as ClearTrigger } from './pin-input-clear-trigger.svelte';
2
+ export { default as Control } from './pin-input-control.svelte';
2
3
  export { default as HiddenInput } from './pin-input-hidden-input.svelte';
3
4
  export { default as Input } from './pin-input-input.svelte';
4
5
  export { default as Label } from './pin-input-label.svelte';
@@ -1,9 +1,11 @@
1
1
  export * as Popover from './popover.js';
2
+ export type { PopoverAnchorProps } from './popover-anchor.svelte';
2
3
  export type { PopoverArrowTipProps } from './popover-arrow-tip.svelte';
3
4
  export type { PopoverArrowProps } from './popover-arrow.svelte';
4
5
  export type { PopoverCloseTriggerProps } from './popover-close-trigger.svelte';
5
6
  export type { PopoverContentProps } from './popover-content.svelte';
6
7
  export type { PopoverDescriptionProps } from './popover-description.svelte';
8
+ export type { PopoverIndicatorProps } from './popover-indicator.svelte';
7
9
  export type { PopoverPositionerProps } from './popover-positioner.svelte';
8
10
  export type { PopoverProps } from './popover-root.svelte';
9
11
  export type { PopoverTitleProps } from './popover-title.svelte';
@@ -0,0 +1,30 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+
4
+ export interface PopoverAnchorProps
5
+ extends HtmlIngredientProps<'div', HTMLDivElement> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '../merge-props.js';
10
+ import {getPopoverContext} from './popover-context.svelte.js';
11
+
12
+ let {
13
+ ref = $bindable(null),
14
+ asChild,
15
+ children,
16
+ ...props
17
+ }: PopoverAnchorProps = $props();
18
+
19
+ let popover = getPopoverContext();
20
+
21
+ let mergedProps = $derived(mergeProps(popover.getAnchorProps(), props));
22
+ </script>
23
+
24
+ {#if asChild}
25
+ {@render asChild(mergedProps)}
26
+ {:else}
27
+ <div bind:this={ref} {...mergedProps}>
28
+ {@render children?.()}
29
+ </div>
30
+ {/if}
@@ -0,0 +1,21 @@
1
+ import type { HtmlIngredientProps } from '../types.js';
2
+ export interface PopoverAnchorProps extends HtmlIngredientProps<'div', HTMLDivElement> {
3
+ }
4
+ 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> {
5
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
6
+ $$bindings?: Bindings;
7
+ } & Exports;
8
+ (internal: unknown, props: Props & {
9
+ $$events?: Events;
10
+ $$slots?: Slots;
11
+ }): Exports & {
12
+ $set?: any;
13
+ $on?: any;
14
+ };
15
+ z_$$bindings?: Bindings;
16
+ }
17
+ declare const PopoverAnchor: $$__sveltets_2_IsomorphicComponent<PopoverAnchorProps, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, "ref">;
20
+ type PopoverAnchor = InstanceType<typeof PopoverAnchor>;
21
+ export default PopoverAnchor;
@@ -0,0 +1,30 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+
4
+ export interface PopoverIndicatorProps
5
+ extends HtmlIngredientProps<'span', HTMLSpanElement> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '../merge-props.js';
10
+ import {getPopoverContext} from './popover-context.svelte.js';
11
+
12
+ let {
13
+ ref = $bindable(null),
14
+ asChild,
15
+ children,
16
+ ...props
17
+ }: PopoverIndicatorProps = $props();
18
+
19
+ let popover = getPopoverContext();
20
+
21
+ let mergedProps = $derived(mergeProps(popover.getIndicatorProps(), props));
22
+ </script>
23
+
24
+ {#if asChild}
25
+ {@render asChild(mergedProps)}
26
+ {:else}
27
+ <span bind:this={ref} {...mergedProps}>
28
+ {@render children?.()}
29
+ </span>
30
+ {/if}
@@ -0,0 +1,21 @@
1
+ import type { HtmlIngredientProps } from '../types.js';
2
+ export interface PopoverIndicatorProps extends HtmlIngredientProps<'span', HTMLSpanElement> {
3
+ }
4
+ 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> {
5
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
6
+ $$bindings?: Bindings;
7
+ } & Exports;
8
+ (internal: unknown, props: Props & {
9
+ $$events?: Events;
10
+ $$slots?: Slots;
11
+ }): Exports & {
12
+ $set?: any;
13
+ $on?: any;
14
+ };
15
+ z_$$bindings?: Bindings;
16
+ }
17
+ declare const PopoverIndicator: $$__sveltets_2_IsomorphicComponent<PopoverIndicatorProps, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, "ref">;
20
+ type PopoverIndicator = InstanceType<typeof PopoverIndicator>;
21
+ export default PopoverIndicator;
@@ -1,8 +1,10 @@
1
+ export { default as Anchor } from './popover-anchor.svelte';
1
2
  export { default as ArrowTip } from './popover-arrow-tip.svelte';
2
3
  export { default as Arrow } from './popover-arrow.svelte';
3
4
  export { default as CloseTrigger } from './popover-close-trigger.svelte';
4
5
  export { default as Content } from './popover-content.svelte';
5
6
  export { default as Description } from './popover-description.svelte';
7
+ export { default as Indicator } from './popover-indicator.svelte';
6
8
  export { default as Positioner } from './popover-positioner.svelte';
7
9
  export { default as Root } from './popover-root.svelte';
8
10
  export { default as Title } from './popover-title.svelte';
@@ -1,8 +1,10 @@
1
+ export { default as Anchor } from './popover-anchor.svelte';
1
2
  export { default as ArrowTip } from './popover-arrow-tip.svelte';
2
3
  export { default as Arrow } from './popover-arrow.svelte';
3
4
  export { default as CloseTrigger } from './popover-close-trigger.svelte';
4
5
  export { default as Content } from './popover-content.svelte';
5
6
  export { default as Description } from './popover-description.svelte';
7
+ export { default as Indicator } from './popover-indicator.svelte';
6
8
  export { default as Positioner } from './popover-positioner.svelte';
7
9
  export { default as Root } from './popover-root.svelte';
8
10
  export { default as Title } from './popover-title.svelte';
@@ -25,7 +25,11 @@
25
25
 
26
26
  let itemState = $derived(ratingGroup.getItemState({index}));
27
27
  let mergedProps = $derived(
28
- mergeProps(ratingGroup.getItemProps({index}), props),
28
+ mergeProps(
29
+ {'aria-checked': itemState.checked},
30
+ ratingGroup.getItemProps({index}),
31
+ props,
32
+ ),
29
33
  );
30
34
  </script>
31
35
 
@@ -18,7 +18,9 @@
18
18
 
19
19
  let select = getSelectContext();
20
20
 
21
- let mergedProps = $derived(mergeProps(select.getTriggerProps(), props));
21
+ let mergedProps = $derived(
22
+ mergeProps({'aria-expanded': false}, select.getTriggerProps(), props),
23
+ );
22
24
  </script>
23
25
 
24
26
  {#if asChild}
@@ -1,5 +1,6 @@
1
1
  export * as Tabs from './tabs.js';
2
2
  export type { TabsContentProps } from './tabs-content.svelte';
3
+ export type { TabsIndicatorProps } from './tabs-indicator.svelte';
3
4
  export type { TabsListProps } from './tabs-list.svelte';
4
5
  export type { TabsProps } from './tabs-root.svelte';
5
6
  export type { TabsTriggerProps } from './tabs-trigger.svelte';
@@ -0,0 +1,30 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+
4
+ export interface TabsIndicatorProps
5
+ extends HtmlIngredientProps<'span', HTMLSpanElement> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '../merge-props.js';
10
+ import {getTabsContext} from './tabs-context.svelte.js';
11
+
12
+ let {
13
+ ref = $bindable(null),
14
+ asChild,
15
+ children,
16
+ ...props
17
+ }: TabsIndicatorProps = $props();
18
+
19
+ let tabs = getTabsContext();
20
+
21
+ let mergedProps = $derived(mergeProps(tabs.getIndicatorProps(), props));
22
+ </script>
23
+
24
+ {#if asChild}
25
+ {@render asChild(mergedProps)}
26
+ {:else}
27
+ <span bind:this={ref} {...mergedProps}>
28
+ {@render children?.()}
29
+ </span>
30
+ {/if}
@@ -0,0 +1,21 @@
1
+ import type { HtmlIngredientProps } from '../types.js';
2
+ export interface TabsIndicatorProps extends HtmlIngredientProps<'span', HTMLSpanElement> {
3
+ }
4
+ 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> {
5
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
6
+ $$bindings?: Bindings;
7
+ } & Exports;
8
+ (internal: unknown, props: Props & {
9
+ $$events?: Events;
10
+ $$slots?: Slots;
11
+ }): Exports & {
12
+ $set?: any;
13
+ $on?: any;
14
+ };
15
+ z_$$bindings?: Bindings;
16
+ }
17
+ declare const TabsIndicator: $$__sveltets_2_IsomorphicComponent<TabsIndicatorProps, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, "ref">;
20
+ type TabsIndicator = InstanceType<typeof TabsIndicator>;
21
+ export default TabsIndicator;
@@ -1,4 +1,5 @@
1
1
  export { default as Content } from './tabs-content.svelte';
2
+ export { default as Indicator } from './tabs-indicator.svelte';
2
3
  export { default as List } from './tabs-list.svelte';
3
4
  export { default as Root } from './tabs-root.svelte';
4
5
  export { default as Trigger } from './tabs-trigger.svelte';
package/dist/tabs/tabs.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as Content } from './tabs-content.svelte';
2
+ export { default as Indicator } from './tabs-indicator.svelte';
2
3
  export { default as List } from './tabs-list.svelte';
3
4
  export { default as Root } from './tabs-root.svelte';
4
5
  export { default as Trigger } from './tabs-trigger.svelte';
@@ -5,15 +5,17 @@
5
5
  export interface TreeViewBranchProps
6
6
  extends Assign<
7
7
  HtmlIngredientProps<'div', HTMLDivElement, BranchState>,
8
- BranchProps
8
+ Omit<BranchProps, 'depth'>
9
9
  > {}
10
10
  </script>
11
11
 
12
12
  <script lang="ts">
13
13
  import {mergeProps} from '../merge-props.js';
14
+ import {reflect} from '@zag-js/svelte';
14
15
  import {createSplitProps} from '@zag-js/utils';
15
16
  import {
16
17
  getTreeViewContext,
18
+ getTreeViewTreePropsContext,
17
19
  setTreeViewBranchPropsContext,
18
20
  } from './tree-view-context.svelte.js';
19
21
 
@@ -25,11 +27,17 @@
25
27
  }: TreeViewBranchProps = $props();
26
28
 
27
29
  let treeView = getTreeViewContext();
30
+ let treeViewProps = getTreeViewTreePropsContext();
28
31
 
29
- let [branchProps, localProps] = $derived(
30
- createSplitProps<BranchProps>(['depth', 'value', 'disabled'])(props),
32
+ let [branchPartialProps, localProps] = $derived(
33
+ createSplitProps<Omit<BranchProps, 'depth'>>(['value', 'disabled'])(props),
31
34
  );
32
35
 
36
+ let branchProps = reflect(() => ({
37
+ ...branchPartialProps,
38
+ ...treeViewProps,
39
+ }));
40
+
33
41
  let branchState = $derived(treeView.getBranchState(branchProps));
34
42
 
35
43
  let mergedProps = $derived(
@@ -1,6 +1,6 @@
1
1
  import type { Assign, HtmlIngredientProps } from '../types.js';
2
2
  import type { BranchProps, BranchState } from '@zag-js/tree-view';
3
- export interface TreeViewBranchProps extends Assign<HtmlIngredientProps<'div', HTMLDivElement, BranchState>, BranchProps> {
3
+ export interface TreeViewBranchProps extends Assign<HtmlIngredientProps<'div', HTMLDivElement, BranchState>, Omit<BranchProps, 'depth'>> {
4
4
  }
5
5
  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> {
6
6
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
@@ -3,3 +3,10 @@ import type { CreateTreeViewReturn } from './create-tree-view.svelte.js';
3
3
  export declare const getTreeViewContext: () => CreateTreeViewReturn, setTreeViewContext: (context: CreateTreeViewReturn | (() => CreateTreeViewReturn)) => void;
4
4
  export declare const getTreeViewItemPropsContext: () => ItemProps, setTreeViewItemPropsContext: (context: ItemProps | (() => ItemProps)) => void;
5
5
  export declare const getTreeViewBranchPropsContext: () => BranchProps, setTreeViewBranchPropsContext: (context: BranchProps | (() => BranchProps)) => void;
6
+ export declare const getTreeViewTreePropsContext: () => {
7
+ depth: number;
8
+ }, setTreeViewTreePropsContext: (context: {
9
+ depth: number;
10
+ } | (() => {
11
+ depth: number;
12
+ })) => void;
@@ -2,3 +2,4 @@ import { createContext } from '../create-context.svelte.js';
2
2
  export const [getTreeViewContext, setTreeViewContext] = createContext('TreeView');
3
3
  export const [getTreeViewItemPropsContext, setTreeViewItemPropsContext] = createContext('TreeViewItem');
4
4
  export const [getTreeViewBranchPropsContext, setTreeViewBranchPropsContext] = createContext('TreeViewBranch');
5
+ export const [getTreeViewTreePropsContext, setTreeViewTreePropsContext] = createContext('TreeViewTree');
@@ -5,15 +5,17 @@
5
5
  export interface TreeViewItemProps
6
6
  extends Assign<
7
7
  HtmlIngredientProps<'div', HTMLDivElement, ItemState>,
8
- ItemProps
8
+ Omit<ItemProps, 'depth'>
9
9
  > {}
10
10
  </script>
11
11
 
12
12
  <script lang="ts">
13
13
  import {mergeProps} from '../merge-props.js';
14
+ import {reflect} from '@zag-js/svelte';
14
15
  import {createSplitProps} from '@zag-js/utils';
15
16
  import {
16
17
  getTreeViewContext,
18
+ getTreeViewTreePropsContext,
17
19
  setTreeViewItemPropsContext,
18
20
  } from './tree-view-context.svelte.js';
19
21
 
@@ -25,11 +27,17 @@
25
27
  }: TreeViewItemProps = $props();
26
28
 
27
29
  let treeView = getTreeViewContext();
30
+ let treeViewProps = getTreeViewTreePropsContext();
28
31
 
29
- let [itemProps, localProps] = $derived(
30
- createSplitProps<ItemProps>(['depth', 'value', 'disabled'])(props),
32
+ let [itemPartialProps, localProps] = $derived(
33
+ createSplitProps<Omit<ItemProps, 'depth'>>(['value', 'disabled'])(props),
31
34
  );
32
35
 
36
+ let itemProps: ItemProps = reflect(() => ({
37
+ ...itemPartialProps,
38
+ ...treeViewProps,
39
+ }));
40
+
33
41
  let itemState = $derived(treeView.getItemState(itemProps));
34
42
 
35
43
  let mergedProps = $derived(
@@ -1,6 +1,6 @@
1
1
  import type { Assign, HtmlIngredientProps } from '../types.js';
2
2
  import type { ItemProps, ItemState } from '@zag-js/tree-view';
3
- export interface TreeViewItemProps extends Assign<HtmlIngredientProps<'div', HTMLDivElement, ItemState>, ItemProps> {
3
+ export interface TreeViewItemProps extends Assign<HtmlIngredientProps<'div', HTMLDivElement, ItemState>, Omit<ItemProps, 'depth'>> {
4
4
  }
5
5
  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> {
6
6
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
@@ -2,15 +2,21 @@
2
2
  import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
4
  export interface TreeViewTreeProps
5
- extends HtmlIngredientProps<'div', HTMLDivElement> {}
5
+ extends HtmlIngredientProps<'div', HTMLDivElement> {
6
+ depth?: number;
7
+ }
6
8
  </script>
7
9
 
8
10
  <script lang="ts">
9
11
  import {mergeProps} from '../merge-props.js';
10
- import {getTreeViewContext} from './tree-view-context.svelte.js';
12
+ import {
13
+ getTreeViewContext,
14
+ setTreeViewTreePropsContext,
15
+ } from './tree-view-context.svelte.js';
11
16
 
12
17
  let {
13
18
  ref = $bindable(null),
19
+ depth = 1,
14
20
  asChild,
15
21
  children,
16
22
  ...props
@@ -19,6 +25,8 @@
19
25
  let treeView = getTreeViewContext();
20
26
 
21
27
  let mergedProps = $derived(mergeProps(treeView.getTreeProps(), props));
28
+
29
+ setTreeViewTreePropsContext({depth});
22
30
  </script>
23
31
 
24
32
  {#if asChild}
@@ -1,5 +1,6 @@
1
1
  import type { HtmlIngredientProps } from '../types.js';
2
2
  export interface TreeViewTreeProps extends HtmlIngredientProps<'div', HTMLDivElement> {
3
+ depth?: number;
3
4
  }
4
5
  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> {
5
6
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "ui-ingredients",
3
3
  "type": "module",
4
4
  "license": "MIT",
5
- "version": "0.0.70",
5
+ "version": "0.1.0",
6
6
  "packageManager": "pnpm@9.7.0",
7
7
  "svelte": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
@@ -328,7 +328,7 @@
328
328
  "@sveltejs/package": "2.3.5",
329
329
  "@sveltejs/vite-plugin-svelte": "4.0.0-next.6",
330
330
  "@testing-library/jest-dom": "6.5.0",
331
- "@testing-library/svelte": "5.2.1",
331
+ "@testing-library/svelte": "5.2.3",
332
332
  "@types/jsdom": "21.1.7",
333
333
  "@untitled-theme/icons-svelte": "0.10.9",
334
334
  "autoprefixer": "10.4.20",