next-helios-fe 1.8.88 → 1.8.90
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/form/other/multipleSelect.d.ts +3 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/dropdown/item.tsx +1 -1
- package/src/components/form/input/file.tsx +3 -2
- package/src/components/form/other/multipleSelect.tsx +35 -26
- package/src/components/form/other/phoneNumber.tsx +2 -1
package/package.json
CHANGED
@@ -62,7 +62,8 @@ export const File: React.FC<FileProps> = ({
|
|
62
62
|
options?.height === "full" && "h-full"
|
63
63
|
}`}
|
64
64
|
>
|
65
|
-
{
|
65
|
+
{options?.variant !== "drag&drop" &&
|
66
|
+
!options?.buttonOnly &&
|
66
67
|
(label ||
|
67
68
|
(!options?.hideInputDetail &&
|
68
69
|
(options?.maxSizeInMb || description))) && (
|
@@ -79,7 +80,7 @@ export const File: React.FC<FileProps> = ({
|
|
79
80
|
)}
|
80
81
|
{!options?.hideInputDetail && (
|
81
82
|
<div className="flex-1 flex justify-end items-center gap-2">
|
82
|
-
{options?.
|
83
|
+
{options?.maxSizeInMb && (
|
83
84
|
<span className="text-sm select-none">
|
84
85
|
{options?.maxSizeInMb} MB
|
85
86
|
</span>
|
@@ -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) {
|
@@ -1561,12 +1561,13 @@ export const PhoneNumber: React.FC<PhoneNumberProps> = ({
|
|
1561
1561
|
<div className="relative flex items-center cursor-pointer">
|
1562
1562
|
<input
|
1563
1563
|
type="text"
|
1564
|
-
className={`max-w-24 w-min ps-4 pe-4 border-default border rounded-md bg-secondary-bg placeholder:duration-300 placeholder:translate-x-0 focus:placeholder:translate-x-1 placeholder:text-silent focus:outline-none focus:ring-1 focus:ring-primary focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:text-disabled disabled:cursor-default ${height} ${
|
1564
|
+
className={`max-w-24 w-min ps-4 pe-4 border-default border rounded-md bg-secondary-bg cursor-pointer placeholder:duration-300 placeholder:translate-x-0 focus:placeholder:translate-x-1 placeholder:text-silent focus:outline-none focus:ring-1 focus:ring-primary focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:text-disabled disabled:cursor-default ${height} ${
|
1565
1565
|
openDropdown
|
1566
1566
|
? "placeholder:translate-x-1 outline-none ring-1 ring-primary shadow shadow-primary border-primary-dark"
|
1567
1567
|
: "border-default placeholder:translate-x-0"
|
1568
1568
|
}`}
|
1569
1569
|
readOnly
|
1570
|
+
tabIndex={-1}
|
1570
1571
|
disabled={rest.disabled}
|
1571
1572
|
value={`${
|
1572
1573
|
countryPhoneCode.find(
|