@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
@@ -1,56 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { useClasses } from '@ringcentral/spring-base';
3
- import { motionTransition } from '@ringcentral/spring-theme';
4
- import { motion } from 'framer-motion';
5
- import { I as Icon } from './Icon.js';
6
- import 'react';
7
- import { u as useMotionSafeTransition } from './useMotionSafeTransition.js';
8
-
9
- const topEyelidVariants = {
10
- show: {
11
- d: 'M 17.5 12.25 C 16.75 10.25 13.8 7 10 7 C 6.2 7 3.25 10.25 2.5 12.25',
12
- },
13
- hide: {
14
- d: 'M 17.5 6.75 C 16.75 8.75 14 12.2 10 12.2 C 6 12.2 3.25 8.75 2.5 6.75',
15
- },
16
- };
17
- const bottomEyelidVariants = {
18
- show: {
19
- d: 'M 17.5 11.75 C 16.75 13.75 13.8 17 10 17 C 6.2 17 3.25 13.75 2.5 11.75',
20
- },
21
- hide: {
22
- d: 'M 17.5 6.75 C 16.75 8.75 14 12.2 10 12.2 C 6 12.2 3.25 8.75 2.5 6.75',
23
- },
24
- };
25
- const eyelashVariants = {
26
- show: {
27
- d: 'M 10 4.5 L 10 1.5 M 4 6.35 L 2.5 3.7 M 16 6.35 L 17.5 3.7',
28
- },
29
- hide: {
30
- d: 'M 10 15.5 L 10 18.5 M 16 13.75 L 17.5 16.4 M 4 13.75 L 2.5 16.4',
31
- },
32
- };
33
- const ShowHideEye = (props) => {
34
- const { classes, size = 'medium', hide = false, className, ...rest } = props;
35
- const cls = useClasses('show-hide-eye', classes, className);
36
- const transition = useMotionSafeTransition(motionTransition['spring-01-fast']);
37
- const pupilShowTransition = useMotionSafeTransition({
38
- delay: 0.05,
39
- });
40
- const pupilHideTransition = useMotionSafeTransition({
41
- duration: 0.1,
42
- });
43
- const pupilVariants = {
44
- show: {
45
- ry: 3.75,
46
- transition: pupilShowTransition,
47
- },
48
- hide: {
49
- ry: 0,
50
- transition: pupilHideTransition,
51
- },
52
- };
53
- return (jsx(Icon, { ...rest, size: size, className: cls('root'), children: jsxs(motion.svg, { xmlns: "http://www.w3.org/2000/svg", viewBox: '0 0 20 20', animate: hide ? 'hide' : 'show', transition: transition, children: [jsx(motion.path, { initial: false, stroke: "currentColor", strokeWidth: 1.5, strokeMiterlimit: 1.5, strokeLinejoin: 'miter', strokeLinecap: 'butt', variants: topEyelidVariants, transition: transition, fill: "transparent" }), jsx(motion.path, { initial: false, stroke: "currentColor", strokeWidth: 1.5, strokeMiterlimit: 1.5, strokeLinejoin: 'miter', strokeLinecap: 'butt', variants: bottomEyelidVariants, transition: transition, fill: "transparent" }), jsx(motion.ellipse, { initial: false, cx: 10, cy: 10.5, rx: 3.75, fill: "currentColor", variants: pupilVariants }), jsx(motion.path, { initial: false, stroke: "currentColor", strokeWidth: 1.5, strokeMiterlimit: 1.5, strokeLinejoin: 'miter', strokeLinecap: 'butt', variants: eyelashVariants, transition: transition, fill: "transparent" })] }) }));
54
- };
55
-
56
- export { ShowHideEye as S };
package/chunks/SlideIn.js DELETED
@@ -1,19 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { motion } from 'framer-motion';
3
- import { u as usePrefersReducedMotion } from './usePrefersReducedMotion.js';
4
- import '@ringcentral/spring-theme';
5
- import { g as getSlideIn } from './getSlideIn.js';
6
-
7
- const SlideIn = (props) => {
8
- const { toggle, toggleOnTransition, toggleOffTransition, children, from = 'right', ...rest } = props;
9
- const prefersReducedMotion = usePrefersReducedMotion();
10
- return (jsx(motion.div, { ...getSlideIn({
11
- toggle,
12
- from,
13
- prefersReducedMotion,
14
- toggleOnTransition,
15
- toggleOffTransition,
16
- }), ...rest, children: children }));
17
- };
18
-
19
- export { SlideIn as S };
@@ -1,73 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { useClasses } from '@ringcentral/spring-base';
3
- import { motion } from 'framer-motion';
4
- import { motionTransition } from '@ringcentral/spring-theme';
5
- import { I as Icon } from './Icon.js';
6
- import 'react';
7
- import { u as useMotionSafeTransition } from './useMotionSafeTransition.js';
8
-
9
- const topCaretVariants = {
10
- initial: {
11
- d: 'M 5 7.5 L 10 2.5 L 15 7.5',
12
- opacity: 1,
13
- },
14
- asc: {
15
- d: 'M 4.75 9.5 L 10 4 L 15.25 9.5',
16
- opacity: 1,
17
- },
18
- desc: {
19
- d: 'M 10 9.5 L 10 4.5 L 10 9.5',
20
- opacity: 0,
21
- transition: {
22
- ease: 'easeOut',
23
- duration: 0.15,
24
- },
25
- },
26
- };
27
- const topLineVariants = {
28
- initial: {
29
- d: 'M 10 2.5 L 10 2.5',
30
- opacity: 0,
31
- },
32
- asc: {
33
- d: 'M 10 4.5 L 10 15.5',
34
- opacity: 1,
35
- },
36
- };
37
- const bottomLineVariants = {
38
- initial: {
39
- d: 'M 10 17.5 L 10 17.5',
40
- opacity: 0,
41
- },
42
- desc: {
43
- d: 'M 10 15.5 L 10 4.5',
44
- opacity: 1,
45
- },
46
- };
47
- const bottomCaretVariants = {
48
- initial: {
49
- d: 'M 5 12.5 L 10 17.5 L 15 12.5',
50
- opacity: 1,
51
- },
52
- asc: {
53
- d: 'M 10 10.5 L 10 15.5 L 10 10.5',
54
- opacity: 0,
55
- transition: {
56
- ease: 'easeOut',
57
- duration: 0.15,
58
- },
59
- },
60
- desc: {
61
- d: 'M 4.75 10.5 L 10 16 L 15.25 10.5',
62
- opacity: 1,
63
- },
64
- };
65
- const SortableArrow = (props) => {
66
- const { classes, size = 'medium', direction = false, className, ...rest } = props;
67
- const cls = useClasses('sortable-arrow', classes, className);
68
- const caretTransition = useMotionSafeTransition(motionTransition['spring-01-fast']);
69
- const lineTransition = useMotionSafeTransition(motionTransition['neutral-01-fast']);
70
- return (jsx(Icon, { ...rest, size: size, className: cls('root'), children: jsxs(motion.svg, { xmlns: "http://www.w3.org/2000/svg", viewBox: '0 0 20 20', animate: direction || 'initial', children: [jsx(motion.path, { initial: false, stroke: "currentColor", strokeWidth: 1.5, strokeMiterlimit: 1.5, strokeLinejoin: 'miter', variants: topCaretVariants, transition: caretTransition, fill: "transparent" }), direction !== 'desc' && (jsx(motion.path, { initial: false, stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: 'square', variants: topLineVariants, transition: lineTransition, fill: "transparent" })), direction !== 'asc' && (jsx(motion.path, { initial: false, stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: 'square', variants: bottomLineVariants, transition: lineTransition, fill: "transparent" })), jsx(motion.path, { initial: false, stroke: "currentColor", strokeWidth: 1.5, strokeMiterlimit: 1.5, strokeLinejoin: 'miter', variants: bottomCaretVariants, transition: caretTransition, fill: "transparent" })] }) }));
71
- };
72
-
73
- export { SortableArrow as S };
@@ -1,31 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import React, { forwardRef, isValidElement, cloneElement } from 'react';
3
- import { useClasses, useId } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
-
6
- const SQUIRCLE_PATH = 'M 0.5 0 C 0.879 0 1 0.121 1 0.5 C 1 0.879 0.879 1 0.5 1 C 0.121 1 0 0.879 0 0.5 C 0 0.121 0.121 0 0.5 0 Z';
7
- const Squircle = forwardRef((inProps, ref) => {
8
- const props = useThemeProps({ props: inProps, name: 'Squircle' });
9
- const { component = 'div', focusVisible, active, children: childrenProp, className, classes, interactive = true, fillShape: fillShapeProp = false, ...rest } = props;
10
- const children = React.Children.toArray(childrenProp);
11
- const firstChild = children[0];
12
- const fillShape = fillShapeProp &&
13
- firstChild &&
14
- isValidElement(firstChild);
15
- const cls = useClasses('squircle', classes, className);
16
- const clipId = useId('sui-squircle-clip', true);
17
- const showFocusRing = interactive && focusVisible;
18
- const Root = component;
19
- return (jsxs(Root, { className: cls('root', { active, interactive }), ...rest, ref: ref, children: [jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "0", height: "0", viewBox: "0 0 1 1", children: jsx("defs", { children: jsx("clipPath", { id: clipId, clipPathUnits: "objectBoundingBox", children: jsx("path", { d: SQUIRCLE_PATH }) }) }) }), !fillShape && (jsx("svg", { className: cls('content'), xmlns: "http://www.w3.org/2000/svg", viewBox: '0 0 1 1', children: jsx("path", { clipPath: `url(#${clipId})`, d: SQUIRCLE_PATH, vectorEffect: "non-scaling-stroke" }) })), showFocusRing && (jsx("svg", { className: cls('ring'), xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1 1", overflow: "visible", children: jsx("path", { d: SQUIRCLE_PATH, fillOpacity: 0, vectorEffect: "non-scaling-stroke" }) })), fillShape
20
- ? cloneElement(firstChild, {
21
- style: {
22
- ...firstChild.props.style,
23
- with: '100%',
24
- height: '100%',
25
- clipPath: `url(#${clipId})`,
26
- },
27
- })
28
- : children] }));
29
- });
30
-
31
- export { Squircle as S };
@@ -1,20 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useClasses } from '@ringcentral/spring-base';
3
- import { MinusBoldMd, CheckBoldSm } from '@ringcentral/spring-icon';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
- import { I as Icon } from './Icon.js';
6
-
7
- const IconSizeMap = {
8
- large: 'small',
9
- medium: 'xsmall',
10
- small: 'xsmall',
11
- };
12
- const StatusIndicator = (inProps) => {
13
- const props = useThemeProps({ props: inProps, name: 'StatusIndicator' });
14
- const { classes, className, size = 'medium', variant = 'available', ...rest } = props;
15
- const cls = useClasses('status-indicator', classes, className);
16
- return (jsxs("div", { className: cls('root', size, variant), ...rest, children: [variant === 'dnd' && (jsx(Icon, { symbol: MinusBoldMd, size: IconSizeMap[size] })), variant === 'available' && (jsx(Icon, { symbol: CheckBoldSm, size: IconSizeMap[size] }))] }));
17
- };
18
- StatusIndicator.displayName = 'SuiStatusIndicator';
19
-
20
- export { StatusIndicator as S };
@@ -1,21 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useClasses } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
- import { b as useStepperContext, u as useStepContext } from './StepperContext.js';
6
-
7
- const StepConnector = forwardRef((inProps, ref) => {
8
- const props = useThemeProps({ props: inProps, name: 'StepConnector' });
9
- const { classes, className, children, ...rest } = props;
10
- const cls = useClasses('step-connector', classes, className);
11
- const { orientation = 'horizontal' } = useStepperContext();
12
- const { active, disabled, completed } = useStepContext();
13
- return (jsx("div", { "aria-hidden": true, className: cls('root', orientation, {
14
- active,
15
- completed,
16
- disabled,
17
- }), ...rest, ref: ref, children: jsx("span", { className: cls('line', `line-${orientation}`) }) }));
18
- });
19
- StepConnector.displayName = 'SuiStepConnector';
20
-
21
- export { StepConnector as S };
@@ -1,43 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useClasses } from '@ringcentral/spring-base';
4
- import { AlertFilledMd, AlertMd, CheckBoldMd, CheckMd } from '@ringcentral/spring-icon';
5
- import { useThemeProps } from '@ringcentral/spring-theme';
6
- import { I as Icon } from './Icon.js';
7
-
8
- const StepIcon = forwardRef((inProps, ref) => {
9
- const props = useThemeProps({ props: inProps, name: 'StepIcon' });
10
- const { classes, className, children, active = false, completed = false, error = false, disabled = false, variant = 'contained', icon, symbol, ...rest } = props;
11
- const cls = useClasses('step-icon', classes, className);
12
- if (symbol) {
13
- return (jsx("span", { className: cls('root', variant, error && `${variant}-error`, active && `${variant}-current`, {
14
- current: active,
15
- completed,
16
- error,
17
- disabled,
18
- }), ...rest, ref: ref, children: jsx(Icon, { className: cls('icon'), size: "xsmall", symbol: symbol }) }));
19
- }
20
- if (typeof icon === 'number' || typeof icon === 'string') {
21
- let content;
22
- if (error) {
23
- content = (jsx(Icon, { className: cls('icon'), size: "large", symbol: variant === 'contained' ? AlertFilledMd : AlertMd }));
24
- }
25
- else if (completed) {
26
- content =
27
- variant === 'contained' ? (jsx(Icon, { className: cls('icon'), size: "xsmall", symbol: CheckBoldMd })) : (jsx(Icon, { className: cls('icon'), size: "large", symbol: CheckMd }));
28
- }
29
- else {
30
- content = (jsx("span", { className: cls('text', active && 'text-current'), children: icon }));
31
- }
32
- return (jsx("span", { className: cls('root', variant, error && `${variant}-error`, active && `${variant}-current`, {
33
- current: active,
34
- completed,
35
- error,
36
- disabled,
37
- }), ...rest, ref: ref, children: content }));
38
- }
39
- return icon;
40
- });
41
- StepIcon.displayName = 'SuiStepIcon';
42
-
43
- export { StepIcon as S };
@@ -1,29 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useClasses } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
- import clsx from 'clsx';
6
- import { b as useStepperContext, u as useStepContext } from './StepperContext.js';
7
- import { S as StepIcon } from './StepIcon.js';
8
-
9
- const StepLabel = forwardRef((inProps, ref) => {
10
- const props = useThemeProps({ props: inProps, name: 'StepLabel' });
11
- const { classes, className, children, error = false, icon: iconProp, optional, labelProps = {}, StepIconComponent: StepIconComponentProp, StepIconProps, ...rest } = props;
12
- const cls = useClasses('step-label', classes, className);
13
- const { orientation = 'horizontal' } = useStepperContext();
14
- const { active, disabled, completed, icon: iconContext, id, connector, index, last, variant, } = useStepContext();
15
- const icon = iconProp || iconContext;
16
- let StepIconComponent = StepIconComponentProp;
17
- if (icon && !StepIconComponent) {
18
- StepIconComponent = StepIcon;
19
- }
20
- return (jsxs("span", { id: id, className: cls('root', orientation, {
21
- current: active,
22
- completed,
23
- disabled,
24
- error,
25
- }), ...rest, ref: ref, children: [index !== 0 ? connector : null, StepIconComponent ? (jsx("span", { className: cls('icon-container', `${orientation}-icon-container`), children: jsx(StepIconComponent, { completed: completed, active: active, error: error, disabled: disabled, icon: icon, variant: variant, ...StepIconProps }) })) : null, jsxs("span", { className: cls('label-container', `${orientation}-label-container`, error && 'error-label-container', { disabled }), children: [children ? (jsx("span", { ...labelProps, className: clsx(cls('label', `${orientation}-label`, active && 'current-label', error && 'error-label', { disabled, completed }), labelProps?.className), children: children })) : null, optional] }), !last ? connector : null] }));
26
- });
27
- StepLabel.displayName = 'SuiStepLabel';
28
-
29
- export { StepLabel as S };
@@ -1,9 +0,0 @@
1
- import { createContext, useContext } from 'react';
2
-
3
- const StepContext = createContext({});
4
- const useStepContext = () => useContext(StepContext);
5
-
6
- const StepperContext = createContext({});
7
- const useStepperContext = () => useContext(StepperContext);
8
-
9
- export { StepContext as S, StepperContext as a, useStepperContext as b, useStepContext as u };
@@ -1,6 +0,0 @@
1
- import { createContext, useContext } from 'react';
2
-
3
- const TableContext = createContext({});
4
- const useTableContext = () => useContext(TableContext);
5
-
6
- export { TableContext as T, useTableContext as u };
@@ -1,6 +0,0 @@
1
- import { createContext, useContext } from 'react';
2
-
3
- const Tablelvl2Context = createContext({});
4
- const useTablelvl2Context = () => useContext(Tablelvl2Context);
5
-
6
- export { Tablelvl2Context as T, useTablelvl2Context as u };
@@ -1,6 +0,0 @@
1
- import { createContext, useContext } from 'react';
2
-
3
- const TabsContext = createContext({});
4
- const useTabsContext = () => useContext(TabsContext);
5
-
6
- export { TabsContext as T, useTabsContext as u };
@@ -1,110 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useRef } from 'react';
3
- import { useInput } from '@mui/base';
4
- import { useId, useClasses, useControlled, useEventCallback, combineProps, useForkRef } from '@ringcentral/spring-base';
5
- import { Xmd } from '@ringcentral/spring-icon';
6
- import { useThemeProps } from '@ringcentral/spring-theme';
7
- import 'framer-motion';
8
- import './Icon.js';
9
- import { S as ShowHideEye } from './ShowHideEye.js';
10
- import { u as useHelperTextId, F as FormField } from './useHelperTextId.js';
11
- import { I as IconButton } from './IconButtonLabel.js';
12
-
13
- const TextFieldComponent = (inProps, ref) => {
14
- const props = useThemeProps({ props: inProps, name: 'TextField' });
15
- 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;
16
- const placeholder = placeholderProp || ' ';
17
- const defaultId = useId();
18
- const id = idProp ?? inputProps?.id ?? defaultId;
19
- const cls = useClasses('text-field', classes, className);
20
- const { disabled, required, error, getInputProps } = useInput(props);
21
- const states = { disabled, required, error, focused };
22
- const idForHelperText = useHelperTextId({
23
- helperText: helperTextProp,
24
- id,
25
- FormHelperTextProps,
26
- });
27
- const widgetProps = getInputProps({
28
- 'aria-describedby': idForHelperText,
29
- ...inputProps,
30
- placeholder,
31
- id,
32
- type,
33
- });
34
- const inputRef = useRef();
35
- const handlerClear = (e) => {
36
- if (disabled)
37
- return;
38
- const el = inputRef.current;
39
- if (el) {
40
- onClear?.(e);
41
- const host = Object.getPrototypeOf(el);
42
- Object.getOwnPropertyDescriptor(host, 'value')?.set?.call(el, '');
43
- el.focus();
44
- el.dispatchEvent(new InputEvent('input', { bubbles: true }));
45
- }
46
- };
47
- let helperText = helperTextProp;
48
- if (showCharacterCount &&
49
- inputProps?.maxLength !== undefined &&
50
- props.value !== undefined) {
51
- helperText = (jsxs("div", { className: cls('helper-text'), children: [jsx("span", { children: helperText }), jsxs("span", { children: [props.value?.length ?? 0, "/", inputProps.maxLength] })] }));
52
- }
53
- const [maskValue, setMaskValue] = useControlled({
54
- controlled: maskValueProps,
55
- default: false,
56
- name: 'TextField',
57
- state: 'showPassword',
58
- });
59
- let inputType = type;
60
- const shouldShowMaskToggleButton = showMaskValueToggleButton && type === 'password';
61
- const isSearchInput = type === 'search';
62
- const shouldHideNativeClear = isSearchInput && !useNativeClearBtn;
63
- if (shouldShowMaskToggleButton) {
64
- if (maskValue) {
65
- inputType = 'text';
66
- }
67
- else {
68
- inputType = 'password';
69
- }
70
- }
71
- const handleMaskValueChange = useEventCallback(() => {
72
- setMaskValue(!maskValue);
73
- if (props.onMaskValueChange) {
74
- props.onMaskValueChange(!maskValue);
75
- }
76
- });
77
- return (jsxs(FormField, { ...combineProps({
78
- classes: {
79
- root: cls('root', {
80
- 'full-width': fullWidth,
81
- 'hide-native-clear': shouldHideNativeClear,
82
- }),
83
- content: cls('form-field-content'),
84
- outlined: cls('outlined'),
85
- standard: cls('standard'),
86
- quiet: cls('quiet'),
87
- },
88
- contentProps: {
89
- onClick: (e) => {
90
- onClick?.(e);
91
- if (e.target === e.currentTarget && !disabled) {
92
- inputRef.current?.focus();
93
- }
94
- },
95
- },
96
- }, RootProps), ...states, htmlFor: id, label: label, ref: ref, helperText: helperText, variant: variant, size: size, FormHelperTextProps: { id: idForHelperText, ...FormHelperTextProps }, children: [startAdornment && (jsx("div", { className: cls('start-adornment'), children: startAdornment })), jsx(InputComponent, { readOnly: readOnly, autoComplete: "off", autoFocus: autoFocus, onKeyDown: onKeyDown, onKeyUp: onKeyUp, ...widgetProps, className: cls('input'), ref: useForkRef(widgetProps.ref, inputRef), type: inputType }), clearBtn && (jsx(IconButton, { symbol: Xmd, shape: 'squircle', background: false, color: 'secondary', variant: "contained", size: "small", title: clearText, "aria-label": clearText, disabled: disabled, ...combineProps({
97
- className: cls('clear'),
98
- onClick: handlerClear,
99
- }, ClearButtonProps) })), shouldShowMaskToggleButton && (jsx(IconButton, { disabled: disabled, shape: 'squircle', background: false, color: 'neutral', variant: "icon", size: "small", ...combineProps({
100
- className: cls('mask-value-button'),
101
- onClick: handleMaskValueChange,
102
- 'aria-label': maskValue ? 'eye-visible' : 'eye',
103
- }, MaskValueButtonProps), children: jsx(ShowHideEye, { hide: !maskValue, size: ShowHideEyeIconProps?.size ??
104
- MaskValueButtonProps?.iconSize ??
105
- 'small', ...ShowHideEyeIconProps }) })), endAdornment && (jsx("div", { className: cls('end-adornment'), children: endAdornment }))] }));
106
- };
107
- const TextField = forwardRef(TextFieldComponent);
108
- TextField.displayName = 'SuiTextField';
109
-
110
- export { TextField as T };
package/chunks/Tooltip.js DELETED
@@ -1,217 +0,0 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { useThemeProps } from '@ringcentral/spring-theme';
3
- import { AnimatePresence } from 'framer-motion';
4
- import { useRef, useEffect, cloneElement, forwardRef } from 'react';
5
- import { logInDev, useWindowContext, useId, useControlled, useIsFocusVisible, useForkRef, useEventListener, useClasses, combineProps } from '@ringcentral/spring-base';
6
- import clsx from 'clsx';
7
- import { I as Icon } from './Icon.js';
8
- import { u as usePrefersReducedMotion } from './usePrefersReducedMotion.js';
9
- import { g as getFade } from './getFade.js';
10
- import { Popper } from '../Popper.js';
11
- import { P as PopperPaper } from './PopperPaper.js';
12
-
13
- const ARIA_DESCRIBEDBY = 'aria-describedby';
14
- const ARIA_LABEL = 'aria-label';
15
- const ARIA_LABELLEDBY = 'aria-labelledby';
16
- const HTML_TITLE = 'title';
17
- let hasWarnedTriggerWhenDisabledNonStringTitle = false;
18
- function computeTooltipA11y({ title, describeChild, triggerWhenDisabled, open, tooltipId, child, }) {
19
- const nameOrDescProps = {};
20
- const disabledOverrides = {};
21
- const titleIsString = typeof title === 'string';
22
- const childProps = child.props;
23
- const hasAriaDescribedBy = ARIA_DESCRIBEDBY in childProps;
24
- const hasAriaLabel = ARIA_LABEL in childProps;
25
- const hasAriaLabelledBy = ARIA_LABELLEDBY in childProps;
26
- const hasUserTitle = HTML_TITLE in childProps;
27
- if (process.env.NODE_ENV !== 'production' &&
28
- triggerWhenDisabled &&
29
- !titleIsString &&
30
- title != null &&
31
- !hasUserTitle &&
32
- !hasWarnedTriggerWhenDisabledNonStringTitle) {
33
- hasWarnedTriggerWhenDisabledNonStringTitle = true;
34
- logInDev({
35
- scope: 'Tooltip',
36
- level: 'warn',
37
- message: 'Using Tooltip with `triggerWhenDisabled` and a non-string `title` is not fully accessible. Use a string `title` when explaining why a control is disabled.',
38
- });
39
- }
40
- if (describeChild) {
41
- if (!hasAriaDescribedBy) {
42
- if (!hasUserTitle) {
43
- nameOrDescProps.title =
44
- !open && titleIsString ? title : null;
45
- }
46
- else if (open) {
47
- nameOrDescProps.title = null;
48
- }
49
- nameOrDescProps[ARIA_DESCRIBEDBY] = open ? tooltipId : null;
50
- }
51
- }
52
- else {
53
- if (titleIsString && !hasAriaLabel) {
54
- nameOrDescProps[ARIA_LABEL] = title;
55
- nameOrDescProps.title = null;
56
- }
57
- else if (!titleIsString && !hasAriaLabelledBy && title) {
58
- nameOrDescProps[ARIA_LABELLEDBY] = open ? tooltipId : null;
59
- if (open) {
60
- nameOrDescProps.title = null;
61
- }
62
- }
63
- else if (open) {
64
- nameOrDescProps.title = null;
65
- }
66
- }
67
- if (triggerWhenDisabled) {
68
- if (open) {
69
- if (!hasAriaDescribedBy) {
70
- disabledOverrides[ARIA_DESCRIBEDBY] = tooltipId;
71
- }
72
- disabledOverrides.title = null;
73
- }
74
- else if (titleIsString) {
75
- disabledOverrides.title = title;
76
- }
77
- }
78
- return { nameOrDescProps, disabledOverrides };
79
- }
80
-
81
- const getDelayTime = (delay) => {
82
- if (!delay)
83
- return null;
84
- if (delay === true)
85
- return 1500;
86
- return delay;
87
- };
88
- const TooltipTrigger = (props, ref) => {
89
- const { renderTooltip, children, open: openProp, delay = false, onOpenStateChange, triggerWhenDisabled, triggerWrapperProps, disableFocusListener, tooltipId: tooltipIdProp, title, describeChild = false, } = props;
90
- const anchorRef = useRef(null);
91
- const didInitiateWithTouch = useRef(false);
92
- const { document } = useWindowContext();
93
- const generatedId = useId();
94
- const tooltipId = tooltipIdProp ?? generatedId;
95
- const [open, setOpen] = useControlled({
96
- controlled: openProp,
97
- default: false,
98
- name: 'Tooltip',
99
- state: 'open',
100
- });
101
- const { isFocusVisibleRef, onFocus: handleFocusVisible, onBlur: handleBlurVisible, ref: focusVisibleRef, } = useIsFocusVisible();
102
- const handleAnchorRef = useForkRef(anchorRef, focusVisibleRef, children.ref);
103
- const delayTimerRef = useRef();
104
- useEffect(() => () => {
105
- clearTimeout(delayTimerRef.current);
106
- }, []);
107
- const handleOpen = (e) => {
108
- const delayTime = getDelayTime(delay);
109
- if (delayTime) {
110
- delayTimerRef.current = setTimeout(() => {
111
- setOpen(true);
112
- onOpenStateChange?.(e, true);
113
- }, delayTime);
114
- }
115
- else {
116
- setOpen(true);
117
- onOpenStateChange?.(e, true);
118
- }
119
- };
120
- const handleClose = (e) => {
121
- clearTimeout(delayTimerRef.current);
122
- delayTimerRef.current = undefined;
123
- setOpen(false);
124
- onOpenStateChange?.(e, false);
125
- };
126
- useEventListener(anchorRef, 'mouseenter', (e) => {
127
- if (didInitiateWithTouch.current) {
128
- didInitiateWithTouch.current = false;
129
- return;
130
- }
131
- if (anchorRef.current) {
132
- anchorRef.current.removeAttribute('title');
133
- }
134
- handleOpen(e);
135
- });
136
- useEventListener(anchorRef, 'mouseleave', (e) => {
137
- handleClose(e);
138
- });
139
- useEventListener(anchorRef, 'touchstart', (e) => {
140
- didInitiateWithTouch.current = true;
141
- }, {
142
- passive: true,
143
- });
144
- useEventListener(anchorRef, 'focus', (e) => {
145
- if (disableFocusListener)
146
- return;
147
- handleFocusVisible(e);
148
- if (isFocusVisibleRef.current === true) {
149
- handleOpen(e);
150
- }
151
- });
152
- useEventListener(anchorRef, 'blur', (e) => {
153
- handleBlurVisible(e);
154
- if (isFocusVisibleRef.current === false) {
155
- handleClose(e);
156
- }
157
- });
158
- useEventListener(open ? document : null, 'keydown', (e) => {
159
- if (e.key === 'Escape') {
160
- handleClose(e);
161
- }
162
- });
163
- const { nameOrDescProps, disabledOverrides } = computeTooltipA11y({
164
- title,
165
- describeChild,
166
- triggerWhenDisabled,
167
- open,
168
- tooltipId,
169
- child: children,
170
- });
171
- return (jsxs(Fragment, { children: [triggerWhenDisabled ? (jsx("span", { ...triggerWrapperProps, className: clsx('sui-tooltip-trigger-wrapper', triggerWrapperProps?.className), ref: handleAnchorRef, children: cloneElement(children, disabledOverrides) })) : (cloneElement(children, {
172
- ref: handleAnchorRef,
173
- ...nameOrDescProps,
174
- })), renderTooltip(open, () => anchorRef.current, tooltipId)] }));
175
- };
176
- TooltipTrigger.displayName = 'SuiTooltipTrigger';
177
-
178
- const TooltipView = forwardRef((props, ref) => {
179
- const { className, icon, size = 'small', classes, children, placement = 'bottom', PopperProps, color = 'neutral', anchorEl, motionProps, tooltipForceHide = false, disableInteractions = true, PopperPaperProps: popperPaperPropsProp, } = props;
180
- const prefersReducedMotion = usePrefersReducedMotion();
181
- const cls = useClasses('tooltip-view', classes, className);
182
- const padding = PopperProps?.padding;
183
- const popperPadding = typeof padding === 'object'
184
- ? {
185
- top: padding.top ?? 16,
186
- right: padding.right ?? 16,
187
- bottom: padding.bottom ?? 16,
188
- left: padding.left ?? 16,
189
- }
190
- : (padding ?? 16);
191
- return (jsx(Popper, { role: "tooltip", placement: placement, offset: 4, ...PopperProps, padding: popperPadding, className: cls('root', {
192
- 'force-hide': tooltipForceHide,
193
- 'disable-interactions': disableInteractions,
194
- }), anchorEl: anchorEl, arrowHeight: 6, arrowPadding: 8, ref: ref, children: ({ arrowRef, arrowStyle }) => (jsxs(PopperPaper, { ...(motionProps ?? getFade({ prefersReducedMotion })), ...combineProps({
195
- arrowRef,
196
- arrowStyle,
197
- classes: {
198
- root: cls('paper', color),
199
- content: cls('paper-content', `paper-content-${size}`),
200
- },
201
- }, popperPaperPropsProp), children: [icon && jsx(Icon, { symbol: icon, size: "small", className: cls('icon') }), jsx("div", { className: cls('content', `content-${size}`), children: children })] })) }));
202
- });
203
- TooltipView.displayName = 'SuiTooltipView';
204
-
205
- const Tooltip = forwardRef((inProps, ref) => {
206
- const props = useThemeProps({ props: inProps, name: 'Tooltip' });
207
- const { children, open: openProp, delay, onOpenStateChange, title, disableFocusListener, disableBackdropAnimation, triggerWhenDisabled, triggerWrapperProps, PopperProps, describeChild = false, ...rest } = props;
208
- const renderTooltip = (open, getAnchorEl, tooltipId) => {
209
- const effectiveOpen = open && !(!title && title !== 0);
210
- const content = effectiveOpen ? (jsx(TooltipView, { disableInteractions: openProp === undefined, ...rest, PopperProps: { ...PopperProps, id: tooltipId }, anchorEl: getAnchorEl, ref: ref, children: title })) : null;
211
- return disableBackdropAnimation ? (jsx(Fragment, { children: content })) : (jsx(AnimatePresence, { children: content }));
212
- };
213
- return (jsx(TooltipTrigger, { disableFocusListener: disableFocusListener, open: openProp, delay: delay, onOpenStateChange: onOpenStateChange, renderTooltip: renderTooltip, triggerWhenDisabled: triggerWhenDisabled, triggerWrapperProps: triggerWrapperProps, tooltipId: PopperProps?.id, title: title, describeChild: describeChild, children: children }));
214
- });
215
- Tooltip.displayName = 'SuiTooltip';
216
-
217
- export { Tooltip as T, TooltipTrigger as a, TooltipView as b };