@codapet/design-system 0.3.9 → 0.4.1
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/index.d.mts +8 -3
- package/dist/index.mjs +57 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -42,7 +42,10 @@ import { ClassValue } from 'clsx';
|
|
|
42
42
|
|
|
43
43
|
declare function Accordion({ ...props }: React$1.ComponentProps<typeof AccordionPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
44
44
|
declare function AccordionItem({ className, ...props }: React$1.ComponentProps<typeof AccordionPrimitive.Item>): react_jsx_runtime.JSX.Element;
|
|
45
|
-
declare function AccordionTrigger({ className, children, ...props }: React$1.ComponentProps<typeof AccordionPrimitive.Trigger>
|
|
45
|
+
declare function AccordionTrigger({ className, children, expandedIcon, collapsedIcon, ...props }: React$1.ComponentProps<typeof AccordionPrimitive.Trigger> & {
|
|
46
|
+
expandedIcon?: React$1.ReactNode;
|
|
47
|
+
collapsedIcon?: React$1.ReactNode;
|
|
48
|
+
}): react_jsx_runtime.JSX.Element;
|
|
46
49
|
declare function AccordionContent({ className, children, ...props }: React$1.ComponentProps<typeof AccordionPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
|
47
50
|
|
|
48
51
|
declare const alertVariants: (props?: ({
|
|
@@ -246,6 +249,7 @@ interface InputProps extends Omit<React$1.ComponentProps<'input'>, 'size'>, Vari
|
|
|
246
249
|
}
|
|
247
250
|
declare const Input: React$1.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
|
|
248
251
|
|
|
252
|
+
type DateFormat = 'MM/DD/YYYY' | 'DD/MM/YYYY' | 'YYYY-MM-DD' | 'DD-MM-YYYY' | 'MM-DD-YYYY' | 'DD.MM.YYYY' | 'MMMM D, YYYY' | 'D MMMM YYYY';
|
|
249
253
|
type NativeInputProps = Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'min' | 'max' | 'size' | 'disabled' | 'onSelect'>;
|
|
250
254
|
type FlattenedCalendarProps = Omit<React$1.ComponentProps<typeof Calendar>, keyof React$1.InputHTMLAttributes<HTMLInputElement> | 'className' | 'mode' | 'selected' | 'onSelect' | 'month' | 'onMonthChange' | 'disabled' | 'captionLayout' | 'showOutsideDays' | 'classNames'>;
|
|
251
255
|
interface DateInputProps extends NativeInputProps, FlattenedCalendarProps {
|
|
@@ -258,6 +262,7 @@ interface DateInputProps extends NativeInputProps, FlattenedCalendarProps {
|
|
|
258
262
|
size?: VariantProps<typeof inputVariants>['size'];
|
|
259
263
|
inputClassName?: string;
|
|
260
264
|
calendarClassName?: string;
|
|
265
|
+
dateFormat?: DateFormat;
|
|
261
266
|
mode?: React$1.ComponentProps<typeof Calendar>['mode'];
|
|
262
267
|
selected?: Date;
|
|
263
268
|
onSelect?: (selectedDate: Date | undefined) => void;
|
|
@@ -268,7 +273,7 @@ interface DateInputProps extends NativeInputProps, FlattenedCalendarProps {
|
|
|
268
273
|
showOutsideDays?: React$1.ComponentProps<typeof Calendar>['showOutsideDays'];
|
|
269
274
|
classNames?: React$1.ComponentProps<typeof Calendar>['classNames'];
|
|
270
275
|
}
|
|
271
|
-
declare function DateInput({ date, setDate, maxDate, minDate, disableFuture, className, inputClassName, calendarClassName, inputDisabled, mode, selected, onSelect, month, onMonthChange, disabled: calendarDisabled, captionLayout, showOutsideDays, classNames, placeholder, onBlur, ...restProps }: DateInputProps): react_jsx_runtime.JSX.Element;
|
|
276
|
+
declare function DateInput({ date, setDate, maxDate, minDate, disableFuture, className, inputClassName, calendarClassName, inputDisabled, dateFormat, mode, selected, onSelect, month, onMonthChange, disabled: calendarDisabled, captionLayout, showOutsideDays, classNames, placeholder, onBlur, ...restProps }: DateInputProps): react_jsx_runtime.JSX.Element;
|
|
272
277
|
|
|
273
278
|
declare function Drawer({ ...props }: React$1.ComponentProps<typeof Drawer$1.Root>): react_jsx_runtime.JSX.Element;
|
|
274
279
|
declare function DrawerTrigger({ ...props }: React$1.ComponentProps<typeof Drawer$1.Trigger>): react_jsx_runtime.JSX.Element;
|
|
@@ -590,4 +595,4 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
590
595
|
|
|
591
596
|
declare function useIsMobile(): boolean;
|
|
592
597
|
|
|
593
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, AutoResizeTextarea, Avatar, AvatarFallback, AvatarImage, Badge, Body, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DateInput, type DateInputProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DisplayHeading, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HeadingL, HeadingM, HeadingS, HeadingXL, HeadingXS, HeadingXXS, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, SmartDialog, SmartDialogClose, SmartDialogContent, SmartDialogDescription, SmartDialogFooter, SmartDialogHeader, SmartDialogTitle, SmartDialogTrigger, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, bodyTextVariants, buttonVariants, cn, displayTextVariants, inputVariants, labelTextVariants, navigationMenuTriggerStyle, toggleVariants, useFormField, useIsMobile, useSidebar };
|
|
598
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, AutoResizeTextarea, Avatar, AvatarFallback, AvatarImage, Badge, Body, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, type DateFormat, DateInput, type DateInputProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DisplayHeading, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HeadingL, HeadingM, HeadingS, HeadingXL, HeadingXS, HeadingXXS, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, SmartDialog, SmartDialogClose, SmartDialogContent, SmartDialogDescription, SmartDialogFooter, SmartDialogHeader, SmartDialogTitle, SmartDialogTrigger, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, bodyTextVariants, buttonVariants, cn, displayTextVariants, inputVariants, labelTextVariants, navigationMenuTriggerStyle, toggleVariants, useFormField, useIsMobile, useSidebar };
|
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ function cn(...inputs) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
// src/components/ui/accordion.tsx
|
|
16
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
17
17
|
function Accordion({
|
|
18
18
|
...props
|
|
19
19
|
}) {
|
|
@@ -35,20 +35,27 @@ function AccordionItem({
|
|
|
35
35
|
function AccordionTrigger({
|
|
36
36
|
className,
|
|
37
37
|
children,
|
|
38
|
+
expandedIcon,
|
|
39
|
+
collapsedIcon,
|
|
38
40
|
...props
|
|
39
41
|
}) {
|
|
42
|
+
const hasCustomIcon = expandedIcon !== void 0 || collapsedIcon !== void 0;
|
|
40
43
|
return /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
|
|
41
44
|
AccordionPrimitive.Trigger,
|
|
42
45
|
{
|
|
43
46
|
"data-slot": "accordion-trigger",
|
|
44
47
|
className: cn(
|
|
45
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50
|
|
48
|
+
"group focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50",
|
|
49
|
+
!hasCustomIcon && "[&[data-state=open]>svg]:rotate-180",
|
|
46
50
|
className
|
|
47
51
|
),
|
|
48
52
|
...props,
|
|
49
53
|
children: [
|
|
50
54
|
children,
|
|
51
|
-
/* @__PURE__ */
|
|
55
|
+
hasCustomIcon ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56
|
+
collapsedIcon !== void 0 && /* @__PURE__ */ jsx("span", { className: "group-data-[state=open]:hidden pointer-events-none shrink-0 text-muted-foreground", children: collapsedIcon }),
|
|
57
|
+
expandedIcon !== void 0 && /* @__PURE__ */ jsx("span", { className: "group-data-[state=closed]:hidden pointer-events-none shrink-0 text-muted-foreground", children: expandedIcon })
|
|
58
|
+
] }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-400" })
|
|
52
59
|
]
|
|
53
60
|
}
|
|
54
61
|
) });
|
|
@@ -1086,7 +1093,7 @@ function CarouselNext({
|
|
|
1086
1093
|
// src/components/ui/chart.tsx
|
|
1087
1094
|
import * as React13 from "react";
|
|
1088
1095
|
import * as RechartsPrimitive from "recharts";
|
|
1089
|
-
import { Fragment, jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1096
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1090
1097
|
var THEMES = { light: "", dark: ".dark" };
|
|
1091
1098
|
var ChartContext = React13.createContext(null);
|
|
1092
1099
|
function useChart() {
|
|
@@ -1212,7 +1219,7 @@ function ChartTooltipContent({
|
|
|
1212
1219
|
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
|
|
1213
1220
|
indicator === "dot" && "items-center"
|
|
1214
1221
|
),
|
|
1215
|
-
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxs5(
|
|
1222
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1216
1223
|
itemConfig?.icon ? /* @__PURE__ */ jsx14(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx14(
|
|
1217
1224
|
"div",
|
|
1218
1225
|
{
|
|
@@ -1879,6 +1886,7 @@ function ContextMenuShortcut({
|
|
|
1879
1886
|
|
|
1880
1887
|
// src/components/ui/date-input.tsx
|
|
1881
1888
|
import "class-variance-authority";
|
|
1889
|
+
import { format as dateFnsFormat, parse as dateFnsParse, isValid } from "date-fns";
|
|
1882
1890
|
import { CalendarDays } from "lucide-react";
|
|
1883
1891
|
import * as React20 from "react";
|
|
1884
1892
|
|
|
@@ -2056,6 +2064,26 @@ function PopoverAnchor({
|
|
|
2056
2064
|
|
|
2057
2065
|
// src/components/ui/date-input.tsx
|
|
2058
2066
|
import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2067
|
+
var DATE_FORMAT_TOKENS = {
|
|
2068
|
+
"MM/DD/YYYY": "MM/dd/yyyy",
|
|
2069
|
+
"DD/MM/YYYY": "dd/MM/yyyy",
|
|
2070
|
+
"YYYY-MM-DD": "yyyy-MM-dd",
|
|
2071
|
+
"DD-MM-YYYY": "dd-MM-yyyy",
|
|
2072
|
+
"MM-DD-YYYY": "MM-dd-yyyy",
|
|
2073
|
+
"DD.MM.YYYY": "dd.MM.yyyy",
|
|
2074
|
+
"MMMM D, YYYY": "MMMM d, yyyy",
|
|
2075
|
+
"D MMMM YYYY": "d MMMM yyyy"
|
|
2076
|
+
};
|
|
2077
|
+
var DATE_FORMAT_PLACEHOLDER = {
|
|
2078
|
+
"MM/DD/YYYY": "mm/dd/yyyy",
|
|
2079
|
+
"DD/MM/YYYY": "dd/mm/yyyy",
|
|
2080
|
+
"YYYY-MM-DD": "yyyy-mm-dd",
|
|
2081
|
+
"DD-MM-YYYY": "dd-mm-yyyy",
|
|
2082
|
+
"MM-DD-YYYY": "mm-dd-yyyy",
|
|
2083
|
+
"DD.MM.YYYY": "dd.mm.yyyy",
|
|
2084
|
+
"MMMM D, YYYY": "Month d, yyyy",
|
|
2085
|
+
"D MMMM YYYY": "d Month yyyy"
|
|
2086
|
+
};
|
|
2059
2087
|
var INPUT_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
2060
2088
|
"accept",
|
|
2061
2089
|
"alt",
|
|
@@ -2115,21 +2143,16 @@ var INPUT_PROP_KEYS = /* @__PURE__ */ new Set([
|
|
|
2115
2143
|
"onCompositionStart",
|
|
2116
2144
|
"onCompositionUpdate"
|
|
2117
2145
|
]);
|
|
2118
|
-
function formatDate(date) {
|
|
2119
|
-
if (!date) {
|
|
2146
|
+
function formatDate(date, dateFormat = "MM/DD/YYYY") {
|
|
2147
|
+
if (!date || !isValid(date)) {
|
|
2120
2148
|
return "";
|
|
2121
2149
|
}
|
|
2122
|
-
return date
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
function isValidDate(date) {
|
|
2129
|
-
if (!date) {
|
|
2130
|
-
return false;
|
|
2131
|
-
}
|
|
2132
|
-
return !isNaN(date.getTime());
|
|
2150
|
+
return dateFnsFormat(date, DATE_FORMAT_TOKENS[dateFormat]);
|
|
2151
|
+
}
|
|
2152
|
+
function parseDate(value, dateFormat = "MM/DD/YYYY") {
|
|
2153
|
+
if (!value) return null;
|
|
2154
|
+
const parsed = dateFnsParse(value, DATE_FORMAT_TOKENS[dateFormat], /* @__PURE__ */ new Date());
|
|
2155
|
+
return isValid(parsed) ? parsed : null;
|
|
2133
2156
|
}
|
|
2134
2157
|
function DateInput({
|
|
2135
2158
|
date,
|
|
@@ -2141,6 +2164,7 @@ function DateInput({
|
|
|
2141
2164
|
inputClassName,
|
|
2142
2165
|
calendarClassName,
|
|
2143
2166
|
inputDisabled,
|
|
2167
|
+
dateFormat = "MM/DD/YYYY",
|
|
2144
2168
|
mode,
|
|
2145
2169
|
selected,
|
|
2146
2170
|
onSelect,
|
|
@@ -2150,13 +2174,14 @@ function DateInput({
|
|
|
2150
2174
|
captionLayout = "dropdown",
|
|
2151
2175
|
showOutsideDays = false,
|
|
2152
2176
|
classNames,
|
|
2153
|
-
placeholder
|
|
2177
|
+
placeholder,
|
|
2154
2178
|
onBlur,
|
|
2155
2179
|
...restProps
|
|
2156
2180
|
}) {
|
|
2181
|
+
const resolvedPlaceholder = placeholder ?? DATE_FORMAT_PLACEHOLDER[dateFormat];
|
|
2157
2182
|
const [open, setOpen] = React20.useState(false);
|
|
2158
2183
|
const [monthState, setMonthState] = React20.useState(date ?? null);
|
|
2159
|
-
const [value, setValue] = React20.useState(formatDate(date ?? null));
|
|
2184
|
+
const [value, setValue] = React20.useState(formatDate(date ?? null, dateFormat));
|
|
2160
2185
|
const [inputProps, calendarProps] = React20.useMemo(() => {
|
|
2161
2186
|
const nextInputProps = {};
|
|
2162
2187
|
const nextCalendarProps = {};
|
|
@@ -2204,10 +2229,10 @@ function DateInput({
|
|
|
2204
2229
|
}, [minDate]);
|
|
2205
2230
|
React20.useEffect(() => {
|
|
2206
2231
|
if (date) {
|
|
2207
|
-
setValue(formatDate(date));
|
|
2232
|
+
setValue(formatDate(date, dateFormat));
|
|
2208
2233
|
setMonthState(date);
|
|
2209
2234
|
}
|
|
2210
|
-
}, [date]);
|
|
2235
|
+
}, [date, dateFormat]);
|
|
2211
2236
|
const effectiveMonth = month ?? monthState ?? void 0;
|
|
2212
2237
|
const effectiveSelected = selected ?? date ?? void 0;
|
|
2213
2238
|
const isInputDisabled = inputDisabled ?? (typeof calendarDisabled === "boolean" ? calendarDisabled : false);
|
|
@@ -2219,7 +2244,7 @@ function DateInput({
|
|
|
2219
2244
|
const isBeforeMax = !effectiveMaxDate || dateObj <= effectiveMaxDate;
|
|
2220
2245
|
if (isAfterMin && isBeforeMax) {
|
|
2221
2246
|
setDate(selectedDate);
|
|
2222
|
-
setValue(formatDate(selectedDate));
|
|
2247
|
+
setValue(formatDate(selectedDate, dateFormat));
|
|
2223
2248
|
setOpen(false);
|
|
2224
2249
|
}
|
|
2225
2250
|
}
|
|
@@ -2250,8 +2275,8 @@ function DateInput({
|
|
|
2250
2275
|
const handleInputChange = (e) => {
|
|
2251
2276
|
const inputValue = e.target.value;
|
|
2252
2277
|
setValue(inputValue);
|
|
2253
|
-
const parsedDate =
|
|
2254
|
-
if (
|
|
2278
|
+
const parsedDate = parseDate(inputValue, dateFormat);
|
|
2279
|
+
if (parsedDate) {
|
|
2255
2280
|
const selectedDate = new Date(parsedDate);
|
|
2256
2281
|
selectedDate.setHours(0, 0, 0, 0);
|
|
2257
2282
|
const isAfterMin = !effectiveMinDate || selectedDate >= effectiveMinDate;
|
|
@@ -2274,16 +2299,16 @@ function DateInput({
|
|
|
2274
2299
|
}
|
|
2275
2300
|
return;
|
|
2276
2301
|
}
|
|
2277
|
-
const parsedDate =
|
|
2278
|
-
if (!
|
|
2279
|
-
setValue(formatDate(date));
|
|
2302
|
+
const parsedDate = parseDate(value, dateFormat);
|
|
2303
|
+
if (!parsedDate) {
|
|
2304
|
+
setValue(formatDate(date, dateFormat));
|
|
2280
2305
|
} else {
|
|
2281
2306
|
const selectedDate = new Date(parsedDate);
|
|
2282
2307
|
selectedDate.setHours(0, 0, 0, 0);
|
|
2283
2308
|
const isAfterMin = !effectiveMinDate || selectedDate >= effectiveMinDate;
|
|
2284
2309
|
const isBeforeMax = !effectiveMaxDate || selectedDate <= effectiveMaxDate;
|
|
2285
2310
|
if (!isAfterMin || !isBeforeMax) {
|
|
2286
|
-
setValue(formatDate(date));
|
|
2311
|
+
setValue(formatDate(date, dateFormat));
|
|
2287
2312
|
}
|
|
2288
2313
|
}
|
|
2289
2314
|
};
|
|
@@ -2293,7 +2318,7 @@ function DateInput({
|
|
|
2293
2318
|
{
|
|
2294
2319
|
id: "date",
|
|
2295
2320
|
value,
|
|
2296
|
-
placeholder,
|
|
2321
|
+
placeholder: resolvedPlaceholder,
|
|
2297
2322
|
className: cn("bg-background cursor-pointer", inputClassName),
|
|
2298
2323
|
onChange: handleInputChange,
|
|
2299
2324
|
onBlur: handleBlur,
|
|
@@ -4679,7 +4704,7 @@ function useMediaQuery(query) {
|
|
|
4679
4704
|
}
|
|
4680
4705
|
|
|
4681
4706
|
// src/components/ui/smart-dialog-drawer.tsx
|
|
4682
|
-
import { Fragment as
|
|
4707
|
+
import { Fragment as Fragment3, jsx as jsx43 } from "react/jsx-runtime";
|
|
4683
4708
|
var SmartDialog = ({ children, ...props }) => {
|
|
4684
4709
|
const isMobile = useMediaQuery("(max-width: 600px)");
|
|
4685
4710
|
return isMobile ? /* @__PURE__ */ jsx43(Drawer, { ...props, children }) : /* @__PURE__ */ jsx43(Dialog, { ...props, children });
|
|
@@ -4737,7 +4762,7 @@ var SmartDialogFooter = ({ children, ...props }) => {
|
|
|
4737
4762
|
};
|
|
4738
4763
|
var SmartDialogClose = ({ children, ...props }) => {
|
|
4739
4764
|
const isMobile = useMediaQuery("(max-width: 600px)");
|
|
4740
|
-
return isMobile ? /* @__PURE__ */ jsx43(
|
|
4765
|
+
return isMobile ? /* @__PURE__ */ jsx43(Fragment3, { children: /* @__PURE__ */ jsx43(DrawerClose, { ...props, children }) }) : /* @__PURE__ */ jsx43(DialogClose, { ...props, children });
|
|
4741
4766
|
};
|
|
4742
4767
|
|
|
4743
4768
|
// src/components/ui/sonner.tsx
|