Optimize config form and binder

This commit is contained in:
Eduard Heimbuch
2023-04-19 11:52:22 +02:00
parent 40c4e1672c
commit a185cc7d16
9 changed files with 41 additions and 12 deletions

View File

@@ -33,15 +33,19 @@ type Props = {
testId?: string;
} & InputHTMLAttributes<HTMLSelectElement>;
/**
* @beta
* @since 2.44.0
*/
const Select = React.forwardRef<HTMLSelectElement, Props>(
({ variant, children, className, options, testId, ...props }, ref) => (
<div className={classNames("select", { "is-multiple": props.multiple }, createVariantClass(variant), className)}>
<select ref={ref} {...props} {...createAttributesForTesting(testId)} className={className}>
{options
? options.map((option) => (
<option {...option} key={option.value as Key}>
{option.label}
{option.children}
? options.map((opt) => (
<option {...opt} key={opt.value as Key}>
{opt.label}
{opt.children}
</option>
))
: children}

View File

@@ -39,6 +39,8 @@ type Props = {
/**
* @see https://bulma.io/documentation/form/select/
* @beta
* @since 2.44.0
*/
const SelectField = React.forwardRef<HTMLSelectElement, Props>(
({ label, helpText, error, className, id, ...props }, ref) => {