@skbkontur/react-ui 4.26.0 → 4.27.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/CHANGELOG.md +16 -0
- package/cjs/components/Button/Button.d.ts +1 -1
- package/cjs/components/Button/Button.js +3 -2
- package/cjs/components/Button/Button.js.map +1 -1
- package/cjs/components/ComboBox/ComboBox.d.ts +2 -2
- package/cjs/components/ComboBox/ComboBox.js +1 -0
- package/cjs/components/ComboBox/ComboBox.js.map +1 -1
- package/cjs/components/CurrencyLabel/CurrencyLabel.d.ts +3 -3
- package/cjs/components/CurrencyLabel/CurrencyLabel.js +4 -3
- package/cjs/components/CurrencyLabel/CurrencyLabel.js.map +1 -1
- package/cjs/components/DateInput/DateInput.d.ts +2 -2
- package/cjs/components/DateInput/DateInput.js +2 -1
- package/cjs/components/DateInput/DateInput.js.map +1 -1
- package/cjs/components/DatePicker/DatePicker.d.ts +2 -2
- package/cjs/components/DatePicker/DatePicker.js +3 -1
- package/cjs/components/DatePicker/DatePicker.js.map +1 -1
- package/cjs/components/Dropdown/Dropdown.d.ts +2 -2
- package/cjs/components/Dropdown/Dropdown.js +2 -0
- package/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/cjs/components/DropdownMenu/DropdownMenu.d.ts +2 -2
- package/cjs/components/DropdownMenu/DropdownMenu.js +3 -1
- package/cjs/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/cjs/components/Kebab/Kebab.d.ts +2 -2
- package/cjs/components/Kebab/Kebab.js +3 -1
- package/cjs/components/Kebab/Kebab.js.map +1 -1
- package/cjs/components/MenuFooter/MenuFooter.d.ts +3 -3
- package/cjs/components/MenuFooter/MenuFooter.js +3 -2
- package/cjs/components/MenuFooter/MenuFooter.js.map +1 -1
- package/cjs/components/MenuHeader/MenuHeader.d.ts +3 -3
- package/cjs/components/MenuHeader/MenuHeader.js +3 -2
- package/cjs/components/MenuHeader/MenuHeader.js.map +1 -1
- package/cjs/components/MenuItem/MenuItem.d.ts +2 -2
- package/cjs/components/MenuItem/MenuItem.js +1 -0
- package/cjs/components/MenuItem/MenuItem.js.map +1 -1
- package/cjs/components/Select/Select.d.ts +2 -2
- package/cjs/components/Select/Select.js +2 -0
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/TokenInput/TokenInput.d.ts +4 -3
- package/cjs/components/TokenInput/TokenInput.js +11 -4
- package/cjs/components/TokenInput/TokenInput.js.map +1 -1
- package/cjs/internal/CustomComboBox/ComboBoxView.d.ts +2 -2
- package/cjs/internal/CustomComboBox/ComboBoxView.js +5 -1
- package/cjs/internal/CustomComboBox/ComboBoxView.js.map +1 -1
- package/cjs/internal/CustomComboBox/CustomComboBox.d.ts +2 -2
- package/cjs/internal/CustomComboBox/CustomComboBox.js +3 -1
- package/cjs/internal/CustomComboBox/CustomComboBox.js.map +1 -1
- package/cjs/internal/PopupMenu/PopupMenu.d.ts +3 -3
- package/cjs/internal/PopupMenu/PopupMenu.js +3 -1
- package/cjs/internal/PopupMenu/PopupMenu.js.map +1 -1
- package/cjs/internal/themes/Theme2022Dark.js +1 -1
- package/cjs/internal/themes/Theme2022Dark.js.map +1 -1
- package/components/Button/Button/Button.js +3 -1
- package/components/Button/Button/Button.js.map +1 -1
- package/components/Button/Button.d.ts +1 -1
- package/components/ComboBox/ComboBox/ComboBox.js.map +1 -1
- package/components/ComboBox/ComboBox.d.ts +2 -2
- package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js +4 -2
- package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js.map +1 -1
- package/components/CurrencyLabel/CurrencyLabel.d.ts +3 -3
- package/components/DateInput/DateInput/DateInput.js +1 -0
- package/components/DateInput/DateInput/DateInput.js.map +1 -1
- package/components/DateInput/DateInput.d.ts +2 -2
- package/components/DatePicker/DatePicker/DatePicker.js +3 -1
- package/components/DatePicker/DatePicker/DatePicker.js.map +1 -1
- package/components/DatePicker/DatePicker.d.ts +2 -2
- package/components/Dropdown/Dropdown/Dropdown.js +1 -0
- package/components/Dropdown/Dropdown/Dropdown.js.map +1 -1
- package/components/Dropdown/Dropdown.d.ts +2 -2
- package/components/DropdownMenu/DropdownMenu/DropdownMenu.js +1 -0
- package/components/DropdownMenu/DropdownMenu/DropdownMenu.js.map +1 -1
- package/components/DropdownMenu/DropdownMenu.d.ts +2 -2
- package/components/Kebab/Kebab/Kebab.js +1 -0
- package/components/Kebab/Kebab/Kebab.js.map +1 -1
- package/components/Kebab/Kebab.d.ts +2 -2
- package/components/MenuFooter/MenuFooter/MenuFooter.js +4 -2
- package/components/MenuFooter/MenuFooter/MenuFooter.js.map +1 -1
- package/components/MenuFooter/MenuFooter.d.ts +3 -3
- package/components/MenuHeader/MenuHeader/MenuHeader.js +4 -2
- package/components/MenuHeader/MenuHeader/MenuHeader.js.map +1 -1
- package/components/MenuHeader/MenuHeader.d.ts +3 -3
- package/components/MenuItem/MenuItem/MenuItem.js.map +1 -1
- package/components/MenuItem/MenuItem.d.ts +2 -2
- package/components/Select/Select/Select.js +1 -0
- package/components/Select/Select/Select.js.map +1 -1
- package/components/Select/Select.d.ts +2 -2
- package/components/TokenInput/TokenInput/TokenInput.js +9 -2
- package/components/TokenInput/TokenInput/TokenInput.js.map +1 -1
- package/components/TokenInput/TokenInput.d.ts +4 -3
- package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js +3 -0
- package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js.map +1 -1
- package/internal/CustomComboBox/ComboBoxView.d.ts +2 -2
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js +1 -0
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js.map +1 -1
- package/internal/CustomComboBox/CustomComboBox.d.ts +2 -2
- package/internal/PopupMenu/PopupMenu/PopupMenu.js +2 -1
- package/internal/PopupMenu/PopupMenu/PopupMenu.js.map +1 -1
- package/internal/PopupMenu/PopupMenu.d.ts +3 -3
- package/internal/themes/Theme2022Dark/Theme2022Dark.js +1 -1
- package/internal/themes/Theme2022Dark/Theme2022Dark.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.27.0](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@4.26.0...@skbkontur/react-ui@4.27.0) (2024-09-30)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **Button:** fix btnTextHoverBg, btnTextActiveBg vars in Theme2022Dark ([#3464](https://github.com/skbkontur/retail-ui/issues/3464)) ([c6d70a3](https://github.com/skbkontur/retail-ui/commit/c6d70a31809903ffe11c6b63108dc100721e595e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **react-ui, a11y:** add id prop for multiple components ([#3502](https://github.com/skbkontur/retail-ui/issues/3502)) ([2ba3db7](https://github.com/skbkontur/retail-ui/commit/2ba3db7894840e97df1daa845b555c6cc6924f18))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [4.26.0](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@4.25.2...@skbkontur/react-ui@4.26.0) (2024-08-20)
|
|
7
23
|
|
|
8
24
|
|
|
@@ -9,7 +9,7 @@ import { SizeProp } from '../../lib/types/props';
|
|
|
9
9
|
export declare type ButtonSize = SizeProp;
|
|
10
10
|
export declare type ButtonType = 'button' | 'submit' | 'reset';
|
|
11
11
|
export declare type ButtonUse = 'default' | 'primary' | 'success' | 'danger' | 'pay' | 'link' | 'text' | 'backless';
|
|
12
|
-
export interface ButtonProps extends CommonProps, Pick<AriaAttributes, 'aria-haspopup' | 'aria-describedby' | 'aria-controls' | 'aria-label' | 'aria-checked' | 'aria-expanded'>, Pick<HTMLAttributes<unknown>, 'role'>, Pick<HTMLProps['button'], 'onClickCapture' | 'onMouseUp' | 'onMouseDown'> {
|
|
12
|
+
export interface ButtonProps extends CommonProps, Pick<AriaAttributes, 'aria-haspopup' | 'aria-describedby' | 'aria-controls' | 'aria-label' | 'aria-checked' | 'aria-expanded'>, Pick<HTMLAttributes<unknown>, 'role' | 'id'>, Pick<HTMLProps['button'], 'onClickCapture' | 'onMouseUp' | 'onMouseDown'> {
|
|
13
13
|
/** @ignore */
|
|
14
14
|
_noPadding?: boolean;
|
|
15
15
|
/** @ignore */
|
|
@@ -554,6 +554,7 @@ Button = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/functi
|
|
|
554
554
|
|
|
555
555
|
|
|
556
556
|
|
|
557
|
+
|
|
557
558
|
|
|
558
559
|
|
|
559
560
|
handleFocus = function (e) {
|
|
@@ -582,9 +583,9 @@ Button = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/functi
|
|
|
582
583
|
* @public
|
|
583
584
|
*/;_proto.focus = function focus() {var _this$node;(_this$node = this.node) == null ? void 0 : _this$node.focus();} /**
|
|
584
585
|
* @public
|
|
585
|
-
*/;_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
|
|
586
|
+
*/;_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,id = _this$props.id;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
|
|
586
587
|
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(), use === 'backless' && !checked && _Button.styles.backlessDisabled2022(this.theme), use === 'text' && _Button.styles.textDisabled2022()] : [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
|
|
587
588
|
// on this button if somewhere on the page user presses Enter while some
|
|
588
589
|
// input is focused. So we set type to 'button' by default.
|
|
589
590
|
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
|
|
590
|
-
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", (0, _extends2.default)({}, wrapProps, { "data-tid": ButtonDataTids.rootElement }), /*#__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.displayName = '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;
|
|
591
|
+
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", (0, _extends2.default)({}, wrapProps, { "data-tid": ButtonDataTids.rootElement }), /*#__PURE__*/_react.default.createElement("button", (0, _extends2.default)({ id: id, "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.displayName = '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","rootElement","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","backlessDisabled2022","textDisabled2022","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__","displayName","__BUTTON__","isButton"],"mappings":"ofAAA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,wD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8KO,IAAMA,cAAc,GAAG;AAC5BC,EAAAA,WAAW,EAAE,qBADe;AAE5BC,EAAAA,IAAI,EAAE,cAFsB;AAG5BC,EAAAA,OAAO,EAAE,iBAHmB,EAAvB,C;;;;;;AASMC,M,OADZC,kB;;;;;;;;;;;AAYSC,IAAAA,Q,GAAW,0CAAkBF,MAAM,CAACG,YAAzB,C;;AAEZC,IAAAA,K,GAAQ;AACbC,MAAAA,YAAY,EAAE,KADD,E;;;;AAKPC,IAAAA,I,GAAiC,I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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2C,YAAY,IAAI,CAAC,CAAC,KAAK9D,KAAL,CAAWkC,IAA7B,IAAqC,CAAC,KAAKlC,KAAL,CAAWyB,QAH/F,QAAP,CAfJ,CAqBD,C,QAEOqE,oB,GAAR,gCAA+B,CAC7B,QAAQ,KAAKrG,QAAL,GAAgBgE,IAAxB,GACE,KAAK,OAAL,CACE,OAAOe,eAAO4E,SAAP,CAAiB,KAAKjI,KAAtB,CAAP,CACF,KAAK,QAAL,CACE,OAAOqD,eAAO6E,UAAP,CAAkB,KAAKlI,KAAvB,CAAP,CACF,KAAK,OAAL,CACA,QACE,OAAOqD,eAAO8E,SAAP,CAAiB,KAAKnI,KAAtB,CAAP,CAPJ,CASD,C,iBA/VyBiH,eAAMmB,S,WAClBC,mB,GAAsB,Q,UACtBC,W,GAAc,Q,UACdC,U,GAAa,I,UAEbhK,Y,GAA6B,EACzC6D,GAAG,EAAE,SADoC,EAEzCE,IAAI,EAAE,OAFmC,EAGzCD,IAAI,EAAE,QAHmC,E,4CAqXtC,IAAMmG,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 rootElement: 'Button__rootElement',\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 displayName = '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 use === 'backless' && !checked && styles.backlessDisabled2022(this.theme),\n use === 'text' && styles.textDisabled2022(),\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} data-tid={ButtonDataTids.rootElement}>\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","rootElement","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","id","use","type","size","sizeClass","getSizeClassName","isFocused","isLink","_isTheme2022","Boolean","wrapClassNameWithArrow","rootClassNameWithArrow","arrowNode","isUseStateWithoutOutlineInDisabledState","includes","rootClassName","trueDisabled","cx","styles","noPadding","noRightPadding","disabledWithoutOutline","checkedDisabled","checkedDisabled2022","borderless2022","backlessDisabled2022","textDisabled2022","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__","displayName","__BUTTON__","isButton"],"mappings":"ofAAA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,wD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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D,IAAI,EAAE,QAHmC,E,4CAsXtC,IAAMmG,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' | 'id'>,\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 rootElement: 'Button__rootElement',\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 displayName = '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 id,\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 use === 'backless' && !checked && styles.backlessDisabled2022(this.theme),\n use === 'text' && styles.textDisabled2022(),\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} data-tid={ButtonDataTids.rootElement}>\n <button id={id} 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,11 +1,11 @@
|
|
|
1
|
-
import React, { AriaAttributes } from 'react';
|
|
1
|
+
import React, { AriaAttributes, HTMLAttributes } from 'react';
|
|
2
2
|
import { DropdownContainerProps } from '../../internal/DropdownContainer';
|
|
3
3
|
import { Nullable } from '../../typings/utility-types';
|
|
4
4
|
import { MenuItemState } from '../MenuItem';
|
|
5
5
|
import { InputIconType } from '../Input';
|
|
6
6
|
import { CommonProps } from '../../internal/CommonWrapper';
|
|
7
7
|
import { SizeProp } from '../../lib/types/props';
|
|
8
|
-
export interface ComboBoxProps<T> extends Pick<DropdownContainerProps, 'menuPos'>, Pick<AriaAttributes, 'aria-describedby' | 'aria-label'>, CommonProps {
|
|
8
|
+
export interface ComboBoxProps<T> extends Pick<DropdownContainerProps, 'menuPos'>, Pick<HTMLAttributes<HTMLElement>, 'id'>, Pick<AriaAttributes, 'aria-describedby' | 'aria-label'>, CommonProps {
|
|
9
9
|
align?: 'left' | 'center' | 'right';
|
|
10
10
|
/**
|
|
11
11
|
* Вызывает функцию поиска `getItems` при фокусе и очистке поля ввода
|
|
@@ -196,6 +196,7 @@ var _createPropsGetter = require("../../lib/createPropsGetter");var _class, _cla
|
|
|
196
196
|
|
|
197
197
|
|
|
198
198
|
|
|
199
|
+
|
|
199
200
|
|
|
200
201
|
|
|
201
202
|
ComboBox = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function (_React$Component) {(0, _inheritsLoose2.default)(ComboBox, _React$Component);function ComboBox() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;_this.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ComboBox.tsx"],"names":["ComboBox","rootNode","getProps","defaultProps","comboboxElement","customComboBoxRef","element","setRootNode","focus","blur","search","query","cancelSearch","open","close","selectInputText","reset","render","props","size","React","Component","__KONTUR_REACT_UI__","displayName","itemToValue","item","value","valueToString","label","renderValue","renderItem","menuAlign","searchOnFocus","drawArrow"],"mappings":"8UAAA;;;AAGA;;;;;AAKA;AACA,gE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+LaA,Q,OADZC,kB;;;;;;;;;;;;;;AAeSC,IAAAA,Q,GAAW,0CAAkBF,QAAQ,CAACG,YAA3B,C;;AAEXC,IAAAA,e,GAA+C,I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqF/CC,IAAAA,iB,GAAoB,UAACC,OAAD,EAA0C;AACpE,YAAKC,WAAL,CAAiBD,OAAjB;AACA,YAAKF,eAAL,GAAuBE,OAAvB;AACD,K,gDArFD;AACF;AACA,K,OACSE,K,GAAP,iBAAe,CACb,IAAI,KAAKJ,eAAT,EAA0B,CACxB,KAAKA,eAAL,CAAqBI,KAArB,GACD,CACF,C,CAED;AAC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AwBA,IAAI,CAACG,KAA7B,EAF+B,EAG9CC,WAAW,EAAE,qBAACJ,IAAD,UAAwBA,IAAI,CAACG,KAA7B,EAHiC,EAI9CE,UAAU,EAAE,oBAACL,IAAD,UAAwBA,IAAI,CAACG,KAA7B,EAJkC,EAK9CG,SAAS,EAAE,MALmC,EAM9CC,aAAa,EAAE,IAN+B,EAO9CC,SAAS,EAAE,IAPmC,E","sourcesContent":["import React, { AriaAttributes } from 'react';\n\nimport { DropdownContainerProps } from '../../internal/DropdownContainer';\nimport { CustomComboBox } from '../../internal/CustomComboBox';\nimport { Nullable } from '../../typings/utility-types';\nimport { MenuItemState } from '../MenuItem';\nimport { InputIconType } from '../Input';\nimport { CommonProps } from '../../internal/CommonWrapper';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { SizeProp } from '../../lib/types/props';\n\nexport interface ComboBoxProps<T>\n extends Pick<DropdownContainerProps, 'menuPos'>,\n Pick<AriaAttributes, 'aria-describedby' | 'aria-label'>,\n CommonProps {\n align?: 'left' | 'center' | 'right';\n /**\n * Вызывает функцию поиска `getItems` при фокусе и очистке поля ввода\n * @default true\n */\n searchOnFocus?: boolean;\n /**\n * Рисует справа иконку в виде стрелки\n * @default true\n */\n drawArrow?: boolean;\n\n autoFocus?: boolean;\n\n borderless?: boolean;\n\n /**\n * Не использовать Portal для рендеринга меню.\n * См. https://github.com/skbkontur/retail-ui/issues/15\n * @default false\n */\n disablePortal?: boolean;\n\n disabled?: boolean;\n /**\n * Состояние валидации при ошибке.\n */\n error?: boolean;\n\n leftIcon?: InputIconType;\n\n rightIcon?: InputIconType;\n\n /**\n * Функция поиска элементов, должна возвращать Promise с массивом элементов.\n * По умолчанию ожидаются объекты с типом `{ value: string, label: string }`.\n *\n * Элементы могут быть любого типа. В этом случае необходимо определить\n * свойства `itemToValue`, `renderValue`, `renderItem`, `valueToString`\n */\n getItems: (query: string) => Promise<Array<ComboBoxExtendedItem<T>>>;\n\n /**\n * Необходим для сравнения полученных результатов с `value`\n * @default item => item.label\n */\n itemToValue?: (item: T) => string | number;\n\n maxLength?: number;\n\n menuAlign?: 'left' | 'right';\n\n onBlur?: () => void;\n\n /** Вызывается при изменении `value` */\n onValueChange?: (value: T) => void;\n\n onFocus?: () => void;\n\n /**\n * Вызывается при изменении текста в поле ввода,\n * если результатом функции будет строка,\n * то она станет следующим состоянием полем ввода\n */\n onInputValueChange?: (value: string) => Nullable<string> | void;\n\n /**\n * Функция для обработки ситуации, когда была введена\n * строка в инпут и был потерян фокус с элемента.\n *\n * Если при потере фокуса в выпадающем списке будет только один\n * элемент и результат `renderValue` с этим элементом будет\n * совпадать со значение в текстовом поле, то\n * сработает onValueChange со значением данного элемента\n *\n * Сама функция также может вернуть значение,\n * неравное `undefined`,\n * с которым будет вызван onValueChange.\n */\n onUnexpectedInput?: (value: string) => void | null | T;\n\n placeholder?: string;\n\n /**\n * Функция отрисовки элементов результата поиска.\n * Не применяется если элемент является функцией или React-элементом\n * @default item => item.label\n */\n renderItem?: (item: T, state?: MenuItemState) => React.ReactNode;\n\n /**\n * Компонент, заменяющий собой обёртку элементов результата поиска.\n *\n * По умолчанию все элементы результата поиска оборачиваются в тег `<button />`.\n *\n * @example\n * itemWrapper={(item) => {\n * if (item.value === 3) {\n * return (props) => {\n * return <a {...props} />\n * }\n * }\n * }}\n */\n itemWrapper?: (item: T) => React.ComponentType<unknown>;\n\n /**\n * Функция для отрисовки сообщения о пустом результате поиска\n * Если есть renderAddButton - не работает\n */\n renderNotFound?: () => React.ReactNode;\n\n /**\n * Функция отображающая сообщение об общем количестве элементов.\n * `found` учитывает только компонент `MenuItem`. Им \"оборачиваются\" элементы, возвращаемые `getItems()`.\n */\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n\n /**\n * Функция отрисовки выбранного значения\n * @default item => item.label\n */\n renderValue?: (item: T) => React.ReactNode;\n\n /**\n * Функция отрисовки кнопки добавления в выпадающем списке\n */\n renderAddButton?: (query?: string) => React.ReactNode;\n\n /**\n * Общее количество элементов.\n * Необходим для работы `renderTotalCount`\n */\n totalCount?: number;\n\n /**\n * Выбранное значение\n * Ожидается, что `value` того же типа что и элементы в массиве,\n * возвращаемом в `getItems`\n */\n value?: Nullable<T>;\n\n /**\n * Необходим для преобразования `value` в строку при фокусировке\n * @default item => item.label\n */\n valueToString?: (item: T) => string;\n\n size?: SizeProp;\n /**\n * Состояние валидации при предупреждении.\n */\n warning?: boolean;\n\n width?: string | number;\n\n maxMenuHeight?: number | string;\n\n onMouseEnter?: (e: React.MouseEvent) => void;\n\n onMouseOver?: (e: React.MouseEvent) => void;\n\n onMouseLeave?: (e: React.MouseEvent) => void;\n\n onInputKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void;\n\n inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];\n}\n\nexport interface ComboBoxItem {\n value: string;\n label: string;\n}\n\nexport type ComboBoxExtendedItem<T> = T | (() => React.ReactElement<T>) | React.ReactElement<T>;\n\ntype DefaultProps<T> = Required<\n Pick<\n ComboBoxProps<T>,\n 'itemToValue' | 'valueToString' | 'renderValue' | 'renderItem' | 'menuAlign' | 'searchOnFocus' | 'drawArrow'\n >\n>;\n\n@rootNode\nexport class ComboBox<T = ComboBoxItem> extends React.Component<ComboBoxProps<T>> {\n public static __KONTUR_REACT_UI__ = 'ComboBox';\n public static displayName = 'ComboBox';\n\n public static defaultProps: DefaultProps<any> = {\n itemToValue: (item: ComboBoxItem) => item.value,\n valueToString: (item: ComboBoxItem) => item.label,\n renderValue: (item: ComboBoxItem) => item.label,\n renderItem: (item: ComboBoxItem) => item.label,\n menuAlign: 'left',\n searchOnFocus: true,\n drawArrow: true,\n };\n\n private getProps = createPropsGetter(ComboBox.defaultProps);\n\n private comboboxElement: Nullable<CustomComboBox<T>> = null;\n private setRootNode!: TSetRootNode;\n\n /**\n * @public\n */\n public focus() {\n if (this.comboboxElement) {\n this.comboboxElement.focus();\n }\n }\n\n /**\n * @public\n */\n public blur() {\n if (this.comboboxElement) {\n this.comboboxElement.blur();\n }\n }\n\n /**\n * Открывает выпадающий список и запускает поиск элементов\n *\n * @public\n * @param {string} [query] Текст поиска. По умолчанию берется\n * текст из инпута или результат `valueToString(value)`\n */\n public search(query?: string) {\n if (this.comboboxElement) {\n this.comboboxElement.search(query);\n }\n }\n\n /**\n * @public\n */\n public cancelSearch() {\n if (this.comboboxElement) {\n this.comboboxElement.cancelSearch();\n }\n }\n\n /**\n * @public Открывает выпадающий список\n */\n public open() {\n if (this.comboboxElement) {\n this.comboboxElement.open();\n }\n }\n\n /**\n * @public Закрывает выпадающий список\n */\n public close() {\n if (this.comboboxElement) {\n this.comboboxElement.close();\n }\n }\n\n /**\n * Выделяет текст внутри input\n * @public\n */\n public selectInputText() {\n if (this.comboboxElement) {\n this.comboboxElement.selectInputText();\n }\n }\n\n /**\n * Сбрасывает введенное пользователем значение\n * @public\n */\n public reset() {\n if (this.comboboxElement) {\n this.comboboxElement.reset();\n }\n }\n\n public render() {\n return <CustomComboBox {...this.getProps()} size={this.props.size} ref={this.customComboBoxRef} />;\n }\n\n private customComboBoxRef = (element: Nullable<CustomComboBox<T>>) => {\n this.setRootNode(element);\n this.comboboxElement = element;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["ComboBox.tsx"],"names":["ComboBox","rootNode","getProps","defaultProps","comboboxElement","customComboBoxRef","element","setRootNode","focus","blur","search","query","cancelSearch","open","close","selectInputText","reset","render","props","size","React","Component","__KONTUR_REACT_UI__","displayName","itemToValue","item","value","valueToString","label","renderValue","renderItem","menuAlign","searchOnFocus","drawArrow"],"mappings":"8UAAA;;;AAGA;;;;;AAKA;AACA,gE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAKA,eAAL,CAAqBW,eAArB,GACD,CACF,C,CAED;AACF;AACA;AACA,K,QACSC,K,GAAP,iBAAe,CACb,IAAI,KAAKZ,eAAT,EAA0B,CACxB,KAAKA,eAAL,CAAqBY,KAArB,GACD,CACF,C,QAEMC,M,GAAP,kBAAgB,CACd,oBAAO,6BAAC,8BAAD,6BAAoB,KAAKf,QAAL,EAApB,IAAqC,IAAI,EAAE,KAAKgB,KAAL,CAAWC,IAAtD,EAA4D,GAAG,EAAE,KAAKd,iBAAtE,IAAP,CACD,C,mBAnG6Ce,eAAMC,S,WACtCC,mB,GAAsB,U,UACtBC,W,GAAc,U,UAEdpB,Y,GAAkC,EAC9CqB,WAAW,EAAE,qBAACC,IAAD,UAAwBA,IAAI,CAACC,KAA7B,EADiC,EAE9CC,aAAa,EAAE,uBAACF,IAAD,UAAwBA,IAAI,CAACG,KAA7B,EAF+B,EAG9CC,WAAW,EAAE,qBAACJ,IAAD,UAAwBA,IAAI,CAACG,KAA7B,EAHiC,EAI9CE,UAAU,EAAE,oBAACL,IAAD,UAAwBA,IAAI,CAACG,KAA7B,EAJkC,EAK9CG,SAAS,EAAE,MALmC,EAM9CC,aAAa,EAAE,IAN+B,EAO9CC,SAAS,EAAE,IAPmC,E","sourcesContent":["import React, { AriaAttributes, HTMLAttributes } from 'react';\n\nimport { DropdownContainerProps } from '../../internal/DropdownContainer';\nimport { CustomComboBox } from '../../internal/CustomComboBox';\nimport { Nullable } from '../../typings/utility-types';\nimport { MenuItemState } from '../MenuItem';\nimport { InputIconType } from '../Input';\nimport { CommonProps } from '../../internal/CommonWrapper';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { SizeProp } from '../../lib/types/props';\n\nexport interface ComboBoxProps<T>\n extends Pick<DropdownContainerProps, 'menuPos'>,\n Pick<HTMLAttributes<HTMLElement>, 'id'>,\n Pick<AriaAttributes, 'aria-describedby' | 'aria-label'>,\n CommonProps {\n align?: 'left' | 'center' | 'right';\n /**\n * Вызывает функцию поиска `getItems` при фокусе и очистке поля ввода\n * @default true\n */\n searchOnFocus?: boolean;\n /**\n * Рисует справа иконку в виде стрелки\n * @default true\n */\n drawArrow?: boolean;\n\n autoFocus?: boolean;\n\n borderless?: boolean;\n\n /**\n * Не использовать Portal для рендеринга меню.\n * См. https://github.com/skbkontur/retail-ui/issues/15\n * @default false\n */\n disablePortal?: boolean;\n\n disabled?: boolean;\n /**\n * Состояние валидации при ошибке.\n */\n error?: boolean;\n\n leftIcon?: InputIconType;\n\n rightIcon?: InputIconType;\n\n /**\n * Функция поиска элементов, должна возвращать Promise с массивом элементов.\n * По умолчанию ожидаются объекты с типом `{ value: string, label: string }`.\n *\n * Элементы могут быть любого типа. В этом случае необходимо определить\n * свойства `itemToValue`, `renderValue`, `renderItem`, `valueToString`\n */\n getItems: (query: string) => Promise<Array<ComboBoxExtendedItem<T>>>;\n\n /**\n * Необходим для сравнения полученных результатов с `value`\n * @default item => item.label\n */\n itemToValue?: (item: T) => string | number;\n\n maxLength?: number;\n\n menuAlign?: 'left' | 'right';\n\n onBlur?: () => void;\n\n /** Вызывается при изменении `value` */\n onValueChange?: (value: T) => void;\n\n onFocus?: () => void;\n\n /**\n * Вызывается при изменении текста в поле ввода,\n * если результатом функции будет строка,\n * то она станет следующим состоянием полем ввода\n */\n onInputValueChange?: (value: string) => Nullable<string> | void;\n\n /**\n * Функция для обработки ситуации, когда была введена\n * строка в инпут и был потерян фокус с элемента.\n *\n * Если при потере фокуса в выпадающем списке будет только один\n * элемент и результат `renderValue` с этим элементом будет\n * совпадать со значение в текстовом поле, то\n * сработает onValueChange со значением данного элемента\n *\n * Сама функция также может вернуть значение,\n * неравное `undefined`,\n * с которым будет вызван onValueChange.\n */\n onUnexpectedInput?: (value: string) => void | null | T;\n\n placeholder?: string;\n\n /**\n * Функция отрисовки элементов результата поиска.\n * Не применяется если элемент является функцией или React-элементом\n * @default item => item.label\n */\n renderItem?: (item: T, state?: MenuItemState) => React.ReactNode;\n\n /**\n * Компонент, заменяющий собой обёртку элементов результата поиска.\n *\n * По умолчанию все элементы результата поиска оборачиваются в тег `<button />`.\n *\n * @example\n * itemWrapper={(item) => {\n * if (item.value === 3) {\n * return (props) => {\n * return <a {...props} />\n * }\n * }\n * }}\n */\n itemWrapper?: (item: T) => React.ComponentType<unknown>;\n\n /**\n * Функция для отрисовки сообщения о пустом результате поиска\n * Если есть renderAddButton - не работает\n */\n renderNotFound?: () => React.ReactNode;\n\n /**\n * Функция отображающая сообщение об общем количестве элементов.\n * `found` учитывает только компонент `MenuItem`. Им \"оборачиваются\" элементы, возвращаемые `getItems()`.\n */\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n\n /**\n * Функция отрисовки выбранного значения\n * @default item => item.label\n */\n renderValue?: (item: T) => React.ReactNode;\n\n /**\n * Функция отрисовки кнопки добавления в выпадающем списке\n */\n renderAddButton?: (query?: string) => React.ReactNode;\n\n /**\n * Общее количество элементов.\n * Необходим для работы `renderTotalCount`\n */\n totalCount?: number;\n\n /**\n * Выбранное значение\n * Ожидается, что `value` того же типа что и элементы в массиве,\n * возвращаемом в `getItems`\n */\n value?: Nullable<T>;\n\n /**\n * Необходим для преобразования `value` в строку при фокусировке\n * @default item => item.label\n */\n valueToString?: (item: T) => string;\n\n size?: SizeProp;\n /**\n * Состояние валидации при предупреждении.\n */\n warning?: boolean;\n\n width?: string | number;\n\n maxMenuHeight?: number | string;\n\n onMouseEnter?: (e: React.MouseEvent) => void;\n\n onMouseOver?: (e: React.MouseEvent) => void;\n\n onMouseLeave?: (e: React.MouseEvent) => void;\n\n onInputKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void;\n\n inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];\n}\n\nexport interface ComboBoxItem {\n value: string;\n label: string;\n}\n\nexport type ComboBoxExtendedItem<T> = T | (() => React.ReactElement<T>) | React.ReactElement<T>;\n\ntype DefaultProps<T> = Required<\n Pick<\n ComboBoxProps<T>,\n 'itemToValue' | 'valueToString' | 'renderValue' | 'renderItem' | 'menuAlign' | 'searchOnFocus' | 'drawArrow'\n >\n>;\n\n@rootNode\nexport class ComboBox<T = ComboBoxItem> extends React.Component<ComboBoxProps<T>> {\n public static __KONTUR_REACT_UI__ = 'ComboBox';\n public static displayName = 'ComboBox';\n\n public static defaultProps: DefaultProps<any> = {\n itemToValue: (item: ComboBoxItem) => item.value,\n valueToString: (item: ComboBoxItem) => item.label,\n renderValue: (item: ComboBoxItem) => item.label,\n renderItem: (item: ComboBoxItem) => item.label,\n menuAlign: 'left',\n searchOnFocus: true,\n drawArrow: true,\n };\n\n private getProps = createPropsGetter(ComboBox.defaultProps);\n\n private comboboxElement: Nullable<CustomComboBox<T>> = null;\n private setRootNode!: TSetRootNode;\n\n /**\n * @public\n */\n public focus() {\n if (this.comboboxElement) {\n this.comboboxElement.focus();\n }\n }\n\n /**\n * @public\n */\n public blur() {\n if (this.comboboxElement) {\n this.comboboxElement.blur();\n }\n }\n\n /**\n * Открывает выпадающий список и запускает поиск элементов\n *\n * @public\n * @param {string} [query] Текст поиска. По умолчанию берется\n * текст из инпута или результат `valueToString(value)`\n */\n public search(query?: string) {\n if (this.comboboxElement) {\n this.comboboxElement.search(query);\n }\n }\n\n /**\n * @public\n */\n public cancelSearch() {\n if (this.comboboxElement) {\n this.comboboxElement.cancelSearch();\n }\n }\n\n /**\n * @public Открывает выпадающий список\n */\n public open() {\n if (this.comboboxElement) {\n this.comboboxElement.open();\n }\n }\n\n /**\n * @public Закрывает выпадающий список\n */\n public close() {\n if (this.comboboxElement) {\n this.comboboxElement.close();\n }\n }\n\n /**\n * Выделяет текст внутри input\n * @public\n */\n public selectInputText() {\n if (this.comboboxElement) {\n this.comboboxElement.selectInputText();\n }\n }\n\n /**\n * Сбрасывает введенное пользователем значение\n * @public\n */\n public reset() {\n if (this.comboboxElement) {\n this.comboboxElement.reset();\n }\n }\n\n public render() {\n return <CustomComboBox {...this.getProps()} size={this.props.size} ref={this.customComboBoxRef} />;\n }\n\n private customComboBoxRef = (element: Nullable<CustomComboBox<T>>) => {\n this.setRootNode(element);\n this.comboboxElement = element;\n };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
2
|
import { CommonProps } from '../../internal/CommonWrapper';
|
|
3
|
-
export interface CurrencyLabelProps extends CommonProps {
|
|
3
|
+
export interface CurrencyLabelProps extends CommonProps, Pick<HTMLAttributes<HTMLElement>, 'id'> {
|
|
4
4
|
/**
|
|
5
5
|
* Минимальное количество отображаемых знаков после запятой
|
|
6
6
|
* @default 2
|
|
@@ -15,7 +15,7 @@ export declare const CurrencyLabelDataTids: {
|
|
|
15
15
|
readonly root: "CurrencyLabel__root";
|
|
16
16
|
};
|
|
17
17
|
export declare const CurrencyLabel: {
|
|
18
|
-
({ value, fractionDigits, currencySymbol, hideTrailingZeros, ...rest }: CurrencyLabelProps): JSX.Element;
|
|
18
|
+
({ id, value, fractionDigits, currencySymbol, hideTrailingZeros, ...rest }: CurrencyLabelProps): JSX.Element;
|
|
19
19
|
__KONTUR_REACT_UI__: string;
|
|
20
20
|
displayName: string;
|
|
21
21
|
propTypes: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _constants = require("../CurrencyInput/constants");
|
|
4
4
|
var _CurrencyHelper = require("../CurrencyInput/CurrencyHelper");
|
|
5
|
-
var _CommonWrapper = require("../../internal/CommonWrapper");var _excluded = ["value", "fractionDigits", "currencySymbol", "hideTrailingZeros"];
|
|
5
|
+
var _CommonWrapper = require("../../internal/CommonWrapper");var _excluded = ["id", "value", "fractionDigits", "currencySymbol", "hideTrailingZeros"];
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -28,10 +28,11 @@ var CurrencyLabel = function CurrencyLabel(_ref)
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
{var id = _ref.id,value = _ref.value,_ref$fractionDigits = _ref.fractionDigits,fractionDigits = _ref$fractionDigits === void 0 ? FRACTION_DIGITS_DEFAULT : _ref$fractionDigits,currencySymbol = _ref.currencySymbol,_ref$hideTrailingZero = _ref.hideTrailingZeros,hideTrailingZeros = _ref$hideTrailingZero === void 0 ? false : _ref$hideTrailingZero,rest = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
32
33
|
return /*#__PURE__*/(
|
|
33
34
|
_react.default.createElement(_CommonWrapper.CommonWrapper, rest, /*#__PURE__*/
|
|
34
|
-
_react.default.createElement("span", { "data-tid": CurrencyLabelDataTids.root },
|
|
35
|
+
_react.default.createElement("span", { id: id, "data-tid": CurrencyLabelDataTids.root },
|
|
35
36
|
_CurrencyHelper.CurrencyHelper.format(value, { fractionDigits: fractionDigits, hideTrailingZeros: hideTrailingZeros }),
|
|
36
37
|
currencySymbol && String.fromCharCode(0xa0) /* */,
|
|
37
38
|
currencySymbol)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CurrencyLabel.tsx"],"names":["FRACTION_DIGITS_DEFAULT","CurrencyLabelDataTids","root","CurrencyLabel","value","fractionDigits","currencySymbol","hideTrailingZeros","rest","CurrencyHelper","format","String","fromCharCode","__KONTUR_REACT_UI__","displayName","propTypes","MAX_SAFE_DIGITS","Error","destructString","fraction","length","Number","isInteger"],"mappings":"+TAAA;;AAEA;AACA;AACA,6D;;;;;;;;;;;;;;AAcA,IAAMA,uBAAuB,GAAG,CAAhC;;AAEO,IAAMC,qBAAqB,GAAG;AACnCC,EAAAA,IAAI,EAAE,qBAD6B,EAA9B,C;;;AAIA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB
|
|
1
|
+
{"version":3,"sources":["CurrencyLabel.tsx"],"names":["FRACTION_DIGITS_DEFAULT","CurrencyLabelDataTids","root","CurrencyLabel","id","value","fractionDigits","currencySymbol","hideTrailingZeros","rest","CurrencyHelper","format","String","fromCharCode","__KONTUR_REACT_UI__","displayName","propTypes","MAX_SAFE_DIGITS","Error","destructString","fraction","length","Number","isInteger"],"mappings":"+TAAA;;AAEA;AACA;AACA,6D;;;;;;;;;;;;;;AAcA,IAAMA,uBAAuB,GAAG,CAAhC;;AAEO,IAAMC,qBAAqB,GAAG;AACnCC,EAAAA,IAAI,EAAE,qBAD6B,EAA9B,C;;;AAIA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB;;;;;;;AAOU,KANrCC,EAMqC,QANrCA,EAMqC,CALrCC,KAKqC,QALrCA,KAKqC,4BAJrCC,cAIqC,CAJrCA,cAIqC,oCAJpBN,uBAIoB,uBAHrCO,cAGqC,QAHrCA,cAGqC,8BAFrCC,iBAEqC,CAFrCA,iBAEqC,sCAFjB,KAEiB,yBADlCC,IACkC;AACrC;AACE,iCAAC,4BAAD,EAAmBA,IAAnB;AACE,2CAAM,EAAE,EAAEL,EAAV,EAAc,YAAUH,qBAAqB,CAACC,IAA9C;AACGQ,mCAAeC,MAAf,CAAsBN,KAAtB,EAA6B,EAAEC,cAAc,EAAdA,cAAF,EAAkBE,iBAAiB,EAAjBA,iBAAlB,EAA7B,CADH;AAEGD,IAAAA,cAAc,IAAIK,MAAM,CAACC,YAAP,CAAoB,IAApB,CAFrB,CAE+C,YAF/C;AAGGN,IAAAA,cAHH,CADF,CADF;;;;AASD,CAjBM,C;;AAmBPJ,aAAa,CAACW,mBAAd,GAAoC,eAApC;AACAX,aAAa,CAACY,WAAd,GAA4B,eAA5B;;AAEAZ,aAAa,CAACa,SAAd,GAA0B;AACxBV,EAAAA,cAAc,EAAE,+BAA6E,kCAA1EA,cAA0E,CAA1EA,eAA0E,qCAAzDN,uBAAyD,wBAAhCK,KAAgC,SAAhCA,KAAgC;AAC3F,QAAIC,eAAc,GAAGW,0BAArB,EAAsC;AACpC,aAAO,IAAIC,KAAJ;AACL,0DAAkDD,0BAAlD,4EADK,CAAP;;;AAID;;AAED,gBAAqBP,+BAAeS,cAAf,CAA8BP,MAAM,CAACP,KAAD,CAApC,KAAgD,EAAEe,QAAQ,EAAE,EAAZ,EAArE,CAAQA,QAAR,SAAQA,QAAR;AACA,QAAIA,QAAQ,CAACC,MAAT,GAAkBf,eAAtB,EAAsC;AACpC,aAAO,IAAIY,KAAJ;AACL,gIADK,CAAP;;;AAID;;AAED,QAAI,CAACI,MAAM,CAACC,SAAP,CAAiBjB,eAAjB,CAAL,EAAuC;AACrC,aAAO,IAAIY,KAAJ,2GAAP;;;AAGD;;AAED,WAAO,IAAP;AACD,GAxBuB,EAA1B","sourcesContent":["import React, { HTMLAttributes } from 'react';\n\nimport { MAX_SAFE_DIGITS } from '../CurrencyInput/constants';\nimport { CurrencyHelper } from '../CurrencyInput/CurrencyHelper';\nimport { CommonWrapper, CommonProps } from '../../internal/CommonWrapper';\n\nexport interface CurrencyLabelProps extends CommonProps, Pick<HTMLAttributes<HTMLElement>, 'id'> {\n /**\n * Минимальное количество отображаемых знаков после запятой\n * @default 2\n */\n fractionDigits?: number;\n value: number;\n currencySymbol?: React.ReactNode;\n /** Убрать лишние нули после запятой */\n hideTrailingZeros?: boolean;\n}\n\nconst FRACTION_DIGITS_DEFAULT = 2;\n\nexport const CurrencyLabelDataTids = {\n root: 'CurrencyLabel__root',\n} as const;\n\nexport const CurrencyLabel = ({\n id,\n value,\n fractionDigits = FRACTION_DIGITS_DEFAULT,\n currencySymbol,\n hideTrailingZeros = false,\n ...rest\n}: CurrencyLabelProps): JSX.Element => {\n return (\n <CommonWrapper {...rest}>\n <span id={id} data-tid={CurrencyLabelDataTids.root}>\n {CurrencyHelper.format(value, { fractionDigits, hideTrailingZeros })}\n {currencySymbol && String.fromCharCode(0xa0) /* */}\n {currencySymbol}\n </span>\n </CommonWrapper>\n );\n};\n\nCurrencyLabel.__KONTUR_REACT_UI__ = 'CurrencyLabel';\nCurrencyLabel.displayName = 'CurrencyLabel';\n\nCurrencyLabel.propTypes = {\n fractionDigits: ({ fractionDigits = FRACTION_DIGITS_DEFAULT, value }: CurrencyLabelProps) => {\n if (fractionDigits > MAX_SAFE_DIGITS) {\n return new Error(\n `[CurrencyLabel]: Prop 'fractionDigits' exceeds ${MAX_SAFE_DIGITS}.` +\n `\\nSee https://tech.skbkontur.ru/react-ui/#/CurrencyInput?id=why15`,\n );\n }\n\n const { fraction } = CurrencyHelper.destructString(String(value)) || { fraction: '' };\n if (fraction.length > fractionDigits) {\n return new Error(\n `[CurrencyLabel]: Prop 'fractionDigits' less than fractional part of the 'value' property,` +\n `'value' will not be cutted`,\n );\n }\n\n if (!Number.isInteger(fractionDigits)) {\n return new Error(\n `[CurrencyLabel]: Prop 'fractionDigits' is not integer, fraction part of these property will not be used`,\n );\n }\n\n return null;\n },\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
2
|
import { InternalDateComponentType } from '../../lib/date/types';
|
|
3
3
|
import { CommonProps } from '../../internal/CommonWrapper';
|
|
4
4
|
import { SizeProp } from '../../lib/types/props';
|
|
@@ -12,7 +12,7 @@ export interface DateInputState {
|
|
|
12
12
|
export declare const DateInputDataTids: {
|
|
13
13
|
readonly icon: "DateInput__icon";
|
|
14
14
|
};
|
|
15
|
-
export interface DateInputProps extends CommonProps {
|
|
15
|
+
export interface DateInputProps extends CommonProps, Pick<HTMLAttributes<HTMLElement>, 'id'> {
|
|
16
16
|
autoFocus?: boolean;
|
|
17
17
|
value?: string;
|
|
18
18
|
/**
|
|
@@ -244,6 +244,7 @@ DateInput = (_dec = (0, _decorators.locale)('DatePicker', _locale.DatePickerLoca
|
|
|
244
244
|
|
|
245
245
|
|
|
246
246
|
|
|
247
|
+
|
|
247
248
|
|
|
248
249
|
|
|
249
250
|
renderIcon = function () {
|
|
@@ -473,4 +474,4 @@ DateInput = (_dec = (0, _decorators.locale)('DatePicker', _locale.DatePickerLoca
|
|
|
473
474
|
_this.shiftSelection(1);
|
|
474
475
|
}
|
|
475
476
|
_this.updateValue({ inputMode: inputMode });
|
|
476
|
-
};_this.state = { valueFormatted: '', selected: null, inputMode: false, focused: false, dragged: false };return _this;}var _proto = DateInput.prototype;_proto.componentDidUpdate = function componentDidUpdate(prevProps) {var _this$getProps = this.getProps(),value = _this$getProps.value,minDate = _this$getProps.minDate,maxDate = _this$getProps.maxDate;if (prevProps.value !== value || prevProps.minDate !== minDate || prevProps.maxDate !== maxDate || this.iDateMediator.isChangedLocale(this.locale)) {this.updateFromProps(false);}this.selectNode();};_proto.componentDidMount = function componentDidMount() {this.updateFromProps(false);if (this.props.autoFocus) {this.focus();}};_proto.blur = function blur() {if (this.inputLikeText) {this.inputLikeText.blur();}};_proto.focus = function focus() {if (this.inputLikeText) {this.inputLikeText.focus();}};_proto.blink = function blink() {if (this.inputLikeText) {this.inputLikeText.blink();}};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _cx2;var _this$state2 = this.state,focused = _this$state2.focused,selected = _this$state2.selected,inputMode = _this$state2.inputMode,valueFormatted = _this$state2.valueFormatted;var showValue = Boolean(focused || valueFormatted);var _this$getProps2 = this.getProps(),width = _this$getProps2.width,size = _this$getProps2.size;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement(_FocusControlWrapper.FocusControlWrapper, { onBlurWhenDisabled: this.resetFocus }, /*#__PURE__*/_react.default.createElement(_InputLikeText.InputLikeText, { width: width, ref: this.inputLikeTextRef, size: size, disabled: this.props.disabled, error: this.props.error, warning: this.props.warning, onBlur: this.handleBlur, onFocus: this.handleFocus, onClick: this.props.onClick, onKeyDown: this.handleKeyDown, onMouseDownCapture: this.handleMouseDownCapture, onPaste: this.handlePaste, rightIcon: this.renderIcon(), onDoubleClickCapture: this.handleDoubleClick, onMouseDragStart: this.handleMouseDragStart, onMouseDragEnd: this.handleMouseDragEnd, value: this.iDateMediator.getInternalString(), inputMode: 'numeric', takeContentWidth: true }, /*#__PURE__*/_react.default.createElement("span", { className: (0, _Emotion.cx)(_DateInput.styles.value(), (_cx2 = {}, _cx2[_DateInput.styles.valueVisible()] = showValue, _cx2)) }, /*#__PURE__*/_react.default.createElement(_DateFragmentsView.DateFragmentsView, { ref: this.dateFragmentsViewRef, fragments: this.iDateMediator.getFragments(), onSelectDateComponent: this.handleSelectDateComponent, selected: selected, inputMode: inputMode })))));};return DateInput;}(_react.default.Component), _class2.__KONTUR_REACT_UI__ = 'DateInput', _class2.displayName = 'DateInput', _class2.defaultProps = { value: '', minDate: _constants.MIN_FULLDATE, maxDate: _constants.MAX_FULLDATE, size: 'small', width: 125 }, _temp)) || _class) || _class);exports.DateInput = DateInput;
|
|
477
|
+
};_this.state = { valueFormatted: '', selected: null, inputMode: false, focused: false, dragged: false };return _this;}var _proto = DateInput.prototype;_proto.componentDidUpdate = function componentDidUpdate(prevProps) {var _this$getProps = this.getProps(),value = _this$getProps.value,minDate = _this$getProps.minDate,maxDate = _this$getProps.maxDate;if (prevProps.value !== value || prevProps.minDate !== minDate || prevProps.maxDate !== maxDate || this.iDateMediator.isChangedLocale(this.locale)) {this.updateFromProps(false);}this.selectNode();};_proto.componentDidMount = function componentDidMount() {this.updateFromProps(false);if (this.props.autoFocus) {this.focus();}};_proto.blur = function blur() {if (this.inputLikeText) {this.inputLikeText.blur();}};_proto.focus = function focus() {if (this.inputLikeText) {this.inputLikeText.focus();}};_proto.blink = function blink() {if (this.inputLikeText) {this.inputLikeText.blink();}};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _cx2;var _this$state2 = this.state,focused = _this$state2.focused,selected = _this$state2.selected,inputMode = _this$state2.inputMode,valueFormatted = _this$state2.valueFormatted;var showValue = Boolean(focused || valueFormatted);var _this$getProps2 = this.getProps(),width = _this$getProps2.width,size = _this$getProps2.size;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement(_FocusControlWrapper.FocusControlWrapper, { onBlurWhenDisabled: this.resetFocus }, /*#__PURE__*/_react.default.createElement(_InputLikeText.InputLikeText, { id: this.props.id, width: width, ref: this.inputLikeTextRef, size: size, disabled: this.props.disabled, error: this.props.error, warning: this.props.warning, onBlur: this.handleBlur, onFocus: this.handleFocus, onClick: this.props.onClick, onKeyDown: this.handleKeyDown, onMouseDownCapture: this.handleMouseDownCapture, onPaste: this.handlePaste, rightIcon: this.renderIcon(), onDoubleClickCapture: this.handleDoubleClick, onMouseDragStart: this.handleMouseDragStart, onMouseDragEnd: this.handleMouseDragEnd, value: this.iDateMediator.getInternalString(), inputMode: 'numeric', takeContentWidth: true }, /*#__PURE__*/_react.default.createElement("span", { className: (0, _Emotion.cx)(_DateInput.styles.value(), (_cx2 = {}, _cx2[_DateInput.styles.valueVisible()] = showValue, _cx2)) }, /*#__PURE__*/_react.default.createElement(_DateFragmentsView.DateFragmentsView, { ref: this.dateFragmentsViewRef, fragments: this.iDateMediator.getFragments(), onSelectDateComponent: this.handleSelectDateComponent, selected: selected, inputMode: inputMode })))));};return DateInput;}(_react.default.Component), _class2.__KONTUR_REACT_UI__ = 'DateInput', _class2.displayName = 'DateInput', _class2.defaultProps = { value: '', minDate: _constants.MIN_FULLDATE, maxDate: _constants.MAX_FULLDATE, size: 'small', width: 125 }, _temp)) || _class) || _class);exports.DateInput = DateInput;
|