@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.
Files changed (241) hide show
  1. package/Accordion.js +90 -34
  2. package/AccordionHeader.js +72 -20
  3. package/Alert.js +120 -28
  4. package/Animation.js +2 -45
  5. package/Announcement.js +46 -35
  6. package/Autocomplete.js +1011 -580
  7. package/Avatar.js +134 -73
  8. package/AvatarGroup.js +50 -7
  9. package/Backdrop.js +45 -7
  10. package/Badge.js +77 -15
  11. package/Block.js +34 -12
  12. package/BlockHeader.js +55 -11
  13. package/BottomNavigation.js +181 -65
  14. package/BottomNavigationItem.js +93 -30
  15. package/Button.js +160 -24
  16. package/CallButton.js +53 -31
  17. package/Checkbox.js +88 -26
  18. package/Chip.js +126 -26
  19. package/CircularProgressIndicator.js +80 -8
  20. package/ClickAwayListener.js +4 -1
  21. package/ComponentsProps.js +1 -0
  22. package/DatePicker.js +611 -190
  23. package/DateUtilsContext.js +43 -25
  24. package/Dialer.js +576 -250
  25. package/Dialog.js +100 -45
  26. package/Divider.js +43 -7
  27. package/DragHandle.js +32 -6
  28. package/Drawer.js +117 -19
  29. package/Dropdown.js +154 -74
  30. package/EmptyState.js +63 -11
  31. package/FabButton.js +51 -17
  32. package/FocusTrap.js +109 -12
  33. package/FormField.js +106 -8
  34. package/FormLabel.js +81 -7
  35. package/Icon.js +1 -8
  36. package/IconButton.js +142 -26
  37. package/IconButtonGroup.js +35 -12
  38. package/InlineEditable.js +98 -44
  39. package/LinearProgressIndicator.js +73 -24
  40. package/Link.js +40 -11
  41. package/List.js +54 -9
  42. package/ListItem.js +152 -23
  43. package/ListItemText.js +44 -16
  44. package/ListNavigation.js +272 -20
  45. package/Menu.js +139 -23
  46. package/MenuActions.js +37 -12
  47. package/MenuDivider.js +34 -8
  48. package/MenuFooter.js +36 -12
  49. package/MenuHeader.js +54 -15
  50. package/MenuItem.js +402 -33
  51. package/MenuItemText.js +51 -8
  52. package/MenuList.js +87 -34
  53. package/Modal.js +345 -16
  54. package/NestedMenuContext.js +183 -11
  55. package/Option.js +32 -34
  56. package/Overlap.js +54 -7
  57. package/PageHeader.js +62 -24
  58. package/PickerTextField.js +156 -33
  59. package/Popover.js +262 -21
  60. package/Popper.js +130 -77
  61. package/PopperPaper.js +54 -8
  62. package/Portal.js +6 -1
  63. package/Radio.js +65 -21
  64. package/RadioGroup.js +56 -17
  65. package/Rating.js +223 -87
  66. package/Select.js +387 -41
  67. package/SingleFilter.js +148 -77
  68. package/Skeleton.js +68 -17
  69. package/Slider.js +168 -69
  70. package/Snackbar.js +122 -59
  71. package/SortableList.js +32 -12
  72. package/SortableListDndContext.js +69 -22
  73. package/SortableListItem.js +92 -47
  74. package/SortableVirtualizedList.js +52 -28
  75. package/SplitButton.js +124 -86
  76. package/Squircle.js +4 -7
  77. package/StatusIndicator.js +51 -9
  78. package/Step.js +63 -38
  79. package/StepButton.js +51 -23
  80. package/StepConnector.js +48 -8
  81. package/StepContent.js +68 -25
  82. package/StepIcon.js +90 -9
  83. package/StepLabel.js +90 -14
  84. package/Stepper.js +65 -23
  85. package/SubMenu.js +203 -99
  86. package/SwipeableDrawer.js +439 -194
  87. package/Switch.js +70 -23
  88. package/Tab.js +120 -57
  89. package/TabContext.js +59 -15
  90. package/TabPanel.js +40 -13
  91. package/Table.js +60 -17
  92. package/TableBody.js +42 -12
  93. package/TableCell.js +84 -50
  94. package/TableContainer.js +32 -10
  95. package/TableFooter.js +38 -10
  96. package/TableHead.js +49 -15
  97. package/TablePagination.js +153 -77
  98. package/TableRow.js +60 -21
  99. package/Tabs.js +593 -268
  100. package/Tag.js +51 -16
  101. package/Text.js +68 -37
  102. package/TextField.js +209 -29
  103. package/Textarea.js +51 -40
  104. package/TimePicker.js +490 -230
  105. package/Tooltip.js +48 -23
  106. package/Tray.js +237 -13
  107. package/TrayMenu.js +62 -41
  108. package/VirtualizedList.js +208 -109
  109. package/VirtualizedMenu.js +359 -29
  110. package/VisuallyHidden.js +29 -6
  111. package/chunks/1250.js +98 -0
  112. package/chunks/1294.js +126 -0
  113. package/chunks/2956.js +18 -0
  114. package/chunks/4476.js +460 -0
  115. package/chunks/4491.js +10 -0
  116. package/chunks/4535.js +364 -0
  117. package/chunks/5047.js +3 -0
  118. package/chunks/6335.js +24 -0
  119. package/chunks/7279.js +10 -0
  120. package/chunks/8011.js +8 -0
  121. package/chunks/8307.js +56 -0
  122. package/chunks/8467.js +8 -0
  123. package/chunks/8809.js +8 -0
  124. package/chunks/{RadioGroup.context.js → 9551.js} +12 -6
  125. package/chunks/987.js +8 -0
  126. package/index.css +2624 -2416
  127. package/index.js +245 -193
  128. package/internal/utils/index.d.ts +1 -0
  129. package/internal/utils/setRef.d.ts +2 -0
  130. package/package.json +8 -8
  131. package/src/Alert/Alert.type.d.ts +2 -1
  132. package/src/Animation/components/Fade/Fade.d.ts +4 -2
  133. package/src/Animation/components/Grow/Grow.d.ts +4 -2
  134. package/src/Animation/components/ShowHideEye/ShowHideEye.d.ts +1 -1
  135. package/src/Animation/components/SlideIn/SlideIn.d.ts +4 -2
  136. package/src/Animation/components/SlideIn/getSlideIn.d.ts +1 -1
  137. package/src/Animation/hooks/useMotionSafeTransition/useMotionSafeTransition.d.ts +2 -0
  138. package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +1 -1
  139. package/src/Autocomplete/useAutocomplete.d.ts +18 -18
  140. package/src/Autocomplete/useAutocompleteTag.d.ts +18 -18
  141. package/src/Badge/Badge.d.ts +2 -1
  142. package/src/Button/Button.classes.d.ts +1 -1
  143. package/src/ComponentsProps.d.ts +111 -110
  144. package/src/DatePicker/DatePickerDataAttributes.d.ts +11 -0
  145. package/src/DatePicker/utils/DatePickerAriaLabelUtils.d.ts +2 -1
  146. package/src/DatePicker/utils/DatePickerUtils.d.ts +1 -1
  147. package/src/Dialer/DialDelete/DialDelete.d.ts +2 -2
  148. package/src/Dialer/DialPad/DialPad.d.ts +2 -2
  149. package/src/Dialer/Dialer.d.ts +4 -2
  150. package/src/Dropdown/Dropdown.type.d.ts +2 -2
  151. package/src/InlineEditable/InlineEditable.type.d.ts +2 -1
  152. package/src/ListNavigation/useListNavigation.d.ts +3 -3
  153. package/src/MenuActions/MenuActions.d.ts +2 -2
  154. package/src/MenuItem/MenuItem.type.d.ts +1 -0
  155. package/src/MenuItem/useMenuItem.d.ts +1 -1
  156. package/src/MenuItem/useVirtualizedMenuItem.d.ts +1 -1
  157. package/src/MenuList/MenuList.type.d.ts +1 -1
  158. package/src/MenuList/MenuListContext.d.ts +2 -3
  159. package/src/Modal/Modal.type.d.ts +1 -0
  160. package/src/NestedMenuContext/MenuOverlayGroupContext.d.ts +2 -2
  161. package/src/Popover/Popover.classes.d.ts +1 -1
  162. package/src/Popover/Popover.internal.d.ts +8 -0
  163. package/src/Popover/Popover.type.d.ts +1 -0
  164. package/src/Popper/Popper.type.d.ts +10 -7
  165. package/src/Rating/utils.d.ts +3 -2
  166. package/src/Select/Select.type.d.ts +7 -5
  167. package/src/Slider/Slider.d.ts +2 -2
  168. package/src/Slider/SliderThumb.d.ts +2 -1
  169. package/src/Squircle/Squircle.d.ts +1 -1
  170. package/src/StatusIndicator/StatusIndicator.d.ts +2 -1
  171. package/src/SubMenu/PopperMenu.type.d.ts +4 -1
  172. package/src/Table/Table.type.d.ts +3 -0
  173. package/src/Table/TableContext.d.ts +3 -0
  174. package/src/Table/TableRowContext.d.ts +7 -0
  175. package/src/Table/index.d.ts +1 -0
  176. package/src/TableCell/TableCell.classes.d.ts +1 -1
  177. package/src/TableFooter/TableFooter.classes.d.ts +1 -1
  178. package/src/TableFooter/TableFooter.type.d.ts +1 -0
  179. package/src/TableHead/TableHead.classes.d.ts +1 -1
  180. package/src/TableHead/TableHead.type.d.ts +1 -0
  181. package/src/TableRow/TableRow.type.d.ts +2 -0
  182. package/chunks/AccordionContext.js +0 -6
  183. package/chunks/Alert.js +0 -48
  184. package/chunks/AvatarGroup.js +0 -22
  185. package/chunks/Backdrop.js +0 -18
  186. package/chunks/Badge.js +0 -32
  187. package/chunks/BottomNavigationItem.js +0 -36
  188. package/chunks/Button.js +0 -88
  189. package/chunks/Chip.js +0 -73
  190. package/chunks/CircularProgressIndicator.js +0 -36
  191. package/chunks/Divider.js +0 -19
  192. package/chunks/DragHandle.js +0 -11
  193. package/chunks/Drawer.js +0 -32
  194. package/chunks/ExpandCollapseCaret.js +0 -24
  195. package/chunks/FormLabel.js +0 -27
  196. package/chunks/Icon.js +0 -25
  197. package/chunks/IconButtonLabel.js +0 -68
  198. package/chunks/List.js +0 -22
  199. package/chunks/ListItem.js +0 -83
  200. package/chunks/Menu.js +0 -61
  201. package/chunks/MenuDivider.js +0 -14
  202. package/chunks/MenuItemText.js +0 -17
  203. package/chunks/MenuList.js +0 -46
  204. package/chunks/Modal.js +0 -212
  205. package/chunks/Overlap.js +0 -25
  206. package/chunks/PickerTextField.js +0 -85
  207. package/chunks/Popover.js +0 -53
  208. package/chunks/PopperPaper.js +0 -15
  209. package/chunks/Select.js +0 -220
  210. package/chunks/ShowHideEye.js +0 -56
  211. package/chunks/SlideIn.js +0 -19
  212. package/chunks/SortableArrow.js +0 -73
  213. package/chunks/Squircle.js +0 -31
  214. package/chunks/StatusIndicator.js +0 -20
  215. package/chunks/StepConnector.js +0 -21
  216. package/chunks/StepIcon.js +0 -43
  217. package/chunks/StepLabel.js +0 -29
  218. package/chunks/StepperContext.js +0 -9
  219. package/chunks/TableContext.js +0 -6
  220. package/chunks/Tablelvl2Context.js +0 -6
  221. package/chunks/TabsContext.js +0 -6
  222. package/chunks/TextField.js +0 -110
  223. package/chunks/Tooltip.js +0 -217
  224. package/chunks/VirtualizedMenu.js +0 -164
  225. package/chunks/VisuallyHidden.js +0 -12
  226. package/chunks/getFade.js +0 -27
  227. package/chunks/getGrow.js +0 -70
  228. package/chunks/getSlideIn.js +0 -30
  229. package/chunks/hasContent.js +0 -3
  230. package/chunks/useAnimationFrame.js +0 -15
  231. package/chunks/useFocusTrapStack.js +0 -36
  232. package/chunks/useHelperTextId.js +0 -22
  233. package/chunks/useListNavigation.js +0 -199
  234. package/chunks/useMenuItemSelect.js +0 -273
  235. package/chunks/useMotionSafeTransition.js +0 -9
  236. package/chunks/useNestedMenuItem.js +0 -27
  237. package/chunks/useNestedParentMenu.js +0 -113
  238. package/chunks/usePrefersReducedMotion.js +0 -36
  239. package/chunks/useTooltipForceHide.js +0 -27
  240. package/chunks/useTrayNavigate.js +0 -150
  241. package/chunks/withTooltip.js +0 -15
package/Tag.js CHANGED
@@ -1,28 +1,63 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useClasses, getTitle } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
- import { I as Icon } from './chunks/Icon.js';
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
- const Tag = forwardRef((inProps, ref) => {
10
- const props = useThemeProps({ props: inProps, name: 'Tag' });
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 = (jsxs(Fragment, { children: [jsx(Icon, { className: cls('start-icon'), symbol: startIcon, size: 'xsmall' }), jsx("span", { className: cls('label'), children: label })] }));
17
- }
18
- else {
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 (jsx("div", { ...rest, ref: ref, className: cls('root', color, variant !== 'outlined' && `${variant}-${color}`, {
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
- }), title: title ?? getTitle(label), children: tagContent }));
50
+ outlined: variant === 'outlined'
51
+ }),
52
+ title: title ?? getTitle(label),
53
+ children: tagContent
54
+ });
25
55
  });
26
- Tag.displayName = 'SuiTag';
56
+ Tag_Tag.displayName = 'SuiTag';
57
+
58
+
59
+
60
+
61
+
27
62
 
28
- export { Tag, Tag$1 as tagStyle };
63
+ export { Tag as tagStyle, Tag_Tag as Tag };
package/Text.js CHANGED
@@ -1,44 +1,57 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useState, useRef } from 'react';
3
- import clsx from 'clsx';
4
- import isString from 'lodash/isString';
5
- import { useForkRef, useOverflow, useClasses } from '@ringcentral/spring-base';
6
- import { useThemeProps } from '@ringcentral/spring-theme';
7
- import { T as Tooltip } from './chunks/Tooltip.js';
8
- import 'framer-motion';
9
- import './chunks/Icon.js';
10
- import './chunks/usePrefersReducedMotion.js';
11
- import './chunks/getFade.js';
12
- import './Popper.js';
13
- import '@floating-ui/react-dom';
14
- import './chunks/Modal.js';
15
- import '@mui/base';
16
- import './chunks/useFocusTrapStack.js';
17
- import './chunks/Backdrop.js';
18
- import './chunks/PopperPaper.js';
19
-
20
- var Text$1 = {"sui-text-root":"sui-text-root","sui-text-no-wrap":"sui-text-no-wrap","sui-text-highlight-term":"sui-text-highlight-term"};
21
-
22
- const Text = forwardRef((inProps, ref) => {
23
- const props = useThemeProps({ props: inProps, name: 'Text' });
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
- useOverflow(innerRef, (state) => setIsShowTitle(state));
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 (jsx(TextRoot, { ref: textRef, title: isShowTitle ? title : undefined, className: cls('root', {
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
- }), ...rest, children: children }));
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 (jsx(Tooltip, { ...TooltipProps, title: title, PopperProps: { offset: 8 }, motionProps: null, children: jsx(TextRoot, { ref: textRef, className: clsx(cls('root', {
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), ...rest, children: children }) }));
76
+ 'highlight-term': highlight
77
+ }), lineClamp),
78
+ ...rest,
79
+ children: children
80
+ })
81
+ });
56
82
  });
57
- Text.displayName = 'SuiText';
83
+ Text_Text.displayName = 'SuiText';
84
+
85
+
86
+
87
+
88
+
58
89
 
59
- export { Text, Text$1 as textStyle };
90
+ export { Text as textStyle, Text_Text as Text };
package/TextField.js CHANGED
@@ -1,29 +1,209 @@
1
- export { T as TextField } from './chunks/TextField.js';
2
- import 'react/jsx-runtime';
3
- import 'react';
4
- import '@mui/base';
5
- import '@ringcentral/spring-base';
6
- import '@ringcentral/spring-icon';
7
- import '@ringcentral/spring-theme';
8
- import 'framer-motion';
9
- import './chunks/Icon.js';
10
- import './chunks/ShowHideEye.js';
11
- import './chunks/useMotionSafeTransition.js';
12
- import './chunks/usePrefersReducedMotion.js';
13
- import './chunks/useHelperTextId.js';
14
- import 'clsx';
15
- import './chunks/IconButtonLabel.js';
16
- import './chunks/Squircle.js';
17
- import './chunks/withTooltip.js';
18
- import './chunks/Tooltip.js';
19
- import './chunks/getFade.js';
20
- import './Popper.js';
21
- import '@floating-ui/react-dom';
22
- import './chunks/Modal.js';
23
- import './chunks/useFocusTrapStack.js';
24
- import './chunks/Backdrop.js';
25
- import './chunks/PopperPaper.js';
26
-
27
- 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"};
28
-
29
- export { TextField as textFieldStyle };
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 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { TextareaAutosize } from '@mui/base';
4
- import { logInDev, useClasses, combineProps } from '@ringcentral/spring-base';
5
- import { useThemeProps } from '@ringcentral/spring-theme';
6
- import { T as TextField } from './chunks/TextField.js';
7
- import '@ringcentral/spring-icon';
8
- import 'framer-motion';
9
- import './chunks/Icon.js';
10
- import './chunks/ShowHideEye.js';
11
- import './chunks/useMotionSafeTransition.js';
12
- import './chunks/usePrefersReducedMotion.js';
13
- import './chunks/useHelperTextId.js';
14
- import 'clsx';
15
- import './chunks/IconButtonLabel.js';
16
- import './chunks/Squircle.js';
17
- import './chunks/withTooltip.js';
18
- import './chunks/Tooltip.js';
19
- import './chunks/getFade.js';
20
- import './Popper.js';
21
- import '@floating-ui/react-dom';
22
- import './chunks/Modal.js';
23
- import './chunks/useFocusTrapStack.js';
24
- import './chunks/Backdrop.js';
25
- import './chunks/PopperPaper.js';
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 (jsx(TextField, { ...rest, size: size, variant: variant, inputProps: inputProps, inputComponent: TextareaAutosize, ClearButtonProps: combineProps({ background: true }, ClearButtonProps), ref: ref, classes: {
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
- Textarea.displayName = 'SuiTextarea';
71
+ Textarea_Textarea.displayName = 'SuiTextarea';
72
+
73
+
74
+
75
+
76
+
66
77
 
67
- export { Textarea, Textarea$1 as textareaStyle };
78
+ export { Textarea as textareaStyle, Textarea_Textarea as Textarea };