@bundle-stats/ui 4.22.2 → 4.23.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc.js +65 -24
- package/globals.d.ts +13 -0
- package/lib/app/app.js +3 -0
- package/lib/app/app.js.map +1 -1
- package/lib/app/app.module.css +11 -1
- package/lib/components/bundle-modules/index.js.map +1 -1
- package/lib/components/delta/delta.js +3 -13
- package/lib/components/delta/delta.js.map +1 -1
- package/lib/components/delta/delta.module.css +13 -12
- package/lib/components/delta/index.js.map +1 -1
- package/lib/components/index.js +3 -1
- package/lib/components/index.js.map +1 -1
- package/lib/components/insight-icon/insight-icon.module.css +6 -6
- package/lib/components/job-name/job-name.js +1 -2
- package/lib/components/job-name/job-name.js.map +1 -1
- package/lib/components/metric-change-legend/index.js +18 -0
- package/lib/components/metric-change-legend/index.js.map +1 -0
- package/lib/components/metric-change-legend/metric-change-legend.js +91 -0
- package/lib/components/metric-change-legend/metric-change-legend.js.map +1 -0
- package/lib/components/metric-change-legend/metric-change-legend.module.css +69 -0
- package/lib/components/metric-run-info/metric-run-info.js +30 -7
- package/lib/components/metric-run-info/metric-run-info.js.map +1 -1
- package/lib/components/metrics-display-selector/metrics-display-selector.js +7 -9
- package/lib/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib/components/metrics-display-selector/metrics-display-selector.module.css +0 -25
- package/lib/components/metrics-table-header/metrics-table-header.js +8 -8
- package/lib/components/metrics-table-header/metrics-table-header.js.map +1 -1
- package/lib/components/metrics-table-header/metrics-table-header.module.css +8 -12
- package/lib/components/metrics-table-options/metrics-table-options.js +1 -1
- package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib/components/metrics-table-title/metrics-table-title.js +1 -1
- package/lib/components/metrics-table-title/metrics-table-title.js.map +1 -1
- package/lib/components/run-info/run-info.js +26 -14
- package/lib/components/run-info/run-info.js.map +1 -1
- package/lib/components/run-info/run-info.module.css +35 -26
- package/lib/components/summary/summary.js +9 -10
- package/lib/components/summary/summary.js.map +1 -1
- package/lib/components/summary/summary.module.css +60 -10
- package/lib/constants.js +13 -1
- package/lib/constants.js.map +1 -1
- package/lib/css/default.css +1 -1
- package/lib/css/variables.css +71 -58
- package/lib/hooks/rows-sort.js +13 -12
- package/lib/hooks/rows-sort.js.map +1 -1
- package/lib/ui/button/button.js.map +1 -1
- package/lib/ui/dialog/dialog.js +4 -2
- package/lib/ui/dialog/dialog.js.map +1 -1
- package/lib/ui/dialog/dialog.module.css +22 -0
- package/lib/ui/dropdown/dropdown.js +4 -3
- package/lib/ui/dropdown/dropdown.js.map +1 -1
- package/lib/ui/dropdown/dropdown.module.css +11 -0
- package/lib/ui/empty-set/empty-set.js +3 -3
- package/lib/ui/empty-set/empty-set.js.map +1 -1
- package/lib/ui/hover-card/hover-card.js +1 -1
- package/lib/ui/hover-card/hover-card.js.map +1 -1
- package/lib/ui/hover-card/hover-card.module.css +14 -0
- package/lib/ui/table/table.module.css +0 -1
- package/lib/ui/tooltip/tooltip.js +1 -1
- package/lib/ui/tooltip/tooltip.js.map +1 -1
- package/lib/ui/tooltip/tooltip.module.css +11 -0
- package/lib-esm/app/app.js +4 -1
- package/lib-esm/app/app.js.map +1 -1
- package/lib-esm/app/app.module.css +11 -1
- package/lib-esm/components/bundle-modules/index.js.map +1 -1
- package/lib-esm/components/delta/delta.js +3 -13
- package/lib-esm/components/delta/delta.js.map +1 -1
- package/lib-esm/components/delta/delta.module.css +13 -12
- package/lib-esm/components/delta/index.js.map +1 -1
- package/lib-esm/components/index.js +1 -0
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/components/insight-icon/insight-icon.module.css +6 -6
- package/lib-esm/components/job-name/job-name.js +1 -2
- package/lib-esm/components/job-name/job-name.js.map +1 -1
- package/lib-esm/components/metric-change-legend/index.js +2 -0
- package/lib-esm/components/metric-change-legend/index.js.map +1 -0
- package/lib-esm/components/metric-change-legend/metric-change-legend.js +84 -0
- package/lib-esm/components/metric-change-legend/metric-change-legend.js.map +1 -0
- package/lib-esm/components/metric-change-legend/metric-change-legend.module.css +69 -0
- package/lib-esm/components/metric-run-info/metric-run-info.js +31 -8
- package/lib-esm/components/metric-run-info/metric-run-info.js.map +1 -1
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js +7 -9
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.module.css +0 -25
- package/lib-esm/components/metrics-table-header/metrics-table-header.js +8 -8
- package/lib-esm/components/metrics-table-header/metrics-table-header.js.map +1 -1
- package/lib-esm/components/metrics-table-header/metrics-table-header.module.css +8 -12
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +1 -1
- package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +1 -1
- package/lib-esm/components/metrics-table-title/metrics-table-title.js.map +1 -1
- package/lib-esm/components/run-info/run-info.js +26 -14
- package/lib-esm/components/run-info/run-info.js.map +1 -1
- package/lib-esm/components/run-info/run-info.module.css +35 -26
- package/lib-esm/components/summary/summary.js +10 -11
- package/lib-esm/components/summary/summary.js.map +1 -1
- package/lib-esm/components/summary/summary.module.css +60 -10
- package/lib-esm/constants.js +12 -0
- package/lib-esm/constants.js.map +1 -1
- package/lib-esm/css/default.css +1 -1
- package/lib-esm/css/variables.css +71 -58
- package/lib-esm/hooks/rows-sort.js +10 -8
- package/lib-esm/hooks/rows-sort.js.map +1 -1
- package/lib-esm/ui/button/button.js.map +1 -1
- package/lib-esm/ui/dialog/dialog.js +4 -2
- package/lib-esm/ui/dialog/dialog.js.map +1 -1
- package/lib-esm/ui/dialog/dialog.module.css +22 -0
- package/lib-esm/ui/dropdown/dropdown.js +4 -3
- package/lib-esm/ui/dropdown/dropdown.js.map +1 -1
- package/lib-esm/ui/dropdown/dropdown.module.css +11 -0
- package/lib-esm/ui/empty-set/empty-set.js +3 -3
- package/lib-esm/ui/empty-set/empty-set.js.map +1 -1
- package/lib-esm/ui/hover-card/hover-card.js +1 -1
- package/lib-esm/ui/hover-card/hover-card.js.map +1 -1
- package/lib-esm/ui/hover-card/hover-card.module.css +14 -0
- package/lib-esm/ui/table/table.module.css +0 -1
- package/lib-esm/ui/tooltip/tooltip.js +1 -1
- package/lib-esm/ui/tooltip/tooltip.js.map +1 -1
- package/lib-esm/ui/tooltip/tooltip.module.css +11 -0
- package/package.json +26 -15
- package/src/app/app.jsx +6 -1
- package/src/app/app.module.css +11 -1
- package/src/app/app.stories.tsx +2 -2
- package/src/components/asset-info/asset-info.stories.tsx +47 -39
- package/src/components/asset-name/asset-name.stories.tsx +1 -3
- package/src/components/asset-not-predictive/asset-not-predictive.stories.tsx +22 -15
- package/src/components/browsertime-table/browsertime-table.stories.tsx +45 -0
- package/src/components/bundle-assets-totals/bundle-assets-totals.stories.tsx +47 -0
- package/src/components/bundle-modules/bundle-modules.stories.tsx +191 -0
- package/src/components/bundle-modules/bundle-modules.tsx +1 -1
- package/src/components/bundle-modules/index.tsx +4 -0
- package/src/components/bundle-packages/bundle-packages.stories.tsx +87 -0
- package/src/components/delta/delta.module.css +13 -12
- package/src/components/delta/delta.stories.tsx +57 -0
- package/src/components/delta/delta.tsx +32 -0
- package/src/components/entry-info/entry-info.stories.tsx +49 -54
- package/src/components/{index.js → index.ts} +7 -2
- package/src/components/insight-icon/insight-icon.module.css +6 -6
- package/src/components/insights/insights.stories.tsx +36 -33
- package/src/components/job-name/job-name.jsx +2 -3
- package/src/components/job-name/job-name.stories.tsx +46 -0
- package/src/components/jobs-header/jobs-header.stories.tsx +19 -15
- package/src/components/lighthouse-table/lighthouse-table.stories.tsx +30 -0
- package/src/components/metric/metric.stories.tsx +24 -22
- package/src/components/metric-change-legend/index.ts +1 -0
- package/src/components/metric-change-legend/metric-change-legend.module.css +69 -0
- package/src/components/metric-change-legend/metric-change-legend.stories.tsx +13 -0
- package/src/components/metric-change-legend/metric-change-legend.tsx +148 -0
- package/src/components/metric-run-info/metric-run-info.stories.tsx +45 -41
- package/src/components/metric-run-info/metric-run-info.tsx +41 -17
- package/src/components/metrics-display-selector/metrics-display-selector.module.css +0 -25
- package/src/components/metrics-display-selector/metrics-display-selector.tsx +25 -37
- package/src/components/metrics-table/metrics-table.stories.tsx +33 -13
- package/src/components/metrics-table/metrics-table.tsx +1 -1
- package/src/components/metrics-table-header/metrics-table-header.module.css +8 -12
- package/src/components/metrics-table-header/metrics-table-header.tsx +14 -10
- package/src/components/metrics-table-options/metrics-table-options.tsx +1 -1
- package/src/components/metrics-table-title/metrics-table-title.jsx +1 -1
- package/src/components/module-info/module-info.stories.tsx +41 -30
- package/src/components/package-info/package-info.stories.tsx +20 -15
- package/src/components/run-info/run-info.module.css +35 -26
- package/src/components/run-info/run-info.stories.tsx +47 -39
- package/src/components/run-info/run-info.tsx +132 -73
- package/src/components/summary/summary.module.css +60 -10
- package/src/components/summary/summary.stories.tsx +26 -32
- package/src/components/summary/summary.tsx +47 -50
- package/src/constants.ts +13 -0
- package/src/css/default.css +1 -1
- package/src/css/variables.css +71 -58
- package/src/hooks/rows-sort.ts +9 -6
- package/src/layout/box/box.stories.tsx +35 -28
- package/src/layout/flex-stack/flex-stack.stories.tsx +79 -48
- package/src/layout/footer/footer.stories.tsx +30 -0
- package/src/layout/stack/stack.stories.tsx +68 -44
- package/src/ui/alert/alert.stories.tsx +25 -21
- package/src/ui/button/button.stories.tsx +181 -176
- package/src/ui/button/button.tsx +8 -1
- package/src/ui/container/container.stories.tsx +28 -21
- package/src/ui/control-group/control-group.stories.tsx +23 -16
- package/src/ui/dialog/dialog.module.css +22 -0
- package/src/ui/dialog/dialog.tsx +9 -2
- package/src/ui/dropdown/dropdown.module.css +11 -0
- package/src/ui/dropdown/dropdown.stories.tsx +23 -15
- package/src/ui/dropdown/dropdown.tsx +5 -1
- package/src/ui/empty-set/empty-set.jsx +16 -4
- package/src/ui/empty-set/empty-set.stories.tsx +41 -0
- package/src/ui/file-name/file-name.stories.tsx +45 -0
- package/src/ui/filters/filters.stories.tsx +29 -26
- package/src/ui/hover-card/hover-card.module.css +14 -0
- package/src/ui/hover-card/hover-card.stories.tsx +35 -26
- package/src/ui/hover-card/hover-card.tsx +1 -1
- package/src/ui/icon/icon.stories.tsx +36 -28
- package/src/ui/input/input.stories.tsx +17 -5
- package/src/ui/input-search/input-search.stories.tsx +31 -0
- package/src/ui/loader/loader.stories.tsx +22 -0
- package/src/ui/skeleton/skeleton.stories.tsx +42 -0
- package/src/ui/table/table.module.css +0 -1
- package/src/ui/table/table.stories.tsx +244 -218
- package/src/ui/tag/tag.stories.tsx +11 -10
- package/src/ui/toolbar/toolbar.stories.tsx +41 -0
- package/src/ui/tooltip/tooltip.module.css +11 -0
- package/src/ui/tooltip/tooltip.tsx +1 -1
- package/types/components/bundle-modules/bundle-modules.d.ts +1 -1
- package/types/components/bundle-modules/index.d.ts +2 -1
- package/types/components/delta/delta.d.ts +7 -21
- package/types/components/delta/index.d.ts +1 -1
- package/types/components/index.d.ts +25 -20
- package/types/components/metric-change-legend/index.d.ts +1 -0
- package/types/components/metric-change-legend/metric-change-legend.d.ts +4 -0
- package/types/components/metric-run-info/metric-run-info.d.ts +2 -6
- package/types/components/metrics-table/metrics-table.d.ts +1 -1
- package/types/components/metrics-table-header/metrics-table-header.d.ts +1 -1
- package/types/components/run-info/run-info.d.ts +16 -7
- package/types/constants.d.ts +12 -0
- package/types/hooks/rows-sort.d.ts +2 -2
- package/types/ui/button/button.d.ts +1 -1
- package/types/ui/dialog/dialog.d.ts +3 -2
- package/types/ui/dropdown/dropdown.d.ts +1 -0
- package/vitest.config.ts +47 -0
- package/vitest.setup.ts +26 -0
- package/lib/assets/icons.svg.js +0 -100
- package/lib/assets/icons.svg.js.map +0 -1
- package/lib-esm/assets/icons.svg.js +0 -63
- package/lib-esm/assets/icons.svg.js.map +0 -1
- package/src/assets/icons.svg.jsx +0 -279
- package/src/components/delta/delta.jsx +0 -22
- package/types/assets/icons.svg.d.ts +0 -2
- /package/src/components/delta/{index.js → index.ts} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { getWrapperDecorator } from '../../stories';
|
|
5
|
+
import { InputSearch } from '.';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'UI/InputSearch',
|
|
9
|
+
component: InputSearch,
|
|
10
|
+
decorators: [getWrapperDecorator()],
|
|
11
|
+
} satisfies Meta<typeof InputSearch>;
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
|
|
17
|
+
const InputSearchWithState = () => {
|
|
18
|
+
const [search, updateSearch] = useState('');
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div>
|
|
22
|
+
<pre>{JSON.stringify({ search }, null, 2)}</pre>
|
|
23
|
+
<br />
|
|
24
|
+
<InputSearch placeholder="Search by name" defaultValue={search} onChange={updateSearch} />
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Default: Story = {
|
|
30
|
+
render: () => <InputSearchWithState />,
|
|
31
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { getWrapperDecorator } from '../../stories';
|
|
4
|
+
import { Loader } from '.';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'UI/Loader',
|
|
8
|
+
component: Loader,
|
|
9
|
+
decorators: [getWrapperDecorator()],
|
|
10
|
+
} satisfies Meta<typeof Loader>;
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {};
|
|
17
|
+
|
|
18
|
+
export const WithSize: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
size: Loader.SIZE_LARGE,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Skeleton } from '.';
|
|
5
|
+
|
|
6
|
+
// Skeleton is a plain .jsx component with defaultProps instead of inline
|
|
7
|
+
// destructuring defaults, so TS can't infer its props as optional on its own.
|
|
8
|
+
const TypedSkeleton = Skeleton as unknown as React.ComponentType<
|
|
9
|
+
{
|
|
10
|
+
className?: string;
|
|
11
|
+
as?: React.ElementType;
|
|
12
|
+
block?: boolean;
|
|
13
|
+
} & React.HTMLAttributes<HTMLElement>
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
const meta = {
|
|
17
|
+
title: 'UI/Skeleton',
|
|
18
|
+
component: TypedSkeleton,
|
|
19
|
+
} satisfies Meta<typeof TypedSkeleton>;
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const MultipleTextLines: Story = {
|
|
26
|
+
render: () => (
|
|
27
|
+
<>
|
|
28
|
+
<TypedSkeleton as="h1" style={{ outline: '1px solid magenta' }} />
|
|
29
|
+
<TypedSkeleton as="h2" style={{ outline: '1px solid magenta' }} />
|
|
30
|
+
<TypedSkeleton as="p" style={{ outline: '1px solid magenta' }} />
|
|
31
|
+
<TypedSkeleton style={{ outline: '1px solid pink' }} />
|
|
32
|
+
</>
|
|
33
|
+
),
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Block: Story = {
|
|
37
|
+
render: () => (
|
|
38
|
+
<div style={{ outline: '1px solid magenta' }}>
|
|
39
|
+
<TypedSkeleton as="div" block />
|
|
40
|
+
</div>
|
|
41
|
+
),
|
|
42
|
+
};
|
|
@@ -1,238 +1,264 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
3
|
|
|
3
4
|
import { getWrapperDecorator } from '../../stories';
|
|
4
5
|
import { Table } from '.';
|
|
5
6
|
|
|
6
7
|
const { THead, TBody, Td, Tr, Th } = Table;
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
const meta = {
|
|
9
10
|
title: 'UI/Table',
|
|
10
11
|
component: Table,
|
|
11
12
|
decorators: [getWrapperDecorator()],
|
|
13
|
+
} satisfies Meta<typeof Table>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
render: () => (
|
|
21
|
+
<Table>
|
|
22
|
+
<TBody>
|
|
23
|
+
<Tr>
|
|
24
|
+
<Td>a1</Td>
|
|
25
|
+
<Td>b1</Td>
|
|
26
|
+
<Td>c1</Td>
|
|
27
|
+
</Tr>
|
|
28
|
+
<Tr>
|
|
29
|
+
<Td>a2</Td>
|
|
30
|
+
<Td>b2</Td>
|
|
31
|
+
<Td>c2</Td>
|
|
32
|
+
</Tr>
|
|
33
|
+
<Tr>
|
|
34
|
+
<Td>a3</Td>
|
|
35
|
+
<Td>b3</Td>
|
|
36
|
+
<Td>c3</Td>
|
|
37
|
+
</Tr>
|
|
38
|
+
</TBody>
|
|
39
|
+
</Table>
|
|
40
|
+
),
|
|
12
41
|
};
|
|
13
42
|
|
|
14
|
-
export const
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
export const Compact: Story = {
|
|
44
|
+
render: () => (
|
|
45
|
+
<Table compact>
|
|
46
|
+
<TBody>
|
|
47
|
+
<Tr>
|
|
48
|
+
<Td>a1</Td>
|
|
49
|
+
<Td>b1</Td>
|
|
50
|
+
<Td>c1</Td>
|
|
51
|
+
</Tr>
|
|
52
|
+
<Tr>
|
|
53
|
+
<Td>a2</Td>
|
|
54
|
+
<Td>b2</Td>
|
|
55
|
+
<Td>c2</Td>
|
|
56
|
+
</Tr>
|
|
57
|
+
<Tr>
|
|
58
|
+
<Td>a3</Td>
|
|
59
|
+
<Td>b3</Td>
|
|
60
|
+
<Td>c3</Td>
|
|
61
|
+
</Tr>
|
|
62
|
+
</TBody>
|
|
63
|
+
</Table>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
35
66
|
|
|
36
|
-
export const
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
67
|
+
export const Outline: Story = {
|
|
68
|
+
render: () => (
|
|
69
|
+
<Table outline>
|
|
70
|
+
<TBody>
|
|
71
|
+
<Tr>
|
|
72
|
+
<Td>a1</Td>
|
|
73
|
+
<Td>b1</Td>
|
|
74
|
+
<Td>c1</Td>
|
|
75
|
+
</Tr>
|
|
76
|
+
<Tr>
|
|
77
|
+
<Td>a2</Td>
|
|
78
|
+
<Td>b2</Td>
|
|
79
|
+
<Td>c2</Td>
|
|
80
|
+
</Tr>
|
|
81
|
+
<Tr>
|
|
82
|
+
<Td>a3</Td>
|
|
83
|
+
<Td>b3</Td>
|
|
84
|
+
<Td>c3</Td>
|
|
85
|
+
</Tr>
|
|
86
|
+
</TBody>
|
|
87
|
+
</Table>
|
|
88
|
+
),
|
|
89
|
+
};
|
|
57
90
|
|
|
58
|
-
export const
|
|
59
|
-
<Table
|
|
60
|
-
|
|
61
|
-
<Tr>
|
|
62
|
-
<Td>a1</Td>
|
|
63
|
-
<Td>b1</Td>
|
|
64
|
-
<Td>c1</Td>
|
|
65
|
-
</Tr>
|
|
66
|
-
<Tr>
|
|
67
|
-
<Td>a2</Td>
|
|
68
|
-
<Td>b2</Td>
|
|
69
|
-
<Td>c2</Td>
|
|
70
|
-
</Tr>
|
|
71
|
-
<Tr>
|
|
72
|
-
<Td>a3</Td>
|
|
73
|
-
<Td>b3</Td>
|
|
74
|
-
<Td>c3</Td>
|
|
75
|
-
</Tr>
|
|
76
|
-
</TBody>
|
|
77
|
-
</Table>
|
|
78
|
-
);
|
|
91
|
+
export const Empty: Story = {
|
|
92
|
+
render: () => <Table />,
|
|
93
|
+
};
|
|
79
94
|
|
|
80
|
-
export const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)
|
|
95
|
+
export const EmptyWithCustomElement: Story = {
|
|
96
|
+
render: () => (
|
|
97
|
+
<Table emptyMessage={<p style={{ outline: '1px solid lightgray' }}>No items available</p>} />
|
|
98
|
+
),
|
|
99
|
+
};
|
|
84
100
|
|
|
85
|
-
export const WithHeaders =
|
|
86
|
-
|
|
87
|
-
<
|
|
88
|
-
<
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
101
|
+
export const WithHeaders: Story = {
|
|
102
|
+
render: () => (
|
|
103
|
+
<Table>
|
|
104
|
+
<THead>
|
|
105
|
+
<Tr>
|
|
106
|
+
<Th>Col A</Th>
|
|
107
|
+
<Th>Col B</Th>
|
|
108
|
+
<Th>Col C</Th>
|
|
109
|
+
</Tr>
|
|
110
|
+
</THead>
|
|
111
|
+
<TBody>
|
|
112
|
+
<Tr>
|
|
113
|
+
<Td>a1</Td>
|
|
114
|
+
<Td>b1</Td>
|
|
115
|
+
<Td>c1</Td>
|
|
116
|
+
</Tr>
|
|
117
|
+
<Tr>
|
|
118
|
+
<Td>a2</Td>
|
|
119
|
+
<Td>b2</Td>
|
|
120
|
+
<Td>c2</Td>
|
|
121
|
+
</Tr>
|
|
122
|
+
<Tr>
|
|
123
|
+
<Td>a3</Td>
|
|
124
|
+
<Td>b3</Td>
|
|
125
|
+
<Td>c3</Td>
|
|
126
|
+
</Tr>
|
|
127
|
+
</TBody>
|
|
128
|
+
</Table>
|
|
129
|
+
),
|
|
130
|
+
};
|
|
113
131
|
|
|
114
|
-
export const WithHeadersAndOutline =
|
|
115
|
-
|
|
116
|
-
<
|
|
117
|
-
<
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
132
|
+
export const WithHeadersAndOutline: Story = {
|
|
133
|
+
render: () => (
|
|
134
|
+
<Table outline>
|
|
135
|
+
<THead>
|
|
136
|
+
<Tr>
|
|
137
|
+
<Th>Col A</Th>
|
|
138
|
+
<Th>Col B</Th>
|
|
139
|
+
<Th>Col C</Th>
|
|
140
|
+
</Tr>
|
|
141
|
+
</THead>
|
|
142
|
+
<TBody>
|
|
143
|
+
<Tr>
|
|
144
|
+
<Td>a1</Td>
|
|
145
|
+
<Td>b1</Td>
|
|
146
|
+
<Td>c1</Td>
|
|
147
|
+
</Tr>
|
|
148
|
+
<Tr>
|
|
149
|
+
<Td>a2</Td>
|
|
150
|
+
<Td>b2</Td>
|
|
151
|
+
<Td>c2</Td>
|
|
152
|
+
</Tr>
|
|
153
|
+
<Tr>
|
|
154
|
+
<Td>a3</Td>
|
|
155
|
+
<Td>b3</Td>
|
|
156
|
+
<Td>c3</Td>
|
|
157
|
+
</Tr>
|
|
158
|
+
</TBody>
|
|
159
|
+
</Table>
|
|
160
|
+
),
|
|
161
|
+
};
|
|
142
162
|
|
|
143
|
-
export const WithMultipleRowsHeader =
|
|
144
|
-
|
|
145
|
-
<
|
|
146
|
-
<
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
<
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
<
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
163
|
+
export const WithMultipleRowsHeader: Story = {
|
|
164
|
+
render: () => (
|
|
165
|
+
<Table>
|
|
166
|
+
<THead>
|
|
167
|
+
<Tr>
|
|
168
|
+
<Th> </Th>
|
|
169
|
+
<Th colSpan={2}>Colspan</Th>
|
|
170
|
+
</Tr>
|
|
171
|
+
<Tr>
|
|
172
|
+
<Th>Col A</Th>
|
|
173
|
+
<Th>Col B</Th>
|
|
174
|
+
<Th>Col C</Th>
|
|
175
|
+
</Tr>
|
|
176
|
+
</THead>
|
|
177
|
+
<TBody>
|
|
178
|
+
<Tr>
|
|
179
|
+
<Td>a1</Td>
|
|
180
|
+
<Td>b1</Td>
|
|
181
|
+
<Td>c1</Td>
|
|
182
|
+
</Tr>
|
|
183
|
+
<Tr>
|
|
184
|
+
<Td>a2</Td>
|
|
185
|
+
<Td>b2</Td>
|
|
186
|
+
<Td>c2</Td>
|
|
187
|
+
</Tr>
|
|
188
|
+
<Tr>
|
|
189
|
+
<Td>a3</Td>
|
|
190
|
+
<Td>b3</Td>
|
|
191
|
+
<Td>c3</Td>
|
|
192
|
+
</Tr>
|
|
193
|
+
</TBody>
|
|
194
|
+
</Table>
|
|
195
|
+
),
|
|
196
|
+
};
|
|
175
197
|
|
|
176
|
-
export const WithRowHeaders =
|
|
177
|
-
|
|
178
|
-
<
|
|
179
|
-
<
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
<
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
export const WithRowHeaders: Story = {
|
|
199
|
+
render: () => (
|
|
200
|
+
<Table>
|
|
201
|
+
<TBody>
|
|
202
|
+
<Tr>
|
|
203
|
+
<Th>row 1</Th>
|
|
204
|
+
<Td>a1</Td>
|
|
205
|
+
<Td>b1</Td>
|
|
206
|
+
<Td>c1</Td>
|
|
207
|
+
</Tr>
|
|
208
|
+
<Tr>
|
|
209
|
+
<Th>row 2</Th>
|
|
210
|
+
<Td>a2</Td>
|
|
211
|
+
<Td>b2</Td>
|
|
212
|
+
<Td>c2</Td>
|
|
213
|
+
</Tr>
|
|
214
|
+
<Tr>
|
|
215
|
+
<Th>row 3</Th>
|
|
216
|
+
<Td>a3</Td>
|
|
217
|
+
<Td>b3</Td>
|
|
218
|
+
<Td>c3</Td>
|
|
219
|
+
</Tr>
|
|
220
|
+
</TBody>
|
|
221
|
+
</Table>
|
|
222
|
+
),
|
|
223
|
+
};
|
|
200
224
|
|
|
201
|
-
export const WithCustomContentAndAttributes =
|
|
202
|
-
|
|
203
|
-
<
|
|
204
|
-
<
|
|
205
|
-
<
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
<
|
|
213
|
-
<
|
|
214
|
-
<
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
<
|
|
222
|
-
<
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
<
|
|
230
|
-
<
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
225
|
+
export const WithCustomContentAndAttributes: Story = {
|
|
226
|
+
render: () => (
|
|
227
|
+
<Table>
|
|
228
|
+
<THead>
|
|
229
|
+
<Tr>
|
|
230
|
+
<Th> </Th>
|
|
231
|
+
<Th style={{ textAlign: 'right' }}>Col A (right)</Th>
|
|
232
|
+
<Th style={{ textAlign: 'center' }}>Col B (center)</Th>
|
|
233
|
+
<Th style={{ textDecoration: 'underline' }}>Col C(underline)</Th>
|
|
234
|
+
</Tr>
|
|
235
|
+
</THead>
|
|
236
|
+
<TBody>
|
|
237
|
+
<Tr>
|
|
238
|
+
<Th>
|
|
239
|
+
<strong>row 1</strong>
|
|
240
|
+
</Th>
|
|
241
|
+
<Td style={{ textAlign: 'right' }}>a1</Td>
|
|
242
|
+
<Td style={{ textAlign: 'center', color: 'red' }}>b1</Td>
|
|
243
|
+
<Td style={{ textDecoration: 'underline' }}>c1</Td>
|
|
244
|
+
</Tr>
|
|
245
|
+
<Tr style={{ color: 'blue', fontSize: '1.5em' }}>
|
|
246
|
+
<Th>
|
|
247
|
+
<strong>row 2</strong>
|
|
248
|
+
</Th>
|
|
249
|
+
<Td style={{ textAlign: 'right' }}>a2</Td>
|
|
250
|
+
<Td style={{ textAlign: 'center' }}>b2</Td>
|
|
251
|
+
<Td style={{ textDecoration: 'underline' }}>c2</Td>
|
|
252
|
+
</Tr>
|
|
253
|
+
<Tr>
|
|
254
|
+
<Th>
|
|
255
|
+
<strong>row 3</strong>
|
|
256
|
+
</Th>
|
|
257
|
+
<Td style={{ textAlign: 'right' }}>a3</Td>
|
|
258
|
+
<Td style={{ textAlign: 'center' }}>b3</Td>
|
|
259
|
+
<Td style={{ textDecoration: 'underline' }}>c3</Td>
|
|
260
|
+
</Tr>
|
|
261
|
+
</TBody>
|
|
262
|
+
</Table>
|
|
263
|
+
),
|
|
264
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Meta, Story } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
2
|
|
|
4
|
-
import { Tag } from '.';
|
|
3
|
+
import { Tag, TagProps } from '.';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
const meta = {
|
|
7
6
|
title: 'UI/Tag',
|
|
8
7
|
component: Tag,
|
|
9
8
|
argTypes: {
|
|
@@ -19,14 +18,16 @@ export default {
|
|
|
19
18
|
args: {
|
|
20
19
|
children: 'tag',
|
|
21
20
|
},
|
|
22
|
-
}
|
|
21
|
+
} satisfies Meta<TagProps>;
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
export default meta;
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
27
26
|
|
|
28
|
-
export const
|
|
27
|
+
export const Default: Story = {};
|
|
29
28
|
|
|
30
|
-
OneLetter
|
|
31
|
-
|
|
29
|
+
export const OneLetter: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
children: 'd',
|
|
32
|
+
},
|
|
32
33
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { getWrapperDecorator } from '../../stories';
|
|
5
|
+
import { Toolbar } from '.';
|
|
6
|
+
|
|
7
|
+
// Toolbar is a plain .jsx component with defaultProps instead of inline
|
|
8
|
+
// destructuring defaults, so TS can't infer its props as optional on its own.
|
|
9
|
+
const TypedToolbar = Toolbar as unknown as React.ComponentType<{
|
|
10
|
+
className?: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
renderActions?: (params: { actionClassName: string }) => React.ReactNode;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
const meta = {
|
|
16
|
+
title: 'UI/Toolbar',
|
|
17
|
+
component: TypedToolbar,
|
|
18
|
+
decorators: [getWrapperDecorator()],
|
|
19
|
+
} satisfies Meta<typeof TypedToolbar>;
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
children: <div>Content</div>,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const WithActions: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
children: 'Content',
|
|
34
|
+
renderActions: ({ actionClassName }) => (
|
|
35
|
+
<>
|
|
36
|
+
<div className={actionClassName}>Action 1</div>
|
|
37
|
+
<div className={actionClassName}>Action 2</div>
|
|
38
|
+
</>
|
|
39
|
+
),
|
|
40
|
+
},
|
|
41
|
+
};
|