@cascivo/react 0.7.1 → 0.9.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.
@@ -30,66 +30,66 @@ function m(e) {
30
30
  let n = Number(t);
31
31
  return Number.isFinite(n) ? n : null;
32
32
  }
33
- function h({ value: n, defaultValue: h, onChange: g, min: _, max: v, step: y = 1, precision: b, formatOptions: x, label: S, hint: C, error: w, size: T = "md", disabled: E, incrementLabel: D, decrementLabel: O, className: k, id: A, onFocus: j, onBlur: M, onKeyDown: N, ...P }) {
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
34
  a();
35
- let F = D ?? s(o.numberInput.increment), I = O ?? s(o.numberInput.decrement), [L, R] = r(u), z = n !== void 0, B = i(h ?? null), V = i(""), H = z ? n : B.value, U = A ?? (S ? `cascade-number-input-${S.toLowerCase().replace(/\s+/g, "-")}` : void 0), W = (e) => {
36
- z || (B.value = e), V.value = e == null ? "" : String(e), e !== H && g?.(e);
37
- }, G = () => {
38
- let e = m(V.value);
39
- e != null && (e = d(e, _, v), b !== void 0 && (e = p(e, b))), W(e);
40
- }, K = (e) => {
41
- let t = (L.value === "focused" ? m(V.value) : H) ?? 0, n = b ?? Math.max(f(y), f(t));
42
- W(d(p(t + e * y, n), _, v));
43
- }, q = L.value === "focused" ? V.value : ((e) => e == null ? "" : x ? new Intl.NumberFormat(void 0, x).format(e) : String(e))(H), J = H != null && v !== void 0 && H >= v, Y = H != null && _ !== void 0 && H <= _;
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
44
  return /* @__PURE__ */ l("div", {
45
- className: t(e.wrapper, k),
46
- "data-state": w ? "error" : L.value,
47
- "data-size": T,
45
+ className: t(e.wrapper, A),
46
+ "data-state": T ? "error" : R.value,
47
+ "data-size": E,
48
48
  children: [
49
- S && /* @__PURE__ */ c("label", {
49
+ C && /* @__PURE__ */ c("label", {
50
50
  className: e.label,
51
- htmlFor: U,
52
- children: S
51
+ htmlFor: W,
52
+ children: C
53
53
  }),
54
54
  /* @__PURE__ */ l("div", {
55
55
  className: e.field,
56
56
  children: [/* @__PURE__ */ c("input", {
57
- id: U,
57
+ id: W,
58
58
  type: "text",
59
59
  inputMode: "decimal",
60
60
  autoComplete: "off",
61
61
  role: "spinbutton",
62
62
  className: e.input,
63
- value: q,
64
- disabled: E,
65
- "aria-valuenow": H ?? void 0,
66
- "aria-valuemin": _,
67
- "aria-valuemax": v,
68
- "aria-invalid": w ? !0 : void 0,
69
- "aria-describedby": w ? `${U}-error` : C ? `${U}-hint` : void 0,
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
70
  onChange: (e) => {
71
- V.value = e.target.value;
71
+ H.value = e.target.value;
72
72
  },
73
73
  onFocus: (e) => {
74
- V.value = H == null ? "" : String(H), R("FOCUS"), j?.(e);
74
+ H.value = U == null ? "" : String(U), z("FOCUS"), M?.(e);
75
75
  },
76
76
  onBlur: (e) => {
77
- G(), R("BLUR"), M?.(e);
77
+ K(), z("BLUR"), N?.(e);
78
78
  },
79
79
  onKeyDown: (e) => {
80
- e.key === "ArrowUp" ? (e.preventDefault(), K(1)) : e.key === "ArrowDown" ? (e.preventDefault(), K(-1)) : e.key === "Enter" && G(), N?.(e);
80
+ e.key === "ArrowUp" ? (e.preventDefault(), q(1)) : e.key === "ArrowDown" ? (e.preventDefault(), q(-1)) : e.key === "Enter" && K(), P?.(e);
81
81
  },
82
- ...P
82
+ ...F
83
83
  }), /* @__PURE__ */ l("div", {
84
84
  className: e.steppers,
85
85
  children: [/* @__PURE__ */ c("button", {
86
86
  type: "button",
87
87
  className: e.stepper,
88
- "aria-label": F,
88
+ "aria-label": I,
89
89
  tabIndex: -1,
90
- disabled: E || J,
90
+ disabled: D || Y,
91
91
  onMouseDown: (e) => e.preventDefault(),
92
- onClick: () => K(1),
92
+ onClick: () => q(1),
93
93
  children: /* @__PURE__ */ c("svg", {
94
94
  viewBox: "0 0 10 10",
95
95
  "aria-hidden": "true",
@@ -106,11 +106,11 @@ function h({ value: n, defaultValue: h, onChange: g, min: _, max: v, step: y = 1
106
106
  }), /* @__PURE__ */ c("button", {
107
107
  type: "button",
108
108
  className: e.stepper,
109
- "aria-label": I,
109
+ "aria-label": L,
110
110
  tabIndex: -1,
111
- disabled: E || Y,
111
+ disabled: D || X,
112
112
  onMouseDown: (e) => e.preventDefault(),
113
- onClick: () => K(-1),
113
+ onClick: () => q(-1),
114
114
  children: /* @__PURE__ */ c("svg", {
115
115
  viewBox: "0 0 10 10",
116
116
  "aria-hidden": "true",
@@ -127,16 +127,16 @@ function h({ value: n, defaultValue: h, onChange: g, min: _, max: v, step: y = 1
127
127
  })]
128
128
  })]
129
129
  }),
130
- w && /* @__PURE__ */ c("span", {
131
- id: `${U}-error`,
130
+ T && /* @__PURE__ */ c("span", {
131
+ id: `${W}-error`,
132
132
  className: e.error,
133
133
  role: "alert",
134
- children: w
134
+ children: T
135
135
  }),
136
- !w && C && /* @__PURE__ */ c("span", {
137
- id: `${U}-hint`,
136
+ !T && w && /* @__PURE__ */ c("span", {
137
+ id: `${W}-hint`,
138
138
  className: e.hint,
139
- children: C
139
+ children: w
140
140
  })
141
141
  ]
142
142
  });
@@ -134,5 +134,5 @@ import { Center as on } from "../../layouts/src/center/center.js";
134
134
  import { Spacer as sn } from "../../layouts/src/spacer/spacer.js";
135
135
  import { AutoGrid as cn } from "../../layouts/src/auto-grid/auto-grid.js";
136
136
  import { ThemeProvider as ln, setTheme as un, themePreloadScript as dn, useTheme as fn } from "./theme.js";
137
- import { ErrorBoundary as pn, FocusScope as mn, Portal as hn, SuspenseBoundary as gn } from "@cascivo/core";
138
- export { M as Accordion, N as AccordionContent, P as AccordionItem, F as AccordionTrigger, I as ActionSheet, d as Alert, ye as AlertDialog, Xt as AppShell, vt as AspectRatio, cn as AutoGrid, f as Avatar, p as AvatarGroup, c as Badge, et as Blockquote, xe as BottomSheet, z as Breadcrumb, t as Button, ft as ButtonGroup, It as Calendar, r as Card, i as CardContent, a as CardFooter, o as CardHeader, s as CardTitle, zt as Carousel, on as Center, Zt as ChatBubble, v as Checkbox, He as CheckboxCard, $e as Code, Wt as CodeSnippet, _t as Collapsible, Rt as ColorPicker, an as Columns, ce as Combobox, ne as CommandMenu, we as Comparison, Et as ContainedList, Dt as ContainedListItem, Se as ContextMenu, Ce as ContextMenuItem, Ue as CopyButton, Ot as DataList, te as DataTable, le as DatePicker, Lt as DateRangePicker, Vt as Dock, Ht as Drawer, w as Dropdown, Ie as Editable, X as EmptyState, pn as ErrorBoundary, Z as Fab, lt as Field, ue as FileUploader, ut as Filter, rn as Flex, mn as FocusScope, ae as Form, tn as Grid, nn as GridItem, H as Header, Be as HeaderPanel, Ze as Heading, Te as HoverCard, Ee as HoverCardContent, De as HoverCardTrigger, dt as IconButton, h as Image, qt as Indicator, mt as InlineLoading, n as Input, Ne as InputGroup, Pe as InputGroupAddon, At as Item, jt as ItemActions, Mt as ItemContent, Nt as ItemDescription, Pt as ItemMedia, Ft as ItemTitle, Jt as Join, L as Kbd, ct as Label, R as Link, tt as List, nt as ListItem, rt as LogViewer, he as Menu, yt as MenuButton, ge as MenuItem, _e as MenuSeparator, ve as MenuTrigger, xt as Menubar, l as Modal, ke as MultiSelect, Ut as NativeSelect, St as NavigationMenu, ht as Notification, ee as NumberInput, je as OtpInput, Q as OverflowMenu, G as Pagination, Oe as PasswordInput, fe as Popover, pe as PopoverContent, me as PopoverTrigger, hn as Portal, Ye as Progress, Y as ProgressBar, Xe as ProgressCircle, K as ProgressIndicator, it as Prose, at as PullToRefresh, ot as QrCode, Qt as RadialProgress, y as Radio, Le as RadioCard, Re as RadioCardGroup, b as RadioGroup, Fe as RatingGroup, st as RelativeTime, Bt as Resizable, gt as ScrollArea, $ as Search, Me as SegmentedControl, _ as Select, u as Separator, be as Sheet, ze as ShellHeader, W as SideNav, J as Skeleton, qe as SkipNavLink, Je as SkipNavTarget, S as Slider, sn as Spacer, e as Spinner, Yt as Stack, We as Stat, Ge as Status, Gt as Steps, Tt as StructuredList, gn as SuspenseBoundary, $t as Swap, en as SwipeItem, Ve as Switcher, O as Tabs, k as TabsContent, A as TabsList, j as TabsTrigger, q as Tag, Ae as TagsInput, Qe as Text, g as Textarea, ln as ThemeProvider, Kt as Tile, de as TimePicker, kt as Timeline, T as ToastProvider, B as Toc, x as Toggle, pt as ToggleGroup, bt as Toggletip, C as Tooltip, Ct as TreeView, m as User, Ke as VisuallyHidden, oe as createForm, E as dismissAllToasts, re as fuzzyMatch, ie as fuzzyScore, un as setTheme, dn as themePreloadScript, wt as treeViewMessages, se as useForm, U as usePopover, fn as useTheme, D as useToast, V as useTocFromRegion };
137
+ import { ErrorBoundary as pn, FocusScope as mn, Portal as hn, SuspenseBoundary as gn, getLinkComponent as _n, setLinkComponent as vn } from "@cascivo/core";
138
+ export { M as Accordion, N as AccordionContent, P as AccordionItem, F as AccordionTrigger, I as ActionSheet, d as Alert, ye as AlertDialog, Xt as AppShell, vt as AspectRatio, cn as AutoGrid, f as Avatar, p as AvatarGroup, c as Badge, et as Blockquote, xe as BottomSheet, z as Breadcrumb, t as Button, ft as ButtonGroup, It as Calendar, r as Card, i as CardContent, a as CardFooter, o as CardHeader, s as CardTitle, zt as Carousel, on as Center, Zt as ChatBubble, v as Checkbox, He as CheckboxCard, $e as Code, Wt as CodeSnippet, _t as Collapsible, Rt as ColorPicker, an as Columns, ce as Combobox, ne as CommandMenu, we as Comparison, Et as ContainedList, Dt as ContainedListItem, Se as ContextMenu, Ce as ContextMenuItem, Ue as CopyButton, Ot as DataList, te as DataTable, le as DatePicker, Lt as DateRangePicker, Vt as Dock, Ht as Drawer, w as Dropdown, Ie as Editable, X as EmptyState, pn as ErrorBoundary, Z as Fab, lt as Field, ue as FileUploader, ut as Filter, rn as Flex, mn as FocusScope, ae as Form, tn as Grid, nn as GridItem, H as Header, Be as HeaderPanel, Ze as Heading, Te as HoverCard, Ee as HoverCardContent, De as HoverCardTrigger, dt as IconButton, h as Image, qt as Indicator, mt as InlineLoading, n as Input, Ne as InputGroup, Pe as InputGroupAddon, At as Item, jt as ItemActions, Mt as ItemContent, Nt as ItemDescription, Pt as ItemMedia, Ft as ItemTitle, Jt as Join, L as Kbd, ct as Label, R as Link, tt as List, nt as ListItem, rt as LogViewer, he as Menu, yt as MenuButton, ge as MenuItem, _e as MenuSeparator, ve as MenuTrigger, xt as Menubar, l as Modal, ke as MultiSelect, Ut as NativeSelect, St as NavigationMenu, ht as Notification, ee as NumberInput, je as OtpInput, Q as OverflowMenu, G as Pagination, Oe as PasswordInput, fe as Popover, pe as PopoverContent, me as PopoverTrigger, hn as Portal, Ye as Progress, Y as ProgressBar, Xe as ProgressCircle, K as ProgressIndicator, it as Prose, at as PullToRefresh, ot as QrCode, Qt as RadialProgress, y as Radio, Le as RadioCard, Re as RadioCardGroup, b as RadioGroup, Fe as RatingGroup, st as RelativeTime, Bt as Resizable, gt as ScrollArea, $ as Search, Me as SegmentedControl, _ as Select, u as Separator, be as Sheet, ze as ShellHeader, W as SideNav, J as Skeleton, qe as SkipNavLink, Je as SkipNavTarget, S as Slider, sn as Spacer, e as Spinner, Yt as Stack, We as Stat, Ge as Status, Gt as Steps, Tt as StructuredList, gn as SuspenseBoundary, $t as Swap, en as SwipeItem, Ve as Switcher, O as Tabs, k as TabsContent, A as TabsList, j as TabsTrigger, q as Tag, Ae as TagsInput, Qe as Text, g as Textarea, ln as ThemeProvider, Kt as Tile, de as TimePicker, kt as Timeline, T as ToastProvider, B as Toc, x as Toggle, pt as ToggleGroup, bt as Toggletip, C as Tooltip, Ct as TreeView, m as User, Ke as VisuallyHidden, oe as createForm, E as dismissAllToasts, re as fuzzyMatch, ie as fuzzyScore, _n as getLinkComponent, vn as setLinkComponent, un as setTheme, dn as themePreloadScript, wt as treeViewMessages, se as useForm, U as usePopover, fn as useTheme, D as useToast, V as useTocFromRegion };
@@ -7,37 +7,42 @@ import { useRef as a } from "react";
7
7
  //#region src/theme.tsx
8
8
  var o = "cascivo-theme", s = "data-theme", c = null, l = {
9
9
  storageKey: o,
10
- defaultTheme: "light"
10
+ defaultTheme: "light",
11
+ explicit: !1
11
12
  };
12
13
  function u(e) {
13
14
  return typeof window > "u" || typeof window.matchMedia != "function" ? e : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : e;
14
15
  }
15
16
  function d() {
16
- return c ??= e(l.storageKey, u(l.defaultTheme)), c;
17
+ return l.explicit ? l.defaultTheme : u(l.defaultTheme);
17
18
  }
18
- function f(e) {
19
- d().value = e;
19
+ function f() {
20
+ return c ??= e(l.storageKey, d()), c;
20
21
  }
21
- function p() {
22
- return n(), [d(), f];
22
+ function p(e) {
23
+ f().value = e;
23
24
  }
24
- function m({ defaultTheme: e, value: n, storageKey: u = o, attribute: f = s, target: p, onChange: m, children: h }) {
25
+ function m() {
26
+ return n(), [f(), p];
27
+ }
28
+ function h({ defaultTheme: e, value: n, storageKey: u = o, attribute: d = s, target: p, onChange: m, children: h }) {
25
29
  let g = a(!1);
26
30
  g.current || (g.current = !0, (c === null || l.storageKey !== u) && (l = {
27
31
  storageKey: u,
28
- defaultTheme: e ?? "light"
32
+ defaultTheme: e ?? "light",
33
+ explicit: e !== void 0
29
34
  }, c = null));
30
- let _ = d();
35
+ let _ = f();
31
36
  n !== void 0 && (_.value = n);
32
37
  let v = a(m);
33
38
  return v.current = m, t(() => {
34
39
  let e = _.value;
35
- (p ? p.current : typeof document < "u" ? document.documentElement : null)?.setAttribute(f, e), v.current?.(e);
40
+ (p ? p.current : typeof document < "u" ? document.documentElement : null)?.setAttribute(d, e), v.current?.(e);
36
41
  }), /* @__PURE__ */ i(r, { children: h });
37
42
  }
38
- function h(e = {}) {
39
- let t = JSON.stringify(e.storageKey ?? o), n = JSON.stringify(e.attribute ?? s);
40
- return `(function(){try{var v=${JSON.stringify(e.defaultTheme ?? "light")};if(typeof matchMedia==='function'){if(matchMedia('(prefers-color-scheme: dark)').matches)v='dark';else if(matchMedia('(prefers-color-scheme: light)').matches)v='light';}var raw=localStorage.getItem(${t});if(raw){v=raw;try{var e=JSON.parse(raw);if(e&&typeof e==='object'&&'value'in e)v=e.value;}catch(_){}}document.documentElement.setAttribute(${n},v);}catch(_){}})();`;
43
+ function g(e = {}) {
44
+ let t = JSON.stringify(e.storageKey ?? o), n = JSON.stringify(e.attribute ?? s), r = JSON.stringify(e.defaultTheme ?? "light"), i = e.defaultTheme === void 0 ? "if(typeof matchMedia==='function'){if(matchMedia('(prefers-color-scheme: dark)').matches)v='dark';else if(matchMedia('(prefers-color-scheme: light)').matches)v='light';}" : "";
45
+ return `(function(){try{var v=${r};` + i + `var raw=localStorage.getItem(${t});if(raw){v=raw;try{var e=JSON.parse(raw);if(e&&typeof e==='object'&&'value'in e)v=e.value;}catch(_){}}document.documentElement.setAttribute(${n},v);}catch(_){}})();`;
41
46
  }
42
47
  //#endregion
43
- export { m as ThemeProvider, f as setTheme, h as themePreloadScript, p as useTheme };
48
+ export { h as ThemeProvider, p as setTheme, g as themePreloadScript, m as useTheme };
@@ -29,59 +29,59 @@ function d() {
29
29
  })]
30
30
  });
31
31
  }
32
- function f({ value: f, defaultValue: p = "", onChange: m, onSearch: h, debounceMs: g = 300, placeholder: _, size: v = "md", label: y, disabled: b = !1, clearLabel: x, id: S, className: C }) {
32
+ function f({ value: f, defaultValue: p = "", onValueChange: m, onChange: h, onSearch: g, debounceMs: _ = 300, placeholder: v, size: y = "md", label: b, disabled: x = !1, clearLabel: S, id: C, className: w }) {
33
33
  i();
34
- let w = _ ?? o(a.search.placeholder), T = y ?? o(a.search.label), E = x ?? o(a.search.clear), D = l(null), O = l("");
35
- O.current === "" && (u += 1, O.current = `cascade-search-${u}`);
36
- let k = S ?? O.current, A = f !== void 0, j = n(A ? f : p);
37
- A && (j.value = f);
38
- let M = l(h);
39
- M.current = h;
40
- let N = l(null), P = () => {
41
- N.current !== null && (clearTimeout(N.current), N.current = null);
34
+ let T = v ?? o(a.search.placeholder), E = b ?? o(a.search.label), D = S ?? o(a.search.clear), O = l(null), k = l("");
35
+ k.current === "" && (u += 1, k.current = `cascade-search-${u}`);
36
+ let A = C ?? k.current, j = f !== void 0, M = n(j ? f : p);
37
+ j && (M.value = f);
38
+ let N = l(g);
39
+ N.current = g;
40
+ let P = l(null), F = () => {
41
+ P.current !== null && (clearTimeout(P.current), P.current = null);
42
42
  };
43
- r(() => P);
44
- let F = (e) => {
43
+ r(() => F);
44
+ let I = (e) => {
45
45
  let t = e.target.value;
46
- A || (j.value = t), m?.(t), P(), N.current = setTimeout(() => {
47
- N.current = null, M.current?.(t);
48
- }, g);
49
- }, I = (e) => {
50
- e.key === "Enter" && (P(), h?.(j.value));
51
- }, L = () => {
52
- P(), A || (j.value = ""), m?.(""), h?.(""), D.current?.focus();
53
- }, R = j.value !== "";
46
+ j || (M.value = t), (m ?? h)?.(t), F(), P.current = setTimeout(() => {
47
+ P.current = null, N.current?.(t);
48
+ }, _);
49
+ }, L = (e) => {
50
+ e.key === "Enter" && (F(), g?.(M.value));
51
+ }, R = () => {
52
+ F(), j || (M.value = ""), (m ?? h)?.(""), g?.(""), O.current?.focus();
53
+ }, z = M.value !== "";
54
54
  return /* @__PURE__ */ c("div", {
55
- className: t(e.root, C),
56
- "data-size": v,
57
- "data-state": R ? "filled" : "empty",
55
+ className: t(e.root, w),
56
+ "data-size": y,
57
+ "data-state": z ? "filled" : "empty",
58
58
  children: [
59
59
  /* @__PURE__ */ s("label", {
60
60
  className: e.label,
61
- htmlFor: k,
62
- children: T
61
+ htmlFor: A,
62
+ children: E
63
63
  }),
64
64
  /* @__PURE__ */ s("span", {
65
65
  className: e.icon,
66
66
  children: /* @__PURE__ */ s(d, {})
67
67
  }),
68
68
  /* @__PURE__ */ s("input", {
69
- ref: D,
70
- id: k,
69
+ ref: O,
70
+ id: A,
71
71
  type: "search",
72
72
  className: e.input,
73
- value: j.value,
74
- placeholder: w,
75
- disabled: b,
76
- onChange: F,
77
- onKeyDown: I
73
+ value: M.value,
74
+ placeholder: T,
75
+ disabled: x,
76
+ onChange: I,
77
+ onKeyDown: L
78
78
  }),
79
- R && /* @__PURE__ */ s("button", {
79
+ z && /* @__PURE__ */ s("button", {
80
80
  type: "button",
81
81
  className: e.clear,
82
- "aria-label": E,
83
- disabled: b,
84
- onClick: L,
82
+ "aria-label": D,
83
+ disabled: x,
84
+ onClick: R,
85
85
  children: /* @__PURE__ */ s("span", {
86
86
  "aria-hidden": "true",
87
87
  children: "✕"
package/dist/swap/swap.js CHANGED
@@ -4,23 +4,23 @@ import e from "./swap.module.js";
4
4
  import { useSignal as t, useSignals as n } from "@cascivo/core";
5
5
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
6
  //#region ../components/src/swap/swap.tsx
7
- function a({ on: a, off: o, checked: s = !1, onChange: c, mode: l = "rotate", className: u, ...d }) {
7
+ function a({ on: a, off: o, checked: s = !1, onValueChange: c, onChange: l, mode: u = "rotate", className: d, ...f }) {
8
8
  n();
9
- let f = t(s);
10
- f.value = s;
11
- function p() {
12
- let e = !f.value;
13
- c?.(e);
9
+ let p = t(s);
10
+ p.value = s;
11
+ function m() {
12
+ let e = !p.value;
13
+ (c ?? l)?.(e);
14
14
  }
15
15
  return /* @__PURE__ */ i("button", {
16
16
  type: "button",
17
17
  role: "switch",
18
- "aria-checked": f.value,
19
- className: [e.swap, u].filter(Boolean).join(" "),
20
- "data-checked": f.value || void 0,
21
- "data-mode": l,
22
- onClick: p,
23
- ...d,
18
+ "aria-checked": p.value,
19
+ className: [e.swap, d].filter(Boolean).join(" "),
20
+ "data-checked": p.value || void 0,
21
+ "data-mode": u,
22
+ onClick: m,
23
+ ...f,
24
24
  children: [/* @__PURE__ */ r("span", {
25
25
  className: e.on,
26
26
  "aria-hidden": "true",
@@ -11,49 +11,49 @@ var s = n({
11
11
  focused: { on: { BLUR: "idle" } }
12
12
  }
13
13
  });
14
- function c({ value: n, defaultValue: c, onChange: l, min: u, max: d, step: f, label: p, hint: m, error: h, size: g = "md", className: _, id: v, onFocus: y, onBlur: b, ...x }) {
14
+ function c({ value: n, defaultValue: c, onValueChange: l, onChange: u, min: d, max: f, step: p, label: m, hint: h, error: g, size: _ = "md", className: v, id: y, onFocus: b, onBlur: x, ...S }) {
15
15
  i();
16
- let [S, C] = r(s), w = v ?? (p ? `cascade-time-picker-${p.toLowerCase().replace(/\s+/g, "-")}` : void 0);
16
+ let [C, w] = r(s), T = y ?? (m ? `cascade-time-picker-${m.toLowerCase().replace(/\s+/g, "-")}` : void 0);
17
17
  return /* @__PURE__ */ o("div", {
18
- className: t(e.wrapper, _),
19
- "data-state": h ? "error" : S.value,
20
- "data-size": g,
18
+ className: t(e.wrapper, v),
19
+ "data-state": g ? "error" : C.value,
20
+ "data-size": _,
21
21
  children: [
22
- p && /* @__PURE__ */ a("label", {
22
+ m && /* @__PURE__ */ a("label", {
23
23
  className: e.label,
24
- htmlFor: w,
25
- children: p
24
+ htmlFor: T,
25
+ children: m
26
26
  }),
27
27
  /* @__PURE__ */ a("input", {
28
- id: w,
28
+ id: T,
29
29
  type: "time",
30
30
  className: e.input,
31
31
  value: n,
32
32
  defaultValue: c,
33
- min: u,
34
- max: d,
35
- step: f,
36
- "aria-invalid": h ? !0 : void 0,
37
- "aria-describedby": h ? `${w}-error` : m ? `${w}-hint` : void 0,
38
- onChange: (e) => l?.(e.target.value),
33
+ min: d,
34
+ max: f,
35
+ step: p,
36
+ "aria-invalid": g ? !0 : void 0,
37
+ "aria-describedby": g ? `${T}-error` : h ? `${T}-hint` : void 0,
38
+ onChange: (e) => (l ?? u)?.(e.target.value),
39
39
  onFocus: (e) => {
40
- C("FOCUS"), y?.(e);
40
+ w("FOCUS"), b?.(e);
41
41
  },
42
42
  onBlur: (e) => {
43
- C("BLUR"), b?.(e);
43
+ w("BLUR"), x?.(e);
44
44
  },
45
- ...x
45
+ ...S
46
46
  }),
47
- h && /* @__PURE__ */ a("span", {
48
- id: `${w}-error`,
47
+ g && /* @__PURE__ */ a("span", {
48
+ id: `${T}-error`,
49
49
  className: e.error,
50
50
  role: "alert",
51
- children: h
51
+ children: g
52
52
  }),
53
- !h && m && /* @__PURE__ */ a("span", {
54
- id: `${w}-hint`,
53
+ !g && h && /* @__PURE__ */ a("span", {
54
+ id: `${T}-hint`,
55
55
  className: e.hint,
56
- children: m
56
+ children: h
57
57
  })
58
58
  ]
59
59
  });
@@ -4,34 +4,34 @@ import e from "./toggle.module.js";
4
4
  import { cn as t, createMachine as n, useMachine as r, useSignals as i } from "@cascivo/core";
5
5
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
6
  //#region ../components/src/toggle/toggle.tsx
7
- function s({ checked: s, defaultChecked: c = !1, onChange: l, label: u, size: d = "md", className: f, disabled: p, ...m }) {
7
+ function s({ checked: s, defaultChecked: c = !1, onValueChange: l, onChange: u, label: d, size: f = "md", className: p, disabled: m, ...h }) {
8
8
  i();
9
- let [h, g] = r(n({
9
+ let [g, _] = r(n({
10
10
  initial: c ? "on" : "off",
11
11
  states: {
12
12
  off: { on: { TOGGLE: "on" } },
13
13
  on: { on: { TOGGLE: "off" } }
14
14
  }
15
- })), _ = s !== void 0, v = _ ? s : h.value === "on";
15
+ })), v = s !== void 0, y = v ? s : g.value === "on";
16
16
  return /* @__PURE__ */ o("button", {
17
17
  type: "button",
18
18
  role: "switch",
19
- "aria-checked": v,
20
- "data-state": v ? "on" : "off",
21
- "data-size": d,
22
- disabled: p,
23
- className: t(e.toggle, f),
19
+ "aria-checked": y,
20
+ "data-state": y ? "on" : "off",
21
+ "data-size": f,
22
+ disabled: m,
23
+ className: t(e.toggle, p),
24
24
  onClick: () => {
25
- _ || g("TOGGLE"), l?.(!v);
25
+ v || _("TOGGLE"), (l ?? u)?.(!y);
26
26
  },
27
- ...m,
27
+ ...h,
28
28
  children: [/* @__PURE__ */ a("span", {
29
29
  className: e.track,
30
30
  "aria-hidden": "true",
31
31
  children: /* @__PURE__ */ a("span", { className: e.thumb })
32
- }), u && /* @__PURE__ */ a("span", {
32
+ }), d && /* @__PURE__ */ a("span", {
33
33
  className: e.label,
34
- children: u
34
+ children: d
35
35
  })]
36
36
  });
37
37
  }
package/dist/user/user.js CHANGED
@@ -6,12 +6,16 @@ import { cn as n } from "@cascivo/core";
6
6
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
7
7
  //#region ../components/src/user/user.tsx
8
8
  function a({ name: a, description: o, avatarProps: s, className: c, children: l, ...u }) {
9
+ let d = typeof a == "string" && s?.name === void 0 && s?.fallback === void 0 ? { name: a } : {};
9
10
  return /* @__PURE__ */ i("div", {
10
11
  role: "group",
11
12
  className: n(t.user, c),
12
13
  ...u,
13
14
  children: [
14
- /* @__PURE__ */ r(e, { ...s }),
15
+ /* @__PURE__ */ r(e, {
16
+ ...d,
17
+ ...s
18
+ }),
15
19
  /* @__PURE__ */ i("span", {
16
20
  className: t.text,
17
21
  children: [/* @__PURE__ */ r("span", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cascivo/react",
3
- "version": "0.7.1",
3
+ "version": "0.9.0",
4
4
  "private": false,
5
5
  "description": "Prebuilt cascivo design system components — use without copying source",
6
6
  "keywords": [
@@ -33,8 +33,8 @@
33
33
  "exports": {
34
34
  ".": {
35
35
  "types": "./dist/index.d.ts",
36
- "import": "./dist/react/src/index.js",
37
- "default": "./dist/react/src/index.js"
36
+ "import": "./dist/index.js",
37
+ "default": "./dist/index.js"
38
38
  },
39
39
  "./styles.css": "./dist/styles.css",
40
40
  "./package.json": "./package.json"
@@ -44,8 +44,8 @@
44
44
  "provenance": true
45
45
  },
46
46
  "dependencies": {
47
- "@cascivo/core": "^0.4.0",
48
- "@cascivo/i18n": "^0.2.7"
47
+ "@cascivo/core": "^0.5.0",
48
+ "@cascivo/i18n": "^0.2.9"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@testing-library/jest-dom": "^6.9.1",
@@ -61,7 +61,7 @@
61
61
  "@cascivo/components": "0.0.0"
62
62
  },
63
63
  "peerDependencies": {
64
- "@preact/signals-react": ">=2.0.0",
64
+ "@preact/signals-react": ">=3.0.0",
65
65
  "react": ">=18.0.0",
66
66
  "react-dom": ">=18.0.0"
67
67
  },
package/readme.body.md CHANGED
@@ -18,6 +18,11 @@ supplies the tokens and themes the components read.
18
18
  Charts live in a separate package — add [`@cascivo/charts`](https://github.com/cascivo/cascivo/tree/main/packages/charts)
19
19
  for `LineChart`, `AreaChart`, `BarChart`, `Sparkline`, and more.
20
20
 
21
+ > **Types are the reference.** The shipped `dist/index.d.ts` is a self-contained, flat
22
+ > rollup — every component's `…Props` interface is real, documentation-grade API. Reading
23
+ > it (or the per-component [`/llms/<name>.md`](https://cascivo.com/llms.txt)) is the fastest
24
+ > way to learn a component's props with no web access.
25
+
21
26
  ### Framework setup (Next.js App Router)
22
27
 
23
28
  In a Server Component file (e.g. `app/layout.tsx`), import the themes once:
@@ -40,12 +45,20 @@ RSC without any extra wrapper.
40
45
  > only if you prefer one explicit stylesheet over per-component tree-shaking, or
41
46
  > for Vite SSR (below), where it is required.
42
47
 
43
- > **Vite SSR / TanStack Start / Remix / workerd?** Those per-component `.css`
44
- > imports need a bundler to resolve them; a bare server-side ESM loader throws
45
- > `Unknown file extension ".css"`. Add `ssr: { noExternal: [/^@cascivo\//] }` (or
46
- > the `cascivoSsr()` plugin from `@cascivo/vite-plugin`) and import
47
- > `@cascivo/react/styles.css` once in your root entry. Full recipe:
48
- > [USING-WITH-VITE-SSR.md](https://github.com/cascivo/cascivo/blob/main/docs/USING-WITH-VITE-SSR.md).
48
+ > **Vite SSR / TanStack Start / Remix / workerd?** The 4-line SSR checklist (full
49
+ > recipe: [USING-WITH-VITE-SSR.md](https://github.com/cascivo/cascivo/blob/main/docs/USING-WITH-VITE-SSR.md)):
50
+ >
51
+ > 1. **`ssr: { noExternal: [/^@cascivo\//] }`** in `vite.config` (or the
52
+ > `cascivoSsr()` plugin from `@cascivo/vite-plugin`). Without it a bare
53
+ > server-side ESM loader can't resolve the per-component `.css` side-effect
54
+ > imports and throws `Unknown file extension ".css"`.
55
+ > 2. **`@preact/signals-react` 3.x** — on React 19 the 2.x line fails to load. The
56
+ > peer range enforces `>=3`.
57
+ > 3. **Import the CSS once** in your root entry: `@cascivo/react/styles.css` +
58
+ > `@cascivo/themes/all` (+ `@cascivo/charts/styles.css` if you use charts).
59
+ > 4. **Theme without a mismatch:** inline `themePreloadScript()` in `<head>` and add
60
+ > `suppressHydrationWarning` to `<html>`, or hard-code `data-theme` for a fixed theme.
61
+ >
49
62
  > Next.js App Router needs none of this.
50
63
 
51
64
  ## Use
@@ -185,7 +198,7 @@ routing break after adding one of these, check that the import resolves to
185
198
 
186
199
  ## Component index
187
200
 
188
- 192 components, exported from `@cascivo/react`. Full props, examples, and live demos at [docs.cascivo.com](https://docs.cascivo.com).
201
+ 192 components, exported from `@cascivo/react`. Full props, examples, and live demos at [cascivo.com/docs](https://cascivo.com/docs).
189
202
 
190
203
  ### Inputs
191
204