@ringcentral/spring-ui 1.9.2 → 1.11.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/Alert.js +1 -1
- package/Announcement.js +4 -2
- package/Autocomplete.js +40 -7
- package/Avatar.js +42 -27
- package/DatePicker.js +45 -38
- package/DateUtilsContext.js +18 -1
- package/Dialer.js +1 -1
- package/Dialog.js +24 -15
- package/NestedMenuContext.js +4 -3
- package/Option.js +5 -5
- package/PickerTextField.js +2 -2
- package/Popper.js +1 -1
- package/Snackbar.js +7 -5
- package/SortableListDndContext.js +3 -3
- package/SortableListItem.js +21 -9
- package/SplitButton.js +1 -1
- package/SubMenu.js +208 -77
- package/SwipeableDrawer.js +1 -9
- package/Switch.js +15 -5
- package/TablePagination.js +11 -21
- package/TableRow.js +1 -1
- package/Text.js +2 -2
- package/Textarea.js +1 -1
- package/TimePicker.js +1 -1
- package/chunks/Alert.js +1 -1
- package/chunks/Drawer.js +1 -1
- package/chunks/Menu.js +25 -6
- package/chunks/Modal.js +7 -3
- package/chunks/PickerTextField.js +18 -7
- package/chunks/TextField.js +0 -1
- package/chunks/Tooltip.js +1 -1
- package/chunks/VirtualizedMenu.js +1 -1
- package/chunks/useMenuItemSelect.js +49 -17
- package/chunks/useNestedMenuItem.js +16 -5
- package/chunks/useNestedParentMenu.js +77 -5
- package/chunks/useTrayNavigate.js +1 -1
- package/index.css +543 -398
- package/index.js +1 -1
- package/package.json +4 -4
- package/src/Accordion/Accordion.classes.d.ts +3 -3
- package/src/Accordion/Accordion.d.ts +1 -1
- package/src/Accordion/Accordion.type.d.ts +1 -1
- package/src/Accordion/AccordionContext.d.ts +1 -1
- package/src/AccordionHeader/AccordionHeader.classes.d.ts +3 -3
- package/src/AccordionHeader/AccordionHeader.d.ts +1 -1
- package/src/AccordionHeader/AccordionHeader.type.d.ts +1 -1
- package/src/Alert/Alert.classes.d.ts +3 -3
- package/src/Alert/Alert.d.ts +3 -3
- package/src/Alert/Alert.type.d.ts +7 -7
- package/src/Alert/AlertTitle.classes.d.ts +3 -3
- package/src/Animation/components/ExpandCollapseCaret/ExpandCollapseCaret.classes.d.ts +3 -3
- package/src/Animation/components/ExpandCollapseCaret/ExpandCollapseCaret.d.ts +2 -2
- package/src/Animation/components/Fade/Fade.d.ts +1 -1
- package/src/Animation/components/Fade/getFade.d.ts +1 -1
- package/src/Animation/components/Grow/Grow.d.ts +1 -1
- package/src/Animation/components/Grow/getGrow.d.ts +4 -4
- package/src/Animation/components/ShowHideEye/ShowHideEye.classes.d.ts +3 -3
- package/src/Animation/components/ShowHideEye/ShowHideEye.d.ts +1 -1
- package/src/Animation/components/SlideIn/SlideIn.d.ts +1 -1
- package/src/Animation/components/SlideIn/getSlideIn.d.ts +2 -2
- package/src/Animation/components/SortableArrow/SortableArrow.classes.d.ts +3 -3
- package/src/Animation/components/SortableArrow/SortableArrow.d.ts +1 -1
- package/src/Animation/components/types.d.ts +2 -2
- package/src/Announcement/Announcement.classes.d.ts +3 -3
- package/src/Announcement/Announcement.type.d.ts +1 -1
- package/src/Autocomplete/Autocomplete.classes.d.ts +6 -6
- package/src/Autocomplete/Autocomplete.type.d.ts +6 -5
- package/src/Autocomplete/SuggestionList/SuggestionList.classes.d.ts +3 -3
- package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +3 -3
- package/src/Autocomplete/SuggestionList/SuggestionListItem.d.ts +2 -2
- package/src/Autocomplete/SuggestionList/utils/SuggestionListItem.d.ts +1 -1
- package/src/Autocomplete/SuggestionList/utils/useDynamicHeight.d.ts +1 -1
- package/src/Autocomplete/SuggestionList/utils/useHighlightScroll.d.ts +1 -1
- package/src/Autocomplete/SuggestionList/utils/useSuggestionList.d.ts +11 -11
- package/src/Autocomplete/SuggestionList/utils/useSuggestionListGroup.d.ts +2 -2
- package/src/Autocomplete/useAutocomplete.d.ts +20 -20
- package/src/Autocomplete/useAutocompleteTag.d.ts +12 -12
- package/src/Avatar/Avatar.classes.d.ts +5 -5
- package/src/Avatar/Avatar.type.d.ts +7 -7
- package/src/AvatarGroup/AvatarGroup.classes.d.ts +3 -3
- package/src/AvatarGroup/AvatarGroup.type.d.ts +6 -6
- package/src/Backdrop/Backdrop.classes.d.ts +3 -3
- package/src/Backdrop/Backdrop.type.d.ts +1 -1
- package/src/Badge/Badge.classes.d.ts +5 -5
- package/src/Badge/Badge.type.d.ts +7 -7
- package/src/Block/Block.classes.d.ts +3 -3
- package/src/Block/Block.type.d.ts +6 -6
- package/src/BlockHeader/BlockHeader.classes.d.ts +3 -3
- package/src/BlockHeader/BlockHeader.type.d.ts +4 -4
- package/src/BottomNavigation/BottomNavigation.classes.d.ts +3 -3
- package/src/BottomNavigation/BottomNavigation.type.d.ts +2 -2
- package/src/BottomNavigation/BottomNavigationContext.d.ts +1 -1
- package/src/BottomNavigation/BottomNavigationGroup/BottomNavigationGroup.classes.d.ts +3 -3
- package/src/BottomNavigation/BottomNavigationGroup/BottomNavigationGroup.type.d.ts +1 -1
- package/src/BottomNavigationItem/BottomNavigationItem.classes.d.ts +3 -3
- package/src/BottomNavigationItem/BottomNavigationItem.type.d.ts +1 -1
- package/src/Button/Button.classes.d.ts +3 -3
- package/src/Button/Button.type.d.ts +8 -8
- package/src/CallButton/CallButton.classes.d.ts +3 -3
- package/src/CallButton/CallButton.type.d.ts +5 -5
- package/src/Checkbox/Checkbox.classes.d.ts +3 -3
- package/src/Checkbox/Checkbox.d.ts +2 -2
- package/src/Checkbox/Checkbox.type.d.ts +2 -2
- package/src/Chip/Chip.classes.d.ts +3 -3
- package/src/Chip/Chip.type.d.ts +5 -5
- package/src/CircularProgressIndicator/CircularProgressIndicator.classes.d.ts +4 -4
- package/src/CircularProgressIndicator/CircularProgressIndicator.d.ts +1 -1
- package/src/CircularProgressIndicator/CircularProgressIndicator.type.d.ts +4 -4
- package/src/ComponentsProps.d.ts +1 -1
- package/src/DatePicker/Calendar.d.ts +1 -1
- package/src/DatePicker/DatePicker.classes.d.ts +3 -3
- package/src/DatePicker/DatePicker.d.ts +1 -1
- package/src/DatePicker/DatePicker.type.d.ts +3 -3
- package/src/DatePicker/DatePickerHeader.d.ts +3 -2
- package/src/DatePicker/Day.d.ts +2 -2
- package/src/DatePicker/SlideDirection.d.ts +1 -1
- package/src/DatePicker/Year.d.ts +2 -2
- package/src/DatePicker/Years.d.ts +1 -1
- package/src/DatePicker/utils/DatePickerAriaLabelUtils.d.ts +12 -4
- package/src/DatePicker/utils/DatePickerUtils.d.ts +1 -1
- package/src/DatePicker/utils/findClosestEnabledDate.d.ts +1 -1
- package/src/DateUtilsContext/DateUtilsContext.d.ts +8 -2
- package/src/Dialer/DialDelete/DialDelete.d.ts +1 -1
- package/src/Dialer/DialPad/DialPad.classes.d.ts +3 -3
- package/src/Dialer/DialPad/DialPad.d.ts +2 -2
- package/src/Dialer/DialPad/utils/DialPadUtils.d.ts +3 -3
- package/src/Dialer/DialPad/utils/types.d.ts +2 -2
- package/src/Dialer/DialPad/utils/useDialKeyboard.d.ts +1 -1
- package/src/Dialer/DialPad/utils/useKeyAudio.d.ts +1 -1
- package/src/Dialer/DialPadButton/DialPadButton.classes.d.ts +3 -3
- package/src/Dialer/DialPadButton/DialPadButton.d.ts +1 -1
- package/src/Dialer/DialTextField/DialTextField.d.ts +2 -2
- package/src/Dialer/Dialer.d.ts +1 -1
- package/src/Dialer/utils/DialerContext.d.ts +1 -1
- package/src/Dialog/Dialog.classes.d.ts +14 -14
- package/src/Dialog/Dialog.d.ts +1 -1
- package/src/Dialog/Dialog.type.d.ts +5 -4
- package/src/Divider/Divider.classes.d.ts +4 -4
- package/src/Divider/Divider.type.d.ts +7 -7
- package/src/DragHandle/DragHandle.classes.d.ts +3 -3
- package/src/DragHandle/DragHandle.type.d.ts +5 -5
- package/src/Drawer/Drawer.classes.d.ts +5 -5
- package/src/Drawer/Drawer.d.ts +1 -1
- package/src/Drawer/Drawer.type.d.ts +4 -4
- package/src/Dropdown/Dropdown.classes.d.ts +3 -3
- package/src/Dropdown/Dropdown.type.d.ts +1 -1
- package/src/EmptyState/EmptyState.classes.d.ts +3 -3
- package/src/EmptyState/EmptyState.d.ts +1 -1
- package/src/EmptyState/EmptyState.type.d.ts +1 -1
- package/src/FabButton/FabButton.classes.d.ts +3 -3
- package/src/FabButton/FabButton.type.d.ts +5 -5
- package/src/FocusTrap/FocusTrap.d.ts +2 -2
- package/src/FormField/FormField.classes.d.ts +4 -4
- package/src/FormField/FormField.type.d.ts +3 -3
- package/src/FormLabel/FormLabel.classes.d.ts +4 -4
- package/src/FormLabel/FormLabel.d.ts +1 -1
- package/src/FormLabel/FormLabel.type.d.ts +2 -2
- package/src/FormLabel/FormLabelContext.d.ts +1 -1
- package/src/Icon/Icon.classes.d.ts +3 -3
- package/src/Icon/Icon.d.ts +1 -1
- package/src/Icon/Icon.type.d.ts +2 -2
- package/src/IconButton/IconButton.classes.d.ts +3 -3
- package/src/IconButton/IconButton.type.d.ts +9 -9
- package/src/IconButton/IconButtonLabel.classes.d.ts +3 -3
- package/src/IconButton/IconButtonLabel.d.ts +1 -1
- package/src/IconButton/IconButtonLabel.type.d.ts +1 -1
- package/src/IconButtonGroup/IconButtonGroup.classes.d.ts +3 -3
- package/src/IconButtonGroup/IconButtonGroup.type.d.ts +4 -4
- package/src/InlineEditable/InlineEditable.classes.d.ts +4 -4
- package/src/InlineEditable/InlineEditable.type.d.ts +5 -5
- package/src/LinearProgressIndicator/LinearProgressIndicator.classes.d.ts +4 -4
- package/src/LinearProgressIndicator/LinearProgressIndicator.type.d.ts +2 -2
- package/src/Link/Link.classes.d.ts +4 -4
- package/src/Link/Link.type.d.ts +4 -4
- package/src/List/List.classes.d.ts +3 -3
- package/src/List/List.type.d.ts +1 -1
- package/src/ListItem/HoverActions.d.ts +1 -1
- package/src/ListItem/ListItem.classes.d.ts +3 -3
- package/src/ListItem/ListItem.d.ts +1 -1
- package/src/ListItem/ListItem.type.d.ts +1 -1
- package/src/ListItemText/ListItemText.classes.d.ts +4 -4
- package/src/ListItemText/ListItemText.d.ts +1 -1
- package/src/ListItemText/ListItemText.type.d.ts +2 -2
- package/src/ListNavigation/ListNavigationContext.d.ts +1 -1
- package/src/ListNavigation/useListNavigation.d.ts +6 -6
- package/src/Menu/Menu.classes.d.ts +3 -3
- package/src/Menu/Menu.d.ts +1 -1
- package/src/Menu/Menu.type.d.ts +1 -1
- package/src/Menu/MenuContext.d.ts +1 -1
- package/src/MenuActions/MenuActions.classes.d.ts +6 -6
- package/src/MenuActions/MenuActions.type.d.ts +1 -1
- package/src/MenuDivider/MenuDivider.classes.d.ts +3 -3
- package/src/MenuDivider/MenuDivider.type.d.ts +1 -1
- package/src/MenuFooter/MenuFooter.classes.d.ts +3 -3
- package/src/MenuFooter/MenuFooter.type.d.ts +1 -1
- package/src/MenuHeader/MenuHeader.classes.d.ts +3 -3
- package/src/MenuHeader/MenuHeader.type.d.ts +1 -1
- package/src/MenuItem/MenuItem.classes.d.ts +3 -3
- package/src/MenuItem/MenuItem.d.ts +1 -1
- package/src/MenuItem/MenuItem.type.d.ts +1 -1
- package/src/MenuItem/MenuItemSelectContext.d.ts +1 -1
- package/src/MenuItem/useMenuItem.d.ts +1 -1
- package/src/MenuItem/useMenuItemSelect.d.ts +5 -5
- package/src/MenuItem/useVirtualizedMenuItem.d.ts +2 -1
- package/src/MenuItemText/MenuItemText.classes.d.ts +3 -3
- package/src/MenuItemText/MenuItemText.d.ts +1 -1
- package/src/MenuItemText/MenuItemText.type.d.ts +1 -1
- package/src/MenuList/MenuList.classes.d.ts +3 -3
- package/src/MenuList/MenuList.type.d.ts +1 -1
- package/src/MenuList/MenuListContext.d.ts +1 -1
- package/src/Modal/InnerModal.d.ts +1 -1
- package/src/Modal/InnerModal.type.d.ts +2 -2
- package/src/Modal/Modal.classes.d.ts +3 -3
- package/src/Modal/Modal.d.ts +1 -1
- package/src/Modal/Modal.type.d.ts +1 -1
- package/src/Modal/ModalContext.d.ts +1 -1
- package/src/NestedMenuContext/MenuOverlayGroupContext.d.ts +15 -0
- package/src/NestedMenuContext/NestedMenuContext.d.ts +22 -5
- package/src/NestedMenuContext/SubMenuTriggerNestedIdContext.d.ts +2 -0
- package/src/NestedMenuContext/pointerGrace.d.ts +8 -0
- package/src/NestedMenuContext/useNestedChildMenu.d.ts +4 -2
- package/src/NestedMenuContext/useNestedMenuItem.d.ts +8 -3
- package/src/NestedMenuContext/useNestedParentMenu.d.ts +8 -1
- package/src/Option/Option.d.ts +1 -1
- package/src/Option/Option.type.d.ts +1 -1
- package/src/Overlap/Overlap.classes.d.ts +3 -3
- package/src/Overlap/Overlap.type.d.ts +8 -8
- package/src/PageHeader/PageHeader.classes.d.ts +15 -15
- package/src/PageHeader/PageHeader.type.d.ts +6 -6
- package/src/PickerTextField/PickerTextField.classes.d.ts +3 -3
- package/src/PickerTextField/PickerTextField.d.ts +1 -1
- package/src/PickerTextField/PickerTextField.type.d.ts +2 -2
- package/src/Popover/Popover.classes.d.ts +3 -3
- package/src/Popover/Popover.d.ts +1 -1
- package/src/Popover/Popover.type.d.ts +2 -2
- package/src/Popper/Popper.d.ts +1 -1
- package/src/Popper/Popper.type.d.ts +4 -4
- package/src/PopperPaper/PopperPaper.classes.d.ts +3 -3
- package/src/PopperPaper/PopperPaper.d.ts +1 -1
- package/src/PopperPaper/PopperPaper.type.d.ts +1 -1
- package/src/Radio/Radio.classes.d.ts +3 -3
- package/src/Radio/Radio.d.ts +2 -2
- package/src/Radio/Radio.type.d.ts +1 -1
- package/src/RadioGroup/RadioGroup.classes.d.ts +3 -3
- package/src/RadioGroup/RadioGroup.context.d.ts +1 -1
- package/src/RadioGroup/RadioGroup.d.ts +1 -1
- package/src/RadioGroup/RadioGroup.type.d.ts +1 -1
- package/src/Rating/Rating.classes.d.ts +3 -3
- package/src/Rating/Rating.d.ts +1 -1
- package/src/Rating/Rating.type.d.ts +2 -2
- package/src/Rating/RatingItem.d.ts +1 -1
- package/src/Select/Select.classes.d.ts +4 -4
- package/src/Select/Select.type.d.ts +5 -5
- package/src/Select/useSelect.d.ts +1 -1
- package/src/SingleFilter/FilterButton/FilterButton.classes.d.ts +3 -3
- package/src/SingleFilter/FilterButton/FilterButton.d.ts +1 -1
- package/src/SingleFilter/FilterButton/FilterButton.type.d.ts +2 -2
- package/src/SingleFilter/SingleFilter.classes.d.ts +3 -3
- package/src/SingleFilter/SingleFilter.d.ts +1 -1
- package/src/SingleFilter/SingleFilter.type.d.ts +2 -2
- package/src/Skeleton/Skeleton.classes.d.ts +3 -3
- package/src/Skeleton/Skeleton.type.d.ts +1 -1
- package/src/Skeleton/SkeletonContainer/SkeletonContainer.classes.d.ts +3 -3
- package/src/Skeleton/SkeletonContainer/SkeletonContainer.type.d.ts +5 -5
- package/src/Slider/Slider.classes.d.ts +4 -4
- package/src/Slider/Slider.d.ts +3 -3
- package/src/Slider/Slider.type.d.ts +2 -2
- package/src/Slider/SliderThumb.d.ts +1 -1
- package/src/Snackbar/Snackbar.classes.d.ts +3 -3
- package/src/Snackbar/Snackbar.d.ts +1 -1
- package/src/Snackbar/Snackbar.type.d.ts +1 -1
- package/src/Snackbar/SnackbarContent/SnackbarContent.classes.d.ts +3 -3
- package/src/Snackbar/SnackbarContent/SnackbarContent.type.d.ts +1 -1
- package/src/SortableList/SortableList.type.d.ts +1 -1
- package/src/SortableListDndContext/SortableListDndContext.type.d.ts +2 -2
- package/src/SortableListItem/SortableListItem.d.ts +1 -1
- package/src/SortableListItem/SortableListItem.type.d.ts +2 -2
- package/src/SortableListItem/SortableListItemOverlay.d.ts +1 -1
- package/src/SortableListItem/SortableListItemOverlay.type.d.ts +1 -1
- package/src/SortableVirtualizedList/SortableVirtualizedList.type.d.ts +1 -1
- package/src/SplitButton/SplitButton.classes.d.ts +3 -3
- package/src/SplitButton/SplitButton.d.ts +1 -1
- package/src/SplitButton/SplitButton.type.d.ts +1 -1
- package/src/Squircle/Squircle.type.d.ts +5 -5
- package/src/Squircle/squircle.classes.d.ts +3 -3
- package/src/StatusIndicator/StatusIndicator.classes.d.ts +3 -3
- package/src/StatusIndicator/StatusIndicator.type.d.ts +1 -1
- package/src/Step/Step.classes.d.ts +3 -3
- package/src/Step/Step.type.d.ts +5 -5
- package/src/Step/StepContext.d.ts +1 -1
- package/src/StepButton/StepButton.classes.d.ts +3 -3
- package/src/StepButton/StepButton.type.d.ts +5 -5
- package/src/StepConnector/StepConnector.classes.d.ts +3 -3
- package/src/StepConnector/StepConnector.type.d.ts +1 -1
- package/src/StepContent/StepContent.classes.d.ts +3 -3
- package/src/StepContent/StepContent.d.ts +1 -1
- package/src/StepContent/StepContent.type.d.ts +1 -1
- package/src/StepIcon/StepIcon.classes.d.ts +3 -3
- package/src/StepIcon/StepIcon.type.d.ts +1 -1
- package/src/StepLabel/StepLabel.classes.d.ts +4 -4
- package/src/StepLabel/StepLabel.d.ts +1 -1
- package/src/StepLabel/StepLabel.type.d.ts +1 -1
- package/src/Stepper/Stepper.classes.d.ts +3 -3
- package/src/Stepper/Stepper.type.d.ts +6 -6
- package/src/Stepper/StepperContext.d.ts +1 -1
- package/src/SubMenu/PopperMenu.classes.d.ts +3 -3
- package/src/SubMenu/PopperMenu.d.ts +1 -1
- package/src/SubMenu/PopperMenu.type.d.ts +1 -1
- package/src/SubMenu/SubMenu.d.ts +1 -1
- package/src/SubMenu/SubMenu.type.d.ts +1 -1
- package/src/SubMenu/useSubMenuInteractionState.d.ts +13 -0
- package/src/SubMenu/useSubMenuPointerGrace.d.ts +15 -0
- package/src/SwipeableDrawer/SwipeableDrawer.classes.d.ts +3 -3
- package/src/SwipeableDrawer/SwipeableDrawer.d.ts +1 -1
- package/src/SwipeableDrawer/SwipeableDrawer.types.d.ts +2 -2
- package/src/SwipeableDrawer/hooks/useSnapPoints.d.ts +1 -1
- package/src/Switch/Switch.classes.d.ts +3 -3
- package/src/Switch/Switch.d.ts +4 -2
- package/src/Switch/Switch.type.d.ts +4 -1
- package/src/Tab/Tab.classes.d.ts +4 -4
- package/src/Tab/Tab.d.ts +1 -1
- package/src/Tab/Tab.type.d.ts +4 -4
- package/src/TabContext/TabContext.type.d.ts +1 -1
- package/src/TabPanel/TabPanel.classes.d.ts +3 -3
- package/src/TabPanel/TabPanel.d.ts +1 -1
- package/src/TabPanel/TabPanel.type.d.ts +1 -1
- package/src/Table/Table.classes.d.ts +3 -3
- package/src/Table/Table.type.d.ts +5 -5
- package/src/Table/TableContext.d.ts +1 -1
- package/src/Table/Tablelvl2Context.d.ts +1 -1
- package/src/TableBody/TableBody.classes.d.ts +3 -3
- package/src/TableBody/TableBody.type.d.ts +5 -5
- package/src/TableCell/TableCell.classes.d.ts +3 -3
- package/src/TableCell/TableCell.type.d.ts +7 -7
- package/src/TableContainer/TableContainer.classes.d.ts +3 -3
- package/src/TableContainer/TableContainer.type.d.ts +6 -6
- package/src/TableFooter/TableFooter.classes.d.ts +3 -3
- package/src/TableFooter/TableFooter.d.ts +1 -1
- package/src/TableFooter/TableFooter.type.d.ts +1 -1
- package/src/TableHead/TableHead.classes.d.ts +3 -3
- package/src/TableHead/TableHead.type.d.ts +5 -5
- package/src/TablePagination/TablePagination.classes.d.ts +3 -3
- package/src/TablePagination/TablePagination.type.d.ts +8 -6
- package/src/TableRow/TableRow.classes.d.ts +3 -3
- package/src/TableRow/TableRow.type.d.ts +5 -5
- package/src/Tabs/TabMoreMenu.d.ts +2 -2
- package/src/Tabs/TabScrollButton.d.ts +2 -2
- package/src/Tabs/Tabs.classes.d.ts +9 -9
- package/src/Tabs/Tabs.d.ts +1 -1
- package/src/Tabs/Tabs.type.d.ts +2 -2
- package/src/Tabs/TabsContext.d.ts +1 -1
- package/src/Tabs/hooks/useTabsScroller.d.ts +3 -3
- package/src/Tag/Tag.classes.d.ts +3 -3
- package/src/Tag/Tag.d.ts +1 -1
- package/src/Tag/Tag.type.d.ts +2 -2
- package/src/Text/Text.classes.d.ts +3 -3
- package/src/Text/Text.type.d.ts +5 -5
- package/src/TextField/TextField.classes.d.ts +3 -3
- package/src/TextField/TextField.d.ts +1 -1
- package/src/TextField/TextField.type.d.ts +9 -9
- package/src/Textarea/Textarea.classes.d.ts +4 -4
- package/src/Textarea/Textarea.d.ts +1 -1
- package/src/Textarea/Textarea.type.d.ts +3 -3
- package/src/TimePicker/NumberPicker.d.ts +1 -1
- package/src/TimePicker/NumberPicker.type.d.ts +3 -3
- package/src/TimePicker/PickerView.type.d.ts +3 -3
- package/src/TimePicker/SelectionView.d.ts +1 -1
- package/src/TimePicker/TimeButton.d.ts +1 -1
- package/src/TimePicker/TimePicker.classes.d.ts +3 -3
- package/src/TimePicker/TimePicker.type.d.ts +1 -1
- package/src/TimePicker/ToggleText.d.ts +1 -1
- package/src/TimePicker/ToggleText.type.d.ts +2 -2
- package/src/TimePicker/utils/TimeBoundary.d.ts +3 -3
- package/src/TimePicker/utils/TimePickerHelper.d.ts +5 -5
- package/src/TimePicker/utils/getNumberPickerBoundary.d.ts +1 -1
- package/src/TimePicker/utils/runKeyHandler.d.ts +1 -1
- package/src/Tooltip/Tooltip.type.d.ts +1 -1
- package/src/Tooltip/TooltipTrigger.a11y.d.ts +4 -4
- package/src/Tooltip/TooltipTrigger.type.d.ts +1 -1
- package/src/Tooltip/TooltipView.classes.d.ts +3 -3
- package/src/Tooltip/TooltipView.type.d.ts +2 -2
- package/src/Tooltip/withTooltip/withTooltip.d.ts +1 -1
- package/src/Tray/Tray.classes.d.ts +6 -6
- package/src/Tray/Tray.d.ts +1 -1
- package/src/Tray/Tray.type.d.ts +2 -2
- package/src/Tray/TrayContext.d.ts +1 -1
- package/src/Tray/TrayPanel.d.ts +1 -1
- package/src/Tray/hooks/useTray.d.ts +2 -2
- package/src/Tray/hooks/useTrayPanel.d.ts +2 -2
- package/src/Tray/types.d.ts +2 -2
- package/src/TrayMenu/TrayMenu.d.ts +1 -1
- package/src/TrayMenu/TrayMenu.type.d.ts +1 -1
- package/src/TrayMenu/TrayMenuItem.d.ts +2 -2
- package/src/VirtualizedList/VirtualizedItemPropsContext.d.ts +1 -1
- package/src/VirtualizedList/VirtualizedList.type.d.ts +2 -2
- package/src/VirtualizedList/VirtuosoContextType.d.ts +1 -1
- package/src/VirtualizedMenu/VirtualizedMenu.classes.d.ts +3 -3
- package/src/VirtualizedMenu/VirtualizedMenu.context.d.ts +1 -1
- package/src/VirtualizedMenu/VirtualizedMenu.type.d.ts +1 -1
- package/src/VirtualizedMenu/VirtualizedMenuList.d.ts +1 -1
- package/src/VisuallyHidden/VisuallyHidden.classes.d.ts +3 -3
- package/src/VisuallyHidden/VisuallyHidden.type.d.ts +1 -1
- package/src/internal/utils/composeEventHandlers.d.ts +7 -0
- package/src/internal/utils/index.d.ts +1 -0
- package/src/Animation/hooks/useMotionSafeTransition/useMotionSafeTransition.d.ts +0 -6
package/Alert.js
CHANGED
package/Announcement.js
CHANGED
|
@@ -3,7 +3,7 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import { useClasses } from '@ringcentral/spring-base';
|
|
4
4
|
import { InfoMd, AlertMd, SuccessMd } from '@ringcentral/spring-icon';
|
|
5
5
|
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
6
|
-
import {
|
|
6
|
+
import { a as Alert } from './chunks/Alert.js';
|
|
7
7
|
import 'clsx';
|
|
8
8
|
import './chunks/Icon.js';
|
|
9
9
|
import './chunks/IconButtonLabel.js';
|
|
@@ -32,7 +32,9 @@ const DEFAULT_ICON_MAP = {
|
|
|
32
32
|
};
|
|
33
33
|
const Announcement = forwardRef((inProps, ref) => {
|
|
34
34
|
const props = useThemeProps({ props: inProps, name: 'Announcement' });
|
|
35
|
-
const { classes, className, severity = 'neutral', startSlot =
|
|
35
|
+
const { classes, className, severity = 'neutral', icon, startSlot = icon === undefined || icon === true
|
|
36
|
+
? DEFAULT_ICON_MAP[severity]
|
|
37
|
+
: icon || null, CloseButtonProps, ...rest } = props;
|
|
36
38
|
const cls = useClasses('announcement', classes, className);
|
|
37
39
|
return (jsx(Alert, { ref: ref, ...rest, startSlot: startSlot, CloseButtonProps: { variant: 'inverted', ...CloseButtonProps }, classes: {
|
|
38
40
|
root: cls('root', severity),
|
package/Autocomplete.js
CHANGED
|
@@ -841,7 +841,7 @@ const SuggestionList = forwardRef((inProps, ref) => {
|
|
|
841
841
|
});
|
|
842
842
|
SuggestionList.displayName = 'SuggestionList';
|
|
843
843
|
|
|
844
|
-
var Autocomplete$1 = {"sui-autocomplete-chevron":"sui-autocomplete-chevron","sui-autocomplete-clear":"sui-autocomplete-clear","sui-autocomplete-root":"sui-autocomplete-root","sui-focused":"sui-focused","sui-disabled":"sui-disabled","sui-autocomplete-input-container":"sui-autocomplete-input-container","sui-autocomplete-form-field-content":"sui-autocomplete-form-field-content","sui-autocomplete-form-field-content-xlarge":"sui-autocomplete-form-field-content-xlarge","sui-autocomplete-form-field-content-large":"sui-autocomplete-form-field-content-large","sui-autocomplete-form-field-content-medium":"sui-autocomplete-form-field-content-medium","sui-autocomplete-input-container-xlarge":"sui-autocomplete-input-container-xlarge","sui-autocomplete-input-container-large":"sui-autocomplete-input-container-large","sui-autocomplete-input-container-medium":"sui-autocomplete-input-container-medium","sui-autocomplete-input":"sui-autocomplete-input","sui-autocomplete-input-xlarge":"sui-autocomplete-input-xlarge","sui-autocomplete-input-large":"sui-autocomplete-input-large","sui-autocomplete-input-medium":"sui-autocomplete-input-medium","sui-autocomplete-outlined-expanded":"sui-autocomplete-outlined-expanded","sui-autocomplete-outlined-expanded-chevron":"sui-autocomplete-outlined-expanded-chevron","sui-autocomplete-standard-expanded-chevron":"sui-autocomplete-standard-expanded-chevron","sui-autocomplete-error-chevron":"sui-autocomplete-error-chevron","sui-autocomplete-end-adornment":"sui-autocomplete-end-adornment","sui-autocomplete-popper-root":"sui-autocomplete-popper-root","sui-popper-widget":"sui-popper-widget","sui-autocomplete-popper-paper":"sui-autocomplete-popper-paper","sui-autocomplete-popper-empty":"sui-autocomplete-popper-empty"};
|
|
844
|
+
var Autocomplete$1 = {"sui-autocomplete-chevron":"sui-autocomplete-chevron","sui-autocomplete-clear":"sui-autocomplete-clear","sui-autocomplete-root":"sui-autocomplete-root","sui-focused":"sui-focused","sui-disabled":"sui-disabled","sui-autocomplete-input-container":"sui-autocomplete-input-container","sui-autocomplete-form-field-content":"sui-autocomplete-form-field-content","sui-autocomplete-form-field-content-xlarge":"sui-autocomplete-form-field-content-xlarge","sui-autocomplete-form-field-content-large":"sui-autocomplete-form-field-content-large","sui-autocomplete-form-field-content-medium":"sui-autocomplete-form-field-content-medium","sui-autocomplete-input-container-xlarge":"sui-autocomplete-input-container-xlarge","sui-autocomplete-input-container-large":"sui-autocomplete-input-container-large","sui-autocomplete-input-container-medium":"sui-autocomplete-input-container-medium","sui-autocomplete-input":"sui-autocomplete-input","sui-autocomplete-input-xlarge":"sui-autocomplete-input-xlarge","sui-autocomplete-input-large":"sui-autocomplete-input-large","sui-autocomplete-input-medium":"sui-autocomplete-input-medium","sui-autocomplete-outlined-expanded":"sui-autocomplete-outlined-expanded","sui-autocomplete-outlined-expanded-chevron":"sui-autocomplete-outlined-expanded-chevron","sui-autocomplete-standard-expanded-chevron":"sui-autocomplete-standard-expanded-chevron","sui-autocomplete-error-chevron":"sui-autocomplete-error-chevron","sui-autocomplete-end-adornment":"sui-autocomplete-end-adornment","sui-autocomplete-popper-root":"sui-autocomplete-popper-root","sui-popper-widget":"sui-popper-widget","sui-autocomplete-popper-paper":"sui-autocomplete-popper-paper","sui-autocomplete-popper-empty":"sui-autocomplete-popper-empty","sui-autocomplete-status-container":"sui-autocomplete-status-container","sui-autocomplete-status-label":"sui-autocomplete-status-label"};
|
|
845
845
|
|
|
846
846
|
function stringArrToRegExp(keyToTags) {
|
|
847
847
|
return new RegExp(keyToTags?.join('|') || '', 'g');
|
|
@@ -1140,15 +1140,45 @@ const useAutocomplete = ({ multiple: multipleProp, variant, inputValue: inputVal
|
|
|
1140
1140
|
if (item && freeSolo) {
|
|
1141
1141
|
switch (addNoOptionItem) {
|
|
1142
1142
|
case 'first':
|
|
1143
|
+
noOptionItemRef.current = null;
|
|
1143
1144
|
return [item, ...results];
|
|
1144
1145
|
case 'last':
|
|
1146
|
+
noOptionItemRef.current = null;
|
|
1145
1147
|
return [...results, item];
|
|
1146
1148
|
}
|
|
1147
1149
|
}
|
|
1150
|
+
if (results.length === 0 && renderNoOptions === true) {
|
|
1151
|
+
if (item) {
|
|
1152
|
+
noOptionItemRef.current = item;
|
|
1153
|
+
}
|
|
1154
|
+
else {
|
|
1155
|
+
noOptionItemRef.current = {
|
|
1156
|
+
id: EMPTY_TAG_TOKEN,
|
|
1157
|
+
label: '',
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
else if (results.length > 0) {
|
|
1162
|
+
noOptionItemRef.current = null;
|
|
1163
|
+
}
|
|
1164
|
+
return results;
|
|
1148
1165
|
}
|
|
1149
|
-
|
|
1166
|
+
if (results.length === 0) {
|
|
1150
1167
|
const item = getInputValueAsItem();
|
|
1151
|
-
|
|
1168
|
+
if (renderNoOptions === true) {
|
|
1169
|
+
if (item) {
|
|
1170
|
+
noOptionItemRef.current = item;
|
|
1171
|
+
}
|
|
1172
|
+
else {
|
|
1173
|
+
noOptionItemRef.current = {
|
|
1174
|
+
id: EMPTY_TAG_TOKEN,
|
|
1175
|
+
label: '',
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
else {
|
|
1180
|
+
noOptionItemRef.current = item;
|
|
1181
|
+
}
|
|
1152
1182
|
if (item && freeSolo && !renderNoOptions) {
|
|
1153
1183
|
return [...results, item];
|
|
1154
1184
|
}
|
|
@@ -1590,7 +1620,7 @@ const TextInput = forwardRef(({ renderInput, ...rest }, ref) => {
|
|
|
1590
1620
|
const Autocomplete = forwardRef((inProps, ref) => {
|
|
1591
1621
|
const props = useThemeProps({ props: inProps, name: 'Autocomplete' });
|
|
1592
1622
|
const isAutocomplete = props.variant === 'autocomplete';
|
|
1593
|
-
const { inputVariant = 'standard', variant, groupExpanded, onGroupExpanded, groupDefaultExpanded, groupVariant = 'normal', getExpandIconProps, groupBy, value: valueProp, autoHighlight = true, clearBtn = false, toggleButton = false, multiple = false, ClearButtonProps, onClear, ToggleButtonProps, getToggleButtonProps: getToggleButtonPropsProp, inputValue: inputValueProp, onKeyDown: onKeyDownProp, helperText: helperTextProp, options, openOnFocus = true, toggleWithInput = true, getOptionLabel = DEFAULT_GET_OPTION_LABEL, renderInput, label, inputRef: inputRefProp, error, placeholder, showPlaceholderWithTags, freeSolo, keyToTags = DEFAULT_KEY_TO_CHIPS, maxFreeSolo, SuggestionListProps: { virtualize = true, ...SuggestionListProps } = {}, autoSelect, PopperComponent = Popper, PopperProps: { anchorElType = 'root', ...PopperProps } = {}, initialIsOpen, disabled, required: requiredProp, disableCloseOnSelect = multiple, onChange: onChangeProp, onInputChange: onInputChangeProp, onMaxFreeSolo, FormHelperTextProps, action, filterOptions, renderOption, renderTags, getOptionDisabled, renderGroup, renderNoOptions, inputProps, debug, disabledItemsHighlightable, open: openProp, addNoOptionItem, onOpen, onClose, focused, classes, className, fullWidth = true, size = 'xlarge', isOptionEqualToValue, ...rest } = props;
|
|
1623
|
+
const { inputVariant = 'standard', variant, groupExpanded, onGroupExpanded, groupDefaultExpanded, groupVariant = 'normal', getExpandIconProps, groupBy, value: valueProp, autoHighlight = true, clearBtn = false, toggleButton = false, multiple = false, ClearButtonProps, onClear, ToggleButtonProps, getToggleButtonProps: getToggleButtonPropsProp, inputValue: inputValueProp, onKeyDown: onKeyDownProp, helperText: helperTextProp, options, openOnFocus = true, toggleWithInput = true, getOptionLabel = DEFAULT_GET_OPTION_LABEL, renderInput, label, inputRef: inputRefProp, error, placeholder, showPlaceholderWithTags, freeSolo, keyToTags = DEFAULT_KEY_TO_CHIPS, maxFreeSolo, SuggestionListProps: { virtualize = true, ...SuggestionListProps } = {}, autoSelect, PopperComponent = Popper, PopperProps: { anchorElType = 'root', ...PopperProps } = {}, initialIsOpen, disabled, required: requiredProp, disableCloseOnSelect = multiple, onChange: onChangeProp, onInputChange: onInputChangeProp, onMaxFreeSolo, FormHelperTextProps, action, filterOptions, renderOption, renderTags, getOptionDisabled, renderGroup, renderNoOptions, noOptionsText = 'No matches found', inputProps, debug, disabledItemsHighlightable, open: openProp, addNoOptionItem, onOpen, onClose, focused, classes, className, fullWidth = true, size = 'xlarge', isOptionEqualToValue, ...rest } = props;
|
|
1594
1624
|
const cls = useClasses('autocomplete', classes, className);
|
|
1595
1625
|
const innerInputRef = useRef(null);
|
|
1596
1626
|
const textFieldRef = useRef(null);
|
|
@@ -1694,10 +1724,13 @@ const Autocomplete = forwardRef((inProps, ref) => {
|
|
|
1694
1724
|
focus: focusInput,
|
|
1695
1725
|
}));
|
|
1696
1726
|
const hasTags = selectedItems.length > 0;
|
|
1697
|
-
const
|
|
1727
|
+
const hasNoOptionItem = !!noOptionItem;
|
|
1728
|
+
const shouldRenderNoOptions = renderNoOptions === true || typeof renderNoOptions === 'function';
|
|
1729
|
+
const willRenderNoOptions = hasNoOptionItem && shouldRenderNoOptions;
|
|
1698
1730
|
const prevHighlightedIndex = usePrevious(() => highlightedIndex, true);
|
|
1699
|
-
const menuChildren = isOpen && (jsxs(Fragment, { children: [jsx(SuggestionList, { highlightedIndex: highlightedIndex, prevHighlightedIndex: prevHighlightedIndex, optionsGroupList: optionsGroupList, options: optionItems, groupVariant: groupVariant, groupExpanded: groupExpanded, renderGroup: renderGroup, renderOption: renderOption, inputValue: inputValue, getItemProps: getItemProps, getSuggestionListProps: getSuggestionListProps, changeHighlightedIndexReason: changeHighlightedIndexReason, getOptionDisabled: getOptionDisabled, isKeepHighlightedIndex: isKeepHighlightedIndex, maxContainerHeight: 180, getOptionLabel: getOptionLabel, position: "unset", virtualize: virtualize, ...SuggestionListProps }), willRenderNoOptions &&
|
|
1700
|
-
|
|
1731
|
+
const menuChildren = isOpen && (jsxs(Fragment, { children: [jsx(SuggestionList, { highlightedIndex: highlightedIndex, prevHighlightedIndex: prevHighlightedIndex, optionsGroupList: optionsGroupList, options: optionItems, groupVariant: groupVariant, groupExpanded: groupExpanded, renderGroup: renderGroup, renderOption: renderOption, inputValue: inputValue, getItemProps: getItemProps, getSuggestionListProps: getSuggestionListProps, changeHighlightedIndexReason: changeHighlightedIndexReason, getOptionDisabled: getOptionDisabled, isKeepHighlightedIndex: isKeepHighlightedIndex, maxContainerHeight: 180, getOptionLabel: getOptionLabel, position: "unset", virtualize: virtualize, ...SuggestionListProps }), willRenderNoOptions && (jsx(Fragment, { children: renderNoOptions === true ? (jsx("div", { ...getNoOptionsProps({
|
|
1732
|
+
className: cls('status-container'),
|
|
1733
|
+
}), children: jsx("span", { className: cls('status-label'), children: noOptionsText }) })) : typeof renderNoOptions === 'function' ? (renderNoOptions(getNoOptionsProps, noOptionItem)) : null }))] }));
|
|
1701
1734
|
const isPopperContentEmpty = !isOpen || (!willRenderNoOptions && optionItems.length === 0);
|
|
1702
1735
|
const popperCls = useClasses('autocomplete-popper', PopperProps?.classes, PopperProps?.className);
|
|
1703
1736
|
return (jsxs(Fragment, { children: [jsx(TextInput, { renderInput: renderInput, variant: inputVariant, ref: toTextFieldRef, inputRef: inputRef, fullWidth: fullWidth, placeholder: !hasTags || (hasTags && multiple && showPlaceholderWithTags)
|
package/Avatar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, useContext } from 'react';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, Children } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useImgLoaded, useClasses, useFocusVisible, useForkRef } from '@ringcentral/spring-base';
|
|
5
5
|
import { ProfileMd } from '@ringcentral/spring-icon';
|
|
@@ -30,6 +30,7 @@ const StatusIndicatorSizeMap = {
|
|
|
30
30
|
xsmall: undefined,
|
|
31
31
|
xxsmall: undefined,
|
|
32
32
|
};
|
|
33
|
+
const hasRenderableFallbackChildren = (children) => Children.toArray(children).some((child) => child !== '');
|
|
33
34
|
const Avatar = forwardRef((inProps, ref) => {
|
|
34
35
|
const props = useThemeProps({ props: inProps, name: 'Avatar' });
|
|
35
36
|
const { component, classes, className, children: childrenProp, imgProps, alt, src, srcSet, size: sizeProp, color = 'default', variant = 'circle', clickable: clickableProp, symbol, avatarShapeRef, showStatusIndicator, IndicatorProps, rootProps, disabled, onClick, ...rest } = props;
|
|
@@ -39,54 +40,68 @@ const Avatar = forwardRef((inProps, ref) => {
|
|
|
39
40
|
src,
|
|
40
41
|
srcSet,
|
|
41
42
|
});
|
|
42
|
-
const hasImg = src || srcSet;
|
|
43
|
-
const
|
|
43
|
+
const hasImg = Boolean(src || srcSet);
|
|
44
|
+
const shouldShowImage = hasImg && loaded === 'loaded';
|
|
45
|
+
const shouldMountImage = hasImg && loaded !== 'error';
|
|
46
|
+
const shouldShowFallback = !shouldShowImage;
|
|
44
47
|
const cls = useClasses('avatar', classes, className);
|
|
45
48
|
const imageProps = {
|
|
46
49
|
alt,
|
|
47
50
|
src,
|
|
48
51
|
srcSet,
|
|
49
52
|
...imgProps,
|
|
50
|
-
|
|
53
|
+
'aria-hidden': shouldShowFallback ? true : imgProps?.['aria-hidden'],
|
|
54
|
+
className: clsx(cls('img'), imgProps?.className, shouldShowFallback && 'sr-only'),
|
|
51
55
|
};
|
|
56
|
+
const AvatarImg = 'img';
|
|
57
|
+
const image = shouldMountImage ? jsx(AvatarImg, { ...imageProps }) : null;
|
|
52
58
|
const groupContext = useContext(AvatarGroupContext);
|
|
53
59
|
const size = sizeProp || groupContext?.size || 'xlarge';
|
|
54
60
|
const groupClassName = groupContext?.className || '';
|
|
55
61
|
let fillShape = false;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
else if (symbol) {
|
|
62
|
-
children = jsx(Icon, { size: IconSizeMap[size], symbol: symbol });
|
|
62
|
+
let fallback = null;
|
|
63
|
+
let fallbackFillShape = false;
|
|
64
|
+
if (symbol) {
|
|
65
|
+
fallback = jsx(Icon, { size: IconSizeMap[size], symbol: symbol });
|
|
63
66
|
}
|
|
64
|
-
else if (childrenProp) {
|
|
65
|
-
|
|
67
|
+
else if (hasRenderableFallbackChildren(childrenProp)) {
|
|
68
|
+
fallback = childrenProp;
|
|
66
69
|
}
|
|
67
70
|
else if (hasImg && alt) {
|
|
68
|
-
|
|
71
|
+
fallback = alt[0];
|
|
72
|
+
fallbackFillShape = true;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
fallback = jsx(Icon, { size: IconSizeMap[size], symbol: ProfileMd });
|
|
76
|
+
}
|
|
77
|
+
if (shouldShowImage) {
|
|
78
|
+
children = image;
|
|
69
79
|
fillShape = true;
|
|
70
80
|
}
|
|
71
81
|
else {
|
|
72
|
-
children =
|
|
82
|
+
children = (jsxs(Fragment, { children: [fallback, image] }));
|
|
83
|
+
fillShape = fallbackFillShape;
|
|
73
84
|
}
|
|
74
85
|
const { focusVisible, focusVisibleRef, focusVisibleHandlers } = useFocusVisible(props);
|
|
75
86
|
const avatarRef = useForkRef(avatarShapeRef, focusVisibleRef);
|
|
76
|
-
const clickable = clickableProp !== false && onClick ? true : clickableProp ?? false;
|
|
87
|
+
const clickable = clickableProp !== false && onClick ? true : (clickableProp ?? false);
|
|
77
88
|
const interactive = clickable && !disabled;
|
|
78
89
|
const supportsStatusIndicator = size !== 'xxsmall' && size !== 'xsmall';
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
const shapeComponent = component ?? (clickable ? 'button' : 'div');
|
|
91
|
+
const AvatarShape = variant === 'squircle' ? Squircle : shapeComponent;
|
|
92
|
+
const isButtonElement = shapeComponent === 'button';
|
|
93
|
+
const hasExplicitAccessibleName = rest['aria-label'] !== undefined || rest['aria-labelledby'] !== undefined;
|
|
94
|
+
const accessibleNameProps = (clickable || isButtonElement) &&
|
|
95
|
+
hasImg &&
|
|
96
|
+
alt &&
|
|
97
|
+
!hasExplicitAccessibleName
|
|
98
|
+
? {
|
|
99
|
+
'aria-label': alt,
|
|
100
|
+
}
|
|
101
|
+
: {};
|
|
87
102
|
const shapeProps = variant === 'squircle'
|
|
88
103
|
? {
|
|
89
|
-
component,
|
|
104
|
+
component: shapeComponent,
|
|
90
105
|
focusVisible: focusVisible && interactive,
|
|
91
106
|
fillShape,
|
|
92
107
|
interactive,
|
|
@@ -121,7 +136,7 @@ const Avatar = forwardRef((inProps, ref) => {
|
|
|
121
136
|
}, floater: supportsStatusIndicator && showStatusIndicator ? (jsx(StatusIndicator, { size: StatusIndicatorSizeMap[size], ...IndicatorProps })) : undefined, className: clsx(className, groupClassName), classes: {
|
|
122
137
|
root: cls('root', size, { disabled }),
|
|
123
138
|
floater: cls('indicator', interactive && 'clickable-indicator'),
|
|
124
|
-
}, ...rootProps, ref: ref, children: jsxs(AvatarShape, { className: cls('shape', variant, color, { clickable }, interactive && 'clickable-shape', interactive && `clickable-${variant}`), ...focusVisibleHandlers, ...shapeProps, ...ariaProps, ...nonInteractiveShapeProps, ...rest, onClick: onClick ? handleClick : undefined, ref: avatarRef, children: [jsx("div", { className: cls('content', `${variant}-content`, `${size}-content`, `${variant}-${color}`), children: children }), variant === 'circle' && (jsx("div", { className: cls('hover-tint', interactive && 'clickable-hover-tint', interactive && `clickable-hover-tint-${color}-${variant}`) })), variant === 'squircle' && interactive && (jsx(Squircle, { interactive: false, className: cls('hover-tint', interactive && 'clickable-hover-tint', interactive && `clickable-hover-tint-${color}-${variant}`) }))] }) }));
|
|
139
|
+
}, ...rootProps, ref: ref, children: jsxs(AvatarShape, { className: cls('shape', variant, color, { clickable }, interactive && 'clickable-shape', interactive && `clickable-${variant}`), ...focusVisibleHandlers, ...shapeProps, ...ariaProps, ...accessibleNameProps, ...nonInteractiveShapeProps, ...rest, onClick: onClick ? handleClick : undefined, ref: avatarRef, children: [jsx("div", { className: cls('content', `${variant}-content`, `${size}-content`, `${variant}-${color}`), children: children }), variant === 'circle' && (jsx("div", { className: cls('hover-tint', interactive && 'clickable-hover-tint', interactive && `clickable-hover-tint-${color}-${variant}`) })), variant === 'squircle' && interactive && (jsx(Squircle, { interactive: false, className: cls('hover-tint', interactive && 'clickable-hover-tint', interactive && `clickable-hover-tint-${color}-${variant}`) }))] }) }));
|
|
125
140
|
});
|
|
126
141
|
Avatar.displayName = 'SuiAvatar';
|
|
127
142
|
|
package/DatePicker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx,
|
|
2
|
-
import { useFocusVisible, useForkRef, combineProps, useOnlyOneFocusable, useKeyboardMoveFocus, usePrevious, useEventCallback, useWindowContext, runKeyHandler, useControlled } from '@ringcentral/spring-base';
|
|
3
|
-
import { createContext, useContext,
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useFocusVisible, useForkRef, combineProps, useOnlyOneFocusable, useKeyboardMoveFocus, usePrevious, useId, useEventCallback, useWindowContext, runKeyHandler, useControlled } from '@ringcentral/spring-base';
|
|
3
|
+
import { createContext, useContext, forwardRef, useRef, useMemo, useLayoutEffect, createElement, useState, useCallback, useEffect } from 'react';
|
|
4
4
|
import { B as Button } from './chunks/Button.js';
|
|
5
5
|
import { C as CircularProgressIndicator } from './chunks/CircularProgressIndicator.js';
|
|
6
6
|
import { useDateUtilsContext, DateUtilsProvider } from './DateUtilsContext.js';
|
|
@@ -10,7 +10,6 @@ import 'framer-motion';
|
|
|
10
10
|
import { useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
|
|
11
11
|
import './chunks/Icon.js';
|
|
12
12
|
import { I as IconButton } from './chunks/IconButtonLabel.js';
|
|
13
|
-
import { V as VisuallyHidden } from './chunks/VisuallyHidden.js';
|
|
14
13
|
import clsx from 'clsx';
|
|
15
14
|
import dayjs from 'dayjs';
|
|
16
15
|
import { P as PickerTextField } from './chunks/PickerTextField.js';
|
|
@@ -30,9 +29,10 @@ import './chunks/useMotionSafeTransition.js';
|
|
|
30
29
|
import './chunks/Squircle.js';
|
|
31
30
|
import './chunks/Popover.js';
|
|
32
31
|
import './chunks/getGrow.js';
|
|
32
|
+
import './chunks/useHelperTextId.js';
|
|
33
33
|
import './chunks/TextField.js';
|
|
34
34
|
import './chunks/ShowHideEye.js';
|
|
35
|
-
import './chunks/
|
|
35
|
+
import './chunks/VisuallyHidden.js';
|
|
36
36
|
|
|
37
37
|
const DatePickerClassesContext = createContext(() => '');
|
|
38
38
|
const useDatePickerClasses = () => useContext(DatePickerClassesContext);
|
|
@@ -44,15 +44,16 @@ const HeaderAction = (props) => {
|
|
|
44
44
|
return (jsx("button", { className: clsx(className, cls('header-action', { focusVisible, disabled })), ref: focusVisibleRef, ...rest, ...focusVisibleHandlers }));
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const ScreenReaderContext = createContext(null);
|
|
48
|
-
const useScreenReaderContext = () => useContext(ScreenReaderContext);
|
|
49
47
|
const defaultScreenReaderProps = {
|
|
50
48
|
getMonthYearAriaLabel: (monthLabel, expanded) => `${monthLabel}${expanded ? ', year selection expanded' : ''}`,
|
|
51
49
|
getSwitchMonthAriaLabel: (isNext, currentMonth) => `${isNext ? 'Next' : 'Previous'} month, currently viewing ${currentMonth}`,
|
|
52
50
|
getBackToTodayAriaLabel: () => 'Go back to today',
|
|
51
|
+
getLoadingAriaLabel: () => 'Loading dates',
|
|
53
52
|
getDayAriaLabel: (day, selected) => `${day}${selected ? ', selected' : ''}`,
|
|
54
53
|
getYearAriaLabel: (year, selected) => `${year}${selected ? ', selected' : ''}`,
|
|
55
54
|
};
|
|
55
|
+
const ScreenReaderContext = createContext(defaultScreenReaderProps);
|
|
56
|
+
const useScreenReaderContext = () => useContext(ScreenReaderContext);
|
|
56
57
|
const ScreenReaderProvider = ({ screenReaderProps, children, }) => {
|
|
57
58
|
return (jsx(ScreenReaderContext.Provider, { value: screenReaderProps || defaultScreenReaderProps, children: children }));
|
|
58
59
|
};
|
|
@@ -131,20 +132,17 @@ const findClosestEnabledDate = ({ date, utils, minDate, maxDate, disableFuture,
|
|
|
131
132
|
};
|
|
132
133
|
|
|
133
134
|
const DatePickerHeader = (props) => {
|
|
134
|
-
const { focusedDate, onMonthChange, disablePrevMonth = false, disableNextMonth = false, onViewChange, view, } = props;
|
|
135
|
+
const { focusedDate, onMonthChange, disablePrevMonth = false, disableNextMonth = false, onViewChange, view, gridLabelId, } = props;
|
|
135
136
|
const utils = useDateUtilsContext();
|
|
136
137
|
const cls = useDatePickerClasses();
|
|
137
138
|
const preMonth = utils.getPreviousMonth(focusedDate);
|
|
138
139
|
const nextMonth = utils.getNextMonth(focusedDate);
|
|
139
140
|
const monthLabel = utils.getCalendarHeaderText(focusedDate);
|
|
140
|
-
const changeFromRef = useRef();
|
|
141
141
|
const selectNextMonth = () => {
|
|
142
142
|
onMonthChange(nextMonth, 'left');
|
|
143
|
-
changeFromRef.current = 'next';
|
|
144
143
|
};
|
|
145
144
|
const selectPreviousMonth = () => {
|
|
146
145
|
onMonthChange(preMonth, 'right');
|
|
147
|
-
changeFromRef.current = 'previous';
|
|
148
146
|
};
|
|
149
147
|
const isYearView = view === 'year';
|
|
150
148
|
const isExpanded = isYearView;
|
|
@@ -152,9 +150,7 @@ const DatePickerHeader = (props) => {
|
|
|
152
150
|
const monthYearAriaLabel = getMonthYearAriaLabel?.(`${monthLabel}`, isExpanded);
|
|
153
151
|
const nextMonthAriaLabel = getSwitchMonthAriaLabel?.(true, utils.getMonthText(focusedDate));
|
|
154
152
|
const previousMonthAriaLabel = getSwitchMonthAriaLabel?.(false, utils.getMonthText(focusedDate));
|
|
155
|
-
return (
|
|
156
|
-
? nextMonthAriaLabel
|
|
157
|
-
: 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": "" })] }))] })] }));
|
|
153
|
+
return (jsx(Fragment, { children: 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: [jsx("span", { id: gridLabelId, "aria-live": "polite", "aria-atomic": "true", 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": "" })] }))] }) }));
|
|
158
154
|
};
|
|
159
155
|
DatePickerHeader.displayName = 'RcDatePickerHeader';
|
|
160
156
|
|
|
@@ -165,12 +161,18 @@ const Day = forwardRef((props, ref) => {
|
|
|
165
161
|
const { focusVisible, focusVisibleHandlers, focusVisibleRef } = useFocusVisible();
|
|
166
162
|
const utils = useDateUtilsContext();
|
|
167
163
|
const handleRef = useForkRef(ref, focusVisibleRef);
|
|
164
|
+
const dayLabel = `${utils.getDatePickerHeaderText(date)} ${utils.getYearText(date)}`;
|
|
168
165
|
return (jsx("button", { onClick: () => onSelect(value), ref: handleRef, className: cls('date-button', 'day', {
|
|
169
166
|
'current-date': current,
|
|
170
167
|
selected,
|
|
171
168
|
disabled,
|
|
172
169
|
focusVisible,
|
|
173
|
-
}), "data-sui-picker-focused": focused ? '' : undefined, "data-sui-picker-day": value, "aria-label": getDayAriaLabel?.(
|
|
170
|
+
}), "data-sui-picker-focused": focused ? '' : undefined, "data-sui-picker-day": value, "aria-label": getDayAriaLabel?.(dayLabel, selected, {
|
|
171
|
+
date,
|
|
172
|
+
disabled,
|
|
173
|
+
today: current,
|
|
174
|
+
focused,
|
|
175
|
+
}), ...rest, ...combineProps({ onBlur, onFocus }, focusVisibleHandlers), children: children }));
|
|
174
176
|
});
|
|
175
177
|
Day.displayName = 'SuiDay';
|
|
176
178
|
|
|
@@ -234,13 +236,14 @@ const Years = forwardRef((props, ref) => {
|
|
|
234
236
|
});
|
|
235
237
|
Years.displayName = 'SuiYears';
|
|
236
238
|
|
|
239
|
+
const DATE_PICKER_CALENDAR_GRID_LABEL_ID_PREFIX = 'DatePickerCalendarGridLabel';
|
|
237
240
|
const Calendar = forwardRef(({ onMonthChange, date, shouldDisableDate, dateRange, todayButtonText, loadingIndicator, disablePast, disableFuture, renderDay, onSelectDay, getInvalidateDateInRange, }, ref) => {
|
|
238
241
|
const cls = useDatePickerClasses();
|
|
239
242
|
const utils = useDateUtilsContext();
|
|
240
243
|
const previousFocusDate = usePrevious(() => focusedDate);
|
|
241
244
|
const previousView = usePrevious(() => view);
|
|
242
245
|
const weeks = useRef([]);
|
|
243
|
-
const
|
|
246
|
+
const weekdayLabels = useMemo(() => utils.getWeekdayLabels(), [utils]);
|
|
244
247
|
const { now, isTodayDisabled } = useMemo(() => {
|
|
245
248
|
const nowDate = utils.date();
|
|
246
249
|
return {
|
|
@@ -252,6 +255,7 @@ const Calendar = forwardRef(({ onMonthChange, date, shouldDisableDate, dateRange
|
|
|
252
255
|
const [view, setView] = useState('day');
|
|
253
256
|
const [slideDirection, setSlideDirection] = useState('left');
|
|
254
257
|
const [loadingQueue, setLoadingQueue] = useState(0);
|
|
258
|
+
const gridLabelId = useId(DATE_PICKER_CALENDAR_GRID_LABEL_ID_PREFIX, true);
|
|
255
259
|
const { min, max } = dateRange;
|
|
256
260
|
const currentMonthNumber = utils.getMonth(focusedDate);
|
|
257
261
|
const sameMonthDate = previousFocusDate
|
|
@@ -320,30 +324,34 @@ const Calendar = forwardRef(({ onMonthChange, date, shouldDisableDate, dateRange
|
|
|
320
324
|
' ': confirmDate,
|
|
321
325
|
});
|
|
322
326
|
};
|
|
323
|
-
const { getBackToTodayAriaLabel } = useScreenReaderContext() ?? {};
|
|
327
|
+
const { getBackToTodayAriaLabel, getLoadingAriaLabel } = useScreenReaderContext() ?? {};
|
|
324
328
|
const backToTodayAriaLabel = getBackToTodayAriaLabel?.();
|
|
329
|
+
const loadingAriaLabel = getLoadingAriaLabel?.();
|
|
325
330
|
const renderDays = (week) => {
|
|
326
331
|
const selectedDate = date;
|
|
327
332
|
return week.map((day) => {
|
|
328
333
|
const disabled = shouldDisableDate(day);
|
|
329
334
|
const isDayInCurrentMonth = utils.getMonth(day) === currentMonthNumber;
|
|
330
335
|
const dayText = utils.getDayText(day);
|
|
331
|
-
const key =
|
|
336
|
+
const key = utils.formatByString(day, 'YYYY-MM-DD');
|
|
332
337
|
const selected = utils.isSameDay(day, selectedDate);
|
|
333
338
|
const focused = utils.isSameDay(focusedDate, day);
|
|
334
339
|
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: () => {
|
|
335
340
|
isDayInCurrentMonth && onSelectDay(day);
|
|
336
341
|
}, children: dayText }, key)) : (jsx("div", { "aria-hidden": true }, key));
|
|
337
|
-
|
|
342
|
+
const renderedDay = renderDay
|
|
338
343
|
? renderDay(day, focusedDate, isDayInCurrentMonth, dayComponent)
|
|
339
344
|
: dayComponent;
|
|
345
|
+
return (jsx("td", { className: cls('day-cell'), "aria-selected": selected && isDayInCurrentMonth ? true : undefined, children: renderedDay }, key));
|
|
340
346
|
});
|
|
341
347
|
};
|
|
342
348
|
const renderBody = () => {
|
|
343
|
-
const loadingElement = loadingIndicator ? (loadingIndicator) : (jsx("div", { className: cls('loading-container'), children: jsx(CircularProgressIndicator, {
|
|
349
|
+
const loadingElement = loadingIndicator ? (loadingIndicator) : (jsx("div", { className: cls('loading-container'), children: jsx(CircularProgressIndicator, { progressBarProps: {
|
|
350
|
+
'aria-label': loadingAriaLabel,
|
|
351
|
+
} }) }));
|
|
344
352
|
switch (view) {
|
|
345
353
|
case 'day':
|
|
346
|
-
return (jsxs(Fragment, { children: [
|
|
354
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: cls('days-panel'), children: jsxs("table", { className: cls('days-grid'), role: "grid", "aria-labelledby": gridLabelId, "aria-busy": loadingQueue > 0 ? true : undefined, onKeyDown: handleKeyDown, children: [jsx("thead", { children: jsx("tr", { className: cls('weekdays'), children: weekdayLabels.map(({ full, min }) => (jsx("th", { className: cls('weekday'), scope: "col", abbr: full, "aria-label": full, children: min }, full))) }) }), loadingQueue > 0 ? (jsx("tbody", { "data-sui-picker-loading": "", children: jsx("tr", { children: jsx("td", { colSpan: 7, children: loadingElement }) }) })) : (jsx("tbody", { children: weeks.current.map((week) => (jsx("tr", { className: cls('week'), children: renderDays(week) }, utils.formatByString(week[0], 'YYYY-MM-DD')))) }))] }) }), jsx("div", { children: jsx(Button, { className: cls('today-button'), variant: "outlined", size: "small", color: "secondary", onClick: () => {
|
|
347
355
|
onSelectDay(now);
|
|
348
356
|
}, disabled: isTodayDisabled, "aria-label": backToTodayAriaLabel, "data-sui-picker-today": "", children: todayButtonText }) })] }));
|
|
349
357
|
case 'year':
|
|
@@ -385,11 +393,11 @@ const Calendar = forwardRef(({ onMonthChange, date, shouldDisableDate, dateRange
|
|
|
385
393
|
useLayoutEffect(() => {
|
|
386
394
|
focusDayElement();
|
|
387
395
|
}, []);
|
|
388
|
-
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()] }));
|
|
396
|
+
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, gridLabelId: gridLabelId }), renderBody()] }));
|
|
389
397
|
});
|
|
390
398
|
Calendar.displayName = 'RcCalendar';
|
|
391
399
|
|
|
392
|
-
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","sui-compact":"sui-compact"};
|
|
400
|
+
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-week":"sui-date-picker-week","sui-date-picker-weekdays":"sui-date-picker-weekdays","sui-date-picker-day-cell":"sui-date-picker-day-cell","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","sui-compact":"sui-compact"};
|
|
393
401
|
|
|
394
402
|
const defaultMinDate = new Date('1900-01-01');
|
|
395
403
|
const defaultMaxDate = new Date('2100-01-01');
|
|
@@ -403,17 +411,16 @@ const InnerDatePicker = (props) => {
|
|
|
403
411
|
default: null,
|
|
404
412
|
name: 'DatePicker',
|
|
405
413
|
});
|
|
406
|
-
const emitValueRef = useRef(null);
|
|
407
414
|
const actionRef = useRef(null);
|
|
415
|
+
const minDateValue = minDate?.valueOf() ?? defaultMinDate.valueOf();
|
|
416
|
+
const maxDateValue = maxDate?.valueOf() ?? defaultMaxDate.valueOf();
|
|
408
417
|
const dateRange = useMemo(() => ({
|
|
409
|
-
min: dayjs(
|
|
410
|
-
max: dayjs(
|
|
411
|
-
}), [
|
|
412
|
-
const getInvalidateDateInRange =
|
|
413
|
-
const shouldDisableDate =
|
|
414
|
-
|
|
415
|
-
Boolean(shouldDisableDateProp?.(day)));
|
|
416
|
-
});
|
|
418
|
+
min: dayjs(minDateValue),
|
|
419
|
+
max: dayjs(maxDateValue),
|
|
420
|
+
}), [minDateValue, maxDateValue]);
|
|
421
|
+
const getInvalidateDateInRange = useCallback((day) => invalidateDateInRange(day, { dateRange, now: utils.date(), disableFuture, disablePast }, utils), [dateRange, disableFuture, disablePast, utils]);
|
|
422
|
+
const shouldDisableDate = useCallback((day) => Boolean(getInvalidateDateInRange(day)) ||
|
|
423
|
+
Boolean(shouldDisableDateProp?.(day)), [getInvalidateDateInRange, shouldDisableDateProp]);
|
|
417
424
|
const getClosestEnabledDate = useCallback((currDate) => {
|
|
418
425
|
return findClosestEnabledDate({
|
|
419
426
|
date: currDate,
|
|
@@ -439,7 +446,6 @@ const InnerDatePicker = (props) => {
|
|
|
439
446
|
const handleChange = (toDate, fromUserSelect) => {
|
|
440
447
|
actionRef.current?.close();
|
|
441
448
|
setControlledValue(toDate);
|
|
442
|
-
emitValueRef.current = toDate;
|
|
443
449
|
onChange?.(toDate, fromUserSelect);
|
|
444
450
|
};
|
|
445
451
|
const handleDaySelect = useEventCallback((day, fromUserSelect = true) => {
|
|
@@ -447,10 +453,11 @@ const InnerDatePicker = (props) => {
|
|
|
447
453
|
handleChange(newDay, fromUserSelect);
|
|
448
454
|
});
|
|
449
455
|
useEffect(() => {
|
|
450
|
-
if (dayjsValue
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
456
|
+
if (!dayjsValue || !shouldDisableDate(dayjsValue)) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
const closestEnabledDate = getClosestEnabledDate(dayjsValue);
|
|
460
|
+
if (!utils.isSameDay(closestEnabledDate, dayjsValue)) {
|
|
454
461
|
handleDaySelect(closestEnabledDate, false);
|
|
455
462
|
}
|
|
456
463
|
}, [
|
|
@@ -458,7 +465,7 @@ const InnerDatePicker = (props) => {
|
|
|
458
465
|
getClosestEnabledDate,
|
|
459
466
|
handleDaySelect,
|
|
460
467
|
shouldDisableDate,
|
|
461
|
-
|
|
468
|
+
utils,
|
|
462
469
|
]);
|
|
463
470
|
return (jsx(DatePickerClassesContext.Provider, { value: cls, children: jsx(PickerTextField, { className: cls('root'), variant: "standard", label: label, ref: innerRef, action: actionRef, onClear: (e) => {
|
|
464
471
|
onClear?.(e);
|
package/DateUtilsContext.js
CHANGED
|
@@ -2,11 +2,27 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import DateUtils from '@date-io/dayjs';
|
|
3
3
|
import { createContext, useMemo, useContext } from 'react';
|
|
4
4
|
|
|
5
|
+
const weekdayLabelFormatMap = {
|
|
6
|
+
min: 'dd',
|
|
7
|
+
short: 'ddd',
|
|
8
|
+
full: 'dddd',
|
|
9
|
+
};
|
|
5
10
|
const DateUtilsContext = createContext(null);
|
|
6
11
|
const DateUtilsProvider = (props) => {
|
|
7
12
|
const { children, locale } = props;
|
|
8
13
|
const utils = useMemo(() => {
|
|
9
14
|
const dateUtils = new DateUtils({ locale });
|
|
15
|
+
const getWeekdayLabels = () => {
|
|
16
|
+
const weekStart = dateUtils.startOfWeek(dateUtils.date());
|
|
17
|
+
return Array.from({ length: 7 }, (_, index) => {
|
|
18
|
+
const weekday = dateUtils.addDays(weekStart, index);
|
|
19
|
+
return {
|
|
20
|
+
min: dateUtils.formatByString(weekday, weekdayLabelFormatMap.min),
|
|
21
|
+
short: dateUtils.formatByString(weekday, weekdayLabelFormatMap.short),
|
|
22
|
+
full: dateUtils.formatByString(weekday, weekdayLabelFormatMap.full),
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
};
|
|
10
26
|
const customUtils = {
|
|
11
27
|
getCalendarHeaderText: (date) => {
|
|
12
28
|
return dateUtils.formatByString(date, 'MMMM YYYY');
|
|
@@ -18,7 +34,7 @@ const DateUtilsProvider = (props) => {
|
|
|
18
34
|
return dateUtils.formatByString(date, 'MMMM');
|
|
19
35
|
},
|
|
20
36
|
getDatePickerHeaderText: (date) => {
|
|
21
|
-
return dateUtils.formatByString(date, '
|
|
37
|
+
return dateUtils.formatByString(date, 'dddd, MMMM D');
|
|
22
38
|
},
|
|
23
39
|
getDateTimePickerHeaderText: (date) => {
|
|
24
40
|
return dateUtils.formatByString(date, 'MMM D');
|
|
@@ -26,6 +42,7 @@ const DateUtilsProvider = (props) => {
|
|
|
26
42
|
getDayText: (date) => {
|
|
27
43
|
return dateUtils.formatByString(date, 'D');
|
|
28
44
|
},
|
|
45
|
+
getWeekdayLabels,
|
|
29
46
|
getHourText: (date, ampm) => {
|
|
30
47
|
return dateUtils.formatByString(date, ampm ? 'hh' : 'HH');
|
|
31
48
|
},
|
package/Dialer.js
CHANGED
|
@@ -248,7 +248,7 @@ const DialPad = forwardRef((inProps, ref) => {
|
|
|
248
248
|
? 'medium'
|
|
249
249
|
: 'large';
|
|
250
250
|
const icon = size === 'large' ? lgIcon : smIcon;
|
|
251
|
-
return (jsx(DialPadButton, { classes: classes, symbol: icon, value: key, onKeyEffect: handleKeyEffect, ...getItemProps(index), "aria-label": ariaLabelArr.join(', '), onKeyDown: onKeyFocusedIndexHandle,
|
|
251
|
+
return (jsx(DialPadButton, { classes: classes, symbol: icon, value: key, onKeyEffect: handleKeyEffect, ...getItemProps(index), "aria-label": ariaLabelArr.join(', '), onKeyDown: onKeyFocusedIndexHandle, [dialButtonKey]: key, ...getDialPadButtonProps?.(key), ...(key === '0'
|
|
252
252
|
? {
|
|
253
253
|
longPressValue: DIALER_PAD_PLUS,
|
|
254
254
|
longPressDelay,
|
package/Dialog.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
3
|
import { motion } from 'framer-motion';
|
|
4
4
|
import kebabCase from 'lodash/kebabCase';
|
|
5
5
|
import { useEventCallback, combineProps, useClasses } from '@ringcentral/spring-base';
|
|
@@ -22,34 +22,31 @@ import './chunks/PopperPaper.js';
|
|
|
22
22
|
import './chunks/useFocusTrapStack.js';
|
|
23
23
|
import './chunks/Backdrop.js';
|
|
24
24
|
|
|
25
|
-
var Dialog$1 = {"sui-dialog-body":"sui-dialog-body","sui-dialog-root":"sui-dialog-root","sui-dialog-non-blocking":"sui-dialog-non-blocking","sui-dialog-small":"sui-dialog-small","sui-dialog-medium":"sui-dialog-medium","sui-dialog-large":"sui-dialog-large","sui-dialog-title-root":"sui-dialog-title-root","sui-dialog-content-root":"sui-dialog-content-root","sui-dialog-actions-root":"sui-dialog-actions-root","sui-dialog-right":"sui-dialog-right","sui-dialog-right-close-button":"sui-dialog-right-close-button","sui-dialog-left":"sui-dialog-left","sui-dialog-left-close-button":"sui-dialog-left-close-button","sui-dialog-full-height":"sui-dialog-full-height","sui-dialog-
|
|
25
|
+
var Dialog$1 = {"sui-dialog-body":"sui-dialog-body","sui-dialog-root":"sui-dialog-root","sui-dialog-non-blocking":"sui-dialog-non-blocking","sui-dialog-small":"sui-dialog-small","sui-dialog-close-button":"sui-dialog-close-button","sui-dialog-medium":"sui-dialog-medium","sui-dialog-large":"sui-dialog-large","sui-dialog-title-root":"sui-dialog-title-root","sui-dialog-content-root":"sui-dialog-content-root","sui-dialog-actions-root":"sui-dialog-actions-root","sui-dialog-right":"sui-dialog-right","sui-dialog-right-close-button":"sui-dialog-right-close-button","sui-dialog-left":"sui-dialog-left","sui-dialog-left-close-button":"sui-dialog-left-close-button","sui-dialog-full-height":"sui-dialog-full-height","sui-dialog-full-screen":"sui-dialog-full-screen","sui-compact":"sui-compact"};
|
|
26
26
|
|
|
27
27
|
const Dialog = forwardRef((inProps, ref) => {
|
|
28
28
|
const props = useThemeProps({ props: inProps, name: 'Dialog' });
|
|
29
|
-
const { bodyProps, classes, className, children, size = 'medium', placement = 'right', open, onClose, blocking = true, CloseButtonProps, ...rest } = props;
|
|
29
|
+
const { bodyProps, classes, className, children, size = 'medium', placement = 'right', open, onClose, blocking = true, closeButton, CloseButtonProps, ...rest } = props;
|
|
30
30
|
const cls = useClassesWithMode('dialog', classes, className);
|
|
31
|
-
const toSize =
|
|
31
|
+
const toSize = kebabCase(size);
|
|
32
32
|
const isFullHeight = size === 'fullHeight';
|
|
33
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
34
|
+
const showCloseButton = shouldShowDialogCloseButton(closeButton, size);
|
|
35
|
+
const closeButtonClassName = showCloseButton
|
|
36
|
+
? cls('close-button', size === 'fullHeight' && `${placement}-close-button`)
|
|
37
|
+
: undefined;
|
|
33
38
|
const slideInProps = getSlideIn({
|
|
34
39
|
toggle: open,
|
|
35
40
|
from: placement,
|
|
36
|
-
prefersReducedMotion
|
|
41
|
+
prefersReducedMotion,
|
|
37
42
|
toggleOnTransition: motionTransition['haste-01-fast'],
|
|
38
43
|
toggleOffTransition: motionTransition['neutral-01-fast'],
|
|
39
44
|
});
|
|
40
45
|
const handleCloseButtonClick = useEventCallback((e) => {
|
|
41
46
|
onClose?.(e, 'closeButtonClick');
|
|
42
47
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
disableScrollLock: true,
|
|
46
|
-
disableBackdropClick: true,
|
|
47
|
-
disableEscapeKeyDown: true,
|
|
48
|
-
hideBackdrop: true,
|
|
49
|
-
}
|
|
50
|
-
: {};
|
|
51
|
-
return (jsx(Modal, { open: open, onClose: onClose, blocking: blocking, ...nonBlockingProps, className: cls('root', { 'non-blocking': !blocking }), ...rest, children: jsxs(motion.div, { role: "dialog", "aria-modal": blocking, ...(isFullHeight && slideInProps), ...bodyProps, ref: ref, tabIndex: blocking ? -1 : undefined, className: cls('body', toSize, isFullHeight && placement), children: [children, isFullHeight && (jsx(IconButton, { size: 'large', color: 'secondary', symbol: Xsm, variant: "contained", ...combineProps({
|
|
52
|
-
className: cls('close-button', `${placement}-close-button`),
|
|
48
|
+
return (jsx(Modal, { open: open, onClose: onClose, blocking: blocking, className: cls('root', { 'non-blocking': !blocking }), ...rest, children: jsxs(motion.div, { role: "dialog", "aria-modal": blocking, ...(isFullHeight && slideInProps), ...bodyProps, ref: ref, tabIndex: blocking ? -1 : undefined, className: cls('body', toSize, isFullHeight && placement), children: [children, closeButtonClassName && (jsx(IconButton, { size: 'large', color: 'secondary', symbol: Xsm, variant: "contained", ...combineProps({
|
|
49
|
+
className: closeButtonClassName,
|
|
53
50
|
onClick: handleCloseButtonClick,
|
|
54
51
|
'aria-label': 'Close',
|
|
55
52
|
}, CloseButtonProps) }))] }) }));
|
|
@@ -70,5 +67,17 @@ const DialogActions = forwardRef(({ className, ...rest }, ref) => {
|
|
|
70
67
|
return jsx("div", { ref: ref, className: cls('root'), ...rest });
|
|
71
68
|
});
|
|
72
69
|
DialogActions.displayName = 'SuiDialogActions';
|
|
70
|
+
function shouldShowDialogCloseButton(closeButton, size) {
|
|
71
|
+
if (size === 'fullScreen') {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (closeButton === false) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
if (closeButton === true) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return size === 'fullHeight';
|
|
81
|
+
}
|
|
73
82
|
|
|
74
83
|
export { Dialog, DialogActions, DialogContent, DialogTitle, Dialog$1 as dialogStyle };
|