mimir-ui-kit 1.38.41 → 1.38.43

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