@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,115 +1,145 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { forwardRef, useState, useMemo, useRef } from 'react';
3
- import { motion, AnimatePresence } from 'framer-motion';
4
- import { tabbable } from 'tabbable';
5
- import { useClasses, useControlled, logInDev, useEventCallback, getTitle, useTabOut, combineProps } from '@ringcentral/spring-base';
6
- import { OverflowMd } from '@ringcentral/spring-icon';
7
- import { useThemeProps, motionTransition } from '@ringcentral/spring-theme';
8
- import { ClickAwayListener } from '@mui/base';
9
- import { a as BottomNavigationContext, B as BottomNavigationItem } from './chunks/BottomNavigationItem.js';
10
- export { u as useBottomNavigationContext } from './chunks/BottomNavigationItem.js';
11
- import { S as Squircle } from './chunks/Squircle.js';
12
- import './chunks/Icon.js';
13
- import { u as useMotionSafeTransition } from './chunks/useMotionSafeTransition.js';
14
- import './chunks/Badge.js';
15
- import 'lodash/isNumber';
16
- import 'lodash/kebabCase';
17
- import './chunks/IconButtonLabel.js';
18
- import './chunks/withTooltip.js';
19
- import './chunks/Tooltip.js';
20
- import 'clsx';
21
- import './chunks/usePrefersReducedMotion.js';
22
- import './chunks/getFade.js';
23
- import './Popper.js';
24
- import '@floating-ui/react-dom';
25
- import './chunks/Modal.js';
26
- import './chunks/useFocusTrapStack.js';
27
- import './chunks/Backdrop.js';
28
- import './chunks/PopperPaper.js';
29
- import './chunks/useTooltipForceHide.js';
30
-
31
- var BottomNavigationGroup$1 = {"sui-bottom-navigation-group-root":"sui-bottom-navigation-group-root"};
32
-
33
- const BottomNavigationGroup = forwardRef((props, ref) => {
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useMemo, useRef, useState } from "react";
3
+ import { AnimatePresence, motion } from "framer-motion";
4
+ import { tabbable } from "tabbable";
5
+ import { combineProps, getTitle, logInDev, useClasses, useControlled, useEventCallback, useTabOut } from "@ringcentral/spring-base";
6
+ import { OverflowMd } from "@ringcentral/spring-icon";
7
+ import { motionTransition, useThemeProps } from "@ringcentral/spring-theme";
8
+ import { ClickAwayListener } from "@mui/base";
9
+ import { BottomNavigationItem as BottomNavigationItem_BottomNavigationItem, BottomNavigationContext } from "./BottomNavigationItem.js";
10
+ import "./Squircle.js";
11
+ import "./chunks/4476.js";
12
+ import { useMotionSafeTransition } from "./chunks/1294.js";
13
+ import { Squircle as Squircle_Squircle } from "./chunks/1250.js";
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+ // extracted by css-extract-rspack-plugin
27
+ /* export default */ var BottomNavigationGroup = ({"sui-bottom-navigation-group-root":"sui-bottom-navigation-group-root"});
28
+
29
+
30
+
31
+
32
+ const BottomNavigationGroup_BottomNavigationGroup = /*#__PURE__*/ forwardRef((props, ref)=>{
34
33
  const { classes, className, children, ...rest } = props;
35
34
  const cls = useClasses('bottom-navigation-group', classes, className);
36
- return (jsx("div", { className: cls('root'), ...rest, ref: ref, children: children }));
35
+ return /*#__PURE__*/ jsx("div", {
36
+ className: cls('root'),
37
+ ...rest,
38
+ ref: ref,
39
+ children: children
40
+ });
37
41
  });
38
- BottomNavigationGroup.displayName = 'SuiBottomNavigationGroup';
42
+ BottomNavigationGroup_BottomNavigationGroup.displayName = 'SuiBottomNavigationGroup';
43
+
44
+
45
+
46
+
47
+
48
+
49
+ // extracted by css-extract-rspack-plugin
50
+ /* export default */ var BottomNavigation = ({"sui-bottom-navigation-root":"sui-bottom-navigation-root","sui-bottom-navigation-full-width":"sui-bottom-navigation-full-width","sui-bottom-navigation-item-wrapper":"sui-bottom-navigation-item-wrapper","sui-bottom-navigation-description":"sui-bottom-navigation-description","sui-bottom-navigation-empty-slot":"sui-bottom-navigation-empty-slot","sui-expanded":"sui-expanded"});
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
39
63
 
40
- var BottomNavigation$1 = {"sui-bottom-navigation-root":"sui-bottom-navigation-root","sui-bottom-navigation-full-width":"sui-bottom-navigation-full-width","sui-bottom-navigation-item-wrapper":"sui-bottom-navigation-item-wrapper","sui-bottom-navigation-description":"sui-bottom-navigation-description","sui-bottom-navigation-empty-slot":"sui-bottom-navigation-empty-slot","sui-expanded":"sui-expanded"};
41
64
 
42
65
  const ROW_HEIGHT = 56;
43
- const BottomNavigation = forwardRef((inProps, ref) => {
44
- const props = useThemeProps({ props: inProps, name: 'BottomNavigation' });
66
+ const BottomNavigation_BottomNavigation = /*#__PURE__*/ forwardRef((inProps, ref)=>{
67
+ const props = useThemeProps({
68
+ props: inProps,
69
+ name: 'BottomNavigation'
70
+ });
45
71
  const { classes, className, children, defaultValue, value: valueProp, defaultData, data: dataProp, onChange, renderItem, MoreProps, description, onTouchEnd, onClick, onKeyDown, onKeyUp, onBlur, onCollapse, fullWidth, ...rest } = props;
46
72
  const [value, setValue] = useControlled({
47
73
  controlled: valueProp,
48
74
  default: defaultValue,
49
75
  name: 'SuiBottomNavigation',
50
- state: 'value',
76
+ state: 'value'
51
77
  });
78
+ // TODO: setData will be used when dnd is implemented
79
+ // oxlint-disable-next-line @typescript-eslint/no-unused-vars
52
80
  const [data, setData] = useControlled({
53
81
  controlled: dataProp,
54
82
  default: defaultData,
55
83
  name: 'SuiBottomNavigation',
56
- state: 'data',
84
+ state: 'data'
57
85
  });
58
86
  const { visible, more } = data;
59
87
  const VISIBLE_MAX_COUNT = more?.length ? 5 : 6;
60
- if (process.env.NODE_ENV !== 'production' &&
61
- visible.length > VISIBLE_MAX_COUNT) {
88
+ if (process.env.NODE_ENV !== 'production' && visible.length > VISIBLE_MAX_COUNT) {
62
89
  logInDev({
63
90
  scope: 'BottomNavigation',
64
91
  message: `You can not have more than ${VISIBLE_MAX_COUNT} visible items.`,
65
- level: 'warn',
92
+ level: 'warn'
66
93
  });
67
94
  }
68
95
  const emptySlots = VISIBLE_MAX_COUNT - visible.length;
69
96
  const cls = useClasses('bottom-navigation', classes, className);
70
97
  const [expanded, setExpanded] = useState(false);
71
98
  const [animationComplete, setAnimationComplete] = useState();
72
- const transition = useMotionSafeTransition(motionTransition['haste-01-fast']);
73
- const handleClose = (e, reason) => {
74
- if (!expanded)
75
- return;
99
+ const transition = useMotionSafeTransition(motionTransition["haste-01-fast"]);
100
+ // oxlint-disable-next-line @typescript-eslint/no-explicit-any
101
+ const handleClose = (e, reason)=>{
102
+ if (!expanded) return;
76
103
  setExpanded(false);
77
104
  onCollapse?.(e, reason);
78
105
  };
79
- const onSelected = useEventCallback((e, newValue) => {
106
+ const onSelected = useEventCallback((e, newValue)=>{
80
107
  handleClose(e, 'ItemSelected');
81
108
  setValue(newValue);
82
109
  if (onChange) {
83
110
  onChange(e, newValue);
84
111
  }
85
112
  });
86
- const contextValue = useMemo(() => {
113
+ const contextValue = useMemo(()=>{
87
114
  return {
88
115
  value,
89
116
  expanded,
90
117
  onSelected,
91
- animationComplete,
118
+ animationComplete
92
119
  };
93
- }, [expanded, onSelected, animationComplete, value]);
94
- const handleMoreClick = (e) => {
120
+ }, [
121
+ expanded,
122
+ onSelected,
123
+ animationComplete,
124
+ value
125
+ ]);
126
+ const handleMoreClick = (e)=>{
95
127
  if (expanded) {
96
128
  handleClose(e, 'ToggleMore');
97
- }
98
- else {
129
+ } else {
99
130
  setExpanded(true);
100
131
  }
101
132
  MoreProps?.onClick?.(e);
102
133
  };
103
134
  const descriptionTitle = getTitle(description);
104
- const handleClickAway = useEventCallback((e) => {
105
- if (!expanded)
106
- return;
135
+ const handleClickAway = useEventCallback((e)=>{
136
+ if (!expanded) return;
107
137
  handleClose(e, 'ClickAway');
108
138
  });
109
- const { tabOutHandler } = useTabOut((e) => {
139
+ const { tabOutHandler } = useTabOut((e)=>{
110
140
  handleClose(e, 'TabBlur');
111
141
  });
112
- const handleKeyDown = (e) => {
142
+ const handleKeyDown = (e)=>{
113
143
  if (e.key === 'Escape') {
114
144
  handleClose(e, 'EscapeKeyDown');
115
145
  }
@@ -118,11 +148,11 @@ const BottomNavigation = forwardRef((inProps, ref) => {
118
148
  const tabOutProps = combineProps(tabOutHandler, {
119
149
  onKeyDown: handleKeyDown,
120
150
  onKeyUp,
121
- onBlur,
151
+ onBlur
122
152
  });
123
153
  const moreGroupRef = useRef(null);
124
154
  const moreButtonRef = useRef(null);
125
- const handleAnimationComplete = () => {
155
+ const handleAnimationComplete = ()=>{
126
156
  setAnimationComplete(true);
127
157
  if (expanded && moreGroupRef.current) {
128
158
  const allTabbable = tabbable(moreGroupRef.current);
@@ -133,10 +163,96 @@ const BottomNavigation = forwardRef((inProps, ref) => {
133
163
  }
134
164
  };
135
165
  const itemWrapperClassName = cls('item-wrapper');
136
- return (jsx(ClickAwayListener, { onClickAway: handleClickAway, children: jsx(motion.div, { transition: transition, onAnimationStart: () => {
166
+ return /*#__PURE__*/ jsx(ClickAwayListener, {
167
+ onClickAway: handleClickAway,
168
+ children: /*#__PURE__*/ jsx(motion.div, {
169
+ transition: transition,
170
+ onAnimationStart: ()=>{
137
171
  setAnimationComplete(false);
138
- }, onAnimationComplete: handleAnimationComplete, initial: false, animate: expanded ? { height: 'auto' } : { height: ROW_HEIGHT }, className: cls('root', { expanded, 'full-width': fullWidth }), ...rest, ...tabOutProps, onClick: onClick, onTouchEnd: onTouchEnd, ref: ref, children: jsxs(BottomNavigationContext.Provider, { value: contextValue, children: [jsxs(BottomNavigationGroup, { children: [visible.slice(0, VISIBLE_MAX_COUNT).map((item) => (jsx("span", { className: itemWrapperClassName, children: renderItem(item) }, item))), [...Array(emptySlots > 0 ? emptySlots : 0)].map((e, i) => (jsx("span", { className: itemWrapperClassName, children: jsx(Squircle, { interactive: false, className: cls('empty-slot', { expanded }) }) }, 'bottom-navigation-slot-' + i))), more?.length ? (jsx("span", { className: itemWrapperClassName, children: jsx(BottomNavigationItem, { symbol: OverflowMd, activated: expanded, expanded: false, ButtonProps: { 'aria-expanded': expanded }, ...MoreProps, count: expanded ? 0 : MoreProps?.count, onClick: handleMoreClick, ref: moreButtonRef }) })) : null] }), jsxs(AnimatePresence, { children: [expanded && more?.length ? (jsx(BottomNavigationGroup, { ref: moreGroupRef, children: more.map((item) => (jsx("span", { title: item, className: itemWrapperClassName, children: renderItem(item) }, item))) }, "more")) : null, expanded && description && (jsx("div", { className: cls('description'), title: descriptionTitle, children: description }))] })] }) }) }));
172
+ },
173
+ onAnimationComplete: handleAnimationComplete,
174
+ initial: false,
175
+ animate: expanded ? {
176
+ height: 'auto'
177
+ } : {
178
+ height: ROW_HEIGHT
179
+ },
180
+ className: cls('root', {
181
+ expanded,
182
+ 'full-width': fullWidth
183
+ }),
184
+ ...rest,
185
+ ...tabOutProps,
186
+ onClick: onClick,
187
+ onTouchEnd: onTouchEnd,
188
+ ref: ref,
189
+ children: /*#__PURE__*/ jsxs(BottomNavigationContext.Provider, {
190
+ value: contextValue,
191
+ children: [
192
+ /*#__PURE__*/ jsxs(BottomNavigationGroup_BottomNavigationGroup, {
193
+ children: [
194
+ visible.slice(0, VISIBLE_MAX_COUNT).map((item)=>/*#__PURE__*/ jsx("span", {
195
+ className: itemWrapperClassName,
196
+ children: renderItem(item)
197
+ }, item)),
198
+ [
199
+ ...Array(emptySlots > 0 ? emptySlots : 0)
200
+ ].map((e, i)=>/*#__PURE__*/ jsx("span", {
201
+ className: itemWrapperClassName,
202
+ children: /*#__PURE__*/ jsx(Squircle_Squircle, {
203
+ interactive: false,
204
+ className: cls('empty-slot', {
205
+ expanded
206
+ })
207
+ })
208
+ }, 'bottom-navigation-slot-' + i)),
209
+ more?.length ? /*#__PURE__*/ jsx("span", {
210
+ className: itemWrapperClassName,
211
+ children: /*#__PURE__*/ jsx(BottomNavigationItem_BottomNavigationItem, {
212
+ symbol: OverflowMd,
213
+ activated: expanded,
214
+ expanded: false,
215
+ ButtonProps: {
216
+ 'aria-expanded': expanded
217
+ },
218
+ ...MoreProps,
219
+ count: expanded ? 0 : MoreProps?.count,
220
+ onClick: handleMoreClick,
221
+ ref: moreButtonRef
222
+ })
223
+ }) : null
224
+ ]
225
+ }),
226
+ /*#__PURE__*/ jsxs(AnimatePresence, {
227
+ children: [
228
+ expanded && more?.length ? /*#__PURE__*/ jsx(BottomNavigationGroup_BottomNavigationGroup, {
229
+ ref: moreGroupRef,
230
+ children: more.map((item)=>/*#__PURE__*/ jsx("span", {
231
+ title: item,
232
+ className: itemWrapperClassName,
233
+ children: renderItem(item)
234
+ }, item))
235
+ }, "more") : null,
236
+ expanded && description && /*#__PURE__*/ jsx("div", {
237
+ className: cls('description'),
238
+ title: descriptionTitle,
239
+ children: description
240
+ })
241
+ ]
242
+ })
243
+ ]
244
+ })
245
+ })
246
+ });
139
247
  });
140
- BottomNavigation.displayName = 'SuiBottomNavigation';
248
+ BottomNavigation_BottomNavigation.displayName = 'SuiBottomNavigation';
249
+
250
+
251
+
252
+
253
+
254
+
255
+
141
256
 
142
- export { BottomNavigation, BottomNavigationContext, BottomNavigationGroup, BottomNavigationGroup$1 as bottomNavigationGroupStyles, BottomNavigation$1 as bottomNavigationStyles };
257
+ export { BottomNavigation as bottomNavigationStyles, BottomNavigationGroup as bottomNavigationGroupStyles, BottomNavigationGroup_BottomNavigationGroup as BottomNavigationGroup, BottomNavigation_BottomNavigation as BottomNavigation };
258
+ export { BottomNavigationContext, useBottomNavigationContext } from "./BottomNavigationItem.js";
@@ -1,30 +1,93 @@
1
- export { B as BottomNavigationItem } from './chunks/BottomNavigationItem.js';
2
- import 'react/jsx-runtime';
3
- import 'react';
4
- import '@ringcentral/spring-base';
5
- import '@ringcentral/spring-theme';
6
- import './chunks/Badge.js';
7
- import 'framer-motion';
8
- import 'lodash/isNumber';
9
- import 'lodash/kebabCase';
10
- import './chunks/Icon.js';
11
- import './chunks/useMotionSafeTransition.js';
12
- import './chunks/usePrefersReducedMotion.js';
13
- import './chunks/IconButtonLabel.js';
14
- import '@mui/base';
15
- import './chunks/Squircle.js';
16
- import './chunks/withTooltip.js';
17
- import './chunks/Tooltip.js';
18
- import 'clsx';
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
- import './chunks/useTooltipForceHide.js';
27
-
28
- var BottomNavigationItem = {"sui-bottom-navigation-item-button":"sui-bottom-navigation-item-button","sui-expanded":"sui-expanded","sui-bottom-navigation-item-activated":"sui-bottom-navigation-item-activated"};
29
-
30
- export { BottomNavigationItem as bottomNavigationItemStyles };
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, forwardRef, useContext } from "react";
3
+ import { combineClasses, useClasses } from "@ringcentral/spring-base";
4
+ import { useThemeProps } from "@ringcentral/spring-theme";
5
+ import { Badge as Badge_Badge } from "./Badge.js";
6
+ import { IconButton as IconButton_IconButton } from "./IconButton.js";
7
+ import { useTooltipForceHide } from "./Tooltip.js";
8
+ import { Tooltip } from "./chunks/4535.js";
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+ const BottomNavigationContext = createContext(null);
17
+ const useBottomNavigationContext = ()=>useContext(BottomNavigationContext);
18
+
19
+ // extracted by css-extract-rspack-plugin
20
+ /* export default */ var BottomNavigationItem = ({"sui-bottom-navigation-item-button":"sui-bottom-navigation-item-button","sui-expanded":"sui-expanded","sui-bottom-navigation-item-activated":"sui-bottom-navigation-item-activated"});
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+ const BottomNavigationItem_BottomNavigationItem = /*#__PURE__*/ forwardRef((inProps, ref)=>{
31
+ const props = useThemeProps({
32
+ props: inProps,
33
+ name: 'BottomNavigationItem'
34
+ });
35
+ const { classes, symbol, activatedSymbol, count, value: valueProp, activated: activatedProp, expanded: expandedProp, onClick, BadgeProps = {}, TooltipProps = {}, ButtonProps = {}, label, className } = props;
36
+ const cls = useClasses('bottom-navigation-item', classes, className);
37
+ const { value: selectedValue, expanded: isExpanded, onSelected, animationComplete } = useBottomNavigationContext() || {};
38
+ // close tooltip temporarily during animation
39
+ const tooltipOpenProps = useTooltipForceHide(animationComplete === false);
40
+ const selected = selectedValue === valueProp;
41
+ const activated = activatedProp !== undefined ? activatedProp : selected;
42
+ const expanded = expandedProp !== undefined ? expandedProp : isExpanded;
43
+ const handleClick = (event)=>{
44
+ if (valueProp !== undefined && !selected) {
45
+ onSelected?.(event, valueProp);
46
+ }
47
+ onClick?.(event);
48
+ };
49
+ let buttonClasses = {
50
+ root: cls('button', {
51
+ activated,
52
+ expanded
53
+ })
54
+ };
55
+ if (ButtonProps.classes) {
56
+ buttonClasses = combineClasses(buttonClasses, ButtonProps.classes);
57
+ }
58
+ return /*#__PURE__*/ jsx(Badge_Badge, {
59
+ variant: "outlined",
60
+ count: count,
61
+ className: cls('root'),
62
+ ...BadgeProps,
63
+ children: /*#__PURE__*/ jsx(Tooltip, {
64
+ ...TooltipProps,
65
+ title: label,
66
+ PopperProps: {
67
+ offset: 8
68
+ },
69
+ motionProps: null,
70
+ ...tooltipOpenProps,
71
+ children: /*#__PURE__*/ jsx(IconButton_IconButton, {
72
+ shape: 'squircle',
73
+ variant: "contained",
74
+ size: "small",
75
+ color: 'secondary',
76
+ symbol: activated && activatedSymbol ? activatedSymbol : symbol,
77
+ onClick: handleClick,
78
+ "aria-label": label,
79
+ ...ButtonProps,
80
+ classes: buttonClasses,
81
+ ref: ref
82
+ })
83
+ })
84
+ });
85
+ });
86
+ BottomNavigationItem_BottomNavigationItem.displayName = 'SuiBottomNavigationItem';
87
+
88
+
89
+
90
+
91
+
92
+
93
+ export { BottomNavigationContext, BottomNavigationItem as bottomNavigationItemStyles, BottomNavigationItem_BottomNavigationItem as BottomNavigationItem, useBottomNavigationContext };
package/Button.js CHANGED
@@ -1,24 +1,160 @@
1
- export { B as Button, b as buttonIconSizeMap } from './chunks/Button.js';
2
- import 'react/jsx-runtime';
3
- import 'react';
4
- import 'clsx';
5
- import '@mui/base';
6
- import '@ringcentral/spring-base';
7
- import '@ringcentral/spring-theme';
8
- import './chunks/CircularProgressIndicator.js';
9
- import './chunks/Icon.js';
10
- import './chunks/Tooltip.js';
11
- import 'framer-motion';
12
- import './chunks/usePrefersReducedMotion.js';
13
- import './chunks/getFade.js';
14
- import './Popper.js';
15
- import '@floating-ui/react-dom';
16
- import './chunks/Modal.js';
17
- import './chunks/useFocusTrapStack.js';
18
- import './chunks/Backdrop.js';
19
- import './chunks/PopperPaper.js';
20
- import './chunks/withTooltip.js';
21
-
22
- var Button = {"sui-button-root":"sui-button-root","sui-disabled":"sui-disabled","sui-button-loading-indicator":"sui-button-loading-indicator","sui-button-xlarge":"sui-button-xlarge","sui-button-large":"sui-button-large","sui-button-medium":"sui-button-medium","sui-button-small":"sui-button-small","sui-button-xsmall":"sui-button-xsmall","sui-button-contained-xlarge":"sui-button-contained-xlarge","sui-button-outlined-xlarge":"sui-button-outlined-xlarge","sui-button-inverted-xlarge":"sui-button-inverted-xlarge","sui-button-contained-large":"sui-button-contained-large","sui-button-outlined-large":"sui-button-outlined-large","sui-button-inverted-large":"sui-button-inverted-large","sui-button-contained-medium":"sui-button-contained-medium","sui-button-outlined-medium":"sui-button-outlined-medium","sui-button-inverted-medium":"sui-button-inverted-medium","sui-button-contained-small":"sui-button-contained-small","sui-button-outlined-small":"sui-button-outlined-small","sui-button-inverted-small":"sui-button-inverted-small","sui-button-contained-xsmall":"sui-button-contained-xsmall","sui-button-outlined-xsmall":"sui-button-outlined-xsmall","sui-button-inverted-xsmall":"sui-button-inverted-xsmall","sui-button-loading":"sui-button-loading","sui-button-content":"sui-button-content","sui-button-contained":"sui-button-contained","sui-focus-visible":"sui-focus-visible","sui-button-outlined":"sui-button-outlined","sui-button-inverted":"sui-button-inverted","sui-button-text":"sui-button-text","sui-button-contained-primary":"sui-button-contained-primary","sui-button-contained-secondary":"sui-button-contained-secondary","sui-button-contained-neutral":"sui-button-contained-neutral","sui-button-contained-danger":"sui-button-contained-danger","sui-button-contained-warning":"sui-button-contained-warning","sui-button-contained-success":"sui-button-contained-success","sui-button-contained-hide-background":"sui-button-contained-hide-background","sui-button-outlined-primary":"sui-button-outlined-primary","sui-button-outlined-secondary":"sui-button-outlined-secondary","sui-button-outlined-neutral":"sui-button-outlined-neutral","sui-button-outlined-danger":"sui-button-outlined-danger","sui-button-outlined-warning":"sui-button-outlined-warning","sui-button-outlined-success":"sui-button-outlined-success","sui-button-text-primary":"sui-button-text-primary","sui-button-text-secondary":"sui-button-text-secondary","sui-button-text-neutral":"sui-button-text-neutral","sui-button-text-danger":"sui-button-text-danger","sui-button-text-warning":"sui-button-text-warning","sui-button-text-success":"sui-button-text-success","sui-button-inverted-primary":"sui-button-inverted-primary","sui-button-inverted-secondary":"sui-button-inverted-secondary","sui-button-inverted-neutral":"sui-button-inverted-neutral","sui-button-inverted-danger":"sui-button-inverted-danger","sui-button-inverted-warning":"sui-button-inverted-warning","sui-button-inverted-success":"sui-button-inverted-success","sui-button-start-slot":"sui-button-start-slot","sui-button-end-slot":"sui-button-end-slot","sui-button-has-start-slot":"sui-button-has-start-slot","sui-button-has-end-slot":"sui-button-has-end-slot","sui-button-hide-background":"sui-button-hide-background","sui-button-full-width":"sui-button-full-width"};
23
-
24
- export { Button as buttonClasses };
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 { CircularProgressIndicator as CircularProgressIndicator_CircularProgressIndicator } from "./CircularProgressIndicator.js";
8
+ import { Icon as Icon_Icon } from "./chunks/8307.js";
9
+ import "./Tooltip.js";
10
+ import { withTooltip } from "./chunks/4535.js";
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+ // extracted by css-extract-rspack-plugin
19
+ /* export default */ var Button = ({"sui-button-root":"sui-button-root","sui-disabled":"sui-disabled","sui-button-xlarge":"sui-button-xlarge","sui-button-large":"sui-button-large","sui-button-medium":"sui-button-medium","sui-button-small":"sui-button-small","sui-button-xsmall":"sui-button-xsmall","sui-button-contained-xlarge":"sui-button-contained-xlarge","sui-button-outlined-xlarge":"sui-button-outlined-xlarge","sui-button-inverted-xlarge":"sui-button-inverted-xlarge","sui-button-contained-large":"sui-button-contained-large","sui-button-outlined-large":"sui-button-outlined-large","sui-button-inverted-large":"sui-button-inverted-large","sui-button-contained-medium":"sui-button-contained-medium","sui-button-outlined-medium":"sui-button-outlined-medium","sui-button-inverted-medium":"sui-button-inverted-medium","sui-button-contained-small":"sui-button-contained-small","sui-button-outlined-small":"sui-button-outlined-small","sui-button-inverted-small":"sui-button-inverted-small","sui-button-contained-xsmall":"sui-button-contained-xsmall","sui-button-outlined-xsmall":"sui-button-outlined-xsmall","sui-button-inverted-xsmall":"sui-button-inverted-xsmall","sui-button-loading":"sui-button-loading","sui-button-content":"sui-button-content","sui-button-contained":"sui-button-contained","sui-focus-visible":"sui-focus-visible","sui-button-outlined":"sui-button-outlined","sui-button-inverted":"sui-button-inverted","sui-button-text":"sui-button-text","sui-button-contained-primary":"sui-button-contained-primary","sui-button-contained-secondary":"sui-button-contained-secondary","sui-button-contained-neutral":"sui-button-contained-neutral","sui-button-contained-danger":"sui-button-contained-danger","sui-button-contained-warning":"sui-button-contained-warning","sui-button-contained-success":"sui-button-contained-success","sui-button-contained-hide-background":"sui-button-contained-hide-background","sui-button-outlined-primary":"sui-button-outlined-primary","sui-button-outlined-secondary":"sui-button-outlined-secondary","sui-button-outlined-neutral":"sui-button-outlined-neutral","sui-button-outlined-danger":"sui-button-outlined-danger","sui-button-outlined-warning":"sui-button-outlined-warning","sui-button-outlined-success":"sui-button-outlined-success","sui-button-text-primary":"sui-button-text-primary","sui-button-text-secondary":"sui-button-text-secondary","sui-button-text-neutral":"sui-button-text-neutral","sui-button-text-danger":"sui-button-text-danger","sui-button-text-warning":"sui-button-text-warning","sui-button-text-success":"sui-button-text-success","sui-button-inverted-primary":"sui-button-inverted-primary","sui-button-inverted-secondary":"sui-button-inverted-secondary","sui-button-inverted-neutral":"sui-button-inverted-neutral","sui-button-inverted-danger":"sui-button-inverted-danger","sui-button-inverted-warning":"sui-button-inverted-warning","sui-button-inverted-success":"sui-button-inverted-success","sui-button-slot":"sui-button-slot","sui-button-loading-indicator":"sui-button-loading-indicator","sui-button-center-slot":"sui-button-center-slot","sui-button-start-slot":"sui-button-start-slot","sui-button-end-slot":"sui-button-end-slot","sui-button-has-start-slot":"sui-button-has-start-slot","sui-button-has-end-slot":"sui-button-has-end-slot","sui-button-hide-background":"sui-button-hide-background","sui-button-full-width":"sui-button-full-width","sui-button-loading-iconless":"sui-button-loading-iconless"});
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+ const buttonIconSizeMap = {
31
+ xlarge: 'large',
32
+ large: 'medium',
33
+ medium: 'small',
34
+ small: 'small',
35
+ xsmall: 'xsmall'
36
+ };
37
+ const CircularProgressIndicatorSizeMap = {
38
+ xlarge: 'medium',
39
+ large: 'medium',
40
+ medium: 'small',
41
+ small: 'small',
42
+ xsmall: 'xsmall'
43
+ };
44
+ const CircularProgressIndicatorColorMap = {
45
+ primary: 'primary',
46
+ secondary: 'primary',
47
+ danger: 'danger',
48
+ warning: 'warning',
49
+ success: 'success',
50
+ neutral: 'primary'
51
+ };
52
+ const SLOT = 'slot';
53
+ const START_SLOT = 'start-slot';
54
+ const CENTER_SLOT = 'center-slot';
55
+ const END_SLOT = 'end-slot';
56
+ const Button_Button = withTooltip(/*#__PURE__*/ forwardRef((inProps, ref)=>{
57
+ const props = useThemeProps({
58
+ props: inProps,
59
+ name: 'Button'
60
+ });
61
+ 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;
62
+ const cls = useClasses('button', classes, className);
63
+ const disableInteractions = disabledProp || loading;
64
+ const { getRootProps, focusVisible } = useButton({
65
+ ...props,
66
+ focusableWhenDisabled,
67
+ disabled: disableInteractions,
68
+ rootRef: ref
69
+ });
70
+ const ButtonRoot = component;
71
+ const isTextContent = typeof children === 'string';
72
+ const loadingIconless = loading && !startIcon && !endIcon;
73
+ const title = (()=>{
74
+ // * if title is not provided and children is string, use children as title
75
+ if (titleProp === undefined && isTextContent) {
76
+ return children;
77
+ }
78
+ return titleProp;
79
+ })();
80
+ let startSlot = null;
81
+ let centerSlot = null;
82
+ let endSlot = null;
83
+ const startSlotClassName = cls(SLOT, START_SLOT, `${size}-start-slot`, `${variant}-${size}-start-slot`);
84
+ const endSlotClassName = cls(SLOT, END_SLOT, `${size}-end-slot`, `${variant}-${size}-end-slot`);
85
+ const centerSlotClassName = cls(SLOT, CENTER_SLOT);
86
+ if (loading) {
87
+ const loadingIndicator = /*#__PURE__*/ jsx(CircularProgressIndicator_CircularProgressIndicator, {
88
+ ...CircularProgressIndicatorProps,
89
+ className: clsx(startIcon ? startSlotClassName : endIcon ? endSlotClassName : centerSlotClassName, cls('loading-indicator'), CircularProgressIndicatorProps?.className),
90
+ variant: "indeterminate",
91
+ size: CircularProgressIndicatorSizeMap[size],
92
+ color: CircularProgressIndicatorColorMap[color],
93
+ progressBarProps: {
94
+ 'aria-label': CircularProgressIndicatorProps?.['aria-label'] ?? 'Loading',
95
+ ...CircularProgressIndicatorProps?.progressBarProps
96
+ }
97
+ });
98
+ if (startIcon) {
99
+ startSlot = loadingIndicator;
100
+ } else if (endIcon) {
101
+ endSlot = loadingIndicator;
102
+ } else {
103
+ centerSlot = loadingIndicator;
104
+ }
105
+ } else if (startIcon) {
106
+ if (/*#__PURE__*/ react.isValidElement(startIcon)) {
107
+ startSlot = /*#__PURE__*/ react.cloneElement(startIcon, {
108
+ className: clsx(startSlotClassName, startIcon.props.className)
109
+ });
110
+ } else {
111
+ startSlot = /*#__PURE__*/ jsx(Icon_Icon, {
112
+ className: startSlotClassName,
113
+ symbol: startIcon,
114
+ size: buttonIconSizeMap[size]
115
+ });
116
+ }
117
+ }
118
+ if (endIcon && (!loading || startIcon)) {
119
+ if (/*#__PURE__*/ react.isValidElement(endIcon)) {
120
+ endSlot = /*#__PURE__*/ react.cloneElement(endIcon, {
121
+ className: clsx(endSlotClassName, endIcon.props.className)
122
+ });
123
+ } else {
124
+ endSlot = /*#__PURE__*/ jsx(Icon_Icon, {
125
+ className: endSlotClassName,
126
+ symbol: endIcon,
127
+ size: buttonIconSizeMap[size]
128
+ });
129
+ }
130
+ }
131
+ const content = isTextContent ? /*#__PURE__*/ jsx("span", {
132
+ className: cls('content'),
133
+ children: children
134
+ }) : children;
135
+ return /*#__PURE__*/ jsxs(ButtonRoot, {
136
+ 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', loadingIconless && 'loading-iconless', {
137
+ disabled: disabledProp,
138
+ focusVisible,
139
+ loading
140
+ }),
141
+ title: title,
142
+ ...rest,
143
+ ...getRootProps(),
144
+ "aria-busy": loading ? true : undefined,
145
+ children: [
146
+ startSlot,
147
+ centerSlot,
148
+ content,
149
+ endSlot
150
+ ]
151
+ });
152
+ }));
153
+ Button_Button.displayName = 'SuiButton';
154
+
155
+
156
+
157
+
158
+
159
+
160
+ export { Button as buttonClasses, Button_Button as Button, buttonIconSizeMap };