@techsio/ui-kit 0.0.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 (183) hide show
  1. package/README.md +165 -0
  2. package/dist/atoms/badge.js +66 -0
  3. package/dist/atoms/button.js +275 -0
  4. package/dist/atoms/error-text.js +38 -0
  5. package/dist/atoms/extra-text.js +27 -0
  6. package/dist/atoms/icon.js +42 -0
  7. package/dist/atoms/image.js +11 -0
  8. package/dist/atoms/input.js +83 -0
  9. package/dist/atoms/label.js +43 -0
  10. package/dist/atoms/link-button.js +51 -0
  11. package/dist/atoms/link.js +23 -0
  12. package/dist/atoms/numeric-input.js +221 -0
  13. package/dist/atoms/rating.js +117 -0
  14. package/dist/atoms/textarea.js +81 -0
  15. package/dist/atoms/tooltip.js +119 -0
  16. package/dist/molecules/accordion.js +245 -0
  17. package/dist/molecules/breadcrumb.js +168 -0
  18. package/dist/molecules/carousel.js +333 -0
  19. package/dist/molecules/checkbox.js +92 -0
  20. package/dist/molecules/color-select.js +159 -0
  21. package/dist/molecules/combobox.js +253 -0
  22. package/dist/molecules/dialog.js +313 -0
  23. package/dist/molecules/form-checkbox.js +59 -0
  24. package/dist/molecules/form-input.js +55 -0
  25. package/dist/molecules/form-numeric-input.js +47 -0
  26. package/dist/molecules/form-textarea.js +54 -0
  27. package/dist/molecules/menu.js +302 -0
  28. package/dist/molecules/pagination.js +184 -0
  29. package/dist/molecules/popover.js +152 -0
  30. package/dist/molecules/product-card.js +194 -0
  31. package/dist/molecules/search-form.js +106 -0
  32. package/dist/molecules/select.js +217 -0
  33. package/dist/molecules/slider.js +249 -0
  34. package/dist/molecules/steps.js +178 -0
  35. package/dist/molecules/switch.js +109 -0
  36. package/dist/molecules/tabs.js +211 -0
  37. package/dist/molecules/toast.js +126 -0
  38. package/dist/molecules/tree-view.js +451 -0
  39. package/dist/organisms/footer.js +209 -0
  40. package/dist/organisms/header.js +245 -0
  41. package/dist/organisms/table.js +233 -0
  42. package/dist/src/atoms/badge.d.ts +59 -0
  43. package/dist/src/atoms/badge.d.ts.map +1 -0
  44. package/dist/src/atoms/button.d.ts +97 -0
  45. package/dist/src/atoms/button.d.ts.map +1 -0
  46. package/dist/src/atoms/error-text.d.ts +29 -0
  47. package/dist/src/atoms/error-text.d.ts.map +1 -0
  48. package/dist/src/atoms/extra-text.d.ts +27 -0
  49. package/dist/src/atoms/extra-text.d.ts.map +1 -0
  50. package/dist/src/atoms/icon.d.ts +65 -0
  51. package/dist/src/atoms/icon.d.ts.map +1 -0
  52. package/dist/src/atoms/image.d.ts +17 -0
  53. package/dist/src/atoms/image.d.ts.map +1 -0
  54. package/dist/src/atoms/input.d.ts +78 -0
  55. package/dist/src/atoms/input.d.ts.map +1 -0
  56. package/dist/src/atoms/label.d.ts +41 -0
  57. package/dist/src/atoms/label.d.ts.map +1 -0
  58. package/dist/src/atoms/link-button.d.ts +129 -0
  59. package/dist/src/atoms/link-button.d.ts.map +1 -0
  60. package/dist/src/atoms/link.d.ts +17 -0
  61. package/dist/src/atoms/link.d.ts.map +1 -0
  62. package/dist/src/atoms/numeric-input.d.ts +64 -0
  63. package/dist/src/atoms/numeric-input.d.ts.map +1 -0
  64. package/dist/src/atoms/rating.d.ts +108 -0
  65. package/dist/src/atoms/rating.d.ts.map +1 -0
  66. package/dist/src/atoms/textarea.d.ts +81 -0
  67. package/dist/src/atoms/textarea.d.ts.map +1 -0
  68. package/dist/src/atoms/tooltip.d.ts +88 -0
  69. package/dist/src/atoms/tooltip.d.ts.map +1 -0
  70. package/dist/src/molecules/accordion.d.ts +182 -0
  71. package/dist/src/molecules/accordion.d.ts.map +1 -0
  72. package/dist/src/molecules/breadcrumb.d.ts +117 -0
  73. package/dist/src/molecules/breadcrumb.d.ts.map +1 -0
  74. package/dist/src/molecules/carousel.d.ts +261 -0
  75. package/dist/src/molecules/carousel.d.ts.map +1 -0
  76. package/dist/src/molecules/checkbox.d.ts +19 -0
  77. package/dist/src/molecules/checkbox.d.ts.map +1 -0
  78. package/dist/src/molecules/color-select.d.ts +20 -0
  79. package/dist/src/molecules/color-select.d.ts.map +1 -0
  80. package/dist/src/molecules/combobox.d.ts +141 -0
  81. package/dist/src/molecules/combobox.d.ts.map +1 -0
  82. package/dist/src/molecules/dialog.d.ts +234 -0
  83. package/dist/src/molecules/dialog.d.ts.map +1 -0
  84. package/dist/src/molecules/form-checkbox.d.ts +15 -0
  85. package/dist/src/molecules/form-checkbox.d.ts.map +1 -0
  86. package/dist/src/molecules/form-input.d.ts +14 -0
  87. package/dist/src/molecules/form-input.d.ts.map +1 -0
  88. package/dist/src/molecules/form-numeric-input.d.ts +14 -0
  89. package/dist/src/molecules/form-numeric-input.d.ts.map +1 -0
  90. package/dist/src/molecules/form-textarea.d.ts +14 -0
  91. package/dist/src/molecules/form-textarea.d.ts.map +1 -0
  92. package/dist/src/molecules/menu.d.ts +153 -0
  93. package/dist/src/molecules/menu.d.ts.map +1 -0
  94. package/dist/src/molecules/pagination.d.ts +123 -0
  95. package/dist/src/molecules/pagination.d.ts.map +1 -0
  96. package/dist/src/molecules/popover.d.ts +124 -0
  97. package/dist/src/molecules/popover.d.ts.map +1 -0
  98. package/dist/src/molecules/product-card.d.ts +160 -0
  99. package/dist/src/molecules/product-card.d.ts.map +1 -0
  100. package/dist/src/molecules/search-form.d.ts +39 -0
  101. package/dist/src/molecules/search-form.d.ts.map +1 -0
  102. package/dist/src/molecules/select.d.ts +126 -0
  103. package/dist/src/molecules/select.d.ts.map +1 -0
  104. package/dist/src/molecules/slider.d.ts +120 -0
  105. package/dist/src/molecules/slider.d.ts.map +1 -0
  106. package/dist/src/molecules/steps.d.ts +96 -0
  107. package/dist/src/molecules/steps.d.ts.map +1 -0
  108. package/dist/src/molecules/switch.d.ts +71 -0
  109. package/dist/src/molecules/switch.d.ts.map +1 -0
  110. package/dist/src/molecules/tabs.d.ts +207 -0
  111. package/dist/src/molecules/tabs.d.ts.map +1 -0
  112. package/dist/src/molecules/toast.d.ts +83 -0
  113. package/dist/src/molecules/toast.d.ts.map +1 -0
  114. package/dist/src/molecules/tree-view.d.ts +202 -0
  115. package/dist/src/molecules/tree-view.d.ts.map +1 -0
  116. package/dist/src/organisms/footer.d.ts +254 -0
  117. package/dist/src/organisms/footer.d.ts.map +1 -0
  118. package/dist/src/organisms/header.d.ts +186 -0
  119. package/dist/src/organisms/header.d.ts.map +1 -0
  120. package/dist/src/organisms/table.d.ts +250 -0
  121. package/dist/src/organisms/table.d.ts.map +1 -0
  122. package/dist/src/templates/accordion.d.ts +15 -0
  123. package/dist/src/templates/accordion.d.ts.map +1 -0
  124. package/dist/src/templates/carousel.d.ts +13 -0
  125. package/dist/src/templates/carousel.d.ts.map +1 -0
  126. package/dist/src/templates/numeric-input.d.ts +14 -0
  127. package/dist/src/templates/numeric-input.d.ts.map +1 -0
  128. package/dist/src/templates/product-card.d.ts +33 -0
  129. package/dist/src/templates/product-card.d.ts.map +1 -0
  130. package/dist/src/templates/tabs.d.ts +16 -0
  131. package/dist/src/templates/tabs.d.ts.map +1 -0
  132. package/dist/src/types/zag.d.ts +19 -0
  133. package/dist/src/types/zag.d.ts.map +1 -0
  134. package/dist/src/utils.d.ts +4 -0
  135. package/dist/src/utils.d.ts.map +1 -0
  136. package/dist/templates/accordion.js +37 -0
  137. package/dist/templates/carousel.js +55 -0
  138. package/dist/templates/numeric-input.js +49 -0
  139. package/dist/templates/product-card.js +92 -0
  140. package/dist/templates/tabs.js +34 -0
  141. package/dist/types/zag.js +0 -0
  142. package/dist/utils.js +20 -0
  143. package/package.json +126 -0
  144. package/src/tokens/_base.css +25 -0
  145. package/src/tokens/_colors.css +5 -0
  146. package/src/tokens/_layout.css +34 -0
  147. package/src/tokens/_semantic.css +360 -0
  148. package/src/tokens/_spacing.css +22 -0
  149. package/src/tokens/_typography.css +17 -0
  150. package/src/tokens/components/atoms/_badge.css +61 -0
  151. package/src/tokens/components/atoms/_button.css +215 -0
  152. package/src/tokens/components/atoms/_icon.css +122 -0
  153. package/src/tokens/components/atoms/_input.css +125 -0
  154. package/src/tokens/components/atoms/_numeric-input.css +57 -0
  155. package/src/tokens/components/atoms/_rating.css +33 -0
  156. package/src/tokens/components/atoms/_textarea.css +93 -0
  157. package/src/tokens/components/atoms/_tooltip.css +21 -0
  158. package/src/tokens/components/components.css +32 -0
  159. package/src/tokens/components/molecules/_accordion.css +85 -0
  160. package/src/tokens/components/molecules/_breadcrumb.css +44 -0
  161. package/src/tokens/components/molecules/_carousel.css +72 -0
  162. package/src/tokens/components/molecules/_checkbox.css +29 -0
  163. package/src/tokens/components/molecules/_color-select.css +61 -0
  164. package/src/tokens/components/molecules/_combobox.css +116 -0
  165. package/src/tokens/components/molecules/_dialog.css +75 -0
  166. package/src/tokens/components/molecules/_menu.css +48 -0
  167. package/src/tokens/components/molecules/_pagination.css +75 -0
  168. package/src/tokens/components/molecules/_popover.css +39 -0
  169. package/src/tokens/components/molecules/_product-card.css +85 -0
  170. package/src/tokens/components/molecules/_search-form.css +10 -0
  171. package/src/tokens/components/molecules/_select.css +88 -0
  172. package/src/tokens/components/molecules/_slider.css +75 -0
  173. package/src/tokens/components/molecules/_steps.css +54 -0
  174. package/src/tokens/components/molecules/_switch.css +62 -0
  175. package/src/tokens/components/molecules/_tabs.css +69 -0
  176. package/src/tokens/components/molecules/_toast.css +77 -0
  177. package/src/tokens/components/molecules/_tree-view.css +80 -0
  178. package/src/tokens/components/molecules/index.css +2 -0
  179. package/src/tokens/components/organisms/_footer.css +90 -0
  180. package/src/tokens/components/organisms/_header.css +86 -0
  181. package/src/tokens/components/organisms/_table.css +63 -0
  182. package/src/tokens/index.css +67 -0
  183. package/src/tokens/tokens-only.css +66 -0
@@ -0,0 +1,451 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { normalizeProps, useMachine } from "@zag-js/react";
3
+ import { collection as tree_view_collection, connect, machine } from "@zag-js/tree-view";
4
+ import { createContext, useContext, useId } from "react";
5
+ import { Icon } from "../atoms/icon.js";
6
+ import { tv } from "../utils.js";
7
+ const treeViewVariants = tv({
8
+ slots: {
9
+ root: 'relative bg-tree-root-bg rounded-tree',
10
+ label: [
11
+ 'text-tree-label-fg font-tree-label'
12
+ ],
13
+ tree: [
14
+ 'outline-none bg-tree-bg',
15
+ 'focus-visible:ring',
16
+ 'focus-visible:ring-tree-ring'
17
+ ],
18
+ branch: [
19
+ 'data-[disabled]:opacity-tree-disabled data-[disabled]:pointer-events-none'
20
+ ],
21
+ branchTrigger: [
22
+ 'group flex items-center justify-between',
23
+ 'hover:bg-tree-node-bg-hover',
24
+ 'cursor-pointer',
25
+ 'has-focus-visible:outline-none',
26
+ 'has-focus-visible:ring',
27
+ 'has-focus-visible:ring-tree-ring'
28
+ ],
29
+ branchControl: [
30
+ 'flex-1'
31
+ ],
32
+ branchText: [
33
+ 'flex-1'
34
+ ],
35
+ branchIndicator: [
36
+ 'group-hover:text-tree-fg-hover',
37
+ 'data-[state=open]:token-icon-tree-indicator-open cursor-pointer hover:scale-125'
38
+ ],
39
+ branchContent: [
40
+ 'relative',
41
+ 'data-[state=closed]:hidden'
42
+ ],
43
+ indentGuide: [
44
+ 'absolute top-0 bottom-0 start-1',
45
+ 'w-tree-indent bg-tree-indent-bg',
46
+ 'opacity-tree-indent'
47
+ ],
48
+ item: [
49
+ 'hover:bg-tree-node-bg-hover hover:text-tree-fg-hover',
50
+ 'data-[selected]:hover:bg-tree-node-bg-hover',
51
+ 'data-[selected]:hover:text-tree-fg-hover',
52
+ 'focus-visible:outline-none',
53
+ 'focus-visible:ring',
54
+ 'focus-visible:ring-tree-ring'
55
+ ],
56
+ itemText: [
57
+ 'flex-1'
58
+ ],
59
+ nodeIcon: [
60
+ 'hover:text-tree-icon-hover'
61
+ ]
62
+ },
63
+ compoundSlots: [
64
+ {
65
+ slots: [
66
+ 'branch',
67
+ 'item'
68
+ ],
69
+ class: [
70
+ 'relative',
71
+ 'ms-[calc(var(--depth)*var(--tree-indent-per-level))]',
72
+ 'data-[depth=1]:ms-0'
73
+ ]
74
+ },
75
+ {
76
+ slots: [
77
+ 'branchControl',
78
+ 'item'
79
+ ],
80
+ class: [
81
+ 'flex items-center gap-tree-icon p-tree-node',
82
+ 'cursor-pointer',
83
+ 'data-[selected]:text-tree-fg-selected',
84
+ 'group-hover:text-tree-fg-hover',
85
+ 'data-[selected]:group-hover:text-tree-fg-hover',
86
+ 'focus-visible:outline-none'
87
+ ]
88
+ }
89
+ ],
90
+ variants: {
91
+ size: {
92
+ sm: {
93
+ nodeIcon: 'text-tree-icon-sm',
94
+ branchText: 'text-tree-sm',
95
+ itemText: 'text-tree-sm',
96
+ branchIndicator: 'text-tree-indicator-sm',
97
+ label: 'text-tree-sm'
98
+ },
99
+ md: {
100
+ nodeIcon: 'text-tree-icon-md',
101
+ branchText: 'text-tree-md',
102
+ itemText: 'text-tree-md',
103
+ branchIndicator: 'text-tree-indicator-md',
104
+ label: 'text-tree-md'
105
+ },
106
+ lg: {
107
+ nodeIcon: 'text-tree-icon-lg',
108
+ branchText: 'text-tree-lg',
109
+ itemText: 'text-tree-lg',
110
+ branchIndicator: 'text-tree-indicator-lg',
111
+ label: 'text-tree-lg'
112
+ }
113
+ }
114
+ },
115
+ defaultVariants: {
116
+ size: 'md'
117
+ }
118
+ });
119
+ const TreeViewContext = /*#__PURE__*/ createContext(null);
120
+ function useTreeViewContext() {
121
+ const context = useContext(TreeViewContext);
122
+ if (!context) throw new Error('TreeView components must be used within TreeView.Root');
123
+ return context;
124
+ }
125
+ const TreeViewNodeContext = /*#__PURE__*/ createContext(null);
126
+ function useTreeViewNodeContext() {
127
+ const context = useContext(TreeViewNodeContext);
128
+ if (!context) throw new Error('TreeView node components must be used within a node provider');
129
+ return context;
130
+ }
131
+ function TreeView({ id, data, size, selectionBehavior = 'all', dir = 'ltr', selectionMode = 'single', expandedValue, selectedValue, focusedValue, defaultExpandedValue, defaultSelectedValue, expandOnClick = true, typeahead = true, onExpandedChange, onSelectionChange, onFocusChange, children, className, ...props }) {
132
+ const generatedId = useId();
133
+ const uniqueId = id || generatedId;
134
+ const collection = tree_view_collection({
135
+ nodeToValue: (node)=>node.id,
136
+ nodeToString: (node)=>node.name,
137
+ rootNode: {
138
+ id: 'ROOT',
139
+ name: '',
140
+ children: data
141
+ }
142
+ });
143
+ const service = useMachine(machine, {
144
+ id: uniqueId,
145
+ collection,
146
+ dir,
147
+ selectionMode,
148
+ expandedValue,
149
+ selectedValue,
150
+ focusedValue,
151
+ defaultExpandedValue,
152
+ defaultSelectedValue,
153
+ expandOnClick,
154
+ typeahead,
155
+ onExpandedChange,
156
+ onSelectionChange,
157
+ onFocusChange
158
+ });
159
+ const api = connect(service, normalizeProps);
160
+ const styles = treeViewVariants({
161
+ size
162
+ });
163
+ return /*#__PURE__*/ jsx(TreeViewContext.Provider, {
164
+ value: {
165
+ api,
166
+ size,
167
+ styles,
168
+ selectionBehavior
169
+ },
170
+ children: /*#__PURE__*/ jsx("div", {
171
+ className: styles.root({
172
+ className
173
+ }),
174
+ ...api.getRootProps(),
175
+ ...props,
176
+ children: children
177
+ })
178
+ });
179
+ }
180
+ TreeView.Label = function({ children, className, ...props }) {
181
+ const { api, styles } = useTreeViewContext();
182
+ return /*#__PURE__*/ jsx("h3", {
183
+ className: styles.label({
184
+ className
185
+ }),
186
+ ...api.getLabelProps(),
187
+ ...props,
188
+ children: children
189
+ });
190
+ };
191
+ TreeView.Tree = function({ children, className, ...props }) {
192
+ const { api, styles } = useTreeViewContext();
193
+ return /*#__PURE__*/ jsx("div", {
194
+ className: styles.tree({
195
+ className
196
+ }),
197
+ ...api.getTreeProps(),
198
+ ...props,
199
+ children: children
200
+ });
201
+ };
202
+ TreeView.NodeProvider = function({ node, indexPath, children }) {
203
+ const { api } = useTreeViewContext();
204
+ const nodeProps = {
205
+ node,
206
+ indexPath
207
+ };
208
+ const nodeState = api.getNodeState(nodeProps);
209
+ return /*#__PURE__*/ jsx(TreeViewNodeContext.Provider, {
210
+ value: {
211
+ node,
212
+ indexPath,
213
+ nodeProps,
214
+ nodeState
215
+ },
216
+ children: children
217
+ });
218
+ };
219
+ TreeView.Branch = function({ children, className, ...props }) {
220
+ const { api, styles } = useTreeViewContext();
221
+ const { nodeProps } = useTreeViewNodeContext();
222
+ return /*#__PURE__*/ jsx("div", {
223
+ className: styles.branch({
224
+ className
225
+ }),
226
+ ...api.getBranchProps(nodeProps),
227
+ ...props,
228
+ children: children
229
+ });
230
+ };
231
+ TreeView.BranchTrigger = function({ children, className, ...props }) {
232
+ const { styles } = useTreeViewContext();
233
+ return /*#__PURE__*/ jsx("div", {
234
+ className: styles.branchTrigger({
235
+ className
236
+ }),
237
+ ...props,
238
+ children: children
239
+ });
240
+ };
241
+ TreeView.BranchControl = function({ children, className, ...props }) {
242
+ const { api, styles, selectionBehavior } = useTreeViewContext();
243
+ const { node, nodeProps, nodeState } = useTreeViewNodeContext();
244
+ const isSelectable = (()=>{
245
+ switch(selectionBehavior){
246
+ case 'all':
247
+ return true;
248
+ case 'leaf-only':
249
+ return false;
250
+ case 'custom':
251
+ return false !== node.selectable;
252
+ default:
253
+ return true;
254
+ }
255
+ })();
256
+ const controlProps = api.getBranchControlProps(nodeProps);
257
+ const finalProps = isSelectable ? controlProps : {
258
+ ...controlProps,
259
+ onClick: (e)=>{
260
+ e.preventDefault();
261
+ e.stopPropagation();
262
+ if (!nodeState.disabled) if (nodeState.expanded) api.collapse([
263
+ node.id
264
+ ]);
265
+ else api.expand([
266
+ node.id
267
+ ]);
268
+ },
269
+ 'aria-selected': void 0,
270
+ 'data-disabled': !isSelectable || nodeState.disabled || void 0
271
+ };
272
+ return /*#__PURE__*/ jsx("div", {
273
+ className: styles.branchControl({
274
+ className
275
+ }),
276
+ ...finalProps,
277
+ ...props,
278
+ children: children
279
+ });
280
+ };
281
+ TreeView.BranchText = function({ children, className }) {
282
+ const { api, styles } = useTreeViewContext();
283
+ const { node, nodeProps } = useTreeViewNodeContext();
284
+ return /*#__PURE__*/ jsx("span", {
285
+ className: styles.branchText({
286
+ className
287
+ }),
288
+ ...api.getBranchTextProps(nodeProps),
289
+ children: children || node.name
290
+ });
291
+ };
292
+ TreeView.BranchIndicator = function({ icon = 'token-icon-tree-indicator', className }) {
293
+ const { api, styles } = useTreeViewContext();
294
+ const { node, nodeProps, nodeState } = useTreeViewNodeContext();
295
+ const handleToggle = (id)=>{
296
+ if (nodeState.expanded) api.collapse([
297
+ id
298
+ ]);
299
+ else api.expand([
300
+ id
301
+ ]);
302
+ };
303
+ return /*#__PURE__*/ jsx(Icon, {
304
+ icon: icon,
305
+ className: styles.branchIndicator({
306
+ className
307
+ }),
308
+ ...api.getBranchIndicatorProps(nodeProps),
309
+ onClick: (e)=>{
310
+ e.preventDefault();
311
+ e.stopPropagation();
312
+ handleToggle(node.id);
313
+ }
314
+ });
315
+ };
316
+ TreeView.BranchContent = function({ children, className, ...props }) {
317
+ const { api, styles } = useTreeViewContext();
318
+ const { nodeProps } = useTreeViewNodeContext();
319
+ return /*#__PURE__*/ jsx("div", {
320
+ className: styles.branchContent({
321
+ className
322
+ }),
323
+ ...api.getBranchContentProps(nodeProps),
324
+ ...props,
325
+ children: children
326
+ });
327
+ };
328
+ TreeView.IndentGuide = function({ className }) {
329
+ const { api, styles } = useTreeViewContext();
330
+ const { nodeProps } = useTreeViewNodeContext();
331
+ return /*#__PURE__*/ jsx("div", {
332
+ className: styles.indentGuide({
333
+ className
334
+ }),
335
+ ...api.getBranchIndentGuideProps(nodeProps)
336
+ });
337
+ };
338
+ TreeView.Item = function({ children, className, ...props }) {
339
+ const { api, styles, selectionBehavior } = useTreeViewContext();
340
+ const { node, nodeProps, nodeState } = useTreeViewNodeContext();
341
+ const isSelectable = (()=>{
342
+ switch(selectionBehavior){
343
+ case 'all':
344
+ case 'leaf-only':
345
+ return true;
346
+ case 'custom':
347
+ return false !== node.selectable;
348
+ default:
349
+ return true;
350
+ }
351
+ })();
352
+ const itemProps = api.getItemProps(nodeProps);
353
+ const finalProps = isSelectable ? itemProps : {
354
+ ...itemProps,
355
+ onClick: (e)=>{
356
+ e.preventDefault();
357
+ e.stopPropagation();
358
+ },
359
+ 'aria-selected': void 0,
360
+ 'data-disabled': !isSelectable || nodeState.disabled || void 0
361
+ };
362
+ return /*#__PURE__*/ jsx("div", {
363
+ className: styles.item({
364
+ className
365
+ }),
366
+ ...finalProps,
367
+ "data-selected": nodeState.selected || void 0,
368
+ ...props,
369
+ children: children
370
+ });
371
+ };
372
+ TreeView.ItemText = function({ children, className }) {
373
+ const { api, styles } = useTreeViewContext();
374
+ const { node, nodeProps } = useTreeViewNodeContext();
375
+ return /*#__PURE__*/ jsx("span", {
376
+ className: styles.itemText({
377
+ className
378
+ }),
379
+ ...api.getItemTextProps(nodeProps),
380
+ children: children || node.name
381
+ });
382
+ };
383
+ TreeView.NodeIcon = function({ icon, className, ...props }) {
384
+ const { styles } = useTreeViewContext();
385
+ const { node, nodeState } = useTreeViewNodeContext();
386
+ const iconToShow = icon || (nodeState.isBranch ? node.icons?.branch || (nodeState.expanded ? 'token-icon-tree-node-open' : 'token-icon-tree-node') : node.icons?.leaf || 'token-icon-tree-item');
387
+ return /*#__PURE__*/ jsx("span", {
388
+ className: styles.nodeIcon({
389
+ className
390
+ }),
391
+ "data-state": nodeState.expanded ? 'open' : 'closed',
392
+ ...props,
393
+ children: /*#__PURE__*/ jsx(Icon, {
394
+ icon: iconToShow
395
+ })
396
+ });
397
+ };
398
+ TreeView.Node = function({ node, indexPath, showIndentGuides = true, showNodeIcons = true, onNodeHover, onNodeLeave }) {
399
+ const { api } = useTreeViewContext();
400
+ const nodeProps = {
401
+ node,
402
+ indexPath
403
+ };
404
+ const nodeState = api.getNodeState(nodeProps);
405
+ return /*#__PURE__*/ jsx(TreeView.NodeProvider, {
406
+ node: node,
407
+ indexPath: indexPath,
408
+ children: nodeState.isBranch ? /*#__PURE__*/ jsxs(TreeView.Branch, {
409
+ children: [
410
+ /*#__PURE__*/ jsxs(TreeView.BranchTrigger, {
411
+ onMouseEnter: ()=>onNodeHover?.(node, indexPath),
412
+ onMouseLeave: ()=>onNodeLeave?.(node, indexPath),
413
+ children: [
414
+ /*#__PURE__*/ jsxs(TreeView.BranchControl, {
415
+ children: [
416
+ showNodeIcons && /*#__PURE__*/ jsx(TreeView.NodeIcon, {}),
417
+ /*#__PURE__*/ jsx(TreeView.BranchText, {})
418
+ ]
419
+ }),
420
+ /*#__PURE__*/ jsx(TreeView.BranchIndicator, {})
421
+ ]
422
+ }),
423
+ /*#__PURE__*/ jsxs(TreeView.BranchContent, {
424
+ children: [
425
+ showIndentGuides && /*#__PURE__*/ jsx(TreeView.IndentGuide, {}),
426
+ node.children?.map((childNode, index)=>/*#__PURE__*/ jsx(TreeView.Node, {
427
+ node: childNode,
428
+ indexPath: [
429
+ ...indexPath,
430
+ index
431
+ ],
432
+ showIndentGuides: showIndentGuides,
433
+ showNodeIcons: showNodeIcons,
434
+ onNodeHover: onNodeHover,
435
+ onNodeLeave: onNodeLeave
436
+ }, childNode.id))
437
+ ]
438
+ })
439
+ ]
440
+ }) : /*#__PURE__*/ jsxs(TreeView.Item, {
441
+ onMouseEnter: ()=>onNodeHover?.(node, indexPath),
442
+ onMouseLeave: ()=>onNodeLeave?.(node, indexPath),
443
+ children: [
444
+ showNodeIcons && /*#__PURE__*/ jsx(TreeView.NodeIcon, {}),
445
+ /*#__PURE__*/ jsx(TreeView.ItemText, {})
446
+ ]
447
+ })
448
+ });
449
+ };
450
+ TreeView.displayName = 'TreeView';
451
+ export { TreeView };
@@ -0,0 +1,209 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext } from "react";
3
+ import { Link } from "../atoms/link.js";
4
+ import { tv } from "../utils.js";
5
+ const footerVariants = tv({
6
+ slots: {
7
+ root: 'flex w-full bg-footer-bg items-center justify-center rounded-footer',
8
+ container: 'w-full max-w-footer-max bg-footer-container-bg',
9
+ section: 'bg-footer-section-bg',
10
+ list: 'flex flex-col bg-footer-list-bg list-none gap-footer-list-gap',
11
+ bottom: 'flex w-full items-center bg-footer-bottom-bg justify-between border-t-(--border-width-footer) pt-footer-bottom',
12
+ title: 'font-footer-title text-footer-title-fg hover:text-footer-title-fg-hover transition-footer-title',
13
+ link: 'font-footer-link text-footer-link-fg hover:text-footer-link-fg-hover transition-footer-link',
14
+ text: 'text-footer-text-fg',
15
+ divider: 'flex w-full h-footer-divider border-0 bg-footer-divider-bg'
16
+ },
17
+ variants: {
18
+ direction: {
19
+ vertical: {
20
+ root: 'flex-col'
21
+ },
22
+ horizontal: {
23
+ root: 'flex-row'
24
+ }
25
+ },
26
+ layout: {
27
+ col: {
28
+ container: 'grid grid-cols-(--footer-cols)'
29
+ },
30
+ row: {
31
+ container: 'flex flex-row'
32
+ }
33
+ },
34
+ sectionFlow: {
35
+ col: {
36
+ section: 'flex flex-col'
37
+ },
38
+ row: {
39
+ section: 'flex flex-row'
40
+ }
41
+ },
42
+ size: {
43
+ sm: {
44
+ root: 'p-footer-root-sm',
45
+ container: 'gap-footer-container-sm',
46
+ section: 'gap-footer-section-sm',
47
+ list: 'gap-footer-list-gap-sm',
48
+ title: 'text-footer-title-sm',
49
+ link: 'text-footer-link-sm',
50
+ text: 'text-footer-text-sm',
51
+ bottom: 'p-footer-bottom-sm',
52
+ divider: 'my-footer-divider-sm'
53
+ },
54
+ md: {
55
+ root: 'p-footer-root-md',
56
+ container: 'gap-footer-container-md',
57
+ section: 'gap-footer-section-md',
58
+ list: 'gap-footer-list-gap-md',
59
+ title: 'text-footer-title-md',
60
+ link: 'text-footer-link-md',
61
+ text: 'text-footer-text-md',
62
+ bottom: 'p-footer-bottom-md',
63
+ divider: 'my-footer-divider-md'
64
+ },
65
+ lg: {
66
+ root: 'p-footer-root-lg',
67
+ container: 'gap-footer-container-lg',
68
+ section: 'gap-footer-section-lg',
69
+ list: 'gap-footer-list-gap-lg',
70
+ title: 'text-footer-title-lg',
71
+ link: 'text-footer-link-lg',
72
+ text: 'text-footer-text-lg',
73
+ bottom: 'p-footer-bottom-lg',
74
+ divider: 'my-footer-divider-lg'
75
+ }
76
+ }
77
+ },
78
+ defaultVariants: {
79
+ size: 'md',
80
+ direction: 'horizontal',
81
+ layout: 'col',
82
+ sectionFlow: 'col'
83
+ }
84
+ });
85
+ const FooterContext = /*#__PURE__*/ createContext({});
86
+ function Footer({ children, size, sectionFlow, direction, layout, className }) {
87
+ const { root } = footerVariants({
88
+ size,
89
+ direction
90
+ });
91
+ return /*#__PURE__*/ jsx(FooterContext.Provider, {
92
+ value: {
93
+ size,
94
+ sectionFlow,
95
+ layout
96
+ },
97
+ children: /*#__PURE__*/ jsx("footer", {
98
+ className: root({
99
+ className
100
+ }),
101
+ children: children
102
+ })
103
+ });
104
+ }
105
+ Footer.Container = function({ children, className }) {
106
+ const { size, layout } = useContext(FooterContext);
107
+ const { container } = footerVariants({
108
+ size,
109
+ layout
110
+ });
111
+ return /*#__PURE__*/ jsx("div", {
112
+ className: container({
113
+ className
114
+ }),
115
+ children: children
116
+ });
117
+ };
118
+ Footer.Section = function({ children, className }) {
119
+ const { size, sectionFlow } = useContext(FooterContext);
120
+ const { section } = footerVariants({
121
+ size,
122
+ sectionFlow
123
+ });
124
+ return /*#__PURE__*/ jsx("div", {
125
+ className: section({
126
+ className
127
+ }),
128
+ children: children
129
+ });
130
+ };
131
+ Footer.Title = function({ children, className }) {
132
+ const { size } = useContext(FooterContext);
133
+ const { title } = footerVariants({
134
+ size
135
+ });
136
+ return /*#__PURE__*/ jsx("h3", {
137
+ className: title({
138
+ className
139
+ }),
140
+ children: children
141
+ });
142
+ };
143
+ Footer.Link = function({ children, className, href, external, ...props }) {
144
+ const { size } = useContext(FooterContext);
145
+ const { link } = footerVariants({
146
+ size
147
+ });
148
+ return /*#__PURE__*/ jsx(Link, {
149
+ href: href,
150
+ className: link({
151
+ className
152
+ }),
153
+ target: external ? '_blank' : void 0,
154
+ rel: external ? 'noopener noreferrer' : void 0,
155
+ ...props,
156
+ children: children
157
+ });
158
+ };
159
+ Footer.Text = function({ children, className }) {
160
+ const { size } = useContext(FooterContext);
161
+ const { text } = footerVariants({
162
+ size
163
+ });
164
+ return /*#__PURE__*/ jsx("p", {
165
+ className: text({
166
+ className
167
+ }),
168
+ children: children
169
+ });
170
+ };
171
+ Footer.List = function({ children, className, ...props }) {
172
+ const { size } = useContext(FooterContext);
173
+ const { list } = footerVariants({
174
+ size
175
+ });
176
+ return /*#__PURE__*/ jsx("ul", {
177
+ className: list({
178
+ className
179
+ }),
180
+ ...props,
181
+ children: children
182
+ });
183
+ };
184
+ Footer.Divider = function({ className, ...props }) {
185
+ const { size } = useContext(FooterContext);
186
+ const { divider } = footerVariants({
187
+ size
188
+ });
189
+ return /*#__PURE__*/ jsx("hr", {
190
+ className: divider({
191
+ className
192
+ }),
193
+ ...props
194
+ });
195
+ };
196
+ Footer.Bottom = function({ children, className, ...props }) {
197
+ const { size } = useContext(FooterContext);
198
+ const { bottom } = footerVariants({
199
+ size
200
+ });
201
+ return /*#__PURE__*/ jsx("div", {
202
+ className: bottom({
203
+ className
204
+ }),
205
+ ...props,
206
+ children: children
207
+ });
208
+ };
209
+ export { Footer };