@transferwise/components 0.0.0-experimental-9d9138b → 0.0.0-experimental-1fc511d

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/build/button/LegacyButton.js +0 -2
  2. package/build/button/LegacyButton.js.map +1 -1
  3. package/build/button/LegacyButton.mjs +0 -2
  4. package/build/button/LegacyButton.mjs.map +1 -1
  5. package/build/carousel/Carousel.js +1 -3
  6. package/build/carousel/Carousel.js.map +1 -1
  7. package/build/carousel/Carousel.mjs +1 -3
  8. package/build/carousel/Carousel.mjs.map +1 -1
  9. package/build/checkbox/Checkbox.js.map +1 -1
  10. package/build/checkbox/Checkbox.mjs.map +1 -1
  11. package/build/checkboxButton/CheckboxButton.js +1 -1
  12. package/build/checkboxButton/CheckboxButton.js.map +1 -1
  13. package/build/checkboxButton/CheckboxButton.mjs +1 -1
  14. package/build/checkboxButton/CheckboxButton.mjs.map +1 -1
  15. package/build/checkboxOption/CheckboxOption.js.map +1 -1
  16. package/build/checkboxOption/CheckboxOption.mjs.map +1 -1
  17. package/build/common/bottomSheet/BottomSheet.js.map +1 -1
  18. package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
  19. package/build/common/dateUtils/isDateValid/isDateValid.js +3 -3
  20. package/build/common/dateUtils/isDateValid/isDateValid.js.map +1 -1
  21. package/build/common/dateUtils/isDateValid/isDateValid.mjs +3 -3
  22. package/build/common/dateUtils/isDateValid/isDateValid.mjs.map +1 -1
  23. package/build/common/panel/Panel.js +3 -8
  24. package/build/common/panel/Panel.js.map +1 -1
  25. package/build/common/panel/Panel.mjs +3 -8
  26. package/build/common/panel/Panel.mjs.map +1 -1
  27. package/build/dateLookup/dateHeader/DateHeader.js +27 -22
  28. package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
  29. package/build/dateLookup/dateHeader/DateHeader.mjs +27 -22
  30. package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
  31. package/build/dimmer/dimmerManager/DimmerManager.js.map +1 -1
  32. package/build/dimmer/dimmerManager/DimmerManager.mjs.map +1 -1
  33. package/build/dropFade/DropFade.js.map +1 -1
  34. package/build/dropFade/DropFade.mjs.map +1 -1
  35. package/build/emphasis/EmphasisHtmlTransformer.js.map +1 -1
  36. package/build/emphasis/EmphasisHtmlTransformer.mjs.map +1 -1
  37. package/build/i18n/cs.json +22 -5
  38. package/build/i18n/cs.json.js +22 -5
  39. package/build/i18n/cs.json.js.map +1 -1
  40. package/build/i18n/cs.json.mjs +22 -5
  41. package/build/i18n/cs.json.mjs.map +1 -1
  42. package/build/i18n/nl.json +73 -0
  43. package/build/index.js +0 -1
  44. package/build/index.js.map +1 -1
  45. package/build/index.mjs +1 -1
  46. package/build/info/Info.js +7 -13
  47. package/build/info/Info.js.map +1 -1
  48. package/build/info/Info.mjs +7 -13
  49. package/build/info/Info.mjs.map +1 -1
  50. package/build/inputs/Input.js +1 -3
  51. package/build/inputs/Input.js.map +1 -1
  52. package/build/inputs/Input.mjs +1 -3
  53. package/build/inputs/Input.mjs.map +1 -1
  54. package/build/inputs/SelectInput.js +1 -3
  55. package/build/inputs/SelectInput.js.map +1 -1
  56. package/build/inputs/SelectInput.mjs +1 -3
  57. package/build/inputs/SelectInput.mjs.map +1 -1
  58. package/build/inputs/_ButtonInput.js +1 -3
  59. package/build/inputs/_ButtonInput.js.map +1 -1
  60. package/build/inputs/_ButtonInput.mjs +1 -3
  61. package/build/inputs/_ButtonInput.mjs.map +1 -1
  62. package/build/inputs/_Popover.js +1 -3
  63. package/build/inputs/_Popover.js.map +1 -1
  64. package/build/inputs/_Popover.mjs +1 -3
  65. package/build/inputs/_Popover.mjs.map +1 -1
  66. package/build/main.css +2 -119
  67. package/build/moneyInput/currencyFormatting.js +2 -2
  68. package/build/moneyInput/currencyFormatting.js.map +1 -1
  69. package/build/moneyInput/currencyFormatting.mjs +2 -2
  70. package/build/moneyInput/currencyFormatting.mjs.map +1 -1
  71. package/build/nudge/Nudge.js +0 -2
  72. package/build/nudge/Nudge.js.map +1 -1
  73. package/build/nudge/Nudge.mjs +0 -2
  74. package/build/nudge/Nudge.mjs.map +1 -1
  75. package/build/promoCard/PromoCardContext.js +0 -1
  76. package/build/promoCard/PromoCardContext.js.map +1 -1
  77. package/build/promoCard/PromoCardContext.mjs +0 -1
  78. package/build/promoCard/PromoCardContext.mjs.map +1 -1
  79. package/build/promoCard/PromoCardGroup.js +0 -1
  80. package/build/promoCard/PromoCardGroup.js.map +1 -1
  81. package/build/promoCard/PromoCardGroup.mjs +0 -1
  82. package/build/promoCard/PromoCardGroup.mjs.map +1 -1
  83. package/build/select/Select.js +19 -25
  84. package/build/select/Select.js.map +1 -1
  85. package/build/select/Select.mjs +19 -25
  86. package/build/select/Select.mjs.map +1 -1
  87. package/build/styles/button/Button.css +2 -2
  88. package/build/styles/dateLookup/DateLookup.css +0 -5
  89. package/build/styles/info/Info.css +0 -23
  90. package/build/styles/main.css +2 -119
  91. package/build/table/Table.js +1 -3
  92. package/build/table/Table.js.map +1 -1
  93. package/build/table/Table.mjs +1 -3
  94. package/build/table/Table.mjs.map +1 -1
  95. package/build/tooltip/Tooltip.js +2 -6
  96. package/build/tooltip/Tooltip.js.map +1 -1
  97. package/build/tooltip/Tooltip.mjs +2 -6
  98. package/build/tooltip/Tooltip.mjs.map +1 -1
  99. package/build/types/button/LegacyButton.d.ts.map +1 -1
  100. package/build/types/carousel/Carousel.d.ts.map +1 -1
  101. package/build/types/checkbox/Checkbox.d.ts.map +1 -1
  102. package/build/types/checkboxOption/CheckboxOption.d.ts +1 -2
  103. package/build/types/checkboxOption/CheckboxOption.d.ts.map +1 -1
  104. package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
  105. package/build/types/common/dateUtils/isDateValid/isDateValid.d.ts.map +1 -1
  106. package/build/types/common/panel/Panel.d.ts.map +1 -1
  107. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
  108. package/build/types/dimmer/dimmerManager/DimmerManager.d.ts +1 -1
  109. package/build/types/dimmer/dimmerManager/DimmerManager.d.ts.map +1 -1
  110. package/build/types/dropFade/DropFade.d.ts.map +1 -1
  111. package/build/types/emphasis/EmphasisHtmlTransformer.d.ts +2 -2
  112. package/build/types/emphasis/EmphasisHtmlTransformer.d.ts.map +1 -1
  113. package/build/types/index.d.ts +0 -2
  114. package/build/types/index.d.ts.map +1 -1
  115. package/build/types/info/Info.d.ts.map +1 -1
  116. package/build/types/inputs/Input.d.ts.map +1 -1
  117. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  118. package/build/types/inputs/_ButtonInput.d.ts.map +1 -1
  119. package/build/types/inputs/_Popover.d.ts.map +1 -1
  120. package/build/types/nudge/Nudge.d.ts.map +1 -1
  121. package/build/types/promoCard/PromoCardContext.d.ts.map +1 -1
  122. package/build/types/promoCard/PromoCardGroup.d.ts.map +1 -1
  123. package/build/types/select/Select.d.ts.map +1 -1
  124. package/build/types/table/Table.d.ts.map +1 -1
  125. package/build/types/tooltip/Tooltip.d.ts.map +1 -1
  126. package/build/types/upload/Upload.d.ts.map +1 -1
  127. package/build/upload/Upload.js +3 -1
  128. package/build/upload/Upload.js.map +1 -1
  129. package/build/upload/Upload.mjs +3 -1
  130. package/build/upload/Upload.mjs.map +1 -1
  131. package/package.json +11 -9
  132. package/src/accordion/Accordion.story.tsx +2 -2
  133. package/src/accordion/AccordionItem/__snapshots__/AccordionItem.spec.js.snap +6 -2
  134. package/src/alert/Alert.story.tsx +2 -2
  135. package/src/alert/Alert.tests.story.tsx +1 -1
  136. package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +12 -4
  137. package/src/button/Button.css +2 -2
  138. package/src/button/Button.less +2 -2
  139. package/src/button/LegacyButton.tsx +0 -2
  140. package/src/carousel/Carousel.spec.tsx +0 -4
  141. package/src/carousel/Carousel.tsx +0 -1
  142. package/src/checkbox/Checkbox.tsx +0 -1
  143. package/src/checkboxButton/CheckboxButton.story.tsx +0 -2
  144. package/src/checkboxButton/CheckboxButton.tsx +1 -1
  145. package/src/checkboxOption/CheckboxOption.tsx +1 -2
  146. package/src/chips/__snapshots__/Chips.spec.tsx.snap +1 -1
  147. package/src/common/bottomSheet/BottomSheet.spec.tsx +0 -1
  148. package/src/common/bottomSheet/BottomSheet.story.tsx +1 -1
  149. package/src/common/bottomSheet/BottomSheet.tsx +0 -1
  150. package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +1 -1
  151. package/src/common/closeButton/__snapshots__/CloseButton.spec.tsx.snap +1 -1
  152. package/src/common/dateUtils/isDateValid/isDateValid.ts +5 -3
  153. package/src/common/hooks/useHasIntersected/useHasIntersected.spec.js +0 -2
  154. package/src/common/panel/Panel.tsx +2 -13
  155. package/src/dateLookup/DateLookup.css +0 -5
  156. package/src/dateLookup/DateLookup.less +0 -4
  157. package/src/dateLookup/dateHeader/DateHeader.tsx +24 -26
  158. package/src/dimmer/Dimmer.story.tsx +0 -1
  159. package/src/dimmer/dimmerManager/DimmerManager.ts +1 -1
  160. package/src/display/Display.story.tsx +0 -2
  161. package/src/dropFade/DropFade.story.tsx +0 -1
  162. package/src/dropFade/DropFade.tsx +0 -1
  163. package/src/emphasis/EmphasisHtmlTransformer.spec.tsx +4 -4
  164. package/src/emphasis/EmphasisHtmlTransformer.ts +2 -2
  165. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +5 -3
  166. package/src/i18n/cs.json +22 -5
  167. package/src/i18n/nl.json +73 -0
  168. package/src/index.ts +0 -2
  169. package/src/info/Info.css +0 -23
  170. package/src/info/Info.less +0 -28
  171. package/src/info/Info.tsx +8 -14
  172. package/src/inputs/Input.tsx +0 -1
  173. package/src/inputs/SelectInput.tsx +1 -7
  174. package/src/inputs/_ButtonInput.tsx +0 -1
  175. package/src/inputs/_Popover.tsx +0 -1
  176. package/src/link/Link.story.tsx +0 -1
  177. package/src/listItem/ListItem.story.tsx +4 -11
  178. package/src/main.css +2 -119
  179. package/src/main.less +0 -1
  180. package/src/markdown/Markdown.spec.tsx +0 -1
  181. package/src/modal/Modal.story.tsx +1 -1
  182. package/src/moneyInput/currencyFormatting.ts +3 -3
  183. package/src/nudge/Nudge.tsx +0 -2
  184. package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +1 -1
  185. package/src/promoCard/PromoCardContext.tsx +0 -1
  186. package/src/promoCard/PromoCardGroup.story.tsx +3 -15
  187. package/src/promoCard/PromoCardGroup.tsx +0 -1
  188. package/src/provider/theme/ThemeProvider.story.tsx +3 -5
  189. package/src/select/Select.spec.tsx +0 -1
  190. package/src/select/Select.tsx +0 -3
  191. package/src/select/option/Option.spec.js +2 -2
  192. package/src/selectOption/SelectOption.story.tsx +1 -2
  193. package/src/table/Table.tsx +0 -1
  194. package/src/test-utils/jest.setup.ts +0 -1
  195. package/src/tooltip/Tooltip.tsx +0 -2
  196. package/src/upload/Upload.spec.tsx +293 -0
  197. package/src/upload/Upload.tsx +5 -1
  198. package/src/upload/steps/completeStep/completeStep.spec.tsx +51 -0
  199. package/src/upload/steps/processingStep/processingStep.spec.tsx +59 -0
  200. package/src/upload/steps/uploadImageStep/uploadImageStep.spec.tsx +79 -0
  201. package/build/styles/item/Item.css +0 -89
  202. package/build/types/item/Item.d.ts +0 -46
  203. package/build/types/item/Item.d.ts.map +0 -1
  204. package/build/types/item/ItemAdditionalInfo.d.ts +0 -7
  205. package/build/types/item/ItemAdditionalInfo.d.ts.map +0 -1
  206. package/build/types/item/ItemCheckbox.d.ts +0 -4
  207. package/build/types/item/ItemCheckbox.d.ts.map +0 -1
  208. package/build/types/item/ItemIconButton.d.ts +0 -4
  209. package/build/types/item/ItemIconButton.d.ts.map +0 -1
  210. package/build/types/item/ItemImage.d.ts +0 -4
  211. package/build/types/item/ItemImage.d.ts.map +0 -1
  212. package/build/types/item/ItemNavigation.d.ts +0 -4
  213. package/build/types/item/ItemNavigation.d.ts.map +0 -1
  214. package/build/types/item/index.d.ts +0 -5
  215. package/build/types/item/index.d.ts.map +0 -1
  216. package/src/item/Item.css +0 -89
  217. package/src/item/Item.less +0 -95
  218. package/src/item/Item.story.tsx +0 -51
  219. package/src/item/Item.tsx +0 -163
  220. package/src/item/ItemAdditionalInfo.tsx +0 -14
  221. package/src/item/ItemCheckbox.tsx +0 -16
  222. package/src/item/ItemIconButton.tsx +0 -15
  223. package/src/item/ItemImage.tsx +0 -11
  224. package/src/item/ItemNavigation.tsx +0 -16
  225. package/src/item/index.ts +0 -4
  226. package/src/upload/Upload.events.spec.js +0 -49
  227. package/src/upload/Upload.spec.js +0 -305
  228. package/src/upload/steps/completeStep/completeStep.spec.js +0 -51
  229. package/src/upload/steps/processingStep/processingStep.spec.js +0 -55
  230. package/src/upload/steps/uploadImageStep/uploadImageStep.spec.js +0 -91
@@ -1 +0,0 @@
1
- {"version":3,"file":"ItemNavigation.d.ts","sourceRoot":"","sources":["../../../src/item/ItemNavigation.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIrD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,CAAC;AAExE,eAAO,MAAM,UAAU,gBAAoC,mBAAmB,gCAQ7E,CAAC"}
@@ -1,5 +0,0 @@
1
- export type { Props as ItemProps } from './Item';
2
- export type { ItemAdditionalInfoProps } from './ItemAdditionalInfo';
3
- export type { ItemCheckboxProps } from './ItemCheckbox';
4
- export { default } from './Item';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/item/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAC;AACjD,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC"}
package/src/item/Item.css DELETED
@@ -1,89 +0,0 @@
1
- .item {
2
- padding: 16px;
3
- border-radius: 24px;
4
- border-radius: var(--radius-large);
5
- background-color: #ffffff;
6
- background-color: var(--color-background-screen);
7
- display: flex;
8
- gap: 16px;
9
- align-items: center;
10
- flex-direction: row;
11
- cursor: pointer;
12
- }
13
- .item.NonInteractive {
14
- cursor: default;
15
- }
16
- .item:disabled {
17
- opacity: 0.45;
18
- mix-blend-mode: luminosity;
19
- }
20
- .item:hover {
21
- background-color: var(--color-background-screen-hover);
22
- }
23
- .item:active {
24
- background-color: var(--color-background-screen-active);
25
- }
26
- .item.active {
27
- background-color: rgba(134,167,189,0.10196);
28
- background-color: var(--color-background-neutral);
29
- }
30
- .item.active:hover {
31
- background-color: var(--color-background-neutral-hover);
32
- }
33
- .item.active:active {
34
- background-color: var(--color-background-neutral-active);
35
- }
36
- .item.inactive {
37
- background-color: rgba(134, 167, 189, 0.025);
38
- border: 1px dashed rgba(0,0,0,0.10196);
39
- border: 1px dashed var(--color-border-neutral);
40
- }
41
- @supports (color: color-mix(in lch, red, blue)) {
42
- .item.inactive {
43
- background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
44
- }
45
- }
46
- .item.inactive:hover {
47
- background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
48
- }
49
- .item.inactive:active {
50
- background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
51
- }
52
- .item-media {
53
- flex: 0 0 auto;
54
- align-items: flex-start;
55
- }
56
- .startValue {
57
- flex: 1;
58
- }
59
- .endValue {
60
- flex: 1;
61
- text-align: end;
62
- }
63
- .endValue.positive {
64
- color: var(--color-sentiment-positive) !important;
65
- }
66
- .endValue.negative {
67
- color: var(--color-sentiment-negative) !important;
68
- }
69
- .endValue.positive .item-title {
70
- color: var(--color-sentiment-positive) !important;
71
- }
72
- .endValue.negative .item-title {
73
- color: var(--color-sentiment-negative) !important;
74
- }
75
- .endValue.strikethrough {
76
- -webkit-text-decoration: line-through;
77
- text-decoration: line-through;
78
- }
79
- .item-title {
80
- color: #37517e;
81
- color: var(--color-content-primary);
82
- }
83
- .item-additionalInfo {
84
- color: #768e9c;
85
- color: var(--color-content-tertiary);
86
- }
87
- .item-action {
88
- flex: 0 0 auto;
89
- }
@@ -1,95 +0,0 @@
1
- .item {
2
- padding: 16px;
3
- border-radius: var(--radius-large);
4
- background-color: var(--color-background-screen);
5
- display: flex;
6
- gap: 16px;
7
- align-items: center;
8
- flex-direction: row;
9
- cursor: pointer;
10
-
11
- &.NonInteractive {
12
- cursor: default;
13
- }
14
-
15
- &:disabled {
16
- opacity: 0.45;
17
- mix-blend-mode: luminosity;
18
- }
19
-
20
- &:hover {
21
- background-color: var(--color-background-screen-hover);
22
- }
23
-
24
- &:active {
25
- background-color: var(--color-background-screen-active);
26
- }
27
- // spotlight - improve naming
28
- &.active {
29
- background-color: var(--color-background-neutral);
30
-
31
- &:hover {
32
- background-color: var(--color-background-neutral-hover);
33
- }
34
- &:active {
35
- background-color: var(--color-background-neutral-active);
36
- }
37
- }
38
- &.inactive {
39
- background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
40
- border: 1px dashed var(--color-border-neutral);
41
-
42
- &:hover {
43
- background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
44
- }
45
- &:active {
46
- background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
47
- }
48
- }
49
- }
50
- // all inverted logic can be way simpler
51
- .item-media {
52
- flex: 0 0 auto;
53
- align-items: flex-start;
54
- }
55
-
56
- .startValue {
57
- flex: 1;
58
- }
59
-
60
- .endValue {
61
- flex: 1;
62
- text-align: end;
63
-
64
- &.positive {
65
- color: var(--color-sentiment-positive) !important;
66
- }
67
- &.negative {
68
- color: var(--color-sentiment-negative) !important;
69
- }
70
- }
71
- .endValue.positive {
72
- .item-title {
73
- color: var(--color-sentiment-positive) !important;
74
- }
75
- }
76
- .endValue.negative {
77
- .item-title {
78
- color: var(--color-sentiment-negative) !important;
79
- }
80
- }
81
- .endValue.strikethrough {
82
- text-decoration: line-through;
83
- }
84
-
85
- .item-title {
86
- color: var(--color-content-primary)
87
- }
88
-
89
- .item-additionalInfo {
90
- color: var(--color-content-tertiary)
91
- }
92
-
93
- .item-action {
94
- flex: 0 0 auto;
95
- }
@@ -1,51 +0,0 @@
1
- import Item, { ButtonItem, Props as ItemProps } from './Item';
2
- import { Meta, StoryObj } from '@storybook/react';
3
- import React from 'react';
4
- import Button from '../button';
5
-
6
- export default {
7
- component: Item,
8
- title: 'Content/Item',
9
- } satisfies Meta<ItemProps>;
10
-
11
- type Story = StoryObj<ItemProps>;
12
-
13
- export const ItemRadio: Story = {
14
- render: () => (
15
- <div>
16
- {/* Basic */}
17
- {/* with additional info */}
18
- {/* with prompt */}
19
- {/* Disabled */}
20
- {/* Spotlight */}
21
- {/* Active */}
22
- <ButtonItem
23
- buttonProps={{
24
- v2: true,
25
- sentiment: 'negative',
26
- priority: 'secondary',
27
- onClick: () => console.log('Button clicked'),
28
- buttonText: 'Submit',
29
- }}
30
- title="Title"
31
- subtitle="Subtitle"
32
- />
33
- </div>
34
- ),
35
- };
36
-
37
- export const ItemButton: Story = {
38
- render: () => (
39
- <div>
40
- {/* Basic */}
41
- {/* with additional info */}
42
- {/* with prompt */}
43
- {/* partially interactive */}
44
- {/* Disabled */}
45
- {/* Spotlight */}
46
- {/* Active */}
47
- </div>
48
- ),
49
- };
50
-
51
- // add intaces with dark mode
package/src/item/Item.tsx DELETED
@@ -1,163 +0,0 @@
1
- import { createContext, ReactNode, useId, useMemo, useState } from 'react';
2
- import { Typography } from '../common';
3
- import Body from '../body';
4
- import { Image } from './ItemImage';
5
- import { AdditionalInfo } from './ItemAdditionalInfo';
6
- import { IconButton } from './ItemIconButton';
7
- import { Checkbox } from './ItemCheckbox';
8
- import { Navigation } from './ItemNavigation';
9
- import Button, { NewButtonProps as ButtonProps } from '../button';
10
-
11
- export type ItemTypes =
12
- | 'none'
13
- | 'navigation'
14
- | 'radio'
15
- | 'checkbox'
16
- | 'switch'
17
- | 'button'
18
- | 'icon-button';
19
-
20
- export type Props = {
21
- as?: 'li' | 'div' | 'span';
22
- inverted?: boolean;
23
- disabled?: boolean;
24
- partialInteractivity?: boolean;
25
- spotlight?: 'active' | 'inactive';
26
- title: ReactNode;
27
- subtitle?: ReactNode;
28
- additionalInfo?: ReactNode;
29
- valueTitle?: ReactNode;
30
- valueSubtitle?: ReactNode;
31
- media?: ReactNode;
32
- control?: ReactNode;
33
- prompt?: ReactNode;
34
- };
35
-
36
- export type ItemContextData = {
37
- setControlType: (type: ItemTypes) => void;
38
- ids?: {
39
- label: string;
40
- additionalInfo: string;
41
- value: string;
42
- control: string;
43
- prompt: string;
44
- };
45
- props: Pick<Props, 'as' | 'disabled' | 'inverted'>;
46
- };
47
-
48
- // @ts-expect-error for now let's mock it with `null` value
49
- // but actually by default we should specify `setControlType('none')`
50
- export const ItemContext = createContext<ItemContextData>(null);
51
-
52
- export const Item = ({
53
- as: View = 'li',
54
- title,
55
- subtitle,
56
- additionalInfo,
57
- prompt,
58
- inverted,
59
- media,
60
- spotlight,
61
- valueTitle,
62
- valueSubtitle,
63
- control,
64
- disabled,
65
- }: Props) => {
66
- /*
67
- const returnType = (): ReactNode => {
68
- switch (type) {
69
- case 'Navigation':
70
- return <Chevron orientation={Position.RIGHT} disabled />;
71
- case 'Radio':
72
- return <RadioButton name="Hello" checked />;
73
- case 'Checkbox':
74
- return <CheckboxButton name="Hello" checked />;
75
- case 'Switch':
76
- return <Switch onClick={() => console.log('clicked')} />;
77
- case 'Button':
78
- return <Button v2>Hello</Button>;
79
- case 'IconButton':
80
- return (
81
- <IconButton size={40} priority="minimal">
82
- <InfoCircle />
83
- </IconButton>
84
- );
85
- case 'NonInteractive':
86
- default:
87
- return <></>;
88
- }
89
- };
90
- */
91
- const idPrefix = useId();
92
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
93
- const [controlType, setControlType] = useState<ItemTypes>();
94
- const ids = {
95
- label: `${idPrefix}_label`,
96
- value: `${idPrefix}_value`,
97
- control: `${idPrefix}_control`,
98
- prompt: `${idPrefix}_prompt`,
99
- additionalInfo: `${idPrefix}_additional-info`,
100
- };
101
-
102
- const itemCtx = useMemo(
103
- () => ({ setControlType, ids, props: { as: View, disabled, inverted } }),
104
- [],
105
- );
106
-
107
- return (
108
- <ItemContext.Provider value={itemCtx}>
109
- <View className={`item ${inverted ? 'inverted' : ''} ${spotlight ?? ''}`}>
110
- {media && <div className="item-media">{media}</div>}
111
- <div className="startValue">
112
- <Body
113
- className={inverted ? '' : 'item-title'}
114
- type={inverted ? Typography.BODY_DEFAULT : Typography.BODY_LARGE_BOLD}
115
- >
116
- {title}
117
- </Body>
118
- <Body
119
- className={inverted ? 'item-title' : ''}
120
- type={inverted ? Typography.BODY_LARGE_BOLD : Typography.BODY_DEFAULT}
121
- >
122
- {subtitle}
123
- </Body>
124
- {additionalInfo}
125
- {prompt}
126
- </div>
127
- {(valueTitle || valueSubtitle) && (
128
- <div id={ids.value} className="item-value">
129
- <Body type={inverted ? Typography.BODY_DEFAULT : Typography.BODY_LARGE_BOLD}>
130
- {valueTitle}
131
- </Body>
132
- <Body type={inverted ? Typography.BODY_LARGE_BOLD : Typography.BODY_DEFAULT}>
133
- {valueSubtitle}
134
- </Body>
135
- </div>
136
- )}
137
- <Body className="item-action">{control}</Body>
138
- </View>
139
- </ItemContext.Provider>
140
- );
141
- };
142
-
143
- export type ItemWithButtonProps = Omit<Props, 'control'> & {
144
- buttonProps: ButtonProps & {
145
- buttonText: string;
146
- };
147
- };
148
-
149
- export const ButtonItem = ({ buttonProps, ...itemProps }: ItemWithButtonProps): JSX.Element => {
150
- return (
151
- <Item {...itemProps} control={<Button {...buttonProps}>{buttonProps.buttonText}</Button>} />
152
- );
153
- };
154
-
155
- /* eslint-disable functional/immutable-data */
156
- Item.Image = Image;
157
- Item.AdditionalInfo = AdditionalInfo;
158
- Item.Checkbox = Checkbox;
159
- Item.IconButton = IconButton;
160
- Item.Navigation = Navigation;
161
- /* eslint-enable functional/immutable-data */
162
-
163
- export default Item;
@@ -1,14 +0,0 @@
1
- import { PropsWithChildren, ReactNode, useContext, useEffect } from 'react';
2
- import Item, { ItemContext, ItemContextData } from './Item';
3
- import Body from '../body';
4
- import { LinkProps } from '../link';
5
-
6
- export type ItemAdditionalInfoProps = PropsWithChildren<{
7
- action: Pick<LinkProps, 'href' | 'onClick' | 'target'>;
8
- }>;
9
-
10
- export const AdditionalInfo = function ({ children, action }: ItemAdditionalInfoProps) {
11
- const { ids, props: baseItemProps } = useContext<ItemContextData>(ItemContext);
12
-
13
- return <Body id={ids?.additionalInfo}>{children}</Body>;
14
- };
@@ -1,16 +0,0 @@
1
- import { useContext, useEffect } from 'react';
2
- import CheckboxButton from '../checkboxButton';
3
- import { CheckboxButtonProps } from '../checkboxButton/CheckboxButton';
4
- import { ItemContext, ItemContextData } from './Item';
5
-
6
- export type ItemCheckboxProps = Pick<CheckboxButtonProps, 'checked' | 'indeterminate' | 'onChange'>;
7
-
8
- export const Checkbox = function (props: ItemCheckboxProps) {
9
- const { setControlType, props: baseItemProps } = useContext<ItemContextData>(ItemContext);
10
-
11
- useEffect(() => {
12
- setControlType('checkbox');
13
- }, []);
14
-
15
- return <CheckboxButton disabled={baseItemProps.disabled} {...props} />;
16
- };
@@ -1,15 +0,0 @@
1
- import { useContext, useEffect } from 'react';
2
- import { default as IconButtonComp, IconButtonProps } from '../iconButton';
3
- import { ItemContext, ItemContextData } from './Item';
4
-
5
- export type ItemIconButtonProps = Pick<IconButtonProps, 'onClick' | 'href' | 'target'>;
6
-
7
- export const IconButton = function (props: ItemIconButtonProps) {
8
- const { setControlType } = useContext<ItemContextData>(ItemContext);
9
-
10
- useEffect(() => {
11
- setControlType('icon-button');
12
- }, []);
13
-
14
- return <IconButtonComp {...props} size={32} />;
15
- };
@@ -1,11 +0,0 @@
1
- import { useContext, useEffect } from 'react';
2
- import Item, { ItemContext, ItemContextData } from './Item';
3
- import { default as Img, ImageProps } from '../image/Image';
4
-
5
- export type ItemImageProps = Pick<ImageProps, 'src' | 'alt'>;
6
-
7
- export const Image = function (props: ItemImageProps) {
8
- const { ids, props: baseItemProps } = useContext<ItemContextData>(ItemContext);
9
-
10
- return <Img {...props} />;
11
- };
@@ -1,16 +0,0 @@
1
- import { ChevronRight, BillSplit as Disabled } from '@transferwise/icons';
2
- import { ButtonProps } from '../button/Button.types';
3
- import Item, { ItemContext, ItemContextData } from './Item';
4
- import { useContext, useEffect } from 'react';
5
-
6
- export type ItemNavigationProps = Pick<ButtonProps, 'onClick' | 'href'>;
7
-
8
- export const Navigation = function Navigation({ onClick }: ItemNavigationProps) {
9
- const { setControlType, props: baseItemProps } = useContext<ItemContextData>(ItemContext);
10
-
11
- useEffect(() => {
12
- setControlType('navigation');
13
- }, []);
14
-
15
- return baseItemProps?.disabled ? <Disabled size={24} /> : <ChevronRight size={24} />;
16
- };
package/src/item/index.ts DELETED
@@ -1,4 +0,0 @@
1
- export type { Props as ItemProps } from './Item';
2
- export type { ItemAdditionalInfoProps } from './ItemAdditionalInfo';
3
- export type { ItemCheckboxProps } from './ItemCheckbox';
4
- export { default } from './Item';
@@ -1,49 +0,0 @@
1
- import { shallow } from 'enzyme';
2
-
3
- import Upload from '.';
4
-
5
- const defaultLocale = 'en-GB';
6
- jest.mock('react-intl', () => ({
7
- injectIntl: (Component) =>
8
- function (props) {
9
- return (
10
- <Component {...props} intl={{ locale: defaultLocale, formatMessage: (id) => `${id}` }} />
11
- );
12
- },
13
- defineMessages: (translations) => translations,
14
- }));
15
-
16
- describe('Upload (events)', () => {
17
- let component;
18
- const props = {
19
- onCancel: jest.fn(),
20
- onChange: jest.fn(),
21
- onFailure: jest.fn(),
22
- onStart: jest.fn(),
23
- onSuccess: jest.fn(),
24
- };
25
-
26
- describe('on shallow', () => {
27
- beforeEach(() => {
28
- component = shallow(<Upload {...props} />).dive();
29
- jest.restoreAllMocks();
30
- });
31
-
32
- it('increments dragCounter on dragenter', () => {
33
- component.find('.droppable').simulate('dragenter', new Event('event'));
34
- expect(component.instance().dragCounter).toStrictEqual(1);
35
- });
36
-
37
- it('decrements dragCounter on dragleave', () => {
38
- component.find('.droppable').simulate('dragleave', new Event('event'));
39
- expect(component.instance().dragCounter).toStrictEqual(-1);
40
- });
41
-
42
- it('reset dragCounter on drop', () => {
43
- component.find('.droppable').simulate('dragenter', new Event('event'));
44
- expect(component.instance().dragCounter).toStrictEqual(1);
45
- component.find('.droppable').simulate('drop', new Event('event'));
46
- expect(component.instance().dragCounter).toStrictEqual(0);
47
- });
48
- });
49
- });