Added create chip element

This commit is contained in:
sianida26 2024-05-17 18:04:51 +07:00
parent 1184a44c57
commit 277391766d

View File

@ -1,4 +1,6 @@
import {
Chip,
ChipProps,
Fieldset,
FieldsetProps,
MultiSelect,
@ -43,12 +45,17 @@ type Group = {
inputs: AcceptedInput[];
} & FieldsetProps;
type ChipType = {
type: "chip";
} & Omit<ChipProps, "type">;
type AcceptedInput = (
| TextInputType
| MultiSelectInputType
| PasswordInputType
| NumberInputType
| SelectType
| ChipType
| Group
) &
GeneralInputProps;
@ -117,6 +124,17 @@ function createInputComponents(options: Options) {
return <Fieldset {...input}>{localComponents}</Fieldset>;
}
case "chip": {
return (
<Chip
{...input}
type="checkbox"
readOnly={options.readonlyAll || input.readOnly}
disabled={options.disableAll || input.disabled}
/>
);
}
}
};