@forsyteco/product-ui 0.0.11 → 0.0.13

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 (111) hide show
  1. package/dist/{active-element-history-BJ1HYFpN.mjs → active-element-history-B7wA4w4L.mjs} +3 -3
  2. package/dist/autocomplete/autocomplete.d.ts +87 -0
  3. package/dist/autocomplete/autocomplete.d.ts.map +1 -0
  4. package/dist/autocomplete/index.cjs +1 -0
  5. package/dist/autocomplete/index.d.ts +4 -0
  6. package/dist/autocomplete/index.d.ts.map +1 -0
  7. package/dist/autocomplete/index.mjs +4 -0
  8. package/dist/autocomplete/types.d.ts +7 -0
  9. package/dist/autocomplete/types.d.ts.map +1 -0
  10. package/dist/autocomplete-DqDP76nV.mjs +318 -0
  11. package/dist/autocomplete-DuGKfbQn.js +1 -0
  12. package/dist/avatar/index.mjs +1 -1
  13. package/dist/{avatar-CN9vtSKm.mjs → avatar-Br4ih6PQ.mjs} +2 -2
  14. package/dist/breadcrumb/index.cjs +1 -1
  15. package/dist/breadcrumb/index.mjs +1 -1
  16. package/dist/{breadcrumb-Bz_JVFcb.mjs → breadcrumb-C81R8CJz.mjs} +2 -2
  17. package/dist/{breadcrumb-y_RB72EG.js → breadcrumb-DJGlCCR1.js} +1 -1
  18. package/dist/{bugs-bn44RJ1Q.mjs → bugs-g7aYPtcD.mjs} +1 -1
  19. package/dist/calendar/calendar.d.ts.map +1 -1
  20. package/dist/calendar/index.cjs +1 -1
  21. package/dist/calendar/index.mjs +1 -1
  22. package/dist/{calendar-CAySGYDy.mjs → calendar-DQdo9vO-.mjs} +1058 -993
  23. package/dist/calendar-v2NOtsdr.js +1 -0
  24. package/dist/chevron-right-CIgI-iLu.js +1 -0
  25. package/dist/{chevron-right-DcjcIxI2.mjs → chevron-right-Ck5BtE5n.mjs} +11 -6
  26. package/dist/combobox/combobox.d.ts +72 -17
  27. package/dist/combobox/combobox.d.ts.map +1 -1
  28. package/dist/combobox/index.cjs +1 -1
  29. package/dist/combobox/index.d.ts +2 -1
  30. package/dist/combobox/index.d.ts.map +1 -1
  31. package/dist/combobox/index.mjs +1 -1
  32. package/dist/combobox/types.d.ts +7 -0
  33. package/dist/combobox/types.d.ts.map +1 -0
  34. package/dist/combobox-B1h2hn6a.js +4 -0
  35. package/dist/combobox-BHLjk9D9.mjs +293 -0
  36. package/dist/combobox-DxpuSWuM.js +1 -0
  37. package/dist/{combobox-Dyen_KC6.mjs → combobox-Umb1ZW9S.mjs} +358 -408
  38. package/dist/data-table/components/table-body.d.ts.map +1 -1
  39. package/dist/date-picker/date-picker.d.ts.map +1 -1
  40. package/dist/{description-CAH1nOgr.mjs → description-hiFZ303Y.mjs} +2 -2
  41. package/dist/dialog/index.mjs +1 -1
  42. package/dist/{dialog-nGcnK6o1.mjs → dialog-Cs7TMa7R.mjs} +53 -53
  43. package/dist/disclosure/index.cjs +1 -1
  44. package/dist/disclosure/index.mjs +1 -1
  45. package/dist/{disclosure-CA45jH3I.mjs → disclosure-DOWglOHy.mjs} +8 -12
  46. package/dist/{disclosure-CGxPdR-8.js → disclosure-qEQ_kll8.js} +1 -1
  47. package/dist/dropdown-menu/index.cjs +1 -1
  48. package/dist/dropdown-menu/index.mjs +1 -1
  49. package/dist/{dropdown-menu-Bj9ftuBZ.mjs → dropdown-menu--aGYYbJi.mjs} +22 -30
  50. package/dist/dropdown-menu-B9fTvSZe.js +1 -0
  51. package/dist/{element-movement-B3AVr940.mjs → element-movement-Bad2OqSj.mjs} +4 -4
  52. package/dist/floating-C1n3e5u7.js +1 -0
  53. package/dist/{floating-dEgEvBqv.mjs → floating-DQ2M2ViQ.mjs} +429 -425
  54. package/dist/{focus-management-DUVCz_zm.mjs → focus-management-BGuC9pKE.mjs} +2 -2
  55. package/dist/{form-fields-CXtJvVC5.mjs → form-fields-Bpp9kTvo.mjs} +2 -2
  56. package/dist/{frozen-Cpa22rmr.mjs → frozen-CXF36eio.mjs} +2 -2
  57. package/dist/{hidden-Blo8kfIB.mjs → hidden-H5tOTsXH.mjs} +1 -1
  58. package/dist/{index-CuNisU0H.mjs → index-Dh75VhI6.mjs} +1 -1
  59. package/dist/index.cjs +1 -1
  60. package/dist/index.d.ts +3 -1
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.mjs +769 -776
  63. package/dist/{keyboard-Bi11Rnr0.mjs → keyboard-BzaAKRwG.mjs} +1 -1
  64. package/dist/{label-DAaE-vxI.mjs → label--pGndX3z.mjs} +3 -3
  65. package/dist/listbox/index.cjs +1 -1
  66. package/dist/listbox/index.mjs +1 -1
  67. package/dist/{listbox-DZ4v8TYt.mjs → listbox-3DAgC6_y.mjs} +17 -21
  68. package/dist/{listbox-BIwbzCji.js → listbox-cpJossI7.js} +1 -1
  69. package/dist/{open-closed-BkH8ZC7H.mjs → open-closed-Be5nD5U2.mjs} +4 -4
  70. package/dist/popover/index.cjs +1 -1
  71. package/dist/popover/index.mjs +1 -1
  72. package/dist/{popover-BAm_8SCx.mjs → popover-CZO6Afya.mjs} +22 -22
  73. package/dist/{popover-B5-dVDC1.js → popover-CysmX396.js} +1 -1
  74. package/dist/{portal-BaBdcS83.mjs → portal-D-TZOwvF.mjs} +6 -6
  75. package/dist/radio-group/index.cjs +1 -1
  76. package/dist/radio-group/index.mjs +1 -1
  77. package/dist/{radio-group-CTf6mrDs.mjs → radio-group-BIQWXrVI.mjs} +8 -8
  78. package/dist/{radio-group-d2V69c7t.js → radio-group-CbQAsBFv.js} +1 -1
  79. package/dist/sonner/index.cjs +1 -1
  80. package/dist/sonner/index.mjs +1 -1
  81. package/dist/{sonner-CuPfwlK5.js → sonner-BRjN2nJD.js} +1 -1
  82. package/dist/{sonner-Ce9PJbum.mjs → sonner-Cgc0p6ph.mjs} +3 -5
  83. package/dist/switch/index.cjs +1 -1
  84. package/dist/switch/index.mjs +1 -1
  85. package/dist/{switch-DqAuXwa2.js → switch-D0OrcI50.js} +1 -1
  86. package/dist/{switch-DKcD0IFH.mjs → switch-Eoi1pTsi.mjs} +13 -13
  87. package/dist/tabs/index.cjs +1 -1
  88. package/dist/tabs/index.mjs +1 -1
  89. package/dist/{tabs-DLqfQ301.mjs → tabs-Cufnu60W.mjs} +15 -15
  90. package/dist/{tabs-X4sPQQYs.js → tabs-TTkcVq-Q.js} +1 -1
  91. package/dist/transition/index.mjs +1 -1
  92. package/dist/{transition-B0MGuDho.mjs → transition-B4KhhkrB.mjs} +4 -4
  93. package/dist/{transition-D0HuUd2-.mjs → transition-Dfxdl8Si.mjs} +1 -1
  94. package/dist/{use-event-listener-BjXsgSkG.mjs → use-event-listener-BUA2xXRr.mjs} +1 -1
  95. package/dist/{use-inert-others-BCB16FKE.mjs → use-inert-others-CgSXXC-d.mjs} +3 -3
  96. package/dist/{use-is-mounted-COmayWN0.mjs → use-is-mounted-DJc35WXO.mjs} +1 -1
  97. package/dist/{use-resolve-button-type-637wy6MK.mjs → use-resolve-button-type-BhmWA6Dl.mjs} +2 -2
  98. package/dist/{use-sync-refs-B0fmGxD4.mjs → use-sync-refs-CDCE8QtA.mjs} +2 -2
  99. package/dist/{use-tab-direction-BTonGsg0.mjs → use-tab-direction-tJsn3ckX.mjs} +8 -8
  100. package/dist/{use-text-value-BMXU9EaO.mjs → use-text-value-BKEvykNe.mjs} +2 -2
  101. package/dist/{use-tree-walker-D25YXIMY.mjs → use-tree-walker-CHC6ccbq.mjs} +2 -2
  102. package/dist/useFocusRing-BM96K_1O.js +1 -0
  103. package/dist/useFocusRing-Df1NuOsX.mjs +497 -0
  104. package/package.json +32 -22
  105. package/dist/calendar-BIhWkTtG.js +0 -1
  106. package/dist/chevron-right-HwlOajQy.js +0 -1
  107. package/dist/combobox-Cm_xVD4l.js +0 -4
  108. package/dist/dropdown-menu-BPMdVlet.js +0 -1
  109. package/dist/floating-CTjRm9bt.js +0 -1
  110. package/dist/useFocusRing-Bocdsy5M.mjs +0 -446
  111. package/dist/useFocusRing-uXUSOfAR.js +0 -1
@@ -1,45 +1,43 @@
1
- import { jsx as X, jsxs as nt } from "react/jsx-runtime";
2
- import * as xe from "react";
3
- import N, { useRef as pe, createContext as Ie, useMemo as ie, useContext as we, useId as he, useCallback as Y, Fragment as Ue, useState as Se } from "react";
4
- import { c as ye } from "./tailwind-DtaLkIY8.mjs";
5
- import { $ as Ke, a as qe } from "./useFocusRing-Bocdsy5M.mjs";
6
- import { flushSync as ee } from "react-dom";
7
- import { w as ot, e as it } from "./use-resolve-button-type-637wy6MK.mjs";
8
- import { u as st } from "./use-by-comparator-Bmefvuy2.mjs";
9
- import { l as lt, b as rt, j as at } from "./form-fields-CXtJvVC5.mjs";
10
- import { a as R, u as se, Y as me, n as te, K as ge, s as ut, y as Ee, V as $e, p as ct, A as Re, o as dt } from "./use-sync-refs-B0fmGxD4.mjs";
11
- import { A as pt, y as ft, R as ht, T as mt, w as Pe, F as gt } from "./floating-dEgEvBqv.mjs";
12
- import { a as A, p as vt, c as de, f as Ae, b as bt, u as xt, L as Ot, S as ue, s as St, g as Et } from "./element-movement-B3AVr940.mjs";
13
- import { y as yt } from "./use-inert-others-BCB16FKE.mjs";
14
- import { T as Ct, x as He, a as It, c as wt, S as F, b as $t, u as Fe, p as Tt, f as Mt, t as Rt, n as Pt } from "./portal-BaBdcS83.mjs";
15
- import { c as ze, d as Ge, b as ve, n as At, o as j } from "./keyboard-Bi11Rnr0.mjs";
16
- import { E as Ft } from "./use-event-listener-BjXsgSkG.mjs";
17
- import { c as zt, u as _t, N as kt, x as Dt, i as Oe } from "./open-closed-BkH8ZC7H.mjs";
18
- import { F as Nt } from "./use-tree-walker-D25YXIMY.mjs";
19
- import { m as _e, n as ke } from "./active-element-history-BJ1HYFpN.mjs";
20
- import { a as Vt, w as Lt } from "./description-CAH1nOgr.mjs";
21
- import { u as De, s as Wt } from "./frozen-Cpa22rmr.mjs";
22
- import { Z as jt, V as Bt, N as Te, u as Ut } from "./label-DAaE-vxI.mjs";
23
- import { G as Kt } from "./focus-management-DUVCz_zm.mjs";
24
- function oe(t, s, e) {
1
+ import { $ as We, a as Be } from "./useFocusRing-Df1NuOsX.mjs";
2
+ import * as ge from "react";
3
+ import V, { useRef as ce, useMemo as oe, createContext as Ee, useContext as Se, useId as pe, useCallback as X, Fragment as je, useState as ye } from "react";
4
+ import { flushSync as Q } from "react-dom";
5
+ import { w as Qe, e as et } from "./use-resolve-button-type-BhmWA6Dl.mjs";
6
+ import { u as tt } from "./use-by-comparator-Bmefvuy2.mjs";
7
+ import { l as nt, b as ot, j as it } from "./form-fields-Bpp9kTvo.mjs";
8
+ import { a as R, u as ie, Y as he, n as ee, K as fe, A as we, y as xe, V as Ce, p as st, s as lt, o as rt } from "./use-sync-refs-CDCE8QtA.mjs";
9
+ import { A as at, F as ut, y as ct, R as dt, T as pt, w as Me } from "./floating-DQ2M2ViQ.mjs";
10
+ import { p as ht, c as ue, a as A, f as $e, b as ft, L as mt, S as ae, s as vt, g as gt, u as bt } from "./element-movement-Bad2OqSj.mjs";
11
+ import { y as xt } from "./use-inert-others-CgSXXC-d.mjs";
12
+ import { T as Ot, x as Ue, a as Et, c as St, S as F, b as yt, u as Re, p as Ct, f as It, t as Tt, n as wt } from "./portal-D-TZOwvF.mjs";
13
+ import { c as Pe, d as He, b as me, n as Mt, o as B } from "./keyboard-BzaAKRwG.mjs";
14
+ import { E as $t } from "./use-event-listener-BUA2xXRr.mjs";
15
+ import { c as Rt, i as be, u as Pt, N as At, x as Ft } from "./open-closed-Be5nD5U2.mjs";
16
+ import { F as zt } from "./use-tree-walker-CHC6ccbq.mjs";
17
+ import { m as Ae, n as Fe } from "./active-element-history-B7wA4w4L.mjs";
18
+ import { a as _t, w as Dt } from "./description-hiFZ303Y.mjs";
19
+ import { u as ze, s as kt } from "./frozen-CXF36eio.mjs";
20
+ import { Z as Vt, V as Nt, N as Ie, u as Lt } from "./label--pGndX3z.mjs";
21
+ import { G as Wt } from "./focus-management-BGuC9pKE.mjs";
22
+ function ne(t, s, e) {
25
23
  let o = e.initialDeps ?? [], n, i = !0;
26
24
  function l() {
27
25
  var r, u, a;
28
- let c;
29
- e.key && ((r = e.debug) != null && r.call(e)) && (c = Date.now());
30
- const v = t();
31
- if (!(v.length !== o.length || v.some((p, g) => o[g] !== p)))
26
+ let d;
27
+ e.key && ((r = e.debug) != null && r.call(e)) && (d = Date.now());
28
+ const g = t();
29
+ if (!(g.length !== o.length || g.some((p, m) => o[m] !== p)))
32
30
  return n;
33
- o = v;
34
- let f;
35
- if (e.key && ((u = e.debug) != null && u.call(e)) && (f = Date.now()), n = s(...v), e.key && ((a = e.debug) != null && a.call(e))) {
36
- const p = Math.round((Date.now() - c) * 100) / 100, g = Math.round((Date.now() - f) * 100) / 100, b = g / 16, w = ($, T) => {
37
- for ($ = String($); $.length < T; )
38
- $ = " " + $;
39
- return $;
31
+ o = g;
32
+ let h;
33
+ if (e.key && ((u = e.debug) != null && u.call(e)) && (h = Date.now()), n = s(...g), e.key && ((a = e.debug) != null && a.call(e))) {
34
+ const p = Math.round((Date.now() - d) * 100) / 100, m = Math.round((Date.now() - h) * 100) / 100, b = m / 16, T = (w, M) => {
35
+ for (w = String(w); w.length < M; )
36
+ w = " " + w;
37
+ return w;
40
38
  };
41
39
  console.info(
42
- `%c⏱ ${w(g, 5)} /${w(p, 5)} ms`,
40
+ `%c⏱ ${T(m, 5)} /${T(p, 5)} ms`,
43
41
  `
44
42
  font-size: .6rem;
45
43
  font-weight: bold;
@@ -56,25 +54,25 @@ function oe(t, s, e) {
56
54
  o = r;
57
55
  }, l;
58
56
  }
59
- function Ne(t, s) {
57
+ function _e(t, s) {
60
58
  if (t === void 0)
61
59
  throw new Error("Unexpected undefined");
62
60
  return t;
63
61
  }
64
- const qt = (t, s) => Math.abs(t - s) < 1.01, Ht = (t, s, e) => {
62
+ const Bt = (t, s) => Math.abs(t - s) < 1.01, jt = (t, s, e) => {
65
63
  let o;
66
64
  return function(...n) {
67
65
  t.clearTimeout(o), o = t.setTimeout(() => s.apply(this, n), e);
68
66
  };
69
- }, Ve = (t) => {
67
+ }, De = (t) => {
70
68
  const { offsetWidth: s, offsetHeight: e } = t;
71
69
  return { width: s, height: e };
72
- }, Gt = (t) => t, Xt = (t) => {
70
+ }, Ut = (t) => t, Ht = (t) => {
73
71
  const s = Math.max(t.startIndex - t.overscan, 0), e = Math.min(t.endIndex + t.overscan, t.count - 1), o = [];
74
72
  for (let n = s; n <= e; n++)
75
73
  o.push(n);
76
74
  return o;
77
- }, Yt = (t, s) => {
75
+ }, Kt = (t, s) => {
78
76
  const e = t.scrollElement;
79
77
  if (!e)
80
78
  return;
@@ -85,7 +83,7 @@ const qt = (t, s) => Math.abs(t - s) < 1.01, Ht = (t, s, e) => {
85
83
  const { width: r, height: u } = l;
86
84
  s({ width: Math.round(r), height: Math.round(u) });
87
85
  };
88
- if (n(Ve(e)), !o.ResizeObserver)
86
+ if (n(De(e)), !o.ResizeObserver)
89
87
  return () => {
90
88
  };
91
89
  const i = new o.ResizeObserver((l) => {
@@ -98,16 +96,16 @@ const qt = (t, s) => Math.abs(t - s) < 1.01, Ht = (t, s, e) => {
98
96
  return;
99
97
  }
100
98
  }
101
- n(Ve(e));
99
+ n(De(e));
102
100
  };
103
101
  t.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
104
102
  });
105
103
  return i.observe(e, { box: "border-box" }), () => {
106
104
  i.unobserve(e);
107
105
  };
108
- }, Le = {
106
+ }, ke = {
109
107
  passive: !0
110
- }, We = typeof window > "u" ? !0 : "onscrollend" in window, Jt = (t, s) => {
108
+ }, Ve = typeof window > "u" ? !0 : "onscrollend" in window, qt = (t, s) => {
111
109
  const e = t.scrollElement;
112
110
  if (!e)
113
111
  return;
@@ -115,23 +113,23 @@ const qt = (t, s) => Math.abs(t - s) < 1.01, Ht = (t, s, e) => {
115
113
  if (!o)
116
114
  return;
117
115
  let n = 0;
118
- const i = t.options.useScrollendEvent && We ? () => {
119
- } : Ht(
116
+ const i = t.options.useScrollendEvent && Ve ? () => {
117
+ } : jt(
120
118
  o,
121
119
  () => {
122
120
  s(n, !1);
123
121
  },
124
122
  t.options.isScrollingResetDelay
125
- ), l = (c) => () => {
126
- const { horizontal: v, isRtl: d } = t.options;
127
- n = v ? e.scrollLeft * (d && -1 || 1) : e.scrollTop, i(), s(n, c);
123
+ ), l = (d) => () => {
124
+ const { horizontal: g, isRtl: c } = t.options;
125
+ n = g ? e.scrollLeft * (c && -1 || 1) : e.scrollTop, i(), s(n, d);
128
126
  }, r = l(!0), u = l(!1);
129
- u(), e.addEventListener("scroll", r, Le);
130
- const a = t.options.useScrollendEvent && We;
131
- return a && e.addEventListener("scrollend", u, Le), () => {
127
+ e.addEventListener("scroll", r, ke);
128
+ const a = t.options.useScrollendEvent && Ve;
129
+ return a && e.addEventListener("scrollend", u, ke), () => {
132
130
  e.removeEventListener("scroll", r), a && e.removeEventListener("scrollend", u);
133
131
  };
134
- }, Qt = (t, s, e) => {
132
+ }, Gt = (t, s, e) => {
135
133
  if (s?.borderBoxSize) {
136
134
  const o = s.borderBoxSize[0];
137
135
  if (o)
@@ -140,7 +138,7 @@ const qt = (t, s) => Math.abs(t - s) < 1.01, Ht = (t, s, e) => {
140
138
  );
141
139
  }
142
140
  return t[e.options.horizontal ? "offsetWidth" : "offsetHeight"];
143
- }, Zt = (t, {
141
+ }, Xt = (t, {
144
142
  adjustments: s = 0,
145
143
  behavior: e
146
144
  }, o) => {
@@ -151,9 +149,9 @@ const qt = (t, s) => Math.abs(t - s) < 1.01, Ht = (t, s, e) => {
151
149
  behavior: e
152
150
  });
153
151
  };
154
- class en {
152
+ class Yt {
155
153
  constructor(s) {
156
- this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
154
+ this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.currentScrollToIndex = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
157
155
  let e = null;
158
156
  const o = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((n) => {
159
157
  n.forEach((i) => {
@@ -189,11 +187,11 @@ class en {
189
187
  scrollPaddingStart: 0,
190
188
  scrollPaddingEnd: 0,
191
189
  horizontal: !1,
192
- getItemKey: Gt,
193
- rangeExtractor: Xt,
190
+ getItemKey: Ut,
191
+ rangeExtractor: Ht,
194
192
  onChange: () => {
195
193
  },
196
- measureElement: Qt,
194
+ measureElement: Gt,
197
195
  initialRect: { width: 0, height: 0 },
198
196
  scrollMargin: 0,
199
197
  gap: 0,
@@ -210,7 +208,7 @@ class en {
210
208
  }, this.notify = (e) => {
211
209
  var o, n;
212
210
  (n = (o = this.options).onChange) == null || n.call(o, this, e);
213
- }, this.maybeNotify = oe(
211
+ }, this.maybeNotify = ne(
214
212
  () => (this.calculateRange(), [
215
213
  this.isScrolling,
216
214
  this.range ? this.range.startIndex : null,
@@ -242,9 +240,6 @@ class en {
242
240
  }
243
241
  this.scrollElement = o, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((e = this.scrollElement) == null ? void 0 : e.window) ?? null, this.elementsCache.forEach((n) => {
244
242
  this.observer.observe(n);
245
- }), this._scrollToOffset(this.getScrollOffset(), {
246
- adjustments: void 0,
247
- behavior: void 0
248
243
  }), this.unsubs.push(
249
244
  this.options.observeElementRect(this, (n) => {
250
245
  this.scrollRect = n, this.maybeNotify();
@@ -253,7 +248,10 @@ class en {
253
248
  this.options.observeElementOffset(this, (n, i) => {
254
249
  this.scrollAdjustments = 0, this.scrollDirection = i ? this.getScrollOffset() < n ? "forward" : "backward" : null, this.scrollOffset = n, this.isScrolling = i, this.maybeNotify();
255
250
  })
256
- );
251
+ ), this._scrollToOffset(this.getScrollOffset(), {
252
+ adjustments: void 0,
253
+ behavior: void 0
254
+ });
257
255
  }
258
256
  }, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, o) => {
259
257
  const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
@@ -268,7 +266,7 @@ class en {
268
266
  break;
269
267
  }
270
268
  return i.size === this.options.lanes ? Array.from(i.values()).sort((l, r) => l.end === r.end ? l.index - r.index : l.end - r.end)[0] : void 0;
271
- }, this.getMeasurementOptions = oe(
269
+ }, this.getMeasurementOptions = ne(
272
270
  () => [
273
271
  this.options.count,
274
272
  this.options.paddingStart,
@@ -286,67 +284,63 @@ class en {
286
284
  lanes: r
287
285
  }),
288
286
  {
289
- key: !1,
290
- skipInitialOnChange: !0,
291
- onChange: () => {
292
- this.notify(this.isScrolling);
293
- }
287
+ key: !1
294
288
  }
295
- ), this.getMeasurements = oe(
289
+ ), this.getMeasurements = ne(
296
290
  () => [this.getMeasurementOptions(), this.itemSizeCache],
297
291
  ({ count: e, paddingStart: o, scrollMargin: n, getItemKey: i, enabled: l, lanes: r }, u) => {
298
292
  if (!l)
299
293
  return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
300
294
  if (this.laneAssignments.size > e)
301
- for (const d of this.laneAssignments.keys())
302
- d >= e && this.laneAssignments.delete(d);
303
- this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMeasuredCacheIndexes = []), this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((d) => {
304
- this.itemSizeCache.set(d.key, d.size);
295
+ for (const c of this.laneAssignments.keys())
296
+ c >= e && this.laneAssignments.delete(c);
297
+ this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMeasuredCacheIndexes = []), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((c) => {
298
+ this.itemSizeCache.set(c.key, c.size);
305
299
  }));
306
300
  const a = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
307
301
  this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1);
308
- const c = this.measurementsCache.slice(0, a), v = new Array(r).fill(
302
+ const d = this.measurementsCache.slice(0, a), g = new Array(r).fill(
309
303
  void 0
310
304
  );
311
- for (let d = 0; d < a; d++) {
312
- const f = c[d];
313
- f && (v[f.lane] = d);
305
+ for (let c = 0; c < a; c++) {
306
+ const h = d[c];
307
+ h && (g[h.lane] = c);
314
308
  }
315
- for (let d = a; d < e; d++) {
316
- const f = i(d), p = this.laneAssignments.get(d);
317
- let g, b;
309
+ for (let c = a; c < e; c++) {
310
+ const h = i(c), p = this.laneAssignments.get(c);
311
+ let m, b;
318
312
  if (p !== void 0 && this.options.lanes > 1) {
319
- g = p;
320
- const S = v[g], z = S !== void 0 ? c[S] : void 0;
313
+ m = p;
314
+ const E = g[m], z = E !== void 0 ? d[E] : void 0;
321
315
  b = z ? z.end + this.options.gap : o + n;
322
316
  } else {
323
- const S = this.options.lanes === 1 ? c[d - 1] : this.getFurthestMeasurement(c, d);
324
- b = S ? S.end + this.options.gap : o + n, g = S ? S.lane : d % this.options.lanes, this.options.lanes > 1 && this.laneAssignments.set(d, g);
317
+ const E = this.options.lanes === 1 ? d[c - 1] : this.getFurthestMeasurement(d, c);
318
+ b = E ? E.end + this.options.gap : o + n, m = E ? E.lane : c % this.options.lanes, this.options.lanes > 1 && this.laneAssignments.set(c, m);
325
319
  }
326
- const w = u.get(f), $ = typeof w == "number" ? w : this.options.estimateSize(d), T = b + $;
327
- c[d] = {
328
- index: d,
320
+ const T = u.get(h), w = typeof T == "number" ? T : this.options.estimateSize(c), M = b + w;
321
+ d[c] = {
322
+ index: c,
329
323
  start: b,
330
- size: $,
331
- end: T,
332
- key: f,
333
- lane: g
334
- }, v[g] = d;
324
+ size: w,
325
+ end: M,
326
+ key: h,
327
+ lane: m
328
+ }, g[m] = c;
335
329
  }
336
- return this.measurementsCache = c, c;
330
+ return this.measurementsCache = d, d;
337
331
  },
338
332
  {
339
333
  key: process.env.NODE_ENV !== "production" && "getMeasurements",
340
334
  debug: () => this.options.debug
341
335
  }
342
- ), this.calculateRange = oe(
336
+ ), this.calculateRange = ne(
343
337
  () => [
344
338
  this.getMeasurements(),
345
339
  this.getSize(),
346
340
  this.getScrollOffset(),
347
341
  this.options.lanes
348
342
  ],
349
- (e, o, n, i) => this.range = e.length > 0 && o > 0 ? tn({
343
+ (e, o, n, i) => this.range = e.length > 0 && o > 0 ? Jt({
350
344
  measurements: e,
351
345
  outerSize: o,
352
346
  scrollOffset: n,
@@ -356,7 +350,7 @@ class en {
356
350
  key: process.env.NODE_ENV !== "production" && "calculateRange",
357
351
  debug: () => this.options.debug
358
352
  }
359
- ), this.getVirtualIndexes = oe(
353
+ ), this.getVirtualIndexes = ne(
360
354
  () => {
361
355
  let e = null, o = null;
362
356
  const n = this.calculateRange();
@@ -406,7 +400,7 @@ class en {
406
400
  return;
407
401
  }
408
402
  this._measureElement(e, void 0);
409
- }, this.getVirtualItems = oe(
403
+ }, this.getVirtualItems = ne(
410
404
  () => [this.getVirtualIndexes(), this.getMeasurements()],
411
405
  (e, o) => {
412
406
  const n = [];
@@ -423,18 +417,27 @@ class en {
423
417
  ), this.getVirtualItemForOffset = (e) => {
424
418
  const o = this.getMeasurements();
425
419
  if (o.length !== 0)
426
- return Ne(
427
- o[Xe(
420
+ return _e(
421
+ o[Ke(
428
422
  0,
429
423
  o.length - 1,
430
- (n) => Ne(o[n]).start,
424
+ (n) => _e(o[n]).start,
431
425
  e
432
426
  )]
433
427
  );
428
+ }, this.getMaxScrollOffset = () => {
429
+ if (!this.scrollElement) return 0;
430
+ if ("scrollHeight" in this.scrollElement)
431
+ return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
432
+ {
433
+ const e = this.scrollElement.document.documentElement;
434
+ return this.options.horizontal ? e.scrollWidth - this.scrollElement.innerWidth : e.scrollHeight - this.scrollElement.innerHeight;
435
+ }
434
436
  }, this.getOffsetForAlignment = (e, o, n = 0) => {
437
+ if (!this.scrollElement) return 0;
435
438
  const i = this.getSize(), l = this.getScrollOffset();
436
439
  o === "auto" && (o = e >= l + i ? "end" : "start"), o === "center" ? e += (n - i) / 2 : o === "end" && (e -= i);
437
- const r = this.getTotalSize() + this.options.scrollMargin - i;
440
+ const r = this.getMaxScrollOffset();
438
441
  return Math.max(Math.min(r, e), 0);
439
442
  }, this.getOffsetForIndex = (e, o = "auto") => {
440
443
  e = Math.max(0, Math.min(e, this.options.count - 1));
@@ -449,6 +452,8 @@ class en {
449
452
  o = "start";
450
453
  else
451
454
  return [l, o];
455
+ if (o === "end" && e === this.options.count - 1)
456
+ return [this.getMaxScrollOffset(), o];
452
457
  const r = o === "end" ? n.end + this.options.scrollPaddingEnd : n.start - this.options.scrollPaddingStart;
453
458
  return [
454
459
  this.getOffsetForAlignment(r, o, n.size),
@@ -464,26 +469,30 @@ class en {
464
469
  }, this.scrollToIndex = (e, { align: o = "auto", behavior: n } = {}) => {
465
470
  n === "smooth" && this.isDynamicMode() && console.warn(
466
471
  "The `smooth` scroll behavior is not fully supported with dynamic size."
467
- ), e = Math.max(0, Math.min(e, this.options.count - 1));
472
+ ), e = Math.max(0, Math.min(e, this.options.count - 1)), this.currentScrollToIndex = e;
468
473
  let i = 0;
469
474
  const l = 10, r = (a) => {
470
475
  if (!this.targetWindow) return;
471
- const c = this.getOffsetForIndex(e, a);
472
- if (!c) {
476
+ const d = this.getOffsetForIndex(e, a);
477
+ if (!d) {
473
478
  console.warn("Failed to get offset for index:", e);
474
479
  return;
475
480
  }
476
- const [v, d] = c;
477
- this._scrollToOffset(v, { adjustments: void 0, behavior: n }), this.targetWindow.requestAnimationFrame(() => {
478
- const f = this.getScrollOffset(), p = this.getOffsetForIndex(e, d);
479
- if (!p) {
480
- console.warn("Failed to get offset for index:", e);
481
- return;
482
- }
483
- qt(p[0], f) || u(d);
481
+ const [g, c] = d;
482
+ this._scrollToOffset(g, { adjustments: void 0, behavior: n }), this.targetWindow.requestAnimationFrame(() => {
483
+ const h = () => {
484
+ if (this.currentScrollToIndex !== e) return;
485
+ const p = this.getScrollOffset(), m = this.getOffsetForIndex(e, c);
486
+ if (!m) {
487
+ console.warn("Failed to get offset for index:", e);
488
+ return;
489
+ }
490
+ Bt(m[0], p) || u(c);
491
+ };
492
+ this.isDynamicMode() ? this.targetWindow.requestAnimationFrame(h) : h();
484
493
  });
485
494
  }, u = (a) => {
486
- this.targetWindow && (i++, i < l ? (process.env.NODE_ENV !== "production" && this.options.debug && console.info("Schedule retry", i, l), this.targetWindow.requestAnimationFrame(() => r(a))) : console.warn(
495
+ this.targetWindow && this.currentScrollToIndex === e && (i++, i < l ? (process.env.NODE_ENV !== "production" && this.options.debug && console.info("Schedule retry", i, l), this.targetWindow.requestAnimationFrame(() => r(a))) : console.warn(
487
496
  `Failed to scroll to index ${e} after ${l} attempts.`
488
497
  ));
489
498
  };
@@ -526,7 +535,7 @@ class en {
526
535
  }, this.setOptions(s);
527
536
  }
528
537
  }
529
- const Xe = (t, s, e, o) => {
538
+ const Ke = (t, s, e, o) => {
530
539
  for (; t <= s; ) {
531
540
  const n = (t + s) / 2 | 0, i = e(n);
532
541
  if (i < o)
@@ -538,7 +547,7 @@ const Xe = (t, s, e, o) => {
538
547
  }
539
548
  return t > 0 ? t - 1 : 0;
540
549
  };
541
- function tn({
550
+ function Jt({
542
551
  measurements: t,
543
552
  outerSize: s,
544
553
  scrollOffset: e,
@@ -550,7 +559,7 @@ function tn({
550
559
  startIndex: 0,
551
560
  endIndex: n
552
561
  };
553
- let l = Xe(
562
+ let l = Ke(
554
563
  0,
555
564
  n,
556
565
  i,
@@ -561,47 +570,50 @@ function tn({
561
570
  r++;
562
571
  else if (o > 1) {
563
572
  const u = Array(o).fill(0);
564
- for (; r < n && u.some((c) => c < e + s); ) {
565
- const c = t[r];
566
- u[c.lane] = c.end, r++;
573
+ for (; r < n && u.some((d) => d < e + s); ) {
574
+ const d = t[r];
575
+ u[d.lane] = d.end, r++;
567
576
  }
568
577
  const a = Array(o).fill(e + s);
569
- for (; l >= 0 && a.some((c) => c >= e); ) {
570
- const c = t[l];
571
- a[c.lane] = c.start, l--;
578
+ for (; l >= 0 && a.some((d) => d >= e); ) {
579
+ const d = t[l];
580
+ a[d.lane] = d.start, l--;
572
581
  }
573
582
  l = Math.max(0, l - l % o), r = Math.min(n, r + (o - 1 - r % o));
574
583
  }
575
584
  return { startIndex: l, endIndex: r };
576
585
  }
577
- const je = typeof document < "u" ? xe.useLayoutEffect : xe.useEffect;
578
- function nn(t) {
579
- const s = xe.useReducer(() => ({}), {})[1], e = {
580
- ...t,
581
- onChange: (n, i) => {
582
- var l;
583
- i ? ee(s) : s(), (l = t.onChange) == null || l.call(t, n, i);
586
+ const Ne = typeof document < "u" ? ge.useLayoutEffect : ge.useEffect;
587
+ function Zt({
588
+ useFlushSync: t = !0,
589
+ ...s
590
+ }) {
591
+ const e = ge.useReducer(() => ({}), {})[1], o = {
592
+ ...s,
593
+ onChange: (i, l) => {
594
+ var r;
595
+ t && l ? Q(e) : e(), (r = s.onChange) == null || r.call(s, i, l);
584
596
  }
585
- }, [o] = xe.useState(
586
- () => new en(e)
597
+ }, [n] = ge.useState(
598
+ () => new Yt(o)
587
599
  );
588
- return o.setOptions(e), je(() => o._didMount(), []), je(() => o._willUpdate()), o;
600
+ return n.setOptions(o), Ne(() => n._didMount(), []), Ne(() => n._willUpdate()), n;
589
601
  }
590
- function on(t) {
591
- return nn({
592
- observeElementRect: Yt,
593
- observeElementOffset: Jt,
594
- scrollToFn: Zt,
602
+ function Qt(t) {
603
+ return Zt({
604
+ observeElementRect: Kt,
605
+ observeElementOffset: qt,
606
+ scrollToFn: Xt,
595
607
  ...t
596
608
  });
597
609
  }
598
- function Ye(t) {
599
- let s = pe({ value: "", selectionStart: null, selectionEnd: null });
600
- return Ft(t, "blur", (e) => {
610
+ function qe(t) {
611
+ let s = ce({ value: "", selectionStart: null, selectionEnd: null });
612
+ return $t(t, "blur", (e) => {
601
613
  let o = e.target;
602
- ze(o) && (s.current = { value: o.value, selectionStart: o.selectionStart, selectionEnd: o.selectionEnd });
614
+ Pe(o) && (s.current = { value: o.value, selectionStart: o.selectionStart, selectionEnd: o.selectionEnd });
603
615
  }), R(() => {
604
- if (!Ge(t) && ze(t) && t.isConnected) {
616
+ if (!He(t) && Pe(t) && t.isConnected) {
605
617
  if (t.focus({ preventScroll: !0 }), t.value !== s.current.value) t.setSelectionRange(t.value.length, t.value.length);
606
618
  else {
607
619
  let { selectionStart: e, selectionEnd: o } = s.current;
@@ -611,56 +623,56 @@ function Ye(t) {
611
623
  }
612
624
  });
613
625
  }
614
- var sn = Object.defineProperty, ln = (t, s, e) => s in t ? sn(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e, Be = (t, s, e) => (ln(t, typeof s != "symbol" ? s + "" : s, e), e), m = ((t) => (t[t.Open = 0] = "Open", t[t.Closed = 1] = "Closed", t))(m || {}), U = ((t) => (t[t.Single = 0] = "Single", t[t.Multi = 1] = "Multi", t))(U || {}), G = ((t) => (t[t.Pointer = 0] = "Pointer", t[t.Focus = 1] = "Focus", t[t.Other = 2] = "Other", t))(G || {}), Je = ((t) => (t[t.OpenCombobox = 0] = "OpenCombobox", t[t.CloseCombobox = 1] = "CloseCombobox", t[t.GoToOption = 2] = "GoToOption", t[t.SetTyping = 3] = "SetTyping", t[t.RegisterOption = 4] = "RegisterOption", t[t.UnregisterOption = 5] = "UnregisterOption", t[t.DefaultToFirstOption = 6] = "DefaultToFirstOption", t[t.SetActivationTrigger = 7] = "SetActivationTrigger", t[t.UpdateVirtualConfiguration = 8] = "UpdateVirtualConfiguration", t[t.SetInputElement = 9] = "SetInputElement", t[t.SetButtonElement = 10] = "SetButtonElement", t[t.SetOptionsElement = 11] = "SetOptionsElement", t[t.MarkInputAsMoved = 12] = "MarkInputAsMoved", t))(Je || {});
615
- function Ce(t, s = (e) => e) {
616
- let e = t.activeOptionIndex !== null ? t.options[t.activeOptionIndex] : null, o = s(t.options.slice()), n = o.length > 0 && o[0].dataRef.current.order !== null ? o.sort((l, r) => l.dataRef.current.order - r.dataRef.current.order) : Kt(o, (l) => l.dataRef.current.domRef.current), i = e ? n.indexOf(e) : null;
626
+ var en = Object.defineProperty, tn = (t, s, e) => s in t ? en(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e, Le = (t, s, e) => (tn(t, typeof s != "symbol" ? s + "" : s, e), e), v = ((t) => (t[t.Open = 0] = "Open", t[t.Closed = 1] = "Closed", t))(v || {}), U = ((t) => (t[t.Single = 0] = "Single", t[t.Multi = 1] = "Multi", t))(U || {}), G = ((t) => (t[t.Pointer = 0] = "Pointer", t[t.Focus = 1] = "Focus", t[t.Other = 2] = "Other", t))(G || {}), Ge = ((t) => (t[t.OpenCombobox = 0] = "OpenCombobox", t[t.CloseCombobox = 1] = "CloseCombobox", t[t.GoToOption = 2] = "GoToOption", t[t.SetTyping = 3] = "SetTyping", t[t.RegisterOption = 4] = "RegisterOption", t[t.UnregisterOption = 5] = "UnregisterOption", t[t.DefaultToFirstOption = 6] = "DefaultToFirstOption", t[t.SetActivationTrigger = 7] = "SetActivationTrigger", t[t.UpdateVirtualConfiguration = 8] = "UpdateVirtualConfiguration", t[t.SetInputElement = 9] = "SetInputElement", t[t.SetButtonElement = 10] = "SetButtonElement", t[t.SetOptionsElement = 11] = "SetOptionsElement", t[t.MarkInputAsMoved = 12] = "MarkInputAsMoved", t))(Ge || {});
627
+ function Oe(t, s = (e) => e) {
628
+ let e = t.activeOptionIndex !== null ? t.options[t.activeOptionIndex] : null, o = s(t.options.slice()), n = o.length > 0 && o[0].dataRef.current.order !== null ? o.sort((l, r) => l.dataRef.current.order - r.dataRef.current.order) : Wt(o, (l) => l.dataRef.current.domRef.current), i = e ? n.indexOf(e) : null;
617
629
  return i === -1 && (i = null), { options: n, activeOptionIndex: i };
618
630
  }
619
- let rn = { 1(t) {
631
+ let nn = { 1(t) {
620
632
  var s;
621
633
  if ((s = t.dataRef.current) != null && s.disabled || t.comboboxState === 1) return t;
622
- let e = t.inputElement ? de.Tracked(bt(t.inputElement)) : t.inputPositionState;
634
+ let e = t.inputElement ? ue.Tracked(ft(t.inputElement)) : t.inputPositionState;
623
635
  return { ...t, activeOptionIndex: null, comboboxState: 1, isTyping: !1, activationTrigger: 2, inputPositionState: e, __demoMode: !1 };
624
636
  }, 0(t) {
625
637
  var s, e;
626
638
  if ((s = t.dataRef.current) != null && s.disabled || t.comboboxState === 0) return t;
627
639
  if ((e = t.dataRef.current) != null && e.value) {
628
640
  let o = t.dataRef.current.calculateIndex(t.dataRef.current.value);
629
- if (o !== -1) return { ...t, activeOptionIndex: o, comboboxState: 0, __demoMode: !1, inputPositionState: de.Idle };
641
+ if (o !== -1) return { ...t, activeOptionIndex: o, comboboxState: 0, __demoMode: !1, inputPositionState: ue.Idle };
630
642
  }
631
- return { ...t, comboboxState: 0, inputPositionState: de.Idle, __demoMode: !1 };
643
+ return { ...t, comboboxState: 0, inputPositionState: ue.Idle, __demoMode: !1 };
632
644
  }, 3(t, s) {
633
645
  return t.isTyping === s.isTyping ? t : { ...t, isTyping: s.isTyping };
634
646
  }, 2(t, s) {
635
647
  var e, o, n, i;
636
648
  if ((e = t.dataRef.current) != null && e.disabled || t.optionsElement && !((o = t.dataRef.current) != null && o.optionsPropsRef.current.static) && t.comboboxState === 1) return t;
637
649
  if (t.virtual) {
638
- let { options: a, disabled: c } = t.virtual, v = s.focus === A.Specific ? s.idx : Ae(s, { resolveItems: () => a, resolveActiveIndex: () => {
639
- var f, p;
640
- return (p = (f = t.activeOptionIndex) != null ? f : a.findIndex((g) => !c(g))) != null ? p : null;
641
- }, resolveDisabled: c, resolveId() {
650
+ let { options: a, disabled: d } = t.virtual, g = s.focus === A.Specific ? s.idx : $e(s, { resolveItems: () => a, resolveActiveIndex: () => {
651
+ var h, p;
652
+ return (p = (h = t.activeOptionIndex) != null ? h : a.findIndex((m) => !d(m))) != null ? p : null;
653
+ }, resolveDisabled: d, resolveId() {
642
654
  throw new Error("Function not implemented.");
643
- } }), d = (n = s.trigger) != null ? n : 2;
644
- return t.activeOptionIndex === v && t.activationTrigger === d ? t : { ...t, activeOptionIndex: v, activationTrigger: d, isTyping: !1, __demoMode: !1 };
655
+ } }), c = (n = s.trigger) != null ? n : 2;
656
+ return t.activeOptionIndex === g && t.activationTrigger === c ? t : { ...t, activeOptionIndex: g, activationTrigger: c, isTyping: !1, __demoMode: !1 };
645
657
  }
646
- let l = Ce(t);
658
+ let l = Oe(t);
647
659
  if (l.activeOptionIndex === null) {
648
- let a = l.options.findIndex((c) => !c.dataRef.current.disabled);
660
+ let a = l.options.findIndex((d) => !d.dataRef.current.disabled);
649
661
  a !== -1 && (l.activeOptionIndex = a);
650
662
  }
651
- let r = s.focus === A.Specific ? s.idx : Ae(s, { resolveItems: () => l.options, resolveActiveIndex: () => l.activeOptionIndex, resolveId: (a) => a.id, resolveDisabled: (a) => a.dataRef.current.disabled }), u = (i = s.trigger) != null ? i : 2;
663
+ let r = s.focus === A.Specific ? s.idx : $e(s, { resolveItems: () => l.options, resolveActiveIndex: () => l.activeOptionIndex, resolveId: (a) => a.id, resolveDisabled: (a) => a.dataRef.current.disabled }), u = (i = s.trigger) != null ? i : 2;
652
664
  return t.activeOptionIndex === r && t.activationTrigger === u ? t : { ...t, ...l, isTyping: !1, activeOptionIndex: r, activationTrigger: u, __demoMode: !1 };
653
665
  }, 4: (t, s) => {
654
666
  var e, o, n, i;
655
667
  if ((e = t.dataRef.current) != null && e.virtual) return { ...t, options: [...t.options, s.payload] };
656
- let l = s.payload, r = Ce(t, (a) => (a.push(l), a));
668
+ let l = s.payload, r = Oe(t, (a) => (a.push(l), a));
657
669
  t.activeOptionIndex === null && (n = (o = t.dataRef.current).isSelected) != null && n.call(o, s.payload.dataRef.current.value) && (r.activeOptionIndex = r.options.indexOf(l));
658
670
  let u = { ...t, ...r, activationTrigger: 2 };
659
671
  return (i = t.dataRef.current) != null && i.__demoMode && t.dataRef.current.value === void 0 && (u.activeOptionIndex = 0), u;
660
672
  }, 5: (t, s) => {
661
673
  var e;
662
674
  if ((e = t.dataRef.current) != null && e.virtual) return { ...t, options: t.options.filter((n) => n.id !== s.id) };
663
- let o = Ce(t, (n) => {
675
+ let o = Oe(t, (n) => {
664
676
  let i = n.findIndex((l) => l.id === s.id);
665
677
  return i !== -1 && n.splice(i, 1), n;
666
678
  });
@@ -676,13 +688,13 @@ let rn = { 1(t) {
676
688
  }
677
689
  return { ...t, activeOptionIndex: n, virtual: { options: s.options, disabled: (o = s.disabled) != null ? o : () => !1 } };
678
690
  }, 9: (t, s) => t.inputElement === s.element ? t : { ...t, inputElement: s.element }, 10: (t, s) => t.buttonElement === s.element ? t : { ...t, buttonElement: s.element }, 11: (t, s) => t.optionsElement === s.element ? t : { ...t, optionsElement: s.element }, 12(t) {
679
- return t.inputPositionState.kind !== "Tracked" ? t : { ...t, inputPositionState: de.Moved };
691
+ return t.inputPositionState.kind !== "Tracked" ? t : { ...t, inputPositionState: ue.Moved };
680
692
  } };
681
- class Me extends Ct {
693
+ class Te extends Ot {
682
694
  constructor(s) {
683
- super(s), Be(this, "actions", { onChange: (e) => {
695
+ super(s), Le(this, "actions", { onChange: (e) => {
684
696
  let { onChange: o, compare: n, mode: i, value: l } = this.state.dataRef.current;
685
- return se(i, { 0: () => o?.(e), 1: () => {
697
+ return ie(i, { 0: () => o?.(e), 1: () => {
686
698
  let r = l.slice(), u = r.findIndex((a) => n(a, e));
687
699
  return u === -1 ? r.push(e) : r.splice(u, 1), o?.(r);
688
700
  } });
@@ -713,7 +725,7 @@ class Me extends Ct {
713
725
  this.send({ type: 10, element: e });
714
726
  }, setOptionsElement: (e) => {
715
727
  this.send({ type: 11, element: e });
716
- } }), Be(this, "selectors", { activeDescendantId: (e) => {
728
+ } }), Le(this, "selectors", { activeDescendantId: (e) => {
717
729
  var o, n;
718
730
  let i = this.selectors.activeOptionIndex(e);
719
731
  if (i !== null) return e.virtual ? (n = e.options.find((l) => !l.dataRef.current.disabled && e.dataRef.current.compare(l.dataRef.current.value, e.virtual.options[i]))) == null ? void 0 : n.id : (o = e.options[i]) == null ? void 0 : o.id;
@@ -742,14 +754,14 @@ class Me extends Ct {
742
754
  return e.inputPositionState.kind === "Moved";
743
755
  } });
744
756
  {
745
- let e = this.state.id, o = He.get(null);
746
- this.disposables.add(o.on(It.Push, (n) => {
757
+ let e = this.state.id, o = Ue.get(null);
758
+ this.disposables.add(o.on(Et.Push, (n) => {
747
759
  !o.selectors.isTop(n, e) && this.state.comboboxState === 0 && this.actions.closeCombobox();
748
760
  })), this.on(0, () => o.actions.push(e)), this.on(1, () => o.actions.pop(e));
749
761
  }
750
762
  this.disposables.group((e) => {
751
763
  this.on(1, (o) => {
752
- o.inputElement && (e.dispose(), e.add(vt(o.inputElement, o.inputPositionState, () => {
764
+ o.inputElement && (e.dispose(), e.add(ht(o.inputElement, o.inputPositionState, () => {
753
765
  this.send({ type: 12 });
754
766
  })));
755
767
  });
@@ -757,318 +769,256 @@ class Me extends Ct {
757
769
  }
758
770
  static new({ id: s, virtual: e = null, __demoMode: o = !1 }) {
759
771
  var n;
760
- return new Me({ id: s, dataRef: { current: {} }, comboboxState: o ? 0 : 1, isTyping: !1, options: [], virtual: e ? { options: e.options, disabled: (n = e.disabled) != null ? n : () => !1 } : null, activeOptionIndex: null, activationTrigger: 2, inputElement: null, buttonElement: null, optionsElement: null, __demoMode: o, inputPositionState: de.Idle });
772
+ return new Te({ id: s, dataRef: { current: {} }, comboboxState: o ? 0 : 1, isTyping: !1, options: [], virtual: e ? { options: e.options, disabled: (n = e.disabled) != null ? n : () => !1 } : null, activeOptionIndex: null, activationTrigger: 2, inputElement: null, buttonElement: null, optionsElement: null, __demoMode: o, inputPositionState: ue.Idle });
761
773
  }
762
774
  reduce(s, e) {
763
- return se(e.type, rn, s, e);
775
+ return ie(e.type, nn, s, e);
764
776
  }
765
777
  }
766
- const Qe = Ie(null);
767
- function be(t) {
768
- let s = we(Qe);
778
+ const Xe = Ee(null);
779
+ function ve(t) {
780
+ let s = Se(Xe);
769
781
  if (s === null) {
770
782
  let e = new Error(`<${t} /> is missing a parent <Combobox /> component.`);
771
- throw Error.captureStackTrace && Error.captureStackTrace(e, Ze), e;
783
+ throw Error.captureStackTrace && Error.captureStackTrace(e, Ye), e;
772
784
  }
773
785
  return s;
774
786
  }
775
- function Ze({ id: t, virtual: s = null, __demoMode: e = !1 }) {
776
- let o = ie(() => Me.new({ id: t, virtual: s, __demoMode: e }), []);
777
- return wt(() => o.dispose()), o;
787
+ function Ye({ id: t, virtual: s = null, __demoMode: e = !1 }) {
788
+ let o = oe(() => Te.new({ id: t, virtual: s, __demoMode: e }), []);
789
+ return St(() => o.dispose()), o;
778
790
  }
779
- let fe = Ie(null);
780
- fe.displayName = "ComboboxDataContext";
781
- function le(t) {
782
- let s = we(fe);
791
+ let de = Ee(null);
792
+ de.displayName = "ComboboxDataContext";
793
+ function se(t) {
794
+ let s = Se(de);
783
795
  if (s === null) {
784
796
  let e = new Error(`<${t} /> is missing a parent <Combobox /> component.`);
785
- throw Error.captureStackTrace && Error.captureStackTrace(e, le), e;
797
+ throw Error.captureStackTrace && Error.captureStackTrace(e, se), e;
786
798
  }
787
799
  return s;
788
800
  }
789
- let et = Ie(null);
790
- function an(t) {
791
- let s = be("VirtualProvider"), e = le("VirtualProvider"), { options: o } = e.virtual, n = F(s, (f) => f.optionsElement), [i, l] = ie(() => {
792
- let f = n;
793
- if (!f) return [0, 0];
794
- let p = window.getComputedStyle(f);
801
+ let Je = Ee(null);
802
+ function on(t) {
803
+ let s = ve("VirtualProvider"), e = se("VirtualProvider"), { options: o } = e.virtual, n = F(s, (h) => h.optionsElement), [i, l] = oe(() => {
804
+ let h = n;
805
+ if (!h) return [0, 0];
806
+ let p = window.getComputedStyle(h);
795
807
  return [parseFloat(p.paddingBlockStart || p.paddingTop), parseFloat(p.paddingBlockEnd || p.paddingBottom)];
796
- }, [n]), r = on({ enabled: o.length !== 0, scrollPaddingStart: i, scrollPaddingEnd: l, count: o.length, estimateSize() {
808
+ }, [n]), r = Qt({ enabled: o.length !== 0, scrollPaddingStart: i, scrollPaddingEnd: l, count: o.length, estimateSize() {
797
809
  return 40;
798
810
  }, getScrollElement() {
799
811
  return s.state.optionsElement;
800
- }, overscan: 12 }), [u, a] = Se(0);
801
- te(() => {
802
- a((f) => f + 1);
812
+ }, overscan: 12 }), [u, a] = ye(0);
813
+ ee(() => {
814
+ a((h) => h + 1);
803
815
  }, [o]);
804
- let c = r.getVirtualItems(), v = F(s, (f) => f.activationTrigger === G.Pointer), d = F(s, s.selectors.activeOptionIndex);
805
- return c.length === 0 ? null : N.createElement(et.Provider, { value: r }, N.createElement("div", { style: { position: "relative", width: "100%", height: `${r.getTotalSize()}px` }, ref: (f) => {
806
- f && (v || d !== null && o.length > d && r.scrollToIndex(d));
807
- } }, c.map((f) => {
816
+ let d = r.getVirtualItems(), g = F(s, (h) => h.activationTrigger === G.Pointer), c = F(s, s.selectors.activeOptionIndex);
817
+ return d.length === 0 ? null : V.createElement(Je.Provider, { value: r }, V.createElement("div", { style: { position: "relative", width: "100%", height: `${r.getTotalSize()}px` }, ref: (h) => {
818
+ h && (g || c !== null && o.length > c && r.scrollToIndex(c));
819
+ } }, d.map((h) => {
808
820
  var p;
809
- return N.createElement(Ue, { key: f.key }, N.cloneElement((p = t.children) == null ? void 0 : p.call(t, { ...t.slot, option: o[f.index] }), { key: `${u}-${f.key}`, "data-index": f.index, "aria-setsize": o.length, "aria-posinset": f.index + 1, style: { position: "absolute", top: 0, left: 0, transform: `translateY(${f.start}px)`, overflowAnchor: "none" } }));
821
+ return V.createElement(je, { key: h.key }, V.cloneElement((p = t.children) == null ? void 0 : p.call(t, { ...t.slot, option: o[h.index] }), { key: `${u}-${h.key}`, "data-index": h.index, "aria-setsize": o.length, "aria-posinset": h.index + 1, style: { position: "absolute", top: 0, left: 0, transform: `translateY(${h.start}px)`, overflowAnchor: "none" } }));
810
822
  })));
811
823
  }
812
- let un = Ue;
813
- function cn(t, s) {
814
- let e = he(), o = Vt(), { value: n, defaultValue: i, onChange: l, form: r, name: u, by: a, invalid: c = !1, disabled: v = o || !1, onClose: d, __demoMode: f = !1, multiple: p = !1, immediate: g = !1, virtual: b = null, nullable: w, ...$ } = t, T = lt(i), [S = p ? [] : void 0, z] = rt(n, l, T), O = Ze({ id: e, virtual: b, __demoMode: f }), V = pe({ static: !1, hold: !1 }), M = st(a), k = R((y) => b ? a === null ? b.options.indexOf(y) : b.options.findIndex((Z) => M(Z, y)) : O.state.options.findIndex((Z) => M(Z.dataRef.current.value, y))), q = Y((y) => se(L.mode, { [U.Multi]: () => S.some((Z) => M(Z, y)), [U.Single]: () => M(S, y) }), [S]), H = F(O, (y) => y.virtual), x = R(() => d?.()), L = ie(() => ({ __demoMode: f, immediate: g, optionsPropsRef: V, value: S, defaultValue: T, disabled: v, invalid: c, mode: p ? U.Multi : U.Single, virtual: b ? H : null, onChange: z, isSelected: q, calculateIndex: k, compare: M, onClose: x }), [f, g, V, S, T, v, c, p, b, H, z, q, k, M, x]);
815
- te(() => {
824
+ let sn = je;
825
+ function ln(t, s) {
826
+ let e = pe(), o = _t(), { value: n, defaultValue: i, onChange: l, form: r, name: u, by: a, invalid: d = !1, disabled: g = o || !1, onClose: c, __demoMode: h = !1, multiple: p = !1, immediate: m = !1, virtual: b = null, nullable: T, ...w } = t, M = nt(i), [E = p ? [] : void 0, z] = ot(n, l, M), O = Ye({ id: e, virtual: b, __demoMode: h }), N = ce({ static: !1, hold: !1 }), $ = tt(a), D = R((y) => b ? a === null ? b.options.indexOf(y) : b.options.findIndex((Z) => $(Z, y)) : O.state.options.findIndex((Z) => $(Z.dataRef.current.value, y))), K = X((y) => ie(L.mode, { [U.Multi]: () => E.some((Z) => $(Z, y)), [U.Single]: () => $(E, y) }), [E]), q = F(O, (y) => y.virtual), x = R(() => c?.()), L = oe(() => ({ __demoMode: h, immediate: m, optionsPropsRef: N, value: E, defaultValue: M, disabled: g, invalid: d, mode: p ? U.Multi : U.Single, virtual: b ? q : null, onChange: z, isSelected: K, calculateIndex: D, compare: $, onClose: x }), [h, m, N, E, M, g, d, p, b, q, z, K, D, $, x]);
827
+ ee(() => {
816
828
  var y;
817
- b && O.send({ type: Je.UpdateVirtualConfiguration, options: b.options, disabled: (y = b.disabled) != null ? y : null });
818
- }, [b, b?.options, b?.disabled]), te(() => {
829
+ b && O.send({ type: Ge.UpdateVirtualConfiguration, options: b.options, disabled: (y = b.disabled) != null ? y : null });
830
+ }, [b, b?.options, b?.disabled]), ee(() => {
819
831
  O.state.dataRef.current = L;
820
832
  }, [L]);
821
- let [W, E, K, re] = F(O, (y) => [y.comboboxState, y.buttonElement, y.inputElement, y.optionsElement]), J = He.get(null), ne = F(J, Y((y) => J.selectors.isTop(y, e), [J, e]));
822
- $t(ne, [E, K, re], () => O.actions.closeCombobox());
823
- let Q = F(O, O.selectors.activeOptionIndex), ae = F(O, O.selectors.activeOption), h = ve({ open: W === m.Open, disabled: v, invalid: c, activeIndex: Q, activeOption: ae, value: S }), [B, I] = Bt(), _ = s === null ? {} : { ref: s }, C = Y(() => {
824
- if (T !== void 0) return z?.(T);
825
- }, [z, T]), D = ge();
826
- return N.createElement(I, { value: B, props: { htmlFor: K?.id }, slot: { open: W === m.Open, disabled: v } }, N.createElement(pt, null, N.createElement(fe.Provider, { value: L }, N.createElement(Qe.Provider, { value: O }, N.createElement(zt, { value: se(W, { [m.Open]: Oe.Open, [m.Closed]: Oe.Closed }) }, u != null && N.createElement(at, { disabled: v, data: S != null ? { [u]: S } : {}, form: r, onReset: C }), D({ ourProps: _, theirProps: $, slot: h, defaultTag: un, name: "Combobox" }))))));
833
+ let [W, S, H, le] = F(O, (y) => [y.comboboxState, y.buttonElement, y.inputElement, y.optionsElement]), Y = Ue.get(null), te = F(Y, X((y) => Y.selectors.isTop(y, e), [Y, e]));
834
+ yt(te, [S, H, le], () => O.actions.closeCombobox());
835
+ let J = F(O, O.selectors.activeOptionIndex), re = F(O, O.selectors.activeOption), f = me({ open: W === v.Open, disabled: g, invalid: d, activeIndex: J, activeOption: re, value: E }), [j, I] = Nt(), _ = s === null ? {} : { ref: s }, C = X(() => {
836
+ if (M !== void 0) return z?.(M);
837
+ }, [z, M]), k = fe();
838
+ return V.createElement(I, { value: j, props: { htmlFor: H?.id }, slot: { open: W === v.Open, disabled: g } }, V.createElement(at, null, V.createElement(de.Provider, { value: L }, V.createElement(Xe.Provider, { value: O }, V.createElement(Rt, { value: ie(W, { [v.Open]: be.Open, [v.Closed]: be.Closed }) }, u != null && V.createElement(it, { disabled: g, data: E != null ? { [u]: E } : {}, form: r, onReset: C }), k({ ourProps: _, theirProps: w, slot: f, defaultTag: sn, name: "Combobox" }))))));
827
839
  }
828
- let dn = "input";
829
- function pn(t, s) {
840
+ let rn = "input";
841
+ function an(t, s) {
830
842
  var e, o;
831
- let n = be("Combobox.Input"), i = le("Combobox.Input"), l = he(), r = Ut(), { id: u = r || `headlessui-combobox-input-${l}`, onChange: a, displayValue: c, disabled: v = i.disabled || !1, autoFocus: d = !1, type: f = "text", ...p } = t, g = pe(null), b = Ee(g, s, gt(), n.actions.setInputElement), [w, $] = F(n, (h) => [h.comboboxState, h.isTyping]), T = ct(), S = R(() => {
843
+ let n = ve("Combobox.Input"), i = se("Combobox.Input"), l = pe(), r = Lt(), { id: u = r || `headlessui-combobox-input-${l}`, onChange: a, displayValue: d, disabled: g = i.disabled || !1, autoFocus: c = !1, type: h = "text", ...p } = t, m = ce(null), b = xe(m, s, ut(), n.actions.setInputElement), [T, w] = F(n, (f) => [f.comboboxState, f.isTyping]), M = st(), E = R(() => {
832
844
  n.actions.onChange(null), n.state.optionsElement && (n.state.optionsElement.scrollTop = 0), n.actions.goToOption({ focus: A.Nothing });
833
- }), z = ie(() => {
834
- var h;
835
- return typeof c == "function" && i.value !== void 0 ? (h = c(i.value)) != null ? h : "" : typeof i.value == "string" ? i.value : "";
836
- }, [i.value, c]);
837
- _e(([h, B], [I, _]) => {
845
+ }), z = oe(() => {
846
+ var f;
847
+ return typeof d == "function" && i.value !== void 0 ? (f = d(i.value)) != null ? f : "" : typeof i.value == "string" ? i.value : "";
848
+ }, [i.value, d]);
849
+ Ae(([f, j], [I, _]) => {
838
850
  if (n.state.isTyping) return;
839
- let C = g.current;
840
- C && ((_ === m.Open && B === m.Closed || h !== I) && (C.value = h), requestAnimationFrame(() => {
841
- if (n.state.isTyping || !C || Ge(C)) return;
842
- let { selectionStart: D, selectionEnd: y } = C;
843
- Math.abs((y ?? 0) - (D ?? 0)) === 0 && D === 0 && C.setSelectionRange(C.value.length, C.value.length);
851
+ let C = m.current;
852
+ C && ((_ === v.Open && j === v.Closed || f !== I) && (C.value = f), requestAnimationFrame(() => {
853
+ if (n.state.isTyping || !C || He(C)) return;
854
+ let { selectionStart: k, selectionEnd: y } = C;
855
+ Math.abs((y ?? 0) - (k ?? 0)) === 0 && k === 0 && C.setSelectionRange(C.value.length, C.value.length);
844
856
  }));
845
- }, [z, w, $]), _e(([h], [B]) => {
846
- if (h === m.Open && B === m.Closed) {
857
+ }, [z, T, w]), Ae(([f], [j]) => {
858
+ if (f === v.Open && j === v.Closed) {
847
859
  if (n.state.isTyping) return;
848
- let I = g.current;
860
+ let I = m.current;
849
861
  if (!I) return;
850
- let _ = I.value, { selectionStart: C, selectionEnd: D, selectionDirection: y } = I;
851
- I.value = "", I.value = _, y !== null ? I.setSelectionRange(C, D, y) : I.setSelectionRange(C, D);
862
+ let _ = I.value, { selectionStart: C, selectionEnd: k, selectionDirection: y } = I;
863
+ I.value = "", I.value = _, y !== null ? I.setSelectionRange(C, k, y) : I.setSelectionRange(C, k);
852
864
  }
853
- }, [w]);
854
- let O = pe(!1), V = R(() => {
865
+ }, [T]);
866
+ let O = ce(!1), N = R(() => {
855
867
  O.current = !0;
856
- }), M = R(() => {
857
- T.nextFrame(() => {
868
+ }), $ = R(() => {
869
+ M.nextFrame(() => {
858
870
  O.current = !1;
859
871
  });
860
- }), k = R((h) => {
861
- switch (n.actions.setIsTyping(!0), h.key) {
862
- case j.Enter:
863
- if (n.state.comboboxState !== m.Open || O.current) return;
864
- if (h.preventDefault(), h.stopPropagation(), n.selectors.activeOptionIndex(n.state) === null) {
872
+ }), D = R((f) => {
873
+ switch (n.actions.setIsTyping(!0), f.key) {
874
+ case B.Enter:
875
+ if (n.state.comboboxState !== v.Open || O.current) return;
876
+ if (f.preventDefault(), f.stopPropagation(), n.selectors.activeOptionIndex(n.state) === null) {
865
877
  n.actions.closeCombobox();
866
878
  return;
867
879
  }
868
880
  n.actions.selectActiveOption(), i.mode === U.Single && n.actions.closeCombobox();
869
881
  break;
870
- case j.ArrowDown:
871
- return h.preventDefault(), h.stopPropagation(), se(n.state.comboboxState, { [m.Open]: () => n.actions.goToOption({ focus: A.Next }), [m.Closed]: () => n.actions.openCombobox() });
872
- case j.ArrowUp:
873
- return h.preventDefault(), h.stopPropagation(), se(n.state.comboboxState, { [m.Open]: () => n.actions.goToOption({ focus: A.Previous }), [m.Closed]: () => {
874
- ee(() => n.actions.openCombobox()), i.value || n.actions.goToOption({ focus: A.Last });
882
+ case B.ArrowDown:
883
+ return f.preventDefault(), f.stopPropagation(), ie(n.state.comboboxState, { [v.Open]: () => n.actions.goToOption({ focus: A.Next }), [v.Closed]: () => n.actions.openCombobox() });
884
+ case B.ArrowUp:
885
+ return f.preventDefault(), f.stopPropagation(), ie(n.state.comboboxState, { [v.Open]: () => n.actions.goToOption({ focus: A.Previous }), [v.Closed]: () => {
886
+ Q(() => n.actions.openCombobox()), i.value || n.actions.goToOption({ focus: A.Last });
875
887
  } });
876
- case j.Home:
877
- if (n.state.comboboxState === m.Closed || h.shiftKey) break;
878
- return h.preventDefault(), h.stopPropagation(), n.actions.goToOption({ focus: A.First });
879
- case j.PageUp:
880
- return h.preventDefault(), h.stopPropagation(), n.actions.goToOption({ focus: A.First });
881
- case j.End:
882
- if (n.state.comboboxState === m.Closed || h.shiftKey) break;
883
- return h.preventDefault(), h.stopPropagation(), n.actions.goToOption({ focus: A.Last });
884
- case j.PageDown:
885
- return h.preventDefault(), h.stopPropagation(), n.actions.goToOption({ focus: A.Last });
886
- case j.Escape:
887
- return n.state.comboboxState !== m.Open ? void 0 : (h.preventDefault(), n.state.optionsElement && !i.optionsPropsRef.current.static && h.stopPropagation(), i.mode === U.Single && i.value === null && S(), n.actions.closeCombobox());
888
- case j.Tab:
889
- if (n.actions.setIsTyping(!1), n.state.comboboxState !== m.Open) return;
888
+ case B.Home:
889
+ if (n.state.comboboxState === v.Closed || f.shiftKey) break;
890
+ return f.preventDefault(), f.stopPropagation(), n.actions.goToOption({ focus: A.First });
891
+ case B.PageUp:
892
+ return f.preventDefault(), f.stopPropagation(), n.actions.goToOption({ focus: A.First });
893
+ case B.End:
894
+ if (n.state.comboboxState === v.Closed || f.shiftKey) break;
895
+ return f.preventDefault(), f.stopPropagation(), n.actions.goToOption({ focus: A.Last });
896
+ case B.PageDown:
897
+ return f.preventDefault(), f.stopPropagation(), n.actions.goToOption({ focus: A.Last });
898
+ case B.Escape:
899
+ return n.state.comboboxState !== v.Open ? void 0 : (f.preventDefault(), n.state.optionsElement && !i.optionsPropsRef.current.static && f.stopPropagation(), i.mode === U.Single && i.value === null && E(), n.actions.closeCombobox());
900
+ case B.Tab:
901
+ if (n.actions.setIsTyping(!1), n.state.comboboxState !== v.Open) return;
890
902
  i.mode === U.Single && n.state.activationTrigger !== G.Focus && n.actions.selectActiveOption(), n.actions.closeCombobox();
891
903
  break;
892
904
  }
893
- }), q = R((h) => {
894
- a?.(h), i.mode === U.Single && h.target.value === "" && S(), n.actions.openCombobox();
895
- }), H = R((h) => {
896
- var B, I, _;
897
- let C = (B = h.relatedTarget) != null ? B : ke.find((D) => D !== h.currentTarget);
898
- if (!((I = n.state.optionsElement) != null && I.contains(C)) && !((_ = n.state.buttonElement) != null && _.contains(C)) && n.state.comboboxState === m.Open) return h.preventDefault(), i.mode === U.Single && i.value === null && S(), n.actions.closeCombobox();
899
- }), x = R((h) => {
900
- var B, I, _;
901
- let C = (B = h.relatedTarget) != null ? B : ke.find((D) => D !== h.currentTarget);
902
- (I = n.state.buttonElement) != null && I.contains(C) || (_ = n.state.optionsElement) != null && _.contains(C) || i.disabled || i.immediate && n.state.comboboxState !== m.Open && T.microTask(() => {
903
- ee(() => n.actions.openCombobox()), n.actions.setActivationTrigger(G.Focus);
905
+ }), K = R((f) => {
906
+ a?.(f), i.mode === U.Single && f.target.value === "" && E(), n.actions.openCombobox();
907
+ }), q = R((f) => {
908
+ var j, I, _;
909
+ let C = (j = f.relatedTarget) != null ? j : Fe.find((k) => k !== f.currentTarget);
910
+ if (!((I = n.state.optionsElement) != null && I.contains(C)) && !((_ = n.state.buttonElement) != null && _.contains(C)) && n.state.comboboxState === v.Open) return f.preventDefault(), i.mode === U.Single && i.value === null && E(), n.actions.closeCombobox();
911
+ }), x = R((f) => {
912
+ var j, I, _;
913
+ let C = (j = f.relatedTarget) != null ? j : Fe.find((k) => k !== f.currentTarget);
914
+ (I = n.state.buttonElement) != null && I.contains(C) || (_ = n.state.optionsElement) != null && _.contains(C) || i.disabled || i.immediate && n.state.comboboxState !== v.Open && M.microTask(() => {
915
+ Q(() => n.actions.openCombobox()), n.actions.setActivationTrigger(G.Focus);
904
916
  });
905
- }), L = Te(), W = Lt(), { isFocused: E, focusProps: K } = Ke({ autoFocus: d }), { isHovered: re, hoverProps: J } = qe({ isDisabled: v }), ne = F(n, (h) => h.optionsElement), Q = ve({ open: w === m.Open, disabled: v, invalid: i.invalid, hover: re, focus: E, autofocus: d }), ae = $e({ ref: b, id: u, role: "combobox", type: f, "aria-controls": ne?.id, "aria-expanded": w === m.Open, "aria-activedescendant": F(n, n.selectors.activeDescendantId), "aria-labelledby": L, "aria-describedby": W, "aria-autocomplete": "list", defaultValue: (o = (e = t.defaultValue) != null ? e : i.defaultValue !== void 0 ? c?.(i.defaultValue) : null) != null ? o : i.defaultValue, disabled: v || void 0, autoFocus: d, onCompositionStart: V, onCompositionEnd: M, onKeyDown: k, onChange: q, onFocus: x, onBlur: H }, K, J);
906
- return ge()({ ourProps: ae, theirProps: p, slot: Q, defaultTag: dn, name: "Combobox.Input" });
917
+ }), L = Ie(), W = Dt(), { isFocused: S, focusProps: H } = We({ autoFocus: c }), { isHovered: le, hoverProps: Y } = Be({ isDisabled: g }), te = F(n, (f) => f.optionsElement), J = me({ open: T === v.Open, disabled: g, invalid: i.invalid, hover: le, focus: S, autofocus: c }), re = Ce({ ref: b, id: u, role: "combobox", type: h, "aria-controls": te?.id, "aria-expanded": T === v.Open, "aria-activedescendant": F(n, n.selectors.activeDescendantId), "aria-labelledby": L, "aria-describedby": W, "aria-autocomplete": "list", defaultValue: (o = (e = t.defaultValue) != null ? e : i.defaultValue !== void 0 ? d?.(i.defaultValue) : null) != null ? o : i.defaultValue, disabled: g || void 0, autoFocus: c, onCompositionStart: N, onCompositionEnd: $, onKeyDown: D, onChange: K, onFocus: x, onBlur: q }, H, Y);
918
+ return fe()({ ourProps: re, theirProps: p, slot: J, defaultTag: rn, name: "Combobox.Input" });
907
919
  }
908
- let fn = "button";
909
- function hn(t, s) {
910
- let e = be("Combobox.Button"), o = le("Combobox.Button"), [n, i] = Se(null), l = Ee(s, i, e.actions.setButtonElement), r = he(), { id: u = `headlessui-combobox-button-${r}`, disabled: a = o.disabled || !1, autoFocus: c = !1, ...v } = t, [d, f, p] = F(e, (x) => [x.comboboxState, x.inputElement, x.optionsElement]), g = Ye(f), b = d === m.Open;
911
- Ot(b, { trigger: n, action: Y((x) => {
912
- if (n != null && n.contains(x.target)) return ue.Ignore;
913
- if (f != null && f.contains(x.target)) return ue.Ignore;
920
+ let un = "button";
921
+ function cn(t, s) {
922
+ let e = ve("Combobox.Button"), o = se("Combobox.Button"), [n, i] = ye(null), l = xe(s, i, e.actions.setButtonElement), r = pe(), { id: u = `headlessui-combobox-button-${r}`, disabled: a = o.disabled || !1, autoFocus: d = !1, ...g } = t, [c, h, p] = F(e, (x) => [x.comboboxState, x.inputElement, x.optionsElement]), m = qe(h), b = c === v.Open;
923
+ mt(b, { trigger: n, action: X((x) => {
924
+ if (n != null && n.contains(x.target)) return ae.Ignore;
925
+ if (h != null && h.contains(x.target)) return ae.Ignore;
914
926
  let L = x.target.closest('[role="option"]:not([data-disabled])');
915
- return At(L) ? ue.Select(L) : p != null && p.contains(x.target) ? ue.Ignore : ue.Close;
916
- }, [n, f, p]), close: e.actions.closeCombobox, select: e.actions.selectActiveOption });
917
- let w = R((x) => {
927
+ return Mt(L) ? ae.Select(L) : p != null && p.contains(x.target) ? ae.Ignore : ae.Close;
928
+ }, [n, h, p]), close: e.actions.closeCombobox, select: e.actions.selectActiveOption });
929
+ let T = R((x) => {
918
930
  switch (x.key) {
919
- case j.Space:
920
- case j.Enter:
921
- x.preventDefault(), x.stopPropagation(), e.state.comboboxState === m.Closed && ee(() => e.actions.openCombobox()), g();
931
+ case B.Space:
932
+ case B.Enter:
933
+ x.preventDefault(), x.stopPropagation(), e.state.comboboxState === v.Closed && Q(() => e.actions.openCombobox()), m();
922
934
  return;
923
- case j.ArrowDown:
924
- x.preventDefault(), x.stopPropagation(), e.state.comboboxState === m.Closed && (ee(() => e.actions.openCombobox()), e.state.dataRef.current.value || e.actions.goToOption({ focus: A.First })), g();
935
+ case B.ArrowDown:
936
+ x.preventDefault(), x.stopPropagation(), e.state.comboboxState === v.Closed && (Q(() => e.actions.openCombobox()), e.state.dataRef.current.value || e.actions.goToOption({ focus: A.First })), m();
925
937
  return;
926
- case j.ArrowUp:
927
- x.preventDefault(), x.stopPropagation(), e.state.comboboxState === m.Closed && (ee(() => e.actions.openCombobox()), e.state.dataRef.current.value || e.actions.goToOption({ focus: A.Last })), g();
938
+ case B.ArrowUp:
939
+ x.preventDefault(), x.stopPropagation(), e.state.comboboxState === v.Closed && (Q(() => e.actions.openCombobox()), e.state.dataRef.current.value || e.actions.goToOption({ focus: A.Last })), m();
928
940
  return;
929
- case j.Escape:
930
- if (e.state.comboboxState !== m.Open) return;
931
- x.preventDefault(), e.state.optionsElement && !o.optionsPropsRef.current.static && x.stopPropagation(), ee(() => e.actions.closeCombobox()), g();
941
+ case B.Escape:
942
+ if (e.state.comboboxState !== v.Open) return;
943
+ x.preventDefault(), e.state.optionsElement && !o.optionsPropsRef.current.static && x.stopPropagation(), Q(() => e.actions.closeCombobox()), m();
932
944
  return;
933
945
  default:
934
946
  return;
935
947
  }
936
- }), $ = St(() => {
937
- e.state.comboboxState === m.Open ? e.actions.closeCombobox() : e.actions.openCombobox(), g();
938
- }), T = Te([u]), { isFocusVisible: S, focusProps: z } = Ke({ autoFocus: c }), { isHovered: O, hoverProps: V } = qe({ isDisabled: a }), { pressed: M, pressProps: k } = ot({ disabled: a }), q = ve({ open: d === m.Open, active: M || d === m.Open, disabled: a, invalid: o.invalid, value: o.value, hover: O, focus: S }), H = $e({ ref: l, id: u, type: it(t, n), tabIndex: -1, "aria-haspopup": "listbox", "aria-controls": p?.id, "aria-expanded": d === m.Open, "aria-labelledby": T, disabled: a || void 0, autoFocus: c, onKeyDown: w }, $, z, V, k);
939
- return ge()({ ourProps: H, theirProps: v, slot: q, defaultTag: fn, name: "Combobox.Button" });
948
+ }), w = vt(() => {
949
+ e.state.comboboxState === v.Open ? e.actions.closeCombobox() : e.actions.openCombobox(), m();
950
+ }), M = Ie([u]), { isFocusVisible: E, focusProps: z } = We({ autoFocus: d }), { isHovered: O, hoverProps: N } = Be({ isDisabled: a }), { pressed: $, pressProps: D } = Qe({ disabled: a }), K = me({ open: c === v.Open, active: $ || c === v.Open, disabled: a, invalid: o.invalid, value: o.value, hover: O, focus: E }), q = Ce({ ref: l, id: u, type: et(t, n), tabIndex: -1, "aria-haspopup": "listbox", "aria-controls": p?.id, "aria-expanded": c === v.Open, "aria-labelledby": M, disabled: a || void 0, autoFocus: d, onKeyDown: T }, w, z, N, D);
951
+ return fe()({ ourProps: q, theirProps: g, slot: K, defaultTag: un, name: "Combobox.Button" });
940
952
  }
941
- let mn = "div", gn = Re.RenderStrategy | Re.Static;
942
- function vn(t, s) {
953
+ let dn = "div", pn = we.RenderStrategy | we.Static;
954
+ function hn(t, s) {
943
955
  var e, o, n;
944
- let i = he(), { id: l = `headlessui-combobox-options-${i}`, hold: r = !1, anchor: u, portal: a = !1, modal: c = !0, transition: v = !1, ...d } = t, f = be("Combobox.Options"), p = le("Combobox.Options"), g = ft(u);
945
- g && (a = !0);
946
- let [b, w] = ht(g), [$, T] = Se(null), S = mt(), z = Ee(s, g ? b : null, f.actions.setOptionsElement, T), [O, V, M, k, q] = F(f, (P) => [P.comboboxState, P.inputElement, P.buttonElement, P.optionsElement, P.activationTrigger]), H = Fe(V || M), x = Fe(k), L = _t(), [W, E] = kt(v, $, L !== null ? (L & Oe.Open) === Oe.Open : O === m.Open);
947
- Tt(W, V, f.actions.closeCombobox);
948
- let K = p.__demoMode ? !1 : c && O === m.Open;
949
- Mt(K, x);
950
- let re = p.__demoMode ? !1 : c && O === m.Open;
951
- yt(re, { allowed: Y(() => [V, M, k], [V, M, k]) });
952
- let J = F(f, f.selectors.didInputMove) ? !1 : W;
953
- te(() => {
956
+ let i = pe(), { id: l = `headlessui-combobox-options-${i}`, hold: r = !1, anchor: u, portal: a = !1, modal: d = !0, transition: g = !1, ...c } = t, h = ve("Combobox.Options"), p = se("Combobox.Options"), m = ct(u);
957
+ m && (a = !0);
958
+ let [b, T] = dt(m), [w, M] = ye(null), E = pt(), z = xe(s, m ? b : null, h.actions.setOptionsElement, M), [O, N, $, D, K] = F(h, (P) => [P.comboboxState, P.inputElement, P.buttonElement, P.optionsElement, P.activationTrigger]), q = Re(N || $), x = Re(D), L = Pt(), [W, S] = At(g, w, L !== null ? (L & be.Open) === be.Open : O === v.Open);
959
+ Ct(W, N, h.actions.closeCombobox);
960
+ let H = p.__demoMode ? !1 : d && O === v.Open;
961
+ It(H, x);
962
+ let le = p.__demoMode ? !1 : d && O === v.Open;
963
+ xt(le, { allowed: X(() => [N, $, D], [N, $, D]) });
964
+ let Y = F(h, h.selectors.didInputMove) ? !1 : W;
965
+ ee(() => {
954
966
  var P;
955
967
  p.optionsPropsRef.current.static = (P = t.static) != null ? P : !1;
956
- }, [p.optionsPropsRef, t.static]), te(() => {
968
+ }, [p.optionsPropsRef, t.static]), ee(() => {
957
969
  p.optionsPropsRef.current.hold = r;
958
- }, [p.optionsPropsRef, r]), Nt(O === m.Open, { container: k, accept(P) {
970
+ }, [p.optionsPropsRef, r]), zt(O === v.Open, { container: D, accept(P) {
959
971
  return P.getAttribute("role") === "option" ? NodeFilter.FILTER_REJECT : P.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
960
972
  }, walk(P) {
961
973
  P.setAttribute("role", "none");
962
974
  } });
963
- let ne = Te([M?.id]), Q = ve({ open: O === m.Open, option: void 0 }), ae = R(() => {
964
- f.actions.setActivationTrigger(G.Pointer);
965
- }), h = R((P) => {
966
- P.preventDefault(), f.actions.setActivationTrigger(G.Pointer);
967
- }), B = $e(g ? S() : {}, { "aria-labelledby": ne, role: "listbox", "aria-multiselectable": p.mode === U.Multi ? !0 : void 0, id: l, ref: z, style: { ...d.style, ...w, "--input-width": Pe(W, V, !0).width, "--button-width": Pe(W, M, !0).width }, onWheel: q === G.Pointer ? void 0 : ae, onMouseDown: h, ...Dt(E) }), I = W && O === m.Closed && !t.static, _ = De(I, (e = p.virtual) == null ? void 0 : e.options), C = De(I, p.value), D = Y((P) => p.compare(C, P), [p.compare, C]), y = ie(() => {
975
+ let te = Ie([$?.id]), J = me({ open: O === v.Open, option: void 0 }), re = R(() => {
976
+ h.actions.setActivationTrigger(G.Pointer);
977
+ }), f = R((P) => {
978
+ P.preventDefault(), h.actions.setActivationTrigger(G.Pointer);
979
+ }), j = Ce(m ? E() : {}, { "aria-labelledby": te, role: "listbox", "aria-multiselectable": p.mode === U.Multi ? !0 : void 0, id: l, ref: z, style: { ...c.style, ...T, "--input-width": Me(W, N, !0).width, "--button-width": Me(W, $, !0).width }, onWheel: K === G.Pointer ? void 0 : re, onMouseDown: f, ...Ft(S) }), I = W && O === v.Closed && !t.static, _ = ze(I, (e = p.virtual) == null ? void 0 : e.options), C = ze(I, p.value), k = X((P) => p.compare(C, P), [p.compare, C]), y = oe(() => {
968
980
  if (!p.virtual) return p;
969
981
  if (_ === void 0) throw new Error("Missing `options` in virtual mode");
970
982
  return _ !== p.virtual.options ? { ...p, virtual: { ...p.virtual, options: _ } } : p;
971
983
  }, [p, _, (o = p.virtual) == null ? void 0 : o.options]);
972
- p.virtual && Object.assign(d, { children: N.createElement(fe.Provider, { value: y }, N.createElement(an, { slot: Q }, d.children)) });
973
- let Z = ge(), tt = ie(() => p.mode === U.Multi ? p : { ...p, isSelected: D }, [p, D]);
974
- return N.createElement(Rt, { enabled: a ? t.static || W : !1, ownerDocument: H }, N.createElement(fe.Provider, { value: tt }, Z({ ourProps: B, theirProps: { ...d, children: N.createElement(Wt, { freeze: I }, typeof d.children == "function" ? (n = d.children) == null ? void 0 : n.call(d, Q) : d.children) }, slot: Q, defaultTag: mn, features: gn, visible: J, name: "Combobox.Options" })));
984
+ p.virtual && Object.assign(c, { children: V.createElement(de.Provider, { value: y }, V.createElement(on, { slot: J }, c.children)) });
985
+ let Z = fe(), Ze = oe(() => p.mode === U.Multi ? p : { ...p, isSelected: k }, [p, k]);
986
+ return V.createElement(Tt, { enabled: a ? t.static || W : !1, ownerDocument: q }, V.createElement(de.Provider, { value: Ze }, Z({ ourProps: j, theirProps: { ...c, children: V.createElement(kt, { freeze: I }, typeof c.children == "function" ? (n = c.children) == null ? void 0 : n.call(c, J) : c.children) }, slot: J, defaultTag: dn, features: pn, visible: Y, name: "Combobox.Options" })));
975
987
  }
976
- let bn = "div";
977
- function xn(t, s) {
988
+ let fn = "div";
989
+ function mn(t, s) {
978
990
  var e, o, n;
979
- let i = le("Combobox.Option"), l = be("Combobox.Option"), r = he(), { id: u = `headlessui-combobox-option-${r}`, value: a, disabled: c = (n = (o = (e = i.virtual) == null ? void 0 : e.disabled) == null ? void 0 : o.call(e, a)) != null ? n : !1, order: v = null, ...d } = t, [f] = F(l, (E) => [E.inputElement]), p = Ye(f), g = F(l, Y((E) => l.selectors.isActive(E, a, u), [a, u])), b = i.isSelected(a), w = pe(null), $ = ut({ disabled: c, value: a, domRef: w, order: v }), T = we(et), S = Ee(s, w, T ? T.measureElement : null), z = R(() => {
991
+ let i = se("Combobox.Option"), l = ve("Combobox.Option"), r = pe(), { id: u = `headlessui-combobox-option-${r}`, value: a, disabled: d = (n = (o = (e = i.virtual) == null ? void 0 : e.disabled) == null ? void 0 : o.call(e, a)) != null ? n : !1, order: g = null, ...c } = t, [h] = F(l, (S) => [S.inputElement]), p = qe(h), m = F(l, X((S) => l.selectors.isActive(S, a, u), [a, u])), b = i.isSelected(a), T = ce(null), w = lt({ disabled: d, value: a, domRef: T, order: g }), M = Se(Je), E = xe(s, T, M ? M.measureElement : null), z = R(() => {
980
992
  l.actions.setIsTyping(!1), l.actions.onChange(a);
981
993
  });
982
- te(() => l.actions.registerOption(u, $), [$, u]);
983
- let O = F(l, Y((E) => l.selectors.shouldScrollIntoView(E, a, u), [a, u]));
984
- te(() => {
985
- if (O) return dt().requestAnimationFrame(() => {
986
- var E, K;
987
- (K = (E = w.current) == null ? void 0 : E.scrollIntoView) == null || K.call(E, { block: "nearest" });
994
+ ee(() => l.actions.registerOption(u, w), [w, u]);
995
+ let O = F(l, X((S) => l.selectors.shouldScrollIntoView(S, a, u), [a, u]));
996
+ ee(() => {
997
+ if (O) return rt().requestAnimationFrame(() => {
998
+ var S, H;
999
+ (H = (S = T.current) == null ? void 0 : S.scrollIntoView) == null || H.call(S, { block: "nearest" });
988
1000
  });
989
- }, [O, w]);
990
- let V = R((E) => {
991
- E.preventDefault(), E.button === Et.Left && (c || (z(), Pt() || requestAnimationFrame(() => p()), i.mode === U.Single && l.actions.closeCombobox()));
992
- }), M = R(() => {
993
- if (c) return l.actions.goToOption({ focus: A.Nothing });
994
- let E = i.calculateIndex(a);
995
- l.actions.goToOption({ focus: A.Specific, idx: E });
996
- }), k = xt(), q = R((E) => k.update(E)), H = R((E) => {
997
- if (!k.wasMoved(E) || c || g && l.state.activationTrigger === G.Pointer) return;
998
- let K = i.calculateIndex(a);
999
- l.actions.goToOption({ focus: A.Specific, idx: K }, G.Pointer);
1000
- }), x = R((E) => {
1001
- k.wasMoved(E) && (c || g && (i.optionsPropsRef.current.hold || l.state.activationTrigger === G.Pointer && l.actions.goToOption({ focus: A.Nothing })));
1002
- }), L = ve({ active: g, focus: g, selected: b, disabled: c }), W = { id: u, ref: S, role: "option", tabIndex: c === !0 ? void 0 : -1, "aria-disabled": c === !0 ? !0 : void 0, "aria-selected": b, disabled: void 0, onMouseDown: V, onFocus: M, onPointerEnter: q, onMouseEnter: q, onPointerMove: H, onMouseMove: H, onPointerLeave: x, onMouseLeave: x };
1003
- return ge()({ ourProps: W, theirProps: d, slot: L, defaultTag: bn, name: "Combobox.Option" });
1004
- }
1005
- let On = me(cn), Sn = me(hn), En = me(pn), yn = jt, Cn = me(vn), In = me(xn), ce = Object.assign(On, { Input: En, Button: Sn, Label: yn, Options: Cn, Option: In });
1006
- function Gn({
1007
- options: t,
1008
- value: s,
1009
- onChange: e,
1010
- placeholder: o = "Select an option...",
1011
- className: n,
1012
- disabled: i = !1
1013
- }) {
1014
- const [l, r] = Se(""), u = l === "" ? t : t.filter(
1015
- (a) => a.label.toLowerCase().includes(l.toLowerCase())
1016
- );
1017
- return /* @__PURE__ */ X("div", { className: ye("relative", n), children: /* @__PURE__ */ nt(
1018
- ce,
1019
- {
1020
- value: s,
1021
- onChange: (a) => {
1022
- a && e?.(a);
1023
- },
1024
- disabled: i,
1025
- children: [
1026
- /* @__PURE__ */ X(
1027
- ce.Input,
1028
- {
1029
- className: ye(
1030
- "w-full rounded-md border border-input bg-background py-2 pl-3 pr-10 text-base leading-5 text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background",
1031
- i && "cursor-not-allowed opacity-50"
1032
- ),
1033
- displayValue: (a) => a?.label || "",
1034
- onChange: (a) => r(a.target.value),
1035
- placeholder: o
1036
- }
1037
- ),
1038
- /* @__PURE__ */ X(ce.Button, { className: "absolute inset-y-0 right-0 flex items-center pr-2", children: /* @__PURE__ */ X(
1039
- "svg",
1040
- {
1041
- className: "h-5 w-5 text-muted-foreground",
1042
- fill: "none",
1043
- stroke: "currentColor",
1044
- viewBox: "0 0 24 24",
1045
- children: /* @__PURE__ */ X(
1046
- "path",
1047
- {
1048
- strokeLinecap: "round",
1049
- strokeLinejoin: "round",
1050
- strokeWidth: 2,
1051
- d: "M19 9l-7 7-7-7"
1052
- }
1053
- )
1054
- }
1055
- ) }),
1056
- /* @__PURE__ */ X(ce.Options, { className: "absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-background py-1 text-base shadow-lg ring-1 ring-border focus:outline-none", children: u.length === 0 && l !== "" ? /* @__PURE__ */ X("div", { className: "relative cursor-default select-none px-4 py-2 text-muted-foreground", children: "Nothing found." }) : u.map((a) => /* @__PURE__ */ X(
1057
- ce.Option,
1058
- {
1059
- value: a,
1060
- className: ({ active: c }) => ye(
1061
- "relative cursor-default select-none py-2 pl-10 pr-4",
1062
- c ? "bg-accent text-accent-foreground" : "text-foreground"
1063
- ),
1064
- children: a.label
1065
- },
1066
- a.id
1067
- )) })
1068
- ]
1069
- }
1070
- ) });
1001
+ }, [O, T]);
1002
+ let N = R((S) => {
1003
+ S.preventDefault(), S.button === gt.Left && (d || (z(), wt() || requestAnimationFrame(() => p()), i.mode === U.Single && l.actions.closeCombobox()));
1004
+ }), $ = R(() => {
1005
+ if (d) return l.actions.goToOption({ focus: A.Nothing });
1006
+ let S = i.calculateIndex(a);
1007
+ l.actions.goToOption({ focus: A.Specific, idx: S });
1008
+ }), D = bt(), K = R((S) => D.update(S)), q = R((S) => {
1009
+ if (!D.wasMoved(S) || d || m && l.state.activationTrigger === G.Pointer) return;
1010
+ let H = i.calculateIndex(a);
1011
+ l.actions.goToOption({ focus: A.Specific, idx: H }, G.Pointer);
1012
+ }), x = R((S) => {
1013
+ D.wasMoved(S) && (d || m && (i.optionsPropsRef.current.hold || l.state.activationTrigger === G.Pointer && l.actions.goToOption({ focus: A.Nothing })));
1014
+ }), L = me({ active: m, focus: m, selected: b, disabled: d }), W = { id: u, ref: E, role: "option", tabIndex: d === !0 ? void 0 : -1, "aria-disabled": d === !0 ? !0 : void 0, "aria-selected": b, disabled: void 0, onMouseDown: N, onFocus: $, onPointerEnter: K, onMouseEnter: K, onPointerMove: q, onMouseMove: q, onPointerLeave: x, onMouseLeave: x };
1015
+ return fe()({ ourProps: W, theirProps: c, slot: L, defaultTag: fn, name: "Combobox.Option" });
1071
1016
  }
1017
+ let vn = he(ln), gn = he(cn), bn = he(an), xn = Vt, On = he(hn), En = he(mn), Bn = Object.assign(vn, { Input: bn, Button: gn, Label: xn, Options: On, Option: En });
1072
1018
  export {
1073
- Gn as C
1019
+ gn as B,
1020
+ En as H,
1021
+ On as U,
1022
+ Bn as a,
1023
+ bn as k
1074
1024
  };