@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
package/dist/modal/modal.js
CHANGED
|
@@ -2,65 +2,71 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./modal.module.js";
|
|
4
4
|
import { cn as t, useDraggable as n, useEffectPropSignal as r, useId as i, useSignalEffect as a, useSignals as o } from "@cascivo/core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useRef as s } from "react";
|
|
6
|
+
import { builtin as c, t as l } from "@cascivo/i18n";
|
|
7
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/modal/modal.tsx
|
|
9
|
-
function f({ open: f = !1, onClose: p, title: m, description: h, children: g,
|
|
9
|
+
function f({ open: f = !1, onClose: p, title: m, description: h, children: g, footer: _, className: v, size: y = "md", draggable: b = !1 }) {
|
|
10
10
|
o();
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
let
|
|
14
|
-
"--modal-x": `${
|
|
15
|
-
"--modal-y": `${
|
|
16
|
-
} : void 0,
|
|
11
|
+
let x = s(null), S = s(p);
|
|
12
|
+
S.current = p;
|
|
13
|
+
let C = i("cascivo-modal-title"), w = i("cascivo-modal-desc"), { handleRef: T, offset: E } = n({ isDisabled: !b }), D = b ? {
|
|
14
|
+
"--modal-x": `${E.value.x}px`,
|
|
15
|
+
"--modal-y": `${E.value.y}px`
|
|
16
|
+
} : void 0, O = r(f);
|
|
17
17
|
return a(() => {
|
|
18
|
-
let e =
|
|
19
|
-
e && (
|
|
18
|
+
let e = x.current;
|
|
19
|
+
e && (O.value ? e.open || e.showModal() : e.open && e.close());
|
|
20
20
|
}), a(() => {
|
|
21
|
-
let e =
|
|
21
|
+
let e = x.current;
|
|
22
22
|
if (!e) return;
|
|
23
|
-
let t = () =>
|
|
23
|
+
let t = () => S.current?.();
|
|
24
24
|
return e.addEventListener("close", t), () => e.removeEventListener("close", t);
|
|
25
|
-
}), /* @__PURE__ */
|
|
26
|
-
ref:
|
|
27
|
-
"data-size":
|
|
28
|
-
"data-draggable":
|
|
29
|
-
className: t(e.dialog,
|
|
30
|
-
style:
|
|
25
|
+
}), /* @__PURE__ */ u("dialog", {
|
|
26
|
+
ref: x,
|
|
27
|
+
"data-size": y,
|
|
28
|
+
"data-draggable": b || void 0,
|
|
29
|
+
className: t(e.dialog, v),
|
|
30
|
+
style: D,
|
|
31
31
|
onClick: (e) => {
|
|
32
|
-
e.target ===
|
|
32
|
+
e.target === x.current && x.current?.close();
|
|
33
33
|
},
|
|
34
|
-
"aria-labelledby": m ?
|
|
35
|
-
"aria-describedby": h ?
|
|
36
|
-
children: /* @__PURE__ */
|
|
34
|
+
"aria-labelledby": m ? C : void 0,
|
|
35
|
+
"aria-describedby": h ? w : void 0,
|
|
36
|
+
children: /* @__PURE__ */ d("div", {
|
|
37
37
|
className: e.panel,
|
|
38
38
|
children: [
|
|
39
|
-
(m || p) && /* @__PURE__ */
|
|
39
|
+
(m || p) && /* @__PURE__ */ d("div", {
|
|
40
40
|
className: e.header,
|
|
41
|
-
ref:
|
|
42
|
-
|
|
41
|
+
ref: b ? (e) => {
|
|
42
|
+
T.current = e;
|
|
43
43
|
} : void 0,
|
|
44
|
-
children: [m && /* @__PURE__ */
|
|
45
|
-
id:
|
|
44
|
+
children: [m && /* @__PURE__ */ u("h2", {
|
|
45
|
+
id: C,
|
|
46
46
|
className: e.title,
|
|
47
47
|
children: m
|
|
48
|
-
}), p && /* @__PURE__ */
|
|
48
|
+
}), p && /* @__PURE__ */ u("button", {
|
|
49
49
|
type: "button",
|
|
50
50
|
className: e.close,
|
|
51
|
-
onClick: () =>
|
|
52
|
-
"aria-label": c
|
|
51
|
+
onClick: () => x.current?.close(),
|
|
52
|
+
"aria-label": l(c.modal.close),
|
|
53
53
|
children: "✕"
|
|
54
54
|
})]
|
|
55
55
|
}),
|
|
56
|
-
h && /* @__PURE__ */
|
|
57
|
-
id:
|
|
56
|
+
h && /* @__PURE__ */ u("p", {
|
|
57
|
+
id: w,
|
|
58
58
|
className: e.description,
|
|
59
59
|
children: h
|
|
60
60
|
}),
|
|
61
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ u("div", {
|
|
62
62
|
className: e.body,
|
|
63
|
+
"data-cascivo-modal-body": "",
|
|
63
64
|
children: g
|
|
65
|
+
}),
|
|
66
|
+
_ && /* @__PURE__ */ u("div", {
|
|
67
|
+
className: e.footer,
|
|
68
|
+
"data-cascivo-modal-footer": "",
|
|
69
|
+
children: _
|
|
64
70
|
})
|
|
65
71
|
]
|
|
66
72
|
})
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import './modal.css';
|
|
4
4
|
var e = {
|
|
5
|
-
dialog: "
|
|
6
|
-
panel: "
|
|
7
|
-
header: "
|
|
8
|
-
title: "
|
|
9
|
-
close: "
|
|
10
|
-
description: "
|
|
11
|
-
body: "
|
|
5
|
+
dialog: "_dialog_hywey_2",
|
|
6
|
+
panel: "_panel_hywey_69",
|
|
7
|
+
header: "_header_hywey_79",
|
|
8
|
+
title: "_title_hywey_101",
|
|
9
|
+
close: "_close_hywey_110",
|
|
10
|
+
description: "_description_hywey_138",
|
|
11
|
+
body: "_body_hywey_148",
|
|
12
|
+
footer: "_footer_hywey_166"
|
|
12
13
|
};
|
|
13
14
|
//#endregion
|
|
14
15
|
export { e as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer cascivo.component{.
|
|
1
|
+
@layer cascivo.component{._wrapper_1fi6e_2{min-inline-size:0;width:100%;display:inline-block;position:relative}._trigger_1fi6e_12{width:100%;height:2.5rem;padding-inline:var(--cascivo-space-4);font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text);background-color:var(--cascivo-color-surface);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-field);cursor:pointer;text-align:start;transition:border-color var(--cascivo-duration-150) var(--cascivo-ease-out);justify-content:space-between;align-items:center;display:flex}._trigger_1fi6e_12:hover:not(:disabled){border-color:var(--cascivo-color-border-strong)}._trigger_1fi6e_12:focus-visible{border-color:var(--cascivo-color-accent);box-shadow:var(--cascivo-focus-ring);outline:none}._trigger_1fi6e_12:disabled{opacity:.5;cursor:not-allowed;background-color:var(--cascivo-color-bg-subtle)}._trigger_1fi6e_12[aria-expanded=true]{border-color:var(--cascivo-color-accent);box-shadow:var(--cascivo-focus-ring)}._trigger-label_1fi6e_51{text-overflow:ellipsis;white-space:nowrap;color:var(--cascivo-color-text-muted);overflow:hidden}._chevron_1fi6e_63{width:1rem;height:1rem;background-color:var(--cascivo-color-text-muted);transition:transform var(--cascivo-duration-150) var(--cascivo-ease-out);flex-shrink:0;margin-inline-start:var(--cascivo-space-2);display:block;-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}._trigger_1fi6e_12[aria-expanded=true] ._chevron_1fi6e_63{transform:rotate(180deg)}._panel_1fi6e_83{position-area:block-end span-inline-end;position-try-fallbacks:--bottom-start, block-start span-inline-end;padding:var(--cascivo-space-1);background-color:var(--cascivo-color-surface);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-overlay);min-width:12rem;max-height:16rem;box-shadow:var(--cascivo-shadow-md);opacity:0;transition:opacity var(--cascivo-motion-enter), translate var(--cascivo-motion-enter), display var(--cascivo-motion-enter) allow-discrete, overlay var(--cascivo-motion-enter) allow-discrete;flex-direction:column;margin-block-start:var(--cascivo-space-1);overflow:hidden;translate:0 -.25rem}._panel_1fi6e_83:popover-open{opacity:1;display:flex;translate:0}@starting-style{._panel_1fi6e_83:popover-open{opacity:0;translate:0 -.25rem}}._search-row_1fi6e_128{padding-block-end:var(--cascivo-space-1)}._search_1fi6e_128{width:100%;height:2rem;padding-inline:var(--cascivo-space-3);font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text);background-color:var(--cascivo-color-bg-subtle);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-field);outline:none}._search_1fi6e_128:focus{border-color:var(--cascivo-color-accent)}._options_1fi6e_149{flex:1;overflow-y:auto}._option_1fi6e_149{align-items:center;gap:var(--cascivo-space-2);padding-block:var(--cascivo-space-1-5);padding-inline:var(--cascivo-space-2);font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text);border-radius:var(--cascivo-radius-item);cursor:pointer;-webkit-user-select:none;user-select:none;display:flex}._option_1fi6e_149[data-active]{background-color:var(--cascivo-color-bg-subtle)}._option_1fi6e_149[data-disabled]{opacity:.5;cursor:not-allowed}._checkbox_1fi6e_177{border:1.5px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-indicator);background-color:var(--cascivo-color-surface);width:1rem;height:1rem;transition:background-color var(--cascivo-duration-100) var(--cascivo-ease-out);flex-shrink:0}._option_1fi6e_149[data-selected] ._checkbox_1fi6e_177{background-color:var(--cascivo-color-accent);border-color:var(--cascivo-color-accent)}._no-results_1fi6e_192{padding-block:var(--cascivo-space-3);padding-inline:var(--cascivo-space-2);font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text-muted);text-align:center}}
|
|
@@ -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 };
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import './multi-select.css';
|
|
4
4
|
var e = {
|
|
5
|
-
wrapper: "
|
|
6
|
-
trigger: "
|
|
7
|
-
"trigger-label": "_trigger-
|
|
8
|
-
chevron: "
|
|
9
|
-
panel: "
|
|
10
|
-
"search-row": "_search-
|
|
11
|
-
search: "
|
|
12
|
-
options: "
|
|
13
|
-
option: "
|
|
14
|
-
checkbox: "
|
|
15
|
-
"no-results": "_no-
|
|
5
|
+
wrapper: "_wrapper_1fi6e_2",
|
|
6
|
+
trigger: "_trigger_1fi6e_12",
|
|
7
|
+
"trigger-label": "_trigger-label_1fi6e_51",
|
|
8
|
+
chevron: "_chevron_1fi6e_63",
|
|
9
|
+
panel: "_panel_1fi6e_83",
|
|
10
|
+
"search-row": "_search-row_1fi6e_128",
|
|
11
|
+
search: "_search_1fi6e_128",
|
|
12
|
+
options: "_options_1fi6e_149",
|
|
13
|
+
option: "_option_1fi6e_149",
|
|
14
|
+
checkbox: "_checkbox_1fi6e_177",
|
|
15
|
+
"no-results": "_no-results_1fi6e_192"
|
|
16
16
|
};
|
|
17
17
|
//#endregion
|
|
18
18
|
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 };
|