@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.
- package/AccordionHeader.js +4 -2
- package/Animation.js +10 -9
- package/Autocomplete.js +5 -2
- package/BlockHeader.js +3 -1
- package/DatePicker.js +5 -3
- package/Dialer.js +36 -21
- package/Dialog.js +4 -3
- package/Dropdown.js +7 -4
- package/EmptyState.js +3 -1
- package/FormField.js +2 -0
- package/ListItemText.js +1 -0
- package/MenuHeader.js +1 -0
- package/MenuItem.js +2 -0
- package/MenuItemText.js +1 -0
- package/MenuList.js +2 -0
- package/Option.js +3 -1
- package/PickerTextField.js +2 -0
- package/Popper.js +28 -25
- package/Rating.js +2 -2
- package/Select.js +3 -0
- package/SingleFilter.js +2 -0
- package/Slider.js +3 -2
- package/SortableVirtualizedList.js +10 -10
- package/SplitButton.js +3 -0
- package/Squircle.js +2 -2
- package/StepContent.js +1 -1
- package/SubMenu.js +2 -0
- package/TableCell.js +1 -1
- package/TablePagination.js +2 -0
- package/Tabs.js +9 -5
- package/TextField.js +2 -0
- package/Textarea.js +2 -0
- package/TimePicker.js +3 -1
- package/TrayMenu.js +2 -0
- package/VirtualizedList.js +3 -2
- package/chunks/Alert.js +2 -2
- package/chunks/Badge.js +1 -1
- package/chunks/Drawer.js +3 -2
- package/chunks/MenuItemText.js +1 -0
- package/chunks/MenuList.js +2 -1
- package/chunks/Modal.js +2 -3
- 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 +3 -5
- package/chunks/composeEventHandlers.js +10 -0
- package/chunks/getSlideIn.js +2 -2
- package/chunks/useFocusTrapStack.js +3 -1
- package/chunks/useHelperTextId.js +4 -2
- package/chunks/useMenuItemSelect.js +34 -25
- package/index.css +205 -172
- package/index.js +3 -1
- package/internal/utils/index.d.ts +1 -0
- package/internal/utils/setRef.d.ts +1 -0
- package/package.json +8 -8
- 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/Autocomplete/SuggestionList/SuggestionList.d.ts +1 -1
- package/src/Autocomplete/useAutocomplete.d.ts +18 -18
- package/src/Autocomplete/useAutocompleteTag.d.ts +18 -18
- package/src/Badge/Badge.d.ts +2 -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/Dialer.d.ts +4 -2
- package/src/Dropdown/Dropdown.type.d.ts +2 -2
- package/src/InlineEditable/InlineEditable.type.d.ts +2 -1
- package/src/ListNavigation/useListNavigation.d.ts +3 -3
- package/src/MenuActions/MenuActions.d.ts +2 -2
- package/src/MenuItem/useMenuItem.d.ts +1 -1
- package/src/MenuItem/useVirtualizedMenuItem.d.ts +1 -1
- package/src/MenuList/MenuList.type.d.ts +1 -1
- package/src/NestedMenuContext/MenuOverlayGroupContext.d.ts +2 -2
- package/src/Popper/Popper.type.d.ts +10 -7
- package/src/Rating/utils.d.ts +3 -2
- package/src/Select/Select.type.d.ts +1 -1
- package/src/Slider/Slider.d.ts +2 -2
- package/src/Slider/SliderThumb.d.ts +2 -1
- package/src/Squircle/Squircle.d.ts +1 -1
- package/src/StatusIndicator/StatusIndicator.d.ts +2 -1
- package/src/SubMenu/PopperMenu.type.d.ts +4 -1
package/AccordionHeader.js
CHANGED
|
@@ -2,6 +2,8 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { useClasses, useFocusVisible, useForkRef, getTitle } from '@ringcentral/spring-base';
|
|
4
4
|
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
5
|
+
import { h as hasContent } from './chunks/hasContent.js';
|
|
6
|
+
import '@mui/utils';
|
|
5
7
|
import { u as useAccordionContext } from './chunks/AccordionContext.js';
|
|
6
8
|
import { E as ExpandCollapseCaret } from './chunks/ExpandCollapseCaret.js';
|
|
7
9
|
import 'framer-motion';
|
|
@@ -13,7 +15,7 @@ var AccordionHeader$1 = {"sui-accordion-header-root":"sui-accordion-header-root"
|
|
|
13
15
|
|
|
14
16
|
const AccordionHeader = forwardRef((inProps, ref) => {
|
|
15
17
|
const props = useThemeProps({ props: inProps, name: 'AccordionHeader' });
|
|
16
|
-
const { classes, className, children, onClick, secondarySlot, disabled, expandIcon = true, ExpandCollapseCaretProps, ...rest } = props;
|
|
18
|
+
const { classes, className, children, onClick, secondarySlot, disabled, expandIcon = true, ExpandCollapseCaretProps, id: idProp, 'aria-controls': ariaControlsProp, ...rest } = props;
|
|
17
19
|
const { id, ariaControls, expanded, toggle } = useAccordionContext();
|
|
18
20
|
const handleChange = (event) => {
|
|
19
21
|
if (toggle) {
|
|
@@ -26,7 +28,7 @@ const AccordionHeader = forwardRef((inProps, ref) => {
|
|
|
26
28
|
const cls = useClasses('accordion-header', classes, className);
|
|
27
29
|
const { focusVisible, focusVisibleRef, focusVisibleHandlers } = useFocusVisible(props);
|
|
28
30
|
const buttonRef = useForkRef(ref, focusVisibleRef);
|
|
29
|
-
return (jsxs("button", { className: cls('root', { focusVisible, disabled }), "aria-expanded": expanded, disabled: disabled, ...rest, id: id, "aria-controls": ariaControls, ref: buttonRef, onClick: handleChange, ...focusVisibleHandlers, children: [jsxs("span", { className: cls('content'), children: [jsx("span", { className: cls('primary-text'), title: getTitle(children), children: children }), secondarySlot && (jsx("span", { className: cls('secondary-slot'), children: secondarySlot }))] }), expandIcon && (jsx(ExpandCollapseCaret, { expanded: !!expanded, orientation: 'vertical', ...ExpandCollapseCaretProps }))] }));
|
|
31
|
+
return (jsxs("button", { className: cls('root', { focusVisible, disabled }), "aria-expanded": expanded, disabled: disabled, ...rest, type: "button", id: id ?? idProp, "aria-controls": ariaControls ?? ariaControlsProp, ref: buttonRef, onClick: handleChange, ...focusVisibleHandlers, children: [jsxs("span", { className: cls('content'), children: [jsx("span", { className: cls('primary-text'), title: getTitle(children), children: children }), hasContent(secondarySlot) && (jsx("span", { className: cls('secondary-slot'), children: secondarySlot }))] }), expandIcon && (jsx(ExpandCollapseCaret, { expanded: !!expanded, orientation: 'vertical', ...ExpandCollapseCaretProps }))] }));
|
|
30
32
|
});
|
|
31
33
|
AccordionHeader.displayName = 'SuiAccordionHeader';
|
|
32
34
|
|
package/Animation.js
CHANGED
|
@@ -29,16 +29,17 @@ const Fade = (props) => {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const Grow = (props) => {
|
|
32
|
-
const { toggle, toggleOffTransition, toggleOnTransition, children, transformOrigin, direction = 'both', ...rest } = props;
|
|
32
|
+
const { toggle, toggleOffTransition, toggleOnTransition, children, transformOrigin, direction = 'both', style, ...rest } = props;
|
|
33
33
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
const growProps = getGrow({
|
|
35
|
+
toggle,
|
|
36
|
+
direction,
|
|
37
|
+
prefersReducedMotion,
|
|
38
|
+
toggleOffTransition,
|
|
39
|
+
toggleOnTransition,
|
|
40
|
+
transformOrigin,
|
|
41
|
+
});
|
|
42
|
+
return (jsx(motion.div, { ...growProps, ...rest, style: { ...growProps.style, ...style }, children: children }));
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
var ShowHideEye = {"sui-show-hide-eye-root":"sui-show-hide-eye-root"};
|
package/Autocomplete.js
CHANGED
|
@@ -28,6 +28,8 @@ import './chunks/useFocusTrapStack.js';
|
|
|
28
28
|
import './chunks/Backdrop.js';
|
|
29
29
|
import './chunks/ShowHideEye.js';
|
|
30
30
|
import './chunks/useHelperTextId.js';
|
|
31
|
+
import './chunks/hasContent.js';
|
|
32
|
+
import '@mui/utils';
|
|
31
33
|
|
|
32
34
|
var SuggestionList$1 = {"sui-suggestion-list-root":"sui-suggestion-list-root","sui-suggestion-list-item":"sui-suggestion-list-item","sui-suggestion-list-readonly":"sui-suggestion-list-readonly","sui-disabled":"sui-disabled","sui-focus-visible":"sui-focus-visible","sui-suggestion-list-selected":"sui-suggestion-list-selected","sui-suggestion-list-highlighted":"sui-suggestion-list-highlighted","sui-suggestion-list-group-title-readonly":"sui-suggestion-list-group-title-readonly","sui-suggestion-list-expand-icon":"sui-suggestion-list-expand-icon","sui-compact":"sui-compact"};
|
|
33
35
|
|
|
@@ -1622,7 +1624,7 @@ const TextInput = forwardRef(({ renderInput, ...rest }, ref) => {
|
|
|
1622
1624
|
const Autocomplete = forwardRef((inProps, ref) => {
|
|
1623
1625
|
const props = useThemeProps({ props: inProps, name: 'Autocomplete' });
|
|
1624
1626
|
const isAutocomplete = props.variant === 'autocomplete';
|
|
1625
|
-
const { inputVariant = 'standard', variant, groupExpanded, onGroupExpanded, groupDefaultExpanded, groupVariant = 'normal', getExpandIconProps, groupBy, value: valueProp, autoHighlight = true, clearBtn = false, toggleButton = false, multiple = false, ClearButtonProps, onClear, ToggleButtonProps, getToggleButtonProps: getToggleButtonPropsProp, inputValue: inputValueProp, onKeyDown: onKeyDownProp, helperText: helperTextProp, options, openOnFocus = true, toggleWithInput = true, getOptionLabel = DEFAULT_GET_OPTION_LABEL, renderInput, label, inputRef: inputRefProp, error, placeholder, showPlaceholderWithTags, freeSolo, keyToTags = DEFAULT_KEY_TO_CHIPS, maxFreeSolo, SuggestionListProps: { virtualize = true, ...SuggestionListProps } = {}, autoSelect, PopperComponent = Popper, PopperProps: { anchorElType = 'root', ...PopperProps } = {}, initialIsOpen, disabled, required: requiredProp, disableCloseOnSelect = multiple, onChange: onChangeProp, onInputChange: onInputChangeProp, onMaxFreeSolo, FormHelperTextProps, action, filterOptions, renderOption, renderTags, getOptionDisabled, renderGroup, renderNoOptions, noOptionsText = 'No matches found', inputProps, debug, disabledItemsHighlightable, open: openProp, addNoOptionItem, onOpen, onClose, focused, classes, className, fullWidth = true, size = 'xlarge', isOptionEqualToValue, ...rest } = props;
|
|
1627
|
+
const { inputVariant = 'standard', variant, groupExpanded, onGroupExpanded, groupDefaultExpanded, groupVariant = 'normal', getExpandIconProps, groupBy, value: valueProp, autoHighlight = true, clearBtn = false, toggleButton = false, multiple = false, ClearButtonProps, onClear, ToggleButtonProps, getToggleButtonProps: getToggleButtonPropsProp, inputValue: inputValueProp, onKeyDown: onKeyDownProp, helperText: helperTextProp, options, openOnFocus = true, toggleWithInput = true, getOptionLabel = DEFAULT_GET_OPTION_LABEL, renderInput, label, inputRef: inputRefProp, error, placeholder, showPlaceholderWithTags, freeSolo, keyToTags = DEFAULT_KEY_TO_CHIPS, maxFreeSolo, SuggestionListProps: { virtualize = true, ...SuggestionListProps } = {}, autoSelect, PopperComponent = Popper, PopperProps: { anchorElType = 'root', children: _popperChildrenIgnored, ...PopperProps } = {}, initialIsOpen, disabled, required: requiredProp, disableCloseOnSelect = multiple, onChange: onChangeProp, onInputChange: onInputChangeProp, onMaxFreeSolo, FormHelperTextProps, action, filterOptions, renderOption, renderTags, getOptionDisabled, renderGroup, renderNoOptions, noOptionsText = 'No matches found', inputProps, debug, disabledItemsHighlightable, open: openProp, addNoOptionItem, onOpen, onClose, focused, classes, className, fullWidth = true, size = 'xlarge', isOptionEqualToValue, ...rest } = props;
|
|
1626
1628
|
const cls = useClasses('autocomplete', classes, className);
|
|
1627
1629
|
const innerInputRef = useRef(null);
|
|
1628
1630
|
const textFieldRef = useRef(null);
|
|
@@ -1674,6 +1676,7 @@ const Autocomplete = forwardRef((inProps, ref) => {
|
|
|
1674
1676
|
disabledItemsHighlightable,
|
|
1675
1677
|
onGroupExpanded,
|
|
1676
1678
|
isOptionEqualToValue,
|
|
1679
|
+
onClear,
|
|
1677
1680
|
});
|
|
1678
1681
|
const open = Boolean((isOpen || noOptionItem) && textFieldRef.current);
|
|
1679
1682
|
const { onBlur, ...InputProps } = getInputProps(inputProps);
|
|
@@ -1702,7 +1705,7 @@ const Autocomplete = forwardRef((inProps, ref) => {
|
|
|
1702
1705
|
return (jsx(Chip, { "aria-label": `${itemChipProps.label}, press Backspace to remove`, color: selectedItem.error ? 'error' : undefined, ...itemChipProps }, key));
|
|
1703
1706
|
});
|
|
1704
1707
|
})();
|
|
1705
|
-
const endAdornment = (toggleButton || clearBtn) && (jsxs(Fragment, { children: [clearBtn && (selectedItems.length > 0 || inputValue) && (jsx(IconButton, { shape: 'squircle', background: false, color: 'secondary', variant: "contained", size: "small", className: cls('clear')
|
|
1708
|
+
const endAdornment = (toggleButton || clearBtn) && (jsxs(Fragment, { children: [clearBtn && (selectedItems.length > 0 || inputValue) && (jsx(IconButton, { shape: 'squircle', background: false, color: 'secondary', variant: "contained", size: "small", symbol: Xsm, ...getClearButtonProps(combineProps({ className: cls('clear') }, ClearButtonProps)) })), toggleButton && (jsx(IconButton, { "aria-hidden": true, tabIndex: -1, shape: 'squircle', color: 'secondary', background: false, variant: "contained", size: "small", className: cls('chevron', error && 'error-chevron', open && `${inputVariant}-expanded-chevron`), children: jsx(ExpandCollapseCaret, { size: 'small', expanded: open }), ...getToggleButtonProps({
|
|
1706
1709
|
...ToggleButtonProps,
|
|
1707
1710
|
...getToggleButtonPropsProp?.(open),
|
|
1708
1711
|
}) }))] }));
|
package/BlockHeader.js
CHANGED
|
@@ -2,6 +2,8 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { useClasses } from '@ringcentral/spring-base';
|
|
4
4
|
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
5
|
+
import { h as hasContent } from './chunks/hasContent.js';
|
|
6
|
+
import '@mui/utils';
|
|
5
7
|
import { D as Divider } from './chunks/Divider.js';
|
|
6
8
|
|
|
7
9
|
var BlockHeader$1 = {"sui-block-header-root":"sui-block-header-root","sui-block-header-title":"sui-block-header-title","sui-block-header-end-slot":"sui-block-header-end-slot","sui-block-header-divider":"sui-block-header-divider"};
|
|
@@ -11,7 +13,7 @@ const BlockHeader = forwardRef((inProps, ref) => {
|
|
|
11
13
|
const { component: BlockHeaderRoot = 'div', classes, className, children, endSlot, divider = false, ...rest } = props;
|
|
12
14
|
const cls = useClasses('block-header', classes, className);
|
|
13
15
|
const title = typeof children === 'string' ? children : undefined;
|
|
14
|
-
return (jsxs(Fragment, { children: [jsxs(BlockHeaderRoot, { className: cls('root'), ...rest, ref: ref, children: [jsx("div", { title: title, className: cls('title'), children: children }), endSlot && jsx("div", { className: cls('end-slot'), children: endSlot })] }), divider && (jsx(Divider, { className: cls('divider'), orientation: "horizontal", flexItem: true }))] }));
|
|
16
|
+
return (jsxs(Fragment, { children: [jsxs(BlockHeaderRoot, { className: cls('root'), ...rest, ref: ref, children: [jsx("div", { title: title, className: cls('title'), children: children }), hasContent(endSlot) && (jsx("div", { className: cls('end-slot'), children: endSlot }))] }), divider && (jsx(Divider, { className: cls('divider'), orientation: "horizontal", flexItem: true }))] }));
|
|
15
17
|
});
|
|
16
18
|
BlockHeader.displayName = 'SuiBlockHeader';
|
|
17
19
|
|
package/DatePicker.js
CHANGED
|
@@ -30,6 +30,8 @@ import './chunks/Squircle.js';
|
|
|
30
30
|
import './chunks/Popover.js';
|
|
31
31
|
import './chunks/getGrow.js';
|
|
32
32
|
import './chunks/useHelperTextId.js';
|
|
33
|
+
import './chunks/hasContent.js';
|
|
34
|
+
import '@mui/utils';
|
|
33
35
|
import './chunks/TextField.js';
|
|
34
36
|
import './chunks/ShowHideEye.js';
|
|
35
37
|
import './chunks/VisuallyHidden.js';
|
|
@@ -41,7 +43,7 @@ const HeaderAction = (props) => {
|
|
|
41
43
|
const { className, disabled, ...rest } = props;
|
|
42
44
|
const cls = useDatePickerClasses();
|
|
43
45
|
const { focusVisible, focusVisibleRef, focusVisibleHandlers } = useFocusVisible();
|
|
44
|
-
return (jsx("button", { className: clsx(className, cls('header-action', { focusVisible, disabled })), ref: focusVisibleRef, ...rest, ...focusVisibleHandlers }));
|
|
46
|
+
return (jsx("button", { className: clsx(className, cls('header-action', { focusVisible, disabled })), ref: focusVisibleRef, ...rest, ...focusVisibleHandlers, type: "button" }));
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
const defaultScreenReaderProps = {
|
|
@@ -172,7 +174,7 @@ const Day = forwardRef((props, ref) => {
|
|
|
172
174
|
disabled,
|
|
173
175
|
today: current,
|
|
174
176
|
focused,
|
|
175
|
-
}), ...rest, ...combineProps({ onBlur, onFocus }, focusVisibleHandlers), children: children }));
|
|
177
|
+
}), ...rest, ...combineProps({ onBlur, onFocus }, focusVisibleHandlers), type: "button", children: children }));
|
|
176
178
|
});
|
|
177
179
|
Day.displayName = 'SuiDay';
|
|
178
180
|
|
|
@@ -187,7 +189,7 @@ const Year = forwardRef((props, ref) => {
|
|
|
187
189
|
selected,
|
|
188
190
|
disabled,
|
|
189
191
|
focusVisible,
|
|
190
|
-
}), "data-sui-picker-year": value, "aria-label": getYearAriaLabel?.(value, selected), ...rest, ...combineProps({ onBlur, onFocus }, focusVisibleHandlers), children: children }));
|
|
192
|
+
}), "data-sui-picker-year": value, "aria-label": getYearAriaLabel?.(value, selected), ...rest, ...combineProps({ onBlur, onFocus }, focusVisibleHandlers), type: "button", children: children }));
|
|
191
193
|
});
|
|
192
194
|
Year.displayName = 'SuiYear';
|
|
193
195
|
|
package/Dialer.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { createContext, useContext, cloneElement, useRef, useEffect, forwardRef, useCallback, useImperativeHandle, useLayoutEffect, useMemo } from 'react';
|
|
2
|
-
import { useLongPress, useForkRef, useWindowContext, useId, useClasses, useEventCallback, useAudio, logInDev, useOnlyOneFocusable, useKeyboardMoveFocus, globalStateClasses, getSelectionPosition, setSelectionPosition, useKeyDownOnce, useSleep
|
|
2
|
+
import { useLongPress, useForkRef, useWindowContext, useId, useClasses, useEventCallback, useAudio, logInDev, useOnlyOneFocusable, useKeyboardMoveFocus, globalStateClasses, combineProps, getSelectionPosition, setSelectionPosition, useKeyDownOnce, useSleep } from '@ringcentral/spring-base';
|
|
3
3
|
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
4
4
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
import { c as composeEventHandlers } from './chunks/composeEventHandlers.js';
|
|
6
|
+
import '@mui/utils';
|
|
5
7
|
import { V as VisuallyHidden } from './chunks/VisuallyHidden.js';
|
|
6
8
|
import { I as IconButton } from './chunks/IconButtonLabel.js';
|
|
7
9
|
import { DialButton1Lg, DialButton1Sm, DialButton2Lg, DialButton2Sm, DialButton3Lg, DialButton3Sm, DialButton4Lg, DialButton4Sm, DialButton5Lg, DialButton5Sm, DialButton6Lg, DialButton6Sm, DialButton7Lg, DialButton7Sm, DialButton8Lg, DialButton8Sm, DialButton9Lg, DialButton9Sm, AsteriskMd, DialButton0Lg, DialButton0Sm, HashMd } from '@ringcentral/spring-icon';
|
|
@@ -24,6 +26,7 @@ import './chunks/PopperPaper.js';
|
|
|
24
26
|
import './chunks/ShowHideEye.js';
|
|
25
27
|
import './chunks/useMotionSafeTransition.js';
|
|
26
28
|
import './chunks/useHelperTextId.js';
|
|
29
|
+
import './chunks/hasContent.js';
|
|
27
30
|
|
|
28
31
|
const DialerContext = createContext({});
|
|
29
32
|
const useDialerContext = () => useContext(DialerContext);
|
|
@@ -42,7 +45,7 @@ const DialDelete = (inProps) => {
|
|
|
42
45
|
onDeleteRef?.current?.(e, reason);
|
|
43
46
|
};
|
|
44
47
|
const { ref, ...events } = useLongPress({ onTap: handleDelete, onPress: handleClear }, children.props, { delay: holdTime, externalWindow: props.externalWindow });
|
|
45
|
-
const forkEleRef = useForkRef(children.
|
|
48
|
+
const forkEleRef = useForkRef(children.ref, ref);
|
|
46
49
|
return cloneElement(children, {
|
|
47
50
|
ref: forkEleRef,
|
|
48
51
|
...events,
|
|
@@ -156,10 +159,13 @@ const useKeyAudio = ({ sounds, processor }) => {
|
|
|
156
159
|
};
|
|
157
160
|
};
|
|
158
161
|
|
|
162
|
+
const MOVE_FOCUSED_ATTR_KEY = 'data-move-focused';
|
|
163
|
+
const DIAL_BUTTON_ATTR_KEY = 'data-dial-button';
|
|
159
164
|
const DialPad = forwardRef((inProps, ref) => {
|
|
160
165
|
const props = useThemeProps({ props: inProps, name: 'DialPad' });
|
|
161
166
|
const { size = 'large', sounds, autoSize, classes, onChange: onChangeProp, action, control, getDialPadButtonProps, sinkId, persistBgTime = 200, volume = 1, muted = false, longPressDelay = 1000, className, ...divProps } = props;
|
|
162
|
-
const { externalWindow } = useWindowContext();
|
|
167
|
+
const { externalWindow, globalThis: contextGlobal } = useWindowContext();
|
|
168
|
+
const contextWindow = externalWindow ?? contextGlobal;
|
|
163
169
|
const cls = useClasses('dial-pad', classes, className);
|
|
164
170
|
const containerRef = useRef(null);
|
|
165
171
|
const hiddenRef = useRef(null);
|
|
@@ -171,7 +177,6 @@ const DialPad = forwardRef((inProps, ref) => {
|
|
|
171
177
|
focusedIndexRef,
|
|
172
178
|
containerRef,
|
|
173
179
|
});
|
|
174
|
-
const dialButtonKey = `${moveFocusedId}-dial-button`;
|
|
175
180
|
const { onKeyFocusedIndexHandle } = useKeyboardMoveFocus({
|
|
176
181
|
options: DIALER_PAD_ICONS,
|
|
177
182
|
focusedIndexRef,
|
|
@@ -184,12 +189,13 @@ const DialPad = forwardRef((inProps, ref) => {
|
|
|
184
189
|
},
|
|
185
190
|
});
|
|
186
191
|
const audioProcessor = useCallback((audio) => {
|
|
192
|
+
const audioWithSinkId = audio;
|
|
187
193
|
if (typeof volume !== 'undefined')
|
|
188
194
|
audio.volume = volume;
|
|
189
195
|
if (typeof muted !== 'undefined')
|
|
190
196
|
audio.muted = muted;
|
|
191
|
-
if (typeof
|
|
192
|
-
|
|
197
|
+
if (typeof audioWithSinkId.setSinkId === 'function')
|
|
198
|
+
void audioWithSinkId.setSinkId(sinkId || '');
|
|
193
199
|
}, [muted, sinkId, volume]);
|
|
194
200
|
const play = useKeyAudio({
|
|
195
201
|
sounds,
|
|
@@ -197,13 +203,13 @@ const DialPad = forwardRef((inProps, ref) => {
|
|
|
197
203
|
});
|
|
198
204
|
const playAudio = useEventCallback((value) => {
|
|
199
205
|
const key = value === DIALER_PAD_PLUS ? '0' : value;
|
|
200
|
-
const keyButtonElm = containerRef.current?.querySelector(`[${
|
|
206
|
+
const keyButtonElm = containerRef.current?.querySelector(`[${MOVE_FOCUSED_ATTR_KEY}="${moveFocusedId}"][${DIAL_BUTTON_ATTR_KEY}="${key}"]`);
|
|
201
207
|
if (keyButtonElm) {
|
|
202
208
|
const oldTimer = keyTimerMapRef.current[key];
|
|
203
209
|
if (oldTimer)
|
|
204
|
-
clearTimeout(oldTimer);
|
|
210
|
+
contextWindow.clearTimeout(oldTimer);
|
|
205
211
|
keyButtonElm.classList.add(globalStateClasses.active);
|
|
206
|
-
keyTimerMapRef.current[key] =
|
|
212
|
+
keyTimerMapRef.current[key] = contextWindow.setTimeout(() => {
|
|
207
213
|
keyButtonElm.classList.remove(globalStateClasses.active);
|
|
208
214
|
delete keyTimerMapRef.current[key];
|
|
209
215
|
}, persistBgTime);
|
|
@@ -220,9 +226,10 @@ const DialPad = forwardRef((inProps, ref) => {
|
|
|
220
226
|
handleChange(value, 'customKeyboard');
|
|
221
227
|
const toIndex = ACCEPTABLE_KEYS.findIndex((x) => x === value);
|
|
222
228
|
focusedIndexRef.current = toIndex;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
229
|
+
const activeElement = externalWindow?.document.activeElement;
|
|
230
|
+
if (activeElement?.getAttribute(MOVE_FOCUSED_ATTR_KEY) ===
|
|
231
|
+
moveFocusedId &&
|
|
232
|
+
activeElement.getAttribute(DIAL_BUTTON_ATTR_KEY) !== null) {
|
|
226
233
|
hiddenRef.current?.focus();
|
|
227
234
|
}
|
|
228
235
|
}
|
|
@@ -237,9 +244,9 @@ const DialPad = forwardRef((inProps, ref) => {
|
|
|
237
244
|
]);
|
|
238
245
|
useEffect(() => () => {
|
|
239
246
|
for (const timer of Object.values(keyTimerMapRef.current)) {
|
|
240
|
-
clearTimeout(timer);
|
|
247
|
+
contextWindow.clearTimeout(timer);
|
|
241
248
|
}
|
|
242
|
-
}, []);
|
|
249
|
+
}, [contextWindow]);
|
|
243
250
|
return (jsxs("div", { ref: forkRef, className: cls('root', { 'auto-size': autoSize }), ...divProps, children: [jsx(VisuallyHidden, { ref: hiddenRef, tabIndex: -1 }), DIALER_PAD_ICONS.map(([lgIcon, smIcon, key, additionLabel], index) => {
|
|
244
251
|
const ariaLabelArr = additionLabel
|
|
245
252
|
? [key, additionLabel]
|
|
@@ -248,12 +255,18 @@ const DialPad = forwardRef((inProps, ref) => {
|
|
|
248
255
|
? 'medium'
|
|
249
256
|
: 'large';
|
|
250
257
|
const icon = size === 'large' ? lgIcon : smIcon;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
258
|
+
const itemProps = getItemProps(index);
|
|
259
|
+
const { onKeyDown: customOnKeyDown, ...customButtonProps } = getDialPadButtonProps?.(key) ?? {};
|
|
260
|
+
return (jsx(DialPadButton, { classes: classes, symbol: icon, value: key, onKeyEffect: handleKeyEffect, ...combineProps(itemProps, {
|
|
261
|
+
'aria-label': ariaLabelArr.join(', '),
|
|
262
|
+
...customButtonProps,
|
|
263
|
+
...(key === '0'
|
|
264
|
+
? {
|
|
265
|
+
longPressValue: DIALER_PAD_PLUS,
|
|
266
|
+
longPressDelay,
|
|
267
|
+
}
|
|
268
|
+
: {}),
|
|
269
|
+
}), [DIAL_BUTTON_ATTR_KEY]: key, onKeyDown: composeEventHandlers(customOnKeyDown, onKeyFocusedIndexHandle), tabIndex: itemProps.tabIndex, size: size === 'large' ? 'xxxlarge' : 'xxlarge', iconSize: iconSize }, key));
|
|
257
270
|
})] }));
|
|
258
271
|
});
|
|
259
272
|
DialPad.displayName = 'SuiDialPad';
|
|
@@ -342,7 +355,9 @@ const DialTextField = forwardRef((inProps, ref) => {
|
|
|
342
355
|
const forkInputRef = useForkRef(inputRefProp, forkContextRef);
|
|
343
356
|
const scrollToPositionRef = useRef();
|
|
344
357
|
const isNotTriggerRefocusRef = useRef(false);
|
|
345
|
-
const maxLength = keypadMode
|
|
358
|
+
const maxLength = keypadMode
|
|
359
|
+
? undefined
|
|
360
|
+
: (inputPropsProp?.maxLength ?? 30);
|
|
346
361
|
const checkNotReFocus = useEventCallback((reason, isFocus) => {
|
|
347
362
|
const elm = inputRef.current;
|
|
348
363
|
const isInputFocus = isFocus ?? externalWindow.document.activeElement === elm;
|
package/Dialog.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { motion } from 'framer-motion';
|
|
4
|
+
import clsx from 'clsx';
|
|
4
5
|
import kebabCase from 'lodash/kebabCase';
|
|
5
|
-
import { useEventCallback, combineProps, useClasses } from '@ringcentral/spring-base';
|
|
6
|
+
import { useEventCallback, useForkRef, combineProps, useClasses } from '@ringcentral/spring-base';
|
|
6
7
|
import { Xsm } from '@ringcentral/spring-icon';
|
|
7
8
|
import { useThemeProps, useClassesWithMode, motionTransition } from '@ringcentral/spring-theme';
|
|
8
9
|
import './chunks/Icon.js';
|
|
@@ -14,7 +15,6 @@ import '@mui/base';
|
|
|
14
15
|
import './chunks/Squircle.js';
|
|
15
16
|
import './chunks/withTooltip.js';
|
|
16
17
|
import './chunks/Tooltip.js';
|
|
17
|
-
import 'clsx';
|
|
18
18
|
import './chunks/getFade.js';
|
|
19
19
|
import './Popper.js';
|
|
20
20
|
import '@floating-ui/react-dom';
|
|
@@ -45,7 +45,8 @@ const Dialog = forwardRef((inProps, ref) => {
|
|
|
45
45
|
const handleCloseButtonClick = useEventCallback((e) => {
|
|
46
46
|
onClose?.(e, 'closeButtonClick');
|
|
47
47
|
});
|
|
48
|
-
|
|
48
|
+
const handleBodyRef = useForkRef(ref, bodyProps?.ref);
|
|
49
|
+
return (jsx(Modal, { open: open, onClose: onClose, blocking: blocking, className: cls('root', { 'non-blocking': !blocking }), ...rest, children: jsxs(motion.div, { role: "dialog", "aria-modal": blocking, ...(isFullHeight && slideInProps), ...bodyProps, ref: handleBodyRef, tabIndex: bodyProps?.tabIndex ?? (blocking ? -1 : undefined), className: clsx(cls('body', toSize, isFullHeight && placement), bodyProps?.className), children: [children, closeButtonClassName && (jsx(IconButton, { size: 'large', color: 'secondary', symbol: Xsm, variant: "contained", ...combineProps({
|
|
49
50
|
className: closeButtonClassName,
|
|
50
51
|
onClick: handleCloseButtonClick,
|
|
51
52
|
'aria-label': 'Close',
|
package/Dropdown.js
CHANGED
|
@@ -7,6 +7,7 @@ import 'framer-motion';
|
|
|
7
7
|
import './chunks/Icon.js';
|
|
8
8
|
import { M as Menu } from './chunks/Menu.js';
|
|
9
9
|
import { c as useMenuItemSelect, a as MenuItemSelectContext } from './chunks/useMenuItemSelect.js';
|
|
10
|
+
import '@mui/utils';
|
|
10
11
|
import 'tabbable';
|
|
11
12
|
import './chunks/useListNavigation.js';
|
|
12
13
|
import './VirtualizedList.js';
|
|
@@ -29,6 +30,7 @@ import './chunks/PopperPaper.js';
|
|
|
29
30
|
import '@ringcentral/spring-icon';
|
|
30
31
|
import './chunks/useAnimationFrame.js';
|
|
31
32
|
import './chunks/useNestedMenuItem.js';
|
|
33
|
+
import './chunks/composeEventHandlers.js';
|
|
32
34
|
import './ListNavigation.js';
|
|
33
35
|
import 'react-virtuoso';
|
|
34
36
|
import './chunks/List.js';
|
|
@@ -38,7 +40,7 @@ var Dropdown$1 = {"sui-dropdown-value":"sui-dropdown-value","sui-dropdown-chevro
|
|
|
38
40
|
|
|
39
41
|
const Dropdown = forwardRef((inProps, ref) => {
|
|
40
42
|
const props = useThemeProps({ props: inProps, name: 'Dropdown' });
|
|
41
|
-
const { classes, className, children, defaultOpen, open: openProp, onOpenChange, disabled, virtualize = true, MenuProps, rootProps, buttonProps: buttonPropsProp = {}, value: valueProp, defaultValue = null, onChange: onChangeProp, renderValue = String, placeholder, label, buttonRef, getSelectedIndex = (value) => {
|
|
43
|
+
const { classes, className, children, defaultOpen, open: openProp, onOpenChange, autoFocus = false, disabled, virtualize = true, MenuProps, rootProps, buttonProps: buttonPropsProp = {}, value: valueProp, defaultValue = null, onChange: onChangeProp, renderValue = String, placeholder, label, buttonRef, getSelectedIndex = (value) => {
|
|
42
44
|
return data.findIndex((v) => v === value);
|
|
43
45
|
}, data, } = props;
|
|
44
46
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -80,13 +82,14 @@ const Dropdown = forwardRef((inProps, ref) => {
|
|
|
80
82
|
});
|
|
81
83
|
const buttonProps = combineProps({
|
|
82
84
|
onClick: () => {
|
|
83
|
-
if (!open)
|
|
85
|
+
if (!disabled && !open)
|
|
84
86
|
handleOpen(true);
|
|
85
87
|
},
|
|
86
88
|
onKeyDown: (e) => {
|
|
87
89
|
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
88
90
|
e.preventDefault();
|
|
89
|
-
|
|
91
|
+
if (!disabled)
|
|
92
|
+
handleOpen(true);
|
|
90
93
|
}
|
|
91
94
|
},
|
|
92
95
|
}, buttonPropsProp);
|
|
@@ -119,7 +122,7 @@ const Dropdown = forwardRef((inProps, ref) => {
|
|
|
119
122
|
}), ref: ref, children: [label && (jsxs(Fragment, { children: [jsx("span", { className: cls('label'), children: label }), jsx("span", { className: cls('colon'), children: ":" })] })), jsxs("button", { className: cls('button', {
|
|
120
123
|
activated: open,
|
|
121
124
|
focusVisible,
|
|
122
|
-
}), ...buttonProps, ...focusVisibleHandlers, ref: handleButtonRef, children: [jsx("span", { className: cls('value'), children: value === null ? placeholder : renderValue(value) }), jsx(Squircle, { className: cls('chevron'), interactive: false, ref: chevronRef, children: jsx(ExpandCollapseCaret, { size: 'small', expanded: open }) })] })] }), anchorEl && menu] }));
|
|
125
|
+
}), ...buttonProps, ...focusVisibleHandlers, type: "button", autoFocus: autoFocus && !disabled, disabled: disabled, ref: handleButtonRef, children: [jsx("span", { className: cls('value'), children: value === null ? placeholder : renderValue(value) }), jsx(Squircle, { className: cls('chevron'), interactive: false, ref: chevronRef, children: jsx(ExpandCollapseCaret, { size: 'small', expanded: open }) })] })] }), anchorEl && menu] }));
|
|
123
126
|
});
|
|
124
127
|
Dropdown.displayName = 'SuiDropdown';
|
|
125
128
|
|
package/EmptyState.js
CHANGED
|
@@ -2,6 +2,8 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { useClasses, getTitle } from '@ringcentral/spring-base';
|
|
4
4
|
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
5
|
+
import { h as hasContent } from './chunks/hasContent.js';
|
|
6
|
+
import '@mui/utils';
|
|
5
7
|
import { I as Icon } from './chunks/Icon.js';
|
|
6
8
|
|
|
7
9
|
var EmptyState$1 = {"sui-empty-state-root":"sui-empty-state-root","sui-empty-state-icon":"sui-empty-state-icon","sui-empty-state-text-container":"sui-empty-state-text-container","sui-empty-state-title":"sui-empty-state-title","sui-empty-state-description":"sui-empty-state-description","sui-empty-state-actions":"sui-empty-state-actions"};
|
|
@@ -10,7 +12,7 @@ const EmptyState = forwardRef((inProps, ref) => {
|
|
|
10
12
|
const props = useThemeProps({ props: inProps, name: 'EmptyState' });
|
|
11
13
|
const { classes, className, title, description, icon, actions, ...rest } = props;
|
|
12
14
|
const cls = useClasses('empty-state', classes, className);
|
|
13
|
-
return (jsxs("div", { ...rest, className: cls('root'), children: [icon && (jsx("div", { className: cls('icon'), children: jsx(Icon, { size: "xxxlarge", symbol: icon }) })), (title || description) && (jsxs("div", { className: cls('text-container'), children: [title && (jsx("span", { className: cls('title'), title: getTitle(title), children: title })), description && (jsx("span", { className: cls('description'), title: getTitle(description), children: description }))] })), actions && actions.length > 0 && (jsx("div", { className: cls('actions'), children: actions }))] }));
|
|
15
|
+
return (jsxs("div", { ...rest, ref: ref, className: cls('root'), children: [icon && (jsx("div", { className: cls('icon'), children: jsx(Icon, { size: "xxxlarge", symbol: icon }) })), (hasContent(title) || hasContent(description)) && (jsxs("div", { className: cls('text-container'), children: [hasContent(title) && (jsx("span", { className: cls('title'), title: getTitle(title), children: title })), hasContent(description) && (jsx("span", { className: cls('description'), title: getTitle(description), children: description }))] })), actions && actions.length > 0 && (jsx("div", { className: cls('actions'), children: actions }))] }));
|
|
14
16
|
});
|
|
15
17
|
EmptyState.displayName = 'SuiEmptyState';
|
|
16
18
|
|
package/FormField.js
CHANGED
|
@@ -4,6 +4,8 @@ import 'react';
|
|
|
4
4
|
import 'clsx';
|
|
5
5
|
import '@ringcentral/spring-base';
|
|
6
6
|
import '@ringcentral/spring-theme';
|
|
7
|
+
import './chunks/hasContent.js';
|
|
8
|
+
import '@mui/utils';
|
|
7
9
|
|
|
8
10
|
var FormField = {"sui-form-field-label":"sui-form-field-label","sui-form-field-helper-text":"sui-form-field-helper-text","sui-form-field-content":"sui-form-field-content","sui-form-field-container":"sui-form-field-container","sui-form-field-focus-effect":"sui-form-field-focus-effect","sui-form-field-outlined":"sui-form-field-outlined","sui-form-field-contained":"sui-form-field-contained","sui-form-field-outlined-label":"sui-form-field-outlined-label","sui-form-field-contained-label":"sui-form-field-contained-label","sui-form-field-outlined-xlarge":"sui-form-field-outlined-xlarge","sui-form-field-contained-xlarge":"sui-form-field-contained-xlarge","sui-form-field-outlined-large":"sui-form-field-outlined-large","sui-form-field-contained-large":"sui-form-field-contained-large","sui-form-field-outlined-medium":"sui-form-field-outlined-medium","sui-form-field-contained-medium":"sui-form-field-contained-medium","sui-form-field-outlined-content":"sui-form-field-outlined-content","sui-form-field-contained-content":"sui-form-field-contained-content","sui-disabled":"sui-disabled","sui-focused":"sui-focused","sui-form-field-standard-content":"sui-form-field-standard-content","sui-form-field-standard-focus-effect":"sui-form-field-standard-focus-effect","sui-form-field-standard":"sui-form-field-standard","sui-form-field-quiet-content":"sui-form-field-quiet-content","sui-form-field-xlarge-content":"sui-form-field-xlarge-content","sui-form-field-large-content":"sui-form-field-large-content","sui-form-field-medium-content":"sui-form-field-medium-content","sui-form-field-error-helper-text":"sui-form-field-error-helper-text","sui-form-field-error-label":"sui-form-field-error-label","sui-form-field-error-focus-effect":"sui-form-field-error-focus-effect","sui-form-field-error-content":"sui-form-field-error-content","sui-form-field-error-standard-content":"sui-form-field-error-standard-content","sui-form-field-error-contained-content":"sui-form-field-error-contained-content","sui-form-field":"sui-form-field"};
|
|
9
11
|
|
package/ListItemText.js
CHANGED
|
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import { useClasses } from '@ringcentral/spring-base';
|
|
4
4
|
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
5
5
|
import { h as hasContent } from './chunks/hasContent.js';
|
|
6
|
+
import '@mui/utils';
|
|
6
7
|
|
|
7
8
|
var ListItemText$1 = {"sui-list-item-text-root":"sui-list-item-text-root","sui-list-item-text-primary-text":"sui-list-item-text-primary-text","sui-list-item-text-secondary-text":"sui-list-item-text-secondary-text","sui-list-item-text-primary":"sui-list-item-text-primary","sui-list-item-text-primary-primary-text":"sui-list-item-text-primary-primary-text","sui-list-item-text-secondary":"sui-list-item-text-secondary","sui-list-item-text-secondary-primary-text":"sui-list-item-text-secondary-primary-text"};
|
|
8
9
|
|
package/MenuHeader.js
CHANGED
|
@@ -2,6 +2,7 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
|
|
4
4
|
import { h as hasContent } from './chunks/hasContent.js';
|
|
5
|
+
import '@mui/utils';
|
|
5
6
|
import { M as MenuDivider } from './chunks/MenuDivider.js';
|
|
6
7
|
import './chunks/Divider.js';
|
|
7
8
|
import '@ringcentral/spring-base';
|
package/MenuItem.js
CHANGED
|
@@ -13,6 +13,8 @@ import 'react-virtuoso';
|
|
|
13
13
|
import './chunks/List.js';
|
|
14
14
|
import './chunks/useListNavigation.js';
|
|
15
15
|
import 'tabbable';
|
|
16
|
+
import './chunks/composeEventHandlers.js';
|
|
17
|
+
import '@mui/utils';
|
|
16
18
|
import './ListNavigation.js';
|
|
17
19
|
import './chunks/Menu.js';
|
|
18
20
|
import './chunks/Popover.js';
|
package/MenuItemText.js
CHANGED
|
@@ -4,6 +4,7 @@ import 'react';
|
|
|
4
4
|
import '@ringcentral/spring-base';
|
|
5
5
|
import '@ringcentral/spring-theme';
|
|
6
6
|
import './chunks/hasContent.js';
|
|
7
|
+
import '@mui/utils';
|
|
7
8
|
|
|
8
9
|
var MenuItemText = {"sui-menu-item-text-root":"sui-menu-item-text-root","sui-menu-item-text-primary-text":"sui-menu-item-text-primary-text","sui-menu-item-text-info-text":"sui-menu-item-text-info-text","sui-compact":"sui-compact"};
|
|
9
10
|
|
package/MenuList.js
CHANGED
|
@@ -22,11 +22,13 @@ import './chunks/useFocusTrapStack.js';
|
|
|
22
22
|
import './chunks/Backdrop.js';
|
|
23
23
|
import './Popper.js';
|
|
24
24
|
import './chunks/PopperPaper.js';
|
|
25
|
+
import '@mui/utils';
|
|
25
26
|
import './VirtualizedList.js';
|
|
26
27
|
import 'react-virtuoso';
|
|
27
28
|
import './chunks/useAnimationFrame.js';
|
|
28
29
|
import '@ringcentral/spring-icon';
|
|
29
30
|
import './chunks/useNestedMenuItem.js';
|
|
31
|
+
import './chunks/composeEventHandlers.js';
|
|
30
32
|
import './ListNavigation.js';
|
|
31
33
|
|
|
32
34
|
var MenuList = {"sui-menu-list-root":"sui-menu-list-root"};
|
package/Option.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { useThemeProps } from '@ringcentral/spring-theme';
|
|
4
|
-
import {
|
|
4
|
+
import { c as composeEventHandlers } from './chunks/composeEventHandlers.js';
|
|
5
|
+
import '@mui/utils';
|
|
6
|
+
import { u as useMenuItemSelectContext, M as MenuItem } from './chunks/useMenuItemSelect.js';
|
|
5
7
|
import '@ringcentral/spring-base';
|
|
6
8
|
import 'tabbable';
|
|
7
9
|
import './chunks/useListNavigation.js';
|
package/PickerTextField.js
CHANGED
|
@@ -18,6 +18,8 @@ import './Popper.js';
|
|
|
18
18
|
import './chunks/PopperPaper.js';
|
|
19
19
|
import './chunks/useHelperTextId.js';
|
|
20
20
|
import 'clsx';
|
|
21
|
+
import './chunks/hasContent.js';
|
|
22
|
+
import '@mui/utils';
|
|
21
23
|
import './chunks/TextField.js';
|
|
22
24
|
import '@ringcentral/spring-icon';
|
|
23
25
|
import './chunks/ShowHideEye.js';
|
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
|
}
|