@cascivo/react 0.16.0 → 0.17.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 +6 -1
- package/dist/accordion/accordion.js +5 -4
- package/dist/app-shell/app-shell.css +1 -1
- package/dist/app-shell/app-shell.js +28 -26
- package/dist/app-shell/app-shell.module.js +8 -8
- package/dist/badge/badge.js +1 -1
- package/dist/button/button.css +1 -1
- package/dist/button/button.js +4 -1
- package/dist/button/button.module.js +4 -1
- package/dist/calendar/calendar.js +67 -63
- package/dist/card/card.css +1 -1
- package/dist/card/card.module.js +8 -8
- package/dist/checkbox/checkbox.css +1 -1
- package/dist/checkbox/checkbox.module.js +4 -4
- package/dist/combobox/combobox.js +55 -54
- package/dist/context-menu/context-menu.js +42 -38
- package/dist/data-table/data-table.css +1 -1
- package/dist/data-table/data-table.js +155 -160
- package/dist/data-table/data-table.module.js +29 -29
- package/dist/date-picker/date-picker.js +90 -89
- package/dist/field/field.css +1 -1
- package/dist/field/field.module.js +3 -3
- package/dist/index.d.ts +307 -145
- 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/layouts/src/grid/grid.css +1 -1
- package/dist/layouts/src/grid/grid.module.js +3 -3
- 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/accordion/accordion.js +5 -4
- package/dist/node/app-shell/app-shell.js +28 -26
- package/dist/node/app-shell/app-shell.module.js +8 -8
- package/dist/node/badge/badge.js +1 -1
- package/dist/node/button/button.js +4 -1
- package/dist/node/button/button.module.js +4 -1
- package/dist/node/calendar/calendar.js +67 -63
- package/dist/node/card/card.module.js +8 -8
- package/dist/node/checkbox/checkbox.module.js +4 -4
- package/dist/node/combobox/combobox.js +55 -54
- package/dist/node/context-menu/context-menu.js +42 -38
- package/dist/node/data-table/data-table.js +155 -160
- package/dist/node/data-table/data-table.module.js +29 -29
- package/dist/node/date-picker/date-picker.js +90 -89
- package/dist/node/field/field.module.js +3 -3
- 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/layouts/src/grid/grid.module.js +3 -3
- 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/search/search.js +5 -4
- package/dist/node/side-nav/side-nav.js +90 -89
- package/dist/node/skip-nav/skip-nav.js +1 -0
- package/dist/node/swap/swap.js +2 -3
- package/dist/node/switcher/switcher.js +1 -1
- package/dist/node/tabs/tabs.js +41 -40
- package/dist/node/tag/tag.module.js +2 -2
- package/dist/node/toc/toc.js +5 -4
- 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/search/search.js +5 -4
- package/dist/side-nav/side-nav.js +90 -89
- package/dist/skip-nav/skip-nav.js +1 -0
- package/dist/styles.css +48 -11
- package/dist/swap/swap.js +2 -3
- package/dist/switcher/switcher.js +1 -1
- package/dist/tabs/tabs.js +41 -40
- package/dist/tag/tag.css +1 -1
- package/dist/tag/tag.module.js +2 -2
- package/dist/toc/toc.js +5 -4
- 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
package/dist/node/swap/swap.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import e from "./swap.module.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useControllableSignal as t, useSignals as n } from "@cascivo/core";
|
|
3
3
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
4
|
//#region ../components/src/swap/swap.tsx
|
|
5
5
|
function a({ on: a, off: o, checked: s = !1, onValueChange: c, onChange: l, mode: u = "rotate", className: d, ariaLabel: f, ...p }) {
|
|
6
6
|
n();
|
|
7
|
-
let m = t(s);
|
|
8
|
-
m.value = s;
|
|
7
|
+
let [m] = t({ value: s });
|
|
9
8
|
function h() {
|
|
10
9
|
let e = !m.value;
|
|
11
10
|
(c ?? l)?.(e);
|
package/dist/node/tabs/tabs.js
CHANGED
|
@@ -2,34 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./tabs.module.js";
|
|
4
4
|
import { createContext as t, forwardRef as n, useId as r, useRef as i } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import { jsx as
|
|
5
|
+
import { Slot as a, cn as o, useControllableSignal as s, useSignals as c } from "@cascivo/core";
|
|
6
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
7
7
|
//#region ../components/src/tabs/tabs.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
let d = r(), f =
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
var u = t(null);
|
|
9
|
+
function d({ defaultValue: t, value: n, onValueChange: i, className: a, children: c }) {
|
|
10
|
+
let d = r(), [f] = s({
|
|
11
|
+
value: n,
|
|
12
|
+
defaultValue: t ?? ""
|
|
13
|
+
}), p = {
|
|
13
14
|
active: f,
|
|
14
15
|
baseId: d,
|
|
15
16
|
setValue: (e) => {
|
|
16
17
|
n === void 0 && (f.value = e), i?.(e);
|
|
17
18
|
}
|
|
18
19
|
};
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ l(u.Provider, {
|
|
20
21
|
value: p,
|
|
21
|
-
children: /* @__PURE__ */
|
|
22
|
-
className:
|
|
23
|
-
children:
|
|
22
|
+
children: /* @__PURE__ */ l("div", {
|
|
23
|
+
className: o(e.tabs, a),
|
|
24
|
+
children: c
|
|
24
25
|
})
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
-
let
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
ref:
|
|
28
|
+
function f({ className: t, children: n, ...r }) {
|
|
29
|
+
let a = i(null);
|
|
30
|
+
return /* @__PURE__ */ l(u.Consumer, { children: (i) => /* @__PURE__ */ l("div", {
|
|
31
|
+
ref: a,
|
|
31
32
|
role: "tablist",
|
|
32
|
-
className:
|
|
33
|
+
className: o(e.list, t),
|
|
33
34
|
onKeyDown: (e) => {
|
|
34
35
|
if (!i || ![
|
|
35
36
|
"ArrowRight",
|
|
@@ -37,61 +38,61 @@ function d({ className: t, children: n, ...r }) {
|
|
|
37
38
|
"Home",
|
|
38
39
|
"End"
|
|
39
40
|
].includes(e.key)) return;
|
|
40
|
-
let t = Array.from(
|
|
41
|
+
let t = Array.from(a.current?.querySelectorAll("[role=\"tab\"]:not([disabled])") ?? []);
|
|
41
42
|
if (t.length === 0) return;
|
|
42
43
|
e.preventDefault();
|
|
43
44
|
let n = t.findIndex((e) => e.dataset.value === i.active.value), r = n;
|
|
44
45
|
e.key === "ArrowRight" ? r = (n + 1) % t.length : e.key === "ArrowLeft" ? r = (n - 1 + t.length) % t.length : e.key === "Home" ? r = 0 : e.key === "End" && (r = t.length - 1);
|
|
45
|
-
let
|
|
46
|
-
|
|
46
|
+
let o = t[r];
|
|
47
|
+
o?.focus(), o?.dataset.value && i.setValue(o.dataset.value);
|
|
47
48
|
},
|
|
48
49
|
...r,
|
|
49
50
|
children: n
|
|
50
51
|
}) });
|
|
51
52
|
}
|
|
52
|
-
var
|
|
53
|
-
return /* @__PURE__ */
|
|
53
|
+
var p = n(function(e, t) {
|
|
54
|
+
return /* @__PURE__ */ l(u.Consumer, { children: (n) => n ? /* @__PURE__ */ l(m, {
|
|
54
55
|
store: n,
|
|
55
56
|
buttonRef: t,
|
|
56
57
|
...e
|
|
57
58
|
}) : null });
|
|
58
59
|
});
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
let
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
type: "button",
|
|
60
|
+
function m({ store: t, value: n, className: r, children: i, disabled: s, buttonRef: u, asChild: d = !1, ...f }) {
|
|
61
|
+
c();
|
|
62
|
+
let p = t.active.value === n;
|
|
63
|
+
return /* @__PURE__ */ l(d ? a : "button", {
|
|
64
|
+
type: d ? void 0 : "button",
|
|
64
65
|
role: "tab",
|
|
65
66
|
id: `${t.baseId}-trigger-${n}`,
|
|
66
|
-
"aria-selected":
|
|
67
|
+
"aria-selected": p,
|
|
67
68
|
"aria-controls": `${t.baseId}-content-${n}`,
|
|
68
|
-
tabIndex:
|
|
69
|
-
"data-state":
|
|
69
|
+
tabIndex: p ? 0 : -1,
|
|
70
|
+
"data-state": p ? "active" : "inactive",
|
|
70
71
|
"data-value": n,
|
|
71
|
-
disabled:
|
|
72
|
-
className:
|
|
72
|
+
...d ? { "aria-disabled": s || void 0 } : { disabled: s },
|
|
73
|
+
className: o(e.trigger, r),
|
|
73
74
|
onClick: () => t.setValue(n),
|
|
74
|
-
ref:
|
|
75
|
-
...
|
|
75
|
+
ref: u,
|
|
76
|
+
...f,
|
|
76
77
|
children: i
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
-
return /* @__PURE__ */
|
|
80
|
+
function h(e) {
|
|
81
|
+
return /* @__PURE__ */ l(u.Consumer, { children: (t) => t ? /* @__PURE__ */ l(g, {
|
|
81
82
|
store: t,
|
|
82
83
|
...e
|
|
83
84
|
}) : null });
|
|
84
85
|
}
|
|
85
|
-
function
|
|
86
|
-
return
|
|
86
|
+
function g({ store: t, value: n, className: r, children: i, ...a }) {
|
|
87
|
+
return c(), t.active.value === n ? /* @__PURE__ */ l("div", {
|
|
87
88
|
role: "tabpanel",
|
|
88
89
|
id: `${t.baseId}-content-${n}`,
|
|
89
90
|
"aria-labelledby": `${t.baseId}-trigger-${n}`,
|
|
90
91
|
tabIndex: 0,
|
|
91
|
-
className:
|
|
92
|
-
...
|
|
92
|
+
className: o(e.content, r),
|
|
93
|
+
...a,
|
|
93
94
|
children: i
|
|
94
95
|
}) : null;
|
|
95
96
|
}
|
|
96
97
|
//#endregion
|
|
97
|
-
export {
|
|
98
|
+
export { d as Tabs, h as TabsContent, f as TabsList, p as TabsTrigger };
|
package/dist/node/toc/toc.js
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./toc.module.js";
|
|
4
4
|
import { useRef as t } from "react";
|
|
5
|
-
import { cn as n,
|
|
5
|
+
import { cn as n, useControllableSignal as r, useSignalEffect as i, useSignals as a } from "@cascivo/core";
|
|
6
6
|
import { builtin as o, t as s } from "@cascivo/i18n";
|
|
7
7
|
import { jsx as c } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/toc/toc.tsx
|
|
9
9
|
function l({ items: l, activeId: u, onActiveChange: d, labels: f, className: p }) {
|
|
10
10
|
a();
|
|
11
|
-
let m = u !== void 0, h = r(
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
let m = u !== void 0, [h] = r({
|
|
12
|
+
value: u,
|
|
13
|
+
defaultValue: l[0]?.id ?? ""
|
|
14
|
+
}), g = t(d);
|
|
14
15
|
return g.current = d, i(() => {
|
|
15
16
|
if (m || typeof document > "u" || typeof IntersectionObserver > "u") return;
|
|
16
17
|
let e = l.map((e) => document.getElementById(e.id)).filter((e) => e !== null);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./virtual-list.module.js";
|
|
4
|
+
import { cn as t, useSignal as n, useSignals as r } from "@cascivo/core";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
//#region ../components/src/virtual-list/virtual-list.tsx
|
|
7
|
+
function a({ items: a, itemHeight: o, height: s, renderItem: c, overscan: l = 3, ariaLabel: u, className: d }) {
|
|
8
|
+
r();
|
|
9
|
+
let f = n(0), p = Math.ceil(s / o), m = Math.floor(f.value / o), h = Math.max(0, m - l), g = Math.min(a.length, m + p + l), _ = a.slice(h, g), v = (e) => {
|
|
10
|
+
f.value = e.currentTarget.scrollTop;
|
|
11
|
+
}, y = { blockSize: `${s}px` };
|
|
12
|
+
return /* @__PURE__ */ i("div", {
|
|
13
|
+
className: t(e.viewport, d),
|
|
14
|
+
style: y,
|
|
15
|
+
onScroll: v,
|
|
16
|
+
role: "list",
|
|
17
|
+
"aria-label": u,
|
|
18
|
+
tabIndex: 0,
|
|
19
|
+
children: /* @__PURE__ */ i("div", {
|
|
20
|
+
className: e.canvas,
|
|
21
|
+
style: { blockSize: `${a.length * o}px` },
|
|
22
|
+
children: _.map((t, n) => {
|
|
23
|
+
let r = h + n;
|
|
24
|
+
return /* @__PURE__ */ i("div", {
|
|
25
|
+
role: "listitem",
|
|
26
|
+
"aria-setsize": a.length,
|
|
27
|
+
"aria-posinset": r + 1,
|
|
28
|
+
className: e.row,
|
|
29
|
+
style: {
|
|
30
|
+
blockSize: `${o}px`,
|
|
31
|
+
transform: `translateY(${r * o}px)`
|
|
32
|
+
},
|
|
33
|
+
children: c(t, r)
|
|
34
|
+
}, r);
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { a as VirtualList };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./wheel-picker.module.js";
|
|
4
|
+
import { useRef as t } from "react";
|
|
5
|
+
import { cn as n, useEffectPropSignal as r, useId as i, useSignalEffect as a } from "@cascivo/core";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
//#region ../components/src/wheel-picker/wheel-picker.tsx
|
|
8
|
+
var c = 120;
|
|
9
|
+
function l({ options: l, value: u, onValueChange: d, visibleCount: f = 5, itemHeight: p = 36, ariaLabel: m, className: h }) {
|
|
10
|
+
let g = t(null), _ = i(), v = Math.max(0, l.findIndex((e) => e.value === u)), y = t(l);
|
|
11
|
+
y.current = l;
|
|
12
|
+
let b = t(d);
|
|
13
|
+
b.current = d;
|
|
14
|
+
let x = t(p);
|
|
15
|
+
x.current = p;
|
|
16
|
+
let S = t(u);
|
|
17
|
+
S.current = u;
|
|
18
|
+
let C = (e, t) => {
|
|
19
|
+
let n = g.current;
|
|
20
|
+
n && n.scrollTo({
|
|
21
|
+
top: e * x.current,
|
|
22
|
+
behavior: t ? "smooth" : "instant"
|
|
23
|
+
});
|
|
24
|
+
}, w = r(u);
|
|
25
|
+
a(() => {
|
|
26
|
+
let e = w.value, t = y.current.findIndex((t) => t.value === e);
|
|
27
|
+
t >= 0 && C(t, !1);
|
|
28
|
+
}), a(() => {
|
|
29
|
+
let e = g.current;
|
|
30
|
+
if (!e) return;
|
|
31
|
+
let t, n = () => {
|
|
32
|
+
clearTimeout(t), t = setTimeout(() => {
|
|
33
|
+
let t = Math.round(e.scrollTop / x.current), n = y.current[t];
|
|
34
|
+
n && n.value !== S.current && b.current(n.value);
|
|
35
|
+
}, c);
|
|
36
|
+
};
|
|
37
|
+
return e.addEventListener("scroll", n, { passive: !0 }), () => {
|
|
38
|
+
clearTimeout(t), e.removeEventListener("scroll", n);
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
let T = (e) => {
|
|
42
|
+
let t = Math.max(0, Math.min(l.length - 1, e)), n = l[t];
|
|
43
|
+
!n || n.value === u || (d(n.value), C(t, !0));
|
|
44
|
+
}, E = (e) => {
|
|
45
|
+
let t = {
|
|
46
|
+
ArrowDown: v + 1,
|
|
47
|
+
ArrowUp: v - 1,
|
|
48
|
+
Home: 0,
|
|
49
|
+
End: l.length - 1,
|
|
50
|
+
PageDown: v + f,
|
|
51
|
+
PageUp: v - f
|
|
52
|
+
}[e.key];
|
|
53
|
+
t !== void 0 && (e.preventDefault(), T(t));
|
|
54
|
+
}, D = (f - 1) / 2 * p, O = {
|
|
55
|
+
"--_item-height": `${p}px`,
|
|
56
|
+
"--_pad": `${D}px`,
|
|
57
|
+
"--_column-height": `${f * p}px`
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ s("div", {
|
|
60
|
+
className: n(e.root, h),
|
|
61
|
+
style: O,
|
|
62
|
+
children: [/* @__PURE__ */ o("div", {
|
|
63
|
+
ref: g,
|
|
64
|
+
role: "listbox",
|
|
65
|
+
tabIndex: 0,
|
|
66
|
+
"aria-label": m,
|
|
67
|
+
"aria-activedescendant": `${_}-${v}`,
|
|
68
|
+
className: e.column,
|
|
69
|
+
onKeyDown: E,
|
|
70
|
+
children: l.map((t, n) => /* @__PURE__ */ o("div", {
|
|
71
|
+
id: `${_}-${n}`,
|
|
72
|
+
role: "option",
|
|
73
|
+
"aria-selected": n === v,
|
|
74
|
+
className: e.option,
|
|
75
|
+
children: t.label
|
|
76
|
+
}, t.value))
|
|
77
|
+
}), /* @__PURE__ */ o("div", {
|
|
78
|
+
"aria-hidden": "true",
|
|
79
|
+
className: e.band
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { l as WheelPicker };
|
package/dist/react/src/index.js
CHANGED
|
@@ -112,26 +112,30 @@ import { ColorPicker as Lt } from "../../color-picker/color-picker.js";
|
|
|
112
112
|
import { Carousel as Rt } from "../../carousel/carousel.js";
|
|
113
113
|
import { Resizable as zt } from "../../resizable/resizable.js";
|
|
114
114
|
import { Dock as Bt } from "../../dock/dock.js";
|
|
115
|
-
import {
|
|
116
|
-
import {
|
|
117
|
-
import {
|
|
118
|
-
import {
|
|
119
|
-
import {
|
|
120
|
-
import {
|
|
121
|
-
import {
|
|
122
|
-
import {
|
|
123
|
-
import {
|
|
124
|
-
import {
|
|
125
|
-
import {
|
|
126
|
-
import {
|
|
127
|
-
import {
|
|
128
|
-
import {
|
|
129
|
-
import {
|
|
130
|
-
import {
|
|
131
|
-
import {
|
|
132
|
-
import {
|
|
133
|
-
import {
|
|
134
|
-
import {
|
|
135
|
-
import {
|
|
136
|
-
import {
|
|
137
|
-
|
|
115
|
+
import { LargeTitleHeader as Vt } from "../../large-title-header/large-title-header.js";
|
|
116
|
+
import { InfiniteScroll as Ht } from "../../infinite-scroll/infinite-scroll.js";
|
|
117
|
+
import { ReorderList as Ut } from "../../reorder-list/reorder-list.js";
|
|
118
|
+
import { VirtualList as Wt } from "../../virtual-list/virtual-list.js";
|
|
119
|
+
import { WheelPicker as Gt } from "../../wheel-picker/wheel-picker.js";
|
|
120
|
+
import { Drawer as Kt } from "../../drawer/drawer.js";
|
|
121
|
+
import { NativeSelect as qt } from "../../native-select/native-select.js";
|
|
122
|
+
import { CodeSnippet as Jt } from "../../code-snippet/code-snippet.js";
|
|
123
|
+
import { Steps as Yt } from "../../steps/steps.js";
|
|
124
|
+
import { Tile as Xt } from "../../tile/tile.js";
|
|
125
|
+
import { Indicator as Zt } from "../../indicator/indicator.js";
|
|
126
|
+
import { Join as Qt } from "../../join/join.js";
|
|
127
|
+
import { Stack as $t } from "../../stack/stack.js";
|
|
128
|
+
import { AppShell as en } from "../../app-shell/app-shell.js";
|
|
129
|
+
import { ChatBubble as tn } from "../../chat-bubble/chat-bubble.js";
|
|
130
|
+
import { RadialProgress as nn } from "../../radial-progress/radial-progress.js";
|
|
131
|
+
import { Swap as rn } from "../../swap/swap.js";
|
|
132
|
+
import { SwipeItem as an } from "../../swipe-item/swipe-item.js";
|
|
133
|
+
import { Grid as on, GridItem as sn } from "../../layouts/src/grid/grid.js";
|
|
134
|
+
import { Flex as cn } from "../../layouts/src/flex/flex.js";
|
|
135
|
+
import { Columns as ln } from "../../layouts/src/columns/columns.js";
|
|
136
|
+
import { Center as un } from "../../layouts/src/center/center.js";
|
|
137
|
+
import { Spacer as dn } from "../../layouts/src/spacer/spacer.js";
|
|
138
|
+
import { AutoGrid as fn } from "../../layouts/src/auto-grid/auto-grid.js";
|
|
139
|
+
import { PageHeader as pn } from "../../layouts/src/page-header/page-header.js";
|
|
140
|
+
import { DismissableLayer as mn, ErrorBoundary as hn, FocusScope as gn, Portal as _n, Presence as vn, Slot as yn, SuspenseBoundary as bn, ThemeProvider as xn, VisuallyHidden as Sn, applyTheme as Cn, batch as wn, cn as Tn, composeRefs as En, computePosition as Dn, computed as On, createMachine as kn, createScope as An, createStreamBuffer as jn, effect as Mn, getLinkComponent as Nn, mergeProps as Pn, setLinkComponent as Fn, setTheme as In, signal as Ln, themePreloadScript as Rn, themeSignal as zn, useAnchorPosition as Bn, useClipboard as Vn, useComputed as Hn, useControllableSignal as Un, useDisclosure as Wn, useEffectPropSignal as Gn, useId as Kn, useMachine as qn, useMediaQuery as Jn, useRovingFocus as Yn, useScope as Xn, useScrollLock as Zn, useSignal as Qn, useSignalEffect as $n, useSignals as er, useStreamBuffer as tr, useTheme as nr, useTypeahead as rr } from "@cascivo/core";
|
|
141
|
+
export { M as Accordion, N as AccordionContent, P as AccordionItem, F as AccordionTrigger, I as ActionSheet, d as Alert, ye as AlertDialog, en as AppShell, _t as AspectRatio, fn as AutoGrid, f as Avatar, p as AvatarGroup, c as Badge, $e as Blockquote, xe as BottomSheet, z as Breadcrumb, t as Button, dt as ButtonGroup, Ft as Calendar, r as Card, i as CardContent, a as CardFooter, o as CardHeader, s as CardTitle, Rt as Carousel, un as Center, tn as ChatBubble, v as Checkbox, He as CheckboxCard, Qe as Code, Jt as CodeSnippet, gt as Collapsible, Lt as ColorPicker, ln as Columns, ce as Combobox, ne as CommandMenu, we as Comparison, Tt as ContainedList, Et as ContainedListItem, Se as ContextMenu, Ce as ContextMenuItem, Ue as CopyButton, Dt as DataList, te as DataTable, le as DatePicker, It as DateRangePicker, mn as DismissableLayer, Bt as Dock, Kt as Drawer, w as Dropdown, Ie as Editable, X as EmptyState, hn as ErrorBoundary, Z as Fab, ct as Field, ue as FileUploader, lt as Filter, cn as Flex, gn as FocusScope, ae as Form, on as Grid, sn as GridItem, H as Header, Be as HeaderPanel, Xe as Heading, Te as HoverCard, Ee as HoverCardContent, De as HoverCardTrigger, ut as IconButton, h as Image, Zt as Indicator, Ht as InfiniteScroll, pt as InlineLoading, n as Input, Ne as InputGroup, Pe as InputGroupAddon, kt as Item, At as ItemActions, jt as ItemContent, Mt as ItemDescription, Nt as ItemMedia, Pt as ItemTitle, Qt as Join, L as Kbd, st as Label, Vt as LargeTitleHeader, R as Link, et as List, tt as ListItem, nt as LogViewer, he as Menu, vt as MenuButton, ge as MenuItem, _e as MenuSeparator, ve as MenuTrigger, bt as Menubar, l as Modal, ke as MultiSelect, qt as NativeSelect, xt as NavigationMenu, mt as Notification, ee as NumberInput, je as OtpInput, Q as OverflowMenu, pn as PageHeader, G as Pagination, Oe as PasswordInput, fe as Popover, pe as PopoverContent, me as PopoverTrigger, _n as Portal, vn as Presence, Je as Progress, Y as ProgressBar, Ye as ProgressCircle, K as ProgressIndicator, rt as Prose, it as PullToRefresh, at as QrCode, nn as RadialProgress, y as Radio, Le as RadioCard, Re as RadioCardGroup, b as RadioGroup, Fe as RatingGroup, ot as RelativeTime, Ut as ReorderList, zt as Resizable, ht as ScrollArea, $ as Search, Me as SegmentedControl, _ as Select, u as Separator, be as Sheet, ze as ShellHeader, W as SideNav, J as Skeleton, Ke as SkipNavLink, qe as SkipNavTarget, S as Slider, yn as Slot, dn as Spacer, e as Spinner, $t as Stack, We as Stat, Ge as Status, Yt as Steps, wt as StructuredList, bn as SuspenseBoundary, rn as Swap, an as SwipeItem, Ve as Switcher, O as Tabs, k as TabsContent, A as TabsList, j as TabsTrigger, q as Tag, Ae as TagsInput, Ze as Text, g as Textarea, xn as ThemeProvider, Xt as Tile, de as TimePicker, Ot as Timeline, T as ToastProvider, B as Toc, x as Toggle, ft as ToggleGroup, yt as Toggletip, C as Tooltip, St as TreeView, m as User, Wt as VirtualList, Sn as VisuallyHidden, Gt as WheelPicker, Cn as applyTheme, wn as batch, Tn as cn, En as composeRefs, Dn as computePosition, On as computed, oe as createForm, kn as createMachine, An as createScope, jn as createStreamBuffer, E as dismissAllToasts, Mn as effect, re as fuzzyMatch, ie as fuzzyScore, Nn as getLinkComponent, Pn as mergeProps, Fn as setLinkComponent, In as setTheme, Ln as signal, Rn as themePreloadScript, zn as themeSignal, Ct as treeViewMessages, Bn as useAnchorPosition, Vn as useClipboard, Hn as useComputed, Un as useControllableSignal, Wn as useDisclosure, Gn as useEffectPropSignal, se as useForm, Kn as useId, qn as useMachine, Jn as useMediaQuery, U as usePopover, Yn as useRovingFocus, Xn as useScope, Zn as useScrollLock, Qn as useSignal, $n as useSignalEffect, er as useSignals, tr as useStreamBuffer, nr as useTheme, D as useToast, V as useTocFromRegion, rr as useTypeahead };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer cascivo.component{._root_1tie9_4{position:relative}._list_1tie9_8{flex-direction:column;margin:0;padding:0;list-style:none;display:flex}._row_1tie9_16{align-items:center;gap:var(--cascivo-space-2);padding-inline:var(--cascivo-space-2);padding-block:var(--cascivo-space-2);border-block-end:1px solid var(--cascivo-border-subtle);background:var(--cascivo-color-surface);display:flex}._row_1tie9_16:last-child{border-block-end:none}._row_1tie9_16[data-active]{background:var(--cascivo-color-surface-2)}._handle_1tie9_34{padding:var(--cascivo-space-1);border-radius:var(--cascivo-radius-sm);color:var(--cascivo-color-text-muted);touch-action:none;cursor:grab;background:0 0;border:none;flex:none;justify-content:center;align-items:center;display:inline-flex}._handle_1tie9_34:focus-visible{outline:var(--cascivo-ring-width) solid var(--cascivo-ring-color);outline-offset:2px}._handle_1tie9_34[aria-pressed=true]{color:var(--cascivo-color-accent);cursor:grabbing}._handle_1tie9_34:disabled{opacity:var(--cascivo-disabled-opacity);cursor:not-allowed}@media (pointer:coarse){._handle_1tie9_34{min-inline-size:var(--cascivo-target-min-coarse,2.75rem);min-block-size:var(--cascivo-target-min-coarse,2.75rem)}}._grip_1tie9_69{block-size:1rem;inline-size:1rem}._label_1tie9_74{min-inline-size:0;color:var(--cascivo-color-foreground)}._srOnly_1tie9_79{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./reorder-list.module.js";
|
|
4
|
+
import { useRef as t } from "react";
|
|
5
|
+
import { cn as n, useSignal as r, useSignalEffect as i, useSignals as a } from "@cascivo/core";
|
|
6
|
+
import { builtin as o, t as s } from "@cascivo/i18n";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
//#region ../components/src/reorder-list/reorder-list.tsx
|
|
9
|
+
function u(e) {
|
|
10
|
+
return e.name ?? (typeof e.label == "string" ? e.label : e.id);
|
|
11
|
+
}
|
|
12
|
+
function d(e, t, n) {
|
|
13
|
+
let r = e.slice(), [i] = r.splice(t, 1);
|
|
14
|
+
return i && r.splice(n, 0, i), r;
|
|
15
|
+
}
|
|
16
|
+
function f({ value: f, onValueChange: p, disabled: m = !1, labels: h, className: g }) {
|
|
17
|
+
a();
|
|
18
|
+
let _ = t(null), v = r(null), y = r(""), b = t(f);
|
|
19
|
+
b.current = f;
|
|
20
|
+
let x = t(p);
|
|
21
|
+
x.current = p;
|
|
22
|
+
let S = t(m);
|
|
23
|
+
S.current = m;
|
|
24
|
+
let C = t(null), w = (e, t, n) => {
|
|
25
|
+
y.value = e ? e.replace("{name}", n.name).replace("{position}", String(n.position)).replace("{total}", String(n.total)) : t;
|
|
26
|
+
}, T = (e, t) => {
|
|
27
|
+
let n = b.current, r = Math.max(0, Math.min(n.length - 1, t));
|
|
28
|
+
if (r === e) return;
|
|
29
|
+
let i = n[e];
|
|
30
|
+
if (!i) return;
|
|
31
|
+
x.current(d(n, e, r)), v.value = r;
|
|
32
|
+
let a = {
|
|
33
|
+
name: u(i),
|
|
34
|
+
position: r + 1,
|
|
35
|
+
total: n.length
|
|
36
|
+
};
|
|
37
|
+
w(h?.moved, s(o.reorderList.moved, a), a);
|
|
38
|
+
}, E = (e) => {
|
|
39
|
+
let t = b.current, n = t[e];
|
|
40
|
+
if (!n) return;
|
|
41
|
+
C.current = t, v.value = e;
|
|
42
|
+
let r = {
|
|
43
|
+
name: u(n),
|
|
44
|
+
position: e + 1,
|
|
45
|
+
total: t.length
|
|
46
|
+
};
|
|
47
|
+
w(h?.grabbed, s(o.reorderList.grabbed, r), r);
|
|
48
|
+
}, D = () => {
|
|
49
|
+
let e = v.value;
|
|
50
|
+
if (e === null) return;
|
|
51
|
+
let t = b.current, n = t[e];
|
|
52
|
+
if (C.current = null, v.value = null, !n) return;
|
|
53
|
+
let r = {
|
|
54
|
+
name: u(n),
|
|
55
|
+
position: e + 1,
|
|
56
|
+
total: t.length
|
|
57
|
+
};
|
|
58
|
+
w(h?.dropped, s(o.reorderList.dropped, r), r);
|
|
59
|
+
}, O = () => {
|
|
60
|
+
let e = C.current, t = v.value;
|
|
61
|
+
if (C.current = null, v.value = null, !e) return;
|
|
62
|
+
x.current(e);
|
|
63
|
+
let n = t === null ? void 0 : e[t], r = {
|
|
64
|
+
name: n ? u(n) : "",
|
|
65
|
+
position: (t ?? 0) + 1,
|
|
66
|
+
total: e.length
|
|
67
|
+
};
|
|
68
|
+
w(h?.cancelled, s(o.reorderList.cancelled, r), r);
|
|
69
|
+
}, k = (e, t) => {
|
|
70
|
+
if (m) return;
|
|
71
|
+
let n = v.value;
|
|
72
|
+
if (e.key === " " || e.key === "Enter") {
|
|
73
|
+
e.preventDefault(), n === t ? D() : E(t);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (e.key === "Escape" && n !== null) {
|
|
77
|
+
e.preventDefault(), O();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
n === t && (e.key === "ArrowUp" ? (e.preventDefault(), T(t, t - 1)) : e.key === "ArrowDown" && (e.preventDefault(), T(t, t + 1)));
|
|
81
|
+
};
|
|
82
|
+
return i(() => {
|
|
83
|
+
let e = _.current;
|
|
84
|
+
if (!e || typeof window > "u") return;
|
|
85
|
+
let t = (t) => {
|
|
86
|
+
let n = v.value;
|
|
87
|
+
if (n === null || S.current) return;
|
|
88
|
+
let r = [...e.querySelectorAll("[data-reorder-row]")].findIndex((e) => {
|
|
89
|
+
let n = e.getBoundingClientRect();
|
|
90
|
+
return t.clientY >= n.top && t.clientY <= n.bottom;
|
|
91
|
+
});
|
|
92
|
+
r !== -1 && r !== n && T(n, r);
|
|
93
|
+
}, n = () => {
|
|
94
|
+
v.value !== null && C.current && D();
|
|
95
|
+
};
|
|
96
|
+
return window.addEventListener("pointermove", t), window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n), () => {
|
|
97
|
+
window.removeEventListener("pointermove", t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
|
|
98
|
+
};
|
|
99
|
+
}), /* @__PURE__ */ l("div", {
|
|
100
|
+
className: n(e.root, g),
|
|
101
|
+
children: [/* @__PURE__ */ c("ul", {
|
|
102
|
+
ref: _,
|
|
103
|
+
className: e.list,
|
|
104
|
+
children: f.map((t, n) => /* @__PURE__ */ l("li", {
|
|
105
|
+
"data-reorder-row": "",
|
|
106
|
+
"data-active": v.value === n ? "" : void 0,
|
|
107
|
+
className: e.row,
|
|
108
|
+
children: [/* @__PURE__ */ c("button", {
|
|
109
|
+
type: "button",
|
|
110
|
+
disabled: m,
|
|
111
|
+
"aria-label": h?.handle ? h.handle.replace("{name}", u(t)) : s(o.reorderList.handle, { name: u(t) }),
|
|
112
|
+
"aria-pressed": v.value === n,
|
|
113
|
+
className: e.handle,
|
|
114
|
+
onKeyDown: (e) => k(e, n),
|
|
115
|
+
onPointerDown: () => {
|
|
116
|
+
m || E(n);
|
|
117
|
+
},
|
|
118
|
+
children: /* @__PURE__ */ c("svg", {
|
|
119
|
+
"aria-hidden": "true",
|
|
120
|
+
viewBox: "0 0 16 16",
|
|
121
|
+
className: e.grip,
|
|
122
|
+
children: /* @__PURE__ */ c("path", {
|
|
123
|
+
d: "M6 4h.01M10 4h.01M6 8h.01M10 8h.01M6 12h.01M10 12h.01",
|
|
124
|
+
stroke: "currentColor",
|
|
125
|
+
strokeWidth: "2",
|
|
126
|
+
strokeLinecap: "round"
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
}), /* @__PURE__ */ c("span", {
|
|
130
|
+
className: e.label,
|
|
131
|
+
children: t.label
|
|
132
|
+
})]
|
|
133
|
+
}, t.id))
|
|
134
|
+
}), /* @__PURE__ */ c("span", {
|
|
135
|
+
role: "status",
|
|
136
|
+
"aria-live": "polite",
|
|
137
|
+
className: e.srOnly,
|
|
138
|
+
children: y.value
|
|
139
|
+
})]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
export { f as ReorderList };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import './reorder-list.css';
|
|
2
|
+
var e = {
|
|
3
|
+
root: "_root_1tie9_4",
|
|
4
|
+
list: "_list_1tie9_8",
|
|
5
|
+
row: "_row_1tie9_16",
|
|
6
|
+
handle: "_handle_1tie9_34",
|
|
7
|
+
grip: "_grip_1tie9_69",
|
|
8
|
+
label: "_label_1tie9_74",
|
|
9
|
+
srOnly: "_srOnly_1tie9_79"
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { e as default };
|
package/dist/search/search.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import e from "./search.module.js";
|
|
4
4
|
import { useRef as t } from "react";
|
|
5
|
-
import { cn as n, focusElement as r,
|
|
5
|
+
import { cn as n, focusElement as r, useControllableSignal as i, useId as a, useSignalEffect as o, useSignals as s } from "@cascivo/core";
|
|
6
6
|
import { builtin as c, t as l } from "@cascivo/i18n";
|
|
7
7
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
8
|
//#region ../components/src/search/search.tsx
|
|
@@ -30,9 +30,10 @@ function f() {
|
|
|
30
30
|
}
|
|
31
31
|
function p({ value: p, defaultValue: m = "", onValueChange: h, onChange: g, onSearch: _, debounceMs: v = 300, placeholder: y, size: b = "md", label: x, disabled: S = !1, clearLabel: C, id: w, className: T }) {
|
|
32
32
|
s();
|
|
33
|
-
let E = y ?? l(c.search.placeholder), D = x ?? l(c.search.label), O = C ?? l(c.search.clear), k = t(null), A =
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
let E = y ?? l(c.search.placeholder), D = x ?? l(c.search.label), O = C ?? l(c.search.clear), k = t(null), A = a("cascade-search"), j = w ?? A, M = p !== void 0, [N] = i({
|
|
34
|
+
value: p,
|
|
35
|
+
defaultValue: m
|
|
36
|
+
}), P = t(_);
|
|
36
37
|
P.current = _;
|
|
37
38
|
let F = t(null), I = () => {
|
|
38
39
|
F.current !== null && (clearTimeout(F.current), F.current = null);
|