@ringcentral/juno 2.0.0-rc.0 → 2.0.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 (84) hide show
  1. package/README.md +2 -1
  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 +115 -108
  11. package/components/Downshift/utils/useDownshiftError.js +2 -1
  12. package/components/Forms/Checkbox/Checkbox.js +11 -7
  13. package/components/Forms/Picker/DatePicker/DatePicker.js +21 -17
  14. package/components/Forms/TextField/TextField.js +26 -22
  15. package/components/Icon/Icon.js +41 -37
  16. package/components/Icon/utils/IconUtils.js +24 -16
  17. package/components/Link/Link.js +16 -12
  18. package/components/List/ListItem/ListItem.js +16 -12
  19. package/components/List/ListItemText/ListItemText.js +21 -17
  20. package/components/Loading/Loading.js +6 -4
  21. package/components/Menu/MenuItem/MenuItem.js +6 -4
  22. package/components/PortalHost/PortalManager/PortalManager.js +24 -16
  23. package/components/Snackbar/SnackbarContent/SnackbarContent.js +11 -7
  24. package/components/Tag/Tag.js +11 -7
  25. package/components/Text/Text.js +1 -2
  26. package/components/Text/TextWithEllipsis.js +7 -4
  27. package/components/TextWithHighlight/TextWithHighlight.js +7 -4
  28. package/components/TextWithLink/TextWithLink.js +7 -4
  29. package/components/TextWithTooltip/TextWithTooltip.js +7 -4
  30. package/components/Thumbnail/Thumbnail.js +16 -12
  31. package/components/Tooltip/Tooltip.js +17 -11
  32. package/components/VirtualizedMenu/VirtualizedMenuList.js +8 -10
  33. package/es6/README.md +2 -1
  34. package/es6/components/Avatar/Avatar.js +37 -33
  35. package/es6/components/Buttons/Button/Button.js +12 -8
  36. package/es6/components/Buttons/IconButton/IconButton.js +6 -4
  37. package/es6/components/Buttons/SplitButton/SplitButton.js +2 -1
  38. package/es6/components/DetachedWindow/DetachedWindow.js +8 -6
  39. package/es6/components/Dialer/DialPad/utils/useKeyAudio.js +4 -4
  40. package/es6/components/Dialog/Dialog.js +12 -8
  41. package/es6/components/Downshift/Downshift.js +116 -109
  42. package/es6/components/Downshift/utils/useDownshiftError.js +3 -2
  43. package/es6/components/Forms/Checkbox/Checkbox.js +12 -8
  44. package/es6/components/Forms/Picker/DatePicker/DatePicker.js +22 -18
  45. package/es6/components/Forms/TextField/TextField.js +27 -23
  46. package/es6/components/Icon/Icon.js +42 -38
  47. package/es6/components/Icon/utils/IconUtils.js +24 -16
  48. package/es6/components/Link/Link.js +17 -13
  49. package/es6/components/List/ListItem/ListItem.js +17 -13
  50. package/es6/components/List/ListItemText/ListItemText.js +22 -18
  51. package/es6/components/Loading/Loading.js +6 -4
  52. package/es6/components/Menu/MenuItem/MenuItem.js +6 -4
  53. package/es6/components/PortalHost/PortalManager/PortalManager.js +24 -16
  54. package/es6/components/Snackbar/SnackbarContent/SnackbarContent.js +12 -8
  55. package/es6/components/Tag/Tag.js +12 -8
  56. package/es6/components/Text/Text.js +1 -2
  57. package/es6/components/Text/TextWithEllipsis.js +7 -4
  58. package/es6/components/TextWithHighlight/TextWithHighlight.js +7 -4
  59. package/es6/components/TextWithLink/TextWithLink.js +7 -4
  60. package/es6/components/TextWithTooltip/TextWithTooltip.js +7 -4
  61. package/es6/components/Thumbnail/Thumbnail.js +17 -13
  62. package/es6/components/Tooltip/Tooltip.js +18 -12
  63. package/es6/components/VirtualizedMenu/VirtualizedMenuList.js +9 -11
  64. package/es6/foundation/config.js +77 -57
  65. package/es6/foundation/hooks/useResizeObserver/useResizeObserver.js +10 -7
  66. package/es6/foundation/styles/opacity.js +6 -4
  67. package/es6/foundation/utils/clearReactReferencesInNode.js +9 -7
  68. package/es6/foundation/utils/hasValue.js +1 -1
  69. package/es6/foundation/utils/index.js +0 -1
  70. package/es6/foundation/utils/isShowJunoWarning.js +0 -2
  71. package/es6/foundation/utils/withDeprecatedCheck.js +14 -15
  72. package/foundation/config.d.ts +23 -13
  73. package/foundation/config.js +78 -58
  74. package/foundation/hooks/useResizeObserver/useResizeObserver.js +10 -7
  75. package/foundation/styles/opacity.js +6 -4
  76. package/foundation/utils/clearReactReferencesInNode.js +9 -7
  77. package/foundation/utils/hasValue.js +1 -1
  78. package/foundation/utils/index.d.ts +0 -1
  79. package/foundation/utils/index.js +0 -1
  80. package/foundation/utils/isShowJunoWarning.d.ts +0 -1
  81. package/foundation/utils/isShowJunoWarning.js +0 -4
  82. package/foundation/utils/withDeprecatedCheck.d.ts +2 -2
  83. package/foundation/utils/withDeprecatedCheck.js +14 -15
  84. package/package.json +5 -5
@@ -8,6 +8,16 @@ var styles_1 = require("./styles");
8
8
  var utils_1 = require("./utils");
9
9
  var _RcTooltip = react_1.forwardRef(function (inProps, ref) {
10
10
  var props = foundation_1.useThemeProps({ props: inProps, name: 'RcTooltip' });
11
+ if (process.env.NODE_ENV !== 'production') {
12
+ // eslint-disable-next-line react-hooks/rules-of-hooks
13
+ foundation_1.useDeprecatedCheck(RcTooltip, props, [
14
+ {
15
+ prop: 'injectGlobalStyle',
16
+ time: '2021-3',
17
+ comment: "@deprecated now need anymore */",
18
+ },
19
+ ]);
20
+ }
11
21
  var children = props.children, tooltipForceHide = props.tooltipForceHide, openProp = props.open, onOpen = props.onOpen, onClose = props.onClose,
12
22
  // * that className will pass into children, just pick that and pass into root popper
13
23
  // * that also not a props in mui doc https://material-ui.com/api/tooltip/
@@ -46,10 +56,12 @@ var _RcTooltip = react_1.forwardRef(function (inProps, ref) {
46
56
  childNode.tagName.toLowerCase() === 'button' &&
47
57
  childNode.disabled) {
48
58
  setIsDisabledButton(true);
49
- foundation_1.logInDev({
50
- component: 'RcTooltip',
51
- message: 'You have set a tooltip on disabled button, A disabled element does not fire events.',
52
- });
59
+ if (process.env.NODE_ENV !== 'production') {
60
+ foundation_1.logInDev({
61
+ component: 'RcTooltip',
62
+ message: 'You have set a tooltip on disabled button, A disabled element does not fire events.',
63
+ });
64
+ }
53
65
  }
54
66
  else if (isDisabledButton) {
55
67
  setIsDisabledButton(false);
@@ -58,13 +70,7 @@ var _RcTooltip = react_1.forwardRef(function (inProps, ref) {
58
70
  return (react_1.default.createElement(Tooltip_1.default, tslib_1.__assign({ ref: tooltipRef, title: isDisabledButton ? '' : title, arrow: true, classes: classes, PopperProps: PopperProps }, additionProp, rest), ignorePointer ? (react_1.default.createElement(styles_1.Mask, tslib_1.__assign({}, maskProps), children)) : (children)));
59
71
  });
60
72
  /** @release */
61
- var RcTooltip = foundation_1.styled(foundation_1.withDeprecatedCheck(_RcTooltip, [
62
- {
63
- prop: 'injectGlobalStyle',
64
- time: '2021-3',
65
- comment: "@deprecated now need anymore */",
66
- },
67
- ], 'RcTooltip'))(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), styles_1.tooltipStyle);
73
+ var RcTooltip = foundation_1.styled(_RcTooltip)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), styles_1.tooltipStyle);
68
74
  exports.RcTooltip = RcTooltip;
69
75
  RcTooltip.defaultProps = {
70
76
  placement: 'bottom',
@@ -35,16 +35,14 @@ var _RcVirtualizedMenuList = react_1.forwardRef(function (inProps, ref) {
35
35
  if (!react_1.default.isValidElement(child)) {
36
36
  return;
37
37
  }
38
- if (foundation_1.isShowJunoWarning) {
39
- if (react_is_1.isFragment(child)) {
40
- foundation_1.logInDev({
41
- component: 'RcVirtualizedMenuList',
42
- message: [
43
- "Material-UI: The Menu component doesn't accept a Fragment as a child.",
44
- 'Consider providing an array instead.',
45
- ].join('\n'),
46
- });
47
- }
38
+ if (process.env.NODE_ENV !== 'production' && react_is_1.isFragment(child)) {
39
+ foundation_1.logInDev({
40
+ component: 'RcVirtualizedMenuList',
41
+ message: [
42
+ "Material-UI: The Menu component doesn't accept a Fragment as a child.",
43
+ 'Consider providing an array instead.',
44
+ ].join('\n'),
45
+ });
48
46
  }
49
47
  if (!child.props.disabled) {
50
48
  if (variant === 'selectedMenu' && child.props.selected) {
package/es6/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # Juno
2
2
 
3
3
  [![NPM version](https://img.shields.io/npm/v/@ringcentral/juno/latest.svg)](https://www.npmjs.com/package/@ringcentral/juno)
4
-
5
4
  [![NPM beta version](https://img.shields.io/npm/v/@ringcentral/juno/beta.svg)](https://www.npmjs.com/package/@ringcentral/juno?activeTab=versions)
6
5
 
6
+ [![NPM version](https://img.shields.io/npm/v/@ringcentral/juno-icon/beta.svg)](https://www.npmjs.com/package/@ringcentral/juno-icon)
7
+
7
8
  Ringcentral React Component library, make your app have the same user experience as Ringcentral Apps.
8
9
 
9
10
  base on [MATERIAL-UI](https://material-ui.com/).
@@ -1,7 +1,7 @@
1
1
  import { __assign, __makeTemplateObject, __rest } from "tslib";
2
2
  import React, { forwardRef, useMemo } 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 { RcPresence } from '../Presence';
6
6
  import { RcTooltip, withTooltip } from '../Tooltip';
7
7
  import { RcAvatarMask, StyledAvatar, StyledAvatarWrapper, StyledIconAvatar, StyledPresenceWrapper, } from './styles';
@@ -9,6 +9,41 @@ import { RcAvatarClasses, RcAvatarSizes } from './utils';
9
9
  var _RcAvatar = forwardRef(function (inProps, ref) {
10
10
  // change default unClickable to here, prevent warning
11
11
  var props = useThemeProps({ props: inProps, name: 'RcAvatar' });
12
+ if (process.env.NODE_ENV !== 'production') {
13
+ // eslint-disable-next-line react-hooks/rules-of-hooks
14
+ useDeprecatedCheck(RcAvatar, inProps, [
15
+ {
16
+ prop: 'customColor',
17
+ time: '2021-3',
18
+ comment: "if 'true', will just use color value, use `color` directly ",
19
+ },
20
+ {
21
+ prop: 'unClickable',
22
+ time: '2021-3',
23
+ comment: "force set avatar clickable, default is true, please use clickable to set clickable ",
24
+ },
25
+ {
26
+ prop: 'isMember',
27
+ time: '2021-3',
28
+ comment: "not used, just keep type temp ",
29
+ },
30
+ {
31
+ prop: 'displayName',
32
+ time: '2021-3',
33
+ comment: "not used, just keep type temp ",
34
+ },
35
+ {
36
+ prop: 'alt',
37
+ time: '2021-3',
38
+ comment: "alt for img, just use `<img src /> in children or imgProps for apply alt` ",
39
+ },
40
+ {
41
+ prop: 'tooltip',
42
+ time: '2021-3',
43
+ comment: "support tooltip for avatar, use title to replace ",
44
+ },
45
+ ]);
46
+ }
12
47
  var presenceOrigin = props.presenceOrigin, idProps = props.id, size = props.size, classes = props.classes, color = props.color, children = props.children, _clickable = props.clickable, onClick = props.onClick, mask = props.mask, presence = props.presence, customColor = props.customColor, tooltip = props.tooltip, iconSize = props.iconSize, iconSymbol = props.iconSymbol, srcProp = props.src, altProp = props.alt, Img = props.Img, imgProps = props.imgProps, presenceProps = props.presenceProps, displayName = props.displayName, rest = __rest(props, ["presenceOrigin", "id", "size", "classes", "color", "children", "clickable", "onClick", "mask", "presence", "customColor", "tooltip", "iconSize", "iconSymbol", "src", "alt", "Img", "imgProps", "presenceProps", "displayName"]);
13
48
  var unClickable = props.unClickable;
14
49
  unClickable = unClickable !== null && unClickable !== void 0 ? unClickable : true;
@@ -93,38 +128,7 @@ var _RcAvatar = forwardRef(function (inProps, ref) {
93
128
  avatar,
94
129
  presenceChildren));
95
130
  });
96
- var RcAvatar = styled(withDeprecatedCheck(withTooltip(_RcAvatar), [
97
- {
98
- prop: 'customColor',
99
- time: '2021-3',
100
- comment: "if 'true', will just use color value, use `color` directly ",
101
- },
102
- {
103
- prop: 'unClickable',
104
- time: '2021-3',
105
- comment: "force set avatar clickable, default is true, please use clickable to set clickable ",
106
- },
107
- {
108
- prop: 'isMember',
109
- time: '2021-3',
110
- comment: "not used, just keep type temp ",
111
- },
112
- {
113
- prop: 'displayName',
114
- time: '2021-3',
115
- comment: "not used, just keep type temp ",
116
- },
117
- {
118
- prop: 'alt',
119
- time: '2021-3',
120
- comment: "alt for img, just use `<img src /> in children or imgProps for apply alt` ",
121
- },
122
- {
123
- prop: 'tooltip',
124
- time: '2021-3',
125
- comment: "support tooltip for avatar, use title to replace ",
126
- },
127
- ], 'RcAvatar'))(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
131
+ var RcAvatar = styled(withTooltip(_RcAvatar))(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
128
132
  RcAvatar.defaultProps = {
129
133
  size: 'medium',
130
134
  presenceOrigin: {
@@ -1,7 +1,7 @@
1
1
  import { __assign, __makeTemplateObject, __rest } from "tslib";
2
2
  import React, { forwardRef, useCallback, useLayoutEffect, useMemo, useRef, } from 'react';
3
3
  import MuiButton from '@material-ui/core/Button';
4
- import { combineClasses, isRcElement, removeClassName, styled, useForkRef, useTheme, useThemeProps, withDeprecatedCheck, } from '../../../foundation';
4
+ import { combineClasses, isRcElement, removeClassName, styled, useDeprecatedCheck, useForkRef, useTheme, useThemeProps, } from '../../../foundation';
5
5
  import { RcIcon } from '../../Icon';
6
6
  import { RcIconSizes } from '../../Icon/utils';
7
7
  import { RcCircularProgress } from '../../Progress';
@@ -11,6 +11,16 @@ import { getButtonIconSize, RcButtonClasses } from './utils';
11
11
  var _RcButton = forwardRef(function (inProps, ref) {
12
12
  var _a, _b;
13
13
  var props = useThemeProps({ props: inProps, name: 'RcButton' });
14
+ if (process.env.NODE_ENV !== 'production') {
15
+ // eslint-disable-next-line react-hooks/rules-of-hooks
16
+ useDeprecatedCheck(RcButton, props, [
17
+ {
18
+ prop: 'IconProps',
19
+ time: '2021-4',
20
+ comment: "@deprecated Icon, please use startIcon with `<RcIcon />` */",
21
+ },
22
+ ]);
23
+ }
14
24
  var childrenProp = props.children, classesProp = props.classes, startIconProp = props.startIcon, endIconProp = props.endIcon, loading = props.loading, loadingMode = props.loadingMode, disabled = props.disabled, IconProps = props.IconProps, size = props.size, color = props.color, CircularProgressProps = props.CircularProgressProps, variant = props.variant, disabledVariant = props.disabledVariant, radius = props.radius, keepElevation = props.keepElevation, rest = __rest(props, ["children", "classes", "startIcon", "endIcon", "loading", "loadingMode", "disabled", "IconProps", "size", "color", "CircularProgressProps", "variant", "disabledVariant", "radius", "keepElevation"]);
15
25
  var theme = useTheme();
16
26
  var innerRef = useRef(null);
@@ -83,13 +93,7 @@ var _RcButton = forwardRef(function (inProps, ref) {
83
93
  return (React.createElement(MuiButton, __assign({ ref: buttonRef, disabled: disabled || loading, variant: isPlain ? undefined : variant, disableRipple: ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.props) === null || _a === void 0 ? void 0 : _a.MuiButton) === null || _b === void 0 ? void 0 : _b.disableRipple) || isPlain, startIcon: startIcon, endIcon: endIcon, classes: classes }, rest), loading && isReplace ? loadingElm : childrenProp));
84
94
  });
85
95
  /** @release */
86
- var RcButton = styled(withDeprecatedCheck(withTooltip(_RcButton), [
87
- {
88
- prop: 'IconProps',
89
- time: '2021-4',
90
- comment: "@deprecated Icon, please use startIcon with `<RcIcon />` */",
91
- },
92
- ], 'RcButton'))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), buttonStyle);
96
+ var RcButton = styled(withTooltip(_RcButton))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), buttonStyle);
93
97
  RcButton.defaultProps = {
94
98
  size: 'large',
95
99
  color: 'primary',
@@ -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 { combineProps, styled, useTheme, useThemeProps, withDeprecatedCheck, } from '../../../foundation';
4
+ import { combineProps, styled, useDeprecatedCheck, useTheme, useThemeProps, } from '../../../foundation';
5
5
  import { RcIcon } from '../../Icon';
6
6
  import { RcTooltip, withTooltip } from '../../Tooltip';
7
7
  import { RcButtonBase } from '../ButtonBase';
@@ -11,6 +11,10 @@ import { RcIconButtonClasses, RcIconButtonTouchRippleClasses } from './utils';
11
11
  var _RcIconButton = memo(forwardRef(function (inProps, ref) {
12
12
  var _a;
13
13
  var props = useThemeProps({ props: inProps, name: 'RcIconButton' });
14
+ if (process.env.NODE_ENV !== 'production') {
15
+ // eslint-disable-next-line react-hooks/rules-of-hooks
16
+ useDeprecatedCheck(RcIconButton, props, rcIconButtonWarning);
17
+ }
14
18
  var _b = props.buttonRef, buttonRef = _b === void 0 ? ref : _b, className = props.className, classes = props.classes, children = props.children, title = props.title, symbol = props.symbol, disabled = props.disabled, invisible = props.invisible, type = props.type, loading = props.loading, TouchRippleProps = props.TouchRippleProps, variant = props.variant, CircularProgressProps = props.CircularProgressProps, color = props.color, shouldPersistBg = props.shouldPersistBg, stretchIcon = props.stretchIcon, iconColor = props.iconColor, iconSize = props.iconSize, disableTouchRipple = props.disableTouchRipple, useColorWhenDisabled = props.useColorWhenDisabled, size = props.size, radius = props.radius, elevation = props.elevation, activeElevation = props.activeElevation, aRef = props.aRef, tooltipTitle = props.tooltipTitle, tooltipForceHide = props.tooltipForceHide, disableToolTip = props.disableToolTip, alwaysEnableTooltip = props.alwaysEnableTooltip, tooltipPlacement = props.tooltipPlacement, ariaLabel = props.ariaLabel, popperProps = props.popperProps, externalLink = props.externalLink, download = props.download, autoFocus = props.autoFocus, href = props.href, rest = __rest(props, ["buttonRef", "className", "classes", "children", "title", "symbol", "disabled", "invisible", "type", "loading", "TouchRippleProps", "variant", "CircularProgressProps", "color", "shouldPersistBg", "stretchIcon", "iconColor", "iconSize", "disableTouchRipple", "useColorWhenDisabled", "size", "radius", "elevation", "activeElevation", "aRef", "tooltipTitle", "tooltipForceHide", "disableToolTip", "alwaysEnableTooltip", "tooltipPlacement", "ariaLabel", "popperProps", "externalLink", "download", "autoFocus", "href"]);
15
19
  var theme = useTheme();
16
20
  var isOutline = variant === 'outline';
@@ -42,9 +46,7 @@ var _RcIconButton = memo(forwardRef(function (inProps, ref) {
42
46
  }
43
47
  return iconButton;
44
48
  }));
45
- var RcIconButton = styled(withDeprecatedCheck(withTooltip(_RcIconButton),
46
- // TODO remove when ready
47
- rcIconButtonWarning, 'RcIconButton'))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), iconButtonStyle);
49
+ var RcIconButton = styled(withTooltip(_RcIconButton))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), iconButtonStyle);
48
50
  RcIconButton.displayName = 'RcIconButton';
49
51
  RcIconButton.defaultProps = {
50
52
  variant: 'round',
@@ -59,7 +59,8 @@ var _RcSplitButton = forwardRef(function (inProps, ref) {
59
59
  };
60
60
  }, [color, loading, toButtonSize, type, variant]);
61
61
  var _j = useMemo(function () {
62
- if (!(childrenProp instanceof Array)) {
62
+ if (process.env.NODE_ENV !== 'production' &&
63
+ !(childrenProp instanceof Array)) {
63
64
  logInDev({
64
65
  component: 'RcSplitButton',
65
66
  message: 'children must be implement with RcSplitButtonChildrenProps[]',
@@ -13,7 +13,7 @@ import { addCommentInHeader, DetachedWindowRefMaps, MUI_INSERTION_POINT, openExt
13
13
  */
14
14
  var RcDetachedWindow = memo(forwardRef(function (inProps, ref) {
15
15
  var props = useThemeProps({ props: inProps, name: 'RcDetachedWindow' });
16
- var childrenProp = props.children, onBeforeunload = props.onBeforeunload, onUnload = props.onUnload, onload = props.onload, title = props.title, url = props.url, name = props.name, specs = props.specs, replace = props.replace, open = props.open, onOpen = props.onOpen, getWindow = props.getWindow, keep = props.keep;
16
+ var childrenProp = props.children, onBeforeunload = props.onBeforeunload, onUnload = props.onUnload, onload = props.onload, title = props.title, url = props.url, name = props.name, specs = props.specs, open = props.open, onOpen = props.onOpen, getWindow = props.getWindow, keep = props.keep;
17
17
  var _a = __read(useState(), 2), externalWindow = _a[0], setExternalWindow = _a[1];
18
18
  var isCloseByWindowExitRef = useRef(false);
19
19
  var innerRef = useRef(null);
@@ -36,13 +36,15 @@ var RcDetachedWindow = memo(forwardRef(function (inProps, ref) {
36
36
  });
37
37
  var openWindow = useEventCallback(function () {
38
38
  var newWindow = getWindow
39
- ? getWindow({ url: url, name: name, specs: specs, replace: replace, title: title })
39
+ ? getWindow({ url: url, name: name, specs: specs, title: title })
40
40
  : openExternalWindow(props);
41
41
  if (!newWindow) {
42
- logInDev({
43
- component: 'RcDetachedWindow',
44
- message: 'Please check your window instance, that `window.open` should not trigger by another window',
45
- });
42
+ if (process.env.NODE_ENV !== 'production') {
43
+ logInDev({
44
+ component: 'RcDetachedWindow',
45
+ message: 'Please check your window instance, that `window.open` should not trigger by another window',
46
+ });
47
+ }
46
48
  return;
47
49
  }
48
50
  if (title)
@@ -25,10 +25,10 @@ export var useKeyAudio = function (_a) {
25
25
  case 2:
26
26
  audio.currentTime = 0;
27
27
  audio.src = src;
28
- lastPlayRef.current = audio
29
- .play()
30
- .catch(function (reason) {
31
- return logInDev({ component: 'RcDialerPad', message: reason });
28
+ lastPlayRef.current = audio.play().catch(function (reason) {
29
+ if (process.env.NODE_ENV !== 'production') {
30
+ logInDev({ component: 'RcDialerPad', message: reason });
31
+ }
32
32
  });
33
33
  return [2 /*return*/];
34
34
  }
@@ -1,13 +1,23 @@
1
1
  import { __assign, __makeTemplateObject, __rest } from "tslib";
2
2
  import React, { forwardRef, useMemo } from 'react';
3
3
  import MuiDialog from '@material-ui/core/Dialog';
4
- import { combineClasses, styled, useRcPortalWindowContext, useThemeProps, withDeprecatedCheck, } from '../../foundation';
4
+ import { combineClasses, styled, useDeprecatedCheck, useRcPortalWindowContext, useThemeProps, } from '../../foundation';
5
5
  import { useUnmountPortalHandler } from '../PortalHost';
6
6
  import { DialogStyle } from './styles';
7
7
  import { RcDialogClasses } from './utils';
8
8
  import { RcDialogContext } from './utils/DialogContext';
9
9
  var _RcDialog = forwardRef(function (inProps, ref) {
10
10
  var props = useThemeProps({ props: inProps, name: 'RcDialog' });
11
+ if (process.env.NODE_ENV !== 'production') {
12
+ // eslint-disable-next-line react-hooks/rules-of-hooks
13
+ useDeprecatedCheck(RcDialog, props, [
14
+ {
15
+ prop: 'size',
16
+ time: '2021-11',
17
+ comment: "\n * please use `maxWidth` and `fullScreen` directly\n *\n * - 'fullScreen' => false\n * - 'large' => `md`\n * - 'medium' => `sm`\n * - 'small' => `xs`\n * - 'xsmall' => no longer exist, should custom by yourself\n */",
18
+ },
19
+ ]);
20
+ }
11
21
  var classesProp = props.classes, _a = props.size, size = _a === void 0 ? 'medium' : _a, maxWidthProp = props.maxWidth, _b = props.fullWidth, fullWidth = _b === void 0 ? true : _b, childrenSize = props.childrenSize, children = props.children, TransitionPropsProp = props.TransitionProps, rest = __rest(props, ["classes", "size", "maxWidth", "fullWidth", "childrenSize", "children", "TransitionProps"]);
12
22
  var classes = useMemo(function () { return combineClasses(RcDialogClasses, classesProp); }, [classesProp]);
13
23
  var externalWindow = useRcPortalWindowContext().externalWindow;
@@ -35,13 +45,7 @@ var _RcDialog = forwardRef(function (inProps, ref) {
35
45
  return (React.createElement(MuiDialog, __assign({ ref: ref, fullWidth: fullWidth, container: externalWindow === null || externalWindow === void 0 ? void 0 : externalWindow.document.body, maxWidth: maxWidth, fullScreen: size === 'fullScreen' ? true : undefined, classes: classes, TransitionProps: TransitionProps }, rest),
36
46
  React.createElement(RcDialogContext.Provider, { value: contextValue }, children)));
37
47
  });
38
- var RcDialog = styled(withDeprecatedCheck(_RcDialog, [
39
- {
40
- prop: 'size',
41
- time: '2021-11',
42
- comment: "\n * please use `maxWidth` and `fullScreen` directly\n *\n * - 'fullScreen' => false\n * - 'large' => `md`\n * - 'medium' => `sm`\n * - 'small' => `xs`\n * - 'xsmall' => no longer exist, should custom by yourself\n */",
43
- },
44
- ], 'RcDialog'))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), DialogStyle);
48
+ var RcDialog = styled(_RcDialog)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), DialogStyle);
45
49
  RcDialog.defaultProps = {};
46
50
  RcDialog.displayName = 'RcDialog';
47
51
  export { RcDialog, RcDialogContext };
@@ -1,7 +1,7 @@
1
1
  import { __assign, __makeTemplateObject, __read, __rest } from "tslib";
2
2
  import React, { forwardRef, memo, useImperativeHandle, useMemo, useRef, useState, } from 'react';
3
3
  import { ArrowDown, ArrowUp } from '@ringcentral/juno-icon';
4
- import { combineClasses, combineProps, getParsePaletteColor, omit, styled, useEventCallback, useForkRef, useTheme, useThemeProps, withDeprecatedCheck, } from '../../foundation';
4
+ import { combineClasses, combineProps, getParsePaletteColor, omit, styled, useDeprecatedCheck, useEventCallback, useForkRef, useTheme, useThemeProps, } from '../../foundation';
5
5
  import { RcChip } from '../Chip';
6
6
  import { ClearIconButton } from '../Forms/TextField/styles/ClearIconButton';
7
7
  import { RcVisuallyHidden } from '../VisuallyHidden';
@@ -10,6 +10,116 @@ import { RcSuggestionList } from './SuggestionList';
10
10
  import { DEFAULT_GET_OPTION_LABEL, DEFAULT_KEY_TO_CHIPS, DEFAULT_LIMIT_CHIPS, RcDownshiftDefaultFilterOptions, RcDownshiftInputClasses, useDownshift, useDownshiftError, } from './utils';
11
11
  var _RcDownshift = memo(forwardRef(function (inProps, ref) {
12
12
  var props = useThemeProps({ props: inProps, name: 'RcDownshift' });
13
+ if (process.env.NODE_ENV !== 'production') {
14
+ // eslint-disable-next-line react-hooks/rules-of-hooks
15
+ useDeprecatedCheck(RcDownshift, props, [
16
+ {
17
+ prop: 'onSelectChange',
18
+ time: '2021-10',
19
+ comment: "@deprecated should use `onChange` */",
20
+ },
21
+ {
22
+ prop: 'suggestionItems',
23
+ time: '2021-10',
24
+ comment: "@deprecated should use `options` to replace */",
25
+ },
26
+ {
27
+ prop: 'selectedItems',
28
+ time: '2021-10',
29
+ comment: "@deprecated not need any more */",
30
+ },
31
+ {
32
+ prop: 'itemToString',
33
+ time: '2021-10',
34
+ comment: "@deprecated use `getOptionLabel` to replace that */",
35
+ },
36
+ {
37
+ prop: 'MenuItem',
38
+ time: '2021-10',
39
+ comment: "@deprecated should use `renderOption` to replace that */",
40
+ },
41
+ {
42
+ prop: 'minRowHeight',
43
+ time: '2021-10',
44
+ comment: "@deprecated suggestion list row min height for virtual list */",
45
+ },
46
+ {
47
+ prop: 'enableFreeChips',
48
+ time: '2021-10',
49
+ comment: "@deprecated enable free chip mode, should use `freeSolo` to replace that */",
50
+ },
51
+ {
52
+ prop: 'inputLabel',
53
+ time: '2021-10',
54
+ comment: "@deprecated please use `label` to replace that */",
55
+ },
56
+ {
57
+ prop: 'inputPlaceholder',
58
+ time: '2021-10',
59
+ comment: "@deprecated input element placeholder attribute */",
60
+ },
61
+ {
62
+ prop: 'maxLength',
63
+ time: '2021-10',
64
+ comment: "@deprecated input element maxlength, please use `TextFieldProps.inputProps.maxLength` */",
65
+ },
66
+ {
67
+ prop: 'screenReader',
68
+ time: '2021-10',
69
+ comment: "@deprecated should use `screenReaderProps` */",
70
+ },
71
+ {
72
+ prop: 'automationId',
73
+ time: '2021-10',
74
+ comment: "@deprecated wrapper automationId, should use `data-test-automation-id` directly */",
75
+ },
76
+ {
77
+ prop: 'InputItem',
78
+ time: '2021-10',
79
+ comment: "@deprecated just use the `renderTags` to render whole tags */",
80
+ },
81
+ {
82
+ prop: 'emailError',
83
+ time: '2021-10',
84
+ comment: "@deprecated please calculate error outside by your self with `renderTags`, or prepare ready items with error field */",
85
+ },
86
+ {
87
+ prop: 'errorSelectedItems',
88
+ time: '2021-10',
89
+ comment: "@deprecated please calculate error outside by your self with `renderTags`, or prepare ready items with error field */",
90
+ },
91
+ {
92
+ prop: 'nameError',
93
+ time: '2021-10',
94
+ comment: "@deprecated replace to `error` */",
95
+ },
96
+ {
97
+ prop: 'keyToChips',
98
+ time: '2021-10',
99
+ comment: "@deprecated rename to `keyToTags` */",
100
+ },
101
+ {
102
+ prop: 'limitOfFreeChips',
103
+ time: '2021-10',
104
+ comment: "@deprecated should use `max` */",
105
+ },
106
+ {
107
+ prop: 'enableAutoTransform',
108
+ time: '2021-10',
109
+ comment: "@deprecated should use `autoSelect` */",
110
+ },
111
+ {
112
+ prop: 'messageRef',
113
+ time: '2021-10',
114
+ comment: "@deprecated should use `inputRef` */",
115
+ },
116
+ {
117
+ prop: 'TextFieldProps',
118
+ time: '2021-10',
119
+ comment: "@deprecated TextField props */",
120
+ },
121
+ ]);
122
+ }
13
123
  var theme = useTheme();
14
124
  var _a = props.itemToString, itemToString = _a === void 0 ? DEFAULT_GET_OPTION_LABEL : _a, _b = props.keyToChips, keyToChips = _b === void 0 ? DEFAULT_KEY_TO_CHIPS : _b, _c = props.limitOfFreeChips, limitOfFreeChips = _c === void 0 ? DEFAULT_LIMIT_CHIPS : _c, minRowHeight = props.minRowHeight, suggestionItems = props.suggestionItems, messageRef = props.messageRef, MenuItem = props.MenuItem, inputLabel = props.inputLabel, nameError = props.nameError, maxLength = props.maxLength, InputItem = props.InputItem, emailError = props.emailError, autoSwitchEmail = props.autoSwitchEmail, enableFreeChips = props.enableFreeChips, inputPlaceholder = props.inputPlaceholder, errorSelectedItems = props.errorSelectedItems, enableAutoTransform = props.enableAutoTransform, allowPlainHelperText = props.allowPlainHelperText, TextFieldProps = props.TextFieldProps, selectedItemsProp = props.selectedItems, automationId = props.automationId, screenReader = props.screenReader, onSelectChange = props.onSelectChange, variant = props.variant, groupExpanded = props.groupExpanded, groupDefaultExpanded = props.groupDefaultExpanded, _d = props.groupVariant, groupVariant = _d === void 0 ? 'normal' : _d, getExpandIconProps = props.getExpandIconProps, groupBy = props.groupBy, _e = props.value, valueProp = _e === void 0 ? selectedItemsProp : _e, _f = props.autoHighlight, autoHighlight = _f === void 0 ? true : _f, _g = props.fullWidth, fullWidth = _g === void 0 ? true : _g, _h = props.clearBtn, clearBtn = _h === void 0 ? false : _h, _j = props.toggleButton, toggleButton = _j === void 0 ? false : _j, _k = props.multiple, multiple = _k === void 0 ? false : _k, clearButtonProps = props.clearButtonProps, onClear = props.onClear, ToggleButtonProps = props.ToggleButtonProps, inputValueProp = props.inputValue, onKeyDownProp = props.onKeyDown, helperTextProp = props.helperText, options = props.options, openOnFocus = props.openOnFocus, _l = props.getOptionLabel, getOptionLabel = _l === void 0 ? itemToString : _l, renderInput = props.renderInput, _m = props.label, label = _m === void 0 ? inputLabel : _m, _o = props.inputRef, inputRefProp = _o === void 0 ? messageRef : _o, _p = props.error, error = _p === void 0 ? nameError : _p, _q = props.placeholder, placeholder = _q === void 0 ? inputPlaceholder : _q, _r = props.freeSolo, freeSolo = _r === void 0 ? enableFreeChips : _r, _s = props.keyToTags, keyToTags = _s === void 0 ? keyToChips : _s, _t = props.maxFreeSolo, maxFreeSolo = _t === void 0 ? limitOfFreeChips : _t, SuggestionListProps = props.SuggestionListProps, _u = props.autoSelect, autoSelect = _u === void 0 ? enableAutoTransform : _u, PopperProps = props.PopperProps, initialIsOpen = props.initialIsOpen, disabled = props.disabled, requiredProp = props.required, _v = props.defaultIsOpen, defaultIsOpen = _v === void 0 ? openOnFocus : _v, _w = props.disableCloseOnSelect, disableCloseOnSelect = _w === void 0 ? defaultIsOpen : _w, _x = props.onChange, onChangeProp = _x === void 0 ? onSelectChange : _x, onInputChangeProp = props.onInputChange, onMaxFreeSolo = props.onMaxFreeSolo, FormHelperTextPropsProp = props.FormHelperTextProps, action = props.action, filterOptions = props.filterOptions, renderOption = props.renderOption, renderTags = props.renderTags, getOptionDisabled = props.getOptionDisabled, renderGroup = props.renderGroup, onGroupExpanded = props.onGroupExpanded, renderNoOptions = props.renderNoOptions, InputPropsProp = props.InputProps, debug = props.debug, disabledItemsHighlightable = props.disabledItemsHighlightable, openProp = props.open, onOpen = props.onOpen, onClose = props.onClose, focused = props.focused, color = props.color, rest = __rest(props, ["itemToString", "keyToChips", "limitOfFreeChips", "minRowHeight", "suggestionItems", "messageRef", "MenuItem", "inputLabel", "nameError", "maxLength", "InputItem", "emailError", "autoSwitchEmail", "enableFreeChips", "inputPlaceholder", "errorSelectedItems", "enableAutoTransform", "allowPlainHelperText", "TextFieldProps", "selectedItems", "automationId", "screenReader", "onSelectChange", "variant", "groupExpanded", "groupDefaultExpanded", "groupVariant", "getExpandIconProps", "groupBy", "value", "autoHighlight", "fullWidth", "clearBtn", "toggleButton", "multiple", "clearButtonProps", "onClear", "ToggleButtonProps", "inputValue", "onKeyDown", "helperText", "options", "openOnFocus", "getOptionLabel", "renderInput", "label", "inputRef", "error", "placeholder", "freeSolo", "keyToTags", "maxFreeSolo", "SuggestionListProps", "autoSelect", "PopperProps", "initialIsOpen", "disabled", "required", "defaultIsOpen", "disableCloseOnSelect", "onChange", "onInputChange", "onMaxFreeSolo", "FormHelperTextProps", "action", "filterOptions", "renderOption", "renderTags", "getOptionDisabled", "renderGroup", "onGroupExpanded", "renderNoOptions", "InputProps", "debug", "disabledItemsHighlightable", "open", "onOpen", "onClose", "focused", "color"]);
15
125
  var _y = __read(useState('bottom'), 2), position = _y[0], setPosition = _y[1];
@@ -20,7 +130,10 @@ var _RcDownshift = memo(forwardRef(function (inProps, ref) {
20
130
  // * if that have pass old suggestionItems mean that use old logic
21
131
  var isNew = !suggestionItems;
22
132
  var oneOfTagError = false;
23
- useDownshiftError({ isNew: isNew, MenuItem: MenuItem, InputItem: InputItem });
133
+ if (process.env.NODE_ENV !== 'production') {
134
+ // eslint-disable-next-line react-hooks/rules-of-hooks
135
+ useDownshiftError({ isNew: isNew, MenuItem: MenuItem, InputItem: InputItem });
136
+ }
24
137
  var required = requiredProp || (TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.required);
25
138
  var _z = useDownshift({
26
139
  focused: focused,
@@ -183,113 +296,7 @@ var _RcDownshift = memo(forwardRef(function (inProps, ref) {
183
296
  isOpen && (React.createElement(RcSuggestionList, __assign({ highlightedIndex: highlightedIndex, optionsGroupList: optionsGroupList, options: optionItems, groupVariant: groupVariant, groupExpanded: groupExpanded, renderGroup: renderGroup, MenuItem: MenuItem, renderOption: renderOption, inputValue: inputValue, getItemProps: getItemProps, getMenuProps: getMenuProps, changeHighlightedIndexReason: changeHighlightedIndexReason, getOptionDisabled: getOptionDisabled, isKeepHighlightedIndex: isKeepHighlightedIndex, onUpdatePopper: handleUpdatePopper, maxContainerHeight: 180, getOptionLabel: getOptionLabel }, SuggestionListProps))),
184
297
  isRenderNoOptions && (renderNoOptions === null || renderNoOptions === void 0 ? void 0 : renderNoOptions(getNoOptionsProps, noOptionItem)))));
185
298
  }));
186
- var RcDownshift = styled(withDeprecatedCheck(_RcDownshift, [
187
- {
188
- prop: 'onSelectChange',
189
- time: '2021-10',
190
- comment: "@deprecated should use `onChange` */",
191
- },
192
- {
193
- prop: 'suggestionItems',
194
- time: '2021-10',
195
- comment: "@deprecated should use `options` to replace */",
196
- },
197
- {
198
- prop: 'selectedItems',
199
- time: '2021-10',
200
- comment: "@deprecated not need any more */",
201
- },
202
- {
203
- prop: 'itemToString',
204
- time: '2021-10',
205
- comment: "@deprecated use `getOptionLabel` to replace that */",
206
- },
207
- {
208
- prop: 'MenuItem',
209
- time: '2021-10',
210
- comment: "@deprecated should use `renderOption` to replace that */",
211
- },
212
- {
213
- prop: 'minRowHeight',
214
- time: '2021-10',
215
- comment: "@deprecated suggestion list row min height for virtual list */",
216
- },
217
- {
218
- prop: 'enableFreeChips',
219
- time: '2021-10',
220
- comment: "@deprecated enable free chip mode, should use `freeSolo` to replace that */",
221
- },
222
- {
223
- prop: 'inputLabel',
224
- time: '2021-10',
225
- comment: "@deprecated please use `label` to replace that */",
226
- },
227
- {
228
- prop: 'inputPlaceholder',
229
- time: '2021-10',
230
- comment: "@deprecated input element placeholder attribute */",
231
- },
232
- {
233
- prop: 'maxLength',
234
- time: '2021-10',
235
- comment: "@deprecated input element maxlength, please use `TextFieldProps.inputProps.maxLength` */",
236
- },
237
- {
238
- prop: 'screenReader',
239
- time: '2021-10',
240
- comment: "@deprecated should use `screenReaderProps` */",
241
- },
242
- {
243
- prop: 'automationId',
244
- time: '2021-10',
245
- comment: "@deprecated wrapper automationId, should use `data-test-automation-id` directly */",
246
- },
247
- {
248
- prop: 'InputItem',
249
- time: '2021-10',
250
- comment: "@deprecated just use the `renderTags` to render whole tags */",
251
- },
252
- {
253
- prop: 'emailError',
254
- time: '2021-10',
255
- comment: "@deprecated please calculate error outside by your self with `renderTags`, or prepare ready items with error field */",
256
- },
257
- {
258
- prop: 'errorSelectedItems',
259
- time: '2021-10',
260
- comment: "@deprecated please calculate error outside by your self with `renderTags`, or prepare ready items with error field */",
261
- },
262
- {
263
- prop: 'nameError',
264
- time: '2021-10',
265
- comment: "@deprecated replace to `error` */",
266
- },
267
- {
268
- prop: 'keyToChips',
269
- time: '2021-10',
270
- comment: "@deprecated rename to `keyToTags` */",
271
- },
272
- {
273
- prop: 'limitOfFreeChips',
274
- time: '2021-10',
275
- comment: "@deprecated should use `max` */",
276
- },
277
- {
278
- prop: 'enableAutoTransform',
279
- time: '2021-10',
280
- comment: "@deprecated should use `autoSelect` */",
281
- },
282
- {
283
- prop: 'messageRef',
284
- time: '2021-10',
285
- comment: "@deprecated should use `inputRef` */",
286
- },
287
- {
288
- prop: 'TextFieldProps',
289
- time: '2021-10',
290
- comment: "@deprecated TextField props */",
291
- },
292
- ], 'RcDownshift'))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), DownshiftStyle);
299
+ var RcDownshift = styled(_RcDownshift)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), DownshiftStyle);
293
300
  RcDownshift.defaultProps = {};
294
301
  RcDownshift.displayName = 'RcDownshift';
295
302
  var ExportType = RcDownshift;
@@ -1,10 +1,11 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { isForwardRef } from 'react-is';
3
- import { isShowJunoWarning, logInDev } from '../../../foundation';
3
+ import { logInDev, rcConfiguration } from '../../../foundation';
4
4
  // TODO: this just for check error props
5
5
  export var useDownshiftError = function (_a) {
6
6
  var isNew = _a.isNew, MenuItem = _a.MenuItem, InputItem = _a.InputItem;
7
- if (isShowJunoWarning) {
7
+ if (process.env.NODE_ENV !== 'production' &&
8
+ !rcConfiguration.WARNING_IGNORE) {
8
9
  // eslint-disable-next-line react-hooks/rules-of-hooks
9
10
  useEffect(function () {
10
11
  if (!isNew) {