@ringcentral/juno 2.1.2 → 2.3.1

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 (153) hide show
  1. package/README.md +1 -2
  2. package/components/Animations/Highlight/Highlight.d.ts +2 -2
  3. package/components/Badge/Badge.js +1 -1
  4. package/components/Chip/Chip.d.ts +21 -3
  5. package/components/Chip/Chip.js +1 -1
  6. package/components/Downshift/SuggestionList/utils/useSuggestionList.js +1 -2
  7. package/components/Downshift/utils/useDownshift.js +2 -3
  8. package/components/Downshift/utils/useDownshiftTag.js +1 -2
  9. package/components/Forms/Picker/DatePicker/DatePicker.js +10 -11
  10. package/components/Forms/Select/PlainSelect/PlainSelect.js +1 -2
  11. package/components/Forms/TextField/styles/ClearIconButton.d.ts +3 -6
  12. package/components/Forms/TextField/styles/ClearIconButton.js +16 -9
  13. package/components/Table/Table.d.ts +14 -0
  14. package/components/Table/Table.js +17 -0
  15. package/components/Table/TableBody/TableBody.d.ts +8 -0
  16. package/components/Table/TableBody/TableBody.js +14 -0
  17. package/components/Table/TableBody/index.d.ts +1 -0
  18. package/components/Table/TableBody/index.js +4 -0
  19. package/components/Table/TableCell/TableCell.d.ts +27 -0
  20. package/components/Table/TableCell/TableCell.js +39 -0
  21. package/components/Table/TableCell/index.d.ts +1 -0
  22. package/components/Table/TableCell/index.js +4 -0
  23. package/components/Table/TableCell/styles/TableCellStyle.d.ts +3 -0
  24. package/components/Table/TableCell/styles/TableCellStyle.js +16 -0
  25. package/components/Table/TableCell/styles/index.d.ts +1 -0
  26. package/components/Table/TableCell/styles/index.js +4 -0
  27. package/components/Table/TableCell/utils/TableCellUtils.d.ts +1 -0
  28. package/components/Table/TableCell/utils/TableCellUtils.js +4 -0
  29. package/components/Table/TableCell/utils/index.d.ts +1 -0
  30. package/components/Table/TableCell/utils/index.js +4 -0
  31. package/components/Table/TableContainer/TableContainer.d.ts +19 -0
  32. package/components/Table/TableContainer/TableContainer.js +22 -0
  33. package/components/Table/TableContainer/index.d.ts +1 -0
  34. package/components/Table/TableContainer/index.js +4 -0
  35. package/components/Table/TableContainer/styles/TableContainerStyle.d.ts +3 -0
  36. package/components/Table/TableContainer/styles/TableContainerStyle.js +13 -0
  37. package/components/Table/TableContainer/styles/index.d.ts +1 -0
  38. package/components/Table/TableContainer/styles/index.js +4 -0
  39. package/components/Table/TableHead/TableHead.d.ts +8 -0
  40. package/components/Table/TableHead/TableHead.js +14 -0
  41. package/components/Table/TableHead/index.d.ts +1 -0
  42. package/components/Table/TableHead/index.js +4 -0
  43. package/components/Table/TableRow/TableRow.d.ts +15 -0
  44. package/components/Table/TableRow/TableRow.js +20 -0
  45. package/components/Table/TableRow/index.d.ts +1 -0
  46. package/components/Table/TableRow/index.js +4 -0
  47. package/components/Table/TableRow/styles/TableRowStyle.d.ts +3 -0
  48. package/components/Table/TableRow/styles/TableRowStyle.js +9 -0
  49. package/components/Table/TableRow/styles/index.d.ts +1 -0
  50. package/components/Table/TableRow/styles/index.js +4 -0
  51. package/components/Table/TableRow/utils/TableRowUtils.d.ts +1 -0
  52. package/components/Table/TableRow/utils/TableRowUtils.js +4 -0
  53. package/components/Table/TableRow/utils/index.d.ts +1 -0
  54. package/components/Table/TableRow/utils/index.js +4 -0
  55. package/components/Table/context.d.ts +10 -0
  56. package/components/Table/context.js +4 -0
  57. package/components/Table/index.d.ts +8 -0
  58. package/components/Table/index.js +10 -0
  59. package/components/Table/types.d.ts +1 -0
  60. package/components/Table/types.js +2 -0
  61. package/components/Tables/TableHead.d.ts +1 -1
  62. package/components/Tables/TableHead.js +1 -3
  63. package/components/Tables/TableHeadCell.d.ts +1 -1
  64. package/components/Tables/TableHeadCell.js +1 -2
  65. package/components/Tabs/Tabs/MoreMenuTab/MoreMenuTab.d.ts +7 -3
  66. package/components/Tabs/Tabs/MoreMenuTab/MoreMenuTab.js +4 -4
  67. package/components/Tooltip/utils/useTooltipForceHide.js +24 -10
  68. package/components/index.d.ts +1 -1
  69. package/components/index.js +1 -1
  70. package/es6/README.md +1 -2
  71. package/es6/components/Badge/Badge.js +2 -2
  72. package/es6/components/Chip/Chip.js +2 -2
  73. package/es6/components/Downshift/SuggestionList/utils/useSuggestionList.js +1 -2
  74. package/es6/components/Downshift/utils/useDownshift.js +1 -2
  75. package/es6/components/Downshift/utils/useDownshiftTag.js +1 -2
  76. package/es6/components/Forms/Picker/DatePicker/DatePicker.js +1 -2
  77. package/es6/components/Forms/Select/PlainSelect/PlainSelect.js +1 -2
  78. package/es6/components/Forms/TextField/styles/ClearIconButton.js +16 -9
  79. package/es6/components/Table/Table.js +15 -0
  80. package/es6/components/Table/TableBody/TableBody.js +12 -0
  81. package/es6/components/Table/TableBody/index.js +1 -0
  82. package/es6/components/Table/TableCell/TableCell.js +37 -0
  83. package/es6/components/Table/TableCell/index.js +1 -0
  84. package/es6/components/Table/TableCell/styles/TableCellStyle.js +14 -0
  85. package/es6/components/Table/TableCell/styles/index.js +1 -0
  86. package/es6/components/Table/TableCell/utils/TableCellUtils.js +2 -0
  87. package/es6/components/Table/TableCell/utils/index.js +1 -0
  88. package/es6/components/Table/TableContainer/TableContainer.js +20 -0
  89. package/es6/components/Table/TableContainer/index.js +1 -0
  90. package/es6/components/Table/TableContainer/styles/TableContainerStyle.js +11 -0
  91. package/es6/components/Table/TableContainer/styles/index.js +1 -0
  92. package/es6/components/Table/TableHead/TableHead.js +12 -0
  93. package/es6/components/Table/TableHead/index.js +1 -0
  94. package/es6/components/Table/TableRow/TableRow.js +18 -0
  95. package/es6/components/Table/TableRow/index.js +1 -0
  96. package/es6/components/Table/TableRow/styles/TableRowStyle.js +7 -0
  97. package/es6/components/Table/TableRow/styles/index.js +1 -0
  98. package/es6/components/Table/TableRow/utils/TableRowUtils.js +2 -0
  99. package/es6/components/Table/TableRow/utils/index.js +1 -0
  100. package/es6/components/Table/context.js +2 -0
  101. package/es6/components/Table/index.js +7 -0
  102. package/es6/components/Table/types.js +0 -0
  103. package/es6/components/Tables/TableHead.js +1 -3
  104. package/es6/components/Tables/TableHeadCell.js +2 -3
  105. package/es6/components/Tabs/Tabs/MoreMenuTab/MoreMenuTab.js +5 -5
  106. package/es6/components/Tooltip/utils/useTooltipForceHide.js +25 -11
  107. package/es6/components/index.js +1 -1
  108. package/es6/foundation/hooks/index.js +2 -0
  109. package/es6/foundation/hooks/useControlled/index.js +1 -0
  110. package/es6/foundation/hooks/useControlled/useControlled.js +1 -0
  111. package/es6/foundation/hooks/useEventListener/useEventListener.js +8 -6
  112. package/es6/foundation/hooks/useGlobalListener/index.js +1 -0
  113. package/es6/foundation/hooks/useGlobalListener/useGlobalListener.js +130 -0
  114. package/es6/foundation/hooks/useHiddenTabindex/useHiddenTabindex.js +4 -3
  115. package/es6/foundation/hooks/useLongPress/useLongPress.js +2 -3
  116. package/es6/foundation/hooks/useOverflow/useOverflow.js +18 -15
  117. package/es6/foundation/hooks/useResizeObserver/useResizeObserver.js +4 -4
  118. package/es6/foundation/hooks/useTouchMouseEvent/useTouchMouseEvent.js +8 -5
  119. package/es6/foundation/utils/getRefElement.js +13 -0
  120. package/es6/foundation/utils/index.js +1 -0
  121. package/es6/foundation/utils/removeClassName.js +4 -3
  122. package/es6/foundation/utils/selectionHandler.js +7 -6
  123. package/foundation/hooks/index.d.ts +2 -0
  124. package/foundation/hooks/index.js +2 -0
  125. package/foundation/hooks/useControlled/index.d.ts +1 -0
  126. package/foundation/hooks/useControlled/index.js +4 -0
  127. package/foundation/hooks/useControlled/useControlled.d.ts +1 -0
  128. package/foundation/hooks/useControlled/useControlled.js +4 -0
  129. package/foundation/hooks/useEventListener/useEventListener.d.ts +2 -2
  130. package/foundation/hooks/useEventListener/useEventListener.js +8 -6
  131. package/foundation/hooks/useGlobalListener/index.d.ts +1 -0
  132. package/foundation/hooks/useGlobalListener/index.js +4 -0
  133. package/foundation/hooks/useGlobalListener/useGlobalListener.d.ts +108 -0
  134. package/foundation/hooks/useGlobalListener/useGlobalListener.js +133 -0
  135. package/foundation/hooks/useHiddenTabindex/useHiddenTabindex.d.ts +2 -2
  136. package/foundation/hooks/useHiddenTabindex/useHiddenTabindex.js +4 -3
  137. package/foundation/hooks/useLongPress/useLongPress.js +1 -2
  138. package/foundation/hooks/useOverflow/useOverflow.d.ts +2 -3
  139. package/foundation/hooks/useOverflow/useOverflow.js +18 -15
  140. package/foundation/hooks/useResizeObserver/useResizeObserver.d.ts +2 -3
  141. package/foundation/hooks/useResizeObserver/useResizeObserver.js +3 -3
  142. package/foundation/hooks/useTouchMouseEvent/useTouchMouseEvent.d.ts +5 -1
  143. package/foundation/hooks/useTouchMouseEvent/useTouchMouseEvent.js +8 -5
  144. package/foundation/theme/theme.type.d.ts +6 -3
  145. package/foundation/utils/getRefElement.d.ts +6 -0
  146. package/foundation/utils/getRefElement.js +15 -0
  147. package/foundation/utils/index.d.ts +1 -0
  148. package/foundation/utils/index.js +1 -0
  149. package/foundation/utils/removeClassName.d.ts +3 -3
  150. package/foundation/utils/removeClassName.js +4 -3
  151. package/foundation/utils/selectionHandler.d.ts +3 -3
  152. package/foundation/utils/selectionHandler.js +7 -6
  153. package/package.json +5 -5
@@ -3,7 +3,7 @@ import React, { forwardRef, useMemo, useRef, } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import MuiBadge from '@material-ui/core/Badge';
5
5
  import { capitalize } from '@material-ui/core/utils';
6
- import { combineProps, logInDev, styled, useChange, useForkRef, useThemeProps, } from '../../foundation';
6
+ import { combineClasses, combineProps, logInDev, styled, useChange, useForkRef, useThemeProps, } from '../../foundation';
7
7
  import { RcBox } from '../Box';
8
8
  import { RcPresence } from '../Presence';
9
9
  import { BadgeStyle } from './styles';
@@ -34,7 +34,7 @@ var _RcBadge = forwardRef(function (inProps, ref) {
34
34
  // eslint-disable-next-line react-hooks/rules-of-hooks
35
35
  useRoundBadgeOffset(innerRef);
36
36
  }
37
- var classes = useMemo(function () { return combineProps(RcBadgeClasses, classesProp); }, [classesProp]);
37
+ var classes = useMemo(function () { return combineClasses(RcBadgeClasses, classesProp); }, [classesProp]);
38
38
  var CustomDotBadge = useMemo(function () {
39
39
  return isDot
40
40
  ? forwardRef(function (_a, ref) {
@@ -3,7 +3,7 @@ import React, { forwardRef, useLayoutEffect, useMemo, useRef, } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import MuiChip from '@material-ui/core/Chip';
5
5
  import { DeleteCircle } from '@ringcentral/juno-icon';
6
- import { combineClasses, isRcElement, omit, removeClassName, styled, useForkRef, useThemeProps, } from '../../foundation';
6
+ import { combineClasses, isRcElement, omit, removeClassName, overridableStyled, useForkRef, useThemeProps, } from '../../foundation';
7
7
  import { RcIconButton } from '../Buttons/IconButton';
8
8
  import { ChipStyle } from './styles';
9
9
  import { RcChipClasses } from './utils';
@@ -46,7 +46,7 @@ var _RcChip = forwardRef(function (inProps, ref) {
46
46
  });
47
47
  return (React.createElement(MuiChip, __assign({ ref: chipRef, id: id, tabIndex: disabled ? -1 : tabIndex, label: label, disabled: disabled, classes: classes, className: clsx(className, focused ? combinedClasses.focused : undefined), avatar: avatar, deleteIcon: deleteIcon, "data-test-automation-class": "selected-item", "data-test-automation-value": id ? id : label, "data-is-error": error }, rest)));
48
48
  });
49
- var RcChip = styled(_RcChip)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), ChipStyle);
49
+ var RcChip = overridableStyled(_RcChip)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), ChipStyle);
50
50
  RcChip.defaultProps = {
51
51
  tabIndex: 0,
52
52
  // FIXME: after implement click state, that can be remove
@@ -1,7 +1,6 @@
1
1
  import { __assign, __read, __rest } from "tslib";
2
2
  import { useCallback, useEffect, useMemo, useRef, } from 'react';
3
- import { useControlled } from '@material-ui/core/utils';
4
- import { combineProps, useForceUpdate, useId, useKeyboardMoveFocus, } from '../../../../foundation';
3
+ import { combineProps, useForceUpdate, useControlled, useId, useKeyboardMoveFocus, } from '../../../../foundation';
5
4
  import { DEFAULT_GET_OPTION_LABEL, isItemCanSelected, } from '../../utils/DownshiftUtils';
6
5
  import { useDownshiftGroup } from '../../utils/useDownshiftGroup';
7
6
  var DEFAULT_HIGHLIGHTED_INDEX = -1;
@@ -1,7 +1,6 @@
1
1
  import { __assign, __awaiter, __generator, __read, __spread } from "tslib";
2
2
  import { useCallback, useLayoutEffect, useMemo, useRef, } from 'react';
3
- import { useControlled } from '@material-ui/core/utils';
4
- import { combineProps, getSelectionPosition, useChange, useId, useSleep, } from '../../../foundation';
3
+ import { combineProps, getSelectionPosition, useChange, useControlled, useId, useSleep, } from '../../../foundation';
5
4
  import { useSuggestionList } from '../SuggestionList/utils/useSuggestionList';
6
5
  import { DEFAULT_GET_OPTION_LABEL, DEFAULT_KEY_TO_CHIPS, downshiftComponentName, stringArrToRegExp, } from './DownshiftUtils';
7
6
  import { useDownshiftTag } from './useDownshiftTag';
@@ -2,8 +2,7 @@ import { __assign, __read, __rest, __spread } from "tslib";
2
2
  import { useMemo, useRef, useState } from 'react';
3
3
  import isString from 'lodash/isString';
4
4
  import uniqueId from 'lodash/uniqueId';
5
- import { useControlled } from '@material-ui/core/utils';
6
- import { combineProps, useEventCallback, useKeyboardMoveFocus, useRefState, } from '../../../foundation';
5
+ import { combineProps, useControlled, useEventCallback, useKeyboardMoveFocus, useRefState, } from '../../../foundation';
7
6
  import { DEFAULT_GET_OPTION_LABEL, downshiftComponentName, stringArrToRegExp, } from './DownshiftUtils';
8
7
  var DOWNSHIFT_ID_TOKEN = 'rc-chip-';
9
8
  /** @inner inner hook work with useDownshift */
@@ -2,11 +2,10 @@ import { __assign, __makeTemplateObject, __read, __rest } from "tslib";
2
2
  import React, { forwardRef, useCallback, useEffect, useMemo, useRef, } from 'react';
3
3
  import moment from 'moment';
4
4
  import MomentUtils from '@date-io/moment';
5
- import { useControlled } from '@material-ui/core/utils';
6
5
  import { MuiPickersUtilsProvider, useUtils as useMuiUtils, } from '@material-ui/pickers';
7
6
  import { findClosestEnabledDate as MuiFindClosestEnabledDate } from '@material-ui/pickers/_helpers/date-utils';
8
7
  import { DateBorder } from '@ringcentral/juno-icon';
9
- import { combineClasses, combineProps, omit, styled, useDeprecatedCheck, useEventCallback, useThemeProps, } from '../../../../foundation';
8
+ import { combineClasses, combineProps, omit, styled, useControlled, useDeprecatedCheck, useEventCallback, useThemeProps, } from '../../../../foundation';
10
9
  import { PickerTextField, } from '../utils';
11
10
  import { Calendar } from './Calendar';
12
11
  import { invalidateDateInRange, RcDatePickerClasses, ScreenReaderProvider, } from './utils';
@@ -1,7 +1,6 @@
1
1
  import { __assign, __makeTemplateObject, __read, __rest } from "tslib";
2
2
  import React, { forwardRef, useMemo, useState } from 'react';
3
- import { useControlled } from '@material-ui/core';
4
- import { combineProps, hasValue, logInDev, styled, } from '../../../../foundation';
3
+ import { combineProps, hasValue, logInDev, useControlled, styled, } from '../../../../foundation';
5
4
  import { RcButton } from '../../../Buttons';
6
5
  import { RcMenu } from '../../../Menu';
7
6
  import { RcVirtualizedMenu } from '../../../VirtualizedMenu';
@@ -3,14 +3,21 @@ import React, { forwardRef } from 'react';
3
3
  import { DeleteCircle } from '@ringcentral/juno-icon';
4
4
  import { styled } from '../../../../foundation';
5
5
  import { RcIconButton } from '../../../Buttons/IconButton';
6
+ import { RcBox } from '../../../Box';
7
+ import { withTooltip } from '../../../Tooltip';
8
+ var FakeButton = styled(RcIconButton)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n right: 0;\n pointer-events: none;\n"], ["\n position: absolute;\n right: 0;\n pointer-events: none;\n"])));
6
9
  var _ClearIconButton = forwardRef(function (_a, ref) {
7
- var onMouseDown = _a.onMouseDown, rest = __rest(_a, ["onMouseDown"]);
8
- return (React.createElement(RcIconButton, __assign({ ref: ref, type: "button", "aria-hidden": true, variant: "plain", symbol: DeleteCircle, tabIndex: -1,
9
- // * for prevent focus change
10
- onMouseDown: function (e) {
11
- e.preventDefault();
12
- onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e);
13
- } }, rest)));
10
+ var onMouseDown = _a.onMouseDown, size = _a.size, iconSize = _a.iconSize, rest = __rest(_a, ["onMouseDown", "size", "iconSize"]);
11
+ return (React.createElement(RcBox, { display: "flex", alignItems: "center", position: "relative" },
12
+ React.createElement(RcIconButton, __assign({ type: "button", "aria-hidden": true, variant: "plain", symbol: DeleteCircle, tabIndex: -1,
13
+ // * for prevent focus change
14
+ onMouseDown: function (e) {
15
+ e.preventDefault();
16
+ onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e);
17
+ }, size: size }, rest, { useRcTooltip: false })),
18
+ React.createElement(FakeButton, { variant: "plain", as: "div", size: size, ref: ref })));
14
19
  });
15
- export var ClearIconButton = styled(_ClearIconButton)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
16
- var templateObject_1;
20
+ // TODO: fix this after upgarde ts
21
+ export var ClearIconButton = styled(withTooltip(_ClearIconButton))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n position: relative;\n"], ["\n display: flex;\n align-items: center;\n position: relative;\n"])));
22
+ ClearIconButton.defaultProps = { useRcTooltip: true };
23
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,15 @@
1
+ import { __assign, __makeTemplateObject, __rest } from "tslib";
2
+ import MuiTable from '@material-ui/core/Table';
3
+ import { styled, useThemeProps } from '../../foundation';
4
+ import React, { forwardRef, useMemo } from 'react';
5
+ import { RcTableContext } from './context';
6
+ var _RcTable = forwardRef(function (props, ref) {
7
+ var _a = useThemeProps({ props: props, name: 'RcTable' }), children = _a.children, size = _a.size, rest = __rest(_a, ["children", "size"]);
8
+ var tableContextValue = useMemo(function () { return ({ size: size }); }, [size]);
9
+ return (React.createElement(MuiTable, __assign({}, rest, { ref: ref }),
10
+ React.createElement(RcTableContext.Provider, { value: tableContextValue }, children)));
11
+ });
12
+ var RcTable = styled(_RcTable)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
13
+ RcTable.displayName = 'RcTable';
14
+ export { RcTable };
15
+ var templateObject_1;
@@ -0,0 +1,12 @@
1
+ import { __assign, __makeTemplateObject, __rest } from "tslib";
2
+ import MuiTableBody from '@material-ui/core/TableBody';
3
+ import React, { forwardRef } from 'react';
4
+ import { styled, useThemeProps } from '../../../foundation';
5
+ var _RcTableBody = forwardRef(function (props, ref) {
6
+ var _a = useThemeProps({ props: props, name: 'RcTableHead' }), children = _a.children, rest = __rest(_a, ["children"]);
7
+ return (React.createElement(MuiTableBody, __assign({}, rest, { ref: ref }), children));
8
+ });
9
+ var RcTableBody = styled(_RcTableBody)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
10
+ RcTableBody.displayName = 'RcTableBody';
11
+ export { RcTableBody };
12
+ var templateObject_1;
@@ -0,0 +1 @@
1
+ export * from './TableBody';
@@ -0,0 +1,37 @@
1
+ import { __assign, __makeTemplateObject, __rest } from "tslib";
2
+ import React, { forwardRef, useMemo, useContext } from 'react';
3
+ import MuiTableCell from '@material-ui/core/TableCell';
4
+ import { combineClasses, styled, useThemeProps, } from '../../../foundation';
5
+ import { TableCellStyle } from './styles';
6
+ import { RcTableCellClasses } from './utils';
7
+ import { RcButtonBase } from '../../Buttons';
8
+ import { RcIcon } from '../../Icon';
9
+ import { JumpToLatest as AscSortIcon, JumpToUnread as DescSortIcon, } from '@ringcentral/juno-icon';
10
+ import clsx from 'clsx';
11
+ import { RcTableContext } from '../context';
12
+ var _RcTableCell = forwardRef(function (props, ref) {
13
+ var _a = useThemeProps({ props: props, name: 'RcTableCell' }), classesProp = _a.classes, childrenProp = _a.children, size = _a.size, sortDirection = _a.sortDirection, _b = _a.activeSort, activeSort = _b === void 0 ? false : _b, rest = __rest(_a, ["classes", "children", "size", "sortDirection", "activeSort"]);
14
+ var classes = combineClasses(RcTableCellClasses, classesProp);
15
+ var children = useMemo(function () {
16
+ var _a;
17
+ if (sortDirection) {
18
+ return (React.createElement(RcButtonBase, { disableRipple: true, className: clsx(classes.sortButton, (_a = {},
19
+ _a[classes.activeSort] = activeSort,
20
+ _a)) },
21
+ childrenProp,
22
+ React.createElement(RcIcon, { size: "small", className: classes.sortIcon, symbol: sortDirection === 'asc' ? DescSortIcon : AscSortIcon })));
23
+ }
24
+ return childrenProp;
25
+ }, [activeSort, childrenProp, classes, sortDirection]);
26
+ return (React.createElement(MuiTableCell, __assign({}, rest, (sortDirection ? { sortDirection: sortDirection } : {}), { ref: ref, classes: classes }), children));
27
+ });
28
+ var RcTableCell = styled(_RcTableCell).attrs(function (_a) {
29
+ var _b;
30
+ var sizeProp = _a.size, _c = _a.sortDirection, sortDirection = _c === void 0 ? false : _c, rest = __rest(_a, ["size", "sortDirection"]);
31
+ var contextSize = useContext(RcTableContext).size;
32
+ var size = (_b = sizeProp !== null && sizeProp !== void 0 ? sizeProp : contextSize) !== null && _b !== void 0 ? _b : 'medium';
33
+ return __assign(__assign({}, rest), { size: size, sortDirection: sortDirection });
34
+ })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), TableCellStyle);
35
+ RcTableCell.displayName = 'RcTableCell';
36
+ export { RcTableCell };
37
+ var templateObject_1;
@@ -0,0 +1 @@
1
+ export * from './TableCell';
@@ -0,0 +1,14 @@
1
+ import { __makeTemplateObject } from "tslib";
2
+ import { css, fakeBorder, focusVisible, palette2, px, spacing, typography, } from '../../../../foundation';
3
+ import { RcIcon } from '../../../Icon';
4
+ import { RcTableCellClasses } from '../utils';
5
+ var SizeMap = {
6
+ large: 56,
7
+ medium: 48,
8
+ small: 40,
9
+ };
10
+ export var TableCellStyle = function (prop) {
11
+ var size = prop.size, sortDirection = prop.sortDirection;
12
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-sizing: border-box;\n padding: ", ";\n min-width: 96px;\n\n &.", " {\n ", "\n height: 40px;\n border-bottom: 1px solid ", ";\n color: ", ";\n background-color: ", ";\n\n padding: ", ";\n\n .", " {\n opacity: 0;\n padding: ", ";\n }\n\n .", " {\n color: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n\n .", " {\n display: inline-flex;\n justify-content: flex-start;\n flex-direction: inherit;\n align-items: center;\n\n height: 100%;\n width: 100%;\n padding: ", ";\n\n ", " {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n\n ", " {\n ", "\n background-color: ", ";\n }\n }\n }\n\n &.", " {\n ", "\n color: ", ";\n\n padding: ", ";\n height: ", ";\n }\n "], ["\n box-sizing: border-box;\n padding: ", ";\n min-width: 96px;\n\n &.", " {\n ", "\n height: 40px;\n border-bottom: 1px solid ", ";\n color: ", ";\n background-color: ", ";\n\n padding: ", ";\n\n .", " {\n opacity: 0;\n padding: ", ";\n }\n\n .", " {\n color: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n\n .", " {\n display: inline-flex;\n justify-content: flex-start;\n flex-direction: inherit;\n align-items: center;\n\n height: 100%;\n width: 100%;\n padding: ", ";\n\n ", " {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n\n ", " {\n ", "\n background-color: ", ";\n }\n }\n }\n\n &.", " {\n ", "\n color: ", ";\n\n padding: ", ";\n height: ", ";\n }\n "])), spacing(0, 2), RcTableCellClasses.head, typography('caption2'), palette2('neutral', 'l02'), palette2('neutral', 'f05'), palette2('neutral', 'b02'), Boolean(sortDirection) && 'unset', RcTableCellClasses.sortIcon, spacing(0, 2), RcTableCellClasses.activeSort, palette2('interactive', 'f01'), RcTableCellClasses.sortIcon, RcTableCellClasses.sortButton, spacing(0, 2), RcIcon, palette2('neutral', 'f04'), palette2('neutral', 'b03'), RcTableCellClasses.sortIcon, focusVisible, fakeBorder({ color: palette2('interactive', 'f01') }), palette2('neutral', 'b03'), RcTableCellClasses.body, typography('body1'), palette2('neutral', 'f06'), size === 'auto' && spacing(3, 2), size !== 'auto' && px(SizeMap[size]));
13
+ };
14
+ var templateObject_1;
@@ -0,0 +1 @@
1
+ export * from './TableCellStyle';
@@ -0,0 +1,2 @@
1
+ import { RcClasses } from '../../../../foundation';
2
+ export var RcTableCellClasses = RcClasses(['head', 'body', 'sortIcon', 'activeSort', 'sortButton'], 'RcTableCell');
@@ -0,0 +1 @@
1
+ export * from './TableCellUtils';
@@ -0,0 +1,20 @@
1
+ import { __assign, __makeTemplateObject, __rest } from "tslib";
2
+ import MuiTableContainer from '@material-ui/core/TableContainer';
3
+ import React, { forwardRef } from 'react';
4
+ import { styled, useThemeProps } from '../../../foundation';
5
+ import { TableContainerStyle } from './styles';
6
+ var _RcTableContainer = forwardRef(function (props, ref) {
7
+ var _a = useThemeProps({
8
+ props: props,
9
+ name: 'RcTableContainer',
10
+ }), children = _a.children, bordered = _a.bordered, rest = __rest(_a, ["children", "bordered"]);
11
+ return (React.createElement(MuiTableContainer, __assign({}, rest, { ref: ref }), children));
12
+ });
13
+ var RcTableContainer = styled(_RcTableContainer)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), TableContainerStyle);
14
+ RcTableContainer.defaultProps = {
15
+ bordered: false,
16
+ square: false,
17
+ };
18
+ RcTableContainer.displayName = 'RcTableContainer';
19
+ export { RcTableContainer };
20
+ var templateObject_1;
@@ -0,0 +1 @@
1
+ export * from './TableContainer';
@@ -0,0 +1,11 @@
1
+ import { __makeTemplateObject } from "tslib";
2
+ import { css, palette2, px } from '../../../../foundation';
3
+ import { RcTableBody } from '../../TableBody';
4
+ import { RcTableCell } from '../../TableCell';
5
+ import { RcTableRow } from '../../TableRow';
6
+ export var TableContainerStyle = function (props) {
7
+ var bordered = props.bordered, square = props.square;
8
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n "], ["\n ",
9
+ "\n "])), bordered && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-radius: ", ";\n border: 1px solid ", ";\n\n ", " ", ":last-child ", " {\n border: none;\n }\n "], ["\n border-radius: ", ";\n border: 1px solid ", ";\n\n ", " ", ":last-child ", " {\n border: none;\n }\n "])), !square && px(4), palette2('neutral', 'l02'), RcTableBody, RcTableRow, RcTableCell));
10
+ };
11
+ var templateObject_1, templateObject_2;
@@ -0,0 +1 @@
1
+ export * from './TableContainerStyle';
@@ -0,0 +1,12 @@
1
+ import { __assign, __makeTemplateObject, __rest } from "tslib";
2
+ import MuiTableHead from '@material-ui/core/TableHead';
3
+ import React, { forwardRef } from 'react';
4
+ import { styled, useThemeProps } from '../../../foundation';
5
+ var _RcTableHead = forwardRef(function (props, ref) {
6
+ var _a = useThemeProps({ props: props, name: 'RcTableHead' }), children = _a.children, rest = __rest(_a, ["children"]);
7
+ return (React.createElement(MuiTableHead, __assign({}, rest, { ref: ref }), children));
8
+ });
9
+ var RcTableHead = styled(_RcTableHead)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
10
+ RcTableHead.displayName = 'RcTableHead';
11
+ export { RcTableHead };
12
+ var templateObject_1;
@@ -0,0 +1 @@
1
+ export * from './TableHead';
@@ -0,0 +1,18 @@
1
+ import { __assign, __makeTemplateObject, __rest } from "tslib";
2
+ import React, { forwardRef, useMemo } from 'react';
3
+ import MuiTableRow from '@material-ui/core/TableRow';
4
+ import { combineClasses, styled, useThemeProps, } from '../../../foundation';
5
+ import { TableRowStyle } from './styles';
6
+ import { RcTableRowClasses } from './utils';
7
+ import clsx from 'clsx';
8
+ var _RcTableRow = forwardRef(function (props, ref) {
9
+ var _a;
10
+ var _b = useThemeProps({ props: props, name: 'RcTableRow' }), className = _b.className, classesProp = _b.classes, children = _b.children, disabled = _b.disabled, rest = __rest(_b, ["className", "classes", "children", "disabled"]);
11
+ var classes = useMemo(function () { return combineClasses(RcTableRowClasses, classesProp); }, [classesProp]);
12
+ return (React.createElement(MuiTableRow, __assign({}, rest, { ref: ref, classes: classes, className: clsx(className, (_a = {}, _a[RcTableRowClasses.disabled] = disabled, _a)) }), children));
13
+ });
14
+ var RcTableRow = styled(_RcTableRow)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), TableRowStyle);
15
+ RcTableRow.defaultProps = {};
16
+ RcTableRow.displayName = 'RcTableRow';
17
+ export { RcTableRow };
18
+ var templateObject_1;
@@ -0,0 +1 @@
1
+ export * from './TableRow';
@@ -0,0 +1,7 @@
1
+ import { __makeTemplateObject } from "tslib";
2
+ import { css, nonTouchHoverMedia, palette2, setOpacity, } from '../../../../foundation';
3
+ import { RcTableRowClasses } from '../utils';
4
+ export var TableRowStyle = function () {
5
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", " {\n &.", ", &:hover {\n background-color: ", ";\n }\n }\n\n &.", " {\n &,\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", " {\n &.", ", &.", ", &:hover {\n background-color: unset;\n }\n }\n "], ["\n ", " {\n &.", ", &:hover {\n background-color: ", ";\n }\n }\n\n &.", " {\n &,\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", " {\n &.", ", &.", ", &:hover {\n background-color: unset;\n }\n }\n "])), nonTouchHoverMedia, RcTableRowClasses.hover, setOpacity(palette2('action', 'grayLight'), '08'), RcTableRowClasses.selected, setOpacity(palette2('interactive', 'f01'), '08'), RcTableRowClasses.disabled, RcTableRowClasses.selected, RcTableRowClasses.hover);
6
+ };
7
+ var templateObject_1;
@@ -0,0 +1 @@
1
+ export * from './TableRowStyle';
@@ -0,0 +1,2 @@
1
+ import { RcClasses } from '../../../../foundation';
2
+ export var RcTableRowClasses = RcClasses(['selected', 'hover', 'disabled'], 'RcTableRow');
@@ -0,0 +1 @@
1
+ export * from './TableRowUtils';
@@ -0,0 +1,2 @@
1
+ import { createContext } from 'react';
2
+ export var RcTableContext = createContext({});
@@ -0,0 +1,7 @@
1
+ export * from './Table';
2
+ export * from './TableBody';
3
+ export * from './TableCell';
4
+ export * from './TableContainer';
5
+ export * from './TableHead';
6
+ export * from './TableRow';
7
+ export * from './context';
File without changes
@@ -1,10 +1,8 @@
1
1
  import React from 'react';
2
- import { useThemeProps } from '../../foundation';
3
2
  import { StyledTableRow } from './styled';
4
3
  import { RcTableHeadCell } from './TableHeadCell';
5
4
  import { ORDER_TABLE_BY } from './types';
6
- var RcTableHeadView = function (inProps) {
7
- var props = useThemeProps({ props: inProps, name: 'RcTableHeadView' });
5
+ var RcTableHeadView = function (props) {
8
6
  var columnData = props.columnData, sortMap = props.sortMap, sortHandler = props.sortHandler;
9
7
  return (React.createElement("thead", null,
10
8
  React.createElement(StyledTableRow, null, columnData.map(function (column) {
@@ -3,12 +3,11 @@ import React, { useMemo } from 'react';
3
3
  import isFunction from 'lodash/isFunction';
4
4
  import isNumber from 'lodash/isNumber';
5
5
  import { JumpToLatest as arrowDown, JumpToUnread as arrowUp, } from '@ringcentral/juno-icon';
6
- import { useA11yKeyEvent, useThemeProps } from '../../foundation';
6
+ import { useA11yKeyEvent } from '../../foundation';
7
7
  import { RcIcon } from '../Icon';
8
8
  import { StyledSortIconWrapper, StyledTableHeadCell, StyledTableHeadCellContent, StyledTableHeadText, } from './styled';
9
9
  import { ARIA_SORT_VALUES, ORDER_TABLE_BY, SORT_ICON_CLASS, } from './types';
10
- var RcTableHeadCell = function (inProps) {
11
- var props = useThemeProps({ props: inProps, name: 'RcTableHeadCell' });
10
+ var RcTableHeadCell = function (props) {
12
11
  var automationID = props.automationID, title = props.title, width = props.width, sortDirection = props.sortDirection, sortKey = props.sortKey, textAlign = props.textAlign;
13
12
  var onClick = function () {
14
13
  var sortHandler = props.sortHandler, sortKey = props.sortKey, sortDirection = props.sortDirection;
@@ -4,17 +4,17 @@ import { MoreHoriz as MoreHorizIcon } from '@ringcentral/juno-icon';
4
4
  import { styled, useEventCallback, useId, } from '../../../../foundation';
5
5
  import { RcIcon } from '../../../Icon';
6
6
  import { RcListItemIcon, RcListItemText } from '../../../List';
7
- import { RcMenu, RcMenuItem } from '../../../Menu';
7
+ import { RcMenu, RcMenuItem, } from '../../../Menu';
8
8
  import { RcTooltip } from '../../../Tooltip';
9
9
  import { RcTab } from '../../Tab';
10
10
  import { getKey } from '../MoreMenuTabs/utils';
11
11
  import { MoreMenuTabStyle } from './styles';
12
12
  var DEFAULT_MORE_MENU_TAB_LABEL = 'more_menu_tab';
13
13
  var _MoreMenuTab = forwardRef(function (props, ref) {
14
- var menuItems = props.menuItems, _a = props.MenuProps, MenuProps = _a === void 0 ? {} : _a, TooltipProps = props.TooltipProps, onChange = props.onChange, MoreIconProp = props.MoreIcon, rest = __rest(props, ["menuItems", "MenuProps", "TooltipProps", "onChange", "MoreIcon"]);
14
+ var menuItems = props.menuItems, _a = props.MenuItemComponent, MenuItemComponent = _a === void 0 ? RcMenuItem : _a, _b = props.MenuProps, MenuProps = _b === void 0 ? {} : _b, TooltipProps = props.TooltipProps, onChange = props.onChange, MoreIconProp = props.MoreIcon, rest = __rest(props, ["menuItems", "MenuItemComponent", "MenuProps", "TooltipProps", "onChange", "MoreIcon"]);
15
15
  var menuIdProp = MenuProps.id, onMenuCloseProp = MenuProps.onClose, MenuPropsRest = __rest(MenuProps, ["id", "onClose"]);
16
16
  var menuId = useId(menuIdProp);
17
- var _b = __read(useState(null), 2), anchorEl = _b[0], setAnchorEl = _b[1];
17
+ var _c = __read(useState(null), 2), anchorEl = _c[0], setAnchorEl = _c[1];
18
18
  var MoreIcon = useMemo(function () {
19
19
  var Icon = MoreIconProp || (React.createElement(RcIcon, { size: "medium", color: "neutral.f04", symbol: MoreHorizIcon }));
20
20
  if (TooltipProps === null || TooltipProps === void 0 ? void 0 : TooltipProps.title) {
@@ -39,11 +39,11 @@ var _MoreMenuTab = forwardRef(function (props, ref) {
39
39
  onChange === null || onChange === void 0 ? void 0 : onChange(event, value);
40
40
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
41
41
  };
42
- return (React.createElement(RcMenuItem, { key: getKey(menuItemRest.key, idx), disabled: disabled, selected: selected, value: value, onClick: handleClick, "data-test-automation-id": menuItemRest['data-test-automation-id'] },
42
+ return (React.createElement(MenuItemComponent, { key: getKey(menuItemRest.key, idx), disabled: disabled, selected: selected, value: value, onClick: handleClick, "data-test-automation-id": menuItemRest['data-test-automation-id'] },
43
43
  icon ? React.createElement(RcListItemIcon, null, icon) : null,
44
44
  React.createElement(RcListItemText, { primary: label || value })));
45
45
  });
46
- }, [menuItems, onChange]);
46
+ }, [MenuItemComponent, menuItems, onChange]);
47
47
  return (React.createElement(React.Fragment, null,
48
48
  React.createElement(RcTab, __assign({}, rest, { ref: ref, onClick: handleTabClick, label: MoreIcon, value: DEFAULT_MORE_MENU_TAB_LABEL, "aria-haspopup": "true", "aria-controls": menuId })),
49
49
  React.createElement(RcMenu, __assign({ autoClose: true }, MenuPropsRest, { id: menuId, anchorEl: anchorEl, open: Boolean(anchorEl), variant: "menu", onClose: handleMenuClose }), MenuList)));
@@ -1,8 +1,24 @@
1
1
  import { __read } from "tslib";
2
+ /* eslint-disable react-hooks/rules-of-hooks */
2
3
  import { useRef } from 'react';
3
- import { useChange, useEventCallback, useEventListener, usePrevious, useRefState, } from '../../../foundation';
4
+ import { logInDev, useChange, useEventCallback, useEventListener, usePrevious, useRefState, } from '../../../foundation';
4
5
  export var useTooltipForceHide = function (_a) {
5
6
  var tooltipForceHide = _a.tooltipForceHide, openProp = _a.open, onClose = _a.onClose, onOpen = _a.onOpen, ref = _a.ref;
7
+ if (process.env.NODE_ENV !== 'production') {
8
+ useChange(function (prev) {
9
+ // ignore first time
10
+ if (prev !== undefined) {
11
+ logInDev({
12
+ component: 'RcTooltip',
13
+ message: 'Should not change tooltipForceHide between controlled and uncontrolled, tooltipForceHide should always be boolean value',
14
+ level: 'error',
15
+ });
16
+ }
17
+ }, function () { return tooltipForceHide === undefined; });
18
+ }
19
+ // * when not set tooltipForceHide, always return undefined directly, not bind any event addition
20
+ if (tooltipForceHide === undefined)
21
+ return undefined;
6
22
  var _b = __read(useRefState(false), 2), openRef = _b[0], setOpen = _b[1];
7
23
  var isOverRef = useRef(false);
8
24
  var openState = tooltipForceHide ? false : openProp !== null && openProp !== void 0 ? openProp : openRef.current;
@@ -35,14 +51,12 @@ export var useTooltipForceHide = function (_a) {
35
51
  setOpen(false);
36
52
  onClose === null || onClose === void 0 ? void 0 : onClose(event);
37
53
  });
38
- return tooltipForceHide !== undefined
39
- ? {
40
- disableFocusListener: tooltipForceHide,
41
- disableHoverListener: tooltipForceHide,
42
- disableTouchListener: tooltipForceHide,
43
- open: openState,
44
- onOpen: handleOpen,
45
- onClose: handleClose,
46
- }
47
- : undefined;
54
+ return {
55
+ disableFocusListener: tooltipForceHide,
56
+ disableHoverListener: tooltipForceHide,
57
+ disableTouchListener: tooltipForceHide,
58
+ open: openState,
59
+ onOpen: handleOpen,
60
+ onClose: handleClose,
61
+ };
48
62
  };
@@ -41,7 +41,7 @@ export * from './Responsive';
41
41
  export * from './Snackbar';
42
42
  export * from './Stepper';
43
43
  export * from './TablePagination';
44
- export * from './Tables';
44
+ export * from './Table';
45
45
  export * from './Tabs';
46
46
  export * from './Tag';
47
47
  export * from './Text';
@@ -2,12 +2,14 @@ export * from './useA11yKeyEvent';
2
2
  export * from './useAnnouncer';
3
3
  export * from './useAudio';
4
4
  export * from './useChange';
5
+ export * from './useControlled';
5
6
  export * from './useDebounce';
6
7
  export * from './useEventCallback';
7
8
  export * from './useEventListener';
8
9
  export * from './useEver';
9
10
  export * from './useForceUpdate';
10
11
  export * from './useForkRef';
12
+ export * from './useGlobalListener';
11
13
  export * from './useHiddenTabindex';
12
14
  export * from './useId';
13
15
  export * from './useInterval';
@@ -0,0 +1 @@
1
+ export * from './useControlled';
@@ -0,0 +1 @@
1
+ export { useControlled } from '@material-ui/core/utils';
@@ -1,6 +1,6 @@
1
1
  import { __read } from "tslib";
2
2
  import { useEffect, useRef } from 'react';
3
- import { isRef } from '../../utils/isRef';
3
+ import { getRefElement } from '../../utils';
4
4
  import { useEventCallback } from '../useEventCallback';
5
5
  /**
6
6
  * bind event when component mount and auto remove event when destroy.
@@ -26,16 +26,18 @@ export function useEventListener(target) {
26
26
  var listener = useEventCallback(cb);
27
27
  var cancelRef = useRef(function () { });
28
28
  var bindRef = useRef(function () { });
29
- var currentRefElm = isRef(target) && target.current;
29
+ var currentRefElm = getRefElement(target);
30
30
  useEffect(function () {
31
31
  if (!target)
32
32
  return;
33
- var elm = isRef(target) ? target.current : target;
34
- if (!elm) {
33
+ var currentElm = getRefElement(target);
34
+ if (!currentElm) {
35
35
  return cancelRef.current;
36
36
  }
37
- bindRef.current = function () { return elm.addEventListener(key, listener, options); };
38
- cancelRef.current = function () { return elm.removeEventListener(key, listener, options); };
37
+ bindRef.current = function () { return currentElm.addEventListener(key, listener, options); };
38
+ cancelRef.current = function () {
39
+ return currentElm.removeEventListener(key, listener, options);
40
+ };
39
41
  bindRef.current();
40
42
  return cancelRef.current;
41
43
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -0,0 +1 @@
1
+ export * from './useGlobalListener';