@ginia/ui 0.1.24 → 0.1.26

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.
package/AGENTS.md CHANGED
@@ -8,6 +8,8 @@
8
8
  - **Storybook (live)**: <https://ginia-ui.vercel.app>
9
9
  - **Component index (machine-readable)**: <https://ginia-ui.vercel.app/llms.txt>
10
10
 
11
+ After changing stories or UI docs, run `pnpm build-storybook` locally to confirm the static build (Vercel runs it on deploy). Dev server: `pnpm storybook`.
12
+
11
13
  ---
12
14
 
13
15
  ## Setup (in a consumer project)
@@ -65,4 +67,5 @@ import { cn } from "@ginia/ui";
65
67
  7. **Icons**: Icons are re-exported from `lucide-react` and should be imported from `@ginia/ui/icons`. For consistent sizing and accessibility, prefer using the `<Icon />` component from `@ginia/ui`.
66
68
  8. **Typography**: Use `<Typography variant="…" />` for headings, body, lead, caption, and display styles. Pass `className` to merge extra Tailwind utilities. Each variant has a default HTML tag; override with `as` or `asChild` when you need a different element (e.g. a link styled as a heading).
67
69
  9. **Brand lockup**: `<Wordmark />` combines the official `<Logo />` SVG with custom text (default “Ginia”). Use `className` on the root, `text` for the word, `size` (`sm` | `md` | `lg`), and optional `label` for screen readers (defaults to `text`).
68
- 10. **No business logic** in components they are purely presentational.
70
+ 10. **Dates**: `<Calendar />` (react-day-picker) defaults to Spanish via `locale={es}`. `<DatePicker />` uses month/year dropdowns and `locale` from `date-fns` (default `es`); pass `enUS` or another locale when needed. Optional `fromYear` / `toYear` bound the year list.
71
+ 11. **No business logic** in components — they are purely presentational.
@@ -36,7 +36,7 @@ const buttonVariants = (0, import_class_variance_authority.cva)(
36
36
  destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 focus-visible:ring-destructive/20",
37
37
  outline: "bg-card text-primary border border-input hover:bg-primary hover:text-primary-foreground shadow-sm",
38
38
  secondary: "bg-accent text-accent-foreground hover:bg-accent/90 shadow-sm",
39
- ghost: "hover:bg-secondary hover:text-secondary-foreground",
39
+ ghost: "hover:bg-accent hover:text-accent-foreground",
40
40
  link: "text-primary underline-offset-4 hover:underline",
41
41
  success: "bg-success text-success-foreground shadow-sm hover:bg-success/90",
42
42
  warning: "bg-warning text-warning-foreground shadow-sm hover:bg-warning/90"
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../../lib/utils\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all duration-200 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:ring-2 focus-visible:ring-ring/20 focus-visible:ring-offset-2\",\n {\n variants: {\n variant: {\n default: \"bg-primary hover:bg-primary-dark text-primary-foreground shadow-sm\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 focus-visible:ring-destructive/20\",\n outline:\n \"bg-card text-primary border border-input hover:bg-primary hover:text-primary-foreground shadow-sm\",\n secondary: \"bg-accent text-accent-foreground hover:bg-accent/90 shadow-sm\",\n ghost: \"hover:bg-secondary hover:text-secondary-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n success: \"bg-success text-success-foreground shadow-sm hover:bg-success/90\",\n warning: \"bg-warning text-warning-foreground shadow-sm hover:bg-warning/90\",\n },\n size: {\n default: \"px-4 py-2\",\n sm: \"px-3 py-1.5 text-sm\",\n lg: \"px-5 py-2.5 text-base\",\n icon: \"size-9 p-2\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nfunction Button({\n className,\n variant,\n size,\n asChild = false,\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n }) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n );\n}\n\nexport { Button, buttonVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmDI;AAhDJ,wBAAqB;AACrB,sCAAuC;AAEvC,mBAAmB;AAEnB,MAAM,qBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,aACE;AAAA,QACF,SACE;AAAA,QACF,WAAW;AAAA,QACX,OAAO;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,MACA,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAEA,SAAS,OAAO;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,GAGK;AACH,QAAM,OAAO,UAAU,yBAAO;AAE9B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,eAAW,iBAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,MACzD,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../../lib/utils\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all duration-200 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:ring-2 focus-visible:ring-ring/20 focus-visible:ring-offset-2\",\n {\n variants: {\n variant: {\n default: \"bg-primary hover:bg-primary-dark text-primary-foreground shadow-sm\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 focus-visible:ring-destructive/20\",\n outline:\n \"bg-card text-primary border border-input hover:bg-primary hover:text-primary-foreground shadow-sm\",\n secondary: \"bg-accent text-accent-foreground hover:bg-accent/90 shadow-sm\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n success: \"bg-success text-success-foreground shadow-sm hover:bg-success/90\",\n warning: \"bg-warning text-warning-foreground shadow-sm hover:bg-warning/90\",\n },\n size: {\n default: \"px-4 py-2\",\n sm: \"px-3 py-1.5 text-sm\",\n lg: \"px-5 py-2.5 text-base\",\n icon: \"size-9 p-2\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nfunction Button({\n className,\n variant,\n size,\n asChild = false,\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n }) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n );\n}\n\nexport { Button, buttonVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmDI;AAhDJ,wBAAqB;AACrB,sCAAuC;AAEvC,mBAAmB;AAEnB,MAAM,qBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,aACE;AAAA,QACF,SACE;AAAA,QACF,WAAW;AAAA,QACX,OAAO;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,MACA,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAEA,SAAS,OAAO;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,GAGK;AACH,QAAM,OAAO,UAAU,yBAAO;AAE9B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,eAAW,iBAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,MACzD,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
@@ -12,7 +12,7 @@ const buttonVariants = cva(
12
12
  destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 focus-visible:ring-destructive/20",
13
13
  outline: "bg-card text-primary border border-input hover:bg-primary hover:text-primary-foreground shadow-sm",
14
14
  secondary: "bg-accent text-accent-foreground hover:bg-accent/90 shadow-sm",
15
- ghost: "hover:bg-secondary hover:text-secondary-foreground",
15
+ ghost: "hover:bg-accent hover:text-accent-foreground",
16
16
  link: "text-primary underline-offset-4 hover:underline",
17
17
  success: "bg-success text-success-foreground shadow-sm hover:bg-success/90",
18
18
  warning: "bg-warning text-warning-foreground shadow-sm hover:bg-warning/90"
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../../lib/utils\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all duration-200 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:ring-2 focus-visible:ring-ring/20 focus-visible:ring-offset-2\",\n {\n variants: {\n variant: {\n default: \"bg-primary hover:bg-primary-dark text-primary-foreground shadow-sm\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 focus-visible:ring-destructive/20\",\n outline:\n \"bg-card text-primary border border-input hover:bg-primary hover:text-primary-foreground shadow-sm\",\n secondary: \"bg-accent text-accent-foreground hover:bg-accent/90 shadow-sm\",\n ghost: \"hover:bg-secondary hover:text-secondary-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n success: \"bg-success text-success-foreground shadow-sm hover:bg-success/90\",\n warning: \"bg-warning text-warning-foreground shadow-sm hover:bg-warning/90\",\n },\n size: {\n default: \"px-4 py-2\",\n sm: \"px-3 py-1.5 text-sm\",\n lg: \"px-5 py-2.5 text-base\",\n icon: \"size-9 p-2\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nfunction Button({\n className,\n variant,\n size,\n asChild = false,\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n }) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n );\n}\n\nexport { Button, buttonVariants };\n"],"mappings":";AAmDI;AAhDJ,SAAS,YAAY;AACrB,SAAS,WAA8B;AAEvC,SAAS,UAAU;AAEnB,MAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,aACE;AAAA,QACF,SACE;AAAA,QACF,WAAW;AAAA,QACX,OAAO;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,MACA,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAEA,SAAS,OAAO;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,GAGK;AACH,QAAM,OAAO,UAAU,OAAO;AAE9B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,MACzD,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../../lib/utils\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all duration-200 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:ring-2 focus-visible:ring-ring/20 focus-visible:ring-offset-2\",\n {\n variants: {\n variant: {\n default: \"bg-primary hover:bg-primary-dark text-primary-foreground shadow-sm\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 focus-visible:ring-destructive/20\",\n outline:\n \"bg-card text-primary border border-input hover:bg-primary hover:text-primary-foreground shadow-sm\",\n secondary: \"bg-accent text-accent-foreground hover:bg-accent/90 shadow-sm\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n success: \"bg-success text-success-foreground shadow-sm hover:bg-success/90\",\n warning: \"bg-warning text-warning-foreground shadow-sm hover:bg-warning/90\",\n },\n size: {\n default: \"px-4 py-2\",\n sm: \"px-3 py-1.5 text-sm\",\n lg: \"px-5 py-2.5 text-base\",\n icon: \"size-9 p-2\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nfunction Button({\n className,\n variant,\n size,\n asChild = false,\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n }) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n );\n}\n\nexport { Button, buttonVariants };\n"],"mappings":";AAmDI;AAhDJ,SAAS,YAAY;AACrB,SAAS,WAA8B;AAEvC,SAAS,UAAU;AAEnB,MAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,aACE;AAAA,QACF,SACE;AAAA,QACF,WAAW;AAAA,QACX,OAAO;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,MACA,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAEA,SAAS,OAAO;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,GAGK;AACH,QAAM,OAAO,UAAU,OAAO;AAE9B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,MACzD,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
@@ -24,14 +24,22 @@ __export(calendar_exports, {
24
24
  module.exports = __toCommonJS(calendar_exports);
25
25
  var import_jsx_runtime = require("react/jsx-runtime");
26
26
  var import_react_day_picker = require("react-day-picker");
27
+ var import_locale = require("date-fns/locale");
28
+ var import_lucide_react = require("lucide-react");
27
29
  var import_utils = require("../../../lib/utils");
28
30
  var import_button = require("../button");
29
- function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
31
+ function Calendar({ className, classNames, showOutsideDays = true, locale = import_locale.enUS, components, ...props }) {
30
32
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
31
33
  import_react_day_picker.DayPicker,
32
34
  {
33
35
  showOutsideDays,
34
- className: (0, import_utils.cn)("p-3", className),
36
+ locale,
37
+ className: (0, import_utils.cn)("rounded-md bg-white p-3 dark:bg-card", className),
38
+ components: {
39
+ IconLeft: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronLeft, { className: "h-4 w-4" }),
40
+ IconRight: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronRight, { className: "h-4 w-4" }),
41
+ ...components
42
+ },
35
43
  classNames: {
36
44
  months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
37
45
  month: "space-y-4",
@@ -39,8 +47,8 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
39
47
  caption_label: "text-sm font-medium",
40
48
  nav: "space-x-1 flex items-center",
41
49
  nav_button: (0, import_utils.cn)(
42
- (0, import_button.buttonVariants)({ variant: "outline" }),
43
- "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
50
+ (0, import_button.buttonVariants)({ variant: "outline", size: "sm" }),
51
+ "h-9 w-9 shrink-0 p-0 hover:bg-muted hover:text-foreground"
44
52
  ),
45
53
  nav_button_previous: "absolute left-1",
46
54
  nav_button_next: "absolute right-1",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/ui/calendar/calendar.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { DayPicker } from \"react-day-picker\";\n\nimport { cn } from \"../../../lib/utils\";\nimport { buttonVariants } from \"../button\";\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>;\n\nfunction Calendar({ className, classNames, showOutsideDays = true, ...props }: CalendarProps) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\"p-3\", className)}\n classNames={{\n months: \"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0\",\n month: \"space-y-4\",\n caption: \"flex justify-center pt-1 relative items-center\",\n caption_label: \"text-sm font-medium\",\n nav: \"space-x-1 flex items-center\",\n nav_button: cn(\n buttonVariants({ variant: \"outline\" }),\n \"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100\",\n ),\n nav_button_previous: \"absolute left-1\",\n nav_button_next: \"absolute right-1\",\n table: \"w-full border-collapse space-y-1\",\n head_row: \"flex\",\n head_cell: \"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]\",\n row: \"flex w-full mt-2\",\n cell: \"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20\",\n day: cn(\n buttonVariants({ variant: \"ghost\" }),\n \"h-9 w-9 p-0 font-normal aria-selected:opacity-100\",\n ),\n day_range_end: \"day-range-end\",\n day_selected:\n \"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground\",\n day_today: \"bg-accent text-accent-foreground\",\n day_outside:\n \"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30\",\n day_disabled: \"text-muted-foreground opacity-50\",\n day_range_middle: \"aria-selected:bg-accent aria-selected:text-accent-foreground\",\n day_hidden: \"invisible\",\n ...classNames,\n }}\n {...props}\n />\n );\n}\n\nexport { Calendar };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYI;AATJ,8BAA0B;AAE1B,mBAAmB;AACnB,oBAA+B;AAI/B,SAAS,SAAS,EAAE,WAAW,YAAY,kBAAkB,MAAM,GAAG,MAAM,GAAkB;AAC5F,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAW,iBAAG,OAAO,SAAS;AAAA,MAC9B,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,SAAS;AAAA,QACT,eAAe;AAAA,QACf,KAAK;AAAA,QACL,gBAAY;AAAA,cACV,8BAAe,EAAE,SAAS,UAAU,CAAC;AAAA,UACrC;AAAA,QACF;AAAA,QACA,qBAAqB;AAAA,QACrB,iBAAiB;AAAA,QACjB,OAAO;AAAA,QACP,UAAU;AAAA,QACV,WAAW;AAAA,QACX,KAAK;AAAA,QACL,MAAM;AAAA,QACN,SAAK;AAAA,cACH,8BAAe,EAAE,SAAS,QAAQ,CAAC;AAAA,UACnC;AAAA,QACF;AAAA,QACA,eAAe;AAAA,QACf,cACE;AAAA,QACF,WAAW;AAAA,QACX,aACE;AAAA,QACF,cAAc;AAAA,QACd,kBAAkB;AAAA,QAClB,YAAY;AAAA,QACZ,GAAG;AAAA,MACL;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/ui/calendar/calendar.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { DayPicker } from \"react-day-picker\";\nimport { enUS } from \"date-fns/locale\";\n\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\n\nimport { cn } from \"../../../lib/utils\";\nimport { buttonVariants } from \"../button\";\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>;\n\nfunction Calendar({ className, classNames, showOutsideDays = true, locale = enUS, components, ...props }: CalendarProps) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n locale={locale}\n className={cn(\"rounded-md bg-white p-3 dark:bg-card\", className)}\n components={{\n IconLeft: () => <ChevronLeft className=\"h-4 w-4\" />,\n IconRight: () => <ChevronRight className=\"h-4 w-4\" />,\n ...components,\n }}\n classNames={{\n months: \"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0\",\n month: \"space-y-4\",\n caption: \"flex justify-center pt-1 relative items-center\",\n caption_label: \"text-sm font-medium\",\n nav: \"space-x-1 flex items-center\",\n nav_button: cn(\n buttonVariants({ variant: \"outline\", size: \"sm\" }),\n \"h-9 w-9 shrink-0 p-0 hover:bg-muted hover:text-foreground\",\n ),\n nav_button_previous: \"absolute left-1\",\n nav_button_next: \"absolute right-1\",\n table: \"w-full border-collapse space-y-1\",\n head_row: \"flex\",\n head_cell: \"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]\",\n row: \"flex w-full mt-2\",\n cell: \"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20\",\n day: cn(\n buttonVariants({ variant: \"ghost\" }),\n \"h-9 w-9 p-0 font-normal aria-selected:opacity-100\",\n ),\n day_range_end: \"day-range-end\",\n day_selected:\n \"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground\",\n day_today: \"bg-accent text-accent-foreground\",\n day_outside:\n \"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30\",\n day_disabled: \"text-muted-foreground opacity-50\",\n day_range_middle: \"aria-selected:bg-accent aria-selected:text-accent-foreground\",\n day_hidden: \"invisible\",\n ...classNames,\n }}\n {...props}\n />\n );\n}\n\nexport { Calendar };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBwB;AAjBxB,8BAA0B;AAC1B,oBAAqB;AAErB,0BAA0C;AAE1C,mBAAmB;AACnB,oBAA+B;AAI/B,SAAS,SAAS,EAAE,WAAW,YAAY,kBAAkB,MAAM,SAAS,oBAAM,YAAY,GAAG,MAAM,GAAkB;AACvH,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,eAAW,iBAAG,wCAAwC,SAAS;AAAA,MAC/D,YAAY;AAAA,QACV,UAAU,MAAM,4CAAC,mCAAY,WAAU,WAAU;AAAA,QACjD,WAAW,MAAM,4CAAC,oCAAa,WAAU,WAAU;AAAA,QACnD,GAAG;AAAA,MACL;AAAA,MACA,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,SAAS;AAAA,QACT,eAAe;AAAA,QACf,KAAK;AAAA,QACL,gBAAY;AAAA,cACV,8BAAe,EAAE,SAAS,WAAW,MAAM,KAAK,CAAC;AAAA,UACjD;AAAA,QACF;AAAA,QACA,qBAAqB;AAAA,QACrB,iBAAiB;AAAA,QACjB,OAAO;AAAA,QACP,UAAU;AAAA,QACV,WAAW;AAAA,QACX,KAAK;AAAA,QACL,MAAM;AAAA,QACN,SAAK;AAAA,cACH,8BAAe,EAAE,SAAS,QAAQ,CAAC;AAAA,UACnC;AAAA,QACF;AAAA,QACA,eAAe;AAAA,QACf,cACE;AAAA,QACF,WAAW;AAAA,QACX,aACE;AAAA,QACF,cAAc;AAAA,QACd,kBAAkB;AAAA,QAClB,YAAY;AAAA,QACZ,GAAG;AAAA,MACL;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
@@ -3,6 +3,6 @@ import * as React from 'react';
3
3
  import { DayPicker } from 'react-day-picker';
4
4
 
5
5
  type CalendarProps = React.ComponentProps<typeof DayPicker>;
6
- declare function Calendar({ className, classNames, showOutsideDays, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
6
+ declare function Calendar({ className, classNames, showOutsideDays, locale, components, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
7
7
 
8
8
  export { Calendar, type CalendarProps };
@@ -3,6 +3,6 @@ import * as React from 'react';
3
3
  import { DayPicker } from 'react-day-picker';
4
4
 
5
5
  type CalendarProps = React.ComponentProps<typeof DayPicker>;
6
- declare function Calendar({ className, classNames, showOutsideDays, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
6
+ declare function Calendar({ className, classNames, showOutsideDays, locale, components, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
7
7
 
8
8
  export { Calendar, type CalendarProps };
@@ -1,14 +1,22 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { DayPicker } from "react-day-picker";
4
+ import { enUS } from "date-fns/locale";
5
+ import { ChevronLeft, ChevronRight } from "lucide-react";
4
6
  import { cn } from "../../../lib/utils";
5
7
  import { buttonVariants } from "../button";
6
- function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
8
+ function Calendar({ className, classNames, showOutsideDays = true, locale = enUS, components, ...props }) {
7
9
  return /* @__PURE__ */ jsx(
8
10
  DayPicker,
9
11
  {
10
12
  showOutsideDays,
11
- className: cn("p-3", className),
13
+ locale,
14
+ className: cn("rounded-md bg-white p-3 dark:bg-card", className),
15
+ components: {
16
+ IconLeft: () => /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
17
+ IconRight: () => /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }),
18
+ ...components
19
+ },
12
20
  classNames: {
13
21
  months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
14
22
  month: "space-y-4",
@@ -16,8 +24,8 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
16
24
  caption_label: "text-sm font-medium",
17
25
  nav: "space-x-1 flex items-center",
18
26
  nav_button: cn(
19
- buttonVariants({ variant: "outline" }),
20
- "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
27
+ buttonVariants({ variant: "outline", size: "sm" }),
28
+ "h-9 w-9 shrink-0 p-0 hover:bg-muted hover:text-foreground"
21
29
  ),
22
30
  nav_button_previous: "absolute left-1",
23
31
  nav_button_next: "absolute right-1",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/ui/calendar/calendar.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { DayPicker } from \"react-day-picker\";\n\nimport { cn } from \"../../../lib/utils\";\nimport { buttonVariants } from \"../button\";\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>;\n\nfunction Calendar({ className, classNames, showOutsideDays = true, ...props }: CalendarProps) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\"p-3\", className)}\n classNames={{\n months: \"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0\",\n month: \"space-y-4\",\n caption: \"flex justify-center pt-1 relative items-center\",\n caption_label: \"text-sm font-medium\",\n nav: \"space-x-1 flex items-center\",\n nav_button: cn(\n buttonVariants({ variant: \"outline\" }),\n \"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100\",\n ),\n nav_button_previous: \"absolute left-1\",\n nav_button_next: \"absolute right-1\",\n table: \"w-full border-collapse space-y-1\",\n head_row: \"flex\",\n head_cell: \"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]\",\n row: \"flex w-full mt-2\",\n cell: \"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20\",\n day: cn(\n buttonVariants({ variant: \"ghost\" }),\n \"h-9 w-9 p-0 font-normal aria-selected:opacity-100\",\n ),\n day_range_end: \"day-range-end\",\n day_selected:\n \"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground\",\n day_today: \"bg-accent text-accent-foreground\",\n day_outside:\n \"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30\",\n day_disabled: \"text-muted-foreground opacity-50\",\n day_range_middle: \"aria-selected:bg-accent aria-selected:text-accent-foreground\",\n day_hidden: \"invisible\",\n ...classNames,\n }}\n {...props}\n />\n );\n}\n\nexport { Calendar };\n"],"mappings":";AAYI;AATJ,SAAS,iBAAiB;AAE1B,SAAS,UAAU;AACnB,SAAS,sBAAsB;AAI/B,SAAS,SAAS,EAAE,WAAW,YAAY,kBAAkB,MAAM,GAAG,MAAM,GAAkB;AAC5F,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,OAAO,SAAS;AAAA,MAC9B,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,SAAS;AAAA,QACT,eAAe;AAAA,QACf,KAAK;AAAA,QACL,YAAY;AAAA,UACV,eAAe,EAAE,SAAS,UAAU,CAAC;AAAA,UACrC;AAAA,QACF;AAAA,QACA,qBAAqB;AAAA,QACrB,iBAAiB;AAAA,QACjB,OAAO;AAAA,QACP,UAAU;AAAA,QACV,WAAW;AAAA,QACX,KAAK;AAAA,QACL,MAAM;AAAA,QACN,KAAK;AAAA,UACH,eAAe,EAAE,SAAS,QAAQ,CAAC;AAAA,UACnC;AAAA,QACF;AAAA,QACA,eAAe;AAAA,QACf,cACE;AAAA,QACF,WAAW;AAAA,QACX,aACE;AAAA,QACF,cAAc;AAAA,QACd,kBAAkB;AAAA,QAClB,YAAY;AAAA,QACZ,GAAG;AAAA,MACL;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/ui/calendar/calendar.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { DayPicker } from \"react-day-picker\";\nimport { enUS } from \"date-fns/locale\";\n\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\n\nimport { cn } from \"../../../lib/utils\";\nimport { buttonVariants } from \"../button\";\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>;\n\nfunction Calendar({ className, classNames, showOutsideDays = true, locale = enUS, components, ...props }: CalendarProps) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n locale={locale}\n className={cn(\"rounded-md bg-white p-3 dark:bg-card\", className)}\n components={{\n IconLeft: () => <ChevronLeft className=\"h-4 w-4\" />,\n IconRight: () => <ChevronRight className=\"h-4 w-4\" />,\n ...components,\n }}\n classNames={{\n months: \"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0\",\n month: \"space-y-4\",\n caption: \"flex justify-center pt-1 relative items-center\",\n caption_label: \"text-sm font-medium\",\n nav: \"space-x-1 flex items-center\",\n nav_button: cn(\n buttonVariants({ variant: \"outline\", size: \"sm\" }),\n \"h-9 w-9 shrink-0 p-0 hover:bg-muted hover:text-foreground\",\n ),\n nav_button_previous: \"absolute left-1\",\n nav_button_next: \"absolute right-1\",\n table: \"w-full border-collapse space-y-1\",\n head_row: \"flex\",\n head_cell: \"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]\",\n row: \"flex w-full mt-2\",\n cell: \"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20\",\n day: cn(\n buttonVariants({ variant: \"ghost\" }),\n \"h-9 w-9 p-0 font-normal aria-selected:opacity-100\",\n ),\n day_range_end: \"day-range-end\",\n day_selected:\n \"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground\",\n day_today: \"bg-accent text-accent-foreground\",\n day_outside:\n \"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30\",\n day_disabled: \"text-muted-foreground opacity-50\",\n day_range_middle: \"aria-selected:bg-accent aria-selected:text-accent-foreground\",\n day_hidden: \"invisible\",\n ...classNames,\n }}\n {...props}\n />\n );\n}\n\nexport { Calendar };\n"],"mappings":";AAoBwB;AAjBxB,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AAErB,SAAS,aAAa,oBAAoB;AAE1C,SAAS,UAAU;AACnB,SAAS,sBAAsB;AAI/B,SAAS,SAAS,EAAE,WAAW,YAAY,kBAAkB,MAAM,SAAS,MAAM,YAAY,GAAG,MAAM,GAAkB;AACvH,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAW,GAAG,wCAAwC,SAAS;AAAA,MAC/D,YAAY;AAAA,QACV,UAAU,MAAM,oBAAC,eAAY,WAAU,WAAU;AAAA,QACjD,WAAW,MAAM,oBAAC,gBAAa,WAAU,WAAU;AAAA,QACnD,GAAG;AAAA,MACL;AAAA,MACA,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,SAAS;AAAA,QACT,eAAe;AAAA,QACf,KAAK;AAAA,QACL,YAAY;AAAA,UACV,eAAe,EAAE,SAAS,WAAW,MAAM,KAAK,CAAC;AAAA,UACjD;AAAA,QACF;AAAA,QACA,qBAAqB;AAAA,QACrB,iBAAiB;AAAA,QACjB,OAAO;AAAA,QACP,UAAU;AAAA,QACV,WAAW;AAAA,QACX,KAAK;AAAA,QACL,MAAM;AAAA,QACN,KAAK;AAAA,UACH,eAAe,EAAE,SAAS,QAAQ,CAAC;AAAA,UACnC;AAAA,QACF;AAAA,QACA,eAAe;AAAA,QACf,cACE;AAAA,QACF,WAAW;AAAA,QACX,aACE;AAAA,QACF,cAAc;AAAA,QACd,kBAAkB;AAAA,QAClB,YAAY;AAAA,QACZ,GAAG;AAAA,MACL;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
@@ -40,64 +40,152 @@ var import_lucide_react = require("lucide-react");
40
40
  var import_utils = require("../../../lib/utils");
41
41
  var import_button = require("../button");
42
42
  var import_popover = require("../popover");
43
- const monthNames = [
44
- "Enero",
45
- "Febrero",
46
- "Marzo",
47
- "Abril",
48
- "Mayo",
49
- "Junio",
50
- "Julio",
51
- "Agosto",
52
- "Septiembre",
53
- "Octubre",
54
- "Noviembre",
55
- "Diciembre"
56
- ];
57
- const dayNames = ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "S\xE1"];
43
+ function getWeekStartsOn(locale) {
44
+ const w = locale.options?.weekStartsOn;
45
+ if (w === void 0) return 1;
46
+ return w;
47
+ }
48
+ function useMonthLabels(locale) {
49
+ return React.useMemo(
50
+ () => Array.from({ length: 12 }, (_, i) => (0, import_date_fns.format)(new Date(2024, i, 1), "LLL", { locale })),
51
+ [locale]
52
+ );
53
+ }
54
+ function weekdayTwoLetterLabel(abbrev) {
55
+ const graphemes = [...abbrev.normalize("NFC")];
56
+ if (graphemes.length <= 2) {
57
+ return abbrev;
58
+ }
59
+ return graphemes.slice(0, 2).join("");
60
+ }
61
+ function useWeekdayLabels(locale) {
62
+ return React.useMemo(() => {
63
+ const weekStartsOn = getWeekStartsOn(locale);
64
+ const start = (0, import_date_fns.startOfWeek)(new Date(2024, 0, 3), { weekStartsOn });
65
+ return Array.from({ length: 7 }, (_, i) => {
66
+ const abbrev = (0, import_date_fns.format)((0, import_date_fns.addDays)(start, i), "EEE", { locale });
67
+ return weekdayTwoLetterLabel(abbrev);
68
+ });
69
+ }, [locale]);
70
+ }
71
+ function getDaysInMonth(date, weekStartsOn) {
72
+ const year = date.getFullYear();
73
+ const month = date.getMonth();
74
+ const lastDay = new Date(year, month + 1, 0);
75
+ const daysInMonth = lastDay.getDate();
76
+ const firstDay = new Date(year, month, 1);
77
+ const startingDayOfWeek = firstDay.getDay();
78
+ const offset = (startingDayOfWeek - weekStartsOn + 7) % 7;
79
+ const days = [];
80
+ for (let i = 0; i < offset; i++) {
81
+ days.push(null);
82
+ }
83
+ for (let day = 1; day <= daysInMonth; day++) {
84
+ days.push(new Date(year, month, day));
85
+ }
86
+ return days;
87
+ }
88
+ function DatePickerSelect({
89
+ className,
90
+ wrapperClassName,
91
+ children,
92
+ ...props
93
+ }) {
94
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
95
+ "div",
96
+ {
97
+ className: (0, import_utils.cn)(
98
+ "relative flex min-h-9 w-full min-w-0 items-center rounded-md border border-input bg-card shadow-xs transition-colors",
99
+ /* Los navegadores suelen ignorar hover:bg en <select>; el hover va en el wrapper */
100
+ "hover:bg-muted/80",
101
+ "focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50",
102
+ "has-[:disabled]:opacity-50",
103
+ wrapperClassName
104
+ ),
105
+ children: [
106
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
107
+ "select",
108
+ {
109
+ ...props,
110
+ className: (0, import_utils.cn)(
111
+ "h-9 w-full min-w-0 flex-1 cursor-pointer appearance-none border-0 bg-transparent py-0 pl-2 pr-9 text-left text-sm text-foreground outline-none",
112
+ "disabled:cursor-not-allowed",
113
+ className
114
+ ),
115
+ children
116
+ }
117
+ ),
118
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
119
+ import_lucide_react.ChevronDown,
120
+ {
121
+ className: "pointer-events-none absolute right-2 top-1/2 size-4 -translate-y-1/2 shrink-0 text-muted-foreground opacity-80",
122
+ "aria-hidden": true
123
+ }
124
+ )
125
+ ]
126
+ }
127
+ );
128
+ }
58
129
  function DatePicker({
59
130
  value,
60
131
  onChange,
61
- placeholder = "Seleccionar fecha",
132
+ placeholder = "Pick a date",
62
133
  disabled = false,
63
- className
134
+ className,
135
+ locale = import_locale.enUS,
136
+ fromYear,
137
+ toYear
64
138
  }) {
65
139
  const [open, setOpen] = React.useState(false);
66
- const [currentMonth, setCurrentMonth] = React.useState(value || /* @__PURE__ */ new Date());
67
- const getDaysInMonth = (date) => {
68
- const year = date.getFullYear();
69
- const month = date.getMonth();
70
- const firstDay = new Date(year, month, 1);
71
- const lastDay = new Date(year, month + 1, 0);
72
- const daysInMonth = lastDay.getDate();
73
- const startingDayOfWeek = firstDay.getDay();
74
- const days2 = [];
75
- for (let i = 0; i < startingDayOfWeek; i++) {
76
- days2.push(null);
140
+ const [currentMonth, setCurrentMonth] = React.useState(() => {
141
+ const base = value ?? /* @__PURE__ */ new Date();
142
+ return new Date(base.getFullYear(), base.getMonth(), 1);
143
+ });
144
+ const monthLabels = useMonthLabels(locale);
145
+ const weekdayLabels = useWeekdayLabels(locale);
146
+ const weekStartsOn = getWeekStartsOn(locale);
147
+ React.useEffect(() => {
148
+ if (value) {
149
+ setCurrentMonth(new Date(value.getFullYear(), value.getMonth(), 1));
77
150
  }
78
- for (let day = 1; day <= daysInMonth; day++) {
79
- days2.push(new Date(Date.UTC(year, month, day)));
151
+ }, [value]);
152
+ const days = React.useMemo(
153
+ () => getDaysInMonth(currentMonth, weekStartsOn),
154
+ [currentMonth, weekStartsOn]
155
+ );
156
+ const yearOptions = React.useMemo(() => {
157
+ const y = (/* @__PURE__ */ new Date()).getFullYear();
158
+ const from = fromYear ?? y - 100;
159
+ const to = toYear ?? y + 10;
160
+ const list = [];
161
+ for (let i = from; i <= to; i++) {
162
+ list.push(i);
80
163
  }
81
- return days2;
82
- };
83
- const days = getDaysInMonth(currentMonth);
164
+ return list;
165
+ }, [fromYear, toYear]);
84
166
  const handleDateSelect = (date) => {
85
167
  onChange?.(date);
86
168
  setOpen(false);
87
169
  };
88
170
  const goToPreviousMonth = () => {
89
- setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1));
171
+ setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1, 1));
90
172
  };
91
173
  const goToNextMonth = () => {
92
- setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1));
174
+ setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1, 1));
175
+ };
176
+ const setMonthFromSelect = (monthIndex) => {
177
+ setCurrentMonth(new Date(currentMonth.getFullYear(), monthIndex, 1));
178
+ };
179
+ const setYearFromSelect = (year) => {
180
+ setCurrentMonth(new Date(year, currentMonth.getMonth(), 1));
93
181
  };
94
182
  const isToday = (date) => {
95
183
  const today = /* @__PURE__ */ new Date();
96
- return date.getUTCFullYear() === today.getFullYear() && date.getUTCMonth() === today.getMonth() && date.getUTCDate() === today.getDate();
184
+ return date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() && date.getDate() === today.getDate();
97
185
  };
98
186
  const isSelected = (date) => {
99
187
  if (!value) return false;
100
- return date.getUTCFullYear() === value.getFullYear() && date.getUTCMonth() === value.getMonth() && date.getUTCDate() === value.getDate();
188
+ return date.getFullYear() === value.getFullYear() && date.getMonth() === value.getMonth() && date.getDate() === value.getDate();
101
189
  };
102
190
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_popover.Popover, { open, onOpenChange: setOpen, children: [
103
191
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popover.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -107,37 +195,85 @@ function DatePicker({
107
195
  "data-slot": "date-picker",
108
196
  className: (0, import_utils.cn)(
109
197
  "w-full justify-start text-left font-normal",
198
+ /* outline usa hover:bg-primary; aquí queremos un hover neutro */
199
+ "hover:bg-muted hover:text-foreground",
110
200
  !value && "text-muted-foreground",
111
201
  className
112
202
  ),
113
203
  disabled,
114
204
  children: [
115
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Calendar, { className: "mr-2 h-4 w-4" }),
116
- value ? (0, import_date_fns.format)(value, "dd/MM/yyyy", { locale: import_locale.es }) : placeholder
205
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Calendar, { className: "mr-2 h-4 w-4 shrink-0" }),
206
+ value ? (0, import_date_fns.format)(value, "P", { locale }) : placeholder
117
207
  ]
118
208
  }
119
209
  ) }),
120
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popover.PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "p-3", children: [
121
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mb-4 flex items-center justify-between", children: [
122
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "outline", size: "sm", onClick: goToPreviousMonth, className: "h-7 w-7 p-0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronLeft, { className: "h-4 w-4" }) }),
123
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-sm font-medium", children: [
124
- monthNames[currentMonth.getMonth()],
125
- " ",
126
- currentMonth.getFullYear()
127
- ] }),
128
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "outline", size: "sm", onClick: goToNextMonth, className: "h-7 w-7 p-0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronRight, { className: "h-4 w-4" }) })
210
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popover.PopoverContent, { className: "w-auto bg-white p-0 dark:bg-card", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "p-3", children: [
211
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mb-3 flex flex-wrap items-center justify-center gap-1.5", children: [
212
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
213
+ import_button.Button,
214
+ {
215
+ type: "button",
216
+ variant: "outline",
217
+ size: "sm",
218
+ onClick: goToPreviousMonth,
219
+ className: "h-9 w-9 shrink-0 p-0 hover:bg-muted hover:text-foreground",
220
+ "aria-label": locale.code?.startsWith("es") ? "Mes anterior" : "Previous month",
221
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronLeft, { className: "h-4 w-4" })
222
+ }
223
+ ),
224
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
225
+ DatePickerSelect,
226
+ {
227
+ wrapperClassName: "w-[6.75rem] shrink-0",
228
+ value: currentMonth.getMonth(),
229
+ onChange: (e) => setMonthFromSelect(Number(e.target.value)),
230
+ "aria-label": locale.code?.startsWith("es") ? "Mes" : "Month",
231
+ children: monthLabels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: i, children: label }, label))
232
+ }
233
+ ),
234
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
235
+ DatePickerSelect,
236
+ {
237
+ wrapperClassName: "w-[5.5rem] shrink-0",
238
+ className: "tabular-nums text-center",
239
+ value: currentMonth.getFullYear(),
240
+ onChange: (e) => setYearFromSelect(Number(e.target.value)),
241
+ "aria-label": locale.code?.startsWith("es") ? "A\xF1o" : "Year",
242
+ children: yearOptions.map((y) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: y, children: y }, y))
243
+ }
244
+ ),
245
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
246
+ import_button.Button,
247
+ {
248
+ type: "button",
249
+ variant: "outline",
250
+ size: "sm",
251
+ onClick: goToNextMonth,
252
+ className: "h-9 w-9 shrink-0 p-0 hover:bg-muted hover:text-foreground",
253
+ "aria-label": locale.code?.startsWith("es") ? "Mes siguiente" : "Next month",
254
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronRight, { className: "h-4 w-4" })
255
+ }
256
+ )
129
257
  ] }),
130
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mb-2 grid grid-cols-7 gap-1", children: dayNames.map((day) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "py-2 text-center text-xs font-medium text-muted-foreground", children: day }, day)) }),
258
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mb-2 grid grid-cols-7 gap-1", children: weekdayLabels.map((day, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
259
+ "div",
260
+ {
261
+ className: "px-0.5 py-2 text-center text-sm font-medium capitalize leading-tight text-muted-foreground",
262
+ children: day
263
+ },
264
+ i
265
+ )) }),
131
266
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-7 gap-1", children: days.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex h-9 w-9 items-center justify-center", children: day ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
132
267
  import_button.Button,
133
268
  {
269
+ type: "button",
134
270
  variant: "ghost",
135
271
  size: "sm",
136
272
  className: (0, import_utils.cn)(
137
273
  "h-9 w-9 p-0 font-normal",
138
- isSelected(day) && "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground",
139
- isToday(day) && !isSelected(day) && "bg-accent text-accent-foreground",
140
- "hover:bg-muted"
274
+ isSelected(day) && "bg-primary text-primary-foreground hover:bg-primary-dark hover:text-primary-foreground",
275
+ isToday(day) && !isSelected(day) && "bg-accent text-accent-foreground hover:bg-accent/80 hover:text-accent-foreground",
276
+ !isSelected(day) && !isToday(day) && "hover:bg-muted hover:text-foreground"
141
277
  ),
142
278
  onClick: () => handleDateSelect(day),
143
279
  children: day.getDate()
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/ui/date-picker/date-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { format } from \"date-fns\";\nimport { es } from \"date-fns/locale\";\nimport { Calendar as CalendarIcon, ChevronLeft, ChevronRight } from \"lucide-react\";\n\nimport { cn } from \"../../../lib/utils\";\nimport { Button } from \"../button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\n\nexport interface DatePickerProps {\n value?: Date;\n onChange?: (date: Date | undefined) => void;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n}\n\nconst monthNames = [\n \"Enero\",\n \"Febrero\",\n \"Marzo\",\n \"Abril\",\n \"Mayo\",\n \"Junio\",\n \"Julio\",\n \"Agosto\",\n \"Septiembre\",\n \"Octubre\",\n \"Noviembre\",\n \"Diciembre\",\n];\nconst dayNames = [\"Do\", \"Lu\", \"Ma\", \"Mi\", \"Ju\", \"Vi\", \"Sá\"];\n\nfunction DatePicker({\n value,\n onChange,\n placeholder = \"Seleccionar fecha\",\n disabled = false,\n className,\n}: DatePickerProps) {\n const [open, setOpen] = React.useState(false);\n const [currentMonth, setCurrentMonth] = React.useState(value || new Date());\n\n const getDaysInMonth = (date: Date) => {\n const year = date.getFullYear();\n const month = date.getMonth();\n const firstDay = new Date(year, month, 1);\n const lastDay = new Date(year, month + 1, 0);\n const daysInMonth = lastDay.getDate();\n const startingDayOfWeek = firstDay.getDay();\n\n const days: (Date | null)[] = [];\n\n for (let i = 0; i < startingDayOfWeek; i++) {\n days.push(null);\n }\n\n for (let day = 1; day <= daysInMonth; day++) {\n days.push(new Date(Date.UTC(year, month, day)));\n }\n\n return days;\n };\n\n const days = getDaysInMonth(currentMonth);\n\n const handleDateSelect = (date: Date) => {\n onChange?.(date);\n setOpen(false);\n };\n\n const goToPreviousMonth = () => {\n setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1));\n };\n\n const goToNextMonth = () => {\n setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1));\n };\n\n const isToday = (date: Date) => {\n const today = new Date();\n return (\n date.getUTCFullYear() === today.getFullYear() &&\n date.getUTCMonth() === today.getMonth() &&\n date.getUTCDate() === today.getDate()\n );\n };\n\n const isSelected = (date: Date) => {\n if (!value) return false;\n return (\n date.getUTCFullYear() === value.getFullYear() &&\n date.getUTCMonth() === value.getMonth() &&\n date.getUTCDate() === value.getDate()\n );\n };\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n data-slot=\"date-picker\"\n className={cn(\n \"w-full justify-start text-left font-normal\",\n !value && \"text-muted-foreground\",\n className,\n )}\n disabled={disabled}\n >\n <CalendarIcon className=\"mr-2 h-4 w-4\" />\n {value ? format(value, \"dd/MM/yyyy\", { locale: es }) : placeholder}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <div className=\"p-3\">\n <div className=\"mb-4 flex items-center justify-between\">\n <Button variant=\"outline\" size=\"sm\" onClick={goToPreviousMonth} className=\"h-7 w-7 p-0\">\n <ChevronLeft className=\"h-4 w-4\" />\n </Button>\n <div className=\"text-sm font-medium\">\n {monthNames[currentMonth.getMonth()]} {currentMonth.getFullYear()}\n </div>\n <Button variant=\"outline\" size=\"sm\" onClick={goToNextMonth} className=\"h-7 w-7 p-0\">\n <ChevronRight className=\"h-4 w-4\" />\n </Button>\n </div>\n\n <div className=\"mb-2 grid grid-cols-7 gap-1\">\n {dayNames.map((day) => (\n <div key={day} className=\"py-2 text-center text-xs font-medium text-muted-foreground\">\n {day}\n </div>\n ))}\n </div>\n\n <div className=\"grid grid-cols-7 gap-1\">\n {days.map((day, index) => (\n <div key={index} className=\"flex h-9 w-9 items-center justify-center\">\n {day ? (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className={cn(\n \"h-9 w-9 p-0 font-normal\",\n isSelected(day) &&\n \"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground\",\n isToday(day) && !isSelected(day) && \"bg-accent text-accent-foreground\",\n \"hover:bg-muted\",\n )}\n onClick={() => handleDateSelect(day)}\n >\n {day.getDate()}\n </Button>\n ) : (\n <div className=\"h-9 w-9\" />\n )}\n </div>\n ))}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\nexport { DatePicker };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsGQ;AApGR,YAAuB;AACvB,sBAAuB;AACvB,oBAAmB;AACnB,0BAAoE;AAEpE,mBAAmB;AACnB,oBAAuB;AACvB,qBAAwD;AAUxD,MAAM,aAAa;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,WAAW,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,MA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eAAK,IAAI,CAAC,KAAK,UACd,4CAAC,SAAgB,WAAU,4CACxB,gBACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,eAAW;AAAA,YACT;AAAA,YACA,WAAW,GAAG,KACZ;AAAA,YACF,QAAQ,GAAG,KAAK,CAAC,WAAW,GAAG,KAAK;AAAA,YACpC;AAAA,UACF;AAAA,UACA,SAAS,MAAM,iBAAiB,GAAG;AAAA,UAElC,cAAI,QAAQ;AAAA;AAAA,MACf,IAEA,4CAAC,SAAI,WAAU,WAAU,KAjBnB,KAmBV,CACD,GACH;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":["days","CalendarIcon"]}
1
+ {"version":3,"sources":["../../../../src/components/ui/date-picker/date-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { addDays, format, startOfWeek } from \"date-fns\";\nimport type { Locale } from \"date-fns\";\nimport { enUS } from \"date-fns/locale\";\nimport {\n Calendar as CalendarIcon,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n} from \"lucide-react\";\n\nimport { cn } from \"../../../lib/utils\";\nimport { Button } from \"../button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\n\nexport interface DatePickerProps {\n value?: Date;\n onChange?: (date: Date | undefined) => void;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n /**\n * Locale de `date-fns` para nombres de mes/día y formato de la fecha en el botón.\n * Por defecto español (`es`).\n */\n locale?: Locale;\n /** Año mínimo en el selector (inclusive). */\n fromYear?: number;\n /** Año máximo en el selector (inclusive). */\n toYear?: number;\n}\n\nfunction getWeekStartsOn(locale: Locale): 0 | 1 | 2 | 3 | 4 | 5 | 6 {\n const w = locale.options?.weekStartsOn;\n if (w === undefined) return 1;\n return w as 0 | 1 | 2 | 3 | 4 | 5 | 6;\n}\n\n/** Meses abreviados (`LLL`) para que el `<select>` sea compacto dentro del popover. */\nfunction useMonthLabels(locale: Locale) {\n return React.useMemo(\n () => Array.from({ length: 12 }, (_, i) => format(new Date(2024, i, 1), \"LLL\", { locale })),\n [locale],\n );\n}\n\n/** Abreviatura del día en exactamente dos caracteres visibles (p. ej. lun → lu, Wed → We). */\nfunction weekdayTwoLetterLabel(abbrev: string): string {\n const graphemes = [...abbrev.normalize(\"NFC\")];\n if (graphemes.length <= 2) {\n return abbrev;\n }\n return graphemes.slice(0, 2).join(\"\");\n}\n\nfunction useWeekdayLabels(locale: Locale) {\n return React.useMemo(() => {\n const weekStartsOn = getWeekStartsOn(locale);\n const start = startOfWeek(new Date(2024, 0, 3), { weekStartsOn });\n return Array.from({ length: 7 }, (_, i) => {\n const abbrev = format(addDays(start, i), \"EEE\", { locale });\n return weekdayTwoLetterLabel(abbrev);\n });\n }, [locale]);\n}\n\nfunction getDaysInMonth(date: Date, weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6) {\n const year = date.getFullYear();\n const month = date.getMonth();\n const lastDay = new Date(year, month + 1, 0);\n const daysInMonth = lastDay.getDate();\n const firstDay = new Date(year, month, 1);\n const startingDayOfWeek = firstDay.getDay();\n const offset = (startingDayOfWeek - weekStartsOn + 7) % 7;\n\n const days: (Date | null)[] = [];\n for (let i = 0; i < offset; i++) {\n days.push(null);\n }\n for (let day = 1; day <= daysInMonth; day++) {\n days.push(new Date(year, month, day));\n }\n return days;\n}\n\n/** Select nativo sin flecha del sistema: el chevron es un icono con margen fijo (padding fiable en todos los navegadores). */\nfunction DatePickerSelect({\n className,\n wrapperClassName,\n children,\n ...props\n}: React.ComponentProps<\"select\"> & { wrapperClassName?: string }) {\n return (\n <div\n className={cn(\n \"relative flex min-h-9 w-full min-w-0 items-center rounded-md border border-input bg-card shadow-xs transition-colors\",\n /* Los navegadores suelen ignorar hover:bg en <select>; el hover va en el wrapper */\n \"hover:bg-muted/80\",\n \"focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50\",\n \"has-[:disabled]:opacity-50\",\n wrapperClassName,\n )}\n >\n <select\n {...props}\n className={cn(\n \"h-9 w-full min-w-0 flex-1 cursor-pointer appearance-none border-0 bg-transparent py-0 pl-2 pr-9 text-left text-sm text-foreground outline-none\",\n \"disabled:cursor-not-allowed\",\n className,\n )}\n >\n {children}\n </select>\n <ChevronDown\n className=\"pointer-events-none absolute right-2 top-1/2 size-4 -translate-y-1/2 shrink-0 text-muted-foreground opacity-80\"\n aria-hidden\n />\n </div>\n );\n}\n\nfunction DatePicker({\n value,\n onChange,\n placeholder = \"Pick a date\",\n disabled = false,\n className,\n locale = enUS,\n fromYear,\n toYear,\n}: DatePickerProps) {\n const [open, setOpen] = React.useState(false);\n const [currentMonth, setCurrentMonth] = React.useState(() => {\n const base = value ?? new Date();\n return new Date(base.getFullYear(), base.getMonth(), 1);\n });\n\n const monthLabels = useMonthLabels(locale);\n const weekdayLabels = useWeekdayLabels(locale);\n const weekStartsOn = getWeekStartsOn(locale);\n\n React.useEffect(() => {\n if (value) {\n setCurrentMonth(new Date(value.getFullYear(), value.getMonth(), 1));\n }\n }, [value]);\n\n const days = React.useMemo(\n () => getDaysInMonth(currentMonth, weekStartsOn),\n [currentMonth, weekStartsOn],\n );\n\n const yearOptions = React.useMemo(() => {\n const y = new Date().getFullYear();\n const from = fromYear ?? y - 100;\n const to = toYear ?? y + 10;\n const list: number[] = [];\n for (let i = from; i <= to; i++) {\n list.push(i);\n }\n return list;\n }, [fromYear, toYear]);\n\n const handleDateSelect = (date: Date) => {\n onChange?.(date);\n setOpen(false);\n };\n\n const goToPreviousMonth = () => {\n setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1, 1));\n };\n\n const goToNextMonth = () => {\n setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1, 1));\n };\n\n const setMonthFromSelect = (monthIndex: number) => {\n setCurrentMonth(new Date(currentMonth.getFullYear(), monthIndex, 1));\n };\n\n const setYearFromSelect = (year: number) => {\n setCurrentMonth(new Date(year, currentMonth.getMonth(), 1));\n };\n\n const isToday = (date: Date) => {\n const today = new Date();\n return (\n date.getFullYear() === today.getFullYear() &&\n date.getMonth() === today.getMonth() &&\n date.getDate() === today.getDate()\n );\n };\n\n const isSelected = (date: Date) => {\n if (!value) return false;\n return (\n date.getFullYear() === value.getFullYear() &&\n date.getMonth() === value.getMonth() &&\n date.getDate() === value.getDate()\n );\n };\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n data-slot=\"date-picker\"\n className={cn(\n \"w-full justify-start text-left font-normal\",\n /* outline usa hover:bg-primary; aquí queremos un hover neutro */\n \"hover:bg-muted hover:text-foreground\",\n !value && \"text-muted-foreground\",\n className,\n )}\n disabled={disabled}\n >\n <CalendarIcon className=\"mr-2 h-4 w-4 shrink-0\" />\n {value ? format(value, \"P\", { locale }) : placeholder}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto bg-white p-0 dark:bg-card\" align=\"start\">\n <div className=\"p-3\">\n <div className=\"mb-3 flex flex-wrap items-center justify-center gap-1.5\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={goToPreviousMonth}\n className=\"h-9 w-9 shrink-0 p-0 hover:bg-muted hover:text-foreground\"\n aria-label={locale.code?.startsWith(\"es\") ? \"Mes anterior\" : \"Previous month\"}\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </Button>\n <DatePickerSelect\n wrapperClassName=\"w-[6.75rem] shrink-0\"\n value={currentMonth.getMonth()}\n onChange={(e) => setMonthFromSelect(Number(e.target.value))}\n aria-label={locale.code?.startsWith(\"es\") ? \"Mes\" : \"Month\"}\n >\n {monthLabels.map((label, i) => (\n <option key={label} value={i}>\n {label}\n </option>\n ))}\n </DatePickerSelect>\n <DatePickerSelect\n wrapperClassName=\"w-[5.5rem] shrink-0\"\n className=\"tabular-nums text-center\"\n value={currentMonth.getFullYear()}\n onChange={(e) => setYearFromSelect(Number(e.target.value))}\n aria-label={locale.code?.startsWith(\"es\") ? \"Año\" : \"Year\"}\n >\n {yearOptions.map((y) => (\n <option key={y} value={y}>\n {y}\n </option>\n ))}\n </DatePickerSelect>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={goToNextMonth}\n className=\"h-9 w-9 shrink-0 p-0 hover:bg-muted hover:text-foreground\"\n aria-label={locale.code?.startsWith(\"es\") ? \"Mes siguiente\" : \"Next month\"}\n >\n <ChevronRight className=\"h-4 w-4\" />\n </Button>\n </div>\n\n <div className=\"mb-2 grid grid-cols-7 gap-1\">\n {weekdayLabels.map((day, i) => (\n <div\n key={i}\n className=\"px-0.5 py-2 text-center text-sm font-medium capitalize leading-tight text-muted-foreground\"\n >\n {day}\n </div>\n ))}\n </div>\n\n <div className=\"grid grid-cols-7 gap-1\">\n {days.map((day, index) => (\n <div key={index} className=\"flex h-9 w-9 items-center justify-center\">\n {day ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className={cn(\n \"h-9 w-9 p-0 font-normal\",\n isSelected(day) &&\n \"bg-primary text-primary-foreground hover:bg-primary-dark hover:text-primary-foreground\",\n isToday(day) &&\n !isSelected(day) &&\n \"bg-accent text-accent-foreground hover:bg-accent/80 hover:text-accent-foreground\",\n !isSelected(day) && !isToday(day) && \"hover:bg-muted hover:text-foreground\",\n )}\n onClick={() => handleDateSelect(day)}\n >\n {day.getDate()}\n </Button>\n ) : (\n <div className=\"h-9 w-9\" />\n )}\n </div>\n ))}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\nexport { DatePicker };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+FI;AA7FJ,YAAuB;AACvB,sBAA6C;AAE7C,oBAAqB;AACrB,0BAKO;AAEP,mBAAmB;AACnB,oBAAuB;AACvB,qBAAwD;AAmBxD,SAAS,gBAAgB,QAA2C;AAClE,QAAM,IAAI,OAAO,SAAS;AAC1B,MAAI,MAAM,OAAW,QAAO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,MAAM,kBAAkB,OAAO,EAAE,OAAO,KAAK,CAAC;AAAA,YACzD,cAAY,OAAO,MAAM,WAAW,IAAI,IAAI,WAAQ;AAAA,YAEnD,sBAAY,IAAI,CAAC,MAChB,4CAAC,YAAe,OAAO,GACpB,eADU,CAEb,CACD;AAAA;AAAA,QACH;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,SAAS;AAAA,YACT,WAAU;AAAA,YACV,cAAY,OAAO,MAAM,WAAW,IAAI,IAAI,kBAAkB;AAAA,YAE9D,sDAAC,oCAAa,WAAU,WAAU;AAAA;AAAA,QACpC;AAAA,SACF;AAAA,MAEA,4CAAC,SAAI,WAAU,+BACZ,wBAAc,IAAI,CAAC,KAAK,MACvB;AAAA,QAAC;AAAA;AAAA,UAEC,WAAU;AAAA,UAET;AAAA;AAAA,QAHI;AAAA,MAIP,CACD,GACH;AAAA,MAEA,4CAAC,SAAI,WAAU,0BACZ,eAAK,IAAI,CAAC,KAAK,UACd,4CAAC,SAAgB,WAAU,4CACxB,gBACC;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,eAAW;AAAA,YACT;AAAA,YACA,WAAW,GAAG,KACZ;AAAA,YACF,QAAQ,GAAG,KACT,CAAC,WAAW,GAAG,KACf;AAAA,YACF,CAAC,WAAW,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAK;AAAA,UACvC;AAAA,UACA,SAAS,MAAM,iBAAiB,GAAG;AAAA,UAElC,cAAI,QAAQ;AAAA;AAAA,MACf,IAEA,4CAAC,SAAI,WAAU,WAAU,KApBnB,KAsBV,CACD,GACH;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":["CalendarIcon"]}
@@ -1,4 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Locale } from 'date-fns';
2
3
 
3
4
  interface DatePickerProps {
4
5
  value?: Date;
@@ -6,7 +7,16 @@ interface DatePickerProps {
6
7
  placeholder?: string;
7
8
  disabled?: boolean;
8
9
  className?: string;
10
+ /**
11
+ * Locale de `date-fns` para nombres de mes/día y formato de la fecha en el botón.
12
+ * Por defecto español (`es`).
13
+ */
14
+ locale?: Locale;
15
+ /** Año mínimo en el selector (inclusive). */
16
+ fromYear?: number;
17
+ /** Año máximo en el selector (inclusive). */
18
+ toYear?: number;
9
19
  }
10
- declare function DatePicker({ value, onChange, placeholder, disabled, className, }: DatePickerProps): react_jsx_runtime.JSX.Element;
20
+ declare function DatePicker({ value, onChange, placeholder, disabled, className, locale, fromYear, toYear, }: DatePickerProps): react_jsx_runtime.JSX.Element;
11
21
 
12
22
  export { DatePicker, type DatePickerProps };
@@ -1,4 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Locale } from 'date-fns';
2
3
 
3
4
  interface DatePickerProps {
4
5
  value?: Date;
@@ -6,7 +7,16 @@ interface DatePickerProps {
6
7
  placeholder?: string;
7
8
  disabled?: boolean;
8
9
  className?: string;
10
+ /**
11
+ * Locale de `date-fns` para nombres de mes/día y formato de la fecha en el botón.
12
+ * Por defecto español (`es`).
13
+ */
14
+ locale?: Locale;
15
+ /** Año mínimo en el selector (inclusive). */
16
+ fromYear?: number;
17
+ /** Año máximo en el selector (inclusive). */
18
+ toYear?: number;
9
19
  }
10
- declare function DatePicker({ value, onChange, placeholder, disabled, className, }: DatePickerProps): react_jsx_runtime.JSX.Element;
20
+ declare function DatePicker({ value, onChange, placeholder, disabled, className, locale, fromYear, toYear, }: DatePickerProps): react_jsx_runtime.JSX.Element;
11
21
 
12
22
  export { DatePicker, type DatePickerProps };
@@ -1,70 +1,163 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
- import { format } from "date-fns";
5
- import { es } from "date-fns/locale";
6
- import { Calendar as CalendarIcon, ChevronLeft, ChevronRight } from "lucide-react";
4
+ import { addDays, format, startOfWeek } from "date-fns";
5
+ import { enUS } from "date-fns/locale";
6
+ import {
7
+ Calendar as CalendarIcon,
8
+ ChevronDown,
9
+ ChevronLeft,
10
+ ChevronRight
11
+ } from "lucide-react";
7
12
  import { cn } from "../../../lib/utils";
8
13
  import { Button } from "../button";
9
14
  import { Popover, PopoverContent, PopoverTrigger } from "../popover";
10
- const monthNames = [
11
- "Enero",
12
- "Febrero",
13
- "Marzo",
14
- "Abril",
15
- "Mayo",
16
- "Junio",
17
- "Julio",
18
- "Agosto",
19
- "Septiembre",
20
- "Octubre",
21
- "Noviembre",
22
- "Diciembre"
23
- ];
24
- const dayNames = ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "S\xE1"];
15
+ function getWeekStartsOn(locale) {
16
+ const w = locale.options?.weekStartsOn;
17
+ if (w === void 0) return 1;
18
+ return w;
19
+ }
20
+ function useMonthLabels(locale) {
21
+ return React.useMemo(
22
+ () => Array.from({ length: 12 }, (_, i) => format(new Date(2024, i, 1), "LLL", { locale })),
23
+ [locale]
24
+ );
25
+ }
26
+ function weekdayTwoLetterLabel(abbrev) {
27
+ const graphemes = [...abbrev.normalize("NFC")];
28
+ if (graphemes.length <= 2) {
29
+ return abbrev;
30
+ }
31
+ return graphemes.slice(0, 2).join("");
32
+ }
33
+ function useWeekdayLabels(locale) {
34
+ return React.useMemo(() => {
35
+ const weekStartsOn = getWeekStartsOn(locale);
36
+ const start = startOfWeek(new Date(2024, 0, 3), { weekStartsOn });
37
+ return Array.from({ length: 7 }, (_, i) => {
38
+ const abbrev = format(addDays(start, i), "EEE", { locale });
39
+ return weekdayTwoLetterLabel(abbrev);
40
+ });
41
+ }, [locale]);
42
+ }
43
+ function getDaysInMonth(date, weekStartsOn) {
44
+ const year = date.getFullYear();
45
+ const month = date.getMonth();
46
+ const lastDay = new Date(year, month + 1, 0);
47
+ const daysInMonth = lastDay.getDate();
48
+ const firstDay = new Date(year, month, 1);
49
+ const startingDayOfWeek = firstDay.getDay();
50
+ const offset = (startingDayOfWeek - weekStartsOn + 7) % 7;
51
+ const days = [];
52
+ for (let i = 0; i < offset; i++) {
53
+ days.push(null);
54
+ }
55
+ for (let day = 1; day <= daysInMonth; day++) {
56
+ days.push(new Date(year, month, day));
57
+ }
58
+ return days;
59
+ }
60
+ function DatePickerSelect({
61
+ className,
62
+ wrapperClassName,
63
+ children,
64
+ ...props
65
+ }) {
66
+ return /* @__PURE__ */ jsxs(
67
+ "div",
68
+ {
69
+ className: cn(
70
+ "relative flex min-h-9 w-full min-w-0 items-center rounded-md border border-input bg-card shadow-xs transition-colors",
71
+ /* Los navegadores suelen ignorar hover:bg en <select>; el hover va en el wrapper */
72
+ "hover:bg-muted/80",
73
+ "focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50",
74
+ "has-[:disabled]:opacity-50",
75
+ wrapperClassName
76
+ ),
77
+ children: [
78
+ /* @__PURE__ */ jsx(
79
+ "select",
80
+ {
81
+ ...props,
82
+ className: cn(
83
+ "h-9 w-full min-w-0 flex-1 cursor-pointer appearance-none border-0 bg-transparent py-0 pl-2 pr-9 text-left text-sm text-foreground outline-none",
84
+ "disabled:cursor-not-allowed",
85
+ className
86
+ ),
87
+ children
88
+ }
89
+ ),
90
+ /* @__PURE__ */ jsx(
91
+ ChevronDown,
92
+ {
93
+ className: "pointer-events-none absolute right-2 top-1/2 size-4 -translate-y-1/2 shrink-0 text-muted-foreground opacity-80",
94
+ "aria-hidden": true
95
+ }
96
+ )
97
+ ]
98
+ }
99
+ );
100
+ }
25
101
  function DatePicker({
26
102
  value,
27
103
  onChange,
28
- placeholder = "Seleccionar fecha",
104
+ placeholder = "Pick a date",
29
105
  disabled = false,
30
- className
106
+ className,
107
+ locale = enUS,
108
+ fromYear,
109
+ toYear
31
110
  }) {
32
111
  const [open, setOpen] = React.useState(false);
33
- const [currentMonth, setCurrentMonth] = React.useState(value || /* @__PURE__ */ new Date());
34
- const getDaysInMonth = (date) => {
35
- const year = date.getFullYear();
36
- const month = date.getMonth();
37
- const firstDay = new Date(year, month, 1);
38
- const lastDay = new Date(year, month + 1, 0);
39
- const daysInMonth = lastDay.getDate();
40
- const startingDayOfWeek = firstDay.getDay();
41
- const days2 = [];
42
- for (let i = 0; i < startingDayOfWeek; i++) {
43
- days2.push(null);
112
+ const [currentMonth, setCurrentMonth] = React.useState(() => {
113
+ const base = value ?? /* @__PURE__ */ new Date();
114
+ return new Date(base.getFullYear(), base.getMonth(), 1);
115
+ });
116
+ const monthLabels = useMonthLabels(locale);
117
+ const weekdayLabels = useWeekdayLabels(locale);
118
+ const weekStartsOn = getWeekStartsOn(locale);
119
+ React.useEffect(() => {
120
+ if (value) {
121
+ setCurrentMonth(new Date(value.getFullYear(), value.getMonth(), 1));
44
122
  }
45
- for (let day = 1; day <= daysInMonth; day++) {
46
- days2.push(new Date(Date.UTC(year, month, day)));
123
+ }, [value]);
124
+ const days = React.useMemo(
125
+ () => getDaysInMonth(currentMonth, weekStartsOn),
126
+ [currentMonth, weekStartsOn]
127
+ );
128
+ const yearOptions = React.useMemo(() => {
129
+ const y = (/* @__PURE__ */ new Date()).getFullYear();
130
+ const from = fromYear ?? y - 100;
131
+ const to = toYear ?? y + 10;
132
+ const list = [];
133
+ for (let i = from; i <= to; i++) {
134
+ list.push(i);
47
135
  }
48
- return days2;
49
- };
50
- const days = getDaysInMonth(currentMonth);
136
+ return list;
137
+ }, [fromYear, toYear]);
51
138
  const handleDateSelect = (date) => {
52
139
  onChange?.(date);
53
140
  setOpen(false);
54
141
  };
55
142
  const goToPreviousMonth = () => {
56
- setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1));
143
+ setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1, 1));
57
144
  };
58
145
  const goToNextMonth = () => {
59
- setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1));
146
+ setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1, 1));
147
+ };
148
+ const setMonthFromSelect = (monthIndex) => {
149
+ setCurrentMonth(new Date(currentMonth.getFullYear(), monthIndex, 1));
150
+ };
151
+ const setYearFromSelect = (year) => {
152
+ setCurrentMonth(new Date(year, currentMonth.getMonth(), 1));
60
153
  };
61
154
  const isToday = (date) => {
62
155
  const today = /* @__PURE__ */ new Date();
63
- return date.getUTCFullYear() === today.getFullYear() && date.getUTCMonth() === today.getMonth() && date.getUTCDate() === today.getDate();
156
+ return date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() && date.getDate() === today.getDate();
64
157
  };
65
158
  const isSelected = (date) => {
66
159
  if (!value) return false;
67
- return date.getUTCFullYear() === value.getFullYear() && date.getUTCMonth() === value.getMonth() && date.getUTCDate() === value.getDate();
160
+ return date.getFullYear() === value.getFullYear() && date.getMonth() === value.getMonth() && date.getDate() === value.getDate();
68
161
  };
69
162
  return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
70
163
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
@@ -74,37 +167,85 @@ function DatePicker({
74
167
  "data-slot": "date-picker",
75
168
  className: cn(
76
169
  "w-full justify-start text-left font-normal",
170
+ /* outline usa hover:bg-primary; aquí queremos un hover neutro */
171
+ "hover:bg-muted hover:text-foreground",
77
172
  !value && "text-muted-foreground",
78
173
  className
79
174
  ),
80
175
  disabled,
81
176
  children: [
82
- /* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }),
83
- value ? format(value, "dd/MM/yyyy", { locale: es }) : placeholder
177
+ /* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4 shrink-0" }),
178
+ value ? format(value, "P", { locale }) : placeholder
84
179
  ]
85
180
  }
86
181
  ) }),
87
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxs("div", { className: "p-3", children: [
88
- /* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-center justify-between", children: [
89
- /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: goToPreviousMonth, className: "h-7 w-7 p-0", children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }) }),
90
- /* @__PURE__ */ jsxs("div", { className: "text-sm font-medium", children: [
91
- monthNames[currentMonth.getMonth()],
92
- " ",
93
- currentMonth.getFullYear()
94
- ] }),
95
- /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: goToNextMonth, className: "h-7 w-7 p-0", children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }) })
182
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto bg-white p-0 dark:bg-card", align: "start", children: /* @__PURE__ */ jsxs("div", { className: "p-3", children: [
183
+ /* @__PURE__ */ jsxs("div", { className: "mb-3 flex flex-wrap items-center justify-center gap-1.5", children: [
184
+ /* @__PURE__ */ jsx(
185
+ Button,
186
+ {
187
+ type: "button",
188
+ variant: "outline",
189
+ size: "sm",
190
+ onClick: goToPreviousMonth,
191
+ className: "h-9 w-9 shrink-0 p-0 hover:bg-muted hover:text-foreground",
192
+ "aria-label": locale.code?.startsWith("es") ? "Mes anterior" : "Previous month",
193
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
194
+ }
195
+ ),
196
+ /* @__PURE__ */ jsx(
197
+ DatePickerSelect,
198
+ {
199
+ wrapperClassName: "w-[6.75rem] shrink-0",
200
+ value: currentMonth.getMonth(),
201
+ onChange: (e) => setMonthFromSelect(Number(e.target.value)),
202
+ "aria-label": locale.code?.startsWith("es") ? "Mes" : "Month",
203
+ children: monthLabels.map((label, i) => /* @__PURE__ */ jsx("option", { value: i, children: label }, label))
204
+ }
205
+ ),
206
+ /* @__PURE__ */ jsx(
207
+ DatePickerSelect,
208
+ {
209
+ wrapperClassName: "w-[5.5rem] shrink-0",
210
+ className: "tabular-nums text-center",
211
+ value: currentMonth.getFullYear(),
212
+ onChange: (e) => setYearFromSelect(Number(e.target.value)),
213
+ "aria-label": locale.code?.startsWith("es") ? "A\xF1o" : "Year",
214
+ children: yearOptions.map((y) => /* @__PURE__ */ jsx("option", { value: y, children: y }, y))
215
+ }
216
+ ),
217
+ /* @__PURE__ */ jsx(
218
+ Button,
219
+ {
220
+ type: "button",
221
+ variant: "outline",
222
+ size: "sm",
223
+ onClick: goToNextMonth,
224
+ className: "h-9 w-9 shrink-0 p-0 hover:bg-muted hover:text-foreground",
225
+ "aria-label": locale.code?.startsWith("es") ? "Mes siguiente" : "Next month",
226
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
227
+ }
228
+ )
96
229
  ] }),
97
- /* @__PURE__ */ jsx("div", { className: "mb-2 grid grid-cols-7 gap-1", children: dayNames.map((day) => /* @__PURE__ */ jsx("div", { className: "py-2 text-center text-xs font-medium text-muted-foreground", children: day }, day)) }),
230
+ /* @__PURE__ */ jsx("div", { className: "mb-2 grid grid-cols-7 gap-1", children: weekdayLabels.map((day, i) => /* @__PURE__ */ jsx(
231
+ "div",
232
+ {
233
+ className: "px-0.5 py-2 text-center text-sm font-medium capitalize leading-tight text-muted-foreground",
234
+ children: day
235
+ },
236
+ i
237
+ )) }),
98
238
  /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1", children: days.map((day, index) => /* @__PURE__ */ jsx("div", { className: "flex h-9 w-9 items-center justify-center", children: day ? /* @__PURE__ */ jsx(
99
239
  Button,
100
240
  {
241
+ type: "button",
101
242
  variant: "ghost",
102
243
  size: "sm",
103
244
  className: cn(
104
245
  "h-9 w-9 p-0 font-normal",
105
- isSelected(day) && "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground",
106
- isToday(day) && !isSelected(day) && "bg-accent text-accent-foreground",
107
- "hover:bg-muted"
246
+ isSelected(day) && "bg-primary text-primary-foreground hover:bg-primary-dark hover:text-primary-foreground",
247
+ isToday(day) && !isSelected(day) && "bg-accent text-accent-foreground hover:bg-accent/80 hover:text-accent-foreground",
248
+ !isSelected(day) && !isToday(day) && "hover:bg-muted hover:text-foreground"
108
249
  ),
109
250
  onClick: () => handleDateSelect(day),
110
251
  children: day.getDate()
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/ui/date-picker/date-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { format } from \"date-fns\";\nimport { es } from \"date-fns/locale\";\nimport { Calendar as CalendarIcon, ChevronLeft, ChevronRight } from \"lucide-react\";\n\nimport { cn } from \"../../../lib/utils\";\nimport { Button } from \"../button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\n\nexport interface DatePickerProps {\n value?: Date;\n onChange?: (date: Date | undefined) => void;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n}\n\nconst monthNames = [\n \"Enero\",\n \"Febrero\",\n \"Marzo\",\n \"Abril\",\n \"Mayo\",\n \"Junio\",\n \"Julio\",\n \"Agosto\",\n \"Septiembre\",\n \"Octubre\",\n \"Noviembre\",\n \"Diciembre\",\n];\nconst dayNames = [\"Do\", \"Lu\", \"Ma\", \"Mi\", \"Ju\", \"Vi\", \"Sá\"];\n\nfunction DatePicker({\n value,\n onChange,\n placeholder = \"Seleccionar fecha\",\n disabled = false,\n className,\n}: DatePickerProps) {\n const [open, setOpen] = React.useState(false);\n const [currentMonth, setCurrentMonth] = React.useState(value || new Date());\n\n const getDaysInMonth = (date: Date) => {\n const year = date.getFullYear();\n const month = date.getMonth();\n const firstDay = new Date(year, month, 1);\n const lastDay = new Date(year, month + 1, 0);\n const daysInMonth = lastDay.getDate();\n const startingDayOfWeek = firstDay.getDay();\n\n const days: (Date | null)[] = [];\n\n for (let i = 0; i < startingDayOfWeek; i++) {\n days.push(null);\n }\n\n for (let day = 1; day <= daysInMonth; day++) {\n days.push(new Date(Date.UTC(year, month, day)));\n }\n\n return days;\n };\n\n const days = getDaysInMonth(currentMonth);\n\n const handleDateSelect = (date: Date) => {\n onChange?.(date);\n setOpen(false);\n };\n\n const goToPreviousMonth = () => {\n setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1));\n };\n\n const goToNextMonth = () => {\n setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1));\n };\n\n const isToday = (date: Date) => {\n const today = new Date();\n return (\n date.getUTCFullYear() === today.getFullYear() &&\n date.getUTCMonth() === today.getMonth() &&\n date.getUTCDate() === today.getDate()\n );\n };\n\n const isSelected = (date: Date) => {\n if (!value) return false;\n return (\n date.getUTCFullYear() === value.getFullYear() &&\n date.getUTCMonth() === value.getMonth() &&\n date.getUTCDate() === value.getDate()\n );\n };\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n data-slot=\"date-picker\"\n className={cn(\n \"w-full justify-start text-left font-normal\",\n !value && \"text-muted-foreground\",\n className,\n )}\n disabled={disabled}\n >\n <CalendarIcon className=\"mr-2 h-4 w-4\" />\n {value ? format(value, \"dd/MM/yyyy\", { locale: es }) : placeholder}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <div className=\"p-3\">\n <div className=\"mb-4 flex items-center justify-between\">\n <Button variant=\"outline\" size=\"sm\" onClick={goToPreviousMonth} className=\"h-7 w-7 p-0\">\n <ChevronLeft className=\"h-4 w-4\" />\n </Button>\n <div className=\"text-sm font-medium\">\n {monthNames[currentMonth.getMonth()]} {currentMonth.getFullYear()}\n </div>\n <Button variant=\"outline\" size=\"sm\" onClick={goToNextMonth} className=\"h-7 w-7 p-0\">\n <ChevronRight className=\"h-4 w-4\" />\n </Button>\n </div>\n\n <div className=\"mb-2 grid grid-cols-7 gap-1\">\n {dayNames.map((day) => (\n <div key={day} className=\"py-2 text-center text-xs font-medium text-muted-foreground\">\n {day}\n </div>\n ))}\n </div>\n\n <div className=\"grid grid-cols-7 gap-1\">\n {days.map((day, index) => (\n <div key={index} className=\"flex h-9 w-9 items-center justify-center\">\n {day ? (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className={cn(\n \"h-9 w-9 p-0 font-normal\",\n isSelected(day) &&\n \"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground\",\n isToday(day) && !isSelected(day) && \"bg-accent text-accent-foreground\",\n \"hover:bg-muted\",\n )}\n onClick={() => handleDateSelect(day)}\n >\n {day.getDate()}\n </Button>\n ) : (\n <div className=\"h-9 w-9\" />\n )}\n </div>\n ))}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\nexport { DatePicker };\n"],"mappings":";AAsGQ,SAUE,KAVF;AApGR,YAAY,WAAW;AACvB,SAAS,cAAc;AACvB,SAAS,UAAU;AACnB,SAAS,YAAY,cAAc,aAAa,oBAAoB;AAEpE,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,SAAS,gBAAgB,sBAAsB;AAUxD,MAAM,aAAa;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,WAAW,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,OAAI;AAE1D,SAAS,WAAW;AAAA,EAClB;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,WAAW;AAAA,EACX;AACF,GAAoB;AAClB,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAS,KAAK;AAC5C,QAAM,CAAC,cAAc,eAAe,IAAI,MAAM,SAAS,SAAS,oBAAI,KAAK,CAAC;AAE1E,QAAM,iBAAiB,CAAC,SAAe;AACrC,UAAM,OAAO,KAAK,YAAY;AAC9B,UAAM,QAAQ,KAAK,SAAS;AAC5B,UAAM,WAAW,IAAI,KAAK,MAAM,OAAO,CAAC;AACxC,UAAM,UAAU,IAAI,KAAK,MAAM,QAAQ,GAAG,CAAC;AAC3C,UAAM,cAAc,QAAQ,QAAQ;AACpC,UAAM,oBAAoB,SAAS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BAAC,gBAAa,WAAU,gBAAe;AAAA,UACtC,QAAQ,OAAO,OAAO,cAAc,EAAE,QAAQ,GAAG,CAAC,IAAI;AAAA;AAAA;AAAA,IACzD,GACF;AAAA,IACA,oBAAC,kBAAe,WAAU,cAAa,OAAM,SAC3C,+BAAC,SAAI,WAAU,OACb;AAAA,2BAAC,SAAI,WAAU,0CACb;AAAA,4BAAC,UAAO,SAAQ,WAAU,MAAK,MAAK,SAAS,mBAAmB,WAAU,eACxE,8BAAC,eAAY,WAAU,WAAU,GACnC;AAAA,QACA,qBAAC,SAAI,WAAU,uBACZ;AAAA,qBAAW,aAAa,SAAS,CAAC;AAAA,UAAE;AAAA,UAAE,aAAa,YAAY;AAAA,WAClE;AAAA,QACA,oBAAC,UAAO,SAAQ,WAAU,MAAK,MAAK,SAAS,eAAe,WAAU,eACpE,8BAAC,gBAAa,WAAU,WAAU,GACpC;AAAA,SACF;AAAA,MAEA,oBAAC,SAAI,WAAU,+BACZ,mBAAS,IAAI,CAAC,QACb,oBAAC,SAAc,WAAU,8DACtB,iBADO,GAEV,CACD,GACH;AAAA,MAEA,oBAAC,SAAI,WAAU,0BACZ,eAAK,IAAI,CAAC,KAAK,UACd,oBAAC,SAAgB,WAAU,4CACxB,gBACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,WAAW;AAAA,YACT;AAAA,YACA,WAAW,GAAG,KACZ;AAAA,YACF,QAAQ,GAAG,KAAK,CAAC,WAAW,GAAG,KAAK;AAAA,YACpC;AAAA,UACF;AAAA,UACA,SAAS,MAAM,iBAAiB,GAAG;AAAA,UAElC,cAAI,QAAQ;AAAA;AAAA,MACf,IAEA,oBAAC,SAAI,WAAU,WAAU,KAjBnB,KAmBV,CACD,GACH;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":["days"]}
1
+ {"version":3,"sources":["../../../../src/components/ui/date-picker/date-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { addDays, format, startOfWeek } from \"date-fns\";\nimport type { Locale } from \"date-fns\";\nimport { enUS } from \"date-fns/locale\";\nimport {\n Calendar as CalendarIcon,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n} from \"lucide-react\";\n\nimport { cn } from \"../../../lib/utils\";\nimport { Button } from \"../button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\n\nexport interface DatePickerProps {\n value?: Date;\n onChange?: (date: Date | undefined) => void;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n /**\n * Locale de `date-fns` para nombres de mes/día y formato de la fecha en el botón.\n * Por defecto español (`es`).\n */\n locale?: Locale;\n /** Año mínimo en el selector (inclusive). */\n fromYear?: number;\n /** Año máximo en el selector (inclusive). */\n toYear?: number;\n}\n\nfunction getWeekStartsOn(locale: Locale): 0 | 1 | 2 | 3 | 4 | 5 | 6 {\n const w = locale.options?.weekStartsOn;\n if (w === undefined) return 1;\n return w as 0 | 1 | 2 | 3 | 4 | 5 | 6;\n}\n\n/** Meses abreviados (`LLL`) para que el `<select>` sea compacto dentro del popover. */\nfunction useMonthLabels(locale: Locale) {\n return React.useMemo(\n () => Array.from({ length: 12 }, (_, i) => format(new Date(2024, i, 1), \"LLL\", { locale })),\n [locale],\n );\n}\n\n/** Abreviatura del día en exactamente dos caracteres visibles (p. ej. lun → lu, Wed → We). */\nfunction weekdayTwoLetterLabel(abbrev: string): string {\n const graphemes = [...abbrev.normalize(\"NFC\")];\n if (graphemes.length <= 2) {\n return abbrev;\n }\n return graphemes.slice(0, 2).join(\"\");\n}\n\nfunction useWeekdayLabels(locale: Locale) {\n return React.useMemo(() => {\n const weekStartsOn = getWeekStartsOn(locale);\n const start = startOfWeek(new Date(2024, 0, 3), { weekStartsOn });\n return Array.from({ length: 7 }, (_, i) => {\n const abbrev = format(addDays(start, i), \"EEE\", { locale });\n return weekdayTwoLetterLabel(abbrev);\n });\n }, [locale]);\n}\n\nfunction getDaysInMonth(date: Date, weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6) {\n const year = date.getFullYear();\n const month = date.getMonth();\n const lastDay = new Date(year, month + 1, 0);\n const daysInMonth = lastDay.getDate();\n const firstDay = new Date(year, month, 1);\n const startingDayOfWeek = firstDay.getDay();\n const offset = (startingDayOfWeek - weekStartsOn + 7) % 7;\n\n const days: (Date | null)[] = [];\n for (let i = 0; i < offset; i++) {\n days.push(null);\n }\n for (let day = 1; day <= daysInMonth; day++) {\n days.push(new Date(year, month, day));\n }\n return days;\n}\n\n/** Select nativo sin flecha del sistema: el chevron es un icono con margen fijo (padding fiable en todos los navegadores). */\nfunction DatePickerSelect({\n className,\n wrapperClassName,\n children,\n ...props\n}: React.ComponentProps<\"select\"> & { wrapperClassName?: string }) {\n return (\n <div\n className={cn(\n \"relative flex min-h-9 w-full min-w-0 items-center rounded-md border border-input bg-card shadow-xs transition-colors\",\n /* Los navegadores suelen ignorar hover:bg en <select>; el hover va en el wrapper */\n \"hover:bg-muted/80\",\n \"focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50\",\n \"has-[:disabled]:opacity-50\",\n wrapperClassName,\n )}\n >\n <select\n {...props}\n className={cn(\n \"h-9 w-full min-w-0 flex-1 cursor-pointer appearance-none border-0 bg-transparent py-0 pl-2 pr-9 text-left text-sm text-foreground outline-none\",\n \"disabled:cursor-not-allowed\",\n className,\n )}\n >\n {children}\n </select>\n <ChevronDown\n className=\"pointer-events-none absolute right-2 top-1/2 size-4 -translate-y-1/2 shrink-0 text-muted-foreground opacity-80\"\n aria-hidden\n />\n </div>\n );\n}\n\nfunction DatePicker({\n value,\n onChange,\n placeholder = \"Pick a date\",\n disabled = false,\n className,\n locale = enUS,\n fromYear,\n toYear,\n}: DatePickerProps) {\n const [open, setOpen] = React.useState(false);\n const [currentMonth, setCurrentMonth] = React.useState(() => {\n const base = value ?? new Date();\n return new Date(base.getFullYear(), base.getMonth(), 1);\n });\n\n const monthLabels = useMonthLabels(locale);\n const weekdayLabels = useWeekdayLabels(locale);\n const weekStartsOn = getWeekStartsOn(locale);\n\n React.useEffect(() => {\n if (value) {\n setCurrentMonth(new Date(value.getFullYear(), value.getMonth(), 1));\n }\n }, [value]);\n\n const days = React.useMemo(\n () => getDaysInMonth(currentMonth, weekStartsOn),\n [currentMonth, weekStartsOn],\n );\n\n const yearOptions = React.useMemo(() => {\n const y = new Date().getFullYear();\n const from = fromYear ?? y - 100;\n const to = toYear ?? y + 10;\n const list: number[] = [];\n for (let i = from; i <= to; i++) {\n list.push(i);\n }\n return list;\n }, [fromYear, toYear]);\n\n const handleDateSelect = (date: Date) => {\n onChange?.(date);\n setOpen(false);\n };\n\n const goToPreviousMonth = () => {\n setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1, 1));\n };\n\n const goToNextMonth = () => {\n setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1, 1));\n };\n\n const setMonthFromSelect = (monthIndex: number) => {\n setCurrentMonth(new Date(currentMonth.getFullYear(), monthIndex, 1));\n };\n\n const setYearFromSelect = (year: number) => {\n setCurrentMonth(new Date(year, currentMonth.getMonth(), 1));\n };\n\n const isToday = (date: Date) => {\n const today = new Date();\n return (\n date.getFullYear() === today.getFullYear() &&\n date.getMonth() === today.getMonth() &&\n date.getDate() === today.getDate()\n );\n };\n\n const isSelected = (date: Date) => {\n if (!value) return false;\n return (\n date.getFullYear() === value.getFullYear() &&\n date.getMonth() === value.getMonth() &&\n date.getDate() === value.getDate()\n );\n };\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n data-slot=\"date-picker\"\n className={cn(\n \"w-full justify-start text-left font-normal\",\n /* outline usa hover:bg-primary; aquí queremos un hover neutro */\n \"hover:bg-muted hover:text-foreground\",\n !value && \"text-muted-foreground\",\n className,\n )}\n disabled={disabled}\n >\n <CalendarIcon className=\"mr-2 h-4 w-4 shrink-0\" />\n {value ? format(value, \"P\", { locale }) : placeholder}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto bg-white p-0 dark:bg-card\" align=\"start\">\n <div className=\"p-3\">\n <div className=\"mb-3 flex flex-wrap items-center justify-center gap-1.5\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={goToPreviousMonth}\n className=\"h-9 w-9 shrink-0 p-0 hover:bg-muted hover:text-foreground\"\n aria-label={locale.code?.startsWith(\"es\") ? \"Mes anterior\" : \"Previous month\"}\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </Button>\n <DatePickerSelect\n wrapperClassName=\"w-[6.75rem] shrink-0\"\n value={currentMonth.getMonth()}\n onChange={(e) => setMonthFromSelect(Number(e.target.value))}\n aria-label={locale.code?.startsWith(\"es\") ? \"Mes\" : \"Month\"}\n >\n {monthLabels.map((label, i) => (\n <option key={label} value={i}>\n {label}\n </option>\n ))}\n </DatePickerSelect>\n <DatePickerSelect\n wrapperClassName=\"w-[5.5rem] shrink-0\"\n className=\"tabular-nums text-center\"\n value={currentMonth.getFullYear()}\n onChange={(e) => setYearFromSelect(Number(e.target.value))}\n aria-label={locale.code?.startsWith(\"es\") ? \"Año\" : \"Year\"}\n >\n {yearOptions.map((y) => (\n <option key={y} value={y}>\n {y}\n </option>\n ))}\n </DatePickerSelect>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={goToNextMonth}\n className=\"h-9 w-9 shrink-0 p-0 hover:bg-muted hover:text-foreground\"\n aria-label={locale.code?.startsWith(\"es\") ? \"Mes siguiente\" : \"Next month\"}\n >\n <ChevronRight className=\"h-4 w-4\" />\n </Button>\n </div>\n\n <div className=\"mb-2 grid grid-cols-7 gap-1\">\n {weekdayLabels.map((day, i) => (\n <div\n key={i}\n className=\"px-0.5 py-2 text-center text-sm font-medium capitalize leading-tight text-muted-foreground\"\n >\n {day}\n </div>\n ))}\n </div>\n\n <div className=\"grid grid-cols-7 gap-1\">\n {days.map((day, index) => (\n <div key={index} className=\"flex h-9 w-9 items-center justify-center\">\n {day ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className={cn(\n \"h-9 w-9 p-0 font-normal\",\n isSelected(day) &&\n \"bg-primary text-primary-foreground hover:bg-primary-dark hover:text-primary-foreground\",\n isToday(day) &&\n !isSelected(day) &&\n \"bg-accent text-accent-foreground hover:bg-accent/80 hover:text-accent-foreground\",\n !isSelected(day) && !isToday(day) && \"hover:bg-muted hover:text-foreground\",\n )}\n onClick={() => handleDateSelect(day)}\n >\n {day.getDate()}\n </Button>\n ) : (\n <div className=\"h-9 w-9\" />\n )}\n </div>\n ))}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\nexport { DatePicker };\n"],"mappings":";AA+FI,SAUE,KAVF;AA7FJ,YAAY,WAAW;AACvB,SAAS,SAAS,QAAQ,mBAAmB;AAE7C,SAAS,YAAY;AACrB;AAAA,EACE,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,SAAS,gBAAgB,sBAAsB;AAmBxD,SAAS,gBAAgB,QAA2C;AAClE,QAAM,IAAI,OAAO,SAAS;AAC1B,MAAI,MAAM,OAAW,QAAO;AAC5B,SAAO;AACT;AAGA,SAAS,eAAe,QAAgB;AACtC,SAAO,MAAM;AAAA,IACX,MAAM,MAAM,KAAK,EAAE,QAAQ,GAAG,GAAG,CAAC,GAAG,MAAM,OAAO,IAAI,KAAK,MAAM,GAAG,CAAC,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC;AAAA,IAC1F,CAAC,MAAM;AAAA,EACT;AACF;AAGA,SAAS,sBAAsB,QAAwB;AACrD,QAAM,YAAY,CAAC,GAAG,OAAO,UAAU,KAAK,CAAC;AAC7C,MAAI,UAAU,UAAU,GAAG;AACzB,WAAO;AAAA,EACT;AACA,SAAO,UAAU,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE;AACtC;AAEA,SAAS,iBAAiB,QAAgB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C,KAAK,MACvB;AAAA,QAAC;AAAA;AAAA,UAEC,WAAU;AAAA,UAET;AAAA;AAAA,QAHI;AAAA,MAIP,CACD,GACH;AAAA,MAEA,oBAAC,SAAI,WAAU,0BACZ,eAAK,IAAI,CAAC,KAAK,UACd,oBAAC,SAAgB,WAAU,4CACxB,gBACC;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,WAAW;AAAA,YACT;AAAA,YACA,WAAW,GAAG,KACZ;AAAA,YACF,QAAQ,GAAG,KACT,CAAC,WAAW,GAAG,KACf;AAAA,YACF,CAAC,WAAW,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAK;AAAA,UACvC;AAAA,UACA,SAAS,MAAM,iBAAiB,GAAG;AAAA,UAElC,cAAI,QAAQ;AAAA;AAAA,MACf,IAEA,oBAAC,SAAI,WAAU,WAAU,KApBnB,KAsBV,CACD,GACH;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1,2 +1,3 @@
1
1
  export { DatePicker, DatePickerProps } from './date-picker.cjs';
2
2
  import 'react/jsx-runtime';
3
+ import 'date-fns';
@@ -1,2 +1,3 @@
1
1
  export { DatePicker, DatePickerProps } from './date-picker.js';
2
2
  import 'react/jsx-runtime';
3
+ import 'date-fns';
@@ -74,6 +74,7 @@ import '@radix-ui/react-collapsible';
74
74
  import '@radix-ui/react-dialog';
75
75
  import 'cmdk';
76
76
  import '@radix-ui/react-context-menu';
77
+ import 'date-fns';
77
78
  import 'vaul';
78
79
  import '@radix-ui/react-dropdown-menu';
79
80
  import 'react-hook-form';
@@ -74,6 +74,7 @@ import '@radix-ui/react-collapsible';
74
74
  import '@radix-ui/react-dialog';
75
75
  import 'cmdk';
76
76
  import '@radix-ui/react-context-menu';
77
+ import 'date-fns';
77
78
  import 'vaul';
78
79
  import '@radix-ui/react-dropdown-menu';
79
80
  import 'react-hook-form';
package/dist/index.d.cts CHANGED
@@ -85,6 +85,7 @@ import '@radix-ui/react-collapsible';
85
85
  import '@radix-ui/react-dialog';
86
86
  import 'cmdk';
87
87
  import '@radix-ui/react-context-menu';
88
+ import 'date-fns';
88
89
  import 'vaul';
89
90
  import '@radix-ui/react-dropdown-menu';
90
91
  import 'react-hook-form';
package/dist/index.d.ts CHANGED
@@ -85,6 +85,7 @@ import '@radix-ui/react-collapsible';
85
85
  import '@radix-ui/react-dialog';
86
86
  import 'cmdk';
87
87
  import '@radix-ui/react-context-menu';
88
+ import 'date-fns';
88
89
  import 'vaul';
89
90
  import '@radix-ui/react-dropdown-menu';
90
91
  import 'react-hook-form';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ginia/ui",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "Ginia Design System — Unified UI component library for all Ginia hubs",
5
5
  "license": "MIT",
6
6
  "private": false,