@ringcentral/juno 2.7.0 → 2.9.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/Buttons/IconButton/IconButton.js +5 -2
- package/components/Buttons/IconButton/styles/StyledIconButton.js +22 -17
- package/es6/components/Buttons/IconButton/IconButton.js +5 -2
- package/es6/components/Buttons/IconButton/styles/StyledIconButton.js +23 -18
- package/es6/foundation/theme/assets/palette.light.json +3 -3
- package/foundation/theme/assets/palette.light.json +3 -3
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ var _RcIconButton = react_1.memo(react_1.forwardRef(function (inProps, ref) {
|
|
|
17
17
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
18
18
|
foundation_1.useDeprecatedCheck(RcIconButton, props, IconButtonProps_1.rcIconButtonWarning);
|
|
19
19
|
}
|
|
20
|
-
var _b = props.buttonRef, buttonRef = _b === void 0 ? ref : _b,
|
|
20
|
+
var _b = props.buttonRef, buttonRef = _b === void 0 ? ref : _b, _c = props.IconProps, IconProps = _c === void 0 ? {} : _c, className = props.className, classesProp = props.classes, children = props.children, title = props.title, disabledFakeBorder = props.disabledFakeBorder, 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 = tslib_1.__rest(props, ["buttonRef", "IconProps", "className", "classes", "children", "title", "disabledFakeBorder", "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"]);
|
|
21
21
|
var theme = foundation_1.useTheme();
|
|
22
22
|
var isOutline = variant === 'outline';
|
|
23
23
|
var isContained = variant === 'contained';
|
|
@@ -33,7 +33,10 @@ var _RcIconButton = react_1.memo(react_1.forwardRef(function (inProps, ref) {
|
|
|
33
33
|
_a));
|
|
34
34
|
var iconButton = (function () {
|
|
35
35
|
var _a, _b;
|
|
36
|
-
|
|
36
|
+
// `color` already handle in StyledIconButton
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
38
|
+
var color = IconProps.color, IconPropsWithoutColor = tslib_1.__rest(IconProps, ["color"]);
|
|
39
|
+
var icon = react_1.default.isValidElement(children) || children === '' ? children : (react_1.default.createElement(Icon_1.RcIcon, tslib_1.__assign({ symbol: symbol, className: classes.icon, loading: loading, size: "inherit", CircularProgressProps: CircularProgressProps }, IconPropsWithoutColor), children));
|
|
37
40
|
var iconButton = (react_1.default.createElement(ButtonBase_1.RcButtonBase, tslib_1.__assign({ ref: buttonRef, disableRipple: ((_b = (_a = theme.props) === null || _a === void 0 ? void 0 : _a.MuiButtonBase) === null || _b === void 0 ? void 0 : _b.disableRipple) || isPlain, type: type, disabled: disabled, "aria-label": ariaLabel || tooltipTitle || title, title: title, "aria-disabled": disabled, className: IconClassName, TouchRippleProps: foundation_1.combineProps({
|
|
38
41
|
classes: utils_1.RcIconButtonTouchRippleClasses,
|
|
39
42
|
}, TouchRippleProps) }, rest), icon));
|
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var foundation_1 = require("../../../../foundation");
|
|
5
|
-
var Icon_1 = require("../../../Icon");
|
|
6
5
|
var utils_1 = require("../utils");
|
|
7
6
|
exports.getFocusVisibleInsetSize = function (_a) {
|
|
8
7
|
var size = _a.size;
|
|
9
8
|
var inset = utils_1.RcIconButtonFocusVisibleInsetSize[size];
|
|
10
9
|
return foundation_1.css(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n top: -", "px;\n right: -", "px;\n bottom: -", "px;\n left: -", "px;\n "], ["\n top: -", "px;\n right: -", "px;\n bottom: -", "px;\n left: -", "px;\n "])), inset, inset, inset, inset);
|
|
11
10
|
};
|
|
12
|
-
// * text inside button should also set style
|
|
13
|
-
var childrenClass = "&," + Icon_1.RcIcon;
|
|
14
11
|
var containedVariantTransitions = function (_a) {
|
|
15
12
|
var theme = _a.theme;
|
|
16
13
|
return theme.transitions.create(['background-color', 'box-shadow', 'border'], {
|
|
@@ -22,7 +19,8 @@ exports.plainIconButtonFocusStyle = function (_a) {
|
|
|
22
19
|
return foundation_1.css(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n &:after {\n content: '';\n position: absolute;\n ", ";\n box-shadow: 0 0 0 1px ", ";\n border-radius: ", ";\n pointer-events: none;\n z-index: 1;\n }\n"], ["\n &:after {\n content: '';\n position: absolute;\n ", ";\n box-shadow: 0 0 0 1px ", ";\n border-radius: ", ";\n pointer-events: none;\n z-index: 1;\n }\n"])), exports.getFocusVisibleInsetSize, foundation_1.focusVisibleColor, foundation_1.radius(radiusProp));
|
|
23
20
|
};
|
|
24
21
|
exports.iconButtonStyle = function (_a) {
|
|
25
|
-
var variant = _a.variant, size = _a.size, stretchIcon = _a.stretchIcon, color = _a.color, disabled = _a.disabled, useColorWhenDisabled = _a.useColorWhenDisabled, shouldPersistBg = _a.shouldPersistBg, radiusProp = _a.radius, disableRipple = _a.disableRipple, elevation = _a.elevation, disabledFakeBorder = _a.disabledFakeBorder, activeElevation = _a.activeElevation;
|
|
22
|
+
var variant = _a.variant, size = _a.size, stretchIcon = _a.stretchIcon, color = _a.color, disabled = _a.disabled, useColorWhenDisabled = _a.useColorWhenDisabled, shouldPersistBg = _a.shouldPersistBg, radiusProp = _a.radius, disableRipple = _a.disableRipple, elevation = _a.elevation, disabledFakeBorder = _a.disabledFakeBorder, activeElevation = _a.activeElevation, _b = _a.IconProps, IconProps = _b === void 0 ? {} : _b;
|
|
23
|
+
var iconColor = IconProps.color;
|
|
26
24
|
var iconSize = utils_1.RcIconButtonSizes[size];
|
|
27
25
|
var isCircle = ['plain', 'round', 'inverse', 'contained'].includes(variant);
|
|
28
26
|
var isPlain = variant === 'plain';
|
|
@@ -31,7 +29,9 @@ exports.iconButtonStyle = function (_a) {
|
|
|
31
29
|
var isContained = variant === 'contained';
|
|
32
30
|
var containerSize = foundation_1.px(isPlain ? iconSize : iconSize * 2);
|
|
33
31
|
var mainColor = foundation_1.getParsePaletteColor(color);
|
|
34
|
-
var
|
|
32
|
+
var containedColor = iconColor
|
|
33
|
+
? foundation_1.getParsePaletteColor(iconColor)
|
|
34
|
+
: foundation_1.paletteContrastText(mainColor);
|
|
35
35
|
var currRadius = radiusProp || (isOutline ? 'lg' : isCircle ? 'circle' : 'zero');
|
|
36
36
|
var persistBgColor = foundation_1.setOpacity(mainColor, isInverse ? '16' : '12');
|
|
37
37
|
var defaultShadow = isContained ? foundation_1.shadows('1') : undefined;
|
|
@@ -43,12 +43,13 @@ exports.iconButtonStyle = function (_a) {
|
|
|
43
43
|
radius: currRadius,
|
|
44
44
|
pseudo: true,
|
|
45
45
|
});
|
|
46
|
-
return foundation_1.css(
|
|
47
|
-
";\n\n
|
|
48
|
-
";\n
|
|
49
|
-
";\n\n
|
|
50
|
-
";\n\n &:active {\n
|
|
51
|
-
";\n
|
|
46
|
+
return foundation_1.css(templateObject_8 || (templateObject_8 = tslib_1.__makeTemplateObject(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n width: ", ";\n height: ", ";\n color: ", ";\n border-radius: ", ";\n transition: ", ";\n cursor: ", ";\n background-color: ", ";\n box-shadow: ", ";\n\n ", ";\n\n font-size: ", ";\n\n ", " {\n &:hover {\n background-color: ", ";\n\n color: ", ";\n }\n }\n\n &:active {\n color: ", ";\n }\n\n ", " {\n background-color: ", ";\n\n &:active {\n color: ", ";\n }\n\n ", ";\n }\n\n &.", " {\n background-color: ", ";\n }\n\n &.", " {\n color: ", ";\n\n background-color: ", ";\n }\n\n &.", " {\n opacity: 0;\n visibility: hidden;\n width: 0;\n height: 0;\n }\n\n &.", " {\n border: 1px solid ", ";\n }\n\n &.", " {\n color: ", ";\n background-color: ", ";\n\n &.", " {\n ", "\n }\n\n &:before {\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n border-radius: ", ";\n position: absolute;\n }\n\n ", ";\n\n ", " {\n &:hover {\n &:before {\n background-color: ", ";\n }\n\n color: ", ";\n }\n }\n\n ", " {\n &:before {\n background-color: ", ";\n }\n\n color: ", ";\n }\n\n &:active {\n ", "\n\n color: ", ";\n }\n }\n\n &.", " {\n ", ";\n }\n\n .", " {\n border-radius: 0;\n animation-name: none;\n opacity: 0;\n }\n\n ", "\n "], ["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n width: ", ";\n height: ", ";\n color: ", ";\n border-radius: ", ";\n transition: ", ";\n cursor: ", ";\n background-color: ", ";\n box-shadow: ", ";\n\n ",
|
|
47
|
+
";\n\n font-size: ",
|
|
48
|
+
";\n\n ", " {\n &:hover {\n background-color: ",
|
|
49
|
+
";\n\n color: ", ";\n }\n }\n\n &:active {\n color: ", ";\n }\n\n ", " {\n background-color: ",
|
|
50
|
+
";\n\n &:active {\n color: ", ";\n }\n\n ", ";\n }\n\n &.", " {\n background-color: ", ";\n }\n\n &.", " {\n color: ",
|
|
51
|
+
";\n\n background-color: ", ";\n }\n\n &.", " {\n opacity: 0;\n visibility: hidden;\n width: 0;\n height: 0;\n }\n\n &.", " {\n border: 1px solid ", ";\n }\n\n &.", " {\n color: ", ";\n background-color: ", ";\n\n &.", " {\n ",
|
|
52
|
+
"\n }\n\n &:before {\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n border-radius: ", ";\n position: absolute;\n }\n\n ", ";\n\n ", " {\n &:hover {\n &:before {\n background-color: ", ";\n }\n\n color: ", ";\n }\n }\n\n ", " {\n &:before {\n background-color: ", ";\n }\n\n color: ", ";\n }\n\n &:active {\n ",
|
|
52
53
|
"\n\n color: ", ";\n }\n }\n\n &.", " {\n ", ";\n }\n\n .", " {\n border-radius: 0;\n animation-name: none;\n opacity: 0;\n }\n\n "
|
|
53
54
|
/**
|
|
54
55
|
* that is equilateral triangle, the third Side length is
|
|
@@ -57,23 +58,27 @@ exports.iconButtonStyle = function (_a) {
|
|
|
57
58
|
*/
|
|
58
59
|
,
|
|
59
60
|
"\n "])), containerSize, containerSize, mainColor, radiusValue, foundation_1.backgroundTransition, disabled ? 'default' : 'pointer', (shouldPersistBg || isInverse) && persistBgColor, nowShadow, nowShadow && foundation_1.css(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n transition: ", ";\n\n &:active {\n box-shadow: ", ";\n }\n "], ["\n transition: ", ";\n\n &:active {\n box-shadow: ",
|
|
60
|
-
";\n }\n "])), containedVariantTransitions, foundation_1.shadows(activeElevation !== null && activeElevation !== void 0 ? activeElevation : (elevation ? Math.min(+elevation + 11, 24) : '12'))),
|
|
61
|
+
";\n }\n "])), containedVariantTransitions, foundation_1.shadows(activeElevation !== null && activeElevation !== void 0 ? activeElevation : (elevation ? Math.min(+elevation + 11, 24) : '12'))), stretchIcon
|
|
61
62
|
? containerSize
|
|
62
63
|
: foundation_1.px(isOutline
|
|
63
64
|
? iconSize * 1.2 // keep size same as before
|
|
64
65
|
: iconSize), foundation_1.nonTouchHoverMedia, isPlain
|
|
65
66
|
? 'transparent'
|
|
66
|
-
: foundation_1.setOpacity(mainColor, isInverse ? '24' : '08'),
|
|
67
|
+
: foundation_1.setOpacity(mainColor, isInverse ? '24' : '08'), foundation_1.setOpacity(mainColor, '88'), mainColor, foundation_1.focusVisible, isPlain
|
|
67
68
|
? 'transparent'
|
|
68
|
-
: foundation_1.setOpacity(mainColor, isInverse ? '32' : '16'),
|
|
69
|
+
: foundation_1.setOpacity(mainColor, isInverse ? '32' : '16'), foundation_1.setOpacity(mainColor, '88'), isPlain && exports.plainIconButtonFocusStyle({ radius: currRadius }), utils_1.RcIconButtonClasses.persistBg, persistBgColor, utils_1.RcIconButtonClasses.disabled, useColorWhenDisabled
|
|
69
70
|
? foundation_1.setOpacity(mainColor, '32')
|
|
70
|
-
: foundation_1.palette2('disabled', 'f02'), isInverse && foundation_1.setOpacity(mainColor, '12'), utils_1.RcIconButtonClasses.invisible, utils_1.RcIconButtonClasses.outline, foundation_1.palette2('neutral', 'l03'), utils_1.RcIconButtonClasses.contained,
|
|
71
|
+
: foundation_1.palette2('disabled', 'f02'), isInverse && foundation_1.setOpacity(mainColor, '12'), utils_1.RcIconButtonClasses.invisible, utils_1.RcIconButtonClasses.outline, foundation_1.palette2('neutral', 'l03'), utils_1.RcIconButtonClasses.contained, containedColor, mainColor, utils_1.RcIconButtonClasses.disabled, function () {
|
|
72
|
+
if (useColorWhenDisabled)
|
|
73
|
+
return foundation_1.css(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n color: ", ";\n background-color: ", ";\n opacity: ", ";\n "], ["\n color: ", ";\n background-color: ", ";\n opacity: ", ";\n "])), containedColor, mainColor, foundation_1.opacity('32'));
|
|
74
|
+
return foundation_1.css(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n "], ["\n background-color: ", ";\n color: ", ";\n "])), foundation_1.palette2('disabled', 'b01'), foundation_1.palette2('disabled', 'f01'));
|
|
75
|
+
}, radiusValue, contrastColorBorder, foundation_1.nonTouchHoverMedia, foundation_1.setOpacity(containedColor, '08'), containedColor, foundation_1.focusVisible, foundation_1.setOpacity(containedColor, '16'), containedColor, disableRipple && foundation_1.css(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n &:before {\n background-color: ", ";\n }\n "], ["\n &:before {\n background-color: ", ";\n }\n "])), foundation_1.setOpacity(containedColor, '24')), containedColor, utils_1.RcIconButtonClasses.inverse, contrastColorBorder, utils_1.RcIconButtonTouchRippleClasses.ripplePulsate,
|
|
71
76
|
/**
|
|
72
77
|
* that is equilateral triangle, the third Side length is
|
|
73
78
|
* Math.sqrt(2) = 1.414213562373095, so we scale that
|
|
74
79
|
* to make that full with this square
|
|
75
80
|
*/
|
|
76
81
|
!isPlain &&
|
|
77
|
-
!['circle', 'round'].includes(currRadius) && foundation_1.css(
|
|
82
|
+
!['circle', 'round'].includes(currRadius) && foundation_1.css(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n .", " {\n transform: scale(1.41421357);\n }\n "], ["\n .", " {\n transform: scale(1.41421357);\n }\n "])), utils_1.RcIconButtonTouchRippleClasses.child));
|
|
78
83
|
};
|
|
79
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
84
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
@@ -15,7 +15,7 @@ var _RcIconButton = memo(forwardRef(function (inProps, ref) {
|
|
|
15
15
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
16
16
|
useDeprecatedCheck(RcIconButton, props, rcIconButtonWarning);
|
|
17
17
|
}
|
|
18
|
-
var _b = props.buttonRef, buttonRef = _b === void 0 ? ref : _b,
|
|
18
|
+
var _b = props.buttonRef, buttonRef = _b === void 0 ? ref : _b, _c = props.IconProps, IconProps = _c === void 0 ? {} : _c, className = props.className, classesProp = props.classes, children = props.children, title = props.title, disabledFakeBorder = props.disabledFakeBorder, 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", "IconProps", "className", "classes", "children", "title", "disabledFakeBorder", "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"]);
|
|
19
19
|
var theme = useTheme();
|
|
20
20
|
var isOutline = variant === 'outline';
|
|
21
21
|
var isContained = variant === 'contained';
|
|
@@ -31,7 +31,10 @@ var _RcIconButton = memo(forwardRef(function (inProps, ref) {
|
|
|
31
31
|
_a));
|
|
32
32
|
var iconButton = (function () {
|
|
33
33
|
var _a, _b;
|
|
34
|
-
|
|
34
|
+
// `color` already handle in StyledIconButton
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
36
|
+
var color = IconProps.color, IconPropsWithoutColor = __rest(IconProps, ["color"]);
|
|
37
|
+
var icon = React.isValidElement(children) || children === '' ? children : (React.createElement(RcIcon, __assign({ symbol: symbol, className: classes.icon, loading: loading, size: "inherit", CircularProgressProps: CircularProgressProps }, IconPropsWithoutColor), children));
|
|
35
38
|
var iconButton = (React.createElement(RcButtonBase, __assign({ ref: buttonRef, disableRipple: ((_b = (_a = theme.props) === null || _a === void 0 ? void 0 : _a.MuiButtonBase) === null || _b === void 0 ? void 0 : _b.disableRipple) || isPlain, type: type, disabled: disabled, "aria-label": ariaLabel || tooltipTitle || title, title: title, "aria-disabled": disabled, className: IconClassName, TouchRippleProps: combineProps({
|
|
36
39
|
classes: RcIconButtonTouchRippleClasses,
|
|
37
40
|
}, TouchRippleProps) }, rest), icon));
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { backgroundTransition, css, focusVisible, focusVisibleColor, getParsePaletteColor, nonTouchHoverMedia, palette2, paletteContrastText, px, radius, setOpacity, shadows, fakeBorder, } from '../../../../foundation';
|
|
3
|
-
import { RcIcon } from '../../../Icon';
|
|
2
|
+
import { backgroundTransition, css, focusVisible, focusVisibleColor, getParsePaletteColor, nonTouchHoverMedia, palette2, paletteContrastText, px, radius, setOpacity, shadows, fakeBorder, opacity, } from '../../../../foundation';
|
|
4
3
|
import { RcIconButtonClasses, RcIconButtonFocusVisibleInsetSize, RcIconButtonSizes, RcIconButtonTouchRippleClasses, } from '../utils';
|
|
5
4
|
export var getFocusVisibleInsetSize = function (_a) {
|
|
6
5
|
var size = _a.size;
|
|
7
6
|
var inset = RcIconButtonFocusVisibleInsetSize[size];
|
|
8
7
|
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n top: -", "px;\n right: -", "px;\n bottom: -", "px;\n left: -", "px;\n "], ["\n top: -", "px;\n right: -", "px;\n bottom: -", "px;\n left: -", "px;\n "])), inset, inset, inset, inset);
|
|
9
8
|
};
|
|
10
|
-
// * text inside button should also set style
|
|
11
|
-
var childrenClass = "&," + RcIcon;
|
|
12
9
|
var containedVariantTransitions = function (_a) {
|
|
13
10
|
var theme = _a.theme;
|
|
14
11
|
return theme.transitions.create(['background-color', 'box-shadow', 'border'], {
|
|
@@ -20,7 +17,8 @@ export var plainIconButtonFocusStyle = function (_a) {
|
|
|
20
17
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:after {\n content: '';\n position: absolute;\n ", ";\n box-shadow: 0 0 0 1px ", ";\n border-radius: ", ";\n pointer-events: none;\n z-index: 1;\n }\n"], ["\n &:after {\n content: '';\n position: absolute;\n ", ";\n box-shadow: 0 0 0 1px ", ";\n border-radius: ", ";\n pointer-events: none;\n z-index: 1;\n }\n"])), getFocusVisibleInsetSize, focusVisibleColor, radius(radiusProp));
|
|
21
18
|
};
|
|
22
19
|
export var iconButtonStyle = function (_a) {
|
|
23
|
-
var variant = _a.variant, size = _a.size, stretchIcon = _a.stretchIcon, color = _a.color, disabled = _a.disabled, useColorWhenDisabled = _a.useColorWhenDisabled, shouldPersistBg = _a.shouldPersistBg, radiusProp = _a.radius, disableRipple = _a.disableRipple, elevation = _a.elevation, disabledFakeBorder = _a.disabledFakeBorder, activeElevation = _a.activeElevation;
|
|
20
|
+
var variant = _a.variant, size = _a.size, stretchIcon = _a.stretchIcon, color = _a.color, disabled = _a.disabled, useColorWhenDisabled = _a.useColorWhenDisabled, shouldPersistBg = _a.shouldPersistBg, radiusProp = _a.radius, disableRipple = _a.disableRipple, elevation = _a.elevation, disabledFakeBorder = _a.disabledFakeBorder, activeElevation = _a.activeElevation, _b = _a.IconProps, IconProps = _b === void 0 ? {} : _b;
|
|
21
|
+
var iconColor = IconProps.color;
|
|
24
22
|
var iconSize = RcIconButtonSizes[size];
|
|
25
23
|
var isCircle = ['plain', 'round', 'inverse', 'contained'].includes(variant);
|
|
26
24
|
var isPlain = variant === 'plain';
|
|
@@ -29,7 +27,9 @@ export var iconButtonStyle = function (_a) {
|
|
|
29
27
|
var isContained = variant === 'contained';
|
|
30
28
|
var containerSize = px(isPlain ? iconSize : iconSize * 2);
|
|
31
29
|
var mainColor = getParsePaletteColor(color);
|
|
32
|
-
var
|
|
30
|
+
var containedColor = iconColor
|
|
31
|
+
? getParsePaletteColor(iconColor)
|
|
32
|
+
: paletteContrastText(mainColor);
|
|
33
33
|
var currRadius = radiusProp || (isOutline ? 'lg' : isCircle ? 'circle' : 'zero');
|
|
34
34
|
var persistBgColor = setOpacity(mainColor, isInverse ? '16' : '12');
|
|
35
35
|
var defaultShadow = isContained ? shadows('1') : undefined;
|
|
@@ -41,12 +41,13 @@ export var iconButtonStyle = function (_a) {
|
|
|
41
41
|
radius: currRadius,
|
|
42
42
|
pseudo: true,
|
|
43
43
|
});
|
|
44
|
-
return css(
|
|
45
|
-
";\n\n
|
|
46
|
-
";\n
|
|
47
|
-
";\n\n
|
|
48
|
-
";\n\n &:active {\n
|
|
49
|
-
";\n
|
|
44
|
+
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n width: ", ";\n height: ", ";\n color: ", ";\n border-radius: ", ";\n transition: ", ";\n cursor: ", ";\n background-color: ", ";\n box-shadow: ", ";\n\n ", ";\n\n font-size: ", ";\n\n ", " {\n &:hover {\n background-color: ", ";\n\n color: ", ";\n }\n }\n\n &:active {\n color: ", ";\n }\n\n ", " {\n background-color: ", ";\n\n &:active {\n color: ", ";\n }\n\n ", ";\n }\n\n &.", " {\n background-color: ", ";\n }\n\n &.", " {\n color: ", ";\n\n background-color: ", ";\n }\n\n &.", " {\n opacity: 0;\n visibility: hidden;\n width: 0;\n height: 0;\n }\n\n &.", " {\n border: 1px solid ", ";\n }\n\n &.", " {\n color: ", ";\n background-color: ", ";\n\n &.", " {\n ", "\n }\n\n &:before {\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n border-radius: ", ";\n position: absolute;\n }\n\n ", ";\n\n ", " {\n &:hover {\n &:before {\n background-color: ", ";\n }\n\n color: ", ";\n }\n }\n\n ", " {\n &:before {\n background-color: ", ";\n }\n\n color: ", ";\n }\n\n &:active {\n ", "\n\n color: ", ";\n }\n }\n\n &.", " {\n ", ";\n }\n\n .", " {\n border-radius: 0;\n animation-name: none;\n opacity: 0;\n }\n\n ", "\n "], ["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n width: ", ";\n height: ", ";\n color: ", ";\n border-radius: ", ";\n transition: ", ";\n cursor: ", ";\n background-color: ", ";\n box-shadow: ", ";\n\n ",
|
|
45
|
+
";\n\n font-size: ",
|
|
46
|
+
";\n\n ", " {\n &:hover {\n background-color: ",
|
|
47
|
+
";\n\n color: ", ";\n }\n }\n\n &:active {\n color: ", ";\n }\n\n ", " {\n background-color: ",
|
|
48
|
+
";\n\n &:active {\n color: ", ";\n }\n\n ", ";\n }\n\n &.", " {\n background-color: ", ";\n }\n\n &.", " {\n color: ",
|
|
49
|
+
";\n\n background-color: ", ";\n }\n\n &.", " {\n opacity: 0;\n visibility: hidden;\n width: 0;\n height: 0;\n }\n\n &.", " {\n border: 1px solid ", ";\n }\n\n &.", " {\n color: ", ";\n background-color: ", ";\n\n &.", " {\n ",
|
|
50
|
+
"\n }\n\n &:before {\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n border-radius: ", ";\n position: absolute;\n }\n\n ", ";\n\n ", " {\n &:hover {\n &:before {\n background-color: ", ";\n }\n\n color: ", ";\n }\n }\n\n ", " {\n &:before {\n background-color: ", ";\n }\n\n color: ", ";\n }\n\n &:active {\n ",
|
|
50
51
|
"\n\n color: ", ";\n }\n }\n\n &.", " {\n ", ";\n }\n\n .", " {\n border-radius: 0;\n animation-name: none;\n opacity: 0;\n }\n\n "
|
|
51
52
|
/**
|
|
52
53
|
* that is equilateral triangle, the third Side length is
|
|
@@ -55,23 +56,27 @@ export var iconButtonStyle = function (_a) {
|
|
|
55
56
|
*/
|
|
56
57
|
,
|
|
57
58
|
"\n "])), containerSize, containerSize, mainColor, radiusValue, backgroundTransition, disabled ? 'default' : 'pointer', (shouldPersistBg || isInverse) && persistBgColor, nowShadow, nowShadow && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n transition: ", ";\n\n &:active {\n box-shadow: ", ";\n }\n "], ["\n transition: ", ";\n\n &:active {\n box-shadow: ",
|
|
58
|
-
";\n }\n "])), containedVariantTransitions, shadows(activeElevation !== null && activeElevation !== void 0 ? activeElevation : (elevation ? Math.min(+elevation + 11, 24) : '12'))),
|
|
59
|
+
";\n }\n "])), containedVariantTransitions, shadows(activeElevation !== null && activeElevation !== void 0 ? activeElevation : (elevation ? Math.min(+elevation + 11, 24) : '12'))), stretchIcon
|
|
59
60
|
? containerSize
|
|
60
61
|
: px(isOutline
|
|
61
62
|
? iconSize * 1.2 // keep size same as before
|
|
62
63
|
: iconSize), nonTouchHoverMedia, isPlain
|
|
63
64
|
? 'transparent'
|
|
64
|
-
: setOpacity(mainColor, isInverse ? '24' : '08'),
|
|
65
|
+
: setOpacity(mainColor, isInverse ? '24' : '08'), setOpacity(mainColor, '88'), mainColor, focusVisible, isPlain
|
|
65
66
|
? 'transparent'
|
|
66
|
-
: setOpacity(mainColor, isInverse ? '32' : '16'),
|
|
67
|
+
: setOpacity(mainColor, isInverse ? '32' : '16'), setOpacity(mainColor, '88'), isPlain && plainIconButtonFocusStyle({ radius: currRadius }), RcIconButtonClasses.persistBg, persistBgColor, RcIconButtonClasses.disabled, useColorWhenDisabled
|
|
67
68
|
? setOpacity(mainColor, '32')
|
|
68
|
-
: palette2('disabled', 'f02'), isInverse && setOpacity(mainColor, '12'), RcIconButtonClasses.invisible, RcIconButtonClasses.outline, palette2('neutral', 'l03'), RcIconButtonClasses.contained,
|
|
69
|
+
: palette2('disabled', 'f02'), isInverse && setOpacity(mainColor, '12'), RcIconButtonClasses.invisible, RcIconButtonClasses.outline, palette2('neutral', 'l03'), RcIconButtonClasses.contained, containedColor, mainColor, RcIconButtonClasses.disabled, function () {
|
|
70
|
+
if (useColorWhenDisabled)
|
|
71
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n background-color: ", ";\n opacity: ", ";\n "], ["\n color: ", ";\n background-color: ", ";\n opacity: ", ";\n "])), containedColor, mainColor, opacity('32'));
|
|
72
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n "], ["\n background-color: ", ";\n color: ", ";\n "])), palette2('disabled', 'b01'), palette2('disabled', 'f01'));
|
|
73
|
+
}, radiusValue, contrastColorBorder, nonTouchHoverMedia, setOpacity(containedColor, '08'), containedColor, focusVisible, setOpacity(containedColor, '16'), containedColor, disableRipple && css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n &:before {\n background-color: ", ";\n }\n "], ["\n &:before {\n background-color: ", ";\n }\n "])), setOpacity(containedColor, '24')), containedColor, RcIconButtonClasses.inverse, contrastColorBorder, RcIconButtonTouchRippleClasses.ripplePulsate,
|
|
69
74
|
/**
|
|
70
75
|
* that is equilateral triangle, the third Side length is
|
|
71
76
|
* Math.sqrt(2) = 1.414213562373095, so we scale that
|
|
72
77
|
* to make that full with this square
|
|
73
78
|
*/
|
|
74
79
|
!isPlain &&
|
|
75
|
-
!['circle', 'round'].includes(currRadius) && css(
|
|
80
|
+
!['circle', 'round'].includes(currRadius) && css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n .", " {\n transform: scale(1.41421357);\n }\n "], ["\n .", " {\n transform: scale(1.41421357);\n }\n "])), RcIconButtonTouchRippleClasses.child));
|
|
76
81
|
};
|
|
77
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
82
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|