@konstructio/ui 0.1.0-alpha.8 → 0.1.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DatePicker.css +1 -1
- package/dist/{Modal-CrG0m703.js → Modal-0oht63vU.js} +32 -32
- package/dist/assets/icons/components/Search.js +26 -0
- package/dist/assets/icons/components/Warning.js +22 -0
- package/dist/assets/icons/components/index.js +6 -0
- package/dist/{chevron-down-UW8ts6wI.js → chevron-down-CVce9Mvh.js} +2 -2
- package/dist/components/Alert/Alert.js +23 -25
- package/dist/components/Alert/Alert.variants.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/AlertDialog/hooks/useAlertDialog.js +7 -7
- package/dist/components/Autocomplete/Autocomplete.variants.js +3 -4
- package/dist/components/Autocomplete/components/List/List.variants.js +3 -7
- package/dist/components/Autocomplete/hooks/useAutocomplete.js +38 -43
- package/dist/components/Autocomplete/hooks/useNavigationList.js +29 -37
- package/dist/components/Badge/Badge.js +40 -42
- package/dist/components/Badge/Badge.variants.js +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +1 -1
- package/dist/components/Breadcrumb/components/Item/Item.js +22 -21
- package/dist/components/Breadcrumb/components/Item/Item.variants.js +1 -1
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
- package/dist/components/Button/Button.js +15 -15
- package/dist/components/Button/Button.variants.js +10 -77
- package/dist/components/Card/Card.variants.js +3 -5
- package/dist/components/Checkbox/Checkbox.js +48 -47
- package/dist/components/Checkbox/Checkbox.variants.js +3 -4
- package/dist/components/Command/Command.js +2 -2
- package/dist/components/Command/Command.variants.js +1 -1
- package/dist/components/Command/components/Command.js +1 -1
- package/dist/components/Command/components/CommandEmpty.js +1 -1
- package/dist/components/Command/components/CommandGroup.js +1 -1
- package/dist/components/Command/components/CommandInput.js +1 -1
- package/dist/components/Command/components/CommandItem.js +13 -13
- package/dist/components/Command/components/CommandList.js +1 -1
- package/dist/components/Command/components/CommandSeparator.js +1 -1
- package/dist/components/Command/components/DialogContent.js +1 -1
- package/dist/components/Command/components/DialogOverlay.js +1 -1
- package/dist/components/Datepicker/DatePicker.js +1496 -1577
- package/dist/components/Datepicker/DatePicker.variants.js +1 -1
- package/dist/components/Divider/Divider.variants.js +1 -1
- package/dist/components/Dropdown/Dropdown.js +28 -6
- package/dist/components/Dropdown/Dropdown.variants.js +43 -26
- package/dist/components/Dropdown/components/List/List.variants.js +1 -1
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +5 -5
- package/dist/components/Dropdown/components/Wrapper.js +96 -86
- package/dist/components/Dropdown/contexts/dropdown.provider.js +12 -12
- package/dist/components/Dropdown/hooks/useDropdown.js +26 -30
- package/dist/components/Dropdown/hooks/useNavigationList.js +25 -31
- package/dist/components/DropdownButton/DropdownButton.js +135 -0
- package/dist/components/Filter/Filter.variants.js +1 -1
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.hook.js +47 -49
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +70 -57
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.hook.js +41 -42
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +68 -55
- package/dist/components/Filter/components/ResetButton/ResetButton.js +22 -16
- package/dist/components/Input/Input.js +116 -109
- package/dist/components/Input/Input.variants.js +18 -5
- package/dist/components/Loading/Loading.js +2 -2
- package/dist/components/Loading/Loading.variants.js +1 -2
- package/dist/components/Modal/Modal.js +2 -2
- package/dist/components/Modal/components/Body/Body.js +1 -1
- package/dist/components/Modal/components/Footer/Footer.js +1 -1
- package/dist/components/Modal/components/Header/Header.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.js +2 -2
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +7 -9
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/Modal/hooks/useModal.js +16 -17
- package/dist/components/NumberInput/NumberInput.js +91 -91
- package/dist/components/NumberInput/NumberInput.variants.js +1 -1
- package/dist/components/PieChart/PieChart.js +5138 -0
- package/dist/components/ProgressBar/ProgressBar.js +58 -26
- package/dist/components/ProgressBar/ProgressBar.variants.js +1 -1
- package/dist/components/Radio/Radio.js +64 -48
- package/dist/components/Radio/Radio.variants.js +3 -3
- package/dist/components/RadioCard/RadioCard.js +26 -23
- package/dist/components/RadioCard/RadioCard.variants.js +1 -1
- package/dist/components/RadioCardGroup/RadioCardGroup.js +28 -28
- package/dist/components/RadioCardGroup/RadioCardGroup.variants.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +37 -37
- package/dist/components/RadioGroup/RadioGroup.variants.js +1 -1
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Range/Range.variants.js +2 -3
- package/dist/components/Sidebar/Sidebar.js +4 -3
- package/dist/components/Sidebar/Sidebar.variants.js +1 -1
- package/dist/components/Sidebar/components/Footer/Footer.js +5 -4
- package/dist/components/Sidebar/components/Footer/Footer.variants.js +1 -1
- package/dist/components/Sidebar/components/Logo/Logo.js +6 -5
- package/dist/components/Sidebar/components/Logo/Logo.variants.js +1 -1
- package/dist/components/Sidebar/components/Navigation/Navigation.js +5 -4
- package/dist/components/Sidebar/components/Navigation/Navigation.variants.js +1 -1
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.js +14 -13
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.variants.js +1 -1
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.js +13 -12
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.variants.js +1 -1
- package/dist/components/Sidebar/components/NavigationSeparator/NavigationSeparator.js +5 -6
- package/dist/components/Sidebar/components/NavigationSeparator/NavigationSeparator.variants.js +1 -1
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.js +9 -8
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.variants.js +1 -1
- package/dist/components/Sidebar/components/Wrapper/Wrapper.js +15 -14
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Slider/Slider.variants.js +2 -8
- package/dist/components/Switch/Switch.js +54 -54
- package/dist/components/Switch/Switch.variants.js +2 -3
- package/dist/components/Table/Table.variants.js +1 -1
- package/dist/components/Tabs/Tabs.js +20 -16
- package/dist/components/Tabs/Tabs.variants.js +3 -5
- package/dist/components/Tabs/components/Content.js +10 -13
- package/dist/components/Tabs/components/List.js +9 -8
- package/dist/components/Tabs/components/Trigger.js +12 -16
- package/dist/components/Tabs/components/index.js +8 -0
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/Tag/Tag.variants.js +1 -1
- package/dist/components/TagSelect/TagSelect.variants.js +1 -1
- package/dist/components/TagSelect/components/Item/Item.variants.js +1 -1
- package/dist/components/TagSelect/components/List/List.variants.js +1 -1
- package/dist/components/TagSelect/hooks/useTagSelect.js +14 -16
- package/dist/components/TextArea/TextArea.variants.js +4 -5
- package/dist/components/TimePicker/TimePicker.variants.js +6 -7
- package/dist/components/TimePicker/components/HoursList/HoursList.js +21 -26
- package/dist/components/TimePicker/components/MeridianList/MeridianList.js +19 -20
- package/dist/components/TimePicker/components/MinutesList/MinutesList.js +24 -25
- package/dist/components/TimePicker/components/Wrapper/Wrapper.js +33 -34
- package/dist/components/TimePicker/components/WrapperList/WrapperList.variants.js +1 -1
- package/dist/components/Toast/Toast.js +223 -232
- package/dist/components/Toast/Toast.variants.js +8 -11
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Tooltip/Tooltip.variants.js +7 -14
- package/dist/components/Tooltip/hooks/useTooltip.js +8 -9
- package/dist/components/Typography/Typography.js +26 -31
- package/dist/components/Typography/Typography.variants.js +1 -1
- package/dist/components/index.js +78 -66
- package/dist/contexts/theme.provider.js +28 -29
- package/dist/{createLucideIcon-ByJ0JZvK.js → createLucideIcon-BpsAkT97.js} +4 -4
- package/dist/index-0ioNhtNM.js +10 -0
- package/dist/{index-CvfCCTEO.js → index-BAraV3ai.js} +7 -7
- package/dist/index-BXuxPoz7.js +435 -0
- package/dist/index-BfXxHr_2.js +125 -0
- package/dist/index-C1g_chDT.js +70 -0
- package/dist/{index-BCGvACM9.js → index-C9T9HQaa.js} +1 -1
- package/dist/{index-Bc1LNrRD.js → index-CZnD2QxM.js} +1 -1
- package/dist/index-CrBonFvu.js +144 -0
- package/dist/{index-rUBNhTeF.js → index-Cvx4lqTq.js} +2 -2
- package/dist/{index-BNmRGtA6.js → index-D29mdTf5.js} +3 -3
- package/dist/{index-Dkt8F6CZ.js → index-D3xzCzcO.js} +12 -12
- package/dist/index-DB2XhXHn.js +431 -0
- package/dist/{index-B5MIi2tR.js → index-DQH6odE9.js} +2 -3
- package/dist/index-Oq5GlCHP.js +131 -0
- package/dist/{index-Cs8Lv8Wj.js → index-bwWKd82e.js} +1 -1
- package/dist/{index--EmNlyHx.js → index-iXyXtdgP.js} +1 -1
- package/dist/index.d.ts +159 -9
- package/dist/index.js +88 -76
- package/dist/package.json +41 -37
- package/dist/styles.css +1 -1
- package/dist/ui/civo-theme.css +261 -241
- package/dist/ui/kubefirst-theme.css +4 -4
- package/dist/ui/theme.css +0 -2
- package/dist/{useBreadcrumb-DMERrNkJ.js → useBreadcrumb-B8DnuqkR.js} +254 -261
- package/dist/utils/index.js +25 -26
- package/package.json +41 -37
- package/dist/index-BNU3RH-3.js +0 -133
- package/dist/index-BvCZBMfr.js +0 -432
- package/dist/index-Cq1I1cG9.js +0 -129
- package/dist/index-DLYwlPRZ.js +0 -440
- package/dist/index-DNRcvRTB.js +0 -145
- package/dist/index-Dm-ooN_M.js +0 -71
- package/dist/index-DwYXX2sM.js +0 -13
package/dist/index-DLYwlPRZ.js
DELETED
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
import * as i from "react";
|
|
2
|
-
import { a as Ee, c as he, b as _, d as ye } from "./index-Cq1I1cG9.js";
|
|
3
|
-
import { u as S, c as De } from "./index-B5MIi2tR.js";
|
|
4
|
-
import { u as w } from "./index-Cs8Lv8Wj.js";
|
|
5
|
-
import { P as be, D as Ce } from "./index-DNRcvRTB.js";
|
|
6
|
-
import { P as N } from "./index-BCGvACM9.js";
|
|
7
|
-
import { u as j } from "./index-DwYXX2sM.js";
|
|
8
|
-
import { jsx as f, jsxs as q, Fragment as B } from "react/jsx-runtime";
|
|
9
|
-
import { P as U } from "./index-Dm-ooN_M.js";
|
|
10
|
-
import { R as Ae } from "./Combination-VYaRRJBZ.js";
|
|
11
|
-
var x = "focusScope.autoFocusOnMount", L = "focusScope.autoFocusOnUnmount", V = { bubbles: !1, cancelable: !0 }, Re = "FocusScope", Q = i.forwardRef((e, n) => {
|
|
12
|
-
const {
|
|
13
|
-
loop: t = !1,
|
|
14
|
-
trapped: o = !1,
|
|
15
|
-
onMountAutoFocus: a,
|
|
16
|
-
onUnmountAutoFocus: r,
|
|
17
|
-
...c
|
|
18
|
-
} = e, [s, g] = i.useState(null), m = j(a), h = j(r), u = i.useRef(null), d = S(n, (l) => g(l)), p = i.useRef({
|
|
19
|
-
paused: !1,
|
|
20
|
-
pause() {
|
|
21
|
-
this.paused = !0;
|
|
22
|
-
},
|
|
23
|
-
resume() {
|
|
24
|
-
this.paused = !1;
|
|
25
|
-
}
|
|
26
|
-
}).current;
|
|
27
|
-
i.useEffect(() => {
|
|
28
|
-
if (o) {
|
|
29
|
-
let l = function(D) {
|
|
30
|
-
if (p.paused || !s) return;
|
|
31
|
-
const y = D.target;
|
|
32
|
-
s.contains(y) ? u.current = y : C(u.current, { select: !0 });
|
|
33
|
-
}, b = function(D) {
|
|
34
|
-
if (p.paused || !s) return;
|
|
35
|
-
const y = D.relatedTarget;
|
|
36
|
-
y !== null && (s.contains(y) || C(u.current, { select: !0 }));
|
|
37
|
-
}, v = function(D) {
|
|
38
|
-
if (document.activeElement === document.body)
|
|
39
|
-
for (const $ of D)
|
|
40
|
-
$.removedNodes.length > 0 && C(s);
|
|
41
|
-
};
|
|
42
|
-
document.addEventListener("focusin", l), document.addEventListener("focusout", b);
|
|
43
|
-
const O = new MutationObserver(v);
|
|
44
|
-
return s && O.observe(s, { childList: !0, subtree: !0 }), () => {
|
|
45
|
-
document.removeEventListener("focusin", l), document.removeEventListener("focusout", b), O.disconnect();
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}, [o, s, p.paused]), i.useEffect(() => {
|
|
49
|
-
if (s) {
|
|
50
|
-
Z.add(p);
|
|
51
|
-
const l = document.activeElement;
|
|
52
|
-
if (!s.contains(l)) {
|
|
53
|
-
const v = new CustomEvent(x, V);
|
|
54
|
-
s.addEventListener(x, m), s.dispatchEvent(v), v.defaultPrevented || (Ne(Ie(X(s)), { select: !0 }), document.activeElement === l && C(s));
|
|
55
|
-
}
|
|
56
|
-
return () => {
|
|
57
|
-
s.removeEventListener(x, m), setTimeout(() => {
|
|
58
|
-
const v = new CustomEvent(L, V);
|
|
59
|
-
s.addEventListener(L, h), s.dispatchEvent(v), v.defaultPrevented || C(l ?? document.body, { select: !0 }), s.removeEventListener(L, h), Z.remove(p);
|
|
60
|
-
}, 0);
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}, [s, m, h, p]);
|
|
64
|
-
const P = i.useCallback(
|
|
65
|
-
(l) => {
|
|
66
|
-
if (!t && !o || p.paused) return;
|
|
67
|
-
const b = l.key === "Tab" && !l.altKey && !l.ctrlKey && !l.metaKey, v = document.activeElement;
|
|
68
|
-
if (b && v) {
|
|
69
|
-
const O = l.currentTarget, [D, y] = Oe(O);
|
|
70
|
-
D && y ? !l.shiftKey && v === y ? (l.preventDefault(), t && C(D, { select: !0 })) : l.shiftKey && v === D && (l.preventDefault(), t && C(y, { select: !0 })) : v === O && l.preventDefault();
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
[t, o, p.paused]
|
|
74
|
-
);
|
|
75
|
-
return /* @__PURE__ */ f(N.div, { tabIndex: -1, ...c, ref: d, onKeyDown: P });
|
|
76
|
-
});
|
|
77
|
-
Q.displayName = Re;
|
|
78
|
-
function Ne(e, { select: n = !1 } = {}) {
|
|
79
|
-
const t = document.activeElement;
|
|
80
|
-
for (const o of e)
|
|
81
|
-
if (C(o, { select: n }), document.activeElement !== t) return;
|
|
82
|
-
}
|
|
83
|
-
function Oe(e) {
|
|
84
|
-
const n = X(e), t = Y(n, e), o = Y(n.reverse(), e);
|
|
85
|
-
return [t, o];
|
|
86
|
-
}
|
|
87
|
-
function X(e) {
|
|
88
|
-
const n = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
89
|
-
acceptNode: (o) => {
|
|
90
|
-
const a = o.tagName === "INPUT" && o.type === "hidden";
|
|
91
|
-
return o.disabled || o.hidden || a ? NodeFilter.FILTER_SKIP : o.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
for (; t.nextNode(); ) n.push(t.currentNode);
|
|
95
|
-
return n;
|
|
96
|
-
}
|
|
97
|
-
function Y(e, n) {
|
|
98
|
-
for (const t of e)
|
|
99
|
-
if (!_e(t, { upTo: n })) return t;
|
|
100
|
-
}
|
|
101
|
-
function _e(e, { upTo: n }) {
|
|
102
|
-
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
103
|
-
for (; e; ) {
|
|
104
|
-
if (n !== void 0 && e === n) return !1;
|
|
105
|
-
if (getComputedStyle(e).display === "none") return !0;
|
|
106
|
-
e = e.parentElement;
|
|
107
|
-
}
|
|
108
|
-
return !1;
|
|
109
|
-
}
|
|
110
|
-
function Pe(e) {
|
|
111
|
-
return e instanceof HTMLInputElement && "select" in e;
|
|
112
|
-
}
|
|
113
|
-
function C(e, { select: n = !1 } = {}) {
|
|
114
|
-
if (e && e.focus) {
|
|
115
|
-
const t = document.activeElement;
|
|
116
|
-
e.focus({ preventScroll: !0 }), e !== t && Pe(e) && n && e.select();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
var Z = Te();
|
|
120
|
-
function Te() {
|
|
121
|
-
let e = [];
|
|
122
|
-
return {
|
|
123
|
-
add(n) {
|
|
124
|
-
const t = e[0];
|
|
125
|
-
n !== t && (t == null || t.pause()), e = z(e, n), e.unshift(n);
|
|
126
|
-
},
|
|
127
|
-
remove(n) {
|
|
128
|
-
var t;
|
|
129
|
-
e = z(e, n), (t = e[0]) == null || t.resume();
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function z(e, n) {
|
|
134
|
-
const t = [...e], o = t.indexOf(n);
|
|
135
|
-
return o !== -1 && t.splice(o, 1), t;
|
|
136
|
-
}
|
|
137
|
-
function Ie(e) {
|
|
138
|
-
return e.filter((n) => n.tagName !== "A");
|
|
139
|
-
}
|
|
140
|
-
var k = 0;
|
|
141
|
-
function Fe() {
|
|
142
|
-
i.useEffect(() => {
|
|
143
|
-
const e = document.querySelectorAll("[data-radix-focus-guard]");
|
|
144
|
-
return document.body.insertAdjacentElement("afterbegin", e[0] ?? J()), document.body.insertAdjacentElement("beforeend", e[1] ?? J()), k++, () => {
|
|
145
|
-
k === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((n) => n.remove()), k--;
|
|
146
|
-
};
|
|
147
|
-
}, []);
|
|
148
|
-
}
|
|
149
|
-
function J() {
|
|
150
|
-
const e = document.createElement("span");
|
|
151
|
-
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;
|
|
152
|
-
}
|
|
153
|
-
var Se = function(e) {
|
|
154
|
-
if (typeof document > "u")
|
|
155
|
-
return null;
|
|
156
|
-
var n = Array.isArray(e) ? e[0] : e;
|
|
157
|
-
return n.ownerDocument.body;
|
|
158
|
-
}, R = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), I = {}, W = 0, ee = function(e) {
|
|
159
|
-
return e && (e.host || ee(e.parentNode));
|
|
160
|
-
}, Me = function(e, n) {
|
|
161
|
-
return n.map(function(t) {
|
|
162
|
-
if (e.contains(t))
|
|
163
|
-
return t;
|
|
164
|
-
var o = ee(t);
|
|
165
|
-
return o && e.contains(o) ? o : (console.error("aria-hidden", t, "in not contained inside", e, ". Doing nothing"), null);
|
|
166
|
-
}).filter(function(t) {
|
|
167
|
-
return !!t;
|
|
168
|
-
});
|
|
169
|
-
}, we = function(e, n, t, o) {
|
|
170
|
-
var a = Me(n, Array.isArray(e) ? e : [e]);
|
|
171
|
-
I[t] || (I[t] = /* @__PURE__ */ new WeakMap());
|
|
172
|
-
var r = I[t], c = [], s = /* @__PURE__ */ new Set(), g = new Set(a), m = function(u) {
|
|
173
|
-
!u || s.has(u) || (s.add(u), m(u.parentNode));
|
|
174
|
-
};
|
|
175
|
-
a.forEach(m);
|
|
176
|
-
var h = function(u) {
|
|
177
|
-
!u || g.has(u) || Array.prototype.forEach.call(u.children, function(d) {
|
|
178
|
-
if (s.has(d))
|
|
179
|
-
h(d);
|
|
180
|
-
else
|
|
181
|
-
try {
|
|
182
|
-
var p = d.getAttribute(o), P = p !== null && p !== "false", l = (R.get(d) || 0) + 1, b = (r.get(d) || 0) + 1;
|
|
183
|
-
R.set(d, l), r.set(d, b), c.push(d), l === 1 && P && T.set(d, !0), b === 1 && d.setAttribute(t, "true"), P || d.setAttribute(o, "true");
|
|
184
|
-
} catch (v) {
|
|
185
|
-
console.error("aria-hidden: cannot operate on ", d, v);
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
};
|
|
189
|
-
return h(n), s.clear(), W++, function() {
|
|
190
|
-
c.forEach(function(u) {
|
|
191
|
-
var d = R.get(u) - 1, p = r.get(u) - 1;
|
|
192
|
-
R.set(u, d), r.set(u, p), d || (T.has(u) || u.removeAttribute(o), T.delete(u)), p || u.removeAttribute(t);
|
|
193
|
-
}), W--, W || (R = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), I = {});
|
|
194
|
-
};
|
|
195
|
-
}, xe = function(e, n, t) {
|
|
196
|
-
t === void 0 && (t = "data-aria-hidden");
|
|
197
|
-
var o = Array.from(Array.isArray(e) ? e : [e]), a = Se(e);
|
|
198
|
-
return a ? (o.push.apply(o, Array.from(a.querySelectorAll("[aria-live]"))), we(o, a, t, "aria-hidden")) : function() {
|
|
199
|
-
return null;
|
|
200
|
-
};
|
|
201
|
-
}, M = "Dialog", [te, et] = he(M), [Le, E] = te(M), ne = (e) => {
|
|
202
|
-
const {
|
|
203
|
-
__scopeDialog: n,
|
|
204
|
-
children: t,
|
|
205
|
-
open: o,
|
|
206
|
-
defaultOpen: a,
|
|
207
|
-
onOpenChange: r,
|
|
208
|
-
modal: c = !0
|
|
209
|
-
} = e, s = i.useRef(null), g = i.useRef(null), [m, h] = Ee({
|
|
210
|
-
prop: o,
|
|
211
|
-
defaultProp: a ?? !1,
|
|
212
|
-
onChange: r,
|
|
213
|
-
caller: M
|
|
214
|
-
});
|
|
215
|
-
return /* @__PURE__ */ f(
|
|
216
|
-
Le,
|
|
217
|
-
{
|
|
218
|
-
scope: n,
|
|
219
|
-
triggerRef: s,
|
|
220
|
-
contentRef: g,
|
|
221
|
-
contentId: w(),
|
|
222
|
-
titleId: w(),
|
|
223
|
-
descriptionId: w(),
|
|
224
|
-
open: m,
|
|
225
|
-
onOpenChange: h,
|
|
226
|
-
onOpenToggle: i.useCallback(() => h((u) => !u), [h]),
|
|
227
|
-
modal: c,
|
|
228
|
-
children: t
|
|
229
|
-
}
|
|
230
|
-
);
|
|
231
|
-
};
|
|
232
|
-
ne.displayName = M;
|
|
233
|
-
var oe = "DialogTrigger", re = i.forwardRef(
|
|
234
|
-
(e, n) => {
|
|
235
|
-
const { __scopeDialog: t, ...o } = e, a = E(oe, t), r = S(n, a.triggerRef);
|
|
236
|
-
return /* @__PURE__ */ f(
|
|
237
|
-
N.button,
|
|
238
|
-
{
|
|
239
|
-
type: "button",
|
|
240
|
-
"aria-haspopup": "dialog",
|
|
241
|
-
"aria-expanded": a.open,
|
|
242
|
-
"aria-controls": a.contentId,
|
|
243
|
-
"data-state": H(a.open),
|
|
244
|
-
...o,
|
|
245
|
-
ref: r,
|
|
246
|
-
onClick: _(e.onClick, a.onOpenToggle)
|
|
247
|
-
}
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
);
|
|
251
|
-
re.displayName = oe;
|
|
252
|
-
var K = "DialogPortal", [ke, ae] = te(K, {
|
|
253
|
-
forceMount: void 0
|
|
254
|
-
}), se = (e) => {
|
|
255
|
-
const { __scopeDialog: n, forceMount: t, children: o, container: a } = e, r = E(K, n);
|
|
256
|
-
return /* @__PURE__ */ f(ke, { scope: n, forceMount: t, children: i.Children.map(o, (c) => /* @__PURE__ */ f(U, { present: t || r.open, children: /* @__PURE__ */ f(be, { asChild: !0, container: a, children: c }) })) });
|
|
257
|
-
};
|
|
258
|
-
se.displayName = K;
|
|
259
|
-
var F = "DialogOverlay", ie = i.forwardRef(
|
|
260
|
-
(e, n) => {
|
|
261
|
-
const t = ae(F, e.__scopeDialog), { forceMount: o = t.forceMount, ...a } = e, r = E(F, e.__scopeDialog);
|
|
262
|
-
return r.modal ? /* @__PURE__ */ f(U, { present: o || r.open, children: /* @__PURE__ */ f(Ue, { ...a, ref: n }) }) : null;
|
|
263
|
-
}
|
|
264
|
-
);
|
|
265
|
-
ie.displayName = F;
|
|
266
|
-
var We = De("DialogOverlay.RemoveScroll"), Ue = i.forwardRef(
|
|
267
|
-
(e, n) => {
|
|
268
|
-
const { __scopeDialog: t, ...o } = e, a = E(F, t);
|
|
269
|
-
return (
|
|
270
|
-
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
271
|
-
// ie. when `Overlay` and `Content` are siblings
|
|
272
|
-
/* @__PURE__ */ f(Ae, { as: We, allowPinchZoom: !0, shards: [a.contentRef], children: /* @__PURE__ */ f(
|
|
273
|
-
N.div,
|
|
274
|
-
{
|
|
275
|
-
"data-state": H(a.open),
|
|
276
|
-
...o,
|
|
277
|
-
ref: n,
|
|
278
|
-
style: { pointerEvents: "auto", ...o.style }
|
|
279
|
-
}
|
|
280
|
-
) })
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
), A = "DialogContent", ce = i.forwardRef(
|
|
284
|
-
(e, n) => {
|
|
285
|
-
const t = ae(A, e.__scopeDialog), { forceMount: o = t.forceMount, ...a } = e, r = E(A, e.__scopeDialog);
|
|
286
|
-
return /* @__PURE__ */ f(U, { present: o || r.open, children: r.modal ? /* @__PURE__ */ f(Ke, { ...a, ref: n }) : /* @__PURE__ */ f(Ge, { ...a, ref: n }) });
|
|
287
|
-
}
|
|
288
|
-
);
|
|
289
|
-
ce.displayName = A;
|
|
290
|
-
var Ke = i.forwardRef(
|
|
291
|
-
(e, n) => {
|
|
292
|
-
const t = E(A, e.__scopeDialog), o = i.useRef(null), a = S(n, t.contentRef, o);
|
|
293
|
-
return i.useEffect(() => {
|
|
294
|
-
const r = o.current;
|
|
295
|
-
if (r) return xe(r);
|
|
296
|
-
}, []), /* @__PURE__ */ f(
|
|
297
|
-
ue,
|
|
298
|
-
{
|
|
299
|
-
...e,
|
|
300
|
-
ref: a,
|
|
301
|
-
trapFocus: t.open,
|
|
302
|
-
disableOutsidePointerEvents: !0,
|
|
303
|
-
onCloseAutoFocus: _(e.onCloseAutoFocus, (r) => {
|
|
304
|
-
var c;
|
|
305
|
-
r.preventDefault(), (c = t.triggerRef.current) == null || c.focus();
|
|
306
|
-
}),
|
|
307
|
-
onPointerDownOutside: _(e.onPointerDownOutside, (r) => {
|
|
308
|
-
const c = r.detail.originalEvent, s = c.button === 0 && c.ctrlKey === !0;
|
|
309
|
-
(c.button === 2 || s) && r.preventDefault();
|
|
310
|
-
}),
|
|
311
|
-
onFocusOutside: _(
|
|
312
|
-
e.onFocusOutside,
|
|
313
|
-
(r) => r.preventDefault()
|
|
314
|
-
)
|
|
315
|
-
}
|
|
316
|
-
);
|
|
317
|
-
}
|
|
318
|
-
), Ge = i.forwardRef(
|
|
319
|
-
(e, n) => {
|
|
320
|
-
const t = E(A, e.__scopeDialog), o = i.useRef(!1), a = i.useRef(!1);
|
|
321
|
-
return /* @__PURE__ */ f(
|
|
322
|
-
ue,
|
|
323
|
-
{
|
|
324
|
-
...e,
|
|
325
|
-
ref: n,
|
|
326
|
-
trapFocus: !1,
|
|
327
|
-
disableOutsidePointerEvents: !1,
|
|
328
|
-
onCloseAutoFocus: (r) => {
|
|
329
|
-
var c, s;
|
|
330
|
-
(c = e.onCloseAutoFocus) == null || c.call(e, r), r.defaultPrevented || (o.current || (s = t.triggerRef.current) == null || s.focus(), r.preventDefault()), o.current = !1, a.current = !1;
|
|
331
|
-
},
|
|
332
|
-
onInteractOutside: (r) => {
|
|
333
|
-
var g, m;
|
|
334
|
-
(g = e.onInteractOutside) == null || g.call(e, r), r.defaultPrevented || (o.current = !0, r.detail.originalEvent.type === "pointerdown" && (a.current = !0));
|
|
335
|
-
const c = r.target;
|
|
336
|
-
((m = t.triggerRef.current) == null ? void 0 : m.contains(c)) && r.preventDefault(), r.detail.originalEvent.type === "focusin" && a.current && r.preventDefault();
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
), ue = i.forwardRef(
|
|
342
|
-
(e, n) => {
|
|
343
|
-
const { __scopeDialog: t, trapFocus: o, onOpenAutoFocus: a, onCloseAutoFocus: r, ...c } = e, s = E(A, t), g = i.useRef(null), m = S(n, g);
|
|
344
|
-
return Fe(), /* @__PURE__ */ q(B, { children: [
|
|
345
|
-
/* @__PURE__ */ f(
|
|
346
|
-
Q,
|
|
347
|
-
{
|
|
348
|
-
asChild: !0,
|
|
349
|
-
loop: !0,
|
|
350
|
-
trapped: o,
|
|
351
|
-
onMountAutoFocus: a,
|
|
352
|
-
onUnmountAutoFocus: r,
|
|
353
|
-
children: /* @__PURE__ */ f(
|
|
354
|
-
Ce,
|
|
355
|
-
{
|
|
356
|
-
role: "dialog",
|
|
357
|
-
id: s.contentId,
|
|
358
|
-
"aria-describedby": s.descriptionId,
|
|
359
|
-
"aria-labelledby": s.titleId,
|
|
360
|
-
"data-state": H(s.open),
|
|
361
|
-
...c,
|
|
362
|
-
ref: m,
|
|
363
|
-
onDismiss: () => s.onOpenChange(!1)
|
|
364
|
-
}
|
|
365
|
-
)
|
|
366
|
-
}
|
|
367
|
-
),
|
|
368
|
-
/* @__PURE__ */ q(B, { children: [
|
|
369
|
-
/* @__PURE__ */ f(He, { titleId: s.titleId }),
|
|
370
|
-
/* @__PURE__ */ f(je, { contentRef: g, descriptionId: s.descriptionId })
|
|
371
|
-
] })
|
|
372
|
-
] });
|
|
373
|
-
}
|
|
374
|
-
), G = "DialogTitle", le = i.forwardRef(
|
|
375
|
-
(e, n) => {
|
|
376
|
-
const { __scopeDialog: t, ...o } = e, a = E(G, t);
|
|
377
|
-
return /* @__PURE__ */ f(N.h2, { id: a.titleId, ...o, ref: n });
|
|
378
|
-
}
|
|
379
|
-
);
|
|
380
|
-
le.displayName = G;
|
|
381
|
-
var fe = "DialogDescription", de = i.forwardRef(
|
|
382
|
-
(e, n) => {
|
|
383
|
-
const { __scopeDialog: t, ...o } = e, a = E(fe, t);
|
|
384
|
-
return /* @__PURE__ */ f(N.p, { id: a.descriptionId, ...o, ref: n });
|
|
385
|
-
}
|
|
386
|
-
);
|
|
387
|
-
de.displayName = fe;
|
|
388
|
-
var pe = "DialogClose", ve = i.forwardRef(
|
|
389
|
-
(e, n) => {
|
|
390
|
-
const { __scopeDialog: t, ...o } = e, a = E(pe, t);
|
|
391
|
-
return /* @__PURE__ */ f(
|
|
392
|
-
N.button,
|
|
393
|
-
{
|
|
394
|
-
type: "button",
|
|
395
|
-
...o,
|
|
396
|
-
ref: n,
|
|
397
|
-
onClick: _(e.onClick, () => a.onOpenChange(!1))
|
|
398
|
-
}
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
|
-
);
|
|
402
|
-
ve.displayName = pe;
|
|
403
|
-
function H(e) {
|
|
404
|
-
return e ? "open" : "closed";
|
|
405
|
-
}
|
|
406
|
-
var me = "DialogTitleWarning", [tt, ge] = ye(me, {
|
|
407
|
-
contentName: A,
|
|
408
|
-
titleName: G,
|
|
409
|
-
docsSlug: "dialog"
|
|
410
|
-
}), He = ({ titleId: e }) => {
|
|
411
|
-
const n = ge(me), t = `\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.
|
|
412
|
-
|
|
413
|
-
If you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
414
|
-
|
|
415
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;
|
|
416
|
-
return i.useEffect(() => {
|
|
417
|
-
e && (document.getElementById(e) || console.error(t));
|
|
418
|
-
}, [t, e]), null;
|
|
419
|
-
}, $e = "DialogDescriptionWarning", je = ({ contentRef: e, descriptionId: n }) => {
|
|
420
|
-
const o = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ge($e).contentName}}.`;
|
|
421
|
-
return i.useEffect(() => {
|
|
422
|
-
var r;
|
|
423
|
-
const a = (r = e.current) == null ? void 0 : r.getAttribute("aria-describedby");
|
|
424
|
-
n && a && (document.getElementById(n) || console.warn(o));
|
|
425
|
-
}, [o, e, n]), null;
|
|
426
|
-
}, nt = ne, ot = re, rt = se, at = ie, st = ce, it = le, ct = de, ut = ve;
|
|
427
|
-
export {
|
|
428
|
-
st as C,
|
|
429
|
-
le as D,
|
|
430
|
-
at as O,
|
|
431
|
-
rt as P,
|
|
432
|
-
nt as R,
|
|
433
|
-
it as T,
|
|
434
|
-
tt as W,
|
|
435
|
-
se as a,
|
|
436
|
-
ut as b,
|
|
437
|
-
et as c,
|
|
438
|
-
ct as d,
|
|
439
|
-
ot as e
|
|
440
|
-
};
|
package/dist/index-DNRcvRTB.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import * as i from "react";
|
|
2
|
-
import { b as h, u as U } from "./index-Cq1I1cG9.js";
|
|
3
|
-
import { P as m, d as z, R as H } from "./index-BCGvACM9.js";
|
|
4
|
-
import { u as T } from "./index-B5MIi2tR.js";
|
|
5
|
-
import { u as b } from "./index-DwYXX2sM.js";
|
|
6
|
-
import { jsx as P } from "react/jsx-runtime";
|
|
7
|
-
function K(r, e = globalThis == null ? void 0 : globalThis.document) {
|
|
8
|
-
const s = b(r);
|
|
9
|
-
i.useEffect(() => {
|
|
10
|
-
const n = (t) => {
|
|
11
|
-
t.key === "Escape" && s(t);
|
|
12
|
-
};
|
|
13
|
-
return e.addEventListener("keydown", n, { capture: !0 }), () => e.removeEventListener("keydown", n, { capture: !0 });
|
|
14
|
-
}, [s, e]);
|
|
15
|
-
}
|
|
16
|
-
var j = "DismissableLayer", p = "dismissableLayer.update", X = "dismissableLayer.pointerDownOutside", Y = "dismissableLayer.focusOutside", g, B = i.createContext({
|
|
17
|
-
layers: /* @__PURE__ */ new Set(),
|
|
18
|
-
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
19
|
-
branches: /* @__PURE__ */ new Set()
|
|
20
|
-
}), x = i.forwardRef(
|
|
21
|
-
(r, e) => {
|
|
22
|
-
const {
|
|
23
|
-
disableOutsidePointerEvents: s = !1,
|
|
24
|
-
onEscapeKeyDown: n,
|
|
25
|
-
onPointerDownOutside: t,
|
|
26
|
-
onFocusOutside: o,
|
|
27
|
-
onInteractOutside: l,
|
|
28
|
-
onDismiss: u,
|
|
29
|
-
...v
|
|
30
|
-
} = r, c = i.useContext(B), [d, N] = i.useState(null), f = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = i.useState({}), W = T(e, (a) => N(a)), D = Array.from(c.layers), [k] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), I = D.indexOf(k), L = d ? D.indexOf(d) : -1, _ = c.layersWithOutsidePointerEventsDisabled.size > 0, C = L >= I, M = G((a) => {
|
|
31
|
-
const E = a.target, R = [...c.branches].some((y) => y.contains(E));
|
|
32
|
-
!C || R || (t == null || t(a), l == null || l(a), a.defaultPrevented || u == null || u());
|
|
33
|
-
}, f), O = J((a) => {
|
|
34
|
-
const E = a.target;
|
|
35
|
-
[...c.branches].some((y) => y.contains(E)) || (o == null || o(a), l == null || l(a), a.defaultPrevented || u == null || u());
|
|
36
|
-
}, f);
|
|
37
|
-
return K((a) => {
|
|
38
|
-
L === c.layers.size - 1 && (n == null || n(a), !a.defaultPrevented && u && (a.preventDefault(), u()));
|
|
39
|
-
}, f), i.useEffect(() => {
|
|
40
|
-
if (d)
|
|
41
|
-
return s && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (g = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(d)), c.layers.add(d), w(), () => {
|
|
42
|
-
s && c.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = g);
|
|
43
|
-
};
|
|
44
|
-
}, [d, f, s, c]), i.useEffect(() => () => {
|
|
45
|
-
d && (c.layers.delete(d), c.layersWithOutsidePointerEventsDisabled.delete(d), w());
|
|
46
|
-
}, [d, c]), i.useEffect(() => {
|
|
47
|
-
const a = () => F({});
|
|
48
|
-
return document.addEventListener(p, a), () => document.removeEventListener(p, a);
|
|
49
|
-
}, []), /* @__PURE__ */ P(
|
|
50
|
-
m.div,
|
|
51
|
-
{
|
|
52
|
-
...v,
|
|
53
|
-
ref: W,
|
|
54
|
-
style: {
|
|
55
|
-
pointerEvents: _ ? C ? "auto" : "none" : void 0,
|
|
56
|
-
...r.style
|
|
57
|
-
},
|
|
58
|
-
onFocusCapture: h(r.onFocusCapture, O.onFocusCapture),
|
|
59
|
-
onBlurCapture: h(r.onBlurCapture, O.onBlurCapture),
|
|
60
|
-
onPointerDownCapture: h(
|
|
61
|
-
r.onPointerDownCapture,
|
|
62
|
-
M.onPointerDownCapture
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
x.displayName = j;
|
|
69
|
-
var q = "DismissableLayerBranch", S = i.forwardRef((r, e) => {
|
|
70
|
-
const s = i.useContext(B), n = i.useRef(null), t = T(e, n);
|
|
71
|
-
return i.useEffect(() => {
|
|
72
|
-
const o = n.current;
|
|
73
|
-
if (o)
|
|
74
|
-
return s.branches.add(o), () => {
|
|
75
|
-
s.branches.delete(o);
|
|
76
|
-
};
|
|
77
|
-
}, [s.branches]), /* @__PURE__ */ P(m.div, { ...r, ref: t });
|
|
78
|
-
});
|
|
79
|
-
S.displayName = q;
|
|
80
|
-
function G(r, e = globalThis == null ? void 0 : globalThis.document) {
|
|
81
|
-
const s = b(r), n = i.useRef(!1), t = i.useRef(() => {
|
|
82
|
-
});
|
|
83
|
-
return i.useEffect(() => {
|
|
84
|
-
const o = (u) => {
|
|
85
|
-
if (u.target && !n.current) {
|
|
86
|
-
let v = function() {
|
|
87
|
-
A(
|
|
88
|
-
X,
|
|
89
|
-
s,
|
|
90
|
-
c,
|
|
91
|
-
{ discrete: !0 }
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
const c = { originalEvent: u };
|
|
95
|
-
u.pointerType === "touch" ? (e.removeEventListener("click", t.current), t.current = v, e.addEventListener("click", t.current, { once: !0 })) : v();
|
|
96
|
-
} else
|
|
97
|
-
e.removeEventListener("click", t.current);
|
|
98
|
-
n.current = !1;
|
|
99
|
-
}, l = window.setTimeout(() => {
|
|
100
|
-
e.addEventListener("pointerdown", o);
|
|
101
|
-
}, 0);
|
|
102
|
-
return () => {
|
|
103
|
-
window.clearTimeout(l), e.removeEventListener("pointerdown", o), e.removeEventListener("click", t.current);
|
|
104
|
-
};
|
|
105
|
-
}, [e, s]), {
|
|
106
|
-
// ensures we check React component tree (not just DOM tree)
|
|
107
|
-
onPointerDownCapture: () => n.current = !0
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
function J(r, e = globalThis == null ? void 0 : globalThis.document) {
|
|
111
|
-
const s = b(r), n = i.useRef(!1);
|
|
112
|
-
return i.useEffect(() => {
|
|
113
|
-
const t = (o) => {
|
|
114
|
-
o.target && !n.current && A(Y, s, { originalEvent: o }, {
|
|
115
|
-
discrete: !1
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
return e.addEventListener("focusin", t), () => e.removeEventListener("focusin", t);
|
|
119
|
-
}, [e, s]), {
|
|
120
|
-
onFocusCapture: () => n.current = !0,
|
|
121
|
-
onBlurCapture: () => n.current = !1
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function w() {
|
|
125
|
-
const r = new CustomEvent(p);
|
|
126
|
-
document.dispatchEvent(r);
|
|
127
|
-
}
|
|
128
|
-
function A(r, e, s, { discrete: n }) {
|
|
129
|
-
const t = s.originalEvent.target, o = new CustomEvent(r, { bubbles: !1, cancelable: !0, detail: s });
|
|
130
|
-
e && t.addEventListener(r, e, { once: !0 }), n ? z(t, o) : t.dispatchEvent(o);
|
|
131
|
-
}
|
|
132
|
-
var ne = x, re = S, Q = "Portal", V = i.forwardRef((r, e) => {
|
|
133
|
-
var u;
|
|
134
|
-
const { container: s, ...n } = r, [t, o] = i.useState(!1);
|
|
135
|
-
U(() => o(!0), []);
|
|
136
|
-
const l = s || t && ((u = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : u.body);
|
|
137
|
-
return l ? H.createPortal(/* @__PURE__ */ P(m.div, { ...n, ref: e }), l) : null;
|
|
138
|
-
});
|
|
139
|
-
V.displayName = Q;
|
|
140
|
-
export {
|
|
141
|
-
re as B,
|
|
142
|
-
x as D,
|
|
143
|
-
V as P,
|
|
144
|
-
ne as R
|
|
145
|
-
};
|
package/dist/index-Dm-ooN_M.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import * as a from "react";
|
|
2
|
-
import { u as T } from "./index-B5MIi2tR.js";
|
|
3
|
-
import { u as A } from "./index-Cq1I1cG9.js";
|
|
4
|
-
function E(n, e) {
|
|
5
|
-
return a.useReducer((r, t) => e[r][t] ?? r, n);
|
|
6
|
-
}
|
|
7
|
-
var R = (n) => {
|
|
8
|
-
const { present: e, children: r } = n, t = P(e), i = typeof r == "function" ? r({ present: t.isPresent }) : a.Children.only(r), c = T(t.ref, v(i));
|
|
9
|
-
return typeof r == "function" || t.isPresent ? a.cloneElement(i, { ref: c }) : null;
|
|
10
|
-
};
|
|
11
|
-
R.displayName = "Presence";
|
|
12
|
-
function P(n) {
|
|
13
|
-
const [e, r] = a.useState(), t = a.useRef(null), i = a.useRef(n), c = a.useRef("none"), p = n ? "mounted" : "unmounted", [N, s] = E(p, {
|
|
14
|
-
mounted: {
|
|
15
|
-
UNMOUNT: "unmounted",
|
|
16
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
17
|
-
},
|
|
18
|
-
unmountSuspended: {
|
|
19
|
-
MOUNT: "mounted",
|
|
20
|
-
ANIMATION_END: "unmounted"
|
|
21
|
-
},
|
|
22
|
-
unmounted: {
|
|
23
|
-
MOUNT: "mounted"
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
return a.useEffect(() => {
|
|
27
|
-
const o = l(t.current);
|
|
28
|
-
c.current = N === "mounted" ? o : "none";
|
|
29
|
-
}, [N]), A(() => {
|
|
30
|
-
const o = t.current, m = i.current;
|
|
31
|
-
if (m !== n) {
|
|
32
|
-
const f = c.current, u = l(o);
|
|
33
|
-
n ? s("MOUNT") : u === "none" || (o == null ? void 0 : o.display) === "none" ? s("UNMOUNT") : s(m && f !== u ? "ANIMATION_OUT" : "UNMOUNT"), i.current = n;
|
|
34
|
-
}
|
|
35
|
-
}, [n, s]), A(() => {
|
|
36
|
-
if (e) {
|
|
37
|
-
let o;
|
|
38
|
-
const m = e.ownerDocument.defaultView ?? window, d = (u) => {
|
|
39
|
-
const g = l(t.current).includes(u.animationName);
|
|
40
|
-
if (u.target === e && g && (s("ANIMATION_END"), !i.current)) {
|
|
41
|
-
const O = e.style.animationFillMode;
|
|
42
|
-
e.style.animationFillMode = "forwards", o = m.setTimeout(() => {
|
|
43
|
-
e.style.animationFillMode === "forwards" && (e.style.animationFillMode = O);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}, f = (u) => {
|
|
47
|
-
u.target === e && (c.current = l(t.current));
|
|
48
|
-
};
|
|
49
|
-
return e.addEventListener("animationstart", f), e.addEventListener("animationcancel", d), e.addEventListener("animationend", d), () => {
|
|
50
|
-
m.clearTimeout(o), e.removeEventListener("animationstart", f), e.removeEventListener("animationcancel", d), e.removeEventListener("animationend", d);
|
|
51
|
-
};
|
|
52
|
-
} else
|
|
53
|
-
s("ANIMATION_END");
|
|
54
|
-
}, [e, s]), {
|
|
55
|
-
isPresent: ["mounted", "unmountSuspended"].includes(N),
|
|
56
|
-
ref: a.useCallback((o) => {
|
|
57
|
-
t.current = o ? getComputedStyle(o) : null, r(o);
|
|
58
|
-
}, [])
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function l(n) {
|
|
62
|
-
return (n == null ? void 0 : n.animationName) || "none";
|
|
63
|
-
}
|
|
64
|
-
function v(n) {
|
|
65
|
-
var t, i;
|
|
66
|
-
let e = (t = Object.getOwnPropertyDescriptor(n.props, "ref")) == null ? void 0 : t.get, r = e && "isReactWarning" in e && e.isReactWarning;
|
|
67
|
-
return r ? n.ref : (e = (i = Object.getOwnPropertyDescriptor(n, "ref")) == null ? void 0 : i.get, r = e && "isReactWarning" in e && e.isReactWarning, r ? n.props.ref : n.props.ref || n.ref);
|
|
68
|
-
}
|
|
69
|
-
export {
|
|
70
|
-
R as P
|
|
71
|
-
};
|
package/dist/index-DwYXX2sM.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as r from "react";
|
|
2
|
-
function n(t) {
|
|
3
|
-
const e = r.useRef(t);
|
|
4
|
-
return r.useEffect(() => {
|
|
5
|
-
e.current = t;
|
|
6
|
-
}), r.useMemo(() => (...s) => {
|
|
7
|
-
var u;
|
|
8
|
-
return (u = e.current) == null ? void 0 : u.call(e, ...s);
|
|
9
|
-
}, []);
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
n as u
|
|
13
|
-
};
|