@skbkontur/react-ui 4.4.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -1
- package/cjs/components/FileUploader/FileUploader.d.ts +2 -1
- package/cjs/components/FileUploader/FileUploader.js +15 -2
- package/cjs/components/FileUploader/FileUploader.js.map +1 -1
- package/cjs/components/Input/Input.js +2 -1
- package/cjs/components/Input/Input.js.map +1 -1
- package/cjs/components/Input/Input.styles.d.ts +1 -0
- package/cjs/components/Input/Input.styles.js +17 -10
- package/cjs/components/Input/Input.styles.js.map +1 -1
- package/cjs/components/ResponsiveLayout/ResponsiveLayout.d.ts +6 -5
- package/cjs/components/ResponsiveLayout/ResponsiveLayout.js +5 -9
- package/cjs/components/ResponsiveLayout/ResponsiveLayout.js.map +1 -1
- package/cjs/components/ResponsiveLayout/ResponsiveLayout.md +31 -0
- package/cjs/components/ResponsiveLayout/decorator.d.ts +1 -1
- package/cjs/components/ResponsiveLayout/types.d.ts +9 -1
- package/cjs/components/ResponsiveLayout/useResponsiveLayout.d.ts +2 -2
- package/cjs/components/ResponsiveLayout/useResponsiveLayout.js +31 -15
- package/cjs/components/ResponsiveLayout/useResponsiveLayout.js.map +1 -1
- package/cjs/components/Token/Token.styles.js +2 -1
- package/cjs/components/Token/Token.styles.js.map +1 -1
- package/cjs/components/TokenInput/TokenInput.d.ts +3 -0
- package/cjs/components/TokenInput/TokenInput.js +56 -13
- package/cjs/components/TokenInput/TokenInput.js.map +1 -1
- package/cjs/components/TokenInput/TokenInput.md +26 -0
- package/cjs/components/TokenInput/TokenInput.styles.js +2 -1
- package/cjs/components/TokenInput/TokenInput.styles.js.map +1 -1
- package/cjs/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
- package/cjs/internal/themes/DefaultTheme.d.ts +2 -0
- package/cjs/internal/themes/DefaultTheme.js +7 -1
- package/cjs/internal/themes/DefaultTheme.js.map +1 -1
- package/components/FileUploader/FileUploader/FileUploader.js +8 -3
- package/components/FileUploader/FileUploader/FileUploader.js.map +1 -1
- package/components/FileUploader/FileUploader.d.ts +2 -1
- package/components/Input/Input/Input.js +1 -1
- package/components/Input/Input/Input.js.map +1 -1
- package/components/Input/Input.styles/Input.styles.js +13 -10
- package/components/Input/Input.styles/Input.styles.js.map +1 -1
- package/components/Input/Input.styles.d.ts +1 -0
- package/components/ResponsiveLayout/ResponsiveLayout/ResponsiveLayout.js +5 -8
- package/components/ResponsiveLayout/ResponsiveLayout/ResponsiveLayout.js.map +1 -1
- package/components/ResponsiveLayout/ResponsiveLayout.d.ts +6 -5
- package/components/ResponsiveLayout/ResponsiveLayout.md +31 -0
- package/components/ResponsiveLayout/decorator.d.ts +1 -1
- package/components/ResponsiveLayout/types.d.ts +9 -1
- package/components/ResponsiveLayout/useResponsiveLayout/useResponsiveLayout.js +42 -17
- package/components/ResponsiveLayout/useResponsiveLayout/useResponsiveLayout.js.map +1 -1
- package/components/ResponsiveLayout/useResponsiveLayout.d.ts +2 -2
- package/components/Token/Token.styles/Token.styles.js +1 -1
- package/components/Token/Token.styles/Token.styles.js.map +1 -1
- package/components/TokenInput/TokenInput/TokenInput.js +82 -19
- package/components/TokenInput/TokenInput/TokenInput.js.map +1 -1
- package/components/TokenInput/TokenInput.d.ts +3 -0
- package/components/TokenInput/TokenInput.md +26 -0
- package/components/TokenInput/TokenInput.styles/TokenInput.styles.js +1 -1
- package/components/TokenInput/TokenInput.styles/TokenInput.styles.js.map +1 -1
- package/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
- package/internal/themes/DefaultTheme/DefaultTheme.js +10 -0
- package/internal/themes/DefaultTheme/DefaultTheme.js.map +1 -1
- package/internal/themes/DefaultTheme.d.ts +2 -0
- package/package.json +3 -20
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.5.0](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@4.4.0...@skbkontur/react-ui@4.5.0) (2022-08-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **Input:** restore background-clip in focus state ([#2986](https://github.com/skbkontur/retail-ui/issues/2986)) ([5a10fd8](https://github.com/skbkontur/retail-ui/commit/5a10fd84233fe8edcc6cc42cd4ddc6f754512779))
|
|
12
|
+
* **react-ui:** add inputFocusedBg and inputFocusedIconColor variables ([#2981](https://github.com/skbkontur/retail-ui/issues/2981)) ([9bc3f9c](https://github.com/skbkontur/retail-ui/commit/9bc3f9c6a8b3c5aa7f166008b9b1191537e648d6))
|
|
13
|
+
* **TokenInput:** fix some scenarios with disabled input and tokens ([#2943](https://github.com/skbkontur/retail-ui/issues/2943)) ([64c999c](https://github.com/skbkontur/retail-ui/commit/64c999c942357011c0695701e43911bdfdc52559))
|
|
14
|
+
* **ValidationContainer:** fix scroll to invalid field on submit ([#2930](https://github.com/skbkontur/retail-ui/issues/2930)) ([c2b966b](https://github.com/skbkontur/retail-ui/commit/c2b966bc8f2fcaac63e377e4d98669a14de610c3))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **ResponsiveLayout,useResponsiveLayout:** custom media queries ([#2957](https://github.com/skbkontur/retail-ui/issues/2957)) ([7befaf9](https://github.com/skbkontur/retail-ui/commit/7befaf9d9222c95d99150aba37988cec9a5b0326))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [4.4.0](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@4.3.1...@skbkontur/react-ui@4.4.0) (2022-08-16)
|
|
7
26
|
|
|
8
|
-
**Note:** Version bump
|
|
27
|
+
**Note:** Version bump due significan refactoring
|
|
9
28
|
|
|
10
29
|
|
|
11
30
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FileUploaderAttachedFile } from '../../internal/FileUploaderControl/fileUtils';
|
|
3
|
+
import { InstanceWithRootNode } from '../../lib/rootNode';
|
|
3
4
|
import { FileUploaderControlProviderProps } from '../../internal/FileUploaderControl/FileUploaderControlProvider';
|
|
4
5
|
import { CommonProps } from '../../internal/CommonWrapper';
|
|
5
6
|
import { Nullable } from '../../typings/utility-types';
|
|
@@ -30,7 +31,7 @@ interface _FileUploaderProps extends CommonProps, React.InputHTMLAttributes<HTML
|
|
|
30
31
|
* */
|
|
31
32
|
renderFile?: (file: FileUploaderAttachedFile, fileNode: React.ReactElement) => React.ReactNode;
|
|
32
33
|
}
|
|
33
|
-
export interface FileUploaderRef {
|
|
34
|
+
export interface FileUploaderRef extends InstanceWithRootNode {
|
|
34
35
|
focus: () => void;
|
|
35
36
|
blur: () => void;
|
|
36
37
|
/** Сбрасывает выбранные файлы */
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _fileUtils = require("../../internal/FileUploaderControl/fileUtils");
|
|
4
4
|
var _Emotion = require("../../lib/theming/Emotion");
|
|
5
|
+
|
|
5
6
|
var _useMemoObject = require("../../hooks/useMemoObject");
|
|
6
7
|
var _FileUploaderControlContext = require("../../internal/FileUploaderControl/FileUploaderControlContext");
|
|
7
8
|
var _useControlLocale = require("../../internal/FileUploaderControl/hooks/useControlLocale");
|
|
@@ -176,7 +177,12 @@ var _FileUploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
|
|
|
176
177
|
(_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.blur();
|
|
177
178
|
}, []);
|
|
178
179
|
|
|
179
|
-
(0, _react.useImperativeHandle)(ref, function () {return { focus: focus, blur: blur, reset: reset };}, [
|
|
180
|
+
(0, _react.useImperativeHandle)(ref, function () {return { focus: focus, blur: blur, reset: reset, getRootNode: function getRootNode() {return rootNodeRef.current;} };}, [
|
|
181
|
+
ref,
|
|
182
|
+
blur,
|
|
183
|
+
focus,
|
|
184
|
+
reset]);
|
|
185
|
+
|
|
180
186
|
|
|
181
187
|
var _useState = (0, _react.useState)(false),focusedByTab = _useState[0],setFocusedByTab = _useState[1];
|
|
182
188
|
var handleInputChange = function handleInputChange(event) {
|
|
@@ -231,9 +237,16 @@ var _FileUploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
|
|
|
231
237
|
_FileUploader2.jsStyles.linkDisabled(theme)] = disabled, _cx4));
|
|
232
238
|
|
|
233
239
|
|
|
240
|
+
var rootNodeRef = (0, _react.useRef)(null);
|
|
241
|
+
|
|
234
242
|
return /*#__PURE__*/(
|
|
235
243
|
_react.default.createElement(_CommonWrapper.CommonWrapper, props, /*#__PURE__*/
|
|
236
|
-
_react.default.createElement("div", {
|
|
244
|
+
_react.default.createElement("div", {
|
|
245
|
+
"data-tid": FileUploaderDataTids.root,
|
|
246
|
+
className: _FileUploader2.jsStyles.root(theme),
|
|
247
|
+
style: (0, _useMemoObject.useMemoObject)({ width: width }),
|
|
248
|
+
ref: rootNodeRef },
|
|
249
|
+
|
|
237
250
|
!hideFiles && !isSingleMode && !!files.length && /*#__PURE__*/_react.default.createElement(_FileUploaderFileList.FileUploaderFileList, { renderFile: renderFile }), /*#__PURE__*/
|
|
238
251
|
_react.default.createElement("div", { className: uploadButtonWrapperClassNames }, /*#__PURE__*/
|
|
239
252
|
_react.default.createElement("label", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FileUploader.tsx"],"names":["stopPropagation","e","FileUploaderDataTids","root","content","link","defaultRenderFile","file","fileNode","_FileUploader","React","forwardRef","props","ref","theme","ThemeContext","disabled","error","warning","multiple","width","fileUploaderWidth","hideFiles","onBlur","onFocus","onChange","request","validateBeforeUpload","onRequestSuccess","onRequestError","renderFile","inputProps","FileUploaderControlContext","files","setFiles","removeFile","reset","setFileValidationResult","locale","inputRef","isAsync","isSingleMode","upload","tryValidateAndUpload","forEach","validationMessage","id","FileUploaderFileValidationResult","handleChange","newFiles","filesArray","Array","from","attachedFiles","map","getAttachedFile","length","handleDrop","event","dataTransfer","clearData","onDrop","isDraggable","labelRef","isWindowDraggable","windowRef","isBrowser","current","window","document","focus","keyListener","isTabPressed","blur","focusedByTab","setFocusedByTab","handleInputChange","target","handleFocus","requestAnimationFrame","handleBlur","hovered","setHovered","uploadButtonClassNames","jsStyles","uploadButton","uploadButtonFocus","dragOver","uploadButtonWrapperClassNames","windowDragOver","uploadButtonIconClassNames","icon","iconDisabled","hasOneFile","hasOneFileForSingle","linkClassNames","linkHovered","linkDisabled","choosedFile","chooseFile","afterLinkText","singleFile","orDragHere","fileInput","FileUploader","memo","displayName"],"mappings":"4jBAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,sD;;AAEA,IAAMA,eAAwC,GAAG,SAA3CA,eAA2C,CAACC,CAAD,UAAOA,CAAC,CAACD,eAAF,EAAP,EAAjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,IAAME,oBAAoB,GAAG;AAClCC,EAAAA,IAAI,EAAE,oBAD4B;AAElCC,EAAAA,OAAO,EAAE,uBAFyB;AAGlCC,EAAAA,IAAI,EAAE,oBAH4B,EAA7B,C;;;AAMP,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,IAAD,EAAiCC,QAAjC,UAAkEA,QAAlE,EAA1B;;AAEA,IAAMC,aAAa,gBAAGC,eAAMC,UAAN,CAAsD,UAACC,KAAD,EAA4BC,GAA5B,EAAoC;AAC9G,MAAMC,KAAK,GAAG,uBAAWC,0BAAX,CAAd;;AAEA;AACEC,EAAAA,QADF;;;;;;;;;;;;;;;AAgBIJ,EAAAA,KAhBJ,CACEI,QADF,CAEEC,KAFF,GAgBIL,KAhBJ,CAEEK,KAFF,CAGEC,OAHF,GAgBIN,KAhBJ,CAGEM,OAHF,m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GAAGxD,MAAM,CAAC4D,WAAV,GAAwB5D,MAAM,CAAC6D,UADrD,CADF;;;AAKE,0CAAK,SAAS,EAAEf,wBAASgB,aAAT,EAAhB;AACGN,IAAAA,mBAAmB;AAClB,0CAAK,SAAS,EAAEV,wBAASiB,UAAT,EAAhB;AACGvE,IAAAA,UAAU,CAACG,KAAK,CAAC,CAAD,CAAN,eAAW,6BAAC,kCAAD,IAAkB,IAAI,EAAEA,KAAK,CAAC,CAAD,CAA7B,GAAX,CADb,CADkB;;;AAKlB;AACGK,IAAAA,MAAM,CAACgE,UADV;AAEE,0CAAK,SAAS,EAAEZ,0BAAhB;AACE,iCAAC,cAAD,OADF,CAFF,CANJ,CALF,CANF;;;;;;AA0BE;AACM3D,IAAAA,UADN;AAEE,MAAA,GAAG,EAAEQ,QAFP;AAGE,MAAA,QAAQ,EAAEvB,QAAQ,GAAG,CAAC,CAAJ,GAAQ,CAH5B;AAIE,MAAA,IAAI,EAAC,MAJP;AAKE,MAAA,QAAQ,EAAEA,QALZ;AAME,MAAA,QAAQ,EAAEG,QANZ;AAOE,MAAA,SAAS,EAAEiE,wBAASmB,SAAT,EAPb;AAQE,MAAA,OAAO,EAAEvG,eARX;AASE,MAAA,QAAQ,EAAE4E,iBATZ;AAUE,MAAA,OAAO,EAAEE,WAVX;AAWE,MAAA,MAAM,EAAEE;AACR;AAZF,QAaE,KAAK,EAAE,EAbT,IA1BF,CADF,CAFF,CADF,CADF;;;;;;;AAmDD,CArNqB,CAAtB;;;;AAyNO,IAAMwB,YAAY,GAAG;AAC1B9F,eAAM+F,IAAN,CAAWhG,aAAX,CAD0B,CAArB,C;;AAGP+F,YAAY,CAACE,WAAb,GAA2B,cAA3B","sourcesContent":["import React, { useCallback, useContext, useImperativeHandle, useRef, useState } from 'react';\n\nimport { FileUploaderAttachedFile, getAttachedFile } from '../../internal/FileUploaderControl/fileUtils';\nimport { cx } from '../../lib/theming/Emotion';\nimport { useMemoObject } from '../../hooks/useMemoObject';\nimport { FileUploaderControlContext } from '../../internal/FileUploaderControl/FileUploaderControlContext';\nimport { useControlLocale } from '../../internal/FileUploaderControl/hooks/useControlLocale';\nimport { useUpload } from '../../internal/FileUploaderControl/hooks/useUpload';\nimport { useDrop } from '../../hooks/useDrop';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { UploadIcon } from '../../internal/icons/16px';\nimport { FileUploaderControlProviderProps } from '../../internal/FileUploaderControl/FileUploaderControlProvider';\nimport { withFileUploaderControlProvider } from '../../internal/FileUploaderControl/withFileUploaderControlProvider';\nimport { keyListener } from '../../lib/events/keyListener';\nimport { FileUploaderFile } from '../../internal/FileUploaderControl/FileUploaderFile/FileUploaderFile';\nimport { FileUploaderFileList } from '../../internal/FileUploaderControl/FileUploaderFileList/FileUploaderFileList';\nimport { isBrowser } from '../../lib/client';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { Nullable } from '../../typings/utility-types';\nimport { FileUploaderFileValidationResult } from '../../internal/FileUploaderControl/FileUploaderFileValidationResult';\n\nimport { jsStyles } from './FileUploader.styles';\n\nconst stopPropagation: React.ReactEventHandler = (e) => e.stopPropagation();\n\ninterface _FileUploaderProps extends CommonProps, React.InputHTMLAttributes<HTMLInputElement> {\n /** Состояние ошибки всего контрола */\n error?: boolean;\n /** Состояние предупреждения всего контрола */\n warning?: boolean;\n /** Свойство ширины. */\n width?: React.CSSProperties['width'];\n /** Свойство, скрывающее отображение файлов. */\n hideFiles?: boolean;\n\n /** Функция, через которую отправляем файлы. Используется для отслеживания статуса загрузки файла. */\n request?: (file: FileUploaderAttachedFile) => Promise<void>;\n /** Срабатывает при удачной попытке отправки через request */\n onRequestSuccess?: (fileId: string) => void;\n /** Срабатывает при неудачной попытке отправки через request */\n onRequestError?: (fileId: string) => void;\n\n /**\n * Функция валидации каждого файла.\n * Срабатывает после выбора файлов и перед попыткой отправить в request.\n * Чтобы вывести валидацию ошибки, промис должен вернуть строку.\n * */\n validateBeforeUpload?: (file: FileUploaderAttachedFile) => Promise<Nullable<string>>;\n\n /**\n * Функция, позволяющая кастомизировать файлы.\n * Через нее можно вешать кастомные валидации на каждый файл.\n * */\n renderFile?: (file: FileUploaderAttachedFile, fileNode: React.ReactElement) => React.ReactNode;\n}\n\nexport interface FileUploaderRef {\n focus: () => void;\n blur: () => void;\n /** Сбрасывает выбранные файлы */\n reset: () => void;\n}\n\nexport const FileUploaderDataTids = {\n root: 'FileUploader__root',\n content: 'FileUploader__content',\n link: 'FileUploader__link',\n} as const;\n\nconst defaultRenderFile = (file: FileUploaderAttachedFile, fileNode: React.ReactElement) => fileNode;\n\nconst _FileUploader = React.forwardRef<FileUploaderRef, _FileUploaderProps>((props: _FileUploaderProps, ref) => {\n const theme = useContext(ThemeContext);\n\n const {\n disabled,\n error,\n warning,\n multiple = false,\n width = theme.fileUploaderWidth,\n hideFiles = false,\n onBlur,\n onFocus,\n onChange,\n request,\n validateBeforeUpload,\n onRequestSuccess,\n onRequestError,\n renderFile = defaultRenderFile,\n ...inputProps\n } = props;\n\n const { files, setFiles, removeFile, reset, setFileValidationResult } = useContext(FileUploaderControlContext);\n\n const locale = useControlLocale();\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n const isAsync = !!request;\n const isSingleMode = !multiple;\n\n const upload = useUpload(request, onRequestSuccess, onRequestError);\n\n const tryValidateAndUpload = useCallback(\n (files: FileUploaderAttachedFile[]) => {\n files.forEach(async (file) => {\n const validationMessage = validateBeforeUpload && (await validateBeforeUpload(file));\n\n if (!validationMessage) {\n isAsync && upload(file);\n } else {\n setFileValidationResult(file.id, FileUploaderFileValidationResult.error(validationMessage));\n }\n });\n },\n [validateBeforeUpload, isAsync, upload, setFileValidationResult],\n );\n\n /** common part **/\n const handleChange = useCallback(\n (newFiles: FileList | null) => {\n if (!newFiles) {\n return;\n }\n\n let filesArray = Array.from(newFiles);\n\n if (isSingleMode) {\n filesArray = [filesArray[0]];\n }\n\n const attachedFiles = filesArray.map(getAttachedFile);\n\n if (isSingleMode && attachedFiles.length && files.length) {\n removeFile(files[0].id);\n }\n\n if (attachedFiles.length) {\n setFiles(attachedFiles);\n tryValidateAndUpload(attachedFiles);\n }\n },\n [tryValidateAndUpload, setFiles, isSingleMode, files, removeFile],\n );\n\n const handleDrop = useCallback(\n (event) => {\n if (disabled) {\n return;\n }\n\n const { dataTransfer } = event;\n const { files } = dataTransfer;\n\n if (files?.length > 0) {\n handleChange(files);\n dataTransfer.clearData();\n }\n },\n [handleChange, disabled],\n );\n\n const { isDraggable, ref: labelRef } = useDrop<HTMLLabelElement>({ onDrop: handleDrop });\n const { isDraggable: isWindowDraggable, ref: windowRef } = useDrop<Document>();\n\n if (isBrowser) {\n windowRef.current = window.document;\n }\n\n const focus = useCallback(() => {\n keyListener.isTabPressed = true;\n inputRef.current?.focus();\n }, []);\n\n const blur = useCallback(() => {\n inputRef.current?.blur();\n }, []);\n\n useImperativeHandle(ref, () => ({ focus, blur, reset }), [blur, focus, reset]);\n\n const [focusedByTab, setFocusedByTab] = useState(false);\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n handleChange(event.target.files);\n };\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n if (!disabled) {\n // focus event fires before keyDown eventlistener\n // so we should check tabPressed in async way\n requestAnimationFrame(() => {\n if (keyListener.isTabPressed) {\n setFocusedByTab(true);\n }\n });\n onFocus?.(e);\n }\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n setFocusedByTab(false);\n if (!disabled) {\n onBlur?.(e);\n }\n };\n\n const [hovered, setHovered] = useState(false);\n\n const uploadButtonClassNames = cx(jsStyles.uploadButton(theme), {\n [jsStyles.uploadButtonFocus(theme)]: focusedByTab,\n [jsStyles.disabled(theme)]: disabled,\n [jsStyles.hovered(theme)]: !disabled && hovered,\n [jsStyles.warning(theme)]: !!warning,\n [jsStyles.error(theme)]: !!error,\n [jsStyles.dragOver(theme)]: isDraggable && !disabled,\n });\n\n const uploadButtonWrapperClassNames = cx({\n [jsStyles.windowDragOver(theme)]: isWindowDraggable && !disabled,\n });\n\n const uploadButtonIconClassNames = cx(jsStyles.icon(theme), {\n [jsStyles.iconDisabled(theme)]: disabled,\n });\n\n const hasOneFile = files.length === 1;\n const hasOneFileForSingle = isSingleMode && hasOneFile && !hideFiles;\n\n const linkClassNames = cx(jsStyles.link(theme), {\n [jsStyles.linkHovered(theme)]: !disabled && hovered,\n [jsStyles.linkDisabled(theme)]: disabled,\n });\n\n return (\n <CommonWrapper {...props}>\n <div data-tid={FileUploaderDataTids.root} className={jsStyles.root(theme)} style={useMemoObject({ width })}>\n {!hideFiles && !isSingleMode && !!files.length && <FileUploaderFileList renderFile={renderFile} />}\n <div className={uploadButtonWrapperClassNames}>\n <label\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n ref={labelRef}\n className={uploadButtonClassNames}\n >\n <div data-tid={FileUploaderDataTids.content} className={jsStyles.content()}>\n <span data-tid={FileUploaderDataTids.link} className={linkClassNames}>\n {hasOneFileForSingle ? locale.choosedFile : locale.chooseFile}\n </span>\n \n <div className={jsStyles.afterLinkText()}>\n {hasOneFileForSingle ? (\n <div className={jsStyles.singleFile()}>\n {renderFile(files[0], <FileUploaderFile file={files[0]} />)}\n </div>\n ) : (\n <>\n {locale.orDragHere} \n <div className={uploadButtonIconClassNames}>\n <UploadIcon />\n </div>\n </>\n )}\n </div>\n </div>\n <input\n {...inputProps}\n ref={inputRef}\n tabIndex={disabled ? -1 : 0}\n type=\"file\"\n disabled={disabled}\n multiple={multiple}\n className={jsStyles.fileInput()}\n onClick={stopPropagation}\n onChange={handleInputChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n // для того, чтобы срабатывало событие change при выборе одного и того же файла подряд\n value={''}\n />\n </label>\n </div>\n </div>\n </CommonWrapper>\n );\n});\n\nexport interface FileUploaderProps extends _FileUploaderProps, FileUploaderControlProviderProps {}\n\nexport const FileUploader = withFileUploaderControlProvider<FileUploaderProps, FileUploaderRef>(\n React.memo(_FileUploader),\n);\nFileUploader.displayName = 'FileUploader';\n"]}
|
|
1
|
+
{"version":3,"sources":["FileUploader.tsx"],"names":["stopPropagation","e","FileUploaderDataTids","root","content","link","defaultRenderFile","file","fileNode","_FileUploader","React","forwardRef","props","ref","theme","ThemeContext","disabled","error","warning","multiple","width","fileUploaderWidth","hideFiles","onBlur","onFocus","onChange","request","validateBeforeUpload","onRequestSuccess","onRequestError","renderFile","inputProps","FileUploaderControlContext","files","setFiles","removeFile","reset","setFileValidationResult","locale","inputRef","isAsync","isSingleMode","upload","tryValidateAndUpload","forEach","validationMessage","id","FileUploaderFileValidationResult","handleChange","newFiles","filesArray","Array","from","attachedFiles","map","getAttachedFile","length","handleDrop","event","dataTransfer","clearData","onDrop","isDraggable","labelRef","isWindowDraggable","windowRef","isBrowser","current","window","document","focus","keyListener","isTabPressed","blur","getRootNode","rootNodeRef","focusedByTab","setFocusedByTab","handleInputChange","target","handleFocus","requestAnimationFrame","handleBlur","hovered","setHovered","uploadButtonClassNames","jsStyles","uploadButton","uploadButtonFocus","dragOver","uploadButtonWrapperClassNames","windowDragOver","uploadButtonIconClassNames","icon","iconDisabled","hasOneFile","hasOneFileForSingle","linkClassNames","linkHovered","linkDisabled","choosedFile","chooseFile","afterLinkText","singleFile","orDragHere","fileInput","FileUploader","memo","displayName"],"mappings":"4jBAAA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,sD;;AAEA,IAAMA,eAAwC,GAAG,SAA3CA,eAA2C,CAACC,CAAD,UAAOA,CAAC,CAACD,eAAF,EAAP,EAAjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,IAAME,oBAAoB,GAAG;AAClCC,EAAAA,IAAI,EAAE,oBAD4B;AAElCC,EAAAA,OAAO,EAAE,uBAFyB;AAGlCC,EAAAA,IAAI,EAAE,oBAH4B,EAA7B,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ME,MAAA,QAAQ,EAAEG,QANZ;AAOE,MAAA,SAAS,EAAEmE,wBAASmB,SAAT,EAPb;AAQE,MAAA,OAAO,EAAEzG,eARX;AASE,MAAA,QAAQ,EAAE8E,iBATZ;AAUE,MAAA,OAAO,EAAEE,WAVX;AAWE,MAAA,MAAM,EAAEE;AACR;AAZF,QAaE,KAAK,EAAE,EAbT,IA1BF,CADF,CAPF,CADF,CADF;;;;;;;AAwDD,CAjOqB,CAAtB;;;;AAqOO,IAAMwB,YAAY,GAAG;AAC1BhG,eAAMiG,IAAN,CAAWlG,aAAX,CAD0B,CAArB,C;;AAGPiG,YAAY,CAACE,WAAb,GAA2B,cAA3B","sourcesContent":["import React, { useCallback, useContext, useImperativeHandle, useRef, useState } from 'react';\n\nimport { FileUploaderAttachedFile, getAttachedFile } from '../../internal/FileUploaderControl/fileUtils';\nimport { cx } from '../../lib/theming/Emotion';\nimport { InstanceWithRootNode } from '../../lib/rootNode';\nimport { useMemoObject } from '../../hooks/useMemoObject';\nimport { FileUploaderControlContext } from '../../internal/FileUploaderControl/FileUploaderControlContext';\nimport { useControlLocale } from '../../internal/FileUploaderControl/hooks/useControlLocale';\nimport { useUpload } from '../../internal/FileUploaderControl/hooks/useUpload';\nimport { useDrop } from '../../hooks/useDrop';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { UploadIcon } from '../../internal/icons/16px';\nimport { FileUploaderControlProviderProps } from '../../internal/FileUploaderControl/FileUploaderControlProvider';\nimport { withFileUploaderControlProvider } from '../../internal/FileUploaderControl/withFileUploaderControlProvider';\nimport { keyListener } from '../../lib/events/keyListener';\nimport { FileUploaderFile } from '../../internal/FileUploaderControl/FileUploaderFile/FileUploaderFile';\nimport { FileUploaderFileList } from '../../internal/FileUploaderControl/FileUploaderFileList/FileUploaderFileList';\nimport { isBrowser } from '../../lib/client';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { Nullable } from '../../typings/utility-types';\nimport { FileUploaderFileValidationResult } from '../../internal/FileUploaderControl/FileUploaderFileValidationResult';\n\nimport { jsStyles } from './FileUploader.styles';\n\nconst stopPropagation: React.ReactEventHandler = (e) => e.stopPropagation();\n\ninterface _FileUploaderProps extends CommonProps, React.InputHTMLAttributes<HTMLInputElement> {\n /** Состояние ошибки всего контрола */\n error?: boolean;\n /** Состояние предупреждения всего контрола */\n warning?: boolean;\n /** Свойство ширины. */\n width?: React.CSSProperties['width'];\n /** Свойство, скрывающее отображение файлов. */\n hideFiles?: boolean;\n\n /** Функция, через которую отправляем файлы. Используется для отслеживания статуса загрузки файла. */\n request?: (file: FileUploaderAttachedFile) => Promise<void>;\n /** Срабатывает при удачной попытке отправки через request */\n onRequestSuccess?: (fileId: string) => void;\n /** Срабатывает при неудачной попытке отправки через request */\n onRequestError?: (fileId: string) => void;\n\n /**\n * Функция валидации каждого файла.\n * Срабатывает после выбора файлов и перед попыткой отправить в request.\n * Чтобы вывести валидацию ошибки, промис должен вернуть строку.\n * */\n validateBeforeUpload?: (file: FileUploaderAttachedFile) => Promise<Nullable<string>>;\n\n /**\n * Функция, позволяющая кастомизировать файлы.\n * Через нее можно вешать кастомные валидации на каждый файл.\n * */\n renderFile?: (file: FileUploaderAttachedFile, fileNode: React.ReactElement) => React.ReactNode;\n}\n\nexport interface FileUploaderRef extends InstanceWithRootNode {\n focus: () => void;\n blur: () => void;\n /** Сбрасывает выбранные файлы */\n reset: () => void;\n}\n\nexport const FileUploaderDataTids = {\n root: 'FileUploader__root',\n content: 'FileUploader__content',\n link: 'FileUploader__link',\n} as const;\n\nconst defaultRenderFile = (file: FileUploaderAttachedFile, fileNode: React.ReactElement) => fileNode;\n\nconst _FileUploader = React.forwardRef<FileUploaderRef, _FileUploaderProps>((props: _FileUploaderProps, ref) => {\n const theme = useContext(ThemeContext);\n\n const {\n disabled,\n error,\n warning,\n multiple = false,\n width = theme.fileUploaderWidth,\n hideFiles = false,\n onBlur,\n onFocus,\n onChange,\n request,\n validateBeforeUpload,\n onRequestSuccess,\n onRequestError,\n renderFile = defaultRenderFile,\n ...inputProps\n } = props;\n\n const { files, setFiles, removeFile, reset, setFileValidationResult } = useContext(FileUploaderControlContext);\n\n const locale = useControlLocale();\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n const isAsync = !!request;\n const isSingleMode = !multiple;\n\n const upload = useUpload(request, onRequestSuccess, onRequestError);\n\n const tryValidateAndUpload = useCallback(\n (files: FileUploaderAttachedFile[]) => {\n files.forEach(async (file) => {\n const validationMessage = validateBeforeUpload && (await validateBeforeUpload(file));\n\n if (!validationMessage) {\n isAsync && upload(file);\n } else {\n setFileValidationResult(file.id, FileUploaderFileValidationResult.error(validationMessage));\n }\n });\n },\n [validateBeforeUpload, isAsync, upload, setFileValidationResult],\n );\n\n /** common part **/\n const handleChange = useCallback(\n (newFiles: FileList | null) => {\n if (!newFiles) {\n return;\n }\n\n let filesArray = Array.from(newFiles);\n\n if (isSingleMode) {\n filesArray = [filesArray[0]];\n }\n\n const attachedFiles = filesArray.map(getAttachedFile);\n\n if (isSingleMode && attachedFiles.length && files.length) {\n removeFile(files[0].id);\n }\n\n if (attachedFiles.length) {\n setFiles(attachedFiles);\n tryValidateAndUpload(attachedFiles);\n }\n },\n [tryValidateAndUpload, setFiles, isSingleMode, files, removeFile],\n );\n\n const handleDrop = useCallback(\n (event) => {\n if (disabled) {\n return;\n }\n\n const { dataTransfer } = event;\n const { files } = dataTransfer;\n\n if (files?.length > 0) {\n handleChange(files);\n dataTransfer.clearData();\n }\n },\n [handleChange, disabled],\n );\n\n const { isDraggable, ref: labelRef } = useDrop<HTMLLabelElement>({ onDrop: handleDrop });\n const { isDraggable: isWindowDraggable, ref: windowRef } = useDrop<Document>();\n\n if (isBrowser) {\n windowRef.current = window.document;\n }\n\n const focus = useCallback(() => {\n keyListener.isTabPressed = true;\n inputRef.current?.focus();\n }, []);\n\n const blur = useCallback(() => {\n inputRef.current?.blur();\n }, []);\n\n useImperativeHandle(ref, () => ({ focus, blur, reset, getRootNode: () => rootNodeRef.current }), [\n ref,\n blur,\n focus,\n reset,\n ]);\n\n const [focusedByTab, setFocusedByTab] = useState(false);\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n handleChange(event.target.files);\n };\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n if (!disabled) {\n // focus event fires before keyDown eventlistener\n // so we should check tabPressed in async way\n requestAnimationFrame(() => {\n if (keyListener.isTabPressed) {\n setFocusedByTab(true);\n }\n });\n onFocus?.(e);\n }\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n setFocusedByTab(false);\n if (!disabled) {\n onBlur?.(e);\n }\n };\n\n const [hovered, setHovered] = useState(false);\n\n const uploadButtonClassNames = cx(jsStyles.uploadButton(theme), {\n [jsStyles.uploadButtonFocus(theme)]: focusedByTab,\n [jsStyles.disabled(theme)]: disabled,\n [jsStyles.hovered(theme)]: !disabled && hovered,\n [jsStyles.warning(theme)]: !!warning,\n [jsStyles.error(theme)]: !!error,\n [jsStyles.dragOver(theme)]: isDraggable && !disabled,\n });\n\n const uploadButtonWrapperClassNames = cx({\n [jsStyles.windowDragOver(theme)]: isWindowDraggable && !disabled,\n });\n\n const uploadButtonIconClassNames = cx(jsStyles.icon(theme), {\n [jsStyles.iconDisabled(theme)]: disabled,\n });\n\n const hasOneFile = files.length === 1;\n const hasOneFileForSingle = isSingleMode && hasOneFile && !hideFiles;\n\n const linkClassNames = cx(jsStyles.link(theme), {\n [jsStyles.linkHovered(theme)]: !disabled && hovered,\n [jsStyles.linkDisabled(theme)]: disabled,\n });\n\n const rootNodeRef = useRef(null);\n\n return (\n <CommonWrapper {...props}>\n <div\n data-tid={FileUploaderDataTids.root}\n className={jsStyles.root(theme)}\n style={useMemoObject({ width })}\n ref={rootNodeRef}\n >\n {!hideFiles && !isSingleMode && !!files.length && <FileUploaderFileList renderFile={renderFile} />}\n <div className={uploadButtonWrapperClassNames}>\n <label\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n ref={labelRef}\n className={uploadButtonClassNames}\n >\n <div data-tid={FileUploaderDataTids.content} className={jsStyles.content()}>\n <span data-tid={FileUploaderDataTids.link} className={linkClassNames}>\n {hasOneFileForSingle ? locale.choosedFile : locale.chooseFile}\n </span>\n \n <div className={jsStyles.afterLinkText()}>\n {hasOneFileForSingle ? (\n <div className={jsStyles.singleFile()}>\n {renderFile(files[0], <FileUploaderFile file={files[0]} />)}\n </div>\n ) : (\n <>\n {locale.orDragHere} \n <div className={uploadButtonIconClassNames}>\n <UploadIcon />\n </div>\n </>\n )}\n </div>\n </div>\n <input\n {...inputProps}\n ref={inputRef}\n tabIndex={disabled ? -1 : 0}\n type=\"file\"\n disabled={disabled}\n multiple={multiple}\n className={jsStyles.fileInput()}\n onClick={stopPropagation}\n onChange={handleInputChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n // для того, чтобы срабатывало событие change при выборе одного и того же файла подряд\n value={''}\n />\n </label>\n </div>\n </div>\n </CommonWrapper>\n );\n});\n\nexport interface FileUploaderProps extends _FileUploaderProps, FileUploaderControlProviderProps {}\n\nexport const FileUploader = withFileUploaderControlProvider<FileUploaderProps, FileUploaderRef>(\n React.memo(_FileUploader),\n);\nFileUploader.displayName = 'FileUploader';\n"]}
|
|
@@ -459,6 +459,7 @@ Input = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/functio
|
|
|
459
459
|
|
|
460
460
|
|
|
461
461
|
|
|
462
|
+
|
|
462
463
|
|
|
463
464
|
|
|
464
465
|
refInput = function (element) {
|
|
@@ -583,4 +584,4 @@ Input = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/functio
|
|
|
583
584
|
* @param {number} end
|
|
584
585
|
*/;_proto.setSelectionRange = function setSelectionRange(start, end) {if (!this.input) {throw new Error('Cannot call "setSelectionRange" on unmounted Input');}if (document.activeElement !== this.input) {this.focus();}this.input.setSelectionRange(start, end);};_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.props), _this3.renderMain);});} /**
|
|
585
586
|
* @public
|
|
586
|
-
*/;_proto.renderMaskedInput = function renderMaskedInput(inputProps, mask) {return /*#__PURE__*/_react.default.createElement(_MaskedInput.MaskedInput, (0, _extends2.default)({}, inputProps, { mask: mask, maskChar: this.props.maskChar, alwaysShowMask: this.props.alwaysShowMask, formatChars: this.props.formatChars, onChange: this.props.onChange, onValueChange: this.handleMaskedValueChange, onUnexpectedInput: this.handleUnexpectedInput }));};_proto.getIconSizeClassname = function getIconSizeClassname(right) {if (right === void 0) {right = false;}switch (this.getProps().size) {case 'large':return right ? _Input.styles.rightIconLarge(this.theme) : _Input.styles.leftIconLarge(this.theme);case 'medium':return right ? _Input.styles.rightIconMedium(this.theme) : _Input.styles.leftIconMedium(this.theme);case 'small':default:return right ? _Input.styles.rightIconSmall(this.theme) : _Input.styles.leftIconSmall(this.theme);}};_proto.renderLeftIcon = function renderLeftIcon() {return this.renderIcon(this.props.leftIcon, this.getIconSizeClassname());};_proto.renderRightIcon = function renderRightIcon() {return this.renderIcon(this.props.rightIcon, this.getIconSizeClassname(true));};_proto.renderIcon = function renderIcon(icon, sizeClassName) {var _cx5;if (!icon) {return null;}var disabled = this.props.disabled;var iconNode = icon instanceof Function ? icon() : icon;return /*#__PURE__*/_react.default.createElement("span", { className: (0, _Emotion.cx)(_Input.styles.icon(), sizeClassName, _Input.styles.useDefaultColor(this.theme), (_cx5 = {}, _cx5[_Input.styles.iconDisabled()] = disabled, _cx5)) }, iconNode);};_proto.renderPlaceholder = function renderPlaceholder() {var disabled = this.props.disabled;var focused = this.state.focused;var placeholder = null;if (this.state.needsPolyfillPlaceholder && this.props.placeholder && !this.isMaskVisible && !this.props.value && !this.props.defaultValue) {var _cx6;placeholder = /*#__PURE__*/_react.default.createElement("div", { className: (0, _Emotion.cx)(_Input.styles.placeholder(this.theme), (_cx6 = {}, _cx6[_Input.styles.placeholderDisabled(this.theme)] = disabled, _cx6[_Input.styles.placeholderFocus(this.theme)] = focused, _cx6)), style: { textAlign: this.props.align || 'inherit' } }, this.props.placeholder);}return placeholder;};_proto.getSizeClassName = function getSizeClassName() {var _cx7, _cx8, _cx9;switch (this.getProps().size) {case 'large':return (0, _Emotion.cx)((_cx7 = {}, _cx7[_Input.styles.sizeLarge(this.theme)] = true, _cx7[_Input.styles.sizeLargeFallback(this.theme)] = _client.isIE11 || _client.isEdge, _cx7));case 'medium':return (0, _Emotion.cx)((_cx8 = {}, _cx8[_Input.styles.sizeMedium(this.theme)] = true, _cx8[_Input.styles.sizeMediumFallback(this.theme)] = _client.isIE11 || _client.isEdge, _cx8));case 'small':default:return (0, _Emotion.cx)((_cx9 = {}, _cx9[_Input.styles.sizeSmall(this.theme)] = true, _cx9[_Input.styles.sizeSmallFallback(this.theme)] = _client.isIE11 || _client.isEdge, _cx9));}};(0, _createClass2.default)(Input, [{ key: "isMaskVisible", get: function get() {var _this$props3 = this.props,mask = _this$props3.mask,alwaysShowMask = _this$props3.alwaysShowMask;var focused = this.state.focused;return Boolean(mask && (focused || alwaysShowMask));} }]);return Input;}(_react.default.Component), _class2.__KONTUR_REACT_UI__ = 'Input', _class2.defaultProps = { size: 'small' }, _temp)) || _class;exports.Input = Input;
|
|
587
|
+
*/;_proto.renderMaskedInput = function renderMaskedInput(inputProps, mask) {return /*#__PURE__*/_react.default.createElement(_MaskedInput.MaskedInput, (0, _extends2.default)({}, inputProps, { mask: mask, maskChar: this.props.maskChar, alwaysShowMask: this.props.alwaysShowMask, formatChars: this.props.formatChars, onChange: this.props.onChange, onValueChange: this.handleMaskedValueChange, onUnexpectedInput: this.handleUnexpectedInput }));};_proto.getIconSizeClassname = function getIconSizeClassname(right) {if (right === void 0) {right = false;}switch (this.getProps().size) {case 'large':return right ? _Input.styles.rightIconLarge(this.theme) : _Input.styles.leftIconLarge(this.theme);case 'medium':return right ? _Input.styles.rightIconMedium(this.theme) : _Input.styles.leftIconMedium(this.theme);case 'small':default:return right ? _Input.styles.rightIconSmall(this.theme) : _Input.styles.leftIconSmall(this.theme);}};_proto.renderLeftIcon = function renderLeftIcon() {return this.renderIcon(this.props.leftIcon, this.getIconSizeClassname());};_proto.renderRightIcon = function renderRightIcon() {return this.renderIcon(this.props.rightIcon, this.getIconSizeClassname(true));};_proto.renderIcon = function renderIcon(icon, sizeClassName) {var _cx5;if (!icon) {return null;}var disabled = this.props.disabled;var iconNode = icon instanceof Function ? icon() : icon;return /*#__PURE__*/_react.default.createElement("span", { className: (0, _Emotion.cx)(_Input.styles.icon(), sizeClassName, _Input.styles.useDefaultColor(this.theme), (_cx5 = {}, _cx5[_Input.styles.iconFocus(this.theme)] = this.state.focused, _cx5[_Input.styles.iconDisabled()] = disabled, _cx5)) }, iconNode);};_proto.renderPlaceholder = function renderPlaceholder() {var disabled = this.props.disabled;var focused = this.state.focused;var placeholder = null;if (this.state.needsPolyfillPlaceholder && this.props.placeholder && !this.isMaskVisible && !this.props.value && !this.props.defaultValue) {var _cx6;placeholder = /*#__PURE__*/_react.default.createElement("div", { className: (0, _Emotion.cx)(_Input.styles.placeholder(this.theme), (_cx6 = {}, _cx6[_Input.styles.placeholderDisabled(this.theme)] = disabled, _cx6[_Input.styles.placeholderFocus(this.theme)] = focused, _cx6)), style: { textAlign: this.props.align || 'inherit' } }, this.props.placeholder);}return placeholder;};_proto.getSizeClassName = function getSizeClassName() {var _cx7, _cx8, _cx9;switch (this.getProps().size) {case 'large':return (0, _Emotion.cx)((_cx7 = {}, _cx7[_Input.styles.sizeLarge(this.theme)] = true, _cx7[_Input.styles.sizeLargeFallback(this.theme)] = _client.isIE11 || _client.isEdge, _cx7));case 'medium':return (0, _Emotion.cx)((_cx8 = {}, _cx8[_Input.styles.sizeMedium(this.theme)] = true, _cx8[_Input.styles.sizeMediumFallback(this.theme)] = _client.isIE11 || _client.isEdge, _cx8));case 'small':default:return (0, _Emotion.cx)((_cx9 = {}, _cx9[_Input.styles.sizeSmall(this.theme)] = true, _cx9[_Input.styles.sizeSmallFallback(this.theme)] = _client.isIE11 || _client.isEdge, _cx9));}};(0, _createClass2.default)(Input, [{ key: "isMaskVisible", get: function get() {var _this$props3 = this.props,mask = _this$props3.mask,alwaysShowMask = _this$props3.alwaysShowMask;var focused = this.state.focused;return Boolean(mask && (focused || alwaysShowMask));} }]);return Input;}(_react.default.Component), _class2.__KONTUR_REACT_UI__ = 'Input', _class2.defaultProps = { size: 'small' }, _temp)) || _class;exports.Input = Input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Input.tsx"],"names":["InputDataTids","root","Input","rootNode","getProps","defaultProps","state","needsPolyfillPlaceholder","blinking","focused","selectAllId","blinkTimeout","input","selectAll","setSelectionRange","value","length","delaySelectAll","cancelDelayedSelectAll","raf","cancel","cancelBlink","callback","clearTimeout","setState","renderMain","props","onMouseEnter","onMouseLeave","onMouseOver","onKeyDown","onKeyPress","onValueChange","width","error","warning","leftIcon","rightIcon","borderless","align","type","mask","maskChar","alwaysShowMask","size","placeholder","selectAllOnFocus","disabled","onUnexpectedInput","prefix","suffix","formatChars","rest","labelProps","className","styles","theme","getSizeClassName","focus","blink","focusFallback","isIE11","isEdge","warningFallback","errorFallback","style","inputProps","inputFocus","inputDisabled","onChange","handleChange","onFocus","handleFocus","handleKeyDown","handleKeyPress","onBlur","handleBlur","textAlign","ref","refInput","isMaskVisible","undefined","renderMaskedInput","React","createElement","sideContainer","renderLeftIcon","renderPrefix","wrapper","renderPlaceholder","rightContainer","renderSuffix","renderRightIcon","element","MaskedInput","event","fieldIsEmpty","target","e","isDeleteKey","isKeyBackspace","isKeyDelete","currentTarget","repeat","handleUnexpectedInput","maxLength","handleMaskedValueChange","prefixDisabled","suffixDisabled","componentWillUnmount","blur","getNode","offsetWidth","window","setTimeout","start","end","Error","document","activeElement","render","setRootNode","getIconSizeClassname","right","rightIconLarge","leftIconLarge","rightIconMedium","leftIconMedium","rightIconSmall","leftIconSmall","renderIcon","icon","sizeClassName","iconNode","Function","useDefaultColor","iconDisabled","defaultValue","placeholderDisabled","placeholderFocus","sizeLarge","sizeLargeFallback","sizeMedium","sizeMediumFallback","sizeSmall","sizeSmallFallback","Boolean","Component","__KONTUR_REACT_UI__"],"mappings":";;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FO,IAAMA,aAAa,GAAG;AAC3BC,EAAAA,IAAI,EAAE,aADqB,EAAtB,C;;;;;AAMP;AACA;AACA;AACA,G;;AAEaC,K,OADZC,kB;;;;;;;AAQSC,IAAAA,Q,GAAW,0CAAkBF,KAAK,CAACG,YAAxB,C;;AAEZC,IAAAA,K,GAAoB;AACzBC,MAAAA,wBAAwB,EAAxBA,kDADyB;AAEzBC,MAAAA,QAAQ,EAAE,KAFe;AAGzBC,MAAAA,OAAO,EAAE,KAHgB,E;;;AAMnBC,IAAAA,W,GAA6B,I;;AAE7BC,IAAAA,Y,GAAe,C;AACfC,IAAAA,K,GAAiC,I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FlCC,IAAAA,S,GAAY,YAAY;AAC7B,UAAI,MAAKD,KAAT,EAAgB;AACd,cAAKE,iBAAL,CAAuB,CAAvB,EAA0B,MAAKF,KAAL,CAAWG,KAAX,CAAiBC,MAA3C;AACD;AACF,K;;AAEOC,IAAAA,c,GAAiB,oBAAe,MAAKP,WAAL,GAAmB,kBAAI,MAAKG,SAAT,CAAlC,E;;AAEjBK,IAAAA,sB,GAAyB,YAAY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ACA,OAAOyI,OAAO,CAACzG,IAAI,KAAKhC,OAAO,IAAIkC,cAAhB,CAAL,CAAd,CACD,C,oBA1FwBwC,eAAMgE,S,WACjBC,mB,GAAsB,O,UAEtB/I,Y,GAA6B,EACzCuC,IAAI,EAAE,OADmC,E","sourcesContent":["// TODO: Enable this rule in functional components.\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport invariant from 'invariant';\nimport React from 'react';\nimport raf from 'raf';\n\nimport { isIE11, isEdge } from '../../lib/client';\nimport { isKeyBackspace, isKeyDelete, someKeys } from '../../lib/events/keyboard/identifiers';\nimport { needsPolyfillPlaceholder } from '../../lib/needsPolyfillPlaceholder';\nimport { Nullable, Override } from '../../typings/utility-types';\nimport { MaskedInput } from '../../internal/MaskedInput';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { CommonWrapper, CommonProps, CommonWrapperRestProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { styles } from './Input.styles';\n\nexport type InputSize = 'small' | 'medium' | 'large';\nexport type InputAlign = 'left' | 'center' | 'right';\nexport type InputType = 'password' | 'text';\nexport type InputIconType = React.ReactNode | (() => React.ReactNode);\n\nexport interface InputProps\n extends CommonProps,\n Override<\n React.InputHTMLAttributes<HTMLInputElement>,\n {\n /**\n * Иконка слева\n * Если `ReactNode` применяются дефолтные стили для иконки\n * Если `() => ReactNode` применяются только стили для позиционирование\n */\n leftIcon?: InputIconType;\n /**\n * Иконка справа\n * Если `ReactNode` применяются дефолтные стили для иконки\n * Если `() => ReactNode` применяются только стили для позиционирование\n */\n rightIcon?: InputIconType;\n /**\n * Состояние валидации при ошибке.\n */\n error?: boolean;\n /**\n * Состояние валидации при предупреждении.\n */\n warning?: boolean;\n /** Режим прозрачной рамки */\n borderless?: boolean;\n /** Выравнивание текста */\n align?: InputAlign;\n /** Паттерн маски */\n mask?: Nullable<string>;\n /** Символ маски */\n maskChar?: Nullable<string>;\n /**\n * Словарь символов-регулярок для задания маски\n * @default { '9': '[0-9]', 'a': '[A-Za-z]', '*': '[A-Za-z0-9]' }\n */\n formatChars?: Record<string, string>;\n /** Показывать символы маски */\n alwaysShowMask?: boolean;\n /** Размер */\n size?: InputSize;\n /** onValueChange */\n onValueChange?: (value: string) => void;\n /** Вызывается на label */\n onMouseEnter?: React.MouseEventHandler<HTMLLabelElement>;\n /** Вызывается на label */\n onMouseLeave?: React.MouseEventHandler<HTMLLabelElement>;\n /** Вызывается на label */\n onMouseOver?: React.MouseEventHandler<HTMLLabelElement>;\n /** Тип */\n type?: InputType;\n /** Значение */\n value?: string;\n capture?: boolean;\n\n /**\n * Префикс\n * `ReactNode` перед значением, но после иконки\n */\n prefix?: React.ReactNode;\n /**\n * Суффикс\n * `ReactNode` после значения, но перед правой иконкой\n */\n suffix?: React.ReactNode;\n /** Выделять введенное значение при фокусе */\n selectAllOnFocus?: boolean;\n /**\n * Обработчик неправильного ввода.\n * По-умолчанию, инпут вспыхивает синим.\n * Если передан - вызывается переданный обработчик,\n * в таком случае вспыхивание можно вызвать\n * публичным методом инстанса `blink()`.\n *\n * @param value значение инпута.\n */\n onUnexpectedInput?: (value: string) => void;\n }\n > {}\n\nexport interface InputState {\n blinking: boolean;\n focused: boolean;\n needsPolyfillPlaceholder: boolean;\n}\n\nexport const InputDataTids = {\n root: 'Input__root',\n} as const;\n\ntype DefaultProps = Required<Pick<InputProps, 'size'>>;\n\n/**\n * Интерфейс пропсов наследуется от `React.InputHTMLAttributes<HTMLInputElement>`.\n * Все пропсы кроме перечисленных, `className` и `style` передаются в `<input>`\n */\n@rootNode\nexport class Input extends React.Component<InputProps, InputState> {\n public static __KONTUR_REACT_UI__ = 'Input';\n\n public static defaultProps: DefaultProps = {\n size: 'small',\n };\n\n private getProps = createPropsGetter(Input.defaultProps);\n\n public state: InputState = {\n needsPolyfillPlaceholder,\n blinking: false,\n focused: false,\n };\n\n private selectAllId: number | null = null;\n private theme!: Theme;\n private blinkTimeout = 0;\n private input: HTMLInputElement | null = null;\n private setRootNode!: TSetRootNode;\n\n public componentWillUnmount() {\n if (this.blinkTimeout) {\n clearTimeout(this.blinkTimeout);\n }\n this.cancelDelayedSelectAll();\n }\n\n /**\n * @public\n */\n public focus() {\n invariant(this.input, 'Cannot call \"focus\" because Input is not mounted');\n this.input.focus();\n }\n\n /**\n * @public\n */\n public blur() {\n invariant(this.input, 'Cannot call \"blur\" because Input is not mounted');\n this.input.blur();\n }\n\n /**\n * @public\n */\n public getNode() {\n return this.input;\n }\n\n /**\n * @public\n */\n public blink() {\n if (this.blinkTimeout) {\n this.cancelBlink(() => {\n // trigger reflow to restart animation\n // @see https://css-tricks.com/restart-css-animation/#article-header-id-0\n void (this.input && this.input.offsetWidth);\n this.blink();\n });\n return;\n }\n this.setState({ blinking: true }, () => {\n this.blinkTimeout = window.setTimeout(this.cancelBlink, 150);\n });\n }\n\n /**\n * @public\n * @param {number} start\n * @param {number} end\n */\n public setSelectionRange(start: number, end: number) {\n if (!this.input) {\n throw new Error('Cannot call \"setSelectionRange\" on unmounted Input');\n }\n\n if (document.activeElement !== this.input) {\n this.focus();\n }\n\n this.input.setSelectionRange(start, end);\n }\n\n public get isMaskVisible(): boolean {\n const { mask, alwaysShowMask } = this.props;\n const { focused } = this.state;\n return Boolean(mask && (focused || alwaysShowMask));\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.props}>\n {this.renderMain}\n </CommonWrapper>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n /**\n * @public\n */\n public selectAll = (): void => {\n if (this.input) {\n this.setSelectionRange(0, this.input.value.length);\n }\n };\n\n private delaySelectAll = (): number => (this.selectAllId = raf(this.selectAll));\n\n private cancelDelayedSelectAll = (): void => {\n if (this.selectAllId) {\n raf.cancel(this.selectAllId);\n this.selectAllId = null;\n }\n };\n\n private cancelBlink = (callback?: () => void): void => {\n if (this.blinkTimeout) {\n clearTimeout(this.blinkTimeout);\n this.blinkTimeout = 0;\n if (this.state.blinking) {\n this.setState({ blinking: false }, callback);\n return;\n }\n }\n if (callback) {\n callback();\n }\n };\n\n private renderMain = (props: CommonWrapperRestProps<InputProps>) => {\n const {\n onMouseEnter,\n onMouseLeave,\n onMouseOver,\n onKeyDown,\n onKeyPress,\n onValueChange,\n width,\n error,\n warning,\n leftIcon,\n rightIcon,\n borderless,\n value,\n align,\n type,\n mask,\n maskChar,\n alwaysShowMask,\n size,\n placeholder,\n selectAllOnFocus,\n disabled,\n onUnexpectedInput,\n prefix,\n suffix,\n formatChars,\n ...rest\n } = props;\n\n const { blinking, focused } = this.state;\n\n const labelProps = {\n className: cx(styles.root(this.theme), this.getSizeClassName(), {\n [styles.focus(this.theme)]: focused,\n [styles.blink(this.theme)]: blinking,\n [styles.borderless()]: borderless && !focused,\n [styles.disabled(this.theme)]: disabled,\n [styles.warning(this.theme)]: warning,\n [styles.error(this.theme)]: error,\n [styles.focusFallback(this.theme)]: focused && (isIE11 || isEdge),\n [styles.warningFallback(this.theme)]: warning && (isIE11 || isEdge),\n [styles.errorFallback(this.theme)]: error && (isIE11 || isEdge),\n }),\n style: { width },\n onMouseEnter,\n onMouseLeave,\n onMouseOver,\n };\n\n const inputProps = {\n ...rest,\n className: cx(styles.input(this.theme), {\n [styles.inputFocus(this.theme)]: focused,\n [styles.inputDisabled(this.theme)]: disabled,\n }),\n value,\n onChange: this.handleChange,\n onFocus: this.handleFocus,\n onKeyDown: this.handleKeyDown,\n onKeyPress: this.handleKeyPress,\n onBlur: this.handleBlur,\n style: { textAlign: align },\n ref: this.refInput,\n type: 'text',\n placeholder: !this.isMaskVisible && !needsPolyfillPlaceholder ? placeholder : undefined,\n disabled,\n };\n\n if (type === 'password') {\n inputProps.type = type;\n }\n\n const input = mask ? this.renderMaskedInput(inputProps, mask) : React.createElement('input', inputProps);\n\n return (\n <label data-tid={InputDataTids.root} {...labelProps}>\n <span className={styles.sideContainer()}>\n {this.renderLeftIcon()}\n {this.renderPrefix()}\n </span>\n <span className={styles.wrapper()}>\n {input}\n {this.renderPlaceholder()}\n </span>\n <span className={cx(styles.sideContainer(), styles.rightContainer())}>\n {this.renderSuffix()}\n {this.renderRightIcon()}\n </span>\n </label>\n );\n };\n\n private renderMaskedInput(\n inputProps: React.InputHTMLAttributes<HTMLInputElement> & {\n capture?: boolean;\n },\n mask: string,\n ) {\n return (\n <MaskedInput\n {...inputProps}\n mask={mask}\n maskChar={this.props.maskChar}\n alwaysShowMask={this.props.alwaysShowMask}\n formatChars={this.props.formatChars}\n onChange={this.props.onChange}\n onValueChange={this.handleMaskedValueChange}\n onUnexpectedInput={this.handleUnexpectedInput}\n />\n );\n }\n\n private getIconSizeClassname(right = false) {\n switch (this.getProps().size) {\n case 'large':\n return right ? styles.rightIconLarge(this.theme) : styles.leftIconLarge(this.theme);\n case 'medium':\n return right ? styles.rightIconMedium(this.theme) : styles.leftIconMedium(this.theme);\n case 'small':\n default:\n return right ? styles.rightIconSmall(this.theme) : styles.leftIconSmall(this.theme);\n }\n }\n\n private renderLeftIcon() {\n return this.renderIcon(this.props.leftIcon, this.getIconSizeClassname());\n }\n\n private renderRightIcon() {\n return this.renderIcon(this.props.rightIcon, this.getIconSizeClassname(true));\n }\n\n private renderIcon(icon: InputIconType, sizeClassName: string) {\n if (!icon) {\n return null;\n }\n const { disabled } = this.props;\n const iconNode = icon instanceof Function ? icon() : icon;\n\n return (\n <span\n className={cx(styles.icon(), sizeClassName, styles.useDefaultColor(this.theme), {\n [styles.iconDisabled()]: disabled,\n })}\n >\n {iconNode}\n </span>\n );\n }\n\n private renderPlaceholder() {\n const { disabled } = this.props;\n const { focused } = this.state;\n let placeholder = null;\n\n if (\n this.state.needsPolyfillPlaceholder &&\n this.props.placeholder &&\n !this.isMaskVisible &&\n !this.props.value &&\n !this.props.defaultValue\n ) {\n placeholder = (\n <div\n className={cx(styles.placeholder(this.theme), {\n [styles.placeholderDisabled(this.theme)]: disabled,\n [styles.placeholderFocus(this.theme)]: focused,\n })}\n style={{ textAlign: this.props.align || 'inherit' }}\n >\n {this.props.placeholder}\n </div>\n );\n }\n\n return placeholder;\n }\n\n private getSizeClassName() {\n switch (this.getProps().size) {\n case 'large':\n return cx({\n [styles.sizeLarge(this.theme)]: true,\n [styles.sizeLargeFallback(this.theme)]: isIE11 || isEdge,\n });\n case 'medium':\n return cx({\n [styles.sizeMedium(this.theme)]: true,\n [styles.sizeMediumFallback(this.theme)]: isIE11 || isEdge,\n });\n case 'small':\n default:\n return cx({\n [styles.sizeSmall(this.theme)]: true,\n [styles.sizeSmallFallback(this.theme)]: isIE11 || isEdge,\n });\n }\n }\n\n private refInput = (element: HTMLInputElement | MaskedInput | null) => {\n if (element instanceof MaskedInput) {\n this.input = element.input;\n } else {\n this.input = element;\n }\n };\n\n private handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (needsPolyfillPlaceholder) {\n const fieldIsEmpty = event.target.value === '';\n if (this.state.needsPolyfillPlaceholder !== fieldIsEmpty) {\n this.setState({ needsPolyfillPlaceholder: fieldIsEmpty });\n }\n }\n\n if (this.props.onValueChange) {\n this.props.onValueChange(event.target.value);\n }\n\n if (this.props.onChange) {\n this.props.onChange(event);\n }\n };\n\n private handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n this.setState({\n focused: true,\n });\n\n if (this.props.selectAllOnFocus) {\n // https://github.com/facebook/react/issues/7769\n this.input && !isIE11 ? this.selectAll() : this.delaySelectAll();\n }\n\n if (this.props.onFocus) {\n this.props.onFocus(event);\n }\n };\n\n private handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (this.props.onKeyDown) {\n this.props.onKeyDown(e);\n }\n\n const isDeleteKey = someKeys(isKeyBackspace, isKeyDelete)(e);\n\n if (!e.currentTarget.value && isDeleteKey && !e.repeat) {\n this.handleUnexpectedInput();\n }\n };\n\n private handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (this.props.onKeyPress) {\n this.props.onKeyPress(event);\n }\n\n if (this.props.maxLength === event.currentTarget.value.length) {\n this.handleUnexpectedInput(event.currentTarget.value);\n }\n };\n\n private handleMaskedValueChange = (value: string) => {\n if (this.props.onValueChange) {\n this.props.onValueChange(value);\n }\n };\n\n private handleUnexpectedInput = (value: string = this.props.value || '') => {\n if (this.props.onUnexpectedInput) {\n this.props.onUnexpectedInput(value);\n } else {\n this.blink();\n }\n };\n\n private handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n this.setState({ focused: false });\n\n if (this.props.onBlur) {\n this.props.onBlur(event);\n }\n };\n\n private renderPrefix = () => {\n const { prefix, disabled } = this.props;\n\n if (!prefix) {\n return null;\n }\n\n return (\n <span className={cx(styles.prefix(this.theme), { [styles.prefixDisabled(this.theme)]: disabled })}>{prefix}</span>\n );\n };\n\n private renderSuffix = () => {\n const { suffix, disabled } = this.props;\n\n if (!suffix) {\n return null;\n }\n\n return (\n <span className={cx(styles.suffix(this.theme), { [styles.suffixDisabled(this.theme)]: disabled })}>{suffix}</span>\n );\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["Input.tsx"],"names":["InputDataTids","root","Input","rootNode","getProps","defaultProps","state","needsPolyfillPlaceholder","blinking","focused","selectAllId","blinkTimeout","input","selectAll","setSelectionRange","value","length","delaySelectAll","cancelDelayedSelectAll","raf","cancel","cancelBlink","callback","clearTimeout","setState","renderMain","props","onMouseEnter","onMouseLeave","onMouseOver","onKeyDown","onKeyPress","onValueChange","width","error","warning","leftIcon","rightIcon","borderless","align","type","mask","maskChar","alwaysShowMask","size","placeholder","selectAllOnFocus","disabled","onUnexpectedInput","prefix","suffix","formatChars","rest","labelProps","className","styles","theme","getSizeClassName","focus","blink","focusFallback","isIE11","isEdge","warningFallback","errorFallback","style","inputProps","inputFocus","inputDisabled","onChange","handleChange","onFocus","handleFocus","handleKeyDown","handleKeyPress","onBlur","handleBlur","textAlign","ref","refInput","isMaskVisible","undefined","renderMaskedInput","React","createElement","sideContainer","renderLeftIcon","renderPrefix","wrapper","renderPlaceholder","rightContainer","renderSuffix","renderRightIcon","element","MaskedInput","event","fieldIsEmpty","target","e","isDeleteKey","isKeyBackspace","isKeyDelete","currentTarget","repeat","handleUnexpectedInput","maxLength","handleMaskedValueChange","prefixDisabled","suffixDisabled","componentWillUnmount","blur","getNode","offsetWidth","window","setTimeout","start","end","Error","document","activeElement","render","setRootNode","getIconSizeClassname","right","rightIconLarge","leftIconLarge","rightIconMedium","leftIconMedium","rightIconSmall","leftIconSmall","renderIcon","icon","sizeClassName","iconNode","Function","useDefaultColor","iconFocus","iconDisabled","defaultValue","placeholderDisabled","placeholderFocus","sizeLarge","sizeLargeFallback","sizeMedium","sizeMediumFallback","sizeSmall","sizeSmallFallback","Boolean","Component","__KONTUR_REACT_UI__"],"mappings":";;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FO,IAAMA,aAAa,GAAG;AAC3BC,EAAAA,IAAI,EAAE,aADqB,EAAtB,C;;;;;AAMP;AACA;AACA;AACA,G;;AAEaC,K,OADZC,kB;;;;;;;AAQSC,IAAAA,Q,GAAW,0CAAkBF,KAAK,CAACG,YAAxB,C;;AAEZC,IAAAA,K,GAAoB;AACzBC,MAAAA,wBAAwB,EAAxBA,kDADyB;AAEzBC,MAAAA,QAAQ,EAAE,KAFe;AAGzBC,MAAAA,OAAO,EAAE,KAHgB,E;;;AAMnBC,IAAAA,W,GAA6B,I;;AAE7BC,IAAAA,Y,GAAe,C;AACfC,IAAAA,K,GAAiC,I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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yF,kBAAP,CAA0B,KAAKxF,KAA/B,CAFI,IAEoCK,kBAAUC,cAF9C,QAAP,CAIF,KAAK,OAAL,CACA,QACE,OAAO,kCACJP,cAAO0F,SAAP,CAAiB,KAAKzF,KAAtB,CADI,IAC2B,IAD3B,OAEJD,cAAO2F,iBAAP,CAAyB,KAAK1F,KAA9B,CAFI,IAEmCK,kBAAUC,cAF7C,QAAP,CAbJ,CAkBD,C,iEA7PD,eAAoC,CAClC,mBAAiC,KAAKpC,KAAtC,CAAQe,IAAR,gBAAQA,IAAR,CAAcE,cAAd,gBAAcA,cAAd,CACA,IAAQlC,OAAR,GAAoB,KAAKH,KAAzB,CAAQG,OAAR,CACA,OAAO0I,OAAO,CAAC1G,IAAI,KAAKhC,OAAO,IAAIkC,cAAhB,CAAL,CAAd,CACD,C,oBA1FwBwC,eAAMiE,S,WACjBC,mB,GAAsB,O,UAEtBhJ,Y,GAA6B,EACzCuC,IAAI,EAAE,OADmC,E","sourcesContent":["// TODO: Enable this rule in functional components.\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport invariant from 'invariant';\nimport React from 'react';\nimport raf from 'raf';\n\nimport { isIE11, isEdge } from '../../lib/client';\nimport { isKeyBackspace, isKeyDelete, someKeys } from '../../lib/events/keyboard/identifiers';\nimport { needsPolyfillPlaceholder } from '../../lib/needsPolyfillPlaceholder';\nimport { Nullable, Override } from '../../typings/utility-types';\nimport { MaskedInput } from '../../internal/MaskedInput';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { CommonWrapper, CommonProps, CommonWrapperRestProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { styles } from './Input.styles';\n\nexport type InputSize = 'small' | 'medium' | 'large';\nexport type InputAlign = 'left' | 'center' | 'right';\nexport type InputType = 'password' | 'text';\nexport type InputIconType = React.ReactNode | (() => React.ReactNode);\n\nexport interface InputProps\n extends CommonProps,\n Override<\n React.InputHTMLAttributes<HTMLInputElement>,\n {\n /**\n * Иконка слева\n * Если `ReactNode` применяются дефолтные стили для иконки\n * Если `() => ReactNode` применяются только стили для позиционирование\n */\n leftIcon?: InputIconType;\n /**\n * Иконка справа\n * Если `ReactNode` применяются дефолтные стили для иконки\n * Если `() => ReactNode` применяются только стили для позиционирование\n */\n rightIcon?: InputIconType;\n /**\n * Состояние валидации при ошибке.\n */\n error?: boolean;\n /**\n * Состояние валидации при предупреждении.\n */\n warning?: boolean;\n /** Режим прозрачной рамки */\n borderless?: boolean;\n /** Выравнивание текста */\n align?: InputAlign;\n /** Паттерн маски */\n mask?: Nullable<string>;\n /** Символ маски */\n maskChar?: Nullable<string>;\n /**\n * Словарь символов-регулярок для задания маски\n * @default { '9': '[0-9]', 'a': '[A-Za-z]', '*': '[A-Za-z0-9]' }\n */\n formatChars?: Record<string, string>;\n /** Показывать символы маски */\n alwaysShowMask?: boolean;\n /** Размер */\n size?: InputSize;\n /** onValueChange */\n onValueChange?: (value: string) => void;\n /** Вызывается на label */\n onMouseEnter?: React.MouseEventHandler<HTMLLabelElement>;\n /** Вызывается на label */\n onMouseLeave?: React.MouseEventHandler<HTMLLabelElement>;\n /** Вызывается на label */\n onMouseOver?: React.MouseEventHandler<HTMLLabelElement>;\n /** Тип */\n type?: InputType;\n /** Значение */\n value?: string;\n capture?: boolean;\n\n /**\n * Префикс\n * `ReactNode` перед значением, но после иконки\n */\n prefix?: React.ReactNode;\n /**\n * Суффикс\n * `ReactNode` после значения, но перед правой иконкой\n */\n suffix?: React.ReactNode;\n /** Выделять введенное значение при фокусе */\n selectAllOnFocus?: boolean;\n /**\n * Обработчик неправильного ввода.\n * По-умолчанию, инпут вспыхивает синим.\n * Если передан - вызывается переданный обработчик,\n * в таком случае вспыхивание можно вызвать\n * публичным методом инстанса `blink()`.\n *\n * @param value значение инпута.\n */\n onUnexpectedInput?: (value: string) => void;\n }\n > {}\n\nexport interface InputState {\n blinking: boolean;\n focused: boolean;\n needsPolyfillPlaceholder: boolean;\n}\n\nexport const InputDataTids = {\n root: 'Input__root',\n} as const;\n\ntype DefaultProps = Required<Pick<InputProps, 'size'>>;\n\n/**\n * Интерфейс пропсов наследуется от `React.InputHTMLAttributes<HTMLInputElement>`.\n * Все пропсы кроме перечисленных, `className` и `style` передаются в `<input>`\n */\n@rootNode\nexport class Input extends React.Component<InputProps, InputState> {\n public static __KONTUR_REACT_UI__ = 'Input';\n\n public static defaultProps: DefaultProps = {\n size: 'small',\n };\n\n private getProps = createPropsGetter(Input.defaultProps);\n\n public state: InputState = {\n needsPolyfillPlaceholder,\n blinking: false,\n focused: false,\n };\n\n private selectAllId: number | null = null;\n private theme!: Theme;\n private blinkTimeout = 0;\n private input: HTMLInputElement | null = null;\n private setRootNode!: TSetRootNode;\n\n public componentWillUnmount() {\n if (this.blinkTimeout) {\n clearTimeout(this.blinkTimeout);\n }\n this.cancelDelayedSelectAll();\n }\n\n /**\n * @public\n */\n public focus() {\n invariant(this.input, 'Cannot call \"focus\" because Input is not mounted');\n this.input.focus();\n }\n\n /**\n * @public\n */\n public blur() {\n invariant(this.input, 'Cannot call \"blur\" because Input is not mounted');\n this.input.blur();\n }\n\n /**\n * @public\n */\n public getNode() {\n return this.input;\n }\n\n /**\n * @public\n */\n public blink() {\n if (this.blinkTimeout) {\n this.cancelBlink(() => {\n // trigger reflow to restart animation\n // @see https://css-tricks.com/restart-css-animation/#article-header-id-0\n void (this.input && this.input.offsetWidth);\n this.blink();\n });\n return;\n }\n this.setState({ blinking: true }, () => {\n this.blinkTimeout = window.setTimeout(this.cancelBlink, 150);\n });\n }\n\n /**\n * @public\n * @param {number} start\n * @param {number} end\n */\n public setSelectionRange(start: number, end: number) {\n if (!this.input) {\n throw new Error('Cannot call \"setSelectionRange\" on unmounted Input');\n }\n\n if (document.activeElement !== this.input) {\n this.focus();\n }\n\n this.input.setSelectionRange(start, end);\n }\n\n public get isMaskVisible(): boolean {\n const { mask, alwaysShowMask } = this.props;\n const { focused } = this.state;\n return Boolean(mask && (focused || alwaysShowMask));\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.props}>\n {this.renderMain}\n </CommonWrapper>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n /**\n * @public\n */\n public selectAll = (): void => {\n if (this.input) {\n this.setSelectionRange(0, this.input.value.length);\n }\n };\n\n private delaySelectAll = (): number => (this.selectAllId = raf(this.selectAll));\n\n private cancelDelayedSelectAll = (): void => {\n if (this.selectAllId) {\n raf.cancel(this.selectAllId);\n this.selectAllId = null;\n }\n };\n\n private cancelBlink = (callback?: () => void): void => {\n if (this.blinkTimeout) {\n clearTimeout(this.blinkTimeout);\n this.blinkTimeout = 0;\n if (this.state.blinking) {\n this.setState({ blinking: false }, callback);\n return;\n }\n }\n if (callback) {\n callback();\n }\n };\n\n private renderMain = (props: CommonWrapperRestProps<InputProps>) => {\n const {\n onMouseEnter,\n onMouseLeave,\n onMouseOver,\n onKeyDown,\n onKeyPress,\n onValueChange,\n width,\n error,\n warning,\n leftIcon,\n rightIcon,\n borderless,\n value,\n align,\n type,\n mask,\n maskChar,\n alwaysShowMask,\n size,\n placeholder,\n selectAllOnFocus,\n disabled,\n onUnexpectedInput,\n prefix,\n suffix,\n formatChars,\n ...rest\n } = props;\n\n const { blinking, focused } = this.state;\n\n const labelProps = {\n className: cx(styles.root(this.theme), this.getSizeClassName(), {\n [styles.focus(this.theme)]: focused,\n [styles.blink(this.theme)]: blinking,\n [styles.borderless()]: borderless && !focused,\n [styles.disabled(this.theme)]: disabled,\n [styles.warning(this.theme)]: warning,\n [styles.error(this.theme)]: error,\n [styles.focusFallback(this.theme)]: focused && (isIE11 || isEdge),\n [styles.warningFallback(this.theme)]: warning && (isIE11 || isEdge),\n [styles.errorFallback(this.theme)]: error && (isIE11 || isEdge),\n }),\n style: { width },\n onMouseEnter,\n onMouseLeave,\n onMouseOver,\n };\n\n const inputProps = {\n ...rest,\n className: cx(styles.input(this.theme), {\n [styles.inputFocus(this.theme)]: focused,\n [styles.inputDisabled(this.theme)]: disabled,\n }),\n value,\n onChange: this.handleChange,\n onFocus: this.handleFocus,\n onKeyDown: this.handleKeyDown,\n onKeyPress: this.handleKeyPress,\n onBlur: this.handleBlur,\n style: { textAlign: align },\n ref: this.refInput,\n type: 'text',\n placeholder: !this.isMaskVisible && !needsPolyfillPlaceholder ? placeholder : undefined,\n disabled,\n };\n\n if (type === 'password') {\n inputProps.type = type;\n }\n\n const input = mask ? this.renderMaskedInput(inputProps, mask) : React.createElement('input', inputProps);\n\n return (\n <label data-tid={InputDataTids.root} {...labelProps}>\n <span className={styles.sideContainer()}>\n {this.renderLeftIcon()}\n {this.renderPrefix()}\n </span>\n <span className={styles.wrapper()}>\n {input}\n {this.renderPlaceholder()}\n </span>\n <span className={cx(styles.sideContainer(), styles.rightContainer())}>\n {this.renderSuffix()}\n {this.renderRightIcon()}\n </span>\n </label>\n );\n };\n\n private renderMaskedInput(\n inputProps: React.InputHTMLAttributes<HTMLInputElement> & {\n capture?: boolean;\n },\n mask: string,\n ) {\n return (\n <MaskedInput\n {...inputProps}\n mask={mask}\n maskChar={this.props.maskChar}\n alwaysShowMask={this.props.alwaysShowMask}\n formatChars={this.props.formatChars}\n onChange={this.props.onChange}\n onValueChange={this.handleMaskedValueChange}\n onUnexpectedInput={this.handleUnexpectedInput}\n />\n );\n }\n\n private getIconSizeClassname(right = false) {\n switch (this.getProps().size) {\n case 'large':\n return right ? styles.rightIconLarge(this.theme) : styles.leftIconLarge(this.theme);\n case 'medium':\n return right ? styles.rightIconMedium(this.theme) : styles.leftIconMedium(this.theme);\n case 'small':\n default:\n return right ? styles.rightIconSmall(this.theme) : styles.leftIconSmall(this.theme);\n }\n }\n\n private renderLeftIcon() {\n return this.renderIcon(this.props.leftIcon, this.getIconSizeClassname());\n }\n\n private renderRightIcon() {\n return this.renderIcon(this.props.rightIcon, this.getIconSizeClassname(true));\n }\n\n private renderIcon(icon: InputIconType, sizeClassName: string) {\n if (!icon) {\n return null;\n }\n const { disabled } = this.props;\n const iconNode = icon instanceof Function ? icon() : icon;\n\n return (\n <span\n className={cx(styles.icon(), sizeClassName, styles.useDefaultColor(this.theme), {\n [styles.iconFocus(this.theme)]: this.state.focused,\n [styles.iconDisabled()]: disabled,\n })}\n >\n {iconNode}\n </span>\n );\n }\n\n private renderPlaceholder() {\n const { disabled } = this.props;\n const { focused } = this.state;\n let placeholder = null;\n\n if (\n this.state.needsPolyfillPlaceholder &&\n this.props.placeholder &&\n !this.isMaskVisible &&\n !this.props.value &&\n !this.props.defaultValue\n ) {\n placeholder = (\n <div\n className={cx(styles.placeholder(this.theme), {\n [styles.placeholderDisabled(this.theme)]: disabled,\n [styles.placeholderFocus(this.theme)]: focused,\n })}\n style={{ textAlign: this.props.align || 'inherit' }}\n >\n {this.props.placeholder}\n </div>\n );\n }\n\n return placeholder;\n }\n\n private getSizeClassName() {\n switch (this.getProps().size) {\n case 'large':\n return cx({\n [styles.sizeLarge(this.theme)]: true,\n [styles.sizeLargeFallback(this.theme)]: isIE11 || isEdge,\n });\n case 'medium':\n return cx({\n [styles.sizeMedium(this.theme)]: true,\n [styles.sizeMediumFallback(this.theme)]: isIE11 || isEdge,\n });\n case 'small':\n default:\n return cx({\n [styles.sizeSmall(this.theme)]: true,\n [styles.sizeSmallFallback(this.theme)]: isIE11 || isEdge,\n });\n }\n }\n\n private refInput = (element: HTMLInputElement | MaskedInput | null) => {\n if (element instanceof MaskedInput) {\n this.input = element.input;\n } else {\n this.input = element;\n }\n };\n\n private handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (needsPolyfillPlaceholder) {\n const fieldIsEmpty = event.target.value === '';\n if (this.state.needsPolyfillPlaceholder !== fieldIsEmpty) {\n this.setState({ needsPolyfillPlaceholder: fieldIsEmpty });\n }\n }\n\n if (this.props.onValueChange) {\n this.props.onValueChange(event.target.value);\n }\n\n if (this.props.onChange) {\n this.props.onChange(event);\n }\n };\n\n private handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n this.setState({\n focused: true,\n });\n\n if (this.props.selectAllOnFocus) {\n // https://github.com/facebook/react/issues/7769\n this.input && !isIE11 ? this.selectAll() : this.delaySelectAll();\n }\n\n if (this.props.onFocus) {\n this.props.onFocus(event);\n }\n };\n\n private handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (this.props.onKeyDown) {\n this.props.onKeyDown(e);\n }\n\n const isDeleteKey = someKeys(isKeyBackspace, isKeyDelete)(e);\n\n if (!e.currentTarget.value && isDeleteKey && !e.repeat) {\n this.handleUnexpectedInput();\n }\n };\n\n private handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (this.props.onKeyPress) {\n this.props.onKeyPress(event);\n }\n\n if (this.props.maxLength === event.currentTarget.value.length) {\n this.handleUnexpectedInput(event.currentTarget.value);\n }\n };\n\n private handleMaskedValueChange = (value: string) => {\n if (this.props.onValueChange) {\n this.props.onValueChange(value);\n }\n };\n\n private handleUnexpectedInput = (value: string = this.props.value || '') => {\n if (this.props.onUnexpectedInput) {\n this.props.onUnexpectedInput(value);\n } else {\n this.blink();\n }\n };\n\n private handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n this.setState({ focused: false });\n\n if (this.props.onBlur) {\n this.props.onBlur(event);\n }\n };\n\n private renderPrefix = () => {\n const { prefix, disabled } = this.props;\n\n if (!prefix) {\n return null;\n }\n\n return (\n <span className={cx(styles.prefix(this.theme), { [styles.prefixDisabled(this.theme)]: disabled })}>{prefix}</span>\n );\n };\n\n private renderSuffix = () => {\n const { suffix, disabled } = this.props;\n\n if (!suffix) {\n return null;\n }\n\n return (\n <span className={cx(styles.suffix(this.theme), { [styles.suffixDisabled(this.theme)]: disabled })}>{suffix}</span>\n );\n };\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.styles = void 0;var _taggedTemplateLiteralLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));var _Emotion = require("../../lib/theming/Emotion");
|
|
2
2
|
|
|
3
3
|
var _DimensionFunctions = require("../../lib/styles/DimensionFunctions");
|
|
4
|
-
var _Mixins = require("../../lib/styles/Mixins");var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40;
|
|
4
|
+
var _Mixins = require("../../lib/styles/Mixins");var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41;
|
|
5
5
|
|
|
6
6
|
var shouldCompensateFontFamily = function shouldCompensateFontFamily(fontFamilyCompensation) {return (
|
|
7
7
|
Boolean(parseInt(fontFamilyCompensation)));};
|
|
@@ -65,7 +65,8 @@ var styles = (0, _Emotion.memoizeStyle)({
|
|
|
65
65
|
},
|
|
66
66
|
|
|
67
67
|
focus: function focus(t) {
|
|
68
|
-
return (0, _Emotion.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2.default)(["\n border-color: ", ";\n box-shadow: ", ";\n outline: none;\n z-index: 2;\n "])),
|
|
68
|
+
return (0, _Emotion.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2.default)(["\n background-color: ", ";\n border-color: ", ";\n box-shadow: ", ";\n outline: none;\n z-index: 2;\n "])),
|
|
69
|
+
t.inputFocusedBg,
|
|
69
70
|
t.inputBorderColorFocus,
|
|
70
71
|
t.inputFocusShadow);
|
|
71
72
|
|
|
@@ -375,58 +376,64 @@ var styles = (0, _Emotion.memoizeStyle)({
|
|
|
375
376
|
|
|
376
377
|
|
|
377
378
|
|
|
379
|
+
},
|
|
380
|
+
|
|
381
|
+
iconFocus: function iconFocus(t) {
|
|
382
|
+
return (0, _Emotion.css)(_templateObject33 || (_templateObject33 = (0, _taggedTemplateLiteralLoose2.default)(["\n color: ", ";\n "])),
|
|
383
|
+
t.inputFocusedIconColor);
|
|
384
|
+
|
|
378
385
|
},
|
|
379
386
|
|
|
380
387
|
iconDisabled: function iconDisabled() {
|
|
381
|
-
return (0, _Emotion.css)(
|
|
388
|
+
return (0, _Emotion.css)(_templateObject34 || (_templateObject34 = (0, _taggedTemplateLiteralLoose2.default)(["\n cursor: default;\n "])));
|
|
382
389
|
|
|
383
390
|
|
|
384
391
|
},
|
|
385
392
|
|
|
386
393
|
leftIconSmall: function leftIconSmall(t) {
|
|
387
|
-
return (0, _Emotion.css)(
|
|
394
|
+
return (0, _Emotion.css)(_templateObject35 || (_templateObject35 = (0, _taggedTemplateLiteralLoose2.default)(["\n min-width: ", ";\n padding-right: ", ";\n "])),
|
|
388
395
|
t.inputIconSizeSmall,
|
|
389
396
|
t.inputIconGapSmall);
|
|
390
397
|
|
|
391
398
|
},
|
|
392
399
|
|
|
393
400
|
rightIconSmall: function rightIconSmall(t) {
|
|
394
|
-
return (0, _Emotion.css)(
|
|
401
|
+
return (0, _Emotion.css)(_templateObject36 || (_templateObject36 = (0, _taggedTemplateLiteralLoose2.default)(["\n min-width: ", ";\n padding-left: ", ";\n "])),
|
|
395
402
|
t.inputIconSizeSmall,
|
|
396
403
|
t.inputIconGapSmall);
|
|
397
404
|
|
|
398
405
|
},
|
|
399
406
|
|
|
400
407
|
leftIconMedium: function leftIconMedium(t) {
|
|
401
|
-
return (0, _Emotion.css)(
|
|
408
|
+
return (0, _Emotion.css)(_templateObject37 || (_templateObject37 = (0, _taggedTemplateLiteralLoose2.default)(["\n min-width: ", ";\n padding-right: ", ";\n "])),
|
|
402
409
|
t.inputIconSizeMedium,
|
|
403
410
|
t.inputIconGapMedium);
|
|
404
411
|
|
|
405
412
|
},
|
|
406
413
|
|
|
407
414
|
rightIconMedium: function rightIconMedium(t) {
|
|
408
|
-
return (0, _Emotion.css)(
|
|
415
|
+
return (0, _Emotion.css)(_templateObject38 || (_templateObject38 = (0, _taggedTemplateLiteralLoose2.default)(["\n min-width: ", ";\n padding-left: ", ";\n "])),
|
|
409
416
|
t.inputIconSizeMedium,
|
|
410
417
|
t.inputIconGapMedium);
|
|
411
418
|
|
|
412
419
|
},
|
|
413
420
|
|
|
414
421
|
leftIconLarge: function leftIconLarge(t) {
|
|
415
|
-
return (0, _Emotion.css)(
|
|
422
|
+
return (0, _Emotion.css)(_templateObject39 || (_templateObject39 = (0, _taggedTemplateLiteralLoose2.default)(["\n min-width: ", ";\n padding-right: ", ";\n "])),
|
|
416
423
|
t.inputIconSizeLarge,
|
|
417
424
|
t.inputIconGapLarge);
|
|
418
425
|
|
|
419
426
|
},
|
|
420
427
|
|
|
421
428
|
rightIconLarge: function rightIconLarge(t) {
|
|
422
|
-
return (0, _Emotion.css)(
|
|
429
|
+
return (0, _Emotion.css)(_templateObject40 || (_templateObject40 = (0, _taggedTemplateLiteralLoose2.default)(["\n min-width: ", ";\n padding-left: ", ";\n "])),
|
|
423
430
|
t.inputIconSizeLarge,
|
|
424
431
|
t.inputIconGapLarge);
|
|
425
432
|
|
|
426
433
|
},
|
|
427
434
|
|
|
428
435
|
hideBlinkingCursor: function hideBlinkingCursor() {
|
|
429
|
-
return (0, _Emotion.css)(
|
|
436
|
+
return (0, _Emotion.css)(_templateObject41 || (_templateObject41 = (0, _taggedTemplateLiteralLoose2.default)(["\n caret-color: transparent;\n "])));
|
|
430
437
|
|
|
431
438
|
|
|
432
439
|
} });exports.styles = styles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Input.styles.ts"],"names":["shouldCompensateFontFamily","fontFamilyCompensation","Boolean","parseInt","styles","wrapper","css","root","t","inputBg","inputBorderWidth","inputBorderColor","inputBorderTopColor","inputShadow","inputColor","inputWidth","borderless","useDefaultColor","inputIconColor","focus","inputBorderColorFocus","inputFocusShadow","focusFallback","inputOutlineWidth","inputFocusOutline","placeholder","inputPlaceholderColor","placeholderFocus","inputPlaceholderColorLight","placeholderDisabled","inputPlaceholderColorDisabled","input","inputTextColor","inputFocus","inputDisabled","inputTextColorDisabled","warning","inputBorderColorWarning","warningFallback","error","inputBorderColorError","errorFallback","disabled","inputDisabledBg","inputDisabledBorderColor","blink","blinkAnimation","keyframes","inputBlinkColor","sizeSmall","inputFontSizeSmall","inputLineHeightSmall","inputPaddingYSmall","inputPaddingXSmall","inputHeightSmall","inputBorderRadiusSmall","sizeSmallFallback","fontFamilyCompensationBaseline","sizeMedium","inputFontSizeMedium","inputLineHeightMedium","inputPaddingYMedium","inputPaddingXMedium","inputHeightMedium","inputBorderRadiusMedium","sizeMediumFallback","sizeLarge","inputFontSizeLarge","inputLineHeightLarge","inputHeightLarge","inputPaddingYLarge","inputPaddingXLarge","inputBorderRadiusLarge","sizeLargeFallback","prefix","prefixDisabled","suffix","suffixDisabled","sideContainer","rightContainer","icon","iconDisabled","leftIconSmall","inputIconSizeSmall","inputIconGapSmall","rightIconSmall","leftIconMedium","inputIconSizeMedium","inputIconGapMedium","rightIconMedium","leftIconLarge","inputIconSizeLarge","inputIconGapLar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IAAAA,CAAC,CAAC+E,mBADjB;AAEkB/E,IAAAA,CAAC,CAACgF,kBAFpB;;AAID,GAnZgC;;AAqZjCE,EAAAA,aArZiC,yBAqZnBlF,CArZmB,EAqZT;AACtB,eAAOF,YAAP;AACeE,IAAAA,CAAC,CAACmF,kBADjB;AAEmBnF,IAAAA,CAAC,CAACoF,iBAFrB;;AAID,GA1ZgC;;AA4ZjCC,EAAAA,cA5ZiC,0BA4ZlBrF,CA5ZkB,EA4ZR;AACvB,eAAOF,YAAP;AACeE,IAAAA,CAAC,CAACmF,kBADjB;AAEkBnF,IAAAA,CAAC,CAACoF,iBAFpB;;AAID,GAjagC;;AAmajCE,EAAAA,kBAnaiC,gCAmaZ;AACnB,eAAOxF,YAAP;;;AAGD,GAvagC,EAAb,CAAf,C","sourcesContent":["import { css, keyframes, memoizeStyle } from '../../lib/theming/Emotion';\nimport { Theme } from '../../lib/theming/Theme';\nimport { shift } from '../../lib/styles/DimensionFunctions';\nimport { resetText } from '../../lib/styles/Mixins';\n\nconst shouldCompensateFontFamily = (fontFamilyCompensation: string): boolean =>\n Boolean(parseInt(fontFamilyCompensation));\n\nexport const styles = memoizeStyle({\n wrapper() {\n return css`\n align-items: center;\n display: flex;\n margin: 0;\n min-width: 0;\n overflow: hidden;\n position: relative;\n text-overflow: clip;\n white-space: nowrap;\n width: 100%;\n\n &::before {\n content: '\\\\A0';\n display: inline-block;\n width: 0;\n }\n `;\n },\n\n root(t: Theme) {\n return css`\n ${resetText()};\n\n align-items: center;\n background-clip: padding-box;\n background-color: ${t.inputBg};\n border: ${t.inputBorderWidth} solid ${t.inputBorderColor};\n border-top-color: ${t.inputBorderTopColor};\n box-shadow: ${t.inputShadow};\n box-sizing: border-box;\n color: ${t.inputColor};\n cursor: text;\n display: inline-flex;\n outline: none;\n position: relative;\n width: ${t.inputWidth};\n\n & * {\n box-sizing: border-box;\n }\n `;\n },\n\n borderless() {\n return css`\n box-shadow: none;\n border-color: transparent;\n `;\n },\n\n useDefaultColor(t: Theme) {\n return css`\n color: ${t.inputIconColor};\n `;\n },\n\n focus(t: Theme) {\n return css`\n border-color: ${t.inputBorderColorFocus};\n box-shadow: ${t.inputFocusShadow};\n outline: none;\n z-index: 2;\n `;\n },\n\n focusFallback(t: Theme) {\n return css`\n box-shadow: none;\n outline: ${t.inputOutlineWidth} solid ${t.inputFocusOutline};\n `;\n },\n\n placeholder(t: Theme) {\n return css`\n -ms-user-select: none;\n color: ${t.inputPlaceholderColor};\n cursor: text;\n font-size: inherit;\n height: 100%;\n left: 0;\n overflow: hidden;\n pointer-events: none;\n position: absolute;\n top: 0;\n user-select: none;\n white-space: nowrap;\n width: 100%;\n `;\n },\n\n placeholderFocus(t: Theme) {\n return css`\n color: ${t.inputPlaceholderColorLight};\n `;\n },\n\n placeholderDisabled(t: Theme) {\n return css`\n color: ${t.inputPlaceholderColorDisabled};\n `;\n },\n\n input(t: Theme) {\n return css`\n -webkit-appearance: none;\n background: transparent;\n border: 0 none;\n color: ${t.inputTextColor};\n font: inherit;\n line-height: inherit;\n margin: 0;\n outline: none;\n padding: 0;\n text-overflow: clip;\n white-space: nowrap;\n width: 100%;\n\n &:-moz-placeholder {\n opacity: 1;\n }\n &::-moz-placeholder {\n opacity: 1;\n }\n &::-ms-clear {\n display: none;\n }\n &:-moz-placeholder {\n color: ${t.inputPlaceholderColor};\n }\n &::-moz-placeholder {\n color: ${t.inputPlaceholderColor};\n }\n &::placeholder {\n color: ${t.inputPlaceholderColor};\n }\n `;\n },\n\n inputFocus(t: Theme) {\n return css`\n &:-moz-placeholder {\n color: ${t.inputPlaceholderColorLight};\n }\n &::-moz-placeholder {\n color: ${t.inputPlaceholderColorLight};\n }\n &::placeholder {\n color: ${t.inputPlaceholderColorLight};\n }\n `;\n },\n\n inputDisabled(t: Theme) {\n return css`\n color: ${t.inputTextColorDisabled};\n /* fix text color in safari https://bugs.webkit.org/show_bug.cgi?id=115510 */\n -webkit-text-fill-color: ${t.inputTextColorDisabled};\n\n &:-moz-placeholder {\n -webkit-text-fill-color: ${t.inputPlaceholderColorDisabled};\n }\n &::-moz-placeholder {\n -webkit-text-fill-color: ${t.inputPlaceholderColorDisabled};\n }\n &::placeholder {\n -webkit-text-fill-color: ${t.inputPlaceholderColorDisabled};\n }\n `;\n },\n\n warning(t: Theme) {\n return css`\n border-color: ${t.inputBorderColorWarning};\n box-shadow: 0 0 0 ${t.inputOutlineWidth} ${t.inputBorderColorWarning};\n z-index: 2;\n `;\n },\n\n warningFallback(t: Theme) {\n return css`\n box-shadow: none;\n outline: ${t.inputBorderWidth} solid ${t.inputBorderColorWarning};\n `;\n },\n\n error(t: Theme) {\n return css`\n border-color: ${t.inputBorderColorError};\n box-shadow: 0 0 0 ${t.inputOutlineWidth} ${t.inputBorderColorError};\n z-index: 2;\n `;\n },\n\n errorFallback(t: Theme) {\n return css`\n box-shadow: none;\n outline: ${t.inputBorderWidth} solid ${t.inputBorderColorError};\n `;\n },\n\n disabled(t: Theme) {\n return css`\n background-color: ${t.inputDisabledBg};\n border-color: ${t.inputDisabledBorderColor};\n box-shadow: none;\n `;\n },\n\n blink(t: Theme) {\n const blinkAnimation = keyframes`\n 0% {\n background-color: ${t.inputBlinkColor};\n }\n `;\n return css`\n animation: ${blinkAnimation} 0.15s ease-in;\n `;\n },\n\n sizeSmall(t: Theme) {\n return css`\n font-size: ${t.inputFontSizeSmall};\n line-height: ${t.inputLineHeightSmall};\n padding-top: ${t.inputPaddingYSmall};\n padding-bottom: ${t.inputPaddingYSmall};\n padding-left: ${t.inputPaddingXSmall};\n padding-right: ${t.inputPaddingXSmall};\n height: ${t.inputHeightSmall};\n border-radius: ${t.inputBorderRadiusSmall};\n `;\n },\n\n sizeSmallFallback(t: Theme) {\n return css`\n padding-top: ${shift(\n t.inputPaddingYSmall,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '-1' : '0',\n )};\n padding-bottom: ${shift(\n t.inputPaddingYSmall,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '1' : '0',\n )};\n padding-left: ${t.inputPaddingXSmall};\n padding-right: ${t.inputPaddingXSmall};\n line-height: normal;\n `;\n },\n\n sizeMedium(t: Theme) {\n return css`\n font-size: ${t.inputFontSizeMedium};\n line-height: ${t.inputLineHeightMedium};\n padding-top: ${t.inputPaddingYMedium};\n padding-bottom: ${t.inputPaddingYMedium};\n padding-left: ${t.inputPaddingXMedium};\n padding-right: ${t.inputPaddingXMedium};\n height: ${t.inputHeightMedium};\n border-radius: ${t.inputBorderRadiusMedium};\n `;\n },\n\n sizeMediumFallback(t: Theme) {\n return css`\n padding-top: ${shift(\n t.inputPaddingYMedium,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '-1' : '0',\n )};\n padding-bottom: ${shift(\n t.inputPaddingYMedium,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '1' : '0',\n )};\n padding-left: ${t.inputPaddingXMedium};\n padding-right: ${t.inputPaddingXMedium};\n line-height: normal;\n `;\n },\n\n sizeLarge(t: Theme) {\n return css`\n font-size: ${t.inputFontSizeLarge};\n line-height: ${t.inputLineHeightLarge};\n height: ${t.inputHeightLarge};\n padding-top: ${shift(\n t.inputPaddingYLarge,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '-1' : '0',\n )};\n padding-bottom: ${shift(\n t.inputPaddingYLarge,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '1' : '0',\n )};\n padding-left: ${t.inputPaddingXLarge};\n padding-right: ${t.inputPaddingXLarge};\n border-radius: ${t.inputBorderRadiusLarge};\n `;\n },\n\n sizeLargeFallback(t: Theme) {\n return css`\n padding-top: ${shift(\n t.inputPaddingYLarge,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '-2' : '0',\n )};\n padding-bottom: ${shift(\n t.inputPaddingYLarge,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '2' : '0',\n )};\n padding-left: ${t.inputPaddingXLarge};\n padding-right: ${t.inputPaddingXLarge};\n line-height: normal;\n `;\n },\n\n prefix(t: Theme) {\n return css`\n color: ${t.inputPlaceholderColor};\n `;\n },\n\n prefixDisabled(t: Theme) {\n return css`\n color: ${t.inputPlaceholderColorDisabled};\n `;\n },\n\n suffix(t: Theme) {\n return css`\n color: ${t.inputPlaceholderColor};\n `;\n },\n\n suffixDisabled(t: Theme) {\n return css`\n color: ${t.inputPlaceholderColorDisabled};\n `;\n },\n\n sideContainer() {\n return css`\n align-items: center;\n display: flex;\n flex-shrink: 0;\n height: 100%;\n\n &::before {\n content: '\\\\a0';\n display: inline-block;\n width: 0;\n }\n `;\n },\n\n rightContainer() {\n return css`\n justify-self: flex-end;\n margin: 0 0 0 auto;\n padding-left: 0;\n `;\n },\n\n icon() {\n return css`\n flex-shrink: 0;\n cursor: text;\n z-index: 2;\n text-align: center;\n box-sizing: content-box !important; // fix possible \"reset.css\" problem\n `;\n },\n\n iconDisabled() {\n return css`\n cursor: default;\n `;\n },\n\n leftIconSmall(t: Theme) {\n return css`\n min-width: ${t.inputIconSizeSmall};\n padding-right: ${t.inputIconGapSmall};\n `;\n },\n\n rightIconSmall(t: Theme) {\n return css`\n min-width: ${t.inputIconSizeSmall};\n padding-left: ${t.inputIconGapSmall};\n `;\n },\n\n leftIconMedium(t: Theme) {\n return css`\n min-width: ${t.inputIconSizeMedium};\n padding-right: ${t.inputIconGapMedium};\n `;\n },\n\n rightIconMedium(t: Theme) {\n return css`\n min-width: ${t.inputIconSizeMedium};\n padding-left: ${t.inputIconGapMedium};\n `;\n },\n\n leftIconLarge(t: Theme) {\n return css`\n min-width: ${t.inputIconSizeLarge};\n padding-right: ${t.inputIconGapLarge};\n `;\n },\n\n rightIconLarge(t: Theme) {\n return css`\n min-width: ${t.inputIconSizeLarge};\n padding-left: ${t.inputIconGapLarge};\n `;\n },\n\n hideBlinkingCursor() {\n return css`\n caret-color: transparent;\n `;\n },\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["Input.styles.ts"],"names":["shouldCompensateFontFamily","fontFamilyCompensation","Boolean","parseInt","styles","wrapper","css","root","t","inputBg","inputBorderWidth","inputBorderColor","inputBorderTopColor","inputShadow","inputColor","inputWidth","borderless","useDefaultColor","inputIconColor","focus","inputFocusedBg","inputBorderColorFocus","inputFocusShadow","focusFallback","inputOutlineWidth","inputFocusOutline","placeholder","inputPlaceholderColor","placeholderFocus","inputPlaceholderColorLight","placeholderDisabled","inputPlaceholderColorDisabled","input","inputTextColor","inputFocus","inputDisabled","inputTextColorDisabled","warning","inputBorderColorWarning","warningFallback","error","inputBorderColorError","errorFallback","disabled","inputDisabledBg","inputDisabledBorderColor","blink","blinkAnimation","keyframes","inputBlinkColor","sizeSmall","inputFontSizeSmall","inputLineHeightSmall","inputPaddingYSmall","inputPaddingXSmall","inputHeightSmall","inputBorderRadiusSmall","sizeSmallFallback","fontFamilyCompensationBaseline","sizeMedium","inputFontSizeMedium","inputLineHeightMedium","inputPaddingYMedium","inputPaddingXMedium","inputHeightMedium","inputBorderRadiusMedium","sizeMediumFallback","sizeLarge","inputFontSizeLarge","inputLineHeightLarge","inputHeightLarge","inputPaddingYLarge","inputPaddingXLarge","inputBorderRadiusLarge","sizeLargeFallback","prefix","prefixDisabled","suffix","suffixDisabled","sideContainer","rightContainer","icon","iconFocus","inputFocusedIconColor","iconDisabled","leftIconSmall","inputIconSizeSmall","inputIconGapSmall","rightIconSmall","leftIconMedium","inputIconSizeMedium","inputIconGapMedium","rightIconMedium","leftIconLarge","inputIconSizeLarge","inputIconGapLarge","rightIconLarge","hideBlinkingCursor"],"mappings":"4QAAA;;AAEA;AACA,iD;;AAEA,IAAMA,0BAA0B,GAAG,SAA7BA,0BAA6B,CAACC,sBAAD;AACjCC,IAAAA,OAAO,CAACC,QAAQ,CAACF,sBAAD,CAAT,CAD0B,GAAnC;;AAGO,IAAMG,MAAM,GAAG,2BAAa;AACjCC,EAAAA,OADiC,qBACvB;AACR,eAAOC,YAAP;;;;;;;;;;;;;;;;;AAiBD,GAnBgC;;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,YAAP;AACeE,IAAAA,CAAC,CAACsF,kBADjB;AAEmBtF,IAAAA,CAAC,CAACuF,iBAFrB;;AAID,GAjagC;;AAmajCC,EAAAA,cAnaiC,0BAmalBxF,CAnakB,EAmaR;AACvB,eAAOF,YAAP;AACeE,IAAAA,CAAC,CAACsF,kBADjB;AAEkBtF,IAAAA,CAAC,CAACuF,iBAFpB;;AAID,GAxagC;;AA0ajCE,EAAAA,kBA1aiC,gCA0aZ;AACnB,eAAO3F,YAAP;;;AAGD,GA9agC,EAAb,CAAf,C","sourcesContent":["import { css, keyframes, memoizeStyle } from '../../lib/theming/Emotion';\nimport { Theme } from '../../lib/theming/Theme';\nimport { shift } from '../../lib/styles/DimensionFunctions';\nimport { resetText } from '../../lib/styles/Mixins';\n\nconst shouldCompensateFontFamily = (fontFamilyCompensation: string): boolean =>\n Boolean(parseInt(fontFamilyCompensation));\n\nexport const styles = memoizeStyle({\n wrapper() {\n return css`\n align-items: center;\n display: flex;\n margin: 0;\n min-width: 0;\n overflow: hidden;\n position: relative;\n text-overflow: clip;\n white-space: nowrap;\n width: 100%;\n\n &::before {\n content: '\\\\A0';\n display: inline-block;\n width: 0;\n }\n `;\n },\n\n root(t: Theme) {\n return css`\n ${resetText()};\n\n align-items: center;\n background-clip: padding-box;\n background-color: ${t.inputBg};\n border: ${t.inputBorderWidth} solid ${t.inputBorderColor};\n border-top-color: ${t.inputBorderTopColor};\n box-shadow: ${t.inputShadow};\n box-sizing: border-box;\n color: ${t.inputColor};\n cursor: text;\n display: inline-flex;\n outline: none;\n position: relative;\n width: ${t.inputWidth};\n\n & * {\n box-sizing: border-box;\n }\n `;\n },\n\n borderless() {\n return css`\n box-shadow: none;\n border-color: transparent;\n `;\n },\n\n useDefaultColor(t: Theme) {\n return css`\n color: ${t.inputIconColor};\n `;\n },\n\n focus(t: Theme) {\n return css`\n background-color: ${t.inputFocusedBg};\n border-color: ${t.inputBorderColorFocus};\n box-shadow: ${t.inputFocusShadow};\n outline: none;\n z-index: 2;\n `;\n },\n\n focusFallback(t: Theme) {\n return css`\n box-shadow: none;\n outline: ${t.inputOutlineWidth} solid ${t.inputFocusOutline};\n `;\n },\n\n placeholder(t: Theme) {\n return css`\n -ms-user-select: none;\n color: ${t.inputPlaceholderColor};\n cursor: text;\n font-size: inherit;\n height: 100%;\n left: 0;\n overflow: hidden;\n pointer-events: none;\n position: absolute;\n top: 0;\n user-select: none;\n white-space: nowrap;\n width: 100%;\n `;\n },\n\n placeholderFocus(t: Theme) {\n return css`\n color: ${t.inputPlaceholderColorLight};\n `;\n },\n\n placeholderDisabled(t: Theme) {\n return css`\n color: ${t.inputPlaceholderColorDisabled};\n `;\n },\n\n input(t: Theme) {\n return css`\n -webkit-appearance: none;\n background: transparent;\n border: 0 none;\n color: ${t.inputTextColor};\n font: inherit;\n line-height: inherit;\n margin: 0;\n outline: none;\n padding: 0;\n text-overflow: clip;\n white-space: nowrap;\n width: 100%;\n\n &:-moz-placeholder {\n opacity: 1;\n }\n &::-moz-placeholder {\n opacity: 1;\n }\n &::-ms-clear {\n display: none;\n }\n &:-moz-placeholder {\n color: ${t.inputPlaceholderColor};\n }\n &::-moz-placeholder {\n color: ${t.inputPlaceholderColor};\n }\n &::placeholder {\n color: ${t.inputPlaceholderColor};\n }\n `;\n },\n\n inputFocus(t: Theme) {\n return css`\n &:-moz-placeholder {\n color: ${t.inputPlaceholderColorLight};\n }\n &::-moz-placeholder {\n color: ${t.inputPlaceholderColorLight};\n }\n &::placeholder {\n color: ${t.inputPlaceholderColorLight};\n }\n `;\n },\n\n inputDisabled(t: Theme) {\n return css`\n color: ${t.inputTextColorDisabled};\n /* fix text color in safari https://bugs.webkit.org/show_bug.cgi?id=115510 */\n -webkit-text-fill-color: ${t.inputTextColorDisabled};\n\n &:-moz-placeholder {\n -webkit-text-fill-color: ${t.inputPlaceholderColorDisabled};\n }\n &::-moz-placeholder {\n -webkit-text-fill-color: ${t.inputPlaceholderColorDisabled};\n }\n &::placeholder {\n -webkit-text-fill-color: ${t.inputPlaceholderColorDisabled};\n }\n `;\n },\n\n warning(t: Theme) {\n return css`\n border-color: ${t.inputBorderColorWarning};\n box-shadow: 0 0 0 ${t.inputOutlineWidth} ${t.inputBorderColorWarning};\n z-index: 2;\n `;\n },\n\n warningFallback(t: Theme) {\n return css`\n box-shadow: none;\n outline: ${t.inputBorderWidth} solid ${t.inputBorderColorWarning};\n `;\n },\n\n error(t: Theme) {\n return css`\n border-color: ${t.inputBorderColorError};\n box-shadow: 0 0 0 ${t.inputOutlineWidth} ${t.inputBorderColorError};\n z-index: 2;\n `;\n },\n\n errorFallback(t: Theme) {\n return css`\n box-shadow: none;\n outline: ${t.inputBorderWidth} solid ${t.inputBorderColorError};\n `;\n },\n\n disabled(t: Theme) {\n return css`\n background-color: ${t.inputDisabledBg};\n border-color: ${t.inputDisabledBorderColor};\n box-shadow: none;\n `;\n },\n\n blink(t: Theme) {\n const blinkAnimation = keyframes`\n 0% {\n background-color: ${t.inputBlinkColor};\n }\n `;\n return css`\n animation: ${blinkAnimation} 0.15s ease-in;\n `;\n },\n\n sizeSmall(t: Theme) {\n return css`\n font-size: ${t.inputFontSizeSmall};\n line-height: ${t.inputLineHeightSmall};\n padding-top: ${t.inputPaddingYSmall};\n padding-bottom: ${t.inputPaddingYSmall};\n padding-left: ${t.inputPaddingXSmall};\n padding-right: ${t.inputPaddingXSmall};\n height: ${t.inputHeightSmall};\n border-radius: ${t.inputBorderRadiusSmall};\n `;\n },\n\n sizeSmallFallback(t: Theme) {\n return css`\n padding-top: ${shift(\n t.inputPaddingYSmall,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '-1' : '0',\n )};\n padding-bottom: ${shift(\n t.inputPaddingYSmall,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '1' : '0',\n )};\n padding-left: ${t.inputPaddingXSmall};\n padding-right: ${t.inputPaddingXSmall};\n line-height: normal;\n `;\n },\n\n sizeMedium(t: Theme) {\n return css`\n font-size: ${t.inputFontSizeMedium};\n line-height: ${t.inputLineHeightMedium};\n padding-top: ${t.inputPaddingYMedium};\n padding-bottom: ${t.inputPaddingYMedium};\n padding-left: ${t.inputPaddingXMedium};\n padding-right: ${t.inputPaddingXMedium};\n height: ${t.inputHeightMedium};\n border-radius: ${t.inputBorderRadiusMedium};\n `;\n },\n\n sizeMediumFallback(t: Theme) {\n return css`\n padding-top: ${shift(\n t.inputPaddingYMedium,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '-1' : '0',\n )};\n padding-bottom: ${shift(\n t.inputPaddingYMedium,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '1' : '0',\n )};\n padding-left: ${t.inputPaddingXMedium};\n padding-right: ${t.inputPaddingXMedium};\n line-height: normal;\n `;\n },\n\n sizeLarge(t: Theme) {\n return css`\n font-size: ${t.inputFontSizeLarge};\n line-height: ${t.inputLineHeightLarge};\n height: ${t.inputHeightLarge};\n padding-top: ${shift(\n t.inputPaddingYLarge,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '-1' : '0',\n )};\n padding-bottom: ${shift(\n t.inputPaddingYLarge,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '1' : '0',\n )};\n padding-left: ${t.inputPaddingXLarge};\n padding-right: ${t.inputPaddingXLarge};\n border-radius: ${t.inputBorderRadiusLarge};\n `;\n },\n\n sizeLargeFallback(t: Theme) {\n return css`\n padding-top: ${shift(\n t.inputPaddingYLarge,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '-2' : '0',\n )};\n padding-bottom: ${shift(\n t.inputPaddingYLarge,\n shouldCompensateFontFamily(t.fontFamilyCompensationBaseline) ? '2' : '0',\n )};\n padding-left: ${t.inputPaddingXLarge};\n padding-right: ${t.inputPaddingXLarge};\n line-height: normal;\n `;\n },\n\n prefix(t: Theme) {\n return css`\n color: ${t.inputPlaceholderColor};\n `;\n },\n\n prefixDisabled(t: Theme) {\n return css`\n color: ${t.inputPlaceholderColorDisabled};\n `;\n },\n\n suffix(t: Theme) {\n return css`\n color: ${t.inputPlaceholderColor};\n `;\n },\n\n suffixDisabled(t: Theme) {\n return css`\n color: ${t.inputPlaceholderColorDisabled};\n `;\n },\n\n sideContainer() {\n return css`\n align-items: center;\n display: flex;\n flex-shrink: 0;\n height: 100%;\n\n &::before {\n content: '\\\\a0';\n display: inline-block;\n width: 0;\n }\n `;\n },\n\n rightContainer() {\n return css`\n justify-self: flex-end;\n margin: 0 0 0 auto;\n padding-left: 0;\n `;\n },\n\n icon() {\n return css`\n flex-shrink: 0;\n cursor: text;\n z-index: 2;\n text-align: center;\n box-sizing: content-box !important; // fix possible \"reset.css\" problem\n `;\n },\n\n iconFocus(t: Theme) {\n return css`\n color: ${t.inputFocusedIconColor};\n `;\n },\n\n iconDisabled() {\n return css`\n cursor: default;\n `;\n },\n\n leftIconSmall(t: Theme) {\n return css`\n min-width: ${t.inputIconSizeSmall};\n padding-right: ${t.inputIconGapSmall};\n `;\n },\n\n rightIconSmall(t: Theme) {\n return css`\n min-width: ${t.inputIconSizeSmall};\n padding-left: ${t.inputIconGapSmall};\n `;\n },\n\n leftIconMedium(t: Theme) {\n return css`\n min-width: ${t.inputIconSizeMedium};\n padding-right: ${t.inputIconGapMedium};\n `;\n },\n\n rightIconMedium(t: Theme) {\n return css`\n min-width: ${t.inputIconSizeMedium};\n padding-left: ${t.inputIconGapMedium};\n `;\n },\n\n leftIconLarge(t: Theme) {\n return css`\n min-width: ${t.inputIconSizeLarge};\n padding-right: ${t.inputIconGapLarge};\n `;\n },\n\n rightIconLarge(t: Theme) {\n return css`\n min-width: ${t.inputIconSizeLarge};\n padding-left: ${t.inputIconGapLarge};\n `;\n },\n\n hideBlinkingCursor() {\n return css`\n caret-color: transparent;\n `;\n },\n});\n"]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ResponsiveLayoutFlags } from './types';
|
|
3
|
-
interface ResponsiveLayoutProps {
|
|
4
|
-
onLayoutChange?: (layout: ResponsiveLayoutFlags) => void;
|
|
5
|
-
children?: React.ReactNode | ((currentLayout: ResponsiveLayoutFlags) => React.ReactNode);
|
|
2
|
+
import { EmptyObject, MediaQueriesType, ResponsiveLayoutFlags } from './types';
|
|
3
|
+
interface ResponsiveLayoutProps<T extends MediaQueriesType = EmptyObject> {
|
|
4
|
+
onLayoutChange?: (layout: ResponsiveLayoutFlags<T>) => void;
|
|
5
|
+
children?: React.ReactNode | ((currentLayout: ResponsiveLayoutFlags<T>) => React.ReactNode);
|
|
6
|
+
customMediaQueries?: T;
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* Компонент для определения текущего лэйаута.
|
|
9
10
|
*/
|
|
10
|
-
export declare
|
|
11
|
+
export declare function ResponsiveLayout<T extends MediaQueriesType = EmptyObject>(props: ResponsiveLayoutProps<T>): JSX.Element;
|
|
11
12
|
export {};
|