@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/Tag.js
CHANGED
|
@@ -1,28 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef } from
|
|
3
|
-
import {
|
|
4
|
-
import { useThemeProps } from
|
|
5
|
-
import {
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { getTitle, useClasses } from "@ringcentral/spring-base";
|
|
4
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
5
|
+
import { Icon as Icon_Icon } from "./chunks/8307.js";
|
|
6
6
|
|
|
7
|
-
var Tag$1 = {"sui-tag-root":"sui-tag-root","sui-tag-has-start-icon":"sui-tag-has-start-icon","sui-tag-default":"sui-tag-default","sui-tag-neutral":"sui-tag-neutral","sui-tag-secondary":"sui-tag-secondary","sui-tag-primary":"sui-tag-primary","sui-tag-success":"sui-tag-success","sui-tag-warning":"sui-tag-warning","sui-tag-danger":"sui-tag-danger","sui-tag-outlined":"sui-tag-outlined","sui-tag-filled-default":"sui-tag-filled-default","sui-tag-filled-neutral":"sui-tag-filled-neutral","sui-tag-filled-secondary":"sui-tag-filled-secondary","sui-tag-filled-primary":"sui-tag-filled-primary","sui-tag-filled-success":"sui-tag-filled-success","sui-tag-filled-warning":"sui-tag-filled-warning","sui-tag-filled-danger":"sui-tag-filled-danger","sui-tag-inverted-default":"sui-tag-inverted-default","sui-tag-inverted-neutral":"sui-tag-inverted-neutral","sui-tag-inverted-secondary":"sui-tag-inverted-secondary","sui-tag-inverted-primary":"sui-tag-inverted-primary","sui-tag-inverted-success":"sui-tag-inverted-success","sui-tag-inverted-warning":"sui-tag-inverted-warning","sui-tag-inverted-danger":"sui-tag-inverted-danger","sui-tag-label":"sui-tag-label","sui-tag-start-icon":"sui-tag-start-icon"};
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// extracted by css-extract-rspack-plugin
|
|
12
|
+
/* export default */ var Tag = ({"sui-tag-root":"sui-tag-root","sui-tag-has-start-icon":"sui-tag-has-start-icon","sui-tag-default":"sui-tag-default","sui-tag-neutral":"sui-tag-neutral","sui-tag-secondary":"sui-tag-secondary","sui-tag-primary":"sui-tag-primary","sui-tag-success":"sui-tag-success","sui-tag-warning":"sui-tag-warning","sui-tag-danger":"sui-tag-danger","sui-tag-outlined":"sui-tag-outlined","sui-tag-filled-default":"sui-tag-filled-default","sui-tag-filled-neutral":"sui-tag-filled-neutral","sui-tag-filled-secondary":"sui-tag-filled-secondary","sui-tag-filled-primary":"sui-tag-filled-primary","sui-tag-filled-success":"sui-tag-filled-success","sui-tag-filled-warning":"sui-tag-filled-warning","sui-tag-filled-danger":"sui-tag-filled-danger","sui-tag-inverted-default":"sui-tag-inverted-default","sui-tag-inverted-neutral":"sui-tag-inverted-neutral","sui-tag-inverted-secondary":"sui-tag-inverted-secondary","sui-tag-inverted-primary":"sui-tag-inverted-primary","sui-tag-inverted-success":"sui-tag-inverted-success","sui-tag-inverted-warning":"sui-tag-inverted-warning","sui-tag-inverted-danger":"sui-tag-inverted-danger","sui-tag-label":"sui-tag-label","sui-tag-start-icon":"sui-tag-start-icon"});
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const Tag_Tag = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
20
|
+
const props = useThemeProps({
|
|
21
|
+
props: inProps,
|
|
22
|
+
name: 'Tag'
|
|
23
|
+
});
|
|
11
24
|
const { classes, className, children, label: labelProp, startIcon, variant = 'outlined', color = 'default', title, ...rest } = props;
|
|
12
25
|
const cls = useClasses('tag', classes, className);
|
|
13
26
|
const label = children ?? labelProp;
|
|
14
27
|
let tagContent = null;
|
|
15
28
|
if (startIcon) {
|
|
16
|
-
tagContent =
|
|
17
|
-
|
|
18
|
-
|
|
29
|
+
tagContent = /*#__PURE__*/ jsxs(Fragment, {
|
|
30
|
+
children: [
|
|
31
|
+
/*#__PURE__*/ jsx(Icon_Icon, {
|
|
32
|
+
className: cls('start-icon'),
|
|
33
|
+
symbol: startIcon,
|
|
34
|
+
size: 'xsmall'
|
|
35
|
+
}),
|
|
36
|
+
/*#__PURE__*/ jsx("span", {
|
|
37
|
+
className: cls('label'),
|
|
38
|
+
children: label
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
19
43
|
tagContent = label;
|
|
20
44
|
}
|
|
21
|
-
return
|
|
45
|
+
return /*#__PURE__*/ jsx("div", {
|
|
46
|
+
...rest,
|
|
47
|
+
ref: ref,
|
|
48
|
+
className: cls('root', color, variant !== 'outlined' && `${variant}-${color}`, {
|
|
22
49
|
'has-start-icon': !!startIcon,
|
|
23
|
-
outlined: variant === 'outlined'
|
|
24
|
-
}),
|
|
50
|
+
outlined: variant === 'outlined'
|
|
51
|
+
}),
|
|
52
|
+
title: title ?? getTitle(label),
|
|
53
|
+
children: tagContent
|
|
54
|
+
});
|
|
25
55
|
});
|
|
26
|
-
|
|
56
|
+
Tag_Tag.displayName = 'SuiTag';
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
27
62
|
|
|
28
|
-
export { Tag,
|
|
63
|
+
export { Tag as tagStyle, Tag_Tag as Tag };
|
package/Text.js
CHANGED
|
@@ -1,44 +1,57 @@
|
|
|
1
|
-
import { jsx } from
|
|
2
|
-
import { forwardRef,
|
|
3
|
-
import clsx from
|
|
4
|
-
import isString from
|
|
5
|
-
import { useForkRef, useOverflow
|
|
6
|
-
import { useThemeProps } from
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useRef, useState } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import isString from "lodash/isString";
|
|
5
|
+
import { useClasses, useForkRef, useOverflow } from "@ringcentral/spring-base";
|
|
6
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
7
|
+
import "./Tooltip.js";
|
|
8
|
+
import { Tooltip } from "./chunks/4535.js";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// extracted by css-extract-rspack-plugin
|
|
17
|
+
/* export default */ var Text = ({"sui-text-root":"sui-text-root","sui-text-no-wrap":"sui-text-no-wrap","sui-text-highlight-term":"sui-text-highlight-term"});
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
const Text_Text = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
27
|
+
const props = useThemeProps({
|
|
28
|
+
props: inProps,
|
|
29
|
+
name: 'Text'
|
|
30
|
+
});
|
|
24
31
|
const { component: TextRoot = 'span', children, className, flexFull, highlight, title: _title, titleWhenOverflow, useTooltip, TooltipProps, noWrap = false, ...rest } = props;
|
|
25
32
|
const [isShowTitle, setIsShowTitle] = useState(false);
|
|
26
33
|
const innerRef = useRef(null);
|
|
27
34
|
const textRef = useForkRef(innerRef, ref);
|
|
35
|
+
// * here put hook in if else, titleWhenOverflow not change any more
|
|
28
36
|
if (titleWhenOverflow) {
|
|
29
|
-
|
|
37
|
+
// oxlint-disable-next-line react-hooks/rules-of-hooks
|
|
38
|
+
useOverflow(innerRef, (state)=>setIsShowTitle(state));
|
|
30
39
|
}
|
|
31
40
|
const cls = useClasses('text', {}, className);
|
|
32
|
-
const title = isShowTitle || useTooltip
|
|
33
|
-
|
|
34
|
-
(_title ?? (isString(children) ? children : undefined))
|
|
35
|
-
: undefined;
|
|
41
|
+
const title = isShowTitle || useTooltip // * if useTooltip always keep title pass into
|
|
42
|
+
? _title ?? (isString(children) ? children : undefined) : undefined;
|
|
36
43
|
const showTooltip = Boolean(useTooltip) && isShowTitle && !!title && !!children;
|
|
37
44
|
if (!showTooltip) {
|
|
38
|
-
return
|
|
45
|
+
return /*#__PURE__*/ jsx(TextRoot, {
|
|
46
|
+
ref: textRef,
|
|
47
|
+
title: isShowTitle ? title : undefined,
|
|
48
|
+
className: cls('root', {
|
|
39
49
|
'no-wrap': noWrap,
|
|
40
|
-
'highlight-term': highlight
|
|
41
|
-
}),
|
|
50
|
+
'highlight-term': highlight
|
|
51
|
+
}),
|
|
52
|
+
...rest,
|
|
53
|
+
children: children
|
|
54
|
+
});
|
|
42
55
|
}
|
|
43
56
|
const lineClamp = [
|
|
44
57
|
'line-clamp-none',
|
|
@@ -47,13 +60,31 @@ const Text = forwardRef((inProps, ref) => {
|
|
|
47
60
|
'line-clamp-3',
|
|
48
61
|
'line-clamp-4',
|
|
49
62
|
'line-clamp-5',
|
|
50
|
-
'line-clamp-6'
|
|
63
|
+
'line-clamp-6'
|
|
51
64
|
][titleWhenOverflow ?? -1];
|
|
52
|
-
return
|
|
65
|
+
return /*#__PURE__*/ jsx(Tooltip, {
|
|
66
|
+
...TooltipProps,
|
|
67
|
+
title: title,
|
|
68
|
+
PopperProps: {
|
|
69
|
+
offset: 8
|
|
70
|
+
},
|
|
71
|
+
motionProps: null,
|
|
72
|
+
children: /*#__PURE__*/ jsx(TextRoot, {
|
|
73
|
+
ref: textRef,
|
|
74
|
+
className: clsx(cls('root', {
|
|
53
75
|
'no-wrap': noWrap,
|
|
54
|
-
'highlight-term': highlight
|
|
55
|
-
}), lineClamp),
|
|
76
|
+
'highlight-term': highlight
|
|
77
|
+
}), lineClamp),
|
|
78
|
+
...rest,
|
|
79
|
+
children: children
|
|
80
|
+
})
|
|
81
|
+
});
|
|
56
82
|
});
|
|
57
|
-
|
|
83
|
+
Text_Text.displayName = 'SuiText';
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
58
89
|
|
|
59
|
-
export { Text,
|
|
90
|
+
export { Text as textStyle, Text_Text as Text };
|
package/TextField.js
CHANGED
|
@@ -1,29 +1,209 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useRef } from "react";
|
|
3
|
+
import { useInput } from "@mui/base";
|
|
4
|
+
import { combineProps, useClasses, useControlled, useEventCallback, useForkRef, useId } from "@ringcentral/spring-base";
|
|
5
|
+
import { Xmd } from "@ringcentral/spring-icon";
|
|
6
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
7
|
+
import { ShowHideEye as ShowHideEye_ShowHideEye } from "./chunks/4476.js";
|
|
8
|
+
import { useHelperTextId, FormField as FormField_FormField } from "./FormField.js";
|
|
9
|
+
import { IconButton as IconButton_IconButton } from "./IconButton.js";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
// extracted by css-extract-rspack-plugin
|
|
18
|
+
/* export default */ var TextField = ({"sui-text-field-clear":"sui-text-field-clear","sui-text-field-mask-value-button":"sui-text-field-mask-value-button","sui-text-field-form-field-content":"sui-text-field-form-field-content","sui-text-field-root":"sui-text-field-root","sui-focused":"sui-focused","sui-disabled":"sui-disabled","sui-text-field-full-width":"sui-text-field-full-width","sui-text-field-input":"sui-text-field-input","sui-text-field-end-adornment":"sui-text-field-end-adornment","sui-text-field-start-adornment":"sui-text-field-start-adornment","sui-text-field-outlined":"sui-text-field-outlined","sui-text-field-standard":"sui-text-field-standard","sui-text-field-quiet":"sui-text-field-quiet","sui-text-field-helper-text":"sui-text-field-helper-text","sui-text-field-hide-native-clear":"sui-text-field-hide-native-clear"});
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const TextFieldComponent = (inProps, ref)=>{
|
|
30
|
+
const props = useThemeProps({
|
|
31
|
+
props: inProps,
|
|
32
|
+
name: 'TextField'
|
|
33
|
+
});
|
|
34
|
+
const { classes, className, clearBtn = true, clearText = 'clear', showCharacterCount = false, useNativeClearBtn = false, size, endAdornment, fullWidth, helperText: helperTextProp, inputProps, label, onClear, placeholder: placeholderProp, RootProps, startAdornment, type, variant = 'outlined', inputComponent: InputComponent = 'input', autoFocus, ClearButtonProps, id: idProp, onKeyDown, onKeyUp, readOnly, onClick, focused, FormHelperTextProps, showMaskValueToggleButton = type === 'password', maskValue: maskValueProps, MaskValueButtonProps, ShowHideEyeIconProps } = props;
|
|
35
|
+
const placeholder = placeholderProp || ' ';
|
|
36
|
+
const defaultId = useId();
|
|
37
|
+
const id = idProp ?? inputProps?.id ?? defaultId;
|
|
38
|
+
const cls = useClasses('text-field', classes, className);
|
|
39
|
+
const { disabled, required, error, getInputProps } = useInput(props);
|
|
40
|
+
const states = {
|
|
41
|
+
disabled,
|
|
42
|
+
required,
|
|
43
|
+
error,
|
|
44
|
+
focused
|
|
45
|
+
};
|
|
46
|
+
const idForHelperText = useHelperTextId({
|
|
47
|
+
helperText: helperTextProp,
|
|
48
|
+
id,
|
|
49
|
+
FormHelperTextProps
|
|
50
|
+
});
|
|
51
|
+
const widgetProps = getInputProps({
|
|
52
|
+
'aria-describedby': idForHelperText,
|
|
53
|
+
...inputProps,
|
|
54
|
+
placeholder,
|
|
55
|
+
id,
|
|
56
|
+
type
|
|
57
|
+
});
|
|
58
|
+
const inputRef = useRef();
|
|
59
|
+
const handlerClear = (e)=>{
|
|
60
|
+
if (disabled) return;
|
|
61
|
+
const el = inputRef.current;
|
|
62
|
+
if (el) {
|
|
63
|
+
onClear?.(e);
|
|
64
|
+
const host = Object.getPrototypeOf(el);
|
|
65
|
+
Object.getOwnPropertyDescriptor(host, 'value')?.set?.call(el, '');
|
|
66
|
+
el.focus();
|
|
67
|
+
el.dispatchEvent(new InputEvent('input', {
|
|
68
|
+
bubbles: true
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
let helperText = helperTextProp;
|
|
73
|
+
if (showCharacterCount && inputProps?.maxLength !== undefined && props.value !== undefined) {
|
|
74
|
+
helperText = /*#__PURE__*/ jsxs("div", {
|
|
75
|
+
className: cls('helper-text'),
|
|
76
|
+
children: [
|
|
77
|
+
/*#__PURE__*/ jsx("span", {
|
|
78
|
+
children: helperText
|
|
79
|
+
}),
|
|
80
|
+
/*#__PURE__*/ jsxs("span", {
|
|
81
|
+
children: [
|
|
82
|
+
props.value?.length ?? 0,
|
|
83
|
+
"/",
|
|
84
|
+
inputProps.maxLength
|
|
85
|
+
]
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const [maskValue, setMaskValue] = useControlled({
|
|
91
|
+
controlled: maskValueProps,
|
|
92
|
+
default: false,
|
|
93
|
+
name: 'TextField',
|
|
94
|
+
state: 'showPassword'
|
|
95
|
+
});
|
|
96
|
+
let inputType = type;
|
|
97
|
+
const shouldShowMaskToggleButton = showMaskValueToggleButton && type === 'password';
|
|
98
|
+
const isSearchInput = type === 'search';
|
|
99
|
+
const shouldHideNativeClear = isSearchInput && !useNativeClearBtn;
|
|
100
|
+
if (shouldShowMaskToggleButton) {
|
|
101
|
+
if (maskValue) {
|
|
102
|
+
inputType = 'text';
|
|
103
|
+
} else {
|
|
104
|
+
inputType = 'password';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const handleMaskValueChange = useEventCallback(()=>{
|
|
108
|
+
setMaskValue(!maskValue);
|
|
109
|
+
if (props.onMaskValueChange) {
|
|
110
|
+
props.onMaskValueChange(!maskValue);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return /*#__PURE__*/ jsxs(FormField_FormField, {
|
|
114
|
+
...combineProps({
|
|
115
|
+
classes: {
|
|
116
|
+
root: cls('root', {
|
|
117
|
+
'full-width': fullWidth,
|
|
118
|
+
'hide-native-clear': shouldHideNativeClear
|
|
119
|
+
}),
|
|
120
|
+
content: cls('form-field-content'),
|
|
121
|
+
outlined: cls('outlined'),
|
|
122
|
+
standard: cls('standard'),
|
|
123
|
+
quiet: cls('quiet')
|
|
124
|
+
},
|
|
125
|
+
contentProps: {
|
|
126
|
+
onClick: (e)=>{
|
|
127
|
+
onClick?.(e);
|
|
128
|
+
if (e.target === e.currentTarget && !disabled) {
|
|
129
|
+
inputRef.current?.focus();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}, RootProps),
|
|
134
|
+
...states,
|
|
135
|
+
htmlFor: id,
|
|
136
|
+
label: label,
|
|
137
|
+
ref: ref,
|
|
138
|
+
helperText: helperText,
|
|
139
|
+
variant: variant,
|
|
140
|
+
size: size,
|
|
141
|
+
FormHelperTextProps: {
|
|
142
|
+
id: idForHelperText,
|
|
143
|
+
...FormHelperTextProps
|
|
144
|
+
},
|
|
145
|
+
children: [
|
|
146
|
+
startAdornment && /*#__PURE__*/ jsx("div", {
|
|
147
|
+
className: cls('start-adornment'),
|
|
148
|
+
children: startAdornment
|
|
149
|
+
}),
|
|
150
|
+
/*#__PURE__*/ jsx(InputComponent, {
|
|
151
|
+
readOnly: readOnly,
|
|
152
|
+
autoComplete: "off",
|
|
153
|
+
autoFocus: autoFocus,
|
|
154
|
+
onKeyDown: onKeyDown,
|
|
155
|
+
onKeyUp: onKeyUp,
|
|
156
|
+
...widgetProps,
|
|
157
|
+
className: cls('input'),
|
|
158
|
+
ref: useForkRef(widgetProps.ref, inputRef),
|
|
159
|
+
type: inputType
|
|
160
|
+
}),
|
|
161
|
+
clearBtn && /*#__PURE__*/ jsx(IconButton_IconButton, {
|
|
162
|
+
symbol: Xmd,
|
|
163
|
+
shape: 'squircle',
|
|
164
|
+
background: false,
|
|
165
|
+
color: 'secondary',
|
|
166
|
+
variant: "contained",
|
|
167
|
+
size: "small",
|
|
168
|
+
title: clearText,
|
|
169
|
+
"aria-label": clearText,
|
|
170
|
+
disabled: disabled,
|
|
171
|
+
...combineProps({
|
|
172
|
+
className: cls('clear'),
|
|
173
|
+
onClick: handlerClear
|
|
174
|
+
}, ClearButtonProps)
|
|
175
|
+
}),
|
|
176
|
+
shouldShowMaskToggleButton && /*#__PURE__*/ jsx(IconButton_IconButton, {
|
|
177
|
+
disabled: disabled,
|
|
178
|
+
shape: 'squircle',
|
|
179
|
+
background: false,
|
|
180
|
+
color: 'neutral',
|
|
181
|
+
variant: "icon",
|
|
182
|
+
size: "small",
|
|
183
|
+
...combineProps({
|
|
184
|
+
className: cls('mask-value-button'),
|
|
185
|
+
onClick: handleMaskValueChange,
|
|
186
|
+
'aria-label': maskValue ? 'eye-visible' : 'eye'
|
|
187
|
+
}, MaskValueButtonProps),
|
|
188
|
+
children: /*#__PURE__*/ jsx(ShowHideEye_ShowHideEye, {
|
|
189
|
+
hide: !maskValue,
|
|
190
|
+
size: ShowHideEyeIconProps?.size ?? MaskValueButtonProps?.iconSize ?? 'small',
|
|
191
|
+
...ShowHideEyeIconProps
|
|
192
|
+
})
|
|
193
|
+
}),
|
|
194
|
+
endAdornment && /*#__PURE__*/ jsx("div", {
|
|
195
|
+
className: cls('end-adornment'),
|
|
196
|
+
children: endAdornment
|
|
197
|
+
})
|
|
198
|
+
]
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
const TextField_TextField = /*#__PURE__*/ forwardRef(TextFieldComponent);
|
|
202
|
+
TextField_TextField.displayName = 'SuiTextField';
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
export { TextField as textFieldStyle, TextField_TextField as TextField };
|
package/Textarea.js
CHANGED
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
import { jsx } from
|
|
2
|
-
import { forwardRef } from
|
|
3
|
-
import { TextareaAutosize } from
|
|
4
|
-
import { logInDev, useClasses
|
|
5
|
-
import { useThemeProps } from
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var Textarea$1 = {"sui-textarea-form-field-content":"sui-textarea-form-field-content","sui-textarea-form-field-content-xlarge":"sui-textarea-form-field-content-xlarge","sui-textarea-form-field-content-large":"sui-textarea-form-field-content-large","sui-textarea-form-field-content-medium":"sui-textarea-form-field-content-medium","sui-textarea-input":"sui-textarea-input","sui-textarea-clear":"sui-textarea-clear","sui-textarea-input-xlarge":"sui-textarea-input-xlarge","sui-textarea-input-large":"sui-textarea-input-large","sui-textarea-input-medium":"sui-textarea-input-medium","sui-textarea-standard-input":"sui-textarea-standard-input","sui-textarea-clear-xlarge":"sui-textarea-clear-xlarge","sui-textarea-clear-large":"sui-textarea-clear-large","sui-textarea-clear-medium":"sui-textarea-clear-medium","sui-textarea-clear-standard":"sui-textarea-clear-standard"};
|
|
28
|
-
|
|
29
|
-
const Textarea = forwardRef((inProps, ref) => {
|
|
30
|
-
const props = useThemeProps({ props: inProps, name: 'Textarea' });
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { TextareaAutosize } from "@mui/base";
|
|
4
|
+
import { combineProps, logInDev, useClasses } from "@ringcentral/spring-base";
|
|
5
|
+
import { useThemeProps } from "@ringcentral/spring-theme";
|
|
6
|
+
import { TextField as TextField_TextField } from "./TextField.js";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// extracted by css-extract-rspack-plugin
|
|
14
|
+
/* export default */ var Textarea = ({"sui-textarea-form-field-content":"sui-textarea-form-field-content","sui-textarea-form-field-content-xlarge":"sui-textarea-form-field-content-xlarge","sui-textarea-form-field-content-large":"sui-textarea-form-field-content-large","sui-textarea-form-field-content-medium":"sui-textarea-form-field-content-medium","sui-textarea-input":"sui-textarea-input","sui-textarea-clear":"sui-textarea-clear","sui-textarea-input-xlarge":"sui-textarea-input-xlarge","sui-textarea-input-large":"sui-textarea-input-large","sui-textarea-input-medium":"sui-textarea-input-medium","sui-textarea-standard-input":"sui-textarea-standard-input","sui-textarea-clear-xlarge":"sui-textarea-clear-xlarge","sui-textarea-clear-large":"sui-textarea-clear-large","sui-textarea-clear-medium":"sui-textarea-clear-medium","sui-textarea-clear-standard":"sui-textarea-clear-standard"});
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
const Textarea_Textarea = /*#__PURE__*/ forwardRef((inProps, ref)=>{
|
|
23
|
+
const props = useThemeProps({
|
|
24
|
+
props: inProps,
|
|
25
|
+
name: 'Textarea'
|
|
26
|
+
});
|
|
31
27
|
const { classes, className, rows, minRows, maxRows, variant = 'outlined', inputProps: inputPropsProp, size = 'xlarge', ClearButtonProps, ...rest } = props;
|
|
32
28
|
let inputProps = inputPropsProp;
|
|
33
29
|
if (rows) {
|
|
@@ -35,33 +31,48 @@ const Textarea = forwardRef((inProps, ref) => {
|
|
|
35
31
|
logInDev({
|
|
36
32
|
scope: 'Textarea',
|
|
37
33
|
message: 'You can not use the `minRows` or `maxRows` props when the input `rows` prop is set.',
|
|
38
|
-
level: 'warn'
|
|
34
|
+
level: 'warn'
|
|
39
35
|
});
|
|
40
36
|
}
|
|
41
37
|
inputProps = {
|
|
42
38
|
...inputProps,
|
|
43
39
|
minRows: rows,
|
|
44
|
-
maxRows: rows
|
|
40
|
+
maxRows: rows
|
|
45
41
|
};
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
42
|
+
} else {
|
|
48
43
|
inputProps = {
|
|
49
44
|
...inputProps,
|
|
50
45
|
maxRows,
|
|
51
|
-
minRows
|
|
46
|
+
minRows
|
|
52
47
|
};
|
|
53
48
|
}
|
|
54
49
|
const cls = useClasses('textarea', classes, className);
|
|
55
|
-
return
|
|
50
|
+
return /*#__PURE__*/ jsx(TextField_TextField, {
|
|
51
|
+
...rest,
|
|
52
|
+
size: size,
|
|
53
|
+
variant: variant,
|
|
54
|
+
inputProps: inputProps,
|
|
55
|
+
inputComponent: TextareaAutosize,
|
|
56
|
+
ClearButtonProps: combineProps({
|
|
57
|
+
background: true
|
|
58
|
+
}, ClearButtonProps),
|
|
59
|
+
ref: ref,
|
|
60
|
+
classes: {
|
|
56
61
|
...classes,
|
|
57
62
|
root: cls('root'),
|
|
58
63
|
outlined: cls('outlined'),
|
|
59
64
|
standard: cls('standard'),
|
|
60
65
|
input: cls('input', `${variant}-input`, `input-${size}`),
|
|
61
66
|
formFieldContent: cls('form-field-content', `form-field-content-${size}`, `${variant}-form-field-content`),
|
|
62
|
-
clear: cls('clear', `clear-${variant}`, `clear-${size}`)
|
|
63
|
-
}
|
|
67
|
+
clear: cls('clear', `clear-${variant}`, `clear-${size}`)
|
|
68
|
+
}
|
|
69
|
+
});
|
|
64
70
|
});
|
|
65
|
-
|
|
71
|
+
Textarea_Textarea.displayName = 'SuiTextarea';
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
66
77
|
|
|
67
|
-
export { Textarea,
|
|
78
|
+
export { Textarea as textareaStyle, Textarea_Textarea as Textarea };
|