@semcore/bulk-textarea 16.2.0-prerelease.4 → 16.2.1-prerelease.1
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 +6 -0
- package/README.md +1 -31
- package/lib/cjs/BulkTextarea.js +28 -28
- package/lib/cjs/BulkTextarea.js.map +1 -1
- package/lib/cjs/BulkTextarea.types.js.map +1 -1
- package/lib/cjs/components/ClearAll.js +2 -2
- package/lib/cjs/components/ClearAll.js.map +1 -1
- package/lib/cjs/components/Counter.js +3 -3
- package/lib/cjs/components/Counter.js.map +1 -1
- package/lib/cjs/components/ErrorsNavigation.js +12 -12
- package/lib/cjs/components/ErrorsNavigation.js.map +1 -1
- package/lib/cjs/components/InputField/InputField.js +87 -91
- package/lib/cjs/components/InputField/InputField.js.map +1 -1
- package/lib/cjs/components/InputField/InputField.types.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +4 -5
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/BulkTextarea.js +26 -25
- package/lib/es6/BulkTextarea.js.map +1 -1
- package/lib/es6/BulkTextarea.types.js.map +1 -1
- package/lib/es6/components/ClearAll.js +2 -2
- package/lib/es6/components/ClearAll.js.map +1 -1
- package/lib/es6/components/Counter.js +2 -2
- package/lib/es6/components/Counter.js.map +1 -1
- package/lib/es6/components/ErrorsNavigation.js +9 -9
- package/lib/es6/components/ErrorsNavigation.js.map +1 -1
- package/lib/es6/components/InputField/InputField.js +87 -90
- package/lib/es6/components/InputField/InputField.js.map +1 -1
- package/lib/es6/components/InputField/InputField.types.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/BulkTextarea.mjs +28 -24
- package/lib/esm/components/ClearAll.mjs +1 -1
- package/lib/esm/components/Counter.mjs +2 -2
- package/lib/esm/components/ErrorsNavigation.mjs +3 -3
- package/lib/esm/components/InputField/InputField.mjs +86 -85
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/BulkTextarea.d.ts +1 -1
- package/lib/types/BulkTextarea.types.d.ts +6 -6
- package/lib/types/components/ClearAll.d.ts +2 -2
- package/lib/types/components/Counter.d.ts +4 -4
- package/lib/types/components/ErrorsNavigation.d.ts +2 -2
- package/lib/types/components/InputField/InputField.d.ts +6 -6
- package/lib/types/components/InputField/InputField.types.d.ts +29 -29
- package/package.json +10 -10
package/lib/es6/BulkTextarea.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import
|
|
3
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
|
+
import _isNativeReflectConstruct from "@babel/runtime/helpers/isNativeReflectConstruct";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
4
6
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
6
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
8
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
8
|
-
|
|
9
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
10
|
import { createComponent, Component, Root, lastInteraction } from '@semcore/core';
|
|
11
|
+
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
12
|
+
import uniqueIdEnhance from '@semcore/core/lib/utils/uniqueID';
|
|
10
13
|
import { Box } from '@semcore/flex-box';
|
|
11
|
-
import
|
|
12
|
-
import { Counter } from './components/Counter';
|
|
14
|
+
import React from 'react';
|
|
13
15
|
import { ClearAll } from './components/ClearAll';
|
|
16
|
+
import { Counter } from './components/Counter';
|
|
14
17
|
import { ErrorsNavigation } from './components/ErrorsNavigation';
|
|
18
|
+
import { InputField } from './components/InputField/InputField';
|
|
15
19
|
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
16
|
-
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
17
|
-
import uniqueIdEnhance from '@semcore/core/lib/utils/uniqueID';
|
|
18
20
|
var BulkTextareaRoot = /*#__PURE__*/function (_Component) {
|
|
19
|
-
_inherits(BulkTextareaRoot, _Component);
|
|
20
|
-
var _super = _createSuper(BulkTextareaRoot);
|
|
21
21
|
function BulkTextareaRoot() {
|
|
22
22
|
var _this;
|
|
23
23
|
_classCallCheck(this, BulkTextareaRoot);
|
|
24
24
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
25
|
args[_key] = arguments[_key];
|
|
26
26
|
}
|
|
27
|
-
_this =
|
|
28
|
-
_defineProperty(
|
|
29
|
-
_defineProperty(
|
|
30
|
-
_defineProperty(
|
|
31
|
-
_defineProperty(
|
|
32
|
-
_defineProperty(
|
|
33
|
-
_defineProperty(
|
|
27
|
+
_this = _callSuper(this, BulkTextareaRoot, [].concat(args));
|
|
28
|
+
_defineProperty(_this, "inputFieldRef", /*#__PURE__*/React.createRef());
|
|
29
|
+
_defineProperty(_this, "clearAllButtonRef", /*#__PURE__*/React.createRef());
|
|
30
|
+
_defineProperty(_this, "nextButtonRef", /*#__PURE__*/React.createRef());
|
|
31
|
+
_defineProperty(_this, "prevButtonRef", /*#__PURE__*/React.createRef());
|
|
32
|
+
_defineProperty(_this, "counterRef", /*#__PURE__*/React.createRef());
|
|
33
|
+
_defineProperty(_this, "state", {
|
|
34
34
|
linesCount: 0,
|
|
35
35
|
isEmptyText: true,
|
|
36
36
|
errorIndex: -1,
|
|
37
37
|
highlightErrorIndex: false
|
|
38
38
|
});
|
|
39
|
-
_defineProperty(
|
|
39
|
+
_defineProperty(_this, "handleChangeLinesCount", function (linesCount) {
|
|
40
40
|
var isEmpty = !linesCount;
|
|
41
41
|
_this.setState({
|
|
42
42
|
linesCount: linesCount,
|
|
@@ -48,7 +48,7 @@ var BulkTextareaRoot = /*#__PURE__*/function (_Component) {
|
|
|
48
48
|
_this.handlers.state('normal');
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
-
_defineProperty(
|
|
51
|
+
_defineProperty(_this, "handleClickClearAll", function (e) {
|
|
52
52
|
var _this$inputFieldRef$c;
|
|
53
53
|
_this.handlers.showErrors(false);
|
|
54
54
|
_this.handlers.errors([]);
|
|
@@ -58,9 +58,11 @@ var BulkTextareaRoot = /*#__PURE__*/function (_Component) {
|
|
|
58
58
|
_this.handlers.value('', e);
|
|
59
59
|
_this.handlers.state('normal');
|
|
60
60
|
var textarea = (_this$inputFieldRef$c = _this.inputFieldRef.current) === null || _this$inputFieldRef$c === void 0 ? void 0 : _this$inputFieldRef$c.querySelector('[role="textbox"]');
|
|
61
|
-
textarea instanceof HTMLDivElement
|
|
61
|
+
if (textarea instanceof HTMLDivElement) {
|
|
62
|
+
textarea.focus();
|
|
63
|
+
}
|
|
62
64
|
});
|
|
63
|
-
_defineProperty(
|
|
65
|
+
_defineProperty(_this, "handleChangeErrorIndex", function (amount) {
|
|
64
66
|
return function () {
|
|
65
67
|
var _this$asProps$errors = _this.asProps.errors,
|
|
66
68
|
errors = _this$asProps$errors === void 0 ? [] : _this$asProps$errors;
|
|
@@ -91,7 +93,8 @@ var BulkTextareaRoot = /*#__PURE__*/function (_Component) {
|
|
|
91
93
|
});
|
|
92
94
|
return _this;
|
|
93
95
|
}
|
|
94
|
-
|
|
96
|
+
_inherits(BulkTextareaRoot, _Component);
|
|
97
|
+
return _createClass(BulkTextareaRoot, [{
|
|
95
98
|
key: "uncontrolledProps",
|
|
96
99
|
value: function uncontrolledProps() {
|
|
97
100
|
return {
|
|
@@ -160,10 +163,10 @@ var BulkTextareaRoot = /*#__PURE__*/function (_Component) {
|
|
|
160
163
|
if (_this2.asProps.showErrors === false && (validateOn !== null && validateOn !== void 0 && validateOn.includes('blur') || validateOn !== null && validateOn !== void 0 && validateOn.includes('blurLine'))) {
|
|
161
164
|
setTimeout(function () {
|
|
162
165
|
var _this2$nextButtonRef$;
|
|
163
|
-
(_this2$nextButtonRef$ = _this2.nextButtonRef.current) === null || _this2$nextButtonRef$ === void 0
|
|
166
|
+
(_this2$nextButtonRef$ = _this2.nextButtonRef.current) === null || _this2$nextButtonRef$ === void 0 || _this2$nextButtonRef$.focus();
|
|
164
167
|
}, 250);
|
|
165
168
|
}
|
|
166
|
-
(_this2$props$onChange = (_this2$props = _this2.props).onChange) === null || _this2$props$onChange === void 0
|
|
169
|
+
(_this2$props$onChange = (_this2$props = _this2.props).onChange) === null || _this2$props$onChange === void 0 || _this2$props$onChange.call(_this2$props, value, event);
|
|
167
170
|
},
|
|
168
171
|
showErrors: showErrors,
|
|
169
172
|
validateOn: validateOn,
|
|
@@ -193,7 +196,6 @@ var BulkTextareaRoot = /*#__PURE__*/function (_Component) {
|
|
|
193
196
|
}
|
|
194
197
|
}, 10); // this timeout to be sure that code will be after state change
|
|
195
198
|
},
|
|
196
|
-
|
|
197
199
|
highlightErrorIndex: highlightErrorIndex,
|
|
198
200
|
errorIndex: errorIndex,
|
|
199
201
|
onErrorIndexChange: function onErrorIndexChange(newErrorIndex) {
|
|
@@ -285,7 +287,6 @@ var BulkTextareaRoot = /*#__PURE__*/function (_Component) {
|
|
|
285
287
|
}, _ref));
|
|
286
288
|
}
|
|
287
289
|
}]);
|
|
288
|
-
return BulkTextareaRoot;
|
|
289
290
|
}(Component);
|
|
290
291
|
_defineProperty(BulkTextareaRoot, "displayName", 'BulkTextarea');
|
|
291
292
|
_defineProperty(BulkTextareaRoot, "defaultProps", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulkTextarea.js","names":["React","createComponent","Component","Root","lastInteraction","Box","InputField","Counter","ClearAll","ErrorsNavigation","localizedMessages","i18nEnhance","uniqueIdEnhance","BulkTextareaRoot","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","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","_createClass","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","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","_assignProps","defaultValue","defaultState","locale","defaultErrors","defaultShowErrors","BulkTextarea"],"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":";;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,eAAe,QAAQ,eAAe;AACjF,SAASC,GAAG,QAAQ,mBAAmB;AAIvC,SAASC,UAAU,QAAyB,oCAAoC;AAChF,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,iBAAiB,QAAQ,gDAAgD;AAClF,OAAOC,WAAW,MAAM,8CAA8C;AACtE,OAAOC,eAAe,MAAM,kCAAkC;AAAC,IAUzDC,gBAAgB,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,gBAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,gBAAA;EAAA,SAAAA,iBAAA;IAAA,IAAAK,KAAA;IAAAC,eAAA,OAAAN,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,SAAAY,MAAA,CAAAL,IAAA;IAAAM,eAAA,CAAAC,sBAAA,CAAAZ,KAAA,iCAsBJlB,KAAK,CAAC+B,SAAS,EAAkB;IAAAF,eAAA,CAAAC,sBAAA,CAAAZ,KAAA,qCAC7BlB,KAAK,CAAC+B,SAAS,EAAqB;IAAAF,eAAA,CAAAC,sBAAA,CAAAZ,KAAA,iCACx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AAQ;EACtBlE,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,EAAE;EACXK,QAAQ,EAAE,GAAG;EACbF,UAAU,EAAE,MAAM;EAClB+D,MAAM,EAAE,IAAI;EACZC,aAAa,EAAE,EAAE;EACjBC,iBAAiB,EAAE;AACrB,CAAC;AAAA3G,eAAA,CAlBGhB,gBAAgB,aAoBH,CAACF,WAAW,CAACD,iBAAiB,CAAC,EAAEE,eAAe,EAAE,CAAC;AAqOtE,IAAM6H,YAAY,GAAI;EAAA,OACpBxI,eAAe,CAACY,gBAAgB,EAAE;IAChCP,UAAU,EAAVA,UAAU;IACVC,OAAO,EAAPA,OAAO;IACPC,QAAQ,EAARA,QAAQ;IACRC,gBAAgB,EAAhBA;EACF,CAAC,CAAC;AAAA,CAAuB,EAAG;AAE9B,eAAegI,YAAY"}
|
|
1
|
+
{"version":3,"file":"BulkTextarea.js","names":["createComponent","Component","Root","lastInteraction","i18nEnhance","uniqueIdEnhance","Box","React","ClearAll","Counter","ErrorsNavigation","InputField","localizedMessages","BulkTextareaRoot","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","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","_inherits","_createClass","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","isKeyboard","FocusEvent","relatedTarget","clearAllButtonRef","_this2$nextButtonRef$","nextButtonRef","props","onChange","call","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","_assignProps","defaultValue","defaultState","locale","defaultErrors","defaultShowErrors","BulkTextarea"],"sources":["../../src/BulkTextarea.tsx"],"sourcesContent":["import { createComponent, Component, Root, lastInteraction } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport uniqueIdEnhance from '@semcore/core/lib/utils/uniqueID';\nimport { Box } from '@semcore/flex-box';\nimport React from 'react';\n\nimport type { BulkTextareaType, BulkTextareaProps } from './BulkTextarea.types';\nimport { ClearAll } from './components/ClearAll';\nimport { Counter } from './components/Counter';\nimport { ErrorsNavigation } from './components/ErrorsNavigation';\nimport { InputField, type InputFieldProps } from './components/InputField/InputField';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\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 if (textarea instanceof HTMLDivElement) {\n textarea.focus();\n }\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":";;;;;;;;;AAAA,SAASA,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,eAAe,QAAQ,eAAe;AACjF,OAAOC,WAAW,MAAM,8CAA8C;AACtE,OAAOC,eAAe,MAAM,kCAAkC;AAC9D,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,KAAK,MAAM,OAAO;AAGzB,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,UAAU,QAA8B,oCAAoC;AACrF,SAASC,iBAAiB,QAAQ,gDAAgD;AAAC,IAU7EC,gBAAgB,0BAAAC,UAAA;EAAA,SAAAD,iBAAA;IAAA,IAAAE,KAAA;IAAAC,eAAA,OAAAH,gBAAA;IAAA,SAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAA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GAAA;IAAAhB,KAAA,EAmDD,SAAAsF,MAAMA,CAAA,EAAG;MAAA,IAAAC,IAAA,QAAA9E,OAAA;MACP,oBAAOzC,KAAA,CAAAwH,aAAA,CAAczH,GAAG,EAAA0H,YAAA;QAAA,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa;MAAC,GAAAF,IAAA,CAAG,CAAC;IAClF;EAAC;AAAA,EAxPyD7H,SAAS;AAAAwB,eAAA,CAA/DZ,gBAAgB,iBAMC,cAAc;AAAAY,eAAA,CAN/BZ,gBAAgB,kBAOE;EACpBoH,YAAY,EAAE,EAAE;EAChBnE,IAAI,EAAE,GAAG;EACToE,YAAY,EAAE,QAAQ;EACtBnE,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,EAAE;EACXK,QAAQ,EAAE,GAAG;EACbF,UAAU,EAAE,MAAM;EAClBgE,MAAM,EAAE,IAAI;EACZC,aAAa,EAAE,EAAE;EACjBC,iBAAiB,EAAE;AACrB,CAAC;AAAA5G,eAAA,CAlBGZ,gBAAgB,aAoBH,CAACT,WAAW,CAACQ,iBAAiB,CAAC,EAAEP,eAAe,CAAC,CAAC,CAAC;AAuOtE,IAAMiI,YAAY,GAAI;EAAA,OACpBtI,eAAe,CAACa,gBAAgB,EAAE;IAChCF,UAAU,EAAVA,UAAU;IACVF,OAAO,EAAPA,OAAO;IACPD,QAAQ,EAARA,QAAQ;IACRE,gBAAgB,EAAhBA;EACF,CAAC,CAAC;AAAA,CAAuB,CAAE,CAAC;AAE9B,eAAe4H,YAAY","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulkTextarea.types.js","names":[],"sources":["../../src/BulkTextarea.types.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"BulkTextarea.types.js","names":[],"sources":["../../src/BulkTextarea.types.ts"],"sourcesContent":["import type Button from '@semcore/button';\nimport type { Intergalactic } from '@semcore/core';\nimport type { BoxProps } from '@semcore/flex-box';\n\nimport type { CounterProps } from './components/Counter';\nimport type { ErrorsNavigationProps } from './components/ErrorsNavigation';\nimport type { InputFieldProps } from './components/InputField/InputField';\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) &\nIntergalactic.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":"","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { Root, sstyled } from '@semcore/core';
|
|
5
3
|
import Button from '@semcore/button';
|
|
4
|
+
import { Root, sstyled } from '@semcore/core';
|
|
6
5
|
import CloseM from '@semcore/icon/Close/m';
|
|
6
|
+
import React from 'react';
|
|
7
7
|
export function ClearAll(props) {
|
|
8
8
|
var _ref = arguments[0],
|
|
9
9
|
_ref2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearAll.js","names":["
|
|
1
|
+
{"version":3,"file":"ClearAll.js","names":["Button","Root","sstyled","CloseM","React","ClearAll","props","_ref","arguments[0]","_ref2","SButton","isHidden","styles","createElement","cn","_objectSpread","_assignProps","getI18nText"],"sources":["../../../src/components/ClearAll.tsx"],"sourcesContent":["import Button from '@semcore/button';\nimport { type IRootComponentProps, Root, sstyled } from '@semcore/core';\nimport type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';\nimport CloseM from '@semcore/icon/Close/m';\nimport React from 'react';\n\nexport function ClearAll(\n props: IRootComponentProps & { isHidden: boolean; getI18nText: ReturnType<typeof useI18n> },\n) {\n const SButton = Root;\n return (\n !props.isHidden &&\n sstyled(props.styles)(\n <SButton render={Button} theme='muted' use='tertiary' addonLeft={CloseM}>\n {props.getI18nText('BulkTextarea.ClearAllButton.buttonText')}\n </SButton>,\n )\n );\n}\n"],"mappings":";;AAAA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SAAmCC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AAEvE,OAAOC,MAAM,MAAM,uBAAuB;AAC1C,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAO,SAASC,QAAQA,CACtBC,KAA2F,EAC3F;EAAA,IAAAC,IAAA,GAAAC,YAAA;IAAAC,KAAA;EACA,IAAMC,OAAO,GAIQV,MAAM;EAH3B,OACE,CAACM,KAAK,CAACK,QAAQ,KAAAF,KAAA,GACfP,OAAO,CAACI,KAAK,CAACM,MAAM,CAAC,eACnBR,KAAA,CAAAS,aAAA,CAACH,OAAO,EAAAD,KAAA,CAAAK,EAAA,YAAAC,aAAA,KAAAC,YAAA;IAAA,SAAuB,OAAO;IAAA,OAAK,UAAU;IAAA,aAAYb;EAAM,GAAAI,IAAA,KACpED,KAAK,CAACW,WAAW,CAAC,wCAAwC,CACpD,CAAC,CACX;AAEL","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import { Root } from '@semcore/core';
|
|
4
|
-
import { ScreenReaderOnly } from '@semcore/flex-box';
|
|
5
3
|
import CounterKit from '@semcore/counter';
|
|
4
|
+
import { ScreenReaderOnly } from '@semcore/flex-box';
|
|
5
|
+
import React from 'react';
|
|
6
6
|
export function Counter(props) {
|
|
7
7
|
var _ref = arguments[0];
|
|
8
8
|
var theme = props.theme,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Counter.js","names":["
|
|
1
|
+
{"version":3,"file":"Counter.js","names":["Root","CounterKit","ScreenReaderOnly","React","Counter","props","_ref","arguments[0]","theme","linesCount","maxLines","getI18nText","createElement","_assignProps","rowsNumber"],"sources":["../../../src/components/Counter.tsx"],"sourcesContent":["import { Root } from '@semcore/core';\nimport type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';\nimport CounterKit, { type CounterProps as CounterPropsKit } from '@semcore/counter';\nimport { ScreenReaderOnly } from '@semcore/flex-box';\nimport React from 'react';\n\nexport type CounterProps = {\n theme: CounterPropsKit['theme'];\n linesCount: number;\n maxLines: number;\n getI18nText: ReturnType<typeof useI18n>;\n};\n\nexport function Counter(props: CounterProps) {\n const { theme, linesCount, maxLines, getI18nText } = props;\n\n return (\n <Root render={CounterKit} ml={1} theme={theme}>\n {linesCount}\n <span aria-hidden='true'>\n /\n {maxLines}\n </span>\n <ScreenReaderOnly>\n {getI18nText('BulkTextarea.Counter.ofAllowedRows:sr-message', { rowsNumber: maxLines })}\n </ScreenReaderOnly>\n {theme === 'warning' && (\n <ScreenReaderOnly>\n {getI18nText('BulkTextarea.Counter.limitReached:sr-message')}\n </ScreenReaderOnly>\n )}\n {theme === 'danger' && (\n <ScreenReaderOnly>\n {getI18nText('BulkTextarea.Counter.limitExceeded:sr-message')}\n </ScreenReaderOnly>\n )}\n </Root>\n );\n}\n"],"mappings":";AAAA,SAASA,IAAI,QAAQ,eAAe;AAEpC,OAAOC,UAAU,MAAgD,kBAAkB;AACnF,SAASC,gBAAgB,QAAQ,mBAAmB;AACpD,OAAOC,KAAK,MAAM,OAAO;AASzB,OAAO,SAASC,OAAOA,CAACC,KAAmB,EAAE;EAAA,IAAAC,IAAA,GAAAC,YAAA;EAC3C,IAAQC,KAAK,GAAwCH,KAAK,CAAlDG,KAAK;IAAEC,UAAU,GAA4BJ,KAAK,CAA3CI,UAAU;IAAEC,QAAQ,GAAkBL,KAAK,CAA/BK,QAAQ;IAAEC,WAAW,GAAKN,KAAK,CAArBM,WAAW;EAEhD,oBACER,KAAA,CAAAS,aAAA,CAAcX,UAAU,EAAAY,YAAA;IAAA,MAAM,CAAC;IAAA,SAASL;EAAK,GAAAF,IAAA,GAC1CG,UAAU,eACXN,KAAA,CAAAS,aAAA;IAAM,eAAY;EAAM,GAAC,GAEvB,EAACF,QACG,CAAC,eACPP,KAAA,CAAAS,aAAA,CAACV,gBAAgB,QACdS,WAAW,CAAC,+CAA+C,EAAE;IAAEG,UAAU,EAAEJ;EAAS,CAAC,CACtE,CAAC,EAClBF,KAAK,KAAK,SAAS,iBAClBL,KAAA,CAAAS,aAAA,CAACV,gBAAgB,QACdS,WAAW,CAAC,8CAA8C,CAC3C,CACnB,EACAH,KAAK,KAAK,QAAQ,iBACjBL,KAAA,CAAAS,aAAA,CAACV,gBAAgB,QACdS,WAAW,CAAC,+CAA+C,CAC5C,CAEhB,CAAC;AAEX","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import Button from '@semcore/button';
|
|
3
2
|
import { Flex } from '@semcore/flex-box';
|
|
4
|
-
import { Text } from '@semcore/typography';
|
|
5
|
-
import ChevronUpM from '@semcore/icon/ChevronUp/m';
|
|
6
3
|
import ChevronDownM from '@semcore/icon/ChevronDown/m';
|
|
4
|
+
import ChevronUpM from '@semcore/icon/ChevronUp/m';
|
|
5
|
+
import { Text } from '@semcore/typography';
|
|
6
|
+
import React from 'react';
|
|
7
7
|
export function ErrorsNavigation(props) {
|
|
8
8
|
var errorIndex = props.errorIndex,
|
|
9
9
|
errorsCount = props.errorsCount,
|
|
@@ -20,19 +20,19 @@ export function ErrorsNavigation(props) {
|
|
|
20
20
|
}, errorsCount > 0 && showErrors && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
21
21
|
onClick: onNextError,
|
|
22
22
|
addonLeft: ChevronDownM,
|
|
23
|
-
use:
|
|
24
|
-
theme:
|
|
23
|
+
use: "tertiary",
|
|
24
|
+
theme: "muted",
|
|
25
25
|
"aria-label": getI18nText('BulkTextarea.ErrorsNavigation.nextError:aria-label'),
|
|
26
|
-
hintPlacement:
|
|
26
|
+
hintPlacement: "bottom",
|
|
27
27
|
disabled: disabled,
|
|
28
28
|
ref: nextButtonRef
|
|
29
29
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
30
30
|
onClick: onPrevError,
|
|
31
31
|
addonLeft: ChevronUpM,
|
|
32
|
-
use:
|
|
33
|
-
theme:
|
|
32
|
+
use: "tertiary",
|
|
33
|
+
theme: "muted",
|
|
34
34
|
"aria-label": getI18nText('BulkTextarea.ErrorsNavigation.previousError:aria-label'),
|
|
35
|
-
hintPlacement:
|
|
35
|
+
hintPlacement: "bottom",
|
|
36
36
|
disabled: disabled,
|
|
37
37
|
ref: prevButtonRef
|
|
38
38
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorsNavigation.js","names":["
|
|
1
|
+
{"version":3,"file":"ErrorsNavigation.js","names":["Button","Flex","ChevronDownM","ChevronUpM","Text","React","ErrorsNavigation","props","errorIndex","errorsCount","onPrevError","onNextError","size","showErrors","getI18nText","disabled","nextButtonRef","prevButtonRef","createElement","alignItems","Fragment","onClick","addonLeft","use","theme","hintPlacement","ref","color","ml"],"sources":["../../../src/components/ErrorsNavigation.tsx"],"sourcesContent":["import Button from '@semcore/button';\nimport type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';\nimport { Flex } from '@semcore/flex-box';\nimport ChevronDownM from '@semcore/icon/ChevronDown/m';\nimport ChevronUpM from '@semcore/icon/ChevronUp/m';\nimport { Text } from '@semcore/typography';\nimport React from 'react';\n\nexport type ErrorsNavigationProps = {\n errorIndex: number;\n onPrevError: () => void;\n onNextError: () => void;\n errorsCount: number;\n size: 'm' | 'l';\n showErrors: boolean;\n getI18nText: ReturnType<typeof useI18n>;\n disabled: boolean;\n nextButtonRef: React.RefObject<HTMLButtonElement>;\n prevButtonRef: React.RefObject<HTMLButtonElement>;\n};\n\nexport function ErrorsNavigation(props: ErrorsNavigationProps) {\n const {\n errorIndex,\n errorsCount,\n onPrevError,\n onNextError,\n size,\n showErrors,\n getI18nText,\n disabled,\n nextButtonRef,\n prevButtonRef,\n } = props;\n return (\n <Flex alignItems='center'>\n {errorsCount > 0 && showErrors && (\n <>\n <Button\n onClick={onNextError}\n addonLeft={ChevronDownM}\n use='tertiary'\n theme='muted'\n aria-label={getI18nText('BulkTextarea.ErrorsNavigation.nextError:aria-label')}\n hintPlacement='bottom'\n disabled={disabled}\n ref={nextButtonRef}\n />\n <Button\n onClick={onPrevError}\n addonLeft={ChevronUpM}\n use='tertiary'\n theme='muted'\n aria-label={getI18nText('BulkTextarea.ErrorsNavigation.previousError:aria-label')}\n hintPlacement='bottom'\n disabled={disabled}\n ref={prevButtonRef}\n />\n <Text size={size === 'l' ? 300 : 200} color='text-critical' ml={1} disabled={disabled}>\n {errorIndex === -1\n ? getI18nText('BulkTextarea.ErrorsNavigation.totalErrors', { errorsCount })\n : getI18nText('BulkTextarea.ErrorsNavigation.selectedError', {\n errorIndex: errorIndex + 1,\n errorsCount,\n })}\n </Text>\n </>\n )}\n </Flex>\n );\n}\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAEpC,SAASC,IAAI,QAAQ,mBAAmB;AACxC,OAAOC,YAAY,MAAM,6BAA6B;AACtD,OAAOC,UAAU,MAAM,2BAA2B;AAClD,SAASC,IAAI,QAAQ,qBAAqB;AAC1C,OAAOC,KAAK,MAAM,OAAO;AAezB,OAAO,SAASC,gBAAgBA,CAACC,KAA4B,EAAE;EAC7D,IACEC,UAAU,GAURD,KAAK,CAVPC,UAAU;IACVC,WAAW,GASTF,KAAK,CATPE,WAAW;IACXC,WAAW,GAQTH,KAAK,CARPG,WAAW;IACXC,WAAW,GAOTJ,KAAK,CAPPI,WAAW;IACXC,IAAI,GAMFL,KAAK,CANPK,IAAI;IACJC,UAAU,GAKRN,KAAK,CALPM,UAAU;IACVC,WAAW,GAITP,KAAK,CAJPO,WAAW;IACXC,QAAQ,GAGNR,KAAK,CAHPQ,QAAQ;IACRC,aAAa,GAEXT,KAAK,CAFPS,aAAa;IACbC,aAAa,GACXV,KAAK,CADPU,aAAa;EAEf,oBACEZ,KAAA,CAAAa,aAAA,CAACjB,IAAI;IAACkB,UAAU,EAAC;EAAQ,GACtBV,WAAW,GAAG,CAAC,IAAII,UAAU,iBAC5BR,KAAA,CAAAa,aAAA,CAAAb,KAAA,CAAAe,QAAA,qBACEf,KAAA,CAAAa,aAAA,CAAClB,MAAM;IACLqB,OAAO,EAAEV,WAAY;IACrBW,SAAS,EAAEpB,YAAa;IACxBqB,GAAG,EAAC,UAAU;IACdC,KAAK,EAAC,OAAO;IACb,cAAYV,WAAW,CAAC,oDAAoD,CAAE;IAC9EW,aAAa,EAAC,QAAQ;IACtBV,QAAQ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