@skbkontur/react-ui 4.21.0 → 4.21.1
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/CHANGELOG.md +13 -0
- package/cjs/components/Button/Button.d.ts +5 -1
- package/cjs/components/Button/Button.js +10 -9
- package/cjs/components/Button/Button.js.map +1 -1
- package/cjs/components/Button/Button.md +40 -32
- package/cjs/components/Button/Button.mixins.d.ts +1 -1
- package/cjs/components/Button/Button.mixins.js +3 -1
- package/cjs/components/Button/Button.mixins.js.map +1 -1
- package/cjs/components/Button/Button.styles.d.ts +0 -6
- package/cjs/components/Button/Button.styles.js +40 -62
- package/cjs/components/Button/Button.styles.js.map +1 -1
- package/cjs/components/Button/ButtonIcon.d.ts +4 -3
- package/cjs/components/Button/ButtonIcon.js +36 -15
- package/cjs/components/Button/ButtonIcon.js.map +1 -1
- package/cjs/components/Button/ButtonIcon.styles.d.ts +16 -0
- package/cjs/components/Button/ButtonIcon.styles.js +89 -0
- package/cjs/components/Button/ButtonIcon.styles.js.map +1 -0
- package/cjs/components/Button/LoadingButtonIcon.d.ts +7 -0
- package/cjs/components/Button/LoadingButtonIcon.js +25 -0
- package/cjs/components/Button/LoadingButtonIcon.js.map +1 -0
- package/cjs/components/ComboBox/ComboBox.md +4 -5
- package/cjs/components/Link/Link.d.ts +6 -2
- package/cjs/components/Link/Link.js +15 -11
- package/cjs/components/Link/Link.js.map +1 -1
- package/cjs/components/Link/Link.md +14 -9
- package/cjs/components/Link/Link.styles.d.ts +3 -1
- package/cjs/components/Link/Link.styles.js +14 -3
- package/cjs/components/Link/Link.styles.js.map +1 -1
- package/cjs/components/Link/LinkIcon.d.ts +6 -0
- package/cjs/components/Link/LinkIcon.js +29 -0
- package/cjs/components/Link/LinkIcon.js.map +1 -0
- package/cjs/internal/CustomComboBox/CustomComboBox.d.ts +1 -0
- package/cjs/internal/CustomComboBox/CustomComboBox.js +22 -1
- package/cjs/internal/CustomComboBox/CustomComboBox.js.map +1 -1
- package/cjs/internal/CustomComboBox/CustomComboBoxReducer.d.ts +1 -0
- package/cjs/internal/CustomComboBox/CustomComboBoxReducer.js +27 -1
- package/cjs/internal/CustomComboBox/CustomComboBoxReducer.js.map +1 -1
- package/cjs/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
- package/cjs/internal/themes/DefaultTheme.d.ts +24 -0
- package/cjs/internal/themes/DefaultTheme.js +34 -2
- package/cjs/internal/themes/DefaultTheme.js.map +1 -1
- package/cjs/internal/themes/Theme2022.d.ts +15 -0
- package/cjs/internal/themes/Theme2022.js +28 -1
- package/cjs/internal/themes/Theme2022.js.map +1 -1
- package/cjs/lib/featureFlagsContext/FEATUREFLAGSCONTEXT.md +42 -0
- package/cjs/lib/featureFlagsContext/FeatureFlagsHelpers.d.ts +1 -0
- package/cjs/lib/featureFlagsContext/ReactUIFeatureFlagsContext.d.ts +1 -0
- package/cjs/lib/featureFlagsContext/ReactUIFeatureFlagsContext.js +3 -1
- package/cjs/lib/featureFlagsContext/ReactUIFeatureFlagsContext.js.map +1 -1
- package/components/Button/Button/Button.js +25 -29
- package/components/Button/Button/Button.js.map +1 -1
- package/components/Button/Button.d.ts +5 -1
- package/components/Button/Button.md +40 -32
- package/components/Button/Button.mixins/Button.mixins.js +2 -2
- package/components/Button/Button.mixins/Button.mixins.js.map +1 -1
- package/components/Button/Button.mixins.d.ts +1 -1
- package/components/Button/Button.styles/Button.styles.js +23 -44
- package/components/Button/Button.styles/Button.styles.js.map +1 -1
- package/components/Button/Button.styles.d.ts +0 -6
- package/components/Button/ButtonIcon/ButtonIcon.js +30 -17
- package/components/Button/ButtonIcon/ButtonIcon.js.map +1 -1
- package/components/Button/ButtonIcon.d.ts +4 -3
- package/components/Button/ButtonIcon.styles/ButtonIcon.styles.js +49 -0
- package/components/Button/ButtonIcon.styles/ButtonIcon.styles.js.map +1 -0
- package/components/Button/ButtonIcon.styles/package.json +6 -0
- package/components/Button/ButtonIcon.styles.d.ts +16 -0
- package/components/Button/LoadingButtonIcon/LoadingButtonIcon.js +23 -0
- package/components/Button/LoadingButtonIcon/LoadingButtonIcon.js.map +1 -0
- package/components/Button/LoadingButtonIcon/package.json +6 -0
- package/components/Button/LoadingButtonIcon.d.ts +7 -0
- package/components/ComboBox/ComboBox.md +4 -5
- package/components/Link/Link/Link.js +15 -15
- package/components/Link/Link/Link.js.map +1 -1
- package/components/Link/Link.d.ts +6 -2
- package/components/Link/Link.md +14 -9
- package/components/Link/Link.styles/Link.styles.js +9 -3
- package/components/Link/Link.styles/Link.styles.js.map +1 -1
- package/components/Link/Link.styles.d.ts +3 -1
- package/components/Link/LinkIcon/LinkIcon.js +19 -0
- package/components/Link/LinkIcon/LinkIcon.js.map +1 -0
- package/components/Link/LinkIcon/package.json +6 -0
- package/components/Link/LinkIcon.d.ts +6 -0
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js +10 -5
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js.map +1 -1
- package/internal/CustomComboBox/CustomComboBox.d.ts +1 -0
- package/internal/CustomComboBox/CustomComboBoxReducer/CustomComboBoxReducer.js +24 -0
- package/internal/CustomComboBox/CustomComboBoxReducer/CustomComboBoxReducer.js.map +1 -1
- package/internal/CustomComboBox/CustomComboBoxReducer.d.ts +1 -0
- package/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
- package/internal/themes/DefaultTheme/DefaultTheme.js +31 -0
- package/internal/themes/DefaultTheme/DefaultTheme.js.map +1 -1
- package/internal/themes/DefaultTheme.d.ts +24 -0
- package/internal/themes/Theme2022/Theme2022.js +38 -0
- package/internal/themes/Theme2022/Theme2022.js.map +1 -1
- package/internal/themes/Theme2022.d.ts +15 -0
- package/lib/featureFlagsContext/FEATUREFLAGSCONTEXT.md +42 -0
- package/lib/featureFlagsContext/FeatureFlagsHelpers.d.ts +1 -0
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext/ReactUIFeatureFlagsContext.js +2 -1
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext/ReactUIFeatureFlagsContext.js.map +1 -1
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.21.1](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@4.22.0-next.0...@skbkontur/react-ui@4.21.1) (2024-03-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **Button:** add variables for hover text color ([#3365](https://github.com/skbkontur/retail-ui/issues/3365)) ([c2ff765](https://github.com/skbkontur/retail-ui/commit/c2ff765ed47b0b11dd08aa5da58aaf90d0d4d383))
|
|
12
|
+
* **Button, Link:** add rightIcon prop ([#3317](https://github.com/skbkontur/retail-ui/issues/3317)) ([83527fc](https://github.com/skbkontur/retail-ui/commit/83527fcfd1e5ef41990e7577a17612f1a4c4f4ac))
|
|
13
|
+
* **ComboBox:** allow to change value in editing state ([#3340](https://github.com/skbkontur/retail-ui/issues/3340)) ([caa4bef](https://github.com/skbkontur/retail-ui/commit/caa4beff7e1fefb9a64984ca8f58524b5d3aa8fc))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
# [4.21.0](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@4.21.0-next.3...@skbkontur/react-ui@4.21.0) (2024-02-21)
|
|
7
20
|
|
|
8
21
|
|
|
@@ -54,7 +54,11 @@ export interface ButtonProps extends CommonProps, Pick<AriaAttributes, 'aria-has
|
|
|
54
54
|
/**
|
|
55
55
|
* Иконка слева от текста кнопки.
|
|
56
56
|
*/
|
|
57
|
-
icon?: React.ReactElement
|
|
57
|
+
icon?: React.ReactElement;
|
|
58
|
+
/**
|
|
59
|
+
* Иконка справа от текста кнопки.
|
|
60
|
+
*/
|
|
61
|
+
rightIcon?: React.ReactElement;
|
|
58
62
|
/**
|
|
59
63
|
* Переводит кнопку в состояние загрузки.
|
|
60
64
|
*/
|
|
@@ -14,14 +14,18 @@ var _ThemeFactory = require("../../lib/theming/ThemeFactory");
|
|
|
14
14
|
var _createPropsGetter = require("../../lib/createPropsGetter");
|
|
15
15
|
var _ThemeHelpers = require("../../lib/theming/ThemeHelpers");
|
|
16
16
|
var _Link = require("../Link");
|
|
17
|
-
var _Spinner = require("../Spinner");
|
|
18
|
-
var _LoadingIcon = require("../../internal/icons2022/LoadingIcon");
|
|
19
17
|
|
|
20
18
|
|
|
21
19
|
var _Button = require("./Button.styles");
|
|
22
20
|
var _ButtonIcon = require("./ButtonIcon");
|
|
23
21
|
var _ButtonArrow = require("./ButtonArrow");
|
|
24
|
-
var _getInnerLinkTheme = require("./getInnerLinkTheme");
|
|
22
|
+
var _getInnerLinkTheme = require("./getInnerLinkTheme");
|
|
23
|
+
var _LoadingButtonIcon = require("./LoadingButtonIcon");var _excluded = ["onClick", "onFocus", "onBlur", "children"];var _class, _class2, _temp;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
25
29
|
|
|
26
30
|
|
|
27
31
|
|
|
@@ -544,9 +548,6 @@ Button = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/functi
|
|
|
544
548
|
|
|
545
549
|
|
|
546
550
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
551
|
|
|
551
552
|
|
|
552
553
|
|
|
@@ -577,9 +578,9 @@ Button = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/functi
|
|
|
577
578
|
* @public
|
|
578
579
|
*/;_proto.focus = function focus() {var _this$node;(_this$node = this.node) == null ? void 0 : _this$node.focus();} /**
|
|
579
580
|
* @public
|
|
580
|
-
*/;_proto.blur = function blur() {var _this$node2;(_this$node2 = this.node) == null ? void 0 : _this$node2.blur();};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = _this2.props.theme ? _ThemeFactory.ThemeFactory.create(_this2.props.theme, theme) : theme;return _this2.renderMain();});};_proto.renderLinkRootWithoutHandlers = function renderLinkRootWithoutHandlers(props) {var onClick = props.onClick,onFocus = props.onFocus,onBlur = props.onBlur,children = props.children,rest = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);return /*#__PURE__*/_react.default.createElement("span", rest, children);};_proto.renderMain = function renderMain() {var _cx2, _cx5, _cx6;var _this$props = this.props,corners = _this$props.corners,active = _this$props.active,disabled = _this$props.disabled,borderless = _this$props.borderless,checked = _this$props.checked,error = _this$props.error,warning = _this$props.warning,loading = _this$props.loading,narrow = _this$props.narrow,icon = _this$props.icon,_noPadding = _this$props._noPadding,_noRightPadding = _this$props._noRightPadding,visuallyFocused = _this$props.visuallyFocused,align = _this$props.align,disableFocus = _this$props.disableFocus,onMouseEnter = _this$props.onMouseEnter,onMouseLeave = _this$props.onMouseLeave,onMouseOver = _this$props.onMouseOver,onMouseDown = _this$props.onMouseDown,onMouseUp = _this$props.onMouseUp,onKeyDown = _this$props.onKeyDown,onClick = _this$props.onClick,onClickCapture = _this$props.onClickCapture,width = _this$props.width,children = _this$props.children,ariaDescribedby = _this$props['aria-describedby'],ariaHasPopup = _this$props['aria-haspopup'],ariaControls = _this$props['aria-controls'],ariaLabel = _this$props['aria-label'],ariaChecked = _this$props['aria-checked'],ariaExpanded = _this$props['aria-expanded'],role = _this$props.role;var _this$getProps = this.getProps(),use = _this$getProps.use,type = _this$getProps.type,size = _this$getProps.size;var sizeClass = this.getSizeClassName();var isFocused = this.state.focusedByTab || visuallyFocused;var isLink = use === 'link';var _isTheme2022 = (0, _ThemeHelpers.isTheme2022)(this.theme); // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
581
|
+
*/;_proto.blur = function blur() {var _this$node2;(_this$node2 = this.node) == null ? void 0 : _this$node2.blur();};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = _this2.props.theme ? _ThemeFactory.ThemeFactory.create(_this2.props.theme, theme) : theme;return _this2.renderMain();});};_proto.renderLinkRootWithoutHandlers = function renderLinkRootWithoutHandlers(props) {var onClick = props.onClick,onFocus = props.onFocus,onBlur = props.onBlur,children = props.children,rest = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);return /*#__PURE__*/_react.default.createElement("span", rest, children);};_proto.renderMain = function renderMain() {var _cx2, _cx5, _cx6;var _this$props = this.props,corners = _this$props.corners,active = _this$props.active,disabled = _this$props.disabled,borderless = _this$props.borderless,checked = _this$props.checked,error = _this$props.error,warning = _this$props.warning,loading = _this$props.loading,narrow = _this$props.narrow,icon = _this$props.icon,rightIcon = _this$props.rightIcon,_noPadding = _this$props._noPadding,_noRightPadding = _this$props._noRightPadding,visuallyFocused = _this$props.visuallyFocused,align = _this$props.align,disableFocus = _this$props.disableFocus,onMouseEnter = _this$props.onMouseEnter,onMouseLeave = _this$props.onMouseLeave,onMouseOver = _this$props.onMouseOver,onMouseDown = _this$props.onMouseDown,onMouseUp = _this$props.onMouseUp,onKeyDown = _this$props.onKeyDown,onClick = _this$props.onClick,onClickCapture = _this$props.onClickCapture,width = _this$props.width,children = _this$props.children,ariaDescribedby = _this$props['aria-describedby'],ariaHasPopup = _this$props['aria-haspopup'],ariaControls = _this$props['aria-controls'],ariaLabel = _this$props['aria-label'],ariaChecked = _this$props['aria-checked'],ariaExpanded = _this$props['aria-expanded'],role = _this$props.role;var _this$getProps = this.getProps(),use = _this$getProps.use,type = _this$getProps.type,size = _this$getProps.size;var sizeClass = this.getSizeClassName();var isFocused = this.state.focusedByTab || visuallyFocused;var isLink = use === 'link';var _isTheme2022 = (0, _ThemeHelpers.isTheme2022)(this.theme); // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
581
582
|
var _useButtonArrow = (0, _ButtonArrow.useButtonArrow)((0, _extends2.default)({}, this.props, { isFocused: Boolean(isFocused) }), this.theme),wrapClassNameWithArrow = _useButtonArrow[0],rootClassNameWithArrow = _useButtonArrow[1],arrowNode = _useButtonArrow[2];var isUseStateWithoutOutlineInDisabledState = !['default', 'backless'].includes(use);var rootClassName = '';if (_isTheme2022) {var trueDisabled = disabled || loading;rootClassName = _Emotion.cx.apply(void 0, [_Button.styles.root(this.theme), _Button.styles[use](this.theme), sizeClass, narrow && _Button.styles.narrow(), _noPadding && _Button.styles.noPadding(), _noRightPadding && _Button.styles.noRightPadding(), rootClassNameWithArrow].concat(trueDisabled ? [_Button.styles.disabled(this.theme), isUseStateWithoutOutlineInDisabledState && _Button.styles.disabledWithoutOutline(this.theme), checked && _Button.styles.checkedDisabled(this.theme), checked && _Button.styles.checkedDisabled2022(this.theme), borderless && _Button.styles.borderless2022()] : [active && !checked && _Button.activeStyles[use](this.theme), isFocused && _Button.styles.focus(this.theme), checked && _Button.styles.checked2022(this.theme), checked && isFocused && _Button.styles.checkedFocused(this.theme), borderless && !checked && !isFocused && _Button.styles.borderless2022()]));} else {var _cx;rootClassName = (0, _Emotion.cx)((_cx = {}, _cx[_Button.styles.root(this.theme)] = true, _cx[_Button.styles.simulatedPress()] = true, _cx[_Button.styles[use](this.theme)] = true, _cx[_Button.activeStyles[use](this.theme)] = active, _cx[sizeClass] = true, _cx[_Button.styles.focus(this.theme)] = isFocused, _cx[_Button.styles.checked(this.theme)] = checked, _cx[_Button.styles.checkedFocused(this.theme)] = checked && isFocused, _cx[_Button.styles.disabled(this.theme)] = disabled || loading, _cx[_Button.styles.checkedDisabled(this.theme)] = checked && disabled, _cx[_Button.styles.borderless()] = borderless && !disabled && !loading && !checked && !isFocused && !active, _cx[_Button.styles.narrow()] = narrow, _cx[_Button.styles.noPadding()] = _noPadding, _cx[_Button.styles.noRightPadding()] = _noRightPadding, _cx));}var rootProps = { // By default the type attribute is 'submit'. IE8 will fire a click event
|
|
582
583
|
// on this button if somewhere on the page user presses Enter while some
|
|
583
584
|
// input is focused. So we set type to 'button' by default.
|
|
584
|
-
type: type, role: role, 'aria-describedby': ariaDescribedby, 'aria-haspopup': ariaHasPopup, 'aria-controls': ariaControls, 'aria-label': ariaLabel, 'aria-checked': ariaChecked, 'aria-expanded': ariaExpanded, className: rootClassName, style: (0, _extends2.default)({ textAlign: align }, corners), disabled: disabled || loading, onClick: onClick, onFocus: this.handleFocus, onBlur: this.handleBlur, onKeyDown: onKeyDown, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseOver: onMouseOver, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onClickCapture: onClickCapture, tabIndex: disableFocus ? -1 : 0, title: this.props.title };var wrapProps = { className: (0, _Emotion.cx)(_Button.globalClasses.root, (_cx2 = {}, _cx2[_Button.styles.wrap(this.theme)] = true, _cx2[wrapClassNameWithArrow] = true, _cx2[this.getSizeWrapClassName()] = true, _cx2)), style: { width: width } };var innerShadowNode = _isTheme2022 ? null : /*#__PURE__*/_react.default.createElement("div", { className: _Button.globalClasses.innerShadow });var outlineNode = null;var isDisabled2022 = _isTheme2022 && (disabled || loading);if ((!isFocused || isLink) && !isDisabled2022) {var _cx3;outlineNode = /*#__PURE__*/_react.default.createElement("div", { style: { zIndex: _isTheme2022 && isLink ? -1 : undefined }, className: (0, _Emotion.cx)(_Button.styles.outline(), (_cx3 = {}, _cx3[_Button.styles.outlineWarning(this.theme)] = warning, _cx3[_Button.styles.outlineError(this.theme)] = error, _cx3[_Button.styles.outlineLink()] = isLink, _cx3[_Button.styles.outlineLinkWarning(this.theme)] = isLink && warning, _cx3[_Button.styles.outlineLinkError(this.theme)] = isLink && error, _cx3)) });}var
|
|
585
|
-
if (isLink) {var _cx4;rootProps.className = (0, _Emotion.cx)((_cx4 = {}, _cx4[_Button.styles.root(this.theme)] = true, _cx4[sizeClass] = true, _cx4[_Button.styles.link(this.theme)] = true, _cx4[_Button.styles.linkLineHeight()] = !_client.isSafari || _client.isSafari && !_isTheme2022, _cx4[_Button.styles.linkLineHeightSafariFallback()] = _client.isSafari && _isTheme2022, _cx4[_Button.styles.linkFocus(this.theme)] = isFocused, _cx4[_Button.styles.linkDisabled(this.theme)] = disabled || loading, _cx4));Object.assign(wrapProps, { className: (0, _Emotion.cx)(_Button.styles.wrap(this.theme), _Button.styles.wrapLink()), style: { width: wrapProps.style.width } });rootProps.style.textAlign = undefined;}var captionNode = /*#__PURE__*/_react.default.createElement("div", { className: (0, _Emotion.cx)(_Button.styles.caption(), _Button.globalClasses.caption, (_cx5 = {}, _cx5[_Button.styles.captionTranslated()] = (active || checked) && !loading && !_isTheme2022, _cx5[_Button.styles.captionLink()] = isLink, _cx5[_Button.styles.captionDisabled()] = !checked && disabled, _cx5)) }, loadingNode,
|
|
585
|
+
type: type, role: role, 'aria-describedby': ariaDescribedby, 'aria-haspopup': ariaHasPopup, 'aria-controls': ariaControls, 'aria-label': ariaLabel, 'aria-checked': ariaChecked, 'aria-expanded': ariaExpanded, className: rootClassName, style: (0, _extends2.default)({ textAlign: align }, corners), disabled: disabled || loading, onClick: onClick, onFocus: this.handleFocus, onBlur: this.handleBlur, onKeyDown: onKeyDown, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseOver: onMouseOver, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onClickCapture: onClickCapture, tabIndex: disableFocus ? -1 : 0, title: this.props.title };var wrapProps = { className: (0, _Emotion.cx)(_Button.globalClasses.root, (_cx2 = {}, _cx2[_Button.styles.wrap(this.theme)] = true, _cx2[wrapClassNameWithArrow] = true, _cx2[this.getSizeWrapClassName()] = true, _cx2)), style: { width: width } };var innerShadowNode = _isTheme2022 ? null : /*#__PURE__*/_react.default.createElement("div", { className: _Button.globalClasses.innerShadow });var outlineNode = null;var isDisabled2022 = _isTheme2022 && (disabled || loading);if ((!isFocused || isLink) && !isDisabled2022) {var _cx3;outlineNode = /*#__PURE__*/_react.default.createElement("div", { style: { zIndex: _isTheme2022 && isLink ? -1 : undefined }, className: (0, _Emotion.cx)(_Button.styles.outline(), (_cx3 = {}, _cx3[_Button.styles.outlineWarning(this.theme)] = warning, _cx3[_Button.styles.outlineError(this.theme)] = error, _cx3[_Button.styles.outlineLink()] = isLink, _cx3[_Button.styles.outlineLinkWarning(this.theme)] = isLink && warning, _cx3[_Button.styles.outlineLinkError(this.theme)] = isLink && error, _cx3)) });}var iconProps = { use: use, size: this.getProps().size, hasChildren: !!children, loading: loading || false };var leftIconNode = icon && /*#__PURE__*/_react.default.createElement(_ButtonIcon.ButtonIcon, (0, _extends2.default)({}, iconProps, { position: "left", icon: icon }));var rightIconNode = rightIcon && /*#__PURE__*/_react.default.createElement(_ButtonIcon.ButtonIcon, (0, _extends2.default)({}, iconProps, { hasBothIcons: !!icon && !!rightIcon, position: "right", icon: rightIcon })); // Force disable all props and features, that cannot be use with Link
|
|
586
|
+
if (isLink) {var _cx4;rootProps.className = (0, _Emotion.cx)((_cx4 = {}, _cx4[_Button.styles.root(this.theme)] = true, _cx4[sizeClass] = true, _cx4[_Button.styles.link(this.theme)] = true, _cx4[_Button.styles.linkLineHeight()] = !_client.isSafari || _client.isSafari && !_isTheme2022, _cx4[_Button.styles.linkLineHeightSafariFallback()] = _client.isSafari && _isTheme2022, _cx4[_Button.styles.linkFocus(this.theme)] = isFocused, _cx4[_Button.styles.linkDisabled(this.theme)] = disabled || loading, _cx4));Object.assign(wrapProps, { className: (0, _Emotion.cx)(_Button.styles.wrap(this.theme), _Button.styles.wrapLink()), style: { width: wrapProps.style.width } });rootProps.style.textAlign = undefined;}var hasLoadingNode = loading && !icon && !rightIcon;var loadingNode = hasLoadingNode && /*#__PURE__*/_react.default.createElement(_LoadingButtonIcon.LoadingButtonIcon, { size: size });var captionNode = /*#__PURE__*/_react.default.createElement("div", { className: (0, _Emotion.cx)(_Button.styles.caption(), _Button.globalClasses.caption, (_cx5 = {}, _cx5[_Button.styles.captionTranslated()] = (active || checked) && !loading && !_isTheme2022, _cx5[_Button.styles.captionLink()] = isLink, _cx5[_Button.styles.captionDisabled()] = !checked && disabled, _cx5)) }, loadingNode, leftIconNode, /*#__PURE__*/_react.default.createElement("span", { className: (0, _Emotion.cx)(_Button.globalClasses.text, (_cx6 = {}, _cx6[_Button.styles.visibilityHidden()] = hasLoadingNode, _cx6)) }, children), rightIconNode);if (_isTheme2022 && isLink && !loading) {captionNode = /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Provider, { value: (0, _getInnerLinkTheme.getInnerLinkTheme)(this.theme) }, /*#__PURE__*/_react.default.createElement(_Link.Link, { focused: isFocused, disabled: disabled, icon: this.renderIcon2022(icon), rightIcon: this.renderIcon2022(rightIcon), as: this.renderLinkRootWithoutHandlers, tabIndex: -1 }, children));}return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement("span", wrapProps, /*#__PURE__*/_react.default.createElement("button", (0, _extends2.default)({ "data-tid": ButtonDataTids.root, ref: this._ref }, rootProps), innerShadowNode, outlineNode, arrowNode, captionNode)));};_proto.renderIcon2022 = function renderIcon2022(icon) {if (icon && (0, _utils.isKonturIcon)(icon)) {var _icon$props$size;var sizes = (0, _ButtonIcon.getButtonIconSizes)(this.theme);return /*#__PURE__*/_react.default.cloneElement(icon, { size: (_icon$props$size = icon.props.size) != null ? _icon$props$size : sizes[this.getProps().size] });}return icon;};_proto.getSizeClassName = function getSizeClassName() {var _cx7, _cx8, _cx9;var _isTheme2022 = (0, _ThemeHelpers.isTheme2022)(this.theme);switch (this.getProps().size) {case 'large':return (0, _Emotion.cx)(_Button.styles.sizeLarge(this.theme), (_cx7 = {}, _cx7[_Button.styles.sizeLargeIE11(this.theme)] = _client.isIE11 || _client.isEdge, _cx7[_Button.styles.sizeLargeWithIcon(this.theme)] = !!this.props.icon, _cx7[_Button.styles.sizeLargeWithIconWithoutText(this.theme)] = _isTheme2022 && !!this.props.icon && !this.props.children, _cx7));case 'medium':return (0, _Emotion.cx)(_Button.styles.sizeMedium(this.theme), (_cx8 = {}, _cx8[_Button.styles.sizeMediumIE11(this.theme)] = _client.isIE11 || _client.isEdge, _cx8[_Button.styles.sizeMediumWithIcon(this.theme)] = !!this.props.icon, _cx8[_Button.styles.sizeMediumWithIconWithoutText(this.theme)] = _isTheme2022 && !!this.props.icon && !this.props.children, _cx8));case 'small':default:return (0, _Emotion.cx)(_Button.styles.sizeSmall(this.theme), (_cx9 = {}, _cx9[_Button.styles.sizeSmallIE11(this.theme)] = _client.isIE11 || _client.isEdge, _cx9[_Button.styles.sizeSmallWithIcon(this.theme)] = !!this.props.icon, _cx9[_Button.styles.sizeSmallWithIconWithoutText(this.theme)] = _isTheme2022 && !!this.props.icon && !this.props.children, _cx9));}};_proto.getSizeWrapClassName = function getSizeWrapClassName() {switch (this.getProps().size) {case 'large':return _Button.styles.wrapLarge(this.theme);case 'medium':return _Button.styles.wrapMedium(this.theme);case 'small':default:return _Button.styles.wrapSmall(this.theme);}};return Button;}(_react.default.Component), _class2.__KONTUR_REACT_UI__ = 'Button', _class2.__BUTTON__ = true, _class2.defaultProps = { use: 'default', size: 'small', type: 'button' }, _temp)) || _class;exports.Button = Button;var isButton = (0, _utils.isReactUIComponent)('Button');exports.isButton = isButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Button.tsx"],"names":["ButtonDataTids","root","spinner","Button","rootNode","getProps","defaultProps","state","focusedByTab","node","handleFocus","e","props","disabled","disableFocus","globalObject","requestAnimationFrame","keyListener","isTabPressed","setState","onFocus","handleBlur","onBlur","_ref","componentDidMount","autoFocus","focus","getDerivedStateFromProps","loading","blur","render","theme","ThemeFactory","create","renderMain","renderLinkRootWithoutHandlers","onClick","children","rest","corners","active","borderless","checked","error","warning","narrow","icon","_noPadding","_noRightPadding","visuallyFocused","align","onMouseEnter","onMouseLeave","onMouseOver","onMouseDown","onMouseUp","onKeyDown","onClickCapture","width","ariaDescribedby","ariaHasPopup","ariaControls","ariaLabel","ariaChecked","ariaExpanded","role","use","type","size","sizeClass","getSizeClassName","isFocused","isLink","_isTheme2022","Boolean","wrapClassNameWithArrow","rootClassNameWithArrow","arrowNode","isUseStateWithoutOutlineInDisabledState","includes","rootClassName","trueDisabled","cx","styles","noPadding","noRightPadding","disabledWithoutOutline","checkedDisabled","checkedDisabled2022","borderless2022","activeStyles","checked2022","checkedFocused","simulatedPress","rootProps","className","style","textAlign","tabIndex","title","wrapProps","globalClasses","wrap","getSizeWrapClassName","innerShadowNode","innerShadow","outlineNode","isDisabled2022","zIndex","undefined","outline","outlineWarning","outlineError","outlineLink","outlineLinkWarning","outlineLinkError","iconNode","loadingNode","loadingIcon","link","linkLineHeight","isSafari","linkLineHeightSafariFallback","linkFocus","linkDisabled","Object","assign","wrapLink","captionNode","caption","captionTranslated","captionLink","captionDisabled","text","visibilityHidden","renderIcon2022","setRootNode","sizes","React","cloneElement","sizeLarge","sizeLargeIE11","isIE11","isEdge","sizeLargeWithIcon","sizeLargeWithIconWithoutText","sizeMedium","sizeMediumIE11","sizeMediumWithIcon","sizeMediumWithIconWithoutText","sizeSmall","sizeSmallIE11","sizeSmallWithIcon","sizeSmallWithIconWithoutText","wrapLarge","wrapMedium","wrapSmall","Component","__KONTUR_REACT_UI__","__BUTTON__","isButton"],"mappings":"4eAAA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,wD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyKO,IAAMA,cAAc,GAAG;AAC5BC,EAAAA,IAAI,EAAE,cADsB;AAE5BC,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AAI,CAAC,CAAC,KAAK7D,KAAL,CAAWkC,IAA7B,IAAqC,CAAC,KAAKlC,KAAL,CAAWyB,QAH/F,QAAP,CAfJ,CAqBD,C,QAEOkE,oB,GAAR,gCAA+B,CAC7B,QAAQ,KAAKlG,QAAL,GAAgB+D,IAAxB,GACE,KAAK,OAAL,CACE,OAAOe,eAAOuE,SAAP,CAAiB,KAAK3H,KAAtB,CAAP,CACF,KAAK,QAAL,CACE,OAAOoD,eAAOwE,UAAP,CAAkB,KAAK5H,KAAvB,CAAP,CACF,KAAK,OAAL,CACA,QACE,OAAOoD,eAAOyE,SAAP,CAAiB,KAAK7H,KAAtB,CAAP,CAPJ,CASD,C,iBA/VyB2G,eAAMmB,S,WAClBC,mB,GAAsB,Q,UACtBC,U,GAAa,I,UAEbzJ,Y,GAA6B,EACzC4D,GAAG,EAAE,SADoC,EAEzCE,IAAI,EAAE,OAFmC,EAGzCD,IAAI,EAAE,QAHmC,E,4CAsXtC,IAAM6F,QAAQ,GAAG,+BAAgC,QAAhC,CAAjB,C","sourcesContent":["import React, { AriaAttributes, HTMLAttributes } from 'react';\nimport { globalObject } from '@skbkontur/global-object';\n\nimport { HTMLProps } from '../../typings/html';\nimport { isKonturIcon, isReactUIComponent } from '../../lib/utils';\nimport { isIE11, isEdge, isSafari } from '../../lib/client';\nimport { keyListener } from '../../lib/events/keyListener';\nimport { Theme, ThemeIn } from '../../lib/theming/Theme';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { CommonWrapper, CommonProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { ThemeFactory } from '../../lib/theming/ThemeFactory';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { isTheme2022 } from '../../lib/theming/ThemeHelpers';\nimport { Link, LinkProps } from '../Link';\nimport { Spinner } from '../Spinner';\nimport { LoadingIcon } from '../../internal/icons2022/LoadingIcon';\nimport { SizeProp } from '../../lib/types/props';\n\nimport { styles, activeStyles, globalClasses } from './Button.styles';\nimport { ButtonIcon, getButtonIconSizes } from './ButtonIcon';\nimport { useButtonArrow } from './ButtonArrow';\nimport { getInnerLinkTheme } from './getInnerLinkTheme';\n\n/**\n * @deprecated use SizeProp\n */\nexport type ButtonSize = SizeProp;\nexport type ButtonType = 'button' | 'submit' | 'reset';\nexport type ButtonUse = 'default' | 'primary' | 'success' | 'danger' | 'pay' | 'link' | 'text' | 'backless';\n\nexport interface ButtonProps\n extends CommonProps,\n Pick<\n AriaAttributes,\n 'aria-haspopup' | 'aria-describedby' | 'aria-controls' | 'aria-label' | 'aria-checked' | 'aria-expanded'\n >,\n Pick<HTMLAttributes<unknown>, 'role'>,\n Pick<HTMLProps['button'], 'onClickCapture' | 'onMouseUp' | 'onMouseDown'> {\n /** @ignore */\n _noPadding?: boolean;\n\n /** @ignore */\n _noRightPadding?: boolean;\n\n /**\n * Применяет к кнопке стили псевдокласса `:active`.\n */\n active?: boolean;\n\n /**\n * CSS-свойство `text-align`.\n */\n align?: React.CSSProperties['textAlign'];\n\n /**\n * Превращает обычную кнопку в кнопку со стрелкой.\n */\n arrow?: boolean | 'left';\n\n /**\n * Даёт кнопке фокус после окончания загрузки страницы.\n */\n autoFocus?: boolean;\n\n /**\n * Убирает обводку у кнопки.\n */\n borderless?: boolean;\n\n /**\n * @ignore\n */\n checked?: boolean;\n\n children?: React.ReactNode;\n\n /** @ignore */\n corners?: React.CSSProperties;\n\n /**\n * Отключенное состояние кнопки.\n */\n disabled?: boolean;\n\n /** @ignore */\n disableFocus?: boolean;\n\n /**\n * Состояние валидации при ошибке.\n */\n error?: boolean;\n\n /**\n * Иконка слева от текста кнопки.\n */\n icon?: React.ReactElement<any>;\n\n /**\n * Переводит кнопку в состояние загрузки.\n */\n loading?: boolean;\n\n /**\n * Сужает кнопку.\n */\n narrow?: boolean;\n\n /**\n * HTML-событие `onblur`.\n */\n onBlur?: React.FocusEventHandler<HTMLButtonElement>;\n\n /**\n * HTML-событие `onclick`.\n */\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n\n /**\n * HTML-событие `onfocus`.\n */\n onFocus?: React.FocusEventHandler<HTMLButtonElement>;\n\n /**\n * HTML-событие `keydown`.\n */\n onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;\n\n /**\n * HTML-событие `onmouseenter`.\n */\n onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;\n\n /**\n * HTML-событие `mouseleave`.\n */\n onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;\n\n /**\n * HTML-событие `onmouseover`.\n */\n onMouseOver?: React.MouseEventHandler<HTMLButtonElement>;\n\n /**\n * Задаёт размер кнопки.\n *\n * **Допустимые значения**: `\"small\"`, `\"medium\"`, `\"large\"`.\n */\n size?: SizeProp;\n\n /**\n * HTML-атрибут `type`.\n */\n type?: ButtonType;\n\n /**\n * HTML-атрибут `title`.\n */\n title?: string;\n\n /**\n * Стиль кнопки.\n *\n * **Допустимые значения**: `\"default\"`, `\"primary\"`, `\"success\"`, `\"danger\"`, `\"pay\"`, `\"link\"`, `\"text\"`, `\"backless\"`.\n */\n use?: ButtonUse;\n\n /** @ignore */\n visuallyFocused?: boolean;\n\n /**\n * Состояние валидации при предупреждении.\n */\n warning?: boolean;\n\n /**\n * CSS-свойство `width`.\n */\n width?: number | string;\n\n /**\n * Обычный объект с переменными темы.\n * Он будет объединён с темой из контекста.\n */\n theme?: ThemeIn;\n}\n\nexport interface ButtonState {\n focusedByTab: boolean;\n}\n\nexport const ButtonDataTids = {\n root: 'Button__root',\n spinner: 'Button__spinner',\n} as const;\n\ntype DefaultProps = Required<Pick<ButtonProps, 'use' | 'size' | 'type'>>;\n\n@rootNode\nexport class Button extends React.Component<ButtonProps, ButtonState> {\n public static __KONTUR_REACT_UI__ = 'Button';\n public static __BUTTON__ = true;\n\n public static defaultProps: DefaultProps = {\n use: 'default',\n size: 'small',\n type: 'button',\n };\n\n private getProps = createPropsGetter(Button.defaultProps);\n\n public state = {\n focusedByTab: false,\n };\n\n private theme!: Theme;\n private node: HTMLButtonElement | null = null;\n private setRootNode!: TSetRootNode;\n\n public componentDidMount() {\n if (this.props.autoFocus) {\n keyListener.isTabPressed = true;\n this.focus();\n }\n }\n\n public static getDerivedStateFromProps(props: ButtonProps) {\n if (props.loading || props.disabled) {\n return { focusedByTab: false };\n }\n return null;\n }\n\n /**\n * @public\n */\n public focus() {\n this.node?.focus();\n }\n\n /**\n * @public\n */\n public blur() {\n this.node?.blur();\n }\n\n public render(): JSX.Element {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = this.props.theme ? ThemeFactory.create(this.props.theme as Theme, theme) : theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderLinkRootWithoutHandlers(props: LinkProps) {\n const { onClick, onFocus, onBlur, children, ...rest } = props;\n return <span {...rest}>{children}</span>;\n }\n\n private renderMain() {\n const {\n corners,\n active,\n disabled,\n borderless,\n checked,\n error,\n warning,\n loading,\n narrow,\n icon,\n _noPadding,\n _noRightPadding,\n visuallyFocused,\n align,\n disableFocus,\n onMouseEnter,\n onMouseLeave,\n onMouseOver,\n onMouseDown,\n onMouseUp,\n onKeyDown,\n onClick,\n onClickCapture,\n width,\n children,\n 'aria-describedby': ariaDescribedby,\n 'aria-haspopup': ariaHasPopup,\n 'aria-controls': ariaControls,\n 'aria-label': ariaLabel,\n 'aria-checked': ariaChecked,\n 'aria-expanded': ariaExpanded,\n role,\n } = this.props;\n const { use, type, size } = this.getProps();\n const sizeClass = this.getSizeClassName();\n\n const isFocused = this.state.focusedByTab || visuallyFocused;\n const isLink = use === 'link';\n const _isTheme2022 = isTheme2022(this.theme);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [wrapClassNameWithArrow, rootClassNameWithArrow, arrowNode] = useButtonArrow(\n { ...this.props, isFocused: Boolean(isFocused) },\n this.theme,\n );\n const isUseStateWithoutOutlineInDisabledState = !['default', 'backless'].includes(use);\n let rootClassName = '';\n if (_isTheme2022) {\n const trueDisabled = disabled || loading;\n rootClassName = cx(\n styles.root(this.theme),\n styles[use](this.theme),\n sizeClass,\n narrow && styles.narrow(),\n _noPadding && styles.noPadding(),\n _noRightPadding && styles.noRightPadding(),\n rootClassNameWithArrow,\n ...(trueDisabled\n ? [\n styles.disabled(this.theme),\n isUseStateWithoutOutlineInDisabledState && styles.disabledWithoutOutline(this.theme),\n checked && styles.checkedDisabled(this.theme),\n checked && styles.checkedDisabled2022(this.theme),\n borderless && styles.borderless2022(),\n ]\n : [\n active && !checked && activeStyles[use](this.theme),\n isFocused && styles.focus(this.theme),\n checked && styles.checked2022(this.theme),\n checked && isFocused && styles.checkedFocused(this.theme),\n borderless && !checked && !isFocused && styles.borderless2022(),\n ]),\n );\n } else {\n rootClassName = cx({\n [styles.root(this.theme)]: true,\n [styles.simulatedPress()]: true,\n [styles[use](this.theme)]: true,\n [activeStyles[use](this.theme)]: active,\n [sizeClass]: true,\n [styles.focus(this.theme)]: isFocused,\n [styles.checked(this.theme)]: checked,\n [styles.checkedFocused(this.theme)]: checked && isFocused,\n [styles.disabled(this.theme)]: disabled || loading,\n [styles.checkedDisabled(this.theme)]: checked && disabled,\n [styles.borderless()]: borderless && !disabled && !loading && !checked && !isFocused && !active,\n [styles.narrow()]: narrow,\n [styles.noPadding()]: _noPadding,\n [styles.noRightPadding()]: _noRightPadding,\n });\n }\n\n const rootProps = {\n // By default the type attribute is 'submit'. IE8 will fire a click event\n // on this button if somewhere on the page user presses Enter while some\n // input is focused. So we set type to 'button' by default.\n type,\n role,\n 'aria-describedby': ariaDescribedby,\n 'aria-haspopup': ariaHasPopup,\n 'aria-controls': ariaControls,\n 'aria-label': ariaLabel,\n 'aria-checked': ariaChecked,\n 'aria-expanded': ariaExpanded,\n className: rootClassName,\n style: {\n textAlign: align,\n ...corners,\n },\n disabled: disabled || loading,\n onClick,\n onFocus: this.handleFocus,\n onBlur: this.handleBlur,\n onKeyDown,\n onMouseEnter,\n onMouseLeave,\n onMouseOver,\n onMouseDown,\n onMouseUp,\n onClickCapture,\n tabIndex: disableFocus ? -1 : 0,\n title: this.props.title,\n };\n\n const wrapProps = {\n className: cx(globalClasses.root, {\n [styles.wrap(this.theme)]: true,\n [wrapClassNameWithArrow]: true,\n [this.getSizeWrapClassName()]: true,\n }),\n style: {\n width,\n },\n };\n\n const innerShadowNode = _isTheme2022 ? null : <div className={globalClasses.innerShadow} />;\n\n let outlineNode = null;\n const isDisabled2022 = _isTheme2022 && (disabled || loading);\n if ((!isFocused || isLink) && !isDisabled2022) {\n outlineNode = (\n <div\n style={{ zIndex: _isTheme2022 && isLink ? -1 : undefined }}\n className={cx(styles.outline(), {\n [styles.outlineWarning(this.theme)]: warning,\n [styles.outlineError(this.theme)]: error,\n [styles.outlineLink()]: isLink,\n [styles.outlineLinkWarning(this.theme)]: isLink && warning,\n [styles.outlineLinkError(this.theme)]: isLink && error,\n })}\n />\n );\n }\n\n const iconNode = icon && (\n <ButtonIcon\n icon={icon}\n size={size}\n hasChildren={Boolean(children)}\n disabled={disabled || false}\n loading={loading || false}\n use={use}\n />\n );\n let loadingNode = null;\n if (loading && !icon) {\n const loadingIcon = _isTheme2022 ? <LoadingIcon size={size} /> : <Spinner caption={null} dimmed type=\"mini\" />;\n loadingNode = (\n <div data-tid={ButtonDataTids.spinner} className={styles.loading()}>\n {loadingIcon}\n </div>\n );\n }\n\n // Force disable all props and features, that cannot be use with Link\n if (isLink) {\n rootProps.className = cx({\n [styles.root(this.theme)]: true,\n [sizeClass]: true,\n [styles.link(this.theme)]: true,\n [styles.linkLineHeight()]: !isSafari || (isSafari && !_isTheme2022),\n [styles.linkLineHeightSafariFallback()]: isSafari && _isTheme2022,\n [styles.linkFocus(this.theme)]: isFocused,\n [styles.linkDisabled(this.theme)]: disabled || loading,\n });\n Object.assign(wrapProps, {\n className: cx(styles.wrap(this.theme), styles.wrapLink()),\n style: { width: wrapProps.style.width },\n });\n rootProps.style.textAlign = undefined;\n }\n\n let captionNode = (\n <div\n className={cx(styles.caption(), globalClasses.caption, {\n [styles.captionTranslated()]: (active || checked) && !loading && !_isTheme2022,\n [styles.captionLink()]: isLink,\n [styles.captionDisabled()]: !checked && disabled,\n })}\n >\n {loadingNode}\n {iconNode}\n <span\n className={cx(globalClasses.text, {\n [styles.visibilityHidden()]: !!loadingNode,\n })}\n >\n {children}\n </span>\n </div>\n );\n if (_isTheme2022 && isLink && !loading) {\n captionNode = (\n <ThemeContext.Provider value={getInnerLinkTheme(this.theme)}>\n <Link\n focused={isFocused}\n disabled={disabled}\n icon={this.renderIcon2022(icon)}\n as={this.renderLinkRootWithoutHandlers}\n tabIndex={-1}\n >\n {children}\n </Link>\n </ThemeContext.Provider>\n );\n }\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <span {...wrapProps}>\n <button data-tid={ButtonDataTids.root} ref={this._ref} {...rootProps}>\n {innerShadowNode}\n {outlineNode}\n {arrowNode}\n {captionNode}\n </button>\n </span>\n </CommonWrapper>\n );\n }\n\n private renderIcon2022(icon: React.ReactElement | undefined) {\n if (icon && isKonturIcon(icon)) {\n const sizes = getButtonIconSizes(this.theme);\n return React.cloneElement(icon, { size: icon.props.size ?? sizes[this.getProps().size] });\n }\n\n return icon;\n }\n\n private getSizeClassName() {\n const _isTheme2022 = isTheme2022(this.theme);\n switch (this.getProps().size) {\n case 'large':\n return cx(styles.sizeLarge(this.theme), {\n [styles.sizeLargeIE11(this.theme)]: isIE11 || isEdge,\n [styles.sizeLargeWithIcon(this.theme)]: !!this.props.icon,\n [styles.sizeLargeWithIconWithoutText(this.theme)]: _isTheme2022 && !!this.props.icon && !this.props.children,\n });\n case 'medium':\n return cx(styles.sizeMedium(this.theme), {\n [styles.sizeMediumIE11(this.theme)]: isIE11 || isEdge,\n [styles.sizeMediumWithIcon(this.theme)]: !!this.props.icon,\n [styles.sizeMediumWithIconWithoutText(this.theme)]: _isTheme2022 && !!this.props.icon && !this.props.children,\n });\n case 'small':\n default:\n return cx(styles.sizeSmall(this.theme), {\n [styles.sizeSmallIE11(this.theme)]: isIE11 || isEdge,\n [styles.sizeSmallWithIcon(this.theme)]: !!this.props.icon,\n [styles.sizeSmallWithIconWithoutText(this.theme)]: _isTheme2022 && !!this.props.icon && !this.props.children,\n });\n }\n }\n\n private getSizeWrapClassName() {\n switch (this.getProps().size) {\n case 'large':\n return styles.wrapLarge(this.theme);\n case 'medium':\n return styles.wrapMedium(this.theme);\n case 'small':\n default:\n return styles.wrapSmall(this.theme);\n }\n }\n\n private handleFocus = (e: React.FocusEvent<HTMLButtonElement>) => {\n if (!this.props.disabled && !this.props.disableFocus) {\n // focus event fires before keyDown eventlistener\n // so we should check tabPressed in async way\n globalObject.requestAnimationFrame?.(() => {\n if (keyListener.isTabPressed) {\n this.setState({ focusedByTab: true });\n }\n });\n this.props.onFocus?.(e);\n }\n };\n\n private handleBlur = (e: React.FocusEvent<HTMLButtonElement>) => {\n this.setState({ focusedByTab: false });\n if (!this.props.disabled && !this.props.disableFocus) {\n this.props.onBlur?.(e);\n }\n };\n\n private _ref = (node: HTMLButtonElement | null) => {\n this.node = node;\n };\n}\n\nexport const isButton = isReactUIComponent<ButtonProps>('Button');\n"]}
|
|
1
|
+
{"version":3,"sources":["Button.tsx"],"names":["ButtonDataTids","root","spinner","Button","rootNode","getProps","defaultProps","state","focusedByTab","node","handleFocus","e","props","disabled","disableFocus","globalObject","requestAnimationFrame","keyListener","isTabPressed","setState","onFocus","handleBlur","onBlur","_ref","componentDidMount","autoFocus","focus","getDerivedStateFromProps","loading","blur","render","theme","ThemeFactory","create","renderMain","renderLinkRootWithoutHandlers","onClick","children","rest","corners","active","borderless","checked","error","warning","narrow","icon","rightIcon","_noPadding","_noRightPadding","visuallyFocused","align","onMouseEnter","onMouseLeave","onMouseOver","onMouseDown","onMouseUp","onKeyDown","onClickCapture","width","ariaDescribedby","ariaHasPopup","ariaControls","ariaLabel","ariaChecked","ariaExpanded","role","use","type","size","sizeClass","getSizeClassName","isFocused","isLink","_isTheme2022","Boolean","wrapClassNameWithArrow","rootClassNameWithArrow","arrowNode","isUseStateWithoutOutlineInDisabledState","includes","rootClassName","trueDisabled","cx","styles","noPadding","noRightPadding","disabledWithoutOutline","checkedDisabled","checkedDisabled2022","borderless2022","activeStyles","checked2022","checkedFocused","simulatedPress","rootProps","className","style","textAlign","tabIndex","title","wrapProps","globalClasses","wrap","getSizeWrapClassName","innerShadowNode","innerShadow","outlineNode","isDisabled2022","zIndex","undefined","outline","outlineWarning","outlineError","outlineLink","outlineLinkWarning","outlineLinkError","iconProps","hasChildren","leftIconNode","rightIconNode","link","linkLineHeight","isSafari","linkLineHeightSafariFallback","linkFocus","linkDisabled","Object","assign","wrapLink","hasLoadingNode","loadingNode","captionNode","caption","captionTranslated","captionLink","captionDisabled","text","visibilityHidden","renderIcon2022","setRootNode","sizes","React","cloneElement","sizeLarge","sizeLargeIE11","isIE11","isEdge","sizeLargeWithIcon","sizeLargeWithIconWithoutText","sizeMedium","sizeMediumIE11","sizeMediumWithIcon","sizeMediumWithIconWithoutText","sizeSmall","sizeSmallIE11","sizeSmallWithIcon","sizeSmallWithIconWithoutText","wrapLarge","wrapMedium","wrapSmall","Component","__KONTUR_REACT_UI__","__BUTTON__","isButton"],"mappings":"4eAAA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,wD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8KO,IAAMA,cAAc,GAAG;AAC5BC,EAAAA,IAAI,EAAE,cADsB;AAE5BC,EAAAA,OAAO,EAAE,iBAFmB,EAAvB,C;;;;;;AAQMC,M,OADZC,kB;;;;;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,eAAOyE,4BAAP,CAAoC,KAAK9H,KAAzC,CAHI,IAG8C2C,YAAY,IAAI,CAAC,CAAC,KAAK9D,KAAL,CAAWkC,IAA7B,IAAqC,CAAC,KAAKlC,KAAL,CAAWyB,QAH/F,QAAP,CAfJ,CAqBD,C,QAEOmE,oB,GAAR,gCAA+B,CAC7B,QAAQ,KAAKnG,QAAL,GAAgBgE,IAAxB,GACE,KAAK,OAAL,CACE,OAAOe,eAAO0E,SAAP,CAAiB,KAAK/H,KAAtB,CAAP,CACF,KAAK,QAAL,CACE,OAAOqD,eAAO2E,UAAP,CAAkB,KAAKhI,KAAvB,CAAP,CACF,KAAK,OAAL,CACA,QACE,OAAOqD,eAAO4E,SAAP,CAAiB,KAAKjI,KAAtB,CAAP,CAPJ,CASD,C,iBA5VyB+G,eAAMmB,S,WAClBC,mB,GAAsB,Q,UACtBC,U,GAAa,I,UAEb7J,Y,GAA6B,EACzC6D,GAAG,EAAE,SADoC,EAEzCE,IAAI,EAAE,OAFmC,EAGzCD,IAAI,EAAE,QAHmC,E,4CAmXtC,IAAMgG,QAAQ,GAAG,+BAAgC,QAAhC,CAAjB,C","sourcesContent":["import React, { AriaAttributes, HTMLAttributes } from 'react';\nimport { globalObject } from '@skbkontur/global-object';\n\nimport { HTMLProps } from '../../typings/html';\nimport { isKonturIcon, isReactUIComponent } from '../../lib/utils';\nimport { isIE11, isEdge, isSafari } from '../../lib/client';\nimport { keyListener } from '../../lib/events/keyListener';\nimport { Theme, ThemeIn } from '../../lib/theming/Theme';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { CommonWrapper, CommonProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { ThemeFactory } from '../../lib/theming/ThemeFactory';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { isTheme2022 } from '../../lib/theming/ThemeHelpers';\nimport { Link, LinkProps } from '../Link';\nimport { SizeProp } from '../../lib/types/props';\n\nimport { styles, activeStyles, globalClasses } from './Button.styles';\nimport { ButtonIcon, ButtonIconProps, getButtonIconSizes } from './ButtonIcon';\nimport { useButtonArrow } from './ButtonArrow';\nimport { getInnerLinkTheme } from './getInnerLinkTheme';\nimport { LoadingButtonIcon } from './LoadingButtonIcon';\n\n/**\n * @deprecated use SizeProp\n */\nexport type ButtonSize = SizeProp;\nexport type ButtonType = 'button' | 'submit' | 'reset';\nexport type ButtonUse = 'default' | 'primary' | 'success' | 'danger' | 'pay' | 'link' | 'text' | 'backless';\n\nexport interface ButtonProps\n extends CommonProps,\n Pick<\n AriaAttributes,\n 'aria-haspopup' | 'aria-describedby' | 'aria-controls' | 'aria-label' | 'aria-checked' | 'aria-expanded'\n >,\n Pick<HTMLAttributes<unknown>, 'role'>,\n Pick<HTMLProps['button'], 'onClickCapture' | 'onMouseUp' | 'onMouseDown'> {\n /** @ignore */\n _noPadding?: boolean;\n\n /** @ignore */\n _noRightPadding?: boolean;\n\n /**\n * Применяет к кнопке стили псевдокласса `:active`.\n */\n active?: boolean;\n\n /**\n * CSS-свойство `text-align`.\n */\n align?: React.CSSProperties['textAlign'];\n\n /**\n * Превращает обычную кнопку в кнопку со стрелкой.\n */\n arrow?: boolean | 'left';\n\n /**\n * Даёт кнопке фокус после окончания загрузки страницы.\n */\n autoFocus?: boolean;\n\n /**\n * Убирает обводку у кнопки.\n */\n borderless?: boolean;\n\n /**\n * @ignore\n */\n checked?: boolean;\n\n children?: React.ReactNode;\n\n /** @ignore */\n corners?: React.CSSProperties;\n\n /**\n * Отключенное состояние кнопки.\n */\n disabled?: boolean;\n\n /** @ignore */\n disableFocus?: boolean;\n\n /**\n * Состояние валидации при ошибке.\n */\n error?: boolean;\n\n /**\n * Иконка слева от текста кнопки.\n */\n icon?: React.ReactElement;\n\n /**\n * Иконка справа от текста кнопки.\n */\n rightIcon?: React.ReactElement;\n\n /**\n * Переводит кнопку в состояние загрузки.\n */\n loading?: boolean;\n\n /**\n * Сужает кнопку.\n */\n narrow?: boolean;\n\n /**\n * HTML-событие `onblur`.\n */\n onBlur?: React.FocusEventHandler<HTMLButtonElement>;\n\n /**\n * HTML-событие `onclick`.\n */\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n\n /**\n * HTML-событие `onfocus`.\n */\n onFocus?: React.FocusEventHandler<HTMLButtonElement>;\n\n /**\n * HTML-событие `keydown`.\n */\n onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;\n\n /**\n * HTML-событие `onmouseenter`.\n */\n onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;\n\n /**\n * HTML-событие `mouseleave`.\n */\n onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;\n\n /**\n * HTML-событие `onmouseover`.\n */\n onMouseOver?: React.MouseEventHandler<HTMLButtonElement>;\n\n /**\n * Задаёт размер кнопки.\n *\n * **Допустимые значения**: `\"small\"`, `\"medium\"`, `\"large\"`.\n */\n size?: SizeProp;\n\n /**\n * HTML-атрибут `type`.\n */\n type?: ButtonType;\n\n /**\n * HTML-атрибут `title`.\n */\n title?: string;\n\n /**\n * Стиль кнопки.\n *\n * **Допустимые значения**: `\"default\"`, `\"primary\"`, `\"success\"`, `\"danger\"`, `\"pay\"`, `\"link\"`, `\"text\"`, `\"backless\"`.\n */\n use?: ButtonUse;\n\n /** @ignore */\n visuallyFocused?: boolean;\n\n /**\n * Состояние валидации при предупреждении.\n */\n warning?: boolean;\n\n /**\n * CSS-свойство `width`.\n */\n width?: number | string;\n\n /**\n * Обычный объект с переменными темы.\n * Он будет объединён с темой из контекста.\n */\n theme?: ThemeIn;\n}\n\nexport interface ButtonState {\n focusedByTab: boolean;\n}\n\nexport const ButtonDataTids = {\n root: 'Button__root',\n spinner: 'Button__spinner',\n} as const;\n\ntype DefaultProps = Required<Pick<ButtonProps, 'use' | 'size' | 'type'>>;\n\n@rootNode\nexport class Button extends React.Component<ButtonProps, ButtonState> {\n public static __KONTUR_REACT_UI__ = 'Button';\n public static __BUTTON__ = true;\n\n public static defaultProps: DefaultProps = {\n use: 'default',\n size: 'small',\n type: 'button',\n };\n\n private getProps = createPropsGetter(Button.defaultProps);\n\n public state = {\n focusedByTab: false,\n };\n\n private theme!: Theme;\n private node: HTMLButtonElement | null = null;\n private setRootNode!: TSetRootNode;\n\n public componentDidMount() {\n if (this.props.autoFocus) {\n keyListener.isTabPressed = true;\n this.focus();\n }\n }\n\n public static getDerivedStateFromProps(props: ButtonProps) {\n if (props.loading || props.disabled) {\n return { focusedByTab: false };\n }\n return null;\n }\n\n /**\n * @public\n */\n public focus() {\n this.node?.focus();\n }\n\n /**\n * @public\n */\n public blur() {\n this.node?.blur();\n }\n\n public render(): JSX.Element {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = this.props.theme ? ThemeFactory.create(this.props.theme as Theme, theme) : theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderLinkRootWithoutHandlers(props: LinkProps) {\n const { onClick, onFocus, onBlur, children, ...rest } = props;\n return <span {...rest}>{children}</span>;\n }\n\n private renderMain() {\n const {\n corners,\n active,\n disabled,\n borderless,\n checked,\n error,\n warning,\n loading,\n narrow,\n icon,\n rightIcon,\n _noPadding,\n _noRightPadding,\n visuallyFocused,\n align,\n disableFocus,\n onMouseEnter,\n onMouseLeave,\n onMouseOver,\n onMouseDown,\n onMouseUp,\n onKeyDown,\n onClick,\n onClickCapture,\n width,\n children,\n 'aria-describedby': ariaDescribedby,\n 'aria-haspopup': ariaHasPopup,\n 'aria-controls': ariaControls,\n 'aria-label': ariaLabel,\n 'aria-checked': ariaChecked,\n 'aria-expanded': ariaExpanded,\n role,\n } = this.props;\n const { use, type, size } = this.getProps();\n const sizeClass = this.getSizeClassName();\n\n const isFocused = this.state.focusedByTab || visuallyFocused;\n const isLink = use === 'link';\n const _isTheme2022 = isTheme2022(this.theme);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [wrapClassNameWithArrow, rootClassNameWithArrow, arrowNode] = useButtonArrow(\n { ...this.props, isFocused: Boolean(isFocused) },\n this.theme,\n );\n const isUseStateWithoutOutlineInDisabledState = !['default', 'backless'].includes(use);\n let rootClassName = '';\n if (_isTheme2022) {\n const trueDisabled = disabled || loading;\n rootClassName = cx(\n styles.root(this.theme),\n styles[use](this.theme),\n sizeClass,\n narrow && styles.narrow(),\n _noPadding && styles.noPadding(),\n _noRightPadding && styles.noRightPadding(),\n rootClassNameWithArrow,\n ...(trueDisabled\n ? [\n styles.disabled(this.theme),\n isUseStateWithoutOutlineInDisabledState && styles.disabledWithoutOutline(this.theme),\n checked && styles.checkedDisabled(this.theme),\n checked && styles.checkedDisabled2022(this.theme),\n borderless && styles.borderless2022(),\n ]\n : [\n active && !checked && activeStyles[use](this.theme),\n isFocused && styles.focus(this.theme),\n checked && styles.checked2022(this.theme),\n checked && isFocused && styles.checkedFocused(this.theme),\n borderless && !checked && !isFocused && styles.borderless2022(),\n ]),\n );\n } else {\n rootClassName = cx({\n [styles.root(this.theme)]: true,\n [styles.simulatedPress()]: true,\n [styles[use](this.theme)]: true,\n [activeStyles[use](this.theme)]: active,\n [sizeClass]: true,\n [styles.focus(this.theme)]: isFocused,\n [styles.checked(this.theme)]: checked,\n [styles.checkedFocused(this.theme)]: checked && isFocused,\n [styles.disabled(this.theme)]: disabled || loading,\n [styles.checkedDisabled(this.theme)]: checked && disabled,\n [styles.borderless()]: borderless && !disabled && !loading && !checked && !isFocused && !active,\n [styles.narrow()]: narrow,\n [styles.noPadding()]: _noPadding,\n [styles.noRightPadding()]: _noRightPadding,\n });\n }\n\n const rootProps = {\n // By default the type attribute is 'submit'. IE8 will fire a click event\n // on this button if somewhere on the page user presses Enter while some\n // input is focused. So we set type to 'button' by default.\n type,\n role,\n 'aria-describedby': ariaDescribedby,\n 'aria-haspopup': ariaHasPopup,\n 'aria-controls': ariaControls,\n 'aria-label': ariaLabel,\n 'aria-checked': ariaChecked,\n 'aria-expanded': ariaExpanded,\n className: rootClassName,\n style: {\n textAlign: align,\n ...corners,\n },\n disabled: disabled || loading,\n onClick,\n onFocus: this.handleFocus,\n onBlur: this.handleBlur,\n onKeyDown,\n onMouseEnter,\n onMouseLeave,\n onMouseOver,\n onMouseDown,\n onMouseUp,\n onClickCapture,\n tabIndex: disableFocus ? -1 : 0,\n title: this.props.title,\n };\n\n const wrapProps = {\n className: cx(globalClasses.root, {\n [styles.wrap(this.theme)]: true,\n [wrapClassNameWithArrow]: true,\n [this.getSizeWrapClassName()]: true,\n }),\n style: {\n width,\n },\n };\n\n const innerShadowNode = _isTheme2022 ? null : <div className={globalClasses.innerShadow} />;\n\n let outlineNode = null;\n const isDisabled2022 = _isTheme2022 && (disabled || loading);\n if ((!isFocused || isLink) && !isDisabled2022) {\n outlineNode = (\n <div\n style={{ zIndex: _isTheme2022 && isLink ? -1 : undefined }}\n className={cx(styles.outline(), {\n [styles.outlineWarning(this.theme)]: warning,\n [styles.outlineError(this.theme)]: error,\n [styles.outlineLink()]: isLink,\n [styles.outlineLinkWarning(this.theme)]: isLink && warning,\n [styles.outlineLinkError(this.theme)]: isLink && error,\n })}\n />\n );\n }\n\n const iconProps: Omit<ButtonIconProps, 'position'> = {\n use,\n size: this.getProps().size,\n hasChildren: !!children,\n loading: loading || false,\n };\n const leftIconNode = icon && <ButtonIcon {...iconProps} position=\"left\" icon={icon} />;\n const rightIconNode = rightIcon && (\n <ButtonIcon {...iconProps} hasBothIcons={!!icon && !!rightIcon} position=\"right\" icon={rightIcon} />\n );\n\n // Force disable all props and features, that cannot be use with Link\n if (isLink) {\n rootProps.className = cx({\n [styles.root(this.theme)]: true,\n [sizeClass]: true,\n [styles.link(this.theme)]: true,\n [styles.linkLineHeight()]: !isSafari || (isSafari && !_isTheme2022),\n [styles.linkLineHeightSafariFallback()]: isSafari && _isTheme2022,\n [styles.linkFocus(this.theme)]: isFocused,\n [styles.linkDisabled(this.theme)]: disabled || loading,\n });\n Object.assign(wrapProps, {\n className: cx(styles.wrap(this.theme), styles.wrapLink()),\n style: { width: wrapProps.style.width },\n });\n rootProps.style.textAlign = undefined;\n }\n\n const hasLoadingNode = loading && !icon && !rightIcon;\n const loadingNode = hasLoadingNode && <LoadingButtonIcon size={size} />;\n\n let captionNode = (\n <div\n className={cx(styles.caption(), globalClasses.caption, {\n [styles.captionTranslated()]: (active || checked) && !loading && !_isTheme2022,\n [styles.captionLink()]: isLink,\n [styles.captionDisabled()]: !checked && disabled,\n })}\n >\n {loadingNode}\n {leftIconNode}\n <span\n className={cx(globalClasses.text, {\n [styles.visibilityHidden()]: hasLoadingNode,\n })}\n >\n {children}\n </span>\n {rightIconNode}\n </div>\n );\n if (_isTheme2022 && isLink && !loading) {\n captionNode = (\n <ThemeContext.Provider value={getInnerLinkTheme(this.theme)}>\n <Link\n focused={isFocused}\n disabled={disabled}\n icon={this.renderIcon2022(icon)}\n rightIcon={this.renderIcon2022(rightIcon)}\n as={this.renderLinkRootWithoutHandlers}\n tabIndex={-1}\n >\n {children}\n </Link>\n </ThemeContext.Provider>\n );\n }\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <span {...wrapProps}>\n <button data-tid={ButtonDataTids.root} ref={this._ref} {...rootProps}>\n {innerShadowNode}\n {outlineNode}\n {arrowNode}\n {captionNode}\n </button>\n </span>\n </CommonWrapper>\n );\n }\n\n private renderIcon2022(icon: React.ReactElement | undefined) {\n if (icon && isKonturIcon(icon)) {\n const sizes = getButtonIconSizes(this.theme);\n return React.cloneElement(icon, { size: icon.props.size ?? sizes[this.getProps().size] });\n }\n\n return icon;\n }\n\n private getSizeClassName() {\n const _isTheme2022 = isTheme2022(this.theme);\n switch (this.getProps().size) {\n case 'large':\n return cx(styles.sizeLarge(this.theme), {\n [styles.sizeLargeIE11(this.theme)]: isIE11 || isEdge,\n [styles.sizeLargeWithIcon(this.theme)]: !!this.props.icon,\n [styles.sizeLargeWithIconWithoutText(this.theme)]: _isTheme2022 && !!this.props.icon && !this.props.children,\n });\n case 'medium':\n return cx(styles.sizeMedium(this.theme), {\n [styles.sizeMediumIE11(this.theme)]: isIE11 || isEdge,\n [styles.sizeMediumWithIcon(this.theme)]: !!this.props.icon,\n [styles.sizeMediumWithIconWithoutText(this.theme)]: _isTheme2022 && !!this.props.icon && !this.props.children,\n });\n case 'small':\n default:\n return cx(styles.sizeSmall(this.theme), {\n [styles.sizeSmallIE11(this.theme)]: isIE11 || isEdge,\n [styles.sizeSmallWithIcon(this.theme)]: !!this.props.icon,\n [styles.sizeSmallWithIconWithoutText(this.theme)]: _isTheme2022 && !!this.props.icon && !this.props.children,\n });\n }\n }\n\n private getSizeWrapClassName() {\n switch (this.getProps().size) {\n case 'large':\n return styles.wrapLarge(this.theme);\n case 'medium':\n return styles.wrapMedium(this.theme);\n case 'small':\n default:\n return styles.wrapSmall(this.theme);\n }\n }\n\n private handleFocus = (e: React.FocusEvent<HTMLButtonElement>) => {\n if (!this.props.disabled && !this.props.disableFocus) {\n // focus event fires before keyDown eventlistener\n // so we should check tabPressed in async way\n globalObject.requestAnimationFrame?.(() => {\n if (keyListener.isTabPressed) {\n this.setState({ focusedByTab: true });\n }\n });\n this.props.onFocus?.(e);\n }\n };\n\n private handleBlur = (e: React.FocusEvent<HTMLButtonElement>) => {\n this.setState({ focusedByTab: false });\n if (!this.props.disabled && !this.props.disableFocus) {\n this.props.onBlur?.(e);\n }\n };\n\n private _ref = (node: HTMLButtonElement | null) => {\n this.node = node;\n };\n}\n\nexport const isButton = isReactUIComponent<ButtonProps>('Button');\n"]}
|
|
@@ -43,46 +43,49 @@ const bgStyle = {
|
|
|
43
43
|
</Gapped>
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
В кнопку можно передать иконку. Иконка может находиться как слева от текста кнопки, так и справа и даже в обоих позициях одновременно.
|
|
47
47
|
|
|
48
48
|
```jsx harmony
|
|
49
|
-
import
|
|
50
|
-
import {
|
|
49
|
+
import { Button, Gapped } from '@skbkontur/react-ui';
|
|
50
|
+
import { XIcon16Regular } from '@skbkontur/icons/XIcon16Regular';
|
|
51
51
|
|
|
52
|
-
<
|
|
52
|
+
<Gapped gap={5}>
|
|
53
|
+
<Button icon={<XIcon16Regular />}>Закрыть</Button>
|
|
54
|
+
<Button icon={<XIcon16Regular />} rightIcon={<XIcon16Regular />}>Закрыть</Button>
|
|
55
|
+
<Button rightIcon={<XIcon16Regular />}>Закрыть</Button>
|
|
56
|
+
</Gapped>
|
|
53
57
|
```
|
|
54
58
|
|
|
55
59
|
У кнопки есть 3 стандартных размера.
|
|
56
60
|
|
|
57
61
|
```jsx harmony
|
|
58
62
|
<div
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
style={{
|
|
64
|
+
display: "flex",
|
|
65
|
+
alignItems: "end",
|
|
66
|
+
gap: '10px',
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
<Button size="small">Маленькая</Button>
|
|
70
|
+
<Button size="medium">Средняя</Button>
|
|
71
|
+
<Button size="large">Большая</Button>
|
|
68
72
|
</div>
|
|
69
73
|
```
|
|
70
74
|
|
|
71
|
-
Кнопки
|
|
75
|
+
Кнопки могут принимать вид стрелок. В таком случае иконка привязывается к краю кнопки.
|
|
72
76
|
|
|
73
77
|
```jsx harmony
|
|
74
78
|
import { Gapped, Button } from '@skbkontur/react-ui';
|
|
75
79
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
</Gapped>;
|
|
80
|
+
|
|
81
|
+
<Gapped gap={5}>
|
|
82
|
+
<Button arrow="left" size="medium">
|
|
83
|
+
Назад
|
|
84
|
+
</Button>
|
|
85
|
+
<Button arrow size="medium">
|
|
86
|
+
Далее
|
|
87
|
+
</Button>
|
|
88
|
+
</Gapped>
|
|
86
89
|
```
|
|
87
90
|
|
|
88
91
|
Кнопка в состоянии загрузки.
|
|
@@ -91,12 +94,11 @@ import { Gapped, Button } from '@skbkontur/react-ui';
|
|
|
91
94
|
|
|
92
95
|
Кнопка на время нахождения в состоянии загрузки отключается.
|
|
93
96
|
|
|
94
|
-
Если в кнопке есть иконка, на время загрузки иконка заменяется на спиннер, если иконки нет
|
|
97
|
+
Если в кнопке есть иконка, на время загрузки иконка заменяется на спиннер, если иконки нет — весь контент кнопки заменяется на спиннер. Когда иконки две — заменяется только левая.
|
|
95
98
|
|
|
96
99
|
```jsx harmony
|
|
97
100
|
import { Button, Gapped } from '@skbkontur/react-ui';
|
|
98
|
-
import
|
|
99
|
-
import BookmarkIcon from '@skbkontur/react-icons/Bookmark';
|
|
101
|
+
import { MinusCircleIcon16Light } from '@skbkontur/icons/MinusCircleIcon16Light';
|
|
100
102
|
|
|
101
103
|
const [loading, setLoading] = React.useState(false);
|
|
102
104
|
|
|
@@ -116,10 +118,16 @@ const handleClick = () => {
|
|
|
116
118
|
|
|
117
119
|
<Gapped>
|
|
118
120
|
<Button width={150} onClick={handleClick} loading={loading}>
|
|
119
|
-
|
|
121
|
+
Удалить
|
|
122
|
+
</Button>
|
|
123
|
+
<Button icon={<MinusCircleIcon16Light />} width={150} onClick={handleClick} loading={loading}>
|
|
124
|
+
Удалить
|
|
125
|
+
</Button>
|
|
126
|
+
<Button rightIcon={<MinusCircleIcon16Light />} width={150} onClick={handleClick} loading={loading}>
|
|
127
|
+
Удалить
|
|
120
128
|
</Button>
|
|
121
|
-
<Button icon={<
|
|
122
|
-
|
|
129
|
+
<Button icon={<MinusCircleIcon16Light />} rightIcon={<MinusCircleIcon16Light />} width={150} onClick={handleClick} loading={loading}>
|
|
130
|
+
Удалить
|
|
123
131
|
</Button>
|
|
124
132
|
</Gapped>
|
|
125
133
|
|
|
@@ -142,7 +150,7 @@ import { Button, Gapped } from '@skbkontur/react-ui';
|
|
|
142
150
|
|
|
143
151
|
```jsx harmony
|
|
144
152
|
import { Toast } from "@skbkontur/react-ui";
|
|
145
|
-
import {
|
|
153
|
+
import { CopyIcon16Regular } from "@skbkontur/icons/CopyIcon16Regular"
|
|
146
154
|
|
|
147
155
|
const textDecorationStyles = {
|
|
148
156
|
btnLinkLineBorderBottomWidth: '0',
|
|
@@ -186,7 +194,7 @@ const renderExampleRow = (title, styles, index) => {
|
|
|
186
194
|
<td style={tdStyle}>
|
|
187
195
|
<div style={{display: 'flex'}}>
|
|
188
196
|
<div style={{width: '80%', whiteSpace: 'pre-line'}}>{stringify(styles).replace(/, /g, '\n')}</div>
|
|
189
|
-
<Button icon={<
|
|
197
|
+
<Button icon={<CopyIcon16Regular />} use={'text'} onClick={() => copyStyles(styles)}/>
|
|
190
198
|
</div>
|
|
191
199
|
</td>
|
|
192
200
|
</tr>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const buttonUseMixin: (btnBackground: string, btnBackgroundStart: string, btnBackgroundEnd: string, color: string, borderColor: string, borderBottomColor: string, borderWidth: string) => string;
|
|
2
|
-
export declare const buttonHoverMixin: (btnBackground: string, btnBackgroundStart: string, btnBackgroundEnd: string, borderColor: string, borderBottomColor: string, borderWidth: string) => string;
|
|
2
|
+
export declare const buttonHoverMixin: (btnBackground: string, btnBackgroundStart: string, btnBackgroundEnd: string, color: string, borderColor: string, borderBottomColor: string, borderWidth: string) => string;
|
|
3
3
|
export declare const buttonActiveMixin: (btnBackground: string, btnShadow: string, borderColor: string, borderTopColor: string, borderWidth: string, arrowBgImage: string) => string;
|
|
4
4
|
export declare const buttonSizeMixin: (fontSize: string, lineHeight: string, paddingX: string, paddingY: string, fontFamilyCompensation: string) => string;
|
|
5
5
|
export declare const buttonSizeMixinIE11: (fontSize: string, paddingX: string, paddingY: string, fontFamilyCompensation: string) => string;
|
|
@@ -62,15 +62,17 @@ var buttonHoverMixin = function buttonHoverMixin(
|
|
|
62
62
|
btnBackground,
|
|
63
63
|
btnBackgroundStart,
|
|
64
64
|
btnBackgroundEnd,
|
|
65
|
+
color,
|
|
65
66
|
borderColor,
|
|
66
67
|
borderBottomColor,
|
|
67
68
|
borderWidth)
|
|
68
69
|
{
|
|
69
70
|
var hasGradient = btnBackgroundStart !== btnBackgroundEnd;
|
|
70
|
-
return (0, _Emotion.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)(["\n background-color: ", ";\n background-image: ", ";\n box-shadow: 0 0 0 ", " ", "", ";\n\n .", " {\n box-shadow: ", " 0 0 ", ";\n }\n "])),
|
|
71
|
+
return (0, _Emotion.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)(["\n background-color: ", ";\n background-image: ", ";\n box-shadow: 0 0 0 ", " ", "", ";\n color: ", ";\n\n .", " {\n box-shadow: ", " 0 0 ", ";\n }\n "])),
|
|
71
72
|
hasGradient ? "initial" : btnBackground,
|
|
72
73
|
hasGradient ? "linear-gradient(" + btnBackgroundStart + ", " + btnBackgroundEnd + ")" : "none",
|
|
73
74
|
borderWidth, borderColor, borderBottomColor ? ", 0 " + borderWidth + " 0 0 " + borderBottomColor : "",
|
|
75
|
+
color,
|
|
74
76
|
|
|
75
77
|
_Button.globalClasses.arrowHelper,
|
|
76
78
|
borderWidth, borderColor);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Button.mixins.ts"],"names":["getBtnPadding","fontSize","paddingY","paddingX","fontFamilyCompensation","additionalOffset","paddingTop","paddingBottom","offset","parseInt","shiftUp","top","bottom","buttonUseMixin","btnBackground","btnBackgroundStart","btnBackgroundEnd","color","borderColor","borderBottomColor","borderWidth","hasGradient","css","globalClasses","arrowHelper","icon","arrow","buttonHoverMixin","buttonActiveMixin","btnShadow","borderTopColor","arrowBgImage","innerShadow","arrowHelperTop","buttonSizeMixin","lineHeight","buttonSizeMixinIE11","arrowOutlineMixin","insetWidth","outlineColor","outlineWidth","insetColor","arrowHelperBottom"],"mappings":"+ZAAA;AACA;;AAEA,yC;;AAEA,IAAMA,aAAa,GAAG,S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,iBAAiB,YAAUC,WAAV,aAA6BD,iBAA7B,KAJpE;;AAMKI,wBAAcC,WANnB;AAOkBJ,EAAAA,WAPlB,EAOuCF,WAPvC;;;;;AAYOK,wBAAcE,IAZrB;AAaOF,wBAAcG,KAbrB;AAceT,EAAAA,KAdf;;;;AAkBD,CA5BM,C;;AA8BA,IAAMU,gBAAgB,GAAG,SAAnBA,gBAAmB;AAC9Bb,aAD8B;AAE9BC,kBAF8B;AAG9BC,gBAH8B;
|
|
1
|
+
{"version":3,"sources":["Button.mixins.ts"],"names":["getBtnPadding","fontSize","paddingY","paddingX","fontFamilyCompensation","additionalOffset","paddingTop","paddingBottom","offset","parseInt","shiftUp","top","bottom","buttonUseMixin","btnBackground","btnBackgroundStart","btnBackgroundEnd","color","borderColor","borderBottomColor","borderWidth","hasGradient","css","globalClasses","arrowHelper","icon","arrow","buttonHoverMixin","buttonActiveMixin","btnShadow","borderTopColor","arrowBgImage","innerShadow","arrowHelperTop","buttonSizeMixin","lineHeight","buttonSizeMixinIE11","arrowOutlineMixin","insetWidth","outlineColor","outlineWidth","insetColor","arrowHelperBottom"],"mappings":"+ZAAA;AACA;;AAEA,yC;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB;AACpBC,QADoB;AAEpBC,QAFoB;AAGpBC,QAHoB;AAIpBC,sBAJoB;AAKpBC,gBALoB;AAMT,KADXA,gBACW,cADXA,gBACW,GADQ,CACR;AACX,MAAIC,UAAU,GAAGJ,QAAjB;AACA,MAAIK,aAAa,GAAGL,QAApB;AACA,MAAMM,MAAM,GAAGC,QAAQ,CAACL,sBAAD,CAAR,IAAoC,CAAnD;;AAEA,MAAMM,OAAO,GAAG,SAAVA,OAAU,CAACC,GAAD,EAAcC,MAAd,EAA8BJ,MAA9B,EAAiD;AAC/D,WAAO,CAAC,+BAAMG,GAAN,OAAc,CAACH,MAAf,CAAD,EAA2B,+BAAMI,MAAN,OAAiBJ,MAAjB,CAA3B,CAAP;AACD,GAFD;;AAIA,MA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;;AAID,CAVM,C;;AAYA,IAAMiC,iBAAiB,GAAG,SAApBA,iBAAoB;AAC/BC,UAD+B;AAE/BC,YAF+B;AAG/BC,YAH+B;AAI/BC,UAJ+B;AAK5B;AACH,aAAOnB,YAAP;AACKC,wBAAcC,WADnB;AAEQD,wBAAcU,cAFtB;AAG2BK,EAAAA,UAH3B,EAGyCA,UAHzC,EAG2DG,UAH3D,EAG0ED,YAH1E,EAGgGD,YAHhG;;;AAMQhB,wBAAcmB,iBANtB;AAO2BJ,EAAAA,UAP3B,EAO0CA,UAP1C,EAO4DG,UAP5D,EAO2ED,YAP3E,EAOiGD,YAPjG;;;;;;AAaaD,EAAAA,UAbb;AAceA,EAAAA,UAdf;AAecA,EAAAA,UAfd;;AAiBQf,wBAAcmB,iBAjBtB;AAkBgBJ,EAAAA,UAlBhB;;;;AAsBD,CA5BM,C","sourcesContent":["import { css } from '../../lib/theming/Emotion';\nimport { shift } from '../../lib/styles/DimensionFunctions';\n\nimport { globalClasses } from './Button.styles';\n\nconst getBtnPadding = (\n fontSize: string,\n paddingY: string,\n paddingX: string,\n fontFamilyCompensation: string,\n additionalOffset = 0,\n): string => {\n let paddingTop = paddingY;\n let paddingBottom = paddingY;\n const offset = parseInt(fontFamilyCompensation) || 0;\n\n const shiftUp = (top: string, bottom: string, offset: number) => {\n return [shift(top, `${-offset}`), shift(bottom, `${offset}`)];\n };\n\n if (fontSize === '16px' && offset) {\n [paddingTop, paddingBottom] = shiftUp(paddingTop, paddingBottom, offset);\n }\n if (additionalOffset && offset) {\n [paddingTop, paddingBottom] = shiftUp(paddingTop, paddingBottom, additionalOffset);\n }\n\n return `${paddingTop} ${paddingX} ${paddingBottom}`;\n};\n\nexport const buttonUseMixin = (\n btnBackground: string,\n btnBackgroundStart: string,\n btnBackgroundEnd: string,\n color: string,\n borderColor: string,\n borderBottomColor: string,\n borderWidth: string,\n) => {\n const hasGradient = btnBackgroundStart !== btnBackgroundEnd;\n return css`\n background-color: ${hasGradient ? `initial` : btnBackground};\n background-image: ${hasGradient ? `linear-gradient(${btnBackgroundStart}, ${btnBackgroundEnd})` : `none`};\n color: ${color};\n box-shadow: 0 0 0 ${borderWidth} ${borderColor}${borderBottomColor ? `, 0 ${borderWidth} 0 0 ${borderBottomColor}` : ``};\n\n .${globalClasses.arrowHelper} {\n box-shadow: ${borderWidth} 0 0 0 ${borderColor};\n }\n\n :enabled:hover,\n :enabled {\n .${globalClasses.icon} svg,\n .${globalClasses.arrow} svg {\n color: ${color};\n }\n }\n `;\n};\n\nexport const buttonHoverMixin = (\n btnBackground: string,\n btnBackgroundStart: string,\n btnBackgroundEnd: string,\n color: string,\n borderColor: string,\n borderBottomColor: string,\n borderWidth: string,\n) => {\n const hasGradient = btnBackgroundStart !== btnBackgroundEnd;\n return css`\n background-color: ${hasGradient ? `initial` : btnBackground};\n background-image: ${hasGradient ? `linear-gradient(${btnBackgroundStart}, ${btnBackgroundEnd})` : `none`};\n box-shadow: 0 0 0 ${borderWidth} ${borderColor}${borderBottomColor ? `, 0 ${borderWidth} 0 0 ${borderBottomColor}` : ``};\n color: ${color};\n\n .${globalClasses.arrowHelper} {\n box-shadow: ${borderWidth} 0 0 ${borderColor};\n }\n `;\n};\n\nexport const buttonActiveMixin = (\n btnBackground: string,\n btnShadow: string,\n borderColor: string,\n borderTopColor: string,\n borderWidth: string,\n arrowBgImage: string,\n) => {\n return css`\n &,\n &:hover {\n background-image: none !important; // override :hover styles\n background-color: ${btnBackground} !important; // override :hover styles\n box-shadow: 0 0 0 ${borderWidth} ${borderColor}${borderTopColor ? `, 0 -${borderWidth} 0 0 ${borderTopColor}` : ``} !important; // override :hover styles\n\n .${globalClasses.innerShadow} {\n box-shadow: ${btnShadow};\n }\n\n .${globalClasses.arrowHelper} {\n box-shadow: ${borderWidth} 0 0 ${borderColor};\n\n &.${globalClasses.arrowHelperTop} {\n background-image: ${arrowBgImage};\n }\n }\n }\n `;\n};\n\nexport const buttonSizeMixin = (\n fontSize: string,\n lineHeight: string,\n paddingX: string,\n paddingY: string,\n fontFamilyCompensation: string,\n) => {\n return css`\n font-size: ${fontSize};\n box-sizing: border-box;\n padding: ${getBtnPadding(fontSize, paddingY, paddingX, fontFamilyCompensation)};\n line-height: ${lineHeight};\n `;\n};\n\nexport const buttonSizeMixinIE11 = (\n fontSize: string,\n paddingX: string,\n paddingY: string,\n fontFamilyCompensation: string,\n) => {\n return css`\n padding: ${getBtnPadding(fontSize, paddingY, paddingX, fontFamilyCompensation, 1)};\n line-height: normal;\n `;\n};\n\nexport const arrowOutlineMixin = (\n insetWidth: string,\n outlineColor: string,\n outlineWidth: string,\n insetColor: string,\n) => {\n return css`\n .${globalClasses.arrowHelper} {\n &.${globalClasses.arrowHelperTop} {\n box-shadow: inset -${insetWidth} ${insetWidth} 0 0 ${insetColor}, ${outlineWidth} 0 0 0 ${outlineColor} !important; // override :active styles\n }\n\n &.${globalClasses.arrowHelperBottom} {\n box-shadow: inset -${insetWidth} -${insetWidth} 0 0 ${insetColor}, ${outlineWidth} 0 0 0 ${outlineColor} !important; // override :active styles\n }\n\n // don't hide inner outline\n // and keep the middle-line fix\n &:before {\n top: ${insetWidth};\n right: ${insetWidth};\n left: ${insetWidth};\n }\n &.${globalClasses.arrowHelperBottom}:before {\n bottom: ${insetWidth};\n }\n }\n `;\n};\n"]}
|
|
@@ -78,15 +78,9 @@ export declare const styles: {
|
|
|
78
78
|
narrow(): string;
|
|
79
79
|
noPadding(): string;
|
|
80
80
|
noRightPadding(): string;
|
|
81
|
-
iconNoRightMargin(): string;
|
|
82
|
-
iconLink(t: Theme): string;
|
|
83
81
|
wrapLink(): string;
|
|
84
82
|
wrapArrow(): string;
|
|
85
83
|
wrapArrowLeft(): string;
|
|
86
|
-
icon(t: Theme): string;
|
|
87
|
-
iconSmall(t: Theme): string;
|
|
88
|
-
iconMedium(t: Theme): string;
|
|
89
|
-
iconLarge(t: Theme): string;
|
|
90
84
|
borderless(): string;
|
|
91
85
|
borderless2022(): string;
|
|
92
86
|
loading(): string;
|