@semcore/bulk-textarea 17.2.1 → 17.2.2-prerelease.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/lib/cjs/BulkTextarea.js +18 -12
  3. package/lib/cjs/BulkTextarea.js.map +1 -1
  4. package/lib/cjs/BulkTextarea.types.js.map +1 -1
  5. package/lib/cjs/components/ClearAll.js.map +1 -1
  6. package/lib/cjs/components/Counter.js.map +1 -1
  7. package/lib/cjs/components/ErrorsNavigation.js +5 -2
  8. package/lib/cjs/components/ErrorsNavigation.js.map +1 -1
  9. package/lib/cjs/components/InputField/History.js +46 -0
  10. package/lib/cjs/components/InputField/History.js.map +1 -0
  11. package/lib/cjs/components/InputField/InputField.js +494 -361
  12. package/lib/cjs/components/InputField/InputField.js.map +1 -1
  13. package/lib/cjs/components/InputField/inputField.shadow.css +42 -51
  14. package/lib/cjs/index.js.map +1 -1
  15. package/lib/es6/BulkTextarea.js +18 -12
  16. package/lib/es6/BulkTextarea.js.map +1 -1
  17. package/lib/es6/BulkTextarea.types.js.map +1 -1
  18. package/lib/es6/components/ClearAll.js.map +1 -1
  19. package/lib/es6/components/Counter.js.map +1 -1
  20. package/lib/es6/components/ErrorsNavigation.js +5 -2
  21. package/lib/es6/components/ErrorsNavigation.js.map +1 -1
  22. package/lib/es6/components/InputField/History.js +38 -0
  23. package/lib/es6/components/InputField/History.js.map +1 -0
  24. package/lib/es6/components/InputField/InputField.js +494 -361
  25. package/lib/es6/components/InputField/InputField.js.map +1 -1
  26. package/lib/es6/components/InputField/inputField.shadow.css +42 -51
  27. package/lib/es6/index.js.map +1 -1
  28. package/lib/esm/BulkTextarea.mjs +12 -5
  29. package/lib/esm/components/ErrorsNavigation.mjs +5 -2
  30. package/lib/esm/components/InputField/History.mjs +40 -0
  31. package/lib/esm/components/InputField/InputField.mjs +481 -358
  32. package/lib/esm/components/InputField/inputField.shadow.css +42 -51
  33. package/lib/types/BulkTextarea.d.ts +108 -2
  34. package/lib/types/BulkTextarea.types.d.ts +245 -147
  35. package/lib/types/components/ClearAll.d.ts +4 -6
  36. package/lib/types/components/Counter.d.ts +4 -9
  37. package/lib/types/components/ErrorsNavigation.d.ts +4 -14
  38. package/lib/types/components/InputField/History.d.ts +20 -0
  39. package/lib/types/components/InputField/InputField.d.ts +30 -24
  40. package/lib/types/index.d.ts +1 -2
  41. package/package.json +3 -3
  42. package/lib/cjs/components/InputField/InputField.types.js +0 -2
  43. package/lib/cjs/components/InputField/InputField.types.js.map +0 -1
  44. package/lib/es6/components/InputField/InputField.types.js +0 -2
  45. package/lib/es6/components/InputField/InputField.types.js.map +0 -1
  46. package/lib/types/components/InputField/InputField.types.d.ts +0 -44
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [17.2.2] - 2026-07-23
6
+
7
+ ### Fixed
8
+
9
+ - Non-working keyboard interactions.
10
+ - `ErrorsNavigation` buttons didn't change the size following parent.
11
+
12
+ ### Changed
13
+
14
+ - Refactor component's types. Deprecated atomic types. Atomic types are
15
+ part of `NSBulktextarea` namespace.
16
+
5
17
  ## [17.2.1] - 2026-06-26
6
18
 
7
19
  ### Fixed
@@ -40,6 +40,12 @@ class BulkTextareaRoot extends _core.Component {
40
40
  this.handlers.showErrors(false);
41
41
  this.handlers.errors([]);
42
42
  this.handlers.state('normal');
43
+ if (document.activeElement === this.clearAllButtonRef.current) {
44
+ const textarea = this.inputFieldRef.current?.querySelector('[contenteditable="true"]');
45
+ if (textarea instanceof HTMLOListElement) {
46
+ textarea.focus();
47
+ }
48
+ }
43
49
  }
44
50
  });
45
51
  (0, _defineProperty2.default)(this, "handleClickClearAll", e => {
@@ -48,13 +54,9 @@ class BulkTextareaRoot extends _core.Component {
48
54
  this.setState({
49
55
  errorIndex: -1
50
56
  });
51
- // @ts-ignore
52
- this.handlers.value('', e);
57
+ // @ts-ignore (we should set right type of value depending on the type of value passed)
58
+ this.handlers.value(typeof this.asProps.value === 'string' ? '' : [], e);
53
59
  this.handlers.state('normal');
54
- const textarea = this.inputFieldRef.current?.querySelector('[role="textbox"]');
55
- if (textarea instanceof HTMLDivElement) {
56
- textarea.focus();
57
- }
58
60
  });
59
61
  (0, _defineProperty2.default)(this, "handleChangeErrorIndex", amount => () => {
60
62
  const {
@@ -154,6 +156,11 @@ class BulkTextareaRoot extends _core.Component {
154
156
  }
155
157
  this.handlers.value?.(value, event);
156
158
  },
159
+ onPaste: () => {
160
+ if (validateOn?.includes('paste')) {
161
+ this.handlers.showErrors(true);
162
+ }
163
+ },
157
164
  showErrors,
158
165
  validateOn,
159
166
  lineValidation: lineValidation,
@@ -273,12 +280,6 @@ class BulkTextareaRoot extends _core.Component {
273
280
  }, _ref));
274
281
  }
275
282
  }
276
-
277
- /**
278
- * BulkTextarea
279
- *
280
- * {@link https://developer.semrush.com/intergalactic/components/bulk-textarea/bulk-textarea-api/|API} | {@link https://developer.semrush.com/intergalactic/components/bulk-textarea/bulk-textarea-code/|Examples}
281
- */
282
283
  (0, _defineProperty2.default)(BulkTextareaRoot, "displayName", 'BulkTextarea');
283
284
  (0, _defineProperty2.default)(BulkTextareaRoot, "defaultProps", {
284
285
  defaultValue: '',
@@ -293,6 +294,11 @@ class BulkTextareaRoot extends _core.Component {
293
294
  defaultShowErrors: false
294
295
  });
295
296
  (0, _defineProperty2.default)(BulkTextareaRoot, "enhance", [(0, _i18nEnhance.default)(_intergalacticDynamicLocales.localizedMessages), (0, _uniqueID.default)()]);
297
+ /**
298
+ * BulkTextarea
299
+ *
300
+ * {@link https://developer.semrush.com/intergalactic/components/bulk-textarea/bulk-textarea-api/|API} | {@link https://developer.semrush.com/intergalactic/components/bulk-textarea/bulk-textarea-code/|Examples}
301
+ */
296
302
  const BulkTextarea = (() => (0, _core.createComponent)(BulkTextareaRoot, {
297
303
  InputField: _InputField.InputField,
298
304
  Counter: _Counter.Counter,
@@ -1 +1 @@
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","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 type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';\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, BulkTextareaDefaultProps } 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 WithI18nEnhanceProps,\n State<T>,\n BulkTextareaDefaultProps<T>\n> {\n static displayName = 'BulkTextarea';\n static defaultProps: BulkTextareaDefaultProps<string | string[]> = {\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.handlers.value?.(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\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\n/**\n * BulkTextarea\n *\n * {@link https://developer.semrush.com/intergalactic/components/bulk-textarea/bulk-textarea-api/|API} | {@link https://developer.semrush.com/intergalactic/components/bulk-textarea/bulk-textarea-code/|Examples}\n */\nconst BulkTextarea = (<T extends string | string[]>() =>\n createComponent<BulkTextareaType<T>, typeof BulkTextareaRoot>(BulkTextareaRoot, {\n InputField,\n Counter,\n ClearAll,\n ErrorsNavigation,\n }))();\n\nexport default BulkTextarea;\n"],"mappings":";;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,MAAA,GAAAF,sBAAA,CAAAH,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;AAUA,MAAMW,gBAAgB,SAAsCC,eAAS,CAYnE;EAAAC,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,sCAiBgBC,cAAK,CAACC,SAAS,CAAiB,CAAC;IAAA,IAAAH,gBAAA,CAAAC,OAAA,0CAC7BC,cAAK,CAACC,SAAS,CAAoB,CAAC;IAAA,IAAAH,gBAAA,CAAAC,OAAA,sCACxCC,cAAK,CAACC,SAAS,CAAoB,CAAC;IAAA,IAAAH,gBAAA,CAAAC,OAAA,sCACpCC,cAAK,CAACC,SAAS,CAAoB,CAAC;IAAA,IAAAH,gBAAA,CAAAC,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AAE,CAAC,MAAM,CAAC;EACpBoD,MAAM,EAAE,IAAI;EACZC,aAAa,EAAE,EAAE;EACjBC,iBAAiB,EAAE;AACrB,CAAC;AAAA,IAAA5F,gBAAA,CAAAC,OAAA,EAzBGL,gBAAgB,aA2BH,CAAC,IAAAiG,oBAAW,EAACC,8CAAiB,CAAC,EAAE,IAAAC,iBAAe,EAAC,CAAC,CAAC;AAgPtE,MAAMC,YAAY,GAAG,CAAC,MACpB,IAAAC,qBAAe,EAA+CrG,gBAAgB,EAAE;EAC9EsG,UAAU,EAAVA,sBAAU;EACVC,OAAO,EAAPA,gBAAO;EACPC,QAAQ,EAARA,kBAAQ;EACRC,gBAAgB,EAAhBA;AACF,CAAC,CAAC,EAAE,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAtG,OAAA,GAEO+F,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","document","activeElement","clearAllButtonRef","current","textarea","inputFieldRef","querySelector","HTMLOListElement","focus","e","value","asProps","amount","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","nextButtonRef","onPaste","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 type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, Root, lastInteraction } from '@semcore/core';\nimport type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport uniqueIdEnhance from '@semcore/core/lib/utils/uniqueID';\nimport React from 'react';\n\nimport type { NSBulktextarea } from './BulkTextarea.types';\nimport { ClearAll } from './components/ClearAll';\nimport { Counter } from './components/Counter';\nimport { ErrorsNavigation } from './components/ErrorsNavigation';\nimport { InputField } from './components/InputField/InputField';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\n\nclass BulkTextareaRoot<T extends string | string[]> extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSBulktextarea.Component<T>>,\n typeof BulkTextareaRoot.enhance,\n NSBulktextarea.Handlers,\n WithI18nEnhanceProps,\n NSBulktextarea.State,\n NSBulktextarea.DefaultProps<T>\n> {\n static displayName = 'BulkTextarea';\n static defaultProps: NSBulktextarea.DefaultProps<string | string[]> = {\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<HTMLOListElement>();\n clearAllButtonRef = React.createRef<HTMLButtonElement>();\n nextButtonRef = React.createRef<HTMLButtonElement>();\n prevButtonRef = React.createRef<HTMLButtonElement>();\n counterRef = React.createRef<HTMLOListElement>();\n\n state: NSBulktextarea.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 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.handlers.value?.(value, event);\n },\n onPaste: () => {\n if (validateOn?.includes('paste')) {\n this.handlers.showErrors(true);\n }\n },\n showErrors,\n validateOn,\n lineValidation: lineValidation,\n errors,\n onErrorsChange: (newErrors: NSBulktextarea.ErrorItem[]) => {\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 if (document.activeElement === this.clearAllButtonRef.current) {\n const textarea = this.inputFieldRef.current?.querySelector('[contenteditable=\"true\"]');\n\n if (textarea instanceof HTMLOListElement) {\n textarea.focus();\n }\n }\n }\n };\n\n handleClickClearAll = (e: Event) => {\n this.handlers.showErrors(false);\n this.handlers.errors([]);\n this.setState({ errorIndex: -1 });\n // @ts-ignore (we should set right type of value depending on the type of value passed)\n this.handlers.value(typeof this.asProps.value === 'string' ? '' : [], e);\n this.handlers.state('normal');\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\nexport type BulkTextareaRootType = typeof BulkTextareaRoot;\n\n/**\n * BulkTextarea\n *\n * {@link https://developer.semrush.com/intergalactic/components/bulk-textarea/bulk-textarea-api/|API} | {@link https://developer.semrush.com/intergalactic/components/bulk-textarea/bulk-textarea-code/|Examples}\n */\nconst BulkTextarea = (<T extends string | string[]>() =>\n createComponent<NSBulktextarea.Component<T>, BulkTextareaRootType>(BulkTextareaRoot, {\n InputField,\n Counter,\n ClearAll,\n ErrorsNavigation,\n }))();\n\nexport default BulkTextarea;\n"],"mappings":";;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AAIA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,MAAA,GAAAF,sBAAA,CAA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,EAAVA,sBAAU;EACVC,OAAO,EAAPA,gBAAO;EACPC,QAAQ,EAARA,kBAAQ;EACRC,gBAAgB,EAAhBA;AACF,CAAC,CAAC,EAAE,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzG,OAAA,GAEOkG,YAAY","ignoreList":[]}
@@ -1 +1 @@
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';\nimport type { PasteProps } from './components/InputField/InputField.types';\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?: InputFieldProps<T>['showErrors'];\n /** Internal */\n onErrorsChange?: InputFieldProps<T>['onErrorsChange'];\n /** Internal */\n onShowErrorsChange?: InputFieldProps<T>['onShowErrorsChange'];\n /** Internal */\n onImmediatelyChange?: InputFieldProps<T>['onImmediatelyChange'];\n};\n\nexport type BulkTextareaDefaultProps<T extends string | string[]> = {\n defaultValue: T;\n size: 'm';\n defaultState: 'normal';\n minRows: 2;\n maxRows: 10;\n maxLines: 100;\n validateOn: BulkTextareaProps<T>['validateOn'];\n locale: 'en';\n defaultErrors: BulkTextareaProps<T>['errors'];\n defaultShowErrors: false;\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 BulkTextareaInputFieldProps<T extends string | string[] = string | string[]> = BoxProps & {\n /**\n * Unique id\n */\n id?: string;\n /**\n * Placeholder for field\n */\n placeholder?: string;\n /**\n * String to render in textarea. OnChanging value, it will go throw paste pipeline\n */\n value?: T;\n /**\n * This component doesn't have default onChange callback, because we think that you need only the result after every changes/fixes\n */\n onBlur?: (value: T, e: Event) => void;\n /**\n * Size of component\n * @default m\n */\n size?: 'm' | 'l';\n /**\n * State for show errors or valid(green) borders\n * @default normal\n */\n state?: 'normal' | 'valid' | 'invalid';\n /**\n * Flag for disabling field\n * @default false\n */\n disabled?: boolean;\n /**\n * Flag for readonly field\n * @default false\n */\n readonly?: boolean;\n /**\n * Min rows\n * @default 2\n */\n minRows?: number;\n /**\n * Max rows\n * @default 10\n */\n maxRows?: number;\n /**\n * List of available points to validate value\n * @default blur\n */\n validateOn?: ('blur' | 'blurLine' | 'paste')[];\n /**\n * Function to validate line\n */\n lineValidation?: (line: string, lines: string[]) => { isValid: boolean; errorMessage: string };\n /**\n * Message for display error about whole field, not only one line.\n * If set empty string, field will not have invalid state.\n */\n commonErrorMessage: string;\n /**\n * Delimiters (event.key) for lines\n * @default Enter\n */\n linesDelimiters?: string[];\n /**\n * Count of max lines in badge\n * @default 100\n */\n maxLines?: number;\n /**\n * Paste props\n */\n pasteProps?: PasteProps;\n /**\n * Function for process line after it was blurred\n */\n lineProcessing?: (line: string, lines: string[]) => string;\n};\n\nexport type BulkTextareaType<T extends string | string[]> = BulkTextareaComponent & {\n InputField: Intergalactic.Component<\n 'div',\n BulkTextareaInputFieldProps<T>\n >;\n Counter: Intergalactic.Component<'div', Partial<CounterProps>>;\n ClearAll: typeof Button;\n ErrorsNavigation: Intergalactic.Component<'div', Partial<ErrorsNavigationProps>>;\n};\n"],"mappings":"","ignoreList":[]}
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';\nimport type { NSCounter } from '@semcore/counter';\n\ndeclare namespace NSBulktextarea {\n type Props<T extends string | string[]> = {\n /** The current value */\n value?: NSBulktextarea.InputField.Props<T>['value'];\n /** Callback triggered when the onBlur event is emmited */\n onChange?: NSBulktextarea.InputField.Props<T>['onBlur'];\n /** Placeholder text */\n placeholder?: NSBulktextarea.InputField.Props<T>['placeholder'];\n /** Component size */\n size?: NSBulktextarea.InputField.Props<T>['size'];\n /** State for show errors or valid(green) borders */\n state?: NSBulktextarea.InputField.Props<T>['state'];\n /** Defines whether the textarea is disabled */\n disabled?: NSBulktextarea.InputField.Props<T>['disabled'];\n /** Defines whether the textarea is readonly */\n readonly?: NSBulktextarea.InputField.Props<T>['readonly'];\n /** Minimum number of rows to display */\n minRows?: NSBulktextarea.InputField.Props<T>['minRows'];\n /** Maximum number of rows to display */\n maxRows?: NSBulktextarea.InputField.Props<T>['maxRows'];\n /** An event when a validation occurs */\n validateOn?: NSBulktextarea.InputField.Props<T>['validateOn'];\n /** A function to valide the line */\n lineValidation?: NSBulktextarea.InputField.Props<T>['lineValidation'];\n /** Line delimeters */\n linesDelimiters?: NSBulktextarea.InputField.Props<T>['linesDelimiters'];\n /** Defines the props for paste action */\n pasteProps?: NSBulktextarea.InputField.Props<T>['pasteProps'];\n /** Maximum number of allowed lines/values */\n maxLines?: NSBulktextarea.InputField.Props<T>['maxLines'];\n /** Function to process individual lines during input */\n lineProcessing?: NSBulktextarea.InputField.Props<T>['lineProcessing'];\n /** List of errors */\n errors?: Array<NSBulktextarea.ErrorItem>;\n /** Defines whether to show errors or not */\n showErrors?: boolean;\n /** Internal */\n onErrorsChange?: (errors: NSBulktextarea.ErrorItem[]) => void;\n /** Internal */\n onShowErrorsChange?: (showErrors: boolean) => void;\n /** Internal */\n onImmediatelyChange?: (lines: string[], value: string) => void;\n };\n type DefaultProps<T extends string | string[]> = {\n defaultValue: T;\n size: 'm';\n defaultState: 'normal';\n minRows: 2;\n maxRows: 10;\n maxLines: 100;\n validateOn: NSBulktextarea.Props<T>['validateOn'];\n locale: 'en';\n defaultErrors: NSBulktextarea.Props<T>['errors'];\n defaultShowErrors: false;\n };\n type State = {\n linesCount: number;\n isEmptyText: boolean;\n errorIndex: number;\n highlightErrorIndex: boolean;\n prevError?: NSBulktextarea.ErrorItem;\n };\n type Handlers = {\n value: null;\n state: null;\n showErrors: null;\n errors: null;\n };\n type ErrorItem = {\n lineIndex: number;\n lineNode?: Node;\n errorMessage: string;\n };\n\n namespace InputField {\n type Props<T extends string | string[] = string | string[]> = BoxProps & {\n /**\n * Unique id\n */\n id?: string;\n /**\n * Placeholder for field. For multiline placeholder use an array of strings\n */\n placeholder?: string | string[];\n /**\n * String to render in textarea. OnChanging value, it will go throw paste pipeline\n */\n value?: T;\n /**\n * This component doesn't have default onChange callback, because we think that you need only the result after every changes/fixes\n */\n onBlur?: (value: T, e: Event) => void;\n\n /**\n * Callback to enable display errors after pasting for `on-paste` validation.\n * @internal\n */\n onPaste?: () => void;\n /**\n * Size of component\n * @default m\n */\n size?: 'm' | 'l';\n /**\n * State for show errors or valid(green) borders\n * @default normal\n */\n state?: 'normal' | 'valid' | 'invalid';\n /**\n * Flag for disabling field\n * @default false\n */\n disabled?: boolean;\n /**\n * Flag for readonly field\n * @default false\n */\n readonly?: boolean;\n /**\n * Min rows\n * @default 2\n */\n minRows?: number;\n /**\n * Max rows\n * @default 10\n */\n maxRows?: number;\n /**\n * List of available points to validate value\n * @default blur\n */\n validateOn?: ('blur' | 'blurLine' | 'paste')[];\n /**\n * Function to validate line\n */\n lineValidation?: (line: string, lines: string[]) => { isValid: boolean; errorMessage: string };\n /**\n * Message for display error about whole field, not only one line.\n * If set empty string, field will not have invalid state.\n */\n commonErrorMessage: string;\n /**\n * Delimiters (event.key) for lines\n * @default Enter\n */\n linesDelimiters?: string[];\n /**\n * Count of max lines in badge\n * @default 100\n */\n maxLines?: number;\n /**\n * Paste props\n */\n pasteProps?: {\n /**\n * @default '\\n'\n */\n delimiter?: string | RegExp;\n /**\n * @default row.trim();\n */\n lineProcessing?: (line: string, lineIndex: number, totalLinesCount: number) => string;\n /**\n * @default true\n */\n skipEmptyLines?: boolean;\n };\n /**\n * Function for process line after it was blurred\n */\n lineProcessing?: (line: string, lines: string[]) => string;\n };\n type DefaultProps = {\n defaultValue: '';\n size: 'm';\n state: 'normal';\n minRows: 2;\n maxRows: 10;\n defaultShowErrors: false;\n defaultErrorIndex: -1;\n defaultLinesCount: 0;\n };\n type Handlers = {\n value: null;\n linesCount: null;\n errorIndex: null;\n };\n type State = {\n keyboardLineIndex: number;\n mouseLineIndex: number;\n visibleErrorPopper: boolean;\n };\n interface Instance {\n focus(): void;\n focus(node: HTMLLIElement, offset: number | [number, number]): void;\n addLine(value: string): Promise<HTMLLIElement>;\n }\n\n type Component<T extends string | string[] = string | string[]> = Intergalactic.Component<'div', Props<T>, {}, [], Instance>;\n }\n\n namespace Counter {\n type Props = {\n theme?: NSCounter.Props['theme'];\n linesCount?: number;\n maxLines?: number;\n };\n\n type Component = Intergalactic.Component<'div', Props>;\n }\n\n namespace ClearAll {\n type Component = typeof Button;\n }\n\n namespace ErrorsNavigation {\n type Props = {\n errorIndex?: number;\n onPrevError?: () => void;\n onNextError?: () => void;\n errorsCount?: number;\n size?: 'm' | 'l';\n showErrors?: boolean;\n disabled?: boolean;\n nextButtonRef?: React.RefObject<HTMLButtonElement>;\n prevButtonRef?: React.RefObject<HTMLButtonElement>;\n };\n\n type Component = Intergalactic.Component<'div', Props>;\n }\n\n type RootComponent = (<T extends string | string[]>(\n props: Intergalactic.InternalTypings.ComponentProps<'div', 'div', BoxProps & NSBulktextarea.Props<T>>,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', {}>;\n\n type Component<T extends string | string[]> = RootComponent & {\n InputField: InputField.Component<T>;\n Counter: Counter.Component;\n ClearAll: ClearAll.Component;\n ErrorsNavigation: ErrorsNavigation.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type BulkTextareaProps<T extends string | string[]> = NSBulktextarea.Props<T>;\n/** @deprecated It will be removed in v18. */\nexport type BulkTextareaDefaultProps<T extends string | string[]> = NSBulktextarea.DefaultProps<T>;\n/** @deprecated It will be removed in v18. */\nexport type BulkTextareaInputFieldProps<T extends string | string[] = string | string[]> =\n NSBulktextarea.InputField.Props<T>;\n/** @deprecated It will be removed in v18. */\nexport type BulkTextareaType<T extends string | string[]> = NSBulktextarea.Component<T>;\n/** @deprecated It will be removed in v18. */\nexport type ErrorItem = NSBulktextarea.ErrorItem;\n\nexport type { NSBulktextarea };\n"],"mappings":"","ignoreList":[]}
@@ -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","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
+ {"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 { Intergalactic } from '@semcore/core';\nimport { Root, sstyled } from '@semcore/core';\nimport CloseM from '@semcore/icon/Close/m';\nimport React from 'react';\n\nimport type { BulkTextareaRootType } from '../BulkTextarea';\nimport type { NSBulktextarea } from '../BulkTextarea.types';\n\nexport function ClearAll(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSBulktextarea.ClearAll.Component,\n BulkTextareaRootType,\n 'ClearAll'\n >,\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":";;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,EAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AAKO,SAASK,QAAQA,CACtBC,KAIC,EACD;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 +1 @@
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 NSCounter } from '@semcore/counter';\nimport React from 'react';\n\nexport type CounterProps = {\n theme: NSCounter.Props['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
+ {"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 type { Intergalactic } from '@semcore/core';\nimport { Root } from '@semcore/core';\nimport CounterKit from '@semcore/counter';\nimport React from 'react';\n\nimport type { BulkTextareaRootType } from '../BulkTextarea';\nimport type { NSBulktextarea } from '../BulkTextarea.types';\n\nexport function Counter(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSBulktextarea.Counter.Component,\n BulkTextareaRootType,\n 'Counter'\n >,\n) {\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":";;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AAKO,SAASK,OAAOA,CACrBC,KAIC,EACD;EAAA,IAAAC,IAAA,GAAAC,YAAA;EACA,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":[]}
@@ -34,7 +34,8 @@ function ErrorsNavigation(props) {
34
34
  "aria-label": getI18nText('BulkTextarea.ErrorsNavigation.nextError:aria-label'),
35
35
  hintPlacement: "bottom",
36
36
  disabled: disabled,
37
- ref: nextButtonRef
37
+ ref: nextButtonRef,
38
+ size: size
38
39
  }), /*#__PURE__*/_react.default.createElement(_button.default, {
39
40
  onClick: onPrevError,
40
41
  addonLeft: _m2.default,
@@ -43,7 +44,9 @@ function ErrorsNavigation(props) {
43
44
  "aria-label": getI18nText('BulkTextarea.ErrorsNavigation.previousError:aria-label'),
44
45
  hintPlacement: "bottom",
45
46
  disabled: disabled,
46
- ref: prevButtonRef
47
+ ref: prevButtonRef,
48
+ size: size,
49
+ ml: 1
47
50
  }), /*#__PURE__*/_react.default.createElement(_typography.Text, {
48
51
  size: size === 'l' ? 300 : 200,
49
52
  color: "text-critical",
@@ -1 +1 @@
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 errorsCount,\n })}\n </Text>\n </>\n )}\n </Flex>\n );\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,EAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,GAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAeO,SAASO,gBAAgBA,CAACC,KAA4B,EAAE;EAC7D,MAAM;IACJC,UAAU;IACVC,WAAW;IACXC,WAAW;IACXC,WAAW;IACXC,IAAI;IACJC,UAAU;IACVC,WAAW;IACXC,QAAQ;IACRC,aAAa;IACbC;EACF,CAAC,GAAGV,KAAK;EACT,oBACEF,MAAA,CAAAa,OAAA,CAAAC,aAAA,CAACrB,eAAA,CAAAsB,IAAI;IAACC,UAAU,EAAC;EAAQ,GACtBZ,WAAW,GAAG,CAAC,IAAII,UAAU,iBAC5BR,MAAA,CAAAa,OAAA,CAAAC,aAAA,CAAAd,MAAA,CAAAa,OAAA,CAAAI,QAAA,qBACEjB,MAAA,CAAAa,OAAA,CAAAC,aAAA,CAACnB,OAAA,CAAAkB,OAAM;IACLK,OAAO,EAAEZ,WAAY;IACrBa,SAAS,EAAEC,UAAa;IACxBC,GAAG,EAAC,UAAU;IACdC,KAAK,EAAC,OAAO;IACb,cAAYb,WAAW,CAAC,oDAAoD,CAAE;IAC9Ec,aAAa,EAAC,QAAQ;IACtBb,QAAQ,EAAEA,QAAS;IACnBc,GAAG,EAAEb;EAAc,CACpB,CAAC,eACFX,MAAA,CAAAa,OAAA,CAAAC,aAAA,CAACnB,OAAA,CAAAkB,OAAM;IACLK,OAAO,EAAEb,WAAY;IACrBc,SAAS,EAAEM,WAAW;IACtBJ,GAAG,EAAC,UAAU;IACdC,KAAK,EAAC,OAAO;IACb,cAAYb,WAAW,CAAC,wDAAwD,CAAE;IAClFc,aAAa,EAAC,QAAQ;IACtBb,QAAQ,EAAEA,QAAS;IACnBc,GAAG,EAAEZ;EAAc,CACpB,CAAC,eACFZ,MAAA,CAAAa,OAAA,CAAAC,aAAA,CAACf,WAAA,CAAA2B,IAAI;IAACnB,IAAI,EAAEA,IAAI,KAAK,GAAG,GAAG,GAAG,GAAG,GAAI;IAACoB,KAAK,EAAC,eAAe;IAACC,EAAE,EAAE,CAAE;IAAClB,QAAQ,EAAEA;EAAS,GACnFP,UAAU,KAAK,CAAC,CAAC,GACdM,WAAW,CAAC,2CAA2C,EAAE;IAAEL;EAAY,CAAC,CAAC,GACzEK,WAAW,CAAC,6CAA6C,EAAE;IACzDN,UAAU,EAAEA,UAAU,GAAG,CAAC;IAC1BC;EACF,CAAC,CACD,CACN,CAEA,CAAC;AAEX","ignoreList":[]}
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","ml","Text","color"],"sources":["../../../src/components/ErrorsNavigation.tsx"],"sourcesContent":["import { Flex } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport type { Intergalactic } from '@semcore/core';\nimport ChevronDownM from '@semcore/icon/ChevronDown/m';\nimport ChevronUpM from '@semcore/icon/ChevronUp/m';\nimport { Text } from '@semcore/typography';\nimport React from 'react';\n\nimport type { BulkTextareaRootType } from '../BulkTextarea';\nimport type { NSBulktextarea } from '../BulkTextarea.types';\n\nexport function ErrorsNavigation(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSBulktextarea.ErrorsNavigation.Component,\n BulkTextareaRootType,\n 'ErrorsNavigation'\n >,\n) {\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 size={size}\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 size={size}\n ml={1}\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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AAW,CAAC,wDAAwD,CAAE;IAClFc,aAAa,EAAC,QAAQ;IACtBb,QAAQ,EAAEA,QAAS;IACnBc,GAAG,EAAEZ,aAAc;IACnBL,IAAI,EAAEA,IAAK;IACXmB,EAAE,EAAE;EAAE,CACP,CAAC,eACF1B,MAAA,CAAAa,OAAA,CAAAC,aAAA,CAACf,WAAA,CAAA4B,IAAI;IAACpB,IAAI,EAAEA,IAAI,KAAK,GAAG,GAAG,GAAG,GAAG,GAAI;IAACqB,KAAK,EAAC,eAAe;IAACF,EAAE,EAAE,CAAE;IAAChB,QAAQ,EAAEA;EAAS,GACnFP,UAAU,KAAK,CAAC,CAAC,GACdM,WAAW,CAAC,2CAA2C,EAAE;IAAEL;EAAY,CAAC,CAAC,GACzEK,WAAW,CAAC,6CAA6C,EAAE;IACzDN,UAAU,EAAEA,UAAU,GAAG,CAAC;IAC1BC;EACF,CAAC,CACD,CACN,CAEA,CAAC;AAEX","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.History = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ const DEFAULT_MAX_LENGTH = 100;
10
+ class History {
11
+ constructor(maxLength = DEFAULT_MAX_LENGTH) {
12
+ (0, _defineProperty2.default)(this, "undoStack", []);
13
+ (0, _defineProperty2.default)(this, "redoStack", []);
14
+ (0, _defineProperty2.default)(this, "maxLength", void 0);
15
+ this.maxLength = maxLength;
16
+ }
17
+ push(state) {
18
+ this.undoStack.push(state);
19
+ this.trimUndoStack();
20
+ this.redoStack = [];
21
+ }
22
+ undo(currentState) {
23
+ const previousState = this.undoStack.pop();
24
+ if (!previousState) {
25
+ return null;
26
+ }
27
+ this.redoStack.push(currentState);
28
+ return previousState;
29
+ }
30
+ redo(currentState) {
31
+ const nextState = this.redoStack.pop();
32
+ if (!nextState) {
33
+ return null;
34
+ }
35
+ this.undoStack.push(currentState);
36
+ this.trimUndoStack();
37
+ return nextState;
38
+ }
39
+ trimUndoStack() {
40
+ if (this.undoStack.length > this.maxLength) {
41
+ this.undoStack.shift();
42
+ }
43
+ }
44
+ }
45
+ exports.History = History;
46
+ //# sourceMappingURL=History.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"History.js","names":["DEFAULT_MAX_LENGTH","History","constructor","maxLength","_defineProperty2","default","push","state","undoStack","trimUndoStack","redoStack","undo","currentState","previousState","pop","redo","nextState","length","shift","exports"],"sources":["../../../../src/components/InputField/History.ts"],"sourcesContent":["export type HistorySelection = {\n startLine: number;\n startOffset: number;\n endLine: number;\n endOffset: number;\n};\n\nexport type HistoryState = {\n lines: string[];\n selection: HistorySelection;\n};\n\nconst DEFAULT_MAX_LENGTH = 100;\n\nexport class History {\n private undoStack: HistoryState[] = [];\n private redoStack: HistoryState[] = [];\n private readonly maxLength: number;\n\n constructor(maxLength = DEFAULT_MAX_LENGTH) {\n this.maxLength = maxLength;\n }\n\n public push(state: HistoryState): void {\n this.undoStack.push(state);\n this.trimUndoStack();\n\n this.redoStack = [];\n }\n\n public undo(currentState: HistoryState): HistoryState | null {\n const previousState = this.undoStack.pop();\n\n if (!previousState) {\n return null;\n }\n\n this.redoStack.push(currentState);\n\n return previousState;\n }\n\n public redo(currentState: HistoryState): HistoryState | null {\n const nextState = this.redoStack.pop();\n\n if (!nextState) {\n return null;\n }\n\n this.undoStack.push(currentState);\n this.trimUndoStack();\n\n return nextState;\n }\n\n private trimUndoStack(): void {\n if (this.undoStack.length > this.maxLength) {\n this.undoStack.shift();\n }\n }\n}\n"],"mappings":";;;;;;;;AAYA,MAAMA,kBAAkB,GAAG,GAAG;AAEvB,MAAMC,OAAO,CAAC;EAKnBC,WAAWA,CAACC,SAAS,GAAGH,kBAAkB,EAAE;IAAA,IAAAI,gBAAA,CAAAC,OAAA,qBAJR,EAAE;IAAA,I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