imbric-theme 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. package/.babelrc.json +3 -0
  2. package/.commitlintrc.json +3 -0
  3. package/.editorconfig +13 -0
  4. package/.eslintcache +1 -0
  5. package/.eslintrc.json +36 -0
  6. package/.huskyrc.json +6 -0
  7. package/.lintstagedrc.json +5 -0
  8. package/.nvmrc +1 -0
  9. package/.prettierrc.json +4 -0
  10. package/.releaserc.json +13 -0
  11. package/.storybook/main.js +9 -0
  12. package/.storybook/preview-head.html +2 -0
  13. package/.storybook/preview.js +32 -0
  14. package/.stylelintrc.json +14 -0
  15. package/.vscode/launch.json +15 -0
  16. package/CHANGELOG.md +0 -0
  17. package/README.md +69 -0
  18. package/atoms/Avatar/Avatar.js +36 -0
  19. package/atoms/Avatar/Avatar.module.css +3 -0
  20. package/atoms/Avatar/Avatar.stories.js +29 -0
  21. package/atoms/Avatar/__snapshots__/Avatar.stories.js.snap +105 -0
  22. package/atoms/Avatar/constants.js +3 -0
  23. package/atoms/Avatar/helpers.js +7 -0
  24. package/atoms/Avatar/index.js +3 -0
  25. package/atoms/Button/Button.js +68 -0
  26. package/atoms/Button/Button.module.css +63 -0
  27. package/atoms/Button/Button.stories.js +47 -0
  28. package/atoms/Button/Button.test.js +60 -0
  29. package/atoms/Button/__snapshots__/Button.stories.js.snap +191 -0
  30. package/atoms/Button/constants.js +3 -0
  31. package/atoms/Button/index.js +3 -0
  32. package/atoms/Card/Card.js +48 -0
  33. package/atoms/Card/Card.module.css +52 -0
  34. package/atoms/Card/Card.stories.js +41 -0
  35. package/atoms/Card/__snapshots__/Card.stories.js.snap +136 -0
  36. package/atoms/Card/constants.js +4 -0
  37. package/atoms/Card/index.js +3 -0
  38. package/atoms/Check/Check.js +26 -0
  39. package/atoms/Check/Check.module.css +11 -0
  40. package/atoms/Check/Check.stories.js +15 -0
  41. package/atoms/Check/__snapshots__/Check.stories.js.snap +67 -0
  42. package/atoms/Check/index.js +2 -0
  43. package/atoms/Divider/Divider.js +19 -0
  44. package/atoms/Divider/Divider.module.css +5 -0
  45. package/atoms/Divider/Divider.stories.js +12 -0
  46. package/atoms/Divider/__snapshots__/Divider.stories.js.snap +22 -0
  47. package/atoms/Divider/index.js +2 -0
  48. package/atoms/Heading/Heading.js +37 -0
  49. package/atoms/Heading/Heading.module.css +66 -0
  50. package/atoms/Heading/Heading.stories.js +46 -0
  51. package/atoms/Heading/__snapshots__/Heading.stories.js.snap +189 -0
  52. package/atoms/Heading/constants.js +5 -0
  53. package/atoms/Heading/index.js +3 -0
  54. package/atoms/Icon/Icon.js +66 -0
  55. package/atoms/Icon/Icon.module.css +112 -0
  56. package/atoms/Icon/Icon.stories.js +48 -0
  57. package/atoms/Icon/__snapshots__/Icon.stories.js.snap +1311 -0
  58. package/atoms/Icon/constants.js +486 -0
  59. package/atoms/Icon/helpers.js +9 -0
  60. package/atoms/Icon/index.js +3 -0
  61. package/atoms/Input/Input.js +49 -0
  62. package/atoms/Input/Input.module.css +27 -0
  63. package/atoms/Input/Input.stories.js +32 -0
  64. package/atoms/Input/__snapshots__/Input.stories.js.snap +101 -0
  65. package/atoms/Input/constants.js +3 -0
  66. package/atoms/Input/index.js +3 -0
  67. package/atoms/Link/Link.js +33 -0
  68. package/atoms/Link/Link.module.css +14 -0
  69. package/atoms/Link/Link.stories.js +30 -0
  70. package/atoms/Link/__snapshots__/Link.stories.js.snap +118 -0
  71. package/atoms/Link/constants.js +5 -0
  72. package/atoms/Link/index.js +3 -0
  73. package/atoms/Loading/Loading.js +30 -0
  74. package/atoms/Loading/Loading.module.css +51 -0
  75. package/atoms/Loading/Loading.stories.js +17 -0
  76. package/atoms/Loading/__snapshots__/Loading.stories.js.snap +26 -0
  77. package/atoms/Loading/index.js +2 -0
  78. package/atoms/Modal/Modal.js +98 -0
  79. package/atoms/Modal/Modal.module.css +85 -0
  80. package/atoms/Modal/Modal.stories.js +43 -0
  81. package/atoms/Modal/__snapshots__/Modal.stories.js.snap +239 -0
  82. package/atoms/Modal/constants.js +1 -0
  83. package/atoms/Modal/index.js +3 -0
  84. package/atoms/Paragraph/Paragraph.js +56 -0
  85. package/atoms/Paragraph/Paragraph.module.css +68 -0
  86. package/atoms/Paragraph/Paragraph.stories.js +52 -0
  87. package/atoms/Paragraph/__snapshots__/Paragraph.stories.js.snap +230 -0
  88. package/atoms/Paragraph/constants.js +5 -0
  89. package/atoms/Paragraph/index.js +3 -0
  90. package/atoms/Picture/Picture.js +40 -0
  91. package/atoms/Picture/Picture.module.css +16 -0
  92. package/atoms/Picture/Picture.stories.js +32 -0
  93. package/atoms/Picture/__snapshots__/Picture.stories.js.snap +156 -0
  94. package/atoms/Picture/index.js +2 -0
  95. package/atoms/Textarea/Textarea.js +46 -0
  96. package/atoms/Textarea/Textarea.module.css +25 -0
  97. package/atoms/Textarea/Textarea.stories.js +16 -0
  98. package/atoms/Textarea/__snapshots__/Textarea.stories.js.snap +25 -0
  99. package/atoms/Textarea/index.js +2 -0
  100. package/codecov.yml +2 -0
  101. package/helpers/storybook.js +29 -0
  102. package/helpers/storybook.test.js +40 -0
  103. package/helpers/styles.js +37 -0
  104. package/helpers/styles.test.js +222 -0
  105. package/hocs/withStyles.js +17 -0
  106. package/hook/useMedia.js +22 -0
  107. package/index.js +31 -0
  108. package/jest.config.js +23 -0
  109. package/jest.setup.js +13 -0
  110. package/layout/CenteredContent/CenteredContent.js +30 -0
  111. package/layout/CenteredContent/CenteredContent.module.css +12 -0
  112. package/layout/CenteredContent/CenteredContent.stories.js +22 -0
  113. package/layout/CenteredContent/__snapshots__/CenteredContent.stories.js.snap +27 -0
  114. package/layout/CenteredContent/index.js +2 -0
  115. package/layout/Container/Container.js +29 -0
  116. package/layout/Container/Container.module.css +14 -0
  117. package/layout/Container/Container.stories.js +22 -0
  118. package/layout/Container/__snapshots__/Container.stories.js.snap +27 -0
  119. package/layout/Container/index.js +2 -0
  120. package/layout/FullHeightContent/FullHeightContent.js +40 -0
  121. package/layout/FullHeightContent/FullHeightContent.module.css +21 -0
  122. package/layout/FullHeightContent/FullHeightContent.stories.js +22 -0
  123. package/layout/FullHeightContent/__snapshots__/FullHeightContent.stories.js.snap +41 -0
  124. package/layout/FullHeightContent/index.js +2 -0
  125. package/layout/Spacer/Spacer.js +40 -0
  126. package/layout/Spacer/Spacer.module.css +12 -0
  127. package/layout/Spacer/Spacer.stories.js +25 -0
  128. package/layout/Spacer/__snapshots__/Spacer.stories.js.snap +97 -0
  129. package/layout/Spacer/components/Horizontal/Horizontal.js +43 -0
  130. package/layout/Spacer/components/Horizontal/Horizontal.stories.js +32 -0
  131. package/layout/Spacer/components/Horizontal/__snapshots__/Horizontal.stories.js.snap +97 -0
  132. package/layout/Spacer/components/Horizontal/index.js +1 -0
  133. package/layout/Spacer/components/Vertical/Vertical.js +31 -0
  134. package/layout/Spacer/components/Vertical/Vertical.stories.js +25 -0
  135. package/layout/Spacer/components/Vertical/__snapshots__/Vertical.stories.js.snap +85 -0
  136. package/layout/Spacer/components/Vertical/index.js +1 -0
  137. package/layout/Spacer/components/index.js +2 -0
  138. package/layout/Spacer/constants.js +5 -0
  139. package/layout/Spacer/helpers.js +3 -0
  140. package/layout/Spacer/index.js +3 -0
  141. package/molecules/Accordion/Accordion.js +70 -0
  142. package/molecules/Accordion/Accordion.module.css +12 -0
  143. package/molecules/Accordion/Accordion.stories.js +31 -0
  144. package/molecules/Accordion/__snapshots__/Accordion.stories.js.snap +228 -0
  145. package/molecules/Accordion/index.js +2 -0
  146. package/molecules/AddButton/AddButton.js +137 -0
  147. package/molecules/AddButton/AddButton.module.css +128 -0
  148. package/molecules/AddButton/AddButton.stories.js +47 -0
  149. package/molecules/AddButton/__snapshots__/AddButton.stories.js.snap +326 -0
  150. package/molecules/AddButton/constants.js +6 -0
  151. package/molecules/AddButton/handlers.js +58 -0
  152. package/molecules/AddButton/handlers.test.js +19 -0
  153. package/molecules/AddButton/helpers.js +6 -0
  154. package/molecules/AddButton/helpers.test.js +41 -0
  155. package/molecules/AddButton/hooks.js +14 -0
  156. package/molecules/AddButton/index.js +3 -0
  157. package/molecules/ButtonIcon/ButtonIcon.js +41 -0
  158. package/molecules/ButtonIcon/ButtonIcon.stories.js +27 -0
  159. package/molecules/ButtonIcon/__snapshots__/ButtonIcon.stories.js.snap +178 -0
  160. package/molecules/ButtonIcon/constants.js +6 -0
  161. package/molecules/ButtonIcon/index.js +2 -0
  162. package/molecules/Dropdown/Dropdown.js +59 -0
  163. package/molecules/Dropdown/Dropdown.module.css +34 -0
  164. package/molecules/Dropdown/Dropdown.stories.js +41 -0
  165. package/molecules/Dropdown/__snapshots__/Dropdown.stories.js.snap +181 -0
  166. package/molecules/Dropdown/index.js +2 -0
  167. package/molecules/Error/Error.js +35 -0
  168. package/molecules/Error/Error.module.css +11 -0
  169. package/molecules/Error/Error.stories.js +18 -0
  170. package/molecules/Error/__snapshots__/Error.stories.js.snap +134 -0
  171. package/molecules/Error/index.js +2 -0
  172. package/molecules/IconLabel/IconLabel.js +83 -0
  173. package/molecules/IconLabel/IconLabel.module.css +16 -0
  174. package/molecules/IconLabel/IconLabel.stories.js +25 -0
  175. package/molecules/IconLabel/__snapshots__/IconLabel.stories.js.snap +211 -0
  176. package/molecules/IconLabel/constants.js +6 -0
  177. package/molecules/IconLabel/index.js +3 -0
  178. package/molecules/LoadingError/LoadingError.js +31 -0
  179. package/molecules/LoadingError/LoadingError.stories.js +24 -0
  180. package/molecules/LoadingError/__snapshots__/LoadingError.stories.js.snap +109 -0
  181. package/molecules/LoadingError/index.js +1 -0
  182. package/molecules/Score/Score.js +61 -0
  183. package/molecules/Score/Score.module.css +11 -0
  184. package/molecules/Score/Score.stories.js +13 -0
  185. package/molecules/Score/__snapshots__/Score.stories.js.snap +100 -0
  186. package/molecules/Score/faces/happy.svg +7 -0
  187. package/molecules/Score/faces/normal.svg +6 -0
  188. package/molecules/Score/faces/sad.svg +6 -0
  189. package/molecules/Score/index.js +2 -0
  190. package/molecules/Task/Task.js +114 -0
  191. package/molecules/Task/Task.module.css +47 -0
  192. package/molecules/Task/Task.stories.js +47 -0
  193. package/molecules/Task/__snapshots__/Task.stories.js.snap +953 -0
  194. package/molecules/Task/constants.js +1 -0
  195. package/molecules/Task/index.js +3 -0
  196. package/molecules/TaskCounter/TaskCounter.js +74 -0
  197. package/molecules/TaskCounter/TaskCounter.module.css +11 -0
  198. package/molecules/TaskCounter/TaskCounter.stories.js +26 -0
  199. package/molecules/TaskCounter/__snapshots__/TaskCounter.stories.js.snap +177 -0
  200. package/molecules/TaskCounter/index.js +2 -0
  201. package/package.json +102 -0
  202. package/scripts/build-tokens.js +40 -0
  203. package/scripts/create-component.js +127 -0
  204. package/storybook.test.js +13 -0
  205. package/styles/globals.css +10 -0
  206. package/styles/tokens.css +390 -0
  207. package/templates/component/Component.js +22 -0
  208. package/templates/component/Component.module.css +3 -0
  209. package/templates/component/Component.stories.js +23 -0
  210. package/templates/component/constants.js +1 -0
  211. package/templates/component/index.js +3 -0
  212. package/tokens/Token/Helper.js +30 -0
  213. package/tokens/Token/Token.js +13 -0
  214. package/tokens/Token/Token.module.css +64 -0
  215. package/tokens/Token/components/Color.js +21 -0
  216. package/tokens/Token/components/Color.stories.js +126 -0
  217. package/tokens/Token/components/FontFamily.js +24 -0
  218. package/tokens/Token/components/FontFamily.stories.js +32 -0
  219. package/tokens/Token/components/FontSize.js +24 -0
  220. package/tokens/Token/components/FontSize.stories.js +31 -0
  221. package/tokens/Token/components/FontWeight.js +24 -0
  222. package/tokens/Token/components/FontWeight.stories.js +31 -0
  223. package/tokens/Token/components/Spacing.js +24 -0
  224. package/tokens/Token/components/Spacing.stories.js +29 -0
  225. package/tokens/Token/components/__snapshots__/Color.stories.js.snap +7169 -0
  226. package/tokens/Token/components/__snapshots__/FontFamily.stories.js.snap +133 -0
  227. package/tokens/Token/components/__snapshots__/FontSize.stories.js.snap +261 -0
  228. package/tokens/Token/components/__snapshots__/FontWeight.stories.js.snap +317 -0
  229. package/tokens/Token/components/__snapshots__/Spacing.stories.js.snap +229 -0
  230. package/tokens/Token/components/index.js +5 -0
  231. package/tokens/Token/helpers.js +17 -0
  232. package/tokens/Token/index.js +1 -0
  233. package/tokens/index.js +471 -0
  234. package/utils/isEmpty.js +28 -0
  235. package/utils/isEmpty.test.js +125 -0
  236. package/utils/isObject.js +4 -0
  237. package/utils/keyboardCodes.js +6 -0
  238. package/utils/testUtils/matchMediaMock.js +14 -0
  239. package/utils/testUtils/svgrMock.js +2 -0
  240. package/utils/toCapitalize.js +4 -0
  241. package/utils/toKebabCase.js +8 -0
  242. package/utils/toPascalCase.js +20 -0
  243. package/webpack/cssModules.js +30 -0
  244. package/webpack/loadConfigs.js +6 -0
  245. package/webpack/reactInlineSvg.js +22 -0
@@ -0,0 +1,101 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Storyshots Atoms/Input Default 1`] = `
4
+ <div
5
+ style={
6
+ Object {
7
+ "alignContent": "flex-start",
8
+ "display": "flex",
9
+ "flexDirection": "column",
10
+ "flexWrap": "wrap",
11
+ "gap": "10px 30px",
12
+ "height": "100%",
13
+ "justifyContent": "flex-start",
14
+ "maxHeight": "auto",
15
+ }
16
+ }
17
+ >
18
+ <input
19
+ className="input"
20
+ onChange={[Function]}
21
+ placeholder="Kingdom slowed"
22
+ type="text"
23
+ value=""
24
+ />
25
+ </div>
26
+ `;
27
+
28
+ exports[`Storyshots Atoms/Input Inline 1`] = `
29
+ <div
30
+ style={
31
+ Object {
32
+ "alignContent": "flex-start",
33
+ "display": "flex",
34
+ "flexDirection": "column",
35
+ "flexWrap": "wrap",
36
+ "gap": "10px 30px",
37
+ "height": "100%",
38
+ "justifyContent": "flex-start",
39
+ "maxHeight": "auto",
40
+ }
41
+ }
42
+ >
43
+ <input
44
+ className="input is-inline"
45
+ onChange={[Function]}
46
+ placeholder="Kingdom slowed"
47
+ type="text"
48
+ value=""
49
+ />
50
+ </div>
51
+ `;
52
+
53
+ exports[`Storyshots Atoms/Input Types 1`] = `
54
+ <div
55
+ style={
56
+ Object {
57
+ "alignContent": "flex-start",
58
+ "display": "flex",
59
+ "flexDirection": "column",
60
+ "flexWrap": "wrap",
61
+ "gap": "10px 30px",
62
+ "height": "100%",
63
+ "justifyContent": "flex-start",
64
+ "maxHeight": "auto",
65
+ }
66
+ }
67
+ >
68
+ <input
69
+ className="input"
70
+ onChange={[Function]}
71
+ placeholder="Kingdom slowed"
72
+ type="text"
73
+ value=""
74
+ />
75
+ </div>
76
+ `;
77
+
78
+ exports[`Storyshots Atoms/Input Value 1`] = `
79
+ <div
80
+ style={
81
+ Object {
82
+ "alignContent": "flex-start",
83
+ "display": "flex",
84
+ "flexDirection": "column",
85
+ "flexWrap": "wrap",
86
+ "gap": "10px 30px",
87
+ "height": "100%",
88
+ "justifyContent": "flex-start",
89
+ "maxHeight": "auto",
90
+ }
91
+ }
92
+ >
93
+ <input
94
+ className="input"
95
+ onChange={[Function]}
96
+ placeholder="Kingdom slowed"
97
+ type="text"
98
+ value="Others mainly cakehole Thorin moldy facial."
99
+ />
100
+ </div>
101
+ `;
@@ -0,0 +1,3 @@
1
+ export const options = {
2
+ types: ['text'],
3
+ }
@@ -0,0 +1,3 @@
1
+ export { default, Input } from './Input'
2
+ export { options } from './constants'
3
+ export { default as styles } from './Input.module.css'
@@ -0,0 +1,33 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+
4
+ import styles from './Link.module.css'
5
+ import { options } from './constants'
6
+ import withStyles from '../../hocs/withStyles'
7
+
8
+ import Paragraph from '../Paragraph'
9
+
10
+ export const Link = ({ children, size, color, getStyles }) => {
11
+ return (
12
+ <a className={getStyles('link', ['color'])}>
13
+ <Paragraph size={size} color={color} weight="semibold" isInline>
14
+ {children}
15
+ </Paragraph>
16
+ </a>
17
+ )
18
+ }
19
+
20
+ Link.propTypes = {
21
+ children: PropTypes.node.isRequired,
22
+ getStyles: PropTypes.func.isRequired,
23
+ color: PropTypes.oneOf(options.colors),
24
+ size: PropTypes.oneOf(options.sizes),
25
+ }
26
+
27
+ Link.defaultProps = {
28
+ getStyles: () => {},
29
+ color: 'primary',
30
+ size: 'md',
31
+ }
32
+
33
+ export default withStyles(styles)(Link)
@@ -0,0 +1,14 @@
1
+ .link {
2
+ display: inline;
3
+ max-width: max-content;
4
+ border-bottom: 1px solid currentColor;
5
+ cursor: pointer;
6
+ }
7
+
8
+ .color-primary {
9
+ color: var(--color-primary);
10
+ }
11
+
12
+ .color-tertiary {
13
+ color: var(--color-tertiary);
14
+ }
@@ -0,0 +1,30 @@
1
+ import { Link, styles, options } from '.'
2
+
3
+ import {
4
+ getTemplate,
5
+ getListTemplate,
6
+ getOptionsArgTypes,
7
+ } from '../../helpers/storybook'
8
+
9
+ const Template = getTemplate(Link, styles)
10
+ const ListTemplate = getListTemplate(Link, styles)
11
+
12
+ export default {
13
+ title: 'Atoms/Link',
14
+ component: Link,
15
+ args: {
16
+ children: 'Mouths Muil',
17
+ },
18
+ argTypes: {
19
+ color: getOptionsArgTypes(options.colors),
20
+ size: getOptionsArgTypes(options.sizes),
21
+ },
22
+ }
23
+
24
+ export const Default = Template.bind({})
25
+
26
+ export const Colors = ListTemplate.bind({})
27
+ Colors.args = { items: options.colors.map((color) => ({ color })) }
28
+
29
+ export const Sizes = ListTemplate.bind({})
30
+ Sizes.args = { items: options.sizes.map((size) => ({ size })) }
@@ -0,0 +1,118 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Storyshots Atoms/Link Colors 1`] = `
4
+ <div
5
+ style={
6
+ Object {
7
+ "alignContent": "flex-start",
8
+ "display": "flex",
9
+ "flexDirection": "column",
10
+ "flexWrap": "wrap",
11
+ "gap": "10px 30px",
12
+ "height": "100%",
13
+ "justifyContent": "flex-start",
14
+ "maxHeight": "auto",
15
+ }
16
+ }
17
+ >
18
+ <a
19
+ className="link color-primary"
20
+ >
21
+ <p
22
+ className="paragraph color-primary size-md weight-semibold is-inline"
23
+ >
24
+ Mouths Muil
25
+ </p>
26
+ </a>
27
+ <a
28
+ className="link color-tertiary"
29
+ >
30
+ <p
31
+ className="paragraph color-tertiary size-md weight-semibold is-inline"
32
+ >
33
+ Mouths Muil
34
+ </p>
35
+ </a>
36
+ </div>
37
+ `;
38
+
39
+ exports[`Storyshots Atoms/Link Default 1`] = `
40
+ <div
41
+ style={
42
+ Object {
43
+ "alignContent": "flex-start",
44
+ "display": "flex",
45
+ "flexDirection": "column",
46
+ "flexWrap": "wrap",
47
+ "gap": "10px 30px",
48
+ "height": "100%",
49
+ "justifyContent": "flex-start",
50
+ "maxHeight": "auto",
51
+ }
52
+ }
53
+ >
54
+ <a
55
+ className="link color-primary"
56
+ >
57
+ <p
58
+ className="paragraph color-primary size-md weight-semibold is-inline"
59
+ >
60
+ Mouths Muil
61
+ </p>
62
+ </a>
63
+ </div>
64
+ `;
65
+
66
+ exports[`Storyshots Atoms/Link Sizes 1`] = `
67
+ <div
68
+ style={
69
+ Object {
70
+ "alignContent": "flex-start",
71
+ "display": "flex",
72
+ "flexDirection": "column",
73
+ "flexWrap": "wrap",
74
+ "gap": "10px 30px",
75
+ "height": "100%",
76
+ "justifyContent": "flex-start",
77
+ "maxHeight": "auto",
78
+ }
79
+ }
80
+ >
81
+ <a
82
+ className="link color-primary"
83
+ >
84
+ <p
85
+ className="paragraph color-primary size-xs weight-semibold is-inline"
86
+ >
87
+ Mouths Muil
88
+ </p>
89
+ </a>
90
+ <a
91
+ className="link color-primary"
92
+ >
93
+ <p
94
+ className="paragraph color-primary size-sm weight-semibold is-inline"
95
+ >
96
+ Mouths Muil
97
+ </p>
98
+ </a>
99
+ <a
100
+ className="link color-primary"
101
+ >
102
+ <p
103
+ className="paragraph color-primary size-md weight-semibold is-inline"
104
+ >
105
+ Mouths Muil
106
+ </p>
107
+ </a>
108
+ <a
109
+ className="link color-primary"
110
+ >
111
+ <p
112
+ className="paragraph color-primary size-lg weight-semibold is-inline"
113
+ >
114
+ Mouths Muil
115
+ </p>
116
+ </a>
117
+ </div>
118
+ `;
@@ -0,0 +1,5 @@
1
+ import { options as paragraphOptions } from '../Paragraph/constants'
2
+ export const options = {
3
+ colors: ['primary', 'tertiary'],
4
+ sizes: paragraphOptions.sizes,
5
+ }
@@ -0,0 +1,3 @@
1
+ export { default, Link } from './Link'
2
+ export { options } from './constants'
3
+ export { default as styles } from './Link.module.css'
@@ -0,0 +1,30 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+
4
+ import styles from './Loading.module.css'
5
+ import withStyles from '../../hocs/withStyles'
6
+
7
+ export const Loading = ({ children, isShown, getStyles, isPlayground }) => {
8
+ if (isShown || isPlayground) {
9
+ return (
10
+ <div className={getStyles('container')}>
11
+ <div className={getStyles('loading', { 'is-shown': isShown })} />
12
+ </div>
13
+ )
14
+ }
15
+
16
+ return <>{children}</>
17
+ }
18
+
19
+ Loading.propTypes = {
20
+ getStyles: PropTypes.func.isRequired,
21
+ children: PropTypes.node,
22
+ isShown: PropTypes.bool,
23
+ isPlayground: PropTypes.bool,
24
+ }
25
+
26
+ Loading.defaultProps = {
27
+ getStyles: () => {},
28
+ }
29
+
30
+ export default withStyles(styles)(Loading)
@@ -0,0 +1,51 @@
1
+ .container {
2
+ --size: 15px;
3
+ --gap: 25px;
4
+ }
5
+
6
+ .loading,
7
+ .loading:before,
8
+ .loading:after {
9
+ width: var(--size);
10
+ height: var(--size);
11
+ animation: pulse 1.8s infinite ease-in-out;
12
+ animation-fill-mode: both;
13
+ border-radius: var(--border-radius-full);
14
+ }
15
+
16
+ .loading {
17
+ position: relative;
18
+ top: calc(var(--size) * -1);
19
+ left: var(--gap);
20
+ animation-delay: -0.16s;
21
+ color: var(--color-primary);
22
+ transform: translateZ(0);
23
+ }
24
+
25
+ .loading:before,
26
+ .loading:after {
27
+ position: absolute;
28
+ top: 0;
29
+ content: '';
30
+ }
31
+
32
+ .loading:before {
33
+ left: calc(var(--gap) * -1);
34
+ animation-delay: -0.32s;
35
+ }
36
+
37
+ .loading:after {
38
+ left: var(--gap);
39
+ }
40
+
41
+ @keyframes pulse {
42
+ 0%,
43
+ 80%,
44
+ 100% {
45
+ box-shadow: 0 var(--size) 0 calc(var(--size) / -2);
46
+ }
47
+
48
+ 40% {
49
+ box-shadow: 0 var(--size) 0 0;
50
+ }
51
+ }
@@ -0,0 +1,17 @@
1
+ import { Loading, styles } from '.'
2
+
3
+ import { getTemplate } from '../../helpers/storybook'
4
+
5
+ const Template = getTemplate(Loading, styles)
6
+
7
+ export default {
8
+ title: 'Atoms/Loading',
9
+ component: Loading,
10
+ args: {
11
+ isPlayground: true,
12
+ children:
13
+ "Adventures washed awfully web poured pirate Iáve extend shared? Glows visit bitter fire-breather 400 triumphant splash responsible Oakenshield's prong invitations mortal? It must be taken deep into Mordor and cast back into the fiery chasm from whence it came.",
14
+ },
15
+ }
16
+
17
+ export const Default = Template.bind({})
@@ -0,0 +1,26 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Storyshots Atoms/Loading Default 1`] = `
4
+ <div
5
+ style={
6
+ Object {
7
+ "alignContent": "flex-start",
8
+ "display": "flex",
9
+ "flexDirection": "column",
10
+ "flexWrap": "wrap",
11
+ "gap": "10px 30px",
12
+ "height": "100%",
13
+ "justifyContent": "flex-start",
14
+ "maxHeight": "auto",
15
+ }
16
+ }
17
+ >
18
+ <div
19
+ className="container"
20
+ >
21
+ <div
22
+ className="loading"
23
+ />
24
+ </div>
25
+ </div>
26
+ `;
@@ -0,0 +1,2 @@
1
+ export { default, Loading } from './Loading'
2
+ export { default as styles } from './Loading.module.css'
@@ -0,0 +1,98 @@
1
+ import React, { useState } from 'react'
2
+ import PropTypes from 'prop-types'
3
+
4
+ import styles from './Modal.module.css'
5
+ import { options } from './constants'
6
+ import withStyles from '../../hocs/withStyles'
7
+ import Icon from '../Icon'
8
+ import Container from '../../layout/Container'
9
+ import isEmpty from '../../utils/isEmpty'
10
+
11
+ import useMedia from '../../hook/useMedia'
12
+
13
+ // Sync with ./Modal.module.css#L13-L17
14
+ const FADE_OUT_ANIMATION_TIME = 400
15
+
16
+ const createHandlerClick = () => (event) => {
17
+ event?.stopPropagation()
18
+ }
19
+
20
+ const createHandlerClose = ({ onClose, setOnFadeOut }) => () => {
21
+ setOnFadeOut(true)
22
+ setTimeout(onClose, FADE_OUT_ANIMATION_TIME)
23
+ }
24
+
25
+ const handleSecondaryAction = ({ onSecondaryAction }) => () => {
26
+ onSecondaryAction()
27
+ }
28
+
29
+ export const Modal = ({
30
+ onClose,
31
+ secondaryAction,
32
+ children,
33
+ getStyles,
34
+ type,
35
+ isPlayground,
36
+ }) => {
37
+ const isDesktop = useMedia(['(min-width: 992px)'], [true])
38
+ const [onFadeOut, setOnFadeOut] = useState(false)
39
+
40
+ const handleClose = createHandlerClose({ onClose, setOnFadeOut })
41
+
42
+ return (
43
+ <div
44
+ className={getStyles('backdrop', {
45
+ 'is-playground': isPlayground,
46
+ 'on-fade-out': onFadeOut,
47
+ })}
48
+ onClick={handleClose}
49
+ >
50
+ <div
51
+ className={getStyles('modal', ['type'])}
52
+ onClick={createHandlerClick()}
53
+ >
54
+ <div className={getStyles('heading')}>
55
+ {!!onClose && (
56
+ <Icon
57
+ color={isDesktop && type === 'secondary' ? 'primary' : 'inverted'}
58
+ name={isDesktop ? 'cross' : 'angleLeft'}
59
+ background={isDesktop ? 'transparent' : 'muted'}
60
+ onClick={handleClose}
61
+ size={isDesktop ? 'lg' : 'md'}
62
+ />
63
+ )}
64
+ {secondaryAction && !isEmpty(secondaryAction) && (
65
+ <Icon
66
+ color="inverted"
67
+ name={secondaryAction?.icon}
68
+ background="muted"
69
+ onClick={handleSecondaryAction({
70
+ onSecondaryAction: secondaryAction?.handler,
71
+ })}
72
+ />
73
+ )}
74
+ </div>
75
+ <Container>{children}</Container>
76
+ </div>
77
+ </div>
78
+ )
79
+ }
80
+
81
+ Modal.propTypes = {
82
+ children: PropTypes.node.isRequired,
83
+ getStyles: PropTypes.func.isRequired,
84
+ onClose: PropTypes.func,
85
+ secondaryAction: PropTypes.shape({
86
+ icon: PropTypes.string,
87
+ handler: PropTypes.func,
88
+ }),
89
+ type: PropTypes.oneOf(options.types),
90
+ isPlayground: PropTypes.bool,
91
+ }
92
+
93
+ Modal.defaultProps = {
94
+ getStyles: () => {},
95
+ type: 'primary',
96
+ }
97
+
98
+ export default withStyles(styles)(Modal)
@@ -0,0 +1,85 @@
1
+ .backdrop {
2
+ position: fixed;
3
+ z-index: var(--z-index-50);
4
+ display: flex;
5
+ align-items: center;
6
+ justify-content: center;
7
+ background: var(--modal-backdrop-color);
8
+ inset: 0;
9
+ }
10
+
11
+ .backdrop:not(.is-playground) {
12
+ animation: fadeInModal 0.2s ease-in forwards;
13
+ }
14
+
15
+ .backdrop.on-fade-out {
16
+ animation: fadeOutModal 0.2s ease-in forwards;
17
+ }
18
+
19
+ .modal {
20
+ display: flex;
21
+ width: 100%;
22
+ height: 100%;
23
+ flex-direction: column;
24
+ padding: 16px 32px;
25
+ }
26
+
27
+ :not(.is-playground) > .modal {
28
+ animation: fadeInModal 0.4s ease-in forwards;
29
+ opacity: 0;
30
+ }
31
+
32
+ .backdrop.on-fade-out .modal {
33
+ animation: fadeOutModal 0.4s ease-in forwards;
34
+ }
35
+
36
+ .heading {
37
+ display: flex;
38
+ justify-content: space-between;
39
+ }
40
+
41
+ .is-playground {
42
+ position: relative;
43
+ width: calc(50% - 15px);
44
+ border: var(--border-width-thick) dashed var(--color-primary);
45
+ }
46
+
47
+ .type-primary {
48
+ background-color: var(--color-primary);
49
+ }
50
+
51
+ .type-secondary {
52
+ background-color: var(--background-color-primary);
53
+ }
54
+
55
+ @media (min-width: 992px) {
56
+ .modal {
57
+ max-width: var(--modal-desktop-max-width);
58
+ height: var(--modal-desktop-height);
59
+ border-radius: var(--border-radius-sm);
60
+ }
61
+
62
+ .heading {
63
+ flex-direction: row-reverse;
64
+ }
65
+ }
66
+
67
+ @keyframes fadeInModal {
68
+ from {
69
+ opacity: 0;
70
+ }
71
+
72
+ to {
73
+ opacity: 1;
74
+ }
75
+ }
76
+
77
+ @keyframes fadeOutModal {
78
+ from {
79
+ opacity: 1;
80
+ }
81
+
82
+ to {
83
+ opacity: 0;
84
+ }
85
+ }
@@ -0,0 +1,43 @@
1
+ import { Modal, styles, options } from '.'
2
+
3
+ import {
4
+ getTemplate,
5
+ getListTemplate,
6
+ getOptionsArgTypes,
7
+ } from '../../helpers/storybook'
8
+
9
+ const Template = getTemplate(Modal, styles)
10
+ const ListTemplate = getListTemplate(Modal, styles)
11
+
12
+ export default {
13
+ title: 'Atoms/Modal',
14
+ component: Modal,
15
+ args: {
16
+ isPlayground: true,
17
+ onClose: null,
18
+ children:
19
+ "Successful boar world's somebody herbs helpful spiders Samwise Gamgee helps unlost circles guard? Investment Thofin folly? Troublemaker minutes moldy Rivendell eve late traveling around crescent fault never naught",
20
+ },
21
+ argTypes: {
22
+ type: getOptionsArgTypes(options.types),
23
+ onClose: { action: 'clicked' },
24
+ },
25
+ parameters: { __sb: { fd: 'row' } },
26
+ }
27
+
28
+ export const Default = Template.bind({})
29
+
30
+ export const Closable = Template.bind({})
31
+ Closable.args = { onClose: () => {} }
32
+
33
+ export const SecondaryAction = Template.bind({})
34
+ SecondaryAction.args = {
35
+ onClose: () => {},
36
+ secondaryAction: {
37
+ icon: 'checkCircle',
38
+ handler: () => {},
39
+ },
40
+ }
41
+
42
+ export const Types = ListTemplate.bind({})
43
+ Types.args = { items: options.types.map((type) => ({ type })) }