next-helios-fe 1.8.88 → 1.8.89
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/package.json
CHANGED
@@ -11,6 +11,9 @@ export interface MultipleSelectProps
|
|
11
11
|
menus: {
|
12
12
|
label: string;
|
13
13
|
value: string;
|
14
|
+
variant?: "button" | "title";
|
15
|
+
disabled?: boolean;
|
16
|
+
disableUnselect?: boolean;
|
14
17
|
[key: string]: any;
|
15
18
|
}[];
|
16
19
|
label?: string;
|
@@ -126,6 +129,12 @@ export const MultipleSelect: React.FC<MultipleSelectProps> = ({
|
|
126
129
|
</div>
|
127
130
|
)}
|
128
131
|
<div className="relative flex items-center">
|
132
|
+
<input
|
133
|
+
ref={inputRef}
|
134
|
+
type="text"
|
135
|
+
className="absolute bottom-0 -z-10 w-full border-0 rounded-md focus:ring-0"
|
136
|
+
disabled={disabled ?? false}
|
137
|
+
/>
|
129
138
|
<div
|
130
139
|
ref={fakeInputRef}
|
131
140
|
className={`group/button flex justify-between items-center gap-2 w-full min-h-10 px-4 border rounded-md caret-transparent focus:outline-none focus:ring-1 focus:ring-primary focus:shadow focus:shadow-primary focus:border-primary-dark ${height} ${
|
@@ -187,12 +196,6 @@ export const MultipleSelect: React.FC<MultipleSelectProps> = ({
|
|
187
196
|
</div>
|
188
197
|
)}
|
189
198
|
</div>
|
190
|
-
<input
|
191
|
-
ref={inputRef}
|
192
|
-
type="text"
|
193
|
-
className="absolute bottom-0 -z-10 w-full border-0 focus:ring-0"
|
194
|
-
disabled={disabled ?? false}
|
195
|
-
/>
|
196
199
|
<div
|
197
200
|
className="absolute left-4 flex flex-wrap gap-2 h-min pointer-events-none"
|
198
201
|
style={{ width: itemContainerRef.current?.clientWidth }}
|
@@ -202,34 +205,38 @@ export const MultipleSelect: React.FC<MultipleSelectProps> = ({
|
|
202
205
|
<div
|
203
206
|
key={item}
|
204
207
|
className={`flex items-center gap-2 px-2 py-0.5 rounded-md text-white select-none cursor-default pointer-events-auto ${
|
205
|
-
disabled
|
208
|
+
disabled ||
|
209
|
+
menus.find((i) => i.value === item)?.disableUnselect
|
210
|
+
? "bg-secondary"
|
211
|
+
: "bg-primary"
|
206
212
|
}`}
|
207
213
|
>
|
208
214
|
<span>{menus.find((i) => i.value === item)?.label}</span>
|
209
|
-
<
|
210
|
-
|
215
|
+
<button
|
216
|
+
disabled={
|
217
|
+
disabled ||
|
218
|
+
menus.find((i) => i.value === item)?.disableUnselect
|
219
|
+
}
|
211
220
|
onClick={() => {
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
});
|
227
|
-
}
|
221
|
+
setTempValue(tempValue.filter((i) => i !== item));
|
222
|
+
if (onChange) {
|
223
|
+
onChange({
|
224
|
+
target: {
|
225
|
+
value: tempValue.filter((i) => i !== item),
|
226
|
+
},
|
227
|
+
} as any);
|
228
|
+
}
|
229
|
+
if (onRemove) {
|
230
|
+
onRemove({
|
231
|
+
target: {
|
232
|
+
value: item,
|
233
|
+
},
|
234
|
+
});
|
228
235
|
}
|
229
236
|
}}
|
230
237
|
>
|
231
238
|
<Icon icon="pajamas:close" />
|
232
|
-
</
|
239
|
+
</button>
|
233
240
|
</div>
|
234
241
|
);
|
235
242
|
})}
|
@@ -273,6 +280,8 @@ export const MultipleSelect: React.FC<MultipleSelectProps> = ({
|
|
273
280
|
active={
|
274
281
|
tempValue?.find((i) => i === item.value) ? true : false
|
275
282
|
}
|
283
|
+
as={item.variant || "button"}
|
284
|
+
disabled={item.disabled ?? false}
|
276
285
|
onClick={() => {
|
277
286
|
setTempValue([...tempValue, item.value]);
|
278
287
|
if (onChange) {
|