@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
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createContext, useContext, useRef, useEffect, forwardRef, useState, useMemo } from 'react';
|
|
3
|
+
import { useForkRef, combineProps, useClasses, useEventCallback } from '@ringcentral/spring-base';
|
|
4
|
+
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { P as Popover } from './Popover.js';
|
|
7
|
+
import { VirtualizedList } from '../VirtualizedList.js';
|
|
8
|
+
|
|
9
|
+
const VirtualizedMenuContext = createContext(null);
|
|
10
|
+
const useVirtualizedMenuContext = () => useContext(VirtualizedMenuContext);
|
|
11
|
+
|
|
12
|
+
const VirtualizedMenuList = (props) => {
|
|
13
|
+
const { children, actions: actionsProp, initialFocus: initialFocusProps, totalListHeightChanged: totalListHeightChangedProp, ...rest } = props;
|
|
14
|
+
const actions = useRef(null);
|
|
15
|
+
const handleListActions = useForkRef(actions, actionsProp);
|
|
16
|
+
const listRef = useRef(null);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const initialFocus = typeof initialFocusProps === 'function'
|
|
19
|
+
? initialFocusProps()
|
|
20
|
+
: initialFocusProps;
|
|
21
|
+
if (initialFocus === true) {
|
|
22
|
+
actions.current?.focus();
|
|
23
|
+
}
|
|
24
|
+
else if (typeof initialFocus === 'number') {
|
|
25
|
+
actions.current?.focusByIndex(initialFocus);
|
|
26
|
+
}
|
|
27
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
28
|
+
}, []); // only excute effect when menu list mounted
|
|
29
|
+
return (jsx(VirtualizedList, { actions: handleListActions, ...rest, ListProps: combineProps({
|
|
30
|
+
role: 'menu',
|
|
31
|
+
}, rest.ListProps), ref: listRef, totalListHeightChanged: totalListHeightChangedProp, children: children }));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const VirtualizedMenu = forwardRef((inProps, ref) => {
|
|
35
|
+
const props = useThemeProps({ props: inProps, name: 'VirtualizedMenu' });
|
|
36
|
+
const { classes, className, children, open, onClose, data, totalCount, isItemDisabled, VirtualizedListProps, popperActions: popperActionsProp, initialFocus = true, maxHeight, PopperProps, ...rest } = props;
|
|
37
|
+
const popperPaperContentRef = useRef(null);
|
|
38
|
+
const paperContentContainerRef = useRef(null);
|
|
39
|
+
const waitForListHeightComputeCallsCount = useRef(0);
|
|
40
|
+
const [waitForHeightCompute, setWaitForHeightCompute] = useState(true);
|
|
41
|
+
const [menuHeight, setMenuHeight] = useState(0);
|
|
42
|
+
const [deferPendingVirtualizedListActions, setDeferPendingVirtualizedListActions,] = useState(true);
|
|
43
|
+
const computedListHeight = useRef(-1);
|
|
44
|
+
const availableHeight = useRef(-1);
|
|
45
|
+
const cls = useClasses('virtualized-menu', classes, className);
|
|
46
|
+
const padding = PopperProps?.padding;
|
|
47
|
+
const popperPadding = typeof padding === 'object'
|
|
48
|
+
? {
|
|
49
|
+
top: padding.top ?? 16,
|
|
50
|
+
right: padding.right ?? 16,
|
|
51
|
+
bottom: padding.bottom ?? 16,
|
|
52
|
+
left: padding.left ?? 16,
|
|
53
|
+
}
|
|
54
|
+
: padding ?? 16;
|
|
55
|
+
const popperActions = useRef(null);
|
|
56
|
+
const handlePopperActions = useForkRef(popperActions, popperActionsProp);
|
|
57
|
+
const menuContextValue = useMemo(() => {
|
|
58
|
+
return { open };
|
|
59
|
+
}, [open]);
|
|
60
|
+
const updateMenuHeight = useEventCallback(() => {
|
|
61
|
+
let computedMenuHeight = computedListHeight.current;
|
|
62
|
+
if (computedMenuHeight > availableHeight.current) {
|
|
63
|
+
computedMenuHeight = availableHeight.current;
|
|
64
|
+
}
|
|
65
|
+
if (maxHeight !== undefined && computedMenuHeight > maxHeight) {
|
|
66
|
+
computedMenuHeight = maxHeight;
|
|
67
|
+
}
|
|
68
|
+
setMenuHeight(computedMenuHeight);
|
|
69
|
+
});
|
|
70
|
+
const updatePopoverHeight = useEventCallback(() => {
|
|
71
|
+
if (!popperPaperContentRef.current)
|
|
72
|
+
return;
|
|
73
|
+
popperPaperContentRef.current.style.maxHeight = `${availableHeight.current}px`;
|
|
74
|
+
/**
|
|
75
|
+
* Reset the paper content container height to `auto`, otherwise the virtuoso scroller
|
|
76
|
+
* will start misbehaving. We only need to set the height of the container during the
|
|
77
|
+
* initial list height computation to ensure the Popover places it appropriately.
|
|
78
|
+
*/
|
|
79
|
+
if (paperContentContainerRef.current) {
|
|
80
|
+
paperContentContainerRef.current.style.height = `auto`;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
const handleTotalListHeightChanged = useEventCallback((listHeight) => {
|
|
84
|
+
/**
|
|
85
|
+
* As the VirtualizedList has components (Header/Footer used for vertical padding), the
|
|
86
|
+
* first 2 calls to `totalListHeightChanged` after triggering the Menu to open will have
|
|
87
|
+
* only computed the height of those components and not the full list. The next calls
|
|
88
|
+
* will include the actual list height. We ignore this call to prevent the menu from
|
|
89
|
+
* flickering between positions/performing any other unnecessary computations. We also
|
|
90
|
+
* need to know the entire list height to be able to choose the correct placement.
|
|
91
|
+
*
|
|
92
|
+
* If we didn't do this, we'd compute the available height prematurely based on an
|
|
93
|
+
* incorrect initial placement, and the height parameter in further calls to
|
|
94
|
+
* `handleTotalListHeightChanged` would be the adjusted height of the popover for
|
|
95
|
+
* the available space in the viewport and not the actual height of the list. For
|
|
96
|
+
* example, if the user set the `placement` prop to `top` but had a very long list
|
|
97
|
+
* which could not fit above the anchor element, the menu could initially appear
|
|
98
|
+
* above the input despite the fact its best placement is below. The user would
|
|
99
|
+
* then see this placement change when re-opening the menu or scrolling, where the
|
|
100
|
+
* Popover would auto-update the position and then choose the correct placement.
|
|
101
|
+
*/
|
|
102
|
+
if (waitForListHeightComputeCallsCount.current < 2) {
|
|
103
|
+
waitForListHeightComputeCallsCount.current += 1;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
computedListHeight.current = listHeight;
|
|
107
|
+
/**
|
|
108
|
+
* Set the height of the paper content container to the height of the list. This is
|
|
109
|
+
* necessary to ensure the Popover determines the correct amount of space needed for
|
|
110
|
+
* the list. If we set the height directly on the list element it would cause an
|
|
111
|
+
* expensive rerender and if we didn't do either the computed available height
|
|
112
|
+
* for the Popover would not be correct.
|
|
113
|
+
*/
|
|
114
|
+
if (paperContentContainerRef.current) {
|
|
115
|
+
paperContentContainerRef.current.style.height = `${listHeight}px`;
|
|
116
|
+
}
|
|
117
|
+
// Update the Menu height now we've correctly computed the list height
|
|
118
|
+
updateMenuHeight();
|
|
119
|
+
// Update the Popper position after the list height has been computed
|
|
120
|
+
popperActions.current?.update();
|
|
121
|
+
// No need to wait for the height compute once we have the list height
|
|
122
|
+
if (waitForHeightCompute) {
|
|
123
|
+
/**
|
|
124
|
+
* Perform all pending actions once we know the list height has settled. This is necessary
|
|
125
|
+
* as those pending actions expect the list to have fully rendered before they can be ran.
|
|
126
|
+
*/
|
|
127
|
+
requestAnimationFrame(() => {
|
|
128
|
+
setDeferPendingVirtualizedListActions(false);
|
|
129
|
+
/**
|
|
130
|
+
* Wait for the next repaint to ensure the pending actions have been completed and the height
|
|
131
|
+
* has been computed and painted. If we didn't do this, the menu could flicker if the initial
|
|
132
|
+
* scroll position was set to a value that would cause the list to scroll down.
|
|
133
|
+
*/
|
|
134
|
+
requestAnimationFrame(() => {
|
|
135
|
+
setWaitForHeightCompute(false);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
const handleAvailableHeightChange = useEventCallback((value) => {
|
|
141
|
+
/**
|
|
142
|
+
* If we haven't yet computed the height of the virtualized list, we need to ignore
|
|
143
|
+
* the available height as the value will be for when the list has not yet fully rendered.
|
|
144
|
+
*/
|
|
145
|
+
if (computedListHeight.current === -1) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
availableHeight.current = value;
|
|
149
|
+
updateMenuHeight();
|
|
150
|
+
updatePopoverHeight();
|
|
151
|
+
});
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
/**
|
|
154
|
+
* Reset the computed values when the Menu is closed, we'll recompute them when it's reopened
|
|
155
|
+
*/
|
|
156
|
+
if (!open) {
|
|
157
|
+
waitForListHeightComputeCallsCount.current = 0;
|
|
158
|
+
computedListHeight.current = -1;
|
|
159
|
+
availableHeight.current = -1;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Hide the menu immediately after being triggered to open to allow time to compute the rendered
|
|
163
|
+
* list height. We need to do this to avoid a potential flicker when the menu first renders, as
|
|
164
|
+
* the virtualized list may not have rendered yet, but its adorning components may have. This may
|
|
165
|
+
* cause the menu to have a different initial placement than it would have after the list has
|
|
166
|
+
* rendered, for example if the user has chosen a preferred `top` placement but the menu cannot
|
|
167
|
+
* actually fit within the space above the anchor element.
|
|
168
|
+
*
|
|
169
|
+
* This is only necessary for the initial render. After the menu has found its correct placement,
|
|
170
|
+
* we can rely on the Popover to auto-update its placement and size as needed in response to list
|
|
171
|
+
* height changes/window resize events.
|
|
172
|
+
*
|
|
173
|
+
* In the `handleTotalListHeightChanged` callback we then reset this flag once we know the total list
|
|
174
|
+
* has actually rendered, so the first place the user sees the menu is in its correct position after
|
|
175
|
+
* all other height computation has been performed.
|
|
176
|
+
*/
|
|
177
|
+
if (open) {
|
|
178
|
+
setWaitForHeightCompute(true);
|
|
179
|
+
setDeferPendingVirtualizedListActions(true);
|
|
180
|
+
// Reset the max height of the popper paper content to ensure the list is not constrained
|
|
181
|
+
if (popperPaperContentRef.current) {
|
|
182
|
+
popperPaperContentRef.current.style.maxHeight = 'none';
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}, [open]);
|
|
186
|
+
return (jsx(Popover, { bordered: true, PopperProps: { ...PopperProps, padding: popperPadding }, ...rest, open: open, className: clsx(cls('root'), waitForHeightCompute && 'opacity-0'), PopperPaperProps: {
|
|
187
|
+
contentRef: popperPaperContentRef,
|
|
188
|
+
}, onClose: onClose, onAvailableHeightChange: handleAvailableHeightChange, ref: ref,
|
|
189
|
+
// disable animation. The Grow animation will cause vl height calculate incorrectly
|
|
190
|
+
motionProps: { variants: undefined }, actions: handlePopperActions, children: jsx("div", { className: cls('paper'), children: jsx("div", { ref: paperContentContainerRef, className: cls('paper-content-container'), children: jsx(VirtualizedMenuContext.Provider, { value: menuContextValue, children: jsx(VirtualizedMenuList, { data: data, totalCount: totalCount, isReady: !deferPendingVirtualizedListActions, isItemDisabled: isItemDisabled, initialFocus: initialFocus, style: { height: menuHeight }, ...combineProps(VirtualizedListProps, {
|
|
191
|
+
components: {
|
|
192
|
+
/**
|
|
193
|
+
* Use Header/Footer components to add padding to the top and bottom of the
|
|
194
|
+
* list. We need to do this as Virtuoso doesn't support padding on the list
|
|
195
|
+
* due to how it uses padding/margin to simulate scrolling. Passing a List
|
|
196
|
+
* wrapper component also doesn't work as the list height computation
|
|
197
|
+
* doesn't account for the padding around the wrapper element.
|
|
198
|
+
*/
|
|
199
|
+
Header: VirtualizedListVerticalPadding,
|
|
200
|
+
Footer: VirtualizedListVerticalPadding,
|
|
201
|
+
},
|
|
202
|
+
totalListHeightChanged: handleTotalListHeightChanged,
|
|
203
|
+
onKeyDown: (e) => {
|
|
204
|
+
if (e.key === 'Tab') {
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
onClose?.();
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
}), children: children }) }) }) }) }));
|
|
210
|
+
});
|
|
211
|
+
function VirtualizedListVerticalPadding() {
|
|
212
|
+
return jsx("div", { className: "h-2" });
|
|
213
|
+
}
|
|
214
|
+
VirtualizedMenu.displayName = 'SuiVirtualizedMenu';
|
|
215
|
+
|
|
216
|
+
export { VirtualizedMenuContext as V, VirtualizedMenu as a, VirtualizedMenuList as b, useVirtualizedMenuContext as u };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { useClasses } from '@ringcentral/spring-base';
|
|
4
|
+
|
|
5
|
+
const VisuallyHidden = forwardRef((props, ref) => {
|
|
6
|
+
const { classes, className, children, ...rest } = props;
|
|
7
|
+
const cls = useClasses('visually-hidden', classes, className);
|
|
8
|
+
return (jsx("span", { className: cls('root'), ...rest, ref: ref, children: children }));
|
|
9
|
+
});
|
|
10
|
+
VisuallyHidden.displayName = 'SuiVisuallyHidden';
|
|
11
|
+
|
|
12
|
+
export { VisuallyHidden as V };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { motionTransition } from '@ringcentral/spring-theme';
|
|
2
|
+
|
|
3
|
+
const getFade = ({ toggle = true, prefersReducedMotion = false, toggleOnTransition, toggleOffTransition, } = {}) => ({
|
|
4
|
+
initial: 'hidden',
|
|
5
|
+
animate: toggle ? 'show' : 'hidden',
|
|
6
|
+
exit: 'hidden',
|
|
7
|
+
variants: {
|
|
8
|
+
show: {
|
|
9
|
+
opacity: 1,
|
|
10
|
+
transition: prefersReducedMotion
|
|
11
|
+
? motionTransition.instant
|
|
12
|
+
: toggleOnTransition || motionTransition['haste-01-fast'],
|
|
13
|
+
},
|
|
14
|
+
hidden: {
|
|
15
|
+
opacity: 0,
|
|
16
|
+
transition: prefersReducedMotion
|
|
17
|
+
? motionTransition.instant
|
|
18
|
+
: toggleOffTransition || motionTransition['haste-01-slow'],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { getFade as g };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { motionTransition } from '@ringcentral/spring-theme';
|
|
2
|
+
|
|
3
|
+
const getGrow = ({ toggle = true, direction = 'both', prefersReducedMotion = false, toggleOffTransition, toggleOnTransition, transformOrigin, } = {}) => {
|
|
4
|
+
const directionStr = direction === 'both' ? '' : direction.toUpperCase();
|
|
5
|
+
return {
|
|
6
|
+
style: {
|
|
7
|
+
transformOrigin: transformOriginToString(transformOrigin),
|
|
8
|
+
},
|
|
9
|
+
initial: 'invisible',
|
|
10
|
+
animate: toggle ? 'visible' : 'invisible',
|
|
11
|
+
exit: 'invisible',
|
|
12
|
+
variants: {
|
|
13
|
+
invisible: {
|
|
14
|
+
transform: `scale${directionStr}(0.618)`,
|
|
15
|
+
opacity: 0,
|
|
16
|
+
...(!prefersReducedMotion &&
|
|
17
|
+
toggleOffTransition && { transition: toggleOffTransition }),
|
|
18
|
+
},
|
|
19
|
+
visible: {
|
|
20
|
+
transform: `scale${directionStr}(1)`,
|
|
21
|
+
opacity: 1,
|
|
22
|
+
...(!prefersReducedMotion &&
|
|
23
|
+
toggleOnTransition && { transition: toggleOnTransition }),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
transition: prefersReducedMotion
|
|
27
|
+
? motionTransition.instant
|
|
28
|
+
: motionTransition['spring-01-fast'],
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const transformOriginToString = (transformOrigin) => {
|
|
32
|
+
if (!transformOrigin)
|
|
33
|
+
return undefined;
|
|
34
|
+
return `${typeof transformOrigin.vertical === 'number'
|
|
35
|
+
? transformOrigin.vertical + 'px'
|
|
36
|
+
: transformOrigin.vertical} ${typeof transformOrigin.horizontal === 'number'
|
|
37
|
+
? transformOrigin.horizontal + 'px'
|
|
38
|
+
: transformOrigin.horizontal}`;
|
|
39
|
+
};
|
|
40
|
+
const alignmentToHorizontalTransformOrigin = {
|
|
41
|
+
start: 'left',
|
|
42
|
+
end: 'right',
|
|
43
|
+
};
|
|
44
|
+
const alignmentToVerticalTransformOrigin = {
|
|
45
|
+
start: 'top',
|
|
46
|
+
end: 'bottom',
|
|
47
|
+
};
|
|
48
|
+
const getTransformOriginStringForPlacement = (params) => {
|
|
49
|
+
const { placement } = params;
|
|
50
|
+
const [base, alignment] = placement.split('-');
|
|
51
|
+
if (base === 'top' || base === 'bottom') {
|
|
52
|
+
return transformOriginToString({
|
|
53
|
+
vertical: base === 'top' ? 'bottom' : 'top',
|
|
54
|
+
horizontal: !alignment
|
|
55
|
+
? 'center'
|
|
56
|
+
: alignmentToHorizontalTransformOrigin[alignment],
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else if (base === 'left' || base === 'right') {
|
|
60
|
+
return transformOriginToString({
|
|
61
|
+
vertical: !alignment
|
|
62
|
+
? 'center'
|
|
63
|
+
: alignmentToVerticalTransformOrigin[alignment],
|
|
64
|
+
horizontal: base === 'left' ? 'right' : 'left',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { getTransformOriginStringForPlacement as a, getGrow as g };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { motionTransition } from '@ringcentral/spring-theme';
|
|
2
|
+
|
|
3
|
+
const horizontal = ['right', 'left'];
|
|
4
|
+
const plus = ['right', 'bottom'];
|
|
5
|
+
const getSlideIn = ({ toggle = true, from = 'right', prefersReducedMotion = false, toggleOnTransition, toggleOffTransition, } = {}) => {
|
|
6
|
+
const axis = horizontal.includes(from) ? 'x' : 'y';
|
|
7
|
+
const invisibleValue = plus.includes(from) ? '100%' : '-100%';
|
|
8
|
+
return {
|
|
9
|
+
initial: 'invisible',
|
|
10
|
+
animate: toggle ? 'visible' : 'invisible',
|
|
11
|
+
exit: 'invisible',
|
|
12
|
+
variants: {
|
|
13
|
+
visible: {
|
|
14
|
+
[axis]: 0,
|
|
15
|
+
...(!prefersReducedMotion &&
|
|
16
|
+
toggleOnTransition && { transition: toggleOnTransition }),
|
|
17
|
+
},
|
|
18
|
+
invisible: {
|
|
19
|
+
[axis]: invisibleValue,
|
|
20
|
+
...(!prefersReducedMotion &&
|
|
21
|
+
toggleOffTransition && { transition: toggleOffTransition }),
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
transition: prefersReducedMotion
|
|
25
|
+
? motionTransition.instant
|
|
26
|
+
: motionTransition['spring-01-fast'],
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { getSlideIn as g };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useWindowContext, useId, useEventCallback } from '@ringcentral/spring-base';
|
|
3
|
+
|
|
4
|
+
const FOCUS_TRAP_STACK = '__SUI_FOCUS_TRAP_STACK__';
|
|
5
|
+
// use global to ensure the work in the same window
|
|
6
|
+
const getFocusTrapStack = (global) => {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
if (!global[FOCUS_TRAP_STACK]) {
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
global[FOCUS_TRAP_STACK] = [];
|
|
11
|
+
}
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
return global[FOCUS_TRAP_STACK];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Hook to manage focus trap stack for proper layering and focus management
|
|
17
|
+
*/
|
|
18
|
+
const useFocusTrapStack = ({ open, }) => {
|
|
19
|
+
const { globalThis } = useWindowContext();
|
|
20
|
+
const id = useId();
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (open) {
|
|
23
|
+
const stack = getFocusTrapStack(globalThis);
|
|
24
|
+
stack.push(id);
|
|
25
|
+
}
|
|
26
|
+
return () => {
|
|
27
|
+
const stack = getFocusTrapStack(globalThis);
|
|
28
|
+
const index = stack.indexOf(id);
|
|
29
|
+
if (index >= 0) {
|
|
30
|
+
stack.splice(index, 1);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
+
}, [open]);
|
|
35
|
+
const isEnabled = useEventCallback(() => {
|
|
36
|
+
const stack = getFocusTrapStack(globalThis);
|
|
37
|
+
return stack.at(-1) === id;
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
isEnabled,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { useFocusTrapStack as u };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useClasses } from '@ringcentral/spring-base';
|
|
5
|
+
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
6
|
+
|
|
7
|
+
const FormField = forwardRef((inProps, ref) => {
|
|
8
|
+
const props = useThemeProps({ props: inProps, name: 'FormField' });
|
|
9
|
+
const { classes, className, children, htmlFor, label, labelProps, helperText, required, disabled, error, variant = 'standard', size = 'xlarge', contentRef, contentProps, focused, FormHelperTextProps, ...rest } = props;
|
|
10
|
+
const cls = useClasses('form-field', classes, className);
|
|
11
|
+
return (jsxs("div", { ...rest, ref: ref, className: cls('root', variant, { disabled, error, focused }), "aria-disabled": disabled, children: [label && (jsxs("label", { htmlFor: htmlFor, ...labelProps, className: clsx(cls('label', `${variant}-label`, error && 'error-label'), labelProps?.className), children: [label, required ? ' *' : ''] })), jsxs("div", { className: cls('container', error && 'error-container'), children: [jsx("div", { className: cls('content', size, `${size}-content`, `${variant}-${size}`, `${variant}-content`, error && 'error-content', error && `error-${variant}-content`), ref: contentRef, ...contentProps, children: children }), jsx("div", { className: cls('focus-effect', `${variant}-focus-effect`, error && 'error-focus-effect') })] }), helperText && (jsx("div", { ...FormHelperTextProps, className: clsx(cls('helper-text', error && 'error-helper-text'), FormHelperTextProps?.className), children: helperText }))] }));
|
|
12
|
+
});
|
|
13
|
+
FormField.displayName = 'SuiFormField';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Hook to generate consistent helper text IDs for form field accessibility
|
|
17
|
+
*
|
|
18
|
+
* Follows the pattern: `${id}-helper-text`
|
|
19
|
+
*
|
|
20
|
+
* @param options Configuration options
|
|
21
|
+
* @returns Generated helper text ID or undefined if no helper text
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const Select = ({ helperText, FormHelperTextProps, ...props }) => {
|
|
26
|
+
* const id = useId(idProp);
|
|
27
|
+
* const helperTextId = useHelperTextId({ helperText, id, FormHelperTextProps });
|
|
28
|
+
*
|
|
29
|
+
* return (
|
|
30
|
+
* <FormField FormHelperTextProps={{ id: helperTextId, ...FormHelperTextProps }}>
|
|
31
|
+
* <button aria-describedby={helperTextId}>
|
|
32
|
+
* </FormField>
|
|
33
|
+
* );
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
const useHelperTextId = ({ helperText, id, FormHelperTextProps, }) => {
|
|
38
|
+
// Only generate ID if helper text exists
|
|
39
|
+
if (!helperText) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
// Use existing ID if provided, otherwise generate standard pattern
|
|
43
|
+
return FormHelperTextProps?.id || `${id}-helper-text`;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { FormField as F, useHelperTextId as u };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useEventCallback } from '@ringcentral/spring-base';
|
|
3
|
+
import { createContext, useContext, useRef, useMemo, useImperativeHandle } from 'react';
|
|
4
|
+
|
|
5
|
+
const ListNavigationContext = createContext(null);
|
|
6
|
+
const useListNavigationContext = () => useContext(ListNavigationContext);
|
|
7
|
+
|
|
8
|
+
const useListNavigation = (props) => {
|
|
9
|
+
const { preventContainerScroll = true, searchAndFocusItemHandler: searchAndFocusItemHandlerProp = defaultSearchAndFocusItem, actions, } = props;
|
|
10
|
+
const currentFocusedItemRef = useRef(null);
|
|
11
|
+
const listRef = useRef(null);
|
|
12
|
+
const sentinelArrowNavRef = useRef(null);
|
|
13
|
+
const sentinelTabBoundaryRef = useRef(null);
|
|
14
|
+
const skipEnforceFocusRef = useRef(false);
|
|
15
|
+
const focusList = () => {
|
|
16
|
+
skipEnforceFocusRef.current = true;
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
18
|
+
listRef.current.focus();
|
|
19
|
+
};
|
|
20
|
+
const focusTabBoundary = () => {
|
|
21
|
+
skipEnforceFocusRef.current = true;
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
|
+
sentinelTabBoundaryRef.current.focus();
|
|
24
|
+
};
|
|
25
|
+
const itemActions = useMemo(() => ({
|
|
26
|
+
// Prevent cache invalidation
|
|
27
|
+
// eslint-disable-next-line sonarjs/no-identical-functions
|
|
28
|
+
onTab: () => {
|
|
29
|
+
skipEnforceFocusRef.current = true;
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
31
|
+
sentinelTabBoundaryRef.current.focus();
|
|
32
|
+
},
|
|
33
|
+
// eslint-disable-next-line sonarjs/no-identical-functions
|
|
34
|
+
onShiftTab: () => {
|
|
35
|
+
skipEnforceFocusRef.current = true;
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
37
|
+
listRef.current.focus();
|
|
38
|
+
},
|
|
39
|
+
updateFocusedItem: (el) => {
|
|
40
|
+
currentFocusedItemRef.current = el;
|
|
41
|
+
},
|
|
42
|
+
}), []);
|
|
43
|
+
const focusFirstItem = useEventCallback(() => {
|
|
44
|
+
const { focused } = searchAndFocusItemHandler('first');
|
|
45
|
+
if (!focused) {
|
|
46
|
+
focusList();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
useImperativeHandle(actions, () => ({
|
|
50
|
+
focus: focusFirstItem,
|
|
51
|
+
}),
|
|
52
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
|
+
[]);
|
|
54
|
+
const sentinelFocusHandler = (e) => {
|
|
55
|
+
if (e.target === e.currentTarget) {
|
|
56
|
+
const skipEnforceFocus = skipEnforceFocusRef.current;
|
|
57
|
+
if (skipEnforceFocus) {
|
|
58
|
+
skipEnforceFocusRef.current = false;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
focusFirstItem();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const searchAndFocusItemHandler = (searchElementOption) => {
|
|
65
|
+
return searchAndFocusItemHandlerProp(searchElementOption, {
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
67
|
+
sentinelEnd: sentinelArrowNavRef.current,
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
69
|
+
list: listRef.current,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const listKeyDownHandler = (e) => {
|
|
73
|
+
const focusedItem = currentFocusedItemRef.current;
|
|
74
|
+
const key = e.key;
|
|
75
|
+
if (focusedItem) {
|
|
76
|
+
const searchElementOption = {
|
|
77
|
+
ArrowDown: {
|
|
78
|
+
baseElement: focusedItem,
|
|
79
|
+
direction: 'down',
|
|
80
|
+
},
|
|
81
|
+
ArrowUp: {
|
|
82
|
+
baseElement: focusedItem,
|
|
83
|
+
direction: 'up',
|
|
84
|
+
},
|
|
85
|
+
Home: 'first',
|
|
86
|
+
End: 'last',
|
|
87
|
+
}[key];
|
|
88
|
+
if (searchElementOption) {
|
|
89
|
+
const { focused, isAfterBaseElement } = searchAndFocusItemHandler(searchElementOption);
|
|
90
|
+
if (!focused) {
|
|
91
|
+
focusList();
|
|
92
|
+
}
|
|
93
|
+
if (!isAfterBaseElement || preventContainerScroll) {
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
// cover case about all item are disabled
|
|
100
|
+
if (e.target === e.currentTarget && key === 'Tab' && !e.shiftKey) {
|
|
101
|
+
focusTabBoundary();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const getListProps = (otherHandler) => {
|
|
106
|
+
const { onKeyDown, onFocus } = otherHandler;
|
|
107
|
+
const handleKeyDown = (e) => {
|
|
108
|
+
onKeyDown?.(e);
|
|
109
|
+
if (e.defaultPrevented) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
listKeyDownHandler(e);
|
|
113
|
+
};
|
|
114
|
+
const handleFocus = (e) => {
|
|
115
|
+
sentinelFocusHandler(e);
|
|
116
|
+
onFocus?.(e);
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
tabIndex: 0,
|
|
120
|
+
onKeyDown: handleKeyDown,
|
|
121
|
+
onFocus: handleFocus,
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
const renderItems = (items) => {
|
|
125
|
+
return (jsxs(ListNavigationContext.Provider, { value: itemActions, children: [items, jsx("div", { "aria-hidden": "true", ref: sentinelArrowNavRef })] }));
|
|
126
|
+
};
|
|
127
|
+
const renderTabBoundary = () => {
|
|
128
|
+
return (jsx("div", {
|
|
129
|
+
// make sentinel end always render in scroller viewport center to
|
|
130
|
+
// prevent scroll when focus to sentinel end
|
|
131
|
+
style: { position: 'fixed', bottom: '50%' }, ref: sentinelTabBoundaryRef, tabIndex: 0, onFocus: sentinelFocusHandler }));
|
|
132
|
+
};
|
|
133
|
+
return { renderItems, renderTabBoundary, getListProps, listRef };
|
|
134
|
+
};
|
|
135
|
+
const isUnfocusable = (el) => el.matches('.sui-disabled, :disabled, hr, [role="separator"], [disabled]');
|
|
136
|
+
const defaultSearchAndFocusItem = (searchElementOption, helperElements) => {
|
|
137
|
+
const { list, sentinelEnd } = helperElements;
|
|
138
|
+
const getFirstItem = () => {
|
|
139
|
+
const firstItem = list.firstElementChild;
|
|
140
|
+
if (firstItem === sentinelEnd) {
|
|
141
|
+
throw Error('SPRING [useListNavigation]: must have child element');
|
|
142
|
+
}
|
|
143
|
+
return firstItem;
|
|
144
|
+
};
|
|
145
|
+
const getLastItem = () => {
|
|
146
|
+
const lastItem = sentinelEnd.previousElementSibling;
|
|
147
|
+
if (!lastItem) {
|
|
148
|
+
throw Error('SPRING [useListNavigation]: must have child element');
|
|
149
|
+
}
|
|
150
|
+
return lastItem;
|
|
151
|
+
};
|
|
152
|
+
let direction;
|
|
153
|
+
let startElement;
|
|
154
|
+
if (typeof searchElementOption === 'string') {
|
|
155
|
+
if (searchElementOption === 'first') {
|
|
156
|
+
startElement = getFirstItem();
|
|
157
|
+
direction = 'down';
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
startElement = getLastItem();
|
|
161
|
+
direction = 'up';
|
|
162
|
+
}
|
|
163
|
+
if (!isUnfocusable(startElement)) {
|
|
164
|
+
startElement.focus();
|
|
165
|
+
return { focused: true };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
startElement = searchElementOption.baseElement;
|
|
170
|
+
direction = searchElementOption.direction;
|
|
171
|
+
}
|
|
172
|
+
let pointer = startElement;
|
|
173
|
+
let isAfterBaseElement = true;
|
|
174
|
+
if (direction === 'up') {
|
|
175
|
+
do {
|
|
176
|
+
if (!pointer.previousElementSibling) {
|
|
177
|
+
pointer = getLastItem();
|
|
178
|
+
isAfterBaseElement = false;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
pointer = pointer.previousElementSibling;
|
|
182
|
+
}
|
|
183
|
+
if (!isUnfocusable(pointer)) {
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
} while (pointer !== startElement);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
do {
|
|
190
|
+
if (pointer.nextElementSibling === sentinelEnd) {
|
|
191
|
+
pointer = getFirstItem();
|
|
192
|
+
isAfterBaseElement = false;
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
pointer = pointer.nextElementSibling;
|
|
196
|
+
}
|
|
197
|
+
if (!isUnfocusable(pointer)) {
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
} while (pointer !== startElement);
|
|
201
|
+
}
|
|
202
|
+
if (isUnfocusable(pointer)) {
|
|
203
|
+
return { focused: false };
|
|
204
|
+
}
|
|
205
|
+
pointer.focus();
|
|
206
|
+
return typeof searchElementOption === 'string'
|
|
207
|
+
? { focused: true }
|
|
208
|
+
: { focused: true, isAfterBaseElement };
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export { ListNavigationContext as L, useListNavigation as a, useListNavigationContext as u };
|