@cascivo/react 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/README.md +24 -11
  2. package/dist/combobox/combobox.js +73 -73
  3. package/dist/command-menu/command-menu.js +2 -2
  4. package/dist/date-picker/date-picker.js +95 -95
  5. package/dist/field/field.js +24 -15
  6. package/dist/filter/filter.js +12 -12
  7. package/dist/index.d.ts +74 -8
  8. package/dist/index.js +2 -0
  9. package/dist/node/accordion/accordion.js +95 -0
  10. package/dist/node/accordion/accordion.module.js +13 -0
  11. package/dist/node/action-sheet/action-sheet.js +91 -0
  12. package/dist/node/action-sheet/action-sheet.module.js +14 -0
  13. package/dist/node/alert/alert.js +55 -0
  14. package/dist/node/alert/alert.module.js +13 -0
  15. package/dist/node/alert-dialog/alert-dialog.js +68 -0
  16. package/dist/node/alert-dialog/alert-dialog.module.js +13 -0
  17. package/dist/node/app-shell/app-shell.js +80 -0
  18. package/dist/node/app-shell/app-shell.module.js +14 -0
  19. package/dist/node/aspect-ratio/aspect-ratio.js +22 -0
  20. package/dist/node/aspect-ratio/aspect-ratio.module.js +8 -0
  21. package/dist/node/avatar/avatar.js +57 -0
  22. package/dist/node/avatar/avatar.module.js +10 -0
  23. package/dist/node/avatar-group/avatar-group.js +26 -0
  24. package/dist/node/avatar-group/avatar-group.module.js +8 -0
  25. package/dist/node/badge/badge.js +17 -0
  26. package/dist/node/badge/badge.module.js +5 -0
  27. package/dist/node/blockquote/blockquote.js +18 -0
  28. package/dist/node/blockquote/blockquote.module.js +8 -0
  29. package/dist/node/bottom-sheet/bottom-sheet.js +111 -0
  30. package/dist/node/bottom-sheet/bottom-sheet.module.js +16 -0
  31. package/dist/node/breadcrumb/breadcrumb.js +28 -0
  32. package/dist/node/breadcrumb/breadcrumb.module.js +5 -0
  33. package/dist/node/button/button.js +31 -0
  34. package/dist/node/button/button.module.js +5 -0
  35. package/dist/node/button-group/button-group.js +39 -0
  36. package/dist/node/button-group/button-group.module.js +5 -0
  37. package/dist/node/calendar/calendar.js +195 -0
  38. package/dist/node/calendar/calendar.module.js +16 -0
  39. package/dist/node/card/card.js +45 -0
  40. package/dist/node/card/card.module.js +11 -0
  41. package/dist/node/carousel/carousel.js +138 -0
  42. package/dist/node/carousel/carousel.module.js +15 -0
  43. package/dist/node/chat-bubble/chat-bubble.js +33 -0
  44. package/dist/node/chat-bubble/chat-bubble.module.js +13 -0
  45. package/dist/node/checkbox/checkbox.js +38 -0
  46. package/dist/node/checkbox/checkbox.module.js +10 -0
  47. package/dist/node/checkbox-card/checkbox-card.js +48 -0
  48. package/dist/node/checkbox-card/checkbox-card.module.js +13 -0
  49. package/dist/node/code/code.js +16 -0
  50. package/dist/node/code/code.module.js +5 -0
  51. package/dist/node/code-snippet/code-snippet.js +116 -0
  52. package/dist/node/code-snippet/code-snippet.module.js +19 -0
  53. package/dist/node/code-snippet/highlight.js +69 -0
  54. package/dist/node/collapsible/collapsible.js +42 -0
  55. package/dist/node/collapsible/collapsible.module.js +10 -0
  56. package/dist/node/color-picker/color-picker.js +268 -0
  57. package/dist/node/color-picker/color-picker.module.js +20 -0
  58. package/dist/node/combobox/combobox.js +164 -0
  59. package/dist/node/combobox/combobox.module.js +21 -0
  60. package/dist/node/command-menu/command-menu.js +425 -0
  61. package/dist/node/command-menu/command-menu.module.js +36 -0
  62. package/dist/node/comparison/comparison.js +69 -0
  63. package/dist/node/comparison/comparison.module.js +11 -0
  64. package/dist/node/contained-list/contained-list.js +41 -0
  65. package/dist/node/contained-list/contained-list.module.js +13 -0
  66. package/dist/node/context-menu/context-menu.js +89 -0
  67. package/dist/node/context-menu/context-menu.module.js +9 -0
  68. package/dist/node/copy-button/copy-button.js +58 -0
  69. package/dist/node/copy-button/copy-button.module.js +8 -0
  70. package/dist/node/data-list/data-list.js +27 -0
  71. package/dist/node/data-list/data-list.module.js +10 -0
  72. package/dist/node/data-table/data-table.js +370 -0
  73. package/dist/node/data-table/data-table.module.js +35 -0
  74. package/dist/node/date-picker/date-picker.js +218 -0
  75. package/dist/node/date-picker/date-picker.module.js +25 -0
  76. package/dist/node/date-range-picker/date-range-picker.js +196 -0
  77. package/dist/node/date-range-picker/date-range-picker.module.js +20 -0
  78. package/dist/node/dock/dock.js +34 -0
  79. package/dist/node/dock/dock.module.js +10 -0
  80. package/dist/node/drawer/drawer.js +95 -0
  81. package/dist/node/drawer/drawer.module.js +15 -0
  82. package/dist/node/dropdown/dropdown.js +109 -0
  83. package/dist/node/dropdown/dropdown.module.js +11 -0
  84. package/dist/node/editable/editable.js +67 -0
  85. package/dist/node/editable/editable.module.js +13 -0
  86. package/dist/node/empty-state/empty-state.js +34 -0
  87. package/dist/node/empty-state/empty-state.module.js +11 -0
  88. package/dist/node/fab/fab.js +93 -0
  89. package/dist/node/fab/fab.module.js +14 -0
  90. package/dist/node/field/field.js +48 -0
  91. package/dist/node/field/field.module.js +9 -0
  92. package/dist/node/file-uploader/file-uploader.js +122 -0
  93. package/dist/node/file-uploader/file-uploader.module.js +20 -0
  94. package/dist/node/filter/filter.js +34 -0
  95. package/dist/node/filter/filter.module.js +8 -0
  96. package/dist/node/form/form.js +95 -0
  97. package/dist/node/form/form.module.js +5 -0
  98. package/dist/node/header/header.js +44 -0
  99. package/dist/node/header/header.module.js +13 -0
  100. package/dist/node/header-panel/header-panel.js +74 -0
  101. package/dist/node/header-panel/header-panel.module.js +11 -0
  102. package/dist/node/heading/heading.js +24 -0
  103. package/dist/node/heading/heading.module.js +5 -0
  104. package/dist/node/hover-card/hover-card.js +84 -0
  105. package/dist/node/hover-card/hover-card.module.js +8 -0
  106. package/dist/node/icon-button/icon-button.js +21 -0
  107. package/dist/node/icon-button/icon-button.module.js +5 -0
  108. package/dist/node/image/image.js +64 -0
  109. package/dist/node/image/image.module.js +11 -0
  110. package/dist/node/index.js +2 -0
  111. package/dist/node/indicator/indicator.js +18 -0
  112. package/dist/node/indicator/indicator.module.js +8 -0
  113. package/dist/node/inline-loading/inline-loading.js +76 -0
  114. package/dist/node/inline-loading/inline-loading.module.js +11 -0
  115. package/dist/node/input/input.js +54 -0
  116. package/dist/node/input/input.module.js +11 -0
  117. package/dist/node/input-group/input-group.js +41 -0
  118. package/dist/node/input-group/input-group.module.js +11 -0
  119. package/dist/node/item/item.js +52 -0
  120. package/dist/node/item/item.module.js +12 -0
  121. package/dist/node/join/join.js +14 -0
  122. package/dist/node/join/join.module.js +5 -0
  123. package/dist/node/kbd/kbd.js +16 -0
  124. package/dist/node/kbd/kbd.module.js +5 -0
  125. package/dist/node/label/label.js +25 -0
  126. package/dist/node/label/label.module.js +9 -0
  127. package/dist/node/layouts/src/auto-grid/auto-grid.js +19 -0
  128. package/dist/node/layouts/src/auto-grid/auto-grid.module.js +6 -0
  129. package/dist/node/layouts/src/center/center.js +18 -0
  130. package/dist/node/layouts/src/center/center.module.js +5 -0
  131. package/dist/node/layouts/src/columns/columns.js +23 -0
  132. package/dist/node/layouts/src/columns/columns.module.js +8 -0
  133. package/dist/node/layouts/src/flex/flex.js +22 -0
  134. package/dist/node/layouts/src/flex/flex.module.js +5 -0
  135. package/dist/node/layouts/src/grid/grid.js +57 -0
  136. package/dist/node/layouts/src/grid/grid.module.js +9 -0
  137. package/dist/node/layouts/src/spacer/spacer.js +19 -0
  138. package/dist/node/layouts/src/spacer/spacer.module.js +5 -0
  139. package/dist/node/link/link.js +22 -0
  140. package/dist/node/link/link.module.js +5 -0
  141. package/dist/node/list/list.js +23 -0
  142. package/dist/node/list/list.module.js +8 -0
  143. package/dist/node/log-viewer/log-viewer.js +184 -0
  144. package/dist/node/log-viewer/log-viewer.module.js +18 -0
  145. package/dist/node/menu/menu.js +121 -0
  146. package/dist/node/menu/menu.module.js +10 -0
  147. package/dist/node/menu-button/menu-button.js +92 -0
  148. package/dist/node/menu-button/menu-button.module.js +10 -0
  149. package/dist/node/menubar/menubar.js +103 -0
  150. package/dist/node/menubar/menubar.module.js +10 -0
  151. package/dist/node/modal/modal.js +70 -0
  152. package/dist/node/modal/modal.module.js +13 -0
  153. package/dist/node/multi-select/multi-select.js +106 -0
  154. package/dist/node/multi-select/multi-select.module.js +17 -0
  155. package/dist/node/native-select/native-select.js +37 -0
  156. package/dist/node/native-select/native-select.module.js +9 -0
  157. package/dist/node/navigation-menu/navigation-menu.js +99 -0
  158. package/dist/node/navigation-menu/navigation-menu.module.js +12 -0
  159. package/dist/node/notification/notification.js +134 -0
  160. package/dist/node/notification/notification.module.js +13 -0
  161. package/dist/node/number-input/number-input.js +145 -0
  162. package/dist/node/number-input/number-input.module.js +14 -0
  163. package/dist/node/otp-input/otp-input.js +70 -0
  164. package/dist/node/otp-input/otp-input.module.js +8 -0
  165. package/dist/node/overflow-menu/overflow-menu.js +65 -0
  166. package/dist/node/overflow-menu/overflow-menu.module.js +9 -0
  167. package/dist/node/pagination/pagination.js +92 -0
  168. package/dist/node/pagination/pagination.module.js +13 -0
  169. package/dist/node/password-input/password-input.js +80 -0
  170. package/dist/node/password-input/password-input.module.js +13 -0
  171. package/dist/node/popover/popover.js +49 -0
  172. package/dist/node/popover/popover.module.js +8 -0
  173. package/dist/node/popover/use-popover.js +57 -0
  174. package/dist/node/progress/progress.js +17 -0
  175. package/dist/node/progress/progress.module.js +8 -0
  176. package/dist/node/progress-bar/progress-bar.js +44 -0
  177. package/dist/node/progress-bar/progress-bar.module.js +13 -0
  178. package/dist/node/progress-circle/progress-circle.js +48 -0
  179. package/dist/node/progress-circle/progress-circle.module.js +11 -0
  180. package/dist/node/progress-indicator/progress-indicator.js +36 -0
  181. package/dist/node/progress-indicator/progress-indicator.module.js +12 -0
  182. package/dist/node/prose/prose.js +15 -0
  183. package/dist/node/prose/prose.module.js +5 -0
  184. package/dist/node/pull-to-refresh/pull-to-refresh.js +82 -0
  185. package/dist/node/pull-to-refresh/pull-to-refresh.module.js +11 -0
  186. package/dist/node/qr-code/encode.js +585 -0
  187. package/dist/node/qr-code/qr-code.js +41 -0
  188. package/dist/node/qr-code/qr-code.module.js +8 -0
  189. package/dist/node/radial-progress/radial-progress.js +28 -0
  190. package/dist/node/radial-progress/radial-progress.module.js +8 -0
  191. package/dist/node/radio/radio.js +49 -0
  192. package/dist/node/radio/radio.module.js +11 -0
  193. package/dist/node/radio-card/radio-card.js +63 -0
  194. package/dist/node/radio-card/radio-card.module.js +13 -0
  195. package/dist/node/rating-group/rating-group.js +37 -0
  196. package/dist/node/rating-group/rating-group.module.js +8 -0
  197. package/dist/node/react/src/index.js +138 -0
  198. package/dist/node/react/src/theme.js +54 -0
  199. package/dist/node/relative-time/relative-time.js +66 -0
  200. package/dist/node/relative-time/relative-time.module.js +5 -0
  201. package/dist/node/resizable/resizable.js +80 -0
  202. package/dist/node/resizable/resizable.module.js +10 -0
  203. package/dist/node/scroll-area/scroll-area.js +38 -0
  204. package/dist/node/scroll-area/scroll-area.module.js +5 -0
  205. package/dist/node/search/search.js +94 -0
  206. package/dist/node/search/search.module.js +11 -0
  207. package/dist/node/segmented-control/segmented-control.js +43 -0
  208. package/dist/node/segmented-control/segmented-control.module.js +8 -0
  209. package/dist/node/select/select.js +71 -0
  210. package/dist/node/select/select.module.js +13 -0
  211. package/dist/node/separator/separator.js +21 -0
  212. package/dist/node/separator/separator.module.js +5 -0
  213. package/dist/node/sheet/sheet.js +50 -0
  214. package/dist/node/sheet/sheet.module.js +11 -0
  215. package/dist/node/shell-header/shell-header.js +166 -0
  216. package/dist/node/shell-header/shell-header.module.js +25 -0
  217. package/dist/node/side-nav/side-nav.js +333 -0
  218. package/dist/node/side-nav/side-nav.module.js +33 -0
  219. package/dist/node/skeleton/skeleton.js +25 -0
  220. package/dist/node/skeleton/skeleton.module.js +9 -0
  221. package/dist/node/skip-nav/skip-nav.js +27 -0
  222. package/dist/node/skip-nav/skip-nav.module.js +5 -0
  223. package/dist/node/slider/slider.js +29 -0
  224. package/dist/node/slider/slider.module.js +9 -0
  225. package/dist/node/spinner/spinner.js +18 -0
  226. package/dist/node/spinner/spinner.module.js +8 -0
  227. package/dist/node/stack/stack.js +19 -0
  228. package/dist/node/stack/stack.module.js +8 -0
  229. package/dist/node/stat/stat.js +41 -0
  230. package/dist/node/stat/stat.module.js +13 -0
  231. package/dist/node/status/status.js +20 -0
  232. package/dist/node/status/status.module.js +9 -0
  233. package/dist/node/steps/steps.js +35 -0
  234. package/dist/node/steps/steps.module.js +10 -0
  235. package/dist/node/storage/src/drivers.js +36 -0
  236. package/dist/node/storage/src/persisted-signal.js +43 -0
  237. package/dist/node/structured-list/structured-list.js +101 -0
  238. package/dist/node/structured-list/structured-list.module.js +14 -0
  239. package/dist/node/swap/swap.js +36 -0
  240. package/dist/node/swap/swap.module.js +9 -0
  241. package/dist/node/swipe-item/swipe-item.js +62 -0
  242. package/dist/node/swipe-item/swipe-item.module.js +14 -0
  243. package/dist/node/switcher/switcher.js +32 -0
  244. package/dist/node/switcher/switcher.module.js +10 -0
  245. package/dist/node/tabs/tabs.js +95 -0
  246. package/dist/node/tabs/tabs.module.js +10 -0
  247. package/dist/node/tag/tag.js +26 -0
  248. package/dist/node/tag/tag.module.js +8 -0
  249. package/dist/node/tags-input/tags-input.js +64 -0
  250. package/dist/node/tags-input/tags-input.module.js +10 -0
  251. package/dist/node/text/text.js +18 -0
  252. package/dist/node/text/text.module.js +5 -0
  253. package/dist/node/textarea/textarea.js +56 -0
  254. package/dist/node/textarea/textarea.module.js +11 -0
  255. package/dist/node/tile/tile.js +39 -0
  256. package/dist/node/tile/tile.module.js +9 -0
  257. package/dist/node/time-picker/time-picker.js +62 -0
  258. package/dist/node/time-picker/time-picker.module.js +11 -0
  259. package/dist/node/timeline/timeline.js +41 -0
  260. package/dist/node/timeline/timeline.module.js +13 -0
  261. package/dist/node/toast/toast.js +85 -0
  262. package/dist/node/toast/toast.module.js +13 -0
  263. package/dist/node/toc/toc.js +42 -0
  264. package/dist/node/toc/toc.module.js +5 -0
  265. package/dist/node/toc/use-toc-from-region.js +18 -0
  266. package/dist/node/toggle/toggle.js +39 -0
  267. package/dist/node/toggle/toggle.module.js +10 -0
  268. package/dist/node/toggle-group/toggle-group.js +55 -0
  269. package/dist/node/toggle-group/toggle-group.module.js +8 -0
  270. package/dist/node/toggletip/toggletip.js +49 -0
  271. package/dist/node/toggletip/toggletip.module.js +9 -0
  272. package/dist/node/tooltip/tooltip.js +58 -0
  273. package/dist/node/tooltip/tooltip.module.js +8 -0
  274. package/dist/node/tree-view/tree-view.js +201 -0
  275. package/dist/node/tree-view/tree-view.module.js +15 -0
  276. package/dist/node/user/user.js +37 -0
  277. package/dist/node/user/user.module.js +11 -0
  278. package/dist/node/visually-hidden/visually-hidden.js +15 -0
  279. package/dist/node/visually-hidden/visually-hidden.module.js +5 -0
  280. package/dist/number-input/number-input.js +41 -41
  281. package/dist/react/src/theme.js +42 -31
  282. package/dist/search/search.js +35 -35
  283. package/dist/swap/swap.js +12 -12
  284. package/dist/time-picker/time-picker.js +24 -24
  285. package/dist/toggle/toggle.js +12 -12
  286. package/package.json +7 -6
  287. package/readme.body.md +24 -11
@@ -0,0 +1,145 @@
1
+ "use client";
2
+
3
+ import e from "./number-input.module.js";
4
+ import { cn as t, createMachine as n, useMachine as r, useSignal as i, useSignals as a } from "@cascivo/core";
5
+ import { builtin as o, t as s } from "@cascivo/i18n";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
+ //#region ../components/src/number-input/number-input.tsx
8
+ var u = n({
9
+ initial: "idle",
10
+ states: {
11
+ idle: { on: { FOCUS: "focused" } },
12
+ focused: { on: { BLUR: "idle" } }
13
+ }
14
+ });
15
+ function d(e, t, n) {
16
+ let r = e;
17
+ return t !== void 0 && (r = Math.max(r, t)), n !== void 0 && (r = Math.min(r, n)), r;
18
+ }
19
+ function f(e) {
20
+ let t = String(e), n = t.indexOf(".");
21
+ return n === -1 ? 0 : t.length - n - 1;
22
+ }
23
+ function p(e, t) {
24
+ let n = 10 ** t;
25
+ return Math.round(e * n) / n;
26
+ }
27
+ function m(e) {
28
+ let t = e.trim();
29
+ if (t === "") return null;
30
+ let n = Number(t);
31
+ return Number.isFinite(n) ? n : null;
32
+ }
33
+ function h({ value: n, defaultValue: h, onValueChange: g, onChange: _, min: v, max: y, step: b = 1, precision: x, formatOptions: S, label: C, hint: w, error: T, size: E = "md", disabled: D, incrementLabel: O, decrementLabel: k, className: A, id: j, onFocus: M, onBlur: N, onKeyDown: P, ...F }) {
34
+ a();
35
+ let I = O ?? s(o.numberInput.increment), L = k ?? s(o.numberInput.decrement), [R, z] = r(u), B = n !== void 0, V = i(h ?? null), H = i(""), U = B ? n : V.value, W = j ?? (C ? `cascade-number-input-${C.toLowerCase().replace(/\s+/g, "-")}` : void 0), G = (e) => {
36
+ B || (V.value = e), H.value = e == null ? "" : String(e), e !== U && (g ?? _)?.(e);
37
+ }, K = () => {
38
+ let e = m(H.value);
39
+ e != null && (e = d(e, v, y), x !== void 0 && (e = p(e, x))), G(e);
40
+ }, q = (e) => {
41
+ let t = (R.value === "focused" ? m(H.value) : U) ?? 0, n = x ?? Math.max(f(b), f(t));
42
+ G(d(p(t + e * b, n), v, y));
43
+ }, J = R.value === "focused" ? H.value : ((e) => e == null ? "" : S ? new Intl.NumberFormat(void 0, S).format(e) : String(e))(U), Y = U != null && y !== void 0 && U >= y, X = U != null && v !== void 0 && U <= v;
44
+ return /* @__PURE__ */ l("div", {
45
+ className: t(e.wrapper, A),
46
+ "data-state": T ? "error" : R.value,
47
+ "data-size": E,
48
+ children: [
49
+ C && /* @__PURE__ */ c("label", {
50
+ className: e.label,
51
+ htmlFor: W,
52
+ children: C
53
+ }),
54
+ /* @__PURE__ */ l("div", {
55
+ className: e.field,
56
+ children: [/* @__PURE__ */ c("input", {
57
+ id: W,
58
+ type: "text",
59
+ inputMode: "decimal",
60
+ autoComplete: "off",
61
+ role: "spinbutton",
62
+ className: e.input,
63
+ value: J,
64
+ disabled: D,
65
+ "aria-valuenow": U ?? void 0,
66
+ "aria-valuemin": v,
67
+ "aria-valuemax": y,
68
+ "aria-invalid": T ? !0 : void 0,
69
+ "aria-describedby": T ? `${W}-error` : w ? `${W}-hint` : void 0,
70
+ onChange: (e) => {
71
+ H.value = e.target.value;
72
+ },
73
+ onFocus: (e) => {
74
+ H.value = U == null ? "" : String(U), z("FOCUS"), M?.(e);
75
+ },
76
+ onBlur: (e) => {
77
+ K(), z("BLUR"), N?.(e);
78
+ },
79
+ onKeyDown: (e) => {
80
+ e.key === "ArrowUp" ? (e.preventDefault(), q(1)) : e.key === "ArrowDown" ? (e.preventDefault(), q(-1)) : e.key === "Enter" && K(), P?.(e);
81
+ },
82
+ ...F
83
+ }), /* @__PURE__ */ l("div", {
84
+ className: e.steppers,
85
+ children: [/* @__PURE__ */ c("button", {
86
+ type: "button",
87
+ className: e.stepper,
88
+ "aria-label": I,
89
+ tabIndex: -1,
90
+ disabled: D || Y,
91
+ onMouseDown: (e) => e.preventDefault(),
92
+ onClick: () => q(1),
93
+ children: /* @__PURE__ */ c("svg", {
94
+ viewBox: "0 0 10 10",
95
+ "aria-hidden": "true",
96
+ focusable: "false",
97
+ children: /* @__PURE__ */ c("path", {
98
+ d: "M2 6.5 5 3.5 8 6.5",
99
+ fill: "none",
100
+ stroke: "currentColor",
101
+ strokeWidth: "1.5",
102
+ strokeLinecap: "round",
103
+ strokeLinejoin: "round"
104
+ })
105
+ })
106
+ }), /* @__PURE__ */ c("button", {
107
+ type: "button",
108
+ className: e.stepper,
109
+ "aria-label": L,
110
+ tabIndex: -1,
111
+ disabled: D || X,
112
+ onMouseDown: (e) => e.preventDefault(),
113
+ onClick: () => q(-1),
114
+ children: /* @__PURE__ */ c("svg", {
115
+ viewBox: "0 0 10 10",
116
+ "aria-hidden": "true",
117
+ focusable: "false",
118
+ children: /* @__PURE__ */ c("path", {
119
+ d: "M2 3.5 5 6.5 8 3.5",
120
+ fill: "none",
121
+ stroke: "currentColor",
122
+ strokeWidth: "1.5",
123
+ strokeLinecap: "round",
124
+ strokeLinejoin: "round"
125
+ })
126
+ })
127
+ })]
128
+ })]
129
+ }),
130
+ T && /* @__PURE__ */ c("span", {
131
+ id: `${W}-error`,
132
+ className: e.error,
133
+ role: "alert",
134
+ children: T
135
+ }),
136
+ !T && w && /* @__PURE__ */ c("span", {
137
+ id: `${W}-hint`,
138
+ className: e.hint,
139
+ children: w
140
+ })
141
+ ]
142
+ });
143
+ }
144
+ //#endregion
145
+ export { h as NumberInput };
@@ -0,0 +1,14 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ wrapper: "_wrapper_q5e5w_2",
5
+ label: "_label_q5e5w_27",
6
+ field: "_field_q5e5w_35",
7
+ input: "_input_q5e5w_39",
8
+ steppers: "_steppers_q5e5w_84",
9
+ stepper: "_stepper_q5e5w_84",
10
+ error: "_error_q5e5w_131",
11
+ hint: "_hint_q5e5w_138"
12
+ };
13
+ //#endregion
14
+ export { e as default };
@@ -0,0 +1,70 @@
1
+ "use client";
2
+
3
+ import e from "./otp-input.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 } from "react/jsx-runtime";
7
+ import { useRef as s } from "react";
8
+ //#region ../components/src/otp-input/otp-input.tsx
9
+ function c({ length: c = 6, value: l, onValueChange: u, disabled: d = !1, type: f = "numeric", className: p, ...m }) {
10
+ r();
11
+ let h = n(Array.from({ length: c }, (e, t) => l[t] ?? "")), g = s([]), _ = Array.from({ length: c }, (e, t) => l[t] ?? "");
12
+ JSON.stringify(h.value) !== JSON.stringify(_) && (h.value = _);
13
+ function v(e) {
14
+ u(e.join("")), h.value = e;
15
+ }
16
+ function y(e) {
17
+ let t = Math.max(0, Math.min(c - 1, e));
18
+ g.current[t]?.focus();
19
+ }
20
+ function b(e, t) {
21
+ if (!(f === "numeric" ? /^\d$/ : /^[a-zA-Z0-9]$/).test(t)) return;
22
+ let n = [...h.value];
23
+ n[e] = t, v(n), e < c - 1 && y(e + 1);
24
+ }
25
+ function x(e, t) {
26
+ if (t.key === "Backspace") {
27
+ t.preventDefault();
28
+ let n = [...h.value];
29
+ n[e] ? (n[e] = "", v(n)) : e > 0 && (n[e - 1] = "", v(n), y(e - 1));
30
+ } else t.key === "ArrowLeft" ? (t.preventDefault(), y(e - 1)) : t.key === "ArrowRight" && (t.preventDefault(), y(e + 1));
31
+ }
32
+ function S(e, t) {
33
+ let n = t.clipboardData.getData("text").replace(/\s/g, "").slice(0, c - e);
34
+ if (!(f === "numeric" ? /^\d+$/ : /^[a-zA-Z0-9]+$/).test(n)) return;
35
+ t.preventDefault();
36
+ let r = [...h.value];
37
+ for (let t = 0; t < n.length; t++) e + t < c && (r[e + t] = n[t] ?? "");
38
+ v(r), y(Math.min(e + n.length, c - 1));
39
+ }
40
+ let C = a(i.otpInput.label);
41
+ return /* @__PURE__ */ o("div", {
42
+ className: t(e.wrapper, p),
43
+ role: "group",
44
+ "aria-label": C,
45
+ ...m,
46
+ children: h.value.map((t, n) => /* @__PURE__ */ o("input", {
47
+ ref: (e) => {
48
+ g.current[n] = e;
49
+ },
50
+ type: f === "numeric" ? "tel" : "text",
51
+ inputMode: f === "numeric" ? "numeric" : "text",
52
+ className: e.slot,
53
+ value: t,
54
+ maxLength: 1,
55
+ "aria-label": a(i.otpInput.digit, { n: String(n + 1) }),
56
+ autoComplete: n === 0 ? "one-time-code" : "off",
57
+ disabled: d,
58
+ "data-filled": t ? "" : void 0,
59
+ onChange: (e) => {
60
+ let t = e.currentTarget.value.slice(-1);
61
+ t && b(n, t);
62
+ },
63
+ onKeyDown: (e) => x(n, e),
64
+ onPaste: (e) => S(n, e),
65
+ onFocus: (e) => e.currentTarget.select()
66
+ }, n))
67
+ });
68
+ }
69
+ //#endregion
70
+ export { c as OtpInput };
@@ -0,0 +1,8 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ wrapper: "_wrapper_15f1m_2",
5
+ slot: "_slot_15f1m_8"
6
+ };
7
+ //#endregion
8
+ export { e as default };
@@ -0,0 +1,65 @@
1
+ "use client";
2
+
3
+ import { Dropdown as e } from "../dropdown/dropdown.js";
4
+ import t from "./overflow-menu.module.js";
5
+ import { cn as n, useSignals as r } from "@cascivo/core";
6
+ import { builtin as i, t as a } from "@cascivo/i18n";
7
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
8
+ //#region ../components/src/overflow-menu/overflow-menu.tsx
9
+ function l() {
10
+ return /* @__PURE__ */ c("svg", {
11
+ viewBox: "0 0 16 16",
12
+ width: "16",
13
+ height: "16",
14
+ fill: "currentColor",
15
+ "aria-hidden": "true",
16
+ children: [
17
+ /* @__PURE__ */ s("circle", {
18
+ cx: "8",
19
+ cy: "3",
20
+ r: "1.5"
21
+ }),
22
+ /* @__PURE__ */ s("circle", {
23
+ cx: "8",
24
+ cy: "8",
25
+ r: "1.5"
26
+ }),
27
+ /* @__PURE__ */ s("circle", {
28
+ cx: "8",
29
+ cy: "13",
30
+ r: "1.5"
31
+ })
32
+ ]
33
+ });
34
+ }
35
+ function u({ items: u, onSelect: d, placement: f = "bottom-end", ariaLabel: p, size: m = "md", disabled: h = !1, className: g }) {
36
+ r();
37
+ let _ = p ?? a(i.overflowMenu.trigger), v = u.map((e) => {
38
+ let n = {
39
+ label: e.label,
40
+ value: e.value
41
+ };
42
+ return e.disabled !== void 0 && (n.disabled = e.disabled), e.destructive ? n.icon = /* @__PURE__ */ c(o, { children: [e.icon, /* @__PURE__ */ s("span", {
43
+ className: t["destructive-flag"],
44
+ "aria-hidden": "true"
45
+ })] }) : e.icon !== void 0 && (n.icon = e.icon), n;
46
+ });
47
+ return /* @__PURE__ */ s("div", {
48
+ className: n(t.root, g),
49
+ children: /* @__PURE__ */ s(e, {
50
+ items: v,
51
+ onSelect: (e) => d?.(e),
52
+ placement: f,
53
+ trigger: /* @__PURE__ */ s("button", {
54
+ type: "button",
55
+ className: t.trigger,
56
+ "data-size": m,
57
+ disabled: h,
58
+ "aria-label": _,
59
+ children: /* @__PURE__ */ s(l, {})
60
+ })
61
+ })
62
+ });
63
+ }
64
+ //#endregion
65
+ export { u as OverflowMenu };
@@ -0,0 +1,9 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ root: "_root_14jtg_2",
5
+ trigger: "_trigger_14jtg_6",
6
+ "destructive-flag": "_destructive-flag_14jtg_49"
7
+ };
8
+ //#endregion
9
+ export { e as default };
@@ -0,0 +1,92 @@
1
+ "use client";
2
+
3
+ import e from "./pagination.module.js";
4
+ import { cn 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/pagination/pagination.tsx
8
+ var s = [
9
+ 10,
10
+ 25,
11
+ 50,
12
+ 100
13
+ ];
14
+ function c({ page: c, pageSize: l, totalItems: u, onPageChange: d, onPageSizeChange: f, pageSizeOptions: p = s, labels: m, className: h }) {
15
+ n();
16
+ let g = Math.max(1, Math.ceil(u / l)), _ = Math.min(Math.max(c, 1), g), v = u === 0 ? 0 : (_ - 1) * l + 1, y = Math.min(_ * l, u), b = m?.nav ?? i(r.pagination.nav), x = m?.itemsPerPage ?? i(r.pagination.itemsPerPage), S = m?.pageOf?.(_, g) ?? i(r.pagination.pageOf, {
17
+ page: _,
18
+ total: g
19
+ }), C = m?.range?.(v, y, u) ?? i(r.pagination.range, {
20
+ start: v,
21
+ end: y,
22
+ total: u
23
+ }), w = m?.previous ?? i(r.pagination.previous), T = m?.next ?? i(r.pagination.next);
24
+ return /* @__PURE__ */ o("nav", {
25
+ "aria-label": b,
26
+ className: t(e.pagination, h),
27
+ children: [
28
+ f && /* @__PURE__ */ o("label", {
29
+ className: e.group,
30
+ children: [/* @__PURE__ */ a("span", {
31
+ className: e.label,
32
+ children: x
33
+ }), /* @__PURE__ */ a("select", {
34
+ className: e.select,
35
+ value: l,
36
+ onChange: (e) => f(Number(e.target.value)),
37
+ children: p.map((e) => /* @__PURE__ */ a("option", {
38
+ value: e,
39
+ children: e
40
+ }, e))
41
+ })]
42
+ }),
43
+ /* @__PURE__ */ a("span", {
44
+ className: e.range,
45
+ children: C
46
+ }),
47
+ /* @__PURE__ */ o("div", {
48
+ className: e.group,
49
+ children: [/* @__PURE__ */ a("select", {
50
+ className: e.select,
51
+ "aria-label": S,
52
+ value: _,
53
+ onChange: (e) => d(Number(e.target.value)),
54
+ children: Array.from({ length: g }, (e, t) => /* @__PURE__ */ a("option", {
55
+ value: t + 1,
56
+ children: t + 1
57
+ }, t + 1))
58
+ }), /* @__PURE__ */ a("span", {
59
+ className: e.label,
60
+ "aria-hidden": "true",
61
+ children: S
62
+ })]
63
+ }),
64
+ /* @__PURE__ */ o("div", {
65
+ className: e.buttons,
66
+ children: [/* @__PURE__ */ a("button", {
67
+ type: "button",
68
+ className: e.button,
69
+ "aria-label": w,
70
+ disabled: _ <= 1,
71
+ onClick: () => d(_ - 1),
72
+ children: /* @__PURE__ */ a("span", {
73
+ "aria-hidden": "true",
74
+ children: "‹"
75
+ })
76
+ }), /* @__PURE__ */ a("button", {
77
+ type: "button",
78
+ className: e.button,
79
+ "aria-label": T,
80
+ disabled: _ >= g,
81
+ onClick: () => d(_ + 1),
82
+ children: /* @__PURE__ */ a("span", {
83
+ "aria-hidden": "true",
84
+ children: "›"
85
+ })
86
+ })]
87
+ })
88
+ ]
89
+ });
90
+ }
91
+ //#endregion
92
+ export { c as Pagination };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ pagination: "_pagination_1rt7c_2",
5
+ group: "_group_1rt7c_13",
6
+ label: "_label_1rt7c_19",
7
+ range: "_range_1rt7c_25",
8
+ select: "_select_1rt7c_35",
9
+ buttons: "_buttons_1rt7c_70",
10
+ button: "_button_1rt7c_70"
11
+ };
12
+ //#endregion
13
+ export { e as default };
@@ -0,0 +1,80 @@
1
+ "use client";
2
+
3
+ import e from "./password-input.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
+ import { useId as c } from "react";
8
+ //#region ../components/src/password-input/password-input.tsx
9
+ function l(e) {
10
+ if (!e) return {
11
+ score: 0,
12
+ label: "weak"
13
+ };
14
+ let t = 0;
15
+ return /[a-z]/.test(e) && t++, /[A-Z]/.test(e) && t++, /[0-9]/.test(e) && t++, /[^a-zA-Z0-9]/.test(e) && t++, e.length >= 12 && (t = Math.min(4, t + 1)), t = Math.min(4, t), {
16
+ score: t,
17
+ label: [
18
+ "weak",
19
+ "weak",
20
+ "fair",
21
+ "good",
22
+ "strong"
23
+ ][t]
24
+ };
25
+ }
26
+ function u({ showStrengthMeter: u = !1, size: d = "md", labels: f, className: p, id: m, value: h, defaultValue: g, onChange: _, ...v }) {
27
+ r();
28
+ let y = n(!1), b = n(typeof h == "string" ? h : typeof g == "string" ? g : "");
29
+ typeof h == "string" && (b.value = h);
30
+ let x = c(), S = m ?? `cascade-password-${x}`, C = u ? l(b.value) : null, w = y.value ? f?.hide ?? a(i.passwordInput.hide) : f?.reveal ?? a(i.passwordInput.reveal), T = C ? f?.strengthLabel ? f.strengthLabel(C.label) : a(i.passwordInput.strengthLabel, { level: C.label }) : void 0;
31
+ return /* @__PURE__ */ s("div", {
32
+ className: t(e.wrapper, p),
33
+ "data-size": d,
34
+ "data-revealed": y.value ? "" : void 0,
35
+ children: [/* @__PURE__ */ s("div", {
36
+ className: e["input-row"],
37
+ children: [/* @__PURE__ */ o("input", {
38
+ ...v,
39
+ id: S,
40
+ type: y.value ? "text" : "password",
41
+ className: e.input,
42
+ value: h,
43
+ defaultValue: g,
44
+ onChange: (e) => {
45
+ typeof h != "string" && (b.value = e.currentTarget.value), _?.(e);
46
+ }
47
+ }), /* @__PURE__ */ o("button", {
48
+ type: "button",
49
+ className: e["reveal-btn"],
50
+ "aria-label": w,
51
+ onClick: () => {
52
+ y.value = !y.value;
53
+ },
54
+ children: /* @__PURE__ */ o("span", {
55
+ className: e["reveal-icon"],
56
+ "aria-hidden": "true"
57
+ })
58
+ })]
59
+ }), u && C && /* @__PURE__ */ o("div", {
60
+ className: e["strength-meter"],
61
+ role: "meter",
62
+ "aria-label": T,
63
+ "aria-valuenow": C.score,
64
+ "aria-valuemin": 0,
65
+ "aria-valuemax": 4,
66
+ "data-strength": C.label,
67
+ children: [
68
+ 0,
69
+ 1,
70
+ 2,
71
+ 3
72
+ ].map((t) => /* @__PURE__ */ o("div", {
73
+ className: e["strength-segment"],
74
+ "data-filled": t < C.score ? "" : void 0
75
+ }, t))
76
+ })]
77
+ });
78
+ }
79
+ //#endregion
80
+ export { u as PasswordInput };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ wrapper: "_wrapper_r2rcd_2",
5
+ "input-row": "_input-row_r2rcd_26",
6
+ input: "_input_r2rcd_26",
7
+ "reveal-btn": "_reveal-btn_r2rcd_68",
8
+ "reveal-icon": "_reveal-icon_r2rcd_94",
9
+ "strength-meter": "_strength-meter_r2rcd_114",
10
+ "strength-segment": "_strength-segment_r2rcd_135"
11
+ };
12
+ //#endregion
13
+ export { e as default };
@@ -0,0 +1,49 @@
1
+ "use client";
2
+
3
+ import { usePopover as e } from "./use-popover.js";
4
+ import t from "./popover.module.js";
5
+ import { useSignals as n } from "@cascivo/core";
6
+ import { jsx as r } from "react/jsx-runtime";
7
+ import { createContext as i } from "react";
8
+ //#region ../components/src/popover/popover.tsx
9
+ var a = i(null);
10
+ function o({ children: t, ...n }) {
11
+ let i = e(n);
12
+ return /* @__PURE__ */ r(a.Provider, {
13
+ value: i,
14
+ children: t
15
+ });
16
+ }
17
+ function s({ children: e }) {
18
+ return n(), /* @__PURE__ */ r(a.Consumer, { children: (n) => {
19
+ if (!n) throw Error("PopoverTrigger must be used inside <Popover>");
20
+ let { triggerRef: i, toggle: a, anchorName: o, isOpen: s } = n;
21
+ return /* @__PURE__ */ r("button", {
22
+ ref: i,
23
+ type: "button",
24
+ "aria-expanded": s.value,
25
+ "aria-haspopup": "dialog",
26
+ style: { anchorName: o },
27
+ onClick: a,
28
+ className: t.trigger,
29
+ children: e
30
+ });
31
+ } });
32
+ }
33
+ function c({ children: e, className: i }) {
34
+ return n(), /* @__PURE__ */ r(a.Consumer, { children: (n) => {
35
+ if (!n) throw Error("PopoverContent must be used inside <Popover>");
36
+ let { popoverRef: a, anchorName: o, isOpen: s } = n;
37
+ return /* @__PURE__ */ r("div", {
38
+ ref: a,
39
+ popover: "auto",
40
+ role: "dialog",
41
+ "data-state": s.value ? "open" : "closed",
42
+ style: { positionAnchor: o },
43
+ className: [t.content, i].filter(Boolean).join(" "),
44
+ children: e
45
+ });
46
+ } });
47
+ }
48
+ //#endregion
49
+ export { o as Popover, c as PopoverContent, s as PopoverTrigger };
@@ -0,0 +1,8 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ trigger: "_trigger_13tp0_2",
5
+ content: "_content_13tp0_11"
6
+ };
7
+ //#endregion
8
+ export { e as default };
@@ -0,0 +1,57 @@
1
+ "use client";
2
+
3
+ import { useSignal as e, useSignalEffect as t } from "@cascivo/core";
4
+ import { useRef as n } from "react";
5
+ //#region ../components/src/popover/use-popover.ts
6
+ var r = 0, i = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("anchor-name: --cascivo-a");
7
+ function a(a = {}) {
8
+ let o = n(`--cascivo-popover-${++r}`).current, s = n(null), c = n(null), l = e(a.open ?? !1);
9
+ a.open !== void 0 && (l.value = a.open);
10
+ let u = n(a.onOpenChange);
11
+ u.current = a.onOpenChange;
12
+ let d = n(a.placement);
13
+ d.current = a.placement;
14
+ let f = n(a.offset);
15
+ return f.current = a.offset, t(() => {
16
+ let e = l.value;
17
+ u.current?.(e);
18
+ let t = c.current;
19
+ if (t) {
20
+ if (e) try {
21
+ t.showPopover();
22
+ } catch {}
23
+ else try {
24
+ t.hidePopover();
25
+ } catch {}
26
+ if (!i && e) {
27
+ let e = s.current;
28
+ if (!e) return;
29
+ let n = e.getBoundingClientRect(), r = d.current ?? "bottom", i = f.current ?? 4;
30
+ r === "bottom" ? (t.style.top = `${n.bottom + i + window.scrollY}px`, t.style.left = `${n.left + window.scrollX}px`) : r === "top" ? (t.style.top = `${n.top - i + window.scrollY}px`, t.style.left = `${n.left + window.scrollX}px`, t.style.transform = "translateY(-100%)") : r === "left" ? (t.style.top = `${n.top + window.scrollY}px`, t.style.left = `${n.left - i + window.scrollX}px`, t.style.transform = "translateX(-100%)") : r === "right" && (t.style.top = `${n.top + window.scrollY}px`, t.style.left = `${n.right + i + window.scrollX}px`);
31
+ }
32
+ }
33
+ }), t(() => {
34
+ let e = c.current;
35
+ if (!e) return;
36
+ let t = (e) => {
37
+ e.newState === "closed" && (l.value = !1);
38
+ };
39
+ return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
40
+ }), {
41
+ triggerRef: s,
42
+ popoverRef: c,
43
+ isOpen: l,
44
+ anchorName: o,
45
+ open: () => {
46
+ l.value = !0;
47
+ },
48
+ close: () => {
49
+ l.value = !1;
50
+ },
51
+ toggle: () => {
52
+ l.value = !l.value;
53
+ }
54
+ };
55
+ }
56
+ //#endregion
57
+ export { a as usePopover };
@@ -0,0 +1,17 @@
1
+ "use client";
2
+
3
+ import e from "./progress.module.js";
4
+ import { jsx as t } from "react/jsx-runtime";
5
+ //#region ../components/src/progress/progress.tsx
6
+ function n({ value: n, variant: r = "primary", size: i = "md", className: a, ...o }) {
7
+ return /* @__PURE__ */ t("progress", {
8
+ className: [e.progress, a].filter(Boolean).join(" "),
9
+ "data-variant": r,
10
+ "data-size": i,
11
+ value: n,
12
+ max: n === void 0 ? void 0 : 100,
13
+ ...o
14
+ });
15
+ }
16
+ //#endregion
17
+ export { n as Progress };
@@ -0,0 +1,8 @@
1
+ "use client";
2
+
3
+ var e = {
4
+ progress: "_progress_1xlox_2",
5
+ "cascivo-progress-indeterminate": "_cascivo-progress-indeterminate_1xlox_1"
6
+ };
7
+ //#endregion
8
+ export { e as default };