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