import type { Meta, StoryObj } from '@storybook/react'; import { useState } from 'react'; import { PixelModal } from './overlays/PixelModal'; import { PixelTooltip } from './overlays/PixelTooltip'; import { PixelDropdown } from './overlays/PixelDropdown'; import { PixelButton } from './actions'; import { PxlKitIcon } from '@pxlkit/core'; import { Gear } from '@pxlkit/ui'; const TONES = ['green', 'cyan', 'gold', 'red', 'purple', 'pink', 'neutral'] as const; const SURFACES = ['pixel', 'linear'] as const; const meta: Meta = { title: 'UI Kit / Overlay', parameters: { layout: 'padded' }, }; export default meta; type Story = StoryObj; function ModalDemo({ surface, title }: { surface: 'pixel' | 'linear'; title: string }) { const [open, setOpen] = useState(false); return ( <> setOpen(true)}>Open modal setOpen(false)}>

Persisting the current procedural world seed will lock subsequent renders to this state.

You can revert later from the settings panel.

); } /** Overview — every overlay component in one frame. */ export const AllOverlay: Story = { render: (args: any) => (

PixelModal

PixelTooltip — 4 positions

Top Bottom Left Right

PixelDropdown

} onSelect={(v) => console.log('dropdown selected', v)} items={[ { value: 'duplicate', label: 'Duplicate' }, { value: 'archive', label: 'Archive' }, { value: 'export', label: 'Export as PNG' }, { value: 'delete', label: 'Delete' }, ]} />
), argTypes: { surface: { control: 'inline-radio', options: SURFACES } }, args: { surface: 'pixel' as const }, }; /* ────────────────────────────────────────────────────────────────────────── PixelModal ────────────────────────────────────────────────────────────────────────── */ export const PixelModalStory: Story = { name: 'PixelModal', render: (args: any) => , argTypes: { title: { control: 'text' }, size: { control: 'inline-radio', options: ['sm', 'md', 'lg'] }, surface: { control: 'inline-radio', options: SURFACES }, }, args: { title: 'Save snapshot?', size: 'md', surface: 'pixel' }, }; /* ────────────────────────────────────────────────────────────────────────── PixelTooltip ────────────────────────────────────────────────────────────────────────── */ export const PixelTooltipStory: Story = { name: 'PixelTooltip', render: (args: any) => ( Hover me ), argTypes: { content: { control: 'text' }, position: { control: 'inline-radio', options: ['top', 'bottom', 'left', 'right'] }, surface: { control: 'inline-radio', options: SURFACES }, }, args: { content: 'Hovering tooltip', position: 'top', surface: 'pixel', }, }; /* ────────────────────────────────────────────────────────────────────────── PixelDropdown ────────────────────────────────────────────────────────────────────────── */ export const PixelDropdownStory: Story = { name: 'PixelDropdown', render: (args: any) => console.log('selected', v)} />, argTypes: { label: { control: 'text' }, tone: { control: 'select', options: TONES }, surface: { control: 'inline-radio', options: SURFACES }, disabled: { control: 'boolean' }, }, args: { label: 'Actions', tone: 'green', surface: 'pixel', disabled: false, items: [ { value: 'duplicate', label: 'Duplicate' }, { value: 'archive', label: 'Archive' }, { value: 'export', label: 'Export as PNG' }, { value: 'delete', label: 'Delete' }, ], }, };