@cascivo/react 0.9.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 (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 +3 -2
  278. package/readme.body.md +5 -5
@@ -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 ee, t as l } from "@cascivo/i18n";
6
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
7
+ import { useId as f, useRef as te } from "react";
8
+ //#region ../components/src/date-picker/date-picker.tsx
9
+ var p = r({
10
+ initial: "closed",
11
+ states: {
12
+ closed: { on: { OPEN: "open" } },
13
+ open: { on: { CLOSE: "closed" } }
14
+ }
15
+ });
16
+ function ne(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 m(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 h(e, t) {
33
+ return new Intl.DateTimeFormat(t).format(e);
34
+ }
35
+ function g(e) {
36
+ return e.toISOString().slice(0, 10);
37
+ }
38
+ function _(e) {
39
+ let [t, n, r] = e.split("-").map(Number);
40
+ return new Date(Date.UTC(t, n - 1, r));
41
+ }
42
+ function v({ value: r, defaultValue: v, onValueChange: y, onChange: b, min: x, max: S, clearable: C = !1, label: w, hint: T, error: E, size: D = "md", disabled: O = !1, labels: k, className: re, id: A }) {
43
+ s();
44
+ let [j, M] = i(p), N = f(), P = A ?? `cascade-date-picker-${N}`, F = `${N}-grid`, I = ee(), ie = k?.placeholder ?? l(c.datePicker.placeholder), ae = k?.previousMonth ?? l(c.datePicker.previousMonth), L = k?.nextMonth ?? l(c.datePicker.nextMonth), R = k?.clear ?? l(c.datePicker.clear), z = /* @__PURE__ */ new Date(), B = g(z), V = a(r ?? v);
45
+ r !== void 0 && (V.value = r);
46
+ let H = a(V.value ? _(V.value).getUTCFullYear() : z.getUTCFullYear()), U = a(V.value ? _(V.value).getUTCMonth() : z.getUTCMonth()), W = a(V.value), G = te(null);
47
+ o(() => {
48
+ if (j.value !== "open") return;
49
+ let e = (e) => {
50
+ G.current && !G.current.contains(e.target) && M("CLOSE");
51
+ };
52
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
53
+ });
54
+ let K = () => {
55
+ O || M("OPEN");
56
+ }, q = () => M("CLOSE"), J = y ?? b, Y = (e) => {
57
+ x && e < x || S && e > S || (r === void 0 && (V.value = e), J?.(e), q());
58
+ }, oe = (e) => {
59
+ e.stopPropagation(), r === void 0 && (V.value = void 0), J?.(void 0);
60
+ }, se = () => {
61
+ U.value === 0 ? t(() => {
62
+ H.value--, U.value = 11;
63
+ }) : U.value--;
64
+ }, ce = () => {
65
+ U.value === 11 ? t(() => {
66
+ H.value++, U.value = 0;
67
+ }) : U.value++;
68
+ }, X = ne(I), Z = m(H.value, U.value, X), le = new Intl.DateTimeFormat(I, { weekday: "short" }), ue = Array.from({ length: 7 }, (e, t) => {
69
+ let n = new Date(Date.UTC(2024, 0, 7 + X + t));
70
+ return le.format(n);
71
+ }), Q = new Intl.DateTimeFormat(I, {
72
+ month: "long",
73
+ year: "numeric"
74
+ }).format(new Date(Date.UTC(H.value, U.value, 1))), de = (e) => {
75
+ let n = W.value;
76
+ if (!n) return;
77
+ let r = _(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(), Y(n);
84
+ return;
85
+ } else if (e.key === "Escape") {
86
+ q();
87
+ return;
88
+ } else return;
89
+ if (e.preventDefault(), i) {
90
+ let e = g(i);
91
+ if (x && e < x || S && e > S) return;
92
+ W.value = e, t(() => {
93
+ H.value = i.getUTCFullYear(), U.value = i.getUTCMonth();
94
+ });
95
+ }
96
+ }, $ = V.value ? h(_(V.value), I) : "";
97
+ return /* @__PURE__ */ d("div", {
98
+ ref: G,
99
+ className: n(e.wrapper, re),
100
+ "data-state": E ? "error" : j.value,
101
+ "data-size": D,
102
+ children: [
103
+ w && /* @__PURE__ */ u("label", {
104
+ className: e.label,
105
+ htmlFor: P,
106
+ children: w
107
+ }),
108
+ /* @__PURE__ */ d("div", {
109
+ className: e.field,
110
+ children: [/* @__PURE__ */ d("button", {
111
+ id: P,
112
+ type: "button",
113
+ role: "combobox",
114
+ "aria-expanded": j.value === "open",
115
+ "aria-controls": F,
116
+ "aria-haspopup": "dialog",
117
+ "aria-invalid": E ? !0 : void 0,
118
+ "aria-describedby": E ? `${N}-error` : T ? `${N}-hint` : void 0,
119
+ className: e.trigger,
120
+ disabled: O,
121
+ onClick: j.value === "open" ? q : K,
122
+ children: [/* @__PURE__ */ u("span", {
123
+ className: n(e.value, $ ? void 0 : e.placeholder),
124
+ children: $ || ie
125
+ }), /* @__PURE__ */ u("span", {
126
+ className: e.icon,
127
+ "aria-hidden": "true",
128
+ children: "📅"
129
+ })]
130
+ }), C && V.value !== void 0 && /* @__PURE__ */ u("button", {
131
+ type: "button",
132
+ className: e.clear,
133
+ "aria-label": R,
134
+ onClick: oe,
135
+ children: "✕"
136
+ })]
137
+ }),
138
+ /* @__PURE__ */ d("div", {
139
+ id: F,
140
+ role: "dialog",
141
+ "aria-label": Q,
142
+ className: e.calendar,
143
+ "data-state": j.value,
144
+ onKeyDown: de,
145
+ children: [/* @__PURE__ */ d("div", {
146
+ className: e.header,
147
+ children: [
148
+ /* @__PURE__ */ u("button", {
149
+ type: "button",
150
+ className: e.navButton,
151
+ "aria-label": ae,
152
+ onClick: se,
153
+ children: "‹"
154
+ }),
155
+ /* @__PURE__ */ u("span", {
156
+ className: e.monthLabel,
157
+ "aria-live": "polite",
158
+ children: Q
159
+ }),
160
+ /* @__PURE__ */ u("button", {
161
+ type: "button",
162
+ className: e.navButton,
163
+ "aria-label": L,
164
+ onClick: ce,
165
+ children: "›"
166
+ })
167
+ ]
168
+ }), /* @__PURE__ */ d("table", {
169
+ role: "grid",
170
+ className: e.grid,
171
+ children: [/* @__PURE__ */ u("thead", { children: /* @__PURE__ */ u("tr", { children: ue.map((t) => /* @__PURE__ */ u("th", {
172
+ className: e.weekday,
173
+ abbr: t,
174
+ scope: "col",
175
+ children: t
176
+ }, t)) }) }), /* @__PURE__ */ u("tbody", { children: Z.map((t, n) => /* @__PURE__ */ u("tr", { children: t.map((t, n) => {
177
+ if (!t) return /* @__PURE__ */ u("td", { className: e.empty }, n);
178
+ let r = g(t), i = r === V.value, a = r === B, o = r === W.value, s = x !== void 0 && r < x || S !== void 0 && r > S;
179
+ return /* @__PURE__ */ u("td", {
180
+ className: e.cell,
181
+ children: /* @__PURE__ */ u("button", {
182
+ type: "button",
183
+ className: e.day,
184
+ tabIndex: o ? 0 : -1,
185
+ "aria-pressed": i,
186
+ "aria-label": h(t, I),
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 || Y(r);
193
+ },
194
+ onFocus: () => {
195
+ W.value = r;
196
+ },
197
+ children: t.getUTCDate()
198
+ })
199
+ }, n);
200
+ }) }, n)) })]
201
+ })]
202
+ }),
203
+ E && /* @__PURE__ */ u("span", {
204
+ id: `${N}-error`,
205
+ className: e.error,
206
+ role: "alert",
207
+ children: E
208
+ }),
209
+ !E && T && /* @__PURE__ */ u("span", {
210
+ id: `${N}-hint`,
211
+ className: e.hint,
212
+ children: T
213
+ })
214
+ ]
215
+ });
216
+ }
217
+ //#endregion
218
+ export { v as DatePicker };
@@ -0,0 +1,25 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ wrapper: "_wrapper_6chzy_2",
5
+ label: "_label_6chzy_27",
6
+ field: "_field_6chzy_34",
7
+ trigger: "_trigger_6chzy_40",
8
+ value: "_value_6chzy_78",
9
+ placeholder: "_placeholder_6chzy_84",
10
+ icon: "_icon_6chzy_87",
11
+ clear: "_clear_6chzy_92",
12
+ calendar: "_calendar_6chzy_117",
13
+ header: "_header_6chzy_149",
14
+ monthLabel: "_monthLabel_6chzy_156",
15
+ navButton: "_navButton_6chzy_162",
16
+ grid: "_grid_6chzy_184",
17
+ weekday: "_weekday_6chzy_189",
18
+ cell: "_cell_6chzy_198",
19
+ empty: "_empty_6chzy_202",
20
+ day: "_day_6chzy_206",
21
+ error: "_error_6chzy_241",
22
+ hint: "_hint_6chzy_245"
23
+ };
24
+ //#endregion
25
+ export { e as default };
@@ -0,0 +1,196 @@
1
+ "use client";
2
+
3
+ import { Calendar as e } from "../calendar/calendar.js";
4
+ import t from "./date-range-picker.module.js";
5
+ import { batch as n, cn as r, useControllableSignal as i, useSignal as a, useSignalEffect as o, useSignals as s } from "@cascivo/core";
6
+ import { builtin as c, currentLocale as ee, t as l } from "@cascivo/i18n";
7
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
8
+ import { useRef as f } from "react";
9
+ //#region ../components/src/date-range-picker/date-range-picker.tsx
10
+ function p(e) {
11
+ return Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate());
12
+ }
13
+ function m(e, t) {
14
+ return !e || !t ? !1 : p(e) === p(t);
15
+ }
16
+ function h(e, t, n) {
17
+ let r = new Date(Date.UTC(e, t + n, 1));
18
+ return {
19
+ year: r.getUTCFullYear(),
20
+ month: r.getUTCMonth()
21
+ };
22
+ }
23
+ function g({ value: g, defaultValue: _, onValueChange: te, min: v, max: y, disabled: b, presets: x, locale: S, placeholder: C, size: w = "md", labels: T, className: ne }) {
24
+ s();
25
+ let E = S ?? ee(), re = C ?? l(c.dateRangePicker.placeholder), D = T?.apply ?? l(c.dateRangePicker.apply), O = T?.clear ?? l(c.dateRangePicker.clear), k = T?.previousMonth ?? l(c.calendar.previousMonth), A = T?.nextMonth ?? l(c.calendar.nextMonth), [j, M] = i({
26
+ value: g === void 0 ? void 0 : g,
27
+ defaultValue: _ ?? null,
28
+ onChange: (e) => {
29
+ e && te?.(e);
30
+ }
31
+ }), N = a(!1), P = a(null), F = a(null), I = j.value?.start ?? _?.start ?? /* @__PURE__ */ new Date(), L = a(I.getUTCFullYear()), R = a(I.getUTCMonth()), z = f(null);
32
+ o(() => {
33
+ if (!N.value) return;
34
+ let e = (e) => {
35
+ z.current && !z.current.contains(e.target) && (N.value = !1);
36
+ };
37
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
38
+ });
39
+ let B = () => {
40
+ N.value = !0;
41
+ }, V = () => {
42
+ N.value = !1;
43
+ }, H = (e) => {
44
+ let t = h(L.value, R.value, e);
45
+ n(() => {
46
+ L.value = t.year, R.value = t.month;
47
+ });
48
+ }, U = (e) => {
49
+ let t = P.value;
50
+ if (t === null) {
51
+ P.value = e;
52
+ return;
53
+ }
54
+ if (m(t, e)) {
55
+ n(() => {
56
+ P.value = null, F.value = null;
57
+ }), M(null);
58
+ return;
59
+ }
60
+ let r = p(t) <= p(e) ? {
61
+ start: t,
62
+ end: e
63
+ } : {
64
+ start: e,
65
+ end: t
66
+ };
67
+ n(() => {
68
+ P.value = null, F.value = null;
69
+ }), M(r);
70
+ }, W = (e) => {
71
+ n(() => {
72
+ P.value = null, F.value = null, L.value = e.range.start.getUTCFullYear(), R.value = e.range.start.getUTCMonth();
73
+ }), M(e.range);
74
+ }, G = () => {
75
+ n(() => {
76
+ P.value = null, F.value = null;
77
+ }), M(null);
78
+ }, K = P.value ?? j.value?.start ?? null, q = P.value ? F.value ?? null : j.value?.end ?? null, J = K && q ? Math.min(p(K), p(q)) : null, Y = K && q ? Math.max(p(K), p(q)) : null, ie = (e) => {
79
+ if (J === null || Y === null) return !1;
80
+ let t = p(e);
81
+ return t > J && t < Y;
82
+ }, ae = (e) => m(e, K) || J !== null && p(e) === J, oe = (e) => m(e, q) || Y !== null && p(e) === Y, X = new Intl.DateTimeFormat(E, {
83
+ year: "numeric",
84
+ month: "short",
85
+ day: "numeric"
86
+ }), Z = j.value ? `${X.format(j.value.start)} → ${X.format(j.value.end)}` : "", Q = h(L.value, R.value, 1), $ = {
87
+ locale: E,
88
+ size: w,
89
+ ...v === void 0 ? {} : { min: v },
90
+ ...y === void 0 ? {} : { max: y },
91
+ ...b === void 0 ? {} : { disabled: b },
92
+ hideNav: !0,
93
+ isInRange: ie,
94
+ isRangeStart: ae,
95
+ isRangeEnd: oe,
96
+ onValueChange: U,
97
+ onDayHover: (e) => {
98
+ F.value = e;
99
+ },
100
+ labels: {
101
+ previousMonth: k,
102
+ nextMonth: A
103
+ }
104
+ };
105
+ return /* @__PURE__ */ d("div", {
106
+ ref: z,
107
+ className: r(t.wrapper, ne),
108
+ "data-size": w,
109
+ onKeyDown: (e) => {
110
+ e.key === "Escape" && N.value && (e.stopPropagation(), V());
111
+ },
112
+ children: [/* @__PURE__ */ d("button", {
113
+ type: "button",
114
+ role: "combobox",
115
+ "aria-expanded": N.value,
116
+ "aria-haspopup": "dialog",
117
+ "aria-label": T?.label ?? l(c.dateRangePicker.label),
118
+ className: t.trigger,
119
+ onClick: N.value ? V : B,
120
+ children: [/* @__PURE__ */ u("span", {
121
+ className: r(t.value, Z ? void 0 : t.placeholder),
122
+ children: Z || re
123
+ }), /* @__PURE__ */ u("span", {
124
+ className: t.icon,
125
+ "aria-hidden": "true",
126
+ children: "📅"
127
+ })]
128
+ }), /* @__PURE__ */ d("div", {
129
+ role: "dialog",
130
+ className: t.panel,
131
+ "data-state": N.value ? "open" : "closed",
132
+ children: [
133
+ x && x.length > 0 && /* @__PURE__ */ u("div", {
134
+ className: t.presets,
135
+ children: x.map((e) => /* @__PURE__ */ u("button", {
136
+ type: "button",
137
+ className: t.preset,
138
+ onClick: () => W(e),
139
+ children: e.label
140
+ }, e.label))
141
+ }),
142
+ /* @__PURE__ */ d("div", {
143
+ className: t.calendars,
144
+ children: [
145
+ /* @__PURE__ */ u("div", {
146
+ className: t.calNav,
147
+ children: /* @__PURE__ */ u("button", {
148
+ type: "button",
149
+ className: t.navButton,
150
+ "aria-label": k,
151
+ onClick: () => H(-1),
152
+ children: "‹"
153
+ })
154
+ }),
155
+ /* @__PURE__ */ u(e, {
156
+ month: R.value,
157
+ year: L.value,
158
+ ...$
159
+ }),
160
+ /* @__PURE__ */ u(e, {
161
+ month: Q.month,
162
+ year: Q.year,
163
+ ...$
164
+ }),
165
+ /* @__PURE__ */ u("div", {
166
+ className: t.calNav,
167
+ children: /* @__PURE__ */ u("button", {
168
+ type: "button",
169
+ className: t.navButton,
170
+ "aria-label": A,
171
+ onClick: () => H(1),
172
+ children: "›"
173
+ })
174
+ })
175
+ ]
176
+ }),
177
+ /* @__PURE__ */ d("div", {
178
+ className: t.footer,
179
+ children: [/* @__PURE__ */ u("button", {
180
+ type: "button",
181
+ className: t.clearBtn,
182
+ onClick: G,
183
+ children: O
184
+ }), /* @__PURE__ */ u("button", {
185
+ type: "button",
186
+ className: t.applyBtn,
187
+ onClick: V,
188
+ children: D
189
+ })]
190
+ })
191
+ ]
192
+ })]
193
+ });
194
+ }
195
+ //#endregion
196
+ export { g as DateRangePicker };
@@ -0,0 +1,20 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ wrapper: "_wrapper_k1szr_2",
5
+ trigger: "_trigger_k1szr_25",
6
+ value: "_value_k1szr_55",
7
+ placeholder: "_placeholder_k1szr_61",
8
+ icon: "_icon_k1szr_64",
9
+ panel: "_panel_k1szr_69",
10
+ calendars: "_calendars_k1szr_104",
11
+ calNav: "_calNav_k1szr_110",
12
+ navButton: "_navButton_k1szr_116",
13
+ presets: "_presets_k1szr_139",
14
+ preset: "_preset_k1szr_139",
15
+ footer: "_footer_k1szr_166",
16
+ clearBtn: "_clearBtn_k1szr_175",
17
+ applyBtn: "_applyBtn_k1szr_176"
18
+ };
19
+ //#endregion
20
+ export { e as default };
@@ -0,0 +1,34 @@
1
+ "use client";
2
+
3
+ import e from "./dock.module.js";
4
+ import { getLinkComponent as t, useSignals as n } from "@cascivo/core";
5
+ import { builtin as r, t as i } from "@cascivo/i18n";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ //#region ../components/src/dock/dock.tsx
8
+ function s({ items: s, activeIndex: c, className: l, ariaLabel: u }) {
9
+ return n(), /* @__PURE__ */ a("nav", {
10
+ "aria-label": u ?? i(r.dock.nav),
11
+ className: [e.dock, l].filter(Boolean).join(" "),
12
+ children: s.map((n, r) => {
13
+ let i = r === c;
14
+ return /* @__PURE__ */ o(n.href ? t() : "button", {
15
+ className: e.item,
16
+ "data-active": i || void 0,
17
+ "aria-current": i ? "page" : void 0,
18
+ ...n.href ? { href: n.href } : {},
19
+ type: n.href ? void 0 : "button",
20
+ onClick: n.onClick,
21
+ children: [/* @__PURE__ */ a("span", {
22
+ className: e.icon,
23
+ "aria-hidden": "true",
24
+ children: n.icon
25
+ }), /* @__PURE__ */ a("span", {
26
+ className: e.label,
27
+ children: n.label
28
+ })]
29
+ }, r);
30
+ })
31
+ });
32
+ }
33
+ //#endregion
34
+ export { s as Dock };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ dock: "_dock_cqgv4_2",
5
+ item: "_item_cqgv4_20",
6
+ icon: "_icon_cqgv4_47",
7
+ label: "_label_cqgv4_54"
8
+ };
9
+ //#endregion
10
+ export { e as default };
@@ -0,0 +1,95 @@
1
+ "use client";
2
+
3
+ import e from "./drawer.module.js";
4
+ import { DismissableLayer as t, FocusScope as n, Portal as r, Presence as i, cn as a, useControllableSignal as o, useDraggable as s, useScrollLock as c, useSignals as l } from "@cascivo/core";
5
+ import { builtin as u, t as d } from "@cascivo/i18n";
6
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
7
+ import { useId as m } from "react";
8
+ //#region ../components/src/drawer/drawer.tsx
9
+ var h = 80;
10
+ function g({ open: g, defaultOpen: _, onOpenChange: v, side: y = "end", size: b, title: x, description: S, children: C, labels: w, className: T, swipeToDismiss: E = !1 }) {
11
+ l();
12
+ let [D, O] = o({
13
+ value: g,
14
+ defaultValue: _ ?? !1,
15
+ onChange: v
16
+ });
17
+ c(D);
18
+ let k = y === "top" || y === "bottom" ? "y" : "x", { handleRef: A, offset: j, isDragging: M, reset: N } = s({
19
+ isDisabled: !E,
20
+ axis: k,
21
+ onDragEnd: (e) => {
22
+ let t = k === "y" ? e.y : e.x, n = y === "end" && t > h || y === "start" && t < -80 || y === "bottom" && t > h || y === "top" && t < -80;
23
+ N(), n && O(!1);
24
+ }
25
+ }), P = m(), F = m(), I = w?.close ?? d(u.drawer.close), L = {
26
+ ...b ? { "--_drawer-size": b } : {},
27
+ ...E ? {
28
+ "--_drawer-drag-x": `${j.value.x}px`,
29
+ "--_drawer-drag-y": `${j.value.y}px`
30
+ } : {}
31
+ };
32
+ return /* @__PURE__ */ f(r, { children: /* @__PURE__ */ f(i, {
33
+ present: D,
34
+ children: /* @__PURE__ */ f("div", {
35
+ className: e.overlay,
36
+ "data-side": y,
37
+ children: /* @__PURE__ */ f(t, {
38
+ onDismiss: () => O(!1),
39
+ children: /* @__PURE__ */ f(n, {
40
+ trapped: !0,
41
+ restoreFocus: !0,
42
+ autoFocus: !0,
43
+ children: /* @__PURE__ */ p("div", {
44
+ role: "dialog",
45
+ "aria-modal": "true",
46
+ "aria-labelledby": x ? P : void 0,
47
+ "aria-describedby": S ? F : void 0,
48
+ "data-side": y,
49
+ "data-dragging": E && M.value ? "" : void 0,
50
+ className: a(e.panel, T),
51
+ style: L,
52
+ children: [(x || S) && /* @__PURE__ */ p("div", {
53
+ className: e.header,
54
+ ref: E ? A : void 0,
55
+ children: [/* @__PURE__ */ p("div", {
56
+ className: e.heading,
57
+ children: [x && /* @__PURE__ */ f("h2", {
58
+ id: P,
59
+ className: e.title,
60
+ children: x
61
+ }), S && /* @__PURE__ */ f("p", {
62
+ id: F,
63
+ className: e.description,
64
+ children: S
65
+ })]
66
+ }), /* @__PURE__ */ f("button", {
67
+ type: "button",
68
+ "aria-label": I,
69
+ onClick: () => O(!1),
70
+ className: e.close,
71
+ children: /* @__PURE__ */ f("svg", {
72
+ "aria-hidden": "true",
73
+ viewBox: "0 0 16 16",
74
+ className: e.closeIcon,
75
+ children: /* @__PURE__ */ f("path", {
76
+ d: "M4 4l8 8M12 4l-8 8",
77
+ fill: "none",
78
+ stroke: "currentColor",
79
+ strokeWidth: "1.5",
80
+ strokeLinecap: "round"
81
+ })
82
+ })
83
+ })]
84
+ }), /* @__PURE__ */ f("div", {
85
+ className: e.body,
86
+ children: C
87
+ })]
88
+ })
89
+ })
90
+ })
91
+ })
92
+ }) });
93
+ }
94
+ //#endregion
95
+ export { g as Drawer };
@@ -0,0 +1,15 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ overlay: "_overlay_cbcjg_2",
5
+ panel: "_panel_cbcjg_39",
6
+ header: "_header_cbcjg_124",
7
+ heading: "_heading_cbcjg_134",
8
+ title: "_title_cbcjg_140",
9
+ description: "_description_cbcjg_147",
10
+ close: "_close_cbcjg_153",
11
+ closeIcon: "_closeIcon_cbcjg_181",
12
+ body: "_body_cbcjg_186"
13
+ };
14
+ //#endregion
15
+ export { e as default };