@colabcommerce/elements 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,863 @@
1
+ import { w as Z, x as be, y as Q, r as de, z as Se, D as lt, G as ct, T as dt, t as ut, q as v, v as ft, E as ht, p as U, P as Ee, H as mt, J as gt, K as De, L as pt, N as Et } from "./globals-C3lGVSJ0.js";
2
+ import * as E from "react";
3
+ import { useState as H, useRef as h, useEffect as R, useCallback as y, useContext as Ke, createContext as yt, useMemo as Ge, useLayoutEffect as Rt, cloneElement as Ne, forwardRef as vt, useImperativeHandle as Tt } from "react";
4
+ import wt from "react-dom";
5
+ import { jsx as l, Fragment as Fe, jsxs as ze } from "react/jsx-runtime";
6
+ var ce;
7
+ function Ie(e) {
8
+ if ((!ce && ce !== 0 || e) && Z) {
9
+ var t = document.createElement("div");
10
+ t.style.position = "absolute", t.style.top = "-9999px", t.style.width = "50px", t.style.height = "50px", t.style.overflow = "scroll", document.body.appendChild(t), ce = t.offsetWidth - t.clientWidth, document.body.removeChild(t);
11
+ }
12
+ return ce;
13
+ }
14
+ function bt() {
15
+ return H(null);
16
+ }
17
+ function Nt(e) {
18
+ const t = h(e);
19
+ return R(() => {
20
+ t.current = e;
21
+ }, [e]), t;
22
+ }
23
+ function we(e) {
24
+ const t = Nt(e);
25
+ return y(function(...n) {
26
+ return t.current && t.current(...n);
27
+ }, [t]);
28
+ }
29
+ function Mt(e) {
30
+ const t = h(e);
31
+ return t.current = e, t;
32
+ }
33
+ function Ct(e) {
34
+ const t = Mt(e);
35
+ R(() => () => t.current(), []);
36
+ }
37
+ function ye(e) {
38
+ e === void 0 && (e = be());
39
+ try {
40
+ var t = e.activeElement;
41
+ return !t || !t.nodeName ? null : t;
42
+ } catch {
43
+ return e.body;
44
+ }
45
+ }
46
+ function We(e, t) {
47
+ if (e.contains) return e.contains(t);
48
+ if (e.compareDocumentPosition) return e === t || !!(e.compareDocumentPosition(t) & 16);
49
+ }
50
+ function Ot() {
51
+ const e = h(!0), t = h(() => e.current);
52
+ return R(() => (e.current = !0, () => {
53
+ e.current = !1;
54
+ }), []), t.current;
55
+ }
56
+ function kt(e) {
57
+ const t = h(e);
58
+ return t.current = e, t;
59
+ }
60
+ function xt(e) {
61
+ const t = kt(e);
62
+ R(() => () => t.current(), []);
63
+ }
64
+ function At(e) {
65
+ const t = h(null);
66
+ return R(() => {
67
+ t.current = e;
68
+ }), t.current;
69
+ }
70
+ function Bt(e) {
71
+ const t = h(e);
72
+ return R(() => {
73
+ t.current = e;
74
+ }, [e]), t;
75
+ }
76
+ function A(e) {
77
+ const t = Bt(e);
78
+ return y(function(...n) {
79
+ return t.current && t.current(...n);
80
+ }, [t]);
81
+ }
82
+ const Lt = "data-rr-ui-";
83
+ function St(e) {
84
+ return `${Lt}${e}`;
85
+ }
86
+ function Dt(e = document) {
87
+ const t = e.defaultView;
88
+ return Math.abs(t.innerWidth - e.documentElement.clientWidth);
89
+ }
90
+ const $e = St("modal-open");
91
+ class Me {
92
+ constructor({
93
+ ownerDocument: t,
94
+ handleContainerOverflow: n = !0,
95
+ isRTL: o = !1
96
+ } = {}) {
97
+ this.handleContainerOverflow = n, this.isRTL = o, this.modals = [], this.ownerDocument = t;
98
+ }
99
+ getScrollbarWidth() {
100
+ return Dt(this.ownerDocument);
101
+ }
102
+ getElement() {
103
+ return (this.ownerDocument || document).body;
104
+ }
105
+ setModalAttributes(t) {
106
+ }
107
+ removeModalAttributes(t) {
108
+ }
109
+ setContainerStyle(t) {
110
+ const n = {
111
+ overflow: "hidden"
112
+ }, o = this.isRTL ? "paddingLeft" : "paddingRight", r = this.getElement();
113
+ t.style = {
114
+ overflow: r.style.overflow,
115
+ [o]: r.style[o]
116
+ }, t.scrollBarWidth && (n[o] = `${parseInt(Q(r, o) || "0", 10) + t.scrollBarWidth}px`), r.setAttribute($e, ""), Q(r, n);
117
+ }
118
+ reset() {
119
+ [...this.modals].forEach((t) => this.remove(t));
120
+ }
121
+ removeContainerStyle(t) {
122
+ const n = this.getElement();
123
+ n.removeAttribute($e), Object.assign(n.style, t.style);
124
+ }
125
+ add(t) {
126
+ let n = this.modals.indexOf(t);
127
+ return n !== -1 || (n = this.modals.length, this.modals.push(t), this.setModalAttributes(t), n !== 0) || (this.state = {
128
+ scrollBarWidth: this.getScrollbarWidth(),
129
+ style: {}
130
+ }, this.handleContainerOverflow && this.setContainerStyle(this.state)), n;
131
+ }
132
+ remove(t) {
133
+ const n = this.modals.indexOf(t);
134
+ n !== -1 && (this.modals.splice(n, 1), !this.modals.length && this.handleContainerOverflow && this.removeContainerStyle(this.state), this.removeModalAttributes(t));
135
+ }
136
+ isTopModal(t) {
137
+ return !!this.modals.length && this.modals[this.modals.length - 1] === t;
138
+ }
139
+ }
140
+ const Ve = /* @__PURE__ */ yt(Z ? window : void 0);
141
+ Ve.Provider;
142
+ function Ce() {
143
+ return Ke(Ve);
144
+ }
145
+ const Re = (e, t) => Z ? e == null ? (t || be()).body : (typeof e == "function" && (e = e()), e && "current" in e && (e = e.current), e && ("nodeType" in e || e.getBoundingClientRect) ? e : null) : null;
146
+ function Ft(e, t) {
147
+ const n = Ce(), [o, r] = H(() => Re(e, n == null ? void 0 : n.document));
148
+ if (!o) {
149
+ const s = Re(e);
150
+ s && r(s);
151
+ }
152
+ return R(() => {
153
+ }, [t, o]), R(() => {
154
+ const s = Re(e);
155
+ s !== o && r(s);
156
+ }, [e, o]), o;
157
+ }
158
+ const je = (e) => !e || typeof e == "function" ? e : (t) => {
159
+ e.current = t;
160
+ };
161
+ function It(e, t) {
162
+ const n = je(e), o = je(t);
163
+ return (r) => {
164
+ n && n(r), o && o(r);
165
+ };
166
+ }
167
+ function Oe(e, t) {
168
+ return Ge(() => It(e, t), [e, t]);
169
+ }
170
+ const Wt = typeof global < "u" && // @ts-ignore
171
+ global.navigator && // @ts-ignore
172
+ global.navigator.product === "ReactNative", $t = typeof document < "u", _e = $t || Wt ? Rt : R;
173
+ function jt({
174
+ children: e,
175
+ in: t,
176
+ onExited: n,
177
+ mountOnEnter: o,
178
+ unmountOnExit: r
179
+ }) {
180
+ const s = h(null), u = h(t), f = A(n);
181
+ R(() => {
182
+ t ? u.current = !0 : f(s.current);
183
+ }, [t, f]);
184
+ const d = Oe(s, de(e)), c = /* @__PURE__ */ Ne(e, {
185
+ ref: d
186
+ });
187
+ return t ? c : r || !u.current && o ? null : c;
188
+ }
189
+ const _t = ["onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "addEndListener", "children"];
190
+ function Ht(e, t) {
191
+ if (e == null) return {};
192
+ var n = {};
193
+ for (var o in e) if ({}.hasOwnProperty.call(e, o)) {
194
+ if (t.indexOf(o) >= 0) continue;
195
+ n[o] = e[o];
196
+ }
197
+ return n;
198
+ }
199
+ function Ut(e) {
200
+ let {
201
+ onEnter: t,
202
+ onEntering: n,
203
+ onEntered: o,
204
+ onExit: r,
205
+ onExiting: s,
206
+ onExited: u,
207
+ addEndListener: f,
208
+ children: d
209
+ } = e, c = Ht(e, _t);
210
+ const g = h(null), T = Oe(g, de(d)), p = (M) => (k) => {
211
+ M && g.current && M(g.current, k);
212
+ }, b = y(p(t), [t]), K = y(p(n), [n]), B = y(p(o), [o]), G = y(p(r), [r]), N = y(p(s), [s]), z = y(p(u), [u]), L = y(p(f), [f]);
213
+ return Object.assign({}, c, {
214
+ nodeRef: g
215
+ }, t && {
216
+ onEnter: b
217
+ }, n && {
218
+ onEntering: K
219
+ }, o && {
220
+ onEntered: B
221
+ }, r && {
222
+ onExit: G
223
+ }, s && {
224
+ onExiting: N
225
+ }, u && {
226
+ onExited: z
227
+ }, f && {
228
+ addEndListener: L
229
+ }, {
230
+ children: typeof d == "function" ? (M, k) => (
231
+ // TODO: Types for RTG missing innerProps, so need to cast.
232
+ d(M, Object.assign({}, k, {
233
+ ref: T
234
+ }))
235
+ ) : /* @__PURE__ */ Ne(d, {
236
+ ref: T
237
+ })
238
+ });
239
+ }
240
+ const Kt = ["component"];
241
+ function Gt(e, t) {
242
+ if (e == null) return {};
243
+ var n = {};
244
+ for (var o in e) if ({}.hasOwnProperty.call(e, o)) {
245
+ if (t.indexOf(o) >= 0) continue;
246
+ n[o] = e[o];
247
+ }
248
+ return n;
249
+ }
250
+ const zt = /* @__PURE__ */ E.forwardRef((e, t) => {
251
+ let {
252
+ component: n
253
+ } = e, o = Gt(e, Kt);
254
+ const r = Ut(o);
255
+ return /* @__PURE__ */ l(n, Object.assign({
256
+ ref: t
257
+ }, r));
258
+ });
259
+ function Vt({
260
+ in: e,
261
+ onTransition: t
262
+ }) {
263
+ const n = h(null), o = h(!0), r = A(t);
264
+ return _e(() => {
265
+ if (!n.current)
266
+ return;
267
+ let s = !1;
268
+ return r({
269
+ in: e,
270
+ element: n.current,
271
+ initial: o.current,
272
+ isStale: () => s
273
+ }), () => {
274
+ s = !0;
275
+ };
276
+ }, [e, r]), _e(() => (o.current = !1, () => {
277
+ o.current = !0;
278
+ }), []), n;
279
+ }
280
+ function Xt({
281
+ children: e,
282
+ in: t,
283
+ onExited: n,
284
+ onEntered: o,
285
+ transition: r
286
+ }) {
287
+ const [s, u] = H(!t);
288
+ t && s && u(!1);
289
+ const f = Vt({
290
+ in: !!t,
291
+ onTransition: (c) => {
292
+ const g = () => {
293
+ c.isStale() || (c.in ? o == null || o(c.element, c.initial) : (u(!0), n == null || n(c.element)));
294
+ };
295
+ Promise.resolve(r(c)).then(g, (T) => {
296
+ throw c.in || u(!0), T;
297
+ });
298
+ }
299
+ }), d = Oe(f, de(e));
300
+ return s && !t ? null : /* @__PURE__ */ Ne(e, {
301
+ ref: d
302
+ });
303
+ }
304
+ function He(e, t, n) {
305
+ return e ? /* @__PURE__ */ l(zt, Object.assign({}, n, {
306
+ component: e
307
+ })) : t ? /* @__PURE__ */ l(Xt, Object.assign({}, n, {
308
+ transition: t
309
+ })) : /* @__PURE__ */ l(jt, Object.assign({}, n));
310
+ }
311
+ const qt = ["show", "role", "className", "style", "children", "backdrop", "keyboard", "onBackdropClick", "onEscapeKeyDown", "transition", "runTransition", "backdropTransition", "runBackdropTransition", "autoFocus", "enforceFocus", "restoreFocus", "restoreFocusOptions", "renderDialog", "renderBackdrop", "manager", "container", "onShow", "onHide", "onExit", "onExited", "onExiting", "onEnter", "onEntering", "onEntered"];
312
+ function Yt(e, t) {
313
+ if (e == null) return {};
314
+ var n = {};
315
+ for (var o in e) if ({}.hasOwnProperty.call(e, o)) {
316
+ if (t.indexOf(o) >= 0) continue;
317
+ n[o] = e[o];
318
+ }
319
+ return n;
320
+ }
321
+ let ve;
322
+ function Pt(e) {
323
+ return ve || (ve = new Me({
324
+ ownerDocument: e == null ? void 0 : e.document
325
+ })), ve;
326
+ }
327
+ function Jt(e) {
328
+ const t = Ce(), n = e || Pt(t), o = h({
329
+ dialog: null,
330
+ backdrop: null
331
+ });
332
+ return Object.assign(o.current, {
333
+ add: () => n.add(o.current),
334
+ remove: () => n.remove(o.current),
335
+ isTopModal: () => n.isTopModal(o.current),
336
+ setDialogRef: y((r) => {
337
+ o.current.dialog = r;
338
+ }, []),
339
+ setBackdropRef: y((r) => {
340
+ o.current.backdrop = r;
341
+ }, [])
342
+ });
343
+ }
344
+ const Xe = /* @__PURE__ */ vt((e, t) => {
345
+ let {
346
+ show: n = !1,
347
+ role: o = "dialog",
348
+ className: r,
349
+ style: s,
350
+ children: u,
351
+ backdrop: f = !0,
352
+ keyboard: d = !0,
353
+ onBackdropClick: c,
354
+ onEscapeKeyDown: g,
355
+ transition: T,
356
+ runTransition: p,
357
+ backdropTransition: b,
358
+ runBackdropTransition: K,
359
+ autoFocus: B = !0,
360
+ enforceFocus: G = !0,
361
+ restoreFocus: N = !0,
362
+ restoreFocusOptions: z,
363
+ renderDialog: L,
364
+ renderBackdrop: M = (i) => /* @__PURE__ */ l("div", Object.assign({}, i)),
365
+ manager: k,
366
+ container: ue,
367
+ onShow: ee,
368
+ onHide: V = () => {
369
+ },
370
+ onExit: fe,
371
+ onExited: X,
372
+ onExiting: te,
373
+ onEnter: ne,
374
+ onEntering: oe,
375
+ onEntered: re
376
+ } = e, he = Yt(e, qt);
377
+ const C = Ce(), S = Ft(ue), m = Jt(k), me = Ot(), se = At(n), [x, D] = H(!n), w = h(null);
378
+ Tt(t, () => m, [m]), Z && !se && n && (w.current = ye(C == null ? void 0 : C.document)), n && x && D(!1);
379
+ const O = A(() => {
380
+ if (m.add(), F.current = Se(document, "keydown", pe), Y.current = Se(
381
+ document,
382
+ "focus",
383
+ // the timeout is necessary b/c this will run before the new modal is mounted
384
+ // and so steals focus from it
385
+ () => setTimeout(ge),
386
+ !0
387
+ ), ee && ee(), B) {
388
+ var i, le;
389
+ const J = ye((i = (le = m.dialog) == null ? void 0 : le.ownerDocument) != null ? i : C == null ? void 0 : C.document);
390
+ m.dialog && J && !We(m.dialog, J) && (w.current = J, m.dialog.focus());
391
+ }
392
+ }), q = A(() => {
393
+ if (m.remove(), F.current == null || F.current(), Y.current == null || Y.current(), N) {
394
+ var i;
395
+ (i = w.current) == null || i.focus == null || i.focus(z), w.current = null;
396
+ }
397
+ });
398
+ R(() => {
399
+ !n || !S || O();
400
+ }, [
401
+ n,
402
+ S,
403
+ /* should never change: */
404
+ O
405
+ ]), R(() => {
406
+ x && q();
407
+ }, [x, q]), xt(() => {
408
+ q();
409
+ });
410
+ const ge = A(() => {
411
+ if (!G || !me() || !m.isTopModal())
412
+ return;
413
+ const i = ye(C == null ? void 0 : C.document);
414
+ m.dialog && i && !We(m.dialog, i) && m.dialog.focus();
415
+ }), ae = A((i) => {
416
+ i.target === i.currentTarget && (c == null || c(i), f === !0 && V());
417
+ }), pe = A((i) => {
418
+ d && lt(i) && m.isTopModal() && (g == null || g(i), i.defaultPrevented || V());
419
+ }), Y = h(), F = h(), ie = (...i) => {
420
+ D(!0), X == null || X(...i);
421
+ };
422
+ if (!S)
423
+ return null;
424
+ const I = Object.assign({
425
+ role: o,
426
+ ref: m.setDialogRef,
427
+ // apparently only works on the dialog role element
428
+ "aria-modal": o === "dialog" ? !0 : void 0
429
+ }, he, {
430
+ style: s,
431
+ className: r,
432
+ tabIndex: -1
433
+ });
434
+ let P = L ? L(I) : /* @__PURE__ */ l("div", Object.assign({}, I, {
435
+ children: /* @__PURE__ */ E.cloneElement(u, {
436
+ role: "document"
437
+ })
438
+ }));
439
+ P = He(T, p, {
440
+ unmountOnExit: !0,
441
+ mountOnEnter: !0,
442
+ appear: !0,
443
+ in: !!n,
444
+ onExit: fe,
445
+ onExiting: te,
446
+ onExited: ie,
447
+ onEnter: ne,
448
+ onEntering: oe,
449
+ onEntered: re,
450
+ children: P
451
+ });
452
+ let W = null;
453
+ return f && (W = M({
454
+ ref: m.setBackdropRef,
455
+ onClick: ae
456
+ }), W = He(b, K, {
457
+ in: !!n,
458
+ appear: !0,
459
+ mountOnEnter: !0,
460
+ unmountOnExit: !0,
461
+ children: W
462
+ })), /* @__PURE__ */ l(Fe, {
463
+ children: /* @__PURE__ */ wt.createPortal(/* @__PURE__ */ ze(Fe, {
464
+ children: [W, P]
465
+ }), S)
466
+ });
467
+ });
468
+ Xe.displayName = "Modal";
469
+ const Qt = Object.assign(Xe, {
470
+ Manager: Me
471
+ });
472
+ function Zt(e, t) {
473
+ return e.classList ? e.classList.contains(t) : (" " + (e.className.baseVal || e.className) + " ").indexOf(" " + t + " ") !== -1;
474
+ }
475
+ function en(e, t) {
476
+ e.classList ? e.classList.add(t) : Zt(e, t) || (typeof e.className == "string" ? e.className = e.className + " " + t : e.setAttribute("class", (e.className && e.className.baseVal || "") + " " + t));
477
+ }
478
+ var tn = Function.prototype.bind.call(Function.prototype.call, [].slice);
479
+ function j(e, t) {
480
+ return tn(e.querySelectorAll(t));
481
+ }
482
+ function Ue(e, t) {
483
+ return e.replace(new RegExp("(^|\\s)" + t + "(?:\\s|$)", "g"), "$1").replace(/\s+/g, " ").replace(/^\s*|\s*$/g, "");
484
+ }
485
+ function nn(e, t) {
486
+ e.classList ? e.classList.remove(t) : typeof e.className == "string" ? e.className = Ue(e.className, t) : e.setAttribute("class", Ue(e.className && e.className.baseVal || "", t));
487
+ }
488
+ const _ = {
489
+ FIXED_CONTENT: ".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",
490
+ STICKY_CONTENT: ".sticky-top",
491
+ NAVBAR_TOGGLER: ".navbar-toggler"
492
+ };
493
+ class on extends Me {
494
+ adjustAndStore(t, n, o) {
495
+ const r = n.style[t];
496
+ n.dataset[t] = r, Q(n, {
497
+ [t]: `${parseFloat(Q(n, t)) + o}px`
498
+ });
499
+ }
500
+ restore(t, n) {
501
+ const o = n.dataset[t];
502
+ o !== void 0 && (delete n.dataset[t], Q(n, {
503
+ [t]: o
504
+ }));
505
+ }
506
+ setContainerStyle(t) {
507
+ super.setContainerStyle(t);
508
+ const n = this.getElement();
509
+ if (en(n, "modal-open"), !t.scrollBarWidth) return;
510
+ const o = this.isRTL ? "paddingLeft" : "paddingRight", r = this.isRTL ? "marginLeft" : "marginRight";
511
+ j(n, _.FIXED_CONTENT).forEach((s) => this.adjustAndStore(o, s, t.scrollBarWidth)), j(n, _.STICKY_CONTENT).forEach((s) => this.adjustAndStore(r, s, -t.scrollBarWidth)), j(n, _.NAVBAR_TOGGLER).forEach((s) => this.adjustAndStore(r, s, t.scrollBarWidth));
512
+ }
513
+ removeContainerStyle(t) {
514
+ super.removeContainerStyle(t);
515
+ const n = this.getElement();
516
+ nn(n, "modal-open");
517
+ const o = this.isRTL ? "paddingLeft" : "paddingRight", r = this.isRTL ? "marginLeft" : "marginRight";
518
+ j(n, _.FIXED_CONTENT).forEach((s) => this.restore(o, s)), j(n, _.STICKY_CONTENT).forEach((s) => this.restore(r, s)), j(n, _.NAVBAR_TOGGLER).forEach((s) => this.restore(r, s));
519
+ }
520
+ }
521
+ let Te;
522
+ function rn(e) {
523
+ return Te || (Te = new on(e)), Te;
524
+ }
525
+ const sn = {
526
+ [ht]: "show",
527
+ [ft]: "show"
528
+ }, ke = /* @__PURE__ */ E.forwardRef(({
529
+ className: e,
530
+ children: t,
531
+ transitionClasses: n = {},
532
+ onEnter: o,
533
+ ...r
534
+ }, s) => {
535
+ const u = {
536
+ in: !1,
537
+ timeout: 300,
538
+ mountOnEnter: !1,
539
+ unmountOnExit: !1,
540
+ appear: !1,
541
+ ...r
542
+ }, f = y((d, c) => {
543
+ ct(d), o == null || o(d, c);
544
+ }, [o]);
545
+ return /* @__PURE__ */ l(dt, {
546
+ ref: s,
547
+ addEndListener: ut,
548
+ ...u,
549
+ onEnter: f,
550
+ childRef: de(t),
551
+ children: (d, c) => /* @__PURE__ */ E.cloneElement(t, {
552
+ ...c,
553
+ className: v("fade", e, t.props.className, sn[d], n[d])
554
+ })
555
+ });
556
+ });
557
+ ke.displayName = "Fade";
558
+ const qe = /* @__PURE__ */ E.forwardRef(({
559
+ className: e,
560
+ bsPrefix: t,
561
+ as: n = "div",
562
+ ...o
563
+ }, r) => (t = U(t, "modal-body"), /* @__PURE__ */ l(n, {
564
+ ref: r,
565
+ className: v(e, t),
566
+ ...o
567
+ })));
568
+ qe.displayName = "ModalBody";
569
+ const Ye = /* @__PURE__ */ E.createContext({
570
+ onHide() {
571
+ }
572
+ }), xe = /* @__PURE__ */ E.forwardRef(({
573
+ bsPrefix: e,
574
+ className: t,
575
+ contentClassName: n,
576
+ centered: o,
577
+ size: r,
578
+ fullscreen: s,
579
+ children: u,
580
+ scrollable: f,
581
+ ...d
582
+ }, c) => {
583
+ e = U(e, "modal");
584
+ const g = `${e}-dialog`, T = typeof s == "string" ? `${e}-fullscreen-${s}` : `${e}-fullscreen`;
585
+ return /* @__PURE__ */ l("div", {
586
+ ...d,
587
+ ref: c,
588
+ className: v(g, t, r && `${e}-${r}`, o && `${g}-centered`, f && `${g}-scrollable`, s && T),
589
+ children: /* @__PURE__ */ l("div", {
590
+ className: v(`${e}-content`, n),
591
+ children: u
592
+ })
593
+ });
594
+ });
595
+ xe.displayName = "ModalDialog";
596
+ const Pe = /* @__PURE__ */ E.forwardRef(({
597
+ className: e,
598
+ bsPrefix: t,
599
+ as: n = "div",
600
+ ...o
601
+ }, r) => (t = U(t, "modal-footer"), /* @__PURE__ */ l(n, {
602
+ ref: r,
603
+ className: v(e, t),
604
+ ...o
605
+ })));
606
+ Pe.displayName = "ModalFooter";
607
+ const an = {
608
+ /** An accessible label indicating the relevant information about the Close Button. */
609
+ "aria-label": Ee.string,
610
+ /** A callback fired after the Close Button is clicked. */
611
+ onClick: Ee.func,
612
+ /**
613
+ * Render different color variant for the button.
614
+ *
615
+ * Omitting this will render the default dark color.
616
+ */
617
+ variant: Ee.oneOf(["white"])
618
+ }, Ae = /* @__PURE__ */ E.forwardRef(({
619
+ className: e,
620
+ variant: t,
621
+ "aria-label": n = "Close",
622
+ ...o
623
+ }, r) => /* @__PURE__ */ l("button", {
624
+ ref: r,
625
+ type: "button",
626
+ className: v("btn-close", t && `btn-close-${t}`, e),
627
+ "aria-label": n,
628
+ ...o
629
+ }));
630
+ Ae.displayName = "CloseButton";
631
+ Ae.propTypes = an;
632
+ const Je = /* @__PURE__ */ E.forwardRef(({
633
+ closeLabel: e = "Close",
634
+ closeVariant: t,
635
+ closeButton: n = !1,
636
+ onHide: o,
637
+ children: r,
638
+ ...s
639
+ }, u) => {
640
+ const f = Ke(Ye), d = we(() => {
641
+ f == null || f.onHide(), o == null || o();
642
+ });
643
+ return /* @__PURE__ */ ze("div", {
644
+ ref: u,
645
+ ...s,
646
+ children: [r, n && /* @__PURE__ */ l(Ae, {
647
+ "aria-label": e,
648
+ variant: t,
649
+ onClick: d
650
+ })]
651
+ });
652
+ });
653
+ Je.displayName = "AbstractModalHeader";
654
+ const Qe = /* @__PURE__ */ E.forwardRef(({
655
+ bsPrefix: e,
656
+ className: t,
657
+ closeLabel: n = "Close",
658
+ closeButton: o = !1,
659
+ ...r
660
+ }, s) => (e = U(e, "modal-header"), /* @__PURE__ */ l(Je, {
661
+ ref: s,
662
+ ...r,
663
+ className: v(t, e),
664
+ closeLabel: n,
665
+ closeButton: o
666
+ })));
667
+ Qe.displayName = "ModalHeader";
668
+ const ln = (e) => (
669
+ // eslint-disable-next-line react/display-name
670
+ /* @__PURE__ */ E.forwardRef((t, n) => /* @__PURE__ */ l("div", {
671
+ ...t,
672
+ ref: n,
673
+ className: v(t.className, e)
674
+ }))
675
+ ), cn = ln("h4"), Ze = /* @__PURE__ */ E.forwardRef(({
676
+ className: e,
677
+ bsPrefix: t,
678
+ as: n = cn,
679
+ ...o
680
+ }, r) => (t = U(t, "modal-title"), /* @__PURE__ */ l(n, {
681
+ ref: r,
682
+ className: v(e, t),
683
+ ...o
684
+ })));
685
+ Ze.displayName = "ModalTitle";
686
+ function dn(e) {
687
+ return /* @__PURE__ */ l(ke, {
688
+ ...e,
689
+ timeout: null
690
+ });
691
+ }
692
+ function un(e) {
693
+ return /* @__PURE__ */ l(ke, {
694
+ ...e,
695
+ timeout: null
696
+ });
697
+ }
698
+ const et = /* @__PURE__ */ E.forwardRef(({
699
+ bsPrefix: e,
700
+ className: t,
701
+ style: n,
702
+ dialogClassName: o,
703
+ contentClassName: r,
704
+ children: s,
705
+ dialogAs: u = xe,
706
+ "data-bs-theme": f,
707
+ "aria-labelledby": d,
708
+ "aria-describedby": c,
709
+ "aria-label": g,
710
+ /* BaseModal props */
711
+ show: T = !1,
712
+ animation: p = !0,
713
+ backdrop: b = !0,
714
+ keyboard: K = !0,
715
+ onEscapeKeyDown: B,
716
+ onShow: G,
717
+ onHide: N,
718
+ container: z,
719
+ autoFocus: L = !0,
720
+ enforceFocus: M = !0,
721
+ restoreFocus: k = !0,
722
+ restoreFocusOptions: ue,
723
+ onEntered: ee,
724
+ onExit: V,
725
+ onExiting: fe,
726
+ onEnter: X,
727
+ onEntering: te,
728
+ onExited: ne,
729
+ backdropClassName: oe,
730
+ manager: re,
731
+ ...he
732
+ }, C) => {
733
+ const [S, m] = H({}), [me, se] = H(!1), x = h(!1), D = h(!1), w = h(null), [O, q] = bt(), ge = mt(C, q), ae = we(N), pe = gt();
734
+ e = U(e, "modal");
735
+ const Y = Ge(() => ({
736
+ onHide: ae
737
+ }), [ae]);
738
+ function F() {
739
+ return re || rn({
740
+ isRTL: pe
741
+ });
742
+ }
743
+ function ie(a) {
744
+ if (!Z) return;
745
+ const $ = F().getScrollbarWidth() > 0, Le = a.scrollHeight > be(a).documentElement.clientHeight;
746
+ m({
747
+ paddingRight: $ && !Le ? Ie() : void 0,
748
+ paddingLeft: !$ && Le ? Ie() : void 0
749
+ });
750
+ }
751
+ const I = we(() => {
752
+ O && ie(O.dialog);
753
+ });
754
+ Ct(() => {
755
+ De(window, "resize", I), w.current == null || w.current();
756
+ });
757
+ const P = () => {
758
+ x.current = !0;
759
+ }, W = (a) => {
760
+ x.current && O && a.target === O.dialog && (D.current = !0), x.current = !1;
761
+ }, i = () => {
762
+ se(!0), w.current = Et(O.dialog, () => {
763
+ se(!1);
764
+ });
765
+ }, le = (a) => {
766
+ a.target === a.currentTarget && i();
767
+ }, J = (a) => {
768
+ if (b === "static") {
769
+ le(a);
770
+ return;
771
+ }
772
+ if (D.current || a.target !== a.currentTarget) {
773
+ D.current = !1;
774
+ return;
775
+ }
776
+ N == null || N();
777
+ }, tt = (a) => {
778
+ K ? B == null || B(a) : (a.preventDefault(), b === "static" && i());
779
+ }, nt = (a, $) => {
780
+ a && ie(a), X == null || X(a, $);
781
+ }, ot = (a) => {
782
+ w.current == null || w.current(), V == null || V(a);
783
+ }, rt = (a, $) => {
784
+ te == null || te(a, $), pt(window, "resize", I);
785
+ }, st = (a) => {
786
+ a && (a.style.display = ""), ne == null || ne(a), De(window, "resize", I);
787
+ }, at = y((a) => /* @__PURE__ */ l("div", {
788
+ ...a,
789
+ className: v(`${e}-backdrop`, oe, !p && "show")
790
+ }), [p, oe, e]), Be = {
791
+ ...n,
792
+ ...S
793
+ };
794
+ Be.display = "block";
795
+ const it = (a) => /* @__PURE__ */ l("div", {
796
+ role: "dialog",
797
+ ...a,
798
+ style: Be,
799
+ className: v(t, e, me && `${e}-static`, !p && "show"),
800
+ onClick: b ? J : void 0,
801
+ onMouseUp: W,
802
+ "data-bs-theme": f,
803
+ "aria-label": g,
804
+ "aria-labelledby": d,
805
+ "aria-describedby": c,
806
+ children: /* @__PURE__ */ l(u, {
807
+ ...he,
808
+ onMouseDown: P,
809
+ className: o,
810
+ contentClassName: r,
811
+ children: s
812
+ })
813
+ });
814
+ return /* @__PURE__ */ l(Ye.Provider, {
815
+ value: Y,
816
+ children: /* @__PURE__ */ l(Qt, {
817
+ show: T,
818
+ ref: ge,
819
+ backdrop: b,
820
+ container: z,
821
+ keyboard: !0,
822
+ autoFocus: L,
823
+ enforceFocus: M,
824
+ restoreFocus: k,
825
+ restoreFocusOptions: ue,
826
+ onEscapeKeyDown: tt,
827
+ onShow: G,
828
+ onHide: N,
829
+ onEnter: nt,
830
+ onEntering: rt,
831
+ onEntered: ee,
832
+ onExit: ot,
833
+ onExiting: fe,
834
+ onExited: st,
835
+ manager: F(),
836
+ transition: p ? dn : void 0,
837
+ backdropTransition: p ? un : void 0,
838
+ renderBackdrop: at,
839
+ renderDialog: it
840
+ })
841
+ });
842
+ });
843
+ et.displayName = "Modal";
844
+ const pn = Object.assign(et, {
845
+ Body: qe,
846
+ Header: Qe,
847
+ Title: Ze,
848
+ Footer: Pe,
849
+ Dialog: xe,
850
+ TRANSITION_DURATION: 300,
851
+ BACKDROP_TRANSITION_DURATION: 150
852
+ });
853
+ export {
854
+ Je as A,
855
+ Qt as B,
856
+ ke as F,
857
+ pn as M,
858
+ Ye as a,
859
+ on as b,
860
+ ln as d,
861
+ rn as g,
862
+ we as u
863
+ };