welcome-ui 8.2.1 → 8.4.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.
Files changed (111) hide show
  1. package/dist/{AXB53BZF-XKOjjeWO.mjs → AXB53BZF-BU4qmiUA.mjs} +3 -3
  2. package/dist/Accordion.mjs +4 -4
  3. package/dist/Alert.mjs +42 -36
  4. package/dist/AspectRatio.mjs +1 -1
  5. package/dist/Avatar.mjs +1 -1
  6. package/dist/BYC7LY2E-TZjhdRy3.mjs +619 -0
  7. package/dist/Badge.mjs +1 -1
  8. package/dist/Box.mjs +1 -1
  9. package/dist/Breadcrumb.mjs +2 -2
  10. package/dist/Button.mjs +3 -3
  11. package/dist/ButtonGroup.mjs +1 -1
  12. package/dist/Card.mjs +2 -2
  13. package/dist/Checkbox.mjs +2 -2
  14. package/dist/ClearButton.mjs +2 -2
  15. package/dist/CloseButton.mjs +2 -2
  16. package/dist/CustomPopper-DavRfSDP.mjs +7613 -0
  17. package/dist/DatePicker.mjs +2 -2
  18. package/dist/DateTimePicker.mjs +34541 -66
  19. package/dist/DateTimePickerCommon.mjs +1 -1
  20. package/dist/Drawer.mjs +58 -58
  21. package/dist/DropdownMenu.mjs +10 -10
  22. package/dist/Field.mjs +15 -15
  23. package/dist/FieldGroup.mjs +1 -1
  24. package/dist/FileDrop.mjs +3 -3
  25. package/dist/FileUpload.mjs +1 -1
  26. package/dist/Files.mjs +2 -2
  27. package/dist/Flex.mjs +1 -1
  28. package/dist/Grid.mjs +1 -1
  29. package/dist/Hint.mjs +1 -1
  30. package/dist/{ITI7HKP4-C89kOQb8.mjs → ITI7HKP4-DKM_MiJK.mjs} +4 -4
  31. package/dist/Icon.mjs +1 -1
  32. package/dist/Icons.mjs +12 -12
  33. package/dist/IconsFont.mjs +1 -1
  34. package/dist/InputText.mjs +10 -10
  35. package/dist/{JC64G2H7-afsomHuH.mjs → JC64G2H7-ifBZq_RU.mjs} +5 -5
  36. package/dist/{KUU7WJ55-CzsjuIMv.mjs → KUU7WJ55-ClLMNDee.mjs} +1 -1
  37. package/dist/{LVA2YJMS-C-kJ1lkr.mjs → LVA2YJMS-B8X1PCyC.mjs} +18 -18
  38. package/dist/Label.mjs +3 -3
  39. package/dist/Link.mjs +2 -2
  40. package/dist/Loader.mjs +1 -1
  41. package/dist/Logo.mjs +1 -1
  42. package/dist/{MTZPJQMC-TybFZCho.mjs → MTZPJQMC-DdjKPI9r.mjs} +2 -2
  43. package/dist/Modal.mjs +18 -18
  44. package/dist/{NLEBE274-oSxMftGy.mjs → NLEBE274-CnAMhwcR.mjs} +3 -3
  45. package/dist/{P2CTZE2T-DOT1mNnX.mjs → P2CTZE2T-1n7Xlf8m.mjs} +4 -4
  46. package/dist/{P4IRICAX-CWSZLTGz.mjs → P4IRICAX-Dg8AjwYu.mjs} +3 -3
  47. package/dist/Pagination.mjs +4 -4
  48. package/dist/PasswordInput.mjs +2 -2
  49. package/dist/Picker.mjs +3 -3
  50. package/dist/Popover.mjs +4 -4
  51. package/dist/{QYJ6MIDR-DJ-vUdAM.mjs → QYJ6MIDR-CpwIyzxN.mjs} +4 -4
  52. package/dist/Radio.mjs +2 -2
  53. package/dist/RadioGroup.mjs +2 -2
  54. package/dist/RadioTab.mjs +2 -2
  55. package/dist/{SYRFVSLH-B6m278Vb.mjs → SYRFVSLH-DPBHrVeS.mjs} +4 -4
  56. package/dist/Search.mjs +12 -12
  57. package/dist/Select.mjs +21 -21
  58. package/dist/Shape.mjs +1 -1
  59. package/dist/Slider.mjs +1 -1
  60. package/dist/Stack.mjs +1 -1
  61. package/dist/Swiper.mjs +1 -1
  62. package/dist/Table.mjs +1 -1
  63. package/dist/Tabs.mjs +8 -8
  64. package/dist/Tag.mjs +3 -3
  65. package/dist/Text.mjs +1 -1
  66. package/dist/Textarea.mjs +1 -1
  67. package/dist/TimePicker.mjs +2 -2
  68. package/dist/Toast.mjs +2 -2
  69. package/dist/Toggle.mjs +7 -6
  70. package/dist/Tooltip.mjs +11 -11
  71. package/dist/UniversalLink.mjs +1 -1
  72. package/dist/{VEVQD5MH-0w9Y7Ytc.mjs → VEVQD5MH-BSxDdMFG.mjs} +3 -3
  73. package/dist/{VGCJ63VH-C0UPBY-5.mjs → VGCJ63VH-C4H4_vtu.mjs} +4 -4
  74. package/dist/VariantIcon.mjs +2 -2
  75. package/dist/WelcomeLoader.mjs +1 -1
  76. package/dist/WuiProvider.mjs +1 -1
  77. package/dist/{X5NMLKT6-BJw3xE-K.mjs → X5NMLKT6-Ctro4-UX.mjs} +2 -2
  78. package/dist/{YV4JVR4I-DPC8mMuG.mjs → YV4JVR4I-BLeUul5N.mjs} +1 -1
  79. package/dist/{downshift.esm-B7Jil1wW.mjs → downshift.esm-DT64V-tc.mjs} +1 -3
  80. package/dist/floating-ui.dom.browser.min-Bza9K_UR.mjs +471 -0
  81. package/dist/{hide-focus-rings-root-CCXdysih.mjs → hide-focus-rings-root-Dcm160m2.mjs} +1 -1
  82. package/dist/{index-QaLwIvZS.mjs → index-6dgzrvpZ.mjs} +1 -1
  83. package/dist/{index-C_k-m0Rl.mjs → index-A1En5GST.mjs} +1 -1
  84. package/dist/{index-D8v_VJ9z.mjs → index-B-Yc2RN_.mjs} +1 -1
  85. package/dist/{index-DAZ1SYdj.mjs → index-B80lXHoK.mjs} +1 -1
  86. package/dist/{index-SQQQ4dEE.mjs → index-CuuMTEio.mjs} +1 -1
  87. package/dist/{index-DvzWKxKE.mjs → index-CwnxYrRd.mjs} +1 -1
  88. package/dist/{index-62h-enZF.mjs → index-D10ydFFH.mjs} +4 -4
  89. package/dist/{index-i_anpNhw.mjs → index-DKL-SItG.mjs} +1 -1
  90. package/dist/{index-CBBbX29m.mjs → index-Dct42YPA.mjs} +1 -1
  91. package/dist/{index-wl3X6EM1.mjs → index-DfD5GTDk.mjs} +1 -1
  92. package/dist/{index-CYmF7qCH.mjs → index-DtWZjMb5.mjs} +1 -1
  93. package/dist/{index-BaLGEKs7.mjs → index-KxL21VJb.mjs} +1 -1
  94. package/dist/{index-DpkNUfAS.mjs → index-eYXK9_x4.mjs} +1 -1
  95. package/dist/{jsx-runtime-B7I4PJ0H.mjs → jsx-runtime-Bqq1Hxg9.mjs} +16 -16
  96. package/dist/{radio-group-C0fUHvam.mjs → radio-group-C2Cv9SMd.mjs} +5 -5
  97. package/dist/theme.mjs +22 -22
  98. package/dist/types/components/Alert/Title.d.ts +3 -1
  99. package/dist/types/components/DatePicker/index.d.ts +1 -1
  100. package/dist/types/components/DateTimePicker/index.d.ts +4 -1
  101. package/dist/types/components/DateTimePicker/utils.d.ts +3 -0
  102. package/dist/types/components/DateTimePickerCommon/styles.d.ts +1 -1
  103. package/dist/types/components/TimePicker/index.d.ts +1 -1
  104. package/dist/types/theme/borders.d.ts +2 -2
  105. package/dist/types/theme/colors.d.ts +2 -9
  106. package/dist/types/theme/radii.d.ts +4 -4
  107. package/dist/types/theme/shadows.d.ts +1 -1
  108. package/dist/{wrap-children-CzmhoRzd.mjs → wrap-children-CRHMWYug.mjs} +3 -3
  109. package/package.json +5 -5
  110. package/dist/BYC7LY2E-CWSI38FM.mjs +0 -1078
  111. package/dist/CustomPopper-DezjKb9n.mjs +0 -7971
@@ -1,1078 +0,0 @@
1
- "use client";
2
- import { a as kt, b as Nt, d as Vt, c as dt } from "./JC64G2H7-afsomHuH.mjs";
3
- import { m as Wt, o as Bt, t as jt, c as pt, b as Ee, a as mt, d as zt } from "./YV4JVR4I-DPC8mMuG.mjs";
4
- import { z as Xt, A as le, C as q, B as j, G as Yt, c as je, _ as Ce, i as He, a5 as ht, b as me, E as Le, D as _e, d as G, g as _, f as ze, h as Xe, t as It, a6 as vt, u as ke, P as et, a7 as se, a4 as qt, e as gt, X as Ut, Y as Ne, a8 as Gt, l as Jt, m as Zt } from "./LVA2YJMS-C-kJ1lkr.mjs";
5
- import { u as wt, P as xt, a as Kt } from "./MTZPJQMC-TybFZCho.mjs";
6
- import { useRef as ce, useState as Ye, useEffect as U, useContext as Qt, createContext as en, useCallback as yt } from "react";
7
- import { j as Se } from "./jsx-runtime-B7I4PJ0H.mjs";
8
- function bt(e = {}) {
9
- var n = e, {
10
- popover: o
11
- } = n, t = Xt(n, [
12
- "popover"
13
- ]);
14
- const i = Wt(
15
- t.store,
16
- Bt(o, [
17
- "arrowElement",
18
- "anchorElement",
19
- "contentElement",
20
- "popoverElement",
21
- "disclosureElement"
22
- ])
23
- );
24
- jt(t, i);
25
- const r = i == null ? void 0 : i.getState(), l = kt(le(q({}, t), { store: i })), a = j(
26
- t.placement,
27
- r == null ? void 0 : r.placement,
28
- "bottom"
29
- ), c = le(q({}, l.getState()), {
30
- placement: a,
31
- currentPlacement: a,
32
- anchorElement: j(r == null ? void 0 : r.anchorElement, null),
33
- popoverElement: j(r == null ? void 0 : r.popoverElement, null),
34
- arrowElement: j(r == null ? void 0 : r.arrowElement, null),
35
- rendered: Symbol("rendered")
36
- }), s = pt(c, l, i);
37
- return le(q(q({}, l), s), {
38
- setAnchorElement: (f) => s.setState("anchorElement", f),
39
- setPopoverElement: (f) => s.setState("popoverElement", f),
40
- setArrowElement: (f) => s.setState("arrowElement", f),
41
- render: () => s.setState("rendered", Symbol("rendered"))
42
- });
43
- }
44
- function Pt(e, n, o) {
45
- return Yt(n, [o.popover]), Ee(e, o, "placement"), Nt(e, n, o);
46
- }
47
- function zn(e = {}) {
48
- const [n, o] = mt(bt, e);
49
- return Pt(n, o, e);
50
- }
51
- function de(e) {
52
- return e.split("-")[1];
53
- }
54
- function Ie(e) {
55
- return e === "y" ? "height" : "width";
56
- }
57
- function z(e) {
58
- return e.split("-")[0];
59
- }
60
- function ne(e) {
61
- return ["top", "bottom"].includes(z(e)) ? "x" : "y";
62
- }
63
- function tt(e, n, o) {
64
- let { reference: t, floating: i } = e;
65
- const r = t.x + t.width / 2 - i.width / 2, l = t.y + t.height / 2 - i.height / 2, a = ne(n), c = Ie(a), s = t[c] / 2 - i[c] / 2, f = a === "x";
66
- let u;
67
- switch (z(n)) {
68
- case "top":
69
- u = { x: r, y: t.y - i.height };
70
- break;
71
- case "bottom":
72
- u = { x: r, y: t.y + t.height };
73
- break;
74
- case "right":
75
- u = { x: t.x + t.width, y: l };
76
- break;
77
- case "left":
78
- u = { x: t.x - i.width, y: l };
79
- break;
80
- default:
81
- u = { x: t.x, y: t.y };
82
- }
83
- switch (de(n)) {
84
- case "start":
85
- u[a] -= s * (o && f ? -1 : 1);
86
- break;
87
- case "end":
88
- u[a] += s * (o && f ? -1 : 1);
89
- }
90
- return u;
91
- }
92
- const tn = async (e, n, o) => {
93
- const { placement: t = "bottom", strategy: i = "absolute", middleware: r = [], platform: l } = o, a = r.filter(Boolean), c = await (l.isRTL == null ? void 0 : l.isRTL(n));
94
- let s = await l.getElementRects({ reference: e, floating: n, strategy: i }), { x: f, y: u } = tt(s, t, c), m = t, p = {}, d = 0;
95
- for (let h = 0; h < a.length; h++) {
96
- const { name: v, fn: g } = a[h], { x: w, y: b, data: P, reset: x } = await g({ x: f, y: u, initialPlacement: t, placement: m, strategy: i, middlewareData: p, rects: s, platform: l, elements: { reference: e, floating: n } });
97
- f = w ?? f, u = b ?? u, p = { ...p, [v]: { ...p[v], ...P } }, x && d <= 50 && (d++, typeof x == "object" && (x.placement && (m = x.placement), x.rects && (s = x.rects === !0 ? await l.getElementRects({ reference: e, floating: n, strategy: i }) : x.rects), { x: f, y: u } = tt(s, m, c)), h = -1);
98
- }
99
- return { x: f, y: u, placement: m, strategy: i, middlewareData: p };
100
- };
101
- function J(e, n) {
102
- return typeof e == "function" ? e(n) : e;
103
- }
104
- function Et(e) {
105
- return typeof e != "number" ? function(n) {
106
- return { top: 0, right: 0, bottom: 0, left: 0, ...n };
107
- }(e) : { top: e, right: e, bottom: e, left: e };
108
- }
109
- function Re(e) {
110
- return { ...e, top: e.y, left: e.x, right: e.x + e.width, bottom: e.y + e.height };
111
- }
112
- async function qe(e, n) {
113
- var o;
114
- n === void 0 && (n = {});
115
- const { x: t, y: i, platform: r, rects: l, elements: a, strategy: c } = e, { boundary: s = "clippingAncestors", rootBoundary: f = "viewport", elementContext: u = "floating", altBoundary: m = !1, padding: p = 0 } = J(n, e), d = Et(p), h = a[m ? u === "floating" ? "reference" : "floating" : u], v = Re(await r.getClippingRect({ element: (o = await (r.isElement == null ? void 0 : r.isElement(h))) == null || o ? h : h.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(a.floating)), boundary: s, rootBoundary: f, strategy: c })), g = u === "floating" ? { ...l.floating, x: t, y: i } : l.reference, w = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a.floating)), b = await (r.isElement == null ? void 0 : r.isElement(w)) && await (r.getScale == null ? void 0 : r.getScale(w)) || { x: 1, y: 1 }, P = Re(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({ rect: g, offsetParent: w, strategy: c }) : g);
116
- return { top: (v.top - P.top + d.top) / b.y, bottom: (P.bottom - v.bottom + d.bottom) / b.y, left: (v.left - P.left + d.left) / b.x, right: (P.right - v.right + d.right) / b.x };
117
- }
118
- const he = Math.min, Q = Math.max;
119
- function Ve(e, n, o) {
120
- return Q(e, he(n, o));
121
- }
122
- const nn = (e) => ({ name: "arrow", options: e, async fn(n) {
123
- const { x: o, y: t, placement: i, rects: r, platform: l, elements: a } = n, { element: c, padding: s = 0 } = J(e, n) || {};
124
- if (c == null) return {};
125
- const f = Et(s), u = { x: o, y: t }, m = ne(i), p = Ie(m), d = await l.getDimensions(c), h = m === "y", v = h ? "top" : "left", g = h ? "bottom" : "right", w = h ? "clientHeight" : "clientWidth", b = r.reference[p] + r.reference[m] - u[m] - r.floating[p], P = u[m] - r.reference[m], x = await (l.getOffsetParent == null ? void 0 : l.getOffsetParent(c));
126
- let E = x ? x[w] : 0;
127
- E && await (l.isElement == null ? void 0 : l.isElement(x)) || (E = a.floating[w] || r.floating[p]);
128
- const C = b / 2 - P / 2, H = E / 2 - d[p] / 2 - 1, D = he(f[v], H), R = he(f[g], H), A = D, $ = E - d[p] - R, y = E / 2 - d[p] / 2 + C, O = Ve(A, y, $), S = de(i) != null && y != O && r.reference[p] / 2 - (y < A ? D : R) - d[p] / 2 < 0 ? y < A ? A - y : $ - y : 0;
129
- return { [m]: u[m] - S, data: { [m]: O, centerOffset: y - O + S } };
130
- } }), on = ["top", "right", "bottom", "left"];
131
- on.reduce((e, n) => e.concat(n, n + "-start", n + "-end"), []);
132
- const rn = { left: "right", right: "left", bottom: "top", top: "bottom" };
133
- function Ae(e) {
134
- return e.replace(/left|right|bottom|top/g, (n) => rn[n]);
135
- }
136
- function sn(e, n, o) {
137
- o === void 0 && (o = !1);
138
- const t = de(e), i = ne(e), r = Ie(i);
139
- let l = i === "x" ? t === (o ? "end" : "start") ? "right" : "left" : t === "start" ? "bottom" : "top";
140
- return n.reference[r] > n.floating[r] && (l = Ae(l)), { main: l, cross: Ae(l) };
141
- }
142
- const ln = { start: "end", end: "start" };
143
- function De(e) {
144
- return e.replace(/start|end/g, (n) => ln[n]);
145
- }
146
- const cn = function(e) {
147
- return e === void 0 && (e = {}), { name: "flip", options: e, async fn(n) {
148
- var o;
149
- const { placement: t, middlewareData: i, rects: r, initialPlacement: l, platform: a, elements: c } = n, { mainAxis: s = !0, crossAxis: f = !0, fallbackPlacements: u, fallbackStrategy: m = "bestFit", fallbackAxisSideDirection: p = "none", flipAlignment: d = !0, ...h } = J(e, n), v = z(t), g = z(l) === l, w = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), b = u || (g || !d ? [Ae(l)] : function(A) {
150
- const $ = Ae(A);
151
- return [De(A), $, De($)];
152
- }(l));
153
- u || p === "none" || b.push(...function(A, $, y, O) {
154
- const S = de(A);
155
- let T = function(M, L, I) {
156
- const V = ["left", "right"], W = ["right", "left"], K = ["top", "bottom"], oe = ["bottom", "top"];
157
- switch (M) {
158
- case "top":
159
- case "bottom":
160
- return I ? L ? W : V : L ? V : W;
161
- case "left":
162
- case "right":
163
- return L ? K : oe;
164
- default:
165
- return [];
166
- }
167
- }(z(A), y === "start", O);
168
- return S && (T = T.map((M) => M + "-" + S), $ && (T = T.concat(T.map(De)))), T;
169
- }(l, d, p, w));
170
- const P = [l, ...b], x = await qe(n, h), E = [];
171
- let C = ((o = i.flip) == null ? void 0 : o.overflows) || [];
172
- if (s && E.push(x[v]), f) {
173
- const { main: A, cross: $ } = sn(t, r, w);
174
- E.push(x[A], x[$]);
175
- }
176
- if (C = [...C, { placement: t, overflows: E }], !E.every((A) => A <= 0)) {
177
- var H, D;
178
- const A = (((H = i.flip) == null ? void 0 : H.index) || 0) + 1, $ = P[A];
179
- if ($) return { data: { index: A, overflows: C }, reset: { placement: $ } };
180
- let y = (D = C.filter((O) => O.overflows[0] <= 0).sort((O, S) => O.overflows[1] - S.overflows[1])[0]) == null ? void 0 : D.placement;
181
- if (!y) switch (m) {
182
- case "bestFit": {
183
- var R;
184
- const O = (R = C.map((S) => [S.placement, S.overflows.filter((T) => T > 0).reduce((T, M) => T + M, 0)]).sort((S, T) => S[1] - T[1])[0]) == null ? void 0 : R[0];
185
- O && (y = O);
186
- break;
187
- }
188
- case "initialPlacement":
189
- y = l;
190
- }
191
- if (t !== y) return { reset: { placement: y } };
192
- }
193
- return {};
194
- } };
195
- }, an = function(e) {
196
- return e === void 0 && (e = 0), { name: "offset", options: e, async fn(n) {
197
- const { x: o, y: t } = n, i = await async function(r, l) {
198
- const { placement: a, platform: c, elements: s } = r, f = await (c.isRTL == null ? void 0 : c.isRTL(s.floating)), u = z(a), m = de(a), p = ne(a) === "x", d = ["left", "top"].includes(u) ? -1 : 1, h = f && p ? -1 : 1, v = J(l, r);
199
- let { mainAxis: g, crossAxis: w, alignmentAxis: b } = typeof v == "number" ? { mainAxis: v, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...v };
200
- return m && typeof b == "number" && (w = m === "end" ? -1 * b : b), p ? { x: w * h, y: g * d } : { x: g * d, y: w * h };
201
- }(n, e);
202
- return { x: o + i.x, y: t + i.y, data: i };
203
- } };
204
- };
205
- function St(e) {
206
- return e === "x" ? "y" : "x";
207
- }
208
- const un = function(e) {
209
- return e === void 0 && (e = {}), { name: "shift", options: e, async fn(n) {
210
- const { x: o, y: t, placement: i } = n, { mainAxis: r = !0, crossAxis: l = !1, limiter: a = { fn: (v) => {
211
- let { x: g, y: w } = v;
212
- return { x: g, y: w };
213
- } }, ...c } = J(e, n), s = { x: o, y: t }, f = await qe(n, c), u = ne(z(i)), m = St(u);
214
- let p = s[u], d = s[m];
215
- if (r) {
216
- const v = u === "y" ? "bottom" : "right";
217
- p = Ve(p + f[u === "y" ? "top" : "left"], p, p - f[v]);
218
- }
219
- if (l) {
220
- const v = m === "y" ? "bottom" : "right";
221
- d = Ve(d + f[m === "y" ? "top" : "left"], d, d - f[v]);
222
- }
223
- const h = a.fn({ ...n, [u]: p, [m]: d });
224
- return { ...h, data: { x: h.x - o, y: h.y - t } };
225
- } };
226
- }, fn = function(e) {
227
- return e === void 0 && (e = {}), { options: e, fn(n) {
228
- const { x: o, y: t, placement: i, rects: r, middlewareData: l } = n, { offset: a = 0, mainAxis: c = !0, crossAxis: s = !0 } = J(e, n), f = { x: o, y: t }, u = ne(i), m = St(u);
229
- let p = f[u], d = f[m];
230
- const h = J(a, n), v = typeof h == "number" ? { mainAxis: h, crossAxis: 0 } : { mainAxis: 0, crossAxis: 0, ...h };
231
- if (c) {
232
- const b = u === "y" ? "height" : "width", P = r.reference[u] - r.floating[b] + v.mainAxis, x = r.reference[u] + r.reference[b] - v.mainAxis;
233
- p < P ? p = P : p > x && (p = x);
234
- }
235
- if (s) {
236
- var g, w;
237
- const b = u === "y" ? "width" : "height", P = ["top", "left"].includes(z(i)), x = r.reference[m] - r.floating[b] + (P && ((g = l.offset) == null ? void 0 : g[m]) || 0) + (P ? 0 : v.crossAxis), E = r.reference[m] + r.reference[b] + (P ? 0 : ((w = l.offset) == null ? void 0 : w[m]) || 0) - (P ? v.crossAxis : 0);
238
- d < x ? d = x : d > E && (d = E);
239
- }
240
- return { [u]: p, [m]: d };
241
- } };
242
- }, dn = function(e) {
243
- return e === void 0 && (e = {}), { name: "size", options: e, async fn(n) {
244
- const { placement: o, rects: t, platform: i, elements: r } = n, { apply: l = () => {
245
- }, ...a } = J(e, n), c = await qe(n, a), s = z(o), f = de(o), u = ne(o) === "x", { width: m, height: p } = t.floating;
246
- let d, h;
247
- s === "top" || s === "bottom" ? (d = s, h = f === (await (i.isRTL == null ? void 0 : i.isRTL(r.floating)) ? "start" : "end") ? "left" : "right") : (h = s, d = f === "end" ? "top" : "bottom");
248
- const v = p - c[d], g = m - c[h], w = !n.middlewareData.shift;
249
- let b = v, P = g;
250
- if (u) {
251
- const E = m - c.left - c.right;
252
- P = f || w ? he(g, E) : E;
253
- } else {
254
- const E = p - c.top - c.bottom;
255
- b = f || w ? he(v, E) : E;
256
- }
257
- if (w && !f) {
258
- const E = Q(c.left, 0), C = Q(c.right, 0), H = Q(c.top, 0), D = Q(c.bottom, 0);
259
- u ? P = m - 2 * (E !== 0 || C !== 0 ? E + C : Q(c.left, c.right)) : b = p - 2 * (H !== 0 || D !== 0 ? H + D : Q(c.top, c.bottom));
260
- }
261
- await l({ ...n, availableWidth: P, availableHeight: b });
262
- const x = await i.getDimensions(r.floating);
263
- return m !== x.width || p !== x.height ? { reset: { rects: !0 } } : {};
264
- } };
265
- };
266
- function F(e) {
267
- var n;
268
- return ((n = e.ownerDocument) == null ? void 0 : n.defaultView) || window;
269
- }
270
- function k(e) {
271
- return F(e).getComputedStyle(e);
272
- }
273
- function Rt(e) {
274
- return e instanceof F(e).Node;
275
- }
276
- function Z(e) {
277
- return Rt(e) ? (e.nodeName || "").toLowerCase() : "#document";
278
- }
279
- function N(e) {
280
- return e instanceof F(e).HTMLElement;
281
- }
282
- function X(e) {
283
- return e instanceof F(e).Element;
284
- }
285
- function nt(e) {
286
- return typeof ShadowRoot < "u" && (e instanceof F(e).ShadowRoot || e instanceof ShadowRoot);
287
- }
288
- function ve(e) {
289
- const { overflow: n, overflowX: o, overflowY: t, display: i } = k(e);
290
- return /auto|scroll|overlay|hidden|clip/.test(n + t + o) && !["inline", "contents"].includes(i);
291
- }
292
- function pn(e) {
293
- return ["table", "td", "th"].includes(Z(e));
294
- }
295
- function We(e) {
296
- const n = Ue(), o = k(e);
297
- return o.transform !== "none" || o.perspective !== "none" || !n && !!o.backdropFilter && o.backdropFilter !== "none" || !n && !!o.filter && o.filter !== "none" || ["transform", "perspective", "filter"].some((t) => (o.willChange || "").includes(t)) || ["paint", "layout", "strict", "content"].some((t) => (o.contain || "").includes(t));
298
- }
299
- function Ue() {
300
- return !(typeof CSS > "u" || !CSS.supports) && CSS.supports("-webkit-backdrop-filter", "none");
301
- }
302
- function $e(e) {
303
- return ["html", "body", "#document"].includes(Z(e));
304
- }
305
- const Be = Math.min, ae = Math.max, Oe = Math.round, Pe = Math.floor, ee = (e) => ({ x: e, y: e });
306
- function At(e) {
307
- const n = k(e);
308
- let o = parseFloat(n.width) || 0, t = parseFloat(n.height) || 0;
309
- const i = N(e), r = i ? e.offsetWidth : o, l = i ? e.offsetHeight : t, a = Oe(o) !== r || Oe(t) !== l;
310
- return a && (o = r, t = l), { width: o, height: t, $: a };
311
- }
312
- function Ge(e) {
313
- return X(e) ? e : e.contextElement;
314
- }
315
- function ue(e) {
316
- const n = Ge(e);
317
- if (!N(n)) return ee(1);
318
- const o = n.getBoundingClientRect(), { width: t, height: i, $: r } = At(n);
319
- let l = (r ? Oe(o.width) : o.width) / t, a = (r ? Oe(o.height) : o.height) / i;
320
- return l && Number.isFinite(l) || (l = 1), a && Number.isFinite(a) || (a = 1), { x: l, y: a };
321
- }
322
- const ot = ee(0);
323
- function Ot(e, n, o) {
324
- var t, i;
325
- if (n === void 0 && (n = !0), !Ue()) return ot;
326
- const r = e ? F(e) : window;
327
- return !o || n && o !== r ? ot : { x: ((t = r.visualViewport) == null ? void 0 : t.offsetLeft) || 0, y: ((i = r.visualViewport) == null ? void 0 : i.offsetTop) || 0 };
328
- }
329
- function te(e, n, o, t) {
330
- n === void 0 && (n = !1), o === void 0 && (o = !1);
331
- const i = e.getBoundingClientRect(), r = Ge(e);
332
- let l = ee(1);
333
- n && (t ? X(t) && (l = ue(t)) : l = ue(e));
334
- const a = Ot(r, o, t);
335
- let c = (i.left + a.x) / l.x, s = (i.top + a.y) / l.y, f = i.width / l.x, u = i.height / l.y;
336
- if (r) {
337
- const m = F(r), p = t && X(t) ? F(t) : t;
338
- let d = m.frameElement;
339
- for (; d && t && p !== m; ) {
340
- const h = ue(d), v = d.getBoundingClientRect(), g = getComputedStyle(d), w = v.left + (d.clientLeft + parseFloat(g.paddingLeft)) * h.x, b = v.top + (d.clientTop + parseFloat(g.paddingTop)) * h.y;
341
- c *= h.x, s *= h.y, f *= h.x, u *= h.y, c += w, s += b, d = F(d).frameElement;
342
- }
343
- }
344
- return Re({ width: f, height: u, x: c, y: s });
345
- }
346
- function Y(e) {
347
- return ((Rt(e) ? e.ownerDocument : e.document) || window.document).documentElement;
348
- }
349
- function Me(e) {
350
- return X(e) ? { scrollLeft: e.scrollLeft, scrollTop: e.scrollTop } : { scrollLeft: e.pageXOffset, scrollTop: e.pageYOffset };
351
- }
352
- function Tt(e) {
353
- return te(Y(e)).left + Me(e).scrollLeft;
354
- }
355
- function fe(e) {
356
- if (Z(e) === "html") return e;
357
- const n = e.assignedSlot || e.parentNode || nt(e) && e.host || Y(e);
358
- return nt(n) ? n.host : n;
359
- }
360
- function Ct(e) {
361
- const n = fe(e);
362
- return $e(n) ? e.ownerDocument ? e.ownerDocument.body : e.body : N(n) && ve(n) ? n : Ct(n);
363
- }
364
- function Te(e, n) {
365
- var o;
366
- n === void 0 && (n = []);
367
- const t = Ct(e), i = t === ((o = e.ownerDocument) == null ? void 0 : o.body), r = F(t);
368
- return i ? n.concat(r, r.visualViewport || [], ve(t) ? t : []) : n.concat(t, Te(t));
369
- }
370
- function rt(e, n, o) {
371
- let t;
372
- if (n === "viewport") t = function(i, r) {
373
- const l = F(i), a = Y(i), c = l.visualViewport;
374
- let s = a.clientWidth, f = a.clientHeight, u = 0, m = 0;
375
- if (c) {
376
- s = c.width, f = c.height;
377
- const p = Ue();
378
- (!p || p && r === "fixed") && (u = c.offsetLeft, m = c.offsetTop);
379
- }
380
- return { width: s, height: f, x: u, y: m };
381
- }(e, o);
382
- else if (n === "document") t = function(i) {
383
- const r = Y(i), l = Me(i), a = i.ownerDocument.body, c = ae(r.scrollWidth, r.clientWidth, a.scrollWidth, a.clientWidth), s = ae(r.scrollHeight, r.clientHeight, a.scrollHeight, a.clientHeight);
384
- let f = -l.scrollLeft + Tt(i);
385
- const u = -l.scrollTop;
386
- return k(a).direction === "rtl" && (f += ae(r.clientWidth, a.clientWidth) - c), { width: c, height: s, x: f, y: u };
387
- }(Y(e));
388
- else if (X(n)) t = function(i, r) {
389
- const l = te(i, !0, r === "fixed"), a = l.top + i.clientTop, c = l.left + i.clientLeft, s = N(i) ? ue(i) : ee(1);
390
- return { width: i.clientWidth * s.x, height: i.clientHeight * s.y, x: c * s.x, y: a * s.y };
391
- }(n, o);
392
- else {
393
- const i = Ot(e);
394
- t = { ...n, x: n.x - i.x, y: n.y - i.y };
395
- }
396
- return Re(t);
397
- }
398
- function Ht(e, n) {
399
- const o = fe(e);
400
- return !(o === n || !X(o) || $e(o)) && (k(o).position === "fixed" || Ht(o, n));
401
- }
402
- function it(e, n) {
403
- return N(e) && k(e).position !== "fixed" ? n ? n(e) : e.offsetParent : null;
404
- }
405
- function st(e, n) {
406
- const o = F(e);
407
- if (!N(e)) return o;
408
- let t = it(e, n);
409
- for (; t && pn(t) && k(t).position === "static"; ) t = it(t, n);
410
- return t && (Z(t) === "html" || Z(t) === "body" && k(t).position === "static" && !We(t)) ? o : t || function(i) {
411
- let r = fe(i);
412
- for (; N(r) && !$e(r); ) {
413
- if (We(r)) return r;
414
- r = fe(r);
415
- }
416
- return null;
417
- }(e) || o;
418
- }
419
- function mn(e, n, o) {
420
- const t = N(n), i = Y(n), r = o === "fixed", l = te(e, !0, r, n);
421
- let a = { scrollLeft: 0, scrollTop: 0 };
422
- const c = ee(0);
423
- if (t || !t && !r) if ((Z(n) !== "body" || ve(i)) && (a = Me(n)), N(n)) {
424
- const s = te(n, !0, r, n);
425
- c.x = s.x + n.clientLeft, c.y = s.y + n.clientTop;
426
- } else i && (c.x = Tt(i));
427
- return { x: l.left + a.scrollLeft - c.x, y: l.top + a.scrollTop - c.y, width: l.width, height: l.height };
428
- }
429
- const hn = { getClippingRect: function(e) {
430
- let { element: n, boundary: o, rootBoundary: t, strategy: i } = e;
431
- const r = o === "clippingAncestors" ? function(s, f) {
432
- const u = f.get(s);
433
- if (u) return u;
434
- let m = Te(s).filter((v) => X(v) && Z(v) !== "body"), p = null;
435
- const d = k(s).position === "fixed";
436
- let h = d ? fe(s) : s;
437
- for (; X(h) && !$e(h); ) {
438
- const v = k(h), g = We(h);
439
- g || v.position !== "fixed" || (p = null), (d ? !g && !p : !g && v.position === "static" && p && ["absolute", "fixed"].includes(p.position) || ve(h) && !g && Ht(s, h)) ? m = m.filter((w) => w !== h) : p = v, h = fe(h);
440
- }
441
- return f.set(s, m), m;
442
- }(n, this._c) : [].concat(o), l = [...r, t], a = l[0], c = l.reduce((s, f) => {
443
- const u = rt(n, f, i);
444
- return s.top = ae(u.top, s.top), s.right = Be(u.right, s.right), s.bottom = Be(u.bottom, s.bottom), s.left = ae(u.left, s.left), s;
445
- }, rt(n, a, i));
446
- return { width: c.right - c.left, height: c.bottom - c.top, x: c.left, y: c.top };
447
- }, convertOffsetParentRelativeRectToViewportRelativeRect: function(e) {
448
- let { rect: n, offsetParent: o, strategy: t } = e;
449
- const i = N(o), r = Y(o);
450
- if (o === r) return n;
451
- let l = { scrollLeft: 0, scrollTop: 0 }, a = ee(1);
452
- const c = ee(0);
453
- if ((i || !i && t !== "fixed") && ((Z(o) !== "body" || ve(r)) && (l = Me(o)), N(o))) {
454
- const s = te(o);
455
- a = ue(o), c.x = s.x + o.clientLeft, c.y = s.y + o.clientTop;
456
- }
457
- return { width: n.width * a.x, height: n.height * a.y, x: n.x * a.x - l.scrollLeft * a.x + c.x, y: n.y * a.y - l.scrollTop * a.y + c.y };
458
- }, isElement: X, getDimensions: function(e) {
459
- return At(e);
460
- }, getOffsetParent: st, getDocumentElement: Y, getScale: ue, async getElementRects(e) {
461
- let { reference: n, floating: o, strategy: t } = e;
462
- const i = this.getOffsetParent || st, r = this.getDimensions;
463
- return { reference: mn(n, await i(o), t), floating: { x: 0, y: 0, ...await r(o) } };
464
- }, getClientRects: (e) => Array.from(e.getClientRects()), isRTL: (e) => k(e).direction === "rtl" };
465
- function vn(e, n, o, t) {
466
- t === void 0 && (t = {});
467
- const { ancestorScroll: i = !0, ancestorResize: r = !0, elementResize: l = !0, layoutShift: a = typeof IntersectionObserver == "function", animationFrame: c = !1 } = t, s = Ge(e), f = i || r ? [...s ? Te(s) : [], ...Te(n)] : [];
468
- f.forEach((h) => {
469
- i && h.addEventListener("scroll", o, { passive: !0 }), r && h.addEventListener("resize", o);
470
- });
471
- const u = s && a ? function(h, v) {
472
- let g, w = null;
473
- const b = Y(h);
474
- function P() {
475
- clearTimeout(g), w && w.disconnect(), w = null;
476
- }
477
- return function x(E, C) {
478
- E === void 0 && (E = !1), C === void 0 && (C = 1), P();
479
- const { left: H, top: D, width: R, height: A } = h.getBoundingClientRect();
480
- if (E || v(), !R || !A) return;
481
- const $ = Pe(D), y = Pe(b.clientWidth - (H + R)), O = Pe(b.clientHeight - (D + A)), S = Pe(H);
482
- let T = !0;
483
- w = new IntersectionObserver((M) => {
484
- const L = M[0].intersectionRatio;
485
- if (L !== C) {
486
- if (!T) return x();
487
- L ? x(!1, L) : g = setTimeout(() => {
488
- x(!1, 1e-7);
489
- }, 100);
490
- }
491
- T = !1;
492
- }, { rootMargin: -$ + "px " + -y + "px " + -O + "px " + -S + "px", threshold: ae(0, Be(1, C)) || 1 }), w.observe(h);
493
- }(!0), P;
494
- }(s, o) : null;
495
- let m, p = null;
496
- l && (p = new ResizeObserver(o), s && !c && p.observe(s), p.observe(n));
497
- let d = c ? te(e) : null;
498
- return c && function h() {
499
- const v = te(e);
500
- !d || v.x === d.x && v.y === d.y && v.width === d.width && v.height === d.height || o(), d = v, m = requestAnimationFrame(h);
501
- }(), o(), () => {
502
- f.forEach((h) => {
503
- i && h.removeEventListener("scroll", o), r && h.removeEventListener("resize", o);
504
- }), u && u(), p && p.disconnect(), p = null, c && cancelAnimationFrame(m);
505
- };
506
- }
507
- const gn = (e, n, o) => {
508
- const t = /* @__PURE__ */ new Map(), i = { platform: hn, ...o }, r = { ...i.platform, _c: t };
509
- return tn(e, n, { ...i, platform: r });
510
- };
511
- var wn = "div";
512
- function lt(e = 0, n = 0, o = 0, t = 0) {
513
- if (typeof DOMRect == "function")
514
- return new DOMRect(e, n, o, t);
515
- const i = {
516
- x: e,
517
- y: n,
518
- width: o,
519
- height: t,
520
- top: n,
521
- right: e + o,
522
- bottom: n + t,
523
- left: e
524
- };
525
- return G(_({}, i), { toJSON: () => i });
526
- }
527
- function xn(e) {
528
- if (!e) return lt();
529
- const { x: n, y: o, width: t, height: i } = e;
530
- return lt(n, o, t, i);
531
- }
532
- function yn(e, n) {
533
- return {
534
- contextElement: e || void 0,
535
- getBoundingClientRect: () => {
536
- const t = e, i = n == null ? void 0 : n(t);
537
- return i || !t ? xn(i) : t.getBoundingClientRect();
538
- }
539
- };
540
- }
541
- function bn(e) {
542
- return /^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e);
543
- }
544
- function ct(e) {
545
- const n = window.devicePixelRatio || 1;
546
- return Math.round(e * n) / n;
547
- }
548
- function Pn(e, n) {
549
- return an(({ placement: o }) => {
550
- var t;
551
- const i = ((e == null ? void 0 : e.clientHeight) || 0) / 2, r = typeof n.gutter == "number" ? n.gutter + i : (t = n.gutter) != null ? t : i;
552
- return {
553
- crossAxis: !!o.split("-")[1] ? void 0 : n.shift,
554
- mainAxis: r,
555
- alignmentAxis: n.shift
556
- };
557
- });
558
- }
559
- function En(e) {
560
- if (e.flip === !1) return;
561
- const n = typeof e.flip == "string" ? e.flip.split(" ") : void 0;
562
- return He(
563
- !n || n.every(bn),
564
- process.env.NODE_ENV !== "production" && "`flip` expects a spaced-delimited list of placements"
565
- ), cn({
566
- padding: e.overflowPadding,
567
- fallbackPlacements: n
568
- });
569
- }
570
- function Sn(e) {
571
- if (!(!e.slide && !e.overlap))
572
- return un({
573
- mainAxis: e.slide,
574
- crossAxis: e.overlap,
575
- padding: e.overflowPadding,
576
- limiter: fn()
577
- });
578
- }
579
- function Rn(e) {
580
- return dn({
581
- padding: e.overflowPadding,
582
- apply({ elements: n, availableWidth: o, availableHeight: t, rects: i }) {
583
- const r = n.floating, l = Math.round(i.reference.width);
584
- o = Math.floor(o), t = Math.floor(t), r.style.setProperty(
585
- "--popover-anchor-width",
586
- `${l}px`
587
- ), r.style.setProperty(
588
- "--popover-available-width",
589
- `${o}px`
590
- ), r.style.setProperty(
591
- "--popover-available-height",
592
- `${t}px`
593
- ), e.sameWidth && (r.style.width = `${l}px`), e.fitViewport && (r.style.maxWidth = `${o}px`, r.style.maxHeight = `${t}px`);
594
- }
595
- });
596
- }
597
- function An(e, n) {
598
- if (e)
599
- return nn({
600
- element: e,
601
- padding: n.arrowPadding
602
- });
603
- }
604
- var $t = je(
605
- function(n) {
606
- var o = n, {
607
- store: t,
608
- modal: i = !1,
609
- portal: r = !!i,
610
- preserveTabOrder: l = !0,
611
- autoFocusOnShow: a = !0,
612
- wrapperProps: c,
613
- fixed: s = !1,
614
- flip: f = !0,
615
- shift: u = 0,
616
- slide: m = !0,
617
- overlap: p = !1,
618
- sameWidth: d = !1,
619
- fitViewport: h = !1,
620
- gutter: v,
621
- arrowPadding: g = 4,
622
- overflowPadding: w = 8,
623
- getAnchorRect: b,
624
- updatePosition: P
625
- } = o, x = Ce(o, [
626
- "store",
627
- "modal",
628
- "portal",
629
- "preserveTabOrder",
630
- "autoFocusOnShow",
631
- "wrapperProps",
632
- "fixed",
633
- "flip",
634
- "shift",
635
- "slide",
636
- "overlap",
637
- "sameWidth",
638
- "fitViewport",
639
- "gutter",
640
- "arrowPadding",
641
- "overflowPadding",
642
- "getAnchorRect",
643
- "updatePosition"
644
- ]);
645
- const E = wt();
646
- t = t || E, He(
647
- t,
648
- process.env.NODE_ENV !== "production" && "Popover must receive a `store` prop or be wrapped in a PopoverProvider component."
649
- );
650
- const C = t.useState("arrowElement"), H = t.useState("anchorElement"), D = t.useState("disclosureElement"), R = t.useState("popoverElement"), A = t.useState("contentElement"), $ = t.useState("placement"), y = t.useState("mounted"), O = t.useState("rendered"), S = ce(null), [T, M] = Ye(!1), { portalRef: L, domReady: I } = ht(r, x.portalRef), V = me(b), W = me(P), K = !!P;
651
- Le(() => {
652
- if (!(R != null && R.isConnected)) return;
653
- R.style.setProperty(
654
- "--popover-overflow-padding",
655
- `${w}px`
656
- );
657
- const B = yn(H, V), pe = async () => {
658
- if (!y) return;
659
- C || (S.current = S.current || document.createElement("div"));
660
- const re = C || S.current, Ft = [
661
- Pn(re, { gutter: v, shift: u }),
662
- En({ flip: f, overflowPadding: w }),
663
- Sn({ slide: m, overlap: p, overflowPadding: w }),
664
- An(re, { arrowPadding: g }),
665
- Rn({
666
- sameWidth: d,
667
- fitViewport: h,
668
- overflowPadding: w
669
- })
670
- ], ie = await gn(B, R, {
671
- placement: $,
672
- strategy: s ? "fixed" : "absolute",
673
- middleware: Ft
674
- });
675
- t == null || t.setState("currentPlacement", ie.placement), M(!0);
676
- const Lt = ct(ie.x), _t = ct(ie.y);
677
- if (Object.assign(R.style, {
678
- top: "0",
679
- left: "0",
680
- transform: `translate3d(${Lt}px,${_t}px,0)`
681
- }), re && ie.middlewareData.arrow) {
682
- const { x: we, y: xe } = ie.middlewareData.arrow, Ze = ie.placement.split("-")[0], ye = re.clientWidth / 2, be = re.clientHeight / 2, Ke = we != null ? we + ye : -ye, Qe = xe != null ? xe + be : -be;
683
- R.style.setProperty(
684
- "--popover-transform-origin",
685
- {
686
- top: `${Ke}px calc(100% + ${be}px)`,
687
- bottom: `${Ke}px ${-be}px`,
688
- left: `calc(100% + ${ye}px) ${Qe}px`,
689
- right: `${-ye}px ${Qe}px`
690
- }[Ze]
691
- ), Object.assign(re.style, {
692
- left: we != null ? `${we}px` : "",
693
- top: xe != null ? `${xe}px` : "",
694
- [Ze]: "100%"
695
- });
696
- }
697
- }, Dt = vn(B, R, async () => {
698
- K ? (await W({ updatePosition: pe }), M(!0)) : await pe();
699
- }, {
700
- // JSDOM doesn't support ResizeObserver
701
- elementResize: typeof ResizeObserver == "function"
702
- });
703
- return () => {
704
- M(!1), Dt();
705
- };
706
- }, [
707
- t,
708
- O,
709
- R,
710
- C,
711
- H,
712
- R,
713
- $,
714
- y,
715
- I,
716
- s,
717
- f,
718
- u,
719
- m,
720
- p,
721
- d,
722
- h,
723
- v,
724
- g,
725
- w,
726
- V,
727
- K,
728
- W
729
- ]), Le(() => {
730
- if (!y || !I || !(R != null && R.isConnected) || !(A != null && A.isConnected)) return;
731
- const B = () => {
732
- R.style.zIndex = getComputedStyle(A).zIndex;
733
- };
734
- B();
735
- let pe = requestAnimationFrame(() => {
736
- pe = requestAnimationFrame(B);
737
- });
738
- return () => cancelAnimationFrame(pe);
739
- }, [y, I, R, A]);
740
- const oe = s ? "fixed" : "absolute";
741
- return x = _e(
742
- x,
743
- (B) => /* @__PURE__ */ Se.jsx(
744
- "div",
745
- G(_({}, c), {
746
- style: _({
747
- // https://floating-ui.com/docs/computeposition#initial-layout
748
- position: oe,
749
- top: 0,
750
- left: 0,
751
- width: "max-content"
752
- }, c == null ? void 0 : c.style),
753
- ref: t == null ? void 0 : t.setPopoverElement,
754
- children: B
755
- })
756
- ),
757
- [t, oe, c]
758
- ), x = _e(
759
- x,
760
- (B) => /* @__PURE__ */ Se.jsx(xt, { value: t, children: B }),
761
- [t]
762
- ), x = G(_({
763
- // data-placing is not part of the public API. We're setting this here so
764
- // we can wait for the popover to be positioned before other components
765
- // move focus into it. For example, this attribute is observed by the
766
- // Combobox component with the autoSelect behavior.
767
- "data-placing": !T || void 0
768
- }, x), {
769
- style: _({
770
- position: "relative"
771
- }, x.style)
772
- }), x = Vt(G(_({
773
- store: t,
774
- modal: i,
775
- portal: r,
776
- preserveTabOrder: l,
777
- preserveTabOrderAnchor: D || H,
778
- autoFocusOnShow: T && a
779
- }, x), {
780
- portalRef: L
781
- })), x;
782
- }
783
- ), Xn = dt(
784
- ze(function(n) {
785
- const o = $t(n);
786
- return Xe(wn, o);
787
- }),
788
- wt
789
- ), ge = It(
790
- [Kt],
791
- [xt]
792
- );
793
- ge.useContext;
794
- ge.useScopedContext;
795
- var Je = ge.useProviderContext, Yn = ge.ContextProvider, On = ge.ScopedContextProvider;
796
- function Tn(e = {}) {
797
- var n;
798
- const o = (n = e.store) == null ? void 0 : n.getState(), t = bt(le(q({}, e), {
799
- placement: j(
800
- e.placement,
801
- o == null ? void 0 : o.placement,
802
- "bottom"
803
- )
804
- })), i = j(e.timeout, o == null ? void 0 : o.timeout, 500), r = le(q({}, t.getState()), {
805
- timeout: i,
806
- showTimeout: j(e.showTimeout, o == null ? void 0 : o.showTimeout),
807
- hideTimeout: j(e.hideTimeout, o == null ? void 0 : o.hideTimeout),
808
- autoFocusOnShow: j(o == null ? void 0 : o.autoFocusOnShow, !1)
809
- }), l = pt(r, t, e.store);
810
- return le(q(q({}, t), l), {
811
- setAutoFocusOnShow: (a) => l.setState("autoFocusOnShow", a)
812
- });
813
- }
814
- function Cn(e, n, o) {
815
- return Ee(e, o, "timeout"), Ee(e, o, "showTimeout"), Ee(e, o, "hideTimeout"), Pt(e, n, o);
816
- }
817
- function In(e = {}) {
818
- const [n, o] = mt(Tn, e);
819
- return Cn(n, o, e);
820
- }
821
- function Fe(e) {
822
- return [e.clientX, e.clientY];
823
- }
824
- function at(e, n) {
825
- const [o, t] = e;
826
- let i = !1;
827
- const r = n.length;
828
- for (let l = r, a = 0, c = l - 1; a < l; c = a++) {
829
- const [s, f] = n[a], [u, m] = n[c], [, p] = n[c === 0 ? l - 1 : c - 1] || [0, 0], d = (f - m) * (o - s) - (s - u) * (t - f);
830
- if (m < f) {
831
- if (t >= m && t < f) {
832
- if (d === 0) return !0;
833
- d > 0 && (t === m ? t > p && (i = !i) : i = !i);
834
- }
835
- } else if (f < m) {
836
- if (t > f && t <= m) {
837
- if (d === 0) return !0;
838
- d < 0 && (t === m ? t < p && (i = !i) : i = !i);
839
- }
840
- } else if (t === f && (o >= u && o <= s || o >= s && o <= u))
841
- return !0;
842
- }
843
- return i;
844
- }
845
- function Hn(e, n) {
846
- const { top: o, right: t, bottom: i, left: r } = n, [l, a] = e, c = l < r ? "left" : l > t ? "right" : null, s = a < o ? "top" : a > i ? "bottom" : null;
847
- return [c, s];
848
- }
849
- function ut(e, n) {
850
- const o = e.getBoundingClientRect(), { top: t, right: i, bottom: r, left: l } = o, [a, c] = Hn(n, o), s = [n];
851
- return a ? (c !== "top" && s.push([a === "left" ? l : i, t]), s.push([a === "left" ? i : l, t]), s.push([a === "left" ? i : l, r]), c !== "bottom" && s.push([a === "left" ? l : i, r])) : c === "top" ? (s.push([l, t]), s.push([l, r]), s.push([i, r]), s.push([i, t])) : (s.push([l, r]), s.push([l, t]), s.push([i, t]), s.push([i, r])), s;
852
- }
853
- var $n = "div";
854
- function Mt(e, n, o, t) {
855
- return Gt(n) ? !0 : e ? !!(Ne(n, e) || o && Ne(o, e) || t != null && t.some((i) => Mt(e, i, o))) : !1;
856
- }
857
- function Mn(e) {
858
- var n = e, {
859
- store: o
860
- } = n, t = Ce(n, [
861
- "store"
862
- ]);
863
- const [i, r] = Ye(!1), l = o.useState("mounted");
864
- U(() => {
865
- l || r(!1);
866
- }, [l]);
867
- const a = t.onFocus, c = me((f) => {
868
- a == null || a(f), !f.defaultPrevented && r(!0);
869
- }), s = ce(null);
870
- return U(() => zt(o, ["anchorElement"], (f) => {
871
- s.current = f.anchorElement;
872
- }), []), t = G(_({
873
- autoFocusOnHide: i,
874
- finalFocus: s
875
- }, t), {
876
- onFocus: c
877
- }), t;
878
- }
879
- var ft = en(null), Dn = je(
880
- function(n) {
881
- var o = n, {
882
- store: t,
883
- modal: i = !1,
884
- portal: r = !!i,
885
- hideOnEscape: l = !0,
886
- hideOnHoverOutside: a = !0,
887
- disablePointerEventsOnApproach: c = !!a
888
- } = o, s = Ce(o, [
889
- "store",
890
- "modal",
891
- "portal",
892
- "hideOnEscape",
893
- "hideOnHoverOutside",
894
- "disablePointerEventsOnApproach"
895
- ]);
896
- const f = Je();
897
- t = t || f, He(
898
- t,
899
- process.env.NODE_ENV !== "production" && "Hovercard must receive a `store` prop or be wrapped in a HovercardProvider component."
900
- );
901
- const u = ce(null), [m, p] = Ye([]), d = ce(0), h = ce(null), { portalRef: v, domReady: g } = ht(r, s.portalRef), w = vt(), b = !!a, P = ke(a), x = !!c, E = ke(
902
- c
903
- ), C = t.useState("open"), H = t.useState("mounted");
904
- U(() => {
905
- if (!g || !H || !b && !x) return;
906
- const y = u.current;
907
- return y ? et(
908
- se("mousemove", (S) => {
909
- if (!t || !w()) return;
910
- const { anchorElement: T, hideTimeout: M, timeout: L } = t.getState(), I = h.current, [V] = S.composedPath(), W = T;
911
- if (Mt(V, y, W, m)) {
912
- h.current = V && W && Ne(W, V) ? Fe(S) : null, window.clearTimeout(d.current), d.current = 0;
913
- return;
914
- }
915
- if (!d.current) {
916
- if (I) {
917
- const K = Fe(S), oe = ut(y, I);
918
- if (at(K, oe)) {
919
- if (h.current = K, !E(S)) return;
920
- S.preventDefault(), S.stopPropagation();
921
- return;
922
- }
923
- }
924
- P(S) && (d.current = window.setTimeout(() => {
925
- d.current = 0, t == null || t.hide();
926
- }, M ?? L));
927
- }
928
- }, !0),
929
- () => clearTimeout(d.current)
930
- ) : void 0;
931
- }, [
932
- t,
933
- w,
934
- g,
935
- H,
936
- b,
937
- x,
938
- m,
939
- E,
940
- P
941
- ]), U(() => {
942
- if (!g || !H || !x) return;
943
- const y = (O) => {
944
- const S = u.current;
945
- if (!S) return;
946
- const T = h.current;
947
- if (!T) return;
948
- const M = ut(S, T);
949
- if (at(Fe(O), M)) {
950
- if (!E(O)) return;
951
- O.preventDefault(), O.stopPropagation();
952
- }
953
- };
954
- return et(
955
- // Note: we may need to add pointer events here in the future.
956
- se("mouseenter", y, !0),
957
- se("mouseover", y, !0),
958
- se("mouseout", y, !0),
959
- se("mouseleave", y, !0)
960
- );
961
- }, [g, H, x, E]), U(() => {
962
- g && (C || t == null || t.setAutoFocusOnShow(!1));
963
- }, [t, g, C]);
964
- const D = qt(C);
965
- U(() => {
966
- if (g)
967
- return () => {
968
- D.current || t == null || t.setAutoFocusOnShow(!1);
969
- };
970
- }, [t, g]);
971
- const R = Qt(ft);
972
- Le(() => {
973
- if (i || !r || !H || !g) return;
974
- const y = u.current;
975
- if (y)
976
- return R == null ? void 0 : R(y);
977
- }, [i, r, H, g]);
978
- const A = yt(
979
- (y) => {
980
- p((S) => [...S, y]);
981
- const O = R == null ? void 0 : R(y);
982
- return () => {
983
- p(
984
- (S) => S.filter((T) => T !== y)
985
- ), O == null || O();
986
- };
987
- },
988
- [R]
989
- );
990
- s = _e(
991
- s,
992
- (y) => /* @__PURE__ */ Se.jsx(On, { value: t, children: /* @__PURE__ */ Se.jsx(ft.Provider, { value: A, children: y }) }),
993
- [t, A]
994
- ), s = G(_({}, s), {
995
- ref: gt(u, s.ref)
996
- }), s = Mn(_({ store: t }, s));
997
- const $ = t.useState(
998
- (y) => i || y.autoFocusOnShow
999
- );
1000
- return s = $t(G(_({
1001
- store: t,
1002
- modal: i,
1003
- portal: r,
1004
- autoFocusOnShow: $
1005
- }, s), {
1006
- portalRef: v,
1007
- hideOnEscape(y) {
1008
- return Ut(l, y) ? !1 : (requestAnimationFrame(() => {
1009
- requestAnimationFrame(() => {
1010
- t == null || t.hide();
1011
- });
1012
- }), !0);
1013
- }
1014
- })), s;
1015
- }
1016
- ), qn = dt(
1017
- ze(function(n) {
1018
- const o = Dn(n);
1019
- return Xe($n, o);
1020
- }),
1021
- Je
1022
- ), Fn = "a", Ln = je(
1023
- function(n) {
1024
- var o = n, { store: t, showOnHover: i = !0 } = o, r = Ce(o, ["store", "showOnHover"]);
1025
- const l = Je();
1026
- t = t || l, He(
1027
- t,
1028
- process.env.NODE_ENV !== "production" && "HovercardAnchor must receive a `store` prop or be wrapped in a HovercardProvider component."
1029
- );
1030
- const a = Jt(r), c = ce(0);
1031
- U(() => () => window.clearTimeout(c.current), []), U(() => se("mouseleave", (g) => {
1032
- if (!t) return;
1033
- const { anchorElement: w } = t.getState();
1034
- w && g.target === w && (window.clearTimeout(c.current), c.current = 0);
1035
- }, !0), [t]);
1036
- const s = r.onMouseMove, f = ke(i), u = vt(), m = me((v) => {
1037
- if (s == null || s(v), a || !t || v.defaultPrevented || c.current || !u() || !f(v)) return;
1038
- const g = v.currentTarget;
1039
- t.setAnchorElement(g), t.setDisclosureElement(g);
1040
- const { showTimeout: w, timeout: b } = t.getState(), P = () => {
1041
- c.current = 0, u() && (t == null || t.setAnchorElement(g), t == null || t.show(), queueMicrotask(() => {
1042
- t == null || t.setDisclosureElement(g);
1043
- }));
1044
- }, x = w ?? b;
1045
- x === 0 ? P() : c.current = window.setTimeout(P, x);
1046
- }), p = r.onClick, d = me((v) => {
1047
- p == null || p(v), t && (window.clearTimeout(c.current), c.current = 0);
1048
- }), h = yt(
1049
- (v) => {
1050
- if (!t) return;
1051
- const { anchorElement: g } = t.getState();
1052
- g != null && g.isConnected || t.setAnchorElement(v);
1053
- },
1054
- [t]
1055
- );
1056
- return r = G(_({}, r), {
1057
- ref: gt(h, r.ref),
1058
- onMouseMove: m,
1059
- onClick: d
1060
- }), r = Zt(r), r;
1061
- }
1062
- ), Un = ze(function(n) {
1063
- const o = Ln(n);
1064
- return Xe(Fn, o);
1065
- });
1066
- export {
1067
- Un as H,
1068
- Xn as P,
1069
- qn as a,
1070
- In as b,
1071
- Tn as c,
1072
- Cn as d,
1073
- On as e,
1074
- Yn as f,
1075
- Dn as g,
1076
- Ln as h,
1077
- zn as u
1078
- };