@semcore/bulk-textarea 16.0.0-prerelease.9 → 16.0.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 +38 -1
- package/lib/cjs/BulkTextarea.js +10 -8
- package/lib/cjs/BulkTextarea.js.map +1 -1
- package/lib/cjs/BulkTextarea.types.js.map +1 -1
- package/lib/cjs/components/InputField/InputField.js +42 -27
- package/lib/cjs/components/InputField/InputField.js.map +1 -1
- package/lib/cjs/components/InputField/InputField.types.js.map +1 -1
- package/lib/cjs/components/InputField/inputField.shadow.css +17 -7
- package/lib/es6/BulkTextarea.js +10 -8
- package/lib/es6/BulkTextarea.js.map +1 -1
- package/lib/es6/BulkTextarea.types.js.map +1 -1
- package/lib/es6/components/InputField/InputField.js +42 -27
- package/lib/es6/components/InputField/InputField.js.map +1 -1
- package/lib/es6/components/InputField/InputField.types.js.map +1 -1
- package/lib/es6/components/InputField/inputField.shadow.css +17 -7
- package/lib/esm/BulkTextarea.mjs +11 -8
- package/lib/esm/components/InputField/InputField.mjs +43 -27
- package/lib/esm/components/InputField/inputField.shadow.css +171 -0
- package/lib/types/BulkTextarea.d.ts +1 -1
- package/lib/types/BulkTextarea.types.d.ts +23 -21
- package/lib/types/components/InputField/InputField.d.ts +4 -4
- package/lib/types/components/InputField/InputField.types.d.ts +4 -4
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
-
## [16.0.0] - 2025-
|
|
5
|
+
## [16.0.0] - 2025-05-19
|
|
6
6
|
|
|
7
7
|
### Added
|
|
8
8
|
|
|
9
9
|
- Major version.
|
|
10
10
|
|
|
11
|
+
## [1.4.2] - 2025-05-13
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Version patch update due to children dependencies update (`@semcore/utils` [4.48.4 ~> 4.48.5]).
|
|
16
|
+
|
|
17
|
+
## [1.4.1] - 2025-05-09
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Version patch update due to children dependencies update (`@semcore/utils` [4.48.2 ~> 4.48.4], `@semcore/icon` [4.61.0 ~> 4.62.0]).
|
|
22
|
+
|
|
23
|
+
## [1.4.0] - 2025-04-11
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Version minor update due to children dependencies update (`@semcore/icon` [4.60.2 ~> 4.61.0]).
|
|
28
|
+
|
|
29
|
+
## [1.3.0] - 2025-04-01
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- New type for value/onChange. It could be `string` or `string[]`, depends on type of `value` property. `string` by default.
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- Error if after processing the inserted value it will be empty array.
|
|
38
|
+
- Error with empty `utf` characters in `onChange` / `lineProcessing`.
|
|
39
|
+
- Cursor position after focusing a non-empty field.
|
|
40
|
+
- Blinking previous error after clicking on another line with error.
|
|
41
|
+
|
|
42
|
+
## [1.2.0] - 2025-03-28
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- Version minor update due to children dependencies update (`@semcore/button` [5.42.1 ~> 5.43.0]).
|
|
47
|
+
|
|
11
48
|
## [1.1.1] - 2025-03-20
|
|
12
49
|
|
|
13
50
|
### Changed
|
package/lib/cjs/BulkTextarea.js
CHANGED
|
@@ -124,7 +124,6 @@ var BulkTextareaRoot = /*#__PURE__*/function (_Component) {
|
|
|
124
124
|
lineValidation = _this$asProps.lineValidation,
|
|
125
125
|
placeholder = _this$asProps.placeholder,
|
|
126
126
|
validateOn = _this$asProps.validateOn,
|
|
127
|
-
onChange = _this$asProps.onChange,
|
|
128
127
|
linesDelimiters = _this$asProps.linesDelimiters,
|
|
129
128
|
maxLines = _this$asProps.maxLines,
|
|
130
129
|
disabled = _this$asProps.disabled,
|
|
@@ -160,6 +159,7 @@ var BulkTextareaRoot = /*#__PURE__*/function (_Component) {
|
|
|
160
159
|
}
|
|
161
160
|
},
|
|
162
161
|
onBlur: function onBlur(value, event) {
|
|
162
|
+
var _this2$props$onChange, _this2$props;
|
|
163
163
|
if (validateOn !== null && validateOn !== void 0 && validateOn.includes('blur') && (_core.lastInteraction.isKeyboard() || event instanceof FocusEvent && event.relatedTarget !== _this2.clearAllButtonRef.current)) {
|
|
164
164
|
_this2.handlers.showErrors(true);
|
|
165
165
|
}
|
|
@@ -169,7 +169,7 @@ var BulkTextareaRoot = /*#__PURE__*/function (_Component) {
|
|
|
169
169
|
(_this2$nextButtonRef$ = _this2.nextButtonRef.current) === null || _this2$nextButtonRef$ === void 0 ? void 0 : _this2$nextButtonRef$.focus();
|
|
170
170
|
}, 250);
|
|
171
171
|
}
|
|
172
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(value, event);
|
|
172
|
+
(_this2$props$onChange = (_this2$props = _this2.props).onChange) === null || _this2$props$onChange === void 0 ? void 0 : _this2$props$onChange.call(_this2$props, value, event);
|
|
173
173
|
},
|
|
174
174
|
showErrors: showErrors,
|
|
175
175
|
validateOn: validateOn,
|
|
@@ -307,12 +307,14 @@ var BulkTextareaRoot = /*#__PURE__*/function (_Component) {
|
|
|
307
307
|
defaultShowErrors: false
|
|
308
308
|
});
|
|
309
309
|
(0, _defineProperty2["default"])(BulkTextareaRoot, "enhance", [(0, _i18nEnhance["default"])(_intergalacticDynamicLocales.localizedMessages), (0, _uniqueID["default"])()]);
|
|
310
|
-
var BulkTextarea = (
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
310
|
+
var BulkTextarea = function () {
|
|
311
|
+
return (0, _core.createComponent)(BulkTextareaRoot, {
|
|
312
|
+
InputField: _InputField.InputField,
|
|
313
|
+
Counter: _Counter.Counter,
|
|
314
|
+
ClearAll: _ClearAll.ClearAll,
|
|
315
|
+
ErrorsNavigation: _ErrorsNavigation.ErrorsNavigation
|
|
316
|
+
});
|
|
317
|
+
}();
|
|
316
318
|
var _default = BulkTextarea;
|
|
317
319
|
exports["default"] = _default;
|
|
318
320
|
//# sourceMappingURL=BulkTextarea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulkTextarea.js","names":["_core","require","_react","_interopRequireDefault","_flexBox","_InputField","_Counter","_ClearAll","_ErrorsNavigation","_intergalacticDynamicLocales","_i18nEnhance","_uniqueID","BulkTextareaRoot","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","React","createRef","linesCount","isEmptyText","errorIndex","highlightErrorIndex","isEmpty","setState","handlers","showErrors","errors","state","e","_this$inputFieldRef$c","value","textarea","inputFieldRef","current","querySelector","HTMLDivElement","focus","amount","_this$asProps$errors","asProps","itemsIndex","newIndex","handleChangeErrorIndex","setTimeout","_createClass2","key","uncontrolledProps","get","uid","getInputFieldProps","_this2","_this$asProps","size","minRows","maxRows","lineValidation","placeholder","validateOn","onChange","linesDelimiters","maxLines","disabled","readonly","pasteProps","lineProcessing","_this$asProps$errors2","_this$state","prevError","onChangeLinesCount","handleChangeLinesCount","onChangeLineIndex","includes","onBlur","event","lastInteraction","isKeyboard","FocusEvent","relatedTarget","clearAllButtonRef","_this2$nextButtonRef$","nextButtonRef","onErrorsChange","newErrors","undefined","_this2$asProps","newState","onErrorIndexChange","newErrorIndex","ref","counterId","getCounterProps","_this$asProps2","getI18nText","_this$state2","counterTheme","id","counterRef","theme","getClearAllProps","_this$asProps3","onClick","handleClickClearAll","isHidden","getErrorsNavigationProps","_this$asProps4","_this$asProps4$errors","onPrevError","onNextError","errorsCount","map","Boolean","prevButtonRef","render","_ref","createElement","Box","assignProps","Component","defaultValue","defaultState","locale","defaultErrors","defaultShowErrors","i18nEnhance","localizedMessages","uniqueIdEnhance","BulkTextarea","createComponent","InputField","Counter","ClearAll","ErrorsNavigation","_default","exports"],"sources":["../../src/BulkTextarea.tsx"],"sourcesContent":["import React from 'react';\nimport { createComponent, Component, Root, lastInteraction } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\n\nimport { BulkTextareaType, BulkTextareaProps } from './BulkTextarea.types';\n\nimport { InputField, InputFieldProps } from './components/InputField/InputField';\nimport { Counter } from './components/Counter';\nimport { ClearAll } from './components/ClearAll';\nimport { ErrorsNavigation } from './components/ErrorsNavigation';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport uniqueIdEnhance from '@semcore/core/lib/utils/uniqueID';\n\ntype State = {\n linesCount: number;\n isEmptyText: boolean;\n errorIndex: number;\n highlightErrorIndex: boolean;\n prevError?: InputFieldProps['errors'][number];\n};\n\nclass BulkTextareaRoot extends Component<\n BulkTextareaProps,\n {},\n State,\n typeof BulkTextareaRoot.enhance\n> {\n static displayName = 'BulkTextarea';\n static defaultProps = {\n defaultValue: '',\n size: 'm',\n defaultState: 'normal',\n minRows: 2,\n maxRows: 10,\n maxLines: 100,\n validateOn: 'blur',\n locale: 'en',\n defaultErrors: [],\n defaultShowErrors: false,\n };\n\n static enhance = [i18nEnhance(localizedMessages), uniqueIdEnhance()] as const;\n\n inputFieldRef = React.createRef<HTMLDivElement>();\n clearAllButtonRef = React.createRef<HTMLButtonElement>();\n nextButtonRef = React.createRef<HTMLButtonElement>();\n prevButtonRef = React.createRef<HTMLButtonElement>();\n counterRef = React.createRef<HTMLDivElement>();\n\n state: State = {\n linesCount: 0,\n isEmptyText: true,\n errorIndex: -1,\n highlightErrorIndex: false,\n };\n\n uncontrolledProps() {\n return {\n value: null,\n state: null,\n showErrors: null,\n errors: null,\n };\n }\n\n get counterId() {\n return `${this.asProps.uid}_counter`;\n }\n\n getInputFieldProps() {\n const {\n value,\n size,\n minRows,\n maxRows,\n lineValidation,\n placeholder,\n validateOn,\n onChange,\n linesDelimiters,\n maxLines,\n disabled,\n readonly,\n pasteProps,\n lineProcessing,\n errors = [],\n showErrors,\n } = this.asProps;\n const { errorIndex, prevError, linesCount, highlightErrorIndex } = this.state;\n\n return {\n value,\n size,\n state: showErrors && errors?.length > 0 ? 'invalid' : 'normal',\n disabled,\n readonly,\n minRows,\n maxRows,\n maxLines,\n placeholder,\n prevError,\n pasteProps,\n linesCount,\n lineProcessing,\n onChangeLinesCount: this.handleChangeLinesCount,\n onChangeLineIndex: () => {\n if (validateOn?.includes('blurLine')) {\n this.handlers.showErrors(true);\n }\n },\n onBlur: (value: string, event: Event) => {\n if (\n validateOn?.includes('blur') &&\n (lastInteraction.isKeyboard() ||\n (event instanceof FocusEvent && event.relatedTarget !== this.clearAllButtonRef.current))\n ) {\n this.handlers.showErrors(true);\n }\n\n if (\n this.asProps.showErrors === false &&\n (validateOn?.includes('blur') || validateOn?.includes('blurLine'))\n ) {\n setTimeout(() => {\n this.nextButtonRef.current?.focus();\n }, 250);\n }\n\n onChange?.(value, event);\n },\n showErrors,\n validateOn,\n lineValidation: lineValidation,\n errors,\n onErrorsChange: (newErrors: InputFieldProps['errors']) => {\n const prevError = newErrors.length === 0 ? errors[0] : undefined;\n this.handlers.errors(newErrors);\n this.setState({ prevError });\n setTimeout(() => {\n const { showErrors, errors } = this.asProps;\n if (showErrors) {\n const newState = newErrors.length === 0 ? 'normal' : 'invalid';\n this.handlers.state(newState);\n }\n if (errors?.length === 0) {\n this.handlers.showErrors(false);\n\n setTimeout(() => {\n this.setState({ prevError: undefined });\n }, 150);\n }\n }, 10); // this timeout to be sure that code will be after state change\n },\n highlightErrorIndex,\n errorIndex,\n onErrorIndexChange: (newErrorIndex: number) => {\n const prevError = errors[errorIndex];\n\n this.setState({ errorIndex: newErrorIndex, prevError, highlightErrorIndex: false });\n },\n linesDelimiters,\n ref: this.inputFieldRef,\n ['aria-describedby']: this.counterId,\n };\n }\n\n getCounterProps() {\n const { maxLines, getI18nText, size } = this.asProps;\n const { linesCount, isEmptyText } = this.state;\n\n let counterTheme = '';\n\n if (linesCount === maxLines) {\n counterTheme = 'warning';\n } else if (linesCount > maxLines!) {\n counterTheme = 'danger';\n }\n\n return {\n id: this.counterId,\n ref: this.counterRef,\n getI18nText,\n theme: counterTheme,\n linesCount: isEmptyText ? 0 : linesCount,\n maxLines,\n size,\n };\n }\n\n getClearAllProps() {\n const { size, getI18nText, disabled, readonly } = this.asProps;\n\n return {\n onClick: this.handleClickClearAll,\n isHidden: this.state.isEmptyText,\n size,\n getI18nText,\n ref: this.clearAllButtonRef,\n disabled: disabled || readonly,\n };\n }\n\n getErrorsNavigationProps() {\n const { size, getI18nText, disabled, readonly, errors = [], showErrors } = this.asProps;\n const { errorIndex } = this.state;\n return {\n size,\n getI18nText,\n errorIndex: errorIndex,\n onPrevError: this.handleChangeErrorIndex(-1),\n onNextError: this.handleChangeErrorIndex(1),\n errorsCount: errors.map(Boolean).length,\n showErrors,\n disabled: disabled || readonly || false,\n nextButtonRef: this.nextButtonRef,\n prevButtonRef: this.prevButtonRef,\n };\n }\n\n handleChangeLinesCount = (linesCount: number) => {\n const isEmpty = !linesCount;\n this.setState({ linesCount, isEmptyText: isEmpty });\n\n if (isEmpty) {\n this.handlers.showErrors(false);\n this.handlers.errors([]);\n this.handlers.state('normal');\n }\n };\n\n handleClickClearAll = (e: Event) => {\n this.handlers.showErrors(false);\n this.handlers.errors([]);\n this.setState({ errorIndex: -1 });\n this.handlers.value('', e);\n this.handlers.state('normal');\n\n const textarea = this.inputFieldRef.current?.querySelector('[role=\"textbox\"]');\n textarea instanceof HTMLDivElement && textarea.focus();\n };\n\n handleChangeErrorIndex = (amount: number) => () => {\n const { errors = [] } = this.asProps;\n const { errorIndex } = this.state;\n const itemsIndex = errors.length - 1;\n let newIndex = errorIndex + amount;\n\n if (newIndex < 0) {\n newIndex = amount + itemsIndex + 1;\n } else if (newIndex > itemsIndex) {\n newIndex = newIndex - itemsIndex - 1;\n }\n\n if (!errors[newIndex]) {\n this.handleChangeErrorIndex(amount < 0 ? amount - 1 : amount + 1)();\n } else {\n this.handlers.showErrors(false);\n this.setState({ errorIndex: -1 });\n\n setTimeout(() => {\n this.handlers.showErrors(true);\n this.setState({ errorIndex: newIndex, highlightErrorIndex: true });\n });\n }\n };\n\n render() {\n return <Root render={Box} __excludeProps={['onBlur', 'value', 'placeholder']} />;\n }\n}\n\nconst BulkTextarea = createComponent(BulkTextareaRoot, {\n InputField,\n Counter,\n ClearAll,\n ErrorsNavigation,\n}) as BulkTextareaType;\n\nexport default BulkTextarea;\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AAIA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAP,OAAA;AACA,IAAAQ,4BAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,SAAA,GAAAR,sBAAA,CAAAF,OAAA;AAA+D,IAUzDW,gBAAgB,0BAAAC,UAAA;EAAA,IAAAC,UAAA,aAAAF,gBAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,gBAAA;EAAA,SAAAA,iBAAA;IAAA,IAAAK,KAAA;IAAA,IAAAC,gBAAA,mBAAAN,gBAAA;IAAA,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,GAAAF,MAAA,CAAAU,IAAA,CAAAC,KAAA,CAAAX,MAAA,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AAH,IAAA,EAAI;IAClF;EAAC;EAAA,OAAAnH,gBAAA;AAAA,EAvP4BuH,eAAS;AAAA,IAAAvG,gBAAA,aAAlChB,gBAAgB,iBAMC,cAAc;AAAA,IAAAgB,gBAAA,aAN/BhB,gBAAgB,kBAOE;EACpBwH,YAAY,EAAE,EAAE;EAChBlE,IAAI,EAAE,GAAG;EACTmE,YAAY,EAAE,QAAQ;EACtBlE,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,EAAE;EACXM,QAAQ,EAAE,GAAG;EACbH,UAAU,EAAE,MAAM;EAClB+D,MAAM,EAAE,IAAI;EACZC,aAAa,EAAE,EAAE;EACjBC,iBAAiB,EAAE;AACrB,CAAC;AAAA,IAAA5G,gBAAA,aAlBGhB,gBAAgB,aAoBH,CAAC,IAAA6H,uBAAW,EAACC,8CAAiB,CAAC,EAAE,IAAAC,oBAAe,GAAE,CAAC;AAsOtE,IAAMC,YAAY,GAAG,IAAAC,qBAAe,EAACjI,gBAAgB,EAAE;EACrDkI,UAAU,EAAVA,sBAAU;EACVC,OAAO,EAAPA,gBAAO;EACPC,QAAQ,EAARA,kBAAQ;EACRC,gBAAgB,EAAhBA;AACF,CAAC,CAAqB;AAAC,IAAAC,QAAA,GAERN,YAAY;AAAAO,OAAA,cAAAD,QAAA"}
|
|
1
|
+
{"version":3,"file":"BulkTextarea.js","names":["_core","require","_react","_interopRequireDefault","_flexBox","_InputField","_Counter","_ClearAll","_ErrorsNavigation","_intergalacticDynamicLocales","_i18nEnhance","_uniqueID","BulkTextareaRoot","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","React","createRef","linesCount","isEmptyText","errorIndex","highlightErrorIndex","isEmpty","setState","handlers","showErrors","errors","state","e","_this$inputFieldRef$c","value","textarea","inputFieldRef","current","querySelector","HTMLDivElement","focus","amount","_this$asProps$errors","asProps","itemsIndex","newIndex","handleChangeErrorIndex","setTimeout","_createClass2","key","uncontrolledProps","get","uid","getInputFieldProps","_this2","_this$asProps","size","minRows","maxRows","lineValidation","placeholder","validateOn","linesDelimiters","maxLines","disabled","readonly","pasteProps","lineProcessing","_this$asProps$errors2","_this$state","prevError","onChangeLinesCount","handleChangeLinesCount","onChangeLineIndex","includes","onBlur","event","_this2$props$onChange","_this2$props","lastInteraction","isKeyboard","FocusEvent","relatedTarget","clearAllButtonRef","_this2$nextButtonRef$","nextButtonRef","props","onChange","onErrorsChange","newErrors","undefined","_this2$asProps","newState","onErrorIndexChange","newErrorIndex","ref","counterId","getCounterProps","_this$asProps2","getI18nText","_this$state2","counterTheme","id","counterRef","theme","getClearAllProps","_this$asProps3","onClick","handleClickClearAll","isHidden","getErrorsNavigationProps","_this$asProps4","_this$asProps4$errors","onPrevError","onNextError","errorsCount","map","Boolean","prevButtonRef","render","_ref","createElement","Box","assignProps","Component","defaultValue","defaultState","locale","defaultErrors","defaultShowErrors","i18nEnhance","localizedMessages","uniqueIdEnhance","BulkTextarea","createComponent","InputField","Counter","ClearAll","ErrorsNavigation","_default","exports"],"sources":["../../src/BulkTextarea.tsx"],"sourcesContent":["import React from 'react';\nimport { createComponent, Component, Root, lastInteraction } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\n\nimport { BulkTextareaType, BulkTextareaProps } from './BulkTextarea.types';\n\nimport { InputField, InputFieldProps } from './components/InputField/InputField';\nimport { Counter } from './components/Counter';\nimport { ClearAll } from './components/ClearAll';\nimport { ErrorsNavigation } from './components/ErrorsNavigation';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport uniqueIdEnhance from '@semcore/core/lib/utils/uniqueID';\n\ntype State<T extends string | string[]> = {\n linesCount: number;\n isEmptyText: boolean;\n errorIndex: number;\n highlightErrorIndex: boolean;\n prevError?: InputFieldProps<T>['errors'][number];\n};\n\nclass BulkTextareaRoot<T extends string | string[]> extends Component<\n BulkTextareaProps<T>,\n {},\n State<T>,\n typeof BulkTextareaRoot.enhance\n> {\n static displayName = 'BulkTextarea';\n static defaultProps = {\n defaultValue: '',\n size: 'm',\n defaultState: 'normal',\n minRows: 2,\n maxRows: 10,\n maxLines: 100,\n validateOn: 'blur',\n locale: 'en',\n defaultErrors: [],\n defaultShowErrors: false,\n };\n\n static enhance = [i18nEnhance(localizedMessages), uniqueIdEnhance()] as const;\n\n inputFieldRef = React.createRef<HTMLDivElement>();\n clearAllButtonRef = React.createRef<HTMLButtonElement>();\n nextButtonRef = React.createRef<HTMLButtonElement>();\n prevButtonRef = React.createRef<HTMLButtonElement>();\n counterRef = React.createRef<HTMLDivElement>();\n\n state: State<T> = {\n linesCount: 0,\n isEmptyText: true,\n errorIndex: -1,\n highlightErrorIndex: false,\n };\n\n uncontrolledProps() {\n return {\n value: null,\n state: null,\n showErrors: null,\n errors: null,\n };\n }\n\n get counterId() {\n return `${this.asProps.uid}_counter`;\n }\n\n getInputFieldProps() {\n const {\n value,\n size,\n minRows,\n maxRows,\n lineValidation,\n placeholder,\n validateOn,\n linesDelimiters,\n maxLines,\n disabled,\n readonly,\n pasteProps,\n lineProcessing,\n errors = [],\n showErrors,\n } = this.asProps;\n const { errorIndex, prevError, linesCount, highlightErrorIndex } = this.state;\n\n return {\n value,\n size,\n state: showErrors && errors?.length > 0 ? 'invalid' : 'normal',\n disabled,\n readonly,\n minRows,\n maxRows,\n maxLines,\n placeholder,\n prevError,\n pasteProps,\n linesCount,\n lineProcessing,\n onChangeLinesCount: this.handleChangeLinesCount,\n onChangeLineIndex: () => {\n if (validateOn?.includes('blurLine')) {\n this.handlers.showErrors(true);\n }\n },\n onBlur: (value: T, event: Event) => {\n if (\n validateOn?.includes('blur') &&\n (lastInteraction.isKeyboard() ||\n (event instanceof FocusEvent && event.relatedTarget !== this.clearAllButtonRef.current))\n ) {\n this.handlers.showErrors(true);\n }\n\n if (\n this.asProps.showErrors === false &&\n (validateOn?.includes('blur') || validateOn?.includes('blurLine'))\n ) {\n setTimeout(() => {\n this.nextButtonRef.current?.focus();\n }, 250);\n }\n\n this.props.onChange?.(value, event);\n },\n showErrors,\n validateOn,\n lineValidation: lineValidation,\n errors,\n onErrorsChange: (newErrors: InputFieldProps<T>['errors']) => {\n const prevError = newErrors.length === 0 ? errors[0] : undefined;\n this.handlers.errors(newErrors);\n this.setState({ prevError });\n setTimeout(() => {\n const { showErrors, errors } = this.asProps;\n if (showErrors) {\n const newState = newErrors.length === 0 ? 'normal' : 'invalid';\n this.handlers.state(newState);\n }\n if (errors?.length === 0) {\n this.handlers.showErrors(false);\n\n setTimeout(() => {\n this.setState({ prevError: undefined });\n }, 150);\n }\n }, 10); // this timeout to be sure that code will be after state change\n },\n highlightErrorIndex,\n errorIndex,\n onErrorIndexChange: (newErrorIndex: number) => {\n const prevError = errors[errorIndex];\n\n this.setState({ errorIndex: newErrorIndex, prevError, highlightErrorIndex: false });\n },\n linesDelimiters,\n ref: this.inputFieldRef,\n ['aria-describedby']: this.counterId,\n };\n }\n\n getCounterProps() {\n const { maxLines, getI18nText, size } = this.asProps;\n const { linesCount, isEmptyText } = this.state;\n\n let counterTheme = '';\n\n if (linesCount === maxLines) {\n counterTheme = 'warning';\n } else if (linesCount > maxLines!) {\n counterTheme = 'danger';\n }\n\n return {\n id: this.counterId,\n ref: this.counterRef,\n getI18nText,\n theme: counterTheme,\n linesCount: isEmptyText ? 0 : linesCount,\n maxLines,\n size,\n };\n }\n\n getClearAllProps() {\n const { size, getI18nText, disabled, readonly } = this.asProps;\n\n return {\n onClick: this.handleClickClearAll,\n isHidden: this.state.isEmptyText,\n size,\n getI18nText,\n ref: this.clearAllButtonRef,\n disabled: disabled || readonly,\n };\n }\n\n getErrorsNavigationProps() {\n const { size, getI18nText, disabled, readonly, errors = [], showErrors } = this.asProps;\n const { errorIndex } = this.state;\n return {\n size,\n getI18nText,\n errorIndex: errorIndex,\n onPrevError: this.handleChangeErrorIndex(-1),\n onNextError: this.handleChangeErrorIndex(1),\n errorsCount: errors.map(Boolean).length,\n showErrors,\n disabled: disabled || readonly || false,\n nextButtonRef: this.nextButtonRef,\n prevButtonRef: this.prevButtonRef,\n };\n }\n\n handleChangeLinesCount = (linesCount: number) => {\n const isEmpty = !linesCount;\n this.setState({ linesCount, isEmptyText: isEmpty });\n\n if (isEmpty) {\n this.handlers.showErrors(false);\n this.handlers.errors([]);\n this.handlers.state('normal');\n }\n };\n\n handleClickClearAll = (e: Event) => {\n this.handlers.showErrors(false);\n this.handlers.errors([]);\n this.setState({ errorIndex: -1 });\n this.handlers.value('', e);\n this.handlers.state('normal');\n\n const textarea = this.inputFieldRef.current?.querySelector('[role=\"textbox\"]');\n textarea instanceof HTMLDivElement && textarea.focus();\n };\n\n handleChangeErrorIndex = (amount: number) => () => {\n const { errors = [] } = this.asProps;\n const { errorIndex } = this.state;\n const itemsIndex = errors.length - 1;\n let newIndex = errorIndex + amount;\n\n if (newIndex < 0) {\n newIndex = amount + itemsIndex + 1;\n } else if (newIndex > itemsIndex) {\n newIndex = newIndex - itemsIndex - 1;\n }\n\n if (!errors[newIndex]) {\n this.handleChangeErrorIndex(amount < 0 ? amount - 1 : amount + 1)();\n } else {\n this.handlers.showErrors(false);\n this.setState({ errorIndex: -1 });\n\n setTimeout(() => {\n this.handlers.showErrors(true);\n this.setState({ errorIndex: newIndex, highlightErrorIndex: true });\n });\n }\n };\n\n render() {\n return <Root render={Box} __excludeProps={['onBlur', 'value', 'placeholder']} />;\n }\n}\n\nconst BulkTextarea = (<T extends string | string[]>() =>\n createComponent(BulkTextareaRoot, {\n InputField,\n Counter,\n ClearAll,\n ErrorsNavigation,\n }) as BulkTextareaType<T>)();\n\nexport default BulkTextarea;\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AAIA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA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AA,aAlBGhB,gBAAgB,aAoBH,CAAC,IAAAgI,uBAAW,EAACC,8CAAiB,CAAC,EAAE,IAAAC,oBAAe,GAAE,CAAC;AAqOtE,IAAMC,YAAY,GAAI;EAAA,OACpB,IAAAC,qBAAe,EAACpI,gBAAgB,EAAE;IAChCqI,UAAU,EAAVA,sBAAU;IACVC,OAAO,EAAPA,gBAAO;IACPC,QAAQ,EAARA,kBAAQ;IACRC,gBAAgB,EAAhBA;EACF,CAAC,CAAC;AAAA,CAAuB,EAAG;AAAC,IAAAC,QAAA,GAEhBN,YAAY;AAAAO,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulkTextarea.types.js","names":[],"sources":["../../src/BulkTextarea.types.ts"],"sourcesContent":["import { Intergalactic } from '@semcore/core';\nimport { BoxProps } from '@semcore/flex-box';\nimport Button from '@semcore/button';\nimport { InputFieldProps } from './components/InputField/InputField';\nimport { CounterProps } from './components/Counter';\nimport { ErrorsNavigationProps } from './components/ErrorsNavigation';\n\nexport type BulkTextareaProps = {\n value?: InputFieldProps['value'];\n onChange?: InputFieldProps['onBlur'];\n placeholder?: InputFieldProps['placeholder'];\n size?: InputFieldProps['size'];\n state?: InputFieldProps['state'];\n disabled?: InputFieldProps['disabled'];\n readonly?: InputFieldProps['readonly'];\n\n minRows?: InputFieldProps['minRows'];\n maxRows?: InputFieldProps['maxRows'];\n\n validateOn?: InputFieldProps['validateOn'];\n lineValidation?: InputFieldProps['lineValidation'];\n linesDelimiters?: InputFieldProps['linesDelimiters'];\n pasteProps?: InputFieldProps['pasteProps'];\n\n maxLines?: InputFieldProps['maxLines'];\n lineProcessing?: InputFieldProps['lineProcessing'];\n\n errors?: InputFieldProps['errors'];\n showErrors?: boolean;\n\n onErrorsChange?: InputFieldProps['onErrorsChange'];\n onShowErrorsChange?: InputFieldProps['onShowErrorsChange'];\n};\n\
|
|
1
|
+
{"version":3,"file":"BulkTextarea.types.js","names":[],"sources":["../../src/BulkTextarea.types.ts"],"sourcesContent":["import { Intergalactic } from '@semcore/core';\nimport { BoxProps } from '@semcore/flex-box';\nimport Button from '@semcore/button';\nimport { InputFieldProps } from './components/InputField/InputField';\nimport { CounterProps } from './components/Counter';\nimport { ErrorsNavigationProps } from './components/ErrorsNavigation';\n\nexport type BulkTextareaProps<T extends string | string[]> = {\n value?: InputFieldProps<T>['value'];\n onChange?: InputFieldProps<T>['onBlur'];\n placeholder?: InputFieldProps<T>['placeholder'];\n size?: InputFieldProps<T>['size'];\n state?: InputFieldProps<T>['state'];\n disabled?: InputFieldProps<T>['disabled'];\n readonly?: InputFieldProps<T>['readonly'];\n\n minRows?: InputFieldProps<T>['minRows'];\n maxRows?: InputFieldProps<T>['maxRows'];\n\n validateOn?: InputFieldProps<T>['validateOn'];\n lineValidation?: InputFieldProps<T>['lineValidation'];\n linesDelimiters?: InputFieldProps<T>['linesDelimiters'];\n pasteProps?: InputFieldProps<T>['pasteProps'];\n\n maxLines?: InputFieldProps<T>['maxLines'];\n lineProcessing?: InputFieldProps<T>['lineProcessing'];\n\n errors?: InputFieldProps<T>['errors'];\n showErrors?: boolean;\n\n onErrorsChange?: InputFieldProps<T>['onErrorsChange'];\n onShowErrorsChange?: InputFieldProps<T>['onShowErrorsChange'];\n};\n\ntype BulkTextareaComponent = (<T extends string | string[]>(\n props: Intergalactic.InternalTypings.ComponentProps<\n 'div',\n 'div',\n BoxProps & BulkTextareaProps<T>\n >,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', {}>;\n\nexport type BulkTextareaType<T extends string | string[]> = BulkTextareaComponent & {\n InputField: Intergalactic.Component<\n 'div',\n Pick<InputFieldProps<T>, 'commonErrorMessage' | 'id'> & Partial<BulkTextareaProps<T>> & BoxProps\n >;\n Counter: Intergalactic.Component<'div', Partial<CounterProps>>;\n ClearAll: typeof Button;\n ErrorsNavigation: Intergalactic.Component<'div', Partial<ErrorsNavigationProps>>;\n};\n"],"mappings":""}
|
|
@@ -21,19 +21,21 @@ var _tooltip = _interopRequireDefault(require("@semcore/tooltip"));
|
|
|
21
21
|
var _ariaProps = require("@semcore/core/lib/utils/ariaProps");
|
|
22
22
|
var _uniqueID = _interopRequireDefault(require("@semcore/core/lib/utils/uniqueID"));
|
|
23
23
|
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
24
|
-
|
|
25
|
-
var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/".
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
24
|
+
/*!__reshadow-styles__:"./inputField.shadow.css"*/
|
|
25
|
+
var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/".___SInputField_1q3lj_gg_>div{box-sizing:content-box;outline:0;border-radius:var(--intergalactic-control-rounded, 6px);border-color:var(--intergalactic-border-primary, #c4c7cf);border-style:solid;border-width:1px;overflow:auto;position:relative;background-color:var(--intergalactic-bg-primary-neutral, #ffffff);color:var(--intergalactic-text-primary, #191b23);word-wrap:break-word;word-break:break-word;font-family:inherit}.___SInputField_1q3lj_gg_>div:empty::before{content:\"1. \"attr(placeholder);color:var(--intergalactic-text-placeholder, #8a8e9b);position:absolute}.___SInputField_1q3lj_gg_>div:nth-child(even){color:red;counter-increment:row;margin-bottom:var(--intergalactic-spacing-1x, 4px);position:relative;word-break:break-all}.___SInputField_1q3lj_gg_>div:nth-child(even)::before{content:counter(row)\".\";display:inline-block;white-space:nowrap;text-align:right;color:var(--intergalactic-text-secondary, #6c6e79);margin-right:var(--intergalactic-spacing-1x, 4px)}.___SInputField_1q3lj_gg_>div>p{counter-increment:row;margin:0 0 var(--intergalactic-spacing-1x, 4px)0;position:relative;word-break:break-all;white-space:pre-wrap;padding:0 var(--intergalactic-spacing-5x, 20px)0 var(--intergalactic-spacing-4x, 16px)}.___SInputField_1q3lj_gg_>div>p:last-of-type{margin-bottom:0}.___SInputField_1q3lj_gg_>div>p:not(:empty)::before{content:counter(row)\".\";display:inline-block;white-space:nowrap;text-align:right;color:var(--intergalactic-text-secondary, #6c6e79);margin-right:var(--intergalactic-spacing-1x, 4px);position:absolute;left:0}.___SInputField_1q3lj_gg_>div>p[data-over-max-rows=true]{background-color:var(--intergalactic-bg-secondary-critical, #fff0f7)}.___SInputField_1q3lj_gg_>div:has(p:nth-child(n+10))>p{padding-left:var(--intergalactic-spacing-6x, 24px)}.___SInputField_1q3lj_gg_>div:has(p:nth-child(n+10))>p:nth-child(-n+9)::before{padding-left:var(--intergalactic-spacing-2x, 8px)}.___SInputField_1q3lj_gg_>div:has(p:nth-child(n+100))>p{padding-left:var(--intergalactic-spacing-8x, 32px)}.___SInputField_1q3lj_gg_>div:has(p:nth-child(n+100))>p:nth-child(-n+9)::before{padding-left:var(--intergalactic-spacing-4x, 16px)}.___SInputField_1q3lj_gg_>div:has(p:nth-child(n+100))>p:nth-child(n+10)::before{padding-left:var(--intergalactic-spacing-2x, 8px)}.___SInputField_1q3lj_gg_>div:has(p:nth-child(n+100))>p:nth-child(n+100)::before{padding-left:0}.___SInputField_1q3lj_gg_.__showErrors_1q3lj_gg_>div[aria-invalid]>p[aria-invalid]:after{content:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBmaWxsPSIjZDEwMDJmIj48cGF0aCBkPSJNNyA2aDJ2NEg3VjZabTIgN3YtMkg3djJoMloiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTYuMTUyIDEuMTcyYy43MTktMS41NjMgMi45NzctMS41NjMgMy42OTYgMGw2LjA0MyAxMy4xNDFjLjM2My43OTEtLjIyNSAxLjY4Ny0xLjEwOSAxLjY4N0gxLjIxOGMtLjg4NCAwLTEuNDcyLS44OTYtMS4xMDktMS42ODdMNi4xNTIgMS4xNzJabTcuMzc0IDEyLjgzN0w4IDEuOTkgMi40NzQgMTQuMDFoMTEuMDUyWiIvPjwvc3ZnPgo=\\ );position:absolute;right:0;top:var(--intergalactic-spacing-05x, 2px)}.___SInputField_1q3lj_gg_._size_m_1q3lj_gg_>div{padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-4x, 16px);font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%);min-height:calc(var(--minRows_1q3lj)*20px);max-height:calc((var(--maxRows_1q3lj) - 1)*(20px + var(--intergalactic-spacing-1x, 4px)) + 18px)}.___SInputField_1q3lj_gg_._size_m_1q3lj_gg_>div:empty{padding-left:var(--intergalactic-spacing-8x, 32px)}.___SInputField_1q3lj_gg_._size_l_1q3lj_gg_>div:empty::before,.___SInputField_1q3lj_gg_._size_m_1q3lj_gg_>div:empty::before{left:var(--intergalactic-spacing-4x, 16px)}.___SInputField_1q3lj_gg_._size_l_1q3lj_gg_>div{padding:var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-4x, 16px);font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%);min-height:calc(var(--minRows_1q3lj)*24px);max-height:calc((var(--maxRows_1q3lj) - 1)*(24px + var(--intergalactic-spacing-1x, 4px)) + 20px)}.___SInputField_1q3lj_gg_._size_l_1q3lj_gg_>div:empty{padding-left:calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-05x, 2px))}.___SInputField_1q3lj_gg_._state_normal_1q3lj_gg_:not(.__disabled_1q3lj_gg_)>div:focus:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));border-color:var(--intergalactic-border-info-active, #006dca)}.___SInputField_1q3lj_gg_._state_valid_1q3lj_gg_>div{border-color:var(--intergalactic-border-success-active, #007c65)}.___SInputField_1q3lj_gg_._state_valid_1q3lj_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px rgba(0, 159, 129, 0.5))}.___SInputField_1q3lj_gg_._state_invalid_1q3lj_gg_>div{border-color:var(--intergalactic-border-critical-active, #d1002f);background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(209, 0, 47, 1) 0, rgba(209, 0, 47, 1) 2px, transparent 0, transparent 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff);border-bottom-left-radius:var(--intergalactic-control-rounded, 6px);border-top-left-radius:var(--intergalactic-control-rounded, 6px);background-repeat:repeat-y}.___SInputField_1q3lj_gg_._state_invalid_1q3lj_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px rgba(255, 73, 83, 0.5))}.___SInputField_1q3lj_gg_.__readonly_1q3lj_gg_>div{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SInputField_1q3lj_gg_.__disabled_1q3lj_gg_>div{opacity:var(--intergalactic-disabled-opacity, 0.3)}", /*__inner_css_end__*/"1q3lj_gg_"),
|
|
26
|
+
/*__reshadow_css_end__*/
|
|
27
|
+
{
|
|
28
|
+
"__SInputField": "___SInputField_1q3lj_gg_",
|
|
29
|
+
"_showErrors": "__showErrors_1q3lj_gg_",
|
|
30
|
+
"_readonly": "__readonly_1q3lj_gg_",
|
|
31
|
+
"_disabled": "__disabled_1q3lj_gg_",
|
|
32
|
+
"_size_m": "_size_m_1q3lj_gg_",
|
|
33
|
+
"--minRows": "--minRows_1q3lj",
|
|
34
|
+
"--maxRows": "--maxRows_1q3lj",
|
|
35
|
+
"_size_l": "_size_l_1q3lj_gg_",
|
|
36
|
+
"_state_normal": "_state_normal_1q3lj_gg_",
|
|
37
|
+
"_state_valid": "_state_valid_1q3lj_gg_",
|
|
38
|
+
"_state_invalid": "_state_invalid_1q3lj_gg_"
|
|
37
39
|
});
|
|
38
40
|
var InputField = /*#__PURE__*/function (_Component) {
|
|
39
41
|
(0, _inherits2["default"])(InputField, _Component);
|
|
@@ -106,8 +108,11 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
106
108
|
lineProcessing = _this$props.lineProcessing,
|
|
107
109
|
_this$props$ariaDesc = _this$props['aria-describedby'],
|
|
108
110
|
ariaDescribedby = _this$props$ariaDesc === void 0 ? '' : _this$props$ariaDesc;
|
|
109
|
-
if (prevProps.value !== value
|
|
110
|
-
this.
|
|
111
|
+
if (prevProps.value !== value) {
|
|
112
|
+
var currentValue = this.getValues().join(this.delimiter);
|
|
113
|
+
if (typeof value === 'string' ? value !== currentValue : value.join(this.delimiter) !== currentValue) {
|
|
114
|
+
this.handleValueOutChange();
|
|
115
|
+
}
|
|
111
116
|
}
|
|
112
117
|
if (prevProps.showErrors !== showErrors || prevProps.errors.length !== errors.length) {
|
|
113
118
|
this.toggleAriaInvalid(showErrors, errors.length);
|
|
@@ -274,8 +279,6 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
274
279
|
}, {
|
|
275
280
|
key: "handleMouseDown",
|
|
276
281
|
value: function handleMouseDown(event) {
|
|
277
|
-
// we need to change keyboardLineIndex, because the caret in real on that current row
|
|
278
|
-
this.errorByInteraction = 'keyboard';
|
|
279
282
|
var element = event.target;
|
|
280
283
|
if (element instanceof HTMLElement) {
|
|
281
284
|
// we need to change keyboardLineIndex, because the caret in real on that current row
|
|
@@ -325,6 +328,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
325
328
|
var validateOn = this.asProps.validateOn;
|
|
326
329
|
var value = (_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 ? void 0 : _event$clipboardData.getData('text/plain');
|
|
327
330
|
var listOfNodes = value ? this.prepareNodesForPaste(value) : [];
|
|
331
|
+
if (listOfNodes.length === 0) return;
|
|
328
332
|
var selection = document.getSelection();
|
|
329
333
|
if (selection !== null && selection !== void 0 && selection.anchorNode && selection !== null && selection !== void 0 && selection.focusNode) {
|
|
330
334
|
var anchorOffset = selection.anchorOffset;
|
|
@@ -349,17 +353,19 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
349
353
|
var _anchorNode$textConte, _anchorNode$textConte2, _focusNode$textConten, _focusNode$textConten2, _ref3;
|
|
350
354
|
var before = (_anchorNode$textConte = anchorNode === null || anchorNode === void 0 ? void 0 : (_anchorNode$textConte2 = anchorNode.textContent) === null || _anchorNode$textConte2 === void 0 ? void 0 : _anchorNode$textConte2.substring(0, fromOffset)) !== null && _anchorNode$textConte !== void 0 ? _anchorNode$textConte : '';
|
|
351
355
|
var after = (_focusNode$textConten = focusNode === null || focusNode === void 0 ? void 0 : (_focusNode$textConten2 = focusNode.textContent) === null || _focusNode$textConten2 === void 0 ? void 0 : _focusNode$textConten2.substring(toOffset)) !== null && _focusNode$textConten !== void 0 ? _focusNode$textConten : '';
|
|
356
|
+
var noEmptyLineBefore = before.trim() === '' ? '' : before;
|
|
357
|
+
var noEmptyLineAfter = after.trim() === '' ? '' : after;
|
|
352
358
|
selection.deleteFromDocument();
|
|
353
359
|
if (documentPosition !== 0) {
|
|
354
360
|
this.textarea.removeChild(focusNode);
|
|
355
361
|
}
|
|
356
362
|
var firstNodeToInsert = listOfNodes.splice(0, 1)[0];
|
|
357
363
|
var _lastNodeToInsert = listOfNodes[listOfNodes.length - 1];
|
|
358
|
-
anchorNode.textContent = (_ref3 =
|
|
364
|
+
anchorNode.textContent = (_ref3 = noEmptyLineBefore + (firstNodeToInsert === null || firstNodeToInsert === void 0 ? void 0 : firstNodeToInsert.textContent)) !== null && _ref3 !== void 0 ? _ref3 : '';
|
|
359
365
|
anchorNode.after.apply(anchorNode, (0, _toConsumableArray2["default"])(listOfNodes));
|
|
360
366
|
if (_lastNodeToInsert) {
|
|
361
367
|
var _lastNodeToInsert$tex2, _lastNodeToInsert$tex3;
|
|
362
|
-
_lastNodeToInsert.textContent = ((_lastNodeToInsert$tex2 = _lastNodeToInsert.textContent) !== null && _lastNodeToInsert$tex2 !== void 0 ? _lastNodeToInsert$tex2 : '') +
|
|
368
|
+
_lastNodeToInsert.textContent = ((_lastNodeToInsert$tex2 = _lastNodeToInsert.textContent) !== null && _lastNodeToInsert$tex2 !== void 0 ? _lastNodeToInsert$tex2 : '') + noEmptyLineAfter;
|
|
363
369
|
textNode = _lastNodeToInsert.childNodes.item(0);
|
|
364
370
|
position = ((_lastNodeToInsert$tex3 = _lastNodeToInsert.textContent) !== null && _lastNodeToInsert$tex3 !== void 0 ? _lastNodeToInsert$tex3 : '').length;
|
|
365
371
|
this.validateLine(_lastNodeToInsert);
|
|
@@ -367,7 +373,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
367
373
|
} else {
|
|
368
374
|
var _anchorNode$textConte3, _anchorNode$textConte4;
|
|
369
375
|
position = ((_anchorNode$textConte3 = anchorNode.textContent) !== null && _anchorNode$textConte3 !== void 0 ? _anchorNode$textConte3 : '').length;
|
|
370
|
-
anchorNode.textContent = ((_anchorNode$textConte4 = anchorNode.textContent) !== null && _anchorNode$textConte4 !== void 0 ? _anchorNode$textConte4 : '') +
|
|
376
|
+
anchorNode.textContent = ((_anchorNode$textConte4 = anchorNode.textContent) !== null && _anchorNode$textConte4 !== void 0 ? _anchorNode$textConte4 : '') + noEmptyLineAfter;
|
|
371
377
|
textNode = anchorNode.childNodes.item(0);
|
|
372
378
|
this.validateLine(anchorNode);
|
|
373
379
|
this.setErrorIndex(anchorNode);
|
|
@@ -518,11 +524,13 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
518
524
|
});
|
|
519
525
|
var _this$asProps4 = this.asProps,
|
|
520
526
|
validateOn = _this$asProps4.validateOn,
|
|
521
|
-
onBlur = _this$asProps4.onBlur
|
|
527
|
+
onBlur = _this$asProps4.onBlur,
|
|
528
|
+
value = _this$asProps4.value;
|
|
522
529
|
if (validateOn.includes('blur')) {
|
|
523
530
|
this.recalculateErrors();
|
|
524
531
|
}
|
|
525
|
-
|
|
532
|
+
var valueToChange = typeof value === 'string' ? this.getValues().join(this.delimiter) : this.getValues();
|
|
533
|
+
onBlur(valueToChange, event);
|
|
526
534
|
setTimeout(function () {
|
|
527
535
|
_this4.setState({
|
|
528
536
|
keyboardLineIndex: -1
|
|
@@ -753,8 +761,9 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
753
761
|
};
|
|
754
762
|
var skipEmptyLines = (_pasteProps$skipEmpty = pasteProps === null || pasteProps === void 0 ? void 0 : pasteProps.skipEmptyLines) !== null && _pasteProps$skipEmpty !== void 0 ? _pasteProps$skipEmpty : this.skipEmptyLines;
|
|
755
763
|
var delimiter = (_pasteProps$delimiter = pasteProps === null || pasteProps === void 0 ? void 0 : pasteProps.delimiter) !== null && _pasteProps$delimiter !== void 0 ? _pasteProps$delimiter : this.delimiter;
|
|
756
|
-
value.split(delimiter)
|
|
757
|
-
|
|
764
|
+
var lines = Array.isArray(value) ? value : value.split(delimiter);
|
|
765
|
+
lines.forEach(function (line, index) {
|
|
766
|
+
var preparedLine = lineProcessing(line, index, lines.length);
|
|
758
767
|
if (preparedLine === '' && skipEmptyLines === false || preparedLine !== '') {
|
|
759
768
|
var node = document.createElement('p');
|
|
760
769
|
if (preparedLine === '') {
|
|
@@ -822,7 +831,12 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
822
831
|
var values = [];
|
|
823
832
|
this.textarea.childNodes.forEach(function (node) {
|
|
824
833
|
var _node$textContent;
|
|
825
|
-
|
|
834
|
+
if (((_node$textContent = node.textContent) === null || _node$textContent === void 0 ? void 0 : _node$textContent.trim()) === '') {
|
|
835
|
+
values.push('');
|
|
836
|
+
} else {
|
|
837
|
+
var _node$textContent2;
|
|
838
|
+
values.push((_node$textContent2 = node.textContent) !== null && _node$textContent2 !== void 0 ? _node$textContent2 : '');
|
|
839
|
+
}
|
|
826
840
|
});
|
|
827
841
|
return values;
|
|
828
842
|
}
|
|
@@ -879,6 +893,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
879
893
|
}
|
|
880
894
|
return newState;
|
|
881
895
|
}, function () {
|
|
896
|
+
_this10.errorByInteraction = key === 'mouseLineIndex' ? 'mouse' : 'keyboard';
|
|
882
897
|
var trigger = isInvalidRow ? targetElement : _this10.textarea;
|
|
883
898
|
if (_this10.shouldChangePopperTrigger(trigger)) {
|
|
884
899
|
var _this10$setPopperTrig;
|
|
@@ -933,8 +948,8 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
933
948
|
value: function validateLine(node) {
|
|
934
949
|
var lineValidation = this.asProps.lineValidation;
|
|
935
950
|
if (lineValidation && node instanceof HTMLElement) {
|
|
936
|
-
var _node$
|
|
937
|
-
var _lineValidation = lineValidation((_node$
|
|
951
|
+
var _node$textContent3;
|
|
952
|
+
var _lineValidation = lineValidation((_node$textContent3 = node.textContent) !== null && _node$textContent3 !== void 0 ? _node$textContent3 : '', this.getValues()),
|
|
938
953
|
isValid = _lineValidation.isValid,
|
|
939
954
|
errorMessage = _lineValidation.errorMessage;
|
|
940
955
|
if (!isValid) {
|