@cascivo/react 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/accordion/accordion.js +46 -44
  2. package/dist/action-sheet/action-sheet.js +16 -16
  3. package/dist/alert-dialog/alert-dialog.js +34 -34
  4. package/dist/app-shell/app-shell.css +1 -1
  5. package/dist/app-shell/app-shell.js +14 -12
  6. package/dist/app-shell/app-shell.module.js +8 -8
  7. package/dist/avatar-group/avatar-group.js +6 -6
  8. package/dist/bottom-sheet/bottom-sheet.js +18 -18
  9. package/dist/button/button.js +15 -12
  10. package/dist/button-group/button-group.js +8 -8
  11. package/dist/carousel/carousel.js +20 -20
  12. package/dist/checkbox/checkbox.js +21 -21
  13. package/dist/checkbox-card/checkbox-card.js +15 -13
  14. package/dist/collapsible/collapsible.js +7 -7
  15. package/dist/color-picker/color-picker.js +26 -26
  16. package/dist/combobox/combobox.js +86 -86
  17. package/dist/command-menu/command-menu.js +111 -111
  18. package/dist/comparison/comparison.js +10 -10
  19. package/dist/context-menu/context-menu.js +9 -9
  20. package/dist/copy-button/copy-button.js +18 -16
  21. package/dist/data-table/data-table.js +1 -1
  22. package/dist/date-picker/date-picker.js +25 -25
  23. package/dist/date-range-picker/date-range-picker.js +26 -26
  24. package/dist/drawer/drawer.css +1 -1
  25. package/dist/drawer/drawer.js +18 -17
  26. package/dist/drawer/drawer.module.js +9 -9
  27. package/dist/dropdown/dropdown.js +48 -48
  28. package/dist/editable/editable.js +11 -11
  29. package/dist/fab/fab.js +53 -53
  30. package/dist/field/field.js +8 -8
  31. package/dist/file-uploader/file-uploader.js +19 -19
  32. package/dist/header-panel/header-panel.js +31 -31
  33. package/dist/hover-card/hover-card.js +21 -21
  34. package/dist/icon-button/icon-button.js +5 -5
  35. package/dist/index.d.ts +202 -194
  36. package/dist/input/input.js +22 -21
  37. package/dist/link/link.js +8 -6
  38. package/dist/log-viewer/log-viewer.js +26 -26
  39. package/dist/menu/menu.js +20 -20
  40. package/dist/menu-button/menu-button.js +48 -48
  41. package/dist/menubar/menubar.js +42 -42
  42. package/dist/modal/modal.css +1 -1
  43. package/dist/modal/modal.js +41 -35
  44. package/dist/modal/modal.module.js +8 -7
  45. package/dist/multi-select/multi-select.css +1 -1
  46. package/dist/multi-select/multi-select.js +57 -57
  47. package/dist/multi-select/multi-select.module.js +11 -11
  48. package/dist/native-select/native-select.js +13 -11
  49. package/dist/navigation-menu/navigation-menu.js +46 -46
  50. package/dist/node/accordion/accordion.js +46 -44
  51. package/dist/node/action-sheet/action-sheet.js +16 -16
  52. package/dist/node/alert-dialog/alert-dialog.js +34 -34
  53. package/dist/node/app-shell/app-shell.js +14 -12
  54. package/dist/node/app-shell/app-shell.module.js +8 -8
  55. package/dist/node/avatar-group/avatar-group.js +6 -6
  56. package/dist/node/bottom-sheet/bottom-sheet.js +18 -18
  57. package/dist/node/button/button.js +15 -12
  58. package/dist/node/button-group/button-group.js +8 -8
  59. package/dist/node/carousel/carousel.js +20 -20
  60. package/dist/node/checkbox/checkbox.js +21 -21
  61. package/dist/node/checkbox-card/checkbox-card.js +15 -13
  62. package/dist/node/collapsible/collapsible.js +7 -7
  63. package/dist/node/color-picker/color-picker.js +26 -26
  64. package/dist/node/combobox/combobox.js +86 -86
  65. package/dist/node/command-menu/command-menu.js +111 -111
  66. package/dist/node/comparison/comparison.js +10 -10
  67. package/dist/node/context-menu/context-menu.js +9 -9
  68. package/dist/node/copy-button/copy-button.js +18 -16
  69. package/dist/node/data-table/data-table.js +1 -1
  70. package/dist/node/date-picker/date-picker.js +25 -25
  71. package/dist/node/date-range-picker/date-range-picker.js +26 -26
  72. package/dist/node/drawer/drawer.js +18 -17
  73. package/dist/node/drawer/drawer.module.js +9 -9
  74. package/dist/node/dropdown/dropdown.js +48 -48
  75. package/dist/node/editable/editable.js +11 -11
  76. package/dist/node/fab/fab.js +53 -53
  77. package/dist/node/field/field.js +8 -8
  78. package/dist/node/file-uploader/file-uploader.js +19 -19
  79. package/dist/node/header-panel/header-panel.js +31 -31
  80. package/dist/node/hover-card/hover-card.js +21 -21
  81. package/dist/node/icon-button/icon-button.js +5 -5
  82. package/dist/node/input/input.js +22 -21
  83. package/dist/node/link/link.js +8 -6
  84. package/dist/node/log-viewer/log-viewer.js +26 -26
  85. package/dist/node/menu/menu.js +20 -20
  86. package/dist/node/menu-button/menu-button.js +48 -48
  87. package/dist/node/menubar/menubar.js +42 -42
  88. package/dist/node/modal/modal.js +41 -35
  89. package/dist/node/modal/modal.module.js +8 -7
  90. package/dist/node/multi-select/multi-select.js +57 -57
  91. package/dist/node/multi-select/multi-select.module.js +11 -11
  92. package/dist/node/native-select/native-select.js +13 -11
  93. package/dist/node/navigation-menu/navigation-menu.js +46 -46
  94. package/dist/node/notification/notification.js +26 -26
  95. package/dist/node/number-input/number-input.js +52 -50
  96. package/dist/node/otp-input/otp-input.js +8 -8
  97. package/dist/node/password-input/password-input.js +28 -27
  98. package/dist/node/popover/popover.js +26 -24
  99. package/dist/node/pull-to-refresh/pull-to-refresh.js +13 -13
  100. package/dist/node/radial-progress/radial-progress.js +5 -5
  101. package/dist/node/radio/radio.js +23 -22
  102. package/dist/node/radio-card/radio-card.js +27 -26
  103. package/dist/node/react/src/index.js +3 -3
  104. package/dist/node/react/src/theme.js +30 -19
  105. package/dist/node/resizable/resizable.js +11 -11
  106. package/dist/node/scroll-area/scroll-area.js +4 -4
  107. package/dist/node/search/search.js +49 -49
  108. package/dist/node/select/select.js +27 -26
  109. package/dist/node/sheet/sheet.js +11 -10
  110. package/dist/node/sheet/sheet.module.js +5 -5
  111. package/dist/node/side-nav/side-nav.js +91 -91
  112. package/dist/node/skip-nav/skip-nav.js +12 -12
  113. package/dist/node/slider/slider.js +13 -11
  114. package/dist/node/structured-list/structured-list.js +23 -23
  115. package/dist/node/tabs/tabs.js +49 -47
  116. package/dist/node/tags-input/tags-input.js +35 -35
  117. package/dist/node/textarea/textarea.js +22 -21
  118. package/dist/node/time-picker/time-picker.js +22 -21
  119. package/dist/node/toast/toast.js +15 -15
  120. package/dist/node/toc/toc.js +8 -8
  121. package/dist/node/toggle/toggle.js +15 -13
  122. package/dist/node/toggle-group/toggle-group.js +10 -10
  123. package/dist/node/toggletip/toggletip.js +9 -9
  124. package/dist/node/tooltip/tooltip.js +5 -5
  125. package/dist/node/tree-view/tree-view.js +32 -32
  126. package/dist/notification/notification.js +26 -26
  127. package/dist/number-input/number-input.js +52 -50
  128. package/dist/otp-input/otp-input.js +8 -8
  129. package/dist/password-input/password-input.js +28 -27
  130. package/dist/popover/popover.js +26 -24
  131. package/dist/pull-to-refresh/pull-to-refresh.js +13 -13
  132. package/dist/radial-progress/radial-progress.js +5 -5
  133. package/dist/radio/radio.js +23 -22
  134. package/dist/radio-card/radio-card.js +27 -26
  135. package/dist/react/src/index.js +3 -3
  136. package/dist/react/src/theme.js +30 -19
  137. package/dist/resizable/resizable.js +11 -11
  138. package/dist/scroll-area/scroll-area.js +4 -4
  139. package/dist/search/search.js +49 -49
  140. package/dist/select/select.js +27 -26
  141. package/dist/sheet/sheet.css +1 -1
  142. package/dist/sheet/sheet.js +11 -10
  143. package/dist/sheet/sheet.module.js +5 -5
  144. package/dist/side-nav/side-nav.js +91 -91
  145. package/dist/skip-nav/skip-nav.js +12 -12
  146. package/dist/slider/slider.js +13 -11
  147. package/dist/structured-list/structured-list.js +23 -23
  148. package/dist/styles.css +55 -5
  149. package/dist/tabs/tabs.js +49 -47
  150. package/dist/tags-input/tags-input.js +35 -35
  151. package/dist/textarea/textarea.js +22 -21
  152. package/dist/time-picker/time-picker.js +22 -21
  153. package/dist/toast/toast.js +15 -15
  154. package/dist/toc/toc.js +8 -8
  155. package/dist/toggle/toggle.js +15 -13
  156. package/dist/toggle-group/toggle-group.js +10 -10
  157. package/dist/toggletip/toggletip.js +9 -9
  158. package/dist/tooltip/tooltip.js +5 -5
  159. package/dist/tree-view/tree-view.js +32 -32
  160. package/package.json +10 -4
@@ -2,9 +2,9 @@
2
2
 
3
3
  import e from "./toggletip.module.js";
4
4
  import { DismissableLayer as t, cn as n, useAnchorPosition as r, useControllableSignal 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
- import { useId as u, useRef as d } from "react";
5
+ import { useId as o, useRef as s } from "react";
6
+ import { builtin as c, t as l } from "@cascivo/i18n";
7
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
8
8
  //#region ../components/src/toggletip/toggletip.tsx
9
9
  function f({ trigger: f, children: p, placement: m = "top", defaultOpen: h = !1, open: g, onOpenChange: _, labels: v, className: y }) {
10
10
  a();
@@ -12,27 +12,27 @@ function f({ trigger: f, children: p, placement: m = "top", defaultOpen: h = !1,
12
12
  ...g !== void 0 && { value: g },
13
13
  defaultValue: h,
14
14
  ..._ && { onChange: _ }
15
- }), S = d(null), C = d(null), w = u(), { anchorStyle: T, floatingStyle: E } = r({
15
+ }), S = s(null), C = s(null), w = o(), { anchorStyle: T, floatingStyle: E } = r({
16
16
  anchorRef: S,
17
17
  floatingRef: C,
18
18
  placement: m,
19
19
  enabled: b
20
20
  });
21
- return /* @__PURE__ */ l("span", {
21
+ return /* @__PURE__ */ d("span", {
22
22
  className: n(e.root, y),
23
- children: [/* @__PURE__ */ c("button", {
23
+ children: [/* @__PURE__ */ u("button", {
24
24
  ref: S,
25
25
  type: "button",
26
26
  className: e.trigger,
27
27
  "aria-expanded": b.value,
28
28
  "aria-controls": w,
29
- "aria-label": v?.label ?? s(o.toggletip.label),
29
+ "aria-label": v?.label ?? l(c.toggletip.label),
30
30
  style: T,
31
31
  onClick: () => x(!b.value),
32
32
  children: f
33
- }), b.value ? /* @__PURE__ */ c(t, {
33
+ }), b.value ? /* @__PURE__ */ u(t, {
34
34
  onDismiss: () => x(!1),
35
- children: /* @__PURE__ */ c("div", {
35
+ children: /* @__PURE__ */ u("div", {
36
36
  ref: C,
37
37
  id: w,
38
38
  role: "status",
@@ -2,8 +2,8 @@
2
2
 
3
3
  import e from "./tooltip.module.js";
4
4
  import { createMachine as t, useId as n, useMachine as r, useSignalEffect as i, useSignals as a } from "@cascivo/core";
5
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
- import { cloneElement as c, useRef as l } from "react";
5
+ import { cloneElement as o, useRef as s } from "react";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
7
  //#region ../components/src/tooltip/tooltip.tsx
8
8
  var u = t({
9
9
  initial: "hidden",
@@ -14,7 +14,7 @@ var u = t({
14
14
  });
15
15
  function d({ content: t, placement: d = "top", children: f, delay: p = 200 }) {
16
16
  a();
17
- let [m, h] = r(u), g = n("cascivo-tooltip"), _ = n("cascivo-anchor"), v = l(void 0), y = l(null), b = m.value === "visible", x = () => {
17
+ let [m, h] = r(u), g = n("cascivo-tooltip"), _ = n("cascivo-anchor"), v = s(void 0), y = s(null), b = m.value === "visible", x = () => {
18
18
  clearTimeout(v.current), v.current = setTimeout(() => h("SHOW"), p);
19
19
  }, S = () => {
20
20
  clearTimeout(v.current), h("HIDE");
@@ -39,9 +39,9 @@ function d({ content: t, placement: d = "top", children: f, delay: p = 200 }) {
39
39
  },
40
40
  "aria-describedby": b ? g : w["aria-describedby"]
41
41
  };
42
- return /* @__PURE__ */ s("span", {
42
+ return /* @__PURE__ */ l("span", {
43
43
  className: e.root,
44
- children: [c(C, T), /* @__PURE__ */ o("span", {
44
+ children: [o(C, T), /* @__PURE__ */ c("span", {
45
45
  ref: y,
46
46
  popover: "manual",
47
47
  role: "tooltip",
@@ -2,9 +2,9 @@
2
2
 
3
3
  import e from "./tree-view.module.js";
4
4
  import { cn as t, useControllableSignal as n, useSignal as r, useSignals as i } from "@cascivo/core";
5
- import { builtin as a, t as o } from "@cascivo/i18n";
6
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
- import { useRef as l } from "react";
5
+ import { useRef as a } from "react";
6
+ import { builtin as o, t as s } from "@cascivo/i18n";
7
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
8
  //#region ../components/src/tree-view/tree-view.tsx
9
9
  function u(e, t) {
10
10
  let n = [], r = (e, i, a) => {
@@ -24,17 +24,17 @@ function u(e, t) {
24
24
  function d(e) {
25
25
  return e === void 0 ? [] : Array.isArray(e) ? e : e === "" ? [] : [e];
26
26
  }
27
- function f({ items: a, selectionMode: o = "single", selected: c, defaultSelected: f, onSelectChange: h, expanded: g, defaultExpanded: _, onExpandedChange: v, className: y, "aria-label": b }) {
27
+ function f({ items: o, selectionMode: s = "single", selected: l, defaultSelected: f, onSelectChange: h, expanded: g, defaultExpanded: _, onExpandedChange: v, className: y, "aria-label": b }) {
28
28
  i();
29
29
  let [x, S] = n({
30
30
  value: g,
31
31
  defaultValue: _ ?? [],
32
32
  onChange: v
33
33
  }), [C, w] = n({
34
- value: c,
35
- defaultValue: f ?? (o === "multi" ? [] : ""),
34
+ value: l,
35
+ defaultValue: f ?? (s === "multi" ? [] : ""),
36
36
  onChange: h
37
- }), T = r(null), E = l(/* @__PURE__ */ new Map()), D = new Set(x.value), O = u(a, D), k = new Map(O.map((e, t) => [e.id, t])), A = d(C.value), j = new Set(A), M = T.value ?? A[0] ?? O[0]?.id ?? null, N = (e) => S([...e]), P = (e) => {
37
+ }), T = r(null), E = a(/* @__PURE__ */ new Map()), D = new Set(x.value), O = u(o, D), k = new Map(O.map((e, t) => [e.id, t])), A = d(C.value), j = new Set(A), M = T.value ?? A[0] ?? O[0]?.id ?? null, N = (e) => S([...e]), P = (e) => {
38
38
  if (D.has(e)) return;
39
39
  let t = new Set(D);
40
40
  t.add(e), N(t);
@@ -45,17 +45,17 @@ function f({ items: a, selectionMode: o = "single", selected: c, defaultSelected
45
45
  }, I = (e) => {
46
46
  T.value = e, E.current.get(e)?.focus();
47
47
  }, L = (e) => {
48
- if (o === "multi") {
48
+ if (s === "multi") {
49
49
  let t = new Set(j);
50
50
  t.has(e) ? t.delete(e) : t.add(e), w([...t]);
51
51
  } else w(e);
52
- }, R = l({
52
+ }, R = a({
53
53
  buffer: "",
54
54
  at: 0
55
55
  }), z = (e, t) => {
56
56
  let n = k.get(t.id);
57
57
  if (n === void 0) return;
58
- let { hasChildren: r, level: i, parentId: o, expanded: s } = O[n];
58
+ let { hasChildren: r, level: i, parentId: a, expanded: s } = O[n];
59
59
  switch (e.key) {
60
60
  case "ArrowDown": {
61
61
  e.preventDefault();
@@ -77,7 +77,7 @@ function f({ items: a, selectionMode: o = "single", selected: c, defaultSelected
77
77
  }
78
78
  break;
79
79
  case "ArrowLeft":
80
- e.preventDefault(), r && s ? F(t.id) : o && I(o);
80
+ e.preventDefault(), r && s ? F(t.id) : a && I(a);
81
81
  break;
82
82
  case "Home":
83
83
  e.preventDefault(), O[0] && I(O[0].id);
@@ -96,17 +96,17 @@ function f({ items: a, selectionMode: o = "single", selected: c, defaultSelected
96
96
  if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) {
97
97
  let t = R.current, r = Date.now();
98
98
  t.buffer = r - t.at > 500 ? e.key : t.buffer + e.key, t.at = r;
99
- let i = t.buffer.toLowerCase(), o = (e) => typeof e.label == "string" && e.label.toLowerCase().startsWith(i), s = p(a, D), c = [...O.slice(n + 1), ...O.slice(0, n + 1)].find((e) => {
99
+ let i = t.buffer.toLowerCase(), a = (e) => typeof e.label == "string" && e.label.toLowerCase().startsWith(i), s = p(o, D), c = [...O.slice(n + 1), ...O.slice(0, n + 1)].find((e) => {
100
100
  let t = s.get(e.id);
101
- return t ? o(t) : !1;
101
+ return t ? a(t) : !1;
102
102
  });
103
103
  c && I(c.id);
104
104
  }
105
105
  break;
106
106
  }
107
107
  }, B = (e, t, n, r) => {
108
- let i = !!e.children && e.children.length > 0, a = D.has(e.id), o = j.has(e.id), c = M === e.id, l = e.children?.length ?? 0;
109
- return /* @__PURE__ */ s(m, {
108
+ let i = !!e.children && e.children.length > 0, a = D.has(e.id), o = j.has(e.id), s = M === e.id, l = e.children?.length ?? 0;
109
+ return /* @__PURE__ */ c(m, {
110
110
  node: e,
111
111
  level: t,
112
112
  posInSet: n,
@@ -114,7 +114,7 @@ function f({ items: a, selectionMode: o = "single", selected: c, defaultSelected
114
114
  hasChildren: i,
115
115
  isExpanded: a,
116
116
  isSelected: o,
117
- isTabbable: c,
117
+ isTabbable: s,
118
118
  itemRefs: E,
119
119
  onFocusNode: () => T.value = e.id,
120
120
  onKeyDown: (t) => z(t, e),
@@ -124,11 +124,11 @@ function f({ items: a, selectionMode: o = "single", selected: c, defaultSelected
124
124
  children: i && e.children.map((e, n) => B(e, t + 1, n + 1, l))
125
125
  }, e.id);
126
126
  };
127
- return /* @__PURE__ */ s("ul", {
127
+ return /* @__PURE__ */ c("ul", {
128
128
  role: "tree",
129
129
  "aria-label": b,
130
130
  className: t(e.tree, y),
131
- children: a.map((e, t) => B(e, 1, t + 1, a.length))
131
+ children: o.map((e, t) => B(e, 1, t + 1, o.length))
132
132
  });
133
133
  }
134
134
  function p(e, t) {
@@ -137,16 +137,16 @@ function p(e, t) {
137
137
  };
138
138
  return r(e), n;
139
139
  }
140
- function m({ node: t, level: n, posInSet: r, setSize: i, hasChildren: a, isExpanded: o, isSelected: l, isTabbable: u, itemRefs: d, onFocusNode: f, onKeyDown: p, onActivate: m, children: h }) {
141
- return /* @__PURE__ */ c("li", {
140
+ function m({ node: t, level: n, posInSet: r, setSize: i, hasChildren: a, isExpanded: o, isSelected: s, isTabbable: u, itemRefs: d, onFocusNode: f, onKeyDown: p, onActivate: m, children: h }) {
141
+ return /* @__PURE__ */ l("li", {
142
142
  role: "treeitem",
143
143
  "aria-level": n,
144
144
  "aria-posinset": r,
145
145
  "aria-setsize": i,
146
- "aria-selected": l,
146
+ "aria-selected": s,
147
147
  "aria-expanded": a ? o : void 0,
148
148
  tabIndex: u ? 0 : -1,
149
- "data-selected": l || void 0,
149
+ "data-selected": s || void 0,
150
150
  "data-state": a ? o ? "open" : "closed" : void 0,
151
151
  style: { "--cascivo-tree-level": n },
152
152
  className: e.item,
@@ -160,31 +160,31 @@ function m({ node: t, level: n, posInSet: r, setSize: i, hasChildren: a, isExpan
160
160
  onClick: (e) => {
161
161
  e.stopPropagation(), m();
162
162
  },
163
- children: [/* @__PURE__ */ c("span", {
163
+ children: [/* @__PURE__ */ l("span", {
164
164
  className: e.row,
165
165
  children: [
166
- a ? /* @__PURE__ */ s("span", {
166
+ a ? /* @__PURE__ */ c("span", {
167
167
  className: e.twisty,
168
168
  "aria-hidden": "true",
169
169
  "data-state": o ? "open" : "closed"
170
- }) : /* @__PURE__ */ s("span", {
170
+ }) : /* @__PURE__ */ c("span", {
171
171
  className: e.twistySpacer,
172
172
  "aria-hidden": "true"
173
173
  }),
174
- t.icon && /* @__PURE__ */ s("span", {
174
+ t.icon && /* @__PURE__ */ c("span", {
175
175
  className: e.icon,
176
176
  "aria-hidden": "true",
177
177
  children: t.icon
178
178
  }),
179
- /* @__PURE__ */ s("span", {
179
+ /* @__PURE__ */ c("span", {
180
180
  className: e.label,
181
181
  children: t.label
182
182
  })
183
183
  ]
184
- }), a && /* @__PURE__ */ s("div", {
184
+ }), a && /* @__PURE__ */ c("div", {
185
185
  className: e.groupWrap,
186
186
  "data-state": o ? "open" : "closed",
187
- children: /* @__PURE__ */ s("ul", {
187
+ children: /* @__PURE__ */ c("ul", {
188
188
  role: "group",
189
189
  className: e.group,
190
190
  children: h
@@ -193,9 +193,9 @@ function m({ node: t, level: n, posInSet: r, setSize: i, hasChildren: a, isExpan
193
193
  });
194
194
  }
195
195
  var h = {
196
- loading: () => o(a.treeView.loading),
197
- expand: () => o(a.treeView.expand),
198
- collapse: () => o(a.treeView.collapse)
196
+ loading: () => s(o.treeView.loading),
197
+ expand: () => s(o.treeView.expand),
198
+ collapse: () => s(o.treeView.collapse)
199
199
  };
200
200
  //#endregion
201
201
  export { f as TreeView, h as treeViewMessages };
@@ -2,9 +2,9 @@
2
2
 
3
3
  import e from "./notification.module.js";
4
4
  import { Presence as t, cn as n, normalizeTone 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
- import { useRef as u } from "react";
5
+ import { useRef as o } from "react";
6
+ import { builtin as s, t as c } from "@cascivo/i18n";
7
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
8
8
  //#region ../components/src/notification/notification.tsx
9
9
  var d = {
10
10
  neutral: "neutral",
@@ -14,73 +14,73 @@ var d = {
14
14
  danger: "error"
15
15
  }, f = new Set(["warning", "error"]), p = 160;
16
16
  function m({ variant: e }) {
17
- return e === "success" ? /* @__PURE__ */ l("svg", {
17
+ return e === "success" ? /* @__PURE__ */ u("svg", {
18
18
  viewBox: "0 0 20 20",
19
19
  width: "20",
20
20
  height: "20",
21
21
  fill: "none",
22
22
  "aria-hidden": "true",
23
- children: [/* @__PURE__ */ c("circle", {
23
+ children: [/* @__PURE__ */ l("circle", {
24
24
  cx: "10",
25
25
  cy: "10",
26
26
  r: "8",
27
27
  stroke: "currentColor",
28
28
  strokeWidth: "1.5"
29
- }), /* @__PURE__ */ c("path", {
29
+ }), /* @__PURE__ */ l("path", {
30
30
  d: "M6.5 10.5l2.5 2.5 4.5-5",
31
31
  stroke: "currentColor",
32
32
  strokeWidth: "1.5",
33
33
  strokeLinecap: "round",
34
34
  strokeLinejoin: "round"
35
35
  })]
36
- }) : e === "warning" ? /* @__PURE__ */ l("svg", {
36
+ }) : e === "warning" ? /* @__PURE__ */ u("svg", {
37
37
  viewBox: "0 0 20 20",
38
38
  width: "20",
39
39
  height: "20",
40
40
  fill: "none",
41
41
  "aria-hidden": "true",
42
- children: [/* @__PURE__ */ c("path", {
42
+ children: [/* @__PURE__ */ l("path", {
43
43
  d: "M10 2.5L18.5 17H1.5L10 2.5z",
44
44
  stroke: "currentColor",
45
45
  strokeWidth: "1.5",
46
46
  strokeLinejoin: "round"
47
- }), /* @__PURE__ */ c("path", {
47
+ }), /* @__PURE__ */ l("path", {
48
48
  d: "M10 8v3.5M10 14h.01",
49
49
  stroke: "currentColor",
50
50
  strokeWidth: "1.5",
51
51
  strokeLinecap: "round"
52
52
  })]
53
- }) : e === "error" ? /* @__PURE__ */ l("svg", {
53
+ }) : e === "error" ? /* @__PURE__ */ u("svg", {
54
54
  viewBox: "0 0 20 20",
55
55
  width: "20",
56
56
  height: "20",
57
57
  fill: "none",
58
58
  "aria-hidden": "true",
59
- children: [/* @__PURE__ */ c("circle", {
59
+ children: [/* @__PURE__ */ l("circle", {
60
60
  cx: "10",
61
61
  cy: "10",
62
62
  r: "8",
63
63
  stroke: "currentColor",
64
64
  strokeWidth: "1.5"
65
- }), /* @__PURE__ */ c("path", {
65
+ }), /* @__PURE__ */ l("path", {
66
66
  d: "M10 6v4.5M10 13.5h.01",
67
67
  stroke: "currentColor",
68
68
  strokeWidth: "1.5",
69
69
  strokeLinecap: "round"
70
70
  })]
71
- }) : /* @__PURE__ */ l("svg", {
71
+ }) : /* @__PURE__ */ u("svg", {
72
72
  viewBox: "0 0 20 20",
73
73
  width: "20",
74
74
  height: "20",
75
75
  fill: "none",
76
76
  "aria-hidden": "true",
77
- children: [/* @__PURE__ */ c("circle", {
77
+ children: [/* @__PURE__ */ l("circle", {
78
78
  cx: "10",
79
79
  cy: "10",
80
80
  r: "8",
81
81
  stroke: "currentColor",
82
82
  strokeWidth: "1.5"
83
- }), /* @__PURE__ */ c("path", {
83
+ }), /* @__PURE__ */ l("path", {
84
84
  d: "M10 9v5M10 6.5h.01",
85
85
  stroke: "currentColor",
86
86
  strokeWidth: "1.5",
@@ -90,45 +90,45 @@ function m({ variant: e }) {
90
90
  }
91
91
  function h({ title: h, description: g, variant: _ = "info", dismissible: v = !1, onDismiss: y, actions: b, icon: x, labels: S, className: C, ...w }) {
92
92
  a();
93
- let T = d[r(_)] ?? _, E = i(!0), D = u(y);
93
+ let T = d[r(_)] ?? _, E = i(!0), D = o(y);
94
94
  D.current = y;
95
95
  let O = v || y !== void 0, k = () => {
96
96
  E.value = !1, setTimeout(() => D.current?.(), p);
97
97
  };
98
- return /* @__PURE__ */ c(t, {
98
+ return /* @__PURE__ */ l(t, {
99
99
  present: E,
100
- children: /* @__PURE__ */ l("div", {
100
+ children: /* @__PURE__ */ u("div", {
101
101
  role: f.has(T) ? "alert" : "status",
102
102
  "data-variant": T,
103
103
  className: n(e.notification, C),
104
104
  ...w,
105
105
  children: [
106
- /* @__PURE__ */ c("span", {
106
+ /* @__PURE__ */ l("span", {
107
107
  className: e.icon,
108
108
  "aria-hidden": "true",
109
- children: x ?? /* @__PURE__ */ c(m, { variant: T })
109
+ children: x ?? /* @__PURE__ */ l(m, { variant: T })
110
110
  }),
111
- /* @__PURE__ */ l("div", {
111
+ /* @__PURE__ */ u("div", {
112
112
  className: e.body,
113
113
  children: [
114
- /* @__PURE__ */ c("div", {
114
+ /* @__PURE__ */ l("div", {
115
115
  className: e.title,
116
116
  children: h
117
117
  }),
118
- g && /* @__PURE__ */ c("div", {
118
+ g && /* @__PURE__ */ l("div", {
119
119
  className: e.description,
120
120
  children: g
121
121
  }),
122
- b && /* @__PURE__ */ c("div", {
122
+ b && /* @__PURE__ */ l("div", {
123
123
  className: e.actions,
124
124
  children: b
125
125
  })
126
126
  ]
127
127
  }),
128
- O && /* @__PURE__ */ c("button", {
128
+ O && /* @__PURE__ */ l("button", {
129
129
  type: "button",
130
130
  className: e.dismiss,
131
- "aria-label": S?.dismiss ?? s(o.notification.dismiss),
131
+ "aria-label": S?.dismiss ?? c(s.notification.dismiss),
132
132
  onClick: k,
133
133
  children: "✕"
134
134
  })
@@ -2,99 +2,101 @@
2
2
 
3
3
  import e from "./number-input.module.js";
4
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";
5
+ import { forwardRef as o } from "react";
6
+ import { builtin as s, t as c } from "@cascivo/i18n";
7
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
7
8
  //#region ../components/src/number-input/number-input.tsx
8
- var u = n({
9
+ var d = n({
9
10
  initial: "idle",
10
11
  states: {
11
12
  idle: { on: { FOCUS: "focused" } },
12
13
  focused: { on: { BLUR: "idle" } }
13
14
  }
14
15
  });
15
- function d(e, t, n) {
16
+ function f(e, t, n) {
16
17
  let r = e;
17
18
  return t !== void 0 && (r = Math.max(r, t)), n !== void 0 && (r = Math.min(r, n)), r;
18
19
  }
19
- function f(e) {
20
+ function p(e) {
20
21
  let t = String(e), n = t.indexOf(".");
21
22
  return n === -1 ? 0 : t.length - n - 1;
22
23
  }
23
- function p(e, t) {
24
+ function m(e, t) {
24
25
  let n = 10 ** t;
25
26
  return Math.round(e * n) / n;
26
27
  }
27
- function m(e) {
28
+ function h(e) {
28
29
  let t = e.trim();
29
30
  if (t === "") return null;
30
31
  let n = Number(t);
31
32
  return Number.isFinite(n) ? n : null;
32
33
  }
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
+ var g = o(function({ value: n, defaultValue: o, 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 }, I) {
34
35
  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", {
36
+ let L = O ?? c(s.numberInput.increment), R = k ?? c(s.numberInput.decrement), [z, B] = r(d), V = n !== void 0, H = i(o ?? null), U = i(""), W = V ? n : H.value, G = j ?? (C ? `cascade-number-input-${C.toLowerCase().replace(/\s+/g, "-")}` : void 0), K = (e) => {
37
+ V || (H.value = e), U.value = e == null ? "" : String(e), e !== W && (g ?? _)?.(e);
38
+ }, q = () => {
39
+ let e = h(U.value);
40
+ e != null && (e = f(e, v, y), x !== void 0 && (e = m(e, x))), K(e);
41
+ }, J = (e) => {
42
+ let t = (z.value === "focused" ? h(U.value) : W) ?? 0, n = x ?? Math.max(p(b), p(t));
43
+ K(f(m(t + e * b, n), v, y));
44
+ }, Y = z.value === "focused" ? U.value : ((e) => e == null ? "" : S ? new Intl.NumberFormat(void 0, S).format(e) : String(e))(W), X = W != null && y !== void 0 && W >= y, Z = W != null && v !== void 0 && W <= v;
45
+ return /* @__PURE__ */ u("div", {
45
46
  className: t(e.wrapper, A),
46
- "data-state": T ? "error" : R.value,
47
+ "data-state": T ? "error" : z.value,
47
48
  "data-size": E,
48
49
  children: [
49
- C && /* @__PURE__ */ c("label", {
50
+ C && /* @__PURE__ */ l("label", {
50
51
  className: e.label,
51
- htmlFor: W,
52
+ htmlFor: G,
52
53
  children: C
53
54
  }),
54
- /* @__PURE__ */ l("div", {
55
+ /* @__PURE__ */ u("div", {
55
56
  className: e.field,
56
- children: [/* @__PURE__ */ c("input", {
57
- id: W,
57
+ children: [/* @__PURE__ */ l("input", {
58
+ id: G,
58
59
  type: "text",
59
60
  inputMode: "decimal",
60
61
  autoComplete: "off",
61
62
  role: "spinbutton",
62
63
  className: e.input,
63
- value: J,
64
+ value: Y,
64
65
  disabled: D,
65
- "aria-valuenow": U ?? void 0,
66
+ "aria-valuenow": W ?? void 0,
66
67
  "aria-valuemin": v,
67
68
  "aria-valuemax": y,
68
69
  "aria-invalid": T ? !0 : void 0,
69
- "aria-describedby": T ? `${W}-error` : w ? `${W}-hint` : void 0,
70
+ "aria-describedby": T ? `${G}-error` : w ? `${G}-hint` : void 0,
70
71
  onChange: (e) => {
71
- H.value = e.target.value;
72
+ U.value = e.target.value;
72
73
  },
73
74
  onFocus: (e) => {
74
- H.value = U == null ? "" : String(U), z("FOCUS"), M?.(e);
75
+ U.value = W == null ? "" : String(W), B("FOCUS"), M?.(e);
75
76
  },
76
77
  onBlur: (e) => {
77
- K(), z("BLUR"), N?.(e);
78
+ q(), B("BLUR"), N?.(e);
78
79
  },
79
80
  onKeyDown: (e) => {
80
- e.key === "ArrowUp" ? (e.preventDefault(), q(1)) : e.key === "ArrowDown" ? (e.preventDefault(), q(-1)) : e.key === "Enter" && K(), P?.(e);
81
+ e.key === "ArrowUp" ? (e.preventDefault(), J(1)) : e.key === "ArrowDown" ? (e.preventDefault(), J(-1)) : e.key === "Enter" && q(), P?.(e);
81
82
  },
83
+ ref: I,
82
84
  ...F
83
- }), /* @__PURE__ */ l("div", {
85
+ }), /* @__PURE__ */ u("div", {
84
86
  className: e.steppers,
85
- children: [/* @__PURE__ */ c("button", {
87
+ children: [/* @__PURE__ */ l("button", {
86
88
  type: "button",
87
89
  className: e.stepper,
88
- "aria-label": I,
90
+ "aria-label": L,
89
91
  tabIndex: -1,
90
- disabled: D || Y,
92
+ disabled: D || X,
91
93
  onMouseDown: (e) => e.preventDefault(),
92
- onClick: () => q(1),
93
- children: /* @__PURE__ */ c("svg", {
94
+ onClick: () => J(1),
95
+ children: /* @__PURE__ */ l("svg", {
94
96
  viewBox: "0 0 10 10",
95
97
  "aria-hidden": "true",
96
98
  focusable: "false",
97
- children: /* @__PURE__ */ c("path", {
99
+ children: /* @__PURE__ */ l("path", {
98
100
  d: "M2 6.5 5 3.5 8 6.5",
99
101
  fill: "none",
100
102
  stroke: "currentColor",
@@ -103,19 +105,19 @@ function h({ value: n, defaultValue: h, onValueChange: g, onChange: _, min: v, m
103
105
  strokeLinejoin: "round"
104
106
  })
105
107
  })
106
- }), /* @__PURE__ */ c("button", {
108
+ }), /* @__PURE__ */ l("button", {
107
109
  type: "button",
108
110
  className: e.stepper,
109
- "aria-label": L,
111
+ "aria-label": R,
110
112
  tabIndex: -1,
111
- disabled: D || X,
113
+ disabled: D || Z,
112
114
  onMouseDown: (e) => e.preventDefault(),
113
- onClick: () => q(-1),
114
- children: /* @__PURE__ */ c("svg", {
115
+ onClick: () => J(-1),
116
+ children: /* @__PURE__ */ l("svg", {
115
117
  viewBox: "0 0 10 10",
116
118
  "aria-hidden": "true",
117
119
  focusable: "false",
118
- children: /* @__PURE__ */ c("path", {
120
+ children: /* @__PURE__ */ l("path", {
119
121
  d: "M2 3.5 5 6.5 8 3.5",
120
122
  fill: "none",
121
123
  stroke: "currentColor",
@@ -127,19 +129,19 @@ function h({ value: n, defaultValue: h, onValueChange: g, onChange: _, min: v, m
127
129
  })]
128
130
  })]
129
131
  }),
130
- T && /* @__PURE__ */ c("span", {
131
- id: `${W}-error`,
132
+ T && /* @__PURE__ */ l("span", {
133
+ id: `${G}-error`,
132
134
  className: e.error,
133
135
  role: "alert",
134
136
  children: T
135
137
  }),
136
- !T && w && /* @__PURE__ */ c("span", {
137
- id: `${W}-hint`,
138
+ !T && w && /* @__PURE__ */ l("span", {
139
+ id: `${G}-hint`,
138
140
  className: e.hint,
139
141
  children: w
140
142
  })
141
143
  ]
142
144
  });
143
- }
145
+ });
144
146
  //#endregion
145
- export { h as NumberInput };
147
+ export { g as NumberInput };
@@ -2,13 +2,13 @@
2
2
 
3
3
  import e from "./otp-input.module.js";
4
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";
5
+ import { useRef as i } from "react";
6
+ import { builtin as a, t as o } from "@cascivo/i18n";
7
+ import { jsx as s } from "react/jsx-runtime";
8
8
  //#region ../components/src/otp-input/otp-input.tsx
9
9
  function c({ length: c = 6, value: l, onValueChange: u, disabled: d = !1, type: f = "numeric", className: p, ...m }) {
10
10
  r();
11
- let h = n(Array.from({ length: c }, (e, t) => l[t] ?? "")), g = s([]), _ = Array.from({ length: c }, (e, t) => l[t] ?? "");
11
+ let h = n(Array.from({ length: c }, (e, t) => l[t] ?? "")), g = i([]), _ = Array.from({ length: c }, (e, t) => l[t] ?? "");
12
12
  JSON.stringify(h.value) !== JSON.stringify(_) && (h.value = _);
13
13
  function v(e) {
14
14
  u(e.join("")), h.value = e;
@@ -37,13 +37,13 @@ function c({ length: c = 6, value: l, onValueChange: u, disabled: d = !1, type:
37
37
  for (let t = 0; t < n.length; t++) e + t < c && (r[e + t] = n[t] ?? "");
38
38
  v(r), y(Math.min(e + n.length, c - 1));
39
39
  }
40
- let C = a(i.otpInput.label);
41
- return /* @__PURE__ */ o("div", {
40
+ let C = o(a.otpInput.label);
41
+ return /* @__PURE__ */ s("div", {
42
42
  className: t(e.wrapper, p),
43
43
  role: "group",
44
44
  "aria-label": C,
45
45
  ...m,
46
- children: h.value.map((t, n) => /* @__PURE__ */ o("input", {
46
+ children: h.value.map((t, n) => /* @__PURE__ */ s("input", {
47
47
  ref: (e) => {
48
48
  g.current[n] = e;
49
49
  },
@@ -52,7 +52,7 @@ function c({ length: c = 6, value: l, onValueChange: u, disabled: d = !1, type:
52
52
  className: e.slot,
53
53
  value: t,
54
54
  maxLength: 1,
55
- "aria-label": a(i.otpInput.digit, { n: String(n + 1) }),
55
+ "aria-label": o(a.otpInput.digit, { n: String(n + 1) }),
56
56
  autoComplete: n === 0 ? "one-time-code" : "off",
57
57
  disabled: d,
58
58
  "data-filled": t ? "" : void 0,