@cascivo/react 0.8.0 → 0.10.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 (287) hide show
  1. package/README.md +24 -11
  2. package/dist/combobox/combobox.js +73 -73
  3. package/dist/command-menu/command-menu.js +2 -2
  4. package/dist/date-picker/date-picker.js +95 -95
  5. package/dist/field/field.js +24 -15
  6. package/dist/filter/filter.js +12 -12
  7. package/dist/index.d.ts +74 -8
  8. package/dist/index.js +2 -0
  9. package/dist/node/accordion/accordion.js +95 -0
  10. package/dist/node/accordion/accordion.module.js +13 -0
  11. package/dist/node/action-sheet/action-sheet.js +91 -0
  12. package/dist/node/action-sheet/action-sheet.module.js +14 -0
  13. package/dist/node/alert/alert.js +55 -0
  14. package/dist/node/alert/alert.module.js +13 -0
  15. package/dist/node/alert-dialog/alert-dialog.js +68 -0
  16. package/dist/node/alert-dialog/alert-dialog.module.js +13 -0
  17. package/dist/node/app-shell/app-shell.js +80 -0
  18. package/dist/node/app-shell/app-shell.module.js +14 -0
  19. package/dist/node/aspect-ratio/aspect-ratio.js +22 -0
  20. package/dist/node/aspect-ratio/aspect-ratio.module.js +8 -0
  21. package/dist/node/avatar/avatar.js +57 -0
  22. package/dist/node/avatar/avatar.module.js +10 -0
  23. package/dist/node/avatar-group/avatar-group.js +26 -0
  24. package/dist/node/avatar-group/avatar-group.module.js +8 -0
  25. package/dist/node/badge/badge.js +17 -0
  26. package/dist/node/badge/badge.module.js +5 -0
  27. package/dist/node/blockquote/blockquote.js +18 -0
  28. package/dist/node/blockquote/blockquote.module.js +8 -0
  29. package/dist/node/bottom-sheet/bottom-sheet.js +111 -0
  30. package/dist/node/bottom-sheet/bottom-sheet.module.js +16 -0
  31. package/dist/node/breadcrumb/breadcrumb.js +28 -0
  32. package/dist/node/breadcrumb/breadcrumb.module.js +5 -0
  33. package/dist/node/button/button.js +31 -0
  34. package/dist/node/button/button.module.js +5 -0
  35. package/dist/node/button-group/button-group.js +39 -0
  36. package/dist/node/button-group/button-group.module.js +5 -0
  37. package/dist/node/calendar/calendar.js +195 -0
  38. package/dist/node/calendar/calendar.module.js +16 -0
  39. package/dist/node/card/card.js +45 -0
  40. package/dist/node/card/card.module.js +11 -0
  41. package/dist/node/carousel/carousel.js +138 -0
  42. package/dist/node/carousel/carousel.module.js +15 -0
  43. package/dist/node/chat-bubble/chat-bubble.js +33 -0
  44. package/dist/node/chat-bubble/chat-bubble.module.js +13 -0
  45. package/dist/node/checkbox/checkbox.js +38 -0
  46. package/dist/node/checkbox/checkbox.module.js +10 -0
  47. package/dist/node/checkbox-card/checkbox-card.js +48 -0
  48. package/dist/node/checkbox-card/checkbox-card.module.js +13 -0
  49. package/dist/node/code/code.js +16 -0
  50. package/dist/node/code/code.module.js +5 -0
  51. package/dist/node/code-snippet/code-snippet.js +116 -0
  52. package/dist/node/code-snippet/code-snippet.module.js +19 -0
  53. package/dist/node/code-snippet/highlight.js +69 -0
  54. package/dist/node/collapsible/collapsible.js +42 -0
  55. package/dist/node/collapsible/collapsible.module.js +10 -0
  56. package/dist/node/color-picker/color-picker.js +268 -0
  57. package/dist/node/color-picker/color-picker.module.js +20 -0
  58. package/dist/node/combobox/combobox.js +164 -0
  59. package/dist/node/combobox/combobox.module.js +21 -0
  60. package/dist/node/command-menu/command-menu.js +425 -0
  61. package/dist/node/command-menu/command-menu.module.js +36 -0
  62. package/dist/node/comparison/comparison.js +69 -0
  63. package/dist/node/comparison/comparison.module.js +11 -0
  64. package/dist/node/contained-list/contained-list.js +41 -0
  65. package/dist/node/contained-list/contained-list.module.js +13 -0
  66. package/dist/node/context-menu/context-menu.js +89 -0
  67. package/dist/node/context-menu/context-menu.module.js +9 -0
  68. package/dist/node/copy-button/copy-button.js +58 -0
  69. package/dist/node/copy-button/copy-button.module.js +8 -0
  70. package/dist/node/data-list/data-list.js +27 -0
  71. package/dist/node/data-list/data-list.module.js +10 -0
  72. package/dist/node/data-table/data-table.js +370 -0
  73. package/dist/node/data-table/data-table.module.js +35 -0
  74. package/dist/node/date-picker/date-picker.js +218 -0
  75. package/dist/node/date-picker/date-picker.module.js +25 -0
  76. package/dist/node/date-range-picker/date-range-picker.js +196 -0
  77. package/dist/node/date-range-picker/date-range-picker.module.js +20 -0
  78. package/dist/node/dock/dock.js +34 -0
  79. package/dist/node/dock/dock.module.js +10 -0
  80. package/dist/node/drawer/drawer.js +95 -0
  81. package/dist/node/drawer/drawer.module.js +15 -0
  82. package/dist/node/dropdown/dropdown.js +109 -0
  83. package/dist/node/dropdown/dropdown.module.js +11 -0
  84. package/dist/node/editable/editable.js +67 -0
  85. package/dist/node/editable/editable.module.js +13 -0
  86. package/dist/node/empty-state/empty-state.js +34 -0
  87. package/dist/node/empty-state/empty-state.module.js +11 -0
  88. package/dist/node/fab/fab.js +93 -0
  89. package/dist/node/fab/fab.module.js +14 -0
  90. package/dist/node/field/field.js +48 -0
  91. package/dist/node/field/field.module.js +9 -0
  92. package/dist/node/file-uploader/file-uploader.js +122 -0
  93. package/dist/node/file-uploader/file-uploader.module.js +20 -0
  94. package/dist/node/filter/filter.js +34 -0
  95. package/dist/node/filter/filter.module.js +8 -0
  96. package/dist/node/form/form.js +95 -0
  97. package/dist/node/form/form.module.js +5 -0
  98. package/dist/node/header/header.js +44 -0
  99. package/dist/node/header/header.module.js +13 -0
  100. package/dist/node/header-panel/header-panel.js +74 -0
  101. package/dist/node/header-panel/header-panel.module.js +11 -0
  102. package/dist/node/heading/heading.js +24 -0
  103. package/dist/node/heading/heading.module.js +5 -0
  104. package/dist/node/hover-card/hover-card.js +84 -0
  105. package/dist/node/hover-card/hover-card.module.js +8 -0
  106. package/dist/node/icon-button/icon-button.js +21 -0
  107. package/dist/node/icon-button/icon-button.module.js +5 -0
  108. package/dist/node/image/image.js +64 -0
  109. package/dist/node/image/image.module.js +11 -0
  110. package/dist/node/index.js +2 -0
  111. package/dist/node/indicator/indicator.js +18 -0
  112. package/dist/node/indicator/indicator.module.js +8 -0
  113. package/dist/node/inline-loading/inline-loading.js +76 -0
  114. package/dist/node/inline-loading/inline-loading.module.js +11 -0
  115. package/dist/node/input/input.js +54 -0
  116. package/dist/node/input/input.module.js +11 -0
  117. package/dist/node/input-group/input-group.js +41 -0
  118. package/dist/node/input-group/input-group.module.js +11 -0
  119. package/dist/node/item/item.js +52 -0
  120. package/dist/node/item/item.module.js +12 -0
  121. package/dist/node/join/join.js +14 -0
  122. package/dist/node/join/join.module.js +5 -0
  123. package/dist/node/kbd/kbd.js +16 -0
  124. package/dist/node/kbd/kbd.module.js +5 -0
  125. package/dist/node/label/label.js +25 -0
  126. package/dist/node/label/label.module.js +9 -0
  127. package/dist/node/layouts/src/auto-grid/auto-grid.js +19 -0
  128. package/dist/node/layouts/src/auto-grid/auto-grid.module.js +6 -0
  129. package/dist/node/layouts/src/center/center.js +18 -0
  130. package/dist/node/layouts/src/center/center.module.js +5 -0
  131. package/dist/node/layouts/src/columns/columns.js +23 -0
  132. package/dist/node/layouts/src/columns/columns.module.js +8 -0
  133. package/dist/node/layouts/src/flex/flex.js +22 -0
  134. package/dist/node/layouts/src/flex/flex.module.js +5 -0
  135. package/dist/node/layouts/src/grid/grid.js +57 -0
  136. package/dist/node/layouts/src/grid/grid.module.js +9 -0
  137. package/dist/node/layouts/src/spacer/spacer.js +19 -0
  138. package/dist/node/layouts/src/spacer/spacer.module.js +5 -0
  139. package/dist/node/link/link.js +22 -0
  140. package/dist/node/link/link.module.js +5 -0
  141. package/dist/node/list/list.js +23 -0
  142. package/dist/node/list/list.module.js +8 -0
  143. package/dist/node/log-viewer/log-viewer.js +184 -0
  144. package/dist/node/log-viewer/log-viewer.module.js +18 -0
  145. package/dist/node/menu/menu.js +121 -0
  146. package/dist/node/menu/menu.module.js +10 -0
  147. package/dist/node/menu-button/menu-button.js +92 -0
  148. package/dist/node/menu-button/menu-button.module.js +10 -0
  149. package/dist/node/menubar/menubar.js +103 -0
  150. package/dist/node/menubar/menubar.module.js +10 -0
  151. package/dist/node/modal/modal.js +70 -0
  152. package/dist/node/modal/modal.module.js +13 -0
  153. package/dist/node/multi-select/multi-select.js +106 -0
  154. package/dist/node/multi-select/multi-select.module.js +17 -0
  155. package/dist/node/native-select/native-select.js +37 -0
  156. package/dist/node/native-select/native-select.module.js +9 -0
  157. package/dist/node/navigation-menu/navigation-menu.js +99 -0
  158. package/dist/node/navigation-menu/navigation-menu.module.js +12 -0
  159. package/dist/node/notification/notification.js +134 -0
  160. package/dist/node/notification/notification.module.js +13 -0
  161. package/dist/node/number-input/number-input.js +145 -0
  162. package/dist/node/number-input/number-input.module.js +14 -0
  163. package/dist/node/otp-input/otp-input.js +70 -0
  164. package/dist/node/otp-input/otp-input.module.js +8 -0
  165. package/dist/node/overflow-menu/overflow-menu.js +65 -0
  166. package/dist/node/overflow-menu/overflow-menu.module.js +9 -0
  167. package/dist/node/pagination/pagination.js +92 -0
  168. package/dist/node/pagination/pagination.module.js +13 -0
  169. package/dist/node/password-input/password-input.js +80 -0
  170. package/dist/node/password-input/password-input.module.js +13 -0
  171. package/dist/node/popover/popover.js +49 -0
  172. package/dist/node/popover/popover.module.js +8 -0
  173. package/dist/node/popover/use-popover.js +57 -0
  174. package/dist/node/progress/progress.js +17 -0
  175. package/dist/node/progress/progress.module.js +8 -0
  176. package/dist/node/progress-bar/progress-bar.js +44 -0
  177. package/dist/node/progress-bar/progress-bar.module.js +13 -0
  178. package/dist/node/progress-circle/progress-circle.js +48 -0
  179. package/dist/node/progress-circle/progress-circle.module.js +11 -0
  180. package/dist/node/progress-indicator/progress-indicator.js +36 -0
  181. package/dist/node/progress-indicator/progress-indicator.module.js +12 -0
  182. package/dist/node/prose/prose.js +15 -0
  183. package/dist/node/prose/prose.module.js +5 -0
  184. package/dist/node/pull-to-refresh/pull-to-refresh.js +82 -0
  185. package/dist/node/pull-to-refresh/pull-to-refresh.module.js +11 -0
  186. package/dist/node/qr-code/encode.js +585 -0
  187. package/dist/node/qr-code/qr-code.js +41 -0
  188. package/dist/node/qr-code/qr-code.module.js +8 -0
  189. package/dist/node/radial-progress/radial-progress.js +28 -0
  190. package/dist/node/radial-progress/radial-progress.module.js +8 -0
  191. package/dist/node/radio/radio.js +49 -0
  192. package/dist/node/radio/radio.module.js +11 -0
  193. package/dist/node/radio-card/radio-card.js +63 -0
  194. package/dist/node/radio-card/radio-card.module.js +13 -0
  195. package/dist/node/rating-group/rating-group.js +37 -0
  196. package/dist/node/rating-group/rating-group.module.js +8 -0
  197. package/dist/node/react/src/index.js +138 -0
  198. package/dist/node/react/src/theme.js +54 -0
  199. package/dist/node/relative-time/relative-time.js +66 -0
  200. package/dist/node/relative-time/relative-time.module.js +5 -0
  201. package/dist/node/resizable/resizable.js +80 -0
  202. package/dist/node/resizable/resizable.module.js +10 -0
  203. package/dist/node/scroll-area/scroll-area.js +38 -0
  204. package/dist/node/scroll-area/scroll-area.module.js +5 -0
  205. package/dist/node/search/search.js +94 -0
  206. package/dist/node/search/search.module.js +11 -0
  207. package/dist/node/segmented-control/segmented-control.js +43 -0
  208. package/dist/node/segmented-control/segmented-control.module.js +8 -0
  209. package/dist/node/select/select.js +71 -0
  210. package/dist/node/select/select.module.js +13 -0
  211. package/dist/node/separator/separator.js +21 -0
  212. package/dist/node/separator/separator.module.js +5 -0
  213. package/dist/node/sheet/sheet.js +50 -0
  214. package/dist/node/sheet/sheet.module.js +11 -0
  215. package/dist/node/shell-header/shell-header.js +166 -0
  216. package/dist/node/shell-header/shell-header.module.js +25 -0
  217. package/dist/node/side-nav/side-nav.js +333 -0
  218. package/dist/node/side-nav/side-nav.module.js +33 -0
  219. package/dist/node/skeleton/skeleton.js +25 -0
  220. package/dist/node/skeleton/skeleton.module.js +9 -0
  221. package/dist/node/skip-nav/skip-nav.js +27 -0
  222. package/dist/node/skip-nav/skip-nav.module.js +5 -0
  223. package/dist/node/slider/slider.js +29 -0
  224. package/dist/node/slider/slider.module.js +9 -0
  225. package/dist/node/spinner/spinner.js +18 -0
  226. package/dist/node/spinner/spinner.module.js +8 -0
  227. package/dist/node/stack/stack.js +19 -0
  228. package/dist/node/stack/stack.module.js +8 -0
  229. package/dist/node/stat/stat.js +41 -0
  230. package/dist/node/stat/stat.module.js +13 -0
  231. package/dist/node/status/status.js +20 -0
  232. package/dist/node/status/status.module.js +9 -0
  233. package/dist/node/steps/steps.js +35 -0
  234. package/dist/node/steps/steps.module.js +10 -0
  235. package/dist/node/storage/src/drivers.js +36 -0
  236. package/dist/node/storage/src/persisted-signal.js +43 -0
  237. package/dist/node/structured-list/structured-list.js +101 -0
  238. package/dist/node/structured-list/structured-list.module.js +14 -0
  239. package/dist/node/swap/swap.js +36 -0
  240. package/dist/node/swap/swap.module.js +9 -0
  241. package/dist/node/swipe-item/swipe-item.js +62 -0
  242. package/dist/node/swipe-item/swipe-item.module.js +14 -0
  243. package/dist/node/switcher/switcher.js +32 -0
  244. package/dist/node/switcher/switcher.module.js +10 -0
  245. package/dist/node/tabs/tabs.js +95 -0
  246. package/dist/node/tabs/tabs.module.js +10 -0
  247. package/dist/node/tag/tag.js +26 -0
  248. package/dist/node/tag/tag.module.js +8 -0
  249. package/dist/node/tags-input/tags-input.js +64 -0
  250. package/dist/node/tags-input/tags-input.module.js +10 -0
  251. package/dist/node/text/text.js +18 -0
  252. package/dist/node/text/text.module.js +5 -0
  253. package/dist/node/textarea/textarea.js +56 -0
  254. package/dist/node/textarea/textarea.module.js +11 -0
  255. package/dist/node/tile/tile.js +39 -0
  256. package/dist/node/tile/tile.module.js +9 -0
  257. package/dist/node/time-picker/time-picker.js +62 -0
  258. package/dist/node/time-picker/time-picker.module.js +11 -0
  259. package/dist/node/timeline/timeline.js +41 -0
  260. package/dist/node/timeline/timeline.module.js +13 -0
  261. package/dist/node/toast/toast.js +85 -0
  262. package/dist/node/toast/toast.module.js +13 -0
  263. package/dist/node/toc/toc.js +42 -0
  264. package/dist/node/toc/toc.module.js +5 -0
  265. package/dist/node/toc/use-toc-from-region.js +18 -0
  266. package/dist/node/toggle/toggle.js +39 -0
  267. package/dist/node/toggle/toggle.module.js +10 -0
  268. package/dist/node/toggle-group/toggle-group.js +55 -0
  269. package/dist/node/toggle-group/toggle-group.module.js +8 -0
  270. package/dist/node/toggletip/toggletip.js +49 -0
  271. package/dist/node/toggletip/toggletip.module.js +9 -0
  272. package/dist/node/tooltip/tooltip.js +58 -0
  273. package/dist/node/tooltip/tooltip.module.js +8 -0
  274. package/dist/node/tree-view/tree-view.js +201 -0
  275. package/dist/node/tree-view/tree-view.module.js +15 -0
  276. package/dist/node/user/user.js +37 -0
  277. package/dist/node/user/user.module.js +11 -0
  278. package/dist/node/visually-hidden/visually-hidden.js +15 -0
  279. package/dist/node/visually-hidden/visually-hidden.module.js +5 -0
  280. package/dist/number-input/number-input.js +41 -41
  281. package/dist/react/src/theme.js +42 -31
  282. package/dist/search/search.js +35 -35
  283. package/dist/swap/swap.js +12 -12
  284. package/dist/time-picker/time-picker.js +24 -24
  285. package/dist/toggle/toggle.js +12 -12
  286. package/package.json +7 -6
  287. package/readme.body.md +24 -11
@@ -0,0 +1,201 @@
1
+ "use client";
2
+
3
+ import e from "./tree-view.module.js";
4
+ import { cn as t, useControllableSignal as n, useSignal as r, useSignals as i } from "@cascivo/core";
5
+ import { builtin as a, t as o } from "@cascivo/i18n";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ import { useRef as l } from "react";
8
+ //#region ../components/src/tree-view/tree-view.tsx
9
+ function u(e, t) {
10
+ let n = [], r = (e, i, a) => {
11
+ for (let o of e) {
12
+ let e = !!o.children && o.children.length > 0, s = t.has(o.id);
13
+ n.push({
14
+ id: o.id,
15
+ level: i,
16
+ parentId: a,
17
+ hasChildren: e,
18
+ expanded: s
19
+ }), e && s && r(o.children, i + 1, o.id);
20
+ }
21
+ };
22
+ return r(e, 1, null), n;
23
+ }
24
+ function d(e) {
25
+ return e === void 0 ? [] : Array.isArray(e) ? e : e === "" ? [] : [e];
26
+ }
27
+ function f({ items: a, selectionMode: o = "single", selected: c, defaultSelected: f, onSelectChange: h, expanded: g, defaultExpanded: _, onExpandedChange: v, className: y, "aria-label": b }) {
28
+ i();
29
+ let [x, S] = n({
30
+ value: g,
31
+ defaultValue: _ ?? [],
32
+ onChange: v
33
+ }), [C, w] = n({
34
+ value: c,
35
+ defaultValue: f ?? (o === "multi" ? [] : ""),
36
+ onChange: h
37
+ }), T = r(null), E = l(/* @__PURE__ */ new Map()), D = new Set(x.value), O = u(a, D), k = new Map(O.map((e, t) => [e.id, t])), A = d(C.value), j = new Set(A), M = T.value ?? A[0] ?? O[0]?.id ?? null, N = (e) => S([...e]), P = (e) => {
38
+ if (D.has(e)) return;
39
+ let t = new Set(D);
40
+ t.add(e), N(t);
41
+ }, F = (e) => {
42
+ if (!D.has(e)) return;
43
+ let t = new Set(D);
44
+ t.delete(e), N(t);
45
+ }, I = (e) => {
46
+ T.value = e, E.current.get(e)?.focus();
47
+ }, L = (e) => {
48
+ if (o === "multi") {
49
+ let t = new Set(j);
50
+ t.has(e) ? t.delete(e) : t.add(e), w([...t]);
51
+ } else w(e);
52
+ }, R = l({
53
+ buffer: "",
54
+ at: 0
55
+ }), z = (e, t) => {
56
+ let n = k.get(t.id);
57
+ if (n === void 0) return;
58
+ let { hasChildren: r, level: i, parentId: o, expanded: s } = O[n];
59
+ switch (e.key) {
60
+ case "ArrowDown": {
61
+ e.preventDefault();
62
+ let t = O[n + 1];
63
+ t && I(t.id);
64
+ break;
65
+ }
66
+ case "ArrowUp": {
67
+ e.preventDefault();
68
+ let t = O[n - 1];
69
+ t && I(t.id);
70
+ break;
71
+ }
72
+ case "ArrowRight":
73
+ if (e.preventDefault(), r && !s) P(t.id);
74
+ else if (r && s) {
75
+ let e = O[n + 1];
76
+ e && e.level > i && I(e.id);
77
+ }
78
+ break;
79
+ case "ArrowLeft":
80
+ e.preventDefault(), r && s ? F(t.id) : o && I(o);
81
+ break;
82
+ case "Home":
83
+ e.preventDefault(), O[0] && I(O[0].id);
84
+ break;
85
+ case "End": {
86
+ e.preventDefault();
87
+ let t = O[O.length - 1];
88
+ t && I(t.id);
89
+ break;
90
+ }
91
+ case "Enter":
92
+ case " ":
93
+ e.preventDefault(), L(t.id);
94
+ break;
95
+ default:
96
+ if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) {
97
+ let t = R.current, r = Date.now();
98
+ t.buffer = r - t.at > 500 ? e.key : t.buffer + e.key, t.at = r;
99
+ let i = t.buffer.toLowerCase(), o = (e) => typeof e.label == "string" && e.label.toLowerCase().startsWith(i), s = p(a, D), c = [...O.slice(n + 1), ...O.slice(0, n + 1)].find((e) => {
100
+ let t = s.get(e.id);
101
+ return t ? o(t) : !1;
102
+ });
103
+ c && I(c.id);
104
+ }
105
+ break;
106
+ }
107
+ }, B = (e, t, n, r) => {
108
+ let i = !!e.children && e.children.length > 0, a = D.has(e.id), o = j.has(e.id), c = M === e.id, l = e.children?.length ?? 0;
109
+ return /* @__PURE__ */ s(m, {
110
+ node: e,
111
+ level: t,
112
+ posInSet: n,
113
+ setSize: r,
114
+ hasChildren: i,
115
+ isExpanded: a,
116
+ isSelected: o,
117
+ isTabbable: c,
118
+ itemRefs: E,
119
+ onFocusNode: () => T.value = e.id,
120
+ onKeyDown: (t) => z(t, e),
121
+ onActivate: () => {
122
+ I(e.id), i && (a ? F : P)(e.id), L(e.id);
123
+ },
124
+ children: i && e.children.map((e, n) => B(e, t + 1, n + 1, l))
125
+ }, e.id);
126
+ };
127
+ return /* @__PURE__ */ s("ul", {
128
+ role: "tree",
129
+ "aria-label": b,
130
+ className: t(e.tree, y),
131
+ children: a.map((e, t) => B(e, 1, t + 1, a.length))
132
+ });
133
+ }
134
+ function p(e, t) {
135
+ let n = /* @__PURE__ */ new Map(), r = (e) => {
136
+ for (let i of e) n.set(i.id, i), i.children && i.children.length > 0 && t.has(i.id) && r(i.children);
137
+ };
138
+ return r(e), n;
139
+ }
140
+ function m({ node: t, level: n, posInSet: r, setSize: i, hasChildren: a, isExpanded: o, isSelected: l, isTabbable: u, itemRefs: d, onFocusNode: f, onKeyDown: p, onActivate: m, children: h }) {
141
+ return /* @__PURE__ */ c("li", {
142
+ role: "treeitem",
143
+ "aria-level": n,
144
+ "aria-posinset": r,
145
+ "aria-setsize": i,
146
+ "aria-selected": l,
147
+ "aria-expanded": a ? o : void 0,
148
+ tabIndex: u ? 0 : -1,
149
+ "data-selected": l || void 0,
150
+ "data-state": a ? o ? "open" : "closed" : void 0,
151
+ style: { "--cascivo-tree-level": n },
152
+ className: e.item,
153
+ ref: (e) => {
154
+ e ? d.current.set(t.id, e) : d.current.delete(t.id);
155
+ },
156
+ onFocus: (e) => {
157
+ e.target === e.currentTarget && f();
158
+ },
159
+ onKeyDown: p,
160
+ onClick: (e) => {
161
+ e.stopPropagation(), m();
162
+ },
163
+ children: [/* @__PURE__ */ c("span", {
164
+ className: e.row,
165
+ children: [
166
+ a ? /* @__PURE__ */ s("span", {
167
+ className: e.twisty,
168
+ "aria-hidden": "true",
169
+ "data-state": o ? "open" : "closed"
170
+ }) : /* @__PURE__ */ s("span", {
171
+ className: e.twistySpacer,
172
+ "aria-hidden": "true"
173
+ }),
174
+ t.icon && /* @__PURE__ */ s("span", {
175
+ className: e.icon,
176
+ "aria-hidden": "true",
177
+ children: t.icon
178
+ }),
179
+ /* @__PURE__ */ s("span", {
180
+ className: e.label,
181
+ children: t.label
182
+ })
183
+ ]
184
+ }), a && /* @__PURE__ */ s("div", {
185
+ className: e.groupWrap,
186
+ "data-state": o ? "open" : "closed",
187
+ children: /* @__PURE__ */ s("ul", {
188
+ role: "group",
189
+ className: e.group,
190
+ children: h
191
+ })
192
+ })]
193
+ });
194
+ }
195
+ var h = {
196
+ loading: () => o(a.treeView.loading),
197
+ expand: () => o(a.treeView.expand),
198
+ collapse: () => o(a.treeView.collapse)
199
+ };
200
+ //#endregion
201
+ export { f as TreeView, h as treeViewMessages };
@@ -0,0 +1,15 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ tree: "_tree_ufkml_2",
5
+ item: "_item_ufkml_12",
6
+ row: "_row_ufkml_16",
7
+ twisty: "_twisty_ufkml_47",
8
+ twistySpacer: "_twistySpacer_ufkml_61",
9
+ icon: "_icon_ufkml_67",
10
+ label: "_label_ufkml_75",
11
+ groupWrap: "_groupWrap_ufkml_83",
12
+ group: "_group_ufkml_83"
13
+ };
14
+ //#endregion
15
+ export { e as default };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+
3
+ import { Avatar as e } from "../avatar/avatar.js";
4
+ import t from "./user.module.js";
5
+ import { cn as n } from "@cascivo/core";
6
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
7
+ //#region ../components/src/user/user.tsx
8
+ function a({ name: a, description: o, avatarProps: s, className: c, children: l, ...u }) {
9
+ let d = typeof a == "string" && s?.name === void 0 && s?.fallback === void 0 ? { name: a } : {};
10
+ return /* @__PURE__ */ i("div", {
11
+ role: "group",
12
+ className: n(t.user, c),
13
+ ...u,
14
+ children: [
15
+ /* @__PURE__ */ r(e, {
16
+ ...d,
17
+ ...s
18
+ }),
19
+ /* @__PURE__ */ i("span", {
20
+ className: t.text,
21
+ children: [/* @__PURE__ */ r("span", {
22
+ className: t.name,
23
+ children: a
24
+ }), o != null && /* @__PURE__ */ r("span", {
25
+ className: t.description,
26
+ children: o
27
+ })]
28
+ }),
29
+ l != null && /* @__PURE__ */ r("span", {
30
+ className: t.action,
31
+ children: l
32
+ })
33
+ ]
34
+ });
35
+ }
36
+ //#endregion
37
+ export { a as User };
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ user: "_user_uuj1b_2",
5
+ text: "_text_uuj1b_10",
6
+ name: "_name_uuj1b_17",
7
+ description: "_description_uuj1b_26",
8
+ action: "_action_uuj1b_34"
9
+ };
10
+ //#endregion
11
+ export { e as default };
@@ -0,0 +1,15 @@
1
+ "use client";
2
+
3
+ import e from "./visually-hidden.module.js";
4
+ import { cn as t } from "@cascivo/core";
5
+ import { jsx as n } from "react/jsx-runtime";
6
+ //#region ../components/src/visually-hidden/visually-hidden.tsx
7
+ function r({ children: r, className: i, ...a }) {
8
+ return /* @__PURE__ */ n("span", {
9
+ className: t(e.visuallyHidden, i),
10
+ ...a,
11
+ children: r
12
+ });
13
+ }
14
+ //#endregion
15
+ export { r as VisuallyHidden };
@@ -0,0 +1,5 @@
1
+ "use client";
2
+
3
+ var e = { visuallyHidden: "_visuallyHidden_1iva7_2" };
4
+ //#endregion
5
+ export { e as default };
@@ -30,66 +30,66 @@ function m(e) {
30
30
  let n = Number(t);
31
31
  return Number.isFinite(n) ? n : null;
32
32
  }
33
- function h({ value: n, defaultValue: h, onChange: g, min: _, max: v, step: y = 1, precision: b, formatOptions: x, label: S, hint: C, error: w, size: T = "md", disabled: E, incrementLabel: D, decrementLabel: O, className: k, id: A, onFocus: j, onBlur: M, onKeyDown: N, ...P }) {
33
+ function h({ value: n, defaultValue: h, onValueChange: g, onChange: _, min: v, max: y, step: b = 1, precision: x, formatOptions: S, label: C, hint: w, error: T, size: E = "md", disabled: D, incrementLabel: O, decrementLabel: k, className: A, id: j, onFocus: M, onBlur: N, onKeyDown: P, ...F }) {
34
34
  a();
35
- let F = D ?? s(o.numberInput.increment), I = O ?? s(o.numberInput.decrement), [L, R] = r(u), z = n !== void 0, B = i(h ?? null), V = i(""), H = z ? n : B.value, U = A ?? (S ? `cascade-number-input-${S.toLowerCase().replace(/\s+/g, "-")}` : void 0), W = (e) => {
36
- z || (B.value = e), V.value = e == null ? "" : String(e), e !== H && g?.(e);
37
- }, G = () => {
38
- let e = m(V.value);
39
- e != null && (e = d(e, _, v), b !== void 0 && (e = p(e, b))), W(e);
40
- }, K = (e) => {
41
- let t = (L.value === "focused" ? m(V.value) : H) ?? 0, n = b ?? Math.max(f(y), f(t));
42
- W(d(p(t + e * y, n), _, v));
43
- }, q = L.value === "focused" ? V.value : ((e) => e == null ? "" : x ? new Intl.NumberFormat(void 0, x).format(e) : String(e))(H), J = H != null && v !== void 0 && H >= v, Y = H != null && _ !== void 0 && H <= _;
35
+ let I = O ?? s(o.numberInput.increment), L = k ?? s(o.numberInput.decrement), [R, z] = r(u), B = n !== void 0, V = i(h ?? null), H = i(""), U = B ? n : V.value, W = j ?? (C ? `cascade-number-input-${C.toLowerCase().replace(/\s+/g, "-")}` : void 0), G = (e) => {
36
+ B || (V.value = e), H.value = e == null ? "" : String(e), e !== U && (g ?? _)?.(e);
37
+ }, K = () => {
38
+ let e = m(H.value);
39
+ e != null && (e = d(e, v, y), x !== void 0 && (e = p(e, x))), G(e);
40
+ }, q = (e) => {
41
+ let t = (R.value === "focused" ? m(H.value) : U) ?? 0, n = x ?? Math.max(f(b), f(t));
42
+ G(d(p(t + e * b, n), v, y));
43
+ }, J = R.value === "focused" ? H.value : ((e) => e == null ? "" : S ? new Intl.NumberFormat(void 0, S).format(e) : String(e))(U), Y = U != null && y !== void 0 && U >= y, X = U != null && v !== void 0 && U <= v;
44
44
  return /* @__PURE__ */ l("div", {
45
- className: t(e.wrapper, k),
46
- "data-state": w ? "error" : L.value,
47
- "data-size": T,
45
+ className: t(e.wrapper, A),
46
+ "data-state": T ? "error" : R.value,
47
+ "data-size": E,
48
48
  children: [
49
- S && /* @__PURE__ */ c("label", {
49
+ C && /* @__PURE__ */ c("label", {
50
50
  className: e.label,
51
- htmlFor: U,
52
- children: S
51
+ htmlFor: W,
52
+ children: C
53
53
  }),
54
54
  /* @__PURE__ */ l("div", {
55
55
  className: e.field,
56
56
  children: [/* @__PURE__ */ c("input", {
57
- id: U,
57
+ id: W,
58
58
  type: "text",
59
59
  inputMode: "decimal",
60
60
  autoComplete: "off",
61
61
  role: "spinbutton",
62
62
  className: e.input,
63
- value: q,
64
- disabled: E,
65
- "aria-valuenow": H ?? void 0,
66
- "aria-valuemin": _,
67
- "aria-valuemax": v,
68
- "aria-invalid": w ? !0 : void 0,
69
- "aria-describedby": w ? `${U}-error` : C ? `${U}-hint` : void 0,
63
+ value: J,
64
+ disabled: D,
65
+ "aria-valuenow": U ?? void 0,
66
+ "aria-valuemin": v,
67
+ "aria-valuemax": y,
68
+ "aria-invalid": T ? !0 : void 0,
69
+ "aria-describedby": T ? `${W}-error` : w ? `${W}-hint` : void 0,
70
70
  onChange: (e) => {
71
- V.value = e.target.value;
71
+ H.value = e.target.value;
72
72
  },
73
73
  onFocus: (e) => {
74
- V.value = H == null ? "" : String(H), R("FOCUS"), j?.(e);
74
+ H.value = U == null ? "" : String(U), z("FOCUS"), M?.(e);
75
75
  },
76
76
  onBlur: (e) => {
77
- G(), R("BLUR"), M?.(e);
77
+ K(), z("BLUR"), N?.(e);
78
78
  },
79
79
  onKeyDown: (e) => {
80
- e.key === "ArrowUp" ? (e.preventDefault(), K(1)) : e.key === "ArrowDown" ? (e.preventDefault(), K(-1)) : e.key === "Enter" && G(), N?.(e);
80
+ e.key === "ArrowUp" ? (e.preventDefault(), q(1)) : e.key === "ArrowDown" ? (e.preventDefault(), q(-1)) : e.key === "Enter" && K(), P?.(e);
81
81
  },
82
- ...P
82
+ ...F
83
83
  }), /* @__PURE__ */ l("div", {
84
84
  className: e.steppers,
85
85
  children: [/* @__PURE__ */ c("button", {
86
86
  type: "button",
87
87
  className: e.stepper,
88
- "aria-label": F,
88
+ "aria-label": I,
89
89
  tabIndex: -1,
90
- disabled: E || J,
90
+ disabled: D || Y,
91
91
  onMouseDown: (e) => e.preventDefault(),
92
- onClick: () => K(1),
92
+ onClick: () => q(1),
93
93
  children: /* @__PURE__ */ c("svg", {
94
94
  viewBox: "0 0 10 10",
95
95
  "aria-hidden": "true",
@@ -106,11 +106,11 @@ function h({ value: n, defaultValue: h, onChange: g, min: _, max: v, step: y = 1
106
106
  }), /* @__PURE__ */ c("button", {
107
107
  type: "button",
108
108
  className: e.stepper,
109
- "aria-label": I,
109
+ "aria-label": L,
110
110
  tabIndex: -1,
111
- disabled: E || Y,
111
+ disabled: D || X,
112
112
  onMouseDown: (e) => e.preventDefault(),
113
- onClick: () => K(-1),
113
+ onClick: () => q(-1),
114
114
  children: /* @__PURE__ */ c("svg", {
115
115
  viewBox: "0 0 10 10",
116
116
  "aria-hidden": "true",
@@ -127,16 +127,16 @@ function h({ value: n, defaultValue: h, onChange: g, min: _, max: v, step: y = 1
127
127
  })]
128
128
  })]
129
129
  }),
130
- w && /* @__PURE__ */ c("span", {
131
- id: `${U}-error`,
130
+ T && /* @__PURE__ */ c("span", {
131
+ id: `${W}-error`,
132
132
  className: e.error,
133
133
  role: "alert",
134
- children: w
134
+ children: T
135
135
  }),
136
- !w && C && /* @__PURE__ */ c("span", {
137
- id: `${U}-hint`,
136
+ !T && w && /* @__PURE__ */ c("span", {
137
+ id: `${W}-hint`,
138
138
  className: e.hint,
139
- children: C
139
+ children: w
140
140
  })
141
141
  ]
142
142
  });
@@ -2,42 +2,53 @@
2
2
 
3
3
  import { persistedSignal as e } from "../../storage/src/persisted-signal.js";
4
4
  import { useSignalEffect as t, useSignals as n } from "@cascivo/core";
5
- import { Fragment as r, jsx as i } from "react/jsx-runtime";
6
- import { useRef as a } from "react";
5
+ import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { useRef as o } from "react";
7
7
  //#region src/theme.tsx
8
- var o = "cascivo-theme", s = "data-theme", c = null, l = {
9
- storageKey: o,
10
- defaultTheme: "light"
8
+ var s = "cascivo-theme", c = "data-theme", l = null, u = {
9
+ storageKey: s,
10
+ defaultTheme: "light",
11
+ explicit: !1
11
12
  };
12
- function u(e) {
13
+ function d(e) {
13
14
  return typeof window > "u" || typeof window.matchMedia != "function" ? e : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : e;
14
15
  }
15
- function d() {
16
- return c ??= e(l.storageKey, u(l.defaultTheme)), c;
17
- }
18
- function f(e) {
19
- d().value = e;
16
+ function f() {
17
+ return u.explicit ? u.defaultTheme : d(u.defaultTheme);
20
18
  }
21
19
  function p() {
22
- return n(), [d(), f];
23
- }
24
- function m({ defaultTheme: e, value: n, storageKey: u = o, attribute: f = s, target: p, onChange: m, children: h }) {
25
- let g = a(!1);
26
- g.current || (g.current = !0, (c === null || l.storageKey !== u) && (l = {
27
- storageKey: u,
28
- defaultTheme: e ?? "light"
29
- }, c = null));
30
- let _ = d();
31
- n !== void 0 && (_.value = n);
32
- let v = a(m);
33
- return v.current = m, t(() => {
34
- let e = _.value;
35
- (p ? p.current : typeof document < "u" ? document.documentElement : null)?.setAttribute(f, e), v.current?.(e);
36
- }), /* @__PURE__ */ i(r, { children: h });
37
- }
38
- function h(e = {}) {
39
- let t = JSON.stringify(e.storageKey ?? o), n = JSON.stringify(e.attribute ?? s);
40
- return `(function(){try{var v=${JSON.stringify(e.defaultTheme ?? "light")};if(typeof matchMedia==='function'){if(matchMedia('(prefers-color-scheme: dark)').matches)v='dark';else if(matchMedia('(prefers-color-scheme: light)').matches)v='light';}var raw=localStorage.getItem(${t});if(raw){v=raw;try{var e=JSON.parse(raw);if(e&&typeof e==='object'&&'value'in e)v=e.value;}catch(_){}}document.documentElement.setAttribute(${n},v);}catch(_){}})();`;
20
+ return l ??= e(u.storageKey, f()), l;
21
+ }
22
+ function m(e) {
23
+ p().value = e;
24
+ }
25
+ function h() {
26
+ return n(), [p(), m];
27
+ }
28
+ function g(e) {
29
+ return JSON.stringify(e).replace(/</g, "\\u003c");
30
+ }
31
+ function _({ defaultTheme: e, value: n, storageKey: d = s, attribute: f = c, target: m, onChange: h, nonce: _, children: v }) {
32
+ let y = o(!1);
33
+ y.current || (y.current = !0, (l === null || u.storageKey !== d) && (u = {
34
+ storageKey: d,
35
+ defaultTheme: e ?? "light",
36
+ explicit: e !== void 0
37
+ }, l = null));
38
+ let b = p();
39
+ n !== void 0 && (b.value = n);
40
+ let x = o(h);
41
+ return x.current = h, t(() => {
42
+ let e = b.value;
43
+ (m ? m.current : typeof document < "u" ? document.documentElement : null)?.setAttribute(f, e), x.current?.(e);
44
+ }), n !== void 0 && !m ? /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("script", {
45
+ nonce: _,
46
+ dangerouslySetInnerHTML: { __html: `document.documentElement.setAttribute(${g(f)},${g(n)})` }
47
+ }), v] }) : /* @__PURE__ */ i(r, { children: v });
48
+ }
49
+ function v(e = {}) {
50
+ let t = JSON.stringify(e.storageKey ?? s), n = JSON.stringify(e.attribute ?? c), r = JSON.stringify(e.defaultTheme ?? "light"), i = e.defaultTheme === void 0 ? "if(typeof matchMedia==='function'){if(matchMedia('(prefers-color-scheme: dark)').matches)v='dark';else if(matchMedia('(prefers-color-scheme: light)').matches)v='light';}" : "";
51
+ return `(function(){try{var v=${r};` + i + `var raw=localStorage.getItem(${t});if(raw){v=raw;try{var e=JSON.parse(raw);if(e&&typeof e==='object'&&'value'in e)v=e.value;}catch(_){}}document.documentElement.setAttribute(${n},v);}catch(_){}})();`;
41
52
  }
42
53
  //#endregion
43
- export { m as ThemeProvider, f as setTheme, h as themePreloadScript, p as useTheme };
54
+ export { _ as ThemeProvider, m as setTheme, v as themePreloadScript, h as useTheme };
@@ -29,59 +29,59 @@ function d() {
29
29
  })]
30
30
  });
31
31
  }
32
- function f({ value: f, defaultValue: p = "", onChange: m, onSearch: h, debounceMs: g = 300, placeholder: _, size: v = "md", label: y, disabled: b = !1, clearLabel: x, id: S, className: C }) {
32
+ function f({ value: f, defaultValue: p = "", onValueChange: m, onChange: h, onSearch: g, debounceMs: _ = 300, placeholder: v, size: y = "md", label: b, disabled: x = !1, clearLabel: S, id: C, className: w }) {
33
33
  i();
34
- let w = _ ?? o(a.search.placeholder), T = y ?? o(a.search.label), E = x ?? o(a.search.clear), D = l(null), O = l("");
35
- O.current === "" && (u += 1, O.current = `cascade-search-${u}`);
36
- let k = S ?? O.current, A = f !== void 0, j = n(A ? f : p);
37
- A && (j.value = f);
38
- let M = l(h);
39
- M.current = h;
40
- let N = l(null), P = () => {
41
- N.current !== null && (clearTimeout(N.current), N.current = null);
34
+ let T = v ?? o(a.search.placeholder), E = b ?? o(a.search.label), D = S ?? o(a.search.clear), O = l(null), k = l("");
35
+ k.current === "" && (u += 1, k.current = `cascade-search-${u}`);
36
+ let A = C ?? k.current, j = f !== void 0, M = n(j ? f : p);
37
+ j && (M.value = f);
38
+ let N = l(g);
39
+ N.current = g;
40
+ let P = l(null), F = () => {
41
+ P.current !== null && (clearTimeout(P.current), P.current = null);
42
42
  };
43
- r(() => P);
44
- let F = (e) => {
43
+ r(() => F);
44
+ let I = (e) => {
45
45
  let t = e.target.value;
46
- A || (j.value = t), m?.(t), P(), N.current = setTimeout(() => {
47
- N.current = null, M.current?.(t);
48
- }, g);
49
- }, I = (e) => {
50
- e.key === "Enter" && (P(), h?.(j.value));
51
- }, L = () => {
52
- P(), A || (j.value = ""), m?.(""), h?.(""), D.current?.focus();
53
- }, R = j.value !== "";
46
+ j || (M.value = t), (m ?? h)?.(t), F(), P.current = setTimeout(() => {
47
+ P.current = null, N.current?.(t);
48
+ }, _);
49
+ }, L = (e) => {
50
+ e.key === "Enter" && (F(), g?.(M.value));
51
+ }, R = () => {
52
+ F(), j || (M.value = ""), (m ?? h)?.(""), g?.(""), O.current?.focus();
53
+ }, z = M.value !== "";
54
54
  return /* @__PURE__ */ c("div", {
55
- className: t(e.root, C),
56
- "data-size": v,
57
- "data-state": R ? "filled" : "empty",
55
+ className: t(e.root, w),
56
+ "data-size": y,
57
+ "data-state": z ? "filled" : "empty",
58
58
  children: [
59
59
  /* @__PURE__ */ s("label", {
60
60
  className: e.label,
61
- htmlFor: k,
62
- children: T
61
+ htmlFor: A,
62
+ children: E
63
63
  }),
64
64
  /* @__PURE__ */ s("span", {
65
65
  className: e.icon,
66
66
  children: /* @__PURE__ */ s(d, {})
67
67
  }),
68
68
  /* @__PURE__ */ s("input", {
69
- ref: D,
70
- id: k,
69
+ ref: O,
70
+ id: A,
71
71
  type: "search",
72
72
  className: e.input,
73
- value: j.value,
74
- placeholder: w,
75
- disabled: b,
76
- onChange: F,
77
- onKeyDown: I
73
+ value: M.value,
74
+ placeholder: T,
75
+ disabled: x,
76
+ onChange: I,
77
+ onKeyDown: L
78
78
  }),
79
- R && /* @__PURE__ */ s("button", {
79
+ z && /* @__PURE__ */ s("button", {
80
80
  type: "button",
81
81
  className: e.clear,
82
- "aria-label": E,
83
- disabled: b,
84
- onClick: L,
82
+ "aria-label": D,
83
+ disabled: x,
84
+ onClick: R,
85
85
  children: /* @__PURE__ */ s("span", {
86
86
  "aria-hidden": "true",
87
87
  children: "✕"
package/dist/swap/swap.js CHANGED
@@ -4,23 +4,23 @@ import e from "./swap.module.js";
4
4
  import { useSignal as t, useSignals as n } from "@cascivo/core";
5
5
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
6
  //#region ../components/src/swap/swap.tsx
7
- function a({ on: a, off: o, checked: s = !1, onChange: c, mode: l = "rotate", className: u, ...d }) {
7
+ function a({ on: a, off: o, checked: s = !1, onValueChange: c, onChange: l, mode: u = "rotate", className: d, ...f }) {
8
8
  n();
9
- let f = t(s);
10
- f.value = s;
11
- function p() {
12
- let e = !f.value;
13
- c?.(e);
9
+ let p = t(s);
10
+ p.value = s;
11
+ function m() {
12
+ let e = !p.value;
13
+ (c ?? l)?.(e);
14
14
  }
15
15
  return /* @__PURE__ */ i("button", {
16
16
  type: "button",
17
17
  role: "switch",
18
- "aria-checked": f.value,
19
- className: [e.swap, u].filter(Boolean).join(" "),
20
- "data-checked": f.value || void 0,
21
- "data-mode": l,
22
- onClick: p,
23
- ...d,
18
+ "aria-checked": p.value,
19
+ className: [e.swap, d].filter(Boolean).join(" "),
20
+ "data-checked": p.value || void 0,
21
+ "data-mode": u,
22
+ onClick: m,
23
+ ...f,
24
24
  children: [/* @__PURE__ */ r("span", {
25
25
  className: e.on,
26
26
  "aria-hidden": "true",