@marigold/components 0.1.0 → 0.3.2
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/CHANGELOG.md +180 -0
- package/dist/ActionGroup/ActionGroup.d.ts +8 -0
- package/dist/ActionGroup/ActionGroup.stories.d.ts +5 -0
- package/dist/ActionGroup/index.d.ts +1 -0
- package/dist/Alert/Alert.d.ts +22 -1
- package/dist/Alert/Alert.stories.d.ts +5 -0
- package/dist/Badge/Badge.d.ts +5 -0
- package/dist/Badge/Badge.stories.d.ts +5 -0
- package/dist/Box.d.ts +2 -0
- package/dist/Button/Button.d.ts +9 -6
- package/dist/Button/Button.stories.d.ts +5 -0
- package/dist/Card/Card.d.ts +14 -0
- package/dist/Card/Card.stories.d.ts +5 -0
- package/dist/Card/index.d.ts +1 -0
- package/dist/Checkbox/Checkbox.d.ts +12 -4
- package/dist/Checkbox/Checkbox.stories.d.ts +5 -0
- package/dist/Checkbox/CheckboxIcons.d.ts +9 -0
- package/dist/Column/Column.d.ts +3 -1
- package/dist/Column/Column.stories.d.ts +5 -0
- package/dist/Columns/Columns.d.ts +2 -2
- package/dist/Columns/Columns.stories.d.ts +5 -0
- package/dist/Container/Container.stories.d.ts +5 -0
- package/dist/Dialog/Dialog.d.ts +12 -2
- package/dist/Dialog/Dialog.stories.d.ts +5 -0
- package/dist/Dialog/ModalDialog.d.ts +8 -0
- package/dist/Divider/Divider.d.ts +7 -3
- package/dist/Divider/Divider.stories.d.ts +5 -0
- package/dist/Field/Field.d.ts +5 -1
- package/dist/Field/Field.stories.d.ts +5 -0
- package/dist/Image/Image.d.ts +5 -0
- package/dist/Image/Image.stories.d.ts +5 -0
- package/dist/Inline/Inline.d.ts +7 -0
- package/dist/Inline/Inline.stories.d.ts +5 -0
- package/dist/Inline/index.d.ts +1 -0
- package/dist/Input/Input.d.ts +5 -0
- package/dist/Input/Input.stories.d.ts +5 -0
- package/dist/Label/Label.d.ts +14 -2
- package/dist/Label/Label.stories.d.ts +5 -0
- package/dist/Link/Link.d.ts +3 -0
- package/dist/Link/Link.stories.d.ts +5 -0
- package/dist/Menu/Menu.d.ts +3 -0
- package/dist/Menu/Menu.stories.d.ts +5 -0
- package/dist/MenuItem/MenuItem.d.ts +5 -0
- package/dist/MenuItem/MenuItem.stories.d.ts +5 -0
- package/dist/Message/Message.d.ts +5 -0
- package/dist/Message/Message.stories.d.ts +5 -0
- package/dist/Provider/MarigoldProvider.d.ts +11 -0
- package/dist/Provider/index.d.ts +3 -0
- package/dist/Radio/Radio.d.ts +11 -4
- package/dist/Radio/Radio.stories.d.ts +5 -0
- package/dist/Radio/RadioIcon.d.ts +9 -0
- package/dist/Select/ListBox.d.ts +9 -0
- package/dist/Select/ListBoxSection.d.ts +9 -0
- package/dist/Select/Option.d.ts +9 -0
- package/dist/Select/Popover.d.ts +9 -0
- package/dist/Select/Select.d.ts +25 -4
- package/dist/Select/Select.stories.d.ts +5 -0
- package/dist/Slider/Slider.d.ts +5 -0
- package/dist/Slider/Slider.stories.d.ts +5 -0
- package/dist/Stack/Stack.d.ts +1 -3
- package/dist/Stack/Stack.stories.d.ts +5 -0
- package/dist/Text/Text.d.ts +5 -0
- package/dist/Text/Text.stories.d.ts +5 -0
- package/dist/Textarea/Textarea.d.ts +7 -1
- package/dist/Textarea/Textarea.stories.d.ts +5 -0
- package/dist/ValidationMessage/ValidationMessage.d.ts +5 -0
- package/dist/ValidationMessage/ValidationMessage.stories.d.ts +5 -0
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +1 -0
- package/dist/VisuallyHidden/VisuallyHidden.stories.d.ts +5 -0
- package/dist/VisuallyHidden/index.d.ts +1 -0
- package/dist/components.cjs.development.js +1068 -601
- 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 +1003 -579
- package/dist/components.esm.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/theme.d.ts +23 -48
- package/package.json +22 -3
- package/src/ActionGroup/ActionGroup.stories.tsx +47 -0
- package/src/ActionGroup/ActionGroup.test.tsx +83 -0
- package/src/ActionGroup/ActionGroup.tsx +32 -0
- package/src/ActionGroup/index.ts +1 -0
- package/src/Alert/Alert.stories.tsx +32 -0
- package/src/Alert/Alert.test.tsx +5 -2
- package/src/Alert/Alert.tsx +27 -34
- package/src/Badge/Badge.stories.tsx +38 -0
- package/src/Badge/Badge.test.tsx +12 -16
- package/src/Badge/Badge.tsx +14 -3
- package/src/Box.ts +2 -0
- package/src/Button/Button.stories.tsx +57 -0
- package/src/Button/Button.test.tsx +76 -13
- package/src/Button/Button.tsx +61 -18
- package/src/Card/Card.stories.tsx +41 -0
- package/src/Card/Card.test.tsx +71 -0
- package/src/Card/Card.tsx +48 -0
- package/src/Card/index.ts +1 -0
- package/src/Checkbox/Checkbox.stories.tsx +78 -0
- package/src/Checkbox/Checkbox.test.tsx +138 -23
- package/src/Checkbox/Checkbox.tsx +67 -68
- package/src/Checkbox/CheckboxIcons.tsx +59 -0
- package/src/Column/Column.stories.tsx +33 -0
- package/src/Column/Column.test.tsx +8 -0
- package/src/Column/Column.tsx +12 -2
- package/src/Columns/Columns.stories.tsx +75 -0
- package/src/Columns/Columns.test.tsx +34 -23
- package/src/Columns/Columns.tsx +30 -30
- package/src/Container/Container.stories.tsx +14 -0
- package/src/Dialog/Dialog.stories.tsx +88 -0
- package/src/Dialog/Dialog.test.tsx +129 -18
- package/src/Dialog/Dialog.tsx +113 -15
- package/src/Dialog/ModalDialog.tsx +76 -0
- package/src/Divider/Divider.stories.tsx +30 -0
- package/src/Divider/Divider.test.tsx +32 -23
- package/src/Divider/Divider.tsx +27 -7
- package/src/Field/Field.stories.tsx +110 -0
- package/src/Field/Field.test.tsx +74 -33
- package/src/Field/Field.tsx +27 -20
- package/src/Image/Image.stories.tsx +34 -0
- package/src/Image/Image.test.tsx +4 -1
- package/src/Image/Image.tsx +13 -1
- package/src/Inline/Inline.stories.tsx +39 -0
- package/src/Inline/Inline.test.tsx +99 -0
- package/src/Inline/Inline.tsx +38 -0
- package/src/Inline/index.ts +1 -0
- package/src/Input/Input.stories.tsx +54 -0
- package/src/Input/Input.test.tsx +7 -3
- package/src/Input/Input.tsx +13 -1
- package/src/Label/Label.stories.tsx +41 -0
- package/src/Label/Label.test.tsx +40 -5
- package/src/Label/Label.tsx +54 -8
- package/src/Link/Link.stories.tsx +35 -0
- package/src/Link/Link.test.tsx +6 -2
- package/src/Link/Link.tsx +12 -1
- package/src/Menu/Menu.stories.tsx +62 -0
- package/src/Menu/Menu.test.tsx +11 -6
- package/src/Menu/Menu.tsx +22 -14
- package/src/MenuItem/MenuItem.stories.tsx +30 -0
- package/src/MenuItem/MenuItem.test.tsx +22 -13
- package/src/MenuItem/MenuItem.tsx +19 -10
- package/src/Message/Message.stories.tsx +30 -0
- package/src/Message/Message.test.tsx +4 -1
- package/src/Message/Message.tsx +18 -14
- package/src/Provider/MarigoldProvider.test.tsx +136 -0
- package/src/Provider/MarigoldProvider.tsx +47 -0
- package/src/Provider/index.ts +4 -0
- package/src/Radio/Radio.stories.tsx +78 -0
- package/src/Radio/Radio.test.tsx +129 -18
- package/src/Radio/Radio.tsx +62 -71
- package/src/Radio/RadioIcon.tsx +49 -0
- package/src/Select/ListBox.tsx +40 -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.tsx +81 -0
- package/src/Select/Select.test.tsx +317 -35
- package/src/Select/Select.tsx +162 -18
- package/src/Slider/Slider.stories.tsx +24 -0
- package/src/Slider/Slider.test.tsx +10 -6
- package/src/Slider/Slider.tsx +25 -13
- package/src/Stack/Stack.stories.tsx +57 -0
- package/src/Stack/Stack.test.tsx +93 -65
- package/src/Stack/Stack.tsx +25 -41
- package/src/Text/Text.stories.tsx +61 -0
- package/src/Text/Text.test.tsx +2 -2
- package/src/Text/Text.tsx +25 -14
- package/src/Textarea/Textarea.stories.tsx +64 -0
- package/src/Textarea/Textarea.test.tsx +11 -8
- package/src/Textarea/Textarea.tsx +41 -38
- package/src/ValidationMessage/ValidationMessage.stories.tsx +27 -0
- package/src/ValidationMessage/ValidationMessage.test.tsx +9 -4
- package/src/ValidationMessage/ValidationMessage.tsx +23 -12
- package/src/VisuallyHidden/VisuallyHidden.stories.tsx +19 -0
- package/src/VisuallyHidden/VisuallyHidden.test.tsx +10 -0
- package/src/VisuallyHidden/VisuallyHidden.tsx +1 -0
- package/src/VisuallyHidden/index.ts +1 -0
- package/src/index.ts +7 -2
- package/src/theme.ts +49 -48
- package/dist/Box/Box.d.ts +0 -46
- package/dist/Box/index.d.ts +0 -1
- package/dist/Heading/Heading.d.ts +0 -7
- package/dist/Heading/index.d.ts +0 -1
- package/dist/Hidden/Hidden.d.ts +0 -5
- package/dist/Hidden/index.d.ts +0 -1
- package/src/Alert/Alert.stories.mdx +0 -45
- package/src/Badge/Badge.stories.mdx +0 -43
- package/src/Box/Box.stories.mdx +0 -38
- package/src/Box/Box.test.tsx +0 -133
- package/src/Box/Box.tsx +0 -157
- package/src/Box/index.ts +0 -1
- package/src/Button/Button.stories.mdx +0 -176
- package/src/Checkbox/Checkbox.stories.mdx +0 -81
- package/src/Column/Column.stories.mdx +0 -74
- package/src/Columns/Columns.stories.mdx +0 -247
- package/src/Container/Container.stories.mdx +0 -36
- package/src/Dialog/Dialog.stories.mdx +0 -64
- package/src/Divider/Divider.stories.mdx +0 -43
- package/src/Field/Field.stories.mdx +0 -57
- package/src/Heading/Heading.stories.mdx +0 -91
- package/src/Heading/Heading.test.tsx +0 -77
- package/src/Heading/Heading.tsx +0 -19
- package/src/Heading/index.ts +0 -1
- package/src/Hidden/Hidden.stories.mdx +0 -64
- package/src/Hidden/Hidden.test.tsx +0 -24
- package/src/Hidden/Hidden.tsx +0 -16
- package/src/Hidden/index.ts +0 -1
- package/src/Image/Image.stories.mdx +0 -40
- package/src/Input/Input.stories.mdx +0 -45
- package/src/Label/Label.stories.mdx +0 -34
- package/src/Link/Link.stories.mdx +0 -38
- package/src/Menu/Menu.stories.mdx +0 -49
- package/src/MenuItem/MenuItem.stories.mdx +0 -32
- package/src/Message/Message.stories.mdx +0 -44
- package/src/Radio/Radio.stories.mdx +0 -100
- package/src/Select/Select.stories.mdx +0 -44
- package/src/Slider/Slider.stories.mdx +0 -58
- package/src/Stack/Stack.stories.mdx +0 -105
- package/src/Text/Text.stories.mdx +0 -60
- package/src/Textarea/Textarea.stories.mdx +0 -65
- package/src/ValidationMessage/ValidationMessage.stories.mdx +0 -36
package/src/Box/Box.test.tsx
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import { ThemeProvider } from '@marigold/system';
|
|
5
|
-
import { Box } from './Box';
|
|
6
|
-
|
|
7
|
-
// Setup
|
|
8
|
-
// ---------------
|
|
9
|
-
const theme = {
|
|
10
|
-
colors: {
|
|
11
|
-
primary: 'hotpink',
|
|
12
|
-
black: '#000',
|
|
13
|
-
white: '#FFF',
|
|
14
|
-
blue: '#2980b9',
|
|
15
|
-
},
|
|
16
|
-
space: [0, 2, 4, 8],
|
|
17
|
-
sizes: [0, 8, 16, 32],
|
|
18
|
-
borders: ['none', '1px solid black'],
|
|
19
|
-
radii: [0, 2, 4],
|
|
20
|
-
opacities: [0, 0.5, 1],
|
|
21
|
-
transitions: ['none', '1s opacity'],
|
|
22
|
-
shadows: ['none', '3px 3px 5px 6px #ccc', 'inset 0 0 10px #000000'],
|
|
23
|
-
variant: {
|
|
24
|
-
color: 'primary',
|
|
25
|
-
p: 2,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// Tests
|
|
30
|
-
// ---------------
|
|
31
|
-
test('renders a <div> by default', () => {
|
|
32
|
-
render(<Box>box</Box>);
|
|
33
|
-
const box = screen.getByText(/box/);
|
|
34
|
-
|
|
35
|
-
expect(box instanceof HTMLDivElement).toBeTruthy();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
test('changes rendered element via as prop', () => {
|
|
39
|
-
render(<Box as="span">box</Box>);
|
|
40
|
-
const box = screen.getByText(/box/);
|
|
41
|
-
|
|
42
|
-
expect(box instanceof HTMLSpanElement).toBeTruthy();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test('passes down HTML attributes', () => {
|
|
46
|
-
render(
|
|
47
|
-
<Box className="my-custom-class" id="box-id" disabled>
|
|
48
|
-
box
|
|
49
|
-
</Box>
|
|
50
|
-
);
|
|
51
|
-
const box = screen.getByText(/box/);
|
|
52
|
-
|
|
53
|
-
expect(box.getAttribute('id')).toEqual('box-id');
|
|
54
|
-
expect(box.getAttribute('disabled')).toMatch('');
|
|
55
|
-
expect(box.getAttribute('class')).toMatch('my-custom-class');
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test('forwards ref', () => {
|
|
59
|
-
const ref = React.createRef<HTMLButtonElement>();
|
|
60
|
-
render(
|
|
61
|
-
<Box as="button" ref={ref}>
|
|
62
|
-
button
|
|
63
|
-
</Box>
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
expect(ref.current instanceof HTMLButtonElement).toBeTruthy();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test.each([
|
|
70
|
-
[{ display: 'flex' }, 'display: flex'],
|
|
71
|
-
[{ height: 1 }, 'height: 8px'],
|
|
72
|
-
[{ width: 2 }, 'width: 16px'],
|
|
73
|
-
[{ minWidth: 1 }, 'min-width: 8px'],
|
|
74
|
-
[{ maxWidth: 3 }, 'max-width: 32px'],
|
|
75
|
-
[{ position: 'absolute' }, 'position: absolute'],
|
|
76
|
-
[{ top: 0 }, 'top: 0px'],
|
|
77
|
-
[{ bottom: 1 }, 'bottom: 2px'],
|
|
78
|
-
[{ right: 3 }, 'right: 8px'],
|
|
79
|
-
[{ left: 2 }, 'left: 4px'],
|
|
80
|
-
[{ zIndex: 1000 }, 'z-index: 1000'],
|
|
81
|
-
[{ p: 1 }, 'padding: 2px'],
|
|
82
|
-
[{ px: 1 }, 'padding-left: 2px', 'padding-right: 2px'],
|
|
83
|
-
[{ py: 2 }, 'padding-top: 4px', 'padding-bottom: 4px'],
|
|
84
|
-
[{ pt: 1 }, 'padding-top: 2px'],
|
|
85
|
-
[{ pb: 1 }, 'padding-bottom: 2px'],
|
|
86
|
-
[{ pl: 1 }, 'padding-left: 2px'],
|
|
87
|
-
[{ pr: 1 }, 'padding-right: 2px'],
|
|
88
|
-
[{ m: 1 }, 'margin: 2px'],
|
|
89
|
-
[{ mx: 1 }, 'margin-left: 2px', 'margin-right: 2px'],
|
|
90
|
-
[{ my: 2 }, 'margin-top: 4px', 'margin-bottom: 4px'],
|
|
91
|
-
[{ mt: 1 }, 'margin-top: 2px'],
|
|
92
|
-
[{ mb: 1 }, 'margin-bottom: 2px'],
|
|
93
|
-
[{ ml: 1 }, 'margin-left: 2px'],
|
|
94
|
-
[{ mr: 1 }, 'margin-right: 2px'],
|
|
95
|
-
[{ flexDirection: 'column' }, 'flex-direction: column'],
|
|
96
|
-
[{ flexWrap: 'wrap' }, 'flex-wrap: wrap'],
|
|
97
|
-
[{ flexShrink: 5 }, 'flex-shrink: 5'],
|
|
98
|
-
[{ flexGrow: 1 }, 'flex-grow: 1'],
|
|
99
|
-
[{ alignItems: 'baseline' }, 'align-items: baseline'],
|
|
100
|
-
[{ justifyContent: 'space-between' }, 'justify-content: space-between'],
|
|
101
|
-
[{ bg: 'primary' }, 'background-color: hotpink'],
|
|
102
|
-
[{ border: 1 }, 'border: 1px solid black'],
|
|
103
|
-
[{ borderRadius: 2 }, 'border-radius: 4px'],
|
|
104
|
-
[{ boxShadow: 1 }, 'box-shadow: 3px 3px 5px 6px #ccc'],
|
|
105
|
-
[{ opacity: 1 }, 'opacity: 0.5'],
|
|
106
|
-
[{ overflow: 'hidden' }, 'overflow: hidden'],
|
|
107
|
-
[{ transition: 1 }, 'transition: 1s opacity'],
|
|
108
|
-
])('test style prop %o', (...args) => {
|
|
109
|
-
const props = args.shift();
|
|
110
|
-
|
|
111
|
-
render(
|
|
112
|
-
<ThemeProvider theme={theme}>
|
|
113
|
-
<Box {...props}>What's in the box!</Box>
|
|
114
|
-
</ThemeProvider>
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
const box = screen.getByText(`What's in the box!`);
|
|
118
|
-
args.forEach((style: any) => {
|
|
119
|
-
expect(box).toHaveStyle(style);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
test('support variants', () => {
|
|
124
|
-
render(
|
|
125
|
-
<ThemeProvider theme={theme}>
|
|
126
|
-
<Box variant="variant">What's in the box!</Box>
|
|
127
|
-
</ThemeProvider>
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
const box = screen.getByText(`What's in the box!`);
|
|
131
|
-
expect(box).toHaveStyle('color: hotpink');
|
|
132
|
-
expect(box).toHaveStyle('padding: 4px');
|
|
133
|
-
});
|
package/src/Box/Box.tsx
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { createElement, forwardRef } from 'react';
|
|
2
|
-
import { ResponsiveStyleValue, useStyles } from '@marigold/system';
|
|
3
|
-
import {
|
|
4
|
-
PolymorphicPropsWithRef,
|
|
5
|
-
PolymorphicComponentWithRef,
|
|
6
|
-
} from '@marigold/types';
|
|
7
|
-
|
|
8
|
-
export type BoxOwnProps = {
|
|
9
|
-
className?: string;
|
|
10
|
-
variant?: string | string[];
|
|
11
|
-
|
|
12
|
-
display?: ResponsiveStyleValue<string>;
|
|
13
|
-
|
|
14
|
-
height?: ResponsiveStyleValue<number | string>;
|
|
15
|
-
width?: ResponsiveStyleValue<number | string>;
|
|
16
|
-
minWidth?: ResponsiveStyleValue<number | string>;
|
|
17
|
-
maxWidth?: ResponsiveStyleValue<number | string>;
|
|
18
|
-
|
|
19
|
-
position?: ResponsiveStyleValue<string>;
|
|
20
|
-
top?: ResponsiveStyleValue<number | string>;
|
|
21
|
-
bottom?: ResponsiveStyleValue<number | string>;
|
|
22
|
-
right?: ResponsiveStyleValue<number | string>;
|
|
23
|
-
left?: ResponsiveStyleValue<number | string>;
|
|
24
|
-
zIndex?: ResponsiveStyleValue<number | string>;
|
|
25
|
-
|
|
26
|
-
p?: ResponsiveStyleValue<number | string>;
|
|
27
|
-
px?: ResponsiveStyleValue<number | string>;
|
|
28
|
-
py?: ResponsiveStyleValue<number | string>;
|
|
29
|
-
pt?: ResponsiveStyleValue<number | string>;
|
|
30
|
-
pb?: ResponsiveStyleValue<number | string>;
|
|
31
|
-
pl?: ResponsiveStyleValue<number | string>;
|
|
32
|
-
pr?: ResponsiveStyleValue<number | string>;
|
|
33
|
-
|
|
34
|
-
m?: ResponsiveStyleValue<number | string>;
|
|
35
|
-
mx?: ResponsiveStyleValue<number | string>;
|
|
36
|
-
my?: ResponsiveStyleValue<number | string>;
|
|
37
|
-
mt?: ResponsiveStyleValue<number | string>;
|
|
38
|
-
mb?: ResponsiveStyleValue<number | string>;
|
|
39
|
-
ml?: ResponsiveStyleValue<number | string>;
|
|
40
|
-
mr?: ResponsiveStyleValue<number | string>;
|
|
41
|
-
|
|
42
|
-
flexDirection?: ResponsiveStyleValue<string>;
|
|
43
|
-
flexWrap?: ResponsiveStyleValue<string>;
|
|
44
|
-
flexShrink?: ResponsiveStyleValue<number | string>;
|
|
45
|
-
flexGrow?: ResponsiveStyleValue<number | string>;
|
|
46
|
-
alignItems?: ResponsiveStyleValue<string>;
|
|
47
|
-
justifyContent?: ResponsiveStyleValue<string>;
|
|
48
|
-
|
|
49
|
-
bg?: ResponsiveStyleValue<number | string>;
|
|
50
|
-
border?: ResponsiveStyleValue<number | string>;
|
|
51
|
-
borderRadius?: ResponsiveStyleValue<number | string>;
|
|
52
|
-
boxShadow?: ResponsiveStyleValue<number | string>;
|
|
53
|
-
opacity?: ResponsiveStyleValue<number | string>;
|
|
54
|
-
overflow?: ResponsiveStyleValue<string>;
|
|
55
|
-
|
|
56
|
-
transition?: ResponsiveStyleValue<number | string>;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export type BoxProps = PolymorphicPropsWithRef<BoxOwnProps, 'div'>;
|
|
60
|
-
|
|
61
|
-
export const Box: PolymorphicComponentWithRef<BoxOwnProps, 'div'> = forwardRef(
|
|
62
|
-
(
|
|
63
|
-
{
|
|
64
|
-
variant,
|
|
65
|
-
as = 'div',
|
|
66
|
-
children,
|
|
67
|
-
className,
|
|
68
|
-
display,
|
|
69
|
-
height,
|
|
70
|
-
width,
|
|
71
|
-
minWidth,
|
|
72
|
-
maxWidth,
|
|
73
|
-
position,
|
|
74
|
-
top,
|
|
75
|
-
bottom,
|
|
76
|
-
right,
|
|
77
|
-
left,
|
|
78
|
-
zIndex,
|
|
79
|
-
p,
|
|
80
|
-
px,
|
|
81
|
-
py,
|
|
82
|
-
pt,
|
|
83
|
-
pb,
|
|
84
|
-
pl,
|
|
85
|
-
pr,
|
|
86
|
-
m,
|
|
87
|
-
mx,
|
|
88
|
-
my,
|
|
89
|
-
mt,
|
|
90
|
-
mb,
|
|
91
|
-
ml,
|
|
92
|
-
mr,
|
|
93
|
-
flexDirection,
|
|
94
|
-
flexWrap,
|
|
95
|
-
flexShrink,
|
|
96
|
-
flexGrow,
|
|
97
|
-
alignItems,
|
|
98
|
-
justifyContent,
|
|
99
|
-
bg,
|
|
100
|
-
border,
|
|
101
|
-
borderRadius,
|
|
102
|
-
boxShadow,
|
|
103
|
-
opacity,
|
|
104
|
-
overflow,
|
|
105
|
-
transition,
|
|
106
|
-
...props
|
|
107
|
-
},
|
|
108
|
-
ref
|
|
109
|
-
) => {
|
|
110
|
-
const cn = useStyles({
|
|
111
|
-
element: as,
|
|
112
|
-
variant,
|
|
113
|
-
className,
|
|
114
|
-
css: {
|
|
115
|
-
display,
|
|
116
|
-
height,
|
|
117
|
-
width,
|
|
118
|
-
minWidth,
|
|
119
|
-
maxWidth,
|
|
120
|
-
position,
|
|
121
|
-
top,
|
|
122
|
-
bottom,
|
|
123
|
-
right,
|
|
124
|
-
left,
|
|
125
|
-
zIndex,
|
|
126
|
-
p,
|
|
127
|
-
px,
|
|
128
|
-
py,
|
|
129
|
-
pt,
|
|
130
|
-
pb,
|
|
131
|
-
pl,
|
|
132
|
-
pr,
|
|
133
|
-
m,
|
|
134
|
-
mx,
|
|
135
|
-
my,
|
|
136
|
-
mt,
|
|
137
|
-
mb,
|
|
138
|
-
ml,
|
|
139
|
-
mr,
|
|
140
|
-
flexDirection,
|
|
141
|
-
flexWrap,
|
|
142
|
-
flexShrink,
|
|
143
|
-
flexGrow,
|
|
144
|
-
alignItems,
|
|
145
|
-
justifyContent,
|
|
146
|
-
bg,
|
|
147
|
-
border,
|
|
148
|
-
borderRadius,
|
|
149
|
-
boxShadow,
|
|
150
|
-
opacity,
|
|
151
|
-
overflow,
|
|
152
|
-
transition,
|
|
153
|
-
},
|
|
154
|
-
});
|
|
155
|
-
return createElement(as, { ...props, ref, className: cn }, children);
|
|
156
|
-
}
|
|
157
|
-
);
|
package/src/Box/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Box';
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
|
|
2
|
-
import { Facebook } from '@marigold/icons';
|
|
3
|
-
import { Button } from './Button';
|
|
4
|
-
import { useStyles } from '@marigold/system';
|
|
5
|
-
|
|
6
|
-
<Meta title="Components/Button" />
|
|
7
|
-
|
|
8
|
-
# Button
|
|
9
|
-
|
|
10
|
-
## Description
|
|
11
|
-
|
|
12
|
-
With the Button component you can render a `button` element.
|
|
13
|
-
The style variant and size of the button can be added with the variant prop and is composed like `variant.size`.
|
|
14
|
-
|
|
15
|
-
## Properties
|
|
16
|
-
|
|
17
|
-
| Property | Type | Default |
|
|
18
|
-
| :------------------- | :--------------------------------------------------------------------------------------------------- | :-------------- |
|
|
19
|
-
| `variant` (optional) | `primary.small`, `primary.large`, `secondary.small`, `secondary.large`, `ghost.small`, `ghost.large` | `primary.large` |
|
|
20
|
-
|
|
21
|
-
## Import
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
import { Button } from '@marigold/components';
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Usage
|
|
28
|
-
|
|
29
|
-
### Large
|
|
30
|
-
|
|
31
|
-
<Canvas>
|
|
32
|
-
<Story name="primary.large">
|
|
33
|
-
<Button variant="primary.large">Primary</Button>
|
|
34
|
-
</Story>
|
|
35
|
-
<Story name="secondary.large">
|
|
36
|
-
<Button variant="secondary.large">Secondary</Button>
|
|
37
|
-
</Story>
|
|
38
|
-
<Story name="ghost.large">
|
|
39
|
-
<Button variant="ghost.large">Ghost</Button>
|
|
40
|
-
</Story>
|
|
41
|
-
<Story name="text.large">
|
|
42
|
-
<Button variant="text.large">Text Only</Button>
|
|
43
|
-
</Story>
|
|
44
|
-
</Canvas>
|
|
45
|
-
|
|
46
|
-
### Small
|
|
47
|
-
|
|
48
|
-
<Canvas>
|
|
49
|
-
<Story name="primary.small">
|
|
50
|
-
<Button variant="primary.small">Primary</Button>
|
|
51
|
-
</Story>
|
|
52
|
-
<Story name="secondary.small">
|
|
53
|
-
<Button variant="secondary.small">Secondary</Button>
|
|
54
|
-
</Story>
|
|
55
|
-
<Story name="ghost.small">
|
|
56
|
-
<Button variant="ghost.small">Ghost</Button>
|
|
57
|
-
</Story>
|
|
58
|
-
<Story name="text.small">
|
|
59
|
-
<Button variant="text.small">Text Only</Button>
|
|
60
|
-
</Story>
|
|
61
|
-
</Canvas>
|
|
62
|
-
|
|
63
|
-
### Disabled
|
|
64
|
-
|
|
65
|
-
<Canvas>
|
|
66
|
-
<Story name="primary.large.disabled">
|
|
67
|
-
<Button variant="primary.large" disabled>
|
|
68
|
-
Primary Large Disabled
|
|
69
|
-
</Button>
|
|
70
|
-
</Story>
|
|
71
|
-
<Story name="secondary.large.disabled">
|
|
72
|
-
<Button variant="secondary.large" disabled>
|
|
73
|
-
Secondary Large Disabled
|
|
74
|
-
</Button>
|
|
75
|
-
</Story>
|
|
76
|
-
<Story name="ghost.large.disabled">
|
|
77
|
-
<Button variant="ghost.large" disabled>
|
|
78
|
-
Ghost Large Disabled
|
|
79
|
-
</Button>
|
|
80
|
-
</Story>
|
|
81
|
-
<Story name="text.large.disabled">
|
|
82
|
-
<Button variant="text.large" disabled>
|
|
83
|
-
Text Only Large Disabled
|
|
84
|
-
</Button>
|
|
85
|
-
</Story>
|
|
86
|
-
</Canvas>
|
|
87
|
-
|
|
88
|
-
### Default with icon
|
|
89
|
-
|
|
90
|
-
<Canvas>
|
|
91
|
-
<Story name="primary.large with default icon">
|
|
92
|
-
<Button variant="primary.large">
|
|
93
|
-
<Facebook /> Like me!
|
|
94
|
-
</Button>
|
|
95
|
-
</Story>
|
|
96
|
-
<Story name="primary.small with default icon">
|
|
97
|
-
<Button variant="primary.small">
|
|
98
|
-
<Facebook /> Like me!
|
|
99
|
-
</Button>
|
|
100
|
-
</Story>
|
|
101
|
-
<Story name="secondary.large with default icon">
|
|
102
|
-
<Button variant="secondary.large">
|
|
103
|
-
<Facebook /> Like me!
|
|
104
|
-
</Button>
|
|
105
|
-
</Story>
|
|
106
|
-
<Story name="secondary.small with default icon">
|
|
107
|
-
<Button variant="secondary.small">
|
|
108
|
-
<Facebook /> Like me!
|
|
109
|
-
</Button>
|
|
110
|
-
</Story>
|
|
111
|
-
<Story name="ghost.large with default icon">
|
|
112
|
-
<Button variant="ghost.large">
|
|
113
|
-
<Facebook /> Like me!
|
|
114
|
-
</Button>
|
|
115
|
-
</Story>
|
|
116
|
-
<Story name="ghost.small with default icon">
|
|
117
|
-
<Button variant="ghost.small">
|
|
118
|
-
<Facebook /> Like me!
|
|
119
|
-
</Button>
|
|
120
|
-
</Story>
|
|
121
|
-
<Story name="text.large with default icon">
|
|
122
|
-
<Button variant="text.large">
|
|
123
|
-
<Facebook /> Like me!
|
|
124
|
-
</Button>
|
|
125
|
-
</Story>
|
|
126
|
-
<Story name="text.small with default icon">
|
|
127
|
-
<Button variant="text.small">
|
|
128
|
-
<Facebook /> Like me!
|
|
129
|
-
</Button>
|
|
130
|
-
</Story>
|
|
131
|
-
</Canvas>
|
|
132
|
-
|
|
133
|
-
### Large with large icon
|
|
134
|
-
|
|
135
|
-
<Canvas>
|
|
136
|
-
<Story name="primary.large with large icon">
|
|
137
|
-
<Button variant="primary.large">
|
|
138
|
-
<Facebook size={48} /> Like me!
|
|
139
|
-
</Button>
|
|
140
|
-
</Story>
|
|
141
|
-
</Canvas>
|
|
142
|
-
|
|
143
|
-
### Small with small icon
|
|
144
|
-
|
|
145
|
-
<Canvas>
|
|
146
|
-
<Story name="primary.small with small icon">
|
|
147
|
-
<Button variant="primary.small">
|
|
148
|
-
<Facebook size={20} /> Like me!
|
|
149
|
-
</Button>
|
|
150
|
-
</Story>
|
|
151
|
-
</Canvas>
|
|
152
|
-
|
|
153
|
-
### With color
|
|
154
|
-
|
|
155
|
-
<Canvas>
|
|
156
|
-
<Story name="with color">
|
|
157
|
-
<Button variant="primary.small">
|
|
158
|
-
<Facebook fill="black" /> Like me!
|
|
159
|
-
</Button>
|
|
160
|
-
</Story>
|
|
161
|
-
</Canvas>
|
|
162
|
-
|
|
163
|
-
### Custom styled
|
|
164
|
-
|
|
165
|
-
<Canvas>
|
|
166
|
-
<Story name="custom">
|
|
167
|
-
<Button
|
|
168
|
-
variant="primary.small"
|
|
169
|
-
className={useStyles({
|
|
170
|
-
bg: '#3b5998',
|
|
171
|
-
})}
|
|
172
|
-
>
|
|
173
|
-
<Facebook /> Like me!
|
|
174
|
-
</Button>
|
|
175
|
-
</Story>
|
|
176
|
-
</Canvas>
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
|
|
2
|
-
import { Checkbox } from './Checkbox';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { useStyles } from '@marigold/system';
|
|
5
|
-
|
|
6
|
-
<Meta title="Components/Checkbox" />
|
|
7
|
-
|
|
8
|
-
# Checkbox
|
|
9
|
-
|
|
10
|
-
## Description
|
|
11
|
-
|
|
12
|
-
With the Checkbox component you can add a HTML `<input>` element with `type="checkbox"` to your form.
|
|
13
|
-
The element uses always the themeSection with the name: `checkbox` in your given theme. The variant in your section can be added with the variant prop. The default variant is `default`.
|
|
14
|
-
|
|
15
|
-
## Properties
|
|
16
|
-
|
|
17
|
-
| Property | Type | Default |
|
|
18
|
-
| :-------------------- | :-------- | :-------- |
|
|
19
|
-
| `id` | `string` | |
|
|
20
|
-
| `variant` (optional) | `string` | `default` |
|
|
21
|
-
| `label` (optional) | `string` | |
|
|
22
|
-
| `required` (optional) | `boolean` | |
|
|
23
|
-
|
|
24
|
-
## Import
|
|
25
|
-
|
|
26
|
-
```tsx
|
|
27
|
-
import { Checkbox } from '@marigold/components';
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Usage
|
|
31
|
-
|
|
32
|
-
### Checkbox standard labeled
|
|
33
|
-
|
|
34
|
-
<Canvas>
|
|
35
|
-
<Story name="CheckboxOne">
|
|
36
|
-
{() => {
|
|
37
|
-
const [isChecked, setChecked] = React.useState(false);
|
|
38
|
-
const onChange = () => {
|
|
39
|
-
setChecked(!isChecked);
|
|
40
|
-
};
|
|
41
|
-
return (
|
|
42
|
-
<Checkbox
|
|
43
|
-
id="myCheckbox"
|
|
44
|
-
name="myCheckbox"
|
|
45
|
-
onChange={onChange}
|
|
46
|
-
checked={isChecked}
|
|
47
|
-
value="Checkbox"
|
|
48
|
-
label="check if you like Marigold"
|
|
49
|
-
/>
|
|
50
|
-
);
|
|
51
|
-
}}
|
|
52
|
-
</Story>
|
|
53
|
-
</Canvas>
|
|
54
|
-
|
|
55
|
-
### Checkbox checked, disabled and custom styled
|
|
56
|
-
|
|
57
|
-
<Canvas>
|
|
58
|
-
<Story name="CheckboxTwo">
|
|
59
|
-
<>
|
|
60
|
-
<Checkbox id="checkboxOne" checked />
|
|
61
|
-
<Checkbox id="checkboxTwo" disabled />
|
|
62
|
-
<Checkbox id="checkboxThree" checked disabled />
|
|
63
|
-
</>
|
|
64
|
-
</Story>
|
|
65
|
-
</Canvas>
|
|
66
|
-
|
|
67
|
-
### Checkbox with required label
|
|
68
|
-
|
|
69
|
-
<Canvas>
|
|
70
|
-
<Story name="CheckboxThree">
|
|
71
|
-
<div>
|
|
72
|
-
<Checkbox
|
|
73
|
-
checked
|
|
74
|
-
id="required"
|
|
75
|
-
value="required"
|
|
76
|
-
required
|
|
77
|
-
label="This label is required"
|
|
78
|
-
/>
|
|
79
|
-
</div>
|
|
80
|
-
</Story>
|
|
81
|
-
</Canvas>
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
|
|
2
|
-
import { Column } from './Column';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { useStyles } from '@marigold/system';
|
|
5
|
-
|
|
6
|
-
<Meta title="Components/Column" />
|
|
7
|
-
|
|
8
|
-
# Column
|
|
9
|
-
|
|
10
|
-
## Description
|
|
11
|
-
|
|
12
|
-
With the Column component you can add a column with a width in percent of the full content.
|
|
13
|
-
|
|
14
|
-
## Properties
|
|
15
|
-
|
|
16
|
-
| Property | Type | Default |
|
|
17
|
-
| :----------------- | :-------------------------------------- | :------ |
|
|
18
|
-
| `width` (optional) | `1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12` | `12` |
|
|
19
|
-
|
|
20
|
-
## Import
|
|
21
|
-
|
|
22
|
-
```tsx
|
|
23
|
-
import { Column } from '@marigold/components';
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Usage
|
|
27
|
-
|
|
28
|
-
<Canvas>
|
|
29
|
-
<Story name="Column">
|
|
30
|
-
<Column
|
|
31
|
-
className={useStyles({
|
|
32
|
-
textAlign: 'center',
|
|
33
|
-
border: '1px solid',
|
|
34
|
-
padding: 2,
|
|
35
|
-
margin: 2,
|
|
36
|
-
})}
|
|
37
|
-
>
|
|
38
|
-
width=12
|
|
39
|
-
</Column>
|
|
40
|
-
<Column
|
|
41
|
-
width={6}
|
|
42
|
-
className={useStyles({
|
|
43
|
-
textAlign: 'center',
|
|
44
|
-
border: '1px solid',
|
|
45
|
-
padding: 2,
|
|
46
|
-
margin: 2,
|
|
47
|
-
})}
|
|
48
|
-
>
|
|
49
|
-
width=6
|
|
50
|
-
</Column>
|
|
51
|
-
<Column
|
|
52
|
-
width={3}
|
|
53
|
-
className={useStyles({
|
|
54
|
-
textAlign: 'center',
|
|
55
|
-
border: '1px solid',
|
|
56
|
-
padding: 2,
|
|
57
|
-
margin: 2,
|
|
58
|
-
})}
|
|
59
|
-
>
|
|
60
|
-
width=3
|
|
61
|
-
</Column>
|
|
62
|
-
<Column
|
|
63
|
-
width={2}
|
|
64
|
-
className={useStyles({
|
|
65
|
-
textAlign: 'center',
|
|
66
|
-
border: '1px solid',
|
|
67
|
-
padding: 2,
|
|
68
|
-
margin: 2,
|
|
69
|
-
})}
|
|
70
|
-
>
|
|
71
|
-
width=2
|
|
72
|
-
</Column>
|
|
73
|
-
</Story>
|
|
74
|
-
</Canvas>
|