mimir-ui-kit 1.38.40 → 1.38.42
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.
- package/dist/assets/Dropdown.css +1 -1
- package/dist/{combobox-CVtJDVoZ.js → combobox-BD-GHvMy.js} +6 -6
- package/dist/components/Accordion/Accordion.js +3 -3
- package/dist/components/CheckboxMimir/CheckboxMimir.js +4 -4
- package/dist/components/Dropdown/Dropdown.d.ts +16 -4
- package/dist/components/Dropdown/Dropdown.js +451 -275
- package/dist/components/MultiSelectSearch/MultiSelectSearch.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +3 -3
- package/dist/components/SelectSearch/SelectSearch.js +1 -1
- package/dist/components/Switcher/Switcher.js +4 -4
- package/dist/components/TabTrail/TabTrail.js +42 -47
- package/dist/{field-FJ34aSs4.js → field-BP5-U1Nr.js} +2 -2
- package/dist/{focus-management-DE4t_lW3.js → focus-management-Dp2_vbQ3.js} +1 -1
- package/dist/{hidden-DbgtYPOH.js → hidden-Dn4lM6EL.js} +1 -1
- package/dist/{keyboard-B0lm_zyn.js → keyboard-CUMsrFX1.js} +3 -1
- package/dist/{label-y3ANLTNC.js → label-DOlEWXBl.js} +2 -2
- package/dist/{open-closed-CdldUPoq.js → open-closed-CkTbpRyi.js} +3 -3
- package/dist/{portal-WDFNoIMz.js → portal-D3A00sie.js} +185 -180
- package/dist/{use-active-press-86hajhdd.js → use-active-press-BVQqDQ3V.js} +1 -1
- package/dist/use-is-mounted-D7cq4xsa.js +11 -0
- package/package.json +1 -1
@@ -1,333 +1,509 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { c as
|
3
|
-
import
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import { e as
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
for (let
|
20
|
-
|
1
|
+
import { jsx as ce, jsxs as Le, Fragment as nt } from "react/jsx-runtime";
|
2
|
+
import { c as fe } from "../../index-DIxK0V-G.js";
|
3
|
+
import y, { createContext as ae, useState as W, useContext as ee, useRef as M, useEffect as de, useMemo as K, Fragment as pe, useReducer as rt, createRef as we, useId as me, memo as ot, useCallback as Ae } from "react";
|
4
|
+
import { Button as lt } from "../Button/Button.js";
|
5
|
+
import { o as S, u as De, M as ve, W as V, y as z, O as oe, n as ie, m as at, e as ut, H as ue, s as Ie, p as it, a as Q, T as st, $ as ct, b as dt, D as Ce, I as pt, c as re } from "../../keyboard-CUMsrFX1.js";
|
6
|
+
import { w as vt } from "../../use-active-press-BVQqDQ3V.js";
|
7
|
+
import { n as Pe, s as ft, l as He, e as mt, E as bt, R as ht, v as Pt, y as $t, x as yt, a as Et, b as gt, m as St, f as Tt, d as _t, t as wt } from "../../portal-D3A00sie.js";
|
8
|
+
import { e as It } from "../../use-resolve-button-type-DhFdPxnv.js";
|
9
|
+
import { T as be, s as he } from "../../hidden-Dn4lM6EL.js";
|
10
|
+
import { R as ke, H as Me, i as D, c as Ge, u as $e, s as Ct } from "../../open-closed-CkTbpRyi.js";
|
11
|
+
import { C as Ft } from "../../close-provider-CEutdhG8.js";
|
12
|
+
import { r as Ke } from "../../bugs-diTMAGNw.js";
|
13
|
+
import { b as Oe, P as le, F as Y, A as Bt, h as kt, T as Fe } from "../../focus-management-Dp2_vbQ3.js";
|
14
|
+
import { f as Mt } from "../../use-is-mounted-D7cq4xsa.js";
|
15
|
+
import '../../assets/Dropdown.css';function Ot({ defaultContainers: e = [], portals: t, mainTreeNode: o } = {}) {
|
16
|
+
let d = Pe(o), f = S(() => {
|
17
|
+
var b, m;
|
18
|
+
let l = [];
|
19
|
+
for (let r of e) r !== null && (r instanceof HTMLElement ? l.push(r) : "current" in r && r.current instanceof HTMLElement && l.push(r.current));
|
20
|
+
if (t != null && t.current) for (let r of t.current) l.push(r);
|
21
|
+
for (let r of (b = d == null ? void 0 : d.querySelectorAll("html > *, body > *")) != null ? b : []) r !== document.body && r !== document.head && r instanceof HTMLElement && r.id !== "headlessui-portal-root" && (o && (r.contains(o) || r.contains((m = o == null ? void 0 : o.getRootNode()) == null ? void 0 : m.host)) || l.some((h) => r.contains(h)) || l.push(r));
|
22
|
+
return l;
|
21
23
|
});
|
22
|
-
return { resolveContainers:
|
24
|
+
return { resolveContainers: f, contains: S((b) => f().some((m) => m.contains(b))) };
|
23
25
|
}
|
24
|
-
let
|
25
|
-
function
|
26
|
-
let [
|
27
|
-
return
|
28
|
-
var
|
29
|
-
if (
|
30
|
-
for (let
|
31
|
-
|
26
|
+
let Ue = ae(null);
|
27
|
+
function je({ children: e, node: t }) {
|
28
|
+
let [o, d] = W(null), f = Xe(t ?? o);
|
29
|
+
return y.createElement(Ue.Provider, { value: f }, e, f === null && y.createElement(be, { features: he.Hidden, ref: (b) => {
|
30
|
+
var m, l;
|
31
|
+
if (b) {
|
32
|
+
for (let r of (l = (m = De(b)) == null ? void 0 : m.querySelectorAll("html > *, body > *")) != null ? l : []) if (r !== document.body && r !== document.head && r instanceof HTMLElement && r != null && r.contains(b)) {
|
33
|
+
d(r);
|
32
34
|
break;
|
33
35
|
}
|
34
36
|
}
|
35
37
|
} }));
|
36
38
|
}
|
37
|
-
function
|
38
|
-
var
|
39
|
-
return (
|
39
|
+
function Xe(e = null) {
|
40
|
+
var t;
|
41
|
+
return (t = ee(Ue)) != null ? t : e;
|
40
42
|
}
|
41
|
-
var
|
42
|
-
function
|
43
|
-
let e =
|
44
|
-
return
|
45
|
-
|
43
|
+
var J = ((e) => (e[e.Forwards = 0] = "Forwards", e[e.Backwards = 1] = "Backwards", e))(J || {});
|
44
|
+
function We() {
|
45
|
+
let e = M(0);
|
46
|
+
return ft(!0, "keydown", (t) => {
|
47
|
+
t.key === "Tab" && (e.current = t.shiftKey ? 1 : 0);
|
46
48
|
}, !0), e;
|
47
49
|
}
|
48
|
-
|
49
|
-
|
50
|
+
function Ze(e) {
|
51
|
+
var t;
|
52
|
+
return !!(e.enter || e.enterFrom || e.enterTo || e.leave || e.leaveFrom || e.leaveTo) || ((t = e.as) != null ? t : Je) !== pe || y.Children.count(e.children) === 1;
|
53
|
+
}
|
54
|
+
let ye = ae(null);
|
55
|
+
ye.displayName = "TransitionContext";
|
56
|
+
var xt = ((e) => (e.Visible = "visible", e.Hidden = "hidden", e))(xt || {});
|
57
|
+
function Nt() {
|
58
|
+
let e = ee(ye);
|
59
|
+
if (e === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
|
60
|
+
return e;
|
61
|
+
}
|
62
|
+
function Rt() {
|
63
|
+
let e = ee(Ee);
|
64
|
+
if (e === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
|
65
|
+
return e;
|
66
|
+
}
|
67
|
+
let Ee = ae(null);
|
68
|
+
Ee.displayName = "NestingContext";
|
69
|
+
function ge(e) {
|
70
|
+
return "children" in e ? ge(e.children) : e.current.filter(({ el: t }) => t.current !== null).filter(({ state: t }) => t === "visible").length > 0;
|
71
|
+
}
|
72
|
+
function qe(e, t) {
|
73
|
+
let o = Ie(e), d = M([]), f = Mt(), b = it(), m = S((c, a = oe.Hidden) => {
|
74
|
+
let s = d.current.findIndex(({ el: u }) => u === c);
|
75
|
+
s !== -1 && (Q(a, { [oe.Unmount]() {
|
76
|
+
d.current.splice(s, 1);
|
77
|
+
}, [oe.Hidden]() {
|
78
|
+
d.current[s].state = "hidden";
|
79
|
+
} }), b.microTask(() => {
|
80
|
+
var u;
|
81
|
+
!ge(d) && f.current && ((u = o.current) == null || u.call(o));
|
82
|
+
}));
|
83
|
+
}), l = S((c) => {
|
84
|
+
let a = d.current.find(({ el: s }) => s === c);
|
85
|
+
return a ? a.state !== "visible" && (a.state = "visible") : d.current.push({ el: c, state: "visible" }), () => m(c, oe.Unmount);
|
86
|
+
}), r = M([]), h = M(Promise.resolve()), n = M({ enter: [], leave: [] }), E = S((c, a, s) => {
|
87
|
+
r.current.splice(0), t && (t.chains.current[a] = t.chains.current[a].filter(([u]) => u !== c)), t == null || t.chains.current[a].push([c, new Promise((u) => {
|
88
|
+
r.current.push(u);
|
89
|
+
})]), t == null || t.chains.current[a].push([c, new Promise((u) => {
|
90
|
+
Promise.all(n.current[a].map(([$, T]) => T)).then(() => u());
|
91
|
+
})]), a === "enter" ? h.current = h.current.then(() => t == null ? void 0 : t.wait.current).then(() => s(a)) : s(a);
|
92
|
+
}), P = S((c, a, s) => {
|
93
|
+
Promise.all(n.current[a].splice(0).map(([u, $]) => $)).then(() => {
|
94
|
+
var u;
|
95
|
+
(u = r.current.shift()) == null || u();
|
96
|
+
}).then(() => s(a));
|
97
|
+
});
|
98
|
+
return K(() => ({ children: d, register: l, unregister: m, onStart: E, onStop: P, wait: h, chains: n }), [l, m, d, E, P, n, h]);
|
99
|
+
}
|
100
|
+
let Je = pe, Qe = ve.RenderStrategy;
|
101
|
+
function Lt(e, t) {
|
102
|
+
var o, d;
|
103
|
+
let { transition: f = !0, beforeEnter: b, afterEnter: m, beforeLeave: l, afterLeave: r, enter: h, enterFrom: n, enterTo: E, entered: P, leave: c, leaveFrom: a, leaveTo: s, ...u } = e, [$, T] = W(null), g = M(null), C = Ze(e), H = z(...C ? [g, t, T] : t === null ? [] : [t]), Z = (o = u.unmount) == null || o ? oe.Unmount : oe.Hidden, { show: F, appear: B, initial: q } = Nt(), [k, O] = W(F ? "visible" : "hidden"), U = Rt(), { register: N, unregister: R } = U;
|
104
|
+
ie(() => N(g), [N, g]), ie(() => {
|
105
|
+
if (Z === oe.Hidden && g.current) {
|
106
|
+
if (F && k !== "visible") {
|
107
|
+
O("visible");
|
108
|
+
return;
|
109
|
+
}
|
110
|
+
return Q(k, { hidden: () => R(g), visible: () => N(g) });
|
111
|
+
}
|
112
|
+
}, [k, g, N, R, F, Z]);
|
113
|
+
let j = He();
|
114
|
+
ie(() => {
|
115
|
+
if (C && j && k === "visible" && g.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
|
116
|
+
}, [g, k, j, C]);
|
117
|
+
let te = q && !B, X = B && F && q, v = M(!1), i = qe(() => {
|
118
|
+
v.current || (O("hidden"), R(g));
|
119
|
+
}, U), p = S((A) => {
|
120
|
+
v.current = !0;
|
121
|
+
let ne = A ? "enter" : "leave";
|
122
|
+
i.onStart(g, ne, (se) => {
|
123
|
+
se === "enter" ? b == null || b() : se === "leave" && (l == null || l());
|
124
|
+
});
|
125
|
+
}), _ = S((A) => {
|
126
|
+
let ne = A ? "enter" : "leave";
|
127
|
+
v.current = !1, i.onStop(g, ne, (se) => {
|
128
|
+
se === "enter" ? m == null || m() : se === "leave" && (r == null || r());
|
129
|
+
}), ne === "leave" && !ge(i) && (O("hidden"), R(g));
|
130
|
+
});
|
131
|
+
de(() => {
|
132
|
+
C && f || (p(F), _(F));
|
133
|
+
}, [F, C, f]);
|
134
|
+
let w = !(!f || !C || !j || te), [, I] = ke(w, $, F, { start: p, end: _ }), x = at({ ref: H, className: ((d = ut(u.className, X && h, X && n, I.enter && h, I.enter && I.closed && n, I.enter && !I.closed && E, I.leave && c, I.leave && !I.closed && a, I.leave && I.closed && s, !I.transition && F && P)) == null ? void 0 : d.trim()) || void 0, ...Me(I) }), L = 0;
|
135
|
+
return k === "visible" && (L |= D.Open), k === "hidden" && (L |= D.Closed), I.enter && (L |= D.Opening), I.leave && (L |= D.Closing), y.createElement(Ee.Provider, { value: i }, y.createElement(Ge, { value: L }, ue({ ourProps: x, theirProps: u, defaultTag: Je, features: Qe, visible: k === "visible", name: "Transition.Child" })));
|
136
|
+
}
|
137
|
+
function At(e, t) {
|
138
|
+
let { show: o, appear: d = !1, unmount: f = !0, ...b } = e, m = M(null), l = Ze(e), r = z(...l ? [m, t] : t === null ? [] : [t]);
|
139
|
+
He();
|
140
|
+
let h = $e();
|
141
|
+
if (o === void 0 && h !== null && (o = (h & D.Open) === D.Open), o === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
|
142
|
+
let [n, E] = W(o ? "visible" : "hidden"), P = qe(() => {
|
143
|
+
o || E("hidden");
|
144
|
+
}), [c, a] = W(!0), s = M([o]);
|
145
|
+
ie(() => {
|
146
|
+
c !== !1 && s.current[s.current.length - 1] !== o && (s.current.push(o), a(!1));
|
147
|
+
}, [s, o]);
|
148
|
+
let u = K(() => ({ show: o, appear: d, initial: c }), [o, d, c]);
|
149
|
+
ie(() => {
|
150
|
+
o ? E("visible") : !ge(P) && m.current !== null && E("hidden");
|
151
|
+
}, [o, P]);
|
152
|
+
let $ = { unmount: f }, T = S(() => {
|
153
|
+
var C;
|
154
|
+
c && a(!1), (C = e.beforeEnter) == null || C.call(e);
|
155
|
+
}), g = S(() => {
|
156
|
+
var C;
|
157
|
+
c && a(!1), (C = e.beforeLeave) == null || C.call(e);
|
158
|
+
});
|
159
|
+
return y.createElement(Ee.Provider, { value: P }, y.createElement(ye.Provider, { value: u }, ue({ ourProps: { ...$, as: pe, children: y.createElement(Ve, { ref: r, ...$, ...b, beforeEnter: T, beforeLeave: g }) }, theirProps: {}, defaultTag: pe, features: Qe, visible: n === "visible", name: "Transition" })));
|
160
|
+
}
|
161
|
+
function Dt(e, t) {
|
162
|
+
let o = ee(ye) !== null, d = $e() !== null;
|
163
|
+
return y.createElement(y.Fragment, null, !o && d ? y.createElement(Be, { ref: t, ...e }) : y.createElement(Ve, { ref: t, ...e }));
|
164
|
+
}
|
165
|
+
let Be = V(At), Ve = V(Lt), Ht = V(Dt), Gt = Object.assign(Be, { Child: Ht, Root: Be });
|
166
|
+
var Kt = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(Kt || {}), Ut = ((e) => (e[e.TogglePopover = 0] = "TogglePopover", e[e.ClosePopover = 1] = "ClosePopover", e[e.SetButton = 2] = "SetButton", e[e.SetButtonId = 3] = "SetButtonId", e[e.SetPanel = 4] = "SetPanel", e[e.SetPanelId = 5] = "SetPanelId", e))(Ut || {});
|
167
|
+
let jt = { 0: (e) => ({ ...e, popoverState: Q(e.popoverState, { 0: 1, 1: 0 }), __demoMode: !1 }), 1(e) {
|
50
168
|
return e.popoverState === 1 ? e : { ...e, popoverState: 1, __demoMode: !1 };
|
51
|
-
}, 2(e,
|
52
|
-
return e.button ===
|
53
|
-
}, 3(e,
|
54
|
-
return e.buttonId ===
|
55
|
-
}, 4(e,
|
56
|
-
return e.panel ===
|
57
|
-
}, 5(e,
|
58
|
-
return e.panelId ===
|
59
|
-
} },
|
60
|
-
|
61
|
-
function
|
62
|
-
let
|
63
|
-
if (
|
64
|
-
let
|
65
|
-
throw Error.captureStackTrace && Error.captureStackTrace(
|
169
|
+
}, 2(e, t) {
|
170
|
+
return e.button === t.button ? e : { ...e, button: t.button };
|
171
|
+
}, 3(e, t) {
|
172
|
+
return e.buttonId === t.buttonId ? e : { ...e, buttonId: t.buttonId };
|
173
|
+
}, 4(e, t) {
|
174
|
+
return e.panel === t.panel ? e : { ...e, panel: t.panel };
|
175
|
+
}, 5(e, t) {
|
176
|
+
return e.panelId === t.panelId ? e : { ...e, panelId: t.panelId };
|
177
|
+
} }, xe = ae(null);
|
178
|
+
xe.displayName = "PopoverContext";
|
179
|
+
function Se(e) {
|
180
|
+
let t = ee(xe);
|
181
|
+
if (t === null) {
|
182
|
+
let o = new Error(`<${e} /> is missing a parent <Popover /> component.`);
|
183
|
+
throw Error.captureStackTrace && Error.captureStackTrace(o, Se), o;
|
66
184
|
}
|
67
|
-
return
|
185
|
+
return t;
|
68
186
|
}
|
69
|
-
let
|
70
|
-
|
71
|
-
function
|
72
|
-
let
|
73
|
-
if (
|
74
|
-
let
|
75
|
-
throw Error.captureStackTrace && Error.captureStackTrace(
|
187
|
+
let Te = ae(null);
|
188
|
+
Te.displayName = "PopoverAPIContext";
|
189
|
+
function Ne(e) {
|
190
|
+
let t = ee(Te);
|
191
|
+
if (t === null) {
|
192
|
+
let o = new Error(`<${e} /> is missing a parent <Popover /> component.`);
|
193
|
+
throw Error.captureStackTrace && Error.captureStackTrace(o, Ne), o;
|
76
194
|
}
|
77
|
-
return
|
195
|
+
return t;
|
78
196
|
}
|
79
|
-
let
|
80
|
-
|
81
|
-
function
|
82
|
-
return
|
197
|
+
let Re = ae(null);
|
198
|
+
Re.displayName = "PopoverGroupContext";
|
199
|
+
function Ye() {
|
200
|
+
return ee(Re);
|
83
201
|
}
|
84
|
-
let
|
85
|
-
|
86
|
-
function
|
87
|
-
return
|
202
|
+
let _e = ae(null);
|
203
|
+
_e.displayName = "PopoverPanelContext";
|
204
|
+
function Xt() {
|
205
|
+
return ee(_e);
|
88
206
|
}
|
89
|
-
function
|
90
|
-
return
|
207
|
+
function Wt(e, t) {
|
208
|
+
return Q(t.type, jt, e, t);
|
91
209
|
}
|
92
|
-
let
|
93
|
-
function
|
94
|
-
var
|
95
|
-
let { __demoMode:
|
96
|
-
|
97
|
-
})),
|
98
|
-
if (!
|
99
|
-
for (let
|
100
|
-
let
|
101
|
-
return !
|
102
|
-
}, [
|
103
|
-
var
|
104
|
-
return (
|
210
|
+
let Zt = "div";
|
211
|
+
function qt(e, t) {
|
212
|
+
var o;
|
213
|
+
let { __demoMode: d = !1, ...f } = e, b = M(null), m = z(t, st((v) => {
|
214
|
+
b.current = v;
|
215
|
+
})), l = M([]), r = rt(Wt, { __demoMode: d, popoverState: d ? 0 : 1, buttons: l, button: null, buttonId: null, panel: null, panelId: null, beforePanelSentinel: we(), afterPanelSentinel: we(), afterButtonSentinel: we() }), [{ popoverState: h, button: n, buttonId: E, panel: P, panelId: c, beforePanelSentinel: a, afterPanelSentinel: s, afterButtonSentinel: u }, $] = r, T = Pe((o = b.current) != null ? o : n), g = K(() => {
|
216
|
+
if (!n || !P) return !1;
|
217
|
+
for (let x of document.querySelectorAll("body > *")) if (Number(x == null ? void 0 : x.contains(n)) ^ Number(x == null ? void 0 : x.contains(P))) return !0;
|
218
|
+
let v = Oe(), i = v.indexOf(n), p = (i + v.length - 1) % v.length, _ = (i + 1) % v.length, w = v[p], I = v[_];
|
219
|
+
return !P.contains(w) && !P.contains(I);
|
220
|
+
}, [n, P]), C = Ie(E), H = Ie(c), Z = K(() => ({ buttonId: C, panelId: H, close: () => $({ type: 1 }) }), [C, H, $]), F = Ye(), B = F == null ? void 0 : F.registerPopover, q = S(() => {
|
221
|
+
var v;
|
222
|
+
return (v = F == null ? void 0 : F.isFocusWithinPopoverGroup()) != null ? v : (T == null ? void 0 : T.activeElement) && ((n == null ? void 0 : n.contains(T.activeElement)) || (P == null ? void 0 : P.contains(T.activeElement)));
|
105
223
|
});
|
106
|
-
|
107
|
-
let [
|
108
|
-
|
109
|
-
var
|
110
|
-
|
111
|
-
}, !0),
|
112
|
-
$({ type: 1 }),
|
224
|
+
de(() => B == null ? void 0 : B(Z), [B, Z]);
|
225
|
+
let [k, O] = mt(), U = Xe(n), N = Ot({ mainTreeNode: U, portals: k, defaultContainers: [n, P] });
|
226
|
+
bt(T == null ? void 0 : T.defaultView, "focus", (v) => {
|
227
|
+
var i, p, _, w, I, x;
|
228
|
+
v.target !== window && v.target instanceof HTMLElement && h === 0 && (q() || n && P && (N.contains(v.target) || (p = (i = a.current) == null ? void 0 : i.contains) != null && p.call(i, v.target) || (w = (_ = s.current) == null ? void 0 : _.contains) != null && w.call(_, v.target) || (x = (I = u.current) == null ? void 0 : I.contains) != null && x.call(I, v.target) || $({ type: 1 })));
|
229
|
+
}, !0), ht(h === 0, N.resolveContainers, (v, i) => {
|
230
|
+
$({ type: 1 }), Bt(i, kt.Loose) || (v.preventDefault(), n == null || n.focus());
|
113
231
|
});
|
114
|
-
let
|
232
|
+
let R = S((v) => {
|
115
233
|
$({ type: 1 });
|
116
|
-
let
|
117
|
-
|
118
|
-
}),
|
119
|
-
return
|
234
|
+
let i = v ? v instanceof HTMLElement ? v : "current" in v && v.current instanceof HTMLElement ? v.current : n : n;
|
235
|
+
i == null || i.focus();
|
236
|
+
}), j = K(() => ({ close: R, isPortalled: g }), [R, g]), te = K(() => ({ open: h === 0, close: R }), [h, R]), X = { ref: m };
|
237
|
+
return y.createElement(je, { node: U }, y.createElement(Pt, null, y.createElement(_e.Provider, { value: null }, y.createElement(xe.Provider, { value: r }, y.createElement(Te.Provider, { value: j }, y.createElement(Ft, { value: R }, y.createElement(Ge, { value: Q(h, { 0: D.Open, 1: D.Closed }) }, y.createElement(O, null, ue({ ourProps: X, theirProps: f, slot: te, defaultTag: Zt, name: "Popover" })))))))));
|
120
238
|
}
|
121
|
-
let
|
122
|
-
function
|
123
|
-
let
|
124
|
-
|
125
|
-
if (!
|
126
|
-
|
239
|
+
let Jt = "button";
|
240
|
+
function Qt(e, t) {
|
241
|
+
let o = me(), { id: d = `headlessui-popover-button-${o}`, disabled: f = !1, autoFocus: b = !1, ...m } = e, [l, r] = Se("Popover.Button"), { isPortalled: h } = Ne("Popover.Button"), n = M(null), E = `headlessui-focus-sentinel-${me()}`, P = Ye(), c = P == null ? void 0 : P.closeOthers, a = Xt() !== null;
|
242
|
+
de(() => {
|
243
|
+
if (!a) return r({ type: 3, buttonId: d }), () => {
|
244
|
+
r({ type: 3, buttonId: null });
|
127
245
|
};
|
128
|
-
}, [
|
129
|
-
let [
|
130
|
-
if (!
|
131
|
-
if (
|
246
|
+
}, [a, d, r]);
|
247
|
+
let [s] = W(() => Symbol()), u = z(n, t, $t(), S((i) => {
|
248
|
+
if (!a) {
|
249
|
+
if (i) l.buttons.current.push(s);
|
132
250
|
else {
|
133
|
-
let
|
134
|
-
|
251
|
+
let p = l.buttons.current.indexOf(s);
|
252
|
+
p !== -1 && l.buttons.current.splice(p, 1);
|
135
253
|
}
|
136
|
-
|
254
|
+
l.buttons.current.length > 1 && console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."), i && r({ type: 2, button: i });
|
137
255
|
}
|
138
|
-
})), $ =
|
139
|
-
var
|
140
|
-
if (
|
141
|
-
if (
|
142
|
-
switch (
|
143
|
-
case
|
144
|
-
case
|
145
|
-
|
256
|
+
})), $ = z(n, t), T = Pe(n), g = S((i) => {
|
257
|
+
var p, _, w;
|
258
|
+
if (a) {
|
259
|
+
if (l.popoverState === 1) return;
|
260
|
+
switch (i.key) {
|
261
|
+
case re.Space:
|
262
|
+
case re.Enter:
|
263
|
+
i.preventDefault(), (_ = (p = i.target).click) == null || _.call(p), r({ type: 1 }), (w = l.button) == null || w.focus();
|
146
264
|
break;
|
147
265
|
}
|
148
|
-
} else switch (
|
149
|
-
case
|
150
|
-
case
|
151
|
-
|
266
|
+
} else switch (i.key) {
|
267
|
+
case re.Space:
|
268
|
+
case re.Enter:
|
269
|
+
i.preventDefault(), i.stopPropagation(), l.popoverState === 1 && (c == null || c(l.buttonId)), r({ type: 0 });
|
152
270
|
break;
|
153
|
-
case
|
154
|
-
if (
|
155
|
-
if (!
|
156
|
-
|
271
|
+
case re.Escape:
|
272
|
+
if (l.popoverState !== 0) return c == null ? void 0 : c(l.buttonId);
|
273
|
+
if (!n.current || T != null && T.activeElement && !n.current.contains(T.activeElement)) return;
|
274
|
+
i.preventDefault(), i.stopPropagation(), r({ type: 1 });
|
157
275
|
break;
|
158
276
|
}
|
159
|
-
}),
|
160
|
-
|
161
|
-
}),
|
162
|
-
var
|
163
|
-
|
164
|
-
}),
|
165
|
-
|
166
|
-
}), { isFocusVisible:
|
167
|
-
let
|
168
|
-
if (!
|
169
|
-
function
|
170
|
-
|
277
|
+
}), C = S((i) => {
|
278
|
+
a || i.key === re.Space && i.preventDefault();
|
279
|
+
}), H = S((i) => {
|
280
|
+
var p, _;
|
281
|
+
Ke(i.currentTarget) || f || (a ? (r({ type: 1 }), (p = l.button) == null || p.focus()) : (i.preventDefault(), i.stopPropagation(), l.popoverState === 1 && (c == null || c(l.buttonId)), r({ type: 0 }), (_ = l.button) == null || _.focus()));
|
282
|
+
}), Z = S((i) => {
|
283
|
+
i.preventDefault(), i.stopPropagation();
|
284
|
+
}), { isFocusVisible: F, focusProps: B } = ct({ autoFocus: b }), { isHovered: q, hoverProps: k } = dt({ isDisabled: f }), { pressed: O, pressProps: U } = vt({ disabled: f }), N = l.popoverState === 0, R = K(() => ({ open: N, active: O || N, disabled: f, hover: q, focus: F, autofocus: b }), [N, q, F, O, f, b]), j = It(e, l.button), te = a ? Ce({ ref: $, type: j, onKeyDown: g, onClick: H, disabled: f || void 0, autoFocus: b }, B, k, U) : Ce({ ref: u, id: l.buttonId, type: j, "aria-expanded": l.popoverState === 0, "aria-controls": l.panel ? l.panelId : void 0, disabled: f || void 0, autoFocus: b, onKeyDown: g, onKeyUp: C, onClick: H, onMouseDown: Z }, B, k, U), X = We(), v = S(() => {
|
285
|
+
let i = l.panel;
|
286
|
+
if (!i) return;
|
287
|
+
function p() {
|
288
|
+
Q(X.current, { [J.Forwards]: () => le(i, Y.First), [J.Backwards]: () => le(i, Y.Last) }) === Fe.Error && le(Oe().filter((_) => _.dataset.headlessuiFocusGuard !== "true"), Q(X.current, { [J.Forwards]: Y.Next, [J.Backwards]: Y.Previous }), { relativeTo: l.button });
|
171
289
|
}
|
172
|
-
|
290
|
+
p();
|
173
291
|
});
|
174
|
-
return
|
292
|
+
return y.createElement(y.Fragment, null, ue({ ourProps: te, theirProps: m, slot: R, defaultTag: Jt, name: "Popover.Button" }), N && !a && h && y.createElement(be, { id: E, ref: l.afterButtonSentinel, features: he.Focusable, "data-headlessui-focus-guard": !0, as: "button", type: "button", onFocus: v }));
|
175
293
|
}
|
176
|
-
let
|
177
|
-
function
|
178
|
-
let
|
179
|
-
if (
|
180
|
-
|
181
|
-
}),
|
182
|
-
return
|
294
|
+
let Vt = "div", Yt = ve.RenderStrategy | ve.Static;
|
295
|
+
function ze(e, t) {
|
296
|
+
let o = me(), { id: d = `headlessui-popover-backdrop-${o}`, transition: f = !1, ...b } = e, [{ popoverState: m }, l] = Se("Popover.Backdrop"), [r, h] = W(null), n = z(t, h), E = $e(), [P, c] = ke(f, r, E !== null ? (E & D.Open) === D.Open : m === 0), a = S(($) => {
|
297
|
+
if (Ke($.currentTarget)) return $.preventDefault();
|
298
|
+
l({ type: 1 });
|
299
|
+
}), s = K(() => ({ open: m === 0 }), [m]), u = { ref: n, id: d, "aria-hidden": !0, onClick: a, ...Me(c) };
|
300
|
+
return ue({ ourProps: u, theirProps: b, slot: s, defaultTag: Vt, features: Yt, visible: P, name: "Popover.Backdrop" });
|
183
301
|
}
|
184
|
-
let
|
185
|
-
function
|
186
|
-
let
|
187
|
-
$ && (
|
188
|
-
let [
|
189
|
-
|
190
|
-
|
191
|
-
}), [
|
192
|
-
let
|
193
|
-
|
194
|
-
|
302
|
+
let zt = "div", en = ve.RenderStrategy | ve.Static;
|
303
|
+
function tn(e, t) {
|
304
|
+
let o = me(), { id: d = `headlessui-popover-panel-${o}`, focus: f = !1, anchor: b, portal: m = !1, modal: l = !1, transition: r = !1, ...h } = e, [n, E] = Se("Popover.Panel"), { close: P, isPortalled: c } = Ne("Popover.Panel"), a = `headlessui-focus-sentinel-before-${o}`, s = `headlessui-focus-sentinel-after-${o}`, u = M(null), $ = yt(b), [T, g] = Et($), C = gt();
|
305
|
+
$ && (m = !0);
|
306
|
+
let [H, Z] = W(null), F = z(u, t, $ ? T : null, S((p) => E({ type: 4, panel: p })), Z), B = Pe(u), q = pt();
|
307
|
+
ie(() => (E({ type: 5, panelId: d }), () => {
|
308
|
+
E({ type: 5, panelId: null });
|
309
|
+
}), [d, E]);
|
310
|
+
let k = $e(), [O, U] = ke(r, H, k !== null ? (k & D.Open) === D.Open : n.popoverState === 0);
|
311
|
+
St(O, n.button, () => {
|
312
|
+
E({ type: 1 });
|
195
313
|
});
|
196
|
-
let
|
197
|
-
|
198
|
-
let
|
199
|
-
var
|
200
|
-
switch (
|
201
|
-
case
|
202
|
-
if (
|
203
|
-
|
314
|
+
let N = n.__demoMode ? !1 : l && O;
|
315
|
+
Tt(N, B);
|
316
|
+
let R = S((p) => {
|
317
|
+
var _;
|
318
|
+
switch (p.key) {
|
319
|
+
case re.Escape:
|
320
|
+
if (n.popoverState !== 0 || !u.current || B != null && B.activeElement && !u.current.contains(B.activeElement)) return;
|
321
|
+
p.preventDefault(), p.stopPropagation(), E({ type: 1 }), (_ = n.button) == null || _.focus();
|
204
322
|
break;
|
205
323
|
}
|
206
324
|
});
|
207
|
-
|
208
|
-
var
|
209
|
-
e.static ||
|
210
|
-
}, [
|
211
|
-
if (
|
212
|
-
let
|
213
|
-
|
214
|
-
}, [
|
215
|
-
let
|
216
|
-
var
|
217
|
-
let
|
218
|
-
|
219
|
-
} : void 0, tabIndex: -1, style: { ...
|
220
|
-
let
|
221
|
-
if (!
|
222
|
-
function
|
223
|
-
|
224
|
-
var
|
225
|
-
|
226
|
-
}, [
|
227
|
-
var
|
228
|
-
(
|
325
|
+
de(() => {
|
326
|
+
var p;
|
327
|
+
e.static || n.popoverState === 1 && ((p = e.unmount) == null || p) && E({ type: 4, panel: null });
|
328
|
+
}, [n.popoverState, e.unmount, e.static, E]), de(() => {
|
329
|
+
if (n.__demoMode || !f || n.popoverState !== 0 || !u.current) return;
|
330
|
+
let p = B == null ? void 0 : B.activeElement;
|
331
|
+
u.current.contains(p) || le(u.current, Y.First);
|
332
|
+
}, [n.__demoMode, f, u.current, n.popoverState]);
|
333
|
+
let j = K(() => ({ open: n.popoverState === 0, close: P }), [n.popoverState, P]), te = Ce($ ? C() : {}, { ref: F, id: d, onKeyDown: R, onBlur: f && n.popoverState === 0 ? (p) => {
|
334
|
+
var _, w, I, x, L;
|
335
|
+
let A = p.relatedTarget;
|
336
|
+
A && u.current && ((_ = u.current) != null && _.contains(A) || (E({ type: 1 }), ((I = (w = n.beforePanelSentinel.current) == null ? void 0 : w.contains) != null && I.call(w, A) || (L = (x = n.afterPanelSentinel.current) == null ? void 0 : x.contains) != null && L.call(x, A)) && A.focus({ preventScroll: !0 })));
|
337
|
+
} : void 0, tabIndex: -1, style: { ...h.style, ...g, "--button-width": _t(n.button, !0).width }, ...Me(U) }), X = We(), v = S(() => {
|
338
|
+
let p = u.current;
|
339
|
+
if (!p) return;
|
340
|
+
function _() {
|
341
|
+
Q(X.current, { [J.Forwards]: () => {
|
342
|
+
var w;
|
343
|
+
le(p, Y.First) === Fe.Error && ((w = n.afterPanelSentinel.current) == null || w.focus());
|
344
|
+
}, [J.Backwards]: () => {
|
345
|
+
var w;
|
346
|
+
(w = n.button) == null || w.focus({ preventScroll: !0 });
|
229
347
|
} });
|
230
348
|
}
|
231
|
-
|
232
|
-
}),
|
233
|
-
let
|
234
|
-
if (!
|
235
|
-
function
|
236
|
-
|
237
|
-
if (!
|
238
|
-
let
|
239
|
-
for (let
|
240
|
-
let
|
241
|
-
|
349
|
+
_();
|
350
|
+
}), i = S(() => {
|
351
|
+
let p = u.current;
|
352
|
+
if (!p) return;
|
353
|
+
function _() {
|
354
|
+
Q(X.current, { [J.Forwards]: () => {
|
355
|
+
if (!n.button) return;
|
356
|
+
let w = Oe(), I = w.indexOf(n.button), x = w.slice(0, I + 1), L = [...w.slice(I + 1), ...x];
|
357
|
+
for (let A of L.slice()) if (A.dataset.headlessuiFocusGuard === "true" || H != null && H.contains(A)) {
|
358
|
+
let ne = L.indexOf(A);
|
359
|
+
ne !== -1 && L.splice(ne, 1);
|
242
360
|
}
|
243
|
-
|
244
|
-
}, [
|
245
|
-
var
|
246
|
-
|
361
|
+
le(L, Y.First, { sorted: !1 });
|
362
|
+
}, [J.Backwards]: () => {
|
363
|
+
var w;
|
364
|
+
le(p, Y.Previous) === Fe.Error && ((w = n.button) == null || w.focus());
|
247
365
|
} });
|
248
366
|
}
|
249
|
-
|
367
|
+
_();
|
250
368
|
});
|
251
|
-
return
|
369
|
+
return y.createElement(Ct, null, y.createElement(_e.Provider, { value: d }, y.createElement(Te.Provider, { value: { close: P, isPortalled: c } }, y.createElement(wt, { enabled: m ? e.static || O : !1 }, O && c && y.createElement(be, { id: a, ref: n.beforePanelSentinel, features: he.Focusable, "data-headlessui-focus-guard": !0, as: "button", type: "button", onFocus: v }), ue({ mergeRefs: q, ourProps: te, theirProps: h, slot: j, defaultTag: zt, features: en, visible: O, name: "Popover.Panel" }), O && c && y.createElement(be, { id: s, ref: n.afterPanelSentinel, features: he.Focusable, "data-headlessui-focus-guard": !0, as: "button", type: "button", onFocus: i })))));
|
252
370
|
}
|
253
|
-
let
|
254
|
-
function
|
255
|
-
let
|
256
|
-
|
257
|
-
let
|
258
|
-
if (
|
259
|
-
let $ =
|
260
|
-
return $.splice(
|
371
|
+
let nn = "div";
|
372
|
+
function rn(e, t) {
|
373
|
+
let o = M(null), d = z(o, t), [f, b] = W([]), m = S((a) => {
|
374
|
+
b((s) => {
|
375
|
+
let u = s.indexOf(a);
|
376
|
+
if (u !== -1) {
|
377
|
+
let $ = s.slice();
|
378
|
+
return $.splice(u, 1), $;
|
261
379
|
}
|
262
|
-
return
|
380
|
+
return s;
|
263
381
|
});
|
264
|
-
}),
|
265
|
-
var
|
266
|
-
let
|
267
|
-
if (!
|
268
|
-
let
|
269
|
-
return (
|
270
|
-
var T,
|
271
|
-
return ((T =
|
382
|
+
}), l = S((a) => (b((s) => [...s, a]), () => m(a))), r = S(() => {
|
383
|
+
var a;
|
384
|
+
let s = De(o);
|
385
|
+
if (!s) return !1;
|
386
|
+
let u = s.activeElement;
|
387
|
+
return (a = o.current) != null && a.contains(u) ? !0 : f.some(($) => {
|
388
|
+
var T, g;
|
389
|
+
return ((T = s.getElementById($.buttonId.current)) == null ? void 0 : T.contains(u)) || ((g = s.getElementById($.panelId.current)) == null ? void 0 : g.contains(u));
|
272
390
|
});
|
273
|
-
}),
|
274
|
-
for (let
|
275
|
-
}),
|
276
|
-
return
|
391
|
+
}), h = S((a) => {
|
392
|
+
for (let s of f) s.buttonId.current !== a && s.close();
|
393
|
+
}), n = K(() => ({ registerPopover: l, unregisterPopover: m, isFocusWithinPopoverGroup: r, closeOthers: h }), [l, m, r, h]), E = K(() => ({}), []), P = e, c = { ref: d };
|
394
|
+
return y.createElement(je, null, y.createElement(Re.Provider, { value: n }, ue({ ourProps: c, theirProps: P, slot: E, defaultTag: nn, name: "Popover.Group" })));
|
277
395
|
}
|
278
|
-
let
|
279
|
-
const
|
280
|
-
menu:
|
281
|
-
"menu-button": "_menu-
|
282
|
-
"menu-items": "_menu-
|
283
|
-
"menu-items-container": "_menu-items-
|
284
|
-
|
396
|
+
let on = V(qt), et = V(Qt), ln = V(ze), an = V(ze), tt = V(tn), un = V(rn), sn = Object.assign(on, { Button: et, Backdrop: an, Overlay: ln, Panel: tt, Group: un });
|
397
|
+
const cn = "_menu_1o2uo_3", dn = "_enter_1o2uo_34", pn = "_leave_1o2uo_48", G = {
|
398
|
+
menu: cn,
|
399
|
+
"menu-button": "_menu-button_1o2uo_6",
|
400
|
+
"menu-items": "_menu-items_1o2uo_11",
|
401
|
+
"menu-items-container": "_menu-items-container_1o2uo_22",
|
402
|
+
"close-button": "_close-button_1o2uo_28",
|
403
|
+
enter: dn,
|
404
|
+
"enter-from": "_enter-from_1o2uo_38",
|
405
|
+
"enter-to": "_enter-to_1o2uo_43",
|
406
|
+
leave: pn,
|
407
|
+
"leave-from": "_leave-from_1o2uo_52",
|
408
|
+
"leave-to": "_leave-to_1o2uo_57"
|
409
|
+
}, In = 300, Cn = ot(
|
285
410
|
({
|
286
411
|
children: e,
|
287
|
-
position:
|
288
|
-
popoverProps:
|
289
|
-
className:
|
290
|
-
buttonClassName:
|
291
|
-
panelClassName:
|
292
|
-
menuItemsClassName:
|
293
|
-
buttonContent:
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
412
|
+
position: t = "bottom end",
|
413
|
+
popoverProps: o,
|
414
|
+
className: d,
|
415
|
+
buttonClassName: f,
|
416
|
+
panelClassName: b,
|
417
|
+
menuItemsClassName: m,
|
418
|
+
buttonContent: l,
|
419
|
+
needCloseButton: r,
|
420
|
+
openOnHover: h = !1,
|
421
|
+
isOpen: n = !1
|
422
|
+
}) => {
|
423
|
+
const [E, P] = W(n), c = M(null), a = M(null), s = Ae(() => {
|
424
|
+
h && P(!0);
|
425
|
+
}, [h]), u = Ae(
|
426
|
+
($) => {
|
427
|
+
if (h) {
|
428
|
+
const T = $.relatedTarget;
|
429
|
+
c.current && !c.current.contains(T) && a.current && !a.current.contains(T) && P(!1);
|
430
|
+
}
|
431
|
+
},
|
432
|
+
[h]
|
433
|
+
);
|
434
|
+
return /* @__PURE__ */ ce(
|
435
|
+
sn,
|
436
|
+
{
|
437
|
+
as: "div",
|
438
|
+
className: fe(G.menu, d),
|
439
|
+
...o,
|
440
|
+
children: ({ open: $, close: T }) => {
|
441
|
+
const g = () => {
|
442
|
+
T(), P(!1);
|
443
|
+
};
|
444
|
+
return /* @__PURE__ */ Le(nt, { children: [
|
445
|
+
/* @__PURE__ */ ce(
|
446
|
+
et,
|
316
447
|
{
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
),
|
321
|
-
children:
|
448
|
+
ref: c,
|
449
|
+
onMouseEnter: s,
|
450
|
+
onMouseLeave: u,
|
451
|
+
className: fe(G["menu-button"], f),
|
452
|
+
children: l
|
453
|
+
}
|
454
|
+
),
|
455
|
+
/* @__PURE__ */ ce(
|
456
|
+
Gt,
|
457
|
+
{
|
458
|
+
show: E || $,
|
459
|
+
as: pe,
|
460
|
+
enter: G.enter,
|
461
|
+
enterFrom: G["enter-from"],
|
462
|
+
enterTo: G["enter-to"],
|
463
|
+
leave: G.leave,
|
464
|
+
leaveFrom: G["leave-from"],
|
465
|
+
leaveTo: G["leave-to"],
|
466
|
+
children: /* @__PURE__ */ Le(
|
467
|
+
tt,
|
468
|
+
{
|
469
|
+
ref: a,
|
470
|
+
anchor: t,
|
471
|
+
onMouseEnter: s,
|
472
|
+
onMouseLeave: u,
|
473
|
+
className: fe(G["menu-items"], b),
|
474
|
+
children: [
|
475
|
+
r && /* @__PURE__ */ ce(
|
476
|
+
lt,
|
477
|
+
{
|
478
|
+
isIconButton: !0,
|
479
|
+
iconName: "Close16px",
|
480
|
+
onClick: g,
|
481
|
+
clear: !0,
|
482
|
+
className: G["close-button"]
|
483
|
+
}
|
484
|
+
),
|
485
|
+
/* @__PURE__ */ ce(
|
486
|
+
"div",
|
487
|
+
{
|
488
|
+
className: fe(
|
489
|
+
G["menu-items-container"],
|
490
|
+
m
|
491
|
+
),
|
492
|
+
children: typeof e == "function" ? e({ close: g }) : e
|
493
|
+
}
|
494
|
+
)
|
495
|
+
]
|
496
|
+
}
|
497
|
+
)
|
322
498
|
}
|
323
499
|
)
|
324
|
-
}
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
500
|
+
] });
|
501
|
+
}
|
502
|
+
}
|
503
|
+
);
|
504
|
+
}
|
329
505
|
);
|
330
506
|
export {
|
331
|
-
|
332
|
-
|
507
|
+
In as ANIMATION_DELAY,
|
508
|
+
Cn as Dropdown
|
333
509
|
};
|