/* eslint-disable no-alert */ import React from 'react'; import type { Meta, StoryObj } from '@storybook/react-vite'; import { Keyboard, Text, type Selection } from 'react-aria-components'; import { Button } from '../Button/Button.quanta'; import { BackgroundIcon, BlindIcon, DashIcon, LinkIcon, MoreoptionsIcon, PropertiesIcon, SettingsIcon, } from '../icons'; import { Menu, MenuItem, MenuSection, MenuSectionHeader, MenuSeparator, MenuTrigger, SubmenuTrigger, } from './Menu.quanta'; const meta: Meta = { title: 'Quanta/Menu', component: Menu, parameters: { layout: 'centered', }, tags: ['autodocs'], }; export default meta; type Story = StoryObj; function TriggerButton({ children }: { children: React.ReactNode }) { return ( ); } export const Default: Story = { render: (args: any) => ( Cut Copy Paste ), args: {}, }; export const WithTextSlots: Story = { render: (args: any) => ( Cut Cut to the clipboard ⌘X Copy Copy to the clipboard ⌘C Paste Paste from the clipboard ⌘V ), args: {}, }; export const WithIconButton: Story = { render: (args: any) => ( Cut Copy Paste ), args: {}, }; export const DisabledItems: Story = { render: (args: any) => ( Cut Copy Paste ), args: {}, }; export const WithSeparators: Story = { render: (args: any) => ( Cut Copy Paste Bold ), args: {}, }; export const WithSections: Story = { render: (args: any) => ( Styles Bold Underline Align Left Middle Right ), args: {}, }; export const WithCustomHeader: Story = { render: (args: any) => ( Styles Bold Underline ), args: {}, }; export const AsLinks: Story = { render: (args: any) => ( Adobe Apple Google Microsoft ), args: {}, }; export const SingleSelection: Story = { render: (args: any) => { const [selected, setSelected] = React.useState( new Set(['center']), ); return ( <> Left Center Right

Current selection (controlled):{' '} {selected === 'all' ? 'all' : [...selected].join(', ')}

); }, args: {}, }; export const MultipleSelection: Story = { render: (args: any) => { const [selected, setSelected] = React.useState( new Set(['sidebar', 'console']), ); return ( <> Sidebar Searchbar Tools Console

Current selection (controlled):{' '} {selected === 'all' ? 'all' : [...selected].join(', ')}

); }, args: {}, }; export const ControlledState: Story = { render: (args: any) => { const [open, setOpen] = React.useState(false); return ( Cut Copy Paste ); }, args: {}, }; export const LongPress: Story = { render: (args: any) => ( alert(String(id))}> Cut Copy Paste ), args: {}, }; export const WithSubmenu: Story = { render: (args: any) => ( New Share SMS X Email Work Personal ), args: {}, };