@marigold/components 0.0.3 → 0.3.1

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 (220) hide show
  1. package/CHANGELOG.md +174 -0
  2. package/dist/ActionGroup/ActionGroup.d.ts +8 -0
  3. package/dist/ActionGroup/ActionGroup.stories.d.ts +5 -0
  4. package/dist/ActionGroup/index.d.ts +1 -0
  5. package/dist/Alert/Alert.d.ts +22 -1
  6. package/dist/Alert/Alert.stories.d.ts +5 -0
  7. package/dist/Badge/Badge.d.ts +5 -0
  8. package/dist/Badge/Badge.stories.d.ts +5 -0
  9. package/dist/Box.d.ts +2 -0
  10. package/dist/Button/Button.d.ts +9 -6
  11. package/dist/Button/Button.stories.d.ts +5 -0
  12. package/dist/Card/Card.d.ts +14 -0
  13. package/dist/Card/Card.stories.d.ts +5 -0
  14. package/dist/Card/index.d.ts +1 -0
  15. package/dist/Checkbox/Checkbox.d.ts +15 -3
  16. package/dist/Checkbox/Checkbox.stories.d.ts +5 -0
  17. package/dist/Checkbox/CheckboxIcons.d.ts +9 -0
  18. package/dist/Column/Column.d.ts +3 -1
  19. package/dist/Column/Column.stories.d.ts +5 -0
  20. package/dist/Columns/Columns.d.ts +2 -2
  21. package/dist/Columns/Columns.stories.d.ts +5 -0
  22. package/dist/Container/Container.stories.d.ts +5 -0
  23. package/dist/Dialog/Dialog.d.ts +12 -2
  24. package/dist/Dialog/Dialog.stories.d.ts +5 -0
  25. package/dist/Dialog/ModalDialog.d.ts +8 -0
  26. package/dist/Divider/Divider.d.ts +5 -0
  27. package/dist/Divider/Divider.stories.d.ts +5 -0
  28. package/dist/Field/Field.d.ts +5 -1
  29. package/dist/Field/Field.stories.d.ts +5 -0
  30. package/dist/Image/Image.d.ts +5 -0
  31. package/dist/Image/Image.stories.d.ts +5 -0
  32. package/dist/Inline/Inline.d.ts +7 -0
  33. package/dist/Inline/Inline.stories.d.ts +5 -0
  34. package/dist/Inline/index.d.ts +1 -0
  35. package/dist/Input/Input.d.ts +5 -0
  36. package/dist/Input/Input.stories.d.ts +5 -0
  37. package/dist/Label/Label.d.ts +14 -2
  38. package/dist/Label/Label.stories.d.ts +5 -0
  39. package/dist/Link/Link.d.ts +10 -6
  40. package/dist/Link/Link.stories.d.ts +5 -0
  41. package/dist/Menu/Menu.d.ts +3 -0
  42. package/dist/Menu/Menu.stories.d.ts +5 -0
  43. package/dist/MenuItem/MenuItem.d.ts +5 -0
  44. package/dist/MenuItem/MenuItem.stories.d.ts +5 -0
  45. package/dist/Message/Message.d.ts +5 -0
  46. package/dist/Message/Message.stories.d.ts +5 -0
  47. package/dist/Provider/MarigoldProvider.d.ts +11 -0
  48. package/dist/Provider/index.d.ts +3 -0
  49. package/dist/Radio/Radio.d.ts +11 -4
  50. package/dist/Radio/Radio.stories.d.ts +5 -0
  51. package/dist/Radio/RadioIcon.d.ts +9 -0
  52. package/dist/Select/ListBox.d.ts +9 -0
  53. package/dist/Select/ListBoxSection.d.ts +9 -0
  54. package/dist/Select/Option.d.ts +9 -0
  55. package/dist/Select/Popover.d.ts +9 -0
  56. package/dist/Select/Select.d.ts +25 -4
  57. package/dist/Select/Select.stories.d.ts +5 -0
  58. package/dist/Slider/Slider.d.ts +5 -0
  59. package/dist/Slider/Slider.stories.d.ts +5 -0
  60. package/dist/Stack/Stack.d.ts +1 -3
  61. package/dist/Stack/Stack.stories.d.ts +5 -0
  62. package/dist/Text/Text.d.ts +17 -10
  63. package/dist/Text/Text.stories.d.ts +5 -0
  64. package/dist/Textarea/Textarea.d.ts +7 -1
  65. package/dist/Textarea/Textarea.stories.d.ts +5 -0
  66. package/dist/ValidationMessage/ValidationMessage.d.ts +5 -0
  67. package/dist/ValidationMessage/ValidationMessage.stories.d.ts +5 -0
  68. package/dist/VisuallyHidden/VisuallyHidden.d.ts +1 -0
  69. package/dist/VisuallyHidden/VisuallyHidden.stories.d.ts +5 -0
  70. package/dist/VisuallyHidden/index.d.ts +1 -0
  71. package/dist/components.cjs.development.js +1075 -562
  72. package/dist/components.cjs.development.js.map +1 -1
  73. package/dist/components.cjs.production.min.js +1 -1
  74. package/dist/components.cjs.production.min.js.map +1 -1
  75. package/dist/components.esm.js +1012 -542
  76. package/dist/components.esm.js.map +1 -1
  77. package/dist/index.d.ts +6 -2
  78. package/dist/theme.d.ts +23 -48
  79. package/package.json +21 -2
  80. package/src/ActionGroup/ActionGroup.stories.tsx +47 -0
  81. package/src/ActionGroup/ActionGroup.test.tsx +83 -0
  82. package/src/ActionGroup/ActionGroup.tsx +32 -0
  83. package/src/ActionGroup/index.ts +1 -0
  84. package/src/Alert/Alert.stories.tsx +32 -0
  85. package/src/Alert/Alert.test.tsx +5 -2
  86. package/src/Alert/Alert.tsx +27 -34
  87. package/src/Badge/Badge.stories.tsx +38 -0
  88. package/src/Badge/Badge.test.tsx +12 -16
  89. package/src/Badge/Badge.tsx +14 -3
  90. package/src/Box.ts +2 -0
  91. package/src/Button/Button.stories.tsx +57 -0
  92. package/src/Button/Button.test.tsx +76 -13
  93. package/src/Button/Button.tsx +61 -18
  94. package/src/Card/Card.stories.tsx +41 -0
  95. package/src/Card/Card.test.tsx +71 -0
  96. package/src/Card/Card.tsx +48 -0
  97. package/src/Card/index.ts +1 -0
  98. package/src/Checkbox/Checkbox.stories.tsx +78 -0
  99. package/src/Checkbox/Checkbox.test.tsx +138 -23
  100. package/src/Checkbox/Checkbox.tsx +81 -52
  101. package/src/Checkbox/CheckboxIcons.tsx +59 -0
  102. package/src/Column/Column.stories.tsx +33 -0
  103. package/src/Column/Column.test.tsx +8 -0
  104. package/src/Column/Column.tsx +12 -2
  105. package/src/Columns/Columns.stories.tsx +75 -0
  106. package/src/Columns/Columns.test.tsx +34 -23
  107. package/src/Columns/Columns.tsx +30 -30
  108. package/src/Container/Container.stories.tsx +14 -0
  109. package/src/Dialog/Dialog.stories.tsx +88 -0
  110. package/src/Dialog/Dialog.test.tsx +129 -18
  111. package/src/Dialog/Dialog.tsx +113 -15
  112. package/src/Dialog/ModalDialog.tsx +76 -0
  113. package/src/Divider/Divider.stories.tsx +30 -0
  114. package/src/Divider/Divider.test.tsx +13 -5
  115. package/src/Divider/Divider.tsx +12 -0
  116. package/src/Field/Field.stories.tsx +110 -0
  117. package/src/Field/Field.test.tsx +74 -33
  118. package/src/Field/Field.tsx +27 -20
  119. package/src/Image/Image.stories.tsx +34 -0
  120. package/src/Image/Image.test.tsx +4 -1
  121. package/src/Image/Image.tsx +13 -1
  122. package/src/Inline/Inline.stories.tsx +39 -0
  123. package/src/Inline/Inline.test.tsx +99 -0
  124. package/src/Inline/Inline.tsx +38 -0
  125. package/src/Inline/index.ts +1 -0
  126. package/src/Input/Input.stories.tsx +54 -0
  127. package/src/Input/Input.test.tsx +7 -3
  128. package/src/Input/Input.tsx +13 -1
  129. package/src/Label/Label.stories.tsx +41 -0
  130. package/src/Label/Label.test.tsx +40 -5
  131. package/src/Label/Label.tsx +54 -8
  132. package/src/Link/Link.stories.tsx +35 -0
  133. package/src/Link/Link.test.tsx +51 -21
  134. package/src/Link/Link.tsx +39 -13
  135. package/src/Menu/Menu.stories.tsx +62 -0
  136. package/src/Menu/Menu.test.tsx +11 -6
  137. package/src/Menu/Menu.tsx +22 -14
  138. package/src/MenuItem/MenuItem.stories.tsx +30 -0
  139. package/src/MenuItem/MenuItem.test.tsx +22 -13
  140. package/src/MenuItem/MenuItem.tsx +19 -10
  141. package/src/Message/Message.stories.tsx +30 -0
  142. package/src/Message/Message.test.tsx +4 -1
  143. package/src/Message/Message.tsx +18 -14
  144. package/src/Provider/MarigoldProvider.test.tsx +136 -0
  145. package/src/Provider/MarigoldProvider.tsx +47 -0
  146. package/src/Provider/index.ts +4 -0
  147. package/src/Radio/Radio.stories.tsx +78 -0
  148. package/src/Radio/Radio.test.tsx +129 -18
  149. package/src/Radio/Radio.tsx +62 -71
  150. package/src/Radio/RadioIcon.tsx +49 -0
  151. package/src/Select/ListBox.tsx +40 -0
  152. package/src/Select/ListBoxSection.tsx +40 -0
  153. package/src/Select/Option.tsx +48 -0
  154. package/src/Select/Popover.tsx +50 -0
  155. package/src/Select/Select.stories.tsx +81 -0
  156. package/src/Select/Select.test.tsx +317 -35
  157. package/src/Select/Select.tsx +162 -18
  158. package/src/Slider/Slider.stories.tsx +24 -0
  159. package/src/Slider/Slider.test.tsx +10 -6
  160. package/src/Slider/Slider.tsx +25 -13
  161. package/src/Stack/Stack.stories.tsx +57 -0
  162. package/src/Stack/Stack.test.tsx +93 -65
  163. package/src/Stack/Stack.tsx +27 -32
  164. package/src/Text/Text.stories.tsx +61 -0
  165. package/src/Text/Text.test.tsx +41 -36
  166. package/src/Text/Text.tsx +56 -31
  167. package/src/Textarea/Textarea.stories.tsx +64 -0
  168. package/src/Textarea/Textarea.test.tsx +11 -8
  169. package/src/Textarea/Textarea.tsx +41 -38
  170. package/src/ValidationMessage/ValidationMessage.stories.tsx +27 -0
  171. package/src/ValidationMessage/ValidationMessage.test.tsx +9 -4
  172. package/src/ValidationMessage/ValidationMessage.tsx +23 -12
  173. package/src/VisuallyHidden/VisuallyHidden.stories.tsx +19 -0
  174. package/src/VisuallyHidden/VisuallyHidden.test.tsx +10 -0
  175. package/src/VisuallyHidden/VisuallyHidden.tsx +1 -0
  176. package/src/VisuallyHidden/index.ts +1 -0
  177. package/src/index.ts +7 -2
  178. package/src/theme.ts +49 -48
  179. package/dist/Box/Box.d.ts +0 -45
  180. package/dist/Box/index.d.ts +0 -1
  181. package/dist/Heading/Heading.d.ts +0 -7
  182. package/dist/Heading/index.d.ts +0 -1
  183. package/dist/Hidden/Hidden.d.ts +0 -5
  184. package/dist/Hidden/index.d.ts +0 -1
  185. package/src/Alert/Alert.stories.mdx +0 -45
  186. package/src/Badge/Badge.stories.mdx +0 -43
  187. package/src/Box/Box.stories.mdx +0 -38
  188. package/src/Box/Box.test.tsx +0 -133
  189. package/src/Box/Box.tsx +0 -152
  190. package/src/Box/index.ts +0 -1
  191. package/src/Button/Button.stories.mdx +0 -176
  192. package/src/Checkbox/Checkbox.stories.mdx +0 -119
  193. package/src/Column/Column.stories.mdx +0 -74
  194. package/src/Columns/Columns.stories.mdx +0 -247
  195. package/src/Container/Container.stories.mdx +0 -36
  196. package/src/Dialog/Dialog.stories.mdx +0 -64
  197. package/src/Divider/Divider.stories.mdx +0 -43
  198. package/src/Field/Field.stories.mdx +0 -57
  199. package/src/Heading/Heading.stories.mdx +0 -91
  200. package/src/Heading/Heading.test.tsx +0 -77
  201. package/src/Heading/Heading.tsx +0 -19
  202. package/src/Heading/index.ts +0 -1
  203. package/src/Hidden/Hidden.stories.mdx +0 -64
  204. package/src/Hidden/Hidden.test.tsx +0 -24
  205. package/src/Hidden/Hidden.tsx +0 -16
  206. package/src/Hidden/index.ts +0 -1
  207. package/src/Image/Image.stories.mdx +0 -40
  208. package/src/Input/Input.stories.mdx +0 -45
  209. package/src/Label/Label.stories.mdx +0 -34
  210. package/src/Link/Link.stories.mdx +0 -38
  211. package/src/Menu/Menu.stories.mdx +0 -49
  212. package/src/MenuItem/MenuItem.stories.mdx +0 -32
  213. package/src/Message/Message.stories.mdx +0 -44
  214. package/src/Radio/Radio.stories.mdx +0 -100
  215. package/src/Select/Select.stories.mdx +0 -44
  216. package/src/Slider/Slider.stories.mdx +0 -58
  217. package/src/Stack/Stack.stories.mdx +0 -105
  218. package/src/Text/Text.stories.mdx +0 -60
  219. package/src/Textarea/Textarea.stories.mdx +0 -65
  220. package/src/ValidationMessage/ValidationMessage.stories.mdx +0 -36
@@ -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
  };
@@ -58,14 +62,13 @@ test('supports label prop', () => {
58
62
  expect(textarea instanceof HTMLLabelElement).toBeTruthy();
59
63
  });
60
64
 
61
- test('supports errorMessage prop', () => {
65
+ test('supports error and errorMessage prop', () => {
62
66
  render(
63
67
  <ThemeProvider theme={theme}>
64
- <Textarea errorMessage="error" title="textarea" />
68
+ <Textarea error errorMessage="error" label="label" title="textarea" />
65
69
  </ThemeProvider>
66
70
  );
67
71
  const textarea = screen.getByText(/error/);
68
-
69
72
  expect(textarea).toBeDefined();
70
73
  });
71
74
 
@@ -75,9 +78,9 @@ test('supports required prop', () => {
75
78
  <Textarea label="test" htmlFor="myId" required title="textarea" />
76
79
  </ThemeProvider>
77
80
  );
78
- const textarea = screen.getByText(/test/).lastChild;
81
+ const label = screen.getByText(/test/);
79
82
 
80
- expect(textarea instanceof SVGElement).toBeTruthy();
83
+ expect(label.nextSibling instanceof SVGElement).toBeTruthy();
81
84
  });
82
85
 
83
86
  test('accepts custom styles prop className', () => {
@@ -1,59 +1,62 @@
1
1
  import React from 'react';
2
- import { useStyles } from '@marigold/system';
3
- import { Exclamation, Required } from '@marigold/icons';
2
+ import { Exclamation } from '@marigold/icons';
4
3
  import { ComponentProps } from '@marigold/types';
5
4
 
6
5
  import { ValidationMessage } from '../ValidationMessage';
7
6
  import { Label } from '../Label';
8
7
  import { Box } from '../Box';
9
8
 
9
+ // Theme Extension
10
+ // ---------------
11
+ export interface TextareaThemeExtension<Value> {
12
+ textarea?: {
13
+ [key: string]: Value;
14
+ };
15
+ }
16
+
17
+ // Props
18
+ // ---------------
10
19
  export type TextareaProps = {
11
20
  variant?: string;
12
21
  label?: string;
13
22
  htmlFor?: string;
14
- errorMessage?: string;
15
23
  required?: boolean;
24
+ error?: boolean;
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,
34
+ error,
22
35
  errorMessage,
23
- required = false,
36
+ required,
24
37
  className = '',
25
38
  children,
26
39
  ...props
27
- }) => {
28
- const errorClassName = useStyles({ css: { color: 'error' } });
29
- const textareaClassNames = useStyles({
30
- css: { outlineColor: errorMessage && 'error' },
31
- className,
32
- });
33
-
34
- return (
35
- <Box>
36
- {label && (
37
- <Label htmlFor={htmlFor}>
38
- {label}
39
- {(errorMessage || required) && (
40
- <Required size={16} className={errorClassName} />
41
- )}
42
- </Label>
43
- )}
44
- <Box
45
- as="textarea"
46
- {...props}
47
- display="block"
48
- variant={`textarea.${variant}`}
49
- className={textareaClassNames}
50
- />
51
- {errorMessage && (
52
- <ValidationMessage>
53
- <Exclamation size={16} />
54
- {errorMessage}
55
- </ValidationMessage>
56
- )}
57
- </Box>
58
- );
59
- };
40
+ }) => (
41
+ <Box>
42
+ {label && (
43
+ <Label htmlFor={htmlFor} required={required}>
44
+ {label}
45
+ </Label>
46
+ )}
47
+ <Box
48
+ as="textarea"
49
+ {...props}
50
+ display="block"
51
+ variant={`textarea.${variant}`}
52
+ css={{ outlineColor: error && 'error' }}
53
+ className={className}
54
+ />
55
+ {error && errorMessage && (
56
+ <ValidationMessage>
57
+ <Exclamation size={16} />
58
+ {errorMessage}
59
+ </ValidationMessage>
60
+ )}
61
+ </Box>
62
+ );
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import type { Meta, ComponentStory } from '@storybook/react';
3
+ import { ValidationMessage } from './ValidationMessage';
4
+ import { Exclamation } from '@marigold/icons';
5
+
6
+ export default {
7
+ title: 'Components/ValidationMessage',
8
+ argTypes: {
9
+ variant: {
10
+ control: {
11
+ type: 'text',
12
+ },
13
+ table: {
14
+ defaultValue: {
15
+ summary: 'error',
16
+ },
17
+ },
18
+ },
19
+ },
20
+ } as Meta;
21
+
22
+ export const Basic: ComponentStory<typeof ValidationMessage> = args => (
23
+ <ValidationMessage {...args}>
24
+ <Exclamation />
25
+ Validation message
26
+ </ValidationMessage>
27
+ );
@@ -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
- alignItems: 'center',
14
+ p: 'medium',
10
15
  },
11
16
  warning: {
12
- alignItems: 'right',
17
+ p: 'small',
13
18
  },
14
19
  },
15
20
  };
@@ -22,7 +27,7 @@ test('supports default variant and themeSection', () => {
22
27
  );
23
28
  const validation = screen.getByTitle(/error/);
24
29
 
25
- expect(validation).toHaveStyle(`align-items: center`);
30
+ expect(validation).toHaveStyle(`padding: 8px`);
26
31
  });
27
32
 
28
33
  test('accepts other variant than default', () => {
@@ -35,7 +40,7 @@ test('accepts other variant than default', () => {
35
40
  );
36
41
  const validation = screen.getByTitle(/warning/);
37
42
 
38
- expect(validation).toHaveStyle(`align-items: right`);
43
+ expect(validation).toHaveStyle(`padding: 4px`);
39
44
  });
40
45
 
41
46
  test('renders correct HTML element', () => {
@@ -1,29 +1,40 @@
1
1
  import React from 'react';
2
- import { useStyles } from '@marigold/system';
3
2
  import { ComponentProps } from '@marigold/types';
4
3
 
4
+ import { Box } from '../Box';
5
+
6
+ // Theme Extension
7
+ // ---------------
8
+ export interface ValidationMessageThemeExtension<Value> {
9
+ validation?: {
10
+ [key: string]: Value;
11
+ };
12
+ }
13
+
14
+ // Props
15
+ // ---------------
5
16
  export type ValidationMessageProps = {
6
17
  variant?: string;
7
18
  } & ComponentProps<'span'>;
8
19
 
20
+ // Component
21
+ // ---------------
9
22
  export const ValidationMessage: React.FC<ValidationMessageProps> = ({
10
23
  variant = 'error',
11
24
  children,
12
25
  className,
13
26
  ...props
14
27
  }) => {
15
- const classNames = useStyles({
16
- variant: `validation.${variant}`,
17
- css: {
18
- display: 'flex',
19
- alignItems: 'center',
20
- },
21
- className,
22
- });
23
-
24
28
  return (
25
- <span className={classNames} {...props}>
29
+ <Box
30
+ as="span"
31
+ display="flex"
32
+ alignItems="center"
33
+ variant={`validation.${variant}`}
34
+ className={className}
35
+ {...props}
36
+ >
26
37
  {children}
27
- </span>
38
+ </Box>
28
39
  );
29
40
  };
@@ -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
@@ -1,23 +1,26 @@
1
1
  export * from './theme';
2
2
 
3
+ export * from './ActionGroup';
3
4
  export * from './Alert';
4
5
  export * from './Badge';
5
6
  export * from './Box';
6
7
  export * from './Button';
8
+ export * from './Card';
7
9
  export * from './Checkbox';
8
10
  export * from './Column';
9
11
  export * from './Columns';
10
12
  export * from './Dialog';
11
13
  export * from './Divider';
12
14
  export * from './Field';
13
- export * from './Heading';
14
- export * from './Hidden';
15
+ export * from './VisuallyHidden';
15
16
  export * from './Image';
17
+ export * from './Inline';
16
18
  export * from './Label';
17
19
  export * from './Link';
18
20
  export * from './Menu';
19
21
  export * from './MenuItem';
20
22
  export * from './Message';
23
+ export * from './Provider';
21
24
  export * from './Radio';
22
25
  export * from './Slider';
23
26
  export * from './Select';
@@ -27,3 +30,5 @@ export * from './Textarea';
27
30
  export * from './Input';
28
31
  export * from './Container';
29
32
  export * from './ValidationMessage';
33
+
34
+ export { Item, Section } from '@react-stately/collections';
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,45 +0,0 @@
1
- import { ResponsiveStyleValue } from '@marigold/system';
2
- import { ComponentWithAs } from '@marigold/types';
3
- export declare type BoxProps = {
4
- className?: string;
5
- variant?: string | string[];
6
- display?: ResponsiveStyleValue<string>;
7
- height?: ResponsiveStyleValue<number | string>;
8
- width?: ResponsiveStyleValue<number | string>;
9
- minWidth?: ResponsiveStyleValue<number | string>;
10
- maxWidth?: ResponsiveStyleValue<number | string>;
11
- position?: ResponsiveStyleValue<string>;
12
- top?: ResponsiveStyleValue<number | string>;
13
- bottom?: ResponsiveStyleValue<number | string>;
14
- right?: ResponsiveStyleValue<number | string>;
15
- left?: ResponsiveStyleValue<number | string>;
16
- zIndex?: ResponsiveStyleValue<number | string>;
17
- p?: ResponsiveStyleValue<number | string>;
18
- px?: ResponsiveStyleValue<number | string>;
19
- py?: ResponsiveStyleValue<number | string>;
20
- pt?: ResponsiveStyleValue<number | string>;
21
- pb?: ResponsiveStyleValue<number | string>;
22
- pl?: ResponsiveStyleValue<number | string>;
23
- pr?: ResponsiveStyleValue<number | string>;
24
- m?: ResponsiveStyleValue<number | string>;
25
- mx?: ResponsiveStyleValue<number | string>;
26
- my?: ResponsiveStyleValue<number | string>;
27
- mt?: ResponsiveStyleValue<number | string>;
28
- mb?: ResponsiveStyleValue<number | string>;
29
- ml?: ResponsiveStyleValue<number | string>;
30
- mr?: ResponsiveStyleValue<number | string>;
31
- flexDirection?: ResponsiveStyleValue<string>;
32
- flexWrap?: ResponsiveStyleValue<string>;
33
- flexShrink?: ResponsiveStyleValue<number | string>;
34
- flexGrow?: ResponsiveStyleValue<number | string>;
35
- alignItems?: ResponsiveStyleValue<string>;
36
- justifyContent?: ResponsiveStyleValue<string>;
37
- bg?: ResponsiveStyleValue<number | string>;
38
- border?: ResponsiveStyleValue<number | string>;
39
- borderRadius?: ResponsiveStyleValue<number | string>;
40
- boxShadow?: ResponsiveStyleValue<number | string>;
41
- opacity?: ResponsiveStyleValue<number | string>;
42
- overflow?: ResponsiveStyleValue<string>;
43
- transition?: ResponsiveStyleValue<number | string>;
44
- };
45
- export declare const Box: ComponentWithAs<BoxProps, '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';
@@ -1,45 +0,0 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
- import { useStyles } from '@marigold/system';
3
- import { Alert } from './Alert';
4
- import { Text } from '../Text/';
5
-
6
- <Meta title="Components/Alert" />
7
-
8
- # Alert
9
-
10
- ## Description
11
-
12
- Simple colored element to display an alert message as a reaction to an event.
13
- Predefined variants are info, success, danger and warning.
14
-
15
- ## Properties
16
-
17
- | Property | Type | Default |
18
- | :------------------- | :------------------------ | :-------- |
19
- | `variant` (optional) | `success, error, warning` | `success` |
20
-
21
- ## Import
22
-
23
- ```tsx
24
- import { Alert } from '@marigold/components';
25
- ```
26
-
27
- ## Usage
28
-
29
- <Canvas>
30
- <Story name="Success">
31
- <Alert>
32
- <Text>Success message</Text>
33
- </Alert>
34
- </Story>
35
- <Story name="Error">
36
- <Alert variant="error">
37
- <Text>Error message</Text>
38
- </Alert>
39
- </Story>
40
- <Story name="Warning">
41
- <Alert variant="warning">
42
- <Text>Warning message</Text>
43
- </Alert>
44
- </Story>
45
- </Canvas>
@@ -1,43 +0,0 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
- import { Badge } from './Badge';
3
- import { Text } from '../Text';
4
- import { Check } from '@marigold/icons';
5
- import { useStyles } from '@marigold/system';
6
-
7
- <Meta title="Components/Badge" />
8
-
9
- # Badge
10
-
11
- ## Description
12
-
13
- A badge tags an element with a short note and color. The content of the badge can be anything but preferably a string and/or icon.
14
-
15
- ## Properties
16
-
17
- | Property | Type | Default |
18
- | :--------------------------- | :------- | :------------ |
19
- | `variant` (optional) | `string` | `default` |
20
- | `borderColor` (optional) | `string` | `transparent` |
21
- | `bgColor` (optional) | `string` | `inherit` |
22
-
23
- ## Import
24
-
25
- ```tsx
26
- import { Badge } from '@marigold/components';
27
- ```
28
-
29
- ## Usage
30
-
31
- <Canvas>
32
- <Story name="Colored Background">
33
- <Badge borderColor="black" bgColor="orange">
34
- <Text>New</Text>
35
- </Badge>
36
- </Story>
37
- <Story name="Outlined">
38
- <Badge borderColor="orange" className={useStyles({ display: 'flex' })}>
39
- <Check size={18} />
40
- cool
41
- </Badge>
42
- </Story>
43
- </Canvas>
@@ -1,38 +0,0 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
- import { Box } from './Box';
3
- import { Button } from '../Button'
4
- import { Label } from '../Label'
5
-
6
- <Meta title="Components/Box" />
7
-
8
- # Box-Component
9
-
10
- ## Import
11
-
12
- ```js
13
- import { Box } from '@marigold/components';
14
- ```
15
-
16
- ## Usage
17
-
18
- <Canvas>
19
- <Story name="div-box">
20
- <Box>I am basic box!</Box>
21
- </Story>
22
- </Canvas>
23
-
24
- <Canvas>
25
- <Story name="button-box">
26
- <Box as="button" bg="primary">
27
- I am a button box!
28
- </Box>
29
- </Story>
30
- </Canvas>
31
-
32
- <Canvas>
33
- <Story name="h1-box">
34
- <Box as="h1" p="3">
35
- I am a blue headline!
36
- </Box>
37
- </Story>
38
- </Canvas>