@ringcentral/spring-ui 1.12.0 → 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 +71 -21
- package/Alert.js +120 -28
- package/Animation.js +2 -46
- package/Announcement.js +46 -35
- package/Autocomplete.js +1011 -583
- 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 +57 -15
- 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 -192
- package/DateUtilsContext.js +43 -25
- package/Dialer.js +564 -253
- package/Dialog.js +99 -45
- package/Divider.js +43 -7
- package/DragHandle.js +32 -6
- package/Drawer.js +117 -19
- package/Dropdown.js +154 -77
- package/EmptyState.js +65 -15
- package/FabButton.js +51 -17
- package/FocusTrap.js +109 -12
- package/FormField.js +108 -12
- 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 -17
- 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 -16
- package/MenuItem.js +402 -35
- package/MenuItemText.js +51 -9
- package/MenuList.js +87 -36
- package/Modal.js +345 -16
- package/NestedMenuContext.js +183 -11
- package/Option.js +32 -36
- package/Overlap.js +54 -7
- package/PageHeader.js +62 -24
- package/PickerTextField.js +156 -35
- package/Popover.js +262 -21
- package/Popper.js +112 -62
- 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 -44
- package/SingleFilter.js +148 -79
- package/Skeleton.js +68 -17
- package/Slider.js +167 -69
- package/Snackbar.js +122 -59
- package/SortableList.js +32 -12
- package/SortableListDndContext.js +69 -22
- package/SortableListItem.js +92 -47
- package/SortableVirtualizedList.js +44 -20
- package/SplitButton.js +124 -89
- 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 +67 -24
- package/StepIcon.js +90 -9
- package/StepLabel.js +90 -14
- package/Stepper.js +65 -23
- package/SubMenu.js +203 -101
- 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 -79
- package/TableRow.js +60 -21
- package/Tabs.js +592 -271
- package/Tag.js +51 -16
- package/Text.js +68 -37
- package/TextField.js +209 -31
- package/Textarea.js +51 -42
- package/TimePicker.js +490 -232
- package/Tooltip.js +48 -23
- package/Tray.js +237 -13
- package/TrayMenu.js +62 -43
- package/VirtualizedList.js +205 -107
- 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 +2436 -2261
- package/index.js +245 -195
- package/internal/utils/setRef.d.ts +2 -1
- package/package.json +4 -4
- package/src/Animation/hooks/useMotionSafeTransition/useMotionSafeTransition.d.ts +2 -0
- package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +1 -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/DatePickerUtils.d.ts +1 -1
- package/src/MenuItem/MenuItem.type.d.ts +1 -0
- package/src/MenuList/MenuListContext.d.ts +2 -3
- package/src/Modal/Modal.type.d.ts +1 -0
- 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/Select/Select.type.d.ts +6 -4
- 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 -33
- 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 -18
- package/chunks/MenuList.js +0 -47
- package/chunks/Modal.js +0 -211
- package/chunks/Overlap.js +0 -25
- package/chunks/PickerTextField.js +0 -85
- package/chunks/Popover.js +0 -61
- package/chunks/PopperPaper.js +0 -15
- package/chunks/Select.js +0 -225
- package/chunks/ShowHideEye.js +0 -56
- package/chunks/SlideIn.js +0 -20
- 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 -162
- package/chunks/VisuallyHidden.js +0 -12
- package/chunks/composeEventHandlers.js +0 -10
- 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 -38
- package/chunks/useHelperTextId.js +0 -24
- package/chunks/useListNavigation.js +0 -199
- package/chunks/useMenuItemSelect.js +0 -282
- 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
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useMemo, createContext, useContext, forwardRef, useRef, useImperativeHandle, useEffect } from 'react';
|
|
3
|
-
import { useControlled, useEventCallback, logInDev, useClasses, useForkRef } from '@ringcentral/spring-base';
|
|
4
|
-
import { useThemeProps, motionTransition } from '@ringcentral/spring-theme';
|
|
5
|
-
import { AnimatePresence, motion } from 'framer-motion';
|
|
6
|
-
import './Icon.js';
|
|
7
|
-
import { u as useMotionSafeTransition } from './useMotionSafeTransition.js';
|
|
8
|
-
|
|
9
|
-
const useTray = (parameters) => {
|
|
10
|
-
const { value: valueProp, defaultValue, onChange, containerRef } = parameters;
|
|
11
|
-
const [value, setValue] = useControlled({
|
|
12
|
-
controlled: valueProp,
|
|
13
|
-
default: defaultValue,
|
|
14
|
-
name: 'useTray',
|
|
15
|
-
state: 'value',
|
|
16
|
-
});
|
|
17
|
-
if (value === undefined) {
|
|
18
|
-
throw new Error('Should set default TrayPanel using defaultValue (not controlled) or value (controlled)');
|
|
19
|
-
}
|
|
20
|
-
const [stack, setStack] = useState([value]);
|
|
21
|
-
const [direction, setDirection] = useState('right');
|
|
22
|
-
const updateValue = (e, newValue) => {
|
|
23
|
-
setValue(newValue);
|
|
24
|
-
onChange?.(e, newValue);
|
|
25
|
-
if (stack.includes(newValue)) {
|
|
26
|
-
setStack(stack.slice(0, stack.indexOf(newValue) + 1));
|
|
27
|
-
setDirection('left');
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
setStack([...stack, newValue]);
|
|
31
|
-
setDirection('right');
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const navigateTo = useEventCallback((newValue, event = null) => {
|
|
35
|
-
let handledValue = newValue;
|
|
36
|
-
if (handledValue === null && stack.length === 1) {
|
|
37
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
38
|
-
logInDev({
|
|
39
|
-
scope: 'useTray',
|
|
40
|
-
message: 'No TrayPanel left to return to',
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (handledValue === null) {
|
|
46
|
-
handledValue = stack[stack.length - 2];
|
|
47
|
-
}
|
|
48
|
-
containerRef.current?.focus();
|
|
49
|
-
updateValue(event, handledValue);
|
|
50
|
-
});
|
|
51
|
-
const trayContextValue = useMemo(() => {
|
|
52
|
-
return {
|
|
53
|
-
value,
|
|
54
|
-
navigateTo,
|
|
55
|
-
direction,
|
|
56
|
-
containerRef,
|
|
57
|
-
};
|
|
58
|
-
}, [value, navigateTo, direction, containerRef]);
|
|
59
|
-
return {
|
|
60
|
-
trayContextValue,
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const TrayContext = createContext(null);
|
|
65
|
-
const useTrayContext = () => useContext(TrayContext);
|
|
66
|
-
|
|
67
|
-
const Tray = forwardRef((inProps, ref) => {
|
|
68
|
-
const props = useThemeProps({ props: inProps, name: 'Tray' });
|
|
69
|
-
const { classes, children, value, defaultValue, onChange, actions, className, ...rest } = props;
|
|
70
|
-
const cls = useClasses('tray', classes, className);
|
|
71
|
-
const rootRef = useRef(null);
|
|
72
|
-
const handleRootRef = useForkRef(ref, rootRef);
|
|
73
|
-
const { trayContextValue } = useTray({
|
|
74
|
-
value,
|
|
75
|
-
defaultValue,
|
|
76
|
-
onChange,
|
|
77
|
-
containerRef: rootRef,
|
|
78
|
-
});
|
|
79
|
-
const { navigateTo } = trayContextValue;
|
|
80
|
-
useImperativeHandle(actions, () => ({
|
|
81
|
-
navigateTo,
|
|
82
|
-
}), [navigateTo]);
|
|
83
|
-
return (jsx("div", { className: cls('root'), ref: handleRootRef, ...rest, tabIndex: -1, children: jsx(TrayContext.Provider, { value: trayContextValue, children: children }) }));
|
|
84
|
-
});
|
|
85
|
-
Tray.displayName = 'SuiTray';
|
|
86
|
-
|
|
87
|
-
const useTrayPanel = (parameters) => {
|
|
88
|
-
const { value } = parameters;
|
|
89
|
-
const context = useTrayContext();
|
|
90
|
-
if (context === null) {
|
|
91
|
-
throw new Error('No TrayContext provided, must be used within a Tray');
|
|
92
|
-
}
|
|
93
|
-
const activated = value === context.value;
|
|
94
|
-
return {
|
|
95
|
-
activated,
|
|
96
|
-
containerRef: context.containerRef,
|
|
97
|
-
direction: context.direction,
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const TrayPanel = forwardRef((inProps, ref) => {
|
|
102
|
-
const props = useThemeProps({ props: inProps, name: 'TrayPanel' });
|
|
103
|
-
const { children, classes, className } = props;
|
|
104
|
-
const { activated, containerRef, direction } = useTrayPanel(props);
|
|
105
|
-
const [display, setDisplay] = useState(activated);
|
|
106
|
-
useEffect(() => {
|
|
107
|
-
if (activated) {
|
|
108
|
-
setDisplay(true);
|
|
109
|
-
}
|
|
110
|
-
}, [activated]);
|
|
111
|
-
const cls = useClasses('tray-panel', classes, className);
|
|
112
|
-
const transition = useMotionSafeTransition(motionTransition['spring-01-fast']);
|
|
113
|
-
return (jsx(AnimatePresence, { initial: false, children: display && (jsx(motion.div, { ref: ref, className: cls('root', { activated }), "data-activated": activated, transition: transition, initial: 'enter', animate: activated ? 'center' : 'exit', onAnimationComplete: () => {
|
|
114
|
-
!activated && setDisplay(false);
|
|
115
|
-
}, variants: {
|
|
116
|
-
enter: {
|
|
117
|
-
height: containerRef.current?.querySelector('[data-activated="false"]')?.offsetHeight,
|
|
118
|
-
transform: direction === 'right'
|
|
119
|
-
? 'translateX(100%)'
|
|
120
|
-
: 'translateX(-100%)',
|
|
121
|
-
},
|
|
122
|
-
center: {
|
|
123
|
-
height: 'auto',
|
|
124
|
-
transform: 'translateX(0%)',
|
|
125
|
-
},
|
|
126
|
-
exit: {
|
|
127
|
-
transform: direction === 'right'
|
|
128
|
-
? 'translateX(-100%)'
|
|
129
|
-
: 'translateX(100%)',
|
|
130
|
-
},
|
|
131
|
-
}, children: children })) }));
|
|
132
|
-
});
|
|
133
|
-
TrayPanel.displayName = 'SuiTrayPanel';
|
|
134
|
-
|
|
135
|
-
const useTrayNavigate = () => {
|
|
136
|
-
const context = useTrayContext();
|
|
137
|
-
if (context === null) {
|
|
138
|
-
throw new Error('No TrayContext provided, must be used within a Tray');
|
|
139
|
-
}
|
|
140
|
-
const { navigateTo } = context;
|
|
141
|
-
const back = (event = null) => {
|
|
142
|
-
context.navigateTo(null, event);
|
|
143
|
-
};
|
|
144
|
-
return {
|
|
145
|
-
navigateTo,
|
|
146
|
-
back,
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export { Tray as T, TrayContext as a, TrayPanel as b, useTray as c, useTrayNavigate as d, useTrayPanel as e, useTrayContext as u };
|
package/chunks/withTooltip.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import { T as Tooltip } from './Tooltip.js';
|
|
4
|
-
|
|
5
|
-
function withTooltip(Component) {
|
|
6
|
-
return forwardRef((props, ref) => {
|
|
7
|
-
const { TooltipProps, ...rest } = props;
|
|
8
|
-
const content = jsx(Component, { ...rest, ref: ref });
|
|
9
|
-
if (!TooltipProps)
|
|
10
|
-
return content;
|
|
11
|
-
return jsx(Tooltip, { ...TooltipProps, children: content });
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { withTooltip as w };
|