@konstructio/ui 0.0.12-alpha.2 → 0.0.12-alpha.3
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/{Modal-DZUwNzSW.js → Modal-ByNiP7eb.js} +3 -3
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/Command/Command.js +32 -0
- package/dist/components/Command/Command.variants.js +97 -0
- package/dist/components/Command/components/Command.js +8 -0
- package/dist/components/Command/components/CommandEmpty.js +15 -0
- package/dist/components/Command/components/CommandGroup.js +19 -0
- package/dist/components/Command/components/CommandInput.js +84 -0
- package/dist/components/Command/components/CommandItem.js +29 -0
- package/dist/components/Command/components/CommandList.js +16 -0
- package/dist/components/Command/components/CommandSeparator.js +16 -0
- package/dist/components/Command/components/CommandShortcut.js +19 -0
- package/dist/components/Command/components/DialogContent.js +31 -0
- package/dist/components/Command/components/DialogOverlay.js +19 -0
- package/dist/components/Command/components/index.js +20 -0
- package/dist/components/Command/contexts/Command.context.js +13 -0
- package/dist/components/Command/contexts/Command.provider.js +24 -0
- package/dist/components/Command/contexts/index.js +6 -0
- package/dist/components/Loading/Loading.js +102 -21
- package/dist/components/Loading/Loading.variants.js +13 -14
- package/dist/components/Modal/Modal.js +2 -2
- package/dist/components/Modal/components/Wrapper/Wrapper.js +2 -2
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/NumberInput/NumberInput.js +1 -1
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Switch/Switch.js +1 -1
- package/dist/components/Tag/Tag.js +17 -5
- package/dist/components/Tag/Tag.variants.js +11 -1
- package/dist/components/TagSelect/TagSelect.js +6 -71
- package/dist/components/TagSelect/TagSelect.variants.js +29 -50
- package/dist/components/TagSelect/components/Item/Item.js +23 -0
- package/dist/components/TagSelect/components/Item/Item.variants.js +31 -0
- package/dist/components/TagSelect/components/List/List.js +13 -0
- package/dist/components/TagSelect/components/List/List.variants.js +37 -0
- package/dist/components/TagSelect/components/Wrapper/Wrapper.js +88 -0
- package/dist/components/TagSelect/components/index.js +8 -0
- package/dist/components/TagSelect/contexts/TagSelect.context.js +19 -0
- package/dist/components/TagSelect/contexts/TagSelect.hook.js +11 -0
- package/dist/components/TagSelect/contexts/TagSelect.provider.js +69 -0
- package/dist/components/TagSelect/contexts/index.js +6 -0
- package/dist/components/TagSelect/hooks/useTagSelect.js +22 -27
- package/dist/components/Toast/Toast.js +3 -3
- package/dist/components/Typography/Typography.js +23 -22
- package/dist/components/Typography/Typography.variants.js +49 -22
- package/dist/components/index.js +1 -1
- package/dist/{index-C6WtlN_F.js → index-BzaHYXkt.js} +1 -1
- package/dist/{index-Z1voPZOH.js → index-CbTU3cnP.js} +1 -1
- package/dist/index-CzSBQN5S.js +432 -0
- package/dist/index-D7QNmo_D.js +422 -0
- package/dist/index-DUA6Y_AE.js +126 -0
- package/dist/{index-B33at13_.js → index-D_76wh4w.js} +1 -1
- package/dist/index-DyKo5ZJT.js +446 -0
- package/dist/index.d.ts +15 -5
- package/dist/index.js +1 -1
- package/dist/package.json +17 -13
- package/dist/styles.css +1 -1
- package/package.json +16 -13
- package/dist/index-3jTPaVvh.js +0 -551
- package/dist/index-BTeAm7mx.js +0 -19133
package/dist/index-3jTPaVvh.js
DELETED
|
@@ -1,551 +0,0 @@
|
|
|
1
|
-
import { jsx as c, jsxs as U, Fragment as j } from "react/jsx-runtime";
|
|
2
|
-
import * as i from "react";
|
|
3
|
-
import { u as xe, d as Y, c as ee, e as Le, a as ke, b as R } from "./index-Cva-e5M4.js";
|
|
4
|
-
import { u as O, S as We, a as $e } from "./index-B_6_jmOO.js";
|
|
5
|
-
import { P as Ue, D as Ge } from "./index-B33at13_.js";
|
|
6
|
-
import { P } from "./index-BTeAm7mx.js";
|
|
7
|
-
import { P as G } from "./index-Dj1pom3_.js";
|
|
8
|
-
import { R as Ke } from "./Combination-b348x__d.js";
|
|
9
|
-
import { Button as Be } from "./components/Button/Button.js";
|
|
10
|
-
import { useTheme as He } from "./contexts/theme.hook.js";
|
|
11
|
-
var qe = i.useId || (() => {
|
|
12
|
-
}), Ve = 0;
|
|
13
|
-
function x(e) {
|
|
14
|
-
const [o, t] = i.useState(qe());
|
|
15
|
-
return xe(() => {
|
|
16
|
-
t((r) => r ?? String(Ve++));
|
|
17
|
-
}, [e]), e || (o ? `radix-${o}` : "");
|
|
18
|
-
}
|
|
19
|
-
var L = "focusScope.autoFocusOnMount", k = "focusScope.autoFocusOnUnmount", Z = { bubbles: !1, cancelable: !0 }, je = "FocusScope", te = i.forwardRef((e, o) => {
|
|
20
|
-
const {
|
|
21
|
-
loop: t = !1,
|
|
22
|
-
trapped: r = !1,
|
|
23
|
-
onMountAutoFocus: n,
|
|
24
|
-
onUnmountAutoFocus: a,
|
|
25
|
-
...l
|
|
26
|
-
} = e, [s, g] = i.useState(null), f = Y(n), D = Y(a), u = i.useRef(null), p = O(o, (d) => g(d)), v = i.useRef({
|
|
27
|
-
paused: !1,
|
|
28
|
-
pause() {
|
|
29
|
-
this.paused = !0;
|
|
30
|
-
},
|
|
31
|
-
resume() {
|
|
32
|
-
this.paused = !1;
|
|
33
|
-
}
|
|
34
|
-
}).current;
|
|
35
|
-
i.useEffect(() => {
|
|
36
|
-
if (r) {
|
|
37
|
-
let d = function(h) {
|
|
38
|
-
if (v.paused || !s) return;
|
|
39
|
-
const E = h.target;
|
|
40
|
-
s.contains(E) ? u.current = E : b(u.current, { select: !0 });
|
|
41
|
-
}, C = function(h) {
|
|
42
|
-
if (v.paused || !s) return;
|
|
43
|
-
const E = h.relatedTarget;
|
|
44
|
-
E !== null && (s.contains(E) || b(u.current, { select: !0 }));
|
|
45
|
-
}, m = function(h) {
|
|
46
|
-
if (document.activeElement === document.body)
|
|
47
|
-
for (const V of h)
|
|
48
|
-
V.removedNodes.length > 0 && b(s);
|
|
49
|
-
};
|
|
50
|
-
document.addEventListener("focusin", d), document.addEventListener("focusout", C);
|
|
51
|
-
const S = new MutationObserver(m);
|
|
52
|
-
return s && S.observe(s, { childList: !0, subtree: !0 }), () => {
|
|
53
|
-
document.removeEventListener("focusin", d), document.removeEventListener("focusout", C), S.disconnect();
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}, [r, s, v.paused]), i.useEffect(() => {
|
|
57
|
-
if (s) {
|
|
58
|
-
J.add(v);
|
|
59
|
-
const d = document.activeElement;
|
|
60
|
-
if (!s.contains(d)) {
|
|
61
|
-
const m = new CustomEvent(L, Z);
|
|
62
|
-
s.addEventListener(L, f), s.dispatchEvent(m), m.defaultPrevented || (Ye(Xe(oe(s)), { select: !0 }), document.activeElement === d && b(s));
|
|
63
|
-
}
|
|
64
|
-
return () => {
|
|
65
|
-
s.removeEventListener(L, f), setTimeout(() => {
|
|
66
|
-
const m = new CustomEvent(k, Z);
|
|
67
|
-
s.addEventListener(k, D), s.dispatchEvent(m), m.defaultPrevented || b(d ?? document.body, { select: !0 }), s.removeEventListener(k, D), J.remove(v);
|
|
68
|
-
}, 0);
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}, [s, f, D, v]);
|
|
72
|
-
const I = i.useCallback(
|
|
73
|
-
(d) => {
|
|
74
|
-
if (!t && !r || v.paused) return;
|
|
75
|
-
const C = d.key === "Tab" && !d.altKey && !d.ctrlKey && !d.metaKey, m = document.activeElement;
|
|
76
|
-
if (C && m) {
|
|
77
|
-
const S = d.currentTarget, [h, E] = Ze(S);
|
|
78
|
-
h && E ? !d.shiftKey && m === E ? (d.preventDefault(), t && b(h, { select: !0 })) : d.shiftKey && m === h && (d.preventDefault(), t && b(E, { select: !0 })) : m === S && d.preventDefault();
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
[t, r, v.paused]
|
|
82
|
-
);
|
|
83
|
-
return /* @__PURE__ */ c(P.div, { tabIndex: -1, ...l, ref: p, onKeyDown: I });
|
|
84
|
-
});
|
|
85
|
-
te.displayName = je;
|
|
86
|
-
function Ye(e, { select: o = !1 } = {}) {
|
|
87
|
-
const t = document.activeElement;
|
|
88
|
-
for (const r of e)
|
|
89
|
-
if (b(r, { select: o }), document.activeElement !== t) return;
|
|
90
|
-
}
|
|
91
|
-
function Ze(e) {
|
|
92
|
-
const o = oe(e), t = z(o, e), r = z(o.reverse(), e);
|
|
93
|
-
return [t, r];
|
|
94
|
-
}
|
|
95
|
-
function oe(e) {
|
|
96
|
-
const o = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
97
|
-
acceptNode: (r) => {
|
|
98
|
-
const n = r.tagName === "INPUT" && r.type === "hidden";
|
|
99
|
-
return r.disabled || r.hidden || n ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
for (; t.nextNode(); ) o.push(t.currentNode);
|
|
103
|
-
return o;
|
|
104
|
-
}
|
|
105
|
-
function z(e, o) {
|
|
106
|
-
for (const t of e)
|
|
107
|
-
if (!ze(t, { upTo: o })) return t;
|
|
108
|
-
}
|
|
109
|
-
function ze(e, { upTo: o }) {
|
|
110
|
-
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
111
|
-
for (; e; ) {
|
|
112
|
-
if (o !== void 0 && e === o) return !1;
|
|
113
|
-
if (getComputedStyle(e).display === "none") return !0;
|
|
114
|
-
e = e.parentElement;
|
|
115
|
-
}
|
|
116
|
-
return !1;
|
|
117
|
-
}
|
|
118
|
-
function Je(e) {
|
|
119
|
-
return e instanceof HTMLInputElement && "select" in e;
|
|
120
|
-
}
|
|
121
|
-
function b(e, { select: o = !1 } = {}) {
|
|
122
|
-
if (e && e.focus) {
|
|
123
|
-
const t = document.activeElement;
|
|
124
|
-
e.focus({ preventScroll: !0 }), e !== t && Je(e) && o && e.select();
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
var J = Qe();
|
|
128
|
-
function Qe() {
|
|
129
|
-
let e = [];
|
|
130
|
-
return {
|
|
131
|
-
add(o) {
|
|
132
|
-
const t = e[0];
|
|
133
|
-
o !== t && (t == null || t.pause()), e = Q(e, o), e.unshift(o);
|
|
134
|
-
},
|
|
135
|
-
remove(o) {
|
|
136
|
-
var t;
|
|
137
|
-
e = Q(e, o), (t = e[0]) == null || t.resume();
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function Q(e, o) {
|
|
142
|
-
const t = [...e], r = t.indexOf(o);
|
|
143
|
-
return r !== -1 && t.splice(r, 1), t;
|
|
144
|
-
}
|
|
145
|
-
function Xe(e) {
|
|
146
|
-
return e.filter((o) => o.tagName !== "A");
|
|
147
|
-
}
|
|
148
|
-
var W = 0;
|
|
149
|
-
function et() {
|
|
150
|
-
i.useEffect(() => {
|
|
151
|
-
const e = document.querySelectorAll("[data-radix-focus-guard]");
|
|
152
|
-
return document.body.insertAdjacentElement("afterbegin", e[0] ?? X()), document.body.insertAdjacentElement("beforeend", e[1] ?? X()), W++, () => {
|
|
153
|
-
W === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((o) => o.remove()), W--;
|
|
154
|
-
};
|
|
155
|
-
}, []);
|
|
156
|
-
}
|
|
157
|
-
function X() {
|
|
158
|
-
const e = document.createElement("span");
|
|
159
|
-
return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
|
|
160
|
-
}
|
|
161
|
-
var tt = function(e) {
|
|
162
|
-
if (typeof document > "u")
|
|
163
|
-
return null;
|
|
164
|
-
var o = Array.isArray(e) ? e[0] : e;
|
|
165
|
-
return o.ownerDocument.body;
|
|
166
|
-
}, _ = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), w = {}, $ = 0, re = function(e) {
|
|
167
|
-
return e && (e.host || re(e.parentNode));
|
|
168
|
-
}, ot = function(e, o) {
|
|
169
|
-
return o.map(function(t) {
|
|
170
|
-
if (e.contains(t))
|
|
171
|
-
return t;
|
|
172
|
-
var r = re(t);
|
|
173
|
-
return r && e.contains(r) ? r : (console.error("aria-hidden", t, "in not contained inside", e, ". Doing nothing"), null);
|
|
174
|
-
}).filter(function(t) {
|
|
175
|
-
return !!t;
|
|
176
|
-
});
|
|
177
|
-
}, rt = function(e, o, t, r) {
|
|
178
|
-
var n = ot(o, Array.isArray(e) ? e : [e]);
|
|
179
|
-
w[t] || (w[t] = /* @__PURE__ */ new WeakMap());
|
|
180
|
-
var a = w[t], l = [], s = /* @__PURE__ */ new Set(), g = new Set(n), f = function(u) {
|
|
181
|
-
!u || s.has(u) || (s.add(u), f(u.parentNode));
|
|
182
|
-
};
|
|
183
|
-
n.forEach(f);
|
|
184
|
-
var D = function(u) {
|
|
185
|
-
!u || g.has(u) || Array.prototype.forEach.call(u.children, function(p) {
|
|
186
|
-
if (s.has(p))
|
|
187
|
-
D(p);
|
|
188
|
-
else
|
|
189
|
-
try {
|
|
190
|
-
var v = p.getAttribute(r), I = v !== null && v !== "false", d = (_.get(p) || 0) + 1, C = (a.get(p) || 0) + 1;
|
|
191
|
-
_.set(p, d), a.set(p, C), l.push(p), d === 1 && I && M.set(p, !0), C === 1 && p.setAttribute(t, "true"), I || p.setAttribute(r, "true");
|
|
192
|
-
} catch (m) {
|
|
193
|
-
console.error("aria-hidden: cannot operate on ", p, m);
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
return D(o), s.clear(), $++, function() {
|
|
198
|
-
l.forEach(function(u) {
|
|
199
|
-
var p = _.get(u) - 1, v = a.get(u) - 1;
|
|
200
|
-
_.set(u, p), a.set(u, v), p || (M.has(u) || u.removeAttribute(r), M.delete(u)), v || u.removeAttribute(t);
|
|
201
|
-
}), $--, $ || (_ = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), w = {});
|
|
202
|
-
};
|
|
203
|
-
}, nt = function(e, o, t) {
|
|
204
|
-
t === void 0 && (t = "data-aria-hidden");
|
|
205
|
-
var r = Array.from(Array.isArray(e) ? e : [e]), n = tt(e);
|
|
206
|
-
return n ? (r.push.apply(r, Array.from(n.querySelectorAll("[aria-live]"))), rt(r, n, t, "aria-hidden")) : function() {
|
|
207
|
-
return null;
|
|
208
|
-
};
|
|
209
|
-
}, K = "Dialog", [ne, ae] = ee(K), [at, A] = ne(K), se = (e) => {
|
|
210
|
-
const {
|
|
211
|
-
__scopeDialog: o,
|
|
212
|
-
children: t,
|
|
213
|
-
open: r,
|
|
214
|
-
defaultOpen: n,
|
|
215
|
-
onOpenChange: a,
|
|
216
|
-
modal: l = !0
|
|
217
|
-
} = e, s = i.useRef(null), g = i.useRef(null), [f = !1, D] = ke({
|
|
218
|
-
prop: r,
|
|
219
|
-
defaultProp: n,
|
|
220
|
-
onChange: a
|
|
221
|
-
});
|
|
222
|
-
return /* @__PURE__ */ c(
|
|
223
|
-
at,
|
|
224
|
-
{
|
|
225
|
-
scope: o,
|
|
226
|
-
triggerRef: s,
|
|
227
|
-
contentRef: g,
|
|
228
|
-
contentId: x(),
|
|
229
|
-
titleId: x(),
|
|
230
|
-
descriptionId: x(),
|
|
231
|
-
open: f,
|
|
232
|
-
onOpenChange: D,
|
|
233
|
-
onOpenToggle: i.useCallback(() => D((u) => !u), [D]),
|
|
234
|
-
modal: l,
|
|
235
|
-
children: t
|
|
236
|
-
}
|
|
237
|
-
);
|
|
238
|
-
};
|
|
239
|
-
se.displayName = K;
|
|
240
|
-
var ie = "DialogTrigger", ce = i.forwardRef(
|
|
241
|
-
(e, o) => {
|
|
242
|
-
const { __scopeDialog: t, ...r } = e, n = A(ie, t), a = O(o, n.triggerRef);
|
|
243
|
-
return /* @__PURE__ */ c(
|
|
244
|
-
P.button,
|
|
245
|
-
{
|
|
246
|
-
type: "button",
|
|
247
|
-
"aria-haspopup": "dialog",
|
|
248
|
-
"aria-expanded": n.open,
|
|
249
|
-
"aria-controls": n.contentId,
|
|
250
|
-
"data-state": q(n.open),
|
|
251
|
-
...r,
|
|
252
|
-
ref: a,
|
|
253
|
-
onClick: R(e.onClick, n.onOpenToggle)
|
|
254
|
-
}
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
);
|
|
258
|
-
ce.displayName = ie;
|
|
259
|
-
var B = "DialogPortal", [st, le] = ne(B, {
|
|
260
|
-
forceMount: void 0
|
|
261
|
-
}), ue = (e) => {
|
|
262
|
-
const { __scopeDialog: o, forceMount: t, children: r, container: n } = e, a = A(B, o);
|
|
263
|
-
return /* @__PURE__ */ c(st, { scope: o, forceMount: t, children: i.Children.map(r, (l) => /* @__PURE__ */ c(G, { present: t || a.open, children: /* @__PURE__ */ c(Ue, { asChild: !0, container: n, children: l }) })) });
|
|
264
|
-
};
|
|
265
|
-
ue.displayName = B;
|
|
266
|
-
var F = "DialogOverlay", de = i.forwardRef(
|
|
267
|
-
(e, o) => {
|
|
268
|
-
const t = le(F, e.__scopeDialog), { forceMount: r = t.forceMount, ...n } = e, a = A(F, e.__scopeDialog);
|
|
269
|
-
return a.modal ? /* @__PURE__ */ c(G, { present: r || a.open, children: /* @__PURE__ */ c(it, { ...n, ref: o }) }) : null;
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
de.displayName = F;
|
|
273
|
-
var it = i.forwardRef(
|
|
274
|
-
(e, o) => {
|
|
275
|
-
const { __scopeDialog: t, ...r } = e, n = A(F, t);
|
|
276
|
-
return (
|
|
277
|
-
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
278
|
-
// ie. when `Overlay` and `Content` are siblings
|
|
279
|
-
/* @__PURE__ */ c(Ke, { as: We, allowPinchZoom: !0, shards: [n.contentRef], children: /* @__PURE__ */ c(
|
|
280
|
-
P.div,
|
|
281
|
-
{
|
|
282
|
-
"data-state": q(n.open),
|
|
283
|
-
...r,
|
|
284
|
-
ref: o,
|
|
285
|
-
style: { pointerEvents: "auto", ...r.style }
|
|
286
|
-
}
|
|
287
|
-
) })
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
), N = "DialogContent", fe = i.forwardRef(
|
|
291
|
-
(e, o) => {
|
|
292
|
-
const t = le(N, e.__scopeDialog), { forceMount: r = t.forceMount, ...n } = e, a = A(N, e.__scopeDialog);
|
|
293
|
-
return /* @__PURE__ */ c(G, { present: r || a.open, children: a.modal ? /* @__PURE__ */ c(ct, { ...n, ref: o }) : /* @__PURE__ */ c(lt, { ...n, ref: o }) });
|
|
294
|
-
}
|
|
295
|
-
);
|
|
296
|
-
fe.displayName = N;
|
|
297
|
-
var ct = i.forwardRef(
|
|
298
|
-
(e, o) => {
|
|
299
|
-
const t = A(N, e.__scopeDialog), r = i.useRef(null), n = O(o, t.contentRef, r);
|
|
300
|
-
return i.useEffect(() => {
|
|
301
|
-
const a = r.current;
|
|
302
|
-
if (a) return nt(a);
|
|
303
|
-
}, []), /* @__PURE__ */ c(
|
|
304
|
-
pe,
|
|
305
|
-
{
|
|
306
|
-
...e,
|
|
307
|
-
ref: n,
|
|
308
|
-
trapFocus: t.open,
|
|
309
|
-
disableOutsidePointerEvents: !0,
|
|
310
|
-
onCloseAutoFocus: R(e.onCloseAutoFocus, (a) => {
|
|
311
|
-
var l;
|
|
312
|
-
a.preventDefault(), (l = t.triggerRef.current) == null || l.focus();
|
|
313
|
-
}),
|
|
314
|
-
onPointerDownOutside: R(e.onPointerDownOutside, (a) => {
|
|
315
|
-
const l = a.detail.originalEvent, s = l.button === 0 && l.ctrlKey === !0;
|
|
316
|
-
(l.button === 2 || s) && a.preventDefault();
|
|
317
|
-
}),
|
|
318
|
-
onFocusOutside: R(
|
|
319
|
-
e.onFocusOutside,
|
|
320
|
-
(a) => a.preventDefault()
|
|
321
|
-
)
|
|
322
|
-
}
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
), lt = i.forwardRef(
|
|
326
|
-
(e, o) => {
|
|
327
|
-
const t = A(N, e.__scopeDialog), r = i.useRef(!1), n = i.useRef(!1);
|
|
328
|
-
return /* @__PURE__ */ c(
|
|
329
|
-
pe,
|
|
330
|
-
{
|
|
331
|
-
...e,
|
|
332
|
-
ref: o,
|
|
333
|
-
trapFocus: !1,
|
|
334
|
-
disableOutsidePointerEvents: !1,
|
|
335
|
-
onCloseAutoFocus: (a) => {
|
|
336
|
-
var l, s;
|
|
337
|
-
(l = e.onCloseAutoFocus) == null || l.call(e, a), a.defaultPrevented || (r.current || (s = t.triggerRef.current) == null || s.focus(), a.preventDefault()), r.current = !1, n.current = !1;
|
|
338
|
-
},
|
|
339
|
-
onInteractOutside: (a) => {
|
|
340
|
-
var g, f;
|
|
341
|
-
(g = e.onInteractOutside) == null || g.call(e, a), a.defaultPrevented || (r.current = !0, a.detail.originalEvent.type === "pointerdown" && (n.current = !0));
|
|
342
|
-
const l = a.target;
|
|
343
|
-
((f = t.triggerRef.current) == null ? void 0 : f.contains(l)) && a.preventDefault(), a.detail.originalEvent.type === "focusin" && n.current && a.preventDefault();
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
);
|
|
347
|
-
}
|
|
348
|
-
), pe = i.forwardRef(
|
|
349
|
-
(e, o) => {
|
|
350
|
-
const { __scopeDialog: t, trapFocus: r, onOpenAutoFocus: n, onCloseAutoFocus: a, ...l } = e, s = A(N, t), g = i.useRef(null), f = O(o, g);
|
|
351
|
-
return et(), /* @__PURE__ */ U(j, { children: [
|
|
352
|
-
/* @__PURE__ */ c(
|
|
353
|
-
te,
|
|
354
|
-
{
|
|
355
|
-
asChild: !0,
|
|
356
|
-
loop: !0,
|
|
357
|
-
trapped: r,
|
|
358
|
-
onMountAutoFocus: n,
|
|
359
|
-
onUnmountAutoFocus: a,
|
|
360
|
-
children: /* @__PURE__ */ c(
|
|
361
|
-
Ge,
|
|
362
|
-
{
|
|
363
|
-
role: "dialog",
|
|
364
|
-
id: s.contentId,
|
|
365
|
-
"aria-describedby": s.descriptionId,
|
|
366
|
-
"aria-labelledby": s.titleId,
|
|
367
|
-
"data-state": q(s.open),
|
|
368
|
-
...l,
|
|
369
|
-
ref: f,
|
|
370
|
-
onDismiss: () => s.onOpenChange(!1)
|
|
371
|
-
}
|
|
372
|
-
)
|
|
373
|
-
}
|
|
374
|
-
),
|
|
375
|
-
/* @__PURE__ */ U(j, { children: [
|
|
376
|
-
/* @__PURE__ */ c(dt, { titleId: s.titleId }),
|
|
377
|
-
/* @__PURE__ */ c(pt, { contentRef: g, descriptionId: s.descriptionId })
|
|
378
|
-
] })
|
|
379
|
-
] });
|
|
380
|
-
}
|
|
381
|
-
), H = "DialogTitle", ge = i.forwardRef(
|
|
382
|
-
(e, o) => {
|
|
383
|
-
const { __scopeDialog: t, ...r } = e, n = A(H, t);
|
|
384
|
-
return /* @__PURE__ */ c(P.h2, { id: n.titleId, ...r, ref: o });
|
|
385
|
-
}
|
|
386
|
-
);
|
|
387
|
-
ge.displayName = H;
|
|
388
|
-
var ve = "DialogDescription", me = i.forwardRef(
|
|
389
|
-
(e, o) => {
|
|
390
|
-
const { __scopeDialog: t, ...r } = e, n = A(ve, t);
|
|
391
|
-
return /* @__PURE__ */ c(P.p, { id: n.descriptionId, ...r, ref: o });
|
|
392
|
-
}
|
|
393
|
-
);
|
|
394
|
-
me.displayName = ve;
|
|
395
|
-
var De = "DialogClose", Ae = i.forwardRef(
|
|
396
|
-
(e, o) => {
|
|
397
|
-
const { __scopeDialog: t, ...r } = e, n = A(De, t);
|
|
398
|
-
return /* @__PURE__ */ c(
|
|
399
|
-
P.button,
|
|
400
|
-
{
|
|
401
|
-
type: "button",
|
|
402
|
-
...r,
|
|
403
|
-
ref: o,
|
|
404
|
-
onClick: R(e.onClick, () => n.onOpenChange(!1))
|
|
405
|
-
}
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
);
|
|
409
|
-
Ae.displayName = De;
|
|
410
|
-
function q(e) {
|
|
411
|
-
return e ? "open" : "closed";
|
|
412
|
-
}
|
|
413
|
-
var Ee = "DialogTitleWarning", [ut, he] = Le(Ee, {
|
|
414
|
-
contentName: N,
|
|
415
|
-
titleName: H,
|
|
416
|
-
docsSlug: "dialog"
|
|
417
|
-
}), dt = ({ titleId: e }) => {
|
|
418
|
-
const o = he(Ee), t = `\`${o.contentName}\` requires a \`${o.titleName}\` for the component to be accessible for screen reader users.
|
|
419
|
-
|
|
420
|
-
If you want to hide the \`${o.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
421
|
-
|
|
422
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;
|
|
423
|
-
return i.useEffect(() => {
|
|
424
|
-
e && (document.getElementById(e) || console.error(t));
|
|
425
|
-
}, [t, e]), null;
|
|
426
|
-
}, ft = "DialogDescriptionWarning", pt = ({ contentRef: e, descriptionId: o }) => {
|
|
427
|
-
const r = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${he(ft).contentName}}.`;
|
|
428
|
-
return i.useEffect(() => {
|
|
429
|
-
var a;
|
|
430
|
-
const n = (a = e.current) == null ? void 0 : a.getAttribute("aria-describedby");
|
|
431
|
-
o && n && (document.getElementById(o) || console.warn(r));
|
|
432
|
-
}, [r, e, o]), null;
|
|
433
|
-
}, gt = se, vt = ce, mt = ue, Dt = de, At = fe, Et = ge, ht = me, ye = Ae, Ce = "AlertDialog", [yt, $t] = ee(Ce, [
|
|
434
|
-
ae
|
|
435
|
-
]), y = ae(), be = (e) => {
|
|
436
|
-
const { __scopeAlertDialog: o, ...t } = e, r = y(o);
|
|
437
|
-
return /* @__PURE__ */ c(gt, { ...r, ...t, modal: !0 });
|
|
438
|
-
};
|
|
439
|
-
be.displayName = Ce;
|
|
440
|
-
var Ct = "AlertDialogTrigger", Ne = i.forwardRef(
|
|
441
|
-
(e, o) => {
|
|
442
|
-
const { __scopeAlertDialog: t, ...r } = e, n = y(t);
|
|
443
|
-
return /* @__PURE__ */ c(vt, { ...n, ...r, ref: o });
|
|
444
|
-
}
|
|
445
|
-
);
|
|
446
|
-
Ne.displayName = Ct;
|
|
447
|
-
var bt = "AlertDialogPortal", _e = (e) => {
|
|
448
|
-
const { __scopeAlertDialog: o, ...t } = e, r = y(o);
|
|
449
|
-
return /* @__PURE__ */ c(mt, { ...r, ...t });
|
|
450
|
-
};
|
|
451
|
-
_e.displayName = bt;
|
|
452
|
-
var Nt = "AlertDialogOverlay", Re = i.forwardRef(
|
|
453
|
-
(e, o) => {
|
|
454
|
-
const { __scopeAlertDialog: t, ...r } = e, n = y(t);
|
|
455
|
-
return /* @__PURE__ */ c(Dt, { ...n, ...r, ref: o });
|
|
456
|
-
}
|
|
457
|
-
);
|
|
458
|
-
Re.displayName = Nt;
|
|
459
|
-
var T = "AlertDialogContent", [_t, Rt] = yt(T), Te = i.forwardRef(
|
|
460
|
-
(e, o) => {
|
|
461
|
-
const { __scopeAlertDialog: t, children: r, ...n } = e, a = y(t), l = i.useRef(null), s = O(o, l), g = i.useRef(null);
|
|
462
|
-
return /* @__PURE__ */ c(
|
|
463
|
-
ut,
|
|
464
|
-
{
|
|
465
|
-
contentName: T,
|
|
466
|
-
titleName: Oe,
|
|
467
|
-
docsSlug: "alert-dialog",
|
|
468
|
-
children: /* @__PURE__ */ c(_t, { scope: t, cancelRef: g, children: /* @__PURE__ */ U(
|
|
469
|
-
At,
|
|
470
|
-
{
|
|
471
|
-
role: "alertdialog",
|
|
472
|
-
...a,
|
|
473
|
-
...n,
|
|
474
|
-
ref: s,
|
|
475
|
-
onOpenAutoFocus: R(n.onOpenAutoFocus, (f) => {
|
|
476
|
-
var D;
|
|
477
|
-
f.preventDefault(), (D = g.current) == null || D.focus({ preventScroll: !0 });
|
|
478
|
-
}),
|
|
479
|
-
onPointerDownOutside: (f) => f.preventDefault(),
|
|
480
|
-
onInteractOutside: (f) => f.preventDefault(),
|
|
481
|
-
children: [
|
|
482
|
-
/* @__PURE__ */ c($e, { children: r }),
|
|
483
|
-
/* @__PURE__ */ c(Ot, { contentRef: l })
|
|
484
|
-
]
|
|
485
|
-
}
|
|
486
|
-
) })
|
|
487
|
-
}
|
|
488
|
-
);
|
|
489
|
-
}
|
|
490
|
-
);
|
|
491
|
-
Te.displayName = T;
|
|
492
|
-
var Oe = "AlertDialogTitle", Pe = i.forwardRef(
|
|
493
|
-
(e, o) => {
|
|
494
|
-
const { __scopeAlertDialog: t, ...r } = e, n = y(t);
|
|
495
|
-
return /* @__PURE__ */ c(Et, { ...n, ...r, ref: o });
|
|
496
|
-
}
|
|
497
|
-
);
|
|
498
|
-
Pe.displayName = Oe;
|
|
499
|
-
var Se = "AlertDialogDescription", Ie = i.forwardRef((e, o) => {
|
|
500
|
-
const { __scopeAlertDialog: t, ...r } = e, n = y(t);
|
|
501
|
-
return /* @__PURE__ */ c(ht, { ...n, ...r, ref: o });
|
|
502
|
-
});
|
|
503
|
-
Ie.displayName = Se;
|
|
504
|
-
var Tt = "AlertDialogAction", Me = i.forwardRef(
|
|
505
|
-
(e, o) => {
|
|
506
|
-
const { __scopeAlertDialog: t, ...r } = e, n = y(t);
|
|
507
|
-
return /* @__PURE__ */ c(ye, { ...n, ...r, ref: o });
|
|
508
|
-
}
|
|
509
|
-
);
|
|
510
|
-
Me.displayName = Tt;
|
|
511
|
-
var we = "AlertDialogCancel", Fe = i.forwardRef(
|
|
512
|
-
(e, o) => {
|
|
513
|
-
const { __scopeAlertDialog: t, ...r } = e, { cancelRef: n } = Rt(we, t), a = y(t), l = O(o, n);
|
|
514
|
-
return /* @__PURE__ */ c(ye, { ...a, ...r, ref: l });
|
|
515
|
-
}
|
|
516
|
-
);
|
|
517
|
-
Fe.displayName = we;
|
|
518
|
-
var Ot = ({ contentRef: e }) => {
|
|
519
|
-
const o = `\`${T}\` requires a description for the component to be accessible for screen reader users.
|
|
520
|
-
|
|
521
|
-
You can add a description to the \`${T}\` by passing a \`${Se}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
522
|
-
|
|
523
|
-
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${T}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
524
|
-
|
|
525
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
|
|
526
|
-
return i.useEffect(() => {
|
|
527
|
-
var r;
|
|
528
|
-
document.getElementById(
|
|
529
|
-
(r = e.current) == null ? void 0 : r.getAttribute("aria-describedby")
|
|
530
|
-
) || console.warn(o);
|
|
531
|
-
}, [o, e]), null;
|
|
532
|
-
}, Ut = be, Pt = Ne, Gt = _e, Kt = Re, Bt = Te, Ht = Me, qt = Fe, Vt = Pe, jt = Ie;
|
|
533
|
-
const Yt = ({
|
|
534
|
-
text: e,
|
|
535
|
-
theme: o,
|
|
536
|
-
onOpen: t
|
|
537
|
-
}) => {
|
|
538
|
-
const { theme: r } = He();
|
|
539
|
-
return /* @__PURE__ */ c(Pt, { asChild: !0, children: /* @__PURE__ */ c(Be, { type: "button", theme: o ?? r, onClick: t, children: e }) });
|
|
540
|
-
};
|
|
541
|
-
export {
|
|
542
|
-
Yt as A,
|
|
543
|
-
Bt as C,
|
|
544
|
-
jt as D,
|
|
545
|
-
Kt as O,
|
|
546
|
-
Gt as P,
|
|
547
|
-
Ut as R,
|
|
548
|
-
Vt as T,
|
|
549
|
-
qt as a,
|
|
550
|
-
Ht as b
|
|
551
|
-
};
|