@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/BottomNavigation.js
CHANGED
|
@@ -1,115 +1,145 @@
|
|
|
1
|
-
import { jsx, jsxs } from
|
|
2
|
-
import { forwardRef,
|
|
3
|
-
import {
|
|
4
|
-
import { tabbable } from
|
|
5
|
-
import {
|
|
6
|
-
import { OverflowMd } from
|
|
7
|
-
import {
|
|
8
|
-
import { ClickAwayListener } from
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const BottomNavigationGroup = forwardRef((props, ref) => {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
4
|
+
import { tabbable } from "tabbable";
|
|
5
|
+
import { combineProps, getTitle, logInDev, useClasses, useControlled, useEventCallback, useTabOut } from "@ringcentral/spring-base";
|
|
6
|
+
import { OverflowMd } from "@ringcentral/spring-icon";
|
|
7
|
+
import { motionTransition, useThemeProps } from "@ringcentral/spring-theme";
|
|
8
|
+
import { ClickAwayListener } from "@mui/base";
|
|
9
|
+
import { BottomNavigationItem as BottomNavigationItem_BottomNavigationItem, BottomNavigationContext } from "./BottomNavigationItem.js";
|
|
10
|
+
import "./Squircle.js";
|
|
11
|
+
import "./chunks/4476.js";
|
|
12
|
+
import { useMotionSafeTransition } from "./chunks/1294.js";
|
|
13
|
+
import { Squircle as Squircle_Squircle } from "./chunks/1250.js";
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// extracted by css-extract-rspack-plugin
|
|
27
|
+
/* export default */ var BottomNavigationGroup = ({"sui-bottom-navigation-group-root":"sui-bottom-navigation-group-root"});
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const BottomNavigationGroup_BottomNavigationGroup = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
34
33
|
const { classes, className, children, ...rest } = props;
|
|
35
34
|
const cls = useClasses('bottom-navigation-group', classes, className);
|
|
36
|
-
return
|
|
35
|
+
return /*#__PURE__*/ jsx("div", {
|
|
36
|
+
className: cls('root'),
|
|
37
|
+
...rest,
|
|
38
|
+
ref: ref,
|
|
39
|
+
children: children
|
|
40
|
+
});
|
|
37
41
|
});
|
|
38
|
-
|
|
42
|
+
BottomNavigationGroup_BottomNavigationGroup.displayName = 'SuiBottomNavigationGroup';
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// extracted by css-extract-rspack-plugin
|
|
50
|
+
/* export default */ var BottomNavigation = ({"sui-bottom-navigation-root":"sui-bottom-navigation-root","sui-bottom-navigation-full-width":"sui-bottom-navigation-full-width","sui-bottom-navigation-item-wrapper":"sui-bottom-navigation-item-wrapper","sui-bottom-navigation-description":"sui-bottom-navigation-description","sui-bottom-navigation-empty-slot":"sui-bottom-navigation-empty-slot","sui-expanded":"sui-expanded"});
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
39
63
|
|
|
40
|
-
var BottomNavigation$1 = {"sui-bottom-navigation-root":"sui-bottom-navigation-root","sui-bottom-navigation-full-width":"sui-bottom-navigation-full-width","sui-bottom-navigation-item-wrapper":"sui-bottom-navigation-item-wrapper","sui-bottom-navigation-description":"sui-bottom-navigation-description","sui-bottom-navigation-empty-slot":"sui-bottom-navigation-empty-slot","sui-expanded":"sui-expanded"};
|
|
41
64
|
|
|
42
65
|
const ROW_HEIGHT = 56;
|
|
43
|
-
const
|
|
44
|
-
const props = useThemeProps({
|
|
66
|
+
const BottomNavigation_BottomNavigation = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
67
|
+
const props = useThemeProps({
|
|
68
|
+
props: inProps,
|
|
69
|
+
name: 'BottomNavigation'
|
|
70
|
+
});
|
|
45
71
|
const { classes, className, children, defaultValue, value: valueProp, defaultData, data: dataProp, onChange, renderItem, MoreProps, description, onTouchEnd, onClick, onKeyDown, onKeyUp, onBlur, onCollapse, fullWidth, ...rest } = props;
|
|
46
72
|
const [value, setValue] = useControlled({
|
|
47
73
|
controlled: valueProp,
|
|
48
74
|
default: defaultValue,
|
|
49
75
|
name: 'SuiBottomNavigation',
|
|
50
|
-
state: 'value'
|
|
76
|
+
state: 'value'
|
|
51
77
|
});
|
|
78
|
+
// TODO: setData will be used when dnd is implemented
|
|
79
|
+
// oxlint-disable-next-line @typescript-eslint/no-unused-vars
|
|
52
80
|
const [data, setData] = useControlled({
|
|
53
81
|
controlled: dataProp,
|
|
54
82
|
default: defaultData,
|
|
55
83
|
name: 'SuiBottomNavigation',
|
|
56
|
-
state: 'data'
|
|
84
|
+
state: 'data'
|
|
57
85
|
});
|
|
58
86
|
const { visible, more } = data;
|
|
59
87
|
const VISIBLE_MAX_COUNT = more?.length ? 5 : 6;
|
|
60
|
-
if (process.env.NODE_ENV !== 'production' &&
|
|
61
|
-
visible.length > VISIBLE_MAX_COUNT) {
|
|
88
|
+
if (process.env.NODE_ENV !== 'production' && visible.length > VISIBLE_MAX_COUNT) {
|
|
62
89
|
logInDev({
|
|
63
90
|
scope: 'BottomNavigation',
|
|
64
91
|
message: `You can not have more than ${VISIBLE_MAX_COUNT} visible items.`,
|
|
65
|
-
level: 'warn'
|
|
92
|
+
level: 'warn'
|
|
66
93
|
});
|
|
67
94
|
}
|
|
68
95
|
const emptySlots = VISIBLE_MAX_COUNT - visible.length;
|
|
69
96
|
const cls = useClasses('bottom-navigation', classes, className);
|
|
70
97
|
const [expanded, setExpanded] = useState(false);
|
|
71
98
|
const [animationComplete, setAnimationComplete] = useState();
|
|
72
|
-
const transition = useMotionSafeTransition(motionTransition[
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
99
|
+
const transition = useMotionSafeTransition(motionTransition["haste-01-fast"]);
|
|
100
|
+
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
|
+
const handleClose = (e, reason)=>{
|
|
102
|
+
if (!expanded) return;
|
|
76
103
|
setExpanded(false);
|
|
77
104
|
onCollapse?.(e, reason);
|
|
78
105
|
};
|
|
79
|
-
const onSelected = useEventCallback((e, newValue)
|
|
106
|
+
const onSelected = useEventCallback((e, newValue)=>{
|
|
80
107
|
handleClose(e, 'ItemSelected');
|
|
81
108
|
setValue(newValue);
|
|
82
109
|
if (onChange) {
|
|
83
110
|
onChange(e, newValue);
|
|
84
111
|
}
|
|
85
112
|
});
|
|
86
|
-
const contextValue = useMemo(()
|
|
113
|
+
const contextValue = useMemo(()=>{
|
|
87
114
|
return {
|
|
88
115
|
value,
|
|
89
116
|
expanded,
|
|
90
117
|
onSelected,
|
|
91
|
-
animationComplete
|
|
118
|
+
animationComplete
|
|
92
119
|
};
|
|
93
|
-
}, [
|
|
94
|
-
|
|
120
|
+
}, [
|
|
121
|
+
expanded,
|
|
122
|
+
onSelected,
|
|
123
|
+
animationComplete,
|
|
124
|
+
value
|
|
125
|
+
]);
|
|
126
|
+
const handleMoreClick = (e)=>{
|
|
95
127
|
if (expanded) {
|
|
96
128
|
handleClose(e, 'ToggleMore');
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
129
|
+
} else {
|
|
99
130
|
setExpanded(true);
|
|
100
131
|
}
|
|
101
132
|
MoreProps?.onClick?.(e);
|
|
102
133
|
};
|
|
103
134
|
const descriptionTitle = getTitle(description);
|
|
104
|
-
const handleClickAway = useEventCallback((e)
|
|
105
|
-
if (!expanded)
|
|
106
|
-
return;
|
|
135
|
+
const handleClickAway = useEventCallback((e)=>{
|
|
136
|
+
if (!expanded) return;
|
|
107
137
|
handleClose(e, 'ClickAway');
|
|
108
138
|
});
|
|
109
|
-
const { tabOutHandler } = useTabOut((e)
|
|
139
|
+
const { tabOutHandler } = useTabOut((e)=>{
|
|
110
140
|
handleClose(e, 'TabBlur');
|
|
111
141
|
});
|
|
112
|
-
const handleKeyDown = (e)
|
|
142
|
+
const handleKeyDown = (e)=>{
|
|
113
143
|
if (e.key === 'Escape') {
|
|
114
144
|
handleClose(e, 'EscapeKeyDown');
|
|
115
145
|
}
|
|
@@ -118,11 +148,11 @@ const BottomNavigation = forwardRef((inProps, ref) => {
|
|
|
118
148
|
const tabOutProps = combineProps(tabOutHandler, {
|
|
119
149
|
onKeyDown: handleKeyDown,
|
|
120
150
|
onKeyUp,
|
|
121
|
-
onBlur
|
|
151
|
+
onBlur
|
|
122
152
|
});
|
|
123
153
|
const moreGroupRef = useRef(null);
|
|
124
154
|
const moreButtonRef = useRef(null);
|
|
125
|
-
const handleAnimationComplete = ()
|
|
155
|
+
const handleAnimationComplete = ()=>{
|
|
126
156
|
setAnimationComplete(true);
|
|
127
157
|
if (expanded && moreGroupRef.current) {
|
|
128
158
|
const allTabbable = tabbable(moreGroupRef.current);
|
|
@@ -133,10 +163,96 @@ const BottomNavigation = forwardRef((inProps, ref) => {
|
|
|
133
163
|
}
|
|
134
164
|
};
|
|
135
165
|
const itemWrapperClassName = cls('item-wrapper');
|
|
136
|
-
return
|
|
166
|
+
return /*#__PURE__*/ jsx(ClickAwayListener, {
|
|
167
|
+
onClickAway: handleClickAway,
|
|
168
|
+
children: /*#__PURE__*/ jsx(motion.div, {
|
|
169
|
+
transition: transition,
|
|
170
|
+
onAnimationStart: ()=>{
|
|
137
171
|
setAnimationComplete(false);
|
|
138
|
-
},
|
|
172
|
+
},
|
|
173
|
+
onAnimationComplete: handleAnimationComplete,
|
|
174
|
+
initial: false,
|
|
175
|
+
animate: expanded ? {
|
|
176
|
+
height: 'auto'
|
|
177
|
+
} : {
|
|
178
|
+
height: ROW_HEIGHT
|
|
179
|
+
},
|
|
180
|
+
className: cls('root', {
|
|
181
|
+
expanded,
|
|
182
|
+
'full-width': fullWidth
|
|
183
|
+
}),
|
|
184
|
+
...rest,
|
|
185
|
+
...tabOutProps,
|
|
186
|
+
onClick: onClick,
|
|
187
|
+
onTouchEnd: onTouchEnd,
|
|
188
|
+
ref: ref,
|
|
189
|
+
children: /*#__PURE__*/ jsxs(BottomNavigationContext.Provider, {
|
|
190
|
+
value: contextValue,
|
|
191
|
+
children: [
|
|
192
|
+
/*#__PURE__*/ jsxs(BottomNavigationGroup_BottomNavigationGroup, {
|
|
193
|
+
children: [
|
|
194
|
+
visible.slice(0, VISIBLE_MAX_COUNT).map((item)=>/*#__PURE__*/ jsx("span", {
|
|
195
|
+
className: itemWrapperClassName,
|
|
196
|
+
children: renderItem(item)
|
|
197
|
+
}, item)),
|
|
198
|
+
[
|
|
199
|
+
...Array(emptySlots > 0 ? emptySlots : 0)
|
|
200
|
+
].map((e, i)=>/*#__PURE__*/ jsx("span", {
|
|
201
|
+
className: itemWrapperClassName,
|
|
202
|
+
children: /*#__PURE__*/ jsx(Squircle_Squircle, {
|
|
203
|
+
interactive: false,
|
|
204
|
+
className: cls('empty-slot', {
|
|
205
|
+
expanded
|
|
206
|
+
})
|
|
207
|
+
})
|
|
208
|
+
}, 'bottom-navigation-slot-' + i)),
|
|
209
|
+
more?.length ? /*#__PURE__*/ jsx("span", {
|
|
210
|
+
className: itemWrapperClassName,
|
|
211
|
+
children: /*#__PURE__*/ jsx(BottomNavigationItem_BottomNavigationItem, {
|
|
212
|
+
symbol: OverflowMd,
|
|
213
|
+
activated: expanded,
|
|
214
|
+
expanded: false,
|
|
215
|
+
ButtonProps: {
|
|
216
|
+
'aria-expanded': expanded
|
|
217
|
+
},
|
|
218
|
+
...MoreProps,
|
|
219
|
+
count: expanded ? 0 : MoreProps?.count,
|
|
220
|
+
onClick: handleMoreClick,
|
|
221
|
+
ref: moreButtonRef
|
|
222
|
+
})
|
|
223
|
+
}) : null
|
|
224
|
+
]
|
|
225
|
+
}),
|
|
226
|
+
/*#__PURE__*/ jsxs(AnimatePresence, {
|
|
227
|
+
children: [
|
|
228
|
+
expanded && more?.length ? /*#__PURE__*/ jsx(BottomNavigationGroup_BottomNavigationGroup, {
|
|
229
|
+
ref: moreGroupRef,
|
|
230
|
+
children: more.map((item)=>/*#__PURE__*/ jsx("span", {
|
|
231
|
+
title: item,
|
|
232
|
+
className: itemWrapperClassName,
|
|
233
|
+
children: renderItem(item)
|
|
234
|
+
}, item))
|
|
235
|
+
}, "more") : null,
|
|
236
|
+
expanded && description && /*#__PURE__*/ jsx("div", {
|
|
237
|
+
className: cls('description'),
|
|
238
|
+
title: descriptionTitle,
|
|
239
|
+
children: description
|
|
240
|
+
})
|
|
241
|
+
]
|
|
242
|
+
})
|
|
243
|
+
]
|
|
244
|
+
})
|
|
245
|
+
})
|
|
246
|
+
});
|
|
139
247
|
});
|
|
140
|
-
|
|
248
|
+
BottomNavigation_BottomNavigation.displayName = 'SuiBottomNavigation';
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
141
256
|
|
|
142
|
-
export { BottomNavigation
|
|
257
|
+
export { BottomNavigation as bottomNavigationStyles, BottomNavigationGroup as bottomNavigationGroupStyles, BottomNavigationGroup_BottomNavigationGroup as BottomNavigationGroup, BottomNavigation_BottomNavigation as BottomNavigation };
|
|
258
|
+
export { BottomNavigationContext, useBottomNavigationContext } from "./BottomNavigationItem.js";
|
package/BottomNavigationItem.js
CHANGED
|
@@ -1,30 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, forwardRef, useContext } from "react";
|
|
3
|
+
import { combineClasses, useClasses } from "@ringcentral/spring-base";
|
|
4
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
5
|
+
import { Badge as Badge_Badge } from "./Badge.js";
|
|
6
|
+
import { IconButton as IconButton_IconButton } from "./IconButton.js";
|
|
7
|
+
import { useTooltipForceHide } from "./Tooltip.js";
|
|
8
|
+
import { Tooltip } from "./chunks/4535.js";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const BottomNavigationContext = createContext(null);
|
|
17
|
+
const useBottomNavigationContext = ()=>useContext(BottomNavigationContext);
|
|
18
|
+
|
|
19
|
+
// extracted by css-extract-rspack-plugin
|
|
20
|
+
/* export default */ var BottomNavigationItem = ({"sui-bottom-navigation-item-button":"sui-bottom-navigation-item-button","sui-expanded":"sui-expanded","sui-bottom-navigation-item-activated":"sui-bottom-navigation-item-activated"});
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const BottomNavigationItem_BottomNavigationItem = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
31
|
+
const props = useThemeProps({
|
|
32
|
+
props: inProps,
|
|
33
|
+
name: 'BottomNavigationItem'
|
|
34
|
+
});
|
|
35
|
+
const { classes, symbol, activatedSymbol, count, value: valueProp, activated: activatedProp, expanded: expandedProp, onClick, BadgeProps = {}, TooltipProps = {}, ButtonProps = {}, label, className } = props;
|
|
36
|
+
const cls = useClasses('bottom-navigation-item', classes, className);
|
|
37
|
+
const { value: selectedValue, expanded: isExpanded, onSelected, animationComplete } = useBottomNavigationContext() || {};
|
|
38
|
+
// close tooltip temporarily during animation
|
|
39
|
+
const tooltipOpenProps = useTooltipForceHide(animationComplete === false);
|
|
40
|
+
const selected = selectedValue === valueProp;
|
|
41
|
+
const activated = activatedProp !== undefined ? activatedProp : selected;
|
|
42
|
+
const expanded = expandedProp !== undefined ? expandedProp : isExpanded;
|
|
43
|
+
const handleClick = (event)=>{
|
|
44
|
+
if (valueProp !== undefined && !selected) {
|
|
45
|
+
onSelected?.(event, valueProp);
|
|
46
|
+
}
|
|
47
|
+
onClick?.(event);
|
|
48
|
+
};
|
|
49
|
+
let buttonClasses = {
|
|
50
|
+
root: cls('button', {
|
|
51
|
+
activated,
|
|
52
|
+
expanded
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
if (ButtonProps.classes) {
|
|
56
|
+
buttonClasses = combineClasses(buttonClasses, ButtonProps.classes);
|
|
57
|
+
}
|
|
58
|
+
return /*#__PURE__*/ jsx(Badge_Badge, {
|
|
59
|
+
variant: "outlined",
|
|
60
|
+
count: count,
|
|
61
|
+
className: cls('root'),
|
|
62
|
+
...BadgeProps,
|
|
63
|
+
children: /*#__PURE__*/ jsx(Tooltip, {
|
|
64
|
+
...TooltipProps,
|
|
65
|
+
title: label,
|
|
66
|
+
PopperProps: {
|
|
67
|
+
offset: 8
|
|
68
|
+
},
|
|
69
|
+
motionProps: null,
|
|
70
|
+
...tooltipOpenProps,
|
|
71
|
+
children: /*#__PURE__*/ jsx(IconButton_IconButton, {
|
|
72
|
+
shape: 'squircle',
|
|
73
|
+
variant: "contained",
|
|
74
|
+
size: "small",
|
|
75
|
+
color: 'secondary',
|
|
76
|
+
symbol: activated && activatedSymbol ? activatedSymbol : symbol,
|
|
77
|
+
onClick: handleClick,
|
|
78
|
+
"aria-label": label,
|
|
79
|
+
...ButtonProps,
|
|
80
|
+
classes: buttonClasses,
|
|
81
|
+
ref: ref
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
BottomNavigationItem_BottomNavigationItem.displayName = 'SuiBottomNavigationItem';
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
export { BottomNavigationContext, BottomNavigationItem as bottomNavigationItemStyles, BottomNavigationItem_BottomNavigationItem as BottomNavigationItem, useBottomNavigationContext };
|
package/Button.js
CHANGED
|
@@ -1,24 +1,160 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react, { forwardRef } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { useButton } from "@mui/base";
|
|
5
|
+
import { useClasses } from "@ringcentral/spring-base";
|
|
6
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
7
|
+
import { CircularProgressIndicator as CircularProgressIndicator_CircularProgressIndicator } from "./CircularProgressIndicator.js";
|
|
8
|
+
import { Icon as Icon_Icon } from "./chunks/8307.js";
|
|
9
|
+
import "./Tooltip.js";
|
|
10
|
+
import { withTooltip } from "./chunks/4535.js";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
// extracted by css-extract-rspack-plugin
|
|
19
|
+
/* export default */ var Button = ({"sui-button-root":"sui-button-root","sui-disabled":"sui-disabled","sui-button-xlarge":"sui-button-xlarge","sui-button-large":"sui-button-large","sui-button-medium":"sui-button-medium","sui-button-small":"sui-button-small","sui-button-xsmall":"sui-button-xsmall","sui-button-contained-xlarge":"sui-button-contained-xlarge","sui-button-outlined-xlarge":"sui-button-outlined-xlarge","sui-button-inverted-xlarge":"sui-button-inverted-xlarge","sui-button-contained-large":"sui-button-contained-large","sui-button-outlined-large":"sui-button-outlined-large","sui-button-inverted-large":"sui-button-inverted-large","sui-button-contained-medium":"sui-button-contained-medium","sui-button-outlined-medium":"sui-button-outlined-medium","sui-button-inverted-medium":"sui-button-inverted-medium","sui-button-contained-small":"sui-button-contained-small","sui-button-outlined-small":"sui-button-outlined-small","sui-button-inverted-small":"sui-button-inverted-small","sui-button-contained-xsmall":"sui-button-contained-xsmall","sui-button-outlined-xsmall":"sui-button-outlined-xsmall","sui-button-inverted-xsmall":"sui-button-inverted-xsmall","sui-button-loading":"sui-button-loading","sui-button-content":"sui-button-content","sui-button-contained":"sui-button-contained","sui-focus-visible":"sui-focus-visible","sui-button-outlined":"sui-button-outlined","sui-button-inverted":"sui-button-inverted","sui-button-text":"sui-button-text","sui-button-contained-primary":"sui-button-contained-primary","sui-button-contained-secondary":"sui-button-contained-secondary","sui-button-contained-neutral":"sui-button-contained-neutral","sui-button-contained-danger":"sui-button-contained-danger","sui-button-contained-warning":"sui-button-contained-warning","sui-button-contained-success":"sui-button-contained-success","sui-button-contained-hide-background":"sui-button-contained-hide-background","sui-button-outlined-primary":"sui-button-outlined-primary","sui-button-outlined-secondary":"sui-button-outlined-secondary","sui-button-outlined-neutral":"sui-button-outlined-neutral","sui-button-outlined-danger":"sui-button-outlined-danger","sui-button-outlined-warning":"sui-button-outlined-warning","sui-button-outlined-success":"sui-button-outlined-success","sui-button-text-primary":"sui-button-text-primary","sui-button-text-secondary":"sui-button-text-secondary","sui-button-text-neutral":"sui-button-text-neutral","sui-button-text-danger":"sui-button-text-danger","sui-button-text-warning":"sui-button-text-warning","sui-button-text-success":"sui-button-text-success","sui-button-inverted-primary":"sui-button-inverted-primary","sui-button-inverted-secondary":"sui-button-inverted-secondary","sui-button-inverted-neutral":"sui-button-inverted-neutral","sui-button-inverted-danger":"sui-button-inverted-danger","sui-button-inverted-warning":"sui-button-inverted-warning","sui-button-inverted-success":"sui-button-inverted-success","sui-button-slot":"sui-button-slot","sui-button-loading-indicator":"sui-button-loading-indicator","sui-button-center-slot":"sui-button-center-slot","sui-button-start-slot":"sui-button-start-slot","sui-button-end-slot":"sui-button-end-slot","sui-button-has-start-slot":"sui-button-has-start-slot","sui-button-has-end-slot":"sui-button-has-end-slot","sui-button-hide-background":"sui-button-hide-background","sui-button-full-width":"sui-button-full-width","sui-button-loading-iconless":"sui-button-loading-iconless"});
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const buttonIconSizeMap = {
|
|
31
|
+
xlarge: 'large',
|
|
32
|
+
large: 'medium',
|
|
33
|
+
medium: 'small',
|
|
34
|
+
small: 'small',
|
|
35
|
+
xsmall: 'xsmall'
|
|
36
|
+
};
|
|
37
|
+
const CircularProgressIndicatorSizeMap = {
|
|
38
|
+
xlarge: 'medium',
|
|
39
|
+
large: 'medium',
|
|
40
|
+
medium: 'small',
|
|
41
|
+
small: 'small',
|
|
42
|
+
xsmall: 'xsmall'
|
|
43
|
+
};
|
|
44
|
+
const CircularProgressIndicatorColorMap = {
|
|
45
|
+
primary: 'primary',
|
|
46
|
+
secondary: 'primary',
|
|
47
|
+
danger: 'danger',
|
|
48
|
+
warning: 'warning',
|
|
49
|
+
success: 'success',
|
|
50
|
+
neutral: 'primary'
|
|
51
|
+
};
|
|
52
|
+
const SLOT = 'slot';
|
|
53
|
+
const START_SLOT = 'start-slot';
|
|
54
|
+
const CENTER_SLOT = 'center-slot';
|
|
55
|
+
const END_SLOT = 'end-slot';
|
|
56
|
+
const Button_Button = withTooltip(/*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
57
|
+
const props = useThemeProps({
|
|
58
|
+
props: inProps,
|
|
59
|
+
name: 'Button'
|
|
60
|
+
});
|
|
61
|
+
const { component = 'button', children, size = 'medium', variant = 'contained', color = 'primary', background = true, fullWidth = false, loading = false, title: titleProp, CircularProgressIndicatorProps, startIcon, endIcon, classes, className, disabled: disabledProp, focusableWhenDisabled, ...rest } = props;
|
|
62
|
+
const cls = useClasses('button', classes, className);
|
|
63
|
+
const disableInteractions = disabledProp || loading;
|
|
64
|
+
const { getRootProps, focusVisible } = useButton({
|
|
65
|
+
...props,
|
|
66
|
+
focusableWhenDisabled,
|
|
67
|
+
disabled: disableInteractions,
|
|
68
|
+
rootRef: ref
|
|
69
|
+
});
|
|
70
|
+
const ButtonRoot = component;
|
|
71
|
+
const isTextContent = typeof children === 'string';
|
|
72
|
+
const loadingIconless = loading && !startIcon && !endIcon;
|
|
73
|
+
const title = (()=>{
|
|
74
|
+
// * if title is not provided and children is string, use children as title
|
|
75
|
+
if (titleProp === undefined && isTextContent) {
|
|
76
|
+
return children;
|
|
77
|
+
}
|
|
78
|
+
return titleProp;
|
|
79
|
+
})();
|
|
80
|
+
let startSlot = null;
|
|
81
|
+
let centerSlot = null;
|
|
82
|
+
let endSlot = null;
|
|
83
|
+
const startSlotClassName = cls(SLOT, START_SLOT, `${size}-start-slot`, `${variant}-${size}-start-slot`);
|
|
84
|
+
const endSlotClassName = cls(SLOT, END_SLOT, `${size}-end-slot`, `${variant}-${size}-end-slot`);
|
|
85
|
+
const centerSlotClassName = cls(SLOT, CENTER_SLOT);
|
|
86
|
+
if (loading) {
|
|
87
|
+
const loadingIndicator = /*#__PURE__*/ jsx(CircularProgressIndicator_CircularProgressIndicator, {
|
|
88
|
+
...CircularProgressIndicatorProps,
|
|
89
|
+
className: clsx(startIcon ? startSlotClassName : endIcon ? endSlotClassName : centerSlotClassName, cls('loading-indicator'), CircularProgressIndicatorProps?.className),
|
|
90
|
+
variant: "indeterminate",
|
|
91
|
+
size: CircularProgressIndicatorSizeMap[size],
|
|
92
|
+
color: CircularProgressIndicatorColorMap[color],
|
|
93
|
+
progressBarProps: {
|
|
94
|
+
'aria-label': CircularProgressIndicatorProps?.['aria-label'] ?? 'Loading',
|
|
95
|
+
...CircularProgressIndicatorProps?.progressBarProps
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
if (startIcon) {
|
|
99
|
+
startSlot = loadingIndicator;
|
|
100
|
+
} else if (endIcon) {
|
|
101
|
+
endSlot = loadingIndicator;
|
|
102
|
+
} else {
|
|
103
|
+
centerSlot = loadingIndicator;
|
|
104
|
+
}
|
|
105
|
+
} else if (startIcon) {
|
|
106
|
+
if (/*#__PURE__*/ react.isValidElement(startIcon)) {
|
|
107
|
+
startSlot = /*#__PURE__*/ react.cloneElement(startIcon, {
|
|
108
|
+
className: clsx(startSlotClassName, startIcon.props.className)
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
startSlot = /*#__PURE__*/ jsx(Icon_Icon, {
|
|
112
|
+
className: startSlotClassName,
|
|
113
|
+
symbol: startIcon,
|
|
114
|
+
size: buttonIconSizeMap[size]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (endIcon && (!loading || startIcon)) {
|
|
119
|
+
if (/*#__PURE__*/ react.isValidElement(endIcon)) {
|
|
120
|
+
endSlot = /*#__PURE__*/ react.cloneElement(endIcon, {
|
|
121
|
+
className: clsx(endSlotClassName, endIcon.props.className)
|
|
122
|
+
});
|
|
123
|
+
} else {
|
|
124
|
+
endSlot = /*#__PURE__*/ jsx(Icon_Icon, {
|
|
125
|
+
className: endSlotClassName,
|
|
126
|
+
symbol: endIcon,
|
|
127
|
+
size: buttonIconSizeMap[size]
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const content = isTextContent ? /*#__PURE__*/ jsx("span", {
|
|
132
|
+
className: cls('content'),
|
|
133
|
+
children: children
|
|
134
|
+
}) : children;
|
|
135
|
+
return /*#__PURE__*/ jsxs(ButtonRoot, {
|
|
136
|
+
className: cls('root', variant, color, size, `${variant}-${color}`, `${variant}-${size}`, !background && 'hide-background', !background && `${variant}-hide-background`, startSlot && 'has-start-slot', endSlot && 'has-end-slot', fullWidth && 'full-width', loadingIconless && 'loading-iconless', {
|
|
137
|
+
disabled: disabledProp,
|
|
138
|
+
focusVisible,
|
|
139
|
+
loading
|
|
140
|
+
}),
|
|
141
|
+
title: title,
|
|
142
|
+
...rest,
|
|
143
|
+
...getRootProps(),
|
|
144
|
+
"aria-busy": loading ? true : undefined,
|
|
145
|
+
children: [
|
|
146
|
+
startSlot,
|
|
147
|
+
centerSlot,
|
|
148
|
+
content,
|
|
149
|
+
endSlot
|
|
150
|
+
]
|
|
151
|
+
});
|
|
152
|
+
}));
|
|
153
|
+
Button_Button.displayName = 'SuiButton';
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
export { Button as buttonClasses, Button_Button as Button, buttonIconSizeMap };
|