@transferwise/components 0.0.0-experimental-4f2af7f → 0.0.0-experimental-8bbf3ee

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 (263) hide show
  1. package/build/actionOption/ActionOption.js.map +1 -1
  2. package/build/actionOption/ActionOption.mjs.map +1 -1
  3. package/build/checkboxOption/CheckboxOption.js.map +1 -1
  4. package/build/checkboxOption/CheckboxOption.mjs.map +1 -1
  5. package/build/index.js +0 -2
  6. package/build/index.js.map +1 -1
  7. package/build/index.mjs +0 -1
  8. package/build/index.mjs.map +1 -1
  9. package/build/legacylistItem/LegacyListItem.js.map +1 -1
  10. package/build/legacylistItem/LegacyListItem.mjs.map +1 -1
  11. package/build/main.css +1 -771
  12. package/build/navigationOption/NavigationOption.js.map +1 -1
  13. package/build/navigationOption/NavigationOption.mjs.map +1 -1
  14. package/build/navigationOptionsList/NavigationOptionsList.js.map +1 -1
  15. package/build/navigationOptionsList/NavigationOptionsList.mjs.map +1 -1
  16. package/build/radioOption/RadioOption.js.map +1 -1
  17. package/build/radioOption/RadioOption.mjs.map +1 -1
  18. package/build/styles/button/Button.css +1 -1
  19. package/build/styles/main.css +1 -771
  20. package/build/summary/Summary.js +0 -8
  21. package/build/summary/Summary.js.map +1 -1
  22. package/build/summary/Summary.mjs +0 -8
  23. package/build/summary/Summary.mjs.map +1 -1
  24. package/build/switchOption/SwitchOption.js +0 -8
  25. package/build/switchOption/SwitchOption.js.map +1 -1
  26. package/build/switchOption/SwitchOption.mjs +0 -8
  27. package/build/switchOption/SwitchOption.mjs.map +1 -1
  28. package/build/types/actionOption/ActionOption.d.ts +0 -8
  29. package/build/types/actionOption/ActionOption.d.ts.map +1 -1
  30. package/build/types/checkboxOption/CheckboxOption.d.ts +0 -8
  31. package/build/types/checkboxOption/CheckboxOption.d.ts.map +1 -1
  32. package/build/types/index.d.ts +0 -2
  33. package/build/types/index.d.ts.map +1 -1
  34. package/build/types/legacylistItem/LegacyListItem.d.ts +0 -8
  35. package/build/types/legacylistItem/LegacyListItem.d.ts.map +1 -1
  36. package/build/types/navigationOption/NavigationOption.d.ts +0 -8
  37. package/build/types/navigationOption/NavigationOption.d.ts.map +1 -1
  38. package/build/types/navigationOptionsList/NavigationOptionsList.d.ts +0 -9
  39. package/build/types/navigationOptionsList/NavigationOptionsList.d.ts.map +1 -1
  40. package/build/types/radioOption/RadioOption.d.ts +0 -8
  41. package/build/types/radioOption/RadioOption.d.ts.map +1 -1
  42. package/build/types/summary/Summary.d.ts +0 -8
  43. package/build/types/summary/Summary.d.ts.map +1 -1
  44. package/build/types/switchOption/SwitchOption.d.ts +0 -8
  45. package/build/types/switchOption/SwitchOption.d.ts.map +1 -1
  46. package/package.json +1 -1
  47. package/src/actionButton/ActionButton.story.tsx +1 -1
  48. package/src/actionOption/ActionOption.story.tsx +0 -4
  49. package/src/actionOption/ActionOption.tsx +0 -8
  50. package/src/avatar/Avatar.story.tsx +1 -1
  51. package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -1
  52. package/src/badge/Badge.story.tsx +1 -1
  53. package/src/button/Button.css +1 -1
  54. package/src/button/Button.less +1 -1
  55. package/src/button/Button.story.tsx +46 -10
  56. package/src/button/LegacyButton.story.tsx +1 -1
  57. package/src/checkboxOption/CheckboxOption.story.tsx +0 -4
  58. package/src/checkboxOption/CheckboxOption.tsx +0 -8
  59. package/src/index.ts +0 -15
  60. package/src/legacylistItem/LegacyListItem.story.tsx +1 -5
  61. package/src/legacylistItem/LegacyListItem.tests.story.tsx +1 -2
  62. package/src/legacylistItem/LegacyListItem.tsx +0 -8
  63. package/src/list/List.story.tsx +3 -13
  64. package/src/main.css +1 -771
  65. package/src/main.less +0 -1
  66. package/src/navigationOption/NavigationOption.story.tsx +1 -4
  67. package/src/navigationOption/NavigationOption.tsx +0 -8
  68. package/src/navigationOptionsList/NavigationOptionsList.story.tsx +0 -4
  69. package/src/navigationOptionsList/NavigationOptionsList.tsx +0 -9
  70. package/src/radioOption/RadioOption.story.tsx +0 -4
  71. package/src/radioOption/RadioOption.tsx +0 -8
  72. package/src/select/Select.story.tsx +1 -1
  73. package/src/summary/Summary.story.tsx +0 -4
  74. package/src/summary/Summary.tsx +0 -8
  75. package/src/switchOption/SwitchOption.story.tsx +1 -4
  76. package/src/switchOption/SwitchOption.tsx +0 -8
  77. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +0 -56
  78. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js.map +0 -1
  79. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +0 -54
  80. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs.map +0 -1
  81. package/build/listItem/AvatarLayout/ListItemAvatarLayout.js +0 -23
  82. package/build/listItem/AvatarLayout/ListItemAvatarLayout.js.map +0 -1
  83. package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs +0 -21
  84. package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs.map +0 -1
  85. package/build/listItem/AvatarView/ListItemAvatarView.js +0 -23
  86. package/build/listItem/AvatarView/ListItemAvatarView.js.map +0 -1
  87. package/build/listItem/AvatarView/ListItemAvatarView.mjs +0 -21
  88. package/build/listItem/AvatarView/ListItemAvatarView.mjs.map +0 -1
  89. package/build/listItem/Button/ListItemButton.js +0 -43
  90. package/build/listItem/Button/ListItemButton.js.map +0 -1
  91. package/build/listItem/Button/ListItemButton.mjs +0 -41
  92. package/build/listItem/Button/ListItemButton.mjs.map +0 -1
  93. package/build/listItem/Checkbox/ListItemCheckbox.js +0 -30
  94. package/build/listItem/Checkbox/ListItemCheckbox.js.map +0 -1
  95. package/build/listItem/Checkbox/ListItemCheckbox.mjs +0 -28
  96. package/build/listItem/Checkbox/ListItemCheckbox.mjs.map +0 -1
  97. package/build/listItem/IconButton/ListItemIconButton.js +0 -56
  98. package/build/listItem/IconButton/ListItemIconButton.js.map +0 -1
  99. package/build/listItem/IconButton/ListItemIconButton.mjs +0 -54
  100. package/build/listItem/IconButton/ListItemIconButton.mjs.map +0 -1
  101. package/build/listItem/Image/ListItemImage.js +0 -31
  102. package/build/listItem/Image/ListItemImage.js.map +0 -1
  103. package/build/listItem/Image/ListItemImage.mjs +0 -29
  104. package/build/listItem/Image/ListItemImage.mjs.map +0 -1
  105. package/build/listItem/ListItem.js +0 -309
  106. package/build/listItem/ListItem.js.map +0 -1
  107. package/build/listItem/ListItem.mjs +0 -304
  108. package/build/listItem/ListItem.mjs.map +0 -1
  109. package/build/listItem/ListItemContext.js +0 -8
  110. package/build/listItem/ListItemContext.js.map +0 -1
  111. package/build/listItem/ListItemContext.mjs +0 -6
  112. package/build/listItem/ListItemContext.mjs.map +0 -1
  113. package/build/listItem/Navigation/ListItemNavigation.js +0 -44
  114. package/build/listItem/Navigation/ListItemNavigation.js.map +0 -1
  115. package/build/listItem/Navigation/ListItemNavigation.mjs +0 -42
  116. package/build/listItem/Navigation/ListItemNavigation.mjs.map +0 -1
  117. package/build/listItem/Prompt/ListItemPrompt.js +0 -59
  118. package/build/listItem/Prompt/ListItemPrompt.js.map +0 -1
  119. package/build/listItem/Prompt/ListItemPrompt.mjs +0 -54
  120. package/build/listItem/Prompt/ListItemPrompt.mjs.map +0 -1
  121. package/build/listItem/Radio/ListItemRadio.js +0 -30
  122. package/build/listItem/Radio/ListItemRadio.js.map +0 -1
  123. package/build/listItem/Radio/ListItemRadio.mjs +0 -28
  124. package/build/listItem/Radio/ListItemRadio.mjs.map +0 -1
  125. package/build/listItem/Switch/ListItemSwitch.js +0 -30
  126. package/build/listItem/Switch/ListItemSwitch.js.map +0 -1
  127. package/build/listItem/Switch/ListItemSwitch.mjs +0 -28
  128. package/build/listItem/Switch/ListItemSwitch.mjs.map +0 -1
  129. package/build/listItem/useListItemControl.js +0 -22
  130. package/build/listItem/useListItemControl.js.map +0 -1
  131. package/build/listItem/useListItemControl.mjs +0 -20
  132. package/build/listItem/useListItemControl.mjs.map +0 -1
  133. package/build/listItem/useListItemMedia.js +0 -21
  134. package/build/listItem/useListItemMedia.js.map +0 -1
  135. package/build/listItem/useListItemMedia.mjs +0 -19
  136. package/build/listItem/useListItemMedia.mjs.map +0 -1
  137. package/build/styles/listItem/ListItem.css +0 -770
  138. package/build/styles/listItem/ListItem.grid.css +0 -370
  139. package/build/styles/listItem/Prompt/ListItemPrompt.css +0 -157
  140. package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts +0 -15
  141. package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts.map +0 -1
  142. package/build/types/listItem/AdditionalInfo/index.d.ts +0 -3
  143. package/build/types/listItem/AdditionalInfo/index.d.ts.map +0 -1
  144. package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts +0 -18
  145. package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts.map +0 -1
  146. package/build/types/listItem/AvatarLayout/index.d.ts +0 -3
  147. package/build/types/listItem/AvatarLayout/index.d.ts.map +0 -1
  148. package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts +0 -16
  149. package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts.map +0 -1
  150. package/build/types/listItem/AvatarView/index.d.ts +0 -3
  151. package/build/types/listItem/AvatarView/index.d.ts.map +0 -1
  152. package/build/types/listItem/Button/ListItemButton.d.ts +0 -20
  153. package/build/types/listItem/Button/ListItemButton.d.ts.map +0 -1
  154. package/build/types/listItem/Button/index.d.ts +0 -3
  155. package/build/types/listItem/Button/index.d.ts.map +0 -1
  156. package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts +0 -14
  157. package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts.map +0 -1
  158. package/build/types/listItem/Checkbox/index.d.ts +0 -3
  159. package/build/types/listItem/Checkbox/index.d.ts.map +0 -1
  160. package/build/types/listItem/IconButton/ListItemIconButton.d.ts +0 -18
  161. package/build/types/listItem/IconButton/ListItemIconButton.d.ts.map +0 -1
  162. package/build/types/listItem/IconButton/index.d.ts +0 -3
  163. package/build/types/listItem/IconButton/index.d.ts.map +0 -1
  164. package/build/types/listItem/Image/ListItemImage.d.ts +0 -25
  165. package/build/types/listItem/Image/ListItemImage.d.ts.map +0 -1
  166. package/build/types/listItem/Image/index.d.ts +0 -3
  167. package/build/types/listItem/Image/index.d.ts.map +0 -1
  168. package/build/types/listItem/ListItem.d.ts +0 -111
  169. package/build/types/listItem/ListItem.d.ts.map +0 -1
  170. package/build/types/listItem/ListItemContext.d.ts +0 -21
  171. package/build/types/listItem/ListItemContext.d.ts.map +0 -1
  172. package/build/types/listItem/Navigation/ListItemNavigation.d.ts +0 -15
  173. package/build/types/listItem/Navigation/ListItemNavigation.d.ts.map +0 -1
  174. package/build/types/listItem/Navigation/index.d.ts +0 -3
  175. package/build/types/listItem/Navigation/index.d.ts.map +0 -1
  176. package/build/types/listItem/Prompt/ListItemPrompt.d.ts +0 -16
  177. package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +0 -1
  178. package/build/types/listItem/Prompt/index.d.ts +0 -3
  179. package/build/types/listItem/Prompt/index.d.ts.map +0 -1
  180. package/build/types/listItem/Radio/ListItemRadio.d.ts +0 -14
  181. package/build/types/listItem/Radio/ListItemRadio.d.ts.map +0 -1
  182. package/build/types/listItem/Radio/index.d.ts +0 -3
  183. package/build/types/listItem/Radio/index.d.ts.map +0 -1
  184. package/build/types/listItem/Switch/ListItemSwitch.d.ts +0 -14
  185. package/build/types/listItem/Switch/ListItemSwitch.d.ts.map +0 -1
  186. package/build/types/listItem/Switch/index.d.ts +0 -3
  187. package/build/types/listItem/Switch/index.d.ts.map +0 -1
  188. package/build/types/listItem/_stories/helpers.d.ts +0 -27
  189. package/build/types/listItem/_stories/helpers.d.ts.map +0 -1
  190. package/build/types/listItem/_stories/subcomponents.d.ts +0 -18
  191. package/build/types/listItem/_stories/subcomponents.d.ts.map +0 -1
  192. package/build/types/listItem/index.d.ts +0 -14
  193. package/build/types/listItem/index.d.ts.map +0 -1
  194. package/build/types/listItem/test-utils.d.ts +0 -7
  195. package/build/types/listItem/test-utils.d.ts.map +0 -1
  196. package/build/types/listItem/useListItemControl.d.ts +0 -5
  197. package/build/types/listItem/useListItemControl.d.ts.map +0 -1
  198. package/build/types/listItem/useListItemMedia.d.ts +0 -6
  199. package/build/types/listItem/useListItemMedia.d.ts.map +0 -1
  200. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.spec.tsx +0 -56
  201. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +0 -198
  202. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.tsx +0 -36
  203. package/src/listItem/AdditionalInfo/index.ts +0 -2
  204. package/src/listItem/AvatarLayout/ListItemAvatarLayout.spec.tsx +0 -59
  205. package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +0 -124
  206. package/src/listItem/AvatarLayout/ListItemAvatarLayout.tsx +0 -27
  207. package/src/listItem/AvatarLayout/index.ts +0 -2
  208. package/src/listItem/AvatarView/ListItemAvatarView.spec.tsx +0 -75
  209. package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +0 -339
  210. package/src/listItem/AvatarView/ListItemAvatarView.tsx +0 -27
  211. package/src/listItem/AvatarView/index.ts +0 -2
  212. package/src/listItem/Button/ListItemButton.spec.tsx +0 -68
  213. package/src/listItem/Button/ListItemButton.story.tsx +0 -473
  214. package/src/listItem/Button/ListItemButton.tsx +0 -56
  215. package/src/listItem/Button/index.ts +0 -2
  216. package/src/listItem/Checkbox/ListItemCheckbox.spec.tsx +0 -82
  217. package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +0 -128
  218. package/src/listItem/Checkbox/ListItemCheckbox.tsx +0 -33
  219. package/src/listItem/Checkbox/index.ts +0 -2
  220. package/src/listItem/IconButton/ListItemIconButton.spec.tsx +0 -119
  221. package/src/listItem/IconButton/ListItemIconButton.story.tsx +0 -284
  222. package/src/listItem/IconButton/ListItemIconButton.tsx +0 -73
  223. package/src/listItem/IconButton/index.ts +0 -2
  224. package/src/listItem/Image/ListItemImage.spec.tsx +0 -30
  225. package/src/listItem/Image/ListItemImage.story.tsx +0 -80
  226. package/src/listItem/Image/ListItemImage.tsx +0 -46
  227. package/src/listItem/Image/index.ts +0 -2
  228. package/src/listItem/ListItem.css +0 -770
  229. package/src/listItem/ListItem.grid.css +0 -370
  230. package/src/listItem/ListItem.grid.less +0 -622
  231. package/src/listItem/ListItem.less +0 -287
  232. package/src/listItem/ListItem.spec.tsx +0 -1511
  233. package/src/listItem/ListItem.tsx +0 -438
  234. package/src/listItem/ListItemContext.tsx +0 -26
  235. package/src/listItem/Navigation/ListItemNavigation.spec.tsx +0 -59
  236. package/src/listItem/Navigation/ListItemNavigation.story.tsx +0 -112
  237. package/src/listItem/Navigation/ListItemNavigation.tsx +0 -39
  238. package/src/listItem/Navigation/index.ts +0 -2
  239. package/src/listItem/Prompt/ListItemPrompt.css +0 -157
  240. package/src/listItem/Prompt/ListItemPrompt.less +0 -134
  241. package/src/listItem/Prompt/ListItemPrompt.spec.tsx +0 -36
  242. package/src/listItem/Prompt/ListItemPrompt.story.tsx +0 -204
  243. package/src/listItem/Prompt/ListItemPrompt.tsx +0 -32
  244. package/src/listItem/Prompt/index.ts +0 -2
  245. package/src/listItem/Radio/ListItemRadio.spec.tsx +0 -66
  246. package/src/listItem/Radio/ListItemRadio.story.tsx +0 -111
  247. package/src/listItem/Radio/ListItemRadio.tsx +0 -33
  248. package/src/listItem/Radio/index.ts +0 -2
  249. package/src/listItem/Switch/ListItemSwitch.spec.tsx +0 -47
  250. package/src/listItem/Switch/ListItemSwitch.story.tsx +0 -79
  251. package/src/listItem/Switch/ListItemSwitch.tsx +0 -33
  252. package/src/listItem/Switch/index.ts +0 -2
  253. package/src/listItem/_stories/ListItem.focus.test.story.tsx +0 -265
  254. package/src/listItem/_stories/ListItem.layout.test.story.tsx +0 -354
  255. package/src/listItem/_stories/ListItem.scenarios.story.tsx +0 -228
  256. package/src/listItem/_stories/ListItem.story.tsx +0 -774
  257. package/src/listItem/_stories/ListItem.variants.test.story.tsx +0 -271
  258. package/src/listItem/_stories/helpers.tsx +0 -53
  259. package/src/listItem/_stories/subcomponents.tsx +0 -139
  260. package/src/listItem/index.ts +0 -14
  261. package/src/listItem/test-utils.tsx +0 -33
  262. package/src/listItem/useListItemControl.tsx +0 -18
  263. package/src/listItem/useListItemMedia.tsx +0 -16
@@ -1,198 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { fn } from 'storybook/test';
3
- import { action } from 'storybook/actions';
4
- import { lorem20 } from '../../test-utils';
5
- import List from '../../list';
6
- import { ListItem } from '../ListItem';
7
- import {
8
- SB_LIST_ITEM_CONTROLS as CONTROLS,
9
- SB_LIST_ITEM_MEDIA as MEDIA,
10
- } from '../_stories/subcomponents';
11
- import { disableControls } from '../_stories/helpers';
12
- import type { ListItemAdditionalInfoProps } from './ListItemAdditionalInfo';
13
-
14
- /**
15
- * Use additional information to add extra details that help make the information clearer for users. Use additional information only after you've used the subtitle.
16
- *
17
- * Refer to the [design documentation](https://wise.design/components/list-item#content:~:text=StatusIcon.iconLabel.error-,Additional%20information,-Use%20additional%20information) for more details.
18
- */
19
- export default {
20
- component: ListItem.AdditionalInfo,
21
- title: 'Content/ListItem/ListItem.AdditionalInfo',
22
- parameters: {
23
- docs: {
24
- toc: true,
25
- },
26
- },
27
- args: {
28
- children: lorem20,
29
- },
30
- argTypes: {
31
- children: {
32
- table: {
33
- type: { summary: 'ReactNode' },
34
- },
35
- },
36
- action: {
37
- table: {
38
- type: { summary: `{ label: string } & Pick<LinkProps, 'href' | 'onClick' | 'target'>` },
39
- },
40
- },
41
- },
42
- } satisfies Meta<ListItemAdditionalInfoProps>;
43
-
44
- type Story = StoryObj<ListItemAdditionalInfoProps>;
45
-
46
- /**
47
- * Convenience controls for previewing rich markup,
48
- * not otherwise possible via Storybook
49
- */
50
- type PreviewStoryArgs = ListItemAdditionalInfoProps & {
51
- previewAction?: string | ListItemAdditionalInfoProps['action'];
52
- };
53
-
54
- const previewArgGroup = {
55
- category: 'Preview options',
56
- type: {
57
- summary: undefined,
58
- },
59
- };
60
-
61
- const previewArgTypes = {
62
- previewAction: {
63
- name: 'Preview `action`',
64
- control: 'radio',
65
- options: ['unset (undefined)', 'link', 'button'],
66
- mapping: {
67
- 'unset (undefined)': undefined,
68
- link: {
69
- label: 'Details about the subject.',
70
- href: 'https://wise.com',
71
- target: '_blank',
72
- },
73
- button: {
74
- label: 'Details about the subject.',
75
- onClick: fn(),
76
- },
77
- },
78
- table: previewArgGroup,
79
- },
80
- } as const;
81
-
82
- export const Playground: StoryObj<PreviewStoryArgs> = {
83
- tags: ['!autodocs'],
84
- argTypes: previewArgTypes,
85
- args: {
86
- children: lorem20,
87
- previewAction: 'link',
88
- },
89
- render: (args: PreviewStoryArgs) => {
90
- const { previewAction, ...props } = args as {
91
- previewAction: ListItemAdditionalInfoProps['action'];
92
- props: ListItemAdditionalInfoProps;
93
- };
94
-
95
- return (
96
- <List>
97
- <ListItem
98
- title="List item title"
99
- subtitle="Subtitle goes here"
100
- media={MEDIA.avatarSingle}
101
- control={CONTROLS.partialButton}
102
- additionalInfo={<ListItem.AdditionalInfo {...props} action={previewAction} />}
103
- />
104
- </List>
105
- );
106
- },
107
- };
108
-
109
- /**
110
- * Fully interactive ListItems do not allow for any nested links or inline buttons as that would fail accessibility compliance.
111
- *
112
- * Non-interactive or partially-interactive ListItems allow appending a single link or inline button via `action` prop. The restriction has been introduced to ensure that the ListItem remains accessible and adheres to the vendors' best practices for mobile platforms.
113
- */
114
- export const Interactivity: Story = {
115
- args: {
116
- action: {
117
- label: 'Details about the subject.',
118
- href: 'https://wise.com',
119
- target: '_blank',
120
- },
121
- },
122
- argTypes: disableControls()(['action']),
123
- render: (args: ListItemAdditionalInfoProps) => {
124
- return (
125
- <List>
126
- <ListItem
127
- title="Fully interactive ListItem"
128
- subtitle="Subtitle goes here"
129
- media={MEDIA.avatarSingle}
130
- control={CONTROLS.button}
131
- additionalInfo={<ListItem.AdditionalInfo {...args} action={undefined} />}
132
- />
133
-
134
- <ListItem
135
- title="Partially interactive ListItem"
136
- subtitle="Subtitle goes here"
137
- media={MEDIA.avatarSingle}
138
- control={CONTROLS.partialButton}
139
- additionalInfo={<ListItem.AdditionalInfo {...args} />}
140
- />
141
-
142
- <ListItem
143
- title="Non-interactive ListItem"
144
- subtitle="Subtitle goes here"
145
- media={MEDIA.avatarSingle}
146
- additionalInfo={<ListItem.AdditionalInfo {...args} />}
147
- />
148
- </List>
149
- );
150
- },
151
- };
152
-
153
- /**
154
- * Interactive `ListItem.AdditionalInfo` allows for 2 types of actions: a link or a button.
155
- */
156
- export const Actions: Story = {
157
- argTypes: disableControls()(['action']),
158
- render: (args: ListItemAdditionalInfoProps) => {
159
- return (
160
- <List>
161
- <ListItem
162
- title="Partially interactive ListItem"
163
- subtitle="Subtitle goes here"
164
- media={MEDIA.avatarSingle}
165
- control={CONTROLS.partialButton}
166
- additionalInfo={
167
- <ListItem.AdditionalInfo
168
- {...args}
169
- action={{
170
- label: 'I am a link.',
171
- href: 'https://wise.com',
172
- target: '_blank',
173
- }}
174
- />
175
- }
176
- />
177
-
178
- <ListItem
179
- title="Partially interactive ListItem"
180
- subtitle="Subtitle goes here"
181
- media={MEDIA.avatarSingle}
182
- control={CONTROLS.partialButton}
183
- additionalInfo={
184
- <ListItem.AdditionalInfo
185
- {...args}
186
- action={{
187
- label: 'I am a button.',
188
- onClick: () => {
189
- action('Button clicked')();
190
- },
191
- }}
192
- />
193
- }
194
- />
195
- </List>
196
- );
197
- },
198
- };
@@ -1,36 +0,0 @@
1
- import { PropsWithChildren, useContext } from 'react';
2
- import { ListItemContext, type ListItemContextData } from '../ListItemContext';
3
- import Body from '../../body';
4
- import Link, { type LinkProps } from '../../link';
5
- import { Typography } from '../../common';
6
-
7
- export type ListItemAdditionalInfoProps = PropsWithChildren<{
8
- /**
9
- * Props object to be passed to the [Link](https://storybook.wise.design/?path=/docs/typography-link--docs) component.
10
- */
11
- action?: { label: string } & Pick<LinkProps, 'href' | 'onClick' | 'target'>;
12
- }>;
13
-
14
- export const AdditionalInfo = function ({ children, action }: ListItemAdditionalInfoProps) {
15
- const { ids } = useContext<ListItemContextData>(ListItemContext);
16
-
17
- return (
18
- <Body
19
- type={Typography.BODY_DEFAULT}
20
- id={ids.additionalInfo}
21
- className="wds-list-item-additional-info"
22
- >
23
- {children}
24
- {action ? (
25
- <>
26
- {' '}
27
- <Link href={action.href} target={action.target} onClick={action.onClick}>
28
- {action.label}
29
- </Link>
30
- </>
31
- ) : null}
32
- </Body>
33
- );
34
- };
35
-
36
- AdditionalInfo.displayName = 'ListItem.AdditionalInfo';
@@ -1,2 +0,0 @@
1
- export type { ListItemAdditionalInfoProps } from './ListItemAdditionalInfo';
2
- export { AdditionalInfo } from './ListItemAdditionalInfo';
@@ -1,59 +0,0 @@
1
- import { mockMatchMedia, render, screen } from '../../test-utils';
2
- import { ListItem, type ListItemProps } from '../ListItem';
3
-
4
- mockMatchMedia();
5
-
6
- const avatars = [
7
- { imgSrc: 'avatar1.jpg', profileName: 'User 1' },
8
- { imgSrc: 'avatar2.jpg', profileName: 'User 2' },
9
- ];
10
-
11
- const renderWithMedia = (media: ListItemProps['media']) =>
12
- render(<ListItem title="Test Title" media={media} />);
13
-
14
- describe('ListItem.AvatarLayout', () => {
15
- it('applies custom className alongside default class', () => {
16
- renderWithMedia(
17
- <ListItem.AvatarLayout
18
- className="custom-class"
19
- role="group"
20
- aria-label="Custom avatar group"
21
- avatars={avatars}
22
- />,
23
- );
24
-
25
- expect(screen.getByRole('group', { name: 'Custom avatar group' })).toHaveClass('custom-class');
26
- });
27
-
28
- it('renders both avatars', () => {
29
- renderWithMedia(<ListItem.AvatarLayout avatars={avatars} />);
30
-
31
- const images = screen.getAllByRole('presentation');
32
- expect(images).toHaveLength(avatars.length);
33
- expect(images[0]).toHaveAttribute('src', avatars[0].imgSrc);
34
- expect(images[1]).toHaveAttribute('src', avatars[1].imgSrc);
35
- });
36
-
37
- it('renders with single avatar', () => {
38
- renderWithMedia(<ListItem.AvatarLayout avatars={[avatars[0]]} />);
39
- expect(screen.getByRole('presentation')).toHaveAttribute('src', avatars[0].imgSrc);
40
- });
41
-
42
- it('handles empty avatars array', () => {
43
- renderWithMedia(<ListItem.AvatarLayout avatars={[]} />);
44
- expect(screen.queryByRole('img')).not.toBeInTheDocument();
45
- });
46
-
47
- it('supports accessibility props', () => {
48
- renderWithMedia(<ListItem.AvatarLayout aria-label="User avatars" avatars={avatars} />);
49
- expect(screen.getByLabelText('User avatars')).toBeInTheDocument();
50
- });
51
-
52
- it('passes through role', () => {
53
- renderWithMedia(
54
- <ListItem.AvatarLayout role="group" aria-label="Avatar group" avatars={avatars} />,
55
- );
56
-
57
- expect(screen.getByRole('group', { name: 'Avatar group' })).toBeInTheDocument();
58
- });
59
- });
@@ -1,124 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { Flag } from '@wise/art';
3
- import { lorem10 } from '../../test-utils';
4
- import { ListItem } from '../ListItem';
5
- import List from '../../list';
6
- import {
7
- SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
8
- SB_LIST_ITEM_CONTROLS as CONTROLS,
9
- } from '../_stories/subcomponents';
10
- import { disableControls } from '../_stories/helpers';
11
- import type { ListItemAvatarLayoutProps } from './ListItemAvatarLayout';
12
-
13
- export default {
14
- component: ListItem.AvatarLayout,
15
- title: 'Content/ListItem/ListItem.AvatarLayout',
16
- parameters: {
17
- docs: {
18
- toc: true,
19
- },
20
- },
21
- args: {
22
- avatars: [{ asset: <Flag code="gb" /> }, { asset: <Flag code="eur" /> }],
23
- orientation: 'horizontal',
24
- size: 48,
25
- },
26
- argTypes: {
27
- avatars: {
28
- description: 'Array of avatar objects with asset and optional styling properties',
29
- table: {
30
- type: { summary: 'SingleAvatarType[]' },
31
- },
32
- },
33
- orientation: {
34
- control: 'inline-radio',
35
- options: ['horizontal', 'diagonal'],
36
- description: 'Layout orientation for multiple avatars',
37
- },
38
- size: {
39
- control: 'select',
40
- options: [32, 40, 48, 56, 72],
41
- description: 'Size of the avatar layout',
42
- },
43
- },
44
- } satisfies Meta<ListItemAvatarLayoutProps>;
45
-
46
- type Story = StoryObj<ListItemAvatarLayoutProps>;
47
-
48
- export const Playground: Story = {
49
- tags: ['!autodocs'],
50
- render: (args: ListItemAvatarLayoutProps) => {
51
- return (
52
- <List>
53
- <ListItem
54
- title="Transfer from GBP to EUR"
55
- subtitle="Currency exchange"
56
- media={<ListItem.AvatarLayout {...args} />}
57
- control={CONTROLS.iconButton}
58
- additionalInfo={INFO.nonInteractive}
59
- />
60
- </List>
61
- );
62
- },
63
- };
64
-
65
- /**
66
- * AvatarLayout supports two orientations: horizontal (default) and diagonal. <br />
67
- * Please refer to the [design documentation](https://wise.design/components/avatar#double) for more details.
68
- */
69
- export const Orientations: Story = {
70
- argTypes: disableControls()(['orientation']),
71
- render: (args) => {
72
- return (
73
- <List>
74
- <ListItem
75
- title="Horizontal orientation"
76
- subtitle={lorem10}
77
- media={<ListItem.AvatarLayout {...args} orientation="horizontal" />}
78
- control={CONTROLS.iconButton}
79
- />
80
-
81
- <ListItem
82
- title="Diagonal orientation"
83
- subtitle={lorem10}
84
- media={<ListItem.AvatarLayout {...args} orientation="diagonal" />}
85
- control={CONTROLS.iconButton}
86
- />
87
- </List>
88
- );
89
- },
90
- };
91
-
92
- /**
93
- * AvatarLayout supports various sizes to fit different list item contexts.
94
- */
95
- export const Sizes: Story = {
96
- parameters: {
97
- docs: {
98
- canvas: {
99
- sourceState: 'hidden',
100
- },
101
- },
102
- },
103
- argTypes: disableControls()(['size', 'orientation']),
104
- render: (args) => {
105
- const sizes = [32, 40, 48, 56, 72] as const;
106
- const orientations = ['horizontal', 'diagonal'] as const;
107
-
108
- return (
109
- <List>
110
- {orientations.map((orientation) =>
111
- sizes.map((size) => (
112
- <ListItem
113
- key={`${orientation}-${size}`}
114
- title={`Size ${size}`}
115
- subtitle={lorem10}
116
- media={<ListItem.AvatarLayout {...args} size={size} orientation={orientation} />}
117
- control={CONTROLS.iconButton}
118
- />
119
- )),
120
- )}
121
- </List>
122
- );
123
- },
124
- };
@@ -1,27 +0,0 @@
1
- import AvatarLayoutComp, { type AvatarLayoutProps } from '../../avatarLayout';
2
- import { clsx } from 'clsx';
3
- import { useListItemMedia } from '../useListItemMedia';
4
-
5
- type SizeProp = { size?: 32 | 40 | 48 | 56 | 72 };
6
-
7
- export type ListItemAvatarLayoutProps = Omit<AvatarLayoutProps, 'size' | 'interactive'> & SizeProp;
8
-
9
- /**
10
- * This component allows for rendering 2 avatars. It's a thin wrapper around the
11
- * [AvatarLayout component](https://storybook.wise.design/?path=/docs/content-avatarlayout--docs), but offers only
12
- * a subset of its sizes, and disallows interactive mode, in line with the ListItem's constraints. <br />
13
- * <br />
14
- * Please refer to the [Design documentation](https://wise.design/components/list-item#avatar) for details.
15
- */
16
- export const AvatarLayout = ({ className, size = 48, ...props }: ListItemAvatarLayoutProps) => {
17
- useListItemMedia(size);
18
-
19
- return (
20
- <AvatarLayoutComp
21
- {...props}
22
- size={size}
23
- className={clsx('wds-list-item-media-avatar-layout', className)}
24
- />
25
- );
26
- };
27
- AvatarLayout.displayName = 'ListItem.AvatarLayout';
@@ -1,2 +0,0 @@
1
- export type { ListItemAvatarLayoutProps } from './ListItemAvatarLayout';
2
- export { AvatarLayout } from './ListItemAvatarLayout';
@@ -1,75 +0,0 @@
1
- import { mockMatchMedia, render, screen } from '../../test-utils';
2
- import { ListItem, type ListItemProps } from '../ListItem';
3
-
4
- mockMatchMedia();
5
-
6
- const baseProps = {
7
- title: 'Test Title',
8
- };
9
-
10
- const avatarProps = {
11
- imgSrc: 'avatar.jpg',
12
- profileName: 'User Avatar',
13
- };
14
-
15
- const renderWithMedia = (media: ListItemProps['media']) =>
16
- render(<ListItem title={baseProps.title} media={media} />);
17
-
18
- describe('ListItem.AvatarView', () => {
19
- it('applies custom className alongside default class', () => {
20
- const { container } = renderWithMedia(
21
- <ListItem.AvatarView
22
- className="custom-class"
23
- imgSrc={avatarProps.imgSrc}
24
- profileName={avatarProps.profileName}
25
- />,
26
- );
27
-
28
- expect(container.querySelector('.custom-class')).toBeInTheDocument();
29
- });
30
-
31
- it('renders avatar with correct image src', () => {
32
- renderWithMedia(
33
- <ListItem.AvatarView imgSrc={avatarProps.imgSrc} profileName={avatarProps.profileName} />,
34
- );
35
-
36
- expect(screen.getByRole('presentation')).toHaveAttribute('src', avatarProps.imgSrc);
37
- });
38
-
39
- it('renders without image when no imgSrc provided', () => {
40
- renderWithMedia(<ListItem.AvatarView profileName={avatarProps.profileName} />);
41
- expect(screen.queryByRole('img')).not.toBeInTheDocument();
42
- });
43
-
44
- it('supports accessibility props', () => {
45
- renderWithMedia(
46
- <ListItem.AvatarView
47
- imgSrc={avatarProps.imgSrc}
48
- profileName={avatarProps.profileName}
49
- aria-label="Profile picture"
50
- />,
51
- );
52
-
53
- expect(screen.getByLabelText('Profile picture')).toBeInTheDocument();
54
- });
55
-
56
- it('passes through role attribute', () => {
57
- renderWithMedia(
58
- <ListItem.AvatarView
59
- imgSrc={avatarProps.imgSrc}
60
- profileName={avatarProps.profileName}
61
- role="button"
62
- aria-label="Profile button"
63
- />,
64
- );
65
-
66
- expect(screen.getByRole('button', { name: 'Profile button' })).toBeInTheDocument();
67
- });
68
-
69
- it('renders initials when no image provided', () => {
70
- const johnDoeProfile = 'John Doe';
71
- renderWithMedia(<ListItem.AvatarView profileName={johnDoeProfile} />);
72
-
73
- expect(screen.getByText('JD')).toBeInTheDocument();
74
- });
75
- });