@cascivo/react 0.9.0 → 0.10.1

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 (278) hide show
  1. package/README.md +5 -5
  2. package/dist/command-menu/command-menu.js +2 -2
  3. package/dist/field/field.js +24 -15
  4. package/dist/index.d.ts +13 -0
  5. package/dist/node/accordion/accordion.js +95 -0
  6. package/dist/node/accordion/accordion.module.js +13 -0
  7. package/dist/node/action-sheet/action-sheet.js +91 -0
  8. package/dist/node/action-sheet/action-sheet.module.js +14 -0
  9. package/dist/node/alert/alert.js +55 -0
  10. package/dist/node/alert/alert.module.js +13 -0
  11. package/dist/node/alert-dialog/alert-dialog.js +68 -0
  12. package/dist/node/alert-dialog/alert-dialog.module.js +13 -0
  13. package/dist/node/app-shell/app-shell.js +80 -0
  14. package/dist/node/app-shell/app-shell.module.js +14 -0
  15. package/dist/node/aspect-ratio/aspect-ratio.js +22 -0
  16. package/dist/node/aspect-ratio/aspect-ratio.module.js +8 -0
  17. package/dist/node/avatar/avatar.js +57 -0
  18. package/dist/node/avatar/avatar.module.js +10 -0
  19. package/dist/node/avatar-group/avatar-group.js +26 -0
  20. package/dist/node/avatar-group/avatar-group.module.js +8 -0
  21. package/dist/node/badge/badge.js +17 -0
  22. package/dist/node/badge/badge.module.js +5 -0
  23. package/dist/node/blockquote/blockquote.js +18 -0
  24. package/dist/node/blockquote/blockquote.module.js +8 -0
  25. package/dist/node/bottom-sheet/bottom-sheet.js +111 -0
  26. package/dist/node/bottom-sheet/bottom-sheet.module.js +16 -0
  27. package/dist/node/breadcrumb/breadcrumb.js +28 -0
  28. package/dist/node/breadcrumb/breadcrumb.module.js +5 -0
  29. package/dist/node/button/button.js +31 -0
  30. package/dist/node/button/button.module.js +5 -0
  31. package/dist/node/button-group/button-group.js +39 -0
  32. package/dist/node/button-group/button-group.module.js +5 -0
  33. package/dist/node/calendar/calendar.js +195 -0
  34. package/dist/node/calendar/calendar.module.js +16 -0
  35. package/dist/node/card/card.js +45 -0
  36. package/dist/node/card/card.module.js +11 -0
  37. package/dist/node/carousel/carousel.js +138 -0
  38. package/dist/node/carousel/carousel.module.js +15 -0
  39. package/dist/node/chat-bubble/chat-bubble.js +33 -0
  40. package/dist/node/chat-bubble/chat-bubble.module.js +13 -0
  41. package/dist/node/checkbox/checkbox.js +38 -0
  42. package/dist/node/checkbox/checkbox.module.js +10 -0
  43. package/dist/node/checkbox-card/checkbox-card.js +48 -0
  44. package/dist/node/checkbox-card/checkbox-card.module.js +13 -0
  45. package/dist/node/code/code.js +16 -0
  46. package/dist/node/code/code.module.js +5 -0
  47. package/dist/node/code-snippet/code-snippet.js +116 -0
  48. package/dist/node/code-snippet/code-snippet.module.js +19 -0
  49. package/dist/node/code-snippet/highlight.js +69 -0
  50. package/dist/node/collapsible/collapsible.js +42 -0
  51. package/dist/node/collapsible/collapsible.module.js +10 -0
  52. package/dist/node/color-picker/color-picker.js +268 -0
  53. package/dist/node/color-picker/color-picker.module.js +20 -0
  54. package/dist/node/combobox/combobox.js +164 -0
  55. package/dist/node/combobox/combobox.module.js +21 -0
  56. package/dist/node/command-menu/command-menu.js +425 -0
  57. package/dist/node/command-menu/command-menu.module.js +36 -0
  58. package/dist/node/comparison/comparison.js +69 -0
  59. package/dist/node/comparison/comparison.module.js +11 -0
  60. package/dist/node/contained-list/contained-list.js +41 -0
  61. package/dist/node/contained-list/contained-list.module.js +13 -0
  62. package/dist/node/context-menu/context-menu.js +89 -0
  63. package/dist/node/context-menu/context-menu.module.js +9 -0
  64. package/dist/node/copy-button/copy-button.js +58 -0
  65. package/dist/node/copy-button/copy-button.module.js +8 -0
  66. package/dist/node/data-list/data-list.js +27 -0
  67. package/dist/node/data-list/data-list.module.js +10 -0
  68. package/dist/node/data-table/data-table.js +370 -0
  69. package/dist/node/data-table/data-table.module.js +35 -0
  70. package/dist/node/date-picker/date-picker.js +218 -0
  71. package/dist/node/date-picker/date-picker.module.js +25 -0
  72. package/dist/node/date-range-picker/date-range-picker.js +196 -0
  73. package/dist/node/date-range-picker/date-range-picker.module.js +20 -0
  74. package/dist/node/dock/dock.js +34 -0
  75. package/dist/node/dock/dock.module.js +10 -0
  76. package/dist/node/drawer/drawer.js +95 -0
  77. package/dist/node/drawer/drawer.module.js +15 -0
  78. package/dist/node/dropdown/dropdown.js +109 -0
  79. package/dist/node/dropdown/dropdown.module.js +11 -0
  80. package/dist/node/editable/editable.js +67 -0
  81. package/dist/node/editable/editable.module.js +13 -0
  82. package/dist/node/empty-state/empty-state.js +34 -0
  83. package/dist/node/empty-state/empty-state.module.js +11 -0
  84. package/dist/node/fab/fab.js +93 -0
  85. package/dist/node/fab/fab.module.js +14 -0
  86. package/dist/node/field/field.js +48 -0
  87. package/dist/node/field/field.module.js +9 -0
  88. package/dist/node/file-uploader/file-uploader.js +122 -0
  89. package/dist/node/file-uploader/file-uploader.module.js +20 -0
  90. package/dist/node/filter/filter.js +34 -0
  91. package/dist/node/filter/filter.module.js +8 -0
  92. package/dist/node/form/form.js +95 -0
  93. package/dist/node/form/form.module.js +5 -0
  94. package/dist/node/header/header.js +44 -0
  95. package/dist/node/header/header.module.js +13 -0
  96. package/dist/node/header-panel/header-panel.js +74 -0
  97. package/dist/node/header-panel/header-panel.module.js +11 -0
  98. package/dist/node/heading/heading.js +24 -0
  99. package/dist/node/heading/heading.module.js +5 -0
  100. package/dist/node/hover-card/hover-card.js +84 -0
  101. package/dist/node/hover-card/hover-card.module.js +8 -0
  102. package/dist/node/icon-button/icon-button.js +21 -0
  103. package/dist/node/icon-button/icon-button.module.js +5 -0
  104. package/dist/node/image/image.js +64 -0
  105. package/dist/node/image/image.module.js +11 -0
  106. package/dist/node/index.js +2 -0
  107. package/dist/node/indicator/indicator.js +18 -0
  108. package/dist/node/indicator/indicator.module.js +8 -0
  109. package/dist/node/inline-loading/inline-loading.js +76 -0
  110. package/dist/node/inline-loading/inline-loading.module.js +11 -0
  111. package/dist/node/input/input.js +54 -0
  112. package/dist/node/input/input.module.js +11 -0
  113. package/dist/node/input-group/input-group.js +41 -0
  114. package/dist/node/input-group/input-group.module.js +11 -0
  115. package/dist/node/item/item.js +52 -0
  116. package/dist/node/item/item.module.js +12 -0
  117. package/dist/node/join/join.js +14 -0
  118. package/dist/node/join/join.module.js +5 -0
  119. package/dist/node/kbd/kbd.js +16 -0
  120. package/dist/node/kbd/kbd.module.js +5 -0
  121. package/dist/node/label/label.js +25 -0
  122. package/dist/node/label/label.module.js +9 -0
  123. package/dist/node/layouts/src/auto-grid/auto-grid.js +19 -0
  124. package/dist/node/layouts/src/auto-grid/auto-grid.module.js +6 -0
  125. package/dist/node/layouts/src/center/center.js +18 -0
  126. package/dist/node/layouts/src/center/center.module.js +5 -0
  127. package/dist/node/layouts/src/columns/columns.js +23 -0
  128. package/dist/node/layouts/src/columns/columns.module.js +8 -0
  129. package/dist/node/layouts/src/flex/flex.js +22 -0
  130. package/dist/node/layouts/src/flex/flex.module.js +5 -0
  131. package/dist/node/layouts/src/grid/grid.js +57 -0
  132. package/dist/node/layouts/src/grid/grid.module.js +9 -0
  133. package/dist/node/layouts/src/spacer/spacer.js +19 -0
  134. package/dist/node/layouts/src/spacer/spacer.module.js +5 -0
  135. package/dist/node/link/link.js +22 -0
  136. package/dist/node/link/link.module.js +5 -0
  137. package/dist/node/list/list.js +23 -0
  138. package/dist/node/list/list.module.js +8 -0
  139. package/dist/node/log-viewer/log-viewer.js +184 -0
  140. package/dist/node/log-viewer/log-viewer.module.js +18 -0
  141. package/dist/node/menu/menu.js +121 -0
  142. package/dist/node/menu/menu.module.js +10 -0
  143. package/dist/node/menu-button/menu-button.js +92 -0
  144. package/dist/node/menu-button/menu-button.module.js +10 -0
  145. package/dist/node/menubar/menubar.js +103 -0
  146. package/dist/node/menubar/menubar.module.js +10 -0
  147. package/dist/node/modal/modal.js +70 -0
  148. package/dist/node/modal/modal.module.js +13 -0
  149. package/dist/node/multi-select/multi-select.js +106 -0
  150. package/dist/node/multi-select/multi-select.module.js +17 -0
  151. package/dist/node/native-select/native-select.js +37 -0
  152. package/dist/node/native-select/native-select.module.js +9 -0
  153. package/dist/node/navigation-menu/navigation-menu.js +99 -0
  154. package/dist/node/navigation-menu/navigation-menu.module.js +12 -0
  155. package/dist/node/notification/notification.js +134 -0
  156. package/dist/node/notification/notification.module.js +13 -0
  157. package/dist/node/number-input/number-input.js +145 -0
  158. package/dist/node/number-input/number-input.module.js +14 -0
  159. package/dist/node/otp-input/otp-input.js +70 -0
  160. package/dist/node/otp-input/otp-input.module.js +8 -0
  161. package/dist/node/overflow-menu/overflow-menu.js +65 -0
  162. package/dist/node/overflow-menu/overflow-menu.module.js +9 -0
  163. package/dist/node/pagination/pagination.js +92 -0
  164. package/dist/node/pagination/pagination.module.js +13 -0
  165. package/dist/node/password-input/password-input.js +80 -0
  166. package/dist/node/password-input/password-input.module.js +13 -0
  167. package/dist/node/popover/popover.js +49 -0
  168. package/dist/node/popover/popover.module.js +8 -0
  169. package/dist/node/popover/use-popover.js +57 -0
  170. package/dist/node/progress/progress.js +17 -0
  171. package/dist/node/progress/progress.module.js +8 -0
  172. package/dist/node/progress-bar/progress-bar.js +44 -0
  173. package/dist/node/progress-bar/progress-bar.module.js +13 -0
  174. package/dist/node/progress-circle/progress-circle.js +48 -0
  175. package/dist/node/progress-circle/progress-circle.module.js +11 -0
  176. package/dist/node/progress-indicator/progress-indicator.js +36 -0
  177. package/dist/node/progress-indicator/progress-indicator.module.js +12 -0
  178. package/dist/node/prose/prose.js +15 -0
  179. package/dist/node/prose/prose.module.js +5 -0
  180. package/dist/node/pull-to-refresh/pull-to-refresh.js +82 -0
  181. package/dist/node/pull-to-refresh/pull-to-refresh.module.js +11 -0
  182. package/dist/node/qr-code/encode.js +585 -0
  183. package/dist/node/qr-code/qr-code.js +41 -0
  184. package/dist/node/qr-code/qr-code.module.js +8 -0
  185. package/dist/node/radial-progress/radial-progress.js +28 -0
  186. package/dist/node/radial-progress/radial-progress.module.js +8 -0
  187. package/dist/node/radio/radio.js +49 -0
  188. package/dist/node/radio/radio.module.js +11 -0
  189. package/dist/node/radio-card/radio-card.js +63 -0
  190. package/dist/node/radio-card/radio-card.module.js +13 -0
  191. package/dist/node/rating-group/rating-group.js +37 -0
  192. package/dist/node/rating-group/rating-group.module.js +8 -0
  193. package/dist/node/react/src/index.js +138 -0
  194. package/dist/node/react/src/theme.js +54 -0
  195. package/dist/node/relative-time/relative-time.js +66 -0
  196. package/dist/node/relative-time/relative-time.module.js +5 -0
  197. package/dist/node/resizable/resizable.js +80 -0
  198. package/dist/node/resizable/resizable.module.js +10 -0
  199. package/dist/node/scroll-area/scroll-area.js +38 -0
  200. package/dist/node/scroll-area/scroll-area.module.js +5 -0
  201. package/dist/node/search/search.js +94 -0
  202. package/dist/node/search/search.module.js +11 -0
  203. package/dist/node/segmented-control/segmented-control.js +43 -0
  204. package/dist/node/segmented-control/segmented-control.module.js +8 -0
  205. package/dist/node/select/select.js +71 -0
  206. package/dist/node/select/select.module.js +13 -0
  207. package/dist/node/separator/separator.js +21 -0
  208. package/dist/node/separator/separator.module.js +5 -0
  209. package/dist/node/sheet/sheet.js +50 -0
  210. package/dist/node/sheet/sheet.module.js +11 -0
  211. package/dist/node/shell-header/shell-header.js +166 -0
  212. package/dist/node/shell-header/shell-header.module.js +25 -0
  213. package/dist/node/side-nav/side-nav.js +333 -0
  214. package/dist/node/side-nav/side-nav.module.js +33 -0
  215. package/dist/node/skeleton/skeleton.js +25 -0
  216. package/dist/node/skeleton/skeleton.module.js +9 -0
  217. package/dist/node/skip-nav/skip-nav.js +27 -0
  218. package/dist/node/skip-nav/skip-nav.module.js +5 -0
  219. package/dist/node/slider/slider.js +29 -0
  220. package/dist/node/slider/slider.module.js +9 -0
  221. package/dist/node/spinner/spinner.js +18 -0
  222. package/dist/node/spinner/spinner.module.js +8 -0
  223. package/dist/node/stack/stack.js +19 -0
  224. package/dist/node/stack/stack.module.js +8 -0
  225. package/dist/node/stat/stat.js +41 -0
  226. package/dist/node/stat/stat.module.js +13 -0
  227. package/dist/node/status/status.js +20 -0
  228. package/dist/node/status/status.module.js +9 -0
  229. package/dist/node/steps/steps.js +35 -0
  230. package/dist/node/steps/steps.module.js +10 -0
  231. package/dist/node/storage/src/drivers.js +36 -0
  232. package/dist/node/storage/src/persisted-signal.js +43 -0
  233. package/dist/node/structured-list/structured-list.js +101 -0
  234. package/dist/node/structured-list/structured-list.module.js +14 -0
  235. package/dist/node/swap/swap.js +36 -0
  236. package/dist/node/swap/swap.module.js +9 -0
  237. package/dist/node/swipe-item/swipe-item.js +62 -0
  238. package/dist/node/swipe-item/swipe-item.module.js +14 -0
  239. package/dist/node/switcher/switcher.js +32 -0
  240. package/dist/node/switcher/switcher.module.js +10 -0
  241. package/dist/node/tabs/tabs.js +95 -0
  242. package/dist/node/tabs/tabs.module.js +10 -0
  243. package/dist/node/tag/tag.js +26 -0
  244. package/dist/node/tag/tag.module.js +8 -0
  245. package/dist/node/tags-input/tags-input.js +64 -0
  246. package/dist/node/tags-input/tags-input.module.js +10 -0
  247. package/dist/node/text/text.js +18 -0
  248. package/dist/node/text/text.module.js +5 -0
  249. package/dist/node/textarea/textarea.js +56 -0
  250. package/dist/node/textarea/textarea.module.js +11 -0
  251. package/dist/node/tile/tile.js +39 -0
  252. package/dist/node/tile/tile.module.js +9 -0
  253. package/dist/node/time-picker/time-picker.js +62 -0
  254. package/dist/node/time-picker/time-picker.module.js +11 -0
  255. package/dist/node/timeline/timeline.js +41 -0
  256. package/dist/node/timeline/timeline.module.js +13 -0
  257. package/dist/node/toast/toast.js +85 -0
  258. package/dist/node/toast/toast.module.js +13 -0
  259. package/dist/node/toc/toc.js +42 -0
  260. package/dist/node/toc/toc.module.js +5 -0
  261. package/dist/node/toc/use-toc-from-region.js +18 -0
  262. package/dist/node/toggle/toggle.js +39 -0
  263. package/dist/node/toggle/toggle.module.js +10 -0
  264. package/dist/node/toggle-group/toggle-group.js +55 -0
  265. package/dist/node/toggle-group/toggle-group.module.js +8 -0
  266. package/dist/node/toggletip/toggletip.js +49 -0
  267. package/dist/node/toggletip/toggletip.module.js +9 -0
  268. package/dist/node/tooltip/tooltip.js +58 -0
  269. package/dist/node/tooltip/tooltip.module.js +8 -0
  270. package/dist/node/tree-view/tree-view.js +201 -0
  271. package/dist/node/tree-view/tree-view.module.js +15 -0
  272. package/dist/node/user/user.js +37 -0
  273. package/dist/node/user/user.module.js +11 -0
  274. package/dist/node/visually-hidden/visually-hidden.js +15 -0
  275. package/dist/node/visually-hidden/visually-hidden.module.js +5 -0
  276. package/dist/react/src/theme.js +35 -29
  277. package/package.json +4 -3
  278. package/readme.body.md +5 -5
@@ -0,0 +1,58 @@
1
+ "use client";
2
+
3
+ import e from "./copy-button.module.js";
4
+ import { cn as t, useSignal as n, useSignals as r } from "@cascivo/core";
5
+ import { builtin as i, t as a } from "@cascivo/i18n";
6
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ //#region ../components/src/copy-button/copy-button.tsx
8
+ function c({ value: c, size: l = "md", labels: u, className: d, ...f }) {
9
+ r();
10
+ let p = n(!1), m = u?.copy ?? a(i.copyButton.copy), h = u?.copied ?? a(i.copyButton.copied);
11
+ return /* @__PURE__ */ o("button", {
12
+ type: "button",
13
+ "aria-label": p.value ? h : m,
14
+ "data-state": p.value ? "copied" : "idle",
15
+ "data-size": l,
16
+ className: t(e.copyButton, d),
17
+ onClick: () => {
18
+ navigator.clipboard.writeText(c), p.value = !0, setTimeout(() => {
19
+ p.value = !1;
20
+ }, 2e3);
21
+ },
22
+ ...f,
23
+ children: p.value ? /* @__PURE__ */ o("svg", {
24
+ "aria-hidden": "true",
25
+ viewBox: "0 0 16 16",
26
+ className: e.icon,
27
+ children: /* @__PURE__ */ o("path", {
28
+ d: "M13.5 4.5 6 12 2.5 8.5",
29
+ fill: "none",
30
+ stroke: "currentColor",
31
+ strokeWidth: "1.5",
32
+ strokeLinecap: "round",
33
+ strokeLinejoin: "round"
34
+ })
35
+ }) : /* @__PURE__ */ s("svg", {
36
+ "aria-hidden": "true",
37
+ viewBox: "0 0 16 16",
38
+ className: e.icon,
39
+ children: [/* @__PURE__ */ o("rect", {
40
+ x: "5.5",
41
+ y: "5.5",
42
+ width: "8",
43
+ height: "8",
44
+ rx: "1.5",
45
+ fill: "none",
46
+ stroke: "currentColor",
47
+ strokeWidth: "1.5"
48
+ }), /* @__PURE__ */ o("path", {
49
+ d: "M3.5 10.5h-1a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1h7a1 1 0 0 1 1 1v1",
50
+ fill: "none",
51
+ stroke: "currentColor",
52
+ strokeWidth: "1.5"
53
+ })]
54
+ })
55
+ });
56
+ }
57
+ //#endregion
58
+ export { c as CopyButton };
@@ -0,0 +1,8 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ copyButton: "_copyButton_w0pqt_2",
5
+ icon: "_icon_w0pqt_45"
6
+ };
7
+ //#endregion
8
+ export { e as default };
@@ -0,0 +1,27 @@
1
+ "use client";
2
+
3
+ import e from "./data-list.module.js";
4
+ import { cn as t } from "@cascivo/core";
5
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
6
+ //#region ../components/src/data-list/data-list.tsx
7
+ function i({ items: i, orientation: a = "horizontal", dividers: o = !1, size: s = "md", className: c, ...l }) {
8
+ return /* @__PURE__ */ n("dl", {
9
+ "data-orientation": a,
10
+ "data-size": s,
11
+ "data-dividers": o ? "" : void 0,
12
+ className: t(e.list, c),
13
+ ...l,
14
+ children: i.map((t, i) => /* @__PURE__ */ r("div", {
15
+ className: e.row,
16
+ children: [/* @__PURE__ */ n("dt", {
17
+ className: e.term,
18
+ children: t.label
19
+ }), /* @__PURE__ */ n("dd", {
20
+ className: e.detail,
21
+ children: t.value
22
+ })]
23
+ }, t.id ?? i))
24
+ });
25
+ }
26
+ //#endregion
27
+ export { i as DataList };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ list: "_list_prsqy_2",
5
+ row: "_row_prsqy_21",
6
+ term: "_term_prsqy_45",
7
+ detail: "_detail_prsqy_51"
8
+ };
9
+ //#endregion
10
+ export { e as default };
@@ -0,0 +1,370 @@
1
+ "use client";
2
+
3
+ import { Button as e } from "../button/button.js";
4
+ import { Checkbox as t } from "../checkbox/checkbox.js";
5
+ import n from "./data-table.module.js";
6
+ import { batch as r, cn as i, useComputed as a, useSignal as o, useSignalEffect as ee, useSignals as te } from "@cascivo/core";
7
+ import { builtin as s, t as c } from "@cascivo/i18n";
8
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
+ import { Fragment as ne, useId as re, useRef as ie } from "react";
10
+ import { flushSync as ae } from "react-dom";
11
+ //#region ../components/src/data-table/data-table.tsx
12
+ function d(e, t) {
13
+ return e[t];
14
+ }
15
+ function oe(e, t) {
16
+ return typeof e == "number" && typeof t == "number" ? e - t : String(e ?? "").localeCompare(String(t ?? ""));
17
+ }
18
+ function f({ columns: f, rows: se, getRowId: ce, sort: p, defaultSort: le, sortMode: ue = "client", onSortChange: de, searchable: m = !1, pagination: h, selection: g, batchActions: _, renderExpandedRow: v, density: fe = "normal", zebra: pe = !1, stickyHeader: me = !1, loading: y = !1, emptyState: he, title: b, description: x, labels: S, className: ge, virtualized: C = !1, rowHeight: w = 40, windowSize: _e = 20, overscan: ve = 3 }) {
19
+ te();
20
+ let ye = re(), T = {
21
+ search: S?.search ?? c(s.dataTable.search),
22
+ empty: S?.empty ?? c(s.dataTable.empty),
23
+ selectAll: S?.selectAll ?? c(s.dataTable.selectAll),
24
+ selectRow: S?.selectRow ?? c(s.dataTable.selectRow),
25
+ itemsSelected: (e) => S?.itemsSelected?.(e) ?? c(s.dataTable.itemsSelected, { count: e }),
26
+ expandRow: S?.expandRow ?? c(s.dataTable.expandRow),
27
+ previousPage: S?.previousPage ?? c(s.dataTable.previousPage),
28
+ nextPage: S?.nextPage ?? c(s.dataTable.nextPage)
29
+ }, E = o(se);
30
+ E.value = se;
31
+ let D = o(f);
32
+ D.value = f;
33
+ let O = o(p ?? le);
34
+ p !== void 0 && (O.value = p);
35
+ let k = o(g?.selected ?? []);
36
+ g?.selected !== void 0 && (k.value = g.selected);
37
+ let A = o(""), j = o(1), M = o(h?.pageSize ?? 0), N = o(/* @__PURE__ */ new Set()), P = ie(null), F = o(0);
38
+ ee(() => {
39
+ if (!C) return;
40
+ let e = P.current;
41
+ if (!e) return;
42
+ let t = () => {
43
+ ae(() => {
44
+ F.value = e.scrollTop;
45
+ });
46
+ };
47
+ return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
48
+ });
49
+ let I = a(() => E.value.map((e, t) => ({
50
+ row: e,
51
+ id: ce ? ce(e) : String(t)
52
+ }))), L = a(() => {
53
+ let e = A.value.trim().toLowerCase();
54
+ if (!e) return I.value;
55
+ let t = D.value;
56
+ return I.value.filter((n) => t.some((t) => String(d(n.row, t.key) ?? "").toLowerCase().includes(e)));
57
+ }), R = a(() => {
58
+ let e = O.value;
59
+ if (!e || ue === "server") return L.value;
60
+ let t = L.value.map((e, t) => [e, t]);
61
+ return t.sort((t, n) => {
62
+ let r = oe(d(t[0].row, e.key), d(n[0].row, e.key));
63
+ return e.direction === "desc" && (r = -r), r === 0 ? t[1] - n[1] : r;
64
+ }), t.map(([e]) => e);
65
+ }), z = a(() => h ? Math.max(1, Math.ceil(L.value.length / M.value)) : 1), B = a(() => Math.min(j.value, z.value)), V = a(() => {
66
+ if (!h) return R.value;
67
+ let e = (B.value - 1) * M.value;
68
+ return R.value.slice(e, e + M.value);
69
+ }), H = a(() => C ? Math.floor(F.value / w) : 0), U = a(() => C ? Math.min(H.value + _e + ve * 2, V.value.length) : V.value.length), be = a(() => C ? V.value.slice(H.value, U.value) : V.value), xe = (e) => {
70
+ let t = O.value, n;
71
+ n = !t || t.key !== e ? {
72
+ key: e,
73
+ direction: "asc"
74
+ } : t.direction === "asc" ? {
75
+ key: e,
76
+ direction: "desc"
77
+ } : void 0, r(() => {
78
+ p === void 0 && (O.value = n), j.value = 1;
79
+ }), de?.(n);
80
+ }, Se = (e) => {
81
+ if (![
82
+ "ArrowUp",
83
+ "ArrowDown",
84
+ "ArrowLeft",
85
+ "ArrowRight"
86
+ ].includes(e.key)) return;
87
+ let t = e.currentTarget, n = Array.from(t.querySelectorAll("th button, td button, td input[type=\"checkbox\"]")), r = n.indexOf(document.activeElement);
88
+ if (r === -1) return;
89
+ e.preventDefault();
90
+ let i = (e) => e.closest("tr"), a;
91
+ if (e.key === "ArrowRight" || e.key === "ArrowLeft") {
92
+ let t = n[r + (e.key === "ArrowRight" ? 1 : -1)];
93
+ t && i(t) === i(n[r]) && (a = t);
94
+ } else {
95
+ let t = e.key === "ArrowDown" ? 1 : -1, o = n[r];
96
+ for (let e = r + t; e >= 0 && e < n.length; e += t) if (i(n[e]) !== i(o)) {
97
+ a = n[e];
98
+ break;
99
+ }
100
+ }
101
+ a?.focus();
102
+ }, W = (e) => {
103
+ g?.selected === void 0 && (k.value = e), g?.onChange?.(e);
104
+ }, Ce = (e) => {
105
+ let t = k.value;
106
+ g?.mode === "single" ? W(t.includes(e) ? [] : [e]) : W(t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
107
+ }, we = (e) => {
108
+ let t = new Set(N.value);
109
+ t.has(e) ? t.delete(e) : t.add(e), N.value = t;
110
+ }, G = V.value, K = k.value, Te = N.value, q = G.length > 0 && G.every((e) => K.includes(e.id)), Ee = G.some((e) => K.includes(e.id)), J = be.value, Y = H.value, X = U.value, De = () => {
111
+ let e = G.map((e) => e.id);
112
+ W(q ? K.filter((t) => !e.includes(t)) : [...new Set([...K, ...e])]);
113
+ }, Z = f.length + +!!g + +!!v, Oe = h && !C && J.length > 0 ? Math.max(0, M.value - J.length) : 0, ke = `${ye}-title`, Ae = `${ye}-description`, Q = L.value.length, $ = Q === 0 ? 0 : (B.value - 1) * M.value + 1, je = Q === 0 ? 0 : $ + G.length - 1, Me = !!_ && _.length > 0 && K.length > 0;
114
+ return /* @__PURE__ */ u("div", {
115
+ className: i(n.root, ge),
116
+ "data-density": fe,
117
+ "data-zebra": pe || void 0,
118
+ "data-sticky-header": me || void 0,
119
+ "data-paginated": h ? !0 : void 0,
120
+ children: [
121
+ /* @__PURE__ */ l("span", {
122
+ "aria-live": "polite",
123
+ className: n.srOnly,
124
+ children: k.value.length > 0 ? T.itemsSelected(k.value.length) : ""
125
+ }),
126
+ (b !== void 0 || x !== void 0 || m) && /* @__PURE__ */ u("div", {
127
+ className: n.toolbar,
128
+ children: [(b !== void 0 || x !== void 0) && /* @__PURE__ */ u("div", {
129
+ className: n.heading,
130
+ children: [b !== void 0 && /* @__PURE__ */ l("div", {
131
+ id: ke,
132
+ className: n.title,
133
+ children: b
134
+ }), x !== void 0 && /* @__PURE__ */ l("div", {
135
+ id: Ae,
136
+ className: n.description,
137
+ children: x
138
+ })]
139
+ }), m && /* @__PURE__ */ l("input", {
140
+ type: "search",
141
+ className: n.search,
142
+ "aria-label": T.search,
143
+ placeholder: T.search,
144
+ value: A.value,
145
+ onChange: (e) => {
146
+ A.value = e.target.value, j.value = 1;
147
+ }
148
+ })]
149
+ }),
150
+ Me && /* @__PURE__ */ u("div", {
151
+ className: n.batchBar,
152
+ children: [/* @__PURE__ */ l("span", {
153
+ className: n.batchCount,
154
+ children: T.itemsSelected(K.length)
155
+ }), /* @__PURE__ */ l("div", {
156
+ className: n.batchActions,
157
+ children: _.map((t, n) => /* @__PURE__ */ l(e, {
158
+ size: "sm",
159
+ variant: "secondary",
160
+ onClick: () => t.onClick(K),
161
+ children: t.label
162
+ }, t.id ?? `${n}-${t.label}`))
163
+ })]
164
+ }),
165
+ /* @__PURE__ */ l("div", {
166
+ ref: C ? P : void 0,
167
+ className: i(n.scroller, C && n.scrollerVirtualized),
168
+ children: /* @__PURE__ */ u("table", {
169
+ className: n.table,
170
+ "aria-labelledby": b === void 0 ? void 0 : ke,
171
+ "aria-describedby": x === void 0 ? void 0 : Ae,
172
+ "aria-busy": y || void 0,
173
+ "aria-rowcount": C ? G.length : void 0,
174
+ onKeyDown: Se,
175
+ children: [
176
+ /* @__PURE__ */ u("colgroup", { children: [
177
+ v && /* @__PURE__ */ l("col", { className: n.controlCol }),
178
+ g && /* @__PURE__ */ l("col", { className: n.controlCol }),
179
+ f.map((e) => /* @__PURE__ */ l("col", { style: e.width === void 0 ? void 0 : { width: e.width } }, e.key))
180
+ ] }),
181
+ /* @__PURE__ */ l("thead", { children: /* @__PURE__ */ u("tr", { children: [
182
+ v && /* @__PURE__ */ l("th", {
183
+ scope: "col",
184
+ className: n.controlCell,
185
+ children: /* @__PURE__ */ l("span", {
186
+ className: n.srOnly,
187
+ children: T.expandRow
188
+ })
189
+ }),
190
+ g && /* @__PURE__ */ l("th", {
191
+ scope: "col",
192
+ className: n.controlCell,
193
+ children: g.mode === "multi" ? /* @__PURE__ */ l(t, {
194
+ "aria-label": T.selectAll,
195
+ checked: q,
196
+ indeterminate: Ee && !q,
197
+ onChange: De
198
+ }) : /* @__PURE__ */ l("span", {
199
+ className: n.srOnly,
200
+ children: T.selectRow
201
+ })
202
+ }),
203
+ f.map((e) => {
204
+ let t = O.value?.key === e.key ? O.value.direction : void 0, r = t === "asc" ? "ascending" : t === "desc" ? "descending" : "none";
205
+ return /* @__PURE__ */ l("th", {
206
+ scope: "col",
207
+ "data-align": e.align ?? "start",
208
+ "aria-sort": e.sortable ? r : void 0,
209
+ children: e.sortable ? /* @__PURE__ */ l("button", {
210
+ type: "button",
211
+ className: n.sortButton,
212
+ "data-state": r,
213
+ onClick: () => xe(e.key),
214
+ children: e.header
215
+ }) : e.header
216
+ }, e.key);
217
+ })
218
+ ] }) }),
219
+ /* @__PURE__ */ u("tbody", { children: [
220
+ y && Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ l("tr", {
221
+ className: n.row,
222
+ children: Array.from({ length: Z }, (e, t) => /* @__PURE__ */ l("td", { children: /* @__PURE__ */ l("span", {
223
+ className: n.shimmer,
224
+ "aria-hidden": "true"
225
+ }) }, t))
226
+ }, t)),
227
+ !y && G.length === 0 && /* @__PURE__ */ l("tr", {
228
+ "data-empty-row": !0,
229
+ children: /* @__PURE__ */ l("td", {
230
+ colSpan: Z,
231
+ className: n.emptyCell,
232
+ children: he ?? T.empty
233
+ })
234
+ }),
235
+ !y && C && Y > 0 && /* @__PURE__ */ l("tr", {
236
+ "aria-hidden": "true",
237
+ style: { height: Y * w }
238
+ }),
239
+ !y && J.map((e, r) => {
240
+ let i = C ? Y + r : r, a = K.includes(e.id), o = Te.has(e.id);
241
+ return /* @__PURE__ */ u(ne, { children: [/* @__PURE__ */ u("tr", {
242
+ className: n.row,
243
+ "data-parity": i % 2 == 0 ? "even" : "odd",
244
+ "data-state": a ? "selected" : void 0,
245
+ "aria-rowindex": C ? Y + r + 1 : void 0,
246
+ children: [
247
+ v && /* @__PURE__ */ l("td", {
248
+ className: n.controlCell,
249
+ children: /* @__PURE__ */ l("button", {
250
+ type: "button",
251
+ className: n.expandButton,
252
+ "aria-expanded": o,
253
+ "aria-label": T.expandRow,
254
+ "data-state": o ? "open" : "closed",
255
+ onClick: () => we(e.id),
256
+ children: /* @__PURE__ */ l("span", {
257
+ className: n.chevron,
258
+ "aria-hidden": "true"
259
+ })
260
+ })
261
+ }),
262
+ g && /* @__PURE__ */ l("td", {
263
+ className: n.controlCell,
264
+ children: /* @__PURE__ */ l(t, {
265
+ "aria-label": T.selectRow,
266
+ checked: a,
267
+ onChange: () => Ce(e.id)
268
+ })
269
+ }),
270
+ f.map((t) => /* @__PURE__ */ l("td", {
271
+ "data-align": t.align ?? "start",
272
+ children: t.render ? t.render(e.row) : String(d(e.row, t.key) ?? "")
273
+ }, t.key))
274
+ ]
275
+ }), v && /* @__PURE__ */ l("tr", {
276
+ className: n.expansionRow,
277
+ "data-state": o ? "open" : "closed",
278
+ children: /* @__PURE__ */ l("td", {
279
+ colSpan: Z,
280
+ children: /* @__PURE__ */ l("div", {
281
+ className: n.expansionGrid,
282
+ "data-state": o ? "open" : "closed",
283
+ children: /* @__PURE__ */ l("div", {
284
+ className: n.expansionInner,
285
+ children: v(e.row)
286
+ })
287
+ })
288
+ })
289
+ })] }, e.id);
290
+ }),
291
+ !y && C && X < G.length && /* @__PURE__ */ l("tr", {
292
+ "aria-hidden": "true",
293
+ style: { height: (G.length - X) * w }
294
+ }),
295
+ Oe > 0 && /* @__PURE__ */ l("tr", {
296
+ "aria-hidden": "true",
297
+ "data-filler-row": !0,
298
+ children: /* @__PURE__ */ l("td", {
299
+ colSpan: Z,
300
+ style: {
301
+ blockSize: `calc(var(--_row-height) * ${Oe})`,
302
+ padding: 0
303
+ }
304
+ })
305
+ })
306
+ ] })
307
+ ]
308
+ })
309
+ }),
310
+ h && /* @__PURE__ */ u("div", {
311
+ className: n.footer,
312
+ children: [
313
+ h.pageSizeOptions && /* @__PURE__ */ u("label", {
314
+ className: n.pageSize,
315
+ children: [/* @__PURE__ */ l("span", { children: "Rows per page" }), /* @__PURE__ */ l("select", {
316
+ value: M.value,
317
+ onChange: (e) => {
318
+ M.value = Number(e.target.value), j.value = 1;
319
+ },
320
+ children: h.pageSizeOptions.map((e) => /* @__PURE__ */ l("option", {
321
+ value: e,
322
+ children: e
323
+ }, e))
324
+ })]
325
+ }),
326
+ /* @__PURE__ */ u("span", {
327
+ className: n.range,
328
+ children: [
329
+ $,
330
+ "–",
331
+ je,
332
+ " of ",
333
+ Q
334
+ ]
335
+ }),
336
+ /* @__PURE__ */ u("div", {
337
+ className: n.pageButtons,
338
+ children: [/* @__PURE__ */ l("button", {
339
+ type: "button",
340
+ className: n.pageButton,
341
+ "aria-label": T.previousPage,
342
+ disabled: B.value <= 1,
343
+ onClick: () => {
344
+ j.value = B.value - 1;
345
+ },
346
+ children: /* @__PURE__ */ l("span", {
347
+ "aria-hidden": "true",
348
+ children: "‹"
349
+ })
350
+ }), /* @__PURE__ */ l("button", {
351
+ type: "button",
352
+ className: n.pageButton,
353
+ "aria-label": T.nextPage,
354
+ disabled: B.value >= z.value,
355
+ onClick: () => {
356
+ j.value = B.value + 1;
357
+ },
358
+ children: /* @__PURE__ */ l("span", {
359
+ "aria-hidden": "true",
360
+ children: "›"
361
+ })
362
+ })]
363
+ })
364
+ ]
365
+ })
366
+ ]
367
+ });
368
+ }
369
+ //#endregion
370
+ export { f as DataTable };
@@ -0,0 +1,35 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ root: "_root_jwjfs_2",
5
+ toolbar: "_toolbar_jwjfs_26",
6
+ heading: "_heading_jwjfs_35",
7
+ title: "_title_jwjfs_41",
8
+ description: "_description_jwjfs_47",
9
+ search: "_search_jwjfs_52",
10
+ batchBar: "_batchBar_jwjfs_79",
11
+ batchCount: "_batchCount_jwjfs_89",
12
+ batchActions: "_batchActions_jwjfs_95",
13
+ scroller: "_scroller_jwjfs_101",
14
+ scrollerVirtualized: "_scrollerVirtualized_jwjfs_106",
15
+ table: "_table_jwjfs_112",
16
+ row: "_row_jwjfs_172",
17
+ controlCol: "_controlCol_jwjfs_178",
18
+ controlCell: "_controlCell_jwjfs_182",
19
+ sortButton: "_sortButton_jwjfs_188",
20
+ emptyCell: "_emptyCell_jwjfs_236",
21
+ expansionRow: "_expansionRow_jwjfs_243",
22
+ expansionGrid: "_expansionGrid_jwjfs_249",
23
+ expansionInner: "_expansionInner_jwjfs_253",
24
+ expandButton: "_expandButton_jwjfs_258",
25
+ chevron: "_chevron_jwjfs_281",
26
+ shimmer: "_shimmer_jwjfs_296",
27
+ footer: "_footer_jwjfs_323",
28
+ pageSize: "_pageSize_jwjfs_333",
29
+ range: "_range_jwjfs_359",
30
+ pageButtons: "_pageButtons_jwjfs_364",
31
+ pageButton: "_pageButton_jwjfs_364",
32
+ srOnly: "_srOnly_jwjfs_405"
33
+ };
34
+ //#endregion
35
+ export { e as default };