@ringcentral/spring-ui 1.7.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/Accordion.js +64 -0
- package/AccordionHeader.js +33 -0
- package/Alert.js +28 -0
- package/Animation.js +46 -0
- package/Announcement.js +48 -0
- package/Autocomplete.js +1767 -0
- package/Avatar.js +105 -0
- package/AvatarGroup.js +9 -0
- package/Backdrop.js +9 -0
- package/Badge.js +15 -0
- package/Block.js +20 -0
- package/BlockHeader.js +18 -0
- package/BottomNavigation.js +145 -0
- package/BottomNavigationItem.js +30 -0
- package/Button.js +24 -0
- package/CallButton.js +39 -0
- package/Checkbox.js +55 -0
- package/Chip.js +26 -0
- package/CircularProgressIndicator.js +10 -0
- package/ClickAwayListener.js +1 -0
- package/ComponentsProps.js +1 -0
- package/DatePicker.js +485 -0
- package/DateUtilsContext.js +56 -0
- package/Dialer.js +587 -0
- package/Dialog.js +62 -0
- package/Divider.js +9 -0
- package/DragHandle.js +8 -0
- package/Drawer.js +19 -0
- package/Dropdown.js +132 -0
- package/EmptyState.js +17 -0
- package/FabButton.js +32 -0
- package/FocusTrap.js +48 -0
- package/FormField.js +10 -0
- package/FormLabel.js +9 -0
- package/Icon.js +9 -0
- package/IconButton.js +26 -0
- package/IconButtonGroup.js +18 -0
- package/InlineEditable.js +98 -0
- package/LICENSE +22 -0
- package/LinearProgressIndicator.js +44 -0
- package/Link.js +18 -0
- package/List.js +11 -0
- package/ListItem.js +22 -0
- package/ListItemText.js +18 -0
- package/ListNavigation.js +57 -0
- package/Menu.js +23 -0
- package/MenuActions.js +21 -0
- package/MenuDivider.js +10 -0
- package/MenuFooter.js +18 -0
- package/MenuHeader.js +18 -0
- package/MenuItem.js +32 -0
- package/MenuItemText.js +9 -0
- package/MenuList.js +33 -0
- package/Modal.js +16 -0
- package/NestedMenuContext.js +23 -0
- package/Option.js +46 -0
- package/Overlap.js +9 -0
- package/PageHeader.js +56 -0
- package/PickerTextField.js +33 -0
- package/Popover.js +21 -0
- package/Popper.js +127 -0
- package/PopperPaper.js +10 -0
- package/Portal.js +1 -0
- package/README.md +76 -0
- package/Radio.js +34 -0
- package/RadioGroup.js +29 -0
- package/Rating.js +235 -0
- package/Select.js +40 -0
- package/SingleFilter.js +130 -0
- package/Skeleton.js +32 -0
- package/Slider.js +110 -0
- package/Snackbar.js +118 -0
- package/SortableList.js +17 -0
- package/SortableListDndContext.js +49 -0
- package/SortableListItem.js +69 -0
- package/SortableVirtualizedList.js +36 -0
- package/SplitButton.js +173 -0
- package/Squircle.js +9 -0
- package/StatusIndicator.js +11 -0
- package/Step.js +65 -0
- package/StepButton.js +41 -0
- package/StepConnector.js +10 -0
- package/StepContent.js +53 -0
- package/StepIcon.js +11 -0
- package/StepLabel.js +14 -0
- package/Stepper.js +37 -0
- package/SubMenu.js +142 -0
- package/SwipeableDrawer.js +742 -0
- package/Switch.js +43 -0
- package/Tab.js +103 -0
- package/TabContext.js +34 -0
- package/TabPanel.js +26 -0
- package/Table.js +24 -0
- package/TableBody.js +20 -0
- package/TableCell.js +86 -0
- package/TableContainer.js +16 -0
- package/TableFooter.js +16 -0
- package/TableHead.js +24 -0
- package/TablePagination.js +122 -0
- package/TableRow.js +37 -0
- package/Tabs.js +827 -0
- package/Tag.js +28 -0
- package/Text.js +61 -0
- package/TextField.js +29 -0
- package/Textarea.js +67 -0
- package/TimePicker.js +600 -0
- package/Tooltip.js +23 -0
- package/Tray.js +13 -0
- package/TrayMenu.js +60 -0
- package/VirtualizedList.js +291 -0
- package/VirtualizedMenu.js +28 -0
- package/VisuallyHidden.js +8 -0
- package/chunks/AccordionContext.js +6 -0
- package/chunks/Alert.js +47 -0
- package/chunks/AvatarGroup.js +22 -0
- package/chunks/Backdrop.js +18 -0
- package/chunks/Badge.js +32 -0
- package/chunks/BottomNavigationItem.js +37 -0
- package/chunks/Button.js +89 -0
- package/chunks/Chip.js +78 -0
- package/chunks/CircularProgressIndicator.js +62 -0
- package/chunks/Divider.js +19 -0
- package/chunks/DragHandle.js +11 -0
- package/chunks/Drawer.js +61 -0
- package/chunks/ExpandCollapseCaret.js +24 -0
- package/chunks/FormLabel.js +27 -0
- package/chunks/Icon.js +25 -0
- package/chunks/IconButtonLabel.js +69 -0
- package/chunks/List.js +22 -0
- package/chunks/ListItem.js +86 -0
- package/chunks/Menu.js +41 -0
- package/chunks/MenuDivider.js +15 -0
- package/chunks/MenuItemText.js +16 -0
- package/chunks/MenuList.js +49 -0
- package/chunks/Modal.js +88 -0
- package/chunks/Overlap.js +25 -0
- package/chunks/PickerTextField.js +75 -0
- package/chunks/Popover.js +58 -0
- package/chunks/PopperPaper.js +15 -0
- package/chunks/RadioGroup.context.js +19 -0
- package/chunks/Select.js +257 -0
- package/chunks/ShowHideEye.js +56 -0
- package/chunks/SlideIn.js +19 -0
- package/chunks/SortableArrow.js +73 -0
- package/chunks/Squircle.js +38 -0
- package/chunks/StatusIndicator.js +19 -0
- package/chunks/StepConnector.js +21 -0
- package/chunks/StepIcon.js +45 -0
- package/chunks/StepLabel.js +29 -0
- package/chunks/StepperContext.js +16 -0
- package/chunks/TableContext.js +6 -0
- package/chunks/Tablelvl2Context.js +6 -0
- package/chunks/TabsContext.js +6 -0
- package/chunks/TextField.js +111 -0
- package/chunks/Tooltip.js +253 -0
- package/chunks/VirtualizedMenu.js +216 -0
- package/chunks/VisuallyHidden.js +12 -0
- package/chunks/getFade.js +23 -0
- package/chunks/getGrow.js +70 -0
- package/chunks/getSlideIn.js +30 -0
- package/chunks/useFocusTrapStack.js +44 -0
- package/chunks/useHelperTextId.js +46 -0
- package/chunks/useListNavigation.js +211 -0
- package/chunks/useMenuItemSelect.js +252 -0
- package/chunks/useMotionSafeTransition.js +13 -0
- package/chunks/useNestedMenuItem.js +16 -0
- package/chunks/useNestedParentMenu.js +54 -0
- package/chunks/usePrefersReducedMotion.js +42 -0
- package/chunks/useTooltipForceHide.js +31 -0
- package/chunks/useTrayNavigate.js +151 -0
- package/chunks/withTooltip.js +15 -0
- package/index.css +10891 -0
- package/index.d.ts +1 -0
- package/index.js +191 -0
- package/package.json +41 -0
- package/src/Accordion/Accordion.classes.d.ts +7 -0
- package/src/Accordion/Accordion.d.ts +5 -0
- package/src/Accordion/Accordion.type.d.ts +31 -0
- package/src/Accordion/AccordionContext.d.ts +9 -0
- package/src/Accordion/index.d.ts +4 -0
- package/src/AccordionHeader/AccordionHeader.classes.d.ts +7 -0
- package/src/AccordionHeader/AccordionHeader.d.ts +5 -0
- package/src/AccordionHeader/AccordionHeader.type.d.ts +25 -0
- package/src/AccordionHeader/index.d.ts +3 -0
- package/src/Alert/Alert.classes.d.ts +8 -0
- package/src/Alert/Alert.d.ts +7 -0
- package/src/Alert/Alert.type.d.ts +56 -0
- package/src/Alert/AlertTitle.classes.d.ts +7 -0
- package/src/Alert/index.d.ts +4 -0
- package/src/Animation/components/ExpandCollapseCaret/ExpandCollapseCaret.classes.d.ts +7 -0
- package/src/Animation/components/ExpandCollapseCaret/ExpandCollapseCaret.d.ts +17 -0
- package/src/Animation/components/ExpandCollapseCaret/index.d.ts +2 -0
- package/src/Animation/components/Fade/Fade.d.ts +5 -0
- package/src/Animation/components/Fade/getFade.d.ts +4 -0
- package/src/Animation/components/Fade/index.d.ts +2 -0
- package/src/Animation/components/Grow/Grow.d.ts +5 -0
- package/src/Animation/components/Grow/getGrow.d.ts +19 -0
- package/src/Animation/components/Grow/index.d.ts +2 -0
- package/src/Animation/components/ShowHideEye/ShowHideEye.classes.d.ts +7 -0
- package/src/Animation/components/ShowHideEye/ShowHideEye.d.ts +14 -0
- package/src/Animation/components/ShowHideEye/index.d.ts +2 -0
- package/src/Animation/components/SlideIn/SlideIn.d.ts +5 -0
- package/src/Animation/components/SlideIn/getSlideIn.d.ts +9 -0
- package/src/Animation/components/SlideIn/index.d.ts +2 -0
- package/src/Animation/components/SortableArrow/SortableArrow.classes.d.ts +7 -0
- package/src/Animation/components/SortableArrow/SortableArrow.d.ts +9 -0
- package/src/Animation/components/SortableArrow/index.d.ts +2 -0
- package/src/Animation/components/index.d.ts +7 -0
- package/src/Animation/components/types.d.ts +9 -0
- package/src/Animation/hooks/__mocks__/MatchMedia.mock.d.ts +12 -0
- package/src/Animation/hooks/index.d.ts +2 -0
- package/src/Animation/hooks/useMotionSafeTransition/index.d.ts +1 -0
- package/src/Animation/hooks/useMotionSafeTransition/useMotionSafeTransition.d.ts +10 -0
- package/src/Animation/hooks/usePrefersReducedMotion/index.d.ts +1 -0
- package/src/Animation/hooks/usePrefersReducedMotion/usePrefersReducedMotion.d.ts +1 -0
- package/src/Animation/index.d.ts +2 -0
- package/src/Announcement/Announcement.classes.d.ts +8 -0
- package/src/Announcement/Announcement.d.ts +5 -0
- package/src/Announcement/Announcement.type.d.ts +4 -0
- package/src/Announcement/index.d.ts +3 -0
- package/src/Autocomplete/Autocomplete.classes.d.ts +14 -0
- package/src/Autocomplete/Autocomplete.d.ts +11 -0
- package/src/Autocomplete/Autocomplete.type.d.ts +141 -0
- package/src/Autocomplete/SuggestionList/SuggestionList.classes.d.ts +7 -0
- package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +144 -0
- package/src/Autocomplete/SuggestionList/SuggestionListItem.d.ts +28 -0
- package/src/Autocomplete/SuggestionList/index.d.ts +4 -0
- package/src/Autocomplete/SuggestionList/utils/SuggestionListItem.d.ts +33 -0
- package/src/Autocomplete/SuggestionList/utils/index.d.ts +5 -0
- package/src/Autocomplete/SuggestionList/utils/useDynamicHeight.d.ts +20 -0
- package/src/Autocomplete/SuggestionList/utils/useHighlightScroll.d.ts +33 -0
- package/src/Autocomplete/SuggestionList/utils/useSuggestionList.d.ts +101 -0
- package/src/Autocomplete/SuggestionList/utils/useSuggestionListGroup.d.ts +71 -0
- package/src/Autocomplete/index.d.ts +6 -0
- package/src/Autocomplete/useAutocomplete.d.ts +640 -0
- package/src/Autocomplete/useAutocompleteTag.d.ts +599 -0
- package/src/Avatar/Avatar.classes.d.ts +10 -0
- package/src/Avatar/Avatar.d.ts +4 -0
- package/src/Avatar/Avatar.type.d.ts +91 -0
- package/src/Avatar/index.d.ts +3 -0
- package/src/AvatarGroup/AvatarGroup.classes.d.ts +7 -0
- package/src/AvatarGroup/AvatarGroup.d.ts +6 -0
- package/src/AvatarGroup/AvatarGroup.type.d.ts +21 -0
- package/src/AvatarGroup/index.d.ts +3 -0
- package/src/Backdrop/Backdrop.classes.d.ts +7 -0
- package/src/Backdrop/Backdrop.d.ts +5 -0
- package/src/Backdrop/Backdrop.type.d.ts +9 -0
- package/src/Backdrop/index.d.ts +3 -0
- package/src/Badge/Badge.classes.d.ts +11 -0
- package/src/Badge/Badge.d.ts +8 -0
- package/src/Badge/Badge.type.d.ts +52 -0
- package/src/Badge/index.d.ts +3 -0
- package/src/Block/Block.classes.d.ts +8 -0
- package/src/Block/Block.d.ts +4 -0
- package/src/Block/Block.type.d.ts +44 -0
- package/src/Block/index.d.ts +3 -0
- package/src/BlockHeader/BlockHeader.classes.d.ts +7 -0
- package/src/BlockHeader/BlockHeader.d.ts +4 -0
- package/src/BlockHeader/BlockHeader.type.d.ts +19 -0
- package/src/BlockHeader/index.d.ts +3 -0
- package/src/BottomNavigation/BottomNavigation.classes.d.ts +7 -0
- package/src/BottomNavigation/BottomNavigation.d.ts +4 -0
- package/src/BottomNavigation/BottomNavigation.type.d.ts +62 -0
- package/src/BottomNavigation/BottomNavigationContext.d.ts +9 -0
- package/src/BottomNavigation/BottomNavigationGroup/BottomNavigationGroup.classes.d.ts +7 -0
- package/src/BottomNavigation/BottomNavigationGroup/BottomNavigationGroup.d.ts +5 -0
- package/src/BottomNavigation/BottomNavigationGroup/BottomNavigationGroup.type.d.ts +3 -0
- package/src/BottomNavigation/BottomNavigationGroup/index.d.ts +3 -0
- package/src/BottomNavigation/index.d.ts +5 -0
- package/src/BottomNavigationItem/BottomNavigationItem.classes.d.ts +7 -0
- package/src/BottomNavigationItem/BottomNavigationItem.d.ts +4 -0
- package/src/BottomNavigationItem/BottomNavigationItem.type.d.ts +63 -0
- package/src/BottomNavigationItem/index.d.ts +3 -0
- package/src/Button/Button.classes.d.ts +8 -0
- package/src/Button/Button.d.ts +6 -0
- package/src/Button/Button.type.d.ts +57 -0
- package/src/Button/index.d.ts +3 -0
- package/src/CallButton/CallButton.classes.d.ts +7 -0
- package/src/CallButton/CallButton.d.ts +4 -0
- package/src/CallButton/CallButton.type.d.ts +19 -0
- package/src/CallButton/index.d.ts +3 -0
- package/src/Checkbox/Checkbox.classes.d.ts +8 -0
- package/src/Checkbox/Checkbox.d.ts +13 -0
- package/src/Checkbox/Checkbox.type.d.ts +30 -0
- package/src/Checkbox/index.d.ts +3 -0
- package/src/Chip/Chip.classes.d.ts +7 -0
- package/src/Chip/Chip.d.ts +4 -0
- package/src/Chip/Chip.type.d.ts +65 -0
- package/src/Chip/index.d.ts +3 -0
- package/src/CircularProgressIndicator/CircularProgressIndicator.classes.d.ts +10 -0
- package/src/CircularProgressIndicator/CircularProgressIndicator.d.ts +5 -0
- package/src/CircularProgressIndicator/CircularProgressIndicator.type.d.ts +32 -0
- package/src/CircularProgressIndicator/index.d.ts +3 -0
- package/src/ClickAwayListener/index.d.ts +2 -0
- package/src/ComponentsProps.d.ts +207 -0
- package/src/DatePicker/Calendar.d.ts +41 -0
- package/src/DatePicker/DatePicker.classes.d.ts +7 -0
- package/src/DatePicker/DatePicker.context.d.ts +6 -0
- package/src/DatePicker/DatePicker.d.ts +6 -0
- package/src/DatePicker/DatePicker.type.d.ts +36 -0
- package/src/DatePicker/DatePickerHeader.d.ts +27 -0
- package/src/DatePicker/Day.d.ts +23 -0
- package/src/DatePicker/HearderAction.d.ts +3 -0
- package/src/DatePicker/SlideDirection.d.ts +1 -0
- package/src/DatePicker/Year.d.ts +21 -0
- package/src/DatePicker/Years.d.ts +21 -0
- package/src/DatePicker/index.d.ts +12 -0
- package/src/DatePicker/utils/DatePickerAriaLabelUtils.d.ts +16 -0
- package/src/DatePicker/utils/DatePickerUtils.d.ts +13 -0
- package/src/DatePicker/utils/findClosestEnabledDate.d.ts +13 -0
- package/src/DatePicker/utils/index.d.ts +3 -0
- package/src/DateUtilsContext/DateUtilsContext.d.ts +22 -0
- package/src/DateUtilsContext/index.d.ts +1 -0
- package/src/Dialer/DialDelete/DialDelete.d.ts +14 -0
- package/src/Dialer/DialDelete/index.d.ts +1 -0
- package/src/Dialer/DialPad/DialPad.classes.d.ts +7 -0
- package/src/Dialer/DialPad/DialPad.d.ts +143 -0
- package/src/Dialer/DialPad/assets/DialerPadSoundsMPEG.d.ts +15 -0
- package/src/Dialer/DialPad/assets/DialerPadSoundsOGG.d.ts +15 -0
- package/src/Dialer/DialPad/assets/index.d.ts +3 -0
- package/src/Dialer/DialPad/index.d.ts +4 -0
- package/src/Dialer/DialPad/utils/DialPadUtils.d.ts +16 -0
- package/src/Dialer/DialPad/utils/index.d.ts +4 -0
- package/src/Dialer/DialPad/utils/types.d.ts +11 -0
- package/src/Dialer/DialPad/utils/useDialKeyboard.d.ts +16 -0
- package/src/Dialer/DialPad/utils/useKeyAudio.d.ts +15 -0
- package/src/Dialer/DialPadButton/DialPadButton.classes.d.ts +7 -0
- package/src/Dialer/DialPadButton/DialPadButton.d.ts +27 -0
- package/src/Dialer/DialPadButton/index.d.ts +2 -0
- package/src/Dialer/DialTextField/DialTextField.d.ts +37 -0
- package/src/Dialer/DialTextField/index.d.ts +2 -0
- package/src/Dialer/DialTextField/utils/getDialPadValueOnlyRegex.d.ts +4 -0
- package/src/Dialer/DialTextField/utils/index.d.ts +2 -0
- package/src/Dialer/DialTextField/utils/useFixedEndSelection.d.ts +10 -0
- package/src/Dialer/Dialer.d.ts +5 -0
- package/src/Dialer/index.d.ts +6 -0
- package/src/Dialer/utils/DialerContext.d.ts +13 -0
- package/src/Dialer/utils/index.d.ts +1 -0
- package/src/Dialog/Dialog.classes.d.ts +29 -0
- package/src/Dialog/Dialog.d.ts +8 -0
- package/src/Dialog/Dialog.type.d.ts +26 -0
- package/src/Dialog/index.d.ts +3 -0
- package/src/Divider/Divider.classes.d.ts +10 -0
- package/src/Divider/Divider.d.ts +4 -0
- package/src/Divider/Divider.type.d.ts +35 -0
- package/src/Divider/index.d.ts +3 -0
- package/src/DragHandle/DragHandle.classes.d.ts +8 -0
- package/src/DragHandle/DragHandle.d.ts +4 -0
- package/src/DragHandle/DragHandle.type.d.ts +17 -0
- package/src/DragHandle/index.d.ts +3 -0
- package/src/Drawer/Drawer.classes.d.ts +10 -0
- package/src/Drawer/Drawer.d.ts +33 -0
- package/src/Drawer/Drawer.type.d.ts +107 -0
- package/src/Drawer/index.d.ts +3 -0
- package/src/Dropdown/Dropdown.classes.d.ts +7 -0
- package/src/Dropdown/Dropdown.d.ts +4 -0
- package/src/Dropdown/Dropdown.type.d.ts +96 -0
- package/src/Dropdown/index.d.ts +3 -0
- package/src/EmptyState/EmptyState.classes.d.ts +7 -0
- package/src/EmptyState/EmptyState.d.ts +5 -0
- package/src/EmptyState/EmptyState.type.d.ts +21 -0
- package/src/EmptyState/index.d.ts +3 -0
- package/src/FabButton/FabButton.classes.d.ts +7 -0
- package/src/FabButton/FabButton.d.ts +4 -0
- package/src/FabButton/FabButton.type.d.ts +22 -0
- package/src/FabButton/index.d.ts +3 -0
- package/src/FocusTrap/FocusTrap.d.ts +49 -0
- package/src/FocusTrap/index.d.ts +2 -0
- package/src/FocusTrap/useFocusTrapStack.d.ts +16 -0
- package/src/FormField/FormField.classes.d.ts +9 -0
- package/src/FormField/FormField.d.ts +5 -0
- package/src/FormField/FormField.type.d.ts +46 -0
- package/src/FormField/index.d.ts +4 -0
- package/src/FormField/useHelperTextId.d.ts +30 -0
- package/src/FormLabel/FormLabel.classes.d.ts +10 -0
- package/src/FormLabel/FormLabel.d.ts +5 -0
- package/src/FormLabel/FormLabel.type.d.ts +26 -0
- package/src/FormLabel/FormLabelContext.d.ts +8 -0
- package/src/FormLabel/index.d.ts +4 -0
- package/src/Icon/Icon.classes.d.ts +7 -0
- package/src/Icon/Icon.d.ts +5 -0
- package/src/Icon/Icon.type.d.ts +25 -0
- package/src/Icon/index.d.ts +3 -0
- package/src/IconButton/IconButton.classes.d.ts +8 -0
- package/src/IconButton/IconButton.d.ts +4 -0
- package/src/IconButton/IconButton.type.d.ts +58 -0
- package/src/IconButton/IconButtonLabel.classes.d.ts +7 -0
- package/src/IconButton/IconButtonLabel.d.ts +5 -0
- package/src/IconButton/IconButtonLabel.type.d.ts +12 -0
- package/src/IconButton/index.d.ts +6 -0
- package/src/IconButtonGroup/IconButtonGroup.classes.d.ts +7 -0
- package/src/IconButtonGroup/IconButtonGroup.d.ts +4 -0
- package/src/IconButtonGroup/IconButtonGroup.type.d.ts +22 -0
- package/src/IconButtonGroup/index.d.ts +3 -0
- package/src/InlineEditable/InlineEditable.classes.d.ts +9 -0
- package/src/InlineEditable/InlineEditable.d.ts +5 -0
- package/src/InlineEditable/InlineEditable.type.d.ts +116 -0
- package/src/InlineEditable/index.d.ts +3 -0
- package/src/LinearProgressIndicator/LinearProgressIndicator.classes.d.ts +9 -0
- package/src/LinearProgressIndicator/LinearProgressIndicator.d.ts +5 -0
- package/src/LinearProgressIndicator/LinearProgressIndicator.type.d.ts +46 -0
- package/src/LinearProgressIndicator/index.d.ts +3 -0
- package/src/Link/Link.classes.d.ts +8 -0
- package/src/Link/Link.d.ts +4 -0
- package/src/Link/Link.type.d.ts +22 -0
- package/src/Link/index.d.ts +3 -0
- package/src/List/List.classes.d.ts +7 -0
- package/src/List/List.d.ts +5 -0
- package/src/List/List.type.d.ts +4 -0
- package/src/List/index.d.ts +3 -0
- package/src/ListItem/HoverActions.d.ts +8 -0
- package/src/ListItem/ListItem.classes.d.ts +7 -0
- package/src/ListItem/ListItem.d.ts +5 -0
- package/src/ListItem/ListItem.type.d.ts +58 -0
- package/src/ListItem/index.d.ts +4 -0
- package/src/ListItemText/ListItemText.classes.d.ts +9 -0
- package/src/ListItemText/ListItemText.d.ts +5 -0
- package/src/ListItemText/ListItemText.type.d.ts +33 -0
- package/src/ListItemText/index.d.ts +3 -0
- package/src/ListNavigation/ListNavigationContext.d.ts +8 -0
- package/src/ListNavigation/index.d.ts +3 -0
- package/src/ListNavigation/useItemNavigation.d.ts +9 -0
- package/src/ListNavigation/useListNavigation.d.ts +49 -0
- package/src/Menu/Menu.classes.d.ts +7 -0
- package/src/Menu/Menu.d.ts +5 -0
- package/src/Menu/Menu.type.d.ts +19 -0
- package/src/Menu/MenuContext.d.ts +7 -0
- package/src/Menu/index.d.ts +4 -0
- package/src/MenuActions/MenuActions.classes.d.ts +13 -0
- package/src/MenuActions/MenuActions.d.ts +9 -0
- package/src/MenuActions/MenuActions.type.d.ts +3 -0
- package/src/MenuActions/index.d.ts +3 -0
- package/src/MenuDivider/MenuDivider.classes.d.ts +7 -0
- package/src/MenuDivider/MenuDivider.d.ts +5 -0
- package/src/MenuDivider/MenuDivider.type.d.ts +3 -0
- package/src/MenuDivider/index.d.ts +3 -0
- package/src/MenuFooter/MenuFooter.classes.d.ts +7 -0
- package/src/MenuFooter/MenuFooter.d.ts +5 -0
- package/src/MenuFooter/MenuFooter.type.d.ts +9 -0
- package/src/MenuFooter/index.d.ts +3 -0
- package/src/MenuHeader/MenuHeader.classes.d.ts +7 -0
- package/src/MenuHeader/MenuHeader.d.ts +5 -0
- package/src/MenuHeader/MenuHeader.type.d.ts +18 -0
- package/src/MenuHeader/index.d.ts +3 -0
- package/src/MenuItem/MenuItem.classes.d.ts +7 -0
- package/src/MenuItem/MenuItem.d.ts +5 -0
- package/src/MenuItem/MenuItem.type.d.ts +29 -0
- package/src/MenuItem/MenuItemSelectContext.d.ts +18 -0
- package/src/MenuItem/index.d.ts +7 -0
- package/src/MenuItem/useMenuItem.d.ts +16 -0
- package/src/MenuItem/useMenuItemSelect.d.ts +62 -0
- package/src/MenuItem/useVirtualizedMenuItem.d.ts +15 -0
- package/src/MenuItemText/MenuItemText.classes.d.ts +7 -0
- package/src/MenuItemText/MenuItemText.d.ts +5 -0
- package/src/MenuItemText/MenuItemText.type.d.ts +27 -0
- package/src/MenuItemText/index.d.ts +3 -0
- package/src/MenuList/MenuList.classes.d.ts +7 -0
- package/src/MenuList/MenuList.d.ts +4 -0
- package/src/MenuList/MenuList.type.d.ts +16 -0
- package/src/MenuList/MenuListContext.d.ts +12 -0
- package/src/MenuList/index.d.ts +4 -0
- package/src/Modal/InnerModal.d.ts +18 -0
- package/src/Modal/InnerModal.type.d.ts +23 -0
- package/src/Modal/Modal.classes.d.ts +7 -0
- package/src/Modal/Modal.d.ts +24 -0
- package/src/Modal/Modal.type.d.ts +19 -0
- package/src/Modal/ModalContext.d.ts +10 -0
- package/src/Modal/index.d.ts +6 -0
- package/src/NestedMenuContext/NestedMenuContext.d.ts +11 -0
- package/src/NestedMenuContext/index.d.ts +4 -0
- package/src/NestedMenuContext/useNestedChildMenu.d.ts +6 -0
- package/src/NestedMenuContext/useNestedMenuItem.d.ts +5 -0
- package/src/NestedMenuContext/useNestedParentMenu.d.ts +8 -0
- package/src/Option/Option.d.ts +4 -0
- package/src/Option/Option.type.d.ts +7 -0
- package/src/Option/index.d.ts +2 -0
- package/src/Overlap/Overlap.classes.d.ts +7 -0
- package/src/Overlap/Overlap.d.ts +4 -0
- package/src/Overlap/Overlap.type.d.ts +30 -0
- package/src/Overlap/index.d.ts +3 -0
- package/src/PageHeader/PageHeader.classes.d.ts +32 -0
- package/src/PageHeader/PageHeader.d.ts +9 -0
- package/src/PageHeader/PageHeader.type.d.ts +14 -0
- package/src/PageHeader/index.d.ts +3 -0
- package/src/PickerTextField/PickerTextField.classes.d.ts +7 -0
- package/src/PickerTextField/PickerTextField.d.ts +5 -0
- package/src/PickerTextField/PickerTextField.type.d.ts +30 -0
- package/src/PickerTextField/index.d.ts +3 -0
- package/src/Popover/Popover.classes.d.ts +7 -0
- package/src/Popover/Popover.d.ts +5 -0
- package/src/Popover/Popover.type.d.ts +50 -0
- package/src/Popover/index.d.ts +3 -0
- package/src/Popper/Popper.d.ts +4 -0
- package/src/Popper/Popper.type.d.ts +92 -0
- package/src/Popper/index.d.ts +2 -0
- package/src/PopperPaper/PopperPaper.classes.d.ts +7 -0
- package/src/PopperPaper/PopperPaper.d.ts +5 -0
- package/src/PopperPaper/PopperPaper.type.d.ts +8 -0
- package/src/PopperPaper/index.d.ts +3 -0
- package/src/Portal/Portal.d.ts +2 -0
- package/src/Portal/index.d.ts +1 -0
- package/src/Radio/Radio.classes.d.ts +7 -0
- package/src/Radio/Radio.d.ts +12 -0
- package/src/Radio/Radio.type.d.ts +16 -0
- package/src/Radio/index.d.ts +3 -0
- package/src/RadioGroup/RadioGroup.classes.d.ts +7 -0
- package/src/RadioGroup/RadioGroup.context.d.ts +15 -0
- package/src/RadioGroup/RadioGroup.d.ts +5 -0
- package/src/RadioGroup/RadioGroup.type.d.ts +14 -0
- package/src/RadioGroup/index.d.ts +4 -0
- package/src/Rating/Rating.classes.d.ts +7 -0
- package/src/Rating/Rating.d.ts +5 -0
- package/src/Rating/Rating.type.d.ts +106 -0
- package/src/Rating/RatingItem.d.ts +3 -0
- package/src/Rating/index.d.ts +5 -0
- package/src/Rating/utils.d.ts +5 -0
- package/src/Select/Select.classes.d.ts +11 -0
- package/src/Select/Select.d.ts +4 -0
- package/src/Select/Select.type.d.ts +118 -0
- package/src/Select/index.d.ts +4 -0
- package/src/Select/useSelect.d.ts +16 -0
- package/src/SingleFilter/FilterButton/FilterButton.classes.d.ts +7 -0
- package/src/SingleFilter/FilterButton/FilterButton.d.ts +5 -0
- package/src/SingleFilter/FilterButton/FilterButton.type.d.ts +27 -0
- package/src/SingleFilter/FilterButton/index.d.ts +3 -0
- package/src/SingleFilter/SingleFilter.classes.d.ts +7 -0
- package/src/SingleFilter/SingleFilter.d.ts +5 -0
- package/src/SingleFilter/SingleFilter.type.d.ts +44 -0
- package/src/SingleFilter/index.d.ts +4 -0
- package/src/Skeleton/Skeleton.classes.d.ts +7 -0
- package/src/Skeleton/Skeleton.d.ts +5 -0
- package/src/Skeleton/Skeleton.type.d.ts +6 -0
- package/src/Skeleton/SkeletonContainer/SkeletonContainer.classes.d.ts +7 -0
- package/src/Skeleton/SkeletonContainer/SkeletonContainer.d.ts +5 -0
- package/src/Skeleton/SkeletonContainer/SkeletonContainer.type.d.ts +11 -0
- package/src/Skeleton/SkeletonContainer/index.d.ts +3 -0
- package/src/Skeleton/index.d.ts +4 -0
- package/src/Slider/Slider.classes.d.ts +13 -0
- package/src/Slider/Slider.d.ts +10 -0
- package/src/Slider/Slider.type.d.ts +137 -0
- package/src/Slider/SliderThumb.d.ts +16 -0
- package/src/Slider/index.d.ts +3 -0
- package/src/Slider/utils.d.ts +1 -0
- package/src/Snackbar/Snackbar.classes.d.ts +7 -0
- package/src/Snackbar/Snackbar.d.ts +5 -0
- package/src/Snackbar/Snackbar.hook.d.ts +1 -0
- package/src/Snackbar/Snackbar.type.d.ts +27 -0
- package/src/Snackbar/SnackbarContent/SnackbarContent.classes.d.ts +8 -0
- package/src/Snackbar/SnackbarContent/SnackbarContent.d.ts +5 -0
- package/src/Snackbar/SnackbarContent/SnackbarContent.type.d.ts +4 -0
- package/src/Snackbar/SnackbarContent/index.d.ts +3 -0
- package/src/Snackbar/index.d.ts +5 -0
- package/src/SortableList/SortableList.d.ts +3 -0
- package/src/SortableList/SortableList.type.d.ts +20 -0
- package/src/SortableList/index.d.ts +2 -0
- package/src/SortableListDndContext/DndKeyboardBlocker.d.ts +2 -0
- package/src/SortableListDndContext/SortableListDndContext.d.ts +4 -0
- package/src/SortableListDndContext/SortableListDndContext.type.d.ts +5 -0
- package/src/SortableListDndContext/index.d.ts +5 -0
- package/src/SortableListDndContext/useSortableListDndContext.d.ts +2 -0
- package/src/SortableListDndContext/utils.d.ts +1 -0
- package/src/SortableListItem/SortableListItem.d.ts +4 -0
- package/src/SortableListItem/SortableListItem.type.d.ts +6 -0
- package/src/SortableListItem/SortableListItemOverlay.d.ts +4 -0
- package/src/SortableListItem/SortableListItemOverlay.type.d.ts +8 -0
- package/src/SortableListItem/index.d.ts +4 -0
- package/src/SortableVirtualizedList/SortableVirtualizedList.d.ts +3 -0
- package/src/SortableVirtualizedList/SortableVirtualizedList.type.d.ts +19 -0
- package/src/SortableVirtualizedList/index.d.ts +2 -0
- package/src/SplitButton/SplitButton.classes.d.ts +8 -0
- package/src/SplitButton/SplitButton.d.ts +5 -0
- package/src/SplitButton/SplitButton.type.d.ts +37 -0
- package/src/SplitButton/index.d.ts +3 -0
- package/src/Squircle/Squircle.d.ts +4 -0
- package/src/Squircle/Squircle.type.d.ts +19 -0
- package/src/Squircle/index.d.ts +3 -0
- package/src/Squircle/squircle.classes.d.ts +7 -0
- package/src/StatusIndicator/StatusIndicator.classes.d.ts +7 -0
- package/src/StatusIndicator/StatusIndicator.d.ts +8 -0
- package/src/StatusIndicator/StatusIndicator.type.d.ts +14 -0
- package/src/StatusIndicator/index.d.ts +3 -0
- package/src/Step/Step.classes.d.ts +7 -0
- package/src/Step/Step.d.ts +4 -0
- package/src/Step/Step.type.d.ts +50 -0
- package/src/Step/StepContext.d.ts +22 -0
- package/src/Step/index.d.ts +4 -0
- package/src/StepButton/StepButton.classes.d.ts +7 -0
- package/src/StepButton/StepButton.d.ts +4 -0
- package/src/StepButton/StepButton.type.d.ts +34 -0
- package/src/StepButton/index.d.ts +3 -0
- package/src/StepConnector/StepConnector.classes.d.ts +7 -0
- package/src/StepConnector/StepConnector.d.ts +5 -0
- package/src/StepConnector/StepConnector.type.d.ts +3 -0
- package/src/StepConnector/index.d.ts +3 -0
- package/src/StepContent/StepContent.classes.d.ts +7 -0
- package/src/StepContent/StepContent.d.ts +5 -0
- package/src/StepContent/StepContent.type.d.ts +14 -0
- package/src/StepContent/index.d.ts +3 -0
- package/src/StepIcon/StepIcon.classes.d.ts +7 -0
- package/src/StepIcon/StepIcon.d.ts +5 -0
- package/src/StepIcon/StepIcon.type.d.ts +38 -0
- package/src/StepIcon/index.d.ts +3 -0
- package/src/StepLabel/StepLabel.classes.d.ts +10 -0
- package/src/StepLabel/StepLabel.d.ts +5 -0
- package/src/StepLabel/StepLabel.type.d.ts +36 -0
- package/src/StepLabel/index.d.ts +3 -0
- package/src/Stepper/Stepper.classes.d.ts +7 -0
- package/src/Stepper/Stepper.d.ts +4 -0
- package/src/Stepper/Stepper.type.d.ts +47 -0
- package/src/Stepper/StepperContext.d.ts +11 -0
- package/src/Stepper/index.d.ts +4 -0
- package/src/SubMenu/PopperMenu.classes.d.ts +7 -0
- package/src/SubMenu/PopperMenu.d.ts +5 -0
- package/src/SubMenu/PopperMenu.type.d.ts +4 -0
- package/src/SubMenu/SubMenu.d.ts +4 -0
- package/src/SubMenu/SubMenu.type.d.ts +6 -0
- package/src/SubMenu/index.d.ts +5 -0
- package/src/SwipeableDrawer/SwipeableDrawer.classes.d.ts +7 -0
- package/src/SwipeableDrawer/SwipeableDrawer.d.ts +31 -0
- package/src/SwipeableDrawer/SwipeableDrawer.types.d.ts +82 -0
- package/src/SwipeableDrawer/hooks/index.d.ts +5 -0
- package/src/SwipeableDrawer/hooks/useDimensions.d.ts +17 -0
- package/src/SwipeableDrawer/hooks/useDrawerGestures.d.ts +151 -0
- package/src/SwipeableDrawer/hooks/useElementSizeObserver.d.ts +10 -0
- package/src/SwipeableDrawer/hooks/useReady.d.ts +4 -0
- package/src/SwipeableDrawer/hooks/useSnapPoints.d.ts +94 -0
- package/src/SwipeableDrawer/index.d.ts +3 -0
- package/src/Switch/Switch.classes.d.ts +7 -0
- package/src/Switch/Switch.d.ts +11 -0
- package/src/Switch/Switch.type.d.ts +19 -0
- package/src/Switch/index.d.ts +3 -0
- package/src/Tab/Tab.classes.d.ts +10 -0
- package/src/Tab/Tab.d.ts +5 -0
- package/src/Tab/Tab.type.d.ts +50 -0
- package/src/Tab/index.d.ts +3 -0
- package/src/TabContext/TabContext.d.ts +20 -0
- package/src/TabContext/TabContext.type.d.ts +13 -0
- package/src/TabContext/index.d.ts +2 -0
- package/src/TabPanel/TabPanel.classes.d.ts +7 -0
- package/src/TabPanel/TabPanel.d.ts +5 -0
- package/src/TabPanel/TabPanel.type.d.ts +18 -0
- package/src/TabPanel/index.d.ts +3 -0
- package/src/Table/Table.classes.d.ts +7 -0
- package/src/Table/Table.d.ts +4 -0
- package/src/Table/Table.type.d.ts +36 -0
- package/src/Table/TableContext.d.ts +8 -0
- package/src/Table/Tablelvl2Context.d.ts +7 -0
- package/src/Table/index.d.ts +5 -0
- package/src/TableBody/TableBody.classes.d.ts +7 -0
- package/src/TableBody/TableBody.d.ts +4 -0
- package/src/TableBody/TableBody.type.d.ts +17 -0
- package/src/TableBody/index.d.ts +3 -0
- package/src/TableCell/TableCell.classes.d.ts +7 -0
- package/src/TableCell/TableCell.d.ts +8 -0
- package/src/TableCell/TableCell.type.d.ts +59 -0
- package/src/TableCell/index.d.ts +3 -0
- package/src/TableContainer/TableContainer.classes.d.ts +8 -0
- package/src/TableContainer/TableContainer.d.ts +4 -0
- package/src/TableContainer/TableContainer.type.d.ts +23 -0
- package/src/TableContainer/index.d.ts +3 -0
- package/src/TableFooter/TableFooter.classes.d.ts +8 -0
- package/src/TableFooter/TableFooter.d.ts +5 -0
- package/src/TableFooter/TableFooter.type.d.ts +9 -0
- package/src/TableFooter/index.d.ts +2 -0
- package/src/TableHead/TableHead.classes.d.ts +7 -0
- package/src/TableHead/TableHead.d.ts +4 -0
- package/src/TableHead/TableHead.type.d.ts +21 -0
- package/src/TableHead/index.d.ts +3 -0
- package/src/TablePagination/TablePagination.classes.d.ts +8 -0
- package/src/TablePagination/TablePagination.d.ts +4 -0
- package/src/TablePagination/TablePagination.type.d.ts +73 -0
- package/src/TablePagination/index.d.ts +2 -0
- package/src/TableRow/TableRow.classes.d.ts +7 -0
- package/src/TableRow/TableRow.d.ts +4 -0
- package/src/TableRow/TableRow.type.d.ts +34 -0
- package/src/TableRow/index.d.ts +3 -0
- package/src/Tabs/TabMoreMenu.d.ts +36 -0
- package/src/Tabs/TabScrollButton.d.ts +21 -0
- package/src/Tabs/Tabs.classes.d.ts +19 -0
- package/src/Tabs/Tabs.d.ts +5 -0
- package/src/Tabs/Tabs.type.d.ts +54 -0
- package/src/Tabs/TabsContext.d.ts +9 -0
- package/src/Tabs/hooks/index.d.ts +2 -0
- package/src/Tabs/hooks/useComputedTabs.d.ts +20 -0
- package/src/Tabs/hooks/useTabsScroller.d.ts +48 -0
- package/src/Tabs/index.d.ts +7 -0
- package/src/Tag/Tag.classes.d.ts +8 -0
- package/src/Tag/Tag.d.ts +5 -0
- package/src/Tag/Tag.type.d.ts +23 -0
- package/src/Tag/index.d.ts +3 -0
- package/src/Text/Text.classes.d.ts +7 -0
- package/src/Text/Text.d.ts +4 -0
- package/src/Text/Text.type.d.ts +34 -0
- package/src/Text/index.d.ts +3 -0
- package/src/TextField/TextField.classes.d.ts +7 -0
- package/src/TextField/TextField.d.ts +5 -0
- package/src/TextField/TextField.type.d.ts +112 -0
- package/src/TextField/index.d.ts +3 -0
- package/src/Textarea/Textarea.classes.d.ts +10 -0
- package/src/Textarea/Textarea.d.ts +5 -0
- package/src/Textarea/Textarea.type.d.ts +26 -0
- package/src/Textarea/index.d.ts +3 -0
- package/src/TimePicker/NumberPicker.d.ts +5 -0
- package/src/TimePicker/NumberPicker.type.d.ts +36 -0
- package/src/TimePicker/PickerView.d.ts +4 -0
- package/src/TimePicker/PickerView.type.d.ts +25 -0
- package/src/TimePicker/SelectionView.d.ts +19 -0
- package/src/TimePicker/TimeButton.d.ts +11 -0
- package/src/TimePicker/TimePicker.classes.d.ts +7 -0
- package/src/TimePicker/TimePicker.context.d.ts +6 -0
- package/src/TimePicker/TimePicker.d.ts +5 -0
- package/src/TimePicker/TimePicker.type.d.ts +30 -0
- package/src/TimePicker/ToggleText.d.ts +5 -0
- package/src/TimePicker/ToggleText.type.d.ts +14 -0
- package/src/TimePicker/constant.d.ts +7 -0
- package/src/TimePicker/index.d.ts +14 -0
- package/src/TimePicker/utils/A11yUtils.d.ts +2 -0
- package/src/TimePicker/utils/TimeBoundary.d.ts +27 -0
- package/src/TimePicker/utils/TimePickerHelper.d.ts +52 -0
- package/src/TimePicker/utils/getNumberPickerBoundary.d.ts +22 -0
- package/src/TimePicker/utils/index.d.ts +4 -0
- package/src/TimePicker/utils/runKeyHandler.d.ts +4 -0
- package/src/Tooltip/Tooltip.d.ts +5 -0
- package/src/Tooltip/Tooltip.type.d.ts +5 -0
- package/src/Tooltip/TooltipTrigger.a11y.d.ts +38 -0
- package/src/Tooltip/TooltipTrigger.d.ts +4 -0
- package/src/Tooltip/TooltipTrigger.type.d.ts +59 -0
- package/src/Tooltip/TooltipView.classes.d.ts +8 -0
- package/src/Tooltip/TooltipView.d.ts +16 -0
- package/src/Tooltip/TooltipView.type.d.ts +44 -0
- package/src/Tooltip/index.d.ts +9 -0
- package/src/Tooltip/useTooltipForceHide.d.ts +8 -0
- package/src/Tooltip/withTooltip/index.d.ts +1 -0
- package/src/Tooltip/withTooltip/withTooltip.d.ts +6 -0
- package/src/Tray/Tray.classes.d.ts +13 -0
- package/src/Tray/Tray.d.ts +5 -0
- package/src/Tray/Tray.type.d.ts +26 -0
- package/src/Tray/TrayContext.d.ts +14 -0
- package/src/Tray/TrayPanel.d.ts +7 -0
- package/src/Tray/hooks/index.d.ts +3 -0
- package/src/Tray/hooks/useTray.d.ts +33 -0
- package/src/Tray/hooks/useTrayNavigate.d.ts +5 -0
- package/src/Tray/hooks/useTrayPanel.d.ts +14 -0
- package/src/Tray/index.d.ts +7 -0
- package/src/Tray/types.d.ts +2 -0
- package/src/TrayMenu/TrayMenu.d.ts +4 -0
- package/src/TrayMenu/TrayMenu.type.d.ts +3 -0
- package/src/TrayMenu/TrayMenuItem.d.ts +9 -0
- package/src/TrayMenu/index.d.ts +3 -0
- package/src/VirtualizedList/VirtualizedItemPropsContext.d.ts +5 -0
- package/src/VirtualizedList/VirtualizedList.d.ts +3 -0
- package/src/VirtualizedList/VirtualizedList.type.d.ts +51 -0
- package/src/VirtualizedList/VirtuosoComponents.d.ts +16 -0
- package/src/VirtualizedList/VirtuosoContextType.d.ts +14 -0
- package/src/VirtualizedList/index.d.ts +5 -0
- package/src/VirtualizedMenu/VirtualizedMenu.classes.d.ts +7 -0
- package/src/VirtualizedMenu/VirtualizedMenu.context.d.ts +6 -0
- package/src/VirtualizedMenu/VirtualizedMenu.d.ts +4 -0
- package/src/VirtualizedMenu/VirtualizedMenu.type.d.ts +35 -0
- package/src/VirtualizedMenu/VirtualizedMenuList.d.ts +6 -0
- package/src/VirtualizedMenu/index.d.ts +5 -0
- package/src/VisuallyHidden/VisuallyHidden.classes.d.ts +7 -0
- package/src/VisuallyHidden/VisuallyHidden.d.ts +5 -0
- package/src/VisuallyHidden/VisuallyHidden.type.d.ts +3 -0
- package/src/VisuallyHidden/index.d.ts +3 -0
- package/src/index.d.ts +112 -0
package/DatePicker.js
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useFocusVisible, useForkRef, combineProps, useOnlyOneFocusable, useKeyboardMoveFocus, usePrevious, useEventCallback, useWindowContext, runKeyHandler, useClasses, useControlled } from '@ringcentral/spring-base';
|
|
3
|
+
import { createContext, useContext, useRef, forwardRef, useMemo, useLayoutEffect, createElement, useState, useCallback, useEffect } from 'react';
|
|
4
|
+
import { B as Button } from './chunks/Button.js';
|
|
5
|
+
import { C as CircularProgressIndicator } from './chunks/CircularProgressIndicator.js';
|
|
6
|
+
import { useDateUtilsContext, DateUtilsProvider } from './DateUtilsContext.js';
|
|
7
|
+
import { CaretLeftMd, CaretRightMd, CalendarMd } from '@ringcentral/spring-icon';
|
|
8
|
+
import { E as ExpandCollapseCaret } from './chunks/ExpandCollapseCaret.js';
|
|
9
|
+
import 'framer-motion';
|
|
10
|
+
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
11
|
+
import './chunks/Icon.js';
|
|
12
|
+
import { I as IconButton } from './chunks/IconButtonLabel.js';
|
|
13
|
+
import { V as VisuallyHidden } from './chunks/VisuallyHidden.js';
|
|
14
|
+
import clsx from 'clsx';
|
|
15
|
+
import dayjs from 'dayjs';
|
|
16
|
+
import { P as PickerTextField } from './chunks/PickerTextField.js';
|
|
17
|
+
import '@mui/base';
|
|
18
|
+
import './chunks/Tooltip.js';
|
|
19
|
+
import './chunks/usePrefersReducedMotion.js';
|
|
20
|
+
import './chunks/getFade.js';
|
|
21
|
+
import './Popper.js';
|
|
22
|
+
import '@floating-ui/react-dom';
|
|
23
|
+
import './chunks/Modal.js';
|
|
24
|
+
import './chunks/useFocusTrapStack.js';
|
|
25
|
+
import './chunks/Backdrop.js';
|
|
26
|
+
import './chunks/PopperPaper.js';
|
|
27
|
+
import './chunks/withTooltip.js';
|
|
28
|
+
import '@date-io/dayjs';
|
|
29
|
+
import './chunks/useMotionSafeTransition.js';
|
|
30
|
+
import './chunks/Squircle.js';
|
|
31
|
+
import './chunks/Popover.js';
|
|
32
|
+
import './chunks/getGrow.js';
|
|
33
|
+
import './chunks/TextField.js';
|
|
34
|
+
import './chunks/ShowHideEye.js';
|
|
35
|
+
import './chunks/useHelperTextId.js';
|
|
36
|
+
|
|
37
|
+
const DatePickerClassesContext = createContext(() => '');
|
|
38
|
+
const useDatePickerClasses = () => useContext(DatePickerClassesContext);
|
|
39
|
+
|
|
40
|
+
const HeaderAction = (props) => {
|
|
41
|
+
const { className, disabled, ...rest } = props;
|
|
42
|
+
const cls = useDatePickerClasses();
|
|
43
|
+
const { focusVisible, focusVisibleRef, focusVisibleHandlers } = useFocusVisible();
|
|
44
|
+
return (jsx("button", { className: clsx(className, cls('header-action', { focusVisible, disabled })), ref: focusVisibleRef, ...rest, ...focusVisibleHandlers }));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const ScreenReaderContext = createContext(null);
|
|
48
|
+
const useScreenReaderContext = () => useContext(ScreenReaderContext);
|
|
49
|
+
const defaultScreenReaderProps = {
|
|
50
|
+
getMonthYearAriaLabel: (monthLabel, expanded) => `${monthLabel}${expanded ? ', year selection expanded' : ''}`,
|
|
51
|
+
getSwitchMonthAriaLabel: (isNext, currentMonth) => `${isNext ? 'Next' : 'Previous'} month, currently viewing ${currentMonth}`,
|
|
52
|
+
getBackToTodayAriaLabel: () => 'Go back to today',
|
|
53
|
+
getDayAriaLabel: (day, selected) => `${day}${selected ? ', selected' : ''}`,
|
|
54
|
+
getYearAriaLabel: (year, selected) => `${year}${selected ? ', selected' : ''}`,
|
|
55
|
+
};
|
|
56
|
+
const ScreenReaderProvider = ({ screenReaderProps, children, }) => {
|
|
57
|
+
return (jsx(ScreenReaderContext.Provider, { value: screenReaderProps || defaultScreenReaderProps, children: children }));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const focusDayElement = () => {
|
|
61
|
+
const elm = document.querySelector('[data-sui-picker-focused]');
|
|
62
|
+
elm?.focus();
|
|
63
|
+
};
|
|
64
|
+
const isSameYearAndMonth = ({ source, comparing }, utils) => {
|
|
65
|
+
if (!source || !comparing) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
const thisMonth = utils.getMonth(source);
|
|
69
|
+
const thisYear = utils.getYear(source);
|
|
70
|
+
const comparingMonth = utils.getMonth(comparing);
|
|
71
|
+
const comparingYear = utils.getYear(comparing);
|
|
72
|
+
return thisMonth === comparingMonth && thisYear === comparingYear;
|
|
73
|
+
};
|
|
74
|
+
const invalidateDateInRange = (day, { dateRange: { min, max }, disableFuture, disablePast, now, }, utils) => {
|
|
75
|
+
if (disableFuture && utils.isAfterDay(day, now)) {
|
|
76
|
+
return now;
|
|
77
|
+
}
|
|
78
|
+
if (disablePast && utils.isBeforeDay(day, now)) {
|
|
79
|
+
return now;
|
|
80
|
+
}
|
|
81
|
+
if (min && utils.isBeforeDay(day, utils.date(min))) {
|
|
82
|
+
return min;
|
|
83
|
+
}
|
|
84
|
+
if (max && utils.isAfterDay(day, utils.date(max))) {
|
|
85
|
+
return max;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const findClosestEnabledDate = ({ date, utils, minDate, maxDate, disableFuture, disablePast, shouldDisableDate, }) => {
|
|
91
|
+
const today = utils.startOfDay(utils.date());
|
|
92
|
+
if (disablePast && utils.isBefore(minDate, today)) {
|
|
93
|
+
minDate = today;
|
|
94
|
+
}
|
|
95
|
+
if (disableFuture && utils.isAfter(maxDate, today)) {
|
|
96
|
+
maxDate = today;
|
|
97
|
+
}
|
|
98
|
+
let forward = date;
|
|
99
|
+
let backward = date;
|
|
100
|
+
if (utils.isBefore(date, minDate)) {
|
|
101
|
+
forward = utils.date(minDate);
|
|
102
|
+
backward = null;
|
|
103
|
+
}
|
|
104
|
+
if (utils.isAfter(date, maxDate)) {
|
|
105
|
+
if (backward) {
|
|
106
|
+
backward = utils.date(maxDate);
|
|
107
|
+
}
|
|
108
|
+
forward = null;
|
|
109
|
+
}
|
|
110
|
+
while (forward || backward) {
|
|
111
|
+
if (forward && utils.isAfter(forward, maxDate)) {
|
|
112
|
+
forward = null;
|
|
113
|
+
}
|
|
114
|
+
if (backward && utils.isBefore(backward, minDate)) {
|
|
115
|
+
backward = null;
|
|
116
|
+
}
|
|
117
|
+
if (forward) {
|
|
118
|
+
if (!shouldDisableDate(forward)) {
|
|
119
|
+
return forward;
|
|
120
|
+
}
|
|
121
|
+
forward = utils.addDays(forward, 1);
|
|
122
|
+
}
|
|
123
|
+
if (backward) {
|
|
124
|
+
if (!shouldDisableDate(backward)) {
|
|
125
|
+
return backward;
|
|
126
|
+
}
|
|
127
|
+
backward = utils.addDays(backward, -1);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// fallback to today if no enabled days
|
|
131
|
+
return utils.date();
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const DatePickerHeader = (props) => {
|
|
135
|
+
const { focusedDate, onMonthChange, disablePrevMonth = false, disableNextMonth = false, onViewChange, view, } = props;
|
|
136
|
+
const utils = useDateUtilsContext();
|
|
137
|
+
const cls = useDatePickerClasses();
|
|
138
|
+
const preMonth = utils.getPreviousMonth(focusedDate);
|
|
139
|
+
const nextMonth = utils.getNextMonth(focusedDate);
|
|
140
|
+
const monthLabel = utils.getCalendarHeaderText(focusedDate);
|
|
141
|
+
const changeFromRef = useRef();
|
|
142
|
+
const selectNextMonth = () => {
|
|
143
|
+
onMonthChange(nextMonth, 'left');
|
|
144
|
+
changeFromRef.current = 'next';
|
|
145
|
+
};
|
|
146
|
+
const selectPreviousMonth = () => {
|
|
147
|
+
onMonthChange(preMonth, 'right');
|
|
148
|
+
changeFromRef.current = 'previous';
|
|
149
|
+
};
|
|
150
|
+
const isYearView = view === 'year';
|
|
151
|
+
const isExpanded = isYearView;
|
|
152
|
+
const { getMonthYearAriaLabel, getSwitchMonthAriaLabel } = useScreenReaderContext() ?? {};
|
|
153
|
+
const monthYearAriaLabel = getMonthYearAriaLabel?.(`${monthLabel}`, isExpanded);
|
|
154
|
+
const nextMonthAriaLabel = getSwitchMonthAriaLabel?.(true, utils.getMonthText(focusedDate));
|
|
155
|
+
const previousMonthAriaLabel = getSwitchMonthAriaLabel?.(false, utils.getMonthText(focusedDate));
|
|
156
|
+
return (jsxs(Fragment, { children: [changeFromRef.current && (jsx(VisuallyHidden, { role: "region", "aria-live": "assertive", children: changeFromRef.current === 'next'
|
|
157
|
+
? nextMonthAriaLabel
|
|
158
|
+
: previousMonthAriaLabel })), jsxs("div", { className: cls('header'), children: [jsxs(HeaderAction, { onClick: onViewChange, "aria-label": monthYearAriaLabel, "aria-expanded": isExpanded, "data-sui-picker-switch-year-action": "", className: cls('switch-year-action'), children: [monthLabel, jsx(ExpandCollapseCaret, { className: cls('switch-year-action-caret'), size: "small", expanded: isExpanded })] }), !isYearView && (jsxs("div", { className: cls('switch-month-actions-group'), children: [jsx(IconButton, { shape: "squircle", variant: "contained", color: "secondary", size: "small", background: false, symbol: CaretLeftMd, className: cls('switch-month-action'), disabled: disablePrevMonth, onClick: selectPreviousMonth, "aria-label": previousMonthAriaLabel, "data-sui-picker-previous-month": "" }), jsx(IconButton, { shape: "squircle", variant: "contained", color: "secondary", size: "small", background: false, symbol: CaretRightMd, className: cls('switch-month-action'), disabled: disableNextMonth, onClick: selectNextMonth, "aria-label": nextMonthAriaLabel, "data-sui-picker-next-month": "" })] }))] })] }));
|
|
159
|
+
};
|
|
160
|
+
DatePickerHeader.displayName = 'RcDatePickerHeader';
|
|
161
|
+
|
|
162
|
+
const Day = forwardRef((props, ref) => {
|
|
163
|
+
const { onSelect, value, selected, disabled, focused, children, current, date, onFocus, onBlur, ...rest } = props;
|
|
164
|
+
const { getDayAriaLabel } = useScreenReaderContext() ?? {};
|
|
165
|
+
const cls = useDatePickerClasses();
|
|
166
|
+
const { focusVisible, focusVisibleHandlers, focusVisibleRef } = useFocusVisible();
|
|
167
|
+
const utils = useDateUtilsContext();
|
|
168
|
+
const handleRef = useForkRef(ref, focusVisibleRef);
|
|
169
|
+
return (jsx("button", { onClick: () => onSelect(value), ref: handleRef, className: cls('date-button', 'day', {
|
|
170
|
+
'current-date': current,
|
|
171
|
+
selected,
|
|
172
|
+
disabled,
|
|
173
|
+
focusVisible,
|
|
174
|
+
}), "data-sui-picker-focused": focused ? '' : undefined, "data-sui-picker-day": value, "aria-label": getDayAriaLabel?.(`${utils.getDatePickerHeaderText(date)} ${utils.getYearText(date)}`, selected), ...rest, ...combineProps({ onBlur, onFocus }, focusVisibleHandlers), children: children }));
|
|
175
|
+
});
|
|
176
|
+
Day.displayName = 'SuiDay';
|
|
177
|
+
|
|
178
|
+
const Year = forwardRef((props, ref) => {
|
|
179
|
+
const { onSelect, value, selected, disabled, children, current, onFocus, onBlur, date, ...rest } = props;
|
|
180
|
+
const { getYearAriaLabel } = useScreenReaderContext() ?? {};
|
|
181
|
+
const cls = useDatePickerClasses();
|
|
182
|
+
const { focusVisible, focusVisibleHandlers, focusVisibleRef } = useFocusVisible();
|
|
183
|
+
const handleRef = useForkRef(ref, focusVisibleRef);
|
|
184
|
+
return (jsx("button", { onClick: () => onSelect(value), ref: handleRef, className: cls('date-button', 'year', {
|
|
185
|
+
'current-date': current,
|
|
186
|
+
selected,
|
|
187
|
+
disabled,
|
|
188
|
+
focusVisible,
|
|
189
|
+
}), "data-sui-picker-year": value, "aria-label": getYearAriaLabel?.(value, selected), ...rest, ...combineProps({ onBlur, onFocus }, focusVisibleHandlers), children: children }));
|
|
190
|
+
});
|
|
191
|
+
Year.displayName = 'SuiYear';
|
|
192
|
+
|
|
193
|
+
const Years = forwardRef((props, ref) => {
|
|
194
|
+
const { date, onYearChange, minDate, maxDate, disablePast, disableFuture, now, } = props;
|
|
195
|
+
const utils = useDateUtilsContext();
|
|
196
|
+
const containerRef = useRef(null);
|
|
197
|
+
const combineRef = useForkRef(containerRef, ref);
|
|
198
|
+
const selectedYearRef = useRef(null);
|
|
199
|
+
const currentYear = utils.getYearText(date || now);
|
|
200
|
+
const years = useMemo(() => utils.getYearRange(minDate, maxDate), [maxDate, minDate, utils]);
|
|
201
|
+
const focusedIndexRef = useRef(0);
|
|
202
|
+
const focusedYear = utils.getYearText(years[focusedIndexRef.current]);
|
|
203
|
+
const { focusIndex, getItemProps } = useOnlyOneFocusable({
|
|
204
|
+
focusedIndexRef,
|
|
205
|
+
containerRef,
|
|
206
|
+
});
|
|
207
|
+
const getOptionDisabled = (year) => Boolean((disablePast && utils.isBeforeYear(year, now)) ||
|
|
208
|
+
(disableFuture && utils.isAfterYear(year, now)));
|
|
209
|
+
const { onKeyFocusedIndexHandle: handleKeyDown } = useKeyboardMoveFocus({
|
|
210
|
+
options: years,
|
|
211
|
+
focusedIndexRef,
|
|
212
|
+
columns: 4,
|
|
213
|
+
infinite: 'order',
|
|
214
|
+
onFocusedIndexChange: (event, toIndex) => {
|
|
215
|
+
focusIndex(toIndex);
|
|
216
|
+
event?.preventDefault();
|
|
217
|
+
},
|
|
218
|
+
getOptionDisabled,
|
|
219
|
+
});
|
|
220
|
+
useLayoutEffect(() => {
|
|
221
|
+
const index = years.findIndex((x) => utils.getYearText(x) === currentYear);
|
|
222
|
+
focusIndex(index);
|
|
223
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
224
|
+
}, []);
|
|
225
|
+
const cls = useDatePickerClasses();
|
|
226
|
+
return (jsx("div", { role: "presentation", className: cls('years-panel'), ref: combineRef, onKeyDown: handleKeyDown, children: years.map((year, index) => {
|
|
227
|
+
const yearText = utils.getYearText(year);
|
|
228
|
+
const selected = yearText === currentYear;
|
|
229
|
+
const focused = yearText === focusedYear;
|
|
230
|
+
const disabled = getOptionDisabled(year);
|
|
231
|
+
return (createElement(Year, { ...getItemProps(index), current: utils.isSameYear(year, now), ref: focused ? selectedYearRef : undefined, key: utils.getYearText(year), selected: selected, date: year, value: yearText, onSelect: (year) => {
|
|
232
|
+
const newDate = utils.setYear(date, Number(year));
|
|
233
|
+
onYearChange(newDate);
|
|
234
|
+
}, disabled: disabled }, utils.getYearText(year)));
|
|
235
|
+
}) }));
|
|
236
|
+
});
|
|
237
|
+
Years.displayName = 'SuiYears';
|
|
238
|
+
|
|
239
|
+
const Calendar = forwardRef(({ onMonthChange, date, shouldDisableDate, dateRange, todayButtonText, loadingIndicator, disablePast, disableFuture, renderDay, onSelectDay, getInvalidateDateInRange, }, ref) => {
|
|
240
|
+
const cls = useDatePickerClasses();
|
|
241
|
+
const utils = useDateUtilsContext();
|
|
242
|
+
const previousFocusDate = usePrevious(() => focusedDate);
|
|
243
|
+
const previousView = usePrevious(() => view);
|
|
244
|
+
const weeks = useRef([]);
|
|
245
|
+
const weekdays = useMemo(() => utils.getWeekdays(), [utils]);
|
|
246
|
+
const { now, isTodayDisabled } = useMemo(() => {
|
|
247
|
+
const nowDate = utils.date();
|
|
248
|
+
return {
|
|
249
|
+
now: nowDate,
|
|
250
|
+
isTodayDisabled: shouldDisableDate(nowDate),
|
|
251
|
+
};
|
|
252
|
+
}, [shouldDisableDate, utils]);
|
|
253
|
+
const [focusedDate, setFocusedDate] = useState(date);
|
|
254
|
+
const [view, setView] = useState('day');
|
|
255
|
+
const [slideDirection, setSlideDirection] = useState('left');
|
|
256
|
+
const [loadingQueue, setLoadingQueue] = useState(0);
|
|
257
|
+
const { min, max } = dateRange;
|
|
258
|
+
const currentMonthNumber = utils.getMonth(focusedDate);
|
|
259
|
+
const sameMonthDate = previousFocusDate
|
|
260
|
+
? isSameYearAndMonth({ source: focusedDate, comparing: previousFocusDate }, utils)
|
|
261
|
+
: false;
|
|
262
|
+
if (!sameMonthDate) {
|
|
263
|
+
weeks.current = utils.getWeekArray(focusedDate);
|
|
264
|
+
}
|
|
265
|
+
const viewChange = view !== previousView;
|
|
266
|
+
const pushToLoadingQueue = () => {
|
|
267
|
+
setLoadingQueue(loadingQueue + 1);
|
|
268
|
+
};
|
|
269
|
+
const popFromLoadingQueue = () => {
|
|
270
|
+
setLoadingQueue(loadingQueue <= 0 ? 0 : loadingQueue - 1);
|
|
271
|
+
};
|
|
272
|
+
const handleMonthChange = useEventCallback((newMonth, direction) => {
|
|
273
|
+
setSlideDirection(direction);
|
|
274
|
+
setFocusedDate(getInvalidateDateInRange(newMonth) || newMonth);
|
|
275
|
+
if (onMonthChange) {
|
|
276
|
+
const returnVal = onMonthChange(newMonth);
|
|
277
|
+
if (returnVal) {
|
|
278
|
+
pushToLoadingQueue();
|
|
279
|
+
returnVal.then(() => {
|
|
280
|
+
popFromLoadingQueue();
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
const handleChangeView = useEventCallback(() => {
|
|
286
|
+
setView(view === 'day' ? 'year' : 'day');
|
|
287
|
+
});
|
|
288
|
+
const disableNextMonth = useMemo(() => {
|
|
289
|
+
const nextStartDay = utils.startOfMonth(utils.getNextMonth(focusedDate));
|
|
290
|
+
return !!getInvalidateDateInRange(nextStartDay);
|
|
291
|
+
}, [focusedDate, getInvalidateDateInRange, utils]);
|
|
292
|
+
const disablePrevMonth = useMemo(() => {
|
|
293
|
+
const prevLatestDay = utils.endOfMonth(utils.getPreviousMonth(focusedDate));
|
|
294
|
+
return !!getInvalidateDateInRange(prevLatestDay);
|
|
295
|
+
}, [focusedDate, getInvalidateDateInRange, utils]);
|
|
296
|
+
const handleKeyDown = (event) => {
|
|
297
|
+
const moveDay = (value) => {
|
|
298
|
+
const day = utils.addDays(focusedDate, value);
|
|
299
|
+
if (day && !shouldDisableDate(day)) {
|
|
300
|
+
const newMonthNumber = utils.getMonth(day);
|
|
301
|
+
if (newMonthNumber !== currentMonthNumber) {
|
|
302
|
+
return handleMonthChange(day, newMonthNumber > currentMonthNumber ? 'left' : 'right');
|
|
303
|
+
}
|
|
304
|
+
setFocusedDate(day);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
const goToDate = (day) => {
|
|
308
|
+
setFocusedDate(getInvalidateDateInRange(day) || day);
|
|
309
|
+
};
|
|
310
|
+
const confirmDate = () => {
|
|
311
|
+
event.stopPropagation();
|
|
312
|
+
onSelectDay(focusedDate);
|
|
313
|
+
};
|
|
314
|
+
runKeyHandler(event, {
|
|
315
|
+
ArrowUp: () => moveDay(-7),
|
|
316
|
+
ArrowDown: () => moveDay(7),
|
|
317
|
+
ArrowLeft: () => moveDay(-1),
|
|
318
|
+
ArrowRight: () => moveDay(1),
|
|
319
|
+
Home: () => goToDate(utils.startOfMonth(focusedDate)),
|
|
320
|
+
End: () => goToDate(utils.endOfMonth(focusedDate)),
|
|
321
|
+
Enter: confirmDate,
|
|
322
|
+
' ': confirmDate,
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
const { getBackToTodayAriaLabel } = useScreenReaderContext() ?? {};
|
|
326
|
+
const backToTodayAriaLabel = getBackToTodayAriaLabel?.();
|
|
327
|
+
const renderDays = (week) => {
|
|
328
|
+
const selectedDate = date;
|
|
329
|
+
return week.map((day) => {
|
|
330
|
+
const disabled = shouldDisableDate(day);
|
|
331
|
+
const isDayInCurrentMonth = utils.getMonth(day) === currentMonthNumber;
|
|
332
|
+
const dayText = utils.getDayText(day);
|
|
333
|
+
const key = `${dayText}/${currentMonthNumber}`;
|
|
334
|
+
const selected = utils.isSameDay(day, selectedDate);
|
|
335
|
+
const focused = utils.isSameDay(focusedDate, day);
|
|
336
|
+
const dayComponent = isDayInCurrentMonth ? (jsx(Day, { disabled: disabled, current: utils.isSameDay(day, now), selected: selected, tabIndex: focused ? 0 : -1, focused: focused, date: day, value: dayText, onSelect: () => {
|
|
337
|
+
isDayInCurrentMonth && onSelectDay(day);
|
|
338
|
+
}, children: dayText }, key)) : (jsx("div", { "aria-hidden": true }, key));
|
|
339
|
+
return renderDay
|
|
340
|
+
? renderDay(day, focusedDate, isDayInCurrentMonth, dayComponent)
|
|
341
|
+
: dayComponent;
|
|
342
|
+
});
|
|
343
|
+
};
|
|
344
|
+
const renderBody = () => {
|
|
345
|
+
const loadingElement = loadingIndicator ? (loadingIndicator) : (jsx("div", { className: cls('loading-container'), children: jsx(CircularProgressIndicator, {}) }));
|
|
346
|
+
switch (view) {
|
|
347
|
+
case 'day':
|
|
348
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: cls('days-panel'), role: "presentation", children: [jsx("div", { className: cls('weekdays'), children: weekdays.map((day) => (jsx("span", { className: cls('weekday'), children: day }, day))) }), loadingQueue > 0 ? (jsx("div", { children: loadingElement })) : (jsx("div", { className: cls('days-grid'), onKeyDown: handleKeyDown, children: weeks.current.map((week) => renderDays(week)) }))] }), jsx("div", { children: jsx(Button, { className: cls('today-button'), variant: "outlined", size: "small", color: "secondary", onClick: () => {
|
|
349
|
+
onSelectDay(now);
|
|
350
|
+
}, disabled: isTodayDisabled, "aria-label": backToTodayAriaLabel, "data-sui-picker-today": "", children: todayButtonText }) })] }));
|
|
351
|
+
case 'year':
|
|
352
|
+
return (jsx(Years, { date: focusedDate, minDate: min, maxDate: max, onYearChange: (day) => {
|
|
353
|
+
setView('day');
|
|
354
|
+
const validateDate = getInvalidateDateInRange(day) || day;
|
|
355
|
+
setFocusedDate(validateDate);
|
|
356
|
+
}, disablePast: disablePast, disableFuture: disableFuture, now: now }));
|
|
357
|
+
default:
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
const { document } = useWindowContext();
|
|
362
|
+
useLayoutEffect(() => {
|
|
363
|
+
if (viewChange)
|
|
364
|
+
return;
|
|
365
|
+
// same month anchor switch
|
|
366
|
+
if (sameMonthDate) {
|
|
367
|
+
focusDayElement();
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
// different month anchor switch and not switch by header action
|
|
371
|
+
const activeEl = document?.activeElement;
|
|
372
|
+
if (activeEl &&
|
|
373
|
+
!activeEl.hasAttribute('data-sui-picker-next-month') &&
|
|
374
|
+
!activeEl.hasAttribute('data-sui-picker-previous-month')) {
|
|
375
|
+
const timer = setTimeout(() => {
|
|
376
|
+
focusDayElement();
|
|
377
|
+
});
|
|
378
|
+
return () => {
|
|
379
|
+
clearTimeout(timer);
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
return undefined;
|
|
383
|
+
});
|
|
384
|
+
// when view change and current is day also focusDay again
|
|
385
|
+
useLayoutEffect(() => {
|
|
386
|
+
if (previousView && view === 'day' && viewChange) {
|
|
387
|
+
focusDayElement();
|
|
388
|
+
}
|
|
389
|
+
}, [previousView, view, viewChange]);
|
|
390
|
+
useLayoutEffect(() => {
|
|
391
|
+
focusDayElement();
|
|
392
|
+
}, []);
|
|
393
|
+
return (jsxs("div", { className: cls('calendar'), ref: ref, children: [jsx(DatePickerHeader, { focusedDate: focusedDate, slideDirection: slideDirection, view: view, onMonthChange: handleMonthChange, onViewChange: handleChangeView, disablePrevMonth: disablePrevMonth, disableNextMonth: disableNextMonth }), renderBody()] }));
|
|
394
|
+
});
|
|
395
|
+
Calendar.displayName = 'RcCalendar';
|
|
396
|
+
|
|
397
|
+
var DatePicker$1 = {"sui-date-picker-calendar":"sui-date-picker-calendar","sui-date-picker-header":"sui-date-picker-header","sui-date-picker-header-action":"sui-date-picker-header-action","sui-focus-visible":"sui-focus-visible","sui-disabled":"sui-disabled","sui-date-picker-switch-year-action":"sui-date-picker-switch-year-action","sui-date-picker-switch-year-action-caret":"sui-date-picker-switch-year-action-caret","sui-date-picker-switch-month-actions-group":"sui-date-picker-switch-month-actions-group","sui-date-picker-switch-month-action":"sui-date-picker-switch-month-action","sui-date-picker-date-button":"sui-date-picker-date-button","sui-selected":"sui-selected","sui-date-picker-current-date":"sui-date-picker-current-date","sui-date-picker-day":"sui-date-picker-day","sui-date-picker-year":"sui-date-picker-year","sui-date-picker-years-panel":"sui-date-picker-years-panel","sui-date-picker-days-panel":"sui-date-picker-days-panel","sui-date-picker-days-grid":"sui-date-picker-days-grid","sui-date-picker-weekdays":"sui-date-picker-weekdays","sui-date-picker-weekday":"sui-date-picker-weekday","sui-date-picker-loading-container":"sui-date-picker-loading-container","sui-date-picker-today-button":"sui-date-picker-today-button"};
|
|
398
|
+
|
|
399
|
+
const defaultMinDate = new Date('1900-01-01');
|
|
400
|
+
const defaultMaxDate = new Date('2100-01-01');
|
|
401
|
+
const DEFAULT_FORMAT = 'MM/DD/YYYY';
|
|
402
|
+
const InnerDatePicker = (props) => {
|
|
403
|
+
const { innerRef, value, onChange, formatString = DEFAULT_FORMAT, todayButtonText = 'Today', min: minDate = null, max: maxDate = null, disableFuture, disablePast, loadingIndicator, onMonthChange, renderDay, disabled, shouldDisableDate: shouldDisableDateProp, onClose, onClear, classes, PopoverProps, screenReaderProps, clearBtn = true, label = 'Date', className, ...rest } = props;
|
|
404
|
+
const cls = useClasses('date-picker', classes, className);
|
|
405
|
+
const utils = useDateUtilsContext();
|
|
406
|
+
const [controlledValue, setControlledValue] = useControlled({
|
|
407
|
+
controlled: value,
|
|
408
|
+
default: null,
|
|
409
|
+
name: 'DatePicker',
|
|
410
|
+
});
|
|
411
|
+
const emitValueRef = useRef(null);
|
|
412
|
+
const actionRef = useRef(null);
|
|
413
|
+
const dateRange = useMemo(() => ({
|
|
414
|
+
min: dayjs(minDate || defaultMinDate),
|
|
415
|
+
max: dayjs(maxDate || defaultMaxDate),
|
|
416
|
+
}), [minDate, maxDate]);
|
|
417
|
+
const getInvalidateDateInRange = useEventCallback((day) => invalidateDateInRange(day, { dateRange, now: utils.date(), disableFuture, disablePast }, utils));
|
|
418
|
+
const shouldDisableDate = useEventCallback((day) => {
|
|
419
|
+
return (Boolean(getInvalidateDateInRange(day)) ||
|
|
420
|
+
Boolean(shouldDisableDateProp?.(day)));
|
|
421
|
+
});
|
|
422
|
+
const getClosestEnabledDate = useCallback((currDate) => {
|
|
423
|
+
return findClosestEnabledDate({
|
|
424
|
+
date: currDate,
|
|
425
|
+
utils,
|
|
426
|
+
minDate: utils.date(dateRange.min),
|
|
427
|
+
maxDate: utils.date(dateRange.max),
|
|
428
|
+
disablePast: Boolean(disablePast),
|
|
429
|
+
disableFuture: Boolean(disableFuture),
|
|
430
|
+
shouldDisableDate,
|
|
431
|
+
});
|
|
432
|
+
}, [
|
|
433
|
+
dateRange.max,
|
|
434
|
+
dateRange.min,
|
|
435
|
+
disableFuture,
|
|
436
|
+
disablePast,
|
|
437
|
+
shouldDisableDate,
|
|
438
|
+
utils,
|
|
439
|
+
]);
|
|
440
|
+
const initialDate = useMemo(() => getClosestEnabledDate(utils.date()), [utils, getClosestEnabledDate]);
|
|
441
|
+
const dayjsValue = useMemo(() => (controlledValue ? dayjs(controlledValue) : null), [controlledValue]);
|
|
442
|
+
const nowDate = dayjsValue || initialDate;
|
|
443
|
+
const textFiledValue = useMemo(() => (dayjsValue ? utils.formatByString(dayjsValue, formatString) : ''), [dayjsValue, utils, formatString]);
|
|
444
|
+
const handleChange = (toDate, fromUserSelect) => {
|
|
445
|
+
actionRef.current?.close();
|
|
446
|
+
setControlledValue(toDate);
|
|
447
|
+
// save inner change value
|
|
448
|
+
emitValueRef.current = toDate;
|
|
449
|
+
onChange?.(toDate, fromUserSelect);
|
|
450
|
+
};
|
|
451
|
+
const handleDaySelect = useEventCallback((day, fromUserSelect = true) => {
|
|
452
|
+
const newDay = day ? utils.startOfDay(day).toDate() : null;
|
|
453
|
+
handleChange(newDay, fromUserSelect);
|
|
454
|
+
});
|
|
455
|
+
useEffect(() => {
|
|
456
|
+
if (
|
|
457
|
+
// only when inner value change need check again is that value is valid
|
|
458
|
+
dayjsValue &&
|
|
459
|
+
value !== emitValueRef.current &&
|
|
460
|
+
shouldDisableDate(dayjsValue)) {
|
|
461
|
+
const closestEnabledDate = getClosestEnabledDate(dayjsValue);
|
|
462
|
+
handleDaySelect(closestEnabledDate, false);
|
|
463
|
+
}
|
|
464
|
+
}, [
|
|
465
|
+
dayjsValue,
|
|
466
|
+
getClosestEnabledDate,
|
|
467
|
+
handleDaySelect,
|
|
468
|
+
shouldDisableDate,
|
|
469
|
+
value,
|
|
470
|
+
]);
|
|
471
|
+
return (jsx(DatePickerClassesContext.Provider, { value: cls, children: jsx(PickerTextField, { className: cls('root'), variant: "standard", label: label, ref: innerRef, action: actionRef, onClear: (e) => {
|
|
472
|
+
onClear?.(e);
|
|
473
|
+
handleChange(null);
|
|
474
|
+
}, PopoverProps: PopoverProps, value: textFiledValue, disabled: disabled, endIconSymbol: CalendarMd, onClose: onClose, clearBtn: clearBtn, ...rest, children: jsx(ScreenReaderProvider, { screenReaderProps: screenReaderProps, children: jsx(Calendar, { date: nowDate, dateRange: dateRange, onSelectDay: handleDaySelect, disableFuture: disableFuture, disablePast: disablePast, loadingIndicator: loadingIndicator, onMonthChange: onMonthChange, renderDay: renderDay, shouldDisableDate: shouldDisableDate, getInvalidateDateInRange: getInvalidateDateInRange, todayButtonText: todayButtonText, formatString: formatString }) }) }) }));
|
|
475
|
+
};
|
|
476
|
+
const DatePicker = forwardRef((inProps, ref) => {
|
|
477
|
+
const { locale = 'en', ...rest } = useThemeProps({
|
|
478
|
+
props: inProps,
|
|
479
|
+
name: 'DatePicker',
|
|
480
|
+
});
|
|
481
|
+
return (jsx(DateUtilsProvider, { locale: locale, children: jsx(InnerDatePicker, { innerRef: ref, ...rest }) }));
|
|
482
|
+
});
|
|
483
|
+
DatePicker.displayName = 'SuiDatePicker';
|
|
484
|
+
|
|
485
|
+
export { Calendar, DEFAULT_FORMAT, DatePicker, DatePickerClassesContext, DatePickerHeader, Day, HeaderAction, ScreenReaderContext, ScreenReaderProvider, Year, Years, DatePicker$1 as datePickerStyle, findClosestEnabledDate, focusDayElement, invalidateDateInRange, isSameYearAndMonth, useDatePickerClasses, useScreenReaderContext };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import DateUtils from '@date-io/dayjs';
|
|
3
|
+
import { createContext, useMemo, useContext } from 'react';
|
|
4
|
+
|
|
5
|
+
const DateUtilsContext = createContext(null);
|
|
6
|
+
const DateUtilsProvider = (props) => {
|
|
7
|
+
const { children, locale } = props;
|
|
8
|
+
const utils = useMemo(() => {
|
|
9
|
+
const dateUtils = new DateUtils({ locale });
|
|
10
|
+
const customUtils = {
|
|
11
|
+
// displaying methods
|
|
12
|
+
getCalendarHeaderText: (date) => {
|
|
13
|
+
return dateUtils.formatByString(date, 'MMMM YYYY');
|
|
14
|
+
},
|
|
15
|
+
getYearText: (date) => {
|
|
16
|
+
return dateUtils.formatByString(date, 'YYYY');
|
|
17
|
+
},
|
|
18
|
+
getMonthText: (date) => {
|
|
19
|
+
return dateUtils.formatByString(date, 'MMMM');
|
|
20
|
+
},
|
|
21
|
+
getDatePickerHeaderText: (date) => {
|
|
22
|
+
return dateUtils.formatByString(date, 'ddd, MMM D');
|
|
23
|
+
},
|
|
24
|
+
getDateTimePickerHeaderText: (date) => {
|
|
25
|
+
return dateUtils.formatByString(date, 'MMM D');
|
|
26
|
+
},
|
|
27
|
+
getDayText: (date) => {
|
|
28
|
+
return dateUtils.formatByString(date, 'D');
|
|
29
|
+
},
|
|
30
|
+
getHourText: (date, ampm) => {
|
|
31
|
+
return dateUtils.formatByString(date, ampm ? 'hh' : 'HH');
|
|
32
|
+
},
|
|
33
|
+
getMinuteText: (date) => {
|
|
34
|
+
return dateUtils.formatByString(date, 'mm');
|
|
35
|
+
},
|
|
36
|
+
getSecondText: (date) => {
|
|
37
|
+
return dateUtils.formatByString(date, 'ss');
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
...dateUtils,
|
|
42
|
+
...customUtils,
|
|
43
|
+
date: dateUtils.dayjs,
|
|
44
|
+
};
|
|
45
|
+
}, [locale]);
|
|
46
|
+
return (jsx(DateUtilsContext.Provider, { value: utils, children: children }));
|
|
47
|
+
};
|
|
48
|
+
const useDateUtilsContext = () => {
|
|
49
|
+
const utils = useContext(DateUtilsContext);
|
|
50
|
+
if (!utils) {
|
|
51
|
+
throw Error('No DateUtils provided, must be used within a DateUtilsProvider');
|
|
52
|
+
}
|
|
53
|
+
return utils;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { DateUtilsProvider, useDateUtilsContext };
|