@cascivo/react 0.3.3 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/README.md +12 -9
  2. package/dist/accordion/accordion.css +1 -0
  3. package/dist/accordion/accordion.js +95 -0
  4. package/dist/accordion/accordion.module.js +14 -0
  5. package/dist/action-sheet/action-sheet.css +1 -0
  6. package/dist/action-sheet/action-sheet.js +91 -0
  7. package/dist/action-sheet/action-sheet.module.js +15 -0
  8. package/dist/alert/alert.css +1 -0
  9. package/dist/alert/alert.js +55 -0
  10. package/dist/alert/alert.module.js +14 -0
  11. package/dist/alert-dialog/alert-dialog.css +1 -0
  12. package/dist/alert-dialog/alert-dialog.js +68 -0
  13. package/dist/alert-dialog/alert-dialog.module.js +14 -0
  14. package/dist/app-shell/app-shell.css +1 -0
  15. package/dist/app-shell/app-shell.js +80 -0
  16. package/dist/app-shell/app-shell.module.js +15 -0
  17. package/dist/aspect-ratio/aspect-ratio.css +1 -0
  18. package/dist/aspect-ratio/aspect-ratio.js +22 -0
  19. package/dist/aspect-ratio/aspect-ratio.module.js +9 -0
  20. package/dist/avatar/avatar.css +1 -0
  21. package/dist/avatar/avatar.js +45 -0
  22. package/dist/avatar/avatar.module.js +11 -0
  23. package/dist/avatar-group/avatar-group.css +1 -0
  24. package/dist/avatar-group/avatar-group.js +26 -0
  25. package/dist/avatar-group/avatar-group.module.js +9 -0
  26. package/dist/badge/badge.css +1 -0
  27. package/dist/badge/badge.js +17 -0
  28. package/dist/badge/badge.module.js +6 -0
  29. package/dist/blockquote/blockquote.css +1 -0
  30. package/dist/blockquote/blockquote.js +18 -0
  31. package/dist/blockquote/blockquote.module.js +9 -0
  32. package/dist/bottom-sheet/bottom-sheet.css +1 -0
  33. package/dist/bottom-sheet/bottom-sheet.js +111 -0
  34. package/dist/bottom-sheet/bottom-sheet.module.js +17 -0
  35. package/dist/breadcrumb/breadcrumb.css +1 -0
  36. package/dist/breadcrumb/breadcrumb.js +28 -0
  37. package/dist/breadcrumb/breadcrumb.module.js +6 -0
  38. package/dist/button/button.css +1 -0
  39. package/dist/button/button.js +31 -0
  40. package/dist/button/button.module.js +6 -0
  41. package/dist/button-group/button-group.css +1 -0
  42. package/dist/button-group/button-group.js +39 -0
  43. package/dist/button-group/button-group.module.js +6 -0
  44. package/dist/calendar/calendar.css +1 -0
  45. package/dist/calendar/calendar.js +195 -0
  46. package/dist/calendar/calendar.module.js +17 -0
  47. package/dist/card/card.css +1 -0
  48. package/dist/card/card.js +45 -0
  49. package/dist/card/card.module.js +12 -0
  50. package/dist/carousel/carousel.css +1 -0
  51. package/dist/carousel/carousel.js +138 -0
  52. package/dist/carousel/carousel.module.js +16 -0
  53. package/dist/chat-bubble/chat-bubble.css +1 -0
  54. package/dist/chat-bubble/chat-bubble.js +33 -0
  55. package/dist/chat-bubble/chat-bubble.module.js +14 -0
  56. package/dist/checkbox/checkbox.css +1 -0
  57. package/dist/checkbox/checkbox.js +38 -0
  58. package/dist/checkbox/checkbox.module.js +11 -0
  59. package/dist/checkbox-card/checkbox-card.css +1 -0
  60. package/dist/checkbox-card/checkbox-card.js +48 -0
  61. package/dist/checkbox-card/checkbox-card.module.js +14 -0
  62. package/dist/code/code.css +1 -0
  63. package/dist/code/code.js +16 -0
  64. package/dist/code/code.module.js +6 -0
  65. package/dist/code-snippet/code-snippet.css +1 -0
  66. package/dist/code-snippet/code-snippet.js +116 -0
  67. package/dist/code-snippet/code-snippet.module.js +20 -0
  68. package/dist/code-snippet/highlight.js +69 -0
  69. package/dist/collapsible/collapsible.css +1 -0
  70. package/dist/collapsible/collapsible.js +42 -0
  71. package/dist/collapsible/collapsible.module.js +11 -0
  72. package/dist/color-picker/color-picker.css +1 -0
  73. package/dist/color-picker/color-picker.js +268 -0
  74. package/dist/color-picker/color-picker.module.js +21 -0
  75. package/dist/combobox/combobox.css +1 -0
  76. package/dist/combobox/combobox.js +164 -0
  77. package/dist/combobox/combobox.module.js +22 -0
  78. package/dist/command-menu/command-menu.css +1 -0
  79. package/dist/command-menu/command-menu.js +263 -0
  80. package/dist/command-menu/command-menu.module.js +22 -0
  81. package/dist/comparison/comparison.css +1 -0
  82. package/dist/comparison/comparison.js +69 -0
  83. package/dist/comparison/comparison.module.js +12 -0
  84. package/dist/contained-list/contained-list.css +1 -0
  85. package/dist/contained-list/contained-list.js +41 -0
  86. package/dist/contained-list/contained-list.module.js +14 -0
  87. package/dist/context-menu/context-menu.css +1 -0
  88. package/dist/context-menu/context-menu.js +60 -0
  89. package/dist/context-menu/context-menu.module.js +10 -0
  90. package/dist/copy-button/copy-button.css +1 -0
  91. package/dist/copy-button/copy-button.js +58 -0
  92. package/dist/copy-button/copy-button.module.js +9 -0
  93. package/dist/data-list/data-list.css +1 -0
  94. package/dist/data-list/data-list.js +27 -0
  95. package/dist/data-list/data-list.module.js +11 -0
  96. package/dist/data-table/data-table.css +1 -0
  97. package/dist/data-table/data-table.js +368 -0
  98. package/dist/data-table/data-table.module.js +36 -0
  99. package/dist/date-picker/date-picker.css +1 -0
  100. package/dist/date-picker/date-picker.js +218 -0
  101. package/dist/date-picker/date-picker.module.js +26 -0
  102. package/dist/date-range-picker/date-range-picker.css +1 -0
  103. package/dist/date-range-picker/date-range-picker.js +195 -0
  104. package/dist/date-range-picker/date-range-picker.module.js +21 -0
  105. package/dist/dock/dock.css +1 -0
  106. package/dist/dock/dock.js +32 -0
  107. package/dist/dock/dock.module.js +11 -0
  108. package/dist/drawer/drawer.css +1 -0
  109. package/dist/drawer/drawer.js +95 -0
  110. package/dist/drawer/drawer.module.js +16 -0
  111. package/dist/dropdown/dropdown.css +1 -0
  112. package/dist/dropdown/dropdown.js +109 -0
  113. package/dist/dropdown/dropdown.module.js +12 -0
  114. package/dist/editable/editable.css +1 -0
  115. package/dist/editable/editable.js +67 -0
  116. package/dist/editable/editable.module.js +14 -0
  117. package/dist/empty-state/empty-state.css +1 -0
  118. package/dist/empty-state/empty-state.js +34 -0
  119. package/dist/empty-state/empty-state.module.js +12 -0
  120. package/dist/fab/fab.css +1 -0
  121. package/dist/fab/fab.js +93 -0
  122. package/dist/fab/fab.module.js +15 -0
  123. package/dist/field/field.css +1 -0
  124. package/dist/field/field.js +39 -0
  125. package/dist/field/field.module.js +10 -0
  126. package/dist/file-uploader/file-uploader.css +1 -0
  127. package/dist/file-uploader/file-uploader.js +122 -0
  128. package/dist/file-uploader/file-uploader.module.js +21 -0
  129. package/dist/filter/filter.css +1 -0
  130. package/dist/filter/filter.js +34 -0
  131. package/dist/filter/filter.module.js +9 -0
  132. package/dist/form/form.css +1 -0
  133. package/dist/form/form.js +88 -0
  134. package/dist/form/form.module.js +6 -0
  135. package/dist/header/header.css +1 -0
  136. package/dist/header/header.js +44 -0
  137. package/dist/header/header.module.js +14 -0
  138. package/dist/header-panel/header-panel.css +1 -0
  139. package/dist/header-panel/header-panel.js +74 -0
  140. package/dist/header-panel/header-panel.module.js +12 -0
  141. package/dist/heading/heading.css +1 -0
  142. package/dist/heading/heading.js +24 -0
  143. package/dist/heading/heading.module.js +6 -0
  144. package/dist/hover-card/hover-card.css +1 -0
  145. package/dist/hover-card/hover-card.js +84 -0
  146. package/dist/hover-card/hover-card.module.js +9 -0
  147. package/dist/icon-button/icon-button.css +1 -0
  148. package/dist/icon-button/icon-button.js +21 -0
  149. package/dist/icon-button/icon-button.module.js +6 -0
  150. package/dist/image/image.css +1 -0
  151. package/dist/image/image.js +64 -0
  152. package/dist/image/image.module.js +12 -0
  153. package/dist/indicator/indicator.css +1 -0
  154. package/dist/indicator/indicator.js +18 -0
  155. package/dist/indicator/indicator.module.js +9 -0
  156. package/dist/inline-loading/inline-loading.css +1 -0
  157. package/dist/inline-loading/inline-loading.js +76 -0
  158. package/dist/inline-loading/inline-loading.module.js +12 -0
  159. package/dist/input/input.css +1 -0
  160. package/dist/input/input.js +54 -0
  161. package/dist/input/input.module.js +12 -0
  162. package/dist/input-group/input-group.css +1 -0
  163. package/dist/input-group/input-group.js +41 -0
  164. package/dist/input-group/input-group.module.js +12 -0
  165. package/dist/item/item.css +1 -0
  166. package/dist/item/item.js +52 -0
  167. package/dist/item/item.module.js +13 -0
  168. package/dist/join/join.css +1 -0
  169. package/dist/join/join.js +14 -0
  170. package/dist/join/join.module.js +6 -0
  171. package/dist/kbd/kbd.css +1 -0
  172. package/dist/kbd/kbd.js +16 -0
  173. package/dist/kbd/kbd.module.js +6 -0
  174. package/dist/label/label.css +1 -0
  175. package/dist/label/label.js +25 -0
  176. package/dist/label/label.module.js +10 -0
  177. package/dist/link/link.css +1 -0
  178. package/dist/link/link.js +22 -0
  179. package/dist/link/link.module.js +6 -0
  180. package/dist/list/list.css +1 -0
  181. package/dist/list/list.js +23 -0
  182. package/dist/list/list.module.js +9 -0
  183. package/dist/menu/menu.css +1 -0
  184. package/dist/menu/menu.js +96 -0
  185. package/dist/menu/menu.module.js +11 -0
  186. package/dist/menu-button/menu-button.css +1 -0
  187. package/dist/menu-button/menu-button.js +92 -0
  188. package/dist/menu-button/menu-button.module.js +11 -0
  189. package/dist/menubar/menubar.css +1 -0
  190. package/dist/menubar/menubar.js +103 -0
  191. package/dist/menubar/menubar.module.js +11 -0
  192. package/dist/modal/modal.css +1 -0
  193. package/dist/modal/modal.js +73 -0
  194. package/dist/modal/modal.module.js +14 -0
  195. package/dist/multi-select/multi-select.css +1 -0
  196. package/dist/multi-select/multi-select.js +105 -0
  197. package/dist/multi-select/multi-select.module.js +18 -0
  198. package/dist/native-select/native-select.css +1 -0
  199. package/dist/native-select/native-select.js +37 -0
  200. package/dist/native-select/native-select.module.js +10 -0
  201. package/dist/navigation-menu/navigation-menu.css +1 -0
  202. package/dist/navigation-menu/navigation-menu.js +95 -0
  203. package/dist/navigation-menu/navigation-menu.module.js +13 -0
  204. package/dist/notification/notification.css +1 -0
  205. package/dist/notification/notification.js +134 -0
  206. package/dist/notification/notification.module.js +14 -0
  207. package/dist/number-input/number-input.css +1 -0
  208. package/dist/number-input/number-input.js +145 -0
  209. package/dist/number-input/number-input.module.js +15 -0
  210. package/dist/otp-input/otp-input.css +1 -0
  211. package/dist/otp-input/otp-input.js +70 -0
  212. package/dist/otp-input/otp-input.module.js +9 -0
  213. package/dist/overflow-menu/overflow-menu.css +1 -0
  214. package/dist/overflow-menu/overflow-menu.js +65 -0
  215. package/dist/overflow-menu/overflow-menu.module.js +10 -0
  216. package/dist/pagination/pagination.css +1 -0
  217. package/dist/pagination/pagination.js +92 -0
  218. package/dist/pagination/pagination.module.js +14 -0
  219. package/dist/password-input/password-input.css +1 -0
  220. package/dist/password-input/password-input.js +76 -0
  221. package/dist/password-input/password-input.module.js +14 -0
  222. package/dist/popover/popover.css +1 -0
  223. package/dist/popover/popover.js +49 -0
  224. package/dist/popover/popover.module.js +9 -0
  225. package/dist/popover/use-popover.js +57 -0
  226. package/dist/progress/progress.css +1 -0
  227. package/dist/progress/progress.js +17 -0
  228. package/dist/progress/progress.module.js +9 -0
  229. package/dist/progress-bar/progress-bar.css +1 -0
  230. package/dist/progress-bar/progress-bar.js +44 -0
  231. package/dist/progress-bar/progress-bar.module.js +14 -0
  232. package/dist/progress-circle/progress-circle.css +1 -0
  233. package/dist/progress-circle/progress-circle.js +48 -0
  234. package/dist/progress-circle/progress-circle.module.js +12 -0
  235. package/dist/progress-indicator/progress-indicator.css +1 -0
  236. package/dist/progress-indicator/progress-indicator.js +36 -0
  237. package/dist/progress-indicator/progress-indicator.module.js +13 -0
  238. package/dist/prose/prose.css +1 -0
  239. package/dist/prose/prose.js +15 -0
  240. package/dist/prose/prose.module.js +6 -0
  241. package/dist/pull-to-refresh/pull-to-refresh.css +1 -0
  242. package/dist/pull-to-refresh/pull-to-refresh.js +82 -0
  243. package/dist/pull-to-refresh/pull-to-refresh.module.js +12 -0
  244. package/dist/qr-code/encode.js +585 -0
  245. package/dist/qr-code/qr-code.css +1 -0
  246. package/dist/qr-code/qr-code.js +41 -0
  247. package/dist/qr-code/qr-code.module.js +9 -0
  248. package/dist/radial-progress/radial-progress.css +1 -0
  249. package/dist/radial-progress/radial-progress.js +25 -0
  250. package/dist/radial-progress/radial-progress.module.js +9 -0
  251. package/dist/radio/radio.css +1 -0
  252. package/dist/radio/radio.js +49 -0
  253. package/dist/radio/radio.module.js +12 -0
  254. package/dist/radio-card/radio-card.css +1 -0
  255. package/dist/radio-card/radio-card.js +63 -0
  256. package/dist/radio-card/radio-card.module.js +14 -0
  257. package/dist/rating-group/rating-group.css +1 -0
  258. package/dist/rating-group/rating-group.js +37 -0
  259. package/dist/rating-group/rating-group.module.js +9 -0
  260. package/dist/react/src/index.js +130 -0
  261. package/dist/relative-time/relative-time.css +1 -0
  262. package/dist/relative-time/relative-time.js +65 -0
  263. package/dist/relative-time/relative-time.module.js +6 -0
  264. package/dist/resizable/resizable.css +1 -0
  265. package/dist/resizable/resizable.js +80 -0
  266. package/dist/resizable/resizable.module.js +11 -0
  267. package/dist/scroll-area/scroll-area.css +1 -0
  268. package/dist/scroll-area/scroll-area.js +38 -0
  269. package/dist/scroll-area/scroll-area.module.js +6 -0
  270. package/dist/search/search.css +1 -0
  271. package/dist/search/search.js +94 -0
  272. package/dist/search/search.module.js +12 -0
  273. package/dist/segmented-control/segmented-control.css +1 -0
  274. package/dist/segmented-control/segmented-control.js +43 -0
  275. package/dist/segmented-control/segmented-control.module.js +9 -0
  276. package/dist/select/select.css +1 -0
  277. package/dist/select/select.js +71 -0
  278. package/dist/select/select.module.js +14 -0
  279. package/dist/separator/separator.css +1 -0
  280. package/dist/separator/separator.js +21 -0
  281. package/dist/separator/separator.module.js +6 -0
  282. package/dist/sheet/sheet.css +1 -0
  283. package/dist/sheet/sheet.js +50 -0
  284. package/dist/sheet/sheet.module.js +12 -0
  285. package/dist/shell-header/shell-header.css +1 -0
  286. package/dist/shell-header/shell-header.js +165 -0
  287. package/dist/shell-header/shell-header.module.js +26 -0
  288. package/dist/side-nav/side-nav.css +1 -0
  289. package/dist/side-nav/side-nav.js +326 -0
  290. package/dist/side-nav/side-nav.module.js +34 -0
  291. package/dist/skeleton/skeleton.css +1 -0
  292. package/dist/skeleton/skeleton.js +25 -0
  293. package/dist/skeleton/skeleton.module.js +10 -0
  294. package/dist/skip-nav/skip-nav.css +1 -0
  295. package/dist/skip-nav/skip-nav.js +27 -0
  296. package/dist/skip-nav/skip-nav.module.js +6 -0
  297. package/dist/slider/slider.css +1 -0
  298. package/dist/slider/slider.js +29 -0
  299. package/dist/slider/slider.module.js +10 -0
  300. package/dist/spinner/spinner.css +1 -0
  301. package/dist/spinner/spinner.js +18 -0
  302. package/dist/spinner/spinner.module.js +9 -0
  303. package/dist/stack/stack.css +1 -0
  304. package/dist/stack/stack.js +19 -0
  305. package/dist/stack/stack.module.js +9 -0
  306. package/dist/stat/stat.css +1 -0
  307. package/dist/stat/stat.js +37 -0
  308. package/dist/stat/stat.module.js +13 -0
  309. package/dist/status/status.css +1 -0
  310. package/dist/status/status.js +20 -0
  311. package/dist/status/status.module.js +10 -0
  312. package/dist/steps/steps.css +1 -0
  313. package/dist/steps/steps.js +32 -0
  314. package/dist/steps/steps.module.js +11 -0
  315. package/dist/structured-list/structured-list.css +1 -0
  316. package/dist/structured-list/structured-list.js +101 -0
  317. package/dist/structured-list/structured-list.module.js +15 -0
  318. package/dist/styles.css +248 -0
  319. package/dist/swap/swap.css +1 -0
  320. package/dist/swap/swap.js +36 -0
  321. package/dist/swap/swap.module.js +10 -0
  322. package/dist/swipe-item/swipe-item.css +1 -0
  323. package/dist/swipe-item/swipe-item.js +62 -0
  324. package/dist/swipe-item/swipe-item.module.js +15 -0
  325. package/dist/switcher/switcher.css +1 -0
  326. package/dist/switcher/switcher.js +29 -0
  327. package/dist/switcher/switcher.module.js +11 -0
  328. package/dist/tabs/tabs.css +1 -0
  329. package/dist/tabs/tabs.js +95 -0
  330. package/dist/tabs/tabs.module.js +11 -0
  331. package/dist/tag/tag.css +1 -0
  332. package/dist/tag/tag.js +26 -0
  333. package/dist/tag/tag.module.js +9 -0
  334. package/dist/tags-input/tags-input.css +1 -0
  335. package/dist/tags-input/tags-input.js +63 -0
  336. package/dist/tags-input/tags-input.module.js +11 -0
  337. package/dist/text/text.css +1 -0
  338. package/dist/text/text.js +18 -0
  339. package/dist/text/text.module.js +6 -0
  340. package/dist/textarea/textarea.css +1 -0
  341. package/dist/textarea/textarea.js +56 -0
  342. package/dist/textarea/textarea.module.js +12 -0
  343. package/dist/tile/tile.css +1 -0
  344. package/dist/tile/tile.js +39 -0
  345. package/dist/tile/tile.module.js +10 -0
  346. package/dist/time-picker/time-picker.css +1 -0
  347. package/dist/time-picker/time-picker.js +62 -0
  348. package/dist/time-picker/time-picker.module.js +12 -0
  349. package/dist/timeline/timeline.css +1 -0
  350. package/dist/timeline/timeline.js +41 -0
  351. package/dist/timeline/timeline.module.js +14 -0
  352. package/dist/toast/toast.css +1 -0
  353. package/dist/toast/toast.js +85 -0
  354. package/dist/toast/toast.module.js +14 -0
  355. package/dist/toc/toc.css +1 -0
  356. package/dist/toc/toc.js +42 -0
  357. package/dist/toc/toc.module.js +6 -0
  358. package/dist/toc/use-toc-from-region.js +17 -0
  359. package/dist/toggle/toggle.css +1 -0
  360. package/dist/toggle/toggle.js +39 -0
  361. package/dist/toggle/toggle.module.js +11 -0
  362. package/dist/toggle-group/toggle-group.css +1 -0
  363. package/dist/toggle-group/toggle-group.js +55 -0
  364. package/dist/toggle-group/toggle-group.module.js +9 -0
  365. package/dist/toggletip/toggletip.css +1 -0
  366. package/dist/toggletip/toggletip.js +49 -0
  367. package/dist/toggletip/toggletip.module.js +10 -0
  368. package/dist/tooltip/tooltip.css +1 -0
  369. package/dist/tooltip/tooltip.js +58 -0
  370. package/dist/tooltip/tooltip.module.js +9 -0
  371. package/dist/tree-view/tree-view.css +1 -0
  372. package/dist/tree-view/tree-view.js +201 -0
  373. package/dist/tree-view/tree-view.module.js +16 -0
  374. package/dist/user/user.css +1 -0
  375. package/dist/user/user.js +33 -0
  376. package/dist/user/user.module.js +12 -0
  377. package/dist/visually-hidden/visually-hidden.css +1 -0
  378. package/dist/visually-hidden/visually-hidden.js +15 -0
  379. package/dist/visually-hidden/visually-hidden.module.js +6 -0
  380. package/package.json +6 -6
  381. package/readme.body.md +12 -9
  382. package/dist/cascivo.css +0 -2
  383. package/dist/index.js +0 -9174
@@ -0,0 +1,368 @@
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
+ }, E = o(se);
28
+ E.value = se;
29
+ let D = o(f);
30
+ D.value = f;
31
+ let O = o(p ?? le);
32
+ p !== void 0 && (O.value = p);
33
+ let k = o(g?.selected ?? []);
34
+ g?.selected !== void 0 && (k.value = g.selected);
35
+ let A = o(""), j = o(1), M = o(h?.pageSize ?? 0), N = o(/* @__PURE__ */ new Set()), P = ie(null), F = o(0);
36
+ ee(() => {
37
+ if (!C) return;
38
+ let e = P.current;
39
+ if (!e) return;
40
+ let t = () => {
41
+ ae(() => {
42
+ F.value = e.scrollTop;
43
+ });
44
+ };
45
+ return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
46
+ });
47
+ let I = a(() => E.value.map((e, t) => ({
48
+ row: e,
49
+ id: ce ? ce(e) : String(t)
50
+ }))), L = a(() => {
51
+ let e = A.value.trim().toLowerCase();
52
+ if (!e) return I.value;
53
+ let t = D.value;
54
+ return I.value.filter((n) => t.some((t) => String(d(n.row, t.key) ?? "").toLowerCase().includes(e)));
55
+ }), R = a(() => {
56
+ let e = O.value;
57
+ if (!e || ue === "server") return L.value;
58
+ let t = L.value.map((e, t) => [e, t]);
59
+ return t.sort((t, n) => {
60
+ let r = oe(d(t[0].row, e.key), d(n[0].row, e.key));
61
+ return e.direction === "desc" && (r = -r), r === 0 ? t[1] - n[1] : r;
62
+ }), t.map(([e]) => e);
63
+ }), z = a(() => h ? Math.max(1, Math.ceil(L.value.length / M.value)) : 1), B = a(() => Math.min(j.value, z.value)), V = a(() => {
64
+ if (!h) return R.value;
65
+ let e = (B.value - 1) * M.value;
66
+ return R.value.slice(e, e + M.value);
67
+ }), 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) => {
68
+ let t = O.value, n;
69
+ n = !t || t.key !== e ? {
70
+ key: e,
71
+ direction: "asc"
72
+ } : t.direction === "asc" ? {
73
+ key: e,
74
+ direction: "desc"
75
+ } : void 0, r(() => {
76
+ p === void 0 && (O.value = n), j.value = 1;
77
+ }), de?.(n);
78
+ }, Se = (e) => {
79
+ if (![
80
+ "ArrowUp",
81
+ "ArrowDown",
82
+ "ArrowLeft",
83
+ "ArrowRight"
84
+ ].includes(e.key)) return;
85
+ let t = e.currentTarget, n = Array.from(t.querySelectorAll("th button, td button, td input[type=\"checkbox\"]")), r = n.indexOf(document.activeElement);
86
+ if (r === -1) return;
87
+ e.preventDefault();
88
+ let i = (e) => e.closest("tr"), a;
89
+ if (e.key === "ArrowRight" || e.key === "ArrowLeft") {
90
+ let t = n[r + (e.key === "ArrowRight" ? 1 : -1)];
91
+ t && i(t) === i(n[r]) && (a = t);
92
+ } else {
93
+ let t = e.key === "ArrowDown" ? 1 : -1, o = n[r];
94
+ for (let e = r + t; e >= 0 && e < n.length; e += t) if (i(n[e]) !== i(o)) {
95
+ a = n[e];
96
+ break;
97
+ }
98
+ }
99
+ a?.focus();
100
+ }, W = (e) => {
101
+ g?.selected === void 0 && (k.value = e), g?.onChange?.(e);
102
+ }, Ce = (e) => {
103
+ let t = k.value;
104
+ g?.mode === "single" ? W(t.includes(e) ? [] : [e]) : W(t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
105
+ }, we = (e) => {
106
+ let t = new Set(N.value);
107
+ t.has(e) ? t.delete(e) : t.add(e), N.value = t;
108
+ }, 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 = () => {
109
+ let e = G.map((e) => e.id);
110
+ W(q ? K.filter((t) => !e.includes(t)) : [...new Set([...K, ...e])]);
111
+ }, 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;
112
+ return /* @__PURE__ */ u("div", {
113
+ className: i(n.root, ge),
114
+ "data-density": fe,
115
+ "data-zebra": pe || void 0,
116
+ "data-sticky-header": me || void 0,
117
+ "data-paginated": h ? !0 : void 0,
118
+ children: [
119
+ /* @__PURE__ */ l("span", {
120
+ "aria-live": "polite",
121
+ className: n.srOnly,
122
+ children: k.value.length > 0 ? T.itemsSelected(k.value.length) : ""
123
+ }),
124
+ (b !== void 0 || x !== void 0 || m) && /* @__PURE__ */ u("div", {
125
+ className: n.toolbar,
126
+ children: [(b !== void 0 || x !== void 0) && /* @__PURE__ */ u("div", {
127
+ className: n.heading,
128
+ children: [b !== void 0 && /* @__PURE__ */ l("div", {
129
+ id: ke,
130
+ className: n.title,
131
+ children: b
132
+ }), x !== void 0 && /* @__PURE__ */ l("div", {
133
+ id: Ae,
134
+ className: n.description,
135
+ children: x
136
+ })]
137
+ }), m && /* @__PURE__ */ l("input", {
138
+ type: "search",
139
+ className: n.search,
140
+ "aria-label": T.search,
141
+ placeholder: T.search,
142
+ value: A.value,
143
+ onChange: (e) => {
144
+ A.value = e.target.value, j.value = 1;
145
+ }
146
+ })]
147
+ }),
148
+ Me && /* @__PURE__ */ u("div", {
149
+ className: n.batchBar,
150
+ children: [/* @__PURE__ */ l("span", {
151
+ className: n.batchCount,
152
+ children: T.itemsSelected(K.length)
153
+ }), /* @__PURE__ */ l("div", {
154
+ className: n.batchActions,
155
+ children: _.map((t) => /* @__PURE__ */ l(e, {
156
+ size: "sm",
157
+ variant: "secondary",
158
+ onClick: () => t.onClick(K),
159
+ children: t.label
160
+ }, t.label))
161
+ })]
162
+ }),
163
+ /* @__PURE__ */ l("div", {
164
+ ref: C ? P : void 0,
165
+ className: i(n.scroller, C && n.scrollerVirtualized),
166
+ children: /* @__PURE__ */ u("table", {
167
+ className: n.table,
168
+ "aria-labelledby": b === void 0 ? void 0 : ke,
169
+ "aria-describedby": x === void 0 ? void 0 : Ae,
170
+ "aria-busy": y || void 0,
171
+ "aria-rowcount": C ? G.length : void 0,
172
+ onKeyDown: Se,
173
+ children: [
174
+ /* @__PURE__ */ u("colgroup", { children: [
175
+ v && /* @__PURE__ */ l("col", { className: n.controlCol }),
176
+ g && /* @__PURE__ */ l("col", { className: n.controlCol }),
177
+ f.map((e) => /* @__PURE__ */ l("col", { style: e.width === void 0 ? void 0 : { width: e.width } }, e.key))
178
+ ] }),
179
+ /* @__PURE__ */ l("thead", { children: /* @__PURE__ */ u("tr", { children: [
180
+ v && /* @__PURE__ */ l("th", {
181
+ scope: "col",
182
+ className: n.controlCell,
183
+ children: /* @__PURE__ */ l("span", {
184
+ className: n.srOnly,
185
+ children: T.expandRow
186
+ })
187
+ }),
188
+ g && /* @__PURE__ */ l("th", {
189
+ scope: "col",
190
+ className: n.controlCell,
191
+ children: g.mode === "multi" ? /* @__PURE__ */ l(t, {
192
+ "aria-label": T.selectAll,
193
+ checked: q,
194
+ indeterminate: Ee && !q,
195
+ onChange: De
196
+ }) : /* @__PURE__ */ l("span", {
197
+ className: n.srOnly,
198
+ children: T.selectRow
199
+ })
200
+ }),
201
+ f.map((e) => {
202
+ let t = O.value?.key === e.key ? O.value.direction : void 0, r = t === "asc" ? "ascending" : t === "desc" ? "descending" : "none";
203
+ return /* @__PURE__ */ l("th", {
204
+ scope: "col",
205
+ "data-align": e.align ?? "start",
206
+ "aria-sort": e.sortable ? r : void 0,
207
+ children: e.sortable ? /* @__PURE__ */ l("button", {
208
+ type: "button",
209
+ className: n.sortButton,
210
+ "data-state": r,
211
+ onClick: () => xe(e.key),
212
+ children: e.header
213
+ }) : e.header
214
+ }, e.key);
215
+ })
216
+ ] }) }),
217
+ /* @__PURE__ */ u("tbody", { children: [
218
+ y && Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ l("tr", {
219
+ className: n.row,
220
+ children: Array.from({ length: Z }, (e, t) => /* @__PURE__ */ l("td", { children: /* @__PURE__ */ l("span", {
221
+ className: n.shimmer,
222
+ "aria-hidden": "true"
223
+ }) }, t))
224
+ }, t)),
225
+ !y && G.length === 0 && /* @__PURE__ */ l("tr", {
226
+ "data-empty-row": !0,
227
+ children: /* @__PURE__ */ l("td", {
228
+ colSpan: Z,
229
+ className: n.emptyCell,
230
+ children: he ?? T.empty
231
+ })
232
+ }),
233
+ !y && C && Y > 0 && /* @__PURE__ */ l("tr", {
234
+ "aria-hidden": "true",
235
+ style: { height: Y * w }
236
+ }),
237
+ !y && J.map((e, r) => {
238
+ let i = C ? Y + r : r, a = K.includes(e.id), o = Te.has(e.id);
239
+ return /* @__PURE__ */ u(ne, { children: [/* @__PURE__ */ u("tr", {
240
+ className: n.row,
241
+ "data-parity": i % 2 == 0 ? "even" : "odd",
242
+ "data-state": a ? "selected" : void 0,
243
+ "aria-rowindex": C ? Y + r + 1 : void 0,
244
+ children: [
245
+ v && /* @__PURE__ */ l("td", {
246
+ className: n.controlCell,
247
+ children: /* @__PURE__ */ l("button", {
248
+ type: "button",
249
+ className: n.expandButton,
250
+ "aria-expanded": o,
251
+ "aria-label": T.expandRow,
252
+ "data-state": o ? "open" : "closed",
253
+ onClick: () => we(e.id),
254
+ children: /* @__PURE__ */ l("span", {
255
+ className: n.chevron,
256
+ "aria-hidden": "true"
257
+ })
258
+ })
259
+ }),
260
+ g && /* @__PURE__ */ l("td", {
261
+ className: n.controlCell,
262
+ children: /* @__PURE__ */ l(t, {
263
+ "aria-label": T.selectRow,
264
+ checked: a,
265
+ onChange: () => Ce(e.id)
266
+ })
267
+ }),
268
+ f.map((t) => /* @__PURE__ */ l("td", {
269
+ "data-align": t.align ?? "start",
270
+ children: t.render ? t.render(e.row) : String(d(e.row, t.key) ?? "")
271
+ }, t.key))
272
+ ]
273
+ }), v && /* @__PURE__ */ l("tr", {
274
+ className: n.expansionRow,
275
+ "data-state": o ? "open" : "closed",
276
+ children: /* @__PURE__ */ l("td", {
277
+ colSpan: Z,
278
+ children: /* @__PURE__ */ l("div", {
279
+ className: n.expansionGrid,
280
+ "data-state": o ? "open" : "closed",
281
+ children: /* @__PURE__ */ l("div", {
282
+ className: n.expansionInner,
283
+ children: v(e.row)
284
+ })
285
+ })
286
+ })
287
+ })] }, e.id);
288
+ }),
289
+ !y && C && X < G.length && /* @__PURE__ */ l("tr", {
290
+ "aria-hidden": "true",
291
+ style: { height: (G.length - X) * w }
292
+ }),
293
+ Oe > 0 && /* @__PURE__ */ l("tr", {
294
+ "aria-hidden": "true",
295
+ "data-filler-row": !0,
296
+ children: /* @__PURE__ */ l("td", {
297
+ colSpan: Z,
298
+ style: {
299
+ blockSize: `calc(var(--_row-height) * ${Oe})`,
300
+ padding: 0
301
+ }
302
+ })
303
+ })
304
+ ] })
305
+ ]
306
+ })
307
+ }),
308
+ h && /* @__PURE__ */ u("div", {
309
+ className: n.footer,
310
+ children: [
311
+ h.pageSizeOptions && /* @__PURE__ */ u("label", {
312
+ className: n.pageSize,
313
+ children: [/* @__PURE__ */ l("span", { children: "Rows per page" }), /* @__PURE__ */ l("select", {
314
+ value: M.value,
315
+ onChange: (e) => {
316
+ M.value = Number(e.target.value), j.value = 1;
317
+ },
318
+ children: h.pageSizeOptions.map((e) => /* @__PURE__ */ l("option", {
319
+ value: e,
320
+ children: e
321
+ }, e))
322
+ })]
323
+ }),
324
+ /* @__PURE__ */ u("span", {
325
+ className: n.range,
326
+ children: [
327
+ $,
328
+ "–",
329
+ je,
330
+ " of ",
331
+ Q
332
+ ]
333
+ }),
334
+ /* @__PURE__ */ u("div", {
335
+ className: n.pageButtons,
336
+ children: [/* @__PURE__ */ l("button", {
337
+ type: "button",
338
+ className: n.pageButton,
339
+ "aria-label": "Previous page",
340
+ disabled: B.value <= 1,
341
+ onClick: () => {
342
+ j.value = B.value - 1;
343
+ },
344
+ children: /* @__PURE__ */ l("span", {
345
+ "aria-hidden": "true",
346
+ children: "‹"
347
+ })
348
+ }), /* @__PURE__ */ l("button", {
349
+ type: "button",
350
+ className: n.pageButton,
351
+ "aria-label": "Next page",
352
+ disabled: B.value >= z.value,
353
+ onClick: () => {
354
+ j.value = B.value + 1;
355
+ },
356
+ children: /* @__PURE__ */ l("span", {
357
+ "aria-hidden": "true",
358
+ children: "›"
359
+ })
360
+ })]
361
+ })
362
+ ]
363
+ })
364
+ ]
365
+ });
366
+ }
367
+ //#endregion
368
+ export { f as DataTable };
@@ -0,0 +1,36 @@
1
+ "use client";
2
+
3
+ import './data-table.css';
4
+ var e = {
5
+ root: "_root_55t77_2",
6
+ toolbar: "_toolbar_55t77_26",
7
+ heading: "_heading_55t77_35",
8
+ title: "_title_55t77_41",
9
+ description: "_description_55t77_47",
10
+ search: "_search_55t77_52",
11
+ batchBar: "_batchBar_55t77_79",
12
+ batchCount: "_batchCount_55t77_89",
13
+ batchActions: "_batchActions_55t77_95",
14
+ scroller: "_scroller_55t77_101",
15
+ scrollerVirtualized: "_scrollerVirtualized_55t77_106",
16
+ table: "_table_55t77_112",
17
+ row: "_row_55t77_168",
18
+ controlCol: "_controlCol_55t77_174",
19
+ controlCell: "_controlCell_55t77_178",
20
+ sortButton: "_sortButton_55t77_184",
21
+ emptyCell: "_emptyCell_55t77_232",
22
+ expansionRow: "_expansionRow_55t77_239",
23
+ expansionGrid: "_expansionGrid_55t77_245",
24
+ expansionInner: "_expansionInner_55t77_249",
25
+ expandButton: "_expandButton_55t77_254",
26
+ chevron: "_chevron_55t77_277",
27
+ shimmer: "_shimmer_55t77_292",
28
+ footer: "_footer_55t77_319",
29
+ pageSize: "_pageSize_55t77_329",
30
+ range: "_range_55t77_355",
31
+ pageButtons: "_pageButtons_55t77_360",
32
+ pageButton: "_pageButton_55t77_360",
33
+ srOnly: "_srOnly_55t77_399"
34
+ };
35
+ //#endregion
36
+ export { e as default };
@@ -0,0 +1 @@
1
+ @layer cascivo.component{._wrapper_1gnc3_2{gap:var(--cascivo-space-1);font-family:var(--cascivo-font-sans);flex-direction:column;display:inline-flex;position:relative}._wrapper_1gnc3_2[data-size=sm]{--_height:2rem;--_font:var(--cascivo-text-sm);--_px:var(--cascivo-space-3)}._wrapper_1gnc3_2[data-size=md]{--_height:2.5rem;--_font:var(--cascivo-text-sm);--_px:var(--cascivo-space-4)}._wrapper_1gnc3_2[data-size=lg]{--_height:3rem;--_font:var(--cascivo-text-base);--_px:var(--cascivo-space-4)}._label_1gnc3_27{font-size:var(--cascivo-text-sm);font-weight:var(--cascivo-font-medium);color:var(--cascivo-color-text);line-height:var(--cascivo-leading-snug)}._field_1gnc3_34{align-items:center;display:flex;position:relative}._trigger_1gnc3_40{justify-content:space-between;align-items:center;gap:var(--cascivo-space-2);block-size:var(--_height,2.5rem);min-inline-size:12rem;padding-inline:var(--_px,var(--cascivo-space-4));font-family:var(--cascivo-font-sans);font-size:var(--_font,var(--cascivo-text-sm));color:var(--cascivo-color-text);background-color:var(--cascivo-color-surface);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-field);cursor:pointer;text-align:start;transition:border-color var(--cascivo-duration-150) var(--cascivo-ease-out), box-shadow var(--cascivo-duration-150) var(--cascivo-ease-out);outline:none;display:flex}._trigger_1gnc3_40:hover:not(:disabled){border-color:var(--cascivo-color-border-strong)}._trigger_1gnc3_40:focus-visible{border-color:var(--cascivo-color-accent);box-shadow:0 0 0 3px color-mix(in srgb, var(--cascivo-color-accent) 20%, transparent)}._trigger_1gnc3_40:disabled{opacity:.5;cursor:not-allowed}._wrapper_1gnc3_2[data-state=error] ._trigger_1gnc3_40{border-color:var(--cascivo-color-danger)}._value_1gnc3_78{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}._placeholder_1gnc3_84{color:var(--cascivo-color-text-subtle)}._icon_1gnc3_87{color:var(--cascivo-color-text-muted);font-style:normal}._clear_1gnc3_92{cursor:pointer;color:var(--cascivo-color-text-muted);font-size:var(--cascivo-text-xs);padding:var(--cascivo-space-1);border-radius:var(--cascivo-radius-control);background:0 0;border:none;outline:none;position:absolute;inset-inline-end:var(--cascivo-space-8)}._clear_1gnc3_92:hover{color:var(--cascivo-color-text)}._clear_1gnc3_92:focus-visible{box-shadow:0 0 0 2px var(--cascivo-color-accent)}._calendar_1gnc3_112{z-index:var(--cascivo-z-dropdown);padding:var(--cascivo-space-3);background-color:var(--cascivo-color-surface-overlay);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-overlay);box-shadow:var(--cascivo-shadow-overlay);opacity:0;visibility:hidden;transition:opacity var(--cascivo-motion-enter), translate var(--cascivo-motion-enter), visibility var(--cascivo-motion-enter);position:absolute;inset-block-start:calc(100% + var(--cascivo-space-1));inset-inline-start:0;translate:0 -.25rem}._calendar_1gnc3_112[data-state=open]{opacity:1;visibility:visible;translate:0}@starting-style{._calendar_1gnc3_112[data-state=open]{opacity:0;translate:0 -.25rem}}._header_1gnc3_144{justify-content:space-between;align-items:center;margin-block-end:var(--cascivo-space-2);display:flex}._monthLabel_1gnc3_151{font-size:var(--cascivo-text-sm);font-weight:var(--cascivo-font-semibold);color:var(--cascivo-color-text)}._navButton_1gnc3_157{border-radius:var(--cascivo-radius-control);cursor:pointer;block-size:2rem;inline-size:2rem;color:var(--cascivo-color-text-muted);font-size:var(--cascivo-text-base);background:0 0;border:1px solid #0000;outline:none;justify-content:center;align-items:center;display:inline-flex}._navButton_1gnc3_157:hover{background-color:var(--cascivo-color-bg-subtle);color:var(--cascivo-color-text)}._navButton_1gnc3_157:focus-visible{border-color:var(--cascivo-color-accent)}._grid_1gnc3_179{border-collapse:collapse;inline-size:100%}._weekday_1gnc3_184{padding-block:var(--cascivo-space-1);font-size:var(--cascivo-text-xs);font-weight:var(--cascivo-font-medium);color:var(--cascivo-color-text-muted);text-align:center;inline-size:2.25rem}._cell_1gnc3_193{text-align:center;padding:2px}._empty_1gnc3_197{inline-size:2.25rem}._day_1gnc3_201{block-size:2.25rem;inline-size:2.25rem;font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text);border-radius:var(--cascivo-radius-control);cursor:pointer;background:0 0;border:none;outline:none;justify-content:center;align-items:center;display:flex}._day_1gnc3_201:hover:not([aria-disabled]){background-color:var(--cascivo-color-bg-subtle)}._day_1gnc3_201:focus-visible{box-shadow:0 0 0 2px var(--cascivo-color-accent)}._day_1gnc3_201[data-today]{font-weight:var(--cascivo-font-semibold);color:var(--cascivo-color-accent)}._day_1gnc3_201[data-selected]{background-color:var(--cascivo-color-accent);color:var(--cascivo-color-accent-foreground,var(--cascivo-color-text-on-accent))}._day_1gnc3_201[aria-disabled]{opacity:.35;cursor:not-allowed}._error_1gnc3_236{font-size:var(--cascivo-text-xs);color:var(--cascivo-color-danger)}._hint_1gnc3_240{font-size:var(--cascivo-text-xs);color:var(--cascivo-color-text-muted)}}
@@ -0,0 +1,218 @@
1
+ "use client";
2
+
3
+ import e from "./date-picker.module.js";
4
+ import { batch as t, cn as n, createMachine as r, useMachine as i, useSignal as a, useSignalEffect as o, useSignals as s } from "@cascivo/core";
5
+ import { builtin as c, currentLocale as l, t as u } from "@cascivo/i18n";
6
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
7
+ import { useId as p, useRef as m } from "react";
8
+ //#region ../components/src/date-picker/date-picker.tsx
9
+ var h = r({
10
+ initial: "closed",
11
+ states: {
12
+ closed: { on: { OPEN: "open" } },
13
+ open: { on: { CLOSE: "closed" } }
14
+ }
15
+ });
16
+ function ee(e) {
17
+ try {
18
+ let t = new Intl.Locale(e).weekInfo;
19
+ if (t) return t.firstDay % 7;
20
+ } catch {}
21
+ return 1;
22
+ }
23
+ function g(e, t, n) {
24
+ let r = new Date(Date.UTC(e, t, 1)), i = new Date(Date.UTC(e, t + 1, 0)), a = (r.getUTCDay() - n + 7) % 7, o = [];
25
+ for (let e = 0; e < a; e++) o.push(null);
26
+ for (let n = 1; n <= i.getUTCDate(); n++) o.push(new Date(Date.UTC(e, t, n)));
27
+ for (; o.length % 7 != 0;) o.push(null);
28
+ let s = [];
29
+ for (let e = 0; e < o.length; e += 7) s.push(o.slice(e, e + 7));
30
+ return s;
31
+ }
32
+ function _(e, t) {
33
+ return new Intl.DateTimeFormat(t).format(e);
34
+ }
35
+ function v(e) {
36
+ return e.toISOString().slice(0, 10);
37
+ }
38
+ function y(e) {
39
+ let [t, n, r] = e.split("-").map(Number);
40
+ return new Date(Date.UTC(t, n - 1, r));
41
+ }
42
+ function b({ value: r, defaultValue: b, onChange: x, min: S, max: C, clearable: w = !1, label: T, hint: E, error: D, size: O = "md", disabled: k = !1, labels: A, className: j, id: M }) {
43
+ s();
44
+ let [N, P] = i(h), F = p(), I = M ?? `cascade-date-picker-${F}`, L = `${F}-grid`, R = l(), z = A?.placeholder ?? u(c.datePicker.placeholder), te = A?.previousMonth ?? u(c.datePicker.previousMonth), ne = A?.nextMonth ?? u(c.datePicker.nextMonth), B = A?.clear ?? u(c.datePicker.clear), V = /* @__PURE__ */ new Date(), H = v(V), U = a(r ?? b);
45
+ r !== void 0 && (U.value = r);
46
+ let W = a(U.value ? y(U.value).getUTCFullYear() : V.getUTCFullYear()), G = a(U.value ? y(U.value).getUTCMonth() : V.getUTCMonth()), K = a(U.value), q = m(null);
47
+ o(() => {
48
+ if (N.value !== "open") return;
49
+ let e = (e) => {
50
+ q.current && !q.current.contains(e.target) && P("CLOSE");
51
+ };
52
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
53
+ });
54
+ let J = () => {
55
+ k || P("OPEN");
56
+ }, Y = () => P("CLOSE"), X = (e) => {
57
+ S && e < S || C && e > C || (r === void 0 && (U.value = e), x?.(e), Y());
58
+ }, re = (e) => {
59
+ e.stopPropagation(), r === void 0 && (U.value = void 0), x?.(void 0);
60
+ }, ie = () => {
61
+ G.value === 0 ? t(() => {
62
+ W.value--, G.value = 11;
63
+ }) : G.value--;
64
+ }, ae = () => {
65
+ G.value === 11 ? t(() => {
66
+ W.value++, G.value = 0;
67
+ }) : G.value++;
68
+ }, Z = ee(R), oe = g(W.value, G.value, Z), se = new Intl.DateTimeFormat(R, { weekday: "short" }), ce = Array.from({ length: 7 }, (e, t) => {
69
+ let n = new Date(Date.UTC(2024, 0, 7 + Z + t));
70
+ return se.format(n);
71
+ }), Q = new Intl.DateTimeFormat(R, {
72
+ month: "long",
73
+ year: "numeric"
74
+ }).format(new Date(Date.UTC(W.value, G.value, 1))), le = (e) => {
75
+ let n = K.value;
76
+ if (!n) return;
77
+ let r = y(n), i;
78
+ if (e.key === "ArrowRight") i = new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate() + 1));
79
+ else if (e.key === "ArrowLeft") i = new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate() - 1));
80
+ else if (e.key === "ArrowDown") i = new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate() + 7));
81
+ else if (e.key === "ArrowUp") i = new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate() - 7));
82
+ else if (e.key === "Enter" || e.key === " ") {
83
+ e.preventDefault(), X(n);
84
+ return;
85
+ } else if (e.key === "Escape") {
86
+ Y();
87
+ return;
88
+ } else return;
89
+ if (e.preventDefault(), i) {
90
+ let e = v(i);
91
+ if (S && e < S || C && e > C) return;
92
+ K.value = e, t(() => {
93
+ W.value = i.getUTCFullYear(), G.value = i.getUTCMonth();
94
+ });
95
+ }
96
+ }, $ = U.value ? _(y(U.value), R) : "";
97
+ return /* @__PURE__ */ f("div", {
98
+ ref: q,
99
+ className: n(e.wrapper, j),
100
+ "data-state": D ? "error" : N.value,
101
+ "data-size": O,
102
+ children: [
103
+ T && /* @__PURE__ */ d("label", {
104
+ className: e.label,
105
+ htmlFor: I,
106
+ children: T
107
+ }),
108
+ /* @__PURE__ */ f("div", {
109
+ className: e.field,
110
+ children: [/* @__PURE__ */ f("button", {
111
+ id: I,
112
+ type: "button",
113
+ role: "combobox",
114
+ "aria-expanded": N.value === "open",
115
+ "aria-controls": L,
116
+ "aria-haspopup": "dialog",
117
+ "aria-invalid": D ? !0 : void 0,
118
+ "aria-describedby": D ? `${F}-error` : E ? `${F}-hint` : void 0,
119
+ className: e.trigger,
120
+ disabled: k,
121
+ onClick: N.value === "open" ? Y : J,
122
+ children: [/* @__PURE__ */ d("span", {
123
+ className: n(e.value, $ ? void 0 : e.placeholder),
124
+ children: $ || z
125
+ }), /* @__PURE__ */ d("span", {
126
+ className: e.icon,
127
+ "aria-hidden": "true",
128
+ children: "📅"
129
+ })]
130
+ }), w && U.value !== void 0 && /* @__PURE__ */ d("button", {
131
+ type: "button",
132
+ className: e.clear,
133
+ "aria-label": B,
134
+ onClick: re,
135
+ children: "✕"
136
+ })]
137
+ }),
138
+ /* @__PURE__ */ f("div", {
139
+ id: L,
140
+ role: "dialog",
141
+ "aria-label": Q,
142
+ className: e.calendar,
143
+ "data-state": N.value,
144
+ onKeyDown: le,
145
+ children: [/* @__PURE__ */ f("div", {
146
+ className: e.header,
147
+ children: [
148
+ /* @__PURE__ */ d("button", {
149
+ type: "button",
150
+ className: e.navButton,
151
+ "aria-label": te,
152
+ onClick: ie,
153
+ children: "‹"
154
+ }),
155
+ /* @__PURE__ */ d("span", {
156
+ className: e.monthLabel,
157
+ "aria-live": "polite",
158
+ children: Q
159
+ }),
160
+ /* @__PURE__ */ d("button", {
161
+ type: "button",
162
+ className: e.navButton,
163
+ "aria-label": ne,
164
+ onClick: ae,
165
+ children: "›"
166
+ })
167
+ ]
168
+ }), /* @__PURE__ */ f("table", {
169
+ role: "grid",
170
+ className: e.grid,
171
+ children: [/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ d("tr", { children: ce.map((t) => /* @__PURE__ */ d("th", {
172
+ className: e.weekday,
173
+ abbr: t,
174
+ scope: "col",
175
+ children: t
176
+ }, t)) }) }), /* @__PURE__ */ d("tbody", { children: oe.map((t, n) => /* @__PURE__ */ d("tr", { children: t.map((t, n) => {
177
+ if (!t) return /* @__PURE__ */ d("td", { className: e.empty }, n);
178
+ let r = v(t), i = r === U.value, a = r === H, o = r === K.value, s = S !== void 0 && r < S || C !== void 0 && r > C;
179
+ return /* @__PURE__ */ d("td", {
180
+ className: e.cell,
181
+ children: /* @__PURE__ */ d("button", {
182
+ type: "button",
183
+ className: e.day,
184
+ tabIndex: o ? 0 : -1,
185
+ "aria-pressed": i,
186
+ "aria-label": _(t, R),
187
+ "aria-current": a ? "date" : void 0,
188
+ "aria-disabled": s || void 0,
189
+ "data-selected": i || void 0,
190
+ "data-today": a || void 0,
191
+ onClick: () => {
192
+ s || X(r);
193
+ },
194
+ onFocus: () => {
195
+ K.value = r;
196
+ },
197
+ children: t.getUTCDate()
198
+ })
199
+ }, n);
200
+ }) }, n)) })]
201
+ })]
202
+ }),
203
+ D && /* @__PURE__ */ d("span", {
204
+ id: `${F}-error`,
205
+ className: e.error,
206
+ role: "alert",
207
+ children: D
208
+ }),
209
+ !D && E && /* @__PURE__ */ d("span", {
210
+ id: `${F}-hint`,
211
+ className: e.hint,
212
+ children: E
213
+ })
214
+ ]
215
+ });
216
+ }
217
+ //#endregion
218
+ export { b as DatePicker };
@@ -0,0 +1,26 @@
1
+ "use client";
2
+
3
+ import './date-picker.css';
4
+ var e = {
5
+ wrapper: "_wrapper_1gnc3_2",
6
+ label: "_label_1gnc3_27",
7
+ field: "_field_1gnc3_34",
8
+ trigger: "_trigger_1gnc3_40",
9
+ value: "_value_1gnc3_78",
10
+ placeholder: "_placeholder_1gnc3_84",
11
+ icon: "_icon_1gnc3_87",
12
+ clear: "_clear_1gnc3_92",
13
+ calendar: "_calendar_1gnc3_112",
14
+ header: "_header_1gnc3_144",
15
+ monthLabel: "_monthLabel_1gnc3_151",
16
+ navButton: "_navButton_1gnc3_157",
17
+ grid: "_grid_1gnc3_179",
18
+ weekday: "_weekday_1gnc3_184",
19
+ cell: "_cell_1gnc3_193",
20
+ empty: "_empty_1gnc3_197",
21
+ day: "_day_1gnc3_201",
22
+ error: "_error_1gnc3_236",
23
+ hint: "_hint_1gnc3_240"
24
+ };
25
+ //#endregion
26
+ export { e as default };
@@ -0,0 +1 @@
1
+ @layer cascivo.component{._wrapper_k1szr_2{font-family:var(--cascivo-font-sans);flex-direction:column;display:inline-flex;position:relative}._wrapper_k1szr_2[data-size=sm]{--_height:2rem;--_font:var(--cascivo-text-sm);--_px:var(--cascivo-space-3)}._wrapper_k1szr_2[data-size=md]{--_height:2.5rem;--_font:var(--cascivo-text-sm);--_px:var(--cascivo-space-4)}._wrapper_k1szr_2[data-size=lg]{--_height:3rem;--_font:var(--cascivo-text-base);--_px:var(--cascivo-space-4)}._trigger_k1szr_25{justify-content:space-between;align-items:center;gap:var(--cascivo-space-2);block-size:var(--_height,2.5rem);min-inline-size:18rem;padding-inline:var(--_px,var(--cascivo-space-4));font-family:var(--cascivo-font-sans);font-size:var(--_font,var(--cascivo-text-sm));color:var(--cascivo-color-text);background-color:var(--cascivo-color-surface);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-field);cursor:pointer;text-align:start;transition:border-color var(--cascivo-duration-150) var(--cascivo-ease-out), box-shadow var(--cascivo-duration-150) var(--cascivo-ease-out);outline:none;display:flex}._trigger_k1szr_25:hover{border-color:var(--cascivo-color-border-strong)}._trigger_k1szr_25:focus-visible{border-color:var(--cascivo-color-accent);box-shadow:0 0 0 3px color-mix(in srgb, var(--cascivo-color-accent) 20%, transparent)}._value_k1szr_55{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}._placeholder_k1szr_61{color:var(--cascivo-color-text-subtle)}._icon_k1szr_64{color:var(--cascivo-color-text-muted);font-style:normal}._panel_k1szr_69{z-index:var(--cascivo-z-dropdown);gap:var(--cascivo-space-2);padding:var(--cascivo-space-3);background-color:var(--cascivo-color-surface-overlay);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-overlay);box-shadow:var(--cascivo-shadow-overlay);opacity:0;visibility:hidden;transition:opacity var(--cascivo-motion-enter), translate var(--cascivo-motion-enter), visibility var(--cascivo-motion-enter);flex-direction:column;display:flex;position:absolute;inset-block-start:calc(100% + var(--cascivo-space-1));inset-inline-start:0;translate:0 -.25rem}._panel_k1szr_69[data-state=open]{opacity:1;visibility:visible;translate:0}@starting-style{._panel_k1szr_69[data-state=open]{opacity:0;translate:0 -.25rem}}._calendars_k1szr_104{align-items:flex-start;gap:var(--cascivo-space-2);display:flex}._calNav_k1szr_110{align-items:center;padding-block-start:var(--cascivo-space-1);display:flex}._navButton_k1szr_116{border-radius:var(--cascivo-radius-control);cursor:pointer;block-size:2rem;inline-size:2rem;color:var(--cascivo-color-text-muted);font-size:var(--cascivo-text-base);background:0 0;border:1px solid #0000;outline:none;justify-content:center;align-items:center;display:inline-flex}._navButton_k1szr_116:hover{background-color:var(--cascivo-color-bg-subtle);color:var(--cascivo-color-text)}._navButton_k1szr_116:focus-visible{box-shadow:var(--cascivo-focus-ring)}._presets_k1szr_139{gap:var(--cascivo-space-1);border-block-end:1px solid var(--cascivo-color-border);flex-wrap:wrap;padding-block-end:var(--cascivo-space-2);display:flex}._preset_k1szr_139{padding-block:var(--cascivo-space-1);padding-inline:var(--cascivo-space-3);font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-control);cursor:pointer;background:0 0;outline:none}._preset_k1szr_139:hover{background-color:var(--cascivo-color-bg-subtle)}._preset_k1szr_139:focus-visible{box-shadow:var(--cascivo-focus-ring)}._footer_k1szr_166{justify-content:flex-end;align-items:center;gap:var(--cascivo-space-2);border-block-start:1px solid var(--cascivo-color-border);padding-block-start:var(--cascivo-space-2);display:flex}._clearBtn_k1szr_175,._applyBtn_k1szr_176{padding-block:var(--cascivo-space-1);padding-inline:var(--cascivo-space-4);font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-sm);font-weight:var(--cascivo-font-medium);border-radius:var(--cascivo-radius-control);cursor:pointer;outline:none}:is(._clearBtn_k1szr_175,._applyBtn_k1szr_176):focus-visible{box-shadow:var(--cascivo-focus-ring)}._clearBtn_k1szr_175{color:var(--cascivo-color-text);border:1px solid var(--cascivo-color-border);background:0 0}._clearBtn_k1szr_175:hover{background-color:var(--cascivo-color-bg-subtle)}._applyBtn_k1szr_176{color:var(--cascivo-color-primary-fg);background-color:var(--cascivo-color-primary);border:1px solid #0000}._applyBtn_k1szr_176:hover{background-color:var(--cascivo-color-primary-hover)}}