welcome-ui 10.0.0-alpha.1 → 10.0.0-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.
Files changed (102) hide show
  1. package/README.md +1 -1
  2. package/dist/{2W3RN7C5-bkX-rIa3.js → 2W3RN7C5-uG7eBeTQ.js} +11 -11
  3. package/dist/4I4MLMKD-z3Xm3qCo.js +150 -0
  4. package/dist/Accordion.js +4 -4
  5. package/dist/Alert.js +1 -1
  6. package/dist/AspectRatio.js +1 -1
  7. package/dist/Avatar.js +1 -1
  8. package/dist/{B7UTNDHN-BlIblHCu.js → B7UTNDHN-BDa2-8JK.js} +2 -2
  9. package/dist/Badge.js +1 -1
  10. package/dist/Breadcrumb.css +1 -1
  11. package/dist/Breadcrumb.js +165 -151
  12. package/dist/Button.js +2 -2
  13. package/dist/ButtonGroup.js +1 -1
  14. package/dist/Card.js +1 -1
  15. package/dist/Checkbox.js +2 -2
  16. package/dist/CloseButton.css +1 -1
  17. package/dist/CloseButton.js +12 -12
  18. package/dist/{DSAASPLT-BaaCUKsb.js → DSAASPLT-C-2xDjIv.js} +3 -3
  19. package/dist/DatePicker.js +2 -2
  20. package/dist/DateTimePicker.js +2 -2
  21. package/dist/Drawer.js +25 -22
  22. package/dist/DropdownMenu.js +41 -41
  23. package/dist/Field.js +1 -1
  24. package/dist/FieldGroup.js +1 -1
  25. package/dist/FileDrop.js +2 -2
  26. package/dist/FileUpload.js +1 -1
  27. package/dist/GVVKDT6A-C66-lr0B.js +619 -0
  28. package/dist/Hint.js +1 -1
  29. package/dist/Icon.css +1 -1
  30. package/dist/Icon.js +32 -24
  31. package/dist/InputText.js +1 -1
  32. package/dist/{KPUWHTQJ-D2TPji47.js → KPUWHTQJ-Byij2al4.js} +11 -11
  33. package/dist/Label.js +1 -1
  34. package/dist/Link.js +20 -19
  35. package/dist/Loader.js +1 -1
  36. package/dist/Logo.js +1 -1
  37. package/dist/Modal.js +5 -5
  38. package/dist/{NI3IVY7K-Ztb3-XAv.js → NI3IVY7K-DpF3td-7.js} +115 -115
  39. package/dist/{NMGNQVTG-C6TqBngP.js → NMGNQVTG-BgAqqGOq.js} +6 -6
  40. package/dist/{OE2EFRVA-C3721cM3.js → OE2EFRVA-DkdhQLJL.js} +27 -27
  41. package/dist/{OLVWQA7U-DysaSaZj.js → OLVWQA7U-wHytlFYu.js} +30 -30
  42. package/dist/Pagination.css +1 -1
  43. package/dist/Pagination.js +155 -76
  44. package/dist/Popover.js +21 -21
  45. package/dist/{RTNCFSKZ-qpPg689E.js → RTNCFSKZ-LcIdBwa8.js} +16 -16
  46. package/dist/Radio.js +2 -2
  47. package/dist/RadioGroup.js +4 -4
  48. package/dist/RadioTab.js +2 -2
  49. package/dist/{SBSPVDDI-DJKkC1eb.js → SBSPVDDI-BoxPz2JY.js} +22 -22
  50. package/dist/{SQZLCNLX-CHDXnZ16.js → SQZLCNLX-CUlXoT69.js} +8 -8
  51. package/dist/Search.js +2 -2
  52. package/dist/Select.js +2 -2
  53. package/dist/Slider.js +1 -1
  54. package/dist/Stepper.js +1 -1
  55. package/dist/Swiper.js +1 -1
  56. package/dist/{T22PY7TE-C1N0q8Kn.js → T22PY7TE-CzEDuEn1.js} +21 -21
  57. package/dist/Table.js +1 -1
  58. package/dist/Tabs.js +23 -23
  59. package/dist/Tag.js +1 -1
  60. package/dist/Text.js +1 -1
  61. package/dist/Textarea.js +1 -1
  62. package/dist/TimePicker.js +2 -2
  63. package/dist/Toast.css +1 -1
  64. package/dist/Toast.js +286 -222
  65. package/dist/Toggle.js +2 -2
  66. package/dist/Tooltip.css +1 -1
  67. package/dist/Tooltip.js +118 -129
  68. package/dist/VariantIcon.js +1 -1
  69. package/dist/VisuallyHidden.js +1 -1
  70. package/dist/WelcomeLoader.js +1 -1
  71. package/dist/{XCKGTAUF-DkxWCbaW.js → XCKGTAUF-CahZE721.js} +4 -4
  72. package/dist/{Y67KZUMI-DFEgrUv2.js → Y67KZUMI-BDyUNSJw.js} +5 -5
  73. package/dist/{ZTXFEM5L-CkrIQCN1.js → ZTXFEM5L-CjFLRObi.js} +3 -3
  74. package/dist/{downshift.esm-D_6pHXkq.js → downshift.esm-xtYanIDi.js} +1 -1
  75. package/dist/scss/breakpoints.scss +9 -0
  76. package/dist/scss/text-ellipsis.scss +5 -0
  77. package/dist/scss/texts.scss +108 -0
  78. package/dist/theme.css +1 -1
  79. package/dist/{tslib.es6-DpB4Y59c.js → tslib.es6-C80jYMbM.js} +1 -1
  80. package/dist/types/components/Breadcrumb/types.d.ts +5 -1
  81. package/dist/types/components/Drawer/AssetDrawer/types.d.ts +3 -0
  82. package/dist/types/components/Drawer/components/Backdrop.d.ts +1 -1
  83. package/dist/types/components/Drawer/index.d.ts +1 -1
  84. package/dist/types/components/Icon/icons.d.ts +4 -5
  85. package/dist/types/components/Icon/types.d.ts +2 -0
  86. package/dist/types/components/Pagination/types.d.ts +11 -0
  87. package/dist/types/components/Toast/components/Growl.d.ts +2 -0
  88. package/dist/types/components/Toast/index.d.ts +4 -1
  89. package/dist/types/components/Toast/types.d.ts +8 -9
  90. package/dist/types/components/Tooltip/types.d.ts +1 -1
  91. package/dist/types/theme/types.d.ts +22 -0
  92. package/dist/types/utils/index.d.ts +0 -1
  93. package/dist/{utils-DileZjMm.js → utils-BD597oo6.js} +1 -1
  94. package/dist/utils.js +2 -2
  95. package/package.json +2 -1
  96. package/dist/4I4MLMKD-BLxAidnq.js +0 -43
  97. package/dist/GVVKDT6A-bET6V7Py.js +0 -724
  98. package/dist/index.css +0 -0
  99. package/dist/types/components/Icon/Icon.d.ts +0 -2
  100. package/dist/types/utils/theme/index.d.ts +0 -0
  101. /package/dist/{index-CdiHdiVB.js → index-PAaZGbyz.js} +0 -0
  102. /package/dist/types/components/Icon/{Icon.test.d.ts → index.test.d.ts} +0 -0
@@ -1,724 +0,0 @@
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
- };