laif-ds 0.2.53 → 0.2.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,22 @@
1
1
  "use client";
2
- import { jsxs as u, jsx as r } from "react/jsx-runtime";
2
+ import { jsxs as p, jsx as r } from "react/jsx-runtime";
3
3
  import { useDebounce as de } from "../../hooks/use-debounce.js";
4
4
  import { cva as ie } from "../../node_modules/class-variance-authority/dist/index.js";
5
5
  import * as R from "react";
6
- import { useState as p, useEffect as b, useCallback as j } from "react";
7
- import { designTokens as x } from "../../lib/design-tokens.js";
6
+ import { useState as w, useEffect as b, useCallback as j } from "react";
7
+ import { designTokens as u } from "../../lib/design-tokens.js";
8
8
  import { cn as M } from "../../lib/utils.js";
9
9
  import { Checkbox as fe } from "./checkbox.js";
10
10
  import { Command as me, CommandInput as ue, CommandList as he, CommandEmpty as ge, CommandGroup as O, CommandItem as V } from "./command.js";
11
11
  import { Icon as _ } from "./icon.js";
12
12
  import { Label as pe } from "./label.js";
13
- import { Popover as xe, PopoverTrigger as we, PopoverContent as ye } from "./popover.js";
13
+ import { Popover as we, PopoverTrigger as xe, PopoverContent as ye } from "./popover.js";
14
14
  import Ne from "../../node_modules/lucide-react/dist/esm/icons/loader-circle.js";
15
- import be from "../../node_modules/lucide-react/dist/esm/icons/check.js";
16
- const Ce = ie(
15
+ const be = ie(
17
16
  M(
18
- x.input.base,
19
- x.radius.default,
20
- x.interaction.disabled,
17
+ u.input.base,
18
+ u.radius.default,
19
+ u.interaction.disabled,
21
20
  "flex items-center justify-between whitespace-nowrap transition-all [&>span]:line-clamp-1",
22
21
  "data-[placeholder]:text-d-muted-foreground",
23
22
  "focus:outline-none"
@@ -25,9 +24,9 @@ const Ce = ie(
25
24
  {
26
25
  variants: {
27
26
  size: {
28
- default: x.sizes.default,
29
- sm: x.sizes.sm,
30
- lg: x.sizes.lg
27
+ default: u.sizes.default,
28
+ sm: u.sizes.sm,
29
+ lg: u.sizes.lg
31
30
  }
32
31
  },
33
32
  defaultVariants: {
@@ -35,10 +34,10 @@ const Ce = ie(
35
34
  }
36
35
  }
37
36
  );
38
- function Be({
37
+ function Fe({
39
38
  fetcher: i,
40
39
  initialOptions: t,
41
- debounce: w = 300,
40
+ debounce: x = 300,
42
41
  renderOptionItem: C,
43
42
  resolveOptionValue: a,
44
43
  renderSelectedValue: s,
@@ -48,14 +47,14 @@ function Be({
48
47
  value: n,
49
48
  onChange: g,
50
49
  disabled: A = !1,
51
- className: D,
52
- wrpClassName: v,
50
+ className: v,
51
+ wrpClassName: D,
53
52
  noResultsMessage: E,
54
53
  clearable: S = !0,
55
54
  multiple: l = !1,
56
55
  size: ee
57
56
  }) {
58
- const [m, L] = p(!1), P = R.useRef(null), F = R.useRef(null), re = R.useRef(null), [ne, I] = p({ loading: !1, error: null }), [X, te] = p(""), W = de(X, w), [B, q] = p(/* @__PURE__ */ new Map()), [$, G] = p([]), [H, se] = p(0), [J, Q] = p(() => t?.length ? new Map(
57
+ const [m, I] = w(!1), L = R.useRef(null), P = R.useRef(null), re = R.useRef(null), [ne, F] = w({ loading: !1, error: null }), [X, te] = w(""), W = de(X, x), [B, q] = w(/* @__PURE__ */ new Map()), [$, G] = w([]), [H, se] = w(0), [J, Q] = w(() => t?.length ? new Map(
59
58
  t.map((e) => [a(e), e])
60
59
  ) : /* @__PURE__ */ new Map());
61
60
  b(() => {
@@ -67,7 +66,7 @@ function Be({
67
66
  return t.forEach((c) => o.set(a(c), c)), o;
68
67
  }));
69
68
  }, [t, a]);
70
- const [k, Y] = p([]), z = j(
69
+ const [k, Y] = w([]), z = j(
71
70
  (e) => {
72
71
  if (!e) {
73
72
  Y([]);
@@ -103,33 +102,33 @@ function Be({
103
102
  }
104
103
  (async () => {
105
104
  try {
106
- I({ loading: !0, error: null });
105
+ F({ loading: !0, error: null });
107
106
  const c = await i(W);
108
107
  q((d) => new Map(d).set(e, c)), G(c), Q((d) => {
109
108
  const y = new Map(d);
110
109
  return c.forEach((U) => y.set(a(U), U)), y;
111
110
  });
112
111
  } catch (c) {
113
- I({
112
+ F({
114
113
  loading: !1,
115
114
  error: c instanceof Error ? c.message : "Failed to fetch options"
116
115
  });
117
116
  } finally {
118
- I((c) => ({ ...c, loading: !1 }));
117
+ F((c) => ({ ...c, loading: !1 }));
119
118
  }
120
119
  })();
121
120
  }, [m, W, B, i, a]), b(() => {
122
121
  m && z(n);
123
122
  }, [m, z, n]), b(() => {
124
- m && P.current && P.current.focus();
123
+ m && L.current && L.current.focus();
125
124
  }, [m]), b(() => {
126
- if (!m || !F.current) return;
127
- const e = F.current.getBoundingClientRect();
125
+ if (!m || !P.current) return;
126
+ const e = P.current.getBoundingClientRect();
128
127
  se(e.width);
129
128
  }, [m]);
130
129
  const ce = j(
131
130
  (e) => {
132
- g?.(S && e === n ? "" : e), L(!1);
131
+ g?.(S && e === n ? "" : e), I(!1);
133
132
  },
134
133
  [n, g, S]
135
134
  ), ae = j(
@@ -142,34 +141,34 @@ function Be({
142
141
  [n, g, l]
143
142
  ), oe = j(
144
143
  (e) => {
145
- e.stopPropagation(), e.preventDefault(), g?.(l ? [] : ""), L(!1);
144
+ e.stopPropagation(), e.preventDefault(), g?.(l ? [] : ""), I(!1);
146
145
  },
147
146
  [g]
148
147
  ), Z = R.useId();
149
- return /* @__PURE__ */ u("div", { className: M("flex flex-col gap-1.5", v), children: [
148
+ return /* @__PURE__ */ p("div", { className: M("flex flex-col gap-1.5", D), children: [
150
149
  N && /* @__PURE__ */ r(pe, { htmlFor: Z, children: N }),
151
- /* @__PURE__ */ u(xe, { open: m, onOpenChange: L, children: [
152
- /* @__PURE__ */ r(we, { asChild: !0, children: /* @__PURE__ */ r(
150
+ /* @__PURE__ */ p(we, { open: m, onOpenChange: I, children: [
151
+ /* @__PURE__ */ r(xe, { asChild: !0, children: /* @__PURE__ */ r(
153
152
  "button",
154
153
  {
155
154
  id: Z,
156
- ref: F,
155
+ ref: P,
157
156
  type: "button",
158
157
  disabled: A,
159
158
  className: M(
160
- Ce({ size: ee }),
159
+ be({ size: ee }),
161
160
  "!border-d-border/50 border !shadow-none",
162
161
  A && "cursor-not-allowed opacity-50",
163
162
  "font-normal",
164
163
  "w-full",
165
164
  "w-full",
166
- x.focusRing,
167
- m && x.activeRing,
168
- D
165
+ u.focusRing,
166
+ m && u.activeRing,
167
+ v
169
168
  ),
170
- children: /* @__PURE__ */ u("div", { className: "flex w-full flex-1 items-center justify-between overflow-hidden", children: [
169
+ children: /* @__PURE__ */ p("div", { className: "flex w-full flex-1 items-center justify-between overflow-hidden", children: [
171
170
  l ? Array.isArray(n) && n.length > 0 ? /* @__PURE__ */ r("div", { className: "min-w-0 flex-1 truncate text-left", children: n.length === 1 ? k[0] && s(k[0]) : `${n.length} elementi selezionati` }) : /* @__PURE__ */ r("span", { className: "text-d-muted-foreground truncate text-left", children: f }) : K ? /* @__PURE__ */ r("div", { className: "min-w-0 flex-1 truncate text-left", children: s(K) }) : /* @__PURE__ */ r("span", { className: "text-d-muted-foreground truncate text-left", children: f }),
172
- /* @__PURE__ */ u("div", { className: "flex flex-shrink-0 items-center justify-end gap-1", children: [
171
+ /* @__PURE__ */ p("div", { className: "flex flex-shrink-0 items-center justify-end gap-1", children: [
173
172
  S && (l && Array.isArray(n) && n.length > 0 || !l && K) && /* @__PURE__ */ r(
174
173
  "div",
175
174
  {
@@ -210,9 +209,9 @@ function Be({
210
209
  onWheel: (e) => e.stopPropagation(),
211
210
  avoidCollisions: !1,
212
211
  children: /* @__PURE__ */ r(
213
- Se,
212
+ Ae,
214
213
  {
215
- inputRef: P,
214
+ inputRef: L,
216
215
  commandListRef: re,
217
216
  placeholder: f,
218
217
  searchTerm: X,
@@ -235,10 +234,10 @@ function Be({
235
234
  ] })
236
235
  ] });
237
236
  }
238
- function Ae({
237
+ function Ce({
239
238
  option: i,
240
239
  multiple: t,
241
- value: w,
240
+ value: x,
242
241
  resolveOptionValue: C,
243
242
  renderSelectedValue: a,
244
243
  renderOptionItem: s,
@@ -247,35 +246,28 @@ function Ae({
247
246
  }) {
248
247
  const f = C(i);
249
248
  let n = !1;
250
- return t ? n = Array.isArray(w) && w.includes(f) : n = w === f, /* @__PURE__ */ r(
249
+ return t ? n = Array.isArray(x) && x.includes(f) : n = x === f, /* @__PURE__ */ r(
251
250
  V,
252
251
  {
253
252
  value: f,
254
253
  onSelect: t ? N : h,
255
- className: "cursor-pointer",
256
- children: /* @__PURE__ */ u("div", { className: "flex w-full items-center justify-between overflow-hidden", children: [
257
- /* @__PURE__ */ u("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
258
- t && /* @__PURE__ */ r(fe, { checked: n }),
259
- s ? /* @__PURE__ */ r("div", { className: "truncate", children: s(i) }) : /* @__PURE__ */ r("span", { className: "truncate", children: a(i) })
260
- ] }),
261
- /* @__PURE__ */ r(
262
- be,
263
- {
264
- className: M(
265
- "ml-2 h-4 w-4 flex-shrink-0",
266
- n ? "opacity-100" : "opacity-0"
267
- )
268
- }
269
- )
270
- ] })
254
+ className: M(
255
+ "cursor-pointer",
256
+ u.dropdownItem.hover,
257
+ !t && n && u.dropdownItem.selected
258
+ ),
259
+ children: /* @__PURE__ */ r("div", { className: "flex w-full items-center justify-between overflow-hidden", children: /* @__PURE__ */ p("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
260
+ t && /* @__PURE__ */ r(fe, { checked: n }),
261
+ s ? /* @__PURE__ */ r("div", { className: "truncate", children: s(i) }) : /* @__PURE__ */ r("span", { className: "truncate", children: a(i) })
262
+ ] }) })
271
263
  },
272
264
  f
273
265
  );
274
266
  }
275
- function Se({
267
+ function Ae({
276
268
  inputRef: i,
277
269
  commandListRef: t,
278
- placeholder: w,
270
+ placeholder: x,
279
271
  searchTerm: C,
280
272
  onSearchTermChange: a,
281
273
  fetchState: s,
@@ -285,36 +277,36 @@ function Se({
285
277
  multiple: n,
286
278
  value: g,
287
279
  resolveOptionValue: A,
288
- renderSelectedValue: D,
289
- renderOptionItem: v,
280
+ renderSelectedValue: v,
281
+ renderOptionItem: D,
290
282
  onSelect: E,
291
283
  onSelectMultiple: S
292
284
  }) {
293
- return /* @__PURE__ */ u(me, { shouldFilter: !1, className: "w-full border-none shadow-sm", children: [
285
+ return /* @__PURE__ */ p(me, { shouldFilter: !1, className: "w-full border-none shadow-sm", children: [
294
286
  /* @__PURE__ */ r(
295
287
  ue,
296
288
  {
297
289
  ref: i,
298
- placeholder: w,
290
+ placeholder: x,
299
291
  className: "placeholder:text-d-muted-foreground",
300
292
  value: C,
301
293
  onValueChange: a
302
294
  }
303
295
  ),
304
296
  s.loading && h.length > 0 && /* @__PURE__ */ r("div", { className: "flex items-center justify-center p-2", children: /* @__PURE__ */ r(Ne, { className: "h-4 w-4 animate-spin" }) }),
305
- /* @__PURE__ */ u(he, { ref: t, children: [
297
+ /* @__PURE__ */ p(he, { ref: t, children: [
306
298
  s.error && /* @__PURE__ */ r("div", { className: "text-d-destructive p-3 text-center", children: s.error }),
307
- s.loading && h.length === 0 && /* @__PURE__ */ r(Re, {}),
299
+ s.loading && h.length === 0 && /* @__PURE__ */ r(Se, {}),
308
300
  !s.loading && !s.error && h.length === 0 && (N || /* @__PURE__ */ r(ge, { children: f || "No results found." })),
309
301
  !s.loading && !s.error && h.length > 0 && /* @__PURE__ */ r(O, { children: h.map((l) => /* @__PURE__ */ r(
310
- Ae,
302
+ Ce,
311
303
  {
312
304
  option: l,
313
305
  multiple: n,
314
306
  value: g,
315
307
  resolveOptionValue: A,
316
- renderSelectedValue: D,
317
- renderOptionItem: v,
308
+ renderSelectedValue: v,
309
+ renderOptionItem: D,
318
310
  onSelect: E,
319
311
  onSelectMultiple: S
320
312
  },
@@ -323,16 +315,16 @@ function Se({
323
315
  ] })
324
316
  ] });
325
317
  }
326
- function Re() {
327
- return /* @__PURE__ */ r(O, { children: [1, 2, 3].map((i) => /* @__PURE__ */ r(V, { disabled: !0, children: /* @__PURE__ */ u("div", { className: "flex w-full items-center gap-2", children: [
318
+ function Se() {
319
+ return /* @__PURE__ */ r(O, { children: [1, 2, 3].map((i) => /* @__PURE__ */ r(V, { disabled: !0, children: /* @__PURE__ */ p("div", { className: "flex w-full items-center gap-2", children: [
328
320
  /* @__PURE__ */ r("div", { className: "bg-d-secondary h-6 w-6 animate-pulse rounded-full" }),
329
- /* @__PURE__ */ u("div", { className: "flex flex-1 flex-col gap-1", children: [
321
+ /* @__PURE__ */ p("div", { className: "flex flex-1 flex-col gap-1", children: [
330
322
  /* @__PURE__ */ r("div", { className: "bg-d-secondary h-4 w-24 animate-pulse rounded" }),
331
323
  /* @__PURE__ */ r("div", { className: "bg-d-secondary h-3 w-16 animate-pulse rounded" })
332
324
  ] })
333
325
  ] }) }, i)) });
334
326
  }
335
327
  export {
336
- Be as AsyncSelect,
337
- Ce as selectTriggerVariants
328
+ Fe as AsyncSelect,
329
+ be as selectTriggerVariants
338
330
  };
@@ -64,7 +64,7 @@ function N({
64
64
  u,
65
65
  {
66
66
  "data-slot": "button",
67
- className: s(m({ variant: a, size: e, className: d }), "relative"),
67
+ className: s("relative", m({ variant: a, size: e, className: d })),
68
68
  ...o,
69
69
  children: [
70
70
  /* @__PURE__ */ t("span", { className: "absolute inset-0 overflow-hidden rounded-[inherit] pointer-events-none", children: /* @__PURE__ */ t("span", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700 ease-out" }) }),
@@ -1,39 +1,42 @@
1
1
  "use client";
2
- import { jsx as n } from "react/jsx-runtime";
3
- import * as m from "react";
4
- import { buttonVariants as f, Button as x } from "./button.js";
2
+ import { jsx as a, jsxs as h } from "react/jsx-runtime";
3
+ import { l as z } from "../../_virtual/lodash.js";
4
+ import * as y from "react";
5
+ import { AppSelect as b } from "./app-select.js";
6
+ import { buttonVariants as w, Button as x } from "./button.js";
5
7
  import { cn as e } from "../../lib/utils.js";
6
- import { getDefaultClassNames as p } from "../../node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js";
7
- import { DayPicker as b } from "../../node_modules/react-day-picker/dist/esm/DayPicker.js";
8
- import w from "../../node_modules/lucide-react/dist/esm/icons/chevron-left.js";
9
- import y from "../../node_modules/lucide-react/dist/esm/icons/chevron-right.js";
10
- import _ from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
11
- function R({
12
- className: u,
13
- classNames: c,
8
+ import { getDefaultClassNames as v } from "../../node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js";
9
+ import { DayPicker as C } from "../../node_modules/react-day-picker/dist/esm/DayPicker.js";
10
+ import _ from "../../node_modules/lucide-react/dist/esm/icons/chevron-left.js";
11
+ import N from "../../node_modules/lucide-react/dist/esm/icons/chevron-right.js";
12
+ import D from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
13
+ import { useDayPicker as k } from "../../node_modules/react-day-picker/dist/esm/useDayPicker.js";
14
+ import { formatDate as M } from "../../node_modules/date-fns/format.js";
15
+ function W({
16
+ className: p,
17
+ classNames: g,
14
18
  showOutsideDays: r = !0,
15
- buttonVariant: s = "ghost",
16
- formatters: i,
17
- components: l,
18
- ...g
19
+ buttonVariant: d = "ghost",
20
+ formatters: u,
21
+ components: s,
22
+ locale: c,
23
+ ...f
19
24
  }) {
20
- const t = p();
21
- return /* @__PURE__ */ n(
22
- b,
25
+ const t = v();
26
+ return /* @__PURE__ */ a(
27
+ C,
23
28
  {
24
29
  showOutsideDays: r,
25
- captionLayout: "dropdown",
26
- reverseYears: !0,
27
30
  endMonth: new Date((/* @__PURE__ */ new Date()).getFullYear() + 100, 11, 31),
28
31
  className: e(
29
- "bg-d-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
32
+ "bg-d-background group/calendar p-3 [--cell-size:--spacing(7)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
30
33
  String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
31
34
  String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
32
- u
35
+ p
33
36
  ),
34
37
  formatters: {
35
- formatMonthDropdown: (a) => a.toLocaleString("default", { month: "short" }),
36
- ...i
38
+ formatMonthDropdown: (n) => n.toLocaleString("default", { month: "short" }),
39
+ ...u
37
40
  },
38
41
  classNames: {
39
42
  root: e("w-fit", t.root),
@@ -43,38 +46,28 @@ function R({
43
46
  ),
44
47
  month: e("flex flex-col w-full gap-4", t.month),
45
48
  nav: e(
46
- "flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
49
+ "hidden",
47
50
  t.nav
48
51
  ),
49
52
  button_previous: e(
50
- f({ variant: s }),
53
+ w({ variant: d }),
51
54
  "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
52
55
  t.button_previous
53
56
  ),
54
57
  button_next: e(
55
- f({ variant: s }),
58
+ w({ variant: d }),
56
59
  "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
57
60
  t.button_next
58
61
  ),
59
62
  month_caption: e(
60
- "flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
63
+ "flex items-center justify-center pt-1 relative",
61
64
  t.month_caption
62
65
  ),
63
- dropdowns: e(
64
- "w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
65
- t.dropdowns
66
- ),
67
- dropdown_root: e(
68
- "relative has-focus:border-ring border border-d-input shadow-xs has-focus:ring-d-ring/50 has-focus:ring-[3px] rounded-md",
69
- t.dropdown_root
70
- ),
71
- dropdown: e("absolute inset-0 opacity-0", t.dropdown),
72
66
  caption_label: e(
73
- "select-none font-medium",
74
- g?.captionLayout === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-d-muted-foreground [&>svg]:size-3.5",
67
+ "select-none font-medium text-sm",
75
68
  t.caption_label
76
69
  ),
77
- table: "w-full border-collapse",
70
+ table: "w-full border-collapse space-y-1",
78
71
  weekdays: e("flex", t.weekdays),
79
72
  weekday: e(
80
73
  "text-d-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
@@ -112,63 +105,137 @@ function R({
112
105
  t.disabled
113
106
  ),
114
107
  hidden: e("invisible", t.hidden),
115
- ...c
108
+ ...g
116
109
  },
117
110
  components: {
118
- Root: ({ className: a, rootRef: d, ...o }) => /* @__PURE__ */ n(
111
+ Root: ({ className: n, rootRef: l, ...i }) => /* @__PURE__ */ a(
119
112
  "div",
120
113
  {
121
114
  "data-slot": "calendar",
122
- ref: d,
123
- className: e(a),
124
- ...o
115
+ ref: l,
116
+ className: e(n),
117
+ ...i
125
118
  }
126
119
  ),
127
- Chevron: ({ className: a, orientation: d, ...o }) => d === "left" ? /* @__PURE__ */ n(w, { className: e("size-4", a), ...o }) : d === "right" ? /* @__PURE__ */ n(
128
- y,
120
+ Chevron: ({ className: n, orientation: l, ...i }) => l === "left" ? /* @__PURE__ */ a(_, { className: e("size-4", n), ...i }) : l === "right" ? /* @__PURE__ */ a(
121
+ N,
129
122
  {
130
- className: e("size-4", a),
131
- ...o
123
+ className: e("size-4", n),
124
+ ...i
132
125
  }
133
- ) : /* @__PURE__ */ n(_, { className: e("size-4", a), ...o }),
134
- DayButton: h,
135
- WeekNumber: ({ children: a, ...d }) => /* @__PURE__ */ n("td", { ...d, children: /* @__PURE__ */ n("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: a }) }),
136
- ...l
126
+ ) : /* @__PURE__ */ a(D, { className: e("size-4", n), ...i }),
127
+ DayButton: L,
128
+ WeekNumber: ({ children: n, ...l }) => /* @__PURE__ */ a("td", { ...l, children: /* @__PURE__ */ a("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: n }) }),
129
+ MonthCaption: (n) => /* @__PURE__ */ a(S, { ...n, locale: c }),
130
+ ...s
137
131
  },
138
- ...g
132
+ locale: c,
133
+ ...f
139
134
  }
140
135
  );
141
136
  }
142
- function h({
143
- className: u,
144
- day: c,
137
+ function L({
138
+ className: p,
139
+ day: g,
145
140
  modifiers: r,
146
- ...s
141
+ ...d
147
142
  }) {
148
- const i = p(), l = m.useRef(null);
149
- return m.useEffect(() => {
150
- r.focused && l.current?.focus();
151
- }, [r.focused]), /* @__PURE__ */ n(
143
+ const u = v(), s = y.useRef(null);
144
+ return y.useEffect(() => {
145
+ r.focused && s.current?.focus();
146
+ }, [r.focused]), /* @__PURE__ */ h(
152
147
  x,
153
148
  {
154
- ref: l,
149
+ ref: s,
155
150
  variant: "ghost",
156
151
  size: "icon",
157
- "data-day": c.date.toLocaleDateString(),
152
+ "data-day": g.date.toLocaleDateString(),
158
153
  "data-selected-single": r.selected && !r.range_start && !r.range_end && !r.range_middle,
159
154
  "data-range-start": r.range_start,
160
155
  "data-range-end": r.range_end,
161
156
  "data-range-middle": r.range_middle,
162
157
  className: e(
163
158
  "data-[selected-single=true]:bg-d-primary data-[selected-single=true]:text-d-primary-foreground data-[range-middle=true]:bg-d-accent data-[range-middle=true]:text-d-accent-foreground data-[range-start=true]:bg-d-primary data-[range-start=true]:text-d-primary-foreground data-[range-end=true]:bg-d-primary data-[range-end=true]:text-d-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-d-ring/50 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[1px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
164
- i.day,
165
- u
159
+ u.day,
160
+ p
166
161
  ),
167
- ...s
162
+ ...d,
163
+ children: [
164
+ d.children,
165
+ r.today && /* @__PURE__ */ a("span", { className: "absolute bottom-1 left-1/2 -translate-x-1/2 h-1 w-1 rounded-full bg-d-primary" })
166
+ ]
168
167
  }
169
168
  );
170
169
  }
170
+ function S({
171
+ calendarMonth: p,
172
+ locale: g
173
+ }) {
174
+ const r = k(), { goToMonth: d, nextMonth: u, previousMonth: s } = r, c = p.date, f = Array.from({ length: 12 }, (m, o) => ({
175
+ value: o,
176
+ label: z.upperFirst(
177
+ g ? M(new Date(2e3, o), "LLLL", { locale: g }) : new Date(2e3, o).toLocaleString("default", { month: "long" })
178
+ )
179
+ })), t = (/* @__PURE__ */ new Date()).getFullYear(), n = Array.from({ length: 201 }, (m, o) => ({
180
+ value: t - 100 + o,
181
+ label: String(t - 100 + o)
182
+ })), l = (m) => {
183
+ if (m === void 0) return;
184
+ const o = new Date(c);
185
+ o.setMonth(Number(m)), d(o);
186
+ }, i = (m) => {
187
+ if (m === void 0) return;
188
+ const o = new Date(c);
189
+ o.setFullYear(Number(m)), d(o);
190
+ };
191
+ return /* @__PURE__ */ h("div", { className: "flex items-center justify-center gap-1", children: [
192
+ /* @__PURE__ */ a(
193
+ x,
194
+ {
195
+ variant: "ghost",
196
+ size: "icon",
197
+ className: "h-6 w-6 p-0",
198
+ disabled: !s,
199
+ onClick: () => s && d(s),
200
+ children: /* @__PURE__ */ a(_, { className: "size-3 opacity-50 hover:opacity-100" })
201
+ }
202
+ ),
203
+ /* @__PURE__ */ h("div", { className: "flex items-center gap-1", children: [
204
+ /* @__PURE__ */ a(
205
+ b,
206
+ {
207
+ options: f,
208
+ value: c.getMonth(),
209
+ onValueChange: l,
210
+ size: "sm",
211
+ className: "h-7 w-[105px] text-xs"
212
+ }
213
+ ),
214
+ /* @__PURE__ */ a(
215
+ b,
216
+ {
217
+ options: n,
218
+ value: c.getFullYear(),
219
+ onValueChange: i,
220
+ size: "sm",
221
+ className: "h-7 w-[75px] text-xs"
222
+ }
223
+ )
224
+ ] }),
225
+ /* @__PURE__ */ a(
226
+ x,
227
+ {
228
+ variant: "ghost",
229
+ size: "icon",
230
+ className: "h-6 w-6 p-0",
231
+ disabled: !u,
232
+ onClick: () => u && d(u),
233
+ children: /* @__PURE__ */ a(N, { className: "size-3 opacity-50 hover:opacity-100" })
234
+ }
235
+ )
236
+ ] });
237
+ }
171
238
  export {
172
- R as Calendar,
173
- h as CalendarDayButton
239
+ W as Calendar,
240
+ L as CalendarDayButton
174
241
  };