@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.
Files changed (405) hide show
  1. package/Alert.js +1 -1
  2. package/Announcement.js +4 -2
  3. package/Autocomplete.js +40 -7
  4. package/Avatar.js +42 -27
  5. package/DatePicker.js +45 -38
  6. package/DateUtilsContext.js +18 -1
  7. package/Dialer.js +1 -1
  8. package/Dialog.js +24 -15
  9. package/NestedMenuContext.js +4 -3
  10. package/Option.js +5 -5
  11. package/PickerTextField.js +2 -2
  12. package/Popper.js +1 -1
  13. package/Snackbar.js +7 -5
  14. package/SortableListDndContext.js +3 -3
  15. package/SortableListItem.js +21 -9
  16. package/SplitButton.js +1 -1
  17. package/SubMenu.js +208 -77
  18. package/SwipeableDrawer.js +1 -9
  19. package/Switch.js +15 -5
  20. package/TablePagination.js +11 -21
  21. package/TableRow.js +1 -1
  22. package/Text.js +2 -2
  23. package/Textarea.js +1 -1
  24. package/TimePicker.js +1 -1
  25. package/chunks/Alert.js +1 -1
  26. package/chunks/Drawer.js +1 -1
  27. package/chunks/Menu.js +25 -6
  28. package/chunks/Modal.js +7 -3
  29. package/chunks/PickerTextField.js +18 -7
  30. package/chunks/TextField.js +0 -1
  31. package/chunks/Tooltip.js +1 -1
  32. package/chunks/VirtualizedMenu.js +1 -1
  33. package/chunks/useMenuItemSelect.js +49 -17
  34. package/chunks/useNestedMenuItem.js +16 -5
  35. package/chunks/useNestedParentMenu.js +77 -5
  36. package/chunks/useTrayNavigate.js +1 -1
  37. package/index.css +543 -398
  38. package/index.js +1 -1
  39. package/package.json +4 -4
  40. package/src/Accordion/Accordion.classes.d.ts +3 -3
  41. package/src/Accordion/Accordion.d.ts +1 -1
  42. package/src/Accordion/Accordion.type.d.ts +1 -1
  43. package/src/Accordion/AccordionContext.d.ts +1 -1
  44. package/src/AccordionHeader/AccordionHeader.classes.d.ts +3 -3
  45. package/src/AccordionHeader/AccordionHeader.d.ts +1 -1
  46. package/src/AccordionHeader/AccordionHeader.type.d.ts +1 -1
  47. package/src/Alert/Alert.classes.d.ts +3 -3
  48. package/src/Alert/Alert.d.ts +3 -3
  49. package/src/Alert/Alert.type.d.ts +7 -7
  50. package/src/Alert/AlertTitle.classes.d.ts +3 -3
  51. package/src/Animation/components/ExpandCollapseCaret/ExpandCollapseCaret.classes.d.ts +3 -3
  52. package/src/Animation/components/ExpandCollapseCaret/ExpandCollapseCaret.d.ts +2 -2
  53. package/src/Animation/components/Fade/Fade.d.ts +1 -1
  54. package/src/Animation/components/Fade/getFade.d.ts +1 -1
  55. package/src/Animation/components/Grow/Grow.d.ts +1 -1
  56. package/src/Animation/components/Grow/getGrow.d.ts +4 -4
  57. package/src/Animation/components/ShowHideEye/ShowHideEye.classes.d.ts +3 -3
  58. package/src/Animation/components/ShowHideEye/ShowHideEye.d.ts +1 -1
  59. package/src/Animation/components/SlideIn/SlideIn.d.ts +1 -1
  60. package/src/Animation/components/SlideIn/getSlideIn.d.ts +2 -2
  61. package/src/Animation/components/SortableArrow/SortableArrow.classes.d.ts +3 -3
  62. package/src/Animation/components/SortableArrow/SortableArrow.d.ts +1 -1
  63. package/src/Animation/components/types.d.ts +2 -2
  64. package/src/Announcement/Announcement.classes.d.ts +3 -3
  65. package/src/Announcement/Announcement.type.d.ts +1 -1
  66. package/src/Autocomplete/Autocomplete.classes.d.ts +6 -6
  67. package/src/Autocomplete/Autocomplete.type.d.ts +6 -5
  68. package/src/Autocomplete/SuggestionList/SuggestionList.classes.d.ts +3 -3
  69. package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +3 -3
  70. package/src/Autocomplete/SuggestionList/SuggestionListItem.d.ts +2 -2
  71. package/src/Autocomplete/SuggestionList/utils/SuggestionListItem.d.ts +1 -1
  72. package/src/Autocomplete/SuggestionList/utils/useDynamicHeight.d.ts +1 -1
  73. package/src/Autocomplete/SuggestionList/utils/useHighlightScroll.d.ts +1 -1
  74. package/src/Autocomplete/SuggestionList/utils/useSuggestionList.d.ts +11 -11
  75. package/src/Autocomplete/SuggestionList/utils/useSuggestionListGroup.d.ts +2 -2
  76. package/src/Autocomplete/useAutocomplete.d.ts +20 -20
  77. package/src/Autocomplete/useAutocompleteTag.d.ts +12 -12
  78. package/src/Avatar/Avatar.classes.d.ts +5 -5
  79. package/src/Avatar/Avatar.type.d.ts +7 -7
  80. package/src/AvatarGroup/AvatarGroup.classes.d.ts +3 -3
  81. package/src/AvatarGroup/AvatarGroup.type.d.ts +6 -6
  82. package/src/Backdrop/Backdrop.classes.d.ts +3 -3
  83. package/src/Backdrop/Backdrop.type.d.ts +1 -1
  84. package/src/Badge/Badge.classes.d.ts +5 -5
  85. package/src/Badge/Badge.type.d.ts +7 -7
  86. package/src/Block/Block.classes.d.ts +3 -3
  87. package/src/Block/Block.type.d.ts +6 -6
  88. package/src/BlockHeader/BlockHeader.classes.d.ts +3 -3
  89. package/src/BlockHeader/BlockHeader.type.d.ts +4 -4
  90. package/src/BottomNavigation/BottomNavigation.classes.d.ts +3 -3
  91. package/src/BottomNavigation/BottomNavigation.type.d.ts +2 -2
  92. package/src/BottomNavigation/BottomNavigationContext.d.ts +1 -1
  93. package/src/BottomNavigation/BottomNavigationGroup/BottomNavigationGroup.classes.d.ts +3 -3
  94. package/src/BottomNavigation/BottomNavigationGroup/BottomNavigationGroup.type.d.ts +1 -1
  95. package/src/BottomNavigationItem/BottomNavigationItem.classes.d.ts +3 -3
  96. package/src/BottomNavigationItem/BottomNavigationItem.type.d.ts +1 -1
  97. package/src/Button/Button.classes.d.ts +3 -3
  98. package/src/Button/Button.type.d.ts +8 -8
  99. package/src/CallButton/CallButton.classes.d.ts +3 -3
  100. package/src/CallButton/CallButton.type.d.ts +5 -5
  101. package/src/Checkbox/Checkbox.classes.d.ts +3 -3
  102. package/src/Checkbox/Checkbox.d.ts +2 -2
  103. package/src/Checkbox/Checkbox.type.d.ts +2 -2
  104. package/src/Chip/Chip.classes.d.ts +3 -3
  105. package/src/Chip/Chip.type.d.ts +5 -5
  106. package/src/CircularProgressIndicator/CircularProgressIndicator.classes.d.ts +4 -4
  107. package/src/CircularProgressIndicator/CircularProgressIndicator.d.ts +1 -1
  108. package/src/CircularProgressIndicator/CircularProgressIndicator.type.d.ts +4 -4
  109. package/src/ComponentsProps.d.ts +1 -1
  110. package/src/DatePicker/Calendar.d.ts +1 -1
  111. package/src/DatePicker/DatePicker.classes.d.ts +3 -3
  112. package/src/DatePicker/DatePicker.d.ts +1 -1
  113. package/src/DatePicker/DatePicker.type.d.ts +3 -3
  114. package/src/DatePicker/DatePickerHeader.d.ts +3 -2
  115. package/src/DatePicker/Day.d.ts +2 -2
  116. package/src/DatePicker/SlideDirection.d.ts +1 -1
  117. package/src/DatePicker/Year.d.ts +2 -2
  118. package/src/DatePicker/Years.d.ts +1 -1
  119. package/src/DatePicker/utils/DatePickerAriaLabelUtils.d.ts +12 -4
  120. package/src/DatePicker/utils/DatePickerUtils.d.ts +1 -1
  121. package/src/DatePicker/utils/findClosestEnabledDate.d.ts +1 -1
  122. package/src/DateUtilsContext/DateUtilsContext.d.ts +8 -2
  123. package/src/Dialer/DialDelete/DialDelete.d.ts +1 -1
  124. package/src/Dialer/DialPad/DialPad.classes.d.ts +3 -3
  125. package/src/Dialer/DialPad/DialPad.d.ts +2 -2
  126. package/src/Dialer/DialPad/utils/DialPadUtils.d.ts +3 -3
  127. package/src/Dialer/DialPad/utils/types.d.ts +2 -2
  128. package/src/Dialer/DialPad/utils/useDialKeyboard.d.ts +1 -1
  129. package/src/Dialer/DialPad/utils/useKeyAudio.d.ts +1 -1
  130. package/src/Dialer/DialPadButton/DialPadButton.classes.d.ts +3 -3
  131. package/src/Dialer/DialPadButton/DialPadButton.d.ts +1 -1
  132. package/src/Dialer/DialTextField/DialTextField.d.ts +2 -2
  133. package/src/Dialer/Dialer.d.ts +1 -1
  134. package/src/Dialer/utils/DialerContext.d.ts +1 -1
  135. package/src/Dialog/Dialog.classes.d.ts +14 -14
  136. package/src/Dialog/Dialog.d.ts +1 -1
  137. package/src/Dialog/Dialog.type.d.ts +5 -4
  138. package/src/Divider/Divider.classes.d.ts +4 -4
  139. package/src/Divider/Divider.type.d.ts +7 -7
  140. package/src/DragHandle/DragHandle.classes.d.ts +3 -3
  141. package/src/DragHandle/DragHandle.type.d.ts +5 -5
  142. package/src/Drawer/Drawer.classes.d.ts +5 -5
  143. package/src/Drawer/Drawer.d.ts +1 -1
  144. package/src/Drawer/Drawer.type.d.ts +4 -4
  145. package/src/Dropdown/Dropdown.classes.d.ts +3 -3
  146. package/src/Dropdown/Dropdown.type.d.ts +1 -1
  147. package/src/EmptyState/EmptyState.classes.d.ts +3 -3
  148. package/src/EmptyState/EmptyState.d.ts +1 -1
  149. package/src/EmptyState/EmptyState.type.d.ts +1 -1
  150. package/src/FabButton/FabButton.classes.d.ts +3 -3
  151. package/src/FabButton/FabButton.type.d.ts +5 -5
  152. package/src/FocusTrap/FocusTrap.d.ts +2 -2
  153. package/src/FormField/FormField.classes.d.ts +4 -4
  154. package/src/FormField/FormField.type.d.ts +3 -3
  155. package/src/FormLabel/FormLabel.classes.d.ts +4 -4
  156. package/src/FormLabel/FormLabel.d.ts +1 -1
  157. package/src/FormLabel/FormLabel.type.d.ts +2 -2
  158. package/src/FormLabel/FormLabelContext.d.ts +1 -1
  159. package/src/Icon/Icon.classes.d.ts +3 -3
  160. package/src/Icon/Icon.d.ts +1 -1
  161. package/src/Icon/Icon.type.d.ts +2 -2
  162. package/src/IconButton/IconButton.classes.d.ts +3 -3
  163. package/src/IconButton/IconButton.type.d.ts +9 -9
  164. package/src/IconButton/IconButtonLabel.classes.d.ts +3 -3
  165. package/src/IconButton/IconButtonLabel.d.ts +1 -1
  166. package/src/IconButton/IconButtonLabel.type.d.ts +1 -1
  167. package/src/IconButtonGroup/IconButtonGroup.classes.d.ts +3 -3
  168. package/src/IconButtonGroup/IconButtonGroup.type.d.ts +4 -4
  169. package/src/InlineEditable/InlineEditable.classes.d.ts +4 -4
  170. package/src/InlineEditable/InlineEditable.type.d.ts +5 -5
  171. package/src/LinearProgressIndicator/LinearProgressIndicator.classes.d.ts +4 -4
  172. package/src/LinearProgressIndicator/LinearProgressIndicator.type.d.ts +2 -2
  173. package/src/Link/Link.classes.d.ts +4 -4
  174. package/src/Link/Link.type.d.ts +4 -4
  175. package/src/List/List.classes.d.ts +3 -3
  176. package/src/List/List.type.d.ts +1 -1
  177. package/src/ListItem/HoverActions.d.ts +1 -1
  178. package/src/ListItem/ListItem.classes.d.ts +3 -3
  179. package/src/ListItem/ListItem.d.ts +1 -1
  180. package/src/ListItem/ListItem.type.d.ts +1 -1
  181. package/src/ListItemText/ListItemText.classes.d.ts +4 -4
  182. package/src/ListItemText/ListItemText.d.ts +1 -1
  183. package/src/ListItemText/ListItemText.type.d.ts +2 -2
  184. package/src/ListNavigation/ListNavigationContext.d.ts +1 -1
  185. package/src/ListNavigation/useListNavigation.d.ts +6 -6
  186. package/src/Menu/Menu.classes.d.ts +3 -3
  187. package/src/Menu/Menu.d.ts +1 -1
  188. package/src/Menu/Menu.type.d.ts +1 -1
  189. package/src/Menu/MenuContext.d.ts +1 -1
  190. package/src/MenuActions/MenuActions.classes.d.ts +6 -6
  191. package/src/MenuActions/MenuActions.type.d.ts +1 -1
  192. package/src/MenuDivider/MenuDivider.classes.d.ts +3 -3
  193. package/src/MenuDivider/MenuDivider.type.d.ts +1 -1
  194. package/src/MenuFooter/MenuFooter.classes.d.ts +3 -3
  195. package/src/MenuFooter/MenuFooter.type.d.ts +1 -1
  196. package/src/MenuHeader/MenuHeader.classes.d.ts +3 -3
  197. package/src/MenuHeader/MenuHeader.type.d.ts +1 -1
  198. package/src/MenuItem/MenuItem.classes.d.ts +3 -3
  199. package/src/MenuItem/MenuItem.d.ts +1 -1
  200. package/src/MenuItem/MenuItem.type.d.ts +1 -1
  201. package/src/MenuItem/MenuItemSelectContext.d.ts +1 -1
  202. package/src/MenuItem/useMenuItem.d.ts +1 -1
  203. package/src/MenuItem/useMenuItemSelect.d.ts +5 -5
  204. package/src/MenuItem/useVirtualizedMenuItem.d.ts +2 -1
  205. package/src/MenuItemText/MenuItemText.classes.d.ts +3 -3
  206. package/src/MenuItemText/MenuItemText.d.ts +1 -1
  207. package/src/MenuItemText/MenuItemText.type.d.ts +1 -1
  208. package/src/MenuList/MenuList.classes.d.ts +3 -3
  209. package/src/MenuList/MenuList.type.d.ts +1 -1
  210. package/src/MenuList/MenuListContext.d.ts +1 -1
  211. package/src/Modal/InnerModal.d.ts +1 -1
  212. package/src/Modal/InnerModal.type.d.ts +2 -2
  213. package/src/Modal/Modal.classes.d.ts +3 -3
  214. package/src/Modal/Modal.d.ts +1 -1
  215. package/src/Modal/Modal.type.d.ts +1 -1
  216. package/src/Modal/ModalContext.d.ts +1 -1
  217. package/src/NestedMenuContext/MenuOverlayGroupContext.d.ts +15 -0
  218. package/src/NestedMenuContext/NestedMenuContext.d.ts +22 -5
  219. package/src/NestedMenuContext/SubMenuTriggerNestedIdContext.d.ts +2 -0
  220. package/src/NestedMenuContext/pointerGrace.d.ts +8 -0
  221. package/src/NestedMenuContext/useNestedChildMenu.d.ts +4 -2
  222. package/src/NestedMenuContext/useNestedMenuItem.d.ts +8 -3
  223. package/src/NestedMenuContext/useNestedParentMenu.d.ts +8 -1
  224. package/src/Option/Option.d.ts +1 -1
  225. package/src/Option/Option.type.d.ts +1 -1
  226. package/src/Overlap/Overlap.classes.d.ts +3 -3
  227. package/src/Overlap/Overlap.type.d.ts +8 -8
  228. package/src/PageHeader/PageHeader.classes.d.ts +15 -15
  229. package/src/PageHeader/PageHeader.type.d.ts +6 -6
  230. package/src/PickerTextField/PickerTextField.classes.d.ts +3 -3
  231. package/src/PickerTextField/PickerTextField.d.ts +1 -1
  232. package/src/PickerTextField/PickerTextField.type.d.ts +2 -2
  233. package/src/Popover/Popover.classes.d.ts +3 -3
  234. package/src/Popover/Popover.d.ts +1 -1
  235. package/src/Popover/Popover.type.d.ts +2 -2
  236. package/src/Popper/Popper.d.ts +1 -1
  237. package/src/Popper/Popper.type.d.ts +4 -4
  238. package/src/PopperPaper/PopperPaper.classes.d.ts +3 -3
  239. package/src/PopperPaper/PopperPaper.d.ts +1 -1
  240. package/src/PopperPaper/PopperPaper.type.d.ts +1 -1
  241. package/src/Radio/Radio.classes.d.ts +3 -3
  242. package/src/Radio/Radio.d.ts +2 -2
  243. package/src/Radio/Radio.type.d.ts +1 -1
  244. package/src/RadioGroup/RadioGroup.classes.d.ts +3 -3
  245. package/src/RadioGroup/RadioGroup.context.d.ts +1 -1
  246. package/src/RadioGroup/RadioGroup.d.ts +1 -1
  247. package/src/RadioGroup/RadioGroup.type.d.ts +1 -1
  248. package/src/Rating/Rating.classes.d.ts +3 -3
  249. package/src/Rating/Rating.d.ts +1 -1
  250. package/src/Rating/Rating.type.d.ts +2 -2
  251. package/src/Rating/RatingItem.d.ts +1 -1
  252. package/src/Select/Select.classes.d.ts +4 -4
  253. package/src/Select/Select.type.d.ts +5 -5
  254. package/src/Select/useSelect.d.ts +1 -1
  255. package/src/SingleFilter/FilterButton/FilterButton.classes.d.ts +3 -3
  256. package/src/SingleFilter/FilterButton/FilterButton.d.ts +1 -1
  257. package/src/SingleFilter/FilterButton/FilterButton.type.d.ts +2 -2
  258. package/src/SingleFilter/SingleFilter.classes.d.ts +3 -3
  259. package/src/SingleFilter/SingleFilter.d.ts +1 -1
  260. package/src/SingleFilter/SingleFilter.type.d.ts +2 -2
  261. package/src/Skeleton/Skeleton.classes.d.ts +3 -3
  262. package/src/Skeleton/Skeleton.type.d.ts +1 -1
  263. package/src/Skeleton/SkeletonContainer/SkeletonContainer.classes.d.ts +3 -3
  264. package/src/Skeleton/SkeletonContainer/SkeletonContainer.type.d.ts +5 -5
  265. package/src/Slider/Slider.classes.d.ts +4 -4
  266. package/src/Slider/Slider.d.ts +3 -3
  267. package/src/Slider/Slider.type.d.ts +2 -2
  268. package/src/Slider/SliderThumb.d.ts +1 -1
  269. package/src/Snackbar/Snackbar.classes.d.ts +3 -3
  270. package/src/Snackbar/Snackbar.d.ts +1 -1
  271. package/src/Snackbar/Snackbar.type.d.ts +1 -1
  272. package/src/Snackbar/SnackbarContent/SnackbarContent.classes.d.ts +3 -3
  273. package/src/Snackbar/SnackbarContent/SnackbarContent.type.d.ts +1 -1
  274. package/src/SortableList/SortableList.type.d.ts +1 -1
  275. package/src/SortableListDndContext/SortableListDndContext.type.d.ts +2 -2
  276. package/src/SortableListItem/SortableListItem.d.ts +1 -1
  277. package/src/SortableListItem/SortableListItem.type.d.ts +2 -2
  278. package/src/SortableListItem/SortableListItemOverlay.d.ts +1 -1
  279. package/src/SortableListItem/SortableListItemOverlay.type.d.ts +1 -1
  280. package/src/SortableVirtualizedList/SortableVirtualizedList.type.d.ts +1 -1
  281. package/src/SplitButton/SplitButton.classes.d.ts +3 -3
  282. package/src/SplitButton/SplitButton.d.ts +1 -1
  283. package/src/SplitButton/SplitButton.type.d.ts +1 -1
  284. package/src/Squircle/Squircle.type.d.ts +5 -5
  285. package/src/Squircle/squircle.classes.d.ts +3 -3
  286. package/src/StatusIndicator/StatusIndicator.classes.d.ts +3 -3
  287. package/src/StatusIndicator/StatusIndicator.type.d.ts +1 -1
  288. package/src/Step/Step.classes.d.ts +3 -3
  289. package/src/Step/Step.type.d.ts +5 -5
  290. package/src/Step/StepContext.d.ts +1 -1
  291. package/src/StepButton/StepButton.classes.d.ts +3 -3
  292. package/src/StepButton/StepButton.type.d.ts +5 -5
  293. package/src/StepConnector/StepConnector.classes.d.ts +3 -3
  294. package/src/StepConnector/StepConnector.type.d.ts +1 -1
  295. package/src/StepContent/StepContent.classes.d.ts +3 -3
  296. package/src/StepContent/StepContent.d.ts +1 -1
  297. package/src/StepContent/StepContent.type.d.ts +1 -1
  298. package/src/StepIcon/StepIcon.classes.d.ts +3 -3
  299. package/src/StepIcon/StepIcon.type.d.ts +1 -1
  300. package/src/StepLabel/StepLabel.classes.d.ts +4 -4
  301. package/src/StepLabel/StepLabel.d.ts +1 -1
  302. package/src/StepLabel/StepLabel.type.d.ts +1 -1
  303. package/src/Stepper/Stepper.classes.d.ts +3 -3
  304. package/src/Stepper/Stepper.type.d.ts +6 -6
  305. package/src/Stepper/StepperContext.d.ts +1 -1
  306. package/src/SubMenu/PopperMenu.classes.d.ts +3 -3
  307. package/src/SubMenu/PopperMenu.d.ts +1 -1
  308. package/src/SubMenu/PopperMenu.type.d.ts +1 -1
  309. package/src/SubMenu/SubMenu.d.ts +1 -1
  310. package/src/SubMenu/SubMenu.type.d.ts +1 -1
  311. package/src/SubMenu/useSubMenuInteractionState.d.ts +13 -0
  312. package/src/SubMenu/useSubMenuPointerGrace.d.ts +15 -0
  313. package/src/SwipeableDrawer/SwipeableDrawer.classes.d.ts +3 -3
  314. package/src/SwipeableDrawer/SwipeableDrawer.d.ts +1 -1
  315. package/src/SwipeableDrawer/SwipeableDrawer.types.d.ts +2 -2
  316. package/src/SwipeableDrawer/hooks/useSnapPoints.d.ts +1 -1
  317. package/src/Switch/Switch.classes.d.ts +3 -3
  318. package/src/Switch/Switch.d.ts +4 -2
  319. package/src/Switch/Switch.type.d.ts +4 -1
  320. package/src/Tab/Tab.classes.d.ts +4 -4
  321. package/src/Tab/Tab.d.ts +1 -1
  322. package/src/Tab/Tab.type.d.ts +4 -4
  323. package/src/TabContext/TabContext.type.d.ts +1 -1
  324. package/src/TabPanel/TabPanel.classes.d.ts +3 -3
  325. package/src/TabPanel/TabPanel.d.ts +1 -1
  326. package/src/TabPanel/TabPanel.type.d.ts +1 -1
  327. package/src/Table/Table.classes.d.ts +3 -3
  328. package/src/Table/Table.type.d.ts +5 -5
  329. package/src/Table/TableContext.d.ts +1 -1
  330. package/src/Table/Tablelvl2Context.d.ts +1 -1
  331. package/src/TableBody/TableBody.classes.d.ts +3 -3
  332. package/src/TableBody/TableBody.type.d.ts +5 -5
  333. package/src/TableCell/TableCell.classes.d.ts +3 -3
  334. package/src/TableCell/TableCell.type.d.ts +7 -7
  335. package/src/TableContainer/TableContainer.classes.d.ts +3 -3
  336. package/src/TableContainer/TableContainer.type.d.ts +6 -6
  337. package/src/TableFooter/TableFooter.classes.d.ts +3 -3
  338. package/src/TableFooter/TableFooter.d.ts +1 -1
  339. package/src/TableFooter/TableFooter.type.d.ts +1 -1
  340. package/src/TableHead/TableHead.classes.d.ts +3 -3
  341. package/src/TableHead/TableHead.type.d.ts +5 -5
  342. package/src/TablePagination/TablePagination.classes.d.ts +3 -3
  343. package/src/TablePagination/TablePagination.type.d.ts +8 -6
  344. package/src/TableRow/TableRow.classes.d.ts +3 -3
  345. package/src/TableRow/TableRow.type.d.ts +5 -5
  346. package/src/Tabs/TabMoreMenu.d.ts +2 -2
  347. package/src/Tabs/TabScrollButton.d.ts +2 -2
  348. package/src/Tabs/Tabs.classes.d.ts +9 -9
  349. package/src/Tabs/Tabs.d.ts +1 -1
  350. package/src/Tabs/Tabs.type.d.ts +2 -2
  351. package/src/Tabs/TabsContext.d.ts +1 -1
  352. package/src/Tabs/hooks/useTabsScroller.d.ts +3 -3
  353. package/src/Tag/Tag.classes.d.ts +3 -3
  354. package/src/Tag/Tag.d.ts +1 -1
  355. package/src/Tag/Tag.type.d.ts +2 -2
  356. package/src/Text/Text.classes.d.ts +3 -3
  357. package/src/Text/Text.type.d.ts +5 -5
  358. package/src/TextField/TextField.classes.d.ts +3 -3
  359. package/src/TextField/TextField.d.ts +1 -1
  360. package/src/TextField/TextField.type.d.ts +9 -9
  361. package/src/Textarea/Textarea.classes.d.ts +4 -4
  362. package/src/Textarea/Textarea.d.ts +1 -1
  363. package/src/Textarea/Textarea.type.d.ts +3 -3
  364. package/src/TimePicker/NumberPicker.d.ts +1 -1
  365. package/src/TimePicker/NumberPicker.type.d.ts +3 -3
  366. package/src/TimePicker/PickerView.type.d.ts +3 -3
  367. package/src/TimePicker/SelectionView.d.ts +1 -1
  368. package/src/TimePicker/TimeButton.d.ts +1 -1
  369. package/src/TimePicker/TimePicker.classes.d.ts +3 -3
  370. package/src/TimePicker/TimePicker.type.d.ts +1 -1
  371. package/src/TimePicker/ToggleText.d.ts +1 -1
  372. package/src/TimePicker/ToggleText.type.d.ts +2 -2
  373. package/src/TimePicker/utils/TimeBoundary.d.ts +3 -3
  374. package/src/TimePicker/utils/TimePickerHelper.d.ts +5 -5
  375. package/src/TimePicker/utils/getNumberPickerBoundary.d.ts +1 -1
  376. package/src/TimePicker/utils/runKeyHandler.d.ts +1 -1
  377. package/src/Tooltip/Tooltip.type.d.ts +1 -1
  378. package/src/Tooltip/TooltipTrigger.a11y.d.ts +4 -4
  379. package/src/Tooltip/TooltipTrigger.type.d.ts +1 -1
  380. package/src/Tooltip/TooltipView.classes.d.ts +3 -3
  381. package/src/Tooltip/TooltipView.type.d.ts +2 -2
  382. package/src/Tooltip/withTooltip/withTooltip.d.ts +1 -1
  383. package/src/Tray/Tray.classes.d.ts +6 -6
  384. package/src/Tray/Tray.d.ts +1 -1
  385. package/src/Tray/Tray.type.d.ts +2 -2
  386. package/src/Tray/TrayContext.d.ts +1 -1
  387. package/src/Tray/TrayPanel.d.ts +1 -1
  388. package/src/Tray/hooks/useTray.d.ts +2 -2
  389. package/src/Tray/hooks/useTrayPanel.d.ts +2 -2
  390. package/src/Tray/types.d.ts +2 -2
  391. package/src/TrayMenu/TrayMenu.d.ts +1 -1
  392. package/src/TrayMenu/TrayMenu.type.d.ts +1 -1
  393. package/src/TrayMenu/TrayMenuItem.d.ts +2 -2
  394. package/src/VirtualizedList/VirtualizedItemPropsContext.d.ts +1 -1
  395. package/src/VirtualizedList/VirtualizedList.type.d.ts +2 -2
  396. package/src/VirtualizedList/VirtuosoContextType.d.ts +1 -1
  397. package/src/VirtualizedMenu/VirtualizedMenu.classes.d.ts +3 -3
  398. package/src/VirtualizedMenu/VirtualizedMenu.context.d.ts +1 -1
  399. package/src/VirtualizedMenu/VirtualizedMenu.type.d.ts +1 -1
  400. package/src/VirtualizedMenu/VirtualizedMenuList.d.ts +1 -1
  401. package/src/VisuallyHidden/VisuallyHidden.classes.d.ts +3 -3
  402. package/src/VisuallyHidden/VisuallyHidden.type.d.ts +1 -1
  403. package/src/internal/utils/composeEventHandlers.d.ts +7 -0
  404. package/src/internal/utils/index.d.ts +1 -0
  405. package/src/Animation/hooks/useMotionSafeTransition/useMotionSafeTransition.d.ts +0 -6
package/Alert.js CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Alert, a as AlertTitle } from './chunks/Alert.js';
1
+ export { a as Alert, A as AlertTitle } from './chunks/Alert.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import '@ringcentral/spring-icon';
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 { A as Alert } from './chunks/Alert.js';
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 = DEFAULT_ICON_MAP[severity], CloseButtonProps, ...rest } = props;
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
- else if (results.length === 0) {
1166
+ if (results.length === 0) {
1150
1167
  const item = getInputValueAsItem();
1151
- noOptionItemRef.current = item;
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 willRenderNoOptions = !!noOptionItem && !!renderNoOptions;
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
- renderNoOptions?.(getNoOptionsProps, noOptionItem)] }));
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 hasImgNotFailing = hasImg && loaded !== 'error';
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
- className: cls('img'),
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
- if (hasImgNotFailing) {
57
- const AvatarImg = 'img';
58
- children = jsx(AvatarImg, { ...imageProps });
59
- fillShape = true;
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
- children = childrenProp;
67
+ else if (hasRenderableFallbackChildren(childrenProp)) {
68
+ fallback = childrenProp;
66
69
  }
67
70
  else if (hasImg && alt) {
68
- children = alt[0];
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 = jsx(Icon, { size: IconSizeMap[size], symbol: ProfileMd });
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
- let AvatarShape = component ?? 'div';
80
- if (variant === 'squircle') {
81
- AvatarShape = Squircle;
82
- }
83
- else if (clickable) {
84
- AvatarShape = 'button';
85
- }
86
- const isButtonElement = AvatarShape === 'button' || component === 'button';
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, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { useFocusVisible, useForkRef, combineProps, useOnlyOneFocusable, useKeyboardMoveFocus, usePrevious, useEventCallback, useWindowContext, runKeyHandler, useControlled } from '@ringcentral/spring-base';
3
- import { createContext, useContext, useRef, forwardRef, useMemo, useLayoutEffect, createElement, useState, useCallback, useEffect } from 'react';
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/useHelperTextId.js';
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 (jsxs(Fragment, { children: [changeFromRef.current && (jsx(VisuallyHidden, { role: "region", "aria-live": "assertive", children: changeFromRef.current === 'next'
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?.(`${utils.getDatePickerHeaderText(date)} ${utils.getYearText(date)}`, selected), ...rest, ...combineProps({ onBlur, onFocus }, focusVisibleHandlers), children: children }));
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 weekdays = useMemo(() => utils.getWeekdays(), [utils]);
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 = `${dayText}/${currentMonthNumber}`;
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
- return renderDay
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: [jsxs("div", { className: cls('days-panel'), role: "presentation", children: [jsx("div", { className: cls('weekdays'), children: weekdays.map((day) => (jsx("span", { className: cls('weekday'), children: day }, day))) }), loadingQueue > 0 ? (jsx("div", { children: loadingElement })) : (jsx("div", { className: cls('days-grid'), onKeyDown: handleKeyDown, children: weeks.current.map((week) => renderDays(week)) }))] }), jsx("div", { children: jsx(Button, { className: cls('today-button'), variant: "outlined", size: "small", color: "secondary", onClick: () => {
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(minDate || defaultMinDate),
410
- max: dayjs(maxDate || defaultMaxDate),
411
- }), [minDate, maxDate]);
412
- const getInvalidateDateInRange = useEventCallback((day) => invalidateDateInRange(day, { dateRange, now: utils.date(), disableFuture, disablePast }, utils));
413
- const shouldDisableDate = useEventCallback((day) => {
414
- return (Boolean(getInvalidateDateInRange(day)) ||
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
- value !== emitValueRef.current &&
452
- shouldDisableDate(dayjsValue)) {
453
- const closestEnabledDate = getClosestEnabledDate(dayjsValue);
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
- value,
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);
@@ -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, 'ddd, MMM D');
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, ...{ [dialButtonKey]: key }, ...getDialPadButtonProps?.(key), ...(key === '0'
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, useMemo } from 'react';
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-close-button":"sui-dialog-close-button","sui-dialog-full-screen":"sui-dialog-full-screen","sui-compact":"sui-compact"};
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 = useMemo(() => kebabCase(size), [size]);
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: usePrefersReducedMotion(),
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
- const nonBlockingProps = !blocking
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 };