@popsure/dirty-swan 0.26.10 → 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 (230) hide show
  1. package/package.json +2 -1
  2. package/src/App.tsx +50 -0
  3. package/src/bin/index.ts +71 -0
  4. package/src/bin/tsconfig.json +13 -0
  5. package/src/bin/util/index.test.ts +85 -0
  6. package/src/bin/util/index.ts +132 -0
  7. package/src/bin/util/test/data.json +13 -0
  8. package/src/colors.scss +1 -0
  9. package/src/font-weight.scss +1 -0
  10. package/src/grid.scss +1 -0
  11. package/src/index.tsx +37 -0
  12. package/src/intro.stories.mdx +41 -0
  13. package/src/lib/components/autocompleteAddress/demo.tsx +38 -0
  14. package/src/lib/components/autocompleteAddress/index.stories.mdx +44 -0
  15. package/src/lib/components/autocompleteAddress/index.tsx +316 -0
  16. package/src/lib/components/autocompleteAddress/mapStyle.ts +187 -0
  17. package/src/lib/components/autocompleteAddress/style.module.scss +82 -0
  18. package/src/lib/components/autocompleteAddress/util/index.test.ts +51 -0
  19. package/src/lib/components/autocompleteAddress/util/index.ts +55 -0
  20. package/src/lib/components/button/icons/index.ts +14 -0
  21. package/src/lib/components/button/icons/send-purple.svg +4 -0
  22. package/src/lib/components/button/icons/send-white.svg +4 -0
  23. package/src/lib/components/button/index.stories.mdx +121 -0
  24. package/src/lib/components/button/index.tsx +64 -0
  25. package/src/lib/components/button/styles.module.scss +5 -0
  26. package/src/lib/components/cards/a.stories.mdx +44 -0
  27. package/src/lib/components/cards/cardButton/index.stories.mdx +47 -0
  28. package/src/lib/components/cards/cardButton/index.tsx +61 -0
  29. package/src/lib/components/cards/cardButton/style.module.scss +33 -0
  30. package/src/lib/components/cards/cardWithLeftIcon/index.stories.mdx +103 -0
  31. package/src/lib/components/cards/cardWithLeftIcon/index.tsx +87 -0
  32. package/src/lib/components/cards/cardWithLeftIcon/style.module.scss +23 -0
  33. package/src/lib/components/cards/cardWithTopIcon/index.stories.mdx +105 -0
  34. package/src/lib/components/cards/cardWithTopIcon/index.tsx +60 -0
  35. package/src/lib/components/cards/cardWithTopIcon/style.module.scss +10 -0
  36. package/src/lib/components/cards/cardWithTopLeftIcon/index.stories.mdx +101 -0
  37. package/src/lib/components/cards/cardWithTopLeftIcon/index.tsx +72 -0
  38. package/src/lib/components/cards/cardWithTopLeftIcon/style.module.scss +21 -0
  39. package/src/lib/components/cards/icons/arrow-right.svg +4 -0
  40. package/src/lib/components/cards/icons/chevron-right.svg +3 -0
  41. package/src/lib/components/cards/icons/feather-logo.svg +10 -0
  42. package/src/lib/components/cards/icons/index.ts +36 -0
  43. package/src/lib/components/cards/icons/info.svg +12 -0
  44. package/src/lib/components/cards/index.test.ts +37 -0
  45. package/src/lib/components/cards/index.tsx +57 -0
  46. package/src/lib/components/cards/infoCard/index.stories.mdx +61 -0
  47. package/src/lib/components/cards/infoCard/index.tsx +47 -0
  48. package/src/lib/components/cards/infoCard/style.module.scss +53 -0
  49. package/src/lib/components/chip/icons/remove-button-highlighted.svg +4 -0
  50. package/src/lib/components/chip/icons/remove-button.svg +4 -0
  51. package/src/lib/components/chip/index.stories.mdx +101 -0
  52. package/src/lib/components/chip/index.tsx +38 -0
  53. package/src/lib/components/chip/style.module.scss +54 -0
  54. package/src/lib/components/comparisonTable/components/Chevron.tsx +19 -0
  55. package/src/lib/components/comparisonTable/components/Row/index.tsx +68 -0
  56. package/src/lib/components/comparisonTable/components/Row/style.module.scss +114 -0
  57. package/src/lib/components/comparisonTable/components/TableArrows/Arrow.tsx +19 -0
  58. package/src/lib/components/comparisonTable/components/TableArrows/index.tsx +52 -0
  59. package/src/lib/components/comparisonTable/components/TableArrows/style.module.scss +53 -0
  60. package/src/lib/components/comparisonTable/components/TableInfoButton/index.tsx +37 -0
  61. package/src/lib/components/comparisonTable/components/TableInfoButton/style.module.scss +30 -0
  62. package/src/lib/components/comparisonTable/components/TableRating/StarIcon.tsx +13 -0
  63. package/src/lib/components/comparisonTable/components/TableRating/ZapIcon.tsx +17 -0
  64. package/src/lib/components/comparisonTable/components/TableRating/index.tsx +45 -0
  65. package/src/lib/components/comparisonTable/components/TableRating/style.module.scss +13 -0
  66. package/src/lib/components/comparisonTable/components/TableRowHeader/index.tsx +35 -0
  67. package/src/lib/components/comparisonTable/components/TableRowHeader/style.module.scss +3 -0
  68. package/src/lib/components/comparisonTable/components/TableTrueFalse.tsx +40 -0
  69. package/src/lib/components/comparisonTable/hooks/useActiveTableArrows.ts +63 -0
  70. package/src/lib/components/comparisonTable/index.stories.mdx +254 -0
  71. package/src/lib/components/comparisonTable/index.tsx +211 -0
  72. package/src/lib/components/comparisonTable/style.module.scss +104 -0
  73. package/src/lib/components/dateSelector/datepicker.scss +406 -0
  74. package/src/lib/components/dateSelector/icons/calendar.svg +6 -0
  75. package/src/lib/components/dateSelector/icons/chevron-left.svg +3 -0
  76. package/src/lib/components/dateSelector/icons/chevron-right.svg +3 -0
  77. package/src/lib/components/dateSelector/index.stories.mdx +62 -0
  78. package/src/lib/components/dateSelector/index.test.ts +33 -0
  79. package/src/lib/components/dateSelector/index.tsx +247 -0
  80. package/src/lib/components/dateSelector/style.module.scss +77 -0
  81. package/src/lib/components/downloadButton/icons/check.svg +3 -0
  82. package/src/lib/components/downloadButton/icons/download.svg +5 -0
  83. package/src/lib/components/downloadButton/index.stories.mdx +59 -0
  84. package/src/lib/components/downloadButton/index.tsx +67 -0
  85. package/src/lib/components/downloadButton/style.module.scss +19 -0
  86. package/src/lib/components/downloadRing/icons/check-outside-circle.tsx +26 -0
  87. package/src/lib/components/downloadRing/icons/download-cloud.tsx +18 -0
  88. package/src/lib/components/downloadRing/icons/style.module.scss +7 -0
  89. package/src/lib/components/downloadRing/index.stories.mdx +35 -0
  90. package/src/lib/components/downloadRing/index.tsx +79 -0
  91. package/src/lib/components/downloadRing/style.module.scss +66 -0
  92. package/src/lib/components/dropzone/images/error.tsx +18 -0
  93. package/src/lib/components/dropzone/images/file.tsx +26 -0
  94. package/src/lib/components/dropzone/images/style.module.scss +7 -0
  95. package/src/lib/components/dropzone/images/upload-complete.tsx +24 -0
  96. package/src/lib/components/dropzone/images/upload.tsx +18 -0
  97. package/src/lib/components/dropzone/index.stories.mdx +44 -0
  98. package/src/lib/components/dropzone/index.tsx +152 -0
  99. package/src/lib/components/dropzone/style.module.scss +90 -0
  100. package/src/lib/components/input/a.stories.mdx +28 -0
  101. package/src/lib/components/input/autoSuggestInput/index.stories.mdx +137 -0
  102. package/src/lib/components/input/autoSuggestInput/index.tsx +81 -0
  103. package/src/lib/components/input/autoSuggestInput/style.module.scss +71 -0
  104. package/src/lib/components/input/autoSuggestMultiSelect/index.stories.mdx +115 -0
  105. package/src/lib/components/input/autoSuggestMultiSelect/index.tsx +75 -0
  106. package/src/lib/components/input/autoSuggestMultiSelect/style.module.scss +4 -0
  107. package/src/lib/components/input/currency/format/index.test.ts +49 -0
  108. package/src/lib/components/input/currency/format/index.ts +15 -0
  109. package/src/lib/components/input/currency/index.stories.mdx +25 -0
  110. package/src/lib/components/input/currency/index.test.tsx +56 -0
  111. package/src/lib/components/input/currency/index.tsx +53 -0
  112. package/src/lib/components/input/iban/formatIban/index.test.ts +11 -0
  113. package/src/lib/components/input/iban/formatIban/index.ts +22 -0
  114. package/src/lib/components/input/iban/index.stories.mdx +21 -0
  115. package/src/lib/components/input/iban/index.tsx +20 -0
  116. package/src/lib/components/input/index.stories.mdx +62 -0
  117. package/src/lib/components/input/index.tsx +51 -0
  118. package/src/lib/components/input/style.module.scss +94 -0
  119. package/src/lib/components/modal/bottomModal/img/close.svg +4 -0
  120. package/src/lib/components/modal/bottomModal/index.tsx +68 -0
  121. package/src/lib/components/modal/bottomModal/style.module.scss +104 -0
  122. package/src/lib/components/modal/bottomOrRegularModal/index.tsx +43 -0
  123. package/src/lib/components/modal/bottomOrRegularModal/style.module.scss +16 -0
  124. package/src/lib/components/modal/hooks/useOnClose.ts +51 -0
  125. package/src/lib/components/modal/index.stories.mdx +316 -0
  126. package/src/lib/components/modal/index.ts +14 -0
  127. package/src/lib/components/modal/regularModal/img/close.svg +4 -0
  128. package/src/lib/components/modal/regularModal/index.tsx +55 -0
  129. package/src/lib/components/modal/regularModal/style.module.scss +106 -0
  130. package/src/lib/components/multiDropzone/UploadFileCell/index.tsx +138 -0
  131. package/src/lib/components/multiDropzone/UploadFileCell/style.module.scss +101 -0
  132. package/src/lib/components/multiDropzone/icons/bmp-complete.svg +10 -0
  133. package/src/lib/components/multiDropzone/icons/bmp.svg +10 -0
  134. package/src/lib/components/multiDropzone/icons/doc-complete.svg +11 -0
  135. package/src/lib/components/multiDropzone/icons/doc.svg +11 -0
  136. package/src/lib/components/multiDropzone/icons/docx-complete.svg +12 -0
  137. package/src/lib/components/multiDropzone/icons/docx.svg +12 -0
  138. package/src/lib/components/multiDropzone/icons/eye.svg +4 -0
  139. package/src/lib/components/multiDropzone/icons/generic-complete.svg +4 -0
  140. package/src/lib/components/multiDropzone/icons/generic-error.svg +7 -0
  141. package/src/lib/components/multiDropzone/icons/generic.svg +4 -0
  142. package/src/lib/components/multiDropzone/icons/heic-complete.svg +11 -0
  143. package/src/lib/components/multiDropzone/icons/heic.svg +11 -0
  144. package/src/lib/components/multiDropzone/icons/index.ts +51 -0
  145. package/src/lib/components/multiDropzone/icons/jpeg-complete.svg +11 -0
  146. package/src/lib/components/multiDropzone/icons/jpeg.svg +11 -0
  147. package/src/lib/components/multiDropzone/icons/jpg-complete.svg +10 -0
  148. package/src/lib/components/multiDropzone/icons/jpg.svg +10 -0
  149. package/src/lib/components/multiDropzone/icons/pdf-complete.svg +8 -0
  150. package/src/lib/components/multiDropzone/icons/pdf.svg +8 -0
  151. package/src/lib/components/multiDropzone/icons/png-complete.svg +10 -0
  152. package/src/lib/components/multiDropzone/icons/png.svg +10 -0
  153. package/src/lib/components/multiDropzone/icons/trash.svg +6 -0
  154. package/src/lib/components/multiDropzone/icons/upload.svg +5 -0
  155. package/src/lib/components/multiDropzone/index.stories.mdx +91 -0
  156. package/src/lib/components/multiDropzone/index.tsx +99 -0
  157. package/src/lib/components/multiDropzone/style.module.scss +32 -0
  158. package/src/lib/components/segmentedControl/index.stories.mdx +47 -0
  159. package/src/lib/components/segmentedControl/index.tsx +105 -0
  160. package/src/lib/components/segmentedControl/style.module.scss +36 -0
  161. package/src/lib/components/signaturePad/img/reset.svg +4 -0
  162. package/src/lib/components/signaturePad/img/sign.svg +3 -0
  163. package/src/lib/components/signaturePad/index.stories.mdx +17 -0
  164. package/src/lib/components/signaturePad/index.tsx +96 -0
  165. package/src/lib/components/signaturePad/style.module.scss +90 -0
  166. package/src/lib/index.tsx +71 -0
  167. package/src/lib/models/autoSuggestInput/index.ts +4 -0
  168. package/src/lib/models/download.ts +1 -0
  169. package/src/lib/models/downloadRing/index.ts +6 -0
  170. package/src/lib/scss/index.scss +22 -0
  171. package/src/lib/scss/private/_reset.scss +149 -0
  172. package/src/lib/scss/private/base/_colors.scss +19 -0
  173. package/src/lib/scss/private/base/_cursors.scss +31 -0
  174. package/src/lib/scss/private/base/_display.scss +35 -0
  175. package/src/lib/scss/private/base/_grid.scss +52 -0
  176. package/src/lib/scss/private/base/_index.scss +9 -0
  177. package/src/lib/scss/private/base/_shadows.scss +2 -0
  178. package/src/lib/scss/private/base/_spacing.scss +89 -0
  179. package/src/lib/scss/private/base/_typography.scss +128 -0
  180. package/src/lib/scss/private/base/_width_and_height.scss +25 -0
  181. package/src/lib/scss/private/base/cursors.stories.mdx +18 -0
  182. package/src/lib/scss/private/base/demo.tsx +119 -0
  183. package/src/lib/scss/private/base/display.stories.mdx +19 -0
  184. package/src/lib/scss/private/base/flex/_flex.scss +63 -0
  185. package/src/lib/scss/private/base/flex/flex.stories.mdx +139 -0
  186. package/src/lib/scss/private/base/flex/style.module.scss +24 -0
  187. package/src/lib/scss/private/base/spacing.stories.mdx +173 -0
  188. package/src/lib/scss/private/base/style.module.scss +42 -0
  189. package/src/lib/scss/private/base/typography.stories.mdx +71 -0
  190. package/src/lib/scss/private/base/width_and_height.stories.mdx +172 -0
  191. package/src/lib/scss/private/components/_badge.scss +41 -0
  192. package/src/lib/scss/private/components/_buttons.scss +193 -0
  193. package/src/lib/scss/private/components/_cards.scss +32 -0
  194. package/src/lib/scss/private/components/_index.scss +6 -0
  195. package/src/lib/scss/private/components/_input.scss +241 -0
  196. package/src/lib/scss/private/components/_notices.scss +39 -0
  197. package/src/lib/scss/private/components/_spinner.scss +60 -0
  198. package/src/lib/scss/private/components/assets/checkmark.svg +3 -0
  199. package/src/lib/scss/private/components/assets/icon-form-dropdown.svg +3 -0
  200. package/src/lib/scss/private/components/badge.stories.mdx +37 -0
  201. package/src/lib/scss/private/components/button.stories.mdx +107 -0
  202. package/src/lib/scss/private/components/cards.stories.mdx +35 -0
  203. package/src/lib/scss/private/components/checkbox.stories.mdx +47 -0
  204. package/src/lib/scss/private/components/input.stories.mdx +33 -0
  205. package/src/lib/scss/private/components/notices.stories.mdx +37 -0
  206. package/src/lib/scss/private/components/radio.stories.mdx +47 -0
  207. package/src/lib/scss/private/components/select.stories.mdx +17 -0
  208. package/src/lib/scss/private/components/spinner.stories.mdx +25 -0
  209. package/src/lib/scss/public/colors/_index.scss +2 -0
  210. package/src/lib/scss/public/colors/default.scss +125 -0
  211. package/src/lib/scss/public/colors/overrides.scss +0 -0
  212. package/src/lib/scss/public/colors.stories.mdx +27 -0
  213. package/src/lib/scss/public/demo.tsx +285 -0
  214. package/src/lib/scss/public/font/_index.scss +2 -0
  215. package/src/lib/scss/public/font/default.scss +3 -0
  216. package/src/lib/scss/public/font/overrides.scss +0 -0
  217. package/src/lib/scss/public/font-weight.scss +9 -0
  218. package/src/lib/scss/public/font-weight.stories.mdx +32 -0
  219. package/src/lib/scss/public/grid.scss +21 -0
  220. package/src/lib/scss/public/grid.stories.mdx +41 -0
  221. package/src/lib/scss/third-party/_google_places.scss +62 -0
  222. package/src/lib/scss/third-party/_index.scss +1 -0
  223. package/src/lib/scss/utils/_index.scss +3 -0
  224. package/src/lib/util/calendarDate/index.test.ts +32 -0
  225. package/src/lib/util/calendarDate/index.ts +30 -0
  226. package/src/lib/util/zeroFill.test.ts +15 -0
  227. package/src/lib/util/zeroFill.ts +7 -0
  228. package/src/react-app-env.d.ts +1 -0
  229. package/src/setupTests.js +8 -0
  230. package/src/theme.stories.mdx +54 -0
@@ -0,0 +1,66 @@
1
+ @use "../../scss/public/grid" as *;
2
+
3
+ .container {
4
+ position: relative;
5
+ display: flex;
6
+ justify-content: center;
7
+ }
8
+
9
+ .button {
10
+ background-color: transparent;
11
+ border: none;
12
+ cursor: pointer;
13
+ }
14
+
15
+ .button:hover {
16
+ .inner-circle-hover {
17
+ animation: borderBlink 1.3s ease-in-out infinite;
18
+ }
19
+ }
20
+
21
+ .button:focus {
22
+ outline: none;
23
+ }
24
+
25
+ circle {
26
+ transition: stroke-dashoffset 0.35s;
27
+ transform: rotate(-90deg);
28
+ transform-origin: 50% 50%;
29
+
30
+ position: absolute;
31
+ }
32
+
33
+ .overlay-circle {
34
+ z-index: 1;
35
+ stroke: var(--ds-primary-500);
36
+ fill: transparent;
37
+ }
38
+
39
+ .overlay-circle-completed {
40
+ z-index: 1;
41
+ stroke: #90df9b;
42
+ fill: rgba(144, 223, 155, 0.1);
43
+ }
44
+
45
+ .inner-circle {
46
+ z-index: 0;
47
+ stroke: var(--ds-primary-100);
48
+ fill: transparent;
49
+ }
50
+
51
+ .text-container {
52
+ position: absolute;
53
+ top: 50%;
54
+ left: 50%;
55
+ transform: translate(-50%, -50%);
56
+ }
57
+
58
+ @keyframes borderBlink {
59
+ from,
60
+ to {
61
+ stroke: var(--ds-primary-100);
62
+ }
63
+ 50% {
64
+ stroke: var(--ds-primary-500);
65
+ }
66
+ }
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+
3
+ export default () => (
4
+ <svg
5
+ width="90"
6
+ height="66"
7
+ viewBox="0 0 90 66"
8
+ fill="none"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ >
11
+ <path
12
+ fill-rule="evenodd"
13
+ clip-rule="evenodd"
14
+ d="M45 0C37.9976 0 30.9572 2.64966 25.6182 7.94665C21.6477 11.8859 19.2407 16.7726 18.2201 21.8685C7.85944 23.8626 0 32.8399 0 43.6762C0 55.9706 10.1084 65.9997 22.5 65.9997H56.656C56.6837 66.0001 56.7114 66.0001 56.7391 65.9997H57.2609C57.2886 66.0001 57.3163 66.0001 57.344 65.9997H70.4348C81.2231 65.9997 90 57.2917 90 46.5881C90 36.486 82.1561 28.2623 72.2079 27.3583C72.2539 20.3322 69.7386 13.2916 64.3512 7.94665C59.0169 2.65398 52.0024 0 45 0ZM57.2609 60.1762H56.7391C56.7114 60.1758 56.6838 60.1758 56.6561 60.1762H22.5C13.2807 60.1762 5.86957 52.8233 5.86957 43.6762C5.86957 35.0382 12.4909 28.0009 20.9715 27.237C21.6366 27.1727 22.2596 26.8852 22.7377 26.4219C23.2157 25.9587 23.5201 25.3474 23.6005 24.6892C24.1405 20.074 26.1989 15.5901 29.7758 12.0413C33.9878 7.86248 39.4844 5.8235 45 5.8235C50.5156 5.8235 55.9776 7.85816 60.1936 12.0413C65.0657 16.8751 67.1274 23.4426 66.3689 29.7241C66.317 30.1333 66.3533 30.5488 66.4754 30.9431C66.5975 31.3373 66.8026 31.7014 67.0772 32.0111C67.3518 32.3208 67.6895 32.5691 68.0681 32.7395C68.4466 32.91 68.8574 32.9987 69.2731 32.9998H70.4348C78.0729 32.9998 84.1304 39.0097 84.1304 46.5881C84.1304 54.1663 78.0729 60.1762 70.4348 60.1762H57.3439C57.3162 60.1758 57.2886 60.1758 57.2609 60.1762ZM32.7678 30.7678C31.7915 29.7915 31.7915 28.2085 32.7678 27.2322C33.7441 26.2559 35.327 26.2559 36.3033 27.2322L44.0355 34.9645L52.2322 26.7678C53.2085 25.7915 54.7915 25.7915 55.7678 26.7678C56.7441 27.7441 56.7441 29.327 55.7678 30.3033L47.5711 38.5L55.3952 46.3241C56.3715 47.3004 56.3715 48.8833 55.3952 49.8596C54.4189 50.836 52.836 50.836 51.8596 49.8596L44.0355 42.0355L36.6759 49.3952C35.6996 50.3715 34.1167 50.3715 33.1404 49.3952C32.164 48.4189 32.164 46.836 33.1404 45.8596L40.5 38.5L32.7678 30.7678Z"
15
+ fill="#E55566"
16
+ />
17
+ </svg>
18
+ );
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+
3
+ import styles from './style.module.scss';
4
+
5
+ export default () => (
6
+ <svg
7
+ width="60"
8
+ height="72"
9
+ viewBox="0 0 60 72"
10
+ fill="none"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ >
13
+ <path
14
+ className={styles['stroke-primary-500']}
15
+ d="M50.5975 69H8.94969C7.37173 69 5.8584 68.3679 4.74262 67.2426C3.62684 66.1174 3 64.5913 3 63V21L20.8491 3H50.5975C52.1754 3 53.6888 3.63214 54.8045 4.75736C55.9203 5.88258 56.5472 7.4087 56.5472 9V63C56.5472 64.5913 55.9203 66.1174 54.8045 67.2426C53.6888 68.3679 52.1754 69 50.5975 69Z"
16
+ strokeWidth="5"
17
+ strokeLinejoin="round"
18
+ />
19
+ <path
20
+ className={styles['stroke-primary-500']}
21
+ d="M20.434 3V15.4528C20.434 17.1042 19.8217 18.6879 18.7319 19.8556C17.642 21.0233 16.1639 21.6792 14.6226 21.6792H3"
22
+ strokeWidth="5"
23
+ strokeLinejoin="round"
24
+ />
25
+ </svg>
26
+ );
@@ -0,0 +1,7 @@
1
+ .stroke-primary-500 {
2
+ stroke: var(--ds-primary-500);
3
+ }
4
+
5
+ .fill-primary-500 {
6
+ fill: var(--ds-primary-500);
7
+ }
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+
3
+ import styles from './style.module.scss';
4
+
5
+ export default () => (
6
+ <svg
7
+ width="90"
8
+ height="66"
9
+ viewBox="0 0 90 66"
10
+ fill="none"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ >
13
+ <path
14
+ className={styles['fill-primary-500']}
15
+ d="M45 0C37.9976 0 30.9572 2.64966 25.6182 7.94665C21.6477 11.8859 19.2407 16.7726 18.2201 21.8685C7.85944 23.8626 0 32.8399 0 43.6762C0 55.9706 10.1084 65.9997 22.5 65.9997H57.2609C57.6498 66.0052 58.0359 65.9339 58.3968 65.79C58.7576 65.6461 59.0861 65.4325 59.3631 65.1616C59.64 64.8907 59.8599 64.5678 60.01 64.2119C60.1602 63.8559 60.2375 63.4738 60.2375 63.088C60.2375 62.7021 60.1602 62.3201 60.01 61.9641C59.8599 61.6081 59.64 61.2853 59.3631 61.0143C59.0861 60.7434 58.7576 60.5298 58.3968 60.3859C58.0359 60.242 57.6498 60.1708 57.2609 60.1762H22.5C13.2807 60.1762 5.86957 52.8233 5.86957 43.6762C5.86957 35.0382 12.4909 28.0009 20.9715 27.237C21.6366 27.1727 22.2596 26.8852 22.7377 26.4219C23.2157 25.9587 23.5201 25.3474 23.6005 24.6892C24.1405 20.074 26.1989 15.5901 29.7758 12.0413C33.9878 7.86248 39.4844 5.8235 45 5.8235C50.5156 5.8235 55.9776 7.85816 60.1936 12.0413C65.0657 16.8751 67.1274 23.4426 66.3689 29.7241C66.317 30.1333 66.3533 30.5488 66.4754 30.9431C66.5975 31.3373 66.8026 31.7014 67.0772 32.0111C67.3518 32.3208 67.6895 32.5691 68.0681 32.7395C68.4466 32.91 68.8574 32.9987 69.2731 32.9998H70.4348C78.0729 32.9998 84.1304 39.0097 84.1304 46.5881C84.1304 54.1663 78.0729 60.1762 70.4348 60.1762H56.7391C56.3502 60.1708 55.9641 60.242 55.6032 60.3859C55.2424 60.5298 54.9139 60.7434 54.6369 61.0143C54.36 61.2853 54.1401 61.6081 53.99 61.9641C53.8398 62.3201 53.7626 62.7021 53.7626 63.088C53.7626 63.4738 53.8398 63.8559 53.99 64.2119C54.1401 64.5678 54.36 64.8907 54.6369 65.1616C54.9139 65.4325 55.2424 65.6461 55.6032 65.79C55.9641 65.9339 56.3502 66.0052 56.7391 65.9997H70.4348C81.2231 65.9997 90 57.2917 90 46.5881C90 36.486 82.1561 28.2623 72.2079 27.3583C72.2539 20.3322 69.7386 13.2916 64.3512 7.94665C59.0169 2.65398 52.0024 0 45 0Z"
16
+ />
17
+ <path
18
+ className={styles['fill-primary-500']}
19
+ fill-rule="evenodd"
20
+ clip-rule="evenodd"
21
+ d="M59.7678 28.0107C60.7441 28.9793 60.7441 30.5498 59.7678 31.5185L38.2043 52.9127C37.8144 53.2995 37.1856 53.2995 36.7957 52.9127L26.7322 42.9282C25.7559 41.9595 25.7559 40.3891 26.7322 39.4204C27.7085 38.4518 29.2915 38.4518 30.2678 39.4204L37.5 46.5959L56.2322 28.0107C57.2085 27.042 58.7915 27.042 59.7678 28.0107Z"
22
+ />
23
+ </svg>
24
+ );
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+
3
+ import styles from './style.module.scss';
4
+
5
+ export default () => (
6
+ <svg
7
+ width="90"
8
+ height="73"
9
+ viewBox="0 0 90 73"
10
+ fill="none"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ >
13
+ <path
14
+ className={styles['fill-primary-500']}
15
+ d="M45 0C37.9976 0 30.9572 2.67062 25.6182 8.00951C21.6477 11.9799 19.2407 16.9053 18.2201 22.0414C7.85945 24.0513 0 33.0997 0 44.0217C0 56.4134 10.1084 66.5218 22.5 66.5218H33.2609C33.6498 66.5273 34.0359 66.4555 34.3968 66.3104C34.7576 66.1654 35.0861 65.9501 35.3631 65.677C35.64 65.404 35.8599 65.0786 36.01 64.7198C36.1602 64.361 36.2375 63.9759 36.2375 63.587C36.2375 63.1981 36.1602 62.813 36.01 62.4542C35.8599 62.0954 35.64 61.7701 35.3631 61.497C35.0861 61.2239 34.7576 61.0086 34.3968 60.8636C34.0359 60.7186 33.6498 60.6467 33.2609 60.6522H22.5C13.2807 60.6522 5.86957 53.2412 5.86957 44.0217C5.86957 35.3154 12.4909 28.2224 20.9715 27.4524C21.6366 27.3876 22.2596 27.0978 22.7377 26.6309C23.2157 26.164 23.5201 25.5479 23.6005 24.8845C24.1405 20.2328 26.1989 15.7134 29.7758 12.1365C33.9878 7.92468 39.4844 5.86957 45 5.86957C50.5156 5.86957 55.9776 7.92032 60.1936 12.1365C65.0657 17.0086 67.1274 23.628 66.3689 29.9592C66.317 30.3717 66.3533 30.7905 66.4754 31.1879C66.5975 31.5852 66.8026 31.9522 67.0772 32.2643C67.3518 32.5765 67.6895 32.8267 68.0681 32.9985C68.4466 33.1703 68.8574 33.2597 69.2731 33.2609H70.4348C78.0729 33.2609 84.1304 39.3183 84.1304 46.9566C84.1304 54.5947 78.0729 60.6522 70.4348 60.6522H56.7391C56.3502 60.6467 55.9641 60.7186 55.6032 60.8636C55.2424 61.0086 54.9139 61.2239 54.6369 61.497C54.36 61.7701 54.1401 62.0954 53.99 62.4542C53.8398 62.813 53.7626 63.1981 53.7626 63.587C53.7626 63.9759 53.8398 64.361 53.99 64.7198C54.1401 65.0786 54.36 65.404 54.6369 65.677C54.9139 65.9501 55.2424 66.1654 55.6032 66.3104C55.9641 66.4555 56.3502 66.5273 56.7391 66.5218H70.4348C81.2231 66.5218 90 57.7449 90 46.9566C90 36.7746 82.1561 28.4859 72.2079 27.5747C72.2539 20.4931 69.7385 13.3968 64.3512 8.00951C59.0169 2.67498 52.0024 0 45 0ZM45 33.2609C44.0215 33.2609 43.5041 33.5757 43.013 34.0251L32.2521 43.8077C31.0095 44.9609 31.0313 46.8324 32.0686 47.9654C33.1059 49.0983 35.0881 49.1803 36.2262 48.1488L42.0652 42.8295V69.4566C42.0652 71.0774 43.3789 72.3914 45 72.3914C46.6212 72.3914 47.9348 71.0774 47.9348 69.4566V42.8295L53.7738 48.1488C54.912 49.1803 56.8342 49.0405 57.9314 47.9654C59.0876 46.8324 58.8758 44.8505 57.7479 43.8077L46.987 34.0251C46.4057 33.4929 45.9785 33.2609 45 33.2609Z"
16
+ />
17
+ </svg>
18
+ );
@@ -0,0 +1,44 @@
1
+ import { Meta, Preview } from '@storybook/addon-docs/blocks';
2
+
3
+ import Dropzone from '.';
4
+
5
+ <Meta title="JSX/Dropzone" component={Dropzone} />
6
+
7
+ # Dropzone
8
+
9
+ Date selector are user interface elements which allow user to select and upload a file.
10
+
11
+ ## Examples
12
+
13
+ ### Idle state
14
+
15
+ <Preview>
16
+ <Dropzone uploading={false} onSelectedFile={() => {}} />
17
+ </Preview>
18
+
19
+ ### Uploading state
20
+
21
+ <Preview>
22
+ <Dropzone uploading={true} progress={30} onSelectedFile={() => {}} />
23
+ </Preview>
24
+
25
+ ### Error state
26
+
27
+ <Preview>
28
+ <Dropzone
29
+ uploading={true}
30
+ progress={30}
31
+ error="Something went wront"
32
+ onSelectedFile={() => {}}
33
+ />
34
+ </Preview>
35
+
36
+ ### Uploaded state
37
+
38
+ <Preview>
39
+ <Dropzone
40
+ uploading={false}
41
+ uploadedFileUrl="http://getpopsure.com/my-file.png"
42
+ onSelectedFile={() => {}}
43
+ />
44
+ </Preview>
@@ -0,0 +1,152 @@
1
+ import React, { useCallback } from 'react';
2
+ import { useDropzone } from 'react-dropzone';
3
+
4
+ import styles from './style.module.scss';
5
+
6
+ import ErrorImage from './images/error';
7
+ import UploadImage from './images/upload';
8
+ import FileImage from './images/file';
9
+
10
+ export function truncateStringTail(aString: string, length: number) {
11
+ if (aString.length > length) {
12
+ const tail = '[...]';
13
+ const truncatedString = aString.substring(
14
+ aString.length - length + tail.length,
15
+ aString.length
16
+ );
17
+ return `${tail}${truncatedString}`;
18
+ }
19
+
20
+ return aString;
21
+ }
22
+
23
+ export default ({
24
+ className,
25
+ uploading,
26
+ progress,
27
+ error,
28
+ uploadedFileUrl,
29
+ onSelectedFile,
30
+ }: {
31
+ className?: string;
32
+ uploading: boolean;
33
+ progress?: number;
34
+ error?: string;
35
+ uploadedFileUrl?: string;
36
+ onSelectedFile: (file: File) => void;
37
+ }) => {
38
+ const onDrop = useCallback(
39
+ (acceptedFiles) => {
40
+ onSelectedFile(acceptedFiles[0]);
41
+ },
42
+ [onSelectedFile]
43
+ );
44
+
45
+ const uploadedFileName =
46
+ (uploadedFileUrl &&
47
+ truncateStringTail(
48
+ new URL(uploadedFileUrl).pathname.split('/').pop() || '',
49
+ 22
50
+ )) ||
51
+ '';
52
+
53
+ type State = 'idle' | 'uploading' | 'error' | 'uploaded';
54
+
55
+ function stateFromParameters({
56
+ uploading,
57
+ progress,
58
+ error,
59
+ uploadedFileUrl,
60
+ }: {
61
+ uploading: boolean;
62
+ progress?: number;
63
+ error?: string;
64
+ uploadedFileUrl?: string;
65
+ }): State {
66
+ if (error) {
67
+ return 'error';
68
+ }
69
+
70
+ if (uploading && progress) {
71
+ return 'uploading';
72
+ }
73
+
74
+ if (uploadedFileUrl) {
75
+ return 'uploaded';
76
+ }
77
+
78
+ return 'idle';
79
+ }
80
+
81
+ const state = stateFromParameters({
82
+ uploading,
83
+ progress,
84
+ error,
85
+ uploadedFileUrl,
86
+ });
87
+
88
+ const {
89
+ action,
90
+ Image,
91
+ text,
92
+ containerStyle,
93
+ textColor,
94
+ }: {
95
+ action: string | undefined;
96
+ Image: React.ComponentType<{}>;
97
+ text: string;
98
+ containerStyle: string | undefined;
99
+ textColor: string;
100
+ } = {
101
+ idle: {
102
+ action: undefined,
103
+ Image: UploadImage,
104
+ text: 'Upload document',
105
+ containerStyle: undefined,
106
+ textColor: 'tc-primary-500',
107
+ },
108
+ uploading: {
109
+ action: undefined,
110
+ Image: UploadImage,
111
+ text: 'Uploading document…',
112
+ containerStyle: styles['container--uploading'],
113
+ textColor: 'tc-primary-500',
114
+ },
115
+ error: {
116
+ action: 'Tap to retry',
117
+ Image: ErrorImage,
118
+ text: 'Error!',
119
+ containerStyle: styles['container--error'],
120
+ textColor: 'tc-red-500',
121
+ },
122
+ uploaded: {
123
+ action: 'Tap to replace',
124
+ Image: FileImage,
125
+ text: uploadedFileName,
126
+ containerStyle: styles['container--uploaded'],
127
+ textColor: 'tc-primary-500',
128
+ },
129
+ }[state];
130
+
131
+ const { getRootProps, getInputProps } = useDropzone({ onDrop });
132
+
133
+ return (
134
+ <div
135
+ className={`${styles.container} ${containerStyle} ${className}`}
136
+ {...getRootProps()}
137
+ >
138
+ <input {...getInputProps()} />
139
+ <Image />
140
+ <div className="p-p mt16">{text}</div>
141
+ {action && <div className={`p-p ${textColor}`}>{action}</div>}
142
+ {state === 'uploading' && (
143
+ <div className={styles['progress-container']}>
144
+ <div
145
+ className={styles['progress-bar']}
146
+ style={{ width: `${progress}%` }}
147
+ />
148
+ </div>
149
+ )}
150
+ </div>
151
+ );
152
+ };
@@ -0,0 +1,90 @@
1
+ .container {
2
+ cursor: pointer;
3
+
4
+ background-color: var(--ds-primary-100);
5
+
6
+ border-radius: 8px;
7
+ border: 1px dashed var(--ds-primary-500);
8
+
9
+ height: 226px;
10
+ width: 100%;
11
+ max-width: 518px;
12
+
13
+ transition: 0.3s background-color, 0.3s border-color;
14
+
15
+ display: flex;
16
+ flex-direction: column;
17
+ align-items: center;
18
+ justify-content: center;
19
+
20
+ &:focus {
21
+ outline: none;
22
+ box-shadow: 0 0 0 2px rgba($color: var(--ds-primary-500), $alpha: 0.5);
23
+ }
24
+
25
+ &:hover {
26
+ background-color: var(--ds-primary-300);
27
+ }
28
+
29
+ &--error {
30
+ border-color: var(--ds-red-300);
31
+ background-color: var(--ds-red-100);
32
+
33
+ &:hover {
34
+ border-color: var(--ds-red-300);
35
+ background-color: var(--ds-red-100);
36
+ }
37
+
38
+ &:focus {
39
+ outline: none;
40
+ box-shadow: 0 0 0 2px rgba($color: var(--ds-red-500), $alpha: 0.5);
41
+ }
42
+ }
43
+
44
+ &--uploading {
45
+ pointer-events: none;
46
+ }
47
+
48
+ &--uploaded {
49
+ &:hover {
50
+ background-color: var(--ds-primary-100);
51
+ }
52
+ }
53
+ }
54
+
55
+ .image {
56
+ width: 88px;
57
+ }
58
+
59
+ .progress-container {
60
+ height: 4px;
61
+ width: 85%;
62
+
63
+ margin-top: 24px;
64
+
65
+ border-radius: 2px;
66
+ background-color: var(--ds-primary-300);
67
+
68
+ overflow: hidden;
69
+
70
+ & .progress-bar {
71
+ height: 100%;
72
+
73
+ background-color: var(--ds-primary-500);
74
+ border-radius: 2px;
75
+
76
+ transition: width 0.3s;
77
+ }
78
+ }
79
+
80
+ .action {
81
+ color: var(--ds-primary-500);
82
+
83
+ &--error {
84
+ color: var(--ds-red-500);
85
+ }
86
+
87
+ &--uploaded {
88
+ color: var(--ds-primary-500);
89
+ }
90
+ }
@@ -0,0 +1,28 @@
1
+ import { Meta, Story, Preview } from '@storybook/addon-docs/blocks';
2
+
3
+ import Input from '.';
4
+
5
+ <Meta title="JSX/Inputs/Intro" />
6
+
7
+ # Inputs
8
+
9
+ Input elements are used to gather information from users.
10
+
11
+ We have defined a few different input components according to the use case:
12
+
13
+ - A default [Input](?path=/story/jsx-inputs-input--page) component
14
+ - A [Currency Input](?path=/story/jsx-inputs-currency-input--page) component that is meant to be used for entering amount in Euro
15
+ - An [Iban Input](?path=/story/jsx-inputs-iban-input--page) that is meant to be used when entering banking informations.
16
+ - A [AutoSuggestInput]() component allows quick search via the input field to find an option for selection.
17
+ - The [AutoSuggestMultiSelect]() component is a combination of the `AutoSuggestInput` and `Chip` components, where the selections are displayed above the input.
18
+
19
+ You are looking at the JSX definition of the Input component, if you want you can use the [css alternative](?path=/story/css-components-input--page)
20
+
21
+ <Preview>
22
+ <iframe
23
+ width="100%"
24
+ height="450"
25
+ src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FMKs4cbojdVOBKUxv7okb93%2FDirty-Swan-Pattern-Library%3Fnode-id%3D3%253A240"
26
+ allowFullScreen
27
+ ></iframe>
28
+ </Preview>
@@ -0,0 +1,137 @@
1
+ import { useState } from 'react';
2
+ import { Meta } from '@storybook/addon-docs/blocks';
3
+
4
+ import AutoSuggestInput from '.';
5
+ import featherLogo from '../../cards/icons/feather-logo.svg';
6
+
7
+ <Meta title="JSX/Inputs/AutoSuggestInput" />
8
+
9
+ # AutoSuggestInput
10
+
11
+ This component allows quick search via the input field to find an option for selection.
12
+
13
+ ## Types
14
+
15
+ ```typescript
16
+ export interface Option {
17
+ value: string; // value of option to be stored and displayed on UI
18
+ leftIcon?: string; // image of the provided option to be displayed on UI
19
+ }
20
+ ```
21
+
22
+ ## Arguments
23
+
24
+ | attribute | unit | description | default value | required |
25
+ | ---------------------------- | -------- | ----------------------------------------------------------------------------------------- | ------------- | -------- |
26
+ | currentOption | string | Current input of the component by user | n/a | true |
27
+ | suggestions | Option | List of suggestions that should be displayed to the respective input | n/a | true |
28
+ | onChange | function | Function that is called when value of current input changes | n/a | true |
29
+ | handleSuggestionSelected | function | Functon that runs when a suggestion is selected from the dropdown | n/a | true |
30
+ | handleSuggestionFetchRequest | function | Function that allows control of which suggestions should be displayed | n/a | true |
31
+ | handleSuggestionClearRequest | function | Function that runs when suggestions are cleared (eg. input removal, selecting suggestion) | n/a | true |
32
+ | placeholder | string | Placeholder for DirtySwan Input component | n/a | true |
33
+ | className | string | Class name for the most parent element | undefined | false |
34
+ | wrapText | boolean | Wether or not wrap the entries in the dropdown or hide overflown text | false | false |
35
+
36
+ ## Example
37
+
38
+ Following component has five options to search from: `feather`, `feather2`, `feather3`,`dirtyswan`, `test value`
39
+
40
+ export const AutoSuggestInputStory = () => {
41
+ const [selectedValues, setSelectedValues] = useState([]);
42
+ const [currentOption, setCurrentOption] = useState('');
43
+ const [suggestions, setSuggestions] = useState([]);
44
+ const options = [
45
+ { value: 'feather', leftIcon: featherLogo },
46
+ { value: 'feather2', leftIcon: featherLogo },
47
+ {
48
+ value: 'feather3',
49
+ leftIcon: featherLogo,
50
+ },
51
+ {
52
+ value: 'dirtyswan',
53
+ leftIcon: featherLogo,
54
+ },
55
+ {
56
+ value: 'test value',
57
+ leftIcon: featherLogo,
58
+ },
59
+ ];
60
+ return (
61
+ <AutoSuggestInput
62
+ className="wmx5"
63
+ placeholder="Placeholder"
64
+ currentOption={currentOption}
65
+ suggestions={suggestions}
66
+ onChange={(value) => {
67
+ setCurrentOption(value);
68
+ }}
69
+ handleSuggestionSelected={(value) => {
70
+ const newSelectedOptions = [...selectedValues];
71
+ newSelectedOptions.push(value);
72
+ setSelectedValues(newSelectedOptions);
73
+ setCurrentOption(value.value);
74
+ }}
75
+ handleSuggestionFetchRequest={({ value }) => {
76
+ const filteredOptions = options.filter((option) =>
77
+ option.value.toLowerCase().startsWith(value.toLowerCase())
78
+ );
79
+ setSuggestions(filteredOptions);
80
+ }}
81
+ handleSuggestionClearRequest={() => setSuggestions([])}
82
+ />
83
+ );
84
+ };
85
+
86
+ <AutoSuggestInputStory />
87
+
88
+ ```typescript
89
+ import React, { useState } from 'react';
90
+ import { AutoSuggestInput } from '@popsure/dirty-swan';
91
+
92
+ export default () => {
93
+ const [selectedValues, setSelectedValues] = useState([]);
94
+ const [currentOption, setCurrentOption] = useState('');
95
+ const [suggestions, setSuggestions] = useState([]);
96
+ const options = [
97
+ { value: 'feather', leftIcon: featherLogo },
98
+ { value: 'feather2', leftIcon: featherLogo },
99
+ {
100
+ value: 'feather3',
101
+ leftIcon: featherLogo,
102
+ },
103
+ {
104
+ value: 'dirtyswan',
105
+ leftIcon: featherLogo,
106
+ },
107
+ {
108
+ value: 'test value',
109
+ leftIcon: featherLogo,
110
+ },
111
+ ];
112
+ return (
113
+ <AutoSuggestInput
114
+ className="wmx5"
115
+ placeholder="Placeholder"
116
+ currentOption={currentOption}
117
+ suggestions={suggestions}
118
+ onChange={(value) => {
119
+ setCurrentOption(value);
120
+ }}
121
+ handleSuggestionSelected={(value) => {
122
+ const newSelectedOptions = [...selectedValues];
123
+ newSelectedOptions.push(value);
124
+ setSelectedValues(newSelectedOptions);
125
+ setCurrentOption(value.value);
126
+ }}
127
+ handleSuggestionFetchRequest={({ value }) => {
128
+ const filteredOptions = options.filter((option) =>
129
+ option.value.toLowerCase().startsWith(value.toLowerCase())
130
+ );
131
+ setSuggestions(filteredOptions);
132
+ }}
133
+ handleSuggestionClearRequest={() => setSuggestions([])}
134
+ />
135
+ );
136
+ };
137
+ ```