@transferwise/components 46.103.1 → 46.105.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 (250) hide show
  1. package/build/header/Header.js +60 -43
  2. package/build/header/Header.js.map +1 -1
  3. package/build/header/Header.mjs +57 -43
  4. package/build/header/Header.mjs.map +1 -1
  5. package/build/i18n/cs.json +2 -0
  6. package/build/i18n/cs.json.js +2 -0
  7. package/build/i18n/cs.json.js.map +1 -1
  8. package/build/i18n/cs.json.mjs +2 -0
  9. package/build/i18n/cs.json.mjs.map +1 -1
  10. package/build/i18n/es.json +2 -0
  11. package/build/i18n/es.json.js +2 -0
  12. package/build/i18n/es.json.js.map +1 -1
  13. package/build/i18n/es.json.mjs +2 -0
  14. package/build/i18n/es.json.mjs.map +1 -1
  15. package/build/i18n/th.json +2 -0
  16. package/build/i18n/th.json.js +2 -0
  17. package/build/i18n/th.json.js.map +1 -1
  18. package/build/i18n/th.json.mjs +2 -0
  19. package/build/i18n/th.json.mjs.map +1 -1
  20. package/build/index.js +3 -1
  21. package/build/index.js.map +1 -1
  22. package/build/index.mjs +2 -1
  23. package/build/index.mjs.map +1 -1
  24. package/build/inputs/SelectInput.js +1 -1
  25. package/build/inputs/SelectInput.js.map +1 -1
  26. package/build/inputs/SelectInput.mjs +1 -1
  27. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +56 -0
  28. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js.map +1 -0
  29. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +54 -0
  30. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs.map +1 -0
  31. package/build/listItem/AvatarLayout/ListItemAvatarLayout.js +23 -0
  32. package/build/listItem/AvatarLayout/ListItemAvatarLayout.js.map +1 -0
  33. package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs +21 -0
  34. package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs.map +1 -0
  35. package/build/listItem/AvatarView/ListItemAvatarView.js +23 -0
  36. package/build/listItem/AvatarView/ListItemAvatarView.js.map +1 -0
  37. package/build/listItem/AvatarView/ListItemAvatarView.mjs +21 -0
  38. package/build/listItem/AvatarView/ListItemAvatarView.mjs.map +1 -0
  39. package/build/listItem/Button/ListItemButton.js +43 -0
  40. package/build/listItem/Button/ListItemButton.js.map +1 -0
  41. package/build/listItem/Button/ListItemButton.mjs +41 -0
  42. package/build/listItem/Button/ListItemButton.mjs.map +1 -0
  43. package/build/listItem/Checkbox/ListItemCheckbox.js +30 -0
  44. package/build/listItem/Checkbox/ListItemCheckbox.js.map +1 -0
  45. package/build/listItem/Checkbox/ListItemCheckbox.mjs +28 -0
  46. package/build/listItem/Checkbox/ListItemCheckbox.mjs.map +1 -0
  47. package/build/listItem/IconButton/ListItemIconButton.js +56 -0
  48. package/build/listItem/IconButton/ListItemIconButton.js.map +1 -0
  49. package/build/listItem/IconButton/ListItemIconButton.mjs +54 -0
  50. package/build/listItem/IconButton/ListItemIconButton.mjs.map +1 -0
  51. package/build/listItem/Image/ListItemImage.js +31 -0
  52. package/build/listItem/Image/ListItemImage.js.map +1 -0
  53. package/build/listItem/Image/ListItemImage.mjs +29 -0
  54. package/build/listItem/Image/ListItemImage.mjs.map +1 -0
  55. package/build/listItem/ListItem.js +311 -0
  56. package/build/listItem/ListItem.js.map +1 -0
  57. package/build/listItem/ListItem.mjs +306 -0
  58. package/build/listItem/ListItem.mjs.map +1 -0
  59. package/build/listItem/ListItemContext.js +8 -0
  60. package/build/listItem/ListItemContext.js.map +1 -0
  61. package/build/listItem/ListItemContext.mjs +6 -0
  62. package/build/listItem/ListItemContext.mjs.map +1 -0
  63. package/build/listItem/Navigation/ListItemNavigation.js +44 -0
  64. package/build/listItem/Navigation/ListItemNavigation.js.map +1 -0
  65. package/build/listItem/Navigation/ListItemNavigation.mjs +42 -0
  66. package/build/listItem/Navigation/ListItemNavigation.mjs.map +1 -0
  67. package/build/listItem/Prompt/ListItemPrompt.js +59 -0
  68. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -0
  69. package/build/listItem/Prompt/ListItemPrompt.mjs +54 -0
  70. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -0
  71. package/build/listItem/Radio/ListItemRadio.js +30 -0
  72. package/build/listItem/Radio/ListItemRadio.js.map +1 -0
  73. package/build/listItem/Radio/ListItemRadio.mjs +28 -0
  74. package/build/listItem/Radio/ListItemRadio.mjs.map +1 -0
  75. package/build/listItem/Switch/ListItemSwitch.js +30 -0
  76. package/build/listItem/Switch/ListItemSwitch.js.map +1 -0
  77. package/build/listItem/Switch/ListItemSwitch.mjs +28 -0
  78. package/build/listItem/Switch/ListItemSwitch.mjs.map +1 -0
  79. package/build/listItem/useListItemControl.js +22 -0
  80. package/build/listItem/useListItemControl.js.map +1 -0
  81. package/build/listItem/useListItemControl.mjs +20 -0
  82. package/build/listItem/useListItemControl.mjs.map +1 -0
  83. package/build/listItem/useListItemMedia.js +21 -0
  84. package/build/listItem/useListItemMedia.js.map +1 -0
  85. package/build/listItem/useListItemMedia.mjs +19 -0
  86. package/build/listItem/useListItemMedia.mjs.map +1 -0
  87. package/build/main.css +794 -14
  88. package/build/styles/header/Header.css +21 -14
  89. package/build/styles/listItem/ListItem.css +773 -0
  90. package/build/styles/listItem/ListItem.grid.css +370 -0
  91. package/build/styles/listItem/Prompt/ListItemPrompt.css +157 -0
  92. package/build/styles/main.css +794 -14
  93. package/build/title/Title.js +10 -4
  94. package/build/title/Title.js.map +1 -1
  95. package/build/title/Title.mjs +6 -4
  96. package/build/title/Title.mjs.map +1 -1
  97. package/build/types/header/Header.d.ts +27 -11
  98. package/build/types/header/Header.d.ts.map +1 -1
  99. package/build/types/header/index.d.ts +1 -0
  100. package/build/types/header/index.d.ts.map +1 -1
  101. package/build/types/index.d.ts +3 -0
  102. package/build/types/index.d.ts.map +1 -1
  103. package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts +15 -0
  104. package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts.map +1 -0
  105. package/build/types/listItem/AdditionalInfo/index.d.ts +3 -0
  106. package/build/types/listItem/AdditionalInfo/index.d.ts.map +1 -0
  107. package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts +18 -0
  108. package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts.map +1 -0
  109. package/build/types/listItem/AvatarLayout/index.d.ts +3 -0
  110. package/build/types/listItem/AvatarLayout/index.d.ts.map +1 -0
  111. package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts +16 -0
  112. package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts.map +1 -0
  113. package/build/types/listItem/AvatarView/index.d.ts +3 -0
  114. package/build/types/listItem/AvatarView/index.d.ts.map +1 -0
  115. package/build/types/listItem/Button/ListItemButton.d.ts +20 -0
  116. package/build/types/listItem/Button/ListItemButton.d.ts.map +1 -0
  117. package/build/types/listItem/Button/index.d.ts +3 -0
  118. package/build/types/listItem/Button/index.d.ts.map +1 -0
  119. package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts +14 -0
  120. package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts.map +1 -0
  121. package/build/types/listItem/Checkbox/index.d.ts +3 -0
  122. package/build/types/listItem/Checkbox/index.d.ts.map +1 -0
  123. package/build/types/listItem/IconButton/ListItemIconButton.d.ts +18 -0
  124. package/build/types/listItem/IconButton/ListItemIconButton.d.ts.map +1 -0
  125. package/build/types/listItem/IconButton/index.d.ts +3 -0
  126. package/build/types/listItem/IconButton/index.d.ts.map +1 -0
  127. package/build/types/listItem/Image/ListItemImage.d.ts +25 -0
  128. package/build/types/listItem/Image/ListItemImage.d.ts.map +1 -0
  129. package/build/types/listItem/Image/index.d.ts +3 -0
  130. package/build/types/listItem/Image/index.d.ts.map +1 -0
  131. package/build/types/listItem/ListItem.d.ts +111 -0
  132. package/build/types/listItem/ListItem.d.ts.map +1 -0
  133. package/build/types/listItem/ListItemContext.d.ts +21 -0
  134. package/build/types/listItem/ListItemContext.d.ts.map +1 -0
  135. package/build/types/listItem/Navigation/ListItemNavigation.d.ts +15 -0
  136. package/build/types/listItem/Navigation/ListItemNavigation.d.ts.map +1 -0
  137. package/build/types/listItem/Navigation/index.d.ts +3 -0
  138. package/build/types/listItem/Navigation/index.d.ts.map +1 -0
  139. package/build/types/listItem/Prompt/ListItemPrompt.d.ts +16 -0
  140. package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +1 -0
  141. package/build/types/listItem/Prompt/index.d.ts +3 -0
  142. package/build/types/listItem/Prompt/index.d.ts.map +1 -0
  143. package/build/types/listItem/Radio/ListItemRadio.d.ts +14 -0
  144. package/build/types/listItem/Radio/ListItemRadio.d.ts.map +1 -0
  145. package/build/types/listItem/Radio/index.d.ts +3 -0
  146. package/build/types/listItem/Radio/index.d.ts.map +1 -0
  147. package/build/types/listItem/Switch/ListItemSwitch.d.ts +14 -0
  148. package/build/types/listItem/Switch/ListItemSwitch.d.ts.map +1 -0
  149. package/build/types/listItem/Switch/index.d.ts +3 -0
  150. package/build/types/listItem/Switch/index.d.ts.map +1 -0
  151. package/build/types/listItem/_stories/helpers.d.ts +27 -0
  152. package/build/types/listItem/_stories/helpers.d.ts.map +1 -0
  153. package/build/types/listItem/_stories/subcomponents.d.ts +18 -0
  154. package/build/types/listItem/_stories/subcomponents.d.ts.map +1 -0
  155. package/build/types/listItem/index.d.ts +14 -0
  156. package/build/types/listItem/index.d.ts.map +1 -0
  157. package/build/types/listItem/test-utils.d.ts +7 -0
  158. package/build/types/listItem/test-utils.d.ts.map +1 -0
  159. package/build/types/listItem/useListItemControl.d.ts +5 -0
  160. package/build/types/listItem/useListItemControl.d.ts.map +1 -0
  161. package/build/types/listItem/useListItemMedia.d.ts +6 -0
  162. package/build/types/listItem/useListItemMedia.d.ts.map +1 -0
  163. package/build/types/title/Title.d.ts +4 -5
  164. package/build/types/title/Title.d.ts.map +1 -1
  165. package/package.json +3 -3
  166. package/src/button/Button.spec.tsx +25 -1
  167. package/src/button/Button.story.tsx +1 -0
  168. package/src/header/Header.accessibility.docs.mdx +85 -0
  169. package/src/header/Header.css +21 -14
  170. package/src/header/Header.less +17 -10
  171. package/src/header/Header.spec.tsx +68 -50
  172. package/src/header/Header.story.tsx +190 -36
  173. package/src/header/Header.tsx +96 -65
  174. package/src/header/index.ts +1 -0
  175. package/src/i18n/cs.json +2 -0
  176. package/src/i18n/es.json +2 -0
  177. package/src/i18n/th.json +2 -0
  178. package/src/iconButton/iconButton.spec.tsx +31 -0
  179. package/src/index.ts +16 -0
  180. package/src/legacylistItem/LegacyListItem.story.tsx +1 -1
  181. package/src/legacylistItem/LegacyListItem.tests.story.tsx +2 -1
  182. package/src/list/List.story.tsx +13 -3
  183. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.spec.tsx +56 -0
  184. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +198 -0
  185. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.tsx +36 -0
  186. package/src/listItem/AdditionalInfo/index.ts +2 -0
  187. package/src/listItem/AvatarLayout/ListItemAvatarLayout.spec.tsx +59 -0
  188. package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +124 -0
  189. package/src/listItem/AvatarLayout/ListItemAvatarLayout.tsx +27 -0
  190. package/src/listItem/AvatarLayout/index.ts +2 -0
  191. package/src/listItem/AvatarView/ListItemAvatarView.spec.tsx +75 -0
  192. package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +339 -0
  193. package/src/listItem/AvatarView/ListItemAvatarView.tsx +27 -0
  194. package/src/listItem/AvatarView/index.ts +2 -0
  195. package/src/listItem/Button/ListItemButton.spec.tsx +90 -0
  196. package/src/listItem/Button/ListItemButton.story.tsx +473 -0
  197. package/src/listItem/Button/ListItemButton.tsx +56 -0
  198. package/src/listItem/Button/index.ts +2 -0
  199. package/src/listItem/Checkbox/ListItemCheckbox.spec.tsx +82 -0
  200. package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +128 -0
  201. package/src/listItem/Checkbox/ListItemCheckbox.tsx +33 -0
  202. package/src/listItem/Checkbox/index.ts +2 -0
  203. package/src/listItem/IconButton/ListItemIconButton.spec.tsx +131 -0
  204. package/src/listItem/IconButton/ListItemIconButton.story.tsx +284 -0
  205. package/src/listItem/IconButton/ListItemIconButton.tsx +73 -0
  206. package/src/listItem/IconButton/index.ts +2 -0
  207. package/src/listItem/Image/ListItemImage.spec.tsx +30 -0
  208. package/src/listItem/Image/ListItemImage.story.tsx +80 -0
  209. package/src/listItem/Image/ListItemImage.tsx +46 -0
  210. package/src/listItem/Image/index.ts +2 -0
  211. package/src/listItem/ListItem.css +773 -0
  212. package/src/listItem/ListItem.grid.css +370 -0
  213. package/src/listItem/ListItem.grid.less +622 -0
  214. package/src/listItem/ListItem.less +291 -0
  215. package/src/listItem/ListItem.spec.tsx +1511 -0
  216. package/src/listItem/ListItem.tsx +440 -0
  217. package/src/listItem/ListItemContext.tsx +26 -0
  218. package/src/listItem/Navigation/ListItemNavigation.spec.tsx +67 -0
  219. package/src/listItem/Navigation/ListItemNavigation.story.tsx +114 -0
  220. package/src/listItem/Navigation/ListItemNavigation.tsx +39 -0
  221. package/src/listItem/Navigation/index.ts +2 -0
  222. package/src/listItem/Prompt/ListItemPrompt.css +157 -0
  223. package/src/listItem/Prompt/ListItemPrompt.less +134 -0
  224. package/src/listItem/Prompt/ListItemPrompt.spec.tsx +36 -0
  225. package/src/listItem/Prompt/ListItemPrompt.story.tsx +204 -0
  226. package/src/listItem/Prompt/ListItemPrompt.tsx +32 -0
  227. package/src/listItem/Prompt/index.ts +2 -0
  228. package/src/listItem/Radio/ListItemRadio.spec.tsx +66 -0
  229. package/src/listItem/Radio/ListItemRadio.story.tsx +111 -0
  230. package/src/listItem/Radio/ListItemRadio.tsx +33 -0
  231. package/src/listItem/Radio/index.ts +2 -0
  232. package/src/listItem/Switch/ListItemSwitch.spec.tsx +47 -0
  233. package/src/listItem/Switch/ListItemSwitch.story.tsx +79 -0
  234. package/src/listItem/Switch/ListItemSwitch.tsx +33 -0
  235. package/src/listItem/Switch/index.ts +2 -0
  236. package/src/listItem/_stories/ListItem.focus.test.story.tsx +265 -0
  237. package/src/listItem/_stories/ListItem.layout.test.story.tsx +374 -0
  238. package/src/listItem/_stories/ListItem.scenarios.story.tsx +228 -0
  239. package/src/listItem/_stories/ListItem.story.tsx +774 -0
  240. package/src/listItem/_stories/ListItem.variants.test.story.tsx +274 -0
  241. package/src/listItem/_stories/helpers.tsx +53 -0
  242. package/src/listItem/_stories/subcomponents.tsx +141 -0
  243. package/src/listItem/index.ts +14 -0
  244. package/src/listItem/test-utils.tsx +33 -0
  245. package/src/listItem/useListItemControl.tsx +18 -0
  246. package/src/listItem/useListItemMedia.tsx +16 -0
  247. package/src/main.css +794 -14
  248. package/src/main.less +1 -0
  249. package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +15 -4
  250. package/src/title/Title.tsx +25 -12
@@ -0,0 +1,41 @@
1
+ import { useContext } from 'react';
2
+ import { clsx } from 'clsx';
3
+ import Button$1 from '../../button/Button.resolver.mjs';
4
+ import { useListItemControl } from '../useListItemControl.mjs';
5
+ import { ListItemContext } from '../ListItemContext.mjs';
6
+ import { jsx } from 'react/jsx-runtime';
7
+
8
+ const Button = ({
9
+ priority = 'secondary-neutral',
10
+ partiallyInteractive,
11
+ ...props
12
+ }) => {
13
+ const {
14
+ baseItemProps
15
+ } = useListItemControl('button', {
16
+ partiallyInteractive,
17
+ ...props
18
+ });
19
+ const {
20
+ ids,
21
+ describedByIds
22
+ } = useContext(ListItemContext);
23
+ const commonProps = {
24
+ ...props,
25
+ className: clsx('wds-list-item-control', !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element'),
26
+ id: ids.control,
27
+ priority,
28
+ v2: true,
29
+ size: 'sm',
30
+ disabled: baseItemProps.disabled
31
+ };
32
+ const buttonContentId = props.href || partiallyInteractive ? '' : `${ids.control}_content`;
33
+ return /*#__PURE__*/jsx(Button$1, {
34
+ "aria-describedby": `${buttonContentId} ${describedByIds}`,
35
+ ...commonProps
36
+ });
37
+ };
38
+ Button.displayName = 'ListItem.Button';
39
+
40
+ export { Button };
41
+ //# sourceMappingURL=ListItemButton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItemButton.mjs","sources":["../../../src/listItem/Button/ListItemButton.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport { clsx } from 'clsx';\nimport ButtonComp, { type ButtonAddonIcon, type NewButtonProps } from '../../button';\nimport { useListItemControl } from '../useListItemControl';\nimport { ListItemContext } from '../ListItemContext';\n\nexport type ListItemButtonProps = Omit<\n NewButtonProps,\n 'v2' | 'size' | 'disabled' | 'block' | 'addonStart'\n> & {\n /**\n * Toggles the [interactivity strategy](https://storybook.wise.design/?path=/docs/content-listitem--docs#interactivity) for the whole ListItem.\n */\n partiallyInteractive?: boolean;\n addonStart?: ButtonAddonIcon;\n};\n\n/**\n * This component allows for rendering a Button control. It's a thin wrapper around the\n * [Button component](https://storybook.wise.design/?path=/docs/content-button--docs), but offers only\n * a subset of its features in line with the ListItem's constraints. <br />\n * <br />\n * Please refer to the [Design documentation](https://wise.design/components/list-item---button) for details.\n */\nexport const Button = ({\n priority = 'secondary-neutral',\n partiallyInteractive,\n ...props\n}: ListItemButtonProps) => {\n const { baseItemProps } = useListItemControl('button', { partiallyInteractive, ...props });\n const { ids, describedByIds } = useContext(ListItemContext);\n\n const commonProps = {\n ...props,\n className: clsx(\n 'wds-list-item-control',\n !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element',\n ),\n id: ids.control,\n priority,\n v2: true,\n size: 'sm',\n disabled: baseItemProps.disabled,\n };\n\n const buttonContentId = props.href || partiallyInteractive ? '' : `${ids.control}_content`;\n\n return (\n <ButtonComp\n aria-describedby={`${buttonContentId} ${describedByIds}`}\n {...(commonProps as NewButtonProps)}\n />\n );\n};\n\nButton.displayName = 'ListItem.Button';\n"],"names":["Button","priority","partiallyInteractive","props","baseItemProps","useListItemControl","ids","describedByIds","useContext","ListItemContext","commonProps","className","clsx","href","id","control","v2","size","disabled","buttonContentId","_jsx","ButtonComp","displayName"],"mappings":";;;;;;;AAwBO,MAAMA,MAAM,GAAGA,CAAC;AACrBC,EAAAA,QAAQ,GAAG,mBAAmB;EAC9BC,oBAAoB;EACpB,GAAGC;AAAK,CACY,KAAI;EACxB,MAAM;AAAEC,IAAAA;AAAa,GAAE,GAAGC,kBAAkB,CAAC,QAAQ,EAAE;IAAEH,oBAAoB;IAAE,GAAGC;AAAK,GAAE,CAAC;EAC1F,MAAM;IAAEG,GAAG;AAAEC,IAAAA;AAAc,GAAE,GAAGC,UAAU,CAACC,eAAe,CAAC;AAE3D,EAAA,MAAMC,WAAW,GAAG;AAClB,IAAA,GAAGP,KAAK;AACRQ,IAAAA,SAAS,EAAEC,IAAI,CACb,uBAAuB,EACvB,CAACV,oBAAoB,IAAIC,KAAK,CAACU,IAAI,IAAI,sCAAsC,CAC9E;IACDC,EAAE,EAAER,GAAG,CAACS,OAAO;IACfd,QAAQ;AACRe,IAAAA,EAAE,EAAE,IAAI;AACRC,IAAAA,IAAI,EAAE,IAAI;IACVC,QAAQ,EAAEd,aAAa,CAACc;GACzB;AAED,EAAA,MAAMC,eAAe,GAAGhB,KAAK,CAACU,IAAI,IAAIX,oBAAoB,GAAG,EAAE,GAAG,CAAA,EAAGI,GAAG,CAACS,OAAO,CAAA,QAAA,CAAU;EAE1F,oBACEK,GAAA,CAACC,QAAU,EAAA;AACT,IAAA,kBAAA,EAAkB,CAAA,EAAGF,eAAe,CAAA,CAAA,EAAIZ,cAAc,CAAA,CAAG;IAAA,GACpDG;AAA8B,GAAC,CACpC;AAEN;AAEAV,MAAM,CAACsB,WAAW,GAAG,iBAAiB;;;;"}
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var CheckboxButton = require('../../checkboxButton/CheckboxButton.js');
5
+ var useListItemControl = require('../useListItemControl.js');
6
+ var ListItemContext = require('../ListItemContext.js');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ const Checkbox = function (props) {
10
+ const {
11
+ baseItemProps
12
+ } = useListItemControl.useListItemControl('checkbox', {
13
+ ...props
14
+ });
15
+ const {
16
+ ids,
17
+ describedByIds
18
+ } = React.useContext(ListItemContext.ListItemContext);
19
+ return /*#__PURE__*/jsxRuntime.jsx(CheckboxButton.default, {
20
+ ...props,
21
+ className: "wds-list-item-control",
22
+ disabled: baseItemProps.disabled,
23
+ id: ids.control,
24
+ "aria-describedby": describedByIds
25
+ });
26
+ };
27
+ Checkbox.displayName = 'ListItem.Checkbox';
28
+
29
+ exports.Checkbox = Checkbox;
30
+ //# sourceMappingURL=ListItemCheckbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItemCheckbox.js","sources":["../../../src/listItem/Checkbox/ListItemCheckbox.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport CheckboxButton, { type CheckboxButtonProps } from '../../checkboxButton/CheckboxButton';\nimport { useListItemControl } from '../useListItemControl';\nimport { ListItemContext } from '../ListItemContext';\n\nexport type ListItemCheckboxProps = Pick<\n CheckboxButtonProps,\n 'checked' | 'indeterminate' | 'onChange' | 'onBlur' | 'onFocus' | 'value' | 'name'\n>;\n\n/**\n * This component allows for rendering a checkbox control within a fully interactive ListItem. <br />It's a thin wrapper around the\n * [CheckboxButton component](https://storybook.wise.design/?path=/docs/actions-checkboxbutton--docs),\n * but offers only a subset of its features in line with the ListItem's constraints. <br />\n *\n * Please refer to the [Design documentation](https://wise.design/components/list-item---checkbox) for details.\n */\nexport const Checkbox = function (props: ListItemCheckboxProps) {\n const { baseItemProps } = useListItemControl('checkbox', { ...props });\n const { ids, describedByIds } = useContext(ListItemContext);\n\n return (\n <CheckboxButton\n {...props}\n className=\"wds-list-item-control\"\n disabled={baseItemProps.disabled}\n id={ids.control}\n aria-describedby={describedByIds}\n />\n );\n};\n\nCheckbox.displayName = 'ListItem.Checkbox';\n"],"names":["Checkbox","props","baseItemProps","useListItemControl","ids","describedByIds","useContext","ListItemContext","_jsx","CheckboxButton","className","disabled","id","control","displayName"],"mappings":";;;;;;;;MAiBaA,QAAQ,GAAG,UAAUC,KAA4B,EAAA;EAC5D,MAAM;AAAEC,IAAAA;AAAa,GAAE,GAAGC,qCAAkB,CAAC,UAAU,EAAE;IAAE,GAAGF;AAAK,GAAE,CAAC;EACtE,MAAM;IAAEG,GAAG;AAAEC,IAAAA;AAAc,GAAE,GAAGC,gBAAU,CAACC,+BAAe,CAAC;EAE3D,oBACEC,cAAA,CAACC,sBAAc,EAAA;AAAA,IAAA,GACTR,KAAK;AACTS,IAAAA,SAAS,EAAC,uBAAuB;IACjCC,QAAQ,EAAET,aAAa,CAACS,QAAS;IACjCC,EAAE,EAAER,GAAG,CAACS,OAAQ;IAChB,kBAAA,EAAkBR;AAAe,GAAA,CACjC;AAEN;AAEAL,QAAQ,CAACc,WAAW,GAAG,mBAAmB;;;;"}
@@ -0,0 +1,28 @@
1
+ import { useContext } from 'react';
2
+ import CheckboxButton from '../../checkboxButton/CheckboxButton.mjs';
3
+ import { useListItemControl } from '../useListItemControl.mjs';
4
+ import { ListItemContext } from '../ListItemContext.mjs';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ const Checkbox = function (props) {
8
+ const {
9
+ baseItemProps
10
+ } = useListItemControl('checkbox', {
11
+ ...props
12
+ });
13
+ const {
14
+ ids,
15
+ describedByIds
16
+ } = useContext(ListItemContext);
17
+ return /*#__PURE__*/jsx(CheckboxButton, {
18
+ ...props,
19
+ className: "wds-list-item-control",
20
+ disabled: baseItemProps.disabled,
21
+ id: ids.control,
22
+ "aria-describedby": describedByIds
23
+ });
24
+ };
25
+ Checkbox.displayName = 'ListItem.Checkbox';
26
+
27
+ export { Checkbox };
28
+ //# sourceMappingURL=ListItemCheckbox.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItemCheckbox.mjs","sources":["../../../src/listItem/Checkbox/ListItemCheckbox.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport CheckboxButton, { type CheckboxButtonProps } from '../../checkboxButton/CheckboxButton';\nimport { useListItemControl } from '../useListItemControl';\nimport { ListItemContext } from '../ListItemContext';\n\nexport type ListItemCheckboxProps = Pick<\n CheckboxButtonProps,\n 'checked' | 'indeterminate' | 'onChange' | 'onBlur' | 'onFocus' | 'value' | 'name'\n>;\n\n/**\n * This component allows for rendering a checkbox control within a fully interactive ListItem. <br />It's a thin wrapper around the\n * [CheckboxButton component](https://storybook.wise.design/?path=/docs/actions-checkboxbutton--docs),\n * but offers only a subset of its features in line with the ListItem's constraints. <br />\n *\n * Please refer to the [Design documentation](https://wise.design/components/list-item---checkbox) for details.\n */\nexport const Checkbox = function (props: ListItemCheckboxProps) {\n const { baseItemProps } = useListItemControl('checkbox', { ...props });\n const { ids, describedByIds } = useContext(ListItemContext);\n\n return (\n <CheckboxButton\n {...props}\n className=\"wds-list-item-control\"\n disabled={baseItemProps.disabled}\n id={ids.control}\n aria-describedby={describedByIds}\n />\n );\n};\n\nCheckbox.displayName = 'ListItem.Checkbox';\n"],"names":["Checkbox","props","baseItemProps","useListItemControl","ids","describedByIds","useContext","ListItemContext","_jsx","CheckboxButton","className","disabled","id","control","displayName"],"mappings":";;;;;;MAiBaA,QAAQ,GAAG,UAAUC,KAA4B,EAAA;EAC5D,MAAM;AAAEC,IAAAA;AAAa,GAAE,GAAGC,kBAAkB,CAAC,UAAU,EAAE;IAAE,GAAGF;AAAK,GAAE,CAAC;EACtE,MAAM;IAAEG,GAAG;AAAEC,IAAAA;AAAc,GAAE,GAAGC,UAAU,CAACC,eAAe,CAAC;EAE3D,oBACEC,GAAA,CAACC,cAAc,EAAA;AAAA,IAAA,GACTR,KAAK;AACTS,IAAAA,SAAS,EAAC,uBAAuB;IACjCC,QAAQ,EAAET,aAAa,CAACS,QAAS;IACjCC,EAAE,EAAER,GAAG,CAACS,OAAQ;IAChB,kBAAA,EAAkBR;AAAe,GAAA,CACjC;AAEN;AAEAL,QAAQ,CAACc,WAAW,GAAG,mBAAmB;;;;"}
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ var clsx = require('clsx');
4
+ var React = require('react');
5
+ var IconButton$1 = require('../../iconButton/IconButton.js');
6
+ var useListItemControl = require('../useListItemControl.js');
7
+ var ListItemContext = require('../ListItemContext.js');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+
10
+ const IconButton = function ({
11
+ priority = 'minimal',
12
+ 'aria-label': ariaLabel,
13
+ ...props
14
+ }) {
15
+ const {
16
+ partiallyInteractive,
17
+ ...restProps
18
+ } = props;
19
+ const {
20
+ ids,
21
+ props: itemProps
22
+ } = React.useContext(ListItemContext.ListItemContext);
23
+ const {
24
+ baseItemProps
25
+ } = useListItemControl.useListItemControl('icon-button', {
26
+ partiallyInteractive,
27
+ ...restProps
28
+ });
29
+ const getAriaProps = () => {
30
+ const labelIds = [itemProps.inverted ? ids.subtitle : ids.title, itemProps.inverted ? ids.title : ids.subtitle, itemProps.inverted ? ids.valueSubtitle : ids.valueTitle, itemProps.inverted ? ids.valueTitle : ids.valueSubtitle].join(' ');
31
+ const descriptorIds = [ids.additionalInfo, ids.prompt].join(' ');
32
+ if (ariaLabel) {
33
+ return {
34
+ 'aria-label': ariaLabel,
35
+ 'aria-describedby': labelIds.concat(descriptorIds)
36
+ };
37
+ }
38
+ return {
39
+ 'aria-labelledby': labelIds,
40
+ 'aria-describedby': descriptorIds
41
+ };
42
+ };
43
+ return /*#__PURE__*/jsxRuntime.jsx(IconButton$1.default, {
44
+ ...restProps,
45
+ ...getAriaProps(),
46
+ className: clsx.clsx('wds-list-item-control', !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element'),
47
+ id: ids.control,
48
+ size: 40,
49
+ priority: priority,
50
+ disabled: baseItemProps.disabled
51
+ });
52
+ };
53
+ IconButton.displayName = 'ListItem.IconButton';
54
+
55
+ exports.IconButton = IconButton;
56
+ //# sourceMappingURL=ListItemIconButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItemIconButton.js","sources":["../../../src/listItem/IconButton/ListItemIconButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useContext, type ReactNode } from 'react';\nimport IconButtonComp, { type IconButtonProps } from '../../iconButton';\nimport { useListItemControl } from '../useListItemControl';\nimport { ListItemContext } from '../ListItemContext';\n\nexport type ListItemIconButtonProps = Pick<\n IconButtonProps,\n 'priority' | 'type' | 'onClick' | 'href' | 'target' | 'aria-label'\n> & {\n children: ReactNode;\n partiallyInteractive?: boolean;\n};\n\n/**\n * This component allows for rendering a IconButton control. It's a thin wrapper around the\n * [IconButton component](https://storybook.wise.design/?path=/docs/actions-iconbutton--docs), but offers only\n * a subset of its features in line with the ListItem's constraints. <br />\n * <br />\n * Please refer to the [Design documentation](https://wise.design/components/list-item---icon-button) for details.\n */\nexport const IconButton = function ({\n priority = 'minimal',\n 'aria-label': ariaLabel,\n ...props\n}: ListItemIconButtonProps) {\n const { partiallyInteractive, ...restProps } = props;\n\n const { ids, props: itemProps } = useContext(ListItemContext);\n const { baseItemProps } = useListItemControl('icon-button', {\n partiallyInteractive,\n ...restProps,\n });\n\n const getAriaProps = () => {\n const labelIds = [\n itemProps.inverted ? ids.subtitle : ids.title,\n itemProps.inverted ? ids.title : ids.subtitle,\n itemProps.inverted ? ids.valueSubtitle : ids.valueTitle,\n itemProps.inverted ? ids.valueTitle : ids.valueSubtitle,\n ].join(' ');\n const descriptorIds = [ids.additionalInfo, ids.prompt].join(' ');\n\n if (ariaLabel) {\n return {\n 'aria-label': ariaLabel,\n 'aria-describedby': labelIds.concat(descriptorIds),\n };\n }\n\n return {\n 'aria-labelledby': labelIds,\n 'aria-describedby': descriptorIds,\n };\n };\n\n return (\n <IconButtonComp\n {...restProps}\n {...getAriaProps()}\n className={clsx(\n 'wds-list-item-control',\n !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element',\n )}\n id={ids.control}\n size={40}\n priority={priority}\n disabled={baseItemProps.disabled}\n />\n );\n};\n\nIconButton.displayName = 'ListItem.IconButton';\n"],"names":["IconButton","priority","ariaLabel","props","partiallyInteractive","restProps","ids","itemProps","useContext","ListItemContext","baseItemProps","useListItemControl","getAriaProps","labelIds","inverted","subtitle","title","valueSubtitle","valueTitle","join","descriptorIds","additionalInfo","prompt","concat","_jsx","IconButtonComp","className","clsx","href","id","control","size","disabled","displayName"],"mappings":";;;;;;;;;AAqBO,MAAMA,UAAU,GAAG,UAAU;AAClCC,EAAAA,QAAQ,GAAG,SAAS;AACpB,EAAA,YAAY,EAAEC,SAAS;EACvB,GAAGC;AAAK,CACgB,EAAA;EACxB,MAAM;IAAEC,oBAAoB;IAAE,GAAGC;AAAS,GAAE,GAAGF,KAAK;EAEpD,MAAM;IAAEG,GAAG;AAAEH,IAAAA,KAAK,EAAEI;AAAS,GAAE,GAAGC,gBAAU,CAACC,+BAAe,CAAC;EAC7D,MAAM;AAAEC,IAAAA;AAAa,GAAE,GAAGC,qCAAkB,CAAC,aAAa,EAAE;IAC1DP,oBAAoB;IACpB,GAAGC;AACJ,GAAA,CAAC;EAEF,MAAMO,YAAY,GAAGA,MAAK;IACxB,MAAMC,QAAQ,GAAG,CACfN,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACS,QAAQ,GAAGT,GAAG,CAACU,KAAK,EAC7CT,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACU,KAAK,GAAGV,GAAG,CAACS,QAAQ,EAC7CR,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACW,aAAa,GAAGX,GAAG,CAACY,UAAU,EACvDX,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACY,UAAU,GAAGZ,GAAG,CAACW,aAAa,CACxD,CAACE,IAAI,CAAC,GAAG,CAAC;AACX,IAAA,MAAMC,aAAa,GAAG,CAACd,GAAG,CAACe,cAAc,EAAEf,GAAG,CAACgB,MAAM,CAAC,CAACH,IAAI,CAAC,GAAG,CAAC;AAEhE,IAAA,IAAIjB,SAAS,EAAE;MACb,OAAO;AACL,QAAA,YAAY,EAAEA,SAAS;AACvB,QAAA,kBAAkB,EAAEW,QAAQ,CAACU,MAAM,CAACH,aAAa;OAClD;AACH,IAAA;IAEA,OAAO;AACL,MAAA,iBAAiB,EAAEP,QAAQ;AAC3B,MAAA,kBAAkB,EAAEO;KACrB;EACH,CAAC;EAED,oBACEI,cAAA,CAACC,oBAAc,EAAA;AAAA,IAAA,GACTpB,SAAS;IAAA,GACTO,YAAY,EAAE;AAClBc,IAAAA,SAAS,EAAEC,SAAI,CACb,uBAAuB,EACvB,CAACvB,oBAAoB,IAAID,KAAK,CAACyB,IAAI,IAAI,sCAAsC,CAC7E;IACFC,EAAE,EAAEvB,GAAG,CAACwB,OAAQ;AAChBC,IAAAA,IAAI,EAAE,EAAG;AACT9B,IAAAA,QAAQ,EAAEA,QAAS;IACnB+B,QAAQ,EAAEtB,aAAa,CAACsB;AAAS,GAAA,CACjC;AAEN;AAEAhC,UAAU,CAACiC,WAAW,GAAG,qBAAqB;;;;"}
@@ -0,0 +1,54 @@
1
+ import { clsx } from 'clsx';
2
+ import { useContext } from 'react';
3
+ import IconButton$1 from '../../iconButton/IconButton.mjs';
4
+ import { useListItemControl } from '../useListItemControl.mjs';
5
+ import { ListItemContext } from '../ListItemContext.mjs';
6
+ import { jsx } from 'react/jsx-runtime';
7
+
8
+ const IconButton = function ({
9
+ priority = 'minimal',
10
+ 'aria-label': ariaLabel,
11
+ ...props
12
+ }) {
13
+ const {
14
+ partiallyInteractive,
15
+ ...restProps
16
+ } = props;
17
+ const {
18
+ ids,
19
+ props: itemProps
20
+ } = useContext(ListItemContext);
21
+ const {
22
+ baseItemProps
23
+ } = useListItemControl('icon-button', {
24
+ partiallyInteractive,
25
+ ...restProps
26
+ });
27
+ const getAriaProps = () => {
28
+ const labelIds = [itemProps.inverted ? ids.subtitle : ids.title, itemProps.inverted ? ids.title : ids.subtitle, itemProps.inverted ? ids.valueSubtitle : ids.valueTitle, itemProps.inverted ? ids.valueTitle : ids.valueSubtitle].join(' ');
29
+ const descriptorIds = [ids.additionalInfo, ids.prompt].join(' ');
30
+ if (ariaLabel) {
31
+ return {
32
+ 'aria-label': ariaLabel,
33
+ 'aria-describedby': labelIds.concat(descriptorIds)
34
+ };
35
+ }
36
+ return {
37
+ 'aria-labelledby': labelIds,
38
+ 'aria-describedby': descriptorIds
39
+ };
40
+ };
41
+ return /*#__PURE__*/jsx(IconButton$1, {
42
+ ...restProps,
43
+ ...getAriaProps(),
44
+ className: clsx('wds-list-item-control', !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element'),
45
+ id: ids.control,
46
+ size: 40,
47
+ priority: priority,
48
+ disabled: baseItemProps.disabled
49
+ });
50
+ };
51
+ IconButton.displayName = 'ListItem.IconButton';
52
+
53
+ export { IconButton };
54
+ //# sourceMappingURL=ListItemIconButton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItemIconButton.mjs","sources":["../../../src/listItem/IconButton/ListItemIconButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useContext, type ReactNode } from 'react';\nimport IconButtonComp, { type IconButtonProps } from '../../iconButton';\nimport { useListItemControl } from '../useListItemControl';\nimport { ListItemContext } from '../ListItemContext';\n\nexport type ListItemIconButtonProps = Pick<\n IconButtonProps,\n 'priority' | 'type' | 'onClick' | 'href' | 'target' | 'aria-label'\n> & {\n children: ReactNode;\n partiallyInteractive?: boolean;\n};\n\n/**\n * This component allows for rendering a IconButton control. It's a thin wrapper around the\n * [IconButton component](https://storybook.wise.design/?path=/docs/actions-iconbutton--docs), but offers only\n * a subset of its features in line with the ListItem's constraints. <br />\n * <br />\n * Please refer to the [Design documentation](https://wise.design/components/list-item---icon-button) for details.\n */\nexport const IconButton = function ({\n priority = 'minimal',\n 'aria-label': ariaLabel,\n ...props\n}: ListItemIconButtonProps) {\n const { partiallyInteractive, ...restProps } = props;\n\n const { ids, props: itemProps } = useContext(ListItemContext);\n const { baseItemProps } = useListItemControl('icon-button', {\n partiallyInteractive,\n ...restProps,\n });\n\n const getAriaProps = () => {\n const labelIds = [\n itemProps.inverted ? ids.subtitle : ids.title,\n itemProps.inverted ? ids.title : ids.subtitle,\n itemProps.inverted ? ids.valueSubtitle : ids.valueTitle,\n itemProps.inverted ? ids.valueTitle : ids.valueSubtitle,\n ].join(' ');\n const descriptorIds = [ids.additionalInfo, ids.prompt].join(' ');\n\n if (ariaLabel) {\n return {\n 'aria-label': ariaLabel,\n 'aria-describedby': labelIds.concat(descriptorIds),\n };\n }\n\n return {\n 'aria-labelledby': labelIds,\n 'aria-describedby': descriptorIds,\n };\n };\n\n return (\n <IconButtonComp\n {...restProps}\n {...getAriaProps()}\n className={clsx(\n 'wds-list-item-control',\n !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element',\n )}\n id={ids.control}\n size={40}\n priority={priority}\n disabled={baseItemProps.disabled}\n />\n );\n};\n\nIconButton.displayName = 'ListItem.IconButton';\n"],"names":["IconButton","priority","ariaLabel","props","partiallyInteractive","restProps","ids","itemProps","useContext","ListItemContext","baseItemProps","useListItemControl","getAriaProps","labelIds","inverted","subtitle","title","valueSubtitle","valueTitle","join","descriptorIds","additionalInfo","prompt","concat","_jsx","IconButtonComp","className","clsx","href","id","control","size","disabled","displayName"],"mappings":";;;;;;;AAqBO,MAAMA,UAAU,GAAG,UAAU;AAClCC,EAAAA,QAAQ,GAAG,SAAS;AACpB,EAAA,YAAY,EAAEC,SAAS;EACvB,GAAGC;AAAK,CACgB,EAAA;EACxB,MAAM;IAAEC,oBAAoB;IAAE,GAAGC;AAAS,GAAE,GAAGF,KAAK;EAEpD,MAAM;IAAEG,GAAG;AAAEH,IAAAA,KAAK,EAAEI;AAAS,GAAE,GAAGC,UAAU,CAACC,eAAe,CAAC;EAC7D,MAAM;AAAEC,IAAAA;AAAa,GAAE,GAAGC,kBAAkB,CAAC,aAAa,EAAE;IAC1DP,oBAAoB;IACpB,GAAGC;AACJ,GAAA,CAAC;EAEF,MAAMO,YAAY,GAAGA,MAAK;IACxB,MAAMC,QAAQ,GAAG,CACfN,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACS,QAAQ,GAAGT,GAAG,CAACU,KAAK,EAC7CT,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACU,KAAK,GAAGV,GAAG,CAACS,QAAQ,EAC7CR,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACW,aAAa,GAAGX,GAAG,CAACY,UAAU,EACvDX,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACY,UAAU,GAAGZ,GAAG,CAACW,aAAa,CACxD,CAACE,IAAI,CAAC,GAAG,CAAC;AACX,IAAA,MAAMC,aAAa,GAAG,CAACd,GAAG,CAACe,cAAc,EAAEf,GAAG,CAACgB,MAAM,CAAC,CAACH,IAAI,CAAC,GAAG,CAAC;AAEhE,IAAA,IAAIjB,SAAS,EAAE;MACb,OAAO;AACL,QAAA,YAAY,EAAEA,SAAS;AACvB,QAAA,kBAAkB,EAAEW,QAAQ,CAACU,MAAM,CAACH,aAAa;OAClD;AACH,IAAA;IAEA,OAAO;AACL,MAAA,iBAAiB,EAAEP,QAAQ;AAC3B,MAAA,kBAAkB,EAAEO;KACrB;EACH,CAAC;EAED,oBACEI,GAAA,CAACC,YAAc,EAAA;AAAA,IAAA,GACTpB,SAAS;IAAA,GACTO,YAAY,EAAE;AAClBc,IAAAA,SAAS,EAAEC,IAAI,CACb,uBAAuB,EACvB,CAACvB,oBAAoB,IAAID,KAAK,CAACyB,IAAI,IAAI,sCAAsC,CAC7E;IACFC,EAAE,EAAEvB,GAAG,CAACwB,OAAQ;AAChBC,IAAAA,IAAI,EAAE,EAAG;AACT9B,IAAAA,QAAQ,EAAEA,QAAS;IACnB+B,QAAQ,EAAEtB,aAAa,CAACsB;AAAS,GAAA,CACjC;AAEN;AAEAhC,UAAU,CAACiC,WAAW,GAAG,qBAAqB;;;;"}
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ var Image$1 = require('../../image/Image.js');
4
+ var clsx = require('clsx');
5
+ var useListItemMedia = require('../useListItemMedia.js');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ const Image = ({
9
+ alt = '',
10
+ size = 48,
11
+ className,
12
+ ...props
13
+ }) => {
14
+ useListItemMedia.useListItemMedia(size);
15
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16
+ className: clsx.clsx('wds-list-item-media-image-wrapper'),
17
+ style: {
18
+ '--wds-list-item-media-size': `${size}px`
19
+ },
20
+ children: /*#__PURE__*/jsxRuntime.jsx(Image$1.default, {
21
+ ...props,
22
+ className: clsx.clsx(className, 'wds-list-item-media-image'),
23
+ alt: alt,
24
+ role: alt ? undefined : 'presentation'
25
+ })
26
+ });
27
+ };
28
+ Image.displayName = 'ListItem.Image';
29
+
30
+ exports.Image = Image;
31
+ //# sourceMappingURL=ListItemImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItemImage.js","sources":["../../../src/listItem/Image/ListItemImage.tsx"],"sourcesContent":["import ImageComp, { type ImageProps } from '../../image';\nimport { clsx } from 'clsx';\nimport { useListItemMedia } from '../useListItemMedia';\n\nexport type ListItemImageProps = Omit<ImageProps, 'stretch' | 'shrink' | 'id' | 'alt' | 'role'> & {\n /**\n * The size of square container for the image, matching available avatar sizes.\n */\n size?: 32 | 40 | 48 | 56 | 72;\n /**\n * When unset, it will force `role=\"presentation\"` on the image. Otherwise, the image will use its implicit img role.\n */\n alt?: string;\n};\n\n/**\n * This component should be used as a last resort, for rare cases when `<ListItem.AvatarView />`\n * or `<ListItem.AvatarLayout />` are insufficient.\n * It's a wrapper around the\n * [Image component](https://storybook.wise.design/?path=/docs/content-image--docs), but offers only\n * a subset of its props, in line with the ListItem's constraints.\n *\n * > **NB**: This component is [not intended for use with illustrations](https://wise.design/foundations/illustration#scale).\n */\nexport const Image = ({ alt = '', size = 48, className, ...props }: ListItemImageProps) => {\n useListItemMedia(size);\n\n return (\n <div\n className={clsx('wds-list-item-media-image-wrapper')}\n style={\n {\n '--wds-list-item-media-size': `${size}px`,\n } as React.CSSProperties\n }\n >\n <ImageComp\n {...props}\n className={clsx(className, 'wds-list-item-media-image')}\n alt={alt}\n role={alt ? undefined : 'presentation'}\n />\n </div>\n );\n};\nImage.displayName = 'ListItem.Image';\n"],"names":["Image","alt","size","className","props","useListItemMedia","_jsx","clsx","style","children","ImageComp","role","undefined","displayName"],"mappings":";;;;;;;AAwBO,MAAMA,KAAK,GAAGA,CAAC;AAAEC,EAAAA,GAAG,GAAG,EAAE;AAAEC,EAAAA,IAAI,GAAG,EAAE;EAAEC,SAAS;EAAE,GAAGC;AAAK,CAAsB,KAAI;EACxFC,iCAAgB,CAACH,IAAI,CAAC;AAEtB,EAAA,oBACEI,cAAA,CAAA,KAAA,EAAA;AACEH,IAAAA,SAAS,EAAEI,SAAI,CAAC,mCAAmC,CAAE;AACrDC,IAAAA,KAAK,EACH;MACE,4BAA4B,EAAE,GAAGN,IAAI,CAAA,EAAA;KAExC;IAAAO,QAAA,eAEDH,cAAA,CAACI,eAAS,EAAA;AAAA,MAAA,GACJN,KAAK;AACTD,MAAAA,SAAS,EAAEI,SAAI,CAACJ,SAAS,EAAE,2BAA2B,CAAE;AACxDF,MAAAA,GAAG,EAAEA,GAAI;AACTU,MAAAA,IAAI,EAAEV,GAAG,GAAGW,SAAS,GAAG;KAAe;AAE3C,GAAK,CAAC;AAEV;AACAZ,KAAK,CAACa,WAAW,GAAG,gBAAgB;;;;"}
@@ -0,0 +1,29 @@
1
+ import Image$1 from '../../image/Image.mjs';
2
+ import { clsx } from 'clsx';
3
+ import { useListItemMedia } from '../useListItemMedia.mjs';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ const Image = ({
7
+ alt = '',
8
+ size = 48,
9
+ className,
10
+ ...props
11
+ }) => {
12
+ useListItemMedia(size);
13
+ return /*#__PURE__*/jsx("div", {
14
+ className: clsx('wds-list-item-media-image-wrapper'),
15
+ style: {
16
+ '--wds-list-item-media-size': `${size}px`
17
+ },
18
+ children: /*#__PURE__*/jsx(Image$1, {
19
+ ...props,
20
+ className: clsx(className, 'wds-list-item-media-image'),
21
+ alt: alt,
22
+ role: alt ? undefined : 'presentation'
23
+ })
24
+ });
25
+ };
26
+ Image.displayName = 'ListItem.Image';
27
+
28
+ export { Image };
29
+ //# sourceMappingURL=ListItemImage.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItemImage.mjs","sources":["../../../src/listItem/Image/ListItemImage.tsx"],"sourcesContent":["import ImageComp, { type ImageProps } from '../../image';\nimport { clsx } from 'clsx';\nimport { useListItemMedia } from '../useListItemMedia';\n\nexport type ListItemImageProps = Omit<ImageProps, 'stretch' | 'shrink' | 'id' | 'alt' | 'role'> & {\n /**\n * The size of square container for the image, matching available avatar sizes.\n */\n size?: 32 | 40 | 48 | 56 | 72;\n /**\n * When unset, it will force `role=\"presentation\"` on the image. Otherwise, the image will use its implicit img role.\n */\n alt?: string;\n};\n\n/**\n * This component should be used as a last resort, for rare cases when `<ListItem.AvatarView />`\n * or `<ListItem.AvatarLayout />` are insufficient.\n * It's a wrapper around the\n * [Image component](https://storybook.wise.design/?path=/docs/content-image--docs), but offers only\n * a subset of its props, in line with the ListItem's constraints.\n *\n * > **NB**: This component is [not intended for use with illustrations](https://wise.design/foundations/illustration#scale).\n */\nexport const Image = ({ alt = '', size = 48, className, ...props }: ListItemImageProps) => {\n useListItemMedia(size);\n\n return (\n <div\n className={clsx('wds-list-item-media-image-wrapper')}\n style={\n {\n '--wds-list-item-media-size': `${size}px`,\n } as React.CSSProperties\n }\n >\n <ImageComp\n {...props}\n className={clsx(className, 'wds-list-item-media-image')}\n alt={alt}\n role={alt ? undefined : 'presentation'}\n />\n </div>\n );\n};\nImage.displayName = 'ListItem.Image';\n"],"names":["Image","alt","size","className","props","useListItemMedia","_jsx","clsx","style","children","ImageComp","role","undefined","displayName"],"mappings":";;;;;AAwBO,MAAMA,KAAK,GAAGA,CAAC;AAAEC,EAAAA,GAAG,GAAG,EAAE;AAAEC,EAAAA,IAAI,GAAG,EAAE;EAAEC,SAAS;EAAE,GAAGC;AAAK,CAAsB,KAAI;EACxFC,gBAAgB,CAACH,IAAI,CAAC;AAEtB,EAAA,oBACEI,GAAA,CAAA,KAAA,EAAA;AACEH,IAAAA,SAAS,EAAEI,IAAI,CAAC,mCAAmC,CAAE;AACrDC,IAAAA,KAAK,EACH;MACE,4BAA4B,EAAE,GAAGN,IAAI,CAAA,EAAA;KAExC;IAAAO,QAAA,eAEDH,GAAA,CAACI,OAAS,EAAA;AAAA,MAAA,GACJN,KAAK;AACTD,MAAAA,SAAS,EAAEI,IAAI,CAACJ,SAAS,EAAE,2BAA2B,CAAE;AACxDF,MAAAA,GAAG,EAAEA,GAAI;AACTU,MAAAA,IAAI,EAAEV,GAAG,GAAGW,SAAS,GAAG;KAAe;AAE3C,GAAK,CAAC;AAEV;AACAZ,KAAK,CAACa,WAAW,GAAG,gBAAgB;;;;"}
@@ -0,0 +1,311 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ require('../common/theme.js');
7
+ require('../common/direction.js');
8
+ require('../common/propsValues/control.js');
9
+ require('../common/propsValues/breakpoint.js');
10
+ require('../common/propsValues/size.js');
11
+ var typography = require('../common/propsValues/typography.js');
12
+ require('../common/propsValues/width.js');
13
+ require('../common/propsValues/type.js');
14
+ require('../common/propsValues/dateMode.js');
15
+ require('../common/propsValues/monthFormat.js');
16
+ require('../common/propsValues/position.js');
17
+ require('../common/propsValues/layouts.js');
18
+ require('../common/propsValues/status.js');
19
+ require('../common/propsValues/sentiment.js');
20
+ require('../common/propsValues/profileType.js');
21
+ require('../common/propsValues/variant.js');
22
+ require('../common/propsValues/scroll.js');
23
+ require('../common/propsValues/markdownNodeType.js');
24
+ require('../common/fileType.js');
25
+ require('@transferwise/icons');
26
+ var clsx = require('clsx');
27
+ require('react-intl');
28
+ require('../common/closeButton/CloseButton.messages.js');
29
+ var jsxRuntime = require('react/jsx-runtime');
30
+ var Body = require('../body/Body.js');
31
+ var ListItemAdditionalInfo = require('./AdditionalInfo/ListItemAdditionalInfo.js');
32
+ var ListItemIconButton = require('./IconButton/ListItemIconButton.js');
33
+ var ListItemCheckbox = require('./Checkbox/ListItemCheckbox.js');
34
+ var ListItemNavigation = require('./Navigation/ListItemNavigation.js');
35
+ var ListItemButton = require('./Button/ListItemButton.js');
36
+ var ListItemRadio = require('./Radio/ListItemRadio.js');
37
+ var ListItemSwitch = require('./Switch/ListItemSwitch.js');
38
+ var ListItemAvatarLayout = require('./AvatarLayout/ListItemAvatarLayout.js');
39
+ var ListItemAvatarView = require('./AvatarView/ListItemAvatarView.js');
40
+ var ListItemImage = require('./Image/ListItemImage.js');
41
+ var ListItemPrompt = require('./Prompt/ListItemPrompt.js');
42
+ require('../primitives/PrimitiveButton/PrimitiveButton.js');
43
+ var PrimitiveAnchor = require('../primitives/PrimitiveAnchor/PrimitiveAnchor.js');
44
+ var ListItemContext = require('./ListItemContext.js');
45
+
46
+ const ListItem = ({
47
+ as: ListItemElement = 'li',
48
+ title,
49
+ subtitle,
50
+ additionalInfo,
51
+ prompt,
52
+ inverted,
53
+ media,
54
+ spotlight,
55
+ valueTitle,
56
+ valueSubtitle,
57
+ control = null,
58
+ disabled,
59
+ className,
60
+ valueColumnWidth,
61
+ id
62
+ }) => {
63
+ const idPrefix = React.useId();
64
+ const [controlProps, setControlProps] = React.useState({});
65
+ const [controlType, setControlType] = React.useState('non-interactive');
66
+ const [mediaSize, setMediaSize] = React.useState();
67
+ const ids = {
68
+ title: `${idPrefix}_title`,
69
+ ...(subtitle ? {
70
+ subtitle: `${idPrefix}_subtitle`
71
+ } : {}),
72
+ ...(valueTitle ? {
73
+ valueTitle: `${idPrefix}_value-title`
74
+ } : {}),
75
+ ...(valueSubtitle ? {
76
+ valueSubtitle: `${idPrefix}_value-subtitle`
77
+ } : {}),
78
+ control: `${idPrefix}_control`,
79
+ ...(prompt ? {
80
+ prompt: `${idPrefix}_prompt`
81
+ } : {}),
82
+ ...(additionalInfo ? {
83
+ additionalInfo: `${idPrefix}_additional-info`
84
+ } : {})
85
+ };
86
+ const isPartiallyInteractive = Boolean((controlType === 'button' || controlType === 'icon-button') && controlProps?.partiallyInteractive);
87
+ const isFullyInteractive = controlType !== 'non-interactive' && !isPartiallyInteractive;
88
+ const isButtonAsLink = (controlType === 'button' || controlType === 'icon-button') && Boolean(controlProps?.href);
89
+ const titlesAndValues = [inverted ? ids.subtitle : ids.title, inverted ? ids.title : ids.subtitle, inverted ? ids.valueSubtitle : ids.valueTitle, inverted ? ids.valueTitle : ids.valueSubtitle].join(' ');
90
+ const additionalInfoPrompt = [ids.additionalInfo, ids.prompt].filter(Boolean).join(' ');
91
+ const describedByIds = React.useMemo(() => {
92
+ return isFullyInteractive && !isButtonAsLink ? additionalInfoPrompt : `${titlesAndValues} ${additionalInfoPrompt}`;
93
+ }, [isFullyInteractive]);
94
+ const listItemContext = React.useMemo(() => ({
95
+ setControlType,
96
+ setControlProps,
97
+ setMediaSize,
98
+ ids,
99
+ props: {
100
+ disabled,
101
+ inverted
102
+ },
103
+ mediaSize,
104
+ describedByIds
105
+ }), [describedByIds, mediaSize]);
106
+ const gridColumnsStyle = {
107
+ '--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',
108
+ '--wds-list-item-body-right': valueColumnWidth ? `${valueColumnWidth}fr` : '50fr'
109
+ };
110
+ const getFeatureClassName = () => {
111
+ const partials = [];
112
+ const hasMedia = Boolean(media);
113
+ const hasControl = Boolean(control);
114
+ const hasInfo = Boolean(additionalInfo);
115
+ const hasPrompt = Boolean(prompt);
116
+ /* eslint-disable functional/immutable-data */
117
+ if (hasMedia && hasControl) {
118
+ partials.push('wds-list-item-hasMedia-hasControl');
119
+ }
120
+ if (hasMedia && !hasControl) {
121
+ partials.push('wds-list-item-hasMedia-noControl');
122
+ }
123
+ if (!hasMedia && hasControl) {
124
+ partials.push('wds-list-item-noMedia-hasControl');
125
+ }
126
+ if (!hasMedia && !hasControl) {
127
+ partials.push('wds-list-item-noMedia-noControl');
128
+ }
129
+ if (hasInfo && hasPrompt) {
130
+ partials.push('wds-list-item-hasInfo-hasPrompt');
131
+ }
132
+ if (hasInfo && !hasPrompt) {
133
+ partials.push('wds-list-item-hasInfo-noPrompt');
134
+ }
135
+ if (!hasInfo && hasPrompt) {
136
+ partials.push('wds-list-item-noInfo-hasPrompt');
137
+ }
138
+ if (!hasInfo && !hasPrompt) {
139
+ partials.push('wds-list-item-noInfo-noPrompt');
140
+ }
141
+ /* eslint-enable functional/immutable-data */
142
+ return partials.join(' ');
143
+ };
144
+ return /*#__PURE__*/jsxRuntime.jsx(ListItemContext.ListItemContext.Provider, {
145
+ value: listItemContext,
146
+ children: /*#__PURE__*/jsxRuntime.jsxs(ListItemElement, {
147
+ className: clsx.clsx('wds-list-item', `wds-list-item-${controlType}`, getFeatureClassName(), {
148
+ 'wds-list-item-interactive': isFullyInteractive,
149
+ 'wds-list-item-partially-interactive': isPartiallyInteractive,
150
+ [`wds-list-item-spotlight wds-list-item-spotlight-${spotlight}`]: isFullyInteractive && !!spotlight,
151
+ disabled
152
+ }, className),
153
+ id: id,
154
+ "aria-disabled": disabled,
155
+ children: [spotlight === 'inactive' && /*#__PURE__*/jsxRuntime.jsx("svg", {
156
+ "aria-hidden": "true",
157
+ className: "wds-list-item-spotlight__border",
158
+ children: /*#__PURE__*/jsxRuntime.jsx("rect", {})
159
+ }), /*#__PURE__*/jsxRuntime.jsxs(View, {
160
+ isPartiallyInteractive,
161
+ subtitle,
162
+ additionalInfo,
163
+ disabled,
164
+ prompt,
165
+ controlType,
166
+ controlProps,
167
+ className: getFeatureClassName(),
168
+ children: [media && /*#__PURE__*/jsxRuntime.jsx("div", {
169
+ className: "wds-list-item-media",
170
+ children: media
171
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
172
+ className: "wds-list-item-body",
173
+ style: valueColumnWidth ? gridColumnsStyle : undefined,
174
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
175
+ className: clsx.clsx({
176
+ 'wds-list-item-body-center': title && !subtitle
177
+ }),
178
+ children: (() => {
179
+ const titles = [/*#__PURE__*/jsxRuntime.jsx(Body.default, {
180
+ id: ids.title,
181
+ type: typography.Typography.BODY_LARGE_BOLD,
182
+ className: "wds-list-item-title",
183
+ children: title
184
+ }, ids.title)];
185
+ if (subtitle) {
186
+ titles.push(/*#__PURE__*/jsxRuntime.jsx(Body.default, {
187
+ id: ids.subtitle,
188
+ className: "wds-list-item-subtitle",
189
+ children: subtitle
190
+ }, ids.subtitle));
191
+ }
192
+ return inverted ? [...titles].reverse() : titles;
193
+ })()
194
+ }), (valueTitle || valueSubtitle) && /*#__PURE__*/jsxRuntime.jsx("span", {
195
+ className: clsx.clsx('wds-list-item-value', {
196
+ 'flex-column': valueTitle !== undefined || valueSubtitle !== undefined,
197
+ 'wds-list-item-body-center': valueTitle && !valueSubtitle || !valueTitle && valueSubtitle
198
+ }),
199
+ children: (() => {
200
+ const values = [];
201
+ if (valueTitle) {
202
+ values.push(/*#__PURE__*/jsxRuntime.jsx(Body.default, {
203
+ id: ids.valueTitle,
204
+ type: typography.Typography.BODY_LARGE_BOLD,
205
+ className: "wds-list-item-title-value",
206
+ children: valueTitle
207
+ }, ids.valueTitle));
208
+ }
209
+ if (valueSubtitle) {
210
+ values.push(/*#__PURE__*/jsxRuntime.jsx(Body.default, {
211
+ id: ids.valueSubtitle,
212
+ className: "wds-list-item-subtitle-value",
213
+ children: valueSubtitle
214
+ }, ids.valueSubtitle));
215
+ }
216
+ return inverted ? [...values].reverse() : values;
217
+ })()
218
+ })]
219
+ }), control === null ? null : /*#__PURE__*/jsxRuntime.jsx(Body.default, {
220
+ className: clsx.clsx('wds-list-item-control-wrapper', {
221
+ 'wds-list-item-button-control': controlType === 'button'
222
+ }),
223
+ style: {
224
+ '--wds-list-item-control-wrapper-height': mediaSize ? `${mediaSize}px` : 'auto'
225
+ },
226
+ children: control
227
+ })]
228
+ })]
229
+ })
230
+ });
231
+ };
232
+ function View({
233
+ children,
234
+ subtitle,
235
+ additionalInfo,
236
+ prompt,
237
+ disabled,
238
+ isPartiallyInteractive,
239
+ controlType = 'non-interactive',
240
+ controlProps,
241
+ className = ''
242
+ }) {
243
+ const {
244
+ ids,
245
+ describedByIds
246
+ } = React.useContext(ListItemContext.ListItemContext);
247
+ const isLinkControl = ['navigation'].includes(controlType);
248
+ const isHrefProvided = isLinkControl && !!controlProps?.href;
249
+ const renderExtras = () => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
250
+ children: [additionalInfo, prompt]
251
+ });
252
+ if (isLinkControl && isHrefProvided) {
253
+ return (
254
+ /*#__PURE__*/
255
+ // for link instances of .Navigation, .IconButton, .Button
256
+ jsxRuntime.jsxs("div", {
257
+ className: clsx.clsx('wds-list-item-gridWrapper', className),
258
+ children: [/*#__PURE__*/jsxRuntime.jsx(PrimitiveAnchor.default, {
259
+ "aria-describedby": describedByIds,
260
+ href: controlProps?.href,
261
+ target: controlProps?.target,
262
+ className: clsx.clsx('wds-list-item-view d-flex flex-row', {
263
+ 'wds-list-item-control': controlType === 'navigation',
264
+ fullyInteractive: !isPartiallyInteractive
265
+ }),
266
+ disabled: disabled,
267
+ onClick: controlProps?.onClick,
268
+ children: children
269
+ }), renderExtras()]
270
+ })
271
+ );
272
+ }
273
+ if (isPartiallyInteractive || controlType === 'non-interactive') {
274
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
275
+ className: clsx.clsx('wds-list-item-gridWrapper', className),
276
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
277
+ className: clsx.clsx('wds-list-item-view d-flex flex-row'),
278
+ children: children
279
+ }), renderExtras()]
280
+ });
281
+ }
282
+ // for form control instances of .Radio, .Checkbox, .Switch, .Button, .Navigation etc
283
+ // Radio cannot be wrapped in a <fieldset> element to announce it as a group.
284
+ const InputWrapper = controlType === 'radio' ? 'div' : 'fieldset';
285
+ return /*#__PURE__*/jsxRuntime.jsxs(InputWrapper, {
286
+ className: clsx.clsx('wds-list-item-gridWrapper', className),
287
+ children: [/*#__PURE__*/jsxRuntime.jsx("label", {
288
+ htmlFor: ids.control,
289
+ className: clsx.clsx('wds-list-item-view', {
290
+ clickable: !disabled,
291
+ fullyInteractive: !isPartiallyInteractive
292
+ }),
293
+ children: children
294
+ }), renderExtras()]
295
+ });
296
+ }
297
+ ListItem.Image = ListItemImage.Image;
298
+ ListItem.AvatarView = ListItemAvatarView.AvatarView;
299
+ ListItem.AvatarLayout = ListItemAvatarLayout.AvatarLayout;
300
+ ListItem.AdditionalInfo = ListItemAdditionalInfo.AdditionalInfo;
301
+ ListItem.Checkbox = ListItemCheckbox.Checkbox;
302
+ ListItem.Radio = ListItemRadio.Radio;
303
+ ListItem.IconButton = ListItemIconButton.IconButton;
304
+ ListItem.Navigation = ListItemNavigation.Navigation;
305
+ ListItem.Button = ListItemButton.Button;
306
+ ListItem.Switch = ListItemSwitch.Switch;
307
+ ListItem.Prompt = ListItemPrompt.Prompt;
308
+
309
+ exports.ListItem = ListItem;
310
+ exports.default = ListItem;
311
+ //# sourceMappingURL=ListItem.js.map