@transferwise/components 0.0.0-experimental-751dc12 → 0.0.0-experimental-4341b9c

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 (318) hide show
  1. package/build/button/Button.js +0 -1
  2. package/build/button/Button.js.map +1 -1
  3. package/build/button/Button.mjs +0 -1
  4. package/build/button/Button.mjs.map +1 -1
  5. package/build/common/RadioButton/RadioButton.js +2 -5
  6. package/build/common/RadioButton/RadioButton.js.map +1 -1
  7. package/build/common/RadioButton/RadioButton.mjs +2 -5
  8. package/build/common/RadioButton/RadioButton.mjs.map +1 -1
  9. package/build/common/initials.js +4 -1
  10. package/build/common/initials.js.map +1 -1
  11. package/build/common/initials.mjs +4 -1
  12. package/build/common/initials.mjs.map +1 -1
  13. package/build/i18n/de.json +2 -0
  14. package/build/i18n/de.json.js +2 -0
  15. package/build/i18n/de.json.js.map +1 -1
  16. package/build/i18n/de.json.mjs +2 -0
  17. package/build/i18n/de.json.mjs.map +1 -1
  18. package/build/i18n/fr.json +2 -0
  19. package/build/i18n/fr.json.js +2 -0
  20. package/build/i18n/fr.json.js.map +1 -1
  21. package/build/i18n/fr.json.mjs +2 -0
  22. package/build/i18n/fr.json.mjs.map +1 -1
  23. package/build/i18n/hu.json +2 -0
  24. package/build/i18n/hu.json.js +2 -0
  25. package/build/i18n/hu.json.js.map +1 -1
  26. package/build/i18n/hu.json.mjs +2 -0
  27. package/build/i18n/hu.json.mjs.map +1 -1
  28. package/build/i18n/it.json +2 -0
  29. package/build/i18n/it.json.js +2 -0
  30. package/build/i18n/it.json.js.map +1 -1
  31. package/build/i18n/it.json.mjs +2 -0
  32. package/build/i18n/it.json.mjs.map +1 -1
  33. package/build/i18n/ja.json +2 -0
  34. package/build/i18n/ja.json.js +2 -0
  35. package/build/i18n/ja.json.js.map +1 -1
  36. package/build/i18n/ja.json.mjs +2 -0
  37. package/build/i18n/ja.json.mjs.map +1 -1
  38. package/build/i18n/pl.json +2 -0
  39. package/build/i18n/pl.json.js +2 -0
  40. package/build/i18n/pl.json.js.map +1 -1
  41. package/build/i18n/pl.json.mjs +2 -0
  42. package/build/i18n/pl.json.mjs.map +1 -1
  43. package/build/i18n/pt.json +2 -0
  44. package/build/i18n/pt.json.js +2 -0
  45. package/build/i18n/pt.json.js.map +1 -1
  46. package/build/i18n/pt.json.mjs +2 -0
  47. package/build/i18n/pt.json.mjs.map +1 -1
  48. package/build/i18n/ro.json +2 -0
  49. package/build/i18n/ro.json.js +2 -0
  50. package/build/i18n/ro.json.js.map +1 -1
  51. package/build/i18n/ro.json.mjs +2 -0
  52. package/build/i18n/ro.json.mjs.map +1 -1
  53. package/build/i18n/ru.json +2 -0
  54. package/build/i18n/ru.json.js +2 -0
  55. package/build/i18n/ru.json.js.map +1 -1
  56. package/build/i18n/ru.json.mjs +2 -0
  57. package/build/i18n/ru.json.mjs.map +1 -1
  58. package/build/i18n/tr.json +2 -0
  59. package/build/i18n/tr.json.js +2 -0
  60. package/build/i18n/tr.json.js.map +1 -1
  61. package/build/i18n/tr.json.mjs +2 -0
  62. package/build/i18n/tr.json.mjs.map +1 -1
  63. package/build/i18n/zh-CN.json +2 -0
  64. package/build/i18n/zh-CN.json.js +2 -0
  65. package/build/i18n/zh-CN.json.js.map +1 -1
  66. package/build/i18n/zh-CN.json.mjs +2 -0
  67. package/build/i18n/zh-CN.json.mjs.map +1 -1
  68. package/build/i18n/zh-HK.json +2 -0
  69. package/build/i18n/zh-HK.json.js +2 -0
  70. package/build/i18n/zh-HK.json.js.map +1 -1
  71. package/build/i18n/zh-HK.json.mjs +2 -0
  72. package/build/i18n/zh-HK.json.mjs.map +1 -1
  73. package/build/iconButton/IconButton.js.map +1 -1
  74. package/build/iconButton/IconButton.mjs.map +1 -1
  75. package/build/image/Image.js.map +1 -1
  76. package/build/image/Image.mjs.map +1 -1
  77. package/build/index.js +0 -2
  78. package/build/index.js.map +1 -1
  79. package/build/index.mjs +0 -1
  80. package/build/index.mjs.map +1 -1
  81. package/build/main.css +0 -709
  82. package/build/styles/main.css +0 -709
  83. package/build/switch/Switch.js +0 -2
  84. package/build/switch/Switch.js.map +1 -1
  85. package/build/switch/Switch.mjs +0 -2
  86. package/build/switch/Switch.mjs.map +1 -1
  87. package/build/types/button/Button.d.ts.map +1 -1
  88. package/build/types/button/Button.types.d.ts +1 -1
  89. package/build/types/button/Button.types.d.ts.map +1 -1
  90. package/build/types/button/index.d.ts +1 -1
  91. package/build/types/button/index.d.ts.map +1 -1
  92. package/build/types/common/RadioButton/RadioButton.d.ts +1 -3
  93. package/build/types/common/RadioButton/RadioButton.d.ts.map +1 -1
  94. package/build/types/common/initials.d.ts.map +1 -1
  95. package/build/types/iconButton/IconButton.d.ts +2 -2
  96. package/build/types/iconButton/IconButton.d.ts.map +1 -1
  97. package/build/types/image/Image.d.ts +0 -3
  98. package/build/types/image/Image.d.ts.map +1 -1
  99. package/build/types/image/index.d.ts +0 -1
  100. package/build/types/image/index.d.ts.map +1 -1
  101. package/build/types/index.d.ts +0 -2
  102. package/build/types/index.d.ts.map +1 -1
  103. package/build/types/switch/Switch.d.ts +0 -2
  104. package/build/types/switch/Switch.d.ts.map +1 -1
  105. package/package.json +1 -1
  106. package/src/button/Button.spec.tsx +0 -18
  107. package/src/button/Button.tsx +1 -5
  108. package/src/button/Button.types.ts +1 -1
  109. package/src/button/index.ts +1 -1
  110. package/src/checkboxButton/CheckboxButton.story.tsx +4 -4
  111. package/src/common/RadioButton/RadioButton.tsx +1 -6
  112. package/src/common/initials.spec.tsx +13 -0
  113. package/src/common/initials.ts +5 -0
  114. package/src/i18n/de.json +2 -0
  115. package/src/i18n/fr.json +2 -0
  116. package/src/i18n/hu.json +2 -0
  117. package/src/i18n/it.json +2 -0
  118. package/src/i18n/ja.json +2 -0
  119. package/src/i18n/pl.json +2 -0
  120. package/src/i18n/pt.json +2 -0
  121. package/src/i18n/ro.json +2 -0
  122. package/src/i18n/ru.json +2 -0
  123. package/src/i18n/tr.json +2 -0
  124. package/src/i18n/zh-CN.json +2 -0
  125. package/src/i18n/zh-HK.json +2 -0
  126. package/src/iconButton/IconButton.story.tsx +1 -1
  127. package/src/iconButton/IconButton.tsx +1 -1
  128. package/src/image/Image.tsx +0 -3
  129. package/src/image/index.ts +0 -1
  130. package/src/index.ts +0 -2
  131. package/src/main.css +0 -709
  132. package/src/main.less +0 -1
  133. package/src/switch/Switch.tsx +0 -4
  134. package/src/test-utils/Parameters.d.ts +77 -0
  135. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +0 -56
  136. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js.map +0 -1
  137. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +0 -54
  138. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs.map +0 -1
  139. package/build/listItem/AvatarLayout/ListItemAvatarLayout.js +0 -23
  140. package/build/listItem/AvatarLayout/ListItemAvatarLayout.js.map +0 -1
  141. package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs +0 -21
  142. package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs.map +0 -1
  143. package/build/listItem/AvatarView/ListItemAvatarView.js +0 -23
  144. package/build/listItem/AvatarView/ListItemAvatarView.js.map +0 -1
  145. package/build/listItem/AvatarView/ListItemAvatarView.mjs +0 -21
  146. package/build/listItem/AvatarView/ListItemAvatarView.mjs.map +0 -1
  147. package/build/listItem/Button/ListItemButton.js +0 -43
  148. package/build/listItem/Button/ListItemButton.js.map +0 -1
  149. package/build/listItem/Button/ListItemButton.mjs +0 -41
  150. package/build/listItem/Button/ListItemButton.mjs.map +0 -1
  151. package/build/listItem/Checkbox/ListItemCheckbox.js +0 -30
  152. package/build/listItem/Checkbox/ListItemCheckbox.js.map +0 -1
  153. package/build/listItem/Checkbox/ListItemCheckbox.mjs +0 -28
  154. package/build/listItem/Checkbox/ListItemCheckbox.mjs.map +0 -1
  155. package/build/listItem/IconButton/ListItemIconButton.js +0 -42
  156. package/build/listItem/IconButton/ListItemIconButton.js.map +0 -1
  157. package/build/listItem/IconButton/ListItemIconButton.mjs +0 -40
  158. package/build/listItem/IconButton/ListItemIconButton.mjs.map +0 -1
  159. package/build/listItem/Image/ListItemImage.js +0 -31
  160. package/build/listItem/Image/ListItemImage.js.map +0 -1
  161. package/build/listItem/Image/ListItemImage.mjs +0 -29
  162. package/build/listItem/Image/ListItemImage.mjs.map +0 -1
  163. package/build/listItem/ListItem.js +0 -308
  164. package/build/listItem/ListItem.js.map +0 -1
  165. package/build/listItem/ListItem.mjs +0 -303
  166. package/build/listItem/ListItem.mjs.map +0 -1
  167. package/build/listItem/ListItemContext.js +0 -8
  168. package/build/listItem/ListItemContext.js.map +0 -1
  169. package/build/listItem/ListItemContext.mjs +0 -6
  170. package/build/listItem/ListItemContext.mjs.map +0 -1
  171. package/build/listItem/Navigation/ListItemNavigation.js +0 -45
  172. package/build/listItem/Navigation/ListItemNavigation.js.map +0 -1
  173. package/build/listItem/Navigation/ListItemNavigation.mjs +0 -43
  174. package/build/listItem/Navigation/ListItemNavigation.mjs.map +0 -1
  175. package/build/listItem/Prompt/ListItemPrompt.js +0 -59
  176. package/build/listItem/Prompt/ListItemPrompt.js.map +0 -1
  177. package/build/listItem/Prompt/ListItemPrompt.mjs +0 -54
  178. package/build/listItem/Prompt/ListItemPrompt.mjs.map +0 -1
  179. package/build/listItem/Radio/ListItemRadio.js +0 -30
  180. package/build/listItem/Radio/ListItemRadio.js.map +0 -1
  181. package/build/listItem/Radio/ListItemRadio.mjs +0 -28
  182. package/build/listItem/Radio/ListItemRadio.mjs.map +0 -1
  183. package/build/listItem/Switch/ListItemSwitch.js +0 -30
  184. package/build/listItem/Switch/ListItemSwitch.js.map +0 -1
  185. package/build/listItem/Switch/ListItemSwitch.mjs +0 -28
  186. package/build/listItem/Switch/ListItemSwitch.mjs.map +0 -1
  187. package/build/listItem/_stories/images/landscape.svg +0 -1
  188. package/build/listItem/_stories/images/portrait.svg +0 -1
  189. package/build/listItem/useListItemControl.js +0 -22
  190. package/build/listItem/useListItemControl.js.map +0 -1
  191. package/build/listItem/useListItemControl.mjs +0 -20
  192. package/build/listItem/useListItemControl.mjs.map +0 -1
  193. package/build/listItem/useListItemMedia.js +0 -21
  194. package/build/listItem/useListItemMedia.js.map +0 -1
  195. package/build/listItem/useListItemMedia.mjs +0 -19
  196. package/build/listItem/useListItemMedia.mjs.map +0 -1
  197. package/build/styles/listItem/ListItem.css +0 -709
  198. package/build/styles/listItem/ListItem.grid.css +0 -368
  199. package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts +0 -15
  200. package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts.map +0 -1
  201. package/build/types/listItem/AdditionalInfo/index.d.ts +0 -3
  202. package/build/types/listItem/AdditionalInfo/index.d.ts.map +0 -1
  203. package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts +0 -18
  204. package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts.map +0 -1
  205. package/build/types/listItem/AvatarLayout/index.d.ts +0 -3
  206. package/build/types/listItem/AvatarLayout/index.d.ts.map +0 -1
  207. package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts +0 -16
  208. package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts.map +0 -1
  209. package/build/types/listItem/AvatarView/index.d.ts +0 -3
  210. package/build/types/listItem/AvatarView/index.d.ts.map +0 -1
  211. package/build/types/listItem/Button/ListItemButton.d.ts +0 -20
  212. package/build/types/listItem/Button/ListItemButton.d.ts.map +0 -1
  213. package/build/types/listItem/Button/index.d.ts +0 -3
  214. package/build/types/listItem/Button/index.d.ts.map +0 -1
  215. package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts +0 -14
  216. package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts.map +0 -1
  217. package/build/types/listItem/Checkbox/index.d.ts +0 -3
  218. package/build/types/listItem/Checkbox/index.d.ts.map +0 -1
  219. package/build/types/listItem/IconButton/ListItemIconButton.d.ts +0 -18
  220. package/build/types/listItem/IconButton/ListItemIconButton.d.ts.map +0 -1
  221. package/build/types/listItem/IconButton/index.d.ts +0 -3
  222. package/build/types/listItem/IconButton/index.d.ts.map +0 -1
  223. package/build/types/listItem/Image/ListItemImage.d.ts +0 -25
  224. package/build/types/listItem/Image/ListItemImage.d.ts.map +0 -1
  225. package/build/types/listItem/Image/index.d.ts +0 -3
  226. package/build/types/listItem/Image/index.d.ts.map +0 -1
  227. package/build/types/listItem/ListItem.d.ts +0 -113
  228. package/build/types/listItem/ListItem.d.ts.map +0 -1
  229. package/build/types/listItem/ListItemContext.d.ts +0 -22
  230. package/build/types/listItem/ListItemContext.d.ts.map +0 -1
  231. package/build/types/listItem/Navigation/ListItemNavigation.d.ts +0 -15
  232. package/build/types/listItem/Navigation/ListItemNavigation.d.ts.map +0 -1
  233. package/build/types/listItem/Navigation/index.d.ts +0 -3
  234. package/build/types/listItem/Navigation/index.d.ts.map +0 -1
  235. package/build/types/listItem/Prompt/ListItemPrompt.d.ts +0 -16
  236. package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +0 -1
  237. package/build/types/listItem/Prompt/index.d.ts +0 -3
  238. package/build/types/listItem/Prompt/index.d.ts.map +0 -1
  239. package/build/types/listItem/Radio/ListItemRadio.d.ts +0 -14
  240. package/build/types/listItem/Radio/ListItemRadio.d.ts.map +0 -1
  241. package/build/types/listItem/Radio/index.d.ts +0 -3
  242. package/build/types/listItem/Radio/index.d.ts.map +0 -1
  243. package/build/types/listItem/Switch/ListItemSwitch.d.ts +0 -14
  244. package/build/types/listItem/Switch/ListItemSwitch.d.ts.map +0 -1
  245. package/build/types/listItem/Switch/index.d.ts +0 -3
  246. package/build/types/listItem/Switch/index.d.ts.map +0 -1
  247. package/build/types/listItem/_stories/subcomponents.d.ts +0 -18
  248. package/build/types/listItem/_stories/subcomponents.d.ts.map +0 -1
  249. package/build/types/listItem/index.d.ts +0 -14
  250. package/build/types/listItem/index.d.ts.map +0 -1
  251. package/build/types/listItem/test-utils.d.ts +0 -7
  252. package/build/types/listItem/test-utils.d.ts.map +0 -1
  253. package/build/types/listItem/useListItemControl.d.ts +0 -5
  254. package/build/types/listItem/useListItemControl.d.ts.map +0 -1
  255. package/build/types/listItem/useListItemMedia.d.ts +0 -6
  256. package/build/types/listItem/useListItemMedia.d.ts.map +0 -1
  257. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.spec.tsx +0 -56
  258. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +0 -145
  259. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.tsx +0 -36
  260. package/src/listItem/AdditionalInfo/index.ts +0 -2
  261. package/src/listItem/AvatarLayout/ListItemAvatarLayout.spec.tsx +0 -59
  262. package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +0 -118
  263. package/src/listItem/AvatarLayout/ListItemAvatarLayout.tsx +0 -27
  264. package/src/listItem/AvatarLayout/index.ts +0 -2
  265. package/src/listItem/AvatarView/ListItemAvatarView.spec.tsx +0 -75
  266. package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +0 -318
  267. package/src/listItem/AvatarView/ListItemAvatarView.tsx +0 -27
  268. package/src/listItem/AvatarView/index.ts +0 -2
  269. package/src/listItem/Button/ListItemButton.spec.tsx +0 -68
  270. package/src/listItem/Button/ListItemButton.story.tsx +0 -408
  271. package/src/listItem/Button/ListItemButton.tsx +0 -56
  272. package/src/listItem/Button/index.ts +0 -2
  273. package/src/listItem/Checkbox/ListItemCheckbox.spec.tsx +0 -82
  274. package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +0 -107
  275. package/src/listItem/Checkbox/ListItemCheckbox.tsx +0 -33
  276. package/src/listItem/Checkbox/index.ts +0 -2
  277. package/src/listItem/IconButton/ListItemIconButton.spec.tsx +0 -119
  278. package/src/listItem/IconButton/ListItemIconButton.story.tsx +0 -236
  279. package/src/listItem/IconButton/ListItemIconButton.tsx +0 -56
  280. package/src/listItem/IconButton/index.ts +0 -2
  281. package/src/listItem/Image/ListItemImage.spec.tsx +0 -30
  282. package/src/listItem/Image/ListItemImage.story.tsx +0 -56
  283. package/src/listItem/Image/ListItemImage.tsx +0 -48
  284. package/src/listItem/Image/index.ts +0 -2
  285. package/src/listItem/ListItem.css +0 -709
  286. package/src/listItem/ListItem.grid.css +0 -368
  287. package/src/listItem/ListItem.grid.less +0 -620
  288. package/src/listItem/ListItem.less +0 -346
  289. package/src/listItem/ListItem.spec.tsx +0 -1496
  290. package/src/listItem/ListItem.tsx +0 -441
  291. package/src/listItem/ListItemContext.tsx +0 -27
  292. package/src/listItem/Navigation/ListItemNavigation.spec.tsx +0 -59
  293. package/src/listItem/Navigation/ListItemNavigation.story.tsx +0 -106
  294. package/src/listItem/Navigation/ListItemNavigation.tsx +0 -40
  295. package/src/listItem/Navigation/index.ts +0 -2
  296. package/src/listItem/Prompt/ListItemPrompt.spec.tsx +0 -36
  297. package/src/listItem/Prompt/ListItemPrompt.story.tsx +0 -201
  298. package/src/listItem/Prompt/ListItemPrompt.tsx +0 -32
  299. package/src/listItem/Prompt/index.ts +0 -2
  300. package/src/listItem/Radio/ListItemRadio.spec.tsx +0 -66
  301. package/src/listItem/Radio/ListItemRadio.story.tsx +0 -98
  302. package/src/listItem/Radio/ListItemRadio.tsx +0 -33
  303. package/src/listItem/Radio/index.ts +0 -2
  304. package/src/listItem/Switch/ListItemSwitch.spec.tsx +0 -47
  305. package/src/listItem/Switch/ListItemSwitch.story.tsx +0 -69
  306. package/src/listItem/Switch/ListItemSwitch.tsx +0 -33
  307. package/src/listItem/Switch/index.ts +0 -2
  308. package/src/listItem/_stories/ListItem.focus.test.story.tsx +0 -250
  309. package/src/listItem/_stories/ListItem.layout.test.story.tsx +0 -338
  310. package/src/listItem/_stories/ListItem.story.tsx +0 -670
  311. package/src/listItem/_stories/ListItem.variants.test.story.tsx +0 -271
  312. package/src/listItem/_stories/images/landscape.svg +0 -1
  313. package/src/listItem/_stories/images/portrait.svg +0 -1
  314. package/src/listItem/_stories/subcomponents.tsx +0 -139
  315. package/src/listItem/index.ts +0 -14
  316. package/src/listItem/test-utils.tsx +0 -33
  317. package/src/listItem/useListItemControl.tsx +0 -18
  318. package/src/listItem/useListItemMedia.tsx +0 -13
@@ -1,271 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { MultiCurrency } from '@transferwise/icons';
3
- import { storyConfig } from '../../test-utils';
4
- import Link from '../../link';
5
- import { ListItem, Props as ItemProps } from '../ListItem';
6
- import {
7
- SB_LIST_ITEM_ADDITIONAL_INFO as ADDITIONAL_INFO,
8
- SB_LIST_ITEM_CONTROLS as CONTROLS,
9
- SB_LIST_ITEM_PROMPTS as PROMPTS,
10
- type SB_ListItem_ControlType as ControlType,
11
- } from './subcomponents';
12
-
13
- export default {
14
- component: ListItem,
15
- title: 'Content/ListItem/tests/variants',
16
- tags: ['!autodocs'],
17
- parameters: {
18
- controls: { disable: true },
19
- actions: { disable: true },
20
- a11y: { disable: true },
21
- knobs: { disable: true },
22
- },
23
- } satisfies Meta<ItemProps>;
24
-
25
- type Story = StoryObj<ItemProps>;
26
- type VariantPartial = { title: string } & Partial<ItemProps>;
27
-
28
- const title = 'This is a title';
29
- const subtitle = 'And it also has a subtitle';
30
- const infoWithoutLink = (
31
- <ListItem.AdditionalInfo>Which is augmented with additional info.</ListItem.AdditionalInfo>
32
- );
33
- const infoWithLink = (
34
- <ListItem.AdditionalInfo
35
- action={{
36
- label: 'Details about the subject.',
37
- href: 'https://wise.com',
38
- target: '_blank',
39
- }}
40
- >
41
- Which is augmented with additional info.
42
- </ListItem.AdditionalInfo>
43
- );
44
-
45
- const valueTitle = '100 GBP';
46
- const valueSubtitle = '200 USD';
47
- const prompt = <ListItem.Prompt sentiment="positive">Finally, there is a prompt.</ListItem.Prompt>;
48
- const promptWithLink = (
49
- <ListItem.Prompt sentiment="positive">
50
- Finally, there is a prompt{' '}
51
- <Link href="https://wise.com" target="_blank" rel="noreferrer">
52
- referencing some details
53
- </Link>{' '}
54
- for your convenience.
55
- </ListItem.Prompt>
56
- );
57
- const media = (
58
- <ListItem.AvatarView>
59
- <MultiCurrency />
60
- </ListItem.AvatarView>
61
- );
62
-
63
- const generateVariantsForControl = (controlType: ControlType): Story => {
64
- const control = CONTROLS[controlType];
65
- const isInteractive = [
66
- 'partialButton',
67
- 'partialButtonAsLink',
68
- 'partialIconButton',
69
- 'partialIconButtonAsLink',
70
- ].includes(controlType);
71
- const additionalInfo = isInteractive ? infoWithLink : infoWithoutLink;
72
- const variants = [
73
- { title },
74
- { title, valueTitle },
75
- { title, subtitle },
76
- { title, valueTitle, valueSubtitle },
77
- { title, subtitle, inverted: true },
78
- { title, subtitle, valueTitle },
79
- { title, subtitle, valueTitle, inverted: true },
80
- { title, subtitle, valueTitle, valueSubtitle },
81
- { title, subtitle, valueTitle, valueSubtitle, inverted: true },
82
- { media, title },
83
- { media, title, valueTitle },
84
- { media, title, subtitle },
85
- { media, title, valueTitle, valueSubtitle },
86
- { media, title, valueTitle },
87
- { media, title, valueSubtitle },
88
- { media, title, subtitle },
89
- { media, title, subtitle, valueTitle },
90
- { media, title, subtitle, valueTitle, valueSubtitle },
91
- { media, title, subtitle, additionalInfo: infoWithoutLink },
92
- isInteractive ? { media, title, subtitle, additionalInfo: infoWithLink } : null,
93
- { media, title, subtitle, additionalInfo, valueTitle },
94
- { media, title, subtitle, additionalInfo, valueTitle, valueSubtitle },
95
- { media, title, subtitle, additionalInfo, valueTitle, valueSubtitle, prompt },
96
- {
97
- media,
98
- title,
99
- subtitle,
100
- additionalInfo,
101
- valueTitle,
102
- valueSubtitle,
103
- prompt: promptWithLink,
104
- },
105
- {
106
- media,
107
- title,
108
- subtitle,
109
- additionalInfo,
110
- valueTitle,
111
- valueSubtitle,
112
- prompt: promptWithLink,
113
- inverted: true,
114
- },
115
- {
116
- media,
117
- title,
118
- subtitle,
119
- additionalInfo,
120
- valueTitle,
121
- valueSubtitle,
122
- prompt: promptWithLink,
123
- spotlight: 'active',
124
- },
125
- {
126
- media,
127
- title,
128
- subtitle,
129
- additionalInfo,
130
- valueTitle,
131
- valueSubtitle,
132
- prompt: promptWithLink,
133
- spotlight: 'inactive',
134
- },
135
- {
136
- media,
137
- title,
138
- subtitle,
139
- additionalInfo,
140
- valueTitle,
141
- valueSubtitle,
142
- prompt: promptWithLink,
143
- spotlight: 'inactive',
144
- disabled: true,
145
- },
146
- ].filter(Boolean) as VariantPartial[];
147
-
148
- return storyConfig(
149
- {
150
- render: () => (
151
- <ol className="list-unstyled">
152
- {variants.map((variant, variantIndex) => (
153
- <ListItem
154
- key={`${controlType}-${variantIndex}-${Math.random()}`}
155
- control={control}
156
- {...variant}
157
- />
158
- ))}
159
- </ol>
160
- ),
161
- },
162
- { variants: ['default', 'dark', 'bright-green', 'forest-green', 'rtl'] },
163
- );
164
- };
165
-
166
- export const Button = generateVariantsForControl('button');
167
- export const ButtonAsLink = generateVariantsForControl('buttonAsLink');
168
- export const ButtonPartiallyInteractive = generateVariantsForControl('partialButton');
169
- export const ButtonAsLinkPartiallyInteractive = generateVariantsForControl('partialButtonAsLink');
170
- export const IconButton = generateVariantsForControl('iconButton');
171
- export const IconButtonAsLink = generateVariantsForControl('iconButtonAsLink');
172
- export const IconButtonWithLabel = generateVariantsForControl('iconButtonWithLabel');
173
- export const IconButtonAsLinkWithLabel = generateVariantsForControl('iconButtonAsLinkWithLabel');
174
- export const IconButtonPartiallyInteractive = generateVariantsForControl('partialIconButton');
175
- export const IconButtonAsLinkPartiallyInteractive =
176
- generateVariantsForControl('partialIconButtonAsLink');
177
- export const Navigation = generateVariantsForControl('navigation');
178
- export const NavigationAsButton = generateVariantsForControl('navigationAsButton');
179
- export const Checkbox = generateVariantsForControl('checkbox');
180
- export const Radio = generateVariantsForControl('radio');
181
- export const Switch = generateVariantsForControl('switch');
182
-
183
- export const ButtonControlLabel: Story = {
184
- render: () => (
185
- <ol className="list-unstyled">
186
- <ListItem
187
- title="Fully interactive button."
188
- subtitle="It uses default content hierarchy."
189
- valueTitle="100 GBP"
190
- valueSubtitle="200 USD"
191
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
192
- control={CONTROLS.button}
193
- prompt={PROMPTS.nonInteractive}
194
- />
195
-
196
- <ListItem
197
- inverted
198
- title="Fully interactive button."
199
- subtitle="It uses inverted content hierarchy."
200
- valueTitle="100 GBP"
201
- valueSubtitle="200 USD"
202
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
203
- control={CONTROLS.button}
204
- prompt={PROMPTS.nonInteractive}
205
- />
206
-
207
- <ListItem
208
- title="Fully interactive button as HTML anchor."
209
- subtitle="It uses default content hierarchy."
210
- valueTitle="100 GBP"
211
- valueSubtitle="200 USD"
212
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
213
- control={CONTROLS.buttonAsLink}
214
- prompt={PROMPTS.nonInteractive}
215
- />
216
-
217
- <ListItem
218
- inverted
219
- title="Fully interactive button as HTML anchor."
220
- subtitle="It uses inverted content hierarchy."
221
- valueTitle="100 GBP"
222
- valueSubtitle="200 USD"
223
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
224
- control={CONTROLS.buttonAsLink}
225
- prompt={PROMPTS.nonInteractive}
226
- />
227
-
228
- <ListItem
229
- title="Partially interactive button."
230
- subtitle="It uses default content hierarchy."
231
- valueTitle="100 GBP"
232
- valueSubtitle="200 USD"
233
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
234
- control={CONTROLS.partialButton}
235
- prompt={PROMPTS.nonInteractive}
236
- />
237
-
238
- <ListItem
239
- inverted
240
- title="Partially interactive button."
241
- subtitle="It uses inverted content hierarchy."
242
- valueTitle="100 GBP"
243
- valueSubtitle="200 USD"
244
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
245
- control={CONTROLS.partialButton}
246
- prompt={PROMPTS.nonInteractive}
247
- />
248
-
249
- <ListItem
250
- title="Partially interactive button as HTML anchor."
251
- subtitle="It uses default content hierarchy."
252
- valueTitle="100 GBP"
253
- valueSubtitle="200 USD"
254
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
255
- control={CONTROLS.buttonAsLink}
256
- prompt={PROMPTS.nonInteractive}
257
- />
258
-
259
- <ListItem
260
- inverted
261
- title="Partially interactive button as HTML anchor."
262
- subtitle="It uses inverted content hierarchy."
263
- valueTitle="100 GBP"
264
- valueSubtitle="200 USD"
265
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
266
- control={CONTROLS.buttonAsLink}
267
- prompt={PROMPTS.nonInteractive}
268
- />
269
- </ol>
270
- ),
271
- };
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 112 80"><path fill="#9FE870" stroke="#163300" stroke-width="2" d="M1 79V1h110v78z"/><path fill="#163300" stroke="#163300" stroke-width="2" d="M74.2 21.4 60.9 58h-5.8l11.1-30.8.5-1.3H48.6l.8 1.5 3 5.2-4.7 5.5-1.4 1.7h9.1l-1.4 4H37.3l9.5-11.2 1.4-1.6h-1.5L41 21.4h33.1Z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 80 112"><path fill="#9FE870" stroke="#163300" stroke-width="2" d="M1 1h78v110H1z"/><path fill="#163300" stroke="#163300" stroke-width="2" d="M59 37 45.9 73.8H40l11-30.9.6-1.3H33.4l1 1.5 3 5.2-4.8 5.5-1.4 1.7h9.1l-1.5 4H22.2l9.5-11.2 1.4-1.6h-1.6L26 37h33Z"/></svg>
@@ -1,139 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { Edit, Briefcase, Plane } from '@transferwise/icons';
3
- import { ListItem } from '../ListItem';
4
- import { fn } from 'storybook/test';
5
- import Link from '../../link';
6
- import { Flag } from '@wise/art';
7
-
8
- export type SB_ListItem_ControlType =
9
- | 'button'
10
- | 'buttonAsLink'
11
- | 'partialButton'
12
- | 'partialButtonAsLink'
13
- | 'iconButton'
14
- | 'iconButtonAsLink'
15
- | 'iconButtonWithLabel'
16
- | 'iconButtonAsLinkWithLabel'
17
- | 'partialIconButton'
18
- | 'partialIconButtonAsLink'
19
- | 'partialIconButtonWithLabel'
20
- | 'partialIconButtonAsLinkWithLabel'
21
- | 'navigation'
22
- | 'navigationAsButton'
23
- | 'checkbox'
24
- | 'radio'
25
- | 'switch';
26
-
27
- export const SB_LIST_ITEM_CONTROLS: Record<SB_ListItem_ControlType, ReactNode> = {
28
- button: <ListItem.Button onClick={() => {}}>Click me</ListItem.Button>,
29
- buttonAsLink: <ListItem.Button href="https://wise.com">Click me</ListItem.Button>,
30
- partialButton: (
31
- <ListItem.Button partiallyInteractive onClick={() => {}}>
32
- Click me
33
- </ListItem.Button>
34
- ),
35
- partialButtonAsLink: (
36
- <ListItem.Button partiallyInteractive href="https://wise.com">
37
- Click me
38
- </ListItem.Button>
39
- ),
40
- navigation: <ListItem.Navigation href="https://wise.com" />,
41
- navigationAsButton: <ListItem.Navigation onClick={fn()} />,
42
- checkbox: <ListItem.Checkbox onChange={() => {}} />,
43
- radio: <ListItem.Radio name="radio" value={Math.random().toString()} onChange={() => {}} />,
44
- switch: <ListItem.Switch onClick={() => {}} />,
45
- iconButton: (
46
- <ListItem.IconButton onClick={() => {}}>
47
- <Edit />
48
- </ListItem.IconButton>
49
- ),
50
- iconButtonAsLink: (
51
- <ListItem.IconButton href="https://wise.com">
52
- <Edit />
53
- </ListItem.IconButton>
54
- ),
55
- iconButtonWithLabel: (
56
- <ListItem.IconButton aria-label="Edit" onClick={() => {}}>
57
- <Edit />
58
- </ListItem.IconButton>
59
- ),
60
- iconButtonAsLinkWithLabel: (
61
- <ListItem.IconButton href="https://wise.com" aria-label="Edit">
62
- <Edit />
63
- </ListItem.IconButton>
64
- ),
65
- partialIconButton: (
66
- <ListItem.IconButton partiallyInteractive onClick={() => {}}>
67
- <Edit />
68
- </ListItem.IconButton>
69
- ),
70
- partialIconButtonAsLink: (
71
- <ListItem.IconButton partiallyInteractive href="https://wise.com">
72
- <Edit />
73
- </ListItem.IconButton>
74
- ),
75
- partialIconButtonWithLabel: (
76
- <ListItem.IconButton partiallyInteractive aria-label="Edit" onClick={() => {}}>
77
- <Edit />
78
- </ListItem.IconButton>
79
- ),
80
- partialIconButtonAsLinkWithLabel: (
81
- <ListItem.IconButton partiallyInteractive aria-label="Edit" href="https://wise.com">
82
- <Edit />
83
- </ListItem.IconButton>
84
- ),
85
- } as const;
86
-
87
- export const SB_LIST_ITEM_ADDITIONAL_INFO = {
88
- interactive: (
89
- <ListItem.AdditionalInfo
90
- action={{
91
- label: 'Details about the subject.',
92
- href: 'https://wise.com',
93
- target: '_blank',
94
- }}
95
- >
96
- Which is augmented with additional info.
97
- </ListItem.AdditionalInfo>
98
- ),
99
- nonInteractive: (
100
- <ListItem.AdditionalInfo>Which is augmented with additional info.</ListItem.AdditionalInfo>
101
- ),
102
- } as const;
103
-
104
- export const SB_LIST_ITEM_PROMPTS = {
105
- interactive: (
106
- <ListItem.Prompt sentiment="positive">
107
- Finally, there is a prompt{' '}
108
- <Link href="https://wise.com" target="_blank" rel="noreferrer">
109
- referencing some details
110
- </Link>{' '}
111
- for your convenience.
112
- </ListItem.Prompt>
113
- ),
114
- nonInteractive: (
115
- <ListItem.Prompt sentiment="positive">Finally, there is a prompt.</ListItem.Prompt>
116
- ),
117
- } as const;
118
-
119
- export const SB_LIST_ITEM_MEDIA = {
120
- image: (
121
- <ListItem.Image
122
- alt="An illustration of a multi-currency account"
123
- src="https://wise.com/public-resources/assets/spend/card-asset/medium/v2/personal_green_wise_2023_active.svg"
124
- />
125
- ),
126
- avatarSingle: (
127
- <ListItem.AvatarView>
128
- <Briefcase />
129
- </ListItem.AvatarView>
130
- ),
131
- avatarDouble: <ListItem.AvatarLayout avatars={[{ asset: <Plane /> }, { asset: '7+' }]} />,
132
- avatarDiagonal: (
133
- <ListItem.AvatarLayout
134
- size={56}
135
- orientation="diagonal"
136
- avatars={[{ asset: <Flag code="gb" /> }, { asset: <Flag code="pl" /> }]}
137
- />
138
- ),
139
- } as const;
@@ -1,14 +0,0 @@
1
- export type { Props as ListItemProps } from './ListItem';
2
- export type { ListItemAdditionalInfoProps } from './AdditionalInfo';
3
- export type { ListItemAvatarLayoutProps } from './AvatarLayout';
4
- export type { ListItemAvatarViewProps } from './AvatarView';
5
- export type { ListItemButtonProps } from './Button';
6
- export type { ListItemCheckboxProps } from './Checkbox';
7
- export type { ListItemIconButtonProps } from './IconButton';
8
- export type { ListItemImageProps } from './Image';
9
- export type { ListItemNavigationProps } from './Navigation';
10
- export type { ListItemPromptProps } from './Prompt';
11
- export type { ListItemRadioProps } from './Radio';
12
- export type { ListItemSwitchProps } from './Switch';
13
-
14
- export { default } from './ListItem';
@@ -1,33 +0,0 @@
1
- import { render, type RenderResult } from '../test-utils';
2
- import { ListItemContext } from './ListItemContext';
3
-
4
- export const mockSetControlType = jest.fn();
5
- export const mockSetControlProps = jest.fn();
6
- export const mockSetMediaSize = jest.fn();
7
-
8
- export const renderWithListItemContext = (ui: React.ReactNode): RenderResult => {
9
- return render(
10
- <ListItemContext.Provider
11
- value={{
12
- setControlType: mockSetControlType,
13
- setControlProps: mockSetControlProps,
14
- setMediaSize: mockSetMediaSize,
15
- ids: {
16
- title: 'title',
17
- additionalInfo: 'additional-info',
18
- valueTitle: 'value-title',
19
- control: 'control',
20
- prompt: 'prompt',
21
- },
22
- props: {},
23
- describedByIds: 'described-by-ids',
24
- }}
25
- >
26
- {ui}
27
- </ListItemContext.Provider>,
28
- );
29
- };
30
-
31
- export const clearListItemMocks = () => {
32
- jest.clearAllMocks();
33
- };
@@ -1,18 +0,0 @@
1
- import { useContext, useEffect } from 'react';
2
- import { ListItemContext, type ListItemContextData } from './ListItemContext';
3
- import type { ListItemTypes, ListItemControlProps } from './ListItem';
4
-
5
- export function useListItemControl(controlType: ListItemTypes, controlProps: ListItemControlProps) {
6
- const {
7
- setControlType,
8
- setControlProps,
9
- props: baseItemProps,
10
- } = useContext<ListItemContextData>(ListItemContext);
11
-
12
- useEffect(() => {
13
- setControlType(controlType);
14
- setControlProps(controlProps);
15
- }, [controlType, controlProps, setControlType, setControlProps]);
16
-
17
- return { baseItemProps };
18
- }
@@ -1,13 +0,0 @@
1
- import { useContext, useEffect } from 'react';
2
- import { ListItemContext, type ListItemContextData } from './ListItemContext';
3
- import type { ListItemAvatarViewProps } from './AvatarView';
4
-
5
- export function useListItemMedia(size?: ListItemAvatarViewProps['size']) {
6
- const { setMediaSize, mediaSize } = useContext<ListItemContextData>(ListItemContext);
7
-
8
- useEffect(() => {
9
- setMediaSize(size);
10
- }, [size, setMediaSize]);
11
-
12
- return { mediaSize, setMediaSize };
13
- }