@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/InlineEditable.js
CHANGED
|
@@ -1,48 +1,52 @@
|
|
|
1
|
-
import { jsx, jsxs } from
|
|
2
|
-
import { forwardRef,
|
|
3
|
-
import { TextareaAutosize } from
|
|
4
|
-
import { useControlled,
|
|
5
|
-
import { useThemeProps } from
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useRef } from "react";
|
|
3
|
+
import { TextareaAutosize } from "@mui/base";
|
|
4
|
+
import { useClasses, useControlled, useForkRef, usePrevious, useWindowContext } from "@ringcentral/spring-base";
|
|
5
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
6
|
+
import { useTooltipForceHide } from "./Tooltip.js";
|
|
7
|
+
import { Tooltip } from "./chunks/4535.js";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
// extracted by css-extract-rspack-plugin
|
|
15
|
+
/* export default */ var InlineEditable = ({"sui-inline-editable-root":"sui-inline-editable-root","sui-inline-editable-full-width":"sui-inline-editable-full-width","sui-inline-editable-input":"sui-inline-editable-input","sui-inline-editable-textarea":"sui-inline-editable-textarea","sui-disabled":"sui-disabled","sui-inline-editable-text":"sui-inline-editable-text","sui-inline-editable-standard":"sui-inline-editable-standard","sui-inline-editable-standard-input":"sui-inline-editable-standard-input","sui-inline-editable-standard-textarea":"sui-inline-editable-standard-textarea","sui-inline-editable-outlined":"sui-inline-editable-outlined","sui-inline-editable-outlined-input":"sui-inline-editable-outlined-input","sui-inline-editable-outlined-textarea":"sui-inline-editable-outlined-textarea"});
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const InlineEditable_InlineEditable = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
24
|
+
const props = useThemeProps({
|
|
25
|
+
props: inProps,
|
|
26
|
+
name: 'InlineEditable'
|
|
27
|
+
});
|
|
24
28
|
const { classes, className, children, variant = 'standard', multiline, value, defaultEditing, isEditing: isEditingProp, onEditStart, onEditComplete, onEditConfirm, onEditCancel, disabled, fullWidth, TooltipProps, placeholder, onFocus, onKeyDown, onBlur, rootProps, ...rest } = props;
|
|
25
29
|
const [isEditing, setEditing] = useControlled({
|
|
26
30
|
controlled: isEditingProp,
|
|
27
31
|
default: defaultEditing,
|
|
28
32
|
name: 'SuiInlineEditable',
|
|
29
|
-
state: 'isEditing'
|
|
33
|
+
state: 'isEditing'
|
|
30
34
|
});
|
|
31
35
|
const Component = multiline ? TextareaAutosize : 'input';
|
|
32
36
|
const cls = useClasses('inline-editable', classes, className);
|
|
33
37
|
const valueBeforeEditing = useRef(value);
|
|
34
|
-
const previousIsEditing = usePrevious(()
|
|
38
|
+
const previousIsEditing = usePrevious(()=>isEditing);
|
|
35
39
|
const inputRef = useRef(null);
|
|
36
40
|
const handleRef = useForkRef(inputRef, ref);
|
|
37
|
-
const handleFocus = (e)
|
|
41
|
+
const handleFocus = (e)=>{
|
|
38
42
|
onFocus?.(e);
|
|
39
43
|
valueBeforeEditing.current = value;
|
|
40
44
|
setEditing(true);
|
|
41
45
|
onEditStart?.();
|
|
42
46
|
};
|
|
43
|
-
const handleEditComplete = (e, reason, values)
|
|
47
|
+
const handleEditComplete = (e, reason, values)=>{
|
|
44
48
|
onEditComplete?.(e, reason, values);
|
|
45
|
-
switch
|
|
49
|
+
switch(reason){
|
|
46
50
|
case 'Enter':
|
|
47
51
|
case 'Blur':
|
|
48
52
|
onEditConfirm?.(e, reason, values);
|
|
@@ -50,45 +54,95 @@ const InlineEditable = forwardRef((inProps, ref) => {
|
|
|
50
54
|
case 'Escape':
|
|
51
55
|
onEditCancel?.(e, reason, values);
|
|
52
56
|
break;
|
|
57
|
+
default:
|
|
58
|
+
break;
|
|
53
59
|
}
|
|
54
60
|
};
|
|
55
|
-
const handleKeyDown = (e)
|
|
61
|
+
const handleKeyDown = (e)=>{
|
|
56
62
|
onKeyDown?.(e);
|
|
57
63
|
const { key, shiftKey } = e;
|
|
58
|
-
|
|
64
|
+
// Enter + Shift in textarea creates a new line
|
|
65
|
+
if (!isEditing || multiline && key === 'Enter' && shiftKey) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
// During IME composition, Enter confirms the composed candidate instead of
|
|
69
|
+
// submitting the editable. Only end editing once composition has finished.
|
|
70
|
+
if (key === 'Enter' && (e.nativeEvent.isComposing || e.nativeEvent.which === 229)) {
|
|
59
71
|
return;
|
|
60
72
|
}
|
|
61
|
-
if ([
|
|
73
|
+
if ([
|
|
74
|
+
'Enter',
|
|
75
|
+
'Escape'
|
|
76
|
+
].includes(key)) {
|
|
62
77
|
setEditing(false);
|
|
63
78
|
handleEditComplete(e, key, {
|
|
64
79
|
currentValue: value,
|
|
65
|
-
previousValue: valueBeforeEditing.current
|
|
80
|
+
previousValue: valueBeforeEditing.current
|
|
66
81
|
});
|
|
67
82
|
}
|
|
68
83
|
};
|
|
69
|
-
const handleBlur = (e)
|
|
84
|
+
const handleBlur = (e)=>{
|
|
70
85
|
onBlur?.(e);
|
|
71
|
-
if (!isEditing)
|
|
72
|
-
return;
|
|
86
|
+
if (!isEditing) return;
|
|
73
87
|
setEditing(false);
|
|
74
88
|
handleEditComplete(e, 'Blur', {
|
|
75
89
|
currentValue: value,
|
|
76
|
-
previousValue: valueBeforeEditing.current
|
|
90
|
+
previousValue: valueBeforeEditing.current
|
|
77
91
|
});
|
|
78
92
|
};
|
|
79
93
|
const { document } = useWindowContext();
|
|
80
|
-
useEffect(()
|
|
94
|
+
useEffect(()=>{
|
|
81
95
|
if (previousIsEditing && !isEditing && inputRef.current) {
|
|
96
|
+
// * enter/esc should blur the input (tab does this automatically)
|
|
82
97
|
document?.activeElement === inputRef.current && inputRef.current.blur();
|
|
83
98
|
}
|
|
84
|
-
|
|
99
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
|
100
|
+
}, [
|
|
101
|
+
isEditing,
|
|
102
|
+
previousIsEditing
|
|
103
|
+
]);
|
|
104
|
+
// close tooltip temporarily during editing
|
|
85
105
|
const tooltipOpenProps = useTooltipForceHide(isEditing);
|
|
86
106
|
const slot = multiline ? 'textarea' : 'input';
|
|
87
|
-
const editableContent =
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}),
|
|
107
|
+
const editableContent = /*#__PURE__*/ jsx(Component, {
|
|
108
|
+
className: cls(slot, `${variant}-${slot}`, {
|
|
109
|
+
disabled
|
|
110
|
+
}),
|
|
111
|
+
value: value,
|
|
112
|
+
autoComplete: "off",
|
|
113
|
+
placeholder: placeholder,
|
|
114
|
+
ref: handleRef,
|
|
115
|
+
onFocus: handleFocus,
|
|
116
|
+
onKeyDown: handleKeyDown,
|
|
117
|
+
onBlur: handleBlur,
|
|
118
|
+
disabled: disabled,
|
|
119
|
+
"aria-label": TooltipProps?.['title'],
|
|
120
|
+
...rest,
|
|
121
|
+
children: children
|
|
122
|
+
});
|
|
123
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
124
|
+
className: cls('root', variant, {
|
|
125
|
+
'full-width': fullWidth || multiline
|
|
126
|
+
}),
|
|
127
|
+
...rootProps,
|
|
128
|
+
children: [
|
|
129
|
+
disabled || !TooltipProps?.title ? editableContent : /*#__PURE__*/ jsx(Tooltip, {
|
|
130
|
+
...TooltipProps,
|
|
131
|
+
...tooltipOpenProps,
|
|
132
|
+
children: editableContent
|
|
133
|
+
}),
|
|
134
|
+
/*#__PURE__*/ jsx("span", {
|
|
135
|
+
className: cls('text'),
|
|
136
|
+
children: value || placeholder
|
|
137
|
+
})
|
|
138
|
+
]
|
|
139
|
+
});
|
|
91
140
|
});
|
|
92
|
-
|
|
141
|
+
InlineEditable_InlineEditable.displayName = 'SuiInlineEditable';
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
93
147
|
|
|
94
|
-
export { InlineEditable,
|
|
148
|
+
export { InlineEditable as inlineEditableStyle, InlineEditable_InlineEditable as InlineEditable };
|
|
@@ -1,45 +1,94 @@
|
|
|
1
|
-
import { jsx, jsxs } from
|
|
2
|
-
import { forwardRef } from
|
|
3
|
-
import clsx from
|
|
4
|
-
import { useClasses, useId } from
|
|
5
|
-
import { useThemeProps } from
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { useClasses, useId } from "@ringcentral/spring-base";
|
|
5
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
6
6
|
|
|
7
|
-
var LinearProgressIndicator$1 = {"sui-linear-progress-indicator-root":"sui-linear-progress-indicator-root","sui-linear-progress-indicator-determinate-track":"sui-linear-progress-indicator-determinate-track","sui-linear-progress-indicator-determinate-track-slim":"sui-linear-progress-indicator-determinate-track-slim","sui-linear-progress-indicator-determinate-bar":"sui-linear-progress-indicator-determinate-bar","sui-linear-progress-indicator-determinate-label":"sui-linear-progress-indicator-determinate-label","sui-linear-progress-indicator-determinate-details-container":"sui-linear-progress-indicator-determinate-details-container","sui-linear-progress-indicator-determinate-details-label":"sui-linear-progress-indicator-determinate-details-label"};
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
// extracted by css-extract-rspack-plugin
|
|
13
|
+
/* export default */ var LinearProgressIndicator = ({"sui-linear-progress-indicator-root":"sui-linear-progress-indicator-root","sui-linear-progress-indicator-determinate-track":"sui-linear-progress-indicator-determinate-track","sui-linear-progress-indicator-determinate-track-slim":"sui-linear-progress-indicator-determinate-track-slim","sui-linear-progress-indicator-determinate-bar":"sui-linear-progress-indicator-determinate-bar","sui-linear-progress-indicator-determinate-label":"sui-linear-progress-indicator-determinate-label","sui-linear-progress-indicator-determinate-details-container":"sui-linear-progress-indicator-determinate-details-container","sui-linear-progress-indicator-determinate-details-label":"sui-linear-progress-indicator-determinate-details-label"});
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const LinearProgressIndicator_LinearProgressIndicator = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
10
21
|
const props = useThemeProps({
|
|
11
22
|
props: inProps,
|
|
12
|
-
name: 'LinearProgressIndicator'
|
|
23
|
+
name: 'LinearProgressIndicator'
|
|
13
24
|
});
|
|
14
25
|
const { classes, className, children, variant, slim = false, min = 0, max, value, label, details, showPercentage = false, progressBarProps: progressBarPropsProp, ...rest } = props;
|
|
15
26
|
const cls = useClasses('linear-progress-indicator', classes, className);
|
|
16
27
|
const labelId = useId();
|
|
17
28
|
const progressBarProps = progressBarPropsProp || {};
|
|
18
29
|
const progressBarLabelledBy = progressBarProps['aria-labelledby'];
|
|
19
|
-
if (max === undefined || value === undefined)
|
|
20
|
-
return null;
|
|
30
|
+
if (max === undefined || value === undefined) return null;
|
|
21
31
|
progressBarProps['aria-valuenow'] = value;
|
|
22
32
|
let labelNode = label;
|
|
23
33
|
if (typeof props.label === 'string') {
|
|
24
|
-
labelNode =
|
|
34
|
+
labelNode = /*#__PURE__*/ jsx("span", {
|
|
35
|
+
id: progressBarLabelledBy || labelId,
|
|
36
|
+
className: cls('label', `${variant}-label`),
|
|
37
|
+
children: props.label
|
|
38
|
+
});
|
|
25
39
|
progressBarProps['aria-labelledby'] = progressBarLabelledBy || labelId;
|
|
26
40
|
}
|
|
27
41
|
let detailsNode = details;
|
|
28
42
|
if (typeof details === 'string') {
|
|
29
|
-
detailsNode =
|
|
43
|
+
detailsNode = /*#__PURE__*/ jsx("span", {
|
|
44
|
+
className: cls('details-label', `${variant}-details-label`),
|
|
45
|
+
children: details
|
|
46
|
+
});
|
|
30
47
|
}
|
|
31
|
-
if (min !== 0)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
progressBarProps['aria-valuemax'] = max;
|
|
35
|
-
const percentage = Math.round((100 / max) * value);
|
|
48
|
+
if (min !== 0) progressBarProps['aria-valuemin'] = min;
|
|
49
|
+
if (max !== 100) progressBarProps['aria-valuemax'] = max;
|
|
50
|
+
const percentage = Math.round(100 / max * value);
|
|
36
51
|
const { className: progressBarClassName, ...restProgressBarProps } = progressBarProps;
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
return /*#__PURE__*/ jsxs("span", {
|
|
53
|
+
className: cls('root', variant, {
|
|
54
|
+
slim
|
|
55
|
+
}),
|
|
56
|
+
...rest,
|
|
57
|
+
ref: ref,
|
|
58
|
+
children: [
|
|
59
|
+
labelNode,
|
|
60
|
+
/*#__PURE__*/ jsx("span", {
|
|
61
|
+
className: clsx(cls('track', `${variant}-track`, slim && `${variant}-track-slim`), progressBarClassName),
|
|
62
|
+
role: "progressbar",
|
|
63
|
+
...restProgressBarProps,
|
|
64
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
65
|
+
className: cls('bar', `${variant}-bar`),
|
|
66
|
+
style: {
|
|
67
|
+
width: `${percentage}%`
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
}),
|
|
71
|
+
(!!detailsNode || showPercentage) && /*#__PURE__*/ jsxs("span", {
|
|
72
|
+
className: cls('details-container', `${variant}-details-container`),
|
|
73
|
+
children: [
|
|
74
|
+
detailsNode,
|
|
75
|
+
showPercentage && /*#__PURE__*/ jsxs("span", {
|
|
76
|
+
className: cls('details-label', `${variant}-details-label`),
|
|
77
|
+
children: [
|
|
78
|
+
percentage,
|
|
79
|
+
"%"
|
|
80
|
+
]
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
});
|
|
42
86
|
});
|
|
43
|
-
|
|
87
|
+
LinearProgressIndicator_LinearProgressIndicator.displayName = 'SuiLinearProgressIndicator';
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
44
93
|
|
|
45
|
-
export { LinearProgressIndicator,
|
|
94
|
+
export { LinearProgressIndicator as linearProgressIndicatorStyle, LinearProgressIndicator_LinearProgressIndicator as LinearProgressIndicator };
|
package/Link.js
CHANGED
|
@@ -1,18 +1,47 @@
|
|
|
1
|
-
import { jsx } from
|
|
2
|
-
import { forwardRef } from
|
|
3
|
-
import { useClasses, useFocusVisible, useForkRef } from
|
|
4
|
-
import { useThemeProps } from
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useClasses, useFocusVisible, useForkRef } from "@ringcentral/spring-base";
|
|
4
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
5
5
|
|
|
6
|
-
var Link$1 = {"sui-link-root":"sui-link-root","sui-focus-visible":"sui-focus-visible","sui-link-none":"sui-link-none","sui-link-hover":"sui-link-hover","sui-link-always":"sui-link-always","sui-link":"sui-link","sui-link-primary":"sui-link-primary","sui-link-secondary":"sui-link-secondary","sui-link-inverted":"sui-link-inverted"};
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// extracted by css-extract-rspack-plugin
|
|
11
|
+
/* export default */ var Link = ({"sui-link-root":"sui-link-root","sui-focus-visible":"sui-focus-visible","sui-link-none":"sui-link-none","sui-link-hover":"sui-link-hover","sui-link-always":"sui-link-always","sui-link":"sui-link","sui-link-primary":"sui-link-primary","sui-link-secondary":"sui-link-secondary","sui-link-inverted":"sui-link-inverted"});
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const Link_Link = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
18
|
+
const props = useThemeProps({
|
|
19
|
+
props: inProps,
|
|
20
|
+
name: 'Link'
|
|
21
|
+
});
|
|
10
22
|
const { classes, component: Component = 'a', className, underline = 'hover', children, variant = 'primary', onBlur, onFocus, onFocusVisible, ...rest } = props;
|
|
11
23
|
const cls = useClasses('link', classes, className);
|
|
12
|
-
const { focusVisible, focusVisibleRef, focusVisibleHandlers } = useFocusVisible({
|
|
24
|
+
const { focusVisible, focusVisibleRef, focusVisibleHandlers } = useFocusVisible({
|
|
25
|
+
onFocusVisible,
|
|
26
|
+
onFocus,
|
|
27
|
+
onBlur
|
|
28
|
+
});
|
|
13
29
|
const linkRef = useForkRef(ref, focusVisibleRef);
|
|
14
|
-
return
|
|
30
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
31
|
+
className: cls('root', variant, underline, {
|
|
32
|
+
focusVisible
|
|
33
|
+
}),
|
|
34
|
+
...rest,
|
|
35
|
+
...focusVisibleHandlers,
|
|
36
|
+
ref: linkRef,
|
|
37
|
+
children: children
|
|
38
|
+
});
|
|
15
39
|
});
|
|
16
|
-
|
|
40
|
+
Link_Link.displayName = 'SuiLink';
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
17
46
|
|
|
18
|
-
export { Link,
|
|
47
|
+
export { Link as linkStyle, Link_Link as Link };
|
package/List.js
CHANGED
|
@@ -1,11 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import './chunks/useListNavigation.js';
|
|
7
|
-
import 'tabbable';
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useClasses, useForkRef } from "@ringcentral/spring-base";
|
|
4
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
5
|
+
import { useListNavigation } from "./ListNavigation.js";
|
|
8
6
|
|
|
9
|
-
var List = {"sui-list-root":"sui-list-root"};
|
|
10
7
|
|
|
11
|
-
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// extracted by css-extract-rspack-plugin
|
|
12
|
+
/* export default */ var List = ({"sui-list-root":"sui-list-root"});
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const List_List = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
20
|
+
const props = useThemeProps({
|
|
21
|
+
props: inProps,
|
|
22
|
+
name: 'List'
|
|
23
|
+
});
|
|
24
|
+
const { classes, className, children, onKeyDown, onFocus, preventContainerScroll, searchAndFocusItemHandler, actions, ...rest } = props;
|
|
25
|
+
const cls = useClasses('list', classes, className);
|
|
26
|
+
const { renderItems, renderTabBoundary, getListProps, listRef } = useListNavigation({
|
|
27
|
+
preventContainerScroll,
|
|
28
|
+
searchAndFocusItemHandler,
|
|
29
|
+
actions
|
|
30
|
+
});
|
|
31
|
+
const handleRef = useForkRef(ref, listRef);
|
|
32
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
33
|
+
children: [
|
|
34
|
+
/*#__PURE__*/ jsx("div", {
|
|
35
|
+
role: "list",
|
|
36
|
+
className: cls('root'),
|
|
37
|
+
...rest,
|
|
38
|
+
...getListProps({
|
|
39
|
+
onFocus,
|
|
40
|
+
onKeyDown
|
|
41
|
+
}),
|
|
42
|
+
ref: handleRef,
|
|
43
|
+
children: renderItems(children)
|
|
44
|
+
}),
|
|
45
|
+
renderTabBoundary()
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
List_List.displayName = 'SuiList';
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
export { List as listStyle, List_List as List };
|
package/ListItem.js
CHANGED
|
@@ -1,23 +1,152 @@
|
|
|
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
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { motionTransition, useClassesWithMode, useThemeProps } from "@ringcentral/spring-theme";
|
|
3
|
+
import { AnimatePresence } from "framer-motion";
|
|
4
|
+
import { forwardRef, useEffect } from "react";
|
|
5
|
+
import { combineProps, useActive, useFocusVisible, useForkRef, useHover } from "@ringcentral/spring-base";
|
|
6
|
+
import { SlideIn } from "./chunks/4476.js";
|
|
7
|
+
import { Divider as Divider_Divider } from "./Divider.js";
|
|
8
|
+
import { useItemNavigation } from "./ListNavigation.js";
|
|
9
|
+
import { useVirtualizedItemPropsContext } from "./VirtualizedList.js";
|
|
10
|
+
import { useMotionSafeTransition } from "./chunks/1294.js";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const HoverActions = (props)=>{
|
|
20
|
+
const { show, children, className, instantTransition } = props;
|
|
21
|
+
const toggleOnTransition = useMotionSafeTransition(motionTransition["spring-01-fast"]);
|
|
22
|
+
const toggleOffTransition = useMotionSafeTransition(motionTransition["neutral-01-fast"]);
|
|
23
|
+
const slideInProps = {
|
|
24
|
+
toggle: show,
|
|
25
|
+
children,
|
|
26
|
+
className,
|
|
27
|
+
toggleOffTransition: instantTransition ? motionTransition.instant : toggleOffTransition,
|
|
28
|
+
toggleOnTransition: instantTransition ? motionTransition.instant : toggleOnTransition,
|
|
29
|
+
onClick: (e)=>{
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return /*#__PURE__*/ jsx(AnimatePresence, {
|
|
34
|
+
children: show && /*#__PURE__*/ jsx(SlideIn, {
|
|
35
|
+
...slideInProps,
|
|
36
|
+
children: children
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
// extracted by css-extract-rspack-plugin
|
|
46
|
+
/* export default */ var ListItem = ({"sui-list-item-root":"sui-list-item-root","sui-list-item-content":"sui-list-item-content","sui-list-item-text":"sui-list-item-text","sui-list-item-divider":"sui-list-item-divider","sui-list-item-container":"sui-list-item-container","sui-list-item-hover-actions":"sui-list-item-hover-actions","sui-list-item-small":"sui-list-item-small","sui-list-item-large":"sui-list-item-large","sui-list-item-auto":"sui-list-item-auto","sui-focus-visible":"sui-focus-visible","sui-focused":"sui-focused","sui-list-item-hoverable":"sui-list-item-hoverable","sui-focus-visible-within":"sui-focus-visible-within","sui-list-item-clickable":"sui-list-item-clickable","sui-selected":"sui-selected","sui-list-item-highlighted":"sui-list-item-highlighted","sui-dragged":"sui-dragged","sui-active":"sui-active","sui-compact":"sui-compact"});
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
const ListItem_ListItem = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
57
|
+
const props = useThemeProps({
|
|
58
|
+
props: inProps,
|
|
59
|
+
name: 'ListItem'
|
|
60
|
+
});
|
|
61
|
+
const { classes, className, children, hoverActions, size = 'small', tabIndex = -1, role = 'listitem', divider = true, onClick, clickable = Boolean(onClick), hoverable = true, focused = false, highlighted = false, autoFocus, selected, dragged, alwaysShowHoverActions = false, instantHoverActions = false, style: styleProp, ...rest } = props;
|
|
62
|
+
const cls = useClassesWithMode('list-item', classes, className);
|
|
63
|
+
const { itemRef, keyboardNavHandlers } = useItemNavigation() ?? {};
|
|
64
|
+
const virtualizedItemProps = useVirtualizedItemPropsContext();
|
|
65
|
+
const { focusVisible, focusVisibleWithin, focusVisibleRef, focusVisibleHandlers } = useFocusVisible({
|
|
66
|
+
...props,
|
|
67
|
+
within: true
|
|
68
|
+
});
|
|
69
|
+
const { active, activeHandlers } = useActive({
|
|
70
|
+
...props,
|
|
71
|
+
disabled: !clickable
|
|
72
|
+
});
|
|
73
|
+
const { hover, hoverHandlers } = useHover({
|
|
74
|
+
...props,
|
|
75
|
+
// useHover only used for hover actions,
|
|
76
|
+
// so disabled when no hover actions or always show
|
|
77
|
+
disabled: !hoverable || !hoverActions
|
|
78
|
+
});
|
|
79
|
+
const enhancedEventHandlers = (()=>{
|
|
80
|
+
const handlers = {
|
|
81
|
+
...focusVisibleHandlers,
|
|
82
|
+
...activeHandlers,
|
|
83
|
+
...hoverHandlers
|
|
84
|
+
};
|
|
85
|
+
if (keyboardNavHandlers) {
|
|
86
|
+
return combineProps(handlers, keyboardNavHandlers);
|
|
87
|
+
}
|
|
88
|
+
return handlers;
|
|
89
|
+
})();
|
|
90
|
+
const rootRef = useForkRef(itemRef, ref, focusVisibleRef);
|
|
91
|
+
useEffect(()=>{
|
|
92
|
+
if (autoFocus) {
|
|
93
|
+
itemRef?.current?.focus();
|
|
94
|
+
}
|
|
95
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
|
96
|
+
}, []);
|
|
97
|
+
const isShowHoverAction = hover || focusVisibleWithin || alwaysShowHoverActions;
|
|
98
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
99
|
+
className: cls('root', size, {
|
|
100
|
+
focusVisibleWithin,
|
|
101
|
+
focusVisible,
|
|
102
|
+
active,
|
|
103
|
+
clickable,
|
|
104
|
+
hoverable,
|
|
105
|
+
selected,
|
|
106
|
+
dragged,
|
|
107
|
+
focused,
|
|
108
|
+
highlighted
|
|
109
|
+
}),
|
|
110
|
+
tabIndex: tabIndex,
|
|
111
|
+
...rest,
|
|
112
|
+
...enhancedEventHandlers,
|
|
113
|
+
...virtualizedItemProps,
|
|
114
|
+
style: virtualizedItemProps ? {
|
|
115
|
+
...styleProp,
|
|
116
|
+
...virtualizedItemProps.style
|
|
117
|
+
} : styleProp,
|
|
118
|
+
role: role,
|
|
119
|
+
ref: rootRef,
|
|
120
|
+
children: [
|
|
121
|
+
/*#__PURE__*/ jsxs("div", {
|
|
122
|
+
className: cls('container'),
|
|
123
|
+
children: [
|
|
124
|
+
/*#__PURE__*/ jsx("div", {
|
|
125
|
+
className: cls('content'),
|
|
126
|
+
children: children
|
|
127
|
+
}),
|
|
128
|
+
hoverActions && /*#__PURE__*/ jsx(HoverActions, {
|
|
129
|
+
show: isShowHoverAction,
|
|
130
|
+
className: cls('hover-actions'),
|
|
131
|
+
instantTransition: instantHoverActions,
|
|
132
|
+
children: hoverActions
|
|
133
|
+
})
|
|
134
|
+
]
|
|
135
|
+
}),
|
|
136
|
+
divider && /*#__PURE__*/ jsx(Divider_Divider, {
|
|
137
|
+
className: cls('divider'),
|
|
138
|
+
orientation: "horizontal",
|
|
139
|
+
flexItem: true
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
ListItem_ListItem.displayName = 'SuiListItem';
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
export { HoverActions, ListItem as listItemStyle, ListItem_ListItem as ListItem };
|