// // Copyright 2026 DXOS.org // import { type Meta, type StoryObj } from '@storybook/react-vite'; import React from 'react'; import { type ChromaticPalette } from '@dxos/ui-types'; import { withLayout, withTheme } from '../../testing/index.ts'; import { type Gap, gapClasses } from '../layout.ts'; import { Flex } from './Flex.tsx'; const Cell = ({ label, hue }: { label: string; hue: ChromaticPalette }) => (
{label}
); const RowStory = () => ( ); const ColumnStory = () => ( ); const GrowStory = () => ( ); /** Every step of the ramp, so a gap change is visible rather than inferred. */ const GapsStory = () => ( {(Object.keys(gapClasses) as Gap[]).map((gap) => (
{gap}
))}
); /** The empty-state shape: one centered child filling the available block size. */ const CenterStory = () => ( Nothing here yet ); /** `asChild` projects the layout onto a semantic element without adding a wrapper. */ const AsChildStory = () => ( ); const meta: Meta = { title: 'ui/react-ui-core/layout/Flex', decorators: [withTheme(), withLayout({ layout: 'column' })], parameters: { layout: 'fullscreen' }, }; export default meta; type Story = StoryObj; export const Row: Story = { render: RowStory }; export const Column: Story = { render: ColumnStory }; export const Grow: Story = { render: GrowStory }; export const Gaps: Story = { render: GapsStory }; export const Center: Story = { render: CenterStory }; export const AsChild: Story = { render: AsChildStory };