@cascivo/react 0.16.0 → 0.16.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 +6 -1
- package/dist/badge/badge.js +1 -1
- package/dist/context-menu/context-menu.js +42 -38
- package/dist/index.d.ts +235 -141
- package/dist/infinite-scroll/infinite-scroll.css +1 -0
- package/dist/infinite-scroll/infinite-scroll.js +49 -0
- package/dist/infinite-scroll/infinite-scroll.module.js +8 -0
- package/dist/large-title-header/large-title-header.css +1 -0
- package/dist/large-title-header/large-title-header.js +38 -0
- package/dist/large-title-header/large-title-header.module.js +13 -0
- package/dist/link/link.css +1 -1
- package/dist/link/link.module.js +1 -1
- package/dist/menu/menu.js +47 -43
- package/dist/node/badge/badge.js +1 -1
- package/dist/node/context-menu/context-menu.js +42 -38
- package/dist/node/infinite-scroll/infinite-scroll.js +49 -0
- package/dist/node/infinite-scroll/infinite-scroll.module.js +7 -0
- package/dist/node/large-title-header/large-title-header.js +38 -0
- package/dist/node/large-title-header/large-title-header.module.js +12 -0
- package/dist/node/link/link.module.js +1 -1
- package/dist/node/menu/menu.js +47 -43
- package/dist/node/react/src/index.js +27 -23
- package/dist/node/reorder-list/reorder-list.js +143 -0
- package/dist/node/reorder-list/reorder-list.module.js +11 -0
- package/dist/node/skip-nav/skip-nav.js +1 -0
- package/dist/node/tabs/tabs.js +38 -38
- package/dist/node/tag/tag.module.js +2 -2
- package/dist/node/virtual-list/virtual-list.js +40 -0
- package/dist/node/virtual-list/virtual-list.module.js +7 -0
- package/dist/node/wheel-picker/wheel-picker.js +84 -0
- package/dist/node/wheel-picker/wheel-picker.module.js +8 -0
- package/dist/react/src/index.js +27 -23
- package/dist/reorder-list/reorder-list.css +1 -0
- package/dist/reorder-list/reorder-list.js +143 -0
- package/dist/reorder-list/reorder-list.module.js +12 -0
- package/dist/skip-nav/skip-nav.js +1 -0
- package/dist/styles.css +41 -4
- package/dist/tabs/tabs.js +38 -38
- package/dist/tag/tag.css +1 -1
- package/dist/tag/tag.module.js +2 -2
- package/dist/virtual-list/virtual-list.css +1 -0
- package/dist/virtual-list/virtual-list.js +40 -0
- package/dist/virtual-list/virtual-list.module.js +8 -0
- package/dist/wheel-picker/wheel-picker.css +1 -0
- package/dist/wheel-picker/wheel-picker.js +84 -0
- package/dist/wheel-picker/wheel-picker.module.js +9 -0
- package/package.json +4 -4
- package/readme.body.md +6 -1
- package/dist/node/react/src/theme.js +0 -78
- package/dist/node/storage/src/drivers.js +0 -34
- package/dist/node/storage/src/persisted-signal.js +0 -41
- package/dist/react/src/theme.js +0 -78
- package/dist/storage/src/drivers.js +0 -34
- package/dist/storage/src/persisted-signal.js +0 -41
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer cascivo.component{._root_1fozn_6{background:var(--cascivo-color-surface);block-size:100%;overflow-y:auto}._bar_1fozn_12{z-index:var(--cascivo-z-raised);align-items:center;gap:var(--cascivo-space-2);min-block-size:var(--cascivo-target-min-coarse,2.75rem);padding-inline:var(--cascivo-space-4);background:var(--cascivo-color-surface);border-block-end:1px solid #0000;padding-block-start:env(safe-area-inset-top,0px);display:flex;position:sticky;inset-block-start:0}._slot_1fozn_29{align-items:center;gap:var(--cascivo-space-1);flex:1 0 0;min-inline-size:0;display:flex}._slotEnd_1fozn_37{justify-content:flex-end}._compactTitle_1fozn_41{min-inline-size:0;font-size:var(--cascivo-text-ui);font-weight:var(--cascivo-font-semibold);color:var(--cascivo-color-foreground);text-overflow:ellipsis;white-space:nowrap;flex:0 auto;display:none;overflow:hidden}._largeTitle_1fozn_56{padding-inline:var(--cascivo-space-4);padding-block:var(--cascivo-space-2) var(--cascivo-space-4);font-size:var(--cascivo-text-heading-lg);font-weight:var(--cascivo-font-bold);line-height:var(--cascivo-leading-tight);color:var(--cascivo-color-foreground);letter-spacing:-.02em;margin:0}@supports (animation-timeline:scroll()){._compactTitle_1fozn_41{opacity:0;animation:linear both _cascivo-large-title-reveal_1fozn_1;animation-timeline:scroll();animation-range:0 var(--_collapse,48px);display:block}._bar_1fozn_12{animation:linear both _cascivo-large-title-hairline_1fozn_1;animation-timeline:scroll();animation-range:0 var(--_collapse,48px)}@media (prefers-reduced-motion:reduce){._compactTitle_1fozn_41,._bar_1fozn_12{animation-timing-function:step-end}}}@keyframes _cascivo-large-title-reveal_1fozn_1{to{opacity:1}}@keyframes _cascivo-large-title-hairline_1fozn_1{to{border-block-end-color:var(--cascivo-border-subtle)}}}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import e from "./large-title-header.module.js";
|
|
2
|
+
import { cn as t } from "@cascivo/core";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region ../components/src/large-title-header/large-title-header.tsx
|
|
5
|
+
function i({ title: i, children: a, leading: o, actions: s, level: c = 1, collapseDistance: l = 48, className: u }) {
|
|
6
|
+
let d = `h${c}`, f = { "--_collapse": `${l}px` };
|
|
7
|
+
return /* @__PURE__ */ r("div", {
|
|
8
|
+
className: t(e.root, u),
|
|
9
|
+
style: f,
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ r("div", {
|
|
12
|
+
className: e.bar,
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ n("div", {
|
|
15
|
+
className: e.slot,
|
|
16
|
+
children: o
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ n("span", {
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
className: e.compactTitle,
|
|
21
|
+
children: i
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ n("div", {
|
|
24
|
+
className: t(e.slot, e.slotEnd),
|
|
25
|
+
children: s
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ n(d, {
|
|
30
|
+
className: e.largeTitle,
|
|
31
|
+
children: i
|
|
32
|
+
}),
|
|
33
|
+
a
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { i as LargeTitleHeader };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './large-title-header.css';
|
|
2
|
+
var e = {
|
|
3
|
+
root: "_root_1fozn_6",
|
|
4
|
+
bar: "_bar_1fozn_12",
|
|
5
|
+
slot: "_slot_1fozn_29",
|
|
6
|
+
slotEnd: "_slotEnd_1fozn_37",
|
|
7
|
+
compactTitle: "_compactTitle_1fozn_41",
|
|
8
|
+
largeTitle: "_largeTitle_1fozn_56",
|
|
9
|
+
"cascivo-large-title-reveal": "_cascivo-large-title-reveal_1fozn_1",
|
|
10
|
+
"cascivo-large-title-hairline": "_cascivo-large-title-hairline_1fozn_1"
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as default };
|
package/dist/link/link.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer cascivo.component{.
|
|
1
|
+
@layer cascivo.component{._link_14poz_2{color:var(--cascivo-link-color,var(--cascivo-color-accent));cursor:pointer;border-radius:var(--cascivo-radius-item);text-underline-offset:.2em;transition:color var(--cascivo-duration-150) var(--cascivo-ease-out)}._link_14poz_2:hover{color:var(--cascivo-color-accent-hover)}._link_14poz_2:active{color:var(--cascivo-color-accent-active)}._link_14poz_2:focus-visible{box-shadow:var(--cascivo-focus-ring);outline:none}._link_14poz_2[data-variant=standalone]{font-family:var(--cascivo-font-sans);font-weight:var(--cascivo-font-medium);text-decoration:none}._link_14poz_2[data-variant=standalone]:hover{text-decoration:underline}._link_14poz_2[data-variant=standalone][data-size=sm]{font-size:var(--cascivo-text-sm)}._link_14poz_2[data-variant=standalone][data-size=md]{font-size:var(--cascivo-text-base)}._link_14poz_2[data-variant=standalone][data-size=lg]{font-size:var(--cascivo-text-lg)}._link_14poz_2[data-variant=inline]{font:inherit;text-decoration:underline}._link_14poz_2[data-external]:not(:has(>svg:last-child)):after{content:"↗" / "";margin-inline-start:var(--cascivo-space-1);font-size:.8em}}
|
package/dist/link/link.module.js
CHANGED
package/dist/menu/menu.js
CHANGED
|
@@ -2,32 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
import { usePopover as e } from "../popover/use-popover.js";
|
|
4
4
|
import t from "./menu.module.js";
|
|
5
|
-
import {
|
|
6
|
-
import { useSignalEffect as
|
|
7
|
-
import { jsx as
|
|
5
|
+
import { Children as n, createContext as r, isValidElement as i } from "react";
|
|
6
|
+
import { useSignalEffect as a, useSignals as o, useTypeahead as s } from "@cascivo/core";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/menu/menu.tsx
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
let { popoverRef:
|
|
13
|
-
let e =
|
|
9
|
+
var u = r(null);
|
|
10
|
+
function d({ ctx: e, children: n }) {
|
|
11
|
+
o();
|
|
12
|
+
let { popoverRef: r, anchorName: i, isOpen: l } = e, u = () => {
|
|
13
|
+
let e = r.current;
|
|
14
14
|
return e ? Array.from(e.querySelectorAll("[role=\"menuitem\"]:not([aria-disabled=\"true\"])")) : [];
|
|
15
15
|
}, d = (e) => {
|
|
16
16
|
let t = u();
|
|
17
17
|
t.length !== 0 && t[e(t, t.indexOf(document.activeElement))]?.focus();
|
|
18
|
-
}, f =
|
|
18
|
+
}, f = s({ onMatch: (e) => {
|
|
19
19
|
u().find((t) => (t.textContent ?? "").trim().toLowerCase().startsWith(e))?.focus();
|
|
20
20
|
} });
|
|
21
|
-
return
|
|
21
|
+
return a(() => {
|
|
22
22
|
if (!l.value) return;
|
|
23
|
-
let e =
|
|
23
|
+
let e = r.current;
|
|
24
24
|
e && e.querySelector("[role=\"menuitem\"]:not([aria-disabled=\"true\"])")?.focus();
|
|
25
|
-
}), /* @__PURE__ */
|
|
26
|
-
ref:
|
|
25
|
+
}), /* @__PURE__ */ c("div", {
|
|
26
|
+
ref: r,
|
|
27
27
|
popover: "auto",
|
|
28
28
|
role: "menu",
|
|
29
29
|
"data-state": l.value ? "open" : "closed",
|
|
30
|
-
style: { positionAnchor:
|
|
30
|
+
style: { positionAnchor: i },
|
|
31
31
|
className: t.panel,
|
|
32
32
|
onKeyDown: (e) => {
|
|
33
33
|
switch (e.key) {
|
|
@@ -49,74 +49,78 @@ function l({ ctx: e, children: n }) {
|
|
|
49
49
|
children: n
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
return /* @__PURE__ */
|
|
52
|
+
function f({ children: e }) {
|
|
53
|
+
return /* @__PURE__ */ c(u.Consumer, { children: (t) => {
|
|
54
54
|
if (!t) throw Error("MenuPanel must be inside <Menu>");
|
|
55
|
-
return /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ c(d, {
|
|
56
56
|
ctx: t,
|
|
57
57
|
children: e
|
|
58
58
|
});
|
|
59
59
|
} });
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
function p() {
|
|
62
|
+
return globalThis.process?.env?.NODE_ENV !== "production";
|
|
63
|
+
}
|
|
64
|
+
function m({ children: t }) {
|
|
65
|
+
let r = e(), a = n.toArray(t), o = a.find((e) => i(e) && e.type === g), s = a.filter((e) => e !== o);
|
|
66
|
+
if (o === void 0 && p()) throw Error("<Menu> requires a <MenuTrigger> child. It is matched by component identity, so it may appear in any order — but it must be a direct child, not wrapped in a fragment or another component.");
|
|
67
|
+
return /* @__PURE__ */ l(u.Provider, {
|
|
68
|
+
value: r,
|
|
69
|
+
children: [o, /* @__PURE__ */ c(f, { children: s })]
|
|
66
70
|
});
|
|
67
71
|
}
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
let { triggerRef:
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
-
ref:
|
|
72
|
+
function h({ ctx: e, children: n, ariaLabel: r, "aria-label": i }) {
|
|
73
|
+
o();
|
|
74
|
+
let { triggerRef: a, toggle: s, anchorName: l, isOpen: u } = e;
|
|
75
|
+
return /* @__PURE__ */ c("button", {
|
|
76
|
+
ref: a,
|
|
73
77
|
type: "button",
|
|
74
78
|
"aria-haspopup": "menu",
|
|
75
79
|
"aria-expanded": u.value,
|
|
76
|
-
"aria-label": r ??
|
|
80
|
+
"aria-label": r ?? i,
|
|
77
81
|
style: { anchorName: l },
|
|
78
|
-
onClick:
|
|
82
|
+
onClick: s,
|
|
79
83
|
className: t.trigger,
|
|
80
84
|
children: n
|
|
81
85
|
});
|
|
82
86
|
}
|
|
83
|
-
function
|
|
87
|
+
function g({ children: e, ariaLabel: t, "aria-label": n }) {
|
|
84
88
|
let r = t ?? n;
|
|
85
|
-
return /* @__PURE__ */
|
|
89
|
+
return /* @__PURE__ */ c(u.Consumer, { children: (t) => {
|
|
86
90
|
if (!t) throw Error("MenuTrigger must be inside <Menu>");
|
|
87
|
-
return /* @__PURE__ */
|
|
91
|
+
return /* @__PURE__ */ c(h, {
|
|
88
92
|
ctx: t,
|
|
89
93
|
...r !== void 0 && { ariaLabel: r },
|
|
90
94
|
children: e
|
|
91
95
|
});
|
|
92
96
|
} });
|
|
93
97
|
}
|
|
94
|
-
function
|
|
95
|
-
return /* @__PURE__ */
|
|
98
|
+
function _({ children: e, onSelect: n, disabled: r }) {
|
|
99
|
+
return /* @__PURE__ */ c(u.Consumer, { children: (i) => {
|
|
96
100
|
if (!i) throw Error("MenuItem must be inside <Menu>");
|
|
97
101
|
let { close: a } = i;
|
|
98
|
-
function
|
|
102
|
+
function o() {
|
|
99
103
|
r || (n(), a());
|
|
100
104
|
}
|
|
101
|
-
function
|
|
102
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(),
|
|
105
|
+
function s(e) {
|
|
106
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), o());
|
|
103
107
|
}
|
|
104
|
-
return /* @__PURE__ */
|
|
108
|
+
return /* @__PURE__ */ c("div", {
|
|
105
109
|
role: "menuitem",
|
|
106
110
|
tabIndex: r ? -1 : 0,
|
|
107
111
|
"aria-disabled": r,
|
|
108
|
-
onClick:
|
|
109
|
-
onKeyDown:
|
|
112
|
+
onClick: o,
|
|
113
|
+
onKeyDown: s,
|
|
110
114
|
className: t.item,
|
|
111
115
|
children: e
|
|
112
116
|
});
|
|
113
117
|
} });
|
|
114
118
|
}
|
|
115
|
-
function
|
|
116
|
-
return /* @__PURE__ */
|
|
119
|
+
function v() {
|
|
120
|
+
return /* @__PURE__ */ c("div", {
|
|
117
121
|
role: "separator",
|
|
118
122
|
className: t.separator
|
|
119
123
|
});
|
|
120
124
|
}
|
|
121
125
|
//#endregion
|
|
122
|
-
export {
|
|
126
|
+
export { m as Menu, _ as MenuItem, v as MenuSeparator, g as MenuTrigger };
|
package/dist/node/badge/badge.js
CHANGED
|
@@ -3,7 +3,7 @@ import { cn as t, normalizeTone as n } from "@cascivo/core/pure";
|
|
|
3
3
|
import { jsx as r } from "react/jsx-runtime";
|
|
4
4
|
//#region ../components/src/badge/badge.tsx
|
|
5
5
|
var i = {
|
|
6
|
-
neutral: "
|
|
6
|
+
neutral: "secondary",
|
|
7
7
|
info: "info",
|
|
8
8
|
success: "success",
|
|
9
9
|
warning: "warning",
|
|
@@ -1,89 +1,93 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import e from "./context-menu.module.js";
|
|
4
|
-
import {
|
|
5
|
-
import { useSignal as
|
|
6
|
-
import { jsx as
|
|
4
|
+
import { Children as t, isValidElement as n, useRef as r } from "react";
|
|
5
|
+
import { useSignal as i, useSignalEffect as a, useSignals as o } from "@cascivo/core";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
7
|
//#region ../components/src/context-menu/context-menu.tsx
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
function l() {
|
|
9
|
+
return globalThis.process?.env?.NODE_ENV !== "production";
|
|
10
|
+
}
|
|
11
|
+
function u({ children: u }) {
|
|
12
|
+
o();
|
|
13
|
+
let f = r(null), p = r(null), m = i(!1), h = () => {
|
|
14
|
+
let e = f.current;
|
|
12
15
|
return e ? Array.from(e.querySelectorAll("[role=\"menuitem\"]:not([aria-disabled=\"true\"])")) : [];
|
|
13
|
-
},
|
|
14
|
-
let t =
|
|
16
|
+
}, g = (e) => {
|
|
17
|
+
let t = h();
|
|
15
18
|
t.length !== 0 && t[e(t, t.indexOf(document.activeElement))]?.focus();
|
|
16
|
-
},
|
|
19
|
+
}, _ = (e) => {
|
|
17
20
|
switch (e.key) {
|
|
18
21
|
case "ArrowDown":
|
|
19
|
-
e.preventDefault(),
|
|
22
|
+
e.preventDefault(), g((e, t) => t < 0 ? 0 : (t + 1) % e.length);
|
|
20
23
|
break;
|
|
21
24
|
case "ArrowUp":
|
|
22
|
-
e.preventDefault(),
|
|
25
|
+
e.preventDefault(), g((e, t) => t < 0 ? e.length - 1 : (t - 1 + e.length) % e.length);
|
|
23
26
|
break;
|
|
24
27
|
case "Home":
|
|
25
|
-
e.preventDefault(),
|
|
28
|
+
e.preventDefault(), g(() => 0);
|
|
26
29
|
break;
|
|
27
30
|
case "End":
|
|
28
|
-
e.preventDefault(),
|
|
31
|
+
e.preventDefault(), g((e) => e.length - 1);
|
|
29
32
|
break;
|
|
30
33
|
}
|
|
31
34
|
};
|
|
32
|
-
|
|
33
|
-
let e =
|
|
34
|
-
if (e) if (
|
|
35
|
+
a(() => {
|
|
36
|
+
let e = f.current;
|
|
37
|
+
if (e) if (m.value) {
|
|
35
38
|
try {
|
|
36
39
|
e.showPopover();
|
|
37
40
|
} catch {}
|
|
38
|
-
|
|
41
|
+
h()[0]?.focus();
|
|
39
42
|
} else try {
|
|
40
43
|
e.hidePopover();
|
|
41
44
|
} catch {}
|
|
42
|
-
}),
|
|
43
|
-
let e =
|
|
45
|
+
}), a(() => {
|
|
46
|
+
let e = f.current;
|
|
44
47
|
if (!e) return;
|
|
45
48
|
let t = (e) => {
|
|
46
|
-
e.newState === "closed" && (
|
|
49
|
+
e.newState === "closed" && (m.value = !1);
|
|
47
50
|
};
|
|
48
51
|
return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
|
|
49
52
|
});
|
|
50
|
-
function
|
|
53
|
+
function v(e) {
|
|
51
54
|
e.preventDefault();
|
|
52
|
-
let t =
|
|
53
|
-
t && (t.style.setProperty("--cascivo-context-x", `${e.clientX}px`), t.style.setProperty("--cascivo-context-y", `${e.clientY}px`),
|
|
55
|
+
let t = p.current;
|
|
56
|
+
t && (t.style.setProperty("--cascivo-context-x", `${e.clientX}px`), t.style.setProperty("--cascivo-context-y", `${e.clientY}px`), m.value = !0);
|
|
54
57
|
}
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
let y = t.toArray(u), b = y.filter((e) => n(e) && e.type === d), x = y.filter((e) => !b.includes(e));
|
|
59
|
+
if (b.length === 0 && l()) throw Error("<ContextMenu> requires at least one <ContextMenuItem> child. Items are matched by component identity, so they must be direct children — not wrapped in a fragment or another component.");
|
|
60
|
+
return /* @__PURE__ */ c("div", {
|
|
61
|
+
ref: p,
|
|
62
|
+
onContextMenu: v,
|
|
59
63
|
className: e.wrapper,
|
|
60
|
-
children: [
|
|
61
|
-
ref:
|
|
64
|
+
children: [x, /* @__PURE__ */ s("div", {
|
|
65
|
+
ref: f,
|
|
62
66
|
popover: "auto",
|
|
63
67
|
role: "menu",
|
|
64
|
-
"data-state":
|
|
68
|
+
"data-state": m.value ? "open" : "closed",
|
|
65
69
|
className: e.menu,
|
|
66
|
-
onKeyDown:
|
|
67
|
-
children:
|
|
70
|
+
onKeyDown: _,
|
|
71
|
+
children: b
|
|
68
72
|
})]
|
|
69
73
|
});
|
|
70
74
|
}
|
|
71
|
-
function
|
|
75
|
+
function d({ children: t, onSelect: n, disabled: r }) {
|
|
72
76
|
function i() {
|
|
73
77
|
r || n();
|
|
74
78
|
}
|
|
75
|
-
function
|
|
79
|
+
function a(e) {
|
|
76
80
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), i());
|
|
77
81
|
}
|
|
78
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ s("div", {
|
|
79
83
|
role: "menuitem",
|
|
80
84
|
tabIndex: r ? -1 : 0,
|
|
81
85
|
"aria-disabled": r,
|
|
82
86
|
onClick: i,
|
|
83
|
-
onKeyDown:
|
|
87
|
+
onKeyDown: a,
|
|
84
88
|
className: e.item,
|
|
85
89
|
children: t
|
|
86
90
|
});
|
|
87
91
|
}
|
|
88
92
|
//#endregion
|
|
89
|
-
export {
|
|
93
|
+
export { u as ContextMenu, d as ContextMenuItem };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Spinner as e } from "../spinner/spinner.js";
|
|
4
|
+
import t from "./infinite-scroll.module.js";
|
|
5
|
+
import { useRef as n } from "react";
|
|
6
|
+
import { cn as r, useSignal as i, useSignalEffect as a, useSignals as o } from "@cascivo/core";
|
|
7
|
+
import { builtin as s, t as c } from "@cascivo/i18n";
|
|
8
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
|
+
//#region ../components/src/infinite-scroll/infinite-scroll.tsx
|
|
10
|
+
function d({ onLoadMore: d, disabled: f = !1, rootMargin: p = "200px", labels: m, className: h }) {
|
|
11
|
+
o();
|
|
12
|
+
let g = n(null), _ = i(!1), v = n(d);
|
|
13
|
+
v.current = d;
|
|
14
|
+
let y = n(f);
|
|
15
|
+
y.current = f;
|
|
16
|
+
let b = () => {
|
|
17
|
+
_.value || y.current || (_.value = !0, Promise.resolve(v.current()).then(() => {
|
|
18
|
+
_.value = !1;
|
|
19
|
+
}, () => {
|
|
20
|
+
_.value = !1;
|
|
21
|
+
}));
|
|
22
|
+
}, x = n(b);
|
|
23
|
+
return x.current = b, a(() => {
|
|
24
|
+
let e = g.current;
|
|
25
|
+
if (!e || f || typeof IntersectionObserver > "u") return;
|
|
26
|
+
let t = new IntersectionObserver((e) => {
|
|
27
|
+
e.some((e) => e.isIntersecting) && x.current();
|
|
28
|
+
}, { rootMargin: p });
|
|
29
|
+
return t.observe(e), () => t.disconnect();
|
|
30
|
+
}), f ? null : /* @__PURE__ */ l("div", {
|
|
31
|
+
ref: g,
|
|
32
|
+
className: r(t.root, h),
|
|
33
|
+
children: _.value ? /* @__PURE__ */ u("span", {
|
|
34
|
+
className: t.status,
|
|
35
|
+
role: "status",
|
|
36
|
+
children: [/* @__PURE__ */ l(e, {
|
|
37
|
+
size: "sm",
|
|
38
|
+
"aria-hidden": "true"
|
|
39
|
+
}), m?.loading ?? c(s.infiniteScroll.loading)]
|
|
40
|
+
}) : /* @__PURE__ */ l("button", {
|
|
41
|
+
type: "button",
|
|
42
|
+
className: t.button,
|
|
43
|
+
onClick: b,
|
|
44
|
+
children: m?.loadMore ?? c(s.infiniteScroll.loadMore)
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { d as InfiniteScroll };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import e from "./large-title-header.module.js";
|
|
2
|
+
import { cn as t } from "@cascivo/core";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region ../components/src/large-title-header/large-title-header.tsx
|
|
5
|
+
function i({ title: i, children: a, leading: o, actions: s, level: c = 1, collapseDistance: l = 48, className: u }) {
|
|
6
|
+
let d = `h${c}`, f = { "--_collapse": `${l}px` };
|
|
7
|
+
return /* @__PURE__ */ r("div", {
|
|
8
|
+
className: t(e.root, u),
|
|
9
|
+
style: f,
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ r("div", {
|
|
12
|
+
className: e.bar,
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ n("div", {
|
|
15
|
+
className: e.slot,
|
|
16
|
+
children: o
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ n("span", {
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
className: e.compactTitle,
|
|
21
|
+
children: i
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ n("div", {
|
|
24
|
+
className: t(e.slot, e.slotEnd),
|
|
25
|
+
children: s
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ n(d, {
|
|
30
|
+
className: e.largeTitle,
|
|
31
|
+
children: i
|
|
32
|
+
}),
|
|
33
|
+
a
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { i as LargeTitleHeader };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var e = {
|
|
2
|
+
root: "_root_1fozn_6",
|
|
3
|
+
bar: "_bar_1fozn_12",
|
|
4
|
+
slot: "_slot_1fozn_29",
|
|
5
|
+
slotEnd: "_slotEnd_1fozn_37",
|
|
6
|
+
compactTitle: "_compactTitle_1fozn_41",
|
|
7
|
+
largeTitle: "_largeTitle_1fozn_56",
|
|
8
|
+
"cascivo-large-title-reveal": "_cascivo-large-title-reveal_1fozn_1",
|
|
9
|
+
"cascivo-large-title-hairline": "_cascivo-large-title-hairline_1fozn_1"
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { e as default };
|
package/dist/node/menu/menu.js
CHANGED
|
@@ -2,32 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
import { usePopover as e } from "../popover/use-popover.js";
|
|
4
4
|
import t from "./menu.module.js";
|
|
5
|
-
import {
|
|
6
|
-
import { useSignalEffect as
|
|
7
|
-
import { jsx as
|
|
5
|
+
import { Children as n, createContext as r, isValidElement as i } from "react";
|
|
6
|
+
import { useSignalEffect as a, useSignals as o, useTypeahead as s } from "@cascivo/core";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/menu/menu.tsx
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
let { popoverRef:
|
|
13
|
-
let e =
|
|
9
|
+
var u = r(null);
|
|
10
|
+
function d({ ctx: e, children: n }) {
|
|
11
|
+
o();
|
|
12
|
+
let { popoverRef: r, anchorName: i, isOpen: l } = e, u = () => {
|
|
13
|
+
let e = r.current;
|
|
14
14
|
return e ? Array.from(e.querySelectorAll("[role=\"menuitem\"]:not([aria-disabled=\"true\"])")) : [];
|
|
15
15
|
}, d = (e) => {
|
|
16
16
|
let t = u();
|
|
17
17
|
t.length !== 0 && t[e(t, t.indexOf(document.activeElement))]?.focus();
|
|
18
|
-
}, f =
|
|
18
|
+
}, f = s({ onMatch: (e) => {
|
|
19
19
|
u().find((t) => (t.textContent ?? "").trim().toLowerCase().startsWith(e))?.focus();
|
|
20
20
|
} });
|
|
21
|
-
return
|
|
21
|
+
return a(() => {
|
|
22
22
|
if (!l.value) return;
|
|
23
|
-
let e =
|
|
23
|
+
let e = r.current;
|
|
24
24
|
e && e.querySelector("[role=\"menuitem\"]:not([aria-disabled=\"true\"])")?.focus();
|
|
25
|
-
}), /* @__PURE__ */
|
|
26
|
-
ref:
|
|
25
|
+
}), /* @__PURE__ */ c("div", {
|
|
26
|
+
ref: r,
|
|
27
27
|
popover: "auto",
|
|
28
28
|
role: "menu",
|
|
29
29
|
"data-state": l.value ? "open" : "closed",
|
|
30
|
-
style: { positionAnchor:
|
|
30
|
+
style: { positionAnchor: i },
|
|
31
31
|
className: t.panel,
|
|
32
32
|
onKeyDown: (e) => {
|
|
33
33
|
switch (e.key) {
|
|
@@ -49,74 +49,78 @@ function l({ ctx: e, children: n }) {
|
|
|
49
49
|
children: n
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
return /* @__PURE__ */
|
|
52
|
+
function f({ children: e }) {
|
|
53
|
+
return /* @__PURE__ */ c(u.Consumer, { children: (t) => {
|
|
54
54
|
if (!t) throw Error("MenuPanel must be inside <Menu>");
|
|
55
|
-
return /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ c(d, {
|
|
56
56
|
ctx: t,
|
|
57
57
|
children: e
|
|
58
58
|
});
|
|
59
59
|
} });
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
function p() {
|
|
62
|
+
return globalThis.process?.env?.NODE_ENV !== "production";
|
|
63
|
+
}
|
|
64
|
+
function m({ children: t }) {
|
|
65
|
+
let r = e(), a = n.toArray(t), o = a.find((e) => i(e) && e.type === g), s = a.filter((e) => e !== o);
|
|
66
|
+
if (o === void 0 && p()) throw Error("<Menu> requires a <MenuTrigger> child. It is matched by component identity, so it may appear in any order — but it must be a direct child, not wrapped in a fragment or another component.");
|
|
67
|
+
return /* @__PURE__ */ l(u.Provider, {
|
|
68
|
+
value: r,
|
|
69
|
+
children: [o, /* @__PURE__ */ c(f, { children: s })]
|
|
66
70
|
});
|
|
67
71
|
}
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
let { triggerRef:
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
-
ref:
|
|
72
|
+
function h({ ctx: e, children: n, ariaLabel: r, "aria-label": i }) {
|
|
73
|
+
o();
|
|
74
|
+
let { triggerRef: a, toggle: s, anchorName: l, isOpen: u } = e;
|
|
75
|
+
return /* @__PURE__ */ c("button", {
|
|
76
|
+
ref: a,
|
|
73
77
|
type: "button",
|
|
74
78
|
"aria-haspopup": "menu",
|
|
75
79
|
"aria-expanded": u.value,
|
|
76
|
-
"aria-label": r ??
|
|
80
|
+
"aria-label": r ?? i,
|
|
77
81
|
style: { anchorName: l },
|
|
78
|
-
onClick:
|
|
82
|
+
onClick: s,
|
|
79
83
|
className: t.trigger,
|
|
80
84
|
children: n
|
|
81
85
|
});
|
|
82
86
|
}
|
|
83
|
-
function
|
|
87
|
+
function g({ children: e, ariaLabel: t, "aria-label": n }) {
|
|
84
88
|
let r = t ?? n;
|
|
85
|
-
return /* @__PURE__ */
|
|
89
|
+
return /* @__PURE__ */ c(u.Consumer, { children: (t) => {
|
|
86
90
|
if (!t) throw Error("MenuTrigger must be inside <Menu>");
|
|
87
|
-
return /* @__PURE__ */
|
|
91
|
+
return /* @__PURE__ */ c(h, {
|
|
88
92
|
ctx: t,
|
|
89
93
|
...r !== void 0 && { ariaLabel: r },
|
|
90
94
|
children: e
|
|
91
95
|
});
|
|
92
96
|
} });
|
|
93
97
|
}
|
|
94
|
-
function
|
|
95
|
-
return /* @__PURE__ */
|
|
98
|
+
function _({ children: e, onSelect: n, disabled: r }) {
|
|
99
|
+
return /* @__PURE__ */ c(u.Consumer, { children: (i) => {
|
|
96
100
|
if (!i) throw Error("MenuItem must be inside <Menu>");
|
|
97
101
|
let { close: a } = i;
|
|
98
|
-
function
|
|
102
|
+
function o() {
|
|
99
103
|
r || (n(), a());
|
|
100
104
|
}
|
|
101
|
-
function
|
|
102
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(),
|
|
105
|
+
function s(e) {
|
|
106
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), o());
|
|
103
107
|
}
|
|
104
|
-
return /* @__PURE__ */
|
|
108
|
+
return /* @__PURE__ */ c("div", {
|
|
105
109
|
role: "menuitem",
|
|
106
110
|
tabIndex: r ? -1 : 0,
|
|
107
111
|
"aria-disabled": r,
|
|
108
|
-
onClick:
|
|
109
|
-
onKeyDown:
|
|
112
|
+
onClick: o,
|
|
113
|
+
onKeyDown: s,
|
|
110
114
|
className: t.item,
|
|
111
115
|
children: e
|
|
112
116
|
});
|
|
113
117
|
} });
|
|
114
118
|
}
|
|
115
|
-
function
|
|
116
|
-
return /* @__PURE__ */
|
|
119
|
+
function v() {
|
|
120
|
+
return /* @__PURE__ */ c("div", {
|
|
117
121
|
role: "separator",
|
|
118
122
|
className: t.separator
|
|
119
123
|
});
|
|
120
124
|
}
|
|
121
125
|
//#endregion
|
|
122
|
-
export {
|
|
126
|
+
export { m as Menu, _ as MenuItem, v as MenuSeparator, g as MenuTrigger };
|