@marigold/components 0.1.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/CHANGELOG.md +180 -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 +12 -4
  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 +7 -3
  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 +3 -0
  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 +5 -0
  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 +1068 -601
  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 +1003 -579
  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 +22 -3
  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 +67 -68
  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 +32 -23
  115. package/src/Divider/Divider.tsx +27 -7
  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 +6 -2
  134. package/src/Link/Link.tsx +12 -1
  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 +25 -41
  164. package/src/Text/Text.stories.tsx +61 -0
  165. package/src/Text/Text.test.tsx +2 -2
  166. package/src/Text/Text.tsx +25 -14
  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 -46
  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 -157
  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 -81
  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
@@ -1,247 +0,0 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
- import { Column, Columns, Divider, Text } from '@marigold/components';
3
- import { useStyles } from '@marigold/system';
4
-
5
- <Meta title="Components/Columns" />
6
-
7
- # Columns
8
-
9
- ## Description
10
-
11
- With the Columns component you can add a bundle of column components by adding props to create a layout.
12
-
13
- ## Properties
14
-
15
- | Property | Type | Default |
16
- | :--------------------------- | :-------------------- | :------ |
17
- | `space` (optional) | `number` | `0` |
18
- | `horizontalAlign` (optional) | `left, right, center` | `left` |
19
- | `verticalAlign` (optional) | `top, bottom, center` | `top` |
20
-
21
- ## Import
22
-
23
- ```tsx
24
- import { Columns } from '@marigold/components';
25
- ```
26
-
27
- ## Usage
28
-
29
- ### Spacing
30
-
31
- <Canvas>
32
- <Story name="Spacing">
33
- <Columns space={24} className={useStyles({ bg: '#f3f3f3' })}>
34
- <Column width={4}>
35
- <Text>
36
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
37
- dignissim dapibus elit, vel egestas felis pharetra non. Cras
38
- malesuada, massa nec ultricies efficitur, lectus ante consequat magna,
39
- a porttitor massa ex ut quam.
40
- </Text>
41
- </Column>
42
- <Column width={4}>
43
- <Text>
44
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
45
- dignissim dapibus elit, vel egestas felis pharetra non. Cras
46
- malesuada, massa nec ultricies efficitur, lectus ante consequat magna,
47
- a porttitor massa ex ut quam.
48
- </Text>
49
- </Column>
50
- <Column width={4}>
51
- <Text>
52
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
53
- dignissim dapibus elit, vel egestas felis pharetra non. Cras
54
- malesuada, massa nec ultricies efficitur, lectus ante consequat magna,
55
- a porttitor massa ex ut quam.
56
- </Text>
57
- </Column>
58
- </Columns>
59
- </Story>
60
- </Canvas>
61
-
62
- ### Width
63
-
64
- <Canvas>
65
- <Story name="Width">
66
- <Columns space={24} className={useStyles({ bg: '#f3f3f3' })}>
67
- <Column
68
- width={12}
69
- className={useStyles({
70
- border: '1px solid',
71
- borderRadius: '4px',
72
- padding: '4px',
73
- })}
74
- >
75
- <Text>width=12</Text>
76
- </Column>
77
- <Column
78
- width={6}
79
- className={useStyles({
80
- border: '1px solid',
81
- borderRadius: '4px',
82
- padding: '4px',
83
- })}
84
- >
85
- <Text>width=6</Text>
86
- </Column>
87
- <Column
88
- width={6}
89
- className={useStyles({
90
- border: '1px solid',
91
- borderRadius: '4px',
92
- padding: '4px',
93
- })}
94
- >
95
- <Text>width=6</Text>
96
- </Column>
97
- <Column
98
- width={4}
99
- className={useStyles({
100
- border: '1px solid',
101
- borderRadius: '4px',
102
- padding: '4px',
103
- })}
104
- >
105
- <Text>width=4</Text>
106
- </Column>
107
- <Column
108
- width={4}
109
- className={useStyles({
110
- border: '1px solid',
111
- borderRadius: '4px',
112
- padding: '4px',
113
- })}
114
- >
115
- <Text>width=4</Text>
116
- </Column>
117
- <Column
118
- width={4}
119
- className={useStyles({
120
- border: '1px solid',
121
- borderRadius: '4px',
122
- padding: '4px',
123
- })}
124
- >
125
- <Text>width=4</Text>
126
- </Column>
127
- <Column
128
- width={3}
129
- className={useStyles({
130
- border: '1px solid',
131
- borderRadius: '4px',
132
- padding: '4px',
133
- })}
134
- >
135
- <Text>width=3</Text>
136
- </Column>
137
- <Column
138
- width={3}
139
- className={useStyles({
140
- border: '1px solid',
141
- borderRadius: '4px',
142
- padding: '4px',
143
- })}
144
- >
145
- <Text>width=3</Text>
146
- </Column>
147
- <Column
148
- width={3}
149
- className={useStyles({
150
- border: '1px solid',
151
- borderRadius: '4px',
152
- padding: '4px',
153
- })}
154
- >
155
- <Text>width=3</Text>
156
- </Column>
157
- <Column
158
- width={3}
159
- className={useStyles({
160
- border: '1px solid',
161
- borderRadius: '4px',
162
- padding: '4px',
163
- })}
164
- >
165
- <Text>width=3</Text>
166
- </Column>
167
- </Columns>
168
- </Story>
169
- </Canvas>
170
-
171
- ### Horizontal Alignment
172
-
173
- <Canvas>
174
- <Story name="horizantalAlign">
175
- <Columns
176
- space={24}
177
- horizontalAlign="left"
178
- className={useStyles({ bg: '#f3f3f3' })}
179
- >
180
- <Column width={1}>
181
- <Text>left</Text>
182
- </Column>
183
- </Columns>
184
- <Divider />
185
- <Columns
186
- space={24}
187
- horizontalAlign="center"
188
- className={useStyles({ bg: '#f3f3f3' })}
189
- >
190
- <Column width={1}>
191
- <Text>center</Text>
192
- </Column>
193
- </Columns>
194
- <Divider />
195
- <Columns
196
- space={24}
197
- horizontalAlign="right"
198
- className={useStyles({ bg: '#f3f3f3' })}
199
- >
200
- <Column width={1}>
201
- <Text>right</Text>
202
- </Column>
203
- </Columns>
204
- </Story>
205
- </Canvas>
206
-
207
- ### Vertical Alignment
208
-
209
- <Canvas>
210
- <Story name="verticalAlign">
211
- <Columns
212
- verticalAlign="top"
213
- className={useStyles({
214
- bg: '#f3f3f3',
215
- height: '80px',
216
- })}
217
- >
218
- <Column width={1}>
219
- <Text>top</Text>
220
- </Column>
221
- </Columns>
222
- <Divider />
223
- <Columns
224
- verticalAlign="center"
225
- className={useStyles({
226
- bg: '#f3f3f3',
227
- height: '80px',
228
- })}
229
- >
230
- <Column width={1}>
231
- <Text>center</Text>
232
- </Column>
233
- </Columns>
234
- <Divider />
235
- <Columns
236
- verticalAlign="bottom"
237
- className={useStyles({
238
- bg: '#f3f3f3',
239
- height: '80px',
240
- })}
241
- >
242
- <Column width={1}>
243
- <Text>bottom</Text>
244
- </Column>
245
- </Columns>
246
- </Story>
247
- </Canvas>
@@ -1,36 +0,0 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
- import { Container } from './Container';
3
- import { Text } from '../Text';
4
- import { useStyles } from '@marigold/system';
5
-
6
- <Meta title="Components/Container" />
7
-
8
- # Container
9
-
10
- ## Description
11
-
12
- Primitive layout component to embed other elements.
13
-
14
- ## Import
15
-
16
- ```tsx
17
- import { Container } from '@marigold/components';
18
- ```
19
-
20
- ## Usage
21
-
22
- <Canvas>
23
- <Story name="Example 1">
24
- <Container className={useStyles({ bg: 'gray' })}>
25
- <Text>Example #1</Text>
26
- </Container>
27
- </Story>
28
- </Canvas>
29
-
30
- <Canvas>
31
- <Story name="Example 2">
32
- <Container className={useStyles({ bg: 'green', padding: 4, margin: 1 })}>
33
- <Text>Example #2</Text>
34
- </Container>
35
- </Story>
36
- </Canvas>
@@ -1,64 +0,0 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
- import { useStyles } from '@marigold/system';
3
- import { Dialog } from './Dialog';
4
- import { Heading } from '../Heading/';
5
- import { Text } from '../Text/';
6
- import { Button } from '../Button/';
7
-
8
- <Meta title="Components/Dialog" />
9
-
10
- # Dialog
11
-
12
- ## Description
13
-
14
- Element to display a Dialog as a reaction to an event. The user style or fill the body of the dialog with content.
15
-
16
- ## Properties
17
-
18
- | Property | Type | Default |
19
- | :-------- | :--------- | :------ |
20
- | `onClick` | `function` | |
21
-
22
- ## Import
23
-
24
- ```tsx
25
- import { Dialog } from '@marigold/components';
26
- ```
27
-
28
- ## Usage
29
-
30
- <Canvas>
31
- <Story name="basic">
32
- <Dialog
33
- title="Title"
34
- className={useStyles({
35
- background: '#f3f3f3',
36
- })}
37
- >
38
- <Heading as="h4" variant="h4">
39
- Dialog Title
40
- </Heading>
41
- <Text>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</Text>
42
- <Text>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</Text>
43
- <Text>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</Text>
44
- </Dialog>
45
- </Story>
46
- </Canvas>
47
-
48
- <Canvas>
49
- <Story name="button">
50
- <Dialog
51
- title="Title"
52
- className={useStyles({
53
- border: '1px solid',
54
- })}
55
- >
56
- <Heading as="h4" variant="h4">
57
- Marigold
58
- </Heading>
59
- <Text>Do you love the marigold design system?</Text>
60
- <br />
61
- <Button variant="secondary.small">Agree</Button>
62
- </Dialog>
63
- </Story>
64
- </Canvas>
@@ -1,43 +0,0 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
- import { Divider } from './Divider';
3
- import { Text } from '../Text';
4
-
5
- <Meta title="Components/Divider" />
6
-
7
- # Divider
8
-
9
- ## Description
10
-
11
- A divider is a layout or list element to group content or separate elements.
12
- The themeSection is `divider` and the variant can be added with the variant prop which is `regular` per default.
13
-
14
- ## Properties
15
-
16
- | Property | Type | Default |
17
- | :------------------- | :------- | :-------- |
18
- | `variant` (optional) | `string` | `regular` |
19
-
20
- ## Import
21
-
22
- ```tsx
23
- import { Divider } from '@marigold/components';
24
- ```
25
-
26
- ## Usage
27
-
28
- <Canvas>
29
- <Story name="Divider/regular">
30
- <div>
31
- <Text>Some text</Text>
32
- <Divider />
33
- <Text>Some other text to show regular divider</Text>
34
- </div>
35
- </Story>
36
- <Story name="Divider/bold">
37
- <div>
38
- <Text>Some text</Text>
39
- <Divider variant="bold" />
40
- <Text>Some other text to show strong divider</Text>
41
- </div>
42
- </Story>
43
- </Canvas>
@@ -1,57 +0,0 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
- import { Field } from './Field';
3
- import { useStyles } from '@marigold/system';
4
-
5
- <Meta title="Components/Field" />
6
-
7
- # Field
8
-
9
- ## Description
10
-
11
- With the Field component you can add a HTML `<label>` and `<input>` element to your form.
12
- The element uses always the themeSection with the name: `field` in your given theme. The variant in your section can be added with the variant prop.
13
- The default variant is `default`.
14
-
15
- ## Properties
16
-
17
- | Property | Type | Default |
18
- | :------------------- | :----------------------------------------------------------------------------------------- | :-------- |
19
- | `variant` (optional) | `string` | `default` |
20
- | `htmlFor` | `string` | |
21
- | `label` | `string` | |
22
- | `error` (optional) | `string` | |
23
- | `type` | `date, datetime-local, email, month, number, password, search, tel, text, time, url, week` | `text` |
24
-
25
- ## Import
26
-
27
- ```tsx
28
- import { Field } from '@marigold/components';
29
- ```
30
-
31
- ## Usage
32
-
33
- <Canvas>
34
- <Story name="Field1">
35
- <div>
36
- <Field label="Firstname" htmlFor="myId" />
37
- <br />
38
- <Field label="Name" htmlFor="myId" error="Validation message" />
39
- </div>
40
- </Story>
41
- </Canvas>
42
-
43
- <Canvas>
44
- <Story name="Field2">
45
- <div>
46
- <Field
47
- label="Pick your date"
48
- type="date"
49
- htmlFor="myId"
50
- error="ERROR!"
51
- className={useStyles({ color: '#dd4142' })}
52
- />
53
- <br />
54
- <Field label="Choose the week" type="week" htmlFor="myId" />
55
- </div>
56
- </Story>
57
- </Canvas>
@@ -1,91 +0,0 @@
1
- import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
- import { Heading } from './Heading';
3
- import { Text } from '../Text';
4
-
5
- <Meta title="Components/Heading" />
6
-
7
- # Heading
8
-
9
- ## Description
10
-
11
- Use the Heading component for headings of texts. Predefined variants are `h1`, `h2`, `h3`, `h4`, `h5` and `h6`.
12
-
13
- ## Properties
14
-
15
- | Property | Type | Default |
16
- | :-------- | :--------------------------------- | :------ |
17
- | `as` | `h1`, `h2`, `h3`, `h4`, `h5`, `h6` | `h2` |
18
- | `variant` | `string` | `h2` |
19
-
20
- ## Import
21
-
22
- ```tsx
23
- import { Heading } from '@marigold/components';
24
- ```
25
-
26
- ## Usage
27
-
28
- <Canvas>
29
- <Story name="Headings">
30
- <div>
31
- <Heading as="h2" variant="h1">
32
- H1 amazing heading
33
- </Heading>
34
- <Text as="p" variant="heading">
35
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
36
- eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
37
- voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
38
- clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
39
- amet.
40
- </Text>
41
- <Heading>H2 amazing heading</Heading>
42
- <Text as="p" variant="heading">
43
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
44
- eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
45
- voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
46
- clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
47
- amet.
48
- </Text>
49
- <Heading as="h3" variant="h3">
50
- H3 amazing heading
51
- </Heading>
52
- <Text as="p" variant="heading">
53
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
54
- eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
55
- voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
56
- clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
57
- amet.
58
- </Text>
59
- <Heading as="h4" variant="h4">
60
- H4 amazing heading
61
- </Heading>
62
- <Text as="p" variant="heading">
63
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
64
- eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
65
- voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
66
- clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
67
- amet.
68
- </Text>
69
- <Heading as="h5" variant="h5">
70
- H5 amazing heading
71
- </Heading>
72
- <Text as="p" variant="heading">
73
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
74
- eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
75
- voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
76
- clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
77
- amet.
78
- </Text>
79
- <Heading as="h6" variant="h6">
80
- H6 amazing heading
81
- </Heading>
82
- <Text as="p" variant="heading">
83
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
84
- eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
85
- voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
86
- clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
87
- amet.
88
- </Text>
89
- </div>
90
- </Story>
91
- </Canvas>
@@ -1,77 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import { ThemeProvider } from '@marigold/system';
4
- import { Heading } from './Heading';
5
-
6
- const theme = {
7
- text: {
8
- h2: {
9
- fontFamily: 'Inter',
10
- },
11
- h3: {
12
- fontFamily: 'Roboto',
13
- },
14
- },
15
- };
16
-
17
- test('supports default variant and themeSection', () => {
18
- render(
19
- <ThemeProvider theme={theme}>
20
- <Heading title="default">Default</Heading>
21
- </ThemeProvider>
22
- );
23
- const heading = screen.getByTitle(/default/);
24
-
25
- expect(heading).toHaveStyle(`font-family: Inter`);
26
- });
27
-
28
- test('accepts other variant than default', () => {
29
- render(
30
- <ThemeProvider theme={theme}>
31
- <Heading title="default" variant="h3">
32
- Default
33
- </Heading>
34
- </ThemeProvider>
35
- );
36
- const heading = screen.getByTitle(/default/);
37
-
38
- expect(heading).toHaveStyle(`font-family: Roboto`);
39
- });
40
-
41
- test('supports default as prop', () => {
42
- render(<Heading title="default">Default</Heading>);
43
- const heading = screen.getByTitle(/default/);
44
-
45
- expect(heading.tagName).toEqual('H2');
46
- });
47
-
48
- test('accepts other as prop than default', () => {
49
- render(
50
- <Heading as="h3" title="default" variant="h3">
51
- Default
52
- </Heading>
53
- );
54
- const heading = screen.getByTitle(/default/);
55
-
56
- expect(heading.tagName).toEqual('H3');
57
- });
58
-
59
- test('renders correct HTML element', () => {
60
- render(<Heading title="default">Default</Heading>);
61
- const heading = screen.getByTitle(/default/);
62
-
63
- expect(heading instanceof HTMLHeadingElement).toBeTruthy();
64
- });
65
-
66
- test('accepts custom styles prop className', () => {
67
- render(
68
- <ThemeProvider theme={theme}>
69
- <Heading className="custom-class-name" title="heading">
70
- Default
71
- </Heading>
72
- </ThemeProvider>
73
- );
74
- const heading = screen.getByTitle(/heading/);
75
-
76
- expect(heading.className).toMatch('custom-class-name');
77
- });
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { ComponentProps } from '@marigold/types';
3
- import { Box } from '../Box';
4
-
5
- export type HeadingProps = {
6
- as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
7
- variant?: string;
8
- } & ComponentProps<'h1'>;
9
-
10
- export const Heading: React.FC<HeadingProps> = ({
11
- as = 'h2',
12
- variant = 'h2',
13
- children,
14
- ...props
15
- }) => (
16
- <Box {...props} as={as} variant={`text.${variant}`}>
17
- {children}
18
- </Box>
19
- );
@@ -1 +0,0 @@
1
- export * from './Heading';