@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/Switch.js
CHANGED
|
@@ -1,22 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef,
|
|
3
|
-
import { useSwitch } from
|
|
4
|
-
import { useClasses, useForkRef
|
|
5
|
-
import { useThemeProps } from
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useLayoutEffect, useRef } from "react";
|
|
3
|
+
import { useSwitch } from "@mui/base";
|
|
4
|
+
import { combineProps, useClasses, useForkRef } from "@ringcentral/spring-base";
|
|
5
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
6
|
+
import { useFormLabel } from "./FormLabel.js";
|
|
7
|
+
import { CircularProgressIndicator as CircularProgressIndicator_CircularProgressIndicator } from "./CircularProgressIndicator.js";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
// extracted by css-extract-rspack-plugin
|
|
15
|
+
/* export default */ var Switch = ({"sui-switch-root":"sui-switch-root","sui-focus-visible":"sui-focus-visible","sui-switch-track":"sui-switch-track","sui-switch-dot":"sui-switch-dot","sui-switch-input":"sui-switch-input","sui-checked":"sui-checked"});
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const Switch_Switch = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
25
|
+
const props = useThemeProps({
|
|
26
|
+
props: inProps,
|
|
27
|
+
name: 'Switch'
|
|
28
|
+
});
|
|
29
|
+
const { classes, className, inputRef: inputRefProp, inputProps: inputPropsProp, rootProps, /* ⬇️ for input */ checked: checkedProp, defaultChecked, disabled: disabledProp, autoFocus = false, onBlur, onChange, onFocus, onFocusVisible, required, loading = false, loadingProps, ...rest } = props;
|
|
15
30
|
const cls = useClasses('switch', classes, className);
|
|
16
31
|
const isDisabled = loading ? true : disabledProp;
|
|
17
32
|
const { disabled, id } = useFormLabel({
|
|
18
33
|
disabled: isDisabled,
|
|
19
|
-
id: inputPropsProp?.id
|
|
34
|
+
id: inputPropsProp?.id
|
|
20
35
|
});
|
|
21
36
|
const { getInputProps, focusVisible, checked } = useSwitch({
|
|
22
37
|
checked: checkedProp,
|
|
@@ -26,25 +41,57 @@ const Switch = forwardRef((inProps, ref) => {
|
|
|
26
41
|
onChange,
|
|
27
42
|
onFocus,
|
|
28
43
|
onFocusVisible,
|
|
29
|
-
required
|
|
44
|
+
required
|
|
30
45
|
});
|
|
31
46
|
const inputProps = getInputProps({
|
|
32
47
|
role: 'switch',
|
|
33
|
-
...inputPropsProp
|
|
48
|
+
...inputPropsProp
|
|
34
49
|
});
|
|
35
50
|
const inputRef = useRef();
|
|
36
51
|
const forkRef = useForkRef(inputRefProp, inputProps.ref, inputRef);
|
|
37
|
-
useLayoutEffect(()
|
|
52
|
+
useLayoutEffect(()=>{
|
|
38
53
|
if (autoFocus) {
|
|
39
54
|
inputRef.current?.focus();
|
|
40
55
|
}
|
|
56
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
|
41
57
|
}, []);
|
|
42
|
-
return
|
|
58
|
+
return /*#__PURE__*/ jsxs("span", {
|
|
59
|
+
...rootProps,
|
|
60
|
+
...rest,
|
|
61
|
+
className: cls('root', {
|
|
62
|
+
focusVisible
|
|
63
|
+
}),
|
|
64
|
+
ref: ref,
|
|
65
|
+
children: [
|
|
66
|
+
/*#__PURE__*/ jsx("input", {
|
|
67
|
+
...inputProps,
|
|
68
|
+
id: id,
|
|
69
|
+
className: cls('input', {
|
|
70
|
+
checked
|
|
71
|
+
}),
|
|
72
|
+
ref: forkRef
|
|
73
|
+
}),
|
|
74
|
+
/*#__PURE__*/ jsx("span", {
|
|
75
|
+
className: cls('track')
|
|
76
|
+
}),
|
|
77
|
+
/*#__PURE__*/ jsx("span", {
|
|
78
|
+
className: cls('dot'),
|
|
79
|
+
children: loading && /*#__PURE__*/ jsx(CircularProgressIndicator_CircularProgressIndicator, {
|
|
80
|
+
...combineProps({
|
|
43
81
|
variant: 'indeterminate',
|
|
44
82
|
size: 'small',
|
|
45
|
-
color: 'primary'
|
|
46
|
-
}, loadingProps)
|
|
83
|
+
color: 'primary'
|
|
84
|
+
}, loadingProps)
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
});
|
|
47
89
|
});
|
|
48
|
-
|
|
90
|
+
Switch_Switch.displayName = 'SuiSwitch';
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
49
96
|
|
|
50
|
-
export { Switch,
|
|
97
|
+
export { Switch as switchStyle, Switch_Switch as Switch };
|
package/Tab.js
CHANGED
|
@@ -1,102 +1,165 @@
|
|
|
1
|
-
import { jsx, jsxs } from
|
|
2
|
-
import { forwardRef,
|
|
3
|
-
import { useTab } from
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
3
|
+
import { useTab } from "@mui/base";
|
|
4
|
+
import { combineClasses, useForkRef } from "@ringcentral/spring-base";
|
|
5
|
+
import { useClassesWithMode, useThemeProps } from "@ringcentral/spring-theme";
|
|
6
|
+
import { Badge as Badge_Badge } from "./Badge.js";
|
|
7
|
+
import { Icon as Icon_Icon } from "./chunks/8307.js";
|
|
8
|
+
import { useTabsContext } from "./chunks/8809.js";
|
|
9
|
+
import "./Tooltip.js";
|
|
10
|
+
import { Tooltip } from "./chunks/4535.js";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
// extracted by css-extract-rspack-plugin
|
|
18
|
+
/* export default */ var Tab = ({"sui-tab-container":"sui-tab-container","sui-tab-pill-badge":"sui-tab-pill-badge","sui-tab-badge-root":"sui-tab-badge-root","sui-tab-root":"sui-tab-root","sui-selected":"sui-selected","sui-focus-visible":"sui-focus-visible","sui-tab-badge":"sui-tab-badge","sui-tab-label":"sui-tab-label","sui-tab-label-container":"sui-tab-label-container","sui-tab-label-text":"sui-tab-label-text","sui-tab-label-badge-root":"sui-tab-label-badge-root","sui-tab-icon":"sui-tab-icon","sui-tab-icon-container":"sui-tab-icon-container","sui-tab-icon-pill":"sui-tab-icon-pill","sui-tab-icon-badge-root":"sui-tab-icon-badge-root","sui-tab-large":"sui-tab-large","sui-tab-pill":"sui-tab-pill","sui-tab-pill-small":"sui-tab-pill-small","sui-tab-label-pill-cobranding":"sui-tab-label-pill-cobranding","sui-tab-icon-pill-cobranding":"sui-tab-icon-pill-cobranding","sui-compact":"sui-compact"});
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Tab component for use within TabContext and Tabs.
|
|
31
|
+
*
|
|
32
|
+
* **IMPORTANT**: It is strongly recommended to provide a unique `id` prop for each Tab.
|
|
33
|
+
* - Unique ids are required for accessibility and correct tab-panel linking
|
|
34
|
+
* - If no `id` is provided, each Tab element will be cloned to provide an auto-generated id, which may have a performance cost
|
|
35
|
+
* - The warning "Tab component missing recommended 'id' prop" will be shown when `id` is not provided
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <TabContext defaultValue={0}>
|
|
40
|
+
* <Tabs>
|
|
41
|
+
* <Tab id="tab-dialpad" label="Dialpad" value={0} />
|
|
42
|
+
* <Tab id="tab-history" label="History" value={1} />
|
|
43
|
+
* </Tabs>
|
|
44
|
+
* <TabPanel value={0}>Dialpad Content</TabPanel>
|
|
45
|
+
* <TabPanel value={1}>History Content</TabPanel>
|
|
46
|
+
* </TabContext>
|
|
47
|
+
* ```
|
|
48
|
+
*/ const Tab_Tab = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
49
|
+
const props = useThemeProps({
|
|
50
|
+
props: inProps,
|
|
51
|
+
name: 'Tab'
|
|
52
|
+
});
|
|
28
53
|
const { classes, className, children: childrenProp, action, onChange, variant = 'label', color: colorProp, label, symbol, TooltipProps, BadgeProps: badgePropsProp, title, style, value, ...rest } = props;
|
|
29
54
|
const tabRef = useRef(null);
|
|
30
55
|
const handleRef = useForkRef(tabRef, ref);
|
|
31
|
-
const { pill, pillGap, color: contextColor, size: contextSize, setFloatingUnderlineVisibility
|
|
56
|
+
const { pill, pillGap, color: contextColor, size: contextSize, setFloatingUnderlineVisibility } = useTabsContext();
|
|
32
57
|
const color = colorProp ?? contextColor ?? 'default';
|
|
33
58
|
const size = contextSize ?? 'medium';
|
|
34
|
-
const { active, focusVisible, setFocusVisible, selected, getRootProps, index
|
|
59
|
+
const { active, focusVisible, setFocusVisible, selected, getRootProps, index } = useTab({
|
|
35
60
|
...rest,
|
|
36
61
|
value,
|
|
37
|
-
rootRef: handleRef
|
|
62
|
+
rootRef: handleRef
|
|
38
63
|
});
|
|
39
|
-
useEffect(()
|
|
40
|
-
if (!setFloatingUnderlineVisibility)
|
|
41
|
-
return;
|
|
64
|
+
useEffect(()=>{
|
|
65
|
+
if (!setFloatingUnderlineVisibility) return;
|
|
42
66
|
if (focusVisible && selected) {
|
|
67
|
+
// Hide the floating underline when the currently selected tab is also focused
|
|
43
68
|
setFloatingUnderlineVisibility(false);
|
|
44
|
-
}
|
|
45
|
-
|
|
69
|
+
} else if (selected) {
|
|
70
|
+
// Show the floating underline when this tab is selected but not focused
|
|
46
71
|
setFloatingUnderlineVisibility(true);
|
|
47
72
|
}
|
|
48
|
-
}, [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
73
|
+
}, [
|
|
74
|
+
focusVisible,
|
|
75
|
+
selected,
|
|
76
|
+
setFloatingUnderlineVisibility
|
|
77
|
+
]);
|
|
78
|
+
useImperativeHandle(action, ()=>({
|
|
79
|
+
focusVisible: ()=>{
|
|
80
|
+
setFocusVisible(true);
|
|
81
|
+
tabRef.current?.focus();
|
|
82
|
+
}
|
|
83
|
+
}), [
|
|
84
|
+
setFocusVisible
|
|
85
|
+
]);
|
|
55
86
|
const cls = useClassesWithMode('tab', classes, className);
|
|
56
87
|
let children = null;
|
|
57
88
|
if (childrenProp) {
|
|
58
89
|
children = childrenProp;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
90
|
+
} else {
|
|
61
91
|
let badgeClasses = {
|
|
62
92
|
root: cls('badge-root', `${variant}-badge-root`, pill && 'pill-badge', pill && `${variant}-pill-badge`),
|
|
63
|
-
content: cls('badge', `${variant}-badge`)
|
|
93
|
+
content: cls('badge', `${variant}-badge`)
|
|
64
94
|
};
|
|
65
95
|
if (badgePropsProp?.classes) {
|
|
66
96
|
badgeClasses = combineClasses(badgeClasses, badgePropsProp.classes);
|
|
67
97
|
}
|
|
68
98
|
let content = null;
|
|
69
99
|
if (variant === 'label' && label) {
|
|
70
|
-
content =
|
|
100
|
+
content = /*#__PURE__*/ jsx("span", {
|
|
101
|
+
className: cls('text', `${variant}-text`),
|
|
102
|
+
children: label
|
|
103
|
+
});
|
|
71
104
|
}
|
|
72
105
|
if (variant === 'icon' && symbol) {
|
|
73
|
-
content = jsx(
|
|
106
|
+
content = /*#__PURE__*/ jsx(Icon_Icon, {
|
|
107
|
+
size: "small",
|
|
108
|
+
symbol: symbol
|
|
109
|
+
});
|
|
74
110
|
}
|
|
75
111
|
const badgeProps = badgePropsProp && {
|
|
76
112
|
color: selected ? 'primary' : 'secondary',
|
|
77
113
|
variant: pill ? 'outlined' : 'contained',
|
|
78
114
|
size: badgePropsProp?.type === 'dot' ? 'medium' : badgePropsProp?.size,
|
|
79
115
|
...badgePropsProp,
|
|
80
|
-
classes: badgeClasses
|
|
116
|
+
classes: badgeClasses
|
|
81
117
|
};
|
|
82
|
-
children =
|
|
118
|
+
children = /*#__PURE__*/ jsxs("div", {
|
|
119
|
+
className: cls('container', `${variant}-container`),
|
|
120
|
+
children: [
|
|
121
|
+
content,
|
|
122
|
+
badgeProps && /*#__PURE__*/ jsx(Badge_Badge, {
|
|
123
|
+
...badgeProps
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
});
|
|
83
127
|
}
|
|
84
128
|
const tooltipTitle = title || (typeof label === 'string' ? label : undefined);
|
|
85
129
|
const nativeTitle = variant === 'label' ? tooltipTitle : undefined;
|
|
86
|
-
const tab =
|
|
130
|
+
const tab = /*#__PURE__*/ jsx("button", {
|
|
131
|
+
className: cls('root', variant, {
|
|
87
132
|
pill,
|
|
88
133
|
active,
|
|
89
134
|
focusVisible,
|
|
90
|
-
selected
|
|
91
|
-
}, size, pill && `pill-${size}`, pill && `${variant}-pill`, pill && color !== 'default' && `${variant}-pill-${color}`),
|
|
135
|
+
selected
|
|
136
|
+
}, size, pill && `pill-${size}`, pill && `${variant}-pill`, pill && color !== 'default' && `${variant}-pill-${color}`),
|
|
137
|
+
title: nativeTitle,
|
|
138
|
+
tabIndex: selected ? 0 : -1,
|
|
139
|
+
style: {
|
|
92
140
|
...style,
|
|
93
|
-
...
|
|
94
|
-
|
|
141
|
+
...pill && index !== 0 ? {
|
|
142
|
+
marginLeft: `${pillGap}px`
|
|
143
|
+
} : {}
|
|
144
|
+
},
|
|
145
|
+
...getRootProps(rest),
|
|
146
|
+
onChange: onChange,
|
|
147
|
+
children: children
|
|
148
|
+
});
|
|
95
149
|
if (variant === 'label') {
|
|
96
150
|
return tab;
|
|
97
151
|
}
|
|
98
|
-
return
|
|
152
|
+
return /*#__PURE__*/ jsx(Tooltip, {
|
|
153
|
+
...TooltipProps,
|
|
154
|
+
title: tooltipTitle,
|
|
155
|
+
children: tab
|
|
156
|
+
});
|
|
99
157
|
});
|
|
100
|
-
|
|
158
|
+
Tab_Tab.displayName = 'SuiTab';
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
101
164
|
|
|
102
|
-
export { Tab,
|
|
165
|
+
export { Tab as tabStyle, Tab_Tab as Tab };
|
package/TabContext.js
CHANGED
|
@@ -1,29 +1,73 @@
|
|
|
1
|
-
import { jsx } from
|
|
2
|
-
import { useTabs,
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TabsProvider, useTabs, useTabsContext } from "@mui/base";
|
|
3
|
+
import { createContext, useContext, useMemo } from "react";
|
|
4
|
+
import { useId } from "@ringcentral/spring-base";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
// Create a separate context for internal use that both Tab and TabPanel can access
|
|
15
|
+
const InternalTabsContext = /*#__PURE__*/ createContext({
|
|
16
|
+
tabsInstanceId: undefined
|
|
17
|
+
});
|
|
18
|
+
const useInternalTabsContext = ()=>useContext(InternalTabsContext);
|
|
19
|
+
/**
|
|
20
|
+
* Generate stable IDs for tab and tabpanel pairs
|
|
21
|
+
* This ensures consistent IDs regardless of whether the tab is visible or in more menu
|
|
22
|
+
*/ const generateTabStableIds = (tabsInstanceId, identifier)=>{
|
|
10
23
|
const prefix = tabsInstanceId || 'Tabs';
|
|
11
24
|
return {
|
|
12
25
|
tabId: `${prefix}-tab-${identifier}`,
|
|
13
|
-
panelId: `${prefix}-tabpanel-${identifier}
|
|
26
|
+
panelId: `${prefix}-tabpanel-${identifier}`
|
|
14
27
|
};
|
|
15
28
|
};
|
|
16
|
-
const useTabStableIds = (identifier)
|
|
29
|
+
const useTabStableIds = (identifier)=>{
|
|
17
30
|
const { tabsInstanceId } = useInternalTabsContext();
|
|
18
31
|
return generateTabStableIds(tabsInstanceId, identifier);
|
|
19
32
|
};
|
|
20
|
-
|
|
33
|
+
/**
|
|
34
|
+
* TabContext provides the context for Tab and TabPanel components.
|
|
35
|
+
*
|
|
36
|
+
* **IMPORTANT**: When using Tab, Tabs, and TabPanel components, you MUST wrap them with TabContext.
|
|
37
|
+
* TabContext manages the state and coordination between tabs and their panels.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <TabContext defaultValue={0}>
|
|
42
|
+
* <Tabs>
|
|
43
|
+
* <Tab label="Tab 1" value={0} />
|
|
44
|
+
* <Tab label="Tab 2" value={1} />
|
|
45
|
+
* </Tabs>
|
|
46
|
+
* <TabPanel value={0}>Content 1</TabPanel>
|
|
47
|
+
* <TabPanel value={1}>Content 2</TabPanel>
|
|
48
|
+
* </TabContext>
|
|
49
|
+
* ```
|
|
50
|
+
*/ const TabContext = (props)=>{
|
|
21
51
|
const { children } = props;
|
|
22
52
|
const { contextValue } = useTabs(props);
|
|
23
53
|
const generatedTabsInstanceId = useId('Tabs', true);
|
|
24
|
-
const internalContextValue = useMemo(()
|
|
25
|
-
|
|
54
|
+
const internalContextValue = useMemo(()=>({
|
|
55
|
+
tabsInstanceId: generatedTabsInstanceId
|
|
56
|
+
}), [
|
|
57
|
+
generatedTabsInstanceId
|
|
58
|
+
]);
|
|
59
|
+
return /*#__PURE__*/ jsx(TabsProvider, {
|
|
60
|
+
value: contextValue,
|
|
61
|
+
children: /*#__PURE__*/ jsx(InternalTabsContext.Provider, {
|
|
62
|
+
value: internalContextValue,
|
|
63
|
+
children: children
|
|
64
|
+
})
|
|
65
|
+
});
|
|
26
66
|
};
|
|
27
67
|
TabContext.displayName = 'SuiTabContext';
|
|
28
68
|
|
|
29
|
-
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
export { TabContext, generateTabStableIds, useInternalTabsContext, useTabStableIds, useTabsContext as useTabContext };
|
package/TabPanel.js
CHANGED
|
@@ -1,26 +1,53 @@
|
|
|
1
|
-
import { jsx } from
|
|
2
|
-
import { forwardRef } from
|
|
3
|
-
import { useTabPanel } from
|
|
4
|
-
import {
|
|
5
|
-
import { useThemeProps } from
|
|
6
|
-
import { useTabStableIds } from
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useTabPanel } from "@mui/base";
|
|
4
|
+
import { useClasses, useEver } from "@ringcentral/spring-base";
|
|
5
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
6
|
+
import { useTabStableIds } from "./TabContext.js";
|
|
7
7
|
|
|
8
|
-
var TabPanel$1 = {};
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// extracted by css-extract-rspack-plugin
|
|
14
|
+
/* export default */ var TabPanel = ({});
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
const TabPanel_TabPanel = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
23
|
+
const props = useThemeProps({
|
|
24
|
+
props: inProps,
|
|
25
|
+
name: 'TabPanel'
|
|
26
|
+
});
|
|
12
27
|
const { classes, className, children, value, keepMounted, id, ...rest } = props;
|
|
13
28
|
const { panelId } = useTabStableIds(value);
|
|
14
29
|
const { hidden, getRootProps } = useTabPanel({
|
|
15
30
|
...props,
|
|
16
|
-
id: id ?? panelId
|
|
31
|
+
id: id ?? panelId
|
|
17
32
|
});
|
|
18
33
|
const isEverShown = useEver(!hidden);
|
|
19
34
|
const keepAlive = keepMounted && isEverShown;
|
|
20
35
|
const unmount = hidden && !keepAlive;
|
|
21
36
|
const cls = useClasses('tab-panel', classes, className);
|
|
22
|
-
return
|
|
37
|
+
return /*#__PURE__*/ jsx("div", {
|
|
38
|
+
role: "tabpanel",
|
|
39
|
+
className: cls('root'),
|
|
40
|
+
...rest,
|
|
41
|
+
...getRootProps(),
|
|
42
|
+
ref: ref,
|
|
43
|
+
children: !unmount && children
|
|
44
|
+
});
|
|
23
45
|
});
|
|
24
|
-
|
|
46
|
+
TabPanel_TabPanel.displayName = 'SuiTabPanel';
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
25
52
|
|
|
26
|
-
export { TabPanel,
|
|
53
|
+
export { TabPanel as tabPanelStyle, TabPanel_TabPanel as TabPanel };
|
package/Table.js
CHANGED
|
@@ -1,24 +1,67 @@
|
|
|
1
|
-
import { jsx } from
|
|
2
|
-
import { forwardRef, useMemo } from
|
|
3
|
-
import { useClasses } from
|
|
4
|
-
import { useThemeProps } from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo } from "react";
|
|
3
|
+
import { useClasses } from "@ringcentral/spring-base";
|
|
4
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
5
|
+
import { TableContext } from "./chunks/7279.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// extracted by css-extract-rspack-plugin
|
|
12
|
+
/* export default */ var Table = ({"sui-table-root":"sui-table-root","sui-table-sticky-header":"sui-table-sticky-header","sui-table-sticky-footer":"sui-table-sticky-footer"});
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
8
17
|
|
|
9
|
-
var Table$1 = {"sui-table-root":"sui-table-root","sui-table-sticky-header":"sui-table-sticky-header","sui-table-sticky-footer":"sui-table-sticky-footer"};
|
|
10
18
|
|
|
11
19
|
const defaultComponent = 'table';
|
|
12
|
-
const
|
|
13
|
-
const props = useThemeProps({
|
|
14
|
-
|
|
20
|
+
const Table_Table = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
21
|
+
const props = useThemeProps({
|
|
22
|
+
props: inProps,
|
|
23
|
+
name: 'Table'
|
|
24
|
+
});
|
|
25
|
+
const { component: TableRoot = defaultComponent, classes, className, children, stickyHeader = false, stickyFooter = false, columnDivider = false, rowDivider = true, size = 'medium', ...rest } = props;
|
|
15
26
|
const cls = useClasses('table', classes, className);
|
|
16
|
-
const table = useMemo(()
|
|
17
|
-
|
|
27
|
+
const table = useMemo(()=>({
|
|
28
|
+
stickyHeader,
|
|
29
|
+
stickyFooter,
|
|
30
|
+
columnDivider,
|
|
31
|
+
rowDivider,
|
|
32
|
+
size
|
|
33
|
+
}), [
|
|
34
|
+
stickyHeader,
|
|
35
|
+
stickyFooter,
|
|
36
|
+
columnDivider,
|
|
37
|
+
rowDivider,
|
|
38
|
+
size
|
|
39
|
+
]);
|
|
40
|
+
return /*#__PURE__*/ jsx(TableContext.Provider, {
|
|
41
|
+
value: table,
|
|
42
|
+
children: /*#__PURE__*/ jsx(TableRoot, {
|
|
43
|
+
role: TableRoot === defaultComponent ? undefined : 'table',
|
|
44
|
+
className: cls('root', {
|
|
18
45
|
'sticky-header': stickyHeader,
|
|
19
|
-
'sticky-footer': stickyFooter
|
|
20
|
-
}),
|
|
46
|
+
'sticky-footer': stickyFooter
|
|
47
|
+
}),
|
|
48
|
+
...rest,
|
|
49
|
+
ref: ref,
|
|
50
|
+
children: children
|
|
51
|
+
})
|
|
52
|
+
});
|
|
21
53
|
});
|
|
22
|
-
|
|
54
|
+
Table_Table.displayName = 'SuiTable';
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
23
63
|
|
|
24
|
-
export { Table
|
|
64
|
+
export { Table as tableStyle, Table_Table as Table };
|
|
65
|
+
export { TableContext, useTableContext } from "./chunks/7279.js";
|
|
66
|
+
export { TableRowContext, useTableRowContext } from "./chunks/987.js";
|
|
67
|
+
export { Tablelvl2Context, useTablelvl2Context } from "./chunks/8011.js";
|
package/TableBody.js
CHANGED
|
@@ -1,20 +1,50 @@
|
|
|
1
|
-
import { jsx, jsxs } from
|
|
2
|
-
import { forwardRef } from
|
|
3
|
-
import { useClasses } from
|
|
4
|
-
import { useThemeProps } from
|
|
5
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useClasses } from "@ringcentral/spring-base";
|
|
4
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
5
|
+
import { useTableContext } from "./chunks/7279.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// extracted by css-extract-rspack-plugin
|
|
12
|
+
/* export default */ var TableBody = ({"sui-table-body-root":"sui-table-body-root"});
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
|
|
7
|
-
var TableBody$1 = {"sui-table-body-root":"sui-table-body-root"};
|
|
8
18
|
|
|
9
19
|
const defaultComponent = 'tbody';
|
|
10
|
-
const
|
|
11
|
-
const props = useThemeProps({
|
|
20
|
+
const TableBody_TableBody = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
21
|
+
const props = useThemeProps({
|
|
22
|
+
props: inProps,
|
|
23
|
+
name: 'TableBody'
|
|
24
|
+
});
|
|
12
25
|
const { component: TableBodyRoot = defaultComponent, classes, className, children, ...rest } = props;
|
|
13
26
|
const cls = useClasses('table-body', classes, className);
|
|
14
27
|
const table = useTableContext();
|
|
15
|
-
const fillerRowForStickyFooter = table && table.stickyFooter ?
|
|
16
|
-
|
|
28
|
+
const fillerRowForStickyFooter = table && table.stickyFooter ? /*#__PURE__*/ jsx("tr", {
|
|
29
|
+
"aria-hidden": true,
|
|
30
|
+
className: "invisible"
|
|
31
|
+
}) : null; // If the table has a sticky footer, we need to add an empty row to prevent any row from stretching vertically.
|
|
32
|
+
return /*#__PURE__*/ jsxs(TableBodyRoot, {
|
|
33
|
+
role: TableBodyRoot === defaultComponent ? undefined : 'rowgroup',
|
|
34
|
+
className: cls('root'),
|
|
35
|
+
...rest,
|
|
36
|
+
ref: ref,
|
|
37
|
+
children: [
|
|
38
|
+
children,
|
|
39
|
+
fillerRowForStickyFooter
|
|
40
|
+
]
|
|
41
|
+
});
|
|
17
42
|
});
|
|
18
|
-
|
|
43
|
+
TableBody_TableBody.displayName = 'SuiTableBody';
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
19
49
|
|
|
20
|
-
export { TableBody,
|
|
50
|
+
export { TableBody as tableBodyStyle, TableBody_TableBody as TableBody };
|