@ringcentral/spring-ui 1.11.1 → 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.
- package/AccordionHeader.js +4 -2
- package/Animation.js +10 -9
- package/Autocomplete.js +7 -2
- package/BlockHeader.js +3 -1
- package/DatePicker.js +5 -3
- package/Dialer.js +36 -21
- package/Dialog.js +4 -3
- package/Dropdown.js +8 -4
- package/EmptyState.js +3 -1
- package/FormField.js +2 -0
- package/ListItem.js +1 -0
- package/ListItemText.js +9 -3
- package/MenuHeader.js +5 -1
- package/MenuItem.js +3 -0
- package/MenuItemText.js +2 -0
- package/MenuList.js +3 -0
- package/Option.js +4 -1
- package/PickerTextField.js +2 -0
- package/Popper.js +28 -25
- package/Rating.js +2 -2
- package/Select.js +4 -0
- package/SingleFilter.js +4 -0
- package/Slider.js +3 -2
- package/SortableListItem.js +1 -0
- package/SortableVirtualizedList.js +11 -10
- package/SplitButton.js +4 -0
- package/Squircle.js +2 -2
- package/StepContent.js +1 -1
- package/SubMenu.js +4 -0
- package/SwipeableDrawer.js +16 -18
- package/TableCell.js +1 -1
- package/TablePagination.js +4 -0
- package/Tabs.js +11 -5
- package/TextField.js +2 -0
- package/Textarea.js +2 -0
- package/TimePicker.js +3 -1
- package/TrayMenu.js +3 -0
- package/VirtualizedList.js +7 -5
- package/VirtualizedMenu.js +1 -0
- package/chunks/Alert.js +2 -2
- package/chunks/Badge.js +1 -1
- package/chunks/Drawer.js +3 -2
- package/chunks/MenuItemText.js +3 -1
- package/chunks/MenuList.js +2 -1
- package/chunks/Modal.js +132 -9
- package/chunks/Popover.js +13 -5
- package/chunks/Select.js +26 -21
- package/chunks/SlideIn.js +2 -1
- package/chunks/Squircle.js +2 -2
- package/chunks/VirtualizedMenu.js +5 -5
- package/chunks/composeEventHandlers.js +10 -0
- package/chunks/getSlideIn.js +2 -2
- package/chunks/hasContent.js +3 -0
- package/chunks/useAnimationFrame.js +15 -0
- package/chunks/useFocusTrapStack.js +3 -1
- package/chunks/useHelperTextId.js +4 -2
- package/chunks/useMenuItemSelect.js +37 -26
- package/index.css +205 -172
- package/index.js +4 -0
- package/internal/hooks/index.d.ts +1 -0
- package/internal/hooks/useAnimationFrame.d.ts +4 -0
- package/internal/utils/hasContent.d.ts +2 -0
- package/internal/utils/index.d.ts +3 -0
- package/internal/utils/setRef.d.ts +1 -0
- package/package.json +8 -8
- package/src/Accordion/Accordion.d.ts +1 -1
- package/src/AccordionHeader/AccordionHeader.d.ts +1 -1
- package/src/Alert/Alert.type.d.ts +2 -1
- package/src/Animation/components/Fade/Fade.d.ts +4 -2
- package/src/Animation/components/Grow/Grow.d.ts +4 -2
- package/src/Animation/components/ShowHideEye/ShowHideEye.d.ts +1 -1
- package/src/Animation/components/SlideIn/SlideIn.d.ts +4 -2
- package/src/Animation/components/SlideIn/getSlideIn.d.ts +1 -1
- package/src/Announcement/Announcement.d.ts +1 -1
- package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +1 -1
- package/src/Autocomplete/SuggestionList/SuggestionListItem.d.ts +1 -1
- package/src/Autocomplete/SuggestionList/utils/useSuggestionList.d.ts +1 -1
- package/src/Autocomplete/useAutocomplete.d.ts +74 -50
- package/src/Autocomplete/useAutocompleteTag.d.ts +68 -44
- package/src/Backdrop/Backdrop.d.ts +1 -1
- package/src/Badge/Badge.d.ts +2 -2
- package/src/BottomNavigation/BottomNavigationGroup/BottomNavigationGroup.d.ts +1 -1
- package/src/CircularProgressIndicator/CircularProgressIndicator.d.ts +1 -1
- package/src/DatePicker/DatePicker.d.ts +1 -1
- package/src/DatePicker/Day.d.ts +1 -1
- package/src/DatePicker/Year.d.ts +1 -1
- package/src/DatePicker/utils/DatePickerAriaLabelUtils.d.ts +2 -1
- package/src/Dialer/DialDelete/DialDelete.d.ts +2 -2
- package/src/Dialer/DialPad/DialPad.d.ts +2 -2
- package/src/Dialer/DialTextField/DialTextField.d.ts +1 -1
- package/src/Dialer/Dialer.d.ts +4 -2
- package/src/Dialog/Dialog.d.ts +4 -4
- package/src/Drawer/Drawer.d.ts +1 -1
- package/src/Dropdown/Dropdown.type.d.ts +2 -2
- package/src/EmptyState/EmptyState.d.ts +1 -1
- package/src/FormField/FormField.d.ts +1 -1
- package/src/FormLabel/FormLabel.d.ts +1 -1
- package/src/Icon/Icon.d.ts +1 -1
- package/src/IconButton/IconButtonLabel.d.ts +1 -1
- package/src/InlineEditable/InlineEditable.type.d.ts +2 -1
- package/src/LinearProgressIndicator/LinearProgressIndicator.d.ts +1 -1
- package/src/List/List.d.ts +1 -1
- package/src/ListItem/ListItem.d.ts +1 -1
- package/src/ListItemText/ListItemText.d.ts +1 -1
- package/src/ListNavigation/useListNavigation.d.ts +3 -3
- package/src/Menu/Menu.d.ts +1 -1
- package/src/MenuActions/MenuActions.d.ts +3 -3
- package/src/MenuDivider/MenuDivider.d.ts +1 -1
- package/src/MenuFooter/MenuFooter.d.ts +1 -1
- package/src/MenuHeader/MenuHeader.d.ts +1 -1
- package/src/MenuItem/MenuItem.d.ts +1 -1
- package/src/MenuItem/useMenuItem.d.ts +1 -1
- package/src/MenuItem/useVirtualizedMenuItem.d.ts +1 -1
- package/src/MenuItemText/MenuItemText.d.ts +1 -1
- package/src/MenuList/MenuList.type.d.ts +1 -1
- package/src/Modal/InnerModal.d.ts +2 -16
- package/src/Modal/InnerModal.type.d.ts +1 -0
- package/src/Modal/Modal.d.ts +2 -21
- package/src/Modal/ModalContext.d.ts +3 -0
- package/src/Modal/OverlayBranchRegistry.d.ts +8 -0
- package/src/Modal/useOverlayBranch.d.ts +8 -0
- package/src/NestedMenuContext/MenuOverlayGroupContext.d.ts +2 -2
- package/src/Option/Option.d.ts +1 -1
- package/src/PageHeader/PageHeader.d.ts +5 -5
- package/src/PickerTextField/PickerTextField.d.ts +1 -1
- package/src/Popover/Popover.d.ts +1 -1
- package/src/Popper/Popper.d.ts +1 -1
- package/src/Popper/Popper.type.d.ts +10 -7
- package/src/PopperPaper/PopperPaper.d.ts +1 -1
- package/src/RadioGroup/RadioGroup.d.ts +1 -1
- package/src/Rating/Rating.d.ts +1 -1
- package/src/Rating/RatingItem.d.ts +1 -1
- package/src/Rating/utils.d.ts +3 -3
- package/src/Select/Select.type.d.ts +1 -1
- package/src/SingleFilter/FilterButton/FilterButton.d.ts +1 -1
- package/src/SingleFilter/SingleFilter.d.ts +1 -1
- package/src/Skeleton/Skeleton.d.ts +1 -1
- package/src/Slider/Slider.d.ts +2 -2
- package/src/Slider/SliderThumb.d.ts +2 -2
- package/src/Snackbar/Snackbar.d.ts +1 -1
- package/src/Snackbar/SnackbarContent/SnackbarContent.d.ts +1 -1
- package/src/SortableListItem/SortableListItem.d.ts +1 -1
- package/src/SortableListItem/SortableListItemOverlay.d.ts +1 -1
- package/src/SplitButton/SplitButton.d.ts +1 -1
- package/src/Squircle/Squircle.d.ts +1 -1
- package/src/StatusIndicator/StatusIndicator.d.ts +2 -2
- package/src/StepConnector/StepConnector.d.ts +1 -1
- package/src/StepContent/StepContent.d.ts +1 -1
- package/src/StepIcon/StepIcon.d.ts +1 -1
- package/src/StepLabel/StepLabel.d.ts +1 -1
- package/src/SubMenu/PopperMenu.d.ts +1 -1
- package/src/SubMenu/PopperMenu.type.d.ts +4 -1
- package/src/SubMenu/SubMenu.d.ts +1 -1
- package/src/SwipeableDrawer/SwipeableDrawer.d.ts +1 -1
- package/src/Tab/Tab.d.ts +1 -1
- package/src/TabPanel/TabPanel.d.ts +1 -1
- package/src/TableFooter/TableFooter.d.ts +1 -1
- package/src/Tabs/TabMoreMenu.d.ts +1 -1
- package/src/Tabs/TabScrollButton.d.ts +1 -1
- package/src/Tabs/Tabs.d.ts +1 -1
- package/src/Tag/Tag.d.ts +1 -1
- package/src/TextField/TextField.d.ts +1 -1
- package/src/Textarea/Textarea.d.ts +1 -1
- package/src/TimePicker/NumberPicker.d.ts +1 -1
- package/src/TimePicker/TimeButton.d.ts +1 -1
- package/src/TimePicker/ToggleText.d.ts +1 -1
- package/src/Tray/Tray.d.ts +1 -1
- package/src/Tray/TrayPanel.d.ts +1 -1
- package/src/TrayMenu/TrayMenu.d.ts +1 -1
- package/src/TrayMenu/TrayMenuItem.d.ts +1 -1
- package/src/VirtualizedList/VirtuosoComponents.d.ts +4 -4
- package/src/VisuallyHidden/VisuallyHidden.d.ts +1 -1
- package/src/internal/utils/index.d.ts +0 -1
- /package/{src/internal → internal}/utils/composeEventHandlers.d.ts +0 -0
package/Popper.js
CHANGED
|
@@ -3,7 +3,7 @@ import { flip, shift, limitShift, arrow, offset, size, useFloating, autoUpdate }
|
|
|
3
3
|
import { useWindowContext, useForkRef } from '@ringcentral/spring-base';
|
|
4
4
|
import { useThemeProps, useTheme } from '@ringcentral/spring-theme';
|
|
5
5
|
import { forwardRef, useRef, useImperativeHandle, useLayoutEffect } from 'react';
|
|
6
|
-
import { u as useModalContext } from './chunks/Modal.js';
|
|
6
|
+
import { u as useModalContext, b as useOverlayBranch } from './chunks/Modal.js';
|
|
7
7
|
import { Portal } from '@mui/base';
|
|
8
8
|
import 'framer-motion';
|
|
9
9
|
import './chunks/Icon.js';
|
|
@@ -20,17 +20,22 @@ const getArrowSide = (placement) => ({
|
|
|
20
20
|
})[placement.split('-')[0]];
|
|
21
21
|
const Popper = forwardRef((inProps, ref) => {
|
|
22
22
|
const props = useThemeProps({ props: inProps, name: 'Popper' });
|
|
23
|
-
const { children: childrenProp, middlewares: middlewaresProp = [], placement: placementProp, anchorEl, arrowHeight = 0, offset: offset$1 = 0, padding = 0, arrowPadding = 0, style, actions, autoUpdate: autoUpdate$1 = true, whileElementsMounted, matchAnchorWidth, container: containerProp, disablePortal, ...rest } = props;
|
|
23
|
+
const { children: childrenProp, middlewares: middlewaresProp = [], placement: placementProp, anchorEl, arrowHeight = 0, offset: offset$1 = 0, padding = 0, arrowPadding = 0, style, actions, autoUpdate: autoUpdate$1 = true, whileElementsMounted, matchAnchorWidth, tether = true, container: containerProp, disablePortal, ...rest } = props;
|
|
24
24
|
const { externalWindow, document } = useWindowContext();
|
|
25
25
|
const container = containerProp ?? document?.body;
|
|
26
26
|
const { scopeProps } = useTheme();
|
|
27
27
|
const modalContext = useModalContext();
|
|
28
|
+
const overlayBranchRegistry = modalContext?.overlayBranchRegistry;
|
|
28
29
|
const finalDisablePortal = disablePortal ?? (modalContext?.ariaHideEnabled ? true : false);
|
|
30
|
+
const overlayBranchRef = useOverlayBranch({
|
|
31
|
+
active: !finalDisablePortal,
|
|
32
|
+
registry: overlayBranchRegistry,
|
|
33
|
+
});
|
|
29
34
|
const arrowRef = useRef(null);
|
|
30
35
|
const presetMiddlewares = [
|
|
31
36
|
flip({ padding }),
|
|
32
37
|
shift({
|
|
33
|
-
limiter: limitShift(),
|
|
38
|
+
...(tether ? { limiter: limitShift() } : { crossAxis: true }),
|
|
34
39
|
padding,
|
|
35
40
|
}),
|
|
36
41
|
arrow({
|
|
@@ -43,6 +48,7 @@ const Popper = forwardRef((inProps, ref) => {
|
|
|
43
48
|
presetMiddlewares.push(size({
|
|
44
49
|
apply({ rects, elements, }) {
|
|
45
50
|
Object.assign(elements.floating.style, {
|
|
51
|
+
boxSizing: 'border-box',
|
|
46
52
|
width: `${rects.reference.width}px`,
|
|
47
53
|
});
|
|
48
54
|
},
|
|
@@ -60,15 +66,7 @@ const Popper = forwardRef((inProps, ref) => {
|
|
|
60
66
|
if (autoUpdate$1 === false) {
|
|
61
67
|
return;
|
|
62
68
|
}
|
|
63
|
-
|
|
64
|
-
return autoUpdate(reference, floating, update, {
|
|
65
|
-
ancestorResize: true,
|
|
66
|
-
ancestorScroll: true,
|
|
67
|
-
animationFrame: false,
|
|
68
|
-
elementResize: Boolean(matchAnchorWidth),
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return autoUpdate(reference, floating, update, autoUpdate$1);
|
|
69
|
+
return autoUpdate(reference, floating, update, autoUpdate$1 === true ? undefined : autoUpdate$1);
|
|
72
70
|
})();
|
|
73
71
|
return () => {
|
|
74
72
|
disposeAutoUpdate?.();
|
|
@@ -79,22 +77,25 @@ const Popper = forwardRef((inProps, ref) => {
|
|
|
79
77
|
useImperativeHandle(actions, () => ({ update }), [update]);
|
|
80
78
|
const handleRootRef = useForkRef(ref, setFloating);
|
|
81
79
|
useLayoutEffect(() => {
|
|
82
|
-
if (anchorEl) {
|
|
83
|
-
const anchor = typeof anchorEl === 'function' ? anchorEl() : anchorEl;
|
|
84
|
-
setReference(anchor);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
80
|
+
if (!anchorEl) {
|
|
87
81
|
setReference(null);
|
|
82
|
+
return undefined;
|
|
88
83
|
}
|
|
84
|
+
const anchor = typeof anchorEl === 'function' ? anchorEl() : anchorEl;
|
|
85
|
+
setReference(anchor);
|
|
86
|
+
return () => {
|
|
87
|
+
setReference(null);
|
|
88
|
+
};
|
|
89
89
|
}, [setReference, anchorEl]);
|
|
90
90
|
const arrowSide = getArrowSide(placement);
|
|
91
|
-
const
|
|
91
|
+
const renderChildren = () => {
|
|
92
92
|
if (typeof childrenProp !== 'function')
|
|
93
93
|
return childrenProp;
|
|
94
|
-
if (!arrowHeight)
|
|
95
|
-
childrenProp({ placement, arrowRef, arrowStyle: {} });
|
|
94
|
+
if (!arrowHeight) {
|
|
95
|
+
return childrenProp({ placement, arrowRef, arrowStyle: {} });
|
|
96
|
+
}
|
|
96
97
|
const squareSideLength = Math.round(((arrowHeight * 2) ** 2 / 2) ** (1 / 2));
|
|
97
|
-
|
|
98
|
+
const childrenRenderProps = {
|
|
98
99
|
placement,
|
|
99
100
|
arrowRef,
|
|
100
101
|
arrowStyle: {
|
|
@@ -104,12 +105,14 @@ const Popper = forwardRef((inProps, ref) => {
|
|
|
104
105
|
left: arrowX,
|
|
105
106
|
[arrowSide]: -squareSideLength / 2,
|
|
106
107
|
},
|
|
107
|
-
}
|
|
108
|
-
|
|
108
|
+
};
|
|
109
|
+
return childrenProp(childrenRenderProps);
|
|
110
|
+
};
|
|
111
|
+
const children = renderChildren();
|
|
109
112
|
const dpr = externalWindow?.devicePixelRatio ?? 1;
|
|
110
113
|
const fixedX = Math.round(Number(x ?? 0) * dpr) / dpr;
|
|
111
114
|
const fixedY = Math.round(Number(y ?? 0) * dpr) / dpr;
|
|
112
|
-
return (jsx(Portal, { container: container, disablePortal: finalDisablePortal, children: jsx("div", { ...scopeProps, style: { display: 'contents' }, children: jsx("div", { ...rest, "data-sui-popper-placement": placement, ref: handleRootRef, style: {
|
|
115
|
+
return (jsx(Portal, { container: container, disablePortal: finalDisablePortal, children: jsx("div", { ref: overlayBranchRef, ...scopeProps, style: { display: 'contents' }, children: jsx("div", { ...rest, "data-sui-popper-placement": placement, ref: handleRootRef, style: {
|
|
113
116
|
...(arrowHeight
|
|
114
117
|
? { minWidth: (arrowHeight + arrowPadding) * 2 }
|
|
115
118
|
: undefined),
|
|
@@ -118,7 +121,7 @@ const Popper = forwardRef((inProps, ref) => {
|
|
|
118
121
|
top: '0',
|
|
119
122
|
left: '0',
|
|
120
123
|
transform: `translate3d(${fixedX}px,${fixedY}px,0)`,
|
|
121
|
-
width: 'max-content',
|
|
124
|
+
...(matchAnchorWidth ? undefined : { width: 'max-content' }),
|
|
122
125
|
}, children: children }) }) }));
|
|
123
126
|
});
|
|
124
127
|
Popper.displayName = 'SuiPopper';
|
package/Rating.js
CHANGED
|
@@ -18,8 +18,8 @@ function roundValueToPrecision(value, precision) {
|
|
|
18
18
|
const nearest = Math.round(value / precision) * precision;
|
|
19
19
|
return Number(nearest.toFixed(getDecimalPrecision(precision)));
|
|
20
20
|
}
|
|
21
|
-
const defaultIcon = jsx(Icon, { symbol: StarFilledMd, size: "large" });
|
|
22
|
-
const defaultEmptyIcon = jsx(Icon, { symbol: StarMd, size: "large" });
|
|
21
|
+
const defaultIcon = (jsx(Icon, { symbol: StarFilledMd, size: "large" }));
|
|
22
|
+
const defaultEmptyIcon = (jsx(Icon, { symbol: StarMd, size: "large" }));
|
|
23
23
|
function defaultLabelText(value) {
|
|
24
24
|
return `${value || '0'} Star${value !== 1 ? 's' : ''}`;
|
|
25
25
|
}
|
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';
|
|
@@ -24,12 +26,14 @@ import './Popper.js';
|
|
|
24
26
|
import './chunks/PopperPaper.js';
|
|
25
27
|
import './chunks/useMenuItemSelect.js';
|
|
26
28
|
import '@ringcentral/spring-icon';
|
|
29
|
+
import './chunks/useAnimationFrame.js';
|
|
27
30
|
import './chunks/useNestedMenuItem.js';
|
|
28
31
|
import './VirtualizedList.js';
|
|
29
32
|
import 'react-virtuoso';
|
|
30
33
|
import './chunks/List.js';
|
|
31
34
|
import './chunks/useListNavigation.js';
|
|
32
35
|
import 'tabbable';
|
|
36
|
+
import './chunks/composeEventHandlers.js';
|
|
33
37
|
import './ListNavigation.js';
|
|
34
38
|
import './chunks/MenuList.js';
|
|
35
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';
|
|
@@ -31,10 +32,13 @@ import './chunks/useNestedParentMenu.js';
|
|
|
31
32
|
import './chunks/Popover.js';
|
|
32
33
|
import './chunks/getGrow.js';
|
|
33
34
|
import '@ringcentral/spring-icon';
|
|
35
|
+
import './chunks/useAnimationFrame.js';
|
|
34
36
|
import './chunks/useNestedMenuItem.js';
|
|
37
|
+
import './chunks/composeEventHandlers.js';
|
|
35
38
|
import './ListNavigation.js';
|
|
36
39
|
import 'react-virtuoso';
|
|
37
40
|
import './chunks/List.js';
|
|
41
|
+
import './chunks/hasContent.js';
|
|
38
42
|
|
|
39
43
|
var FilterButton$1 = {"sui-filter-button-root":"sui-filter-button-root","sui-focus-visible":"sui-focus-visible","sui-selected":"sui-selected","sui-disabled":"sui-disabled"};
|
|
40
44
|
|
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':
|
|
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
|
}) }))] }));
|
package/SortableListItem.js
CHANGED
|
@@ -15,6 +15,7 @@ import './chunks/useListNavigation.js';
|
|
|
15
15
|
import 'tabbable';
|
|
16
16
|
import './VirtualizedList.js';
|
|
17
17
|
import 'react-virtuoso';
|
|
18
|
+
import './chunks/useAnimationFrame.js';
|
|
18
19
|
import './chunks/List.js';
|
|
19
20
|
import './chunks/useMotionSafeTransition.js';
|
|
20
21
|
import './chunks/usePrefersReducedMotion.js';
|
|
@@ -6,6 +6,7 @@ import { forwardRef, useMemo } from 'react';
|
|
|
6
6
|
import { VirtualizedList } from './VirtualizedList.js';
|
|
7
7
|
import '@ringcentral/spring-base';
|
|
8
8
|
import 'react-virtuoso';
|
|
9
|
+
import './chunks/useAnimationFrame.js';
|
|
9
10
|
import './chunks/List.js';
|
|
10
11
|
import './chunks/useListNavigation.js';
|
|
11
12
|
import 'tabbable';
|
|
@@ -18,16 +19,16 @@ const SortableVirtualizedList = forwardRef((inProps, ref) => {
|
|
|
18
19
|
const { children, data, ...rest } = props;
|
|
19
20
|
const { active } = useDndContext();
|
|
20
21
|
const keepInvisibleItems = useMemo(() => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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];
|
|
31
32
|
}, [active, data]);
|
|
32
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) }) }));
|
|
33
34
|
});
|
package/SplitButton.js
CHANGED
|
@@ -33,11 +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';
|
|
39
|
+
import './chunks/useAnimationFrame.js';
|
|
38
40
|
import '@ringcentral/spring-icon';
|
|
39
41
|
import './chunks/useNestedMenuItem.js';
|
|
42
|
+
import './chunks/composeEventHandlers.js';
|
|
40
43
|
import './ListNavigation.js';
|
|
44
|
+
import './chunks/hasContent.js';
|
|
41
45
|
import './chunks/useHelperTextId.js';
|
|
42
46
|
import './chunks/VirtualizedMenu.js';
|
|
43
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
|
|
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 {
|
|
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: '
|
|
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';
|
|
@@ -22,12 +23,15 @@ import './chunks/usePrefersReducedMotion.js';
|
|
|
22
23
|
import './chunks/getFade.js';
|
|
23
24
|
import './chunks/useFocusTrapStack.js';
|
|
24
25
|
import './chunks/Backdrop.js';
|
|
26
|
+
import './chunks/useAnimationFrame.js';
|
|
27
|
+
import './chunks/composeEventHandlers.js';
|
|
25
28
|
import './ListNavigation.js';
|
|
26
29
|
import './chunks/Popover.js';
|
|
27
30
|
import './chunks/getGrow.js';
|
|
28
31
|
import './chunks/PopperPaper.js';
|
|
29
32
|
import 'react-virtuoso';
|
|
30
33
|
import './chunks/List.js';
|
|
34
|
+
import './chunks/hasContent.js';
|
|
31
35
|
|
|
32
36
|
var PopperMenu$1 = {"sui-popper-menu-root":"sui-popper-menu-root","sui-popper-menu-paper":"sui-popper-menu-paper"};
|
|
33
37
|
|
package/SwipeableDrawer.js
CHANGED
|
@@ -7,6 +7,7 @@ import { D as Drawer } from './chunks/Drawer.js';
|
|
|
7
7
|
import { D as DragHandle } from './chunks/DragHandle.js';
|
|
8
8
|
import { useMotionValue, animate, useTransform } from 'framer-motion';
|
|
9
9
|
import { rubberbandIfOutOfBounds, useDrag } from '@use-gesture/react';
|
|
10
|
+
import { u as useAnimationFrame } from './chunks/useAnimationFrame.js';
|
|
10
11
|
import { ResizeObserver } from '@juggle/resize-observer';
|
|
11
12
|
import './chunks/Icon.js';
|
|
12
13
|
import './chunks/usePrefersReducedMotion.js';
|
|
@@ -48,8 +49,7 @@ const observerOptions = {
|
|
|
48
49
|
box: 'border-box',
|
|
49
50
|
};
|
|
50
51
|
function useElementSizeObserver(ref, { enabled, resizeSourceRef, }) {
|
|
51
|
-
const {
|
|
52
|
-
const win = externalWindow ?? globalThis;
|
|
52
|
+
const { requestAnimationFrame, cancelAnimationFrame } = useAnimationFrame();
|
|
53
53
|
const [size, setSize] = useState(0);
|
|
54
54
|
const handleResize = useCallback((entries) => {
|
|
55
55
|
const entry = entries?.[0];
|
|
@@ -74,8 +74,6 @@ function useElementSizeObserver(ref, { enabled, resizeSourceRef, }) {
|
|
|
74
74
|
if (!enabled) {
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
const rAF = win.requestAnimationFrame.bind(win);
|
|
78
|
-
const cAF = win.cancelAnimationFrame.bind(win);
|
|
79
77
|
let resizeObserver = null;
|
|
80
78
|
let rafId = 0;
|
|
81
79
|
let initialMeasurementRafId = 0;
|
|
@@ -85,7 +83,7 @@ function useElementSizeObserver(ref, { enabled, resizeSourceRef, }) {
|
|
|
85
83
|
return;
|
|
86
84
|
resizeObserver = new ResizeObserver(handleResize);
|
|
87
85
|
resizeObserver.observe(el, observerOptions);
|
|
88
|
-
initialMeasurementRafId =
|
|
86
|
+
initialMeasurementRafId = requestAnimationFrame(() => {
|
|
89
87
|
const initial = Math.max(el.scrollHeight, el.offsetHeight, el.getBoundingClientRect().height);
|
|
90
88
|
if (initial > 0) {
|
|
91
89
|
setSize(initial);
|
|
@@ -97,31 +95,33 @@ function useElementSizeObserver(ref, { enabled, resizeSourceRef, }) {
|
|
|
97
95
|
startObserving();
|
|
98
96
|
}
|
|
99
97
|
else {
|
|
100
|
-
rafId =
|
|
98
|
+
rafId = requestAnimationFrame(waitForElement);
|
|
101
99
|
}
|
|
102
100
|
};
|
|
103
101
|
if (ref.current) {
|
|
104
102
|
startObserving();
|
|
105
103
|
}
|
|
106
104
|
else {
|
|
107
|
-
rafId =
|
|
105
|
+
rafId = requestAnimationFrame(waitForElement);
|
|
108
106
|
}
|
|
109
107
|
return () => {
|
|
110
108
|
if (rafId)
|
|
111
|
-
|
|
112
|
-
if (initialMeasurementRafId)
|
|
113
|
-
|
|
109
|
+
cancelAnimationFrame(rafId);
|
|
110
|
+
if (initialMeasurementRafId) {
|
|
111
|
+
cancelAnimationFrame(initialMeasurementRafId);
|
|
112
|
+
}
|
|
114
113
|
if (resizeObserver) {
|
|
115
114
|
resizeObserver.disconnect();
|
|
116
115
|
}
|
|
117
116
|
};
|
|
118
|
-
}, [ref, handleResize, enabled,
|
|
117
|
+
}, [ref, handleResize, enabled, requestAnimationFrame, cancelAnimationFrame]);
|
|
119
118
|
return enabled ? size : 0;
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
function useMaxHeight(registerReady) {
|
|
123
|
-
const { externalWindow, globalThis } = useWindowContext();
|
|
124
|
-
const win = externalWindow ??
|
|
122
|
+
const { externalWindow, globalThis: contextGlobal } = useWindowContext();
|
|
123
|
+
const win = externalWindow ?? contextGlobal;
|
|
124
|
+
const { requestAnimationFrame, cancelAnimationFrame } = useAnimationFrame();
|
|
125
125
|
const setReady = useMemo(() => {
|
|
126
126
|
return registerReady ? registerReady('maxHeight') : undefined;
|
|
127
127
|
}, [registerReady]);
|
|
@@ -132,13 +132,11 @@ function useMaxHeight(registerReady) {
|
|
|
132
132
|
maxReadyCalledRef.current = false;
|
|
133
133
|
}, [setReady]);
|
|
134
134
|
useLayoutEffect(() => {
|
|
135
|
-
const rAF = win.requestAnimationFrame.bind(win);
|
|
136
|
-
const cAF = win.cancelAnimationFrame.bind(win);
|
|
137
135
|
const handleResize = () => {
|
|
138
136
|
if (raf.current) {
|
|
139
137
|
return;
|
|
140
138
|
}
|
|
141
|
-
raf.current =
|
|
139
|
+
raf.current = requestAnimationFrame(() => {
|
|
142
140
|
if (raf.current !== 0) {
|
|
143
141
|
setMaxHeight(win.innerHeight);
|
|
144
142
|
raf.current = 0;
|
|
@@ -153,9 +151,9 @@ function useMaxHeight(registerReady) {
|
|
|
153
151
|
}
|
|
154
152
|
return () => {
|
|
155
153
|
win.removeEventListener('resize', handleResize);
|
|
156
|
-
|
|
154
|
+
cancelAnimationFrame(raf.current);
|
|
157
155
|
};
|
|
158
|
-
}, [setReady, win]);
|
|
156
|
+
}, [setReady, win, requestAnimationFrame, cancelAnimationFrame]);
|
|
159
157
|
return maxHeight;
|
|
160
158
|
}
|
|
161
159
|
function usePreservedHeight(currentHeight) {
|
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)
|
|
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
|
package/TablePagination.js
CHANGED
|
@@ -22,7 +22,11 @@ import './chunks/Modal.js';
|
|
|
22
22
|
import './chunks/useFocusTrapStack.js';
|
|
23
23
|
import './chunks/Backdrop.js';
|
|
24
24
|
import './chunks/PopperPaper.js';
|
|
25
|
+
import './chunks/hasContent.js';
|
|
26
|
+
import '@mui/utils';
|
|
27
|
+
import './chunks/composeEventHandlers.js';
|
|
25
28
|
import './chunks/useMenuItemSelect.js';
|
|
29
|
+
import './chunks/useAnimationFrame.js';
|
|
26
30
|
import './chunks/useNestedParentMenu.js';
|
|
27
31
|
import './chunks/useNestedMenuItem.js';
|
|
28
32
|
import './VirtualizedList.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';
|
|
@@ -36,10 +37,13 @@ import './chunks/useFocusTrapStack.js';
|
|
|
36
37
|
import './chunks/Backdrop.js';
|
|
37
38
|
import './Popper.js';
|
|
38
39
|
import './chunks/PopperPaper.js';
|
|
40
|
+
import './chunks/useAnimationFrame.js';
|
|
39
41
|
import './chunks/useNestedMenuItem.js';
|
|
42
|
+
import './chunks/composeEventHandlers.js';
|
|
40
43
|
import './ListNavigation.js';
|
|
41
44
|
import 'react-virtuoso';
|
|
42
45
|
import './chunks/List.js';
|
|
46
|
+
import './chunks/hasContent.js';
|
|
43
47
|
import 'clsx';
|
|
44
48
|
|
|
45
49
|
const TabMenuItem = forwardRef((props, ref) => {
|
|
@@ -188,9 +192,11 @@ function useComputedTabs(props) {
|
|
|
188
192
|
}, [children, tabsInstanceId]);
|
|
189
193
|
const [visibleTabs, setVisibleTabs] = useState(processedChildren);
|
|
190
194
|
const visibleTabsChildren = useMemo(() => {
|
|
191
|
-
return Array.from(visibleTabs.entries()).map(([childValue, { child }]) => {
|
|
192
|
-
|
|
193
|
-
|
|
195
|
+
return Array.from(visibleTabs.entries()).map(([childValue, { child }]) => ({
|
|
196
|
+
...child,
|
|
197
|
+
key: child.key ?? childValue,
|
|
198
|
+
props: { ...child.props, value: childValue },
|
|
199
|
+
}));
|
|
194
200
|
}, [visibleTabs]);
|
|
195
201
|
const prevChildren = usePrevious(() => children);
|
|
196
202
|
const cacheTabsChildren = useEventCallback(() => {
|
|
@@ -570,7 +576,7 @@ var Tabs$1 = {"sui-tabs-root":"sui-tabs-root","sui-tabs-large":"sui-tabs-large",
|
|
|
570
576
|
const DEFAULT_PILL_GAP = 4;
|
|
571
577
|
const Tabs = forwardRef((inProps, ref) => {
|
|
572
578
|
const props = useThemeProps({ props: inProps, name: 'Tabs' });
|
|
573
|
-
const { classes, className, children,
|
|
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;
|
|
574
580
|
const pillGap = pill ? pillGapProp : 0;
|
|
575
581
|
const tabsRef = useRef(null);
|
|
576
582
|
const scrollerRef = useRef(null);
|
|
@@ -717,7 +723,7 @@ const Tabs = forwardRef((inProps, ref) => {
|
|
|
717
723
|
'scroll-left': !!scrollButtonStart,
|
|
718
724
|
'scroll-right': !!scrollButtonEnd,
|
|
719
725
|
'scroll-both': !!(scrollButtonStart && scrollButtonEnd),
|
|
720
|
-
}, size), ...
|
|
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: {
|
|
721
727
|
left: floatingUnderlineLeftMotionValue,
|
|
722
728
|
width: floatingUnderlineWidthMotionValue,
|
|
723
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';
|
|
@@ -24,7 +25,9 @@ import './Popper.js';
|
|
|
24
25
|
import './chunks/PopperPaper.js';
|
|
25
26
|
import './chunks/useMotionSafeTransition.js';
|
|
26
27
|
import '@ringcentral/spring-icon';
|
|
28
|
+
import './chunks/useAnimationFrame.js';
|
|
27
29
|
import './chunks/useNestedMenuItem.js';
|
|
30
|
+
import './chunks/composeEventHandlers.js';
|
|
28
31
|
import './ListNavigation.js';
|
|
29
32
|
import 'react-virtuoso';
|
|
30
33
|
import './chunks/List.js';
|
package/VirtualizedList.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createContext, useContext, forwardRef, isValidElement, useRef, useState, useImperativeHandle, useEffect } from 'react';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useForkRef,
|
|
3
|
+
import { useForkRef, useVirtuosoExternalWindow, useEventCallback, logInDev } from '@ringcentral/spring-base';
|
|
4
4
|
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
5
5
|
import { Virtuoso } from 'react-virtuoso';
|
|
6
|
+
import { u as useAnimationFrame } from './chunks/useAnimationFrame.js';
|
|
6
7
|
import { L as List } from './chunks/List.js';
|
|
7
8
|
import './chunks/useListNavigation.js';
|
|
8
9
|
import 'tabbable';
|
|
@@ -10,6 +11,7 @@ import 'tabbable';
|
|
|
10
11
|
const VirtualizedItemPropsContext = createContext(null);
|
|
11
12
|
const useVirtualizedItemPropsContext = () => useContext(VirtualizedItemPropsContext);
|
|
12
13
|
|
|
14
|
+
const DATA_ITEM_INDEX_ATTR = 'data-item-index';
|
|
13
15
|
const VirtuosoList = forwardRef((props, ref) => {
|
|
14
16
|
const { children: childrenProp, context, style, ...rest } = props;
|
|
15
17
|
const { searchAndFocusItemHandler, isScrolling, ListProps, listActions, listRef, itemContentRenderer, data, keepInvisibleItems, computeItemKey, } = context;
|
|
@@ -20,12 +22,12 @@ const VirtuosoList = forwardRef((props, ref) => {
|
|
|
20
22
|
if (keepInvisibleItems && computeItemKey && Array.isArray(childrenProp)) {
|
|
21
23
|
const firstChild = childrenProp[0];
|
|
22
24
|
if (firstChild && isValidElement(firstChild)) {
|
|
23
|
-
const index = Number(firstChild.props
|
|
25
|
+
const index = Number(firstChild.props[DATA_ITEM_INDEX_ATTR]);
|
|
24
26
|
rangeStart = Number.isNaN(index) ? null : index;
|
|
25
27
|
}
|
|
26
28
|
const lastChild = childrenProp.at(-1);
|
|
27
29
|
if (lastChild && isValidElement(lastChild)) {
|
|
28
|
-
const index = Number(lastChild.props
|
|
30
|
+
const index = Number(lastChild.props[DATA_ITEM_INDEX_ATTR]);
|
|
29
31
|
rangeEnd = Number.isNaN(index) ? null : index;
|
|
30
32
|
}
|
|
31
33
|
children = [
|
|
@@ -85,7 +87,7 @@ const VirtualizedList = forwardRef((inProps, ref) => {
|
|
|
85
87
|
const handleVirtuosoRef = useForkRef(virtuosoRef, virtuosoActions);
|
|
86
88
|
const initialFocusItemByIndexPromiseRef = useRef(null);
|
|
87
89
|
const itemRenderedPromiseRef = useRef(null);
|
|
88
|
-
const {
|
|
90
|
+
const { requestAnimationFrame } = useAnimationFrame();
|
|
89
91
|
const externalWindowProps = useVirtuosoExternalWindow();
|
|
90
92
|
const isItemRendered = (index) => {
|
|
91
93
|
const { startIndex, endIndex } = listRangeRef.current;
|
|
@@ -96,7 +98,7 @@ const VirtualizedList = forwardRef((inProps, ref) => {
|
|
|
96
98
|
new Promise((resolve) => {
|
|
97
99
|
initialFocusItemByIndexPromiseRef.current = resolve;
|
|
98
100
|
}).then(() => {
|
|
99
|
-
|
|
101
|
+
requestAnimationFrame(() => focusByIndexAction(index));
|
|
100
102
|
});
|
|
101
103
|
}
|
|
102
104
|
else {
|
package/VirtualizedMenu.js
CHANGED
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);
|