@ringcentral/spring-ui 1.8.0 → 1.9.1
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/Autocomplete.js +46 -11
- package/Avatar.js +12 -3
- package/CircularProgressIndicator.js +1 -0
- package/Dialog.js +16 -4
- package/LinearProgressIndicator.js +6 -5
- package/Link.js +2 -2
- package/Modal.js +1 -1
- package/Radio.js +6 -3
- package/StepButton.js +2 -3
- package/StepContent.js +3 -8
- package/SwipeableDrawer.js +30 -17
- package/Switch.js +2 -2
- package/Tab.js +1 -1
- package/TableRow.js +2 -3
- package/Tabs.js +2 -3
- package/Tooltip.js +1 -1
- package/VirtualizedList.js +5 -10
- package/VirtualizedMenu.js +1 -1
- package/chunks/Button.js +1 -1
- package/chunks/CircularProgressIndicator.js +3 -1
- package/chunks/IconButtonLabel.js +2 -3
- package/chunks/Menu.js +3 -2
- package/chunks/MenuList.js +3 -3
- package/chunks/Modal.js +5 -9
- package/chunks/Tooltip.js +1 -1
- package/chunks/VirtualizedMenu.js +44 -22
- package/chunks/getFade.js +3 -1
- package/chunks/useListNavigation.js +3 -0
- package/chunks/useMenuItemSelect.js +3 -3
- package/chunks/useNestedParentMenu.js +5 -16
- package/chunks/usePrefersReducedMotion.js +6 -2
- package/index.css +49 -37
- package/package.json +4 -4
- package/src/Accordion/Accordion.d.ts +1 -1
- package/src/AccordionHeader/AccordionHeader.d.ts +1 -1
- package/src/Alert/Alert.d.ts +1 -1
- package/src/Autocomplete/SuggestionList/utils/useHighlightScroll.d.ts +4 -3
- package/src/Autocomplete/useAutocomplete.d.ts +4 -4
- package/src/Autocomplete/useAutocompleteTag.d.ts +3 -3
- package/src/Checkbox/Checkbox.classes.d.ts +1 -1
- package/src/Checkbox/Checkbox.d.ts +2 -2
- package/src/Checkbox/Checkbox.type.d.ts +4 -4
- package/src/CircularProgressIndicator/CircularProgressIndicator.d.ts +1 -1
- package/src/CircularProgressIndicator/CircularProgressIndicator.type.d.ts +2 -2
- package/src/DatePicker/Day.d.ts +1 -1
- package/src/DatePicker/Year.d.ts +1 -1
- package/src/Dialog/Dialog.classes.d.ts +1 -1
- package/src/Dialog/Dialog.d.ts +1 -1
- package/src/Dialog/Dialog.type.d.ts +3 -0
- package/src/Drawer/Drawer.d.ts +1 -1
- package/src/Dropdown/Dropdown.type.d.ts +4 -4
- package/src/EmptyState/EmptyState.d.ts +1 -1
- package/src/FormField/FormField.type.d.ts +2 -2
- 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/LinearProgressIndicator/LinearProgressIndicator.type.d.ts +2 -2
- package/src/ListItemText/ListItemText.d.ts +1 -1
- package/src/Menu/Menu.d.ts +1 -1
- package/src/MenuItem/MenuItem.d.ts +1 -1
- package/src/MenuItemText/MenuItemText.d.ts +1 -1
- package/src/Modal/InnerModal.d.ts +2 -2
- package/src/Modal/Modal.classes.d.ts +1 -1
- package/src/Modal/Modal.d.ts +3 -3
- package/src/NestedMenuContext/NestedMenuContext.d.ts +1 -1
- package/src/Option/Option.d.ts +1 -1
- package/src/Popover/Popover.d.ts +1 -1
- package/src/Popper/Popper.d.ts +1 -1
- package/src/PopperPaper/PopperPaper.d.ts +1 -1
- package/src/Radio/Radio.d.ts +2 -2
- package/src/Radio/Radio.type.d.ts +4 -4
- 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/SingleFilter/FilterButton/FilterButton.d.ts +1 -1
- package/src/SingleFilter/SingleFilter.d.ts +1 -1
- package/src/Slider/Slider.d.ts +2 -2
- package/src/SortableListItem/SortableListItemOverlay.d.ts +1 -1
- package/src/SplitButton/SplitButton.d.ts +1 -1
- package/src/StepContent/StepContent.d.ts +1 -1
- package/src/StepLabel/StepLabel.d.ts +1 -1
- package/src/SubMenu/PopperMenu.d.ts +1 -1
- package/src/SubMenu/SubMenu.d.ts +1 -1
- package/src/SwipeableDrawer/SwipeableDrawer.d.ts +1 -1
- package/src/Switch/Switch.d.ts +2 -2
- package/src/Switch/Switch.type.d.ts +4 -4
- package/src/Tab/Tab.d.ts +1 -1
- package/src/TabPanel/TabPanel.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/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/Tooltip/TooltipView.classes.d.ts +1 -1
- package/src/Tray/Tray.d.ts +1 -1
- package/src/TrayMenu/TrayMenu.d.ts +1 -1
- package/src/TrayMenu/TrayMenuItem.d.ts +1 -1
- package/src/VirtualizedMenu/VirtualizedMenu.classes.d.ts +1 -1
package/Autocomplete.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { forwardRef, useRef, useMemo, useCallback, useEffect, useLayoutEffect, useState, useImperativeHandle } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { Virtuoso } from 'react-virtuoso';
|
|
5
|
-
import { usePrevious,
|
|
5
|
+
import { usePrevious, useRefState, useEventCallback, logInDev, combineProps, useDepsChange, useControlled, useId, useForceUpdate, useKeyboardMoveFocus, useForkRef, useVirtuosoExternalWindow, useSleep, useRetry, useChange, getSelectionPosition, useClasses } from '@ringcentral/spring-base';
|
|
6
6
|
import { useClassesWithMode, useThemeProps } from '@ringcentral/spring-theme';
|
|
7
7
|
import { E as ExpandCollapseCaret } from './chunks/ExpandCollapseCaret.js';
|
|
8
8
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
@@ -86,25 +86,32 @@ const useDynamicHeight = ({ itemCount, maxContainerHeight, onContainerHeightChan
|
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
function useHighlightScroll({ containerHeighRef, scrollToIndex, }) {
|
|
90
|
-
const { externalWindow } = useWindowContext();
|
|
89
|
+
function useHighlightScroll({ virtualize = true, containerHeighRef, scrollToIndex, }) {
|
|
91
90
|
const renderedItemsRef = useRef([]);
|
|
92
91
|
const scrollerRef = useRef();
|
|
93
92
|
const scrollToHighlightedIndex = (prevHighlightedIndex, currHighlightedIndex, topHighlightIndex = 0) => {
|
|
94
93
|
const needsScrollReset = prevHighlightedIndex === -1;
|
|
95
94
|
if (!scrollerRef.current) {
|
|
96
95
|
if (currHighlightedIndex !== topHighlightIndex) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
index: currHighlightedIndex,
|
|
101
|
-
align: 'start',
|
|
102
|
-
});
|
|
96
|
+
scrollToIndex({
|
|
97
|
+
index: currHighlightedIndex,
|
|
98
|
+
align: 'start',
|
|
103
99
|
});
|
|
104
100
|
}
|
|
105
101
|
return;
|
|
106
102
|
}
|
|
107
103
|
const scrollElm = scrollerRef.current;
|
|
104
|
+
if (!virtualize) {
|
|
105
|
+
if (needsScrollReset && currHighlightedIndex === topHighlightIndex) {
|
|
106
|
+
scrollElm.scrollTop = 0;
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
scrollToIndex({
|
|
110
|
+
index: currHighlightedIndex,
|
|
111
|
+
align: 'start',
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
108
115
|
const renderedItems = renderedItemsRef.current;
|
|
109
116
|
const lastHighlightedIndex = needsScrollReset
|
|
110
117
|
? currHighlightedIndex
|
|
@@ -643,6 +650,7 @@ const SuggestionList = forwardRef((inProps, ref) => {
|
|
|
643
650
|
const listRef = useRef(null);
|
|
644
651
|
const itemData = options;
|
|
645
652
|
const itemCount = options.length;
|
|
653
|
+
const externalWindowProps = useVirtuosoExternalWindow();
|
|
646
654
|
const internalPrevHighlightedIndex = usePrevious(() => highlightedIndex, true);
|
|
647
655
|
const actualPrevHighlightedIndex = prevHighlightedIndex ?? internalPrevHighlightedIndex;
|
|
648
656
|
const cls = useClassesWithMode('suggestion-list', classesProp, classNameProp);
|
|
@@ -679,7 +687,33 @@ const SuggestionList = forwardRef((inProps, ref) => {
|
|
|
679
687
|
return true;
|
|
680
688
|
}
|
|
681
689
|
const toElm = scroller?.querySelector(`[data-item-index="${toIndex}"]`);
|
|
682
|
-
toElm
|
|
690
|
+
if (!toElm || !scroller) {
|
|
691
|
+
return false;
|
|
692
|
+
}
|
|
693
|
+
const scrollerRect = scroller.getBoundingClientRect();
|
|
694
|
+
const elementRect = toElm.getBoundingClientRect();
|
|
695
|
+
const scrollerTop = scrollerRect.top;
|
|
696
|
+
const scrollerBottom = scrollerRect.bottom;
|
|
697
|
+
const elementTop = elementRect.top;
|
|
698
|
+
const elementBottom = elementRect.bottom;
|
|
699
|
+
const isFullyVisible = elementTop >= scrollerTop && elementBottom <= scrollerBottom;
|
|
700
|
+
if (!isFullyVisible) {
|
|
701
|
+
let scrollOffset = 0;
|
|
702
|
+
if (elementTop < scrollerTop) {
|
|
703
|
+
scrollOffset = toElm.offsetTop - paddingValue;
|
|
704
|
+
}
|
|
705
|
+
else if (elementBottom > scrollerBottom) {
|
|
706
|
+
scrollOffset =
|
|
707
|
+
toElm.offsetTop -
|
|
708
|
+
scroller.clientHeight +
|
|
709
|
+
toElm.offsetHeight +
|
|
710
|
+
paddingValue;
|
|
711
|
+
}
|
|
712
|
+
scroller.scrollTo({
|
|
713
|
+
top: scrollOffset,
|
|
714
|
+
behavior: 'auto',
|
|
715
|
+
});
|
|
716
|
+
}
|
|
683
717
|
return true;
|
|
684
718
|
}
|
|
685
719
|
if (paddingValue > 0 &&
|
|
@@ -698,6 +732,7 @@ const SuggestionList = forwardRef((inProps, ref) => {
|
|
|
698
732
|
intervalTime: 20,
|
|
699
733
|
});
|
|
700
734
|
const { scrollerRef, scrollerRefFn, itemsRendered: itemsRenderedFromHook, scrollToHighlightedIndex, } = useHighlightScroll({
|
|
735
|
+
virtualize,
|
|
701
736
|
containerHeighRef,
|
|
702
737
|
scrollToIndex: scrollToIndexWithRetry,
|
|
703
738
|
});
|
|
@@ -786,7 +821,7 @@ const SuggestionList = forwardRef((inProps, ref) => {
|
|
|
786
821
|
};
|
|
787
822
|
const rootClass = cls('root');
|
|
788
823
|
const context = { listRef, rootClass, paddingValue };
|
|
789
|
-
return virtualize ? (jsx(Virtuoso, { ref: forkVlRef, totalCount: itemCount, data: itemData, context: context, components: components, itemContent: itemContent, ...getSuggestionListProps(), ...combineProps({
|
|
824
|
+
return virtualize ? (jsx(Virtuoso, { ref: forkVlRef, totalCount: itemCount, data: itemData, context: context, components: components, itemContent: itemContent, ...externalWindowProps, ...getSuggestionListProps(), ...combineProps({
|
|
790
825
|
scrollerRef: (scrollElm) => {
|
|
791
826
|
scrollerRefFn(scrollElm);
|
|
792
827
|
},
|
package/Avatar.js
CHANGED
|
@@ -32,7 +32,7 @@ const StatusIndicatorSizeMap = {
|
|
|
32
32
|
};
|
|
33
33
|
const Avatar = forwardRef((inProps, ref) => {
|
|
34
34
|
const props = useThemeProps({ props: inProps, name: 'Avatar' });
|
|
35
|
-
const { component, classes, className, children: childrenProp, imgProps, alt, src, srcSet, size: sizeProp, color = 'default', variant = 'circle', clickable: clickableProp, symbol, avatarShapeRef, showStatusIndicator, IndicatorProps, rootProps, disabled, ...rest } = props;
|
|
35
|
+
const { component, classes, className, children: childrenProp, imgProps, alt, src, srcSet, size: sizeProp, color = 'default', variant = 'circle', clickable: clickableProp, symbol, avatarShapeRef, showStatusIndicator, IndicatorProps, rootProps, disabled, onClick, ...rest } = props;
|
|
36
36
|
let children = null;
|
|
37
37
|
const loaded = useImgLoaded({
|
|
38
38
|
...imgProps,
|
|
@@ -73,7 +73,7 @@ const Avatar = forwardRef((inProps, ref) => {
|
|
|
73
73
|
}
|
|
74
74
|
const { focusVisible, focusVisibleRef, focusVisibleHandlers } = useFocusVisible(props);
|
|
75
75
|
const avatarRef = useForkRef(avatarShapeRef, focusVisibleRef);
|
|
76
|
-
const clickable = clickableProp !== false &&
|
|
76
|
+
const clickable = clickableProp !== false && onClick ? true : clickableProp ?? false;
|
|
77
77
|
const interactive = clickable && !disabled;
|
|
78
78
|
const supportsStatusIndicator = size !== 'xxsmall' && size !== 'xsmall';
|
|
79
79
|
let AvatarShape = component ?? 'div';
|
|
@@ -106,13 +106,22 @@ const Avatar = forwardRef((inProps, ref) => {
|
|
|
106
106
|
tabIndex: -1,
|
|
107
107
|
}
|
|
108
108
|
: {};
|
|
109
|
+
const rootClickHandler = onClick;
|
|
110
|
+
const handleClick = (event) => {
|
|
111
|
+
if (disabled) {
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
event.stopPropagation();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
rootClickHandler?.(event);
|
|
117
|
+
};
|
|
109
118
|
return (jsx(Overlap, { position: {
|
|
110
119
|
bottom: '-1px',
|
|
111
120
|
right: '-1px',
|
|
112
121
|
}, floater: supportsStatusIndicator && showStatusIndicator ? (jsx(StatusIndicator, { size: StatusIndicatorSizeMap[size], ...IndicatorProps })) : undefined, className: clsx(className, groupClassName), classes: {
|
|
113
122
|
root: cls('root', size, { disabled }),
|
|
114
123
|
floater: cls('indicator', interactive && 'clickable-indicator'),
|
|
115
|
-
}, ...rootProps, ref: ref, children: jsxs(AvatarShape, { className: cls('shape', variant, color, { clickable }, interactive && 'clickable-shape', interactive && `clickable-${variant}`), ...focusVisibleHandlers, ...shapeProps, ...ariaProps, ...nonInteractiveShapeProps, ...rest, ref: avatarRef, children: [jsx("div", { className: cls('content', `${variant}-content`, `${size}-content`, `${variant}-${color}`), children: children }), variant === 'circle' && (jsx("div", { className: cls('hover-tint', interactive && 'clickable-hover-tint', interactive && `clickable-hover-tint-${color}-${variant}`) })), variant === 'squircle' && interactive && (jsx(Squircle, { interactive: false, className: cls('hover-tint', interactive && 'clickable-hover-tint', interactive && `clickable-hover-tint-${color}-${variant}`) }))] }) }));
|
|
124
|
+
}, ...rootProps, ref: ref, children: jsxs(AvatarShape, { className: cls('shape', variant, color, { clickable }, interactive && 'clickable-shape', interactive && `clickable-${variant}`), ...focusVisibleHandlers, ...shapeProps, ...ariaProps, ...nonInteractiveShapeProps, ...rest, onClick: onClick ? handleClick : undefined, ref: avatarRef, children: [jsx("div", { className: cls('content', `${variant}-content`, `${size}-content`, `${variant}-${color}`), children: children }), variant === 'circle' && (jsx("div", { className: cls('hover-tint', interactive && 'clickable-hover-tint', interactive && `clickable-hover-tint-${color}-${variant}`) })), variant === 'squircle' && interactive && (jsx(Squircle, { interactive: false, className: cls('hover-tint', interactive && 'clickable-hover-tint', interactive && `clickable-hover-tint-${color}-${variant}`) }))] }) }));
|
|
116
125
|
});
|
|
117
126
|
Avatar.displayName = 'SuiAvatar';
|
|
118
127
|
|
package/Dialog.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { forwardRef, useMemo } from 'react';
|
|
3
3
|
import { motion } from 'framer-motion';
|
|
4
4
|
import kebabCase from 'lodash/kebabCase';
|
|
5
|
-
import { useEventCallback, useClasses } from '@ringcentral/spring-base';
|
|
5
|
+
import { useEventCallback, combineProps, useClasses } from '@ringcentral/spring-base';
|
|
6
6
|
import { Xsm } from '@ringcentral/spring-icon';
|
|
7
7
|
import { useThemeProps, useClassesWithMode, motionTransition } from '@ringcentral/spring-theme';
|
|
8
8
|
import './chunks/Icon.js';
|
|
@@ -22,11 +22,11 @@ import './chunks/PopperPaper.js';
|
|
|
22
22
|
import './chunks/useFocusTrapStack.js';
|
|
23
23
|
import './chunks/Backdrop.js';
|
|
24
24
|
|
|
25
|
-
var Dialog$1 = {"sui-dialog-body":"sui-dialog-body","sui-dialog-root":"sui-dialog-root","sui-dialog-small":"sui-dialog-small","sui-dialog-medium":"sui-dialog-medium","sui-dialog-large":"sui-dialog-large","sui-dialog-title-root":"sui-dialog-title-root","sui-dialog-content-root":"sui-dialog-content-root","sui-dialog-actions-root":"sui-dialog-actions-root","sui-dialog-right":"sui-dialog-right","sui-dialog-right-close-button":"sui-dialog-right-close-button","sui-dialog-left":"sui-dialog-left","sui-dialog-left-close-button":"sui-dialog-left-close-button","sui-dialog-full-height":"sui-dialog-full-height","sui-dialog-close-button":"sui-dialog-close-button","sui-dialog-full-screen":"sui-dialog-full-screen","sui-compact":"sui-compact"};
|
|
25
|
+
var Dialog$1 = {"sui-dialog-body":"sui-dialog-body","sui-dialog-root":"sui-dialog-root","sui-dialog-non-blocking":"sui-dialog-non-blocking","sui-dialog-small":"sui-dialog-small","sui-dialog-medium":"sui-dialog-medium","sui-dialog-large":"sui-dialog-large","sui-dialog-title-root":"sui-dialog-title-root","sui-dialog-content-root":"sui-dialog-content-root","sui-dialog-actions-root":"sui-dialog-actions-root","sui-dialog-right":"sui-dialog-right","sui-dialog-right-close-button":"sui-dialog-right-close-button","sui-dialog-left":"sui-dialog-left","sui-dialog-left-close-button":"sui-dialog-left-close-button","sui-dialog-full-height":"sui-dialog-full-height","sui-dialog-close-button":"sui-dialog-close-button","sui-dialog-full-screen":"sui-dialog-full-screen","sui-compact":"sui-compact"};
|
|
26
26
|
|
|
27
27
|
const Dialog = forwardRef((inProps, ref) => {
|
|
28
28
|
const props = useThemeProps({ props: inProps, name: 'Dialog' });
|
|
29
|
-
const { bodyProps, classes, className, children, size = 'medium', placement = 'right', open, onClose, ...rest } = props;
|
|
29
|
+
const { bodyProps, classes, className, children, size = 'medium', placement = 'right', open, onClose, blocking = true, CloseButtonProps, ...rest } = props;
|
|
30
30
|
const cls = useClassesWithMode('dialog', classes, className);
|
|
31
31
|
const toSize = useMemo(() => kebabCase(size), [size]);
|
|
32
32
|
const isFullHeight = size === 'fullHeight';
|
|
@@ -40,7 +40,19 @@ const Dialog = forwardRef((inProps, ref) => {
|
|
|
40
40
|
const handleCloseButtonClick = useEventCallback((e) => {
|
|
41
41
|
onClose?.(e, 'closeButtonClick');
|
|
42
42
|
});
|
|
43
|
-
|
|
43
|
+
const nonBlockingProps = !blocking
|
|
44
|
+
? {
|
|
45
|
+
disableScrollLock: true,
|
|
46
|
+
disableBackdropClick: true,
|
|
47
|
+
disableEscapeKeyDown: true,
|
|
48
|
+
hideBackdrop: true,
|
|
49
|
+
}
|
|
50
|
+
: {};
|
|
51
|
+
return (jsx(Modal, { open: open, onClose: onClose, blocking: blocking, ...nonBlockingProps, className: cls('root', { 'non-blocking': !blocking }), ...rest, children: jsxs(motion.div, { role: "dialog", "aria-modal": blocking, ...(isFullHeight && slideInProps), ...bodyProps, ref: ref, tabIndex: blocking ? -1 : undefined, className: cls('body', toSize, isFullHeight && placement), children: [children, isFullHeight && (jsx(IconButton, { size: 'large', color: 'secondary', symbol: Xsm, variant: "contained", ...combineProps({
|
|
52
|
+
className: cls('close-button', `${placement}-close-button`),
|
|
53
|
+
onClick: handleCloseButtonClick,
|
|
54
|
+
'aria-label': 'Close',
|
|
55
|
+
}, CloseButtonProps) }))] }) }));
|
|
44
56
|
});
|
|
45
57
|
Dialog.displayName = 'SuiDialog';
|
|
46
58
|
const DialogTitle = forwardRef(({ className, ...rest }, ref) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
3
4
|
import { useClasses, useId } from '@ringcentral/spring-base';
|
|
4
5
|
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
5
6
|
|
|
@@ -14,13 +15,14 @@ const LinearProgressIndicator = forwardRef((inProps, ref) => {
|
|
|
14
15
|
const cls = useClasses('linear-progress-indicator', classes, className);
|
|
15
16
|
const labelId = useId();
|
|
16
17
|
const progressBarProps = progressBarPropsProp || {};
|
|
18
|
+
const progressBarLabelledBy = progressBarProps['aria-labelledby'];
|
|
17
19
|
if (max === undefined || value === undefined)
|
|
18
20
|
return null;
|
|
19
|
-
const labelledBy = progressBarProps['aria-labelledby'] || labelId;
|
|
20
21
|
progressBarProps['aria-valuenow'] = value;
|
|
21
22
|
let labelNode = label;
|
|
22
23
|
if (typeof props.label === 'string') {
|
|
23
|
-
labelNode = (jsx("span", { id:
|
|
24
|
+
labelNode = (jsx("span", { id: progressBarLabelledBy || labelId, className: cls('label', `${variant}-label`), children: props.label }));
|
|
25
|
+
progressBarProps['aria-labelledby'] = progressBarLabelledBy || labelId;
|
|
24
26
|
}
|
|
25
27
|
let detailsNode = details;
|
|
26
28
|
if (typeof details === 'string') {
|
|
@@ -30,12 +32,11 @@ const LinearProgressIndicator = forwardRef((inProps, ref) => {
|
|
|
30
32
|
progressBarProps['aria-valuemin'] = min;
|
|
31
33
|
if (max !== 100)
|
|
32
34
|
progressBarProps['aria-valuemax'] = max;
|
|
33
|
-
if (labelNode)
|
|
34
|
-
progressBarProps['aria-labelledby'] = labelledBy;
|
|
35
35
|
const percentage = Math.round((100 / max) * value);
|
|
36
|
+
const { className: progressBarClassName, ...restProgressBarProps } = progressBarProps;
|
|
36
37
|
return (jsxs("span", { className: cls('root', variant, {
|
|
37
38
|
slim,
|
|
38
|
-
}), ...rest, ref: ref, children: [labelNode, jsx("span", { className: cls('track', `${variant}-track`, slim && `${variant}-track-slim`), role: "progressbar", ...
|
|
39
|
+
}), ...rest, ref: ref, children: [labelNode, jsx("span", { className: clsx(cls('track', `${variant}-track`, slim && `${variant}-track-slim`), progressBarClassName), role: "progressbar", ...restProgressBarProps, children: jsx("span", { className: cls('bar', `${variant}-bar`), style: {
|
|
39
40
|
width: `${percentage}%`,
|
|
40
41
|
} }) }), (!!detailsNode || showPercentage) && (jsxs("span", { className: cls('details-container', `${variant}-details-container`), children: [detailsNode, showPercentage && (jsxs("span", { className: cls('details-label', `${variant}-details-label`), children: [percentage, "%"] }))] }))] }));
|
|
41
42
|
});
|
package/Link.js
CHANGED
|
@@ -7,9 +7,9 @@ var Link$1 = {"sui-link-root":"sui-link-root","sui-focus-visible":"sui-focus-vis
|
|
|
7
7
|
|
|
8
8
|
const Link = forwardRef((inProps, ref) => {
|
|
9
9
|
const props = useThemeProps({ props: inProps, name: 'Link' });
|
|
10
|
-
const { classes, component: Component = 'a', className, underline = 'hover', children, variant = 'primary', ...rest } = props;
|
|
10
|
+
const { classes, component: Component = 'a', className, underline = 'hover', children, variant = 'primary', onBlur, onFocus, onFocusVisible, ...rest } = props;
|
|
11
11
|
const cls = useClasses('link', classes, className);
|
|
12
|
-
const { focusVisible, focusVisibleRef, focusVisibleHandlers } = useFocusVisible(
|
|
12
|
+
const { focusVisible, focusVisibleRef, focusVisibleHandlers } = useFocusVisible({ onFocusVisible, onFocus, onBlur });
|
|
13
13
|
const linkRef = useForkRef(ref, focusVisibleRef);
|
|
14
14
|
return (jsx(Component, { className: cls('root', variant, underline, { focusVisible }), ...rest, ...focusVisibleHandlers, ref: linkRef, children: children }));
|
|
15
15
|
});
|
package/Modal.js
CHANGED
|
@@ -11,6 +11,6 @@ import './chunks/getFade.js';
|
|
|
11
11
|
import './chunks/useFocusTrapStack.js';
|
|
12
12
|
import './chunks/Backdrop.js';
|
|
13
13
|
|
|
14
|
-
var Modal = {"sui-modal-root":"sui-modal-root"};
|
|
14
|
+
var Modal = {"sui-modal-root":"sui-modal-root","sui-modal-non-blocking":"sui-modal-non-blocking","sui-backdrop-root":"sui-backdrop-root"};
|
|
15
15
|
|
|
16
16
|
export { Modal as modalStyles };
|
package/Radio.js
CHANGED
|
@@ -10,14 +10,17 @@ var Radio$1 = {"sui-radio-root":"sui-radio-root","sui-focus-visible":"sui-focus-
|
|
|
10
10
|
|
|
11
11
|
const Radio = forwardRef((inProps, ref) => {
|
|
12
12
|
const props = useThemeProps({ props: inProps, name: 'Radio' });
|
|
13
|
-
const { name = '', classes, inputRef, rootProps, inputProps, className: rootClass, ...rest } = props;
|
|
13
|
+
const { name = '', classes, inputRef, rootProps, inputProps, disabled: disabledProp, className: rootClass, ...rest } = props;
|
|
14
14
|
const cls = useClasses('radio', classes, rootClass);
|
|
15
15
|
const { disabled, id, value } = useFormLabel({
|
|
16
16
|
value: rest.value,
|
|
17
17
|
id: inputProps?.id,
|
|
18
|
-
disabled:
|
|
18
|
+
disabled: disabledProp,
|
|
19
|
+
});
|
|
20
|
+
const { focusVisible, getInputProps, checked } = useSwitch({
|
|
21
|
+
...rest,
|
|
22
|
+
disabled,
|
|
19
23
|
});
|
|
20
|
-
const { focusVisible, getInputProps, checked } = useSwitch(rest);
|
|
21
24
|
const { onChange, ...inputRest } = getInputProps({
|
|
22
25
|
role: undefined,
|
|
23
26
|
...inputProps,
|
package/StepButton.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef, cloneElement } from 'react';
|
|
3
|
-
import { useButton } from '@
|
|
4
|
-
import { useClasses, isSuiElement, combineProps } from '@ringcentral/spring-base';
|
|
3
|
+
import { useClasses, useButton, isSuiElement, combineProps } from '@ringcentral/spring-base';
|
|
5
4
|
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
6
5
|
import { b as useStepperContext, u as useStepContext } from './chunks/StepperContext.js';
|
|
7
6
|
import { S as StepLabel } from './chunks/StepLabel.js';
|
|
@@ -34,7 +33,7 @@ const StepButton = forwardRef((inProps, ref) => {
|
|
|
34
33
|
active,
|
|
35
34
|
highlighted: activeStep && variant === 'outlined',
|
|
36
35
|
'hide-connector': !connector,
|
|
37
|
-
}), ...getRootProps(),
|
|
36
|
+
}), ...getRootProps(rest), ref: ref, children: child }));
|
|
38
37
|
});
|
|
39
38
|
StepButton.displayName = 'SuiStepButton';
|
|
40
39
|
|
package/StepContent.js
CHANGED
|
@@ -16,9 +16,7 @@ const StepContent = forwardRef((inProps, ref) => {
|
|
|
16
16
|
const cls = useClasses('step-content', classes, className);
|
|
17
17
|
const { orientation } = useStepperContext();
|
|
18
18
|
const { disabled, active, last, expanded: expandedProp, connector, id, } = useStepContext();
|
|
19
|
-
const
|
|
20
|
-
const collapsedTransition = useMotionSafeTransition(motionTransition['spring-01-slow']);
|
|
21
|
-
const collapsedHeightTransition = useMotionSafeTransition(motionTransition['haste-01-slow']);
|
|
19
|
+
const transition = useMotionSafeTransition(motionTransition['haste-01-fast']);
|
|
22
20
|
if (process.env.NODE_ENV !== 'production' && orientation !== 'vertical') {
|
|
23
21
|
logInDev({
|
|
24
22
|
scope: 'AvatarGroup',
|
|
@@ -31,16 +29,13 @@ const StepContent = forwardRef((inProps, ref) => {
|
|
|
31
29
|
const keepAlive = keepMounted && isEverShown;
|
|
32
30
|
const motionVariants = {
|
|
33
31
|
expanded: {
|
|
34
|
-
transition
|
|
32
|
+
transition,
|
|
35
33
|
opacity: 1,
|
|
36
34
|
height: 'auto',
|
|
37
35
|
paddingTop: 12,
|
|
38
36
|
},
|
|
39
37
|
collapsed: {
|
|
40
|
-
transition
|
|
41
|
-
...collapsedTransition,
|
|
42
|
-
height: collapsedHeightTransition,
|
|
43
|
-
},
|
|
38
|
+
transition,
|
|
44
39
|
opacity: 0,
|
|
45
40
|
height: 0,
|
|
46
41
|
paddingTop: 0,
|
package/SwipeableDrawer.js
CHANGED
|
@@ -48,6 +48,8 @@ const observerOptions = {
|
|
|
48
48
|
box: 'border-box',
|
|
49
49
|
};
|
|
50
50
|
function useElementSizeObserver(ref, { enabled, resizeSourceRef, }) {
|
|
51
|
+
const { externalWindow, globalThis } = useWindowContext();
|
|
52
|
+
const win = externalWindow ?? globalThis;
|
|
51
53
|
const [size, setSize] = useState(0);
|
|
52
54
|
const handleResize = useCallback((entries) => {
|
|
53
55
|
const entry = entries?.[0];
|
|
@@ -72,6 +74,8 @@ function useElementSizeObserver(ref, { enabled, resizeSourceRef, }) {
|
|
|
72
74
|
if (!enabled) {
|
|
73
75
|
return;
|
|
74
76
|
}
|
|
77
|
+
const rAF = win.requestAnimationFrame.bind(win);
|
|
78
|
+
const cAF = win.cancelAnimationFrame.bind(win);
|
|
75
79
|
let resizeObserver = null;
|
|
76
80
|
let rafId = 0;
|
|
77
81
|
let initialMeasurementRafId = 0;
|
|
@@ -81,7 +85,7 @@ function useElementSizeObserver(ref, { enabled, resizeSourceRef, }) {
|
|
|
81
85
|
return;
|
|
82
86
|
resizeObserver = new ResizeObserver(handleResize);
|
|
83
87
|
resizeObserver.observe(el, observerOptions);
|
|
84
|
-
initialMeasurementRafId =
|
|
88
|
+
initialMeasurementRafId = rAF(() => {
|
|
85
89
|
const initial = Math.max(el.scrollHeight, el.offsetHeight, el.getBoundingClientRect().height);
|
|
86
90
|
if (initial > 0) {
|
|
87
91
|
setSize(initial);
|
|
@@ -93,62 +97,65 @@ function useElementSizeObserver(ref, { enabled, resizeSourceRef, }) {
|
|
|
93
97
|
startObserving();
|
|
94
98
|
}
|
|
95
99
|
else {
|
|
96
|
-
rafId =
|
|
100
|
+
rafId = rAF(waitForElement);
|
|
97
101
|
}
|
|
98
102
|
};
|
|
99
103
|
if (ref.current) {
|
|
100
104
|
startObserving();
|
|
101
105
|
}
|
|
102
106
|
else {
|
|
103
|
-
rafId =
|
|
107
|
+
rafId = rAF(waitForElement);
|
|
104
108
|
}
|
|
105
109
|
return () => {
|
|
106
110
|
if (rafId)
|
|
107
|
-
|
|
111
|
+
cAF(rafId);
|
|
108
112
|
if (initialMeasurementRafId)
|
|
109
|
-
|
|
113
|
+
cAF(initialMeasurementRafId);
|
|
110
114
|
if (resizeObserver) {
|
|
111
115
|
resizeObserver.disconnect();
|
|
112
116
|
}
|
|
113
117
|
};
|
|
114
|
-
}, [ref, handleResize, enabled]);
|
|
118
|
+
}, [ref, handleResize, enabled, win]);
|
|
115
119
|
return enabled ? size : 0;
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
function useMaxHeight(registerReady) {
|
|
119
|
-
const { globalThis } = useWindowContext();
|
|
123
|
+
const { externalWindow, globalThis } = useWindowContext();
|
|
124
|
+
const win = externalWindow ?? globalThis;
|
|
120
125
|
const setReady = useMemo(() => {
|
|
121
126
|
return registerReady ? registerReady('maxHeight') : undefined;
|
|
122
127
|
}, [registerReady]);
|
|
123
|
-
const [maxHeight, setMaxHeight] = useState(() =>
|
|
128
|
+
const [maxHeight, setMaxHeight] = useState(() => win.innerHeight ?? 0);
|
|
124
129
|
const raf = useRef(0);
|
|
125
130
|
const maxReadyCalledRef = useRef(false);
|
|
126
131
|
useLayoutEffect(() => {
|
|
127
132
|
maxReadyCalledRef.current = false;
|
|
128
133
|
}, [setReady]);
|
|
129
134
|
useLayoutEffect(() => {
|
|
135
|
+
const rAF = win.requestAnimationFrame.bind(win);
|
|
136
|
+
const cAF = win.cancelAnimationFrame.bind(win);
|
|
130
137
|
const handleResize = () => {
|
|
131
138
|
if (raf.current) {
|
|
132
139
|
return;
|
|
133
140
|
}
|
|
134
|
-
raf.current =
|
|
141
|
+
raf.current = rAF(() => {
|
|
135
142
|
if (raf.current !== 0) {
|
|
136
|
-
setMaxHeight(
|
|
143
|
+
setMaxHeight(win.innerHeight);
|
|
137
144
|
raf.current = 0;
|
|
138
145
|
}
|
|
139
146
|
});
|
|
140
147
|
};
|
|
141
|
-
|
|
142
|
-
setMaxHeight(
|
|
148
|
+
win.addEventListener('resize', handleResize);
|
|
149
|
+
setMaxHeight(win.innerHeight);
|
|
143
150
|
if (setReady && !maxReadyCalledRef.current) {
|
|
144
151
|
maxReadyCalledRef.current = true;
|
|
145
152
|
setReady();
|
|
146
153
|
}
|
|
147
154
|
return () => {
|
|
148
|
-
|
|
149
|
-
|
|
155
|
+
win.removeEventListener('resize', handleResize);
|
|
156
|
+
cAF(raf.current);
|
|
150
157
|
};
|
|
151
|
-
}, [setReady,
|
|
158
|
+
}, [setReady, win]);
|
|
152
159
|
return maxHeight;
|
|
153
160
|
}
|
|
154
161
|
function usePreservedHeight(currentHeight) {
|
|
@@ -331,6 +338,8 @@ function defaultInitialSnap({ snapPoints, lastSnap: _lastSnap, }) {
|
|
|
331
338
|
}
|
|
332
339
|
function useDrawerGestures(options) {
|
|
333
340
|
const { anchor, open, onClose, snapPoints: getSnapPoints = defaultSnapPoints, initialSnap: getInitialSnap = defaultInitialSnap, contentRef, headerRef, footerRef, headerEnabled, footerEnabled, } = options;
|
|
341
|
+
const { externalWindow } = useWindowContext();
|
|
342
|
+
const gestureWindow = externalWindow;
|
|
334
343
|
const { ready, registerReady } = useReady();
|
|
335
344
|
const heightRef = useRef(0);
|
|
336
345
|
const lastSnapRef = useRef(null);
|
|
@@ -515,9 +524,13 @@ function useDrawerGestures(options) {
|
|
|
515
524
|
return memo;
|
|
516
525
|
});
|
|
517
526
|
const isVertical = anchor === 'top' || anchor === 'bottom';
|
|
518
|
-
const
|
|
527
|
+
const gestureConfig = useMemo(() => ({
|
|
519
528
|
filterTaps: true,
|
|
520
|
-
|
|
529
|
+
...(gestureWindow && {
|
|
530
|
+
window: gestureWindow,
|
|
531
|
+
}),
|
|
532
|
+
}), [gestureWindow]);
|
|
533
|
+
const bind = useDrag(handleDrag, gestureConfig);
|
|
521
534
|
const heightStyle = useTransform(heightMotionValue, (y) => {
|
|
522
535
|
const clamped = Math.max(0, Math.min(y, maxHeight));
|
|
523
536
|
return `${Math.round(clamped)}px`;
|
package/Switch.js
CHANGED
|
@@ -9,7 +9,7 @@ var Switch$1 = {"sui-switch-root":"sui-switch-root","sui-focus-visible":"sui-foc
|
|
|
9
9
|
|
|
10
10
|
const Switch = forwardRef((inProps, ref) => {
|
|
11
11
|
const props = useThemeProps({ props: inProps, name: 'Switch' });
|
|
12
|
-
const { classes, className, inputRef: inputRefProp, inputProps: inputPropsProp, checked: checkedProp, defaultChecked, disabled: disabledProp, autoFocus = false, onBlur, onChange, onFocus, onFocusVisible, required, ...rest } = props;
|
|
12
|
+
const { classes, className, inputRef: inputRefProp, inputProps: inputPropsProp, rootProps, checked: checkedProp, defaultChecked, disabled: disabledProp, autoFocus = false, onBlur, onChange, onFocus, onFocusVisible, required, ...rest } = props;
|
|
13
13
|
const cls = useClasses('switch', classes, className);
|
|
14
14
|
const { disabled, id } = useFormLabel({
|
|
15
15
|
disabled: disabledProp,
|
|
@@ -33,7 +33,7 @@ const Switch = forwardRef((inProps, ref) => {
|
|
|
33
33
|
inputRef.current?.focus();
|
|
34
34
|
}
|
|
35
35
|
}, []);
|
|
36
|
-
return (jsxs("span", { className: cls('root', { focusVisible }),
|
|
36
|
+
return (jsxs("span", { ...rootProps, ...rest, className: cls('root', { focusVisible }), ref: ref, children: [jsx("input", { ...inputProps, id: id, className: cls('input', { checked }), ref: forkRef }), jsx("span", { className: cls('track') }), jsx("span", { className: cls('dot') })] }));
|
|
37
37
|
});
|
|
38
38
|
Switch.displayName = 'SuiSwitch';
|
|
39
39
|
|
package/Tab.js
CHANGED
|
@@ -21,7 +21,7 @@ import './chunks/useFocusTrapStack.js';
|
|
|
21
21
|
import './chunks/Backdrop.js';
|
|
22
22
|
import './chunks/PopperPaper.js';
|
|
23
23
|
|
|
24
|
-
var Tab$1 = {"sui-tab-container":"sui-tab-container","sui-tab-pill-badge":"sui-tab-pill-badge","sui-tab-badge-root":"sui-tab-badge-root","sui-tab-root":"sui-tab-root","sui-selected":"sui-selected","sui-focus-visible":"sui-focus-visible","sui-tab-badge":"sui-tab-badge","sui-
|
|
24
|
+
var Tab$1 = {"sui-tab-container":"sui-tab-container","sui-tab-pill-badge":"sui-tab-pill-badge","sui-tab-badge-root":"sui-tab-badge-root","sui-tab-root":"sui-tab-root","sui-selected":"sui-selected","sui-focus-visible":"sui-focus-visible","sui-tab-badge":"sui-tab-badge","sui-tab-label":"sui-tab-label","sui-tab-label-container":"sui-tab-label-container","sui-tab-label-text":"sui-tab-label-text","sui-tab-label-badge-root":"sui-tab-label-badge-root","sui-tab-icon":"sui-tab-icon","sui-tab-icon-container":"sui-tab-icon-container","sui-tab-icon-pill":"sui-tab-icon-pill","sui-tab-icon-badge-root":"sui-tab-icon-badge-root","sui-tab-large":"sui-tab-large","sui-tab-pill":"sui-tab-pill","sui-tab-pill-small":"sui-tab-pill-small","sui-tab-label-pill-cobranding":"sui-tab-label-pill-cobranding","sui-tab-icon-pill-cobranding":"sui-tab-icon-pill-cobranding","sui-compact":"sui-compact"};
|
|
25
25
|
|
|
26
26
|
const Tab = forwardRef((inProps, ref) => {
|
|
27
27
|
const props = useThemeProps({ props: inProps, name: 'Tab' });
|
package/TableRow.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import { useButton } from '@
|
|
4
|
-
import { useClasses } from '@ringcentral/spring-base';
|
|
3
|
+
import { useClasses, useButton } from '@ringcentral/spring-base';
|
|
5
4
|
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
6
5
|
import { u as useTablelvl2Context } from './chunks/Tablelvl2Context.js';
|
|
7
6
|
|
|
@@ -21,7 +20,7 @@ const TableRow = forwardRef((inProps, ref) => {
|
|
|
21
20
|
rootElementName: TableRowRoot,
|
|
22
21
|
rootRef: ref,
|
|
23
22
|
});
|
|
24
|
-
const rootProps = getRootProps();
|
|
23
|
+
const rootProps = getRootProps(rest);
|
|
25
24
|
const role = roleProp ?? (TableRowRoot !== defaultComponent ? 'row' : undefined);
|
|
26
25
|
return (jsx(TableRowRoot, { className: cls('root', variant, {
|
|
27
26
|
hoverable,
|
package/Tabs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import React, { forwardRef, useState, useMemo, useRef, Children, isValidElement, cloneElement, useEffect, useLayoutEffect, useCallback } from 'react';
|
|
3
3
|
import { useTab, useTabsList, TabsListProvider } from '@mui/base';
|
|
4
|
-
import { useClasses, combineClasses, getTitle, useFontLoaded, useWindowContext, logInDev, usePrevious, useEventCallback, useOnReRender, useForkRef } from '@ringcentral/spring-base';
|
|
4
|
+
import { useClasses, combineClasses, getTitle, combineProps, useFontLoaded, useWindowContext, logInDev, usePrevious, useEventCallback, useOnReRender, useForkRef } from '@ringcentral/spring-base';
|
|
5
5
|
import { OverflowMd, CaretLeftMd, CaretRightMd } from '@ringcentral/spring-icon';
|
|
6
6
|
import { useMode, motionTransition, useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
|
|
7
7
|
import { B as Badge } from './chunks/Badge.js';
|
|
@@ -92,12 +92,11 @@ const TabMoreMenu = forwardRef((props, ref) => {
|
|
|
92
92
|
};
|
|
93
93
|
const handleClose = (event, reason) => {
|
|
94
94
|
setAnchor(null);
|
|
95
|
-
MenuProps?.onClose?.(event, reason);
|
|
96
95
|
};
|
|
97
96
|
const iconButton = (jsx(IconButton, { color: 'secondary', symbol: OverflowMd, ...iconButtonProps, onClick: (e) => {
|
|
98
97
|
setAnchor((prev) => (prev ? null : e.currentTarget));
|
|
99
98
|
}, "aria-expanded": Boolean(anchor), "aria-label": getTitle(TooltipProps?.title), ...ButtonProps, classes: iconButtonClasses }));
|
|
100
|
-
return (jsxs(Fragment, { children: [jsxs("div", { className: cls('root'), ref: ref, ...rest, children: [TooltipProps ? (jsx(Tooltip, { ...TooltipProps, children: iconButton })) : (iconButton), Number(BadgeProps?.count) > 0 ? jsx(Badge, { ...badgeProps }) : null] }), jsx(Menu, { open: Boolean(anchor), anchorEl: anchor, onClose: handleClose, children: jsx(MenuList, { children: menuItems.map(({ ref, ...props }, index) => (jsx(TabMenuItem, { ...props, ref: ref, component: MenuItemComponent }, props.value || `TabMenuItem-${index}`))) }) })] }));
|
|
99
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: cls('root'), ref: ref, ...rest, children: [TooltipProps ? (jsx(Tooltip, { ...TooltipProps, children: iconButton })) : (iconButton), Number(BadgeProps?.count) > 0 ? jsx(Badge, { ...badgeProps }) : null] }), jsx(Menu, { open: Boolean(anchor), anchorEl: anchor, ...combineProps({ onClose: handleClose }, MenuProps), children: jsx(MenuList, { children: menuItems.map(({ ref, ...props }, index) => (jsx(TabMenuItem, { ...props, ref: ref, component: MenuItemComponent }, props.value || `TabMenuItem-${index}`))) }) })] }));
|
|
101
100
|
});
|
|
102
101
|
TabMoreMenu.displayName = 'SuiTabMoreMenu';
|
|
103
102
|
|
package/Tooltip.js
CHANGED
|
@@ -18,6 +18,6 @@ import './chunks/useFocusTrapStack.js';
|
|
|
18
18
|
import './chunks/Backdrop.js';
|
|
19
19
|
import './chunks/PopperPaper.js';
|
|
20
20
|
|
|
21
|
-
var TooltipView = {"sui-tooltip-view-root":"sui-tooltip-view-root","sui-tooltip-view-disable-interactions":"sui-tooltip-view-disable-interactions","sui-tooltip-trigger-wrapper":"sui-tooltip-trigger-wrapper","sui-tooltip-view-paper":"sui-tooltip-view-paper","sui-tooltip-view-paper-content":"sui-tooltip-view-paper-content","sui-tooltip-view-paper-content-medium":"sui-tooltip-view-paper-content-medium","sui-tooltip-view-icon":"sui-tooltip-view-icon","sui-tooltip-view-content":"sui-tooltip-view-content","sui-tooltip-view-
|
|
21
|
+
var TooltipView = {"sui-tooltip-view-root":"sui-tooltip-view-root","sui-tooltip-view-disable-interactions":"sui-tooltip-view-disable-interactions","sui-tooltip-trigger-wrapper":"sui-tooltip-trigger-wrapper","sui-tooltip-view-paper":"sui-tooltip-view-paper","sui-tooltip-view-paper-content":"sui-tooltip-view-paper-content","sui-tooltip-view-paper-content-medium":"sui-tooltip-view-paper-content-medium","sui-tooltip-view-icon":"sui-tooltip-view-icon","sui-tooltip-view-content":"sui-tooltip-view-content","sui-tooltip-view-neutral":"sui-tooltip-view-neutral","sui-tooltip-view-success":"sui-tooltip-view-success","sui-tooltip-view-danger":"sui-tooltip-view-danger","sui-tooltip-view-inverted":"sui-tooltip-view-inverted","sui-tooltip-view-force-hide":"sui-tooltip-view-force-hide"};
|
|
22
22
|
|
|
23
23
|
export { TooltipView as tooltipViewStyle };
|
package/VirtualizedList.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext, useContext, forwardRef, isValidElement, useRef, useState, useImperativeHandle, useEffect } from 'react';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useForkRef,
|
|
3
|
+
import { useForkRef, useWindowContext, useVirtuosoExternalWindow, useEventCallback, logInDev } from '@ringcentral/spring-base';
|
|
4
4
|
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
5
5
|
import { Virtuoso } from 'react-virtuoso';
|
|
6
6
|
import { L as List } from './chunks/List.js';
|
|
@@ -85,6 +85,8 @@ const VirtualizedList = forwardRef((inProps, ref) => {
|
|
|
85
85
|
const handleVirtuosoRef = useForkRef(virtuosoRef, virtuosoActions);
|
|
86
86
|
const initialFocusItemByIndexPromiseRef = useRef(null);
|
|
87
87
|
const itemRenderedPromiseRef = useRef(null);
|
|
88
|
+
const { globalThis: contextWindow } = useWindowContext();
|
|
89
|
+
const externalWindowProps = useVirtuosoExternalWindow();
|
|
88
90
|
const isItemRendered = (index) => {
|
|
89
91
|
const { startIndex, endIndex } = listRangeRef.current;
|
|
90
92
|
return index <= endIndex && index >= startIndex;
|
|
@@ -94,7 +96,7 @@ const VirtualizedList = forwardRef((inProps, ref) => {
|
|
|
94
96
|
new Promise((resolve) => {
|
|
95
97
|
initialFocusItemByIndexPromiseRef.current = resolve;
|
|
96
98
|
}).then(() => {
|
|
97
|
-
requestAnimationFrame(() => focusByIndexAction(index));
|
|
99
|
+
contextWindow.requestAnimationFrame(() => focusByIndexAction(index));
|
|
98
100
|
});
|
|
99
101
|
}
|
|
100
102
|
else {
|
|
@@ -235,14 +237,7 @@ const VirtualizedList = forwardRef((inProps, ref) => {
|
|
|
235
237
|
itemContentRenderer: children,
|
|
236
238
|
computeItemKey: computeItemKey,
|
|
237
239
|
};
|
|
238
|
-
|
|
239
|
-
const externalProps = externalWindow &&
|
|
240
|
-
externalWindow !== (window || globalThis.window)
|
|
241
|
-
? {
|
|
242
|
-
externalWindow,
|
|
243
|
-
}
|
|
244
|
-
: undefined;
|
|
245
|
-
return (jsx(Virtuoso, { className: "sui-virtualized-list", ...externalProps, ref: handleVirtuosoRef, increaseViewportBy: 200, ...(computeItemKey ? { computeItemKey } : undefined), ...rest, context: { ...context, ...virtuosoContext }, components: { ...VirtuosoComponents, ...components }, totalCount: totalCount, data: data, rangeChanged: (range) => {
|
|
240
|
+
return (jsx(Virtuoso, { className: "sui-virtualized-list", ...externalWindowProps, ref: handleVirtuosoRef, increaseViewportBy: 200, ...(computeItemKey ? { computeItemKey } : undefined), ...rest, context: { ...context, ...virtuosoContext }, components: { ...VirtuosoComponents, ...components }, totalCount: totalCount, data: data, rangeChanged: (range) => {
|
|
246
241
|
listRangeRef.current = range;
|
|
247
242
|
const itemRenderedPromise = itemRenderedPromiseRef.current;
|
|
248
243
|
if (itemRenderedPromise) {
|
package/VirtualizedMenu.js
CHANGED
|
@@ -23,6 +23,6 @@ import './chunks/List.js';
|
|
|
23
23
|
import './chunks/useListNavigation.js';
|
|
24
24
|
import 'tabbable';
|
|
25
25
|
|
|
26
|
-
var VirtualizedMenu = {"sui-virtualized-menu-paper":"sui-virtualized-menu-paper","sui-virtualized-menu-paper-content-container":"sui-virtualized-menu-paper-content-container"};
|
|
26
|
+
var VirtualizedMenu = {"sui-virtualized-menu-paper":"sui-virtualized-menu-paper","sui-virtualized-menu-paper-content-container":"sui-virtualized-menu-paper-content-container","sui-virtualized-menu-list":"sui-virtualized-menu-list"};
|
|
27
27
|
|
|
28
28
|
export { VirtualizedMenu as virtualizedMenuStyle };
|
package/chunks/Button.js
CHANGED
|
@@ -81,7 +81,7 @@ const Button = withTooltip(forwardRef((inProps, ref) => {
|
|
|
81
81
|
disabled: disabledProp,
|
|
82
82
|
focusVisible,
|
|
83
83
|
loading,
|
|
84
|
-
}), title: title, ...rest, ...getRootProps(),
|
|
84
|
+
}), title: title, ...rest, ...getRootProps(), children: [startSlot, isTextContent ? (jsx("span", { className: cls('content'), children: children })) : (children), endSlot] }));
|
|
85
85
|
}));
|
|
86
86
|
Button.displayName = 'SuiButton';
|
|
87
87
|
|