laif-ds 0.2.54 → 0.2.56

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,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
  };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsxs as f, jsx as t } from "react/jsx-runtime";
3
- import { Calendar as w } from "./calendar.js";
3
+ import { Calendar as T } from "./calendar.js";
4
4
  import { Icon as E } from "./icon.js";
5
5
  import { Label as L } from "./label.js";
6
6
  import { Popover as q, PopoverTrigger as A, PopoverContent as B } from "./popover.js";
@@ -17,7 +17,7 @@ function v({
17
17
  placeholder: I = "Seleziona data",
18
18
  dateFormat: a = "dd/MM/yyyy",
19
19
  className: M,
20
- disabled: n = !1,
20
+ disabled: s = !1,
21
21
  size: m = "default",
22
22
  firstDate: l,
23
23
  lastDate: u,
@@ -30,21 +30,21 @@ function v({
30
30
  }) {
31
31
  const [r, y] = c.useState(e), [O, C] = c.useState(
32
32
  g
33
- ), [S, R] = c.useState(!1), z = (s) => {
34
- y(s), s && C(s), p && p(s);
33
+ ), [S, R] = c.useState(!1), w = (n) => {
34
+ y(n), n && C(n), p && p(n);
35
35
  };
36
36
  let i = [];
37
37
  l && i.push({ before: l }), u && i.push({ after: u }), h?.length && i.push(
38
- (s) => !h.some(
39
- (T) => H(T, s)
38
+ (n) => !h.some(
39
+ (z) => H(z, n)
40
40
  )
41
- ), n && (i = [!0]), F(() => {
41
+ ), s && (i = [!0]), F(() => {
42
42
  y(r), C(r || g);
43
43
  }, [r]);
44
44
  const b = c.useId();
45
45
  return /* @__PURE__ */ f("div", { className: P("flex flex-col gap-1.5", k), children: [
46
46
  x && /* @__PURE__ */ t(L, { htmlFor: b, children: x }),
47
- /* @__PURE__ */ f(q, { open: n ? !1 : S, onOpenChange: R, children: [
47
+ /* @__PURE__ */ f(q, { open: s ? !1 : S, onOpenChange: R, children: [
48
48
  /* @__PURE__ */ t(A, { asChild: !0, children: /* @__PURE__ */ f(
49
49
  "div",
50
50
  {
@@ -59,16 +59,16 @@ function v({
59
59
  S && o.activeRing,
60
60
  "hover:border-d-ring cursor-pointer transition-colors",
61
61
  !r && "text-d-muted-foreground",
62
- n && "cursor-not-allowed opacity-50",
62
+ s && "cursor-not-allowed opacity-50",
63
63
  m === "default" && o.sizes.default,
64
64
  m === "sm" && o.sizes.sm,
65
65
  m === "lg" && o.sizes.lg,
66
66
  M
67
67
  ),
68
- "aria-disabled": n,
68
+ "aria-disabled": s,
69
69
  role: "button",
70
- tabIndex: n ? -1 : 0,
71
- onClick: n ? void 0 : () => {
70
+ tabIndex: s ? -1 : 0,
71
+ onClick: s ? void 0 : () => {
72
72
  },
73
73
  children: [
74
74
  /* @__PURE__ */ t(
@@ -86,13 +86,13 @@ function v({
86
86
  ]
87
87
  }
88
88
  ) }),
89
- /* @__PURE__ */ t(B, { className: "w-auto p-0", children: /* @__PURE__ */ t(
90
- w,
89
+ /* @__PURE__ */ t(B, { className: "w-auto p-0 shadow", children: /* @__PURE__ */ t(
90
+ T,
91
91
  {
92
92
  ...j || {
93
93
  mode: "single",
94
94
  selected: r,
95
- onSelect: z
95
+ onSelect: w
96
96
  },
97
97
  autoFocus: !0,
98
98
  disabled: i,
package/dist/index.d.ts CHANGED
@@ -518,7 +518,7 @@ export declare const buttonVariants: (props?: ({
518
518
  size?: "default" | "sm" | "lg" | "icon" | null | undefined;
519
519
  } & ClassProp) | undefined) => string;
520
520
 
521
- export declare function Calendar({ className, classNames, showOutsideDays, buttonVariant, formatters, components, ...props }: CalendarProps): JSX.Element;
521
+ export declare function Calendar({ className, classNames, showOutsideDays, buttonVariant, formatters, components, locale, ...props }: CalendarProps): JSX.Element;
522
522
 
523
523
  export declare interface CalendarAppointment {
524
524
  id: number;
@@ -38,6 +38,11 @@ const e = {
38
38
  // Badge specific
39
39
  badge: {
40
40
  base: "inline-flex items-center justify-center border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 gap-1"
41
+ },
42
+ // Dropdown item specific
43
+ dropdownItem: {
44
+ selected: "bg-d-primary/10 text-d-primary font-medium",
45
+ hover: "data-[selected=true]:bg-d-accent/50 data-[selected=true]:text-d-accent-foreground"
41
46
  }
42
47
  };
43
48
  export {
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import e from "../../_virtual/index3.js";
2
+ import e from "../../_virtual/index5.js";
3
3
  export {
4
4
  e as EventEmitter,
5
5
  e as default
@@ -3,7 +3,7 @@ import { stringify as w } from "../../comma-separated-tokens/index.js";
3
3
  import { ok as u } from "../../devlop/lib/default.js";
4
4
  import { svg as m, html as C } from "../../property-information/index.js";
5
5
  import { stringify as N } from "../../space-separated-tokens/index.js";
6
- import S from "../../../_virtual/index4.js";
6
+ import S from "../../../_virtual/index3.js";
7
7
  import { whitespace as j } from "../../hast-util-whitespace/lib/index.js";
8
8
  import { name as x } from "../../estree-util-is-identifier-name/lib/index.js";
9
9
  import { VFileMessage as h } from "../../vfile-message/lib/index.js";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import e from "../../../../_virtual/index3.js";
2
+ import e from "../../../../_virtual/index5.js";
3
3
  var r = new e(), n = "recharts.syncEvent.tooltip";
4
4
  export {
5
5
  n as TOOLTIP_SYNC_EVENT,
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { bail as P } from "../../bail/index.js";
3
- import y from "../../../_virtual/index5.js";
3
+ import y from "../../../_virtual/index4.js";
4
4
  import z from "../../is-plain-obj/index.js";
5
5
  import { CallableInstance as C } from "./callable-instance.js";
6
6
  import { trough as A } from "../../trough/lib/index.js";