import { Meta, StoryObj } from "@storybook/react"; import { InputControls } from "@sb/helpers"; import { CustomSelect } from "."; import { Item, Section } from "../../Collection"; import { getCssProps } from "@sb/cssprops"; import { MaterialIcon } from "@components/Icons/MaterialIcon"; import { Flex } from "@components/Layout/Flex"; const meta: Meta = { title: "Dropdowns/Selection/CustomSelect", component: CustomSelect, parameters: { layout: "centered", cssprops: getCssProps("Dropdown", "Listbox", "Button"), }, argTypes: { ...InputControls, variant: { control: "select", options: ["default", "floating"], }, selectedKey: { control: "select", description: "Control the value of the selected key in a controlled component", options: ["val1", "val2", "val3", null], }, defaultSelectedKey: { control: false, description: "Control the value of the selected key in an uncontrolled component", }, children: { control: false, }, isOpen: { control: "boolean", description: "Control the open state of the menu", }, defaultOpen: { control: "boolean", description: "Control the inital state of the menu", }, onOpenChange: { control: false, action: "onOpenChange", description: "Callback for when the menu is opened or closed", table: { category: "Events", }, }, onSelectionChange: { action: "onSelectionChange", control: false, description: "Callback for when the selection changes", table: { category: "Events", }, }, }, }; export default meta; type Story = StoryObj; export const Primary: Story = { args: { size: "medium", variant: "default", label: "Custom Select Label", children: [ Item 1, Item 2, Item 3, ], }, }; export const WithSections: Story = { args: { ...Primary.args, children: [ Item 1, Item 2, Item 3,
Item 4 Item 5
, ], }, }; export const Floating: Story = { args: { ...Primary.args, defaultSelectedKey: "undefined", variant: "floating", }, }; export const WithCustomContent: Story = { args: { ...Primary.args, children: [ Home , Settings , Profile , ], }, };