@mci-ui/mci-ui 0.0.87 → 0.0.89

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 (33) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/shared/ui/MciModal/MciModal.js +30 -28
  3. package/dist/shared/ui/mciAccordion/MciAccordion.js +97 -64
  4. package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +45 -25
  5. package/dist/shared/ui/mciButton/MciButton.js +39 -31
  6. package/dist/shared/ui/mciCheck/MciCheck.js +86 -76
  7. package/dist/shared/ui/mciDrawer/MciDrawer.js +78 -54
  8. package/dist/shared/ui/mciInput/MciInput.js +39 -40
  9. package/dist/shared/ui/mciLoader/MciLoader.js +14 -14
  10. package/dist/shared/ui/mciPagination/MciPagination.js +28 -18
  11. package/dist/shared/ui/mciPicker/MciPicker.js +53 -53
  12. package/dist/shared/ui/mciSelect/MciSelect.js +42 -41
  13. package/dist/shared/ui/mciTable/MciTable.js +97 -90
  14. package/dist/shared/ui/mciTable/MciTableClamp2.js +4 -3
  15. package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +100 -79
  16. package/dist/shared/ui/mciTabs/MciTabs.js +66 -55
  17. package/dist/shared/ui/mciToggle/MciToggle.js +51 -43
  18. package/dist/shared/ui/mciUpload/MciUpload.js +129 -107
  19. package/dist/types/shared/types/mci-table.types.d.ts +2 -0
  20. package/dist/types/shared/types/ui/accordion.types.d.ts +1 -0
  21. package/dist/types/shared/types/ui/breadcrumb.types.d.ts +1 -1
  22. package/dist/types/shared/types/ui/button.types.d.ts +1 -1
  23. package/dist/types/shared/types/ui/check.types.d.ts +1 -1
  24. package/dist/types/shared/types/ui/drawer.types.d.ts +2 -0
  25. package/dist/types/shared/types/ui/loader.types.d.ts +1 -1
  26. package/dist/types/shared/types/ui/pagination.types.d.ts +1 -1
  27. package/dist/types/shared/types/ui/toggle.types.d.ts +1 -1
  28. package/dist/types/shared/types/ui/upload.types.d.ts +1 -1
  29. package/dist/types/shared/ui/mciAccordion/MciAccordion.d.ts +5 -3
  30. package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -1
  31. package/dist/types/shared/ui/mciTable/MciTable.d.ts +1 -1
  32. package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +3 -2
  33. package/package.json +1 -1
@@ -8,7 +8,7 @@ import _e from "../mciInput/MciInput.js";
8
8
  import { toSafeDate as D, formatDateByPattern as qe, isDateOutsideBounds as Ge, normalizeDate as F, isSameCalendarDay as He, parseDateFromInput as he, formatManualDateInput as Je, getCalendarDays as Qe, shiftYear as Ue, shiftMonth as Xe } from "./mci-picker.utils.js";
9
9
  const Ze = $e(
10
10
  ({
11
- type: s = "date",
11
+ type: o = "date",
12
12
  value: T,
13
13
  onChange: u,
14
14
  placeholder: K,
@@ -29,38 +29,38 @@ const Ze = $e(
29
29
  align: V = "auto"
30
30
  }, ve) => {
31
31
  const [f, W] = w(!1), [re, p] = w(
32
- s === "range" ? [null, null] : null
33
- ), [I, R] = w([null, null]), [m, b] = w(/* @__PURE__ */ new Date()), [le, Y] = w(y), [we, _] = w(0), [j, d] = w(""), [q, se] = w(!1), [G, oe] = w(V), E = Te(null), g = de(() => {
32
+ o === "range" ? [null, null] : null
33
+ ), [I, R] = w([null, null]), [m, b] = w(/* @__PURE__ */ new Date()), [le, Y] = w(y), [we, _] = w(0), [j, d] = w(""), [q, oe] = w(!1), [G, se] = w(V), E = Te(null), g = de(() => {
34
34
  const e = T !== void 0 ? T : re;
35
- if (s === "date") return D(e);
35
+ if (o === "date") return D(e);
36
36
  const t = e;
37
37
  return [D(t[0]), D(t[1])];
38
- }, [T, re, s]), H = We[xe], c = N(
38
+ }, [T, re, o]), H = We[xe], c = N(
39
39
  (e) => qe(e, k),
40
40
  [k]
41
41
  ), S = N(
42
42
  (e) => Ge(e, M, ee),
43
43
  [M, ee]
44
44
  ), C = de(() => {
45
- if (s === "date") return c(g);
45
+ if (o === "date") return c(g);
46
46
  const [e, t] = g;
47
47
  return !e && !t ? "" : e && t ? `${c(e)} - ${c(t)}` : e ? `${c(e)} - ...` : "...";
48
- }, [s, g, c]);
48
+ }, [o, g, c]);
49
49
  $(() => {
50
50
  (!f && !q || j === "" && C !== "") && d(C);
51
51
  }, [C, f, j, q]), $(() => {
52
52
  if (f)
53
- if (s === "range") {
53
+ if (o === "range") {
54
54
  const e = g;
55
55
  R(e), e[0] ? b(e[0]) : e[1] ? b(e[1]) : b(/* @__PURE__ */ new Date());
56
56
  } else {
57
57
  const e = g;
58
58
  b(e || /* @__PURE__ */ new Date());
59
59
  }
60
- }, [f, s, g]), $(() => {
60
+ }, [f, o, g]), $(() => {
61
61
  if (f && V === "auto" && E.current) {
62
62
  const e = E.current.getBoundingClientRect(), t = window.innerWidth - e.right, n = e.left;
63
- t < 300 && n > 300 ? oe("right") : oe("left");
63
+ t < 300 && n > 300 ? se("right") : se("left");
64
64
  }
65
65
  }, [f, V]);
66
66
  const x = N(() => {
@@ -75,9 +75,9 @@ const Ze = $e(
75
75
  };
76
76
  }, [f, J, Q]);
77
77
  const De = () => {
78
- se(!0), !(A || f) && (s === "range" || !te) && (W(!0), Y(y));
78
+ oe(!0), !(A || f) && (o === "range" || !te) && (W(!0), Y(y));
79
79
  }, ye = () => {
80
- if (se(!1), s !== "date") return;
80
+ if (oe(!1), o !== "date") return;
81
81
  const e = j.trim();
82
82
  if (!e) {
83
83
  p(null), u?.(null);
@@ -91,69 +91,69 @@ const Ze = $e(
91
91
  }
92
92
  d(C);
93
93
  }, Ie = (e) => {
94
- if (s !== "date") return;
94
+ if (o !== "date") return;
95
95
  const t = e.target.value, n = Je(t), i = n.replace(/\D/g, "");
96
96
  if (!(i.length >= 1 && Number.parseInt(i[0] ?? "0", 10) > 3)) {
97
97
  if (i.length >= 2) {
98
- const o = Number.parseInt(i.slice(0, 2), 10);
99
- if (o < 1 || o > 31) return;
98
+ const s = Number.parseInt(i.slice(0, 2), 10);
99
+ if (s < 1 || s > 31) return;
100
100
  }
101
101
  if (!(i.length >= 3 && Number.parseInt(i[2] ?? "0", 10) > 1)) {
102
102
  if (i.length >= 4) {
103
- const o = Number.parseInt(i.slice(2, 4), 10);
104
- if (o < 1 || o > 12) return;
103
+ const s = Number.parseInt(i.slice(2, 4), 10);
104
+ if (s < 1 || s > 12) return;
105
105
  }
106
106
  if (d(n), n.length === 10) {
107
- const o = he(n);
108
- o && !S(o) && (p(o), u?.(o), b(o));
107
+ const s = he(n);
108
+ s && !S(s) && (p(s), u?.(s), b(s));
109
109
  } else n === "" && (p(null), u?.(null));
110
110
  }
111
111
  }
112
112
  }, Ce = N(() => {
113
- const e = s === "range" ? [null, null] : null;
113
+ const e = o === "range" ? [null, null] : null;
114
114
  p(e), R([null, null]), u?.(e), d("");
115
- }, [s, u]), ze = N(
115
+ }, [o, u]), ze = N(
116
116
  (e) => {
117
117
  if (S(e)) return;
118
118
  const t = F(e);
119
- if (s === "date")
119
+ if (o === "date")
120
120
  p(t), u?.(t), d(c(t)), x();
121
121
  else {
122
122
  const [n, i] = I;
123
123
  if (!n && !i || n && i)
124
124
  R([t, null]), d(`${c(t)} - ...`);
125
125
  else if (n && !i) {
126
- const o = t < n ? [t, n] : [n, t];
127
- R(o), p(o), u?.(o);
128
- const [z, v] = o;
126
+ const s = t < n ? [t, n] : [n, t];
127
+ R(s), p(s), u?.(s);
128
+ const [z, v] = s;
129
129
  d(`${c(z)} - ${c(v)}`), x();
130
130
  }
131
131
  }
132
132
  },
133
- [s, I, S, u, x, c]
133
+ [o, I, S, u, x, c]
134
134
  ), Fe = N((e) => {
135
135
  const t = new Date(m.getFullYear(), e, 1);
136
- b(t), y === "month" && s === "date" ? (p(t), u?.(t), d(c(t)), x()) : Y("day");
137
- }, [m, y, u, x, s, c]), Ye = N((e) => {
136
+ b(t), y === "month" && o === "date" ? (p(t), u?.(t), d(c(t)), x()) : Y("day");
137
+ }, [m, y, u, x, o, c]), Ye = N((e) => {
138
138
  const t = new Date(e, m.getMonth(), 1);
139
- b(t), y === "year" && s === "date" ? (p(t), u?.(t), d(c(t)), x()) : Y("month");
140
- }, [m, y, u, x, s, c]), ae = (e) => {
139
+ b(t), y === "year" && o === "date" ? (p(t), u?.(t), d(c(t)), x()) : Y("month");
140
+ }, [m, y, u, x, o, c]), ae = (e) => {
141
141
  b((t) => Xe(t, e));
142
142
  }, L = (e) => {
143
143
  b((t) => Ue(t, e));
144
144
  }, O = N((e, t) => He(e, t), []), Ae = (e) => {
145
145
  const t = F(e);
146
- if (s === "date") return g && O(t, g);
146
+ if (o === "date") return g && O(t, g);
147
147
  const [n] = I[0] ? I : g;
148
148
  return D(n) && O(t, D(n));
149
149
  }, Se = (e) => {
150
- if (s !== "range") return !1;
150
+ if (o !== "range") return !1;
151
151
  const t = F(e), [, n] = I[1] ? I : g;
152
152
  return D(n) && O(t, D(n));
153
153
  }, Re = (e) => {
154
- if (s !== "range") return !1;
155
- const t = F(e), [n, i] = I[0] ? I : g, o = D(n), z = D(i);
156
- return o && !z ? !1 : o && z && t > F(o) && t < F(z);
154
+ if (o !== "range") return !1;
155
+ const t = F(e), [n, i] = I[0] ? I : g, s = D(n), z = D(i);
156
+ return s && !z ? !1 : s && z && t > F(s) && t < F(z);
157
157
  }, ie = (e, t, n) => {
158
158
  const i = Qe(e);
159
159
  return /* @__PURE__ */ h("div", { className: "w-[300px] p-2 select-none", children: [
@@ -165,7 +165,7 @@ const Ze = $e(
165
165
  onClick: () => L(-1),
166
166
  type: "button",
167
167
  className: a(
168
- "rounded p-1 transition-colors",
168
+ "cursor-pointer rounded p-1 transition-colors",
169
169
  l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
170
170
  ),
171
171
  children: /* @__PURE__ */ r(Pe, { size: 18 })
@@ -177,7 +177,7 @@ const Ze = $e(
177
177
  onClick: () => ae(-1),
178
178
  type: "button",
179
179
  className: a(
180
- "rounded p-1 transition-colors",
180
+ "cursor-pointer rounded p-1 transition-colors",
181
181
  l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
182
182
  ),
183
183
  children: /* @__PURE__ */ r(X, { size: 18 })
@@ -224,7 +224,7 @@ const Ze = $e(
224
224
  onClick: () => ae(1),
225
225
  type: "button",
226
226
  className: a(
227
- "rounded p-1 transition-colors",
227
+ "cursor-pointer rounded p-1 transition-colors",
228
228
  l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
229
229
  ),
230
230
  children: /* @__PURE__ */ r(Z, { size: 18 })
@@ -236,7 +236,7 @@ const Ze = $e(
236
236
  onClick: () => L(1),
237
237
  type: "button",
238
238
  className: a(
239
- "rounded p-1 transition-colors",
239
+ "cursor-pointer rounded p-1 transition-colors",
240
240
  l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
241
241
  ),
242
242
  children: /* @__PURE__ */ r(Be, { size: 18 })
@@ -251,19 +251,19 @@ const Ze = $e(
251
251
  "mb-1 grid grid-cols-7 text-center text-[11px] font-bold uppercase",
252
252
  l ? "text-blue-500" : "text-blue-600"
253
253
  ),
254
- children: H.weekdaysShort.map((o) => /* @__PURE__ */ r("div", { className: "py-1", children: o }, o))
254
+ children: H.weekdaysShort.map((s) => /* @__PURE__ */ r("div", { className: "py-1", children: s }, s))
255
255
  }
256
256
  ),
257
- /* @__PURE__ */ r("div", { className: "grid grid-cols-7 gap-y-1 relative", children: i.map((o, z) => {
258
- const v = o.date, ue = S(v), P = Ae(v), B = Se(v), Le = Re(v);
257
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-7 gap-y-1 relative", children: i.map((s, z) => {
258
+ const v = s.date, ue = S(v), P = Ae(v), B = Se(v), Le = Re(v);
259
259
  return /* @__PURE__ */ r(
260
260
  "div",
261
261
  {
262
262
  className: a(
263
263
  "relative flex h-10 items-center justify-center",
264
264
  Le && (l ? "bg-blue-500/15" : "bg-blue-50"),
265
- P && s === "range" && B ? l ? "rounded-full bg-blue-500" : "rounded-full bg-blue-50" : P && s === "range" ? l ? "rounded-l-full bg-gradient-to-r from-transparent to-blue-500/15" : "rounded-l-full bg-gradient-to-r from-transparent to-blue-50" : "",
266
- B && s === "range" ? l ? "rounded-r-full bg-gradient-to-l from-transparent to-blue-500/15" : "rounded-r-full bg-gradient-to-l from-transparent to-blue-50" : ""
265
+ P && o === "range" && B ? l ? "rounded-full bg-blue-500" : "rounded-full bg-blue-50" : P && o === "range" ? l ? "rounded-l-full bg-gradient-to-r from-transparent to-blue-500/15" : "rounded-l-full bg-gradient-to-r from-transparent to-blue-50" : "",
266
+ B && o === "range" ? l ? "rounded-r-full bg-gradient-to-l from-transparent to-blue-500/15" : "rounded-r-full bg-gradient-to-l from-transparent to-blue-50" : ""
267
267
  ),
268
268
  children: /* @__PURE__ */ r(
269
269
  "button",
@@ -273,7 +273,7 @@ const Ze = $e(
273
273
  disabled: ue,
274
274
  className: a(
275
275
  "z-10 flex h-9 w-9 cursor-pointer items-center justify-center rounded-full text-sm font-medium transition-all",
276
- o.isCurrentMonth ? l ? "text-neutral-50" : "text-slate-700" : l ? "text-neutral-100/40" : "text-slate-300",
276
+ s.isCurrentMonth ? l ? "text-neutral-50" : "text-slate-700" : l ? "text-neutral-100/40" : "text-slate-300",
277
277
  ue && "cursor-not-allowed opacity-20",
278
278
  P || B ? "bg-blue-600 text-white shadow-md shadow-blue-200 hover:bg-blue-700" : l ? "hover:bg-neutral-300 hover:text-white" : "hover:bg-blue-50",
279
279
  O(v, /* @__PURE__ */ new Date()) && !P && !B && (l ? "border border-blue-500 text-blue-500" : "border border-blue-600 text-blue-600")
@@ -294,7 +294,7 @@ const Ze = $e(
294
294
  type: "button",
295
295
  onClick: () => L(-1),
296
296
  className: a(
297
- "rounded p-1",
297
+ "cursor-pointer rounded p-1",
298
298
  l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
299
299
  ),
300
300
  children: /* @__PURE__ */ r(X, { size: 20 })
@@ -307,7 +307,7 @@ const Ze = $e(
307
307
  type: "button",
308
308
  onClick: () => L(1),
309
309
  className: a(
310
- "rounded p-1",
310
+ "cursor-pointer rounded p-1",
311
311
  l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
312
312
  ),
313
313
  children: /* @__PURE__ */ r(Z, { size: 20 })
@@ -325,7 +325,7 @@ const Ze = $e(
325
325
  type: "button",
326
326
  onClick: () => _((n) => n - 1),
327
327
  className: a(
328
- "rounded p-1",
328
+ "cursor-pointer rounded p-1",
329
329
  l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
330
330
  ),
331
331
  children: /* @__PURE__ */ r(X, { size: 20 })
@@ -342,7 +342,7 @@ const Ze = $e(
342
342
  type: "button",
343
343
  onClick: () => _((n) => n + 1),
344
344
  className: a(
345
- "rounded p-1",
345
+ "cursor-pointer rounded p-1",
346
346
  l ? "text-neutral-100 hover:bg-neutral-300 hover:text-white" : "text-slate-500 hover:bg-slate-100"
347
347
  ),
348
348
  children: /* @__PURE__ */ r(Z, { size: 20 })
@@ -385,10 +385,10 @@ const Ze = $e(
385
385
  required: me,
386
386
  error: ge,
387
387
  darkMode: l,
388
- maxLength: s === "date" ? 10 : void 0,
388
+ maxLength: o === "date" ? 10 : void 0,
389
389
  onFocus: De,
390
390
  onBlur: ye,
391
- readOnly: !te || s === "range",
391
+ readOnly: !te || o === "range",
392
392
  showClearButton: pe,
393
393
  onClear: Ce
394
394
  }
@@ -407,8 +407,8 @@ const Ze = $e(
407
407
  style: { width: "max-content" },
408
408
  onMouseDown: (e) => e.stopPropagation(),
409
409
  children: le === "day" ? /* @__PURE__ */ h(U, { children: [
410
- ie(m, !0, s !== "range"),
411
- s === "range" && /* @__PURE__ */ r("div", { className: a(
410
+ ie(m, !0, o !== "range"),
411
+ o === "range" && /* @__PURE__ */ r("div", { className: a(
412
412
  "hidden border-l md:block",
413
413
  l ? "border-neutral-200" : "border-slate-100"
414
414
  ), children: ie(new Date(m.getFullYear(), m.getMonth() + 1, 1), !1, !0) })
@@ -1,9 +1,9 @@
1
1
  import { jsxs as _, jsx as a } from "react/jsx-runtime";
2
2
  import { AltArrowDown as st } from "@solar-icons/react";
3
3
  import ot from "../../../assets/icons/close.svg.js";
4
- import { forwardRef as ct, useState as w, useRef as G, useMemo as O, useCallback as h, useEffect as J } from "react";
4
+ import { forwardRef as ct, useState as w, useRef as G, useMemo as O, useCallback as p, useEffect as J } from "react";
5
5
  import { useClickOutside as it, useEscapeKey as ut, cn as s } from "../../lib/utils.js";
6
- import { getFilteredOptions as ft, getSelectStateStyles as mt, getSelectIconColor as ht, SELECT_SIZES as pt } from "./mci-select.utils.js";
6
+ import { getFilteredOptions as ft, getSelectStateStyles as mt, getSelectIconColor as pt, SELECT_SIZES as ht } from "./mci-select.utils.js";
7
7
  const xt = ct(
8
8
  ({
9
9
  label: U,
@@ -14,7 +14,7 @@ const xt = ct(
14
14
  size: l = "base",
15
15
  darkMode: e = !1,
16
16
  error: o,
17
- disabled: r = !1,
17
+ disabled: n = !1,
18
18
  required: Q = !1,
19
19
  value: m,
20
20
  onChange: b,
@@ -22,45 +22,45 @@ const xt = ct(
22
22
  onBlur: y,
23
23
  className: X,
24
24
  clearable: Y = !1,
25
- searchable: p = !1,
25
+ searchable: h = !1,
26
26
  onSearch: N,
27
27
  name: k
28
28
  }, z) => {
29
- const [n, S] = w(!1), [i, F] = w(!1), [M, $] = w(""), [T, x] = w(""), [C, u] = w(-1), H = G(null), K = G(null), d = m !== void 0 ? m : M, Z = L.find((t) => t.value === d), E = d !== "" && d !== void 0, D = Y && E && !r, I = !!(v && R === "right"), c = pt[l], tt = O(() => I && D ? l === "sm" || l === "md" ? "pr-16" : "pr-20" : I || D ? l === "sm" ? "pr-11" : l === "md" ? "pr-12" : "pr-14" : l === "sm" ? "pr-8" : l === "md" ? "pr-9" : "pr-10", [I, D, l]), f = O(() => ft(L, T, p, !!N), [L, T, p, N]), q = h(() => {
29
+ const [r, S] = w(!1), [i, F] = w(!1), [M, $] = w(""), [T, x] = w(""), [C, u] = w(-1), H = G(null), K = G(null), g = m !== void 0 ? m : M, Z = L.find((t) => t.value === g), E = g !== "" && g !== void 0, D = Y && E && !n, I = !!(v && R === "right"), c = ht[l], tt = O(() => I && D ? l === "sm" || l === "md" ? "pr-16" : "pr-20" : I || D ? l === "sm" ? "pr-11" : l === "md" ? "pr-12" : "pr-14" : l === "sm" ? "pr-8" : l === "md" ? "pr-9" : "pr-10", [I, D, l]), f = O(() => ft(L, T, h, !!N), [L, T, h, N]), q = p(() => {
30
30
  S(!1), F(!1), x(""), u(-1), y?.();
31
31
  }, [y]), { handleClick: V } = it(H, q), { handleEscape: j } = ut(q);
32
32
  J(() => {
33
- if (n)
33
+ if (r)
34
34
  return document.addEventListener("mousedown", V), document.addEventListener("keydown", j), () => {
35
35
  document.removeEventListener("mousedown", V), document.removeEventListener("keydown", j);
36
36
  };
37
- }, [n, V, j]), J(() => {
38
- n && p && K.current && K.current.focus();
39
- }, [n, p]);
40
- const et = h(() => {
41
- r || (S((t) => !t), n ? (x(""), u(-1)) : (F(!0), W?.()));
42
- }, [r, n, W]), P = h(
37
+ }, [r, V, j]), J(() => {
38
+ r && h && K.current && K.current.focus();
39
+ }, [r, h]);
40
+ const et = p(() => {
41
+ n || (S((t) => !t), r ? (x(""), u(-1)) : (F(!0), W?.()));
42
+ }, [n, r, W]), P = p(
43
43
  (t) => {
44
44
  m === void 0 && $(t), b?.(t), S(!1), F(!1), x(""), u(-1), y?.();
45
45
  },
46
46
  [m, b, y]
47
- ), nt = h(
47
+ ), nt = p(
48
48
  (t) => {
49
- if (!r) {
50
- if (!n && (t.key === "ArrowDown" || t.key === "ArrowUp" || t.key === "Enter")) {
49
+ if (!n) {
50
+ if (!r && (t.key === "ArrowDown" || t.key === "ArrowUp" || t.key === "Enter")) {
51
51
  t.preventDefault(), S(!0);
52
52
  return;
53
53
  }
54
- if (n)
54
+ if (r)
55
55
  switch (t.key) {
56
56
  case "ArrowDown":
57
57
  t.preventDefault(), u(
58
- (g) => g < f.length - 1 ? g + 1 : 0
58
+ (d) => d < f.length - 1 ? d + 1 : 0
59
59
  );
60
60
  break;
61
61
  case "ArrowUp":
62
62
  t.preventDefault(), u(
63
- (g) => g > 0 ? g - 1 : f.length - 1
63
+ (d) => d > 0 ? d - 1 : f.length - 1
64
64
  );
65
65
  break;
66
66
  case "Enter":
@@ -69,23 +69,23 @@ const xt = ct(
69
69
  }
70
70
  }
71
71
  },
72
- [n, f, C, r, P]
73
- ), rt = h(
72
+ [r, f, C, n, P]
73
+ ), rt = p(
74
74
  (t) => {
75
- t.stopPropagation(), !r && (m === void 0 && $(""), b?.(""), x(""), u(-1));
75
+ t.stopPropagation(), !n && (m === void 0 && $(""), b?.(""), x(""), u(-1));
76
76
  },
77
- [m, b, r]
78
- ), lt = h(
77
+ [m, b, n]
78
+ ), lt = p(
79
79
  (t) => {
80
80
  x(t), N?.(t), u(0);
81
81
  },
82
82
  [N]
83
83
  ), at = O(
84
- () => mt(r, o, e),
85
- [o, r, e]
84
+ () => mt(n, o, e),
85
+ [o, n, e]
86
86
  ), B = O(
87
- () => ht(r, o, n, i, e),
88
- [r, o, n, i, e]
87
+ () => pt(n, o, r, i, e),
88
+ [n, o, r, i, e]
89
89
  );
90
90
  return /* @__PURE__ */ _("div", { className: s("w-full", X), ref: z, children: [
91
91
  U && /* @__PURE__ */ _(
@@ -114,22 +114,23 @@ const xt = ct(
114
114
  "div",
115
115
  {
116
116
  role: "combobox",
117
- "aria-expanded": n,
117
+ "aria-expanded": r,
118
118
  "aria-haspopup": "listbox",
119
119
  "aria-controls": `${k}-listbox`,
120
- "aria-disabled": r,
121
- tabIndex: r ? -1 : 0,
120
+ "aria-disabled": n,
121
+ tabIndex: n ? -1 : 0,
122
122
  onClick: et,
123
123
  className: s(
124
124
  "flex w-full items-center border font-normal transition-all duration-300 ease-in-out",
125
+ n ? "cursor-not-allowed" : "cursor-pointer",
125
126
  l === "base" ? "rounded-xl" : "rounded-lg",
126
127
  c.container,
127
128
  v && R === "left" ? c.iconPaddingLeft : c.padding,
128
129
  tt,
129
130
  at,
130
- e && !r && (i || n) && !o && "border-blue-500 shadow-[0_0_0_2px_var(--opacity-25,rgba(21,93,252,0.25))] text-white",
131
- e && !r && (i || n) && o && "border-red-500 shadow-[0_0_0_2px_rgba(231,0,11,0.25)]",
132
- !e && !r && i && "shadow-blue border-blue-600"
131
+ e && !n && (i || r) && !o && "border-blue-500 shadow-[0_0_0_2px_var(--opacity-25,rgba(21,93,252,0.25))] text-white",
132
+ e && !n && (i || r) && o && "border-red-500 shadow-[0_0_0_2px_rgba(231,0,11,0.25)]",
133
+ !e && !n && i && "shadow-blue border-blue-600"
133
134
  ),
134
135
  children: [
135
136
  v && /* @__PURE__ */ a(
@@ -143,7 +144,7 @@ const xt = ct(
143
144
  children: v
144
145
  }
145
146
  ),
146
- p && n ? /* @__PURE__ */ a(
147
+ h && r ? /* @__PURE__ */ a(
147
148
  "input",
148
149
  {
149
150
  ref: K,
@@ -163,9 +164,9 @@ const xt = ct(
163
164
  title: Z?.label || A,
164
165
  className: s(
165
166
  "block min-w-0 flex-1 truncate select-none",
166
- !E && !r && (e ? "text-neutral-100" : "text-slate-400"),
167
- e && E && (i || n) && "text-white",
168
- e && E && !i && !n && "text-neutral-50"
167
+ !E && !n && (e ? "text-neutral-100" : "text-slate-400"),
168
+ e && E && (i || r) && "text-white",
169
+ e && E && !i && !r && "text-neutral-50"
169
170
  ),
170
171
  children: Z?.label || A
171
172
  }
@@ -190,7 +191,7 @@ const xt = ct(
190
191
  className: s(
191
192
  "absolute top-1/2 -translate-y-1/2 pointer-events-none transition-all duration-300",
192
193
  l === "sm" ? "right-2" : "right-3",
193
- n && "rotate-180",
194
+ r && "rotate-180",
194
195
  B
195
196
  ),
196
197
  children: /* @__PURE__ */ a(st, { className: c.iconSize })
@@ -199,7 +200,7 @@ const xt = ct(
199
200
  ]
200
201
  }
201
202
  ),
202
- n && !r && /* @__PURE__ */ a(
203
+ r && !n && /* @__PURE__ */ a(
203
204
  "div",
204
205
  {
205
206
  id: `${k}-listbox`,
@@ -216,12 +217,12 @@ const xt = ct(
216
217
  "div",
217
218
  {
218
219
  role: "option",
219
- "aria-selected": d === t.value,
220
+ "aria-selected": g === t.value,
220
221
  onClick: () => P(t.value),
221
222
  title: t.label,
222
223
  className: s(
223
224
  "cursor-pointer truncate rounded-sm px-3 py-2 font-normal transition-colors",
224
- d === t.value ? e ? "bg-neutral-300 text-white" : "bg-slate-100" : e ? "hover:bg-neutral-300 hover:text-white" : "hover:bg-slate-100"
225
+ g === t.value ? e ? "bg-neutral-300 text-white" : "bg-slate-100" : e ? "hover:bg-neutral-300 hover:text-white" : "hover:bg-slate-100"
225
226
  ),
226
227
  children: t.label
227
228
  },