@marigold/components 0.0.1 → 0.2.0
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/dist/ActionGroup/ActionGroup.d.ts +9 -0
- package/dist/ActionGroup/index.d.ts +1 -0
- package/dist/Alert/Alert.d.ts +20 -2
- package/dist/Badge/Badge.d.ts +8 -0
- package/dist/Badge/index.d.ts +1 -0
- package/dist/Box/Box.d.ts +47 -0
- package/dist/Box/index.d.ts +1 -0
- package/dist/Button/Button.d.ts +4 -3
- package/dist/Card/Card.d.ts +9 -0
- package/dist/Card/index.d.ts +1 -0
- package/dist/Checkbox/Checkbox.d.ts +14 -2
- package/dist/Checkbox/CheckboxIcons.d.ts +9 -0
- package/dist/Column/Column.d.ts +8 -0
- package/dist/Column/index.d.ts +1 -0
- package/dist/Columns/Columns.d.ts +10 -0
- package/dist/Columns/index.d.ts +1 -0
- package/dist/Container/Container.d.ts +6 -0
- package/dist/Container/index.d.ts +1 -0
- package/dist/Dialog/Dialog.d.ts +14 -0
- package/dist/Dialog/ModalDialog.d.ts +5 -0
- package/dist/Dialog/index.d.ts +1 -0
- package/dist/Divider/Divider.d.ts +7 -0
- package/dist/Divider/index.d.ts +1 -0
- package/dist/Field/Field.d.ts +11 -0
- package/dist/Field/index.d.ts +1 -0
- package/dist/Heading/Heading.d.ts +7 -5
- package/dist/Hidden/Hidden.d.ts +5 -0
- package/dist/Hidden/index.d.ts +1 -0
- package/dist/Image/Image.d.ts +7 -0
- package/dist/Image/index.d.ts +1 -0
- package/dist/Input/Input.d.ts +6 -0
- package/dist/Input/index.d.ts +1 -0
- package/dist/Label/Label.d.ts +8 -5
- package/dist/Link/Link.d.ts +7 -3
- package/dist/Menu/Menu.d.ts +12 -0
- package/dist/Menu/index.d.ts +1 -0
- package/dist/MenuItem/MenuItem.d.ts +7 -0
- package/dist/MenuItem/index.d.ts +1 -0
- package/dist/Message/Message.d.ts +7 -0
- package/dist/Message/index.d.ts +1 -0
- package/dist/Provider/MarigoldProvider.d.ts +3 -0
- package/dist/Provider/index.d.ts +3 -0
- package/dist/Radio/Radio.d.ts +14 -2
- package/dist/Radio/RadioIcons.d.ts +9 -0
- package/dist/Select/ListBox.d.ts +8 -0
- package/dist/Select/ListBoxSection.d.ts +8 -0
- package/dist/Select/Option.d.ts +8 -0
- package/dist/Select/Popover.d.ts +9 -0
- package/dist/Select/Select.d.ts +13 -3
- package/dist/Slider/Slider.d.ts +6 -3
- package/dist/Stack/Stack.d.ts +7 -0
- package/dist/Stack/index.d.ts +1 -0
- package/dist/Text/Text.d.ts +12 -3
- package/dist/Textarea/Textarea.d.ts +11 -3
- package/dist/ValidationMessage/ValidationMessage.d.ts +6 -0
- package/dist/ValidationMessage/index.d.ts +1 -0
- package/dist/components.cjs.development.js +1308 -195
- package/dist/components.cjs.development.js.map +1 -1
- package/dist/components.cjs.production.min.js +1 -1
- package/dist/components.cjs.production.min.js.map +1 -1
- package/dist/components.esm.js +1267 -185
- package/dist/components.esm.js.map +1 -1
- package/dist/index.d.ts +21 -4
- package/dist/theme.d.ts +24 -4
- package/package.json +24 -4
- package/src/ActionGroup/ActionGroup.stories.mdx +62 -0
- package/src/ActionGroup/ActionGroup.test.tsx +83 -0
- package/src/ActionGroup/ActionGroup.tsx +43 -0
- package/src/ActionGroup/index.ts +1 -0
- package/src/Alert/Alert.stories.mdx +30 -42
- package/src/Alert/Alert.test.tsx +37 -22
- package/src/Alert/Alert.tsx +31 -21
- package/src/Badge/Badge.stories.mdx +57 -0
- package/src/Badge/Badge.test.tsx +61 -0
- package/src/Badge/Badge.tsx +25 -0
- package/src/Badge/index.ts +1 -0
- package/src/Box/Box.stories.mdx +334 -0
- package/src/Box/Box.test.tsx +133 -0
- package/src/Box/Box.tsx +165 -0
- package/src/Box/index.ts +1 -0
- package/src/Button/Button.stories.mdx +58 -134
- package/src/Button/Button.test.tsx +65 -23
- package/src/Button/Button.tsx +48 -14
- package/src/Card/Card.stories.mdx +49 -0
- package/src/Card/Card.test.tsx +66 -0
- package/src/Card/Card.tsx +36 -0
- package/src/Card/index.ts +1 -0
- package/src/Checkbox/Checkbox.stories.mdx +79 -101
- package/src/Checkbox/Checkbox.test.tsx +73 -32
- package/src/Checkbox/Checkbox.tsx +114 -35
- package/src/Checkbox/CheckboxIcons.tsx +49 -0
- package/src/Column/Column.stories.mdx +49 -0
- package/src/Column/Column.test.tsx +32 -0
- package/src/Column/Column.tsx +27 -0
- package/src/Column/index.ts +1 -0
- package/src/Columns/Columns.stories.mdx +65 -0
- package/src/Columns/Columns.test.tsx +102 -0
- package/src/Columns/Columns.tsx +69 -0
- package/src/Columns/index.ts +1 -0
- package/src/Container/Container.stories.mdx +19 -0
- package/src/Container/Container.test.tsx +26 -0
- package/src/Container/Container.tsx +13 -0
- package/src/Container/index.ts +1 -0
- package/src/Dialog/Dialog.stories.mdx +73 -0
- package/src/Dialog/Dialog.test.tsx +87 -0
- package/src/Dialog/Dialog.tsx +84 -0
- package/src/Dialog/ModalDialog.tsx +47 -0
- package/src/Dialog/index.ts +1 -0
- package/src/Divider/Divider.stories.mdx +37 -0
- package/src/Divider/Divider.test.tsx +63 -0
- package/src/Divider/Divider.tsx +13 -0
- package/src/Divider/index.ts +1 -0
- package/src/Field/Field.stories.mdx +97 -0
- package/src/Field/Field.test.tsx +80 -0
- package/src/Field/Field.tsx +54 -0
- package/src/Field/index.ts +1 -0
- package/src/Heading/Heading.stories.mdx +36 -76
- package/src/Heading/Heading.test.tsx +31 -17
- package/src/Heading/Heading.tsx +15 -12
- package/src/Hidden/Hidden.stories.mdx +39 -0
- package/src/Hidden/Hidden.test.tsx +24 -0
- package/src/Hidden/Hidden.tsx +16 -0
- package/src/Hidden/index.ts +1 -0
- package/src/Image/Image.stories.mdx +36 -0
- package/src/Image/Image.test.tsx +70 -0
- package/src/Image/Image.tsx +13 -0
- package/src/Image/index.ts +1 -0
- package/src/Input/Input.stories.mdx +61 -0
- package/src/Input/Input.test.tsx +70 -0
- package/src/Input/Input.tsx +13 -0
- package/src/Input/index.ts +1 -0
- package/src/Label/Label.stories.mdx +50 -34
- package/src/Label/Label.test.tsx +45 -16
- package/src/Label/Label.tsx +26 -17
- package/src/Link/Link.stories.mdx +40 -31
- package/src/Link/Link.test.tsx +53 -28
- package/src/Link/Link.tsx +32 -14
- package/src/Menu/Menu.stories.mdx +81 -0
- package/src/Menu/Menu.test.tsx +79 -0
- package/src/Menu/Menu.tsx +41 -0
- package/src/Menu/index.ts +1 -0
- package/src/MenuItem/MenuItem.stories.mdx +37 -0
- package/src/MenuItem/MenuItem.test.tsx +63 -0
- package/src/MenuItem/MenuItem.tsx +23 -0
- package/src/MenuItem/index.ts +1 -0
- package/src/Message/Message.stories.mdx +44 -0
- package/src/Message/Message.test.tsx +87 -0
- package/src/Message/Message.tsx +43 -0
- package/src/Message/index.ts +1 -0
- package/src/Provider/MarigoldProvider.test.tsx +126 -0
- package/src/Provider/MarigoldProvider.tsx +29 -0
- package/src/Provider/index.ts +3 -0
- package/src/Radio/Radio.stories.mdx +80 -83
- package/src/Radio/Radio.test.tsx +63 -22
- package/src/Radio/Radio.tsx +110 -35
- package/src/Radio/RadioIcons.tsx +39 -0
- package/src/Select/ListBox.tsx +39 -0
- package/src/Select/ListBoxSection.tsx +40 -0
- package/src/Select/Option.tsx +48 -0
- package/src/Select/Popover.tsx +50 -0
- package/src/Select/Select.stories.mdx +72 -37
- package/src/Select/Select.test.tsx +271 -28
- package/src/Select/Select.tsx +158 -23
- package/src/Slider/Slider.stories.mdx +26 -54
- package/src/Slider/Slider.test.tsx +13 -13
- package/src/Slider/Slider.tsx +20 -18
- package/src/Stack/Stack.stories.mdx +51 -0
- package/src/Stack/Stack.test.tsx +129 -0
- package/src/Stack/Stack.tsx +39 -0
- package/src/Stack/index.ts +1 -0
- package/src/Text/Text.stories.mdx +53 -47
- package/src/Text/Text.test.tsx +55 -15
- package/src/Text/Text.tsx +44 -10
- package/src/Textarea/Textarea.stories.mdx +68 -21
- package/src/Textarea/Textarea.test.tsx +47 -16
- package/src/Textarea/Textarea.tsx +46 -14
- package/src/ValidationMessage/ValidationMessage.stories.mdx +36 -0
- package/src/ValidationMessage/ValidationMessage.test.tsx +63 -0
- package/src/ValidationMessage/ValidationMessage.tsx +28 -0
- package/src/ValidationMessage/index.ts +1 -0
- package/src/index.ts +22 -4
- package/src/theme.ts +24 -4
- package/dist/Svg/Svg.d.ts +0 -5
- package/dist/Svg/index.d.ts +0 -1
- package/dist/TextInput/TextInput.d.ts +0 -3
- package/dist/TextInput/index.d.ts +0 -1
- package/src/Svg/Svg.stories.mdx +0 -47
- package/src/Svg/Svg.test.tsx +0 -58
- package/src/Svg/Svg.tsx +0 -25
- package/src/Svg/index.ts +0 -1
- package/src/TextInput/TextInput.stories.mdx +0 -37
- package/src/TextInput/TextInput.test.tsx +0 -71
- package/src/TextInput/TextInput.tsx +0 -21
- package/src/TextInput/index.ts +0 -1
package/src/Alert/Alert.test.tsx
CHANGED
|
@@ -1,64 +1,79 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import {
|
|
4
|
-
import { Alert } from '
|
|
3
|
+
import { ThemeProvider } from '@marigold/system';
|
|
4
|
+
import { Alert } from './Alert';
|
|
5
5
|
|
|
6
6
|
const theme = {
|
|
7
7
|
alerts: {
|
|
8
|
-
|
|
8
|
+
success: {
|
|
9
9
|
alignItems: 'center',
|
|
10
10
|
},
|
|
11
|
-
|
|
11
|
+
error: {
|
|
12
12
|
alignItems: 'right',
|
|
13
13
|
},
|
|
14
|
+
warning: {
|
|
15
|
+
alignItems: 'left',
|
|
16
|
+
},
|
|
14
17
|
},
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
test('supports default variant and themeSection', () => {
|
|
18
21
|
render(
|
|
19
|
-
<
|
|
22
|
+
<ThemeProvider theme={theme}>
|
|
20
23
|
<Alert title="default">Default</Alert>
|
|
21
|
-
</
|
|
24
|
+
</ThemeProvider>
|
|
22
25
|
);
|
|
23
26
|
const alert = screen.getByTitle(/default/);
|
|
24
27
|
|
|
25
28
|
expect(alert).toHaveStyle(`align-items: center`);
|
|
26
29
|
});
|
|
27
30
|
|
|
28
|
-
test('accepts
|
|
31
|
+
test('accepts error variant', () => {
|
|
29
32
|
render(
|
|
30
|
-
<
|
|
31
|
-
<Alert title="
|
|
32
|
-
|
|
33
|
+
<ThemeProvider theme={theme}>
|
|
34
|
+
<Alert title="error" variant="error">
|
|
35
|
+
Error
|
|
33
36
|
</Alert>
|
|
34
|
-
</
|
|
37
|
+
</ThemeProvider>
|
|
35
38
|
);
|
|
36
|
-
const alert = screen.getByTitle(/
|
|
39
|
+
const alert = screen.getByTitle(/error/);
|
|
37
40
|
|
|
38
41
|
expect(alert).toHaveStyle(`align-items: right`);
|
|
39
42
|
});
|
|
40
43
|
|
|
44
|
+
test('accepts warning variant', () => {
|
|
45
|
+
render(
|
|
46
|
+
<ThemeProvider theme={theme}>
|
|
47
|
+
<Alert title="warning" variant="warning">
|
|
48
|
+
warning
|
|
49
|
+
</Alert>
|
|
50
|
+
</ThemeProvider>
|
|
51
|
+
);
|
|
52
|
+
const alert = screen.getByTitle(/warning/);
|
|
53
|
+
|
|
54
|
+
expect(alert).toHaveStyle(`align-items: left`);
|
|
55
|
+
});
|
|
56
|
+
|
|
41
57
|
test('renders correct HTML element', () => {
|
|
42
58
|
render(
|
|
43
|
-
<
|
|
59
|
+
<ThemeProvider theme={theme}>
|
|
44
60
|
<Alert title="default">Default</Alert>
|
|
45
|
-
</
|
|
61
|
+
</ThemeProvider>
|
|
46
62
|
);
|
|
47
63
|
const alert = screen.getByTitle(/default/);
|
|
48
64
|
|
|
49
65
|
expect(alert instanceof HTMLDivElement).toBeTruthy();
|
|
50
66
|
});
|
|
51
67
|
|
|
52
|
-
test('
|
|
68
|
+
test('accepts custom styles prop className', () => {
|
|
53
69
|
render(
|
|
54
|
-
<
|
|
55
|
-
<Alert
|
|
56
|
-
|
|
70
|
+
<ThemeProvider theme={theme}>
|
|
71
|
+
<Alert className="custom-class-name" title="alert">
|
|
72
|
+
alert
|
|
57
73
|
</Alert>
|
|
58
|
-
</
|
|
74
|
+
</ThemeProvider>
|
|
59
75
|
);
|
|
60
|
-
const alert = screen.getByTitle(/
|
|
76
|
+
const alert = screen.getByTitle(/alert/);
|
|
61
77
|
|
|
62
|
-
expect(alert).
|
|
63
|
-
expect(alert).not.toHaveStyle(`align-items: left`);
|
|
78
|
+
expect(alert.className).toMatch('custom-class-name');
|
|
64
79
|
});
|
package/src/Alert/Alert.tsx
CHANGED
|
@@ -1,27 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ComponentProps } from '@marigold/types';
|
|
3
|
+
import { Exclamation, Check, Notification } from '@marigold/icons';
|
|
4
|
+
import { Box } from '../Box';
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
const ICON_MAP = {
|
|
7
|
+
success: Check,
|
|
8
|
+
warning: Notification,
|
|
9
|
+
error: Exclamation,
|
|
10
|
+
} as const;
|
|
5
11
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
export type AlertProps = {
|
|
13
|
+
variant?: keyof typeof ICON_MAP;
|
|
14
|
+
} & ComponentProps<'div'>;
|
|
15
|
+
|
|
16
|
+
export const Alert: React.FC<AlertProps> = ({
|
|
17
|
+
variant = 'success',
|
|
18
|
+
children,
|
|
19
|
+
...props
|
|
20
|
+
}) => {
|
|
21
|
+
const Icon = ICON_MAP[variant];
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Box {...props} display="flex" variant={`alerts.${variant}`}>
|
|
9
25
|
<Box
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
css={{
|
|
16
|
-
display: 'flex',
|
|
17
|
-
alignItems: 'center',
|
|
18
|
-
px: 3,
|
|
19
|
-
py: 2,
|
|
20
|
-
borderRadius: 4,
|
|
21
|
-
}}
|
|
26
|
+
display="inline-block"
|
|
27
|
+
alignItems="center"
|
|
28
|
+
width="32px"
|
|
29
|
+
height="32px"
|
|
30
|
+
bg={variant}
|
|
22
31
|
>
|
|
23
|
-
{
|
|
32
|
+
<Box as={Icon} size={12} color="#fff" bg={variant} m={10} />
|
|
24
33
|
</Box>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
);
|
|
34
|
+
<Box mx="16px">{children}</Box>
|
|
35
|
+
</Box>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
|
|
2
|
+
import { Badge } from './Badge';
|
|
3
|
+
import { Check } from '@marigold/icons';
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
title="Components/Badge"
|
|
7
|
+
argTypes={{
|
|
8
|
+
variant: {
|
|
9
|
+
control: {
|
|
10
|
+
type: 'select',
|
|
11
|
+
},
|
|
12
|
+
options: ['default'],
|
|
13
|
+
description: 'Badge style',
|
|
14
|
+
table: {
|
|
15
|
+
defaultValue: {
|
|
16
|
+
summary: 'default',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
bgColor: {
|
|
21
|
+
control: {
|
|
22
|
+
type: 'text',
|
|
23
|
+
},
|
|
24
|
+
description: 'background',
|
|
25
|
+
table: {
|
|
26
|
+
defaultValue: {
|
|
27
|
+
summary: 'inherit',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
borderColor: {
|
|
32
|
+
control: {
|
|
33
|
+
type: 'text',
|
|
34
|
+
},
|
|
35
|
+
description: 'Outline color',
|
|
36
|
+
table: {
|
|
37
|
+
defaultValue: {
|
|
38
|
+
summary: 'transparent',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
|
|
45
|
+
# Badge
|
|
46
|
+
|
|
47
|
+
export const Template = args => (
|
|
48
|
+
<Badge {...args}>
|
|
49
|
+
<Check /> Check
|
|
50
|
+
</Badge>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
<Canvas>
|
|
54
|
+
<Story name="Default">{Template.bind({})}</Story>
|
|
55
|
+
</Canvas>
|
|
56
|
+
|
|
57
|
+
<ArgsTable story="Default" />
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { ThemeProvider } from '@marigold/system';
|
|
4
|
+
import { Badge } from './Badge';
|
|
5
|
+
|
|
6
|
+
const theme = {
|
|
7
|
+
badge: {
|
|
8
|
+
default: {
|
|
9
|
+
borderRadius: '8px',
|
|
10
|
+
},
|
|
11
|
+
fatBadge: {
|
|
12
|
+
borderRadius: '12px',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
test('supports default variant and themeSection', () => {
|
|
18
|
+
render(
|
|
19
|
+
<ThemeProvider theme={theme}>
|
|
20
|
+
<Badge title="badge" />
|
|
21
|
+
</ThemeProvider>
|
|
22
|
+
);
|
|
23
|
+
const badge = screen.getByTitle(/badge/);
|
|
24
|
+
|
|
25
|
+
expect(badge).toHaveStyle(`border-radius: 8px;`);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('renders correct HTML element', () => {
|
|
29
|
+
render(
|
|
30
|
+
<ThemeProvider theme={theme}>
|
|
31
|
+
<Badge title="badge" />
|
|
32
|
+
</ThemeProvider>
|
|
33
|
+
);
|
|
34
|
+
const badge = screen.getByTitle(/badge/);
|
|
35
|
+
|
|
36
|
+
expect(badge instanceof HTMLDivElement).toBeTruthy();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('supports other variant than default', () => {
|
|
40
|
+
render(
|
|
41
|
+
<ThemeProvider theme={theme}>
|
|
42
|
+
<Badge variant="fatBadge" title="badge" />
|
|
43
|
+
</ThemeProvider>
|
|
44
|
+
);
|
|
45
|
+
const badge = screen.getByTitle(/badge/);
|
|
46
|
+
|
|
47
|
+
expect(badge).toHaveStyle(`border-radius: 12px;`);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('accepts custom styles prop className', () => {
|
|
51
|
+
render(
|
|
52
|
+
<ThemeProvider theme={theme}>
|
|
53
|
+
<Badge className="custom-class-name" title="badge">
|
|
54
|
+
badge
|
|
55
|
+
</Badge>
|
|
56
|
+
</ThemeProvider>
|
|
57
|
+
);
|
|
58
|
+
const badge = screen.getByTitle(/badge/);
|
|
59
|
+
|
|
60
|
+
expect(badge.className).toMatch('custom-class-name');
|
|
61
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentProps } from '@marigold/types';
|
|
3
|
+
import { Box } from '../Box';
|
|
4
|
+
|
|
5
|
+
export type BadgeProps = {
|
|
6
|
+
variant?: string;
|
|
7
|
+
bgColor?: string;
|
|
8
|
+
borderColor?: string;
|
|
9
|
+
} & ComponentProps<'div'>;
|
|
10
|
+
|
|
11
|
+
export const Badge: React.FC<BadgeProps> = ({
|
|
12
|
+
variant = 'default',
|
|
13
|
+
bgColor = 'transparent',
|
|
14
|
+
borderColor = 'transparent',
|
|
15
|
+
children,
|
|
16
|
+
...props
|
|
17
|
+
}) => (
|
|
18
|
+
<Box
|
|
19
|
+
css={{ bg: bgColor, borderColor: borderColor }}
|
|
20
|
+
variant={`badge.${variant}`}
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</Box>
|
|
25
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Badge';
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
|
|
2
|
+
import { Box } from './Box';
|
|
3
|
+
import { Button } from '../Button';
|
|
4
|
+
import { Label } from '../Label';
|
|
5
|
+
|
|
6
|
+
<Meta
|
|
7
|
+
title="Components/Box"
|
|
8
|
+
argTypes={{
|
|
9
|
+
variant: {
|
|
10
|
+
control: {
|
|
11
|
+
type: 'text',
|
|
12
|
+
},
|
|
13
|
+
table: {
|
|
14
|
+
category: 'General',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
display: {
|
|
18
|
+
control: {
|
|
19
|
+
type: 'text',
|
|
20
|
+
},
|
|
21
|
+
table: {
|
|
22
|
+
category: 'General',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
height: {
|
|
26
|
+
control: {
|
|
27
|
+
type: 'text',
|
|
28
|
+
},
|
|
29
|
+
table: {
|
|
30
|
+
category: 'Width',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
width: {
|
|
34
|
+
control: {
|
|
35
|
+
type: 'text',
|
|
36
|
+
},
|
|
37
|
+
table: {
|
|
38
|
+
category: 'Width',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
minWidth: {
|
|
42
|
+
control: {
|
|
43
|
+
type: 'text',
|
|
44
|
+
},
|
|
45
|
+
table: {
|
|
46
|
+
category: 'Width',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
maxWidth: {
|
|
50
|
+
control: {
|
|
51
|
+
type: 'text',
|
|
52
|
+
},
|
|
53
|
+
table: {
|
|
54
|
+
category: 'Width',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
position: {
|
|
58
|
+
control: {
|
|
59
|
+
type: 'text',
|
|
60
|
+
},
|
|
61
|
+
table: {
|
|
62
|
+
category: 'Position',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
top: {
|
|
66
|
+
control: {
|
|
67
|
+
type: 'text',
|
|
68
|
+
},
|
|
69
|
+
table: {
|
|
70
|
+
category: 'Position',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
bottom: {
|
|
74
|
+
control: {
|
|
75
|
+
type: 'text',
|
|
76
|
+
},
|
|
77
|
+
table: {
|
|
78
|
+
category: 'Position',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
right: {
|
|
82
|
+
control: {
|
|
83
|
+
type: 'text',
|
|
84
|
+
},
|
|
85
|
+
table: {
|
|
86
|
+
category: 'Position',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
left: {
|
|
90
|
+
control: {
|
|
91
|
+
type: 'text',
|
|
92
|
+
},
|
|
93
|
+
table: {
|
|
94
|
+
category: 'Position',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
zIndex: {
|
|
98
|
+
control: {
|
|
99
|
+
type: 'text',
|
|
100
|
+
},
|
|
101
|
+
table: {
|
|
102
|
+
category: 'Position',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
p: {
|
|
106
|
+
control: {
|
|
107
|
+
type: 'text',
|
|
108
|
+
},
|
|
109
|
+
table: {
|
|
110
|
+
category: 'Padding',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
px: {
|
|
114
|
+
control: {
|
|
115
|
+
type: 'text',
|
|
116
|
+
},
|
|
117
|
+
table: {
|
|
118
|
+
category: 'Padding',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
py: {
|
|
122
|
+
control: {
|
|
123
|
+
type: 'text',
|
|
124
|
+
},
|
|
125
|
+
table: {
|
|
126
|
+
category: 'Padding',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
pt: {
|
|
130
|
+
control: {
|
|
131
|
+
type: 'text',
|
|
132
|
+
},
|
|
133
|
+
table: {
|
|
134
|
+
category: 'Padding',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
pb: {
|
|
138
|
+
control: {
|
|
139
|
+
type: 'text',
|
|
140
|
+
},
|
|
141
|
+
table: {
|
|
142
|
+
category: 'Padding',
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
pl: {
|
|
146
|
+
control: {
|
|
147
|
+
type: 'text',
|
|
148
|
+
},
|
|
149
|
+
table: {
|
|
150
|
+
category: 'Padding',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
pr: {
|
|
154
|
+
control: {
|
|
155
|
+
type: 'text',
|
|
156
|
+
},
|
|
157
|
+
table: {
|
|
158
|
+
category: 'Padding',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
m: {
|
|
162
|
+
control: {
|
|
163
|
+
type: 'text',
|
|
164
|
+
},
|
|
165
|
+
table: {
|
|
166
|
+
category: 'Margin',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
mx: {
|
|
170
|
+
control: {
|
|
171
|
+
type: 'text',
|
|
172
|
+
},
|
|
173
|
+
table: {
|
|
174
|
+
category: 'Margin',
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
my: {
|
|
178
|
+
control: {
|
|
179
|
+
type: 'text',
|
|
180
|
+
},
|
|
181
|
+
table: {
|
|
182
|
+
category: 'Margin',
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
mt: {
|
|
186
|
+
control: {
|
|
187
|
+
type: 'text',
|
|
188
|
+
},
|
|
189
|
+
table: {
|
|
190
|
+
category: 'Margin',
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
mb: {
|
|
194
|
+
control: {
|
|
195
|
+
type: 'text',
|
|
196
|
+
},
|
|
197
|
+
table: {
|
|
198
|
+
category: 'Margin',
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
ml: {
|
|
202
|
+
control: {
|
|
203
|
+
type: 'text',
|
|
204
|
+
},
|
|
205
|
+
table: {
|
|
206
|
+
category: 'Margin',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
mr: {
|
|
210
|
+
control: {
|
|
211
|
+
type: 'text',
|
|
212
|
+
},
|
|
213
|
+
table: {
|
|
214
|
+
category: 'Margin',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
flexDirection: {
|
|
218
|
+
control: {
|
|
219
|
+
type: 'text',
|
|
220
|
+
},
|
|
221
|
+
table: {
|
|
222
|
+
category: 'Flex',
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
flexWrap: {
|
|
226
|
+
control: {
|
|
227
|
+
type: 'text',
|
|
228
|
+
},
|
|
229
|
+
table: {
|
|
230
|
+
category: 'Flex',
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
flexShrink: {
|
|
234
|
+
control: {
|
|
235
|
+
type: 'text',
|
|
236
|
+
},
|
|
237
|
+
table: {
|
|
238
|
+
category: 'Flex',
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
flexGrow: {
|
|
242
|
+
control: {
|
|
243
|
+
type: 'text',
|
|
244
|
+
},
|
|
245
|
+
table: {
|
|
246
|
+
category: 'Flex',
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
alignItems: {
|
|
250
|
+
control: {
|
|
251
|
+
type: 'text',
|
|
252
|
+
},
|
|
253
|
+
table: {
|
|
254
|
+
category: 'Flex',
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
justifyContent: {
|
|
258
|
+
control: {
|
|
259
|
+
type: 'text',
|
|
260
|
+
},
|
|
261
|
+
table: {
|
|
262
|
+
category: 'Flex',
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
bg: {
|
|
266
|
+
control: {
|
|
267
|
+
type: 'text',
|
|
268
|
+
},
|
|
269
|
+
table: {
|
|
270
|
+
category: 'Other',
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
border: {
|
|
274
|
+
control: {
|
|
275
|
+
type: 'text',
|
|
276
|
+
},
|
|
277
|
+
table: {
|
|
278
|
+
category: 'Other',
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
borderRadius: {
|
|
282
|
+
control: {
|
|
283
|
+
type: 'text',
|
|
284
|
+
},
|
|
285
|
+
table: {
|
|
286
|
+
category: 'Other',
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
boxShadow: {
|
|
290
|
+
control: {
|
|
291
|
+
type: 'text',
|
|
292
|
+
},
|
|
293
|
+
table: {
|
|
294
|
+
category: 'Other',
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
opacity: {
|
|
298
|
+
control: {
|
|
299
|
+
type: 'text',
|
|
300
|
+
},
|
|
301
|
+
table: {
|
|
302
|
+
category: 'Other',
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
overflow: {
|
|
306
|
+
control: {
|
|
307
|
+
type: 'text',
|
|
308
|
+
},
|
|
309
|
+
table: {
|
|
310
|
+
category: 'Other',
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
transition: {
|
|
314
|
+
control: {
|
|
315
|
+
type: 'text',
|
|
316
|
+
},
|
|
317
|
+
table: {
|
|
318
|
+
category: 'Other',
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
}}
|
|
322
|
+
/>
|
|
323
|
+
|
|
324
|
+
# Box-Component
|
|
325
|
+
|
|
326
|
+
## For custom components
|
|
327
|
+
|
|
328
|
+
export const Template = args => <Box {...args}>Style me!</Box>;
|
|
329
|
+
|
|
330
|
+
<Canvas>
|
|
331
|
+
<Story name="Default">{Template.bind({})}</Story>
|
|
332
|
+
</Canvas>
|
|
333
|
+
|
|
334
|
+
<ArgsTable story="Default" />
|