@ringcentral/spring-ui 1.7.0 → 1.9.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 (282) hide show
  1. package/Alert.js +3 -3
  2. package/Announcement.js +1 -1
  3. package/Autocomplete.js +216 -243
  4. package/Avatar.js +27 -13
  5. package/BottomNavigation.js +0 -3
  6. package/Checkbox.js +0 -2
  7. package/DatePicker.js +5 -13
  8. package/DateUtilsContext.js +0 -1
  9. package/Dialer.js +2 -50
  10. package/Dialog.js +18 -6
  11. package/Dropdown.js +0 -7
  12. package/FocusTrap.js +0 -32
  13. package/InlineEditable.js +0 -4
  14. package/Link.js +1 -1
  15. package/ListItem.js +1 -1
  16. package/ListNavigation.js +0 -6
  17. package/Menu.js +1 -1
  18. package/MenuDivider.js +2 -2
  19. package/MenuFooter.js +4 -4
  20. package/MenuHeader.js +4 -4
  21. package/MenuItem.js +1 -1
  22. package/MenuItemText.js +1 -1
  23. package/Modal.js +1 -1
  24. package/PageHeader.js +6 -4
  25. package/Popper.js +0 -1
  26. package/Rating.js +0 -5
  27. package/SingleFilter.js +0 -1
  28. package/Slider.js +1 -4
  29. package/Snackbar.js +0 -14
  30. package/SortableListItem.js +0 -1
  31. package/SplitButton.js +1 -3
  32. package/StatusIndicator.js +1 -1
  33. package/StepButton.js +2 -3
  34. package/StepContent.js +3 -8
  35. package/SubMenu.js +0 -4
  36. package/SwipeableDrawer.js +37 -162
  37. package/Switch.js +1 -4
  38. package/Tab.js +7 -8
  39. package/TabContext.js +0 -5
  40. package/TableBody.js +1 -1
  41. package/TableCell.js +0 -6
  42. package/TableRow.js +2 -4
  43. package/Tabs.js +22 -121
  44. package/Text.js +2 -4
  45. package/TimePicker.js +7 -46
  46. package/VirtualizedList.js +6 -39
  47. package/VirtualizedMenu.js +1 -1
  48. package/chunks/Alert.js +8 -7
  49. package/chunks/BottomNavigationItem.js +0 -1
  50. package/chunks/Button.js +0 -1
  51. package/chunks/Chip.js +0 -5
  52. package/chunks/Drawer.js +1 -30
  53. package/chunks/ListItem.js +3 -6
  54. package/chunks/Menu.js +6 -5
  55. package/chunks/MenuDivider.js +2 -3
  56. package/chunks/MenuItemText.js +3 -3
  57. package/chunks/MenuList.js +3 -6
  58. package/chunks/Modal.js +1 -1
  59. package/chunks/PickerTextField.js +0 -1
  60. package/chunks/Popover.js +0 -5
  61. package/chunks/Select.js +2 -39
  62. package/chunks/Squircle.js +0 -7
  63. package/chunks/StatusIndicator.js +1 -0
  64. package/chunks/StepIcon.js +1 -3
  65. package/chunks/StepperContext.js +0 -7
  66. package/chunks/Tooltip.js +0 -36
  67. package/chunks/VirtualizedMenu.js +45 -99
  68. package/chunks/getFade.js +4 -0
  69. package/chunks/useFocusTrapStack.js +0 -8
  70. package/chunks/useHelperTextId.js +0 -24
  71. package/chunks/useListNavigation.js +5 -17
  72. package/chunks/useMenuItemSelect.js +9 -22
  73. package/chunks/useMotionSafeTransition.js +0 -4
  74. package/chunks/useNestedParentMenu.js +5 -18
  75. package/chunks/usePrefersReducedMotion.js +6 -12
  76. package/chunks/useTooltipForceHide.js +0 -4
  77. package/chunks/useTrayNavigate.js +0 -1
  78. package/index.css +434 -135
  79. package/index.js +1 -1
  80. package/package.json +4 -4
  81. package/src/Accordion/Accordion.d.ts +1 -1
  82. package/src/Accordion/Accordion.type.d.ts +0 -21
  83. package/src/AccordionHeader/AccordionHeader.d.ts +1 -1
  84. package/src/AccordionHeader/AccordionHeader.type.d.ts +0 -14
  85. package/src/Alert/Alert.d.ts +1 -1
  86. package/src/Alert/Alert.type.d.ts +0 -32
  87. package/src/Animation/components/ExpandCollapseCaret/ExpandCollapseCaret.d.ts +0 -4
  88. package/src/Animation/components/ShowHideEye/ShowHideEye.d.ts +0 -4
  89. package/src/Animation/hooks/useMotionSafeTransition/useMotionSafeTransition.d.ts +0 -4
  90. package/src/Autocomplete/Autocomplete.d.ts +0 -5
  91. package/src/Autocomplete/Autocomplete.type.d.ts +0 -84
  92. package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +5 -89
  93. package/src/Autocomplete/SuggestionList/SuggestionListItem.d.ts +0 -2
  94. package/src/Autocomplete/SuggestionList/utils/SuggestionListItem.d.ts +1 -13
  95. package/src/Autocomplete/SuggestionList/utils/useDynamicHeight.d.ts +0 -6
  96. package/src/Autocomplete/SuggestionList/utils/useHighlightScroll.d.ts +4 -23
  97. package/src/Autocomplete/SuggestionList/utils/useSuggestionList.d.ts +3 -41
  98. package/src/Autocomplete/SuggestionList/utils/useSuggestionListGroup.d.ts +0 -49
  99. package/src/Autocomplete/useAutocomplete.d.ts +5 -66
  100. package/src/Autocomplete/useAutocompleteTag.d.ts +3 -36
  101. package/src/Avatar/Avatar.type.d.ts +0 -58
  102. package/src/AvatarGroup/AvatarGroup.type.d.ts +0 -3
  103. package/src/Backdrop/Backdrop.type.d.ts +0 -4
  104. package/src/Badge/Badge.type.d.ts +0 -33
  105. package/src/Block/Block.type.d.ts +0 -24
  106. package/src/BlockHeader/BlockHeader.type.d.ts +0 -5
  107. package/src/BottomNavigation/BottomNavigation.type.d.ts +0 -34
  108. package/src/BottomNavigationItem/BottomNavigationItem.type.d.ts +0 -39
  109. package/src/Button/Button.type.d.ts +0 -30
  110. package/src/CallButton/CallButton.type.d.ts +0 -4
  111. package/src/Checkbox/Checkbox.type.d.ts +0 -17
  112. package/src/Chip/Chip.type.d.ts +0 -41
  113. package/src/CircularProgressIndicator/CircularProgressIndicator.d.ts +1 -1
  114. package/src/CircularProgressIndicator/CircularProgressIndicator.type.d.ts +0 -19
  115. package/src/DatePicker/Calendar.d.ts +1 -20
  116. package/src/DatePicker/DatePicker.type.d.ts +0 -18
  117. package/src/DatePicker/DatePickerHeader.d.ts +1 -12
  118. package/src/DatePicker/Day.d.ts +1 -8
  119. package/src/DatePicker/Year.d.ts +1 -7
  120. package/src/DatePicker/Years.d.ts +0 -7
  121. package/src/Dialer/DialDelete/DialDelete.d.ts +0 -3
  122. package/src/Dialer/DialPad/DialPad.d.ts +0 -106
  123. package/src/Dialer/DialPad/utils/types.d.ts +0 -5
  124. package/src/Dialer/DialPad/utils/useDialKeyboard.d.ts +0 -5
  125. package/src/Dialer/DialPad/utils/useKeyAudio.d.ts +0 -9
  126. package/src/Dialer/DialPadButton/DialPadButton.d.ts +0 -14
  127. package/src/Dialer/DialTextField/DialTextField.d.ts +0 -23
  128. package/src/Dialer/DialTextField/utils/getDialPadValueOnlyRegex.d.ts +0 -3
  129. package/src/Dialer/DialTextField/utils/useFixedEndSelection.d.ts +0 -3
  130. package/src/Dialog/Dialog.classes.d.ts +1 -1
  131. package/src/Dialog/Dialog.d.ts +1 -1
  132. package/src/Dialog/Dialog.type.d.ts +3 -11
  133. package/src/Divider/Divider.type.d.ts +0 -17
  134. package/src/DragHandle/DragHandle.type.d.ts +0 -4
  135. package/src/Drawer/Drawer.d.ts +1 -29
  136. package/src/Drawer/Drawer.type.d.ts +0 -84
  137. package/src/Dropdown/Dropdown.type.d.ts +0 -64
  138. package/src/EmptyState/EmptyState.d.ts +1 -1
  139. package/src/EmptyState/EmptyState.type.d.ts +0 -12
  140. package/src/FabButton/FabButton.type.d.ts +0 -5
  141. package/src/FocusTrap/FocusTrap.d.ts +0 -38
  142. package/src/FocusTrap/useFocusTrapStack.d.ts +0 -9
  143. package/src/FormField/FormField.type.d.ts +0 -26
  144. package/src/FormField/useHelperTextId.d.ts +0 -25
  145. package/src/FormLabel/FormLabel.d.ts +1 -1
  146. package/src/FormLabel/FormLabel.type.d.ts +0 -14
  147. package/src/Icon/Icon.d.ts +1 -1
  148. package/src/Icon/Icon.type.d.ts +0 -15
  149. package/src/IconButton/IconButton.type.d.ts +0 -30
  150. package/src/IconButton/IconButtonLabel.d.ts +1 -1
  151. package/src/IconButton/IconButtonLabel.type.d.ts +0 -3
  152. package/src/IconButtonGroup/IconButtonGroup.type.d.ts +0 -8
  153. package/src/InlineEditable/InlineEditable.type.d.ts +0 -75
  154. package/src/LinearProgressIndicator/LinearProgressIndicator.type.d.ts +0 -31
  155. package/src/Link/Link.classes.d.ts +1 -1
  156. package/src/Link/Link.type.d.ts +1 -10
  157. package/src/ListItem/ListItem.type.d.ts +0 -41
  158. package/src/ListItemText/ListItemText.d.ts +1 -1
  159. package/src/ListItemText/ListItemText.type.d.ts +0 -21
  160. package/src/ListNavigation/useListNavigation.d.ts +0 -16
  161. package/src/Menu/Menu.d.ts +1 -1
  162. package/src/Menu/Menu.type.d.ts +0 -10
  163. package/src/MenuFooter/MenuFooter.type.d.ts +0 -4
  164. package/src/MenuHeader/MenuHeader.type.d.ts +0 -10
  165. package/src/MenuItem/MenuItem.d.ts +1 -1
  166. package/src/MenuItem/MenuItem.type.d.ts +0 -19
  167. package/src/MenuItem/MenuItemSelectContext.d.ts +0 -3
  168. package/src/MenuItem/useMenuItemSelect.d.ts +0 -21
  169. package/src/MenuItemText/MenuItemText.d.ts +1 -1
  170. package/src/MenuItemText/MenuItemText.type.d.ts +0 -17
  171. package/src/MenuList/MenuList.type.d.ts +0 -4
  172. package/src/MenuList/MenuListContext.d.ts +0 -6
  173. package/src/Modal/InnerModal.d.ts +2 -2
  174. package/src/Modal/InnerModal.type.d.ts +0 -5
  175. package/src/Modal/Modal.classes.d.ts +1 -1
  176. package/src/Modal/Modal.d.ts +3 -3
  177. package/src/Modal/Modal.type.d.ts +0 -11
  178. package/src/Modal/ModalContext.d.ts +0 -4
  179. package/src/NestedMenuContext/NestedMenuContext.d.ts +1 -1
  180. package/src/Option/Option.d.ts +1 -1
  181. package/src/Option/Option.type.d.ts +0 -3
  182. package/src/Overlap/Overlap.type.d.ts +0 -11
  183. package/src/PageHeader/PageHeader.type.d.ts +0 -4
  184. package/src/PickerTextField/PickerTextField.type.d.ts +0 -10
  185. package/src/Popover/Popover.d.ts +1 -1
  186. package/src/Popover/Popover.type.d.ts +0 -29
  187. package/src/Popper/Popper.d.ts +1 -1
  188. package/src/Popper/Popper.type.d.ts +0 -61
  189. package/src/PopperPaper/PopperPaper.d.ts +1 -1
  190. package/src/Radio/Radio.type.d.ts +0 -5
  191. package/src/RadioGroup/RadioGroup.d.ts +1 -1
  192. package/src/RadioGroup/RadioGroup.type.d.ts +0 -4
  193. package/src/Rating/Rating.d.ts +1 -1
  194. package/src/Rating/Rating.type.d.ts +0 -74
  195. package/src/Rating/RatingItem.d.ts +1 -1
  196. package/src/Select/Select.type.d.ts +0 -84
  197. package/src/SingleFilter/FilterButton/FilterButton.d.ts +1 -1
  198. package/src/SingleFilter/FilterButton/FilterButton.type.d.ts +0 -16
  199. package/src/SingleFilter/SingleFilter.d.ts +1 -1
  200. package/src/SingleFilter/SingleFilter.type.d.ts +0 -26
  201. package/src/Skeleton/Skeleton.type.d.ts +0 -1
  202. package/src/Skeleton/SkeletonContainer/SkeletonContainer.classes.d.ts +1 -1
  203. package/src/Slider/Slider.classes.d.ts +1 -5
  204. package/src/Slider/Slider.d.ts +2 -2
  205. package/src/Slider/Slider.type.d.ts +0 -104
  206. package/src/Snackbar/Snackbar.type.d.ts +0 -18
  207. package/src/SortableListItem/SortableListItemOverlay.d.ts +1 -1
  208. package/src/SplitButton/SplitButton.d.ts +1 -1
  209. package/src/SplitButton/SplitButton.type.d.ts +0 -21
  210. package/src/Squircle/Squircle.type.d.ts +0 -3
  211. package/src/StatusIndicator/StatusIndicator.classes.d.ts +1 -1
  212. package/src/StatusIndicator/StatusIndicator.type.d.ts +1 -9
  213. package/src/Step/Step.type.d.ts +0 -29
  214. package/src/Step/StepContext.d.ts +0 -7
  215. package/src/StepButton/StepButton.type.d.ts +0 -15
  216. package/src/StepContent/StepContent.d.ts +1 -1
  217. package/src/StepContent/StepContent.type.d.ts +0 -7
  218. package/src/StepIcon/StepIcon.type.d.ts +0 -26
  219. package/src/StepLabel/StepLabel.d.ts +1 -1
  220. package/src/StepLabel/StepLabel.type.d.ts +0 -23
  221. package/src/Stepper/Stepper.type.d.ts +0 -27
  222. package/src/SubMenu/PopperMenu.d.ts +1 -1
  223. package/src/SubMenu/SubMenu.d.ts +1 -1
  224. package/src/SwipeableDrawer/SwipeableDrawer.d.ts +1 -27
  225. package/src/SwipeableDrawer/SwipeableDrawer.types.d.ts +0 -67
  226. package/src/SwipeableDrawer/hooks/useDrawerGestures.d.ts +0 -110
  227. package/src/SwipeableDrawer/hooks/useElementSizeObserver.d.ts +0 -5
  228. package/src/SwipeableDrawer/hooks/useSnapPoints.d.ts +0 -60
  229. package/src/Switch/Switch.type.d.ts +0 -9
  230. package/src/Tab/Tab.classes.d.ts +3 -2
  231. package/src/Tab/Tab.d.ts +1 -1
  232. package/src/Tab/Tab.type.d.ts +0 -29
  233. package/src/TabContext/TabContext.d.ts +0 -4
  234. package/src/TabContext/TabContext.type.d.ts +0 -7
  235. package/src/TabPanel/TabPanel.d.ts +1 -1
  236. package/src/TabPanel/TabPanel.type.d.ts +0 -10
  237. package/src/Table/Table.type.d.ts +0 -19
  238. package/src/TableBody/TableBody.type.d.ts +0 -3
  239. package/src/TableCell/TableCell.d.ts +0 -4
  240. package/src/TableCell/TableCell.type.d.ts +0 -35
  241. package/src/TableContainer/TableContainer.type.d.ts +0 -7
  242. package/src/TableFooter/TableFooter.type.d.ts +0 -3
  243. package/src/TableHead/TableHead.type.d.ts +0 -6
  244. package/src/TablePagination/TablePagination.type.d.ts +0 -47
  245. package/src/TableRow/TableRow.type.d.ts +0 -17
  246. package/src/Tabs/TabMoreMenu.d.ts +0 -16
  247. package/src/Tabs/TabScrollButton.d.ts +1 -11
  248. package/src/Tabs/Tabs.classes.d.ts +1 -1
  249. package/src/Tabs/Tabs.d.ts +1 -1
  250. package/src/Tabs/Tabs.type.d.ts +2 -36
  251. package/src/Tabs/TabsContext.d.ts +2 -0
  252. package/src/Tabs/hooks/useTabsScroller.d.ts +0 -30
  253. package/src/Tag/Tag.d.ts +1 -1
  254. package/src/Tag/Tag.type.d.ts +0 -12
  255. package/src/Text/Text.type.d.ts +0 -13
  256. package/src/TextField/TextField.type.d.ts +0 -64
  257. package/src/Textarea/Textarea.d.ts +1 -1
  258. package/src/Textarea/Textarea.type.d.ts +0 -13
  259. package/src/TimePicker/NumberPicker.d.ts +1 -1
  260. package/src/TimePicker/NumberPicker.type.d.ts +0 -12
  261. package/src/TimePicker/SelectionView.d.ts +0 -6
  262. package/src/TimePicker/TimeButton.d.ts +1 -4
  263. package/src/TimePicker/TimePicker.type.d.ts +0 -11
  264. package/src/TimePicker/ToggleText.d.ts +1 -1
  265. package/src/TimePicker/ToggleText.type.d.ts +0 -3
  266. package/src/TimePicker/utils/TimeBoundary.d.ts +0 -3
  267. package/src/TimePicker/utils/TimePickerHelper.d.ts +0 -19
  268. package/src/TimePicker/utils/getNumberPickerBoundary.d.ts +0 -3
  269. package/src/Tooltip/TooltipTrigger.a11y.d.ts +0 -9
  270. package/src/Tooltip/TooltipTrigger.type.d.ts +0 -44
  271. package/src/Tooltip/TooltipView.type.d.ts +0 -25
  272. package/src/Tooltip/useTooltipForceHide.d.ts +0 -4
  273. package/src/Tray/Tray.d.ts +1 -1
  274. package/src/Tray/Tray.type.d.ts +0 -13
  275. package/src/Tray/TrayContext.d.ts +0 -4
  276. package/src/Tray/hooks/useTray.d.ts +0 -16
  277. package/src/Tray/hooks/useTrayPanel.d.ts +0 -3
  278. package/src/TrayMenu/TrayMenu.d.ts +1 -1
  279. package/src/TrayMenu/TrayMenuItem.d.ts +1 -1
  280. package/src/VirtualizedList/VirtualizedList.type.d.ts +0 -27
  281. package/src/VirtualizedMenu/VirtualizedMenu.classes.d.ts +1 -1
  282. package/src/VirtualizedMenu/VirtualizedMenu.type.d.ts +0 -17
package/TimePicker.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { createContext, useContext, forwardRef, useRef, useLayoutEffect, useState, useMemo } from 'react';
3
- import { useFocusVisible, useForkRef, combineProps, runKeyHandler, useEventCallback, useClasses } from '@ringcentral/spring-base';
3
+ import { useFocusVisible, useForkRef, combineProps, runKeyHandler, useEventCallback } from '@ringcentral/spring-base';
4
4
  import { CaretUpMd, CaretDownMd, RecentMd } from '@ringcentral/spring-icon';
5
5
  import { I as Icon } from './chunks/Icon.js';
6
6
  import { I as IconButton } from './chunks/IconButtonLabel.js';
7
7
  import clsx from 'clsx';
8
- import { useThemeProps } from '@ringcentral/spring-theme';
8
+ import { useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
9
9
  import { P as PickerTextField } from './chunks/PickerTextField.js';
10
10
  import '@mui/base';
11
11
  import './chunks/Squircle.js';
@@ -66,7 +66,6 @@ const parseNumberToString = (value, isTwelveHourSystem) => {
66
66
  const count = parseNumber(value, isTwelveHourSystem);
67
67
  return pad(count);
68
68
  };
69
- /** add miss zero */
70
69
  const pad = (num, size = 2) => {
71
70
  let s = `${num}`;
72
71
  while (s.length < size) {
@@ -74,12 +73,6 @@ const pad = (num, size = 2) => {
74
73
  }
75
74
  return s;
76
75
  };
77
- /**
78
- * get formatted time hh:mm
79
- * @param option `{hour, min, period}`
80
- * @param isTwelveHourSystem boolean
81
- * @returns `hh:mm AM` or `hh:mm PM` or `hh:mm`
82
- */
83
76
  const getFormattedTime = ({ hour, minute, period }, isTwelveHourSystem) => {
84
77
  const formattedHour = parseNumberToString(hour, isTwelveHourSystem);
85
78
  const formattedMinute = parseNumberToString(minute);
@@ -106,15 +99,9 @@ const twelveHourSystemSource = buildConsecutiveNumberToArray(0, 11);
106
99
  const twentyFourHourSystemSource = buildConsecutiveNumberToArray(0, 23);
107
100
  const minuteSource = [0, 15, 30, 45];
108
101
  const lastMinute = 45;
109
- /**
110
- * hour and minute timestamp
111
- */
112
102
  const getTimestampFromDate = (date) => {
113
103
  return date.getHours() * ONE_HOUR + date.getMinutes() * ONE_MINUTE;
114
104
  };
115
- /**
116
- * hour and minute number
117
- */
118
105
  const getHourAndMinute = (times) => {
119
106
  if (times === null) {
120
107
  return {
@@ -129,23 +116,12 @@ const getHourAndMinute = (times) => {
129
116
  minute: Math.floor(minute / ONE_MINUTE),
130
117
  };
131
118
  };
132
- /**
133
- * get timestamp from date or timestamp
134
- *
135
- * if nowTime is number, it must be hour and minute timestamp
136
- */
137
119
  function getTimestamp(nowTime) {
138
120
  return nowTime instanceof Date ? getTimestampFromDate(nowTime) : nowTime;
139
121
  }
140
- /**
141
- * hour and min object to timestamp
142
- */
143
122
  const getTimestampFromHourAndMin = (option) => {
144
123
  return option.hour * ONE_HOUR + option.minute * ONE_MINUTE;
145
124
  };
146
- /**
147
- * get period, `PM` or `AM`
148
- */
149
125
  function getPeriod(currHour) {
150
126
  return currHour >= HALF_DAY_HOURS ? TIME_SYSTEM_TEXT.PM : TIME_SYSTEM_TEXT.AM;
151
127
  }
@@ -157,8 +133,6 @@ const getRecoupHour = (currHour, period) => {
157
133
  }
158
134
  break;
159
135
  case TIME_SYSTEM_TEXT.AM:
160
- // FIXME
161
- // eslint-disable-next-line sonarjs/no-collapsible-if
162
136
  if (currHour < HALF_DAY_HOURS) {
163
137
  if (currHour >= HALF_DAY_HOURS) {
164
138
  return -HALF_DAY_HOURS;
@@ -174,9 +148,6 @@ const getDateBeginning = () => {
174
148
  date.setHours(0, 0, 0, 0);
175
149
  return date;
176
150
  };
177
- /**
178
- * get target time boundary, what time is nearest time with that timeGap
179
- */
180
151
  class TimeBoundary {
181
152
  _hour = undefined;
182
153
  value;
@@ -217,7 +188,6 @@ class TimeBoundary {
217
188
  let hour = time.getHours();
218
189
  let minute = time.getMinutes();
219
190
  const partCount = Math.ceil(minute / this.timeGap);
220
- // when time is the latest or more, add one hour
221
191
  if (partCount >= HOUR_MINUTES / this.timeGap) {
222
192
  hour++;
223
193
  minute = 0;
@@ -254,9 +224,6 @@ const getRangeBoundary = ({ min, max, gap = TIME_GAP, }) => {
254
224
  };
255
225
  };
256
226
 
257
- /**
258
- * get range from current hour
259
- */
260
227
  function getNumberPickerBoundary(currentHour, { range, isTwelveHourSystem }) {
261
228
  const currentIsPM = currentHour >= HALF_DAY_HOURS;
262
229
  let maxHour = range.max.hour ?? 23;
@@ -306,7 +273,6 @@ const NumberPicker = forwardRef((props, ref) => {
306
273
  if (autoFocus) {
307
274
  pickerRef.current?.focus();
308
275
  }
309
- // eslint-disable-next-line react-hooks/exhaustive-deps
310
276
  }, []);
311
277
  const index = Math.floor(value / step);
312
278
  const isFirst = index === 0;
@@ -416,7 +382,6 @@ const PickerView = (props) => {
416
382
  onChange(resultValue);
417
383
  }
418
384
  };
419
- // get boundary must use current show value
420
385
  const boundary = useMemo(() => {
421
386
  const originHour = value.hour +
422
387
  (isTwelveHourSystem && value.period === TIME_SYSTEM_TEXT.PM ? 12 : 0);
@@ -425,7 +390,6 @@ const PickerView = (props) => {
425
390
  isTwelveHourSystem,
426
391
  });
427
392
  }, [range, value, isTwelveHourSystem]);
428
- // reset pickerValue if pickerValue is out of range
429
393
  useLayoutEffect(() => {
430
394
  const { hour, minute, period } = value;
431
395
  if (hour > boundary.hour.max || minute > boundary.minute.max) {
@@ -442,17 +406,13 @@ const PickerView = (props) => {
442
406
  period,
443
407
  }, true);
444
408
  }
445
- // ignore `handleChange`
446
- // eslint-disable-next-line react-hooks/exhaustive-deps
447
409
  }, [boundary, value]);
448
410
  const isHourView = selectionShowType === 'hour';
449
411
  const { getHourPickerAriaLabel, getMinutePickerAriaLabel, getPeriodToggleAriaLabel, } = screenReaderProps;
450
412
  const toggleTextDisabled = useMemo(() => {
451
413
  return Boolean(range.min.hour &&
452
- // * min is pm time
453
414
  (range.min.hour >= HALF_DAY_HOURS ||
454
415
  (range.max.hour &&
455
- // * min and max in same AM period
456
416
  range.min.hour < HALF_DAY_HOURS &&
457
417
  range.max.hour < HALF_DAY_HOURS)));
458
418
  }, [range.max.hour, range.min.hour]);
@@ -484,7 +444,7 @@ const PickerView = (props) => {
484
444
  }, "data-sui-picker-selection-view": selectionShowType }));
485
445
  };
486
446
 
487
- var TimePicker$1 = {"sui-time-picker-picker-root":"sui-time-picker-picker-root","sui-time-picker-time-button":"sui-time-picker-time-button","sui-focus-visible":"sui-focus-visible","sui-selected":"sui-selected","sui-disabled":"sui-disabled","sui-time-picker-number-picker":"sui-time-picker-number-picker","sui-time-picker-picker-view":"sui-time-picker-picker-view","sui-time-picker-main-view":"sui-time-picker-main-view","sui-time-picker-twelve-hour":"sui-time-picker-twelve-hour","sui-time-picker-minute-selection-view":"sui-time-picker-minute-selection-view","sui-time-picker-hour-selection-view":"sui-time-picker-hour-selection-view"};
447
+ var TimePicker$1 = {"sui-time-picker-picker-root":"sui-time-picker-picker-root","sui-time-picker-time-button":"sui-time-picker-time-button","sui-focus-visible":"sui-focus-visible","sui-selected":"sui-selected","sui-disabled":"sui-disabled","sui-time-picker-number-picker":"sui-time-picker-number-picker","sui-time-picker-picker-view":"sui-time-picker-picker-view","sui-time-picker-main-view":"sui-time-picker-main-view","sui-time-picker-twelve-hour":"sui-time-picker-twelve-hour","sui-time-picker-minute-selection-view":"sui-time-picker-minute-selection-view","sui-time-picker-hour-selection-view":"sui-time-picker-hour-selection-view","sui-compact":"sui-compact"};
488
448
 
489
449
  const TimePicker = forwardRef((inProps, ref) => {
490
450
  const props = useThemeProps({ props: inProps, name: 'TimePicker' });
@@ -493,7 +453,7 @@ const TimePicker = forwardRef((inProps, ref) => {
493
453
  getMinutePickerAriaLabel: (minute) => `Minute: ${minute}, use up and down arrow keys to change minutes time by 15 minutes`,
494
454
  getPeriodToggleAriaLabel: (period) => `${period}, use up or down arrow keys to switch between AM or PM`,
495
455
  }, className, ...rest } = props;
496
- const cls = useClasses('time-picker', classes, className);
456
+ const cls = useClassesWithMode('time-picker', classes, className, ['main-view', 'hour-selection-view', 'minute-selection-view']);
497
457
  const actionRef = useRef(null);
498
458
  const [selectionShowType, setSelectionType] = useState('none');
499
459
  const pickerValue = value ?? defaultPickerValue;
@@ -525,7 +485,6 @@ const TimePicker = forwardRef((inProps, ref) => {
525
485
  update(toValue);
526
486
  }
527
487
  else {
528
- // * when time is zero emit null
529
488
  update(toValue ? getTimestamp(toValue) : null);
530
489
  }
531
490
  });
@@ -564,7 +523,6 @@ const TimePicker = forwardRef((inProps, ref) => {
564
523
  }
565
524
  handleChange(time);
566
525
  };
567
- // reset value if value is out of range
568
526
  useLayoutEffect(() => {
569
527
  if (textFieldTimestamp === null)
570
528
  return;
@@ -587,6 +545,9 @@ const TimePicker = forwardRef((inProps, ref) => {
587
545
  onExitComplete: () => {
588
546
  setSelectionType('none');
589
547
  },
548
+ PopperProps: {
549
+ offset: 4,
550
+ },
590
551
  }, PopoverProps), endIconSymbol: RecentMd, clearBtn: clearBtn, ...rest, children: jsx(PickerView, { isTwelveHourSystem: isTwelveHourSystem, onChange: updateTime, afterDraftConfirm: () => {
591
552
  actionRef.current?.close();
592
553
  }, defaultValue: {
@@ -1,6 +1,6 @@
1
1
  import { createContext, useContext, forwardRef, isValidElement, useRef, useState, useImperativeHandle, useEffect } from 'react';
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { useForkRef, useEventCallback, useWindowContext, logInDev } from '@ringcentral/spring-base';
3
+ import { useForkRef, useWindowContext, useVirtuosoExternalWindow, useEventCallback, logInDev } from '@ringcentral/spring-base';
4
4
  import { useThemeProps } from '@ringcentral/spring-theme';
5
5
  import { Virtuoso } from 'react-virtuoso';
6
6
  import { L as List } from './chunks/List.js';
@@ -12,9 +12,7 @@ const useVirtualizedItemPropsContext = () => useContext(VirtualizedItemPropsCont
12
12
 
13
13
  const VirtuosoList = forwardRef((props, ref) => {
14
14
  const { children: childrenProp, context, style, ...rest } = props;
15
- const { searchAndFocusItemHandler, isScrolling, ListProps, listActions, listRef, itemContentRenderer, data, keepInvisibleItems, computeItemKey,
16
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
17
- } = context;
15
+ const { searchAndFocusItemHandler, isScrolling, ListProps, listActions, listRef, itemContentRenderer, data, keepInvisibleItems, computeItemKey, } = context;
18
16
  const handleListRef = useForkRef(listRef, ref);
19
17
  let rangeStart = null;
20
18
  let rangeEnd = null;
@@ -33,7 +31,6 @@ const VirtuosoList = forwardRef((props, ref) => {
33
31
  children = [
34
32
  ...(rangeStart !== null
35
33
  ? keepInvisibleItems
36
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
37
34
  .filter((itemIndex) => itemIndex < rangeStart)
38
35
  .map((itemIndex) => {
39
36
  const itemData = data ? data[itemIndex] : itemIndex;
@@ -47,7 +44,6 @@ const VirtuosoList = forwardRef((props, ref) => {
47
44
  ...childrenProp,
48
45
  ...(rangeEnd !== null
49
46
  ? keepInvisibleItems
50
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
51
47
  .filter((itemIndex) => itemIndex > rangeEnd)
52
48
  .map((itemIndex) => {
53
49
  const itemData = data ? data[itemIndex] : itemIndex;
@@ -63,9 +59,7 @@ const VirtuosoList = forwardRef((props, ref) => {
63
59
  return (jsx(List, { ...ListProps, ...rest, actions: listActions, style: {
64
60
  ...ListProps?.style,
65
61
  ...style,
66
- // optimize list scrolling
67
62
  ...(isScrolling ? { pointerEvents: 'none' } : undefined),
68
- // for prop `keepInvisibleItems`
69
63
  position: 'relative',
70
64
  }, preventContainerScroll: false, ref: handleListRef, searchAndFocusItemHandler: searchAndFocusItemHandler, children: children }));
71
65
  });
@@ -91,23 +85,18 @@ const VirtualizedList = forwardRef((inProps, ref) => {
91
85
  const handleVirtuosoRef = useForkRef(virtuosoRef, virtuosoActions);
92
86
  const initialFocusItemByIndexPromiseRef = useRef(null);
93
87
  const itemRenderedPromiseRef = useRef(null);
88
+ const { globalThis: contextWindow } = useWindowContext();
89
+ const externalWindowProps = useVirtuosoExternalWindow();
94
90
  const isItemRendered = (index) => {
95
91
  const { startIndex, endIndex } = listRangeRef.current;
96
92
  return index <= endIndex && index >= startIndex;
97
93
  };
98
94
  const focusItemByIndex = (index) => {
99
- /**
100
- * If the component isn't ready, we need to defer the focus action until the component is ready.
101
- * This is necessary if a parent component is waiting for some height calculation of the list to
102
- * be performed before it actually renders the list. If we didn't do this the component would not
103
- * know where to scroll to/would scroll to an incorrect position as it has not yet fully rendered.
104
- */
105
95
  if (!isReady) {
106
96
  new Promise((resolve) => {
107
97
  initialFocusItemByIndexPromiseRef.current = resolve;
108
98
  }).then(() => {
109
- // Wrap in rAF to ensure height has truly settled before focusing
110
- requestAnimationFrame(() => focusByIndexAction(index));
99
+ contextWindow.requestAnimationFrame(() => focusByIndexAction(index));
111
100
  });
112
101
  }
113
102
  else {
@@ -173,7 +162,6 @@ const VirtualizedList = forwardRef((inProps, ref) => {
173
162
  if (direction === 'up') {
174
163
  do {
175
164
  if (pointer - 1 < firstItemIndex) {
176
- // disabled focus loop when infinite is true
177
165
  if (infinite) {
178
166
  pointer = startIndex;
179
167
  }
@@ -193,7 +181,6 @@ const VirtualizedList = forwardRef((inProps, ref) => {
193
181
  else {
194
182
  do {
195
183
  if (pointer + 1 > lastItemIndex) {
196
- // disabled focus loop when infinite is true
197
184
  if (infinite) {
198
185
  pointer = startIndex;
199
186
  }
@@ -234,7 +221,6 @@ const VirtualizedList = forwardRef((inProps, ref) => {
234
221
  focusByIndex: focusByIndexAction,
235
222
  }), [focusByIndexAction]);
236
223
  useEffect(() => {
237
- // Execute the initial focus item by index promise when the list is ready
238
224
  if (isReady) {
239
225
  initialFocusItemByIndexPromiseRef.current?.();
240
226
  }
@@ -251,26 +237,7 @@ const VirtualizedList = forwardRef((inProps, ref) => {
251
237
  itemContentRenderer: children,
252
238
  computeItemKey: computeItemKey,
253
239
  };
254
- const { externalWindow } = useWindowContext();
255
- /**
256
- * The 'externalWindow' prop exists only in the forked version of Virtuoso.
257
- *
258
- * Passing 'externalWindow' to the original Virtuoso component will result in a React error.
259
- *
260
- * If 'externalWindow' is present in the context, it indicates that the user is using the forked version.
261
- *
262
- * Therefore, we only pass 'externalWindow' to Virtuoso when it exists and is not the same as the global window, ensuring compatibility.
263
- */
264
- const externalProps = externalWindow &&
265
- // window is not the same as the global window, we need to pass the externalWindow to Virtuoso for fork virtuoso
266
- externalWindow !== (window || globalThis.window)
267
- ? {
268
- externalWindow,
269
- }
270
- : undefined;
271
- return (jsx(Virtuoso, { className: "sui-virtualized-list", ...externalProps, ref: handleVirtuosoRef,
272
- // pre-render, make scroll smooth when move focus
273
- increaseViewportBy: 200, ...(computeItemKey ? { computeItemKey } : undefined), ...rest, context: { ...context, ...virtuosoContext }, components: { ...VirtuosoComponents, ...components }, totalCount: totalCount, data: data, rangeChanged: (range) => {
240
+ return (jsx(Virtuoso, { className: "sui-virtualized-list", ...externalWindowProps, ref: handleVirtuosoRef, increaseViewportBy: 200, ...(computeItemKey ? { computeItemKey } : undefined), ...rest, context: { ...context, ...virtuosoContext }, components: { ...VirtuosoComponents, ...components }, totalCount: totalCount, data: data, rangeChanged: (range) => {
274
241
  listRangeRef.current = range;
275
242
  const itemRenderedPromise = itemRenderedPromiseRef.current;
276
243
  if (itemRenderedPromise) {
@@ -23,6 +23,6 @@ import './chunks/List.js';
23
23
  import './chunks/useListNavigation.js';
24
24
  import 'tabbable';
25
25
 
26
- var VirtualizedMenu = {"sui-virtualized-menu-paper":"sui-virtualized-menu-paper","sui-virtualized-menu-paper-content-container":"sui-virtualized-menu-paper-content-container"};
26
+ var VirtualizedMenu = {"sui-virtualized-menu-paper":"sui-virtualized-menu-paper","sui-virtualized-menu-paper-content-container":"sui-virtualized-menu-paper-content-container","sui-virtualized-menu-list":"sui-virtualized-menu-list"};
27
27
 
28
28
  export { VirtualizedMenu as virtualizedMenuStyle };
package/chunks/Alert.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { forwardRef, isValidElement } from 'react';
3
- import { useClasses } from '@ringcentral/spring-base';
2
+ import { forwardRef, useMemo, isValidElement } from 'react';
4
3
  import { Xmd, InfoMd, AlertMd, SuccessMd } from '@ringcentral/spring-icon';
5
- import { useThemeProps } from '@ringcentral/spring-theme';
4
+ import { useThemeProps, useClassesWithMode, useMode } from '@ringcentral/spring-theme';
6
5
  import clsx from 'clsx';
7
6
  import { I as Icon } from './Icon.js';
8
7
  import { I as IconButton } from './IconButtonLabel.js';
@@ -17,9 +16,11 @@ const DEFAULT_ICON_MAP = {
17
16
  const Alert = forwardRef((inProps, ref) => {
18
17
  const props = useThemeProps({ props: inProps, name: 'Alert' });
19
18
  const { action, classes, className, component: AlertRoot = 'div', closeText = 'close', children, icon: iconProp, startSlot, onClose, severity = 'info', CloseButtonProps, ...rest } = props;
20
- const cls = useClasses('alert', classes, className);
19
+ const cls = useClassesWithMode('alert', classes, className);
20
+ const { mode } = useMode();
21
+ const iconSize = useMemo(() => (mode === 'compact' ? 'small' : 'medium'), [mode]);
21
22
  const renderIcon = (icon, severity) => {
22
- return (jsx("div", { className: cls('icon', `${severity}-icon`), children: isValidElement(icon) ? (icon) : (jsx(Icon, { size: "medium", symbol: icon })) }));
23
+ return (jsx("div", { className: cls('icon', `${severity}-icon`), children: isValidElement(icon) ? (icon) : (jsx(Icon, { size: iconSize, symbol: icon })) }));
23
24
  };
24
25
  let startSlotContent = null;
25
26
  if (startSlot) {
@@ -31,7 +32,7 @@ const Alert = forwardRef((inProps, ref) => {
31
32
  }
32
33
  let closeSlot = null;
33
34
  if (onClose) {
34
- closeSlot = (jsx(IconButton, { symbol: Xmd, variant: "icon", shape: 'squircle', color: 'secondary', size: "small", background: false, title: closeText, "aria-label": closeText, onClick: onClose, ...CloseButtonProps, className: clsx(cls('close'), CloseButtonProps?.className) }));
35
+ closeSlot = (jsx(IconButton, { symbol: Xmd, variant: "icon", shape: 'squircle', color: 'secondary', size: iconSize, background: false, title: closeText, "aria-label": closeText, onClick: onClose, ...CloseButtonProps, className: clsx(cls('close'), CloseButtonProps?.className) }));
35
36
  }
36
37
  let actionSlot = null;
37
38
  if (action) {
@@ -40,7 +41,7 @@ const Alert = forwardRef((inProps, ref) => {
40
41
  return (jsxs(AlertRoot, { ...rest, ref: ref, className: cls('root', severity), children: [startSlotContent, jsxs("div", { className: cls('body'), children: [jsx("div", { className: cls('content'), role: "alert", children: children }), actionSlot] }), closeSlot] }));
41
42
  });
42
43
  const AlertTitle = ({ className, classes, ...rest }) => {
43
- const cls = useClasses('alert-title', classes, className);
44
+ const cls = useClassesWithMode('alert-title', classes, className);
44
45
  return jsx("div", { className: cls('root'), ...rest });
45
46
  };
46
47
 
@@ -15,7 +15,6 @@ const BottomNavigationItem = forwardRef((inProps, ref) => {
15
15
  const { classes, symbol, activatedSymbol, count, value: valueProp, activated: activatedProp, expanded: expandedProp, onClick, BadgeProps = {}, TooltipProps = {}, ButtonProps = {}, label, className, } = props;
16
16
  const cls = useClasses('bottom-navigation-item', classes, className);
17
17
  const { value: selectedValue, expanded: isExpanded, onSelected, animationComplete, } = useBottomNavigationContext() || {};
18
- // close tooltip temporarily during animation
19
18
  const tooltipOpenProps = useTooltipForceHide(animationComplete === false);
20
19
  const selected = selectedValue === valueProp;
21
20
  const activated = activatedProp !== undefined ? activatedProp : selected;
package/chunks/Button.js CHANGED
@@ -47,7 +47,6 @@ const Button = withTooltip(forwardRef((inProps, ref) => {
47
47
  const ButtonRoot = component;
48
48
  const isTextContent = typeof children === 'string';
49
49
  const title = (() => {
50
- // * if title is not provided and children is string, use children as title
51
50
  if (titleProp === undefined && isTextContent) {
52
51
  return children;
53
52
  }
package/chunks/Chip.js CHANGED
@@ -11,18 +11,14 @@ const Chip = forwardRef((inProps, ref) => {
11
11
  const { component: ChipRoot = 'div', classes, className, children, label, startSlot, size = 'large', clickable: clickableProp, truncate = true, color = 'default', DeleteIconProps = {}, disabled, onClick, onDelete, onKeyDown, onKeyUp, ...rest } = props;
12
12
  const cls = useClasses('chip', classes, className);
13
13
  const handleDeleteIconClick = (event) => {
14
- // Stop the event from bubbling up to the `Chip`
15
14
  event.stopPropagation();
16
15
  if (onDelete) {
17
16
  onDelete(event);
18
17
  }
19
18
  };
20
19
  const handleKeyDown = (event) => {
21
- // Ignore events from children of `Chip`.
22
20
  if (event.currentTarget === event.target &&
23
21
  isDeleteKeyboardEvent(event)) {
24
- // Will be handled in keyUp, otherwise some browsers
25
- // might init navigation
26
22
  event.preventDefault();
27
23
  }
28
24
  if (onKeyDown) {
@@ -30,7 +26,6 @@ const Chip = forwardRef((inProps, ref) => {
30
26
  }
31
27
  };
32
28
  const handleKeyUp = (event) => {
33
- // Ignore events from children of `Chip`.
34
29
  if (event.currentTarget === event.target &&
35
30
  onDelete &&
36
31
  isDeleteKeyboardEvent(event)) {
package/chunks/Drawer.js CHANGED
@@ -9,38 +9,9 @@ import { u as usePrefersReducedMotion } from './usePrefersReducedMotion.js';
9
9
  import { g as getSlideIn } from './getSlideIn.js';
10
10
  import { M as Modal } from './Modal.js';
11
11
 
12
- /**
13
- * Drawer Component - Base drawer without gesture support
14
- *
15
- * A clean, lightweight drawer component that provides basic modal/slide functionality.
16
- * For gesture support, use SwipeableDrawer which builds on top of this component.
17
- *
18
- * @example
19
- * ```tsx
20
- * // Simple navigation drawer
21
- * <Drawer
22
- * open={open}
23
- * onClose={onClose}
24
- * anchor="left"
25
- * variant="temporary"
26
- * >
27
- * <Navigation />
28
- * </Drawer>
29
- *
30
- * // Bottom sheet without gestures
31
- * <Drawer
32
- * open={open}
33
- * onClose={onClose}
34
- * anchor="bottom"
35
- * >
36
- * <Content />
37
- * </Drawer>
38
- * ```
39
- */
40
12
  const Drawer = forwardRef((inProps, ref) => {
41
13
  const props = useThemeProps({ props: inProps, name: 'Drawer' });
42
- const { anchor = 'left', bodyProps, classes, className, children, header, footer, open, onClose, variant = 'temporary', // eslint-disable-line @typescript-eslint/no-unused-vars
43
- blocking = true, measurementRefs, headerProps, ...rest } = props;
14
+ const { anchor = 'left', bodyProps, classes, className, children, header, footer, open, onClose, variant = 'temporary', blocking = true, measurementRefs, headerProps, ...rest } = props;
44
15
  const headerRef = measurementRefs?.header;
45
16
  const footerRef = measurementRefs?.footer;
46
17
  const contentRef = measurementRefs?.content;
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { forwardRef, useEffect } from 'react';
3
- import { useClasses, useFocusVisible, useActive, useHover, combineProps, useForkRef } from '@ringcentral/spring-base';
4
- import { motionTransition, useThemeProps } from '@ringcentral/spring-theme';
3
+ import { useFocusVisible, useActive, useHover, combineProps, useForkRef } from '@ringcentral/spring-base';
4
+ import { motionTransition, useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
5
5
  import { D as Divider } from './Divider.js';
6
6
  import { useItemNavigation } from '../ListNavigation.js';
7
7
  import { useVirtualizedItemPropsContext } from '../VirtualizedList.js';
@@ -34,7 +34,7 @@ const HoverActions = (props) => {
34
34
  const ListItem = forwardRef((inProps, ref) => {
35
35
  const props = useThemeProps({ props: inProps, name: 'ListItem' });
36
36
  const { classes, className, children, hoverActions, size = 'small', tabIndex = -1, role = 'listitem', divider = true, onClick, clickable = Boolean(onClick), hoverable = true, focused = false, highlighted = false, autoFocus, selected, dragged, alwaysShowHoverActions = false, instantHoverActions = false, style: styleProp, ...rest } = props;
37
- const cls = useClasses('list-item', classes, className);
37
+ const cls = useClassesWithMode('list-item', classes, className);
38
38
  const { itemRef, keyboardNavHandlers } = useItemNavigation() ?? {};
39
39
  const virtualizedItemProps = useVirtualizedItemPropsContext();
40
40
  const { focusVisible, focusVisibleWithin, focusVisibleRef, focusVisibleHandlers, } = useFocusVisible({ ...props, within: true });
@@ -44,8 +44,6 @@ const ListItem = forwardRef((inProps, ref) => {
44
44
  });
45
45
  const { hover, hoverHandlers } = useHover({
46
46
  ...props,
47
- // useHover only used for hover actions,
48
- // so disabled when no hover actions or always show
49
47
  disabled: !hoverable || !hoverActions,
50
48
  });
51
49
  const enhancedEventHandlers = (() => {
@@ -64,7 +62,6 @@ const ListItem = forwardRef((inProps, ref) => {
64
62
  if (autoFocus) {
65
63
  itemRef?.current?.focus();
66
64
  }
67
- // eslint-disable-next-line react-hooks/exhaustive-deps
68
65
  }, []);
69
66
  const isShowHoverAction = hover || focusVisibleWithin || alwaysShowHoverActions;
70
67
  return (jsxs("div", { className: cls('root', size, {
package/chunks/Menu.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { createContext, useContext, forwardRef, useMemo } from 'react';
3
- import { useClasses, useEventCallback } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
3
+ import { useEventCallback } from '@ringcentral/spring-base';
4
+ import { useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
5
5
  import { a as useNestedParentMenu, N as NestedMenuContext } from './useNestedParentMenu.js';
6
6
  import { P as Popover } from './Popover.js';
7
7
 
@@ -13,7 +13,7 @@ const useMenuContext = () => {
13
13
  const Menu = forwardRef((inProps, ref) => {
14
14
  const props = useThemeProps({ props: inProps, name: 'Menu' });
15
15
  const { classes, children, open = false, onClose, autoFocus = true, className, PopperProps, ...rest } = props;
16
- const cls = useClasses('menu', classes, className);
16
+ const cls = useClassesWithMode('menu', classes, className);
17
17
  const padding = PopperProps?.padding;
18
18
  const popperPadding = typeof padding === 'object'
19
19
  ? {
@@ -30,8 +30,9 @@ const Menu = forwardRef((inProps, ref) => {
30
30
  onClose?.(undefined, 'Other');
31
31
  });
32
32
  const menuContextValue = useMemo(() => {
33
- return { close: closeHandler, autoFocus };
34
- }, [autoFocus, closeHandler]);
33
+ const effectiveAutoFocus = open ? autoFocus : false;
34
+ return { close: closeHandler, autoFocus: effectiveAutoFocus };
35
+ }, [autoFocus, closeHandler, open]);
35
36
  return (jsx(Popover, { bordered: true, className: cls('root'), PopperProps: { ...PopperProps, padding: popperPadding }, ...rest, open: open, onClose: (e, reason) => {
36
37
  onClose?.(e, reason);
37
38
  }, ref: ref, children: jsx("div", { className: cls('paper'), children: jsx(MenuContext.Provider, { value: menuContextValue, children: jsx(NestedMenuContext.Provider, { value: contextValue, children: children }) }) }) }));
@@ -1,13 +1,12 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef } from 'react';
3
- import { useClasses } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
3
+ import { useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
5
4
  import { D as Divider } from './Divider.js';
6
5
 
7
6
  const MenuDivider = forwardRef((inProps, ref) => {
8
7
  const props = useThemeProps({ props: inProps, name: 'MenuDivider' });
9
8
  const { classes, className, ...rest } = props;
10
- const cls = useClasses('menu-divider', classes, className);
9
+ const cls = useClassesWithMode('menu-divider', classes, className);
11
10
  return jsx(Divider, { className: cls('root'), ...rest, ref: ref });
12
11
  });
13
12
  MenuDivider.displayName = 'SuiMenuDivider';
@@ -1,12 +1,12 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef } from 'react';
3
- import { useClasses, getTitle } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
3
+ import { getTitle } from '@ringcentral/spring-base';
4
+ import { useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
5
5
 
6
6
  const MenuItemText = forwardRef((inProps, ref) => {
7
7
  const props = useThemeProps({ props: inProps, name: 'MenuItemText' });
8
8
  const { classes, className, primary, primaryText, infoText, info, children, ...rest } = props;
9
- const cls = useClasses('menu-item-text', classes, className);
9
+ const cls = useClassesWithMode('menu-item-text', classes, className);
10
10
  const primaryContent = primary ?? primaryText ?? children;
11
11
  const secondaryContent = info ?? infoText;
12
12
  return (jsxs("div", { className: cls('root'), ...rest, ref: ref, children: [jsx("span", { className: cls('primary-text'), title: getTitle(primaryContent), children: primaryContent }), secondaryContent && (jsx("span", { className: cls('info-text'), title: getTitle(secondaryContent), children: secondaryContent }))] }));
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useMemo, useRef, useEffect } from 'react';
2
+ import { forwardRef, useMemo, useRef, useLayoutEffect } from 'react';
3
3
  import { useClasses, useForkRef, useWindowContext } from '@ringcentral/spring-base';
4
4
  import { useThemeProps } from '@ringcentral/spring-theme';
5
5
  import { L as List } from './List.js';
@@ -29,15 +29,12 @@ const MenuList = forwardRef((inProps, ref) => {
29
29
  const listRef = useRef(null);
30
30
  const handleListRef = useForkRef(listRef, ref);
31
31
  const { document } = useWindowContext();
32
- useEffect(() => {
32
+ useLayoutEffect(() => {
33
33
  if (autoFocus &&
34
- // ensure item can auto focus correctly
35
34
  !listRef.current?.contains(document?.activeElement ?? null)) {
36
35
  actions.current?.focus();
37
36
  }
38
- // eslint-disable-next-line react-hooks/exhaustive-deps
39
- }, []);
40
- // Use appropriate role and ARIA attributes based on widget type
37
+ }, [autoFocus]);
41
38
  const listRole = widget === 'select' ? 'listbox' : 'menu';
42
39
  const listboxProps = widget === 'select'
43
40
  ? { 'aria-multiselectable': selectMode === 'multiple' }
package/chunks/Modal.js CHANGED
@@ -31,7 +31,7 @@ const InnerModal = forwardRef((props, ref) => {
31
31
  onBackdropClick?.(event);
32
32
  onClose?.(event, 'backdropClick');
33
33
  });
34
- return (jsx(ModalContext.Provider, { value: { ariaHideEnabled }, children: jsxs(motion.div, { ...rest, ...motionProps, role: "presentation", className: cls('root'), onKeyDown: (e) => {
34
+ return (jsx(ModalContext.Provider, { value: { ariaHideEnabled }, children: jsxs(motion.div, { ...rest, ...motionProps, role: "presentation", className: cls('root', { 'non-blocking': !blocking }), onKeyDown: (e) => {
35
35
  onKeyDown?.(e);
36
36
  if (!disableEscapeKeyDown &&
37
37
  e.key === 'Escape' &&
@@ -57,7 +57,6 @@ const PickerTextField = forwardRef((props, ref) => {
57
57
  ...inputProps,
58
58
  }, ...rest, readOnly: true, onClear: (e) => {
59
59
  onClear?.(e);
60
- // prevent open popover
61
60
  e.stopPropagation();
62
61
  } }), jsx(Popover, { bordered: true, open: open, anchorEl: anchorRef.current, onClose: (...args) => {
63
62
  handleOpen(false);
package/chunks/Popover.js CHANGED
@@ -37,11 +37,6 @@ const Popover = forwardRef((inProps, ref) => {
37
37
  const popperPaperProps = {
38
38
  className: cls('paper', { bordered, shadow }),
39
39
  };
40
- /**
41
- * If no transform origin is set, determine the transform origin using
42
- * the computed placement. This ensures the transition used for the
43
- * grow animation is always faithful to where the Popover is positioned.
44
- */
45
40
  if (!transformOrigin) {
46
41
  popperPaperProps.style = {
47
42
  ...popperPaperProps.style,