refactor(forms): Enhance MultiSelect with controlled state and styling
This commit overhauls the `MultiSelect` component to improve its functionality, flexibility, and integration with form libraries. The component is now a controlled component, accepting a `value` prop and using the `onChange` handler to propagate updates. This allows for seamless integration with libraries like React Hook Form. Key changes include: - Added `value`, `disabled`, `active`, and `height` props for more granular control over the component's state and appearance. - Refactored styling logic to use the `cn` utility for cleaner conditional class management. - Simplified the internal JSX structure and SVGs for better readability and maintenance. - Updated the component's state management to correctly reflect the incoming `value` prop.
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
import type { Metadata } from "next";
|
||||
|
||||
import { GlobeIcon } from "@/assets/icons";
|
||||
|
||||
import DatePickerOne from "@/components/FormElements/DatePicker/DatePickerOne";
|
||||
import DatePickerTwo from "@/components/FormElements/DatePicker/DatePickerTwo";
|
||||
import InputGroup from "@/components/FormElements/InputGroup";
|
||||
import { TextAreaGroup } from "@/components/FormElements/InputGroup/text-area";
|
||||
import MultiSelect from "@/components/FormElements/MultiSelect";
|
||||
import { Checkbox } from "@/components/FormElements/checkbox";
|
||||
import { RadioInput } from "@/components/FormElements/radio";
|
||||
import { Select } from "@/components/FormElements/select";
|
||||
import { Switch } from "@/components/FormElements/switch";
|
||||
import { ShowcaseSection } from "@/components/Layouts/showcase-section";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user