@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.
- package/README.md +3 -2
- package/components/Avatar/Avatar.js +36 -32
- package/components/Buttons/Button/Button.js +11 -7
- package/components/Buttons/IconButton/IconButton.js +5 -3
- package/components/Buttons/SplitButton/SplitButton.js +2 -1
- package/components/DetachedWindow/DetachedWindow.d.ts +1 -7
- package/components/DetachedWindow/DetachedWindow.js +8 -6
- package/components/Dialer/DialPad/utils/useKeyAudio.js +4 -4
- package/components/Dialog/Dialog.js +11 -7
- package/components/Downshift/Downshift.js +116 -109
- package/components/Downshift/SuggestionList/SuggestionList.d.ts +7 -1
- package/components/Downshift/SuggestionList/SuggestionList.js +13 -5
- package/components/Downshift/utils/useDownshiftError.js +2 -1
- package/components/Forms/Checkbox/Checkbox.js +11 -7
- package/components/Forms/Picker/DatePicker/DatePicker.js +21 -17
- package/components/Forms/TextField/TextField.js +26 -22
- package/components/Icon/Icon.js +41 -37
- package/components/Icon/utils/IconUtils.js +24 -16
- package/components/Link/Link.js +16 -12
- package/components/List/ListItem/ListItem.js +16 -12
- package/components/List/ListItemText/ListItemText.js +21 -17
- package/components/Loading/Loading.js +6 -4
- package/components/Menu/MenuItem/MenuItem.js +6 -4
- package/components/PortalHost/PortalManager/PortalManager.js +24 -16
- package/components/Snackbar/SnackbarContent/SnackbarContent.js +11 -7
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +11 -8
- package/components/Tag/Tag.js +11 -7
- package/components/Text/Text.js +1 -2
- package/components/Text/TextWithEllipsis.js +7 -4
- package/components/TextWithHighlight/TextWithHighlight.js +7 -4
- package/components/TextWithLink/TextWithLink.js +7 -4
- package/components/TextWithTooltip/TextWithTooltip.js +7 -4
- package/components/Thumbnail/Thumbnail.js +16 -12
- package/components/Tooltip/Tooltip.js +17 -11
- package/components/VirtualizedMenu/VirtualizedMenuList.js +8 -10
- package/es6/README.md +3 -2
- package/es6/components/Avatar/Avatar.js +37 -33
- package/es6/components/Buttons/Button/Button.js +12 -8
- package/es6/components/Buttons/IconButton/IconButton.js +6 -4
- package/es6/components/Buttons/SplitButton/SplitButton.js +2 -1
- package/es6/components/DetachedWindow/DetachedWindow.js +8 -6
- package/es6/components/Dialer/DialPad/utils/useKeyAudio.js +4 -4
- package/es6/components/Dialog/Dialog.js +12 -8
- package/es6/components/Downshift/Downshift.js +117 -110
- package/es6/components/Downshift/SuggestionList/SuggestionList.js +13 -5
- package/es6/components/Downshift/utils/useDownshiftError.js +3 -2
- package/es6/components/Forms/Checkbox/Checkbox.js +12 -8
- package/es6/components/Forms/Picker/DatePicker/DatePicker.js +22 -18
- package/es6/components/Forms/TextField/TextField.js +27 -23
- package/es6/components/Icon/Icon.js +42 -38
- package/es6/components/Icon/utils/IconUtils.js +24 -16
- package/es6/components/Link/Link.js +17 -13
- package/es6/components/List/ListItem/ListItem.js +17 -13
- package/es6/components/List/ListItemText/ListItemText.js +22 -18
- package/es6/components/Loading/Loading.js +6 -4
- package/es6/components/Menu/MenuItem/MenuItem.js +6 -4
- package/es6/components/PortalHost/PortalManager/PortalManager.js +24 -16
- package/es6/components/Snackbar/SnackbarContent/SnackbarContent.js +12 -8
- package/es6/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +12 -9
- package/es6/components/Tag/Tag.js +12 -8
- package/es6/components/Text/Text.js +1 -2
- package/es6/components/Text/TextWithEllipsis.js +7 -4
- package/es6/components/TextWithHighlight/TextWithHighlight.js +7 -4
- package/es6/components/TextWithLink/TextWithLink.js +7 -4
- package/es6/components/TextWithTooltip/TextWithTooltip.js +7 -4
- package/es6/components/Thumbnail/Thumbnail.js +17 -13
- package/es6/components/Tooltip/Tooltip.js +18 -12
- package/es6/components/VirtualizedMenu/VirtualizedMenuList.js +9 -11
- package/es6/foundation/config.js +77 -57
- package/es6/foundation/hooks/useAudio/useAudio.js +1 -1
- package/es6/foundation/hooks/useResizeObserver/useResizeObserver.js +10 -7
- package/es6/foundation/styles/opacity.js +6 -4
- package/es6/foundation/theme/useThemeProps.js +1 -1
- package/es6/foundation/utils/clearReactReferencesInNode.js +9 -7
- package/es6/foundation/utils/hasValue.js +1 -1
- package/es6/foundation/utils/index.js +0 -1
- package/es6/foundation/utils/isShowJunoWarning.js +0 -2
- package/es6/foundation/utils/withDeprecatedCheck.js +14 -15
- package/foundation/config.d.ts +23 -13
- package/foundation/config.js +78 -58
- package/foundation/hooks/useAudio/useAudio.d.ts +1 -1
- package/foundation/hooks/useAudio/useAudio.js +1 -1
- package/foundation/hooks/useResizeObserver/useResizeObserver.js +10 -7
- package/foundation/styles/opacity.js +6 -4
- package/foundation/theme/useThemeProps.d.ts +1 -1
- package/foundation/theme/useThemeProps.js +1 -1
- package/foundation/utils/clearReactReferencesInNode.js +9 -7
- package/foundation/utils/hasValue.js +1 -1
- package/foundation/utils/index.d.ts +0 -1
- package/foundation/utils/index.js +0 -1
- package/foundation/utils/isShowJunoWarning.d.ts +0 -1
- package/foundation/utils/isShowJunoWarning.js +0 -4
- package/foundation/utils/withDeprecatedCheck.d.ts +2 -2
- package/foundation/utils/withDeprecatedCheck.js +14 -15
- package/package.json +2 -2
|
@@ -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,
|
|
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(
|
|
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,
|
|
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(
|
|
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 (
|
|
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,
|
|
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,
|
|
39
|
+
? getWindow({ url: url, name: name, specs: specs, title: title })
|
|
40
40
|
: openExternalWindow(props);
|
|
41
41
|
if (!newWindow) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
.
|
|
30
|
-
|
|
31
|
-
|
|
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,
|
|
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(
|
|
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,
|
|
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
|
-
|
|
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,
|
|
@@ -180,116 +293,10 @@ var _RcDownshift = memo(forwardRef(function (inProps, ref) {
|
|
|
180
293
|
}
|
|
181
294
|
},
|
|
182
295
|
} }, getPopperProps(PopperProps)),
|
|
183
|
-
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))),
|
|
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, position: "unset" }, SuggestionListProps))),
|
|
184
297
|
isRenderNoOptions && (renderNoOptions === null || renderNoOptions === void 0 ? void 0 : renderNoOptions(getNoOptionsProps, noOptionItem)))));
|
|
185
298
|
}));
|
|
186
|
-
var RcDownshift = styled(
|
|
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;
|
|
@@ -17,8 +17,9 @@ var List = forwardRef(function (props, ref) {
|
|
|
17
17
|
return React.createElement("div", __assign({ ref: forkRef, "data-suggestion-list": true }, props));
|
|
18
18
|
});
|
|
19
19
|
var SuggestionList = forwardRef(function (inProps, ref) {
|
|
20
|
+
var _a;
|
|
20
21
|
var props = useThemeProps({ props: inProps, name: 'RcSuggestionList' });
|
|
21
|
-
var highlightedIndex = props.highlightedIndex, options = props.options, getItemProps = props.getItemProps, getMenuProps = props.getMenuProps, renderOption = props.renderOption, inputValue = props.inputValue, groupVariant = props.groupVariant, groupExpanded = props.groupExpanded, renderGroup = props.renderGroup, optionsGroupList = props.optionsGroupList, getOptionDisabled = props.getOptionDisabled, MenuItem = props.MenuItem, changeHighlightedIndexReason = props.changeHighlightedIndexReason, isKeepHighlightedIndex = props.isKeepHighlightedIndex, componentsProp = props.components, onUpdatePopper = props.onUpdatePopper, getOptionLabel = props.getOptionLabel, padding = props.padding,
|
|
22
|
+
var highlightedIndex = props.highlightedIndex, options = props.options, getItemProps = props.getItemProps, getMenuProps = props.getMenuProps, renderOption = props.renderOption, inputValue = props.inputValue, groupVariant = props.groupVariant, groupExpanded = props.groupExpanded, renderGroup = props.renderGroup, optionsGroupList = props.optionsGroupList, getOptionDisabled = props.getOptionDisabled, MenuItem = props.MenuItem, changeHighlightedIndexReason = props.changeHighlightedIndexReason, isKeepHighlightedIndex = props.isKeepHighlightedIndex, componentsProp = props.components, onUpdatePopper = props.onUpdatePopper, getOptionLabel = props.getOptionLabel, padding = props.padding, _b = props.maxContainerHeight, maxContainerHeight = _b === void 0 ? '100%' : _b, classNameProp = props.className, classesProp = props.classes, _c = props.position, position = _c === void 0 ? 'absolute' : _c, rest = __rest(props, ["highlightedIndex", "options", "getItemProps", "getMenuProps", "renderOption", "inputValue", "groupVariant", "groupExpanded", "renderGroup", "optionsGroupList", "getOptionDisabled", "MenuItem", "changeHighlightedIndexReason", "isKeepHighlightedIndex", "components", "onUpdatePopper", "getOptionLabel", "padding", "maxContainerHeight", "className", "classes", "position"]);
|
|
22
23
|
var vlRef = useRef(null);
|
|
23
24
|
var forkVlRef = useForkRef(ref, vlRef);
|
|
24
25
|
var isTitleMode = groupVariant === 'normal';
|
|
@@ -27,7 +28,7 @@ var SuggestionList = forwardRef(function (inProps, ref) {
|
|
|
27
28
|
var itemCount = options.length;
|
|
28
29
|
var classes = combineClasses(RcSuggestionListClasses, classesProp);
|
|
29
30
|
var className = clsx(classNameProp, classes === null || classes === void 0 ? void 0 : classes.root);
|
|
30
|
-
var
|
|
31
|
+
var _d = useDynamicHeight({
|
|
31
32
|
itemCount: itemCount,
|
|
32
33
|
maxContainerHeight: maxContainerHeight,
|
|
33
34
|
onContainerHeightChange: function (changeHeight) {
|
|
@@ -37,7 +38,7 @@ var SuggestionList = forwardRef(function (inProps, ref) {
|
|
|
37
38
|
onUpdatePopper === null || onUpdatePopper === void 0 ? void 0 : onUpdatePopper();
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
|
-
}), totalListHeightChanged =
|
|
41
|
+
}), totalListHeightChanged = _d.totalListHeightChanged, style = _d.style, containerHeighRef = _d.containerHeighRef;
|
|
41
42
|
var sleep = useSleep().sleep;
|
|
42
43
|
var scrollToIndexWithRetry = useRetry(function (location) { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
44
|
var toIndex, toElm;
|
|
@@ -66,10 +67,17 @@ var SuggestionList = forwardRef(function (inProps, ref) {
|
|
|
66
67
|
retryTimes: 10,
|
|
67
68
|
intervalTime: 20,
|
|
68
69
|
}).retry;
|
|
69
|
-
var
|
|
70
|
+
var _e = useHighlightScroll({
|
|
70
71
|
containerHeighRef: containerHeighRef,
|
|
71
72
|
scrollToIndex: scrollToIndexWithRetry,
|
|
72
|
-
}), scrollerRef =
|
|
73
|
+
}), scrollerRef = _e.scrollerRef, scrollerRefFn = _e.scrollerRefFn, itemsRendered = _e.itemsRendered, scrollToHighlightedIndex = _e.scrollToHighlightedIndex;
|
|
74
|
+
// for safari, prevent popover
|
|
75
|
+
var virtuosoViewPort = (_a = scrollerRef.current) === null || _a === void 0 ? void 0 : _a.firstElementChild;
|
|
76
|
+
useLayoutEffect(function () {
|
|
77
|
+
if (virtuosoViewPort) {
|
|
78
|
+
virtuosoViewPort.style.position = position;
|
|
79
|
+
}
|
|
80
|
+
}, [virtuosoViewPort, position]);
|
|
73
81
|
var prevHighlightedIndex = usePrevious(function () { return highlightedIndex; }, true);
|
|
74
82
|
useLayoutEffect(function () {
|
|
75
83
|
if (vlRef.current &&
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { isForwardRef } from 'react-is';
|
|
3
|
-
import {
|
|
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 (
|
|
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) {
|
|
@@ -2,7 +2,7 @@ import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
|
2
2
|
import React, { forwardRef, useMemo } from 'react';
|
|
3
3
|
import MuiCheckbox from '@material-ui/core/Checkbox';
|
|
4
4
|
import { Indeterminate as indeterminateIcon, Selects as selectIcon, Unselect as unSelectIcon, } from '@ringcentral/juno-icon';
|
|
5
|
-
import { combineClasses, styled,
|
|
5
|
+
import { combineClasses, styled, useDeprecatedCheck, useThemeProps, } from '../../../foundation';
|
|
6
6
|
import { withTooltip } from '../../Tooltip';
|
|
7
7
|
import { RcFormControlLabel } from '../FormControlLabel';
|
|
8
8
|
import { CustomIconPropsGetter } from '../utils';
|
|
@@ -15,6 +15,16 @@ var getIconProps = CustomIconPropsGetter({
|
|
|
15
15
|
});
|
|
16
16
|
var _RcCheckbox = forwardRef(function (inProps, ref) {
|
|
17
17
|
var props = useThemeProps({ props: inProps, name: 'RcCheckbox' });
|
|
18
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
19
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
20
|
+
useDeprecatedCheck(RcCheckbox, props, [
|
|
21
|
+
{
|
|
22
|
+
prop: 'iconSize',
|
|
23
|
+
time: '2021-4',
|
|
24
|
+
comment: "@deprecated using size to replace that",
|
|
25
|
+
},
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
18
28
|
var label = props.label, formControlLabelProps = props.formControlLabelProps, color = props.color, error = props.error, followColorWhenUnChecked = props.followColorWhenUnChecked, classesProp = props.classes, iconSize = props.iconSize, sizeProp = props.size, icon = props.icon, checkedIcon = props.checkedIcon, rest = __rest(props, ["label", "formControlLabelProps", "color", "error", "followColorWhenUnChecked", "classes", "iconSize", "size", "icon", "checkedIcon"]);
|
|
19
29
|
var size = sizeProp;
|
|
20
30
|
// TODO: switch to size
|
|
@@ -29,13 +39,7 @@ var _RcCheckbox = forwardRef(function (inProps, ref) {
|
|
|
29
39
|
}
|
|
30
40
|
return Checkbox;
|
|
31
41
|
});
|
|
32
|
-
var RcCheckbox = styled(
|
|
33
|
-
{
|
|
34
|
-
prop: 'iconSize',
|
|
35
|
-
time: '2021-4',
|
|
36
|
-
comment: "@deprecated using size to replace that",
|
|
37
|
-
},
|
|
38
|
-
], 'RcCheckbox'))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), CheckboxStyle);
|
|
42
|
+
var RcCheckbox = styled(withTooltip(_RcCheckbox))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), CheckboxStyle);
|
|
39
43
|
RcCheckbox.displayName = 'RcCheckbox';
|
|
40
44
|
RcCheckbox.defaultProps = {
|
|
41
45
|
color: 'interactive.f01',
|
|
@@ -6,7 +6,7 @@ import { useControlled } from '@material-ui/core/utils';
|
|
|
6
6
|
import { MuiPickersUtilsProvider, useUtils as useMuiUtils, } from '@material-ui/pickers';
|
|
7
7
|
import { findClosestEnabledDate as MuiFindClosestEnabledDate } from '@material-ui/pickers/_helpers/date-utils';
|
|
8
8
|
import { DateBorder } from '@ringcentral/juno-icon';
|
|
9
|
-
import { combineClasses, combineProps, omit, styled, useEventCallback, useThemeProps,
|
|
9
|
+
import { combineClasses, combineProps, omit, styled, useDeprecatedCheck, useEventCallback, useThemeProps, } from '../../../../foundation';
|
|
10
10
|
import { PickerTextField, } from '../utils';
|
|
11
11
|
import { Calendar } from './Calendar';
|
|
12
12
|
import { invalidateDateInRange, RcDatePickerClasses, ScreenReaderProvider, } from './utils';
|
|
@@ -110,26 +110,30 @@ var InnerRcDatePicker = forwardRef(function (props, ref) {
|
|
|
110
110
|
});
|
|
111
111
|
var _RcDatePicker = forwardRef(function (inProps, ref) {
|
|
112
112
|
var props = useThemeProps({ props: inProps, name: 'RcDatePicker' });
|
|
113
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
114
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
115
|
+
useDeprecatedCheck(RcDatePicker, props, [
|
|
116
|
+
{
|
|
117
|
+
prop: 'minDate',
|
|
118
|
+
time: '2021-3',
|
|
119
|
+
comment: "Min date @DateIOType, using min instead ",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
prop: 'maxDate',
|
|
123
|
+
time: '2021-3',
|
|
124
|
+
comment: "Max date @DateIOType, using max instead ",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
prop: 'date',
|
|
128
|
+
time: '2021-3',
|
|
129
|
+
comment: "please use value to replace that ",
|
|
130
|
+
},
|
|
131
|
+
]);
|
|
132
|
+
}
|
|
113
133
|
return (React.createElement(MuiPickersUtilsProvider, { utils: MomentUtils, locale: props.locale, libInstance: moment },
|
|
114
134
|
React.createElement(InnerRcDatePicker, __assign({ ref: ref }, props))));
|
|
115
135
|
});
|
|
116
|
-
var RcDatePicker = styled(
|
|
117
|
-
{
|
|
118
|
-
prop: 'minDate',
|
|
119
|
-
time: '2021-3',
|
|
120
|
-
comment: "Min date @DateIOType, using min instead ",
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
prop: 'maxDate',
|
|
124
|
-
time: '2021-3',
|
|
125
|
-
comment: "Max date @DateIOType, using max instead ",
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
prop: 'date',
|
|
129
|
-
time: '2021-3',
|
|
130
|
-
comment: "please use value to replace that ",
|
|
131
|
-
},
|
|
132
|
-
], 'RcDatePicker'))(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
136
|
+
var RcDatePicker = styled(_RcDatePicker)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
133
137
|
RcDatePicker.defaultProps = {
|
|
134
138
|
clearBtn: true,
|
|
135
139
|
formatString: DEFAULT_FORMAT,
|