@transferwise/components 0.0.0-experimental-29d0f94 → 0.0.0-experimental-4b1de0a

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 (319) hide show
  1. package/build/button/Button.js +1 -0
  2. package/build/button/Button.js.map +1 -1
  3. package/build/button/Button.mjs +1 -0
  4. package/build/button/Button.mjs.map +1 -1
  5. package/build/common/RadioButton/RadioButton.js +5 -2
  6. package/build/common/RadioButton/RadioButton.js.map +1 -1
  7. package/build/common/RadioButton/RadioButton.mjs +5 -2
  8. package/build/common/RadioButton/RadioButton.mjs.map +1 -1
  9. package/build/common/initials.js +1 -4
  10. package/build/common/initials.js.map +1 -1
  11. package/build/common/initials.mjs +1 -4
  12. package/build/common/initials.mjs.map +1 -1
  13. package/build/i18n/de.json +0 -2
  14. package/build/i18n/de.json.js +0 -2
  15. package/build/i18n/de.json.js.map +1 -1
  16. package/build/i18n/de.json.mjs +0 -2
  17. package/build/i18n/de.json.mjs.map +1 -1
  18. package/build/i18n/fr.json +0 -2
  19. package/build/i18n/fr.json.js +0 -2
  20. package/build/i18n/fr.json.js.map +1 -1
  21. package/build/i18n/fr.json.mjs +0 -2
  22. package/build/i18n/fr.json.mjs.map +1 -1
  23. package/build/i18n/hu.json +0 -2
  24. package/build/i18n/hu.json.js +0 -2
  25. package/build/i18n/hu.json.js.map +1 -1
  26. package/build/i18n/hu.json.mjs +0 -2
  27. package/build/i18n/hu.json.mjs.map +1 -1
  28. package/build/i18n/it.json +0 -2
  29. package/build/i18n/it.json.js +0 -2
  30. package/build/i18n/it.json.js.map +1 -1
  31. package/build/i18n/it.json.mjs +0 -2
  32. package/build/i18n/it.json.mjs.map +1 -1
  33. package/build/i18n/ja.json +0 -2
  34. package/build/i18n/ja.json.js +0 -2
  35. package/build/i18n/ja.json.js.map +1 -1
  36. package/build/i18n/ja.json.mjs +0 -2
  37. package/build/i18n/ja.json.mjs.map +1 -1
  38. package/build/i18n/pl.json +0 -2
  39. package/build/i18n/pl.json.js +0 -2
  40. package/build/i18n/pl.json.js.map +1 -1
  41. package/build/i18n/pl.json.mjs +0 -2
  42. package/build/i18n/pl.json.mjs.map +1 -1
  43. package/build/i18n/ro.json +0 -2
  44. package/build/i18n/ro.json.js +0 -2
  45. package/build/i18n/ro.json.js.map +1 -1
  46. package/build/i18n/ro.json.mjs +0 -2
  47. package/build/i18n/ro.json.mjs.map +1 -1
  48. package/build/i18n/ru.json +0 -2
  49. package/build/i18n/ru.json.js +0 -2
  50. package/build/i18n/ru.json.js.map +1 -1
  51. package/build/i18n/ru.json.mjs +0 -2
  52. package/build/i18n/ru.json.mjs.map +1 -1
  53. package/build/i18n/tr.json +0 -2
  54. package/build/i18n/tr.json.js +0 -2
  55. package/build/i18n/tr.json.js.map +1 -1
  56. package/build/i18n/tr.json.mjs +0 -2
  57. package/build/i18n/tr.json.mjs.map +1 -1
  58. package/build/i18n/zh-CN.json +0 -2
  59. package/build/i18n/zh-CN.json.js +0 -2
  60. package/build/i18n/zh-CN.json.js.map +1 -1
  61. package/build/i18n/zh-CN.json.mjs +0 -2
  62. package/build/i18n/zh-CN.json.mjs.map +1 -1
  63. package/build/i18n/zh-HK.json +0 -2
  64. package/build/i18n/zh-HK.json.js +0 -2
  65. package/build/i18n/zh-HK.json.js.map +1 -1
  66. package/build/i18n/zh-HK.json.mjs +0 -2
  67. package/build/i18n/zh-HK.json.mjs.map +1 -1
  68. package/build/iconButton/IconButton.js.map +1 -1
  69. package/build/iconButton/IconButton.mjs.map +1 -1
  70. package/build/image/Image.js.map +1 -1
  71. package/build/image/Image.mjs.map +1 -1
  72. package/build/index.js +2 -0
  73. package/build/index.js.map +1 -1
  74. package/build/index.mjs +1 -0
  75. package/build/index.mjs.map +1 -1
  76. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +56 -0
  77. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js.map +1 -0
  78. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +54 -0
  79. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs.map +1 -0
  80. package/build/listItem/AvatarLayout/ListItemAvatarLayout.js +23 -0
  81. package/build/listItem/AvatarLayout/ListItemAvatarLayout.js.map +1 -0
  82. package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs +21 -0
  83. package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs.map +1 -0
  84. package/build/listItem/AvatarView/ListItemAvatarView.js +23 -0
  85. package/build/listItem/AvatarView/ListItemAvatarView.js.map +1 -0
  86. package/build/listItem/AvatarView/ListItemAvatarView.mjs +21 -0
  87. package/build/listItem/AvatarView/ListItemAvatarView.mjs.map +1 -0
  88. package/build/listItem/Button/ListItemButton.js +43 -0
  89. package/build/listItem/Button/ListItemButton.js.map +1 -0
  90. package/build/listItem/Button/ListItemButton.mjs +41 -0
  91. package/build/listItem/Button/ListItemButton.mjs.map +1 -0
  92. package/build/listItem/Checkbox/ListItemCheckbox.js +30 -0
  93. package/build/listItem/Checkbox/ListItemCheckbox.js.map +1 -0
  94. package/build/listItem/Checkbox/ListItemCheckbox.mjs +28 -0
  95. package/build/listItem/Checkbox/ListItemCheckbox.mjs.map +1 -0
  96. package/build/listItem/IconButton/ListItemIconButton.js +42 -0
  97. package/build/listItem/IconButton/ListItemIconButton.js.map +1 -0
  98. package/build/listItem/IconButton/ListItemIconButton.mjs +40 -0
  99. package/build/listItem/IconButton/ListItemIconButton.mjs.map +1 -0
  100. package/build/listItem/Image/ListItemImage.js +31 -0
  101. package/build/listItem/Image/ListItemImage.js.map +1 -0
  102. package/build/listItem/Image/ListItemImage.mjs +29 -0
  103. package/build/listItem/Image/ListItemImage.mjs.map +1 -0
  104. package/build/listItem/ListItem.js +312 -0
  105. package/build/listItem/ListItem.js.map +1 -0
  106. package/build/listItem/ListItem.mjs +307 -0
  107. package/build/listItem/ListItem.mjs.map +1 -0
  108. package/build/listItem/ListItemContext.js +8 -0
  109. package/build/listItem/ListItemContext.js.map +1 -0
  110. package/build/listItem/ListItemContext.mjs +6 -0
  111. package/build/listItem/ListItemContext.mjs.map +1 -0
  112. package/build/listItem/Navigation/ListItemNavigation.js +45 -0
  113. package/build/listItem/Navigation/ListItemNavigation.js.map +1 -0
  114. package/build/listItem/Navigation/ListItemNavigation.mjs +43 -0
  115. package/build/listItem/Navigation/ListItemNavigation.mjs.map +1 -0
  116. package/build/listItem/Prompt/ListItemPrompt.js +59 -0
  117. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -0
  118. package/build/listItem/Prompt/ListItemPrompt.mjs +54 -0
  119. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -0
  120. package/build/listItem/Radio/ListItemRadio.js +30 -0
  121. package/build/listItem/Radio/ListItemRadio.js.map +1 -0
  122. package/build/listItem/Radio/ListItemRadio.mjs +28 -0
  123. package/build/listItem/Radio/ListItemRadio.mjs.map +1 -0
  124. package/build/listItem/Switch/ListItemSwitch.js +30 -0
  125. package/build/listItem/Switch/ListItemSwitch.js.map +1 -0
  126. package/build/listItem/Switch/ListItemSwitch.mjs +28 -0
  127. package/build/listItem/Switch/ListItemSwitch.mjs.map +1 -0
  128. package/build/listItem/useListItemControl.js +22 -0
  129. package/build/listItem/useListItemControl.js.map +1 -0
  130. package/build/listItem/useListItemControl.mjs +20 -0
  131. package/build/listItem/useListItemControl.mjs.map +1 -0
  132. package/build/listItem/useListItemMedia.js +21 -0
  133. package/build/listItem/useListItemMedia.js.map +1 -0
  134. package/build/listItem/useListItemMedia.mjs +19 -0
  135. package/build/listItem/useListItemMedia.mjs.map +1 -0
  136. package/build/main.css +773 -1
  137. package/build/styles/avatarView/AvatarView.css +3 -1
  138. package/build/styles/listItem/ListItem.css +770 -0
  139. package/build/styles/listItem/ListItem.grid.css +370 -0
  140. package/build/styles/main.css +773 -1
  141. package/build/switch/Switch.js +2 -0
  142. package/build/switch/Switch.js.map +1 -1
  143. package/build/switch/Switch.mjs +2 -0
  144. package/build/switch/Switch.mjs.map +1 -1
  145. package/build/test-utils/assets/placeholder-landscape.svg +1 -0
  146. package/build/test-utils/assets/placeholder-portrait.svg +1 -0
  147. package/build/types/button/Button.d.ts.map +1 -1
  148. package/build/types/button/Button.types.d.ts +1 -1
  149. package/build/types/button/Button.types.d.ts.map +1 -1
  150. package/build/types/button/index.d.ts +1 -1
  151. package/build/types/button/index.d.ts.map +1 -1
  152. package/build/types/common/RadioButton/RadioButton.d.ts +3 -1
  153. package/build/types/common/RadioButton/RadioButton.d.ts.map +1 -1
  154. package/build/types/common/initials.d.ts.map +1 -1
  155. package/build/types/iconButton/IconButton.d.ts +2 -2
  156. package/build/types/iconButton/IconButton.d.ts.map +1 -1
  157. package/build/types/image/Image.d.ts +3 -0
  158. package/build/types/image/Image.d.ts.map +1 -1
  159. package/build/types/image/index.d.ts +1 -0
  160. package/build/types/image/index.d.ts.map +1 -1
  161. package/build/types/index.d.ts +2 -0
  162. package/build/types/index.d.ts.map +1 -1
  163. package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts +15 -0
  164. package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts.map +1 -0
  165. package/build/types/listItem/AdditionalInfo/index.d.ts +3 -0
  166. package/build/types/listItem/AdditionalInfo/index.d.ts.map +1 -0
  167. package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts +18 -0
  168. package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts.map +1 -0
  169. package/build/types/listItem/AvatarLayout/index.d.ts +3 -0
  170. package/build/types/listItem/AvatarLayout/index.d.ts.map +1 -0
  171. package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts +16 -0
  172. package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts.map +1 -0
  173. package/build/types/listItem/AvatarView/index.d.ts +3 -0
  174. package/build/types/listItem/AvatarView/index.d.ts.map +1 -0
  175. package/build/types/listItem/Button/ListItemButton.d.ts +20 -0
  176. package/build/types/listItem/Button/ListItemButton.d.ts.map +1 -0
  177. package/build/types/listItem/Button/index.d.ts +3 -0
  178. package/build/types/listItem/Button/index.d.ts.map +1 -0
  179. package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts +14 -0
  180. package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts.map +1 -0
  181. package/build/types/listItem/Checkbox/index.d.ts +3 -0
  182. package/build/types/listItem/Checkbox/index.d.ts.map +1 -0
  183. package/build/types/listItem/IconButton/ListItemIconButton.d.ts +18 -0
  184. package/build/types/listItem/IconButton/ListItemIconButton.d.ts.map +1 -0
  185. package/build/types/listItem/IconButton/index.d.ts +3 -0
  186. package/build/types/listItem/IconButton/index.d.ts.map +1 -0
  187. package/build/types/listItem/Image/ListItemImage.d.ts +25 -0
  188. package/build/types/listItem/Image/ListItemImage.d.ts.map +1 -0
  189. package/build/types/listItem/Image/index.d.ts +3 -0
  190. package/build/types/listItem/Image/index.d.ts.map +1 -0
  191. package/build/types/listItem/ListItem.d.ts +113 -0
  192. package/build/types/listItem/ListItem.d.ts.map +1 -0
  193. package/build/types/listItem/ListItemContext.d.ts +22 -0
  194. package/build/types/listItem/ListItemContext.d.ts.map +1 -0
  195. package/build/types/listItem/Navigation/ListItemNavigation.d.ts +15 -0
  196. package/build/types/listItem/Navigation/ListItemNavigation.d.ts.map +1 -0
  197. package/build/types/listItem/Navigation/index.d.ts +3 -0
  198. package/build/types/listItem/Navigation/index.d.ts.map +1 -0
  199. package/build/types/listItem/Prompt/ListItemPrompt.d.ts +16 -0
  200. package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +1 -0
  201. package/build/types/listItem/Prompt/index.d.ts +3 -0
  202. package/build/types/listItem/Prompt/index.d.ts.map +1 -0
  203. package/build/types/listItem/Radio/ListItemRadio.d.ts +14 -0
  204. package/build/types/listItem/Radio/ListItemRadio.d.ts.map +1 -0
  205. package/build/types/listItem/Radio/index.d.ts +3 -0
  206. package/build/types/listItem/Radio/index.d.ts.map +1 -0
  207. package/build/types/listItem/Switch/ListItemSwitch.d.ts +14 -0
  208. package/build/types/listItem/Switch/ListItemSwitch.d.ts.map +1 -0
  209. package/build/types/listItem/Switch/index.d.ts +3 -0
  210. package/build/types/listItem/Switch/index.d.ts.map +1 -0
  211. package/build/types/listItem/_stories/helpers.d.ts +27 -0
  212. package/build/types/listItem/_stories/helpers.d.ts.map +1 -0
  213. package/build/types/listItem/_stories/subcomponents.d.ts +18 -0
  214. package/build/types/listItem/_stories/subcomponents.d.ts.map +1 -0
  215. package/build/types/listItem/index.d.ts +14 -0
  216. package/build/types/listItem/index.d.ts.map +1 -0
  217. package/build/types/listItem/test-utils.d.ts +7 -0
  218. package/build/types/listItem/test-utils.d.ts.map +1 -0
  219. package/build/types/listItem/useListItemControl.d.ts +5 -0
  220. package/build/types/listItem/useListItemControl.d.ts.map +1 -0
  221. package/build/types/listItem/useListItemMedia.d.ts +6 -0
  222. package/build/types/listItem/useListItemMedia.d.ts.map +1 -0
  223. package/build/types/switch/Switch.d.ts +3 -1
  224. package/build/types/switch/Switch.d.ts.map +1 -1
  225. package/package.json +4 -4
  226. package/src/avatarView/AvatarView.css +3 -1
  227. package/src/avatarView/AvatarView.less +2 -1
  228. package/src/button/Button.spec.tsx +18 -0
  229. package/src/button/Button.tsx +5 -1
  230. package/src/button/Button.types.ts +1 -1
  231. package/src/button/index.ts +1 -1
  232. package/src/checkboxButton/CheckboxButton.story.tsx +4 -4
  233. package/src/common/RadioButton/RadioButton.tsx +6 -1
  234. package/src/common/initials.spec.tsx +0 -13
  235. package/src/common/initials.ts +0 -5
  236. package/src/i18n/de.json +0 -2
  237. package/src/i18n/fr.json +0 -2
  238. package/src/i18n/hu.json +0 -2
  239. package/src/i18n/it.json +0 -2
  240. package/src/i18n/ja.json +0 -2
  241. package/src/i18n/pl.json +0 -2
  242. package/src/i18n/ro.json +0 -2
  243. package/src/i18n/ru.json +0 -2
  244. package/src/i18n/tr.json +0 -2
  245. package/src/i18n/zh-CN.json +0 -2
  246. package/src/i18n/zh-HK.json +0 -2
  247. package/src/iconButton/IconButton.story.tsx +1 -1
  248. package/src/iconButton/IconButton.tsx +1 -1
  249. package/src/image/Image.tsx +3 -0
  250. package/src/image/index.ts +1 -0
  251. package/src/index.ts +2 -0
  252. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.spec.tsx +56 -0
  253. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +195 -0
  254. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.tsx +36 -0
  255. package/src/listItem/AdditionalInfo/index.ts +2 -0
  256. package/src/listItem/AvatarLayout/ListItemAvatarLayout.spec.tsx +59 -0
  257. package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +121 -0
  258. package/src/listItem/AvatarLayout/ListItemAvatarLayout.tsx +27 -0
  259. package/src/listItem/AvatarLayout/index.ts +2 -0
  260. package/src/listItem/AvatarView/ListItemAvatarView.spec.tsx +75 -0
  261. package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +336 -0
  262. package/src/listItem/AvatarView/ListItemAvatarView.tsx +27 -0
  263. package/src/listItem/AvatarView/index.ts +2 -0
  264. package/src/listItem/Button/ListItemButton.spec.tsx +68 -0
  265. package/src/listItem/Button/ListItemButton.story.tsx +466 -0
  266. package/src/listItem/Button/ListItemButton.tsx +56 -0
  267. package/src/listItem/Button/index.ts +2 -0
  268. package/src/listItem/Checkbox/ListItemCheckbox.spec.tsx +82 -0
  269. package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +125 -0
  270. package/src/listItem/Checkbox/ListItemCheckbox.tsx +33 -0
  271. package/src/listItem/Checkbox/index.ts +2 -0
  272. package/src/listItem/IconButton/ListItemIconButton.spec.tsx +119 -0
  273. package/src/listItem/IconButton/ListItemIconButton.story.tsx +249 -0
  274. package/src/listItem/IconButton/ListItemIconButton.tsx +56 -0
  275. package/src/listItem/IconButton/index.ts +2 -0
  276. package/src/listItem/Image/ListItemImage.spec.tsx +30 -0
  277. package/src/listItem/Image/ListItemImage.story.tsx +77 -0
  278. package/src/listItem/Image/ListItemImage.tsx +48 -0
  279. package/src/listItem/Image/index.ts +2 -0
  280. package/src/listItem/ListItem.css +770 -0
  281. package/src/listItem/ListItem.grid.css +370 -0
  282. package/src/listItem/ListItem.grid.less +622 -0
  283. package/src/listItem/ListItem.less +421 -0
  284. package/src/listItem/ListItem.spec.tsx +1496 -0
  285. package/src/listItem/ListItem.tsx +447 -0
  286. package/src/listItem/ListItemContext.tsx +27 -0
  287. package/src/listItem/Navigation/ListItemNavigation.spec.tsx +59 -0
  288. package/src/listItem/Navigation/ListItemNavigation.story.tsx +109 -0
  289. package/src/listItem/Navigation/ListItemNavigation.tsx +40 -0
  290. package/src/listItem/Navigation/index.ts +2 -0
  291. package/src/listItem/Prompt/ListItemPrompt.spec.tsx +36 -0
  292. package/src/listItem/Prompt/ListItemPrompt.story.tsx +201 -0
  293. package/src/listItem/Prompt/ListItemPrompt.tsx +32 -0
  294. package/src/listItem/Prompt/index.ts +2 -0
  295. package/src/listItem/Radio/ListItemRadio.spec.tsx +66 -0
  296. package/src/listItem/Radio/ListItemRadio.story.tsx +108 -0
  297. package/src/listItem/Radio/ListItemRadio.tsx +33 -0
  298. package/src/listItem/Radio/index.ts +2 -0
  299. package/src/listItem/Switch/ListItemSwitch.spec.tsx +47 -0
  300. package/src/listItem/Switch/ListItemSwitch.story.tsx +77 -0
  301. package/src/listItem/Switch/ListItemSwitch.tsx +33 -0
  302. package/src/listItem/Switch/index.ts +2 -0
  303. package/src/listItem/_stories/ListItem.focus.test.story.tsx +250 -0
  304. package/src/listItem/_stories/ListItem.layout.test.story.tsx +353 -0
  305. package/src/listItem/_stories/ListItem.scenarios.story.tsx +209 -0
  306. package/src/listItem/_stories/ListItem.story.tsx +772 -0
  307. package/src/listItem/_stories/ListItem.variants.test.story.tsx +271 -0
  308. package/src/listItem/_stories/helpers.tsx +53 -0
  309. package/src/listItem/_stories/subcomponents.tsx +139 -0
  310. package/src/listItem/index.ts +14 -0
  311. package/src/listItem/test-utils.tsx +33 -0
  312. package/src/listItem/useListItemControl.tsx +18 -0
  313. package/src/listItem/useListItemMedia.tsx +13 -0
  314. package/src/main.css +773 -1
  315. package/src/main.less +1 -0
  316. package/src/switch/Switch.tsx +5 -1
  317. package/src/test-utils/assets/placeholder-landscape.svg +1 -0
  318. package/src/test-utils/assets/placeholder-portrait.svg +1 -0
  319. package/src/test-utils/Parameters.d.ts +0 -77
@@ -0,0 +1,312 @@
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
+ /* eslint-disable functional/immutable-data */
47
+ const ListItem = ({
48
+ as: ListItemElement = 'li',
49
+ title,
50
+ subtitle,
51
+ additionalInfo,
52
+ prompt,
53
+ inverted,
54
+ media,
55
+ spotlight,
56
+ valueTitle,
57
+ valueSubtitle,
58
+ control = null,
59
+ disabled,
60
+ className,
61
+ valueColumnWidth,
62
+ role,
63
+ id,
64
+ 'aria-labelledby': ariaLabelledby
65
+ }) => {
66
+ const idPrefix = React.useId();
67
+ const [controlProps, setControlProps] = React.useState({});
68
+ const [controlType, setControlType] = React.useState('non-interactive');
69
+ const [mediaSize, setMediaSize] = React.useState();
70
+ const ids = {
71
+ title: `${idPrefix}_title`,
72
+ ...(subtitle ? {
73
+ subtitle: `${idPrefix}_subtitle`
74
+ } : {}),
75
+ ...(valueTitle ? {
76
+ valueTitle: `${idPrefix}_value-title`
77
+ } : {}),
78
+ ...(valueSubtitle ? {
79
+ valueSubtitle: `${idPrefix}_value-subtitle`
80
+ } : {}),
81
+ control: `${idPrefix}_control`,
82
+ ...(prompt ? {
83
+ prompt: `${idPrefix}_prompt`
84
+ } : {}),
85
+ ...(additionalInfo ? {
86
+ additionalInfo: `${idPrefix}_additional-info`
87
+ } : {})
88
+ };
89
+ const isPartiallyInteractive = Boolean((controlType === 'button' || controlType === 'icon-button') && controlProps?.partiallyInteractive);
90
+ const isFullyInteractive = controlType !== 'non-interactive' && !isPartiallyInteractive;
91
+ const isButtonAsLink = (controlType === 'button' || controlType === 'icon-button') && Boolean(controlProps?.href);
92
+ const titlesAndValues = [inverted ? ids.subtitle : ids.title, inverted ? ids.title : ids.subtitle, inverted ? ids.valueSubtitle : ids.valueTitle, inverted ? ids.valueTitle : ids.valueSubtitle].join(' ');
93
+ const additionalInfoPrompt = [ids.additionalInfo, ids.prompt].filter(Boolean).join(' ');
94
+ const describedByIds = React.useMemo(() => {
95
+ return isFullyInteractive && !isButtonAsLink ? additionalInfoPrompt : `${titlesAndValues} ${additionalInfoPrompt}`;
96
+ }, [isFullyInteractive]);
97
+ const listItemContext = React.useMemo(() => ({
98
+ setControlType,
99
+ setControlProps,
100
+ setMediaSize,
101
+ ids,
102
+ props: {
103
+ disabled,
104
+ inverted
105
+ },
106
+ mediaSize,
107
+ describedByIds
108
+ }), [describedByIds, mediaSize]);
109
+ const gridColumnsStyle = {
110
+ '--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',
111
+ '--wds-list-item-body-right': valueColumnWidth ? `${valueColumnWidth}fr` : '50fr'
112
+ };
113
+ const getFeatureClassName = () => {
114
+ const partials = [];
115
+ const hasMedia = Boolean(media);
116
+ const hasControl = Boolean(control);
117
+ const hasInfo = Boolean(additionalInfo);
118
+ const hasPrompt = Boolean(prompt);
119
+ if (hasMedia && hasControl) {
120
+ partials.push('wds-list-item-hasMedia-hasControl');
121
+ }
122
+ if (hasMedia && !hasControl) {
123
+ partials.push('wds-list-item-hasMedia-noControl');
124
+ }
125
+ if (!hasMedia && hasControl) {
126
+ partials.push('wds-list-item-noMedia-hasControl');
127
+ }
128
+ if (!hasMedia && !hasControl) {
129
+ partials.push('wds-list-item-noMedia-noControl');
130
+ }
131
+ if (hasInfo && hasPrompt) {
132
+ partials.push('wds-list-item-hasInfo-hasPrompt');
133
+ }
134
+ if (hasInfo && !hasPrompt) {
135
+ partials.push('wds-list-item-hasInfo-noPrompt');
136
+ }
137
+ if (!hasInfo && hasPrompt) {
138
+ partials.push('wds-list-item-noInfo-hasPrompt');
139
+ }
140
+ if (!hasInfo && !hasPrompt) {
141
+ partials.push('wds-list-item-noInfo-noPrompt');
142
+ }
143
+ return partials.join(' ');
144
+ };
145
+ return /*#__PURE__*/jsxRuntime.jsx(ListItemContext.ListItemContext.Provider, {
146
+ value: listItemContext,
147
+ children: /*#__PURE__*/jsxRuntime.jsxs(ListItemElement, {
148
+ className: clsx.clsx('wds-list-item', `wds-list-item-${controlType}`, getFeatureClassName(), {
149
+ 'wds-list-item-interactive': isFullyInteractive,
150
+ 'wds-list-item-partially-interactive': isPartiallyInteractive,
151
+ [`wds-list-item-spotlight wds-list-item-spotlight-${spotlight}`]: isFullyInteractive && !!spotlight,
152
+ disabled
153
+ }, className),
154
+ id: id,
155
+ role: role,
156
+ "aria-disabled": disabled,
157
+ "aria-labelledby": ariaLabelledby,
158
+ children: [spotlight === 'inactive' && /*#__PURE__*/jsxRuntime.jsx("svg", {
159
+ "aria-hidden": "true",
160
+ className: "wds-list-item-spotlight__border",
161
+ children: /*#__PURE__*/jsxRuntime.jsx("rect", {})
162
+ }), /*#__PURE__*/jsxRuntime.jsxs(View, {
163
+ isPartiallyInteractive,
164
+ subtitle,
165
+ additionalInfo,
166
+ disabled,
167
+ prompt,
168
+ controlType,
169
+ controlProps,
170
+ className: getFeatureClassName(),
171
+ children: [media && /*#__PURE__*/jsxRuntime.jsx("div", {
172
+ className: "wds-list-item-media",
173
+ children: media
174
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
175
+ className: "wds-list-item-body",
176
+ style: valueColumnWidth ? gridColumnsStyle : undefined,
177
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
178
+ className: clsx.clsx({
179
+ 'wds-list-item-body-center': title && !subtitle
180
+ }),
181
+ children: (() => {
182
+ const titles = [/*#__PURE__*/jsxRuntime.jsx(Body.default, {
183
+ id: ids.title,
184
+ type: typography.Typography.BODY_LARGE_BOLD,
185
+ className: "wds-list-item-title",
186
+ children: title
187
+ }, ids.title)];
188
+ if (subtitle) {
189
+ titles.push(/*#__PURE__*/jsxRuntime.jsx(Body.default, {
190
+ id: ids.subtitle,
191
+ className: "wds-list-item-subtitle",
192
+ children: subtitle
193
+ }, ids.subtitle));
194
+ }
195
+ return inverted ? [...titles].reverse() : titles;
196
+ })()
197
+ }), (valueTitle || valueSubtitle) && /*#__PURE__*/jsxRuntime.jsx("span", {
198
+ className: clsx.clsx('wds-list-item-value', {
199
+ 'flex-column': valueTitle !== undefined || valueSubtitle !== undefined,
200
+ 'wds-list-item-body-center': valueTitle && !valueSubtitle || !valueTitle && valueSubtitle
201
+ }),
202
+ children: (() => {
203
+ const values = [];
204
+ if (valueTitle) {
205
+ values.push(/*#__PURE__*/jsxRuntime.jsx(Body.default, {
206
+ id: ids.valueTitle,
207
+ type: typography.Typography.BODY_LARGE_BOLD,
208
+ className: "wds-list-item-title-value",
209
+ children: valueTitle
210
+ }, ids.valueTitle));
211
+ }
212
+ if (valueSubtitle) {
213
+ values.push(/*#__PURE__*/jsxRuntime.jsx(Body.default, {
214
+ id: ids.valueSubtitle,
215
+ className: "wds-list-item-subtitle-value",
216
+ children: valueSubtitle
217
+ }, ids.valueSubtitle));
218
+ }
219
+ return inverted ? [...values].reverse() : values;
220
+ })()
221
+ })]
222
+ }), control === null ? null : /*#__PURE__*/jsxRuntime.jsx(Body.default, {
223
+ className: clsx.clsx('wds-list-item-control-wrapper', {
224
+ 'wds-list-item-button-control': controlType === 'button'
225
+ }),
226
+ style: {
227
+ '--wds-list-item-control-wrapper-height': mediaSize ? `${mediaSize}px` : 'auto'
228
+ },
229
+ children: control
230
+ })]
231
+ })]
232
+ })
233
+ });
234
+ };
235
+ function View({
236
+ children,
237
+ subtitle,
238
+ additionalInfo,
239
+ prompt,
240
+ disabled,
241
+ isPartiallyInteractive,
242
+ controlType = 'non-interactive',
243
+ controlProps,
244
+ className = ''
245
+ }) {
246
+ const {
247
+ ids,
248
+ describedByIds
249
+ } = React.useContext(ListItemContext.ListItemContext);
250
+ const isLinkControl = ['navigation'].includes(controlType);
251
+ const isHrefProvided = isLinkControl && !!controlProps?.href && controlProps?.href !== '#';
252
+ const renderExtras = () => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
253
+ children: [Boolean(subtitle) && additionalInfo, prompt]
254
+ });
255
+ if (isLinkControl && isHrefProvided) {
256
+ return (
257
+ /*#__PURE__*/
258
+ // for link instances of .Navigation, .IconButton, .Button
259
+ jsxRuntime.jsxs("div", {
260
+ className: clsx.clsx('wds-list-item-gridWrapper', className),
261
+ children: [/*#__PURE__*/jsxRuntime.jsx(PrimitiveAnchor.default, {
262
+ "aria-describedby": describedByIds,
263
+ href: controlProps?.href,
264
+ target: controlProps?.target,
265
+ className: clsx.clsx('wds-list-item-view d-flex flex-row', {
266
+ 'wds-list-item-control': controlType === 'navigation'
267
+ }),
268
+ disabled: disabled,
269
+ children: children
270
+ }), renderExtras()]
271
+ })
272
+ );
273
+ }
274
+ if (isPartiallyInteractive || controlType === 'non-interactive') {
275
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
276
+ className: clsx.clsx('wds-list-item-gridWrapper', className),
277
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
278
+ className: clsx.clsx('wds-list-item-view d-flex flex-row'),
279
+ children: children
280
+ }), renderExtras()]
281
+ });
282
+ }
283
+ // for form control instances of .Radio, .Checkbox, .Switch, .Button, .Navigation etc
284
+ // Radio cannot be wrapped in a <fieldset> element to announce it as a group.
285
+ const InputWrapper = controlType === 'radio' ? 'div' : 'fieldset';
286
+ return /*#__PURE__*/jsxRuntime.jsxs(InputWrapper, {
287
+ className: clsx.clsx('wds-list-item-gridWrapper', className),
288
+ children: [/*#__PURE__*/jsxRuntime.jsx("label", {
289
+ htmlFor: ids.control,
290
+ className: clsx.clsx('wds-list-item-view', {
291
+ clickable: !disabled,
292
+ fullyInteractive: !isPartiallyInteractive
293
+ }),
294
+ children: children
295
+ }), renderExtras()]
296
+ });
297
+ }
298
+ ListItem.Image = ListItemImage.Image;
299
+ ListItem.AvatarView = ListItemAvatarView.AvatarView;
300
+ ListItem.AvatarLayout = ListItemAvatarLayout.AvatarLayout;
301
+ ListItem.AdditionalInfo = ListItemAdditionalInfo.AdditionalInfo;
302
+ ListItem.Checkbox = ListItemCheckbox.Checkbox;
303
+ ListItem.Radio = ListItemRadio.Radio;
304
+ ListItem.IconButton = ListItemIconButton.IconButton;
305
+ ListItem.Navigation = ListItemNavigation.Navigation;
306
+ ListItem.Button = ListItemButton.Button;
307
+ ListItem.Switch = ListItemSwitch.Switch;
308
+ ListItem.Prompt = ListItemPrompt.Prompt;
309
+
310
+ exports.ListItem = ListItem;
311
+ exports.default = ListItem;
312
+ //# sourceMappingURL=ListItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItem.js","sources":["../../src/listItem/ListItem.tsx"],"sourcesContent":["/* eslint-disable functional/immutable-data */\nimport {\n useContext,\n useId,\n useMemo,\n useState,\n useEffect,\n type PropsWithChildren,\n type ReactNode,\n} from 'react';\nimport { Typography } from '../common';\nimport Body from '../body';\nimport { AdditionalInfo } from './AdditionalInfo';\nimport { IconButton, type ListItemIconButtonProps } from './IconButton';\nimport { Checkbox, type ListItemCheckboxProps } from './Checkbox';\nimport { Navigation, type ListItemNavigationProps } from './Navigation';\nimport { clsx } from 'clsx';\nimport { Button, type ListItemButtonProps } from './Button';\nimport { Radio, type ListItemRadioProps } from './Radio';\nimport { Switch, type ListItemSwitchProps } from './Switch';\nimport { AvatarLayout } from './AvatarLayout';\nimport { AvatarView } from './AvatarView';\nimport { Image } from './Image';\nimport { Prompt } from './Prompt';\nimport { PrimitiveAnchor } from '../primitives';\nimport {\n ListItemContext,\n type ListItemContextData,\n type ListItemMediaSize,\n} from './ListItemContext';\n\nexport type ListItemTypes =\n | 'non-interactive'\n | 'navigation'\n | 'radio'\n | 'checkbox'\n | 'switch'\n | 'button'\n | 'icon-button';\n\nexport type ListItemControlProps =\n | ListItemNavigationProps\n | ListItemCheckboxProps\n | ListItemButtonProps\n | ListItemIconButtonProps\n | ListItemRadioProps\n | ListItemSwitchProps;\n\nexport type Props = {\n as?: 'li' | 'div';\n /**\n * Swaps vertical hierarchy of title and subtitle and their corresponding right values.\n */\n inverted?: boolean;\n disabled?: boolean;\n /**\n * Highlights the list item as an action to be taken or already taken. <br />\n */\n spotlight?: 'active' | 'inactive';\n title: ReactNode;\n subtitle?: ReactNode;\n /**\n * Requires `<ListItem.AdditionalInfo />` component as a sole child. <br />\n * Can be only rendered if `subtitle` is also provided.\n */\n additionalInfo?: ReactNode;\n valueTitle?: ReactNode;\n valueSubtitle?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br />\n * `<ListItem.AvatarView />`,\n * `<ListItem.AvatarLayout />` or\n * `<ListItem.Image />`\n */\n media?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br/>\n * `<ListItem.Button />`, <br/>\n * `<ListItem.Checkbox />`, <br/>\n * `<ListItem.IconButton />`, <br/>\n * `<ListItem.Navigation />`, <br/>\n * `<ListItem.Radio />`, or\n * `<ListItem.Switch />`\n */\n control?: ReactNode;\n /**\n * Requires `<ListItem.Prompt />` component as a sole child.\n */\n prompt?: ReactNode;\n className?: string;\n /**\n * A number between `0–100` which resolves to a `fr` value of a `grid-template-columns` declaration. E.g. `valueColumnWidth={25}` will result in a `75fr 25fr`. <br />\n * Controls the width ratio of left side content (title and subtitle) to the right side content.\n */\n valueColumnWidth?: number;\n id?: string;\n role?: string;\n 'aria-labelledby'?: string;\n};\n\n/**\n * @see [Design documentation](https://wise.design/components/list-item)\n * @see [Storybook documentation](https://storybook.wise.design/?path=/docs/content-listitem--docs)\n */\nexport const ListItem = ({\n as: ListItemElement = 'li',\n title,\n subtitle,\n additionalInfo,\n prompt,\n inverted,\n media,\n spotlight,\n valueTitle,\n valueSubtitle,\n control = null,\n disabled,\n className,\n valueColumnWidth,\n role,\n id,\n 'aria-labelledby': ariaLabelledby,\n}: Props) => {\n const idPrefix = useId();\n const [controlProps, setControlProps] = useState<ListItemControlProps>({});\n const [controlType, setControlType] = useState<ListItemTypes>('non-interactive');\n const [mediaSize, setMediaSize] = useState<ListItemMediaSize | undefined>();\n\n const ids: ListItemContextData['ids'] = {\n title: `${idPrefix}_title`,\n ...(subtitle ? { subtitle: `${idPrefix}_subtitle` } : {}),\n ...(valueTitle ? { valueTitle: `${idPrefix}_value-title` } : {}),\n ...(valueSubtitle ? { valueSubtitle: `${idPrefix}_value-subtitle` } : {}),\n control: `${idPrefix}_control`,\n ...(prompt ? { prompt: `${idPrefix}_prompt` } : {}),\n ...(additionalInfo ? { additionalInfo: `${idPrefix}_additional-info` } : {}),\n };\n\n const isPartiallyInteractive = Boolean(\n (controlType === 'button' || controlType === 'icon-button') &&\n (controlProps as ListItemButtonProps | ListItemIconButtonProps)?.partiallyInteractive,\n );\n const isFullyInteractive = controlType !== 'non-interactive' && !isPartiallyInteractive;\n const isButtonAsLink =\n (controlType === 'button' || controlType === 'icon-button') &&\n Boolean((controlProps as ListItemButtonProps | ListItemIconButtonProps)?.href);\n\n const titlesAndValues = [\n inverted ? ids.subtitle : ids.title,\n inverted ? ids.title : ids.subtitle,\n inverted ? ids.valueSubtitle : ids.valueTitle,\n inverted ? ids.valueTitle : ids.valueSubtitle,\n ].join(' ');\n const additionalInfoPrompt = [ids.additionalInfo, ids.prompt].filter(Boolean).join(' ');\n\n const describedByIds = useMemo(() => {\n return isFullyInteractive && !isButtonAsLink\n ? additionalInfoPrompt\n : `${titlesAndValues} ${additionalInfoPrompt}`;\n }, [isFullyInteractive]);\n\n const listItemContext = useMemo(\n () => ({\n setControlType,\n setControlProps,\n setMediaSize,\n ids,\n props: { disabled, inverted },\n mediaSize,\n describedByIds,\n }),\n [describedByIds, mediaSize],\n );\n const gridColumnsStyle = {\n '--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',\n '--wds-list-item-body-right': valueColumnWidth ? `${valueColumnWidth}fr` : '50fr',\n } as React.CSSProperties;\n\n const getFeatureClassName = () => {\n const partials = [];\n const hasMedia = Boolean(media);\n const hasControl = Boolean(control);\n const hasInfo = Boolean(additionalInfo);\n const hasPrompt = Boolean(prompt);\n\n if (hasMedia && hasControl) {\n partials.push('wds-list-item-hasMedia-hasControl');\n }\n\n if (hasMedia && !hasControl) {\n partials.push('wds-list-item-hasMedia-noControl');\n }\n\n if (!hasMedia && hasControl) {\n partials.push('wds-list-item-noMedia-hasControl');\n }\n\n if (!hasMedia && !hasControl) {\n partials.push('wds-list-item-noMedia-noControl');\n }\n\n if (hasInfo && hasPrompt) {\n partials.push('wds-list-item-hasInfo-hasPrompt');\n }\n if (hasInfo && !hasPrompt) {\n partials.push('wds-list-item-hasInfo-noPrompt');\n }\n if (!hasInfo && hasPrompt) {\n partials.push('wds-list-item-noInfo-hasPrompt');\n }\n if (!hasInfo && !hasPrompt) {\n partials.push('wds-list-item-noInfo-noPrompt');\n }\n\n return partials.join(' ');\n };\n\n return (\n <ListItemContext.Provider value={listItemContext}>\n <ListItemElement\n className={clsx(\n 'wds-list-item',\n `wds-list-item-${controlType}`,\n getFeatureClassName(),\n {\n 'wds-list-item-interactive': isFullyInteractive,\n 'wds-list-item-partially-interactive': isPartiallyInteractive,\n [`wds-list-item-spotlight wds-list-item-spotlight-${spotlight}`]:\n isFullyInteractive && !!spotlight,\n disabled,\n },\n className,\n )}\n id={id}\n role={role}\n aria-disabled={disabled}\n aria-labelledby={ariaLabelledby}\n >\n {spotlight === 'inactive' && (\n <svg aria-hidden=\"true\" className=\"wds-list-item-spotlight__border\">\n <rect />\n </svg>\n )}\n\n <View\n {...{\n isPartiallyInteractive,\n subtitle,\n additionalInfo,\n disabled,\n prompt,\n controlType,\n controlProps,\n }}\n className={getFeatureClassName()}\n >\n {media && <div className=\"wds-list-item-media\">{media}</div>}\n\n {/* Title + Subtitle + Values - Group */}\n <div\n className=\"wds-list-item-body\"\n style={valueColumnWidth ? gridColumnsStyle : undefined}\n >\n {/* Title + Subtitle + Values - Group */}\n <span\n className={clsx({\n 'wds-list-item-body-center': title && !subtitle,\n })}\n >\n {(() => {\n const titles = [\n <Body\n key={ids.title}\n id={ids.title}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title\"\n >\n {title}\n </Body>,\n ];\n if (subtitle) {\n titles.push(\n <Body key={ids.subtitle} id={ids.subtitle} className=\"wds-list-item-subtitle\">\n {subtitle}\n </Body>,\n );\n }\n return inverted ? [...titles].reverse() : titles;\n })()}\n </span>\n\n {(valueTitle || valueSubtitle) && (\n <span\n className={clsx('wds-list-item-value', {\n 'flex-column': valueTitle !== undefined || valueSubtitle !== undefined,\n 'wds-list-item-body-center':\n (valueTitle && !valueSubtitle) || (!valueTitle && valueSubtitle),\n })}\n >\n {(() => {\n const values = [];\n if (valueTitle) {\n values.push(\n <Body\n key={ids.valueTitle}\n id={ids.valueTitle}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title-value\"\n >\n {valueTitle}\n </Body>,\n );\n }\n if (valueSubtitle) {\n values.push(\n <Body\n key={ids.valueSubtitle}\n id={ids.valueSubtitle}\n className=\"wds-list-item-subtitle-value\"\n >\n {valueSubtitle}\n </Body>,\n );\n }\n return inverted ? [...values].reverse() : values;\n })()}\n </span>\n )}\n </div>\n\n {control === null ? null : (\n <Body\n className={clsx('wds-list-item-control-wrapper', {\n 'wds-list-item-button-control': controlType === 'button',\n })}\n style={\n {\n '--wds-list-item-control-wrapper-height': mediaSize ? `${mediaSize}px` : 'auto',\n } as React.CSSProperties\n }\n >\n {control}\n </Body>\n )}\n </View>\n </ListItemElement>\n </ListItemContext.Provider>\n );\n};\n\ntype ViewProps = PropsWithChildren<{\n isPartiallyInteractive: boolean;\n controlType?: ListItemTypes;\n controlProps?: ListItemControlProps;\n}> &\n Pick<Props, 'subtitle' | 'additionalInfo' | 'disabled' | 'prompt' | 'className'>;\n\nfunction View({\n children,\n subtitle,\n additionalInfo,\n prompt,\n disabled,\n isPartiallyInteractive,\n controlType = 'non-interactive',\n controlProps,\n className = '',\n}: ViewProps) {\n const { ids, describedByIds } = useContext<ListItemContextData>(ListItemContext);\n const isLinkControl = ['navigation'].includes(controlType);\n\n const isHrefProvided =\n isLinkControl &&\n !!(controlProps as ListItemNavigationProps)?.href &&\n (controlProps as ListItemNavigationProps)?.href !== '#';\n\n const renderExtras = () => (\n <>\n {Boolean(subtitle) && additionalInfo}\n {prompt}\n </>\n );\n\n if (isLinkControl && isHrefProvided) {\n return (\n // for link instances of .Navigation, .IconButton, .Button\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <PrimitiveAnchor\n aria-describedby={describedByIds}\n href={(controlProps as ListItemNavigationProps)?.href}\n target={(controlProps as ListItemNavigationProps)?.target}\n className={clsx('wds-list-item-view d-flex flex-row', {\n 'wds-list-item-control': controlType === 'navigation',\n })}\n disabled={disabled}\n >\n {children}\n </PrimitiveAnchor>\n\n {renderExtras()}\n </div>\n );\n }\n\n if (isPartiallyInteractive || controlType === 'non-interactive') {\n return (\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <div className={clsx('wds-list-item-view d-flex flex-row')}>{children}</div>\n\n {renderExtras()}\n </div>\n );\n }\n\n // for form control instances of .Radio, .Checkbox, .Switch, .Button, .Navigation etc\n // Radio cannot be wrapped in a <fieldset> element to announce it as a group.\n const InputWrapper = controlType === 'radio' ? 'div' : 'fieldset';\n return (\n <InputWrapper className={clsx('wds-list-item-gridWrapper', className)}>\n <label\n htmlFor={ids.control}\n className={clsx('wds-list-item-view', {\n clickable: !disabled,\n fullyInteractive: !isPartiallyInteractive,\n })}\n >\n {children}\n </label>\n\n {renderExtras()}\n </InputWrapper>\n );\n}\n\nListItem.Image = Image;\nListItem.AvatarView = AvatarView;\nListItem.AvatarLayout = AvatarLayout;\nListItem.AdditionalInfo = AdditionalInfo;\nListItem.Checkbox = Checkbox;\nListItem.Radio = Radio;\nListItem.IconButton = IconButton;\nListItem.Navigation = Navigation;\nListItem.Button = Button;\nListItem.Switch = Switch;\nListItem.Prompt = Prompt;\n\nexport default ListItem;\n"],"names":["ListItem","as","ListItemElement","title","subtitle","additionalInfo","prompt","inverted","media","spotlight","valueTitle","valueSubtitle","control","disabled","className","valueColumnWidth","role","id","ariaLabelledby","idPrefix","useId","controlProps","setControlProps","useState","controlType","setControlType","mediaSize","setMediaSize","ids","isPartiallyInteractive","Boolean","partiallyInteractive","isFullyInteractive","isButtonAsLink","href","titlesAndValues","join","additionalInfoPrompt","filter","describedByIds","useMemo","listItemContext","props","gridColumnsStyle","getFeatureClassName","partials","hasMedia","hasControl","hasInfo","hasPrompt","push","_jsx","ListItemContext","Provider","value","children","_jsxs","clsx","View","style","undefined","titles","Body","type","Typography","BODY_LARGE_BOLD","reverse","values","useContext","isLinkControl","includes","isHrefProvided","renderExtras","_Fragment","PrimitiveAnchor","target","InputWrapper","htmlFor","clickable","fullyInteractive","Image","AvatarView","AvatarLayout","AdditionalInfo","Checkbox","Radio","IconButton","Navigation","Button","Switch","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAwGO,MAAMA,QAAQ,GAAGA,CAAC;EACvBC,EAAE,EAAEC,eAAe,GAAG,IAAI;EAC1BC,KAAK;EACLC,QAAQ;EACRC,cAAc;EACdC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACLC,SAAS;EACTC,UAAU;EACVC,aAAa;AACbC,EAAAA,OAAO,GAAG,IAAI;EACdC,QAAQ;EACRC,SAAS;EACTC,gBAAgB;EAChBC,IAAI;EACJC,EAAE;AACF,EAAA,iBAAiB,EAAEC;AAAc,CAC3B,KAAI;AACV,EAAA,MAAMC,QAAQ,GAAGC,WAAK,EAAE;EACxB,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGC,cAAQ,CAAuB,EAAE,CAAC;EAC1E,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGF,cAAQ,CAAgB,iBAAiB,CAAC;EAChF,MAAM,CAACG,SAAS,EAAEC,YAAY,CAAC,GAAGJ,cAAQ,EAAiC;AAE3E,EAAA,MAAMK,GAA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AAA;AAEA;AACA;EACA,MAAMI,YAAY,GAAGpD,WAAW,KAAK,OAAO,GAAG,KAAK,GAAG,UAAU;EACjE,oBACEgC,eAAA,CAACoB,YAAY,EAAA;AAAC9D,IAAAA,SAAS,EAAE2C,SAAI,CAAC,2BAA2B,EAAE3C,SAAS,CAAE;AAAAyC,IAAAA,QAAA,gBACpEJ,cAAA,CAAA,OAAA,EAAA;MACE0B,OAAO,EAAEjD,GAAG,CAAChB,OAAQ;AACrBE,MAAAA,SAAS,EAAE2C,SAAI,CAAC,oBAAoB,EAAE;QACpCqB,SAAS,EAAE,CAACjE,QAAQ;AACpBkE,QAAAA,gBAAgB,EAAE,CAAClD;AACpB,OAAA,CAAE;AAAA0B,MAAAA,QAAA,EAEFA;AAAQ,KACJ,CAEP,EAACiB,YAAY,EAAE;AAAA,GACH,CAAC;AAEnB;AAEAxE,QAAQ,CAACgF,KAAK,GAAGA,mBAAK;AACtBhF,QAAQ,CAACiF,UAAU,GAAGA,6BAAU;AAChCjF,QAAQ,CAACkF,YAAY,GAAGA,iCAAY;AACpClF,QAAQ,CAACmF,cAAc,GAAGA,qCAAc;AACxCnF,QAAQ,CAACoF,QAAQ,GAAGA,yBAAQ;AAC5BpF,QAAQ,CAACqF,KAAK,GAAGA,mBAAK;AACtBrF,QAAQ,CAACsF,UAAU,GAAGA,6BAAU;AAChCtF,QAAQ,CAACuF,UAAU,GAAGA,6BAAU;AAChCvF,QAAQ,CAACwF,MAAM,GAAGA,qBAAM;AACxBxF,QAAQ,CAACyF,MAAM,GAAGA,qBAAM;AACxBzF,QAAQ,CAAC0F,MAAM,GAAGA,qBAAM;;;;;"}
@@ -0,0 +1,307 @@
1
+ import { useId, useState, useMemo, useContext } from 'react';
2
+ import '../common/theme.mjs';
3
+ import '../common/direction.mjs';
4
+ import '../common/propsValues/control.mjs';
5
+ import '../common/propsValues/breakpoint.mjs';
6
+ import '../common/propsValues/size.mjs';
7
+ import { Typography } from '../common/propsValues/typography.mjs';
8
+ import '../common/propsValues/width.mjs';
9
+ import '../common/propsValues/type.mjs';
10
+ import '../common/propsValues/dateMode.mjs';
11
+ import '../common/propsValues/monthFormat.mjs';
12
+ import '../common/propsValues/position.mjs';
13
+ import '../common/propsValues/layouts.mjs';
14
+ import '../common/propsValues/status.mjs';
15
+ import '../common/propsValues/sentiment.mjs';
16
+ import '../common/propsValues/profileType.mjs';
17
+ import '../common/propsValues/variant.mjs';
18
+ import '../common/propsValues/scroll.mjs';
19
+ import '../common/propsValues/markdownNodeType.mjs';
20
+ import '../common/fileType.mjs';
21
+ import '@transferwise/icons';
22
+ import { clsx } from 'clsx';
23
+ import 'react-intl';
24
+ import '../common/closeButton/CloseButton.messages.mjs';
25
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
26
+ import Body from '../body/Body.mjs';
27
+ import { AdditionalInfo } from './AdditionalInfo/ListItemAdditionalInfo.mjs';
28
+ import { IconButton } from './IconButton/ListItemIconButton.mjs';
29
+ import { Checkbox } from './Checkbox/ListItemCheckbox.mjs';
30
+ import { Navigation } from './Navigation/ListItemNavigation.mjs';
31
+ import { Button } from './Button/ListItemButton.mjs';
32
+ import { Radio } from './Radio/ListItemRadio.mjs';
33
+ import { Switch } from './Switch/ListItemSwitch.mjs';
34
+ import { AvatarLayout } from './AvatarLayout/ListItemAvatarLayout.mjs';
35
+ import { AvatarView } from './AvatarView/ListItemAvatarView.mjs';
36
+ import { Image } from './Image/ListItemImage.mjs';
37
+ import { Prompt } from './Prompt/ListItemPrompt.mjs';
38
+ import '../primitives/PrimitiveButton/PrimitiveButton.mjs';
39
+ import PrimitiveAnchor from '../primitives/PrimitiveAnchor/PrimitiveAnchor.mjs';
40
+ import { ListItemContext } from './ListItemContext.mjs';
41
+
42
+ /* eslint-disable functional/immutable-data */
43
+ const ListItem = ({
44
+ as: ListItemElement = 'li',
45
+ title,
46
+ subtitle,
47
+ additionalInfo,
48
+ prompt,
49
+ inverted,
50
+ media,
51
+ spotlight,
52
+ valueTitle,
53
+ valueSubtitle,
54
+ control = null,
55
+ disabled,
56
+ className,
57
+ valueColumnWidth,
58
+ role,
59
+ id,
60
+ 'aria-labelledby': ariaLabelledby
61
+ }) => {
62
+ const idPrefix = useId();
63
+ const [controlProps, setControlProps] = useState({});
64
+ const [controlType, setControlType] = useState('non-interactive');
65
+ const [mediaSize, setMediaSize] = useState();
66
+ const ids = {
67
+ title: `${idPrefix}_title`,
68
+ ...(subtitle ? {
69
+ subtitle: `${idPrefix}_subtitle`
70
+ } : {}),
71
+ ...(valueTitle ? {
72
+ valueTitle: `${idPrefix}_value-title`
73
+ } : {}),
74
+ ...(valueSubtitle ? {
75
+ valueSubtitle: `${idPrefix}_value-subtitle`
76
+ } : {}),
77
+ control: `${idPrefix}_control`,
78
+ ...(prompt ? {
79
+ prompt: `${idPrefix}_prompt`
80
+ } : {}),
81
+ ...(additionalInfo ? {
82
+ additionalInfo: `${idPrefix}_additional-info`
83
+ } : {})
84
+ };
85
+ const isPartiallyInteractive = Boolean((controlType === 'button' || controlType === 'icon-button') && controlProps?.partiallyInteractive);
86
+ const isFullyInteractive = controlType !== 'non-interactive' && !isPartiallyInteractive;
87
+ const isButtonAsLink = (controlType === 'button' || controlType === 'icon-button') && Boolean(controlProps?.href);
88
+ const titlesAndValues = [inverted ? ids.subtitle : ids.title, inverted ? ids.title : ids.subtitle, inverted ? ids.valueSubtitle : ids.valueTitle, inverted ? ids.valueTitle : ids.valueSubtitle].join(' ');
89
+ const additionalInfoPrompt = [ids.additionalInfo, ids.prompt].filter(Boolean).join(' ');
90
+ const describedByIds = useMemo(() => {
91
+ return isFullyInteractive && !isButtonAsLink ? additionalInfoPrompt : `${titlesAndValues} ${additionalInfoPrompt}`;
92
+ }, [isFullyInteractive]);
93
+ const listItemContext = useMemo(() => ({
94
+ setControlType,
95
+ setControlProps,
96
+ setMediaSize,
97
+ ids,
98
+ props: {
99
+ disabled,
100
+ inverted
101
+ },
102
+ mediaSize,
103
+ describedByIds
104
+ }), [describedByIds, mediaSize]);
105
+ const gridColumnsStyle = {
106
+ '--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',
107
+ '--wds-list-item-body-right': valueColumnWidth ? `${valueColumnWidth}fr` : '50fr'
108
+ };
109
+ const getFeatureClassName = () => {
110
+ const partials = [];
111
+ const hasMedia = Boolean(media);
112
+ const hasControl = Boolean(control);
113
+ const hasInfo = Boolean(additionalInfo);
114
+ const hasPrompt = Boolean(prompt);
115
+ if (hasMedia && hasControl) {
116
+ partials.push('wds-list-item-hasMedia-hasControl');
117
+ }
118
+ if (hasMedia && !hasControl) {
119
+ partials.push('wds-list-item-hasMedia-noControl');
120
+ }
121
+ if (!hasMedia && hasControl) {
122
+ partials.push('wds-list-item-noMedia-hasControl');
123
+ }
124
+ if (!hasMedia && !hasControl) {
125
+ partials.push('wds-list-item-noMedia-noControl');
126
+ }
127
+ if (hasInfo && hasPrompt) {
128
+ partials.push('wds-list-item-hasInfo-hasPrompt');
129
+ }
130
+ if (hasInfo && !hasPrompt) {
131
+ partials.push('wds-list-item-hasInfo-noPrompt');
132
+ }
133
+ if (!hasInfo && hasPrompt) {
134
+ partials.push('wds-list-item-noInfo-hasPrompt');
135
+ }
136
+ if (!hasInfo && !hasPrompt) {
137
+ partials.push('wds-list-item-noInfo-noPrompt');
138
+ }
139
+ return partials.join(' ');
140
+ };
141
+ return /*#__PURE__*/jsx(ListItemContext.Provider, {
142
+ value: listItemContext,
143
+ children: /*#__PURE__*/jsxs(ListItemElement, {
144
+ className: clsx('wds-list-item', `wds-list-item-${controlType}`, getFeatureClassName(), {
145
+ 'wds-list-item-interactive': isFullyInteractive,
146
+ 'wds-list-item-partially-interactive': isPartiallyInteractive,
147
+ [`wds-list-item-spotlight wds-list-item-spotlight-${spotlight}`]: isFullyInteractive && !!spotlight,
148
+ disabled
149
+ }, className),
150
+ id: id,
151
+ role: role,
152
+ "aria-disabled": disabled,
153
+ "aria-labelledby": ariaLabelledby,
154
+ children: [spotlight === 'inactive' && /*#__PURE__*/jsx("svg", {
155
+ "aria-hidden": "true",
156
+ className: "wds-list-item-spotlight__border",
157
+ children: /*#__PURE__*/jsx("rect", {})
158
+ }), /*#__PURE__*/jsxs(View, {
159
+ isPartiallyInteractive,
160
+ subtitle,
161
+ additionalInfo,
162
+ disabled,
163
+ prompt,
164
+ controlType,
165
+ controlProps,
166
+ className: getFeatureClassName(),
167
+ children: [media && /*#__PURE__*/jsx("div", {
168
+ className: "wds-list-item-media",
169
+ children: media
170
+ }), /*#__PURE__*/jsxs("div", {
171
+ className: "wds-list-item-body",
172
+ style: valueColumnWidth ? gridColumnsStyle : undefined,
173
+ children: [/*#__PURE__*/jsx("span", {
174
+ className: clsx({
175
+ 'wds-list-item-body-center': title && !subtitle
176
+ }),
177
+ children: (() => {
178
+ const titles = [/*#__PURE__*/jsx(Body, {
179
+ id: ids.title,
180
+ type: Typography.BODY_LARGE_BOLD,
181
+ className: "wds-list-item-title",
182
+ children: title
183
+ }, ids.title)];
184
+ if (subtitle) {
185
+ titles.push(/*#__PURE__*/jsx(Body, {
186
+ id: ids.subtitle,
187
+ className: "wds-list-item-subtitle",
188
+ children: subtitle
189
+ }, ids.subtitle));
190
+ }
191
+ return inverted ? [...titles].reverse() : titles;
192
+ })()
193
+ }), (valueTitle || valueSubtitle) && /*#__PURE__*/jsx("span", {
194
+ className: clsx('wds-list-item-value', {
195
+ 'flex-column': valueTitle !== undefined || valueSubtitle !== undefined,
196
+ 'wds-list-item-body-center': valueTitle && !valueSubtitle || !valueTitle && valueSubtitle
197
+ }),
198
+ children: (() => {
199
+ const values = [];
200
+ if (valueTitle) {
201
+ values.push(/*#__PURE__*/jsx(Body, {
202
+ id: ids.valueTitle,
203
+ type: Typography.BODY_LARGE_BOLD,
204
+ className: "wds-list-item-title-value",
205
+ children: valueTitle
206
+ }, ids.valueTitle));
207
+ }
208
+ if (valueSubtitle) {
209
+ values.push(/*#__PURE__*/jsx(Body, {
210
+ id: ids.valueSubtitle,
211
+ className: "wds-list-item-subtitle-value",
212
+ children: valueSubtitle
213
+ }, ids.valueSubtitle));
214
+ }
215
+ return inverted ? [...values].reverse() : values;
216
+ })()
217
+ })]
218
+ }), control === null ? null : /*#__PURE__*/jsx(Body, {
219
+ className: clsx('wds-list-item-control-wrapper', {
220
+ 'wds-list-item-button-control': controlType === 'button'
221
+ }),
222
+ style: {
223
+ '--wds-list-item-control-wrapper-height': mediaSize ? `${mediaSize}px` : 'auto'
224
+ },
225
+ children: control
226
+ })]
227
+ })]
228
+ })
229
+ });
230
+ };
231
+ function View({
232
+ children,
233
+ subtitle,
234
+ additionalInfo,
235
+ prompt,
236
+ disabled,
237
+ isPartiallyInteractive,
238
+ controlType = 'non-interactive',
239
+ controlProps,
240
+ className = ''
241
+ }) {
242
+ const {
243
+ ids,
244
+ describedByIds
245
+ } = useContext(ListItemContext);
246
+ const isLinkControl = ['navigation'].includes(controlType);
247
+ const isHrefProvided = isLinkControl && !!controlProps?.href && controlProps?.href !== '#';
248
+ const renderExtras = () => /*#__PURE__*/jsxs(Fragment, {
249
+ children: [Boolean(subtitle) && additionalInfo, prompt]
250
+ });
251
+ if (isLinkControl && isHrefProvided) {
252
+ return (
253
+ /*#__PURE__*/
254
+ // for link instances of .Navigation, .IconButton, .Button
255
+ jsxs("div", {
256
+ className: clsx('wds-list-item-gridWrapper', className),
257
+ children: [/*#__PURE__*/jsx(PrimitiveAnchor, {
258
+ "aria-describedby": describedByIds,
259
+ href: controlProps?.href,
260
+ target: controlProps?.target,
261
+ className: clsx('wds-list-item-view d-flex flex-row', {
262
+ 'wds-list-item-control': controlType === 'navigation'
263
+ }),
264
+ disabled: disabled,
265
+ children: children
266
+ }), renderExtras()]
267
+ })
268
+ );
269
+ }
270
+ if (isPartiallyInteractive || controlType === 'non-interactive') {
271
+ return /*#__PURE__*/jsxs("div", {
272
+ className: clsx('wds-list-item-gridWrapper', className),
273
+ children: [/*#__PURE__*/jsx("div", {
274
+ className: clsx('wds-list-item-view d-flex flex-row'),
275
+ children: children
276
+ }), renderExtras()]
277
+ });
278
+ }
279
+ // for form control instances of .Radio, .Checkbox, .Switch, .Button, .Navigation etc
280
+ // Radio cannot be wrapped in a <fieldset> element to announce it as a group.
281
+ const InputWrapper = controlType === 'radio' ? 'div' : 'fieldset';
282
+ return /*#__PURE__*/jsxs(InputWrapper, {
283
+ className: clsx('wds-list-item-gridWrapper', className),
284
+ children: [/*#__PURE__*/jsx("label", {
285
+ htmlFor: ids.control,
286
+ className: clsx('wds-list-item-view', {
287
+ clickable: !disabled,
288
+ fullyInteractive: !isPartiallyInteractive
289
+ }),
290
+ children: children
291
+ }), renderExtras()]
292
+ });
293
+ }
294
+ ListItem.Image = Image;
295
+ ListItem.AvatarView = AvatarView;
296
+ ListItem.AvatarLayout = AvatarLayout;
297
+ ListItem.AdditionalInfo = AdditionalInfo;
298
+ ListItem.Checkbox = Checkbox;
299
+ ListItem.Radio = Radio;
300
+ ListItem.IconButton = IconButton;
301
+ ListItem.Navigation = Navigation;
302
+ ListItem.Button = Button;
303
+ ListItem.Switch = Switch;
304
+ ListItem.Prompt = Prompt;
305
+
306
+ export { ListItem, ListItem as default };
307
+ //# sourceMappingURL=ListItem.mjs.map