@xqmsg/ui-core 0.23.1-rc.2 → 0.23.1-rc.3
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/components/input/index.d.ts +2 -1
- package/dist/ui-core.cjs.development.js +4 -2
- 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 +4 -2
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/input/StackedPilledInput/index.tsx +7 -18
- package/src/components/input/index.tsx +3 -0
package/package.json
CHANGED
|
@@ -67,11 +67,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
67
67
|
|
|
68
68
|
if (watchedValue !== undefined && watchedValue?.length) {
|
|
69
69
|
setLatestFormValueToArray(
|
|
70
|
-
watchedValue
|
|
71
|
-
.split(';')
|
|
72
|
-
.join(',')
|
|
73
|
-
.split(',')
|
|
74
|
-
.filter(Boolean)
|
|
70
|
+
watchedValue.split(';').join(',').split(',').filter(Boolean)
|
|
75
71
|
);
|
|
76
72
|
|
|
77
73
|
if (latestTokenElement) {
|
|
@@ -87,10 +83,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
87
83
|
const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
88
84
|
if (tokenIndex === null) {
|
|
89
85
|
setLocalValue(
|
|
90
|
-
e.target.value
|
|
91
|
-
.trim()
|
|
92
|
-
.replace(',', '')
|
|
93
|
-
.replace(';', '').length
|
|
86
|
+
e.target.value.trim().replace(',', '').replace(';', '').length
|
|
94
87
|
? e.target.value
|
|
95
88
|
: ''
|
|
96
89
|
);
|
|
@@ -114,7 +107,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
114
107
|
const filteredUniqueValues = Array.from(
|
|
115
108
|
new Set(
|
|
116
109
|
lastestFormValueToArray.filter(
|
|
117
|
-
value => value !== lastestFormValueToArray[tokenIndex]
|
|
110
|
+
(value) => value !== lastestFormValueToArray[tokenIndex]
|
|
118
111
|
)
|
|
119
112
|
)
|
|
120
113
|
);
|
|
@@ -130,11 +123,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
130
123
|
const filteredUniqueValues = Array.from(
|
|
131
124
|
new Set([
|
|
132
125
|
...lastestFormValueToArray,
|
|
133
|
-
...localValue
|
|
134
|
-
.trim()
|
|
135
|
-
.split(';')
|
|
136
|
-
.join(',')
|
|
137
|
-
.split(','),
|
|
126
|
+
...localValue.trim().split(';').join(',').split(','),
|
|
138
127
|
])
|
|
139
128
|
);
|
|
140
129
|
|
|
@@ -158,7 +147,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
158
147
|
const filteredUniqueValues = Array.from(
|
|
159
148
|
new Set(
|
|
160
149
|
[...lastestFormValueToArray].filter(
|
|
161
|
-
value => value !== lastestFormValueToArray[tokenIndex]
|
|
150
|
+
(value) => value !== lastestFormValueToArray[tokenIndex]
|
|
162
151
|
)
|
|
163
152
|
)
|
|
164
153
|
);
|
|
@@ -178,7 +167,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
178
167
|
return setTokenIndex(lastestFormValueToArray.length - 1);
|
|
179
168
|
}
|
|
180
169
|
|
|
181
|
-
setTokenIndex(prevTokenIndex => (prevTokenIndex as number) - 1);
|
|
170
|
+
setTokenIndex((prevTokenIndex) => (prevTokenIndex as number) - 1);
|
|
182
171
|
|
|
183
172
|
const tokenElement = document.getElementById(
|
|
184
173
|
`${name}_token_${tokenIndex}`
|
|
@@ -198,7 +187,7 @@ const StackedPilledInput = React.forwardRef<
|
|
|
198
187
|
if (tokenIndex === lastestFormValueToArray.length - 1) {
|
|
199
188
|
return setTokenIndex(null);
|
|
200
189
|
}
|
|
201
|
-
setTokenIndex(prevTokenIndex => (prevTokenIndex as number) + 1);
|
|
190
|
+
setTokenIndex((prevTokenIndex) => (prevTokenIndex as number) + 1);
|
|
202
191
|
|
|
203
192
|
const tokenElement = document.getElementById(
|
|
204
193
|
`${name}_token_${tokenIndex}`
|
|
@@ -49,6 +49,7 @@ export interface InputProps<T extends FieldValues> extends ValidationProps {
|
|
|
49
49
|
allowDefault?: boolean;
|
|
50
50
|
rightElement?: React.ReactNode;
|
|
51
51
|
variant: string;
|
|
52
|
+
separators?: string[];
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
/**
|
|
@@ -81,6 +82,7 @@ export function Input<T extends FieldValues>({
|
|
|
81
82
|
setValue,
|
|
82
83
|
setError,
|
|
83
84
|
clearErrors,
|
|
85
|
+
separators,
|
|
84
86
|
}: InputProps<T>) {
|
|
85
87
|
const selectedInputField = (
|
|
86
88
|
onChange: () => void,
|
|
@@ -227,6 +229,7 @@ export function Input<T extends FieldValues>({
|
|
|
227
229
|
maxLength={maxLength}
|
|
228
230
|
variant={variant}
|
|
229
231
|
label={label}
|
|
232
|
+
separators={separators}
|
|
230
233
|
/>
|
|
231
234
|
);
|
|
232
235
|
case 'switch':
|