@ringcentral/juno 2.15.0 → 2.17.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/components/Downshift/Downshift.d.ts +9 -1
- package/components/Downshift/Downshift.js +26 -9
- package/components/Downshift/SuggestionList/SuggestionList.d.ts +13 -1
- package/components/Downshift/SuggestionList/SuggestionList.js +6 -4
- package/components/Downshift/styles/StyledPopper.d.ts +10 -5
- package/components/Downshift/styles/StyledPopper.js +2 -2
- package/components/Downshift/utils/useDownshift.d.ts +1 -0
- package/components/Downshift/utils/useDownshift.js +3 -0
- package/components/List/ListItem/ListItem.d.ts +3 -1
- package/components/List/ListItem/ListItem.js +3 -2
- package/components/List/ListItem/styles/ListItemStyle.d.ts +5 -0
- package/components/List/ListItem/styles/ListItemStyle.js +17 -5
- package/components/List/ListItem/utils/ListItemUtils.d.ts +2 -0
- package/components/List/ListItem/utils/ListItemUtils.js +5 -4
- package/components/Menu/MenuItem/MenuItem.d.ts +7 -6
- package/components/Menu/MenuItem/MenuItem.js +14 -4
- package/components/Menu/MenuItem/styles/MenuItemStyle.js +6 -3
- package/components/Menu/MenuItem/utils/MenuItemUtils.d.ts +4 -1
- package/components/Menu/MenuItem/utils/MenuItemUtils.js +4 -1
- package/components/Menu/MenuOption/styles/StyledMenuOption.d.ts +1 -1
- package/components/Menu/SubMenu/SubMenu.d.ts +1 -1
- package/components/Menu/SubMenu/utils/SubMenuUtils.d.ts +1 -1
- package/components/TablePagination/styles/TablePaginationStyle.d.ts +4 -4
- package/components/Text/index.d.ts +0 -1
- package/components/Text/index.js +0 -1
- package/components/index.d.ts +0 -1
- package/components/index.js +0 -1
- package/es6/components/Downshift/Downshift.js +27 -10
- package/es6/components/Downshift/SuggestionList/SuggestionList.js +6 -4
- package/es6/components/Downshift/styles/StyledPopper.js +2 -2
- package/es6/components/Downshift/utils/useDownshift.js +3 -0
- package/es6/components/List/ListItem/ListItem.js +3 -2
- package/es6/components/List/ListItem/styles/ListItemStyle.js +19 -7
- package/es6/components/List/ListItem/utils/ListItemUtils.js +4 -3
- package/es6/components/Menu/MenuItem/MenuItem.js +16 -6
- package/es6/components/Menu/MenuItem/styles/MenuItemStyle.js +10 -7
- package/es6/components/Menu/MenuItem/utils/MenuItemUtils.js +4 -1
- package/es6/components/Text/index.js +0 -1
- package/es6/components/index.js +0 -1
- package/foundation/theme/ThemeHandler.d.ts +1 -1
- package/foundation/theme/ThemeSwitcherProvider/ThemeSwitcherProvider.d.ts +2 -2
- package/package.json +1 -1
- package/components/Autocomplete/Autocomplete.d.ts +0 -4
- package/components/Autocomplete/Autocomplete.js +0 -7
- package/components/Autocomplete/index.d.ts +0 -1
- package/components/Autocomplete/index.js +0 -4
- package/components/Grid/deprecated/Grid.d.ts +0 -6
- package/components/Grid/deprecated/Grid.js +0 -8
- package/components/Grid/deprecated/index.d.ts +0 -1
- package/components/Grid/deprecated/index.js +0 -4
- package/components/ImageView/ImageView.d.ts +0 -311
- package/components/ImageView/ImageView.js +0 -206
- package/components/ImageView/index.d.ts +0 -1
- package/components/ImageView/index.js +0 -4
- package/components/Tables/Table.d.ts +0 -34
- package/components/Tables/Table.js +0 -31
- package/components/Tables/TableBodyCellContent.d.ts +0 -10
- package/components/Tables/TableBodyCellContent.js +0 -16
- package/components/Tables/TableHead.d.ts +0 -4
- package/components/Tables/TableHead.js +0 -18
- package/components/Tables/TableHeadCell.d.ts +0 -4
- package/components/Tables/TableHeadCell.js +0 -64
- package/components/Tables/TableRow.d.ts +0 -3
- package/components/Tables/TableRow.js +0 -6
- package/components/Tables/index.d.ts +0 -7
- package/components/Tables/index.js +0 -10
- package/components/Tables/styled.d.ts +0 -24
- package/components/Tables/styled.js +0 -46
- package/components/Tables/types.d.ts +0 -60
- package/components/Tables/types.js +0 -49
- package/components/Text/TextWithEllipsis.d.ts +0 -6
- package/components/Text/TextWithEllipsis.js +0 -21
- package/components/TextWithHighlight/TextWithHighlight.d.ts +0 -6
- package/components/TextWithHighlight/TextWithHighlight.js +0 -20
- package/components/TextWithHighlight/index.d.ts +0 -1
- package/components/TextWithHighlight/index.js +0 -4
- package/components/TextWithLink/TextWithLink.d.ts +0 -14
- package/components/TextWithLink/TextWithLink.js +0 -31
- package/components/TextWithLink/index.d.ts +0 -1
- package/components/TextWithLink/index.js +0 -4
- package/components/TextWithTooltip/TextWithTooltip.d.ts +0 -8
- package/components/TextWithTooltip/TextWithTooltip.js +0 -35
- package/components/TextWithTooltip/index.d.ts +0 -1
- package/components/TextWithTooltip/index.js +0 -4
- package/es6/components/Autocomplete/Autocomplete.js +0 -4
- package/es6/components/Autocomplete/index.js +0 -1
- package/es6/components/Grid/deprecated/Grid.js +0 -6
- package/es6/components/Grid/deprecated/index.js +0 -1
- package/es6/components/ImageView/ImageView.js +0 -204
- package/es6/components/ImageView/index.js +0 -1
- package/es6/components/Tables/Table.js +0 -29
- package/es6/components/Tables/TableBodyCellContent.js +0 -14
- package/es6/components/Tables/TableHead.js +0 -15
- package/es6/components/Tables/TableHeadCell.js +0 -62
- package/es6/components/Tables/TableRow.js +0 -4
- package/es6/components/Tables/index.js +0 -7
- package/es6/components/Tables/styled.js +0 -38
- package/es6/components/Tables/types.js +0 -41
- package/es6/components/Text/TextWithEllipsis.js +0 -19
- package/es6/components/TextWithHighlight/TextWithHighlight.js +0 -18
- package/es6/components/TextWithHighlight/index.js +0 -1
- package/es6/components/TextWithLink/TextWithLink.js +0 -29
- package/es6/components/TextWithLink/index.js +0 -1
- package/es6/components/TextWithTooltip/TextWithTooltip.js +0 -33
- package/es6/components/TextWithTooltip/index.js +0 -1
|
@@ -9,6 +9,7 @@ var DEFAULT_HIGHLIGHTED_INDEX = -1;
|
|
|
9
9
|
export var useDownshift = function (_a) {
|
|
10
10
|
var multipleProp = _a.multiple, variant = _a.variant, labelProp = _a.label, inputValueProp = _a.inputValue, _b = _a.getOptionLabel, getOptionLabel = _b === void 0 ? DEFAULT_GET_OPTION_LABEL : _b, _c = _a.keyToTags, keyToTags = _c === void 0 ? DEFAULT_KEY_TO_CHIPS : _c, filterOptionsProp = _a.filterOptions, disabledItemsHighlightable = _a.disabledItemsHighlightable, options = _a.options, freeSolo = _a.freeSolo, onInputChangeProp = _a.onInputChange, maxFreeSolo = _a.maxFreeSolo, onMaxFreeSolo = _a.onMaxFreeSolo, openOnFocus = _a.openOnFocus, disableCloseOnSelect = _a.disableCloseOnSelect, initialIsOpen = _a.initialIsOpen, autoSelect = _a.autoSelect, inputContainerRef = _a.inputContainerRef, inputRef = _a.inputRef, wrapperRef = _a.wrapperRef, onKeyDownProp = _a.onKeyDown, onSelectChange = _a.onChange, _d = _a.value, selectedItemsProp = _d === void 0 ? [] : _d, disabled = _a.disabled, renderNoOptions = _a.renderNoOptions, onClear = _a.onClear, autoHighlight = _a.autoHighlight, getOptionDisabled = _a.getOptionDisabled, addNoOptionItem = _a.addNoOptionItem, groupBy = _a.groupBy, onGroupExpanded = _a.onGroupExpanded, groupVariant = _a.groupVariant, groupExpanded = _a.groupExpanded, groupDefaultExpanded = _a.groupDefaultExpanded, getExpandIconProps = _a.getExpandIconProps, required = _a.required, openProp = _a.open, onOpen = _a.onOpen, onClose = _a.onClose, focused = _a.focused;
|
|
11
11
|
var isAutocomplete = variant === 'autocomplete';
|
|
12
|
+
var autoCompleteSelectedIndexRef = useRef(DEFAULT_HIGHLIGHTED_INDEX);
|
|
12
13
|
var downshiftId = useId('downshift', true);
|
|
13
14
|
var _e = __read(useControlled({
|
|
14
15
|
controlled: focused,
|
|
@@ -235,6 +236,7 @@ export var useDownshift = function (_a) {
|
|
|
235
236
|
var fIndex = optionItems.findIndex(function (x) { return getOptionLabel(x) === itemText_1; });
|
|
236
237
|
if (fIndex > -1) {
|
|
237
238
|
toIndex = fIndex;
|
|
239
|
+
autoCompleteSelectedIndexRef.current = fIndex;
|
|
238
240
|
}
|
|
239
241
|
}
|
|
240
242
|
setHighlightedIndex(toIndex, { reason: 'auto' });
|
|
@@ -518,5 +520,6 @@ export var useDownshift = function (_a) {
|
|
|
518
520
|
focused: focused !== null && focused !== void 0 ? focused : (tagFocused || inputFocused ? true : undefined),
|
|
519
521
|
id: downshiftId,
|
|
520
522
|
inputChanged: isInputValueChangedRef.current,
|
|
523
|
+
autoCompleteSelectedIndex: autoCompleteSelectedIndexRef.current,
|
|
521
524
|
};
|
|
522
525
|
};
|
|
@@ -23,14 +23,15 @@ var _RcListItem = forwardRef(function (inProps, ref) {
|
|
|
23
23
|
},
|
|
24
24
|
]);
|
|
25
25
|
}
|
|
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"]);
|
|
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, focused = props.focused, rest = __rest(props, ["classes", "color", "TouchRippleProps", "children", "className", "singleLine", "button", "size", "canHover", "isInline", "baseColor", "title", "highlighted", "maxWidth", "focused"]);
|
|
27
27
|
var classes = useMemo(function () { return combineClasses(RcListItemClasses, classesProp); }, [classesProp]);
|
|
28
28
|
var ListItemClassName = useMemo(function () {
|
|
29
29
|
var _a;
|
|
30
30
|
return clsx(className, (_a = {},
|
|
31
31
|
_a[RcListItemMultilineClassName] = !singleLine,
|
|
32
|
+
_a[classes.focusVisible] = focused,
|
|
32
33
|
_a));
|
|
33
|
-
}, [className, singleLine]);
|
|
34
|
+
}, [className, singleLine, classes, focused]);
|
|
34
35
|
// * when not button can't have TouchRippleProps
|
|
35
36
|
var additionProps = useMemo(function () {
|
|
36
37
|
return button
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css, getParsePaletteColor, nonTouchHoverMedia, palette2, px, setAlpha, setOpacity, spacing, typography, } from '../../../../foundation';
|
|
1
|
+
import { __assign, __makeTemplateObject } from "tslib";
|
|
2
|
+
import { css, focusVisible, getParsePaletteColor, nonTouchHoverMedia, palette2, px, setAlpha, setOpacity, spacing, typography, } from '../../../../foundation';
|
|
3
3
|
import { RcFormControlLabel } from '../../../Forms/FormControlLabel';
|
|
4
4
|
import { RcSwitch } from '../../../Forms/Switch';
|
|
5
5
|
import { colorMap, RcListItemClasses, RcListItemRippleClasses, RcListItemTopAndBottomPaddings, } from '../utils';
|
|
6
6
|
export var ListItemFormControlStyle = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", " {\n margin-right: 0;\n\n > ", " {\n /** The DOM structure of Switch is special,\n should remove this after fix Switch as common control */\n margin-left: ", ";\n margin-right: ", ";\n }\n }\n"], ["\n ", " {\n margin-right: 0;\n\n > ", " {\n /** The DOM structure of Switch is special,\n should remove this after fix Switch as common control */\n margin-left: ", ";\n margin-right: ", ";\n }\n }\n"])), RcFormControlLabel, RcSwitch, spacing(1), spacing(1));
|
|
7
|
-
export var
|
|
8
|
-
var
|
|
7
|
+
export var sharedListItemStyle = function (_a) {
|
|
8
|
+
var highlighted = _a.highlighted, color = _a.color, canHover = _a.canHover, _b = _a.baseColor, baseColorProp = _b === void 0 ? 'black' : _b, mainClasses = _a.mainClasses, rippleClasses = _a.rippleClasses;
|
|
9
9
|
var baseColor = getParsePaletteColor(color !== null && color !== void 0 ? color : colorMap[baseColorProp]);
|
|
10
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", ";\n color: ", ";\n\n ", ";\n\n ", ",\n &.", " {\n background-color: ", ";\n }\n\n ", " {\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", " {\n &,\n &:hover {\n background-color: ", ";\n }\n }\n\n .", " {\n color: ", ";\n }\n\n ", ";\n "], ["\n ", ";\n color: ", ";\n\n ",
|
|
11
|
+
";\n\n "
|
|
12
|
+
// that for menuItem, because in current version of menuItem that not support focused classes
|
|
13
|
+
// TODO: that can be remove after upgrade to V5
|
|
14
|
+
,
|
|
15
|
+
",\n &.", " {\n background-color: ", ";\n }\n\n ", " {\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", " {\n &,\n &:hover {\n background-color: ", ";\n }\n }\n\n .", " {\n color: ", ";\n }\n\n ", ";\n "])), typography('body1'), palette2('neutral', 'f06'), highlighted && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n "], ["\n background-color: ", ";\n "])), setAlpha(baseColor, 0.05)),
|
|
16
|
+
// that for menuItem, because in current version of menuItem that not support focused classes
|
|
17
|
+
// TODO: that can be remove after upgrade to V5
|
|
18
|
+
focusVisible, mainClasses.focusVisible, setOpacity(baseColor, '16'), nonTouchHoverMedia, canHover ? setOpacity(baseColor, '08') : 'unset', mainClasses.selected, setOpacity(baseColor, '12'), rippleClasses.rippleVisible, baseColor, ListItemFormControlStyle);
|
|
19
|
+
};
|
|
20
|
+
export var ListItemStyle = function (props) {
|
|
21
|
+
var maxWidth = props.maxWidth, isInline = props.isInline, size = props.size, onClick = props.onClick;
|
|
10
22
|
var defaultPadding = RcListItemTopAndBottomPaddings[size];
|
|
11
|
-
return css(
|
|
12
|
-
";\n\n &.", " {\n
|
|
23
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n display: ", ";\n cursor: ", ";\n\n ", ";\n\n &.", " {\n padding-left: ", ";\n padding-right: ", ";\n }\n\n &.", " {\n padding-top: ", ";\n padding-bottom: ", ";\n }\n "], ["\n width: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n display: ", ";\n cursor: ", ";\n\n ",
|
|
24
|
+
";\n\n &.", " {\n padding-left: ", ";\n padding-right: ", ";\n }\n\n &.", " {\n padding-top: ", ";\n padding-bottom: ", ";\n }\n "])), maxWidth ? px(maxWidth) : '100%', defaultPadding, defaultPadding, isInline ? 'inline-flex' : 'flex', onClick ? 'pointer' : 'default', sharedListItemStyle(__assign(__assign({}, props), { mainClasses: RcListItemClasses, rippleClasses: RcListItemRippleClasses })), RcListItemClasses.gutters, spacing(4), spacing(4), RcListItemClasses.dense, spacing(1), spacing(1));
|
|
13
25
|
};
|
|
14
|
-
var templateObject_1, templateObject_2, templateObject_3;
|
|
26
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { RcClasses, spacing, } from '../../../../foundation';
|
|
2
|
-
var RcListItemPrefix = 'RcListItem';
|
|
2
|
+
export var RcListItemPrefix = 'RcListItem';
|
|
3
|
+
export var RcListItemRipplePrefix = RcListItemPrefix + "TouchRipple";
|
|
3
4
|
export var RcListItemMultilineClassName = RcListItemPrefix + "-multiline";
|
|
4
|
-
export var RcListItemClasses = RcClasses(['
|
|
5
|
+
export var RcListItemClasses = RcClasses(['gutters', 'dense', 'selected', 'focusVisible'], RcListItemPrefix);
|
|
5
6
|
export var RcListItemTopAndBottomPaddings = {
|
|
6
7
|
small: spacing(1),
|
|
7
8
|
medium: spacing(1.25),
|
|
@@ -11,4 +12,4 @@ export var colorMap = {
|
|
|
11
12
|
secondary: 'highlight.f02',
|
|
12
13
|
black: 'action.grayLight',
|
|
13
14
|
};
|
|
14
|
-
export var RcListItemRippleClasses = RcClasses(['rippleVisible'],
|
|
15
|
+
export var RcListItemRippleClasses = RcClasses(['rippleVisible'], RcListItemRipplePrefix);
|
|
@@ -3,7 +3,7 @@ import React, { forwardRef, useContext, useImperativeHandle, useMemo, } from 're
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import MuiMenuItem from '@material-ui/core/MenuItem';
|
|
5
5
|
import { Check as checkSvg } from '@ringcentral/juno-icon';
|
|
6
|
-
import { combineClasses, isRcElement, logInDev, omit, styled, useEventCallback, useId, useThemeProps, } from '../../../foundation';
|
|
6
|
+
import { combineClasses, isRcElement, logInDev, omit, styled, useEventCallback, useId, useThemeProps, combineProps, } from '../../../foundation';
|
|
7
7
|
import { RcIcon } from '../../Icon';
|
|
8
8
|
import { RcListItemSecondaryAction } from '../../List';
|
|
9
9
|
import { RcListItemAvatar } from '../../List/ListItemAvatar';
|
|
@@ -13,11 +13,11 @@ import { RcMenuContext } from '../Menu/MenuContext';
|
|
|
13
13
|
import { RcMenuListContext } from '../MenuList/MenuListContext';
|
|
14
14
|
import { RcSubMenuContext } from '../SubMenu/SubMenuContext';
|
|
15
15
|
import { MenuItemStyle, StyledCheckIcon } from './styles';
|
|
16
|
-
import { RcMenuItemClasses } from './utils';
|
|
16
|
+
import { RcMenuItemClasses, RcMenuItemRippleClasses } from './utils';
|
|
17
17
|
var _RcMenuItem = forwardRef(function (inProps, ref) {
|
|
18
18
|
var _a;
|
|
19
19
|
var props = useThemeProps({ props: inProps, name: 'RcMenuItem' });
|
|
20
|
-
var classesProp = props.classes, children = props.children, className = props.className, onMouseEnter = props.onMouseEnter, onClick = props.onClick, onFocus = props.onFocus, size = props.size, type = props.type, checked = props.checked, icon = props.icon, symbol = props.symbol, avatar = props.avatar, secondaryAction = props.secondaryAction, idRef = props.idRef, isSubMenuItem = props.isSubMenuItem, title = props.title, rest = __rest(props, ["classes", "children", "className", "onMouseEnter", "onClick", "onFocus", "size", "type", "checked", "icon", "symbol", "avatar", "secondaryAction", "idRef", "isSubMenuItem", "title"]);
|
|
20
|
+
var classesProp = props.classes, children = props.children, color = props.color, button = props.button, className = props.className, onMouseEnter = props.onMouseEnter, onClick = props.onClick, onFocus = props.onFocus, highlighted = props.highlighted, size = props.size, type = props.type, checked = props.checked, icon = props.icon, symbol = props.symbol, avatar = props.avatar, secondaryAction = props.secondaryAction, idRef = props.idRef, isSubMenuItem = props.isSubMenuItem, TouchRipplePropsProp = props.TouchRippleProps, title = props.title, focused = props.focused, rest = __rest(props, ["classes", "children", "color", "button", "className", "onMouseEnter", "onClick", "onFocus", "highlighted", "size", "type", "checked", "icon", "symbol", "avatar", "secondaryAction", "idRef", "isSubMenuItem", "TouchRippleProps", "title", "focused"]);
|
|
21
21
|
var isCheckedType = type === 'checked';
|
|
22
22
|
var menuItemId = useId('menu-item', true);
|
|
23
23
|
var menuContext = useContext(RcMenuContext);
|
|
@@ -34,7 +34,7 @@ var _RcMenuItem = forwardRef(function (inProps, ref) {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
var classes = useMemo(function () { return combineClasses(RcMenuItemClasses, classesProp); }, [classesProp]);
|
|
37
|
-
var toClasses = useMemo(function () { return omit(classes, ['checked', 'unchecked']); }, [classes]);
|
|
37
|
+
var toClasses = useMemo(function () { return omit(classes, ['checked', 'unchecked', 'focusVisible']); }, [classes]);
|
|
38
38
|
var itemAvatar = useMemo(function () {
|
|
39
39
|
if (React.isValidElement(avatar)) {
|
|
40
40
|
return isRcElement(avatar, ['RcListItemAvatar']) ? (avatar) : (React.createElement(RcListItemAvatar, null, avatar));
|
|
@@ -68,6 +68,14 @@ var _RcMenuItem = forwardRef(function (inProps, ref) {
|
|
|
68
68
|
}
|
|
69
69
|
return secondaryAction ? (isRcElement(secondaryAction, ['RcListItemSecondaryAction']) ? (secondaryAction) : (React.createElement(RcListItemSecondaryAction, null, secondaryAction))) : null;
|
|
70
70
|
}, [checked, isCheckedType, secondaryAction]);
|
|
71
|
+
// * when not button can't have TouchRippleProps
|
|
72
|
+
var additionProps = useMemo(function () {
|
|
73
|
+
return button
|
|
74
|
+
? {
|
|
75
|
+
TouchRippleProps: combineProps({ classes: RcMenuItemRippleClasses }, TouchRipplePropsProp),
|
|
76
|
+
}
|
|
77
|
+
: {};
|
|
78
|
+
}, [TouchRipplePropsProp, button]);
|
|
71
79
|
var handleMouseEnter = useEventCallback(function (e) {
|
|
72
80
|
onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(e);
|
|
73
81
|
setFocusedMenuItemId();
|
|
@@ -87,10 +95,11 @@ var _RcMenuItem = forwardRef(function (inProps, ref) {
|
|
|
87
95
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
88
96
|
});
|
|
89
97
|
useImperativeHandle(idRef, function () { return menuItemId; }, [menuItemId]);
|
|
90
|
-
return (React.createElement(MuiMenuItem, __assign({ "aria-checked": isCheckedType && checked ? true : undefined }, rest, { ref: ref, title: typeof title === 'string' ? title : undefined, classes: toClasses, className: clsx(className, (_a = {},
|
|
98
|
+
return (React.createElement(MuiMenuItem, __assign({ "aria-checked": isCheckedType && checked ? true : undefined }, additionProps, rest, { ref: ref, title: typeof title === 'string' ? title : undefined, classes: toClasses, className: clsx(className, (_a = {},
|
|
91
99
|
_a[classes.checked] = isCheckedType && checked,
|
|
92
100
|
_a[classes.unchecked] = isCheckedType && !checked,
|
|
93
|
-
_a
|
|
101
|
+
_a[classes.focusVisible] = focused,
|
|
102
|
+
_a)), onMouseEnter: handleMouseEnter, onClick: handleClick, onFocus: handleFocus, "data-menuitem-id": menuItemId, button: button }),
|
|
94
103
|
itemAvatar,
|
|
95
104
|
itemIcon,
|
|
96
105
|
children,
|
|
@@ -99,6 +108,7 @@ var _RcMenuItem = forwardRef(function (inProps, ref) {
|
|
|
99
108
|
var RcMenuItem = styled(withTooltip(_RcMenuItem))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), MenuItemStyle);
|
|
100
109
|
RcMenuItem.defaultProps = {
|
|
101
110
|
size: 'medium',
|
|
111
|
+
button: true,
|
|
102
112
|
};
|
|
103
113
|
RcMenuItem.displayName = 'RcMenuItem';
|
|
104
114
|
export { RcMenuItem };
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css,
|
|
1
|
+
import { __assign, __makeTemplateObject } from "tslib";
|
|
2
|
+
import { css, spacing, styled } from '../../../../foundation';
|
|
3
3
|
import { RcIcon } from '../../../Icon';
|
|
4
|
-
import {
|
|
5
|
-
import { RcMenuItemClasses, RcMenuItemLeftAndRightPaddings, RcMenuItemTopAndBottomPaddings, } from '../utils';
|
|
4
|
+
import { sharedListItemStyle } from '../../../List/ListItem/styles';
|
|
5
|
+
import { RcMenuItemClasses, RcMenuItemLeftAndRightPaddings, RcMenuItemRippleClasses, RcMenuItemTopAndBottomPaddings, } from '../utils';
|
|
6
6
|
export var StyledCheckIcon = styled(RcIcon)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 22px;\n"], ["\n height: 22px;\n"])));
|
|
7
|
-
export var MenuItemStyle = function (
|
|
8
|
-
var size = _a.
|
|
7
|
+
export var MenuItemStyle = function (props) {
|
|
8
|
+
var size = props.size, _a = props.color, color = _a === void 0 ? 'action.grayLight' : _a;
|
|
9
9
|
var topAndBottomPadding = RcMenuItemTopAndBottomPaddings[size];
|
|
10
10
|
var leftAndRightPadding = RcMenuItemLeftAndRightPaddings[size];
|
|
11
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n outline: none;\n box-sizing: border-box;\n
|
|
11
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n outline: none;\n box-sizing: border-box;\n height: auto;\n min-height: 32px;\n min-width: 112px;\n padding-top: ", ";\n padding-bottom: ", ";\n\n ", ";\n\n .", " {\n padding-left: ", ";\n padding-right: ", ";\n }\n\n &.", " {\n padding-top: ", ";\n padding-bottom: ", ";\n min-height: auto;\n line-height: 22px;\n font-weight: 700;\n }\n "], ["\n outline: none;\n box-sizing: border-box;\n height: auto;\n min-height: 32px;\n min-width: 112px;\n padding-top: ", ";\n padding-bottom: ", ";\n\n ",
|
|
12
|
+
";\n\n .", " {\n padding-left: ", ";\n padding-right: ", ";\n }\n\n &.", " {\n padding-top: ", ";\n padding-bottom: ", ";\n min-height: auto;\n line-height: 22px;\n font-weight: 700;\n }\n "])), topAndBottomPadding, topAndBottomPadding, sharedListItemStyle(__assign(__assign({}, props), { color: color,
|
|
13
|
+
// in menuItem always be can hover
|
|
14
|
+
canHover: true, mainClasses: RcMenuItemClasses, rippleClasses: RcMenuItemRippleClasses })), RcMenuItemClasses.gutters, leftAndRightPadding, leftAndRightPadding, RcMenuItemClasses.dense, spacing(1), spacing(1));
|
|
12
15
|
};
|
|
13
16
|
var templateObject_1, templateObject_2;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { RcClasses, spacing } from '../../../../foundation';
|
|
2
|
-
export var
|
|
2
|
+
export var RcMenuItemPrefix = 'RcMenuItem';
|
|
3
|
+
export var RcMenuItemRipplePrefix = RcMenuItemPrefix + "TouchRipple";
|
|
4
|
+
export var RcMenuItemClasses = RcClasses(['checked', 'unchecked', 'gutters', 'dense', 'selected', 'focusVisible'], RcMenuItemPrefix);
|
|
3
5
|
export var RcMenuItemTopAndBottomPaddings = {
|
|
4
6
|
medium: spacing(1),
|
|
5
7
|
large: spacing(2),
|
|
@@ -8,3 +10,4 @@ export var RcMenuItemLeftAndRightPaddings = {
|
|
|
8
10
|
medium: spacing(4),
|
|
9
11
|
large: spacing(5),
|
|
10
12
|
};
|
|
13
|
+
export var RcMenuItemRippleClasses = RcClasses(['rippleVisible'], RcMenuItemRipplePrefix);
|
package/es6/components/index.js
CHANGED
|
@@ -15,7 +15,7 @@ export declare class RcThemeHandler {
|
|
|
15
15
|
setTheme(themeOptions: RcThemeInput, isEmit?: boolean): RcTheme;
|
|
16
16
|
/** Set Theme Name with read static json file */
|
|
17
17
|
setThemeName(name: string): Promise<void>;
|
|
18
|
-
read(theme: string): Promise<import("type-fest/source/partial-deep").PartialObjectDeep<Pick<RcTheme, "direction" | "opacity" | "radius" | "props" | "palette" | "typography" | "shape" | "breakpoints" | "mixins" | "overrides" | "shadows" | "transitions" | "zIndex" | "unstable_strictMode"
|
|
18
|
+
read(theme: string): Promise<import("type-fest/source/partial-deep").PartialObjectDeep<Pick<RcTheme, "direction" | "opacity" | "radius" | "props" | "palette" | "typography" | "shape" | "breakpoints" | "mixins" | "overrides" | "shadows" | "transitions" | "zIndex" | "unstable_strictMode">, {}>>;
|
|
19
19
|
loadUrl(url: string): Promise<RcThemeInput>;
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
2
|
import { RcThemeSwitcherProviderProps } from './ThemeContext';
|
|
3
|
-
export declare const RcDefaultDarkTheme: import("type-fest/source/partial-deep").PartialObjectDeep<Pick<import("../theme.type").RcTheme, "direction" | "opacity" | "radius" | "props" | "palette" | "typography" | "shape" | "breakpoints" | "mixins" | "overrides" | "shadows" | "transitions" | "zIndex" | "unstable_strictMode"
|
|
4
|
-
export declare const RcDefaultHighContrastTheme: import("type-fest/source/partial-deep").PartialObjectDeep<Pick<import("../theme.type").RcTheme, "direction" | "opacity" | "radius" | "props" | "palette" | "typography" | "shape" | "breakpoints" | "mixins" | "overrides" | "shadows" | "transitions" | "zIndex" | "unstable_strictMode"
|
|
3
|
+
export declare const RcDefaultDarkTheme: import("type-fest/source/partial-deep").PartialObjectDeep<Pick<import("../theme.type").RcTheme, "direction" | "opacity" | "radius" | "props" | "palette" | "typography" | "shape" | "breakpoints" | "mixins" | "overrides" | "shadows" | "transitions" | "zIndex" | "unstable_strictMode">, {}>;
|
|
4
|
+
export declare const RcDefaultHighContrastTheme: import("type-fest/source/partial-deep").PartialObjectDeep<Pick<import("../theme.type").RcTheme, "direction" | "opacity" | "radius" | "props" | "palette" | "typography" | "shape" | "breakpoints" | "mixins" | "overrides" | "shadows" | "transitions" | "zIndex" | "unstable_strictMode">, {}>;
|
|
5
5
|
export declare const RcThemeSwitcherDefaultTheme: {
|
|
6
6
|
defaultTheme: string;
|
|
7
7
|
themeMap: {
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var Autocomplete_1 = tslib_1.__importDefault(require("@material-ui/lab/Autocomplete"));
|
|
5
|
-
/** @deprecated should use `RcDownshift` to replace that */
|
|
6
|
-
var RcAutocomplete = Autocomplete_1.default;
|
|
7
|
-
exports.RcAutocomplete = RcAutocomplete;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Autocomplete';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
-
var Grid_1 = tslib_1.__importDefault(require("@material-ui/core/Grid"));
|
|
6
|
-
exports.RcGrid = react_1.default.memo(function (props) { return react_1.default.createElement(Grid_1.default, tslib_1.__assign({}, props)); });
|
|
7
|
-
exports.RcGrid.displayName = 'RcGrid';
|
|
8
|
-
exports.RcGrid.dependencies = [exports.RcGrid];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Grid';
|