@cascivo/react 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion/accordion.js +46 -44
- package/dist/action-sheet/action-sheet.js +16 -16
- package/dist/alert-dialog/alert-dialog.js +34 -34
- package/dist/app-shell/app-shell.css +1 -1
- package/dist/app-shell/app-shell.js +14 -12
- package/dist/app-shell/app-shell.module.js +8 -8
- package/dist/avatar-group/avatar-group.js +6 -6
- package/dist/bottom-sheet/bottom-sheet.js +18 -18
- package/dist/button/button.js +15 -12
- package/dist/button-group/button-group.js +8 -8
- package/dist/carousel/carousel.js +20 -20
- package/dist/checkbox/checkbox.js +21 -21
- package/dist/checkbox-card/checkbox-card.js +15 -13
- package/dist/collapsible/collapsible.js +7 -7
- package/dist/color-picker/color-picker.js +26 -26
- package/dist/combobox/combobox.js +86 -86
- package/dist/command-menu/command-menu.js +111 -111
- package/dist/comparison/comparison.js +10 -10
- package/dist/context-menu/context-menu.js +9 -9
- package/dist/copy-button/copy-button.js +18 -16
- package/dist/data-table/data-table.js +1 -1
- package/dist/date-picker/date-picker.js +25 -25
- package/dist/date-range-picker/date-range-picker.js +26 -26
- package/dist/drawer/drawer.css +1 -1
- package/dist/drawer/drawer.js +18 -17
- package/dist/drawer/drawer.module.js +9 -9
- package/dist/dropdown/dropdown.js +48 -48
- package/dist/editable/editable.js +11 -11
- package/dist/fab/fab.js +53 -53
- package/dist/field/field.js +8 -8
- package/dist/file-uploader/file-uploader.js +19 -19
- package/dist/header-panel/header-panel.js +31 -31
- package/dist/hover-card/hover-card.js +21 -21
- package/dist/icon-button/icon-button.js +5 -5
- package/dist/index.d.ts +202 -194
- package/dist/input/input.js +22 -21
- package/dist/link/link.js +8 -6
- package/dist/log-viewer/log-viewer.js +26 -26
- package/dist/menu/menu.js +20 -20
- package/dist/menu-button/menu-button.js +48 -48
- package/dist/menubar/menubar.js +42 -42
- package/dist/modal/modal.css +1 -1
- package/dist/modal/modal.js +41 -35
- package/dist/modal/modal.module.js +8 -7
- package/dist/multi-select/multi-select.css +1 -1
- package/dist/multi-select/multi-select.js +57 -57
- package/dist/multi-select/multi-select.module.js +11 -11
- package/dist/native-select/native-select.js +13 -11
- package/dist/navigation-menu/navigation-menu.js +46 -46
- package/dist/node/accordion/accordion.js +46 -44
- package/dist/node/action-sheet/action-sheet.js +16 -16
- package/dist/node/alert-dialog/alert-dialog.js +34 -34
- package/dist/node/app-shell/app-shell.js +14 -12
- package/dist/node/app-shell/app-shell.module.js +8 -8
- package/dist/node/avatar-group/avatar-group.js +6 -6
- package/dist/node/bottom-sheet/bottom-sheet.js +18 -18
- package/dist/node/button/button.js +15 -12
- package/dist/node/button-group/button-group.js +8 -8
- package/dist/node/carousel/carousel.js +20 -20
- package/dist/node/checkbox/checkbox.js +21 -21
- package/dist/node/checkbox-card/checkbox-card.js +15 -13
- package/dist/node/collapsible/collapsible.js +7 -7
- package/dist/node/color-picker/color-picker.js +26 -26
- package/dist/node/combobox/combobox.js +86 -86
- package/dist/node/command-menu/command-menu.js +111 -111
- package/dist/node/comparison/comparison.js +10 -10
- package/dist/node/context-menu/context-menu.js +9 -9
- package/dist/node/copy-button/copy-button.js +18 -16
- package/dist/node/data-table/data-table.js +1 -1
- package/dist/node/date-picker/date-picker.js +25 -25
- package/dist/node/date-range-picker/date-range-picker.js +26 -26
- package/dist/node/drawer/drawer.js +18 -17
- package/dist/node/drawer/drawer.module.js +9 -9
- package/dist/node/dropdown/dropdown.js +48 -48
- package/dist/node/editable/editable.js +11 -11
- package/dist/node/fab/fab.js +53 -53
- package/dist/node/field/field.js +8 -8
- package/dist/node/file-uploader/file-uploader.js +19 -19
- package/dist/node/header-panel/header-panel.js +31 -31
- package/dist/node/hover-card/hover-card.js +21 -21
- package/dist/node/icon-button/icon-button.js +5 -5
- package/dist/node/input/input.js +22 -21
- package/dist/node/link/link.js +8 -6
- package/dist/node/log-viewer/log-viewer.js +26 -26
- package/dist/node/menu/menu.js +20 -20
- package/dist/node/menu-button/menu-button.js +48 -48
- package/dist/node/menubar/menubar.js +42 -42
- package/dist/node/modal/modal.js +41 -35
- package/dist/node/modal/modal.module.js +8 -7
- package/dist/node/multi-select/multi-select.js +57 -57
- package/dist/node/multi-select/multi-select.module.js +11 -11
- package/dist/node/native-select/native-select.js +13 -11
- package/dist/node/navigation-menu/navigation-menu.js +46 -46
- package/dist/node/notification/notification.js +26 -26
- package/dist/node/number-input/number-input.js +52 -50
- package/dist/node/otp-input/otp-input.js +8 -8
- package/dist/node/password-input/password-input.js +28 -27
- package/dist/node/popover/popover.js +26 -24
- package/dist/node/pull-to-refresh/pull-to-refresh.js +13 -13
- package/dist/node/radial-progress/radial-progress.js +5 -5
- package/dist/node/radio/radio.js +23 -22
- package/dist/node/radio-card/radio-card.js +27 -26
- package/dist/node/react/src/index.js +3 -3
- package/dist/node/react/src/theme.js +30 -19
- package/dist/node/resizable/resizable.js +11 -11
- package/dist/node/scroll-area/scroll-area.js +4 -4
- package/dist/node/search/search.js +49 -49
- package/dist/node/select/select.js +27 -26
- package/dist/node/sheet/sheet.js +11 -10
- package/dist/node/sheet/sheet.module.js +5 -5
- package/dist/node/side-nav/side-nav.js +91 -91
- package/dist/node/skip-nav/skip-nav.js +12 -12
- package/dist/node/slider/slider.js +13 -11
- package/dist/node/structured-list/structured-list.js +23 -23
- package/dist/node/tabs/tabs.js +49 -47
- package/dist/node/tags-input/tags-input.js +35 -35
- package/dist/node/textarea/textarea.js +22 -21
- package/dist/node/time-picker/time-picker.js +22 -21
- package/dist/node/toast/toast.js +15 -15
- package/dist/node/toc/toc.js +8 -8
- package/dist/node/toggle/toggle.js +15 -13
- package/dist/node/toggle-group/toggle-group.js +10 -10
- package/dist/node/toggletip/toggletip.js +9 -9
- package/dist/node/tooltip/tooltip.js +5 -5
- package/dist/node/tree-view/tree-view.js +32 -32
- package/dist/notification/notification.js +26 -26
- package/dist/number-input/number-input.js +52 -50
- package/dist/otp-input/otp-input.js +8 -8
- package/dist/password-input/password-input.js +28 -27
- package/dist/popover/popover.js +26 -24
- package/dist/pull-to-refresh/pull-to-refresh.js +13 -13
- package/dist/radial-progress/radial-progress.js +5 -5
- package/dist/radio/radio.js +23 -22
- package/dist/radio-card/radio-card.js +27 -26
- package/dist/react/src/index.js +3 -3
- package/dist/react/src/theme.js +30 -19
- package/dist/resizable/resizable.js +11 -11
- package/dist/scroll-area/scroll-area.js +4 -4
- package/dist/search/search.js +49 -49
- package/dist/select/select.js +27 -26
- package/dist/sheet/sheet.css +1 -1
- package/dist/sheet/sheet.js +11 -10
- package/dist/sheet/sheet.module.js +5 -5
- package/dist/side-nav/side-nav.js +91 -91
- package/dist/skip-nav/skip-nav.js +12 -12
- package/dist/slider/slider.js +13 -11
- package/dist/structured-list/structured-list.js +23 -23
- package/dist/styles.css +55 -5
- package/dist/tabs/tabs.js +49 -47
- package/dist/tags-input/tags-input.js +35 -35
- package/dist/textarea/textarea.js +22 -21
- package/dist/time-picker/time-picker.js +22 -21
- package/dist/toast/toast.js +15 -15
- package/dist/toc/toc.js +8 -8
- package/dist/toggle/toggle.js +15 -13
- package/dist/toggle-group/toggle-group.js +10 -10
- package/dist/toggletip/toggletip.js +9 -9
- package/dist/tooltip/tooltip.js +5 -5
- package/dist/tree-view/tree-view.js +32 -32
- package/package.json +10 -4
|
@@ -2,98 +2,98 @@
|
|
|
2
2
|
|
|
3
3
|
import { usePopover as e } from "../popover/use-popover.js";
|
|
4
4
|
import t from "./multi-select.module.js";
|
|
5
|
-
import { cn as n,
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { cn as n, focusElement as r, useComputed as i, useSignal as a, useSignalEffect as o, useSignals as s } from "@cascivo/core";
|
|
6
|
+
import { useRef as c } from "react";
|
|
7
|
+
import { builtin as l, t as u } from "@cascivo/i18n";
|
|
8
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
9
|
//#region ../components/src/multi-select/multi-select.tsx
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
let e =
|
|
14
|
-
return e ?
|
|
10
|
+
function p({ options: p, value: m, onValueChange: h, placeholder: g, disabled: _ = !1, labels: v, className: y, ...b }) {
|
|
11
|
+
s();
|
|
12
|
+
let x = e({ placement: "bottom" }), S = a(""), C = a(-1), w = c(null), T = c(null), E = i(() => {
|
|
13
|
+
let e = S.value.toLowerCase();
|
|
14
|
+
return e ? p.filter((t) => t.label.toLowerCase().includes(e)) : p;
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}),
|
|
19
|
-
let e =
|
|
20
|
-
if (!e || !
|
|
16
|
+
o(() => {
|
|
17
|
+
x.isOpen.value ? (C.value = -1, setTimeout(() => r(T.current), 0)) : S.value = "";
|
|
18
|
+
}), o(() => {
|
|
19
|
+
let e = w.current;
|
|
20
|
+
if (!e || !x.isOpen.value) return;
|
|
21
21
|
let t = (e) => {
|
|
22
|
-
let t =
|
|
23
|
-
if (e.key === "ArrowDown") e.preventDefault(),
|
|
24
|
-
else if (e.key === "ArrowUp") e.preventDefault(),
|
|
22
|
+
let t = E.value;
|
|
23
|
+
if (e.key === "ArrowDown") e.preventDefault(), C.value = Math.min(C.value + 1, t.length - 1);
|
|
24
|
+
else if (e.key === "ArrowUp") e.preventDefault(), C.value = Math.max(C.value - 1, -1);
|
|
25
25
|
else if (e.key === " " || e.key === "Enter") {
|
|
26
|
-
let n = t[
|
|
27
|
-
n && !n.disabled && (e.preventDefault(),
|
|
28
|
-
} else e.key === "Escape" &&
|
|
26
|
+
let n = t[C.value];
|
|
27
|
+
n && !n.disabled && (e.preventDefault(), D(n.value));
|
|
28
|
+
} else e.key === "Escape" && x.close();
|
|
29
29
|
};
|
|
30
30
|
return e.addEventListener("keydown", t), () => e.removeEventListener("keydown", t);
|
|
31
31
|
});
|
|
32
|
-
function
|
|
33
|
-
|
|
32
|
+
function D(e) {
|
|
33
|
+
m.includes(e) ? h(m.filter((t) => t !== e)) : h([...m, e]);
|
|
34
34
|
}
|
|
35
|
-
let
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
-
className: n(t.wrapper,
|
|
38
|
-
...
|
|
39
|
-
children: [/* @__PURE__ */
|
|
40
|
-
ref:
|
|
35
|
+
let O = m.length === 0 ? g ?? v?.placeholder ?? u(l.multiSelect.placeholder) : v?.selected ? v.selected(m.length) : u(l.multiSelect.selected, { count: String(m.length) }), k = v?.search ?? u(l.multiSelect.search), A = v?.noResults ?? u(l.multiSelect.noResults);
|
|
36
|
+
return /* @__PURE__ */ f("div", {
|
|
37
|
+
className: n(t.wrapper, y),
|
|
38
|
+
...b,
|
|
39
|
+
children: [/* @__PURE__ */ f("button", {
|
|
40
|
+
ref: x.triggerRef,
|
|
41
41
|
type: "button",
|
|
42
42
|
className: t.trigger,
|
|
43
43
|
"aria-haspopup": "listbox",
|
|
44
|
-
"aria-expanded":
|
|
45
|
-
disabled:
|
|
46
|
-
style: { anchorName:
|
|
47
|
-
onClick: () =>
|
|
48
|
-
children: [/* @__PURE__ */
|
|
44
|
+
"aria-expanded": x.isOpen.value,
|
|
45
|
+
disabled: _,
|
|
46
|
+
style: { anchorName: x.anchorName },
|
|
47
|
+
onClick: () => x.toggle(),
|
|
48
|
+
children: [/* @__PURE__ */ d("span", {
|
|
49
49
|
className: t["trigger-label"],
|
|
50
|
-
children:
|
|
51
|
-
}), /* @__PURE__ */
|
|
50
|
+
children: O
|
|
51
|
+
}), /* @__PURE__ */ d("span", {
|
|
52
52
|
className: t.chevron,
|
|
53
53
|
"aria-hidden": "true"
|
|
54
54
|
})]
|
|
55
|
-
}), /* @__PURE__ */
|
|
56
|
-
ref:
|
|
55
|
+
}), /* @__PURE__ */ f("div", {
|
|
56
|
+
ref: x.popoverRef,
|
|
57
57
|
popover: "auto",
|
|
58
58
|
className: t.panel,
|
|
59
|
-
style: { positionAnchor:
|
|
59
|
+
style: { positionAnchor: x.anchorName },
|
|
60
60
|
tabIndex: -1,
|
|
61
|
-
children: [/* @__PURE__ */
|
|
61
|
+
children: [/* @__PURE__ */ d("div", {
|
|
62
62
|
className: t["search-row"],
|
|
63
|
-
children: /* @__PURE__ */
|
|
64
|
-
ref:
|
|
63
|
+
children: /* @__PURE__ */ d("input", {
|
|
64
|
+
ref: T,
|
|
65
65
|
type: "search",
|
|
66
66
|
className: t.search,
|
|
67
|
-
placeholder:
|
|
68
|
-
value:
|
|
67
|
+
placeholder: k,
|
|
68
|
+
value: S.value,
|
|
69
69
|
onChange: (e) => {
|
|
70
|
-
|
|
70
|
+
S.value = e.currentTarget.value, C.value = -1;
|
|
71
71
|
}
|
|
72
72
|
})
|
|
73
|
-
}), /* @__PURE__ */
|
|
74
|
-
ref:
|
|
73
|
+
}), /* @__PURE__ */ d("div", {
|
|
74
|
+
ref: w,
|
|
75
75
|
role: "listbox",
|
|
76
76
|
"aria-multiselectable": "true",
|
|
77
|
-
"aria-label":
|
|
77
|
+
"aria-label": v?.label ?? u(l.multiSelect.label),
|
|
78
78
|
className: t.options,
|
|
79
|
-
children:
|
|
79
|
+
children: E.value.length === 0 ? /* @__PURE__ */ d("div", {
|
|
80
80
|
className: t["no-results"],
|
|
81
|
-
children:
|
|
82
|
-
}) :
|
|
81
|
+
children: A
|
|
82
|
+
}) : E.value.map((e, n) => /* @__PURE__ */ f("div", {
|
|
83
83
|
role: "option",
|
|
84
|
-
"aria-selected":
|
|
84
|
+
"aria-selected": m.includes(e.value),
|
|
85
85
|
"aria-disabled": e.disabled,
|
|
86
|
-
"data-active": n ===
|
|
87
|
-
"data-selected":
|
|
86
|
+
"data-active": n === C.value ? "" : void 0,
|
|
87
|
+
"data-selected": m.includes(e.value) ? "" : void 0,
|
|
88
88
|
"data-disabled": e.disabled ? "" : void 0,
|
|
89
89
|
className: t.option,
|
|
90
90
|
onMouseDown: (t) => {
|
|
91
|
-
t.preventDefault(), e.disabled ||
|
|
91
|
+
t.preventDefault(), e.disabled || D(e.value);
|
|
92
92
|
},
|
|
93
93
|
onMouseEnter: () => {
|
|
94
|
-
|
|
94
|
+
C.value = n;
|
|
95
95
|
},
|
|
96
|
-
children: [/* @__PURE__ */
|
|
96
|
+
children: [/* @__PURE__ */ d("span", {
|
|
97
97
|
className: t.checkbox,
|
|
98
98
|
"aria-hidden": "true"
|
|
99
99
|
}), e.label]
|
|
@@ -103,4 +103,4 @@ function f({ options: f, value: p, onValueChange: m, placeholder: h, disabled: g
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
//#endregion
|
|
106
|
-
export {
|
|
106
|
+
export { p as MultiSelect };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
var e = {
|
|
4
|
-
wrapper: "
|
|
5
|
-
trigger: "
|
|
6
|
-
"trigger-label": "_trigger-
|
|
7
|
-
chevron: "
|
|
8
|
-
panel: "
|
|
9
|
-
"search-row": "_search-
|
|
10
|
-
search: "
|
|
11
|
-
options: "
|
|
12
|
-
option: "
|
|
13
|
-
checkbox: "
|
|
14
|
-
"no-results": "_no-
|
|
4
|
+
wrapper: "_wrapper_1fi6e_2",
|
|
5
|
+
trigger: "_trigger_1fi6e_12",
|
|
6
|
+
"trigger-label": "_trigger-label_1fi6e_51",
|
|
7
|
+
chevron: "_chevron_1fi6e_63",
|
|
8
|
+
panel: "_panel_1fi6e_83",
|
|
9
|
+
"search-row": "_search-row_1fi6e_128",
|
|
10
|
+
search: "_search_1fi6e_128",
|
|
11
|
+
options: "_options_1fi6e_149",
|
|
12
|
+
option: "_option_1fi6e_149",
|
|
13
|
+
checkbox: "_checkbox_1fi6e_177",
|
|
14
|
+
"no-results": "_no-results_1fi6e_192"
|
|
15
15
|
};
|
|
16
16
|
//#endregion
|
|
17
17
|
export { e as default };
|
|
@@ -2,36 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./native-select.module.js";
|
|
4
4
|
import { cn as t } from "@cascivo/core";
|
|
5
|
-
import {
|
|
5
|
+
import { forwardRef as n } from "react";
|
|
6
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
7
|
//#region ../components/src/native-select/native-select.tsx
|
|
7
|
-
|
|
8
|
-
let
|
|
9
|
-
return /* @__PURE__ */
|
|
8
|
+
var a = n(function({ options: n, children: a, size: o = "md", invalid: s, disabled: c, placeholder: l, value: u, defaultValue: d, className: f, ...p }, m) {
|
|
9
|
+
let h = u !== void 0, g = l !== void 0;
|
|
10
|
+
return /* @__PURE__ */ i("div", {
|
|
10
11
|
className: t(e.root, f),
|
|
11
12
|
"data-size": o,
|
|
12
13
|
"data-invalid": s || void 0,
|
|
13
|
-
children: [/* @__PURE__ */
|
|
14
|
+
children: [/* @__PURE__ */ i("select", {
|
|
15
|
+
ref: m,
|
|
14
16
|
className: e.select,
|
|
15
17
|
disabled: c,
|
|
16
18
|
"aria-invalid": s || void 0,
|
|
17
19
|
value: u,
|
|
18
|
-
defaultValue: !
|
|
20
|
+
defaultValue: !h && g ? d ?? "" : d,
|
|
19
21
|
...p,
|
|
20
|
-
children: [
|
|
22
|
+
children: [g && /* @__PURE__ */ r("option", {
|
|
21
23
|
value: "",
|
|
22
24
|
disabled: !0,
|
|
23
25
|
hidden: !0,
|
|
24
26
|
children: l
|
|
25
|
-
}),
|
|
27
|
+
}), n ? n.map((e) => /* @__PURE__ */ r("option", {
|
|
26
28
|
value: e.value,
|
|
27
29
|
disabled: e.disabled,
|
|
28
30
|
children: e.label
|
|
29
31
|
}, e.value)) : a]
|
|
30
|
-
}), /* @__PURE__ */
|
|
32
|
+
}), /* @__PURE__ */ r("span", {
|
|
31
33
|
className: e.chevron,
|
|
32
34
|
"aria-hidden": "true"
|
|
33
35
|
})]
|
|
34
36
|
});
|
|
35
|
-
}
|
|
37
|
+
});
|
|
36
38
|
//#endregion
|
|
37
|
-
export {
|
|
39
|
+
export { a as NativeSelect };
|
|
@@ -1,92 +1,92 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import e from "./navigation-menu.module.js";
|
|
4
|
-
import { DismissableLayer as t, Presence as n, cn as r,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { DismissableLayer as t, Presence as n, cn as r, focusElement as i, getLinkComponent as a, useAnchorPosition as o, useRovingFocus as s, useSignal as c, useSignals as l } from "@cascivo/core";
|
|
5
|
+
import { useId as u, useRef as d } from "react";
|
|
6
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
7
7
|
//#region ../components/src/navigation-menu/navigation-menu.tsx
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
let
|
|
8
|
+
function m({ items: t, "aria-label": n, orientation: i = "horizontal", className: a }) {
|
|
9
|
+
l();
|
|
10
|
+
let o = u(), d = c(null), p = s({
|
|
11
11
|
orientation: i,
|
|
12
12
|
loop: !0
|
|
13
13
|
});
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ f("nav", {
|
|
15
15
|
"aria-label": n,
|
|
16
16
|
className: r(e.nav, a),
|
|
17
17
|
"data-orientation": i,
|
|
18
|
-
children: /* @__PURE__ */
|
|
18
|
+
children: /* @__PURE__ */ f("ul", {
|
|
19
19
|
role: "list",
|
|
20
20
|
className: e.list,
|
|
21
|
-
children: t.map((e, t) => /* @__PURE__ */
|
|
21
|
+
children: t.map((e, t) => /* @__PURE__ */ f(h, {
|
|
22
22
|
item: e,
|
|
23
|
-
baseId:
|
|
24
|
-
openId:
|
|
23
|
+
baseId: o,
|
|
24
|
+
openId: d,
|
|
25
25
|
itemProps: p.getItemProps(t)
|
|
26
26
|
}, e.id))
|
|
27
27
|
})
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
let
|
|
33
|
-
anchorRef:
|
|
34
|
-
floatingRef:
|
|
30
|
+
function h({ item: t, baseId: r, openId: s, itemProps: c }) {
|
|
31
|
+
l();
|
|
32
|
+
let u = d(null), m = d(null), h = t.content != null, _ = s.value === t.id, v = `${r}-panel-${t.id}`, { anchorStyle: y, floatingStyle: b } = o({
|
|
33
|
+
anchorRef: u,
|
|
34
|
+
floatingRef: m,
|
|
35
35
|
placement: "bottom-start",
|
|
36
|
-
enabled:
|
|
37
|
-
}), { ref:
|
|
38
|
-
if (!
|
|
39
|
-
let n =
|
|
40
|
-
return /* @__PURE__ */
|
|
36
|
+
enabled: _
|
|
37
|
+
}), { ref: x, onKeyDown: S, ...C } = c;
|
|
38
|
+
if (!h) {
|
|
39
|
+
let n = a();
|
|
40
|
+
return /* @__PURE__ */ f("li", {
|
|
41
41
|
className: e.item,
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
-
ref: (e) =>
|
|
42
|
+
children: /* @__PURE__ */ f(n, {
|
|
43
|
+
ref: (e) => x(e),
|
|
44
44
|
href: t.href,
|
|
45
45
|
className: e.link,
|
|
46
|
-
onKeyDown:
|
|
47
|
-
...
|
|
46
|
+
onKeyDown: S,
|
|
47
|
+
...C,
|
|
48
48
|
children: t.label
|
|
49
49
|
})
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ p("li", {
|
|
53
53
|
className: e.item,
|
|
54
|
-
children: [/* @__PURE__ */
|
|
54
|
+
children: [/* @__PURE__ */ f("button", {
|
|
55
55
|
ref: (e) => {
|
|
56
|
-
|
|
56
|
+
u.current = e, x(e);
|
|
57
57
|
},
|
|
58
58
|
type: "button",
|
|
59
|
-
"aria-expanded":
|
|
60
|
-
"aria-controls":
|
|
61
|
-
"data-state":
|
|
59
|
+
"aria-expanded": _,
|
|
60
|
+
"aria-controls": v,
|
|
61
|
+
"data-state": _ ? "open" : "closed",
|
|
62
62
|
className: e.trigger,
|
|
63
|
-
style:
|
|
63
|
+
style: y,
|
|
64
64
|
onClick: () => {
|
|
65
|
-
|
|
65
|
+
s.value = _ ? null : t.id;
|
|
66
66
|
},
|
|
67
67
|
onKeyDown: (e) => {
|
|
68
|
-
|
|
68
|
+
S(e), !e.defaultPrevented && e.key === "Escape" && (s.value = null);
|
|
69
69
|
},
|
|
70
|
-
...
|
|
70
|
+
...C,
|
|
71
71
|
children: t.label
|
|
72
|
-
}), /* @__PURE__ */
|
|
73
|
-
present:
|
|
74
|
-
children: /* @__PURE__ */
|
|
75
|
-
panelId:
|
|
76
|
-
floatingRef:
|
|
77
|
-
floatingStyle:
|
|
72
|
+
}), /* @__PURE__ */ f(n, {
|
|
73
|
+
present: _,
|
|
74
|
+
children: /* @__PURE__ */ f(g, {
|
|
75
|
+
panelId: v,
|
|
76
|
+
floatingRef: m,
|
|
77
|
+
floatingStyle: b,
|
|
78
78
|
onClose: () => {
|
|
79
|
-
|
|
79
|
+
s.value = null, i(u.current);
|
|
80
80
|
},
|
|
81
81
|
children: t.content
|
|
82
82
|
})
|
|
83
83
|
})]
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
return /* @__PURE__ */
|
|
86
|
+
function g({ panelId: n, floatingRef: r, floatingStyle: i, onClose: a, children: o }) {
|
|
87
|
+
return /* @__PURE__ */ f(t, {
|
|
88
88
|
onDismiss: a,
|
|
89
|
-
children: /* @__PURE__ */
|
|
89
|
+
children: /* @__PURE__ */ f("div", {
|
|
90
90
|
ref: r,
|
|
91
91
|
id: n,
|
|
92
92
|
className: e.panel,
|
|
@@ -96,4 +96,4 @@ function h({ panelId: n, floatingRef: r, floatingStyle: i, onClose: a, children:
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
//#endregion
|
|
99
|
-
export {
|
|
99
|
+
export { m as NavigationMenu };
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./notification.module.js";
|
|
4
4
|
import { Presence as t, cn as n, normalizeTone as r, useSignal as i, useSignals as a } from "@cascivo/core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useRef as o } from "react";
|
|
6
|
+
import { builtin as s, t as c } from "@cascivo/i18n";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/notification/notification.tsx
|
|
9
9
|
var d = {
|
|
10
10
|
neutral: "neutral",
|
|
@@ -14,73 +14,73 @@ var d = {
|
|
|
14
14
|
danger: "error"
|
|
15
15
|
}, f = new Set(["warning", "error"]), p = 160;
|
|
16
16
|
function m({ variant: e }) {
|
|
17
|
-
return e === "success" ? /* @__PURE__ */
|
|
17
|
+
return e === "success" ? /* @__PURE__ */ u("svg", {
|
|
18
18
|
viewBox: "0 0 20 20",
|
|
19
19
|
width: "20",
|
|
20
20
|
height: "20",
|
|
21
21
|
fill: "none",
|
|
22
22
|
"aria-hidden": "true",
|
|
23
|
-
children: [/* @__PURE__ */
|
|
23
|
+
children: [/* @__PURE__ */ l("circle", {
|
|
24
24
|
cx: "10",
|
|
25
25
|
cy: "10",
|
|
26
26
|
r: "8",
|
|
27
27
|
stroke: "currentColor",
|
|
28
28
|
strokeWidth: "1.5"
|
|
29
|
-
}), /* @__PURE__ */
|
|
29
|
+
}), /* @__PURE__ */ l("path", {
|
|
30
30
|
d: "M6.5 10.5l2.5 2.5 4.5-5",
|
|
31
31
|
stroke: "currentColor",
|
|
32
32
|
strokeWidth: "1.5",
|
|
33
33
|
strokeLinecap: "round",
|
|
34
34
|
strokeLinejoin: "round"
|
|
35
35
|
})]
|
|
36
|
-
}) : e === "warning" ? /* @__PURE__ */
|
|
36
|
+
}) : e === "warning" ? /* @__PURE__ */ u("svg", {
|
|
37
37
|
viewBox: "0 0 20 20",
|
|
38
38
|
width: "20",
|
|
39
39
|
height: "20",
|
|
40
40
|
fill: "none",
|
|
41
41
|
"aria-hidden": "true",
|
|
42
|
-
children: [/* @__PURE__ */
|
|
42
|
+
children: [/* @__PURE__ */ l("path", {
|
|
43
43
|
d: "M10 2.5L18.5 17H1.5L10 2.5z",
|
|
44
44
|
stroke: "currentColor",
|
|
45
45
|
strokeWidth: "1.5",
|
|
46
46
|
strokeLinejoin: "round"
|
|
47
|
-
}), /* @__PURE__ */
|
|
47
|
+
}), /* @__PURE__ */ l("path", {
|
|
48
48
|
d: "M10 8v3.5M10 14h.01",
|
|
49
49
|
stroke: "currentColor",
|
|
50
50
|
strokeWidth: "1.5",
|
|
51
51
|
strokeLinecap: "round"
|
|
52
52
|
})]
|
|
53
|
-
}) : e === "error" ? /* @__PURE__ */
|
|
53
|
+
}) : e === "error" ? /* @__PURE__ */ u("svg", {
|
|
54
54
|
viewBox: "0 0 20 20",
|
|
55
55
|
width: "20",
|
|
56
56
|
height: "20",
|
|
57
57
|
fill: "none",
|
|
58
58
|
"aria-hidden": "true",
|
|
59
|
-
children: [/* @__PURE__ */
|
|
59
|
+
children: [/* @__PURE__ */ l("circle", {
|
|
60
60
|
cx: "10",
|
|
61
61
|
cy: "10",
|
|
62
62
|
r: "8",
|
|
63
63
|
stroke: "currentColor",
|
|
64
64
|
strokeWidth: "1.5"
|
|
65
|
-
}), /* @__PURE__ */
|
|
65
|
+
}), /* @__PURE__ */ l("path", {
|
|
66
66
|
d: "M10 6v4.5M10 13.5h.01",
|
|
67
67
|
stroke: "currentColor",
|
|
68
68
|
strokeWidth: "1.5",
|
|
69
69
|
strokeLinecap: "round"
|
|
70
70
|
})]
|
|
71
|
-
}) : /* @__PURE__ */
|
|
71
|
+
}) : /* @__PURE__ */ u("svg", {
|
|
72
72
|
viewBox: "0 0 20 20",
|
|
73
73
|
width: "20",
|
|
74
74
|
height: "20",
|
|
75
75
|
fill: "none",
|
|
76
76
|
"aria-hidden": "true",
|
|
77
|
-
children: [/* @__PURE__ */
|
|
77
|
+
children: [/* @__PURE__ */ l("circle", {
|
|
78
78
|
cx: "10",
|
|
79
79
|
cy: "10",
|
|
80
80
|
r: "8",
|
|
81
81
|
stroke: "currentColor",
|
|
82
82
|
strokeWidth: "1.5"
|
|
83
|
-
}), /* @__PURE__ */
|
|
83
|
+
}), /* @__PURE__ */ l("path", {
|
|
84
84
|
d: "M10 9v5M10 6.5h.01",
|
|
85
85
|
stroke: "currentColor",
|
|
86
86
|
strokeWidth: "1.5",
|
|
@@ -90,45 +90,45 @@ function m({ variant: e }) {
|
|
|
90
90
|
}
|
|
91
91
|
function h({ title: h, description: g, variant: _ = "info", dismissible: v = !1, onDismiss: y, actions: b, icon: x, labels: S, className: C, ...w }) {
|
|
92
92
|
a();
|
|
93
|
-
let T = d[r(_)] ?? _, E = i(!0), D =
|
|
93
|
+
let T = d[r(_)] ?? _, E = i(!0), D = o(y);
|
|
94
94
|
D.current = y;
|
|
95
95
|
let O = v || y !== void 0, k = () => {
|
|
96
96
|
E.value = !1, setTimeout(() => D.current?.(), p);
|
|
97
97
|
};
|
|
98
|
-
return /* @__PURE__ */
|
|
98
|
+
return /* @__PURE__ */ l(t, {
|
|
99
99
|
present: E,
|
|
100
|
-
children: /* @__PURE__ */
|
|
100
|
+
children: /* @__PURE__ */ u("div", {
|
|
101
101
|
role: f.has(T) ? "alert" : "status",
|
|
102
102
|
"data-variant": T,
|
|
103
103
|
className: n(e.notification, C),
|
|
104
104
|
...w,
|
|
105
105
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ l("span", {
|
|
107
107
|
className: e.icon,
|
|
108
108
|
"aria-hidden": "true",
|
|
109
|
-
children: x ?? /* @__PURE__ */
|
|
109
|
+
children: x ?? /* @__PURE__ */ l(m, { variant: T })
|
|
110
110
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ u("div", {
|
|
112
112
|
className: e.body,
|
|
113
113
|
children: [
|
|
114
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ l("div", {
|
|
115
115
|
className: e.title,
|
|
116
116
|
children: h
|
|
117
117
|
}),
|
|
118
|
-
g && /* @__PURE__ */
|
|
118
|
+
g && /* @__PURE__ */ l("div", {
|
|
119
119
|
className: e.description,
|
|
120
120
|
children: g
|
|
121
121
|
}),
|
|
122
|
-
b && /* @__PURE__ */
|
|
122
|
+
b && /* @__PURE__ */ l("div", {
|
|
123
123
|
className: e.actions,
|
|
124
124
|
children: b
|
|
125
125
|
})
|
|
126
126
|
]
|
|
127
127
|
}),
|
|
128
|
-
O && /* @__PURE__ */
|
|
128
|
+
O && /* @__PURE__ */ l("button", {
|
|
129
129
|
type: "button",
|
|
130
130
|
className: e.dismiss,
|
|
131
|
-
"aria-label": S?.dismiss ?? s
|
|
131
|
+
"aria-label": S?.dismiss ?? c(s.notification.dismiss),
|
|
132
132
|
onClick: k,
|
|
133
133
|
children: "✕"
|
|
134
134
|
})
|