@skbkontur/react-ui 5.4.0 → 5.4.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 +24 -0
- package/cjs/components/Autocomplete/Autocomplete.d.ts +10 -2
- package/cjs/components/Autocomplete/Autocomplete.js +18 -2
- package/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/cjs/components/Button/Button.d.ts +23 -13
- package/cjs/components/Button/Button.js +13 -3
- package/cjs/components/Button/Button.js.map +1 -1
- package/cjs/components/CurrencyInput/CurrencyInput.d.ts +11 -22
- package/cjs/components/CurrencyInput/CurrencyInput.js +10 -17
- package/cjs/components/CurrencyInput/CurrencyInput.js.map +1 -1
- package/cjs/components/FxInput/FxInput.d.ts +23 -16
- package/cjs/components/FxInput/FxInput.js +142 -65
- package/cjs/components/FxInput/FxInput.js.map +1 -1
- package/cjs/components/Input/Input.d.ts +27 -37
- package/cjs/components/Input/Input.js +9 -19
- package/cjs/components/Input/Input.js.map +1 -1
- package/cjs/components/Link/Link.d.ts +10 -10
- package/cjs/components/Link/Link.js +1 -1
- package/cjs/components/Link/Link.js.map +1 -1
- package/cjs/components/MaskedInput/ColorableInputElement/ColorableInputElement.d.ts +1 -0
- package/cjs/components/MaskedInput/ColorableInputElement/ColorableInputElement.js +107 -78
- package/cjs/components/MaskedInput/ColorableInputElement/ColorableInputElement.js.map +1 -1
- package/cjs/components/MaskedInput/MaskedInput.js +5 -3
- package/cjs/components/MaskedInput/MaskedInput.js.map +1 -1
- package/cjs/components/PasswordInput/PasswordInput.d.ts +5 -6
- package/cjs/components/PasswordInput/PasswordInput.js +4 -5
- package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
- package/cjs/components/__stories__/Form.js +95 -0
- package/cjs/components/__stories__/Form.js.map +1 -0
- package/cjs/internal/CommonWrapper/types.d.ts +1 -1
- package/cjs/internal/CommonWrapper/types.js.map +1 -1
- package/cjs/lib/featureFlagsContext/FeatureFlagsHelpers.d.ts +1 -0
- package/cjs/lib/featureFlagsContext/ReactUIFeatureFlagsContext.d.ts +1 -0
- package/cjs/lib/featureFlagsContext/ReactUIFeatureFlagsContext.js +2 -0
- package/cjs/lib/featureFlagsContext/ReactUIFeatureFlagsContext.js.map +1 -1
- package/cjs/lib/utils.d.ts +5 -1
- package/cjs/lib/utils.js +20 -4
- package/cjs/lib/utils.js.map +1 -1
- package/cjs/test-setup.d.ts +1 -0
- package/cjs/vitest.config.d.ts +2 -0
- package/components/Autocomplete/Autocomplete/Autocomplete.js +10 -2
- package/components/Autocomplete/Autocomplete/Autocomplete.js.map +1 -1
- package/components/Autocomplete/Autocomplete.d.ts +10 -2
- package/components/Button/Button/Button.js +4 -2
- package/components/Button/Button/Button.js.map +1 -1
- package/components/Button/Button.d.ts +23 -13
- package/components/CurrencyInput/CurrencyInput/CurrencyInput.js +6 -17
- package/components/CurrencyInput/CurrencyInput/CurrencyInput.js.map +1 -1
- package/components/CurrencyInput/CurrencyInput.d.ts +11 -22
- package/components/FxInput/FxInput/FxInput.js +122 -71
- package/components/FxInput/FxInput/FxInput.js.map +1 -1
- package/components/FxInput/FxInput.d.ts +23 -16
- package/components/Input/Input/Input.js +8 -16
- package/components/Input/Input/Input.js.map +1 -1
- package/components/Input/Input.d.ts +27 -37
- package/components/Link/Link/Link.js +1 -1
- package/components/Link/Link/Link.js.map +1 -1
- package/components/Link/Link.d.ts +10 -10
- package/components/MaskedInput/ColorableInputElement/ColorableInputElement/ColorableInputElement.js +81 -66
- package/components/MaskedInput/ColorableInputElement/ColorableInputElement/ColorableInputElement.js.map +1 -1
- package/components/MaskedInput/ColorableInputElement/ColorableInputElement.d.ts +1 -0
- package/components/MaskedInput/MaskedInput/MaskedInput.js +4 -2
- package/components/MaskedInput/MaskedInput/MaskedInput.js.map +1 -1
- package/components/PasswordInput/PasswordInput/PasswordInput.js +4 -5
- package/components/PasswordInput/PasswordInput/PasswordInput.js.map +1 -1
- package/components/PasswordInput/PasswordInput.d.ts +5 -6
- package/components/__stories__/Form/Form.js +98 -0
- package/components/__stories__/Form/Form.js.map +1 -0
- package/components/__stories__/Form/package.json +6 -0
- package/internal/CommonWrapper/types/types.js.map +1 -1
- package/internal/CommonWrapper/types.d.ts +1 -1
- package/lib/featureFlagsContext/FeatureFlagsHelpers.d.ts +1 -0
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext/ReactUIFeatureFlagsContext.js +1 -0
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext/ReactUIFeatureFlagsContext.js.map +1 -1
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext.d.ts +1 -0
- package/lib/utils/utils.js +18 -2
- package/lib/utils/utils.js.map +1 -1
- package/lib/utils.d.ts +5 -1
- package/package.json +8 -14
- package/test-setup.d.ts +1 -0
- package/vitest.config.d.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_globalObject","_decorators","_RenderLayer","_utils","_identifiers","_KeyboardEventCodes","_Input","_client","_CommonWrapper","_ThemeContext","_Emotion","_rootNode","_SizeDecorator","_createPropsGetter","_PasswordInput2","_PasswordInputIcon","_locale","_dec","_class","_PasswordInput","PasswordInputDataTids","exports","root","capsLockDetector","eyeIcon","PasswordInput","locale","PasswordInputLocaleHelper","rootNode","withSize","_React$PureComponent","_this","_len","arguments","length","args","Array","_key","call","apply","concat","state","visible","focused","capsLockEnabled","getProps","createPropsGetter","focus","input","blur","handleKeyPress","e","_this$props","props","onKeyPress","detectCapsLock","getModifierState","Codes","CapsLock","setState","handleKeydown","_this2","_this2$props","onKeyDown","isKeyCapsLock","isNonNullable","handleToggleVisibility","prevState","focusOnInput","handleFocus","event","onFocus","handleFocusOutside","hideSymbols","renderEye","default","createElement","className","styles","iconWrapper","cx","toggleVisibility","theme","getEyeWrapperClassname","disabled","type","eyeClosedAriaLabel","eyeOpenedAriaLabel","onClick","icon","PasswordInputIcon","size","refInput","element","renderMain","RenderLayer","active","onFocusOutside","onClickOutside","Input","_extends2","ref","rightIcon","_inheritsLoose2","_proto","prototype","componentDidMount","isIE11","isBrowser","globalObject","document","msCapsLockWarningOff","getDerivedStateFromProps","render","_this3","ThemeContext","Consumer","CommonWrapper","rootNodeRef","setRootNode","eyeWrapperLarge","eyeWrapperMedium","eyeWrapperSmall","React","PureComponent","__KONTUR_REACT_UI__","displayName"],"sources":["PasswordInput.tsx"],"sourcesContent":["import type { AriaAttributes } from 'react';\nimport React from 'react';\nimport { globalObject, isBrowser } from '@skbkontur/global-object';\n\nimport { locale } from '../../lib/locale/decorators';\nimport { RenderLayer } from '../../internal/RenderLayer';\nimport { isNonNullable } from '../../lib/utils';\nimport { isKeyCapsLock } from '../../lib/events/keyboard/identifiers';\nimport { KeyboardEventCodes as Codes } from '../../lib/events/keyboard/KeyboardEventCodes';\nimport type { InputProps } from '../Input';\nimport { Input } from '../Input';\nimport type { Nullable } from '../../typings/utility-types';\nimport { isIE11 } from '../../lib/client';\nimport type { CommonProps, CommonWrapperRestProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport type { Theme } from '../../lib/theming/Theme';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { cx } from '../../lib/theming/Emotion';\nimport type { TGetRootNode, TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport { withSize } from '../../lib/size/SizeDecorator';\nimport type { SizeProp } from '../../lib/types/props';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { styles } from './PasswordInput.styles';\nimport { PasswordInputIcon } from './PasswordInputIcon';\nimport type { PasswordInputLocale } from './locale';\nimport { PasswordInputLocaleHelper } from './locale';\n\nexport interface PasswordInputProps\n extends Pick<AriaAttributes, 'aria-label'>,\n CommonProps,\n Omit<InputProps, 'showClearIcon'> {\n /** Включает CapsLock детектор. */\n detectCapsLock?: boolean;\n}\n\nexport interface PasswordInputState {\n visible: boolean;\n focused: boolean;\n capsLockEnabled?: boolean | null;\n}\n\nexport const PasswordInputDataTids = {\n root: 'PasswordInput',\n capsLockDetector: 'PasswordInputCapsLockDetector',\n eyeIcon: 'PasswordInputEyeIcon',\n} as const;\n\n/**\n * `PasswordInput` — однострочное поле для ввода пароля, в котором символы заменяются на точки.\n *\n * Не используйте такое поле для ввода одноразовых кодов из смс. У них короткий срок действия и используются они только один раз.\n */\n\n@rootNode\n@locale('PasswordInput', PasswordInputLocaleHelper)\n@withSize\nexport class PasswordInput extends React.PureComponent<PasswordInputProps, PasswordInputState> {\n public static __KONTUR_REACT_UI__ = 'PasswordInput';\n public static displayName = 'PasswordInput';\n\n public state: PasswordInputState = {\n visible: false,\n focused: false,\n capsLockEnabled: false,\n };\n private size!: SizeProp;\n\n private theme!: Theme;\n\n private input: Nullable<Input>;\n public getRootNode!: TGetRootNode;\n private setRootNode!: TSetRootNode;\n private readonly locale!: PasswordInputLocale;\n\n private getProps = createPropsGetter({});\n\n public componentDidMount() {\n if (this.props.detectCapsLock) {\n this.setState({ capsLockEnabled: null });\n }\n\n // @ts-expect-error: IE-specific API.\n if (isIE11 && isBrowser(globalObject) && !globalObject.document.msCapsLockWarningOff) {\n // @ts-expect-error: Read the comment above.\n // turns off default ie capslock warning\n globalObject.document.msCapsLockWarningOff = true;\n }\n }\n\n public static getDerivedStateFromProps(props: PasswordInputProps, state: PasswordInputState) {\n if (props.disabled) {\n return { visible: false };\n }\n\n return state;\n }\n\n public render(): JSX.Element {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.getProps()}>\n {this.renderMain}\n </CommonWrapper>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n /**\n * @public\n */\n public focus = () => {\n if (this.input) {\n this.input.focus();\n }\n };\n\n /**\n * @public\n */\n public blur = () => {\n if (this.input) {\n this.input.blur();\n }\n };\n\n private handleKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {\n const { onKeyPress, detectCapsLock } = this.props;\n\n if (onKeyPress) {\n onKeyPress(e);\n }\n\n if (!detectCapsLock) {\n return;\n }\n\n const capsLockEnabled = e.getModifierState(Codes.CapsLock);\n\n this.setState({ capsLockEnabled });\n };\n\n private handleKeydown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n const {\n props: { detectCapsLock, onKeyDown },\n state: { capsLockEnabled },\n } = this;\n\n if (onKeyDown) {\n onKeyDown(e);\n }\n\n if (!detectCapsLock) {\n return;\n }\n\n if (isKeyCapsLock(e) && isNonNullable(capsLockEnabled)) {\n this.setState({ capsLockEnabled: !capsLockEnabled });\n }\n };\n\n private handleToggleVisibility = () => {\n this.setState((prevState) => ({ visible: !prevState.visible }), this.focusOnInput);\n };\n\n private focusOnInput = () => {\n if (this.input) {\n this.input.focus();\n }\n };\n\n private handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n if (this.state.focused) {\n return;\n }\n\n this.setState({ focused: true });\n\n if (this.props.onFocus) {\n this.props.onFocus(event);\n }\n };\n\n private handleFocusOutside = () => {\n this.hideSymbols();\n\n if (this.state.focused) {\n this.setState({ focused: false });\n }\n };\n\n private getEyeWrapperClassname() {\n switch (this.size) {\n case 'large':\n return styles.eyeWrapperLarge(this.theme);\n case 'medium':\n return styles.eyeWrapperMedium(this.theme);\n case 'small':\n default:\n return styles.eyeWrapperSmall(this.theme);\n }\n }\n\n private renderEye = () => {\n const { capsLockEnabled } = this.state;\n\n return (\n <span className={styles.iconWrapper()}>\n {capsLockEnabled && (\n <span className={styles.capsLockDetector()} data-tid={PasswordInputDataTids.capsLockDetector} />\n )}\n <span className={cx(styles.toggleVisibility(this.theme), this.getEyeWrapperClassname())}>\n {!this.props.disabled && (\n <button\n type=\"button\"\n aria-label={this.state.visible ? this.locale.eyeClosedAriaLabel : this.locale.eyeOpenedAriaLabel}\n onClick={this.handleToggleVisibility}\n className={styles.icon()}\n data-tid={PasswordInputDataTids.eyeIcon}\n >\n <PasswordInputIcon size={this.size} visible={this.state.visible} />\n </button>\n )}\n </span>\n </span>\n );\n };\n\n private refInput = (element: Input) => {\n this.input = element;\n };\n\n private hideSymbols = () => {\n this.setState({ visible: false });\n };\n\n private renderMain = (props: CommonWrapperRestProps<PasswordInputProps>) => {\n return (\n <RenderLayer\n active={this.state.focused}\n onFocusOutside={this.handleFocusOutside}\n onClickOutside={this.handleFocusOutside}\n >\n <div data-tid={PasswordInputDataTids.root} className={styles.root()}>\n <Input\n ref={this.refInput}\n type={this.state.visible ? 'text' : 'password'}\n onKeyDown={this.handleKeydown}\n onKeyPress={this.handleKeyPress}\n rightIcon={this.renderEye()}\n onFocus={this.handleFocus}\n {...props}\n />\n </div>\n </RenderLayer>\n );\n };\n}\n"],"mappings":";AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;;AAEA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;;AAEA,IAAAO,MAAA,GAAAP,OAAA;;AAEA,IAAAQ,OAAA,GAAAR,OAAA;;AAEA,IAAAS,cAAA,GAAAT,OAAA;;AAEA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAX,OAAA;;AAEA,IAAAY,SAAA,GAAAZ,OAAA;AACA,IAAAa,cAAA,GAAAb,OAAA;;AAEA,IAAAc,kBAAA,GAAAd,OAAA;;AAEA,IAAAe,eAAA,GAAAf,OAAA;AACA,IAAAgB,kBAAA,GAAAhB,OAAA;;AAEA,IAAAiB,OAAA,GAAAjB,OAAA,aAAqD,IAAAkB,IAAA,EAAAC,MAAA,EAAAC,cAAA;;;;;;;;;;;;;;;;AAgB9C,IAAMC,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EACnCE,IAAI,EAAE,eAAe;EACrBC,gBAAgB,EAAE,+BAA+B;E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OAAA,EAA6B,KAAAC,MAAA,QAC3B,oBACErH,MAAA,CAAA8E,OAAA,CAAAC,aAAA,CAACnE,aAAA,CAAA0G,YAAY,CAACC,QAAQ,QACnB,UAAClC,KAAK,EAAK,CACVgC,MAAI,CAAChC,KAAK,GAAGA,KAAK,CAClB,oBACErF,MAAA,CAAA8E,OAAA,CAAAC,aAAA,CAACpE,cAAA,CAAA6G,aAAa,MAAAjB,SAAA,CAAAzB,OAAA,IAAC2C,WAAW,EAAEJ,MAAI,CAACK,WAAY,IAAKL,MAAI,CAACrE,QAAQ,CAAC,CAAC,GAC9DqE,MAAI,CAACpB,UACO,CAAC,CAEpB,CACqB,CAAC,CAE5B,CAAC,CAAAU,MAAA,CAqFOrB,sBAAsB,GAA9B,SAAAA,uBAAA,EAAiC,CAC/B,QAAQ,IAAI,CAACQ,IAAI,GACf,KAAK,OAAO,CACV,OAAOb,sBAAM,CAAC0C,eAAe,CAAC,IAAI,CAACtC,KAAK,CAAC,CAC3C,KAAK,QAAQ,CACX,OAAOJ,sBAAM,CAAC2C,gBAAgB,CAAC,IAAI,CAACvC,KAAK,CAAC,CAC5C,KAAK,OAAO,CACZ,QACE,OAAOJ,sBAAM,CAAC4C,eAAe,CAAC,IAAI,CAACxC,KAAK,CAAC,CAC7C,CACF,CAAC,QAAAzD,aAAA,GArJgCkG,cAAK,CAACC,aAAa,GAAAzG,cAAA,CACtC0G,mBAAmB,GAAG,eAAe,EAAA1G,cAAA,CACrC2G,WAAW,GAAG,eAAe,EAAA3G,cAAA,MAAAD,MAAA,KAAAA,MAAA,KAAAA,MAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_globalObject","_decorators","_RenderLayer","_utils","_identifiers","_KeyboardEventCodes","_Input","_client","_CommonWrapper","_ThemeContext","_Emotion","_rootNode","_SizeDecorator","_createPropsGetter","_PasswordInput2","_PasswordInputIcon","_locale","_dec","_class","_PasswordInput","PasswordInputDataTids","exports","root","capsLockDetector","eyeIcon","PasswordInput","locale","PasswordInputLocaleHelper","rootNode","withSize","_React$PureComponent","_this","_len","arguments","length","args","Array","_key","call","apply","concat","state","visible","focused","capsLockEnabled","getProps","createPropsGetter","focus","input","blur","handleKeyPress","e","_this$props","props","onKeyPress","detectCapsLock","getModifierState","Codes","CapsLock","setState","handleKeydown","_this2","_this2$props","onKeyDown","isKeyCapsLock","isNonNullable","handleToggleVisibility","prevState","focusOnInput","handleFocus","event","onFocus","handleFocusOutside","hideSymbols","renderEye","default","createElement","className","styles","iconWrapper","cx","toggleVisibility","theme","getEyeWrapperClassname","disabled","type","eyeClosedAriaLabel","eyeOpenedAriaLabel","onClick","icon","PasswordInputIcon","size","refInput","element","renderMain","RenderLayer","active","onFocusOutside","onClickOutside","Input","_extends2","ref","rightIcon","_inheritsLoose2","_proto","prototype","componentDidMount","isIE11","isBrowser","globalObject","document","msCapsLockWarningOff","getDerivedStateFromProps","render","_this3","ThemeContext","Consumer","CommonWrapper","rootNodeRef","setRootNode","eyeWrapperLarge","eyeWrapperMedium","eyeWrapperSmall","React","PureComponent","__KONTUR_REACT_UI__","displayName"],"sources":["PasswordInput.tsx"],"sourcesContent":["import type { AriaAttributes } from 'react';\nimport React from 'react';\nimport { globalObject, isBrowser } from '@skbkontur/global-object';\n\nimport { locale } from '../../lib/locale/decorators';\nimport { RenderLayer } from '../../internal/RenderLayer';\nimport { isNonNullable } from '../../lib/utils';\nimport { isKeyCapsLock } from '../../lib/events/keyboard/identifiers';\nimport { KeyboardEventCodes as Codes } from '../../lib/events/keyboard/KeyboardEventCodes';\nimport type { InputProps } from '../Input';\nimport { Input } from '../Input';\nimport type { Nullable } from '../../typings/utility-types';\nimport { isIE11 } from '../../lib/client';\nimport type { CommonProps, CommonWrapperRestProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport type { Theme } from '../../lib/theming/Theme';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { cx } from '../../lib/theming/Emotion';\nimport type { TGetRootNode, TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport { withSize } from '../../lib/size/SizeDecorator';\nimport type { SizeProp } from '../../lib/types/props';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { styles } from './PasswordInput.styles';\nimport { PasswordInputIcon } from './PasswordInputIcon';\nimport type { PasswordInputLocale } from './locale';\nimport { PasswordInputLocaleHelper } from './locale';\n\nexport interface PasswordInputProps\n extends Pick<AriaAttributes, 'aria-label'>,\n CommonProps,\n Omit<InputProps, 'showClearIcon'> {\n /** Визуально показывает, что активен CapsLock. */\n detectCapsLock?: boolean;\n}\n\nexport interface PasswordInputState {\n visible: boolean;\n focused: boolean;\n capsLockEnabled?: boolean | null;\n}\n\nexport const PasswordInputDataTids = {\n root: 'PasswordInput',\n capsLockDetector: 'PasswordInputCapsLockDetector',\n eyeIcon: 'PasswordInputEyeIcon',\n} as const;\n\n/**\n * Однострочное поле для ввода пароля, в котором символы заменяются на точки.\n */\n\n@rootNode\n@locale('PasswordInput', PasswordInputLocaleHelper)\n@withSize\nexport class PasswordInput extends React.PureComponent<PasswordInputProps, PasswordInputState> {\n public static __KONTUR_REACT_UI__ = 'PasswordInput';\n public static displayName = 'PasswordInput';\n\n public state: PasswordInputState = {\n visible: false,\n focused: false,\n capsLockEnabled: false,\n };\n private size!: SizeProp;\n\n private theme!: Theme;\n\n private input: Nullable<Input>;\n public getRootNode!: TGetRootNode;\n private setRootNode!: TSetRootNode;\n private readonly locale!: PasswordInputLocale;\n\n private getProps = createPropsGetter({});\n\n public componentDidMount() {\n if (this.props.detectCapsLock) {\n this.setState({ capsLockEnabled: null });\n }\n\n // @ts-expect-error: IE-specific API.\n if (isIE11 && isBrowser(globalObject) && !globalObject.document.msCapsLockWarningOff) {\n // @ts-expect-error: Read the comment above.\n // turns off default ie capslock warning\n globalObject.document.msCapsLockWarningOff = true;\n }\n }\n\n public static getDerivedStateFromProps(props: PasswordInputProps, state: PasswordInputState) {\n if (props.disabled) {\n return { visible: false };\n }\n\n return state;\n }\n\n public render(): JSX.Element {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.getProps()}>\n {this.renderMain}\n </CommonWrapper>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n /** Программно устанавливает фокус на поле.\n * Появляется фокусная рамка, элемент получает клавиатурные события и воспринимается как текущий элемент для чтения скринридерами.\n * @public\n */\n public focus = () => {\n if (this.input) {\n this.input.focus();\n }\n };\n\n /** Программно снимает фокус с кнопки.\n * @public\n */\n public blur = () => {\n if (this.input) {\n this.input.blur();\n }\n };\n\n private handleKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {\n const { onKeyPress, detectCapsLock } = this.props;\n\n if (onKeyPress) {\n onKeyPress(e);\n }\n\n if (!detectCapsLock) {\n return;\n }\n\n const capsLockEnabled = e.getModifierState(Codes.CapsLock);\n\n this.setState({ capsLockEnabled });\n };\n\n private handleKeydown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n const {\n props: { detectCapsLock, onKeyDown },\n state: { capsLockEnabled },\n } = this;\n\n if (onKeyDown) {\n onKeyDown(e);\n }\n\n if (!detectCapsLock) {\n return;\n }\n\n if (isKeyCapsLock(e) && isNonNullable(capsLockEnabled)) {\n this.setState({ capsLockEnabled: !capsLockEnabled });\n }\n };\n\n private handleToggleVisibility = () => {\n this.setState((prevState) => ({ visible: !prevState.visible }), this.focusOnInput);\n };\n\n private focusOnInput = () => {\n if (this.input) {\n this.input.focus();\n }\n };\n\n private handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n if (this.state.focused) {\n return;\n }\n\n this.setState({ focused: true });\n\n if (this.props.onFocus) {\n this.props.onFocus(event);\n }\n };\n\n private handleFocusOutside = () => {\n this.hideSymbols();\n\n if (this.state.focused) {\n this.setState({ focused: false });\n }\n };\n\n private getEyeWrapperClassname() {\n switch (this.size) {\n case 'large':\n return styles.eyeWrapperLarge(this.theme);\n case 'medium':\n return styles.eyeWrapperMedium(this.theme);\n case 'small':\n default:\n return styles.eyeWrapperSmall(this.theme);\n }\n }\n\n private renderEye = () => {\n const { capsLockEnabled } = this.state;\n\n return (\n <span className={styles.iconWrapper()}>\n {capsLockEnabled && (\n <span className={styles.capsLockDetector()} data-tid={PasswordInputDataTids.capsLockDetector} />\n )}\n <span className={cx(styles.toggleVisibility(this.theme), this.getEyeWrapperClassname())}>\n {!this.props.disabled && (\n <button\n type=\"button\"\n aria-label={this.state.visible ? this.locale.eyeClosedAriaLabel : this.locale.eyeOpenedAriaLabel}\n onClick={this.handleToggleVisibility}\n className={styles.icon()}\n data-tid={PasswordInputDataTids.eyeIcon}\n >\n <PasswordInputIcon size={this.size} visible={this.state.visible} />\n </button>\n )}\n </span>\n </span>\n );\n };\n\n private refInput = (element: Input) => {\n this.input = element;\n };\n\n private hideSymbols = () => {\n this.setState({ visible: false });\n };\n\n private renderMain = (props: CommonWrapperRestProps<PasswordInputProps>) => {\n return (\n <RenderLayer\n active={this.state.focused}\n onFocusOutside={this.handleFocusOutside}\n onClickOutside={this.handleFocusOutside}\n >\n <div data-tid={PasswordInputDataTids.root} className={styles.root()}>\n <Input\n ref={this.refInput}\n type={this.state.visible ? 'text' : 'password'}\n onKeyDown={this.handleKeydown}\n onKeyPress={this.handleKeyPress}\n rightIcon={this.renderEye()}\n onFocus={this.handleFocus}\n {...props}\n />\n </div>\n </RenderLayer>\n );\n };\n}\n"],"mappings":";AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;;AAEA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;;AAEA,IAAAO,MAAA,GAAAP,OAAA;;AAEA,IAAAQ,OAAA,GAAA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AAC4C,eAAe,CAAC,IAAI,CAACxC,KAAK,CAAC,CAC7C,CACF,CAAC,QAAAzD,aAAA,GAtJgCkG,cAAK,CAACC,aAAa,GAAAzG,cAAA,CACtC0G,mBAAmB,GAAG,eAAe,EAAA1G,cAAA,CACrC2G,WAAW,GAAG,eAAe,EAAA3G,cAAA,MAAAD,MAAA,KAAAA,MAAA,KAAAA,MAAA","ignoreList":[]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.Form = void 0;var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));var _taggedTemplateLiteralLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));var _react = _interopRequireDefault(require("react"));
|
|
2
|
+
var _Emotion = require("@skbkontur/react-ui/lib/theming/Emotion");var _excluded = ["children", "className"],_excluded2 = ["children", "className"],_excluded3 = ["children", "className"],_excluded4 = ["children", "className"],_excluded5 = ["children", "className"],_excluded6 = ["children", "className"];var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
3
|
+
|
|
4
|
+
var line = (0, _Emotion.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)(["\n display: flex;\n align-items: baseline;\n margin-bottom: 10px;\n"])));
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var title = (0, _Emotion.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)(["\n box-sizing: border-box;\n margin-right: 10px;\n width: 150px;\n text-align: right;\n"])));
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var content = (0, _Emotion.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2.default)(["\n display: inline-flex;\n"])));
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var formLineBreak = (0, _Emotion.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteralLoose2.default)(["\n height: 20px;\n"])));
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var actionsBar = (0, _Emotion.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2.default)(["\n margin-top: 10px;\n padding-left: 160px;\n"])));
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var formWrapper = (0, _Emotion.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteralLoose2.default)(["\n display: flex;\n flex-direction: column;\n"])));
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
var FormLine = function FormLine(_ref) {var children = _ref.children,className = _ref.className,rest = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
38
|
+
return /*#__PURE__*/(
|
|
39
|
+
_react.default.createElement("div", (0, _extends2.default)({ className: (0, _Emotion.css)(line, className) }, rest),
|
|
40
|
+
children
|
|
41
|
+
));
|
|
42
|
+
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var Line = function Line(_ref2) {var children = _ref2.children,className = _ref2.className,rest = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
|
|
46
|
+
return /*#__PURE__*/(
|
|
47
|
+
_react.default.createElement("div", (0, _extends2.default)({ className: (0, _Emotion.css)(line, className) }, rest),
|
|
48
|
+
children
|
|
49
|
+
));
|
|
50
|
+
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var Title = function Title(_ref3) {var children = _ref3.children,className = _ref3.className,rest = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
|
|
54
|
+
return /*#__PURE__*/(
|
|
55
|
+
_react.default.createElement("span", (0, _extends2.default)({ className: (0, _Emotion.css)(title, className) }, rest),
|
|
56
|
+
children
|
|
57
|
+
));
|
|
58
|
+
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
var Content = function Content(_ref4) {var children = _ref4.children,className = _ref4.className,rest = (0, _objectWithoutPropertiesLoose2.default)(_ref4, _excluded4);
|
|
62
|
+
return /*#__PURE__*/(
|
|
63
|
+
_react.default.createElement("span", (0, _extends2.default)({ className: (0, _Emotion.css)(content, className) }, rest),
|
|
64
|
+
children
|
|
65
|
+
));
|
|
66
|
+
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var LineBreak = function LineBreak(_ref5) {var children = _ref5.children,className = _ref5.className,rest = (0, _objectWithoutPropertiesLoose2.default)(_ref5, _excluded5);
|
|
70
|
+
return /*#__PURE__*/(
|
|
71
|
+
_react.default.createElement("div", (0, _extends2.default)({ className: (0, _Emotion.css)(formLineBreak, className) }, rest),
|
|
72
|
+
children
|
|
73
|
+
));
|
|
74
|
+
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var ActionsBar = function ActionsBar(_ref6) {var children = _ref6.children,className = _ref6.className,rest = (0, _objectWithoutPropertiesLoose2.default)(_ref6, _excluded6);
|
|
78
|
+
return /*#__PURE__*/(
|
|
79
|
+
_react.default.createElement("div", (0, _extends2.default)({ className: (0, _Emotion.css)(actionsBar, className) }, rest),
|
|
80
|
+
children
|
|
81
|
+
));
|
|
82
|
+
|
|
83
|
+
};var
|
|
84
|
+
|
|
85
|
+
Form = exports.Form = /*#__PURE__*/function (_React$Component) {function Form() {return _React$Component.apply(this, arguments) || this;}(0, _inheritsLoose2.default)(Form, _React$Component);var _proto = Form.prototype;_proto.
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
render = function render() {
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement("div", { className: (0, _Emotion.css)(formWrapper, this.props.className) }, this.props.children);
|
|
95
|
+
};return Form;}(_react.default.Component);Form.Line = Line;Form.LineBreak = LineBreak;Form.ActionsBar = ActionsBar;Form.FormLine = FormLine;Form.Title = Title;Form.Content = Content;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_Emotion","_excluded","_excluded2","_excluded3","_excluded4","_excluded5","_excluded6","_templateObject","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","line","css","_taggedTemplateLiteralLoose2","default","title","content","formLineBreak","actionsBar","formWrapper","FormLine","_ref","children","className","rest","_objectWithoutPropertiesLoose2","createElement","_extends2","Line","_ref2","Title","_ref3","Content","_ref4","LineBreak","_ref5","ActionsBar","_ref6","Form","exports","_React$Component","apply","arguments","_inheritsLoose2","_proto","prototype","render","props","React","Component"],"sources":["Form.tsx"],"sourcesContent":["import React from 'react';\nimport { css } from '@skbkontur/react-ui/lib/theming/Emotion';\n\nconst line = css`\n display: flex;\n align-items: baseline;\n margin-bottom: 10px;\n`;\n\nconst title = css`\n box-sizing: border-box;\n margin-right: 10px;\n width: 150px;\n text-align: right;\n`;\n\nconst content = css`\n display: inline-flex;\n`;\n\nconst formLineBreak = css`\n height: 20px;\n`;\n\nconst actionsBar = css`\n margin-top: 10px;\n padding-left: 160px;\n`;\n\nconst formWrapper = css`\n display: flex;\n flex-direction: column;\n`;\n\ntype ComponentProps = React.PropsWithChildren<React.HTMLAttributes<HTMLElement>>;\n\nconst FormLine = ({ children, className, ...rest }: ComponentProps) => {\n return (\n <div className={css(line, className)} {...rest}>\n {children}\n </div>\n );\n};\n\nconst Line = ({ children, className, ...rest }: ComponentProps) => {\n return (\n <div className={css(line, className)} {...rest}>\n {children}\n </div>\n );\n};\n\nconst Title = ({ children, className, ...rest }: ComponentProps) => {\n return (\n <span className={css(title, className)} {...rest}>\n {children}\n </span>\n );\n};\n\nconst Content = ({ children, className, ...rest }: ComponentProps) => {\n return (\n <span className={css(content, className)} {...rest}>\n {children}\n </span>\n );\n};\n\nconst LineBreak = ({ children, className, ...rest }: ComponentProps) => {\n return (\n <div className={css(formLineBreak, className)} {...rest}>\n {children}\n </div>\n );\n};\n\nconst ActionsBar = ({ children, className, ...rest }: ComponentProps) => {\n return (\n <div className={css(actionsBar, className)} {...rest}>\n {children}\n </div>\n );\n};\n\nexport class Form extends React.Component<ComponentProps> {\n public static Line = Line;\n public static LineBreak = LineBreak;\n public static ActionsBar = ActionsBar;\n public static FormLine = FormLine;\n public static Title = Title;\n public static Content = Content;\n\n public render() {\n return <div className={css(formWrapper, this.props.className)}>{this.props.children}</div>;\n }\n}\n"],"mappings":"8jBAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA,4CAA8D,IAAAE,SAAA,6BAAAC,UAAA,6BAAAC,UAAA,6BAAAC,UAAA,6BAAAC,UAAA,6BAAAC,UAAA,iCAAAC,eAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA;;AAE9D,IAAMC,IAAI,OAAGC,YAAG,EAAAP,eAAA,KAAAA,eAAA,OAAAQ,4BAAA,CAAAC,OAAA,+EAIf;;;;;;AAED,IAAMC,KAAK,OAAGH,YAAG,EAAAN,gBAAA,KAAAA,gBAAA,OAAAO,4BAAA,CAAAC,OAAA,oGAKhB;;;;;;;AAED,IAAME,OAAO,OAAGJ,YAAG,EAAAL,gBAAA,KAAAA,gBAAA,OAAAM,4BAAA,CAAAC,OAAA,oCAElB;;;;AAED,IAAMG,aAAa,OAAGL,YAAG,EAAAJ,gBAAA,KAAAA,gBAAA,OAAAK,4BAAA,CAAAC,OAAA,4BAExB;;;;AAED,IAAMI,UAAU,OAAGN,YAAG,EAAAH,gBAAA,KAAAA,gBAAA,OAAAI,4BAAA,CAAAC,OAAA,wDAGrB;;;;;AAED,IAAMK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AAI,GAAAC,OAAA,CAAAD,IAAA,0BAAAE,gBAAA,YAAAF,KAAA,UAAAE,gBAAA,CAAAC,KAAA,OAAAC,SAAA,eAAAC,eAAA,CAAA7B,OAAA,EAAAwB,IAAA,EAAAE,gBAAA,MAAAI,MAAA,GAAAN,IAAA,CAAAO,SAAA,CAAAD,MAAA;;;;;;;;EAQRE,MAAM,GAAb,SAAAA,OAAA,EAAgB;IACd,oBAAOnD,MAAA,CAAAmB,OAAA,CAAAY,aAAA,UAAKH,SAAS,EAAE,IAAAX,YAAG,EAACO,WAAW,EAAE,IAAI,CAAC4B,KAAK,CAACxB,SAAS,CAAE,IAAE,IAAI,CAACwB,KAAK,CAACzB,QAAc,CAAC;EAC5F,CAAC,QAAAgB,IAAA,GAVuBU,cAAK,CAACC,SAAS,EAA5BX,IAAI,CACDV,IAAI,GAAGA,IAAI,CADdU,IAAI,CAEDJ,SAAS,GAAGA,SAAS,CAFxBI,IAAI,CAGDF,UAAU,GAAGA,UAAU,CAH1BE,IAAI,CAIDlB,QAAQ,GAAGA,QAAQ,CAJtBkB,IAAI,CAKDR,KAAK,GAAGA,KAAK,CALhBQ,IAAI,CAMDN,OAAO,GAAGA,OAAO","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ export interface CommonProps {
|
|
|
10
10
|
*/
|
|
11
11
|
style?: React.HTMLAttributes<HTMLElement>['style'];
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Наравне с data-tid транслируются любые data-атрибуты. Они попадают на корневой элемент.
|
|
14
14
|
*/
|
|
15
15
|
'data-tid'?: string;
|
|
16
16
|
children?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type React from 'react';\n\nimport type { Nullable } from '../../typings/utility-types';\n\nexport interface CommonProps {\n /**\n * HTML-атрибут `class`.\n */\n className?: React.HTMLAttributes<HTMLElement>['className'];\n /**\n * HTML-атрибут `style`.\n */\n style?: React.HTMLAttributes<HTMLElement>['style'];\n /**\n *
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type React from 'react';\n\nimport type { Nullable } from '../../typings/utility-types';\n\nexport interface CommonProps {\n /**\n * HTML-атрибут `class`.\n */\n className?: React.HTMLAttributes<HTMLElement>['className'];\n /**\n * HTML-атрибут `style`.\n */\n style?: React.HTMLAttributes<HTMLElement>['style'];\n /**\n * Наравне с data-tid транслируются любые data-атрибуты. Они попадают на корневой элемент.\n */\n 'data-tid'?: string;\n children?: React.ReactNode;\n}\n\nexport interface CommonPropsRootNodeRef {\n rootNodeRef?: (instance: Nullable<Element>) => void;\n}\n\nexport type NotCommonProps<P> = Omit<P, keyof CommonProps>;\nexport type CommonWrapperProps<P> = P & {\n children: React.ReactNode | ((rest: CommonWrapperRestProps<P>) => React.ReactNode);\n};\nexport type CommonWrapperRestProps<P> = Omit<NotCommonProps<P>, 'children'>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -8,6 +8,7 @@ export declare const getFullReactUIFlagsContext: (flags: ReactUIFeatureFlags) =>
|
|
|
8
8
|
groupAddHintAndTooltipSupport?: boolean | undefined;
|
|
9
9
|
popupFixPinTearing?: boolean | undefined;
|
|
10
10
|
autocompleteUseMaskedInput?: boolean | undefined;
|
|
11
|
+
fxInputUseMaskedInput?: boolean | undefined;
|
|
11
12
|
sidePageDisableHeaderShrink?: boolean | undefined;
|
|
12
13
|
sidePageNotCutTitleOnStuckByDefault?: boolean | undefined;
|
|
13
14
|
tokenInputCreateTokenOnBlurInWithoutReferenceMode?: boolean | undefined;
|
|
@@ -8,6 +8,7 @@ export interface ReactUIFeatureFlags {
|
|
|
8
8
|
groupAddHintAndTooltipSupport?: boolean;
|
|
9
9
|
popupFixPinTearing?: boolean;
|
|
10
10
|
autocompleteUseMaskedInput?: boolean;
|
|
11
|
+
fxInputUseMaskedInput?: boolean;
|
|
11
12
|
sidePageDisableHeaderShrink?: boolean;
|
|
12
13
|
sidePageNotCutTitleOnStuckByDefault?: boolean;
|
|
13
14
|
tokenInputCreateTokenOnBlurInWithoutReferenceMode?: boolean;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
|
|
17
18
|
var reactUIFeatureFlagsDefault = exports.reactUIFeatureFlagsDefault = {
|
|
18
19
|
dateInputFixSameNumberTypingOnRefocus: false,
|
|
19
20
|
dateInputAllowInvalidValuesInDays: false,
|
|
@@ -23,6 +24,7 @@ var reactUIFeatureFlagsDefault = exports.reactUIFeatureFlagsDefault = {
|
|
|
23
24
|
groupAddHintAndTooltipSupport: false,
|
|
24
25
|
popupFixPinTearing: false,
|
|
25
26
|
autocompleteUseMaskedInput: false,
|
|
27
|
+
fxInputUseMaskedInput: false,
|
|
26
28
|
sidePageDisableHeaderShrink: false,
|
|
27
29
|
sidePageNotCutTitleOnStuckByDefault: false,
|
|
28
30
|
tokenInputCreateTokenOnBlurInWithoutReferenceMode: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","reactUIFeatureFlagsDefault","exports","dateInputFixSameNumberTypingOnRefocus","dateInputAllowInvalidValuesInDays","comboBoxAllowValueChangeInEditingState","stickyReduceLayoutEvents","radioGroupRemoveBaselineSpacer","groupAddHintAndTooltipSupport","popupFixPinTearing","autocompleteUseMaskedInput","sidePageDisableHeaderShrink","sidePageNotCutTitleOnStuckByDefault","tokenInputCreateTokenOnBlurInWithoutReferenceMode","ReactUIFeatureFlagsContext","React","createContext","displayName","__KONTUR_REACT_UI__"],"sources":["ReactUIFeatureFlagsContext.tsx"],"sourcesContent":["import React from 'react';\n\nexport interface ReactUIFeatureFlags {\n dateInputFixSameNumberTypingOnRefocus?: boolean;\n dateInputAllowInvalidValuesInDays?: boolean;\n comboBoxAllowValueChangeInEditingState?: boolean;\n stickyReduceLayoutEvents?: boolean;\n radioGroupRemoveBaselineSpacer?: boolean;\n groupAddHintAndTooltipSupport?: boolean;\n popupFixPinTearing?: boolean;\n autocompleteUseMaskedInput?: boolean;\n sidePageDisableHeaderShrink?: boolean;\n sidePageNotCutTitleOnStuckByDefault?: boolean;\n tokenInputCreateTokenOnBlurInWithoutReferenceMode?: boolean;\n}\n\nexport const reactUIFeatureFlagsDefault: ReactUIFeatureFlags = {\n dateInputFixSameNumberTypingOnRefocus: false,\n dateInputAllowInvalidValuesInDays: false,\n comboBoxAllowValueChangeInEditingState: false,\n stickyReduceLayoutEvents: false,\n radioGroupRemoveBaselineSpacer: false,\n groupAddHintAndTooltipSupport: false,\n popupFixPinTearing: false,\n autocompleteUseMaskedInput: false,\n sidePageDisableHeaderShrink: false,\n sidePageNotCutTitleOnStuckByDefault: false,\n tokenInputCreateTokenOnBlurInWithoutReferenceMode: false,\n};\n\nexport const ReactUIFeatureFlagsContext = React.createContext<ReactUIFeatureFlags>(reactUIFeatureFlagsDefault);\n\nReactUIFeatureFlagsContext.displayName = 'ReactUIFeatureFlagsContext';\nReactUIFeatureFlagsContext.__KONTUR_REACT_UI__ = 'ReactUIFeatureFlagsContext';\n"],"mappings":"qNAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","reactUIFeatureFlagsDefault","exports","dateInputFixSameNumberTypingOnRefocus","dateInputAllowInvalidValuesInDays","comboBoxAllowValueChangeInEditingState","stickyReduceLayoutEvents","radioGroupRemoveBaselineSpacer","groupAddHintAndTooltipSupport","popupFixPinTearing","autocompleteUseMaskedInput","fxInputUseMaskedInput","sidePageDisableHeaderShrink","sidePageNotCutTitleOnStuckByDefault","tokenInputCreateTokenOnBlurInWithoutReferenceMode","ReactUIFeatureFlagsContext","React","createContext","displayName","__KONTUR_REACT_UI__"],"sources":["ReactUIFeatureFlagsContext.tsx"],"sourcesContent":["import React from 'react';\n\nexport interface ReactUIFeatureFlags {\n dateInputFixSameNumberTypingOnRefocus?: boolean;\n dateInputAllowInvalidValuesInDays?: boolean;\n comboBoxAllowValueChangeInEditingState?: boolean;\n stickyReduceLayoutEvents?: boolean;\n radioGroupRemoveBaselineSpacer?: boolean;\n groupAddHintAndTooltipSupport?: boolean;\n popupFixPinTearing?: boolean;\n autocompleteUseMaskedInput?: boolean;\n fxInputUseMaskedInput?: boolean;\n sidePageDisableHeaderShrink?: boolean;\n sidePageNotCutTitleOnStuckByDefault?: boolean;\n tokenInputCreateTokenOnBlurInWithoutReferenceMode?: boolean;\n}\n\nexport const reactUIFeatureFlagsDefault: ReactUIFeatureFlags = {\n dateInputFixSameNumberTypingOnRefocus: false,\n dateInputAllowInvalidValuesInDays: false,\n comboBoxAllowValueChangeInEditingState: false,\n stickyReduceLayoutEvents: false,\n radioGroupRemoveBaselineSpacer: false,\n groupAddHintAndTooltipSupport: false,\n popupFixPinTearing: false,\n autocompleteUseMaskedInput: false,\n fxInputUseMaskedInput: false,\n sidePageDisableHeaderShrink: false,\n sidePageNotCutTitleOnStuckByDefault: false,\n tokenInputCreateTokenOnBlurInWithoutReferenceMode: false,\n};\n\nexport const ReactUIFeatureFlagsContext = React.createContext<ReactUIFeatureFlags>(reactUIFeatureFlagsDefault);\n\nReactUIFeatureFlagsContext.displayName = 'ReactUIFeatureFlagsContext';\nReactUIFeatureFlagsContext.__KONTUR_REACT_UI__ = 'ReactUIFeatureFlagsContext';\n"],"mappings":"qNAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;;;;;;;;;;;;;;;;;AAiBO,IAAMC,0BAA+C,GAAAC,OAAA,CAAAD,0BAAA,GAAG;EAC7DE,qCAAqC,EAAE,KAAK;EAC5CC,iCAAiC,EAAE,KAAK;EACxCC,sCAAsC,EAAE,KAAK;EAC7CC,wBAAwB,EAAE,KAAK;EAC/BC,8BAA8B,EAAE,KAAK;EACrCC,6BAA6B,EAAE,KAAK;EACpCC,kBAAkB,EAAE,KAAK;EACzBC,0BAA0B,EAAE,KAAK;EACjCC,qBAAqB,EAAE,KAAK;EAC5BC,2BAA2B,EAAE,KAAK;EAClCC,mCAAmC,EAAE,KAAK;EAC1CC,iDAAiD,EAAE;AACrD,CAAC;;AAEM,IAAMC,0BAA0B,GAAAb,OAAA,CAAAa,0BAAA,gBAAGC,cAAK,CAACC,aAAa,CAAsBhB,0BAA0B,CAAC;;AAE9Gc,0BAA0B,CAACG,WAAW,GAAG,4BAA4B;AACrEH,0BAA0B,CAACI,mBAAmB,GAAG,4BAA4B","ignoreList":[]}
|
package/cjs/lib/utils.d.ts
CHANGED
|
@@ -99,5 +99,9 @@ export declare const isDropdownMenu: (child: React.ReactNode) => child is React.
|
|
|
99
99
|
export declare const isHint: (child: React.ReactNode) => child is React.ReactElement<HintProps, string | React.JSXElementConstructor<any>>;
|
|
100
100
|
export declare const isTooltip: (child: React.ReactNode) => child is React.ReactElement<TooltipProps, string | React.JSXElementConstructor<any>>;
|
|
101
101
|
export declare const isKonturIcon: (icon: React.ReactElement) => boolean;
|
|
102
|
-
export declare function clickOutside(): void;
|
|
102
|
+
export declare function clickOutside(eventType?: 'touchstart' | 'mousedown' | 'pointerup'): void;
|
|
103
103
|
export declare function isElement(el: unknown): el is Element;
|
|
104
|
+
export declare function isDocument(node?: Document | null): node is Document;
|
|
105
|
+
export declare function isWindow(node?: Window | null): node is Window;
|
|
106
|
+
export declare function tryGetDocument(node?: Node | null): Document | null;
|
|
107
|
+
export declare function tryGetWindow(node?: Node | null): Window | null;
|
package/cjs/lib/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.CancelationError = void 0;exports.clickOutside = clickOutside;exports.emptyHandler = exports.delay = void 0;exports.escapeRegExpSpecChars = escapeRegExpSpecChars;exports.isButton = exports.isAutocomplete = exports.getRandomID = exports.formatBytes = exports.extractDataProps = void 0;exports.isClassComponent = isClassComponent;exports.
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.CancelationError = void 0;exports.clickOutside = clickOutside;exports.emptyHandler = exports.delay = void 0;exports.escapeRegExpSpecChars = escapeRegExpSpecChars;exports.isButton = exports.isAutocomplete = exports.getRandomID = exports.formatBytes = exports.extractDataProps = void 0;exports.isClassComponent = isClassComponent;exports.isCurrencyInput = void 0;exports.isDocument = isDocument;exports.isDropdownMenu = exports.isDropdown = void 0;exports.isElement = isElement;exports.isExternalLink = void 0;exports.isFunction = isFunction;exports.isFunctionalComponent = isFunctionalComponent;exports.isInput = exports.isHint = exports.isFxInput = void 0;exports.isIntrinsicElement = isIntrinsicElement;exports.isReactUINode = exports.isReactUIInstance = exports.isReactUIComponent = exports.isPasswordInput = exports.isNullable = exports.isNonNullable = exports.isKonturIcon = void 0;exports.isRefableElement = isRefableElement;exports.isTooltip = exports.isSelect = void 0;exports.isWindow = isWindow;exports.mergeRefs = mergeRefs;exports.startsWithOneOf = void 0;exports.taskWithDelay = taskWithDelay;exports.tryGetDocument = tryGetDocument;exports.tryGetWindow = tryGetWindow;var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
2
2
|
var _react = require("react");
|
|
3
3
|
var _reactIs = require("react-is");
|
|
4
4
|
var _globalObject = require("@skbkontur/global-object");
|
|
@@ -243,13 +243,29 @@ var isKonturIcon = exports.isKonturIcon = function isKonturIcon(icon) {
|
|
|
243
243
|
return Object.prototype.hasOwnProperty.call(icon == null ? void 0 : icon.type, '__KONTUR_ICON__');
|
|
244
244
|
};
|
|
245
245
|
|
|
246
|
-
function clickOutside() {
|
|
246
|
+
function clickOutside(eventType) {if (eventType === void 0) {eventType = 'mousedown';}
|
|
247
247
|
var event = document.createEvent('HTMLEvents');
|
|
248
|
-
event.initEvent(
|
|
249
|
-
|
|
248
|
+
event.initEvent(eventType, true, true);
|
|
250
249
|
document.body.dispatchEvent(event);
|
|
251
250
|
}
|
|
252
251
|
|
|
253
252
|
function isElement(el) {
|
|
254
253
|
return !!el && typeof el === 'object' && 'nodeType' in el && el.nodeType === Node.ELEMENT_NODE;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function isDocument(node) {
|
|
257
|
+
return !!node && typeof node === 'object' && node.nodeType === Node.DOCUMENT_NODE;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function isWindow(node) {
|
|
261
|
+
return !!node && typeof node === 'object' && node.window === node;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function tryGetDocument(node) {
|
|
265
|
+
return !!node && isDocument(node.ownerDocument) ? node.ownerDocument : null;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function tryGetWindow(node) {
|
|
269
|
+
var doc = tryGetDocument(node);
|
|
270
|
+
return isDocument(doc) ? doc.defaultView : null;
|
|
255
271
|
}
|
package/cjs/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactIs","_globalObject","_delay","exports","delay","emptyHandler","CancelationError","_Error","_this","_len","arguments","length","args","Array","_key","call","apply","concat","code","_inheritsLoose2","default","_wrapNativeSuper2","Error","taskWithDelay","task","ms","cancelationToken","Promise","resolve","reject","globalObject","setTimeout","then","catch","isFunction","x","isFunctionalComponent","Component","Boolean","prototype","isReactComponent","isClassComponent","isIntrinsicElement","element","type","isRefableElement","isForwardRef","escapeRegExpSpecChars","s","replace","getRandomID","Math","random","toString","slice","isExternalLink","link","isBrowser","RegExp","location","host","test","isReactUINode","componentName","node","isValidElement","Object","hasOwnProperty","__KONTUR_REACT_UI__","KB","UNITS","calculateDecimals","decimals","formatBytes","bytes","calculatedDecimals","i","floor","log2","formattedBytes","parseFloat","pow","toFixed","isNonNullable","value","undefined","isNullable","isReactUIComponent","name","child","_child$type","isReactUIInstance","instance","constructor","mergeRefs","refs","forEach","ref","current","extractDataProps","props","dataProps","restWithoutDataProps","entries","map","_ref","startsWith","startsWithOneOf","searchKeys","inputString","keyIndex","findIndex","key","isButton","isInput","isFxInput","isAutocomplete","isPasswordInput","isCurrencyInput","isSelect","isDropdown","isDropdownMenu","isHint","isTooltip","isKonturIcon","icon","clickOutside","event","document","createEvent","initEvent","body","dispatchEvent","isElement","el","nodeType","Node","ELEMENT_NODE"],"sources":["utils.ts"],"sourcesContent":["import type React from 'react';\nimport { isValidElement } from 'react';\nimport { isForwardRef } from 'react-is';\nimport { globalObject, isBrowser } from '@skbkontur/global-object';\n\nimport type { CurrencyInputProps } from '../components/CurrencyInput';\nimport type { PasswordInputProps } from '../components/PasswordInput';\nimport type { InputProps } from '../components/Input';\nimport type { AutocompleteProps } from '../components/Autocomplete';\nimport type { FxInputProps } from '../components/FxInput';\nimport type { SelectProps } from '../components/Select';\nimport type { DropdownProps } from '../components/Dropdown';\nimport type { DropdownMenuProps } from '../components/DropdownMenu';\nimport type { ButtonProps } from '../components/Button';\nimport type { TooltipProps } from '../components/Tooltip';\nimport type { HintProps } from '../components/Hint';\n\nexport { delay } from './delay';\n\n// NOTE: Copy-paste from @types/react\nexport type Defaultize<P, D> = P extends any\n ? string extends keyof P\n ? P\n : Pick<P, Exclude<keyof P, keyof D>> &\n Partial<Pick<P, Extract<keyof P, keyof D>>> &\n Partial<Pick<D, Exclude<keyof D, keyof P>>>\n : never;\n\nexport type DefaultizeProps<C, P> = C extends { defaultProps: infer D } ? Defaultize<P, D> : P;\n\nexport type AnyObject = Record<string, unknown>;\n\nexport type NoInfer<T> = T extends infer U ? U : never;\n\nexport const emptyHandler = () => {\n /* noop */\n};\n\nexport class CancelationError extends Error {\n public code = 'CancelationError';\n}\n\nexport function taskWithDelay(task: () => void, ms: number) {\n let cancelationToken: () => void = () => null;\n\n new Promise((resolve, reject) => {\n cancelationToken = reject;\n globalObject.setTimeout(resolve, ms);\n })\n .then(task)\n .catch(() => null);\n\n return cancelationToken;\n}\n\nexport type FunctionWithParams<R = any> = (...args: any[]) => R;\n\nexport function isFunction<T>(x: T | FunctionWithParams): x is FunctionWithParams {\n return typeof x === 'function';\n}\n\nexport function isFunctionalComponent(Component: unknown): Component is React.ComponentType {\n return Boolean(typeof Component === 'function' && !(Component.prototype && Component.prototype.isReactComponent));\n}\n\nexport function isClassComponent(Component: unknown): Component is React.ComponentType {\n return Boolean(typeof Component === 'function' && Component.prototype && Component.prototype.isReactComponent);\n}\n\nexport function isIntrinsicElement(element: React.ReactElement): boolean {\n return typeof element.type === 'string';\n}\n\nexport function isRefableElement(element: React.ReactElement): boolean {\n return Boolean(isIntrinsicElement(element) || isClassComponent(element.type) || isForwardRef(element));\n}\n\nexport function escapeRegExpSpecChars(s: string): string {\n return s.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\n\nexport const getRandomID = (): string => Math.random().toString(16).slice(2);\n\nexport const isExternalLink = (link: string): boolean => {\n return isBrowser(globalObject) && new RegExp(`^(https?:)?//(?!${globalObject.location.host})\\\\S+`, 'gi').test(link);\n};\n\n/**\n * Check if the given ReactNode is an element of the specified ReactUI component\n */\nexport const isReactUINode = (componentName: string, node: React.ReactNode): boolean => {\n if (isValidElement(node)) {\n return (\n Object.prototype.hasOwnProperty.call(node.type, '__KONTUR_REACT_UI__') &&\n // @ts-expect-error: React doesn't know about existence of __KONTUR_REACT_UI__.\n node.type.__KONTUR_REACT_UI__ === componentName\n );\n }\n\n return false;\n};\n\nconst KB = 1024;\nconst UNITS = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\nconst calculateDecimals = (decimals: number) => {\n if (decimals < 0) {\n return 0;\n }\n\n return 0;\n};\n\nexport const formatBytes = (bytes: number, decimals = 2): string | null => {\n if (bytes === 0) {\n return '0 Bytes';\n }\n\n if (!bytes) {\n return null;\n }\n\n const calculatedDecimals = calculateDecimals(decimals);\n\n const i = Math.floor(Math.log2(bytes) / Math.log2(KB));\n const formattedBytes = parseFloat((bytes / Math.pow(KB, i)).toFixed(calculatedDecimals));\n\n return `${formattedBytes} ${UNITS[i]}`;\n};\n\n/**\n * Проверяет, не является ли переданный аргумент null или undefined и исключает типы null и undefined из типа аргумента\n *\n * @param value Значение, которое нужно проверить и исключить из него типы\n * @returns Возвращает true, если переданный аргумент не является null или undefined иначе false\n */\nexport const isNonNullable = <T>(value: T): value is NonNullable<T> => {\n return value !== null && value !== undefined;\n};\n\n/**\n * Checks if the value `null` or `undefined`.\n *\n * @param value Value to check for `null` and `undefined`.\n * @returns Returns `true` if `value` is `null` or `undefined`, else `false`.\n */\nexport const isNullable = (value: unknown): value is null | undefined => {\n return value === null || value === undefined;\n};\n\n/**\n * Creates a function that checks if the given `child`\n * is an instance of some component specified by `name`.\n *\n * @param name Component name for which function will be created.\n * @returns A function that checks if the given `child` is an instance of the component specified by `name`.\n */\nexport const isReactUIComponent = <P = any>(name: string) => {\n return (child: React.ReactNode): child is React.ReactElement<P> => {\n // @ts-expect-error: Property `type` doesn't exist on type `React.ReactNode`, but exists on type `React.ReactElement` meanwhile `React.ReactElement` is not compatible with `React` `children` type.\n return child?.type?.__KONTUR_REACT_UI__ === name;\n };\n};\n\n/**\n * Checks if a component instance is a ReactUI component with the given name.\n *\n * @typeParam T Expected ReactUI component type.\n * @param instance Component instance.\n * @param componentName ReactUI component name.\n * @returns `true` if it matches, otherwise `false`.\n */\nexport const isReactUIInstance = <T extends React.Component>(\n instance: React.Component,\n componentName: string,\n): instance is T => {\n const constructor = instance?.constructor;\n return '__KONTUR_REACT_UI__' in constructor && constructor.__KONTUR_REACT_UI__ === componentName;\n};\n\n/** @deprecated Переехал в `lib/mergeRefs.ts`. Со следующей мажорной версии от сюда будет удален*/\nexport function mergeRefs<T = any>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T> {\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (isNonNullable(ref)) {\n return ((ref as React.MutableRefObject<T | null>).current = value);\n }\n });\n };\n}\n\n/**\n * Extracts all data attributes from props and returns them as well as props.\n *\n * @param props Props object to extract data attributes from.\n * @returns Separated data attributes and all other props.\n */\nexport const extractDataProps = <T extends Record<string, any>>(props: T) => {\n const dataProps: Record<string, any> = {};\n const restWithoutDataProps: Record<string, any> = {};\n\n Object.entries(props).map(([name, value]) => {\n if (name.startsWith('data-')) {\n return (dataProps[name] = value);\n }\n\n return (restWithoutDataProps[name] = value);\n });\n\n return { dataProps, restWithoutDataProps };\n};\n\n/**\n * Basically `.startsWith` for arrays.\n *\n * @param searchKeys Array of strings to test against `inputString`.\n * @param inputString String on which search will be performed.\n * @returns `true` if `inputString` starts with one of keys, else `false`.\n */\nexport const startsWithOneOf = (searchKeys: string[], inputString: string) => {\n const keyIndex = searchKeys.findIndex((key) => {\n return inputString.startsWith(key);\n });\n\n return keyIndex >= 0;\n};\n\nexport const isButton = isReactUIComponent<ButtonProps>('Button');\nexport const isInput = isReactUIComponent<InputProps>('Input');\nexport const isFxInput = isReactUIComponent<FxInputProps>('FxInput');\nexport const isAutocomplete = isReactUIComponent<AutocompleteProps>('Autocomplete');\nexport const isPasswordInput = isReactUIComponent<PasswordInputProps>('PasswordInput');\nexport const isCurrencyInput = isReactUIComponent<CurrencyInputProps>('CurrencyInput');\nexport const isSelect = isReactUIComponent<SelectProps<unknown, unknown>>('Select');\nexport const isDropdown = isReactUIComponent<DropdownProps>('Dropdown');\nexport const isDropdownMenu = isReactUIComponent<DropdownMenuProps>('DropdownMenu');\nexport const isHint = isReactUIComponent<HintProps>('Hint');\nexport const isTooltip = isReactUIComponent<TooltipProps>('Tooltip');\n\nexport const isKonturIcon = (icon: React.ReactElement) => {\n return Object.prototype.hasOwnProperty.call(icon?.type, '__KONTUR_ICON__');\n};\n\nexport function clickOutside() {\n const event = document.createEvent('HTMLEvents');\n event.initEvent('mousedown', true, true);\n\n document.body.dispatchEvent(event);\n}\n\nexport function isElement(el: unknown): el is Element {\n return !!el && typeof el === 'object' && 'nodeType' in el && el.nodeType === Node.ELEMENT_NODE;\n}\n"],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,SAASkF,YAAYA,CAAA,EAAG;EAC7B,IAAMC,KAAK,GAAGC,QAAQ,CAACC,WAAW,CAAC,YAAY,CAAC;EAChDF,KAAK,CAACG,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC;;EAExCF,QAAQ,CAACG,IAAI,CAACC,aAAa,CAACL,KAAK,CAAC;AACpC;;AAEO,SAASM,SAASA,CAACC,EAAW,EAAiB;EACpD,OAAO,CAAC,CAACA,EAAE,IAAI,OAAOA,EAAE,KAAK,QAAQ,IAAI,UAAU,IAAIA,EAAE,IAAIA,EAAE,CAACC,QAAQ,KAAKC,IAAI,CAACC,YAAY;AAChG","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","require","_reactIs","_globalObject","_delay","exports","delay","emptyHandler","CancelationError","_Error","_this","_len","arguments","length","args","Array","_key","call","apply","concat","code","_inheritsLoose2","default","_wrapNativeSuper2","Error","taskWithDelay","task","ms","cancelationToken","Promise","resolve","reject","globalObject","setTimeout","then","catch","isFunction","x","isFunctionalComponent","Component","Boolean","prototype","isReactComponent","isClassComponent","isIntrinsicElement","element","type","isRefableElement","isForwardRef","escapeRegExpSpecChars","s","replace","getRandomID","Math","random","toString","slice","isExternalLink","link","isBrowser","RegExp","location","host","test","isReactUINode","componentName","node","isValidElement","Object","hasOwnProperty","__KONTUR_REACT_UI__","KB","UNITS","calculateDecimals","decimals","formatBytes","bytes","calculatedDecimals","i","floor","log2","formattedBytes","parseFloat","pow","toFixed","isNonNullable","value","undefined","isNullable","isReactUIComponent","name","child","_child$type","isReactUIInstance","instance","constructor","mergeRefs","refs","forEach","ref","current","extractDataProps","props","dataProps","restWithoutDataProps","entries","map","_ref","startsWith","startsWithOneOf","searchKeys","inputString","keyIndex","findIndex","key","isButton","isInput","isFxInput","isAutocomplete","isPasswordInput","isCurrencyInput","isSelect","isDropdown","isDropdownMenu","isHint","isTooltip","isKonturIcon","icon","clickOutside","eventType","event","document","createEvent","initEvent","body","dispatchEvent","isElement","el","nodeType","Node","ELEMENT_NODE","isDocument","DOCUMENT_NODE","isWindow","window","tryGetDocument","ownerDocument","tryGetWindow","doc","defaultView"],"sources":["utils.ts"],"sourcesContent":["import type React from 'react';\nimport { isValidElement } from 'react';\nimport { isForwardRef } from 'react-is';\nimport { globalObject, isBrowser } from '@skbkontur/global-object';\n\nimport type { CurrencyInputProps } from '../components/CurrencyInput';\nimport type { PasswordInputProps } from '../components/PasswordInput';\nimport type { InputProps } from '../components/Input';\nimport type { AutocompleteProps } from '../components/Autocomplete';\nimport type { FxInputProps } from '../components/FxInput';\nimport type { SelectProps } from '../components/Select';\nimport type { DropdownProps } from '../components/Dropdown';\nimport type { DropdownMenuProps } from '../components/DropdownMenu';\nimport type { ButtonProps } from '../components/Button';\nimport type { TooltipProps } from '../components/Tooltip';\nimport type { HintProps } from '../components/Hint';\n\nexport { delay } from './delay';\n\n// NOTE: Copy-paste from @types/react\nexport type Defaultize<P, D> = P extends any\n ? string extends keyof P\n ? P\n : Pick<P, Exclude<keyof P, keyof D>> &\n Partial<Pick<P, Extract<keyof P, keyof D>>> &\n Partial<Pick<D, Exclude<keyof D, keyof P>>>\n : never;\n\nexport type DefaultizeProps<C, P> = C extends { defaultProps: infer D } ? Defaultize<P, D> : P;\n\nexport type AnyObject = Record<string, unknown>;\n\nexport type NoInfer<T> = T extends infer U ? U : never;\n\nexport const emptyHandler = () => {\n /* noop */\n};\n\nexport class CancelationError extends Error {\n public code = 'CancelationError';\n}\n\nexport function taskWithDelay(task: () => void, ms: number) {\n let cancelationToken: () => void = () => null;\n\n new Promise((resolve, reject) => {\n cancelationToken = reject;\n globalObject.setTimeout(resolve, ms);\n })\n .then(task)\n .catch(() => null);\n\n return cancelationToken;\n}\n\nexport type FunctionWithParams<R = any> = (...args: any[]) => R;\n\nexport function isFunction<T>(x: T | FunctionWithParams): x is FunctionWithParams {\n return typeof x === 'function';\n}\n\nexport function isFunctionalComponent(Component: unknown): Component is React.ComponentType {\n return Boolean(typeof Component === 'function' && !(Component.prototype && Component.prototype.isReactComponent));\n}\n\nexport function isClassComponent(Component: unknown): Component is React.ComponentType {\n return Boolean(typeof Component === 'function' && Component.prototype && Component.prototype.isReactComponent);\n}\n\nexport function isIntrinsicElement(element: React.ReactElement): boolean {\n return typeof element.type === 'string';\n}\n\nexport function isRefableElement(element: React.ReactElement): boolean {\n return Boolean(isIntrinsicElement(element) || isClassComponent(element.type) || isForwardRef(element));\n}\n\nexport function escapeRegExpSpecChars(s: string): string {\n return s.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\n\nexport const getRandomID = (): string => Math.random().toString(16).slice(2);\n\nexport const isExternalLink = (link: string): boolean => {\n return isBrowser(globalObject) && new RegExp(`^(https?:)?//(?!${globalObject.location.host})\\\\S+`, 'gi').test(link);\n};\n\n/**\n * Check if the given ReactNode is an element of the specified ReactUI component\n */\nexport const isReactUINode = (componentName: string, node: React.ReactNode): boolean => {\n if (isValidElement(node)) {\n return (\n Object.prototype.hasOwnProperty.call(node.type, '__KONTUR_REACT_UI__') &&\n // @ts-expect-error: React doesn't know about existence of __KONTUR_REACT_UI__.\n node.type.__KONTUR_REACT_UI__ === componentName\n );\n }\n\n return false;\n};\n\nconst KB = 1024;\nconst UNITS = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\nconst calculateDecimals = (decimals: number) => {\n if (decimals < 0) {\n return 0;\n }\n\n return 0;\n};\n\nexport const formatBytes = (bytes: number, decimals = 2): string | null => {\n if (bytes === 0) {\n return '0 Bytes';\n }\n\n if (!bytes) {\n return null;\n }\n\n const calculatedDecimals = calculateDecimals(decimals);\n\n const i = Math.floor(Math.log2(bytes) / Math.log2(KB));\n const formattedBytes = parseFloat((bytes / Math.pow(KB, i)).toFixed(calculatedDecimals));\n\n return `${formattedBytes} ${UNITS[i]}`;\n};\n\n/**\n * Проверяет, не является ли переданный аргумент null или undefined и исключает типы null и undefined из типа аргумента\n *\n * @param value Значение, которое нужно проверить и исключить из него типы\n * @returns Возвращает true, если переданный аргумент не является null или undefined иначе false\n */\nexport const isNonNullable = <T>(value: T): value is NonNullable<T> => {\n return value !== null && value !== undefined;\n};\n\n/**\n * Checks if the value `null` or `undefined`.\n *\n * @param value Value to check for `null` and `undefined`.\n * @returns Returns `true` if `value` is `null` or `undefined`, else `false`.\n */\nexport const isNullable = (value: unknown): value is null | undefined => {\n return value === null || value === undefined;\n};\n\n/**\n * Creates a function that checks if the given `child`\n * is an instance of some component specified by `name`.\n *\n * @param name Component name for which function will be created.\n * @returns A function that checks if the given `child` is an instance of the component specified by `name`.\n */\nexport const isReactUIComponent = <P = any>(name: string) => {\n return (child: React.ReactNode): child is React.ReactElement<P> => {\n // @ts-expect-error: Property `type` doesn't exist on type `React.ReactNode`, but exists on type `React.ReactElement` meanwhile `React.ReactElement` is not compatible with `React` `children` type.\n return child?.type?.__KONTUR_REACT_UI__ === name;\n };\n};\n\n/**\n * Checks if a component instance is a ReactUI component with the given name.\n *\n * @typeParam T Expected ReactUI component type.\n * @param instance Component instance.\n * @param componentName ReactUI component name.\n * @returns `true` if it matches, otherwise `false`.\n */\nexport const isReactUIInstance = <T extends React.Component>(\n instance: React.Component,\n componentName: string,\n): instance is T => {\n const constructor = instance?.constructor;\n return '__KONTUR_REACT_UI__' in constructor && constructor.__KONTUR_REACT_UI__ === componentName;\n};\n\n/** @deprecated Переехал в `lib/mergeRefs.ts`. Со следующей мажорной версии от сюда будет удален*/\nexport function mergeRefs<T = any>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T> {\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (isNonNullable(ref)) {\n return ((ref as React.MutableRefObject<T | null>).current = value);\n }\n });\n };\n}\n\n/**\n * Extracts all data attributes from props and returns them as well as props.\n *\n * @param props Props object to extract data attributes from.\n * @returns Separated data attributes and all other props.\n */\nexport const extractDataProps = <T extends Record<string, any>>(props: T) => {\n const dataProps: Record<string, any> = {};\n const restWithoutDataProps: Record<string, any> = {};\n\n Object.entries(props).map(([name, value]) => {\n if (name.startsWith('data-')) {\n return (dataProps[name] = value);\n }\n\n return (restWithoutDataProps[name] = value);\n });\n\n return { dataProps, restWithoutDataProps };\n};\n\n/**\n * Basically `.startsWith` for arrays.\n *\n * @param searchKeys Array of strings to test against `inputString`.\n * @param inputString String on which search will be performed.\n * @returns `true` if `inputString` starts with one of keys, else `false`.\n */\nexport const startsWithOneOf = (searchKeys: string[], inputString: string) => {\n const keyIndex = searchKeys.findIndex((key) => {\n return inputString.startsWith(key);\n });\n\n return keyIndex >= 0;\n};\n\nexport const isButton = isReactUIComponent<ButtonProps>('Button');\nexport const isInput = isReactUIComponent<InputProps>('Input');\nexport const isFxInput = isReactUIComponent<FxInputProps>('FxInput');\nexport const isAutocomplete = isReactUIComponent<AutocompleteProps>('Autocomplete');\nexport const isPasswordInput = isReactUIComponent<PasswordInputProps>('PasswordInput');\nexport const isCurrencyInput = isReactUIComponent<CurrencyInputProps>('CurrencyInput');\nexport const isSelect = isReactUIComponent<SelectProps<unknown, unknown>>('Select');\nexport const isDropdown = isReactUIComponent<DropdownProps>('Dropdown');\nexport const isDropdownMenu = isReactUIComponent<DropdownMenuProps>('DropdownMenu');\nexport const isHint = isReactUIComponent<HintProps>('Hint');\nexport const isTooltip = isReactUIComponent<TooltipProps>('Tooltip');\n\nexport const isKonturIcon = (icon: React.ReactElement) => {\n return Object.prototype.hasOwnProperty.call(icon?.type, '__KONTUR_ICON__');\n};\n\nexport function clickOutside(eventType: 'touchstart' | 'mousedown' | 'pointerup' = 'mousedown') {\n const event = document.createEvent('HTMLEvents');\n event.initEvent(eventType, true, true);\n document.body.dispatchEvent(event);\n}\n\nexport function isElement(el: unknown): el is Element {\n return !!el && typeof el === 'object' && 'nodeType' in el && el.nodeType === Node.ELEMENT_NODE;\n}\n\nexport function isDocument(node?: Document | null): node is Document {\n return !!node && typeof node === 'object' && node.nodeType === Node.DOCUMENT_NODE;\n}\n\nexport function isWindow(node?: Window | null): node is Window {\n return !!node && typeof node === 'object' && node.window === node;\n}\n\nexport function tryGetDocument(node?: Node | null): Document | null {\n return !!node && isDocument(node.ownerDocument) ? node.ownerDocument : null;\n}\n\nexport function tryGetWindow(node?: Node | null): Window | null {\n const doc = tryGetDocument(node);\n return isDocument(doc) ? doc.defaultView : null;\n}\n"],"mappings":";AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;;;;;;;;;;;;;;AAcA,IAAAG,MAAA,GAAAH,OAAA,YAAgCI,OAAA,CAAAC,KAAA,GAAAF,MAAA,CAAAE,KAAA;;AAEhC;;;;;;;;;;;;;;;AAeO,IAAMC,YAAY,GAAAF,OAAA,CAAAE,YAAA,GAAG,SAAfA,YAAYA,CAAA,EAAS;;EAChC,WACD,CAAC;;AAEWC,gBAAgB,GAAAH,OAAA,CAAAG,gBAAA,0BAAAC,MAAA,YAAAD,iBAAA,OAAAE,KAAA,UAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA,KAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA,GAAAN,KAAA,GAAAD,MAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,MAAA,SAAAU,MAAA,CAAAL,IAAA,WAAAJ,KAAA;IACpBU,IAAI,GAAG,kBAAkB,QAAAV,KAAA,MAAAW,eAAA,CAAAC,OAAA,EAAAd,gBAAA,EAAAC,MAAA,SAAAD,gBAAA,qBAAAe,iBAAA,CAAAD,OAAA,EADIE,KAAK;;;AAIpC,SAASC,aAAaA,CAACC,IAAgB,EAAEC,EAAU,EAAE;EAC1D,IAAIC,gBAA4B,GAAG,SAAAA,iBAAA,UAAM,IAAI;;EAE7C,IAAIC,OAAO,CAAC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C9D,IAAMkF,GAAG,GAAGH,cAAc,CAAC/E,IAAI,CAAC;EAChC,OAAO2E,UAAU,CAACO,GAAG,CAAC,GAAGA,GAAG,CAACC,WAAW,GAAG,IAAI;AACjD","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|
|
@@ -286,14 +286,22 @@ export var Autocomplete = (_dec = locale('Autocomplete', AutocompleteLocaleHelpe
|
|
|
286
286
|
}
|
|
287
287
|
_inheritsLoose(Autocomplete, _React$Component);
|
|
288
288
|
var _proto = Autocomplete.prototype; /**
|
|
289
|
-
* @public
|
|
289
|
+
* @public focus method
|
|
290
|
+
* @description Focuses the input.
|
|
291
|
+
* @example
|
|
292
|
+
* <Autocomplete ref={autocompleteRef} />
|
|
293
|
+
* <button onClick={() => autocompleteRef.current?.focus()}>Focus</button>
|
|
290
294
|
*/
|
|
291
295
|
_proto.focus = function focus() {
|
|
292
296
|
if (this.input) {
|
|
293
297
|
this.input.focus();
|
|
294
298
|
}
|
|
295
299
|
} /**
|
|
296
|
-
* @public
|
|
300
|
+
* @public blur method
|
|
301
|
+
* @description Blurs the input.
|
|
302
|
+
* @example
|
|
303
|
+
* <Autocomplete ref={autocompleteRef} />
|
|
304
|
+
* <button onClick={() => autocompleteRef.current?.blur()}>Blur</button>
|
|
297
305
|
*/;
|
|
298
306
|
_proto.blur = function blur() {
|
|
299
307
|
this.handleBlur();
|