@cascivo/react 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -11
- package/dist/combobox/combobox.js +73 -73
- package/dist/command-menu/command-menu.js +2 -2
- package/dist/date-picker/date-picker.js +95 -95
- package/dist/field/field.js +24 -15
- package/dist/filter/filter.js +12 -12
- package/dist/index.d.ts +74 -8
- package/dist/index.js +2 -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/number-input/number-input.js +41 -41
- package/dist/react/src/theme.js +42 -31
- 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/package.json +7 -6
- package/readme.body.md +24 -11
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./segmented-control.module.js";
|
|
4
|
+
import { cn as t } from "@cascivo/core";
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
//#region ../components/src/segmented-control/segmented-control.tsx
|
|
7
|
+
function r({ options: r, value: i, onValueChange: a, size: o = "md", disabled: s = !1, className: c, ...l }) {
|
|
8
|
+
function u(e, t) {
|
|
9
|
+
let n = r.filter((e) => !e.disabled), i = n.findIndex((e) => e.value === r[t]?.value);
|
|
10
|
+
if (e.key === "ArrowRight") {
|
|
11
|
+
e.preventDefault();
|
|
12
|
+
let t = n[(i + 1) % n.length];
|
|
13
|
+
t && a(t.value);
|
|
14
|
+
} else if (e.key === "ArrowLeft") {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
let t = n[(i - 1 + n.length) % n.length];
|
|
17
|
+
t && a(t.value);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ n("div", {
|
|
21
|
+
role: "group",
|
|
22
|
+
className: t(e.wrapper, c),
|
|
23
|
+
"data-size": o,
|
|
24
|
+
"data-disabled": s ? "" : void 0,
|
|
25
|
+
...l,
|
|
26
|
+
children: r.map((t, r) => /* @__PURE__ */ n("button", {
|
|
27
|
+
type: "button",
|
|
28
|
+
role: "radio",
|
|
29
|
+
"aria-checked": t.value === i,
|
|
30
|
+
"data-selected": t.value === i ? "" : void 0,
|
|
31
|
+
"data-size": o,
|
|
32
|
+
className: e.segment,
|
|
33
|
+
disabled: s || t.disabled,
|
|
34
|
+
onClick: () => {
|
|
35
|
+
t.disabled || a(t.value);
|
|
36
|
+
},
|
|
37
|
+
onKeyDown: (e) => u(e, r),
|
|
38
|
+
children: t.label
|
|
39
|
+
}, t.value))
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { r as SegmentedControl };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./select.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/select/select.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, placeholder: l, options: u, size: d = "md", className: f, id: p, defaultValue: m, value: h, onFocus: g, onBlur: _, ...v }) {
|
|
15
|
+
let [y, b] = r(o), x = p ?? (n ? `cascade-select-${n.toLowerCase().replace(/\s+/g, "-")}` : void 0), S = h !== void 0, C = l !== void 0;
|
|
16
|
+
return /* @__PURE__ */ a("div", {
|
|
17
|
+
className: t(e.wrapper, f),
|
|
18
|
+
"data-state": c ? "error" : y.value,
|
|
19
|
+
"data-size": d,
|
|
20
|
+
children: [
|
|
21
|
+
n && /* @__PURE__ */ i("label", {
|
|
22
|
+
className: e.label,
|
|
23
|
+
htmlFor: x,
|
|
24
|
+
children: n
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ a("div", {
|
|
27
|
+
className: e.field,
|
|
28
|
+
children: [/* @__PURE__ */ a("select", {
|
|
29
|
+
id: x,
|
|
30
|
+
className: e.select,
|
|
31
|
+
"aria-invalid": c ? !0 : void 0,
|
|
32
|
+
"aria-describedby": c ? `${x}-error` : s ? `${x}-hint` : void 0,
|
|
33
|
+
value: h,
|
|
34
|
+
defaultValue: !S && C ? m ?? "" : m,
|
|
35
|
+
onFocus: (e) => {
|
|
36
|
+
b("FOCUS"), g?.(e);
|
|
37
|
+
},
|
|
38
|
+
onBlur: (e) => {
|
|
39
|
+
b("BLUR"), _?.(e);
|
|
40
|
+
},
|
|
41
|
+
...v,
|
|
42
|
+
children: [C && /* @__PURE__ */ i("option", {
|
|
43
|
+
value: "",
|
|
44
|
+
disabled: !0,
|
|
45
|
+
children: l
|
|
46
|
+
}), u.map((e) => /* @__PURE__ */ i("option", {
|
|
47
|
+
value: e.value,
|
|
48
|
+
disabled: e.disabled,
|
|
49
|
+
children: e.label
|
|
50
|
+
}, e.value))]
|
|
51
|
+
}), /* @__PURE__ */ i("span", {
|
|
52
|
+
className: e.chevron,
|
|
53
|
+
"aria-hidden": "true"
|
|
54
|
+
})]
|
|
55
|
+
}),
|
|
56
|
+
c && /* @__PURE__ */ i("span", {
|
|
57
|
+
id: `${x}-error`,
|
|
58
|
+
className: e.error,
|
|
59
|
+
role: "alert",
|
|
60
|
+
children: c
|
|
61
|
+
}),
|
|
62
|
+
!c && s && /* @__PURE__ */ i("span", {
|
|
63
|
+
id: `${x}-hint`,
|
|
64
|
+
className: e.hint,
|
|
65
|
+
children: s
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { s as Select };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
var e = {
|
|
4
|
+
wrapper: "_wrapper_1b5d9_2",
|
|
5
|
+
label: "_label_1b5d9_24",
|
|
6
|
+
field: "_field_1b5d9_32",
|
|
7
|
+
select: "_select_1b5d9_37",
|
|
8
|
+
chevron: "_chevron_1b5d9_79",
|
|
9
|
+
error: "_error_1b5d9_92",
|
|
10
|
+
hint: "_hint_1b5d9_99"
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./separator.module.js";
|
|
4
|
+
import { cn as t } from "@cascivo/core";
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
//#region ../components/src/separator/separator.tsx
|
|
7
|
+
function r({ orientation: r = "horizontal", decorative: i = !1, className: a, ...o }) {
|
|
8
|
+
return r === "horizontal" && !i ? /* @__PURE__ */ n("hr", {
|
|
9
|
+
"data-orientation": "horizontal",
|
|
10
|
+
className: t(e.separator, a),
|
|
11
|
+
...o
|
|
12
|
+
}) : /* @__PURE__ */ n("div", {
|
|
13
|
+
role: i ? "none" : "separator",
|
|
14
|
+
"aria-orientation": i ? void 0 : r,
|
|
15
|
+
"data-orientation": r,
|
|
16
|
+
className: t(e.separator, a),
|
|
17
|
+
...o
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { r as Separator };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./sheet.module.js";
|
|
4
|
+
import { useSignal as t, useSignalEffect as n } from "@cascivo/core";
|
|
5
|
+
import { builtin as r, t as i } from "@cascivo/i18n";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import { useId as s, useRef as c } from "react";
|
|
8
|
+
//#region ../components/src/sheet/sheet.tsx
|
|
9
|
+
function l({ open: l, onClose: u, title: d, children: f, side: p = "end" }) {
|
|
10
|
+
let m = c(null), h = s(), g = t(l);
|
|
11
|
+
g.value = l;
|
|
12
|
+
let _ = c(u);
|
|
13
|
+
return _.current = u, n(() => {
|
|
14
|
+
let e = m.current;
|
|
15
|
+
if (e) if (g.value) try {
|
|
16
|
+
e.showPopover();
|
|
17
|
+
} catch {}
|
|
18
|
+
else try {
|
|
19
|
+
e.hidePopover();
|
|
20
|
+
} catch {}
|
|
21
|
+
}), /* @__PURE__ */ o("div", {
|
|
22
|
+
ref: m,
|
|
23
|
+
popover: "manual",
|
|
24
|
+
role: "dialog",
|
|
25
|
+
"aria-modal": "true",
|
|
26
|
+
"aria-labelledby": d == null ? void 0 : h,
|
|
27
|
+
"data-state": l ? "open" : "closed",
|
|
28
|
+
"data-side": p,
|
|
29
|
+
className: e.sheet,
|
|
30
|
+
children: [/* @__PURE__ */ o("div", {
|
|
31
|
+
className: e.header,
|
|
32
|
+
children: [d != null && /* @__PURE__ */ a("span", {
|
|
33
|
+
id: h,
|
|
34
|
+
className: e.title,
|
|
35
|
+
children: d
|
|
36
|
+
}), /* @__PURE__ */ a("button", {
|
|
37
|
+
type: "button",
|
|
38
|
+
"aria-label": i(r.sheet.close),
|
|
39
|
+
onClick: () => _.current(),
|
|
40
|
+
className: e.close,
|
|
41
|
+
children: "✕"
|
|
42
|
+
})]
|
|
43
|
+
}), /* @__PURE__ */ a("div", {
|
|
44
|
+
className: e.body,
|
|
45
|
+
children: f
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { l as Sheet };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { usePopover as e } from "../popover/use-popover.js";
|
|
4
|
+
import t from "./shell-header.module.js";
|
|
5
|
+
import { cn as n, getLinkComponent as r, useSignal as i, useSignalEffect as a, useSignals as o } from "@cascivo/core";
|
|
6
|
+
import { builtin as s, t as c } from "@cascivo/i18n";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
//#region ../components/src/shell-header/shell-header.tsx
|
|
9
|
+
function d(e) {
|
|
10
|
+
return typeof e == "object" && !!e && "name" in e;
|
|
11
|
+
}
|
|
12
|
+
function f(e) {
|
|
13
|
+
return "items" in e;
|
|
14
|
+
}
|
|
15
|
+
function p({ item: n }) {
|
|
16
|
+
o();
|
|
17
|
+
let s = r(), { triggerRef: c, popoverRef: d, isOpen: f, anchorName: p, toggle: m, close: h } = e(), g = n.items.some((e) => e.active), _ = i(!1);
|
|
18
|
+
a(() => {
|
|
19
|
+
if (!_.value || !f.value) return;
|
|
20
|
+
_.value = !1;
|
|
21
|
+
let e = d.current;
|
|
22
|
+
e && e.querySelector("[role=\"menuitem\"]")?.focus();
|
|
23
|
+
});
|
|
24
|
+
function v(e) {
|
|
25
|
+
e.key === "ArrowDown" ? (e.preventDefault(), f.value ? d.current?.querySelector("[role=\"menuitem\"]")?.focus() : (_.value = !0, m())) : e.key === "Escape" && (e.preventDefault(), h());
|
|
26
|
+
}
|
|
27
|
+
function y(e) {
|
|
28
|
+
let t = Array.from(d.current?.querySelectorAll("[role=\"menuitem\"]") ?? []), n = t.indexOf(document.activeElement);
|
|
29
|
+
e.key === "ArrowDown" ? (e.preventDefault(), t[(n + 1) % t.length]?.focus()) : e.key === "ArrowUp" ? (e.preventDefault(), t[(n - 1 + t.length) % t.length]?.focus()) : e.key === "Escape" && (h(), c.current?.focus());
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ u("li", {
|
|
32
|
+
className: t.navMenuWrapper,
|
|
33
|
+
children: [/* @__PURE__ */ u("button", {
|
|
34
|
+
ref: c,
|
|
35
|
+
type: "button",
|
|
36
|
+
"aria-haspopup": "menu",
|
|
37
|
+
"aria-expanded": f.value,
|
|
38
|
+
"data-state": g ? "active" : void 0,
|
|
39
|
+
style: { anchorName: p },
|
|
40
|
+
className: t.navMenuTrigger,
|
|
41
|
+
onClick: m,
|
|
42
|
+
onKeyDown: v,
|
|
43
|
+
children: [n.label, /* @__PURE__ */ l("svg", {
|
|
44
|
+
viewBox: "0 0 16 16",
|
|
45
|
+
width: "12",
|
|
46
|
+
height: "12",
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
className: t.chevron,
|
|
49
|
+
children: /* @__PURE__ */ l("path", {
|
|
50
|
+
d: "M4 6l4 4 4-4",
|
|
51
|
+
fill: "none",
|
|
52
|
+
stroke: "currentColor",
|
|
53
|
+
strokeWidth: "1.5",
|
|
54
|
+
strokeLinecap: "round",
|
|
55
|
+
strokeLinejoin: "round"
|
|
56
|
+
})
|
|
57
|
+
})]
|
|
58
|
+
}), /* @__PURE__ */ l("div", {
|
|
59
|
+
ref: d,
|
|
60
|
+
popover: "auto",
|
|
61
|
+
role: "menu",
|
|
62
|
+
"aria-label": n.label,
|
|
63
|
+
"data-state": f.value ? "open" : "closed",
|
|
64
|
+
style: { positionAnchor: p },
|
|
65
|
+
className: t.navMenuPanel,
|
|
66
|
+
onKeyDown: y,
|
|
67
|
+
children: n.items.map((e, n) => /* @__PURE__ */ l(s, {
|
|
68
|
+
href: e.href,
|
|
69
|
+
role: "menuitem",
|
|
70
|
+
"aria-current": e.active ? "page" : void 0,
|
|
71
|
+
"data-state": e.active ? "active" : void 0,
|
|
72
|
+
className: t.navMenuItem,
|
|
73
|
+
onClick: h,
|
|
74
|
+
children: e.label
|
|
75
|
+
}, e.id ?? `${n}-${e.href}`))
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function m({ brand: e, nav: i, actions: a, end: m, onMenuClick: h, menuExpanded: g, skipToContentHref: _ = "#cascade-main", labels: v, className: y }) {
|
|
80
|
+
o();
|
|
81
|
+
let b = r(), x = v?.nav ?? c(s.shellHeader.nav), S = g ? v?.closeMenu ?? c(s.shellHeader.closeMenu) : v?.openMenu ?? c(s.shellHeader.openMenu);
|
|
82
|
+
return /* @__PURE__ */ u("header", {
|
|
83
|
+
role: "banner",
|
|
84
|
+
className: n(t.header, y),
|
|
85
|
+
children: [
|
|
86
|
+
_ !== !1 && /* @__PURE__ */ l("a", {
|
|
87
|
+
href: _,
|
|
88
|
+
className: t.skipLink,
|
|
89
|
+
children: v?.skipToContent ?? c(s.shellHeader.skipToContent)
|
|
90
|
+
}),
|
|
91
|
+
h && /* @__PURE__ */ l("button", {
|
|
92
|
+
type: "button",
|
|
93
|
+
"aria-label": S,
|
|
94
|
+
"aria-expanded": g ?? !1,
|
|
95
|
+
className: t.menuButton,
|
|
96
|
+
onClick: h,
|
|
97
|
+
children: /* @__PURE__ */ l("svg", {
|
|
98
|
+
viewBox: "0 0 16 16",
|
|
99
|
+
width: "16",
|
|
100
|
+
height: "16",
|
|
101
|
+
"aria-hidden": "true",
|
|
102
|
+
children: /* @__PURE__ */ l("path", {
|
|
103
|
+
d: "M2 4h12M2 8h12M2 12h12",
|
|
104
|
+
stroke: "currentColor",
|
|
105
|
+
strokeWidth: "1.5",
|
|
106
|
+
strokeLinecap: "round"
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
}),
|
|
110
|
+
e != null && (d(e) ? /* @__PURE__ */ u(b, {
|
|
111
|
+
href: e.href ?? "/",
|
|
112
|
+
"aria-label": [e.prefix, e.name].filter(Boolean).join(" "),
|
|
113
|
+
className: t.brand,
|
|
114
|
+
children: [e.prefix && /* @__PURE__ */ l("span", {
|
|
115
|
+
className: t.brandPrefix,
|
|
116
|
+
children: e.prefix
|
|
117
|
+
}), /* @__PURE__ */ l("span", {
|
|
118
|
+
className: t.brandName,
|
|
119
|
+
children: e.name
|
|
120
|
+
})]
|
|
121
|
+
}) : /* @__PURE__ */ l("div", {
|
|
122
|
+
className: t.brand,
|
|
123
|
+
children: e
|
|
124
|
+
})),
|
|
125
|
+
i && i.length > 0 && /* @__PURE__ */ l("nav", {
|
|
126
|
+
"aria-label": x,
|
|
127
|
+
className: t.nav,
|
|
128
|
+
children: /* @__PURE__ */ l("ul", {
|
|
129
|
+
className: t.navList,
|
|
130
|
+
children: i.map((e, n) => f(e) ? /* @__PURE__ */ l(p, { item: e }, e.id ?? `${n}-${e.label}`) : /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(b, {
|
|
131
|
+
href: e.href,
|
|
132
|
+
"aria-current": e.active ? "page" : void 0,
|
|
133
|
+
"data-state": e.active ? "active" : void 0,
|
|
134
|
+
className: t.navLink,
|
|
135
|
+
...e.onClick ? { onClick: e.onClick } : {},
|
|
136
|
+
children: e.label
|
|
137
|
+
}) }, e.id ?? `${n}-${e.href}`))
|
|
138
|
+
})
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ l("div", { className: t.spacer }),
|
|
141
|
+
a && a.length > 0 && /* @__PURE__ */ l("div", {
|
|
142
|
+
className: t.actions,
|
|
143
|
+
children: a.map((e) => /* @__PURE__ */ l("button", {
|
|
144
|
+
type: "button",
|
|
145
|
+
"aria-label": e.label,
|
|
146
|
+
"aria-pressed": e.active ?? !1,
|
|
147
|
+
title: e.label,
|
|
148
|
+
"data-state": e.active ? "active" : void 0,
|
|
149
|
+
className: t.action,
|
|
150
|
+
onClick: e.onClick,
|
|
151
|
+
children: /* @__PURE__ */ l("span", {
|
|
152
|
+
className: t.actionIcon,
|
|
153
|
+
"aria-hidden": "true",
|
|
154
|
+
children: e.icon
|
|
155
|
+
})
|
|
156
|
+
}, e.id))
|
|
157
|
+
}),
|
|
158
|
+
m && /* @__PURE__ */ l("div", {
|
|
159
|
+
className: t.end,
|
|
160
|
+
children: m
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
export { m as ShellHeader };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
var e = {
|
|
4
|
+
header: "_header_80jhs_2",
|
|
5
|
+
skipLink: "_skipLink_80jhs_14",
|
|
6
|
+
menuButton: "_menuButton_80jhs_36",
|
|
7
|
+
brand: "_brand_80jhs_59",
|
|
8
|
+
brandPrefix: "_brandPrefix_80jhs_69",
|
|
9
|
+
brandName: "_brandName_80jhs_73",
|
|
10
|
+
nav: "_nav_80jhs_77",
|
|
11
|
+
navList: "_navList_80jhs_81",
|
|
12
|
+
navLink: "_navLink_80jhs_90",
|
|
13
|
+
navMenuWrapper: "_navMenuWrapper_80jhs_119",
|
|
14
|
+
navMenuTrigger: "_navMenuTrigger_80jhs_124",
|
|
15
|
+
chevron: "_chevron_80jhs_156",
|
|
16
|
+
navMenuPanel: "_navMenuPanel_80jhs_164",
|
|
17
|
+
navMenuItem: "_navMenuItem_80jhs_197",
|
|
18
|
+
spacer: "_spacer_80jhs_219",
|
|
19
|
+
actions: "_actions_80jhs_223",
|
|
20
|
+
action: "_action_80jhs_223",
|
|
21
|
+
actionIcon: "_actionIcon_80jhs_257",
|
|
22
|
+
end: "_end_80jhs_265"
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { e as default };
|