@cascivo/react 0.9.0 → 0.10.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.
- package/README.md +5 -5
- package/dist/command-menu/command-menu.js +2 -2
- package/dist/field/field.js +24 -15
- package/dist/index.d.ts +13 -0
- package/dist/node/accordion/accordion.js +95 -0
- package/dist/node/accordion/accordion.module.js +13 -0
- package/dist/node/action-sheet/action-sheet.js +91 -0
- package/dist/node/action-sheet/action-sheet.module.js +14 -0
- package/dist/node/alert/alert.js +55 -0
- package/dist/node/alert/alert.module.js +13 -0
- package/dist/node/alert-dialog/alert-dialog.js +68 -0
- package/dist/node/alert-dialog/alert-dialog.module.js +13 -0
- package/dist/node/app-shell/app-shell.js +80 -0
- package/dist/node/app-shell/app-shell.module.js +14 -0
- package/dist/node/aspect-ratio/aspect-ratio.js +22 -0
- package/dist/node/aspect-ratio/aspect-ratio.module.js +8 -0
- package/dist/node/avatar/avatar.js +57 -0
- package/dist/node/avatar/avatar.module.js +10 -0
- package/dist/node/avatar-group/avatar-group.js +26 -0
- package/dist/node/avatar-group/avatar-group.module.js +8 -0
- package/dist/node/badge/badge.js +17 -0
- package/dist/node/badge/badge.module.js +5 -0
- package/dist/node/blockquote/blockquote.js +18 -0
- package/dist/node/blockquote/blockquote.module.js +8 -0
- package/dist/node/bottom-sheet/bottom-sheet.js +111 -0
- package/dist/node/bottom-sheet/bottom-sheet.module.js +16 -0
- package/dist/node/breadcrumb/breadcrumb.js +28 -0
- package/dist/node/breadcrumb/breadcrumb.module.js +5 -0
- package/dist/node/button/button.js +31 -0
- package/dist/node/button/button.module.js +5 -0
- package/dist/node/button-group/button-group.js +39 -0
- package/dist/node/button-group/button-group.module.js +5 -0
- package/dist/node/calendar/calendar.js +195 -0
- package/dist/node/calendar/calendar.module.js +16 -0
- package/dist/node/card/card.js +45 -0
- package/dist/node/card/card.module.js +11 -0
- package/dist/node/carousel/carousel.js +138 -0
- package/dist/node/carousel/carousel.module.js +15 -0
- package/dist/node/chat-bubble/chat-bubble.js +33 -0
- package/dist/node/chat-bubble/chat-bubble.module.js +13 -0
- package/dist/node/checkbox/checkbox.js +38 -0
- package/dist/node/checkbox/checkbox.module.js +10 -0
- package/dist/node/checkbox-card/checkbox-card.js +48 -0
- package/dist/node/checkbox-card/checkbox-card.module.js +13 -0
- package/dist/node/code/code.js +16 -0
- package/dist/node/code/code.module.js +5 -0
- package/dist/node/code-snippet/code-snippet.js +116 -0
- package/dist/node/code-snippet/code-snippet.module.js +19 -0
- package/dist/node/code-snippet/highlight.js +69 -0
- package/dist/node/collapsible/collapsible.js +42 -0
- package/dist/node/collapsible/collapsible.module.js +10 -0
- package/dist/node/color-picker/color-picker.js +268 -0
- package/dist/node/color-picker/color-picker.module.js +20 -0
- package/dist/node/combobox/combobox.js +164 -0
- package/dist/node/combobox/combobox.module.js +21 -0
- package/dist/node/command-menu/command-menu.js +425 -0
- package/dist/node/command-menu/command-menu.module.js +36 -0
- package/dist/node/comparison/comparison.js +69 -0
- package/dist/node/comparison/comparison.module.js +11 -0
- package/dist/node/contained-list/contained-list.js +41 -0
- package/dist/node/contained-list/contained-list.module.js +13 -0
- package/dist/node/context-menu/context-menu.js +89 -0
- package/dist/node/context-menu/context-menu.module.js +9 -0
- package/dist/node/copy-button/copy-button.js +58 -0
- package/dist/node/copy-button/copy-button.module.js +8 -0
- package/dist/node/data-list/data-list.js +27 -0
- package/dist/node/data-list/data-list.module.js +10 -0
- package/dist/node/data-table/data-table.js +370 -0
- package/dist/node/data-table/data-table.module.js +35 -0
- package/dist/node/date-picker/date-picker.js +218 -0
- package/dist/node/date-picker/date-picker.module.js +25 -0
- package/dist/node/date-range-picker/date-range-picker.js +196 -0
- package/dist/node/date-range-picker/date-range-picker.module.js +20 -0
- package/dist/node/dock/dock.js +34 -0
- package/dist/node/dock/dock.module.js +10 -0
- package/dist/node/drawer/drawer.js +95 -0
- package/dist/node/drawer/drawer.module.js +15 -0
- package/dist/node/dropdown/dropdown.js +109 -0
- package/dist/node/dropdown/dropdown.module.js +11 -0
- package/dist/node/editable/editable.js +67 -0
- package/dist/node/editable/editable.module.js +13 -0
- package/dist/node/empty-state/empty-state.js +34 -0
- package/dist/node/empty-state/empty-state.module.js +11 -0
- package/dist/node/fab/fab.js +93 -0
- package/dist/node/fab/fab.module.js +14 -0
- package/dist/node/field/field.js +48 -0
- package/dist/node/field/field.module.js +9 -0
- package/dist/node/file-uploader/file-uploader.js +122 -0
- package/dist/node/file-uploader/file-uploader.module.js +20 -0
- package/dist/node/filter/filter.js +34 -0
- package/dist/node/filter/filter.module.js +8 -0
- package/dist/node/form/form.js +95 -0
- package/dist/node/form/form.module.js +5 -0
- package/dist/node/header/header.js +44 -0
- package/dist/node/header/header.module.js +13 -0
- package/dist/node/header-panel/header-panel.js +74 -0
- package/dist/node/header-panel/header-panel.module.js +11 -0
- package/dist/node/heading/heading.js +24 -0
- package/dist/node/heading/heading.module.js +5 -0
- package/dist/node/hover-card/hover-card.js +84 -0
- package/dist/node/hover-card/hover-card.module.js +8 -0
- package/dist/node/icon-button/icon-button.js +21 -0
- package/dist/node/icon-button/icon-button.module.js +5 -0
- package/dist/node/image/image.js +64 -0
- package/dist/node/image/image.module.js +11 -0
- package/dist/node/index.js +2 -0
- package/dist/node/indicator/indicator.js +18 -0
- package/dist/node/indicator/indicator.module.js +8 -0
- package/dist/node/inline-loading/inline-loading.js +76 -0
- package/dist/node/inline-loading/inline-loading.module.js +11 -0
- package/dist/node/input/input.js +54 -0
- package/dist/node/input/input.module.js +11 -0
- package/dist/node/input-group/input-group.js +41 -0
- package/dist/node/input-group/input-group.module.js +11 -0
- package/dist/node/item/item.js +52 -0
- package/dist/node/item/item.module.js +12 -0
- package/dist/node/join/join.js +14 -0
- package/dist/node/join/join.module.js +5 -0
- package/dist/node/kbd/kbd.js +16 -0
- package/dist/node/kbd/kbd.module.js +5 -0
- package/dist/node/label/label.js +25 -0
- package/dist/node/label/label.module.js +9 -0
- package/dist/node/layouts/src/auto-grid/auto-grid.js +19 -0
- package/dist/node/layouts/src/auto-grid/auto-grid.module.js +6 -0
- package/dist/node/layouts/src/center/center.js +18 -0
- package/dist/node/layouts/src/center/center.module.js +5 -0
- package/dist/node/layouts/src/columns/columns.js +23 -0
- package/dist/node/layouts/src/columns/columns.module.js +8 -0
- package/dist/node/layouts/src/flex/flex.js +22 -0
- package/dist/node/layouts/src/flex/flex.module.js +5 -0
- package/dist/node/layouts/src/grid/grid.js +57 -0
- package/dist/node/layouts/src/grid/grid.module.js +9 -0
- package/dist/node/layouts/src/spacer/spacer.js +19 -0
- package/dist/node/layouts/src/spacer/spacer.module.js +5 -0
- package/dist/node/link/link.js +22 -0
- package/dist/node/link/link.module.js +5 -0
- package/dist/node/list/list.js +23 -0
- package/dist/node/list/list.module.js +8 -0
- package/dist/node/log-viewer/log-viewer.js +184 -0
- package/dist/node/log-viewer/log-viewer.module.js +18 -0
- package/dist/node/menu/menu.js +121 -0
- package/dist/node/menu/menu.module.js +10 -0
- package/dist/node/menu-button/menu-button.js +92 -0
- package/dist/node/menu-button/menu-button.module.js +10 -0
- package/dist/node/menubar/menubar.js +103 -0
- package/dist/node/menubar/menubar.module.js +10 -0
- package/dist/node/modal/modal.js +70 -0
- package/dist/node/modal/modal.module.js +13 -0
- package/dist/node/multi-select/multi-select.js +106 -0
- package/dist/node/multi-select/multi-select.module.js +17 -0
- package/dist/node/native-select/native-select.js +37 -0
- package/dist/node/native-select/native-select.module.js +9 -0
- package/dist/node/navigation-menu/navigation-menu.js +99 -0
- package/dist/node/navigation-menu/navigation-menu.module.js +12 -0
- package/dist/node/notification/notification.js +134 -0
- package/dist/node/notification/notification.module.js +13 -0
- package/dist/node/number-input/number-input.js +145 -0
- package/dist/node/number-input/number-input.module.js +14 -0
- package/dist/node/otp-input/otp-input.js +70 -0
- package/dist/node/otp-input/otp-input.module.js +8 -0
- package/dist/node/overflow-menu/overflow-menu.js +65 -0
- package/dist/node/overflow-menu/overflow-menu.module.js +9 -0
- package/dist/node/pagination/pagination.js +92 -0
- package/dist/node/pagination/pagination.module.js +13 -0
- package/dist/node/password-input/password-input.js +80 -0
- package/dist/node/password-input/password-input.module.js +13 -0
- package/dist/node/popover/popover.js +49 -0
- package/dist/node/popover/popover.module.js +8 -0
- package/dist/node/popover/use-popover.js +57 -0
- package/dist/node/progress/progress.js +17 -0
- package/dist/node/progress/progress.module.js +8 -0
- package/dist/node/progress-bar/progress-bar.js +44 -0
- package/dist/node/progress-bar/progress-bar.module.js +13 -0
- package/dist/node/progress-circle/progress-circle.js +48 -0
- package/dist/node/progress-circle/progress-circle.module.js +11 -0
- package/dist/node/progress-indicator/progress-indicator.js +36 -0
- package/dist/node/progress-indicator/progress-indicator.module.js +12 -0
- package/dist/node/prose/prose.js +15 -0
- package/dist/node/prose/prose.module.js +5 -0
- package/dist/node/pull-to-refresh/pull-to-refresh.js +82 -0
- package/dist/node/pull-to-refresh/pull-to-refresh.module.js +11 -0
- package/dist/node/qr-code/encode.js +585 -0
- package/dist/node/qr-code/qr-code.js +41 -0
- package/dist/node/qr-code/qr-code.module.js +8 -0
- package/dist/node/radial-progress/radial-progress.js +28 -0
- package/dist/node/radial-progress/radial-progress.module.js +8 -0
- package/dist/node/radio/radio.js +49 -0
- package/dist/node/radio/radio.module.js +11 -0
- package/dist/node/radio-card/radio-card.js +63 -0
- package/dist/node/radio-card/radio-card.module.js +13 -0
- package/dist/node/rating-group/rating-group.js +37 -0
- package/dist/node/rating-group/rating-group.module.js +8 -0
- package/dist/node/react/src/index.js +138 -0
- package/dist/node/react/src/theme.js +54 -0
- package/dist/node/relative-time/relative-time.js +66 -0
- package/dist/node/relative-time/relative-time.module.js +5 -0
- package/dist/node/resizable/resizable.js +80 -0
- package/dist/node/resizable/resizable.module.js +10 -0
- package/dist/node/scroll-area/scroll-area.js +38 -0
- package/dist/node/scroll-area/scroll-area.module.js +5 -0
- package/dist/node/search/search.js +94 -0
- package/dist/node/search/search.module.js +11 -0
- package/dist/node/segmented-control/segmented-control.js +43 -0
- package/dist/node/segmented-control/segmented-control.module.js +8 -0
- package/dist/node/select/select.js +71 -0
- package/dist/node/select/select.module.js +13 -0
- package/dist/node/separator/separator.js +21 -0
- package/dist/node/separator/separator.module.js +5 -0
- package/dist/node/sheet/sheet.js +50 -0
- package/dist/node/sheet/sheet.module.js +11 -0
- package/dist/node/shell-header/shell-header.js +166 -0
- package/dist/node/shell-header/shell-header.module.js +25 -0
- package/dist/node/side-nav/side-nav.js +333 -0
- package/dist/node/side-nav/side-nav.module.js +33 -0
- package/dist/node/skeleton/skeleton.js +25 -0
- package/dist/node/skeleton/skeleton.module.js +9 -0
- package/dist/node/skip-nav/skip-nav.js +27 -0
- package/dist/node/skip-nav/skip-nav.module.js +5 -0
- package/dist/node/slider/slider.js +29 -0
- package/dist/node/slider/slider.module.js +9 -0
- package/dist/node/spinner/spinner.js +18 -0
- package/dist/node/spinner/spinner.module.js +8 -0
- package/dist/node/stack/stack.js +19 -0
- package/dist/node/stack/stack.module.js +8 -0
- package/dist/node/stat/stat.js +41 -0
- package/dist/node/stat/stat.module.js +13 -0
- package/dist/node/status/status.js +20 -0
- package/dist/node/status/status.module.js +9 -0
- package/dist/node/steps/steps.js +35 -0
- package/dist/node/steps/steps.module.js +10 -0
- package/dist/node/storage/src/drivers.js +36 -0
- package/dist/node/storage/src/persisted-signal.js +43 -0
- package/dist/node/structured-list/structured-list.js +101 -0
- package/dist/node/structured-list/structured-list.module.js +14 -0
- package/dist/node/swap/swap.js +36 -0
- package/dist/node/swap/swap.module.js +9 -0
- package/dist/node/swipe-item/swipe-item.js +62 -0
- package/dist/node/swipe-item/swipe-item.module.js +14 -0
- package/dist/node/switcher/switcher.js +32 -0
- package/dist/node/switcher/switcher.module.js +10 -0
- package/dist/node/tabs/tabs.js +95 -0
- package/dist/node/tabs/tabs.module.js +10 -0
- package/dist/node/tag/tag.js +26 -0
- package/dist/node/tag/tag.module.js +8 -0
- package/dist/node/tags-input/tags-input.js +64 -0
- package/dist/node/tags-input/tags-input.module.js +10 -0
- package/dist/node/text/text.js +18 -0
- package/dist/node/text/text.module.js +5 -0
- package/dist/node/textarea/textarea.js +56 -0
- package/dist/node/textarea/textarea.module.js +11 -0
- package/dist/node/tile/tile.js +39 -0
- package/dist/node/tile/tile.module.js +9 -0
- package/dist/node/time-picker/time-picker.js +62 -0
- package/dist/node/time-picker/time-picker.module.js +11 -0
- package/dist/node/timeline/timeline.js +41 -0
- package/dist/node/timeline/timeline.module.js +13 -0
- package/dist/node/toast/toast.js +85 -0
- package/dist/node/toast/toast.module.js +13 -0
- package/dist/node/toc/toc.js +42 -0
- package/dist/node/toc/toc.module.js +5 -0
- package/dist/node/toc/use-toc-from-region.js +18 -0
- package/dist/node/toggle/toggle.js +39 -0
- package/dist/node/toggle/toggle.module.js +10 -0
- package/dist/node/toggle-group/toggle-group.js +55 -0
- package/dist/node/toggle-group/toggle-group.module.js +8 -0
- package/dist/node/toggletip/toggletip.js +49 -0
- package/dist/node/toggletip/toggletip.module.js +9 -0
- package/dist/node/tooltip/tooltip.js +58 -0
- package/dist/node/tooltip/tooltip.module.js +8 -0
- package/dist/node/tree-view/tree-view.js +201 -0
- package/dist/node/tree-view/tree-view.module.js +15 -0
- package/dist/node/user/user.js +37 -0
- package/dist/node/user/user.module.js +11 -0
- package/dist/node/visually-hidden/visually-hidden.js +15 -0
- package/dist/node/visually-hidden/visually-hidden.module.js +5 -0
- package/dist/react/src/theme.js +35 -29
- package/package.json +4 -3
- package/readme.body.md +5 -5
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./form.module.js";
|
|
4
|
+
import { batch as t, cn as n, signal as r, useSignal as i, useSignals as a } from "@cascivo/core";
|
|
5
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
6
|
+
//#region ../components/src/form/form.tsx
|
|
7
|
+
function s(e) {
|
|
8
|
+
let t = e[0];
|
|
9
|
+
return t === void 0 ? "" : String(typeof t == "string" || typeof t == "number" ? t : t.key);
|
|
10
|
+
}
|
|
11
|
+
async function c(e, t) {
|
|
12
|
+
let n = await e["~standard"].validate(t);
|
|
13
|
+
if (!("issues" in n) || n.issues === void 0) return {};
|
|
14
|
+
let r = {};
|
|
15
|
+
for (let e of n.issues) {
|
|
16
|
+
let t = e.path && e.path.length > 0 ? s(e.path) : "";
|
|
17
|
+
t && !(t in r) && (r[t] = e.message);
|
|
18
|
+
}
|
|
19
|
+
return r;
|
|
20
|
+
}
|
|
21
|
+
function l(e) {
|
|
22
|
+
let n = r({ ...e.initialValues }), i = r({}), a = r({}), o = r(!1), s = async (t) => {
|
|
23
|
+
let n = {};
|
|
24
|
+
return e.schema && (n = await c(e.schema, t)), Object.keys(n).length === 0 && e.validate && (n = await e.validate(t)), n;
|
|
25
|
+
}, l = 0, u = (t, r) => {
|
|
26
|
+
if (n.value = {
|
|
27
|
+
...n.value,
|
|
28
|
+
[t]: r
|
|
29
|
+
}, !e.validateOnChange) return;
|
|
30
|
+
let a = ++l;
|
|
31
|
+
s(n.value).then((e) => {
|
|
32
|
+
if (a !== l) return;
|
|
33
|
+
let n = { ...i.value }, r = e[t];
|
|
34
|
+
r === void 0 ? delete n[t] : n[t] = r, i.value = n;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
values: n,
|
|
39
|
+
errors: i,
|
|
40
|
+
touched: a,
|
|
41
|
+
submitting: o,
|
|
42
|
+
setValue: u,
|
|
43
|
+
field(e) {
|
|
44
|
+
return {
|
|
45
|
+
get value() {
|
|
46
|
+
return n.value[e];
|
|
47
|
+
},
|
|
48
|
+
onChange: (t) => u(e, t),
|
|
49
|
+
onBlur: () => {
|
|
50
|
+
a.value = {
|
|
51
|
+
...a.value,
|
|
52
|
+
[e]: !0
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
get error() {
|
|
56
|
+
return i.value[e];
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
async submit(r) {
|
|
61
|
+
o.value = !0;
|
|
62
|
+
try {
|
|
63
|
+
let o = await s(n.value), c = Object.fromEntries(Object.keys(e.initialValues).map((e) => [e, !0]));
|
|
64
|
+
t(() => {
|
|
65
|
+
i.value = o, a.value = c;
|
|
66
|
+
}), Object.keys(o).length === 0 && await r(n.value);
|
|
67
|
+
} finally {
|
|
68
|
+
o.value = !1;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
reset() {
|
|
72
|
+
t(() => {
|
|
73
|
+
n.value = { ...e.initialValues }, i.value = {}, a.value = {};
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function u(e) {
|
|
79
|
+
a();
|
|
80
|
+
let t = i(null);
|
|
81
|
+
return t.peek() === null && (t.value = l(e)), t.peek();
|
|
82
|
+
}
|
|
83
|
+
function d({ form: t, onValid: r, children: i, className: a, ...s }) {
|
|
84
|
+
return /* @__PURE__ */ o("form", {
|
|
85
|
+
noValidate: !0,
|
|
86
|
+
className: n(e.form, a),
|
|
87
|
+
onSubmit: (e) => {
|
|
88
|
+
e.preventDefault(), t.submit(r);
|
|
89
|
+
},
|
|
90
|
+
...s,
|
|
91
|
+
children: i
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { d as Form, l as createForm, u as useForm };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./header.module.js";
|
|
4
|
+
import { cn as t, getLinkComponent as n, useSignals as r } from "@cascivo/core";
|
|
5
|
+
import { builtin as i, t as a } from "@cascivo/i18n";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
//#region ../components/src/header/header.tsx
|
|
8
|
+
function c({ brand: c, links: l, actions: u, sticky: d = !1, labels: f, className: p, ...m }) {
|
|
9
|
+
r();
|
|
10
|
+
let h = n(), g = f?.nav ?? a(i.header.nav);
|
|
11
|
+
return /* @__PURE__ */ s("header", {
|
|
12
|
+
role: "banner",
|
|
13
|
+
"data-sticky": d || void 0,
|
|
14
|
+
className: t(e.header, p),
|
|
15
|
+
...m,
|
|
16
|
+
children: [
|
|
17
|
+
c && /* @__PURE__ */ o("div", {
|
|
18
|
+
className: e.brand,
|
|
19
|
+
children: c
|
|
20
|
+
}),
|
|
21
|
+
l && l.length > 0 && /* @__PURE__ */ o("nav", {
|
|
22
|
+
"aria-label": g,
|
|
23
|
+
className: e.nav,
|
|
24
|
+
children: /* @__PURE__ */ o("ul", {
|
|
25
|
+
className: e.list,
|
|
26
|
+
children: l.map((t, n) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o(h, {
|
|
27
|
+
href: t.href,
|
|
28
|
+
"aria-current": t.active ? "page" : void 0,
|
|
29
|
+
"data-state": t.active ? "active" : void 0,
|
|
30
|
+
className: e.link,
|
|
31
|
+
children: t.label
|
|
32
|
+
}) }, t.id ?? `${n}-${t.href}`))
|
|
33
|
+
})
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ o("div", { className: e.spacer }),
|
|
36
|
+
u && /* @__PURE__ */ o("div", {
|
|
37
|
+
className: e.actions,
|
|
38
|
+
children: u
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { c as Header };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
var e = {
|
|
4
|
+
header: "_header_1n9di_2",
|
|
5
|
+
brand: "_brand_1n9di_20",
|
|
6
|
+
nav: "_nav_1n9di_35",
|
|
7
|
+
list: "_list_1n9di_39",
|
|
8
|
+
link: "_link_1n9di_48",
|
|
9
|
+
spacer: "_spacer_1n9di_80",
|
|
10
|
+
actions: "_actions_1n9di_84"
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as default };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./header-panel.module.js";
|
|
4
|
+
import { cn as t, useSignal as n, useSignalEffect 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";
|
|
8
|
+
//#region ../components/src/header-panel/header-panel.tsx
|
|
9
|
+
function u({ open: u, onClose: d, label: f, children: p, labels: m, className: h }) {
|
|
10
|
+
i();
|
|
11
|
+
let g = l(null), _ = l(null), v = n(u);
|
|
12
|
+
v.value = u;
|
|
13
|
+
let y = l(d);
|
|
14
|
+
return y.current = d, r(() => {
|
|
15
|
+
let e = g.current;
|
|
16
|
+
if (e) if (v.value) {
|
|
17
|
+
_.current = document.activeElement;
|
|
18
|
+
try {
|
|
19
|
+
e.showPopover();
|
|
20
|
+
} catch {}
|
|
21
|
+
e.focus();
|
|
22
|
+
} else {
|
|
23
|
+
try {
|
|
24
|
+
e.hidePopover();
|
|
25
|
+
} catch {}
|
|
26
|
+
_.current?.focus(), _.current = null;
|
|
27
|
+
}
|
|
28
|
+
}), r(() => {
|
|
29
|
+
let e = g.current;
|
|
30
|
+
if (!e) return;
|
|
31
|
+
let t = (e) => {
|
|
32
|
+
let t = "newState" in e ? e.newState === "closed" : !0;
|
|
33
|
+
v.peek() && t && y.current();
|
|
34
|
+
};
|
|
35
|
+
return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
|
|
36
|
+
}), /* @__PURE__ */ c("div", {
|
|
37
|
+
ref: g,
|
|
38
|
+
popover: "auto",
|
|
39
|
+
role: "region",
|
|
40
|
+
"aria-label": f,
|
|
41
|
+
tabIndex: -1,
|
|
42
|
+
"data-state": u ? "open" : "closed",
|
|
43
|
+
className: t(e.panel, h),
|
|
44
|
+
children: [/* @__PURE__ */ c("div", {
|
|
45
|
+
className: e.header,
|
|
46
|
+
children: [/* @__PURE__ */ s("span", {
|
|
47
|
+
className: e.title,
|
|
48
|
+
children: f
|
|
49
|
+
}), /* @__PURE__ */ s("button", {
|
|
50
|
+
type: "button",
|
|
51
|
+
"aria-label": m?.close ?? o(a.headerPanel.close),
|
|
52
|
+
className: e.close,
|
|
53
|
+
onClick: () => y.current(),
|
|
54
|
+
children: /* @__PURE__ */ s("svg", {
|
|
55
|
+
viewBox: "0 0 16 16",
|
|
56
|
+
width: "14",
|
|
57
|
+
height: "14",
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
children: /* @__PURE__ */ s("path", {
|
|
60
|
+
d: "M4 4l8 8M12 4l-8 8",
|
|
61
|
+
stroke: "currentColor",
|
|
62
|
+
strokeWidth: "1.5",
|
|
63
|
+
strokeLinecap: "round"
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
})]
|
|
67
|
+
}), /* @__PURE__ */ s("div", {
|
|
68
|
+
className: e.body,
|
|
69
|
+
children: p
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { u as HeaderPanel };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./heading.module.js";
|
|
4
|
+
import { cn as t } from "@cascivo/core";
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
//#region ../components/src/heading/heading.tsx
|
|
7
|
+
var r = {
|
|
8
|
+
1: "2xl",
|
|
9
|
+
2: "xl",
|
|
10
|
+
3: "lg",
|
|
11
|
+
4: "md",
|
|
12
|
+
5: "sm",
|
|
13
|
+
6: "sm"
|
|
14
|
+
};
|
|
15
|
+
function i({ level: i = 2, size: a, className: o, children: s, ...c }) {
|
|
16
|
+
return /* @__PURE__ */ n(`h${i}`, {
|
|
17
|
+
"data-size": a ?? r[i],
|
|
18
|
+
className: t(e.heading, o),
|
|
19
|
+
...c,
|
|
20
|
+
children: s
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { i as Heading };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { usePopover as e } from "../popover/use-popover.js";
|
|
4
|
+
import t from "./hover-card.module.js";
|
|
5
|
+
import { useSignalEffect as n, useSignals as r } from "@cascivo/core";
|
|
6
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
7
|
+
import { createContext as a, useRef as o } from "react";
|
|
8
|
+
//#region ../components/src/hover-card/hover-card.tsx
|
|
9
|
+
var s = a(null);
|
|
10
|
+
function c({ children: t, openDelay: r = 300, closeDelay: a = 100 }) {
|
|
11
|
+
let c = e(), l = o(void 0), u = o(void 0), d = o(r);
|
|
12
|
+
d.current = r;
|
|
13
|
+
let f = o(a);
|
|
14
|
+
f.current = a;
|
|
15
|
+
let p = {
|
|
16
|
+
...c,
|
|
17
|
+
open: () => {
|
|
18
|
+
clearTimeout(u.current), l.current = setTimeout(() => {
|
|
19
|
+
c.isOpen.value = !0;
|
|
20
|
+
}, d.current);
|
|
21
|
+
},
|
|
22
|
+
close: () => {
|
|
23
|
+
clearTimeout(l.current), u.current = setTimeout(() => {
|
|
24
|
+
c.isOpen.value = !1;
|
|
25
|
+
}, f.current);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return n(() => () => {
|
|
29
|
+
clearTimeout(l.current), clearTimeout(u.current);
|
|
30
|
+
}), /* @__PURE__ */ i(s.Provider, {
|
|
31
|
+
value: p,
|
|
32
|
+
children: t
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function l({ ctx: e, children: n }) {
|
|
36
|
+
r();
|
|
37
|
+
let { triggerRef: a, anchorName: o, open: s, close: c } = e;
|
|
38
|
+
return /* @__PURE__ */ i("span", {
|
|
39
|
+
ref: a,
|
|
40
|
+
style: { anchorName: o },
|
|
41
|
+
onMouseEnter: s,
|
|
42
|
+
onMouseLeave: c,
|
|
43
|
+
onFocus: s,
|
|
44
|
+
onBlur: c,
|
|
45
|
+
className: t.trigger,
|
|
46
|
+
children: n
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function u({ children: e }) {
|
|
50
|
+
return /* @__PURE__ */ i(s.Consumer, { children: (t) => {
|
|
51
|
+
if (!t) throw Error("HoverCardTrigger must be inside <HoverCard>");
|
|
52
|
+
return /* @__PURE__ */ i(l, {
|
|
53
|
+
ctx: t,
|
|
54
|
+
children: e
|
|
55
|
+
});
|
|
56
|
+
} });
|
|
57
|
+
}
|
|
58
|
+
function d({ ctx: e, children: n, className: a }) {
|
|
59
|
+
r();
|
|
60
|
+
let { popoverRef: o, anchorName: s, isOpen: c, open: l, close: u } = e;
|
|
61
|
+
return /* @__PURE__ */ i("div", {
|
|
62
|
+
ref: o,
|
|
63
|
+
popover: "auto",
|
|
64
|
+
role: "complementary",
|
|
65
|
+
"data-state": c.value ? "open" : "closed",
|
|
66
|
+
style: { positionAnchor: s },
|
|
67
|
+
onMouseEnter: l,
|
|
68
|
+
onMouseLeave: u,
|
|
69
|
+
className: [t.content, a].filter(Boolean).join(" "),
|
|
70
|
+
children: n
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function f({ children: e, className: t }) {
|
|
74
|
+
return /* @__PURE__ */ i(s.Consumer, { children: (n) => {
|
|
75
|
+
if (!n) throw Error("HoverCardContent must be inside <HoverCard>");
|
|
76
|
+
return /* @__PURE__ */ i(d, {
|
|
77
|
+
ctx: n,
|
|
78
|
+
...t !== void 0 && { className: t },
|
|
79
|
+
children: e
|
|
80
|
+
});
|
|
81
|
+
} });
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { c as HoverCard, f as HoverCardContent, u as HoverCardTrigger };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./icon-button.module.js";
|
|
4
|
+
import { Slot as t, cn as n } from "@cascivo/core";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
import { forwardRef as i } from "react";
|
|
7
|
+
//#region ../components/src/icon-button/icon-button.tsx
|
|
8
|
+
var a = i(function({ label: i, icon: a, size: o = "md", variant: s = "ghost", asChild: c = !1, className: l, children: u, ...d }, f) {
|
|
9
|
+
return /* @__PURE__ */ r(c ? t : "button", {
|
|
10
|
+
type: c ? void 0 : "button",
|
|
11
|
+
"aria-label": i,
|
|
12
|
+
"data-size": o,
|
|
13
|
+
"data-variant": s,
|
|
14
|
+
className: n(e.iconButton, l),
|
|
15
|
+
ref: f,
|
|
16
|
+
...d,
|
|
17
|
+
children: u ?? a
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { a as IconButton };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./image.module.js";
|
|
4
|
+
import { cn as t, createMachine as n, useMachine as r, useSignals as i } from "@cascivo/core";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
//#region ../components/src/image/image.tsx
|
|
7
|
+
var s = n({
|
|
8
|
+
initial: "loading",
|
|
9
|
+
states: {
|
|
10
|
+
loading: { on: {
|
|
11
|
+
LOADED: "loaded",
|
|
12
|
+
ERROR: "error"
|
|
13
|
+
} },
|
|
14
|
+
loaded: {},
|
|
15
|
+
error: {}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
function c({ src: n, alt: c = "", fallbackSrc: l, width: u, height: d, radius: f = "md", zoom: p = !1, removeWrapper: m = !1, isBlurred: h = !1, className: g, style: _, ...v }) {
|
|
19
|
+
i();
|
|
20
|
+
let [y, b] = r(s), x = y.value === "error", S = x && !l, C = x && l ? l : n, w = {
|
|
21
|
+
...u !== void 0 && { inlineSize: u },
|
|
22
|
+
...d !== void 0 && { blockSize: d }
|
|
23
|
+
};
|
|
24
|
+
return m ? /* @__PURE__ */ a("img", {
|
|
25
|
+
className: t(e.image, g),
|
|
26
|
+
src: C,
|
|
27
|
+
alt: c,
|
|
28
|
+
onLoad: () => b("LOADED"),
|
|
29
|
+
onError: () => b("ERROR"),
|
|
30
|
+
style: {
|
|
31
|
+
...w,
|
|
32
|
+
..._
|
|
33
|
+
},
|
|
34
|
+
...v
|
|
35
|
+
}) : /* @__PURE__ */ o("span", {
|
|
36
|
+
"data-state": y.value,
|
|
37
|
+
"data-radius": f,
|
|
38
|
+
"data-zoom": p || void 0,
|
|
39
|
+
"data-blurred": h || void 0,
|
|
40
|
+
className: t(e.wrapper, g),
|
|
41
|
+
style: {
|
|
42
|
+
...w,
|
|
43
|
+
..._
|
|
44
|
+
},
|
|
45
|
+
role: S ? "img" : void 0,
|
|
46
|
+
"aria-label": S ? c : void 0,
|
|
47
|
+
children: [y.value === "loading" && /* @__PURE__ */ a("span", {
|
|
48
|
+
className: e.placeholder,
|
|
49
|
+
"aria-hidden": "true"
|
|
50
|
+
}), S ? /* @__PURE__ */ a("span", {
|
|
51
|
+
className: e.fallback,
|
|
52
|
+
"aria-hidden": "true"
|
|
53
|
+
}) : /* @__PURE__ */ a("img", {
|
|
54
|
+
className: e.image,
|
|
55
|
+
src: C,
|
|
56
|
+
alt: c,
|
|
57
|
+
onLoad: () => b("LOADED"),
|
|
58
|
+
onError: () => b("ERROR"),
|
|
59
|
+
...v
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { c as Image };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
var e = {
|
|
4
|
+
wrapper: "_wrapper_1cf1d_2",
|
|
5
|
+
image: "_image_1cf1d_28",
|
|
6
|
+
placeholder: "_placeholder_1cf1d_47",
|
|
7
|
+
"cascade-image-shimmer": "_cascade-image-shimmer_1cf1d_1",
|
|
8
|
+
fallback: "_fallback_1cf1d_66"
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { e as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./indicator.module.js";
|
|
4
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
|
+
//#region ../components/src/indicator/indicator.tsx
|
|
6
|
+
function r({ children: r, overlay: i, placement: a = "top-end", className: o }) {
|
|
7
|
+
return /* @__PURE__ */ n("div", {
|
|
8
|
+
className: [e.indicator, o].filter(Boolean).join(" "),
|
|
9
|
+
"data-placement": a,
|
|
10
|
+
children: [r, /* @__PURE__ */ t("div", {
|
|
11
|
+
className: e.overlay,
|
|
12
|
+
"aria-hidden": !0,
|
|
13
|
+
children: i
|
|
14
|
+
})]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { r as Indicator };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Spinner as e } from "../spinner/spinner.js";
|
|
4
|
+
import t from "./inline-loading.module.js";
|
|
5
|
+
import { cn as n } from "@cascivo/core";
|
|
6
|
+
import { builtin as r, t as i } from "@cascivo/i18n";
|
|
7
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
8
|
+
//#region ../components/src/inline-loading/inline-loading.tsx
|
|
9
|
+
function s(e, t) {
|
|
10
|
+
switch (e) {
|
|
11
|
+
case "active": return t?.active ?? i(r.inlineLoading.active);
|
|
12
|
+
case "finished": return t?.finished ?? i(r.inlineLoading.finished);
|
|
13
|
+
case "error": return t?.error ?? i(r.inlineLoading.error);
|
|
14
|
+
default: return "";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function c({ status: n }) {
|
|
18
|
+
return n === "active" ? /* @__PURE__ */ a(e, {
|
|
19
|
+
size: "sm",
|
|
20
|
+
className: t.spinner
|
|
21
|
+
}) : n === "finished" ? /* @__PURE__ */ a("svg", {
|
|
22
|
+
className: t.icon,
|
|
23
|
+
viewBox: "0 0 16 16",
|
|
24
|
+
width: "16",
|
|
25
|
+
height: "16",
|
|
26
|
+
fill: "none",
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
children: /* @__PURE__ */ a("path", {
|
|
29
|
+
d: "M3.5 8.5l3 3 6-7",
|
|
30
|
+
stroke: "currentColor",
|
|
31
|
+
strokeWidth: "1.75",
|
|
32
|
+
strokeLinecap: "round",
|
|
33
|
+
strokeLinejoin: "round"
|
|
34
|
+
})
|
|
35
|
+
}) : n === "error" ? /* @__PURE__ */ o("svg", {
|
|
36
|
+
className: t.icon,
|
|
37
|
+
viewBox: "0 0 16 16",
|
|
38
|
+
width: "16",
|
|
39
|
+
height: "16",
|
|
40
|
+
fill: "none",
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
children: [/* @__PURE__ */ a("path", {
|
|
43
|
+
d: "M8 4.5v4M8 11h.01",
|
|
44
|
+
stroke: "currentColor",
|
|
45
|
+
strokeWidth: "1.75",
|
|
46
|
+
strokeLinecap: "round",
|
|
47
|
+
strokeLinejoin: "round"
|
|
48
|
+
}), /* @__PURE__ */ a("circle", {
|
|
49
|
+
cx: "8",
|
|
50
|
+
cy: "8",
|
|
51
|
+
r: "6.25",
|
|
52
|
+
stroke: "currentColor",
|
|
53
|
+
strokeWidth: "1.5"
|
|
54
|
+
})]
|
|
55
|
+
}) : null;
|
|
56
|
+
}
|
|
57
|
+
function l({ status: e, label: r, labels: i, className: l, ...u }) {
|
|
58
|
+
let d = r ?? s(e, i);
|
|
59
|
+
return /* @__PURE__ */ o("div", {
|
|
60
|
+
role: "status",
|
|
61
|
+
"aria-live": "polite",
|
|
62
|
+
"data-status": e,
|
|
63
|
+
className: n(t["inline-loading"], l),
|
|
64
|
+
...u,
|
|
65
|
+
children: [/* @__PURE__ */ a("span", {
|
|
66
|
+
className: t.indicator,
|
|
67
|
+
"aria-hidden": "true",
|
|
68
|
+
children: /* @__PURE__ */ a(c, { status: e })
|
|
69
|
+
}), d && /* @__PURE__ */ a("span", {
|
|
70
|
+
className: t.label,
|
|
71
|
+
children: d
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { l as InlineLoading };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./input.module.js";
|
|
4
|
+
import { cn as t, createMachine as n, useMachine as r } from "@cascivo/core";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
//#region ../components/src/input/input.tsx
|
|
7
|
+
var o = n({
|
|
8
|
+
initial: "idle",
|
|
9
|
+
states: {
|
|
10
|
+
idle: { on: { FOCUS: "focused" } },
|
|
11
|
+
focused: { on: { BLUR: "idle" } }
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
function s({ label: n, hint: s, error: c, size: l = "md", className: u, id: d, onFocus: f, onBlur: p, ...m }) {
|
|
15
|
+
let [h, g] = r(o), _ = d ?? (n ? `cascade-input-${n.toLowerCase().replace(/\s+/g, "-")}` : void 0);
|
|
16
|
+
return /* @__PURE__ */ a("div", {
|
|
17
|
+
className: t(e.wrapper, u),
|
|
18
|
+
"data-state": c ? "error" : h.value,
|
|
19
|
+
"data-size": l,
|
|
20
|
+
children: [
|
|
21
|
+
n && /* @__PURE__ */ i("label", {
|
|
22
|
+
className: e.label,
|
|
23
|
+
htmlFor: _,
|
|
24
|
+
children: n
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ i("input", {
|
|
27
|
+
id: _,
|
|
28
|
+
className: e.input,
|
|
29
|
+
"aria-invalid": c ? !0 : void 0,
|
|
30
|
+
"aria-describedby": c ? `${_}-error` : s ? `${_}-hint` : void 0,
|
|
31
|
+
onFocus: (e) => {
|
|
32
|
+
g("FOCUS"), f?.(e);
|
|
33
|
+
},
|
|
34
|
+
onBlur: (e) => {
|
|
35
|
+
g("BLUR"), p?.(e);
|
|
36
|
+
},
|
|
37
|
+
...m
|
|
38
|
+
}),
|
|
39
|
+
c && /* @__PURE__ */ i("span", {
|
|
40
|
+
id: `${_}-error`,
|
|
41
|
+
className: e.error,
|
|
42
|
+
role: "alert",
|
|
43
|
+
children: c
|
|
44
|
+
}),
|
|
45
|
+
!c && s && /* @__PURE__ */ i("span", {
|
|
46
|
+
id: `${_}-hint`,
|
|
47
|
+
className: e.hint,
|
|
48
|
+
children: s
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { s as Input };
|