@popsure/dirty-swan 0.26.8 → 0.26.11

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 (233) hide show
  1. package/dist/index.css +1 -0
  2. package/dist/index.css.map +1 -1
  3. package/dist/lib/scss/private/components/_buttons.scss +2 -0
  4. package/package.json +2 -1
  5. package/src/App.tsx +50 -0
  6. package/src/bin/index.ts +71 -0
  7. package/src/bin/tsconfig.json +13 -0
  8. package/src/bin/util/index.test.ts +85 -0
  9. package/src/bin/util/index.ts +132 -0
  10. package/src/bin/util/test/data.json +13 -0
  11. package/src/colors.scss +1 -0
  12. package/src/font-weight.scss +1 -0
  13. package/src/grid.scss +1 -0
  14. package/src/index.tsx +37 -0
  15. package/src/intro.stories.mdx +41 -0
  16. package/src/lib/components/autocompleteAddress/demo.tsx +38 -0
  17. package/src/lib/components/autocompleteAddress/index.stories.mdx +44 -0
  18. package/src/lib/components/autocompleteAddress/index.tsx +316 -0
  19. package/src/lib/components/autocompleteAddress/mapStyle.ts +187 -0
  20. package/src/lib/components/autocompleteAddress/style.module.scss +82 -0
  21. package/src/lib/components/autocompleteAddress/util/index.test.ts +51 -0
  22. package/src/lib/components/autocompleteAddress/util/index.ts +55 -0
  23. package/src/lib/components/button/icons/index.ts +14 -0
  24. package/src/lib/components/button/icons/send-purple.svg +4 -0
  25. package/src/lib/components/button/icons/send-white.svg +4 -0
  26. package/src/lib/components/button/index.stories.mdx +121 -0
  27. package/src/lib/components/button/index.tsx +64 -0
  28. package/src/lib/components/button/styles.module.scss +5 -0
  29. package/src/lib/components/cards/a.stories.mdx +44 -0
  30. package/src/lib/components/cards/cardButton/index.stories.mdx +47 -0
  31. package/src/lib/components/cards/cardButton/index.tsx +61 -0
  32. package/src/lib/components/cards/cardButton/style.module.scss +33 -0
  33. package/src/lib/components/cards/cardWithLeftIcon/index.stories.mdx +103 -0
  34. package/src/lib/components/cards/cardWithLeftIcon/index.tsx +87 -0
  35. package/src/lib/components/cards/cardWithLeftIcon/style.module.scss +23 -0
  36. package/src/lib/components/cards/cardWithTopIcon/index.stories.mdx +105 -0
  37. package/src/lib/components/cards/cardWithTopIcon/index.tsx +60 -0
  38. package/src/lib/components/cards/cardWithTopIcon/style.module.scss +10 -0
  39. package/src/lib/components/cards/cardWithTopLeftIcon/index.stories.mdx +101 -0
  40. package/src/lib/components/cards/cardWithTopLeftIcon/index.tsx +72 -0
  41. package/src/lib/components/cards/cardWithTopLeftIcon/style.module.scss +21 -0
  42. package/src/lib/components/cards/icons/arrow-right.svg +4 -0
  43. package/src/lib/components/cards/icons/chevron-right.svg +3 -0
  44. package/src/lib/components/cards/icons/feather-logo.svg +10 -0
  45. package/src/lib/components/cards/icons/index.ts +36 -0
  46. package/src/lib/components/cards/icons/info.svg +12 -0
  47. package/src/lib/components/cards/index.test.ts +37 -0
  48. package/src/lib/components/cards/index.tsx +57 -0
  49. package/src/lib/components/cards/infoCard/index.stories.mdx +61 -0
  50. package/src/lib/components/cards/infoCard/index.tsx +47 -0
  51. package/src/lib/components/cards/infoCard/style.module.scss +53 -0
  52. package/src/lib/components/chip/icons/remove-button-highlighted.svg +4 -0
  53. package/src/lib/components/chip/icons/remove-button.svg +4 -0
  54. package/src/lib/components/chip/index.stories.mdx +101 -0
  55. package/src/lib/components/chip/index.tsx +38 -0
  56. package/src/lib/components/chip/style.module.scss +54 -0
  57. package/src/lib/components/comparisonTable/components/Chevron.tsx +19 -0
  58. package/src/lib/components/comparisonTable/components/Row/index.tsx +68 -0
  59. package/src/lib/components/comparisonTable/components/Row/style.module.scss +114 -0
  60. package/src/lib/components/comparisonTable/components/TableArrows/Arrow.tsx +19 -0
  61. package/src/lib/components/comparisonTable/components/TableArrows/index.tsx +52 -0
  62. package/src/lib/components/comparisonTable/components/TableArrows/style.module.scss +53 -0
  63. package/src/lib/components/comparisonTable/components/TableInfoButton/index.tsx +37 -0
  64. package/src/lib/components/comparisonTable/components/TableInfoButton/style.module.scss +30 -0
  65. package/src/lib/components/comparisonTable/components/TableRating/StarIcon.tsx +13 -0
  66. package/src/lib/components/comparisonTable/components/TableRating/ZapIcon.tsx +17 -0
  67. package/src/lib/components/comparisonTable/components/TableRating/index.tsx +45 -0
  68. package/src/lib/components/comparisonTable/components/TableRating/style.module.scss +13 -0
  69. package/src/lib/components/comparisonTable/components/TableRowHeader/index.tsx +35 -0
  70. package/src/lib/components/comparisonTable/components/TableRowHeader/style.module.scss +3 -0
  71. package/src/lib/components/comparisonTable/components/TableTrueFalse.tsx +40 -0
  72. package/src/lib/components/comparisonTable/hooks/useActiveTableArrows.ts +63 -0
  73. package/src/lib/components/comparisonTable/index.stories.mdx +254 -0
  74. package/src/lib/components/comparisonTable/index.tsx +211 -0
  75. package/src/lib/components/comparisonTable/style.module.scss +104 -0
  76. package/src/lib/components/dateSelector/datepicker.scss +406 -0
  77. package/src/lib/components/dateSelector/icons/calendar.svg +6 -0
  78. package/src/lib/components/dateSelector/icons/chevron-left.svg +3 -0
  79. package/src/lib/components/dateSelector/icons/chevron-right.svg +3 -0
  80. package/src/lib/components/dateSelector/index.stories.mdx +62 -0
  81. package/src/lib/components/dateSelector/index.test.ts +33 -0
  82. package/src/lib/components/dateSelector/index.tsx +247 -0
  83. package/src/lib/components/dateSelector/style.module.scss +77 -0
  84. package/src/lib/components/downloadButton/icons/check.svg +3 -0
  85. package/src/lib/components/downloadButton/icons/download.svg +5 -0
  86. package/src/lib/components/downloadButton/index.stories.mdx +59 -0
  87. package/src/lib/components/downloadButton/index.tsx +67 -0
  88. package/src/lib/components/downloadButton/style.module.scss +19 -0
  89. package/src/lib/components/downloadRing/icons/check-outside-circle.tsx +26 -0
  90. package/src/lib/components/downloadRing/icons/download-cloud.tsx +18 -0
  91. package/src/lib/components/downloadRing/icons/style.module.scss +7 -0
  92. package/src/lib/components/downloadRing/index.stories.mdx +35 -0
  93. package/src/lib/components/downloadRing/index.tsx +79 -0
  94. package/src/lib/components/downloadRing/style.module.scss +66 -0
  95. package/src/lib/components/dropzone/images/error.tsx +18 -0
  96. package/src/lib/components/dropzone/images/file.tsx +26 -0
  97. package/src/lib/components/dropzone/images/style.module.scss +7 -0
  98. package/src/lib/components/dropzone/images/upload-complete.tsx +24 -0
  99. package/src/lib/components/dropzone/images/upload.tsx +18 -0
  100. package/src/lib/components/dropzone/index.stories.mdx +44 -0
  101. package/src/lib/components/dropzone/index.tsx +152 -0
  102. package/src/lib/components/dropzone/style.module.scss +90 -0
  103. package/src/lib/components/input/a.stories.mdx +28 -0
  104. package/src/lib/components/input/autoSuggestInput/index.stories.mdx +137 -0
  105. package/src/lib/components/input/autoSuggestInput/index.tsx +81 -0
  106. package/src/lib/components/input/autoSuggestInput/style.module.scss +71 -0
  107. package/src/lib/components/input/autoSuggestMultiSelect/index.stories.mdx +115 -0
  108. package/src/lib/components/input/autoSuggestMultiSelect/index.tsx +75 -0
  109. package/src/lib/components/input/autoSuggestMultiSelect/style.module.scss +4 -0
  110. package/src/lib/components/input/currency/format/index.test.ts +49 -0
  111. package/src/lib/components/input/currency/format/index.ts +15 -0
  112. package/src/lib/components/input/currency/index.stories.mdx +25 -0
  113. package/src/lib/components/input/currency/index.test.tsx +56 -0
  114. package/src/lib/components/input/currency/index.tsx +53 -0
  115. package/src/lib/components/input/iban/formatIban/index.test.ts +11 -0
  116. package/src/lib/components/input/iban/formatIban/index.ts +22 -0
  117. package/src/lib/components/input/iban/index.stories.mdx +21 -0
  118. package/src/lib/components/input/iban/index.tsx +20 -0
  119. package/src/lib/components/input/index.stories.mdx +62 -0
  120. package/src/lib/components/input/index.tsx +51 -0
  121. package/src/lib/components/input/style.module.scss +94 -0
  122. package/src/lib/components/modal/bottomModal/img/close.svg +4 -0
  123. package/src/lib/components/modal/bottomModal/index.tsx +68 -0
  124. package/src/lib/components/modal/bottomModal/style.module.scss +104 -0
  125. package/src/lib/components/modal/bottomOrRegularModal/index.tsx +43 -0
  126. package/src/lib/components/modal/bottomOrRegularModal/style.module.scss +16 -0
  127. package/src/lib/components/modal/hooks/useOnClose.ts +51 -0
  128. package/src/lib/components/modal/index.stories.mdx +316 -0
  129. package/src/lib/components/modal/index.ts +14 -0
  130. package/src/lib/components/modal/regularModal/img/close.svg +4 -0
  131. package/src/lib/components/modal/regularModal/index.tsx +55 -0
  132. package/src/lib/components/modal/regularModal/style.module.scss +106 -0
  133. package/src/lib/components/multiDropzone/UploadFileCell/index.tsx +138 -0
  134. package/src/lib/components/multiDropzone/UploadFileCell/style.module.scss +101 -0
  135. package/src/lib/components/multiDropzone/icons/bmp-complete.svg +10 -0
  136. package/src/lib/components/multiDropzone/icons/bmp.svg +10 -0
  137. package/src/lib/components/multiDropzone/icons/doc-complete.svg +11 -0
  138. package/src/lib/components/multiDropzone/icons/doc.svg +11 -0
  139. package/src/lib/components/multiDropzone/icons/docx-complete.svg +12 -0
  140. package/src/lib/components/multiDropzone/icons/docx.svg +12 -0
  141. package/src/lib/components/multiDropzone/icons/eye.svg +4 -0
  142. package/src/lib/components/multiDropzone/icons/generic-complete.svg +4 -0
  143. package/src/lib/components/multiDropzone/icons/generic-error.svg +7 -0
  144. package/src/lib/components/multiDropzone/icons/generic.svg +4 -0
  145. package/src/lib/components/multiDropzone/icons/heic-complete.svg +11 -0
  146. package/src/lib/components/multiDropzone/icons/heic.svg +11 -0
  147. package/src/lib/components/multiDropzone/icons/index.ts +51 -0
  148. package/src/lib/components/multiDropzone/icons/jpeg-complete.svg +11 -0
  149. package/src/lib/components/multiDropzone/icons/jpeg.svg +11 -0
  150. package/src/lib/components/multiDropzone/icons/jpg-complete.svg +10 -0
  151. package/src/lib/components/multiDropzone/icons/jpg.svg +10 -0
  152. package/src/lib/components/multiDropzone/icons/pdf-complete.svg +8 -0
  153. package/src/lib/components/multiDropzone/icons/pdf.svg +8 -0
  154. package/src/lib/components/multiDropzone/icons/png-complete.svg +10 -0
  155. package/src/lib/components/multiDropzone/icons/png.svg +10 -0
  156. package/src/lib/components/multiDropzone/icons/trash.svg +6 -0
  157. package/src/lib/components/multiDropzone/icons/upload.svg +5 -0
  158. package/src/lib/components/multiDropzone/index.stories.mdx +91 -0
  159. package/src/lib/components/multiDropzone/index.tsx +99 -0
  160. package/src/lib/components/multiDropzone/style.module.scss +32 -0
  161. package/src/lib/components/segmentedControl/index.stories.mdx +47 -0
  162. package/src/lib/components/segmentedControl/index.tsx +105 -0
  163. package/src/lib/components/segmentedControl/style.module.scss +36 -0
  164. package/src/lib/components/signaturePad/img/reset.svg +4 -0
  165. package/src/lib/components/signaturePad/img/sign.svg +3 -0
  166. package/src/lib/components/signaturePad/index.stories.mdx +17 -0
  167. package/src/lib/components/signaturePad/index.tsx +96 -0
  168. package/src/lib/components/signaturePad/style.module.scss +90 -0
  169. package/src/lib/index.tsx +71 -0
  170. package/src/lib/models/autoSuggestInput/index.ts +4 -0
  171. package/src/lib/models/download.ts +1 -0
  172. package/src/lib/models/downloadRing/index.ts +6 -0
  173. package/src/lib/scss/index.scss +22 -0
  174. package/src/lib/scss/private/_reset.scss +149 -0
  175. package/src/lib/scss/private/base/_colors.scss +19 -0
  176. package/src/lib/scss/private/base/_cursors.scss +31 -0
  177. package/src/lib/scss/private/base/_display.scss +35 -0
  178. package/src/lib/scss/private/base/_grid.scss +52 -0
  179. package/src/lib/scss/private/base/_index.scss +9 -0
  180. package/src/lib/scss/private/base/_shadows.scss +2 -0
  181. package/src/lib/scss/private/base/_spacing.scss +89 -0
  182. package/src/lib/scss/private/base/_typography.scss +128 -0
  183. package/src/lib/scss/private/base/_width_and_height.scss +25 -0
  184. package/src/lib/scss/private/base/cursors.stories.mdx +18 -0
  185. package/src/lib/scss/private/base/demo.tsx +119 -0
  186. package/src/lib/scss/private/base/display.stories.mdx +19 -0
  187. package/src/lib/scss/private/base/flex/_flex.scss +63 -0
  188. package/src/lib/scss/private/base/flex/flex.stories.mdx +139 -0
  189. package/src/lib/scss/private/base/flex/style.module.scss +24 -0
  190. package/src/lib/scss/private/base/spacing.stories.mdx +173 -0
  191. package/src/lib/scss/private/base/style.module.scss +42 -0
  192. package/src/lib/scss/private/base/typography.stories.mdx +71 -0
  193. package/src/lib/scss/private/base/width_and_height.stories.mdx +172 -0
  194. package/src/lib/scss/private/components/_badge.scss +41 -0
  195. package/src/lib/scss/private/components/_buttons.scss +193 -0
  196. package/src/lib/scss/private/components/_cards.scss +32 -0
  197. package/src/lib/scss/private/components/_index.scss +6 -0
  198. package/src/lib/scss/private/components/_input.scss +241 -0
  199. package/src/lib/scss/private/components/_notices.scss +39 -0
  200. package/src/lib/scss/private/components/_spinner.scss +60 -0
  201. package/src/lib/scss/private/components/assets/checkmark.svg +3 -0
  202. package/src/lib/scss/private/components/assets/icon-form-dropdown.svg +3 -0
  203. package/src/lib/scss/private/components/badge.stories.mdx +37 -0
  204. package/src/lib/scss/private/components/button.stories.mdx +107 -0
  205. package/src/lib/scss/private/components/cards.stories.mdx +35 -0
  206. package/src/lib/scss/private/components/checkbox.stories.mdx +47 -0
  207. package/src/lib/scss/private/components/input.stories.mdx +33 -0
  208. package/src/lib/scss/private/components/notices.stories.mdx +37 -0
  209. package/src/lib/scss/private/components/radio.stories.mdx +47 -0
  210. package/src/lib/scss/private/components/select.stories.mdx +17 -0
  211. package/src/lib/scss/private/components/spinner.stories.mdx +25 -0
  212. package/src/lib/scss/public/colors/_index.scss +2 -0
  213. package/src/lib/scss/public/colors/default.scss +125 -0
  214. package/src/lib/scss/public/colors/overrides.scss +0 -0
  215. package/src/lib/scss/public/colors.stories.mdx +27 -0
  216. package/src/lib/scss/public/demo.tsx +285 -0
  217. package/src/lib/scss/public/font/_index.scss +2 -0
  218. package/src/lib/scss/public/font/default.scss +3 -0
  219. package/src/lib/scss/public/font/overrides.scss +0 -0
  220. package/src/lib/scss/public/font-weight.scss +9 -0
  221. package/src/lib/scss/public/font-weight.stories.mdx +32 -0
  222. package/src/lib/scss/public/grid.scss +21 -0
  223. package/src/lib/scss/public/grid.stories.mdx +41 -0
  224. package/src/lib/scss/third-party/_google_places.scss +62 -0
  225. package/src/lib/scss/third-party/_index.scss +1 -0
  226. package/src/lib/scss/utils/_index.scss +3 -0
  227. package/src/lib/util/calendarDate/index.test.ts +32 -0
  228. package/src/lib/util/calendarDate/index.ts +30 -0
  229. package/src/lib/util/zeroFill.test.ts +15 -0
  230. package/src/lib/util/zeroFill.ts +7 -0
  231. package/src/react-app-env.d.ts +1 -0
  232. package/src/setupTests.js +8 -0
  233. package/src/theme.stories.mdx +54 -0
@@ -0,0 +1,105 @@
1
+ import { Meta, Preview } from '@storybook/addon-docs/blocks';
2
+
3
+ import CardWithTopIcon from '.';
4
+ import { featherLogo } from '../icons';
5
+
6
+ <Meta title="JSX/Cards/Card with top icon" />
7
+
8
+ # Card with top icon
9
+
10
+ | attribute | unit | description | default value | required |
11
+ | ---------- | ------------------------------------------------------------------------------------ | ------------------------------------------------ | ------------- | -------- |
12
+ | title | string | The title text that needs to be displayed | n/a | true |
13
+ | cardSize | [Card Size (s,m,b)](?path=/story/jsx-cards-intro--page#card-size-xsmall-small-medium-big) | Size of the card | medium | false |
14
+ | topIcon | [Icon](?path=/story/jsx-cards-intro--page#icon) | Icon displayed on the top of the card | n/a | true |
15
+ | rightIcon | [Icon](?path=/story/jsx-cards-intro--page#icon) | Icon displayed on the right of the title | n/a | false |
16
+ | state | [Card State](?path=/story/jsx-cards-intro--page#card-state) | State that describe the interation with the card | actionable | false |
17
+ | dropshadow | boolean | If the card should have a box-shadow or not | true | false |
18
+
19
+ <Preview>
20
+ <>
21
+ <h4 className="p-h4">Small card</h4>
22
+ <CardWithTopIcon
23
+ title="Lorem ipsum"
24
+ cardSize="small"
25
+ className="wmx6 mt8"
26
+ rightIcon="arrow"
27
+ topIcon={featherLogo}
28
+ >
29
+ <p className="p-p mt16 tc-grey-600">
30
+ Praesent euismod porta odio at tempus.{' '}
31
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
32
+ eros at, rhoncus imperdiet nunc
33
+ </p>
34
+ </CardWithTopIcon>
35
+ <h4 className="p-h4 mt24">Medium card</h4>
36
+ <CardWithTopIcon
37
+ title="Lorem ipsum"
38
+ cardSize="medium"
39
+ className="wmx6 mt8"
40
+ rightIcon="arrow"
41
+ topIcon={featherLogo}
42
+ >
43
+ <p className="p-p mt16 tc-grey-600">
44
+ Praesent euismod porta odio at tempus.{' '}
45
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
46
+ eros at, rhoncus imperdiet nunc
47
+ </p>
48
+ </CardWithTopIcon>
49
+ <h4 className="p-h4 mt24">Big card</h4>
50
+ <CardWithTopIcon
51
+ title="Lorem ipsum"
52
+ cardSize="big"
53
+ className="wmx6 mt8"
54
+ rightIcon="arrow"
55
+ topIcon={featherLogo}
56
+ >
57
+ <p className="p-p mt16 tc-grey-600">
58
+ Praesent euismod porta odio at tempus.{' '}
59
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
60
+ eros at, rhoncus imperdiet nunc
61
+ </p>
62
+ </CardWithTopIcon>
63
+ <h4 className="p-h4 mt24">Muted</h4>
64
+ <CardWithTopIcon
65
+ title="Lorem ipsum"
66
+ className="wmx6 mt8"
67
+ rightIcon="arrow"
68
+ topIcon={featherLogo}
69
+ state="muted"
70
+ >
71
+ <p className="p-p mt16 tc-grey-600">
72
+ Praesent euismod porta odio at tempus.{' '}
73
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
74
+ eros at, rhoncus imperdiet nunc
75
+ </p>
76
+ </CardWithTopIcon>
77
+ <h4 className="p-h4 mt24">No right icon</h4>
78
+ <CardWithTopIcon
79
+ title="Lorem ipsum"
80
+ topIcon={featherLogo}
81
+ cardSize="small"
82
+ className="wmx6 mt8"
83
+ >
84
+ <p className="p-p mt16 tc-grey-600">
85
+ Praesent euismod porta odio at tempus.{' '}
86
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
87
+ eros at, rhoncus imperdiet nunc
88
+ </p>
89
+ </CardWithTopIcon>
90
+ <h4 className="p-h4 mt24">No dropshadow</h4>
91
+ <CardWithTopIcon
92
+ title="Lorem ipsum"
93
+ topIcon={featherLogo}
94
+ cardSize="small"
95
+ className="wmx6 mt8"
96
+ dropshadow={false}
97
+ >
98
+ <p className="p-p mt16 tc-grey-600">
99
+ Praesent euismod porta odio at tempus.{' '}
100
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
101
+ eros at, rhoncus imperdiet nunc
102
+ </p>
103
+ </CardWithTopIcon>
104
+ </>
105
+ </Preview>
@@ -0,0 +1,60 @@
1
+ import {
2
+ associatedClassForCardState,
3
+ CardProps,
4
+ headingForCardSize,
5
+ } from '..';
6
+ import { Icon, arrowRight, IconSize } from '../icons';
7
+
8
+ import styles from './style.module.scss';
9
+
10
+ export default ({
11
+ className,
12
+ title,
13
+ cardSize = 'medium',
14
+ children,
15
+ topIcon,
16
+ topIconSize = { width: 48, height: 48 },
17
+ rightIcon,
18
+ state = 'actionable',
19
+ dropshadow = true,
20
+ ...props
21
+ }: CardProps & {
22
+ topIcon: Icon;
23
+ topIconSize: IconSize;
24
+ cardSize?: 'small' | 'medium' | 'big';
25
+ rightIcon?: 'arrow' | Icon;
26
+ }) => {
27
+ const cardStyle = `d-flex fd-column ai-center ${className} ${associatedClassForCardState(
28
+ state,
29
+ dropshadow
30
+ )} ${styles.container}`;
31
+
32
+ const headingStyle = headingForCardSize(cardSize);
33
+ const iconStyle = styles['right-icon'];
34
+
35
+ return (
36
+ <>
37
+ <div className={cardStyle} {...props}>
38
+ <img
39
+ width={topIconSize.width}
40
+ height={topIconSize.height}
41
+ alt={topIcon.alt}
42
+ src={topIcon.src}
43
+ />
44
+ <div className="d-flex mt16">
45
+ <div className={headingStyle}>{title}</div>
46
+ {rightIcon && (
47
+ <img
48
+ className={iconStyle}
49
+ width="24px"
50
+ height="24px"
51
+ src={rightIcon === 'arrow' ? arrowRight.src : rightIcon.src}
52
+ alt={rightIcon === 'arrow' ? arrowRight.alt : rightIcon.alt}
53
+ />
54
+ )}
55
+ </div>
56
+ {children}
57
+ </div>
58
+ </>
59
+ );
60
+ };
@@ -0,0 +1,10 @@
1
+ .container {
2
+ padding: 32px 24px 24px 24px;
3
+
4
+ display: flex;
5
+ flex-direction: column;
6
+ align-items: center;
7
+ }
8
+ .right-icon {
9
+ margin-left: 4px;
10
+ }
@@ -0,0 +1,101 @@
1
+ import { Meta, Preview } from '@storybook/addon-docs/blocks';
2
+
3
+ import CardWithTopLeftIcon from '.';
4
+ import { featherLogo } from '../icons';
5
+
6
+ <Meta title="JSX/Cards/Card with top left icon" />
7
+
8
+ # Card with top left icon
9
+
10
+ | attribute | unit | description | default value | required |
11
+ | ---------- | --------------------------------------------------------------------------------- | ------------------------------------------------ | ------------- | -------- |
12
+ | title | string | The title text that needs to be displayed | n/a | true |
13
+ | cardSize | [Card Size (xs,s,m,b)](?path=/story/jsx-cards-intro--page#card-size-xsmall-small-medium-big) | Size of the card | medium | false |
14
+ | topIcon | [Icon](?path=/story/jsx-cards-intro--page#icon) | Icon displayed on the left of the title | n/a | false |
15
+ | rightIcon | [Icon](?path=/story/jsx-cards-intro--page#icon) | Icon displayed on the right of the title | n/a | false |
16
+ | state | [Card State](?path=/story/jsx-cards-intro--page#card-state) | State that describe the interation with the card | actionable | false |
17
+ | dropshadow | boolean | If the card should have a box-shadow or not | true | false |
18
+
19
+ <Preview>
20
+ <>
21
+ <h4 className="p-h4">Extra small card</h4>
22
+ <CardWithTopLeftIcon
23
+ title="Lorem ipsum"
24
+ cardSize="xsmall"
25
+ className="wmx6 mt8"
26
+ rightIcon="arrow"
27
+ leftIcon={featherLogo}
28
+ >
29
+ Praesent euismod porta odio at tempus.{' '}
30
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
31
+ eros at, rhoncus imperdiet nunc
32
+ </CardWithTopLeftIcon>
33
+ <h4 className="p-h4 mt24">Small card</h4>
34
+ <CardWithTopLeftIcon
35
+ title="Lorem ipsum"
36
+ cardSize="small"
37
+ className="wmx6 mt8"
38
+ rightIcon="arrow"
39
+ leftIcon={featherLogo}
40
+ >
41
+ Praesent euismod porta odio at tempus.{' '}
42
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
43
+ eros at, rhoncus imperdiet nunc
44
+ </CardWithTopLeftIcon>
45
+ <h4 className="p-h4 mt24">Medium card</h4>
46
+ <CardWithTopLeftIcon
47
+ title="Lorem ipsum"
48
+ cardSize="medium"
49
+ className="wmx6 mt8"
50
+ rightIcon="arrow"
51
+ leftIcon={featherLogo}
52
+ >
53
+ Praesent euismod porta odio at tempus.{' '}
54
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
55
+ eros at, rhoncus imperdiet nunc
56
+ </CardWithTopLeftIcon>
57
+ <h4 className="p-h4 mt24">Big card</h4>
58
+ <CardWithTopLeftIcon
59
+ title="Lorem ipsum"
60
+ cardSize="big"
61
+ className="wmx6 mt8"
62
+ rightIcon="arrow"
63
+ leftIcon={featherLogo}
64
+ >
65
+ Praesent euismod porta odio at tempus.{' '}
66
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
67
+ eros at, rhoncus imperdiet nunc
68
+ </CardWithTopLeftIcon>
69
+ <h4 className="p-h4 mt24">Muted</h4>
70
+ <CardWithTopLeftIcon
71
+ title="Lorem ipsum"
72
+ state="muted"
73
+ className="wmx6 mt8"
74
+ rightIcon="arrow"
75
+ leftIcon={featherLogo}
76
+ >
77
+ Praesent euismod porta odio at tempus.{' '}
78
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
79
+ eros at, rhoncus imperdiet nunc
80
+ </CardWithTopLeftIcon>
81
+ <h4 className="p-h4 mt24">No right icon or left icon</h4>
82
+ <CardWithTopLeftIcon title="Lorem ipsum" className="wmx6 mt8">
83
+ Praesent euismod porta odio at tempus.{' '}
84
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
85
+ eros at, rhoncus imperdiet nunc
86
+ </CardWithTopLeftIcon>
87
+ <h4 className="p-h4">No dropshadow</h4>
88
+ <CardWithTopLeftIcon
89
+ title="Lorem ipsum"
90
+ cardSize="medium"
91
+ className="wmx6 mt8"
92
+ rightIcon="arrow"
93
+ leftIcon={featherLogo}
94
+ dropshadow={false}
95
+ >
96
+ Praesent euismod porta odio at tempus.{' '}
97
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
98
+ eros at, rhoncus imperdiet nunc
99
+ </CardWithTopLeftIcon>
100
+ </>
101
+ </Preview>
@@ -0,0 +1,72 @@
1
+ import {
2
+ associatedClassForCardState,
3
+ CardProps,
4
+ headingForCardSize,
5
+ } from '..';
6
+ import { Icon, arrowRight, featherLogo } from '../icons';
7
+
8
+ import styles from './style.module.scss';
9
+
10
+ const containerStyleFromTitleSize = (
11
+ titleSize: 'xsmall' | 'small' | 'medium' | 'big'
12
+ ): string => {
13
+ switch (titleSize) {
14
+ case 'xsmall':
15
+ return 'container--xsmall';
16
+ default:
17
+ return 'container';
18
+ }
19
+ };
20
+
21
+ export default ({
22
+ className,
23
+ title,
24
+ cardSize = 'medium',
25
+ children,
26
+ leftIcon,
27
+ rightIcon,
28
+ state = 'actionable',
29
+ dropshadow = true,
30
+ ...props
31
+ }: CardProps & {
32
+ cardSize?: 'xsmall' | 'small' | 'medium' | 'big';
33
+ leftIcon?: 'logo' | Icon;
34
+ rightIcon?: 'arrow' | Icon;
35
+ }) => {
36
+ const cardStyle = `${className} ${associatedClassForCardState(
37
+ state,
38
+ dropshadow
39
+ )} ${styles[containerStyleFromTitleSize(cardSize)]}`;
40
+
41
+ const titleContainerStyle = styles['title-container'];
42
+ const headingStyle = headingForCardSize(cardSize);
43
+ const iconStyle = styles['right-icon'];
44
+ const cardTextStyle = `p-p tc-grey-600 ${cardSize === 'xsmall' ? styles.indent : 'mt16'}`;
45
+
46
+ return (
47
+ <div className={cardStyle} {...props}>
48
+ <div className={titleContainerStyle}>
49
+ {leftIcon && (
50
+ <img
51
+ className="mr8"
52
+ width="28px"
53
+ height="28px"
54
+ src={leftIcon === 'logo' ? featherLogo.src : leftIcon.src}
55
+ alt={leftIcon === 'logo' ? featherLogo.alt : leftIcon.src}
56
+ />
57
+ )}
58
+ <div className={headingStyle}>{title}</div>
59
+ {rightIcon && (
60
+ <img
61
+ className={iconStyle}
62
+ width="24px"
63
+ height="24px"
64
+ src={rightIcon === 'arrow' ? arrowRight.src : rightIcon.src}
65
+ alt={rightIcon === 'arrow' ? arrowRight.alt : rightIcon.alt}
66
+ />
67
+ )}
68
+ </div>
69
+ <p className={cardTextStyle}>{children}</p>
70
+ </div>
71
+ );
72
+ };
@@ -0,0 +1,21 @@
1
+ .container {
2
+ padding: 24px;
3
+
4
+ &--xsmall {
5
+ padding: 16px 24px;
6
+ }
7
+ }
8
+
9
+ .title-container {
10
+ display: flex;
11
+
12
+ align-items: center;
13
+ }
14
+
15
+ .right-icon {
16
+ margin-left: auto;
17
+ }
18
+
19
+ .indent {
20
+ margin-left: 36px;
21
+ }
@@ -0,0 +1,4 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M5 12H19" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
3
+ <path d="M12 5L19 12L12 19" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
4
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M9 18L15 12L9 6" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
3
+ </svg>
@@ -0,0 +1,10 @@
1
+ <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="3" y="0" width="22" height="28">
3
+ <path d="M23.8761 0C14.4485 4.03927 5.77595 19.2529 3.53731 26.0756C3.04003 27.5912 2.60201 29.2504 4.03812 26.6043C4.89889 25.0183 7.02902 22.7858 11.8864 21.9848C15.7724 21.344 17.3995 20.5116 19.8916 17.6795C18.7427 18.0914 17.2587 18.9525 14.0909 17.9656C18.4837 18.3512 21.5108 15.748 22.6934 12.044C19.7931 13.3599 17.3385 12.4392 16.6956 12.1007C20.6519 12.2002 23.9887 9.68393 24.7913 5.49304C25.2591 3.05005 24.5097 0.800979 23.8761 0Z" fill="#6160A2"/>
4
+ </mask>
5
+ <g mask="url(#mask0)">
6
+ <path d="M21.1875 1.45451C12.8431 6.88225 5.56109 19.9077 3.53731 26.0756C3.04003 27.5912 2.60201 29.2504 4.03812 26.6043C4.89889 25.0183 7.02902 22.7858 11.8864 21.9848C15.1146 21.4525 16.784 20.7879 18.6853 18.9545C19.0219 18.63 19.1998 17.9565 18.7553 18.1015C18.24 18.2696 17.709 17.5612 18.205 17.3425C19.7521 16.6603 20.976 15.4887 21.8303 14.0102C22.2446 13.2932 20.7231 12.6796 19.8955 12.7075C18.8859 12.7415 19.6982 11.6399 20.6391 11.2723C21.8973 10.7807 23.0427 10.0842 23.7916 9.26859C24.7617 8.21223 24.48 7.11878 24.7913 5.49304C24.969 4.56516 24.971 3.66526 24.8706 2.86204C24.6464 1.06951 22.7019 0.469502 21.1875 1.45451Z" fill="#6160A2"/>
7
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M30.4837 5.72996C30.4837 14.8734 23.1695 22.4039 14.0022 22.4039C4.83493 22.4039 -2.47925 14.8734 -2.47925 5.72996C-2.47925 -3.4135 4.83493 -10.944 14.0022 -10.944C23.1695 -10.944 30.4837 -3.4135 30.4837 5.72996ZM14.0022 18.0289C20.6884 18.0289 26.1087 12.5225 26.1087 5.72996C26.1087 -1.06259 20.6884 -6.56903 14.0022 -6.56903C7.316 -6.56903 1.89575 -1.06259 1.89575 5.72996C1.89575 12.5225 7.316 18.0289 14.0022 18.0289Z" fill="#90DF9B"/>
8
+ <path d="M26.1087 5.72995C26.1087 12.5225 20.6884 18.0289 14.0022 18.0289C7.316 18.0289 1.89575 12.5225 1.89575 5.72995C1.89575 -1.06259 7.316 -6.56903 14.0022 -6.56903C20.6884 -6.56903 26.1087 -1.06259 26.1087 5.72995Z" fill="#8E8CEE"/>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,36 @@
1
+ import arrowRightImage from './arrow-right.svg';
2
+ import featherLogoImage from './feather-logo.svg';
3
+ import infoImage from './info.svg';
4
+ import chevronRightImage from './chevron-right.svg';
5
+
6
+ export interface Icon {
7
+ src: string;
8
+ alt: string;
9
+ }
10
+
11
+ export interface IconSize {
12
+ width: number;
13
+ height: number;
14
+ }
15
+
16
+ const arrowRight: Icon = {
17
+ src: arrowRightImage,
18
+ alt: 'arrow pointing right',
19
+ };
20
+
21
+ const featherLogo: Icon = {
22
+ src: featherLogoImage,
23
+ alt: 'feather logo',
24
+ };
25
+
26
+ const info: Icon = {
27
+ src: infoImage,
28
+ alt: 'circle with the letter i inside for information',
29
+ };
30
+
31
+ const chevronRight: Icon = {
32
+ src: chevronRightImage,
33
+ alt: 'chevron facing right',
34
+ };
35
+
36
+ export { arrowRight, featherLogo, info, chevronRight };
@@ -0,0 +1,12 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0)">
3
+ <path d="M10 18.3334C14.6024 18.3334 18.3334 14.6024 18.3334 10C18.3334 5.39765 14.6024 1.66669 10 1.66669C5.39765 1.66669 1.66669 5.39765 1.66669 10C1.66669 14.6024 5.39765 18.3334 10 18.3334Z" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
4
+ <path d="M10 13.3333V10" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
5
+ <circle cx="10" cy="6.66665" r="0.833333" fill="#8E8CEE"/>
6
+ </g>
7
+ <defs>
8
+ <clipPath id="clip0">
9
+ <rect width="20" height="20" fill="white"/>
10
+ </clipPath>
11
+ </defs>
12
+ </svg>
@@ -0,0 +1,37 @@
1
+ import { associatedClassForCardState } from '.';
2
+
3
+ describe('Associated class for card state', () => {
4
+ it('Should be an actionable class', () => {
5
+ expect(associatedClassForCardState('actionable', true)).toEqual(
6
+ 'ds-card--actionable'
7
+ );
8
+ });
9
+
10
+ it('Should be a muted class', () => {
11
+ expect(associatedClassForCardState('muted', true)).toEqual(
12
+ 'ds-card--muted'
13
+ );
14
+ });
15
+
16
+ it('Should be a static class', () => {
17
+ expect(associatedClassForCardState('static', true)).toEqual('ds-card');
18
+ });
19
+
20
+ it('Should be an actionable class without dropshadow', () => {
21
+ expect(associatedClassForCardState('actionable', false)).toEqual(
22
+ 'ds-card--actionable ds-card--no-dropshadow'
23
+ );
24
+ });
25
+
26
+ it('Should be a muted class without dropshadow', () => {
27
+ expect(associatedClassForCardState('muted', false)).toEqual(
28
+ 'ds-card--muted ds-card--no-dropshadow'
29
+ );
30
+ });
31
+
32
+ it('Should be a static class without dropshadow', () => {
33
+ expect(associatedClassForCardState('static', false)).toEqual(
34
+ 'ds-card ds-card--no-dropshadow'
35
+ );
36
+ });
37
+ });
@@ -0,0 +1,57 @@
1
+ import CardWithTopLeftIcon from './cardWithTopLeftIcon';
2
+ import CardWithLeftIcon from './cardWithLeftIcon';
3
+ import CardWithTopIcon from './cardWithTopIcon';
4
+ import InfoCard from './infoCard';
5
+ import CardButton from './cardButton';
6
+
7
+ type CardState = 'actionable' | 'static' | 'muted';
8
+
9
+ export type CardProps = {
10
+ title: string;
11
+ children: React.ReactNode;
12
+ state?: CardState;
13
+ dropshadow?: boolean;
14
+ } & JSX.IntrinsicElements['div'];
15
+
16
+ export const headingForCardSize = (
17
+ cardSize: 'xsmall' | 'small' | 'medium' | 'big'
18
+ ): string => {
19
+ switch (cardSize) {
20
+ case 'xsmall':
21
+ case 'small':
22
+ return 'p-h4';
23
+ case 'medium':
24
+ return 'p-h3';
25
+ case 'big':
26
+ return 'p-h2';
27
+ }
28
+ };
29
+
30
+ export const associatedClassForCardState = (
31
+ state: CardState,
32
+ dropshadow: boolean
33
+ ): string => {
34
+ const baseClass = (() => {
35
+ switch (state) {
36
+ case 'actionable':
37
+ return 'ds-card--actionable';
38
+ case 'muted':
39
+ return 'ds-card--muted';
40
+ case 'static':
41
+ return 'ds-card';
42
+ }
43
+ })();
44
+
45
+ if (dropshadow === false) {
46
+ return `${baseClass} ds-card--no-dropshadow`;
47
+ }
48
+ return baseClass;
49
+ };
50
+
51
+ export {
52
+ CardWithTopLeftIcon,
53
+ CardWithLeftIcon,
54
+ CardWithTopIcon,
55
+ InfoCard,
56
+ CardButton,
57
+ };
@@ -0,0 +1,61 @@
1
+ import { Meta, Preview } from '@storybook/addon-docs/blocks';
2
+
3
+ import InfoCard from '.';
4
+ import { featherLogo } from '../icons';
5
+
6
+ <Meta title="JSX/Cards/Info card" />
7
+
8
+ # Info card
9
+
10
+ | attribute | unit | description | default value | required |
11
+ | ---------- | ----------------------------------------------------------- | --------------------------------------------------------------- | ------------- | -------- |
12
+ | title | string | The title text that needs to be displayed | n/a | true |
13
+ | topIcon | [Icon](?path=/story/jsx-cards-intro--page#icon) | Icon displayed on the top of the card, inside the purple circle | n/a | true |
14
+ | rightIcon | [Icon](?path=/story/jsx-cards-intro--page#icon) | Icon displayed on the top right corner of the card | n/a | false |
15
+ | state | [Card State](?path=/story/jsx-cards-intro--page#card-state) | State that describe the interation with the card | actionable | false |
16
+ | dropshadow | boolean | If the card should have a box-shadow or not | true | false |
17
+
18
+ <Preview>
19
+ <>
20
+ <h4 className="p-h4">With right icon</h4>
21
+ <InfoCard
22
+ className="wmx6 mt8"
23
+ title="Lorem ipsum"
24
+ rightIcon="info"
25
+ topIcon={featherLogo}
26
+ >
27
+ Praesent euismod porta odio at tempus.{' '}
28
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
29
+ eros at, rhoncus imperdiet nunc
30
+ </InfoCard>
31
+ <h4 className="p-h4 mt24">Without right icon</h4>
32
+ <InfoCard className="wmx6 mt8" title="Lorem ipsum" topIcon={featherLogo}>
33
+ Praesent euismod porta odio at tempus.{' '}
34
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
35
+ eros at, rhoncus imperdiet nunc
36
+ </InfoCard>
37
+ <h4 className="p-h4 mt24">Muted</h4>
38
+ <InfoCard
39
+ className="wmx6 mt8"
40
+ title="Lorem ipsum"
41
+ topIcon={featherLogo}
42
+ state="muted"
43
+ >
44
+ Praesent euismod porta odio at tempus.{' '}
45
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
46
+ eros at, rhoncus imperdiet nunc
47
+ </InfoCard>
48
+ <h4 className="p-h4">No dropshadow</h4>
49
+ <InfoCard
50
+ className="wmx6 mt8"
51
+ title="Lorem ipsum"
52
+ rightIcon="info"
53
+ topIcon={featherLogo}
54
+ dropshadow={false}
55
+ >
56
+ Praesent euismod porta odio at tempus.{' '}
57
+ <span className="fw-bold">Aenean urna massa</span>, facilisis malesuada
58
+ eros at, rhoncus imperdiet nunc
59
+ </InfoCard>
60
+ </>
61
+ </Preview>
@@ -0,0 +1,47 @@
1
+ import { associatedClassForCardState, CardProps } from '..';
2
+ import { Icon, info } from '../icons';
3
+
4
+ import styles from './style.module.scss';
5
+
6
+ export default ({
7
+ className,
8
+ title,
9
+ children,
10
+ topIcon,
11
+ rightIcon,
12
+ state = 'actionable',
13
+ dropshadow = true,
14
+ ...props
15
+ }: CardProps & {
16
+ topIcon: Icon;
17
+ rightIcon?: 'info' | Icon;
18
+ }) => (
19
+ <div className={`${styles['root-container']} ${className ?? ''}`} {...props}>
20
+ <img
21
+ src={topIcon.src}
22
+ alt={topIcon.alt}
23
+ className={`${styles['top-icon']} ${
24
+ state === 'muted' ? styles['top-icon--muted'] : ''
25
+ } `}
26
+ width="80px"
27
+ height="80px"
28
+ />
29
+ <div
30
+ className={`${associatedClassForCardState(state, dropshadow)} ${
31
+ styles.container
32
+ }`}
33
+ >
34
+ {rightIcon && (
35
+ <img
36
+ width="20px"
37
+ height="20px"
38
+ className={styles['right-icon']}
39
+ src={rightIcon === 'info' ? info.src : rightIcon.src}
40
+ alt={rightIcon === 'info' ? info.alt : rightIcon.alt}
41
+ />
42
+ )}
43
+ <div className="p-h4 ta-center mt64">{title}</div>
44
+ <p className="p-p mt16 tc-grey-600">{children}</p>
45
+ </div>
46
+ </div>
47
+ );