asheeui 0.6.5 → 0.6.7

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 (64) hide show
  1. package/dist/components/accordion/Accordion.js +10 -10
  2. package/dist/components/autocomplete/Autocomplete.d.ts +8 -0
  3. package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
  4. package/dist/components/autocomplete/Autocomplete.js +120 -118
  5. package/dist/components/autocomplete/autocomplete-config.d.ts +27 -1
  6. package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
  7. package/dist/components/autocomplete/autocomplete-config.js +14 -6
  8. package/dist/components/date-picker/DatePicker.d.ts +20 -0
  9. package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
  10. package/dist/components/date-picker/DatePicker.js +230 -229
  11. package/dist/components/date-picker/date-picker-config.d.ts +16 -0
  12. package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
  13. package/dist/components/date-picker/date-picker-config.js +14 -10
  14. package/dist/components/keyboard/OnScreenKeyboard.d.ts +16 -6
  15. package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
  16. package/dist/components/keyboard/OnScreenKeyboard.js +96 -90
  17. package/dist/components/keyboard/index.js +1 -0
  18. package/dist/components/keyboard/keyboard-config.d.ts +27 -1
  19. package/dist/components/keyboard/keyboard-config.d.ts.map +1 -1
  20. package/dist/components/keyboard/keyboard-config.js +12 -8
  21. package/dist/components/keyboard/keyboard-context.d.ts +4 -7
  22. package/dist/components/keyboard/keyboard-context.d.ts.map +1 -1
  23. package/dist/components/keyboard/keyboard-context.js +61 -58
  24. package/dist/components/keyboard/keyboard-styles.d.ts +13 -0
  25. package/dist/components/keyboard/keyboard-styles.d.ts.map +1 -0
  26. package/dist/components/keyboard/keyboard-styles.js +14 -0
  27. package/dist/components/multi-select/MultiSelect.d.ts +8 -0
  28. package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
  29. package/dist/components/multi-select/MultiSelect.js +186 -184
  30. package/dist/components/multi-select/multi-select-config.d.ts +18 -0
  31. package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
  32. package/dist/components/multi-select/multi-select-config.js +14 -10
  33. package/dist/components/resizable-screen/ResizableScreen.d.ts +23 -11
  34. package/dist/components/resizable-screen/ResizableScreen.d.ts.map +1 -1
  35. package/dist/components/resizable-screen/ResizableScreen.js +69 -60
  36. package/dist/components/select/Select.d.ts +8 -6
  37. package/dist/components/select/Select.d.ts.map +1 -1
  38. package/dist/components/select/Select.js +135 -135
  39. package/dist/components/select/select-config.d.ts +27 -1
  40. package/dist/components/select/select-config.d.ts.map +1 -1
  41. package/dist/components/select/select-config.js +14 -6
  42. package/dist/components/select-menu/SelectMenu.d.ts +23 -1
  43. package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
  44. package/dist/components/select-menu/SelectMenu.js +72 -67
  45. package/dist/components/select-menu/index.d.ts +1 -0
  46. package/dist/components/select-menu/index.d.ts.map +1 -1
  47. package/dist/components/select-menu/index.js +1 -0
  48. package/dist/components/select-menu/select-menu-config.d.ts +1 -1
  49. package/dist/components/select-menu/select-menu-config.js +3 -3
  50. package/dist/components/select-menu/use-select-floating.d.ts +95 -0
  51. package/dist/components/select-menu/use-select-floating.d.ts.map +1 -0
  52. package/dist/components/select-menu/use-select-floating.js +36 -0
  53. package/dist/components/toast/toast-config.d.ts +11 -0
  54. package/dist/components/toast/toast-config.d.ts.map +1 -1
  55. package/dist/components/toast/toast-config.js +4 -2
  56. package/dist/components/toast/toast-context.d.ts +21 -1
  57. package/dist/components/toast/toast-context.d.ts.map +1 -1
  58. package/dist/components/toast/toast-context.js +134 -114
  59. package/dist/config/resolve-config.d.ts.map +1 -1
  60. package/dist/utils/merge-object.d.ts +7 -1
  61. package/dist/utils/merge-object.d.ts.map +1 -1
  62. package/dist/utils/types.d.ts +16 -4
  63. package/dist/utils/types.d.ts.map +1 -1
  64. package/package.json +1 -1
@@ -1,21 +1,23 @@
1
1
  "use client";
2
- import { jsx as o, jsxs as h, Fragment as fe } from "react/jsx-runtime";
3
- import { useFloating as pe, autoUpdate as he, offset as ge, flip as be, shift as xe, size as ye, useClick as ve, useDismiss as we, useRole as Se, useInteractions as De, FloatingFocusManager as Ne } from "@floating-ui/react";
4
- import { forwardRef as Me, useId as Ae, useState as _, useCallback as Z, useMemo as ke } from "react";
2
+ import { jsx as r, jsxs as h, Fragment as xe } from "react/jsx-runtime";
3
+ import { useClick as ve, useDismiss as ye, useRole as Se, useInteractions as we, FloatingFocusManager as De } from "@floating-ui/react";
4
+ import { forwardRef as Ne, useId as Me, useState as R, useCallback as U, useMemo as Ae } from "react";
5
+ import { createPortal as ke } from "react-dom";
5
6
  import { CalendarIcon as Ie } from "../../icons/CalendarIcon.js";
6
7
  import { ChevronLeftIcon as Fe } from "../../icons/ChevronLeftIcon.js";
7
- import { ChevronRightIcon as Ce } from "../../icons/ChevronRightIcon.js";
8
- import { ClearIcon as _e } from "../../icons/ClearIcon.js";
9
- import { ClockIcon as Re } from "../../icons/ClockIcon.js";
10
- import { useAsheeConfig as Ee } from "../../libs/context.js";
11
- import { resolveCascade as j, resolveRadiusKey as $e, resolveClassKey as ee } from "../../utils/resolve-token.js";
12
- import { FieldShell as Le } from "../field/FieldShell.js";
13
- import { FALLBACK_DATE_PICKER_CONFIG as y } from "./date-picker-config.js";
14
- import { CALENDAR_COLOR_CLASSES as K, DATE_PICKER_CELL_SIZE_CLASS as Pe, DATE_PICKER_STATUS_BORDER_CLASS as Te, DATE_PICKER_SIZE_CLASS as Ye } from "./date-picker-styles.js";
15
- import { resolveVariantClass as je } from "../../shared/variant.js";
8
+ import { ChevronRightIcon as _e } from "../../icons/ChevronRightIcon.js";
9
+ import { ClearIcon as Re } from "../../icons/ClearIcon.js";
10
+ import { ClockIcon as Te } from "../../icons/ClockIcon.js";
11
+ import { useAsheeConfig as Ce } from "../../libs/context.js";
12
+ import { resolveCascade as I, resolveRadiusKey as Pe, resolveClassKey as ee } from "../../utils/resolve-token.js";
13
+ import { FieldShell as Ee } from "../field/FieldShell.js";
14
+ import { FALLBACK_DATE_PICKER_CONFIG as p } from "./date-picker-config.js";
15
+ import { CALENDAR_COLOR_CLASSES as O, DATE_PICKER_CELL_SIZE_CLASS as $e, DATE_PICKER_STATUS_BORDER_CLASS as Le, DATE_PICKER_SIZE_CLASS as Ye } from "./date-picker-styles.js";
16
+ import { resolveVariantClass as Ke } from "../../shared/variant.js";
16
17
  import { RADIUS_CLASS as te } from "../../shared/radius.js";
18
+ import { useSelectFloating as je } from "../select-menu/use-select-floating.js";
17
19
  import { cn as d } from "../../utils/cn.js";
18
- const Ke = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Oe = [
20
+ const Oe = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], ze = [
19
21
  "January",
20
22
  "February",
21
23
  "March",
@@ -29,21 +31,21 @@ const Ke = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Oe = [
29
31
  "November",
30
32
  "December"
31
33
  ];
32
- function R(e) {
34
+ function T(e) {
33
35
  return String(e).padStart(2, "0");
34
36
  }
35
- function ze(e, n) {
36
- const l = R(e.getDate()), m = R(e.getMonth() + 1), a = e.getFullYear(), s = R(e.getHours()), u = R(e.getMinutes());
37
+ function He(e, n) {
38
+ const i = T(e.getDate()), m = T(e.getMonth() + 1), l = e.getFullYear(), a = T(e.getHours()), u = T(e.getMinutes());
37
39
  switch (n) {
38
40
  case "date":
39
- return `${l}/${m}/${a}`;
41
+ return `${i}/${m}/${l}`;
40
42
  case "time":
41
- return `${s}:${u}`;
43
+ return `${a}:${u}`;
42
44
  case "datetime":
43
- return `${l}/${m}/${a} ${s}:${u}`;
45
+ return `${i}/${m}/${l} ${a}:${u}`;
44
46
  }
45
47
  }
46
- function He(e) {
48
+ function Ve(e) {
47
49
  switch (e) {
48
50
  case "date":
49
51
  return "Select date...";
@@ -53,167 +55,167 @@ function He(e) {
53
55
  return "Select date & time...";
54
56
  }
55
57
  }
56
- function Ve(e, n) {
57
- const l = new Date(e, n + 1, 0).getDate(), m = new Date(e, n, 1).getDay(), a = [
58
+ function Je(e, n) {
59
+ const i = new Date(e, n + 1, 0).getDate(), m = new Date(e, n, 1).getDay(), l = [
58
60
  ...Array(m).fill(null),
59
- ...Array.from({ length: l }, (s, u) => u + 1)
61
+ ...Array.from({ length: i }, (a, u) => u + 1)
60
62
  ];
61
- for (; a.length % 7 !== 0; ) a.push(null);
62
- return a;
63
+ for (; l.length % 7 !== 0; ) l.push(null);
64
+ return l;
63
65
  }
64
66
  function oe({
65
67
  value: e,
66
68
  max: n,
67
- label: l,
69
+ label: i,
68
70
  onChange: m,
69
- resolvedColor: a,
70
- radiusClass: s
71
+ resolvedColor: l,
72
+ radiusClass: a
71
73
  }) {
72
- const u = () => m(e >= n ? 0 : e + 1), v = () => m(e <= 0 ? n : e - 1), w = K[a] ?? K.primary;
74
+ const u = () => m(e >= n ? 0 : e + 1), y = () => m(e <= 0 ? n : e - 1), S = O[l] ?? O.primary;
73
75
  return /* @__PURE__ */ h("div", { className: "flex flex-col items-center gap-0.5", children: [
74
- /* @__PURE__ */ o("span", { className: "text-[10px] uppercase tracking-widest text-foreground/70 select-none", children: l }),
75
- /* @__PURE__ */ o(
76
+ /* @__PURE__ */ r("span", { className: "text-[10px] uppercase tracking-widest text-foreground/70 select-none", children: i }),
77
+ /* @__PURE__ */ r(
76
78
  "button",
77
79
  {
78
80
  type: "button",
79
81
  className: d(
80
82
  "w-10 h-7 flex items-center justify-center text-xs text-foreground/70 transition-colors",
81
- s,
82
- w.hover
83
+ a,
84
+ S.hover
83
85
  ),
84
86
  onClick: u,
85
- "aria-label": `Increment ${l}`,
87
+ "aria-label": `Increment ${i}`,
86
88
  children: "▲"
87
89
  }
88
90
  ),
89
- /* @__PURE__ */ o(
91
+ /* @__PURE__ */ r(
90
92
  "div",
91
93
  {
92
94
  className: d(
93
95
  "w-10 h-10 flex items-center justify-center text-base font-mono font-bold text-foreground bg-background border border-border select-none",
94
- s
96
+ a
95
97
  ),
96
- children: R(e)
98
+ children: T(e)
97
99
  }
98
100
  ),
99
- /* @__PURE__ */ o(
101
+ /* @__PURE__ */ r(
100
102
  "button",
101
103
  {
102
104
  type: "button",
103
105
  className: d(
104
106
  "w-10 h-7 flex items-center justify-center text-xs text-foreground/70 transition-colors",
105
- s,
106
- w.hover
107
+ a,
108
+ S.hover
107
109
  ),
108
- onClick: v,
109
- "aria-label": `Decrement ${l}`,
110
+ onClick: y,
111
+ "aria-label": `Decrement ${i}`,
110
112
  children: "▼"
111
113
  }
112
114
  )
113
115
  ] });
114
116
  }
115
- function Je({
117
+ function Be({
116
118
  selected: e,
117
119
  mode: n,
118
- isClearable: l,
120
+ isClearable: i,
119
121
  resolvedSizeKey: m,
120
- resolvedColor: a,
121
- radiusClass: s,
122
+ resolvedColor: l,
123
+ radiusClass: a,
122
124
  onSelect: u,
123
- onClose: v,
124
- disableFuture: w = !1
125
+ onClose: y,
126
+ disableFuture: S = !1
125
127
  }) {
126
- const c = /* @__PURE__ */ new Date(), [g, E] = _(
128
+ const c = /* @__PURE__ */ new Date(), [g, C] = R(
127
129
  (e == null ? void 0 : e.getFullYear()) ?? c.getFullYear()
128
- ), [f, D] = _(
130
+ ), [f, N] = R(
129
131
  (e == null ? void 0 : e.getMonth()) ?? c.getMonth()
130
- ), [b, $] = _((e == null ? void 0 : e.getHours()) ?? 0), [I, O] = _((e == null ? void 0 : e.getMinutes()) ?? 0), x = K[a] ?? K.primary;
131
- function L(t, i) {
132
- const k = e ?? /* @__PURE__ */ new Date();
132
+ ), [b, P] = R((e == null ? void 0 : e.getHours()) ?? 0), [F, z] = R((e == null ? void 0 : e.getMinutes()) ?? 0), x = O[l] ?? O.primary;
133
+ function E(t, s) {
134
+ const _ = e ?? /* @__PURE__ */ new Date();
133
135
  u(
134
- new Date(k.getFullYear(), k.getMonth(), k.getDate(), t, i, 0, 0)
136
+ new Date(_.getFullYear(), _.getMonth(), _.getDate(), t, s, 0, 0)
135
137
  );
136
138
  }
137
- function z(t) {
138
- $(t), L(t, I);
139
+ function H(t) {
140
+ P(t), E(t, F);
139
141
  }
140
- function N(t) {
141
- O(t), L(b, t);
142
+ function V(t) {
143
+ z(t), E(b, t);
142
144
  }
143
- function M(t) {
144
- u(new Date(g, f, t, b, I, 0, 0)), n === "date" && v();
145
+ function J(t) {
146
+ u(new Date(g, f, t, b, F, 0, 0)), n === "date" && y();
145
147
  }
146
- function r() {
147
- f === 0 ? (D(11), E((t) => t - 1)) : D((t) => t - 1);
148
+ function M() {
149
+ f === 0 ? (N(11), C((t) => t - 1)) : N((t) => t - 1);
148
150
  }
149
- function H() {
150
- f === 11 ? (D(0), E((t) => t + 1)) : D((t) => t + 1);
151
+ function A() {
152
+ f === 11 ? (N(0), C((t) => t + 1)) : N((t) => t + 1);
151
153
  }
152
- function V(t) {
154
+ function o(t) {
153
155
  return !!e && e.getFullYear() === g && e.getMonth() === f && e.getDate() === t;
154
156
  }
155
- function F(t) {
157
+ function B(t) {
156
158
  return c.getFullYear() === g && c.getMonth() === f && c.getDate() === t;
157
159
  }
158
- const P = new Date(
160
+ const G = new Date(
159
161
  c.getFullYear(),
160
162
  c.getMonth(),
161
163
  c.getDate()
162
164
  );
163
- function C(t) {
164
- return w ? new Date(g, f, t) > P : !1;
165
+ function w(t) {
166
+ return S ? new Date(g, f, t) > G : !1;
165
167
  }
166
- const J = !w || g < c.getFullYear() || g === c.getFullYear() && f < c.getMonth(), A = n === "date" || n === "datetime", U = n === "time" || n === "datetime", B = n !== "date" || l && !!e, T = Ve(g, f), G = ke(() => T.map((t, i) => ({
167
- key: t !== null ? `day-${t}` : `empty-slot-${i}`,
168
+ const $ = !S || g < c.getFullYear() || g === c.getFullYear() && f < c.getMonth(), L = n === "date" || n === "datetime", Y = n === "time" || n === "datetime", K = n !== "date" || i && !!e, k = Je(g, f), v = Ae(() => k.map((t, s) => ({
169
+ key: t !== null ? `day-${t}` : `empty-slot-${s}`,
168
170
  day: t
169
- })), [T]);
171
+ })), [k]);
170
172
  return /* @__PURE__ */ h(
171
173
  "div",
172
174
  {
173
175
  className: d(
174
176
  "bg-background border border-border shadow-xl select-none p-3 min-w-70",
175
- s
177
+ a
176
178
  ),
177
179
  children: [
178
- A && /* @__PURE__ */ h(fe, { children: [
180
+ L && /* @__PURE__ */ h(xe, { children: [
179
181
  /* @__PURE__ */ h("div", { className: "flex items-center justify-between pb-2 mb-2 border-b border-border", children: [
180
- /* @__PURE__ */ o(
182
+ /* @__PURE__ */ r(
181
183
  "button",
182
184
  {
183
185
  type: "button",
184
- onClick: r,
186
+ onClick: M,
185
187
  "aria-label": "Previous month",
186
188
  className: d(
187
189
  "p-1 text-foreground transition-colors",
188
- s,
190
+ a,
189
191
  x.hover
190
192
  ),
191
- children: /* @__PURE__ */ o(Fe, {})
193
+ children: /* @__PURE__ */ r(Fe, {})
192
194
  }
193
195
  ),
194
196
  /* @__PURE__ */ h("span", { className: "font-medium text-sm text-foreground", children: [
195
- Oe[f],
197
+ ze[f],
196
198
  " ",
197
199
  g
198
200
  ] }),
199
- /* @__PURE__ */ o(
201
+ /* @__PURE__ */ r(
200
202
  "button",
201
203
  {
202
204
  type: "button",
203
- onClick: H,
204
- disabled: !J,
205
+ onClick: A,
206
+ disabled: !$,
205
207
  "aria-label": "Next month",
206
208
  className: d(
207
209
  "p-1 text-foreground transition-colors disabled:opacity-30 disabled:cursor-not-allowed",
208
- s,
210
+ a,
209
211
  x.hover
210
212
  ),
211
- children: /* @__PURE__ */ o(Ce, {})
213
+ children: /* @__PURE__ */ r(_e, {})
212
214
  }
213
215
  )
214
216
  ] }),
215
217
  /* @__PURE__ */ h("div", { className: "grid grid-cols-7 gap-1 text-center", children: [
216
- Ke.map((t) => /* @__PURE__ */ o(
218
+ Oe.map((t) => /* @__PURE__ */ r(
217
219
  "div",
218
220
  {
219
221
  className: "text-xs font-semibold text-foreground/70 py-1",
@@ -221,71 +223,71 @@ function Je({
221
223
  },
222
224
  t
223
225
  )),
224
- G.map(
225
- ({ key: t, day: i }) => i === null ? /* @__PURE__ */ o("div", {}, t) : /* @__PURE__ */ o(
226
+ v.map(
227
+ ({ key: t, day: s }) => s === null ? /* @__PURE__ */ r("div", {}, t) : /* @__PURE__ */ r(
226
228
  "button",
227
229
  {
228
230
  type: "button",
229
- onClick: () => M(i),
230
- disabled: C(i),
231
+ onClick: () => J(s),
232
+ disabled: w(s),
231
233
  className: d(
232
234
  "w-full flex items-center justify-center font-medium transition-colors",
233
- Pe[m],
234
- s,
235
- C(i) ? "opacity-30 cursor-not-allowed text-foreground/70" : V(i) ? d(x.bg, "font-semibold") : F(i) ? d("border", x.border, x.text) : d("text-foreground", x.hover)
235
+ $e[m],
236
+ a,
237
+ w(s) ? "opacity-30 cursor-not-allowed text-foreground/70" : o(s) ? d(x.bg, "font-semibold") : B(s) ? d("border", x.border, x.text) : d("text-foreground", x.hover)
236
238
  ),
237
- children: i
239
+ children: s
238
240
  },
239
- i
241
+ s
240
242
  )
241
243
  )
242
244
  ] })
243
245
  ] }),
244
- U && /* @__PURE__ */ h("div", { className: "flex items-center justify-center gap-4 py-3 border-t border-border mt-2", children: [
245
- /* @__PURE__ */ o(
246
+ Y && /* @__PURE__ */ h("div", { className: "flex items-center justify-center gap-4 py-3 border-t border-border mt-2", children: [
247
+ /* @__PURE__ */ r(
246
248
  oe,
247
249
  {
248
250
  value: b,
249
251
  max: 23,
250
252
  label: "HH",
251
- onChange: z,
252
- resolvedColor: a,
253
- radiusClass: s
253
+ onChange: H,
254
+ resolvedColor: l,
255
+ radiusClass: a
254
256
  }
255
257
  ),
256
- /* @__PURE__ */ o("span", { className: "text-xl font-bold text-foreground/70 select-none pt-3", children: ":" }),
257
- /* @__PURE__ */ o(
258
+ /* @__PURE__ */ r("span", { className: "text-xl font-bold text-foreground/70 select-none pt-3", children: ":" }),
259
+ /* @__PURE__ */ r(
258
260
  oe,
259
261
  {
260
- value: I,
262
+ value: F,
261
263
  max: 59,
262
264
  label: "MM",
263
- onChange: N,
264
- resolvedColor: a,
265
- radiusClass: s
265
+ onChange: V,
266
+ resolvedColor: l,
267
+ radiusClass: a
266
268
  }
267
269
  )
268
270
  ] }),
269
- B && /* @__PURE__ */ h("div", { className: "flex items-center justify-between border-t border-border pt-2 mt-2", children: [
270
- l && e && /* @__PURE__ */ o(
271
+ K && /* @__PURE__ */ h("div", { className: "flex items-center justify-between border-t border-border pt-2 mt-2", children: [
272
+ i && e && /* @__PURE__ */ r(
271
273
  "button",
272
274
  {
273
275
  type: "button",
274
276
  onClick: () => {
275
- u(null), v();
277
+ u(null), y();
276
278
  },
277
279
  className: "text-xs text-foreground/70 hover:text-danger transition-colors",
278
280
  children: "Clear"
279
281
  }
280
282
  ),
281
- n !== "date" && /* @__PURE__ */ o(
283
+ n !== "date" && /* @__PURE__ */ r(
282
284
  "button",
283
285
  {
284
286
  type: "button",
285
- onClick: v,
287
+ onClick: y,
286
288
  className: d(
287
289
  "ml-auto text-xs font-medium px-3 py-1.5 hover:opacity-90 transition-opacity",
288
- s,
290
+ a,
289
291
  x.bg
290
292
  ),
291
293
  children: "Done"
@@ -296,186 +298,185 @@ function Je({
296
298
  }
297
299
  );
298
300
  }
299
- const Ue = Me(
301
+ const Ge = Ne(
300
302
  ({
301
303
  selected: e,
302
304
  onChange: n,
303
- mode: l,
305
+ mode: i,
304
306
  size: m,
305
- radius: a,
306
- variant: s,
307
+ radius: l,
308
+ variant: a,
307
309
  color: u,
308
- status: v,
309
- label: w,
310
+ status: y,
311
+ label: S,
310
312
  labelAlign: c,
311
313
  description: g,
312
- message: E,
314
+ message: C,
313
315
  required: f,
314
- isLoading: D,
316
+ isLoading: N,
315
317
  disabled: b,
316
- isClearable: $ = !1,
317
- disableFuture: I = !1,
318
- placeholder: O,
318
+ isClearable: P = !1,
319
+ disableFuture: F = !1,
320
+ placeholder: z,
319
321
  className: x,
320
- id: L,
321
- style: z
322
- }, N) => {
322
+ id: E,
323
+ style: H,
324
+ portal: V,
325
+ portalTarget: J
326
+ }, M) => {
323
327
  var X;
324
- const M = Ee(), r = (X = M.components) == null ? void 0 : X.datePicker, H = Ae(), V = L ?? H, [F, P] = _(!1), { refs: C, floatingStyles: J, context: A } = pe({
325
- open: F,
326
- onOpenChange: (p) => !b && P(p),
327
- placement: "bottom-start",
328
- whileElementsMounted: he,
329
- middleware: [
330
- ge(4),
331
- be(),
332
- xe({ padding: 8 }),
333
- ye({
334
- apply({ availableHeight: p, elements: me }) {
335
- Object.assign(me.floating.style, {
336
- maxHeight: `${p}px`
337
- });
338
- }
339
- })
340
- ]
341
- }), U = ve(A, { enabled: !b }), B = we(A), T = Se(A, { role: "dialog" }), { getReferenceProps: G, getFloatingProps: t } = De([
342
- U,
343
- B,
344
- T
345
- ]), i = j(
328
+ const A = Ce(), o = (X = A.components) == null ? void 0 : X.datePicker, B = Me(), G = E ?? B, [w, $] = R(!1), L = I(
346
329
  m,
347
- r == null ? void 0 : r.size,
330
+ o == null ? void 0 : o.size,
348
331
  void 0,
349
- y.size
350
- ), k = j(
351
- s,
352
- r == null ? void 0 : r.variant,
353
- M.defaultVariant,
354
- y.variant
355
- ), q = j(
332
+ p.size
333
+ ), Y = I(
334
+ a,
335
+ o == null ? void 0 : o.variant,
336
+ A.defaultVariant,
337
+ p.variant
338
+ ), K = I(
356
339
  u,
357
- r == null ? void 0 : r.color,
358
- M.defaultColor,
359
- y.color
360
- ), W = $e(
361
- typeof a == "string" ? a : void 0,
362
- typeof (r == null ? void 0 : r.radius) == "string" ? r.radius : void 0,
363
- M.defaultRadius,
364
- y.radius
365
- ), S = v ?? y.status, ne = j(
340
+ o == null ? void 0 : o.color,
341
+ A.defaultColor,
342
+ p.color
343
+ ), k = Pe(
344
+ typeof l == "string" ? l : void 0,
345
+ typeof (o == null ? void 0 : o.radius) == "string" ? o.radius : void 0,
346
+ A.defaultRadius,
347
+ p.radius
348
+ ), v = y ?? p.status, t = I(
366
349
  c,
367
- r == null ? void 0 : r.labelAlign,
350
+ o == null ? void 0 : o.labelAlign,
368
351
  void 0,
369
- y.labelAlign
370
- ), Y = l ?? (r == null ? void 0 : r.mode) ?? y.mode, re = je(
352
+ p.labelAlign
353
+ ), s = i ?? (o == null ? void 0 : o.mode) ?? p.mode, _ = I(
354
+ V,
355
+ o == null ? void 0 : o.portal,
356
+ void 0,
357
+ p.portal
358
+ ), re = I(
359
+ J,
360
+ o == null ? void 0 : o.portalTarget,
361
+ void 0,
362
+ p.portalTarget
363
+ ), ne = Ke(
364
+ Y,
365
+ v === "error" ? "danger" : v === "success" ? "success" : v === "warning" ? "warning" : K
366
+ ), ae = v !== "default" ? Le[v] : "", se = Y === "underlined" ? "rounded-none" : ee(
371
367
  k,
372
- S === "error" ? "danger" : S === "success" ? "success" : S === "warning" ? "warning" : q
373
- ), se = S !== "default" ? Te[S] : "", ae = k === "underlined" ? "rounded-none" : ee(
374
- W,
375
368
  te,
376
- y.radius
377
- ), ie = ee(
378
- W === "full" ? "xl" : W,
369
+ p.radius
370
+ ), le = ee(
371
+ k === "full" ? "xl" : k,
379
372
  te,
380
- y.radius
381
- ), le = Z(
382
- (p) => n == null ? void 0 : n(p),
373
+ p.radius
374
+ ), { refs: W, floatingStyles: ie, context: j } = je({
375
+ isOpen: w,
376
+ onOpenChange: $,
377
+ disabled: b
378
+ }), ce = ve(j, { enabled: !b }), ue = ye(j), de = Se(j, { role: "dialog" }), { getReferenceProps: me, getFloatingProps: fe } = we([
379
+ ce,
380
+ ue,
381
+ de
382
+ ]), pe = U(
383
+ (D) => n == null ? void 0 : n(D),
383
384
  [n]
384
- ), ce = Z(() => P(!1), []), ue = Z(
385
- (p) => {
386
- p.stopPropagation(), n == null || n(null);
385
+ ), he = U(() => $(!1), []), ge = U(
386
+ (D) => {
387
+ D.stopPropagation(), n == null || n(null);
387
388
  },
388
389
  [n]
389
- ), de = O ?? He(Y), Q = e ? ze(e, Y) : null;
390
- return /* @__PURE__ */ o(
391
- Le,
390
+ ), be = z ?? Ve(s), Z = e ? He(e, s) : null, q = w ? /* @__PURE__ */ r(De, { context: j, modal: !1, children: /* @__PURE__ */ r(
391
+ "div",
392
+ {
393
+ ref: W.setFloating,
394
+ style: { ...ie, zIndex: 999999 },
395
+ className: "outline-none",
396
+ ...fe(),
397
+ children: /* @__PURE__ */ r("div", { className: "animate-in fade-in-0 zoom-in-95 duration-150 ease-out", children: /* @__PURE__ */ r(
398
+ Be,
399
+ {
400
+ selected: e,
401
+ mode: s,
402
+ isClearable: P,
403
+ resolvedSizeKey: L,
404
+ onSelect: pe,
405
+ onClose: he,
406
+ disableFuture: F,
407
+ resolvedColor: K,
408
+ radiusClass: le
409
+ }
410
+ ) })
411
+ }
412
+ ) }) : null, Q = re ?? (typeof document < "u" ? document.body : null);
413
+ return /* @__PURE__ */ r(
414
+ Ee,
392
415
  {
393
- id: V,
394
- label: w,
395
- labelAlign: ne,
416
+ id: G,
417
+ label: S,
418
+ labelAlign: t,
396
419
  description: g,
397
- message: E,
398
- status: S,
420
+ message: C,
421
+ status: v,
399
422
  required: f,
400
- isLoading: D,
423
+ isLoading: N,
401
424
  children: /* @__PURE__ */ h("div", { className: "w-full relative inline-block", children: [
402
425
  /* @__PURE__ */ h(
403
426
  "div",
404
427
  {
405
- ref: (p) => {
406
- C.setReference(p), typeof N == "function" ? N(p) : N && (N.current = p);
428
+ ref: (D) => {
429
+ W.setReference(D), typeof M == "function" ? M(D) : M && (M.current = D);
407
430
  },
408
431
  role: "combobox",
409
432
  tabIndex: b ? -1 : 0,
410
- "aria-expanded": F,
433
+ "aria-expanded": w,
411
434
  "aria-haspopup": "dialog",
412
- "aria-invalid": S === "error",
435
+ "aria-invalid": v === "error",
413
436
  "aria-disabled": b,
414
437
  className: d(
415
438
  "w-full flex items-center justify-between cursor-pointer text-foreground outline-none transition-colors select-none shrink-0",
416
439
  "focus-visible:ring-2 focus-visible:ring-offset-2",
417
440
  b && "pointer-events-none opacity-50 cursor-not-allowed",
418
- Ye[i],
419
- re,
420
- se,
441
+ Ye[L],
442
+ ne,
421
443
  ae,
444
+ se,
422
445
  x
423
446
  ),
424
- style: z,
425
- ...G(),
447
+ style: H,
448
+ ...me(),
426
449
  children: [
427
- /* @__PURE__ */ o(
450
+ /* @__PURE__ */ r(
428
451
  "span",
429
452
  {
430
- className: Q ? "text-foreground" : "text-foreground/70",
431
- children: Q ?? de
453
+ className: Z ? "text-foreground" : "text-foreground/70",
454
+ children: Z ?? be
432
455
  }
433
456
  ),
434
457
  /* @__PURE__ */ h("div", { className: "flex items-center gap-1.5 ml-2 shrink-0", children: [
435
- $ && e && !b && /* @__PURE__ */ o(
458
+ P && e && !b && /* @__PURE__ */ r(
436
459
  "button",
437
460
  {
438
461
  type: "button",
439
- onClick: ue,
462
+ onClick: ge,
440
463
  "aria-label": "Clear selection",
441
464
  className: "p-0.5 rounded text-foreground/70 hover:text-foreground transition-colors",
442
- children: /* @__PURE__ */ o(_e, { className: "size-3.5" })
465
+ children: /* @__PURE__ */ r(Re, { className: "size-3.5" })
443
466
  }
444
467
  ),
445
- /* @__PURE__ */ o("span", { className: "text-foreground/70 pointer-events-none", children: Y === "time" ? /* @__PURE__ */ o(Re, {}) : /* @__PURE__ */ o(Ie, {}) })
468
+ /* @__PURE__ */ r("span", { className: "text-foreground/70 pointer-events-none", children: s === "time" ? /* @__PURE__ */ r(Te, {}) : /* @__PURE__ */ r(Ie, {}) })
446
469
  ] })
447
470
  ]
448
471
  }
449
472
  ),
450
- F && /* @__PURE__ */ o(Ne, { context: A, modal: !1, children: /* @__PURE__ */ o(
451
- "div",
452
- {
453
- ref: C.setFloating,
454
- style: { ...J, zIndex: 99999 },
455
- className: "outline-none",
456
- ...t(),
457
- children: /* @__PURE__ */ o("div", { className: "animate-in fade-in-0 zoom-in-95 duration-150 ease-out", children: /* @__PURE__ */ o(
458
- Je,
459
- {
460
- selected: e,
461
- mode: Y,
462
- isClearable: $,
463
- resolvedSizeKey: i,
464
- onSelect: le,
465
- onClose: ce,
466
- disableFuture: I,
467
- resolvedColor: q,
468
- radiusClass: ie
469
- }
470
- ) })
471
- }
472
- ) })
473
+ w && (_ && Q ? ke(q, Q) : q)
473
474
  ] })
474
475
  }
475
476
  );
476
477
  }
477
478
  );
478
- Ue.displayName = "DatePicker";
479
+ Ge.displayName = "DatePicker";
479
480
  export {
480
- Ue as DatePicker
481
+ Ge as DatePicker
481
482
  };