@semcore/bulk-textarea 1.5.0-prerelease.0 → 1.5.0-prerelease.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/BulkTextarea.js +38 -35
- package/lib/cjs/BulkTextarea.js.map +1 -1
- package/lib/cjs/BulkTextarea.types.js.map +1 -1
- package/lib/cjs/components/ClearAll.js +2 -2
- package/lib/cjs/components/ClearAll.js.map +1 -1
- package/lib/cjs/components/Counter.js +5 -5
- package/lib/cjs/components/Counter.js.map +1 -1
- package/lib/cjs/components/ErrorsNavigation.js +14 -14
- package/lib/cjs/components/ErrorsNavigation.js.map +1 -1
- package/lib/cjs/components/InputField/InputField.js +167 -219
- package/lib/cjs/components/InputField/InputField.js.map +1 -1
- package/lib/cjs/components/InputField/InputField.types.js.map +1 -1
- package/lib/cjs/components/InputField/inputField.shadow.css +18 -56
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +5 -4
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/BulkTextarea.js +32 -31
- package/lib/es6/BulkTextarea.js.map +1 -1
- package/lib/es6/BulkTextarea.types.js.map +1 -1
- package/lib/es6/components/ClearAll.js +2 -2
- package/lib/es6/components/ClearAll.js.map +1 -1
- package/lib/es6/components/Counter.js +2 -2
- package/lib/es6/components/Counter.js.map +1 -1
- package/lib/es6/components/ErrorsNavigation.js +10 -10
- package/lib/es6/components/ErrorsNavigation.js.map +1 -1
- package/lib/es6/components/InputField/InputField.js +165 -219
- package/lib/es6/components/InputField/InputField.js.map +1 -1
- package/lib/es6/components/InputField/InputField.types.js.map +1 -1
- package/lib/es6/components/InputField/inputField.shadow.css +18 -56
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/BulkTextarea.mjs +35 -33
- package/lib/esm/components/ClearAll.mjs +1 -1
- package/lib/esm/components/Counter.mjs +2 -2
- package/lib/esm/components/ErrorsNavigation.mjs +4 -4
- package/lib/esm/components/InputField/InputField.mjs +136 -181
- package/lib/esm/components/InputField/inputField.shadow.css +18 -56
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/BulkTextarea.d.ts +1 -1
- package/lib/types/BulkTextarea.types.d.ts +8 -113
- package/lib/types/components/ClearAll.d.ts +2 -2
- package/lib/types/components/Counter.d.ts +4 -4
- package/lib/types/components/ErrorsNavigation.d.ts +2 -2
- package/lib/types/components/InputField/InputField.d.ts +7 -12
- package/lib/types/components/InputField/InputField.types.d.ts +125 -11
- package/package.json +10 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
SInputField>div {
|
|
1
|
+
SInputField > div {
|
|
2
2
|
box-sizing: content-box;
|
|
3
3
|
outline: none;
|
|
4
4
|
border-radius: var(--intergalactic-control-rounded, 6px);
|
|
@@ -37,7 +37,7 @@ SInputField>div {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
>p {
|
|
40
|
+
> p {
|
|
41
41
|
counter-increment: row;
|
|
42
42
|
/*display: inline-block;*/
|
|
43
43
|
margin: 0 0 var(--intergalactic-spacing-1x, 4px) 0;
|
|
@@ -68,60 +68,38 @@ SInputField>div {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
&:has(p:nth-child(n + 10)) {
|
|
71
|
-
>p {
|
|
71
|
+
> p {
|
|
72
72
|
padding-left: var(--intergalactic-spacing-6x, 24px);
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
>p:nth-child(-n + 9)::before {
|
|
74
|
+
> p:nth-child(-n + 9)::before {
|
|
76
75
|
padding-left: var(--intergalactic-spacing-2x, 8px);
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
&:has(p:nth-child(n + 100)) {
|
|
81
|
-
>p {
|
|
82
|
-
padding-left: var(--intergalactic-spacing-8x, 32px);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
>p:nth-child(-n + 9)::before {
|
|
86
|
-
padding-left: var(--intergalactic-spacing-4x, 16px);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
>p:nth-child(n + 10)::before {
|
|
90
|
-
padding-left: var(--intergalactic-spacing-2x, 8px);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
>p:nth-child(n + 100)::before {
|
|
94
|
-
padding-left: 0;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
&:has(p:nth-child(n + 1000)) {
|
|
99
80
|
> p {
|
|
100
|
-
padding-left:
|
|
81
|
+
padding-left: var(--intergalactic-spacing-8x, 32px);
|
|
101
82
|
}
|
|
102
83
|
> p:nth-child(-n + 9)::before {
|
|
103
|
-
padding-left: var(--intergalactic-spacing-6x, 24px);
|
|
104
|
-
}
|
|
105
|
-
> p:nth-child(n + 10)::before {
|
|
106
84
|
padding-left: var(--intergalactic-spacing-4x, 16px);
|
|
107
85
|
}
|
|
108
|
-
> p:nth-child(n +
|
|
86
|
+
> p:nth-child(n + 10)::before {
|
|
109
87
|
padding-left: var(--intergalactic-spacing-2x, 8px);
|
|
110
88
|
}
|
|
111
|
-
> p:nth-child(n +
|
|
89
|
+
> p:nth-child(n + 100)::before {
|
|
112
90
|
padding-left: 0;
|
|
113
91
|
}
|
|
114
92
|
}
|
|
115
93
|
}
|
|
116
94
|
|
|
117
|
-
SInputField[showErrors]>div[aria-invalid]>p[aria-invalid]:after {
|
|
95
|
+
SInputField[showErrors] > div[aria-invalid] > p[aria-invalid]:after {
|
|
118
96
|
content: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBmaWxsPSIjZDEwMDJmIj48cGF0aCBkPSJNNyA2aDJ2NEg3VjZabTIgN3YtMkg3djJoMloiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTYuMTUyIDEuMTcyYy43MTktMS41NjMgMi45NzctMS41NjMgMy42OTYgMGw2LjA0MyAxMy4xNDFjLjM2My43OTEtLjIyNSAxLjY4Ny0xLjEwOSAxLjY4N0gxLjIxOGMtLjg4NCAwLTEuNDcyLS44OTYtMS4xMDktMS42ODdMNi4xNTIgMS4xNzJabTcuMzc0IDEyLjgzN0w4IDEuOTkgMi40NzQgMTQuMDFoMTEuMDUyWiIvPjwvc3ZnPgo= ");
|
|
119
97
|
position: absolute;
|
|
120
98
|
right: 0;
|
|
121
99
|
top: var(--intergalactic-spacing-05x, 2px);
|
|
122
100
|
}
|
|
123
101
|
|
|
124
|
-
SInputField[size='m']>div {
|
|
102
|
+
SInputField[size='m'] > div {
|
|
125
103
|
padding: var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-4x, 16px);
|
|
126
104
|
font-size: var(--intergalactic-fs-200, 14px);
|
|
127
105
|
line-height: var(--intergalactic-lh-200, 142%);
|
|
@@ -132,14 +110,13 @@ SInputField[size='m']>div {
|
|
|
132
110
|
|
|
133
111
|
&:empty {
|
|
134
112
|
padding-left: var(--intergalactic-spacing-8x, 32px);
|
|
135
|
-
|
|
136
113
|
&::before {
|
|
137
114
|
left: var(--intergalactic-spacing-4x, 16px);
|
|
138
115
|
}
|
|
139
116
|
}
|
|
140
117
|
}
|
|
141
118
|
|
|
142
|
-
SInputField[size='l']>div {
|
|
119
|
+
SInputField[size='l'] > div {
|
|
143
120
|
padding: var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-4x, 16px);
|
|
144
121
|
font-size: var(--intergalactic-fs-300, 16px);
|
|
145
122
|
line-height: var(--intergalactic-lh-300, 150%);
|
|
@@ -149,7 +126,6 @@ SInputField[size='l']>div {
|
|
|
149
126
|
|
|
150
127
|
&:empty {
|
|
151
128
|
padding-left: calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-05x, 2px));
|
|
152
|
-
|
|
153
129
|
&::before {
|
|
154
130
|
left: var(--intergalactic-spacing-4x, 16px);
|
|
155
131
|
}
|
|
@@ -157,39 +133,26 @@ SInputField[size='l']>div {
|
|
|
157
133
|
}
|
|
158
134
|
|
|
159
135
|
|
|
160
|
-
SInputField[state='normal']:not([disabled])>div {
|
|
136
|
+
SInputField[state='normal']:not([disabled]) > div:focus {
|
|
161
137
|
&:focus {
|
|
138
|
+
box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px oklch(0.376 0.247 264.2 / 0.441));
|
|
162
139
|
border-color: var(--intergalactic-border-info-active, oklch(0.382 0.248 264.2 / 0.386));
|
|
163
|
-
@mixin focus-outline-mixin {
|
|
164
|
-
outline-offset: 0;
|
|
165
|
-
transition-property: outline-color, outline-width;
|
|
166
|
-
}
|
|
167
140
|
}
|
|
168
141
|
}
|
|
169
142
|
|
|
170
|
-
SInputField[state='valid']>div {
|
|
143
|
+
SInputField[state='valid'] > div {
|
|
171
144
|
border-color: var(--intergalactic-border-success-active, oklch(0.75 0.153 167.5));
|
|
172
145
|
|
|
173
146
|
&:focus {
|
|
174
|
-
|
|
175
|
-
@mixin focus-outline-mixin {
|
|
176
|
-
outline-offset: 0;
|
|
177
|
-
transition-property: outline-color, outline-width;
|
|
178
|
-
}
|
|
179
|
-
outline-color: var(--intergalactic-keyboard-focus-valid-outline, oklch(0.711 0.146 166.9));
|
|
147
|
+
box-shadow: var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px oklch(0.711 0.146 166.9));
|
|
180
148
|
}
|
|
181
149
|
}
|
|
182
150
|
|
|
183
|
-
SInputField[state='invalid']>div {
|
|
151
|
+
SInputField[state='invalid'] > div {
|
|
184
152
|
border-color: var(--intergalactic-border-critical-active, oklch(0.628 0.258 29 / 0.56));
|
|
185
153
|
|
|
186
154
|
&:focus {
|
|
187
|
-
|
|
188
|
-
@mixin focus-outline-mixin {
|
|
189
|
-
outline-offset: 0;
|
|
190
|
-
transition-property: outline-color, outline-width;
|
|
191
|
-
}
|
|
192
|
-
outline-color: var(--intergalactic-keyboard-focus-invalid-outline, oklch(0.628 0.257 28.9 / 0.652));
|
|
155
|
+
box-shadow: var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px oklch(0.628 0.257 28.9 / 0.652));
|
|
193
156
|
}
|
|
194
157
|
|
|
195
158
|
background-image: var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, oklch(0.628 0.258 29 / 0.56) 0, oklch(0.628 0.258 29 / 0.56) 1px, transparent 0, transparent 50%));
|
|
@@ -200,10 +163,9 @@ SInputField[state='invalid']>div {
|
|
|
200
163
|
background-repeat: repeat-y;
|
|
201
164
|
}
|
|
202
165
|
|
|
203
|
-
SInputField[readonly]>div {
|
|
166
|
+
SInputField[readonly] > div {
|
|
204
167
|
background-color: var(--intergalactic-bg-secondary-neutral, oklch(0.98 0.001 180));
|
|
205
168
|
}
|
|
206
|
-
|
|
207
|
-
SInputField[disabled]>div {
|
|
169
|
+
SInputField[disabled] > div {
|
|
208
170
|
opacity: var(--intergalactic-disabled-opacity, 0.4);
|
|
209
171
|
}
|
|
@@ -6,12 +6,12 @@ import it from "./it.json.mjs";
|
|
|
6
6
|
import ja from "./ja.json.mjs";
|
|
7
7
|
import ko from "./ko.json.mjs";
|
|
8
8
|
import nl from "./nl.json.mjs";
|
|
9
|
-
import pl from "./pl.json.mjs";
|
|
10
9
|
import pt from "./pt.json.mjs";
|
|
11
|
-
import sv from "./sv.json.mjs";
|
|
12
10
|
import tr from "./tr.json.mjs";
|
|
13
11
|
import vi from "./vi.json.mjs";
|
|
14
12
|
import zh from "./zh.json.mjs";
|
|
13
|
+
import pl from "./pl.json.mjs";
|
|
14
|
+
import sv from "./sv.json.mjs";
|
|
15
15
|
var localizedMessages = {
|
|
16
16
|
de,
|
|
17
17
|
en,
|
|
@@ -1,138 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import type { PasteProps } from './components/InputField/InputField.types';
|
|
1
|
+
import { Intergalactic } from '@semcore/utils/lib/core';
|
|
2
|
+
import { BoxProps } from '@semcore/flex-box';
|
|
3
|
+
import Button from '@semcore/button';
|
|
4
|
+
import { InputFieldProps } from './components/InputField/InputField';
|
|
5
|
+
import { CounterProps } from './components/Counter';
|
|
6
|
+
import { ErrorsNavigationProps } from './components/ErrorsNavigation';
|
|
8
7
|
export type BulkTextareaProps<T extends string | string[]> = {
|
|
9
|
-
/** The current value */
|
|
10
8
|
value?: InputFieldProps<T>['value'];
|
|
11
|
-
/** Callback triggered when the onBlur event is emmited */
|
|
12
9
|
onChange?: InputFieldProps<T>['onBlur'];
|
|
13
|
-
/** Placeholder text */
|
|
14
10
|
placeholder?: InputFieldProps<T>['placeholder'];
|
|
15
|
-
/** Component size */
|
|
16
11
|
size?: InputFieldProps<T>['size'];
|
|
17
|
-
/** State for show errors or valid(green) borders */
|
|
18
12
|
state?: InputFieldProps<T>['state'];
|
|
19
|
-
/** Defines whether the textarea is disabled */
|
|
20
13
|
disabled?: InputFieldProps<T>['disabled'];
|
|
21
|
-
/** Defines whether the textarea is readonly */
|
|
22
14
|
readonly?: InputFieldProps<T>['readonly'];
|
|
23
|
-
/** Minimum number of rows to display */
|
|
24
15
|
minRows?: InputFieldProps<T>['minRows'];
|
|
25
|
-
/** Maximum number of rows to display */
|
|
26
16
|
maxRows?: InputFieldProps<T>['maxRows'];
|
|
27
|
-
/** An event when a validation occurs */
|
|
28
17
|
validateOn?: InputFieldProps<T>['validateOn'];
|
|
29
|
-
/** A function to valide the line */
|
|
30
18
|
lineValidation?: InputFieldProps<T>['lineValidation'];
|
|
31
|
-
/** Line delimeters */
|
|
32
19
|
linesDelimiters?: InputFieldProps<T>['linesDelimiters'];
|
|
33
|
-
/** Defines the props for paste action */
|
|
34
20
|
pasteProps?: InputFieldProps<T>['pasteProps'];
|
|
35
|
-
/** Maximum number of allowed lines/values */
|
|
36
21
|
maxLines?: InputFieldProps<T>['maxLines'];
|
|
37
|
-
/** Function to process individual lines during input */
|
|
38
22
|
lineProcessing?: InputFieldProps<T>['lineProcessing'];
|
|
39
|
-
/** List of errors */
|
|
40
23
|
errors?: InputFieldProps<T>['errors'];
|
|
41
|
-
|
|
42
|
-
showErrors?: InputFieldProps<T>['showErrors'];
|
|
43
|
-
/** Internal */
|
|
24
|
+
showErrors?: boolean;
|
|
44
25
|
onErrorsChange?: InputFieldProps<T>['onErrorsChange'];
|
|
45
|
-
/** Internal */
|
|
46
26
|
onShowErrorsChange?: InputFieldProps<T>['onShowErrorsChange'];
|
|
47
|
-
/** Internal */
|
|
48
|
-
onImmediatelyChange?: InputFieldProps<T>['onImmediatelyChange'];
|
|
49
27
|
};
|
|
50
28
|
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
|
-
};
|
|
134
29
|
export type BulkTextareaType<T extends string | string[]> = BulkTextareaComponent & {
|
|
135
|
-
InputField: Intergalactic.Component<'div',
|
|
30
|
+
InputField: Intergalactic.Component<'div', Pick<InputFieldProps<T>, 'commonErrorMessage' | 'id'> & Partial<BulkTextareaProps<T>> & BoxProps>;
|
|
136
31
|
Counter: Intergalactic.Component<'div', Partial<CounterProps>>;
|
|
137
32
|
ClearAll: typeof Button;
|
|
138
33
|
ErrorsNavigation: Intergalactic.Component<'div', Partial<ErrorsNavigationProps>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type IRootComponentProps } from '@semcore/core';
|
|
2
|
-
import type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';
|
|
3
1
|
import React from 'react';
|
|
2
|
+
import { IRootComponentProps } from '@semcore/core';
|
|
3
|
+
import { useI18n } from '@semcore/utils/lib/enhances/WithI18n';
|
|
4
4
|
export declare function ClearAll(props: IRootComponentProps & {
|
|
5
5
|
isHidden: boolean;
|
|
6
6
|
getI18nText: ReturnType<typeof useI18n>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CounterProps as CounterPropsKit } from '@semcore/counter';
|
|
3
|
+
import { useI18n } from '@semcore/utils/lib/enhances/WithI18n';
|
|
4
4
|
export type CounterProps = {
|
|
5
5
|
theme: CounterPropsKit['theme'];
|
|
6
6
|
linesCount: number;
|
|
7
7
|
maxLines: number;
|
|
8
8
|
getI18nText: ReturnType<typeof useI18n>;
|
|
9
9
|
};
|
|
10
|
-
export declare function Counter(props: CounterProps):
|
|
10
|
+
export declare function Counter(props: CounterProps): JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import { useI18n } from '@semcore/utils/lib/enhances/WithI18n';
|
|
3
3
|
export type ErrorsNavigationProps = {
|
|
4
4
|
errorIndex: number;
|
|
5
5
|
onPrevError: () => void;
|
|
@@ -12,4 +12,4 @@ export type ErrorsNavigationProps = {
|
|
|
12
12
|
nextButtonRef: React.RefObject<HTMLButtonElement>;
|
|
13
13
|
prevButtonRef: React.RefObject<HTMLButtonElement>;
|
|
14
14
|
};
|
|
15
|
-
export declare function ErrorsNavigation(props: ErrorsNavigationProps):
|
|
15
|
+
export declare function ErrorsNavigation(props: ErrorsNavigationProps): JSX.Element;
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import type { PopperContext } from '@semcore/base-components';
|
|
2
|
-
import { Component } from '@semcore/core';
|
|
3
1
|
import React from 'react';
|
|
4
|
-
import
|
|
2
|
+
import { Component } from '@semcore/core';
|
|
3
|
+
import { PopperContext } from '@semcore/popper';
|
|
4
|
+
import { InputFieldProps, ErrorItem } from './InputField.types';
|
|
5
5
|
type IndexKeys = 'keyboardLineIndex' | 'mouseLineIndex';
|
|
6
6
|
type State = {
|
|
7
7
|
[key in IndexKeys]: number;
|
|
8
8
|
} & {
|
|
9
9
|
visibleErrorPopper: boolean;
|
|
10
10
|
};
|
|
11
|
-
declare class InputField<T extends string | string[]> extends Component<InputFieldProps<T>, typeof InputField.enhance
|
|
12
|
-
value: null;
|
|
13
|
-
linesCount: null;
|
|
14
|
-
errorIndex: null;
|
|
15
|
-
}, {}, State> {
|
|
11
|
+
declare class InputField<T extends string | string[]> extends Component<InputFieldProps<T>, {}, State, typeof InputField.enhance> {
|
|
16
12
|
static displayName: string;
|
|
17
13
|
static style: {
|
|
18
14
|
[key: string]: string;
|
|
19
15
|
};
|
|
20
16
|
static enhance: readonly [(props: any) => {
|
|
21
|
-
uid:
|
|
17
|
+
uid: string;
|
|
22
18
|
}];
|
|
23
19
|
static defaultProps: {
|
|
24
20
|
defaultValue: string;
|
|
@@ -45,7 +41,6 @@ declare class InputField<T extends string | string[]> extends Component<InputFie
|
|
|
45
41
|
toggleErrorsPopperTimeout: number;
|
|
46
42
|
isFocusing: boolean;
|
|
47
43
|
linesCountTimeout: number;
|
|
48
|
-
observer: MutationObserver;
|
|
49
44
|
state: {
|
|
50
45
|
visibleErrorPopper: boolean;
|
|
51
46
|
keyboardLineIndex: number;
|
|
@@ -71,10 +66,10 @@ declare class InputField<T extends string | string[]> extends Component<InputFie
|
|
|
71
66
|
handleScroll(): void;
|
|
72
67
|
handleMouseDown(event: MouseEvent): void;
|
|
73
68
|
handleMouseMove(event: MouseEvent): void;
|
|
74
|
-
handleMouseLeave(): void;
|
|
69
|
+
handleMouseLeave(event: MouseEvent): void;
|
|
75
70
|
handlePaste(event: ClipboardEvent): void;
|
|
76
71
|
handleChange(event: Event): void;
|
|
77
|
-
handleFocus(): void;
|
|
72
|
+
handleFocus(event: FocusEvent): void;
|
|
78
73
|
handleBlur(event: Event): void;
|
|
79
74
|
handleKeyDown(event: KeyboardEvent): void;
|
|
80
75
|
render(): React.ReactNode;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export type PasteProps = {
|
|
1
|
+
type PasteProps = {
|
|
3
2
|
/**
|
|
4
3
|
* @default '\n'
|
|
5
4
|
*/
|
|
@@ -18,27 +17,142 @@ export type ErrorItem = {
|
|
|
18
17
|
lineNode?: Node;
|
|
19
18
|
errorMessage: string;
|
|
20
19
|
};
|
|
21
|
-
export type InputFieldProps<T extends string | string[]> =
|
|
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
|
+
*/
|
|
22
105
|
prevError: ErrorItem;
|
|
106
|
+
/**
|
|
107
|
+
* Internal
|
|
108
|
+
*/
|
|
23
109
|
currentLineIndex: number;
|
|
110
|
+
/**
|
|
111
|
+
* Internal
|
|
112
|
+
*/
|
|
24
113
|
linesCount: number;
|
|
114
|
+
/**
|
|
115
|
+
* Internal
|
|
116
|
+
*/
|
|
25
117
|
onChangeLineIndex: (newIndex: number) => void;
|
|
118
|
+
/**
|
|
119
|
+
* Internal
|
|
120
|
+
*/
|
|
26
121
|
onChangeLinesCount: (rowsCount: number) => void;
|
|
122
|
+
/**
|
|
123
|
+
* Internal
|
|
124
|
+
*/
|
|
27
125
|
showErrors: boolean;
|
|
28
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* Internal
|
|
128
|
+
* List of errors in rows
|
|
129
|
+
*/
|
|
29
130
|
errors: ErrorItem[];
|
|
30
|
-
/**
|
|
131
|
+
/**
|
|
132
|
+
* Internal
|
|
133
|
+
* Select row with error
|
|
134
|
+
*/
|
|
31
135
|
errorIndex: number;
|
|
32
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* Internal
|
|
138
|
+
* Flag for select all row
|
|
139
|
+
*/
|
|
33
140
|
highlightErrorIndex: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Internal
|
|
143
|
+
*/
|
|
34
144
|
onErrorsChange: (errors: ErrorItem[]) => void;
|
|
145
|
+
/**
|
|
146
|
+
* Internal
|
|
147
|
+
*/
|
|
35
148
|
onShowErrorsChange: (showErrors: boolean) => void;
|
|
149
|
+
/**
|
|
150
|
+
* Internal
|
|
151
|
+
*/
|
|
36
152
|
onErrorIndexChange: (errorIndex: number) => void;
|
|
37
153
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*/
|
|
41
|
-
onImmediatelyChange?: (lines: string[], value: string) => void;
|
|
42
|
-
} & {
|
|
154
|
+
* Internal
|
|
155
|
+
*/
|
|
43
156
|
'aria-describedby'?: string;
|
|
44
157
|
};
|
|
158
|
+
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": "1.5.0-prerelease.
|
|
4
|
+
"version": "1.5.0-prerelease.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/utils": "4.49.0-prerelease.
|
|
18
|
-
"@semcore/flex-box": "5.42.0-prerelease.
|
|
19
|
-
"@semcore/button": "5.44.0-prerelease.
|
|
20
|
-
"@semcore/typography": "5.54.0-prerelease.
|
|
21
|
-
"@semcore/counter": "3.39.0-prerelease.
|
|
22
|
-
"@semcore/icon": "4.63.0-prerelease.
|
|
23
|
-
"@semcore/popper": "5.47.0-prerelease.
|
|
24
|
-
"@semcore/tooltip": "6.50.0-prerelease.
|
|
17
|
+
"@semcore/utils": "4.49.0-prerelease.1",
|
|
18
|
+
"@semcore/flex-box": "5.42.0-prerelease.1",
|
|
19
|
+
"@semcore/button": "5.44.0-prerelease.1",
|
|
20
|
+
"@semcore/typography": "5.54.0-prerelease.1",
|
|
21
|
+
"@semcore/counter": "3.39.0-prerelease.1",
|
|
22
|
+
"@semcore/icon": "4.63.0-prerelease.1",
|
|
23
|
+
"@semcore/popper": "5.47.0-prerelease.1",
|
|
24
|
+
"@semcore/tooltip": "6.50.0-prerelease.1",
|
|
25
25
|
"csstype": "3.0.8",
|
|
26
26
|
"dompurify": "3.2.3"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@semcore/core": "^2.40.0-prerelease.
|
|
29
|
+
"@semcore/core": "^2.40.0-prerelease.1",
|
|
30
30
|
"react": "16.8 - 18",
|
|
31
31
|
"react-dom": "16.8 - 18"
|
|
32
32
|
},
|