@transferwise/components 46.103.1 → 46.104.0

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 (209) hide show
  1. package/build/index.js +2 -0
  2. package/build/index.js.map +1 -1
  3. package/build/index.mjs +1 -0
  4. package/build/index.mjs.map +1 -1
  5. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +56 -0
  6. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js.map +1 -0
  7. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +54 -0
  8. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs.map +1 -0
  9. package/build/listItem/AvatarLayout/ListItemAvatarLayout.js +23 -0
  10. package/build/listItem/AvatarLayout/ListItemAvatarLayout.js.map +1 -0
  11. package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs +21 -0
  12. package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs.map +1 -0
  13. package/build/listItem/AvatarView/ListItemAvatarView.js +23 -0
  14. package/build/listItem/AvatarView/ListItemAvatarView.js.map +1 -0
  15. package/build/listItem/AvatarView/ListItemAvatarView.mjs +21 -0
  16. package/build/listItem/AvatarView/ListItemAvatarView.mjs.map +1 -0
  17. package/build/listItem/Button/ListItemButton.js +43 -0
  18. package/build/listItem/Button/ListItemButton.js.map +1 -0
  19. package/build/listItem/Button/ListItemButton.mjs +41 -0
  20. package/build/listItem/Button/ListItemButton.mjs.map +1 -0
  21. package/build/listItem/Checkbox/ListItemCheckbox.js +30 -0
  22. package/build/listItem/Checkbox/ListItemCheckbox.js.map +1 -0
  23. package/build/listItem/Checkbox/ListItemCheckbox.mjs +28 -0
  24. package/build/listItem/Checkbox/ListItemCheckbox.mjs.map +1 -0
  25. package/build/listItem/IconButton/ListItemIconButton.js +56 -0
  26. package/build/listItem/IconButton/ListItemIconButton.js.map +1 -0
  27. package/build/listItem/IconButton/ListItemIconButton.mjs +54 -0
  28. package/build/listItem/IconButton/ListItemIconButton.mjs.map +1 -0
  29. package/build/listItem/Image/ListItemImage.js +31 -0
  30. package/build/listItem/Image/ListItemImage.js.map +1 -0
  31. package/build/listItem/Image/ListItemImage.mjs +29 -0
  32. package/build/listItem/Image/ListItemImage.mjs.map +1 -0
  33. package/build/listItem/ListItem.js +309 -0
  34. package/build/listItem/ListItem.js.map +1 -0
  35. package/build/listItem/ListItem.mjs +304 -0
  36. package/build/listItem/ListItem.mjs.map +1 -0
  37. package/build/listItem/ListItemContext.js +8 -0
  38. package/build/listItem/ListItemContext.js.map +1 -0
  39. package/build/listItem/ListItemContext.mjs +6 -0
  40. package/build/listItem/ListItemContext.mjs.map +1 -0
  41. package/build/listItem/Navigation/ListItemNavigation.js +44 -0
  42. package/build/listItem/Navigation/ListItemNavigation.js.map +1 -0
  43. package/build/listItem/Navigation/ListItemNavigation.mjs +42 -0
  44. package/build/listItem/Navigation/ListItemNavigation.mjs.map +1 -0
  45. package/build/listItem/Prompt/ListItemPrompt.js +59 -0
  46. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -0
  47. package/build/listItem/Prompt/ListItemPrompt.mjs +54 -0
  48. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -0
  49. package/build/listItem/Radio/ListItemRadio.js +30 -0
  50. package/build/listItem/Radio/ListItemRadio.js.map +1 -0
  51. package/build/listItem/Radio/ListItemRadio.mjs +28 -0
  52. package/build/listItem/Radio/ListItemRadio.mjs.map +1 -0
  53. package/build/listItem/Switch/ListItemSwitch.js +30 -0
  54. package/build/listItem/Switch/ListItemSwitch.js.map +1 -0
  55. package/build/listItem/Switch/ListItemSwitch.mjs +28 -0
  56. package/build/listItem/Switch/ListItemSwitch.mjs.map +1 -0
  57. package/build/listItem/useListItemControl.js +22 -0
  58. package/build/listItem/useListItemControl.js.map +1 -0
  59. package/build/listItem/useListItemControl.mjs +20 -0
  60. package/build/listItem/useListItemControl.mjs.map +1 -0
  61. package/build/listItem/useListItemMedia.js +21 -0
  62. package/build/listItem/useListItemMedia.js.map +1 -0
  63. package/build/listItem/useListItemMedia.mjs +19 -0
  64. package/build/listItem/useListItemMedia.mjs.map +1 -0
  65. package/build/main.css +770 -0
  66. package/build/styles/listItem/ListItem.css +770 -0
  67. package/build/styles/listItem/ListItem.grid.css +370 -0
  68. package/build/styles/listItem/Prompt/ListItemPrompt.css +157 -0
  69. package/build/styles/main.css +770 -0
  70. package/build/types/index.d.ts +2 -0
  71. package/build/types/index.d.ts.map +1 -1
  72. package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts +15 -0
  73. package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts.map +1 -0
  74. package/build/types/listItem/AdditionalInfo/index.d.ts +3 -0
  75. package/build/types/listItem/AdditionalInfo/index.d.ts.map +1 -0
  76. package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts +18 -0
  77. package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts.map +1 -0
  78. package/build/types/listItem/AvatarLayout/index.d.ts +3 -0
  79. package/build/types/listItem/AvatarLayout/index.d.ts.map +1 -0
  80. package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts +16 -0
  81. package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts.map +1 -0
  82. package/build/types/listItem/AvatarView/index.d.ts +3 -0
  83. package/build/types/listItem/AvatarView/index.d.ts.map +1 -0
  84. package/build/types/listItem/Button/ListItemButton.d.ts +20 -0
  85. package/build/types/listItem/Button/ListItemButton.d.ts.map +1 -0
  86. package/build/types/listItem/Button/index.d.ts +3 -0
  87. package/build/types/listItem/Button/index.d.ts.map +1 -0
  88. package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts +14 -0
  89. package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts.map +1 -0
  90. package/build/types/listItem/Checkbox/index.d.ts +3 -0
  91. package/build/types/listItem/Checkbox/index.d.ts.map +1 -0
  92. package/build/types/listItem/IconButton/ListItemIconButton.d.ts +18 -0
  93. package/build/types/listItem/IconButton/ListItemIconButton.d.ts.map +1 -0
  94. package/build/types/listItem/IconButton/index.d.ts +3 -0
  95. package/build/types/listItem/IconButton/index.d.ts.map +1 -0
  96. package/build/types/listItem/Image/ListItemImage.d.ts +25 -0
  97. package/build/types/listItem/Image/ListItemImage.d.ts.map +1 -0
  98. package/build/types/listItem/Image/index.d.ts +3 -0
  99. package/build/types/listItem/Image/index.d.ts.map +1 -0
  100. package/build/types/listItem/ListItem.d.ts +111 -0
  101. package/build/types/listItem/ListItem.d.ts.map +1 -0
  102. package/build/types/listItem/ListItemContext.d.ts +21 -0
  103. package/build/types/listItem/ListItemContext.d.ts.map +1 -0
  104. package/build/types/listItem/Navigation/ListItemNavigation.d.ts +15 -0
  105. package/build/types/listItem/Navigation/ListItemNavigation.d.ts.map +1 -0
  106. package/build/types/listItem/Navigation/index.d.ts +3 -0
  107. package/build/types/listItem/Navigation/index.d.ts.map +1 -0
  108. package/build/types/listItem/Prompt/ListItemPrompt.d.ts +16 -0
  109. package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +1 -0
  110. package/build/types/listItem/Prompt/index.d.ts +3 -0
  111. package/build/types/listItem/Prompt/index.d.ts.map +1 -0
  112. package/build/types/listItem/Radio/ListItemRadio.d.ts +14 -0
  113. package/build/types/listItem/Radio/ListItemRadio.d.ts.map +1 -0
  114. package/build/types/listItem/Radio/index.d.ts +3 -0
  115. package/build/types/listItem/Radio/index.d.ts.map +1 -0
  116. package/build/types/listItem/Switch/ListItemSwitch.d.ts +14 -0
  117. package/build/types/listItem/Switch/ListItemSwitch.d.ts.map +1 -0
  118. package/build/types/listItem/Switch/index.d.ts +3 -0
  119. package/build/types/listItem/Switch/index.d.ts.map +1 -0
  120. package/build/types/listItem/_stories/helpers.d.ts +27 -0
  121. package/build/types/listItem/_stories/helpers.d.ts.map +1 -0
  122. package/build/types/listItem/_stories/subcomponents.d.ts +18 -0
  123. package/build/types/listItem/_stories/subcomponents.d.ts.map +1 -0
  124. package/build/types/listItem/index.d.ts +14 -0
  125. package/build/types/listItem/index.d.ts.map +1 -0
  126. package/build/types/listItem/test-utils.d.ts +7 -0
  127. package/build/types/listItem/test-utils.d.ts.map +1 -0
  128. package/build/types/listItem/useListItemControl.d.ts +5 -0
  129. package/build/types/listItem/useListItemControl.d.ts.map +1 -0
  130. package/build/types/listItem/useListItemMedia.d.ts +6 -0
  131. package/build/types/listItem/useListItemMedia.d.ts.map +1 -0
  132. package/package.json +3 -3
  133. package/src/actionButton/ActionButton.story.tsx +1 -1
  134. package/src/avatar/Avatar.story.tsx +1 -1
  135. package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -1
  136. package/src/badge/Badge.story.tsx +1 -1
  137. package/src/button/Button.story.tsx +1 -0
  138. package/src/button/LegacyButton.story.tsx +1 -1
  139. package/src/index.ts +15 -0
  140. package/src/legacylistItem/LegacyListItem.story.tsx +1 -1
  141. package/src/legacylistItem/LegacyListItem.tests.story.tsx +2 -1
  142. package/src/list/List.story.tsx +13 -3
  143. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.spec.tsx +56 -0
  144. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +198 -0
  145. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.tsx +36 -0
  146. package/src/listItem/AdditionalInfo/index.ts +2 -0
  147. package/src/listItem/AvatarLayout/ListItemAvatarLayout.spec.tsx +59 -0
  148. package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +124 -0
  149. package/src/listItem/AvatarLayout/ListItemAvatarLayout.tsx +27 -0
  150. package/src/listItem/AvatarLayout/index.ts +2 -0
  151. package/src/listItem/AvatarView/ListItemAvatarView.spec.tsx +75 -0
  152. package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +339 -0
  153. package/src/listItem/AvatarView/ListItemAvatarView.tsx +27 -0
  154. package/src/listItem/AvatarView/index.ts +2 -0
  155. package/src/listItem/Button/ListItemButton.spec.tsx +68 -0
  156. package/src/listItem/Button/ListItemButton.story.tsx +473 -0
  157. package/src/listItem/Button/ListItemButton.tsx +56 -0
  158. package/src/listItem/Button/index.ts +2 -0
  159. package/src/listItem/Checkbox/ListItemCheckbox.spec.tsx +82 -0
  160. package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +128 -0
  161. package/src/listItem/Checkbox/ListItemCheckbox.tsx +33 -0
  162. package/src/listItem/Checkbox/index.ts +2 -0
  163. package/src/listItem/IconButton/ListItemIconButton.spec.tsx +119 -0
  164. package/src/listItem/IconButton/ListItemIconButton.story.tsx +284 -0
  165. package/src/listItem/IconButton/ListItemIconButton.tsx +73 -0
  166. package/src/listItem/IconButton/index.ts +2 -0
  167. package/src/listItem/Image/ListItemImage.spec.tsx +30 -0
  168. package/src/listItem/Image/ListItemImage.story.tsx +80 -0
  169. package/src/listItem/Image/ListItemImage.tsx +46 -0
  170. package/src/listItem/Image/index.ts +2 -0
  171. package/src/listItem/ListItem.css +770 -0
  172. package/src/listItem/ListItem.grid.css +370 -0
  173. package/src/listItem/ListItem.grid.less +622 -0
  174. package/src/listItem/ListItem.less +287 -0
  175. package/src/listItem/ListItem.spec.tsx +1511 -0
  176. package/src/listItem/ListItem.tsx +438 -0
  177. package/src/listItem/ListItemContext.tsx +26 -0
  178. package/src/listItem/Navigation/ListItemNavigation.spec.tsx +59 -0
  179. package/src/listItem/Navigation/ListItemNavigation.story.tsx +112 -0
  180. package/src/listItem/Navigation/ListItemNavigation.tsx +39 -0
  181. package/src/listItem/Navigation/index.ts +2 -0
  182. package/src/listItem/Prompt/ListItemPrompt.css +157 -0
  183. package/src/listItem/Prompt/ListItemPrompt.less +134 -0
  184. package/src/listItem/Prompt/ListItemPrompt.spec.tsx +36 -0
  185. package/src/listItem/Prompt/ListItemPrompt.story.tsx +204 -0
  186. package/src/listItem/Prompt/ListItemPrompt.tsx +32 -0
  187. package/src/listItem/Prompt/index.ts +2 -0
  188. package/src/listItem/Radio/ListItemRadio.spec.tsx +66 -0
  189. package/src/listItem/Radio/ListItemRadio.story.tsx +111 -0
  190. package/src/listItem/Radio/ListItemRadio.tsx +33 -0
  191. package/src/listItem/Radio/index.ts +2 -0
  192. package/src/listItem/Switch/ListItemSwitch.spec.tsx +47 -0
  193. package/src/listItem/Switch/ListItemSwitch.story.tsx +79 -0
  194. package/src/listItem/Switch/ListItemSwitch.tsx +33 -0
  195. package/src/listItem/Switch/index.ts +2 -0
  196. package/src/listItem/_stories/ListItem.focus.test.story.tsx +265 -0
  197. package/src/listItem/_stories/ListItem.layout.test.story.tsx +354 -0
  198. package/src/listItem/_stories/ListItem.scenarios.story.tsx +228 -0
  199. package/src/listItem/_stories/ListItem.story.tsx +774 -0
  200. package/src/listItem/_stories/ListItem.variants.test.story.tsx +271 -0
  201. package/src/listItem/_stories/helpers.tsx +53 -0
  202. package/src/listItem/_stories/subcomponents.tsx +139 -0
  203. package/src/listItem/index.ts +14 -0
  204. package/src/listItem/test-utils.tsx +33 -0
  205. package/src/listItem/useListItemControl.tsx +18 -0
  206. package/src/listItem/useListItemMedia.tsx +16 -0
  207. package/src/main.css +770 -0
  208. package/src/main.less +1 -0
  209. package/src/select/Select.story.tsx +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subcomponents.d.ts","sourceRoot":"","sources":["../../../../src/listItem/_stories/subcomponents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOlC,MAAM,MAAM,uBAAuB,GAC/B,QAAQ,GACR,cAAc,GACd,eAAe,GACf,qBAAqB,GACrB,YAAY,GACZ,kBAAkB,GAClB,qBAAqB,GACrB,2BAA2B,GAC3B,mBAAmB,GACnB,yBAAyB,GACzB,4BAA4B,GAC5B,kCAAkC,GAClC,YAAY,GACZ,oBAAoB,GACpB,UAAU,GACV,OAAO,GACP,QAAQ,CAAC;AAEb,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,EAAE,SAAS,CA0DnE,CAAC;AAEX,eAAO,MAAM,4BAA4B;;;CAe/B,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;CAavB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;CAoBrB,CAAC"}
@@ -0,0 +1,14 @@
1
+ export type { ListItemProps } from './ListItem';
2
+ export type { ListItemAdditionalInfoProps } from './AdditionalInfo';
3
+ export type { ListItemAvatarLayoutProps } from './AvatarLayout';
4
+ export type { ListItemAvatarViewProps } from './AvatarView';
5
+ export type { ListItemButtonProps } from './Button';
6
+ export type { ListItemCheckboxProps } from './Checkbox';
7
+ export type { ListItemIconButtonProps } from './IconButton';
8
+ export type { ListItemImageProps } from './Image';
9
+ export type { ListItemNavigationProps } from './Navigation';
10
+ export type { ListItemPromptProps } from './Prompt';
11
+ export type { ListItemRadioProps } from './Radio';
12
+ export type { ListItemSwitchProps } from './Switch';
13
+ export { default } from './ListItem';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/listItem/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AACpE,YAAY,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAChE,YAAY,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxD,YAAY,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,YAAY,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type RenderResult } from '../test-utils';
2
+ export declare const mockSetControlType: jest.Mock<any, any, any>;
3
+ export declare const mockSetControlProps: jest.Mock<any, any, any>;
4
+ export declare const mockSetMediaSize: jest.Mock<any, any, any>;
5
+ export declare const renderWithListItemContext: (ui: React.ReactNode) => RenderResult;
6
+ export declare const clearListItemMocks: () => void;
7
+ //# sourceMappingURL=test-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../src/listItem/test-utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAG1D,eAAO,MAAM,kBAAkB,0BAAY,CAAC;AAC5C,eAAO,MAAM,mBAAmB,0BAAY,CAAC;AAC7C,eAAO,MAAM,gBAAgB,0BAAY,CAAC;AAE1C,eAAO,MAAM,yBAAyB,GAAI,IAAI,KAAK,CAAC,SAAS,KAAG,YAqB/D,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAE9B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ListItemTypes, ListItemControlProps } from './ListItem';
2
+ export declare function useListItemControl(controlType: ListItemTypes, controlProps: ListItemControlProps): {
3
+ baseItemProps: Pick<import("./ListItem").ListItemProps, "disabled" | "inverted">;
4
+ };
5
+ //# sourceMappingURL=useListItemControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useListItemControl.d.ts","sourceRoot":"","sources":["../../../src/listItem/useListItemControl.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEtE,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB;;EAahG"}
@@ -0,0 +1,6 @@
1
+ import { type ListItemMediaSize } from './ListItemContext';
2
+ export declare function useListItemMedia(size?: ListItemMediaSize): {
3
+ mediaSize: ListItemMediaSize | undefined;
4
+ setMediaSize: (size: ListItemMediaSize | undefined) => void;
5
+ };
6
+ //# sourceMappingURL=useListItemMedia.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useListItemMedia.d.ts","sourceRoot":"","sources":["../../../src/listItem/useListItemMedia.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,iBAAiB;;;EAQxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.103.1",
3
+ "version": "46.104.0",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -85,8 +85,8 @@
85
85
  "storybook-addon-test-codegen": "^2.0.1",
86
86
  "@transferwise/less-config": "3.1.2",
87
87
  "@transferwise/neptune-css": "14.24.5",
88
- "@wise/wds-configs": "0.0.0",
89
- "@wise/components-theming": "1.6.4"
88
+ "@wise/components-theming": "1.6.4",
89
+ "@wise/wds-configs": "0.0.0"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@transferwise/icons": "^3.22.3",
@@ -13,7 +13,7 @@ import ActionButton from './ActionButton';
13
13
  export default {
14
14
  component: ActionButton,
15
15
  title: 'Actions/ActionButton',
16
- tags: ['deprecated'],
16
+ tags: ['wds:deprecated'],
17
17
  } satisfies Meta<typeof ActionButton>;
18
18
 
19
19
  type Story = StoryObj<typeof ActionButton>;
@@ -13,7 +13,7 @@ import Avatar, { AvatarType } from '.';
13
13
  export default {
14
14
  component: Avatar,
15
15
  title: 'Content/Avatar',
16
- tags: ['deprecated'],
16
+ tags: ['wds:deprecated'],
17
17
  } satisfies Meta<typeof Avatar>;
18
18
 
19
19
  type Story = StoryObj<typeof Avatar>;
@@ -10,7 +10,7 @@ import AvatarWrapper from './AvatarWrapper';
10
10
  export default {
11
11
  component: AvatarWrapper,
12
12
  title: 'Content/AvatarWrapper',
13
- tags: ['deprecated'],
13
+ tags: ['wds:deprecated'],
14
14
  } satisfies Meta<typeof AvatarWrapper>;
15
15
 
16
16
  type Story = StoryObj<typeof AvatarWrapper>;
@@ -9,7 +9,7 @@ import Badge, { type BadgeProps } from './Badge';
9
9
  const meta: Meta<typeof Badge> = {
10
10
  component: Badge,
11
11
  title: 'Content/Badge',
12
- tags: ['deprecated'],
12
+ tags: ['wds:deprecated'],
13
13
  };
14
14
 
15
15
  export default meta;
@@ -152,6 +152,7 @@ const getPropsForPreview = (args: PreviewStoryArgs) => {
152
152
  const meta: Meta<typeof Button> = {
153
153
  component: Button,
154
154
  title: 'Actions/Button',
155
+ tags: ['wds:new'],
155
156
  argTypes: {
156
157
  v2: {
157
158
  table: {
@@ -25,7 +25,7 @@ const withContainer = (Story: any) => (
25
25
  const meta: Meta<typeof LegacyButton> = {
26
26
  component: LegacyButton,
27
27
  title: 'Actions/Button/Legacy Button',
28
- tags: ['deprecated'],
28
+ tags: ['wds:deprecated'],
29
29
  args: {
30
30
  size: undefined,
31
31
  priority: undefined,
package/src/index.ts CHANGED
@@ -108,6 +108,20 @@ export type {
108
108
  TableCellStatus,
109
109
  TableCellType,
110
110
  } from './table';
111
+ export type {
112
+ ListItemProps,
113
+ ListItemSwitchProps,
114
+ ListItemRadioProps,
115
+ ListItemPromptProps,
116
+ ListItemNavigationProps,
117
+ ListItemImageProps,
118
+ ListItemIconButtonProps,
119
+ ListItemAdditionalInfoProps,
120
+ ListItemButtonProps,
121
+ ListItemCheckboxProps,
122
+ ListItemAvatarLayoutProps,
123
+ ListItemAvatarViewProps,
124
+ } from './listItem';
111
125
  export type { ListProps } from './list';
112
126
 
113
127
  /**
@@ -210,6 +224,7 @@ export { default as Typeahead } from './typeahead';
210
224
  export { default as Upload } from './upload';
211
225
  export { default as UploadInput } from './uploadInput';
212
226
  export { default as Table } from './table';
227
+ export { default as ListItem } from './listItem';
213
228
  export { default as List } from './list';
214
229
 
215
230
  /**
@@ -10,7 +10,7 @@ import LegacyListItem from '.';
10
10
 
11
11
  export default {
12
12
  component: LegacyListItem,
13
- title: 'Other/LegacyListItem',
13
+ title: 'Content/LegacyListItem',
14
14
  };
15
15
 
16
16
  const Template = ({
@@ -6,7 +6,8 @@ import List from '../list';
6
6
 
7
7
  export default {
8
8
  component: LegacyListItem,
9
- title: 'Other/LegacyListItem/tests',
9
+ tags: ['!autodocs'],
10
+ title: 'Content/LegacyListItem/tests',
10
11
  };
11
12
 
12
13
  export const LongText = () => {
@@ -1,5 +1,5 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import LegacyListItem from '../legacylistItem';
2
+ import ListItem from '../listItem';
3
3
  import List from './List';
4
4
 
5
5
  export default {
@@ -13,8 +13,18 @@ type Story = StoryObj<typeof List>;
13
13
  export const Basic: Story = {
14
14
  render: (args) => (
15
15
  <List {...args}>
16
- <LegacyListItem title="First item" value="This is the first item." />
17
- <LegacyListItem title="Second item" value="This is the second item." />
16
+ <ListItem
17
+ as={args.as === 'div' ? 'div' : undefined}
18
+ title="First item"
19
+ subtitle="This is the first item."
20
+ media={<ListItem.AvatarView />}
21
+ />
22
+ <ListItem
23
+ as={args.as === 'div' ? 'div' : undefined}
24
+ title="Second item"
25
+ subtitle="This is the second item."
26
+ media={<ListItem.AvatarView />}
27
+ />
18
28
  </List>
19
29
  ),
20
30
  };
@@ -0,0 +1,56 @@
1
+ import { render, screen } from '../../test-utils';
2
+ import { ListItem, type ListItemProps } from '../ListItem';
3
+
4
+ describe('ListItem.AdditionalInfo', () => {
5
+ const renderWithInfo = (info: ListItemProps['additionalInfo']) =>
6
+ render(<ListItem title="Test title" subtitle="Test subtitle" additionalInfo={info} />);
7
+
8
+ it('renders children content', () => {
9
+ renderWithInfo(
10
+ <ListItem.AdditionalInfo>Additional information content</ListItem.AdditionalInfo>,
11
+ );
12
+ expect(screen.getByText('Additional information content')).toBeInTheDocument();
13
+ });
14
+
15
+ it('renders action button when onClick provided', () => {
16
+ const handleActionClick = jest.fn();
17
+ renderWithInfo(
18
+ <ListItem.AdditionalInfo action={{ label: 'Learn more', onClick: handleActionClick }}>
19
+ Additional info
20
+ </ListItem.AdditionalInfo>,
21
+ );
22
+
23
+ expect(screen.getByRole('button', { name: 'Learn more' })).toBeInTheDocument();
24
+ });
25
+
26
+ it('renders action link with href when provided', () => {
27
+ renderWithInfo(
28
+ <ListItem.AdditionalInfo action={{ label: 'Learn more', href: '/learn' }}>
29
+ Additional info
30
+ </ListItem.AdditionalInfo>,
31
+ );
32
+
33
+ const actionLink = screen.getByRole('link', { name: 'Learn more' });
34
+ expect(actionLink).toBeInTheDocument();
35
+ expect(actionLink).toHaveAttribute('href', '/learn');
36
+ });
37
+
38
+ it('renders action link with target when provided', () => {
39
+ renderWithInfo(
40
+ <ListItem.AdditionalInfo action={{ label: 'Learn more', href: '/learn', target: '_blank' }}>
41
+ Additional info
42
+ </ListItem.AdditionalInfo>,
43
+ );
44
+
45
+ const actionLink = screen.getByRole('link', { name: 'Learn more (opens in new tab)' });
46
+ expect(actionLink).toBeInTheDocument();
47
+ expect(actionLink).toHaveAttribute('target', '_blank');
48
+ });
49
+
50
+ it('does not render action when not provided', () => {
51
+ renderWithInfo(<ListItem.AdditionalInfo>Additional info only</ListItem.AdditionalInfo>);
52
+
53
+ expect(screen.queryByRole('link')).not.toBeInTheDocument();
54
+ expect(screen.queryByRole('button')).not.toBeInTheDocument();
55
+ });
56
+ });
@@ -0,0 +1,198 @@
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
+ };
@@ -0,0 +1,36 @@
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';
@@ -0,0 +1,2 @@
1
+ export type { ListItemAdditionalInfoProps } from './ListItemAdditionalInfo';
2
+ export { AdditionalInfo } from './ListItemAdditionalInfo';
@@ -0,0 +1,59 @@
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
+ });