@northlight/ui 2.1.0 → 2.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Mediatool
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,5 +1,5 @@
1
1
  import { AccordionProps, AccordionButtonProps, AccordionPanelProps, AccordionItemProps, AvatarProps as AvatarProps$1, AlertProps as AlertProps$1, AspectRatioProps, StackProps, BadgeProps, ButtonProps as ButtonProps$1, CheckboxProps as CheckboxProps$1, StackDirection, IconButtonProps as IconButtonProps$1, InputProps, FlexProps, BoxProps, TagProps as TagProps$1, IconProps as IconProps$1, SystemStyleObject, HeadingProps as HeadingProps$1, TextProps, FormLabelProps as FormLabelProps$1, Heading, Text, ModalProps as ModalProps$1, NumberInputProps as NumberInputProps$1, PinInputProps as PinInputProps$1, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, SpinnerProps as SpinnerProps$1, SwitchProps as SwitchProps$1, TabsProps as TabsProps$1, TabPanelProps as TabPanelProps$1, TextareaProps as TextareaProps$1, UseToastOptions as UseToastOptions$1, FadeProps as FadeProps$1, ScaleFadeProps as ScaleFadeProps$1, SlideProps as SlideProps$1, SlideFadeProps as SlideFadeProps$1, CollapseProps as CollapseProps$1, TabListProps, TabProps, LinkProps, GridProps, GridItemProps, EditableProps as EditableProps$1 } from '@chakra-ui/react';
2
- export { AbsoluteCenter, AccordionButtonProps, AccordionIcon, AccordionIconProps, AccordionItemProps, AccordionPanelProps, AccordionProps, AlertDescription, AlertDialog, AlertDialogBody, AlertDialogCloseButton, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertIcon, AlertTitle, AspectRatioProps, BadgeProps, Box, BoxProps, BreadcrumbItem as Breadcrumb, BreadcrumbLink, BreadcrumbSeparator, Breadcrumb as Breadcrumbs, ButtonGroup, Card, CardBody, CardFooter, CardHeader, Center, Modal as ChakraModal, CheckboxGroup, Circle, CircularProgress, CircularProgressLabel, CloseButton, Code, Container, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, DrawerHeader, DrawerOverlay, Editable, EditableInput, EditablePreview, Flex, FormControl, FormErrorMessage, FormHelperText, Grid, GridItem, HStack, Heading, Highlight, Image, Input, InputAddon, InputGroup, InputLeftAddon, InputLeftElement, InputRightAddon, InputRightElement, Kbd, Link, LinkOverlay, List, ListIcon, ListItem, Menu, MenuButton, MenuCommand, MenuDivider, MenuGroup, MenuIcon, MenuItem, MenuItemOption, MenuList, MenuOptionGroup, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, NumberDecrementStepper, NumberIncrementStepper, OrderedList, PinInputField, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, Portal, RangeSlider, RangeSliderFilledTrack, RangeSliderMark, RangeSliderThumb, RangeSliderTrack, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, Slider, SliderFilledTrack, SliderMark, SliderThumb, SliderTrack, Spacer, Stack, StackDivider, Stat, StatArrow, StatGroup, StatHelpText, StatLabel, StatNumber, TabIndicator as StepIndicator, TabPanels as StepPanels, Tab, TabIndicator, TabList, TabPanels, Table, TableCaption, TableContainer, TagCloseButton, TagLabel, TagLeftIcon, TagRightIcon, Tbody, Td, Text, Tfoot, Th, Thead, Tooltip, Tr, UnorderedList, VStack, VisuallyHidden, VisuallyHiddenInput, Wrap, WrapItem, useBoolean, useBreakpoint, useBreakpointValue, useClipboard, useControllableProp, useControllableState, useDisclosure, useEditable, useEditableControls, useEditableState, useInterval, useMediaQuery, useMergeRefs, useNumberInput, useOutsideClick, usePrefersReducedMotion, useRadio, useRadioGroup, useTab, useTabs, useTheme, useToken } from '@chakra-ui/react';
2
+ export { AbsoluteCenter, AccordionButtonProps, AccordionIcon, AccordionIconProps, AccordionItemProps, AccordionPanelProps, AccordionProps, AlertDescription, AlertDialog, AlertDialogBody, AlertDialogCloseButton, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertIcon, AlertTitle, AspectRatioProps, BadgeProps, Box, BoxProps, BreadcrumbItem as Breadcrumb, BreadcrumbLink, BreadcrumbSeparator, Breadcrumb as Breadcrumbs, ButtonGroup, Card, CardBody, CardFooter, CardHeader, Center, Modal as ChakraModal, CheckboxGroup, Circle, CircularProgress, CircularProgressLabel, CloseButton, Code, Container, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, DrawerHeader, DrawerOverlay, Editable, EditableInput, EditablePreview, Flex, FormControl, FormErrorMessage, FormHelperText, Grid, GridItem, HStack, Heading, Hide, Highlight, Image, Input, InputAddon, InputGroup, InputLeftAddon, InputLeftElement, InputRightAddon, InputRightElement, Kbd, Link, LinkOverlay, List, ListIcon, ListItem, Menu, MenuButton, MenuCommand, MenuDivider, MenuGroup, MenuIcon, MenuItem, MenuItemOption, MenuList, MenuOptionGroup, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, NumberDecrementStepper, NumberIncrementStepper, OrderedList, PinInputField, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, Portal, RangeSlider, RangeSliderFilledTrack, RangeSliderMark, RangeSliderThumb, RangeSliderTrack, Show, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, Slider, SliderFilledTrack, SliderMark, SliderThumb, SliderTrack, Spacer, Stack, StackDivider, Stat, StatArrow, StatGroup, StatHelpText, StatLabel, StatNumber, TabIndicator as StepIndicator, TabPanels as StepPanels, Tab, TabIndicator, TabList, TabPanels, Table, TableCaption, TableContainer, TagCloseButton, TagLabel, TagLeftIcon, TagRightIcon, Tbody, Td, Text, Tfoot, Th, Thead, Tooltip, Tr, UnorderedList, VStack, VisuallyHidden, VisuallyHiddenInput, Wrap, WrapItem, useBoolean, useBreakpoint, useBreakpointValue, useClipboard, useControllableProp, useControllableState, useDisclosure, useEditable, useEditableControls, useEditableState, useInterval, useMediaQuery, useMergeRefs, useNumberInput, useOutsideClick, usePrefersReducedMotion, useRadio, useRadioGroup, useTab, useTabs, useTheme, useToken } from '@chakra-ui/react';
3
3
  import * as React$1 from 'react';
4
4
  import React__default, { ChangeEvent, ComponentType, InputHTMLAttributes, ReactNode, ReactElement } from 'react';
5
5
  import { RegisterOptions, FieldValues, UseFormReturn as UseFormReturn$1, SetValueConfig, ControllerRenderProps, UseFormProps, FieldError, Merge, FieldErrorsImpl } from 'react-hook-form';
@@ -13,11 +13,11 @@ import { Props, GroupBase, ActionMeta, ChakraStylesConfig, SelectInstance, MenuL
13
13
  export { AsyncCreatableSelect, AsyncSelect, Select as ChakraReactSelect, CreatableSelect } from 'chakra-react-select';
14
14
  import { DndContextProps, UseDroppableArguments, UseDraggableArguments, UniqueIdentifier, CollisionDetection, SensorDescriptor, SensorOptions } from '@dnd-kit/core';
15
15
  export * from '@dnd-kit/core';
16
- export { useInterval as dndUseInterval } from '@dnd-kit/core';
17
16
  import { UseSortableArguments, SortingStrategy, SortableContextProps } from '@dnd-kit/sortable';
18
17
  export * from '@dnd-kit/sortable';
19
18
  import { SyntheticListenerMap } from '@dnd-kit/core/dist/hooks/utilities';
20
19
  export * from '@dnd-kit/utilities';
20
+ export { useInterval as dndUseInterval } from '@dnd-kit/utilities';
21
21
  export * from '@dnd-kit/modifiers';
22
22
  import { VariableSizeListProps, VariableSizeList, VariableSizeGridProps, VariableSizeGrid } from 'react-window';
23
23
  import * as _chakra_ui_system_dist_system_types from '@chakra-ui/system/dist/system.types';
@@ -654,6 +654,7 @@ interface DateRangePickerProps extends Omit<AriaDateRangePickerProps<DateValue>,
654
654
  minValue?: string | undefined;
655
655
  maxValue?: string | undefined;
656
656
  fiscalStartMonth?: number;
657
+ fiscalStartDay?: number;
657
658
  mode?: DatePickerMode;
658
659
  }
659
660
  interface DatePickerFieldProps extends Omit<InputProps, 'onChange'>, InputFieldProps {
@@ -668,6 +669,7 @@ interface DatePickerFieldProps extends Omit<InputProps, 'onChange'>, InputFieldP
668
669
  onChange?: (date: DateValue) => void;
669
670
  isClearable?: boolean;
670
671
  fiscalStartMonth?: number;
672
+ fiscalStartDay?: number;
671
673
  }
672
674
  interface DateRangePickerFieldProps extends Omit<DatePickerFieldProps, 'onChange'> {
673
675
  onChange?: (date: null | DateRange) => void;
@@ -752,17 +754,19 @@ declare const DatePicker: (props: DatePickerProps) => JSX.Element;
752
754
  * ?)
753
755
  *
754
756
  * @example (Example)
755
- * ### Another example
757
+ * ## Sophisticated example
758
+ * The `DateRangePickerField` can have **fiscalStartMonth** and **fiscalStartDay** as a `number`
756
759
  * (?
757
760
  * <Form initialValues={{date: null}}>
758
761
  * <DateRangePickerField
759
762
  * name="date"
760
- * mode="simple"
763
+ * mode="advanced"
761
764
  * variant="filled"
762
- * fiscalStarMonth={3}
765
+ * fiscalStartMonth={3}
766
+ * fiscalStartDay={5}
763
767
  * dateFormat="mm|dd-yyyy"
764
768
  * minValue="2023-01-01"
765
- * maxValue="2024-01-01"
769
+ * maxValue="2028-01-01"
766
770
  * />
767
771
  * </Form>
768
772
  * ?)
@@ -2464,6 +2468,17 @@ type SelectFieldProps<T> = Omit<SelectProps<T>, 'onChange'> & InputFieldProps &
2464
2468
  * <Select
2465
2469
  * options={[{ label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' }]}
2466
2470
  * onChange={(value, action) => console.log('Selected:', value)}
2471
+ * isClearable={ true }
2472
+ * />
2473
+ * ?)
2474
+ *
2475
+ * @example (Example)
2476
+ * ## Clearable Select
2477
+ * (?
2478
+ * <Select
2479
+ * options={[{ label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' }]}
2480
+ * onChange={(value, action) => console.log('Selected:', value)}
2481
+ * isClearable={ true }
2467
2482
  * />
2468
2483
  * ?)
2469
2484
  *
@@ -1,5 +1,5 @@
1
1
  import { Accordion as Accordion$1, AccordionButton as AccordionButton$1, AccordionPanel as AccordionPanel$1, AccordionItem as AccordionItem$1, useMultiStyleConfig, chakra, Alert as Alert$2, AspectRatio as AspectRatio$1, forwardRef, useStyleConfig, Icon as Icon$2, Box, Heading, Text, FormLabel as FormLabel$1, VisuallyHidden, HStack, Badge as Badge$1, Button as Button$2, Checkbox as Checkbox$2, useInterval, FormControl, Stack, FormErrorMessage, Flex, IconButton as IconButton$1, useDisclosure, useBoolean, useToken as useToken$1, Popover, PopoverTrigger, PopoverContent, PopoverHeader, PopoverBody, SimpleGrid, SlideFade as SlideFade$1, Table, Thead, Tbody, Tr, Select as Select$2, PopoverAnchor, InputGroup, InputRightElement, Link as Link$1, Fade as Fade$1, ScaleFade as ScaleFade$1, Slide as Slide$1, Collapse as Collapse$1, Portal, CloseButton as CloseButton$1, Radio as Radio$2, RadioGroup as RadioGroup$1, Center, Tag as Tag$2, TagLabel, TagRightIcon, useEditableControls, useEditableState, Editable, InputLeftElement, Input as Input$1, EditablePreview, EditableInput, Modal as Modal$2, ModalOverlay, ModalContent, ModalCloseButton, ModalHeader, ModalBody, Slider, SliderTrack, SliderFilledTrack, SliderThumb, ModalFooter, VStack, Progress, Spinner as Spinner$2, Image as Image$1, keyframes, extendTheme, ChakraProvider, NumberInputStepper as NumberInputStepper$1, Divider, NumberIncrementStepper, NumberDecrementStepper, NumberInput as NumberInput$2, NumberInputField as NumberInputField$1, PinInput as PinInput$2, Switch as Switch$2, TabPanel as TabPanel$1, Tabs as Tabs$2, Textarea as Textarea$2, useToast as useToast$1, Circle, TagLeftIcon, AlertTitle, AlertDescription, Tab, TabList, useClipboard, Tooltip as Tooltip$1, Grid, GridItem } from '@chakra-ui/react';
2
- export { AbsoluteCenter, AccordionIcon, AlertDescription, AlertDialog, AlertDialogBody, AlertDialogCloseButton, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertIcon, AlertTitle, Box, BreadcrumbItem as Breadcrumb, BreadcrumbLink, BreadcrumbSeparator, Breadcrumb as Breadcrumbs, ButtonGroup, Card, CardBody, CardFooter, CardHeader, Center, Modal as ChakraModal, CheckboxGroup, Circle, CircularProgress, CircularProgressLabel, CloseButton, Code, Container, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, DrawerHeader, DrawerOverlay, Editable, EditableInput, EditablePreview, Flex, FormControl, FormErrorMessage, FormHelperText, Grid, GridItem, HStack, Heading, Highlight, Image, Input, InputAddon, InputGroup, InputLeftAddon, InputLeftElement, InputRightAddon, InputRightElement, Kbd, Link, LinkOverlay, List, ListIcon, ListItem, Menu, MenuButton, MenuCommand, MenuDivider, MenuGroup, MenuIcon, MenuItem, MenuItemOption, MenuList, MenuOptionGroup, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, NumberDecrementStepper, NumberIncrementStepper, OrderedList, PinInputField, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, Portal, RangeSlider, RangeSliderFilledTrack, RangeSliderMark, RangeSliderThumb, RangeSliderTrack, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, Slider, SliderFilledTrack, SliderMark, SliderThumb, SliderTrack, Spacer, Stack, StackDivider, Stat, StatArrow, StatGroup, StatHelpText, StatLabel, StatNumber, TabIndicator as StepIndicator, TabPanels as StepPanels, Tab, TabIndicator, TabList, TabPanels, Table, TableCaption, TableContainer, TagCloseButton, TagLabel, TagLeftIcon, TagRightIcon, Tbody, Td, Text, Tfoot, Th, Thead, Tooltip, Tr, UnorderedList, VStack, VisuallyHidden, VisuallyHiddenInput, Wrap, WrapItem, useBoolean, useBreakpoint, useBreakpointValue, useClipboard, useControllableProp, useControllableState, useDisclosure, useEditable, useEditableControls, useEditableState, useInterval, useMediaQuery, useMergeRefs, useNumberInput, useOutsideClick, usePrefersReducedMotion, useRadio, useRadioGroup, useTab, useTabs, useTheme, useToken } from '@chakra-ui/react';
2
+ export { AbsoluteCenter, AccordionIcon, AlertDescription, AlertDialog, AlertDialogBody, AlertDialogCloseButton, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertIcon, AlertTitle, Box, BreadcrumbItem as Breadcrumb, BreadcrumbLink, BreadcrumbSeparator, Breadcrumb as Breadcrumbs, ButtonGroup, Card, CardBody, CardFooter, CardHeader, Center, Modal as ChakraModal, CheckboxGroup, Circle, CircularProgress, CircularProgressLabel, CloseButton, Code, Container, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, DrawerHeader, DrawerOverlay, Editable, EditableInput, EditablePreview, Flex, FormControl, FormErrorMessage, FormHelperText, Grid, GridItem, HStack, Heading, Hide, Highlight, Image, Input, InputAddon, InputGroup, InputLeftAddon, InputLeftElement, InputRightAddon, InputRightElement, Kbd, Link, LinkOverlay, List, ListIcon, ListItem, Menu, MenuButton, MenuCommand, MenuDivider, MenuGroup, MenuIcon, MenuItem, MenuItemOption, MenuList, MenuOptionGroup, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, NumberDecrementStepper, NumberIncrementStepper, OrderedList, PinInputField, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, Portal, RangeSlider, RangeSliderFilledTrack, RangeSliderMark, RangeSliderThumb, RangeSliderTrack, Show, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, Slider, SliderFilledTrack, SliderMark, SliderThumb, SliderTrack, Spacer, Stack, StackDivider, Stat, StatArrow, StatGroup, StatHelpText, StatLabel, StatNumber, TabIndicator as StepIndicator, TabPanels as StepPanels, Tab, TabIndicator, TabList, TabPanels, Table, TableCaption, TableContainer, TagCloseButton, TagLabel, TagLeftIcon, TagRightIcon, Tbody, Td, Text, Tfoot, Th, Thead, Tooltip, Tr, UnorderedList, VStack, VisuallyHidden, VisuallyHiddenInput, Wrap, WrapItem, useBoolean, useBreakpoint, useBreakpointValue, useClipboard, useControllableProp, useControllableState, useDisclosure, useEditable, useEditableControls, useEditableState, useInterval, useMediaQuery, useMergeRefs, useNumberInput, useOutsideClick, usePrefersReducedMotion, useRadio, useRadioGroup, useTab, useTabs, useTheme, useToken } from '@chakra-ui/react';
3
3
  import React, { isValidElement, cloneElement, Children, createContext, useContext, useState, useRef, useEffect, forwardRef as forwardRef$1, useImperativeHandle, memo, useMemo, useCallback } from 'react';
4
4
  import { UserSquareDuo, BusinessContactDuo, CheckDuo, ChevronUpDuo, ChevronDownDuo, ColorsDuo, CheckSolid, CalendarDuo, ChevronLeftSolid, ChevronRightSolid, XCloseSolid, ChevronUpSolid, ChevronDownSolid, ArrowCircleLeftDuo, ArrowCircleRightDuo, ChevronSelectorVerticalSolid, SearchDuo, DotsMatrixSolid, DragDuo, EditDuo, ZoomInDuo, Image03Solid, UploadCloudSolid, FileBlankDuo, EditBoxDuo, DownloadDuo, TrashFullDuo, Image03Duo, CheckCircleSolid, AlertTriangleSolid, AlertCircleSolid, BellSolid, StatusWorkingSolid, HourglassSolid, CDeleteSolid, CopyDuo } from '@northlight/icons';
5
5
  import { useToken, useMultiStyleConfig as useMultiStyleConfig$1, chakra as chakra$1 } from '@chakra-ui/system';
@@ -27,9 +27,9 @@ import { chakraComponents, AsyncSelect, Select as Select$3 } from 'chakra-react-
27
27
  export { AsyncCreatableSelect, AsyncSelect, Select as ChakraReactSelect, CreatableSelect } from 'chakra-react-select';
28
28
  import { DndContext, useDraggable, useDroppable, useSensors, useSensor, PointerSensor, KeyboardSensor, rectIntersection, DragOverlay } from '@dnd-kit/core';
29
29
  export * from '@dnd-kit/core';
30
- export { useInterval as dndUseInterval } from '@dnd-kit/core';
31
30
  import { CSS } from '@dnd-kit/utilities';
32
31
  export * from '@dnd-kit/utilities';
32
+ export { useInterval as dndUseInterval } from '@dnd-kit/utilities';
33
33
  import { SortableContext, useSortable, sortableKeyboardCoordinates, arrayMove, rectSortingStrategy } from '@dnd-kit/sortable';
34
34
  export * from '@dnd-kit/sortable';
35
35
  export * from '@dnd-kit/modifiers';
@@ -1619,9 +1619,9 @@ const useSelectCallbacks = ({
1619
1619
  const handleChange = (val, event) => {
1620
1620
  var _a;
1621
1621
  onChange(val, event);
1622
- if (!isMulti && !isNil(value)) {
1622
+ if (!isMulti && !isNil(val)) {
1623
1623
  onAdd(val.value);
1624
- } else if (val.length > items.current.length) {
1624
+ } else if (!isNil(val) && val.length > items.current.length) {
1625
1625
  onAdd((_a = last(val)) == null ? void 0 : _a.value);
1626
1626
  } else {
1627
1627
  const removedItems = map(
@@ -3831,8 +3831,16 @@ const DateButton = ({
3831
3831
  children
3832
3832
  )));
3833
3833
 
3834
- const getQuickSelectOptions = (state, locale, fiscalStartMonth) => {
3834
+ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay) => {
3835
3835
  const thisDay = today(state.timeZone);
3836
+ const startOfMonthWithDays = (date, { months, days }) => {
3837
+ const start = date.add({ months }).set({ day: days });
3838
+ return start;
3839
+ };
3840
+ const endOfMonthWithDays = (date, { months, days }) => {
3841
+ const end = date.add({ months }).set({ day: days }).subtract({ days: 1 });
3842
+ return end;
3843
+ };
3836
3844
  const thisWeek = {
3837
3845
  value: {
3838
3846
  start: startOfWeek(thisDay, locale),
@@ -3905,66 +3913,78 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth) => {
3905
3913
  };
3906
3914
  const thisFiscalYear = {
3907
3915
  value: {
3908
- start: startOfMonth(
3909
- startOfYear(thisDay).add({ months: fiscalStartMonth })
3916
+ start: startOfMonthWithDays(
3917
+ startOfYear(thisDay),
3918
+ { months: fiscalStartMonth, days: fiscalStartDay }
3910
3919
  ),
3911
- end: endOfMonth(
3912
- startOfYear(thisDay).add({ months: fiscalStartMonth + 11 })
3920
+ end: endOfMonthWithDays(
3921
+ startOfYear(thisDay),
3922
+ { months: fiscalStartMonth + 11, days: fiscalStartDay }
3913
3923
  )
3914
3924
  },
3915
3925
  label: "This Fiscal Year"
3916
3926
  };
3917
3927
  const lastFiscalYear = {
3918
3928
  value: {
3919
- start: startOfMonth(
3920
- startOfYear(thisDay).add({ months: fiscalStartMonth }).subtract({ years: 1 })
3929
+ start: startOfMonthWithDays(
3930
+ startOfYear(thisDay).subtract({ years: 1 }),
3931
+ { months: fiscalStartMonth, days: fiscalStartDay - 1 }
3921
3932
  ),
3922
- end: endOfMonth(
3923
- startOfYear(thisDay).add({ months: fiscalStartMonth + 11 }).subtract({ years: 1 })
3933
+ end: endOfMonthWithDays(
3934
+ startOfYear(thisDay).subtract({ years: 1 }),
3935
+ { months: fiscalStartMonth + 11, days: fiscalStartDay }
3924
3936
  )
3925
3937
  },
3926
3938
  label: "Last Fiscal Year"
3927
3939
  };
3928
3940
  const F1 = {
3929
3941
  value: {
3930
- start: startOfMonth(
3931
- startOfYear(thisDay).add({ months: fiscalStartMonth })
3942
+ start: startOfMonthWithDays(
3943
+ startOfYear(thisDay),
3944
+ { months: fiscalStartMonth, days: fiscalStartDay }
3932
3945
  ),
3933
- end: endOfMonth(
3934
- startOfYear(thisDay).add({ months: fiscalStartMonth + 2 })
3946
+ end: endOfMonthWithDays(
3947
+ startOfYear(thisDay),
3948
+ { months: fiscalStartMonth + 2, days: fiscalStartDay }
3935
3949
  )
3936
3950
  },
3937
3951
  label: fiscalStartMonth === 0 ? "Q1" : "FQ1"
3938
3952
  };
3939
3953
  const F2 = {
3940
3954
  value: {
3941
- start: startOfMonth(
3942
- startOfYear(thisDay).add({ months: fiscalStartMonth + 3 })
3955
+ start: startOfMonthWithDays(
3956
+ startOfYear(thisDay),
3957
+ { months: fiscalStartMonth + 3, days: fiscalStartDay }
3943
3958
  ),
3944
- end: endOfMonth(
3945
- startOfYear(thisDay).add({ months: fiscalStartMonth + 5 })
3959
+ end: endOfMonthWithDays(
3960
+ startOfYear(thisDay),
3961
+ { months: fiscalStartMonth + 5, days: fiscalStartDay }
3946
3962
  )
3947
3963
  },
3948
3964
  label: fiscalStartMonth === 0 ? "Q2" : "FQ2"
3949
3965
  };
3950
3966
  const F3 = {
3951
3967
  value: {
3952
- start: startOfMonth(
3953
- startOfYear(thisDay).add({ months: fiscalStartMonth + 6 })
3968
+ start: startOfMonthWithDays(
3969
+ startOfYear(thisDay),
3970
+ { months: fiscalStartMonth + 6, days: fiscalStartDay }
3954
3971
  ),
3955
- end: endOfMonth(
3956
- startOfYear(thisDay).add({ months: fiscalStartMonth + 8 })
3972
+ end: endOfMonthWithDays(
3973
+ startOfYear(thisDay),
3974
+ { months: fiscalStartMonth + 8, days: fiscalStartDay }
3957
3975
  )
3958
3976
  },
3959
3977
  label: fiscalStartMonth === 0 ? "Q3" : "FQ3"
3960
3978
  };
3961
3979
  const F4 = {
3962
3980
  value: {
3963
- start: startOfMonth(
3964
- startOfYear(thisDay).add({ months: fiscalStartMonth + 9 })
3981
+ start: startOfMonthWithDays(
3982
+ startOfYear(thisDay),
3983
+ { months: fiscalStartMonth + 9, days: fiscalStartDay }
3965
3984
  ),
3966
- end: endOfMonth(
3967
- startOfYear(thisDay).add({ months: fiscalStartMonth + 11 })
3985
+ end: endOfMonthWithDays(
3986
+ startOfYear(thisDay),
3987
+ { months: fiscalStartMonth + 11, days: fiscalStartDay }
3968
3988
  )
3969
3989
  },
3970
3990
  label: fiscalStartMonth === 0 ? "Q4" : "FQ4"
@@ -3991,12 +4011,13 @@ const seperator = `1px solid ${palette.gray["100"]}`;
3991
4011
  const QuickSelect = ({
3992
4012
  state,
3993
4013
  fiscalStartMonth = 0,
4014
+ fiscalStartDay = 0,
3994
4015
  updateVisibleRange,
3995
4016
  locale = "",
3996
4017
  height = "xs"
3997
4018
  }) => {
3998
4019
  const { quickDates, fiscalQuarters } = useMemo(
3999
- () => getQuickSelectOptions(state, locale, fiscalStartMonth),
4020
+ () => getQuickSelectOptions(state, locale, fiscalStartMonth, fiscalStartDay),
4000
4021
  []
4001
4022
  );
4002
4023
  const updateDate = (newDate) => () => {
@@ -4100,14 +4121,15 @@ const RangeCalendar = (props) => {
4100
4121
  state,
4101
4122
  ref
4102
4123
  );
4103
- const { fiscalStartMonth, handleClose, resetDate, isClearable = true } = props;
4124
+ const { fiscalStartMonth, fiscalStartDay, handleClose, resetDate, isClearable = true } = props;
4104
4125
  return /* @__PURE__ */ React.createElement(Box, __spreadProps$g(__spreadValues$1a({}, calendarProps), { ref, __css: rangeCalendarContainer }), /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(Flex, { gap: 4 }, /* @__PURE__ */ React.createElement(
4105
4126
  QuickSelect,
4106
4127
  {
4107
4128
  state,
4108
4129
  updateVisibleRange: () => setUpdateRange(true),
4109
4130
  locale,
4110
- fiscalStartMonth
4131
+ fiscalStartMonth,
4132
+ fiscalStartDay
4111
4133
  }
4112
4134
  ), /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(HStack, { spacing: 2, alignSelf: "center" }, /* @__PURE__ */ React.createElement(MonthButton, __spreadValues$1a({}, prevButtonProps), /* @__PURE__ */ React.createElement(Icon$1, { as: ChevronLeftSolid, boxSize: 4 })), /* @__PURE__ */ React.createElement(Box, { w: "52" }, /* @__PURE__ */ React.createElement(Label$1, { textAlign: "center" }, months[state.visibleRange.start.month - 1], " -", " ", months[state.visibleRange.start.month], " ", state.visibleRange.end.year)), /* @__PURE__ */ React.createElement(MonthButton, __spreadValues$1a({}, nextButtonProps), /* @__PURE__ */ React.createElement(Icon$1, { as: ChevronRightSolid, boxSize: 4 }))), /* @__PURE__ */ React.createElement(HStack, { alignItems: "start", spacing: 4 }, /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(HStack, { alignSelf: "center", spacing: "0a" }, /* @__PURE__ */ React.createElement(MonthSelect, { state, offset: 0 }), /* @__PURE__ */ React.createElement(YearSelectRangeCalendar, { state, offset: 0 }), /* @__PURE__ */ React.createElement(Icon$1, { as: ChevronSelectorVerticalSolid, size: "xs", fontWeight: "bold" })), /* @__PURE__ */ React.createElement(RangeCalendarGrid, { state, locale }), /* @__PURE__ */ React.createElement(AdjustRange, { state, adjust: "start" })), /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(HStack, { alignSelf: "center", spacing: "0a" }, /* @__PURE__ */ React.createElement(MonthSelect, { state, offset: 1 }), /* @__PURE__ */ React.createElement(YearSelectRangeCalendar, { state, offset: 1 }), /* @__PURE__ */ React.createElement(Icon$1, { as: ChevronSelectorVerticalSolid, size: "xs", fontWeight: "bold" })), /* @__PURE__ */ React.createElement(
4113
4135
  RangeCalendarGrid,
@@ -4152,7 +4174,7 @@ const SimpleRangeCalendar = (props) => {
4152
4174
  state,
4153
4175
  ref
4154
4176
  );
4155
- const { fiscalStartMonth, handleClose, resetDate, isClearable = true } = props;
4177
+ const { fiscalStartMonth, fiscalStartDay, handleClose, resetDate, isClearable = true } = props;
4156
4178
  return /* @__PURE__ */ React.createElement(Box, __spreadProps$f(__spreadValues$19({}, calendarProps), { ref, __css: rangeCalendarContainer }), /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(Flex, { gap: 4 }, /* @__PURE__ */ React.createElement(
4157
4179
  QuickSelect,
4158
4180
  {
@@ -4161,6 +4183,7 @@ const SimpleRangeCalendar = (props) => {
4161
4183
  },
4162
4184
  locale,
4163
4185
  fiscalStartMonth,
4186
+ fiscalStartDay,
4164
4187
  height: "72"
4165
4188
  }
4166
4189
  ), /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(HStack, { spacing: 2, alignSelf: "center" }, /* @__PURE__ */ React.createElement(MonthButton, __spreadValues$19({}, prevButtonProps), /* @__PURE__ */ React.createElement(Icon$1, { as: ChevronLeftSolid, boxSize: 4 })), /* @__PURE__ */ React.createElement(HStack, { w: "full", justify: "center" }, /* @__PURE__ */ React.createElement(MonthSelect, { state, offset: 0 }), /* @__PURE__ */ React.createElement(YearSelectRangeCalendar, { state, offset: 0 })), /* @__PURE__ */ React.createElement(MonthButton, __spreadValues$19({}, nextButtonProps), /* @__PURE__ */ React.createElement(Icon$1, { as: ChevronRightSolid, boxSize: 4 }))), /* @__PURE__ */ React.createElement(Stack, { h: "full", justify: "space-between" }, /* @__PURE__ */ React.createElement(RangeCalendarGrid, { state, locale }), /* @__PURE__ */ React.createElement(HStack, { alignSelf: "end", pt: "2" }, isClearable && /* @__PURE__ */ React.createElement(Button$1, { onClick: resetDate, variant: "ghost", size: "sm" }, "Clear"), /* @__PURE__ */ React.createElement(Button$1, { variant: "brand", onClick: handleClose, size: "sm" }, "Save")))))));
@@ -4200,6 +4223,7 @@ const DateRangePicker = (props) => {
4200
4223
  isInvalid = false,
4201
4224
  dateFormat,
4202
4225
  fiscalStartMonth,
4226
+ fiscalStartDay,
4203
4227
  mode = "advanced",
4204
4228
  variant = "outline",
4205
4229
  onChange: onChangeCallback = identity,
@@ -4293,6 +4317,7 @@ const DateRangePicker = (props) => {
4293
4317
  resetDate,
4294
4318
  handleClose,
4295
4319
  fiscalStartMonth: fiscalStartMonth || 0,
4320
+ fiscalStartDay: fiscalStartDay || 0,
4296
4321
  isClearable
4297
4322
  })
4298
4323
  ), mode === "advanced" && /* @__PURE__ */ React.createElement(
@@ -4301,6 +4326,7 @@ const DateRangePicker = (props) => {
4301
4326
  resetDate,
4302
4327
  handleClose,
4303
4328
  fiscalStartMonth: fiscalStartMonth || 0,
4329
+ fiscalStartDay: fiscalStartDay || 0,
4304
4330
  isClearable
4305
4331
  })
4306
4332
  )))