UNPKG

@transkripid/flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS - Transkrip.id fork

92 lines (91 loc) 4.09 kB
import { jsx as h } from "react/jsx-runtime"; import { c as _ } from "react/compiler-runtime"; import { useFloating as ee, useMergeRefs as te, useClick as oe, useDismiss as se, useRole as le, useInteractions as ie, FloatingPortal as ne, FloatingOverlay as re, FloatingFocusManager as ae } from "@floating-ui/react"; import { forwardRef as de, useState as ce } from "react"; import { twMerge as G } from "tailwind-merge"; import { mergeDeep as me } from "../../helpers/merge-deep.mjs"; import { getTheme as fe } from "../../theme-store/index.mjs"; import { ModalBody as J } from "./ModalBody.mjs"; import { ModalContext as pe } from "./ModalContext.mjs"; import { ModalFooter as K } from "./ModalFooter.mjs"; import { ModalHeader as L } from "./ModalHeader.mjs"; const Q = de((P, k) => { const e = _(55); let r, y, a, l, b, o, d, i, F, M, v, n; e[0] !== P ? ({ children: r, className: y, dismissible: F, onClose: l, popup: b, position: M, root: d, show: i, size: v, theme: n, initialFocus: a, ...o } = P, e[0] = P, e[1] = r, e[2] = y, e[3] = a, e[4] = l, e[5] = b, e[6] = o, e[7] = d, e[8] = i, e[9] = F, e[10] = M, e[11] = v, e[12] = n) : (r = e[1], y = e[2], a = e[3], l = e[4], b = e[5], o = e[6], d = e[7], i = e[8], F = e[9], M = e[10], v = e[11], n = e[12]); const z = F === void 0 ? !1 : F, U = M === void 0 ? "center" : M, V = v === void 0 ? "2xl" : v; let N; e[13] !== n ? (N = n === void 0 ? {} : n, e[13] = n, e[14] = N) : N = e[14]; const W = N, [B, X] = ce(void 0), t = me(fe().modal, W); let c; e[15] !== l ? (c = () => l && l(), e[15] = l, e[16] = c) : c = e[16]; let w; e[17] !== i || e[18] !== c ? (w = { open: i, onOpenChange: c }, e[17] = i, e[18] = c, e[19] = w) : w = e[19]; const { context: s } = ee(w); let x; e[20] !== s.refs.setFloating || e[21] !== k ? (x = [s.refs.setFloating, k], e[20] = s.refs.setFloating, e[21] = k, e[22] = x) : x = e[22]; const I = te(x), O = oe(s); let C; e[23] !== z ? (C = { outsidePressEvent: "mousedown", enabled: z }, e[23] = z, e[24] = C) : C = e[24]; const j = se(s, C), D = le(s); let T; e[25] !== O || e[26] !== j || e[27] !== D ? (T = [O, j, D], e[25] = O, e[26] = j, e[27] = D, e[28] = T) : T = e[28]; const { getFloatingProps: S } = ie(T); if (!i) return null; const E = ne, R = re, Y = !0, Z = "modal-overlay", $ = G(t.root.base, t.root.positions[U], i ? t.root.show.on : t.root.show.off, y), q = ae; let m; e[29] !== S || e[30] !== o ? (m = S(o), e[29] = S, e[30] = o, e[31] = m) : m = e[31]; const A = G(t.content.base, t.root.sizes[V]); let f; e[32] !== r || e[33] !== t.content.inner ? (f = /* @__PURE__ */ h("div", { className: t.content.inner, children: r }), e[32] = r, e[33] = t.content.inner, e[34] = f) : f = e[34]; let p; e[35] !== B || e[36] !== I || e[37] !== m || e[38] !== A || e[39] !== f ? (p = /* @__PURE__ */ h("div", { ref: I, ...m, "aria-labelledby": B, className: A, children: f }), e[35] = B, e[36] = I, e[37] = m, e[38] = A, e[39] = f, e[40] = p) : p = e[40]; let u; e[41] !== q || e[42] !== s || e[43] !== a || e[44] !== p ? (u = /* @__PURE__ */ h(q, { context: s, initialFocus: a, children: p }), e[41] = q, e[42] = s, e[43] = a, e[44] = p, e[45] = u) : u = e[45]; let g; e[46] !== R || e[47] !== o || e[48] !== $ || e[49] !== u ? (g = /* @__PURE__ */ h(R, { lockScroll: Y, "data-testid": Z, className: $, ...o, children: u }), e[46] = R, e[47] = o, e[48] = $, e[49] = u, e[50] = g) : g = e[50]; let H; return e[51] !== E || e[52] !== d || e[53] !== g ? (H = /* @__PURE__ */ h(E, { root: d, children: g }), e[51] = E, e[52] = d, e[53] = g, e[54] = H) : H = e[54], /* @__PURE__ */ h(pe.Provider, { value: { theme: t, popup: b, onClose: l, setHeaderId: X }, children: H }); }); Q.displayName = "Modal"; L.displayName = "Modal.Header"; J.displayName = "Modal.Body"; K.displayName = "Modal.Footer"; const Ce = Object.assign(Q, { Header: L, Body: J, Footer: K }); export { Ce as Modal }; //# sourceMappingURL=Modal.mjs.map