@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,53 +1,77 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Meta } from '@storybook/react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
|
|
4
4
|
import { getWrapperDecorator } from '../../stories';
|
|
5
5
|
import { Box } from '../box';
|
|
6
6
|
import { Stack } from '.';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const meta = {
|
|
9
9
|
title: 'Layout/Stack',
|
|
10
10
|
component: Stack,
|
|
11
11
|
decorators: [getWrapperDecorator()],
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
)
|
|
12
|
+
} satisfies Meta<typeof Stack>;
|
|
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 WithSpace: 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 WithNestedStacks: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
space: 'large',
|
|
60
|
+
children: (
|
|
61
|
+
<>
|
|
62
|
+
<Box outline>Lorem ipsum 1</Box>
|
|
63
|
+
<Box outline>Lorem ipsum 2</Box>
|
|
64
|
+
<Stack space="small">
|
|
65
|
+
<Box outline>Lorem ipsum 3.1</Box>
|
|
66
|
+
<Box outline>Lorem ipsum 3.2</Box>
|
|
67
|
+
</Stack>
|
|
68
|
+
</>
|
|
69
|
+
),
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const WithSingleItem: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
children: <Box outline>Lorem ipsum</Box>,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
@@ -1,39 +1,43 @@
|
|
|
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 { Alert } from '.';
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
const meta = {
|
|
8
7
|
title: 'UI/Alert',
|
|
9
8
|
component: Alert,
|
|
10
9
|
decorators: [getWrapperDecorator()],
|
|
11
|
-
|
|
10
|
+
args: {
|
|
11
|
+
children: 'Lorem ipsum',
|
|
12
|
+
},
|
|
13
|
+
} satisfies Meta<typeof Alert>;
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
export default meta;
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
16
18
|
|
|
17
|
-
export const
|
|
19
|
+
export const Default: Story = {};
|
|
18
20
|
|
|
19
|
-
WithKindSuccess
|
|
20
|
-
|
|
21
|
+
export const WithKindSuccess: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
kind: 'success',
|
|
24
|
+
},
|
|
21
25
|
};
|
|
22
26
|
|
|
23
|
-
export const WithKindInfo =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
export const WithKindInfo: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
kind: 'info',
|
|
30
|
+
},
|
|
27
31
|
};
|
|
28
32
|
|
|
29
|
-
export const WithKindWarning =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
export const WithKindWarning: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
kind: 'warning',
|
|
36
|
+
},
|
|
33
37
|
};
|
|
34
38
|
|
|
35
|
-
export const WithKindDanger =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
export const WithKindDanger: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
kind: 'danger',
|
|
42
|
+
},
|
|
39
43
|
};
|
|
@@ -1,234 +1,239 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Meta,
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
|
|
4
4
|
import { Stack } from '../../layout/stack';
|
|
5
5
|
import { FlexStack } from '../../layout/flex-stack';
|
|
6
6
|
import { Icon } from '../icon';
|
|
7
7
|
import { Button, BUTTON_SIZE, BUTTON_KIND } from '.';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const meta = {
|
|
10
10
|
title: 'UI/Button',
|
|
11
11
|
component: Button,
|
|
12
|
-
|
|
12
|
+
args: {
|
|
13
|
+
children: 'Action',
|
|
14
|
+
},
|
|
15
|
+
} satisfies Meta<typeof Button>;
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
17
20
|
|
|
18
|
-
const Items = (props) => (
|
|
21
|
+
const Items = (props: React.ComponentProps<typeof FlexStack>) => (
|
|
19
22
|
<FlexStack alignItems="top" style={{ flexWrap: 'wrap', gap: '12px' }} {...props} />
|
|
20
23
|
);
|
|
21
24
|
|
|
22
|
-
export const Default =
|
|
25
|
+
export const Default: Story = {};
|
|
23
26
|
|
|
24
|
-
export const All =
|
|
25
|
-
|
|
26
|
-
<Stack space="
|
|
27
|
-
<h2>Size</h2>
|
|
28
|
-
<Items>
|
|
29
|
-
{Object.values(BUTTON_SIZE).map((size) => (
|
|
30
|
-
<Button size={size} key={size}>
|
|
31
|
-
Action {size}
|
|
32
|
-
</Button>
|
|
33
|
-
))}
|
|
34
|
-
</Items>
|
|
35
|
-
</Stack>
|
|
36
|
-
<Stack space="medium">
|
|
37
|
-
<h2>Kind</h2>
|
|
27
|
+
export const All: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<Stack space="large">
|
|
38
30
|
<Stack space="medium">
|
|
31
|
+
<h2>Size</h2>
|
|
39
32
|
<Items>
|
|
40
|
-
{Object.values(
|
|
41
|
-
<Button
|
|
42
|
-
Action {
|
|
43
|
-
</Button>
|
|
44
|
-
))}
|
|
45
|
-
</Items>
|
|
46
|
-
<h3>Active</h3>
|
|
47
|
-
<Items>
|
|
48
|
-
{Object.values(BUTTON_KIND).map((kind) => (
|
|
49
|
-
<Button kind={kind} key={kind} active>
|
|
50
|
-
Action {kind}
|
|
51
|
-
</Button>
|
|
52
|
-
))}
|
|
53
|
-
</Items>
|
|
54
|
-
<h3>As link</h3>
|
|
55
|
-
<Items>
|
|
56
|
-
{Object.values(BUTTON_KIND).map((kind) => (
|
|
57
|
-
<Button kind={kind} key={kind} as="a" href="#">
|
|
58
|
-
Action {kind}
|
|
59
|
-
</Button>
|
|
60
|
-
))}
|
|
61
|
-
</Items>
|
|
62
|
-
<h3>With icon</h3>
|
|
63
|
-
<Items>
|
|
64
|
-
{Object.values(BUTTON_KIND).map((kind) => (
|
|
65
|
-
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE} kind={kind} key={kind}>
|
|
66
|
-
Action {kind}
|
|
67
|
-
</Button>
|
|
68
|
-
))}
|
|
69
|
-
</Items>
|
|
70
|
-
<Items>
|
|
71
|
-
{Object.values(BUTTON_KIND).map((kind) => (
|
|
72
|
-
<Button rightGlyph={Icon.ICONS.ARROW_RIGHT_CIRCLE} kind={kind} key={kind}>
|
|
73
|
-
Action {kind}
|
|
74
|
-
</Button>
|
|
75
|
-
))}
|
|
76
|
-
</Items>
|
|
77
|
-
<h3>Disabled</h3>
|
|
78
|
-
<Items>
|
|
79
|
-
{Object.values(BUTTON_KIND).map((kind) => (
|
|
80
|
-
<Button kind={kind} key={kind} disabled>
|
|
81
|
-
Action {kind}
|
|
33
|
+
{Object.values(BUTTON_SIZE).map((size) => (
|
|
34
|
+
<Button size={size} key={size}>
|
|
35
|
+
Action {size}
|
|
82
36
|
</Button>
|
|
83
37
|
))}
|
|
84
38
|
</Items>
|
|
85
39
|
</Stack>
|
|
86
|
-
</Stack>
|
|
87
|
-
<Stack space="medium">
|
|
88
|
-
<h2>Outline & Kind</h2>
|
|
89
40
|
<Stack space="medium">
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
Action default
|
|
94
|
-
</Button>
|
|
41
|
+
<h2>Kind</h2>
|
|
42
|
+
<Stack space="medium">
|
|
43
|
+
<Items>
|
|
95
44
|
{Object.values(BUTTON_KIND).map((kind) => (
|
|
96
|
-
<Button
|
|
45
|
+
<Button kind={kind} key={kind}>
|
|
97
46
|
Action {kind}
|
|
98
47
|
</Button>
|
|
99
48
|
))}
|
|
100
49
|
</Items>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<Items>
|
|
104
|
-
<Button outline active>
|
|
105
|
-
Action default
|
|
106
|
-
</Button>
|
|
107
|
-
{Object.values(BUTTON_KIND).map((kind) => (
|
|
108
|
-
<Button outline kind={kind} key={kind} active>
|
|
109
|
-
Action {kind}
|
|
110
|
-
</Button>
|
|
111
|
-
))}
|
|
112
|
-
</Items>
|
|
113
|
-
<h3>With icon</h3>
|
|
114
|
-
{Object.values(BUTTON_SIZE).map((size) => (
|
|
115
|
-
<Items key={size}>
|
|
116
|
-
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE} outline size={size}>
|
|
117
|
-
Action default
|
|
118
|
-
</Button>
|
|
50
|
+
<h3>Active</h3>
|
|
51
|
+
<Items>
|
|
119
52
|
{Object.values(BUTTON_KIND).map((kind) => (
|
|
120
|
-
<Button
|
|
121
|
-
glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE}
|
|
122
|
-
outline
|
|
123
|
-
kind={kind}
|
|
124
|
-
size={size}
|
|
125
|
-
key={kind}
|
|
126
|
-
>
|
|
53
|
+
<Button kind={kind} key={kind} active>
|
|
127
54
|
Action {kind}
|
|
128
55
|
</Button>
|
|
129
56
|
))}
|
|
130
57
|
</Items>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
{Object.values(BUTTON_SIZE).map((size) => (
|
|
134
|
-
<Items key={size}>
|
|
135
|
-
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE} outline size={size} />
|
|
58
|
+
<h3>As link</h3>
|
|
59
|
+
<Items>
|
|
136
60
|
{Object.values(BUTTON_KIND).map((kind) => (
|
|
137
|
-
<Button
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
kind={kind}
|
|
141
|
-
size={size}
|
|
142
|
-
key={kind}
|
|
143
|
-
/>
|
|
61
|
+
<Button kind={kind} key={kind} as="a" href="#">
|
|
62
|
+
Action {kind}
|
|
63
|
+
</Button>
|
|
144
64
|
))}
|
|
145
65
|
</Items>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
66
|
+
<h3>With icon</h3>
|
|
67
|
+
<Items>
|
|
68
|
+
{Object.values(BUTTON_KIND).map((kind) => (
|
|
69
|
+
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE} kind={kind} key={kind}>
|
|
70
|
+
Action {kind}
|
|
71
|
+
</Button>
|
|
72
|
+
))}
|
|
73
|
+
</Items>
|
|
74
|
+
<Items>
|
|
75
|
+
{Object.values(BUTTON_KIND).map((kind) => (
|
|
76
|
+
<Button rightGlyph={Icon.ICONS.ARROW_RIGHT_CIRCLE} kind={kind} key={kind}>
|
|
77
|
+
Action {kind}
|
|
78
|
+
</Button>
|
|
79
|
+
))}
|
|
80
|
+
</Items>
|
|
81
|
+
<h3>Disabled</h3>
|
|
82
|
+
<Items>
|
|
83
|
+
{Object.values(BUTTON_KIND).map((kind) => (
|
|
84
|
+
<Button kind={kind} key={kind} disabled>
|
|
85
|
+
Action {kind}
|
|
86
|
+
</Button>
|
|
87
|
+
))}
|
|
88
|
+
</Items>
|
|
89
|
+
</Stack>
|
|
158
90
|
</Stack>
|
|
159
|
-
</Stack>
|
|
160
|
-
<Stack space="medium">
|
|
161
|
-
<h2>Solid & Kind</h2>
|
|
162
91
|
<Stack space="medium">
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
92
|
+
<h2>Outline & Kind</h2>
|
|
93
|
+
<Stack space="medium">
|
|
94
|
+
{Object.values(BUTTON_SIZE).map((size) => (
|
|
95
|
+
<Items key={size}>
|
|
96
|
+
<Button outline size={size}>
|
|
97
|
+
Action default
|
|
98
|
+
</Button>
|
|
99
|
+
{Object.values(BUTTON_KIND).map((kind) => (
|
|
100
|
+
<Button outline kind={kind} key={kind} size={size}>
|
|
101
|
+
Action {kind}
|
|
102
|
+
</Button>
|
|
103
|
+
))}
|
|
104
|
+
</Items>
|
|
105
|
+
))}
|
|
106
|
+
<h3>Active</h3>
|
|
107
|
+
<Items>
|
|
108
|
+
<Button outline active>
|
|
166
109
|
Action default
|
|
167
110
|
</Button>
|
|
168
111
|
{Object.values(BUTTON_KIND).map((kind) => (
|
|
169
|
-
<Button
|
|
112
|
+
<Button outline kind={kind} key={kind} active>
|
|
170
113
|
Action {kind}
|
|
171
114
|
</Button>
|
|
172
115
|
))}
|
|
173
116
|
</Items>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
117
|
+
<h3>With icon</h3>
|
|
118
|
+
{Object.values(BUTTON_SIZE).map((size) => (
|
|
119
|
+
<Items key={size}>
|
|
120
|
+
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE} outline size={size}>
|
|
121
|
+
Action default
|
|
122
|
+
</Button>
|
|
123
|
+
{Object.values(BUTTON_KIND).map((kind) => (
|
|
124
|
+
<Button
|
|
125
|
+
glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE}
|
|
126
|
+
outline
|
|
127
|
+
kind={kind}
|
|
128
|
+
size={size}
|
|
129
|
+
key={kind}
|
|
130
|
+
>
|
|
131
|
+
Action {kind}
|
|
132
|
+
</Button>
|
|
133
|
+
))}
|
|
134
|
+
</Items>
|
|
184
135
|
))}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
136
|
+
<h3>Only icon</h3>
|
|
137
|
+
{Object.values(BUTTON_SIZE).map((size) => (
|
|
138
|
+
<Items key={size}>
|
|
139
|
+
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE} outline size={size} />
|
|
140
|
+
{Object.values(BUTTON_KIND).map((kind) => (
|
|
141
|
+
<Button
|
|
142
|
+
glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE}
|
|
143
|
+
outline
|
|
144
|
+
kind={kind}
|
|
145
|
+
size={size}
|
|
146
|
+
key={kind}
|
|
147
|
+
/>
|
|
148
|
+
))}
|
|
149
|
+
</Items>
|
|
150
|
+
))}
|
|
151
|
+
<h3>Disabled</h3>
|
|
152
|
+
<Items>
|
|
153
|
+
<Button outline disabled>
|
|
190
154
|
Action default
|
|
191
155
|
</Button>
|
|
192
156
|
{Object.values(BUTTON_KIND).map((kind) => (
|
|
193
|
-
<Button
|
|
194
|
-
glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE}
|
|
195
|
-
solid
|
|
196
|
-
kind={kind}
|
|
197
|
-
size={size}
|
|
198
|
-
key={kind}
|
|
199
|
-
>
|
|
157
|
+
<Button outline kind={kind} key={kind} disabled>
|
|
200
158
|
Action {kind}
|
|
201
159
|
</Button>
|
|
202
160
|
))}
|
|
203
161
|
</Items>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
162
|
+
</Stack>
|
|
163
|
+
</Stack>
|
|
164
|
+
<Stack space="medium">
|
|
165
|
+
<h2>Solid & Kind</h2>
|
|
166
|
+
<Stack space="medium">
|
|
167
|
+
{Object.values(BUTTON_SIZE).map((size) => (
|
|
168
|
+
<Items key={size}>
|
|
169
|
+
<Button solid size={size}>
|
|
170
|
+
Action default
|
|
171
|
+
</Button>
|
|
172
|
+
{Object.values(BUTTON_KIND).map((kind) => (
|
|
173
|
+
<Button solid kind={kind} key={kind} size={size}>
|
|
174
|
+
Action {kind}
|
|
175
|
+
</Button>
|
|
176
|
+
))}
|
|
177
|
+
</Items>
|
|
178
|
+
))}
|
|
179
|
+
<h3>Active</h3>
|
|
180
|
+
<Items>
|
|
181
|
+
<Button solid active>
|
|
182
|
+
Action default
|
|
183
|
+
</Button>
|
|
209
184
|
{Object.values(BUTTON_KIND).map((kind) => (
|
|
210
|
-
<Button
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
kind={kind}
|
|
214
|
-
size={size}
|
|
215
|
-
key={kind}
|
|
216
|
-
/>
|
|
185
|
+
<Button solid kind={kind} key={kind} active>
|
|
186
|
+
Action {kind}
|
|
187
|
+
</Button>
|
|
217
188
|
))}
|
|
218
189
|
</Items>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
190
|
+
<h3>With icon</h3>
|
|
191
|
+
{Object.values(BUTTON_SIZE).map((size) => (
|
|
192
|
+
<Items key={size}>
|
|
193
|
+
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE} solid size={size}>
|
|
194
|
+
Action default
|
|
195
|
+
</Button>
|
|
196
|
+
{Object.values(BUTTON_KIND).map((kind) => (
|
|
197
|
+
<Button
|
|
198
|
+
glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE}
|
|
199
|
+
solid
|
|
200
|
+
kind={kind}
|
|
201
|
+
size={size}
|
|
202
|
+
key={kind}
|
|
203
|
+
>
|
|
204
|
+
Action {kind}
|
|
205
|
+
</Button>
|
|
206
|
+
))}
|
|
207
|
+
</Items>
|
|
229
208
|
))}
|
|
230
|
-
|
|
209
|
+
<h3>Only icon</h3>
|
|
210
|
+
{Object.values(BUTTON_SIZE).map((size) => (
|
|
211
|
+
<Items key={size}>
|
|
212
|
+
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE} solid size={size} />
|
|
213
|
+
{Object.values(BUTTON_KIND).map((kind) => (
|
|
214
|
+
<Button
|
|
215
|
+
glyph={Icon.ICONS.ARROW_RIGHT_CIRCLE}
|
|
216
|
+
solid
|
|
217
|
+
kind={kind}
|
|
218
|
+
size={size}
|
|
219
|
+
key={kind}
|
|
220
|
+
/>
|
|
221
|
+
))}
|
|
222
|
+
</Items>
|
|
223
|
+
))}
|
|
224
|
+
<h3>Disabled</h3>
|
|
225
|
+
<Items>
|
|
226
|
+
<Button solid disabled>
|
|
227
|
+
Action default
|
|
228
|
+
</Button>
|
|
229
|
+
{Object.values(BUTTON_KIND).map((kind) => (
|
|
230
|
+
<Button solid kind={kind} key={kind} disabled>
|
|
231
|
+
Action {kind}
|
|
232
|
+
</Button>
|
|
233
|
+
))}
|
|
234
|
+
</Items>
|
|
235
|
+
</Stack>
|
|
231
236
|
</Stack>
|
|
232
237
|
</Stack>
|
|
233
|
-
|
|
234
|
-
|
|
238
|
+
),
|
|
239
|
+
};
|
package/src/ui/button/button.tsx
CHANGED
|
@@ -94,4 +94,11 @@ const ButtonComponent = <T extends React.ElementType = 'button'>(
|
|
|
94
94
|
);
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
// React.forwardRef collapses ButtonComponent's generic `as` parameter down to
|
|
98
|
+
// its default ('button'), so cast back to a polymorphic signature to keep
|
|
99
|
+
// `as`/its associated element props (e.g. `href` with `as="a"`) type-checked.
|
|
100
|
+
export const Button = React.forwardRef(ButtonComponent) as <T extends React.ElementType = 'button'>(
|
|
101
|
+
props: ButtonProps<T> &
|
|
102
|
+
Omit<React.ComponentPropsWithoutRef<T>, keyof ButtonProps<T>> &
|
|
103
|
+
React.RefAttributes<Element>,
|
|
104
|
+
) => React.ReactElement | null;
|
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
3
|
|
|
3
4
|
import { Container } from '.';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
const meta = {
|
|
6
7
|
title: 'UI/Container',
|
|
7
8
|
component: Container,
|
|
8
|
-
}
|
|
9
|
+
} satisfies Meta<typeof Container>;
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
<Container style={{ background: 'white' }}>
|
|
12
|
-
<div
|
|
13
|
-
style={{
|
|
14
|
-
background: 'white',
|
|
15
|
-
padding: '24px',
|
|
16
|
-
}}
|
|
17
|
-
>
|
|
18
|
-
Content
|
|
19
|
-
</div>
|
|
20
|
-
</Container>
|
|
21
|
-
);
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
22
14
|
|
|
23
|
-
Default
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
args: {
|
|
17
|
+
style: { background: 'white' },
|
|
18
|
+
children: (
|
|
19
|
+
<div
|
|
20
|
+
style={{
|
|
21
|
+
background: 'white',
|
|
22
|
+
padding: '24px',
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
Content
|
|
26
|
+
</div>
|
|
27
|
+
),
|
|
28
|
+
},
|
|
29
|
+
decorators: [
|
|
30
|
+
(Story) => (
|
|
31
|
+
<div style={{ background: 'hotpink' }}>
|
|
32
|
+
<Story />
|
|
33
|
+
</div>
|
|
34
|
+
),
|
|
35
|
+
],
|
|
36
|
+
};
|