welcome-ui 9.0.0-alpha.2 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -3
- package/dist/2W3RN7C5-bkX-rIa3.js +61 -0
- package/dist/4I4MLMKD-BLxAidnq.js +43 -0
- package/dist/Accordion.js +6 -6
- package/dist/Alert.js +1 -1
- package/dist/AspectRatio.js +1 -1
- package/dist/Avatar.js +1 -1
- package/dist/{4CMBR7SL-Dhp8uJop.js → B7UTNDHN-BlIblHCu.js} +59 -59
- package/dist/Badge.js +1 -1
- package/dist/Breadcrumb.css +1 -1
- package/dist/Breadcrumb.js +27 -27
- package/dist/Button.js +2 -2
- package/dist/ButtonGroup.js +1 -1
- package/dist/Card.js +1 -1
- package/dist/Checkbox.css +1 -1
- package/dist/Checkbox.js +22 -22
- package/dist/CloseButton.js +3 -3
- package/dist/{SYRFVSLH-CHNUB1rW.js → DSAASPLT-BaaCUKsb.js} +7 -7
- package/dist/DatePicker.js +5 -5
- package/dist/DateTimePicker.js +2 -2
- package/dist/Drawer.css +1 -1
- package/dist/Drawer.js +67 -67
- package/dist/DropdownMenu.js +261 -259
- package/dist/Field.js +1 -1
- package/dist/FieldGroup.js +1 -1
- package/dist/FileDrop.js +194 -221
- package/dist/FileUpload.js +2 -2
- package/dist/GVVKDT6A-bET6V7Py.js +724 -0
- package/dist/Hint.js +1 -1
- package/dist/{Icon-BisRi8B3.js → Icon-EG7O4YwD.js} +1 -1
- package/dist/Icon.js +12 -12
- package/dist/InputText.js +1 -1
- package/dist/{ASMQKSDT-SH1qSiMi.js → KPUWHTQJ-D2TPji47.js} +30 -30
- package/dist/Label.js +3 -3
- package/dist/Link.css +1 -1
- package/dist/Link.js +27 -27
- package/dist/Loader.js +1 -1
- package/dist/Logo.js +1 -1
- package/dist/Modal.js +10 -10
- package/dist/{JC64G2H7-DPy9R0De.js → NI3IVY7K-Ztb3-XAv.js} +571 -571
- package/dist/{P4IRICAX-7kH4HzWI.js → NMGNQVTG-C6TqBngP.js} +5 -5
- package/dist/{LVA2YJMS-NUHCRwFZ.js → OE2EFRVA-C3721cM3.js} +316 -315
- package/dist/{ITI7HKP4-C5xLpoVY.js → OLVWQA7U-DysaSaZj.js} +59 -59
- package/dist/Pagination.css +1 -1
- package/dist/Pagination.js +81 -73
- package/dist/PasswordInput.js +17 -18
- package/dist/Popover.js +14 -14
- package/dist/{YV4JVR4I-CVFstk2K.js → RTNCFSKZ-qpPg689E.js} +75 -73
- package/dist/Radio.css +1 -1
- package/dist/Radio.js +29 -29
- package/dist/RadioGroup.js +21 -21
- package/dist/RadioTab.js +2 -2
- package/dist/{P2CTZE2T-D1TepwxQ.js → SBSPVDDI-DJKkC1eb.js} +43 -43
- package/dist/{NLEBE274-B4zy25kL.js → SQZLCNLX-CHDXnZ16.js} +16 -16
- package/dist/Search.js +2 -2
- package/dist/Select.js +170 -181
- package/dist/Slider.js +1 -1
- package/dist/Swiper.css +1 -1
- package/dist/Swiper.js +151 -151
- package/dist/{VGCJ63VH-CVhs4PYt.js → T22PY7TE-C1N0q8Kn.js} +109 -109
- package/dist/Table.js +1 -1
- package/dist/Tabs.js +303 -308
- package/dist/Tag.js +3 -3
- package/dist/Text.js +1 -1
- package/dist/Textarea.js +1 -1
- package/dist/TimePicker.js +2 -2
- package/dist/Toast.js +1 -1
- package/dist/Toggle.js +2 -2
- package/dist/Tooltip.js +72 -72
- package/dist/VariantIcon.js +3 -3
- package/dist/WelcomeLoader.js +1 -1
- package/dist/XCKGTAUF-DkxWCbaW.js +25 -0
- package/dist/Y67KZUMI-DFEgrUv2.js +15 -0
- package/dist/{AXB53BZF-BHeessqV.js → ZTXFEM5L-CkrIQCN1.js} +7 -7
- package/dist/{field-icon-size-Du58qHNC.js → field-icon-size-Z5NulTSk.js} +216 -224
- package/dist/{index-5rXezknO.js → index-BC2bF45u.js} +1 -1
- package/dist/{index-C8GsqBDe.js → index-BeetbagJ.js} +1 -1
- package/dist/{index-BJLXLdM3.js → index-Bt79XJ8R.js} +1 -1
- package/dist/{index-Dcq5gh3E.js → index-BtwrJ6N4.js} +1 -1
- package/dist/{index-DL4-ut3P.js → index-CCASZBtz.js} +1 -1
- package/dist/{index-lbUBMgHp.js → index-CPqDZeah.js} +2 -2
- package/dist/{index-CTgip19b.js → index-CQEPCbEE.js} +1 -1
- package/dist/{index-CnxSNAPH.js → index-Crpe9CvH.js} +1 -1
- package/dist/{index-CWVOLBDY.js → index-D5a8Oe6k.js} +1 -1
- package/dist/{index-C1jjVTAc.js → index-D8dq-I5s.js} +1 -1
- package/dist/{index-Cvtm6uuS.js → index-DkwTwo3z.js} +1 -1
- package/dist/{index-BG2aV9o8.js → index-DnO8yBVT.js} +1 -1
- package/dist/index.css +0 -0
- package/dist/tslib.es6-DpB4Y59c.js +683 -0
- package/dist/types/components/Pagination/index.d.ts +1 -2
- package/dist/types/components/Pagination/types.d.ts +5 -2
- package/dist/types/components/PasswordInput/ToggleButton.d.ts +1 -1
- package/dist/types/components/PasswordInput/types.d.ts +1 -1
- package/dist/types/components/Tabs/components/TabList/index.d.ts +1 -1
- package/dist/types/components/Tabs/index.d.ts +1 -1
- package/dist/types/components/Tabs/types.d.ts +1 -2
- package/dist/types/components/Tabs/utils.d.ts +1 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/theme/index.d.ts +0 -0
- package/dist/types/utils/useForkRef.d.ts +7 -1
- package/dist/useForkRef-D807AV7D.js +22 -0
- package/dist/{utils-BNMgUIHQ.js → utils-BpbIqM56.js} +1 -1
- package/dist/utils.js +2 -2
- package/package.json +5 -5
- package/dist/BYC7LY2E-DbSoi9cN.js +0 -673
- package/dist/KUU7WJ55-CsIy9XMu.js +0 -61
- package/dist/MTZPJQMC-D_TnSwZf.js +0 -15
- package/dist/QYJ6MIDR-Dm7lYMh6.js +0 -43
- package/dist/X5NMLKT6-PeY306ft.js +0 -25
- package/dist/index--0U5Rubs.js +0 -644
- /package/dist/{index-PAaZGbyz.js → index-CdiHdiVB.js} +0 -0
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as Ge, c as Fe, b as Ze, d as Je } from "./NI3IVY7K-Ztb3-XAv.js";
|
|
3
|
+
import { P as _e, a as Ke, u as Te, b as Qe } from "./Y67KZUMI-DFEgrUv2.js";
|
|
4
|
+
import { e as et, c as ue, _ as J, i as K, ae as ke, u as Z, M as ae, x as he, d as R, a as E, f as ce, b as le, k as De, l as Pe, S as Oe, a7 as U, V as tt, p as xe, z as ot, q as ge, m as rt, A as nt, W as st, w as it, r as at, aa as ut, v as ct, F as lt, G as q, I as k, H as M, K as dt } from "./OE2EFRVA-C3721cM3.js";
|
|
5
|
+
import { B as ft, N as pt, L as mt, A as vt, O as ht, g as Pt, C as gt, a as wt } from "./floating-ui.dom.browser.min-Bza9K_UR.js";
|
|
6
|
+
import { useRef as X, useState as de, useEffect as D, useContext as xt, createContext as St, useCallback as Ne, useMemo as Ae } from "react";
|
|
7
|
+
import { jsx as A, jsxs as Et } from "react/jsx-runtime";
|
|
8
|
+
import { a as bt, u as Ve, m as yt, o as Ot, t as At, c as We, d as ie, b as ze } from "./RTNCFSKZ-qpPg689E.js";
|
|
9
|
+
var Q = et(
|
|
10
|
+
[Ke],
|
|
11
|
+
[_e]
|
|
12
|
+
);
|
|
13
|
+
Q.useContext;
|
|
14
|
+
Q.useScopedContext;
|
|
15
|
+
var Se = Q.useProviderContext, so = Q.ContextProvider, Ct = Q.ScopedContextProvider;
|
|
16
|
+
function me(t) {
|
|
17
|
+
return [t.clientX, t.clientY];
|
|
18
|
+
}
|
|
19
|
+
function Ce(t, r) {
|
|
20
|
+
const [o, e] = t;
|
|
21
|
+
let n = !1;
|
|
22
|
+
const s = r.length;
|
|
23
|
+
for (let a = s, l = 0, u = a - 1; l < a; u = l++) {
|
|
24
|
+
const [i, c] = r[l], [x, p] = r[u], [, S] = r[u === 0 ? a - 1 : u - 1] || [0, 0], m = (c - p) * (o - i) - (i - x) * (e - c);
|
|
25
|
+
if (p < c) {
|
|
26
|
+
if (e >= p && e < c) {
|
|
27
|
+
if (m === 0) return !0;
|
|
28
|
+
m > 0 && (e === p ? e > S && (n = !n) : n = !n);
|
|
29
|
+
}
|
|
30
|
+
} else if (c < p) {
|
|
31
|
+
if (e > c && e <= p) {
|
|
32
|
+
if (m === 0) return !0;
|
|
33
|
+
m < 0 && (e === p ? e < S && (n = !n) : n = !n);
|
|
34
|
+
}
|
|
35
|
+
} else if (e === c && (o >= x && o <= i || o >= i && o <= x))
|
|
36
|
+
return !0;
|
|
37
|
+
}
|
|
38
|
+
return n;
|
|
39
|
+
}
|
|
40
|
+
function Ht(t, r) {
|
|
41
|
+
const { top: o, right: e, bottom: n, left: s } = r, [a, l] = t, u = a < s ? "left" : a > e ? "right" : null, i = l < o ? "top" : l > n ? "bottom" : null;
|
|
42
|
+
return [u, i];
|
|
43
|
+
}
|
|
44
|
+
function He(t, r) {
|
|
45
|
+
const o = t.getBoundingClientRect(), { top: e, right: n, bottom: s, left: a } = o, [l, u] = Ht(r, o), i = [r];
|
|
46
|
+
return l ? (u !== "top" && i.push([l === "left" ? a : n, e]), i.push([l === "left" ? n : a, e]), i.push([l === "left" ? n : a, s]), u !== "bottom" && i.push([l === "left" ? a : n, s])) : u === "top" ? (i.push([a, e]), i.push([a, s]), i.push([n, s]), i.push([n, e])) : (i.push([a, s]), i.push([a, e]), i.push([n, e]), i.push([n, s])), i;
|
|
47
|
+
}
|
|
48
|
+
var $t = "div";
|
|
49
|
+
function $e(t = 0, r = 0, o = 0, e = 0) {
|
|
50
|
+
if (typeof DOMRect == "function")
|
|
51
|
+
return new DOMRect(t, r, o, e);
|
|
52
|
+
const n = {
|
|
53
|
+
x: t,
|
|
54
|
+
y: r,
|
|
55
|
+
width: o,
|
|
56
|
+
height: e,
|
|
57
|
+
top: r,
|
|
58
|
+
right: t + o,
|
|
59
|
+
bottom: r + e,
|
|
60
|
+
left: t
|
|
61
|
+
};
|
|
62
|
+
return R(E({}, n), { toJSON: () => n });
|
|
63
|
+
}
|
|
64
|
+
function Mt(t) {
|
|
65
|
+
if (!t) return $e();
|
|
66
|
+
const { x: r, y: o, width: e, height: n } = t;
|
|
67
|
+
return $e(r, o, e, n);
|
|
68
|
+
}
|
|
69
|
+
function Rt(t, r) {
|
|
70
|
+
return {
|
|
71
|
+
contextElement: t || void 0,
|
|
72
|
+
getBoundingClientRect: () => {
|
|
73
|
+
const e = t, n = r == null ? void 0 : r(e);
|
|
74
|
+
return n || !e ? Mt(n) : e.getBoundingClientRect();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function Ft(t) {
|
|
79
|
+
return /^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(t);
|
|
80
|
+
}
|
|
81
|
+
function Me(t) {
|
|
82
|
+
const r = window.devicePixelRatio || 1;
|
|
83
|
+
return Math.round(t * r) / r;
|
|
84
|
+
}
|
|
85
|
+
function _t(t, r) {
|
|
86
|
+
return mt(({ placement: o }) => {
|
|
87
|
+
var e;
|
|
88
|
+
const n = ((t == null ? void 0 : t.clientHeight) || 0) / 2, s = typeof r.gutter == "number" ? r.gutter + n : (e = r.gutter) != null ? e : n;
|
|
89
|
+
return {
|
|
90
|
+
crossAxis: !!o.split("-")[1] ? void 0 : r.shift,
|
|
91
|
+
mainAxis: s,
|
|
92
|
+
alignmentAxis: r.shift
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function Tt(t) {
|
|
97
|
+
if (t.flip === !1) return;
|
|
98
|
+
const r = typeof t.flip == "string" ? t.flip.split(" ") : void 0;
|
|
99
|
+
return K(
|
|
100
|
+
!r || r.every(Ft),
|
|
101
|
+
process.env.NODE_ENV !== "production" && "`flip` expects a spaced-delimited list of placements"
|
|
102
|
+
), vt({
|
|
103
|
+
padding: t.overflowPadding,
|
|
104
|
+
fallbackPlacements: r
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function kt(t) {
|
|
108
|
+
if (!(!t.slide && !t.overlap))
|
|
109
|
+
return ht({
|
|
110
|
+
mainAxis: t.slide,
|
|
111
|
+
crossAxis: t.overlap,
|
|
112
|
+
padding: t.overflowPadding,
|
|
113
|
+
limiter: wt()
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function Dt(t) {
|
|
117
|
+
return gt({
|
|
118
|
+
padding: t.overflowPadding,
|
|
119
|
+
apply({ elements: r, availableWidth: o, availableHeight: e, rects: n }) {
|
|
120
|
+
const s = r.floating, a = Math.round(n.reference.width);
|
|
121
|
+
o = Math.floor(o), e = Math.floor(e), s.style.setProperty(
|
|
122
|
+
"--popover-anchor-width",
|
|
123
|
+
`${a}px`
|
|
124
|
+
), s.style.setProperty(
|
|
125
|
+
"--popover-available-width",
|
|
126
|
+
`${o}px`
|
|
127
|
+
), s.style.setProperty(
|
|
128
|
+
"--popover-available-height",
|
|
129
|
+
`${e}px`
|
|
130
|
+
), t.sameWidth && (s.style.width = `${a}px`), t.fitViewport && (s.style.maxWidth = `${o}px`, s.style.maxHeight = `${e}px`);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function Nt(t, r) {
|
|
135
|
+
if (t)
|
|
136
|
+
return Pt({
|
|
137
|
+
element: t,
|
|
138
|
+
padding: r.arrowPadding
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
var je = ue(
|
|
142
|
+
function(r) {
|
|
143
|
+
var o = r, {
|
|
144
|
+
store: e,
|
|
145
|
+
modal: n = !1,
|
|
146
|
+
portal: s = !!n,
|
|
147
|
+
preserveTabOrder: a = !0,
|
|
148
|
+
autoFocusOnShow: l = !0,
|
|
149
|
+
wrapperProps: u,
|
|
150
|
+
fixed: i = !1,
|
|
151
|
+
flip: c = !0,
|
|
152
|
+
shift: x = 0,
|
|
153
|
+
slide: p = !0,
|
|
154
|
+
overlap: S = !1,
|
|
155
|
+
sameWidth: m = !1,
|
|
156
|
+
fitViewport: b = !1,
|
|
157
|
+
gutter: w,
|
|
158
|
+
arrowPadding: f = 4,
|
|
159
|
+
overflowPadding: v = 8,
|
|
160
|
+
getAnchorRect: C,
|
|
161
|
+
updatePosition: F
|
|
162
|
+
} = o, h = J(o, [
|
|
163
|
+
"store",
|
|
164
|
+
"modal",
|
|
165
|
+
"portal",
|
|
166
|
+
"preserveTabOrder",
|
|
167
|
+
"autoFocusOnShow",
|
|
168
|
+
"wrapperProps",
|
|
169
|
+
"fixed",
|
|
170
|
+
"flip",
|
|
171
|
+
"shift",
|
|
172
|
+
"slide",
|
|
173
|
+
"overlap",
|
|
174
|
+
"sameWidth",
|
|
175
|
+
"fitViewport",
|
|
176
|
+
"gutter",
|
|
177
|
+
"arrowPadding",
|
|
178
|
+
"overflowPadding",
|
|
179
|
+
"getAnchorRect",
|
|
180
|
+
"updatePosition"
|
|
181
|
+
]);
|
|
182
|
+
const W = Te();
|
|
183
|
+
e = e || W, K(
|
|
184
|
+
e,
|
|
185
|
+
process.env.NODE_ENV !== "production" && "Popover must receive a `store` prop or be wrapped in a PopoverProvider component."
|
|
186
|
+
);
|
|
187
|
+
const N = e.useState("arrowElement"), y = e.useState("anchorElement"), fe = e.useState("disclosureElement"), P = e.useState("popoverElement"), V = e.useState("contentElement"), ee = e.useState("placement"), d = e.useState("mounted"), O = e.useState("rendered"), g = X(null), [H, _] = de(!1), { portalRef: pe, domReady: z } = ke(s, h.portalRef), j = Z(C), B = Z(F), Y = !!F;
|
|
188
|
+
ae(() => {
|
|
189
|
+
if (!(P != null && P.isConnected)) return;
|
|
190
|
+
P.style.setProperty(
|
|
191
|
+
"--popover-overflow-padding",
|
|
192
|
+
`${v}px`
|
|
193
|
+
);
|
|
194
|
+
const $ = Rt(y, j), G = async () => {
|
|
195
|
+
if (!d) return;
|
|
196
|
+
N || (g.current = g.current || document.createElement("div"));
|
|
197
|
+
const I = N || g.current, qe = [
|
|
198
|
+
_t(I, { gutter: w, shift: x }),
|
|
199
|
+
Tt({ flip: c, overflowPadding: v }),
|
|
200
|
+
kt({ slide: p, overlap: S, overflowPadding: v }),
|
|
201
|
+
Nt(I, { arrowPadding: f }),
|
|
202
|
+
Dt({
|
|
203
|
+
sameWidth: m,
|
|
204
|
+
fitViewport: b,
|
|
205
|
+
overflowPadding: v
|
|
206
|
+
})
|
|
207
|
+
], L = await pt($, P, {
|
|
208
|
+
placement: ee,
|
|
209
|
+
strategy: i ? "fixed" : "absolute",
|
|
210
|
+
middleware: qe
|
|
211
|
+
});
|
|
212
|
+
e == null || e.setState("currentPlacement", L.placement), _(!0);
|
|
213
|
+
const Xe = Me(L.x), Ye = Me(L.y);
|
|
214
|
+
if (Object.assign(P.style, {
|
|
215
|
+
top: "0",
|
|
216
|
+
left: "0",
|
|
217
|
+
transform: `translate3d(${Xe}px,${Ye}px,0)`
|
|
218
|
+
}), I && L.middlewareData.arrow) {
|
|
219
|
+
const { x: oe, y: re } = L.middlewareData.arrow, Ee = L.placement.split("-")[0], ne = I.clientWidth / 2, se = I.clientHeight / 2, be = oe != null ? oe + ne : -ne, ye = re != null ? re + se : -se;
|
|
220
|
+
P.style.setProperty(
|
|
221
|
+
"--popover-transform-origin",
|
|
222
|
+
{
|
|
223
|
+
top: `${be}px calc(100% + ${se}px)`,
|
|
224
|
+
bottom: `${be}px ${-se}px`,
|
|
225
|
+
left: `calc(100% + ${ne}px) ${ye}px`,
|
|
226
|
+
right: `${-ne}px ${ye}px`
|
|
227
|
+
}[Ee]
|
|
228
|
+
), Object.assign(I.style, {
|
|
229
|
+
left: oe != null ? `${oe}px` : "",
|
|
230
|
+
top: re != null ? `${re}px` : "",
|
|
231
|
+
[Ee]: "100%"
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}, Ue = ft($, P, async () => {
|
|
235
|
+
Y ? (await B({ updatePosition: G }), _(!0)) : await G();
|
|
236
|
+
}, {
|
|
237
|
+
// JSDOM doesn't support ResizeObserver
|
|
238
|
+
elementResize: typeof ResizeObserver == "function"
|
|
239
|
+
});
|
|
240
|
+
return () => {
|
|
241
|
+
_(!1), Ue();
|
|
242
|
+
};
|
|
243
|
+
}, [
|
|
244
|
+
e,
|
|
245
|
+
O,
|
|
246
|
+
P,
|
|
247
|
+
N,
|
|
248
|
+
y,
|
|
249
|
+
P,
|
|
250
|
+
ee,
|
|
251
|
+
d,
|
|
252
|
+
z,
|
|
253
|
+
i,
|
|
254
|
+
c,
|
|
255
|
+
x,
|
|
256
|
+
p,
|
|
257
|
+
S,
|
|
258
|
+
m,
|
|
259
|
+
b,
|
|
260
|
+
w,
|
|
261
|
+
f,
|
|
262
|
+
v,
|
|
263
|
+
j,
|
|
264
|
+
Y,
|
|
265
|
+
B
|
|
266
|
+
]), ae(() => {
|
|
267
|
+
if (!d || !z || !(P != null && P.isConnected) || !(V != null && V.isConnected)) return;
|
|
268
|
+
const $ = () => {
|
|
269
|
+
P.style.zIndex = getComputedStyle(V).zIndex;
|
|
270
|
+
};
|
|
271
|
+
$();
|
|
272
|
+
let G = requestAnimationFrame(() => {
|
|
273
|
+
G = requestAnimationFrame($);
|
|
274
|
+
});
|
|
275
|
+
return () => cancelAnimationFrame(G);
|
|
276
|
+
}, [d, z, P, V]);
|
|
277
|
+
const te = i ? "fixed" : "absolute";
|
|
278
|
+
return h = he(
|
|
279
|
+
h,
|
|
280
|
+
($) => /* @__PURE__ */ A(
|
|
281
|
+
"div",
|
|
282
|
+
R(E({}, u), {
|
|
283
|
+
style: E({
|
|
284
|
+
// https://floating-ui.com/docs/computeposition#initial-layout
|
|
285
|
+
position: te,
|
|
286
|
+
top: 0,
|
|
287
|
+
left: 0,
|
|
288
|
+
width: "max-content"
|
|
289
|
+
}, u == null ? void 0 : u.style),
|
|
290
|
+
ref: e == null ? void 0 : e.setPopoverElement,
|
|
291
|
+
children: $
|
|
292
|
+
})
|
|
293
|
+
),
|
|
294
|
+
[e, te, u]
|
|
295
|
+
), h = he(
|
|
296
|
+
h,
|
|
297
|
+
($) => /* @__PURE__ */ A(_e, { value: e, children: $ }),
|
|
298
|
+
[e]
|
|
299
|
+
), h = R(E({
|
|
300
|
+
// data-placing is not part of the public API. We're setting this here so
|
|
301
|
+
// we can wait for the popover to be positioned before other components
|
|
302
|
+
// move focus into it. For example, this attribute is observed by the
|
|
303
|
+
// Combobox component with the autoSelect behavior.
|
|
304
|
+
"data-placing": !H || void 0
|
|
305
|
+
}, h), {
|
|
306
|
+
style: E({
|
|
307
|
+
position: "relative"
|
|
308
|
+
}, h.style)
|
|
309
|
+
}), h = Ge(R(E({
|
|
310
|
+
store: e,
|
|
311
|
+
modal: n,
|
|
312
|
+
portal: s,
|
|
313
|
+
preserveTabOrder: a,
|
|
314
|
+
preserveTabOrderAnchor: fe || y,
|
|
315
|
+
autoFocusOnShow: H && l
|
|
316
|
+
}, h), {
|
|
317
|
+
portalRef: pe
|
|
318
|
+
})), h;
|
|
319
|
+
}
|
|
320
|
+
), io = Fe(
|
|
321
|
+
ce(function(r) {
|
|
322
|
+
const o = je(r);
|
|
323
|
+
return le($t, o);
|
|
324
|
+
}),
|
|
325
|
+
Te
|
|
326
|
+
), Vt = "div";
|
|
327
|
+
function Be(t, r, o, e) {
|
|
328
|
+
return rt(r) ? !0 : t ? !!(ge(r, t) || o && ge(o, t) || e != null && e.some((n) => Be(t, n, o))) : !1;
|
|
329
|
+
}
|
|
330
|
+
function Wt(t) {
|
|
331
|
+
var r = t, {
|
|
332
|
+
store: o
|
|
333
|
+
} = r, e = J(r, [
|
|
334
|
+
"store"
|
|
335
|
+
]);
|
|
336
|
+
const [n, s] = de(!1), a = o.useState("mounted");
|
|
337
|
+
D(() => {
|
|
338
|
+
a || s(!1);
|
|
339
|
+
}, [a]);
|
|
340
|
+
const l = e.onFocus, u = Z((c) => {
|
|
341
|
+
l == null || l(c), !c.defaultPrevented && s(!0);
|
|
342
|
+
}), i = X(null);
|
|
343
|
+
return D(() => bt(o, ["anchorElement"], (c) => {
|
|
344
|
+
i.current = c.anchorElement;
|
|
345
|
+
}), []), e = R(E({
|
|
346
|
+
autoFocusOnHide: n,
|
|
347
|
+
finalFocus: i
|
|
348
|
+
}, e), {
|
|
349
|
+
onFocus: u
|
|
350
|
+
}), e;
|
|
351
|
+
}
|
|
352
|
+
var Re = St(null), zt = ue(
|
|
353
|
+
function(r) {
|
|
354
|
+
var o = r, {
|
|
355
|
+
store: e,
|
|
356
|
+
modal: n = !1,
|
|
357
|
+
portal: s = !!n,
|
|
358
|
+
hideOnEscape: a = !0,
|
|
359
|
+
hideOnHoverOutside: l = !0,
|
|
360
|
+
disablePointerEventsOnApproach: u = !!l
|
|
361
|
+
} = o, i = J(o, [
|
|
362
|
+
"store",
|
|
363
|
+
"modal",
|
|
364
|
+
"portal",
|
|
365
|
+
"hideOnEscape",
|
|
366
|
+
"hideOnHoverOutside",
|
|
367
|
+
"disablePointerEventsOnApproach"
|
|
368
|
+
]);
|
|
369
|
+
const c = Se();
|
|
370
|
+
e = e || c, K(
|
|
371
|
+
e,
|
|
372
|
+
process.env.NODE_ENV !== "production" && "Hovercard must receive a `store` prop or be wrapped in a HovercardProvider component."
|
|
373
|
+
);
|
|
374
|
+
const x = X(null), [p, S] = de([]), m = X(0), b = X(null), { portalRef: w, domReady: f } = ke(s, i.portalRef), v = De(), C = !!l, F = Pe(l), h = !!u, W = Pe(
|
|
375
|
+
u
|
|
376
|
+
), N = e.useState("open"), y = e.useState("mounted");
|
|
377
|
+
D(() => {
|
|
378
|
+
if (!f || !y || !C && !h) return;
|
|
379
|
+
const d = x.current;
|
|
380
|
+
return d ? Oe(
|
|
381
|
+
U("mousemove", (g) => {
|
|
382
|
+
if (!e || !v()) return;
|
|
383
|
+
const { anchorElement: H, hideTimeout: _, timeout: pe } = e.getState(), z = b.current, [j] = g.composedPath(), B = H;
|
|
384
|
+
if (Be(j, d, B, p)) {
|
|
385
|
+
b.current = j && B && ge(B, j) ? me(g) : null, window.clearTimeout(m.current), m.current = 0;
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
if (!m.current) {
|
|
389
|
+
if (z) {
|
|
390
|
+
const Y = me(g), te = He(d, z);
|
|
391
|
+
if (Ce(Y, te)) {
|
|
392
|
+
if (b.current = Y, !W(g)) return;
|
|
393
|
+
g.preventDefault(), g.stopPropagation();
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
F(g) && (m.current = window.setTimeout(() => {
|
|
398
|
+
m.current = 0, e == null || e.hide();
|
|
399
|
+
}, _ ?? pe));
|
|
400
|
+
}
|
|
401
|
+
}, !0),
|
|
402
|
+
() => clearTimeout(m.current)
|
|
403
|
+
) : void 0;
|
|
404
|
+
}, [
|
|
405
|
+
e,
|
|
406
|
+
v,
|
|
407
|
+
f,
|
|
408
|
+
y,
|
|
409
|
+
C,
|
|
410
|
+
h,
|
|
411
|
+
p,
|
|
412
|
+
W,
|
|
413
|
+
F
|
|
414
|
+
]), D(() => {
|
|
415
|
+
if (!f || !y || !h) return;
|
|
416
|
+
const d = (O) => {
|
|
417
|
+
const g = x.current;
|
|
418
|
+
if (!g) return;
|
|
419
|
+
const H = b.current;
|
|
420
|
+
if (!H) return;
|
|
421
|
+
const _ = He(g, H);
|
|
422
|
+
if (Ce(me(O), _)) {
|
|
423
|
+
if (!W(O)) return;
|
|
424
|
+
O.preventDefault(), O.stopPropagation();
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
return Oe(
|
|
428
|
+
// Note: we may need to add pointer events here in the future.
|
|
429
|
+
U("mouseenter", d, !0),
|
|
430
|
+
U("mouseover", d, !0),
|
|
431
|
+
U("mouseout", d, !0),
|
|
432
|
+
U("mouseleave", d, !0)
|
|
433
|
+
);
|
|
434
|
+
}, [f, y, h, W]), D(() => {
|
|
435
|
+
f && (N || e == null || e.setAutoFocusOnShow(!1));
|
|
436
|
+
}, [e, f, N]);
|
|
437
|
+
const fe = tt(N);
|
|
438
|
+
D(() => {
|
|
439
|
+
if (f)
|
|
440
|
+
return () => {
|
|
441
|
+
fe.current || e == null || e.setAutoFocusOnShow(!1);
|
|
442
|
+
};
|
|
443
|
+
}, [e, f]);
|
|
444
|
+
const P = xt(Re);
|
|
445
|
+
ae(() => {
|
|
446
|
+
if (n || !s || !y || !f) return;
|
|
447
|
+
const d = x.current;
|
|
448
|
+
if (d)
|
|
449
|
+
return P == null ? void 0 : P(d);
|
|
450
|
+
}, [n, s, y, f]);
|
|
451
|
+
const V = Ne(
|
|
452
|
+
(d) => {
|
|
453
|
+
S((g) => [...g, d]);
|
|
454
|
+
const O = P == null ? void 0 : P(d);
|
|
455
|
+
return () => {
|
|
456
|
+
S(
|
|
457
|
+
(g) => g.filter((H) => H !== d)
|
|
458
|
+
), O == null || O();
|
|
459
|
+
};
|
|
460
|
+
},
|
|
461
|
+
[P]
|
|
462
|
+
);
|
|
463
|
+
i = he(
|
|
464
|
+
i,
|
|
465
|
+
(d) => /* @__PURE__ */ A(Ct, { value: e, children: /* @__PURE__ */ A(Re.Provider, { value: V, children: d }) }),
|
|
466
|
+
[e, V]
|
|
467
|
+
), i = R(E({}, i), {
|
|
468
|
+
ref: xe(x, i.ref)
|
|
469
|
+
}), i = Wt(E({ store: e }, i));
|
|
470
|
+
const ee = e.useState(
|
|
471
|
+
(d) => n || d.autoFocusOnShow
|
|
472
|
+
);
|
|
473
|
+
return i = je(R(E({
|
|
474
|
+
store: e,
|
|
475
|
+
modal: n,
|
|
476
|
+
portal: s,
|
|
477
|
+
autoFocusOnShow: ee
|
|
478
|
+
}, i), {
|
|
479
|
+
portalRef: w,
|
|
480
|
+
hideOnEscape(d) {
|
|
481
|
+
return ot(a, d) ? !1 : (requestAnimationFrame(() => {
|
|
482
|
+
requestAnimationFrame(() => {
|
|
483
|
+
e == null || e.hide();
|
|
484
|
+
});
|
|
485
|
+
}), !0);
|
|
486
|
+
}
|
|
487
|
+
})), i;
|
|
488
|
+
}
|
|
489
|
+
), ao = Fe(
|
|
490
|
+
ce(function(r) {
|
|
491
|
+
const o = zt(r);
|
|
492
|
+
return le(Vt, o);
|
|
493
|
+
}),
|
|
494
|
+
Se
|
|
495
|
+
), jt = "a", Bt = ue(
|
|
496
|
+
function(r) {
|
|
497
|
+
var o = r, { store: e, showOnHover: n = !0 } = o, s = J(o, ["store", "showOnHover"]);
|
|
498
|
+
const a = Se();
|
|
499
|
+
e = e || a, K(
|
|
500
|
+
e,
|
|
501
|
+
process.env.NODE_ENV !== "production" && "HovercardAnchor must receive a `store` prop or be wrapped in a HovercardProvider component."
|
|
502
|
+
);
|
|
503
|
+
const l = nt(s), u = X(0);
|
|
504
|
+
D(() => () => window.clearTimeout(u.current), []), D(() => U("mouseleave", (f) => {
|
|
505
|
+
if (!e) return;
|
|
506
|
+
const { anchorElement: v } = e.getState();
|
|
507
|
+
v && f.target === v && (window.clearTimeout(u.current), u.current = 0);
|
|
508
|
+
}, !0), [e]);
|
|
509
|
+
const i = s.onMouseMove, c = Pe(n), x = De(), p = Z((w) => {
|
|
510
|
+
if (i == null || i(w), l || !e || w.defaultPrevented || u.current || !x() || !c(w)) return;
|
|
511
|
+
const f = w.currentTarget;
|
|
512
|
+
e.setAnchorElement(f), e.setDisclosureElement(f);
|
|
513
|
+
const { showTimeout: v, timeout: C } = e.getState(), F = () => {
|
|
514
|
+
u.current = 0, x() && (e == null || e.setAnchorElement(f), e == null || e.show(), queueMicrotask(() => {
|
|
515
|
+
e == null || e.setDisclosureElement(f);
|
|
516
|
+
}));
|
|
517
|
+
}, h = v ?? C;
|
|
518
|
+
h === 0 ? F() : u.current = window.setTimeout(F, h);
|
|
519
|
+
}), S = s.onClick, m = Z((w) => {
|
|
520
|
+
S == null || S(w), e && (window.clearTimeout(u.current), u.current = 0);
|
|
521
|
+
}), b = Ne(
|
|
522
|
+
(w) => {
|
|
523
|
+
if (!e) return;
|
|
524
|
+
const { anchorElement: f } = e.getState();
|
|
525
|
+
f != null && f.isConnected || e.setAnchorElement(w);
|
|
526
|
+
},
|
|
527
|
+
[e]
|
|
528
|
+
);
|
|
529
|
+
return s = R(E({}, s), {
|
|
530
|
+
ref: xe(b, s.ref),
|
|
531
|
+
onMouseMove: p,
|
|
532
|
+
onClick: m
|
|
533
|
+
}), s = st(s), s;
|
|
534
|
+
}
|
|
535
|
+
), uo = ce(function(r) {
|
|
536
|
+
const o = Bt(r);
|
|
537
|
+
return le(jt, o);
|
|
538
|
+
}), ve = "M23 27.8C24.1 29 26.4 30 28 30H30H0H2C3.7 30 5.9 29 7 27.8L14 20.6C14.7 19.8 15.3 19.8 16 20.6L23 27.8Z", It = "div", we = 30, T = we / 2, Lt = {
|
|
539
|
+
top: `rotate(180 ${T} ${T})`,
|
|
540
|
+
right: `rotate(-90 ${T} ${T})`,
|
|
541
|
+
bottom: `rotate(0 ${T} ${T})`,
|
|
542
|
+
left: `rotate(90 ${T} ${T})`
|
|
543
|
+
};
|
|
544
|
+
function Ut(t) {
|
|
545
|
+
const [r, o] = de(), e = Ve(t, "contentElement");
|
|
546
|
+
return ae(() => {
|
|
547
|
+
if (!e) return;
|
|
548
|
+
const s = ut(e).getComputedStyle(e);
|
|
549
|
+
o(s);
|
|
550
|
+
}, [e]), r;
|
|
551
|
+
}
|
|
552
|
+
function qt(t) {
|
|
553
|
+
var r;
|
|
554
|
+
return t ? (r = t.getPropertyValue("box-shadow").match(/0px 0px 0px ([^0]+px)/)) == null ? void 0 : r[1] : void 0;
|
|
555
|
+
}
|
|
556
|
+
function Xt(t, r) {
|
|
557
|
+
if (!r) return;
|
|
558
|
+
const o = r.getPropertyValue(`border-${t}-color`);
|
|
559
|
+
if (o) return o;
|
|
560
|
+
const n = r.getPropertyValue("box-shadow").match(/0px 0px 0px [^,]+/);
|
|
561
|
+
return n && n[0].replace(/^0px 0px 0px\s+[^\s,]+/, "").trim() || void 0;
|
|
562
|
+
}
|
|
563
|
+
var Yt = ue(
|
|
564
|
+
function(r) {
|
|
565
|
+
var o = r, {
|
|
566
|
+
store: e,
|
|
567
|
+
size: n = we,
|
|
568
|
+
borderWidth: s
|
|
569
|
+
} = o, a = J(o, [
|
|
570
|
+
"store",
|
|
571
|
+
"size",
|
|
572
|
+
"borderWidth"
|
|
573
|
+
]);
|
|
574
|
+
const l = Qe();
|
|
575
|
+
e = e || l, K(
|
|
576
|
+
e,
|
|
577
|
+
process.env.NODE_ENV !== "production" && "PopoverArrow must be wrapped in a Popover component."
|
|
578
|
+
);
|
|
579
|
+
const u = Ve(
|
|
580
|
+
e,
|
|
581
|
+
(v) => v.currentPlacement.split("-")[0]
|
|
582
|
+
), i = it(), c = Ut(e), x = Xt(u, c) || "none", p = (c == null ? void 0 : c.getPropertyValue("background-color")) || "none", [S, m] = Ae(() => {
|
|
583
|
+
if (s != null) return [s, !1];
|
|
584
|
+
if (!c) return [0, !1];
|
|
585
|
+
const v = qt(c);
|
|
586
|
+
if (v) return [Number.parseInt(v, 10), !0];
|
|
587
|
+
const C = c.getPropertyValue(`border-${u}-width`);
|
|
588
|
+
return C ? [Math.ceil(Number.parseFloat(C)), !1] : [0, !1];
|
|
589
|
+
}, [s, c, u]), b = S * 2 * (we / n), w = Lt[u], f = Ae(
|
|
590
|
+
() => /* @__PURE__ */ A("svg", { display: "block", viewBox: "0 0 30 30", children: /* @__PURE__ */ Et("g", { transform: w, children: [
|
|
591
|
+
!m && // When using the CSS border property, set the fill color to match
|
|
592
|
+
// the background behind the stroke so transparent strokes match
|
|
593
|
+
// the appearance of borders on HTML elements.
|
|
594
|
+
/* @__PURE__ */ A(
|
|
595
|
+
"path",
|
|
596
|
+
{
|
|
597
|
+
fill: "none",
|
|
598
|
+
stroke: `var(--ak-layer, ${p})`,
|
|
599
|
+
d: ve,
|
|
600
|
+
mask: `url(#${i})`
|
|
601
|
+
}
|
|
602
|
+
),
|
|
603
|
+
/* @__PURE__ */ A("path", { fill: "none", d: ve, mask: `url(#${i})` }),
|
|
604
|
+
/* @__PURE__ */ A("path", { stroke: "none", d: ve }),
|
|
605
|
+
/* @__PURE__ */ A("mask", { id: i, maskUnits: "userSpaceOnUse", children: /* @__PURE__ */ A(
|
|
606
|
+
"rect",
|
|
607
|
+
{
|
|
608
|
+
x: "-15",
|
|
609
|
+
y: "0",
|
|
610
|
+
width: "60",
|
|
611
|
+
height: "30",
|
|
612
|
+
fill: "white",
|
|
613
|
+
stroke: "black"
|
|
614
|
+
}
|
|
615
|
+
) })
|
|
616
|
+
] }) }),
|
|
617
|
+
[w, m, p, i]
|
|
618
|
+
);
|
|
619
|
+
return a = R(E({
|
|
620
|
+
children: f,
|
|
621
|
+
"aria-hidden": !0
|
|
622
|
+
}, a), {
|
|
623
|
+
ref: xe(e.setArrowElement, a.ref),
|
|
624
|
+
style: E({
|
|
625
|
+
position: "absolute",
|
|
626
|
+
fontSize: n,
|
|
627
|
+
width: "1em",
|
|
628
|
+
height: "1em",
|
|
629
|
+
pointerEvents: "none",
|
|
630
|
+
fill: `var(--ak-layer, ${p})`,
|
|
631
|
+
stroke: `var(--ak-layer-border, ${x})`,
|
|
632
|
+
strokeWidth: b
|
|
633
|
+
}, a.style)
|
|
634
|
+
}), at(a);
|
|
635
|
+
}
|
|
636
|
+
), co = ct(
|
|
637
|
+
ce(function(r) {
|
|
638
|
+
const o = Yt(r);
|
|
639
|
+
return le(It, o);
|
|
640
|
+
})
|
|
641
|
+
);
|
|
642
|
+
function Ie(t = {}) {
|
|
643
|
+
var r = t, {
|
|
644
|
+
popover: o
|
|
645
|
+
} = r, e = lt(r, [
|
|
646
|
+
"popover"
|
|
647
|
+
]);
|
|
648
|
+
const n = yt(
|
|
649
|
+
e.store,
|
|
650
|
+
Ot(o, [
|
|
651
|
+
"arrowElement",
|
|
652
|
+
"anchorElement",
|
|
653
|
+
"contentElement",
|
|
654
|
+
"popoverElement",
|
|
655
|
+
"disclosureElement"
|
|
656
|
+
])
|
|
657
|
+
);
|
|
658
|
+
At(e, n);
|
|
659
|
+
const s = n == null ? void 0 : n.getState(), a = Ze(q(k({}, e), { store: n })), l = M(
|
|
660
|
+
e.placement,
|
|
661
|
+
s == null ? void 0 : s.placement,
|
|
662
|
+
"bottom"
|
|
663
|
+
), u = q(k({}, a.getState()), {
|
|
664
|
+
placement: l,
|
|
665
|
+
currentPlacement: l,
|
|
666
|
+
anchorElement: M(s == null ? void 0 : s.anchorElement, null),
|
|
667
|
+
popoverElement: M(s == null ? void 0 : s.popoverElement, null),
|
|
668
|
+
arrowElement: M(s == null ? void 0 : s.arrowElement, null),
|
|
669
|
+
rendered: Symbol("rendered")
|
|
670
|
+
}), i = We(u, a, n);
|
|
671
|
+
return q(k(k({}, a), i), {
|
|
672
|
+
setAnchorElement: (c) => i.setState("anchorElement", c),
|
|
673
|
+
setPopoverElement: (c) => i.setState("popoverElement", c),
|
|
674
|
+
setArrowElement: (c) => i.setState("arrowElement", c),
|
|
675
|
+
render: () => i.setState("rendered", Symbol("rendered"))
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
function Le(t, r, o) {
|
|
679
|
+
return dt(r, [o.popover]), ie(t, o, "placement"), Je(t, r, o);
|
|
680
|
+
}
|
|
681
|
+
function lo(t = {}) {
|
|
682
|
+
const [r, o] = ze(Ie, t);
|
|
683
|
+
return Le(r, o, t);
|
|
684
|
+
}
|
|
685
|
+
function Gt(t = {}) {
|
|
686
|
+
var r;
|
|
687
|
+
const o = (r = t.store) == null ? void 0 : r.getState(), e = Ie(q(k({}, t), {
|
|
688
|
+
placement: M(
|
|
689
|
+
t.placement,
|
|
690
|
+
o == null ? void 0 : o.placement,
|
|
691
|
+
"bottom"
|
|
692
|
+
)
|
|
693
|
+
})), n = M(t.timeout, o == null ? void 0 : o.timeout, 500), s = q(k({}, e.getState()), {
|
|
694
|
+
timeout: n,
|
|
695
|
+
showTimeout: M(t.showTimeout, o == null ? void 0 : o.showTimeout),
|
|
696
|
+
hideTimeout: M(t.hideTimeout, o == null ? void 0 : o.hideTimeout),
|
|
697
|
+
autoFocusOnShow: M(o == null ? void 0 : o.autoFocusOnShow, !1)
|
|
698
|
+
}), a = We(s, e, t.store);
|
|
699
|
+
return q(k(k({}, e), a), {
|
|
700
|
+
setAutoFocusOnShow: (l) => a.setState("autoFocusOnShow", l)
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
function Zt(t, r, o) {
|
|
704
|
+
return ie(t, o, "timeout"), ie(t, o, "showTimeout"), ie(t, o, "hideTimeout"), Le(t, r, o);
|
|
705
|
+
}
|
|
706
|
+
function fo(t = {}) {
|
|
707
|
+
const [r, o] = ze(Gt, t);
|
|
708
|
+
return Zt(r, o, t);
|
|
709
|
+
}
|
|
710
|
+
export {
|
|
711
|
+
Ct as H,
|
|
712
|
+
co as P,
|
|
713
|
+
so as a,
|
|
714
|
+
Yt as b,
|
|
715
|
+
Bt as c,
|
|
716
|
+
Gt as d,
|
|
717
|
+
Zt as e,
|
|
718
|
+
uo as f,
|
|
719
|
+
ao as g,
|
|
720
|
+
lo as h,
|
|
721
|
+
fo as i,
|
|
722
|
+
io as j,
|
|
723
|
+
zt as u
|
|
724
|
+
};
|