@ikatec/nebula-react 1.3.2 → 1.4.0-beta.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 CHANGED
@@ -580,10 +580,15 @@ interface Messages {
580
580
  cropper: CropperMessages;
581
581
  }
582
582
 
583
+ declare enum NebulaLanguage {
584
+ EN_US = "en-US",
585
+ ES = "es",
586
+ PT_BR = "pt-BR"
587
+ }
583
588
  /**
584
589
  * Type to store the language in the localStorage.
585
590
  */
586
- type Language = 'en-US' | 'es' | 'pt-BR';
591
+ type Language = NebulaLanguage.EN_US | NebulaLanguage.ES | NebulaLanguage.PT_BR;
587
592
  /**
588
593
  * Get the language from the localStorage.
589
594
  */
@@ -625,6 +630,21 @@ interface InputDateTimePickerSingleProps extends Omit<InputTextProps, 'onChange'
625
630
  }
626
631
  declare const InputDateTimePickerSingle: ({ placeholder, className, value, onChange, numberOfMonths, onClean, disabledDates, ...rest }: InputDateTimePickerSingleProps) => react_jsx_runtime.JSX.Element;
627
632
 
633
+ interface InputDateRangePickerProps extends Omit<InputTextProps, 'onChange' | 'value'> {
634
+ value?: string;
635
+ onChange?: (value?: string, calendarDate?: [Date | undefined, Date | undefined]) => void;
636
+ numberOfMonths?: CalendarProps['numberOfMonths'];
637
+ placeholder?: string;
638
+ className?: string;
639
+ disabledDates?: CalendarProps['disabled'];
640
+ onClean?: VoidFunction;
641
+ popoverContainer?: HTMLElement | null;
642
+ }
643
+ declare const InputDateRangePicker: {
644
+ ({ placeholder, className, value, onChange, numberOfMonths, onClean, disabledDates, ...rest }: InputDateRangePickerProps): react_jsx_runtime.JSX.Element;
645
+ displayName: string;
646
+ };
647
+
628
648
  type InputTimeProps = Omit<React.ComponentProps<typeof InputText>, 'onChange'> & {
629
649
  onChange?: (value: string) => void;
630
650
  };
@@ -885,4 +905,4 @@ declare function useClickOutside<T extends HTMLElement>(refs: PossibleRefs<T>, o
885
905
 
886
906
  declare function useKeyPress(key: string, callback: VoidFunction): void;
887
907
 
888
- export { Accordion, AccordionContent, AccordionDescription, AccordionItem, type AccordionProps, AccordionTitle, AccordionTrigger, ActionBar, ActionBarButton, ActionBarClose, ActionBarContent, ActionBarDivider, ActionBarPortal, ActionBarTrigger, Alert, AlertButton, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, StyledAsync as Async, StyledAsyncCreatable as AsyncCreatable, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, Calendar, type CalendarProps, Caption, type CaptionProps, Checkbox, type CheckboxProps, StyledCreatable as Creatable, Cropper, CropperCropArea, CropperDescription, CropperImage, type CropperProps, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type FileMetadata, FileUpload, type FileUploadActions, FileUploadError, type FileUploadOptions, type FileUploadProps, type FileUploadState, type FileWithPreview, Heading, type HeadingProps, InputDatePickerSingle, type InputDatePickerSingleProps, InputDateTimePickerSingle, type InputDateTimePickerSingleProps, InputPhone, InputText, type InputTextProps, InputTime, type InputTimeProps, Label, Link, type LinkProps, NebulaI18nProvider, type NebulaI18nProviderProps, Pagination, type PaginationProps, Paragraph, type ParagraphProps, Popover, PopoverContent, type PopoverContentProps, PopoverTrigger, ProfileImage, type ProfileImageProps, RadioGroup, RadioGroupItem, StyledSelect as Select, type CreateStyledSelectProps as SelectProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, Slider, Space, SpaceDirectionEnum, type SpaceProps, SpaceSizeEnum, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperSeparator, StepperTitle, StepperTrigger, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, type TagProps, TextArea, type TextAreaProps, Toaster, Tooltip, type TooltipProps, alertVariants, badgeSizeEnum, badgeVariantEnum, buttonSizeEnum, buttonVariantEnum, buttonVariantsConfig, dateIsAvailable, formatBytes, getNebulaLanguage, localeByi18nKey, messages, separatorVariants, setNebulaLanguage, tagVariantsEnum, tailwind, toast, useClickOutside, useFileUpload, useKeyPress, useNebulaI18n };
908
+ export { Accordion, AccordionContent, AccordionDescription, AccordionItem, type AccordionProps, AccordionTitle, AccordionTrigger, ActionBar, ActionBarButton, ActionBarClose, ActionBarContent, ActionBarDivider, ActionBarPortal, ActionBarTrigger, Alert, AlertButton, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, StyledAsync as Async, StyledAsyncCreatable as AsyncCreatable, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, Calendar, type CalendarProps, Caption, type CaptionProps, Checkbox, type CheckboxProps, StyledCreatable as Creatable, Cropper, CropperCropArea, CropperDescription, CropperImage, type CropperProps, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type FileMetadata, FileUpload, type FileUploadActions, FileUploadError, type FileUploadOptions, type FileUploadProps, type FileUploadState, type FileWithPreview, Heading, type HeadingProps, InputDatePickerSingle, type InputDatePickerSingleProps, InputDateRangePicker, type InputDateRangePickerProps, InputDateTimePickerSingle, type InputDateTimePickerSingleProps, InputPhone, InputText, type InputTextProps, InputTime, type InputTimeProps, Label, Link, type LinkProps, NebulaI18nProvider, type NebulaI18nProviderProps, Pagination, type PaginationProps, Paragraph, type ParagraphProps, Popover, PopoverContent, type PopoverContentProps, PopoverTrigger, ProfileImage, type ProfileImageProps, RadioGroup, RadioGroupItem, StyledSelect as Select, type CreateStyledSelectProps as SelectProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, Slider, Space, SpaceDirectionEnum, type SpaceProps, SpaceSizeEnum, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperSeparator, StepperTitle, StepperTrigger, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, type TagProps, TextArea, type TextAreaProps, Toaster, Tooltip, type TooltipProps, alertVariants, badgeSizeEnum, badgeVariantEnum, buttonSizeEnum, buttonVariantEnum, buttonVariantsConfig, dateIsAvailable, formatBytes, getNebulaLanguage, localeByi18nKey, messages, separatorVariants, setNebulaLanguage, tagVariantsEnum, tailwind, toast, useClickOutside, useFileUpload, useKeyPress, useNebulaI18n };
package/dist/index.d.ts CHANGED
@@ -580,10 +580,15 @@ interface Messages {
580
580
  cropper: CropperMessages;
581
581
  }
582
582
 
583
+ declare enum NebulaLanguage {
584
+ EN_US = "en-US",
585
+ ES = "es",
586
+ PT_BR = "pt-BR"
587
+ }
583
588
  /**
584
589
  * Type to store the language in the localStorage.
585
590
  */
586
- type Language = 'en-US' | 'es' | 'pt-BR';
591
+ type Language = NebulaLanguage.EN_US | NebulaLanguage.ES | NebulaLanguage.PT_BR;
587
592
  /**
588
593
  * Get the language from the localStorage.
589
594
  */
@@ -625,6 +630,21 @@ interface InputDateTimePickerSingleProps extends Omit<InputTextProps, 'onChange'
625
630
  }
626
631
  declare const InputDateTimePickerSingle: ({ placeholder, className, value, onChange, numberOfMonths, onClean, disabledDates, ...rest }: InputDateTimePickerSingleProps) => react_jsx_runtime.JSX.Element;
627
632
 
633
+ interface InputDateRangePickerProps extends Omit<InputTextProps, 'onChange' | 'value'> {
634
+ value?: string;
635
+ onChange?: (value?: string, calendarDate?: [Date | undefined, Date | undefined]) => void;
636
+ numberOfMonths?: CalendarProps['numberOfMonths'];
637
+ placeholder?: string;
638
+ className?: string;
639
+ disabledDates?: CalendarProps['disabled'];
640
+ onClean?: VoidFunction;
641
+ popoverContainer?: HTMLElement | null;
642
+ }
643
+ declare const InputDateRangePicker: {
644
+ ({ placeholder, className, value, onChange, numberOfMonths, onClean, disabledDates, ...rest }: InputDateRangePickerProps): react_jsx_runtime.JSX.Element;
645
+ displayName: string;
646
+ };
647
+
628
648
  type InputTimeProps = Omit<React.ComponentProps<typeof InputText>, 'onChange'> & {
629
649
  onChange?: (value: string) => void;
630
650
  };
@@ -885,4 +905,4 @@ declare function useClickOutside<T extends HTMLElement>(refs: PossibleRefs<T>, o
885
905
 
886
906
  declare function useKeyPress(key: string, callback: VoidFunction): void;
887
907
 
888
- export { Accordion, AccordionContent, AccordionDescription, AccordionItem, type AccordionProps, AccordionTitle, AccordionTrigger, ActionBar, ActionBarButton, ActionBarClose, ActionBarContent, ActionBarDivider, ActionBarPortal, ActionBarTrigger, Alert, AlertButton, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, StyledAsync as Async, StyledAsyncCreatable as AsyncCreatable, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, Calendar, type CalendarProps, Caption, type CaptionProps, Checkbox, type CheckboxProps, StyledCreatable as Creatable, Cropper, CropperCropArea, CropperDescription, CropperImage, type CropperProps, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type FileMetadata, FileUpload, type FileUploadActions, FileUploadError, type FileUploadOptions, type FileUploadProps, type FileUploadState, type FileWithPreview, Heading, type HeadingProps, InputDatePickerSingle, type InputDatePickerSingleProps, InputDateTimePickerSingle, type InputDateTimePickerSingleProps, InputPhone, InputText, type InputTextProps, InputTime, type InputTimeProps, Label, Link, type LinkProps, NebulaI18nProvider, type NebulaI18nProviderProps, Pagination, type PaginationProps, Paragraph, type ParagraphProps, Popover, PopoverContent, type PopoverContentProps, PopoverTrigger, ProfileImage, type ProfileImageProps, RadioGroup, RadioGroupItem, StyledSelect as Select, type CreateStyledSelectProps as SelectProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, Slider, Space, SpaceDirectionEnum, type SpaceProps, SpaceSizeEnum, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperSeparator, StepperTitle, StepperTrigger, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, type TagProps, TextArea, type TextAreaProps, Toaster, Tooltip, type TooltipProps, alertVariants, badgeSizeEnum, badgeVariantEnum, buttonSizeEnum, buttonVariantEnum, buttonVariantsConfig, dateIsAvailable, formatBytes, getNebulaLanguage, localeByi18nKey, messages, separatorVariants, setNebulaLanguage, tagVariantsEnum, tailwind, toast, useClickOutside, useFileUpload, useKeyPress, useNebulaI18n };
908
+ export { Accordion, AccordionContent, AccordionDescription, AccordionItem, type AccordionProps, AccordionTitle, AccordionTrigger, ActionBar, ActionBarButton, ActionBarClose, ActionBarContent, ActionBarDivider, ActionBarPortal, ActionBarTrigger, Alert, AlertButton, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, StyledAsync as Async, StyledAsyncCreatable as AsyncCreatable, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, Calendar, type CalendarProps, Caption, type CaptionProps, Checkbox, type CheckboxProps, StyledCreatable as Creatable, Cropper, CropperCropArea, CropperDescription, CropperImage, type CropperProps, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type FileMetadata, FileUpload, type FileUploadActions, FileUploadError, type FileUploadOptions, type FileUploadProps, type FileUploadState, type FileWithPreview, Heading, type HeadingProps, InputDatePickerSingle, type InputDatePickerSingleProps, InputDateRangePicker, type InputDateRangePickerProps, InputDateTimePickerSingle, type InputDateTimePickerSingleProps, InputPhone, InputText, type InputTextProps, InputTime, type InputTimeProps, Label, Link, type LinkProps, NebulaI18nProvider, type NebulaI18nProviderProps, Pagination, type PaginationProps, Paragraph, type ParagraphProps, Popover, PopoverContent, type PopoverContentProps, PopoverTrigger, ProfileImage, type ProfileImageProps, RadioGroup, RadioGroupItem, StyledSelect as Select, type CreateStyledSelectProps as SelectProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, Slider, Space, SpaceDirectionEnum, type SpaceProps, SpaceSizeEnum, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperSeparator, StepperTitle, StepperTrigger, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, type TagProps, TextArea, type TextAreaProps, Toaster, Tooltip, type TooltipProps, alertVariants, badgeSizeEnum, badgeVariantEnum, buttonSizeEnum, buttonVariantEnum, buttonVariantsConfig, dateIsAvailable, formatBytes, getNebulaLanguage, localeByi18nKey, messages, separatorVariants, setNebulaLanguage, tagVariantsEnum, tailwind, toast, useClickOutside, useFileUpload, useKeyPress, useNebulaI18n };
package/dist/index.js CHANGED
@@ -1807,9 +1807,9 @@ var setNebulaLanguage = (language) => {
1807
1807
  var messages19 = /* @__PURE__ */ new Map([
1808
1808
  [null, enMessages],
1809
1809
  [void 0, enMessages],
1810
- ["en-US", enMessages],
1811
- ["es", esMessages],
1812
- ["pt-BR", ptBrMessages]
1810
+ ["en-US" /* EN_US */, enMessages],
1811
+ ["es" /* ES */, esMessages],
1812
+ ["pt-BR" /* PT_BR */, ptBrMessages]
1813
1813
  ]);
1814
1814
  var NebulaI18nContext = React8.createContext(
1815
1815
  null
@@ -1823,13 +1823,13 @@ var NebulaI18nProvider = ({
1823
1823
  [customI18nStorageKey]
1824
1824
  );
1825
1825
  const [messages20, setMessages] = React8.useState(
1826
- messages19.get(getNebulaLanguage()) ?? messages19.get("en-US")
1826
+ messages19.get(getNebulaLanguage()) ?? messages19.get("en-US" /* EN_US */)
1827
1827
  );
1828
1828
  const handleStorageChange = React8.useCallback(
1829
1829
  ({ detail }) => {
1830
1830
  if (detail.key === storageKey) {
1831
1831
  setMessages(
1832
- messages19.get(detail.value) ?? messages19.get("en-US")
1832
+ messages19.get(detail.value) ?? messages19.get("en-US" /* EN_US */)
1833
1833
  );
1834
1834
  }
1835
1835
  },
@@ -2663,22 +2663,19 @@ var DrawerOverlay = React8__namespace.forwardRef(({ className, ...props }, ref)
2663
2663
  }
2664
2664
  ));
2665
2665
  DrawerOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
2666
- var DrawerVariants = classVarianceAuthority.cva(
2667
- "fixed flex flex-col z-50 shadow-lg transition ease-in-out",
2668
- {
2669
- variants: {
2670
- side: {
2671
- top: "inset-x-0 top-0 data-[state=open]:animate-slide-in-from-top data-[state=closed]:animate-slide-out-to-top",
2672
- bottom: "inset-x-0 bottom-0 data-[state=open]:animate-slide-in-from-bottom data-[state=closed]:animate-slide-out-to-bottom",
2673
- left: "inset-y-0 h-full left-0 w-3/4 data-[state=open]:animate-slide-in-from-left data-[state=closed]:animate-slide-out-to-left sm:max-w-sm",
2674
- right: "inset-y-0 h-full right-0 w-3/4 data-[state=open]:animate-slide-in-from-right data-[state=closed]:animate-slide-out-to-right sm:max-w-sm"
2675
- }
2676
- },
2677
- defaultVariants: {
2678
- side: "right"
2666
+ var DrawerVariants = classVarianceAuthority.cva("fixed flex flex-col z-50 shadow-lg", {
2667
+ variants: {
2668
+ side: {
2669
+ top: "inset-x-0 top-0 data-[state=open]:animate-slide-in-from-top data-[state=closed]:animate-slide-out-to-top",
2670
+ bottom: "inset-x-0 bottom-0 data-[state=open]:animate-slide-in-from-bottom data-[state=closed]:animate-slide-out-to-bottom",
2671
+ left: "inset-y-0 h-full left-0 w-3/4 data-[state=open]:animate-slide-in-from-left data-[state=closed]:animate-slide-out-to-left sm:max-w-sm",
2672
+ right: "inset-y-0 h-full right-0 w-3/4 data-[state=open]:animate-slide-in-from-right data-[state=closed]:animate-slide-out-to-right sm:max-w-sm"
2679
2673
  }
2674
+ },
2675
+ defaultVariants: {
2676
+ side: "right"
2680
2677
  }
2681
- );
2678
+ });
2682
2679
  var DrawerContent = React8__namespace.forwardRef(({ side = "right", className, portal = false, children, ...props }, ref) => {
2683
2680
  const Comp = portal ? DrawerPortal : React8__namespace.Fragment;
2684
2681
  return /* @__PURE__ */ jsxRuntime.jsxs(Comp, { children: [
@@ -2927,7 +2924,7 @@ var Tooltip = React8__namespace.forwardRef(
2927
2924
  }, ref) => {
2928
2925
  const Comp = portal ? TooltipPrimitive__namespace.Portal : React8__namespace.Fragment;
2929
2926
  return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Provider, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipPrimitive__namespace.Root, { children: [
2930
- /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Trigger, { children }),
2927
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Trigger, { type: "button", children }),
2931
2928
  /* @__PURE__ */ jsxRuntime.jsx(Comp, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2932
2929
  TooltipPrimitive__namespace.Content,
2933
2930
  {
@@ -4013,6 +4010,24 @@ var formatDateToSubmit = (dateStr, timeFallback = "23:59") => {
4013
4010
  };
4014
4011
 
4015
4012
  // src/utils/valid-date-format.ts
4013
+ function dateParts(dateSlice, locale, time) {
4014
+ const [day, month, year] = [
4015
+ locale !== "en-US" /* EN_US */ ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
4016
+ locale === "en-US" /* EN_US */ ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
4017
+ dateSlice.substring(6)
4018
+ ];
4019
+ const [hour = 0, minute = 0] = time?.split(":") ?? [];
4020
+ return {
4021
+ date: new Date(
4022
+ Number(year),
4023
+ Number(month) - 1,
4024
+ Number(day),
4025
+ Number(Math.min(Math.max(Number(hour), 0), 23)),
4026
+ Number(Math.min(Math.max(Number(minute), 0), 59))
4027
+ ),
4028
+ dateParts: [Number(day), Number(month), Number(year)]
4029
+ };
4030
+ }
4016
4031
  function dateFormatIsValid(dateStr, locale) {
4017
4032
  const regexBR = /^(?:(?:31\/(0[13578]|1[02]))\/(?:\d{4})|(?:29|30)\/(0[13-9]|1[0-2])\/(?:\d{4})|29\/02\/(?:\d\d(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)|(?:0[1-9]|1\d|2[0-8])\/(0[1-9]|1[0-2])\/(?:\d{4}))$/;
4018
4033
  const regexUS = /^(?:(?:(0[13578]|1[02])\/31)\/(?:\d{4})|(?:(0[13-9]|1[0-2])\/(29|30))\/(?:\d{4})|(?:02\/29)\/(?:\d\d(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)|(?:(0[1-9]|1[0-2])\/(0[1-9]|1\d|2[0-8]))\/(?:\d{4}))$/;
@@ -4093,13 +4108,8 @@ var InputDatePickerSingle = ({
4093
4108
  handleClearValue();
4094
4109
  return;
4095
4110
  }
4096
- const [day, month2, year] = [
4097
- locale !== "en-US" ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
4098
- locale === "en-US" ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
4099
- dateSlice.substring(6)
4100
- ];
4101
- const date = new Date(Number(year), Number(month2) - 1, Number(day));
4102
- if ([day, month2, year].some((value2) => !value2) || !dateFormatIsValid(dateSlice, locale) || !dateFns.isValid(new Date(date)) || !dateIsAvailable(date, disabledDates)) {
4111
+ const { date } = dateParts(dateSlice, locale);
4112
+ if (!dateFns.isValid(date) || !dateFormatIsValid(dateSlice, locale) || !dateIsAvailable(date, disabledDates)) {
4103
4113
  onChange?.(text);
4104
4114
  handleClearValue();
4105
4115
  return;
@@ -4317,13 +4327,8 @@ var InputDateTimePickerSingle = ({
4317
4327
  handleClearValue();
4318
4328
  return;
4319
4329
  }
4320
- const [day, month2, year] = [
4321
- locale !== "en-US" ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
4322
- locale === "en-US" ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
4323
- dateSlice.substring(6)
4324
- ];
4325
- const date = new Date(Number(year), Number(month2) - 1, Number(day));
4326
- if ([day, month2, year].some((value2) => !value2) || !dateFormatIsValid(dateSlice, locale) || !dateFns.isValid(new Date(date)) || !dateIsAvailable(date, disabledDates)) {
4330
+ const date = dateParts(dateSlice, locale, hourSlice).date;
4331
+ if (!dateFns.isValid(date) || !dateFormatIsValid(dateSlice, locale) || !dateIsAvailable(date, disabledDates)) {
4327
4332
  onChange?.(text);
4328
4333
  handleClearValue();
4329
4334
  return;
@@ -4494,6 +4499,143 @@ var InputDateTimePickerSingle = ({
4494
4499
  ) })
4495
4500
  ] });
4496
4501
  };
4502
+ var InputDateRangePicker = ({
4503
+ placeholder,
4504
+ className,
4505
+ value,
4506
+ onChange,
4507
+ numberOfMonths = 1,
4508
+ onClean,
4509
+ disabledDates,
4510
+ ...rest
4511
+ }) => {
4512
+ const [month, setMonth] = React8.useState(/* @__PURE__ */ new Date());
4513
+ const [innerValue, setInnerValue] = React8.useState();
4514
+ const [popoverIsOpen, setPopoverIsOpen] = React8.useState(false);
4515
+ const maskOptions = {
4516
+ mask: "__/__/____ - __/__/____",
4517
+ replacement: { _: /\d/ }
4518
+ };
4519
+ const inputRef = mask.useMask(maskOptions);
4520
+ const { locale } = useNebulaI18n();
4521
+ const conteinerRef = React8.useRef(null);
4522
+ const calendarRef = React8.useRef(null);
4523
+ useClickOutside([conteinerRef, calendarRef], () => {
4524
+ setPopoverIsOpen(false);
4525
+ });
4526
+ useKeyPress("Escape", () => {
4527
+ setPopoverIsOpen(false);
4528
+ });
4529
+ const handleInnerInputChange = (value2) => {
4530
+ const [startDate, endDate] = value2.split(" - ");
4531
+ const dateStart = startDate && dateFormatIsValid(startDate, locale) ? dateParts(startDate, locale).date : void 0;
4532
+ const dateEnd = endDate && dateFormatIsValid(endDate, locale) ? dateParts(endDate, locale).date : void 0;
4533
+ onChange?.(value2, [dateStart, dateEnd]);
4534
+ };
4535
+ const handleChangeCalendarDate = React8.useCallback(
4536
+ (date) => {
4537
+ setInnerValue(date);
4538
+ const [from, to] = date;
4539
+ const fromStr = from ? Intl.DateTimeFormat(locale ?? "en-US", {
4540
+ month: "2-digit",
4541
+ year: "numeric",
4542
+ day: "2-digit"
4543
+ }).format(from) : "";
4544
+ const toStr = to ? Intl.DateTimeFormat(locale ?? "en-US", {
4545
+ month: "2-digit",
4546
+ year: "numeric",
4547
+ day: "2-digit"
4548
+ }).format(to) : "";
4549
+ onChange?.(
4550
+ [fromStr, toStr !== fromStr ? toStr : void 0].filter(Boolean).join(" - "),
4551
+ date
4552
+ );
4553
+ setMonth(to ?? /* @__PURE__ */ new Date());
4554
+ },
4555
+ [locale, onChange]
4556
+ );
4557
+ React8.useEffect(() => {
4558
+ if (value) {
4559
+ const [startDate, endDate] = value.split(" - ");
4560
+ const dateStart = startDate && dateFormatIsValid(startDate, locale) ? dateParts(startDate, locale).date : void 0;
4561
+ const dateEnd = endDate && dateFormatIsValid(endDate, locale) ? dateParts(endDate, locale).date : void 0;
4562
+ setInnerValue(
4563
+ [dateStart, dateEnd].filter(Boolean)
4564
+ );
4565
+ if (dateEnd instanceof Date) {
4566
+ setMonth(dateEnd);
4567
+ } else {
4568
+ setMonth(/* @__PURE__ */ new Date());
4569
+ }
4570
+ } else {
4571
+ setInnerValue([void 0, void 0]);
4572
+ setMonth(/* @__PURE__ */ new Date());
4573
+ }
4574
+ }, [value, locale]);
4575
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nebula-ds w-full", ref: conteinerRef, children: [
4576
+ /* @__PURE__ */ jsxRuntime.jsx(
4577
+ InputText,
4578
+ {
4579
+ ref: inputRef,
4580
+ placeholder,
4581
+ value,
4582
+ className,
4583
+ icon: /* @__PURE__ */ jsxRuntime.jsx(
4584
+ lucideReact.CalendarIcon,
4585
+ {
4586
+ tabIndex: 0,
4587
+ role: "button",
4588
+ onClick: () => setPopoverIsOpen((s) => !s),
4589
+ onKeyUp: (e) => {
4590
+ if (e.key === "Enter") {
4591
+ setPopoverIsOpen((s) => !s);
4592
+ }
4593
+ },
4594
+ className: "nebula-ds cursor-pointer"
4595
+ }
4596
+ ),
4597
+ iconPlacement: "end",
4598
+ onKeyUp: (e) => {
4599
+ if (e.key === "ArrowDown") {
4600
+ setPopoverIsOpen(true);
4601
+ }
4602
+ },
4603
+ onClean: onClean ? () => {
4604
+ onClean();
4605
+ } : void 0,
4606
+ ...rest,
4607
+ onChange: (e) => handleInnerInputChange(e.target.value)
4608
+ }
4609
+ ),
4610
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nebula-ds relative", children: popoverIsOpen && /* @__PURE__ */ jsxRuntime.jsx(
4611
+ "div",
4612
+ {
4613
+ className: "nebula-ds absolute top-full left-0-0 z-40 pb-2 pt-1",
4614
+ ref: calendarRef,
4615
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4616
+ Calendar,
4617
+ {
4618
+ required: false,
4619
+ mode: "range",
4620
+ numberOfMonths,
4621
+ disabled: disabledDates,
4622
+ month,
4623
+ onPrevClick: setMonth,
4624
+ onNextClick: setMonth,
4625
+ selected: {
4626
+ from: innerValue?.[0],
4627
+ to: innerValue?.[1]
4628
+ },
4629
+ onSelect: (date) => {
4630
+ handleChangeCalendarDate([date?.from, date?.to]);
4631
+ }
4632
+ }
4633
+ )
4634
+ }
4635
+ ) })
4636
+ ] });
4637
+ };
4638
+ InputDateRangePicker.displayName = "InputDateRangePicker";
4497
4639
  var FileUploadError = /* @__PURE__ */ ((FileUploadError4) => {
4498
4640
  FileUploadError4["MAX_FILES_EXCEEDED"] = "MAX_FILES_EXCEEDED";
4499
4641
  FileUploadError4["MAXIMUM_FILE_SIZE_EXCEEDED"] = "MAXIMUM_FILE_SIZE_EXCEEDED";
@@ -4757,9 +4899,25 @@ var useFileUpload = (options = {}) => {
4757
4899
  },
4758
4900
  [accept, multiple, handleFileChange]
4759
4901
  );
4760
- return [
4761
- state,
4762
- {
4902
+ return React8.useMemo(
4903
+ () => [
4904
+ state,
4905
+ {
4906
+ addFiles,
4907
+ removeFile,
4908
+ clearFiles,
4909
+ clearErrors,
4910
+ handleDragEnter,
4911
+ handleDragLeave,
4912
+ handleDragOver,
4913
+ handleDrop,
4914
+ handleFileChange,
4915
+ openFileDialog,
4916
+ getInputProps
4917
+ }
4918
+ ],
4919
+ [
4920
+ state,
4763
4921
  addFiles,
4764
4922
  removeFile,
4765
4923
  clearFiles,
@@ -4771,8 +4929,8 @@ var useFileUpload = (options = {}) => {
4771
4929
  handleFileChange,
4772
4930
  openFileDialog,
4773
4931
  getInputProps
4774
- }
4775
- ];
4932
+ ]
4933
+ );
4776
4934
  };
4777
4935
  var formatBytes = (bytes, decimals = 2) => {
4778
4936
  if (bytes === 0) return "0 Bytes";
@@ -4827,7 +4985,7 @@ function FileUpload({
4827
4985
  });
4828
4986
  React8.useEffect(() => {
4829
4987
  onError?.(errors);
4830
- }, [errors, onError]);
4988
+ }, [errors]);
4831
4989
  const disabled = React8.useMemo(() => {
4832
4990
  if (rest.disabled) return true;
4833
4991
  if (rest.multiple) {
@@ -6111,7 +6269,7 @@ var ProfileImage = ({
6111
6269
  const [isDialogOpen, setIsDialogOpen] = React8.useState(false);
6112
6270
  React8.useEffect(() => {
6113
6271
  onError?.(errors);
6114
- }, [errors, onError]);
6272
+ }, [errors]);
6115
6273
  const [file] = files;
6116
6274
  const fileId = file?.id;
6117
6275
  const previousFileIdRef = React8.useRef(null);
@@ -6696,6 +6854,7 @@ exports.FileUpload = FileUpload;
6696
6854
  exports.FileUploadError = FileUploadError;
6697
6855
  exports.Heading = Heading;
6698
6856
  exports.InputDatePickerSingle = InputDatePickerSingle;
6857
+ exports.InputDateRangePicker = InputDateRangePicker;
6699
6858
  exports.InputDateTimePickerSingle = InputDateTimePickerSingle;
6700
6859
  exports.InputPhone = InputPhone;
6701
6860
  exports.InputText = InputText;
package/dist/index.mjs CHANGED
@@ -1765,9 +1765,9 @@ var setNebulaLanguage = (language) => {
1765
1765
  var messages19 = /* @__PURE__ */ new Map([
1766
1766
  [null, enMessages],
1767
1767
  [void 0, enMessages],
1768
- ["en-US", enMessages],
1769
- ["es", esMessages],
1770
- ["pt-BR", ptBrMessages]
1768
+ ["en-US" /* EN_US */, enMessages],
1769
+ ["es" /* ES */, esMessages],
1770
+ ["pt-BR" /* PT_BR */, ptBrMessages]
1771
1771
  ]);
1772
1772
  var NebulaI18nContext = createContext(
1773
1773
  null
@@ -1781,13 +1781,13 @@ var NebulaI18nProvider = ({
1781
1781
  [customI18nStorageKey]
1782
1782
  );
1783
1783
  const [messages20, setMessages] = useState(
1784
- messages19.get(getNebulaLanguage()) ?? messages19.get("en-US")
1784
+ messages19.get(getNebulaLanguage()) ?? messages19.get("en-US" /* EN_US */)
1785
1785
  );
1786
1786
  const handleStorageChange = useCallback(
1787
1787
  ({ detail }) => {
1788
1788
  if (detail.key === storageKey) {
1789
1789
  setMessages(
1790
- messages19.get(detail.value) ?? messages19.get("en-US")
1790
+ messages19.get(detail.value) ?? messages19.get("en-US" /* EN_US */)
1791
1791
  );
1792
1792
  }
1793
1793
  },
@@ -2621,22 +2621,19 @@ var DrawerOverlay = React8.forwardRef(({ className, ...props }, ref) => /* @__PU
2621
2621
  }
2622
2622
  ));
2623
2623
  DrawerOverlay.displayName = DialogPrimitive.Overlay.displayName;
2624
- var DrawerVariants = cva(
2625
- "fixed flex flex-col z-50 shadow-lg transition ease-in-out",
2626
- {
2627
- variants: {
2628
- side: {
2629
- top: "inset-x-0 top-0 data-[state=open]:animate-slide-in-from-top data-[state=closed]:animate-slide-out-to-top",
2630
- bottom: "inset-x-0 bottom-0 data-[state=open]:animate-slide-in-from-bottom data-[state=closed]:animate-slide-out-to-bottom",
2631
- left: "inset-y-0 h-full left-0 w-3/4 data-[state=open]:animate-slide-in-from-left data-[state=closed]:animate-slide-out-to-left sm:max-w-sm",
2632
- right: "inset-y-0 h-full right-0 w-3/4 data-[state=open]:animate-slide-in-from-right data-[state=closed]:animate-slide-out-to-right sm:max-w-sm"
2633
- }
2634
- },
2635
- defaultVariants: {
2636
- side: "right"
2624
+ var DrawerVariants = cva("fixed flex flex-col z-50 shadow-lg", {
2625
+ variants: {
2626
+ side: {
2627
+ top: "inset-x-0 top-0 data-[state=open]:animate-slide-in-from-top data-[state=closed]:animate-slide-out-to-top",
2628
+ bottom: "inset-x-0 bottom-0 data-[state=open]:animate-slide-in-from-bottom data-[state=closed]:animate-slide-out-to-bottom",
2629
+ left: "inset-y-0 h-full left-0 w-3/4 data-[state=open]:animate-slide-in-from-left data-[state=closed]:animate-slide-out-to-left sm:max-w-sm",
2630
+ right: "inset-y-0 h-full right-0 w-3/4 data-[state=open]:animate-slide-in-from-right data-[state=closed]:animate-slide-out-to-right sm:max-w-sm"
2637
2631
  }
2632
+ },
2633
+ defaultVariants: {
2634
+ side: "right"
2638
2635
  }
2639
- );
2636
+ });
2640
2637
  var DrawerContent = React8.forwardRef(({ side = "right", className, portal = false, children, ...props }, ref) => {
2641
2638
  const Comp = portal ? DrawerPortal : React8.Fragment;
2642
2639
  return /* @__PURE__ */ jsxs(Comp, { children: [
@@ -2885,7 +2882,7 @@ var Tooltip = React8.forwardRef(
2885
2882
  }, ref) => {
2886
2883
  const Comp = portal ? TooltipPrimitive.Portal : React8.Fragment;
2887
2884
  return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsxs(TooltipPrimitive.Root, { children: [
2888
- /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { children }),
2885
+ /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { type: "button", children }),
2889
2886
  /* @__PURE__ */ jsx(Comp, { children: /* @__PURE__ */ jsxs(
2890
2887
  TooltipPrimitive.Content,
2891
2888
  {
@@ -3971,6 +3968,24 @@ var formatDateToSubmit = (dateStr, timeFallback = "23:59") => {
3971
3968
  };
3972
3969
 
3973
3970
  // src/utils/valid-date-format.ts
3971
+ function dateParts(dateSlice, locale, time) {
3972
+ const [day, month, year] = [
3973
+ locale !== "en-US" /* EN_US */ ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
3974
+ locale === "en-US" /* EN_US */ ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
3975
+ dateSlice.substring(6)
3976
+ ];
3977
+ const [hour = 0, minute = 0] = time?.split(":") ?? [];
3978
+ return {
3979
+ date: new Date(
3980
+ Number(year),
3981
+ Number(month) - 1,
3982
+ Number(day),
3983
+ Number(Math.min(Math.max(Number(hour), 0), 23)),
3984
+ Number(Math.min(Math.max(Number(minute), 0), 59))
3985
+ ),
3986
+ dateParts: [Number(day), Number(month), Number(year)]
3987
+ };
3988
+ }
3974
3989
  function dateFormatIsValid(dateStr, locale) {
3975
3990
  const regexBR = /^(?:(?:31\/(0[13578]|1[02]))\/(?:\d{4})|(?:29|30)\/(0[13-9]|1[0-2])\/(?:\d{4})|29\/02\/(?:\d\d(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)|(?:0[1-9]|1\d|2[0-8])\/(0[1-9]|1[0-2])\/(?:\d{4}))$/;
3976
3991
  const regexUS = /^(?:(?:(0[13578]|1[02])\/31)\/(?:\d{4})|(?:(0[13-9]|1[0-2])\/(29|30))\/(?:\d{4})|(?:02\/29)\/(?:\d\d(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)|(?:(0[1-9]|1[0-2])\/(0[1-9]|1\d|2[0-8]))\/(?:\d{4}))$/;
@@ -4051,13 +4066,8 @@ var InputDatePickerSingle = ({
4051
4066
  handleClearValue();
4052
4067
  return;
4053
4068
  }
4054
- const [day, month2, year] = [
4055
- locale !== "en-US" ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
4056
- locale === "en-US" ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
4057
- dateSlice.substring(6)
4058
- ];
4059
- const date = new Date(Number(year), Number(month2) - 1, Number(day));
4060
- if ([day, month2, year].some((value2) => !value2) || !dateFormatIsValid(dateSlice, locale) || !isValid(new Date(date)) || !dateIsAvailable(date, disabledDates)) {
4069
+ const { date } = dateParts(dateSlice, locale);
4070
+ if (!isValid(date) || !dateFormatIsValid(dateSlice, locale) || !dateIsAvailable(date, disabledDates)) {
4061
4071
  onChange?.(text);
4062
4072
  handleClearValue();
4063
4073
  return;
@@ -4275,13 +4285,8 @@ var InputDateTimePickerSingle = ({
4275
4285
  handleClearValue();
4276
4286
  return;
4277
4287
  }
4278
- const [day, month2, year] = [
4279
- locale !== "en-US" ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
4280
- locale === "en-US" ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
4281
- dateSlice.substring(6)
4282
- ];
4283
- const date = new Date(Number(year), Number(month2) - 1, Number(day));
4284
- if ([day, month2, year].some((value2) => !value2) || !dateFormatIsValid(dateSlice, locale) || !isValid(new Date(date)) || !dateIsAvailable(date, disabledDates)) {
4288
+ const date = dateParts(dateSlice, locale, hourSlice).date;
4289
+ if (!isValid(date) || !dateFormatIsValid(dateSlice, locale) || !dateIsAvailable(date, disabledDates)) {
4285
4290
  onChange?.(text);
4286
4291
  handleClearValue();
4287
4292
  return;
@@ -4452,6 +4457,143 @@ var InputDateTimePickerSingle = ({
4452
4457
  ) })
4453
4458
  ] });
4454
4459
  };
4460
+ var InputDateRangePicker = ({
4461
+ placeholder,
4462
+ className,
4463
+ value,
4464
+ onChange,
4465
+ numberOfMonths = 1,
4466
+ onClean,
4467
+ disabledDates,
4468
+ ...rest
4469
+ }) => {
4470
+ const [month, setMonth] = useState(/* @__PURE__ */ new Date());
4471
+ const [innerValue, setInnerValue] = useState();
4472
+ const [popoverIsOpen, setPopoverIsOpen] = useState(false);
4473
+ const maskOptions = {
4474
+ mask: "__/__/____ - __/__/____",
4475
+ replacement: { _: /\d/ }
4476
+ };
4477
+ const inputRef = useMask(maskOptions);
4478
+ const { locale } = useNebulaI18n();
4479
+ const conteinerRef = useRef(null);
4480
+ const calendarRef = useRef(null);
4481
+ useClickOutside([conteinerRef, calendarRef], () => {
4482
+ setPopoverIsOpen(false);
4483
+ });
4484
+ useKeyPress("Escape", () => {
4485
+ setPopoverIsOpen(false);
4486
+ });
4487
+ const handleInnerInputChange = (value2) => {
4488
+ const [startDate, endDate] = value2.split(" - ");
4489
+ const dateStart = startDate && dateFormatIsValid(startDate, locale) ? dateParts(startDate, locale).date : void 0;
4490
+ const dateEnd = endDate && dateFormatIsValid(endDate, locale) ? dateParts(endDate, locale).date : void 0;
4491
+ onChange?.(value2, [dateStart, dateEnd]);
4492
+ };
4493
+ const handleChangeCalendarDate = useCallback(
4494
+ (date) => {
4495
+ setInnerValue(date);
4496
+ const [from, to] = date;
4497
+ const fromStr = from ? Intl.DateTimeFormat(locale ?? "en-US", {
4498
+ month: "2-digit",
4499
+ year: "numeric",
4500
+ day: "2-digit"
4501
+ }).format(from) : "";
4502
+ const toStr = to ? Intl.DateTimeFormat(locale ?? "en-US", {
4503
+ month: "2-digit",
4504
+ year: "numeric",
4505
+ day: "2-digit"
4506
+ }).format(to) : "";
4507
+ onChange?.(
4508
+ [fromStr, toStr !== fromStr ? toStr : void 0].filter(Boolean).join(" - "),
4509
+ date
4510
+ );
4511
+ setMonth(to ?? /* @__PURE__ */ new Date());
4512
+ },
4513
+ [locale, onChange]
4514
+ );
4515
+ useEffect(() => {
4516
+ if (value) {
4517
+ const [startDate, endDate] = value.split(" - ");
4518
+ const dateStart = startDate && dateFormatIsValid(startDate, locale) ? dateParts(startDate, locale).date : void 0;
4519
+ const dateEnd = endDate && dateFormatIsValid(endDate, locale) ? dateParts(endDate, locale).date : void 0;
4520
+ setInnerValue(
4521
+ [dateStart, dateEnd].filter(Boolean)
4522
+ );
4523
+ if (dateEnd instanceof Date) {
4524
+ setMonth(dateEnd);
4525
+ } else {
4526
+ setMonth(/* @__PURE__ */ new Date());
4527
+ }
4528
+ } else {
4529
+ setInnerValue([void 0, void 0]);
4530
+ setMonth(/* @__PURE__ */ new Date());
4531
+ }
4532
+ }, [value, locale]);
4533
+ return /* @__PURE__ */ jsxs("div", { className: "nebula-ds w-full", ref: conteinerRef, children: [
4534
+ /* @__PURE__ */ jsx(
4535
+ InputText,
4536
+ {
4537
+ ref: inputRef,
4538
+ placeholder,
4539
+ value,
4540
+ className,
4541
+ icon: /* @__PURE__ */ jsx(
4542
+ CalendarIcon,
4543
+ {
4544
+ tabIndex: 0,
4545
+ role: "button",
4546
+ onClick: () => setPopoverIsOpen((s) => !s),
4547
+ onKeyUp: (e) => {
4548
+ if (e.key === "Enter") {
4549
+ setPopoverIsOpen((s) => !s);
4550
+ }
4551
+ },
4552
+ className: "nebula-ds cursor-pointer"
4553
+ }
4554
+ ),
4555
+ iconPlacement: "end",
4556
+ onKeyUp: (e) => {
4557
+ if (e.key === "ArrowDown") {
4558
+ setPopoverIsOpen(true);
4559
+ }
4560
+ },
4561
+ onClean: onClean ? () => {
4562
+ onClean();
4563
+ } : void 0,
4564
+ ...rest,
4565
+ onChange: (e) => handleInnerInputChange(e.target.value)
4566
+ }
4567
+ ),
4568
+ /* @__PURE__ */ jsx("div", { className: "nebula-ds relative", children: popoverIsOpen && /* @__PURE__ */ jsx(
4569
+ "div",
4570
+ {
4571
+ className: "nebula-ds absolute top-full left-0-0 z-40 pb-2 pt-1",
4572
+ ref: calendarRef,
4573
+ children: /* @__PURE__ */ jsx(
4574
+ Calendar,
4575
+ {
4576
+ required: false,
4577
+ mode: "range",
4578
+ numberOfMonths,
4579
+ disabled: disabledDates,
4580
+ month,
4581
+ onPrevClick: setMonth,
4582
+ onNextClick: setMonth,
4583
+ selected: {
4584
+ from: innerValue?.[0],
4585
+ to: innerValue?.[1]
4586
+ },
4587
+ onSelect: (date) => {
4588
+ handleChangeCalendarDate([date?.from, date?.to]);
4589
+ }
4590
+ }
4591
+ )
4592
+ }
4593
+ ) })
4594
+ ] });
4595
+ };
4596
+ InputDateRangePicker.displayName = "InputDateRangePicker";
4455
4597
  var FileUploadError = /* @__PURE__ */ ((FileUploadError4) => {
4456
4598
  FileUploadError4["MAX_FILES_EXCEEDED"] = "MAX_FILES_EXCEEDED";
4457
4599
  FileUploadError4["MAXIMUM_FILE_SIZE_EXCEEDED"] = "MAXIMUM_FILE_SIZE_EXCEEDED";
@@ -4715,9 +4857,25 @@ var useFileUpload = (options = {}) => {
4715
4857
  },
4716
4858
  [accept, multiple, handleFileChange]
4717
4859
  );
4718
- return [
4719
- state,
4720
- {
4860
+ return useMemo(
4861
+ () => [
4862
+ state,
4863
+ {
4864
+ addFiles,
4865
+ removeFile,
4866
+ clearFiles,
4867
+ clearErrors,
4868
+ handleDragEnter,
4869
+ handleDragLeave,
4870
+ handleDragOver,
4871
+ handleDrop,
4872
+ handleFileChange,
4873
+ openFileDialog,
4874
+ getInputProps
4875
+ }
4876
+ ],
4877
+ [
4878
+ state,
4721
4879
  addFiles,
4722
4880
  removeFile,
4723
4881
  clearFiles,
@@ -4729,8 +4887,8 @@ var useFileUpload = (options = {}) => {
4729
4887
  handleFileChange,
4730
4888
  openFileDialog,
4731
4889
  getInputProps
4732
- }
4733
- ];
4890
+ ]
4891
+ );
4734
4892
  };
4735
4893
  var formatBytes = (bytes, decimals = 2) => {
4736
4894
  if (bytes === 0) return "0 Bytes";
@@ -4785,7 +4943,7 @@ function FileUpload({
4785
4943
  });
4786
4944
  useEffect(() => {
4787
4945
  onError?.(errors);
4788
- }, [errors, onError]);
4946
+ }, [errors]);
4789
4947
  const disabled = useMemo(() => {
4790
4948
  if (rest.disabled) return true;
4791
4949
  if (rest.multiple) {
@@ -6069,7 +6227,7 @@ var ProfileImage = ({
6069
6227
  const [isDialogOpen, setIsDialogOpen] = useState(false);
6070
6228
  useEffect(() => {
6071
6229
  onError?.(errors);
6072
- }, [errors, onError]);
6230
+ }, [errors]);
6073
6231
  const [file] = files;
6074
6232
  const fileId = file?.id;
6075
6233
  const previousFileIdRef = useRef(null);
@@ -6570,4 +6728,4 @@ var tailwind = {
6570
6728
  // plugin: () => require("tailwindcss")("node_modules/@nebulareact/dist/tailwind.config.js"),
6571
6729
  };
6572
6730
 
6573
- export { Accordion, AccordionContent, AccordionDescription, AccordionItem, AccordionTitle, AccordionTrigger, ActionBar, ActionBarButton, ActionBarClose, ActionBarContent, ActionBarDivider, ActionBarPortal, ActionBarTrigger, Alert, AlertButton, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, StyledAsync as Async, StyledAsyncCreatable as AsyncCreatable, Badge, Box, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Caption, Checkbox, StyledCreatable as Creatable, Cropper2 as Cropper, CropperCropArea2 as CropperCropArea, CropperDescription2 as CropperDescription, CropperImage2 as CropperImage, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FileUpload, FileUploadError, Heading, InputDatePickerSingle, InputDateTimePickerSingle, InputPhone, InputText, InputTime, Label, Link, NebulaI18nProvider, Pagination, Paragraph, Popover, PopoverContent, PopoverTrigger, ProfileImage, RadioGroup2 as RadioGroup, RadioGroupItem, StyledSelect as Select, Separator2 as Separator, Skeleton, Slider, Space, SpaceDirectionEnum, SpaceSizeEnum, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperSeparator, StepperTitle, StepperTrigger, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TextArea, Toaster, Tooltip, alertVariants, badgeSizeEnum, badgeVariantEnum, buttonSizeEnum, buttonVariantEnum, buttonVariantsConfig, dateIsAvailable, formatBytes, getNebulaLanguage, localeByi18nKey, messages19 as messages, separatorVariants, setNebulaLanguage, tagVariantsEnum, tailwind, toast, useClickOutside, useFileUpload, useKeyPress, useNebulaI18n };
6731
+ export { Accordion, AccordionContent, AccordionDescription, AccordionItem, AccordionTitle, AccordionTrigger, ActionBar, ActionBarButton, ActionBarClose, ActionBarContent, ActionBarDivider, ActionBarPortal, ActionBarTrigger, Alert, AlertButton, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, StyledAsync as Async, StyledAsyncCreatable as AsyncCreatable, Badge, Box, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Caption, Checkbox, StyledCreatable as Creatable, Cropper2 as Cropper, CropperCropArea2 as CropperCropArea, CropperDescription2 as CropperDescription, CropperImage2 as CropperImage, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FileUpload, FileUploadError, Heading, InputDatePickerSingle, InputDateRangePicker, InputDateTimePickerSingle, InputPhone, InputText, InputTime, Label, Link, NebulaI18nProvider, Pagination, Paragraph, Popover, PopoverContent, PopoverTrigger, ProfileImage, RadioGroup2 as RadioGroup, RadioGroupItem, StyledSelect as Select, Separator2 as Separator, Skeleton, Slider, Space, SpaceDirectionEnum, SpaceSizeEnum, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperSeparator, StepperTitle, StepperTrigger, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TextArea, Toaster, Tooltip, alertVariants, badgeSizeEnum, badgeVariantEnum, buttonSizeEnum, buttonVariantEnum, buttonVariantsConfig, dateIsAvailable, formatBytes, getNebulaLanguage, localeByi18nKey, messages19 as messages, separatorVariants, setNebulaLanguage, tagVariantsEnum, tailwind, toast, useClickOutside, useFileUpload, useKeyPress, useNebulaI18n };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikatec/nebula-react",
3
- "version": "1.3.2",
3
+ "version": "1.4.0-beta.1",
4
4
  "description": "React components for Nebula Design System",
5
5
  "publishConfig": {
6
6
  "access": "public"
Binary file