@ringcentral/spring-ui 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/Accordion.js +90 -34
  2. package/AccordionHeader.js +71 -21
  3. package/Alert.js +120 -28
  4. package/Animation.js +2 -46
  5. package/Announcement.js +46 -35
  6. package/Autocomplete.js +1011 -583
  7. package/Avatar.js +134 -73
  8. package/AvatarGroup.js +50 -7
  9. package/Backdrop.js +45 -7
  10. package/Badge.js +77 -15
  11. package/Block.js +34 -12
  12. package/BlockHeader.js +57 -15
  13. package/BottomNavigation.js +181 -65
  14. package/BottomNavigationItem.js +93 -30
  15. package/Button.js +160 -24
  16. package/CallButton.js +53 -31
  17. package/Checkbox.js +88 -26
  18. package/Chip.js +126 -26
  19. package/CircularProgressIndicator.js +80 -8
  20. package/ClickAwayListener.js +4 -1
  21. package/ComponentsProps.js +1 -0
  22. package/DatePicker.js +611 -192
  23. package/DateUtilsContext.js +43 -25
  24. package/Dialer.js +564 -253
  25. package/Dialog.js +99 -45
  26. package/Divider.js +43 -7
  27. package/DragHandle.js +32 -6
  28. package/Drawer.js +117 -19
  29. package/Dropdown.js +154 -77
  30. package/EmptyState.js +65 -15
  31. package/FabButton.js +51 -17
  32. package/FocusTrap.js +109 -12
  33. package/FormField.js +108 -12
  34. package/FormLabel.js +81 -7
  35. package/Icon.js +1 -8
  36. package/IconButton.js +142 -26
  37. package/IconButtonGroup.js +35 -12
  38. package/InlineEditable.js +98 -44
  39. package/LinearProgressIndicator.js +73 -24
  40. package/Link.js +40 -11
  41. package/List.js +54 -9
  42. package/ListItem.js +152 -23
  43. package/ListItemText.js +44 -17
  44. package/ListNavigation.js +272 -20
  45. package/Menu.js +139 -23
  46. package/MenuActions.js +37 -12
  47. package/MenuDivider.js +34 -8
  48. package/MenuFooter.js +36 -12
  49. package/MenuHeader.js +54 -16
  50. package/MenuItem.js +402 -35
  51. package/MenuItemText.js +51 -9
  52. package/MenuList.js +87 -36
  53. package/Modal.js +345 -16
  54. package/NestedMenuContext.js +183 -11
  55. package/Option.js +32 -36
  56. package/Overlap.js +54 -7
  57. package/PageHeader.js +62 -24
  58. package/PickerTextField.js +156 -35
  59. package/Popover.js +262 -21
  60. package/Popper.js +112 -62
  61. package/PopperPaper.js +54 -8
  62. package/Portal.js +6 -1
  63. package/Radio.js +65 -21
  64. package/RadioGroup.js +56 -17
  65. package/Rating.js +223 -87
  66. package/Select.js +387 -44
  67. package/SingleFilter.js +148 -79
  68. package/Skeleton.js +68 -17
  69. package/Slider.js +167 -69
  70. package/Snackbar.js +122 -59
  71. package/SortableList.js +32 -12
  72. package/SortableListDndContext.js +69 -22
  73. package/SortableListItem.js +92 -47
  74. package/SortableVirtualizedList.js +44 -20
  75. package/SplitButton.js +124 -89
  76. package/Squircle.js +4 -7
  77. package/StatusIndicator.js +51 -9
  78. package/Step.js +63 -38
  79. package/StepButton.js +51 -23
  80. package/StepConnector.js +48 -8
  81. package/StepContent.js +67 -24
  82. package/StepIcon.js +90 -9
  83. package/StepLabel.js +90 -14
  84. package/Stepper.js +65 -23
  85. package/SubMenu.js +203 -101
  86. package/SwipeableDrawer.js +439 -194
  87. package/Switch.js +70 -23
  88. package/Tab.js +120 -57
  89. package/TabContext.js +59 -15
  90. package/TabPanel.js +40 -13
  91. package/Table.js +60 -17
  92. package/TableBody.js +42 -12
  93. package/TableCell.js +84 -50
  94. package/TableContainer.js +32 -10
  95. package/TableFooter.js +38 -10
  96. package/TableHead.js +49 -15
  97. package/TablePagination.js +153 -79
  98. package/TableRow.js +60 -21
  99. package/Tabs.js +592 -271
  100. package/Tag.js +51 -16
  101. package/Text.js +68 -37
  102. package/TextField.js +209 -31
  103. package/Textarea.js +51 -42
  104. package/TimePicker.js +490 -232
  105. package/Tooltip.js +48 -23
  106. package/Tray.js +237 -13
  107. package/TrayMenu.js +62 -43
  108. package/VirtualizedList.js +205 -107
  109. package/VirtualizedMenu.js +359 -29
  110. package/VisuallyHidden.js +29 -6
  111. package/chunks/1250.js +98 -0
  112. package/chunks/1294.js +126 -0
  113. package/chunks/2956.js +18 -0
  114. package/chunks/4476.js +460 -0
  115. package/chunks/4491.js +10 -0
  116. package/chunks/4535.js +364 -0
  117. package/chunks/5047.js +3 -0
  118. package/chunks/6335.js +24 -0
  119. package/chunks/7279.js +10 -0
  120. package/chunks/8011.js +8 -0
  121. package/chunks/8307.js +56 -0
  122. package/chunks/8467.js +8 -0
  123. package/chunks/8809.js +8 -0
  124. package/chunks/{RadioGroup.context.js → 9551.js} +12 -6
  125. package/chunks/987.js +8 -0
  126. package/index.css +2436 -2261
  127. package/index.js +245 -195
  128. package/internal/utils/setRef.d.ts +2 -1
  129. package/package.json +4 -4
  130. package/src/Animation/hooks/useMotionSafeTransition/useMotionSafeTransition.d.ts +2 -0
  131. package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +1 -1
  132. package/src/Button/Button.classes.d.ts +1 -1
  133. package/src/ComponentsProps.d.ts +111 -110
  134. package/src/DatePicker/DatePickerDataAttributes.d.ts +11 -0
  135. package/src/DatePicker/utils/DatePickerUtils.d.ts +1 -1
  136. package/src/MenuItem/MenuItem.type.d.ts +1 -0
  137. package/src/MenuList/MenuListContext.d.ts +2 -3
  138. package/src/Modal/Modal.type.d.ts +1 -0
  139. package/src/Popover/Popover.classes.d.ts +1 -1
  140. package/src/Popover/Popover.internal.d.ts +8 -0
  141. package/src/Popover/Popover.type.d.ts +1 -0
  142. package/src/Select/Select.type.d.ts +6 -4
  143. package/src/Table/Table.type.d.ts +3 -0
  144. package/src/Table/TableContext.d.ts +3 -0
  145. package/src/Table/TableRowContext.d.ts +7 -0
  146. package/src/Table/index.d.ts +1 -0
  147. package/src/TableCell/TableCell.classes.d.ts +1 -1
  148. package/src/TableFooter/TableFooter.classes.d.ts +1 -1
  149. package/src/TableFooter/TableFooter.type.d.ts +1 -0
  150. package/src/TableHead/TableHead.classes.d.ts +1 -1
  151. package/src/TableHead/TableHead.type.d.ts +1 -0
  152. package/src/TableRow/TableRow.type.d.ts +2 -0
  153. package/chunks/AccordionContext.js +0 -6
  154. package/chunks/Alert.js +0 -48
  155. package/chunks/AvatarGroup.js +0 -22
  156. package/chunks/Backdrop.js +0 -18
  157. package/chunks/Badge.js +0 -32
  158. package/chunks/BottomNavigationItem.js +0 -36
  159. package/chunks/Button.js +0 -88
  160. package/chunks/Chip.js +0 -73
  161. package/chunks/CircularProgressIndicator.js +0 -36
  162. package/chunks/Divider.js +0 -19
  163. package/chunks/DragHandle.js +0 -11
  164. package/chunks/Drawer.js +0 -33
  165. package/chunks/ExpandCollapseCaret.js +0 -24
  166. package/chunks/FormLabel.js +0 -27
  167. package/chunks/Icon.js +0 -25
  168. package/chunks/IconButtonLabel.js +0 -68
  169. package/chunks/List.js +0 -22
  170. package/chunks/ListItem.js +0 -83
  171. package/chunks/Menu.js +0 -61
  172. package/chunks/MenuDivider.js +0 -14
  173. package/chunks/MenuItemText.js +0 -18
  174. package/chunks/MenuList.js +0 -47
  175. package/chunks/Modal.js +0 -211
  176. package/chunks/Overlap.js +0 -25
  177. package/chunks/PickerTextField.js +0 -85
  178. package/chunks/Popover.js +0 -61
  179. package/chunks/PopperPaper.js +0 -15
  180. package/chunks/Select.js +0 -225
  181. package/chunks/ShowHideEye.js +0 -56
  182. package/chunks/SlideIn.js +0 -20
  183. package/chunks/SortableArrow.js +0 -73
  184. package/chunks/Squircle.js +0 -31
  185. package/chunks/StatusIndicator.js +0 -20
  186. package/chunks/StepConnector.js +0 -21
  187. package/chunks/StepIcon.js +0 -43
  188. package/chunks/StepLabel.js +0 -29
  189. package/chunks/StepperContext.js +0 -9
  190. package/chunks/TableContext.js +0 -6
  191. package/chunks/Tablelvl2Context.js +0 -6
  192. package/chunks/TabsContext.js +0 -6
  193. package/chunks/TextField.js +0 -110
  194. package/chunks/Tooltip.js +0 -217
  195. package/chunks/VirtualizedMenu.js +0 -162
  196. package/chunks/VisuallyHidden.js +0 -12
  197. package/chunks/composeEventHandlers.js +0 -10
  198. package/chunks/getFade.js +0 -27
  199. package/chunks/getGrow.js +0 -70
  200. package/chunks/getSlideIn.js +0 -30
  201. package/chunks/hasContent.js +0 -3
  202. package/chunks/useAnimationFrame.js +0 -15
  203. package/chunks/useFocusTrapStack.js +0 -38
  204. package/chunks/useHelperTextId.js +0 -24
  205. package/chunks/useListNavigation.js +0 -199
  206. package/chunks/useMenuItemSelect.js +0 -282
  207. package/chunks/useMotionSafeTransition.js +0 -9
  208. package/chunks/useNestedMenuItem.js +0 -27
  209. package/chunks/useNestedParentMenu.js +0 -113
  210. package/chunks/usePrefersReducedMotion.js +0 -36
  211. package/chunks/useTooltipForceHide.js +0 -27
  212. package/chunks/useTrayNavigate.js +0 -150
  213. package/chunks/withTooltip.js +0 -15
package/TableCell.js CHANGED
@@ -1,80 +1,114 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useClasses, useHover, useFocusVisible } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
- import clsx from 'clsx';
6
- import 'framer-motion';
7
- import './chunks/Icon.js';
8
- import { S as SortableArrow } from './chunks/SortableArrow.js';
9
- import { u as useTableContext } from './chunks/TableContext.js';
10
- import { u as useTablelvl2Context } from './chunks/Tablelvl2Context.js';
11
- import './chunks/useMotionSafeTransition.js';
12
- import './chunks/usePrefersReducedMotion.js';
13
-
14
- var TableCell$1 = {"sui-table-cell-root":"sui-table-cell-root","sui-table-cell-padding-checkbox":"sui-table-cell-padding-checkbox","sui-table-cell-content":"sui-table-cell-content","sui-table-cell-head":"sui-table-cell-head","sui-table-cell-sortable":"sui-table-cell-sortable","sui-table-cell-content-sortable":"sui-table-cell-content-sortable","sui-table-cell-sort-icon":"sui-table-cell-sort-icon","sui-focus-visible":"sui-focus-visible","sui-table-cell-padding-none":"sui-table-cell-padding-none","sui-table-cell-align-left":"sui-table-cell-align-left","sui-table-cell-align-center":"sui-table-cell-align-center","sui-table-cell-align-right":"sui-table-cell-align-right","sui-table-cell-align-justify":"sui-table-cell-align-justify","sui-table-cell-sticky-header-default-bg":"sui-table-cell-sticky-header-default-bg","sui-table-cell-content-padding-checkbox":"sui-table-cell-content-padding-checkbox","sui-table-cell-content-align-center":"sui-table-cell-content-align-center","sui-table-cell-content-align-right":"sui-table-cell-content-align-right","sui-table-cell-content-align-justify":"sui-table-cell-content-align-justify","sui-table-cell-sorted":"sui-table-cell-sorted","sui-table-cell-sort-indicator":"sui-table-cell-sort-indicator","sui-table-cell-sort-icon-sorted":"sui-table-cell-sort-icon-sorted","sui-table-cell-column-divider":"sui-table-cell-column-divider"};
15
-
16
- const TableCell = forwardRef((inProps, ref) => {
17
- const props = useThemeProps({ props: inProps, name: 'TableCell' });
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useClasses, useFocusVisible, useHover } from "@ringcentral/spring-base";
4
+ import { useThemeProps } from "@ringcentral/spring-theme";
5
+ import clsx from "clsx";
6
+ import { SortableArrow } from "./chunks/4476.js";
7
+ import { useTableContext } from "./chunks/7279.js";
8
+ import { useTableRowContext } from "./chunks/987.js";
9
+ import { useTablelvl2Context } from "./chunks/8011.js";
10
+
11
+
12
+
13
+
14
+
15
+
16
+ // extracted by css-extract-rspack-plugin
17
+ /* export default */ var TableCell = ({"sui-table-cell-root":"sui-table-cell-root","sui-table-cell-padding-checkbox":"sui-table-cell-padding-checkbox","sui-table-cell-content":"sui-table-cell-content","sui-table-cell-head":"sui-table-cell-head","sui-table-cell-small":"sui-table-cell-small","sui-table-cell-large":"sui-table-cell-large","sui-table-cell-sortable":"sui-table-cell-sortable","sui-table-cell-content-sortable":"sui-table-cell-content-sortable","sui-table-cell-sort-icon":"sui-table-cell-sort-icon","sui-focus-visible":"sui-focus-visible","sui-table-cell-padding-none":"sui-table-cell-padding-none","sui-table-cell-align-left":"sui-table-cell-align-left","sui-table-cell-align-center":"sui-table-cell-align-center","sui-table-cell-align-right":"sui-table-cell-align-right","sui-table-cell-align-justify":"sui-table-cell-align-justify","sui-table-cell-sticky-header-default-bg":"sui-table-cell-sticky-header-default-bg","sui-table-cell-content-padding-checkbox":"sui-table-cell-content-padding-checkbox","sui-table-cell-content-align-center":"sui-table-cell-content-align-center","sui-table-cell-content-align-right":"sui-table-cell-content-align-right","sui-table-cell-content-align-justify":"sui-table-cell-content-align-justify","sui-table-cell-sorted":"sui-table-cell-sorted","sui-table-cell-sort-indicator":"sui-table-cell-sort-indicator","sui-table-cell-sort-icon-sorted":"sui-table-cell-sort-icon-sorted","sui-table-cell-column-divider":"sui-table-cell-column-divider","sui-table-cell-hide-row-divider":"sui-table-cell-hide-row-divider"});
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+ /**
29
+ * The component renders a `<th>` element when the parent context is a header
30
+ * or otherwise a `<td>` element.
31
+ */ const TableCell_TableCell = /*#__PURE__*/ forwardRef((inProps, ref)=>{
32
+ const props = useThemeProps({
33
+ props: inProps,
34
+ name: 'TableCell'
35
+ });
18
36
  const { component: componentProp, variant: variantProp, padding = 'normal', align = 'inherit', scope: scopeProp, sortDirection, showSortIndicator = false, initialSortIconDirection = 'asc', classes, className, children, SortIconProps, ...rest } = props;
19
37
  const cls = useClasses('table-cell', classes, className);
20
38
  const sortable = sortDirection !== undefined;
21
39
  const sorted = !!sortDirection;
22
40
  const table = useTableContext();
41
+ const tableRow = useTableRowContext();
23
42
  const tablelvl2 = useTablelvl2Context();
43
+ const size = tableRow.size ?? table.size;
24
44
  const { hover, hoverHandlers } = useHover();
25
45
  const isHeadCell = tablelvl2 && tablelvl2.variant === 'head';
26
46
  let TableCellRoot = 'td';
27
47
  if (componentProp) {
28
48
  TableCellRoot = componentProp;
29
- }
30
- else {
49
+ } else {
31
50
  TableCellRoot = isHeadCell ? 'th' : 'td';
32
51
  }
33
52
  const { focusVisible, focusVisibleRef, focusVisibleHandlers } = useFocusVisible();
34
53
  let scope = scopeProp;
54
+ // scope is not a valid attribute for <td/> elements.
55
+ // source: https://html.spec.whatwg.org/multipage/tables.html#the-td-element
35
56
  if (TableCellRoot === 'td') {
36
57
  scope = undefined;
37
- }
38
- else if (!scope && isHeadCell) {
58
+ } else if (!scope && isHeadCell) {
39
59
  scope = 'col';
40
60
  }
41
- const variant = variantProp || (tablelvl2 && tablelvl2.variant);
61
+ const variant = variantProp || tablelvl2 && tablelvl2.variant;
62
+ const isBodyVariant = variant !== 'head';
42
63
  let ariaSort = undefined;
43
64
  let sortIcon = null;
44
- const sortIconDirection = sorted
45
- ? sortDirection
46
- : (showSortIndicator && (hover || focusVisible)) || !showSortIndicator
47
- ? initialSortIconDirection
48
- : false;
49
- if (sorted)
50
- ariaSort = sortDirection === 'asc' ? 'ascending' : 'descending';
65
+ const sortIconDirection = sorted ? sortDirection : showSortIndicator && (hover || focusVisible) || !showSortIndicator ? initialSortIconDirection : false;
66
+ if (sorted) ariaSort = sortDirection === 'asc' ? 'ascending' : 'descending';
51
67
  if (sortable) {
52
- sortIcon = (jsx(SortableArrow, { direction: sortIconDirection, size: "small", ...SortIconProps, className: clsx(cls('sort-icon', sorted && 'sort-icon-sorted', showSortIndicator && 'sort-indicator'), SortIconProps?.className) }));
68
+ sortIcon = /*#__PURE__*/ jsx(SortableArrow, {
69
+ direction: sortIconDirection,
70
+ size: "small",
71
+ ...SortIconProps,
72
+ className: clsx(cls('sort-icon', sorted && 'sort-icon-sorted', showSortIndicator && 'sort-indicator'), SortIconProps?.className)
73
+ });
53
74
  }
54
75
  const ContentElement = sortable ? 'button' : 'div';
55
- const sortableProps = sortable
56
- ? {
57
- ref: focusVisibleRef,
58
- type: 'button',
59
- ...focusVisibleHandlers,
60
- ...hoverHandlers,
61
- }
62
- : {};
63
- return (jsx(TableCellRoot, { className: cls('root', variant, align !== 'inherit' && `align-${align}`, padding !== 'normal' && `padding-${padding}`, {
76
+ const sortableProps = sortable ? {
77
+ ref: focusVisibleRef,
78
+ type: 'button',
79
+ ...focusVisibleHandlers,
80
+ ...hoverHandlers
81
+ } : {};
82
+ return /*#__PURE__*/ jsx(TableCellRoot, {
83
+ className: cls('root', variant, align !== 'inherit' && `align-${align}`, padding !== 'normal' && `padding-${padding}`, isBodyVariant && size !== 'medium' && size, {
64
84
  sortable,
65
85
  sorted,
66
- 'sticky-header-default-bg': variant === 'head' &&
67
- table &&
68
- table.stickyHeader &&
69
- tablelvl2?.useDefaultBgColor,
86
+ 'sticky-header-default-bg': variant === 'head' && table && table.stickyHeader && tablelvl2?.useDefaultBgColor,
70
87
  'column-divider': table.columnDivider,
71
- }), "aria-sort": ariaSort, scope: scope, ...rest, ref: ref, children: jsxs(ContentElement, { ...sortableProps, className: cls('content', padding !== 'normal' &&
72
- padding !== 'none' &&
73
- `content-padding-${padding}`, align !== 'inherit' && align !== 'left' && `content-align-${align}`, {
88
+ 'hide-row-divider': isBodyVariant && !table.rowDivider
89
+ }),
90
+ "aria-sort": ariaSort,
91
+ scope: scope,
92
+ ...rest,
93
+ ref: ref,
94
+ children: /*#__PURE__*/ jsxs(ContentElement, {
95
+ ...sortableProps,
96
+ className: cls('content', padding !== 'normal' && padding !== 'none' && `content-padding-${padding}`, align !== 'inherit' && align !== 'left' && `content-align-${align}`, {
74
97
  'content-sortable': sortable,
75
- focusVisible: sortable && focusVisible,
76
- }), children: [children, sortIcon] }) }));
98
+ focusVisible: sortable && focusVisible
99
+ }),
100
+ children: [
101
+ children,
102
+ sortIcon
103
+ ]
104
+ })
105
+ });
77
106
  });
78
- TableCell.displayName = 'SuiTableCell';
107
+ TableCell_TableCell.displayName = 'SuiTableCell';
108
+
109
+
110
+
111
+
112
+
79
113
 
80
- export { TableCell, TableCell$1 as tableCellStyle };
114
+ export { TableCell as tableCellStyle, TableCell_TableCell as TableCell };
package/TableContainer.js CHANGED
@@ -1,16 +1,38 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { useClasses } from '@ringcentral/spring-base';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useClasses } from "@ringcentral/spring-base";
4
+ import { useThemeProps } from "@ringcentral/spring-theme";
5
5
 
6
- var TableContainer$1 = {"sui-table-container":"sui-table-container","sui-table-container-root":"sui-table-container-root","sui-table-container-standard-border":"sui-table-container-standard-border","sui-table-container-rounded-border":"sui-table-container-rounded-border"};
7
6
 
8
- const TableContainer = forwardRef((inProps, ref) => {
9
- const props = useThemeProps({ props: inProps, name: 'TableContainer' });
7
+
8
+
9
+
10
+ // extracted by css-extract-rspack-plugin
11
+ /* export default */ var TableContainer = ({"sui-table-container":"sui-table-container","sui-table-container-root":"sui-table-container-root","sui-table-container-standard-border":"sui-table-container-standard-border","sui-table-container-rounded-border":"sui-table-container-rounded-border"});
12
+
13
+
14
+
15
+
16
+
17
+ const TableContainer_TableContainer = /*#__PURE__*/ forwardRef((inProps, ref)=>{
18
+ const props = useThemeProps({
19
+ props: inProps,
20
+ name: 'TableContainer'
21
+ });
10
22
  const { component: TableContainerRoot = 'div', classes, className, children, border = 'standard', ...rest } = props;
11
23
  const cls = useClasses('table-container', classes, className);
12
- return (jsx(TableContainerRoot, { className: cls('root', border, `${border}-border`), ...rest, ref: ref, children: children }));
24
+ return /*#__PURE__*/ jsx(TableContainerRoot, {
25
+ className: cls('root', border, `${border}-border`),
26
+ ...rest,
27
+ ref: ref,
28
+ children: children
29
+ });
13
30
  });
14
- TableContainer.displayName = 'SuiTableContainer';
31
+ TableContainer_TableContainer.displayName = 'SuiTableContainer';
32
+
33
+
34
+
35
+
36
+
15
37
 
16
- export { TableContainer, TableContainer$1 as tableContainerStyle };
38
+ export { TableContainer as tableContainerStyle, TableContainer_TableContainer as TableContainer };
package/TableFooter.js CHANGED
@@ -1,16 +1,44 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { useClasses } from '@ringcentral/spring-base';
3
- import { forwardRef } from 'react';
4
- import { u as useTableContext } from './chunks/TableContext.js';
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useClasses } from "@ringcentral/spring-base";
3
+ import { forwardRef } from "react";
4
+ import { useTableContext } from "./chunks/7279.js";
5
5
 
6
- var TableFooter$1 = {"sui-table-footer-root":"sui-table-footer-root","sui-table-footer-content":"sui-table-footer-content","sui-table-footer-padding-none":"sui-table-footer-padding-none","sui-table-footer-padding-checkbox":"sui-table-footer-padding-checkbox","sui-table-footer-sticky":"sui-table-footer-sticky"};
7
6
 
8
- const TableFooter = forwardRef((inProps, ref) => {
9
- const { classes, colSpan, children, className, padding = 'normal', ...rest } = inProps;
7
+
8
+
9
+ // extracted by css-extract-rspack-plugin
10
+ /* export default */ var TableFooter = ({"sui-table-footer-root":"sui-table-footer-root","sui-table-footer-content":"sui-table-footer-content","sui-table-footer-padding-none":"sui-table-footer-padding-none","sui-table-footer-padding-checkbox":"sui-table-footer-padding-checkbox","sui-table-footer-sticky":"sui-table-footer-sticky","sui-table-footer-hide-divider":"sui-table-footer-hide-divider"});
11
+
12
+
13
+
14
+
15
+
16
+ const TableFooter_TableFooter = /*#__PURE__*/ forwardRef((inProps, ref)=>{
17
+ const { classes, colSpan, children, className, padding = 'normal', divider = true, ...rest } = inProps;
10
18
  const cls = useClasses('table-footer', classes, className);
11
19
  const table = useTableContext();
12
- return (jsx("tfoot", { ...rest, className: cls('root', { sticky: table.stickyFooter }), ref: ref, children: jsx("tr", { children: jsx("td", { colSpan: colSpan || 1000, children: jsx("div", { className: cls('content', padding !== 'normal' && `padding-${padding}`), children: children }) }) }) }));
20
+ return /*#__PURE__*/ jsx("tfoot", {
21
+ ...rest,
22
+ className: cls('root', {
23
+ sticky: table.stickyFooter,
24
+ 'hide-divider': !divider
25
+ }),
26
+ ref: ref,
27
+ children: /*#__PURE__*/ jsx("tr", {
28
+ children: /*#__PURE__*/ jsx("td", {
29
+ colSpan: colSpan || 1000,
30
+ children: /*#__PURE__*/ jsx("div", {
31
+ className: cls('content', padding !== 'normal' && `padding-${padding}`),
32
+ children: children
33
+ })
34
+ })
35
+ })
36
+ });
13
37
  });
14
- TableFooter.displayName = 'SuiTableFooter';
38
+ TableFooter_TableFooter.displayName = 'SuiTableFooter';
39
+
40
+
41
+
42
+
15
43
 
16
- export { TableFooter, TableFooter$1 as tableFooterStyles };
44
+ export { TableFooter as tableFooterStyles, TableFooter_TableFooter as TableFooter };
package/TableHead.js CHANGED
@@ -1,24 +1,58 @@
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 { u as useTableContext } from './chunks/TableContext.js';
6
- import { T as Tablelvl2Context } 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 { useTableContext } from "./chunks/7279.js";
6
+ import { Tablelvl2Context } from "./chunks/8011.js";
7
+
8
+
9
+
10
+
11
+
12
+ // extracted by css-extract-rspack-plugin
13
+ /* export default */ var TableHead = ({"sui-table-head-root":"sui-table-head-root","sui-table-head-background":"sui-table-head-background","sui-table-head-sticky":"sui-table-head-sticky","sui-table-head-hide-divider":"sui-table-head-hide-divider","sui-table-cell-root":"sui-table-cell-root"});
14
+
15
+
16
+
17
+
18
+
7
19
 
8
- var TableHead$1 = {"sui-table-head-root":"sui-table-head-root","sui-table-head-background":"sui-table-head-background","sui-table-head-sticky":"sui-table-head-sticky"};
9
20
 
10
21
  const defaultComponent = 'thead';
11
- const TableHead = forwardRef((inProps, ref) => {
12
- const props = useThemeProps({ props: inProps, name: 'TableHead' });
13
- const { component: TableHeadRoot = defaultComponent, classes, className, children, useDefaultBgColor, ...rest } = props;
22
+ const TableHead_TableHead = /*#__PURE__*/ forwardRef((inProps, ref)=>{
23
+ const props = useThemeProps({
24
+ props: inProps,
25
+ name: 'TableHead'
26
+ });
27
+ const { component: TableHeadRoot = defaultComponent, classes, className, children, useDefaultBgColor, divider = true, ...rest } = props;
14
28
  const cls = useClasses('table-head', classes, className);
15
29
  const table = useTableContext();
16
- const tablelvl2 = useMemo(() => ({ variant: 'head', useDefaultBgColor }), [useDefaultBgColor]);
17
- return (jsx(Tablelvl2Context.Provider, { value: tablelvl2, children: jsx(TableHeadRoot, { className: cls('root', {
30
+ const tablelvl2 = useMemo(()=>({
31
+ variant: 'head',
32
+ useDefaultBgColor
33
+ }), [
34
+ useDefaultBgColor
35
+ ]);
36
+ return /*#__PURE__*/ jsx(Tablelvl2Context.Provider, {
37
+ value: tablelvl2,
38
+ children: /*#__PURE__*/ jsx(TableHeadRoot, {
39
+ className: cls('root', {
18
40
  background: !useDefaultBgColor,
19
41
  sticky: table && table.stickyHeader,
20
- }), role: TableHeadRoot === defaultComponent ? undefined : 'rowgroup', ...rest, ref: ref, children: children }) }));
42
+ 'hide-divider': !divider
43
+ }),
44
+ role: TableHeadRoot === defaultComponent ? undefined : 'rowgroup',
45
+ ...rest,
46
+ ref: ref,
47
+ children: children
48
+ })
49
+ });
21
50
  });
22
- TableHead.displayName = 'SuiTableHead';
51
+ TableHead_TableHead.displayName = 'SuiTableHead';
52
+
53
+
54
+
55
+
56
+
23
57
 
24
- export { TableHead, TableHead$1 as tableHeadStyle };
58
+ export { TableHead as tableHeadStyle, TableHead_TableHead as TableHead };
@@ -1,62 +1,50 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { combineProps, useClasses, useEventCallback } from '@ringcentral/spring-base';
3
- import { CaretLeftMd, CaretRightMd } from '@ringcentral/spring-icon';
4
- import { useThemeProps } from '@ringcentral/spring-theme';
5
- import { forwardRef } from 'react';
6
- import { I as IconButton } from './chunks/IconButtonLabel.js';
7
- import { M as MenuItemText } from './chunks/MenuItemText.js';
8
- import { Option } from './Option.js';
9
- import { S as Select } from './chunks/Select.js';
10
- import '@mui/base';
11
- import './chunks/Icon.js';
12
- import './chunks/Squircle.js';
13
- import './chunks/withTooltip.js';
14
- import './chunks/Tooltip.js';
15
- import 'framer-motion';
16
- import 'clsx';
17
- import './chunks/usePrefersReducedMotion.js';
18
- import './chunks/getFade.js';
19
- import './Popper.js';
20
- import '@floating-ui/react-dom';
21
- import './chunks/Modal.js';
22
- import './chunks/useFocusTrapStack.js';
23
- import './chunks/Backdrop.js';
24
- import './chunks/PopperPaper.js';
25
- import './chunks/hasContent.js';
26
- import '@mui/utils';
27
- import './chunks/composeEventHandlers.js';
28
- import './chunks/useMenuItemSelect.js';
29
- import './chunks/useAnimationFrame.js';
30
- import './chunks/useNestedParentMenu.js';
31
- import './chunks/useNestedMenuItem.js';
32
- import './VirtualizedList.js';
33
- import 'react-virtuoso';
34
- import './chunks/List.js';
35
- import './chunks/useListNavigation.js';
36
- import 'tabbable';
37
- import './ListNavigation.js';
38
- import './chunks/Menu.js';
39
- import './chunks/Popover.js';
40
- import './chunks/getGrow.js';
41
- import './chunks/ExpandCollapseCaret.js';
42
- import './chunks/useMotionSafeTransition.js';
43
- import './chunks/useHelperTextId.js';
44
- import './chunks/MenuList.js';
45
- import './chunks/VirtualizedMenu.js';
46
-
47
- var TablePagination$1 = {"sui-table-pagination-content":"sui-table-pagination-content","sui-table-pagination-selector":"sui-table-pagination-selector","sui-table-pagination-rows-per-page-controls":"sui-table-pagination-rows-per-page-controls","sui-table-pagination-rows-per-page-label":"sui-table-pagination-rows-per-page-label","sui-table-pagination-current-page-controls":"sui-table-pagination-current-page-controls","sui-table-pagination-range-container":"sui-table-pagination-range-container"};
48
-
49
- const TablePagination = forwardRef((inProps, ref) => {
50
- const { classes, className, component: Root = 'td', colSpan = 1000, page, variant = 'range', count = -1, rowsPerPage = 10, rowsPerPageLabel = 'Rows per page', rowsPerPageOptions = [10, 25, 50, 100], onRowsPerPageChange, rangeSeparatorLabel = 'of', previousPageButtonProps, nextPageButtonProps, selectorProps, MenuProps, onPageChange, ...rest } = useThemeProps({
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { combineProps, useClasses, useEventCallback } from "@ringcentral/spring-base";
3
+ import { CaretLeftMd, CaretRightMd } from "@ringcentral/spring-icon";
4
+ import { useThemeProps } from "@ringcentral/spring-theme";
5
+ import { forwardRef } from "react";
6
+ import { IconButton as IconButton_IconButton } from "./IconButton.js";
7
+ import { MenuItemText as MenuItemText_MenuItemText } from "./MenuItemText.js";
8
+ import { Option } from "./Option.js";
9
+ import { Select as Select_Select } from "./Select.js";
10
+
11
+
12
+
13
+
14
+
15
+
16
+ // extracted by css-extract-rspack-plugin
17
+ /* export default */ var TablePagination = ({"sui-table-pagination-content":"sui-table-pagination-content","sui-table-pagination-selector":"sui-table-pagination-selector","sui-table-pagination-rows-per-page-controls":"sui-table-pagination-rows-per-page-controls","sui-table-pagination-rows-per-page-label":"sui-table-pagination-rows-per-page-label","sui-table-pagination-current-page-controls":"sui-table-pagination-current-page-controls","sui-table-pagination-range-container":"sui-table-pagination-range-container"});
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+ const TablePagination_TablePagination = /*#__PURE__*/ forwardRef((inProps, ref)=>{
29
+ const { classes, className, component: Root = 'td', colSpan = 1000, page, variant = 'range', count = -1, rowsPerPage = 10, rowsPerPageLabel = 'Rows per page', rowsPerPageOptions = [
30
+ 10,
31
+ 25,
32
+ 50,
33
+ 100
34
+ ], onRowsPerPageChange, rangeSeparatorLabel = 'of', previousPageButtonProps, nextPageButtonProps, selectorProps, MenuProps, onPageChange, ...rest } = useThemeProps({
51
35
  props: inProps,
52
- name: 'TablePagination',
36
+ name: 'TablePagination'
53
37
  });
54
38
  const mergedSelectMenuProps = combineProps({
55
- PopperProps: { matchAnchorWidth: false },
56
- classes: { paper: 'min-w-16' },
39
+ PopperProps: {
40
+ matchAnchorWidth: false
41
+ },
42
+ classes: {
43
+ paper: 'min-w-16'
44
+ }
57
45
  }, MenuProps);
58
46
  const rootProps = {
59
- ...rest,
47
+ ...rest
60
48
  };
61
49
  if (Root === 'td') {
62
50
  rootProps.colSpan = colSpan;
@@ -73,44 +61,130 @@ const TablePagination = forwardRef((inProps, ref) => {
73
61
  endOfRange = totalPages;
74
62
  showRowRange = false;
75
63
  total = totalPages;
76
- }
77
- else {
64
+ } else {
78
65
  endOfRange = page * rowsPerPage + rowsPerPage;
79
- if (endOfRange > count)
80
- endOfRange = count;
66
+ if (endOfRange > count) endOfRange = count;
81
67
  }
82
- const handlePreviousPageButtonClick = useEventCallback((e) => {
83
- if (!hasPreviousPage)
84
- return;
68
+ const handlePreviousPageButtonClick = useEventCallback((e)=>{
69
+ if (!hasPreviousPage) return;
85
70
  onPageChange?.(e, page - 1);
86
71
  });
87
- const handleNextPageButtonClick = useEventCallback((e) => {
88
- if (!hasNextPage)
89
- return;
72
+ const handleNextPageButtonClick = useEventCallback((e)=>{
73
+ if (!hasNextPage) return;
90
74
  onPageChange?.(e, page + 1);
91
75
  });
92
- const handleSelectPageChange = useEventCallback((e) => {
76
+ const handleSelectPageChange = useEventCallback((e)=>{
93
77
  onPageChange?.(e, parseInt(e.target.value, 10));
94
78
  });
95
- const handleRowsPerPageChange = useEventCallback((e, child) => {
79
+ const handleRowsPerPageChange = useEventCallback((e, child)=>{
96
80
  onPageChange?.(e, 0);
97
81
  onRowsPerPageChange?.(e, child);
98
82
  });
99
- return (jsx(Root, { className: cls('root'), ...rootProps, ref: ref, children: jsxs("div", { className: cls('content'), children: [variant === 'page-size' && (jsxs("div", { className: cls('rows-per-page-controls'), children: [jsx("span", { className: cls('rows-per-page-label'), children: rowsPerPageLabel }), jsx(Select, { value: rowsPerPage, variant: "outlined", size: "medium", classes: {
100
- selector: cls('selector'),
101
- }, selectorProps: selectorProps, MenuProps: mergedSelectMenuProps, onChange: handleRowsPerPageChange, children: rowsPerPageOptions?.map((option) => (jsx(Option, { value: option, children: jsx(MenuItemText, { children: option }) }, option))) })] })), jsxs("div", { className: cls('range-container'), children: [variant === 'select-page' && (jsx(Select, { value: page, variant: "outlined", size: "medium", classes: {
83
+ return /*#__PURE__*/ jsx(Root, {
84
+ className: cls('root'),
85
+ ...rootProps,
86
+ ref: ref,
87
+ children: /*#__PURE__*/ jsxs("div", {
88
+ className: cls('content'),
89
+ children: [
90
+ variant === 'page-size' && /*#__PURE__*/ jsxs("div", {
91
+ className: cls('rows-per-page-controls'),
92
+ children: [
93
+ /*#__PURE__*/ jsx("span", {
94
+ className: cls('rows-per-page-label'),
95
+ children: rowsPerPageLabel
96
+ }),
97
+ /*#__PURE__*/ jsx(Select_Select, {
98
+ value: rowsPerPage,
99
+ variant: "outlined",
100
+ size: "medium",
101
+ classes: {
102
+ selector: cls('selector')
103
+ },
104
+ selectorProps: selectorProps,
105
+ MenuProps: mergedSelectMenuProps,
106
+ onChange: handleRowsPerPageChange,
107
+ children: rowsPerPageOptions?.map((option)=>/*#__PURE__*/ jsx(Option, {
108
+ value: option,
109
+ children: /*#__PURE__*/ jsx(MenuItemText_MenuItemText, {
110
+ children: option
111
+ })
112
+ }, option))
113
+ })
114
+ ]
115
+ }),
116
+ /*#__PURE__*/ jsxs("div", {
117
+ className: cls('range-container'),
118
+ children: [
119
+ variant === 'select-page' && /*#__PURE__*/ jsx(Select_Select, {
120
+ value: page,
121
+ variant: "outlined",
122
+ size: "medium",
123
+ classes: {
102
124
  content: 'mr-0.5',
103
- selector: cls('selector'),
104
- }, selectorProps: selectorProps, MenuProps: mergedSelectMenuProps, renderValue: (value) => value + 1, onChange: handleSelectPageChange, children: Array(totalPages)
105
- .fill(totalPages)
106
- .map((_, i) => (jsx(Option, { value: i, children: jsx(MenuItemText, { children: i + 1 }) }, i))) })), showRowRange && jsx("span", { children: `${startOfRange}-${endOfRange}` }), jsx("span", { children: rangeSeparatorLabel }), jsx("span", { children: total })] }), jsxs("div", { className: cls('current-page-controls'), children: [jsx(IconButton, { shape: "squircle", color: "secondary", variant: "contained", size: "small", symbol: CaretLeftMd, background: false, disabled: !hasPreviousPage, ...combineProps({
125
+ selector: cls('selector')
126
+ },
127
+ selectorProps: selectorProps,
128
+ MenuProps: mergedSelectMenuProps,
129
+ renderValue: (value)=>value + 1,
130
+ onChange: handleSelectPageChange,
131
+ children: Array(totalPages).fill(totalPages).map((_, i)=>/*#__PURE__*/ jsx(Option, {
132
+ value: i,
133
+ children: /*#__PURE__*/ jsx(MenuItemText_MenuItemText, {
134
+ children: i + 1
135
+ })
136
+ }, i))
137
+ }),
138
+ showRowRange && /*#__PURE__*/ jsx("span", {
139
+ children: `${startOfRange}-${endOfRange}`
140
+ }),
141
+ /*#__PURE__*/ jsx("span", {
142
+ children: rangeSeparatorLabel
143
+ }),
144
+ /*#__PURE__*/ jsx("span", {
145
+ children: total
146
+ })
147
+ ]
148
+ }),
149
+ /*#__PURE__*/ jsxs("div", {
150
+ className: cls('current-page-controls'),
151
+ children: [
152
+ /*#__PURE__*/ jsx(IconButton_IconButton, {
153
+ shape: "squircle",
154
+ color: "secondary",
155
+ variant: "contained",
156
+ size: "small",
157
+ symbol: CaretLeftMd,
158
+ background: false,
159
+ disabled: !hasPreviousPage,
160
+ ...combineProps({
107
161
  onClick: handlePreviousPageButtonClick,
108
- 'aria-label': 'Go to previous page',
109
- }, previousPageButtonProps) }), jsx(IconButton, { shape: "squircle", color: "secondary", variant: "contained", size: "small", symbol: CaretRightMd, background: false, disabled: !hasNextPage, ...combineProps({
162
+ 'aria-label': 'Go to previous page'
163
+ }, previousPageButtonProps)
164
+ }),
165
+ /*#__PURE__*/ jsx(IconButton_IconButton, {
166
+ shape: "squircle",
167
+ color: "secondary",
168
+ variant: "contained",
169
+ size: "small",
170
+ symbol: CaretRightMd,
171
+ background: false,
172
+ disabled: !hasNextPage,
173
+ ...combineProps({
110
174
  onClick: handleNextPageButtonClick,
111
- 'aria-label': 'Go to next page',
112
- }, nextPageButtonProps) })] })] }) }));
175
+ 'aria-label': 'Go to next page'
176
+ }, nextPageButtonProps)
177
+ })
178
+ ]
179
+ })
180
+ ]
181
+ })
182
+ });
113
183
  });
114
- TablePagination.displayName = 'SuiTablePagination';
184
+ TablePagination_TablePagination.displayName = 'SuiTablePagination';
185
+
186
+
187
+
188
+
115
189
 
116
- export { TablePagination, TablePagination$1 as tablePaginationStyles };
190
+ export { TablePagination as tablePaginationStyles, TablePagination_TablePagination as TablePagination };