@alea-design/ui 0.1.1 → 0.3.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 +7 -1
- package/dist/components/accordion/Accordion.js +29 -0
- package/dist/components/ai/AI.d.ts +5 -1
- package/dist/components/ai/AI.js +187 -0
- package/dist/components/app/AppParts.d.ts +16 -4
- package/dist/components/app/AppParts.js +134 -0
- package/dist/components/button/Button.d.ts +1 -1
- package/dist/components/button/Button.js +137 -0
- package/dist/components/button/Groups.d.ts +1 -1
- package/dist/components/button/Groups.js +112 -0
- package/dist/components/card/Card.d.ts +3 -2
- package/dist/components/card/Card.js +47 -0
- package/dist/components/chat/Chat.d.ts +4 -2
- package/dist/components/chat/Chat.js +275 -0
- package/dist/components/choice/Choice.js +69 -0
- package/dist/components/color/Color.d.ts +3 -3
- package/dist/components/color/Color.js +98 -0
- package/dist/components/combobox/Autocomplete.d.ts +5 -5
- package/dist/components/combobox/Autocomplete.js +126 -0
- package/dist/components/combobox/ComboBox.d.ts +4 -4
- package/dist/components/combobox/ComboBox.js +112 -0
- package/dist/components/combobox/Highlight.js +50 -0
- package/dist/components/command/CommandPalette.d.ts +10 -3
- package/dist/components/command/CommandPalette.js +56 -0
- package/dist/components/content/Content.d.ts +1 -1
- package/dist/components/content/Content.js +125 -0
- package/dist/components/data/Data.js +79 -0
- package/dist/components/date/Date.js +109 -0
- package/dist/components/display/Display.d.ts +5 -3
- package/dist/components/display/Display.js +89 -0
- package/dist/components/display/Display2.d.ts +3 -1
- package/dist/components/display/Display2.js +75 -0
- package/dist/components/emoji/EmojiPicker.js +52 -0
- package/dist/components/emoji/emoji-data.js +27 -0
- package/dist/components/extras/CodeSteps.d.ts +3 -0
- package/dist/components/extras/CodeSteps.js +19 -0
- package/dist/components/extras/Extras.d.ts +1 -1
- package/dist/components/extras/Extras.js +116 -0
- package/dist/components/feedback/Feedback.d.ts +11 -8
- package/dist/components/feedback/Feedback.js +185 -0
- package/dist/components/feedback/Spinner.js +18 -0
- package/dist/components/feedback/Status.d.ts +6 -2
- package/dist/components/feedback/Status.js +48 -0
- package/dist/components/field/Field.d.ts +1 -1
- package/dist/components/field/Field.js +187 -0
- package/dist/components/field/FieldLoading.d.ts +1 -1
- package/dist/components/field/FieldLoading.js +18 -0
- package/dist/components/filter/FilterBar.js +96 -0
- package/dist/components/form/Form.d.ts +5 -5
- package/dist/components/form/Form.js +53 -0
- package/dist/components/icon/Icon.d.ts +2 -2
- package/dist/components/icon/Icon.js +66 -0
- package/dist/components/icon/icon-cells.js +39 -0
- package/dist/components/icon/icon-contexts.d.ts +1 -1
- package/dist/components/icon/icon-contexts.js +38 -0
- package/dist/components/icon/icon-names.d.ts +1 -1
- package/dist/components/icon/icon-names.js +376 -0
- package/dist/components/layout/Bento.d.ts +1 -1
- package/dist/components/layout/Bento.js +38 -0
- package/dist/components/layout/Layout.d.ts +1 -1
- package/dist/components/layout/Layout.js +54 -0
- package/dist/components/layout/Layout2.d.ts +36 -6
- package/dist/components/layout/Layout2.js +105 -0
- package/dist/components/layout/Layout3.js +35 -0
- package/dist/components/layout/Responsive.d.ts +1 -1
- package/dist/components/layout/Responsive.js +32 -0
- package/dist/components/list/List.d.ts +3 -2
- package/dist/components/list/List.js +82 -0
- package/dist/components/list/Lists2.d.ts +6 -4
- package/dist/components/list/Lists2.js +60 -0
- package/dist/components/media/Media.d.ts +8 -4
- package/dist/components/media/Media.js +188 -0
- package/dist/components/menu/Menu.d.ts +23 -12
- package/dist/components/menu/Menu.js +68 -0
- package/dist/components/more/More.d.ts +7 -7
- package/dist/components/more/More.js +182 -0
- package/dist/components/navigation/Navbar.d.ts +1 -1
- package/dist/components/navigation/Navbar.js +27 -0
- package/dist/components/navigation/Navigation.js +121 -0
- package/dist/components/navigation/Navigation2.d.ts +6 -2
- package/dist/components/navigation/Navigation2.js +355 -0
- package/dist/components/overlay/Drawer.d.ts +11 -6
- package/dist/components/overlay/Drawer.js +39 -0
- package/dist/components/overlay/Modal.d.ts +6 -3
- package/dist/components/overlay/Modal.js +27 -0
- package/dist/components/overlay/Overlay.d.ts +14 -9
- package/dist/components/overlay/Overlay.js +76 -0
- package/dist/components/overlay/Sheet.d.ts +11 -5
- package/dist/components/overlay/Sheet.js +52 -0
- package/dist/components/page/Page.d.ts +5 -5
- package/dist/components/page/Page.js +132 -0
- package/dist/components/page/PageParts.d.ts +5 -5
- package/dist/components/page/PageParts.js +109 -0
- package/dist/components/picker/Picker.d.ts +11 -11
- package/dist/components/picker/Picker.js +294 -0
- package/dist/components/picker/Wheel.js +132 -0
- package/dist/components/rating/Rating.d.ts +2 -1
- package/dist/components/rating/Rating.js +66 -0
- package/dist/components/select/Select.d.ts +8 -6
- package/dist/components/select/Select.js +146 -0
- package/dist/components/shell/AppShell.d.ts +3 -3
- package/dist/components/shell/AppShell.js +56 -0
- package/dist/components/shell/AppSidebar.d.ts +5 -5
- package/dist/components/shell/AppSidebar.js +62 -0
- package/dist/components/slider/Slider.d.ts +2 -1
- package/dist/components/slider/Slider.js +36 -0
- package/dist/components/surface/Surface.d.ts +16 -0
- package/dist/components/surface/Surface.js +7 -0
- package/dist/components/table/Table.d.ts +4 -3
- package/dist/components/table/Table.js +58 -0
- package/dist/components/tabs/Tabs.d.ts +1 -0
- package/dist/components/tabs/Tabs.js +120 -0
- package/dist/components/theme/Theme.d.ts +11 -6
- package/dist/components/theme/Theme.js +186 -0
- package/dist/components/theme/lens.js +104 -0
- package/dist/components/tree/Tree.js +303 -0
- package/dist/components/typography/Typography.js +43 -0
- package/dist/components/upload/Upload.js +71 -0
- package/dist/components/work/Ops.js +24 -0
- package/dist/components/work/Work.d.ts +4 -2
- package/dist/components/work/Work.js +241 -0
- package/dist/css/accordion.css +1 -0
- package/dist/css/ai.css +1 -0
- package/dist/css/app.css +1 -0
- package/dist/css/base.css +1 -0
- package/dist/css/button.css +1 -0
- package/dist/css/card.css +1 -0
- package/dist/css/chat.css +1 -0
- package/dist/css/choice.css +1 -0
- package/dist/css/color.css +1 -0
- package/dist/css/combobox.css +1 -0
- package/dist/css/command.css +1 -0
- package/dist/css/content.css +1 -0
- package/dist/css/data.css +1 -0
- package/dist/css/date.css +1 -0
- package/dist/css/display.css +1 -0
- package/dist/css/emoji.css +1 -0
- package/dist/css/extras.css +1 -0
- package/dist/css/feedback.css +1 -0
- package/dist/css/field.css +1 -0
- package/dist/css/filter.css +1 -0
- package/dist/css/form.css +1 -0
- package/dist/css/groups.json +346 -0
- package/dist/css/icon.css +1 -0
- package/dist/css/layout.css +1 -0
- package/dist/css/list.css +1 -0
- package/dist/css/media.css +1 -0
- package/dist/css/menu.css +1 -0
- package/dist/css/more.css +1 -0
- package/dist/css/navigation.css +1 -0
- package/dist/css/overlay.css +1 -0
- package/dist/css/page.css +1 -0
- package/dist/css/picker.css +1 -0
- package/dist/css/rating.css +1 -0
- package/dist/css/select.css +1 -0
- package/dist/css/shell.css +1 -0
- package/dist/css/slider.css +1 -0
- package/dist/css/surface.css +1 -0
- package/dist/css/table.css +1 -0
- package/dist/css/tabs.css +1 -0
- package/dist/css/tree.css +1 -0
- package/dist/css/typography.css +1 -0
- package/dist/css/upload.css +1 -0
- package/dist/css/work.css +1 -0
- package/dist/i18n/strings.js +842 -0
- package/dist/index.d.ts +71 -70
- package/dist/index.js +398 -7436
- package/dist/styles.css +1 -1
- package/dist/utils/Blueprint.js +131 -0
- package/dist/utils/DotField.js +32 -0
- package/dist/utils/attr.d.ts +1 -1
- package/dist/utils/attr.js +18 -0
- package/dist/utils/blueprintScene.js +161 -0
- package/dist/utils/controlled.js +11 -0
- package/dist/utils/cx.js +11 -0
- package/dist/utils/inert.js +9 -0
- package/dist/utils/refs.d.ts +3 -0
- package/dist/utils/refs.js +11 -0
- package/dist/utils/responsive.js +12 -0
- package/dist/utils/scrollEdges.js +31 -0
- package/dist/utils/space.js +10 -0
- package/dist/utils/vocabulary.d.ts +6 -0
- package/dist/utils/vocabulary.js +17 -0
- package/package.json +12 -8
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l, jsxs as p } from "react/jsx-runtime";
|
|
3
|
+
import { useId as z, useState as h, useEffect as b, useRef as R } from "react";
|
|
4
|
+
import { spaceFromPx as x } from "../../utils/space.js";
|
|
5
|
+
import { cx as u } from "../../utils/cx.js";
|
|
6
|
+
import { useStrings as w } from "../../i18n/strings.js";
|
|
7
|
+
import { surfaceAttrs as E } from "../surface/Surface.js";
|
|
8
|
+
function O({ ratio: s = 16 / 9, children: e, className: a, style: t }) {
|
|
9
|
+
return /* @__PURE__ */ l("div", { className: u("alea-aspect", a), style: { aspectRatio: String(s), ...t }, children: e });
|
|
10
|
+
}
|
|
11
|
+
function W({ children: s, height: e = 240, direction: a = "vertical", className: t, "aria-label": r }) {
|
|
12
|
+
const i = R(null), [n, o] = h({ start: !1, end: !1, scrolls: !1 }), c = () => {
|
|
13
|
+
const d = i.current;
|
|
14
|
+
if (!d) return;
|
|
15
|
+
const g = a !== "horizontal", f = g ? d.scrollTop : Math.abs(d.scrollLeft), m = g ? d.scrollHeight - d.clientHeight : d.scrollWidth - d.clientWidth;
|
|
16
|
+
o({ start: f > 2, end: f < m - 2, scrolls: m > 1 });
|
|
17
|
+
};
|
|
18
|
+
return b(() => {
|
|
19
|
+
if (c(), typeof ResizeObserver > "u") return;
|
|
20
|
+
const d = new ResizeObserver(c);
|
|
21
|
+
return i.current && (d.observe(i.current), i.current.firstElementChild && d.observe(i.current.firstElementChild)), () => d.disconnect();
|
|
22
|
+
}, []), /* @__PURE__ */ l("div", { className: u("alea-scroll", t), "data-direction": a, "data-start": n.start || void 0, "data-end": n.end || void 0, children: /* @__PURE__ */ l(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
ref: i,
|
|
26
|
+
className: "alea-scroll-view",
|
|
27
|
+
onScroll: c,
|
|
28
|
+
style: { [a === "horizontal" ? "maxWidth" : "maxHeight"]: a === "horizontal" ? "100%" : e },
|
|
29
|
+
tabIndex: n.scrolls ? 0 : void 0,
|
|
30
|
+
role: n.scrolls ? "region" : void 0,
|
|
31
|
+
"aria-label": n.scrolls ? r : void 0,
|
|
32
|
+
children: /* @__PURE__ */ l("div", { className: "alea-scroll-content", children: s })
|
|
33
|
+
}
|
|
34
|
+
) });
|
|
35
|
+
}
|
|
36
|
+
function T({ children: s, columnWidth: e = 220, gap: a = 12, className: t, asList: r }) {
|
|
37
|
+
return /* @__PURE__ */ l(r ? "ul" : "div", { className: u("alea-masonry", t), style: { columnWidth: e, columnGap: x(a), "--alea-masonry-gap": x(a) }, children: s });
|
|
38
|
+
}
|
|
39
|
+
function C({ src: s, alt: e = "", title: a, subtitle: t, href: r, fit: i = "cover", tone: n = "accent", ratio: o, radius: c, className: d }) {
|
|
40
|
+
const [g, f] = h(!1);
|
|
41
|
+
b(() => {
|
|
42
|
+
f(!1);
|
|
43
|
+
}, [s]);
|
|
44
|
+
const m = !s || g, S = o || m ? { aspectRatio: String(o ?? 1) } : void 0, y = m ? null : /* @__PURE__ */ l("img", { src: s, alt: e, loading: "lazy", onError: () => f(!0), style: o ? { height: "100%" } : void 0 }), v = (a || t) && /* @__PURE__ */ p("span", { className: "alea-imagelist-cap", children: [
|
|
45
|
+
a && /* @__PURE__ */ l("span", { className: "alea-imagelist-title", children: a }),
|
|
46
|
+
t && /* @__PURE__ */ l("span", { className: "alea-imagelist-sub", children: t })
|
|
47
|
+
] }), k = m && e && !a ? r ? { "aria-label": e } : { role: "img", "aria-label": e } : {}, N = { className: u("alea-imagelist-tile", d), "data-fallback": m || void 0, "data-tone": m ? n : void 0, "data-fit": i, ...E({ radius: c }), style: S, ...k };
|
|
48
|
+
return r ? /* @__PURE__ */ p("a", { href: r, ...N, className: u(N.className, "alea-focus-ring"), children: [
|
|
49
|
+
y,
|
|
50
|
+
v
|
|
51
|
+
] }) : /* @__PURE__ */ p("figure", { ...N, children: [
|
|
52
|
+
y,
|
|
53
|
+
v && /* @__PURE__ */ l("figcaption", { children: v })
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
function j({ items: s, variant: e = "grid", minItemWidth: a = 180, ratio: t = 1, radius: r, className: i }) {
|
|
57
|
+
const n = (o) => /* @__PURE__ */ l(C, { ...o, ratio: e === "grid" ? t : void 0, radius: r });
|
|
58
|
+
return e === "masonry" ? /* @__PURE__ */ l(T, { asList: !0, columnWidth: a, className: u("alea-imagelist", i), children: s.map((o, c) => /* @__PURE__ */ l("li", { children: n(o) }, c)) }) : /* @__PURE__ */ l("ul", { className: u("alea-imagelist", i), style: { gridTemplateColumns: `repeat(auto-fill, minmax(min(${a}px, 100%), 1fr))` }, children: s.map((o, c) => /* @__PURE__ */ l("li", { children: n(o) }, c)) });
|
|
59
|
+
}
|
|
60
|
+
function $({ legend: s, description: e, children: a, isDisabled: t, variant: r = "filled", className: i }) {
|
|
61
|
+
const n = z();
|
|
62
|
+
return /* @__PURE__ */ p("fieldset", { className: u("alea-fieldset", i), "data-variant": r, disabled: t, "aria-describedby": e ? n : void 0, children: [
|
|
63
|
+
/* @__PURE__ */ l("legend", { className: "alea-fieldset-legend", children: s }),
|
|
64
|
+
e && /* @__PURE__ */ l("p", { id: n, className: "alea-fieldset-desc", children: e }),
|
|
65
|
+
/* @__PURE__ */ l("div", { className: "alea-fieldset-body", children: a })
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
function G({ children: s, maxHeight: e = 120, showLabel: a, hideLabel: t, className: r }) {
|
|
69
|
+
const i = w();
|
|
70
|
+
a ?? (a = i.showMore), t ?? (t = i.showLess);
|
|
71
|
+
const [n, o] = h(!1), [c, d] = h(!0), g = R(null), f = z();
|
|
72
|
+
return b(() => {
|
|
73
|
+
const m = g.current;
|
|
74
|
+
m && m.scrollHeight && d(m.scrollHeight > e + 8);
|
|
75
|
+
}, [s, e]), /* @__PURE__ */ p("div", { className: u("alea-spoiler", r), "data-open": n || void 0, "data-long": c || void 0, children: [
|
|
76
|
+
/* @__PURE__ */ l("div", { id: f, ref: g, className: "alea-spoiler-body", style: { maxHeight: n || !c ? void 0 : e }, children: s }),
|
|
77
|
+
c && /* @__PURE__ */ l("button", { type: "button", className: "alea-link alea-spoiler-toggle alea-focus-ring", "data-variant": "standalone", "aria-expanded": n, "aria-controls": f, onClick: () => o(!n), children: n ? t : a })
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
function P({ text: s, children: e, tone: a = "accent", placement: t = "end", className: r }) {
|
|
81
|
+
return /* @__PURE__ */ p("div", { className: u("alea-ribbon-wrap", r), children: [
|
|
82
|
+
e,
|
|
83
|
+
/* @__PURE__ */ l("span", { className: "alea-ribbon", "data-tone": a, "data-placement": t, children: s })
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
function q({ children: s, count: e, max: a = 99, label: t, tone: r = "danger", position: i = "top-end", processing: n, isHidden: o, className: c }) {
|
|
87
|
+
return /* @__PURE__ */ p("span", { className: u("alea-indicator-wrap", c), children: [
|
|
88
|
+
s,
|
|
89
|
+
!o && /* @__PURE__ */ p("span", { className: "alea-indicator", "data-tone": r, "data-position": i, "data-dot": e == null || void 0, "data-processing": n || void 0, role: "status", children: [
|
|
90
|
+
/* @__PURE__ */ l("span", { "aria-hidden": "true", children: e != null ? e > a ? `${a}+` : e : null }),
|
|
91
|
+
/* @__PURE__ */ l("span", { className: "alea-visually-hidden", children: t })
|
|
92
|
+
] })
|
|
93
|
+
] });
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
O as AspectRatio,
|
|
97
|
+
$ as Fieldset,
|
|
98
|
+
j as ImageList,
|
|
99
|
+
C as ImageTile,
|
|
100
|
+
q as Indicator,
|
|
101
|
+
T as Masonry,
|
|
102
|
+
P as Ribbon,
|
|
103
|
+
W as ScrollArea,
|
|
104
|
+
G as Spoiler
|
|
105
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a, jsxs as p } from "react/jsx-runtime";
|
|
3
|
+
import { useState as y } from "react";
|
|
4
|
+
import { cx as o } from "../../utils/cx.js";
|
|
5
|
+
import { Card as h } from "../card/Card.js";
|
|
6
|
+
import { SegmentedControl as b } from "../button/Button.js";
|
|
7
|
+
import { useStrings as g } from "../../i18n/strings.js";
|
|
8
|
+
function w({ children: e, narrow: l = "end", narrowWidth: s = 340, stackBelow: t = "md", className: i, style: d }) {
|
|
9
|
+
return /* @__PURE__ */ a("div", { className: o("alea-split-layout", i), style: { "--alea-split-layout-narrow": `${s}px`, ...d }, children: /* @__PURE__ */ p("div", { className: "alea-split-layout-grid", "data-narrow": l, "data-stack": t, children: [
|
|
10
|
+
/* @__PURE__ */ a("div", { className: "alea-split-layout-col", children: e[0] }),
|
|
11
|
+
/* @__PURE__ */ a("div", { className: "alea-split-layout-col", children: e[1] })
|
|
12
|
+
] }) });
|
|
13
|
+
}
|
|
14
|
+
function z({ children: e, size: l = "sm", card: s = !0, as: t = "main", className: i }) {
|
|
15
|
+
return /* @__PURE__ */ a(t, { id: t === "main" ? "main" : void 0, className: o("alea-focus-layout", i), "data-size": l, children: s ? /* @__PURE__ */ a(h, { padding: "loose", className: "alea-focus-layout-card", children: e }) : /* @__PURE__ */ a("div", { className: "alea-focus-layout-card", children: e }) });
|
|
16
|
+
}
|
|
17
|
+
function A({ bar: e, start: l, end: s, children: t, labels: i = {}, height: d = "100dvh", mainAs: m = "main", className: v }) {
|
|
18
|
+
const r = g(), n = { start: i.start ?? r.paneLabels.start, main: i.main ?? r.paneLabels.main, end: i.end ?? r.paneLabels.end }, [c, f] = y("main"), u = [l ? { id: "start", label: n.start } : null, { id: "main", label: n.main }, s ? { id: "end", label: n.end } : null].filter(Boolean);
|
|
19
|
+
return /* @__PURE__ */ p("div", { className: o("alea-panes", v), "data-area": c, "data-start": l ? !0 : void 0, "data-end": s ? !0 : void 0, style: { height: d }, children: [
|
|
20
|
+
e && /* @__PURE__ */ a("header", { className: "alea-panes-bar", children: e }),
|
|
21
|
+
u.length > 1 && /* @__PURE__ */ a("div", { className: "alea-panes-tabs", children: /* @__PURE__ */ a(b, { "aria-label": r.paneArea, size: "sm", value: c, onChange: (N) => f(String(N)), items: u }) }),
|
|
22
|
+
l && /* @__PURE__ */ a("aside", { className: "alea-panes-start", "aria-label": n.start, children: l }),
|
|
23
|
+
/* @__PURE__ */ a(m, { id: m === "main" ? "main" : void 0, role: m === "main" ? void 0 : "region", className: "alea-panes-main", "aria-label": n.main, children: t }),
|
|
24
|
+
s && /* @__PURE__ */ a("aside", { className: "alea-panes-end", "aria-label": n.end, children: s })
|
|
25
|
+
] });
|
|
26
|
+
}
|
|
27
|
+
function F({ device: e = "desktop", children: l, className: s }) {
|
|
28
|
+
return /* @__PURE__ */ a("div", { className: o("alea-device-frame", s), "data-device": e, children: l });
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
F as DeviceFrame,
|
|
32
|
+
z as FocusLayout,
|
|
33
|
+
A as PaneLayout,
|
|
34
|
+
w as SplitLayout
|
|
35
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type { Breakpoint } from './Layout';
|
|
2
|
+
import type { Breakpoint } from './Layout.js';
|
|
3
3
|
/** Whether a media query matches, updating live. False on the server. */
|
|
4
4
|
export declare function useMediaQuery(query: string): boolean;
|
|
5
5
|
/** The current breakpoint (base, sm, md, lg, xl) and helpers: isAbove('md'), isBelow('lg'). */
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { useState as w, useEffect as l } from "react";
|
|
4
|
+
const a = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
5
|
+
function s(n) {
|
|
6
|
+
const i = () => typeof window < "u" && !!window.matchMedia && window.matchMedia(n).matches, [d, c] = w(i);
|
|
7
|
+
return l(() => {
|
|
8
|
+
var o;
|
|
9
|
+
if (typeof window > "u" || !window.matchMedia) return;
|
|
10
|
+
const e = window.matchMedia(n), t = () => c(e.matches);
|
|
11
|
+
return t(), (o = e.addEventListener) == null || o.call(e, "change", t), () => {
|
|
12
|
+
var m;
|
|
13
|
+
return (m = e.removeEventListener) == null ? void 0 : m.call(e, "change", t);
|
|
14
|
+
};
|
|
15
|
+
}, [n]), d;
|
|
16
|
+
}
|
|
17
|
+
function x() {
|
|
18
|
+
const n = s(`(min-width: ${a.sm}px)`), i = s(`(min-width: ${a.md}px)`), d = s(`(min-width: ${a.lg}px)`), e = s(`(min-width: ${a.xl}px)`) ? "xl" : d ? "lg" : i ? "md" : n ? "sm" : "base", t = ["base", "sm", "md", "lg", "xl"];
|
|
19
|
+
return { current: e, isAbove: (o) => t.indexOf(e) >= t.indexOf(o), isBelow: (o) => t.indexOf(e) < t.indexOf(o) };
|
|
20
|
+
}
|
|
21
|
+
function h({ above: n, below: i, children: d }) {
|
|
22
|
+
return /* @__PURE__ */ r("div", { className: "alea-show", "data-above": n, "data-below": i, children: d });
|
|
23
|
+
}
|
|
24
|
+
function p({ above: n, below: i, children: d }) {
|
|
25
|
+
return /* @__PURE__ */ r("div", { className: "alea-show", "data-above": i, "data-below": n, children: d });
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
p as Hide,
|
|
29
|
+
h as Show,
|
|
30
|
+
x as useBreakpoint,
|
|
31
|
+
s as useMediaQuery
|
|
32
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import { type GridListProps, type GridListItemProps, type Key, type DropIndicatorProps } from 'react-aria-components';
|
|
3
|
+
import { type SurfaceProps } from '../surface/Surface.js';
|
|
3
4
|
type WithId = {
|
|
4
5
|
id: Key;
|
|
5
6
|
};
|
|
@@ -8,7 +9,7 @@ export declare function reorderItems<T extends WithId>(items: T[], keys: Key[],
|
|
|
8
9
|
key: Key;
|
|
9
10
|
dropPosition: 'before' | 'after' | 'on';
|
|
10
11
|
}): T[];
|
|
11
|
-
export interface ListViewProps<T extends object> extends GridListProps<T
|
|
12
|
+
export interface ListViewProps<T extends object> extends GridListProps<T>, SurfaceProps {
|
|
12
13
|
/** Lines between items (joined), separate cards, or nothing (plain). */
|
|
13
14
|
variant?: 'joined' | 'separated' | 'plain';
|
|
14
15
|
/** stack (rows, default) or grid (cards in columns, arrow keys move in two directions). Set the column width with --alea-list-min. */
|
|
@@ -19,7 +20,7 @@ export interface ListViewProps<T extends object> extends GridListProps<T> {
|
|
|
19
20
|
dragGroup?: string;
|
|
20
21
|
}
|
|
21
22
|
/** A list of rich items people can select, open or act on, with keyboard navigation. Rows can be dragged to reorder, or between lists; cards can sit in a grid. */
|
|
22
|
-
export declare function ListView<T extends object>({ variant, layout, onItemsChange, dragGroup, items, className, ...props }: ListViewProps<T>): import("react").JSX.Element;
|
|
23
|
+
export declare function ListView<T extends object>({ variant, layout, onItemsChange, dragGroup, items, surface, radius, className, ...props }: ListViewProps<T>): import("react").JSX.Element;
|
|
23
24
|
/** The line that shows where a dragged row will land. Use it in renderDropIndicator of your own drag and drop. */
|
|
24
25
|
export declare function DropIndicator(props: DropIndicatorProps): import("react").JSX.Element;
|
|
25
26
|
/** The handle that starts a drag with the keyboard (Enter) or a screen reader. Put it in rows of a draggable list or table. */
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as t, jsxs as N, Fragment as w } from "react/jsx-runtime";
|
|
3
|
+
import { Button as A, DropIndicator as L, GridListItem as O, Checkbox as S, useDragAndDrop as P, isTextDropItem as k, GridList as V } from "react-aria-components";
|
|
4
|
+
import { isTextDropItem as Y, useAsyncList as Z, useDragAndDrop as _, useListData as G, useTreeData as h } from "react-aria-components";
|
|
5
|
+
import { GripVertical as j, Check as H } from "lucide-react";
|
|
6
|
+
import { cx as y, withBase as v } from "../../utils/cx.js";
|
|
7
|
+
import { useStrings as J } from "../../i18n/strings.js";
|
|
8
|
+
import { surfaceAttrs as z } from "../surface/Surface.js";
|
|
9
|
+
function B(r, i, e) {
|
|
10
|
+
const s = r.filter((o) => i.includes(o.id)), l = r.filter((o) => !i.includes(o.id));
|
|
11
|
+
let d = l.findIndex((o) => o.id === e.key);
|
|
12
|
+
return d < 0 ? r : (e.dropPosition === "after" && (d += 1), [...l.slice(0, d), ...s, ...l.slice(d)]);
|
|
13
|
+
}
|
|
14
|
+
function K({ variant: r = "joined", layout: i = "stack", onItemsChange: e, dragGroup: s, items: l, surface: d, radius: o, className: x, ...m }) {
|
|
15
|
+
const c = l ? [...l] : [], u = s ? `application/x-alea-${s}` : "application/x-alea-list", T = (a) => String((a == null ? void 0 : a.textValue) ?? (a == null ? void 0 : a.label) ?? (a == null ? void 0 : a.name) ?? (a == null ? void 0 : a.title) ?? (a == null ? void 0 : a.id) ?? ""), { dragAndDropHooks: b } = P({
|
|
16
|
+
getItems: (a) => [...a].map((n) => {
|
|
17
|
+
const p = c.find((f) => f.id === n);
|
|
18
|
+
return { "text/plain": T(p), [u]: JSON.stringify(p) };
|
|
19
|
+
}),
|
|
20
|
+
acceptedDragTypes: [u],
|
|
21
|
+
getDropOperation: () => "move",
|
|
22
|
+
onReorder: (a) => e == null ? void 0 : e(B(c, [...a.keys], a.target)),
|
|
23
|
+
onInsert: s ? async (a) => {
|
|
24
|
+
const n = await Promise.all(a.items.filter(k).map(async (D) => JSON.parse(await D.getText(u)))), p = a.target;
|
|
25
|
+
let f = c.findIndex((D) => D.id === p.key);
|
|
26
|
+
p.dropPosition === "after" && (f += 1), e == null || e([...c.slice(0, f), ...n, ...c.slice(f)]);
|
|
27
|
+
} : void 0,
|
|
28
|
+
onRootDrop: s ? async (a) => {
|
|
29
|
+
const n = await Promise.all(a.items.filter(k).map(async (p) => JSON.parse(await p.getText(u))));
|
|
30
|
+
e == null || e([...c, ...n]);
|
|
31
|
+
} : void 0,
|
|
32
|
+
onDragEnd: s ? (a) => {
|
|
33
|
+
a.dropOperation === "move" && !a.isInternal && (e == null || e(c.filter((n) => !a.keys.has(n.id))));
|
|
34
|
+
} : void 0,
|
|
35
|
+
renderDropIndicator: (a) => /* @__PURE__ */ t(R, { target: a })
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ t(
|
|
38
|
+
V,
|
|
39
|
+
{
|
|
40
|
+
...m,
|
|
41
|
+
items: l,
|
|
42
|
+
layout: i,
|
|
43
|
+
dragAndDropHooks: e ? b : void 0,
|
|
44
|
+
"data-variant": r,
|
|
45
|
+
"data-layout": i,
|
|
46
|
+
...z({ surface: d, radius: o }),
|
|
47
|
+
"data-draggable": e ? !0 : void 0,
|
|
48
|
+
className: v("alea-list", x)
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function R(r) {
|
|
53
|
+
return /* @__PURE__ */ t(L, { ...r, className: y("alea-drop-indicator", r.className) });
|
|
54
|
+
}
|
|
55
|
+
function $({ label: r, className: i }) {
|
|
56
|
+
const e = J();
|
|
57
|
+
return /* @__PURE__ */ t(A, { slot: "drag", className: y("alea-drag-handle alea-focus-ring", i), "aria-label": r ?? e.dragToMove, children: /* @__PURE__ */ t(j, { size: 16, "aria-hidden": "true" }) });
|
|
58
|
+
}
|
|
59
|
+
function Q({ children: r, description: i, start: e, end: s, className: l, textValue: d, ...o }) {
|
|
60
|
+
return /* @__PURE__ */ t(O, { ...o, textValue: d ?? (typeof r == "string" ? r : void 0), className: v("alea-list-item", l), children: ({ selectionMode: x, selectionBehavior: m, allowsDragging: c }) => /* @__PURE__ */ N(w, { children: [
|
|
61
|
+
c && /* @__PURE__ */ t($, {}),
|
|
62
|
+
x !== "none" && m === "toggle" && /* @__PURE__ */ t(S, { slot: "selection", className: "alea-check alea-table-check", children: /* @__PURE__ */ t("span", { className: "alea-check-box", "aria-hidden": "true", children: /* @__PURE__ */ t(H, { size: 14, strokeWidth: 3 }) }) }),
|
|
63
|
+
e && /* @__PURE__ */ t("span", { className: "alea-list-start", children: e }),
|
|
64
|
+
/* @__PURE__ */ N("span", { className: "alea-list-text", children: [
|
|
65
|
+
/* @__PURE__ */ t("span", { className: "alea-list-title", children: r }),
|
|
66
|
+
i && /* @__PURE__ */ t("span", { className: "alea-list-desc", children: i })
|
|
67
|
+
] }),
|
|
68
|
+
s && /* @__PURE__ */ t("span", { className: "alea-list-end", children: s })
|
|
69
|
+
] }) });
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
$ as DragHandle,
|
|
73
|
+
R as DropIndicator,
|
|
74
|
+
Q as ListItem,
|
|
75
|
+
K as ListView,
|
|
76
|
+
Y as isTextDropItem,
|
|
77
|
+
B as reorderItems,
|
|
78
|
+
Z as useAsyncList,
|
|
79
|
+
_ as useDragAndDrop,
|
|
80
|
+
G as useListData,
|
|
81
|
+
h as useTreeData
|
|
82
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
export interface StructuredListProps<T extends {
|
|
3
3
|
id: string;
|
|
4
4
|
}> {
|
|
@@ -38,6 +38,8 @@ export interface ContainedListProps {
|
|
|
38
38
|
/** ContainedListItem elements. */
|
|
39
39
|
children: ReactNode;
|
|
40
40
|
/** on-page (a card, default) or disclosed (flat, for lists inside popovers and panels). */
|
|
41
|
+
variant?: 'on-page' | 'disclosed';
|
|
42
|
+
/** @deprecated Use variant. */
|
|
41
43
|
kind?: 'on-page' | 'disclosed';
|
|
42
44
|
/** sm (40 px rows), md (48 px, default) or lg (64 px). */
|
|
43
45
|
size?: 'sm' | 'md' | 'lg';
|
|
@@ -47,8 +49,8 @@ export interface ContainedListProps {
|
|
|
47
49
|
className?: string;
|
|
48
50
|
}
|
|
49
51
|
/** A titled list in its own container, with an action: recent files, members, integrations. Rows hold text, an icon or avatar at the start, and actions at the end. */
|
|
50
|
-
export declare function ContainedList({ label, action, children, kind, size, headingLevel, className }: ContainedListProps): import("react").JSX.Element;
|
|
51
|
-
export interface ContainedListItemProps {
|
|
52
|
+
export declare function ContainedList({ label, action, children, variant, kind, size, headingLevel, className }: ContainedListProps): import("react").JSX.Element;
|
|
53
|
+
export interface ContainedListItemProps extends HTMLAttributes<HTMLLIElement> {
|
|
52
54
|
children: ReactNode;
|
|
53
55
|
/** A second line. */
|
|
54
56
|
description?: ReactNode;
|
|
@@ -60,7 +62,7 @@ export interface ContainedListItemProps {
|
|
|
60
62
|
href?: string;
|
|
61
63
|
}
|
|
62
64
|
/** One row of a ContainedList. */
|
|
63
|
-
export declare
|
|
65
|
+
export declare const ContainedListItem: import("react").ForwardRefExoticComponent<ContainedListItemProps & import("react").RefAttributes<HTMLLIElement>>;
|
|
64
66
|
export interface PageIndicatorProps {
|
|
65
67
|
/** How many pages. */
|
|
66
68
|
count: number;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as n, jsx as a, Fragment as f } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as b } from "react";
|
|
4
|
+
import { RadioGroup as v, Radio as y } from "react-aria-components";
|
|
5
|
+
import { Check as k } from "lucide-react";
|
|
6
|
+
import { cx as u } from "../../utils/cx.js";
|
|
7
|
+
import { useStrings as w } from "../../i18n/strings.js";
|
|
8
|
+
import { renamed as x } from "../../utils/vocabulary.js";
|
|
9
|
+
function z({ columns: t, rows: i, selectionMode: l = "none", value: d, defaultValue: c, onChange: o, showHeader: r = !0, className: p, "aria-label": e }) {
|
|
10
|
+
const m = { gridTemplateColumns: `${l === "single" ? "40px " : ""}${t.map((s) => s.width ?? "minmax(0, 1fr)").join(" ")}` }, N = r && /* @__PURE__ */ n("div", { className: "alea-slist-row alea-slist-head", style: m, "aria-hidden": l === "single" || void 0, role: l === "single" ? void 0 : "row", children: [
|
|
11
|
+
l === "single" && /* @__PURE__ */ a("span", {}),
|
|
12
|
+
t.map((s) => /* @__PURE__ */ a("span", { className: "alea-slist-cell", "data-align": s.align, role: l === "single" ? void 0 : "columnheader", children: s.label }, s.key))
|
|
13
|
+
] });
|
|
14
|
+
return l === "single" ? /* @__PURE__ */ n(v, { "aria-label": e, value: d, defaultValue: c, onChange: o, className: u("alea-slist", p), "data-selectable": !0, children: [
|
|
15
|
+
N,
|
|
16
|
+
i.map((s) => /* @__PURE__ */ a(y, { value: s.id, className: "alea-slist-row alea-slist-option alea-focus-ring", style: m, children: ({ isSelected: h }) => /* @__PURE__ */ n(f, { children: [
|
|
17
|
+
/* @__PURE__ */ a("span", { className: "alea-slist-check", "aria-hidden": "true", children: h && /* @__PURE__ */ a(k, { size: 16 }) }),
|
|
18
|
+
t.map((g) => /* @__PURE__ */ a("span", { className: "alea-slist-cell", "data-align": g.align, "data-label": typeof g.label == "string" ? g.label : void 0, children: s[g.key] }, g.key))
|
|
19
|
+
] }) }, s.id))
|
|
20
|
+
] }) : /* @__PURE__ */ n("div", { className: u("alea-slist", p), role: "table", "aria-label": e, children: [
|
|
21
|
+
N,
|
|
22
|
+
/* @__PURE__ */ a("div", { role: "rowgroup", children: i.map((s) => /* @__PURE__ */ a("div", { className: "alea-slist-row", role: "row", style: m, children: t.map((h, g) => /* @__PURE__ */ a("span", { className: "alea-slist-cell", role: g === 0 ? "rowheader" : "cell", "data-align": h.align, "data-label": typeof h.label == "string" ? h.label : void 0, children: s[h.key] }, h.key)) }, s.id)) })
|
|
23
|
+
] });
|
|
24
|
+
}
|
|
25
|
+
function O({ label: t, action: i, children: l, variant: d, kind: c, size: o = "md", headingLevel: r = 3, className: p }) {
|
|
26
|
+
const e = x("ContainedList", "kind", c, "variant", d) ?? "on-page", m = `h${r}`;
|
|
27
|
+
return /* @__PURE__ */ n("section", { className: u("alea-clist", p), "data-kind": e, "data-size": o, children: [
|
|
28
|
+
/* @__PURE__ */ n("header", { className: "alea-clist-head", children: [
|
|
29
|
+
/* @__PURE__ */ a(m, { className: "alea-clist-title", children: t }),
|
|
30
|
+
i && /* @__PURE__ */ a("div", { className: "alea-clist-action", children: i })
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ a("ul", { className: "alea-clist-items", children: l })
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
const S = b(function({ children: i, description: l, start: d, end: c, href: o, className: r, ...p }, e) {
|
|
36
|
+
const m = /* @__PURE__ */ n(f, { children: [
|
|
37
|
+
d && /* @__PURE__ */ a("span", { className: "alea-clist-start", children: d }),
|
|
38
|
+
/* @__PURE__ */ n("span", { className: "alea-clist-text", children: [
|
|
39
|
+
/* @__PURE__ */ a("span", { className: "alea-clist-name", children: i }),
|
|
40
|
+
l && /* @__PURE__ */ a("span", { className: "alea-clist-desc", children: l })
|
|
41
|
+
] })
|
|
42
|
+
] });
|
|
43
|
+
return /* @__PURE__ */ n("li", { ref: e, ...p, className: u("alea-clist-item", r), children: [
|
|
44
|
+
o ? /* @__PURE__ */ a("a", { href: o, className: "alea-clist-link alea-focus-ring", children: m }) : /* @__PURE__ */ a("span", { className: "alea-clist-link", children: m }),
|
|
45
|
+
c && /* @__PURE__ */ a("span", { className: "alea-clist-end", children: c })
|
|
46
|
+
] });
|
|
47
|
+
});
|
|
48
|
+
function A({ count: t, current: i, onChange: l, variant: d = "dots", className: c, "aria-label": o }) {
|
|
49
|
+
const r = w();
|
|
50
|
+
return d === "numbers" ? /* @__PURE__ */ a("span", { className: u("alea-page-indicator", c), "data-variant": "numbers", role: "status", children: r.nOfTotal(i + 1, t) }) : /* @__PURE__ */ n("div", { className: u("alea-page-indicator", c), "data-variant": d, role: "group", "aria-label": o ?? r.pages, children: [
|
|
51
|
+
Array.from({ length: t }, (p, e) => l ? /* @__PURE__ */ a("button", { type: "button", className: "alea-page-dot alea-focus-ring", "aria-label": r.slideN(e + 1), "aria-current": e === i ? "step" : void 0, "data-current": e === i || void 0, onClick: () => l(e) }, e) : /* @__PURE__ */ a("span", { className: "alea-page-dot", "aria-hidden": "true", "data-current": e === i || void 0 }, e)),
|
|
52
|
+
!l && /* @__PURE__ */ a("span", { className: "alea-visually-hidden", children: r.nOfTotal(i + 1, t) })
|
|
53
|
+
] });
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
O as ContainedList,
|
|
57
|
+
S as ContainedListItem,
|
|
58
|
+
A as PageIndicator,
|
|
59
|
+
z as StructuredList
|
|
60
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CSSProperties, type ReactNode } from 'react';
|
|
1
|
+
import { type CSSProperties, type ReactNode, type HTMLAttributes } from 'react';
|
|
2
2
|
export interface TimelineItem {
|
|
3
3
|
id: string;
|
|
4
4
|
title: ReactNode;
|
|
@@ -80,7 +80,7 @@ export interface ImageProps {
|
|
|
80
80
|
}
|
|
81
81
|
/** An image that loads lazily, shows a shimmer while loading and a fallback on error, and opens a zoomable preview. */
|
|
82
82
|
export declare function Image({ src, alt, width, height, preview, fallback, fit, radius, srcSet, sizes, ratio, priority, placeholder, loadingEffect, isLoading, className }: ImageProps): import("react").JSX.Element;
|
|
83
|
-
export interface QRCodeProps {
|
|
83
|
+
export interface QRCodeProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'color'> {
|
|
84
84
|
/** What the code holds: a URL, text, a Wi-Fi string. */
|
|
85
85
|
value: string;
|
|
86
86
|
/** Size in px. Default 160. */
|
|
@@ -97,7 +97,7 @@ export interface QRCodeProps {
|
|
|
97
97
|
background?: string;
|
|
98
98
|
}
|
|
99
99
|
/** A QR code drawn as SVG, crisp at any size. */
|
|
100
|
-
export declare
|
|
100
|
+
export declare const QRCode: import("react").ForwardRefExoticComponent<QRCodeProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
101
101
|
export interface WatermarkProps {
|
|
102
102
|
children: ReactNode;
|
|
103
103
|
/** The text repeated across the area. */
|
|
@@ -128,6 +128,10 @@ export interface TourProps {
|
|
|
128
128
|
onOpenChange: (open: boolean) => void;
|
|
129
129
|
/** Called when the last step is done. */
|
|
130
130
|
onFinish?: () => void;
|
|
131
|
+
/** Extra class names for the tour layer. */
|
|
132
|
+
className?: string;
|
|
133
|
+
/** Inline style for the tour layer. */
|
|
134
|
+
style?: CSSProperties;
|
|
131
135
|
}
|
|
132
136
|
/** A guided walk through a screen: each step spotlights an element and explains it. Escape skips; focus stays in the step. */
|
|
133
|
-
export declare
|
|
137
|
+
export declare const Tour: import("react").ForwardRefExoticComponent<TourProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as h, jsx as e, Fragment as B } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as H, useState as C, useId as U, useCallback as X, useEffect as P, forwardRef as F, useMemo as O, useLayoutEffect as _ } from "react";
|
|
4
|
+
import { Pause as G, Play as J, ChevronLeft as K, ChevronRight as Y, ImageOff as V, ZoomOut as ee, ZoomIn as ae, X as te } from "lucide-react";
|
|
5
|
+
import { cx as I } from "../../utils/cx.js";
|
|
6
|
+
import { IconButton as z, Button as S } from "../button/Button.js";
|
|
7
|
+
import { DialogModal as W, Dialog as j } from "../overlay/Overlay.js";
|
|
8
|
+
import { useStrings as R } from "../../i18n/strings.js";
|
|
9
|
+
import { DotField as re } from "../../utils/DotField.js";
|
|
10
|
+
import { inertProps as le } from "../../utils/inert.js";
|
|
11
|
+
function ve({ items: f, pending: r, mode: s = "start", reverse: d, size: b, className: x }) {
|
|
12
|
+
const u = d ? [...f].reverse() : f;
|
|
13
|
+
return /* @__PURE__ */ h("ol", { className: I("alea-timeline", x), "data-mode": s !== "start" ? s : void 0, "data-size": b, children: [
|
|
14
|
+
u.map((n) => /* @__PURE__ */ h("li", { className: "alea-tl-item", "data-tone": n.tone || "neutral", "data-active": n.isActive || void 0, children: [
|
|
15
|
+
/* @__PURE__ */ e("span", { className: "alea-tl-dot", "aria-hidden": "true", children: n.dot }),
|
|
16
|
+
/* @__PURE__ */ h("div", { className: "alea-tl-body", children: [
|
|
17
|
+
n.time && (n.dateTime ? /* @__PURE__ */ e("time", { className: "alea-tl-time", dateTime: n.dateTime, children: n.time }) : /* @__PURE__ */ e("span", { className: "alea-tl-time", children: n.time })),
|
|
18
|
+
/* @__PURE__ */ e("p", { className: "alea-tl-title", children: n.title }),
|
|
19
|
+
n.description && /* @__PURE__ */ e("div", { className: "alea-tl-desc", children: n.description })
|
|
20
|
+
] })
|
|
21
|
+
] }, n.id)),
|
|
22
|
+
r && /* @__PURE__ */ h("li", { className: "alea-tl-item", "data-pending": !0, children: [
|
|
23
|
+
/* @__PURE__ */ e("span", { className: "alea-tl-dot", "aria-hidden": "true" }),
|
|
24
|
+
/* @__PURE__ */ e("div", { className: "alea-tl-body", children: /* @__PURE__ */ e("p", { className: "alea-tl-title alea-tl-pending", children: r }) })
|
|
25
|
+
] })
|
|
26
|
+
] });
|
|
27
|
+
}
|
|
28
|
+
function pe({ children: f, "aria-label": r, autoplay: s, perView: d = 1, showDots: b = !0, className: x }) {
|
|
29
|
+
const u = R(), n = H(null), [i, v] = C(0), [g, p] = C(!!s), [y, o] = C(!1), N = f.length, m = Math.max(1, Math.ceil(N - d + 1)), l = U(), t = X((c) => {
|
|
30
|
+
var L;
|
|
31
|
+
const a = n.current;
|
|
32
|
+
if (!a) return;
|
|
33
|
+
const w = (c + m) % m, k = a.children[w], $ = getComputedStyle(a).direction === "rtl", M = k ? a.scrollLeft + ($ ? k.getBoundingClientRect().right - a.getBoundingClientRect().right : k.getBoundingClientRect().left - a.getBoundingClientRect().left) : 0, E = ((L = window.matchMedia) == null ? void 0 : L.call(window, "(prefers-reduced-motion: reduce)").matches) && document.documentElement.getAttribute("data-alea-reduced") !== "never" || ["off", "reduced"].includes(document.documentElement.getAttribute("data-alea-motion") || "");
|
|
34
|
+
typeof a.scrollTo == "function" ? a.scrollTo({ left: M, behavior: E ? "auto" : "smooth" }) : a.scrollLeft = M, v(w);
|
|
35
|
+
}, [m]);
|
|
36
|
+
return P(() => {
|
|
37
|
+
const c = n.current;
|
|
38
|
+
if (!c) return;
|
|
39
|
+
const a = () => {
|
|
40
|
+
const w = c.clientWidth / d;
|
|
41
|
+
v(Math.min(m - 1, Math.round(Math.abs(c.scrollLeft) / Math.max(1, w))));
|
|
42
|
+
};
|
|
43
|
+
return c.addEventListener("scroll", a, { passive: !0 }), () => c.removeEventListener("scroll", a);
|
|
44
|
+
}, [d, m]), P(() => {
|
|
45
|
+
var a;
|
|
46
|
+
if (!s || !g || y || typeof window < "u" && ((a = window.matchMedia) != null && a.call(window, "(prefers-reduced-motion: reduce)").matches)) return;
|
|
47
|
+
const c = setInterval(() => t(i + 1), s);
|
|
48
|
+
return () => clearInterval(c);
|
|
49
|
+
}, [s, g, y, i, t]), /* @__PURE__ */ h(
|
|
50
|
+
"section",
|
|
51
|
+
{
|
|
52
|
+
className: I("alea-carousel", x),
|
|
53
|
+
"aria-roledescription": "carousel",
|
|
54
|
+
"aria-label": r,
|
|
55
|
+
onMouseEnter: () => o(!0),
|
|
56
|
+
onMouseLeave: () => o(!1),
|
|
57
|
+
onFocusCapture: () => o(!0),
|
|
58
|
+
onBlurCapture: () => o(!1),
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ h("div", { className: "alea-carousel-controls", children: [
|
|
61
|
+
s && /* @__PURE__ */ e(z, { size: "sm", "aria-label": g ? u.stopSlides : u.playSlides, onPress: () => p((c) => !c), children: g ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ e(J, {}) }),
|
|
62
|
+
/* @__PURE__ */ e(z, { size: "sm", "aria-label": u.previousSlide, "aria-controls": `${l}-track`, onPress: () => t(i - 1), children: /* @__PURE__ */ e(K, {}) }),
|
|
63
|
+
/* @__PURE__ */ e(z, { size: "sm", "aria-label": u.nextSlide, "aria-controls": `${l}-track`, onPress: () => t(i + 1), children: /* @__PURE__ */ e(Y, {}) })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ e("div", { ref: n, id: `${l}-track`, className: "alea-carousel-track alea-focus-ring", tabIndex: 0, "aria-label": u.slides, "aria-live": g && !y ? "off" : "polite", style: { "--alea-per-view": d }, children: f.map((c, a) => /* @__PURE__ */ e("div", { className: "alea-carousel-slide", role: "group", "aria-roledescription": "slide", "aria-label": u.nOfTotal(a + 1, N), "aria-hidden": a < i || a >= i + d ? !0 : void 0, ...le(a < i || a >= i + d), children: c }, a)) }),
|
|
66
|
+
b && m > 1 && /* @__PURE__ */ e("div", { className: "alea-carousel-dots", role: "group", "aria-label": u.chooseSlide, children: Array.from({ length: m }, (c, a) => /* @__PURE__ */ e("button", { type: "button", className: "alea-carousel-dot alea-focus-ring", "aria-label": u.slideN(a + 1), "aria-current": a === i ? "true" : void 0, onClick: () => t(a) }, a)) })
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function be({ src: f, alt: r, width: s, height: d, preview: b = !0, fallback: x, fit: u = "cover", radius: n = "md", srcSet: i, sizes: v, ratio: g, priority: p, placeholder: y, loadingEffect: o = "shimmer", isLoading: N, className: m }) {
|
|
72
|
+
const l = R(), [t, c] = C("loading"), [a, w] = C(!1), [k, $] = C(1), M = o === "matrix", E = !!N || t === "loading", L = N ? "loading" : t, Q = f ? /* @__PURE__ */ e("img", { src: f, srcSet: i, sizes: v, alt: r, loading: p ? "eager" : "lazy", decoding: p ? "sync" : "async", fetchPriority: p ? "high" : void 0, onLoad: () => c("ok"), onError: () => c("error"), style: { objectFit: u } }) : null, T = y ? /^(data:|https?:|\/)/.test(y) ? { backgroundImage: `url(${y})`, backgroundSize: "cover" } : { background: y } : null, A = /* @__PURE__ */ h("span", { className: I("alea-image", m), "data-state": L, "data-effect": M ? "matrix" : void 0, "aria-busy": E || void 0, "data-radius": n, "data-placeholder": T ? !0 : void 0, style: { width: s, height: d, aspectRatio: g ? String(g) : void 0, ...t === "loading" && T ? T : {} }, children: [
|
|
73
|
+
M && t !== "error" && /* @__PURE__ */ e(re, {}),
|
|
74
|
+
M && /* @__PURE__ */ e("span", { role: "status", className: "alea-visually-hidden", children: E ? l.loading : "" }),
|
|
75
|
+
t === "error" ? x ?? /* @__PURE__ */ h("span", { className: "alea-image-fallback", children: [
|
|
76
|
+
/* @__PURE__ */ e(V, { size: 22, "aria-hidden": "true" }),
|
|
77
|
+
/* @__PURE__ */ e("span", { children: l.imageFailed(r || "") })
|
|
78
|
+
] }) : Q
|
|
79
|
+
] });
|
|
80
|
+
return !b || t === "error" || N || !f ? A : /* @__PURE__ */ h(B, { children: [
|
|
81
|
+
/* @__PURE__ */ e("button", { type: "button", className: "alea-image-button alea-focus-ring", onClick: () => {
|
|
82
|
+
$(1), w(!0);
|
|
83
|
+
}, "aria-label": l.viewLarger(r || l.image.toLowerCase()), style: { width: s, height: d }, children: A }),
|
|
84
|
+
/* @__PURE__ */ e(W, { isOpen: a, onOpenChange: w, size: "full", className: "alea-image-overlay", children: /* @__PURE__ */ e(j, { "aria-label": r || l.imagePreview, hideClose: !0, className: "alea-image-dialog", children: ({ close: Z }) => /* @__PURE__ */ h(B, { children: [
|
|
85
|
+
/* @__PURE__ */ h("div", { className: "alea-image-tools", children: [
|
|
86
|
+
/* @__PURE__ */ e(z, { "aria-label": l.zoomOut, variant: "secondary", isDisabled: k <= 0.5, onPress: () => $((q) => Math.max(0.5, q - 0.25)), children: /* @__PURE__ */ e(ee, {}) }),
|
|
87
|
+
/* @__PURE__ */ h("span", { className: "alea-image-zoom", "aria-live": "polite", children: [
|
|
88
|
+
Math.round(k * 100),
|
|
89
|
+
"%"
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ e(z, { "aria-label": l.zoomIn, variant: "secondary", isDisabled: k >= 3, onPress: () => $((q) => Math.min(3, q + 0.25)), children: /* @__PURE__ */ e(ae, {}) }),
|
|
92
|
+
/* @__PURE__ */ e(z, { "aria-label": l.close, variant: "secondary", onPress: Z, children: /* @__PURE__ */ e(te, {}) })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ e("div", { className: "alea-image-stage", children: /* @__PURE__ */ e("img", { src: f, alt: r, style: { transform: `scale(${k})` } }) })
|
|
95
|
+
] }) }) })
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
let D = null, ne = null;
|
|
99
|
+
function se() {
|
|
100
|
+
return ne ?? (ne = import("qrcode-generator").then((f) => {
|
|
101
|
+
const r = f.default ?? f;
|
|
102
|
+
return r.stringToBytes = r.stringToBytesFuncs["UTF-8"], D = r;
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
const Ne = F(function({ value: r, size: s = 160, level: d = "M", logo: b, label: x, color: u = "#111011", background: n = "#ffffff", className: i, style: v, ...g }, p) {
|
|
106
|
+
const y = R(), [o, N] = C(D ? { qrcode: D } : null);
|
|
107
|
+
P(() => {
|
|
108
|
+
if (o) return;
|
|
109
|
+
let l = !0;
|
|
110
|
+
return se().then((t) => {
|
|
111
|
+
l && N({ qrcode: t });
|
|
112
|
+
}, () => {
|
|
113
|
+
}), () => {
|
|
114
|
+
l = !1;
|
|
115
|
+
};
|
|
116
|
+
}, [o]);
|
|
117
|
+
const m = O(() => {
|
|
118
|
+
if (!o) return null;
|
|
119
|
+
const l = o.qrcode(0, d);
|
|
120
|
+
l.addData(r), l.make();
|
|
121
|
+
const t = l.getModuleCount();
|
|
122
|
+
let c = "";
|
|
123
|
+
for (let a = 0; a < t; a++) for (let w = 0; w < t; w++) l.isDark(a, w) && (c += `M${w + 4} ${a + 4}h1v1h-1z`);
|
|
124
|
+
return { d: c, n: t + 8 };
|
|
125
|
+
}, [o, r, d]);
|
|
126
|
+
return /* @__PURE__ */ h("span", { ref: p, ...g, className: I("alea-qr", i), style: { width: s, height: s, ...v }, role: "img", "aria-label": x ?? g["aria-label"] ?? y.qrCode(r), children: [
|
|
127
|
+
m && /* @__PURE__ */ h("svg", { viewBox: `0 0 ${m.n} ${m.n}`, width: s, height: s, shapeRendering: "crispEdges", "aria-hidden": "true", children: [
|
|
128
|
+
/* @__PURE__ */ e("rect", { width: m.n, height: m.n, fill: n, rx: m.n * 0.06 }),
|
|
129
|
+
/* @__PURE__ */ e("path", { d: m.d, fill: u })
|
|
130
|
+
] }),
|
|
131
|
+
b && m && /* @__PURE__ */ e("span", { className: "alea-qr-logo", "aria-hidden": "true", style: { background: n }, children: b })
|
|
132
|
+
] });
|
|
133
|
+
});
|
|
134
|
+
function ye({ children: f, text: r, rotate: s = -22, gap: d = 120, opacity: b = 0.08, className: x }) {
|
|
135
|
+
const u = O(() => {
|
|
136
|
+
const n = d + r.length * 7.5, i = d, v = `<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${i}"><text x="50%" y="50%" fill="currentColor" font-family="Inter, sans-serif" font-size="14" font-weight="600" text-anchor="middle" dominant-baseline="middle" transform="rotate(${s} ${n / 2} ${i / 2})">${r.replace(/[<&>"]/g, (g) => ({ "<": "<", "&": "&", ">": ">", '"': """ })[g])}</text></svg>`;
|
|
137
|
+
return `url("data:image/svg+xml,${encodeURIComponent(v)}")`;
|
|
138
|
+
}, [r, s, d]);
|
|
139
|
+
return /* @__PURE__ */ h("div", { className: I("alea-watermark", x), children: [
|
|
140
|
+
f,
|
|
141
|
+
/* @__PURE__ */ e("span", { className: "alea-watermark-layer", "aria-hidden": "true", style: { WebkitMaskImage: u, maskImage: u, opacity: b } })
|
|
142
|
+
] });
|
|
143
|
+
}
|
|
144
|
+
const we = F(function({ steps: r, isOpen: s, onOpenChange: d, onFinish: b, className: x, style: u }, n) {
|
|
145
|
+
const i = R(), [v, g] = C(0), [p, y] = C(null), o = r[v];
|
|
146
|
+
if (P(() => {
|
|
147
|
+
s && g(0);
|
|
148
|
+
}, [s]), _(() => {
|
|
149
|
+
if (!s || !o) return;
|
|
150
|
+
const l = typeof o.target == "string" ? document.querySelector(o.target) : o.target || null;
|
|
151
|
+
if (!l) {
|
|
152
|
+
y(null);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
l.scrollIntoView({ block: "center", behavior: "smooth" });
|
|
156
|
+
const t = () => y(l.getBoundingClientRect());
|
|
157
|
+
t();
|
|
158
|
+
const c = setTimeout(t, 350);
|
|
159
|
+
return window.addEventListener("resize", t), window.addEventListener("scroll", t, !0), () => {
|
|
160
|
+
clearTimeout(c), window.removeEventListener("resize", t), window.removeEventListener("scroll", t, !0);
|
|
161
|
+
};
|
|
162
|
+
}, [s, v, o]), !o) return null;
|
|
163
|
+
const N = 8, m = p ? { top: Math.min(window.innerHeight - 220, p.bottom + N + 12), left: Math.max(16, Math.min(window.innerWidth - 336, p.left)) } : { top: "50%", left: "50%", transform: "translate(-50%, -50%)" };
|
|
164
|
+
return /* @__PURE__ */ e(W, { isOpen: s, onOpenChange: d, isDismissable: !1, className: "alea-tour-overlay", children: /* @__PURE__ */ e(j, { ref: n, style: u, "aria-label": typeof o.title == "string" ? o.title : i.stepN(v + 1), hideClose: !0, className: I("alea-tour", x), children: ({ close: l }) => /* @__PURE__ */ h(B, { children: [
|
|
165
|
+
p && /* @__PURE__ */ e("span", { className: "alea-tour-spot", "aria-hidden": "true", style: { top: p.top - N, left: p.left - N, width: p.width + N * 2, height: p.height + N * 2 } }),
|
|
166
|
+
/* @__PURE__ */ h("div", { className: "alea-tour-card", style: m, children: [
|
|
167
|
+
/* @__PURE__ */ e("p", { className: "alea-tour-count", children: i.stepNOfTotal(v + 1, r.length) }),
|
|
168
|
+
/* @__PURE__ */ e("h2", { className: "alea-tour-title", children: o.title }),
|
|
169
|
+
o.content && /* @__PURE__ */ e("div", { className: "alea-tour-text", children: o.content }),
|
|
170
|
+
/* @__PURE__ */ h("div", { className: "alea-tour-actions", children: [
|
|
171
|
+
/* @__PURE__ */ e(S, { size: "sm", variant: "ghost", onPress: l, children: i.skip }),
|
|
172
|
+
/* @__PURE__ */ e("span", { className: "alea-tour-spacer" }),
|
|
173
|
+
v > 0 && /* @__PURE__ */ e(S, { size: "sm", variant: "ghost", onPress: () => g((t) => t - 1), children: i.back }),
|
|
174
|
+
/* @__PURE__ */ e(S, { size: "sm", autoFocus: !0, onPress: () => {
|
|
175
|
+
v < r.length - 1 ? g((t) => t + 1) : (b == null || b(), l());
|
|
176
|
+
}, children: v < r.length - 1 ? i.next : i.done })
|
|
177
|
+
] })
|
|
178
|
+
] })
|
|
179
|
+
] }) }) });
|
|
180
|
+
});
|
|
181
|
+
export {
|
|
182
|
+
pe as Carousel,
|
|
183
|
+
be as Image,
|
|
184
|
+
Ne as QRCode,
|
|
185
|
+
ve as Timeline,
|
|
186
|
+
we as Tour,
|
|
187
|
+
ye as Watermark
|
|
188
|
+
};
|