@xqmsg/ui-core 0.23.1-rc.3 → 0.23.1-rc.4
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/dist/ui-core.cjs.development.js +1 -1
- package/dist/ui-core.cjs.development.js.map +1 -1
- package/dist/ui-core.cjs.production.min.js +1 -1
- package/dist/ui-core.cjs.production.min.js.map +1 -1
- package/dist/ui-core.esm.js +1 -1
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/input/StackedPilledInput/index.tsx +18 -7
- package/src/components/input/index.tsx +2 -5
package/package.json
CHANGED
|
@@ -67,7 +67,11 @@ const StackedPilledInput = React.forwardRef<
|
|
|
67
67
|
|
|
68
68
|
if (watchedValue !== undefined && watchedValue?.length) {
|
|
69
69
|
setLatestFormValueToArray(
|
|
70
|
-
watchedValue
|
|
70
|
+
watchedValue
|
|
71
|
+
.split(';')
|
|
72
|
+
.join(',')
|
|
73
|
+
.split(',')
|
|
74
|
+
.filter(Boolean)
|
|
71
75
|
);
|
|
72
76
|
|
|
73
77
|
if (latestTokenElement) {
|
|
@@ -83,7 +87,10 @@ const StackedPilledInput = React.forwardRef<
|
|
|
83
87
|
const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
84
88
|
if (tokenIndex === null) {
|
|
85
89
|
setLocalValue(
|
|
86
|
-
e.target.value
|
|
90
|
+
e.target.value
|
|
91
|
+
.trim()
|
|
92
|
+
.replace(',', '')
|
|
93
|
+
.replace(';', '').length
|
|
87
94
|
? e.target.value
|
|
88
95
|
: ''
|
|
89
96
|
);
|
|
@@ -107,7 +114,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
107
114
|
const filteredUniqueValues = Array.from(
|
|
108
115
|
new Set(
|
|
109
116
|
lastestFormValueToArray.filter(
|
|
110
|
-
|
|
117
|
+
value => value !== lastestFormValueToArray[tokenIndex]
|
|
111
118
|
)
|
|
112
119
|
)
|
|
113
120
|
);
|
|
@@ -123,7 +130,11 @@ const StackedPilledInput = React.forwardRef<
|
|
|
123
130
|
const filteredUniqueValues = Array.from(
|
|
124
131
|
new Set([
|
|
125
132
|
...lastestFormValueToArray,
|
|
126
|
-
...localValue
|
|
133
|
+
...localValue
|
|
134
|
+
.trim()
|
|
135
|
+
.split(';')
|
|
136
|
+
.join(',')
|
|
137
|
+
.split(','),
|
|
127
138
|
])
|
|
128
139
|
);
|
|
129
140
|
|
|
@@ -147,7 +158,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
147
158
|
const filteredUniqueValues = Array.from(
|
|
148
159
|
new Set(
|
|
149
160
|
[...lastestFormValueToArray].filter(
|
|
150
|
-
|
|
161
|
+
value => value !== lastestFormValueToArray[tokenIndex]
|
|
151
162
|
)
|
|
152
163
|
)
|
|
153
164
|
);
|
|
@@ -167,7 +178,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
167
178
|
return setTokenIndex(lastestFormValueToArray.length - 1);
|
|
168
179
|
}
|
|
169
180
|
|
|
170
|
-
setTokenIndex(
|
|
181
|
+
setTokenIndex(prevTokenIndex => (prevTokenIndex as number) - 1);
|
|
171
182
|
|
|
172
183
|
const tokenElement = document.getElementById(
|
|
173
184
|
`${name}_token_${tokenIndex}`
|
|
@@ -187,7 +198,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
187
198
|
if (tokenIndex === lastestFormValueToArray.length - 1) {
|
|
188
199
|
return setTokenIndex(null);
|
|
189
200
|
}
|
|
190
|
-
setTokenIndex(
|
|
201
|
+
setTokenIndex(prevTokenIndex => (prevTokenIndex as number) + 1);
|
|
191
202
|
|
|
192
203
|
const tokenElement = document.getElementById(
|
|
193
204
|
`${name}_token_${tokenIndex}`
|
|
@@ -289,11 +289,8 @@ export function Input<T extends FieldValues>({
|
|
|
289
289
|
ref,
|
|
290
290
|
value
|
|
291
291
|
)}
|
|
292
|
-
{isInvalid
|
|
293
|
-
|
|
294
|
-
) : (
|
|
295
|
-
helperText && <FormHelperText>{helperText}</FormHelperText>
|
|
296
|
-
)}
|
|
292
|
+
{isInvalid && <FormErrorMessage>{errorText}</FormErrorMessage>}
|
|
293
|
+
{helperText && <FormHelperText>{helperText}</FormHelperText>}
|
|
297
294
|
</FormControl>
|
|
298
295
|
)}
|
|
299
296
|
/>
|