@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,36 +0,0 @@
1
- import { mockMatchMedia, render, screen } from '../../test-utils';
2
- import { Sentiment } from '../../common';
3
- import { ListItem } from '../ListItem';
4
- import type { ListItemPromptProps } from './ListItemPrompt';
5
-
6
- mockMatchMedia();
7
-
8
- describe('ListItem.Prompt', () => {
9
- it('renders children content', () => {
10
- render(
11
- <ListItem
12
- title="Test Title"
13
- prompt={<ListItem.Prompt>This is a prompt message</ListItem.Prompt>}
14
- />,
15
- );
16
-
17
- expect(screen.getByText('This is a prompt message')).toBeInTheDocument();
18
- });
19
-
20
- describe('render icon', () => {
21
- it.each([
22
- [Sentiment.NEUTRAL, 'info-icon'],
23
- [Sentiment.POSITIVE, 'check-icon'],
24
- [Sentiment.NEGATIVE, 'cross-icon'],
25
- [Sentiment.WARNING, 'alert-icon'],
26
- ] as [ListItemPromptProps['sentiment'], string][])('renders %s icon', (sentiment, iconId) => {
27
- render(
28
- <ListItem
29
- title="Test Title"
30
- prompt={<ListItem.Prompt sentiment={sentiment}>Message</ListItem.Prompt>}
31
- />,
32
- );
33
- expect(screen.getByTestId(iconId)).toBeInTheDocument();
34
- });
35
- });
36
- });
@@ -1,201 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { action } from 'storybook/actions';
3
- import { lorem10, lorem5 } from '../../test-utils';
4
- import Link from '../../link';
5
- import { Sentiment as Sentiments } from '../../common';
6
- import { ListItem } from '../..';
7
- import { Prompt, ListItemPromptProps } from './ListItemPrompt';
8
- import {
9
- SB_LIST_ITEM_CONTROLS as CONTROLS,
10
- SB_LIST_ITEM_MEDIA as MEDIA,
11
- } from '../_stories/subcomponents';
12
-
13
- const meta: Meta<ListItemPromptProps> = {
14
- component: Prompt,
15
- title: 'Content/ListItem/ListItem.Prompt',
16
- parameters: {
17
- docs: {
18
- toc: true,
19
- },
20
- },
21
- args: {
22
- sentiment: undefined,
23
- children: 'You have done a terrible thing',
24
- },
25
- argTypes: {
26
- sentiment: {
27
- options: [
28
- 'unset (undefined)',
29
- Sentiments.POSITIVE,
30
- Sentiments.NEGATIVE,
31
- Sentiments.NEUTRAL,
32
- Sentiments.WARNING,
33
- ],
34
- mapping: {
35
- 'unset (undefined)': undefined,
36
- },
37
- control: { type: 'radio' },
38
- },
39
- children: {
40
- table: {
41
- type: { summary: 'ReactNode' },
42
- },
43
- },
44
- },
45
- };
46
-
47
- export default meta;
48
-
49
- type Story = StoryObj<ListItemPromptProps>;
50
-
51
- export const Playground: Story = {
52
- tags: ['!autodocs'],
53
- parameters: {
54
- docs: {
55
- source: 'dynamic',
56
- },
57
- },
58
- render: (args) => (
59
- <ListItem
60
- title={lorem5}
61
- subtitle={lorem10}
62
- media={MEDIA.avatarSingle}
63
- control={CONTROLS.switch}
64
- prompt={<Prompt {...args} />}
65
- />
66
- ),
67
- };
68
-
69
- export const Sentiment: Story = {
70
- parameters: {
71
- controls: { disable: true },
72
- actions: { disable: true },
73
- a11y: { disable: true },
74
- knobs: { disable: true },
75
- },
76
- render: (args) => (
77
- <ol className="list-unstyled">
78
- <ListItem
79
- title={lorem5}
80
- subtitle={lorem10}
81
- media={MEDIA.avatarSingle}
82
- control={CONTROLS.switch}
83
- prompt={<Prompt sentiment={Sentiments.NEUTRAL}>This is a neutral prompt.</Prompt>}
84
- />
85
- <ListItem
86
- title={lorem5}
87
- subtitle={lorem10}
88
- media={MEDIA.avatarSingle}
89
- control={CONTROLS.switch}
90
- prompt={<Prompt sentiment={Sentiments.POSITIVE}>This is a positive prompt.</Prompt>}
91
- />
92
- <ListItem
93
- title={lorem5}
94
- subtitle={lorem10}
95
- media={MEDIA.avatarSingle}
96
- control={CONTROLS.switch}
97
- prompt={<Prompt sentiment={Sentiments.WARNING}>This is a warning prompt.</Prompt>}
98
- />
99
- <ListItem
100
- title={lorem5}
101
- subtitle={lorem10}
102
- media={MEDIA.avatarSingle}
103
- control={CONTROLS.switch}
104
- prompt={<Prompt sentiment={Sentiments.NEGATIVE}>This is a negative prompt.</Prompt>}
105
- />
106
- </ol>
107
- ),
108
- };
109
-
110
- /**
111
- * `ListItem.Prompt` is rendered on a separate branch of the Accessibility Tree from the item's
112
- * control, so it can include a single instance of `Link` component, which can be rendered as
113
- * either HTML anchor or button. That element will spread across the whole surface of the Prompt
114
- * so it's easily accessible for all users.
115
- */
116
- export const Interactivity: Story = {
117
- argTypes: {
118
- children: {
119
- table: {
120
- disable: true,
121
- },
122
- },
123
- },
124
- render: (args) => (
125
- <ol className="list-unstyled">
126
- <ListItem
127
- title={lorem5}
128
- subtitle={lorem10}
129
- media={MEDIA.avatarSingle}
130
- control={CONTROLS.switch}
131
- prompt={
132
- <Prompt sentiment={args.sentiment}>
133
- This prompt includes a{' '}
134
- <Link href="https://wise.com" target="_blank" rel="noreferrer">
135
- link to some resource
136
- </Link>{' '}
137
- to help the user in their journey.
138
- </Prompt>
139
- }
140
- />
141
-
142
- <ListItem
143
- title={lorem5}
144
- subtitle={lorem10}
145
- media={MEDIA.avatarSingle}
146
- control={CONTROLS.switch}
147
- prompt={
148
- <Prompt sentiment={args.sentiment}>
149
- {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
150
- This prompt includes an <Link onClick={action('inline button')}>
151
- inline button
152
- </Link>{' '}
153
- than can e.g. trigger a modal.
154
- </Prompt>
155
- }
156
- />
157
- </ol>
158
- ),
159
- };
160
-
161
- /**
162
- * By default, the Prompt will try to occupy as little space as possible, but as soon as you make it more than 1 line long, it will stretch to the full available width.
163
- *
164
- * **NB:** While Prompt supports multi-line text, its content should be concise and have no more than 2 short sentences so users can quickly understand the message.
165
- */
166
- export const Sizing: Story = {
167
- parameters: {
168
- docs: {
169
- canvas: {
170
- sourceState: 'hidden',
171
- },
172
- },
173
- },
174
- render: (args) => (
175
- <ol className="list-unstyled">
176
- <ListItem
177
- title={lorem5}
178
- subtitle={lorem10}
179
- media={MEDIA.image}
180
- control={CONTROLS.switch}
181
- prompt={
182
- <ListItem.Prompt sentiment={Sentiments.POSITIVE}>This is a short text</ListItem.Prompt>
183
- }
184
- />
185
- <ListItem
186
- title={lorem5}
187
- subtitle={lorem10}
188
- media={MEDIA.image}
189
- control={CONTROLS.switch}
190
- prompt={
191
- <ListItem.Prompt sentiment={Sentiments.WARNING}>
192
- This is a very, very, very, very, very long text that will wrap into more than 1 line
193
- and will make the prompt stretch to a full available width. Technically it can be as
194
- long as Vim manual, but we recommend keeping it concise and no more than 2 short
195
- sentences.
196
- </ListItem.Prompt>
197
- }
198
- />
199
- </ol>
200
- ),
201
- };
@@ -1,32 +0,0 @@
1
- import { useContext } from 'react';
2
- import { clsx } from 'clsx';
3
- import { Sentiment } from '../../common';
4
- import StatusIcon from '../../statusIcon';
5
- import Body from '../../body';
6
- import { ListItemContext, type ListItemContextData } from '../ListItemContext';
7
-
8
- export type ListItemPromptProps = {
9
- sentiment?: `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`;
10
- children: React.ReactNode;
11
- };
12
-
13
- /**
14
- * This component allows for rendering an Inline Prompt. <br />In the future it will be a thin wrapper around a standalone component.<br />
15
- *
16
- * Please refer to the [Design documentation](https://wise.design/components/list-item#prompt) for details.
17
- */
18
- export const Prompt = ({ sentiment = Sentiment.NEUTRAL, children }: ListItemPromptProps) => {
19
- const { ids } = useContext<ListItemContextData>(ListItemContext);
20
-
21
- return (
22
- <div id={ids.prompt} className={clsx('wds-list-item-prompt', sentiment)}>
23
- <div className="np-prompt-icon">
24
- <StatusIcon size={16} sentiment={sentiment} />
25
- </div>
26
- <Body>{children}</Body>
27
- </div>
28
- );
29
- };
30
-
31
- Prompt.displayName = 'ListItem.Prompt';
32
- export default Prompt;
@@ -1,2 +0,0 @@
1
- export type { ListItemPromptProps } from './ListItemPrompt';
2
- export { Prompt } from './ListItemPrompt';
@@ -1,66 +0,0 @@
1
- import { render, screen } from '../../test-utils';
2
- import userEvent from '@testing-library/user-event';
3
- import { ListItem, type Props as ListItemProps } from '../ListItem';
4
-
5
- describe('ListItem.Radio', () => {
6
- const renderWith = (overrides: Partial<ListItemProps> = {}) =>
7
- render(<ListItem title="Test Title" {...overrides} />);
8
-
9
- it('renders radio button', () => {
10
- renderWith({
11
- control: <ListItem.Radio name="test-radio" value="option1" onChange={() => {}} />,
12
- });
13
-
14
- expect(screen.getByRole('radio')).toBeInTheDocument();
15
- });
16
-
17
- describe('checked state', () => {
18
- it('reflects checked state', () => {
19
- renderWith({
20
- control: <ListItem.Radio name="test-radio" value="option1" checked />,
21
- });
22
-
23
- expect(screen.getByRole('radio')).toBeChecked();
24
- });
25
-
26
- it('reflects unchecked state', () => {
27
- renderWith({
28
- control: <ListItem.Radio name="test-radio" value="option1" checked={false} />,
29
- });
30
-
31
- expect(screen.getByRole('radio')).not.toBeChecked();
32
- });
33
- });
34
-
35
- it('handles onChange events', async () => {
36
- const handleChange = jest.fn();
37
- renderWith({
38
- control: <ListItem.Radio name="test-radio" value="option1" onChange={handleChange} />,
39
- });
40
-
41
- await userEvent.click(screen.getByRole('radio'));
42
- expect(handleChange).toHaveBeenCalledTimes(1);
43
- });
44
-
45
- it('is disabled when ListItem is disabled', async () => {
46
- const handleChange = jest.fn();
47
- renderWith({
48
- disabled: true,
49
- control: <ListItem.Radio name="test-radio" value="option1" onChange={handleChange} />,
50
- });
51
-
52
- const radio = screen.getByRole('radio');
53
- expect(radio).toBeDisabled();
54
- await userEvent.click(radio);
55
- expect(handleChange).not.toHaveBeenCalled();
56
- });
57
-
58
- it('supports name and value attributes', () => {
59
- renderWith({ control: <ListItem.Radio name="test-radio" value="option1" /> });
60
-
61
- const radio = screen.getByRole('radio');
62
- expect(radio).toHaveAttribute('name', 'test-radio');
63
- // eslint-disable-next-line jest-dom/prefer-to-have-value
64
- expect(radio).toHaveAttribute('value', 'option1');
65
- });
66
- });
@@ -1,98 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { useState } from 'react';
3
- import { ListItem } from '../ListItem';
4
- import {
5
- SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
6
- SB_LIST_ITEM_MEDIA as MEDIA,
7
- } from '../_stories/subcomponents';
8
- import type { ListItemRadioProps } from './ListItemRadio';
9
- import { fn } from 'storybook/test';
10
- import { ProfileType } from '../../common';
11
-
12
- const meta: Meta<ListItemRadioProps> = {
13
- component: ListItem.Radio,
14
- title: 'Content/ListItem/ListItem.Radio',
15
- parameters: {
16
- docs: {
17
- toc: true,
18
- },
19
- },
20
- args: {
21
- name: 'radio-group',
22
- value: 'option1',
23
- checked: false,
24
- onChange: fn(),
25
- },
26
- } satisfies Meta<ListItemRadioProps>;
27
-
28
- export default meta;
29
-
30
- type Story = StoryObj<ListItemRadioProps>;
31
-
32
- export const Playground: Story = {
33
- tags: ['!autodocs'],
34
- render: (args: ListItemRadioProps) => {
35
- return (
36
- <ListItem
37
- title="List item with radio"
38
- subtitle="Select this option"
39
- media={MEDIA.avatarSingle}
40
- control={<ListItem.Radio {...args} />}
41
- additionalInfo={INFO.nonInteractive}
42
- />
43
- );
44
- },
45
- };
46
-
47
- /**
48
- * Radio controls follow the native HTML behaviour and can be grouped using the `name` prop.
49
- */
50
- export const RadioGroup: Story = {
51
- render: function Render() {
52
- const [selectedValue, setSelectedValue] = useState('2');
53
-
54
- return (
55
- <ol className="list-unstyled">
56
- <ListItem
57
- control={
58
- <ListItem.Radio
59
- name="group"
60
- value="1"
61
- checked={selectedValue === '1'}
62
- onChange={setSelectedValue}
63
- />
64
- }
65
- title="First option"
66
- subtitle="This is the first choice"
67
- media={<ListItem.AvatarView profileType={ProfileType.BUSINESS} />}
68
- />
69
- <ListItem
70
- control={
71
- <ListItem.Radio
72
- name="group"
73
- value="2"
74
- checked={selectedValue === '2'}
75
- onChange={setSelectedValue}
76
- />
77
- }
78
- title="Second option"
79
- subtitle="This is the second choice"
80
- media={<ListItem.AvatarView profileType={ProfileType.BUSINESS} />}
81
- />
82
- <ListItem
83
- control={
84
- <ListItem.Radio
85
- name="group"
86
- value="3"
87
- checked={selectedValue === '3'}
88
- onChange={setSelectedValue}
89
- />
90
- }
91
- title="Third option"
92
- subtitle="This is the third choice"
93
- media={<ListItem.AvatarView profileType={ProfileType.BUSINESS} />}
94
- />
95
- </ol>
96
- );
97
- },
98
- };
@@ -1,33 +0,0 @@
1
- import { useContext } from 'react';
2
- import RadioButton, { type RadioButtonProps } from '../../common/RadioButton/RadioButton';
3
- import { useListItemControl } from '../useListItemControl';
4
- import { ListItemContext } from '../ListItemContext';
5
-
6
- export type ListItemRadioProps = Omit<
7
- RadioButtonProps,
8
- 'disabled' | 'readOnly' | 'className' | 'id'
9
- >;
10
-
11
- /**
12
- * This component allows for rendering a Button control. It's a thin wrapper around the
13
- * [Button component](https://storybook.wise.design/?path=/docs/content-button--docs), but offers only
14
- * a subset of its features in line with the ListItem's constraints. <br />
15
- * <br />
16
- * Please refer to the [Design documentation](https://wise.design/components/list-item---button) for details.
17
- */
18
- export const Radio = function (props: ListItemRadioProps) {
19
- const { baseItemProps } = useListItemControl('radio', { ...props });
20
- const { ids, describedByIds } = useContext(ListItemContext);
21
-
22
- return (
23
- <RadioButton
24
- {...props}
25
- aria-describedby={describedByIds}
26
- className="wds-list-item-control"
27
- disabled={baseItemProps.disabled}
28
- id={ids.control}
29
- />
30
- );
31
- };
32
-
33
- Radio.displayName = 'ListItem.Radio';
@@ -1,2 +0,0 @@
1
- export type { ListItemRadioProps } from './ListItemRadio';
2
- export { Radio } from './ListItemRadio';
@@ -1,47 +0,0 @@
1
- import { render, screen } from '../../test-utils';
2
- import userEvent from '@testing-library/user-event';
3
- import { ListItem, type Props as ListItemProps } from '../ListItem';
4
-
5
- describe('ListItem.Switch', () => {
6
- const renderWith = (overrides: Partial<ListItemProps> = {}) =>
7
- render(<ListItem title="Test title" {...overrides} />);
8
-
9
- it('renders switch with correct role', () => {
10
- renderWith({ control: <ListItem.Switch checked={false} onClick={() => {}} /> });
11
- expect(screen.getByRole('switch')).toBeInTheDocument();
12
- });
13
-
14
- describe('checked state', () => {
15
- it('reflects checked state', () => {
16
- renderWith({ control: <ListItem.Switch checked onClick={() => {}} /> });
17
- expect(screen.getByRole('switch')).toBeChecked();
18
- });
19
-
20
- it('reflects unchecked state', () => {
21
- renderWith({ control: <ListItem.Switch checked={false} onClick={() => {}} /> });
22
- expect(screen.getByRole('switch')).not.toBeChecked();
23
- });
24
- });
25
-
26
- it('handles onClick events', async () => {
27
- const handleClick = jest.fn();
28
- renderWith({ control: <ListItem.Switch checked={false} onClick={handleClick} /> });
29
-
30
- await userEvent.click(screen.getByRole('switch'));
31
- expect(handleClick).toHaveBeenCalledTimes(1);
32
- });
33
-
34
- it('is disabled when ListItem is disabled', async () => {
35
- const handleClick = jest.fn();
36
- renderWith({
37
- disabled: true,
38
- control: <ListItem.Switch checked={false} onClick={handleClick} />,
39
- });
40
-
41
- const switchElement = screen.getByRole('switch');
42
- expect(switchElement).toBeDisabled();
43
-
44
- await userEvent.click(screen.getByRole('switch'));
45
- expect(handleClick).not.toHaveBeenCalled();
46
- });
47
- });
@@ -1,69 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { useState } from 'react';
3
- import { ListItem } from '../ListItem';
4
- import {
5
- SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
6
- SB_LIST_ITEM_MEDIA as MEDIA,
7
- } from '../_stories/subcomponents';
8
- import type { ListItemSwitchProps } from './ListItemSwitch';
9
- import { fn } from 'storybook/test';
10
- import { lorem10, lorem5 } from '../../test-utils';
11
-
12
- const meta: Meta<ListItemSwitchProps> = {
13
- component: ListItem.Switch,
14
- title: 'Content/ListItem/ListItem.Switch',
15
- parameters: {
16
- docs: {
17
- toc: true,
18
- },
19
- },
20
- args: {
21
- checked: false,
22
- onClick: fn(),
23
- },
24
- argTypes: {
25
- checked: {
26
- control: 'boolean',
27
- },
28
- },
29
- } satisfies Meta<ListItemSwitchProps>;
30
-
31
- export default meta;
32
-
33
- type Story = StoryObj<ListItemSwitchProps>;
34
-
35
- export const Playground: Story = {
36
- tags: ['!autodocs'],
37
- render: (args: ListItemSwitchProps) => {
38
- return (
39
- <ListItem
40
- title="List item with switch"
41
- subtitle="Toggle this setting"
42
- media={MEDIA.avatarSingle}
43
- control={<ListItem.Switch {...args} />}
44
- additionalInfo={INFO.nonInteractive}
45
- />
46
- );
47
- },
48
- };
49
-
50
- export const States: Story = {
51
- render: (args) => {
52
- return (
53
- <ol className="list-unstyled">
54
- <ListItem
55
- title={lorem5}
56
- subtitle={lorem10}
57
- media={MEDIA.avatarSingle}
58
- control={<ListItem.Switch {...args} checked />}
59
- />
60
- <ListItem
61
- key={lorem5}
62
- title={lorem10}
63
- media={MEDIA.avatarSingle}
64
- control={<ListItem.Switch {...args} />}
65
- />
66
- </ol>
67
- );
68
- },
69
- };
@@ -1,33 +0,0 @@
1
- import { useContext } from 'react';
2
- import SwitchComp, { type SwitchProps } from '../../switch';
3
- import { useListItemControl } from '../useListItemControl';
4
- import { ListItemContext } from '../ListItemContext';
5
-
6
- export type ListItemSwitchProps = Omit<
7
- SwitchProps,
8
- 'disabled' | 'id' | 'aria-labelledby' | 'aria-label'
9
- >;
10
-
11
- /**
12
- * This component allows for rendering a switch control within a fully interactive ListItem. <br />It's a thin wrapper around the
13
- * [CheckboxButton component](https://storybook.wise.design/?path=/docs/actions-switch--docs),
14
- * but offers only a subset of its features in line with the ListItem's constraints. <br />
15
- *
16
- * Please refer to the [Design documentation](https://wise.design/components/list-item---switch) for details.
17
- */
18
- export const Switch = function (props: ListItemSwitchProps) {
19
- const { baseItemProps } = useListItemControl('switch', { ...props });
20
- const { ids, describedByIds } = useContext(ListItemContext);
21
-
22
- return (
23
- <SwitchComp
24
- {...props}
25
- aria-describedby={describedByIds}
26
- className="wds-list-item-control"
27
- disabled={baseItemProps.disabled}
28
- id={ids.control}
29
- />
30
- );
31
- };
32
-
33
- Switch.displayName = 'ListItem.Switch';
@@ -1,2 +0,0 @@
1
- export type { ListItemSwitchProps } from './ListItemSwitch';
2
- export { Switch } from './ListItemSwitch';