svelora 3.0.6 → 3.0.7

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 (157) hide show
  1. package/dist/BentoGrid/BentoCard.svelte +45 -0
  2. package/dist/BentoGrid/BentoCard.svelte.d.ts +4 -0
  3. package/dist/BentoGrid/BentoGrid.svelte +9 -0
  4. package/dist/BentoGrid/BentoGrid.svelte.d.ts +4 -0
  5. package/dist/BentoGrid/bento-grid.types.d.ts +47 -0
  6. package/dist/BentoGrid/bento-grid.types.js +1 -0
  7. package/dist/BentoGrid/bento-grid.variants.d.ts +30 -0
  8. package/dist/BentoGrid/bento-grid.variants.js +16 -0
  9. package/dist/BentoGrid/index.d.ts +5 -0
  10. package/dist/BentoGrid/index.js +5 -0
  11. package/dist/Chart/Chart.svelte +47 -0
  12. package/dist/Chart/Chart.svelte.d.ts +4 -0
  13. package/dist/Chart/chart.types.d.ts +20 -0
  14. package/dist/Chart/chart.types.js +1 -0
  15. package/dist/Chart/chart.variants.d.ts +3 -0
  16. package/dist/Chart/chart.variants.js +4 -0
  17. package/dist/Chart/index.d.ts +4 -0
  18. package/dist/Chart/index.js +4 -0
  19. package/dist/Chat/ChatBubble.svelte +30 -0
  20. package/dist/Chat/ChatBubble.svelte.d.ts +4 -0
  21. package/dist/Chat/ChatInput.svelte +50 -0
  22. package/dist/Chat/ChatInput.svelte.d.ts +4 -0
  23. package/dist/Chat/ChatMessage.svelte +15 -0
  24. package/dist/Chat/ChatMessage.svelte.d.ts +4 -0
  25. package/dist/Chat/chat.types.d.ts +63 -0
  26. package/dist/Chat/chat.types.js +1 -0
  27. package/dist/Chat/chat.variants.d.ts +117 -0
  28. package/dist/Chat/chat.variants.js +47 -0
  29. package/dist/Chat/index.d.ts +6 -0
  30. package/dist/Chat/index.js +6 -0
  31. package/dist/ColorPicker/ColorPicker.svelte +109 -0
  32. package/dist/ColorPicker/ColorPicker.svelte.d.ts +4 -0
  33. package/dist/ColorPicker/color-picker.types.d.ts +26 -0
  34. package/dist/ColorPicker/color-picker.types.js +1 -0
  35. package/dist/ColorPicker/color-picker.variants.d.ts +69 -0
  36. package/dist/ColorPicker/color-picker.variants.js +13 -0
  37. package/dist/ColorPicker/index.d.ts +4 -0
  38. package/dist/ColorPicker/index.js +4 -0
  39. package/dist/DateRangePicker/DateRangePicker.svelte +59 -0
  40. package/dist/DateRangePicker/DateRangePicker.svelte.d.ts +4 -0
  41. package/dist/DateRangePicker/date-range-picker.types.d.ts +34 -0
  42. package/dist/DateRangePicker/date-range-picker.types.js +1 -0
  43. package/dist/DateRangePicker/date-range-picker.variants.d.ts +39 -0
  44. package/dist/DateRangePicker/date-range-picker.variants.js +20 -0
  45. package/dist/DateRangePicker/index.d.ts +4 -0
  46. package/dist/DateRangePicker/index.js +4 -0
  47. package/dist/List/List.svelte +14 -0
  48. package/dist/List/List.svelte.d.ts +4 -0
  49. package/dist/List/ListItem.svelte +64 -0
  50. package/dist/List/ListItem.svelte.d.ts +4 -0
  51. package/dist/List/index.d.ts +5 -0
  52. package/dist/List/index.js +5 -0
  53. package/dist/List/list.types.d.ts +62 -0
  54. package/dist/List/list.types.js +1 -0
  55. package/dist/List/list.variants.d.ts +99 -0
  56. package/dist/List/list.variants.js +42 -0
  57. package/dist/Marquee/Marquee.svelte +50 -0
  58. package/dist/Marquee/Marquee.svelte.d.ts +4 -0
  59. package/dist/Marquee/index.d.ts +4 -0
  60. package/dist/Marquee/index.js +4 -0
  61. package/dist/Marquee/marquee.types.d.ts +38 -0
  62. package/dist/Marquee/marquee.types.js +1 -0
  63. package/dist/Marquee/marquee.variants.d.ts +78 -0
  64. package/dist/Marquee/marquee.variants.js +28 -0
  65. package/dist/Menu/Menu.svelte +134 -0
  66. package/dist/Menu/Menu.svelte.d.ts +4 -0
  67. package/dist/Menu/index.d.ts +4 -0
  68. package/dist/Menu/index.js +4 -0
  69. package/dist/Menu/menu.types.d.ts +82 -0
  70. package/dist/Menu/menu.types.js +1 -0
  71. package/dist/Menu/menu.variants.d.ts +46 -0
  72. package/dist/Menu/menu.variants.js +32 -0
  73. package/dist/NumberTicker/NumberTicker.svelte +59 -0
  74. package/dist/NumberTicker/NumberTicker.svelte.d.ts +4 -0
  75. package/dist/NumberTicker/index.d.ts +4 -0
  76. package/dist/NumberTicker/index.js +4 -0
  77. package/dist/NumberTicker/number-ticker.types.d.ts +26 -0
  78. package/dist/NumberTicker/number-ticker.types.js +1 -0
  79. package/dist/NumberTicker/number-ticker.variants.d.ts +27 -0
  80. package/dist/NumberTicker/number-ticker.variants.js +6 -0
  81. package/dist/PasswordInput/PasswordInput.svelte +74 -0
  82. package/dist/PasswordInput/PasswordInput.svelte.d.ts +4 -0
  83. package/dist/PasswordInput/index.d.ts +4 -0
  84. package/dist/PasswordInput/index.js +4 -0
  85. package/dist/PasswordInput/password-input.types.d.ts +18 -0
  86. package/dist/PasswordInput/password-input.types.js +1 -0
  87. package/dist/PasswordInput/password-input.variants.d.ts +57 -0
  88. package/dist/PasswordInput/password-input.variants.js +11 -0
  89. package/dist/Prose/Prose.svelte +13 -0
  90. package/dist/Prose/Prose.svelte.d.ts +4 -0
  91. package/dist/Prose/index.d.ts +4 -0
  92. package/dist/Prose/index.js +4 -0
  93. package/dist/Prose/prose.types.d.ts +22 -0
  94. package/dist/Prose/prose.types.js +1 -0
  95. package/dist/Prose/prose.variants.d.ts +45 -0
  96. package/dist/Prose/prose.variants.js +45 -0
  97. package/dist/Rating/Rating.svelte +93 -0
  98. package/dist/Rating/Rating.svelte.d.ts +4 -0
  99. package/dist/Rating/index.d.ts +4 -0
  100. package/dist/Rating/index.js +4 -0
  101. package/dist/Rating/rating.types.d.ts +59 -0
  102. package/dist/Rating/rating.types.js +1 -0
  103. package/dist/Rating/rating.variants.d.ts +93 -0
  104. package/dist/Rating/rating.variants.js +32 -0
  105. package/dist/Resizable/Resizable.svelte +9 -0
  106. package/dist/Resizable/Resizable.svelte.d.ts +4 -0
  107. package/dist/Resizable/index.d.ts +4 -0
  108. package/dist/Resizable/index.js +4 -0
  109. package/dist/Resizable/resizable.types.d.ts +18 -0
  110. package/dist/Resizable/resizable.types.js +1 -0
  111. package/dist/Resizable/resizable.variants.d.ts +48 -0
  112. package/dist/Resizable/resizable.variants.js +17 -0
  113. package/dist/ScrollArea/ScrollArea.svelte +54 -0
  114. package/dist/ScrollArea/ScrollArea.svelte.d.ts +4 -0
  115. package/dist/ScrollArea/index.d.ts +4 -0
  116. package/dist/ScrollArea/index.js +4 -0
  117. package/dist/ScrollArea/scroll-area.types.d.ts +27 -0
  118. package/dist/ScrollArea/scroll-area.types.js +1 -0
  119. package/dist/ScrollArea/scroll-area.variants.d.ts +45 -0
  120. package/dist/ScrollArea/scroll-area.variants.js +27 -0
  121. package/dist/Sidebar/Sidebar.svelte +30 -0
  122. package/dist/Sidebar/Sidebar.svelte.d.ts +4 -0
  123. package/dist/Sidebar/index.d.ts +4 -0
  124. package/dist/Sidebar/index.js +4 -0
  125. package/dist/Sidebar/sidebar.types.d.ts +31 -0
  126. package/dist/Sidebar/sidebar.types.js +1 -0
  127. package/dist/Sidebar/sidebar.variants.d.ts +69 -0
  128. package/dist/Sidebar/sidebar.variants.js +23 -0
  129. package/dist/Spotlight/Spotlight.svelte +31 -0
  130. package/dist/Spotlight/Spotlight.svelte.d.ts +4 -0
  131. package/dist/Spotlight/index.d.ts +4 -0
  132. package/dist/Spotlight/index.js +4 -0
  133. package/dist/Spotlight/spotlight.types.d.ts +22 -0
  134. package/dist/Spotlight/spotlight.types.js +1 -0
  135. package/dist/Spotlight/spotlight.variants.d.ts +39 -0
  136. package/dist/Spotlight/spotlight.variants.js +8 -0
  137. package/dist/TagsInput/TagsInput.svelte +100 -0
  138. package/dist/TagsInput/TagsInput.svelte.d.ts +4 -0
  139. package/dist/TagsInput/index.d.ts +4 -0
  140. package/dist/TagsInput/index.js +4 -0
  141. package/dist/TagsInput/tags-input.types.d.ts +32 -0
  142. package/dist/TagsInput/tags-input.types.js +1 -0
  143. package/dist/TagsInput/tags-input.variants.d.ts +45 -0
  144. package/dist/TagsInput/tags-input.variants.js +22 -0
  145. package/dist/TreeView/TreeView.svelte +95 -0
  146. package/dist/TreeView/TreeView.svelte.d.ts +4 -0
  147. package/dist/TreeView/index.d.ts +4 -0
  148. package/dist/TreeView/index.js +4 -0
  149. package/dist/TreeView/tree-view.types.d.ts +68 -0
  150. package/dist/TreeView/tree-view.types.js +1 -0
  151. package/dist/TreeView/tree-view.variants.d.ts +69 -0
  152. package/dist/TreeView/tree-view.variants.js +30 -0
  153. package/dist/docs/navigation.js +108 -0
  154. package/dist/index.d.ts +18 -0
  155. package/dist/index.js +18 -0
  156. package/dist/mcp/svelora-docs.data.json +39 -3
  157. package/package.json +8 -6
@@ -0,0 +1,39 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ export declare const spotlightVariants: import("tailwind-variants").TVReturnType<{
3
+ [key: string]: {
4
+ [key: string]: import("tailwind-merge").ClassNameValue | {
5
+ content?: import("tailwind-merge").ClassNameValue;
6
+ root?: import("tailwind-merge").ClassNameValue;
7
+ spotlight?: import("tailwind-merge").ClassNameValue;
8
+ };
9
+ };
10
+ } | {
11
+ [x: string]: {
12
+ [x: string]: import("tailwind-merge").ClassNameValue | {
13
+ content?: import("tailwind-merge").ClassNameValue;
14
+ root?: import("tailwind-merge").ClassNameValue;
15
+ spotlight?: import("tailwind-merge").ClassNameValue;
16
+ };
17
+ };
18
+ } | {}, {
19
+ root: string;
20
+ spotlight: string;
21
+ content: string;
22
+ }, undefined, {
23
+ [key: string]: {
24
+ [key: string]: import("tailwind-merge").ClassNameValue | {
25
+ content?: import("tailwind-merge").ClassNameValue;
26
+ root?: import("tailwind-merge").ClassNameValue;
27
+ spotlight?: import("tailwind-merge").ClassNameValue;
28
+ };
29
+ };
30
+ } | {}, {
31
+ root: string;
32
+ spotlight: string;
33
+ content: string;
34
+ }, import("tailwind-variants").TVReturnType<unknown, {
35
+ root: string;
36
+ spotlight: string;
37
+ content: string;
38
+ }, undefined, unknown, unknown, undefined>>;
39
+ export type SpotlightVariantProps = VariantProps<typeof spotlightVariants>;
@@ -0,0 +1,8 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const spotlightVariants = tv({
3
+ slots: {
4
+ root: 'relative overflow-hidden group',
5
+ spotlight: 'pointer-events-none absolute -inset-px rounded-xl opacity-0 transition-opacity duration-300 group-hover:opacity-100',
6
+ content: 'relative z-10 h-full w-full'
7
+ }
8
+ });
@@ -0,0 +1,100 @@
1
+ <script lang="ts">import { twMerge } from "tailwind-merge";
2
+ import Icon from "../Icon/Icon.svelte";
3
+ import { tagsInputVariants } from "./tags-input.variants.js";
4
+ let { value = $bindable([]), placeholder = "Add a tag...", disabled = false, maxTags, separators = [",", "Enter"], class: className, onchange, ...restProps } = $props();
5
+ let styles = $derived(tagsInputVariants({ disabled }));
6
+ let inputValue = $state("");
7
+ let inputRef = $state(null);
8
+ function addTag(tag) {
9
+ const t = tag.trim();
10
+ if (!t) return;
11
+ if (maxTags && value.length >= maxTags) return;
12
+ if (value.includes(t)) return;
13
+ value = [...value, t];
14
+ inputValue = "";
15
+ onchange?.(value);
16
+ }
17
+ function removeTag(index) {
18
+ if (disabled) return;
19
+ value = value.filter((_, i) => i !== index);
20
+ onchange?.(value);
21
+ }
22
+ function handleKeyDown(e) {
23
+ if (disabled) return;
24
+ // Backspace to remove last tag if input is empty
25
+ if (e.key === "Backspace" && inputValue === "" && value.length > 0) {
26
+ removeTag(value.length - 1);
27
+ return;
28
+ }
29
+ // Add tag on separator
30
+ if (separators.includes(e.key)) {
31
+ e.preventDefault();
32
+ addTag(inputValue);
33
+ }
34
+ }
35
+ // Also handle pasting comma-separated values
36
+ function handlePaste(e) {
37
+ if (disabled) return;
38
+ const pasteData = e.clipboardData?.getData("text");
39
+ if (pasteData) {
40
+ e.preventDefault();
41
+ const tags = pasteData.split(separators.includes(",") ? "," : "\n").map((t) => t.trim()).filter(Boolean);
42
+ let newTags = [...value];
43
+ for (const t of tags) {
44
+ if (maxTags && newTags.length >= maxTags) break;
45
+ if (!newTags.includes(t)) {
46
+ newTags.push(t);
47
+ }
48
+ }
49
+ if (newTags.length !== value.length) {
50
+ value = newTags;
51
+ onchange?.(value);
52
+ }
53
+ }
54
+ }
55
+ function handleContainerClick() {
56
+ if (!disabled && inputRef) {
57
+ inputRef.focus();
58
+ }
59
+ }
60
+ </script>
61
+
62
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
63
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
64
+ <div
65
+ class={twMerge(styles.base() as any, className)}
66
+ onclick={handleContainerClick}
67
+ {...restProps}
68
+ >
69
+ {#each value as tag, i}
70
+ <span class={styles.tag() as any}>
71
+ <span class={styles.tagText() as any}>{tag}</span>
72
+ <button
73
+ type="button"
74
+ class={styles.removeButton() as any}
75
+ onclick={(e) => {
76
+ e.stopPropagation()
77
+ removeTag(i)
78
+ }}
79
+ {disabled}
80
+ aria-label={`Remove tag ${tag}`}
81
+ >
82
+ <Icon name="lucide:x" class="w-3 h-3" />
83
+ </button>
84
+ </span>
85
+ {/each}
86
+
87
+ {#if !maxTags || value.length < maxTags}
88
+ <input
89
+ bind:this={inputRef}
90
+ bind:value={inputValue}
91
+ type="text"
92
+ {placeholder}
93
+ {disabled}
94
+ class={styles.input() as any}
95
+ onkeydown={handleKeyDown}
96
+ onpaste={handlePaste}
97
+ onblur={() => addTag(inputValue)}
98
+ />
99
+ {/if}
100
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { TagsInputProps } from './tags-input.types.js';
2
+ declare const TagsInput: import("svelte").Component<TagsInputProps, {}, "value">;
3
+ type TagsInput = ReturnType<typeof TagsInput>;
4
+ export default TagsInput;
@@ -0,0 +1,4 @@
1
+ import TagsInput from './TagsInput.svelte';
2
+ export { TagsInput };
3
+ export * from './tags-input.types.js';
4
+ export * from './tags-input.variants.js';
@@ -0,0 +1,4 @@
1
+ import TagsInput from './TagsInput.svelte';
2
+ export { TagsInput };
3
+ export * from './tags-input.types.js';
4
+ export * from './tags-input.variants.js';
@@ -0,0 +1,32 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ export interface TagsInputProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onchange'> {
3
+ /**
4
+ * Array of tag strings.
5
+ */
6
+ value?: string[];
7
+ /**
8
+ * Placeholder text for the input field.
9
+ */
10
+ placeholder?: string;
11
+ /**
12
+ * Whether the input is disabled.
13
+ */
14
+ disabled?: boolean;
15
+ /**
16
+ * Maximum number of tags allowed.
17
+ */
18
+ maxTags?: number;
19
+ /**
20
+ * Array of characters that trigger tag creation.
21
+ * @default [',', 'Enter']
22
+ */
23
+ separators?: string[];
24
+ /**
25
+ * Additional CSS classes.
26
+ */
27
+ class?: string;
28
+ /**
29
+ * Event fired when tags change.
30
+ */
31
+ onchange?: (tags: string[]) => void;
32
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,45 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ export declare const tagsInputVariants: import("tailwind-variants").TVReturnType<{
3
+ disabled: {
4
+ true: {
5
+ base: string;
6
+ input: string;
7
+ removeButton: string;
8
+ };
9
+ };
10
+ }, {
11
+ base: string;
12
+ tag: string;
13
+ tagText: string;
14
+ removeButton: string;
15
+ input: string;
16
+ }, undefined, {
17
+ disabled: {
18
+ true: {
19
+ base: string;
20
+ input: string;
21
+ removeButton: string;
22
+ };
23
+ };
24
+ }, {
25
+ base: string;
26
+ tag: string;
27
+ tagText: string;
28
+ removeButton: string;
29
+ input: string;
30
+ }, import("tailwind-variants").TVReturnType<{
31
+ disabled: {
32
+ true: {
33
+ base: string;
34
+ input: string;
35
+ removeButton: string;
36
+ };
37
+ };
38
+ }, {
39
+ base: string;
40
+ tag: string;
41
+ tagText: string;
42
+ removeButton: string;
43
+ input: string;
44
+ }, undefined, unknown, unknown, undefined>>;
45
+ export type TagsInputVariantProps = VariantProps<typeof tagsInputVariants>;
@@ -0,0 +1,22 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const tagsInputVariants = tv({
3
+ slots: {
4
+ base: 'flex flex-wrap items-center gap-2 p-2 w-full rounded-md border border-outline-variant bg-surface-50 dark:bg-surface-900 focus-within:ring-2 focus-within:ring-primary focus-within:border-primary transition-colors cursor-text',
5
+ tag: 'flex items-center gap-1 px-2.5 py-1 text-sm rounded-full bg-surface-200 dark:bg-surface-800 text-surface-900 dark:text-surface-50',
6
+ tagText: 'truncate max-w-[150px]',
7
+ removeButton: 'flex items-center justify-center w-4 h-4 rounded-full hover:bg-surface-300 dark:hover:bg-surface-700 transition-colors focus:outline-none focus:ring-2 focus:ring-primary',
8
+ input: 'flex-1 min-w-[120px] bg-transparent border-0 outline-none focus:ring-0 text-sm text-surface-900 dark:text-surface-50 placeholder:text-surface-500 dark:placeholder:text-surface-400 p-1'
9
+ },
10
+ variants: {
11
+ disabled: {
12
+ true: {
13
+ base: 'opacity-50 cursor-not-allowed',
14
+ input: 'cursor-not-allowed',
15
+ removeButton: 'pointer-events-none'
16
+ }
17
+ }
18
+ },
19
+ defaultVariants: {
20
+ disabled: false
21
+ }
22
+ });
@@ -0,0 +1,95 @@
1
+ <script lang="ts">import { twMerge } from "tailwind-merge";
2
+ import Icon from "../Icon/Icon.svelte";
3
+ import { treeViewVariants } from "./tree-view.variants.js";
4
+ let { items = [], selectedIds = [], expandedIds = $bindable([]), size = "md", expandOnRowClick = true, class: className, onItemClick, onItemExpand, labelSnippet, ...restProps } = $props();
5
+ let styles = $derived(treeViewVariants({ size }));
6
+ // Internal state tracking for faster lookup
7
+ let expandedSet = $derived(new Set(expandedIds));
8
+ let selectedSet = $derived(new Set(selectedIds));
9
+ function toggleExpand(e, item) {
10
+ e.stopPropagation();
11
+ if (item.disabled || !item.children?.length) return;
12
+ const isExpanded = expandedSet.has(item.id);
13
+ if (isExpanded) {
14
+ expandedIds = expandedIds.filter((id) => id !== item.id);
15
+ } else {
16
+ expandedIds = [...expandedIds, item.id];
17
+ }
18
+ onItemExpand?.(item, !isExpanded);
19
+ }
20
+ function handleRowClick(e, item) {
21
+ if (item.disabled) return;
22
+ if (expandOnRowClick && item.children?.length) {
23
+ toggleExpand(e, item);
24
+ }
25
+ onItemClick?.(item);
26
+ }
27
+ </script>
28
+
29
+ {#snippet renderTree(treeItems: TreeItem[])}
30
+ <div class={styles.root()}>
31
+ {#each treeItems as item}
32
+ {@const hasChildren = item.children && item.children.length > 0}
33
+ {@const isExpanded = expandedSet.has(item.id)}
34
+ {@const isSelected = selectedSet.has(item.id)}
35
+
36
+ <div class={styles.item()}>
37
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
38
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
39
+ <div
40
+ class={twMerge(
41
+ styles.itemRow(),
42
+ isSelected && styles.itemRowActive(),
43
+ item.disabled && styles.itemRowDisabled()
44
+ )}
45
+ onclick={(e) => handleRowClick(e, item)}
46
+ >
47
+ <!-- Chevron / Spacer -->
48
+ <div class={styles.chevronWrapper()}>
49
+ {#if hasChildren}
50
+ <button
51
+ type="button"
52
+ class="w-full h-full flex items-center justify-center outline-none"
53
+ onclick={(e) => {
54
+ if (!expandOnRowClick) toggleExpand(e, item)
55
+ }}
56
+ tabindex="-1"
57
+ disabled={item.disabled}
58
+ >
59
+ <Icon
60
+ name="lucide:chevron-right"
61
+ class={twMerge(styles.chevron(), isExpanded && 'rotate-90')}
62
+ />
63
+ </button>
64
+ {/if}
65
+ </div>
66
+
67
+ <!-- Icon -->
68
+ {#if item.icon}
69
+ <Icon name={item.icon} class={styles.icon()} />
70
+ {/if}
71
+
72
+ <!-- Label -->
73
+ <div class={styles.label()}>
74
+ {#if labelSnippet}
75
+ {@render labelSnippet(item)}
76
+ {:else}
77
+ {item.label}
78
+ {/if}
79
+ </div>
80
+ </div>
81
+
82
+ <!-- Children -->
83
+ {#if hasChildren && isExpanded}
84
+ <div class={styles.childrenWrapper()}>
85
+ {@render renderTree(item.children!)}
86
+ </div>
87
+ {/if}
88
+ </div>
89
+ {/each}
90
+ </div>
91
+ {/snippet}
92
+
93
+ <div class={className} {...restProps}>
94
+ {@render renderTree(items)}
95
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { TreeViewProps } from './tree-view.types.js';
2
+ declare const TreeView: import("svelte").Component<TreeViewProps, {}, "expandedIds">;
3
+ type TreeView = ReturnType<typeof TreeView>;
4
+ export default TreeView;
@@ -0,0 +1,4 @@
1
+ import TreeView from './TreeView.svelte';
2
+ export { TreeView };
3
+ export * from './tree-view.types.js';
4
+ export * from './tree-view.variants.js';
@@ -0,0 +1,4 @@
1
+ import TreeView from './TreeView.svelte';
2
+ export { TreeView };
3
+ export * from './tree-view.types.js';
4
+ export * from './tree-view.variants.js';
@@ -0,0 +1,68 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { TreeViewVariantProps } from './tree-view.variants.js';
3
+ import type { Snippet } from 'svelte';
4
+ export interface TreeItem {
5
+ /**
6
+ * Unique identifier for the item.
7
+ */
8
+ id: string | number;
9
+ /**
10
+ * Text label to display.
11
+ */
12
+ label: string;
13
+ /**
14
+ * Optional icon name.
15
+ */
16
+ icon?: string;
17
+ /**
18
+ * Whether the item is disabled.
19
+ */
20
+ disabled?: boolean;
21
+ /**
22
+ * Child items (for nested trees).
23
+ */
24
+ children?: TreeItem[];
25
+ /**
26
+ * Any other custom data you want to attach.
27
+ */
28
+ [key: string]: any;
29
+ }
30
+ export interface TreeViewProps extends HTMLAttributes<HTMLDivElement> {
31
+ /**
32
+ * Array of tree items to display.
33
+ */
34
+ items: TreeItem[];
35
+ /**
36
+ * Currently selected item IDs.
37
+ */
38
+ selectedIds?: (string | number)[];
39
+ /**
40
+ * Currently expanded item IDs.
41
+ */
42
+ expandedIds?: (string | number)[];
43
+ /**
44
+ * Component size.
45
+ */
46
+ size?: TreeViewVariantProps['size'];
47
+ /**
48
+ * Whether clicking the row expands the item, or only clicking the chevron expands it.
49
+ * @default true
50
+ */
51
+ expandOnRowClick?: boolean;
52
+ /**
53
+ * Additional CSS classes.
54
+ */
55
+ class?: string;
56
+ /**
57
+ * Event fired when an item is clicked.
58
+ */
59
+ onItemClick?: (item: TreeItem) => void;
60
+ /**
61
+ * Event fired when an item's expanded state changes.
62
+ */
63
+ onItemExpand?: (item: TreeItem, isExpanded: boolean) => void;
64
+ /**
65
+ * Custom snippet for rendering the label part of the item.
66
+ */
67
+ labelSnippet?: Snippet<[TreeItem]>;
68
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,69 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ export declare const treeViewVariants: import("tailwind-variants").TVReturnType<{
3
+ size: {
4
+ sm: {
5
+ itemRow: string;
6
+ chevron: string;
7
+ icon: string;
8
+ };
9
+ md: {
10
+ itemRow: string;
11
+ };
12
+ };
13
+ }, {
14
+ root: string;
15
+ item: string;
16
+ itemRow: string;
17
+ itemRowActive: string;
18
+ itemRowDisabled: string;
19
+ chevronWrapper: string;
20
+ chevron: string;
21
+ icon: string;
22
+ label: string;
23
+ childrenWrapper: string;
24
+ }, undefined, {
25
+ size: {
26
+ sm: {
27
+ itemRow: string;
28
+ chevron: string;
29
+ icon: string;
30
+ };
31
+ md: {
32
+ itemRow: string;
33
+ };
34
+ };
35
+ }, {
36
+ root: string;
37
+ item: string;
38
+ itemRow: string;
39
+ itemRowActive: string;
40
+ itemRowDisabled: string;
41
+ chevronWrapper: string;
42
+ chevron: string;
43
+ icon: string;
44
+ label: string;
45
+ childrenWrapper: string;
46
+ }, import("tailwind-variants").TVReturnType<{
47
+ size: {
48
+ sm: {
49
+ itemRow: string;
50
+ chevron: string;
51
+ icon: string;
52
+ };
53
+ md: {
54
+ itemRow: string;
55
+ };
56
+ };
57
+ }, {
58
+ root: string;
59
+ item: string;
60
+ itemRow: string;
61
+ itemRowActive: string;
62
+ itemRowDisabled: string;
63
+ chevronWrapper: string;
64
+ chevron: string;
65
+ icon: string;
66
+ label: string;
67
+ childrenWrapper: string;
68
+ }, undefined, unknown, unknown, undefined>>;
69
+ export type TreeViewVariantProps = VariantProps<typeof treeViewVariants>;
@@ -0,0 +1,30 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const treeViewVariants = tv({
3
+ slots: {
4
+ root: 'flex flex-col text-sm',
5
+ item: 'flex flex-col',
6
+ itemRow: 'flex items-center gap-1.5 py-1.5 px-2 rounded-md hover:bg-surface-100 dark:hover:bg-surface-800 cursor-pointer select-none transition-colors text-surface-900 dark:text-surface-50',
7
+ itemRowActive: 'bg-primary-50 dark:bg-primary-900/30 text-primary-900 dark:text-primary-100',
8
+ itemRowDisabled: 'opacity-50 cursor-not-allowed hover:bg-transparent dark:hover:bg-transparent',
9
+ chevronWrapper: 'flex items-center justify-center w-5 h-5 shrink-0 rounded hover:bg-surface-200 dark:hover:bg-surface-700 transition-colors',
10
+ chevron: 'w-4 h-4 transition-transform duration-200',
11
+ icon: 'w-4 h-4 shrink-0 text-surface-500 dark:text-surface-400',
12
+ label: 'truncate flex-1',
13
+ childrenWrapper: 'flex flex-col pl-4 ml-2.5 border-l border-outline-variant/50 mt-1'
14
+ },
15
+ variants: {
16
+ size: {
17
+ sm: {
18
+ itemRow: 'py-1 text-xs',
19
+ chevron: 'w-3 h-3',
20
+ icon: 'w-3 h-3'
21
+ },
22
+ md: {
23
+ itemRow: 'py-1.5 text-sm'
24
+ }
25
+ }
26
+ },
27
+ defaultVariants: {
28
+ size: 'md'
29
+ }
30
+ });