import React from 'react'; import type { Meta, StoryObj } from '@storybook/react-vite'; import { Anchor } from '../Anchor/Anchor'; import { Icon } from '../Icon/Icon'; import { Checkbox } from '../Inputs/Checkbox/Checkbox'; import { Strong } from '../Typography/Strong/Strong'; import { Text } from '../Typography/Text/Text'; import { DataList } from './DataList'; import { getDatalistItemProps } from './DataListItem'; import { listOfFruits, listOfVegetables } from './fixtures'; const meta: Meta = { title: 'UI kit/Form/Primitives/DataList', component: DataList, tags: ['autodocs'], }; export default meta; type Story = StoryObj; export const Default: Story = { args: { children: listOfFruits.map((item, index) => ( {item.name} )), }, }; export const WithDescription: Story = { args: { children: listOfFruits.map((item, index) => ( {item.name} {item.description} )), }, }; export const TwoColumns: Story = { args: { children: listOfFruits.map((item, index) => ( {item.name} {item.description} )), }, }; export const ThreeCells: Story = { args: { children: listOfFruits.map((item, index) => ( {item.name} {item.description} )), }, }; /** * Shows dense DataList split into section with no dividers between items. */ export const Sections: Story = { args: { gap: 'sm', dense: true, divider: false, children: ( <> Select all Fruits {listOfFruits.map((item, index) => ( {item.name} ))} Vegetables {listOfVegetables.map((item, index) => ( {item.name} ))} ), }, }; export const NativeHTMLItems: Story = { args: { children: ( <> HTML Anchor Element with href Anchor HTML Anchor Element (with no href) Anchor + aria-disabled HTML Anchor Element (with no href) Anchor + data-disabled
HTML Div Element Div
HTML Div Element Div + aria-disabled
HTML Div Element Div + data-disabled
), }, }; export const NativeHTMLItemCells: Story = { args: { children: ( <> Active item Description Anchor with href Disabled item Description Anchor with href Disabled item Description Anchor with no href ), }, };