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