@lazar-ui/kit 0.1.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 (100) hide show
  1. package/README.md +182 -0
  2. package/dist/Overlay-RmiBtqDR.mjs +1011 -0
  3. package/dist/accordion.css +1 -0
  4. package/dist/accordion.d.ts +53 -0
  5. package/dist/accordion.js +48 -0
  6. package/dist/alert.css +1 -0
  7. package/dist/alert.d.ts +33 -0
  8. package/dist/alert.js +20 -0
  9. package/dist/avatar.css +1 -0
  10. package/dist/avatar.d.ts +34 -0
  11. package/dist/avatar.js +41 -0
  12. package/dist/badge.css +1 -0
  13. package/dist/badge.d.ts +33 -0
  14. package/dist/badge.js +23 -0
  15. package/dist/breadcrumbs.css +1 -0
  16. package/dist/breadcrumbs.d.ts +80 -0
  17. package/dist/breadcrumbs.js +63 -0
  18. package/dist/button.css +1 -0
  19. package/dist/button.d.ts +66 -0
  20. package/dist/button.js +46 -0
  21. package/dist/camelCase-PtIYufW8.mjs +528 -0
  22. package/dist/card.css +1 -0
  23. package/dist/card.d.ts +42 -0
  24. package/dist/card.js +24 -0
  25. package/dist/checkbox.css +1 -0
  26. package/dist/checkbox.d.ts +41 -0
  27. package/dist/checkbox.js +42 -0
  28. package/dist/clsx-OuTLNxxd.mjs +16 -0
  29. package/dist/config-provider.d.ts +78 -0
  30. package/dist/config-provider.js +14 -0
  31. package/dist/css/palettes/indigo.css +104 -0
  32. package/dist/css/palettes/monochrome.css +104 -0
  33. package/dist/css/semantic.css +113 -0
  34. package/dist/dialog.css +1 -0
  35. package/dist/dialog.d.ts +91 -0
  36. package/dist/dialog.js +75 -0
  37. package/dist/drawer.css +1 -0
  38. package/dist/drawer.d.ts +128 -0
  39. package/dist/drawer.js +106 -0
  40. package/dist/empty-state.css +1 -0
  41. package/dist/empty-state.d.ts +33 -0
  42. package/dist/empty-state.js +52 -0
  43. package/dist/error-boundary.css +1 -0
  44. package/dist/error-boundary.d.ts +55 -0
  45. package/dist/error-boundary.js +37 -0
  46. package/dist/flex.css +1 -0
  47. package/dist/flex.d.ts +68 -0
  48. package/dist/flex.js +73 -0
  49. package/dist/form-field.css +1 -0
  50. package/dist/form-field.d.ts +27 -0
  51. package/dist/form-field.js +22 -0
  52. package/dist/getComponentSlots-DwAYUFNk.mjs +16 -0
  53. package/dist/getVariantClassName-D7Nhpuec.mjs +8 -0
  54. package/dist/input.css +1 -0
  55. package/dist/input.d.ts +39 -0
  56. package/dist/input.js +146 -0
  57. package/dist/isValidReactNode-CmYwTWCE.mjs +18 -0
  58. package/dist/menu.css +1 -0
  59. package/dist/menu.d.ts +94 -0
  60. package/dist/menu.js +135 -0
  61. package/dist/pagination.css +1 -0
  62. package/dist/pagination.d.ts +40 -0
  63. package/dist/pagination.js +74 -0
  64. package/dist/popover.css +1 -0
  65. package/dist/popover.d.ts +54 -0
  66. package/dist/popover.js +65 -0
  67. package/dist/select.css +1 -0
  68. package/dist/select.d.ts +64 -0
  69. package/dist/select.js +170 -0
  70. package/dist/separator.css +1 -0
  71. package/dist/separator.d.ts +25 -0
  72. package/dist/separator.js +24 -0
  73. package/dist/skeleton.css +1 -0
  74. package/dist/skeleton.d.ts +38 -0
  75. package/dist/skeleton.js +27 -0
  76. package/dist/spinner.css +1 -0
  77. package/dist/spinner.d.ts +31 -0
  78. package/dist/spinner.js +29 -0
  79. package/dist/switch.css +1 -0
  80. package/dist/switch.d.ts +44 -0
  81. package/dist/switch.js +37 -0
  82. package/dist/table.css +1 -0
  83. package/dist/table.d.ts +60 -0
  84. package/dist/table.js +40 -0
  85. package/dist/tabs.css +1 -0
  86. package/dist/tabs.d.ts +69 -0
  87. package/dist/tabs.js +79 -0
  88. package/dist/textarea.css +1 -0
  89. package/dist/textarea.d.ts +53 -0
  90. package/dist/textarea.js +46 -0
  91. package/dist/tooltip.css +1 -0
  92. package/dist/tooltip.d.ts +38 -0
  93. package/dist/tooltip.js +99 -0
  94. package/dist/useLocale-D2Z0JH0l.mjs +70 -0
  95. package/dist/useModalOverlay-D5Bs9FCB.mjs +486 -0
  96. package/dist/useOverlayPosition-DVu1Qziq.mjs +451 -0
  97. package/dist/useOverlayTriggerState-BIo1Jcba.mjs +221 -0
  98. package/dist/utils.d.ts +58 -0
  99. package/dist/utils.js +18 -0
  100. package/package.json +76 -0
@@ -0,0 +1,451 @@
1
+ import { m as he, c as we, $ as re, t as xe, d as ve, a as Le, b as V, l as B } from "./Overlay-RmiBtqDR.mjs";
2
+ import Ee, { useState as ne, useEffect as _, useContext as Te, useRef as W, useCallback as j } from "react";
3
+ const Pe = /* @__PURE__ */ new Set([
4
+ "Arab",
5
+ "Syrc",
6
+ "Samr",
7
+ "Mand",
8
+ "Thaa",
9
+ "Mend",
10
+ "Nkoo",
11
+ "Adlm",
12
+ "Rohg",
13
+ "Hebr"
14
+ ]), Re = /* @__PURE__ */ new Set([
15
+ "ae",
16
+ "ar",
17
+ "arc",
18
+ "bcc",
19
+ "bqi",
20
+ "ckb",
21
+ "dv",
22
+ "fa",
23
+ "glk",
24
+ "he",
25
+ "ku",
26
+ "mzn",
27
+ "nqo",
28
+ "pnb",
29
+ "ps",
30
+ "sd",
31
+ "ug",
32
+ "ur",
33
+ "yi"
34
+ ]);
35
+ function Ie(e) {
36
+ if (Intl.Locale) {
37
+ let o = new Intl.Locale(e).maximize(), r = typeof o.getTextInfo == "function" ? o.getTextInfo() : o.textInfo;
38
+ if (r) return r.direction === "rtl";
39
+ if (o.script) return Pe.has(o.script);
40
+ }
41
+ let t = e.split("-")[0];
42
+ return Re.has(t);
43
+ }
44
+ const ae = Symbol.for("react-aria.i18n.locale");
45
+ function ie() {
46
+ let e = typeof window < "u" && window[ae] || typeof navigator < "u" && (navigator.language || navigator.userLanguage) || "en-US";
47
+ try {
48
+ Intl.DateTimeFormat.supportedLocalesOf([
49
+ e
50
+ ]);
51
+ } catch {
52
+ e = "en-US";
53
+ }
54
+ return {
55
+ locale: e,
56
+ direction: Ie(e) ? "rtl" : "ltr"
57
+ };
58
+ }
59
+ let X = ie(), A = /* @__PURE__ */ new Set();
60
+ function J() {
61
+ X = ie();
62
+ for (let e of A) e(X);
63
+ }
64
+ function Ce() {
65
+ let e = he(), [t, o] = ne(X);
66
+ return _(() => (A.size === 0 && window.addEventListener("languagechange", J), A.add(o), () => {
67
+ A.delete(o), A.size === 0 && window.removeEventListener("languagechange", J);
68
+ }), []), e ? {
69
+ locale: typeof window < "u" && window[ae] || "en-US",
70
+ direction: "ltr"
71
+ } : t;
72
+ }
73
+ const He = /* @__PURE__ */ Ee.createContext(null);
74
+ function Se() {
75
+ let e = Ce();
76
+ return Te(He) || e;
77
+ }
78
+ function Z(e, t = -1 / 0, o = 1 / 0) {
79
+ return Math.min(Math.max(e, t), o);
80
+ }
81
+ const Me = /* @__PURE__ */ new WeakMap();
82
+ function ze(e) {
83
+ let { triggerRef: t, isOpen: o, onClose: r } = e;
84
+ _(() => {
85
+ if (!o || r === null) return;
86
+ let l = (n) => {
87
+ let a = we(n);
88
+ if (!t.current || a instanceof Node && !re(a, t.current) || a instanceof HTMLInputElement || a instanceof HTMLTextAreaElement) return;
89
+ let i = r || Me.get(t.current);
90
+ i && i();
91
+ };
92
+ return window.addEventListener("scroll", l, !0), () => {
93
+ window.removeEventListener("scroll", l, !0);
94
+ };
95
+ }, [
96
+ o,
97
+ r,
98
+ t
99
+ ]);
100
+ }
101
+ function ye() {
102
+ return typeof window.ResizeObserver < "u";
103
+ }
104
+ function K(e) {
105
+ const { ref: t, box: o, onResize: r } = e;
106
+ let l = xe(r);
107
+ _(() => {
108
+ let n = t?.current;
109
+ if (n)
110
+ if (ye()) {
111
+ const a = new window.ResizeObserver((i) => {
112
+ i.length && l();
113
+ });
114
+ return a.observe(n, {
115
+ box: o
116
+ }), () => {
117
+ n && a.unobserve(n);
118
+ };
119
+ } else
120
+ return window.addEventListener("resize", l, !1), () => {
121
+ window.removeEventListener("resize", l, !1);
122
+ };
123
+ }, [
124
+ t,
125
+ o
126
+ ]);
127
+ }
128
+ const C = {
129
+ top: "top",
130
+ bottom: "top",
131
+ left: "left",
132
+ right: "left"
133
+ }, F = {
134
+ top: "bottom",
135
+ bottom: "top",
136
+ left: "right",
137
+ right: "left"
138
+ }, Ae = {
139
+ top: "left",
140
+ left: "top"
141
+ }, q = {
142
+ top: "height",
143
+ left: "width"
144
+ }, ce = {
145
+ width: "totalWidth",
146
+ height: "totalHeight"
147
+ }, N = {};
148
+ let ke = () => typeof document < "u" ? window.visualViewport : null;
149
+ function Q(e, t) {
150
+ let o = 0, r = 0, l = 0, n = 0, a = 0, i = 0, s = {}, c = (t?.scale ?? 1) > 1;
151
+ if (e.tagName === "BODY" || e.tagName === "HTML") {
152
+ let p = document.documentElement;
153
+ l = p.clientWidth, n = p.clientHeight, o = t?.width ?? l, r = t?.height ?? n, s.top = p.scrollTop || e.scrollTop, s.left = p.scrollLeft || e.scrollLeft, t && (a = t.offsetTop, i = t.offsetLeft);
154
+ } else
155
+ ({ width: o, height: r, top: a, left: i } = k(e, !1)), s.top = e.scrollTop, s.left = e.scrollLeft, l = o, n = r;
156
+ return ve() && (e.tagName === "BODY" || e.tagName === "HTML") && c && (s.top = 0, s.left = 0, a = t?.pageTop ?? 0, i = t?.pageLeft ?? 0), {
157
+ width: o,
158
+ height: r,
159
+ totalWidth: l,
160
+ totalHeight: n,
161
+ scroll: s,
162
+ top: a,
163
+ left: i
164
+ };
165
+ }
166
+ function Ne(e) {
167
+ return {
168
+ top: e.scrollTop,
169
+ left: e.scrollLeft,
170
+ width: e.scrollWidth,
171
+ height: e.scrollHeight
172
+ };
173
+ }
174
+ function D(e, t, o, r, l, n, a) {
175
+ let i = l.scroll[e] ?? 0, s = r[q[e]], c = a[e] + r.scroll[C[e]] + n, p = a[e] + r.scroll[C[e]] + s - n, x = t - i + r.scroll[C[e]] + a[e] - r[C[e]], m = t - i + o + r.scroll[C[e]] + a[e] - r[C[e]];
176
+ return x < c ? c - x : m > p ? Math.max(p - m, c - x) : 0;
177
+ }
178
+ function Fe(e) {
179
+ let t = window.getComputedStyle(e);
180
+ return {
181
+ top: parseInt(t.marginTop, 10) || 0,
182
+ bottom: parseInt(t.marginBottom, 10) || 0,
183
+ left: parseInt(t.marginLeft, 10) || 0,
184
+ right: parseInt(t.marginRight, 10) || 0
185
+ };
186
+ }
187
+ function ee(e) {
188
+ if (N[e]) return N[e];
189
+ let [t, o] = e.split(" "), r = C[t] || "right", l = Ae[r];
190
+ C[o] || (o = "center");
191
+ let n = q[r], a = q[l];
192
+ return N[e] = {
193
+ placement: t,
194
+ crossPlacement: o,
195
+ axis: r,
196
+ crossAxis: l,
197
+ size: n,
198
+ crossSize: a
199
+ }, N[e];
200
+ }
201
+ function Y(e, t, o, r, l, n, a, i, s, c, p) {
202
+ let { placement: x, crossPlacement: m, axis: b, crossAxis: f, size: h, crossSize: v } = r, E = {};
203
+ E[f] = e[f] ?? 0, m === "center" ? E[f] += ((e[v] ?? 0) - (o[v] ?? 0)) / 2 : m !== f && (E[f] += (e[v] ?? 0) - (o[v] ?? 0)), E[f] += n;
204
+ const d = e[f] - o[v] + s + c, H = e[f] + e[v] - s - c;
205
+ if (E[f] = Z(E[f], d, H), x === b) {
206
+ let u = i ? p[h] : p[ce[h]];
207
+ E[F[b]] = Math.floor(u - e[b] + l);
208
+ } else E[b] = Math.floor(e[b] + e[h] + l);
209
+ return E;
210
+ }
211
+ function _e(e, t, o, r, l, n, a, i, s, c, p) {
212
+ let x = (e.top != null ? e.top : s[ce.height] - (e.bottom ?? 0) - a) - (s.scroll.top ?? 0), m = c ? o.top : 0, b = {
213
+ // This should be boundary top in container coord system vs viewport top in container coord system
214
+ // For the viewport top, there are several cases
215
+ // 1. pinchzoom case where we want the viewports offset top as top here
216
+ // 2. case where container is offset from the boundary and is contained by the boundary. In this case the top we want here is NOT 0, we want to take boundary's top even though is is a negative number OR the visual viewport, whichever is more restrictive
217
+ top: Math.max(t.top + m, (p?.offsetTop ?? t.top) + m),
218
+ bottom: Math.min(t.top + t.height + m, (p?.offsetTop ?? 0) + (p?.height ?? 0))
219
+ };
220
+ return i !== "top" ? (
221
+ // We want the distance between the top of the overlay to the bottom of the boundary
222
+ Math.max(0, b.bottom - x - ((l.top ?? 0) + (l.bottom ?? 0) + n))
223
+ ) : Math.max(0, x + a - b.top - ((l.top ?? 0) + (l.bottom ?? 0) + n));
224
+ }
225
+ function te(e, t, o, r, l, n, a, i) {
226
+ let { placement: s, axis: c, size: p } = n;
227
+ return s === c ? Math.max(0, o[c] - (a.scroll[c] ?? 0) - (e[c] + (i ? t[c] : 0)) - (r[c] ?? 0) - r[F[c]] - l) : Math.max(0, e[p] + e[c] + (i ? t[c] : 0) - o[c] - o[p] + (a.scroll[c] ?? 0) - (r[c] ?? 0) - r[F[c]] - l);
228
+ }
229
+ function Ue(e, t, o, r, l, n, a, i, s, c, p, x, m, b, f, h, v, E) {
230
+ let d = ee(e), { size: H, crossAxis: u, crossSize: P, placement: $, crossPlacement: R } = d, w = Y(t, i, o, d, p, x, c, m, f, h, s), T = p, g = te(i, c, t, l, n + p, d, s, v);
231
+ if (a && o[H] > g) {
232
+ let O = ee(`${F[$]} ${R}`), be = Y(t, i, o, O, p, x, c, m, f, h, s);
233
+ te(i, c, t, l, n + p, O, s, v) > g && (d = O, w = be, T = p);
234
+ }
235
+ let L = "bottom";
236
+ d.axis === "top" ? d.placement === "top" ? L = "top" : d.placement === "bottom" && (L = "bottom") : d.crossAxis === "top" && (d.crossPlacement === "top" ? L = "bottom" : d.crossPlacement === "bottom" && (L = "top"));
237
+ let y = D(u, w[u], o[P], i, s, n, c);
238
+ w[u] += y;
239
+ let I = _e(w, i, c, m, l, n, o.height, L, s, v, E);
240
+ b && b < I && (I = b), o.height = Math.min(o.height, I), w = Y(t, i, o, d, T, x, c, m, f, h, s), y = D(u, w[u], o[P], i, s, n, c), w[u] += y;
241
+ let S = {}, M = t[u] - w[u] - l[C[u]], fe = M + 0.5 * t[P];
242
+ const se = f / 2 + h, pe = C[u] === "left" ? (l.left ?? 0) + (l.right ?? 0) : (l.top ?? 0) + (l.bottom ?? 0), ue = o[P] - pe - f / 2 - h, de = t[u] + f / 2 - (w[u] + l[C[u]]), $e = t[u] + t[P] - f / 2 - (w[u] + l[C[u]]), ge = Z(fe, de, $e);
243
+ S[u] = Z(ge, se, ue), { placement: $, crossPlacement: R } = d, f ? M = S[u] : R === "right" ? M += t[P] : R === "center" && (M += t[P] / 2);
244
+ let G = $ === "left" || $ === "top" ? o[H] : 0, me = {
245
+ x: $ === "top" || $ === "bottom" ? M : G,
246
+ y: $ === "left" || $ === "right" ? M : G
247
+ };
248
+ return {
249
+ position: w,
250
+ maxHeight: I,
251
+ arrowOffsetLeft: S.left,
252
+ arrowOffsetTop: S.top,
253
+ placement: $,
254
+ triggerAnchorPoint: me
255
+ };
256
+ }
257
+ function Oe(e) {
258
+ let { placement: t, targetNode: o, overlayNode: r, scrollNode: l, padding: n, shouldFlip: a, boundaryElement: i, offset: s, crossOffset: c, maxHeight: p, arrowSize: x = 0, arrowBoundaryOffset: m = 0 } = e, b = ke(), f = r instanceof HTMLElement ? Ye(r) : document.documentElement, h = f === document.documentElement;
259
+ const v = window.getComputedStyle(f).position;
260
+ let E = !!v && v !== "static", d = h ? k(o, !1) : oe(o, f, !1);
261
+ if (!h) {
262
+ let { marginTop: g, marginLeft: L } = window.getComputedStyle(o);
263
+ d.top += parseInt(g, 10) || 0, d.left += parseInt(L, 10) || 0;
264
+ }
265
+ let H = k(r, !0), u = Fe(r);
266
+ H.width += (u.left ?? 0) + (u.right ?? 0), H.height += (u.top ?? 0) + (u.bottom ?? 0);
267
+ let P = Ne(l), $ = Q(i, b), R = Q(f, b), w;
268
+ if ((i.tagName === "BODY" || i.tagName === "HTML") && !h) {
269
+ let g = U(f, !1);
270
+ w = {
271
+ top: -(g.top - $.top),
272
+ left: -(g.left - $.left),
273
+ width: 0,
274
+ height: 0
275
+ };
276
+ } else (i.tagName === "BODY" || i.tagName === "HTML") && h ? w = {
277
+ top: 0,
278
+ left: 0,
279
+ width: 0,
280
+ height: 0
281
+ } : w = oe(i, f, !1);
282
+ let T = re(i, f);
283
+ return Ue(t, d, H, P, u, n, a, $, R, w, s, c, E, p, x, m, T, b);
284
+ }
285
+ function U(e, t) {
286
+ let { top: o, left: r, width: l, height: n } = e.getBoundingClientRect();
287
+ return t && e instanceof e.ownerDocument.defaultView.HTMLElement && (l = e.offsetWidth, n = e.offsetHeight), {
288
+ top: o,
289
+ left: r,
290
+ width: l,
291
+ height: n
292
+ };
293
+ }
294
+ function k(e, t) {
295
+ let { top: o, left: r, width: l, height: n } = U(e, t), { scrollTop: a, scrollLeft: i, clientTop: s, clientLeft: c } = document.documentElement;
296
+ return {
297
+ top: o + a - s,
298
+ left: r + i - c,
299
+ width: l,
300
+ height: n
301
+ };
302
+ }
303
+ function oe(e, t, o) {
304
+ let r = window.getComputedStyle(e), l;
305
+ if (r.position === "fixed") l = U(e, o);
306
+ else {
307
+ l = k(e, o);
308
+ let n = k(t, o), a = window.getComputedStyle(t);
309
+ n.top += (parseInt(a.borderTopWidth, 10) || 0) - t.scrollTop, n.left += (parseInt(a.borderLeftWidth, 10) || 0) - t.scrollLeft, l.top -= n.top, l.left -= n.left;
310
+ }
311
+ return l.top -= parseInt(r.marginTop, 10) || 0, l.left -= parseInt(r.marginLeft, 10) || 0, l;
312
+ }
313
+ function Ye(e) {
314
+ let t = e.offsetParent;
315
+ if (t && t === document.body && window.getComputedStyle(t).position === "static" && !le(t) && (t = document.documentElement), t == null)
316
+ for (t = e.parentElement; t && !le(t); ) t = t.parentElement;
317
+ return t || document.documentElement;
318
+ }
319
+ function le(e) {
320
+ let t = window.getComputedStyle(e);
321
+ return t.transform !== "none" || /transform|perspective/.test(t.willChange) || t.filter !== "none" || t.contain === "paint" || "backdropFilter" in t && t.backdropFilter !== "none" || "WebkitBackdropFilter" in t && t.WebkitBackdropFilter !== "none";
322
+ }
323
+ let z = typeof document < "u" ? window.visualViewport : null;
324
+ function Ve(e) {
325
+ let { direction: t } = Se(), { arrowSize: o, targetRef: r, overlayRef: l, arrowRef: n, scrollRef: a = l, placement: i = "bottom", containerPadding: s = 12, shouldFlip: c = !0, boundaryElement: p = typeof document < "u" ? document.body : null, offset: x = 0, crossOffset: m = 0, shouldUpdatePosition: b = !0, isOpen: f = !0, onClose: h, maxHeight: v, arrowBoundaryOffset: E = 0 } = e, [d, H] = ne(null), u = [
326
+ b,
327
+ i,
328
+ l.current,
329
+ r.current,
330
+ n?.current,
331
+ a.current,
332
+ s,
333
+ c,
334
+ p,
335
+ x,
336
+ m,
337
+ f,
338
+ t,
339
+ v,
340
+ E,
341
+ o
342
+ ], P = W(z?.scale);
343
+ _(() => {
344
+ f && (P.current = z?.scale);
345
+ }, [
346
+ f
347
+ ]);
348
+ let $ = j(() => {
349
+ if (b === !1 || !f || !l.current || !r.current || !p || z?.scale !== P.current) return;
350
+ let T = null;
351
+ if (a.current && Le(a.current)) {
352
+ let I = V()?.getBoundingClientRect(), S = a.current.getBoundingClientRect();
353
+ T = {
354
+ type: "top",
355
+ offset: (I?.top ?? 0) - S.top
356
+ }, T.offset > S.height / 2 && (T.type = "bottom", T.offset = (I?.bottom ?? 0) - S.bottom);
357
+ }
358
+ let g = l.current;
359
+ !v && l.current && (g.style.top = "0px", g.style.bottom = "", g.style.maxHeight = (window.visualViewport?.height ?? window.innerHeight) + "px");
360
+ let L = Oe({
361
+ placement: Xe(i, t),
362
+ overlayNode: l.current,
363
+ targetNode: r.current,
364
+ scrollNode: a.current || l.current,
365
+ padding: s,
366
+ shouldFlip: c,
367
+ boundaryElement: p,
368
+ offset: x,
369
+ crossOffset: m,
370
+ maxHeight: v,
371
+ arrowSize: o ?? (n?.current ? U(n.current, !0).width : 0),
372
+ arrowBoundaryOffset: E
373
+ });
374
+ if (!L.position) return;
375
+ g.style.top = "", g.style.bottom = "", g.style.left = "", g.style.right = "", Object.keys(L.position).forEach((I) => g.style[I] = L.position[I] + "px"), g.style.maxHeight = L.maxHeight != null ? L.maxHeight + "px" : "";
376
+ let y = V();
377
+ if (T && y && a.current) {
378
+ let I = y.getBoundingClientRect(), S = a.current.getBoundingClientRect(), M = I[T.type] - S[T.type];
379
+ a.current.scrollTop += M - T.offset;
380
+ }
381
+ H(L);
382
+ }, u);
383
+ B($, u), Be($), K({
384
+ ref: l,
385
+ onResize: $
386
+ }), K({
387
+ ref: r,
388
+ onResize: $
389
+ });
390
+ let R = W(!1);
391
+ B(() => {
392
+ let T, g = () => {
393
+ R.current = !0, clearTimeout(T), T = setTimeout(() => {
394
+ R.current = !1;
395
+ }, 500), $();
396
+ }, L = () => {
397
+ R.current && g();
398
+ };
399
+ return z?.addEventListener("resize", g), z?.addEventListener("scroll", L), () => {
400
+ z?.removeEventListener("resize", g), z?.removeEventListener("scroll", L);
401
+ };
402
+ }, [
403
+ $
404
+ ]);
405
+ let w = j(() => {
406
+ R.current || h?.();
407
+ }, [
408
+ h,
409
+ R
410
+ ]);
411
+ return ze({
412
+ triggerRef: r,
413
+ isOpen: f,
414
+ onClose: h && w
415
+ }), {
416
+ overlayProps: {
417
+ style: {
418
+ position: d ? "absolute" : "fixed",
419
+ top: d ? void 0 : 0,
420
+ left: d ? void 0 : 0,
421
+ zIndex: 1e5,
422
+ ...d?.position,
423
+ maxHeight: d?.maxHeight ?? "100vh"
424
+ }
425
+ },
426
+ placement: d?.placement ?? null,
427
+ triggerAnchorPoint: d?.triggerAnchorPoint ?? null,
428
+ arrowProps: {
429
+ "aria-hidden": "true",
430
+ role: "presentation",
431
+ style: {
432
+ left: d?.arrowOffsetLeft,
433
+ top: d?.arrowOffsetTop
434
+ }
435
+ },
436
+ updatePosition: $
437
+ };
438
+ }
439
+ function Be(e) {
440
+ B(() => (window.addEventListener("resize", e, !1), () => {
441
+ window.removeEventListener("resize", e, !1);
442
+ }), [
443
+ e
444
+ ]);
445
+ }
446
+ function Xe(e, t) {
447
+ return t === "rtl" ? e.replace("start", "right").replace("end", "left") : e.replace("start", "left").replace("end", "right");
448
+ }
449
+ export {
450
+ Ve as $
451
+ };
@@ -0,0 +1,221 @@
1
+ import { $ as h, c as m, j as T, o as y, b as C, k as I, i as G, t as P, f as V } from "./Overlay-RmiBtqDR.mjs";
2
+ import x, { useRef as E, useCallback as v, useEffect as D, useState as B, useReducer as k } from "react";
3
+ function M() {
4
+ let a = E(/* @__PURE__ */ new Map()), n = v((o, s, u, i) => {
5
+ let t = i?.once ? (...b) => {
6
+ a.current.delete(u), u(...b);
7
+ } : u;
8
+ a.current.set(u, {
9
+ type: s,
10
+ eventTarget: o,
11
+ fn: t,
12
+ options: i
13
+ }), o.addEventListener(s, t, i);
14
+ }, []), e = v((o, s, u, i) => {
15
+ let t = a.current.get(u)?.fn || u;
16
+ o.removeEventListener(s, t, i), a.current.delete(u);
17
+ }, []), l = v(() => {
18
+ a.current.forEach((o, s) => {
19
+ e(o.eventTarget, o.type, s, o.options);
20
+ });
21
+ }, [
22
+ e
23
+ ]);
24
+ return D(() => l, [
25
+ l
26
+ ]), {
27
+ addGlobalListener: n,
28
+ removeGlobalListener: e,
29
+ removeAllGlobalListeners: l
30
+ };
31
+ }
32
+ function S(a) {
33
+ let { isDisabled: n, onBlurWithin: e, onFocusWithin: l, onFocusWithinChange: o } = a, s = E({
34
+ isFocusWithin: !1
35
+ }), { addGlobalListener: u, removeAllGlobalListeners: i } = M(), t = v((r) => {
36
+ h(r.currentTarget, m(r)) && s.current.isFocusWithin && !h(r.currentTarget, r.relatedTarget) && (s.current.isFocusWithin = !1, i(), e && e(r), o && o(!1));
37
+ }, [
38
+ e,
39
+ o,
40
+ s,
41
+ i
42
+ ]), b = T(t), f = v((r) => {
43
+ if (!h(r.currentTarget, m(r))) return;
44
+ let p = m(r);
45
+ const d = y(p), c = C(d);
46
+ if (!s.current.isFocusWithin && c === p) {
47
+ l && l(r), o && o(!0), s.current.isFocusWithin = !0, b(r);
48
+ let g = r.currentTarget;
49
+ u(d, "focus", (W) => {
50
+ let L = m(W);
51
+ if (s.current.isFocusWithin && !h(g, L)) {
52
+ let w = new d.defaultView.FocusEvent("blur", {
53
+ relatedTarget: L
54
+ });
55
+ I(w, g);
56
+ let F = G(w);
57
+ t(F);
58
+ }
59
+ }, {
60
+ capture: !0
61
+ });
62
+ }
63
+ }, [
64
+ l,
65
+ o,
66
+ b,
67
+ u,
68
+ t
69
+ ]);
70
+ return n ? {
71
+ focusWithinProps: {
72
+ // These cannot be null, that would conflict in mergeProps
73
+ onFocus: void 0,
74
+ onBlur: void 0
75
+ }
76
+ } : {
77
+ focusWithinProps: {
78
+ onFocus: f,
79
+ onBlur: t
80
+ }
81
+ };
82
+ }
83
+ const A = typeof document < "u" ? x.useInsertionEffect ?? x.useLayoutEffect : () => {
84
+ };
85
+ function R(a, n, e) {
86
+ let [l, o] = B(a || n), s = E(l), u = E(a !== void 0), i = a !== void 0;
87
+ D(() => {
88
+ let r = u.current;
89
+ r !== i && process.env.NODE_ENV !== "production" && console.warn(`WARN: A component changed from ${r ? "controlled" : "uncontrolled"} to ${i ? "controlled" : "uncontrolled"}.`), u.current = i;
90
+ }, [
91
+ i
92
+ ]);
93
+ let t = i ? a : l;
94
+ A(() => {
95
+ s.current = t;
96
+ });
97
+ let [, b] = k(() => ({}), {}), f = v((r, ...p) => {
98
+ let d = typeof r == "function" ? r(s.current) : r;
99
+ Object.is(s.current, d) || (s.current = d, o(d), b(), e?.(d, ...p));
100
+ }, [
101
+ e
102
+ ]);
103
+ return [
104
+ t,
105
+ f
106
+ ];
107
+ }
108
+ function N(a) {
109
+ let { ref: n, onInteractOutside: e, isDisabled: l, onInteractOutsideStart: o } = a, s = E({
110
+ isPointerDown: !1,
111
+ ignoreEmulatedMouseEvents: !1
112
+ }), u = P((t) => {
113
+ e && O(t, n) && (o && o(t), s.current.isPointerDown = !0);
114
+ }), i = P((t) => {
115
+ e && e(t);
116
+ });
117
+ D(() => {
118
+ let t = s.current;
119
+ if (l) return;
120
+ const b = n.current, f = y(b);
121
+ if (typeof PointerEvent < "u") {
122
+ let r = (p) => {
123
+ t.isPointerDown && O(p, n) && i(p), t.isPointerDown = !1;
124
+ };
125
+ return f.addEventListener("pointerdown", u, !0), f.addEventListener("click", r, !0), () => {
126
+ f.removeEventListener("pointerdown", u, !0), f.removeEventListener("click", r, !0);
127
+ };
128
+ } else if (process.env.NODE_ENV === "test") {
129
+ let r = (d) => {
130
+ t.ignoreEmulatedMouseEvents ? t.ignoreEmulatedMouseEvents = !1 : t.isPointerDown && O(d, n) && i(d), t.isPointerDown = !1;
131
+ }, p = (d) => {
132
+ t.ignoreEmulatedMouseEvents = !0, t.isPointerDown && O(d, n) && i(d), t.isPointerDown = !1;
133
+ };
134
+ return f.addEventListener("mousedown", u, !0), f.addEventListener("mouseup", r, !0), f.addEventListener("touchstart", u, !0), f.addEventListener("touchend", p, !0), () => {
135
+ f.removeEventListener("mousedown", u, !0), f.removeEventListener("mouseup", r, !0), f.removeEventListener("touchstart", u, !0), f.removeEventListener("touchend", p, !0);
136
+ };
137
+ }
138
+ }, [
139
+ n,
140
+ l
141
+ ]);
142
+ }
143
+ function O(a, n) {
144
+ if (a.button > 0) return !1;
145
+ let e = m(a);
146
+ if (e) {
147
+ const l = e.ownerDocument;
148
+ if (!l || !h(l.documentElement, e) || e.closest("[data-react-aria-top-layer]")) return !1;
149
+ }
150
+ return n.current ? !a.composedPath().includes(n.current) : !1;
151
+ }
152
+ const $ = [];
153
+ function U(a, n) {
154
+ let { onClose: e, shouldCloseOnBlur: l, isOpen: o, isDismissable: s = !1, isKeyboardDismissDisabled: u = !1, shouldCloseOnInteractOutside: i } = a, t = E(void 0);
155
+ D(() => {
156
+ if (o && !$.includes(n))
157
+ return $.push(n), () => {
158
+ let c = $.indexOf(n);
159
+ c >= 0 && $.splice(c, 1);
160
+ };
161
+ }, [
162
+ o,
163
+ n
164
+ ]);
165
+ let b = () => {
166
+ $[$.length - 1] === n && e && e();
167
+ }, f = (c) => {
168
+ const g = $[$.length - 1];
169
+ t.current = g, (!i || i(m(c))) && g === n && c.stopPropagation();
170
+ }, r = (c) => {
171
+ (!i || i(m(c))) && ($[$.length - 1] === n && c.stopPropagation(), t.current === n && b()), t.current = void 0;
172
+ }, p = (c) => {
173
+ c.key === "Escape" && !u && !c.nativeEvent.isComposing && (c.stopPropagation(), c.preventDefault(), b());
174
+ };
175
+ N({
176
+ ref: n,
177
+ onInteractOutside: s && o ? r : void 0,
178
+ onInteractOutsideStart: f
179
+ });
180
+ let { focusWithinProps: d } = S({
181
+ isDisabled: !l,
182
+ onBlurWithin: (c) => {
183
+ !c.relatedTarget || V(c.relatedTarget) || (!i || i(c.relatedTarget)) && e?.();
184
+ }
185
+ });
186
+ return {
187
+ overlayProps: {
188
+ onKeyDown: p,
189
+ ...d
190
+ },
191
+ underlayProps: {}
192
+ };
193
+ }
194
+ function _(a) {
195
+ let [n, e] = R(a.isOpen, a.defaultOpen || !1, a.onOpenChange);
196
+ const l = v(() => {
197
+ e(!0);
198
+ }, [
199
+ e
200
+ ]), o = v(() => {
201
+ e(!1);
202
+ }, [
203
+ e
204
+ ]), s = v(() => {
205
+ e(!n);
206
+ }, [
207
+ e,
208
+ n
209
+ ]);
210
+ return {
211
+ isOpen: n,
212
+ setOpen: e,
213
+ open: l,
214
+ close: o,
215
+ toggle: s
216
+ };
217
+ }
218
+ export {
219
+ U as $,
220
+ _ as a
221
+ };