lecom-ui 5.2.83 → 5.2.85
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.
|
@@ -9,9 +9,23 @@ import { CalendarIcon } from 'lucide-react';
|
|
|
9
9
|
function DatePicker({
|
|
10
10
|
className,
|
|
11
11
|
variant = "outlined",
|
|
12
|
-
locale
|
|
12
|
+
locale,
|
|
13
|
+
placeholder = "Pick a date",
|
|
14
|
+
value,
|
|
15
|
+
onChange,
|
|
16
|
+
format: format$1 = "PPP",
|
|
17
|
+
status
|
|
13
18
|
}) {
|
|
14
|
-
const [
|
|
19
|
+
const [internalDate, setInternalDate] = React.useState();
|
|
20
|
+
const isControlled = value !== void 0 && onChange !== void 0;
|
|
21
|
+
const date = isControlled ? value : internalDate;
|
|
22
|
+
const handleSelect = (selected) => {
|
|
23
|
+
if (isControlled && onChange) {
|
|
24
|
+
onChange(selected);
|
|
25
|
+
} else {
|
|
26
|
+
setInternalDate(selected);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
15
29
|
return /* @__PURE__ */ React.createElement(Popover, null, /* @__PURE__ */ React.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
|
|
16
30
|
Button,
|
|
17
31
|
{
|
|
@@ -19,17 +33,18 @@ function DatePicker({
|
|
|
19
33
|
className: cn(
|
|
20
34
|
"w-[240px] justify-start text-left font-normal",
|
|
21
35
|
!date && "text-muted-foreground",
|
|
22
|
-
className
|
|
36
|
+
className,
|
|
37
|
+
status
|
|
23
38
|
)
|
|
24
39
|
},
|
|
25
40
|
/* @__PURE__ */ React.createElement(CalendarIcon, { className: "mr-2 h-4 w-4" }),
|
|
26
|
-
date ? format(date,
|
|
41
|
+
date ? format(date, format$1, { locale }) : /* @__PURE__ */ React.createElement("span", null, placeholder)
|
|
27
42
|
)), /* @__PURE__ */ React.createElement(PopoverContent, { className: "w-auto p-0", align: "start" }, /* @__PURE__ */ React.createElement(
|
|
28
43
|
Calendar,
|
|
29
44
|
{
|
|
30
45
|
mode: "single",
|
|
31
46
|
selected: date,
|
|
32
|
-
onSelect:
|
|
47
|
+
onSelect: handleSelect,
|
|
33
48
|
autoFocus: true,
|
|
34
49
|
locale
|
|
35
50
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1159,11 +1159,16 @@ interface DatePickerProps {
|
|
|
1159
1159
|
className?: string;
|
|
1160
1160
|
variant?: 'outlined' | 'filled' | 'ghost' | null;
|
|
1161
1161
|
locale?: Locale;
|
|
1162
|
+
placeholder?: string;
|
|
1163
|
+
value?: Date;
|
|
1164
|
+
onChange?: (date: Date | undefined) => void;
|
|
1165
|
+
format?: string;
|
|
1166
|
+
status?: string;
|
|
1162
1167
|
}
|
|
1163
|
-
declare function DatePicker({ className, variant, locale, }: DatePickerProps): React$1.JSX.Element;
|
|
1168
|
+
declare function DatePicker({ className, variant, locale, placeholder, value, onChange, format, status, }: DatePickerProps): React$1.JSX.Element;
|
|
1164
1169
|
declare namespace DatePicker {
|
|
1165
1170
|
var displayName: string;
|
|
1166
1171
|
}
|
|
1167
1172
|
|
|
1168
1173
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, CadastroFacil, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapse, Combobox, CustomDivider, DataTable, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogScroll, DialogTitle, DialogTrigger, 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, ErrorEmptyDisplay, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, Layout, LogoLecom, LogoLecomBrand, ModoTeste, MultiSelect, Notification, Pagination, PaginationContent, PaginationEllipsis, PaginationFirst, PaginationIndex, PaginationItem, PaginationLast, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, Rpa, SairModoTeste, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Skeleton, Spin, Steps, Switch, TOAST_REMOVE_DELAY, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TagInput, Textarea, ToggleGroup, ToggleGroupItem, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, Translations, TypeMessageNotification, Typography, Upload, accordionVariants, buttonVariants, collapseTriggerVariants, colors, fonts, initializeI18n, inputVariants, notificationVariants, reducer, tagVariants, textareaVariants, toast, typographyVariants, useFormField, useIsMobile, useNotificationToast, usePagination, useSidebar };
|
|
1169
|
-
export type { BgColor, BuildCellSelect, BuildColumns, BuildHeaderSelect, ButtonProps, CadastroFacilProps, CalloutNotificationProps, ChartConfig, CheckboxProps, CheckedCell, CheckedCellChange, CheckedHeader, CheckedHeaderChange, Color, ColorToken, Column, ColumnRender, ColumnSort, ColumnSortClient, ColumnTitle, ComboboxGroup, ComboboxOption, ComboboxProps, CustomStyles$1 as CustomStyles, DataTableProps, DialogContentProps, ErrorEmptyDisplayProps, ExpandIconPosition, File, FillColor, Fonts, Header, HeaderProps, InlineNotificationProps, InputProps, LayoutProps, LogoLecomBrandProps, LogoLecomProps, Meta, ModoTesteProps, NotificationProps, PaginationProps, Row, RpaProps, SideBarProps, SpinProps, StepsProps, SwitchProps, TableProps, TagInputProps, TagProps, TagValue, TextColor, TextareaProps, TimelineStepItem, ToastNotificationProps, ToasterToast, TooltipContentProps, TypographyProps, UploadProps, UsePaginationItem };
|
|
1174
|
+
export type { BgColor, BuildCellSelect, BuildColumns, BuildHeaderSelect, ButtonProps, CadastroFacilProps, CalloutNotificationProps, ChartConfig, CheckboxProps, CheckedCell, CheckedCellChange, CheckedHeader, CheckedHeaderChange, Color, ColorToken, Column, ColumnRender, ColumnSort, ColumnSortClient, ColumnTitle, ComboboxGroup, ComboboxOption, ComboboxProps, CustomStyles$1 as CustomStyles, DataTableProps, DatePickerProps, DialogContentProps, ErrorEmptyDisplayProps, ExpandIconPosition, File, FillColor, Fonts, Header, HeaderProps, InlineNotificationProps, InputProps, LayoutProps, LogoLecomBrandProps, LogoLecomProps, Meta, ModoTesteProps, NotificationProps, PaginationProps, Row, RpaProps, SideBarProps, SpinProps, StepsProps, SwitchProps, TableProps, TagInputProps, TagProps, TagValue, TextColor, TextareaProps, TimelineStepItem, ToastNotificationProps, ToasterToast, TooltipContentProps, TypographyProps, UploadProps, UsePaginationItem };
|