@skbkontur/react-ui 5.0.10 → 5.0.11-ZIndex-several-roots.2
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 +12 -0
- package/cjs/components/Dropdown/Dropdown.d.ts +2 -2
- package/cjs/components/Dropdown/Dropdown.js +8 -8
- package/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/cjs/components/MaskedInput/ColorableInputElement/ColorableInputElement.js +11 -10
- package/cjs/components/MaskedInput/ColorableInputElement/ColorableInputElement.js.map +1 -1
- package/cjs/components/MenuItem/MenuItem.js +23 -23
- package/cjs/components/MenuItem/MenuItem.js.map +1 -1
- package/cjs/components/PasswordInput/PasswordInput.js +1 -1
- package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
- package/cjs/internal/Menu/Menu.d.ts +2 -1
- package/cjs/internal/Menu/Menu.js +4 -2
- package/cjs/internal/Menu/Menu.js.map +1 -1
- package/cjs/internal/ZIndex/ZIndex.d.ts +1 -1
- package/cjs/internal/ZIndex/ZIndex.js +18 -6
- package/cjs/internal/ZIndex/ZIndex.js.map +1 -1
- package/components/Dropdown/Dropdown/Dropdown.js +11 -11
- package/components/Dropdown/Dropdown/Dropdown.js.map +1 -1
- package/components/Dropdown/Dropdown.d.ts +2 -2
- package/components/MaskedInput/ColorableInputElement/ColorableInputElement/ColorableInputElement.js +13 -10
- package/components/MaskedInput/ColorableInputElement/ColorableInputElement/ColorableInputElement.js.map +1 -1
- package/components/MenuItem/MenuItem/MenuItem.js +41 -35
- package/components/MenuItem/MenuItem/MenuItem.js.map +1 -1
- package/components/PasswordInput/PasswordInput/PasswordInput.js +1 -1
- package/components/PasswordInput/PasswordInput/PasswordInput.js.map +1 -1
- package/internal/Menu/Menu/Menu.js +6 -3
- package/internal/Menu/Menu/Menu.js.map +1 -1
- package/internal/Menu/Menu.d.ts +2 -1
- package/internal/ZIndex/ZIndex/ZIndex.js +12 -14
- package/internal/ZIndex/ZIndex/ZIndex.js.map +1 -1
- package/internal/ZIndex/ZIndex.d.ts +1 -1
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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
|
+
## [5.0.11](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@5.0.10...@skbkontur/react-ui@5.0.11) (2025-03-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **Combobox:** use ComboBoxMenuDataTids in Menu ([#3601](https://github.com/skbkontur/retail-ui/issues/3601)) ([ae8afea](https://github.com/skbkontur/retail-ui/commit/ae8afea4684cfbfa7d03c0abe273a0f062943524))
|
|
12
|
+
* **PasswordInput:** prevent Input root data-tid override ([#3598](https://github.com/skbkontur/retail-ui/issues/3598)) ([61b2e83](https://github.com/skbkontur/retail-ui/commit/61b2e8303acc4446872e73f7a87f177b55a0fc37))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
## [5.0.10](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@5.0.9...@skbkontur/react-ui@5.0.10) (2025-01-30)
|
|
7
19
|
|
|
8
20
|
|
|
@@ -4,7 +4,7 @@ import { MenuHeader } from '../MenuHeader';
|
|
|
4
4
|
import { MenuItem } from '../MenuItem';
|
|
5
5
|
import { MenuSeparator } from '../MenuSeparator';
|
|
6
6
|
import { ButtonUse } from '../Button';
|
|
7
|
-
import { CommonProps
|
|
7
|
+
import { CommonProps } from '../../internal/CommonWrapper';
|
|
8
8
|
import { SizeProp } from '../../lib/types/props';
|
|
9
9
|
export interface DropdownProps extends Pick<AriaAttributes, 'aria-label' | 'aria-describedby'>, Pick<HTMLAttributes<HTMLElement>, 'id'>, CommonProps {
|
|
10
10
|
/**
|
|
@@ -121,7 +121,7 @@ export declare class Dropdown extends React.Component<DropdownProps> {
|
|
|
121
121
|
private setRootNode;
|
|
122
122
|
private theme;
|
|
123
123
|
render(): React.JSX.Element;
|
|
124
|
-
renderMain: (
|
|
124
|
+
renderMain: () => React.JSX.Element;
|
|
125
125
|
/**
|
|
126
126
|
* @public
|
|
127
127
|
*/
|
|
@@ -35,7 +35,8 @@ var PASS_PROPS = {
|
|
|
35
35
|
onMouseOver: true,
|
|
36
36
|
menuPos: true,
|
|
37
37
|
id: true,
|
|
38
|
-
'aria-describedby': true
|
|
38
|
+
'aria-describedby': true,
|
|
39
|
+
'aria-label': true
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
|
|
@@ -197,21 +198,20 @@ Dropdown = exports.Dropdown = (0, _rootNode.rootNode)(_class = (_Dropdown = /*#_
|
|
|
197
198
|
|
|
198
199
|
|
|
199
200
|
|
|
200
|
-
renderMain = function (
|
|
201
|
+
renderMain = function () {
|
|
202
|
+
var _this$props = _this.props,caption = _this$props.caption,icon = _this$props.icon,rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props, _excluded);
|
|
201
203
|
var items = _react.default.Children.map(_this.props.children, function (item) {return item;}) || [];
|
|
202
204
|
|
|
203
205
|
return /*#__PURE__*/(
|
|
204
|
-
_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: _this.setRootNode },
|
|
206
|
+
_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: _this.setRootNode }, rest), /*#__PURE__*/
|
|
205
207
|
_react.default.createElement(_Select.Select, (0, _extends2.default)({
|
|
206
208
|
"data-tid": DropdownDataTids.root,
|
|
207
209
|
ref: _this._refSelect },
|
|
208
|
-
(0, _filterProps.filterProps)(
|
|
210
|
+
(0, _filterProps.filterProps)(rest, PASS_PROPS), {
|
|
209
211
|
value: caption,
|
|
210
212
|
items: items,
|
|
211
213
|
_icon: icon,
|
|
212
|
-
renderValue: renderValue
|
|
213
|
-
size: _this.props.size,
|
|
214
|
-
"aria-label": _this.props['aria-label'] })
|
|
214
|
+
renderValue: renderValue })
|
|
215
215
|
)
|
|
216
216
|
));
|
|
217
217
|
|
|
@@ -237,7 +237,7 @@ Dropdown = exports.Dropdown = (0, _rootNode.rootNode)(_class = (_Dropdown = /*#_
|
|
|
237
237
|
|
|
238
238
|
_refSelect = function (element) {
|
|
239
239
|
_this._select = element;
|
|
240
|
-
};return _this;}(0, _inheritsLoose2.default)(Dropdown, _React$Component);var _proto = Dropdown.prototype;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = (0, _getDropdownTheme.getDropdownTheme)(theme);return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Provider, { value: _this2.theme }, _this2.renderMain(
|
|
240
|
+
};return _this;}(0, _inheritsLoose2.default)(Dropdown, _React$Component);var _proto = Dropdown.prototype;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = (0, _getDropdownTheme.getDropdownTheme)(theme);return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Provider, { value: _this2.theme }, _this2.renderMain());});}; /**
|
|
241
241
|
* @public
|
|
242
242
|
*/_proto.open = function open() {if (this._select) {this._select.open();}} /**
|
|
243
243
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_propTypes","_filterProps","_MenuHeader","_MenuItem","_MenuSeparator","_Select","_CommonWrapper","_rootNode","_ThemeContext","_getDropdownTheme","_excluded","_class","_Dropdown","PASS_PROPS","_renderButton","error","disabled","disablePortal","menuAlign","menuWidth","maxMenuHeight","use","size","warning","width","onOpen","onClose","onMouseEnter","onMouseLeave","onMouseOver","menuPos","id","DropdownDataTids","exports","root","Dropdown","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","renderMain","_ref","caption","icon","props","_objectWithoutPropertiesLoose2","default","items","React","Children","map","children","item","createElement","CommonWrapper","_extends2","rootNodeRef","setRootNode","Select","ref","_refSelect","filterProps","value","_icon","renderValue","element","_select","_inheritsLoose2","_proto","prototype","render","_this2","ThemeContext","Consumer","theme","getDropdownTheme","Provider","open","close","Component","__KONTUR_REACT_UI__","displayName","Header","MenuHeader","MenuItem","Separator","MenuSeparator","propTypes","PropTypes","node","isRequired","bool","number","oneOf","oneOfType","string","any","func"],"sources":["Dropdown.tsx"],"sourcesContent":["import React, { AriaAttributes, HTMLAttributes } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { filterProps } from '../../lib/filterProps';\nimport { MenuHeader } from '../MenuHeader';\nimport { MenuItem } from '../MenuItem';\nimport { MenuSeparator } from '../MenuSeparator';\nimport { Select } from '../Select';\nimport { Nullable } from '../../typings/utility-types';\nimport { ButtonUse } from '../Button';\nimport { CommonWrapper, CommonProps, CommonWrapperRestProps } from '../../internal/CommonWrapper';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { SizeProp } from '../../lib/types/props';\n\nimport { getDropdownTheme } from './getDropdownTheme';\n\nconst PASS_PROPS = {\n _renderButton: true,\n error: true,\n disabled: true,\n disablePortal: true,\n menuAlign: true,\n menuWidth: true,\n maxMenuHeight: true,\n use: true,\n size: true,\n warning: true,\n width: true,\n onOpen: true,\n onClose: true,\n onMouseEnter: true,\n onMouseLeave: true,\n onMouseOver: true,\n menuPos: true,\n id: true,\n 'aria-describedby': true,\n};\n\nexport interface DropdownProps\n extends Pick<AriaAttributes, 'aria-label' | 'aria-describedby'>,\n Pick<HTMLAttributes<HTMLElement>, 'id'>,\n CommonProps {\n /**\n * Подпись на кнопке.\n */\n caption: React.ReactNode;\n /**\n * Иконка слева от текста кнопки\n */\n icon?: React.ReactElement<any>;\n width?: React.CSSProperties['width'];\n\n /** @ignore */\n _renderButton?: (params: any) => JSX.Element;\n\n /**\n * Отключает использование портала\n */\n disablePortal?: boolean;\n\n /**\n * Визуально отключает Dropdown\n */\n disabled?: boolean;\n\n /**\n * Состояние валидации при ошибке.\n */\n error?: boolean;\n /**\n * Состояние валидации при предупреждении.\n */\n warning?: boolean;\n maxMenuHeight?: number;\n /**\n * Позволяет вручную задать текущую позицию выпадающего окна\n */\n menuPos?: 'top' | 'bottom';\n menuAlign?: 'left' | 'right';\n menuWidth?: number | string;\n size?: SizeProp;\n\n /**\n * Смотри Button.\n */\n use?: ButtonUse;\n\n /**\n * Вызывается при закрытии меню.\n */\n onClose?: () => void;\n /**\n * Вызывается при открытии меню.\n */\n onOpen?: () => void;\n onMouseEnter?: (event: React.MouseEvent<HTMLElement>) => void;\n onMouseLeave?: (event: React.MouseEvent<HTMLElement>) => void;\n onMouseOver?: (event: React.MouseEvent<HTMLElement>) => void;\n}\n\ntype DropdownSelectType = Select<React.ReactNode, React.ReactNode>;\n\nexport const DropdownDataTids = {\n root: 'Dropdown__root',\n} as const;\n\n/**\n * Выпадающее меню.\n *\n */\n@rootNode\nexport class Dropdown extends React.Component<DropdownProps> {\n public static __KONTUR_REACT_UI__ = 'Dropdown';\n public static displayName = 'Dropdown';\n\n public static Header = MenuHeader;\n public static MenuItem = MenuItem;\n public static Separator = MenuSeparator;\n\n public static propTypes = {\n /**\n * Подпись на кнопке.\n */\n caption: PropTypes.node.isRequired,\n\n /**\n * Отключает использование портала\n */\n disablePortal: PropTypes.bool,\n\n /**\n * Визуально отключает Dropdown\n */\n disabled: PropTypes.bool,\n\n /**\n * Визуально показать наличие ошибки.\n */\n error: PropTypes.bool,\n\n /**\n * Иконка слева от текста кнопки\n */\n icon: PropTypes.node,\n\n maxMenuHeight: PropTypes.number,\n\n menuAlign: PropTypes.oneOf(['left', 'right']),\n\n menuWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n size: PropTypes.oneOf(['small', 'medium', 'large']),\n\n /**\n * Смотри Button.\n */\n use: PropTypes.any,\n\n /**\n * Визуально показать наличие предупреждения.\n */\n warning: PropTypes.bool,\n\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Вызывается при закрытии меню.\n */\n onClose: PropTypes.func,\n\n onMouseEnter: PropTypes.func,\n\n onMouseLeave: PropTypes.func,\n\n onMouseOver: PropTypes.func,\n\n /**\n * Вызывается при открытии меню.\n */\n onOpen: PropTypes.func,\n };\n\n private _select: Nullable<DropdownSelectType>;\n private setRootNode!: TSetRootNode;\n private theme!: Theme;\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = getDropdownTheme(theme);\n return <ThemeContext.Provider value={this.theme}>{this.renderMain(this.props)}</ThemeContext.Provider>;\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public renderMain = ({ caption, icon, ...props }: CommonWrapperRestProps<DropdownProps>) => {\n const items = React.Children.map(this.props.children, (item) => item) || [];\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <Select<React.ReactNode, React.ReactNode>\n data-tid={DropdownDataTids.root}\n ref={this._refSelect}\n {...filterProps(props, PASS_PROPS)}\n value={caption}\n items={items}\n _icon={icon}\n renderValue={renderValue}\n size={this.props.size}\n aria-label={this.props['aria-label']}\n />\n </CommonWrapper>\n );\n };\n\n /**\n * @public\n */\n public open() {\n if (this._select) {\n this._select.open();\n }\n }\n\n /**\n * @public\n */\n public close() {\n if (this._select) {\n this._select.close();\n }\n }\n\n private _refSelect = (element: DropdownSelectType): void => {\n this._select = element;\n };\n}\n\nfunction renderValue(value: any) {\n return value;\n}\n"],"mappings":"qeAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;;AAEA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAA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AAA7F,SAAA,MAAAD,MAAA,CA4DH,SAAS6D,WAAWA,CAACF,KAAU,EAAE,CAC/B,OAAOA,KAAK,CACd","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_propTypes","_filterProps","_MenuHeader","_MenuItem","_MenuSeparator","_Select","_CommonWrapper","_rootNode","_ThemeContext","_getDropdownTheme","_excluded","_class","_Dropdown","PASS_PROPS","_renderButton","error","disabled","disablePortal","menuAlign","menuWidth","maxMenuHeight","use","size","warning","width","onOpen","onClose","onMouseEnter","onMouseLeave","onMouseOver","menuPos","id","DropdownDataTids","exports","root","Dropdown","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","renderMain","_this$props","props","caption","icon","rest","_objectWithoutPropertiesLoose2","default","items","React","Children","map","children","item","createElement","CommonWrapper","_extends2","rootNodeRef","setRootNode","Select","ref","_refSelect","filterProps","value","_icon","renderValue","element","_select","_inheritsLoose2","_proto","prototype","render","_this2","ThemeContext","Consumer","theme","getDropdownTheme","Provider","open","close","Component","__KONTUR_REACT_UI__","displayName","Header","MenuHeader","MenuItem","Separator","MenuSeparator","propTypes","PropTypes","node","isRequired","bool","number","oneOf","oneOfType","string","any","func"],"sources":["Dropdown.tsx"],"sourcesContent":["import React, { AriaAttributes, HTMLAttributes } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { filterProps } from '../../lib/filterProps';\nimport { MenuHeader } from '../MenuHeader';\nimport { MenuItem } from '../MenuItem';\nimport { MenuSeparator } from '../MenuSeparator';\nimport { Select } from '../Select';\nimport { Nullable } from '../../typings/utility-types';\nimport { ButtonUse } from '../Button';\nimport { CommonWrapper, CommonProps } from '../../internal/CommonWrapper';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { SizeProp } from '../../lib/types/props';\n\nimport { getDropdownTheme } from './getDropdownTheme';\n\nconst PASS_PROPS = {\n _renderButton: true,\n error: true,\n disabled: true,\n disablePortal: true,\n menuAlign: true,\n menuWidth: true,\n maxMenuHeight: true,\n use: true,\n size: true,\n warning: true,\n width: true,\n onOpen: true,\n onClose: true,\n onMouseEnter: true,\n onMouseLeave: true,\n onMouseOver: true,\n menuPos: true,\n id: true,\n 'aria-describedby': true,\n 'aria-label': true,\n};\n\nexport interface DropdownProps\n extends Pick<AriaAttributes, 'aria-label' | 'aria-describedby'>,\n Pick<HTMLAttributes<HTMLElement>, 'id'>,\n CommonProps {\n /**\n * Подпись на кнопке.\n */\n caption: React.ReactNode;\n /**\n * Иконка слева от текста кнопки\n */\n icon?: React.ReactElement<any>;\n width?: React.CSSProperties['width'];\n\n /** @ignore */\n _renderButton?: (params: any) => JSX.Element;\n\n /**\n * Отключает использование портала\n */\n disablePortal?: boolean;\n\n /**\n * Визуально отключает Dropdown\n */\n disabled?: boolean;\n\n /**\n * Состояние валидации при ошибке.\n */\n error?: boolean;\n /**\n * Состояние валидации при предупреждении.\n */\n warning?: boolean;\n maxMenuHeight?: number;\n /**\n * Позволяет вручную задать текущую позицию выпадающего окна\n */\n menuPos?: 'top' | 'bottom';\n menuAlign?: 'left' | 'right';\n menuWidth?: number | string;\n size?: SizeProp;\n\n /**\n * Смотри Button.\n */\n use?: ButtonUse;\n\n /**\n * Вызывается при закрытии меню.\n */\n onClose?: () => void;\n /**\n * Вызывается при открытии меню.\n */\n onOpen?: () => void;\n onMouseEnter?: (event: React.MouseEvent<HTMLElement>) => void;\n onMouseLeave?: (event: React.MouseEvent<HTMLElement>) => void;\n onMouseOver?: (event: React.MouseEvent<HTMLElement>) => void;\n}\n\ntype DropdownSelectType = Select<React.ReactNode, React.ReactNode>;\n\nexport const DropdownDataTids = {\n root: 'Dropdown__root',\n} as const;\n\n/**\n * Выпадающее меню.\n *\n */\n@rootNode\nexport class Dropdown extends React.Component<DropdownProps> {\n public static __KONTUR_REACT_UI__ = 'Dropdown';\n public static displayName = 'Dropdown';\n\n public static Header = MenuHeader;\n public static MenuItem = MenuItem;\n public static Separator = MenuSeparator;\n\n public static propTypes = {\n /**\n * Подпись на кнопке.\n */\n caption: PropTypes.node.isRequired,\n\n /**\n * Отключает использование портала\n */\n disablePortal: PropTypes.bool,\n\n /**\n * Визуально отключает Dropdown\n */\n disabled: PropTypes.bool,\n\n /**\n * Визуально показать наличие ошибки.\n */\n error: PropTypes.bool,\n\n /**\n * Иконка слева от текста кнопки\n */\n icon: PropTypes.node,\n\n maxMenuHeight: PropTypes.number,\n\n menuAlign: PropTypes.oneOf(['left', 'right']),\n\n menuWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n size: PropTypes.oneOf(['small', 'medium', 'large']),\n\n /**\n * Смотри Button.\n */\n use: PropTypes.any,\n\n /**\n * Визуально показать наличие предупреждения.\n */\n warning: PropTypes.bool,\n\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Вызывается при закрытии меню.\n */\n onClose: PropTypes.func,\n\n onMouseEnter: PropTypes.func,\n\n onMouseLeave: PropTypes.func,\n\n onMouseOver: PropTypes.func,\n\n /**\n * Вызывается при открытии меню.\n */\n onOpen: PropTypes.func,\n };\n\n private _select: Nullable<DropdownSelectType>;\n private setRootNode!: TSetRootNode;\n private theme!: Theme;\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = getDropdownTheme(theme);\n return <ThemeContext.Provider value={this.theme}>{this.renderMain()}</ThemeContext.Provider>;\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public renderMain = () => {\n const { caption, icon, ...rest } = this.props;\n const items = React.Children.map(this.props.children, (item) => item) || [];\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...rest}>\n <Select<React.ReactNode, React.ReactNode>\n data-tid={DropdownDataTids.root}\n ref={this._refSelect}\n {...filterProps(rest, PASS_PROPS)}\n value={caption}\n items={items}\n _icon={icon}\n renderValue={renderValue}\n />\n </CommonWrapper>\n );\n };\n\n /**\n * @public\n */\n public open() {\n if (this._select) {\n this._select.open();\n }\n }\n\n /**\n * @public\n */\n public close() {\n if (this._select) {\n this._select.close();\n }\n }\n\n private _refSelect = (element: DropdownSelectType): void => {\n this._select = element;\n };\n}\n\nfunction renderValue(value: any) {\n return value;\n}\n"],"mappings":"qeAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;;AAEA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;;;AAGA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;;;;AAIA,IAAAU,iBAAA,GAAAV,OAAA,uBAAsD,IAAAW,SAAA,2BAAAC,MAAA,EAAAC,SAAA;;AAEtD,IAAMC,UAAU,GAAG;EACjBC,aAAa,EAAE,IAAI;EACnBC,KAAK,EAAE,IAAI;EACXC,QAAQ,EAAE,IAAI;EACdC,aAAa,EAAE,IAAI;EACnBC,SAAS,EAAE,IAAI;EACfC,SAAS,EAAE,IAAI;EACfC,aAAa,EAAE,IAAI;EACnBC,GAAG,EAAE,IAAI;EACTC,IAAI,EAAE,IAAI;EACVC,OAAO,EAAE,IAAI;EACbC,KAAK,EAAE,IAAI;EACXC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAE,IAAI;EACbC,YAAY,EAAE,IAAI;EAClBC,YAAY,EAAE,IAAI;EAClBC,WAAW,EAAE,IAAI;EACjBC,OAAO,EAAE,IAAI;EACbC,EAAE,EAAE,IAAI;EACR,kBAAkB,EAAE,IAAI;EACxB,YAAY,EAAE;AAChB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEM,IAAMC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AM,EAAEJ,kBAAS,CAACO,MAAM,CAAC,CAAC,EAEhE;AACJ;AACA,KACI9E,OAAO,EAAEuE,kBAAS,CAACS,IAAI,EAEvB/E,YAAY,EAAEsE,kBAAS,CAACS,IAAI,EAE5B9E,YAAY,EAAEqE,kBAAS,CAACS,IAAI,EAE5B7E,WAAW,EAAEoE,kBAAS,CAACS,IAAI,EAE3B;AACJ;AACA,KACIjF,MAAM,EAAEwE,kBAAS,CAACS,IAAI,CACxB,CAAC,EAAA9F,SAAA,MAAAD,MAAA,CA2DH,SAAS8D,WAAWA,CAACF,KAAU,EAAE,CAC/B,OAAOA,KAAK,CACd","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ var _ThemeContext = require("../../../lib/theming/ThemeContext");
|
|
|
7
7
|
var _forwardRefAndName = require("../../../lib/forwardRefAndName");
|
|
8
8
|
var _Emotion = require("../../../lib/theming/Emotion");
|
|
9
9
|
|
|
10
|
+
|
|
10
11
|
var _ColorableInputElement = require("./ColorableInputElement.styles");var _excluded = ["children", "onInput", "onFocus", "onBlur", "showOnFocus"];
|
|
11
12
|
|
|
12
13
|
|
|
@@ -44,9 +45,9 @@ var ColorableInputElement = exports.ColorableInputElement = (0, _forwardRefAndNa
|
|
|
44
45
|
(0, _react.useEffect)(updateActive, []);
|
|
45
46
|
|
|
46
47
|
(0, _react.useEffect)(function () {
|
|
47
|
-
activation(props);
|
|
48
|
+
activation(props, theme);
|
|
48
49
|
updateActive();
|
|
49
|
-
}, [active, showOnFocus, props.value, props.defaultValue, props.disabled, focused.current]);
|
|
50
|
+
}, [active, showOnFocus, props.value, props.defaultValue, props.disabled, focused.current, theme]);
|
|
50
51
|
|
|
51
52
|
(0, _react.useEffect)(function () {
|
|
52
53
|
if (inputRef.current) {
|
|
@@ -72,7 +73,7 @@ var ColorableInputElement = exports.ColorableInputElement = (0, _forwardRefAndNa
|
|
|
72
73
|
var isActive = !((_inputRef$current = inputRef.current) != null && (_inputRef$current = _inputRef$current.parentElement) != null && _inputRef$current.querySelector(':placeholder-shown'));
|
|
73
74
|
setActive(isActive);
|
|
74
75
|
|
|
75
|
-
activation(props);
|
|
76
|
+
activation(props, theme);
|
|
76
77
|
|
|
77
78
|
onInput == null || onInput(e);
|
|
78
79
|
}
|
|
@@ -99,9 +100,9 @@ var ColorableInputElement = exports.ColorableInputElement = (0, _forwardRefAndNa
|
|
|
99
100
|
});
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
function activation(props) {
|
|
103
|
+
function activation(props, theme) {
|
|
103
104
|
if (active) {
|
|
104
|
-
debouncedPaintText(props);
|
|
105
|
+
debouncedPaintText(props, theme);
|
|
105
106
|
} else {var _inputRef$current3;
|
|
106
107
|
debouncedPaintText.cancel();
|
|
107
108
|
inputRef.current && (inputRef.current.style.backgroundImage = '');
|
|
@@ -109,7 +110,7 @@ var ColorableInputElement = exports.ColorableInputElement = (0, _forwardRefAndNa
|
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
function paintText(_props) {var _inputRef$current4, _shadow;if (_props === void 0) {_props = props;}
|
|
113
|
+
function paintText(_props, _theme) {var _inputRef$current4, _shadow;if (_props === void 0) {_props = props;}if (_theme === void 0) {_theme = theme;}
|
|
113
114
|
if (!spanRef.current || !inputRef.current || !inputStyle.current || !(0, _globalObject.isBrowser)(_globalObject.globalObject)) {
|
|
114
115
|
return;
|
|
115
116
|
}
|
|
@@ -141,11 +142,11 @@ var ColorableInputElement = exports.ColorableInputElement = (0, _forwardRefAndNa
|
|
|
141
142
|
var threshold = filledRect.width / (inputRect.width / 100);
|
|
142
143
|
var degree = style.fontStyle === 'italic' ? 100 : 90;
|
|
143
144
|
|
|
144
|
-
var typedValueColor =
|
|
145
|
-
var maskColor =
|
|
145
|
+
var typedValueColor = _theme.inputTextColor;
|
|
146
|
+
var maskColor = _theme.inputPlaceholderColor;
|
|
146
147
|
if (_props.disabled) {
|
|
147
|
-
typedValueColor =
|
|
148
|
-
maskColor =
|
|
148
|
+
typedValueColor = _theme.inputTextColorDisabled;
|
|
149
|
+
maskColor = _theme.inputTextColorDisabled;
|
|
149
150
|
}
|
|
150
151
|
if (_props.showOnFocus) {
|
|
151
152
|
maskColor = focused.current ? maskColor : 'transparent';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_globalObject","_lodash","_interopRequireDefault","_ThemeContext","_forwardRefAndName","_Emotion","_ColorableInputElement","_excluded","ColorableInputElement","exports","forwardRefAndName","props","ref","inputRef","useRef","spanRef","focused","inputStyle","React","theme","useContext","ThemeContext","debouncedPaintText","useCallback","debounce","paintText","_useState","useState","active","setActive","children","onInput","onFocus","onBlur","showOnFocus","inputProps","_objectWithoutPropertiesLoose2","default","useImperativeHandle","input","current","getRootNode","useEffect","updateActive","activation","value","defaultValue","disabled","getComputedStyle","createElement","Fragment","cloneElement","_extends2","handleInput","handleFocus","handleBlur","className","cx","globalClasses","style","visibility","position","whiteSpace","e","_inputRef$current","isActive","parentElement","querySelector","setTimeout","_inputRef$current2","_inputRef$current3","cancel","backgroundImage","classList","remove","_props","_inputRef$current4","_shadow","isBrowser","globalObject","add","shadow","shadowRoot","typedValueElement","getElementById","attachShadow","mode","document","setAttribute","appendChild","textContent","getAttribute","inputRect","getBoundingClientRect","filledRect","threshold","width","degree","fontStyle","typedValueColor","inputTextColor","maskColor","inputPlaceholderColor","inputTextColorDisabled"],"sources":["ColorableInputElement.tsx"],"sourcesContent":["import React, { ForwardedRef, useContext, useEffect, useImperativeHandle, useRef, useCallback, useState } from 'react';\nimport { globalObject, isBrowser } from '@skbkontur/global-object';\nimport debounce from 'lodash.debounce';\n\nimport { ThemeContext } from '../../../lib/theming/ThemeContext';\nimport { InputElement, InputElementProps } from '../../Input';\nimport { forwardRefAndName } from '../../../lib/forwardRefAndName';\nimport { cx } from '../../../lib/theming/Emotion';\n\nimport { globalClasses } from './ColorableInputElement.styles';\n\nexport type ColorableInputElementProps = InputElementProps & {\n showOnFocus?: boolean;\n children: React.ReactElement;\n};\n\n// Возможно придётся включить.\n// Иногда, на тяжёлых страницах, текст рендерится итеративно.\n// Из-за этого могут оставаться артефакты при покраске компонента, которые пропадут только после фокуса.\n// setInterval(() => window.requestAnimationFrame(() => dictionary.forEach((paint) => paint())), 1000);\n\nexport const ColorableInputElement = forwardRefAndName(\n 'ColorableInputElement',\n function ColorableInputElement(props: ColorableInputElementProps, ref: ForwardedRef<InputElement>) {\n const inputRef = useRef<HTMLInputElement | null>(null);\n const spanRef = useRef<HTMLSpanElement | null>(null);\n const focused = useRef(false);\n const inputStyle = React.useRef<CSSStyleDeclaration>();\n const theme = useContext(ThemeContext);\n const debouncedPaintText = useCallback(debounce(paintText), []);\n const [active, setActive] = useState(true);\n\n const { children, onInput, onFocus, onBlur, showOnFocus, ...inputProps } = props;\n\n useImperativeHandle(\n ref,\n () => ({\n input: inputRef.current,\n getRootNode: () => inputRef.current,\n }),\n [],\n );\n\n useEffect(updateActive, []);\n\n useEffect(() => {\n activation(props);\n updateActive();\n }, [active, showOnFocus, props.value, props.defaultValue, props.disabled, focused.current]);\n\n useEffect(() => {\n if (inputRef.current) {\n inputStyle.current = getComputedStyle(inputRef.current);\n }\n });\n\n return (\n <>\n {React.cloneElement(children, {\n ...inputProps,\n onInput: handleInput,\n onFocus: handleFocus,\n onBlur: handleBlur,\n inputRef,\n className: cx(props.className, active && globalClasses.input),\n })}\n {active && <span style={{ visibility: 'hidden', position: 'absolute', whiteSpace: 'pre' }} ref={spanRef} />}\n </>\n );\n\n function handleInput(e: React.ChangeEvent<HTMLInputElement>) {\n const isActive = !inputRef.current?.parentElement?.querySelector(':placeholder-shown');\n setActive(isActive);\n\n activation(props);\n\n onInput?.(e);\n }\n\n function handleFocus(e: React.FocusEvent<HTMLInputElement>) {\n setTimeout(updateActive);\n\n focused.current = true;\n\n onFocus?.(e);\n }\n\n function handleBlur(e: React.FocusEvent<HTMLInputElement>) {\n updateActive();\n\n focused.current = false;\n\n onBlur?.(e);\n }\n\n function updateActive() {\n setTimeout(() => {\n setActive(!inputRef.current?.parentElement?.querySelector(':placeholder-shown'));\n });\n }\n\n function activation(props: ColorableInputElementProps) {\n if (active) {\n debouncedPaintText(props);\n } else {\n debouncedPaintText.cancel();\n inputRef.current && (inputRef.current.style.backgroundImage = '');\n inputRef.current?.classList.remove(globalClasses.input);\n }\n }\n\n function paintText(_props: Partial<ColorableInputElementProps> = props) {\n if (!spanRef.current || !inputRef.current || !inputStyle.current || !isBrowser(globalObject)) {\n return;\n }\n\n inputRef.current?.classList.add(globalClasses.input);\n\n let shadow = spanRef.current.shadowRoot;\n let typedValueElement = shadow?.getElementById('span');\n\n if (!typedValueElement) {\n shadow = spanRef.current.attachShadow({ mode: 'open' });\n\n typedValueElement = globalObject.document.createElement('span');\n typedValueElement.setAttribute('id', 'span');\n\n shadow.appendChild(typedValueElement);\n }\n\n const style = inputStyle.current;\n\n typedValueElement.textContent =\n ((inputRef.current.getAttribute('data-unmasked-value') || focused.current) &&\n inputRef.current.getAttribute('data-typed-value')) ||\n '';\n\n const inputRect = inputRef.current.getBoundingClientRect();\n const filledRect = spanRef.current.getBoundingClientRect();\n\n const threshold = filledRect.width / (inputRect.width / 100);\n const degree = style.fontStyle === 'italic' ? 100 : 90;\n\n let typedValueColor = theme.inputTextColor;\n let maskColor = theme.inputPlaceholderColor;\n if (_props.disabled) {\n typedValueColor = theme.inputTextColorDisabled;\n maskColor = theme.inputTextColorDisabled;\n }\n if (_props.showOnFocus) {\n maskColor = focused.current ? maskColor : 'transparent';\n }\n\n inputRef.current.style.backgroundImage = `\n linear-gradient(\n ${degree}deg,\n ${typedValueColor} ${threshold}%,\n ${maskColor} ${threshold}%\n )`;\n }\n },\n);\n"],"mappings":"wdAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;;AAEA,IAAAI,aAAA,GAAAJ,OAAA;;AA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AMC,SAAS,GAAG/E,QAAQ,CAAC2B,OAAO,CAACqD,qBAAqB,CAAC,CAAC;MAC1D,IAAMC,UAAU,GAAG/E,OAAO,CAACyB,OAAO,CAACqD,qBAAqB,CAAC,CAAC;;MAE1D,IAAME,SAAS,GAAGD,UAAU,CAACE,KAAK,IAAIJ,SAAS,CAACI,KAAK,GAAG,GAAG,CAAC;MAC5D,IAAMC,MAAM,GAAGtC,KAAK,CAACuC,SAAS,KAAK,QAAQ,GAAG,GAAG,GAAG,EAAE;;MAEtD,IAAIC,eAAe,GAAGhF,KAAK,CAACiF,cAAc;MAC1C,IAAIC,SAAS,GAAGlF,KAAK,CAACmF,qBAAqB;MAC3C,IAAI3B,MAAM,CAAC5B,QAAQ,EAAE;QACnBoD,eAAe,GAAGhF,KAAK,CAACoF,sBAAsB;QAC9CF,SAAS,GAAGlF,KAAK,CAACoF,sBAAsB;MAC1C;MACA,IAAI5B,MAAM,CAACzC,WAAW,EAAE;QACtBmE,SAAS,GAAGrF,OAAO,CAACwB,OAAO,GAAG6D,SAAS,GAAG,aAAa;MACzD;;MAEAxF,QAAQ,CAAC2B,OAAO,CAACmB,KAAK,CAACa,eAAe;;MAEhCyB,MAAM;MACNE,eAAe,SAAIJ,SAAS;MAC5BM,SAAS,SAAIN,SAAS,eAC1B;;IACJ;EACF;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_globalObject","_lodash","_interopRequireDefault","_ThemeContext","_forwardRefAndName","_Emotion","_ColorableInputElement","_excluded","ColorableInputElement","exports","forwardRefAndName","props","ref","inputRef","useRef","spanRef","focused","inputStyle","React","theme","useContext","ThemeContext","debouncedPaintText","useCallback","debounce","paintText","_useState","useState","active","setActive","children","onInput","onFocus","onBlur","showOnFocus","inputProps","_objectWithoutPropertiesLoose2","default","useImperativeHandle","input","current","getRootNode","useEffect","updateActive","activation","value","defaultValue","disabled","getComputedStyle","createElement","Fragment","cloneElement","_extends2","handleInput","handleFocus","handleBlur","className","cx","globalClasses","style","visibility","position","whiteSpace","e","_inputRef$current","isActive","parentElement","querySelector","setTimeout","_inputRef$current2","_inputRef$current3","cancel","backgroundImage","classList","remove","_props","_theme","_inputRef$current4","_shadow","isBrowser","globalObject","add","shadow","shadowRoot","typedValueElement","getElementById","attachShadow","mode","document","setAttribute","appendChild","textContent","getAttribute","inputRect","getBoundingClientRect","filledRect","threshold","width","degree","fontStyle","typedValueColor","inputTextColor","maskColor","inputPlaceholderColor","inputTextColorDisabled"],"sources":["ColorableInputElement.tsx"],"sourcesContent":["import React, { ForwardedRef, useContext, useEffect, useImperativeHandle, useRef, useCallback, useState } from 'react';\nimport { globalObject, isBrowser } from '@skbkontur/global-object';\nimport debounce from 'lodash.debounce';\n\nimport { ThemeContext } from '../../../lib/theming/ThemeContext';\nimport { InputElement, InputElementProps } from '../../Input';\nimport { forwardRefAndName } from '../../../lib/forwardRefAndName';\nimport { cx } from '../../../lib/theming/Emotion';\nimport { Theme } from '../../../lib/theming/Theme';\n\nimport { globalClasses } from './ColorableInputElement.styles';\n\nexport type ColorableInputElementProps = InputElementProps & {\n showOnFocus?: boolean;\n children: React.ReactElement;\n};\n\n// Возможно придётся включить.\n// Иногда, на тяжёлых страницах, текст рендерится итеративно.\n// Из-за этого могут оставаться артефакты при покраске компонента, которые пропадут только после фокуса.\n// setInterval(() => window.requestAnimationFrame(() => dictionary.forEach((paint) => paint())), 1000);\n\nexport const ColorableInputElement = forwardRefAndName(\n 'ColorableInputElement',\n function ColorableInputElement(props: ColorableInputElementProps, ref: ForwardedRef<InputElement>) {\n const inputRef = useRef<HTMLInputElement | null>(null);\n const spanRef = useRef<HTMLSpanElement | null>(null);\n const focused = useRef(false);\n const inputStyle = React.useRef<CSSStyleDeclaration>();\n const theme = useContext(ThemeContext);\n const debouncedPaintText = useCallback(debounce(paintText), []);\n const [active, setActive] = useState(true);\n\n const { children, onInput, onFocus, onBlur, showOnFocus, ...inputProps } = props;\n\n useImperativeHandle(\n ref,\n () => ({\n input: inputRef.current,\n getRootNode: () => inputRef.current,\n }),\n [],\n );\n\n useEffect(updateActive, []);\n\n useEffect(() => {\n activation(props, theme);\n updateActive();\n }, [active, showOnFocus, props.value, props.defaultValue, props.disabled, focused.current, theme]);\n\n useEffect(() => {\n if (inputRef.current) {\n inputStyle.current = getComputedStyle(inputRef.current);\n }\n });\n\n return (\n <>\n {React.cloneElement(children, {\n ...inputProps,\n onInput: handleInput,\n onFocus: handleFocus,\n onBlur: handleBlur,\n inputRef,\n className: cx(props.className, active && globalClasses.input),\n })}\n {active && <span style={{ visibility: 'hidden', position: 'absolute', whiteSpace: 'pre' }} ref={spanRef} />}\n </>\n );\n\n function handleInput(e: React.ChangeEvent<HTMLInputElement>) {\n const isActive = !inputRef.current?.parentElement?.querySelector(':placeholder-shown');\n setActive(isActive);\n\n activation(props, theme);\n\n onInput?.(e);\n }\n\n function handleFocus(e: React.FocusEvent<HTMLInputElement>) {\n setTimeout(updateActive);\n\n focused.current = true;\n\n onFocus?.(e);\n }\n\n function handleBlur(e: React.FocusEvent<HTMLInputElement>) {\n updateActive();\n\n focused.current = false;\n\n onBlur?.(e);\n }\n\n function updateActive() {\n setTimeout(() => {\n setActive(!inputRef.current?.parentElement?.querySelector(':placeholder-shown'));\n });\n }\n\n function activation(props: ColorableInputElementProps, theme: Theme) {\n if (active) {\n debouncedPaintText(props, theme);\n } else {\n debouncedPaintText.cancel();\n inputRef.current && (inputRef.current.style.backgroundImage = '');\n inputRef.current?.classList.remove(globalClasses.input);\n }\n }\n\n function paintText(_props: Partial<ColorableInputElementProps> = props, _theme: Theme = theme) {\n if (!spanRef.current || !inputRef.current || !inputStyle.current || !isBrowser(globalObject)) {\n return;\n }\n\n inputRef.current?.classList.add(globalClasses.input);\n\n let shadow = spanRef.current.shadowRoot;\n let typedValueElement = shadow?.getElementById('span');\n\n if (!typedValueElement) {\n shadow = spanRef.current.attachShadow({ mode: 'open' });\n\n typedValueElement = globalObject.document.createElement('span');\n typedValueElement.setAttribute('id', 'span');\n\n shadow.appendChild(typedValueElement);\n }\n\n const style = inputStyle.current;\n\n typedValueElement.textContent =\n ((inputRef.current.getAttribute('data-unmasked-value') || focused.current) &&\n inputRef.current.getAttribute('data-typed-value')) ||\n '';\n\n const inputRect = inputRef.current.getBoundingClientRect();\n const filledRect = spanRef.current.getBoundingClientRect();\n\n const threshold = filledRect.width / (inputRect.width / 100);\n const degree = style.fontStyle === 'italic' ? 100 : 90;\n\n let typedValueColor = _theme.inputTextColor;\n let maskColor = _theme.inputPlaceholderColor;\n if (_props.disabled) {\n typedValueColor = _theme.inputTextColorDisabled;\n maskColor = _theme.inputTextColorDisabled;\n }\n if (_props.showOnFocus) {\n maskColor = focused.current ? maskColor : 'transparent';\n }\n\n inputRef.current.style.backgroundImage = `\n linear-gradient(\n ${degree}deg,\n ${typedValueColor} ${threshold}%,\n ${maskColor} ${threshold}%\n )`;\n }\n },\n);\n"],"mappings":"wdAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;;AAEA,IAAAI,aAAA,GAAAJ,OAAA;;AAEA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;;;AAGA,IAAAO,sBAAA,GAAAP,OAAA,mCAA+D,IAAAQ,SAAA;;;;;;;AAO/D;AACA;AACA;AACA;;AAEO,IAAMC,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG,IAAAE,oCAAiB;EACpD,uBAAuB;EACvB,SAASF,qBAAqBA,CAACG,KAAiC,EAAEC,GAA+B,EAAE;IACjG,IAAMC,QAAQ,GAAG,IAAAC,aAAM,EAA0B,IAAI,CAAC;IACtD,IAAMC,OAAO,GAAG,IAAAD,aAAM,EAAyB,IAAI,CAAC;IACpD,IAAME,OAAO,GAAG,IAAAF,aAAM,EAAC,KAAK,CAAC;IAC7B,IAAMG,UAAU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,CAACyB,cAAc;MAC3C,IAAIC,SAAS,GAAG1B,MAAM,CAAC2B,qBAAqB;MAC5C,IAAI5B,MAAM,CAAC5B,QAAQ,EAAE;QACnBqD,eAAe,GAAGxB,MAAM,CAAC4B,sBAAsB;QAC/CF,SAAS,GAAG1B,MAAM,CAAC4B,sBAAsB;MAC3C;MACA,IAAI7B,MAAM,CAACzC,WAAW,EAAE;QACtBoE,SAAS,GAAGtF,OAAO,CAACwB,OAAO,GAAG8D,SAAS,GAAG,aAAa;MACzD;;MAEAzF,QAAQ,CAAC2B,OAAO,CAACmB,KAAK,CAACa,eAAe;;MAEhC0B,MAAM;MACNE,eAAe,SAAIJ,SAAS;MAC5BM,SAAS,SAAIN,SAAS,eAC1B;;IACJ;EACF;AACF,CAAC","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@ var _rootNode = require("../../lib/rootNode");
|
|
|
14
14
|
var _MenuContext = require("../../internal/Menu/MenuContext");
|
|
15
15
|
var _getVisualStateDataAttributes = require("../../internal/CommonWrapper/utils/getVisualStateDataAttributes");
|
|
16
16
|
|
|
17
|
-
var _MenuItem2 = require("./MenuItem.styles");var _excluded = ["link", "comment", "icon", "loose", "state", "size", "_enableIconPadding", "component", "onMouseEnter", "onMouseLeave", "isMobile", "href", "disabled", "scrollIntoView", "rel", "isNotSelectable"];var _class, _MenuItem;
|
|
17
|
+
var _MenuItem2 = require("./MenuItem.styles");var _excluded = ["link", "comment", "icon", "loose", "state", "size", "_enableIconPadding", "component", "onMouseEnter", "onMouseLeave", "isMobile", "href", "disabled", "scrollIntoView", "rel", "isNotSelectable", "children", "className", "style", "data-tid"];var _class, _MenuItem;
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -189,17 +189,6 @@ MenuItem = exports.MenuItem = (0, _rootNode.rootNode)(_class = (_MenuItem = /*#_
|
|
|
189
189
|
|
|
190
190
|
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
192
|
|
|
204
193
|
|
|
205
194
|
|
|
@@ -275,9 +264,12 @@ MenuItem = exports.MenuItem = (0, _rootNode.rootNode)(_class = (_MenuItem = /*#_
|
|
|
275
264
|
|
|
276
265
|
|
|
277
266
|
|
|
278
|
-
renderMain = function (
|
|
279
|
-
var
|
|
280
|
-
|
|
267
|
+
renderMain = function () {var _cx2, _cx3, _cx4;
|
|
268
|
+
var _this$props =
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
281
273
|
|
|
282
274
|
|
|
283
275
|
|
|
@@ -294,7 +286,8 @@ MenuItem = exports.MenuItem = (0, _rootNode.rootNode)(_class = (_MenuItem = /*#_
|
|
|
294
286
|
|
|
295
287
|
|
|
296
288
|
|
|
297
|
-
|
|
289
|
+
|
|
290
|
+
_this.props,link = _this$props.link,comment = _this$props.comment,icon = _this$props.icon,loose = _this$props.loose,state = _this$props.state,size = _this$props.size,_enableIconPadding = _this$props._enableIconPadding,component = _this$props.component,onMouseEnter = _this$props.onMouseEnter,onMouseLeave = _this$props.onMouseLeave,isMobile = _this$props.isMobile,href = _this$props.href,disabled = _this$props.disabled,scrollIntoView = _this$props.scrollIntoView,_this$props$rel = _this$props.rel,rel = _this$props$rel === void 0 ? href && (0, _utils.isExternalLink)(href) ? 'noopener noreferrer' : _this.props.rel : _this$props$rel,isNotSelectable = _this$props.isNotSelectable,children = _this$props.children,unusedClasses = _this$props.className,style = _this$props.style,dataTid = _this$props['data-tid'],rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props, _excluded);
|
|
298
291
|
|
|
299
292
|
var iconElement = null;
|
|
300
293
|
if (icon) {var _cx;
|
|
@@ -320,19 +313,25 @@ MenuItem = exports.MenuItem = (0, _rootNode.rootNode)(_class = (_MenuItem = /*#_
|
|
|
320
313
|
_MenuItem2.styles.selected(_this.theme)] = _this.isSelected, _cx2[
|
|
321
314
|
_MenuItem2.styles.link(_this.theme)] = !!link, _cx2[
|
|
322
315
|
_this.getWithIconSizeClassName()] = Boolean(iconElement) || !!_enableIconPadding || _this.context.enableIconPadding, _cx2[
|
|
323
|
-
_MenuItem2.styles.disabled(_this.theme)] = !!
|
|
316
|
+
_MenuItem2.styles.disabled(_this.theme)] = !!disabled, _cx2)
|
|
324
317
|
);
|
|
325
318
|
|
|
326
|
-
var children = _this.props.children;
|
|
327
|
-
|
|
328
319
|
var content = children;
|
|
329
320
|
if ((0, _utils.isFunction)(children)) {
|
|
330
|
-
content = children(
|
|
321
|
+
content = children(state);
|
|
331
322
|
}
|
|
332
323
|
|
|
333
324
|
var Component = _this.getComponent();
|
|
334
325
|
|
|
335
326
|
return /*#__PURE__*/(
|
|
327
|
+
_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({
|
|
328
|
+
rootNodeRef: _this.setRootNode },
|
|
329
|
+
(0, _getVisualStateDataAttributes.getVisualStateDataAttributes)({
|
|
330
|
+
hover: _this.isHover,
|
|
331
|
+
selected: _this.isSelected
|
|
332
|
+
}),
|
|
333
|
+
_this.props), /*#__PURE__*/
|
|
334
|
+
|
|
336
335
|
_react.default.createElement(Component, (0, _extends2.default)({
|
|
337
336
|
ref: _this.setRootRef,
|
|
338
337
|
"data-tid": MenuItemDataTids.root },
|
|
@@ -357,7 +356,7 @@ MenuItem = exports.MenuItem = (0, _rootNode.rootNode)(_class = (_MenuItem = /*#_
|
|
|
357
356
|
|
|
358
357
|
typeof content === 'function' ? content() : content
|
|
359
358
|
),
|
|
360
|
-
|
|
359
|
+
comment && /*#__PURE__*/
|
|
361
360
|
_react.default.createElement("div", {
|
|
362
361
|
"data-tid": MenuItemDataTids.comment,
|
|
363
362
|
className: (0, _Emotion.cx)((_cx4 = {}, _cx4[
|
|
@@ -368,6 +367,7 @@ MenuItem = exports.MenuItem = (0, _rootNode.rootNode)(_class = (_MenuItem = /*#_
|
|
|
368
367
|
comment
|
|
369
368
|
)
|
|
370
369
|
|
|
370
|
+
)
|
|
371
371
|
));
|
|
372
372
|
|
|
373
373
|
};
|
|
@@ -413,7 +413,7 @@ MenuItem = exports.MenuItem = (0, _rootNode.rootNode)(_class = (_MenuItem = /*#_
|
|
|
413
413
|
};_this.
|
|
414
414
|
|
|
415
415
|
getComponent = function () {
|
|
416
|
-
var _this$
|
|
416
|
+
var _this$props2 = _this.props,disabled = _this$props2.disabled,component = _this$props2.component,href = _this$props2.href;
|
|
417
417
|
|
|
418
418
|
if (component) {
|
|
419
419
|
return component;
|
|
@@ -432,7 +432,7 @@ MenuItem = exports.MenuItem = (0, _rootNode.rootNode)(_class = (_MenuItem = /*#_
|
|
|
432
432
|
|
|
433
433
|
hasIconAmongItems = function () {var _this$context$navigat3;
|
|
434
434
|
return Boolean((_this$context$navigat3 = _this.context.navigation) == null ? void 0 : _this$context$navigat3.items.some(function (item) {return item.props.icon;}));
|
|
435
|
-
};return _this;}(0, _inheritsLoose2.default)(MenuItem, _React$Component);var _proto = MenuItem.prototype;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return
|
|
435
|
+
};return _this;}(0, _inheritsLoose2.default)(MenuItem, _React$Component);var _proto = MenuItem.prototype;_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.componentDidMount = function componentDidMount() {if (this.props.scrollIntoView && this.rootRef) {(0, _scrollYCenterIntoNearestScrollable.scrollYCenterIntoNearestScrollable)(this.rootRef);}if (this.rootRef && (0, _globalObject.isBrowser)(_globalObject.globalObject)) {this.setState({ iconOffsetTop: _globalObject.globalObject.getComputedStyle(this.rootRef).getPropertyValue('padding-top') });}if (this.contentRef.current && !this.props.isNotSelectable) {var _this$context$navigat4;(_this$context$navigat4 = this.context.navigation) == null || _this$context$navigat4.add(this.contentRef.current, this);}if (this.props.icon) {var _this$context$setEnab, _this$context;(_this$context$setEnab = (_this$context = this.context).setEnableIconPadding) == null || _this$context$setEnab.call(_this$context, true);}};_proto.componentWillUnmount = function componentWillUnmount() {if (this.contentRef.current) {var _this$context$navigat5, _this$context$setEnab2, _this$context2;!this.props.isNotSelectable && ((_this$context$navigat5 = this.context.navigation) == null ? void 0 : _this$context$navigat5.remove(this.contentRef.current));(_this$context$setEnab2 = (_this$context2 = this.context).setEnableIconPadding) == null || _this$context$setEnab2.call(_this$context2, this.hasIconAmongItems());}};_proto.componentDidUpdate = function componentDidUpdate(prevProps) {if (prevProps.icon !== this.props.icon) {var _this$context$setEnab3, _this$context3;(_this$context$setEnab3 = (_this$context3 = this.context).setEnableIconPadding) == null || _this$context$setEnab3.call(_this$context3, !!this.props.icon || this.hasIconAmongItems());}if (this.contentRef.current && prevProps.isNotSelectable !== this.props.isNotSelectable) {if (this.props.isNotSelectable) {var _this$context$navigat6;this.unhighlight();(_this$context$navigat6 = this.context.navigation) == null || _this$context$navigat6.remove(this.contentRef.current);} else {var _this$context$navigat7;(_this$context$navigat7 = this.context.navigation) == null || _this$context$navigat7.add(this.contentRef.current, this);}}};_proto.getRootSizeClassName = function getRootSizeClassName() {switch (this.props.size) {case 'large':return _MenuItem2.styles.rootLarge(this.theme);case 'medium':return _MenuItem2.styles.rootMedium(this.theme);case 'small':default:return _MenuItem2.styles.rootSmall(this.theme);}};_proto.getIconSizeClassName = function getIconSizeClassName() {switch (this.props.size) {case 'large':return _MenuItem2.styles.iconLarge(this.theme);case 'medium':return _MenuItem2.styles.iconMedium(this.theme);case 'small':default:return _MenuItem2.styles.iconSmall(this.theme);}};_proto.getWithIconSizeClassName = function getWithIconSizeClassName() {switch (this.props.size) {case 'large':return _MenuItem2.styles.withIconLarge(this.theme);case 'medium':return _MenuItem2.styles.withIconMedium(this.theme);case 'small':default:return _MenuItem2.styles.withIconSmall(this.theme);}};return (0, _createClass2.default)(MenuItem, [{ key: "activeState", get: function get() {return this.state.highlighted ? 'hover' : this.props.state;} }, { key: "isHover", get: function get() {return (this.state.highlighted || this.props.state === 'hover') && !this.props.disabled;} }, { key: "isSelected", get: function get() {return this.props.state === 'selected' && !this.state.highlighted;} }]);}(_react.default.Component), _MenuItem.__KONTUR_REACT_UI__ = 'MenuItem', _MenuItem.displayName = 'MenuItem', _MenuItem.__MENU_ITEM__ = true, _MenuItem.propTypes = { comment: _propTypes.default.node, disabled: _propTypes.default.bool, href: _propTypes.default.string, icon: _propTypes.default.node, loose: _propTypes.default.bool, state: _propTypes.default.string, target: _propTypes.default.string, onClick: _propTypes.default.func, size: _propTypes.default.string }, _MenuItem.contextType = _MenuContext.MenuContext, _MenuItem)) || _class;
|
|
436
436
|
|
|
437
437
|
|
|
438
438
|
var isMenuItem = exports.isMenuItem = (0, _utils.isReactUIComponent)('MenuItem');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_propTypes","_globalObject","_scrollYCenterIntoNearestScrollable","_utils","_ThemeContext","_CommonWrapper","_Emotion","_rootNode","_MenuContext","_getVisualStateDataAttributes","_MenuItem2","_excluded","_class","_MenuItem","MenuItemDataTids","exports","root","content","comment","MenuItem","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","state","iconOffsetTop","highlighted","mouseEntered","rootRef","contentRef","React","createRef","highlight","setState","unhighlight","select","event","handleClick","isEnabled","props","disabled","navigate","href","target","window","open","location","renderMain","_cx2","_cx3","_cx4","link","icon","loose","size","_enableIconPadding","component","onMouseEnter","onMouseLeave","isMobile","scrollIntoView","_props$rel","rel","isExternalLink","isNotSelectable","rest","_objectWithoutPropertiesLoose2","default","iconElement","_cx","createElement","style","top","className","cx","styles","getIconSizeClassName","theme","getRootSizeClassName","rootMobile","hover","isHover","selected","isSelected","getWithIconSizeClassName","Boolean","context","enableIconPadding","children","isFunction","Component","getComponent","_extends2","ref","setRootRef","activeState","onMouseOver","handleMouseEnterFix","handleMouseLeave","onClick","undefined","tabIndex","mobileContentWithIcon","isNonNullable","commentHover","e","_this$context$navigat","navigation","_this$context$navigat2","onItemClick","element","_this$props","hasIconAmongItems","_this$context$navigat3","items","some","item","_inheritsLoose2","_proto","prototype","render","_this2","ThemeContext","Consumer","CommonWrapper","rootNodeRef","setRootNode","getVisualStateDataAttributes","componentDidMount","scrollYCenterIntoNearestScrollable","isBrowser","globalObject","getComputedStyle","getPropertyValue","current","_this$context$navigat4","add","_this$context$setEnab","_this$context","setEnableIconPadding","componentWillUnmount","_this$context$navigat5","_this$context$setEnab2","_this$context2","remove","componentDidUpdate","prevProps","_this$context$setEnab3","_this$context3","_this$context$navigat6","_this$context$navigat7","rootLarge","rootMedium","rootSmall","iconLarge","iconMedium","iconSmall","withIconLarge","withIconMedium","withIconSmall","_createClass2","key","get","__KONTUR_REACT_UI__","displayName","__MENU_ITEM__","propTypes","PropTypes","node","bool","string","func","contextType","MenuContext","isMenuItem","isReactUIComponent"],"sources":["MenuItem.tsx"],"sourcesContent":["import React, { AriaAttributes, HTMLAttributes } from 'react';\nimport PropTypes from 'prop-types';\nimport { globalObject, isBrowser } from '@skbkontur/global-object';\n\nimport { scrollYCenterIntoNearestScrollable } from '../../lib/dom/scrollYCenterIntoNearestScrollable';\nimport { Nullable } from '../../typings/utility-types';\nimport { isExternalLink, isFunction, isNonNullable, isReactUIComponent } from '../../lib/utils';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { CommonProps, CommonWrapper, CommonWrapperRestProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { SizeProp } from '../../lib/types/props';\nimport { MenuContext, MenuContextType } from '../../internal/Menu/MenuContext';\nimport { getVisualStateDataAttributes } from '../../internal/CommonWrapper/utils/getVisualStateDataAttributes';\n\nimport { styles } from './MenuItem.styles';\n\nexport type MenuItemState = null | 'hover' | 'selected' | void;\n\nexport interface MenuItemProps\n extends Pick<AriaAttributes, 'aria-describedby' | 'aria-label'>,\n Pick<HTMLAttributes<HTMLElement>, 'id'>,\n Omit<CommonProps, 'children'> {\n /**\n * @ignore\n */\n _enableIconPadding?: boolean;\n /**\n * Добавляет описание для элемента меню.\n */\n comment?: React.ReactNode;\n /**\n * Отключенное состояние.\n */\n disabled?: boolean;\n /**\n * Добавляет элементу меню иконку.\n */\n icon?: React.ReactElement<any>;\n /**\n * Меняет цвет текста на синий.\n */\n link?: boolean;\n /**\n * Размер\n */\n size?: SizeProp;\n /**\n * @ignore\n */\n loose?: boolean;\n /**\n * @ignore\n */\n state?: MenuItemState;\n /**\n * HTML-событие `onclick`.\n */\n onClick?: (event: React.SyntheticEvent<HTMLElement>) => void;\n /**\n * HTML-событие `mouseenter`.\n */\n onMouseEnter?: React.MouseEventHandler;\n /**\n * HTML-событие `mouseleave`.\n */\n onMouseLeave?: React.MouseEventHandler;\n children?: React.ReactNode | ((state: MenuItemState) => React.ReactNode);\n /**\n * HTML-атрибут `target`.\n */\n target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];\n /**\n * HTML-атрибут `title`.\n */\n title?: React.AnchorHTMLAttributes<HTMLAnchorElement>['title'];\n /**\n * HTML-атрибут `href`.\n */\n href?: React.AnchorHTMLAttributes<HTMLAnchorElement>['href'];\n /**\n * HTML-атрибут `rel`.\n *\n * Для внешних ссылок аттрибут rel по умолчанию равен \"noopener noreferrer\"\n */\n rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];\n /**\n * Заменяет корневой элемент, на компонент переданный в проп.\n *\n * По умолчанию корневой элемент рендерится как `button`. <br />Если передан `href`, то вместо `button` рендерится `a`.\n */\n component?: React.ComponentType<any>;\n /**\n * Запрещает выделение и выбор данного пункта меню\n *\n */\n isNotSelectable?: boolean;\n\n isMobile?: boolean;\n /** @ignore */\n scrollIntoView?: boolean;\n}\n\nexport const MenuItemDataTids = {\n root: 'MenuItem__root',\n content: 'MenuItem__content',\n comment: 'MenuItem__comment',\n} as const;\n\n/**\n *\n * `MenuItem` - это вложенный компонент, задающий базовые стили для элемента меню и позволяющий навигироваться по элементам меню с помощью клавиатуры.\n *\n * Сущности в которых может быть использован `MenuItem`: [DropdownMenu](#/Components/DropdownMenu), [Kebab](#/Components/Kebab), [TooltipMenu](#/Components/TooltipMenu) и [Select](#/Components/Select).\n */\n@rootNode\nexport class MenuItem extends React.Component<MenuItemProps> {\n public static __KONTUR_REACT_UI__ = 'MenuItem';\n public static displayName = 'MenuItem';\n public static __MENU_ITEM__ = true;\n\n public static propTypes = {\n comment: PropTypes.node,\n\n disabled: PropTypes.bool,\n\n href: PropTypes.string,\n\n icon: PropTypes.node,\n\n loose: PropTypes.bool,\n\n state: PropTypes.string,\n\n target: PropTypes.string,\n\n onClick: PropTypes.func,\n\n size: PropTypes.string,\n };\n\n public state = {\n iconOffsetTop: 0,\n highlighted: false,\n };\n\n private theme!: Theme;\n private mouseEntered = false;\n private setRootNode!: TSetRootNode;\n private rootRef: Nullable<HTMLElement> = null;\n private contentRef = React.createRef<HTMLElement>();\n static contextType = MenuContext;\n\n public context!: MenuContextType;\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return (\n <CommonWrapper\n rootNodeRef={this.setRootNode}\n {...getVisualStateDataAttributes({\n hover: this.isHover,\n selected: this.isSelected,\n })}\n {...this.props}\n >\n {this.renderMain(this.props)}\n </CommonWrapper>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public componentDidMount() {\n if (this.props.scrollIntoView && this.rootRef) {\n scrollYCenterIntoNearestScrollable(this.rootRef);\n }\n if (this.rootRef && isBrowser(globalObject)) {\n this.setState({ iconOffsetTop: globalObject.getComputedStyle(this.rootRef).getPropertyValue('padding-top') });\n }\n if (this.contentRef.current && !this.props.isNotSelectable) {\n this.context.navigation?.add(this.contentRef.current, this);\n }\n if (this.props.icon) {\n this.context.setEnableIconPadding?.(true);\n }\n }\n\n public componentWillUnmount() {\n if (this.contentRef.current) {\n !this.props.isNotSelectable && this.context.navigation?.remove(this.contentRef.current);\n this.context.setEnableIconPadding?.(this.hasIconAmongItems());\n }\n }\n\n public componentDidUpdate(prevProps: Readonly<MenuItemProps>) {\n if (prevProps.icon !== this.props.icon) {\n this.context.setEnableIconPadding?.(!!this.props.icon || this.hasIconAmongItems());\n }\n if (this.contentRef.current && prevProps.isNotSelectable !== this.props.isNotSelectable) {\n if (this.props.isNotSelectable) {\n this.unhighlight();\n this.context.navigation?.remove(this.contentRef.current);\n } else {\n this.context.navigation?.add(this.contentRef.current, this);\n }\n }\n }\n\n public highlight = () => {\n this.setState({ highlighted: true });\n };\n\n public unhighlight = () => {\n this.setState({ highlighted: false });\n };\n\n public select = (event: React.SyntheticEvent<HTMLElement>) => {\n this.handleClick(event as React.MouseEvent<HTMLElement>);\n };\n\n public isEnabled = () => {\n return !this.props.disabled;\n };\n\n public navigate = () => {\n if (!this.props.href) {\n return;\n }\n if (this.props.target) {\n window.open(this.props.href, this.props.target);\n } else {\n location.href = this.props.href;\n }\n };\n\n private getRootSizeClassName() {\n switch (this.props.size) {\n case 'large':\n return styles.rootLarge(this.theme);\n case 'medium':\n return styles.rootMedium(this.theme);\n case 'small':\n default:\n return styles.rootSmall(this.theme);\n }\n }\n\n private getIconSizeClassName() {\n switch (this.props.size) {\n case 'large':\n return styles.iconLarge(this.theme);\n case 'medium':\n return styles.iconMedium(this.theme);\n case 'small':\n default:\n return styles.iconSmall(this.theme);\n }\n }\n\n private getWithIconSizeClassName() {\n switch (this.props.size) {\n case 'large':\n return styles.withIconLarge(this.theme);\n case 'medium':\n return styles.withIconMedium(this.theme);\n case 'small':\n default:\n return styles.withIconSmall(this.theme);\n }\n }\n\n private renderMain = (props: CommonWrapperRestProps<MenuItemProps>) => {\n const {\n link,\n comment,\n icon,\n loose,\n state,\n size,\n _enableIconPadding,\n component,\n onMouseEnter,\n onMouseLeave,\n isMobile,\n href,\n disabled,\n scrollIntoView,\n rel = this.props.href && isExternalLink(this.props.href) ? 'noopener noreferrer' : this.props.rel,\n isNotSelectable,\n ...rest\n } = props;\n\n let iconElement = null;\n if (icon) {\n iconElement = (\n <div\n style={{ top: this.state.iconOffsetTop }}\n className={cx({\n [styles.icon()]: true,\n [this.getIconSizeClassName()]: true,\n })}\n >\n {icon}\n </div>\n );\n }\n\n const className = cx({\n [styles.root(this.theme)]: true,\n [this.getRootSizeClassName()]: true,\n [styles.rootMobile(this.theme)]: isMobile,\n [styles.loose()]: !!loose,\n [styles.hover(this.theme)]: this.isHover,\n [styles.selected(this.theme)]: this.isSelected,\n [styles.link(this.theme)]: !!link,\n [this.getWithIconSizeClassName()]: Boolean(iconElement) || !!_enableIconPadding || this.context.enableIconPadding,\n [styles.disabled(this.theme)]: !!this.props.disabled,\n });\n\n const { children } = this.props;\n\n let content = children;\n if (isFunction(children)) {\n content = children(this.props.state);\n }\n\n const Component = this.getComponent();\n\n return (\n <Component\n ref={this.setRootRef}\n data-tid={MenuItemDataTids.root}\n {...rest}\n disabled={disabled}\n state={this.activeState}\n onMouseOver={this.handleMouseEnterFix}\n onMouseLeave={this.handleMouseLeave}\n onClick={this.handleClick}\n className={className}\n href={href}\n rel={href ? rel : undefined}\n tabIndex={-1}\n >\n {iconElement}\n <span\n className={cx({\n [styles.mobileContentWithIcon()]: isMobile && isNonNullable(icon),\n })}\n ref={this.contentRef}\n data-tid={MenuItemDataTids.content}\n >\n {typeof content === 'function' ? content() : content}\n </span>\n {this.props.comment && (\n <div\n data-tid={MenuItemDataTids.comment}\n className={cx({\n [styles.comment(this.theme)]: true,\n [styles.commentHover(this.theme)]: this.isHover,\n })}\n >\n {comment}\n </div>\n )}\n </Component>\n );\n };\n\n private get activeState() {\n return this.state.highlighted ? 'hover' : this.props.state;\n }\n\n private get isHover(): boolean {\n return (this.state.highlighted || this.props.state === 'hover') && !this.props.disabled;\n }\n\n private get isSelected(): boolean {\n return this.props.state === 'selected' && !this.state.highlighted;\n }\n\n // https://github.com/facebook/react/issues/10109\n // Mouseenter event not triggered when cursor moves from disabled button\n private handleMouseEnterFix = (e: React.MouseEvent<HTMLElement>) => {\n if (!this.mouseEntered) {\n this.mouseEntered = true;\n this.props.onMouseEnter?.(e);\n !this.props.isNotSelectable && this.context.navigation?.highlight(this);\n }\n };\n\n private handleMouseLeave = (e: React.MouseEvent<HTMLElement>) => {\n this.mouseEntered = false;\n this.props.onMouseLeave?.(e);\n !this.props.isNotSelectable && this.context.navigation?.unhighlight();\n };\n\n private handleClick = (e: React.MouseEvent<HTMLElement>) => {\n if (this.props.isNotSelectable) {\n return;\n }\n this.props.onClick?.(e);\n this.context.onItemClick?.(e);\n };\n\n private setRootRef = (element: HTMLElement) => {\n this.rootRef = element;\n };\n\n private getComponent = () => {\n const { disabled, component, href } = this.props;\n\n if (component) {\n return component;\n }\n\n if (disabled) {\n return 'button';\n }\n\n if (href) {\n return 'a';\n }\n\n return 'button';\n };\n\n private hasIconAmongItems = () => {\n return Boolean(this.context.navigation?.items.some((item) => item.props.icon));\n };\n}\n\nexport const isMenuItem = isReactUIComponent('MenuItem');\n"],"mappings":"olBAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;;AAEA,IAAAG,mCAAA,GAAAH,OAAA;;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;;AAEA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;;AAEA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,6BAAA,GAAAV,OAAA;;AAEA,IAAAW,UAAA,GAAAX,OAAA,sBAA2C,IAAAY,SAAA,4MAAAC,MAAA,EAAAC,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAM0K,UAAU,GAAAvK,OAAA,CAAAuK,UAAA,GAAG,IAAAC,yBAAkB,EAAC,UAAU,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_propTypes","_globalObject","_scrollYCenterIntoNearestScrollable","_utils","_ThemeContext","_CommonWrapper","_Emotion","_rootNode","_MenuContext","_getVisualStateDataAttributes","_MenuItem2","_excluded","_class","_MenuItem","MenuItemDataTids","exports","root","content","comment","MenuItem","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","state","iconOffsetTop","highlighted","mouseEntered","rootRef","contentRef","React","createRef","highlight","setState","unhighlight","select","event","handleClick","isEnabled","props","disabled","navigate","href","target","window","open","location","renderMain","_cx2","_cx3","_cx4","_this$props","link","icon","loose","size","_enableIconPadding","component","onMouseEnter","onMouseLeave","isMobile","scrollIntoView","_this$props$rel","rel","isExternalLink","isNotSelectable","children","unusedClasses","className","style","dataTid","rest","_objectWithoutPropertiesLoose2","default","iconElement","_cx","createElement","top","cx","styles","getIconSizeClassName","theme","getRootSizeClassName","rootMobile","hover","isHover","selected","isSelected","getWithIconSizeClassName","Boolean","context","enableIconPadding","isFunction","Component","getComponent","CommonWrapper","_extends2","rootNodeRef","setRootNode","getVisualStateDataAttributes","ref","setRootRef","activeState","onMouseOver","handleMouseEnterFix","handleMouseLeave","onClick","undefined","tabIndex","mobileContentWithIcon","isNonNullable","commentHover","e","_this$context$navigat","navigation","_this$context$navigat2","onItemClick","element","_this$props2","hasIconAmongItems","_this$context$navigat3","items","some","item","_inheritsLoose2","_proto","prototype","render","_this2","ThemeContext","Consumer","componentDidMount","scrollYCenterIntoNearestScrollable","isBrowser","globalObject","getComputedStyle","getPropertyValue","current","_this$context$navigat4","add","_this$context$setEnab","_this$context","setEnableIconPadding","componentWillUnmount","_this$context$navigat5","_this$context$setEnab2","_this$context2","remove","componentDidUpdate","prevProps","_this$context$setEnab3","_this$context3","_this$context$navigat6","_this$context$navigat7","rootLarge","rootMedium","rootSmall","iconLarge","iconMedium","iconSmall","withIconLarge","withIconMedium","withIconSmall","_createClass2","key","get","__KONTUR_REACT_UI__","displayName","__MENU_ITEM__","propTypes","PropTypes","node","bool","string","func","contextType","MenuContext","isMenuItem","isReactUIComponent"],"sources":["MenuItem.tsx"],"sourcesContent":["import React, { AriaAttributes, HTMLAttributes } from 'react';\nimport PropTypes from 'prop-types';\nimport { globalObject, isBrowser } from '@skbkontur/global-object';\n\nimport { scrollYCenterIntoNearestScrollable } from '../../lib/dom/scrollYCenterIntoNearestScrollable';\nimport { Nullable } from '../../typings/utility-types';\nimport { isExternalLink, isFunction, isNonNullable, isReactUIComponent } from '../../lib/utils';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { SizeProp } from '../../lib/types/props';\nimport { MenuContext, MenuContextType } from '../../internal/Menu/MenuContext';\nimport { getVisualStateDataAttributes } from '../../internal/CommonWrapper/utils/getVisualStateDataAttributes';\n\nimport { styles } from './MenuItem.styles';\n\nexport type MenuItemState = null | 'hover' | 'selected' | void;\n\nexport interface MenuItemProps\n extends Pick<AriaAttributes, 'aria-describedby' | 'aria-label'>,\n Pick<HTMLAttributes<HTMLElement>, 'id'>,\n Omit<CommonProps, 'children'> {\n /**\n * @ignore\n */\n _enableIconPadding?: boolean;\n /**\n * Добавляет описание для элемента меню.\n */\n comment?: React.ReactNode;\n /**\n * Отключенное состояние.\n */\n disabled?: boolean;\n /**\n * Добавляет элементу меню иконку.\n */\n icon?: React.ReactElement<any>;\n /**\n * Меняет цвет текста на синий.\n */\n link?: boolean;\n /**\n * Размер\n */\n size?: SizeProp;\n /**\n * @ignore\n */\n loose?: boolean;\n /**\n * @ignore\n */\n state?: MenuItemState;\n /**\n * HTML-событие `onclick`.\n */\n onClick?: (event: React.SyntheticEvent<HTMLElement>) => void;\n /**\n * HTML-событие `mouseenter`.\n */\n onMouseEnter?: React.MouseEventHandler;\n /**\n * HTML-событие `mouseleave`.\n */\n onMouseLeave?: React.MouseEventHandler;\n children?: React.ReactNode | ((state: MenuItemState) => React.ReactNode);\n /**\n * HTML-атрибут `target`.\n */\n target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];\n /**\n * HTML-атрибут `title`.\n */\n title?: React.AnchorHTMLAttributes<HTMLAnchorElement>['title'];\n /**\n * HTML-атрибут `href`.\n */\n href?: React.AnchorHTMLAttributes<HTMLAnchorElement>['href'];\n /**\n * HTML-атрибут `rel`.\n *\n * Для внешних ссылок аттрибут rel по умолчанию равен \"noopener noreferrer\"\n */\n rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];\n /**\n * Заменяет корневой элемент, на компонент переданный в проп.\n *\n * По умолчанию корневой элемент рендерится как `button`. <br />Если передан `href`, то вместо `button` рендерится `a`.\n */\n component?: React.ComponentType<any>;\n /**\n * Запрещает выделение и выбор данного пункта меню\n *\n */\n isNotSelectable?: boolean;\n\n isMobile?: boolean;\n /** @ignore */\n scrollIntoView?: boolean;\n}\n\nexport const MenuItemDataTids = {\n root: 'MenuItem__root',\n content: 'MenuItem__content',\n comment: 'MenuItem__comment',\n} as const;\n\n/**\n *\n * `MenuItem` - это вложенный компонент, задающий базовые стили для элемента меню и позволяющий навигироваться по элементам меню с помощью клавиатуры.\n *\n * Сущности в которых может быть использован `MenuItem`: [DropdownMenu](#/Components/DropdownMenu), [Kebab](#/Components/Kebab), [TooltipMenu](#/Components/TooltipMenu) и [Select](#/Components/Select).\n */\n@rootNode\nexport class MenuItem extends React.Component<MenuItemProps> {\n public static __KONTUR_REACT_UI__ = 'MenuItem';\n public static displayName = 'MenuItem';\n public static __MENU_ITEM__ = true;\n\n public static propTypes = {\n comment: PropTypes.node,\n\n disabled: PropTypes.bool,\n\n href: PropTypes.string,\n\n icon: PropTypes.node,\n\n loose: PropTypes.bool,\n\n state: PropTypes.string,\n\n target: PropTypes.string,\n\n onClick: PropTypes.func,\n\n size: PropTypes.string,\n };\n\n public state = {\n iconOffsetTop: 0,\n highlighted: false,\n };\n\n private theme!: Theme;\n private mouseEntered = false;\n private setRootNode!: TSetRootNode;\n private rootRef: Nullable<HTMLElement> = null;\n private contentRef = React.createRef<HTMLElement>();\n static contextType = MenuContext;\n\n public context!: MenuContextType;\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public componentDidMount() {\n if (this.props.scrollIntoView && this.rootRef) {\n scrollYCenterIntoNearestScrollable(this.rootRef);\n }\n if (this.rootRef && isBrowser(globalObject)) {\n this.setState({ iconOffsetTop: globalObject.getComputedStyle(this.rootRef).getPropertyValue('padding-top') });\n }\n if (this.contentRef.current && !this.props.isNotSelectable) {\n this.context.navigation?.add(this.contentRef.current, this);\n }\n if (this.props.icon) {\n this.context.setEnableIconPadding?.(true);\n }\n }\n\n public componentWillUnmount() {\n if (this.contentRef.current) {\n !this.props.isNotSelectable && this.context.navigation?.remove(this.contentRef.current);\n this.context.setEnableIconPadding?.(this.hasIconAmongItems());\n }\n }\n\n public componentDidUpdate(prevProps: Readonly<MenuItemProps>) {\n if (prevProps.icon !== this.props.icon) {\n this.context.setEnableIconPadding?.(!!this.props.icon || this.hasIconAmongItems());\n }\n if (this.contentRef.current && prevProps.isNotSelectable !== this.props.isNotSelectable) {\n if (this.props.isNotSelectable) {\n this.unhighlight();\n this.context.navigation?.remove(this.contentRef.current);\n } else {\n this.context.navigation?.add(this.contentRef.current, this);\n }\n }\n }\n\n public highlight = () => {\n this.setState({ highlighted: true });\n };\n\n public unhighlight = () => {\n this.setState({ highlighted: false });\n };\n\n public select = (event: React.SyntheticEvent<HTMLElement>) => {\n this.handleClick(event as React.MouseEvent<HTMLElement>);\n };\n\n public isEnabled = () => {\n return !this.props.disabled;\n };\n\n public navigate = () => {\n if (!this.props.href) {\n return;\n }\n if (this.props.target) {\n window.open(this.props.href, this.props.target);\n } else {\n location.href = this.props.href;\n }\n };\n\n private getRootSizeClassName() {\n switch (this.props.size) {\n case 'large':\n return styles.rootLarge(this.theme);\n case 'medium':\n return styles.rootMedium(this.theme);\n case 'small':\n default:\n return styles.rootSmall(this.theme);\n }\n }\n\n private getIconSizeClassName() {\n switch (this.props.size) {\n case 'large':\n return styles.iconLarge(this.theme);\n case 'medium':\n return styles.iconMedium(this.theme);\n case 'small':\n default:\n return styles.iconSmall(this.theme);\n }\n }\n\n private getWithIconSizeClassName() {\n switch (this.props.size) {\n case 'large':\n return styles.withIconLarge(this.theme);\n case 'medium':\n return styles.withIconMedium(this.theme);\n case 'small':\n default:\n return styles.withIconSmall(this.theme);\n }\n }\n\n private renderMain = () => {\n const {\n link,\n comment,\n icon,\n loose,\n state,\n size,\n _enableIconPadding,\n component,\n onMouseEnter,\n onMouseLeave,\n isMobile,\n href,\n disabled,\n scrollIntoView,\n rel = href && isExternalLink(href) ? 'noopener noreferrer' : this.props.rel,\n isNotSelectable,\n children,\n className: unusedClasses,\n style,\n 'data-tid': dataTid,\n ...rest\n } = this.props;\n\n let iconElement = null;\n if (icon) {\n iconElement = (\n <div\n style={{ top: this.state.iconOffsetTop }}\n className={cx({\n [styles.icon()]: true,\n [this.getIconSizeClassName()]: true,\n })}\n >\n {icon}\n </div>\n );\n }\n\n const className = cx({\n [styles.root(this.theme)]: true,\n [this.getRootSizeClassName()]: true,\n [styles.rootMobile(this.theme)]: isMobile,\n [styles.loose()]: !!loose,\n [styles.hover(this.theme)]: this.isHover,\n [styles.selected(this.theme)]: this.isSelected,\n [styles.link(this.theme)]: !!link,\n [this.getWithIconSizeClassName()]: Boolean(iconElement) || !!_enableIconPadding || this.context.enableIconPadding,\n [styles.disabled(this.theme)]: !!disabled,\n });\n\n let content = children;\n if (isFunction(children)) {\n content = children(state);\n }\n\n const Component = this.getComponent();\n\n return (\n <CommonWrapper\n rootNodeRef={this.setRootNode}\n {...getVisualStateDataAttributes({\n hover: this.isHover,\n selected: this.isSelected,\n })}\n {...this.props}\n >\n <Component\n ref={this.setRootRef}\n data-tid={MenuItemDataTids.root}\n {...rest}\n disabled={disabled}\n state={this.activeState}\n onMouseOver={this.handleMouseEnterFix}\n onMouseLeave={this.handleMouseLeave}\n onClick={this.handleClick}\n className={className}\n href={href}\n rel={href ? rel : undefined}\n tabIndex={-1}\n >\n {iconElement}\n <span\n className={cx({\n [styles.mobileContentWithIcon()]: isMobile && isNonNullable(icon),\n })}\n ref={this.contentRef}\n data-tid={MenuItemDataTids.content}\n >\n {typeof content === 'function' ? content() : content}\n </span>\n {comment && (\n <div\n data-tid={MenuItemDataTids.comment}\n className={cx({\n [styles.comment(this.theme)]: true,\n [styles.commentHover(this.theme)]: this.isHover,\n })}\n >\n {comment}\n </div>\n )}\n </Component>\n </CommonWrapper>\n );\n };\n\n private get activeState() {\n return this.state.highlighted ? 'hover' : this.props.state;\n }\n\n private get isHover(): boolean {\n return (this.state.highlighted || this.props.state === 'hover') && !this.props.disabled;\n }\n\n private get isSelected(): boolean {\n return this.props.state === 'selected' && !this.state.highlighted;\n }\n\n // https://github.com/facebook/react/issues/10109\n // Mouseenter event not triggered when cursor moves from disabled button\n private handleMouseEnterFix = (e: React.MouseEvent<HTMLElement>) => {\n if (!this.mouseEntered) {\n this.mouseEntered = true;\n this.props.onMouseEnter?.(e);\n !this.props.isNotSelectable && this.context.navigation?.highlight(this);\n }\n };\n\n private handleMouseLeave = (e: React.MouseEvent<HTMLElement>) => {\n this.mouseEntered = false;\n this.props.onMouseLeave?.(e);\n !this.props.isNotSelectable && this.context.navigation?.unhighlight();\n };\n\n private handleClick = (e: React.MouseEvent<HTMLElement>) => {\n if (this.props.isNotSelectable) {\n return;\n }\n this.props.onClick?.(e);\n this.context.onItemClick?.(e);\n };\n\n private setRootRef = (element: HTMLElement) => {\n this.rootRef = element;\n };\n\n private getComponent = () => {\n const { disabled, component, href } = this.props;\n\n if (component) {\n return component;\n }\n\n if (disabled) {\n return 'button';\n }\n\n if (href) {\n return 'a';\n }\n\n return 'button';\n };\n\n private hasIconAmongItems = () => {\n return Boolean(this.context.navigation?.items.some((item) => item.props.icon));\n };\n}\n\nexport const isMenuItem = isReactUIComponent('MenuItem');\n"],"mappings":"olBAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;;AAEA,IAAAG,mCAAA,GAAAH,OAAA;;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;;AAEA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;;AAEA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,6BAAA,GAAAV,OAAA;;AAEA,IAAAW,UAAA,GAAAX,OAAA,sBAA2C,IAAAY,SAAA,0PAAAC,MAAA,EAAAC,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFpC,IAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EAC9BE,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAE,mBAAmB;EAC5BC,OAAO,EAAE;AACX,CAAU;;AAEV;AACA;AACA;AACA;AACA;AACA,GALA;;AAOaC,QAAQ,GAAAJ,OAAA,CAAAI,QAAA,OADpBC,kBAAQ,EAAAR,MAAA,IAAAC,SAAA,0BAAAQ,gBAAA,YAAAF,SAAA,OAAAG,KAAA,UAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA,KAAAF,I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IAAI,CAACA,KAAK,CAACE,WAAW,CACnE,CAAC,OA3Q2BI,cAAK,CAAC+D,SAAS,GAAAxF,SAAA,CAC7BiK,mBAAmB,GAAG,UAAU,EAAAjK,SAAA,CAChCkK,WAAW,GAAG,UAAU,EAAAlK,SAAA,CACxBmK,aAAa,GAAG,IAAI,EAAAnK,SAAA,CAEpBoK,SAAS,GAAG,EACxB/J,OAAO,EAAEgK,kBAAS,CAACC,IAAI,EAEvBnI,QAAQ,EAAEkI,kBAAS,CAACE,IAAI,EAExBlI,IAAI,EAAEgI,kBAAS,CAACG,MAAM,EAEtBxH,IAAI,EAAEqH,kBAAS,CAACC,IAAI,EAEpBrH,KAAK,EAAEoH,kBAAS,CAACE,IAAI,EAErBpJ,KAAK,EAAEkJ,kBAAS,CAACG,MAAM,EAEvBlI,MAAM,EAAE+H,kBAAS,CAACG,MAAM,EAExBnE,OAAO,EAAEgE,kBAAS,CAACI,IAAI,EAEvBvH,IAAI,EAAEmH,kBAAS,CAACG,MAAM,CACxB,CAAC,EAAAxK,SAAA,CAYM0K,WAAW,GAAGC,wBAAW,EAAA3K,SAAA,MAAAD,MAAA;;;AA6R3B,IAAM6K,UAAU,GAAA1K,OAAA,CAAA0K,UAAA,GAAG,IAAAC,yBAAkB,EAAC,UAAU,CAAC","ignoreList":[]}
|
|
@@ -238,6 +238,6 @@ PasswordInput = exports.PasswordInput = (_dec = (0, _decorators.locale)('Passwor
|
|
|
238
238
|
};return _this;}(0, _inheritsLoose2.default)(PasswordInput, _React$PureComponent);var _proto = PasswordInput.prototype;_proto.componentDidMount = function componentDidMount() {if (this.props.detectCapsLock) {this.setState({ capsLockEnabled: null });} // @ts-expect-error: IE-specific API.
|
|
239
239
|
if (_client.isIE11 && (0, _globalObject.isBrowser)(_globalObject.globalObject) && !_globalObject.globalObject.document.msCapsLockWarningOff) {// @ts-expect-error: Read the comment above.
|
|
240
240
|
// turns off default ie capslock warning
|
|
241
|
-
_globalObject.globalObject.document.msCapsLockWarningOff = true;}};PasswordInput.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {if (props.disabled) {return { visible: false };}return state;};_proto.render = function render() {var _this3 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this3.theme = theme;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: _this3.setRootNode }, _this3.
|
|
241
|
+
_globalObject.globalObject.document.msCapsLockWarningOff = true;}};PasswordInput.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {if (props.disabled) {return { visible: false };}return state;};_proto.render = function render() {var _this3 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this3.theme = theme;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: _this3.setRootNode }, _this3.getProps()), _this3.renderMain);});};_proto.getEyeWrapperClassname = function getEyeWrapperClassname() {switch (this.getProps().size) {case 'large':return _PasswordInput2.styles.eyeWrapperLarge(this.theme);case 'medium':return _PasswordInput2.styles.eyeWrapperMedium(this.theme);case 'small':default:return _PasswordInput2.styles.eyeWrapperSmall(this.theme);}};return PasswordInput;}(_react.default.PureComponent), _PasswordInput.__KONTUR_REACT_UI__ = 'PasswordInput', _PasswordInput.displayName = 'PasswordInput', _PasswordInput.propTypes = { /**
|
|
242
242
|
* Включает CapsLock детектор
|
|
243
243
|
*/detectCapsLock: _propTypes.default.bool }, _PasswordInput.defaultProps = { size: 'small' }, _PasswordInput)) || _class) || _class);
|