@alea-design/ui 0.5.1 → 0.6.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/dist/components/button/Button.d.ts +3 -1
- package/dist/components/button/Button.js +64 -63
- package/dist/components/card/Card.d.ts +6 -2
- package/dist/components/card/Card.js +20 -20
- package/dist/components/combobox/Autocomplete.d.ts +4 -0
- package/dist/components/combobox/Autocomplete.js +89 -87
- package/dist/components/command/CommandPalette.d.ts +10 -0
- package/dist/components/command/CommandPalette.js +76 -52
- package/dist/components/data/Data.d.ts +6 -4
- package/dist/components/data/Data.js +66 -56
- package/dist/components/date/Date.d.ts +16 -2
- package/dist/components/date/Date.js +80 -69
- package/dist/components/display/Display.d.ts +3 -1
- package/dist/components/display/Display.js +27 -27
- package/dist/components/display/Display2.d.ts +2 -2
- package/dist/components/display/Display2.js +28 -27
- package/dist/components/feedback/Feedback.d.ts +3 -1
- package/dist/components/feedback/Feedback.js +102 -102
- package/dist/components/feedback/PageSkeleton.d.ts +19 -0
- package/dist/components/feedback/PageSkeleton.js +58 -0
- package/dist/components/field/Field.d.ts +3 -1
- package/dist/components/field/Field.js +82 -82
- package/dist/components/filter/FilterBar.d.ts +5 -2
- package/dist/components/filter/FilterBar.js +97 -66
- package/dist/components/form/Form.d.ts +8 -2
- package/dist/components/form/Form.js +53 -40
- package/dist/components/icon/icon-names.d.ts +2 -2
- package/dist/components/icon/icon-names.js +4 -2
- package/dist/components/list/List.d.ts +6 -2
- package/dist/components/list/List.js +65 -62
- package/dist/components/list/Lists2.d.ts +4 -0
- package/dist/components/list/Lists2.js +35 -35
- package/dist/components/media/Media.js +27 -27
- package/dist/components/more/More.d.ts +2 -2
- package/dist/components/more/More.js +46 -45
- package/dist/components/navigation/Navigation.d.ts +7 -5
- package/dist/components/navigation/Navigation.js +91 -74
- package/dist/components/navigation/Navigation2.d.ts +9 -3
- package/dist/components/navigation/Navigation2.js +209 -195
- package/dist/components/notification/NotificationCenter.js +70 -70
- package/dist/components/overlay/Drawer.d.ts +6 -1
- package/dist/components/overlay/Drawer.js +27 -25
- package/dist/components/overlay/Modal.d.ts +5 -0
- package/dist/components/overlay/Modal.js +16 -15
- package/dist/components/overlay/Overlay.d.ts +10 -1
- package/dist/components/overlay/Overlay.js +54 -52
- package/dist/components/overlay/Sheet.d.ts +2 -0
- package/dist/components/overlay/Sheet.js +30 -30
- package/dist/components/page/PageParts.js +20 -20
- package/dist/components/select/Select.js +75 -70
- package/dist/components/settings/Settings.d.ts +29 -0
- package/dist/components/settings/Settings.js +31 -0
- package/dist/components/shell/AccountMenu.d.ts +20 -0
- package/dist/components/shell/AccountMenu.js +32 -0
- package/dist/components/shell/AppShell.d.ts +9 -2
- package/dist/components/shell/AppShell.js +37 -37
- package/dist/components/shell/AppSidebar.d.ts +9 -3
- package/dist/components/shell/AppSidebar.js +45 -39
- package/dist/components/table/Table.d.ts +18 -4
- package/dist/components/table/Table.js +70 -46
- package/dist/components/tabs/Tabs.js +105 -94
- package/dist/components/theme/Theme.d.ts +7 -4
- package/dist/components/theme/Theme.js +127 -130
- package/dist/components/upload/Upload.js +62 -54
- package/dist/css/base.css +1 -1
- package/dist/css/button.css +1 -1
- package/dist/css/card.css +1 -1
- package/dist/css/command.css +1 -1
- package/dist/css/date.css +1 -1
- package/dist/css/display.css +1 -1
- package/dist/css/feedback.css +1 -1
- package/dist/css/field.css +1 -1
- package/dist/css/form.css +1 -1
- package/dist/css/groups.json +36 -20
- package/dist/css/list.css +1 -1
- package/dist/css/menu.css +1 -1
- package/dist/css/navigation.css +1 -1
- package/dist/css/notification.css +1 -1
- package/dist/css/overlay.css +1 -1
- package/dist/css/page.css +1 -1
- package/dist/css/select.css +1 -1
- package/dist/css/settings.css +1 -0
- package/dist/css/shell.css +1 -1
- package/dist/css/table.css +1 -1
- package/dist/css/tabs.css +1 -1
- package/dist/css/upload.css +1 -1
- package/dist/i18n/strings.d.ts +7 -0
- package/dist/i18n/strings.js +14 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +318 -306
- package/dist/styles.css +1 -1
- package/dist/utils/animateRows.d.ts +11 -0
- package/dist/utils/animateRows.js +23 -0
- package/dist/utils/decimal.d.ts +12 -0
- package/dist/utils/decimal.js +48 -0
- package/dist/utils/initialFocus.d.ts +6 -0
- package/dist/utils/initialFocus.js +24 -0
- package/dist/utils/refs.d.ts +2 -0
- package/dist/utils/refs.js +14 -6
- package/package.json +3 -3
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as c, jsx as a, Fragment as
|
|
3
|
-
import { useId as
|
|
4
|
-
import { useLocale as
|
|
5
|
-
import { Bell as U, CheckCheck as ge, X, CircleAlert as
|
|
6
|
-
import { Presence as
|
|
7
|
-
import { cx as
|
|
8
|
-
import { useStrings as
|
|
9
|
-
import { IconButton as
|
|
10
|
-
import { Badge as
|
|
11
|
-
import { EmptyState as
|
|
2
|
+
import { jsxs as c, jsx as a, Fragment as de } from "react/jsx-runtime";
|
|
3
|
+
import { useId as ue, useState as N, useRef as v, useEffect as Q, useMemo as fe, useLayoutEffect as me, useCallback as he, useSyncExternalStore as pe } from "react";
|
|
4
|
+
import { useLocale as we, DialogTrigger as Ne, Dialog as xe, Heading as ye } from "react-aria-components";
|
|
5
|
+
import { Bell as U, CheckCheck as ge, X, CircleAlert as ve, TriangleAlert as Se, CircleCheck as be, Info as Ie, Check as Te } from "lucide-react";
|
|
6
|
+
import { Presence as Ee, Reveal as ke } from "@alea-design/motion";
|
|
7
|
+
import { cx as ze } from "../../utils/cx.js";
|
|
8
|
+
import { useStrings as De } from "../../i18n/strings.js";
|
|
9
|
+
import { IconButton as S, Button as _ } from "../button/Button.js";
|
|
10
|
+
import { CountBadge as Le, Badge as Pe } from "../display/Display.js";
|
|
11
|
+
import { EmptyState as Me } from "../data/Data.js";
|
|
12
12
|
import { Popover as $e } from "../overlay/Overlay.js";
|
|
13
|
-
import { Drawer as
|
|
14
|
-
const
|
|
13
|
+
import { Drawer as Ae } from "../overlay/Drawer.js";
|
|
14
|
+
const Be = { info: Ie, success: be, warning: Se, danger: ve }, J = "(max-width: 639.98px)";
|
|
15
15
|
function Fe() {
|
|
16
|
-
const r =
|
|
16
|
+
const r = he((d) => {
|
|
17
17
|
var s;
|
|
18
18
|
if (typeof window > "u" || !window.matchMedia) return () => {
|
|
19
19
|
};
|
|
20
|
-
const o = window.matchMedia(
|
|
20
|
+
const o = window.matchMedia(J);
|
|
21
21
|
return (s = o.addEventListener) == null || s.call(o, "change", d), () => {
|
|
22
22
|
var l;
|
|
23
23
|
return (l = o.removeEventListener) == null ? void 0 : l.call(o, "change", d);
|
|
24
24
|
};
|
|
25
25
|
}, []);
|
|
26
|
-
return
|
|
26
|
+
return pe(r, () => typeof window < "u" && window.matchMedia ? window.matchMedia(J).matches : !1, () => !1);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function Ce(r, d = 3e4) {
|
|
29
29
|
const [o, s] = N(() => Date.now());
|
|
30
|
-
return
|
|
30
|
+
return Q(() => {
|
|
31
31
|
if (!r) return;
|
|
32
32
|
s(Date.now());
|
|
33
33
|
const l = window.setInterval(() => s(Date.now()), d);
|
|
@@ -35,29 +35,29 @@ function Be(r, d = 3e4) {
|
|
|
35
35
|
}, [r, d]), o;
|
|
36
36
|
}
|
|
37
37
|
function Oe(r, d, o) {
|
|
38
|
-
const s = Math.round((r.getTime() - d) / 1e3), l = Math.abs(s),
|
|
39
|
-
return l < 45 ?
|
|
38
|
+
const s = Math.round((r.getTime() - d) / 1e3), l = Math.abs(s), m = new Intl.RelativeTimeFormat(o, { numeric: "auto" });
|
|
39
|
+
return l < 45 ? m.format(0, "second") : l < 3600 ? m.format(Math.round(s / 60), "minute") : l < 86400 ? m.format(Math.round(s / 3600), "hour") : m.format(Math.round(s / 86400), "day");
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function Ye({
|
|
42
42
|
items: r,
|
|
43
43
|
onChange: d,
|
|
44
44
|
onMarkRead: o,
|
|
45
45
|
onMarkAllRead: s,
|
|
46
46
|
onDismiss: l,
|
|
47
|
-
onAction:
|
|
47
|
+
onAction: m,
|
|
48
48
|
labels: x,
|
|
49
49
|
presentation: k = "auto",
|
|
50
|
-
placement:
|
|
50
|
+
placement: V = "bottom end",
|
|
51
51
|
isOpen: z,
|
|
52
|
-
defaultOpen:
|
|
53
|
-
onOpenChange:
|
|
54
|
-
max:
|
|
55
|
-
announce:
|
|
52
|
+
defaultOpen: W,
|
|
53
|
+
onOpenChange: b,
|
|
54
|
+
max: I = 99,
|
|
55
|
+
announce: Y = !0,
|
|
56
56
|
motion: D,
|
|
57
|
-
className:
|
|
57
|
+
className: Z
|
|
58
58
|
}) {
|
|
59
59
|
var K;
|
|
60
|
-
const u =
|
|
60
|
+
const u = De(), { locale: L } = we(), f = {
|
|
61
61
|
title: u.notifications,
|
|
62
62
|
bell: u.notificationBell,
|
|
63
63
|
markRead: u.markRead,
|
|
@@ -69,23 +69,23 @@ function We({
|
|
|
69
69
|
unread: u.unreadNotification,
|
|
70
70
|
...x,
|
|
71
71
|
tones: { ...u.notificationTones, ...x == null ? void 0 : x.tones }
|
|
72
|
-
}, P =
|
|
73
|
-
z === void 0 &&
|
|
74
|
-
},
|
|
75
|
-
|
|
72
|
+
}, P = ue(), q = Fe(), M = k === "drawer" || k === "auto" && q, [ee, te] = N(W ?? !1), $ = z ?? ee, ne = (t) => {
|
|
73
|
+
z === void 0 && te(t), b == null || b(t);
|
|
74
|
+
}, ae = Ce($), p = r.filter((t) => !t.read).length, A = v(null), [re, B] = N({ text: "", n: 0 });
|
|
75
|
+
Q(() => {
|
|
76
76
|
const t = A.current;
|
|
77
|
-
if (A.current = new Set(r.map((i) => i.id)), !t || !
|
|
77
|
+
if (A.current = new Set(r.map((i) => i.id)), !t || !Y) return;
|
|
78
78
|
const e = r.filter((i) => !i.read && !t.has(i.id));
|
|
79
79
|
if (!e.length) return;
|
|
80
|
-
|
|
81
|
-
const n = window.setTimeout(() =>
|
|
80
|
+
B((i) => ({ text: e.map((h) => f.newNotification(h.title)).join(". "), n: i.n + 1 }));
|
|
81
|
+
const n = window.setTimeout(() => B((i) => ({ ...i, text: "" })), 6e3);
|
|
82
82
|
return () => window.clearTimeout(n);
|
|
83
83
|
}, [r]);
|
|
84
|
-
const [
|
|
84
|
+
const [F, C] = N([]), O = fe(() => {
|
|
85
85
|
const t = r.map((n) => ({ item: n, leaving: !1 })), e = new Set(r.map((n) => n.id));
|
|
86
|
-
for (const n of
|
|
86
|
+
for (const n of F) e.has(n.item.id) || t.splice(Math.min(n.index, t.length), 0, { item: n.item, leaving: !0 });
|
|
87
87
|
return t;
|
|
88
|
-
}, [r,
|
|
88
|
+
}, [r, F]), T = v(null), H = v(null), [R, y] = N(null), ie = r.some((t) => t.id === R) ? R : ((K = r[0]) == null ? void 0 : K.id) ?? null, g = v(null);
|
|
89
89
|
me(() => {
|
|
90
90
|
var n;
|
|
91
91
|
const t = g.current;
|
|
@@ -94,35 +94,35 @@ function We({
|
|
|
94
94
|
e && (g.current = null, e.focus());
|
|
95
95
|
});
|
|
96
96
|
const E = (t) => d == null ? void 0 : d(t), j = (t) => {
|
|
97
|
-
g.current = t.id,
|
|
98
|
-
},
|
|
97
|
+
g.current = t.id, y(t.id), o == null || o(t), E(r.map((e) => e.id === t.id ? { ...e, read: !0 } : e));
|
|
98
|
+
}, oe = () => {
|
|
99
99
|
const t = r.filter((e) => !e.read);
|
|
100
100
|
t.length && (s == null || s(t), E(r.map((e) => e.read ? e : { ...e, read: !0 })));
|
|
101
|
-
},
|
|
101
|
+
}, se = (t) => {
|
|
102
102
|
const e = r.findIndex((i) => i.id === t.id), n = r[e + 1] ?? r[e - 1];
|
|
103
|
-
g.current = n ? n.id : "empty", n &&
|
|
104
|
-
},
|
|
103
|
+
g.current = n ? n.id : "empty", n && y(n.id), C((i) => [...i, { item: t, index: e }]), window.setTimeout(() => C((i) => i.filter((h) => h.item.id !== t.id)), 400), l == null || l(t), E(r.filter((i) => i.id !== t.id));
|
|
104
|
+
}, le = (t) => {
|
|
105
105
|
var e, n;
|
|
106
|
-
(n = (e = t.action) == null ? void 0 : e.onPress) == null || n.call(e),
|
|
107
|
-
},
|
|
108
|
-
var
|
|
106
|
+
(n = (e = t.action) == null ? void 0 : e.onPress) == null || n.call(e), m == null || m(t), t.read || j(t);
|
|
107
|
+
}, ce = (t) => {
|
|
108
|
+
var h;
|
|
109
109
|
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(t.key)) return;
|
|
110
|
-
const e = [...((
|
|
110
|
+
const e = [...((h = T.current) == null ? void 0 : h.querySelectorAll("[data-nid]:not([data-leaving])")) ?? []];
|
|
111
111
|
if (!e.length) return;
|
|
112
112
|
const n = e.findIndex((w) => w.contains(t.target)), i = t.key === "Home" ? 0 : t.key === "End" ? e.length - 1 : t.key === "ArrowDown" ? Math.min(n + 1, e.length - 1) : Math.max(n - 1, 0);
|
|
113
|
-
t.preventDefault(),
|
|
114
|
-
}, G = /* @__PURE__ */ a(
|
|
113
|
+
t.preventDefault(), y(e[i].dataset.nid ?? null), e[i].focus();
|
|
114
|
+
}, G = /* @__PURE__ */ a(xe, { className: "alea-notifs", "aria-labelledby": P, children: ({ close: t }) => /* @__PURE__ */ c(de, { children: [
|
|
115
115
|
/* @__PURE__ */ c("div", { className: "alea-notifs-head", children: [
|
|
116
|
-
/* @__PURE__ */ c(
|
|
116
|
+
/* @__PURE__ */ c(ye, { slot: "title", id: P, className: "alea-notifs-title", children: [
|
|
117
117
|
f.title,
|
|
118
|
-
|
|
118
|
+
p > 0 && /* @__PURE__ */ a(Pe, { tone: "accent", size: "sm", "aria-hidden": "true", children: p > I ? `${I}+` : p })
|
|
119
119
|
] }),
|
|
120
|
-
/* @__PURE__ */ a(_, { variant: "text", size: "xs", iconStart: /* @__PURE__ */ a(ge, {}), isDisabled:
|
|
121
|
-
|
|
120
|
+
/* @__PURE__ */ a(_, { variant: "text", size: "xs", iconStart: /* @__PURE__ */ a(ge, {}), isDisabled: p === 0, onPress: oe, children: f.markAllRead }),
|
|
121
|
+
M && /* @__PURE__ */ a(S, { "aria-label": u.close, size: "xs", onPress: t, children: /* @__PURE__ */ a(X, {}) })
|
|
122
122
|
] }),
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
return /* @__PURE__ */ a(
|
|
123
|
+
O.length === 0 ? /* @__PURE__ */ a("div", { className: "alea-notifs-empty", ref: H, tabIndex: -1, children: /* @__PURE__ */ a(Me, { size: "sm", title: f.emptyTitle, description: f.emptyDescription, icon: /* @__PURE__ */ a(U, {}) }) }) : /* @__PURE__ */ a("ul", { className: "alea-notifs-list", ref: T, onKeyDown: ce, children: O.map(({ item: e, leaving: n }, i) => {
|
|
124
|
+
const h = Be[e.tone], w = !n && e.id === ie;
|
|
125
|
+
return /* @__PURE__ */ a(Ee, { show: !n, exitClassName: "alea-notif-out", children: /* @__PURE__ */ a(
|
|
126
126
|
"li",
|
|
127
127
|
{
|
|
128
128
|
className: "alea-notif",
|
|
@@ -131,9 +131,9 @@ function We({
|
|
|
131
131
|
"data-unread": e.read ? void 0 : !0,
|
|
132
132
|
"data-leaving": n || void 0,
|
|
133
133
|
tabIndex: w ? 0 : -1,
|
|
134
|
-
onFocus: () => !n &&
|
|
135
|
-
children: /* @__PURE__ */ c(
|
|
136
|
-
/* @__PURE__ */ a("span", { className: "alea-notif-icon", "aria-hidden": "true", children: /* @__PURE__ */ a(
|
|
134
|
+
onFocus: () => !n && y(e.id),
|
|
135
|
+
children: /* @__PURE__ */ c(ke, { className: "alea-notif-inner", motion: "rise", delay: Math.min(i, 6) * 30, children: [
|
|
136
|
+
/* @__PURE__ */ a("span", { className: "alea-notif-icon", "aria-hidden": "true", children: /* @__PURE__ */ a(h, {}) }),
|
|
137
137
|
/* @__PURE__ */ c("div", { className: "alea-notif-body", children: [
|
|
138
138
|
/* @__PURE__ */ c("p", { className: "alea-notif-title", children: [
|
|
139
139
|
/* @__PURE__ */ c("span", { className: "alea-visually-hidden", children: [
|
|
@@ -145,7 +145,7 @@ function We({
|
|
|
145
145
|
] }),
|
|
146
146
|
e.description && /* @__PURE__ */ a("p", { className: "alea-notif-text", children: e.description }),
|
|
147
147
|
/* @__PURE__ */ c("p", { className: "alea-notif-meta", children: [
|
|
148
|
-
/* @__PURE__ */ a("time", { dateTime: e.time.toISOString(), title: e.time.toLocaleString(L), children: Oe(e.time,
|
|
148
|
+
/* @__PURE__ */ a("time", { dateTime: e.time.toISOString(), title: e.time.toLocaleString(L), children: Oe(e.time, ae, L) }),
|
|
149
149
|
e.action && /* @__PURE__ */ a(
|
|
150
150
|
_,
|
|
151
151
|
{
|
|
@@ -154,32 +154,32 @@ function We({
|
|
|
154
154
|
href: e.action.href,
|
|
155
155
|
excludeFromTabOrder: !w,
|
|
156
156
|
className: "alea-notif-action",
|
|
157
|
-
onPress: () =>
|
|
157
|
+
onPress: () => le(e),
|
|
158
158
|
children: e.action.label
|
|
159
159
|
}
|
|
160
160
|
)
|
|
161
161
|
] })
|
|
162
162
|
] }),
|
|
163
163
|
/* @__PURE__ */ c("div", { className: "alea-notif-tools", children: [
|
|
164
|
-
!e.read && /* @__PURE__ */ a(
|
|
165
|
-
/* @__PURE__ */ a(
|
|
164
|
+
!e.read && /* @__PURE__ */ a(S, { "aria-label": `${f.markRead}: ${e.title}`, size: "xs", excludeFromTabOrder: !w, onPress: () => j(e), children: /* @__PURE__ */ a(Te, {}) }),
|
|
165
|
+
/* @__PURE__ */ a(S, { "aria-label": `${f.dismiss}: ${e.title}`, size: "xs", excludeFromTabOrder: !w, onPress: () => se(e), children: /* @__PURE__ */ a(X, {}) })
|
|
166
166
|
] })
|
|
167
167
|
] })
|
|
168
168
|
}
|
|
169
169
|
) }, e.id);
|
|
170
170
|
}) })
|
|
171
171
|
] }) });
|
|
172
|
-
return /* @__PURE__ */ c("span", { className:
|
|
173
|
-
/* @__PURE__ */ c(
|
|
172
|
+
return /* @__PURE__ */ c("span", { className: ze("alea-notifs-root", Z), children: [
|
|
173
|
+
/* @__PURE__ */ c(Ne, { isOpen: $, onOpenChange: ne, children: [
|
|
174
174
|
/* @__PURE__ */ c("span", { className: "alea-notifs-bell", children: [
|
|
175
|
-
/* @__PURE__ */ a(
|
|
176
|
-
|
|
175
|
+
/* @__PURE__ */ a(S, { "aria-label": f.bell(p), variant: "ghost", children: /* @__PURE__ */ a(U, {}) }),
|
|
176
|
+
/* @__PURE__ */ a(Le, { className: "alea-notifs-count", count: p, max: I, tone: "danger", size: "sm", "aria-hidden": "true" })
|
|
177
177
|
] }),
|
|
178
|
-
|
|
178
|
+
M ? /* @__PURE__ */ a(Ae, { placement: "bottom", size: 640, motion: D, className: "alea-notifs-drawer", children: G }) : /* @__PURE__ */ a($e, { placement: V, size: "lg", motion: D, className: "alea-notifs-popover", children: G })
|
|
179
179
|
] }),
|
|
180
|
-
/* @__PURE__ */ a("span", { className: "alea-visually-hidden", role: "status", "aria-live": "polite", "aria-atomic": "true", children:
|
|
180
|
+
/* @__PURE__ */ a("span", { className: "alea-visually-hidden", role: "status", "aria-live": "polite", "aria-atomic": "true", children: re.text })
|
|
181
181
|
] });
|
|
182
182
|
}
|
|
183
183
|
export {
|
|
184
|
-
|
|
184
|
+
Ye as NotificationCenter
|
|
185
185
|
};
|
|
@@ -3,6 +3,7 @@ import { DialogTrigger, type ModalOverlayProps } from 'react-aria-components';
|
|
|
3
3
|
import { type MotionProp } from '@alea-design/motion';
|
|
4
4
|
import { type DialogProps, type PopoverProps } from './Overlay.js';
|
|
5
5
|
import { type SurfaceProps } from '../surface/Surface.js';
|
|
6
|
+
import { type InitialFocus } from '../../utils/initialFocus.js';
|
|
6
7
|
export interface DrawerProps extends Omit<ModalOverlayProps, 'children'>, Pick<SurfaceProps, 'surface'> {
|
|
7
8
|
children: ReactNode;
|
|
8
9
|
/** Side it slides in from. Default end (right in left-to-right). */
|
|
@@ -11,9 +12,13 @@ export interface DrawerProps extends Omit<ModalOverlayProps, 'children'>, Pick<S
|
|
|
11
12
|
size?: number | string;
|
|
12
13
|
/** How it enters and leaves (default: from its edge): a preset, false, or options. */
|
|
13
14
|
motion?: MotionProp;
|
|
15
|
+
/** What is behind it: blur (dim and blur, default) or dim (only the dark layer, no backdrop-filter). */
|
|
16
|
+
backdrop?: 'blur' | 'dim';
|
|
17
|
+
/** Where focus goes when it opens: dialog (default, the dialog itself), first-field (the first input, picker or date field) or a CSS selector for the control inside it. */
|
|
18
|
+
initialFocus?: InitialFocus;
|
|
14
19
|
}
|
|
15
20
|
/** A panel that slides in from the side: filters, details, navigation on mobile. Focus is trapped, Escape closes. */
|
|
16
|
-
export declare function Drawer({ children, placement, size, className, isDismissable, motion, surface, ...props }: DrawerProps): import("react").JSX.Element;
|
|
21
|
+
export declare function Drawer({ children, placement, size, className, isDismissable, motion, backdrop, initialFocus, surface, ...props }: DrawerProps): import("react").JSX.Element;
|
|
17
22
|
/** The content of a Drawer: title, body and footer, like Dialog. */
|
|
18
23
|
export declare function DrawerContent(props: DialogProps): import("react").JSX.Element;
|
|
19
24
|
export { DialogTrigger as DrawerTrigger };
|
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as
|
|
2
|
+
import { jsx as r, jsxs as d, Fragment as y } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as x } from "react";
|
|
4
4
|
import { ModalOverlay as D, Modal as P, DialogTrigger as N } from "react-aria-components";
|
|
5
|
-
import { DialogTrigger as
|
|
6
|
-
import { withMotionStyle as
|
|
7
|
-
import { withBase as
|
|
8
|
-
import { Button as
|
|
9
|
-
import { Dialog as
|
|
10
|
-
import { useStrings as
|
|
11
|
-
import { renamedValue as
|
|
12
|
-
import { surfaceAttrs as
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
import { DialogTrigger as Y } from "react-aria-components";
|
|
6
|
+
import { withMotionStyle as F } from "@alea-design/motion";
|
|
7
|
+
import { withBase as M, cx as T } from "../../utils/cx.js";
|
|
8
|
+
import { Button as g } from "../button/Button.js";
|
|
9
|
+
import { Dialog as j, Popover as A, PopoverDialog as B } from "./Overlay.js";
|
|
10
|
+
import { useStrings as R } from "../../i18n/strings.js";
|
|
11
|
+
import { renamedValue as S } from "../../utils/vocabulary.js";
|
|
12
|
+
import { surfaceAttrs as k } from "../surface/Surface.js";
|
|
13
|
+
import { useInitialFocus as z } from "../../utils/initialFocus.js";
|
|
14
|
+
function K({ children: o, placement: a = "end", size: e = 420, className: l, isDismissable: t = !0, motion: n, backdrop: i, initialFocus: m, surface: s, ...c }) {
|
|
15
|
+
const p = z(m);
|
|
16
|
+
return /* @__PURE__ */ r(D, { ...c, isDismissable: t, className: M("alea-modal-overlay alea-drawer-overlay", l), "data-placement": a, "data-backdrop": i, children: /* @__PURE__ */ r(P, { ref: p, className: "alea-drawer", "data-placement": a, ...k({ surface: s }), style: F({ "--alea-drawer-size": typeof e == "number" ? `${e}px` : e }, n), children: o }) });
|
|
15
17
|
}
|
|
16
|
-
function
|
|
17
|
-
return /* @__PURE__ */ r(
|
|
18
|
+
function Q(o) {
|
|
19
|
+
return /* @__PURE__ */ r(j, { ...o, className: "alea-drawer-content" });
|
|
18
20
|
}
|
|
19
|
-
const
|
|
20
|
-
const v =
|
|
21
|
-
return n ?? (n =
|
|
21
|
+
const U = x(function({ motion: a, children: e, title: l, description: t, confirmLabel: n, cancelLabel: i, tone: m, onConfirm: s, placement: c = "top", className: p, style: h }, w) {
|
|
22
|
+
const v = S("Popconfirm", "tone", m, { default: "neutral" }) ?? "neutral", f = R();
|
|
23
|
+
return n ?? (n = f.yes), i ?? (i = f.cancel), /* @__PURE__ */ d(N, { children: [
|
|
22
24
|
e,
|
|
23
|
-
/* @__PURE__ */ r(
|
|
25
|
+
/* @__PURE__ */ r(A, { showArrow: !0, placement: c, motion: a, children: /* @__PURE__ */ r(B, { ref: w, style: h, role: "alertdialog", title: l, className: T("alea-popover-dialog alea-popconfirm", p), children: ({ close: u }) => /* @__PURE__ */ d(y, { children: [
|
|
24
26
|
t && /* @__PURE__ */ r("p", { className: "alea-popconfirm-text", children: t }),
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */ r(
|
|
27
|
-
/* @__PURE__ */ r(
|
|
28
|
-
await
|
|
27
|
+
/* @__PURE__ */ d("div", { className: "alea-popconfirm-actions", children: [
|
|
28
|
+
/* @__PURE__ */ r(g, { size: "sm", variant: "ghost", onPress: u, children: i }),
|
|
29
|
+
/* @__PURE__ */ r(g, { size: "sm", variant: v === "danger" ? "danger" : "primary", autoFocus: !0, onPress: async () => {
|
|
30
|
+
await s(), u();
|
|
29
31
|
}, children: n })
|
|
30
32
|
] })
|
|
31
33
|
] }) }) })
|
|
32
34
|
] });
|
|
33
35
|
});
|
|
34
36
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
K as Drawer,
|
|
38
|
+
Q as DrawerContent,
|
|
39
|
+
Y as DrawerTrigger,
|
|
40
|
+
U as Popconfirm
|
|
39
41
|
};
|
|
@@ -2,6 +2,7 @@ import { type CSSProperties, type ReactNode } from 'react';
|
|
|
2
2
|
import { type ModalOverlayProps } from 'react-aria-components';
|
|
3
3
|
import { type MotionProp } from '@alea-design/motion';
|
|
4
4
|
import { type SurfaceProps } from '../surface/Surface.js';
|
|
5
|
+
import { type InitialFocus } from '../../utils/initialFocus.js';
|
|
5
6
|
type Render = ReactNode | ((opts: {
|
|
6
7
|
close: () => void;
|
|
7
8
|
}) => ReactNode);
|
|
@@ -22,6 +23,8 @@ export interface ModalProps extends Omit<ModalOverlayProps, 'children' | 'classN
|
|
|
22
23
|
footer?: Render;
|
|
23
24
|
/** xs 320, sm 400, md 560 (default), lg 760, xl 960, full (the whole window less a margin), or auto (as wide as its content). */
|
|
24
25
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'auto';
|
|
26
|
+
/** Size of the title: md (24 px display, default) or sm (16 px, semibold) for compact dialogs, forms and settings. */
|
|
27
|
+
titleSize?: 'sm' | 'md';
|
|
25
28
|
/** center (default) or top (stays put while its content grows, good for search and long forms). */
|
|
26
29
|
placement?: 'center' | 'top';
|
|
27
30
|
/** inside: the header and footer stay, the body scrolls (default). outside: the whole modal scrolls with the page, for long reading. */
|
|
@@ -36,6 +39,8 @@ export interface ModalProps extends Omit<ModalOverlayProps, 'children' | 'classN
|
|
|
36
39
|
fullscreenBelow?: 'sm' | 'md';
|
|
37
40
|
/** How it enters and leaves (default rise): a preset, false, or options. */
|
|
38
41
|
motion?: MotionProp;
|
|
42
|
+
/** Where focus goes when it opens: dialog (default, the dialog itself, so its title is read first), first-field (the first input, picker or date field in the body) or a CSS selector for the control inside it. */
|
|
43
|
+
initialFocus?: InitialFocus;
|
|
39
44
|
/** Extra class names for the modal surface. */
|
|
40
45
|
className?: string;
|
|
41
46
|
}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as a, jsxs as i, Fragment as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { ModalOverlay as
|
|
2
|
+
import { jsx as a, jsxs as i, Fragment as X } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as $ } from "react";
|
|
4
|
+
import { ModalOverlay as q, Modal as E, Dialog as G, Heading as J, DialogTrigger as K } from "react-aria-components";
|
|
5
5
|
import { X as v } from "lucide-react";
|
|
6
|
-
import { withMotionStyle as
|
|
7
|
-
import { cx as
|
|
6
|
+
import { withMotionStyle as L } from "@alea-design/motion";
|
|
7
|
+
import { cx as Q } from "../../utils/cx.js";
|
|
8
8
|
import { IconButton as N } from "../button/Button.js";
|
|
9
|
-
import { useStrings as
|
|
10
|
-
import { surfaceAttrs as
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
import { useStrings as U } from "../../i18n/strings.js";
|
|
10
|
+
import { surfaceAttrs as V } from "../surface/Surface.js";
|
|
11
|
+
import { useInitialFocus as W } from "../../utils/initialFocus.js";
|
|
12
|
+
const b = (l, e) => typeof l == "function" ? l({ close: e }) : l, ra = $(function({ children: e, trigger: r, title: d, "aria-label": g, header: m, footer: s, size: y = "md", titleSize: M = "md", placement: z = "center", scrollBehavior: t = "inside", padding: j = "normal", backdrop: w = "dim", showClose: c = !0, fullscreenBelow: n, motion: D, initialFocus: F, className: I, isDismissable: P = !0, isOpen: f, defaultOpen: u, onOpenChange: x, style: R, surface: S, radius: k, ...A }, H) {
|
|
13
|
+
const p = U(), T = W(F), h = /* @__PURE__ */ a(q, { ...A, ...r ? {} : { isOpen: f, defaultOpen: u, onOpenChange: x }, isDismissable: P, className: "alea-modal-overlay alea-xmodal-overlay", "data-placement": z, "data-scroll": t, "data-backdrop": w, "data-fullscreen-below": n, children: /* @__PURE__ */ a(E, { ref: T, className: "alea-modal alea-xmodal", ...V({ surface: S, radius: k }), "data-size": y, "data-scroll": t, "data-fullscreen-below": n, style: L(void 0, D), children: /* @__PURE__ */ a(G, { ref: H, "aria-modal": "true", "aria-label": d ? void 0 : g, className: Q("alea-xmodal-dialog", I), style: R, "data-padding": j, children: ({ close: o }) => /* @__PURE__ */ i(X, { children: [
|
|
13
14
|
m || d ? /* @__PURE__ */ i("div", { className: "alea-xmodal-head", children: [
|
|
14
|
-
m ?? /* @__PURE__ */ a(
|
|
15
|
+
m ?? /* @__PURE__ */ a(J, { slot: "title", className: "alea-dialog-title", "data-size": M === "sm" ? "sm" : void 0, children: d }),
|
|
15
16
|
c && /* @__PURE__ */ a(N, { "aria-label": p.close, size: "sm", variant: "ghost", onPress: o, className: "alea-dialog-x", children: /* @__PURE__ */ a(v, {}) })
|
|
16
17
|
] }) : c && /* @__PURE__ */ a(N, { "aria-label": p.close, size: "sm", variant: "ghost", onPress: o, className: "alea-xmodal-x", children: /* @__PURE__ */ a(v, {}) }),
|
|
17
18
|
/* @__PURE__ */ a("div", { className: "alea-xmodal-body", children: b(e, o) }),
|
|
18
|
-
|
|
19
|
+
s && /* @__PURE__ */ a("div", { className: "alea-xmodal-footer", children: b(s, o) })
|
|
19
20
|
] }) }) }) });
|
|
20
|
-
return r ? /* @__PURE__ */ i(
|
|
21
|
+
return r ? /* @__PURE__ */ i(K, { isOpen: f, defaultOpen: u, onOpenChange: x, children: [
|
|
21
22
|
r,
|
|
22
|
-
|
|
23
|
-
] }) :
|
|
23
|
+
h
|
|
24
|
+
] }) : h;
|
|
24
25
|
});
|
|
25
26
|
export {
|
|
26
|
-
|
|
27
|
+
ra as Modal
|
|
27
28
|
};
|
|
@@ -2,6 +2,7 @@ import { type ReactNode, type CSSProperties } from 'react';
|
|
|
2
2
|
import { DialogTrigger, type PopoverProps as RACPopoverProps, type TooltipProps as RACTooltipProps, type TooltipTriggerComponentProps, type DialogProps as RACDialogProps, type ModalOverlayProps } from 'react-aria-components';
|
|
3
3
|
import { type MotionProp } from '@alea-design/motion';
|
|
4
4
|
import { type SurfaceProps } from '../surface/Surface.js';
|
|
5
|
+
import { type InitialFocus } from '../../utils/initialFocus.js';
|
|
5
6
|
export { DialogTrigger };
|
|
6
7
|
export interface PopoverProps extends Omit<RACPopoverProps, 'children'>, SurfaceProps {
|
|
7
8
|
children: ReactNode;
|
|
@@ -68,9 +69,13 @@ export interface DialogModalProps extends Omit<ModalOverlayProps, 'children'>, S
|
|
|
68
69
|
fullscreenBelow?: 'sm' | 'md';
|
|
69
70
|
/** How the dialog enters and leaves (default rise): a preset, false, or options. */
|
|
70
71
|
motion?: MotionProp;
|
|
72
|
+
/** What is behind it: blur (dim and blur, default) or dim (only the dark layer, no backdrop-filter: cheaper on big pages and phones). */
|
|
73
|
+
backdrop?: 'blur' | 'dim';
|
|
74
|
+
/** Where focus goes when it opens: dialog (default, the dialog itself), first-field (the first input, picker or date field) or a CSS selector for the control inside it. */
|
|
75
|
+
initialFocus?: InitialFocus;
|
|
71
76
|
}
|
|
72
77
|
/** The modal layer: dims the page, traps focus, closes on Escape (and outside click when isDismissable). Four sizes, full screen on phones when you want. */
|
|
73
|
-
export declare function DialogModal({ children, size, fullscreenBelow, className, isDismissable, motion, surface, radius, ...props }: DialogModalProps): import("react").JSX.Element;
|
|
78
|
+
export declare function DialogModal({ children, size, fullscreenBelow, className, isDismissable, motion, backdrop, initialFocus, surface, radius, ...props }: DialogModalProps): import("react").JSX.Element;
|
|
74
79
|
export interface AlertDialogProps {
|
|
75
80
|
/** The question, e.g. "Delete this file?". */
|
|
76
81
|
title: ReactNode;
|
|
@@ -91,6 +96,10 @@ export interface AlertDialogProps {
|
|
|
91
96
|
onOpenChange?: (open: boolean) => void;
|
|
92
97
|
/** How the dialog enters and leaves (default rise). */
|
|
93
98
|
motion?: MotionProp;
|
|
99
|
+
/** What is behind it: blur (default) or dim (no backdrop-filter). */
|
|
100
|
+
backdrop?: 'blur' | 'dim';
|
|
101
|
+
/** Which control has focus when it opens: confirm (default), cancel (the safe choice for a destructive action) or content (the dialog itself, so a screen reader reads the title and text first; use it when the dialog has a required field). */
|
|
102
|
+
initialFocus?: 'confirm' | 'cancel' | 'content';
|
|
94
103
|
/** Extra class names for the dialog. */
|
|
95
104
|
className?: string;
|
|
96
105
|
/** Inline style for the dialog. */
|
|
@@ -1,76 +1,78 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as a, jsxs as
|
|
3
|
-
import { forwardRef as g } from "react";
|
|
4
|
-
import { Dialog as
|
|
5
|
-
import { DialogTrigger as
|
|
6
|
-
import { X as
|
|
7
|
-
import { withMotionStyle as
|
|
8
|
-
import { cx as
|
|
9
|
-
import { Button as
|
|
2
|
+
import { jsx as a, jsxs as m, Fragment as h } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as g, useId as j } from "react";
|
|
4
|
+
import { Dialog as T, Heading as b, ModalOverlay as L, Modal as O, Popover as R, OverlayArrow as x, Button as S, Tooltip as H, TooltipTrigger as V } from "react-aria-components";
|
|
5
|
+
import { DialogTrigger as da } from "react-aria-components";
|
|
6
|
+
import { X as B } from "lucide-react";
|
|
7
|
+
import { withMotionStyle as f } from "@alea-design/motion";
|
|
8
|
+
import { cx as M, withBase as v } from "../../utils/cx.js";
|
|
9
|
+
import { Button as P, IconButton as X } from "../button/Button.js";
|
|
10
10
|
import { useStrings as N } from "../../i18n/strings.js";
|
|
11
|
-
import { renamedValue as
|
|
12
|
-
import { surfaceAttrs as
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
import { renamedValue as q } from "../../utils/vocabulary.js";
|
|
12
|
+
import { surfaceAttrs as z } from "../surface/Surface.js";
|
|
13
|
+
import { useInitialFocus as E } from "../../utils/initialFocus.js";
|
|
14
|
+
const la = g(function({ children: e, showArrow: o, className: l, offset: i = 8, motion: r, style: s, size: n, surface: c, radius: d, ...t }, u) {
|
|
15
|
+
return /* @__PURE__ */ m(R, { ...t, ref: u, offset: o ? 12 : i, "data-size": n, ...z({ surface: c, radius: d }), className: v("alea-popover", l), style: f(s, r), children: [
|
|
15
16
|
o && /* @__PURE__ */ a(x, { className: "alea-arrow", children: /* @__PURE__ */ a("svg", { width: 12, height: 12, viewBox: "0 0 12 12", children: /* @__PURE__ */ a("path", { d: "M0 0 L6 6 L12 0" }) }) }),
|
|
16
17
|
e
|
|
17
18
|
] });
|
|
18
|
-
}),
|
|
19
|
-
const
|
|
20
|
-
return /* @__PURE__ */ a(
|
|
21
|
-
(e ||
|
|
22
|
-
e && /* @__PURE__ */ a(
|
|
23
|
-
|
|
19
|
+
}), ra = g(function({ title: e, description: o, footer: l, showClose: i, children: r, className: s, ...n }, c) {
|
|
20
|
+
const d = N();
|
|
21
|
+
return /* @__PURE__ */ a(T, { ...n, ref: c, className: M("alea-popover-dialog", s), children: (t) => /* @__PURE__ */ m(h, { children: [
|
|
22
|
+
(e || i) && /* @__PURE__ */ m("div", { className: "alea-popover-head", children: [
|
|
23
|
+
e && /* @__PURE__ */ a(b, { slot: "title", className: "alea-popover-title", children: e }),
|
|
24
|
+
i && /* @__PURE__ */ a(S, { className: "alea-popover-close alea-focus-ring", "aria-label": d.close, onPress: t.close, children: /* @__PURE__ */ a(B, { size: 16, "aria-hidden": "true" }) })
|
|
24
25
|
] }),
|
|
25
26
|
o && /* @__PURE__ */ a("p", { className: "alea-popover-desc", children: o }),
|
|
26
|
-
typeof
|
|
27
|
-
l && /* @__PURE__ */ a("div", { className: "alea-popover-footer", children: typeof l == "function" ? l(
|
|
27
|
+
typeof r == "function" ? r(t) : r,
|
|
28
|
+
l && /* @__PURE__ */ a("div", { className: "alea-popover-footer", children: typeof l == "function" ? l(t.close) : l })
|
|
28
29
|
] }) });
|
|
29
30
|
});
|
|
30
|
-
function
|
|
31
|
-
return /* @__PURE__ */
|
|
31
|
+
function ia({ children: p, title: e, shortcut: o, hideArrow: l, className: i, offset: r = 8, motion: s, style: n, ...c }) {
|
|
32
|
+
return /* @__PURE__ */ m(H, { ...c, offset: r, className: v("alea-tooltip", i), "data-rich": e ? !0 : void 0, style: f(n, s), children: [
|
|
32
33
|
!l && /* @__PURE__ */ a(x, { className: "alea-arrow alea-tooltip-arrow", children: /* @__PURE__ */ a("svg", { width: 8, height: 8, viewBox: "0 0 8 8", children: /* @__PURE__ */ a("path", { d: "M0 0 L4 4 L8 0" }) }) }),
|
|
33
34
|
e && /* @__PURE__ */ a("span", { className: "alea-tooltip-title", children: e }),
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
|
|
35
|
+
/* @__PURE__ */ m("span", { className: "alea-tooltip-text", children: [
|
|
36
|
+
p,
|
|
36
37
|
o && /* @__PURE__ */ a("kbd", { className: "alea-tooltip-kbd", children: o })
|
|
37
38
|
] })
|
|
38
39
|
] });
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
return /* @__PURE__ */ a(
|
|
41
|
+
function ta({ delay: p = 600, closeDelay: e = 200, ...o }) {
|
|
42
|
+
return /* @__PURE__ */ a(V, { ...o, delay: p, closeDelay: e });
|
|
42
43
|
}
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
return /* @__PURE__ */ a(
|
|
46
|
-
(e || !
|
|
47
|
-
e && /* @__PURE__ */ a(
|
|
48
|
-
!
|
|
44
|
+
const G = g(function({ title: e, description: o, children: l, footer: i, hideClose: r, className: s, ...n }, c) {
|
|
45
|
+
const d = N();
|
|
46
|
+
return /* @__PURE__ */ a(T, { ...n, ref: c, className: M("alea-dialog", s), children: ({ close: t }) => /* @__PURE__ */ m(h, { children: [
|
|
47
|
+
(e || !r) && /* @__PURE__ */ m("div", { className: "alea-dialog-head", children: [
|
|
48
|
+
e && /* @__PURE__ */ a(b, { slot: "title", className: "alea-dialog-title", children: e }),
|
|
49
|
+
!r && /* @__PURE__ */ a(X, { "aria-label": d.close, size: "sm", variant: "ghost", onPress: t, className: "alea-dialog-x", children: /* @__PURE__ */ a(B, {}) })
|
|
49
50
|
] }),
|
|
50
51
|
o && /* @__PURE__ */ a("p", { className: "alea-dialog-description", children: o }),
|
|
51
|
-
l && /* @__PURE__ */ a("div", { className: "alea-dialog-body", children: typeof l == "function" ? l({ close:
|
|
52
|
-
|
|
52
|
+
l && /* @__PURE__ */ a("div", { className: "alea-dialog-body", children: typeof l == "function" ? l({ close: t }) : l }),
|
|
53
|
+
i && /* @__PURE__ */ a("div", { className: "alea-dialog-footer", children: typeof i == "function" ? i({ close: t }) : i })
|
|
53
54
|
] }) });
|
|
54
55
|
});
|
|
55
|
-
function
|
|
56
|
-
|
|
56
|
+
function J({ children: p, size: e = "md", fullscreenBelow: o, className: l, isDismissable: i = !0, motion: r, backdrop: s, initialFocus: n, surface: c, radius: d, ...t }) {
|
|
57
|
+
const u = E(n);
|
|
58
|
+
return /* @__PURE__ */ a(L, { ...t, isDismissable: i, className: v("alea-modal-overlay", l), "data-backdrop": s, "data-fullscreen-below": o, children: /* @__PURE__ */ a(O, { ref: u, className: "alea-modal", "data-size": e, "data-fullscreen-below": o, ...z({ surface: c, radius: d }), style: f(void 0, r), children: p }) });
|
|
57
59
|
}
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
/* @__PURE__ */ a(
|
|
62
|
-
/* @__PURE__ */ a(
|
|
63
|
-
await (
|
|
64
|
-
}, children:
|
|
65
|
-
] }), children:
|
|
60
|
+
const sa = g(function({ motion: e, backdrop: o, initialFocus: l = "confirm", title: i, children: r, confirmLabel: s, cancelLabel: n, tone: c, onConfirm: d, isOpen: t, defaultOpen: u, onOpenChange: $, className: A, style: I }, k) {
|
|
61
|
+
const y = j(), F = q("AlertDialog", "tone", c, { default: "neutral" }) ?? "neutral", D = N();
|
|
62
|
+
return s ?? (s = D.confirm), n ?? (n = D.cancel), /* @__PURE__ */ a(J, { isOpen: t, defaultOpen: u, onOpenChange: $, isDismissable: !1, size: "sm", motion: e, backdrop: o, children: /* @__PURE__ */ a(G, { ref: k, className: A, style: I, role: "alertdialog", "aria-describedby": r ? y : void 0, title: i, hideClose: !0, footer: ({ close: w }) => /* @__PURE__ */ m(h, { children: [
|
|
63
|
+
/* @__PURE__ */ a(P, { variant: "ghost", autoFocus: l === "cancel", onPress: w, children: n }),
|
|
64
|
+
/* @__PURE__ */ a(P, { variant: F === "danger" ? "danger" : "primary", autoFocus: l === "confirm", onPress: async () => {
|
|
65
|
+
await (d == null ? void 0 : d()), w();
|
|
66
|
+
}, children: s })
|
|
67
|
+
] }), children: r ? /* @__PURE__ */ a("div", { id: y, style: { display: "contents" }, children: r }) : null }) });
|
|
66
68
|
});
|
|
67
69
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
sa as AlertDialog,
|
|
71
|
+
G as Dialog,
|
|
72
|
+
J as DialogModal,
|
|
73
|
+
da as DialogTrigger,
|
|
74
|
+
la as Popover,
|
|
75
|
+
ra as PopoverDialog,
|
|
76
|
+
ia as Tooltip,
|
|
77
|
+
ta as TooltipTrigger
|
|
76
78
|
};
|