@semcore/bulk-textarea 17.0.0-prerelease.27 → 17.0.0-prerelease.30
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 +5 -1
- package/lib/cjs/BulkTextarea.types.js.map +1 -1
- package/lib/cjs/components/InputField/InputField.types.js.map +1 -1
- package/lib/es6/BulkTextarea.types.js.map +1 -1
- package/lib/es6/components/InputField/InputField.types.js.map +1 -1
- package/lib/types/BulkTextarea.types.d.ts +86 -2
- package/lib/types/components/InputField/InputField.types.d.ts +9 -130
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
-
## [17.0.0] - 2026-
|
|
5
|
+
## [17.0.0] - 2026-03-09
|
|
6
6
|
|
|
7
7
|
### BREAK
|
|
8
8
|
|
|
9
9
|
- New major version.
|
|
10
10
|
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Fixed types for `Bulktextarea.InputField`.
|
|
14
|
+
|
|
11
15
|
## [16.6.2] - 2025-11-17
|
|
12
16
|
|
|
13
17
|
### Changed
|
|
@@ -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';\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?:
|
|
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\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputField.types.js","names":[],"sources":["../../../../src/components/InputField/InputField.types.ts"],"sourcesContent":["type 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\nexport type ErrorItem = {\n lineIndex: number;\n lineNode?: Node;\n errorMessage: string;\n};\n\nexport type InputFieldProps<T extends string | string[]>
|
|
1
|
+
{"version":3,"file":"InputField.types.js","names":[],"sources":["../../../../src/components/InputField/InputField.types.ts"],"sourcesContent":["import type { BulkTextareaInputFieldProps } from '../../BulkTextarea.types';\n\nexport type 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\nexport type ErrorItem = {\n lineIndex: number;\n lineNode?: Node;\n errorMessage: string;\n};\n\nexport type InputFieldProps<T extends string | string[]> =\n BulkTextareaInputFieldProps<T>\n & Required<\n Pick<\n BulkTextareaInputFieldProps<T>,\n 'value' | 'onBlur' | 'size' | 'state' | 'minRows' | 'maxRows' | 'validateOn' | 'maxLines' | 'pasteProps'\n >\n >\n & {\n prevError: ErrorItem;\n currentLineIndex: number;\n linesCount: number;\n onChangeLineIndex: (newIndex: number) => void;\n onChangeLinesCount: (rowsCount: number) => void;\n showErrors: boolean;\n /** List of errors in rows */\n errors: ErrorItem[];\n /** Select row with error */\n errorIndex: number;\n /** Flag for select all row */\n highlightErrorIndex: boolean;\n onErrorsChange: (errors: ErrorItem[]) => void;\n onShowErrorsChange: (showErrors: boolean) => void;\n onErrorIndexChange: (errorIndex: number) => void;\n /**\n * Return lines from textarea immediately they changed (uses mutation observer on textarea node under the hood)\n * Throttling may be required during processing this cb\n */\n onImmediatelyChange?: (lines: string[], value: string) => void;\n }\n & { 'aria-describedby'?: string };\n"],"mappings":"","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';\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?:
|
|
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\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputField.types.js","names":[],"sources":["../../../../src/components/InputField/InputField.types.ts"],"sourcesContent":["type 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\nexport type ErrorItem = {\n lineIndex: number;\n lineNode?: Node;\n errorMessage: string;\n};\n\nexport type InputFieldProps<T extends string | string[]>
|
|
1
|
+
{"version":3,"file":"InputField.types.js","names":[],"sources":["../../../../src/components/InputField/InputField.types.ts"],"sourcesContent":["import type { BulkTextareaInputFieldProps } from '../../BulkTextarea.types';\n\nexport type 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\nexport type ErrorItem = {\n lineIndex: number;\n lineNode?: Node;\n errorMessage: string;\n};\n\nexport type InputFieldProps<T extends string | string[]> =\n BulkTextareaInputFieldProps<T>\n & Required<\n Pick<\n BulkTextareaInputFieldProps<T>,\n 'value' | 'onBlur' | 'size' | 'state' | 'minRows' | 'maxRows' | 'validateOn' | 'maxLines' | 'pasteProps'\n >\n >\n & {\n prevError: ErrorItem;\n currentLineIndex: number;\n linesCount: number;\n onChangeLineIndex: (newIndex: number) => void;\n onChangeLinesCount: (rowsCount: number) => void;\n showErrors: boolean;\n /** List of errors in rows */\n errors: ErrorItem[];\n /** Select row with error */\n errorIndex: number;\n /** Flag for select all row */\n highlightErrorIndex: boolean;\n onErrorsChange: (errors: ErrorItem[]) => void;\n onShowErrorsChange: (showErrors: boolean) => void;\n onErrorIndexChange: (errorIndex: number) => void;\n /**\n * Return lines from textarea immediately they changed (uses mutation observer on textarea node under the hood)\n * Throttling may be required during processing this cb\n */\n onImmediatelyChange?: (lines: string[], value: string) => void;\n }\n & { 'aria-describedby'?: string };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import type { Intergalactic } from '@semcore/core';
|
|
|
4
4
|
import type { CounterProps } from './components/Counter';
|
|
5
5
|
import type { ErrorsNavigationProps } from './components/ErrorsNavigation';
|
|
6
6
|
import type { InputFieldProps } from './components/InputField/InputField';
|
|
7
|
+
import type { PasteProps } from './components/InputField/InputField.types';
|
|
7
8
|
export type BulkTextareaProps<T extends string | string[]> = {
|
|
8
9
|
/** The current value */
|
|
9
10
|
value?: InputFieldProps<T>['value'];
|
|
@@ -38,7 +39,7 @@ export type BulkTextareaProps<T extends string | string[]> = {
|
|
|
38
39
|
/** List of errors */
|
|
39
40
|
errors?: InputFieldProps<T>['errors'];
|
|
40
41
|
/** Defines whether to show errors or not */
|
|
41
|
-
showErrors?:
|
|
42
|
+
showErrors?: InputFieldProps<T>['showErrors'];
|
|
42
43
|
/** Internal */
|
|
43
44
|
onErrorsChange?: InputFieldProps<T>['onErrorsChange'];
|
|
44
45
|
/** Internal */
|
|
@@ -47,8 +48,91 @@ export type BulkTextareaProps<T extends string | string[]> = {
|
|
|
47
48
|
onImmediatelyChange?: InputFieldProps<T>['onImmediatelyChange'];
|
|
48
49
|
};
|
|
49
50
|
type BulkTextareaComponent = (<T extends string | string[]>(props: Intergalactic.InternalTypings.ComponentProps<'div', 'div', BoxProps & BulkTextareaProps<T>>) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', {}>;
|
|
51
|
+
export type BulkTextareaInputFieldProps<T extends string | string[] = string | string[]> = BoxProps & {
|
|
52
|
+
/**
|
|
53
|
+
* Unique id
|
|
54
|
+
*/
|
|
55
|
+
id?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Placeholder for field
|
|
58
|
+
*/
|
|
59
|
+
placeholder?: string;
|
|
60
|
+
/**
|
|
61
|
+
* String to render in textarea. OnChanging value, it will go throw paste pipeline
|
|
62
|
+
*/
|
|
63
|
+
value?: T;
|
|
64
|
+
/**
|
|
65
|
+
* This component doesn't have default onChange callback, because we think that you need only the result after every changes/fixes
|
|
66
|
+
*/
|
|
67
|
+
onBlur?: (value: T, e: Event) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Size of component
|
|
70
|
+
* @default m
|
|
71
|
+
*/
|
|
72
|
+
size?: 'm' | 'l';
|
|
73
|
+
/**
|
|
74
|
+
* State for show errors or valid(green) borders
|
|
75
|
+
* @default normal
|
|
76
|
+
*/
|
|
77
|
+
state?: 'normal' | 'valid' | 'invalid';
|
|
78
|
+
/**
|
|
79
|
+
* Flag for disabling field
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
disabled?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Flag for readonly field
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
readonly?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Min rows
|
|
90
|
+
* @default 2
|
|
91
|
+
*/
|
|
92
|
+
minRows?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Max rows
|
|
95
|
+
* @default 10
|
|
96
|
+
*/
|
|
97
|
+
maxRows?: number;
|
|
98
|
+
/**
|
|
99
|
+
* List of available points to validate value
|
|
100
|
+
* @default blur
|
|
101
|
+
*/
|
|
102
|
+
validateOn?: ('blur' | 'blurLine' | 'paste')[];
|
|
103
|
+
/**
|
|
104
|
+
* Function to validate line
|
|
105
|
+
*/
|
|
106
|
+
lineValidation?: (line: string, lines: string[]) => {
|
|
107
|
+
isValid: boolean;
|
|
108
|
+
errorMessage: string;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Message for display error about whole field, not only one line.
|
|
112
|
+
* If set empty string, field will not have invalid state.
|
|
113
|
+
*/
|
|
114
|
+
commonErrorMessage: string;
|
|
115
|
+
/**
|
|
116
|
+
* Delimiters (event.key) for lines
|
|
117
|
+
* @default Enter
|
|
118
|
+
*/
|
|
119
|
+
linesDelimiters?: string[];
|
|
120
|
+
/**
|
|
121
|
+
* Count of max lines in badge
|
|
122
|
+
* @default 100
|
|
123
|
+
*/
|
|
124
|
+
maxLines?: number;
|
|
125
|
+
/**
|
|
126
|
+
* Paste props
|
|
127
|
+
*/
|
|
128
|
+
pasteProps?: PasteProps;
|
|
129
|
+
/**
|
|
130
|
+
* Function for process line after it was blurred
|
|
131
|
+
*/
|
|
132
|
+
lineProcessing?: (line: string, lines: string[]) => string;
|
|
133
|
+
};
|
|
50
134
|
export type BulkTextareaType<T extends string | string[]> = BulkTextareaComponent & {
|
|
51
|
-
InputField: Intergalactic.Component<'div',
|
|
135
|
+
InputField: Intergalactic.Component<'div', BulkTextareaInputFieldProps<T>>;
|
|
52
136
|
Counter: Intergalactic.Component<'div', Partial<CounterProps>>;
|
|
53
137
|
ClearAll: typeof Button;
|
|
54
138
|
ErrorsNavigation: Intergalactic.Component<'div', Partial<ErrorsNavigationProps>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
type
|
|
1
|
+
import type { BulkTextareaInputFieldProps } from '../../BulkTextarea.types';
|
|
2
|
+
export type PasteProps = {
|
|
2
3
|
/**
|
|
3
4
|
* @default '\n'
|
|
4
5
|
*/
|
|
@@ -17,149 +18,27 @@ export type ErrorItem = {
|
|
|
17
18
|
lineNode?: Node;
|
|
18
19
|
errorMessage: string;
|
|
19
20
|
};
|
|
20
|
-
export type InputFieldProps<T extends string | string[]> = {
|
|
21
|
-
/**
|
|
22
|
-
* Unique id
|
|
23
|
-
*/
|
|
24
|
-
id?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Placeholder for field
|
|
27
|
-
*/
|
|
28
|
-
placeholder?: string;
|
|
29
|
-
/**
|
|
30
|
-
* String to render in textarea. OnChanging value, it will go throw paste pipeline
|
|
31
|
-
*/
|
|
32
|
-
value: T;
|
|
33
|
-
/**
|
|
34
|
-
* This component doesn't have default onChange callback, because we think that you need only the result after every changes/fixes
|
|
35
|
-
*/
|
|
36
|
-
onBlur: (value: T, e: Event) => void;
|
|
37
|
-
/**
|
|
38
|
-
* Size of component
|
|
39
|
-
* @default m
|
|
40
|
-
*/
|
|
41
|
-
size: 'm' | 'l';
|
|
42
|
-
/**
|
|
43
|
-
* State for show errors or valid(green) borders
|
|
44
|
-
* @default normal
|
|
45
|
-
*/
|
|
46
|
-
state: 'normal' | 'valid' | 'invalid';
|
|
47
|
-
/**
|
|
48
|
-
* Flag for disabling field
|
|
49
|
-
* @default false
|
|
50
|
-
*/
|
|
51
|
-
disabled?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Flag for readonly field
|
|
54
|
-
* @default false
|
|
55
|
-
*/
|
|
56
|
-
readonly?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Min rows
|
|
59
|
-
* @default 2
|
|
60
|
-
*/
|
|
61
|
-
minRows: number;
|
|
62
|
-
/**
|
|
63
|
-
* Max rows
|
|
64
|
-
* @default 10
|
|
65
|
-
*/
|
|
66
|
-
maxRows: number;
|
|
67
|
-
/**
|
|
68
|
-
* List of available points to validate value
|
|
69
|
-
* @default blur
|
|
70
|
-
*/
|
|
71
|
-
validateOn: ('blur' | 'blurLine' | 'paste')[];
|
|
72
|
-
/**
|
|
73
|
-
* Function to validate line
|
|
74
|
-
*/
|
|
75
|
-
lineValidation?: (line: string, lines: string[]) => {
|
|
76
|
-
isValid: boolean;
|
|
77
|
-
errorMessage: string;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Message for display error about whole field, not only one line.
|
|
81
|
-
* If set empty string, field will not have invalid state.
|
|
82
|
-
*/
|
|
83
|
-
commonErrorMessage: string;
|
|
84
|
-
/**
|
|
85
|
-
* Delimiters (event.key) for lines
|
|
86
|
-
* @default Enter
|
|
87
|
-
*/
|
|
88
|
-
linesDelimiters?: string[];
|
|
89
|
-
/**
|
|
90
|
-
* Count of max lines in badge
|
|
91
|
-
* @default 100
|
|
92
|
-
*/
|
|
93
|
-
maxLines: number;
|
|
94
|
-
/**
|
|
95
|
-
* Paste props
|
|
96
|
-
*/
|
|
97
|
-
pasteProps: PasteProps;
|
|
98
|
-
/**
|
|
99
|
-
* Function for process line after it was blurred
|
|
100
|
-
*/
|
|
101
|
-
lineProcessing?: (line: string, lines: string[]) => string;
|
|
102
|
-
/**
|
|
103
|
-
* Internal
|
|
104
|
-
*/
|
|
21
|
+
export type InputFieldProps<T extends string | string[]> = BulkTextareaInputFieldProps<T> & Required<Pick<BulkTextareaInputFieldProps<T>, 'value' | 'onBlur' | 'size' | 'state' | 'minRows' | 'maxRows' | 'validateOn' | 'maxLines' | 'pasteProps'>> & {
|
|
105
22
|
prevError: ErrorItem;
|
|
106
|
-
/**
|
|
107
|
-
* Internal
|
|
108
|
-
*/
|
|
109
23
|
currentLineIndex: number;
|
|
110
|
-
/**
|
|
111
|
-
* Internal
|
|
112
|
-
*/
|
|
113
24
|
linesCount: number;
|
|
114
|
-
/**
|
|
115
|
-
* Internal
|
|
116
|
-
*/
|
|
117
25
|
onChangeLineIndex: (newIndex: number) => void;
|
|
118
|
-
/**
|
|
119
|
-
* Internal
|
|
120
|
-
*/
|
|
121
26
|
onChangeLinesCount: (rowsCount: number) => void;
|
|
122
|
-
/**
|
|
123
|
-
* Internal
|
|
124
|
-
*/
|
|
125
27
|
showErrors: boolean;
|
|
126
|
-
/**
|
|
127
|
-
* Internal
|
|
128
|
-
* List of errors in rows
|
|
129
|
-
*/
|
|
28
|
+
/** List of errors in rows */
|
|
130
29
|
errors: ErrorItem[];
|
|
131
|
-
/**
|
|
132
|
-
* Internal
|
|
133
|
-
* Select row with error
|
|
134
|
-
*/
|
|
30
|
+
/** Select row with error */
|
|
135
31
|
errorIndex: number;
|
|
136
|
-
/**
|
|
137
|
-
* Internal
|
|
138
|
-
* Flag for select all row
|
|
139
|
-
*/
|
|
32
|
+
/** Flag for select all row */
|
|
140
33
|
highlightErrorIndex: boolean;
|
|
141
|
-
/**
|
|
142
|
-
* Internal
|
|
143
|
-
*/
|
|
144
34
|
onErrorsChange: (errors: ErrorItem[]) => void;
|
|
145
|
-
/**
|
|
146
|
-
* Internal
|
|
147
|
-
*/
|
|
148
35
|
onShowErrorsChange: (showErrors: boolean) => void;
|
|
149
|
-
/**
|
|
150
|
-
* Internal
|
|
151
|
-
*/
|
|
152
36
|
onErrorIndexChange: (errorIndex: number) => void;
|
|
153
37
|
/**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
*/
|
|
38
|
+
* Return lines from textarea immediately they changed (uses mutation observer on textarea node under the hood)
|
|
39
|
+
* Throttling may be required during processing this cb
|
|
40
|
+
*/
|
|
158
41
|
onImmediatelyChange?: (lines: string[], value: string) => void;
|
|
159
42
|
} & {
|
|
160
|
-
/**
|
|
161
|
-
* Internal
|
|
162
|
-
*/
|
|
163
43
|
'aria-describedby'?: string;
|
|
164
44
|
};
|
|
165
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/bulk-textarea",
|
|
3
3
|
"description": "Semrush BulkTextarea Component",
|
|
4
|
-
"version": "17.0.0-prerelease.
|
|
4
|
+
"version": "17.0.0-prerelease.30",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/button": "^17.0.0-prerelease.
|
|
18
|
-
"@semcore/typography": "^17.0.0-prerelease.
|
|
19
|
-
"@semcore/counter": "^17.0.0-prerelease.
|
|
20
|
-
"@semcore/tooltip": "^17.0.0-prerelease.
|
|
17
|
+
"@semcore/button": "^17.0.0-prerelease.30",
|
|
18
|
+
"@semcore/typography": "^17.0.0-prerelease.30",
|
|
19
|
+
"@semcore/counter": "^17.0.0-prerelease.30",
|
|
20
|
+
"@semcore/tooltip": "^17.0.0-prerelease.30",
|
|
21
21
|
"dompurify": "3.2.3"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/dompurify": "3.2.0",
|
|
34
|
-
"@semcore/core": "17.0.0-prerelease.
|
|
34
|
+
"@semcore/core": "17.0.0-prerelease.30",
|
|
35
|
+
"@semcore/base-components": "17.0.0-prerelease.30",
|
|
35
36
|
"@semcore/testing-utils": "1.0.0",
|
|
36
|
-
"@semcore/
|
|
37
|
-
"@semcore/icon": "16.7.2-prerelease.27"
|
|
37
|
+
"@semcore/icon": "16.7.2-prerelease.30"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "pnpm semcore-builder --source=ts && pnpm vite build"
|