@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/VirtualizedMenu.js
CHANGED
|
@@ -1,29 +1,359 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import { createContext, forwardRef, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { combineProps, useClasses, useEventCallback, useForkRef } from "@ringcentral/spring-base";
|
|
4
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
5
|
+
import { VirtualizedList } from "./VirtualizedList.js";
|
|
6
|
+
import { useAnimationFrame } from "./chunks/6335.js";
|
|
7
|
+
import { Popover as Popover_Popover } from "./Popover.js";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const VirtualizedMenuContext = createContext(null);
|
|
12
|
+
const useVirtualizedMenuContext = ()=>useContext(VirtualizedMenuContext);
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
// extracted by css-extract-rspack-plugin
|
|
19
|
+
/* export default */ var VirtualizedMenu = ({"sui-virtualized-menu-paper":"sui-virtualized-menu-paper","sui-virtualized-menu-paper-content-container":"sui-virtualized-menu-paper-content-container","sui-virtualized-menu-list":"sui-virtualized-menu-list"});
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const VirtualizedMenuList = (props)=>{
|
|
29
|
+
const { children, actions: actionsProp, initialFocus: initialFocusProps, totalListHeightChanged: totalListHeightChangedProp, ...rest } = props;
|
|
30
|
+
const actions = useRef(null);
|
|
31
|
+
const handleListActions = useForkRef(actions, actionsProp);
|
|
32
|
+
const listRef = useRef(null);
|
|
33
|
+
const virtualizedMenuContext = useVirtualizedMenuContext();
|
|
34
|
+
useLayoutEffect(()=>{
|
|
35
|
+
if (!virtualizedMenuContext?.open) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const initialFocus = typeof initialFocusProps === 'function' ? initialFocusProps() : initialFocusProps;
|
|
39
|
+
if (initialFocus === true) {
|
|
40
|
+
actions.current?.focus();
|
|
41
|
+
} else if (typeof initialFocus === 'number') {
|
|
42
|
+
actions.current?.focusByIndex(initialFocus);
|
|
43
|
+
}
|
|
44
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
+
}, [
|
|
46
|
+
virtualizedMenuContext?.open
|
|
47
|
+
]);
|
|
48
|
+
return /*#__PURE__*/ jsx(VirtualizedList, {
|
|
49
|
+
actions: handleListActions,
|
|
50
|
+
...rest,
|
|
51
|
+
ListProps: combineProps({
|
|
52
|
+
role: 'menu'
|
|
53
|
+
}, rest.ListProps),
|
|
54
|
+
ref: listRef,
|
|
55
|
+
totalListHeightChanged: totalListHeightChangedProp,
|
|
56
|
+
children: children
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const MENU_VERTICAL_PADDING = 8;
|
|
70
|
+
/** Reach `measureDesiredHeight` without putting it on public `PopoverProps`. */ const InternalPopover = Popover_Popover;
|
|
71
|
+
const isEmptyVirtualizedData = (data, totalCount)=>totalCount === 0 || totalCount === undefined && data !== undefined && data.length === 0;
|
|
72
|
+
const VirtualizedMenu_VirtualizedMenu = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
73
|
+
const props = useThemeProps({
|
|
74
|
+
props: inProps,
|
|
75
|
+
name: 'VirtualizedMenu'
|
|
76
|
+
});
|
|
77
|
+
const { classes, className, children, open, onClose, onAfterClose, data, totalCount, isItemDisabled, actions, VirtualizedListProps, popperActions: popperActionsProp, initialFocus = true, maxHeight, PopperProps, ...rest } = props;
|
|
78
|
+
const paperContentContainerRef = useRef(null);
|
|
79
|
+
const hasItemsRenderedRef = useRef(false);
|
|
80
|
+
/** Whether the container currently holds the height used to pick a side. */ const isHoldingPlacementHeightRef = useRef(false);
|
|
81
|
+
const [waitForHeightCompute, setWaitForHeightCompute] = useState(true);
|
|
82
|
+
const [menuHeight, setMenuHeight] = useState(MENU_VERTICAL_PADDING * 2);
|
|
83
|
+
/**
|
|
84
|
+
* Number of times the placement measurement has been asked to release. This
|
|
85
|
+
* is a counter rather than a boolean on purpose: the request is raised from
|
|
86
|
+
* Popover's `size` middleware, which can run in the same React batch that
|
|
87
|
+
* started the measurement. A boolean would collapse to "nothing changed" and
|
|
88
|
+
* strand the inline height on the container forever.
|
|
89
|
+
*/ const [placementHeightReleases, setPlacementHeightReleases] = useState(0);
|
|
90
|
+
const [deferPendingVirtualizedListActions, setDeferPendingVirtualizedListActions] = useState(true);
|
|
91
|
+
const computedListHeight = useRef(-1);
|
|
92
|
+
const availableHeight = useRef(-1);
|
|
93
|
+
const cls = useClasses('virtualized-menu', classes, className);
|
|
94
|
+
const padding = PopperProps?.padding;
|
|
95
|
+
const popperPadding = typeof padding === 'object' ? {
|
|
96
|
+
top: padding.top ?? 16,
|
|
97
|
+
right: padding.right ?? 16,
|
|
98
|
+
bottom: padding.bottom ?? 16,
|
|
99
|
+
left: padding.left ?? 16
|
|
100
|
+
} : padding ?? 16;
|
|
101
|
+
const popperActions = useRef(null);
|
|
102
|
+
const handlePopperActions = useForkRef(popperActions, popperActionsProp);
|
|
103
|
+
const { requestAnimationFrame } = useAnimationFrame();
|
|
104
|
+
/**
|
|
105
|
+
* Give the container back to the list. Only safe once the clamped height has
|
|
106
|
+
* been committed to the list, otherwise the menu collapses to the list's
|
|
107
|
+
* previous height while Floating UI is still positioning it.
|
|
108
|
+
*/ const releasePlacementHeight = useEventCallback(()=>{
|
|
109
|
+
isHoldingPlacementHeightRef.current = false;
|
|
110
|
+
if (paperContentContainerRef.current) {
|
|
111
|
+
paperContentContainerRef.current.style.height = '';
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
const resetLayoutCache = useEventCallback(()=>{
|
|
115
|
+
hasItemsRenderedRef.current = false;
|
|
116
|
+
computedListHeight.current = -1;
|
|
117
|
+
availableHeight.current = -1;
|
|
118
|
+
releasePlacementHeight();
|
|
119
|
+
setMenuHeight(MENU_VERTICAL_PADDING * 2);
|
|
120
|
+
setWaitForHeightCompute(true);
|
|
121
|
+
setDeferPendingVirtualizedListActions(true);
|
|
122
|
+
});
|
|
123
|
+
const menuContextValue = useMemo(()=>{
|
|
124
|
+
return {
|
|
125
|
+
open
|
|
126
|
+
};
|
|
127
|
+
}, [
|
|
128
|
+
open
|
|
129
|
+
]);
|
|
130
|
+
const handleAfterClose = useEventCallback(()=>{
|
|
131
|
+
resetLayoutCache();
|
|
132
|
+
onAfterClose?.();
|
|
133
|
+
});
|
|
134
|
+
const updateMenuHeight = useEventCallback(()=>{
|
|
135
|
+
let computedMenuHeight = computedListHeight.current;
|
|
136
|
+
// availableHeight stays -1 until Popper reports space; do not clamp against it yet
|
|
137
|
+
if (availableHeight.current !== -1 && computedMenuHeight > availableHeight.current) {
|
|
138
|
+
computedMenuHeight = availableHeight.current;
|
|
139
|
+
}
|
|
140
|
+
if (maxHeight !== undefined && computedMenuHeight > maxHeight) {
|
|
141
|
+
computedMenuHeight = maxHeight;
|
|
142
|
+
}
|
|
143
|
+
setMenuHeight(computedMenuHeight);
|
|
144
|
+
});
|
|
145
|
+
/**
|
|
146
|
+
* Write the height the list actually wants onto the container and report it as
|
|
147
|
+
* Popover's desired height. The list's scroll viewport is sized from state, so
|
|
148
|
+
* dropping Popover's clamp cannot grow it back: without this, `flip` would only
|
|
149
|
+
* ever measure the viewport-clamped height from the previous pass — including
|
|
150
|
+
* window resize, where Virtuoso does not re-report total height. Only the public
|
|
151
|
+
* `maxHeight` caps it.
|
|
152
|
+
*/ const holdPlacementHeight = useEventCallback(()=>{
|
|
153
|
+
if (computedListHeight.current === -1 || !hasItemsRenderedRef.current || !paperContentContainerRef.current) {
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
const placementHeight = maxHeight !== undefined ? Math.min(computedListHeight.current, maxHeight) : computedListHeight.current;
|
|
157
|
+
paperContentContainerRef.current.style.height = `${placementHeight}px`;
|
|
158
|
+
isHoldingPlacementHeightRef.current = true;
|
|
159
|
+
return placementHeight;
|
|
160
|
+
});
|
|
161
|
+
const applyListHeight = useEventCallback((listHeight)=>{
|
|
162
|
+
/**
|
|
163
|
+
* Virtuoso reports height without the ::before/::after pseudo-element padding.
|
|
164
|
+
* Add padding to match the actual rendered height (same approach as SuggestionList).
|
|
165
|
+
*/ const adjustedHeight = true ? listHeight + MENU_VERTICAL_PADDING * 2 : 0;
|
|
166
|
+
computedListHeight.current = adjustedHeight;
|
|
167
|
+
updateMenuHeight();
|
|
168
|
+
popperActions.current?.update();
|
|
169
|
+
});
|
|
170
|
+
const revealWhenSettled = useEventCallback(()=>{
|
|
171
|
+
/**
|
|
172
|
+
* Perform all pending actions once we know the list height has settled. This is necessary
|
|
173
|
+
* as those pending actions expect the list to have fully rendered before they can be ran.
|
|
174
|
+
*/ requestAnimationFrame(()=>{
|
|
175
|
+
setDeferPendingVirtualizedListActions(false);
|
|
176
|
+
/**
|
|
177
|
+
* Wait for the next repaint to ensure the pending actions have been completed and the height
|
|
178
|
+
* has been computed and painted. If we didn't do this, the menu could flicker if the initial
|
|
179
|
+
* scroll position was set to a value that would cause the list to scroll down.
|
|
180
|
+
*/ requestAnimationFrame(()=>{
|
|
181
|
+
setWaitForHeightCompute(false);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
const handleTotalListHeightChanged = useEventCallback((listHeight)=>{
|
|
186
|
+
/**
|
|
187
|
+
* Only process height after items have been rendered. This prevents using incomplete
|
|
188
|
+
* measurements before Virtuoso has actually rendered list content, avoiding flicker
|
|
189
|
+
* and incorrect placement (same approach as SuggestionList).
|
|
190
|
+
*/ if (!hasItemsRenderedRef.current) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
applyListHeight(listHeight);
|
|
194
|
+
if (waitForHeightCompute) {
|
|
195
|
+
revealWhenSettled();
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
const handleAvailableHeightChange = useEventCallback((value)=>{
|
|
199
|
+
/**
|
|
200
|
+
* Ignore available height updates until the list has been computed and items rendered.
|
|
201
|
+
* This prevents applying constraints to an incomplete list during initial render.
|
|
202
|
+
*/ if (computedListHeight.current === -1 || !hasItemsRenderedRef.current) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
availableHeight.current = value;
|
|
206
|
+
updateMenuHeight();
|
|
207
|
+
/**
|
|
208
|
+
* The measurement cannot be released here. `updateMenuHeight` only schedules a
|
|
209
|
+
* render, so the list still has its old height in the DOM: clearing the container
|
|
210
|
+
* now would collapse the menu in the middle of Popover's `size` middleware, and
|
|
211
|
+
* the pass that follows would measure a nearly empty menu and settle on the wrong
|
|
212
|
+
* side. Hand it to a layout effect, which runs once the new height is committed.
|
|
213
|
+
*/ if (isHoldingPlacementHeightRef.current) {
|
|
214
|
+
isHoldingPlacementHeightRef.current = false;
|
|
215
|
+
setPlacementHeightReleases((count)=>count + 1);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
/**
|
|
219
|
+
* Drop the measurement hold once the list height has committed. Do not call
|
|
220
|
+
* `popper.update()` here: the pass that held for `flip` already finished, and
|
|
221
|
+
* another update would hold again → release → update forever on resize.
|
|
222
|
+
*/ useLayoutEffect(()=>{
|
|
223
|
+
if (placementHeightReleases === 0) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
releasePlacementHeight();
|
|
227
|
+
}, [
|
|
228
|
+
placementHeightReleases,
|
|
229
|
+
releasePlacementHeight
|
|
230
|
+
]);
|
|
231
|
+
useEffect(()=>{
|
|
232
|
+
if (!open) {
|
|
233
|
+
hasItemsRenderedRef.current = false;
|
|
234
|
+
// Never carry a held measurement across a close, otherwise a menu closed
|
|
235
|
+
// mid-measurement would reopen with an oversized container.
|
|
236
|
+
releasePlacementHeight();
|
|
237
|
+
// Keep computedListHeight / availableHeight while the list stays mounted
|
|
238
|
+
// (close animation / rapid toggle). They are reset in resetLayoutCache
|
|
239
|
+
// once the Popover content has actually left the DOM.
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Keep Popover's enter animation held until Virtuoso reports list height, so
|
|
243
|
+
* the menu only becomes visible on the correct flip side (not a too-short
|
|
244
|
+
* pre-list placement). After that, Popover auto-update handles resize and
|
|
245
|
+
* growth.
|
|
246
|
+
*/ if (open) {
|
|
247
|
+
// Reuse preserved height from previous render during rapid toggling (component reuse).
|
|
248
|
+
// This avoids the minimum height flash and eliminates dependency on Virtuoso re-reporting height.
|
|
249
|
+
if (computedListHeight.current !== -1) {
|
|
250
|
+
updateMenuHeight();
|
|
251
|
+
setWaitForHeightCompute(false);
|
|
252
|
+
setDeferPendingVirtualizedListActions(false);
|
|
253
|
+
// Trigger Popper update to recalculate availableHeight (e.g., window resize).
|
|
254
|
+
// Ensures handleAvailableHeightChange is called even if Virtuoso skips callbacks.
|
|
255
|
+
popperActions.current?.update();
|
|
256
|
+
} else {
|
|
257
|
+
setMenuHeight(MENU_VERTICAL_PADDING * 2); // initial height for the menu
|
|
258
|
+
setWaitForHeightCompute(true);
|
|
259
|
+
setDeferPendingVirtualizedListActions(true);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps -- stable useEventCallback refs; run on open toggle only
|
|
263
|
+
}, [
|
|
264
|
+
open
|
|
265
|
+
]);
|
|
266
|
+
const isEmptyList = isEmptyVirtualizedData(data, totalCount);
|
|
267
|
+
useEffect(()=>{
|
|
268
|
+
if (!open || !isEmptyList) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Virtuoso often skips `totalListHeightChanged` for empty lists. Settle once
|
|
273
|
+
* from emptiness, not from every `itemsRendered`, so empty menus still clear
|
|
274
|
+
* `waitForHeightCompute` (which releases the enter animation) and land on
|
|
275
|
+
* padding-only height.
|
|
276
|
+
*/ hasItemsRenderedRef.current = true;
|
|
277
|
+
applyListHeight(0);
|
|
278
|
+
revealWhenSettled();
|
|
279
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps -- stable useEventCallback refs; run when empty list opens
|
|
280
|
+
}, [
|
|
281
|
+
open,
|
|
282
|
+
isEmptyList
|
|
283
|
+
]);
|
|
284
|
+
return /*#__PURE__*/ jsx(InternalPopover, {
|
|
285
|
+
bordered: true,
|
|
286
|
+
PopperProps: {
|
|
287
|
+
...PopperProps,
|
|
288
|
+
padding: popperPadding
|
|
289
|
+
},
|
|
290
|
+
...rest,
|
|
291
|
+
open: open,
|
|
292
|
+
className: cls('root'),
|
|
293
|
+
onClose: onClose,
|
|
294
|
+
onAfterClose: handleAfterClose,
|
|
295
|
+
onAvailableHeightChange: handleAvailableHeightChange,
|
|
296
|
+
deferEnterAnimation: waitForHeightCompute,
|
|
297
|
+
measureDesiredHeight: holdPlacementHeight,
|
|
298
|
+
disableContentVerticalScroll: true,
|
|
299
|
+
ref: ref,
|
|
300
|
+
// disable animation. The Grow animation will cause vl height calculate incorrectly
|
|
301
|
+
motionProps: {
|
|
302
|
+
variants: undefined
|
|
303
|
+
},
|
|
304
|
+
actions: handlePopperActions,
|
|
305
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
306
|
+
className: cls('paper'),
|
|
307
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
308
|
+
ref: paperContentContainerRef,
|
|
309
|
+
className: cls('paper-content-container'),
|
|
310
|
+
children: /*#__PURE__*/ jsx(VirtualizedMenuContext.Provider, {
|
|
311
|
+
value: menuContextValue,
|
|
312
|
+
children: /*#__PURE__*/ jsx(VirtualizedMenuList, {
|
|
313
|
+
data: data,
|
|
314
|
+
totalCount: totalCount,
|
|
315
|
+
isReady: !deferPendingVirtualizedListActions,
|
|
316
|
+
isItemDisabled: isItemDisabled,
|
|
317
|
+
initialFocus: initialFocus,
|
|
318
|
+
actions: actions,
|
|
319
|
+
...combineProps(VirtualizedListProps, {
|
|
320
|
+
style: {
|
|
321
|
+
height: menuHeight
|
|
322
|
+
},
|
|
323
|
+
ListProps: combineProps(VirtualizedListProps?.ListProps, {
|
|
324
|
+
className: cls('list'),
|
|
325
|
+
style: {
|
|
326
|
+
['--sui-virtualized-menu-vertical-padding']: `${MENU_VERTICAL_PADDING}px`
|
|
327
|
+
}
|
|
328
|
+
}),
|
|
329
|
+
totalListHeightChanged: handleTotalListHeightChanged,
|
|
330
|
+
itemsRendered: (items)=>{
|
|
331
|
+
if (items && items.length > 0) {
|
|
332
|
+
hasItemsRenderedRef.current = true;
|
|
333
|
+
}
|
|
334
|
+
VirtualizedListProps?.itemsRendered?.(items);
|
|
335
|
+
},
|
|
336
|
+
onKeyDown: (e)=>{
|
|
337
|
+
if (e.key === 'Tab') {
|
|
338
|
+
e.preventDefault();
|
|
339
|
+
onClose?.();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}),
|
|
343
|
+
children: children
|
|
344
|
+
})
|
|
345
|
+
})
|
|
346
|
+
})
|
|
347
|
+
})
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
VirtualizedMenu_VirtualizedMenu.displayName = 'SuiVirtualizedMenu';
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
export { VirtualizedMenu as virtualizedMenuStyle, VirtualizedMenuContext, VirtualizedMenuList, VirtualizedMenu_VirtualizedMenu as VirtualizedMenu, useVirtualizedMenuContext };
|
package/VisuallyHidden.js
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import '@ringcentral/spring-base';
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useClasses } from "@ringcentral/spring-base";
|
|
5
4
|
|
|
6
|
-
var VisuallyHidden = {"sui-visually-hidden-root":"sui-visually-hidden-root"};
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// extracted by css-extract-rspack-plugin
|
|
9
|
+
/* export default */ var VisuallyHidden = ({"sui-visually-hidden-root":"sui-visually-hidden-root"});
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const VisuallyHidden_VisuallyHidden = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
15
|
+
const { classes, className, children, ...rest } = props;
|
|
16
|
+
const cls = useClasses('visually-hidden', classes, className);
|
|
17
|
+
return /*#__PURE__*/ jsx("span", {
|
|
18
|
+
className: cls('root'),
|
|
19
|
+
...rest,
|
|
20
|
+
ref: ref,
|
|
21
|
+
children: children
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
VisuallyHidden_VisuallyHidden.displayName = 'SuiVisuallyHidden';
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export { VisuallyHidden as visuallyHiddenStyle, VisuallyHidden_VisuallyHidden as VisuallyHidden };
|
package/chunks/1250.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react, { cloneElement, forwardRef, isValidElement } from "react";
|
|
3
|
+
import { useClasses, useId } from "@ringcentral/spring-base";
|
|
4
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// extracted by css-extract-rspack-plugin
|
|
11
|
+
/* export default */ var Squircle = ({"sui-squircle-root":"sui-squircle-root","sui-squircle-interactive":"sui-squircle-interactive","sui-active":"sui-active","sui-squircle-content":"sui-squircle-content","sui-squircle-ring":"sui-squircle-ring"});
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const SQUIRCLE_PATH = 'M 0.5 0 C 0.879 0 1 0.121 1 0.5 C 1 0.879 0.879 1 0.5 1 C 0.121 1 0 0.879 0 0.5 C 0 0.121 0.121 0 0.5 0 Z';
|
|
18
|
+
const Squircle_Squircle = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
19
|
+
const props = useThemeProps({
|
|
20
|
+
props: inProps,
|
|
21
|
+
name: 'Squircle'
|
|
22
|
+
});
|
|
23
|
+
const { component = 'div', focusVisible, active, children: childrenProp, className, classes, interactive = true, fillShape: fillShapeProp = false, ...rest } = props;
|
|
24
|
+
/**
|
|
25
|
+
* If the children passed to this component have a conditionally rendered
|
|
26
|
+
* element, using toArray will ensure that any falsy children are removed.
|
|
27
|
+
* Otherwise fillShape will always be false even if only 1 truthy child
|
|
28
|
+
* is passed to this component.
|
|
29
|
+
*/ const children = react.Children.toArray(childrenProp);
|
|
30
|
+
const firstChild = children[0];
|
|
31
|
+
const fillShape = fillShapeProp && firstChild && // oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
+
/*#__PURE__*/ isValidElement(firstChild);
|
|
33
|
+
const cls = useClasses('squircle', classes, className);
|
|
34
|
+
const clipId = useId('sui-squircle-clip', true);
|
|
35
|
+
const showFocusRing = interactive && focusVisible;
|
|
36
|
+
const Root = component;
|
|
37
|
+
return /*#__PURE__*/ jsxs(Root, {
|
|
38
|
+
className: cls('root', {
|
|
39
|
+
active,
|
|
40
|
+
interactive
|
|
41
|
+
}),
|
|
42
|
+
...rest,
|
|
43
|
+
ref: ref,
|
|
44
|
+
children: [
|
|
45
|
+
/*#__PURE__*/ jsx("svg", {
|
|
46
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
+
width: "0",
|
|
48
|
+
height: "0",
|
|
49
|
+
viewBox: "0 0 1 1",
|
|
50
|
+
style: {
|
|
51
|
+
position: 'absolute'
|
|
52
|
+
},
|
|
53
|
+
"aria-hidden": true,
|
|
54
|
+
children: /*#__PURE__*/ jsx("defs", {
|
|
55
|
+
children: /*#__PURE__*/ jsx("clipPath", {
|
|
56
|
+
id: clipId,
|
|
57
|
+
clipPathUnits: "objectBoundingBox",
|
|
58
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
59
|
+
d: SQUIRCLE_PATH
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
}),
|
|
64
|
+
!fillShape && /*#__PURE__*/ jsx("svg", {
|
|
65
|
+
className: cls('content'),
|
|
66
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
67
|
+
viewBox: '0 0 1 1',
|
|
68
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
69
|
+
clipPath: `url(#${clipId})`,
|
|
70
|
+
d: SQUIRCLE_PATH,
|
|
71
|
+
vectorEffect: "non-scaling-stroke"
|
|
72
|
+
})
|
|
73
|
+
}),
|
|
74
|
+
showFocusRing && /*#__PURE__*/ jsx("svg", {
|
|
75
|
+
className: cls('ring'),
|
|
76
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
77
|
+
viewBox: "0 0 1 1",
|
|
78
|
+
overflow: "visible",
|
|
79
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
80
|
+
d: SQUIRCLE_PATH,
|
|
81
|
+
fillOpacity: 0,
|
|
82
|
+
vectorEffect: "non-scaling-stroke"
|
|
83
|
+
})
|
|
84
|
+
}),
|
|
85
|
+
fillShape ? /*#__PURE__*/ cloneElement(firstChild, {
|
|
86
|
+
style: {
|
|
87
|
+
...firstChild.props.style,
|
|
88
|
+
width: '100%',
|
|
89
|
+
height: '100%',
|
|
90
|
+
clipPath: `url(#${clipId})`
|
|
91
|
+
}
|
|
92
|
+
}) : children
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
export { Squircle as squircleStyle, Squircle_Squircle as Squircle };
|
package/chunks/1294.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MotionConfigContext, motion } from "framer-motion";
|
|
3
|
+
import { useClasses, useGlobalListener } from "@ringcentral/spring-base";
|
|
4
|
+
import { motionTransition } from "@ringcentral/spring-theme";
|
|
5
|
+
import { useContext, useState } from "react";
|
|
6
|
+
import { Icon as Icon_Icon } from "./8307.js";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* in all component that uses this hook, we always use same instance of MediaQueryList
|
|
20
|
+
* so we can cache the instance here
|
|
21
|
+
*/ let instance;
|
|
22
|
+
const getPrefersReducedMotionMediaQuery = ()=>{
|
|
23
|
+
if (!instance || // in test environment, we need to reassign the instance to the window object
|
|
24
|
+
process.env.NODE_ENV === 'test') {
|
|
25
|
+
instance = window?.matchMedia?.('(prefers-reduced-motion)');
|
|
26
|
+
}
|
|
27
|
+
return instance;
|
|
28
|
+
};
|
|
29
|
+
const usePrefersReducedMotion = ()=>{
|
|
30
|
+
const mediaQuery = getPrefersReducedMotionMediaQuery();
|
|
31
|
+
const [shouldReduceMotion, setShouldReduceMotion] = useState(mediaQuery?.matches || false);
|
|
32
|
+
const context = useContext(MotionConfigContext);
|
|
33
|
+
useGlobalListener('change', (event)=>{
|
|
34
|
+
setShouldReduceMotion(event.matches);
|
|
35
|
+
}, {
|
|
36
|
+
target: mediaQuery,
|
|
37
|
+
customKey: 'prefers-reduced-motion'
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* As we're determining the reduced motion state ourselves after the initial mount,
|
|
41
|
+
* we need to check the MotionConfigContext to see how the prefers-reduced-motion
|
|
42
|
+
* state should be handled.
|
|
43
|
+
*/ if (context.reducedMotion === 'user') {
|
|
44
|
+
// When explicitly set to 'user', respect the media query even in test environment
|
|
45
|
+
return shouldReduceMotion;
|
|
46
|
+
}
|
|
47
|
+
if (context.reducedMotion === 'always' || // In test environment, we always enable reduced motion to skip animations.
|
|
48
|
+
// Note: This overrides the default 'never' setting from MotionConfigContext.
|
|
49
|
+
process.env.NODE_ENV === 'test') {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
// In production, respect the 'never' setting
|
|
53
|
+
if (context.reducedMotion === 'never') {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return shouldReduceMotion;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A hook that returns an instant transition if the user has reduced motion enabled.
|
|
66
|
+
* If reduced motion is not enabled, returns the given motion transition.
|
|
67
|
+
*
|
|
68
|
+
* Note: We use instant transition (duration: 0) instead of relying on framer-motion's
|
|
69
|
+
* reducedMotion setting because framer-motion only disables transform/layout animations,
|
|
70
|
+
* but opacity/backgroundColor animations persist.
|
|
71
|
+
*/ const useMotionSafeTransition = (transition)=>{
|
|
72
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
73
|
+
return prefersReducedMotion ? motionTransition.instant : transition;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
// extracted by css-extract-rspack-plugin
|
|
82
|
+
/* export default */ var ExpandCollapseCaret = ({"sui-expand-collapse-caret-root":"sui-expand-collapse-caret-root","sui-expand-collapse-caret-vertical":"sui-expand-collapse-caret-vertical","sui-expand-collapse-caret-horizontal":"sui-expand-collapse-caret-horizontal"});
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
const motionVariants = {
|
|
91
|
+
expanded: {
|
|
92
|
+
d: 'M 4.5 12.8 L 9.85 7.525 L 15.1 12.8'
|
|
93
|
+
},
|
|
94
|
+
collapsed: {
|
|
95
|
+
d: 'M 4.5 7.5 L 9.85 12.9 L 15.15 7.55'
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const ExpandCollapseCaret_ExpandCollapseCaret = (props)=>{
|
|
99
|
+
const { size = 'small', orientation = 'vertical', expanded, classes, className, ...rest } = props;
|
|
100
|
+
const cls = useClasses('expand-collapse-caret', classes, className);
|
|
101
|
+
const transition = useMotionSafeTransition(motionTransition["spring-01-fast"]);
|
|
102
|
+
return /*#__PURE__*/ jsx(Icon_Icon, {
|
|
103
|
+
...rest,
|
|
104
|
+
size: size,
|
|
105
|
+
className: cls('root', orientation),
|
|
106
|
+
children: /*#__PURE__*/ jsx(motion.svg, {
|
|
107
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
108
|
+
viewBox: '0 0 20 20',
|
|
109
|
+
children: /*#__PURE__*/ jsx(motion.path, {
|
|
110
|
+
initial: false,
|
|
111
|
+
stroke: "currentColor",
|
|
112
|
+
strokeWidth: 1.5,
|
|
113
|
+
variants: motionVariants,
|
|
114
|
+
animate: expanded ? 'expanded' : 'collapsed',
|
|
115
|
+
transition: transition,
|
|
116
|
+
fill: "transparent"
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
export { ExpandCollapseCaret as expandCollapseCaretStyles, ExpandCollapseCaret_ExpandCollapseCaret as ExpandCollapseCaret, useMotionSafeTransition, usePrefersReducedMotion };
|
package/chunks/2956.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Provides information about the current step in Stepper.
|
|
7
|
+
*/ const StepContext = createContext({});
|
|
8
|
+
/**
|
|
9
|
+
* Returns the current StepContext or an empty object if no StepContext
|
|
10
|
+
* has been defined in the component tree.
|
|
11
|
+
*/ const useStepContext = ()=>useContext(StepContext);
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const StepperContext = createContext({});
|
|
16
|
+
const useStepperContext = ()=>useContext(StepperContext);
|
|
17
|
+
|
|
18
|
+
export { StepContext, StepperContext, useStepContext, useStepperContext };
|