import { Meta, StoryObj } from "@storybook/react"; import { getCssProps } from "@sb/cssprops"; import { IconMenu } from "."; import { Item, MaterialIcon, Section } from "../../"; const meta: Meta = { title: "Dropdowns/Menu/IconMenu", component: IconMenu, parameters: { layout: "centered", cssprops: getCssProps("Dropdown", "Menu", "Button"), }, argTypes: { buttonVariant: { control: "select", options: [ "primary", "secondary", "error", "success", "inverted", "content", ], }, iconVariant: { control: "select", options: ["default", "outlined", "round", "sharp", "two-tone"], }, children: { control: false, }, onClose: { description: "Callback for when the menu is closed.", table: { category: "Events", }, }, onOpenChange: { description: "Callback for when the menu is opened or closed.", table: { category: "Events", }, }, isOpen: { control: "boolean", description: "Control the open state of the menu externally.", }, defaultOpen: { control: "boolean", description: "Whether the menu is open by default.", }, disabledKeys: { control: "multi-select", options: ["item1", "item2", "item3"], description: "Keys of items that should be disabled.", }, }, }; export default meta; type Story = StoryObj; export const Primary: Story = { args: { icon: "more_vert", children: [ alert("Item 1")}> Item 1 , alert("Item 2")}> Item 2 , alert("Item 3")}> Item 3 , ], }, }; export const WithSections: Story = { args: { ...Primary.args, children: [ Item 1, Item 2,
Item 3 Item 4
, ], }, }; export const WithIcons: Story = { args: { ...Primary.args, children: [ Edit , Delete , Archive , ], }, }; export const DisabledItems: Story = { args: { ...Primary.args, disabledKeys: ["item2"], }, };