@ringcentral/juno 2.0.0-rc.0 → 2.0.3-beta.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 (95) hide show
  1. package/README.md +3 -2
  2. package/components/Avatar/Avatar.js +36 -32
  3. package/components/Buttons/Button/Button.js +11 -7
  4. package/components/Buttons/IconButton/IconButton.js +5 -3
  5. package/components/Buttons/SplitButton/SplitButton.js +2 -1
  6. package/components/DetachedWindow/DetachedWindow.d.ts +1 -7
  7. package/components/DetachedWindow/DetachedWindow.js +8 -6
  8. package/components/Dialer/DialPad/utils/useKeyAudio.js +4 -4
  9. package/components/Dialog/Dialog.js +11 -7
  10. package/components/Downshift/Downshift.js +116 -109
  11. package/components/Downshift/SuggestionList/SuggestionList.d.ts +7 -1
  12. package/components/Downshift/SuggestionList/SuggestionList.js +13 -5
  13. package/components/Downshift/utils/useDownshiftError.js +2 -1
  14. package/components/Forms/Checkbox/Checkbox.js +11 -7
  15. package/components/Forms/Picker/DatePicker/DatePicker.js +21 -17
  16. package/components/Forms/TextField/TextField.js +26 -22
  17. package/components/Icon/Icon.js +41 -37
  18. package/components/Icon/utils/IconUtils.js +24 -16
  19. package/components/Link/Link.js +16 -12
  20. package/components/List/ListItem/ListItem.js +16 -12
  21. package/components/List/ListItemText/ListItemText.js +21 -17
  22. package/components/Loading/Loading.js +6 -4
  23. package/components/Menu/MenuItem/MenuItem.js +6 -4
  24. package/components/PortalHost/PortalManager/PortalManager.js +24 -16
  25. package/components/Snackbar/SnackbarContent/SnackbarContent.js +11 -7
  26. package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +11 -8
  27. package/components/Tag/Tag.js +11 -7
  28. package/components/Text/Text.js +1 -2
  29. package/components/Text/TextWithEllipsis.js +7 -4
  30. package/components/TextWithHighlight/TextWithHighlight.js +7 -4
  31. package/components/TextWithLink/TextWithLink.js +7 -4
  32. package/components/TextWithTooltip/TextWithTooltip.js +7 -4
  33. package/components/Thumbnail/Thumbnail.js +16 -12
  34. package/components/Tooltip/Tooltip.js +17 -11
  35. package/components/VirtualizedMenu/VirtualizedMenuList.js +8 -10
  36. package/es6/README.md +3 -2
  37. package/es6/components/Avatar/Avatar.js +37 -33
  38. package/es6/components/Buttons/Button/Button.js +12 -8
  39. package/es6/components/Buttons/IconButton/IconButton.js +6 -4
  40. package/es6/components/Buttons/SplitButton/SplitButton.js +2 -1
  41. package/es6/components/DetachedWindow/DetachedWindow.js +8 -6
  42. package/es6/components/Dialer/DialPad/utils/useKeyAudio.js +4 -4
  43. package/es6/components/Dialog/Dialog.js +12 -8
  44. package/es6/components/Downshift/Downshift.js +117 -110
  45. package/es6/components/Downshift/SuggestionList/SuggestionList.js +13 -5
  46. package/es6/components/Downshift/utils/useDownshiftError.js +3 -2
  47. package/es6/components/Forms/Checkbox/Checkbox.js +12 -8
  48. package/es6/components/Forms/Picker/DatePicker/DatePicker.js +22 -18
  49. package/es6/components/Forms/TextField/TextField.js +27 -23
  50. package/es6/components/Icon/Icon.js +42 -38
  51. package/es6/components/Icon/utils/IconUtils.js +24 -16
  52. package/es6/components/Link/Link.js +17 -13
  53. package/es6/components/List/ListItem/ListItem.js +17 -13
  54. package/es6/components/List/ListItemText/ListItemText.js +22 -18
  55. package/es6/components/Loading/Loading.js +6 -4
  56. package/es6/components/Menu/MenuItem/MenuItem.js +6 -4
  57. package/es6/components/PortalHost/PortalManager/PortalManager.js +24 -16
  58. package/es6/components/Snackbar/SnackbarContent/SnackbarContent.js +12 -8
  59. package/es6/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +12 -9
  60. package/es6/components/Tag/Tag.js +12 -8
  61. package/es6/components/Text/Text.js +1 -2
  62. package/es6/components/Text/TextWithEllipsis.js +7 -4
  63. package/es6/components/TextWithHighlight/TextWithHighlight.js +7 -4
  64. package/es6/components/TextWithLink/TextWithLink.js +7 -4
  65. package/es6/components/TextWithTooltip/TextWithTooltip.js +7 -4
  66. package/es6/components/Thumbnail/Thumbnail.js +17 -13
  67. package/es6/components/Tooltip/Tooltip.js +18 -12
  68. package/es6/components/VirtualizedMenu/VirtualizedMenuList.js +9 -11
  69. package/es6/foundation/config.js +77 -57
  70. package/es6/foundation/hooks/useAudio/useAudio.js +1 -1
  71. package/es6/foundation/hooks/useResizeObserver/useResizeObserver.js +10 -7
  72. package/es6/foundation/styles/opacity.js +6 -4
  73. package/es6/foundation/theme/useThemeProps.js +1 -1
  74. package/es6/foundation/utils/clearReactReferencesInNode.js +9 -7
  75. package/es6/foundation/utils/hasValue.js +1 -1
  76. package/es6/foundation/utils/index.js +0 -1
  77. package/es6/foundation/utils/isShowJunoWarning.js +0 -2
  78. package/es6/foundation/utils/withDeprecatedCheck.js +14 -15
  79. package/foundation/config.d.ts +23 -13
  80. package/foundation/config.js +78 -58
  81. package/foundation/hooks/useAudio/useAudio.d.ts +1 -1
  82. package/foundation/hooks/useAudio/useAudio.js +1 -1
  83. package/foundation/hooks/useResizeObserver/useResizeObserver.js +10 -7
  84. package/foundation/styles/opacity.js +6 -4
  85. package/foundation/theme/useThemeProps.d.ts +1 -1
  86. package/foundation/theme/useThemeProps.js +1 -1
  87. package/foundation/utils/clearReactReferencesInNode.js +9 -7
  88. package/foundation/utils/hasValue.js +1 -1
  89. package/foundation/utils/index.d.ts +0 -1
  90. package/foundation/utils/index.js +0 -1
  91. package/foundation/utils/isShowJunoWarning.d.ts +0 -1
  92. package/foundation/utils/isShowJunoWarning.js +0 -4
  93. package/foundation/utils/withDeprecatedCheck.d.ts +2 -2
  94. package/foundation/utils/withDeprecatedCheck.js +14 -15
  95. package/package.json +2 -2
@@ -2,13 +2,38 @@ import { __assign, __makeTemplateObject, __read, __rest } from "tslib";
2
2
  import React, { forwardRef, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
3
3
  import MuiTextField from '@material-ui/core/TextField';
4
4
  import { DeleteCircle } from '@ringcentral/juno-icon';
5
- import { clearReactReferencesInNode, combineClasses, combineProps, styled, useEventCallback, useForkRef, useThemeProps, withDeprecatedCheck, } from '../../../foundation';
5
+ import { clearReactReferencesInNode, combineClasses, combineProps, styled, useDeprecatedCheck, useEventCallback, useForkRef, useThemeProps, } from '../../../foundation';
6
6
  import { useRcFormContext } from '../Form/Form/FormContext';
7
7
  import { ClearIconButton, TextFieldStyle } from './styles';
8
8
  import { RcOutlineTextFieldIconSizes, RcOutlineTextFieldInputClasses, RcTextFieldClasses, RcTextFieldFormHelperTextClasses, RcTextFieldInputClasses, RcTextFieldInputLabelClasses, } from './utils';
9
9
  var combineOutlineClasses = combineClasses(RcTextFieldInputClasses, RcOutlineTextFieldInputClasses);
10
10
  var _RcTextField = forwardRef(function (inProps, ref) {
11
11
  var props = useThemeProps({ props: inProps, name: 'RcTextField' });
12
+ if (process.env.NODE_ENV !== 'production') {
13
+ // eslint-disable-next-line react-hooks/rules-of-hooks
14
+ useDeprecatedCheck(RcTextField, props, [
15
+ {
16
+ prop: 'focusOnMount',
17
+ time: '2021-4',
18
+ comment: "please use `autoFocus` to replace that",
19
+ },
20
+ {
21
+ prop: 'selectOnMount',
22
+ time: '2021-4',
23
+ comment: "please use `autoSelect` to replace that",
24
+ },
25
+ {
26
+ prop: 'clearLabel',
27
+ time: '2021-4',
28
+ comment: "clear button label, please use `clearButtonProps` with `title` replace that",
29
+ },
30
+ {
31
+ prop: 'clearAriaLabel',
32
+ time: '2021-4',
33
+ comment: "clear button aria-label, use `clearButtonProps` with `aria-label` replace that",
34
+ },
35
+ ]);
36
+ }
12
37
  var classesProp = props.classes, InputLabelPropsProp = props.InputLabelProps, FormHelperTextPropsProp = props.FormHelperTextProps, valueProp = props.value, focusOnMount = props.focusOnMount, selectOnMount = props.selectOnMount, clearAriaLabel = props.clearAriaLabel,
13
38
  // TODO: remove when remove focusOnMount
14
39
  _a = props.autoFocus,
@@ -139,28 +164,7 @@ var _RcTextField = forwardRef(function (inProps, ref) {
139
164
  return (React.createElement(MuiTextField, __assign({}, rest, events, { id: id, value: valueProp, onChange: onChange, defaultValue: defaultValue, error: validate ? !!validateMessage : error, helperText: validateMessage || helperText, classes: classes, FormHelperTextProps: FormHelperTextProps, InputLabelProps: InputLabelProps, InputProps: InputProps, inputRef: inputRef, ref: ref })));
140
165
  });
141
166
  /** @release */
142
- var RcTextField = styled(withDeprecatedCheck(_RcTextField, [
143
- {
144
- prop: 'focusOnMount',
145
- time: '2021-4',
146
- comment: "please use `autoFocus` to replace that",
147
- },
148
- {
149
- prop: 'selectOnMount',
150
- time: '2021-4',
151
- comment: "please use `autoSelect` to replace that",
152
- },
153
- {
154
- prop: 'clearLabel',
155
- time: '2021-4',
156
- comment: "clear button label, please use `clearButtonProps` with `title` replace that",
157
- },
158
- {
159
- prop: 'clearAriaLabel',
160
- time: '2021-4',
161
- comment: "clear button aria-label, use `clearButtonProps` with `aria-label` replace that",
162
- },
163
- ], 'RcTextField'))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), TextFieldStyle);
167
+ var RcTextField = styled(_RcTextField)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), TextFieldStyle);
164
168
  RcTextField.defaultProps = {
165
169
  clearBtn: true,
166
170
  variant: 'standard',
@@ -1,7 +1,7 @@
1
1
  import { __assign, __makeTemplateObject, __rest } from "tslib";
2
2
  import React, { forwardRef, memo, } from 'react';
3
3
  import clsx from 'clsx';
4
- import { styled, useThemeProps, withDeprecatedCheck, } from '../../foundation';
4
+ import { styled, useDeprecatedCheck, useThemeProps, } from '../../foundation';
5
5
  import { RcCircularProgress } from '../Progress';
6
6
  import { IconStyle, StyledSvg } from './styles';
7
7
  import { RcIconSizes } from './utils';
@@ -12,6 +12,46 @@ import { useIconService } from './utils/IconService';
12
12
  */
13
13
  var _RcIcon = memo(forwardRef(function (inProps, ref) {
14
14
  var props = useThemeProps({ props: inProps, name: 'RcIcon' });
15
+ if (process.env.NODE_ENV !== 'production') {
16
+ // eslint-disable-next-line react-hooks/rules-of-hooks
17
+ useDeprecatedCheck(RcIcon, props, [
18
+ {
19
+ prop: 'icon',
20
+ time: '2021-1',
21
+ comment: 'please use symbol to replace icon',
22
+ },
23
+ {
24
+ prop: 'children',
25
+ time: '2021-1',
26
+ comment: 'please use symbol to replace children',
27
+ },
28
+ {
29
+ prop: 'iconSize',
30
+ time: '2021-1',
31
+ comment: 'please use size',
32
+ },
33
+ {
34
+ prop: 'iconColor',
35
+ time: '2021-1',
36
+ comment: 'please use color',
37
+ },
38
+ {
39
+ prop: 'useLoading',
40
+ time: '2021-1',
41
+ comment: 'please use loading',
42
+ },
43
+ {
44
+ prop: 'loadingSize',
45
+ time: '2021-1',
46
+ comment: 'please use CircularProgressProps={{ size: 24 }} to set custom loading size',
47
+ },
48
+ {
49
+ prop: 'desc',
50
+ time: '2021-1',
51
+ comment: 'please use symbol',
52
+ },
53
+ ]);
54
+ }
15
55
  var loadingSize = props.loadingSize, useLoading = props.useLoading, iconColor = props.iconColor, iconSize = props.iconSize, icon = props.icon, desc = props.desc, className = props.className, _a = props.loading, loading = _a === void 0 ? useLoading : _a, CircularProgressProps = props.CircularProgressProps, symbol = props.symbol, children = props.children,
16
56
  // * pick props
17
57
  color = props.color, size = props.size, rest = __rest(props, ["loadingSize", "useLoading", "iconColor", "iconSize", "icon", "desc", "className", "loading", "CircularProgressProps", "symbol", "children", "color", "size"]);
@@ -61,43 +101,7 @@ var _RcIcon = memo(forwardRef(function (inProps, ref) {
61
101
  !!desc && React.createElement("title", null, desc),
62
102
  React.createElement("use", { xlinkHref: href, href: href }))))));
63
103
  }));
64
- var RcIcon = styled(withDeprecatedCheck(_RcIcon, [
65
- {
66
- prop: 'icon',
67
- time: '2021-1',
68
- comment: 'please use symbol to replace icon',
69
- },
70
- {
71
- prop: 'children',
72
- time: '2021-1',
73
- comment: 'please use symbol to replace children',
74
- },
75
- {
76
- prop: 'iconSize',
77
- time: '2021-1',
78
- comment: 'please use size',
79
- },
80
- {
81
- prop: 'iconColor',
82
- time: '2021-1',
83
- comment: 'please use color',
84
- },
85
- {
86
- prop: 'useLoading',
87
- time: '2021-1',
88
- comment: 'please use loading',
89
- },
90
- {
91
- prop: 'loadingSize',
92
- time: '2021-1',
93
- comment: 'please use CircularProgressProps={{ size: 24 }} to set custom loading size',
94
- },
95
- {
96
- prop: 'desc',
97
- time: '2021-1',
98
- comment: 'please use symbol',
99
- },
100
- ], 'RcIcon'))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), IconStyle);
104
+ var RcIcon = styled(_RcIcon)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), IconStyle);
101
105
  RcIcon.defaultProps = {
102
106
  size: 'large',
103
107
  };
@@ -12,28 +12,36 @@ export var RcIconSizes = {
12
12
  export function switchSize(size) {
13
13
  switch (size) {
14
14
  case 'extraSmall':
15
- logInDev({
16
- component: 'RcIcon',
17
- message: 'please change extraSmall to xsmall',
18
- });
15
+ if (process.env.NODE_ENV !== 'production') {
16
+ logInDev({
17
+ component: 'RcIcon',
18
+ message: 'please change extraSmall to xsmall',
19
+ });
20
+ }
19
21
  return 'xsmall';
20
22
  case 'moreLarge':
21
- logInDev({
22
- component: 'RcIcon',
23
- message: 'please change moreLarge to xlarge',
24
- });
23
+ if (process.env.NODE_ENV !== 'production') {
24
+ logInDev({
25
+ component: 'RcIcon',
26
+ message: 'please change moreLarge to xlarge',
27
+ });
28
+ }
25
29
  return 'xlarge';
26
30
  case 'mediumLarge':
27
- logInDev({
28
- component: 'RcIcon',
29
- message: 'please change mediumLarge to xxlarge',
30
- });
31
+ if (process.env.NODE_ENV !== 'production') {
32
+ logInDev({
33
+ component: 'RcIcon',
34
+ message: 'please change mediumLarge to xxlarge',
35
+ });
36
+ }
31
37
  return 'xxlarge';
32
38
  case 'extraLarge':
33
- logInDev({
34
- component: 'RcIcon',
35
- message: 'please change extraLarge to xxxlarge',
36
- });
39
+ if (process.env.NODE_ENV !== 'production') {
40
+ logInDev({
41
+ component: 'RcIcon',
42
+ message: 'please change extraLarge to xxxlarge',
43
+ });
44
+ }
37
45
  return 'xxxlarge';
38
46
  default:
39
47
  return size;
@@ -1,9 +1,24 @@
1
1
  import { __assign, __makeTemplateObject, __rest } from "tslib";
2
2
  import React, { forwardRef } from 'react';
3
- import { styled, useA11yKeyEvent, useThemeProps, withDeprecatedCheck, } from '../../foundation';
3
+ import { styled, useA11yKeyEvent, useDeprecatedCheck, useThemeProps, } from '../../foundation';
4
4
  import { LinkStyle } from './styles';
5
5
  var _RcLink = forwardRef(function (inProps, ref) {
6
6
  var props = useThemeProps({ props: inProps, name: 'RcLink' });
7
+ if (process.env.NODE_ENV !== 'production') {
8
+ // eslint-disable-next-line react-hooks/rules-of-hooks
9
+ useDeprecatedCheck(RcLink, props, [
10
+ {
11
+ prop: 'size',
12
+ time: '2021-4',
13
+ comment: "@deprecated size of Link, default is medium, please use variant directly\n * `small` => `caption1`\n * `medium` => `body1`\n * `large` => `headline1`\n */",
14
+ },
15
+ {
16
+ prop: 'handleOnClick',
17
+ time: '2021-4',
18
+ comment: "@deprecated use onClick replace that */",
19
+ },
20
+ ]);
21
+ }
7
22
  var _handleOnClick = props.handleOnClick, ComponentProp = props.Component, onKeyDown = props.onKeyDown, onClick = props.onClick, disabled = props.disabled, children = props.children, tabIndex = props.tabIndex, color = props.color, underline = props.underline, variant = props.variant, rest = __rest(props, ["handleOnClick", "Component", "onKeyDown", "onClick", "disabled", "children", "tabIndex", "color", "underline", "variant"]);
8
23
  // TODO: remove when handleOnClick removed
9
24
  var handleOnClick = _handleOnClick ? _handleOnClick : onClick;
@@ -18,18 +33,7 @@ var _RcLink = forwardRef(function (inProps, ref) {
18
33
  * @release
19
34
  * that onClick event will be trigger with `enter` like `<a>`, when have custom onKeydown event, that will be cover by outside
20
35
  * */
21
- var RcLink = styled(withDeprecatedCheck(_RcLink, [
22
- {
23
- prop: 'size',
24
- time: '2021-4',
25
- comment: "@deprecated size of Link, default is medium, please use variant directly\n * `small` => `caption1`\n * `medium` => `body1`\n * `large` => `headline1`\n */",
26
- },
27
- {
28
- prop: 'handleOnClick',
29
- time: '2021-4',
30
- comment: "@deprecated use onClick replace that */",
31
- },
32
- ], 'RcLink'))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), LinkStyle);
36
+ var RcLink = styled(_RcLink)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), LinkStyle);
33
37
  RcLink.defaultProps = {
34
38
  variant: 'body1',
35
39
  color: 'informative.f02',
@@ -2,12 +2,27 @@ import { __assign, __makeTemplateObject, __rest } from "tslib";
2
2
  import React, { forwardRef, useMemo } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import MuiListItem from '@material-ui/core/ListItem';
5
- import { combineClasses, combineProps, styled, useThemeProps, withDeprecatedCheck, } from '../../../foundation';
5
+ import { combineClasses, combineProps, styled, useDeprecatedCheck, useThemeProps, } from '../../../foundation';
6
6
  import { withTooltip } from '../../Tooltip';
7
7
  import { ListItemStyle } from './styles';
8
8
  import { RcListItemClasses, RcListItemMultilineClassName, RcListItemRippleClasses, } from './utils';
9
9
  var _RcListItem = forwardRef(function (inProps, ref) {
10
10
  var props = useThemeProps({ props: inProps, name: 'RcListItem' });
11
+ if (process.env.NODE_ENV !== 'production') {
12
+ // eslint-disable-next-line react-hooks/rules-of-hooks
13
+ useDeprecatedCheck(RcListItem, props, [
14
+ {
15
+ prop: 'baseColor',
16
+ time: '2021-9',
17
+ comment: '@deprecated should use color directly',
18
+ },
19
+ {
20
+ prop: 'maxWidth',
21
+ time: '2021-4',
22
+ comment: 'recommend using classes to define',
23
+ },
24
+ ]);
25
+ }
11
26
  var classesProp = props.classes, color = props.color, TouchRipplePropsProp = props.TouchRippleProps, children = props.children, className = props.className, singleLine = props.singleLine, button = props.button, size = props.size, canHover = props.canHover, isInline = props.isInline, baseColor = props.baseColor, title = props.title, highlighted = props.highlighted, maxWidth = props.maxWidth, rest = __rest(props, ["classes", "color", "TouchRippleProps", "children", "className", "singleLine", "button", "size", "canHover", "isInline", "baseColor", "title", "highlighted", "maxWidth"]);
12
27
  var classes = useMemo(function () { return combineClasses(RcListItemClasses, classesProp); }, [classesProp]);
13
28
  var ListItemClassName = useMemo(function () {
@@ -26,18 +41,7 @@ var _RcListItem = forwardRef(function (inProps, ref) {
26
41
  }, [TouchRipplePropsProp, button]);
27
42
  return (React.createElement(MuiListItem, __assign({}, rest, additionProps, { ref: ref, title: typeof title === 'string' ? title : undefined, classes: classes, className: ListItemClassName, button: button }), children));
28
43
  });
29
- var RcListItem = styled(withDeprecatedCheck(withTooltip(_RcListItem), [
30
- {
31
- prop: 'baseColor',
32
- time: '2021-9',
33
- comment: '@deprecated should use color directly',
34
- },
35
- {
36
- prop: 'maxWidth',
37
- time: '2021-4',
38
- comment: 'recommend using classes to define',
39
- },
40
- ], 'RcListItem'))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), ListItemStyle);
44
+ var RcListItem = styled(withTooltip(_RcListItem))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), ListItemStyle);
41
45
  RcListItem.defaultProps = {
42
46
  singleLine: false,
43
47
  button: true,
@@ -1,34 +1,38 @@
1
1
  import { __assign, __makeTemplateObject, __rest } from "tslib";
2
2
  import React, { forwardRef, useMemo } from 'react';
3
3
  import MuiListItemText from '@material-ui/core/ListItemText';
4
- import { combineClasses, omit, styled, useThemeProps, withDeprecatedCheck, } from '../../../foundation';
4
+ import { combineClasses, omit, styled, useDeprecatedCheck, useThemeProps, } from '../../../foundation';
5
5
  import { ListItemTextStyle } from './styles';
6
6
  import { RcListItemTextClasses } from './utils';
7
7
  var _RcListItemText = forwardRef(function (inProps, ref) {
8
8
  var props = useThemeProps({ props: inProps, name: 'RcListItemText' });
9
+ if (process.env.NODE_ENV !== 'production') {
10
+ // eslint-disable-next-line react-hooks/rules-of-hooks
11
+ useDeprecatedCheck(RcListItemText, props, [
12
+ {
13
+ prop: 'primaryColor',
14
+ time: '2021-4',
15
+ comment: 'recommend use primaryTypographyProps color prop',
16
+ },
17
+ {
18
+ prop: 'alignCenter',
19
+ time: '2021-4',
20
+ comment: "recommend using classes to define it",
21
+ },
22
+ {
23
+ prop: 'lineThrough',
24
+ time: '2021-4',
25
+ comment: "recommend using classes to define it",
26
+ },
27
+ ]);
28
+ }
9
29
  var classesProp = props.classes, children = props.children, isEllipsis = props.isEllipsis, primaryTypographyPropsProp = props.primaryTypographyProps, secondaryTypographyPropsProp = props.secondaryTypographyProps, primaryColor = props.primaryColor, alignCenter = props.alignCenter, lineThrough = props.lineThrough, rest = __rest(props, ["classes", "children", "isEllipsis", "primaryTypographyProps", "secondaryTypographyProps", "primaryColor", "alignCenter", "lineThrough"]);
10
30
  var classes = useMemo(function () { return combineClasses(RcListItemTextClasses, classesProp); }, [classesProp]);
11
31
  var primaryTypographyProps = useMemo(function () { return omit(primaryTypographyPropsProp, ['color', 'variant']); }, [primaryTypographyPropsProp]);
12
32
  var secondaryTypographyProps = useMemo(function () { return omit(secondaryTypographyPropsProp, ['color', 'variant']); }, [secondaryTypographyPropsProp]);
13
33
  return (React.createElement(MuiListItemText, __assign({}, rest, { ref: ref, classes: classes, primaryTypographyProps: primaryTypographyProps, secondaryTypographyProps: secondaryTypographyProps }), children));
14
34
  });
15
- var RcListItemText = styled(withDeprecatedCheck(_RcListItemText, [
16
- {
17
- prop: 'primaryColor',
18
- time: '2021-4',
19
- comment: 'recommend use primaryTypographyProps color prop',
20
- },
21
- {
22
- prop: 'alignCenter',
23
- time: '2021-4',
24
- comment: "recommend using classes to define it",
25
- },
26
- {
27
- prop: 'lineThrough',
28
- time: '2021-4',
29
- comment: "recommend using classes to define it",
30
- },
31
- ], 'RcListItemText'))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), ListItemTextStyle);
35
+ var RcListItemText = styled(_RcListItemText)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), ListItemTextStyle);
32
36
  RcListItemText.defaultProps = {
33
37
  isEllipsis: true,
34
38
  primaryTypographyProps: {
@@ -18,10 +18,12 @@ var RcLoading = function (inProps) {
18
18
  childrenWhenLoading.type !== React.Fragment) {
19
19
  return (React.createElement(RcBox, { clone: true, display: "none" }, childrenWhenLoading));
20
20
  }
21
- logInDev({
22
- component: 'RcLoading',
23
- message: 'please confirm your children is a valid html element to set style, when you use `keepVisible=false`',
24
- });
21
+ if (process.env.NODE_ENV !== 'production') {
22
+ logInDev({
23
+ component: 'RcLoading',
24
+ message: 'please confirm your children is a valid html element to set style, when you use `keepVisible=false`',
25
+ });
26
+ }
25
27
  return childrenWhenLoading;
26
28
  };
27
29
  return (React.createElement(React.Fragment, null,
@@ -50,10 +50,12 @@ var _RcMenuItem = forwardRef(function (inProps, ref) {
50
50
  return isRcElement(icon, ['RcListItemIcon']) ? (icon) : (React.createElement(RcListItemIcon, null, icon));
51
51
  }
52
52
  if (typeof icon === 'string') {
53
- logInDev({
54
- component: 'RcMenuItem',
55
- message: 'please use symbol to replace icon string',
56
- });
53
+ if (process.env.NODE_ENV !== 'production') {
54
+ logInDev({
55
+ component: 'RcMenuItem',
56
+ message: 'please use symbol to replace icon string',
57
+ });
58
+ }
57
59
  return (React.createElement(RcListItemIcon, null,
58
60
  React.createElement(RcIcon, { size: "small" }, icon)));
59
61
  }
@@ -31,10 +31,12 @@ var PortalManager = /** @class */ (function (_super) {
31
31
  var currPortal = this.portalStore.get(id);
32
32
  // portalWithSameID opened
33
33
  if (currPortal === null || currPortal === void 0 ? void 0 : currPortal.open) {
34
- logInDev({
35
- component: 'RcPortalHost',
36
- message: "open the portal with id('" + id + "') failed, this portal is already open",
37
- });
34
+ if (process.env.NODE_ENV !== 'production') {
35
+ logInDev({
36
+ component: 'RcPortalHost',
37
+ message: "open the portal with id('" + id + "') failed, this portal is already open",
38
+ });
39
+ }
38
40
  return currPortal.portalController;
39
41
  }
40
42
  var portalDescriptor = this.createPortalDescriptor({
@@ -118,10 +120,12 @@ var PortalManager = /** @class */ (function (_super) {
118
120
  PortalManager.prototype.closeByID = function (id, feedback) {
119
121
  var portal = this.portalStore.get(id);
120
122
  if (!(portal === null || portal === void 0 ? void 0 : portal.open)) {
121
- logInDev({
122
- component: 'RcPortalHost',
123
- message: 'close portal failed, this portal is already closed',
124
- });
123
+ if (process.env.NODE_ENV !== 'production') {
124
+ logInDev({
125
+ component: 'RcPortalHost',
126
+ message: 'close portal failed, this portal is already closed',
127
+ });
128
+ }
125
129
  return;
126
130
  }
127
131
  this._feedbackMap.set(portal.id, feedback);
@@ -137,10 +141,12 @@ var PortalManager = /** @class */ (function (_super) {
137
141
  PortalManager.prototype[UnmountSymbol] = function (id) {
138
142
  var portal = this.portalStore.get(id);
139
143
  if (!portal) {
140
- logInDev({
141
- component: 'RcPortalHost',
142
- message: 'unmount portal failed, this portal is already unmount',
143
- });
144
+ if (process.env.NODE_ENV !== 'production') {
145
+ logInDev({
146
+ component: 'RcPortalHost',
147
+ message: 'unmount portal failed, this portal is already unmount',
148
+ });
149
+ }
144
150
  return;
145
151
  }
146
152
  this.portalStore.delete(portal.id);
@@ -151,10 +157,12 @@ var PortalManager = /** @class */ (function (_super) {
151
157
  PortalManager.prototype.updatePropsByID = function (id, propsOrHandler) {
152
158
  var portal = this.portalStore.get(id);
153
159
  if (!(portal === null || portal === void 0 ? void 0 : portal.open)) {
154
- logInDev({
155
- component: 'RcPortalHost',
156
- message: 'update props failed, this portal is already closed',
157
- });
160
+ if (process.env.NODE_ENV !== 'production') {
161
+ logInDev({
162
+ component: 'RcPortalHost',
163
+ message: 'update props failed, this portal is already closed',
164
+ });
165
+ }
158
166
  return;
159
167
  }
160
168
  var props = (function () {
@@ -1,13 +1,23 @@
1
1
  import { __assign, __makeTemplateObject, __rest } from "tslib";
2
2
  import React, { forwardRef, isValidElement, useMemo, } from 'react';
3
3
  import MuiSnackbarContent from '@material-ui/core/SnackbarContent';
4
- import { combineClasses, isRcElement, styled, useThemeProps, withDeprecatedCheck, } from '../../../foundation';
4
+ import { combineClasses, isRcElement, styled, useDeprecatedCheck, useThemeProps, } from '../../../foundation';
5
5
  import { RcCircularProgress } from '../../Progress/CircularProgress';
6
6
  import { snackbarContentStyle } from './styles';
7
7
  import { RcSnackbarContentClasses, RcSnackbarContentLoadingSizes, } from './utils';
8
8
  /** @release */
9
9
  var _RcSnackbarContent = forwardRef(function (inProps, ref) {
10
10
  var props = useThemeProps({ props: inProps, name: 'RcSnackbarContent' });
11
+ if (process.env.NODE_ENV !== 'production') {
12
+ // eslint-disable-next-line react-hooks/rules-of-hooks
13
+ useDeprecatedCheck(RcSnackbarContent, props, [
14
+ {
15
+ prop: 'ariaLabel',
16
+ time: '2021-3',
17
+ comment: "please use `aria-label` directly ",
18
+ },
19
+ ]);
20
+ }
11
21
  var classesProp = props.classes, loading = props.loading, size = props.size, messageAlign = props.messageAlign, type = props.type, fullWidth = props.fullWidth, actionProp = props.action, rest = __rest(props, ["classes", "loading", "size", "messageAlign", "type", "fullWidth", "action"]);
12
22
  var classes = useMemo(function () { return combineClasses(RcSnackbarContentClasses, classesProp); }, [classesProp]);
13
23
  var action = useMemo(function () {
@@ -28,13 +38,7 @@ var _RcSnackbarContent = forwardRef(function (inProps, ref) {
28
38
  }, [actionProp, size]);
29
39
  return (React.createElement(MuiSnackbarContent, __assign({}, rest, { ref: ref, classes: classes, action: loading ? (React.createElement(RcCircularProgress, { color: "inherit", size: RcSnackbarContentLoadingSizes[size] })) : (action) })));
30
40
  });
31
- var RcSnackbarContent = styled(withDeprecatedCheck(_RcSnackbarContent, [
32
- {
33
- prop: 'ariaLabel',
34
- time: '2021-3',
35
- comment: "please use `aria-label` directly ",
36
- },
37
- ], 'RcSnackbarContent'))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), snackbarContentStyle);
41
+ var RcSnackbarContent = styled(_RcSnackbarContent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), snackbarContentStyle);
38
42
  RcSnackbarContent.defaultProps = {
39
43
  type: 'success',
40
44
  messageAlign: 'center',
@@ -2,7 +2,7 @@ import { __assign, __makeTemplateObject, __read, __rest, __spread } from "tslib"
2
2
  import React, { createRef, forwardRef, useEffect, useMemo, useRef, useState, } from 'react';
3
3
  import isEqual from 'lodash/isEqual';
4
4
  import MuiTabs from '@material-ui/core/Tabs';
5
- import { styled, useForceUpdate, useForkRef, useResizeObserver, useThrottle, } from '../../../../foundation';
5
+ import { styled, useForceUpdate, useForkRef, usePrevious, useResizeObserver, useThrottle, } from '../../../../foundation';
6
6
  import { DEFAULT_MORE_MENU_TAB_LABEL, MoreMenuTab, } from '../MoreMenuTab';
7
7
  import { computeChildBySize, DEFAULT_SIZE, getDomBoundingClientSize, getKey, parseKey, } from './utils';
8
8
  export var findChildrenByKey = function (childrenProp, key) {
@@ -20,6 +20,7 @@ export var findChildrenByKey = function (childrenProp, key) {
20
20
  var _MoreMenuTabs = forwardRef(function (props, ref) {
21
21
  var orientation = props.orientation, childrenProp = props.children, valueProp = props.value, onChange = props.onChange, _a = props.MoreButtonProps, MoreButtonProps = _a === void 0 ? {} : _a, rest = __rest(props, ["orientation", "children", "value", "onChange", "MoreButtonProps"]);
22
22
  var onGroupInfoChange = MoreButtonProps.onGroupInfoChange, MoreButtonPropsRest = __rest(MoreButtonProps, ["onGroupInfoChange"]);
23
+ var prevChildren = usePrevious(function () { return childrenProp; });
23
24
  var isVertical = orientation === 'vertical';
24
25
  var oriStr = isVertical ? 'height' : 'width';
25
26
  var innerRef = useRef(null);
@@ -33,7 +34,7 @@ var _MoreMenuTabs = forwardRef(function (props, ref) {
33
34
  var groupingRef = useRef();
34
35
  var _b = __read(useState([]), 2), menuTabChild = _b[0], setMenuTabChild = _b[1];
35
36
  var _c = __read(useState(true), 2), useMoreMode = _c[0], setUseMoreMode = _c[1];
36
- var sizeChangeResolve = useRef(true);
37
+ var hasResizeRef = useRef(true);
37
38
  var forceUpdate = useForceUpdate();
38
39
  var sizeChange = function (size) {
39
40
  if (tabsSizeRef.current.height !== size.height ||
@@ -47,7 +48,7 @@ var _MoreMenuTabs = forwardRef(function (props, ref) {
47
48
  var _b = __read(_a, 1), entry = _b[0];
48
49
  var _c = entry.contentRect, width = _c.width, height = _c.height;
49
50
  var obj = { width: width, height: height };
50
- sizeChangeResolve.current = false;
51
+ hasResizeRef.current = true;
51
52
  throttleTabsSizeChange(obj);
52
53
  }, { mode: 'none' });
53
54
  var tabsSize = tabsSizeRef.current;
@@ -111,10 +112,10 @@ var _MoreMenuTabs = forwardRef(function (props, ref) {
111
112
  }, []);
112
113
  useEffect(function () {
113
114
  var _a;
114
- var currSelectMenuItem;
115
+ var currSelectTabItem;
115
116
  var tabRefsMap = tabRefsMapRef.current;
116
117
  if (tabRefsMap) {
117
- currSelectMenuItem = __spread(tabRefsMap).find(function (_a) {
118
+ currSelectTabItem = __spread(tabRefsMap).find(function (_a) {
118
119
  var _b = __read(_a, 2), mapValue = _b[1];
119
120
  return valueProp === mapValue.value || valueProp === mapValue.index;
120
121
  });
@@ -153,7 +154,7 @@ var _MoreMenuTabs = forwardRef(function (props, ref) {
153
154
  });
154
155
  });
155
156
  var limitSize = tabsSize[oriStr] - moreTabSizeRef.current[oriStr];
156
- var _a = computeChildBySize(labelArray, currSelectMenuItem === null || currSelectMenuItem === void 0 ? void 0 : currSelectMenuItem[0], limitSize), tabsTabLabel = _a.plainArr, menuTabLabel = _a.groupArr;
157
+ var _a = computeChildBySize(labelArray, currSelectTabItem === null || currSelectTabItem === void 0 ? void 0 : currSelectTabItem[0], limitSize), tabsTabLabel = _a.plainArr, menuTabLabel = _a.groupArr;
157
158
  computeGroupingInfo(tabsTabLabel, menuTabLabel);
158
159
  var tabsTabChild = tabsTabLabel.map(function (key) {
159
160
  return findChildrenByKey(childrenProp, key);
@@ -189,18 +190,20 @@ var _MoreMenuTabs = forwardRef(function (props, ref) {
189
190
  if (tabsSize.width !== 0 && tabsSize.height !== 0) {
190
191
  // computed: 1.resize 2. valueProp 3.moreMenuClick
191
192
  // not computed: visible tab change
192
- if (((_a = groupingRef.current) === null || _a === void 0 ? void 0 : _a.tabs.includes((currSelectMenuItem === null || currSelectMenuItem === void 0 ? void 0 : currSelectMenuItem[0]) || '')) &&
193
- sizeChangeResolve.current === true) {
193
+ if (((_a = groupingRef.current) === null || _a === void 0 ? void 0 : _a.tabs.includes((currSelectTabItem === null || currSelectTabItem === void 0 ? void 0 : currSelectTabItem[0]) || '')) &&
194
+ !hasResizeRef.current &&
195
+ prevChildren === childrenProp) {
194
196
  return;
195
197
  }
196
198
  computeTabChild(tabsSize);
197
- sizeChangeResolve.current = true;
199
+ hasResizeRef.current = false;
198
200
  }
199
201
  }, [
200
202
  childrenProp,
201
203
  isVertical,
202
204
  onGroupInfoChange,
203
205
  oriStr,
206
+ prevChildren,
204
207
  tabsSize,
205
208
  valueProp,
206
209
  ]);
@@ -1,19 +1,23 @@
1
1
  import { __assign, __makeTemplateObject, __rest } from "tslib";
2
2
  import React, { forwardRef, memo } from 'react';
3
- import { styled, useThemeProps, withDeprecatedCheck, } from '../../foundation';
3
+ import { styled, useDeprecatedCheck, useThemeProps, } from '../../foundation';
4
4
  import { TagStyle } from './styles';
5
5
  var _RcTag = memo(forwardRef(function (inProps, ref) {
6
6
  var props = useThemeProps({ props: inProps, name: 'RcTag' });
7
+ if (process.env.NODE_ENV !== 'production') {
8
+ // eslint-disable-next-line react-hooks/rules-of-hooks
9
+ useDeprecatedCheck(RcTag, props, [
10
+ {
11
+ prop: 'content',
12
+ comment: 'you should replace with children',
13
+ time: '2021-1',
14
+ },
15
+ ]);
16
+ }
7
17
  var color = props.color, children = props.children, content = props.content, textColor = props.textColor, borderColor = props.borderColor, radius = props.radius, rest = __rest(props, ["color", "children", "content", "textColor", "borderColor", "radius"]);
8
18
  return (React.createElement("span", __assign({}, rest, { ref: ref }), content || children));
9
19
  }));
10
- var RcTag = styled(withDeprecatedCheck(_RcTag, [
11
- {
12
- prop: 'content',
13
- comment: 'you should replace with children',
14
- time: '2021-1',
15
- },
16
- ]))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), TagStyle);
20
+ var RcTag = styled(_RcTag)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), TagStyle);
17
21
  RcTag.defaultProps = {
18
22
  color: 'highlight.b03',
19
23
  textColor: 'neutral.f01',