@marigold/components 0.2.0 → 0.3.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/CHANGELOG.md +294 -0
- package/dist/ActionGroup/ActionGroup.d.ts +1 -2
- package/dist/ActionGroup/ActionGroup.stories.d.ts +5 -0
- package/dist/Alert/Alert.d.ts +10 -13
- 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 +5 -0
- package/dist/Button/Button.stories.d.ts +5 -0
- package/dist/Card/Card.d.ts +5 -0
- package/dist/Card/Card.stories.d.ts +5 -0
- package/dist/Checkbox/Checkbox.d.ts +10 -5
- package/dist/Checkbox/Checkbox.stories.d.ts +5 -0
- package/dist/Checkbox/CheckboxIcons.d.ts +9 -9
- 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 +5 -2
- package/dist/Dialog/Dialog.stories.d.ts +5 -0
- package/dist/Dialog/ModalDialog.d.ts +4 -1
- package/dist/Divider/Divider.d.ts +5 -0
- package/dist/Divider/Divider.stories.d.ts +5 -0
- package/dist/Field/Field.d.ts +2 -0
- 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 +12 -1
- package/dist/Label/Label.stories.d.ts +5 -0
- package/dist/Link/Link.d.ts +4 -1
- 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 -3
- package/dist/Provider/index.d.ts +1 -1
- package/dist/Radio/Radio.d.ts +6 -0
- package/dist/Radio/RadioIcons.d.ts +1 -0
- package/dist/Select/ListBox.d.ts +1 -0
- package/dist/Select/ListBoxSection.d.ts +1 -0
- package/dist/Select/Option.d.ts +1 -0
- package/dist/Select/Select.d.ts +15 -1
- 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.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 +5 -0
- 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 +480 -496
- 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 +415 -441
- package/dist/components.esm.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/theme.d.ts +23 -48
- package/package.json +4 -1
- package/src/ActionGroup/ActionGroup.stories.tsx +47 -0
- package/src/ActionGroup/ActionGroup.test.tsx +36 -36
- package/src/ActionGroup/ActionGroup.tsx +17 -28
- package/src/Alert/Alert.stories.tsx +32 -0
- package/src/Alert/Alert.test.tsx +4 -1
- package/src/Alert/Alert.tsx +18 -3
- package/src/Badge/Badge.stories.tsx +38 -0
- package/src/Badge/Badge.test.tsx +5 -1
- package/src/Badge/Badge.tsx +13 -1
- package/src/Box.ts +2 -0
- package/src/Button/{Button.stories.mdx → Button.stories.tsx} +10 -17
- package/src/Button/Button.test.tsx +34 -11
- package/src/Button/Button.tsx +17 -3
- package/src/Card/{Card.stories.mdx → Card.stories.tsx} +9 -17
- package/src/Card/Card.test.tsx +8 -3
- package/src/Card/Card.tsx +13 -1
- package/src/Checkbox/Checkbox.stories.mdx +11 -0
- package/src/Checkbox/Checkbox.stories.tsx +78 -0
- package/src/Checkbox/Checkbox.test.tsx +77 -8
- package/src/Checkbox/Checkbox.tsx +70 -90
- package/src/Checkbox/CheckboxIcons.tsx +51 -41
- package/src/Column/Column.stories.tsx +33 -0
- 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.mdx → Dialog.stories.tsx} +33 -18
- package/src/Dialog/Dialog.test.tsx +91 -20
- package/src/Dialog/Dialog.tsx +63 -17
- package/src/Dialog/ModalDialog.tsx +33 -4
- package/src/Divider/{Divider.stories.mdx → Divider.stories.tsx} +10 -17
- package/src/Divider/Divider.test.tsx +13 -5
- package/src/Divider/Divider.tsx +12 -0
- package/src/Field/{Field.stories.mdx → Field.stories.tsx} +33 -20
- package/src/Field/Field.test.tsx +55 -5
- package/src/Field/Field.tsx +10 -8
- 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.mdx → Input.stories.tsx} +10 -17
- package/src/Input/Input.test.tsx +7 -3
- package/src/Input/Input.tsx +13 -1
- package/src/Label/{Label.stories.mdx → Label.stories.tsx} +10 -21
- package/src/Label/Label.test.tsx +25 -4
- package/src/Label/Label.tsx +42 -9
- package/src/Link/Link.stories.tsx +35 -0
- package/src/Link/Link.test.tsx +6 -2
- package/src/Link/Link.tsx +10 -0
- package/src/Menu/{Menu.stories.mdx → Menu.stories.tsx} +13 -32
- package/src/Menu/Menu.test.tsx +7 -2
- package/src/Menu/Menu.tsx +10 -0
- package/src/MenuItem/MenuItem.stories.tsx +30 -0
- package/src/MenuItem/MenuItem.test.tsx +7 -2
- package/src/MenuItem/MenuItem.tsx +12 -0
- package/src/Message/Message.stories.tsx +30 -0
- package/src/Message/Message.test.tsx +4 -1
- package/src/Message/Message.tsx +17 -5
- package/src/Provider/MarigoldProvider.test.tsx +65 -55
- package/src/Provider/MarigoldProvider.tsx +37 -19
- package/src/Provider/index.ts +2 -1
- package/src/Radio/Radio.stories.mdx +11 -0
- package/src/Radio/Radio.test.tsx +36 -2
- package/src/Radio/Radio.tsx +13 -2
- package/src/Radio/RadioIcons.tsx +1 -1
- package/src/Select/ListBox.tsx +1 -0
- package/src/Select/{Select.stories.mdx → Select.stories.tsx} +23 -20
- package/src/Select/Select.test.tsx +39 -1
- package/src/Select/Select.tsx +24 -13
- 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 +16 -7
- package/src/Text/{Text.stories.mdx → Text.stories.tsx} +20 -19
- package/src/Text/Text.test.tsx +2 -2
- package/src/Text/Text.tsx +12 -0
- package/src/Textarea/{Textarea.stories.mdx → Textarea.stories.tsx} +14 -24
- package/src/Textarea/Textarea.test.tsx +7 -3
- package/src/Textarea/Textarea.tsx +13 -1
- package/src/ValidationMessage/{ValidationMessage.stories.mdx → ValidationMessage.stories.tsx} +8 -17
- package/src/ValidationMessage/ValidationMessage.test.tsx +7 -2
- package/src/ValidationMessage/ValidationMessage.tsx +12 -0
- 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 +2 -2
- package/src/theme.ts +49 -48
- package/dist/Box/Box.d.ts +0 -47
- 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/ActionGroup/ActionGroup.stories.mdx +0 -62
- package/src/Alert/Alert.stories.mdx +0 -35
- package/src/Badge/Badge.stories.mdx +0 -57
- package/src/Box/Box.stories.mdx +0 -334
- package/src/Box/Box.test.tsx +0 -133
- package/src/Box/Box.tsx +0 -165
- package/src/Box/index.ts +0 -1
- package/src/Column/Column.stories.mdx +0 -49
- package/src/Columns/Columns.stories.mdx +0 -65
- package/src/Container/Container.stories.mdx +0 -19
- package/src/Heading/Heading.stories.mdx +0 -39
- 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 -39
- 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 -36
- package/src/Link/Link.stories.mdx +0 -45
- package/src/MenuItem/MenuItem.stories.mdx +0 -37
- package/src/Message/Message.stories.mdx +0 -44
- package/src/Slider/Slider.stories.mdx +0 -31
- package/src/Stack/Stack.stories.mdx +0 -51
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, ComponentStory } from '@storybook/react';
|
|
3
|
+
import { Stack } from './Stack';
|
|
4
|
+
import { Text } from '../Text';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/Stack',
|
|
8
|
+
argTypes: {
|
|
9
|
+
space: {
|
|
10
|
+
control: {
|
|
11
|
+
type: 'select',
|
|
12
|
+
},
|
|
13
|
+
options: [
|
|
14
|
+
'none',
|
|
15
|
+
'xxsmall',
|
|
16
|
+
'xsmall',
|
|
17
|
+
'small',
|
|
18
|
+
'medium',
|
|
19
|
+
'large',
|
|
20
|
+
'xlarge',
|
|
21
|
+
'xxlarge',
|
|
22
|
+
],
|
|
23
|
+
description: 'Responsive Style Value',
|
|
24
|
+
table: {
|
|
25
|
+
defaultValue: {
|
|
26
|
+
summary: 'none',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
align: {
|
|
31
|
+
control: {
|
|
32
|
+
type: 'select',
|
|
33
|
+
},
|
|
34
|
+
options: ['left', 'right', 'center'],
|
|
35
|
+
description: 'HTML element style',
|
|
36
|
+
table: {
|
|
37
|
+
defaultValue: {
|
|
38
|
+
summary: 'left',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
} as Meta;
|
|
44
|
+
|
|
45
|
+
export const Basic: ComponentStory<typeof Stack> = args => (
|
|
46
|
+
<Stack {...args}>
|
|
47
|
+
<Text as="h2" variant="headline2">
|
|
48
|
+
Heading
|
|
49
|
+
</Text>
|
|
50
|
+
<Text>
|
|
51
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
|
|
52
|
+
dignissim dapibus elit, vel egestas felis pharetra non. Cras malesuada,
|
|
53
|
+
massa nec ultricies efficitur, lectus ante consequat magna, a porttitor
|
|
54
|
+
massa ex ut quam.
|
|
55
|
+
</Text>
|
|
56
|
+
</Stack>
|
|
57
|
+
);
|
package/src/Stack/Stack.test.tsx
CHANGED
|
@@ -16,20 +16,26 @@ const theme = {
|
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
const getTopPadding = (element: HTMLElement) =>
|
|
20
|
+
getComputedStyle(element).getPropertyValue('padding-top');
|
|
21
|
+
|
|
19
22
|
test('default space is "none"', () => {
|
|
20
23
|
render(
|
|
21
24
|
<ThemeProvider theme={theme}>
|
|
22
25
|
<Stack>
|
|
23
26
|
<Text>first</Text>
|
|
24
27
|
<Text>second</Text>
|
|
28
|
+
<Text>third</Text>
|
|
25
29
|
</Stack>
|
|
26
30
|
</ThemeProvider>
|
|
27
31
|
);
|
|
28
|
-
const first = screen.getByText(/first/)
|
|
29
|
-
const second = screen.getByText(/second/)
|
|
32
|
+
const first = screen.getByText(/first/).parentElement!;
|
|
33
|
+
const second = screen.getByText(/second/).parentElement!;
|
|
34
|
+
const third = screen.getByText(/third/).parentElement!;
|
|
30
35
|
|
|
31
|
-
expect(first).
|
|
36
|
+
expect(getTopPadding(first)).toEqual('');
|
|
32
37
|
expect(second).toHaveStyle(`padding-top: 0px`);
|
|
38
|
+
expect(third).toHaveStyle(`padding-top: 0px`);
|
|
33
39
|
});
|
|
34
40
|
|
|
35
41
|
test('accepts and uses spacing from theme', () => {
|
|
@@ -38,14 +44,17 @@ test('accepts and uses spacing from theme', () => {
|
|
|
38
44
|
<Stack space="small">
|
|
39
45
|
<Text>first</Text>
|
|
40
46
|
<Text>second</Text>
|
|
47
|
+
<Text>third</Text>
|
|
41
48
|
</Stack>
|
|
42
49
|
</ThemeProvider>
|
|
43
50
|
);
|
|
44
51
|
const first = screen.getByText(/first/);
|
|
45
52
|
const second = screen.getByText(/second/);
|
|
53
|
+
const third = screen.getByText(/third/);
|
|
46
54
|
|
|
47
|
-
expect(first
|
|
55
|
+
expect(getTopPadding(first)).toEqual('');
|
|
48
56
|
expect(second.parentElement).toHaveStyle(`padding-top: 2px`);
|
|
57
|
+
expect(third.parentElement).toHaveStyle(`padding-top: 2px`);
|
|
49
58
|
});
|
|
50
59
|
|
|
51
60
|
test('aligns children left by default', () => {
|
|
@@ -104,13 +113,13 @@ test('supports nesting', () => {
|
|
|
104
113
|
const fourth = screen.getByText(/fourth/);
|
|
105
114
|
const lowerStack = screen.getByTestId('lowerStack');
|
|
106
115
|
|
|
107
|
-
expect(upperStack.parentElement).
|
|
116
|
+
expect(getTopPadding(upperStack.parentElement!)).toEqual('');
|
|
108
117
|
expect(lowerStack.parentElement).toHaveStyle(`padding-top: 8px`);
|
|
109
118
|
|
|
110
|
-
expect(first.parentElement).
|
|
119
|
+
expect(getTopPadding(first.parentElement!)).toEqual('');
|
|
111
120
|
expect(second.parentElement).toHaveStyle(`padding-top: 2px`);
|
|
112
121
|
|
|
113
|
-
expect(third.parentElement).
|
|
122
|
+
expect(getTopPadding(third.parentElement!)).toEqual('');
|
|
114
123
|
expect(fourth.parentElement).toHaveStyle(`padding-top: 2px`);
|
|
115
124
|
});
|
|
116
125
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, ComponentStory } from '@storybook/react';
|
|
2
3
|
import { Text } from './Text';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
title
|
|
6
|
-
argTypes
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Text',
|
|
7
|
+
argTypes: {
|
|
7
8
|
as: {
|
|
8
9
|
control: {
|
|
9
10
|
type: 'select',
|
|
10
11
|
},
|
|
11
|
-
options: ['span', 'p'],
|
|
12
|
-
description: 'Set
|
|
12
|
+
options: ['span', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
|
|
13
|
+
description: 'Set HTML element',
|
|
13
14
|
table: {
|
|
14
15
|
defaultValue: {
|
|
15
16
|
summary: 'span',
|
|
@@ -20,8 +21,16 @@ import { Text } from './Text';
|
|
|
20
21
|
control: {
|
|
21
22
|
type: 'select',
|
|
22
23
|
},
|
|
23
|
-
options: [
|
|
24
|
-
|
|
24
|
+
options: [
|
|
25
|
+
'body',
|
|
26
|
+
'headline1',
|
|
27
|
+
'headline2',
|
|
28
|
+
'headline3',
|
|
29
|
+
'headline4',
|
|
30
|
+
'headline5',
|
|
31
|
+
'headline6',
|
|
32
|
+
],
|
|
33
|
+
description: 'CHoose between body and different headlines',
|
|
25
34
|
table: {
|
|
26
35
|
defaultValue: {
|
|
27
36
|
summary: 'body',
|
|
@@ -39,12 +48,10 @@ import { Text } from './Text';
|
|
|
39
48
|
},
|
|
40
49
|
},
|
|
41
50
|
},
|
|
42
|
-
}
|
|
43
|
-
|
|
51
|
+
},
|
|
52
|
+
} as Meta;
|
|
44
53
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export const Template = args => (
|
|
54
|
+
export const Basic: ComponentStory<typeof Text> = args => (
|
|
48
55
|
<Text {...args}>
|
|
49
56
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
|
|
50
57
|
dignissim dapibus elit, vel egestas felis pharetra non. Cras malesuada,
|
|
@@ -52,9 +59,3 @@ export const Template = args => (
|
|
|
52
59
|
massa ex ut quam.
|
|
53
60
|
</Text>
|
|
54
61
|
);
|
|
55
|
-
|
|
56
|
-
<Canvas>
|
|
57
|
-
<Story name="Default">{Template.bind({})}</Story>
|
|
58
|
-
</Canvas>
|
|
59
|
-
|
|
60
|
-
<ArgsTable story="Default" />
|
package/src/Text/Text.test.tsx
CHANGED
|
@@ -15,7 +15,7 @@ const theme = {
|
|
|
15
15
|
body: {
|
|
16
16
|
fontFamily: 'Oswald Regular',
|
|
17
17
|
},
|
|
18
|
-
|
|
18
|
+
headline1: {
|
|
19
19
|
fontFamily: 'Inter',
|
|
20
20
|
},
|
|
21
21
|
},
|
|
@@ -35,7 +35,7 @@ test('uses `text.body` as default variant', () => {
|
|
|
35
35
|
test('allows to change variants via `variant` prop (with "text" prefix)', () => {
|
|
36
36
|
render(
|
|
37
37
|
<ThemeProvider theme={theme}>
|
|
38
|
-
<Text variant="
|
|
38
|
+
<Text variant="headline1">text</Text>
|
|
39
39
|
</ThemeProvider>
|
|
40
40
|
);
|
|
41
41
|
const text = screen.getByText(/text/);
|
package/src/Text/Text.tsx
CHANGED
|
@@ -7,6 +7,16 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import { Box, BoxOwnProps } from '../Box';
|
|
9
9
|
|
|
10
|
+
// Theme Extension
|
|
11
|
+
// ---------------
|
|
12
|
+
export interface TextThemeExtension<Value> {
|
|
13
|
+
text?: {
|
|
14
|
+
[key: string]: Value;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Props
|
|
19
|
+
// ---------------
|
|
10
20
|
export type TextOwnProps = {
|
|
11
21
|
align?: ResponsiveStyleValue<string>;
|
|
12
22
|
color?: ResponsiveStyleValue<string>;
|
|
@@ -17,6 +27,8 @@ export type TextOwnProps = {
|
|
|
17
27
|
|
|
18
28
|
export type TextProps = PolymorphicPropsWithRef<TextOwnProps, 'span'>;
|
|
19
29
|
|
|
30
|
+
// Component
|
|
31
|
+
// ---------------
|
|
20
32
|
export const Text: PolymorphicComponentWithRef<TextOwnProps, 'span'> =
|
|
21
33
|
forwardRef(
|
|
22
34
|
(
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, ComponentStory } from '@storybook/react';
|
|
3
|
+
import { Textarea } from '.';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
title
|
|
6
|
-
argTypes
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Textarea',
|
|
7
|
+
argTypes: {
|
|
7
8
|
variant: {
|
|
8
9
|
control: {
|
|
9
10
|
type: 'text',
|
|
10
11
|
},
|
|
11
12
|
table: {
|
|
12
13
|
defaultValue: {
|
|
13
|
-
summary: '
|
|
14
|
+
summary: '__default',
|
|
14
15
|
},
|
|
15
16
|
},
|
|
16
17
|
},
|
|
@@ -18,18 +19,15 @@ import { Textarea } from '../Textarea';
|
|
|
18
19
|
control: {
|
|
19
20
|
type: 'text',
|
|
20
21
|
},
|
|
21
|
-
description: '
|
|
22
|
+
description: 'Label text',
|
|
23
|
+
defaultValue: 'Textarea Label',
|
|
22
24
|
},
|
|
23
25
|
htmlFor: {
|
|
24
26
|
control: {
|
|
25
27
|
type: 'text',
|
|
26
28
|
},
|
|
27
29
|
description: 'Bind to label',
|
|
28
|
-
|
|
29
|
-
defaultValue: {
|
|
30
|
-
summary: 'textarea',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
30
|
+
defaultValue: 'textareaId',
|
|
33
31
|
},
|
|
34
32
|
error: {
|
|
35
33
|
control: {
|
|
@@ -58,17 +56,9 @@ import { Textarea } from '../Textarea';
|
|
|
58
56
|
},
|
|
59
57
|
},
|
|
60
58
|
},
|
|
61
|
-
}
|
|
62
|
-
|
|
59
|
+
},
|
|
60
|
+
} as Meta;
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
export const Template = args => (
|
|
67
|
-
<Textarea placeholder="Placeholder..." label="Textarea Label" {...args} />
|
|
62
|
+
export const Basic: ComponentStory<typeof Textarea> = args => (
|
|
63
|
+
<Textarea placeholder="Placeholder..." {...args} />
|
|
68
64
|
);
|
|
69
|
-
|
|
70
|
-
<Canvas>
|
|
71
|
-
<Story name="Default">{Template.bind({})}</Story>
|
|
72
|
-
</Canvas>
|
|
73
|
-
|
|
74
|
-
<ArgsTable story="Default" />
|
|
@@ -4,12 +4,16 @@ import { ThemeProvider } from '@marigold/system';
|
|
|
4
4
|
import { Textarea } from '../Textarea';
|
|
5
5
|
|
|
6
6
|
const theme = {
|
|
7
|
+
fonts: {
|
|
8
|
+
body: 'Inter Regular',
|
|
9
|
+
fancy: 'Roboto',
|
|
10
|
+
},
|
|
7
11
|
textarea: {
|
|
8
|
-
|
|
9
|
-
fontFamily: '
|
|
12
|
+
__default: {
|
|
13
|
+
fontFamily: 'body',
|
|
10
14
|
},
|
|
11
15
|
textarea2: {
|
|
12
|
-
fontFamily: '
|
|
16
|
+
fontFamily: 'fancy',
|
|
13
17
|
},
|
|
14
18
|
},
|
|
15
19
|
};
|
|
@@ -6,6 +6,16 @@ import { ValidationMessage } from '../ValidationMessage';
|
|
|
6
6
|
import { Label } from '../Label';
|
|
7
7
|
import { Box } from '../Box';
|
|
8
8
|
|
|
9
|
+
// Theme Extension
|
|
10
|
+
// ---------------
|
|
11
|
+
export interface TextareaThemeExtension<Value> {
|
|
12
|
+
textarea?: {
|
|
13
|
+
[key: string]: Value;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Props
|
|
18
|
+
// ---------------
|
|
9
19
|
export type TextareaProps = {
|
|
10
20
|
variant?: string;
|
|
11
21
|
label?: string;
|
|
@@ -15,8 +25,10 @@ export type TextareaProps = {
|
|
|
15
25
|
errorMessage?: string;
|
|
16
26
|
} & ComponentProps<'textarea'>;
|
|
17
27
|
|
|
28
|
+
// Component
|
|
29
|
+
// ---------------
|
|
18
30
|
export const Textarea: React.FC<TextareaProps> = ({
|
|
19
|
-
variant = '
|
|
31
|
+
variant = '',
|
|
20
32
|
htmlFor = 'textarea',
|
|
21
33
|
label,
|
|
22
34
|
error,
|
package/src/ValidationMessage/{ValidationMessage.stories.mdx → ValidationMessage.stories.tsx}
RENAMED
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, ComponentStory } from '@storybook/react';
|
|
2
3
|
import { ValidationMessage } from './ValidationMessage';
|
|
3
4
|
import { Exclamation } from '@marigold/icons';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
title
|
|
7
|
-
argTypes
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/ValidationMessage',
|
|
8
|
+
argTypes: {
|
|
8
9
|
variant: {
|
|
9
10
|
control: {
|
|
10
11
|
type: 'text',
|
|
11
12
|
},
|
|
12
|
-
description: '?',
|
|
13
13
|
table: {
|
|
14
14
|
defaultValue: {
|
|
15
15
|
summary: 'error',
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
|
-
}
|
|
20
|
-
|
|
19
|
+
},
|
|
20
|
+
} as Meta;
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export const Template = args => (
|
|
22
|
+
export const Basic: ComponentStory<typeof ValidationMessage> = args => (
|
|
26
23
|
<ValidationMessage {...args}>
|
|
27
24
|
<Exclamation />
|
|
28
25
|
Validation message
|
|
29
26
|
</ValidationMessage>
|
|
30
27
|
);
|
|
31
|
-
|
|
32
|
-
<Canvas>
|
|
33
|
-
<Story name="Default">{Template.bind({})}</Story>
|
|
34
|
-
</Canvas>
|
|
35
|
-
|
|
36
|
-
<ArgsTable story="Default" />
|
|
@@ -4,12 +4,17 @@ import { ThemeProvider } from '@marigold/system';
|
|
|
4
4
|
import { ValidationMessage } from './ValidationMessage';
|
|
5
5
|
|
|
6
6
|
const theme = {
|
|
7
|
+
space: {
|
|
8
|
+
none: 0,
|
|
9
|
+
small: 4,
|
|
10
|
+
medium: 8,
|
|
11
|
+
},
|
|
7
12
|
validation: {
|
|
8
13
|
error: {
|
|
9
|
-
p: '
|
|
14
|
+
p: 'medium',
|
|
10
15
|
},
|
|
11
16
|
warning: {
|
|
12
|
-
p: '
|
|
17
|
+
p: 'small',
|
|
13
18
|
},
|
|
14
19
|
},
|
|
15
20
|
};
|
|
@@ -3,10 +3,22 @@ import { ComponentProps } from '@marigold/types';
|
|
|
3
3
|
|
|
4
4
|
import { Box } from '../Box';
|
|
5
5
|
|
|
6
|
+
// Theme Extension
|
|
7
|
+
// ---------------
|
|
8
|
+
export interface ValidationMessageThemeExtension<Value> {
|
|
9
|
+
validation?: {
|
|
10
|
+
[key: string]: Value;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Props
|
|
15
|
+
// ---------------
|
|
6
16
|
export type ValidationMessageProps = {
|
|
7
17
|
variant?: string;
|
|
8
18
|
} & ComponentProps<'span'>;
|
|
9
19
|
|
|
20
|
+
// Component
|
|
21
|
+
// ---------------
|
|
10
22
|
export const ValidationMessage: React.FC<ValidationMessageProps> = ({
|
|
11
23
|
variant = 'error',
|
|
12
24
|
children,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, ComponentStory } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { VisuallyHidden } from './VisuallyHidden';
|
|
5
|
+
import { Text } from '../Text';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Components/Hidden',
|
|
9
|
+
} as Meta;
|
|
10
|
+
|
|
11
|
+
export const Basic: ComponentStory<typeof VisuallyHidden> = ({
|
|
12
|
+
children,
|
|
13
|
+
...args
|
|
14
|
+
}) => (
|
|
15
|
+
<>
|
|
16
|
+
<Text>The Text below is visually hidden</Text>
|
|
17
|
+
<VisuallyHidden {...args}>Invisible!</VisuallyHidden>
|
|
18
|
+
</>
|
|
19
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { VisuallyHidden } from './VisuallyHidden';
|
|
4
|
+
|
|
5
|
+
test('is visually hidden', () => {
|
|
6
|
+
render(<VisuallyHidden>Default</VisuallyHidden>);
|
|
7
|
+
const hidden = screen.getByText('Default');
|
|
8
|
+
|
|
9
|
+
expect(hidden).toHaveStyle(`overflow: hidden`);
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VisuallyHidden } from '@react-aria/visually-hidden';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VisuallyHidden';
|
package/src/index.ts
CHANGED
|
@@ -12,9 +12,9 @@ export * from './Columns';
|
|
|
12
12
|
export * from './Dialog';
|
|
13
13
|
export * from './Divider';
|
|
14
14
|
export * from './Field';
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './Hidden';
|
|
15
|
+
export * from './VisuallyHidden';
|
|
17
16
|
export * from './Image';
|
|
17
|
+
export * from './Inline';
|
|
18
18
|
export * from './Label';
|
|
19
19
|
export * from './Link';
|
|
20
20
|
export * from './Menu';
|
package/src/theme.ts
CHANGED
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
import { type CSSObject, type Theme as Scales } from '@marigold/system';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
3
|
+
// Provider
|
|
4
|
+
// ---------------
|
|
5
|
+
import { type RootThemeExtension } from './Provider';
|
|
6
|
+
|
|
7
|
+
// Components
|
|
8
|
+
// ---------------
|
|
9
|
+
import { type AlertThemeExtension } from './Alert';
|
|
10
|
+
import { type BadgeThemeExtension } from './Badge';
|
|
11
|
+
import { type ButtonThemeExtension } from './Button';
|
|
12
|
+
import { type CardThemeExtension } from './Card';
|
|
13
|
+
import { type CheckboxThemeExtension } from './Checkbox';
|
|
14
|
+
import { type DividerThemeExtension } from './Divider';
|
|
15
|
+
import { type ImageThemeExtension } from './Image';
|
|
16
|
+
import { type InputThemeExtension } from './Input';
|
|
17
|
+
import { type LabelThemeExtension } from './Label';
|
|
18
|
+
import { type LinkThemeExtension } from './Link';
|
|
19
|
+
import { type MenuThemeExtension } from './Menu';
|
|
20
|
+
import { type MenuItemThemeExtension } from './MenuItem';
|
|
21
|
+
import { type MessageThemeExtension } from './Message';
|
|
22
|
+
import { type RadioThemeExtension } from './Radio';
|
|
23
|
+
import { type SelectThemeExtension } from './Select';
|
|
24
|
+
import { type SliderThemeExtension } from './Slider';
|
|
25
|
+
import { type TextThemeExtension } from './Text';
|
|
26
|
+
import { type TextareaThemeExtension } from './Textarea';
|
|
27
|
+
import { type ValidationMessageThemeExtension } from './ValidationMessage';
|
|
28
|
+
|
|
29
|
+
export interface Theme
|
|
30
|
+
extends Scales,
|
|
31
|
+
RootThemeExtension<CSSObject>,
|
|
32
|
+
AlertThemeExtension<CSSObject>,
|
|
33
|
+
BadgeThemeExtension<CSSObject>,
|
|
34
|
+
ButtonThemeExtension<CSSObject>,
|
|
35
|
+
CardThemeExtension<CSSObject>,
|
|
36
|
+
CheckboxThemeExtension<CSSObject>,
|
|
37
|
+
DividerThemeExtension<CSSObject>,
|
|
38
|
+
ImageThemeExtension<CSSObject>,
|
|
39
|
+
InputThemeExtension<CSSObject>,
|
|
40
|
+
LabelThemeExtension<CSSObject>,
|
|
41
|
+
LinkThemeExtension<CSSObject>,
|
|
42
|
+
MenuThemeExtension<CSSObject>,
|
|
43
|
+
MenuItemThemeExtension<CSSObject>,
|
|
44
|
+
MessageThemeExtension<CSSObject>,
|
|
45
|
+
RadioThemeExtension<CSSObject>,
|
|
46
|
+
SelectThemeExtension<CSSObject>,
|
|
47
|
+
SliderThemeExtension<CSSObject>,
|
|
48
|
+
TextThemeExtension<CSSObject>,
|
|
49
|
+
TextareaThemeExtension<CSSObject>,
|
|
50
|
+
ValidationMessageThemeExtension<CSSObject> {}
|
package/dist/Box/Box.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { CSSObject, ResponsiveStyleValue } from '@marigold/system';
|
|
2
|
-
import { PolymorphicPropsWithRef, PolymorphicComponentWithRef } from '@marigold/types';
|
|
3
|
-
export declare type BoxOwnProps = {
|
|
4
|
-
className?: string;
|
|
5
|
-
variant?: string | string[];
|
|
6
|
-
css?: CSSObject;
|
|
7
|
-
display?: ResponsiveStyleValue<string>;
|
|
8
|
-
height?: ResponsiveStyleValue<number | string>;
|
|
9
|
-
width?: ResponsiveStyleValue<number | string>;
|
|
10
|
-
minWidth?: ResponsiveStyleValue<number | string>;
|
|
11
|
-
maxWidth?: ResponsiveStyleValue<number | string>;
|
|
12
|
-
position?: ResponsiveStyleValue<string>;
|
|
13
|
-
top?: ResponsiveStyleValue<number | string>;
|
|
14
|
-
bottom?: ResponsiveStyleValue<number | string>;
|
|
15
|
-
right?: ResponsiveStyleValue<number | string>;
|
|
16
|
-
left?: ResponsiveStyleValue<number | string>;
|
|
17
|
-
zIndex?: ResponsiveStyleValue<number | string>;
|
|
18
|
-
p?: ResponsiveStyleValue<number | string>;
|
|
19
|
-
px?: ResponsiveStyleValue<number | string>;
|
|
20
|
-
py?: ResponsiveStyleValue<number | string>;
|
|
21
|
-
pt?: ResponsiveStyleValue<number | string>;
|
|
22
|
-
pb?: ResponsiveStyleValue<number | string>;
|
|
23
|
-
pl?: ResponsiveStyleValue<number | string>;
|
|
24
|
-
pr?: ResponsiveStyleValue<number | string>;
|
|
25
|
-
m?: ResponsiveStyleValue<number | string>;
|
|
26
|
-
mx?: ResponsiveStyleValue<number | string>;
|
|
27
|
-
my?: ResponsiveStyleValue<number | string>;
|
|
28
|
-
mt?: ResponsiveStyleValue<number | string>;
|
|
29
|
-
mb?: ResponsiveStyleValue<number | string>;
|
|
30
|
-
ml?: ResponsiveStyleValue<number | string>;
|
|
31
|
-
mr?: ResponsiveStyleValue<number | string>;
|
|
32
|
-
flexDirection?: ResponsiveStyleValue<string>;
|
|
33
|
-
flexWrap?: ResponsiveStyleValue<string>;
|
|
34
|
-
flexShrink?: ResponsiveStyleValue<number | string>;
|
|
35
|
-
flexGrow?: ResponsiveStyleValue<number | string>;
|
|
36
|
-
alignItems?: ResponsiveStyleValue<string>;
|
|
37
|
-
justifyContent?: ResponsiveStyleValue<string>;
|
|
38
|
-
bg?: ResponsiveStyleValue<number | string>;
|
|
39
|
-
border?: ResponsiveStyleValue<number | string>;
|
|
40
|
-
borderRadius?: ResponsiveStyleValue<number | string>;
|
|
41
|
-
boxShadow?: ResponsiveStyleValue<number | string>;
|
|
42
|
-
opacity?: ResponsiveStyleValue<number | string>;
|
|
43
|
-
overflow?: ResponsiveStyleValue<string>;
|
|
44
|
-
transition?: ResponsiveStyleValue<number | string>;
|
|
45
|
-
};
|
|
46
|
-
export declare type BoxProps = PolymorphicPropsWithRef<BoxOwnProps, 'div'>;
|
|
47
|
-
export declare const Box: PolymorphicComponentWithRef<BoxOwnProps, 'div'>;
|
package/dist/Box/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Box';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentProps } from '@marigold/types';
|
|
3
|
-
export declare type HeadingProps = {
|
|
4
|
-
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
5
|
-
variant?: string;
|
|
6
|
-
} & ComponentProps<'h1'>;
|
|
7
|
-
export declare const Heading: React.FC<HeadingProps>;
|
package/dist/Heading/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Heading';
|
package/dist/Hidden/Hidden.d.ts
DELETED
package/dist/Hidden/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Hidden';
|