import React from 'react'
import { action } from '@storybook/addon-actions'
import { type Meta, type StoryObj } from '@storybook/react'
import { Icon } from '~components/Icon'
import { Text } from '~components/Text'
import { type StickerSheetStory } from '~storybook/components/StickerSheet'
import {
TableCard,
TableContainer,
TableHeader,
TableHeaderRowCell,
TableRow,
TableRowCell,
} from '../index'
export default {
title: 'Components/Table',
parameters: {
chromatic: { disable: false },
docs: {
source: { type: 'dynamic' },
},
a11y: {
config: {
rules: [
{
// Fixing this in a rebuild
id: 'nested-interactive',
enabled: false,
},
{
// Fixing this in a rebuild
id: 'aria-required-children',
enabled: false,
},
{
// Fixing this in a rebuild
id: 'aria-required-parent',
enabled: false,
},
],
},
},
},
decorators: [
(Story) => (
),
],
} satisfies Meta
const TableTemplate: StoryObj = {
render: ({ isReversed }) => (
<>
TableHeaderRowCell with long titles
Default
Data 2
Data 3
TableHeaderRowCell onClick
Default
Data 2
Data 3
TableHeaderRowCell icons with onClick
}
/>
}
/>
}
/>
Default
Data 2
Data 3
TableHeaderRowCell tooltips
Default
Data 2
Data 3
TableHeaderRowCell checkable
Default
Data 2
Data 3
TableCard onClick
Default
Data 2
Data 3
Hover
Data 2
Data 3
Focus
Data 2
Data 3
TableCard popout
Default
Data 2
Data 3
Default popout
Data 2
Data 3
Hover
None
Data 3
Focus
None
Data 3
TableCard well
Default
Data 2
Data 3
Default well
Data 2
Data 3
Hover
None
Data 3
Focus
Well
Data 3
>
),
parameters: {
pseudo: {
hover: [
'[data-sb-pseudo-styles="hover"]',
'[data-sb-pseudo-styles="hover"] button',
'[data-sb-pseudo-styles="hover"] input',
],
focus: [
'[data-sb-pseudo-styles="focus"]',
'[data-sb-pseudo-styles="focus-visible"] button',
'[data-sb-pseudo-styles="focus-visible"] input',
],
focusVisible: [
'[data-sb-pseudo-styles="focus-visible"]',
'[data-sb-pseudo-styles="focus-visible"] button',
'[data-sb-pseudo-styles="focus-visible"] input',
],
},
},
}
export const StickerSheetDefault: StoryObj = {
...TableTemplate,
name: 'Sticker Sheet (Default)',
}
export const StickerSheetRTL: StoryObj = {
...TableTemplate,
name: 'Sticker Sheet (RTL)',
parameters: { ...TableTemplate.parameters, textDirection: 'rtl' },
}
export const StickerSheetReversed: StoryObj = {
...TableTemplate,
name: 'Sticker Sheet (Reversed)',
parameters: {
...TableTemplate.parameters,
backgrounds: { default: 'Purple 700' },
},
args: {
isReversed: true,
},
}