@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,670 +0,0 @@
1
- import { useState } from 'react';
2
- import { Meta, StoryObj } from '@storybook/react-webpack5';
3
- import { MultiCurrency, Plus } from '@transferwise/icons';
4
- import { lorem5, lorem10 } from '../../test-utils';
5
- import { ListItem, Props as ItemProps } from '../ListItem';
6
- import {
7
- SB_LIST_ITEM_CONTROLS as CONTROLS,
8
- SB_LIST_ITEM_ADDITIONAL_INFO as ADDITIONAL_INFO,
9
- SB_LIST_ITEM_PROMPTS as PROMPTS,
10
- SB_LIST_ITEM_MEDIA as MEDIA,
11
- } from './subcomponents';
12
-
13
- /**
14
- * List Items let users review or select options from a dynamic list.<br />
15
- * For more details please refer to the [release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3647251055/List+Item+release+notes) and the [design spec](https://wise.design/components/list-item). <br />
16
- *
17
- * > This component replaces now deprecated `LegacyListItem`, `Summary` and all `*Option` components
18
- */
19
- export default {
20
- component: ListItem,
21
- subcomponents: {
22
- 'ListItem.AdditionalInfo': ListItem.AdditionalInfo,
23
- 'ListItem.Prompt': ListItem.Prompt,
24
- 'ListItem.Button': ListItem.Button,
25
- 'ListItem.IconButton': ListItem.IconButton,
26
- 'ListItem.Navigation': ListItem.Navigation,
27
- 'ListItem.Checkbox': ListItem.Checkbox,
28
- 'ListItem.Radio': ListItem.Radio,
29
- 'ListItem.Switch': ListItem.Switch,
30
- 'ListItem.AvatarView': ListItem.AvatarView,
31
- 'ListItem.AvatarLayout': ListItem.AvatarLayout,
32
- 'ListItem.Image': ListItem.Image,
33
- },
34
- title: 'Content/ListItem',
35
- parameters: {
36
- docs: {
37
- toc: true,
38
- },
39
- },
40
- args: {
41
- title: 'List item title',
42
- subtitle: 'Subtitle goes here',
43
- valueTitle: '100 GBP',
44
- valueSubtitle: '100 USD',
45
- disabled: false,
46
- spotlight: undefined,
47
- inverted: false,
48
- valueColumnWidth: undefined,
49
- },
50
- argTypes: {
51
- spotlight: {
52
- control: 'radio',
53
- options: ['unset (undefined)', 'active', 'inactive'],
54
- mapping: {
55
- 'unset (undefined)': undefined,
56
- active: 'active',
57
- inactive: 'inactive',
58
- },
59
- },
60
- },
61
- } satisfies Meta<ItemProps>;
62
-
63
- type Story = StoryObj<ItemProps>;
64
-
65
- /**
66
- * Convenience controls for previewing rich markup,
67
- * not otherwise possible via Storybook
68
- */
69
- type PreviewStoryArgs = ItemProps & {
70
- previewInteractivity: 'non-interactive' | 'fully-interactive' | 'partially-interactive';
71
- previewControlFull: ItemProps['control'];
72
- previewControlPartial: ItemProps['control'];
73
- previewAdditionalInfoFull: ItemProps['additionalInfo'];
74
- previewAdditionalInfoPartial: ItemProps['additionalInfo'];
75
- previewPrompt: ItemProps['prompt'];
76
- previewMedia: ItemProps['media'];
77
- };
78
-
79
- const previewArgGroup = {
80
- category: 'Preview options',
81
- type: {
82
- summary: undefined,
83
- },
84
- };
85
-
86
- const previewArgTypes = {
87
- previewInteractivity: {
88
- name: 'Preview different interactivity',
89
- control: 'radio',
90
- options: ['non-interactive', 'fully-interactive', 'partially-interactive'],
91
- table: previewArgGroup,
92
- },
93
-
94
- previewControlFull: {
95
- name: 'Preview with `control`',
96
- if: {
97
- arg: 'previewInteractivity',
98
- eq: 'fully-interactive',
99
- },
100
- control: 'select',
101
- options: [
102
- 'unset (undefined)',
103
- 'Button',
104
- 'Button as anchor',
105
- 'IconButton',
106
- 'IconButton as anchor',
107
- 'Navigation',
108
- 'Navigation as button',
109
- 'Checkbox',
110
- 'Radio',
111
- 'Switch',
112
- ],
113
- mapping: {
114
- 'unset (undefined)': undefined,
115
- Button: CONTROLS.button,
116
- 'Button as anchor': CONTROLS.buttonAsLink,
117
- IconButton: CONTROLS.iconButton,
118
- 'IconButton as anchor': CONTROLS.iconButtonAsLink,
119
- Navigation: CONTROLS.navigation,
120
- 'Navigation as button': CONTROLS.navigationAsButton,
121
- Checkbox: CONTROLS.checkbox,
122
- Radio: CONTROLS.radio,
123
- Switch: CONTROLS.switch,
124
- },
125
- table: previewArgGroup,
126
- },
127
-
128
- previewControlPartial: {
129
- name: 'Preview with `control`',
130
- if: {
131
- arg: 'previewInteractivity',
132
- eq: 'partially-interactive',
133
- },
134
- control: 'select',
135
- options: [
136
- 'unset (undefined)',
137
- 'Button',
138
- 'Button as anchor',
139
- 'IconButton',
140
- 'IconButton as anchor',
141
- ],
142
- mapping: {
143
- 'unset (undefined)': undefined,
144
- Button: CONTROLS.partialButton,
145
- 'Button as anchor': CONTROLS.partialButtonAsLink,
146
- IconButton: CONTROLS.partialIconButton,
147
- 'IconButton as anchor': CONTROLS.partialIconButtonAsLink,
148
- },
149
- table: previewArgGroup,
150
- },
151
-
152
- previewAdditionalInfoFull: {
153
- name: 'Preview with `additionalInfo`',
154
- if: {
155
- arg: 'previewInteractivity',
156
- eq: 'fully-interactive',
157
- },
158
- control: 'radio',
159
- options: ['unset (undefined)', 'non-interactive'],
160
- mapping: {
161
- 'unset (undefined)': undefined,
162
- 'non-interactive': ADDITIONAL_INFO.nonInteractive,
163
- },
164
- table: previewArgGroup,
165
- },
166
- previewAdditionalInfoPartial: {
167
- name: 'Preview with `additionalInfo`',
168
- if: {
169
- arg: 'previewInteractivity',
170
- eq: 'partially-interactive',
171
- },
172
- control: 'radio',
173
- options: ['unset (undefined)', 'interactive', 'non-interactive'],
174
- mapping: {
175
- 'unset (undefined)': undefined,
176
- interactive: ADDITIONAL_INFO.interactive,
177
- 'non-interactive': ADDITIONAL_INFO.nonInteractive,
178
- },
179
- table: previewArgGroup,
180
- },
181
-
182
- previewPrompt: {
183
- name: 'Preview with `prompt`',
184
- control: 'radio',
185
- options: ['unset (undefined)', 'interactive', 'non-interactive'],
186
- mapping: {
187
- 'unset (undefined)': undefined,
188
- interactive: PROMPTS.interactive,
189
- 'non-interactive': PROMPTS.nonInteractive,
190
- },
191
- table: previewArgGroup,
192
- },
193
-
194
- previewMedia: {
195
- name: 'Preview with `media`',
196
- control: 'select',
197
- options: [
198
- 'unset (undefined)',
199
- 'image',
200
- 'avatar: single',
201
- 'avatar: double',
202
- 'avatar: double-diagonal',
203
- ],
204
- mapping: {
205
- 'unset (undefined)': undefined,
206
- image: MEDIA.image,
207
- 'avatar: single': MEDIA.avatarSingle,
208
- 'avatar: double': MEDIA.avatarDouble,
209
- 'avatar: double-diagonal': MEDIA.avatarDiagonal,
210
- },
211
- table: previewArgGroup,
212
- },
213
- } as const;
214
-
215
- const getPropsForPreview = (args: PreviewStoryArgs): [ItemProps, Partial<ItemProps>] => {
216
- const {
217
- previewInteractivity,
218
- previewControlFull,
219
- previewControlPartial,
220
- previewAdditionalInfoFull,
221
- previewAdditionalInfoPartial,
222
- previewPrompt,
223
- previewMedia,
224
- ...props
225
- } = args;
226
-
227
- return [
228
- props,
229
- {
230
- control: previewControlFull || previewControlPartial,
231
- additionalInfo: previewAdditionalInfoFull || previewAdditionalInfoPartial,
232
- prompt: previewPrompt,
233
- media: previewMedia,
234
- },
235
- ];
236
- };
237
-
238
- export const Playground: StoryObj<PreviewStoryArgs> = {
239
- tags: ['!autodocs'],
240
- render: (args: PreviewStoryArgs) => {
241
- const [props, previewProps] = getPropsForPreview(args);
242
-
243
- return (
244
- <ol className="list-unstyled">
245
- <ListItem {...props} {...previewProps} />
246
- </ol>
247
- );
248
- },
249
- argTypes: previewArgTypes,
250
- args: {
251
- previewInteractivity: 'fully-interactive',
252
- previewPrompt: 'interactive',
253
- previewMedia: 'avatar: single',
254
- previewControlFull: 'Button',
255
- previewControlPartial: 'Button',
256
- previewAdditionalInfoFull: 'non-interactive',
257
- previewAdditionalInfoPartial: 'non-interactive',
258
- },
259
- };
260
-
261
- /**
262
- * ListItem uses container queries under the hood, which means its layout self-adjusts based on
263
- * the available space. At the 100% zoom level, these breakpoints correspond to
264
- * containers under `320px`, those between `321px and 399px`, and finally everything including
265
- * and above `400px`. <br />
266
- * This also supports high levels of zoom for assistive tech users.
267
- */
268
- export const Responsiveness: Story = {
269
- parameters: {
270
- docs: {
271
- canvas: {
272
- sourceState: 'hidden',
273
- },
274
- },
275
- },
276
- render: (args) => {
277
- return (
278
- <ol
279
- className="list-unstyled"
280
- style={{ display: 'grid', gridTemplateColumns: '320px 360px 400px', gap: 16 }}
281
- >
282
- <div style={{ width: '320px' }}>
283
- <ListItem
284
- {...args}
285
- subtitle={lorem10}
286
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
287
- control={CONTROLS.button}
288
- media={MEDIA.image}
289
- prompt={PROMPTS.interactive}
290
- />
291
- </div>
292
- <div style={{ width: '360px' }}>
293
- <ListItem
294
- {...args}
295
- subtitle={lorem10}
296
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
297
- control={CONTROLS.button}
298
- media={MEDIA.image}
299
- prompt={PROMPTS.interactive}
300
- />
301
- </div>
302
- <div style={{ width: '400px' }}>
303
- <ListItem
304
- {...args}
305
- subtitle={lorem10}
306
- additionalInfo={<div />}
307
- control={CONTROLS.button}
308
- media={MEDIA.image}
309
- prompt={PROMPTS.interactive}
310
- />
311
- </div>
312
- </ol>
313
- );
314
- },
315
- };
316
-
317
- /**
318
- * Due to platform limitations, the component is unable to automagically adjust its content to
319
- * all possible configurations. <br />
320
- * By default, it'll follow a CSS grid `1fr max-content` ratio of left side content (`title` and
321
- * `subtitle`) to the right side content (`valueTitle` and `valueSubtitle`).
322
- *
323
- * To adjust the width of the right side content, you can use `valueColumnWidth` prop which accepts
324
- * a number between `0–100` which resolves to a `fr` value of a `grid-template-columns` declaration.
325
- * E.g. `valueColumnWidth={25}` will result in a `75fr 25fr`.
326
- *
327
- * **NB:** This behaviour is slightly different on mobile platforms as they have more control over
328
- * layout calculations.
329
- */
330
- export const ContentRatio: Story = {
331
- parameters: {
332
- docs: {
333
- canvas: {
334
- sourceState: 'hidden',
335
- },
336
- },
337
- },
338
- args: {
339
- valueTitle: `${lorem5} ${lorem5}`,
340
- valueSubtitle: lorem5,
341
- valueColumnWidth: 70,
342
- },
343
- render: (args) => {
344
- return (
345
- <ListItem
346
- {...args}
347
- subtitle={lorem5}
348
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
349
- control={CONTROLS.button}
350
- media={MEDIA.image}
351
- prompt={PROMPTS.interactive}
352
- />
353
- );
354
- },
355
- };
356
-
357
- /**
358
- * List item supports default and inverted title and description to allow for further flexibility
359
- * in the component.
360
- *
361
- * Refer to the [design documentation](https://wise.design/components/list-item#content-hierarchy) for more details.
362
- */
363
- export const ContentHierarchy: Story = {
364
- args: {
365
- inverted: true,
366
- },
367
- render: (args) => {
368
- return (
369
- <ListItem
370
- {...args}
371
- subtitle={lorem10}
372
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
373
- control={CONTROLS.button}
374
- media={MEDIA.image}
375
- prompt={PROMPTS.interactive}
376
- />
377
- );
378
- },
379
- };
380
-
381
- /**
382
- * Interactive list items can alternatively be displayed with a spotlight.
383
- *
384
- * Refer to the [design documentation](https://wise.design/components/list-item#spotlight) for more details.
385
- */
386
- export const Spotlight: Story = {
387
- render: (args) => {
388
- return (
389
- <ol className="list-unstyled">
390
- <ListItem
391
- {...args}
392
- subtitle={lorem10}
393
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
394
- control={CONTROLS.button}
395
- media={MEDIA.image}
396
- prompt={PROMPTS.interactive}
397
- spotlight="inactive"
398
- />
399
- <ListItem
400
- {...args}
401
- subtitle={lorem10}
402
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
403
- control={CONTROLS.button}
404
- media={MEDIA.image}
405
- prompt={PROMPTS.interactive}
406
- spotlight="active"
407
- />
408
- </ol>
409
- );
410
- },
411
- };
412
-
413
- /**
414
- * By default, all list items are fully interactive, meaning that their whole surface triggers the
415
- * main action. The only 2 exceptions are those using `ListItem.Button` and `ListItem.IconButton`
416
- * as their controls, which can be made partially interactive by toggling `partiallyInteractive`
417
- * prop directly on them.
418
- *
419
- * Fully interactive list items **cannot contain any other interactive elements**, such as links or
420
- * buttons, inside them, with the only exception being the `ListItem.Prompt` subcomponent, as it's
421
- * rendered on a separate Accessibility Tree branch. <br/>
422
- * Partially interactive items can also have interactive `ListItem.AdditionalInfo` which allows
423
- * for a single, appended link or inline button.
424
- *
425
- * All of these limitations were put in place to ensure that the list item is compliant with
426
- * accessibility guidance and offers consistent experience across all engineering platforms.
427
- *
428
- * Please refer to the [design documentation](https://wise.design/components/list-item#:~:text=specific%20list%20item.-,Interaction,-The%20list%20item) for more details.
429
- */
430
- export const Interactivity: Story = {
431
- render: function Render() {
432
- const [clicked, setClicked] = useState(0);
433
-
434
- return (
435
- <>
436
- <label>Count: {clicked}</label>
437
- <ListItem
438
- title="Fully interactive"
439
- subtitle={lorem10}
440
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
441
- control={
442
- <ListItem.Button
443
- priority="secondary-neutral"
444
- onClick={() => setClicked((current) => current + 1)}
445
- >
446
- as Button
447
- </ListItem.Button>
448
- }
449
- prompt={PROMPTS.interactive}
450
- />
451
- <ListItem
452
- title="Partially interactive"
453
- subtitle={lorem10}
454
- additionalInfo={ADDITIONAL_INFO.interactive}
455
- control={
456
- <ListItem.Button
457
- priority="secondary-neutral"
458
- partiallyInteractive
459
- onClick={() => setClicked((current) => current + 1)}
460
- >
461
- as Button
462
- </ListItem.Button>
463
- }
464
- prompt={PROMPTS.interactive}
465
- />
466
- <ListItem
467
- title="Fully interactive"
468
- subtitle={lorem10}
469
- additionalInfo={ADDITIONAL_INFO.nonInteractive}
470
- control={
471
- <ListItem.IconButton
472
- aria-label="Add something to me"
473
- onClick={() => setClicked((current) => current + 1)}
474
- >
475
- <Plus />
476
- </ListItem.IconButton>
477
- }
478
- prompt={PROMPTS.interactive}
479
- />
480
- <ListItem
481
- title="Partially interactive"
482
- subtitle={lorem10}
483
- additionalInfo={ADDITIONAL_INFO.interactive}
484
- control={
485
- <ListItem.IconButton
486
- partiallyInteractive
487
- onClick={() => setClicked((current) => current + 1)}
488
- >
489
- <Plus />
490
- </ListItem.IconButton>
491
- }
492
- prompt={PROMPTS.interactive}
493
- />
494
- </>
495
- );
496
- },
497
- };
498
-
499
- /**
500
- * While most disabled states will show as grayed out, the navigation control switches from chevron
501
- * to a new icon for improved user experience and accessibility. <br />
502
- * For the same reason, only the control part of the List Item is dimmed, while all the content
503
- * retains high contrast and interactivity.
504
- */
505
- export const Disabled: Story = {
506
- parameters: {
507
- docs: {
508
- canvas: {
509
- sourceState: 'hidden',
510
- },
511
- },
512
- },
513
- render: () => (
514
- <div>
515
- <ListItem
516
- disabled
517
- media={
518
- <ListItem.AvatarView>
519
- <MultiCurrency />
520
- </ListItem.AvatarView>
521
- }
522
- title="Navigation"
523
- subtitle={lorem5}
524
- control={<ListItem.Navigation onClick={() => {}} />}
525
- />
526
- <ListItem
527
- disabled
528
- media={
529
- <ListItem.AvatarView>
530
- <MultiCurrency />
531
- </ListItem.AvatarView>
532
- }
533
- title="Button secondary neutral"
534
- subtitle={lorem5}
535
- control={<ListItem.Button priority="secondary-neutral">Secondary Neutral</ListItem.Button>}
536
- />
537
- <ListItem
538
- disabled
539
- media={
540
- <ListItem.AvatarView>
541
- <MultiCurrency />
542
- </ListItem.AvatarView>
543
- }
544
- title="Button primary"
545
- subtitle={lorem5}
546
- control={<ListItem.Button priority="primary">Primary</ListItem.Button>}
547
- />
548
- <ListItem
549
- disabled
550
- media={
551
- <ListItem.AvatarView>
552
- <MultiCurrency />
553
- </ListItem.AvatarView>
554
- }
555
- title="Button tertiary"
556
- subtitle={lorem5}
557
- control={<ListItem.Button priority="tertiary">Tertiary</ListItem.Button>}
558
- />
559
- <ListItem
560
- disabled
561
- media={
562
- <ListItem.AvatarView>
563
- <MultiCurrency />
564
- </ListItem.AvatarView>
565
- }
566
- title="Icon Button"
567
- subtitle={lorem5}
568
- control={
569
- <ListItem.IconButton>
570
- <Plus />
571
- </ListItem.IconButton>
572
- }
573
- />
574
- <ListItem
575
- disabled
576
- media={
577
- <ListItem.AvatarView>
578
- <MultiCurrency />
579
- </ListItem.AvatarView>
580
- }
581
- title="Checkbox"
582
- subtitle={lorem5}
583
- control={<ListItem.Checkbox />}
584
- />
585
- <ListItem
586
- disabled
587
- media={
588
- <ListItem.AvatarView>
589
- <MultiCurrency />
590
- </ListItem.AvatarView>
591
- }
592
- title="Checkbox checked"
593
- subtitle={lorem5}
594
- control={<ListItem.Checkbox checked />}
595
- />
596
- <ListItem
597
- disabled
598
- media={
599
- <ListItem.AvatarView>
600
- <MultiCurrency />
601
- </ListItem.AvatarView>
602
- }
603
- title="Checkbox indeterminate"
604
- subtitle={lorem5}
605
- control={<ListItem.Checkbox indeterminate />}
606
- />
607
- <ListItem
608
- disabled
609
- media={
610
- <ListItem.AvatarView>
611
- <MultiCurrency />
612
- </ListItem.AvatarView>
613
- }
614
- title="Switch on"
615
- subtitle={lorem5}
616
- control={<ListItem.Switch checked onClick={() => {}} />}
617
- />
618
- <ListItem
619
- disabled
620
- media={
621
- <ListItem.AvatarView>
622
- <MultiCurrency />
623
- </ListItem.AvatarView>
624
- }
625
- title="Switch off"
626
- subtitle={lorem5}
627
- control={<ListItem.Switch onClick={() => {}} />}
628
- />
629
- <ListItem
630
- disabled
631
- media={
632
- <ListItem.AvatarView>
633
- <MultiCurrency />
634
- </ListItem.AvatarView>
635
- }
636
- title="Switch off"
637
- subtitle={lorem5}
638
- control={<ListItem.Radio name="radio" checked />}
639
- />
640
- <ListItem
641
- disabled
642
- media={
643
- <ListItem.AvatarView>
644
- <MultiCurrency />
645
- </ListItem.AvatarView>
646
- }
647
- title="Switch off"
648
- subtitle={lorem5}
649
- control={<ListItem.Radio name="radios" />}
650
- />
651
- <ListItem
652
- disabled
653
- media={
654
- <ListItem.AvatarView>
655
- <MultiCurrency />
656
- </ListItem.AvatarView>
657
- }
658
- title="Switch off"
659
- subtitle={lorem5}
660
- additionalInfo={ADDITIONAL_INFO.interactive}
661
- prompt={PROMPTS.interactive}
662
- control={
663
- <ListItem.Button partiallyInteractive onClick={() => {}}>
664
- Click me
665
- </ListItem.Button>
666
- }
667
- />
668
- </div>
669
- ),
670
- };