@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
@@ -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 };