@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.
Files changed (195) hide show
  1. package/CHANGELOG.md +294 -0
  2. package/dist/ActionGroup/ActionGroup.d.ts +1 -2
  3. package/dist/ActionGroup/ActionGroup.stories.d.ts +5 -0
  4. package/dist/Alert/Alert.d.ts +10 -13
  5. package/dist/Alert/Alert.stories.d.ts +5 -0
  6. package/dist/Badge/Badge.d.ts +5 -0
  7. package/dist/Badge/Badge.stories.d.ts +5 -0
  8. package/dist/Box.d.ts +2 -0
  9. package/dist/Button/Button.d.ts +5 -0
  10. package/dist/Button/Button.stories.d.ts +5 -0
  11. package/dist/Card/Card.d.ts +5 -0
  12. package/dist/Card/Card.stories.d.ts +5 -0
  13. package/dist/Checkbox/Checkbox.d.ts +10 -5
  14. package/dist/Checkbox/Checkbox.stories.d.ts +5 -0
  15. package/dist/Checkbox/CheckboxIcons.d.ts +9 -9
  16. package/dist/Column/Column.stories.d.ts +5 -0
  17. package/dist/Columns/Columns.d.ts +2 -2
  18. package/dist/Columns/Columns.stories.d.ts +5 -0
  19. package/dist/Container/Container.stories.d.ts +5 -0
  20. package/dist/Dialog/Dialog.d.ts +5 -2
  21. package/dist/Dialog/Dialog.stories.d.ts +5 -0
  22. package/dist/Dialog/ModalDialog.d.ts +4 -1
  23. package/dist/Divider/Divider.d.ts +5 -0
  24. package/dist/Divider/Divider.stories.d.ts +5 -0
  25. package/dist/Field/Field.d.ts +2 -0
  26. package/dist/Field/Field.stories.d.ts +5 -0
  27. package/dist/Image/Image.d.ts +5 -0
  28. package/dist/Image/Image.stories.d.ts +5 -0
  29. package/dist/Inline/Inline.d.ts +7 -0
  30. package/dist/Inline/Inline.stories.d.ts +5 -0
  31. package/dist/Inline/index.d.ts +1 -0
  32. package/dist/Input/Input.d.ts +5 -0
  33. package/dist/Input/Input.stories.d.ts +5 -0
  34. package/dist/Label/Label.d.ts +12 -1
  35. package/dist/Label/Label.stories.d.ts +5 -0
  36. package/dist/Link/Link.d.ts +4 -1
  37. package/dist/Link/Link.stories.d.ts +5 -0
  38. package/dist/Menu/Menu.d.ts +3 -0
  39. package/dist/Menu/Menu.stories.d.ts +5 -0
  40. package/dist/MenuItem/MenuItem.d.ts +5 -0
  41. package/dist/MenuItem/MenuItem.stories.d.ts +5 -0
  42. package/dist/Message/Message.d.ts +5 -0
  43. package/dist/Message/Message.stories.d.ts +5 -0
  44. package/dist/Provider/MarigoldProvider.d.ts +11 -3
  45. package/dist/Provider/index.d.ts +1 -1
  46. package/dist/Radio/Radio.d.ts +6 -0
  47. package/dist/Radio/RadioIcons.d.ts +1 -0
  48. package/dist/Select/ListBox.d.ts +1 -0
  49. package/dist/Select/ListBoxSection.d.ts +1 -0
  50. package/dist/Select/Option.d.ts +1 -0
  51. package/dist/Select/Select.d.ts +15 -1
  52. package/dist/Select/Select.stories.d.ts +5 -0
  53. package/dist/Slider/Slider.d.ts +5 -0
  54. package/dist/Slider/Slider.stories.d.ts +5 -0
  55. package/dist/Stack/Stack.stories.d.ts +5 -0
  56. package/dist/Text/Text.d.ts +5 -0
  57. package/dist/Text/Text.stories.d.ts +5 -0
  58. package/dist/Textarea/Textarea.d.ts +5 -0
  59. package/dist/Textarea/Textarea.stories.d.ts +5 -0
  60. package/dist/ValidationMessage/ValidationMessage.d.ts +5 -0
  61. package/dist/ValidationMessage/ValidationMessage.stories.d.ts +5 -0
  62. package/dist/VisuallyHidden/VisuallyHidden.d.ts +1 -0
  63. package/dist/VisuallyHidden/VisuallyHidden.stories.d.ts +5 -0
  64. package/dist/VisuallyHidden/index.d.ts +1 -0
  65. package/dist/components.cjs.development.js +480 -496
  66. package/dist/components.cjs.development.js.map +1 -1
  67. package/dist/components.cjs.production.min.js +1 -1
  68. package/dist/components.cjs.production.min.js.map +1 -1
  69. package/dist/components.esm.js +415 -441
  70. package/dist/components.esm.js.map +1 -1
  71. package/dist/index.d.ts +2 -2
  72. package/dist/theme.d.ts +23 -48
  73. package/package.json +4 -1
  74. package/src/ActionGroup/ActionGroup.stories.tsx +47 -0
  75. package/src/ActionGroup/ActionGroup.test.tsx +36 -36
  76. package/src/ActionGroup/ActionGroup.tsx +17 -28
  77. package/src/Alert/Alert.stories.tsx +32 -0
  78. package/src/Alert/Alert.test.tsx +4 -1
  79. package/src/Alert/Alert.tsx +18 -3
  80. package/src/Badge/Badge.stories.tsx +38 -0
  81. package/src/Badge/Badge.test.tsx +5 -1
  82. package/src/Badge/Badge.tsx +13 -1
  83. package/src/Box.ts +2 -0
  84. package/src/Button/{Button.stories.mdx → Button.stories.tsx} +10 -17
  85. package/src/Button/Button.test.tsx +34 -11
  86. package/src/Button/Button.tsx +17 -3
  87. package/src/Card/{Card.stories.mdx → Card.stories.tsx} +9 -17
  88. package/src/Card/Card.test.tsx +8 -3
  89. package/src/Card/Card.tsx +13 -1
  90. package/src/Checkbox/Checkbox.stories.mdx +11 -0
  91. package/src/Checkbox/Checkbox.stories.tsx +78 -0
  92. package/src/Checkbox/Checkbox.test.tsx +77 -8
  93. package/src/Checkbox/Checkbox.tsx +70 -90
  94. package/src/Checkbox/CheckboxIcons.tsx +51 -41
  95. package/src/Column/Column.stories.tsx +33 -0
  96. package/src/Columns/Columns.stories.tsx +75 -0
  97. package/src/Columns/Columns.test.tsx +34 -23
  98. package/src/Columns/Columns.tsx +30 -30
  99. package/src/Container/Container.stories.tsx +14 -0
  100. package/src/Dialog/{Dialog.stories.mdx → Dialog.stories.tsx} +33 -18
  101. package/src/Dialog/Dialog.test.tsx +91 -20
  102. package/src/Dialog/Dialog.tsx +63 -17
  103. package/src/Dialog/ModalDialog.tsx +33 -4
  104. package/src/Divider/{Divider.stories.mdx → Divider.stories.tsx} +10 -17
  105. package/src/Divider/Divider.test.tsx +13 -5
  106. package/src/Divider/Divider.tsx +12 -0
  107. package/src/Field/{Field.stories.mdx → Field.stories.tsx} +33 -20
  108. package/src/Field/Field.test.tsx +55 -5
  109. package/src/Field/Field.tsx +10 -8
  110. package/src/Image/Image.stories.tsx +34 -0
  111. package/src/Image/Image.test.tsx +4 -1
  112. package/src/Image/Image.tsx +13 -1
  113. package/src/Inline/Inline.stories.tsx +39 -0
  114. package/src/Inline/Inline.test.tsx +99 -0
  115. package/src/Inline/Inline.tsx +38 -0
  116. package/src/Inline/index.ts +1 -0
  117. package/src/Input/{Input.stories.mdx → Input.stories.tsx} +10 -17
  118. package/src/Input/Input.test.tsx +7 -3
  119. package/src/Input/Input.tsx +13 -1
  120. package/src/Label/{Label.stories.mdx → Label.stories.tsx} +10 -21
  121. package/src/Label/Label.test.tsx +25 -4
  122. package/src/Label/Label.tsx +42 -9
  123. package/src/Link/Link.stories.tsx +35 -0
  124. package/src/Link/Link.test.tsx +6 -2
  125. package/src/Link/Link.tsx +10 -0
  126. package/src/Menu/{Menu.stories.mdx → Menu.stories.tsx} +13 -32
  127. package/src/Menu/Menu.test.tsx +7 -2
  128. package/src/Menu/Menu.tsx +10 -0
  129. package/src/MenuItem/MenuItem.stories.tsx +30 -0
  130. package/src/MenuItem/MenuItem.test.tsx +7 -2
  131. package/src/MenuItem/MenuItem.tsx +12 -0
  132. package/src/Message/Message.stories.tsx +30 -0
  133. package/src/Message/Message.test.tsx +4 -1
  134. package/src/Message/Message.tsx +17 -5
  135. package/src/Provider/MarigoldProvider.test.tsx +65 -55
  136. package/src/Provider/MarigoldProvider.tsx +37 -19
  137. package/src/Provider/index.ts +2 -1
  138. package/src/Radio/Radio.stories.mdx +11 -0
  139. package/src/Radio/Radio.test.tsx +36 -2
  140. package/src/Radio/Radio.tsx +13 -2
  141. package/src/Radio/RadioIcons.tsx +1 -1
  142. package/src/Select/ListBox.tsx +1 -0
  143. package/src/Select/{Select.stories.mdx → Select.stories.tsx} +23 -20
  144. package/src/Select/Select.test.tsx +39 -1
  145. package/src/Select/Select.tsx +24 -13
  146. package/src/Slider/Slider.stories.tsx +24 -0
  147. package/src/Slider/Slider.test.tsx +10 -6
  148. package/src/Slider/Slider.tsx +25 -13
  149. package/src/Stack/Stack.stories.tsx +57 -0
  150. package/src/Stack/Stack.test.tsx +16 -7
  151. package/src/Text/{Text.stories.mdx → Text.stories.tsx} +20 -19
  152. package/src/Text/Text.test.tsx +2 -2
  153. package/src/Text/Text.tsx +12 -0
  154. package/src/Textarea/{Textarea.stories.mdx → Textarea.stories.tsx} +14 -24
  155. package/src/Textarea/Textarea.test.tsx +7 -3
  156. package/src/Textarea/Textarea.tsx +13 -1
  157. package/src/ValidationMessage/{ValidationMessage.stories.mdx → ValidationMessage.stories.tsx} +8 -17
  158. package/src/ValidationMessage/ValidationMessage.test.tsx +7 -2
  159. package/src/ValidationMessage/ValidationMessage.tsx +12 -0
  160. package/src/VisuallyHidden/VisuallyHidden.stories.tsx +19 -0
  161. package/src/VisuallyHidden/VisuallyHidden.test.tsx +10 -0
  162. package/src/VisuallyHidden/VisuallyHidden.tsx +1 -0
  163. package/src/VisuallyHidden/index.ts +1 -0
  164. package/src/index.ts +2 -2
  165. package/src/theme.ts +49 -48
  166. package/dist/Box/Box.d.ts +0 -47
  167. package/dist/Box/index.d.ts +0 -1
  168. package/dist/Heading/Heading.d.ts +0 -7
  169. package/dist/Heading/index.d.ts +0 -1
  170. package/dist/Hidden/Hidden.d.ts +0 -5
  171. package/dist/Hidden/index.d.ts +0 -1
  172. package/src/ActionGroup/ActionGroup.stories.mdx +0 -62
  173. package/src/Alert/Alert.stories.mdx +0 -35
  174. package/src/Badge/Badge.stories.mdx +0 -57
  175. package/src/Box/Box.stories.mdx +0 -334
  176. package/src/Box/Box.test.tsx +0 -133
  177. package/src/Box/Box.tsx +0 -165
  178. package/src/Box/index.ts +0 -1
  179. package/src/Column/Column.stories.mdx +0 -49
  180. package/src/Columns/Columns.stories.mdx +0 -65
  181. package/src/Container/Container.stories.mdx +0 -19
  182. package/src/Heading/Heading.stories.mdx +0 -39
  183. package/src/Heading/Heading.test.tsx +0 -77
  184. package/src/Heading/Heading.tsx +0 -19
  185. package/src/Heading/index.ts +0 -1
  186. package/src/Hidden/Hidden.stories.mdx +0 -39
  187. package/src/Hidden/Hidden.test.tsx +0 -24
  188. package/src/Hidden/Hidden.tsx +0 -16
  189. package/src/Hidden/index.ts +0 -1
  190. package/src/Image/Image.stories.mdx +0 -36
  191. package/src/Link/Link.stories.mdx +0 -45
  192. package/src/MenuItem/MenuItem.stories.mdx +0 -37
  193. package/src/Message/Message.stories.mdx +0 -44
  194. package/src/Slider/Slider.stories.mdx +0 -31
  195. 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
+ );
@@ -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).toHaveStyle(`padding-top: 0px`);
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.parentElement).toHaveStyle(`padding-top: 0px`);
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).toHaveStyle(`padding-top: 0px`);
116
+ expect(getTopPadding(upperStack.parentElement!)).toEqual('');
108
117
  expect(lowerStack.parentElement).toHaveStyle(`padding-top: 8px`);
109
118
 
110
- expect(first.parentElement).toHaveStyle(`padding-top: 0px`);
119
+ expect(getTopPadding(first.parentElement!)).toEqual('');
111
120
  expect(second.parentElement).toHaveStyle(`padding-top: 2px`);
112
121
 
113
- expect(third.parentElement).toHaveStyle(`padding-top: 0px`);
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 { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
1
+ import React from 'react';
2
+ import type { Meta, ComponentStory } from '@storybook/react';
2
3
  import { Text } from './Text';
3
4
 
4
- <Meta
5
- title="Components/Text"
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 inline',
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: ['body', 'heading'],
24
- description: 'Doesnt matter',
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
- # Text
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" />
@@ -15,7 +15,7 @@ const theme = {
15
15
  body: {
16
16
  fontFamily: 'Oswald Regular',
17
17
  },
18
- heading: {
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="heading">text</Text>
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 { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
2
- import { Textarea } from '../Textarea';
1
+ import React from 'react';
2
+ import type { Meta, ComponentStory } from '@storybook/react';
3
+ import { Textarea } from '.';
3
4
 
4
- <Meta
5
- title="Components/Textarea"
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: 'default',
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: 'Text above',
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
- table: {
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
- # Textarea
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
- default: {
9
- fontFamily: 'Inter Regular',
12
+ __default: {
13
+ fontFamily: 'body',
10
14
  },
11
15
  textarea2: {
12
- fontFamily: 'Roboto',
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 = 'default',
31
+ variant = '',
20
32
  htmlFor = 'textarea',
21
33
  label,
22
34
  error,
@@ -1,36 +1,27 @@
1
- import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
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
- <Meta
6
- title="Components/ValidationMessage"
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
- # ValidationMessage
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: '8px',
14
+ p: 'medium',
10
15
  },
11
16
  warning: {
12
- p: '4px',
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 './Heading';
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
- export type CSSObject = object;
1
+ import { type CSSObject, type Theme as Scales } from '@marigold/system';
2
2
 
3
- export type BaseTheme = {
4
- breakpoints: string[];
5
- space: {
6
- none: number;
7
- xxsmall: number;
8
- xsmall: number;
9
- small: number;
10
- medium: number;
11
- large: number;
12
- xlarge: number;
13
- xxlarge: number;
14
- };
15
- fonts: {
16
- body: string;
17
- heading: string;
18
- };
19
- fontSizes: {
20
- xxsmall: string;
21
- xsmall: string;
22
- small: string;
23
- medium: string;
24
- large: string;
25
- xlarge: string;
26
- };
27
- fontWeights: {
28
- body: number;
29
- heading: number;
30
- bold: number;
31
- };
32
- lineHeights: {
33
- body: number;
34
- heading: number;
35
- };
36
- colors: {
37
- text: string;
38
- background: string;
39
- primary: string;
40
- secondary: string;
41
- disabled: string;
42
- error: string;
43
- warning: string;
44
- info: string;
45
- success: string;
46
- [key: string]: string;
47
- };
48
- [key: string]: CSSObject;
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'>;
@@ -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>;
@@ -1 +0,0 @@
1
- export * from './Heading';
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export declare type HiddenProps = {
3
- show?: boolean;
4
- };
5
- export declare const Hidden: React.FC<HiddenProps>;
@@ -1 +0,0 @@
1
- export * from './Hidden';