mimir-ui-kit 1.42.2 → 1.43.0

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