@bundle-stats/ui 4.22.2-beta.1 → 4.22.3
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/components/bundle-modules/index.js.map +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/components/metrics-table-header/metrics-table-header.js +2 -2
- package/lib/components/metrics-table-header/metrics-table-header.js.map +1 -1
- package/lib/css/default.css +1 -1
- 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/empty-set/empty-set.js +3 -3
- package/lib/ui/empty-set/empty-set.js.map +1 -1
- package/lib-esm/components/bundle-modules/index.js.map +1 -1
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/components/metrics-table-header/metrics-table-header.js +2 -2
- package/lib-esm/components/metrics-table-header/metrics-table-header.js.map +1 -1
- package/lib-esm/css/default.css +1 -1
- 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/empty-set/empty-set.js +3 -3
- package/lib-esm/ui/empty-set/empty-set.js.map +1 -1
- package/package.json +26 -15
- 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.stories.tsx +57 -0
- package/src/components/entry-info/entry-info.stories.tsx +49 -54
- package/src/components/{index.js → index.ts} +4 -2
- package/src/components/insights/insights.stories.tsx +36 -33
- 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-run-info/metric-run-info.stories.tsx +45 -41
- 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.tsx +9 -4
- 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.stories.tsx +39 -37
- package/src/components/summary/summary.stories.tsx +26 -32
- package/src/css/default.css +1 -1
- 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/dropdown/dropdown.stories.tsx +23 -15
- 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.stories.tsx +35 -26
- 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.stories.tsx +244 -218
- package/src/ui/tag/tag.stories.tsx +11 -10
- package/src/ui/toolbar/toolbar.stories.tsx +41 -0
- package/types/components/bundle-modules/bundle-modules.d.ts +1 -1
- package/types/components/bundle-modules/index.d.ts +2 -1
- package/types/components/index.d.ts +22 -20
- 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/hooks/rows-sort.d.ts +2 -2
- package/types/ui/button/button.d.ts +1 -1
- 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/types/assets/icons.svg.d.ts +0 -2
|
@@ -1,21 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
2
|
import { action } from 'storybook/actions';
|
|
4
3
|
|
|
5
4
|
import { getWrapperDecorator } from '../../stories';
|
|
6
5
|
import { ModuleInfo } from '.';
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
const ITEM = {
|
|
8
|
+
key: './node_modules/lodash/fp/merge.js',
|
|
9
|
+
label: './node_modules/lodash/fp/merge.js',
|
|
10
|
+
biggerIsBetter: false,
|
|
11
|
+
changed: true,
|
|
12
|
+
thirdParty: true,
|
|
13
|
+
duplicated: true,
|
|
14
|
+
fileType: 'JS',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const meta = {
|
|
9
18
|
title: 'Components/ModuleInfo',
|
|
10
19
|
component: ModuleInfo,
|
|
11
20
|
decorators: [getWrapperDecorator()],
|
|
12
|
-
|
|
21
|
+
args: {
|
|
22
|
+
labels: ['Job #2', 'Job #1'],
|
|
23
|
+
onClose: action('CLOSE'),
|
|
24
|
+
},
|
|
25
|
+
} satisfies Meta<typeof ModuleInfo>;
|
|
13
26
|
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
item: {
|
|
34
|
+
...ITEM,
|
|
19
35
|
runs: [
|
|
20
36
|
{
|
|
21
37
|
name: './node_modules/lodash/fp/merge.js',
|
|
@@ -29,8 +45,8 @@ export const Default = () => (
|
|
|
29
45
|
displayValue: '3KiB',
|
|
30
46
|
},
|
|
31
47
|
] as any,
|
|
32
|
-
}
|
|
33
|
-
chunks
|
|
48
|
+
},
|
|
49
|
+
chunks: [
|
|
34
50
|
{
|
|
35
51
|
id: '1',
|
|
36
52
|
name: 'chunk-1',
|
|
@@ -43,18 +59,15 @@ export const Default = () => (
|
|
|
43
59
|
id: '3',
|
|
44
60
|
name: 'chunk-3',
|
|
45
61
|
},
|
|
46
|
-
]
|
|
47
|
-
chunkIds
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/>
|
|
51
|
-
);
|
|
62
|
+
],
|
|
63
|
+
chunkIds: ['1', '2', '3'],
|
|
64
|
+
},
|
|
65
|
+
};
|
|
52
66
|
|
|
53
|
-
export const Duplicates =
|
|
54
|
-
|
|
55
|
-
item
|
|
56
|
-
|
|
57
|
-
duplicated: true,
|
|
67
|
+
export const Duplicates: Story = {
|
|
68
|
+
args: {
|
|
69
|
+
item: {
|
|
70
|
+
...ITEM,
|
|
58
71
|
runs: [
|
|
59
72
|
{
|
|
60
73
|
name: './node_modules/lodash/fp/merge.js',
|
|
@@ -68,8 +81,8 @@ export const Duplicates = () => (
|
|
|
68
81
|
displayValue: '3KiB',
|
|
69
82
|
},
|
|
70
83
|
] as any,
|
|
71
|
-
}
|
|
72
|
-
chunks
|
|
84
|
+
},
|
|
85
|
+
chunks: [
|
|
73
86
|
{
|
|
74
87
|
id: '1',
|
|
75
88
|
name: 'chunk-1',
|
|
@@ -90,9 +103,7 @@ export const Duplicates = () => (
|
|
|
90
103
|
id: '5',
|
|
91
104
|
name: 'chunk-5',
|
|
92
105
|
},
|
|
93
|
-
]
|
|
94
|
-
chunkIds
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
/>
|
|
98
|
-
);
|
|
106
|
+
],
|
|
107
|
+
chunkIds: ['1', '2', '3', '4', '5'],
|
|
108
|
+
},
|
|
109
|
+
};
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { action } from 'storybook/actions';
|
|
2
3
|
|
|
3
4
|
import { getWrapperDecorator } from '../../stories';
|
|
4
5
|
import { PackageInfo } from '.';
|
|
5
6
|
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Components/PackageInfo',
|
|
8
|
-
component: PackageInfo,
|
|
9
|
-
decorators: [getWrapperDecorator()],
|
|
10
|
-
};
|
|
11
|
-
|
|
12
7
|
const RUNS = [
|
|
13
8
|
{
|
|
14
9
|
name: 'lodash',
|
|
@@ -23,14 +18,24 @@ const RUNS = [
|
|
|
23
18
|
},
|
|
24
19
|
];
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
const meta = {
|
|
22
|
+
title: 'Components/PackageInfo',
|
|
23
|
+
component: PackageInfo,
|
|
24
|
+
decorators: [getWrapperDecorator()],
|
|
25
|
+
} satisfies Meta<typeof PackageInfo>;
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
item: {
|
|
30
34
|
label: 'lodash',
|
|
31
35
|
duplicate: true,
|
|
32
36
|
runs: RUNS as any,
|
|
33
|
-
}
|
|
34
|
-
labels
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
},
|
|
38
|
+
labels: ['Job #2', 'Job #1'],
|
|
39
|
+
onClose: action('CLOSE'),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Meta, Story } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
2
|
|
|
4
3
|
import { RunInfo } from './run-info';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
const meta = {
|
|
7
6
|
title: 'Components/RunInfo',
|
|
8
7
|
component: RunInfo,
|
|
9
8
|
args: {
|
|
9
|
+
id: 'webpack.totalSizeByTypeALL',
|
|
10
10
|
size: 'medium',
|
|
11
11
|
},
|
|
12
12
|
argTypes: {
|
|
@@ -15,51 +15,53 @@ export default {
|
|
|
15
15
|
control: { type: 'select' },
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
|
-
}
|
|
18
|
+
} satisfies Meta<typeof RunInfo>;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
export default meta;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
23
23
|
|
|
24
|
-
Default
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
title: 'Bundle Size',
|
|
27
|
+
current: '120KiB',
|
|
28
|
+
baseline: '100KiB',
|
|
29
|
+
delta: '+20%',
|
|
30
|
+
deltaType: 'HIGH_NEGATIVE',
|
|
31
|
+
},
|
|
30
32
|
};
|
|
31
33
|
|
|
32
|
-
export const DeltaPercentage =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
export const DeltaPercentage: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
...Default.args,
|
|
37
|
+
deltaPercentage: '+20KiB',
|
|
38
|
+
},
|
|
37
39
|
};
|
|
38
40
|
|
|
39
|
-
export const SizeLarge =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
export const SizeLarge: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
...Default.args,
|
|
44
|
+
size: 'large',
|
|
45
|
+
},
|
|
44
46
|
};
|
|
45
47
|
|
|
46
|
-
export const TitleHoverCard =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
export const TitleHoverCard: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
...Default.args,
|
|
51
|
+
titleHoverCard: 'Info',
|
|
52
|
+
},
|
|
51
53
|
};
|
|
52
54
|
|
|
53
|
-
export const TitleTooltip =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
export const TitleTooltip: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
...Default.args,
|
|
58
|
+
titleTooltip: 'Info',
|
|
59
|
+
},
|
|
58
60
|
};
|
|
59
61
|
|
|
60
|
-
export const Loading =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
export const Loading: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
title: 'Bundle Size',
|
|
65
|
+
loading: true,
|
|
66
|
+
},
|
|
65
67
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Meta,
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import { createJobs } from '@bundle-stats/utils';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable import/no-relative-packages */
|
|
6
6
|
import baselineData from '../../../../../fixtures/webpack-stats.baseline.json';
|
|
7
7
|
import currentData from '../../../../../fixtures/webpack-stats.current.json';
|
|
8
8
|
/* eslint-enable import/no-relative-packages */
|
|
9
|
-
import { METRICS_WEBPACK_ASSETS } from '../../constants';
|
|
10
9
|
import { getWrapperDecorator } from '../../stories';
|
|
11
10
|
import { Summary } from '.';
|
|
12
11
|
|
|
@@ -14,46 +13,41 @@ const MULTIPLE_JOBS = createJobs([{ webpack: currentData }, { webpack: baselineD
|
|
|
14
13
|
|
|
15
14
|
const SINGLE_JOB = createJobs([{ webpack: currentData }]);
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
const meta = {
|
|
18
17
|
title: 'Components/Summary',
|
|
19
18
|
component: Summary,
|
|
20
19
|
decorators: [getWrapperDecorator()],
|
|
21
|
-
}
|
|
20
|
+
} satisfies Meta<typeof Summary>;
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
export default meta;
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
26
25
|
|
|
27
|
-
Default
|
|
28
|
-
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
data: MULTIPLE_JOBS[0].summary!.webpack,
|
|
29
|
+
},
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
export const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
data: MULTIPLE_JOBS[0].summary,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const Loading = Template.bind({});
|
|
39
|
-
|
|
40
|
-
Loading.args = {
|
|
41
|
-
loading: true,
|
|
32
|
+
export const Loading: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
loading: true,
|
|
35
|
+
},
|
|
42
36
|
};
|
|
43
37
|
|
|
44
|
-
export const SingleRun =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
export const SingleRun: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
data: SINGLE_JOB[0].summary!.webpack,
|
|
41
|
+
showSummaryItemDelta: false,
|
|
42
|
+
showSummaryItemBaseline: false,
|
|
43
|
+
},
|
|
50
44
|
};
|
|
51
45
|
|
|
52
|
-
export const WithLink =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
export const WithLink: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
data: MULTIPLE_JOBS[0].summary!.webpack,
|
|
49
|
+
summaryItemLink: (linkProps) => (
|
|
50
|
+
<button {...linkProps} type="button" onClick={() => alert(JSON.stringify(linkProps))} />
|
|
51
|
+
),
|
|
52
|
+
},
|
|
59
53
|
};
|
package/src/css/default.css
CHANGED
package/src/hooks/rows-sort.ts
CHANGED
|
@@ -20,15 +20,18 @@ const getSortDirection = (directionParam: string | undefined): SortAction['direc
|
|
|
20
20
|
return '';
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
export function getSortFn<TRow>(
|
|
24
|
+
fieldPath: string,
|
|
25
|
+
getCustomSort: UseRowsSortParams<TRow>['getCustomSort'],
|
|
26
|
+
) {
|
|
27
|
+
return (item: TRow) => {
|
|
26
28
|
if (!fieldPath) {
|
|
27
29
|
return getCustomSort(item);
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
return get(item, fieldPath) || 0;
|
|
31
33
|
};
|
|
34
|
+
}
|
|
32
35
|
|
|
33
36
|
interface UseRowsSortParams<TRow> {
|
|
34
37
|
rows: Array<TRow>;
|
|
@@ -47,13 +50,13 @@ interface UseRowsSort<TRow> {
|
|
|
47
50
|
updateSort: (params: SortAction) => void;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
|
-
export
|
|
53
|
+
export function useRowsSort<TRow>({
|
|
51
54
|
rows,
|
|
52
55
|
initialField = 'runs[0].delta',
|
|
53
56
|
initialDirection = 'desc',
|
|
54
57
|
getCustomSort,
|
|
55
58
|
setQueryState,
|
|
56
|
-
}: UseRowsSortParams<TRow>): UseRowsSort<TRow>
|
|
59
|
+
}: UseRowsSortParams<TRow>): UseRowsSort<TRow> {
|
|
57
60
|
const [sort, setSort] = useState({
|
|
58
61
|
field: initialField,
|
|
59
62
|
direction: getSortDirection(initialDirection),
|
|
@@ -85,4 +88,4 @@ export const useRowsSort = <TRow>({
|
|
|
85
88
|
updateSort,
|
|
86
89
|
items: orderedRows,
|
|
87
90
|
};
|
|
88
|
-
}
|
|
91
|
+
}
|
|
@@ -1,49 +1,56 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { Meta, Story } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
2
|
|
|
4
3
|
import { getWrapperDecorator } from '../../stories';
|
|
5
4
|
import { Box } from '.';
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
const meta = {
|
|
8
7
|
title: 'Layout/Box',
|
|
9
8
|
component: Box,
|
|
10
9
|
decorators: [getWrapperDecorator()],
|
|
11
|
-
|
|
10
|
+
args: {
|
|
11
|
+
style: { border: '1px dotted magenta' },
|
|
12
|
+
children: 'Lorem ipsum',
|
|
13
|
+
},
|
|
14
|
+
} satisfies Meta<typeof Box>;
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
<Box style={{ border: '1px dotted magenta' }} {...props}>
|
|
15
|
-
Lorem ipsum
|
|
16
|
-
</Box>
|
|
17
|
-
);
|
|
16
|
+
export default meta;
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
20
19
|
|
|
21
|
-
export const
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
export const Default: Story = {};
|
|
21
|
+
|
|
22
|
+
export const WithPadding: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
padding: 'medium',
|
|
25
|
+
},
|
|
24
26
|
};
|
|
25
27
|
|
|
26
|
-
export const WithHorizontalPadding =
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
export const WithHorizontalPadding: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
horizontalPadding: 'medium',
|
|
31
|
+
},
|
|
29
32
|
};
|
|
30
33
|
|
|
31
|
-
export const WithVerticalPadding =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
export const WithVerticalPadding: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
verticalPadding: 'medium',
|
|
37
|
+
},
|
|
34
38
|
};
|
|
35
39
|
|
|
36
|
-
export const WithHorizontalAndVerticalPadding =
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
export const WithHorizontalAndVerticalPadding: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
padding: ['xxsmall', 'medium'],
|
|
43
|
+
},
|
|
39
44
|
};
|
|
40
45
|
|
|
41
|
-
export const WithOutline =
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
export const WithOutline: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
outline: true,
|
|
49
|
+
},
|
|
44
50
|
};
|
|
45
51
|
|
|
46
|
-
export const WithOutlineHover =
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
export const WithOutlineHover: Story = {
|
|
53
|
+
args: {
|
|
54
|
+
outlineHover: true,
|
|
55
|
+
},
|
|
49
56
|
};
|
|
@@ -1,59 +1,90 @@
|
|
|
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 { Box } from '../box';
|
|
5
6
|
import { FlexStack } from '.';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
const meta = {
|
|
8
9
|
title: 'Layout/FlexStack',
|
|
9
10
|
component: FlexStack,
|
|
10
11
|
decorators: [getWrapperDecorator()],
|
|
12
|
+
} satisfies Meta<typeof FlexStack>;
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
children: (
|
|
21
|
+
<>
|
|
22
|
+
<Box outline>Lorem ipsum 1</Box>
|
|
23
|
+
<Box outline>Lorem ipsum 2</Box>
|
|
24
|
+
{null}
|
|
25
|
+
Lorem ipsum 3
|
|
26
|
+
</>
|
|
27
|
+
),
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const withCustomWrapper: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
as: 'main',
|
|
34
|
+
className: 'wrapper',
|
|
35
|
+
children: (
|
|
36
|
+
<>
|
|
37
|
+
<Box outline>Lorem ipsum 1</Box>
|
|
38
|
+
<Box outline>Lorem ipsum 2</Box>
|
|
39
|
+
</>
|
|
40
|
+
),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const withLargeSpace: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
space: 'large',
|
|
47
|
+
children: (
|
|
48
|
+
<>
|
|
49
|
+
<Box outline>Lorem ipsum 1</Box>
|
|
50
|
+
<Box outline>Lorem ipsum 2</Box>
|
|
51
|
+
<Box outline>Lorem ipsum 3</Box>
|
|
52
|
+
</>
|
|
53
|
+
),
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const withNestedStack: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
space: 'large',
|
|
60
|
+
children: (
|
|
61
|
+
<>
|
|
62
|
+
<Box outline>Lorem ipsum 1</Box>
|
|
63
|
+
<Box outline>Lorem ipsum 2</Box>
|
|
64
|
+
<FlexStack space="small">
|
|
65
|
+
<Box outline>Lorem ipsum 3.1</Box>
|
|
66
|
+
<Box outline>Lorem ipsum 3.2</Box>
|
|
67
|
+
</FlexStack>
|
|
68
|
+
</>
|
|
69
|
+
),
|
|
70
|
+
},
|
|
11
71
|
};
|
|
12
72
|
|
|
13
|
-
export const
|
|
14
|
-
|
|
15
|
-
<Box outline>Lorem ipsum
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<Box outline>Lorem ipsum 1</Box>
|
|
32
|
-
<Box outline>Lorem ipsum 2</Box>
|
|
33
|
-
<Box outline>Lorem ipsum 3</Box>
|
|
34
|
-
</FlexStack>
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
export const withNestedStack = () => (
|
|
38
|
-
<FlexStack space="large">
|
|
39
|
-
<Box outline>Lorem ipsum 1</Box>
|
|
40
|
-
<Box outline>Lorem ipsum 2</Box>
|
|
41
|
-
<FlexStack space="small">
|
|
42
|
-
<Box outline>Lorem ipsum 3.1</Box>
|
|
43
|
-
<Box outline>Lorem ipsum 3.2</Box>
|
|
44
|
-
</FlexStack>
|
|
45
|
-
</FlexStack>
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
export const singleItem = () => (
|
|
49
|
-
<FlexStack>
|
|
50
|
-
<Box outline>Lorem ipsum</Box>
|
|
51
|
-
</FlexStack>
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
export const withAlignItems = () => (
|
|
55
|
-
<FlexStack alignItems="center" space="medium">
|
|
56
|
-
<h1>Title</h1>
|
|
57
|
-
<a href="#test">Option 1</a>
|
|
58
|
-
</FlexStack>
|
|
59
|
-
);
|
|
73
|
+
export const singleItem: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
children: <Box outline>Lorem ipsum</Box>,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const withAlignItems: Story = {
|
|
80
|
+
args: {
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
space: 'medium',
|
|
83
|
+
children: (
|
|
84
|
+
<>
|
|
85
|
+
<h1>Title</h1>
|
|
86
|
+
<a href="#test">Option 1</a>
|
|
87
|
+
</>
|
|
88
|
+
),
|
|
89
|
+
},
|
|
90
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { getWrapperDecorator } from '../../stories';
|
|
5
|
+
import { Footer } from '.';
|
|
6
|
+
|
|
7
|
+
// Footer 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 TypedFooter = Footer as unknown as React.ComponentType<{
|
|
10
|
+
className?: string;
|
|
11
|
+
version?: string;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
const meta = {
|
|
15
|
+
title: 'Layout/Footer',
|
|
16
|
+
component: TypedFooter,
|
|
17
|
+
decorators: [getWrapperDecorator()],
|
|
18
|
+
} satisfies Meta<typeof TypedFooter>;
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {};
|
|
25
|
+
|
|
26
|
+
export const WithVersion: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
version: '1.0.0',
|
|
29
|
+
},
|
|
30
|
+
};
|