@ringcentral/spring-ui 1.11.2 → 1.12.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 (86) hide show
  1. package/AccordionHeader.js +4 -2
  2. package/Animation.js +10 -9
  3. package/Autocomplete.js +5 -2
  4. package/BlockHeader.js +3 -1
  5. package/DatePicker.js +5 -3
  6. package/Dialer.js +36 -21
  7. package/Dialog.js +4 -3
  8. package/Dropdown.js +7 -4
  9. package/EmptyState.js +3 -1
  10. package/FormField.js +2 -0
  11. package/ListItemText.js +1 -0
  12. package/MenuHeader.js +1 -0
  13. package/MenuItem.js +2 -0
  14. package/MenuItemText.js +1 -0
  15. package/MenuList.js +2 -0
  16. package/Option.js +3 -1
  17. package/PickerTextField.js +2 -0
  18. package/Popper.js +28 -25
  19. package/Rating.js +2 -2
  20. package/Select.js +3 -0
  21. package/SingleFilter.js +2 -0
  22. package/Slider.js +3 -2
  23. package/SortableVirtualizedList.js +10 -10
  24. package/SplitButton.js +3 -0
  25. package/Squircle.js +2 -2
  26. package/StepContent.js +1 -1
  27. package/SubMenu.js +2 -0
  28. package/TableCell.js +1 -1
  29. package/TablePagination.js +2 -0
  30. package/Tabs.js +9 -5
  31. package/TextField.js +2 -0
  32. package/Textarea.js +2 -0
  33. package/TimePicker.js +3 -1
  34. package/TrayMenu.js +2 -0
  35. package/VirtualizedList.js +3 -2
  36. package/chunks/Alert.js +2 -2
  37. package/chunks/Badge.js +1 -1
  38. package/chunks/Drawer.js +3 -2
  39. package/chunks/MenuItemText.js +1 -0
  40. package/chunks/MenuList.js +2 -1
  41. package/chunks/Modal.js +2 -3
  42. package/chunks/Popover.js +13 -5
  43. package/chunks/Select.js +26 -21
  44. package/chunks/SlideIn.js +2 -1
  45. package/chunks/Squircle.js +2 -2
  46. package/chunks/VirtualizedMenu.js +3 -5
  47. package/chunks/composeEventHandlers.js +10 -0
  48. package/chunks/getSlideIn.js +2 -2
  49. package/chunks/useFocusTrapStack.js +3 -1
  50. package/chunks/useHelperTextId.js +4 -2
  51. package/chunks/useMenuItemSelect.js +34 -25
  52. package/index.css +205 -172
  53. package/index.js +3 -1
  54. package/internal/utils/index.d.ts +1 -0
  55. package/internal/utils/setRef.d.ts +1 -0
  56. package/package.json +8 -8
  57. package/src/Alert/Alert.type.d.ts +2 -1
  58. package/src/Animation/components/Fade/Fade.d.ts +4 -2
  59. package/src/Animation/components/Grow/Grow.d.ts +4 -2
  60. package/src/Animation/components/ShowHideEye/ShowHideEye.d.ts +1 -1
  61. package/src/Animation/components/SlideIn/SlideIn.d.ts +4 -2
  62. package/src/Animation/components/SlideIn/getSlideIn.d.ts +1 -1
  63. package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +1 -1
  64. package/src/Autocomplete/useAutocomplete.d.ts +18 -18
  65. package/src/Autocomplete/useAutocompleteTag.d.ts +18 -18
  66. package/src/Badge/Badge.d.ts +2 -1
  67. package/src/DatePicker/utils/DatePickerAriaLabelUtils.d.ts +2 -1
  68. package/src/Dialer/DialDelete/DialDelete.d.ts +2 -2
  69. package/src/Dialer/DialPad/DialPad.d.ts +2 -2
  70. package/src/Dialer/Dialer.d.ts +4 -2
  71. package/src/Dropdown/Dropdown.type.d.ts +2 -2
  72. package/src/InlineEditable/InlineEditable.type.d.ts +2 -1
  73. package/src/ListNavigation/useListNavigation.d.ts +3 -3
  74. package/src/MenuActions/MenuActions.d.ts +2 -2
  75. package/src/MenuItem/useMenuItem.d.ts +1 -1
  76. package/src/MenuItem/useVirtualizedMenuItem.d.ts +1 -1
  77. package/src/MenuList/MenuList.type.d.ts +1 -1
  78. package/src/NestedMenuContext/MenuOverlayGroupContext.d.ts +2 -2
  79. package/src/Popper/Popper.type.d.ts +10 -7
  80. package/src/Rating/utils.d.ts +3 -2
  81. package/src/Select/Select.type.d.ts +1 -1
  82. package/src/Slider/Slider.d.ts +2 -2
  83. package/src/Slider/SliderThumb.d.ts +2 -1
  84. package/src/Squircle/Squircle.d.ts +1 -1
  85. package/src/StatusIndicator/StatusIndicator.d.ts +2 -1
  86. package/src/SubMenu/PopperMenu.type.d.ts +4 -1
package/Select.js CHANGED
@@ -9,6 +9,8 @@ import './chunks/Icon.js';
9
9
  import './chunks/useMotionSafeTransition.js';
10
10
  import './chunks/usePrefersReducedMotion.js';
11
11
  import './chunks/getGrow.js';
12
+ import './chunks/hasContent.js';
13
+ import '@mui/utils';
12
14
  import './chunks/useHelperTextId.js';
13
15
  import 'clsx';
14
16
  import './chunks/Menu.js';
@@ -31,6 +33,7 @@ import 'react-virtuoso';
31
33
  import './chunks/List.js';
32
34
  import './chunks/useListNavigation.js';
33
35
  import 'tabbable';
36
+ import './chunks/composeEventHandlers.js';
34
37
  import './ListNavigation.js';
35
38
  import './chunks/MenuList.js';
36
39
  import './chunks/Squircle.js';
package/SingleFilter.js CHANGED
@@ -9,6 +9,7 @@ import './chunks/Icon.js';
9
9
  import { I as IconButton } from './chunks/IconButtonLabel.js';
10
10
  import { M as Menu } from './chunks/Menu.js';
11
11
  import { M as MenuItem } from './chunks/useMenuItemSelect.js';
12
+ import '@mui/utils';
12
13
  import 'tabbable';
13
14
  import './chunks/useListNavigation.js';
14
15
  import './VirtualizedList.js';
@@ -33,6 +34,7 @@ import './chunks/getGrow.js';
33
34
  import '@ringcentral/spring-icon';
34
35
  import './chunks/useAnimationFrame.js';
35
36
  import './chunks/useNestedMenuItem.js';
37
+ import './chunks/composeEventHandlers.js';
36
38
  import './ListNavigation.js';
37
39
  import 'react-virtuoso';
38
40
  import './chunks/List.js';
package/Slider.js CHANGED
@@ -82,12 +82,13 @@ const InnerSlider = (inProps, ref) => {
82
82
  });
83
83
  const cls = useClasses('slider', classes, className);
84
84
  const hasMarks = marks.length > 0;
85
+ const hasMarkLabels = marks.some((mark) => Boolean(mark.label));
85
86
  const isEmpty = values.every((value) => value === min);
86
87
  const transition = useMotionSafeTransition(dragging ? motionTransition['instant'] : motionTransition['haste-01-fast']);
87
88
  return (jsxs("span", { className: cls('root', color, orientation, {
88
89
  disabled,
89
90
  empty: isEmpty,
90
- 'has-marks': hasMarks,
91
+ 'has-marks': hasMarkLabels,
91
92
  'show-color-at-rest': showColorAtRest,
92
93
  }), "aria-disabled": disabled, ...rest, ...getRootProps({
93
94
  onMouseDown,
@@ -96,7 +97,7 @@ const InnerSlider = (inProps, ref) => {
96
97
  }), initial: false, animate: {
97
98
  ...axisProps[axis].offset(trackOffset),
98
99
  ...axisProps[axis].leap(trackLeap),
99
- }, transition: transition }), values.map((value, index) => (jsx(SliderThumb, { value: value, index: index, min: min, max: max, axis: axis, axisProps: axisProps, focusVisible: focusedThumbIndex === index, dragging: dragging, valueLabelDisplay: valueLabelDisplay, valueLabelFormat: valueLabelFormat, valueLabelTooltipProps: valueLabelTooltipProps, orientation: orientation, scale: scale, classes: classes, transition: transition, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, getThumbProps: getThumbProps, getAriaValueText: getAriaValueText, getHiddenInputProps: getHiddenInputProps }, `value-${index}`))), hasMarks && (jsx("span", { className: cls('marks', `marks-${orientation}`), children: marks.map((mark, index) => {
100
+ }, transition: transition }), values.map((value, index) => (jsx(SliderThumb, { value: value, index: index, min: min, max: max, axis: axis, axisProps: axisProps, focusVisible: focusedThumbIndex === index, dragging: dragging, valueLabelDisplay: valueLabelDisplay, valueLabelFormat: valueLabelFormat, valueLabelTooltipProps: valueLabelTooltipProps, orientation: orientation, scale: scale, classes: classes, transition: transition, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-valuetext": ariaValuetext, getThumbProps: getThumbProps, getAriaValueText: getAriaValueText, getHiddenInputProps: getHiddenInputProps }, `value-${index}`))), hasMarks && (jsx("span", { className: cls('marks', `marks-${orientation}`), children: marks.map((mark, index) => {
100
101
  return (jsxs("span", { "data-index": index, className: cls('mark-container', `mark-container-${orientation}`), style: axisProps[axis].offset(valueToPercent(mark.value, min, max)), children: [jsx("span", { className: cls('mark', `mark-${orientation}`) }), mark.label &&
101
102
  (typeof mark.label === 'string' ? (jsx("span", { className: cls('mark-label'), children: mark.label })) : (mark.label))] }, `${mark.value}`));
102
103
  }) }))] }));
@@ -19,16 +19,16 @@ const SortableVirtualizedList = forwardRef((inProps, ref) => {
19
19
  const { children, data, ...rest } = props;
20
20
  const { active } = useDndContext();
21
21
  const keepInvisibleItems = useMemo(() => {
22
- return active
23
- ? [
24
- data.findIndex((value) => {
25
- if (typeof value === 'object') {
26
- return value.id === active.id;
27
- }
28
- return value === active.id;
29
- }),
30
- ]
31
- : undefined;
22
+ if (!active) {
23
+ return undefined;
24
+ }
25
+ const activeIndex = data.findIndex((value) => {
26
+ if (typeof value === 'object') {
27
+ return value.id === active.id;
28
+ }
29
+ return value === active.id;
30
+ });
31
+ return activeIndex === -1 ? undefined : [activeIndex];
32
32
  }, [active, data]);
33
33
  return (jsx(SortableContext, { items: data, children: jsx(VirtualizedList, { ...rest, data: data, keepInvisibleItems: keepInvisibleItems, computeItemKey: (_, item) => typeof item === 'object' ? item.id : item, ref: ref, children: (index, data) => children(data, index) }) }));
34
34
  });
package/SplitButton.js CHANGED
@@ -33,12 +33,15 @@ import './chunks/getGrow.js';
33
33
  import './chunks/List.js';
34
34
  import './chunks/useListNavigation.js';
35
35
  import 'tabbable';
36
+ import '@mui/utils';
36
37
  import './VirtualizedList.js';
37
38
  import 'react-virtuoso';
38
39
  import './chunks/useAnimationFrame.js';
39
40
  import '@ringcentral/spring-icon';
40
41
  import './chunks/useNestedMenuItem.js';
42
+ import './chunks/composeEventHandlers.js';
41
43
  import './ListNavigation.js';
44
+ import './chunks/hasContent.js';
42
45
  import './chunks/useHelperTextId.js';
43
46
  import './chunks/VirtualizedMenu.js';
44
47
 
package/Squircle.js CHANGED
@@ -4,6 +4,6 @@ import 'react';
4
4
  import '@ringcentral/spring-base';
5
5
  import '@ringcentral/spring-theme';
6
6
 
7
- var squircle = {"sui-squircle-root":"sui-squircle-root","sui-squircle-interactive":"sui-squircle-interactive","sui-active":"sui-active","sui-squircle-content":"sui-squircle-content","sui-squircle-ring":"sui-squircle-ring"};
7
+ var Squircle = {"sui-squircle-root":"sui-squircle-root","sui-squircle-interactive":"sui-squircle-interactive","sui-active":"sui-active","sui-squircle-content":"sui-squircle-content","sui-squircle-ring":"sui-squircle-ring"};
8
8
 
9
- export { squircle as squircleStyle };
9
+ export { Squircle as squircleStyle };
package/StepContent.js CHANGED
@@ -19,7 +19,7 @@ const StepContent = forwardRef((inProps, ref) => {
19
19
  const transition = useMotionSafeTransition(motionTransition['haste-01-fast']);
20
20
  if (process.env.NODE_ENV !== 'production' && orientation !== 'vertical') {
21
21
  logInDev({
22
- scope: 'AvatarGroup',
22
+ scope: 'StepContent',
23
23
  level: 'error',
24
24
  message: '<StepContent /> is only designed for use with the vertical stepper.',
25
25
  });
package/SubMenu.js CHANGED
@@ -7,6 +7,7 @@ import { CaretRightMd } from '@ringcentral/spring-icon';
7
7
  import { useThemeProps } from '@ringcentral/spring-theme';
8
8
  import { I as Icon } from './chunks/Icon.js';
9
9
  import { S as SubMenuTriggerNestedIdContext, M as MenuItem } from './chunks/useMenuItemSelect.js';
10
+ import '@mui/utils';
10
11
  import 'tabbable';
11
12
  import './chunks/useListNavigation.js';
12
13
  import { b as useMenuOverlayGroupContext } from './chunks/Menu.js';
@@ -23,6 +24,7 @@ import './chunks/getFade.js';
23
24
  import './chunks/useFocusTrapStack.js';
24
25
  import './chunks/Backdrop.js';
25
26
  import './chunks/useAnimationFrame.js';
27
+ import './chunks/composeEventHandlers.js';
26
28
  import './ListNavigation.js';
27
29
  import './chunks/Popover.js';
28
30
  import './chunks/getGrow.js';
package/TableCell.js CHANGED
@@ -49,7 +49,7 @@ const TableCell = forwardRef((inProps, ref) => {
49
49
  if (sorted)
50
50
  ariaSort = sortDirection === 'asc' ? 'ascending' : 'descending';
51
51
  if (sortable) {
52
- sortIcon = (jsx(SortableArrow, { direction: sortIconDirection, size: "small", className: clsx(cls('sort-icon', sorted && 'sort-icon-sorted', showSortIndicator && 'sort-indicator'), SortIconProps?.className), ...SortIconProps }));
52
+ sortIcon = (jsx(SortableArrow, { direction: sortIconDirection, size: "small", ...SortIconProps, className: clsx(cls('sort-icon', sorted && 'sort-icon-sorted', showSortIndicator && 'sort-indicator'), SortIconProps?.className) }));
53
53
  }
54
54
  const ContentElement = sortable ? 'button' : 'div';
55
55
  const sortableProps = sortable
@@ -23,6 +23,8 @@ import './chunks/useFocusTrapStack.js';
23
23
  import './chunks/Backdrop.js';
24
24
  import './chunks/PopperPaper.js';
25
25
  import './chunks/hasContent.js';
26
+ import '@mui/utils';
27
+ import './chunks/composeEventHandlers.js';
26
28
  import './chunks/useMenuItemSelect.js';
27
29
  import './chunks/useAnimationFrame.js';
28
30
  import './chunks/useNestedParentMenu.js';
package/Tabs.js CHANGED
@@ -8,6 +8,7 @@ import { B as Badge } from './chunks/Badge.js';
8
8
  import { I as IconButton } from './chunks/IconButtonLabel.js';
9
9
  import { M as Menu } from './chunks/Menu.js';
10
10
  import { M as MenuItem } from './chunks/useMenuItemSelect.js';
11
+ import '@mui/utils';
11
12
  import 'tabbable';
12
13
  import './chunks/useListNavigation.js';
13
14
  import './VirtualizedList.js';
@@ -38,6 +39,7 @@ import './Popper.js';
38
39
  import './chunks/PopperPaper.js';
39
40
  import './chunks/useAnimationFrame.js';
40
41
  import './chunks/useNestedMenuItem.js';
42
+ import './chunks/composeEventHandlers.js';
41
43
  import './ListNavigation.js';
42
44
  import 'react-virtuoso';
43
45
  import './chunks/List.js';
@@ -190,9 +192,11 @@ function useComputedTabs(props) {
190
192
  }, [children, tabsInstanceId]);
191
193
  const [visibleTabs, setVisibleTabs] = useState(processedChildren);
192
194
  const visibleTabsChildren = useMemo(() => {
193
- return Array.from(visibleTabs.entries()).map(([childValue, { child }]) => {
194
- return { ...child, props: { ...child.props, value: childValue } };
195
- });
195
+ return Array.from(visibleTabs.entries()).map(([childValue, { child }]) => ({
196
+ ...child,
197
+ key: child.key ?? childValue,
198
+ props: { ...child.props, value: childValue },
199
+ }));
196
200
  }, [visibleTabs]);
197
201
  const prevChildren = usePrevious(() => children);
198
202
  const cacheTabsChildren = useEventCallback(() => {
@@ -572,7 +576,7 @@ var Tabs$1 = {"sui-tabs-root":"sui-tabs-root","sui-tabs-large":"sui-tabs-large",
572
576
  const DEFAULT_PILL_GAP = 4;
573
577
  const Tabs = forwardRef((inProps, ref) => {
574
578
  const props = useThemeProps({ props: inProps, name: 'Tabs' });
575
- const { classes, className, children, onBlur, onFocus, variant = 'standard', onGroupInfoUpdate, MoreMenuProps, pill, pillGap: pillGapProp = DEFAULT_PILL_GAP, color = 'default', size = 'medium', ScrollButtonStartProps, ScrollButtonEndProps, enableScrollButtons = true, ...rest } = props;
579
+ const { classes, className, children, variant = 'standard', onGroupInfoUpdate, MoreMenuProps, pill, pillGap: pillGapProp = DEFAULT_PILL_GAP, color = 'default', size = 'medium', ScrollButtonStartProps, ScrollButtonEndProps, enableScrollButtons = true, ...rest } = props;
576
580
  const pillGap = pill ? pillGapProp : 0;
577
581
  const tabsRef = useRef(null);
578
582
  const scrollerRef = useRef(null);
@@ -719,7 +723,7 @@ const Tabs = forwardRef((inProps, ref) => {
719
723
  'scroll-left': !!scrollButtonStart,
720
724
  'scroll-right': !!scrollButtonEnd,
721
725
  'scroll-both': !!(scrollButtonStart && scrollButtonEnd),
722
- }, size), ...rest, ...getRootProps(), children: [scrollButtonStart, jsx("div", { className: cls('scroller'), ref: scrollerRef, children: jsxs("div", { className: cls('tab-list'), ref: tabListRef, children: [visibleTabsChildren, showMore && (jsx(TabMoreMenu, { menuItems: moreMenuItems, ...MoreMenuProps, ref: tabMoreMenuRef })), jsx("div", { className: cls('underline') }), !pill && (jsx(motion.div, { style: {
726
+ }, size), ...getRootProps(rest), children: [scrollButtonStart, jsx("div", { className: cls('scroller'), ref: scrollerRef, children: jsxs("div", { className: cls('tab-list'), ref: tabListRef, children: [visibleTabsChildren, showMore && (jsx(TabMoreMenu, { menuItems: moreMenuItems, ...MoreMenuProps, ref: tabMoreMenuRef })), jsx("div", { className: cls('underline') }), !pill && (jsx(motion.div, { style: {
723
727
  left: floatingUnderlineLeftMotionValue,
724
728
  width: floatingUnderlineWidthMotionValue,
725
729
  opacity: floatingUnderlineOpacityMotionValue,
package/TextField.js CHANGED
@@ -12,6 +12,8 @@ import './chunks/useMotionSafeTransition.js';
12
12
  import './chunks/usePrefersReducedMotion.js';
13
13
  import './chunks/useHelperTextId.js';
14
14
  import 'clsx';
15
+ import './chunks/hasContent.js';
16
+ import '@mui/utils';
15
17
  import './chunks/IconButtonLabel.js';
16
18
  import './chunks/Squircle.js';
17
19
  import './chunks/withTooltip.js';
package/Textarea.js CHANGED
@@ -12,6 +12,8 @@ import './chunks/useMotionSafeTransition.js';
12
12
  import './chunks/usePrefersReducedMotion.js';
13
13
  import './chunks/useHelperTextId.js';
14
14
  import 'clsx';
15
+ import './chunks/hasContent.js';
16
+ import '@mui/utils';
15
17
  import './chunks/IconButtonLabel.js';
16
18
  import './chunks/Squircle.js';
17
19
  import './chunks/withTooltip.js';
package/TimePicker.js CHANGED
@@ -23,6 +23,8 @@ import './chunks/PopperPaper.js';
23
23
  import './chunks/Popover.js';
24
24
  import './chunks/getGrow.js';
25
25
  import './chunks/useHelperTextId.js';
26
+ import './chunks/hasContent.js';
27
+ import '@mui/utils';
26
28
  import './chunks/TextField.js';
27
29
  import './chunks/ShowHideEye.js';
28
30
  import './chunks/useMotionSafeTransition.js';
@@ -40,7 +42,7 @@ const TimeButton = forwardRef((props, ref) => {
40
42
  selected,
41
43
  disabled,
42
44
  focusVisible,
43
- })), ...rest, ...combineProps({ onBlur, onFocus }, focusVisibleHandlers), children: children }));
45
+ })), ...rest, ...combineProps({ onBlur, onFocus }, focusVisibleHandlers), type: "button", children: children }));
44
46
  });
45
47
  TimeButton.displayName = 'SuiTimeButton';
46
48
 
package/TrayMenu.js CHANGED
@@ -5,6 +5,7 @@ import { M as Menu } from './chunks/Menu.js';
5
5
  import { T as Tray, d as useTrayNavigate } from './chunks/useTrayNavigate.js';
6
6
  import '@ringcentral/spring-base';
7
7
  import { M as MenuItem } from './chunks/useMenuItemSelect.js';
8
+ import '@mui/utils';
8
9
  import 'tabbable';
9
10
  import './chunks/useListNavigation.js';
10
11
  import './VirtualizedList.js';
@@ -26,6 +27,7 @@ import './chunks/useMotionSafeTransition.js';
26
27
  import '@ringcentral/spring-icon';
27
28
  import './chunks/useAnimationFrame.js';
28
29
  import './chunks/useNestedMenuItem.js';
30
+ import './chunks/composeEventHandlers.js';
29
31
  import './ListNavigation.js';
30
32
  import 'react-virtuoso';
31
33
  import './chunks/List.js';
@@ -11,6 +11,7 @@ import 'tabbable';
11
11
  const VirtualizedItemPropsContext = createContext(null);
12
12
  const useVirtualizedItemPropsContext = () => useContext(VirtualizedItemPropsContext);
13
13
 
14
+ const DATA_ITEM_INDEX_ATTR = 'data-item-index';
14
15
  const VirtuosoList = forwardRef((props, ref) => {
15
16
  const { children: childrenProp, context, style, ...rest } = props;
16
17
  const { searchAndFocusItemHandler, isScrolling, ListProps, listActions, listRef, itemContentRenderer, data, keepInvisibleItems, computeItemKey, } = context;
@@ -21,12 +22,12 @@ const VirtuosoList = forwardRef((props, ref) => {
21
22
  if (keepInvisibleItems && computeItemKey && Array.isArray(childrenProp)) {
22
23
  const firstChild = childrenProp[0];
23
24
  if (firstChild && isValidElement(firstChild)) {
24
- const index = Number(firstChild.props?.['data-item-index']);
25
+ const index = Number(firstChild.props[DATA_ITEM_INDEX_ATTR]);
25
26
  rangeStart = Number.isNaN(index) ? null : index;
26
27
  }
27
28
  const lastChild = childrenProp.at(-1);
28
29
  if (lastChild && isValidElement(lastChild)) {
29
- const index = Number(lastChild.props?.['data-item-index']);
30
+ const index = Number(lastChild.props[DATA_ITEM_INDEX_ATTR]);
30
31
  rangeEnd = Number.isNaN(index) ? null : index;
31
32
  }
32
33
  children = [
package/chunks/Alert.js CHANGED
@@ -15,7 +15,7 @@ const DEFAULT_ICON_MAP = {
15
15
  };
16
16
  const Alert = forwardRef((inProps, ref) => {
17
17
  const props = useThemeProps({ props: inProps, name: 'Alert' });
18
- const { action, classes, className, component: AlertRoot = 'div', closeText = 'close', children, icon: iconProp, startSlot, onClose, severity = 'info', CloseButtonProps, ...rest } = props;
18
+ const { action, classes, className, component: AlertRoot = 'div', closeText = 'close', children, icon: iconProp, startSlot, onClose, severity = 'info', CloseButtonProps, contentProps, ...rest } = props;
19
19
  const cls = useClassesWithMode('alert', classes, className);
20
20
  const { mode } = useMode();
21
21
  const iconSize = useMemo(() => (mode === 'compact' ? 'small' : 'medium'), [mode]);
@@ -38,7 +38,7 @@ const Alert = forwardRef((inProps, ref) => {
38
38
  if (action) {
39
39
  actionSlot = jsx("div", { className: cls('action'), children: action });
40
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
+ 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", ...contentProps, children: children }), actionSlot] }), closeSlot] }));
42
42
  });
43
43
  const AlertTitle = ({ className, classes, ...rest }) => {
44
44
  const cls = useClassesWithMode('alert-title', classes, className);
package/chunks/Badge.js CHANGED
@@ -20,7 +20,7 @@ const Badge = (inProps) => {
20
20
  : count
21
21
  : undefined;
22
22
  const toOrigin = useMemo(() => kebabCase(anchorOrigin), [anchorOrigin]);
23
- const overlapMode = children || forceOverlap;
23
+ const overlapMode = Boolean(children || forceOverlap);
24
24
  return (jsxs("span", { className: cls('root', {
25
25
  absolute: !children && forceOverlap,
26
26
  }), ...rest, children: [children, jsx(AnimatePresence, { initial: false, children: invisible ||
package/chunks/Drawer.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { forwardRef } from 'react';
3
3
  import { motion } from 'framer-motion';
4
- import { useClasses } from '@ringcentral/spring-base';
4
+ import { useClasses, useForkRef } from '@ringcentral/spring-base';
5
5
  import { useThemeProps, motionTransition } from '@ringcentral/spring-theme';
6
6
  import clsx from 'clsx';
7
7
  import './Icon.js';
@@ -23,9 +23,10 @@ const Drawer = forwardRef((inProps, ref) => {
23
23
  toggleOnTransition: motionTransition['neutral-01-fast'],
24
24
  toggleOffTransition: motionTransition['neutral-01-fast'],
25
25
  });
26
+ const handleBodyRef = useForkRef(ref, bodyProps?.ref);
26
27
  return (jsx(Modal, { open: open, onClose: onClose, blocking: blocking, className: clsx(cls('root', `anchor-${anchor}`, {
27
28
  'non-blocking': !blocking,
28
- })), ...rest, children: jsxs(motion.div, { role: "dialog", "aria-modal": blocking, ...slideInProps, ...bodyProps, ref: ref, className: clsx(cls('body', `body-${anchor}`), bodyProps?.className), tabIndex: blocking ? -1 : undefined, children: [header && (jsx("div", { ref: headerRef, ...headerProps, className: clsx(cls('header'), headerProps?.className), children: header })), jsx("div", { ref: contentRef, className: cls('content'), children: children }), footer && (jsx("div", { ref: footerRef, className: cls('footer'), children: footer }))] }) }));
29
+ })), ...rest, children: jsxs(motion.div, { role: "dialog", "aria-modal": blocking, ...slideInProps, ...bodyProps, ref: handleBodyRef, className: clsx(cls('body', `body-${anchor}`), bodyProps?.className), tabIndex: bodyProps?.tabIndex ?? (blocking ? -1 : undefined), children: [header && (jsx("div", { ref: headerRef, ...headerProps, className: clsx(cls('header'), headerProps?.className), children: header })), jsx("div", { ref: contentRef, className: cls('content'), children: children }), footer && (jsx("div", { ref: footerRef, className: cls('footer'), children: footer }))] }) }));
29
30
  });
30
31
  Drawer.displayName = 'SuiDrawer';
31
32
 
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
3
3
  import { getTitle } from '@ringcentral/spring-base';
4
4
  import { useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
5
5
  import { h as hasContent } from './hasContent.js';
6
+ import '@mui/utils';
6
7
 
7
8
  const MenuItemText = forwardRef((inProps, ref) => {
8
9
  const props = useThemeProps({ props: inProps, name: 'MenuItemText' });
@@ -5,6 +5,7 @@ import { useThemeProps } from '@ringcentral/spring-theme';
5
5
  import { L as List } from './List.js';
6
6
  import { u as useMenuContext } from './Menu.js';
7
7
  import { c as useMenuItemSelect, e as MenuListContext, a as MenuItemSelectContext } from './useMenuItemSelect.js';
8
+ import '@mui/utils';
8
9
  import 'tabbable';
9
10
  import './useListNavigation.js';
10
11
  import '../VirtualizedList.js';
@@ -13,7 +14,7 @@ const MenuList = forwardRef((inProps, ref) => {
13
14
  const props = useThemeProps({ props: inProps, name: 'MenuList' });
14
15
  const { classes, className, children, widget, selectMode = 'single', nowrap, value: valueProp, onChange, autoFocus: autoFocusProp, ...rest } = props;
15
16
  const menuContext = useMenuContext();
16
- const autoFocus = Boolean(autoFocusProp || menuContext?.autoFocus);
17
+ const autoFocus = Boolean(autoFocusProp ?? menuContext?.autoFocus);
17
18
  const cls = useClasses('menu-list', classes, className);
18
19
  const menuListContextValue = useMemo(() => ({
19
20
  nowrap,
package/chunks/Modal.js CHANGED
@@ -130,10 +130,9 @@ const InnerModal = forwardRef((props, ref) => {
130
130
  const overlayBranchRegistry = ariaHideEnabled
131
131
  ? ownOverlayBranchRegistry
132
132
  : parentOverlayBranchRegistry;
133
- const isOverlayBranch = !blocking && open && parentOverlayBranchRegistry != null;
134
133
  const ariaHideEnabledForChildren = ariaHideEnabled || parentModalContext?.ariaHideEnabled === true;
135
134
  const overlayBranchRef = useOverlayBranch({
136
- active: isOverlayBranch,
135
+ active: !blocking && open,
137
136
  registry: parentOverlayBranchRegistry,
138
137
  });
139
138
  const handleRef = useForkRef(ref, ariaHideOutsideRef, overlayBranchRef);
@@ -209,4 +208,4 @@ const Modal = forwardRef((inProps, ref) => {
209
208
  });
210
209
  Modal.displayName = 'SuiModal';
211
210
 
212
- export { InnerModal as I, Modal as M, ModalContext as a, useModalContext as u };
211
+ export { InnerModal as I, Modal as M, ModalContext as a, useOverlayBranch as b, useModalContext as u };
package/chunks/Popover.js CHANGED
@@ -19,15 +19,23 @@ const Popover = forwardRef((inProps, ref) => {
19
19
  const handlePaperContentRef = useForkRef(popperPaperPropsProp?.contentRef, paperContentRef);
20
20
  const prefersReducedMotion = usePrefersReducedMotion();
21
21
  return (jsx(Modal, { ...rest, className: cls('root', 'popper'), ref: ref, motionProps: null, hideBackdrop: true, children: jsx(Popper, { arrowHeight: variant === 'standard' ? 0 : 10, arrowPadding: 12, offset: variant === 'standard' ? 2 : 4, ...combineProps({
22
+ tether: false,
22
23
  middlewares: [
23
24
  size({
24
25
  padding: PopperProps?.padding,
25
- apply({ availableHeight, availableWidth, }) {
26
+ apply({ availableHeight, availableWidth, elements, }) {
26
27
  onAvailableHeightChange?.(availableHeight);
27
- if (paperContentRef.current) {
28
- paperContentRef.current.style.maxHeight = `${availableHeight}px`;
29
- paperContentRef.current.style.maxWidth = `${availableWidth}px`;
28
+ const content = paperContentRef.current;
29
+ if (!content) {
30
+ return;
30
31
  }
32
+ const decorationHeight = elements.floating.offsetHeight - content.offsetHeight;
33
+ const decorationWidth = elements.floating.offsetWidth - content.offsetWidth;
34
+ const maxHeight = Math.max(0, availableHeight - decorationHeight);
35
+ content.style.maxWidth = `${Math.max(0, availableWidth - decorationWidth)}px`;
36
+ content.style.maxHeight = '';
37
+ content.style.maxHeight =
38
+ maxHeight < content.scrollHeight ? `${maxHeight}px` : '';
31
39
  },
32
40
  }),
33
41
  ],
@@ -45,7 +53,7 @@ const Popover = forwardRef((inProps, ref) => {
45
53
  }),
46
54
  };
47
55
  }
48
- return (jsx(PopperPaper, { contentRef: handlePaperContentRef, arrowRef: arrowRef, arrowStyle: arrowStyle, ...combineProps(combineProps(motionProps, popperPaperProps), popperPaperPropsProp), children: children }));
56
+ return (jsx(PopperPaper, { arrowRef: arrowRef, arrowStyle: arrowStyle, ...combineProps(combineProps(motionProps, popperPaperProps), popperPaperPropsProp), contentRef: handlePaperContentRef, children: children }));
49
57
  } }) }));
50
58
  });
51
59
  Popover.displayName = 'SuiPopover';
package/chunks/Select.js CHANGED
@@ -7,6 +7,8 @@ import 'framer-motion';
7
7
  import { u as usePrefersReducedMotion } from './usePrefersReducedMotion.js';
8
8
  import { g as getGrow } from './getGrow.js';
9
9
  import './Icon.js';
10
+ import { h as hasContent } from './hasContent.js';
11
+ import '@mui/utils';
10
12
  import { u as useHelperTextId, F as FormField } from './useHelperTextId.js';
11
13
  import { M as Menu, a as MenuContext } from './Menu.js';
12
14
  import { c as useMenuItemSelect, a as MenuItemSelectContext } from './useMenuItemSelect.js';
@@ -148,37 +150,40 @@ const Select = forwardRef((inProps, ref) => {
148
150
  close: handleClose,
149
151
  autoFocus: true,
150
152
  }), [handleClose]);
151
- const selectorProps = getButtonProps(selectorPropsProp);
153
+ const selectorProps = getButtonProps(combineProps({
154
+ onMouseDown: (event) => {
155
+ if (disabled || event.button !== 0)
156
+ return;
157
+ event.preventDefault();
158
+ event.currentTarget.focus();
159
+ },
160
+ }, selectorPropsProp));
152
161
  const selectedValue = value !== null || displayEmpty ? renderValue(value) : null;
153
162
  const valueId = `${id}-value`;
154
163
  const labelId = `${id}-label`;
155
164
  let menu = null;
165
+ const baseMenuClasses = { paper: cls('menu') };
166
+ const basePopperProps = { offset: 4, matchAnchorWidth: true };
167
+ const popperProps = combineProps(basePopperProps, !virtualize
168
+ ? MenuProps?.PopperProps
169
+ : virtualizedMenuPropsProp?.PopperProps);
170
+ const menuClasses = popperProps.matchAnchorWidth
171
+ ? combineClasses(baseMenuClasses, { paper: 'min-w-0' })
172
+ : baseMenuClasses;
173
+ const onExitComplete = () => {
174
+ setDidMenuExit(true);
175
+ };
156
176
  const baseMenuProps = {
157
- onExitComplete: () => {
158
- setDidMenuExit(true);
159
- },
177
+ onExitComplete,
160
178
  placement: DEFAULT_PLACEMENT,
161
179
  open,
162
180
  anchorEl,
163
- PopperProps: {
164
- offset: 4,
165
- matchAnchorWidth: true,
166
- },
167
- classes: {
168
- paper: cls('menu'),
169
- },
181
+ PopperProps: basePopperProps,
182
+ classes: menuClasses,
170
183
  onClose: handleClose,
171
184
  };
172
- const popperProps = combineProps(baseMenuProps.PopperProps, !virtualize
173
- ? MenuProps?.PopperProps
174
- : virtualizedMenuPropsProp?.PopperProps);
175
- if (popperProps.matchAnchorWidth) {
176
- baseMenuProps.classes = combineClasses(baseMenuProps.classes, {
177
- paper: 'min-w-0',
178
- });
179
- }
180
185
  if (!virtualize) {
181
- menu = (jsx(Menu, { ...baseMenuProps, ...MenuProps, PopperProps: popperProps, classes: combineClasses(baseMenuProps.classes, MenuProps?.classes), motionProps: getYAxisGrowMotion({
186
+ menu = (jsx(Menu, { ...baseMenuProps, ...MenuProps, PopperProps: popperProps, classes: combineClasses(menuClasses, MenuProps?.classes), motionProps: getYAxisGrowMotion({
182
187
  placement: MenuProps?.placement,
183
188
  prefersReducedMotion: prefersReducedMotion,
184
189
  }), children: jsx(MenuList, { value: value, onChange: handleMenuListChange, nowrap: false, widget: "select", selectMode: selectMode, ...getListboxProps(), children: children }) }));
@@ -198,7 +203,7 @@ const Select = forwardRef((inProps, ref) => {
198
203
  content: cls('content'),
199
204
  }, size: size, ...rest, children: [jsxs("button", { className: cls('selector', `${variant}-selector`, `${variant}-selector-${size}`, {
200
205
  expanded: open,
201
- }), type: 'button', disabled: disabled, "aria-labelledby": label ? `${labelId} ${valueId}` : valueId, "aria-describedby": helperTextId, ...selectorProps, id: id, children: [selectedValue ? (jsx("span", { id: valueId, "aria-live": "polite", className: cls('value'), title: getTitle(selectedValue), children: selectedValue })) : (jsx("span", { id: valueId, className: cls('placeholder'), title: getTitle(placeholder), children: placeholder })), jsx(Squircle, { className: cls('chevron'), interactive: false, children: jsx(ExpandCollapseCaret, { size: 'small', expanded: open }) })] }), jsx("input", { ref: inputRef, name: name, value: `${value}`, disabled: disabled, className: cls('native-input'), tabIndex: -1, "aria-hidden": true, "aria-invalid": error, onChange: handleInputChange, ...inputProps })] }), anchorEl && menu] }));
206
+ }), disabled: disabled, "aria-labelledby": label ? `${labelId} ${valueId}` : valueId, "aria-describedby": helperTextId, ...selectorProps, id: id, type: "button", children: [hasContent(selectedValue) ? (jsx("span", { id: valueId, "aria-live": "polite", className: cls('value'), title: getTitle(selectedValue), children: selectedValue })) : (jsx("span", { id: valueId, className: cls('placeholder'), title: getTitle(placeholder), children: placeholder })), jsx(Squircle, { className: cls('chevron'), interactive: false, children: jsx(ExpandCollapseCaret, { size: 'small', expanded: open }) })] }), jsx("input", { ref: inputRef, name: name, value: `${value}`, disabled: disabled, className: cls('native-input'), tabIndex: -1, "aria-hidden": true, "aria-invalid": error, onChange: handleInputChange, ...inputProps })] }), anchorEl && menu] }));
202
207
  });
203
208
  Select.displayName = 'SuiSelect';
204
209
  function getYAxisGrowMotion(params) {
package/chunks/SlideIn.js CHANGED
@@ -5,7 +5,7 @@ import '@ringcentral/spring-theme';
5
5
  import { g as getSlideIn } from './getSlideIn.js';
6
6
 
7
7
  const SlideIn = (props) => {
8
- const { toggle, toggleOnTransition, toggleOffTransition, children, from = 'right', ...rest } = props;
8
+ const { toggle, toggleOnTransition, toggleOffTransition, transition, children, from = 'right', ...rest } = props;
9
9
  const prefersReducedMotion = usePrefersReducedMotion();
10
10
  return (jsx(motion.div, { ...getSlideIn({
11
11
  toggle,
@@ -13,6 +13,7 @@ const SlideIn = (props) => {
13
13
  prefersReducedMotion,
14
14
  toggleOnTransition,
15
15
  toggleOffTransition,
16
+ transition,
16
17
  }), ...rest, children: children }));
17
18
  };
18
19
 
@@ -16,11 +16,11 @@ const Squircle = forwardRef((inProps, ref) => {
16
16
  const clipId = useId('sui-squircle-clip', true);
17
17
  const showFocusRing = interactive && focusVisible;
18
18
  const Root = component;
19
- return (jsxs(Root, { className: cls('root', { active, interactive }), ...rest, ref: ref, children: [jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "0", height: "0", viewBox: "0 0 1 1", children: jsx("defs", { children: jsx("clipPath", { id: clipId, clipPathUnits: "objectBoundingBox", children: jsx("path", { d: SQUIRCLE_PATH }) }) }) }), !fillShape && (jsx("svg", { className: cls('content'), xmlns: "http://www.w3.org/2000/svg", viewBox: '0 0 1 1', children: jsx("path", { clipPath: `url(#${clipId})`, d: SQUIRCLE_PATH, vectorEffect: "non-scaling-stroke" }) })), showFocusRing && (jsx("svg", { className: cls('ring'), xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1 1", overflow: "visible", children: jsx("path", { d: SQUIRCLE_PATH, fillOpacity: 0, vectorEffect: "non-scaling-stroke" }) })), fillShape
19
+ return (jsxs(Root, { className: cls('root', { active, interactive }), ...rest, ref: ref, children: [jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "0", height: "0", viewBox: "0 0 1 1", style: { position: 'absolute' }, "aria-hidden": true, children: jsx("defs", { children: jsx("clipPath", { id: clipId, clipPathUnits: "objectBoundingBox", children: jsx("path", { d: SQUIRCLE_PATH }) }) }) }), !fillShape && (jsx("svg", { className: cls('content'), xmlns: "http://www.w3.org/2000/svg", viewBox: '0 0 1 1', children: jsx("path", { clipPath: `url(#${clipId})`, d: SQUIRCLE_PATH, vectorEffect: "non-scaling-stroke" }) })), showFocusRing && (jsx("svg", { className: cls('ring'), xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1 1", overflow: "visible", children: jsx("path", { d: SQUIRCLE_PATH, fillOpacity: 0, vectorEffect: "non-scaling-stroke" }) })), fillShape
20
20
  ? cloneElement(firstChild, {
21
21
  style: {
22
22
  ...firstChild.props.style,
23
- with: '100%',
23
+ width: '100%',
24
24
  height: '100%',
25
25
  clipPath: `url(#${clipId})`,
26
26
  },
@@ -38,7 +38,7 @@ const VirtualizedMenuList = (props) => {
38
38
  const MENU_VERTICAL_PADDING = 8;
39
39
  const VirtualizedMenu = forwardRef((inProps, ref) => {
40
40
  const props = useThemeProps({ props: inProps, name: 'VirtualizedMenu' });
41
- const { classes, className, children, open, onClose, data, totalCount, isItemDisabled, VirtualizedListProps, popperActions: popperActionsProp, initialFocus = true, maxHeight, PopperProps, ...rest } = props;
41
+ const { classes, className, children, open, onClose, data, totalCount, isItemDisabled, actions, VirtualizedListProps, popperActions: popperActionsProp, initialFocus = true, maxHeight, PopperProps, ...rest } = props;
42
42
  const popperPaperContentRef = useRef(null);
43
43
  const paperContentContainerRef = useRef(null);
44
44
  const hasItemsRenderedRef = useRef(false);
@@ -74,9 +74,6 @@ const VirtualizedMenu = forwardRef((inProps, ref) => {
74
74
  setMenuHeight(computedMenuHeight);
75
75
  });
76
76
  const updatePopoverHeight = useEventCallback(() => {
77
- if (!popperPaperContentRef.current)
78
- return;
79
- popperPaperContentRef.current.style.maxHeight = `${availableHeight.current}px`;
80
77
  if (paperContentContainerRef.current) {
81
78
  paperContentContainerRef.current.style.height = `auto`;
82
79
  }
@@ -133,7 +130,8 @@ const VirtualizedMenu = forwardRef((inProps, ref) => {
133
130
  }, [open]);
134
131
  return (jsx(Popover, { bordered: true, PopperProps: { ...PopperProps, padding: popperPadding }, ...rest, open: open, className: clsx(cls('root'), waitForHeightCompute && 'opacity-0'), PopperPaperProps: {
135
132
  contentRef: popperPaperContentRef,
136
- }, onClose: onClose, onAvailableHeightChange: handleAvailableHeightChange, ref: ref, motionProps: { variants: undefined }, actions: handlePopperActions, children: jsx("div", { className: cls('paper'), children: jsx("div", { ref: paperContentContainerRef, className: cls('paper-content-container'), children: jsx(VirtualizedMenuContext.Provider, { value: menuContextValue, children: jsx(VirtualizedMenuList, { data: data, totalCount: totalCount, isReady: !deferPendingVirtualizedListActions, isItemDisabled: isItemDisabled, initialFocus: initialFocus, style: { height: menuHeight }, ...combineProps(VirtualizedListProps, {
133
+ }, onClose: onClose, onAvailableHeightChange: handleAvailableHeightChange, ref: ref, motionProps: { variants: undefined }, actions: handlePopperActions, children: jsx("div", { className: cls('paper'), children: jsx("div", { ref: paperContentContainerRef, className: cls('paper-content-container'), children: jsx(VirtualizedMenuContext.Provider, { value: menuContextValue, children: jsx(VirtualizedMenuList, { data: data, totalCount: totalCount, isReady: !deferPendingVirtualizedListActions, isItemDisabled: isItemDisabled, initialFocus: initialFocus, actions: actions, ...combineProps(VirtualizedListProps, {
134
+ style: { height: menuHeight },
137
135
  ListProps: combineProps(VirtualizedListProps?.ListProps, {
138
136
  className: cls('list'),
139
137
  style: {
@@ -0,0 +1,10 @@
1
+ const composeEventHandlers = (externalEventHandler, internalEventHandler, options = {}) => (event, ...args) => {
2
+ const { checkForDefaultPrevented = true } = options;
3
+ externalEventHandler?.(event, ...args);
4
+ if (checkForDefaultPrevented && event.defaultPrevented) {
5
+ return;
6
+ }
7
+ internalEventHandler?.(event, ...args);
8
+ };
9
+
10
+ export { composeEventHandlers as c };
@@ -2,7 +2,7 @@ import { motionTransition } from '@ringcentral/spring-theme';
2
2
 
3
3
  const horizontal = ['right', 'left'];
4
4
  const plus = ['right', 'bottom'];
5
- const getSlideIn = ({ toggle = true, from = 'right', prefersReducedMotion = false, toggleOnTransition, toggleOffTransition, } = {}) => {
5
+ const getSlideIn = ({ toggle = true, from = 'right', prefersReducedMotion = false, toggleOnTransition, toggleOffTransition, transition, } = {}) => {
6
6
  const axis = horizontal.includes(from) ? 'x' : 'y';
7
7
  const invisibleValue = plus.includes(from) ? '100%' : '-100%';
8
8
  return {
@@ -23,7 +23,7 @@ const getSlideIn = ({ toggle = true, from = 'right', prefersReducedMotion = fals
23
23
  },
24
24
  transition: prefersReducedMotion
25
25
  ? motionTransition.instant
26
- : motionTransition['spring-01-fast'],
26
+ : (transition ?? motionTransition['spring-01-fast']),
27
27
  };
28
28
  };
29
29
 
@@ -14,7 +14,9 @@ const useFocusTrapStack = ({ open, }) => {
14
14
  useEffect(() => {
15
15
  if (open) {
16
16
  const stack = getFocusTrapStack(globalThis);
17
- stack.push(id);
17
+ if (stack.indexOf(id) < 0) {
18
+ stack.push(id);
19
+ }
18
20
  }
19
21
  return () => {
20
22
  const stack = getFocusTrapStack(globalThis);