@ringcentral/spring-ui 1.12.0 → 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 (213) hide show
  1. package/Accordion.js +90 -34
  2. package/AccordionHeader.js +71 -21
  3. package/Alert.js +120 -28
  4. package/Animation.js +2 -46
  5. package/Announcement.js +46 -35
  6. package/Autocomplete.js +1011 -583
  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 +57 -15
  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 -192
  23. package/DateUtilsContext.js +43 -25
  24. package/Dialer.js +564 -253
  25. package/Dialog.js +99 -45
  26. package/Divider.js +43 -7
  27. package/DragHandle.js +32 -6
  28. package/Drawer.js +117 -19
  29. package/Dropdown.js +154 -77
  30. package/EmptyState.js +65 -15
  31. package/FabButton.js +51 -17
  32. package/FocusTrap.js +109 -12
  33. package/FormField.js +108 -12
  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 -17
  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 -16
  50. package/MenuItem.js +402 -35
  51. package/MenuItemText.js +51 -9
  52. package/MenuList.js +87 -36
  53. package/Modal.js +345 -16
  54. package/NestedMenuContext.js +183 -11
  55. package/Option.js +32 -36
  56. package/Overlap.js +54 -7
  57. package/PageHeader.js +62 -24
  58. package/PickerTextField.js +156 -35
  59. package/Popover.js +262 -21
  60. package/Popper.js +112 -62
  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 -44
  67. package/SingleFilter.js +148 -79
  68. package/Skeleton.js +68 -17
  69. package/Slider.js +167 -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 +44 -20
  75. package/SplitButton.js +124 -89
  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 +67 -24
  82. package/StepIcon.js +90 -9
  83. package/StepLabel.js +90 -14
  84. package/Stepper.js +65 -23
  85. package/SubMenu.js +203 -101
  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 -79
  98. package/TableRow.js +60 -21
  99. package/Tabs.js +592 -271
  100. package/Tag.js +51 -16
  101. package/Text.js +68 -37
  102. package/TextField.js +209 -31
  103. package/Textarea.js +51 -42
  104. package/TimePicker.js +490 -232
  105. package/Tooltip.js +48 -23
  106. package/Tray.js +237 -13
  107. package/TrayMenu.js +62 -43
  108. package/VirtualizedList.js +205 -107
  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 +2436 -2261
  127. package/index.js +245 -195
  128. package/internal/utils/setRef.d.ts +2 -1
  129. package/package.json +4 -4
  130. package/src/Animation/hooks/useMotionSafeTransition/useMotionSafeTransition.d.ts +2 -0
  131. package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +1 -1
  132. package/src/Button/Button.classes.d.ts +1 -1
  133. package/src/ComponentsProps.d.ts +111 -110
  134. package/src/DatePicker/DatePickerDataAttributes.d.ts +11 -0
  135. package/src/DatePicker/utils/DatePickerUtils.d.ts +1 -1
  136. package/src/MenuItem/MenuItem.type.d.ts +1 -0
  137. package/src/MenuList/MenuListContext.d.ts +2 -3
  138. package/src/Modal/Modal.type.d.ts +1 -0
  139. package/src/Popover/Popover.classes.d.ts +1 -1
  140. package/src/Popover/Popover.internal.d.ts +8 -0
  141. package/src/Popover/Popover.type.d.ts +1 -0
  142. package/src/Select/Select.type.d.ts +6 -4
  143. package/src/Table/Table.type.d.ts +3 -0
  144. package/src/Table/TableContext.d.ts +3 -0
  145. package/src/Table/TableRowContext.d.ts +7 -0
  146. package/src/Table/index.d.ts +1 -0
  147. package/src/TableCell/TableCell.classes.d.ts +1 -1
  148. package/src/TableFooter/TableFooter.classes.d.ts +1 -1
  149. package/src/TableFooter/TableFooter.type.d.ts +1 -0
  150. package/src/TableHead/TableHead.classes.d.ts +1 -1
  151. package/src/TableHead/TableHead.type.d.ts +1 -0
  152. package/src/TableRow/TableRow.type.d.ts +2 -0
  153. package/chunks/AccordionContext.js +0 -6
  154. package/chunks/Alert.js +0 -48
  155. package/chunks/AvatarGroup.js +0 -22
  156. package/chunks/Backdrop.js +0 -18
  157. package/chunks/Badge.js +0 -32
  158. package/chunks/BottomNavigationItem.js +0 -36
  159. package/chunks/Button.js +0 -88
  160. package/chunks/Chip.js +0 -73
  161. package/chunks/CircularProgressIndicator.js +0 -36
  162. package/chunks/Divider.js +0 -19
  163. package/chunks/DragHandle.js +0 -11
  164. package/chunks/Drawer.js +0 -33
  165. package/chunks/ExpandCollapseCaret.js +0 -24
  166. package/chunks/FormLabel.js +0 -27
  167. package/chunks/Icon.js +0 -25
  168. package/chunks/IconButtonLabel.js +0 -68
  169. package/chunks/List.js +0 -22
  170. package/chunks/ListItem.js +0 -83
  171. package/chunks/Menu.js +0 -61
  172. package/chunks/MenuDivider.js +0 -14
  173. package/chunks/MenuItemText.js +0 -18
  174. package/chunks/MenuList.js +0 -47
  175. package/chunks/Modal.js +0 -211
  176. package/chunks/Overlap.js +0 -25
  177. package/chunks/PickerTextField.js +0 -85
  178. package/chunks/Popover.js +0 -61
  179. package/chunks/PopperPaper.js +0 -15
  180. package/chunks/Select.js +0 -225
  181. package/chunks/ShowHideEye.js +0 -56
  182. package/chunks/SlideIn.js +0 -20
  183. package/chunks/SortableArrow.js +0 -73
  184. package/chunks/Squircle.js +0 -31
  185. package/chunks/StatusIndicator.js +0 -20
  186. package/chunks/StepConnector.js +0 -21
  187. package/chunks/StepIcon.js +0 -43
  188. package/chunks/StepLabel.js +0 -29
  189. package/chunks/StepperContext.js +0 -9
  190. package/chunks/TableContext.js +0 -6
  191. package/chunks/Tablelvl2Context.js +0 -6
  192. package/chunks/TabsContext.js +0 -6
  193. package/chunks/TextField.js +0 -110
  194. package/chunks/Tooltip.js +0 -217
  195. package/chunks/VirtualizedMenu.js +0 -162
  196. package/chunks/VisuallyHidden.js +0 -12
  197. package/chunks/composeEventHandlers.js +0 -10
  198. package/chunks/getFade.js +0 -27
  199. package/chunks/getGrow.js +0 -70
  200. package/chunks/getSlideIn.js +0 -30
  201. package/chunks/hasContent.js +0 -3
  202. package/chunks/useAnimationFrame.js +0 -15
  203. package/chunks/useFocusTrapStack.js +0 -38
  204. package/chunks/useHelperTextId.js +0 -24
  205. package/chunks/useListNavigation.js +0 -199
  206. package/chunks/useMenuItemSelect.js +0 -282
  207. package/chunks/useMotionSafeTransition.js +0 -9
  208. package/chunks/useNestedMenuItem.js +0 -27
  209. package/chunks/useNestedParentMenu.js +0 -113
  210. package/chunks/usePrefersReducedMotion.js +0 -36
  211. package/chunks/useTooltipForceHide.js +0 -27
  212. package/chunks/useTrayNavigate.js +0 -150
  213. package/chunks/withTooltip.js +0 -15
package/chunks/Button.js DELETED
@@ -1,88 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import React, { forwardRef } from 'react';
3
- import clsx from 'clsx';
4
- import { useButton } from '@mui/base';
5
- import { useClasses } from '@ringcentral/spring-base';
6
- import { useThemeProps } from '@ringcentral/spring-theme';
7
- import { C as CircularProgressIndicator } from './CircularProgressIndicator.js';
8
- import { I as Icon } from './Icon.js';
9
- import './Tooltip.js';
10
- import { w as withTooltip } from './withTooltip.js';
11
-
12
- const buttonIconSizeMap = {
13
- xlarge: 'large',
14
- large: 'medium',
15
- medium: 'small',
16
- small: 'small',
17
- xsmall: 'xsmall',
18
- };
19
- const CircularProgressIndicatorSizeMap = {
20
- xlarge: 'medium',
21
- large: 'medium',
22
- medium: 'small',
23
- small: 'small',
24
- xsmall: 'xsmall',
25
- };
26
- const CircularProgressIndicatorColorMap = {
27
- primary: 'primary',
28
- secondary: 'primary',
29
- danger: 'danger',
30
- warning: 'warning',
31
- success: 'success',
32
- neutral: 'primary',
33
- };
34
- const START_SLOT = 'start-slot';
35
- const END_SLOT = 'end-slot';
36
- const Button = withTooltip(forwardRef((inProps, ref) => {
37
- const props = useThemeProps({ props: inProps, name: 'Button' });
38
- const { component = 'button', children, size = 'medium', variant = 'contained', color = 'primary', background = true, fullWidth = false, loading = false, title: titleProp, CircularProgressIndicatorProps, startIcon, endIcon, classes, className, disabled: disabledProp, focusableWhenDisabled, ...rest } = props;
39
- const cls = useClasses('button', classes, className);
40
- const disableInteractions = disabledProp || loading;
41
- const { getRootProps, focusVisible } = useButton({
42
- ...props,
43
- focusableWhenDisabled,
44
- disabled: disableInteractions,
45
- rootRef: ref,
46
- });
47
- const ButtonRoot = component;
48
- const isTextContent = typeof children === 'string';
49
- const title = (() => {
50
- if (titleProp === undefined && isTextContent) {
51
- return children;
52
- }
53
- return titleProp;
54
- })();
55
- let startSlot = null;
56
- let endSlot = null;
57
- const startSlotClassName = cls(START_SLOT, `${size}-start-slot`, `${variant}-${size}-start-slot`);
58
- const endSlotClassName = cls(END_SLOT, `${size}-end-slot`, `${variant}-${size}-end-slot`);
59
- if (loading) {
60
- startSlot = (jsx(CircularProgressIndicator, { className: clsx(startSlotClassName, cls('loading-indicator')), variant: "indeterminate", size: CircularProgressIndicatorSizeMap[size], color: CircularProgressIndicatorColorMap[color], ...CircularProgressIndicatorProps }));
61
- }
62
- else if (startIcon) {
63
- if (React.isValidElement(startIcon)) {
64
- startSlot = React.cloneElement(startIcon, {
65
- className: clsx(startSlotClassName, startIcon.props.className),
66
- });
67
- }
68
- else {
69
- startSlot = (jsx(Icon, { className: startSlotClassName, symbol: startIcon, size: buttonIconSizeMap[size] }));
70
- }
71
- }
72
- if (React.isValidElement(endIcon)) {
73
- endSlot = React.cloneElement(endIcon, {
74
- className: clsx(endSlotClassName, endIcon.props.className),
75
- });
76
- }
77
- else if (endIcon) {
78
- endSlot = (jsx(Icon, { className: endSlotClassName, symbol: endIcon, size: buttonIconSizeMap[size] }));
79
- }
80
- return (jsxs(ButtonRoot, { className: cls('root', variant, color, size, `${variant}-${color}`, `${variant}-${size}`, !background && 'hide-background', !background && `${variant}-hide-background`, startSlot && 'has-start-slot', endSlot && 'has-end-slot', fullWidth && 'full-width', {
81
- disabled: disabledProp,
82
- focusVisible,
83
- loading,
84
- }), title: title, ...rest, ...getRootProps(), children: [startSlot, isTextContent ? (jsx("span", { className: cls('content'), children: children })) : (children), endSlot] }));
85
- }));
86
- Button.displayName = 'SuiButton';
87
-
88
- export { Button as B, buttonIconSizeMap as b };
package/chunks/Chip.js DELETED
@@ -1,73 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useButton } from '@mui/base';
4
- import { useClasses, useId, getTitle, isDeleteKeyboardEvent } from '@ringcentral/spring-base';
5
- import { Xmd } from '@ringcentral/spring-icon';
6
- import { useThemeProps } from '@ringcentral/spring-theme';
7
- import { I as IconButton } from './IconButtonLabel.js';
8
-
9
- const Chip = forwardRef((inProps, ref) => {
10
- const props = useThemeProps({ props: inProps, name: 'Chip' });
11
- const { component: ChipRoot = 'div', classes, className, children, label, startSlot, size = 'large', clickable: clickableProp, truncate = true, color = 'default', DeleteIconProps = {}, disabled, onClick, onDelete, onKeyDown, onKeyUp, ...rest } = props;
12
- const cls = useClasses('chip', classes, className);
13
- const handleDeleteIconClick = (event) => {
14
- event.stopPropagation();
15
- if (onDelete) {
16
- onDelete(event);
17
- }
18
- };
19
- const handleKeyDown = (event) => {
20
- if (event.currentTarget === event.target &&
21
- isDeleteKeyboardEvent(event)) {
22
- event.preventDefault();
23
- }
24
- if (onKeyDown) {
25
- onKeyDown(event);
26
- }
27
- };
28
- const handleKeyUp = (event) => {
29
- if (event.currentTarget === event.target &&
30
- onDelete &&
31
- isDeleteKeyboardEvent(event)) {
32
- onDelete(event);
33
- }
34
- if (onKeyUp) {
35
- onKeyUp(event);
36
- }
37
- };
38
- const clickable = clickableProp !== false && onClick ? true : clickableProp;
39
- const deleteIconButtonVariant = !clickable && color === 'default' ? 'contained' : 'inverted';
40
- const deleteIconButtonColor = !clickable && color === 'error' ? 'danger' : 'secondary';
41
- const deleteIconButtonSize = size === 'small' ? 'xsmall' : 'small';
42
- const { onDelete: _, ...buttonProps } = props;
43
- const { getRootProps } = useButton({
44
- ...buttonProps,
45
- rootRef: ref,
46
- });
47
- const rootProps = clickable
48
- ? {
49
- className: cls('root', color, size, {
50
- clickable,
51
- disabled,
52
- truncate,
53
- }),
54
- ...rest,
55
- ...getRootProps({ onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }),
56
- }
57
- : {
58
- className: cls('root', color, size, { disabled, truncate }),
59
- ...rest,
60
- ref,
61
- };
62
- const labelId = useId();
63
- const nonInteractiveDeleteProps = {
64
- tabIndex: -1,
65
- component: 'span',
66
- role: 'presentation',
67
- };
68
- const deleteIcon = onDelete ? (jsx(IconButton, { background: false, className: cls('delete-icon'), variant: deleteIconButtonVariant, color: deleteIconButtonColor, size: deleteIconButtonSize, symbol: Xmd, onClick: handleDeleteIconClick, "aria-describedby": labelId, ...(clickable ? nonInteractiveDeleteProps : {}), ...DeleteIconProps })) : null;
69
- return (jsxs(ChipRoot, { ...rootProps, children: [startSlot, jsx("span", { id: labelId, className: cls('label'), title: getTitle(label), children: label }), deleteIcon] }));
70
- });
71
- Chip.displayName = 'SuiChip';
72
-
73
- export { Chip as C };
@@ -1,36 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import clsx from 'clsx';
4
- import { useClasses } from '@ringcentral/spring-base';
5
- import { useThemeProps } from '@ringcentral/spring-theme';
6
-
7
- const CircularProgressIndicator = forwardRef((inProps, ref) => {
8
- const props = useThemeProps({
9
- props: inProps,
10
- name: 'CircularProgressIndicator',
11
- });
12
- const { classes, className, children, variant = 'indeterminate', size = 'large', color = 'primary', value, progressBarProps: progressBarPropsProp, ...rest } = props;
13
- const cls = useClasses('circular-progress-indicator', classes, className);
14
- const progressBarProps = progressBarPropsProp || {};
15
- let content = null;
16
- if (variant === 'indeterminate') {
17
- content = (jsx("span", { className: cls('outer-circle', `${variant}-outer-circle`), children: jsx("span", { className: cls('inner-circle', `${variant}-inner-circle`) }) }));
18
- }
19
- else if (variant === 'determinate') {
20
- if (value === undefined) {
21
- throw new Error('The value prop is required for a determinate CircularProgressIndicator');
22
- }
23
- progressBarProps['aria-valuenow'] = value;
24
- progressBarProps['aria-valuemin'] = 0;
25
- progressBarProps['aria-valuemax'] = 100;
26
- const radius = 28;
27
- const circumference = 2 * Math.PI * radius;
28
- const offset = circumference - (value / 100) * circumference;
29
- content = (jsx("svg", { width: '100%', height: '100%', viewBox: "0 0 56 56", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("circle", { className: cls('progress-circle', `${variant}-progress-circle`), cx: "28", cy: "28", r: radius, fill: "none", strokeWidth: 18, strokeDasharray: circumference, strokeDashoffset: offset, transform: "rotate(-90 28 28)" }) }));
30
- }
31
- const { className: progressBarClassName, ...restProgressBarProps } = progressBarProps;
32
- return (jsx("span", { className: clsx(cls('root', variant, size, color, `${variant}-${size}`, `${variant}-${color}`), progressBarClassName), ...rest, ...restProgressBarProps, role: "progressbar", ref: ref, children: content }));
33
- });
34
- CircularProgressIndicator.displayName = 'SuiProgressIndicator';
35
-
36
- export { CircularProgressIndicator as C };
package/chunks/Divider.js DELETED
@@ -1,19 +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
-
6
- const Divider = forwardRef((inProps, ref) => {
7
- const props = useThemeProps({ props: inProps, name: 'Divider' });
8
- const { component: DividerRoot = 'hr', variant = 'full', orientation = 'horizontal', classes, className, children, flexItem = false, title, ...rest } = props;
9
- const cls = useClasses('divider', classes, className);
10
- const role = DividerRoot !== 'hr' ? 'separator' : undefined;
11
- const hasTitle = title !== undefined;
12
- return (jsx(DividerRoot, { role: role, className: cls('root', variant, orientation, {
13
- 'flex-item': flexItem,
14
- 'has-title': hasTitle,
15
- }, `${variant}-${orientation}`, hasTitle && `${orientation}-has-title`), "data-title": title, ref: ref, ...rest, children: children }));
16
- });
17
- Divider.displayName = 'SuiDivider';
18
-
19
- export { Divider as D };
@@ -1,11 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useClasses } from '@ringcentral/spring-base';
4
-
5
- const DragHandle = forwardRef((props, ref) => {
6
- const { component: DragHandleRoot = 'div', anchor = 'top', classes, className, ...rest } = props;
7
- const cls = useClasses('drag-handle', classes, className);
8
- return (jsx(DragHandleRoot, { ref: ref, className: cls('root', anchor), role: "presentation", "aria-hidden": "true", ...rest, children: jsx("div", { className: cls('bar') }) }));
9
- });
10
-
11
- export { DragHandle as D };
package/chunks/Drawer.js DELETED
@@ -1,33 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { motion } from 'framer-motion';
4
- import { useClasses, useForkRef } from '@ringcentral/spring-base';
5
- import { useThemeProps, motionTransition } from '@ringcentral/spring-theme';
6
- import clsx from 'clsx';
7
- import './Icon.js';
8
- import { u as usePrefersReducedMotion } from './usePrefersReducedMotion.js';
9
- import { g as getSlideIn } from './getSlideIn.js';
10
- import { M as Modal } from './Modal.js';
11
-
12
- const Drawer = forwardRef((inProps, ref) => {
13
- const props = useThemeProps({ props: inProps, name: 'Drawer' });
14
- const { anchor = 'left', bodyProps, classes, className, children, header, footer, open, onClose, variant = 'temporary', blocking = true, measurementRefs, headerProps, ...rest } = props;
15
- const headerRef = measurementRefs?.header;
16
- const footerRef = measurementRefs?.footer;
17
- const contentRef = measurementRefs?.content;
18
- const cls = useClasses('drawer', classes, className);
19
- const slideInProps = getSlideIn({
20
- toggle: open,
21
- from: anchor,
22
- prefersReducedMotion: usePrefersReducedMotion(),
23
- toggleOnTransition: motionTransition['neutral-01-fast'],
24
- toggleOffTransition: motionTransition['neutral-01-fast'],
25
- });
26
- const handleBodyRef = useForkRef(ref, bodyProps?.ref);
27
- return (jsx(Modal, { open: open, onClose: onClose, blocking: blocking, className: clsx(cls('root', `anchor-${anchor}`, {
28
- 'non-blocking': !blocking,
29
- })), ...rest, children: jsxs(motion.div, { role: "dialog", "aria-modal": blocking, ...slideInProps, ...bodyProps, ref: handleBodyRef, className: clsx(cls('body', `body-${anchor}`), bodyProps?.className), tabIndex: bodyProps?.tabIndex ?? (blocking ? -1 : undefined), children: [header && (jsx("div", { ref: headerRef, ...headerProps, className: clsx(cls('header'), headerProps?.className), children: header })), jsx("div", { ref: contentRef, className: cls('content'), children: children }), footer && (jsx("div", { ref: footerRef, className: cls('footer'), children: footer }))] }) }));
30
- });
31
- Drawer.displayName = 'SuiDrawer';
32
-
33
- export { Drawer as D };
@@ -1,24 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { motion } from 'framer-motion';
3
- import { useClasses } from '@ringcentral/spring-base';
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 motionVariants = {
10
- expanded: {
11
- d: 'M 4.5 12.8 L 9.85 7.525 L 15.1 12.8',
12
- },
13
- collapsed: {
14
- d: 'M 4.5 7.5 L 9.85 12.9 L 15.15 7.55',
15
- },
16
- };
17
- const ExpandCollapseCaret = (props) => {
18
- const { size = 'small', orientation = 'vertical', expanded, classes, className, ...rest } = props;
19
- const cls = useClasses('expand-collapse-caret', classes, className);
20
- const transition = useMotionSafeTransition(motionTransition['spring-01-fast']);
21
- return (jsx(Icon, { ...rest, size: size, className: cls('root', orientation), children: jsx(motion.svg, { xmlns: "http://www.w3.org/2000/svg", viewBox: '0 0 20 20', children: jsx(motion.path, { initial: false, stroke: "currentColor", strokeWidth: 1.5, variants: motionVariants, animate: expanded ? 'expanded' : 'collapsed', transition: transition, fill: "transparent" }) }) }));
22
- };
23
-
24
- export { ExpandCollapseCaret as E };
@@ -1,27 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { createContext, useContext, forwardRef, useMemo } from 'react';
3
- import { useClasses, useId } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
-
6
- const FormLabelContext = createContext({});
7
- const useFormLabel = (props) => {
8
- const { disabled: disabledProp, id: idProp, value: valueProp } = props;
9
- const { disabled: innerDisabled, id: innerId, value: innerValue, } = useContext(FormLabelContext);
10
- const disabled = disabledProp ?? innerDisabled;
11
- const id = idProp ?? innerId;
12
- const value = valueProp ?? innerValue;
13
- return { id, disabled, value };
14
- };
15
-
16
- const FormLabel = forwardRef((inProps, ref) => {
17
- const props = useThemeProps({ props: inProps, name: 'FormLabel' });
18
- const { classes, className, children, label, value, labelRef, id: idProp, disabled = false, fullWidth = false, placement = 'end', rootProps, ...rest } = props;
19
- const cls = useClasses('form-label', classes, className);
20
- const innerId = useId();
21
- const id = idProp || innerId;
22
- const formLabelContextValue = useMemo(() => ({ id, disabled, value }), [disabled, id, value]);
23
- return (jsxs("div", { className: cls('root', placement, { 'full-width': fullWidth }), ref: ref, ...rootProps, children: [jsx(FormLabelContext.Provider, { value: formLabelContextValue, children: children }), jsx("label", { className: cls('label', `${placement}-label`, { disabled }), ...rest, ref: labelRef, htmlFor: id, children: label })] }));
24
- });
25
- FormLabel.displayName = 'SuiFormLabel';
26
-
27
- export { FormLabel as F, FormLabelContext as a, useFormLabel as u };
package/chunks/Icon.js DELETED
@@ -1,25 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useMemo, cloneElement } from 'react';
3
- import { useClasses } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
-
6
- const Icon = forwardRef((inProps, ref) => {
7
- const props = useThemeProps({ props: inProps, name: 'Icon' });
8
- const { size = 'medium', symbol, children: childrenProp, className, classes, ...rest } = props;
9
- const cls = useClasses('icon', classes, className);
10
- const svgClassName = cls('svg');
11
- const children = useMemo(() => {
12
- if (symbol) {
13
- const Comp = symbol;
14
- return jsx(Comp, { className: svgClassName });
15
- }
16
- else if (childrenProp) {
17
- return cloneElement(childrenProp, { className: svgClassName });
18
- }
19
- return null;
20
- }, [childrenProp, svgClassName, symbol]);
21
- return (jsx("span", { className: cls('root', size), ...rest, ref: ref, children: children }));
22
- });
23
- Icon.displayName = 'SuiIcon';
24
-
25
- export { Icon as I };
@@ -1,68 +0,0 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { forwardRef, cloneElement } from 'react';
3
- import { useButton } from '@mui/base';
4
- import { useClasses } from '@ringcentral/spring-base';
5
- import { useThemeProps } from '@ringcentral/spring-theme';
6
- import { I as Icon } from './Icon.js';
7
- import { S as Squircle } from './Squircle.js';
8
- import { w as withTooltip } from './withTooltip.js';
9
-
10
- const IconSizeMap = {
11
- xxxlarge: 'medium',
12
- xxlarge: 'medium',
13
- xlarge: 'large',
14
- large: 'medium',
15
- medium: 'small',
16
- small: 'small',
17
- xsmall: 'xsmall',
18
- };
19
- function sizeSupportsLabel(size) {
20
- switch (size) {
21
- case 'xxxlarge':
22
- case 'xxlarge':
23
- return true;
24
- default:
25
- return false;
26
- }
27
- }
28
- const IconButton = withTooltip(forwardRef((inProps, ref) => {
29
- const props = useThemeProps({ props: inProps, name: 'IconButton' });
30
- const { component = 'button', color = 'primary', shape = 'circular', size = 'large', background = true, variant = 'outlined', label, symbol, classes, iconSize, className, children, disabled, ...rest } = props;
31
- const cls = useClasses('icon-button', classes, className);
32
- const { getRootProps, focusVisible } = useButton({
33
- ...props,
34
- rootRef: ref,
35
- });
36
- const rootProps = getRootProps({
37
- className: cls('root', size, variant, color, shape, `${size}-${shape}`, `${size}-${variant}`, `${variant}-${color}`, `${variant}-${shape}`, ...(!background
38
- ? [
39
- 'hide-background',
40
- `${variant}-hide-background`,
41
- `${shape}-hide-background`,
42
- ]
43
- : []), {
44
- disabled,
45
- focusVisible,
46
- }),
47
- 'aria-label': label,
48
- ...rest,
49
- });
50
- const content = (jsxs(Fragment, { children: [children || (jsx(Icon, { symbol: symbol, size: iconSize ?? IconSizeMap[size] })), sizeSupportsLabel(size) && label && (jsx("span", { className: cls('label', `${size}-label`, shape === 'squircle' && `${shape}-label`, `${size}-${shape}-label`), children: label }))] }));
51
- if (shape === 'squircle') {
52
- return (jsx(Squircle, { ...rootProps, component: component, interactive: !disabled, focusVisible: focusVisible, children: content }));
53
- }
54
- const IconButtonRoot = component;
55
- return jsx(IconButtonRoot, { ...rootProps, children: content });
56
- }));
57
- IconButton.displayName = 'SuiIconButton';
58
-
59
- const IconButtonLabel = forwardRef((inProps, ref) => {
60
- const props = useThemeProps({ props: inProps, name: 'IconButtonLabel' });
61
- const { label, className, classes, children, ...rest } = props;
62
- const cls = useClasses('icon-button-outer-label', classes, className);
63
- const ariaLabel = children.props['aria-label'] || children.props.label || label;
64
- return (jsxs("div", { className: cls('root'), ...rest, ref: ref, children: [cloneElement(children, { 'aria-label': ariaLabel }), label && jsx("span", { className: cls('text'), children: label })] }));
65
- });
66
- IconButtonLabel.displayName = 'SuiIconButtonLabel';
67
-
68
- export { IconButton as I, IconButtonLabel as a };
package/chunks/List.js DELETED
@@ -1,22 +0,0 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useClasses, useForkRef } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
- import { a as useListNavigation } from './useListNavigation.js';
6
- import 'tabbable';
7
-
8
- const List = forwardRef((inProps, ref) => {
9
- const props = useThemeProps({ props: inProps, name: 'List' });
10
- const { classes, className, children, onKeyDown, onFocus, preventContainerScroll, searchAndFocusItemHandler, actions, ...rest } = props;
11
- const cls = useClasses('list', classes, className);
12
- const { renderItems, renderTabBoundary, getListProps, listRef } = useListNavigation({
13
- preventContainerScroll,
14
- searchAndFocusItemHandler,
15
- actions,
16
- });
17
- const handleRef = useForkRef(ref, listRef);
18
- return (jsxs(Fragment, { children: [jsx("div", { role: "list", className: cls('root'), ...rest, ...getListProps({ onFocus, onKeyDown }), ref: handleRef, children: renderItems(children) }), renderTabBoundary()] }));
19
- });
20
- List.displayName = 'SuiList';
21
-
22
- export { List as L };
@@ -1,83 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { forwardRef, useEffect } from 'react';
3
- import { useFocusVisible, useActive, useHover, combineProps, useForkRef } from '@ringcentral/spring-base';
4
- import { motionTransition, useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
5
- import { D as Divider } from './Divider.js';
6
- import { useItemNavigation } from '../ListNavigation.js';
7
- import { useVirtualizedItemPropsContext } from '../VirtualizedList.js';
8
- import { AnimatePresence } from 'framer-motion';
9
- import './Icon.js';
10
- import { u as useMotionSafeTransition } from './useMotionSafeTransition.js';
11
- import { S as SlideIn } from './SlideIn.js';
12
-
13
- const HoverActions = (props) => {
14
- const { show, children, className, instantTransition } = props;
15
- const toggleOnTransition = useMotionSafeTransition(motionTransition['spring-01-fast']);
16
- const toggleOffTransition = useMotionSafeTransition(motionTransition['neutral-01-fast']);
17
- const slideInProps = {
18
- toggle: show,
19
- children,
20
- className,
21
- toggleOffTransition: instantTransition
22
- ? motionTransition['instant']
23
- : toggleOffTransition,
24
- toggleOnTransition: instantTransition
25
- ? motionTransition['instant']
26
- : toggleOnTransition,
27
- onClick: (e) => {
28
- e.stopPropagation();
29
- },
30
- };
31
- return (jsx(AnimatePresence, { children: show && jsx(SlideIn, { ...slideInProps, children: children }) }));
32
- };
33
-
34
- const ListItem = forwardRef((inProps, ref) => {
35
- const props = useThemeProps({ props: inProps, name: 'ListItem' });
36
- const { classes, className, children, hoverActions, size = 'small', tabIndex = -1, role = 'listitem', divider = true, onClick, clickable = Boolean(onClick), hoverable = true, focused = false, highlighted = false, autoFocus, selected, dragged, alwaysShowHoverActions = false, instantHoverActions = false, style: styleProp, ...rest } = props;
37
- const cls = useClassesWithMode('list-item', classes, className);
38
- const { itemRef, keyboardNavHandlers } = useItemNavigation() ?? {};
39
- const virtualizedItemProps = useVirtualizedItemPropsContext();
40
- const { focusVisible, focusVisibleWithin, focusVisibleRef, focusVisibleHandlers, } = useFocusVisible({ ...props, within: true });
41
- const { active, activeHandlers } = useActive({
42
- ...props,
43
- disabled: !clickable,
44
- });
45
- const { hover, hoverHandlers } = useHover({
46
- ...props,
47
- disabled: !hoverable || !hoverActions,
48
- });
49
- const enhancedEventHandlers = (() => {
50
- const handlers = {
51
- ...focusVisibleHandlers,
52
- ...activeHandlers,
53
- ...hoverHandlers,
54
- };
55
- if (keyboardNavHandlers) {
56
- return combineProps(handlers, keyboardNavHandlers);
57
- }
58
- return handlers;
59
- })();
60
- const rootRef = useForkRef(itemRef, ref, focusVisibleRef);
61
- useEffect(() => {
62
- if (autoFocus) {
63
- itemRef?.current?.focus();
64
- }
65
- }, []);
66
- const isShowHoverAction = hover || focusVisibleWithin || alwaysShowHoverActions;
67
- return (jsxs("div", { className: cls('root', size, {
68
- focusVisibleWithin,
69
- focusVisible,
70
- active,
71
- clickable,
72
- hoverable,
73
- selected,
74
- dragged,
75
- focused,
76
- highlighted,
77
- }), tabIndex: tabIndex, ...rest, ...enhancedEventHandlers, ...virtualizedItemProps, style: virtualizedItemProps
78
- ? { ...styleProp, ...virtualizedItemProps.style }
79
- : styleProp, role: role, ref: rootRef, children: [jsxs("div", { className: cls('container'), children: [jsx("div", { className: cls('content'), children: children }), hoverActions && (jsx(HoverActions, { show: isShowHoverAction, className: cls('hover-actions'), instantTransition: instantHoverActions, children: hoverActions }))] }), divider && (jsx(Divider, { className: cls('divider'), orientation: "horizontal", flexItem: true }))] }));
80
- });
81
- ListItem.displayName = 'SuiListItem';
82
-
83
- export { HoverActions as H, ListItem as L };
package/chunks/Menu.js DELETED
@@ -1,61 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { createContext, useContext, useState, useMemo, forwardRef } from 'react';
3
- import { useEventCallback } from '@ringcentral/spring-base';
4
- import { useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
5
- import { a as useNestedParentMenu, N as NestedMenuContext } from './useNestedParentMenu.js';
6
- import { P as Popover } from './Popover.js';
7
-
8
- const overlayContainerStyle = {
9
- display: 'contents',
10
- };
11
- const MenuOverlayGroupContext = createContext(null);
12
- const useMenuOverlayGroupContext = () => useContext(MenuOverlayGroupContext);
13
- const useMenuOverlayGroupValue = () => {
14
- const [container, setContainer] = useState(null);
15
- const value = useMemo(() => ({ container }), [container]);
16
- return {
17
- setContainer,
18
- value,
19
- };
20
- };
21
- const MenuOverlayGroupContainer = (props) => {
22
- const { setContainer } = props;
23
- return (jsx("div", { "data-sui-menu-overlay-container": "", ref: setContainer, style: overlayContainerStyle }));
24
- };
25
-
26
- const MenuContext = createContext(null);
27
- const useMenuContext = () => {
28
- return useContext(MenuContext);
29
- };
30
-
31
- const Menu = forwardRef((inProps, ref) => {
32
- const props = useThemeProps({ props: inProps, name: 'Menu' });
33
- const { classes, children, open = false, onClose, autoFocus = true, className, PopperProps, ...rest } = props;
34
- const cls = useClassesWithMode('menu', classes, className);
35
- const padding = PopperProps?.padding;
36
- const popperPadding = typeof padding === 'object'
37
- ? {
38
- top: padding.top ?? 16,
39
- right: padding.right ?? 16,
40
- bottom: padding.bottom ?? 16,
41
- left: padding.left ?? 16,
42
- }
43
- : (padding ?? 16);
44
- const { contentClickHandlers, contentPointerHandlers, contextValue } = useNestedParentMenu({
45
- open,
46
- });
47
- const { setContainer: setOverlayContainer, value: overlayGroupValue } = useMenuOverlayGroupValue();
48
- const closeHandler = useEventCallback(() => {
49
- onClose?.(undefined, 'Other');
50
- });
51
- const menuContextValue = useMemo(() => {
52
- const effectiveAutoFocus = open ? autoFocus : false;
53
- return { close: closeHandler, autoFocus: effectiveAutoFocus };
54
- }, [autoFocus, closeHandler, open]);
55
- return (jsx(Popover, { bordered: true, className: cls('root'), PopperProps: { ...PopperProps, padding: popperPadding }, ...rest, open: open, onClose: (e, reason) => {
56
- onClose?.(e, reason);
57
- }, ref: ref, children: jsxs(MenuOverlayGroupContext.Provider, { value: overlayGroupValue, children: [jsx("div", { className: cls('paper'), onClickCapture: contentClickHandlers.onClickCapture, onPointerMove: contentPointerHandlers.onPointerMove, children: jsx(MenuContext.Provider, { value: menuContextValue, children: jsx(NestedMenuContext.Provider, { value: contextValue, children: children }) }) }), jsx(MenuOverlayGroupContainer, { setContainer: setOverlayContainer })] }) }));
58
- });
59
- Menu.displayName = 'SuiMenu';
60
-
61
- export { Menu as M, MenuContext as a, useMenuOverlayGroupContext as b, useMenuContext as u };
@@ -1,14 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
4
- import { D as Divider } from './Divider.js';
5
-
6
- const MenuDivider = forwardRef((inProps, ref) => {
7
- const props = useThemeProps({ props: inProps, name: 'MenuDivider' });
8
- const { classes, className, ...rest } = props;
9
- const cls = useClassesWithMode('menu-divider', classes, className);
10
- return jsx(Divider, { className: cls('root'), ...rest, ref: ref });
11
- });
12
- MenuDivider.displayName = 'SuiMenuDivider';
13
-
14
- export { MenuDivider as M };
@@ -1,18 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { getTitle } from '@ringcentral/spring-base';
4
- import { useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
5
- import { h as hasContent } from './hasContent.js';
6
- import '@mui/utils';
7
-
8
- const MenuItemText = forwardRef((inProps, ref) => {
9
- const props = useThemeProps({ props: inProps, name: 'MenuItemText' });
10
- const { classes, className, primary, primaryText, infoText, info, children, ...rest } = props;
11
- const cls = useClassesWithMode('menu-item-text', classes, className);
12
- const primaryContent = primary ?? primaryText ?? children;
13
- const secondaryContent = info ?? infoText;
14
- return (jsxs("div", { className: cls('root'), ...rest, ref: ref, children: [jsx("span", { className: cls('primary-text'), title: getTitle(primaryContent), children: primaryContent }), hasContent(secondaryContent) && (jsx("span", { className: cls('info-text'), title: getTitle(secondaryContent), children: secondaryContent }))] }));
15
- });
16
- MenuItemText.displayName = 'SuiMenuItemText';
17
-
18
- export { MenuItemText as M };