@semcore/bulk-textarea 16.6.2 → 17.0.0-prerelease.17
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 +4 -4
- package/lib/cjs/BulkTextarea.js +248 -269
- package/lib/cjs/BulkTextarea.js.map +1 -1
- package/lib/cjs/BulkTextarea.types.js.map +1 -1
- package/lib/cjs/components/ClearAll.js +9 -8
- package/lib/cjs/components/ClearAll.js.map +1 -1
- package/lib/cjs/components/Counter.js +12 -10
- package/lib/cjs/components/Counter.js.map +1 -1
- package/lib/cjs/components/ErrorsNavigation.js +22 -20
- package/lib/cjs/components/ErrorsNavigation.js.map +1 -1
- package/lib/cjs/components/InputField/InputField.js +916 -1045
- package/lib/cjs/components/InputField/InputField.js.map +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +16 -16
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/BulkTextarea.js +242 -263
- package/lib/es6/BulkTextarea.js.map +1 -1
- package/lib/es6/BulkTextarea.types.js.map +1 -1
- package/lib/es6/components/ClearAll.js +8 -7
- package/lib/es6/components/ClearAll.js.map +1 -1
- package/lib/es6/components/Counter.js +7 -5
- package/lib/es6/components/Counter.js.map +1 -1
- package/lib/es6/components/ErrorsNavigation.js +15 -13
- package/lib/es6/components/ErrorsNavigation.js.map +1 -1
- package/lib/es6/components/InputField/InputField.js +910 -1040
- package/lib/es6/components/InputField/InputField.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +15 -15
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/BulkTextarea.mjs +244 -223
- package/lib/esm/components/ClearAll.mjs +8 -7
- package/lib/esm/components/Counter.mjs +7 -2
- package/lib/esm/components/ErrorsNavigation.mjs +13 -2
- package/lib/esm/components/InputField/InputField.mjs +903 -981
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/types/BulkTextarea.types.d.ts +1 -1
- package/lib/types/components/InputField/InputField.d.ts +6 -2
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulkTextarea.js","names":["_core","require","_i18nEnhance","_interopRequireDefault","_uniqueID","_flexBox","_react","_ClearAll","_Counter","_ErrorsNavigation","_InputField","_intergalacticDynamicLocales","BulkTextareaRoot","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","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","_inherits2","_createClass2","key","uncontrolledProps","get","uid","getInputFieldProps","_this2","_this$asProps","size","minRows","maxRows","lineValidation","placeholder","validateOn","linesDelimiters","maxLines","disabled","readonly","pasteProps","lineProcessing","_this$asProps$errors2","onImmediatelyChange","_this$state","prevError","onChangeLinesCount","handleChangeLinesCount","onChangeLineIndex","includes","onBlur","event","_this2$props$onChange","_this2$props","lastInteraction","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","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 { 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 onImmediatelyChange,\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 onImmediatelyChange,\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,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAH,sBAAA,CAAAF,OAAA;AAGA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,4BAAA,GAAAV,OAAA;AAAmF,IAU7EW,gBAAgB,0BAAAC,UAAA;EAAA,SAAAD,iBAAA;IAAA,IAAAE,KAAA;IAAA,IAAAC,gBAAA,mBAAAH,gBAAA;IAAA,SAAAI,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,OAAAQ,WAAA,mBAAAV,gBAAA,KAAAW,MAAA,CAAAJ,IAAA;IAAA,IAAAK,gBAAA,aAAAV,KAAA,gCAsBJW,iBAAK,CAACC,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,MAAA,YAAA2H,aAAA,CAAcC,YAAG,MAAAlI,KAAA,CAAAmI,WAAA;QAAA,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa;MAAC,GAAAH,IAAA,CAAG,CAAC;IAClF;EAAC;AAAA,EA1PyDI,eAAS;AAAA,IAAA5G,gBAAA,aAA/DZ,gBAAgB,iBAMC,cAAc;AAAA,IAAAY,gBAAA,aAN/BZ,gBAAgB,kBAOE;EACpByH,YAAY,EAAE,EAAE;EAChBvE,IAAI,EAAE,GAAG;EACTwE,YAAY,EAAE,QAAQ;EACtBvE,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,EAAE;EACXK,QAAQ,EAAE,GAAG;EACbF,UAAU,EAAE,MAAM;EAClBoE,MAAM,EAAE,IAAI;EACZC,aAAa,EAAE,EAAE;EACjBC,iBAAiB,EAAE;AACrB,CAAC;AAAA,IAAAjH,gBAAA,aAlBGZ,gBAAgB,aAoBH,CAAC,IAAA8H,uBAAW,EAACC,8CAAiB,CAAC,EAAE,IAAAC,oBAAe,EAAC,CAAC,CAAC;AAyOtE,IAAMC,YAAY,GAAI;EAAA,OACpB,IAAAC,qBAAe,EAAClI,gBAAgB,EAAE;IAChCmI,UAAU,EAAVA,sBAAU;IACVC,OAAO,EAAPA,gBAAO;IACPC,QAAQ,EAARA,kBAAQ;IACRC,gBAAgB,EAAhBA;EACF,CAAC,CAAC;AAAA,CAAuB,CAAE,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEhBP,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"BulkTextarea.js","names":["_core","require","_baseComponents","_i18nEnhance","_interopRequireDefault","_uniqueID","_react","_ClearAll","_Counter","_ErrorsNavigation","_InputField","_intergalacticDynamicLocales","BulkTextareaRoot","Component","constructor","args","_defineProperty2","default","React","createRef","linesCount","isEmptyText","errorIndex","highlightErrorIndex","isEmpty","setState","handlers","showErrors","errors","state","e","value","textarea","inputFieldRef","current","querySelector","HTMLDivElement","focus","amount","asProps","itemsIndex","length","newIndex","handleChangeErrorIndex","setTimeout","uncontrolledProps","counterId","uid","getInputFieldProps","size","minRows","maxRows","lineValidation","placeholder","validateOn","linesDelimiters","maxLines","disabled","readonly","pasteProps","lineProcessing","onImmediatelyChange","prevError","onChangeLinesCount","handleChangeLinesCount","onChangeLineIndex","includes","onBlur","event","lastInteraction","isKeyboard","FocusEvent","relatedTarget","clearAllButtonRef","nextButtonRef","props","onChange","onErrorsChange","newErrors","undefined","newState","onErrorIndexChange","newErrorIndex","ref","getCounterProps","getI18nText","counterTheme","id","counterRef","theme","getClearAllProps","onClick","handleClickClearAll","isHidden","getErrorsNavigationProps","onPrevError","onNextError","errorsCount","map","Boolean","prevButtonRef","render","_ref","createElement","Box","assignProps","defaultValue","defaultState","locale","defaultErrors","defaultShowErrors","i18nEnhance","localizedMessages","uniqueIdEnhance","BulkTextarea","createComponent","InputField","Counter","ClearAll","ErrorsNavigation","_default","exports"],"sources":["../../src/BulkTextarea.tsx"],"sourcesContent":["import { Box } from '@semcore/base-components';\nimport { 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 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 typeof BulkTextareaRoot.enhance,\n {\n value: null;\n state: null;\n showErrors: null;\n errors: null;\n },\n {},\n State<T>\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 onImmediatelyChange,\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 onImmediatelyChange,\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 // @ts-ignore\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 unknown as BulkTextareaType<T>)();\n\nexport default BulkTextarea;\n"],"mappings":";;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAD,sBAAA,CAAA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ent":["import type
|
|
1
|
+
{"version":3,"file":"BulkTextarea.types.js","names":[],"sources":["../../src/BulkTextarea.types.ts"],"sourcesContent":["import type { BoxProps } from '@semcore/base-components';\nimport type Button from '@semcore/button';\nimport type { Intergalactic } from '@semcore/core';\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 /** The current value */\n value?: InputFieldProps<T>['value'];\n /** Callback triggered when the onBlur event is emmited */\n onChange?: InputFieldProps<T>['onBlur'];\n /** Placeholder text */\n placeholder?: InputFieldProps<T>['placeholder'];\n /** Component size */\n size?: InputFieldProps<T>['size'];\n /** State for show errors or valid(green) borders */\n state?: InputFieldProps<T>['state'];\n /** Defines whether the textarea is disabled */\n disabled?: InputFieldProps<T>['disabled'];\n /** Defines whether the textarea is readonly */\n readonly?: InputFieldProps<T>['readonly'];\n /** Minimum number of rows to display */\n minRows?: InputFieldProps<T>['minRows'];\n /** Maximum number of rows to display */\n maxRows?: InputFieldProps<T>['maxRows'];\n /** An event when a validation occurs */\n validateOn?: InputFieldProps<T>['validateOn'];\n /** A function to valide the line */\n lineValidation?: InputFieldProps<T>['lineValidation'];\n /** Line delimeters */\n linesDelimiters?: InputFieldProps<T>['linesDelimiters'];\n /** Defines the props for paste action */\n pasteProps?: InputFieldProps<T>['pasteProps'];\n /** Maximum number of allowed lines/values */\n maxLines?: InputFieldProps<T>['maxLines'];\n /** Function to process individual lines during input */\n lineProcessing?: InputFieldProps<T>['lineProcessing'];\n /** List of errors */\n errors?: InputFieldProps<T>['errors'];\n /** Defines whether to show errors or not */\n showErrors?: boolean;\n /** Internal */\n onErrorsChange?: InputFieldProps<T>['onErrorsChange'];\n /** Internal */\n onShowErrorsChange?: InputFieldProps<T>['onShowErrorsChange'];\n /** Internal */\n onImmediatelyChange?: InputFieldProps<T>['onImmediatelyChange'];\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,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.ClearAll = ClearAll;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
8
|
var _core = require("@semcore/core");
|
|
10
9
|
var _button = _interopRequireDefault(require("@semcore/button"));
|
|
11
10
|
var _m = _interopRequireDefault(require("@semcore/icon/Close/m"));
|
|
@@ -13,11 +12,13 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
13
12
|
function ClearAll(props) {
|
|
14
13
|
var _ref = arguments[0],
|
|
15
14
|
_ref2;
|
|
16
|
-
|
|
17
|
-
return !props.isHidden && (_ref2 = (0, _core.sstyled)(props.styles), /*#__PURE__*/_react
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
const SButton = _button.default;
|
|
16
|
+
return !props.isHidden && (_ref2 = (0, _core.sstyled)(props.styles), /*#__PURE__*/_react.default.createElement(SButton, _ref2.cn("SButton", {
|
|
17
|
+
...(0, _core.assignProps)({
|
|
18
|
+
"theme": 'muted',
|
|
19
|
+
"use": 'tertiary',
|
|
20
|
+
"addonLeft": _m.default
|
|
21
|
+
}, _ref)
|
|
22
|
+
}), props.getI18nText('BulkTextarea.ClearAllButton.buttonText')));
|
|
22
23
|
}
|
|
23
24
|
//# sourceMappingURL=ClearAll.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearAll.js","names":["_core","require","_button","_interopRequireDefault","_m","_react","ClearAll","props","_ref","arguments[0]","_ref2","SButton","Button","isHidden","sstyled","styles","
|
|
1
|
+
{"version":3,"file":"ClearAll.js","names":["_core","require","_button","_interopRequireDefault","_m","_react","ClearAll","props","_ref","arguments[0]","_ref2","SButton","Button","isHidden","sstyled","styles","default","createElement","cn","assignProps","CloseM","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":";;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,EAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEO,SAASK,QAAQA,CACtBC,KAA2F,EAC3F;EAAA,IAAAC,IAAA,GAAAC,YAAA;IAAAC,KAAA;EACA,MAAMC,OAAO,GAIQC,eAAM;EAH3B,OACE,CAACL,KAAK,CAACM,QAAQ,KAAAH,KAAA,GACf,IAAAI,aAAO,EAACP,KAAK,CAACQ,MAAM,CAAC,eACnBV,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACN,OAAO,EAAAD,KAAA,CAAAQ,EAAA;IAAA,OAAAlB,KAAA,CAAAmB,WAAA;MAAA,SAAuB,OAAO;MAAA,OAAK,UAAU;MAAA,aAAYC;IAAM,GAAAZ,IAAA;EAAA,IACpED,KAAK,CAACc,WAAW,CAAC,wCAAwC,CACpD,CAAC,CACX;AAEL","ignoreList":[]}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.Counter = Counter;
|
|
8
8
|
var _core = require("@semcore/core");
|
|
9
|
+
var _baseComponents = require("@semcore/base-components");
|
|
9
10
|
var _counter = _interopRequireDefault(require("@semcore/counter"));
|
|
10
|
-
var _flexBox = require("@semcore/flex-box");
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
function Counter(props) {
|
|
13
13
|
var _ref = arguments[0];
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const {
|
|
15
|
+
theme,
|
|
16
|
+
linesCount,
|
|
17
|
+
maxLines,
|
|
18
|
+
getI18nText
|
|
19
|
+
} = props;
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(_counter.default, (0, _core.assignProps)({
|
|
19
21
|
"ml": 1,
|
|
20
22
|
"theme": theme
|
|
21
|
-
}, _ref), linesCount, /*#__PURE__*/_react
|
|
23
|
+
}, _ref), linesCount, /*#__PURE__*/_react.default.createElement("span", {
|
|
22
24
|
"aria-hidden": "true"
|
|
23
|
-
}, "/", maxLines), /*#__PURE__*/_react
|
|
25
|
+
}, "/", maxLines), /*#__PURE__*/_react.default.createElement(_baseComponents.ScreenReaderOnly, null, getI18nText('BulkTextarea.Counter.ofAllowedRows:sr-message', {
|
|
24
26
|
rowsNumber: maxLines
|
|
25
|
-
})), theme === 'warning' && /*#__PURE__*/_react
|
|
27
|
+
})), theme === 'warning' && /*#__PURE__*/_react.default.createElement(_baseComponents.ScreenReaderOnly, null, getI18nText('BulkTextarea.Counter.limitReached:sr-message')), theme === 'danger' && /*#__PURE__*/_react.default.createElement(_baseComponents.ScreenReaderOnly, null, getI18nText('BulkTextarea.Counter.limitExceeded:sr-message')));
|
|
26
28
|
}
|
|
27
29
|
//# sourceMappingURL=Counter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Counter.js","names":["_core","require","
|
|
1
|
+
{"version":3,"file":"Counter.js","names":["_core","require","_baseComponents","_counter","_interopRequireDefault","_react","Counter","props","_ref","arguments[0]","theme","linesCount","maxLines","getI18nText","default","createElement","CounterKit","assignProps","ScreenReaderOnly","rowsNumber"],"sources":["../../../src/components/Counter.tsx"],"sourcesContent":["import { ScreenReaderOnly } from '@semcore/base-components';\nimport { Root } from '@semcore/core';\nimport type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';\nimport CounterKit, { type CounterProps as CounterPropsKit } from '@semcore/counter';\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":";;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AASO,SAASK,OAAOA,CAACC,KAAmB,EAAE;EAAA,IAAAC,IAAA,GAAAC,YAAA;EAC3C,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC,QAAQ;IAAEC;EAAY,CAAC,GAAGN,KAAK;EAE1D,oBACEF,MAAA,CAAAS,OAAA,CAAAC,aAAA,CAAcC,gBAAU,MAAAhB,KAAA,CAAAiB,WAAA;IAAA,MAAM,CAAC;IAAA,SAASP;EAAK,GAAAF,IAAA,GAC1CG,UAAU,eACXN,MAAA,CAAAS,OAAA,CAAAC,aAAA;IAAM,eAAY;EAAM,GAAC,GAEvB,EAACH,QACG,CAAC,eACPP,MAAA,CAAAS,OAAA,CAAAC,aAAA,CAACb,eAAA,CAAAgB,gBAAgB,QACdL,WAAW,CAAC,+CAA+C,EAAE;IAAEM,UAAU,EAAEP;EAAS,CAAC,CACtE,CAAC,EAClBF,KAAK,KAAK,SAAS,iBAClBL,MAAA,CAAAS,OAAA,CAAAC,aAAA,CAACb,eAAA,CAAAgB,gBAAgB,QACdL,WAAW,CAAC,8CAA8C,CAC3C,CACnB,EACAH,KAAK,KAAK,QAAQ,iBACjBL,MAAA,CAAAS,OAAA,CAAAC,aAAA,CAACb,eAAA,CAAAgB,gBAAgB,QACdL,WAAW,CAAC,+CAA+C,CAC5C,CAEhB,CAAC;AAEX","ignoreList":[]}
|
|
@@ -1,57 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.ErrorsNavigation = ErrorsNavigation;
|
|
8
|
+
var _baseComponents = require("@semcore/base-components");
|
|
8
9
|
var _button = _interopRequireDefault(require("@semcore/button"));
|
|
9
|
-
var _flexBox = require("@semcore/flex-box");
|
|
10
10
|
var _m = _interopRequireDefault(require("@semcore/icon/ChevronDown/m"));
|
|
11
11
|
var _m2 = _interopRequireDefault(require("@semcore/icon/ChevronUp/m"));
|
|
12
12
|
var _typography = require("@semcore/typography");
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
function ErrorsNavigation(props) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
const {
|
|
16
|
+
errorIndex,
|
|
17
|
+
errorsCount,
|
|
18
|
+
onPrevError,
|
|
19
|
+
onNextError,
|
|
20
|
+
size,
|
|
21
|
+
showErrors,
|
|
22
|
+
getI18nText,
|
|
23
|
+
disabled,
|
|
24
|
+
nextButtonRef,
|
|
25
|
+
prevButtonRef
|
|
26
|
+
} = props;
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_baseComponents.Flex, {
|
|
26
28
|
alignItems: "center"
|
|
27
|
-
}, errorsCount > 0 && showErrors && /*#__PURE__*/_react
|
|
29
|
+
}, errorsCount > 0 && showErrors && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
28
30
|
onClick: onNextError,
|
|
29
|
-
addonLeft: _m
|
|
31
|
+
addonLeft: _m.default,
|
|
30
32
|
use: "tertiary",
|
|
31
33
|
theme: "muted",
|
|
32
34
|
"aria-label": getI18nText('BulkTextarea.ErrorsNavigation.nextError:aria-label'),
|
|
33
35
|
hintPlacement: "bottom",
|
|
34
36
|
disabled: disabled,
|
|
35
37
|
ref: nextButtonRef
|
|
36
|
-
}), /*#__PURE__*/_react
|
|
38
|
+
}), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
37
39
|
onClick: onPrevError,
|
|
38
|
-
addonLeft: _m2
|
|
40
|
+
addonLeft: _m2.default,
|
|
39
41
|
use: "tertiary",
|
|
40
42
|
theme: "muted",
|
|
41
43
|
"aria-label": getI18nText('BulkTextarea.ErrorsNavigation.previousError:aria-label'),
|
|
42
44
|
hintPlacement: "bottom",
|
|
43
45
|
disabled: disabled,
|
|
44
46
|
ref: prevButtonRef
|
|
45
|
-
}), /*#__PURE__*/_react
|
|
47
|
+
}), /*#__PURE__*/_react.default.createElement(_typography.Text, {
|
|
46
48
|
size: size === 'l' ? 300 : 200,
|
|
47
49
|
color: "text-critical",
|
|
48
50
|
ml: 1,
|
|
49
51
|
disabled: disabled
|
|
50
52
|
}, errorIndex === -1 ? getI18nText('BulkTextarea.ErrorsNavigation.totalErrors', {
|
|
51
|
-
errorsCount
|
|
53
|
+
errorsCount
|
|
52
54
|
}) : getI18nText('BulkTextarea.ErrorsNavigation.selectedError', {
|
|
53
55
|
errorIndex: errorIndex + 1,
|
|
54
|
-
errorsCount
|
|
56
|
+
errorsCount
|
|
55
57
|
}))));
|
|
56
58
|
}
|
|
57
59
|
//# sourceMappingURL=ErrorsNavigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorsNavigation.js","names":["
|
|
1
|
+
{"version":3,"file":"ErrorsNavigation.js","names":["_baseComponents","require","_button","_interopRequireDefault","_m","_m2","_typography","_react","ErrorsNavigation","props","errorIndex","errorsCount","onPrevError","onNextError","size","showErrors","getI18nText","disabled","nextButtonRef","prevButtonRef","default","createElement","Flex","alignItems","Fragment","onClick","addonLeft","ChevronDownM","use","theme","hintPlacement","ref","ChevronUpM","Text","color","ml"],"sources":["../../../src/components/ErrorsNavigation.tsx"],"sourcesContent":["import { Flex } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';\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 errors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