@ringcentral/spring-ui 1.11.2 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/Accordion.js +90 -34
  2. package/AccordionHeader.js +72 -20
  3. package/Alert.js +120 -28
  4. package/Animation.js +2 -45
  5. package/Announcement.js +46 -35
  6. package/Autocomplete.js +1011 -580
  7. package/Avatar.js +134 -73
  8. package/AvatarGroup.js +50 -7
  9. package/Backdrop.js +45 -7
  10. package/Badge.js +77 -15
  11. package/Block.js +34 -12
  12. package/BlockHeader.js +55 -11
  13. package/BottomNavigation.js +181 -65
  14. package/BottomNavigationItem.js +93 -30
  15. package/Button.js +160 -24
  16. package/CallButton.js +53 -31
  17. package/Checkbox.js +88 -26
  18. package/Chip.js +126 -26
  19. package/CircularProgressIndicator.js +80 -8
  20. package/ClickAwayListener.js +4 -1
  21. package/ComponentsProps.js +1 -0
  22. package/DatePicker.js +611 -190
  23. package/DateUtilsContext.js +43 -25
  24. package/Dialer.js +576 -250
  25. package/Dialog.js +100 -45
  26. package/Divider.js +43 -7
  27. package/DragHandle.js +32 -6
  28. package/Drawer.js +117 -19
  29. package/Dropdown.js +154 -74
  30. package/EmptyState.js +63 -11
  31. package/FabButton.js +51 -17
  32. package/FocusTrap.js +109 -12
  33. package/FormField.js +106 -8
  34. package/FormLabel.js +81 -7
  35. package/Icon.js +1 -8
  36. package/IconButton.js +142 -26
  37. package/IconButtonGroup.js +35 -12
  38. package/InlineEditable.js +98 -44
  39. package/LinearProgressIndicator.js +73 -24
  40. package/Link.js +40 -11
  41. package/List.js +54 -9
  42. package/ListItem.js +152 -23
  43. package/ListItemText.js +44 -16
  44. package/ListNavigation.js +272 -20
  45. package/Menu.js +139 -23
  46. package/MenuActions.js +37 -12
  47. package/MenuDivider.js +34 -8
  48. package/MenuFooter.js +36 -12
  49. package/MenuHeader.js +54 -15
  50. package/MenuItem.js +402 -33
  51. package/MenuItemText.js +51 -8
  52. package/MenuList.js +87 -34
  53. package/Modal.js +345 -16
  54. package/NestedMenuContext.js +183 -11
  55. package/Option.js +32 -34
  56. package/Overlap.js +54 -7
  57. package/PageHeader.js +62 -24
  58. package/PickerTextField.js +156 -33
  59. package/Popover.js +262 -21
  60. package/Popper.js +130 -77
  61. package/PopperPaper.js +54 -8
  62. package/Portal.js +6 -1
  63. package/Radio.js +65 -21
  64. package/RadioGroup.js +56 -17
  65. package/Rating.js +223 -87
  66. package/Select.js +387 -41
  67. package/SingleFilter.js +148 -77
  68. package/Skeleton.js +68 -17
  69. package/Slider.js +168 -69
  70. package/Snackbar.js +122 -59
  71. package/SortableList.js +32 -12
  72. package/SortableListDndContext.js +69 -22
  73. package/SortableListItem.js +92 -47
  74. package/SortableVirtualizedList.js +52 -28
  75. package/SplitButton.js +124 -86
  76. package/Squircle.js +4 -7
  77. package/StatusIndicator.js +51 -9
  78. package/Step.js +63 -38
  79. package/StepButton.js +51 -23
  80. package/StepConnector.js +48 -8
  81. package/StepContent.js +68 -25
  82. package/StepIcon.js +90 -9
  83. package/StepLabel.js +90 -14
  84. package/Stepper.js +65 -23
  85. package/SubMenu.js +203 -99
  86. package/SwipeableDrawer.js +439 -194
  87. package/Switch.js +70 -23
  88. package/Tab.js +120 -57
  89. package/TabContext.js +59 -15
  90. package/TabPanel.js +40 -13
  91. package/Table.js +60 -17
  92. package/TableBody.js +42 -12
  93. package/TableCell.js +84 -50
  94. package/TableContainer.js +32 -10
  95. package/TableFooter.js +38 -10
  96. package/TableHead.js +49 -15
  97. package/TablePagination.js +153 -77
  98. package/TableRow.js +60 -21
  99. package/Tabs.js +593 -268
  100. package/Tag.js +51 -16
  101. package/Text.js +68 -37
  102. package/TextField.js +209 -29
  103. package/Textarea.js +51 -40
  104. package/TimePicker.js +490 -230
  105. package/Tooltip.js +48 -23
  106. package/Tray.js +237 -13
  107. package/TrayMenu.js +62 -41
  108. package/VirtualizedList.js +208 -109
  109. package/VirtualizedMenu.js +359 -29
  110. package/VisuallyHidden.js +29 -6
  111. package/chunks/1250.js +98 -0
  112. package/chunks/1294.js +126 -0
  113. package/chunks/2956.js +18 -0
  114. package/chunks/4476.js +460 -0
  115. package/chunks/4491.js +10 -0
  116. package/chunks/4535.js +364 -0
  117. package/chunks/5047.js +3 -0
  118. package/chunks/6335.js +24 -0
  119. package/chunks/7279.js +10 -0
  120. package/chunks/8011.js +8 -0
  121. package/chunks/8307.js +56 -0
  122. package/chunks/8467.js +8 -0
  123. package/chunks/8809.js +8 -0
  124. package/chunks/{RadioGroup.context.js → 9551.js} +12 -6
  125. package/chunks/987.js +8 -0
  126. package/index.css +2624 -2416
  127. package/index.js +245 -193
  128. package/internal/utils/index.d.ts +1 -0
  129. package/internal/utils/setRef.d.ts +2 -0
  130. package/package.json +8 -8
  131. package/src/Alert/Alert.type.d.ts +2 -1
  132. package/src/Animation/components/Fade/Fade.d.ts +4 -2
  133. package/src/Animation/components/Grow/Grow.d.ts +4 -2
  134. package/src/Animation/components/ShowHideEye/ShowHideEye.d.ts +1 -1
  135. package/src/Animation/components/SlideIn/SlideIn.d.ts +4 -2
  136. package/src/Animation/components/SlideIn/getSlideIn.d.ts +1 -1
  137. package/src/Animation/hooks/useMotionSafeTransition/useMotionSafeTransition.d.ts +2 -0
  138. package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +1 -1
  139. package/src/Autocomplete/useAutocomplete.d.ts +18 -18
  140. package/src/Autocomplete/useAutocompleteTag.d.ts +18 -18
  141. package/src/Badge/Badge.d.ts +2 -1
  142. package/src/Button/Button.classes.d.ts +1 -1
  143. package/src/ComponentsProps.d.ts +111 -110
  144. package/src/DatePicker/DatePickerDataAttributes.d.ts +11 -0
  145. package/src/DatePicker/utils/DatePickerAriaLabelUtils.d.ts +2 -1
  146. package/src/DatePicker/utils/DatePickerUtils.d.ts +1 -1
  147. package/src/Dialer/DialDelete/DialDelete.d.ts +2 -2
  148. package/src/Dialer/DialPad/DialPad.d.ts +2 -2
  149. package/src/Dialer/Dialer.d.ts +4 -2
  150. package/src/Dropdown/Dropdown.type.d.ts +2 -2
  151. package/src/InlineEditable/InlineEditable.type.d.ts +2 -1
  152. package/src/ListNavigation/useListNavigation.d.ts +3 -3
  153. package/src/MenuActions/MenuActions.d.ts +2 -2
  154. package/src/MenuItem/MenuItem.type.d.ts +1 -0
  155. package/src/MenuItem/useMenuItem.d.ts +1 -1
  156. package/src/MenuItem/useVirtualizedMenuItem.d.ts +1 -1
  157. package/src/MenuList/MenuList.type.d.ts +1 -1
  158. package/src/MenuList/MenuListContext.d.ts +2 -3
  159. package/src/Modal/Modal.type.d.ts +1 -0
  160. package/src/NestedMenuContext/MenuOverlayGroupContext.d.ts +2 -2
  161. package/src/Popover/Popover.classes.d.ts +1 -1
  162. package/src/Popover/Popover.internal.d.ts +8 -0
  163. package/src/Popover/Popover.type.d.ts +1 -0
  164. package/src/Popper/Popper.type.d.ts +10 -7
  165. package/src/Rating/utils.d.ts +3 -2
  166. package/src/Select/Select.type.d.ts +7 -5
  167. package/src/Slider/Slider.d.ts +2 -2
  168. package/src/Slider/SliderThumb.d.ts +2 -1
  169. package/src/Squircle/Squircle.d.ts +1 -1
  170. package/src/StatusIndicator/StatusIndicator.d.ts +2 -1
  171. package/src/SubMenu/PopperMenu.type.d.ts +4 -1
  172. package/src/Table/Table.type.d.ts +3 -0
  173. package/src/Table/TableContext.d.ts +3 -0
  174. package/src/Table/TableRowContext.d.ts +7 -0
  175. package/src/Table/index.d.ts +1 -0
  176. package/src/TableCell/TableCell.classes.d.ts +1 -1
  177. package/src/TableFooter/TableFooter.classes.d.ts +1 -1
  178. package/src/TableFooter/TableFooter.type.d.ts +1 -0
  179. package/src/TableHead/TableHead.classes.d.ts +1 -1
  180. package/src/TableHead/TableHead.type.d.ts +1 -0
  181. package/src/TableRow/TableRow.type.d.ts +2 -0
  182. package/chunks/AccordionContext.js +0 -6
  183. package/chunks/Alert.js +0 -48
  184. package/chunks/AvatarGroup.js +0 -22
  185. package/chunks/Backdrop.js +0 -18
  186. package/chunks/Badge.js +0 -32
  187. package/chunks/BottomNavigationItem.js +0 -36
  188. package/chunks/Button.js +0 -88
  189. package/chunks/Chip.js +0 -73
  190. package/chunks/CircularProgressIndicator.js +0 -36
  191. package/chunks/Divider.js +0 -19
  192. package/chunks/DragHandle.js +0 -11
  193. package/chunks/Drawer.js +0 -32
  194. package/chunks/ExpandCollapseCaret.js +0 -24
  195. package/chunks/FormLabel.js +0 -27
  196. package/chunks/Icon.js +0 -25
  197. package/chunks/IconButtonLabel.js +0 -68
  198. package/chunks/List.js +0 -22
  199. package/chunks/ListItem.js +0 -83
  200. package/chunks/Menu.js +0 -61
  201. package/chunks/MenuDivider.js +0 -14
  202. package/chunks/MenuItemText.js +0 -17
  203. package/chunks/MenuList.js +0 -46
  204. package/chunks/Modal.js +0 -212
  205. package/chunks/Overlap.js +0 -25
  206. package/chunks/PickerTextField.js +0 -85
  207. package/chunks/Popover.js +0 -53
  208. package/chunks/PopperPaper.js +0 -15
  209. package/chunks/Select.js +0 -220
  210. package/chunks/ShowHideEye.js +0 -56
  211. package/chunks/SlideIn.js +0 -19
  212. package/chunks/SortableArrow.js +0 -73
  213. package/chunks/Squircle.js +0 -31
  214. package/chunks/StatusIndicator.js +0 -20
  215. package/chunks/StepConnector.js +0 -21
  216. package/chunks/StepIcon.js +0 -43
  217. package/chunks/StepLabel.js +0 -29
  218. package/chunks/StepperContext.js +0 -9
  219. package/chunks/TableContext.js +0 -6
  220. package/chunks/Tablelvl2Context.js +0 -6
  221. package/chunks/TabsContext.js +0 -6
  222. package/chunks/TextField.js +0 -110
  223. package/chunks/Tooltip.js +0 -217
  224. package/chunks/VirtualizedMenu.js +0 -164
  225. package/chunks/VisuallyHidden.js +0 -12
  226. package/chunks/getFade.js +0 -27
  227. package/chunks/getGrow.js +0 -70
  228. package/chunks/getSlideIn.js +0 -30
  229. package/chunks/hasContent.js +0 -3
  230. package/chunks/useAnimationFrame.js +0 -15
  231. package/chunks/useFocusTrapStack.js +0 -36
  232. package/chunks/useHelperTextId.js +0 -22
  233. package/chunks/useListNavigation.js +0 -199
  234. package/chunks/useMenuItemSelect.js +0 -273
  235. package/chunks/useMotionSafeTransition.js +0 -9
  236. package/chunks/useNestedMenuItem.js +0 -27
  237. package/chunks/useNestedParentMenu.js +0 -113
  238. package/chunks/usePrefersReducedMotion.js +0 -36
  239. package/chunks/useTooltipForceHide.js +0 -27
  240. package/chunks/useTrayNavigate.js +0 -150
  241. package/chunks/withTooltip.js +0 -15
package/Switch.js CHANGED
@@ -1,22 +1,37 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useRef, useLayoutEffect } from 'react';
3
- import { useSwitch } from '@mui/base';
4
- import { useClasses, useForkRef, combineProps } from '@ringcentral/spring-base';
5
- import { useThemeProps } from '@ringcentral/spring-theme';
6
- import { u as useFormLabel } from './chunks/FormLabel.js';
7
- import { C as CircularProgressIndicator } from './chunks/CircularProgressIndicator.js';
8
- import 'clsx';
9
-
10
- var Switch$1 = {"sui-switch-root":"sui-switch-root","sui-focus-visible":"sui-focus-visible","sui-switch-track":"sui-switch-track","sui-switch-dot":"sui-switch-dot","sui-switch-input":"sui-switch-input","sui-checked":"sui-checked"};
11
-
12
- const Switch = forwardRef((inProps, ref) => {
13
- const props = useThemeProps({ props: inProps, name: 'Switch' });
14
- const { classes, className, inputRef: inputRefProp, inputProps: inputPropsProp, rootProps, checked: checkedProp, defaultChecked, disabled: disabledProp, autoFocus = false, onBlur, onChange, onFocus, onFocusVisible, required, loading = false, loadingProps, ...rest } = props;
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useLayoutEffect, useRef } from "react";
3
+ import { useSwitch } from "@mui/base";
4
+ import { combineProps, useClasses, useForkRef } from "@ringcentral/spring-base";
5
+ import { useThemeProps } from "@ringcentral/spring-theme";
6
+ import { useFormLabel } from "./FormLabel.js";
7
+ import { CircularProgressIndicator as CircularProgressIndicator_CircularProgressIndicator } from "./CircularProgressIndicator.js";
8
+
9
+
10
+
11
+
12
+
13
+
14
+ // extracted by css-extract-rspack-plugin
15
+ /* export default */ var Switch = ({"sui-switch-root":"sui-switch-root","sui-focus-visible":"sui-focus-visible","sui-switch-track":"sui-switch-track","sui-switch-dot":"sui-switch-dot","sui-switch-input":"sui-switch-input","sui-checked":"sui-checked"});
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+ const Switch_Switch = /*#__PURE__*/ forwardRef((inProps, ref)=>{
25
+ const props = useThemeProps({
26
+ props: inProps,
27
+ name: 'Switch'
28
+ });
29
+ const { classes, className, inputRef: inputRefProp, inputProps: inputPropsProp, rootProps, /* ⬇️ for input */ checked: checkedProp, defaultChecked, disabled: disabledProp, autoFocus = false, onBlur, onChange, onFocus, onFocusVisible, required, loading = false, loadingProps, ...rest } = props;
15
30
  const cls = useClasses('switch', classes, className);
16
31
  const isDisabled = loading ? true : disabledProp;
17
32
  const { disabled, id } = useFormLabel({
18
33
  disabled: isDisabled,
19
- id: inputPropsProp?.id,
34
+ id: inputPropsProp?.id
20
35
  });
21
36
  const { getInputProps, focusVisible, checked } = useSwitch({
22
37
  checked: checkedProp,
@@ -26,25 +41,57 @@ const Switch = forwardRef((inProps, ref) => {
26
41
  onChange,
27
42
  onFocus,
28
43
  onFocusVisible,
29
- required,
44
+ required
30
45
  });
31
46
  const inputProps = getInputProps({
32
47
  role: 'switch',
33
- ...inputPropsProp,
48
+ ...inputPropsProp
34
49
  });
35
50
  const inputRef = useRef();
36
51
  const forkRef = useForkRef(inputRefProp, inputProps.ref, inputRef);
37
- useLayoutEffect(() => {
52
+ useLayoutEffect(()=>{
38
53
  if (autoFocus) {
39
54
  inputRef.current?.focus();
40
55
  }
56
+ // oxlint-disable-next-line react-hooks/exhaustive-deps
41
57
  }, []);
42
- return (jsxs("span", { ...rootProps, ...rest, className: cls('root', { focusVisible }), ref: ref, children: [jsx("input", { ...inputProps, id: id, className: cls('input', { checked }), ref: forkRef }), jsx("span", { className: cls('track') }), jsx("span", { className: cls('dot'), children: loading && (jsx(CircularProgressIndicator, { ...combineProps({
58
+ return /*#__PURE__*/ jsxs("span", {
59
+ ...rootProps,
60
+ ...rest,
61
+ className: cls('root', {
62
+ focusVisible
63
+ }),
64
+ ref: ref,
65
+ children: [
66
+ /*#__PURE__*/ jsx("input", {
67
+ ...inputProps,
68
+ id: id,
69
+ className: cls('input', {
70
+ checked
71
+ }),
72
+ ref: forkRef
73
+ }),
74
+ /*#__PURE__*/ jsx("span", {
75
+ className: cls('track')
76
+ }),
77
+ /*#__PURE__*/ jsx("span", {
78
+ className: cls('dot'),
79
+ children: loading && /*#__PURE__*/ jsx(CircularProgressIndicator_CircularProgressIndicator, {
80
+ ...combineProps({
43
81
  variant: 'indeterminate',
44
82
  size: 'small',
45
- color: 'primary',
46
- }, loadingProps) })) })] }));
83
+ color: 'primary'
84
+ }, loadingProps)
85
+ })
86
+ })
87
+ ]
88
+ });
47
89
  });
48
- Switch.displayName = 'SuiSwitch';
90
+ Switch_Switch.displayName = 'SuiSwitch';
91
+
92
+
93
+
94
+
95
+
49
96
 
50
- export { Switch, Switch$1 as switchStyle };
97
+ export { Switch as switchStyle, Switch_Switch as Switch };
package/Tab.js CHANGED
@@ -1,102 +1,165 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { forwardRef, useRef, useEffect, useImperativeHandle } from 'react';
3
- import { useTab } from '@mui/base';
4
- import { useForkRef, combineClasses } from '@ringcentral/spring-base';
5
- import { useThemeProps, useClassesWithMode } from '@ringcentral/spring-theme';
6
- import { B as Badge } from './chunks/Badge.js';
7
- import { I as Icon } from './chunks/Icon.js';
8
- import { u as useTabsContext } from './chunks/TabsContext.js';
9
- import { T as Tooltip } from './chunks/Tooltip.js';
10
- import 'framer-motion';
11
- import 'lodash/isNumber';
12
- import 'lodash/kebabCase';
13
- import './chunks/useMotionSafeTransition.js';
14
- import './chunks/usePrefersReducedMotion.js';
15
- import 'clsx';
16
- import './chunks/getFade.js';
17
- import './Popper.js';
18
- import '@floating-ui/react-dom';
19
- import './chunks/Modal.js';
20
- import './chunks/useFocusTrapStack.js';
21
- import './chunks/Backdrop.js';
22
- import './chunks/PopperPaper.js';
23
-
24
- var Tab$1 = {"sui-tab-container":"sui-tab-container","sui-tab-pill-badge":"sui-tab-pill-badge","sui-tab-badge-root":"sui-tab-badge-root","sui-tab-root":"sui-tab-root","sui-selected":"sui-selected","sui-focus-visible":"sui-focus-visible","sui-tab-badge":"sui-tab-badge","sui-tab-label":"sui-tab-label","sui-tab-label-container":"sui-tab-label-container","sui-tab-label-text":"sui-tab-label-text","sui-tab-label-badge-root":"sui-tab-label-badge-root","sui-tab-icon":"sui-tab-icon","sui-tab-icon-container":"sui-tab-icon-container","sui-tab-icon-pill":"sui-tab-icon-pill","sui-tab-icon-badge-root":"sui-tab-icon-badge-root","sui-tab-large":"sui-tab-large","sui-tab-pill":"sui-tab-pill","sui-tab-pill-small":"sui-tab-pill-small","sui-tab-label-pill-cobranding":"sui-tab-label-pill-cobranding","sui-tab-icon-pill-cobranding":"sui-tab-icon-pill-cobranding","sui-compact":"sui-compact"};
25
-
26
- const Tab = forwardRef((inProps, ref) => {
27
- const props = useThemeProps({ props: inProps, name: 'Tab' });
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
3
+ import { useTab } from "@mui/base";
4
+ import { combineClasses, useForkRef } from "@ringcentral/spring-base";
5
+ import { useClassesWithMode, useThemeProps } from "@ringcentral/spring-theme";
6
+ import { Badge as Badge_Badge } from "./Badge.js";
7
+ import { Icon as Icon_Icon } from "./chunks/8307.js";
8
+ import { useTabsContext } from "./chunks/8809.js";
9
+ import "./Tooltip.js";
10
+ import { Tooltip } from "./chunks/4535.js";
11
+
12
+
13
+
14
+
15
+
16
+
17
+ // extracted by css-extract-rspack-plugin
18
+ /* export default */ var Tab = ({"sui-tab-container":"sui-tab-container","sui-tab-pill-badge":"sui-tab-pill-badge","sui-tab-badge-root":"sui-tab-badge-root","sui-tab-root":"sui-tab-root","sui-selected":"sui-selected","sui-focus-visible":"sui-focus-visible","sui-tab-badge":"sui-tab-badge","sui-tab-label":"sui-tab-label","sui-tab-label-container":"sui-tab-label-container","sui-tab-label-text":"sui-tab-label-text","sui-tab-label-badge-root":"sui-tab-label-badge-root","sui-tab-icon":"sui-tab-icon","sui-tab-icon-container":"sui-tab-icon-container","sui-tab-icon-pill":"sui-tab-icon-pill","sui-tab-icon-badge-root":"sui-tab-icon-badge-root","sui-tab-large":"sui-tab-large","sui-tab-pill":"sui-tab-pill","sui-tab-pill-small":"sui-tab-pill-small","sui-tab-label-pill-cobranding":"sui-tab-label-pill-cobranding","sui-tab-icon-pill-cobranding":"sui-tab-icon-pill-cobranding","sui-compact":"sui-compact"});
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+ /**
30
+ * Tab component for use within TabContext and Tabs.
31
+ *
32
+ * **IMPORTANT**: It is strongly recommended to provide a unique `id` prop for each Tab.
33
+ * - Unique ids are required for accessibility and correct tab-panel linking
34
+ * - If no `id` is provided, each Tab element will be cloned to provide an auto-generated id, which may have a performance cost
35
+ * - The warning "Tab component missing recommended 'id' prop" will be shown when `id` is not provided
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * <TabContext defaultValue={0}>
40
+ * <Tabs>
41
+ * <Tab id="tab-dialpad" label="Dialpad" value={0} />
42
+ * <Tab id="tab-history" label="History" value={1} />
43
+ * </Tabs>
44
+ * <TabPanel value={0}>Dialpad Content</TabPanel>
45
+ * <TabPanel value={1}>History Content</TabPanel>
46
+ * </TabContext>
47
+ * ```
48
+ */ const Tab_Tab = /*#__PURE__*/ forwardRef((inProps, ref)=>{
49
+ const props = useThemeProps({
50
+ props: inProps,
51
+ name: 'Tab'
52
+ });
28
53
  const { classes, className, children: childrenProp, action, onChange, variant = 'label', color: colorProp, label, symbol, TooltipProps, BadgeProps: badgePropsProp, title, style, value, ...rest } = props;
29
54
  const tabRef = useRef(null);
30
55
  const handleRef = useForkRef(tabRef, ref);
31
- const { pill, pillGap, color: contextColor, size: contextSize, setFloatingUnderlineVisibility, } = useTabsContext();
56
+ const { pill, pillGap, color: contextColor, size: contextSize, setFloatingUnderlineVisibility } = useTabsContext();
32
57
  const color = colorProp ?? contextColor ?? 'default';
33
58
  const size = contextSize ?? 'medium';
34
- const { active, focusVisible, setFocusVisible, selected, getRootProps, index, } = useTab({
59
+ const { active, focusVisible, setFocusVisible, selected, getRootProps, index } = useTab({
35
60
  ...rest,
36
61
  value,
37
- rootRef: handleRef,
62
+ rootRef: handleRef
38
63
  });
39
- useEffect(() => {
40
- if (!setFloatingUnderlineVisibility)
41
- return;
64
+ useEffect(()=>{
65
+ if (!setFloatingUnderlineVisibility) return;
42
66
  if (focusVisible && selected) {
67
+ // Hide the floating underline when the currently selected tab is also focused
43
68
  setFloatingUnderlineVisibility(false);
44
- }
45
- else if (selected) {
69
+ } else if (selected) {
70
+ // Show the floating underline when this tab is selected but not focused
46
71
  setFloatingUnderlineVisibility(true);
47
72
  }
48
- }, [focusVisible, selected, setFloatingUnderlineVisibility]);
49
- useImperativeHandle(action, () => ({
50
- focusVisible: () => {
51
- setFocusVisible(true);
52
- tabRef.current?.focus();
53
- },
54
- }), [setFocusVisible]);
73
+ }, [
74
+ focusVisible,
75
+ selected,
76
+ setFloatingUnderlineVisibility
77
+ ]);
78
+ useImperativeHandle(action, ()=>({
79
+ focusVisible: ()=>{
80
+ setFocusVisible(true);
81
+ tabRef.current?.focus();
82
+ }
83
+ }), [
84
+ setFocusVisible
85
+ ]);
55
86
  const cls = useClassesWithMode('tab', classes, className);
56
87
  let children = null;
57
88
  if (childrenProp) {
58
89
  children = childrenProp;
59
- }
60
- else {
90
+ } else {
61
91
  let badgeClasses = {
62
92
  root: cls('badge-root', `${variant}-badge-root`, pill && 'pill-badge', pill && `${variant}-pill-badge`),
63
- content: cls('badge', `${variant}-badge`),
93
+ content: cls('badge', `${variant}-badge`)
64
94
  };
65
95
  if (badgePropsProp?.classes) {
66
96
  badgeClasses = combineClasses(badgeClasses, badgePropsProp.classes);
67
97
  }
68
98
  let content = null;
69
99
  if (variant === 'label' && label) {
70
- content = (jsx("span", { className: cls('text', `${variant}-text`), children: label }));
100
+ content = /*#__PURE__*/ jsx("span", {
101
+ className: cls('text', `${variant}-text`),
102
+ children: label
103
+ });
71
104
  }
72
105
  if (variant === 'icon' && symbol) {
73
- content = jsx(Icon, { size: "small", symbol: symbol });
106
+ content = /*#__PURE__*/ jsx(Icon_Icon, {
107
+ size: "small",
108
+ symbol: symbol
109
+ });
74
110
  }
75
111
  const badgeProps = badgePropsProp && {
76
112
  color: selected ? 'primary' : 'secondary',
77
113
  variant: pill ? 'outlined' : 'contained',
78
114
  size: badgePropsProp?.type === 'dot' ? 'medium' : badgePropsProp?.size,
79
115
  ...badgePropsProp,
80
- classes: badgeClasses,
116
+ classes: badgeClasses
81
117
  };
82
- children = (jsxs("div", { className: cls('container', `${variant}-container`), children: [content, badgeProps && jsx(Badge, { ...badgeProps })] }));
118
+ children = /*#__PURE__*/ jsxs("div", {
119
+ className: cls('container', `${variant}-container`),
120
+ children: [
121
+ content,
122
+ badgeProps && /*#__PURE__*/ jsx(Badge_Badge, {
123
+ ...badgeProps
124
+ })
125
+ ]
126
+ });
83
127
  }
84
128
  const tooltipTitle = title || (typeof label === 'string' ? label : undefined);
85
129
  const nativeTitle = variant === 'label' ? tooltipTitle : undefined;
86
- const tab = (jsx("button", { className: cls('root', variant, {
130
+ const tab = /*#__PURE__*/ jsx("button", {
131
+ className: cls('root', variant, {
87
132
  pill,
88
133
  active,
89
134
  focusVisible,
90
- selected,
91
- }, size, pill && `pill-${size}`, pill && `${variant}-pill`, pill && color !== 'default' && `${variant}-pill-${color}`), title: nativeTitle, tabIndex: selected ? 0 : -1, style: {
135
+ selected
136
+ }, size, pill && `pill-${size}`, pill && `${variant}-pill`, pill && color !== 'default' && `${variant}-pill-${color}`),
137
+ title: nativeTitle,
138
+ tabIndex: selected ? 0 : -1,
139
+ style: {
92
140
  ...style,
93
- ...(pill && index !== 0 ? { marginLeft: `${pillGap}px` } : {}),
94
- }, ...getRootProps(rest), onChange: onChange, children: children }));
141
+ ...pill && index !== 0 ? {
142
+ marginLeft: `${pillGap}px`
143
+ } : {}
144
+ },
145
+ ...getRootProps(rest),
146
+ onChange: onChange,
147
+ children: children
148
+ });
95
149
  if (variant === 'label') {
96
150
  return tab;
97
151
  }
98
- return (jsx(Tooltip, { ...TooltipProps, title: tooltipTitle, children: tab }));
152
+ return /*#__PURE__*/ jsx(Tooltip, {
153
+ ...TooltipProps,
154
+ title: tooltipTitle,
155
+ children: tab
156
+ });
99
157
  });
100
- Tab.displayName = 'SuiTab';
158
+ Tab_Tab.displayName = 'SuiTab';
159
+
160
+
161
+
162
+
163
+
101
164
 
102
- export { Tab, Tab$1 as tabStyle };
165
+ export { Tab as tabStyle, Tab_Tab as Tab };
package/TabContext.js CHANGED
@@ -1,29 +1,73 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { useTabs, TabsProvider } from '@mui/base';
3
- export { useTabsContext as useTabContext } from '@mui/base';
4
- import { createContext, useContext, useMemo } from 'react';
5
- import { useId } from '@ringcentral/spring-base';
6
-
7
- const InternalTabsContext = createContext({ tabsInstanceId: undefined });
8
- const useInternalTabsContext = () => useContext(InternalTabsContext);
9
- const generateTabStableIds = (tabsInstanceId, identifier) => {
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { TabsProvider, useTabs, useTabsContext } from "@mui/base";
3
+ import { createContext, useContext, useMemo } from "react";
4
+ import { useId } from "@ringcentral/spring-base";
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+ // Create a separate context for internal use that both Tab and TabPanel can access
15
+ const InternalTabsContext = /*#__PURE__*/ createContext({
16
+ tabsInstanceId: undefined
17
+ });
18
+ const useInternalTabsContext = ()=>useContext(InternalTabsContext);
19
+ /**
20
+ * Generate stable IDs for tab and tabpanel pairs
21
+ * This ensures consistent IDs regardless of whether the tab is visible or in more menu
22
+ */ const generateTabStableIds = (tabsInstanceId, identifier)=>{
10
23
  const prefix = tabsInstanceId || 'Tabs';
11
24
  return {
12
25
  tabId: `${prefix}-tab-${identifier}`,
13
- panelId: `${prefix}-tabpanel-${identifier}`,
26
+ panelId: `${prefix}-tabpanel-${identifier}`
14
27
  };
15
28
  };
16
- const useTabStableIds = (identifier) => {
29
+ const useTabStableIds = (identifier)=>{
17
30
  const { tabsInstanceId } = useInternalTabsContext();
18
31
  return generateTabStableIds(tabsInstanceId, identifier);
19
32
  };
20
- const TabContext = (props) => {
33
+ /**
34
+ * TabContext provides the context for Tab and TabPanel components.
35
+ *
36
+ * **IMPORTANT**: When using Tab, Tabs, and TabPanel components, you MUST wrap them with TabContext.
37
+ * TabContext manages the state and coordination between tabs and their panels.
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * <TabContext defaultValue={0}>
42
+ * <Tabs>
43
+ * <Tab label="Tab 1" value={0} />
44
+ * <Tab label="Tab 2" value={1} />
45
+ * </Tabs>
46
+ * <TabPanel value={0}>Content 1</TabPanel>
47
+ * <TabPanel value={1}>Content 2</TabPanel>
48
+ * </TabContext>
49
+ * ```
50
+ */ const TabContext = (props)=>{
21
51
  const { children } = props;
22
52
  const { contextValue } = useTabs(props);
23
53
  const generatedTabsInstanceId = useId('Tabs', true);
24
- const internalContextValue = useMemo(() => ({ tabsInstanceId: generatedTabsInstanceId }), [generatedTabsInstanceId]);
25
- return (jsx(TabsProvider, { value: contextValue, children: jsx(InternalTabsContext.Provider, { value: internalContextValue, children: children }) }));
54
+ const internalContextValue = useMemo(()=>({
55
+ tabsInstanceId: generatedTabsInstanceId
56
+ }), [
57
+ generatedTabsInstanceId
58
+ ]);
59
+ return /*#__PURE__*/ jsx(TabsProvider, {
60
+ value: contextValue,
61
+ children: /*#__PURE__*/ jsx(InternalTabsContext.Provider, {
62
+ value: internalContextValue,
63
+ children: children
64
+ })
65
+ });
26
66
  };
27
67
  TabContext.displayName = 'SuiTabContext';
28
68
 
29
- export { TabContext, generateTabStableIds, useInternalTabsContext, useTabStableIds };
69
+
70
+
71
+
72
+
73
+ export { TabContext, generateTabStableIds, useInternalTabsContext, useTabStableIds, useTabsContext as useTabContext };
package/TabPanel.js CHANGED
@@ -1,26 +1,53 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useTabPanel } from '@mui/base';
4
- import { useEver, useClasses } from '@ringcentral/spring-base';
5
- import { useThemeProps } from '@ringcentral/spring-theme';
6
- import { useTabStableIds } from './TabContext.js';
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useTabPanel } from "@mui/base";
4
+ import { useClasses, useEver } from "@ringcentral/spring-base";
5
+ import { useThemeProps } from "@ringcentral/spring-theme";
6
+ import { useTabStableIds } from "./TabContext.js";
7
7
 
8
- var TabPanel$1 = {};
9
8
 
10
- const TabPanel = forwardRef((inProps, ref) => {
11
- const props = useThemeProps({ props: inProps, name: 'TabPanel' });
9
+
10
+
11
+
12
+
13
+ // extracted by css-extract-rspack-plugin
14
+ /* export default */ var TabPanel = ({});
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+ const TabPanel_TabPanel = /*#__PURE__*/ forwardRef((inProps, ref)=>{
23
+ const props = useThemeProps({
24
+ props: inProps,
25
+ name: 'TabPanel'
26
+ });
12
27
  const { classes, className, children, value, keepMounted, id, ...rest } = props;
13
28
  const { panelId } = useTabStableIds(value);
14
29
  const { hidden, getRootProps } = useTabPanel({
15
30
  ...props,
16
- id: id ?? panelId,
31
+ id: id ?? panelId
17
32
  });
18
33
  const isEverShown = useEver(!hidden);
19
34
  const keepAlive = keepMounted && isEverShown;
20
35
  const unmount = hidden && !keepAlive;
21
36
  const cls = useClasses('tab-panel', classes, className);
22
- return (jsx("div", { role: "tabpanel", className: cls('root'), ...rest, ...getRootProps(), ref: ref, children: !unmount && children }));
37
+ return /*#__PURE__*/ jsx("div", {
38
+ role: "tabpanel",
39
+ className: cls('root'),
40
+ ...rest,
41
+ ...getRootProps(),
42
+ ref: ref,
43
+ children: !unmount && children
44
+ });
23
45
  });
24
- TabPanel.displayName = 'SuiTabPanel';
46
+ TabPanel_TabPanel.displayName = 'SuiTabPanel';
47
+
48
+
49
+
50
+
51
+
25
52
 
26
- export { TabPanel, TabPanel$1 as tabPanelStyle };
53
+ export { TabPanel as tabPanelStyle, TabPanel_TabPanel as TabPanel };
package/Table.js CHANGED
@@ -1,24 +1,67 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useMemo } from 'react';
3
- import { useClasses } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
- import { T as TableContext } from './chunks/TableContext.js';
6
- export { u as useTableContext } from './chunks/TableContext.js';
7
- export { T as Tablelvl2Context, u as useTablelvl2Context } from './chunks/Tablelvl2Context.js';
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useMemo } from "react";
3
+ import { useClasses } from "@ringcentral/spring-base";
4
+ import { useThemeProps } from "@ringcentral/spring-theme";
5
+ import { TableContext } from "./chunks/7279.js";
6
+
7
+
8
+
9
+
10
+
11
+ // extracted by css-extract-rspack-plugin
12
+ /* export default */ var Table = ({"sui-table-root":"sui-table-root","sui-table-sticky-header":"sui-table-sticky-header","sui-table-sticky-footer":"sui-table-sticky-footer"});
13
+
14
+
15
+
16
+
8
17
 
9
- var Table$1 = {"sui-table-root":"sui-table-root","sui-table-sticky-header":"sui-table-sticky-header","sui-table-sticky-footer":"sui-table-sticky-footer"};
10
18
 
11
19
  const defaultComponent = 'table';
12
- const Table = forwardRef((inProps, ref) => {
13
- const props = useThemeProps({ props: inProps, name: 'Table' });
14
- const { component: TableRoot = defaultComponent, classes, className, children, stickyHeader = false, stickyFooter = false, columnDivider = false, ...rest } = props;
20
+ const Table_Table = /*#__PURE__*/ forwardRef((inProps, ref)=>{
21
+ const props = useThemeProps({
22
+ props: inProps,
23
+ name: 'Table'
24
+ });
25
+ const { component: TableRoot = defaultComponent, classes, className, children, stickyHeader = false, stickyFooter = false, columnDivider = false, rowDivider = true, size = 'medium', ...rest } = props;
15
26
  const cls = useClasses('table', classes, className);
16
- const table = useMemo(() => ({ stickyHeader, stickyFooter, columnDivider }), [stickyHeader, stickyFooter, columnDivider]);
17
- return (jsx(TableContext.Provider, { value: table, children: jsx(TableRoot, { role: TableRoot === defaultComponent ? undefined : 'table', className: cls('root', {
27
+ const table = useMemo(()=>({
28
+ stickyHeader,
29
+ stickyFooter,
30
+ columnDivider,
31
+ rowDivider,
32
+ size
33
+ }), [
34
+ stickyHeader,
35
+ stickyFooter,
36
+ columnDivider,
37
+ rowDivider,
38
+ size
39
+ ]);
40
+ return /*#__PURE__*/ jsx(TableContext.Provider, {
41
+ value: table,
42
+ children: /*#__PURE__*/ jsx(TableRoot, {
43
+ role: TableRoot === defaultComponent ? undefined : 'table',
44
+ className: cls('root', {
18
45
  'sticky-header': stickyHeader,
19
- 'sticky-footer': stickyFooter,
20
- }), ...rest, ref: ref, children: children }) }));
46
+ 'sticky-footer': stickyFooter
47
+ }),
48
+ ...rest,
49
+ ref: ref,
50
+ children: children
51
+ })
52
+ });
21
53
  });
22
- Table.displayName = 'SuiTable';
54
+ Table_Table.displayName = 'SuiTable';
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
23
63
 
24
- export { Table, TableContext, Table$1 as tableStyle };
64
+ export { Table as tableStyle, Table_Table as Table };
65
+ export { TableContext, useTableContext } from "./chunks/7279.js";
66
+ export { TableRowContext, useTableRowContext } from "./chunks/987.js";
67
+ export { Tablelvl2Context, useTablelvl2Context } from "./chunks/8011.js";
package/TableBody.js CHANGED
@@ -1,20 +1,50 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useClasses } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
- import { u as useTableContext } from './chunks/TableContext.js';
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useClasses } from "@ringcentral/spring-base";
4
+ import { useThemeProps } from "@ringcentral/spring-theme";
5
+ import { useTableContext } from "./chunks/7279.js";
6
+
7
+
8
+
9
+
10
+
11
+ // extracted by css-extract-rspack-plugin
12
+ /* export default */ var TableBody = ({"sui-table-body-root":"sui-table-body-root"});
13
+
14
+
15
+
16
+
6
17
 
7
- var TableBody$1 = {"sui-table-body-root":"sui-table-body-root"};
8
18
 
9
19
  const defaultComponent = 'tbody';
10
- const TableBody = forwardRef((inProps, ref) => {
11
- const props = useThemeProps({ props: inProps, name: 'TableBody' });
20
+ const TableBody_TableBody = /*#__PURE__*/ forwardRef((inProps, ref)=>{
21
+ const props = useThemeProps({
22
+ props: inProps,
23
+ name: 'TableBody'
24
+ });
12
25
  const { component: TableBodyRoot = defaultComponent, classes, className, children, ...rest } = props;
13
26
  const cls = useClasses('table-body', classes, className);
14
27
  const table = useTableContext();
15
- const fillerRowForStickyFooter = table && table.stickyFooter ? (jsx("tr", { "aria-hidden": true, className: "invisible" })) : null;
16
- return (jsxs(TableBodyRoot, { role: TableBodyRoot === defaultComponent ? undefined : 'rowgroup', className: cls('root'), ...rest, ref: ref, children: [children, fillerRowForStickyFooter] }));
28
+ const fillerRowForStickyFooter = table && table.stickyFooter ? /*#__PURE__*/ jsx("tr", {
29
+ "aria-hidden": true,
30
+ className: "invisible"
31
+ }) : null; // If the table has a sticky footer, we need to add an empty row to prevent any row from stretching vertically.
32
+ return /*#__PURE__*/ jsxs(TableBodyRoot, {
33
+ role: TableBodyRoot === defaultComponent ? undefined : 'rowgroup',
34
+ className: cls('root'),
35
+ ...rest,
36
+ ref: ref,
37
+ children: [
38
+ children,
39
+ fillerRowForStickyFooter
40
+ ]
41
+ });
17
42
  });
18
- TableBody.displayName = 'SuiTableBody';
43
+ TableBody_TableBody.displayName = 'SuiTableBody';
44
+
45
+
46
+
47
+
48
+
19
49
 
20
- export { TableBody, TableBody$1 as tableBodyStyle };
50
+ export { TableBody as tableBodyStyle, TableBody_TableBody as TableBody };