laif-ds 0.2.23 → 0.2.25

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 (54) hide show
  1. package/dist/_virtual/index2.js +5 -2
  2. package/dist/_virtual/index3.js +2 -5
  3. package/dist/_virtual/index6.js +2 -2
  4. package/dist/_virtual/index7.js +2 -2
  5. package/dist/components/ui/alert-dialog.js +6 -6
  6. package/dist/components/ui/app-multiple-select-dropdown.js +34 -34
  7. package/dist/components/ui/app-select.js +127 -124
  8. package/dist/components/ui/badge.js +13 -12
  9. package/dist/components/ui/button.js +20 -18
  10. package/dist/components/ui/calendar.js +6 -6
  11. package/dist/components/ui/checkbox.js +9 -9
  12. package/dist/components/ui/confirmer.js +45 -19
  13. package/dist/components/ui/context-menu.js +4 -4
  14. package/dist/components/ui/date-picker.js +45 -36
  15. package/dist/components/ui/input-otp.js +16 -16
  16. package/dist/components/ui/input-selector.js +19 -19
  17. package/dist/components/ui/input.js +19 -19
  18. package/dist/components/ui/menubar.js +1 -1
  19. package/dist/components/ui/pagination.js +90 -77
  20. package/dist/components/ui/radio-group.js +14 -14
  21. package/dist/components/ui/select.js +27 -27
  22. package/dist/components/ui/switch.js +8 -6
  23. package/dist/components/ui/table.js +16 -16
  24. package/dist/components/ui/tables/data-cross-table/data-cross-table.js +6 -6
  25. package/dist/components/ui/tables/data-table/components/data-table-actions.js +51 -0
  26. package/dist/components/ui/tables/data-table/components/data-table-advanced-filter.js +470 -0
  27. package/dist/components/ui/tables/data-table/components/data-table-body.js +340 -0
  28. package/dist/components/ui/tables/data-table/components/data-table-column-visibility.js +274 -0
  29. package/dist/components/ui/tables/data-table/components/data-table-filter-inputs.js +177 -0
  30. package/dist/components/ui/tables/data-table/components/data-table-filters.js +286 -0
  31. package/dist/components/ui/tables/data-table/components/data-table-pagination.js +131 -0
  32. package/dist/components/ui/tables/data-table/components/data-table-searchbar.js +112 -0
  33. package/dist/components/ui/tables/data-table/components/data-table-simple-filters.js +263 -0
  34. package/dist/components/ui/tables/data-table/components/data-table-sorting.js +128 -0
  35. package/dist/components/ui/tables/data-table/data-table-constants.js +58 -0
  36. package/dist/components/ui/tables/data-table/data-table-i18n.js +138 -0
  37. package/dist/components/ui/tables/data-table/data-table.js +549 -0
  38. package/dist/components/ui/tables/data-table/data-table.service.js +254 -0
  39. package/dist/components/ui/tabs.js +33 -33
  40. package/dist/components/ui/textarea.js +11 -11
  41. package/dist/components/ui/tooltip.js +10 -10
  42. package/dist/css-for-template.css +57 -0
  43. package/dist/index.d.ts +249 -76
  44. package/dist/index.js +64 -64
  45. package/dist/node_modules/eventemitter3/index.js +1 -1
  46. package/dist/node_modules/eventemitter3/index2.js +1 -1
  47. package/dist/node_modules/recharts/es6/util/Events.js +1 -1
  48. package/dist/node_modules/style-to-object/cjs/index.js +1 -1
  49. package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
  50. package/dist/styles.css +1 -1
  51. package/dist/styles.v3.css +1 -1
  52. package/package.json +5 -3
  53. package/dist/components/ui/data-table.js +0 -461
  54. package/dist/components/ui/data-table.service.js +0 -62
@@ -1,20 +1,22 @@
1
1
  "use client";
2
2
  import { jsx as r, jsxs as c } from "react/jsx-runtime";
3
- import { Root as v } from "../../node_modules/@radix-ui/react-slot/dist/index.js";
4
- import { cva as m } from "../../node_modules/class-variance-authority/dist/index.js";
3
+ import { Root as m } from "../../node_modules/@radix-ui/react-slot/dist/index.js";
4
+ import { cva as v } from "../../node_modules/class-variance-authority/dist/index.js";
5
5
  import { cn as l } from "../../lib/utils.js";
6
6
  import { Icon as u } from "./icon.js";
7
- const b = m(
8
- "cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-d-ring focus-visible:ring-d-ring/50 focus-visible:ring-[3px] aria-invalid:ring-d-destructive/20 dark:aria-invalid:ring-d-destructive/40 aria-invalid:border-d-destructive transition-all duration-200 ease-out transform-gpu active:scale-[0.98] active:shadow-sm overflow-hidden relative group",
7
+ const b = v(
8
+ "cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all focus-visible:ring-d-ring/50 focus-visible:ring-[3px] aria-invalid:ring-d-destructive/20 aria-invalid:border-d-destructive transition-all duration-200 ease-out transform-gpu active:scale-[0.98] active:shadow-sm overflow-hidden relative group disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-d-ring",
9
9
  {
10
10
  variants: {
11
11
  variant: {
12
12
  default: "bg-d-primary text-d-primary-foreground shadow-xs hover:bg-d-primary/90 hover:shadow-d-primary/25 [clip-path:inset(0_round_0.375rem)] before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-white/20 before:to-transparent before:translate-x-[-100%] hover:before:translate-x-[100%] before:transition-transform before:duration-700 before:ease-out",
13
- destructive: "bg-d-destructive text-white shadow-xs hover:bg-d-destructive/90 hover:shadow-d-destructive/25 focus-visible:ring-d-destructive/20 dark:focus-visible:ring-d-destructive/40 dark:bg-d-destructive/60 [clip-path:inset(0_round_0.375rem)] before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-white/20 before:to-transparent before:translate-x-[-100%] hover:before:translate-x-[100%] before:transition-transform before:duration-700 before:ease-out",
14
- outline: "border bg-d-background shadow-xs hover:bg-d-accent hover:text-d-accent-foreground hover:border-d-accent dark:bg-d-input/30 dark:border-d-input dark:hover:bg-d-input/50",
13
+ destructive: "bg-d-destructive text-d-destructive-foreground shadow-xs hover:bg-d-destructive/90 hover:shadow-d-destructive/25 focus-visible:ring-d-destructive/20 [clip-path:inset(0_round_0.375rem)] before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-white/20 before:to-transparent before:translate-x-[-100%] hover:before:translate-x-[100%] before:transition-transform before:duration-700 before:ease-out",
14
+ outline: "border border-d-foreground bg-d-background shadow-xs hover:bg-d-accent hover:text-d-accent-foreground hover:border-d-accent disabled:border-d-foreground/30",
15
15
  "outline-primary": "border !border-d-primary bg-d-background shadow-xs text-d-primary/80 hover:!text-d-primary hover:bg-d-primary/5 hover:border-d-primary/80 ",
16
16
  secondary: "bg-d-secondary text-d-secondary-foreground shadow-xs hover:bg-d-secondary/80 hover:text-d-secondary-foreground ",
17
- ghost: "hover:bg-d-accent hover:text-d-accent-foreground dark:hover:bg-d-accent",
17
+ ghost: "hover:bg-d-accent hover:text-d-accent-foreground ",
18
+ "ghost-destructive": "text-d-destructive bg-transparent hover:bg-d-destructive/10",
19
+ "ghost-accent": "text-d-primary bg-transparent hover:bg-d-primary/10",
18
20
  link: "text-d-primary underline-offset-4 hover:underline"
19
21
  },
20
22
  size: {
@@ -34,22 +36,22 @@ function w({
34
36
  className: o,
35
37
  variant: a,
36
38
  size: e,
37
- asChild: n = !1,
38
- iconLeft: d,
39
- iconRight: i,
39
+ asChild: d = !1,
40
+ iconLeft: n,
41
+ iconRight: s,
40
42
  isLoading: f = !1,
41
43
  ...t
42
44
  }) {
43
- const s = n ? v : "button";
44
- return n ? /* @__PURE__ */ r(
45
- s,
45
+ const i = d ? m : "button";
46
+ return d ? /* @__PURE__ */ r(
47
+ i,
46
48
  {
47
49
  "data-slot": "button",
48
50
  className: l(b({ variant: a, size: e, className: o })),
49
51
  ...t
50
52
  }
51
53
  ) : /* @__PURE__ */ c(
52
- s,
54
+ i,
53
55
  {
54
56
  "data-slot": "button",
55
57
  className: l(b({ variant: a, size: e, className: o }), "relative"),
@@ -86,18 +88,18 @@ function w({
86
88
  )
87
89
  ]
88
90
  }
89
- ) : d && /* @__PURE__ */ r(
91
+ ) : n && /* @__PURE__ */ r(
90
92
  u,
91
93
  {
92
- name: d,
94
+ name: n,
93
95
  size: e === "default" ? "md" : e === "sm" ? "xs" : "sm"
94
96
  }
95
97
  ),
96
98
  t.children,
97
- i && /* @__PURE__ */ r(
99
+ s && /* @__PURE__ */ r(
98
100
  u,
99
101
  {
100
- name: i,
102
+ name: s,
101
103
  size: e === "default" ? "md" : e === "sm" ? "xs" : "sm"
102
104
  }
103
105
  )
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import { jsx as d } from "react/jsx-runtime";
3
3
  import * as g from "react";
4
- import { cn as e } from "../../lib/utils.js";
5
4
  import { buttonVariants as m, Button as b } from "./button.js";
5
+ import { cn as e } from "../../lib/utils.js";
6
6
  import { getDefaultClassNames as f } from "../../node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js";
7
7
  import { DayPicker as w } from "../../node_modules/react-day-picker/dist/esm/DayPicker.js";
8
8
  import _ from "../../node_modules/lucide-react/dist/esm/icons/chevron-left.js";
9
- import h from "../../node_modules/lucide-react/dist/esm/icons/chevron-right.js";
10
- import y from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
9
+ import y from "../../node_modules/lucide-react/dist/esm/icons/chevron-right.js";
10
+ import h from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
11
11
  function B({
12
12
  className: c,
13
13
  classNames: i,
@@ -124,12 +124,12 @@ function B({
124
124
  }
125
125
  ),
126
126
  Chevron: ({ className: a, orientation: n, ...o }) => n === "left" ? /* @__PURE__ */ d(_, { className: e("size-4", a), ...o }) : n === "right" ? /* @__PURE__ */ d(
127
- h,
127
+ y,
128
128
  {
129
129
  className: e("size-4", a),
130
130
  ...o
131
131
  }
132
- ) : /* @__PURE__ */ d(y, { className: e("size-4", a), ...o }),
132
+ ) : /* @__PURE__ */ d(h, { className: e("size-4", a), ...o }),
133
133
  DayButton: v,
134
134
  WeekNumber: ({ children: a, ...n }) => /* @__PURE__ */ d("td", { ...n, children: /* @__PURE__ */ d("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: a }) }),
135
135
  ...p
@@ -159,7 +159,7 @@ function v({
159
159
  "data-range-end": r.range_end,
160
160
  "data-range-middle": r.range_middle,
161
161
  className: e(
162
- "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 dark:hover:text-d-accent-foreground 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",
162
+ "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",
163
163
  s.day,
164
164
  c
165
165
  ),
@@ -1,33 +1,33 @@
1
1
  "use client";
2
2
  import { jsx as r } from "react/jsx-runtime";
3
- import { Checkbox as o, CheckboxIndicator as a } from "../../node_modules/@radix-ui/react-checkbox/dist/index.js";
4
- import { cn as n } from "../../lib/utils.js";
5
- import s from "../../node_modules/lucide-react/dist/esm/icons/minus.js";
3
+ import { Checkbox as d, CheckboxIndicator as a } from "../../node_modules/@radix-ui/react-checkbox/dist/index.js";
4
+ import { cn as s } from "../../lib/utils.js";
5
+ import n from "../../node_modules/lucide-react/dist/esm/icons/minus.js";
6
6
  import c from "../../node_modules/lucide-react/dist/esm/icons/check.js";
7
7
  function f({
8
8
  className: t,
9
9
  checked: i,
10
- ...d
10
+ ...o
11
11
  }) {
12
12
  const e = i === "indeterminate";
13
13
  return /* @__PURE__ */ r(
14
- o,
14
+ d,
15
15
  {
16
16
  "data-slot": "checkbox",
17
- className: n(
18
- "peer bg-d-input border-d-border data-[state=checked]:bg-d-primary data-[state=checked]:border-d-primary data-[state=checked]:text-d-primary-foreground focus-visible:border-d-ring focus-visible:ring-d-ring/50 aria-invalid:border-d-destructive aria-invalid:ring-d-destructive/20 dark:aria-invalid:ring-d-destructive/40 size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
17
+ className: s(
18
+ "peer bg-d-input border-d-border data-[state=checked]:bg-d-primary data-[state=checked]:border-d-primary data-[state=checked]:text-d-primary-foreground focus-visible:border-d-ring focus-visible:ring-d-ring/50 aria-invalid:border-d-destructive aria-invalid:ring-d-destructive/20 size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
19
19
  e && "bg-d-primary border-d-primary text-d-primary-foreground",
20
20
  t
21
21
  ),
22
22
  checked: e ? !1 : i,
23
- ...d,
23
+ ...o,
24
24
  children: /* @__PURE__ */ r(
25
25
  a,
26
26
  {
27
27
  "data-slot": "checkbox-indicator",
28
28
  className: "flex items-center justify-center text-current transition-none",
29
29
  forceMount: e || void 0,
30
- children: e ? /* @__PURE__ */ r(s, { className: "size-3.5" }) : /* @__PURE__ */ r(c, { className: "size-3.5" })
30
+ children: e ? /* @__PURE__ */ r(n, { className: "size-3.5" }) : /* @__PURE__ */ r(c, { className: "size-3.5" })
31
31
  }
32
32
  )
33
33
  }
@@ -1,31 +1,57 @@
1
1
  "use client";
2
- import { jsx as o, jsxs as t } from "react/jsx-runtime";
3
- import { createAsk as p } from "../../node_modules/use-ask/dist/index.js";
4
- import { AlertDialog as d, AlertDialogContent as m, AlertDialogHeader as A, AlertDialogTitle as f, AlertDialogDescription as g, AlertDialogFooter as h, AlertDialogCancel as u } from "./alert-dialog.js";
5
- import { Button as C } from "./button.js";
6
- const [n, D] = p({}), O = n.ask;
7
- n.safeAsk;
8
- const k = {
2
+ import { jsx as t, jsxs as r } from "react/jsx-runtime";
3
+ import { createAsk as d } from "../../node_modules/use-ask/dist/index.js";
4
+ import { AlertDialog as m, AlertDialogContent as p, AlertDialogHeader as u, AlertDialogTitle as f, AlertDialogDescription as A, AlertDialogFooter as g, AlertDialogCancel as v } from "./alert-dialog.js";
5
+ import { Button as h } from "./button.js";
6
+ import { Icon as x } from "./icon.js";
7
+ const [i, C] = d({}), O = i.ask;
8
+ i.safeAsk;
9
+ const D = {
9
10
  title: "Are you sure?",
10
11
  cancelText: "Cancel",
11
- actionText: "Continue"
12
+ actionText: "Continue",
13
+ variant: "default"
12
14
  }, P = () => {
13
- const [{ key: r, payload: i }, { asking: l, cancel: c, ok: a }] = D(), e = { ...k, ...i };
14
- return /* @__PURE__ */ o(
15
- d,
15
+ const [{ key: n, payload: o }, { asking: a, cancel: c, ok: l }] = C(), e = { ...D, ...o };
16
+ return /* @__PURE__ */ t(
17
+ m,
16
18
  {
17
- open: l,
19
+ open: a,
18
20
  onOpenChange: (s) => !s && c(),
19
- children: /* @__PURE__ */ t(m, { children: [
20
- /* @__PURE__ */ o(A, { children: /* @__PURE__ */ o(f, { children: e.title }) }),
21
- /* @__PURE__ */ o(g, { children: e.description }),
22
- /* @__PURE__ */ t(h, { children: [
23
- /* @__PURE__ */ o(u, { ...e.CancelProps, children: e.cancelText }),
24
- /* @__PURE__ */ o(C, { ...e.ActionProps, onClick: () => a(!0), children: e.actionText })
21
+ children: /* @__PURE__ */ r(p, { children: [
22
+ /* @__PURE__ */ t(u, { children: /* @__PURE__ */ r(
23
+ f,
24
+ {
25
+ className: e.variant === "destructive" ? "flex items-center gap-2" : void 0,
26
+ children: [
27
+ e.variant === "destructive" && /* @__PURE__ */ t(
28
+ x,
29
+ {
30
+ name: "AlertTriangle",
31
+ className: "text-d-destructive",
32
+ size: "sm"
33
+ }
34
+ ),
35
+ e.title
36
+ ]
37
+ }
38
+ ) }),
39
+ /* @__PURE__ */ t(A, { children: e.description }),
40
+ /* @__PURE__ */ r(g, { children: [
41
+ /* @__PURE__ */ t(v, { ...e.CancelProps, children: e.cancelText }),
42
+ /* @__PURE__ */ t(
43
+ h,
44
+ {
45
+ ...e.ActionProps,
46
+ variant: e.variant === "destructive" ? "destructive" : "default",
47
+ onClick: () => l(!0),
48
+ children: e.actionText
49
+ }
50
+ )
25
51
  ] })
26
52
  ] })
27
53
  },
28
- r
54
+ n
29
55
  );
30
56
  };
31
57
  export {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as e, jsxs as r } from "react/jsx-runtime";
3
- import { Root as u, Trigger as c, Portal as d, Content as l, Item as m, CheckboxItem as f, ItemIndicator as i, RadioItem as x, Label as p, Separator as g, Group as v, Sub as b, SubContent as h, SubTrigger as C, RadioGroup as z } from "../../node_modules/@radix-ui/react-context-menu/dist/index.js";
3
+ import { Root as u, Trigger as c, Portal as d, Content as l, Item as m, CheckboxItem as f, ItemIndicator as i, RadioItem as x, Label as p, Separator as g, Group as b, Sub as v, SubContent as h, SubTrigger as C, RadioGroup as z } from "../../node_modules/@radix-ui/react-context-menu/dist/index.js";
4
4
  import { cn as a } from "../../lib/utils.js";
5
5
  import M from "../../node_modules/lucide-react/dist/esm/icons/check.js";
6
6
  import y from "../../node_modules/lucide-react/dist/esm/icons/circle.js";
@@ -18,7 +18,7 @@ function T({
18
18
  function j({
19
19
  ...t
20
20
  }) {
21
- return /* @__PURE__ */ e(v, { "data-slot": "context-menu-group", ...t });
21
+ return /* @__PURE__ */ e(b, { "data-slot": "context-menu-group", ...t });
22
22
  }
23
23
  function L({
24
24
  ...t
@@ -28,7 +28,7 @@ function L({
28
28
  function P({
29
29
  ...t
30
30
  }) {
31
- return /* @__PURE__ */ e(b, { "data-slot": "context-menu-sub", ...t });
31
+ return /* @__PURE__ */ e(v, { "data-slot": "context-menu-sub", ...t });
32
32
  }
33
33
  function q({
34
34
  ...t
@@ -109,7 +109,7 @@ function E({
109
109
  "data-inset": n,
110
110
  "data-variant": o,
111
111
  className: a(
112
- "focus:bg-d-accent focus:text-d-accent-foreground data-[variant=destructive]:text-d-destructive data-[variant=destructive]:focus:bg-d-destructive/10 dark:data-[variant=destructive]:focus:bg-d-destructive/20 data-[variant=destructive]:focus:text-d-destructive data-[variant=destructive]:*:[svg]:!text-d-destructive [&_svg:not([class*='text-'])]:text-d-secondary-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
112
+ "focus:bg-d-accent focus:text-d-accent-foreground data-[variant=destructive]:text-d-destructive data-[variant=destructive]:focus:bg-d-destructive/10 data-[variant=destructive]:focus:text-d-destructive data-[variant=destructive]:*:[svg]:!text-d-destructive [&_svg:not([class*='text-'])]:text-d-secondary-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
113
113
  t
114
114
  ),
115
115
  ...s
@@ -1,39 +1,48 @@
1
1
  "use client";
2
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
3
- import * as c from "react";
4
- import { cn as g } from "../../lib/utils.js";
5
- import { buttonVariants as x } from "./button.js";
6
- import { Icon as h } from "./icon.js";
2
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
3
+ import { buttonVariants as w } from "./button.js";
7
4
  import { Calendar as v } from "./calendar.js";
8
- import { Popover as w, PopoverTrigger as P, PopoverContent as b } from "./popover.js";
9
- import { formatDate as C } from "../../node_modules/date-fns/format.js";
10
- function E({
11
- value: n,
12
- onChange: a,
13
- placeholder: l = "Seleziona data",
14
- dateFormat: m = "PPP",
15
- className: f,
16
- buttonVariant: u = "default",
5
+ import { Icon as y } from "./icon.js";
6
+ import { Popover as C, PopoverTrigger as j, PopoverContent as N } from "./popover.js";
7
+ import { cn as S } from "../../lib/utils.js";
8
+ import * as u from "react";
9
+ import { formatDate as k } from "../../node_modules/date-fns/format.js";
10
+ import { isSameDay as I } from "../../node_modules/date-fns/isSameDay.js";
11
+ function B({
12
+ value: i,
13
+ onChange: s,
14
+ placeholder: p = "Seleziona data",
15
+ dateFormat: g = "PPP",
16
+ className: h,
17
+ buttonVariant: x = "default",
17
18
  disabled: t = !1,
18
- size: o = "default"
19
+ size: o = "default",
20
+ firstDate: d,
21
+ lastDate: f,
22
+ availableDates: m
19
23
  }) {
20
- const [r, i] = c.useState(n);
21
- c.useEffect(() => {
22
- i(n);
23
- }, [n]);
24
- const p = (s) => {
25
- i(s), a && a(s);
24
+ const [n, c] = u.useState(i);
25
+ u.useEffect(() => {
26
+ c(i);
27
+ }, [i]);
28
+ const b = (a) => {
29
+ c(a), s && s(a);
26
30
  };
27
- return /* @__PURE__ */ d(w, { open: t ? !1 : void 0, children: [
28
- /* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e(
31
+ let r = [];
32
+ return d && r.push({ before: d }), f && r.push({ after: f }), m?.length && r.push(
33
+ (a) => !m.some(
34
+ (P) => I(P, a)
35
+ )
36
+ ), t && (r = [!0]), /* @__PURE__ */ l(C, { open: t ? !1 : void 0, children: [
37
+ /* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
29
38
  "div",
30
39
  {
31
- className: g(
32
- x({ variant: u, size: o }),
40
+ className: S(
41
+ w({ variant: x, size: o }),
33
42
  "border-d-input text-d-foreground hover:bg-d-accent bg-d-input ring-offset-background data-[placeholder]:text-d-muted-foreground focus:ring-d-ring flex items-center justify-between border px-3 py-2 font-normal whitespace-nowrap shadow-sm focus:ring-1 focus:outline-none [&>span]:line-clamp-1",
34
- !r && "text-d-muted-foreground",
43
+ !n && "text-d-muted-foreground",
35
44
  t && "cursor-not-allowed opacity-50",
36
- f,
45
+ h,
37
46
  o === "sm" && "text-xs",
38
47
  o === "lg" && "text-lg"
39
48
  ),
@@ -42,30 +51,30 @@ function E({
42
51
  tabIndex: t ? -1 : 0,
43
52
  onClick: t ? void 0 : () => {
44
53
  },
45
- children: /* @__PURE__ */ d("div", { className: "flex w-full items-center justify-between gap-2", children: [
54
+ children: /* @__PURE__ */ l("div", { className: "flex w-full items-center justify-between gap-2", children: [
46
55
  /* @__PURE__ */ e(
47
- h,
56
+ y,
48
57
  {
49
58
  name: "Calendar",
50
59
  size: o === "default" ? "md" : o === "sm" ? "xs" : "sm"
51
60
  }
52
61
  ),
53
- r ? /* @__PURE__ */ e("span", { children: C(r, m) }) : /* @__PURE__ */ e("span", { className: "text-d-muted-foreground", children: l })
62
+ n ? /* @__PURE__ */ e("span", { children: k(n, g) }) : /* @__PURE__ */ e("span", { className: "text-d-muted-foreground", children: p })
54
63
  ] })
55
64
  }
56
65
  ) }),
57
- /* @__PURE__ */ e(b, { className: "w-auto p-0", children: /* @__PURE__ */ e(
66
+ /* @__PURE__ */ e(N, { className: "w-auto p-0", children: /* @__PURE__ */ e(
58
67
  v,
59
68
  {
60
69
  mode: "single",
61
- selected: r,
62
- onSelect: p,
63
- initialFocus: !0,
64
- disabled: t
70
+ selected: n,
71
+ onSelect: b,
72
+ autoFocus: !0,
73
+ disabled: r
65
74
  }
66
75
  ) })
67
76
  ] });
68
77
  }
69
78
  export {
70
- E as DatePicker
79
+ B as DatePicker
71
80
  };
@@ -1,32 +1,32 @@
1
1
  "use client";
2
- import { jsx as a, jsxs as u } from "react/jsx-runtime";
3
- import * as c from "react";
4
- import { OTPInput as l, OTPInputContext as p } from "../../node_modules/input-otp/dist/index.js";
5
- import { cn as r } from "../../lib/utils.js";
2
+ import { jsx as r, jsxs as u } from "react/jsx-runtime";
3
+ import { OTPInput as c, OTPInputContext as l } from "../../node_modules/input-otp/dist/index.js";
4
+ import * as p from "react";
5
+ import { cn as a } from "../../lib/utils.js";
6
6
  function x({
7
7
  className: t,
8
8
  containerClassName: e,
9
9
  ...i
10
10
  }) {
11
- return /* @__PURE__ */ a(
12
- l,
11
+ return /* @__PURE__ */ r(
12
+ c,
13
13
  {
14
14
  "data-slot": "input-otp",
15
- containerClassName: r(
15
+ containerClassName: a(
16
16
  "flex items-center gap-2 has-disabled:opacity-50",
17
17
  e
18
18
  ),
19
- className: r("disabled:cursor-not-allowed", t),
19
+ className: a("disabled:cursor-not-allowed", t),
20
20
  ...i
21
21
  }
22
22
  );
23
23
  }
24
24
  function b({ className: t, ...e }) {
25
- return /* @__PURE__ */ a(
25
+ return /* @__PURE__ */ r(
26
26
  "div",
27
27
  {
28
28
  "data-slot": "input-otp-group",
29
- className: r("flex items-center", t),
29
+ className: a("flex items-center", t),
30
30
  ...e
31
31
  }
32
32
  );
@@ -36,20 +36,20 @@ function g({
36
36
  className: e,
37
37
  ...i
38
38
  }) {
39
- const n = c.useContext(p), { char: d, hasFakeCaret: s, isActive: o } = n?.slots[t] ?? {};
39
+ const n = p.useContext(l), { char: s, hasFakeCaret: o, isActive: d } = n?.slots[t] ?? {};
40
40
  return /* @__PURE__ */ u(
41
41
  "div",
42
42
  {
43
43
  "data-slot": "input-otp-slot",
44
- "data-active": o,
45
- className: r(
46
- "data-[active=true]:border-d-ring data-[active=true]:ring-d-ring/50 data-[active=true]:aria-invalid:ring-d-destructive/20 dark:data-[active=true]:aria-invalid:ring-d-destructive/40 aria-invalid:border-d-destructive data-[active=true]:aria-invalid:border-d-destructive dark:bg-d-input/30 border-d-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
44
+ "data-active": d,
45
+ className: a(
46
+ "data-[active=true]:border-d-ring data-[active=true]:ring-d-ring/50 data-[active=true]:aria-invalid:ring-d-destructive/20 aria-invalid:border-d-destructive data-[active=true]:aria-invalid:border-d-destructive border-d-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
47
47
  e
48
48
  ),
49
49
  ...i,
50
50
  children: [
51
- d,
52
- s && /* @__PURE__ */ a("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ a("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }) })
51
+ s,
52
+ o && /* @__PURE__ */ r("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ r("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }) })
53
53
  ]
54
54
  }
55
55
  );
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { jsx as t, jsxs as N } from "react/jsx-runtime";
3
- import * as c from "react";
4
- import { motion as s } from "framer-motion";
5
- import { cn as i } from "../../lib/utils.js";
3
+ import { cn as n } from "../../lib/utils.js";
4
+ import { motion as c } from "framer-motion";
5
+ import * as s from "react";
6
6
  const x = {
7
7
  container: {
8
8
  initial: { opacity: 0, y: 20 },
@@ -10,7 +10,7 @@ const x = {
10
10
  exit: { opacity: 0, y: -20 }
11
11
  }
12
12
  };
13
- function V({
13
+ function k({
14
14
  value: r = 1,
15
15
  onChange: l,
16
16
  min: p = 1,
@@ -19,39 +19,39 @@ function V({
19
19
  buttonClassName: d,
20
20
  counterClassName: h
21
21
  }) {
22
- const [e, a] = c.useState(r), [u, m] = c.useState(!1);
23
- c.useEffect(() => {
22
+ const [e, a] = s.useState(r), [u, m] = s.useState(!1);
23
+ s.useEffect(() => {
24
24
  a(r);
25
25
  }, [r]);
26
26
  const v = (o) => {
27
27
  if (o.preventDefault(), e < b) {
28
- const n = e + 1;
29
- a(n), l?.(n);
28
+ const i = e + 1;
29
+ a(i), l?.(i);
30
30
  } else
31
31
  f();
32
32
  }, y = (o) => {
33
33
  if (o.preventDefault(), e > p) {
34
- const n = e - 1;
35
- a(n), l?.(n);
34
+ const i = e - 1;
35
+ a(i), l?.(i);
36
36
  } else
37
37
  f();
38
38
  }, f = () => {
39
39
  m(!0), setTimeout(() => m(!1), 300);
40
40
  };
41
41
  return /* @__PURE__ */ t(
42
- s.div,
42
+ c.div,
43
43
  {
44
44
  "data-slot": "input-selector",
45
45
  variants: x.container,
46
46
  initial: "initial",
47
47
  animate: "animate",
48
48
  exit: "exit",
49
- className: i(
49
+ className: n(
50
50
  "flex w-full flex-col items-center justify-center gap-8",
51
51
  g
52
52
  ),
53
53
  children: /* @__PURE__ */ N(
54
- s.div,
54
+ c.div,
55
55
  {
56
56
  variants: u ? {
57
57
  initial: { x: 0 },
@@ -69,7 +69,7 @@ function V({
69
69
  {
70
70
  type: "button",
71
71
  onClick: y,
72
- className: i(
72
+ className: n(
73
73
  "border-d-border h-12 w-12 rounded-full",
74
74
  "bg-d-background",
75
75
  "hover:bg-d-accent hover:text-d-accent-foreground",
@@ -81,14 +81,14 @@ function V({
81
81
  }
82
82
  ),
83
83
  /* @__PURE__ */ t(
84
- s.span,
84
+ c.span,
85
85
  {
86
86
  variants: x.container,
87
87
  initial: "initial",
88
88
  animate: "animate",
89
89
  exit: "exit",
90
- className: i(
91
- "text-d-foreground dark:text-d-foreground text-2xl font-medium",
90
+ className: n(
91
+ "text-d-foreground text-2xl font-medium",
92
92
  h
93
93
  ),
94
94
  children: e
@@ -100,7 +100,7 @@ function V({
100
100
  {
101
101
  type: "button",
102
102
  onClick: v,
103
- className: i(
103
+ className: n(
104
104
  "border-d-border h-12 w-12 rounded-full border",
105
105
  "bg-d-background",
106
106
  "hover:bg-d-accent hover:text-d-accent-foreground",
@@ -118,5 +118,5 @@ function V({
118
118
  );
119
119
  }
120
120
  export {
121
- V as InputSelector
121
+ k as InputSelector
122
122
  };