@ringcentral/spring-ui 1.11.2 → 1.13.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 (241) hide show
  1. package/Accordion.js +90 -34
  2. package/AccordionHeader.js +72 -20
  3. package/Alert.js +120 -28
  4. package/Animation.js +2 -45
  5. package/Announcement.js +46 -35
  6. package/Autocomplete.js +1011 -580
  7. package/Avatar.js +134 -73
  8. package/AvatarGroup.js +50 -7
  9. package/Backdrop.js +45 -7
  10. package/Badge.js +77 -15
  11. package/Block.js +34 -12
  12. package/BlockHeader.js +55 -11
  13. package/BottomNavigation.js +181 -65
  14. package/BottomNavigationItem.js +93 -30
  15. package/Button.js +160 -24
  16. package/CallButton.js +53 -31
  17. package/Checkbox.js +88 -26
  18. package/Chip.js +126 -26
  19. package/CircularProgressIndicator.js +80 -8
  20. package/ClickAwayListener.js +4 -1
  21. package/ComponentsProps.js +1 -0
  22. package/DatePicker.js +611 -190
  23. package/DateUtilsContext.js +43 -25
  24. package/Dialer.js +576 -250
  25. package/Dialog.js +100 -45
  26. package/Divider.js +43 -7
  27. package/DragHandle.js +32 -6
  28. package/Drawer.js +117 -19
  29. package/Dropdown.js +154 -74
  30. package/EmptyState.js +63 -11
  31. package/FabButton.js +51 -17
  32. package/FocusTrap.js +109 -12
  33. package/FormField.js +106 -8
  34. package/FormLabel.js +81 -7
  35. package/Icon.js +1 -8
  36. package/IconButton.js +142 -26
  37. package/IconButtonGroup.js +35 -12
  38. package/InlineEditable.js +98 -44
  39. package/LinearProgressIndicator.js +73 -24
  40. package/Link.js +40 -11
  41. package/List.js +54 -9
  42. package/ListItem.js +152 -23
  43. package/ListItemText.js +44 -16
  44. package/ListNavigation.js +272 -20
  45. package/Menu.js +139 -23
  46. package/MenuActions.js +37 -12
  47. package/MenuDivider.js +34 -8
  48. package/MenuFooter.js +36 -12
  49. package/MenuHeader.js +54 -15
  50. package/MenuItem.js +402 -33
  51. package/MenuItemText.js +51 -8
  52. package/MenuList.js +87 -34
  53. package/Modal.js +345 -16
  54. package/NestedMenuContext.js +183 -11
  55. package/Option.js +32 -34
  56. package/Overlap.js +54 -7
  57. package/PageHeader.js +62 -24
  58. package/PickerTextField.js +156 -33
  59. package/Popover.js +262 -21
  60. package/Popper.js +130 -77
  61. package/PopperPaper.js +54 -8
  62. package/Portal.js +6 -1
  63. package/Radio.js +65 -21
  64. package/RadioGroup.js +56 -17
  65. package/Rating.js +223 -87
  66. package/Select.js +387 -41
  67. package/SingleFilter.js +148 -77
  68. package/Skeleton.js +68 -17
  69. package/Slider.js +168 -69
  70. package/Snackbar.js +122 -59
  71. package/SortableList.js +32 -12
  72. package/SortableListDndContext.js +69 -22
  73. package/SortableListItem.js +92 -47
  74. package/SortableVirtualizedList.js +52 -28
  75. package/SplitButton.js +124 -86
  76. package/Squircle.js +4 -7
  77. package/StatusIndicator.js +51 -9
  78. package/Step.js +63 -38
  79. package/StepButton.js +51 -23
  80. package/StepConnector.js +48 -8
  81. package/StepContent.js +68 -25
  82. package/StepIcon.js +90 -9
  83. package/StepLabel.js +90 -14
  84. package/Stepper.js +65 -23
  85. package/SubMenu.js +203 -99
  86. package/SwipeableDrawer.js +439 -194
  87. package/Switch.js +70 -23
  88. package/Tab.js +120 -57
  89. package/TabContext.js +59 -15
  90. package/TabPanel.js +40 -13
  91. package/Table.js +60 -17
  92. package/TableBody.js +42 -12
  93. package/TableCell.js +84 -50
  94. package/TableContainer.js +32 -10
  95. package/TableFooter.js +38 -10
  96. package/TableHead.js +49 -15
  97. package/TablePagination.js +153 -77
  98. package/TableRow.js +60 -21
  99. package/Tabs.js +593 -268
  100. package/Tag.js +51 -16
  101. package/Text.js +68 -37
  102. package/TextField.js +209 -29
  103. package/Textarea.js +51 -40
  104. package/TimePicker.js +490 -230
  105. package/Tooltip.js +48 -23
  106. package/Tray.js +237 -13
  107. package/TrayMenu.js +62 -41
  108. package/VirtualizedList.js +208 -109
  109. package/VirtualizedMenu.js +359 -29
  110. package/VisuallyHidden.js +29 -6
  111. package/chunks/1250.js +98 -0
  112. package/chunks/1294.js +126 -0
  113. package/chunks/2956.js +18 -0
  114. package/chunks/4476.js +460 -0
  115. package/chunks/4491.js +10 -0
  116. package/chunks/4535.js +364 -0
  117. package/chunks/5047.js +3 -0
  118. package/chunks/6335.js +24 -0
  119. package/chunks/7279.js +10 -0
  120. package/chunks/8011.js +8 -0
  121. package/chunks/8307.js +56 -0
  122. package/chunks/8467.js +8 -0
  123. package/chunks/8809.js +8 -0
  124. package/chunks/{RadioGroup.context.js → 9551.js} +12 -6
  125. package/chunks/987.js +8 -0
  126. package/index.css +2624 -2416
  127. package/index.js +245 -193
  128. package/internal/utils/index.d.ts +1 -0
  129. package/internal/utils/setRef.d.ts +2 -0
  130. package/package.json +8 -8
  131. package/src/Alert/Alert.type.d.ts +2 -1
  132. package/src/Animation/components/Fade/Fade.d.ts +4 -2
  133. package/src/Animation/components/Grow/Grow.d.ts +4 -2
  134. package/src/Animation/components/ShowHideEye/ShowHideEye.d.ts +1 -1
  135. package/src/Animation/components/SlideIn/SlideIn.d.ts +4 -2
  136. package/src/Animation/components/SlideIn/getSlideIn.d.ts +1 -1
  137. package/src/Animation/hooks/useMotionSafeTransition/useMotionSafeTransition.d.ts +2 -0
  138. package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +1 -1
  139. package/src/Autocomplete/useAutocomplete.d.ts +18 -18
  140. package/src/Autocomplete/useAutocompleteTag.d.ts +18 -18
  141. package/src/Badge/Badge.d.ts +2 -1
  142. package/src/Button/Button.classes.d.ts +1 -1
  143. package/src/ComponentsProps.d.ts +111 -110
  144. package/src/DatePicker/DatePickerDataAttributes.d.ts +11 -0
  145. package/src/DatePicker/utils/DatePickerAriaLabelUtils.d.ts +2 -1
  146. package/src/DatePicker/utils/DatePickerUtils.d.ts +1 -1
  147. package/src/Dialer/DialDelete/DialDelete.d.ts +2 -2
  148. package/src/Dialer/DialPad/DialPad.d.ts +2 -2
  149. package/src/Dialer/Dialer.d.ts +4 -2
  150. package/src/Dropdown/Dropdown.type.d.ts +2 -2
  151. package/src/InlineEditable/InlineEditable.type.d.ts +2 -1
  152. package/src/ListNavigation/useListNavigation.d.ts +3 -3
  153. package/src/MenuActions/MenuActions.d.ts +2 -2
  154. package/src/MenuItem/MenuItem.type.d.ts +1 -0
  155. package/src/MenuItem/useMenuItem.d.ts +1 -1
  156. package/src/MenuItem/useVirtualizedMenuItem.d.ts +1 -1
  157. package/src/MenuList/MenuList.type.d.ts +1 -1
  158. package/src/MenuList/MenuListContext.d.ts +2 -3
  159. package/src/Modal/Modal.type.d.ts +1 -0
  160. package/src/NestedMenuContext/MenuOverlayGroupContext.d.ts +2 -2
  161. package/src/Popover/Popover.classes.d.ts +1 -1
  162. package/src/Popover/Popover.internal.d.ts +8 -0
  163. package/src/Popover/Popover.type.d.ts +1 -0
  164. package/src/Popper/Popper.type.d.ts +10 -7
  165. package/src/Rating/utils.d.ts +3 -2
  166. package/src/Select/Select.type.d.ts +7 -5
  167. package/src/Slider/Slider.d.ts +2 -2
  168. package/src/Slider/SliderThumb.d.ts +2 -1
  169. package/src/Squircle/Squircle.d.ts +1 -1
  170. package/src/StatusIndicator/StatusIndicator.d.ts +2 -1
  171. package/src/SubMenu/PopperMenu.type.d.ts +4 -1
  172. package/src/Table/Table.type.d.ts +3 -0
  173. package/src/Table/TableContext.d.ts +3 -0
  174. package/src/Table/TableRowContext.d.ts +7 -0
  175. package/src/Table/index.d.ts +1 -0
  176. package/src/TableCell/TableCell.classes.d.ts +1 -1
  177. package/src/TableFooter/TableFooter.classes.d.ts +1 -1
  178. package/src/TableFooter/TableFooter.type.d.ts +1 -0
  179. package/src/TableHead/TableHead.classes.d.ts +1 -1
  180. package/src/TableHead/TableHead.type.d.ts +1 -0
  181. package/src/TableRow/TableRow.type.d.ts +2 -0
  182. package/chunks/AccordionContext.js +0 -6
  183. package/chunks/Alert.js +0 -48
  184. package/chunks/AvatarGroup.js +0 -22
  185. package/chunks/Backdrop.js +0 -18
  186. package/chunks/Badge.js +0 -32
  187. package/chunks/BottomNavigationItem.js +0 -36
  188. package/chunks/Button.js +0 -88
  189. package/chunks/Chip.js +0 -73
  190. package/chunks/CircularProgressIndicator.js +0 -36
  191. package/chunks/Divider.js +0 -19
  192. package/chunks/DragHandle.js +0 -11
  193. package/chunks/Drawer.js +0 -32
  194. package/chunks/ExpandCollapseCaret.js +0 -24
  195. package/chunks/FormLabel.js +0 -27
  196. package/chunks/Icon.js +0 -25
  197. package/chunks/IconButtonLabel.js +0 -68
  198. package/chunks/List.js +0 -22
  199. package/chunks/ListItem.js +0 -83
  200. package/chunks/Menu.js +0 -61
  201. package/chunks/MenuDivider.js +0 -14
  202. package/chunks/MenuItemText.js +0 -17
  203. package/chunks/MenuList.js +0 -46
  204. package/chunks/Modal.js +0 -212
  205. package/chunks/Overlap.js +0 -25
  206. package/chunks/PickerTextField.js +0 -85
  207. package/chunks/Popover.js +0 -53
  208. package/chunks/PopperPaper.js +0 -15
  209. package/chunks/Select.js +0 -220
  210. package/chunks/ShowHideEye.js +0 -56
  211. package/chunks/SlideIn.js +0 -19
  212. package/chunks/SortableArrow.js +0 -73
  213. package/chunks/Squircle.js +0 -31
  214. package/chunks/StatusIndicator.js +0 -20
  215. package/chunks/StepConnector.js +0 -21
  216. package/chunks/StepIcon.js +0 -43
  217. package/chunks/StepLabel.js +0 -29
  218. package/chunks/StepperContext.js +0 -9
  219. package/chunks/TableContext.js +0 -6
  220. package/chunks/Tablelvl2Context.js +0 -6
  221. package/chunks/TabsContext.js +0 -6
  222. package/chunks/TextField.js +0 -110
  223. package/chunks/Tooltip.js +0 -217
  224. package/chunks/VirtualizedMenu.js +0 -164
  225. package/chunks/VisuallyHidden.js +0 -12
  226. package/chunks/getFade.js +0 -27
  227. package/chunks/getGrow.js +0 -70
  228. package/chunks/getSlideIn.js +0 -30
  229. package/chunks/hasContent.js +0 -3
  230. package/chunks/useAnimationFrame.js +0 -15
  231. package/chunks/useFocusTrapStack.js +0 -36
  232. package/chunks/useHelperTextId.js +0 -22
  233. package/chunks/useListNavigation.js +0 -199
  234. package/chunks/useMenuItemSelect.js +0 -273
  235. package/chunks/useMotionSafeTransition.js +0 -9
  236. package/chunks/useNestedMenuItem.js +0 -27
  237. package/chunks/useNestedParentMenu.js +0 -113
  238. package/chunks/usePrefersReducedMotion.js +0 -36
  239. package/chunks/useTooltipForceHide.js +0 -27
  240. package/chunks/useTrayNavigate.js +0 -150
  241. package/chunks/withTooltip.js +0 -15
package/Dropdown.js CHANGED
@@ -1,126 +1,206 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { forwardRef, useState, useRef, useEffect } from 'react';
3
- import { useControlled, useClasses, useEventCallback, combineProps, useFocusVisible, useForkRef } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
- import { E as ExpandCollapseCaret } from './chunks/ExpandCollapseCaret.js';
6
- import 'framer-motion';
7
- import './chunks/Icon.js';
8
- import { M as Menu } from './chunks/Menu.js';
9
- import { c as useMenuItemSelect, a as MenuItemSelectContext } from './chunks/useMenuItemSelect.js';
10
- import 'tabbable';
11
- import './chunks/useListNavigation.js';
12
- import './VirtualizedList.js';
13
- import { M as MenuList } from './chunks/MenuList.js';
14
- import { S as Squircle } from './chunks/Squircle.js';
15
- import { a as VirtualizedMenu } from './chunks/VirtualizedMenu.js';
16
- import './chunks/useMotionSafeTransition.js';
17
- import './chunks/usePrefersReducedMotion.js';
18
- import './chunks/useNestedParentMenu.js';
19
- import './chunks/Popover.js';
20
- import '@floating-ui/react-dom';
21
- import './chunks/getGrow.js';
22
- import './chunks/Modal.js';
23
- import '@mui/base';
24
- import './chunks/getFade.js';
25
- import './chunks/useFocusTrapStack.js';
26
- import './chunks/Backdrop.js';
27
- import './Popper.js';
28
- import './chunks/PopperPaper.js';
29
- import '@ringcentral/spring-icon';
30
- import './chunks/useAnimationFrame.js';
31
- import './chunks/useNestedMenuItem.js';
32
- import './ListNavigation.js';
33
- import 'react-virtuoso';
34
- import './chunks/List.js';
35
- import 'clsx';
36
-
37
- var Dropdown$1 = {"sui-dropdown-value":"sui-dropdown-value","sui-dropdown-chevron":"sui-dropdown-chevron","sui-dropdown-button":"sui-dropdown-button","sui-focus-visible":"sui-focus-visible","sui-dropdown-label":"sui-dropdown-label","sui-dropdown-colon":"sui-dropdown-colon","sui-dropdown-activated":"sui-dropdown-activated","sui-dropdown-root":"sui-dropdown-root","sui-disabled":"sui-disabled"};
38
-
39
- const Dropdown = forwardRef((inProps, ref) => {
40
- const props = useThemeProps({ props: inProps, name: 'Dropdown' });
41
- const { classes, className, children, defaultOpen, open: openProp, onOpenChange, disabled, virtualize = true, MenuProps, rootProps, buttonProps: buttonPropsProp = {}, value: valueProp, defaultValue = null, onChange: onChangeProp, renderValue = String, placeholder, label, buttonRef, getSelectedIndex = (value) => {
42
- return data.findIndex((v) => v === value);
43
- }, data, } = props;
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
3
+ import { combineProps, useClasses, useControlled, useEventCallback, useFocusVisible, useForkRef } from "@ringcentral/spring-base";
4
+ import { useThemeProps } from "@ringcentral/spring-theme";
5
+ import "./chunks/4476.js";
6
+ import { Menu as Menu_Menu } from "./Menu.js";
7
+ import { MenuItemSelectContext, useMenuItemSelect, MenuListContext } from "./MenuItem.js";
8
+ import { MenuList as MenuList_MenuList } from "./MenuList.js";
9
+ import "./Squircle.js";
10
+ import { VirtualizedMenu as VirtualizedMenu_VirtualizedMenu } from "./VirtualizedMenu.js";
11
+ import { Squircle as Squircle_Squircle } from "./chunks/1250.js";
12
+ import { ExpandCollapseCaret as ExpandCollapseCaret_ExpandCollapseCaret } from "./chunks/1294.js";
13
+
14
+
15
+
16
+
17
+
18
+ // extracted by css-extract-rspack-plugin
19
+ /* export default */ var Dropdown = ({"sui-dropdown-value":"sui-dropdown-value","sui-dropdown-chevron":"sui-dropdown-chevron","sui-dropdown-button":"sui-dropdown-button","sui-focus-visible":"sui-focus-visible","sui-dropdown-label":"sui-dropdown-label","sui-dropdown-colon":"sui-dropdown-colon","sui-dropdown-activated":"sui-dropdown-activated","sui-dropdown-root":"sui-dropdown-root","sui-disabled":"sui-disabled"});
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ const Dropdown_Dropdown = /*#__PURE__*/ forwardRef((inProps, ref)=>{
32
+ const props = useThemeProps({
33
+ props: inProps,
34
+ name: 'Dropdown'
35
+ });
36
+ const { classes, className, children, defaultOpen, open: openProp, onOpenChange, autoFocus = false, disabled, virtualize = true, MenuProps, rootProps, buttonProps: buttonPropsProp = {}, value: valueProp, defaultValue = null, onChange: onChangeProp, renderValue = String, placeholder, label, buttonRef, getSelectedIndex = (value)=>{
37
+ return data.findIndex((v)=>v === value);
38
+ }, data } = props;
44
39
  const [anchorEl, setAnchorEl] = useState(null);
45
40
  const [open, setOpen] = useControlled({
46
41
  controlled: openProp,
47
42
  default: defaultOpen,
48
43
  name: 'SuiSelect',
49
- state: 'open',
44
+ state: 'open'
50
45
  });
51
46
  const chevronRef = useRef(null);
52
- useEffect(() => {
47
+ useEffect(()=>{
53
48
  setAnchorEl(chevronRef.current);
54
49
  }, []);
55
50
  const cls = useClasses('dropdown', classes, className);
56
- const handleOpen = useEventCallback((isOpen) => {
51
+ const handleOpen = useEventCallback((isOpen)=>{
52
+ // prevent trigger onOpenChange when open state is not change
57
53
  if (open !== isOpen) {
54
+ // for uncontrolled mode
58
55
  setOpen(isOpen);
56
+ // for controlled mode
59
57
  onOpenChange?.(isOpen);
60
58
  }
61
59
  });
62
- const handleClose = useEventCallback(() => {
60
+ const handleClose = useEventCallback(()=>{
63
61
  handleOpen(false);
64
62
  });
65
63
  const [value, setValue] = useControlled({
66
64
  controlled: valueProp,
67
65
  default: defaultValue,
68
66
  name: 'SuiDropdown',
69
- state: 'value',
67
+ state: 'value'
70
68
  });
71
- const handleMenuListChange = useEventCallback((newValue) => {
69
+ const handleMenuListChange = useEventCallback((newValue)=>{
70
+ // for uncontrolled mode
72
71
  setValue(newValue);
72
+ // for controlled mode
73
73
  onChangeProp?.(newValue);
74
74
  handleOpen(false);
75
75
  });
76
76
  const { contextValue: virtualizedMenuContextValue } = useMenuItemSelect({
77
77
  value,
78
78
  onChange: handleMenuListChange,
79
- onClose: handleClose,
79
+ onClose: handleClose
80
80
  });
81
+ const menuListContextValue = useMemo(()=>({
82
+ nowrap: true
83
+ }), []);
81
84
  const buttonProps = combineProps({
82
- onClick: () => {
83
- if (!open)
84
- handleOpen(true);
85
+ onClick: ()=>{
86
+ if (!disabled && !open) handleOpen(true);
85
87
  },
86
- onKeyDown: (e) => {
88
+ onKeyDown: (e)=>{
87
89
  if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
90
+ // prevent scroll
88
91
  e.preventDefault();
89
- handleOpen(true);
92
+ if (!disabled) handleOpen(true);
90
93
  }
91
- },
94
+ }
92
95
  }, buttonPropsProp);
93
96
  const { focusVisible, focusVisibleRef, focusVisibleHandlers } = useFocusVisible(buttonProps);
94
97
  const handleButtonRef = useForkRef(buttonRef, focusVisibleRef);
95
- useEffect(() => {
98
+ useEffect(()=>{
99
+ // close menu when disabled
96
100
  if (disabled) {
97
101
  handleOpen(false);
98
102
  }
99
- }, [disabled, handleOpen]);
103
+ }, [
104
+ disabled,
105
+ handleOpen
106
+ ]);
100
107
  const baseMenuProps = {
101
- placement: 'top',
108
+ placement: 'bottom',
102
109
  open,
103
110
  anchorEl,
104
- onClose: handleClose,
111
+ onClose: handleClose
105
112
  };
106
113
  let menu = null;
107
114
  if (!virtualize) {
108
- menu = (jsx(Menu, { ...baseMenuProps, ...MenuProps, children: jsx(MenuList, { value: value, onChange: handleMenuListChange, nowrap: false, widget: "menu", children: children }) }));
109
- }
110
- else {
111
- menu = (jsx(MenuItemSelectContext.Provider, { value: virtualizedMenuContextValue, children: jsx(VirtualizedMenu, { ...baseMenuProps, ...MenuProps, initialFocus: () => {
112
- if (value !== null)
113
- return getSelectedIndex(value);
115
+ menu = /*#__PURE__*/ jsx(Menu_Menu, {
116
+ ...baseMenuProps,
117
+ ...MenuProps,
118
+ children: /*#__PURE__*/ jsx(MenuList_MenuList, {
119
+ value: value,
120
+ onChange: handleMenuListChange,
121
+ nowrap: menuListContextValue.nowrap,
122
+ widget: "menu",
123
+ children: children
124
+ })
125
+ });
126
+ } else {
127
+ menu = /*#__PURE__*/ jsx(MenuItemSelectContext.Provider, {
128
+ value: virtualizedMenuContextValue,
129
+ children: /*#__PURE__*/ jsx(VirtualizedMenu_VirtualizedMenu, {
130
+ ...baseMenuProps,
131
+ ...MenuProps,
132
+ initialFocus: ()=>{
133
+ if (value !== null) return getSelectedIndex(value);
114
134
  return true;
115
- }, data: data, children: children }) }));
135
+ },
136
+ data: data,
137
+ children: children
138
+ })
139
+ });
116
140
  }
117
- return (jsxs(Fragment, { children: [jsxs("div", { "aria-disabled": disabled, ...rootProps, className: cls('root', {
118
- disabled,
119
- }), ref: ref, children: [label && (jsxs(Fragment, { children: [jsx("span", { className: cls('label'), children: label }), jsx("span", { className: cls('colon'), children: ":" })] })), jsxs("button", { className: cls('button', {
141
+ return /*#__PURE__*/ jsxs(Fragment, {
142
+ children: [
143
+ /*#__PURE__*/ jsxs("div", {
144
+ "aria-disabled": disabled,
145
+ ...rootProps,
146
+ className: cls('root', {
147
+ disabled
148
+ }),
149
+ ref: ref,
150
+ children: [
151
+ label && /*#__PURE__*/ jsxs(Fragment, {
152
+ children: [
153
+ /*#__PURE__*/ jsx("span", {
154
+ className: cls('label'),
155
+ children: label
156
+ }),
157
+ /*#__PURE__*/ jsx("span", {
158
+ className: cls('colon'),
159
+ children: ":"
160
+ })
161
+ ]
162
+ }),
163
+ /*#__PURE__*/ jsxs("button", {
164
+ className: cls('button', {
120
165
  activated: open,
121
- focusVisible,
122
- }), ...buttonProps, ...focusVisibleHandlers, ref: handleButtonRef, children: [jsx("span", { className: cls('value'), children: value === null ? placeholder : renderValue(value) }), jsx(Squircle, { className: cls('chevron'), interactive: false, ref: chevronRef, children: jsx(ExpandCollapseCaret, { size: 'small', expanded: open }) })] })] }), anchorEl && menu] }));
166
+ focusVisible
167
+ }),
168
+ ...buttonProps,
169
+ ...focusVisibleHandlers,
170
+ type: "button",
171
+ autoFocus: autoFocus && !disabled,
172
+ disabled: disabled,
173
+ ref: handleButtonRef,
174
+ children: [
175
+ /*#__PURE__*/ jsx("span", {
176
+ className: cls('value'),
177
+ children: value === null ? placeholder : renderValue(value)
178
+ }),
179
+ /*#__PURE__*/ jsx(Squircle_Squircle, {
180
+ className: cls('chevron'),
181
+ interactive: false,
182
+ ref: chevronRef,
183
+ children: /*#__PURE__*/ jsx(ExpandCollapseCaret_ExpandCollapseCaret, {
184
+ size: 'small',
185
+ expanded: open
186
+ })
187
+ })
188
+ ]
189
+ })
190
+ ]
191
+ }),
192
+ /*#__PURE__*/ jsx(MenuListContext.Provider, {
193
+ value: menuListContextValue,
194
+ children: anchorEl && menu
195
+ })
196
+ ]
197
+ });
123
198
  });
124
- Dropdown.displayName = 'SuiDropdown';
199
+ Dropdown_Dropdown.displayName = 'SuiDropdown';
200
+
201
+
202
+
203
+
204
+
125
205
 
126
- export { Dropdown, Dropdown$1 as dropdownStyle };
206
+ export { Dropdown as dropdownStyle, Dropdown_Dropdown as Dropdown };
package/EmptyState.js CHANGED
@@ -1,17 +1,69 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useClasses, getTitle } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
- import { I as Icon } from './chunks/Icon.js';
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { getTitle, useClasses } from "@ringcentral/spring-base";
4
+ import { useThemeProps } from "@ringcentral/spring-theme";
5
+ import { Icon as Icon_Icon } from "./chunks/8307.js";
6
+ import { hasContent } from "./chunks/5047.js";
6
7
 
7
- var EmptyState$1 = {"sui-empty-state-root":"sui-empty-state-root","sui-empty-state-icon":"sui-empty-state-icon","sui-empty-state-text-container":"sui-empty-state-text-container","sui-empty-state-title":"sui-empty-state-title","sui-empty-state-description":"sui-empty-state-description","sui-empty-state-actions":"sui-empty-state-actions"};
8
8
 
9
- const EmptyState = forwardRef((inProps, ref) => {
10
- const props = useThemeProps({ props: inProps, name: 'EmptyState' });
9
+
10
+
11
+
12
+ // extracted by css-extract-rspack-plugin
13
+ /* export default */ var EmptyState = ({"sui-empty-state-root":"sui-empty-state-root","sui-empty-state-icon":"sui-empty-state-icon","sui-empty-state-text-container":"sui-empty-state-text-container","sui-empty-state-title":"sui-empty-state-title","sui-empty-state-description":"sui-empty-state-description","sui-empty-state-actions":"sui-empty-state-actions"});
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+ const EmptyState_EmptyState = /*#__PURE__*/ forwardRef((inProps, ref)=>{
22
+ const props = useThemeProps({
23
+ props: inProps,
24
+ name: 'EmptyState'
25
+ });
11
26
  const { classes, className, title, description, icon, actions, ...rest } = props;
12
27
  const cls = useClasses('empty-state', classes, className);
13
- return (jsxs("div", { ...rest, className: cls('root'), children: [icon && (jsx("div", { className: cls('icon'), children: jsx(Icon, { size: "xxxlarge", symbol: icon }) })), (title || description) && (jsxs("div", { className: cls('text-container'), children: [title && (jsx("span", { className: cls('title'), title: getTitle(title), children: title })), description && (jsx("span", { className: cls('description'), title: getTitle(description), children: description }))] })), actions && actions.length > 0 && (jsx("div", { className: cls('actions'), children: actions }))] }));
28
+ return /*#__PURE__*/ jsxs("div", {
29
+ ...rest,
30
+ ref: ref,
31
+ className: cls('root'),
32
+ children: [
33
+ icon && /*#__PURE__*/ jsx("div", {
34
+ className: cls('icon'),
35
+ children: /*#__PURE__*/ jsx(Icon_Icon, {
36
+ size: "xxxlarge",
37
+ symbol: icon
38
+ })
39
+ }),
40
+ (hasContent(title) || hasContent(description)) && /*#__PURE__*/ jsxs("div", {
41
+ className: cls('text-container'),
42
+ children: [
43
+ hasContent(title) && /*#__PURE__*/ jsx("span", {
44
+ className: cls('title'),
45
+ title: getTitle(title),
46
+ children: title
47
+ }),
48
+ hasContent(description) && /*#__PURE__*/ jsx("span", {
49
+ className: cls('description'),
50
+ title: getTitle(description),
51
+ children: description
52
+ })
53
+ ]
54
+ }),
55
+ actions && actions.length > 0 && /*#__PURE__*/ jsx("div", {
56
+ className: cls('actions'),
57
+ children: actions
58
+ })
59
+ ]
60
+ });
14
61
  });
15
- EmptyState.displayName = 'SuiEmptyState';
62
+ EmptyState_EmptyState.displayName = 'SuiEmptyState';
63
+
64
+
65
+
66
+
67
+
16
68
 
17
- export { EmptyState, EmptyState$1 as emptyStateStyle };
69
+ export { EmptyState as emptyStateStyle, EmptyState_EmptyState as EmptyState };
package/FabButton.js CHANGED
@@ -1,32 +1,66 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useState } from 'react';
3
- import { useButton } from '@mui/base';
4
- import { useClasses } from '@ringcentral/spring-base';
5
- import { useThemeProps } from '@ringcentral/spring-theme';
6
- import { I as Icon } from './chunks/Icon.js';
7
- import { S as Squircle } from './chunks/Squircle.js';
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useState } from "react";
3
+ import { useButton } from "@mui/base";
4
+ import { useClasses } from "@ringcentral/spring-base";
5
+ import { useThemeProps } from "@ringcentral/spring-theme";
6
+ import { Icon as Icon_Icon } from "./chunks/8307.js";
7
+ import { Squircle as Squircle_Squircle } from "./chunks/1250.js";
8
+
9
+
10
+
11
+
12
+
13
+
14
+ // extracted by css-extract-rspack-plugin
15
+ /* export default */ var FabButton = ({"sui-fab-button-root":"sui-fab-button-root","sui-fab-button-large":"sui-fab-button-large","sui-fab-button-small":"sui-fab-button-small","sui-fab-button-activated":"sui-fab-button-activated","sui-active":"sui-active"});
16
+
17
+
18
+
19
+
20
+
21
+
8
22
 
9
- var FabButton$1 = {"sui-fab-button-root":"sui-fab-button-root","sui-fab-button-large":"sui-fab-button-large","sui-fab-button-small":"sui-fab-button-small","sui-fab-button-activated":"sui-fab-button-activated","sui-active":"sui-active"};
10
23
 
11
24
  const IconSizeMap = {
12
25
  large: 'medium',
13
- small: 'small',
26
+ small: 'small'
14
27
  };
15
- const FabButton = forwardRef((inProps, ref) => {
16
- const props = useThemeProps({ props: inProps, name: 'FabButton' });
28
+ const FabButton_FabButton = /*#__PURE__*/ forwardRef((inProps, ref)=>{
29
+ const props = useThemeProps({
30
+ props: inProps,
31
+ name: 'FabButton'
32
+ });
17
33
  const { classes, className, symbol, size = 'large', onClick, ...rest } = props;
18
34
  const [activated, setActivated] = useState(false);
19
35
  const cls = useClasses('fab-button', classes, className);
20
- const clickHandler = (e) => {
21
- setActivated((pre) => !pre);
36
+ const clickHandler = (e)=>{
37
+ setActivated((pre)=>!pre);
22
38
  onClick && onClick(e);
23
39
  };
24
40
  const { getRootProps, focusVisible } = useButton({
25
41
  ...props,
26
- rootRef: ref,
42
+ rootRef: ref
43
+ });
44
+ return /*#__PURE__*/ jsx(Squircle_Squircle, {
45
+ component: "button",
46
+ className: cls('root', size, {
47
+ activated
48
+ }),
49
+ focusVisible: focusVisible,
50
+ ...rest,
51
+ ...getRootProps(),
52
+ onClick: clickHandler,
53
+ children: /*#__PURE__*/ jsx(Icon_Icon, {
54
+ size: IconSizeMap[size],
55
+ symbol: symbol
56
+ })
27
57
  });
28
- return (jsx(Squircle, { component: "button", className: cls('root', size, { activated }), focusVisible: focusVisible, ...rest, ...getRootProps(), onClick: clickHandler, children: jsx(Icon, { size: IconSizeMap[size], symbol: symbol }) }));
29
58
  });
30
- FabButton.displayName = 'SuiFabButton';
59
+ FabButton_FabButton.displayName = 'SuiFabButton';
60
+
61
+
62
+
63
+
64
+
31
65
 
32
- export { FabButton, FabButton$1 as fabButtonStyle };
66
+ export { FabButton as fabButtonStyle, FabButton_FabButton as FabButton };
package/FocusTrap.js CHANGED
@@ -1,16 +1,113 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { FocusTrap as FocusTrap$1 } from '@mui/base';
3
- import { useImperativeHandle } from 'react';
4
- import { u as useFocusTrapStack } from './chunks/useFocusTrapStack.js';
5
- import '@ringcentral/spring-base';
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { FocusTrap } from "@mui/base";
3
+ import { useEffect, useImperativeHandle } from "react";
4
+ import { useEventCallback, useId, useWindowContext } from "@ringcentral/spring-base";
6
5
 
7
- const FocusTrap = (props) => {
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ const FOCUS_TRAP_STACK = '__SUI_FOCUS_TRAP_STACK__';
14
+ // use global to ensure the work in the same window
15
+ const getFocusTrapStack = (global)=>{
16
+ // @ts-ignore
17
+ if (!global[FOCUS_TRAP_STACK]) {
18
+ // @ts-ignore
19
+ global[FOCUS_TRAP_STACK] = [];
20
+ }
21
+ // @ts-ignore
22
+ return global[FOCUS_TRAP_STACK];
23
+ };
24
+ /**
25
+ * Hook to manage focus trap stack for proper layering and focus management
26
+ */ const useFocusTrapStack = ({ open })=>{
27
+ const { globalThis } = useWindowContext();
28
+ const id = useId();
29
+ useEffect(()=>{
30
+ if (open) {
31
+ const stack = getFocusTrapStack(globalThis);
32
+ if (stack.indexOf(id) < 0) {
33
+ stack.push(id);
34
+ }
35
+ }
36
+ return ()=>{
37
+ const stack = getFocusTrapStack(globalThis);
38
+ const index = stack.indexOf(id);
39
+ if (index >= 0) {
40
+ stack.splice(index, 1);
41
+ }
42
+ };
43
+ // oxlint-disable-next-line react-hooks/exhaustive-deps
44
+ }, [
45
+ open
46
+ ]);
47
+ const isEnabled = useEventCallback(()=>{
48
+ const stack = getFocusTrapStack(globalThis);
49
+ return stack.at(-1) === id;
50
+ });
51
+ return {
52
+ isEnabled
53
+ };
54
+ };
55
+
56
+
57
+
58
+
59
+
60
+ /**
61
+ * Utility component that locks focus inside the component.
62
+ *
63
+ * @deprecated This component is deprecated. Use `useFocusTrapStack` hook directly with MUI's FocusTrap instead.
64
+ *
65
+ * @example
66
+ * ```tsx
67
+ * import { FocusTrap } from '@mui/base';
68
+ * import { useFocusTrapStack } from '@ringcentral/spring-ui';
69
+ *
70
+ * function MyModal({ open, children }) {
71
+ * // Call useFocusTrapStack where the `open` prop changes first (typically in Modal/Dialog)
72
+ * // This prevents race conditions between stack registration and autofocus behavior
73
+ * const { isEnabled } = useFocusTrapStack({ open });
74
+ *
75
+ * return open ? (
76
+ * <Portal>
77
+ * <div className="modal-backdrop">
78
+ * <FocusTrap
79
+ * open={open}
80
+ * isEnabled={isEnabled}
81
+ * >
82
+ * <div className="modal-content" tabIndex={-1}>
83
+ * {children}
84
+ * </div>
85
+ * </FocusTrap>
86
+ * </div>
87
+ * </Portal>
88
+ * ) : null;
89
+ * }
90
+ * ```
91
+ */ const FocusTrap_FocusTrap = (props)=>{
8
92
  const { open, children, action, ...rest } = props;
9
- const { isEnabled } = useFocusTrapStack({ open });
10
- useImperativeHandle(action, () => ({
11
- isEnabled,
12
- }), [isEnabled]);
13
- return (jsx(FocusTrap$1, { ...rest, open: open, isEnabled: isEnabled, children: children }));
93
+ const { isEnabled } = useFocusTrapStack({
94
+ open
95
+ });
96
+ useImperativeHandle(action, ()=>({
97
+ isEnabled
98
+ }), [
99
+ isEnabled
100
+ ]);
101
+ return /*#__PURE__*/ jsx(FocusTrap, {
102
+ ...rest,
103
+ open: open,
104
+ isEnabled: isEnabled,
105
+ children: children
106
+ });
14
107
  };
15
108
 
16
- export { FocusTrap, useFocusTrapStack };
109
+
110
+
111
+
112
+
113
+ export { FocusTrap_FocusTrap as FocusTrap, useFocusTrapStack };