laif-ds 0.2.24 → 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.
@@ -1,5 +1,8 @@
1
1
  "use client";
2
- var e = { exports: {} };
2
+ import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
+ import { __require as t } from "../node_modules/eventemitter3/index2.js";
4
+ var r = t();
5
+ const m = /* @__PURE__ */ e(r);
3
6
  export {
4
- e as __module
7
+ m as default
5
8
  };
@@ -1,8 +1,5 @@
1
1
  "use client";
2
- import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
- import { __require as t } from "../node_modules/eventemitter3/index2.js";
4
- var r = t();
5
- const m = /* @__PURE__ */ e(r);
2
+ var e = { exports: {} };
6
3
  export {
7
- m as default
4
+ e as __module
8
5
  };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- var e = {};
2
+ var e = { exports: {} };
3
3
  export {
4
- e as __exports
4
+ e as __module
5
5
  };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- var e = { exports: {} };
2
+ var e = {};
3
3
  export {
4
- e as __module
4
+ e as __exports
5
5
  };
@@ -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
  };
package/dist/index.d.ts CHANGED
@@ -1005,7 +1005,7 @@ export declare interface DataTableState {
1005
1005
  computedSorting?: DataTableSorting;
1006
1006
  }
1007
1007
 
1008
- export declare function DatePicker({ value, onChange, placeholder, dateFormat, className, buttonVariant, disabled, size, }: DatePickerProps): JSX.Element;
1008
+ export declare function DatePicker({ value, onChange, placeholder, dateFormat, className, buttonVariant, disabled, size, firstDate, lastDate, availableDates, }: DatePickerProps): JSX.Element;
1009
1009
 
1010
1010
  declare interface DatePickerProps {
1011
1011
  value?: Date;
@@ -1016,6 +1016,9 @@ declare interface DatePickerProps {
1016
1016
  buttonVariant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
1017
1017
  disabled?: boolean;
1018
1018
  size?: "sm" | "default" | "lg";
1019
+ firstDate?: Date;
1020
+ lastDate?: Date;
1021
+ availableDates?: Date[];
1019
1022
  }
1020
1023
 
1021
1024
  export declare function Dialog({ ...props }: React_2.ComponentProps<typeof DialogPrimitive.Root>): JSX.Element;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import e from "../../_virtual/index3.js";
2
+ import e from "../../_virtual/index2.js";
3
3
  export {
4
4
  e as EventEmitter,
5
5
  e as default
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __module as x } from "../../_virtual/index7.js";
2
+ import { __module as x } from "../../_virtual/index6.js";
3
3
  var w;
4
4
  function O() {
5
5
  return w ? x.exports : (w = 1, (function(d) {
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import e from "../../../../_virtual/index3.js";
2
+ import e from "../../../../_virtual/index2.js";
3
3
  var r = new e(), n = "recharts.syncEvent.tooltip";
4
4
  export {
5
5
  n as TOOLTIP_SYNC_EVENT,
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __exports as r } from "../../../_virtual/index6.js";
2
+ import { __exports as r } from "../../../_virtual/index7.js";
3
3
  import { __require as c } from "../../inline-style-parser/index.js";
4
4
  var f;
5
5
  function j() {
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __module as e } from "../../../_virtual/index2.js";
2
+ import { __module as e } from "../../../_virtual/index3.js";
3
3
  import { __require as i } from "../cjs/use-sync-external-store-shim.production.js";
4
4
  import { __require as o } from "../cjs/use-sync-external-store-shim.development.js";
5
5
  var r;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "laif-ds",
3
3
  "private": false,
4
- "version": "0.2.24",
4
+ "version": "0.2.25",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",