@pismo/marola 0.0.1-alpha.9 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/README.md +1 -1
  2. package/dist/{Button-B1umG8kJ.js → Button-2b1peDFT.js} +25 -26
  3. package/dist/{ClickAwayListener-BKznXF1d.js → ClickAwayListener-BSW-Nd-y.js} +3 -2
  4. package/dist/Dialog.module-DFEmFdYT.js +30 -0
  5. package/dist/Group-B3p31ftp.js +26 -0
  6. package/dist/Popup-B6ZSGIEI.js +1248 -0
  7. package/dist/{Portal-BcdMtRGF.js → Portal-DIeBsWdL.js} +2 -2
  8. package/dist/SelectButton-C8JQKaf4.js +61 -0
  9. package/dist/Tabs.module-jkH1Qjn7.js +22 -0
  10. package/dist/Toggle-BCgIItCc.js +142 -0
  11. package/dist/assets/Advice.css +1 -1
  12. package/dist/assets/Button.css +1 -1
  13. package/dist/assets/Checkbox.css +1 -1
  14. package/dist/assets/Dialog.css +1 -1
  15. package/dist/assets/EllipsisTooltip.css +1 -0
  16. package/dist/assets/Group.css +1 -0
  17. package/dist/assets/IconButton.css +1 -1
  18. package/dist/assets/Input.css +1 -1
  19. package/dist/assets/InputSearch.css +1 -1
  20. package/dist/assets/PageHeader.css +1 -1
  21. package/dist/assets/Pagination.css +1 -1
  22. package/dist/assets/SelectButton.css +1 -0
  23. package/dist/assets/Skeleton.css +1 -1
  24. package/dist/assets/Snackbar.css +1 -1
  25. package/dist/assets/SortTooltip.css +1 -1
  26. package/dist/assets/Stepper.css +1 -1
  27. package/dist/assets/Table.css +1 -1
  28. package/dist/assets/TextDisplay.css +1 -0
  29. package/dist/assets/Toggle.css +1 -1
  30. package/dist/assets/Toggle2.css +1 -0
  31. package/dist/assets/Typography.css +1 -1
  32. package/dist/combineHooksSlotProps-DVjg9PRh.js +80 -0
  33. package/dist/components/Advice/Advice.d.ts +17 -3
  34. package/dist/components/Advice/Advice.js +39 -17
  35. package/dist/components/Advice/Advice.stories.d.ts +18 -0
  36. package/dist/components/Button/Button.d.ts +6 -3
  37. package/dist/components/Button/Button.js +60 -65
  38. package/dist/components/Button/Button.stories.d.ts +3 -1
  39. package/dist/components/Checkbox/Checkbox.d.ts +19 -2
  40. package/dist/components/Checkbox/Checkbox.js +63 -40
  41. package/dist/components/Checkbox/Checkbox.stories.d.ts +31 -0
  42. package/dist/components/Chip/Chip.d.ts +39 -0
  43. package/dist/components/Chip/Chip.js +19 -0
  44. package/dist/components/Chip/Chip.stories.d.ts +42 -0
  45. package/dist/components/Chip/chip.test.d.ts +1 -0
  46. package/dist/components/Dialog/Actions.js +1 -1
  47. package/dist/components/Dialog/Backdrop.js +1 -1
  48. package/dist/components/Dialog/CloseIconButton.js +2 -2
  49. package/dist/components/Dialog/Dialog.d.ts +1 -1
  50. package/dist/components/Dialog/Dialog.js +13 -13
  51. package/dist/components/Dialog/Dialog.stories.d.ts +10 -10
  52. package/dist/components/Dialog/{Title.d.ts → DialogTitle.d.ts} +3 -3
  53. package/dist/components/Dialog/DialogTitle.js +29 -0
  54. package/dist/components/EllipsisTooltip/EllipsisTooltip.d.ts +7 -0
  55. package/dist/components/EllipsisTooltip/EllipsisTooltip.js +23 -0
  56. package/dist/components/EllipsisTooltip/EllipsisTooltip.stories.d.ts +31 -0
  57. package/dist/components/Icon/Icon.d.ts +8 -15
  58. package/dist/components/Icon/Icon.js +108 -57
  59. package/dist/components/Icon/Icon.stories.d.ts +14 -0
  60. package/dist/components/Icon/types.d.ts +5 -0
  61. package/dist/components/Icon/types.js +1 -0
  62. package/dist/components/IconButton/Icon.stories.d.ts +15 -0
  63. package/dist/components/IconButton/IconButton.d.ts +18 -2
  64. package/dist/components/IconButton/IconButton.js +58 -63
  65. package/dist/components/Input/Input.d.ts +1 -1
  66. package/dist/components/Input/Input.js +241 -230
  67. package/dist/components/InputSearch/InputSearch.d.ts +7 -9
  68. package/dist/components/InputSearch/InputSearch.js +30 -25
  69. package/dist/components/InputSearch/InputSearch.stories.d.ts +21 -4
  70. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +1 -1
  71. package/dist/components/PageHeader/PageHeader.d.ts +36 -6
  72. package/dist/components/PageHeader/PageHeader.js +83 -47
  73. package/dist/components/PageHeader/PageHeader.stories.d.ts +2 -31
  74. package/dist/components/Pagination/Pagination.d.ts +24 -5
  75. package/dist/components/Pagination/Pagination.js +127 -109
  76. package/dist/components/Pagination/Pagination.stories.d.ts +17 -0
  77. package/dist/components/Select/Select.d.ts +26 -0
  78. package/dist/components/Select/Select.js +857 -0
  79. package/dist/components/Select/Select.stories.d.ts +22 -0
  80. package/dist/components/Select/SelectButton.d.ts +12 -0
  81. package/dist/components/Select/SelectButton.js +8 -0
  82. package/dist/components/Skeleton/Skeleton.d.ts +10 -3
  83. package/dist/components/Skeleton/Skeleton.js +16 -19
  84. package/dist/components/Skeleton/Skeleton.stories.d.ts +14 -0
  85. package/dist/components/Skeleton/SkeletonCircle.stories.d.ts +14 -0
  86. package/dist/components/Skeleton/SkeletonTable.stories.d.ts +16 -0
  87. package/dist/components/Snackbar/Snackbar.d.ts +19 -5
  88. package/dist/components/Snackbar/Snackbar.js +247 -230
  89. package/dist/components/Snackbar/Snackbar.stories.d.ts +319 -0
  90. package/dist/components/SortTooltip/SortTooltip.d.ts +3 -1
  91. package/dist/components/SortTooltip/SortTooltip.js +55 -29
  92. package/dist/components/Stepper/Stepper.d.ts +11 -1
  93. package/dist/components/Stepper/Stepper.js +37 -22
  94. package/dist/components/Stepper/Stepper.stories.d.ts +16 -0
  95. package/dist/components/Table/Table.d.ts +33 -16
  96. package/dist/components/Table/Table.js +106 -91
  97. package/dist/components/Table/Table.stories.d.ts +29 -0
  98. package/dist/components/Table/_Table.TBody.stories.d.ts +14 -0
  99. package/dist/components/Table/_Table.THead.stories.d.ts +14 -0
  100. package/dist/components/Table/_Table.Td.stories.d.ts +16 -0
  101. package/dist/components/Table/_Table.Th.stories.d.ts +15 -0
  102. package/dist/components/Table/_Table.Tr.stories.d.ts +15 -0
  103. package/dist/components/Tabs/Tab.d.ts +5 -0
  104. package/dist/components/Tabs/Tab.js +179 -6
  105. package/dist/components/Tabs/Tab.stories.d.ts +15 -0
  106. package/dist/components/Tabs/TabPanel.d.ts +4 -0
  107. package/dist/components/Tabs/TabPanel.js +12 -12
  108. package/dist/components/Tabs/TabPanel.stories.d.ts +14 -0
  109. package/dist/components/Tabs/Tabs.d.ts +5 -1
  110. package/dist/components/Tabs/Tabs.js +242 -668
  111. package/dist/components/Tabs/Tabs.stories.d.ts +14 -0
  112. package/dist/components/TextDisplay/TextDisplay.d.ts +23 -0
  113. package/dist/components/TextDisplay/TextDisplay.js +37 -0
  114. package/dist/components/TextDisplay/TextDisplay.stories.d.ts +13 -0
  115. package/dist/components/TextDisplay/textDisplay.test.d.ts +1 -0
  116. package/dist/components/Toggle/Toggle.js +143 -129
  117. package/dist/components/ToggleGroup/Group.d.ts +18 -0
  118. package/dist/components/ToggleGroup/Group.js +7 -0
  119. package/dist/components/ToggleGroup/Group.test.d.ts +1 -0
  120. package/dist/components/ToggleGroup/Toggle.d.ts +15 -0
  121. package/dist/components/ToggleGroup/Toggle.js +17 -0
  122. package/dist/components/ToggleGroup/Toggle.test.d.ts +1 -0
  123. package/dist/components/ToggleGroup/ToggleGroup.d.ts +2 -0
  124. package/dist/components/ToggleGroup/ToggleGroup.js +6 -0
  125. package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +25 -0
  126. package/dist/components/Tooltip/Tooltip.d.ts +22 -6
  127. package/dist/components/Tooltip/Tooltip.js +114 -1339
  128. package/dist/components/Tooltip/Tooltip.stories.d.ts +35 -0
  129. package/dist/components/Typography/Typography.d.ts +5 -2
  130. package/dist/components/Typography/Typography.js +58 -74
  131. package/dist/components/Typography/Typography.stories.d.ts +1 -0
  132. package/dist/contexts/SnackbarProvider/SnackbarProvider.d.ts +11 -0
  133. package/dist/contexts/SnackbarProvider/SnackbarProvider.js +50 -0
  134. package/dist/contexts/SnackbarProvider/SnackbarProvider.stories.d.ts +21 -0
  135. package/dist/{index-CqjC7P5Y.js → index-CH45lKw7.js} +333 -307
  136. package/dist/{index-BNWbc5Kh.js → index-CjW42-M-.js} +3108 -3152
  137. package/dist/main.d.ts +10 -1
  138. package/dist/main.js +74 -55
  139. package/dist/marola.css +1 -0
  140. package/dist/{useButton-Bc8IAgyk.js → useButton-DNk3wrQp.js} +3 -4
  141. package/dist/useCompoundItem-D1iRfg8D.js +84 -0
  142. package/dist/useEventCallback-xTG9piMa.js +45 -0
  143. package/dist/useList-B0hog_3-.js +436 -0
  144. package/dist/utils/styleStrings.d.ts +1 -1
  145. package/dist/utils/styleStrings.js +7 -7
  146. package/package.json +4 -4
  147. package/dist/Dialog.module-CGVM5V_D.js +0 -15
  148. package/dist/Tab-CRwnhsj5.js +0 -254
  149. package/dist/Tabs.module-yYcTJnj6.js +0 -103
  150. package/dist/_commonjsHelpers-CT_km90n.js +0 -30
  151. package/dist/assets/global.css +0 -1
  152. package/dist/components/Button/Button.stories.js +0 -40
  153. package/dist/components/Dialog/Dialog.stories.js +0 -59
  154. package/dist/components/Dialog/Title.js +0 -29
  155. package/dist/components/Input/Input.stories.js +0 -106
  156. package/dist/components/InputSearch/InputSearch.stories.js +0 -36
  157. package/dist/components/LoadingSpinner/LoadingSpinner.stories.js +0 -38
  158. package/dist/components/PageHeader/PageHeader.stories.js +0 -49
  159. package/dist/components/Toggle/Toggle.stories.js +0 -33
  160. package/dist/components/Typography/Typography.stories.js +0 -30
  161. package/dist/components/Typography/typography.test.js +0 -11357
  162. package/dist/magic-string.es-O_8lTkE3.js +0 -738
  163. package/dist/objectWithoutPropertiesLoose-D7Cp0Pg_.js +0 -26
  164. package/dist/utils/styleStrings.test.js +0 -41
  165. package/dist/vi.Y_w82WR8-Df0JUamG.js +0 -9860
@@ -1,1301 +1,61 @@
1
1
  import '../../assets/Tooltip.css';
2
- import { jsx as L } from "react/jsx-runtime";
3
- import * as w from "react";
4
- import { useLayoutEffect as qt, useEffect as Pt, useRef as Kt, useState as yt } from "react";
5
- import { _ as _t, a as et } from "../../objectWithoutPropertiesLoose-D7Cp0Pg_.js";
6
- import { g as Gt, a as Jt, u as Qt, b as Zt, P as p, c as te, d as ee } from "../../index-CqjC7P5Y.js";
7
- import { r as ne } from "../../index-BNWbc5Kh.js";
8
- import { u as oe } from "../../useEnhancedEffect-CJGo-L3B.js";
9
- import { P as ie, H as wt } from "../../Portal-BcdMtRGF.js";
10
- import { c as re } from "../../clsx-DB4S2d7J.js";
11
- import { C as se } from "../../ClickAwayListener-BKznXF1d.js";
12
- const ot = Math.min, I = Math.max, it = Math.round, tt = Math.floor, $ = (t) => ({
13
- x: t,
14
- y: t
15
- }), le = {
16
- left: "right",
17
- right: "left",
18
- bottom: "top",
19
- top: "bottom"
20
- }, ce = {
21
- start: "end",
22
- end: "start"
23
- };
24
- function vt(t, e, o) {
25
- return I(t, ot(e, o));
26
- }
27
- function ct(t, e) {
28
- return typeof t == "function" ? t(e) : t;
29
- }
30
- function U(t) {
31
- return t.split("-")[0];
32
- }
33
- function at(t) {
34
- return t.split("-")[1];
35
- }
36
- function St(t) {
37
- return t === "x" ? "y" : "x";
38
- }
39
- function Lt(t) {
40
- return t === "y" ? "height" : "width";
41
- }
42
- function ft(t) {
43
- return ["top", "bottom"].includes(U(t)) ? "y" : "x";
44
- }
45
- function kt(t) {
46
- return St(ft(t));
47
- }
48
- function ae(t, e, o) {
49
- o === void 0 && (o = !1);
50
- const n = at(t), i = kt(t), r = Lt(i);
51
- let s = i === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
52
- return e.reference[r] > e.floating[r] && (s = rt(s)), [s, rt(s)];
53
- }
54
- function fe(t) {
55
- const e = rt(t);
56
- return [mt(t), e, mt(e)];
57
- }
58
- function mt(t) {
59
- return t.replace(/start|end/g, (e) => ce[e]);
60
- }
61
- function ue(t, e, o) {
62
- const n = ["left", "right"], i = ["right", "left"], r = ["top", "bottom"], s = ["bottom", "top"];
63
- switch (t) {
64
- case "top":
65
- case "bottom":
66
- return o ? e ? i : n : e ? n : i;
67
- case "left":
68
- case "right":
69
- return e ? r : s;
70
- default:
71
- return [];
72
- }
73
- }
74
- function de(t, e, o, n) {
75
- const i = at(t);
76
- let r = ue(U(t), o === "start", n);
77
- return i && (r = r.map((s) => s + "-" + i), e && (r = r.concat(r.map(mt)))), r;
78
- }
79
- function rt(t) {
80
- return t.replace(/left|right|bottom|top/g, (e) => le[e]);
81
- }
82
- function me(t) {
83
- return {
84
- top: 0,
85
- right: 0,
86
- bottom: 0,
87
- left: 0,
88
- ...t
89
- };
90
- }
91
- function pe(t) {
92
- return typeof t != "number" ? me(t) : {
93
- top: t,
94
- right: t,
95
- bottom: t,
96
- left: t
97
- };
98
- }
99
- function st(t) {
100
- const {
101
- x: e,
102
- y: o,
103
- width: n,
104
- height: i
105
- } = t;
106
- return {
107
- width: n,
108
- height: i,
109
- top: o,
110
- left: e,
111
- right: e + n,
112
- bottom: o + i,
113
- x: e,
114
- y: o
115
- };
116
- }
117
- function bt(t, e, o) {
118
- let {
119
- reference: n,
120
- floating: i
121
- } = t;
122
- const r = ft(e), s = kt(e), l = Lt(s), c = U(e), a = r === "y", f = n.x + n.width / 2 - i.width / 2, u = n.y + n.height / 2 - i.height / 2, m = n[l] / 2 - i[l] / 2;
123
- let d;
124
- switch (c) {
125
- case "top":
126
- d = {
127
- x: f,
128
- y: n.y - i.height
129
- };
130
- break;
131
- case "bottom":
132
- d = {
133
- x: f,
134
- y: n.y + n.height
135
- };
136
- break;
137
- case "right":
138
- d = {
139
- x: n.x + n.width,
140
- y: u
141
- };
142
- break;
143
- case "left":
144
- d = {
145
- x: n.x - i.width,
146
- y: u
147
- };
148
- break;
149
- default:
150
- d = {
151
- x: n.x,
152
- y: n.y
153
- };
154
- }
155
- switch (at(e)) {
156
- case "start":
157
- d[s] -= m * (o && a ? -1 : 1);
158
- break;
159
- case "end":
160
- d[s] += m * (o && a ? -1 : 1);
161
- break;
162
- }
163
- return d;
164
- }
165
- const he = async (t, e, o) => {
166
- const {
167
- placement: n = "bottom",
168
- strategy: i = "absolute",
169
- middleware: r = [],
170
- platform: s
171
- } = o, l = r.filter(Boolean), c = await (s.isRTL == null ? void 0 : s.isRTL(e));
172
- let a = await s.getElementRects({
173
- reference: t,
174
- floating: e,
175
- strategy: i
176
- }), {
177
- x: f,
178
- y: u
179
- } = bt(a, n, c), m = n, d = {}, g = 0;
180
- for (let x = 0; x < l.length; x++) {
181
- const {
182
- name: v,
183
- fn: h
184
- } = l[x], {
185
- x: y,
186
- y: b,
187
- data: C,
188
- reset: E
189
- } = await h({
190
- x: f,
191
- y: u,
192
- initialPlacement: n,
193
- placement: m,
194
- strategy: i,
195
- middlewareData: d,
196
- rects: a,
197
- platform: s,
198
- elements: {
199
- reference: t,
200
- floating: e
201
- }
202
- });
203
- f = y ?? f, u = b ?? u, d = {
204
- ...d,
205
- [v]: {
206
- ...d[v],
207
- ...C
208
- }
209
- }, E && g <= 50 && (g++, typeof E == "object" && (E.placement && (m = E.placement), E.rects && (a = E.rects === !0 ? await s.getElementRects({
210
- reference: t,
211
- floating: e,
212
- strategy: i
213
- }) : E.rects), {
214
- x: f,
215
- y: u
216
- } = bt(a, m, c)), x = -1);
217
- }
218
- return {
219
- x: f,
220
- y: u,
221
- placement: m,
222
- strategy: i,
223
- middlewareData: d
224
- };
225
- };
226
- async function Mt(t, e) {
227
- var o;
228
- e === void 0 && (e = {});
229
- const {
230
- x: n,
231
- y: i,
232
- platform: r,
233
- rects: s,
234
- elements: l,
235
- strategy: c
236
- } = t, {
237
- boundary: a = "clippingAncestors",
238
- rootBoundary: f = "viewport",
239
- elementContext: u = "floating",
240
- altBoundary: m = !1,
241
- padding: d = 0
242
- } = ct(e, t), g = pe(d), v = l[m ? u === "floating" ? "reference" : "floating" : u], h = st(await r.getClippingRect({
243
- element: (o = await (r.isElement == null ? void 0 : r.isElement(v))) == null || o ? v : v.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(l.floating)),
244
- boundary: a,
245
- rootBoundary: f,
246
- strategy: c
247
- })), y = u === "floating" ? {
248
- x: n,
249
- y: i,
250
- width: s.floating.width,
251
- height: s.floating.height
252
- } : s.reference, b = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(l.floating)), C = await (r.isElement == null ? void 0 : r.isElement(b)) ? await (r.getScale == null ? void 0 : r.getScale(b)) || {
253
- x: 1,
254
- y: 1
255
- } : {
256
- x: 1,
257
- y: 1
258
- }, E = st(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
259
- elements: l,
260
- rect: y,
261
- offsetParent: b,
262
- strategy: c
263
- }) : y);
264
- return {
265
- top: (h.top - E.top + g.top) / C.y,
266
- bottom: (E.bottom - h.bottom + g.bottom) / C.y,
267
- left: (h.left - E.left + g.left) / C.x,
268
- right: (E.right - h.right + g.right) / C.x
269
- };
270
- }
271
- const ge = function(t) {
272
- return t === void 0 && (t = {}), {
273
- name: "flip",
274
- options: t,
275
- async fn(e) {
276
- var o, n;
277
- const {
278
- placement: i,
279
- middlewareData: r,
280
- rects: s,
281
- initialPlacement: l,
282
- platform: c,
283
- elements: a
284
- } = e, {
285
- mainAxis: f = !0,
286
- crossAxis: u = !0,
287
- fallbackPlacements: m,
288
- fallbackStrategy: d = "bestFit",
289
- fallbackAxisSideDirection: g = "none",
290
- flipAlignment: x = !0,
291
- ...v
292
- } = ct(t, e);
293
- if ((o = r.arrow) != null && o.alignmentOffset)
294
- return {};
295
- const h = U(i), y = U(l) === l, b = await (c.isRTL == null ? void 0 : c.isRTL(a.floating)), C = m || (y || !x ? [rt(l)] : fe(l));
296
- !m && g !== "none" && C.push(...de(l, x, g, b));
297
- const E = [l, ...C], A = await Mt(e, v), N = [];
298
- let _ = ((n = r.flip) == null ? void 0 : n.overflows) || [];
299
- if (f && N.push(A[h]), u) {
300
- const T = ae(i, s, b);
301
- N.push(A[T[0]], A[T[1]]);
302
- }
303
- if (_ = [..._, {
304
- placement: i,
305
- overflows: N
306
- }], !N.every((T) => T <= 0)) {
307
- var z, j;
308
- const T = (((z = r.flip) == null ? void 0 : z.index) || 0) + 1, W = E[T];
309
- if (W)
310
- return {
311
- data: {
312
- index: T,
313
- overflows: _
314
- },
315
- reset: {
316
- placement: W
317
- }
318
- };
319
- let k = (j = _.filter((O) => O.overflows[0] <= 0).sort((O, M) => O.overflows[1] - M.overflows[1])[0]) == null ? void 0 : j.placement;
320
- if (!k)
321
- switch (d) {
322
- case "bestFit": {
323
- var B;
324
- const O = (B = _.map((M) => [M.placement, M.overflows.filter((R) => R > 0).reduce((R, Y) => R + Y, 0)]).sort((M, R) => M[1] - R[1])[0]) == null ? void 0 : B[0];
325
- O && (k = O);
326
- break;
327
- }
328
- case "initialPlacement":
329
- k = l;
330
- break;
331
- }
332
- if (i !== k)
333
- return {
334
- reset: {
335
- placement: k
336
- }
337
- };
338
- }
339
- return {};
340
- }
341
- };
342
- };
343
- async function xe(t, e) {
344
- const {
345
- placement: o,
346
- platform: n,
347
- elements: i
348
- } = t, r = await (n.isRTL == null ? void 0 : n.isRTL(i.floating)), s = U(o), l = at(o), c = ft(o) === "y", a = ["left", "top"].includes(s) ? -1 : 1, f = r && c ? -1 : 1, u = ct(e, t);
349
- let {
350
- mainAxis: m,
351
- crossAxis: d,
352
- alignmentAxis: g
353
- } = typeof u == "number" ? {
354
- mainAxis: u,
355
- crossAxis: 0,
356
- alignmentAxis: null
357
- } : {
358
- mainAxis: 0,
359
- crossAxis: 0,
360
- alignmentAxis: null,
361
- ...u
362
- };
363
- return l && typeof g == "number" && (d = l === "end" ? g * -1 : g), c ? {
364
- x: d * f,
365
- y: m * a
366
- } : {
367
- x: m * a,
368
- y: d * f
369
- };
370
- }
371
- const ye = function(t) {
372
- return t === void 0 && (t = 0), {
373
- name: "offset",
374
- options: t,
375
- async fn(e) {
376
- var o, n;
377
- const {
378
- x: i,
379
- y: r,
380
- placement: s,
381
- middlewareData: l
382
- } = e, c = await xe(e, t);
383
- return s === ((o = l.offset) == null ? void 0 : o.placement) && (n = l.arrow) != null && n.alignmentOffset ? {} : {
384
- x: i + c.x,
385
- y: r + c.y,
386
- data: {
387
- ...c,
388
- placement: s
389
- }
390
- };
391
- }
392
- };
393
- }, we = function(t) {
394
- return t === void 0 && (t = {}), {
395
- name: "shift",
396
- options: t,
397
- async fn(e) {
398
- const {
399
- x: o,
400
- y: n,
401
- placement: i
402
- } = e, {
403
- mainAxis: r = !0,
404
- crossAxis: s = !1,
405
- limiter: l = {
406
- fn: (v) => {
407
- let {
408
- x: h,
409
- y
410
- } = v;
411
- return {
412
- x: h,
413
- y
414
- };
415
- }
416
- },
417
- ...c
418
- } = ct(t, e), a = {
419
- x: o,
420
- y: n
421
- }, f = await Mt(e, c), u = ft(U(i)), m = St(u);
422
- let d = a[m], g = a[u];
423
- if (r) {
424
- const v = m === "y" ? "top" : "left", h = m === "y" ? "bottom" : "right", y = d + f[v], b = d - f[h];
425
- d = vt(y, d, b);
426
- }
427
- if (s) {
428
- const v = u === "y" ? "top" : "left", h = u === "y" ? "bottom" : "right", y = g + f[v], b = g - f[h];
429
- g = vt(y, g, b);
430
- }
431
- const x = l.fn({
432
- ...e,
433
- [m]: d,
434
- [u]: g
435
- });
436
- return {
437
- ...x,
438
- data: {
439
- x: x.x - o,
440
- y: x.y - n
441
- }
442
- };
443
- }
444
- };
445
- };
446
- function H(t) {
447
- return Dt(t) ? (t.nodeName || "").toLowerCase() : "#document";
448
- }
449
- function P(t) {
450
- var e;
451
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
452
- }
453
- function V(t) {
454
- var e;
455
- return (e = (Dt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
456
- }
457
- function Dt(t) {
458
- return t instanceof Node || t instanceof P(t).Node;
459
- }
460
- function F(t) {
461
- return t instanceof Element || t instanceof P(t).Element;
462
- }
463
- function D(t) {
464
- return t instanceof HTMLElement || t instanceof P(t).HTMLElement;
465
- }
466
- function Ct(t) {
467
- return typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof P(t).ShadowRoot;
468
- }
469
- function Z(t) {
470
- const {
471
- overflow: e,
472
- overflowX: o,
473
- overflowY: n,
474
- display: i
475
- } = S(t);
476
- return /auto|scroll|overlay|hidden|clip/.test(e + n + o) && !["inline", "contents"].includes(i);
477
- }
478
- function ve(t) {
479
- return ["table", "td", "th"].includes(H(t));
480
- }
481
- function pt(t) {
482
- const e = ht(), o = S(t);
483
- return o.transform !== "none" || o.perspective !== "none" || (o.containerType ? o.containerType !== "normal" : !1) || !e && (o.backdropFilter ? o.backdropFilter !== "none" : !1) || !e && (o.filter ? o.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((n) => (o.willChange || "").includes(n)) || ["paint", "layout", "strict", "content"].some((n) => (o.contain || "").includes(n));
484
- }
485
- function be(t) {
486
- let e = J(t);
487
- for (; D(e) && !ut(e); ) {
488
- if (pt(e))
489
- return e;
490
- e = J(e);
491
- }
492
- return null;
493
- }
494
- function ht() {
495
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
496
- }
497
- function ut(t) {
498
- return ["html", "body", "#document"].includes(H(t));
499
- }
500
- function S(t) {
501
- return P(t).getComputedStyle(t);
502
- }
503
- function dt(t) {
504
- return F(t) ? {
505
- scrollLeft: t.scrollLeft,
506
- scrollTop: t.scrollTop
507
- } : {
508
- scrollLeft: t.pageXOffset,
509
- scrollTop: t.pageYOffset
510
- };
511
- }
512
- function J(t) {
513
- if (H(t) === "html")
514
- return t;
515
- const e = (
516
- // Step into the shadow DOM of the parent of a slotted node.
517
- t.assignedSlot || // DOM Element detected.
518
- t.parentNode || // ShadowRoot detected.
519
- Ct(t) && t.host || // Fallback.
520
- V(t)
521
- );
522
- return Ct(e) ? e.host : e;
523
- }
524
- function Ft(t) {
525
- const e = J(t);
526
- return ut(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : D(e) && Z(e) ? e : Ft(e);
527
- }
528
- function Q(t, e, o) {
529
- var n;
530
- e === void 0 && (e = []), o === void 0 && (o = !0);
531
- const i = Ft(t), r = i === ((n = t.ownerDocument) == null ? void 0 : n.body), s = P(i);
532
- return r ? e.concat(s, s.visualViewport || [], Z(i) ? i : [], s.frameElement && o ? Q(s.frameElement) : []) : e.concat(i, Q(i, [], o));
533
- }
534
- function Vt(t) {
535
- const e = S(t);
536
- let o = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
537
- const i = D(t), r = i ? t.offsetWidth : o, s = i ? t.offsetHeight : n, l = it(o) !== r || it(n) !== s;
538
- return l && (o = r, n = s), {
539
- width: o,
540
- height: n,
541
- $: l
542
- };
543
- }
544
- function gt(t) {
545
- return F(t) ? t : t.contextElement;
546
- }
547
- function G(t) {
548
- const e = gt(t);
549
- if (!D(e))
550
- return $(1);
551
- const o = e.getBoundingClientRect(), {
552
- width: n,
553
- height: i,
554
- $: r
555
- } = Vt(e);
556
- let s = (r ? it(o.width) : o.width) / n, l = (r ? it(o.height) : o.height) / i;
557
- return (!s || !Number.isFinite(s)) && (s = 1), (!l || !Number.isFinite(l)) && (l = 1), {
558
- x: s,
559
- y: l
560
- };
561
- }
562
- const Ce = /* @__PURE__ */ $(0);
563
- function jt(t) {
564
- const e = P(t);
565
- return !ht() || !e.visualViewport ? Ce : {
566
- x: e.visualViewport.offsetLeft,
567
- y: e.visualViewport.offsetTop
568
- };
569
- }
570
- function Ee(t, e, o) {
571
- return e === void 0 && (e = !1), !o || e && o !== P(t) ? !1 : e;
572
- }
573
- function X(t, e, o, n) {
574
- e === void 0 && (e = !1), o === void 0 && (o = !1);
575
- const i = t.getBoundingClientRect(), r = gt(t);
576
- let s = $(1);
577
- e && (n ? F(n) && (s = G(n)) : s = G(t));
578
- const l = Ee(r, o, n) ? jt(r) : $(0);
579
- let c = (i.left + l.x) / s.x, a = (i.top + l.y) / s.y, f = i.width / s.x, u = i.height / s.y;
580
- if (r) {
581
- const m = P(r), d = n && F(n) ? P(n) : n;
582
- let g = m, x = g.frameElement;
583
- for (; x && n && d !== g; ) {
584
- const v = G(x), h = x.getBoundingClientRect(), y = S(x), b = h.left + (x.clientLeft + parseFloat(y.paddingLeft)) * v.x, C = h.top + (x.clientTop + parseFloat(y.paddingTop)) * v.y;
585
- c *= v.x, a *= v.y, f *= v.x, u *= v.y, c += b, a += C, g = P(x), x = g.frameElement;
586
- }
587
- }
588
- return st({
589
- width: f,
590
- height: u,
591
- x: c,
592
- y: a
593
- });
594
- }
595
- const Re = [":popover-open", ":modal"];
596
- function Bt(t) {
597
- return Re.some((e) => {
598
- try {
599
- return t.matches(e);
600
- } catch {
601
- return !1;
602
- }
603
- });
604
- }
605
- function Ae(t) {
606
- let {
607
- elements: e,
608
- rect: o,
609
- offsetParent: n,
610
- strategy: i
611
- } = t;
612
- const r = i === "fixed", s = V(n), l = e ? Bt(e.floating) : !1;
613
- if (n === s || l && r)
614
- return o;
615
- let c = {
616
- scrollLeft: 0,
617
- scrollTop: 0
618
- }, a = $(1);
619
- const f = $(0), u = D(n);
620
- if ((u || !u && !r) && ((H(n) !== "body" || Z(s)) && (c = dt(n)), D(n))) {
621
- const m = X(n);
622
- a = G(n), f.x = m.x + n.clientLeft, f.y = m.y + n.clientTop;
623
- }
624
- return {
625
- width: o.width * a.x,
626
- height: o.height * a.y,
627
- x: o.x * a.x - c.scrollLeft * a.x + f.x,
628
- y: o.y * a.y - c.scrollTop * a.y + f.y
629
- };
630
- }
631
- function Te(t) {
632
- return Array.from(t.getClientRects());
633
- }
634
- function Wt(t) {
635
- return X(V(t)).left + dt(t).scrollLeft;
636
- }
637
- function Oe(t) {
638
- const e = V(t), o = dt(t), n = t.ownerDocument.body, i = I(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), r = I(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
639
- let s = -o.scrollLeft + Wt(t);
640
- const l = -o.scrollTop;
641
- return S(n).direction === "rtl" && (s += I(e.clientWidth, n.clientWidth) - i), {
642
- width: i,
643
- height: r,
644
- x: s,
645
- y: l
646
- };
647
- }
648
- function Ne(t, e) {
649
- const o = P(t), n = V(t), i = o.visualViewport;
650
- let r = n.clientWidth, s = n.clientHeight, l = 0, c = 0;
651
- if (i) {
652
- r = i.width, s = i.height;
653
- const a = ht();
654
- (!a || a && e === "fixed") && (l = i.offsetLeft, c = i.offsetTop);
655
- }
656
- return {
657
- width: r,
658
- height: s,
659
- x: l,
660
- y: c
661
- };
662
- }
663
- function Pe(t, e) {
664
- const o = X(t, !0, e === "fixed"), n = o.top + t.clientTop, i = o.left + t.clientLeft, r = D(t) ? G(t) : $(1), s = t.clientWidth * r.x, l = t.clientHeight * r.y, c = i * r.x, a = n * r.y;
665
- return {
666
- width: s,
667
- height: l,
668
- x: c,
669
- y: a
670
- };
671
- }
672
- function Et(t, e, o) {
673
- let n;
674
- if (e === "viewport")
675
- n = Ne(t, o);
676
- else if (e === "document")
677
- n = Oe(V(t));
678
- else if (F(e))
679
- n = Pe(e, o);
680
- else {
681
- const i = jt(t);
682
- n = {
683
- ...e,
684
- x: e.x - i.x,
685
- y: e.y - i.y
686
- };
687
- }
688
- return st(n);
689
- }
690
- function $t(t, e) {
691
- const o = J(t);
692
- return o === e || !F(o) || ut(o) ? !1 : S(o).position === "fixed" || $t(o, e);
693
- }
694
- function _e(t, e) {
695
- const o = e.get(t);
696
- if (o)
697
- return o;
698
- let n = Q(t, [], !1).filter((l) => F(l) && H(l) !== "body"), i = null;
699
- const r = S(t).position === "fixed";
700
- let s = r ? J(t) : t;
701
- for (; F(s) && !ut(s); ) {
702
- const l = S(s), c = pt(s);
703
- !c && l.position === "fixed" && (i = null), (r ? !c && !i : !c && l.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || Z(s) && !c && $t(t, s)) ? n = n.filter((f) => f !== s) : i = l, s = J(s);
704
- }
705
- return e.set(t, n), n;
706
- }
707
- function Se(t) {
708
- let {
709
- element: e,
710
- boundary: o,
711
- rootBoundary: n,
712
- strategy: i
713
- } = t;
714
- const s = [...o === "clippingAncestors" ? _e(e, this._c) : [].concat(o), n], l = s[0], c = s.reduce((a, f) => {
715
- const u = Et(e, f, i);
716
- return a.top = I(u.top, a.top), a.right = ot(u.right, a.right), a.bottom = ot(u.bottom, a.bottom), a.left = I(u.left, a.left), a;
717
- }, Et(e, l, i));
718
- return {
719
- width: c.right - c.left,
720
- height: c.bottom - c.top,
721
- x: c.left,
722
- y: c.top
723
- };
724
- }
725
- function Le(t) {
726
- const {
727
- width: e,
728
- height: o
729
- } = Vt(t);
730
- return {
731
- width: e,
732
- height: o
733
- };
734
- }
735
- function ke(t, e, o) {
736
- const n = D(e), i = V(e), r = o === "fixed", s = X(t, !0, r, e);
737
- let l = {
738
- scrollLeft: 0,
739
- scrollTop: 0
740
- };
741
- const c = $(0);
742
- if (n || !n && !r)
743
- if ((H(e) !== "body" || Z(i)) && (l = dt(e)), n) {
744
- const u = X(e, !0, r, e);
745
- c.x = u.x + e.clientLeft, c.y = u.y + e.clientTop;
746
- } else
747
- i && (c.x = Wt(i));
748
- const a = s.left + l.scrollLeft - c.x, f = s.top + l.scrollTop - c.y;
749
- return {
750
- x: a,
751
- y: f,
752
- width: s.width,
753
- height: s.height
754
- };
755
- }
756
- function Rt(t, e) {
757
- return !D(t) || S(t).position === "fixed" ? null : e ? e(t) : t.offsetParent;
758
- }
759
- function Ht(t, e) {
760
- const o = P(t);
761
- if (!D(t) || Bt(t))
762
- return o;
763
- let n = Rt(t, e);
764
- for (; n && ve(n) && S(n).position === "static"; )
765
- n = Rt(n, e);
766
- return n && (H(n) === "html" || H(n) === "body" && S(n).position === "static" && !pt(n)) ? o : n || be(t) || o;
767
- }
768
- const Me = async function(t) {
769
- const e = this.getOffsetParent || Ht, o = this.getDimensions, n = await o(t.floating);
770
- return {
771
- reference: ke(t.reference, await e(t.floating), t.strategy),
772
- floating: {
773
- x: 0,
774
- y: 0,
775
- width: n.width,
776
- height: n.height
777
- }
778
- };
779
- };
780
- function De(t) {
781
- return S(t).direction === "rtl";
782
- }
783
- const Fe = {
784
- convertOffsetParentRelativeRectToViewportRelativeRect: Ae,
785
- getDocumentElement: V,
786
- getClippingRect: Se,
787
- getOffsetParent: Ht,
788
- getElementRects: Me,
789
- getClientRects: Te,
790
- getDimensions: Le,
791
- getScale: G,
792
- isElement: F,
793
- isRTL: De
794
- };
795
- function Ve(t, e) {
796
- let o = null, n;
797
- const i = V(t);
798
- function r() {
799
- var l;
800
- clearTimeout(n), (l = o) == null || l.disconnect(), o = null;
801
- }
802
- function s(l, c) {
803
- l === void 0 && (l = !1), c === void 0 && (c = 1), r();
804
- const {
805
- left: a,
806
- top: f,
807
- width: u,
808
- height: m
809
- } = t.getBoundingClientRect();
810
- if (l || e(), !u || !m)
811
- return;
812
- const d = tt(f), g = tt(i.clientWidth - (a + u)), x = tt(i.clientHeight - (f + m)), v = tt(a), y = {
813
- rootMargin: -d + "px " + -g + "px " + -x + "px " + -v + "px",
814
- threshold: I(0, ot(1, c)) || 1
815
- };
816
- let b = !0;
817
- function C(E) {
818
- const A = E[0].intersectionRatio;
819
- if (A !== c) {
820
- if (!b)
821
- return s();
822
- A ? s(!1, A) : n = setTimeout(() => {
823
- s(!1, 1e-7);
824
- }, 1e3);
825
- }
826
- b = !1;
827
- }
828
- try {
829
- o = new IntersectionObserver(C, {
830
- ...y,
831
- // Handle <iframe>s
832
- root: i.ownerDocument
833
- });
834
- } catch {
835
- o = new IntersectionObserver(C, y);
836
- }
837
- o.observe(t);
838
- }
839
- return s(!0), r;
840
- }
841
- function At(t, e, o, n) {
842
- n === void 0 && (n = {});
843
- const {
844
- ancestorScroll: i = !0,
845
- ancestorResize: r = !0,
846
- elementResize: s = typeof ResizeObserver == "function",
847
- layoutShift: l = typeof IntersectionObserver == "function",
848
- animationFrame: c = !1
849
- } = n, a = gt(t), f = i || r ? [...a ? Q(a) : [], ...Q(e)] : [];
850
- f.forEach((h) => {
851
- i && h.addEventListener("scroll", o, {
852
- passive: !0
853
- }), r && h.addEventListener("resize", o);
854
- });
855
- const u = a && l ? Ve(a, o) : null;
856
- let m = -1, d = null;
857
- s && (d = new ResizeObserver((h) => {
858
- let [y] = h;
859
- y && y.target === a && d && (d.unobserve(e), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
860
- var b;
861
- (b = d) == null || b.observe(e);
862
- })), o();
863
- }), a && !c && d.observe(a), d.observe(e));
864
- let g, x = c ? X(t) : null;
865
- c && v();
866
- function v() {
867
- const h = X(t);
868
- x && (h.x !== x.x || h.y !== x.y || h.width !== x.width || h.height !== x.height) && o(), x = h, g = requestAnimationFrame(v);
869
- }
870
- return o(), () => {
871
- var h;
872
- f.forEach((y) => {
873
- i && y.removeEventListener("scroll", o), r && y.removeEventListener("resize", o);
874
- }), u == null || u(), (h = d) == null || h.disconnect(), d = null, c && cancelAnimationFrame(g);
875
- };
876
- }
877
- const Tt = ye, je = we, Be = ge, We = (t, e, o) => {
878
- const n = /* @__PURE__ */ new Map(), i = {
879
- platform: Fe,
880
- ...o
881
- }, r = {
882
- ...i.platform,
883
- _c: n
884
- };
885
- return he(t, e, {
886
- ...i,
887
- platform: r
888
- });
889
- };
890
- var nt = typeof document < "u" ? qt : Pt;
891
- function lt(t, e) {
892
- if (t === e)
893
- return !0;
894
- if (typeof t != typeof e)
895
- return !1;
896
- if (typeof t == "function" && t.toString() === e.toString())
897
- return !0;
898
- let o, n, i;
899
- if (t && e && typeof t == "object") {
900
- if (Array.isArray(t)) {
901
- if (o = t.length, o !== e.length)
902
- return !1;
903
- for (n = o; n-- !== 0; )
904
- if (!lt(t[n], e[n]))
905
- return !1;
906
- return !0;
907
- }
908
- if (i = Object.keys(t), o = i.length, o !== Object.keys(e).length)
909
- return !1;
910
- for (n = o; n-- !== 0; )
911
- if (!{}.hasOwnProperty.call(e, i[n]))
912
- return !1;
913
- for (n = o; n-- !== 0; ) {
914
- const r = i[n];
915
- if (!(r === "_owner" && t.$$typeof) && !lt(t[r], e[r]))
916
- return !1;
917
- }
918
- return !0;
919
- }
920
- return t !== t && e !== e;
921
- }
922
- function zt(t) {
923
- return typeof window > "u" ? 1 : (t.ownerDocument.defaultView || window).devicePixelRatio || 1;
924
- }
925
- function Ot(t, e) {
926
- const o = zt(t);
927
- return Math.round(e * o) / o;
928
- }
929
- function Nt(t) {
930
- const e = w.useRef(t);
931
- return nt(() => {
932
- e.current = t;
933
- }), e;
934
- }
935
- function $e(t) {
936
- t === void 0 && (t = {});
937
- const {
938
- placement: e = "bottom",
939
- strategy: o = "absolute",
940
- middleware: n = [],
941
- platform: i,
942
- elements: {
943
- reference: r,
944
- floating: s
945
- } = {},
946
- transform: l = !0,
947
- whileElementsMounted: c,
948
- open: a
949
- } = t, [f, u] = w.useState({
950
- x: 0,
951
- y: 0,
952
- strategy: o,
953
- placement: e,
954
- middlewareData: {},
955
- isPositioned: !1
956
- }), [m, d] = w.useState(n);
957
- lt(m, n) || d(n);
958
- const [g, x] = w.useState(null), [v, h] = w.useState(null), y = w.useCallback((R) => {
959
- R !== A.current && (A.current = R, x(R));
960
- }, []), b = w.useCallback((R) => {
961
- R !== N.current && (N.current = R, h(R));
962
- }, []), C = r || g, E = s || v, A = w.useRef(null), N = w.useRef(null), _ = w.useRef(f), z = c != null, j = Nt(c), B = Nt(i), T = w.useCallback(() => {
963
- if (!A.current || !N.current)
964
- return;
965
- const R = {
966
- placement: e,
967
- strategy: o,
968
- middleware: m
969
- };
970
- B.current && (R.platform = B.current), We(A.current, N.current, R).then((Y) => {
971
- const q = {
972
- ...Y,
973
- isPositioned: !0
974
- };
975
- W.current && !lt(_.current, q) && (_.current = q, ne.flushSync(() => {
976
- u(q);
977
- }));
978
- });
979
- }, [m, e, o, B]);
980
- nt(() => {
981
- a === !1 && _.current.isPositioned && (_.current.isPositioned = !1, u((R) => ({
982
- ...R,
983
- isPositioned: !1
984
- })));
985
- }, [a]);
986
- const W = w.useRef(!1);
987
- nt(() => (W.current = !0, () => {
988
- W.current = !1;
989
- }), []), nt(() => {
990
- if (C && (A.current = C), E && (N.current = E), C && E) {
991
- if (j.current)
992
- return j.current(C, E, T);
993
- T();
994
- }
995
- }, [C, E, T, j, z]);
996
- const k = w.useMemo(() => ({
997
- reference: A,
998
- floating: N,
999
- setReference: y,
1000
- setFloating: b
1001
- }), [y, b]), O = w.useMemo(() => ({
1002
- reference: C,
1003
- floating: E
1004
- }), [C, E]), M = w.useMemo(() => {
1005
- const R = {
1006
- position: o,
1007
- left: 0,
1008
- top: 0
1009
- };
1010
- if (!O.floating)
1011
- return R;
1012
- const Y = Ot(O.floating, f.x), q = Ot(O.floating, f.y);
1013
- return l ? {
1014
- ...R,
1015
- transform: "translate(" + Y + "px, " + q + "px)",
1016
- ...zt(O.floating) >= 1.5 && {
1017
- willChange: "transform"
1018
- }
1019
- } : {
1020
- position: o,
1021
- left: Y,
1022
- top: q
1023
- };
1024
- }, [o, l, O.floating, f.x, f.y]);
1025
- return w.useMemo(() => ({
1026
- ...f,
1027
- update: T,
1028
- refs: k,
1029
- elements: O,
1030
- floatingStyles: M
1031
- }), [f, T, k, O, M]);
1032
- }
1033
- const It = "Popup";
1034
- function He(t) {
1035
- return Gt(It, t);
1036
- }
1037
- Jt(It, ["root", "open"]);
1038
- const xt = /* @__PURE__ */ w.createContext(null);
1039
- process.env.NODE_ENV !== "production" && (xt.displayName = "TransitionContext");
1040
- function ze() {
1041
- const t = w.useContext(xt);
1042
- if (!t)
2
+ import { jsx as a, jsxs as v, Fragment as P } from "react/jsx-runtime";
3
+ import * as u from "react";
4
+ import { useRef as R, useState as T, useEffect as E, isValidElement as q, cloneElement as M } from "react";
5
+ import { T as O, P as V } from "../../Popup-B6ZSGIEI.js";
6
+ import { _ as $, b as z, P as l } from "../../index-CH45lKw7.js";
7
+ import { c as D } from "../../clsx-DB4S2d7J.js";
8
+ import { C as F } from "../../ClickAwayListener-BSW-Nd-y.js";
9
+ function I() {
10
+ const e = u.useContext(O);
11
+ if (!e)
1043
12
  throw new Error("Missing transition context");
1044
13
  const {
1045
- registerTransition: e,
1046
- requestedEnter: o,
14
+ registerTransition: o,
15
+ requestedEnter: r,
1047
16
  onExited: n
1048
- } = t;
1049
- return w.useEffect(() => e(), [e]), {
17
+ } = e;
18
+ return u.useEffect(() => o(), [o]), {
1050
19
  onExited: n,
1051
- requestedEnter: o
20
+ requestedEnter: r
1052
21
  };
1053
22
  }
1054
- function Ie(t) {
1055
- const [e, o] = w.useState(!0), n = w.useRef(!1), i = w.useRef(0), [r, s] = w.useState(!1), l = w.useRef(t);
1056
- w.useEffect(() => {
1057
- !t && // checking registeredTransitions.current instead of hasTransition to avoid this effect re-firing whenever hasTransition changes
1058
- i.current > 0 && // prevents waiting for a pending transition right after mounting
1059
- l.current !== t && (n.current = !0, o(!1)), l.current = t;
1060
- }, [t]);
1061
- const c = w.useCallback(() => {
1062
- n.current = !1, o(!0);
1063
- }, []), a = w.useCallback(() => (i.current += 1, s(!0), () => {
1064
- i.current -= 1, i.current === 0 && s(!1);
1065
- }), []);
1066
- let f;
1067
- return r ? t ? f = !1 : f = !n.current && e : f = !t, {
1068
- contextValue: w.useMemo(() => ({
1069
- requestedEnter: t,
1070
- onExited: c,
1071
- registerTransition: a,
1072
- hasExited: f
1073
- }), [c, t, a, f]),
1074
- hasExited: f
1075
- };
1076
- }
1077
- const Ut = /* @__PURE__ */ w.createContext(null);
1078
- process.env.NODE_ENV !== "production" && (Ut.displayName = "PopupContext");
1079
- const Ue = ["anchor", "children", "container", "disablePortal", "keepMounted", "middleware", "offset", "open", "placement", "slotProps", "slots", "strategy"];
1080
- function Xe(t) {
23
+ const W = ["children", "className", "enterAnimationName", "enterClassName", "exitAnimationName", "exitClassName"];
24
+ function b(e) {
1081
25
  const {
1082
- open: e
1083
- } = t;
1084
- return te({
1085
- root: ["root", e && "open"]
1086
- }, ee(He));
1087
- }
1088
- function Ye(t) {
1089
- return typeof t == "function" ? t() : t;
1090
- }
1091
- const Xt = /* @__PURE__ */ w.forwardRef(function(e, o) {
1092
- var n;
1093
- const {
1094
- anchor: i,
1095
- children: r,
1096
- container: s,
1097
- disablePortal: l = !1,
1098
- keepMounted: c = !1,
1099
- middleware: a,
1100
- offset: f = 0,
1101
- open: u = !1,
1102
- placement: m = "bottom",
1103
- slotProps: d = {},
1104
- slots: g = {},
1105
- strategy: x = "absolute"
1106
- } = e, v = _t(e, Ue), {
1107
- refs: h,
1108
- elements: y,
1109
- floatingStyles: b,
1110
- update: C,
1111
- placement: E
1112
- } = $e({
1113
- elements: {
1114
- reference: Ye(i)
1115
- },
1116
- open: u,
1117
- middleware: a ?? [Tt(f ?? 0), Be(), je()],
1118
- placement: m,
1119
- strategy: x,
1120
- whileElementsMounted: c ? void 0 : At
1121
- }), A = Qt(h.setFloating, o);
1122
- oe(() => {
1123
- if (c && u && y.reference && y.floating)
1124
- return At(y.reference, y.floating, C);
1125
- }, [c, u, y, C]);
1126
- const N = et({}, e, {
1127
- disablePortal: l,
1128
- keepMounted: c,
1129
- offset: Tt,
1130
- open: u,
1131
- placement: m,
1132
- finalPlacement: E,
1133
- strategy: x
1134
- }), {
1135
- contextValue: _,
1136
- hasExited: z
1137
- } = Ie(u), j = c && z ? "hidden" : void 0, B = Xe(N), T = (n = g == null ? void 0 : g.root) != null ? n : "div", W = Zt({
1138
- elementType: T,
1139
- externalSlotProps: d.root,
1140
- externalForwardedProps: v,
1141
- ownerState: N,
1142
- className: B.root,
1143
- additionalProps: {
1144
- ref: A,
1145
- role: "tooltip",
1146
- style: et({}, b, {
1147
- visibility: j
1148
- })
1149
- }
1150
- }), k = w.useMemo(() => ({
1151
- placement: E
1152
- }), [E]);
1153
- return c || !z ? /* @__PURE__ */ L(ie, {
1154
- disablePortal: l,
1155
- container: s,
1156
- children: /* @__PURE__ */ L(Ut.Provider, {
1157
- value: k,
1158
- children: /* @__PURE__ */ L(xt.Provider, {
1159
- value: _,
1160
- children: /* @__PURE__ */ L(T, et({}, W, {
1161
- children: r
1162
- }))
1163
- })
1164
- })
1165
- }) : null;
1166
- });
1167
- process.env.NODE_ENV !== "production" && (Xt.propTypes = {
1168
- // ┌────────────────────────────── Warning ──────────────────────────────┐
1169
- // │ These PropTypes are generated from the TypeScript type definitions. │
1170
- // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
1171
- // └─────────────────────────────────────────────────────────────────────┘
1172
- /**
1173
- * An HTML element, [virtual element](https://floating-ui.com/docs/virtual-elements),
1174
- * or a function that returns either.
1175
- * It's used to set the position of the popup.
1176
- */
1177
- anchor: p.oneOfType([wt, p.object, p.func]),
1178
- /**
1179
- * @ignore
1180
- */
1181
- children: p.oneOfType([p.node, p.func]),
1182
- /**
1183
- * An HTML element or function that returns one. The container will have the portal children appended to it.
1184
- * By default, it uses the body of the top-level document object, so it's `document.body` in these cases.
1185
- */
1186
- container: p.oneOfType([wt, p.func]),
1187
- /**
1188
- * If `true`, the popup will be rendered where it is defined, without the use of portals.
1189
- * @default false
1190
- */
1191
- disablePortal: p.bool,
1192
- /**
1193
- * If `true`, the popup will exist in the DOM even if it's closed.
1194
- * Its visibility will be controlled by the `visibility` CSS property.
1195
- *
1196
- * Otherwise, a closed popup will be removed from the DOM.
1197
- *
1198
- * @default false
1199
- */
1200
- keepMounted: p.bool,
1201
- /**
1202
- * Collection of Floating UI middleware to use when positioning the popup.
1203
- * If not provided, the [`offset`](https://floating-ui.com/docs/offset)
1204
- * and [`flip`](https://floating-ui.com/docs/flip) functions will be used.
1205
- *
1206
- * @see https://floating-ui.com/docs/computePosition#middleware
1207
- */
1208
- middleware: p.arrayOf(p.oneOfType([p.oneOf([!1]), p.shape({
1209
- fn: p.func.isRequired,
1210
- name: p.string.isRequired,
1211
- options: p.any
1212
- })])),
1213
- /**
1214
- * Distance between a popup and the trigger element.
1215
- * This prop is ignored when custom `middleware` is provided.
1216
- *
1217
- * @default 0
1218
- * @see https://floating-ui.com/docs/offset
1219
- */
1220
- offset: p.oneOfType([p.func, p.number, p.shape({
1221
- alignmentAxis: p.number,
1222
- crossAxis: p.number,
1223
- mainAxis: p.number
1224
- })]),
1225
- /**
1226
- * If `true`, the popup is visible.
1227
- *
1228
- * @default false
1229
- */
1230
- open: p.bool,
1231
- /**
1232
- * Determines where to place the popup relative to the trigger element.
1233
- *
1234
- * @default 'bottom'
1235
- * @see https://floating-ui.com/docs/computePosition#placement
1236
- */
1237
- placement: p.oneOf(["bottom-end", "bottom-start", "bottom", "left-end", "left-start", "left", "right-end", "right-start", "right", "top-end", "top-start", "top"]),
1238
- /**
1239
- * The props used for each slot inside the Popup.
1240
- *
1241
- * @default {}
1242
- */
1243
- slotProps: p.shape({
1244
- root: p.oneOfType([p.func, p.object])
1245
- }),
1246
- /**
1247
- * The components used for each slot inside the Popup.
1248
- * Either a string to use a HTML element or a component.
1249
- *
1250
- * @default {}
1251
- */
1252
- slots: p.shape({
1253
- root: p.elementType
1254
- }),
1255
- /**
1256
- * The type of CSS position property to use (absolute or fixed).
1257
- *
1258
- * @default 'absolute'
1259
- * @see https://floating-ui.com/docs/computePosition#strategy
1260
- */
1261
- strategy: p.oneOf(["absolute", "fixed"])
1262
- });
1263
- const qe = ["children", "className", "enterAnimationName", "enterClassName", "exitAnimationName", "exitClassName"];
1264
- function Yt(t) {
1265
- const {
1266
- children: e,
1267
- className: o,
26
+ children: o,
27
+ className: r,
1268
28
  enterAnimationName: n,
1269
- enterClassName: i,
1270
- exitAnimationName: r,
1271
- exitClassName: s
1272
- } = t, l = _t(t, qe), {
1273
- requestedEnter: c,
1274
- onExited: a
1275
- } = ze(), f = w.useRef(!0);
1276
- w.useEffect(() => {
1277
- c && f.current && (f.current = !1);
1278
- }, [c]);
1279
- const u = w.useCallback((m) => {
1280
- m.animationName === r ? (a(), f.current = !0) : m.animationName === n && (f.current = !1);
1281
- }, [a, r, n]);
1282
- return /* @__PURE__ */ L("div", et({
1283
- onAnimationEnd: u,
1284
- className: re(o, c ? i : s)
1285
- }, l, {
1286
- children: e
29
+ enterClassName: c,
30
+ exitAnimationName: _,
31
+ exitClassName: f
32
+ } = e, p = $(e, W), {
33
+ requestedEnter: d,
34
+ onExited: s
35
+ } = I(), i = u.useRef(!0);
36
+ u.useEffect(() => {
37
+ d && i.current && (i.current = !1);
38
+ }, [d]);
39
+ const N = u.useCallback((t) => {
40
+ t.animationName === _ ? (s(), i.current = !0) : t.animationName === n && (i.current = !1);
41
+ }, [s, _, n]);
42
+ return /* @__PURE__ */ a("div", z({
43
+ onAnimationEnd: N,
44
+ className: D(r, d ? c : f)
45
+ }, p, {
46
+ children: o
1287
47
  }));
1288
48
  }
1289
- process.env.NODE_ENV !== "production" && (Yt.propTypes = {
1290
- children: p.node,
1291
- className: p.string,
1292
- enterAnimationName: p.string,
1293
- enterClassName: p.string,
1294
- exitAnimationName: p.string,
1295
- exitClassName: p.string
49
+ process.env.NODE_ENV !== "production" && (b.propTypes = {
50
+ children: l.node,
51
+ className: l.string,
52
+ enterAnimationName: l.string,
53
+ enterClassName: l.string,
54
+ exitAnimationName: l.string,
55
+ exitClassName: l.string
1296
56
  });
1297
- const Ke = "_tooltip_1dujm_1", K = {
1298
- tooltip: Ke,
57
+ const B = "_tooltip_1dujm_1", m = {
58
+ tooltip: B,
1299
59
  "tooltip--small-padding": "_tooltip--small-padding_1dujm_5",
1300
60
  "tooltip--normal-padding": "_tooltip--normal-padding_1dujm_8",
1301
61
  "tooltip--white-theme": "_tooltip--white-theme_1dujm_11",
@@ -1305,62 +65,77 @@ const Ke = "_tooltip_1dujm_1", K = {
1305
65
  "tooltip--open-animation": "_tooltip--open-animation_1dujm_1",
1306
66
  "tooltip--anim-close": "_tooltip--anim-close_1dujm_23",
1307
67
  "tooltip--close-animation": "_tooltip--close-animation_1dujm_1"
1308
- }, sn = ({
1309
- children: t,
1310
- show: e,
1311
- anchorRef: o,
1312
- onClose: n,
1313
- arialRole: i,
1314
- position: r = "bottom",
1315
- theme: s = "black",
1316
- padding: l = "small",
1317
- className: c,
1318
- disableHoverListener: a,
1319
- ...f
68
+ }, X = ({
69
+ arialRole: e,
70
+ children: o,
71
+ className: r,
72
+ disableHoverListener: n,
73
+ onClose: c,
74
+ padding: _ = "small",
75
+ position: f = "bottom",
76
+ open: p,
77
+ theme: d = "black",
78
+ title: s,
79
+ onTargetCreated: i,
80
+ ...N
1320
81
  }) => {
1321
- const u = Kt(null), [m, d] = yt(e || !1), [g, x] = yt(o || null);
1322
- Pt(() => {
1323
- var b;
1324
- if (!o && (u != null && u.current)) {
1325
- const C = (b = u == null ? void 0 : u.current) == null ? void 0 : b.parentElement;
1326
- C && (a || (C.onpointerenter = () => d(!0), C.onpointerleave = () => d(!1)), x(C));
82
+ const t = R(null), [y, h] = T(p || !1);
83
+ let j = y;
84
+ E(() => {
85
+ h(p || !1);
86
+ }, [p]);
87
+ const A = q(o) ? o : /* @__PURE__ */ a("span", { children: o });
88
+ !s && s !== 0 && (j = !1);
89
+ const k = () => {
90
+ c == null || c(), !n && h(!1);
91
+ };
92
+ E(() => {
93
+ var C;
94
+ if (t != null && t.current) {
95
+ i == null || i(t == null ? void 0 : t.current);
96
+ const x = (C = t == null ? void 0 : t.current) == null ? void 0 : C.parentElement;
97
+ x && (n || (x.onpointerenter = () => h(!0), x.onpointerleave = () => h(!1)));
1327
98
  }
1328
- }, [u, a, o]);
1329
- const v = (b) => {
1330
- o != null && o.contains(b.target) || (n == null || n(), !a && d(!1));
1331
- }, h = {
1332
- padding: r.match(/(bottom|top)/) ? ".25rem 0" : "0 .25rem",
99
+ }, [t, n]);
100
+ const w = {
101
+ padding: f.match(/(bottom|top)/) ? ".25rem 0" : "0 .25rem",
1333
102
  zIndex: 1
1334
- }, y = [
1335
- K.tooltip,
1336
- K[`tooltip--${s}-theme`],
1337
- K[`tooltip--${l}-padding`],
1338
- c || ""
1339
- ].join(" ").trim();
1340
- return /* @__PURE__ */ L("span", { ref: u, children: /* @__PURE__ */ L(
1341
- Xt,
1342
- {
1343
- ...f,
1344
- open: e || m,
1345
- anchor: g,
1346
- disablePortal: !0,
1347
- style: h,
1348
- role: i,
1349
- placement: r,
1350
- children: /* @__PURE__ */ L(
1351
- Yt,
1352
- {
1353
- className: K["tooltip--animation"],
1354
- enterClassName: K["tooltip--anim-open"],
1355
- exitClassName: K["tooltip--anim-close"],
1356
- enterAnimationName: "tooltip--open-animation",
1357
- exitAnimationName: "tooltip--close-animation",
1358
- children: /* @__PURE__ */ L("div", { className: y, children: /* @__PURE__ */ L(se, { onClickAway: v, children: /* @__PURE__ */ L("div", { children: t }) }) })
1359
- }
1360
- )
1361
- }
1362
- ) });
103
+ }, S = [
104
+ m.tooltip,
105
+ m[`tooltip--${d}-theme`],
106
+ m[`tooltip--${_}-padding`],
107
+ r || ""
108
+ ].join(" ").trim(), g = {
109
+ ...A.props,
110
+ ref: t
111
+ };
112
+ return /* @__PURE__ */ v(P, { children: [
113
+ M(A, g),
114
+ /* @__PURE__ */ a(
115
+ V,
116
+ {
117
+ ...N,
118
+ open: j,
119
+ anchor: t == null ? void 0 : t.current,
120
+ disablePortal: !0,
121
+ style: w,
122
+ role: e,
123
+ placement: f,
124
+ children: /* @__PURE__ */ a(
125
+ b,
126
+ {
127
+ className: m["tooltip--animation"],
128
+ enterClassName: m["tooltip--anim-open"],
129
+ exitClassName: m["tooltip--anim-close"],
130
+ enterAnimationName: "tooltip--open-animation",
131
+ exitAnimationName: "tooltip--close-animation",
132
+ children: /* @__PURE__ */ a("div", { className: S, children: /* @__PURE__ */ a(F, { onClickAway: k, children: /* @__PURE__ */ a("div", { children: s }) }) })
133
+ }
134
+ )
135
+ }
136
+ )
137
+ ] });
1363
138
  };
1364
139
  export {
1365
- sn as Tooltip
140
+ X as Tooltip
1366
141
  };