@popsure/dirty-swan 0.26.10 → 0.26.13

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 (240) hide show
  1. package/dist/index.css +62 -0
  2. package/dist/index.css.map +1 -1
  3. package/dist/lib/scss/private/base/_border_radius.scss +15 -0
  4. package/dist/lib/scss/private/base/_grid.scss +8 -0
  5. package/dist/lib/scss/private/base/_index.scss +1 -0
  6. package/dist/lib/scss/private/base/style.module.scss +10 -0
  7. package/dist/lib/scss/public/colors/default.scss +5 -0
  8. package/dist/lib/scss/public/demo.tsx +13 -1
  9. package/package.json +2 -1
  10. package/src/App.tsx +50 -0
  11. package/src/bin/index.ts +71 -0
  12. package/src/bin/tsconfig.json +13 -0
  13. package/src/bin/util/index.test.ts +85 -0
  14. package/src/bin/util/index.ts +132 -0
  15. package/src/bin/util/test/data.json +13 -0
  16. package/src/colors.scss +1 -0
  17. package/src/font-weight.scss +1 -0
  18. package/src/grid.scss +1 -0
  19. package/src/index.tsx +37 -0
  20. package/src/intro.stories.mdx +41 -0
  21. package/src/lib/components/autocompleteAddress/demo.tsx +38 -0
  22. package/src/lib/components/autocompleteAddress/index.stories.mdx +44 -0
  23. package/src/lib/components/autocompleteAddress/index.tsx +316 -0
  24. package/src/lib/components/autocompleteAddress/mapStyle.ts +187 -0
  25. package/src/lib/components/autocompleteAddress/style.module.scss +82 -0
  26. package/src/lib/components/autocompleteAddress/util/index.test.ts +51 -0
  27. package/src/lib/components/autocompleteAddress/util/index.ts +55 -0
  28. package/src/lib/components/button/icons/index.ts +14 -0
  29. package/src/lib/components/button/icons/send-purple.svg +4 -0
  30. package/src/lib/components/button/icons/send-white.svg +4 -0
  31. package/src/lib/components/button/index.stories.mdx +121 -0
  32. package/src/lib/components/button/index.tsx +64 -0
  33. package/src/lib/components/button/styles.module.scss +5 -0
  34. package/src/lib/components/cards/a.stories.mdx +44 -0
  35. package/src/lib/components/cards/cardButton/index.stories.mdx +47 -0
  36. package/src/lib/components/cards/cardButton/index.tsx +61 -0
  37. package/src/lib/components/cards/cardButton/style.module.scss +33 -0
  38. package/src/lib/components/cards/cardWithLeftIcon/index.stories.mdx +103 -0
  39. package/src/lib/components/cards/cardWithLeftIcon/index.tsx +87 -0
  40. package/src/lib/components/cards/cardWithLeftIcon/style.module.scss +23 -0
  41. package/src/lib/components/cards/cardWithTopIcon/index.stories.mdx +105 -0
  42. package/src/lib/components/cards/cardWithTopIcon/index.tsx +60 -0
  43. package/src/lib/components/cards/cardWithTopIcon/style.module.scss +10 -0
  44. package/src/lib/components/cards/cardWithTopLeftIcon/index.stories.mdx +101 -0
  45. package/src/lib/components/cards/cardWithTopLeftIcon/index.tsx +72 -0
  46. package/src/lib/components/cards/cardWithTopLeftIcon/style.module.scss +21 -0
  47. package/src/lib/components/cards/icons/arrow-right.svg +4 -0
  48. package/src/lib/components/cards/icons/chevron-right.svg +3 -0
  49. package/src/lib/components/cards/icons/feather-logo.svg +10 -0
  50. package/src/lib/components/cards/icons/index.ts +36 -0
  51. package/src/lib/components/cards/icons/info.svg +12 -0
  52. package/src/lib/components/cards/index.test.ts +37 -0
  53. package/src/lib/components/cards/index.tsx +57 -0
  54. package/src/lib/components/cards/infoCard/index.stories.mdx +61 -0
  55. package/src/lib/components/cards/infoCard/index.tsx +47 -0
  56. package/src/lib/components/cards/infoCard/style.module.scss +53 -0
  57. package/src/lib/components/chip/icons/remove-button-highlighted.svg +4 -0
  58. package/src/lib/components/chip/icons/remove-button.svg +4 -0
  59. package/src/lib/components/chip/index.stories.mdx +101 -0
  60. package/src/lib/components/chip/index.tsx +38 -0
  61. package/src/lib/components/chip/style.module.scss +54 -0
  62. package/src/lib/components/comparisonTable/components/Chevron.tsx +19 -0
  63. package/src/lib/components/comparisonTable/components/Row/index.tsx +68 -0
  64. package/src/lib/components/comparisonTable/components/Row/style.module.scss +114 -0
  65. package/src/lib/components/comparisonTable/components/TableArrows/Arrow.tsx +19 -0
  66. package/src/lib/components/comparisonTable/components/TableArrows/index.tsx +52 -0
  67. package/src/lib/components/comparisonTable/components/TableArrows/style.module.scss +53 -0
  68. package/src/lib/components/comparisonTable/components/TableInfoButton/index.tsx +37 -0
  69. package/src/lib/components/comparisonTable/components/TableInfoButton/style.module.scss +30 -0
  70. package/src/lib/components/comparisonTable/components/TableRating/StarIcon.tsx +13 -0
  71. package/src/lib/components/comparisonTable/components/TableRating/ZapIcon.tsx +17 -0
  72. package/src/lib/components/comparisonTable/components/TableRating/index.tsx +45 -0
  73. package/src/lib/components/comparisonTable/components/TableRating/style.module.scss +13 -0
  74. package/src/lib/components/comparisonTable/components/TableRowHeader/index.tsx +35 -0
  75. package/src/lib/components/comparisonTable/components/TableRowHeader/style.module.scss +3 -0
  76. package/src/lib/components/comparisonTable/components/TableTrueFalse.tsx +40 -0
  77. package/src/lib/components/comparisonTable/hooks/useActiveTableArrows.ts +63 -0
  78. package/src/lib/components/comparisonTable/index.stories.mdx +254 -0
  79. package/src/lib/components/comparisonTable/index.tsx +211 -0
  80. package/src/lib/components/comparisonTable/style.module.scss +104 -0
  81. package/src/lib/components/dateSelector/datepicker.scss +406 -0
  82. package/src/lib/components/dateSelector/icons/calendar.svg +6 -0
  83. package/src/lib/components/dateSelector/icons/chevron-left.svg +3 -0
  84. package/src/lib/components/dateSelector/icons/chevron-right.svg +3 -0
  85. package/src/lib/components/dateSelector/index.stories.mdx +62 -0
  86. package/src/lib/components/dateSelector/index.test.ts +33 -0
  87. package/src/lib/components/dateSelector/index.tsx +247 -0
  88. package/src/lib/components/dateSelector/style.module.scss +77 -0
  89. package/src/lib/components/downloadButton/icons/check.svg +3 -0
  90. package/src/lib/components/downloadButton/icons/download.svg +5 -0
  91. package/src/lib/components/downloadButton/index.stories.mdx +59 -0
  92. package/src/lib/components/downloadButton/index.tsx +67 -0
  93. package/src/lib/components/downloadButton/style.module.scss +19 -0
  94. package/src/lib/components/downloadRing/icons/check-outside-circle.tsx +26 -0
  95. package/src/lib/components/downloadRing/icons/download-cloud.tsx +18 -0
  96. package/src/lib/components/downloadRing/icons/style.module.scss +7 -0
  97. package/src/lib/components/downloadRing/index.stories.mdx +35 -0
  98. package/src/lib/components/downloadRing/index.tsx +79 -0
  99. package/src/lib/components/downloadRing/style.module.scss +66 -0
  100. package/src/lib/components/dropzone/images/error.tsx +18 -0
  101. package/src/lib/components/dropzone/images/file.tsx +26 -0
  102. package/src/lib/components/dropzone/images/style.module.scss +7 -0
  103. package/src/lib/components/dropzone/images/upload-complete.tsx +24 -0
  104. package/src/lib/components/dropzone/images/upload.tsx +18 -0
  105. package/src/lib/components/dropzone/index.stories.mdx +44 -0
  106. package/src/lib/components/dropzone/index.tsx +152 -0
  107. package/src/lib/components/dropzone/style.module.scss +90 -0
  108. package/src/lib/components/input/a.stories.mdx +28 -0
  109. package/src/lib/components/input/autoSuggestInput/index.stories.mdx +137 -0
  110. package/src/lib/components/input/autoSuggestInput/index.tsx +81 -0
  111. package/src/lib/components/input/autoSuggestInput/style.module.scss +71 -0
  112. package/src/lib/components/input/autoSuggestMultiSelect/index.stories.mdx +115 -0
  113. package/src/lib/components/input/autoSuggestMultiSelect/index.tsx +75 -0
  114. package/src/lib/components/input/autoSuggestMultiSelect/style.module.scss +4 -0
  115. package/src/lib/components/input/currency/format/index.test.ts +49 -0
  116. package/src/lib/components/input/currency/format/index.ts +15 -0
  117. package/src/lib/components/input/currency/index.stories.mdx +25 -0
  118. package/src/lib/components/input/currency/index.test.tsx +56 -0
  119. package/src/lib/components/input/currency/index.tsx +53 -0
  120. package/src/lib/components/input/iban/formatIban/index.test.ts +11 -0
  121. package/src/lib/components/input/iban/formatIban/index.ts +22 -0
  122. package/src/lib/components/input/iban/index.stories.mdx +21 -0
  123. package/src/lib/components/input/iban/index.tsx +20 -0
  124. package/src/lib/components/input/index.stories.mdx +62 -0
  125. package/src/lib/components/input/index.tsx +51 -0
  126. package/src/lib/components/input/style.module.scss +94 -0
  127. package/src/lib/components/modal/bottomModal/img/close.svg +4 -0
  128. package/src/lib/components/modal/bottomModal/index.tsx +68 -0
  129. package/src/lib/components/modal/bottomModal/style.module.scss +104 -0
  130. package/src/lib/components/modal/bottomOrRegularModal/index.tsx +43 -0
  131. package/src/lib/components/modal/bottomOrRegularModal/style.module.scss +16 -0
  132. package/src/lib/components/modal/hooks/useOnClose.ts +51 -0
  133. package/src/lib/components/modal/index.stories.mdx +316 -0
  134. package/src/lib/components/modal/index.ts +14 -0
  135. package/src/lib/components/modal/regularModal/img/close.svg +4 -0
  136. package/src/lib/components/modal/regularModal/index.tsx +55 -0
  137. package/src/lib/components/modal/regularModal/style.module.scss +106 -0
  138. package/src/lib/components/multiDropzone/UploadFileCell/index.tsx +138 -0
  139. package/src/lib/components/multiDropzone/UploadFileCell/style.module.scss +101 -0
  140. package/src/lib/components/multiDropzone/icons/bmp-complete.svg +10 -0
  141. package/src/lib/components/multiDropzone/icons/bmp.svg +10 -0
  142. package/src/lib/components/multiDropzone/icons/doc-complete.svg +11 -0
  143. package/src/lib/components/multiDropzone/icons/doc.svg +11 -0
  144. package/src/lib/components/multiDropzone/icons/docx-complete.svg +12 -0
  145. package/src/lib/components/multiDropzone/icons/docx.svg +12 -0
  146. package/src/lib/components/multiDropzone/icons/eye.svg +4 -0
  147. package/src/lib/components/multiDropzone/icons/generic-complete.svg +4 -0
  148. package/src/lib/components/multiDropzone/icons/generic-error.svg +7 -0
  149. package/src/lib/components/multiDropzone/icons/generic.svg +4 -0
  150. package/src/lib/components/multiDropzone/icons/heic-complete.svg +11 -0
  151. package/src/lib/components/multiDropzone/icons/heic.svg +11 -0
  152. package/src/lib/components/multiDropzone/icons/index.ts +51 -0
  153. package/src/lib/components/multiDropzone/icons/jpeg-complete.svg +11 -0
  154. package/src/lib/components/multiDropzone/icons/jpeg.svg +11 -0
  155. package/src/lib/components/multiDropzone/icons/jpg-complete.svg +10 -0
  156. package/src/lib/components/multiDropzone/icons/jpg.svg +10 -0
  157. package/src/lib/components/multiDropzone/icons/pdf-complete.svg +8 -0
  158. package/src/lib/components/multiDropzone/icons/pdf.svg +8 -0
  159. package/src/lib/components/multiDropzone/icons/png-complete.svg +10 -0
  160. package/src/lib/components/multiDropzone/icons/png.svg +10 -0
  161. package/src/lib/components/multiDropzone/icons/trash.svg +6 -0
  162. package/src/lib/components/multiDropzone/icons/upload.svg +5 -0
  163. package/src/lib/components/multiDropzone/index.stories.mdx +91 -0
  164. package/src/lib/components/multiDropzone/index.tsx +99 -0
  165. package/src/lib/components/multiDropzone/style.module.scss +32 -0
  166. package/src/lib/components/segmentedControl/index.stories.mdx +47 -0
  167. package/src/lib/components/segmentedControl/index.tsx +105 -0
  168. package/src/lib/components/segmentedControl/style.module.scss +36 -0
  169. package/src/lib/components/signaturePad/img/reset.svg +4 -0
  170. package/src/lib/components/signaturePad/img/sign.svg +3 -0
  171. package/src/lib/components/signaturePad/index.stories.mdx +17 -0
  172. package/src/lib/components/signaturePad/index.tsx +96 -0
  173. package/src/lib/components/signaturePad/style.module.scss +90 -0
  174. package/src/lib/index.tsx +71 -0
  175. package/src/lib/models/autoSuggestInput/index.ts +4 -0
  176. package/src/lib/models/download.ts +1 -0
  177. package/src/lib/models/downloadRing/index.ts +6 -0
  178. package/src/lib/scss/index.scss +22 -0
  179. package/src/lib/scss/private/_reset.scss +149 -0
  180. package/src/lib/scss/private/base/_border_radius.scss +15 -0
  181. package/src/lib/scss/private/base/_colors.scss +19 -0
  182. package/src/lib/scss/private/base/_cursors.scss +31 -0
  183. package/src/lib/scss/private/base/_display.scss +35 -0
  184. package/src/lib/scss/private/base/_grid.scss +60 -0
  185. package/src/lib/scss/private/base/_index.scss +10 -0
  186. package/src/lib/scss/private/base/_shadows.scss +2 -0
  187. package/src/lib/scss/private/base/_spacing.scss +89 -0
  188. package/src/lib/scss/private/base/_typography.scss +128 -0
  189. package/src/lib/scss/private/base/_width_and_height.scss +25 -0
  190. package/src/lib/scss/private/base/border_radius.stories.mdx +43 -0
  191. package/src/lib/scss/private/base/cursors.stories.mdx +18 -0
  192. package/src/lib/scss/private/base/demo.tsx +119 -0
  193. package/src/lib/scss/private/base/display.stories.mdx +19 -0
  194. package/src/lib/scss/private/base/flex/_flex.scss +63 -0
  195. package/src/lib/scss/private/base/flex/flex.stories.mdx +139 -0
  196. package/src/lib/scss/private/base/flex/style.module.scss +24 -0
  197. package/src/lib/scss/private/base/spacing.stories.mdx +185 -0
  198. package/src/lib/scss/private/base/style.module.scss +52 -0
  199. package/src/lib/scss/private/base/typography.stories.mdx +71 -0
  200. package/src/lib/scss/private/base/width_and_height.stories.mdx +172 -0
  201. package/src/lib/scss/private/components/_badge.scss +41 -0
  202. package/src/lib/scss/private/components/_buttons.scss +193 -0
  203. package/src/lib/scss/private/components/_cards.scss +32 -0
  204. package/src/lib/scss/private/components/_index.scss +6 -0
  205. package/src/lib/scss/private/components/_input.scss +241 -0
  206. package/src/lib/scss/private/components/_notices.scss +39 -0
  207. package/src/lib/scss/private/components/_spinner.scss +60 -0
  208. package/src/lib/scss/private/components/assets/checkmark.svg +3 -0
  209. package/src/lib/scss/private/components/assets/icon-form-dropdown.svg +3 -0
  210. package/src/lib/scss/private/components/badge.stories.mdx +37 -0
  211. package/src/lib/scss/private/components/button.stories.mdx +107 -0
  212. package/src/lib/scss/private/components/cards.stories.mdx +35 -0
  213. package/src/lib/scss/private/components/checkbox.stories.mdx +47 -0
  214. package/src/lib/scss/private/components/input.stories.mdx +33 -0
  215. package/src/lib/scss/private/components/notices.stories.mdx +37 -0
  216. package/src/lib/scss/private/components/radio.stories.mdx +47 -0
  217. package/src/lib/scss/private/components/select.stories.mdx +17 -0
  218. package/src/lib/scss/private/components/spinner.stories.mdx +25 -0
  219. package/src/lib/scss/public/colors/_index.scss +2 -0
  220. package/src/lib/scss/public/colors/default.scss +130 -0
  221. package/src/lib/scss/public/colors/overrides.scss +0 -0
  222. package/src/lib/scss/public/colors.stories.mdx +27 -0
  223. package/src/lib/scss/public/demo.tsx +297 -0
  224. package/src/lib/scss/public/font/_index.scss +2 -0
  225. package/src/lib/scss/public/font/default.scss +3 -0
  226. package/src/lib/scss/public/font/overrides.scss +0 -0
  227. package/src/lib/scss/public/font-weight.scss +9 -0
  228. package/src/lib/scss/public/font-weight.stories.mdx +32 -0
  229. package/src/lib/scss/public/grid.scss +21 -0
  230. package/src/lib/scss/public/grid.stories.mdx +41 -0
  231. package/src/lib/scss/third-party/_google_places.scss +62 -0
  232. package/src/lib/scss/third-party/_index.scss +1 -0
  233. package/src/lib/scss/utils/_index.scss +3 -0
  234. package/src/lib/util/calendarDate/index.test.ts +32 -0
  235. package/src/lib/util/calendarDate/index.ts +30 -0
  236. package/src/lib/util/zeroFill.test.ts +15 -0
  237. package/src/lib/util/zeroFill.ts +7 -0
  238. package/src/react-app-env.d.ts +1 -0
  239. package/src/setupTests.js +8 -0
  240. package/src/theme.stories.mdx +54 -0
@@ -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
+ );
@@ -0,0 +1,53 @@
1
+ @use "../../../scss/public/grid" as *;
2
+
3
+ @keyframes appear-in {
4
+ from {
5
+ opacity: 0;
6
+ }
7
+
8
+ to {
9
+ opacity: 1;
10
+ }
11
+ }
12
+
13
+ .root-container {
14
+ position: relative;
15
+ padding-top: 40px;
16
+
17
+ &:hover {
18
+ .right-icon {
19
+ visibility: visible;
20
+
21
+ animation-name: appear-in;
22
+ animation-duration: 0.3s;
23
+ animation-fill-mode: both;
24
+ }
25
+ }
26
+ }
27
+
28
+ .top-icon {
29
+ position: absolute;
30
+
31
+ left: 50%;
32
+ transform: translateX(-50%) translateY(-40px);
33
+
34
+ &--muted {
35
+ opacity: 0.25;
36
+ }
37
+ }
38
+
39
+ .right-icon {
40
+ visibility: hidden;
41
+ position: absolute;
42
+ top: 64px;
43
+ right: 24px;
44
+ }
45
+
46
+ .container {
47
+ padding: 0 24px 24px 24px;
48
+ height: 100%;
49
+
50
+ @include p-size-mobile {
51
+ height: fit-content;
52
+ }
53
+ }
@@ -0,0 +1,4 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M12 4L4 12" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
3
+ <path d="M4 4L12 12" stroke="#8E8CEE" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M12.4167 4L4.41666 12" stroke="#B1B0F5" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
3
+ <path d="M4.41666 4L12.4167 12" stroke="#B1B0F5" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
4
+ </svg>
@@ -0,0 +1,101 @@
1
+ import { useState } from 'react';
2
+ import { Meta, Preview } from '@storybook/addon-docs/blocks';
3
+
4
+ import Chip from '.';
5
+ import featherLogo from '../cards/icons/feather-logo.svg';
6
+
7
+ <Meta title="JSX/Chip" />
8
+
9
+ # Chip
10
+
11
+ Chip component displays text and image (optional) of given values.
12
+
13
+ The X button in the right calls the prop `onRemove` function to keep track of removed selected values.
14
+
15
+ <Preview>
16
+ <iframe
17
+ width="100%"
18
+ height="450"
19
+ src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FMKs4cbojdVOBKUxv7okb93%2FDirty-Swan-Design-System%3Fnode-id%3D245%253A42"
20
+ allowFullScreen
21
+ ></iframe>
22
+ </Preview>
23
+
24
+ ## Example
25
+
26
+ export const ChipStory = () => {
27
+ const values = [
28
+ { value: 'feather', leftIcon: featherLogo },
29
+ { value: 'feather2', leftIcon: featherLogo },
30
+ {
31
+ value: 'feather3',
32
+ leftIcon: featherLogo,
33
+ },
34
+ {
35
+ value: 'dirtyswan',
36
+ leftIcon: featherLogo,
37
+ },
38
+ {
39
+ value: 'test value',
40
+ leftIcon: featherLogo,
41
+ },
42
+ ];
43
+ const [selectedValues, setSelectedValues] = useState(values);
44
+ return (
45
+ <div style={{ display: 'flex', flexWrap: 'wrap' }}>
46
+ {selectedValues.map((value) => (
47
+ <Chip
48
+ value={value}
49
+ onRemove={(value) => {
50
+ const newValues = [...selectedValues].filter(
51
+ (selectedValue) => selectedValue.value !== value.value
52
+ );
53
+ setSelectedValues(newValues);
54
+ }}
55
+ />
56
+ ))}
57
+ </div>
58
+ );
59
+ };
60
+
61
+ <ChipStory />
62
+
63
+ ```typescript
64
+ import React, { useState } from 'react';
65
+ import { Chip } from '@popsure/dirty-swan';
66
+
67
+ export default () => {
68
+ const values = [
69
+ { value: 'feather', leftIcon: featherLogo },
70
+ { value: 'feather2', leftIcon: featherLogo },
71
+ {
72
+ value: 'feather3',
73
+ leftIcon: featherLogo,
74
+ },
75
+ {
76
+ value: 'dirtyswan',
77
+ leftIcon: featherLogo,
78
+ },
79
+ {
80
+ value: 'test value',
81
+ leftIcon: featherLogo,
82
+ },
83
+ ];
84
+ const [selectedValues, setSelectedValues] = useState(values);
85
+ return (
86
+ <div style={{ display: 'flex', flexWrap: 'wrap' }}>
87
+ {selectedValues.map((value) => (
88
+ <Chip
89
+ value={value}
90
+ onRemove={(value) => {
91
+ const newValues = [...selectedValues].filter(
92
+ (selectedValue) => selectedValue.value !== value.value
93
+ );
94
+ setSelectedValues(newValues);
95
+ }}
96
+ />
97
+ ))}
98
+ </div>
99
+ );
100
+ };
101
+ ```
@@ -0,0 +1,38 @@
1
+ import styles from './style.module.scss';
2
+ import removeButtonIcon from './icons/remove-button.svg';
3
+ import removeButtonHighlightedIcon from './icons/remove-button-highlighted.svg';
4
+ import { Option } from '../../models/autoSuggestInput';
5
+
6
+ export default ({
7
+ value,
8
+ onRemove,
9
+ }: {
10
+ value: Option;
11
+ onRemove: (value: Option) => void;
12
+ }) => (
13
+ <div className={`p-p mr8 mb8 d-flex ${styles['chip']}`}>
14
+ {value.leftIcon && (
15
+ <img
16
+ className={`mr8 ${styles['chip-image']}`}
17
+ src={value.leftIcon}
18
+ alt={value.value}
19
+ />
20
+ )}
21
+ <div className="mr8">{value.value}</div>
22
+ <div
23
+ className={`c-pointer ${styles['chip-button-container']}`}
24
+ onClick={() => onRemove(value)}
25
+ >
26
+ <img
27
+ className={styles['chip-remove-button-highlighted']}
28
+ src={removeButtonHighlightedIcon}
29
+ alt="removal x button highlighted"
30
+ />
31
+ <img
32
+ className={styles['chip-remove-button']}
33
+ src={removeButtonIcon}
34
+ alt="removal x button"
35
+ />
36
+ </div>
37
+ </div>
38
+ );
@@ -0,0 +1,54 @@
1
+ .chip {
2
+ background: var(--ds-primary-100);
3
+
4
+ border: 2px solid var(--ds-primary-100);
5
+ border-radius: 8px;
6
+
7
+ padding: 4px 8px;
8
+ width: fit-content;
9
+ width: -moz-fit-content;
10
+
11
+ display: flex;
12
+ align-items: center;
13
+
14
+ animation-name: appearInAnimation;
15
+ animation-duration: 0.5s;
16
+ animation-fill-mode: both;
17
+ }
18
+
19
+ .chip:hover {
20
+ transition: 0.2s ease-in;
21
+ border: 2px solid var(--ds-primary-500);
22
+ }
23
+
24
+ .chip-image {
25
+ width: 24px;
26
+ height: 14px;
27
+ }
28
+
29
+ .chip-button-container {
30
+ width: 16px;
31
+ height: 16px;
32
+
33
+ position: relative;
34
+ }
35
+
36
+ .chip-remove-button,
37
+ .chip-remove-button-highlighted {
38
+ position: absolute;
39
+ }
40
+
41
+ .chip-remove-button:hover {
42
+ opacity: 0;
43
+ }
44
+
45
+ @keyframes appearInAnimation {
46
+ from {
47
+ opacity: 0;
48
+ transform: translateX(16px);
49
+ }
50
+
51
+ to {
52
+ opacity: 1;
53
+ }
54
+ }
@@ -0,0 +1,19 @@
1
+ const Chevron = ({ className }: { className?: string }) => (
2
+ <svg
3
+ width="20"
4
+ height="20"
5
+ fill="none"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ className={className}
8
+ >
9
+ <path
10
+ d="M15 12.5l-5-5-5 5"
11
+ stroke="#8E8CEE"
12
+ strokeWidth="2"
13
+ strokeLinecap="round"
14
+ strokeLinejoin="round"
15
+ />
16
+ </svg>
17
+ );
18
+
19
+ export default Chevron;
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+
3
+ import { Cell } from '../../index';
4
+
5
+ import styles from './style.module.scss';
6
+
7
+ interface RowProps<T> {
8
+ cell: Cell<T>;
9
+ data: Array<T>;
10
+ isRowHeader?: boolean;
11
+ rowId: string;
12
+ }
13
+
14
+ const Row = <T extends { id: number }>(props: RowProps<T>) => {
15
+ const { cell, data, isRowHeader, rowId } = props;
16
+
17
+ return (
18
+ <div
19
+ key={rowId}
20
+ className={`
21
+ d-flex
22
+ w-100
23
+ ${isRowHeader ? styles.header : ''}
24
+ `}
25
+ >
26
+ <h4
27
+ className={`
28
+ wmx4
29
+ ${styles.cell}
30
+ ${styles.sticky}
31
+ ${isRowHeader ? `p-h2 p--serif ${styles.title}` : ''}
32
+ ${typeof cell.key === 'undefined' ? styles.addon : ''}
33
+ `}
34
+ >
35
+ {cell.label}
36
+ </h4>
37
+
38
+ {Array.isArray(data) &&
39
+ data.map((item) => {
40
+ /**
41
+ * Do not render a cell if
42
+ * the data source object doesn't have the current key
43
+ */
44
+ if (typeof cell.key === 'undefined') return null;
45
+ if (typeof item[cell.key] === 'undefined') return null;
46
+
47
+ return (
48
+ <div
49
+ className={`ta-center ${styles.cell}`}
50
+ key={`${rowId}-${item.id}`}
51
+ >
52
+ {
53
+ /**
54
+ * Return a function if `render` option is present
55
+ * else print the current data source value
56
+ */
57
+ typeof cell.render === 'function'
58
+ ? cell.render(item[cell.key], item)
59
+ : `${item[cell.key]}`
60
+ }
61
+ </div>
62
+ );
63
+ })}
64
+ </div>
65
+ );
66
+ };
67
+
68
+ export default React.memo(Row) as typeof Row;
@@ -0,0 +1,114 @@
1
+ @use "../../../../scss/public/colors" as *;
2
+ @use "../../../../scss/public/grid" as *;
3
+
4
+ $cell-min-width: 256px;
5
+
6
+ .header {
7
+ position: relative;
8
+
9
+ & > div {
10
+ width: 100vw;
11
+
12
+ &:nth-child(n + 3) {
13
+ margin: 0;
14
+ }
15
+
16
+ @include p-size-tablet {
17
+ width: $cell-min-width;
18
+ scroll-snap-align: unset;
19
+ }
20
+ }
21
+ }
22
+
23
+ .cell {
24
+ display: flex;
25
+ justify-content: center;
26
+ align-items: center;
27
+
28
+ scroll-snap-align: end;
29
+
30
+ line-height: 24px;
31
+
32
+ padding: 16px;
33
+
34
+ color: $ds-grey-700;
35
+
36
+ width: 50vw;
37
+
38
+ &:first-child {
39
+ background-color: white;
40
+ /** Add scroll snap to every column except the first one */
41
+ scroll-snap-align: unset;
42
+ }
43
+
44
+ &:nth-child(n + 3) {
45
+ margin-left: 50vw;
46
+
47
+ @include p-size-tablet {
48
+ margin-left: unset;
49
+ }
50
+ }
51
+
52
+ @include p-size-tablet {
53
+ flex: 1 0 $cell-min-width;
54
+ width: $cell-min-width;
55
+ padding: 24px;
56
+
57
+ &:last-child {
58
+ padding: 24px 8px 24px 24px;
59
+ }
60
+ }
61
+ }
62
+
63
+ .title {
64
+ position: relative;
65
+ color: $ds-grey-900;
66
+
67
+ display: none;
68
+
69
+ &:after {
70
+ content: '';
71
+ display: block;
72
+
73
+ position: absolute;
74
+ top: calc(
75
+ 50% + 16px
76
+ ); // Display bottom border at the same distance regardless of cell height
77
+
78
+ height: 4px;
79
+ width: 100%;
80
+ max-width: 140px;
81
+
82
+ background-color: $ds-primary-500;
83
+ }
84
+
85
+ @include p-size-tablet {
86
+ display: flex;
87
+ }
88
+ }
89
+
90
+ .sticky {
91
+ position: sticky;
92
+ justify-content: flex-start;
93
+ z-index: 1;
94
+
95
+ top: 0;
96
+ left: 0;
97
+
98
+ width: 50vw;
99
+
100
+ @include p-size-tablet {
101
+ border-right: 1px solid $ds-grey-100;
102
+ flex: 1 0 288px;
103
+ }
104
+ }
105
+
106
+ .addon {
107
+ width: 100%;
108
+ border-right: none;
109
+ max-width: 100vw;
110
+
111
+ @include p-size-desktop {
112
+ max-width: 944px;
113
+ }
114
+ }
@@ -0,0 +1,19 @@
1
+ const ArrowIcon = ({ className }: { className?: string }) => (
2
+ <svg
3
+ width="14"
4
+ height="8"
5
+ viewBox="0 0 14 8"
6
+ fill="none"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ className={className}
9
+ >
10
+ <path
11
+ d="M1 1.00003L7 7.00003L13 1.00003"
12
+ strokeWidth="2"
13
+ strokeLinecap="round"
14
+ strokeLinejoin="round"
15
+ />
16
+ </svg>
17
+ );
18
+
19
+ export default ArrowIcon;
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ import ArrowIcon from './Arrow';
5
+ import { ActiveTableArrows } from '../../hooks/useActiveTableArrows';
6
+
7
+ import styles from './style.module.scss';
8
+
9
+ export type ArrowValues = 'prev' | 'next';
10
+
11
+ interface TableArrowsProps {
12
+ onClick: (value: ArrowValues) => void;
13
+ active: ActiveTableArrows;
14
+ }
15
+
16
+ const TableArrows = (props: TableArrowsProps) => {
17
+ const { active, onClick } = props;
18
+ const handleButtonClick = (value: ArrowValues) => () => onClick(value);
19
+
20
+ return (
21
+ <div className={`mt24 ${styles.container}`}>
22
+ <button
23
+ onClick={handleButtonClick('prev')}
24
+ className={classNames(
25
+ `p-btn--secondary d-flex`,
26
+ styles.prev,
27
+ styles.arrow,
28
+ {
29
+ [styles.active]: active.left,
30
+ }
31
+ )}
32
+ >
33
+ <ArrowIcon />
34
+ </button>
35
+ <button
36
+ onClick={handleButtonClick('next')}
37
+ className={classNames(
38
+ `p-btn--secondary d-flex`,
39
+ styles.next,
40
+ styles.arrow,
41
+ {
42
+ [styles.active]: active.right,
43
+ }
44
+ )}
45
+ >
46
+ <ArrowIcon />
47
+ </button>
48
+ </div>
49
+ );
50
+ };
51
+
52
+ export default TableArrows;
@@ -0,0 +1,53 @@
1
+ @use "../../../../scss/public/colors" as *;
2
+ @use "../../../../scss/public/grid" as *;
3
+
4
+ .container {
5
+ position: absolute;
6
+ width: 100vw;
7
+ padding: 0 16px;
8
+ justify-content: space-between;
9
+ z-index: 1;
10
+ display: flex;
11
+ @include p-size-tablet {
12
+ display: none;
13
+ }
14
+ }
15
+
16
+ .next {
17
+ transform: rotate(-90deg);
18
+ }
19
+
20
+ .prev {
21
+ transform: rotate(90deg);
22
+ }
23
+
24
+ .arrow {
25
+ width: 32px;
26
+ height: 32px;
27
+
28
+ padding: 0;
29
+
30
+ border-radius: 50%;
31
+ background-color: $ds-grey-200;
32
+
33
+ justify-content: center;
34
+ align-items: center;
35
+
36
+ stroke: $ds-primary-100;
37
+
38
+ &:hover,
39
+ &:focus {
40
+ background-color: $ds-grey-200;
41
+ cursor: not-allowed;
42
+ }
43
+ }
44
+
45
+ .active {
46
+ stroke: $ds-primary-500;
47
+
48
+ &:hover,
49
+ &:focus {
50
+ background-color: $ds-grey-200;
51
+ cursor: pointer;
52
+ }
53
+ }