@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
@@ -1,9 +1,10 @@
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 { Label } from './Label';
3
4
 
4
- <Meta
5
- title="Components/Label"
6
- argTypes={{
5
+ export default {
6
+ title: 'Components/Label',
7
+ argTypes: {
7
8
  variant: {
8
9
  control: {
9
10
  type: 'text',
@@ -19,9 +20,7 @@ import { Label } from './Label';
19
20
  control: {
20
21
  type: 'text',
21
22
  },
22
- type: {
23
- required: true,
24
- },
23
+ defaultValue: 'input',
25
24
  },
26
25
  required: {
27
26
  control: {
@@ -34,19 +33,9 @@ import { Label } from './Label';
34
33
  },
35
34
  },
36
35
  },
37
- }}
38
- />
39
-
40
- # Label
36
+ },
37
+ } as Meta;
41
38
 
42
- export const Template = args => (
43
- <Label htmlFor="input" {...args}>
44
- Label
45
- </Label>
39
+ export const Basic: ComponentStory<typeof Label> = args => (
40
+ <Label {...args}>Label</Label>
46
41
  );
47
-
48
- <Canvas>
49
- <Story name="Default">{Template.bind({})}</Story>
50
- </Canvas>
51
-
52
- <ArgsTable story="Default" />
@@ -4,17 +4,25 @@ import { ThemeProvider } from '@marigold/system';
4
4
  import { Label } from './Label';
5
5
 
6
6
  const theme = {
7
+ fonts: {
8
+ body: 'Inter Regular',
9
+ label: 'Oswald',
10
+ },
7
11
  label: {
8
12
  above: {
9
- fontFamily: 'Inter Regular',
13
+ fontFamily: 'body',
10
14
  },
11
15
  myLabel: {
12
- fontFamily: 'Oswald Regular',
16
+ fontFamily: 'label',
13
17
  },
14
18
  },
19
+ colors: {
20
+ text: 'black',
21
+ disabled: 'gray',
22
+ },
15
23
  };
16
24
 
17
- test('supports default variant and themeSection', () => {
25
+ test('supports default variant and styles', () => {
18
26
  render(
19
27
  <ThemeProvider theme={theme}>
20
28
  <Label htmlFor="labelId">label</Label>
@@ -23,6 +31,7 @@ test('supports default variant and themeSection', () => {
23
31
  const label = screen.getByText(/label/);
24
32
 
25
33
  expect(label).toHaveStyle(`font-family: Inter Regular`);
34
+ expect(label).toHaveStyle(`color: black`);
26
35
  });
27
36
 
28
37
  test('supports other variant than default', () => {
@@ -35,7 +44,7 @@ test('supports other variant than default', () => {
35
44
  );
36
45
  const label = screen.getByText(/label/);
37
46
 
38
- expect(label).toHaveStyle(`font-family: Oswald Regular`);
47
+ expect(label).toHaveStyle(`font-family: Oswald`);
39
48
  });
40
49
 
41
50
  test('supports htmlFor prop', () => {
@@ -63,6 +72,18 @@ test('supports required prop', () => {
63
72
  expect(parent instanceof HTMLSpanElement).toBeTruthy();
64
73
  });
65
74
 
75
+ test('supports color prop', () => {
76
+ render(
77
+ <ThemeProvider theme={theme}>
78
+ <Label htmlFor="labelId" color="disabled">
79
+ label
80
+ </Label>
81
+ </ThemeProvider>
82
+ );
83
+ const label = screen.getByText(/label/);
84
+ expect(label).toHaveStyle(`color: gray`);
85
+ });
86
+
66
87
  test('renders <label> element', () => {
67
88
  render(
68
89
  <ThemeProvider theme={theme}>
@@ -1,31 +1,64 @@
1
1
  import React from 'react';
2
+
2
3
  import { ComponentProps } from '@marigold/types';
3
4
  import { Required } from '@marigold/icons';
5
+ import { ResponsiveStyleValue } from '@marigold/system';
4
6
 
5
7
  import { Box } from '../Box';
6
8
 
7
- export type LabelProps = {
9
+ // Theme Extension
10
+ // ---------------
11
+ export interface LabelThemeExtension<Value> {
12
+ label?: {
13
+ [key: string]: Value;
14
+ };
15
+ }
16
+
17
+ // LabelBase
18
+ // ---------------
19
+ export type LabelBaseProps = {
8
20
  htmlFor?: string;
9
21
  variant?: string;
10
22
  required?: boolean;
23
+ color?: ResponsiveStyleValue<string>;
11
24
  } & ComponentProps<'label'>;
12
25
 
13
- export const Label: React.FC<LabelProps> = ({
26
+ export const LabelBase: React.FC<LabelProps> = ({
14
27
  variant = 'above',
28
+ required,
29
+ color = 'text',
30
+ children,
31
+ ...props
32
+ }) => {
33
+ return (
34
+ <Box
35
+ {...props}
36
+ as="label"
37
+ __baseCSS={{ color: color }}
38
+ variant={`label.${variant}`}
39
+ >
40
+ {children}
41
+ </Box>
42
+ );
43
+ };
44
+
45
+ // Label
46
+ // ---------------
47
+ export type LabelProps = {
48
+ required?: boolean;
49
+ } & LabelBaseProps;
50
+
51
+ export const Label: React.FC<LabelProps> = ({
15
52
  required,
16
53
  children,
17
54
  ...props
18
55
  }) => {
19
56
  return required ? (
20
57
  <Box as="span" display="inline-flex" alignItems="center">
21
- <Box {...props} as="label" variant={`label.${variant}`}>
22
- {children}
23
- </Box>
24
- {required && <Box as={Required} size={16} css={{ color: 'red60' }} />}
58
+ <LabelBase {...props}>{children}</LabelBase>
59
+ {required && <Box as={Required} size={16} css={{ color: 'error' }} />}
25
60
  </Box>
26
61
  ) : (
27
- <Box {...props} as="label" variant={`label.${variant}`}>
28
- {children}
29
- </Box>
62
+ <LabelBase {...props}>{children}</LabelBase>
30
63
  );
31
64
  };
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import type { Meta, ComponentStory } from '@storybook/react';
3
+ import { Link } from './Link';
4
+ import { Text } from '../Text';
5
+
6
+ export default {
7
+ title: 'Components/Link',
8
+ argTypes: {
9
+ variant: {
10
+ control: {
11
+ type: 'text',
12
+ },
13
+ description: '?',
14
+ table: {
15
+ defaultValue: {
16
+ summary: 'link',
17
+ },
18
+ },
19
+ },
20
+ href: {
21
+ control: {
22
+ type: 'text',
23
+ },
24
+ description: 'The URL to direct to',
25
+ },
26
+ },
27
+ } as Meta;
28
+
29
+ export const Basic: ComponentStory<typeof Link> = args => (
30
+ <Text>
31
+ <Link href="https://marigold-ui.io" target="_blank" {...args}>
32
+ Marigold Docs
33
+ </Link>
34
+ </Text>
35
+ );
@@ -4,12 +4,16 @@ import { ThemeProvider } from '@marigold/system';
4
4
  import { Link } from './Link';
5
5
 
6
6
  const theme = {
7
+ fonts: {
8
+ link: 'Inter',
9
+ body: 'Oswald',
10
+ },
7
11
  text: {
8
12
  link: {
9
- fontFamily: 'Inter',
13
+ fontFamily: 'link',
10
14
  },
11
15
  second: {
12
- fontFamily: 'Oswald',
16
+ fontFamily: 'body',
13
17
  },
14
18
  },
15
19
  };
package/src/Link/Link.tsx CHANGED
@@ -4,9 +4,19 @@ import { PolymorphicComponent, PolymorphicProps } from '@marigold/types';
4
4
 
5
5
  import { Text, TextOwnProps } from '../Text';
6
6
 
7
+ // Theme Extension
8
+ // ---------------
9
+ export interface LinkThemeExtension<Value> {
10
+ link?: Value;
11
+ }
12
+
13
+ // Props
14
+ // ---------------
7
15
  export type LinkOwnProps = { disabled?: boolean } & TextOwnProps;
8
16
  export type LinkProps = PolymorphicProps<LinkOwnProps, 'a'>;
9
17
 
18
+ // Component
19
+ // ---------------
10
20
  export const Link = (({
11
21
  as = 'a',
12
22
  variant = 'link',
@@ -1,17 +1,16 @@
1
- import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
1
+ import React, { useState } from 'react';
2
+ import type { Meta, ComponentStory } from '@storybook/react';
2
3
  import { Menu } from './Menu';
3
4
  import { MenuItem } from '../MenuItem';
4
- import { BurgerMenu } from '@marigold/icons';
5
- import { useState } from 'react';
6
5
 
7
- <Meta
8
- title="Components/Menu"
9
- parameters={{
6
+ export default {
7
+ title: 'Components/Menu',
8
+ parameters: {
10
9
  actions: {
11
10
  handles: ['click'],
12
11
  },
13
- }}
14
- argTypes={{
12
+ },
13
+ argTypes: {
15
14
  variant: {
16
15
  control: {
17
16
  type: 'text',
@@ -28,11 +27,7 @@ import { useState } from 'react';
28
27
  type: 'text',
29
28
  },
30
29
  description: 'Menu label on hover',
31
- table: {
32
- defaultValue: {
33
- summary: 'Menu',
34
- },
35
- },
30
+ defaultValue: 'Menu',
36
31
  },
37
32
  show: {
38
33
  control: {
@@ -51,31 +46,17 @@ import { useState } from 'react';
51
46
  type: 'text',
52
47
  },
53
48
  description: 'Function to show menu or toggle something',
54
- type: { required: true },
55
49
  },
56
- }}
57
- />
50
+ },
51
+ } as Meta;
58
52
 
59
- # Menu
60
-
61
- export const Template = ({ onClick, ...args }) => {
62
- const [showMenu, setShowMenu] = React.useState(false);
53
+ export const Basic: ComponentStory<typeof Menu> = ({ onClick, ...args }) => {
54
+ const [showMenu, setShowMenu] = useState(false);
63
55
  return (
64
- <Menu
65
- onClick={() => setShowMenu(!showMenu)}
66
- show={showMenu}
67
- label={<BurgerMenu />}
68
- {...args}
69
- >
56
+ <Menu onClick={() => setShowMenu(!showMenu)} show={showMenu} {...args}>
70
57
  <MenuItem href="#">Home</MenuItem>
71
58
  <MenuItem href="#">Tickets</MenuItem>
72
59
  <MenuItem href="#">Logout</MenuItem>
73
60
  </Menu>
74
61
  );
75
62
  };
76
-
77
- <Canvas>
78
- <Story name="Mini menu">{Template.bind({})}</Story>
79
- </Canvas>
80
-
81
- <ArgsTable story="Mini menu" />
@@ -5,12 +5,17 @@ import { Menu } from './Menu';
5
5
  import { MenuItem } from '../MenuItem';
6
6
 
7
7
  const theme = {
8
+ space: {
9
+ none: 0,
10
+ small: 4,
11
+ medium: 8,
12
+ },
8
13
  menu: {
9
14
  default: {
10
- padding: '4px',
15
+ padding: 'small',
11
16
  },
12
17
  custom: {
13
- padding: '8px',
18
+ padding: 'medium',
14
19
  },
15
20
  },
16
21
  };
package/src/Menu/Menu.tsx CHANGED
@@ -4,6 +4,14 @@ import { ComponentProps } from '@marigold/types';
4
4
  import { Button } from '../Button';
5
5
  import { Box } from '../Box';
6
6
 
7
+ // Theme Extension
8
+ // ---------------
9
+ export interface MenuThemeExtension<Value> {
10
+ menu?: Value;
11
+ }
12
+
13
+ // Props
14
+ // ---------------
7
15
  export type MenuProps = {
8
16
  variant?: string;
9
17
  label?: string;
@@ -13,6 +21,8 @@ export type MenuProps = {
13
21
  title?: string; // For testing
14
22
  };
15
23
 
24
+ // Component
25
+ // ---------------
16
26
  export const Menu: React.FC<MenuProps> = ({
17
27
  variant = 'default',
18
28
  label = 'Menu',
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import type { Meta, ComponentStory } from '@storybook/react';
3
+ import { MenuItem } from './MenuItem';
4
+
5
+ export default {
6
+ title: 'Components/MenuItem',
7
+ parameters: {
8
+ actions: {
9
+ handles: ['click'],
10
+ },
11
+ },
12
+ argTypes: {
13
+ variant: {
14
+ control: {
15
+ type: 'text',
16
+ },
17
+ table: {
18
+ defaultValue: {
19
+ summary: 'default',
20
+ },
21
+ },
22
+ },
23
+ },
24
+ } as Meta;
25
+
26
+ export const Basic: ComponentStory<typeof MenuItem> = args => (
27
+ <MenuItem href="#" {...args}>
28
+ Home
29
+ </MenuItem>
30
+ );
@@ -4,12 +4,17 @@ import { ThemeProvider } from '@marigold/system';
4
4
  import { MenuItem } from './MenuItem';
5
5
 
6
6
  const theme = {
7
+ space: {
8
+ none: 0,
9
+ small: 4,
10
+ medium: 8,
11
+ },
7
12
  menuItem: {
8
13
  default: {
9
- padding: '4px',
14
+ padding: 'small',
10
15
  },
11
16
  item: {
12
- padding: '8px',
17
+ padding: 'medium',
13
18
  },
14
19
  },
15
20
  };
@@ -3,10 +3,22 @@ import { ComponentProps } from '@marigold/types';
3
3
  import { Link } from '../Link';
4
4
  import { Box } from '../Box';
5
5
 
6
+ // Theme Extension
7
+ // ---------------
8
+ export interface MenuItemThemeExtension<Value> {
9
+ menuItem?: {
10
+ [key: string]: Value;
11
+ };
12
+ }
13
+
14
+ // Props
15
+ // ---------------
6
16
  export type MenuItemProps = {
7
17
  variant?: string;
8
18
  } & ComponentProps<typeof Link>;
9
19
 
20
+ // Component
21
+ // ---------------
10
22
  export const MenuItem: React.FC<MenuItemProps> = ({
11
23
  variant = 'default',
12
24
  className,
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import type { Meta, ComponentStory } from '@storybook/react';
3
+ import { Message } from './Message';
4
+ import { Text } from '../Text';
5
+
6
+ export default {
7
+ title: 'Components/Message',
8
+ argTypes: {
9
+ variant: {
10
+ control: {
11
+ type: 'select',
12
+ },
13
+ options: ['warning', 'error', 'info'],
14
+ description: 'Messaging in different colors and icons',
15
+ },
16
+ messageTitle: {
17
+ control: {
18
+ type: 'text',
19
+ },
20
+ description: 'Content',
21
+ defaultValue: 'Danger Zone!',
22
+ },
23
+ },
24
+ } as Meta;
25
+
26
+ export const Basic: ComponentStory<typeof Message> = args => (
27
+ <Message {...args}>
28
+ <Text>Hello, I am a simple message.</Text>
29
+ </Message>
30
+ );
@@ -4,7 +4,10 @@ import { ThemeProvider } from '@marigold/system';
4
4
  import { Message } from './Message';
5
5
 
6
6
  const theme = {
7
- messages: {
7
+ colors: {
8
+ primary: 'hotpink',
9
+ },
10
+ message: {
8
11
  info: {
9
12
  alignItems: 'center',
10
13
  },
@@ -2,13 +2,25 @@ import React from 'react';
2
2
  import { Exclamation, Info, Notification } from '@marigold/icons';
3
3
  import { ComponentProps } from '@marigold/types';
4
4
  import { Box } from '../Box';
5
- import { Heading } from '../Heading';
5
+ import { Text } from '../Text';
6
6
 
7
+ // Theme Extension
8
+ // ---------------
9
+ export interface MessageThemeExtension<Value> {
10
+ message?: {
11
+ [key: string]: Value;
12
+ };
13
+ }
14
+
15
+ // Props
16
+ // ---------------
7
17
  export type MessageProps = {
8
18
  messageTitle: string;
9
19
  variant?: string;
10
20
  } & ComponentProps<'div'>;
11
21
 
22
+ // Component
23
+ // ---------------
12
24
  export const Message: React.FC<MessageProps> = ({
13
25
  messageTitle,
14
26
  variant = 'info',
@@ -27,15 +39,15 @@ export const Message: React.FC<MessageProps> = ({
27
39
  return (
28
40
  <Box
29
41
  display="inline-block"
30
- variant={`messages.${variant}`}
42
+ variant={`message.${variant}`}
31
43
  className={className}
32
44
  {...props}
33
45
  >
34
- <Box display="flex" alignItems="center" variant="messages.title">
46
+ <Box display="flex" alignItems="center" variant="message.title">
35
47
  {icon}
36
- <Heading as="h4" variant="h4">
48
+ <Text as="h4" variant="headline4">
37
49
  {messageTitle}
38
- </Heading>
50
+ </Text>
39
51
  </Box>
40
52
  <Box css={{ color: 'black' }}>{children}</Box>
41
53
  </Box>