@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.
Files changed (89) hide show
  1. package/.babelrc.js +65 -24
  2. package/globals.d.ts +13 -0
  3. package/lib/components/bundle-modules/index.js.map +1 -1
  4. package/lib/components/index.js.map +1 -1
  5. package/lib/components/metrics-table-header/metrics-table-header.js +2 -2
  6. package/lib/components/metrics-table-header/metrics-table-header.js.map +1 -1
  7. package/lib/css/default.css +1 -1
  8. package/lib/hooks/rows-sort.js +13 -12
  9. package/lib/hooks/rows-sort.js.map +1 -1
  10. package/lib/ui/button/button.js.map +1 -1
  11. package/lib/ui/empty-set/empty-set.js +3 -3
  12. package/lib/ui/empty-set/empty-set.js.map +1 -1
  13. package/lib-esm/components/bundle-modules/index.js.map +1 -1
  14. package/lib-esm/components/index.js.map +1 -1
  15. package/lib-esm/components/metrics-table-header/metrics-table-header.js +2 -2
  16. package/lib-esm/components/metrics-table-header/metrics-table-header.js.map +1 -1
  17. package/lib-esm/css/default.css +1 -1
  18. package/lib-esm/hooks/rows-sort.js +10 -8
  19. package/lib-esm/hooks/rows-sort.js.map +1 -1
  20. package/lib-esm/ui/button/button.js.map +1 -1
  21. package/lib-esm/ui/empty-set/empty-set.js +3 -3
  22. package/lib-esm/ui/empty-set/empty-set.js.map +1 -1
  23. package/package.json +26 -15
  24. package/src/app/app.stories.tsx +2 -2
  25. package/src/components/asset-info/asset-info.stories.tsx +47 -39
  26. package/src/components/asset-name/asset-name.stories.tsx +1 -3
  27. package/src/components/asset-not-predictive/asset-not-predictive.stories.tsx +22 -15
  28. package/src/components/browsertime-table/browsertime-table.stories.tsx +45 -0
  29. package/src/components/bundle-assets-totals/bundle-assets-totals.stories.tsx +47 -0
  30. package/src/components/bundle-modules/bundle-modules.stories.tsx +191 -0
  31. package/src/components/bundle-modules/bundle-modules.tsx +1 -1
  32. package/src/components/bundle-modules/index.tsx +4 -0
  33. package/src/components/bundle-packages/bundle-packages.stories.tsx +87 -0
  34. package/src/components/delta/delta.stories.tsx +57 -0
  35. package/src/components/entry-info/entry-info.stories.tsx +49 -54
  36. package/src/components/{index.js → index.ts} +4 -2
  37. package/src/components/insights/insights.stories.tsx +36 -33
  38. package/src/components/job-name/job-name.stories.tsx +46 -0
  39. package/src/components/jobs-header/jobs-header.stories.tsx +19 -15
  40. package/src/components/lighthouse-table/lighthouse-table.stories.tsx +30 -0
  41. package/src/components/metric/metric.stories.tsx +24 -22
  42. package/src/components/metric-run-info/metric-run-info.stories.tsx +45 -41
  43. package/src/components/metrics-table/metrics-table.stories.tsx +33 -13
  44. package/src/components/metrics-table/metrics-table.tsx +1 -1
  45. package/src/components/metrics-table-header/metrics-table-header.tsx +9 -4
  46. package/src/components/module-info/module-info.stories.tsx +41 -30
  47. package/src/components/package-info/package-info.stories.tsx +20 -15
  48. package/src/components/run-info/run-info.stories.tsx +39 -37
  49. package/src/components/summary/summary.stories.tsx +26 -32
  50. package/src/css/default.css +1 -1
  51. package/src/hooks/rows-sort.ts +9 -6
  52. package/src/layout/box/box.stories.tsx +35 -28
  53. package/src/layout/flex-stack/flex-stack.stories.tsx +79 -48
  54. package/src/layout/footer/footer.stories.tsx +30 -0
  55. package/src/layout/stack/stack.stories.tsx +68 -44
  56. package/src/ui/alert/alert.stories.tsx +25 -21
  57. package/src/ui/button/button.stories.tsx +181 -176
  58. package/src/ui/button/button.tsx +8 -1
  59. package/src/ui/container/container.stories.tsx +28 -21
  60. package/src/ui/control-group/control-group.stories.tsx +23 -16
  61. package/src/ui/dropdown/dropdown.stories.tsx +23 -15
  62. package/src/ui/empty-set/empty-set.jsx +16 -4
  63. package/src/ui/empty-set/empty-set.stories.tsx +41 -0
  64. package/src/ui/file-name/file-name.stories.tsx +45 -0
  65. package/src/ui/filters/filters.stories.tsx +29 -26
  66. package/src/ui/hover-card/hover-card.stories.tsx +35 -26
  67. package/src/ui/icon/icon.stories.tsx +36 -28
  68. package/src/ui/input/input.stories.tsx +17 -5
  69. package/src/ui/input-search/input-search.stories.tsx +31 -0
  70. package/src/ui/loader/loader.stories.tsx +22 -0
  71. package/src/ui/skeleton/skeleton.stories.tsx +42 -0
  72. package/src/ui/table/table.stories.tsx +244 -218
  73. package/src/ui/tag/tag.stories.tsx +11 -10
  74. package/src/ui/toolbar/toolbar.stories.tsx +41 -0
  75. package/types/components/bundle-modules/bundle-modules.d.ts +1 -1
  76. package/types/components/bundle-modules/index.d.ts +2 -1
  77. package/types/components/index.d.ts +22 -20
  78. package/types/components/metrics-table/metrics-table.d.ts +1 -1
  79. package/types/components/metrics-table-header/metrics-table-header.d.ts +1 -1
  80. package/types/hooks/rows-sort.d.ts +2 -2
  81. package/types/ui/button/button.d.ts +1 -1
  82. package/vitest.config.ts +47 -0
  83. package/vitest.setup.ts +26 -0
  84. package/lib/assets/icons.svg.js +0 -100
  85. package/lib/assets/icons.svg.js.map +0 -1
  86. package/lib-esm/assets/icons.svg.js +0 -63
  87. package/lib-esm/assets/icons.svg.js.map +0 -1
  88. package/src/assets/icons.svg.jsx +0 -279
  89. package/types/assets/icons.svg.d.ts +0 -2
@@ -1,21 +1,37 @@
1
- import React from 'react';
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
- export default {
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 const Default = () => (
15
- <ModuleInfo
16
- item={{
17
- label: './node_modules/lodash/fp/merge.js',
18
- duplicated: true,
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={['1', '2', '3']}
48
- labels={['Job #2', 'Job #1']}
49
- onClose={action('CLOSE')}
50
- />
51
- );
62
+ ],
63
+ chunkIds: ['1', '2', '3'],
64
+ },
65
+ };
52
66
 
53
- export const Duplicates = () => (
54
- <ModuleInfo
55
- item={{
56
- label: './node_modules/lodash/fp/merge.js',
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={['1', '2', '3', '4', '5']}
95
- labels={['Job #2', 'Job #1']}
96
- onClose={action('CLOSE')}
97
- />
98
- );
106
+ ],
107
+ chunkIds: ['1', '2', '3', '4', '5'],
108
+ },
109
+ };
@@ -1,14 +1,9 @@
1
- import React from 'react';
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
- export const Default = () => (
27
- <PackageInfo
28
- name="lodash~1"
29
- item={{
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={['Job #2', 'Job #1']}
35
- />
36
- );
37
+ },
38
+ labels: ['Job #2', 'Job #1'],
39
+ onClose: action('CLOSE'),
40
+ },
41
+ };
@@ -1,12 +1,12 @@
1
- import React from 'react';
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
- export default {
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
- } as Meta;
18
+ } satisfies Meta<typeof RunInfo>;
19
19
 
20
- const Template: Story = (args) => <RunInfo id="webpack.totalSizeByTypeALL" {...args} />;
20
+ export default meta;
21
21
 
22
- export const Default = Template.bind({});
22
+ type Story = StoryObj<typeof meta>;
23
23
 
24
- Default.args = {
25
- title: 'Bundle Size',
26
- current: '120KiB',
27
- baseline: '100KiB',
28
- delta: '+20%',
29
- deltaType: 'HIGH_NEGATIVE',
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 = Template.bind({});
33
-
34
- DeltaPercentage.args = {
35
- ...Default.args,
36
- deltaPercentage: '+20KiB',
34
+ export const DeltaPercentage: Story = {
35
+ args: {
36
+ ...Default.args,
37
+ deltaPercentage: '+20KiB',
38
+ },
37
39
  };
38
40
 
39
- export const SizeLarge = Template.bind({});
40
-
41
- SizeLarge.args = {
42
- ...Default.args,
43
- size: 'large',
41
+ export const SizeLarge: Story = {
42
+ args: {
43
+ ...Default.args,
44
+ size: 'large',
45
+ },
44
46
  };
45
47
 
46
- export const TitleHoverCard = Template.bind({});
47
-
48
- TitleHoverCard.args = {
49
- ...Default.args,
50
- titleHoverCard: 'Info',
48
+ export const TitleHoverCard: Story = {
49
+ args: {
50
+ ...Default.args,
51
+ titleHoverCard: 'Info',
52
+ },
51
53
  };
52
54
 
53
- export const TitleTooltip = Template.bind({});
54
-
55
- TitleTooltip.args = {
56
- ...Default.args,
57
- titleTooltip: 'Info',
55
+ export const TitleTooltip: Story = {
56
+ args: {
57
+ ...Default.args,
58
+ titleTooltip: 'Info',
59
+ },
58
60
  };
59
61
 
60
- export const Loading = Template.bind({});
61
-
62
- Loading.args = {
63
- title: 'Bundle Size',
64
- loading: true,
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, Story } from '@storybook/react';
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
- export default {
16
+ const meta = {
18
17
  title: 'Components/Summary',
19
18
  component: Summary,
20
19
  decorators: [getWrapperDecorator()],
21
- } as Meta;
20
+ } satisfies Meta<typeof Summary>;
22
21
 
23
- const Template: Story = (args) => <Summary {...args} />;
22
+ export default meta;
24
23
 
25
- export const Default = Template.bind({});
24
+ type Story = StoryObj<typeof meta>;
26
25
 
27
- Default.args = {
28
- data: MULTIPLE_JOBS[0].summary,
26
+ export const Default: Story = {
27
+ args: {
28
+ data: MULTIPLE_JOBS[0].summary!.webpack,
29
+ },
29
30
  };
30
31
 
31
- export const CustomKeys = Template.bind({});
32
-
33
- CustomKeys.args = {
34
- keys: METRICS_WEBPACK_ASSETS,
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 = Template.bind({});
45
-
46
- SingleRun.args = {
47
- data: SINGLE_JOB[0].summary,
48
- showSummaryItemDelta: false,
49
- showSummaryItemBaseline: false,
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 = Template.bind({});
53
-
54
- WithLink.args = {
55
- data: MULTIPLE_JOBS[0].summary,
56
- summaryItemLink: (linkProps: React.ComponentProps<'button'>) => (
57
- <button {...linkProps} type="button" onClick={() => alert(JSON.stringify(linkProps))} />
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
  };
@@ -1,4 +1,4 @@
1
- @import url('~modern-css-reset/dist/reset.css');
1
+ @import url('modern-css-reset/dist/reset.css');
2
2
 
3
3
  /** modern-css-reset updates */
4
4
  pre,
@@ -20,15 +20,18 @@ const getSortDirection = (directionParam: string | undefined): SortAction['direc
20
20
  return '';
21
21
  };
22
22
 
23
- export const getSortFn =
24
- <TRow>(fieldPath: string, getCustomSort: UseRowsSortParams<TRow>['getCustomSort']) =>
25
- (item: TRow) => {
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 const useRowsSort = <TRow>({
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 React from 'react';
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
- export default {
6
+ const meta = {
8
7
  title: 'Layout/Box',
9
8
  component: Box,
10
9
  decorators: [getWrapperDecorator()],
11
- } as Meta<typeof Box>;
10
+ args: {
11
+ style: { border: '1px dotted magenta' },
12
+ children: 'Lorem ipsum',
13
+ },
14
+ } satisfies Meta<typeof Box>;
12
15
 
13
- const Template: Story = (props: any) => (
14
- <Box style={{ border: '1px dotted magenta' }} {...props}>
15
- Lorem ipsum
16
- </Box>
17
- );
16
+ export default meta;
18
17
 
19
- export const Default = Template.bind({});
18
+ type Story = StoryObj<typeof meta>;
20
19
 
21
- export const WithPadding = Template.bind({});
22
- WithPadding.args = {
23
- padding: 'medium',
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 = Template.bind({});
27
- WithHorizontalPadding.args = {
28
- horizontalPadding: 'medium',
28
+ export const WithHorizontalPadding: Story = {
29
+ args: {
30
+ horizontalPadding: 'medium',
31
+ },
29
32
  };
30
33
 
31
- export const WithVerticalPadding = Template.bind({});
32
- WithVerticalPadding.args = {
33
- verticalPadding: 'medium',
34
+ export const WithVerticalPadding: Story = {
35
+ args: {
36
+ verticalPadding: 'medium',
37
+ },
34
38
  };
35
39
 
36
- export const WithHorizontalAndVerticalPadding = Template.bind({});
37
- WithHorizontalAndVerticalPadding.args = {
38
- padding: ['xxsmall', 'medium'],
40
+ export const WithHorizontalAndVerticalPadding: Story = {
41
+ args: {
42
+ padding: ['xxsmall', 'medium'],
43
+ },
39
44
  };
40
45
 
41
- export const WithOutline = Template.bind({});
42
- WithOutline.args = {
43
- outline: true,
46
+ export const WithOutline: Story = {
47
+ args: {
48
+ outline: true,
49
+ },
44
50
  };
45
51
 
46
- export const WithOutlineHover = Template.bind({});
47
- WithOutlineHover.args = {
48
- outlineHover: true,
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
- export default {
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 Default = () => (
14
- <FlexStack>
15
- <Box outline>Lorem ipsum 1</Box>
16
- <Box outline>Lorem ipsum 2</Box>
17
- {null}
18
- Lorem ipsum 3
19
- </FlexStack>
20
- );
21
-
22
- export const withCustomWrapper = () => (
23
- <FlexStack as="main" className="wrapper">
24
- <Box outline>Lorem ipsum 1</Box>
25
- <Box outline>Lorem ipsum 2</Box>
26
- </FlexStack>
27
- );
28
-
29
- export const withLargeSpace = () => (
30
- <FlexStack space="large">
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
+ };