@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.
- package/README.md +22 -9
- package/dist/avatar/avatar.js +26 -14
- package/dist/combobox/combobox.js +73 -73
- package/dist/date-picker/date-picker.js +95 -95
- package/dist/filter/filter.js +12 -12
- package/dist/index.d.ts +67 -9
- package/dist/index.js +2 -0
- package/dist/number-input/number-input.js +41 -41
- package/dist/react/src/index.js +2 -2
- package/dist/react/src/theme.js +19 -14
- package/dist/search/search.js +35 -35
- package/dist/swap/swap.js +12 -12
- package/dist/time-picker/time-picker.js +24 -24
- package/dist/toggle/toggle.js +12 -12
- package/dist/user/user.js +5 -1
- package/package.json +6 -6
- package/readme.body.md +20 -7
|
@@ -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,
|
|
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
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
let e = m(
|
|
39
|
-
e != null && (e = d(e,
|
|
40
|
-
},
|
|
41
|
-
let t = (
|
|
42
|
-
|
|
43
|
-
},
|
|
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,
|
|
46
|
-
"data-state":
|
|
47
|
-
"data-size":
|
|
45
|
+
className: t(e.wrapper, A),
|
|
46
|
+
"data-state": T ? "error" : R.value,
|
|
47
|
+
"data-size": E,
|
|
48
48
|
children: [
|
|
49
|
-
|
|
49
|
+
C && /* @__PURE__ */ c("label", {
|
|
50
50
|
className: e.label,
|
|
51
|
-
htmlFor:
|
|
52
|
-
children:
|
|
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:
|
|
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:
|
|
64
|
-
disabled:
|
|
65
|
-
"aria-valuenow":
|
|
66
|
-
"aria-valuemin":
|
|
67
|
-
"aria-valuemax":
|
|
68
|
-
"aria-invalid":
|
|
69
|
-
"aria-describedby":
|
|
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
|
-
|
|
71
|
+
H.value = e.target.value;
|
|
72
72
|
},
|
|
73
73
|
onFocus: (e) => {
|
|
74
|
-
|
|
74
|
+
H.value = U == null ? "" : String(U), z("FOCUS"), M?.(e);
|
|
75
75
|
},
|
|
76
76
|
onBlur: (e) => {
|
|
77
|
-
|
|
77
|
+
K(), z("BLUR"), N?.(e);
|
|
78
78
|
},
|
|
79
79
|
onKeyDown: (e) => {
|
|
80
|
-
e.key === "ArrowUp" ? (e.preventDefault(),
|
|
80
|
+
e.key === "ArrowUp" ? (e.preventDefault(), q(1)) : e.key === "ArrowDown" ? (e.preventDefault(), q(-1)) : e.key === "Enter" && K(), P?.(e);
|
|
81
81
|
},
|
|
82
|
-
...
|
|
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":
|
|
88
|
+
"aria-label": I,
|
|
89
89
|
tabIndex: -1,
|
|
90
|
-
disabled:
|
|
90
|
+
disabled: D || Y,
|
|
91
91
|
onMouseDown: (e) => e.preventDefault(),
|
|
92
|
-
onClick: () =>
|
|
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":
|
|
109
|
+
"aria-label": L,
|
|
110
110
|
tabIndex: -1,
|
|
111
|
-
disabled:
|
|
111
|
+
disabled: D || X,
|
|
112
112
|
onMouseDown: (e) => e.preventDefault(),
|
|
113
|
-
onClick: () =>
|
|
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
|
-
|
|
131
|
-
id: `${
|
|
130
|
+
T && /* @__PURE__ */ c("span", {
|
|
131
|
+
id: `${W}-error`,
|
|
132
132
|
className: e.error,
|
|
133
133
|
role: "alert",
|
|
134
|
-
children:
|
|
134
|
+
children: T
|
|
135
135
|
}),
|
|
136
|
-
!
|
|
137
|
-
id: `${
|
|
136
|
+
!T && w && /* @__PURE__ */ c("span", {
|
|
137
|
+
id: `${W}-hint`,
|
|
138
138
|
className: e.hint,
|
|
139
|
-
children:
|
|
139
|
+
children: w
|
|
140
140
|
})
|
|
141
141
|
]
|
|
142
142
|
});
|
package/dist/react/src/index.js
CHANGED
|
@@ -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 };
|
package/dist/react/src/theme.js
CHANGED
|
@@ -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
|
|
17
|
+
return l.explicit ? l.defaultTheme : u(l.defaultTheme);
|
|
17
18
|
}
|
|
18
|
-
function f(
|
|
19
|
-
d()
|
|
19
|
+
function f() {
|
|
20
|
+
return c ??= e(l.storageKey, d()), c;
|
|
20
21
|
}
|
|
21
|
-
function p() {
|
|
22
|
-
|
|
22
|
+
function p(e) {
|
|
23
|
+
f().value = e;
|
|
23
24
|
}
|
|
24
|
-
function m(
|
|
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 _ =
|
|
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(
|
|
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
|
|
39
|
-
let t = JSON.stringify(e.storageKey ?? o), n = JSON.stringify(e.attribute ?? s);
|
|
40
|
-
return `(function(){try{var v=${
|
|
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 {
|
|
48
|
+
export { h as ThemeProvider, p as setTheme, g as themePreloadScript, m as useTheme };
|
package/dist/search/search.js
CHANGED
|
@@ -29,59 +29,59 @@ function d() {
|
|
|
29
29
|
})]
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
function f({ value: f, defaultValue: p = "",
|
|
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
|
|
35
|
-
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
let
|
|
39
|
-
|
|
40
|
-
let
|
|
41
|
-
|
|
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(() =>
|
|
44
|
-
let
|
|
43
|
+
r(() => F);
|
|
44
|
+
let I = (e) => {
|
|
45
45
|
let t = e.target.value;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
e.key === "Enter" && (
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
},
|
|
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,
|
|
56
|
-
"data-size":
|
|
57
|
-
"data-state":
|
|
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:
|
|
62
|
-
children:
|
|
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:
|
|
70
|
-
id:
|
|
69
|
+
ref: O,
|
|
70
|
+
id: A,
|
|
71
71
|
type: "search",
|
|
72
72
|
className: e.input,
|
|
73
|
-
value:
|
|
74
|
-
placeholder:
|
|
75
|
-
disabled:
|
|
76
|
-
onChange:
|
|
77
|
-
onKeyDown:
|
|
73
|
+
value: M.value,
|
|
74
|
+
placeholder: T,
|
|
75
|
+
disabled: x,
|
|
76
|
+
onChange: I,
|
|
77
|
+
onKeyDown: L
|
|
78
78
|
}),
|
|
79
|
-
|
|
79
|
+
z && /* @__PURE__ */ s("button", {
|
|
80
80
|
type: "button",
|
|
81
81
|
className: e.clear,
|
|
82
|
-
"aria-label":
|
|
83
|
-
disabled:
|
|
84
|
-
onClick:
|
|
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,
|
|
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
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
let e = !
|
|
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":
|
|
19
|
-
className: [e.swap,
|
|
20
|
-
"data-checked":
|
|
21
|
-
"data-mode":
|
|
22
|
-
onClick:
|
|
23
|
-
...
|
|
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,
|
|
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 [
|
|
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":
|
|
20
|
-
"data-size":
|
|
18
|
+
className: t(e.wrapper, v),
|
|
19
|
+
"data-state": g ? "error" : C.value,
|
|
20
|
+
"data-size": _,
|
|
21
21
|
children: [
|
|
22
|
-
|
|
22
|
+
m && /* @__PURE__ */ a("label", {
|
|
23
23
|
className: e.label,
|
|
24
|
-
htmlFor:
|
|
25
|
-
children:
|
|
24
|
+
htmlFor: T,
|
|
25
|
+
children: m
|
|
26
26
|
}),
|
|
27
27
|
/* @__PURE__ */ a("input", {
|
|
28
|
-
id:
|
|
28
|
+
id: T,
|
|
29
29
|
type: "time",
|
|
30
30
|
className: e.input,
|
|
31
31
|
value: n,
|
|
32
32
|
defaultValue: c,
|
|
33
|
-
min:
|
|
34
|
-
max:
|
|
35
|
-
step:
|
|
36
|
-
"aria-invalid":
|
|
37
|
-
"aria-describedby":
|
|
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
|
-
|
|
40
|
+
w("FOCUS"), b?.(e);
|
|
41
41
|
},
|
|
42
42
|
onBlur: (e) => {
|
|
43
|
-
|
|
43
|
+
w("BLUR"), x?.(e);
|
|
44
44
|
},
|
|
45
|
-
...
|
|
45
|
+
...S
|
|
46
46
|
}),
|
|
47
|
-
|
|
48
|
-
id: `${
|
|
47
|
+
g && /* @__PURE__ */ a("span", {
|
|
48
|
+
id: `${T}-error`,
|
|
49
49
|
className: e.error,
|
|
50
50
|
role: "alert",
|
|
51
|
-
children:
|
|
51
|
+
children: g
|
|
52
52
|
}),
|
|
53
|
-
!
|
|
54
|
-
id: `${
|
|
53
|
+
!g && h && /* @__PURE__ */ a("span", {
|
|
54
|
+
id: `${T}-hint`,
|
|
55
55
|
className: e.hint,
|
|
56
|
-
children:
|
|
56
|
+
children: h
|
|
57
57
|
})
|
|
58
58
|
]
|
|
59
59
|
});
|
package/dist/toggle/toggle.js
CHANGED
|
@@ -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,
|
|
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 [
|
|
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
|
-
})),
|
|
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":
|
|
20
|
-
"data-state":
|
|
21
|
-
"data-size":
|
|
22
|
-
disabled:
|
|
23
|
-
className: t(e.toggle,
|
|
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
|
-
|
|
25
|
+
v || _("TOGGLE"), (l ?? u)?.(!y);
|
|
26
26
|
},
|
|
27
|
-
...
|
|
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
|
-
}),
|
|
32
|
+
}), d && /* @__PURE__ */ a("span", {
|
|
33
33
|
className: e.label,
|
|
34
|
-
children:
|
|
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, {
|
|
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.
|
|
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/
|
|
37
|
-
"default": "./dist/
|
|
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.
|
|
48
|
-
"@cascivo/i18n": "^0.2.
|
|
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": ">=
|
|
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?**
|
|
44
|
-
>
|
|
45
|
-
>
|
|
46
|
-
>
|
|
47
|
-
> `@cascivo/
|
|
48
|
-
>
|
|
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 [
|
|
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
|
|