next-helios-fe 1.8.3 → 1.8.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/package.json
CHANGED
@@ -14,6 +14,7 @@ export interface SelectProps
|
|
14
14
|
label?: string;
|
15
15
|
placeholder?: string;
|
16
16
|
description?: string;
|
17
|
+
labelComponent?: (e?: any) => React.ReactNode;
|
17
18
|
options?: {
|
18
19
|
width?: "full" | "fit";
|
19
20
|
height?: "short" | "medium" | "high";
|
@@ -21,11 +22,12 @@ export interface SelectProps
|
|
21
22
|
}
|
22
23
|
|
23
24
|
export const Select: React.FC<SelectProps> = ({
|
24
|
-
options,
|
25
25
|
label,
|
26
26
|
menus,
|
27
27
|
placeholder,
|
28
28
|
description,
|
29
|
+
labelComponent,
|
30
|
+
options,
|
29
31
|
...rest
|
30
32
|
}) => {
|
31
33
|
const [tempValue, setTempValue] = useState("");
|
@@ -151,7 +153,7 @@ export const Select: React.FC<SelectProps> = ({
|
|
151
153
|
<button
|
152
154
|
key={index}
|
153
155
|
type="button"
|
154
|
-
className="min-w-40 w-full my-0.5 px-4 py-2 rounded-md text-sm text-left hover:bg-secondary-light disabled:bg-primary-transparent disabled:text-primary"
|
156
|
+
className="flex justify-between items-center min-w-40 w-full my-0.5 px-4 py-2 rounded-md text-sm text-left hover:bg-secondary-light disabled:bg-primary-transparent disabled:text-primary"
|
155
157
|
disabled
|
156
158
|
onClick={() => {
|
157
159
|
setTempValue(item.value);
|
@@ -162,7 +164,8 @@ export const Select: React.FC<SelectProps> = ({
|
|
162
164
|
}
|
163
165
|
}}
|
164
166
|
>
|
165
|
-
{item.label}
|
167
|
+
<span>{item.label}</span>
|
168
|
+
{labelComponent ? labelComponent(item) : ""}
|
166
169
|
</button>
|
167
170
|
);
|
168
171
|
} else {
|
@@ -170,7 +173,7 @@ export const Select: React.FC<SelectProps> = ({
|
|
170
173
|
<button
|
171
174
|
key={index}
|
172
175
|
type="button"
|
173
|
-
className="min-w-40 w-full my-0.5 px-4 py-2 rounded-md text-sm text-left hover:bg-secondary-light disabled:text-slate-400"
|
176
|
+
className="flex justify-between items-center min-w-40 w-full my-0.5 px-4 py-2 rounded-md text-sm text-left hover:bg-secondary-light disabled:text-slate-400"
|
174
177
|
disabled={item.disabled}
|
175
178
|
onClick={() => {
|
176
179
|
setTempValue(item.value);
|
@@ -181,7 +184,8 @@ export const Select: React.FC<SelectProps> = ({
|
|
181
184
|
}
|
182
185
|
}}
|
183
186
|
>
|
184
|
-
{item.label}
|
187
|
+
<span>{item.label}</span>
|
188
|
+
{labelComponent ? labelComponent(item) : ""}
|
185
189
|
</button>
|
186
190
|
);
|
187
191
|
}
|