acai-ui-library 0.1.16 → 0.1.18
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/dist/components/calendar.cjs +16 -1
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.d.cts +1 -1
- package/dist/components/calendar.d.ts +1 -1
- package/dist/components/calendar.js +16 -1
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/date-picker.cjs +16 -1
- package/dist/components/date-picker.cjs.map +1 -1
- package/dist/components/date-picker.js +16 -1
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-time-picker.cjs +678 -0
- package/dist/components/date-time-picker.cjs.map +1 -0
- package/dist/components/date-time-picker.d.cts +73 -0
- package/dist/components/date-time-picker.d.ts +73 -0
- package/dist/components/date-time-picker.js +643 -0
- package/dist/components/date-time-picker.js.map +1 -0
- package/dist/components/time-picker.cjs +432 -0
- package/dist/components/time-picker.cjs.map +1 -0
- package/dist/components/time-picker.d.cts +108 -0
- package/dist/components/time-picker.d.ts +108 -0
- package/dist/components/time-picker.js +389 -0
- package/dist/components/time-picker.js.map +1 -0
- package/dist/index.cjs +669 -181
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +663 -178
- package/dist/index.js.map +1 -1
- package/dist/lib/brand.cjs +31 -0
- package/dist/lib/brand.cjs.map +1 -0
- package/dist/lib/brand.d.cts +4 -0
- package/dist/lib/brand.d.ts +4 -0
- package/dist/lib/brand.js +6 -0
- package/dist/lib/brand.js.map +1 -0
- package/package.json +1 -1
|
@@ -35,10 +35,25 @@ function cn(...inputs) {
|
|
|
35
35
|
|
|
36
36
|
// src/components/calendar.tsx
|
|
37
37
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
-
|
|
38
|
+
var DEFAULT_YEARS_BACK = 10;
|
|
39
|
+
var DEFAULT_YEARS_FORWARD = 10;
|
|
40
|
+
function Calendar({
|
|
41
|
+
className,
|
|
42
|
+
classNames,
|
|
43
|
+
showOutsideDays = true,
|
|
44
|
+
captionLayout = "dropdown",
|
|
45
|
+
startMonth,
|
|
46
|
+
endMonth,
|
|
47
|
+
...props
|
|
48
|
+
}) {
|
|
49
|
+
const now = /* @__PURE__ */ new Date();
|
|
50
|
+
const defaultedStartMonth = startMonth ?? new Date(now.getFullYear() - DEFAULT_YEARS_BACK, 0, 1);
|
|
51
|
+
const defaultedEndMonth = endMonth ?? new Date(now.getFullYear() + DEFAULT_YEARS_FORWARD, 11, 1);
|
|
39
52
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
40
53
|
import_react_day_picker.DayPicker,
|
|
41
54
|
{
|
|
55
|
+
startMonth: defaultedStartMonth,
|
|
56
|
+
endMonth: defaultedEndMonth,
|
|
42
57
|
showOutsideDays,
|
|
43
58
|
className: cn("w-[260px] rounded-lg p-3", className),
|
|
44
59
|
classNames: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/calendar.tsx","../../src/lib/utils.ts"],"sourcesContent":["import * as React from \"react\"\nimport { DayPicker } from \"react-day-picker\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\nfunction Calendar({
|
|
1
|
+
{"version":3,"sources":["../../src/components/calendar.tsx","../../src/lib/utils.ts"],"sourcesContent":["import * as React from \"react\"\nimport { DayPicker } from \"react-day-picker\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\n/**\n * How far the year dropdown reaches when the caller gives no bounds.\n *\n * `captionLayout` defaults to \"dropdown\" here, and react-day-picker then falls\n * back to [currentYear - 100, currentYear] for the year list. That is wrong in\n * both directions: a hundred dead years to scroll past, and no future year at\n * all - a deadline could not be set beyond December of the current year.\n * Callers that know their range pass `startMonth` / `endMonth` and these are\n * not used.\n */\nconst DEFAULT_YEARS_BACK = 10\nconst DEFAULT_YEARS_FORWARD = 10\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"dropdown\",\n startMonth,\n endMonth,\n ...props\n}: CalendarProps) {\n const now = new Date()\n const defaultedStartMonth =\n startMonth ?? new Date(now.getFullYear() - DEFAULT_YEARS_BACK, 0, 1)\n const defaultedEndMonth =\n endMonth ?? new Date(now.getFullYear() + DEFAULT_YEARS_FORWARD, 11, 1)\n\n return (\n <DayPicker\n startMonth={defaultedStartMonth}\n endMonth={defaultedEndMonth}\n showOutsideDays={showOutsideDays}\n className={cn(\"w-[260px] rounded-lg p-3\", className)}\n classNames={{\n months: \"flex flex-col\",\n month: \"space-y-3\",\n month_caption: \"relative flex h-8 items-center justify-center\",\n caption_label: \"text-sm font-medium hidden\",\n nav: \"flex items-center\",\n button_previous: cn(\n \"absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n button_next: cn(\n \"absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n month_grid: \"w-full border-collapse\",\n weekdays: \"flex w-full\",\n weekday:\n \"flex-1 h-8 flex items-center justify-center text-[11px] font-medium text-muted-foreground uppercase tracking-wider\",\n week: \"flex w-full mt-1\",\n day: \"flex-1 h-8 p-0 relative focus-within:z-20 flex items-center justify-center text-sm\",\n day_button: cn(\n \"inline-flex size-8 items-center justify-center rounded-md bg-transparent text-sm font-normal cursor-pointer border-none hover:bg-[var(--hc-color-border-subtle)] transition-colors\"\n ),\n range_end: \"day-range-end\",\n selected:\n \"[&>button]:bg-[var(--hc-primary-600)] [&>button]:text-white [&>button]:hover:bg-[var(--hc-primary-600)] [&>button]:hover:text-white [&>button]:font-medium\",\n today: \"[&>button]:font-semibold [&>button]:text-[var(--hc-primary-600)]\",\n outside:\n \"day-outside [&>button]:bg-transparent [&>button]:text-[var(--hc-grey-200)]\",\n disabled: \"[&>button]:text-[var(--hc-grey-200)] [&>button]:opacity-50 [&>button]:cursor-default\",\n range_middle:\n \"[&>button]:bg-[var(--hc-primary-100)] [&>button]:text-foreground [&>button]:rounded-none\",\n range_start: \"[&>button]:rounded-e-none\",\n dropdowns: \"flex items-center gap-1.5 justify-center [&>select]:flex-1\",\n dropdown:\n \"h-7 w-[88px] rounded-md border border-[var(--hc-color-border-subtle)] bg-background px-2 text-xs font-medium text-foreground cursor-pointer outline-none accent-[var(--hc-primary-600)] focus:border-[var(--hc-primary-500)] focus:ring-[2px] focus:ring-[var(--hc-primary-500)]/20 [&>option:checked]:bg-[var(--hc-primary-600)] [&>option:checked]:text-white [&>option]:py-1\",\n hidden: \"invisible\",\n ...classNames,\n }}\n captionLayout={captionLayout}\n components={{\n Chevron: ({ orientation }) => {\n const Icon = orientation === \"left\" ? ChevronLeft : ChevronRight\n return <Icon className=\"size-4\" />\n },\n }}\n {...props}\n />\n )\n}\nCalendar.displayName = \"Calendar\"\n\nexport { Calendar }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAA0B;AAC1B,0BAA0C;;;ACF1C,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;AD6EiB;AAjEjB,IAAM,qBAAqB;AAC3B,IAAM,wBAAwB;AAE9B,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkB;AAChB,QAAM,MAAM,oBAAI,KAAK;AACrB,QAAM,sBACJ,cAAc,IAAI,KAAK,IAAI,YAAY,IAAI,oBAAoB,GAAG,CAAC;AACrE,QAAM,oBACJ,YAAY,IAAI,KAAK,IAAI,YAAY,IAAI,uBAAuB,IAAI,CAAC;AAEvE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,MACA,WAAW,GAAG,4BAA4B,SAAS;AAAA,MACnD,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,eAAe;AAAA,QACf,eAAe;AAAA,QACf,KAAK;AAAA,QACL,iBAAiB;AAAA,UACf;AAAA,QACF;AAAA,QACA,aAAa;AAAA,UACX;AAAA,QACF;AAAA,QACA,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,SACE;AAAA,QACF,MAAM;AAAA,QACN,KAAK;AAAA,QACL,YAAY;AAAA,UACV;AAAA,QACF;AAAA,QACA,WAAW;AAAA,QACX,UACE;AAAA,QACF,OAAO;AAAA,QACP,SACE;AAAA,QACF,UAAU;AAAA,QACV,cACE;AAAA,QACF,aAAa;AAAA,QACb,WAAW;AAAA,QACX,UACE;AAAA,QACF,QAAQ;AAAA,QACR,GAAG;AAAA,MACL;AAAA,MACA;AAAA,MACA,YAAY;AAAA,QACV,SAAS,CAAC,EAAE,YAAY,MAAM;AAC5B,gBAAM,OAAO,gBAAgB,SAAS,kCAAc;AACpD,iBAAO,4CAAC,QAAK,WAAU,UAAS;AAAA,QAClC;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AACA,SAAS,cAAc;","names":[]}
|
|
@@ -3,7 +3,7 @@ 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, captionLayout, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
|
|
6
|
+
declare function Calendar({ className, classNames, showOutsideDays, captionLayout, startMonth, endMonth, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
|
|
7
7
|
declare namespace Calendar {
|
|
8
8
|
var displayName: string;
|
|
9
9
|
}
|
|
@@ -3,7 +3,7 @@ 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, captionLayout, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
|
|
6
|
+
declare function Calendar({ className, classNames, showOutsideDays, captionLayout, startMonth, endMonth, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
|
|
7
7
|
declare namespace Calendar {
|
|
8
8
|
var displayName: string;
|
|
9
9
|
}
|
|
@@ -11,10 +11,25 @@ function cn(...inputs) {
|
|
|
11
11
|
|
|
12
12
|
// src/components/calendar.tsx
|
|
13
13
|
import { jsx } from "react/jsx-runtime";
|
|
14
|
-
|
|
14
|
+
var DEFAULT_YEARS_BACK = 10;
|
|
15
|
+
var DEFAULT_YEARS_FORWARD = 10;
|
|
16
|
+
function Calendar({
|
|
17
|
+
className,
|
|
18
|
+
classNames,
|
|
19
|
+
showOutsideDays = true,
|
|
20
|
+
captionLayout = "dropdown",
|
|
21
|
+
startMonth,
|
|
22
|
+
endMonth,
|
|
23
|
+
...props
|
|
24
|
+
}) {
|
|
25
|
+
const now = /* @__PURE__ */ new Date();
|
|
26
|
+
const defaultedStartMonth = startMonth ?? new Date(now.getFullYear() - DEFAULT_YEARS_BACK, 0, 1);
|
|
27
|
+
const defaultedEndMonth = endMonth ?? new Date(now.getFullYear() + DEFAULT_YEARS_FORWARD, 11, 1);
|
|
15
28
|
return /* @__PURE__ */ jsx(
|
|
16
29
|
DayPicker,
|
|
17
30
|
{
|
|
31
|
+
startMonth: defaultedStartMonth,
|
|
32
|
+
endMonth: defaultedEndMonth,
|
|
18
33
|
showOutsideDays,
|
|
19
34
|
className: cn("w-[260px] rounded-lg p-3", className),
|
|
20
35
|
classNames: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/calendar.tsx","../../src/lib/utils.ts"],"sourcesContent":["import * as React from \"react\"\nimport { DayPicker } from \"react-day-picker\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\nfunction Calendar({
|
|
1
|
+
{"version":3,"sources":["../../src/components/calendar.tsx","../../src/lib/utils.ts"],"sourcesContent":["import * as React from \"react\"\nimport { DayPicker } from \"react-day-picker\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\n/**\n * How far the year dropdown reaches when the caller gives no bounds.\n *\n * `captionLayout` defaults to \"dropdown\" here, and react-day-picker then falls\n * back to [currentYear - 100, currentYear] for the year list. That is wrong in\n * both directions: a hundred dead years to scroll past, and no future year at\n * all - a deadline could not be set beyond December of the current year.\n * Callers that know their range pass `startMonth` / `endMonth` and these are\n * not used.\n */\nconst DEFAULT_YEARS_BACK = 10\nconst DEFAULT_YEARS_FORWARD = 10\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"dropdown\",\n startMonth,\n endMonth,\n ...props\n}: CalendarProps) {\n const now = new Date()\n const defaultedStartMonth =\n startMonth ?? new Date(now.getFullYear() - DEFAULT_YEARS_BACK, 0, 1)\n const defaultedEndMonth =\n endMonth ?? new Date(now.getFullYear() + DEFAULT_YEARS_FORWARD, 11, 1)\n\n return (\n <DayPicker\n startMonth={defaultedStartMonth}\n endMonth={defaultedEndMonth}\n showOutsideDays={showOutsideDays}\n className={cn(\"w-[260px] rounded-lg p-3\", className)}\n classNames={{\n months: \"flex flex-col\",\n month: \"space-y-3\",\n month_caption: \"relative flex h-8 items-center justify-center\",\n caption_label: \"text-sm font-medium hidden\",\n nav: \"flex items-center\",\n button_previous: cn(\n \"absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n button_next: cn(\n \"absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n month_grid: \"w-full border-collapse\",\n weekdays: \"flex w-full\",\n weekday:\n \"flex-1 h-8 flex items-center justify-center text-[11px] font-medium text-muted-foreground uppercase tracking-wider\",\n week: \"flex w-full mt-1\",\n day: \"flex-1 h-8 p-0 relative focus-within:z-20 flex items-center justify-center text-sm\",\n day_button: cn(\n \"inline-flex size-8 items-center justify-center rounded-md bg-transparent text-sm font-normal cursor-pointer border-none hover:bg-[var(--hc-color-border-subtle)] transition-colors\"\n ),\n range_end: \"day-range-end\",\n selected:\n \"[&>button]:bg-[var(--hc-primary-600)] [&>button]:text-white [&>button]:hover:bg-[var(--hc-primary-600)] [&>button]:hover:text-white [&>button]:font-medium\",\n today: \"[&>button]:font-semibold [&>button]:text-[var(--hc-primary-600)]\",\n outside:\n \"day-outside [&>button]:bg-transparent [&>button]:text-[var(--hc-grey-200)]\",\n disabled: \"[&>button]:text-[var(--hc-grey-200)] [&>button]:opacity-50 [&>button]:cursor-default\",\n range_middle:\n \"[&>button]:bg-[var(--hc-primary-100)] [&>button]:text-foreground [&>button]:rounded-none\",\n range_start: \"[&>button]:rounded-e-none\",\n dropdowns: \"flex items-center gap-1.5 justify-center [&>select]:flex-1\",\n dropdown:\n \"h-7 w-[88px] rounded-md border border-[var(--hc-color-border-subtle)] bg-background px-2 text-xs font-medium text-foreground cursor-pointer outline-none accent-[var(--hc-primary-600)] focus:border-[var(--hc-primary-500)] focus:ring-[2px] focus:ring-[var(--hc-primary-500)]/20 [&>option:checked]:bg-[var(--hc-primary-600)] [&>option:checked]:text-white [&>option]:py-1\",\n hidden: \"invisible\",\n ...classNames,\n }}\n captionLayout={captionLayout}\n components={{\n Chevron: ({ orientation }) => {\n const Icon = orientation === \"left\" ? ChevronLeft : ChevronRight\n return <Icon className=\"size-4\" />\n },\n }}\n {...props}\n />\n )\n}\nCalendar.displayName = \"Calendar\"\n\nexport { Calendar }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":";AACA,SAAS,iBAAiB;AAC1B,SAAS,aAAa,oBAAoB;;;ACF1C,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;AD6EiB;AAjEjB,IAAM,qBAAqB;AAC3B,IAAM,wBAAwB;AAE9B,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkB;AAChB,QAAM,MAAM,oBAAI,KAAK;AACrB,QAAM,sBACJ,cAAc,IAAI,KAAK,IAAI,YAAY,IAAI,oBAAoB,GAAG,CAAC;AACrE,QAAM,oBACJ,YAAY,IAAI,KAAK,IAAI,YAAY,IAAI,uBAAuB,IAAI,CAAC;AAEvE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,MACA,WAAW,GAAG,4BAA4B,SAAS;AAAA,MACnD,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,eAAe;AAAA,QACf,eAAe;AAAA,QACf,KAAK;AAAA,QACL,iBAAiB;AAAA,UACf;AAAA,QACF;AAAA,QACA,aAAa;AAAA,UACX;AAAA,QACF;AAAA,QACA,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,SACE;AAAA,QACF,MAAM;AAAA,QACN,KAAK;AAAA,QACL,YAAY;AAAA,UACV;AAAA,QACF;AAAA,QACA,WAAW;AAAA,QACX,UACE;AAAA,QACF,OAAO;AAAA,QACP,SACE;AAAA,QACF,UAAU;AAAA,QACV,cACE;AAAA,QACF,aAAa;AAAA,QACb,WAAW;AAAA,QACX,UACE;AAAA,QACF,QAAQ;AAAA,QACR,GAAG;AAAA,MACL;AAAA,MACA;AAAA,MACA,YAAY;AAAA,QACV,SAAS,CAAC,EAAE,YAAY,MAAM;AAC5B,gBAAM,OAAO,gBAAgB,SAAS,cAAc;AACpD,iBAAO,oBAAC,QAAK,WAAU,UAAS;AAAA,QAClC;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AACA,SAAS,cAAc;","names":[]}
|
|
@@ -123,10 +123,25 @@ Button.displayName = "Button";
|
|
|
123
123
|
var import_react_day_picker = require("react-day-picker");
|
|
124
124
|
var import_lucide_react2 = require("lucide-react");
|
|
125
125
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
126
|
-
|
|
126
|
+
var DEFAULT_YEARS_BACK = 10;
|
|
127
|
+
var DEFAULT_YEARS_FORWARD = 10;
|
|
128
|
+
function Calendar({
|
|
129
|
+
className,
|
|
130
|
+
classNames,
|
|
131
|
+
showOutsideDays = true,
|
|
132
|
+
captionLayout = "dropdown",
|
|
133
|
+
startMonth,
|
|
134
|
+
endMonth,
|
|
135
|
+
...props
|
|
136
|
+
}) {
|
|
137
|
+
const now = /* @__PURE__ */ new Date();
|
|
138
|
+
const defaultedStartMonth = startMonth ?? new Date(now.getFullYear() - DEFAULT_YEARS_BACK, 0, 1);
|
|
139
|
+
const defaultedEndMonth = endMonth ?? new Date(now.getFullYear() + DEFAULT_YEARS_FORWARD, 11, 1);
|
|
127
140
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
128
141
|
import_react_day_picker.DayPicker,
|
|
129
142
|
{
|
|
143
|
+
startMonth: defaultedStartMonth,
|
|
144
|
+
endMonth: defaultedEndMonth,
|
|
130
145
|
showOutsideDays,
|
|
131
146
|
className: cn("w-[260px] rounded-lg p-3", className),
|
|
132
147
|
classNames: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/date-picker.tsx","../../src/lib/utils.ts","../../src/components/button.tsx","../../src/components/calendar.tsx","../../src/components/popover.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { CalendarIcon } from \"lucide-react\"\nimport type { DateRange, Matcher } from \"react-day-picker\"\nimport { cn } from \"../lib/utils\"\nimport { Button } from \"./button\"\nimport { Calendar } from \"./calendar\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\n\nexport type DatePickerPreset =\n | { label: string; value: Date }\n | { label: string; value: { from: Date; to: Date } }\n\nexport interface DatePickerProps {\n /** Selected value. For `mode=\"single\"` this is a Date, for `mode=\"range\"` this is a range object. */\n date?: Date | DateRange\n /** Called with the new selection. */\n onDateChange?: (date: Date | DateRange | undefined) => void\n /** Selection mode. Defaults to \"single\". */\n mode?: \"single\" | \"range\"\n /** Placeholder for the trigger when no date is picked. */\n placeholder?: string\n /** Classname applied to the trigger button. */\n className?: string\n /** Optional date format string — reserved for future use. */\n formatStr?: string\n /** Optional preset list rendered in a sidebar to the left of the calendar. */\n presets?: DatePickerPreset[]\n /** Passed through to the underlying Calendar. */\n disabled?: Matcher | Matcher[]\n}\n\nfunction formatDate(d: Date): string {\n return d.toLocaleDateString()\n}\n\nfunction DatePicker({\n date,\n onDateChange,\n mode = \"single\",\n placeholder = \"Pick a date\",\n className,\n presets,\n disabled,\n}: DatePickerProps) {\n const label = React.useMemo(() => {\n if (!date) return <span>{placeholder}</span>\n if (mode === \"range\") {\n const range = date as DateRange\n if (range.from && range.to) {\n return `${formatDate(range.from)} – ${formatDate(range.to)}`\n }\n if (range.from) return formatDate(range.from)\n return <span>{placeholder}</span>\n }\n return (date as Date).toLocaleDateString()\n }, [date, mode, placeholder])\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n className={cn(\n \"w-[280px] justify-start text-left font-normal\",\n !date && \"text-muted-foreground\",\n className\n )}\n >\n <CalendarIcon className=\"me-2 h-4 w-4\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <div className=\"flex\">\n {presets && presets.length > 0 && (\n <div className=\"flex flex-col gap-1 border-e p-2 min-w-[140px]\">\n {presets.map((preset) => (\n <Button\n key={preset.label}\n variant=\"ghost\"\n size=\"sm\"\n className=\"justify-start font-normal\"\n onClick={() => onDateChange?.(preset.value as Date | DateRange)}\n >\n {preset.label}\n </Button>\n ))}\n </div>\n )}\n <div>\n {mode === \"range\" ? (\n <Calendar\n mode=\"range\"\n selected={date as DateRange | undefined}\n onSelect={(value) => onDateChange?.(value)}\n disabled={disabled}\n // Focus moves into the calendar the user just opened (keyboard navigation).\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n />\n ) : (\n <Calendar\n mode=\"single\"\n selected={date as Date | undefined}\n onSelect={(value) => onDateChange?.(value)}\n disabled={disabled}\n // Focus moves into the calendar the user just opened (keyboard navigation).\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n />\n )}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )\n}\n\nexport { DatePicker }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\nimport * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Loader2 } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground hover:bg-primary-hover\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive-hover\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary-hover\",\n ghost:\n \"hover:bg-accent hover:text-accent-foreground\",\n link:\n \"text-primary underline-offset-4 hover:underline\",\n success:\n \"bg-success text-success-foreground hover:bg-success-hover\",\n },\n size: {\n xs: \"h-7 px-2.5 text-xs\",\n sm: \"h-9 px-3\",\n default: \"h-10 px-4 py-2\",\n lg: \"h-11 px-8\",\n icon: \"h-10 w-10\",\n \"icon-sm\": \"h-8 w-8\",\n },\n shape: {\n default: \"rounded-md\",\n rounded: \"rounded-lg\",\n pill: \"rounded-full\",\n square: \"rounded-none\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n shape: \"default\",\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n loading?: boolean\n prefixIcon?: React.ReactNode\n suffixIcon?: React.ReactNode\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n shape,\n asChild = false,\n loading = false,\n prefixIcon,\n suffixIcon,\n children,\n disabled,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, shape, className }))}\n ref={ref}\n disabled={isDisabled}\n {...props}\n >\n {loading && <Loader2 className=\"animate-spin\" />}\n {!loading && prefixIcon}\n {children}\n {suffixIcon}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\nimport { DayPicker } from \"react-day-picker\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\nfunction Calendar({ className, classNames, showOutsideDays = true, captionLayout = \"dropdown\", ...props }: CalendarProps) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\"w-[260px] rounded-lg p-3\", className)}\n classNames={{\n months: \"flex flex-col\",\n month: \"space-y-3\",\n month_caption: \"relative flex h-8 items-center justify-center\",\n caption_label: \"text-sm font-medium hidden\",\n nav: \"flex items-center\",\n button_previous: cn(\n \"absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n button_next: cn(\n \"absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n month_grid: \"w-full border-collapse\",\n weekdays: \"flex w-full\",\n weekday:\n \"flex-1 h-8 flex items-center justify-center text-[11px] font-medium text-muted-foreground uppercase tracking-wider\",\n week: \"flex w-full mt-1\",\n day: \"flex-1 h-8 p-0 relative focus-within:z-20 flex items-center justify-center text-sm\",\n day_button: cn(\n \"inline-flex size-8 items-center justify-center rounded-md bg-transparent text-sm font-normal cursor-pointer border-none hover:bg-[var(--hc-color-border-subtle)] transition-colors\"\n ),\n range_end: \"day-range-end\",\n selected:\n \"[&>button]:bg-[var(--hc-primary-600)] [&>button]:text-white [&>button]:hover:bg-[var(--hc-primary-600)] [&>button]:hover:text-white [&>button]:font-medium\",\n today: \"[&>button]:font-semibold [&>button]:text-[var(--hc-primary-600)]\",\n outside:\n \"day-outside [&>button]:bg-transparent [&>button]:text-[var(--hc-grey-200)]\",\n disabled: \"[&>button]:text-[var(--hc-grey-200)] [&>button]:opacity-50 [&>button]:cursor-default\",\n range_middle:\n \"[&>button]:bg-[var(--hc-primary-100)] [&>button]:text-foreground [&>button]:rounded-none\",\n range_start: \"[&>button]:rounded-e-none\",\n dropdowns: \"flex items-center gap-1.5 justify-center [&>select]:flex-1\",\n dropdown:\n \"h-7 w-[88px] rounded-md border border-[var(--hc-color-border-subtle)] bg-background px-2 text-xs font-medium text-foreground cursor-pointer outline-none accent-[var(--hc-primary-600)] focus:border-[var(--hc-primary-500)] focus:ring-[2px] focus:ring-[var(--hc-primary-500)]/20 [&>option:checked]:bg-[var(--hc-primary-600)] [&>option:checked]:text-white [&>option]:py-1\",\n hidden: \"invisible\",\n ...classNames,\n }}\n captionLayout={captionLayout}\n components={{\n Chevron: ({ orientation }) => {\n const Icon = orientation === \"left\" ? ChevronLeft : ChevronRight\n return <Icon className=\"size-4\" />\n },\n }}\n {...props}\n />\n )\n}\nCalendar.displayName = \"Calendar\"\n\nexport { Calendar }\n","import * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\nimport { cn } from \"../lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,SAAuB;AACvB,IAAAC,uBAA6B;;;ACD7B,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ACJA,YAAuB;AACvB,wBAAqB;AACrB,sCAAuC;AACvC,0BAAwB;AA4ElB;AAzEN,IAAM,qBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,WACE;AAAA,QACF,OACE;AAAA,QACF,MACE;AAAA,QACF,SACE;AAAA,MACJ;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,WAAW;AAAA,MACb;AAAA,MACA,OAAO;AAAA,QACL,SAAS;AAAA,QACT,SAAS;AAAA,QACT,MAAM;AAAA,QACN,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,EACF;AACF;AAWA,IAAM,SAAe;AAAA,EACnB,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GACA,QACG;AACH,UAAM,OAAO,UAAU,yBAAO;AAC9B,UAAM,aAAa,YAAY;AAE/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,OAAO,UAAU,C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WAAU,cAAa,OAAM,SAC3C,wDAAC,SAAI,WAAU,QACZ;AAAA,iBAAW,QAAQ,SAAS,KAC3B,6CAAC,SAAI,WAAU,kDACZ,kBAAQ,IAAI,CAAC,WACZ;AAAA,QAAC;AAAA;AAAA,UAEC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,WAAU;AAAA,UACV,SAAS,MAAM,eAAe,OAAO,KAAyB;AAAA,UAE7D,iBAAO;AAAA;AAAA,QANH,OAAO;AAAA,MAOd,CACD,GACH;AAAA,MAEF,6CAAC,SACE,mBAAS,UACR;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,UAAU;AAAA,UACV,UAAU,CAAC,UAAU,eAAe,KAAK;AAAA,UACzC;AAAA,UAGA,WAAS;AAAA;AAAA,MACX,IAEA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,UAAU;AAAA,UACV,UAAU,CAAC,UAAU,eAAe,KAAK;AAAA,UACzC;AAAA,UAGA,WAAS;AAAA;AAAA,MACX,GAEJ;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":["React","import_lucide_react","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/date-picker.tsx","../../src/lib/utils.ts","../../src/components/button.tsx","../../src/components/calendar.tsx","../../src/components/popover.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { CalendarIcon } from \"lucide-react\"\nimport type { DateRange, Matcher } from \"react-day-picker\"\nimport { cn } from \"../lib/utils\"\nimport { Button } from \"./button\"\nimport { Calendar } from \"./calendar\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\n\nexport type DatePickerPreset =\n | { label: string; value: Date }\n | { label: string; value: { from: Date; to: Date } }\n\nexport interface DatePickerProps {\n /** Selected value. For `mode=\"single\"` this is a Date, for `mode=\"range\"` this is a range object. */\n date?: Date | DateRange\n /** Called with the new selection. */\n onDateChange?: (date: Date | DateRange | undefined) => void\n /** Selection mode. Defaults to \"single\". */\n mode?: \"single\" | \"range\"\n /** Placeholder for the trigger when no date is picked. */\n placeholder?: string\n /** Classname applied to the trigger button. */\n className?: string\n /** Optional date format string — reserved for future use. */\n formatStr?: string\n /** Optional preset list rendered in a sidebar to the left of the calendar. */\n presets?: DatePickerPreset[]\n /** Passed through to the underlying Calendar. */\n disabled?: Matcher | Matcher[]\n}\n\nfunction formatDate(d: Date): string {\n return d.toLocaleDateString()\n}\n\nfunction DatePicker({\n date,\n onDateChange,\n mode = \"single\",\n placeholder = \"Pick a date\",\n className,\n presets,\n disabled,\n}: DatePickerProps) {\n const label = React.useMemo(() => {\n if (!date) return <span>{placeholder}</span>\n if (mode === \"range\") {\n const range = date as DateRange\n if (range.from && range.to) {\n return `${formatDate(range.from)} – ${formatDate(range.to)}`\n }\n if (range.from) return formatDate(range.from)\n return <span>{placeholder}</span>\n }\n return (date as Date).toLocaleDateString()\n }, [date, mode, placeholder])\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n className={cn(\n \"w-[280px] justify-start text-left font-normal\",\n !date && \"text-muted-foreground\",\n className\n )}\n >\n <CalendarIcon className=\"me-2 h-4 w-4\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <div className=\"flex\">\n {presets && presets.length > 0 && (\n <div className=\"flex flex-col gap-1 border-e p-2 min-w-[140px]\">\n {presets.map((preset) => (\n <Button\n key={preset.label}\n variant=\"ghost\"\n size=\"sm\"\n className=\"justify-start font-normal\"\n onClick={() => onDateChange?.(preset.value as Date | DateRange)}\n >\n {preset.label}\n </Button>\n ))}\n </div>\n )}\n <div>\n {mode === \"range\" ? (\n <Calendar\n mode=\"range\"\n selected={date as DateRange | undefined}\n onSelect={(value) => onDateChange?.(value)}\n disabled={disabled}\n // Focus moves into the calendar the user just opened (keyboard navigation).\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n />\n ) : (\n <Calendar\n mode=\"single\"\n selected={date as Date | undefined}\n onSelect={(value) => onDateChange?.(value)}\n disabled={disabled}\n // Focus moves into the calendar the user just opened (keyboard navigation).\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n />\n )}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )\n}\n\nexport { DatePicker }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\nimport * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Loader2 } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground hover:bg-primary-hover\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive-hover\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary-hover\",\n ghost:\n \"hover:bg-accent hover:text-accent-foreground\",\n link:\n \"text-primary underline-offset-4 hover:underline\",\n success:\n \"bg-success text-success-foreground hover:bg-success-hover\",\n },\n size: {\n xs: \"h-7 px-2.5 text-xs\",\n sm: \"h-9 px-3\",\n default: \"h-10 px-4 py-2\",\n lg: \"h-11 px-8\",\n icon: \"h-10 w-10\",\n \"icon-sm\": \"h-8 w-8\",\n },\n shape: {\n default: \"rounded-md\",\n rounded: \"rounded-lg\",\n pill: \"rounded-full\",\n square: \"rounded-none\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n shape: \"default\",\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n loading?: boolean\n prefixIcon?: React.ReactNode\n suffixIcon?: React.ReactNode\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n shape,\n asChild = false,\n loading = false,\n prefixIcon,\n suffixIcon,\n children,\n disabled,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, shape, className }))}\n ref={ref}\n disabled={isDisabled}\n {...props}\n >\n {loading && <Loader2 className=\"animate-spin\" />}\n {!loading && prefixIcon}\n {children}\n {suffixIcon}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\nimport { DayPicker } from \"react-day-picker\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\n/**\n * How far the year dropdown reaches when the caller gives no bounds.\n *\n * `captionLayout` defaults to \"dropdown\" here, and react-day-picker then falls\n * back to [currentYear - 100, currentYear] for the year list. That is wrong in\n * both directions: a hundred dead years to scroll past, and no future year at\n * all - a deadline could not be set beyond December of the current year.\n * Callers that know their range pass `startMonth` / `endMonth` and these are\n * not used.\n */\nconst DEFAULT_YEARS_BACK = 10\nconst DEFAULT_YEARS_FORWARD = 10\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"dropdown\",\n startMonth,\n endMonth,\n ...props\n}: CalendarProps) {\n const now = new Date()\n const defaultedStartMonth =\n startMonth ?? new Date(now.getFullYear() - DEFAULT_YEARS_BACK, 0, 1)\n const defaultedEndMonth =\n endMonth ?? new Date(now.getFullYear() + DEFAULT_YEARS_FORWARD, 11, 1)\n\n return (\n <DayPicker\n startMonth={defaultedStartMonth}\n endMonth={defaultedEndMonth}\n showOutsideDays={showOutsideDays}\n className={cn(\"w-[260px] rounded-lg p-3\", className)}\n classNames={{\n months: \"flex flex-col\",\n month: \"space-y-3\",\n month_caption: \"relative flex h-8 items-center justify-center\",\n caption_label: \"text-sm font-medium hidden\",\n nav: \"flex items-center\",\n button_previous: cn(\n \"absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n button_next: cn(\n \"absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n month_grid: \"w-full border-collapse\",\n weekdays: \"flex w-full\",\n weekday:\n \"flex-1 h-8 flex items-center justify-center text-[11px] font-medium text-muted-foreground uppercase tracking-wider\",\n week: \"flex w-full mt-1\",\n day: \"flex-1 h-8 p-0 relative focus-within:z-20 flex items-center justify-center text-sm\",\n day_button: cn(\n \"inline-flex size-8 items-center justify-center rounded-md bg-transparent text-sm font-normal cursor-pointer border-none hover:bg-[var(--hc-color-border-subtle)] transition-colors\"\n ),\n range_end: \"day-range-end\",\n selected:\n \"[&>button]:bg-[var(--hc-primary-600)] [&>button]:text-white [&>button]:hover:bg-[var(--hc-primary-600)] [&>button]:hover:text-white [&>button]:font-medium\",\n today: \"[&>button]:font-semibold [&>button]:text-[var(--hc-primary-600)]\",\n outside:\n \"day-outside [&>button]:bg-transparent [&>button]:text-[var(--hc-grey-200)]\",\n disabled: \"[&>button]:text-[var(--hc-grey-200)] [&>button]:opacity-50 [&>button]:cursor-default\",\n range_middle:\n \"[&>button]:bg-[var(--hc-primary-100)] [&>button]:text-foreground [&>button]:rounded-none\",\n range_start: \"[&>button]:rounded-e-none\",\n dropdowns: \"flex items-center gap-1.5 justify-center [&>select]:flex-1\",\n dropdown:\n \"h-7 w-[88px] rounded-md border border-[var(--hc-color-border-subtle)] bg-background px-2 text-xs font-medium text-foreground cursor-pointer outline-none accent-[var(--hc-primary-600)] focus:border-[var(--hc-primary-500)] focus:ring-[2px] focus:ring-[var(--hc-primary-500)]/20 [&>option:checked]:bg-[var(--hc-primary-600)] [&>option:checked]:text-white [&>option]:py-1\",\n hidden: \"invisible\",\n ...classNames,\n }}\n captionLayout={captionLayout}\n components={{\n Chevron: ({ orientation }) => {\n const Icon = orientation === \"left\" ? ChevronLeft : ChevronRight\n return <Icon className=\"size-4\" />\n },\n }}\n {...props}\n />\n )\n}\nCalendar.displayName = \"Calendar\"\n\nexport { Calendar }\n","import * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\nimport { cn } from \"../lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,SAAuB;AACvB,IAA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QAAQ;AAAA,UACT;AAAA,QACF;AAAA,QAEA;AAAA,uDAAC,qCAAa,WAAU,gBAAe;AAAA,UACtC;AAAA;AAAA;AAAA,IACH,GACF;AAAA,IACA,6CAAC,kBAAe,WAAU,cAAa,OAAM,SAC3C,wDAAC,SAAI,WAAU,QACZ;AAAA,iBAAW,QAAQ,SAAS,KAC3B,6CAAC,SAAI,WAAU,kDACZ,kBAAQ,IAAI,CAAC,WACZ;AAAA,QAAC;AAAA;AAAA,UAEC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,WAAU;AAAA,UACV,SAAS,MAAM,eAAe,OAAO,KAAyB;AAAA,UAE7D,iBAAO;AAAA;AAAA,QANH,OAAO;AAAA,MAOd,CACD,GACH;AAAA,MAEF,6CAAC,SACE,mBAAS,UACR;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,UAAU;AAAA,UACV,UAAU,CAAC,UAAU,eAAe,KAAK;AAAA,UACzC;AAAA,UAGA,WAAS;AAAA;AAAA,MACX,IAEA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,UAAU;AAAA,UACV,UAAU,CAAC,UAAU,eAAe,KAAK;AAAA,UACzC;AAAA,UAGA,WAAS;AAAA;AAAA,MACX,GAEJ;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":["React","import_lucide_react","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime"]}
|
|
@@ -89,10 +89,25 @@ Button.displayName = "Button";
|
|
|
89
89
|
import { DayPicker } from "react-day-picker";
|
|
90
90
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
91
91
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
92
|
-
|
|
92
|
+
var DEFAULT_YEARS_BACK = 10;
|
|
93
|
+
var DEFAULT_YEARS_FORWARD = 10;
|
|
94
|
+
function Calendar({
|
|
95
|
+
className,
|
|
96
|
+
classNames,
|
|
97
|
+
showOutsideDays = true,
|
|
98
|
+
captionLayout = "dropdown",
|
|
99
|
+
startMonth,
|
|
100
|
+
endMonth,
|
|
101
|
+
...props
|
|
102
|
+
}) {
|
|
103
|
+
const now = /* @__PURE__ */ new Date();
|
|
104
|
+
const defaultedStartMonth = startMonth ?? new Date(now.getFullYear() - DEFAULT_YEARS_BACK, 0, 1);
|
|
105
|
+
const defaultedEndMonth = endMonth ?? new Date(now.getFullYear() + DEFAULT_YEARS_FORWARD, 11, 1);
|
|
93
106
|
return /* @__PURE__ */ jsx2(
|
|
94
107
|
DayPicker,
|
|
95
108
|
{
|
|
109
|
+
startMonth: defaultedStartMonth,
|
|
110
|
+
endMonth: defaultedEndMonth,
|
|
96
111
|
showOutsideDays,
|
|
97
112
|
className: cn("w-[260px] rounded-lg p-3", className),
|
|
98
113
|
classNames: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/date-picker.tsx","../../src/lib/utils.ts","../../src/components/button.tsx","../../src/components/calendar.tsx","../../src/components/popover.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { CalendarIcon } from \"lucide-react\"\nimport type { DateRange, Matcher } from \"react-day-picker\"\nimport { cn } from \"../lib/utils\"\nimport { Button } from \"./button\"\nimport { Calendar } from \"./calendar\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\n\nexport type DatePickerPreset =\n | { label: string; value: Date }\n | { label: string; value: { from: Date; to: Date } }\n\nexport interface DatePickerProps {\n /** Selected value. For `mode=\"single\"` this is a Date, for `mode=\"range\"` this is a range object. */\n date?: Date | DateRange\n /** Called with the new selection. */\n onDateChange?: (date: Date | DateRange | undefined) => void\n /** Selection mode. Defaults to \"single\". */\n mode?: \"single\" | \"range\"\n /** Placeholder for the trigger when no date is picked. */\n placeholder?: string\n /** Classname applied to the trigger button. */\n className?: string\n /** Optional date format string — reserved for future use. */\n formatStr?: string\n /** Optional preset list rendered in a sidebar to the left of the calendar. */\n presets?: DatePickerPreset[]\n /** Passed through to the underlying Calendar. */\n disabled?: Matcher | Matcher[]\n}\n\nfunction formatDate(d: Date): string {\n return d.toLocaleDateString()\n}\n\nfunction DatePicker({\n date,\n onDateChange,\n mode = \"single\",\n placeholder = \"Pick a date\",\n className,\n presets,\n disabled,\n}: DatePickerProps) {\n const label = React.useMemo(() => {\n if (!date) return <span>{placeholder}</span>\n if (mode === \"range\") {\n const range = date as DateRange\n if (range.from && range.to) {\n return `${formatDate(range.from)} – ${formatDate(range.to)}`\n }\n if (range.from) return formatDate(range.from)\n return <span>{placeholder}</span>\n }\n return (date as Date).toLocaleDateString()\n }, [date, mode, placeholder])\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n className={cn(\n \"w-[280px] justify-start text-left font-normal\",\n !date && \"text-muted-foreground\",\n className\n )}\n >\n <CalendarIcon className=\"me-2 h-4 w-4\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <div className=\"flex\">\n {presets && presets.length > 0 && (\n <div className=\"flex flex-col gap-1 border-e p-2 min-w-[140px]\">\n {presets.map((preset) => (\n <Button\n key={preset.label}\n variant=\"ghost\"\n size=\"sm\"\n className=\"justify-start font-normal\"\n onClick={() => onDateChange?.(preset.value as Date | DateRange)}\n >\n {preset.label}\n </Button>\n ))}\n </div>\n )}\n <div>\n {mode === \"range\" ? (\n <Calendar\n mode=\"range\"\n selected={date as DateRange | undefined}\n onSelect={(value) => onDateChange?.(value)}\n disabled={disabled}\n // Focus moves into the calendar the user just opened (keyboard navigation).\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n />\n ) : (\n <Calendar\n mode=\"single\"\n selected={date as Date | undefined}\n onSelect={(value) => onDateChange?.(value)}\n disabled={disabled}\n // Focus moves into the calendar the user just opened (keyboard navigation).\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n />\n )}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )\n}\n\nexport { DatePicker }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\nimport * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Loader2 } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground hover:bg-primary-hover\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive-hover\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary-hover\",\n ghost:\n \"hover:bg-accent hover:text-accent-foreground\",\n link:\n \"text-primary underline-offset-4 hover:underline\",\n success:\n \"bg-success text-success-foreground hover:bg-success-hover\",\n },\n size: {\n xs: \"h-7 px-2.5 text-xs\",\n sm: \"h-9 px-3\",\n default: \"h-10 px-4 py-2\",\n lg: \"h-11 px-8\",\n icon: \"h-10 w-10\",\n \"icon-sm\": \"h-8 w-8\",\n },\n shape: {\n default: \"rounded-md\",\n rounded: \"rounded-lg\",\n pill: \"rounded-full\",\n square: \"rounded-none\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n shape: \"default\",\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n loading?: boolean\n prefixIcon?: React.ReactNode\n suffixIcon?: React.ReactNode\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n shape,\n asChild = false,\n loading = false,\n prefixIcon,\n suffixIcon,\n children,\n disabled,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, shape, className }))}\n ref={ref}\n disabled={isDisabled}\n {...props}\n >\n {loading && <Loader2 className=\"animate-spin\" />}\n {!loading && prefixIcon}\n {children}\n {suffixIcon}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\nimport { DayPicker } from \"react-day-picker\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\nfunction Calendar({ className, classNames, showOutsideDays = true, captionLayout = \"dropdown\", ...props }: CalendarProps) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\"w-[260px] rounded-lg p-3\", className)}\n classNames={{\n months: \"flex flex-col\",\n month: \"space-y-3\",\n month_caption: \"relative flex h-8 items-center justify-center\",\n caption_label: \"text-sm font-medium hidden\",\n nav: \"flex items-center\",\n button_previous: cn(\n \"absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n button_next: cn(\n \"absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n month_grid: \"w-full border-collapse\",\n weekdays: \"flex w-full\",\n weekday:\n \"flex-1 h-8 flex items-center justify-center text-[11px] font-medium text-muted-foreground uppercase tracking-wider\",\n week: \"flex w-full mt-1\",\n day: \"flex-1 h-8 p-0 relative focus-within:z-20 flex items-center justify-center text-sm\",\n day_button: cn(\n \"inline-flex size-8 items-center justify-center rounded-md bg-transparent text-sm font-normal cursor-pointer border-none hover:bg-[var(--hc-color-border-subtle)] transition-colors\"\n ),\n range_end: \"day-range-end\",\n selected:\n \"[&>button]:bg-[var(--hc-primary-600)] [&>button]:text-white [&>button]:hover:bg-[var(--hc-primary-600)] [&>button]:hover:text-white [&>button]:font-medium\",\n today: \"[&>button]:font-semibold [&>button]:text-[var(--hc-primary-600)]\",\n outside:\n \"day-outside [&>button]:bg-transparent [&>button]:text-[var(--hc-grey-200)]\",\n disabled: \"[&>button]:text-[var(--hc-grey-200)] [&>button]:opacity-50 [&>button]:cursor-default\",\n range_middle:\n \"[&>button]:bg-[var(--hc-primary-100)] [&>button]:text-foreground [&>button]:rounded-none\",\n range_start: \"[&>button]:rounded-e-none\",\n dropdowns: \"flex items-center gap-1.5 justify-center [&>select]:flex-1\",\n dropdown:\n \"h-7 w-[88px] rounded-md border border-[var(--hc-color-border-subtle)] bg-background px-2 text-xs font-medium text-foreground cursor-pointer outline-none accent-[var(--hc-primary-600)] focus:border-[var(--hc-primary-500)] focus:ring-[2px] focus:ring-[var(--hc-primary-500)]/20 [&>option:checked]:bg-[var(--hc-primary-600)] [&>option:checked]:text-white [&>option]:py-1\",\n hidden: \"invisible\",\n ...classNames,\n }}\n captionLayout={captionLayout}\n components={{\n Chevron: ({ orientation }) => {\n const Icon = orientation === \"left\" ? ChevronLeft : ChevronRight\n return <Icon className=\"size-4\" />\n },\n }}\n {...props}\n />\n )\n}\nCalendar.displayName = \"Calendar\"\n\nexport { Calendar }\n","import * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\nimport { cn } from \"../lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent }\n"],"mappings":";AAAA,YAAYA,YAAW;AACvB,SAAS,oBAAoB;;;ACD7B,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACJA,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AACvC,SAAS,eAAe;AA4ElB,SAMc,KANd;AAzEN,IAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,WACE;AAAA,QACF,OACE;AAAA,QACF,MACE;AAAA,QACF,SACE;AAAA,MACJ;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,WAAW;AAAA,MACb;AAAA,MACA,OAAO;AAAA,QACL,SAAS;AAAA,QACT,SAAS;AAAA,QACT,MAAM;AAAA,QACN,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,EACF;AACF;AAWA,IAAM,SAAe;AAAA,EACnB,CACE;AAAA,IACE;A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,IAC5B;AACA,WAAQ,KAAc,mBAAmB;AAAA,EAC3C,GAAG,CAAC,MAAM,MAAM,WAAW,CAAC;AAE5B,SACE,gBAAAC,MAAC,WACC;AAAA,oBAAAD,KAAC,kBAAe,SAAO,MACrB,0BAAAC;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,WAAW;AAAA,UACT;AAAA,UACA,CAAC,QAAQ;AAAA,UACT;AAAA,QACF;AAAA,QAEA;AAAA,0BAAAD,KAAC,gBAAa,WAAU,gBAAe;AAAA,UACtC;AAAA;AAAA;AAAA,IACH,GACF;AAAA,IACA,gBAAAA,KAAC,kBAAe,WAAU,cAAa,OAAM,SAC3C,0BAAAC,MAAC,SAAI,WAAU,QACZ;AAAA,iBAAW,QAAQ,SAAS,KAC3B,gBAAAD,KAAC,SAAI,WAAU,kDACZ,kBAAQ,IAAI,CAAC,WACZ,gBAAAA;AAAA,QAAC;AAAA;AAAA,UAEC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,WAAU;AAAA,UACV,SAAS,MAAM,eAAe,OAAO,KAAyB;AAAA,UAE7D,iBAAO;AAAA;AAAA,QANH,OAAO;AAAA,MAOd,CACD,GACH;AAAA,MAEF,gBAAAA,KAAC,SACE,mBAAS,UACR,gBAAAA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,UAAU;AAAA,UACV,UAAU,CAAC,UAAU,eAAe,KAAK;AAAA,UACzC;AAAA,UAGA,WAAS;AAAA;AAAA,MACX,IAEA,gBAAAA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,UAAU;AAAA,UACV,UAAU,CAAC,UAAU,eAAe,KAAK;AAAA,UACzC;AAAA,UAGA,WAAS;AAAA;AAAA,MACX,GAEJ;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":["React","jsx","React","jsx","jsx","jsxs"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/date-picker.tsx","../../src/lib/utils.ts","../../src/components/button.tsx","../../src/components/calendar.tsx","../../src/components/popover.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { CalendarIcon } from \"lucide-react\"\nimport type { DateRange, Matcher } from \"react-day-picker\"\nimport { cn } from \"../lib/utils\"\nimport { Button } from \"./button\"\nimport { Calendar } from \"./calendar\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\n\nexport type DatePickerPreset =\n | { label: string; value: Date }\n | { label: string; value: { from: Date; to: Date } }\n\nexport interface DatePickerProps {\n /** Selected value. For `mode=\"single\"` this is a Date, for `mode=\"range\"` this is a range object. */\n date?: Date | DateRange\n /** Called with the new selection. */\n onDateChange?: (date: Date | DateRange | undefined) => void\n /** Selection mode. Defaults to \"single\". */\n mode?: \"single\" | \"range\"\n /** Placeholder for the trigger when no date is picked. */\n placeholder?: string\n /** Classname applied to the trigger button. */\n className?: string\n /** Optional date format string — reserved for future use. */\n formatStr?: string\n /** Optional preset list rendered in a sidebar to the left of the calendar. */\n presets?: DatePickerPreset[]\n /** Passed through to the underlying Calendar. */\n disabled?: Matcher | Matcher[]\n}\n\nfunction formatDate(d: Date): string {\n return d.toLocaleDateString()\n}\n\nfunction DatePicker({\n date,\n onDateChange,\n mode = \"single\",\n placeholder = \"Pick a date\",\n className,\n presets,\n disabled,\n}: DatePickerProps) {\n const label = React.useMemo(() => {\n if (!date) return <span>{placeholder}</span>\n if (mode === \"range\") {\n const range = date as DateRange\n if (range.from && range.to) {\n return `${formatDate(range.from)} – ${formatDate(range.to)}`\n }\n if (range.from) return formatDate(range.from)\n return <span>{placeholder}</span>\n }\n return (date as Date).toLocaleDateString()\n }, [date, mode, placeholder])\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n className={cn(\n \"w-[280px] justify-start text-left font-normal\",\n !date && \"text-muted-foreground\",\n className\n )}\n >\n <CalendarIcon className=\"me-2 h-4 w-4\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <div className=\"flex\">\n {presets && presets.length > 0 && (\n <div className=\"flex flex-col gap-1 border-e p-2 min-w-[140px]\">\n {presets.map((preset) => (\n <Button\n key={preset.label}\n variant=\"ghost\"\n size=\"sm\"\n className=\"justify-start font-normal\"\n onClick={() => onDateChange?.(preset.value as Date | DateRange)}\n >\n {preset.label}\n </Button>\n ))}\n </div>\n )}\n <div>\n {mode === \"range\" ? (\n <Calendar\n mode=\"range\"\n selected={date as DateRange | undefined}\n onSelect={(value) => onDateChange?.(value)}\n disabled={disabled}\n // Focus moves into the calendar the user just opened (keyboard navigation).\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n />\n ) : (\n <Calendar\n mode=\"single\"\n selected={date as Date | undefined}\n onSelect={(value) => onDateChange?.(value)}\n disabled={disabled}\n // Focus moves into the calendar the user just opened (keyboard navigation).\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n />\n )}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )\n}\n\nexport { DatePicker }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\nimport * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Loader2 } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground hover:bg-primary-hover\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive-hover\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary-hover\",\n ghost:\n \"hover:bg-accent hover:text-accent-foreground\",\n link:\n \"text-primary underline-offset-4 hover:underline\",\n success:\n \"bg-success text-success-foreground hover:bg-success-hover\",\n },\n size: {\n xs: \"h-7 px-2.5 text-xs\",\n sm: \"h-9 px-3\",\n default: \"h-10 px-4 py-2\",\n lg: \"h-11 px-8\",\n icon: \"h-10 w-10\",\n \"icon-sm\": \"h-8 w-8\",\n },\n shape: {\n default: \"rounded-md\",\n rounded: \"rounded-lg\",\n pill: \"rounded-full\",\n square: \"rounded-none\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n shape: \"default\",\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n loading?: boolean\n prefixIcon?: React.ReactNode\n suffixIcon?: React.ReactNode\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n shape,\n asChild = false,\n loading = false,\n prefixIcon,\n suffixIcon,\n children,\n disabled,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, shape, className }))}\n ref={ref}\n disabled={isDisabled}\n {...props}\n >\n {loading && <Loader2 className=\"animate-spin\" />}\n {!loading && prefixIcon}\n {children}\n {suffixIcon}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\nimport { DayPicker } from \"react-day-picker\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\n/**\n * How far the year dropdown reaches when the caller gives no bounds.\n *\n * `captionLayout` defaults to \"dropdown\" here, and react-day-picker then falls\n * back to [currentYear - 100, currentYear] for the year list. That is wrong in\n * both directions: a hundred dead years to scroll past, and no future year at\n * all - a deadline could not be set beyond December of the current year.\n * Callers that know their range pass `startMonth` / `endMonth` and these are\n * not used.\n */\nconst DEFAULT_YEARS_BACK = 10\nconst DEFAULT_YEARS_FORWARD = 10\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"dropdown\",\n startMonth,\n endMonth,\n ...props\n}: CalendarProps) {\n const now = new Date()\n const defaultedStartMonth =\n startMonth ?? new Date(now.getFullYear() - DEFAULT_YEARS_BACK, 0, 1)\n const defaultedEndMonth =\n endMonth ?? new Date(now.getFullYear() + DEFAULT_YEARS_FORWARD, 11, 1)\n\n return (\n <DayPicker\n startMonth={defaultedStartMonth}\n endMonth={defaultedEndMonth}\n showOutsideDays={showOutsideDays}\n className={cn(\"w-[260px] rounded-lg p-3\", className)}\n classNames={{\n months: \"flex flex-col\",\n month: \"space-y-3\",\n month_caption: \"relative flex h-8 items-center justify-center\",\n caption_label: \"text-sm font-medium hidden\",\n nav: \"flex items-center\",\n button_previous: cn(\n \"absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n button_next: cn(\n \"absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n month_grid: \"w-full border-collapse\",\n weekdays: \"flex w-full\",\n weekday:\n \"flex-1 h-8 flex items-center justify-center text-[11px] font-medium text-muted-foreground uppercase tracking-wider\",\n week: \"flex w-full mt-1\",\n day: \"flex-1 h-8 p-0 relative focus-within:z-20 flex items-center justify-center text-sm\",\n day_button: cn(\n \"inline-flex size-8 items-center justify-center rounded-md bg-transparent text-sm font-normal cursor-pointer border-none hover:bg-[var(--hc-color-border-subtle)] transition-colors\"\n ),\n range_end: \"day-range-end\",\n selected:\n \"[&>button]:bg-[var(--hc-primary-600)] [&>button]:text-white [&>button]:hover:bg-[var(--hc-primary-600)] [&>button]:hover:text-white [&>button]:font-medium\",\n today: \"[&>button]:font-semibold [&>button]:text-[var(--hc-primary-600)]\",\n outside:\n \"day-outside [&>button]:bg-transparent [&>button]:text-[var(--hc-grey-200)]\",\n disabled: \"[&>button]:text-[var(--hc-grey-200)] [&>button]:opacity-50 [&>button]:cursor-default\",\n range_middle:\n \"[&>button]:bg-[var(--hc-primary-100)] [&>button]:text-foreground [&>button]:rounded-none\",\n range_start: \"[&>button]:rounded-e-none\",\n dropdowns: \"flex items-center gap-1.5 justify-center [&>select]:flex-1\",\n dropdown:\n \"h-7 w-[88px] rounded-md border border-[var(--hc-color-border-subtle)] bg-background px-2 text-xs font-medium text-foreground cursor-pointer outline-none accent-[var(--hc-primary-600)] focus:border-[var(--hc-primary-500)] focus:ring-[2px] focus:ring-[var(--hc-primary-500)]/20 [&>option:checked]:bg-[var(--hc-primary-600)] [&>option:checked]:text-white [&>option]:py-1\",\n hidden: \"invisible\",\n ...classNames,\n }}\n captionLayout={captionLayout}\n components={{\n Chevron: ({ orientation }) => {\n const Icon = orientation === \"left\" ? ChevronLeft : ChevronRight\n return <Icon className=\"size-4\" />\n },\n }}\n {...props}\n />\n )\n}\nCalendar.displayName = \"Calendar\"\n\nexport { Calendar }\n","import * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\nimport { cn } from \"../lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent }\n"],"mappings":";AAAA,YAAYA,YAAW;AACvB,SAAS,oBAAoB;;;ACD7B,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACJA,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AACvC,SAAS,eAAe;AA4ElB,SAMc,KANd;AAzEN,IAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,WACE;AAAA,QACF,OACE;AAAA,QACF,MACE;AAAA,QACF,SACE;AAAA,MACJ;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,WAAW;AAAA,MACb;AAAA,MACA,OAAO;AAAA,QACL,SAAS;AAAA,QACT,SAAS;AAAA,QACT,MAAM;AAAA,QACN,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,EACF;AACF;AAWA,IAAM,SAAe;AAAA,EACnB,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,UAAU;AAAA,IACV;AAAA,IACA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