@react-spectrum/s2 1.1.0 → 1.2.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 (427) hide show
  1. package/dist/Accordion.cjs +2 -2
  2. package/dist/Accordion.css +2 -2
  3. package/dist/Accordion.mjs +2 -2
  4. package/dist/ActionBar.cjs +59 -59
  5. package/dist/ActionBar.css +58 -58
  6. package/dist/ActionBar.mjs +59 -59
  7. package/dist/ActionButton.cjs +233 -233
  8. package/dist/ActionButton.css +160 -160
  9. package/dist/ActionButton.mjs +233 -233
  10. package/dist/ActionButtonGroup.cjs +15 -15
  11. package/dist/ActionButtonGroup.css +9 -9
  12. package/dist/ActionButtonGroup.mjs +15 -15
  13. package/dist/Add.cjs +10 -10
  14. package/dist/Add.css +6 -6
  15. package/dist/Add.mjs +10 -10
  16. package/dist/AlertDialog.cjs +3 -3
  17. package/dist/AlertDialog.css +3 -3
  18. package/dist/AlertDialog.mjs +3 -3
  19. package/dist/Asterisk.cjs +6 -6
  20. package/dist/Asterisk.css +4 -4
  21. package/dist/Asterisk.mjs +6 -6
  22. package/dist/Avatar.cjs +16 -16
  23. package/dist/Avatar.css +16 -16
  24. package/dist/Avatar.mjs +16 -16
  25. package/dist/AvatarGroup.cjs +120 -120
  26. package/dist/AvatarGroup.css +31 -31
  27. package/dist/AvatarGroup.mjs +120 -120
  28. package/dist/Badge.cjs +196 -196
  29. package/dist/Badge.css +125 -125
  30. package/dist/Badge.mjs +196 -196
  31. package/dist/Breadcrumbs.cjs +234 -234
  32. package/dist/Breadcrumbs.css +100 -100
  33. package/dist/Breadcrumbs.mjs +234 -234
  34. package/dist/Button.cjs +332 -332
  35. package/dist/Button.css +174 -174
  36. package/dist/Button.mjs +332 -332
  37. package/dist/ButtonGroup.cjs +20 -20
  38. package/dist/ButtonGroup.css +15 -15
  39. package/dist/ButtonGroup.mjs +20 -20
  40. package/dist/Calendar.cjs +168 -168
  41. package/dist/Calendar.css +134 -134
  42. package/dist/Calendar.mjs +168 -168
  43. package/dist/Card.cjs +309 -309
  44. package/dist/Card.css +206 -206
  45. package/dist/Card.mjs +309 -309
  46. package/dist/CardView.cjs +17 -17
  47. package/dist/CardView.css +17 -17
  48. package/dist/CardView.mjs +17 -17
  49. package/dist/CenterBaseline.cjs +1 -1
  50. package/dist/CenterBaseline.css +2 -2
  51. package/dist/CenterBaseline.mjs +1 -1
  52. package/dist/Checkbox.cjs +161 -161
  53. package/dist/Checkbox.css +92 -92
  54. package/dist/Checkbox.mjs +161 -161
  55. package/dist/CheckboxGroup.cjs +43 -43
  56. package/dist/CheckboxGroup.css +37 -37
  57. package/dist/CheckboxGroup.mjs +43 -43
  58. package/dist/Checkmark.cjs +12 -12
  59. package/dist/Checkmark.css +8 -8
  60. package/dist/Checkmark.mjs +12 -12
  61. package/dist/Chevron.cjs +12 -12
  62. package/dist/Chevron.css +10 -10
  63. package/dist/Chevron.mjs +12 -12
  64. package/dist/ClearButton.cjs +30 -30
  65. package/dist/ClearButton.css +30 -30
  66. package/dist/ClearButton.mjs +30 -30
  67. package/dist/CloseButton.cjs +55 -55
  68. package/dist/CloseButton.css +47 -47
  69. package/dist/CloseButton.mjs +55 -55
  70. package/dist/ColorArea.cjs +16 -16
  71. package/dist/ColorArea.css +16 -16
  72. package/dist/ColorArea.mjs +16 -16
  73. package/dist/ColorField.cjs +31 -31
  74. package/dist/ColorField.css +27 -27
  75. package/dist/ColorField.mjs +31 -31
  76. package/dist/ColorHandle.cjs +27 -27
  77. package/dist/ColorHandle.css +42 -42
  78. package/dist/ColorHandle.mjs +27 -27
  79. package/dist/ColorSlider.cjs +108 -108
  80. package/dist/ColorSlider.css +52 -52
  81. package/dist/ColorSlider.mjs +108 -108
  82. package/dist/ColorSwatch.cjs +29 -29
  83. package/dist/ColorSwatch.css +29 -29
  84. package/dist/ColorSwatch.mjs +29 -29
  85. package/dist/ColorSwatchPicker.cjs +29 -29
  86. package/dist/ColorSwatchPicker.css +48 -48
  87. package/dist/ColorSwatchPicker.mjs +29 -29
  88. package/dist/ColorWheel.cjs +26 -26
  89. package/dist/ColorWheel.css +17 -17
  90. package/dist/ColorWheel.mjs +26 -26
  91. package/dist/ComboBox.cjs +381 -381
  92. package/dist/ComboBox.cjs.map +1 -1
  93. package/dist/ComboBox.css +187 -187
  94. package/dist/ComboBox.css.map +1 -1
  95. package/dist/ComboBox.mjs +381 -381
  96. package/dist/ComboBox.mjs.map +1 -1
  97. package/dist/ContextualHelp.cjs +70 -41
  98. package/dist/ContextualHelp.cjs.map +1 -1
  99. package/dist/ContextualHelp.css +71 -71
  100. package/dist/ContextualHelp.css.map +1 -1
  101. package/dist/ContextualHelp.mjs +74 -46
  102. package/dist/ContextualHelp.mjs.map +1 -1
  103. package/dist/Cross.cjs +14 -14
  104. package/dist/Cross.css +10 -10
  105. package/dist/Cross.mjs +14 -14
  106. package/dist/CustomDialog.cjs +25 -25
  107. package/dist/CustomDialog.css +25 -25
  108. package/dist/CustomDialog.mjs +25 -25
  109. package/dist/Dash.cjs +10 -10
  110. package/dist/Dash.css +6 -6
  111. package/dist/Dash.mjs +10 -10
  112. package/dist/DateField.cjs +73 -73
  113. package/dist/DateField.css +77 -77
  114. package/dist/DateField.mjs +73 -73
  115. package/dist/DatePicker.cjs +172 -172
  116. package/dist/DatePicker.css +128 -128
  117. package/dist/DatePicker.mjs +172 -172
  118. package/dist/DateRangePicker.cjs +55 -55
  119. package/dist/DateRangePicker.css +59 -59
  120. package/dist/DateRangePicker.mjs +55 -55
  121. package/dist/Dialog.cjs +17 -17
  122. package/dist/Dialog.css +70 -70
  123. package/dist/Dialog.mjs +17 -17
  124. package/dist/Disclosure.cjs +119 -119
  125. package/dist/Disclosure.css +112 -112
  126. package/dist/Disclosure.mjs +119 -119
  127. package/dist/Divider.cjs +25 -25
  128. package/dist/Divider.css +25 -25
  129. package/dist/Divider.mjs +25 -25
  130. package/dist/DropZone.cjs +61 -61
  131. package/dist/DropZone.css +57 -57
  132. package/dist/DropZone.mjs +61 -61
  133. package/dist/Field.cjs +351 -351
  134. package/dist/Field.cjs.map +1 -1
  135. package/dist/Field.css +147 -147
  136. package/dist/Field.css.map +1 -1
  137. package/dist/Field.mjs +351 -351
  138. package/dist/Field.mjs.map +1 -1
  139. package/dist/Form.cjs +9 -9
  140. package/dist/Form.css +9 -9
  141. package/dist/Form.mjs +9 -9
  142. package/dist/FullscreenDialog.cjs +5 -5
  143. package/dist/FullscreenDialog.css +78 -78
  144. package/dist/FullscreenDialog.mjs +5 -5
  145. package/dist/IllustratedMessage.cjs +228 -228
  146. package/dist/IllustratedMessage.css +72 -72
  147. package/dist/IllustratedMessage.mjs +228 -228
  148. package/dist/Image.cjs +14 -14
  149. package/dist/Image.css +14 -14
  150. package/dist/Image.mjs +14 -14
  151. package/dist/InlineAlert.cjs +100 -100
  152. package/dist/InlineAlert.css +76 -76
  153. package/dist/InlineAlert.mjs +100 -100
  154. package/dist/Link.cjs +49 -49
  155. package/dist/Link.css +41 -41
  156. package/dist/Link.mjs +49 -49
  157. package/dist/LinkOut.cjs +8 -8
  158. package/dist/LinkOut.css +8 -8
  159. package/dist/LinkOut.mjs +8 -8
  160. package/dist/ListView.cjs +777 -0
  161. package/dist/ListView.cjs.map +1 -0
  162. package/dist/ListView.css +740 -0
  163. package/dist/ListView.css.map +1 -0
  164. package/dist/ListView.mjs +770 -0
  165. package/dist/ListView.mjs.map +1 -0
  166. package/dist/Menu.cjs +529 -437
  167. package/dist/Menu.cjs.map +1 -1
  168. package/dist/Menu.css +234 -190
  169. package/dist/Menu.css.map +1 -1
  170. package/dist/Menu.mjs +530 -439
  171. package/dist/Menu.mjs.map +1 -1
  172. package/dist/Meter.cjs +153 -153
  173. package/dist/Meter.css +91 -91
  174. package/dist/Meter.mjs +153 -153
  175. package/dist/Modal.cjs +66 -66
  176. package/dist/Modal.css +54 -54
  177. package/dist/Modal.mjs +66 -66
  178. package/dist/NotificationBadge.cjs +56 -56
  179. package/dist/NotificationBadge.css +49 -49
  180. package/dist/NotificationBadge.mjs +56 -56
  181. package/dist/NumberField.cjs +114 -114
  182. package/dist/NumberField.css +99 -99
  183. package/dist/NumberField.mjs +114 -114
  184. package/dist/Picker.cjs +336 -284
  185. package/dist/Picker.cjs.map +1 -1
  186. package/dist/Picker.css +173 -173
  187. package/dist/Picker.css.map +1 -1
  188. package/dist/Picker.mjs +338 -286
  189. package/dist/Picker.mjs.map +1 -1
  190. package/dist/Popover.cjs +87 -87
  191. package/dist/Popover.css +70 -70
  192. package/dist/Popover.mjs +87 -87
  193. package/dist/ProgressBar.cjs +163 -163
  194. package/dist/ProgressBar.css +99 -99
  195. package/dist/ProgressBar.mjs +163 -163
  196. package/dist/ProgressCircle.cjs +31 -31
  197. package/dist/ProgressCircle.css +24 -24
  198. package/dist/ProgressCircle.mjs +31 -31
  199. package/dist/Provider.cjs +11 -11
  200. package/dist/Provider.css +10 -10
  201. package/dist/Provider.mjs +11 -11
  202. package/dist/Radio.cjs +145 -145
  203. package/dist/Radio.css +78 -78
  204. package/dist/Radio.mjs +145 -145
  205. package/dist/RadioGroup.cjs +41 -41
  206. package/dist/RadioGroup.css +37 -37
  207. package/dist/RadioGroup.mjs +41 -41
  208. package/dist/RangeCalendar.cjs +7 -7
  209. package/dist/RangeCalendar.css +10 -10
  210. package/dist/RangeCalendar.mjs +7 -7
  211. package/dist/SearchField.cjs +41 -41
  212. package/dist/SearchField.css +45 -45
  213. package/dist/SearchField.mjs +41 -41
  214. package/dist/SegmentedControl.cjs +178 -178
  215. package/dist/SegmentedControl.css +123 -123
  216. package/dist/SegmentedControl.mjs +178 -178
  217. package/dist/SelectBoxGroup.cjs +142 -142
  218. package/dist/SelectBoxGroup.css +120 -120
  219. package/dist/SelectBoxGroup.mjs +142 -142
  220. package/dist/Slider.cjs +294 -294
  221. package/dist/Slider.css +154 -154
  222. package/dist/Slider.mjs +294 -294
  223. package/dist/StatusLight.cjs +115 -115
  224. package/dist/StatusLight.css +59 -59
  225. package/dist/StatusLight.mjs +115 -115
  226. package/dist/Switch.cjs +154 -154
  227. package/dist/Switch.css +74 -74
  228. package/dist/Switch.mjs +154 -154
  229. package/dist/TableView.cjs +444 -420
  230. package/dist/TableView.cjs.map +1 -1
  231. package/dist/TableView.css +232 -204
  232. package/dist/TableView.css.map +1 -1
  233. package/dist/TableView.mjs +446 -422
  234. package/dist/TableView.mjs.map +1 -1
  235. package/dist/Tabs.cjs +123 -123
  236. package/dist/Tabs.css +105 -105
  237. package/dist/Tabs.mjs +123 -123
  238. package/dist/TabsPicker.cjs +127 -127
  239. package/dist/TabsPicker.css +108 -108
  240. package/dist/TabsPicker.mjs +127 -127
  241. package/dist/TagGroup.cjs +203 -203
  242. package/dist/TagGroup.css +146 -146
  243. package/dist/TagGroup.mjs +203 -203
  244. package/dist/TextField.cjs +58 -58
  245. package/dist/TextField.css +54 -54
  246. package/dist/TextField.mjs +58 -58
  247. package/dist/TimeField.cjs +51 -51
  248. package/dist/TimeField.css +47 -47
  249. package/dist/TimeField.mjs +51 -51
  250. package/dist/Toast.cjs +121 -121
  251. package/dist/Toast.cjs.map +1 -1
  252. package/dist/Toast.css +110 -110
  253. package/dist/Toast.css.map +1 -1
  254. package/dist/Toast.mjs +122 -122
  255. package/dist/Toast.mjs.map +1 -1
  256. package/dist/ToggleButton.cjs +3 -3
  257. package/dist/ToggleButton.css +12 -12
  258. package/dist/ToggleButton.mjs +3 -3
  259. package/dist/Tooltip.cjs +78 -78
  260. package/dist/Tooltip.css +65 -65
  261. package/dist/Tooltip.mjs +78 -78
  262. package/dist/TreeView.cjs +179 -145
  263. package/dist/TreeView.cjs.map +1 -1
  264. package/dist/TreeView.css +140 -128
  265. package/dist/TreeView.css.map +1 -1
  266. package/dist/TreeView.mjs +179 -145
  267. package/dist/TreeView.mjs.map +1 -1
  268. package/dist/ar-AE.cjs +1 -0
  269. package/dist/ar-AE.cjs.map +1 -1
  270. package/dist/ar-AE.mjs +1 -0
  271. package/dist/ar-AE.mjs.map +1 -1
  272. package/dist/bg-BG.cjs +1 -0
  273. package/dist/bg-BG.cjs.map +1 -1
  274. package/dist/bg-BG.mjs +1 -0
  275. package/dist/bg-BG.mjs.map +1 -1
  276. package/dist/cs-CZ.cjs +1 -0
  277. package/dist/cs-CZ.cjs.map +1 -1
  278. package/dist/cs-CZ.mjs +1 -0
  279. package/dist/cs-CZ.mjs.map +1 -1
  280. package/dist/da-DK.cjs +1 -0
  281. package/dist/da-DK.cjs.map +1 -1
  282. package/dist/da-DK.mjs +1 -0
  283. package/dist/da-DK.mjs.map +1 -1
  284. package/dist/de-DE.cjs +1 -0
  285. package/dist/de-DE.cjs.map +1 -1
  286. package/dist/de-DE.mjs +1 -0
  287. package/dist/de-DE.mjs.map +1 -1
  288. package/dist/el-GR.cjs +1 -0
  289. package/dist/el-GR.cjs.map +1 -1
  290. package/dist/el-GR.mjs +1 -0
  291. package/dist/el-GR.mjs.map +1 -1
  292. package/dist/en-US.cjs +1 -0
  293. package/dist/en-US.cjs.map +1 -1
  294. package/dist/en-US.mjs +1 -0
  295. package/dist/en-US.mjs.map +1 -1
  296. package/dist/es-ES.cjs +1 -0
  297. package/dist/es-ES.cjs.map +1 -1
  298. package/dist/es-ES.mjs +1 -0
  299. package/dist/es-ES.mjs.map +1 -1
  300. package/dist/et-EE.cjs +1 -0
  301. package/dist/et-EE.cjs.map +1 -1
  302. package/dist/et-EE.mjs +1 -0
  303. package/dist/et-EE.mjs.map +1 -1
  304. package/dist/fi-FI.cjs +1 -0
  305. package/dist/fi-FI.cjs.map +1 -1
  306. package/dist/fi-FI.mjs +1 -0
  307. package/dist/fi-FI.mjs.map +1 -1
  308. package/dist/fr-FR.cjs +1 -0
  309. package/dist/fr-FR.cjs.map +1 -1
  310. package/dist/fr-FR.mjs +1 -0
  311. package/dist/fr-FR.mjs.map +1 -1
  312. package/dist/he-IL.cjs +1 -0
  313. package/dist/he-IL.cjs.map +1 -1
  314. package/dist/he-IL.mjs +1 -0
  315. package/dist/he-IL.mjs.map +1 -1
  316. package/dist/hr-HR.cjs +1 -0
  317. package/dist/hr-HR.cjs.map +1 -1
  318. package/dist/hr-HR.mjs +1 -0
  319. package/dist/hr-HR.mjs.map +1 -1
  320. package/dist/hu-HU.cjs +1 -0
  321. package/dist/hu-HU.cjs.map +1 -1
  322. package/dist/hu-HU.mjs +1 -0
  323. package/dist/hu-HU.mjs.map +1 -1
  324. package/dist/it-IT.cjs +1 -0
  325. package/dist/it-IT.cjs.map +1 -1
  326. package/dist/it-IT.mjs +1 -0
  327. package/dist/it-IT.mjs.map +1 -1
  328. package/dist/ja-JP.cjs +1 -0
  329. package/dist/ja-JP.cjs.map +1 -1
  330. package/dist/ja-JP.mjs +1 -0
  331. package/dist/ja-JP.mjs.map +1 -1
  332. package/dist/ko-KR.cjs +1 -0
  333. package/dist/ko-KR.cjs.map +1 -1
  334. package/dist/ko-KR.mjs +1 -0
  335. package/dist/ko-KR.mjs.map +1 -1
  336. package/dist/lt-LT.cjs +1 -0
  337. package/dist/lt-LT.cjs.map +1 -1
  338. package/dist/lt-LT.mjs +1 -0
  339. package/dist/lt-LT.mjs.map +1 -1
  340. package/dist/lv-LV.cjs +1 -0
  341. package/dist/lv-LV.cjs.map +1 -1
  342. package/dist/lv-LV.mjs +1 -0
  343. package/dist/lv-LV.mjs.map +1 -1
  344. package/dist/main.cjs +7 -0
  345. package/dist/main.cjs.map +1 -1
  346. package/dist/module.mjs +5 -3
  347. package/dist/module.mjs.map +1 -1
  348. package/dist/nb-NO.cjs +1 -0
  349. package/dist/nb-NO.cjs.map +1 -1
  350. package/dist/nb-NO.mjs +1 -0
  351. package/dist/nb-NO.mjs.map +1 -1
  352. package/dist/nl-NL.cjs +1 -0
  353. package/dist/nl-NL.cjs.map +1 -1
  354. package/dist/nl-NL.mjs +1 -0
  355. package/dist/nl-NL.mjs.map +1 -1
  356. package/dist/pl-PL.cjs +1 -0
  357. package/dist/pl-PL.cjs.map +1 -1
  358. package/dist/pl-PL.mjs +1 -0
  359. package/dist/pl-PL.mjs.map +1 -1
  360. package/dist/pt-BR.cjs +1 -0
  361. package/dist/pt-BR.cjs.map +1 -1
  362. package/dist/pt-BR.mjs +1 -0
  363. package/dist/pt-BR.mjs.map +1 -1
  364. package/dist/pt-PT.cjs +1 -0
  365. package/dist/pt-PT.cjs.map +1 -1
  366. package/dist/pt-PT.mjs +1 -0
  367. package/dist/pt-PT.mjs.map +1 -1
  368. package/dist/ro-RO.cjs +1 -0
  369. package/dist/ro-RO.cjs.map +1 -1
  370. package/dist/ro-RO.mjs +1 -0
  371. package/dist/ro-RO.mjs.map +1 -1
  372. package/dist/ru-RU.cjs +1 -0
  373. package/dist/ru-RU.cjs.map +1 -1
  374. package/dist/ru-RU.mjs +1 -0
  375. package/dist/ru-RU.mjs.map +1 -1
  376. package/dist/sk-SK.cjs +1 -0
  377. package/dist/sk-SK.cjs.map +1 -1
  378. package/dist/sk-SK.mjs +1 -0
  379. package/dist/sk-SK.mjs.map +1 -1
  380. package/dist/sl-SI.cjs +1 -0
  381. package/dist/sl-SI.cjs.map +1 -1
  382. package/dist/sl-SI.mjs +1 -0
  383. package/dist/sl-SI.mjs.map +1 -1
  384. package/dist/sr-SP.cjs +1 -0
  385. package/dist/sr-SP.cjs.map +1 -1
  386. package/dist/sr-SP.mjs +1 -0
  387. package/dist/sr-SP.mjs.map +1 -1
  388. package/dist/sv-SE.cjs +1 -0
  389. package/dist/sv-SE.cjs.map +1 -1
  390. package/dist/sv-SE.mjs +1 -0
  391. package/dist/sv-SE.mjs.map +1 -1
  392. package/dist/tr-TR.cjs +1 -0
  393. package/dist/tr-TR.cjs.map +1 -1
  394. package/dist/tr-TR.mjs +1 -0
  395. package/dist/tr-TR.mjs.map +1 -1
  396. package/dist/types.d.ts +77 -6
  397. package/dist/types.d.ts.map +1 -1
  398. package/dist/uk-UA.cjs +1 -0
  399. package/dist/uk-UA.cjs.map +1 -1
  400. package/dist/uk-UA.mjs +1 -0
  401. package/dist/uk-UA.mjs.map +1 -1
  402. package/dist/zh-CN.cjs +1 -0
  403. package/dist/zh-CN.cjs.map +1 -1
  404. package/dist/zh-CN.mjs +1 -0
  405. package/dist/zh-CN.mjs.map +1 -1
  406. package/dist/zh-TW.cjs +1 -0
  407. package/dist/zh-TW.cjs.map +1 -1
  408. package/dist/zh-TW.mjs +1 -0
  409. package/dist/zh-TW.mjs.map +1 -1
  410. package/icons/Icon.cjs +10 -10
  411. package/icons/Icon.css +9 -9
  412. package/icons/Icon.mjs +10 -10
  413. package/icons/Skeleton.cjs +2 -2
  414. package/icons/Skeleton.css +6 -6
  415. package/icons/Skeleton.mjs +2 -2
  416. package/package.json +21 -21
  417. package/src/ComboBox.tsx +4 -3
  418. package/src/ContextualHelp.tsx +81 -43
  419. package/src/Field.tsx +3 -3
  420. package/src/ListView.tsx +782 -0
  421. package/src/Menu.tsx +100 -16
  422. package/src/Picker.tsx +72 -11
  423. package/src/TableView.tsx +30 -12
  424. package/src/Toast.tsx +2 -2
  425. package/src/TreeView.tsx +43 -6
  426. package/src/index.ts +6 -3
  427. package/style/__tests__/style-macro.test.js +69 -69
@@ -0,0 +1,782 @@
1
+ /*
2
+ * Copyright 2026 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {ActionButtonGroupContext} from './ActionButtonGroup';
14
+ import {ActionMenuContext} from './ActionMenu';
15
+ import {baseColor, colorMix, focusRing, fontRelative, space, style} from '../style' with {type: 'macro'};
16
+ import {centerBaseline} from './CenterBaseline';
17
+ import {Checkbox} from './Checkbox';
18
+ import {
19
+ CheckboxContext,
20
+ Collection,
21
+ CollectionRendererContext,
22
+ ContextValue,
23
+ DEFAULT_SLOT,
24
+ DefaultCollectionRenderer,
25
+ GridList,
26
+ GridListItem,
27
+ GridListItemProps,
28
+ GridListItemRenderProps,
29
+ GridListLoadMoreItem,
30
+ GridListProps,
31
+ GridListRenderProps,
32
+ Key,
33
+ ListLayout,
34
+ ListState,
35
+ Provider,
36
+ SlotProps,
37
+ useSlottedContext,
38
+ Virtualizer
39
+ } from 'react-aria-components';
40
+ import Chevron from '../ui-icons/Chevron';
41
+ import {controlFont, getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};
42
+ import {createContext, forwardRef, ReactElement, ReactNode, useContext, useRef} from 'react';
43
+ import {DOMProps, DOMRef, DOMRefValue, forwardRefType, GlobalDOMAttributes, LoadingState} from '@react-types/shared';
44
+ import {edgeToText} from '../style/spectrum-theme' with {type: 'macro'};
45
+ import {IconContext} from './Icon';
46
+ import {ImageContext} from './Image';
47
+ // @ts-ignore
48
+ import intlMessages from '../intl/*.json';
49
+ import LinkOutIcon from '../ui-icons/LinkOut';
50
+ import {ProgressCircle} from './ProgressCircle';
51
+ import {Text, TextContext} from './Content';
52
+ import {useActionBarContainer} from './ActionBar';
53
+ import {useDOMRef} from '@react-spectrum/utils';
54
+ import {useLocale, useLocalizedStringFormatter} from 'react-aria';
55
+ import {useScale} from './utils';
56
+ import {useSpectrumContextProps} from './useSpectrumContextProps';
57
+
58
+ export interface ListViewProps<T> extends Omit<GridListProps<T>, 'className' | 'style' | 'children' | 'selectionBehavior' | 'dragAndDropHooks' | 'layout' | 'render' | 'keyboardNavigationBehavior' | keyof GlobalDOMAttributes>, DOMProps, UnsafeStyles, ListViewStylesProps, SlotProps {
59
+ /** Spectrum-defined styles, returned by the `style()` macro. */
60
+ styles?: StylesPropWithHeight,
61
+ /** The current loading state of the ListView. */
62
+ loadingState?: LoadingState,
63
+ /** Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. */
64
+ onLoadMore?: () => void,
65
+ /** The children of the ListView. */
66
+ children: ReactNode | ((item: T) => ReactNode),
67
+ /** Provides the ActionBar to display when items are selected in the ListView. */
68
+ renderActionBar?: (selectedKeys: 'all' | Set<Key>) => ReactElement,
69
+ /** Hides the default link out icons on items that open links in a new tab. */
70
+ hideLinkOutIcon?: boolean
71
+ }
72
+
73
+ interface ListViewStylesProps {
74
+ /** Whether the ListView should be displayed with a quiet style. */
75
+ isQuiet?: boolean,
76
+ /**
77
+ * How selection should be displayed.
78
+ * @default 'checkbox'
79
+ */
80
+ selectionStyle?: 'highlight' | 'checkbox',
81
+ /**
82
+ * Sets the overflow behavior for item contents.
83
+ * @default 'truncate'
84
+ */
85
+ overflowMode?: 'wrap' | 'truncate'
86
+ }
87
+
88
+ export interface ListViewItemProps extends Omit<GridListItemProps, 'children' | 'className' | 'style' | 'render' | 'onClick' | keyof GlobalDOMAttributes> {
89
+ /**
90
+ * The contents of the item.
91
+ */
92
+ children: ReactNode,
93
+ /** Whether the item has child items (renders a chevron indicator). */
94
+ hasChildItems?: boolean
95
+ }
96
+
97
+ export const ListViewContext = createContext<ContextValue<Partial<ListViewProps<any>>, DOMRefValue<HTMLDivElement>>>(null);
98
+
99
+ let InternalListViewContext = createContext<{isQuiet?: boolean, selectionStyle?: 'highlight' | 'checkbox', overflowMode?: 'wrap' | 'truncate', scale?: 'medium' | 'large', hideLinkOutIcon?: boolean}>({});
100
+
101
+ const listViewWrapper = style({
102
+ minHeight: 0,
103
+ minWidth: 0,
104
+ display: 'flex',
105
+ isolation: 'isolate',
106
+ disableTapHighlight: true,
107
+ position: 'relative',
108
+ // Clip ActionBar animation.
109
+ overflow: 'clip'
110
+ }, getAllowedOverrides({height: true}));
111
+
112
+ // When any row has a trailing icon, reserve space so actions align.
113
+ const hasTrailingIconRows = ':has([data-has-trailing-icon]) [role="row"]';
114
+
115
+ const listView = style<GridListRenderProps & {isQuiet?: boolean}>({
116
+ ...focusRing(),
117
+ outlineOffset: {
118
+ default: -2,
119
+ isQuiet: -1
120
+ },
121
+ userSelect: 'none',
122
+ minHeight: 0,
123
+ minWidth: 0,
124
+ width: 'full',
125
+ height: 'full',
126
+ boxSizing: 'border-box',
127
+ overflow: 'auto',
128
+ fontSize: controlFont(),
129
+ backgroundColor: {
130
+ default: 'gray-25',
131
+ isQuiet: 'transparent',
132
+ forcedColors: 'Background'
133
+ },
134
+ borderRadius: {
135
+ default: 'default',
136
+ isQuiet: 'none'
137
+ },
138
+ borderColor: 'gray-300',
139
+ borderWidth: {
140
+ default: 1,
141
+ isQuiet: 0
142
+ },
143
+ borderStyle: 'solid',
144
+ '--trailing-icon-width': {
145
+ type: 'width',
146
+ value: {
147
+ default: 'auto',
148
+ [hasTrailingIconRows]: fontRelative(20)
149
+ }
150
+ }
151
+ });
152
+
153
+ /**
154
+ * A ListView displays a list of interactive items, and allows a user to navigate, select, or perform an action.
155
+ */
156
+ export const ListView = /*#__PURE__*/ (forwardRef as forwardRefType)(function ListView<T extends object>(
157
+ props: ListViewProps<T>,
158
+ ref: DOMRef<HTMLDivElement>
159
+ ) {
160
+ [props, ref] = useSpectrumContextProps(props, ref, ListViewContext);
161
+ let {children, isQuiet, selectionStyle = 'checkbox', overflowMode = 'truncate', loadingState, onLoadMore, renderEmptyState: userRenderEmptyState, hideLinkOutIcon = false, ...otherProps} = props;
162
+ let scale = useScale();
163
+ let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');
164
+ let rowHeight = scale === 'large' ? 50 : 40;
165
+
166
+ let domRef = useDOMRef(ref);
167
+ let scrollRef = useRef<HTMLElement | null>(null);
168
+
169
+ let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
170
+ let renderEmptyState: ListViewProps<T>['renderEmptyState'] | undefined;
171
+ if (userRenderEmptyState != null && !isLoading) {
172
+ renderEmptyState = (renderProps) => (
173
+ <div className={emptyStateWrapper}>
174
+ <CollectionRendererContext.Provider value={DefaultCollectionRenderer}>
175
+ {userRenderEmptyState!(renderProps)}
176
+ </CollectionRendererContext.Provider>
177
+ </div>
178
+ );
179
+ } else if (loadingState === 'loading') {
180
+ renderEmptyState = () => (
181
+ <div className={centeredWrapper}>
182
+ <div className={loadingSpinnerWrapper}>
183
+ <ProgressCircle
184
+ isIndeterminate
185
+ aria-label={stringFormatter.format('table.loading')} />
186
+ </div>
187
+ </div>
188
+ );
189
+ }
190
+
191
+ let loadMoreSpinner = onLoadMore ? (
192
+ <GridListLoadMoreItem isLoading={loadingState === 'loadingMore'} onLoadMore={onLoadMore} className={style({height: 'full', width: 'full', paddingY: 8})}>
193
+ <div className={centeredWrapper}>
194
+ <div className={loadingSpinnerWrapper}>
195
+ <ProgressCircle
196
+ isIndeterminate
197
+ aria-label={stringFormatter.format('table.loadingMore')} />
198
+ </div>
199
+ </div>
200
+ </GridListLoadMoreItem>
201
+ ) : null;
202
+
203
+ let wrappedChildren: ReactNode;
204
+ let gridListProps = otherProps;
205
+ if (typeof children === 'function' && otherProps.items) {
206
+ let {items, dependencies = [], ...rest} = otherProps;
207
+ gridListProps = rest;
208
+ wrappedChildren = (
209
+ <>
210
+ <Collection items={items} dependencies={dependencies}>
211
+ {children}
212
+ </Collection>
213
+ {loadMoreSpinner}
214
+ </>
215
+ );
216
+ } else {
217
+ wrappedChildren = (
218
+ <>
219
+ {children}
220
+ {loadMoreSpinner}
221
+ </>
222
+ );
223
+ }
224
+
225
+ let {selectedKeys, onSelectionChange, actionBar, actionBarHeight} = useActionBarContainer({...props, scrollRef});
226
+
227
+ return (
228
+ <div
229
+ ref={domRef}
230
+ className={(props.UNSAFE_className || '') + listViewWrapper(null, props.styles)}
231
+ style={props.UNSAFE_style}>
232
+ <Virtualizer
233
+ layout={ListLayout}
234
+ layoutOptions={{
235
+ estimatedRowHeight: rowHeight,
236
+ loaderHeight: 60
237
+ }}>
238
+ <InternalListViewContext.Provider value={{isQuiet, selectionStyle, overflowMode, scale, hideLinkOutIcon}}>
239
+ <GridList
240
+ ref={scrollRef as any}
241
+ {...gridListProps}
242
+ selectionBehavior={selectionStyle === 'highlight' ? 'replace' : 'toggle'}
243
+ selectionMode={gridListProps.selectionMode}
244
+ renderEmptyState={renderEmptyState}
245
+ style={{
246
+ paddingBottom: actionBarHeight > 0 ? actionBarHeight + 8 : 0,
247
+ scrollPaddingBottom: actionBarHeight > 0 ? actionBarHeight + 8 : 0
248
+ }}
249
+ className={(renderProps) => listView({
250
+ ...renderProps,
251
+ isQuiet
252
+ })}
253
+ selectedKeys={selectedKeys}
254
+ defaultSelectedKeys={undefined}
255
+ onSelectionChange={onSelectionChange}>
256
+ {wrappedChildren}
257
+ </GridList>
258
+ </InternalListViewContext.Provider>
259
+ </Virtualizer>
260
+ {actionBar}
261
+ </div>
262
+ );
263
+ });
264
+
265
+ const selectedBackground = colorMix('gray-25', 'gray-900', 7);
266
+ const selectedActiveBackground = colorMix('gray-25', 'gray-900', 10);
267
+
268
+ const listitem = style<GridListItemRenderProps & {
269
+ isFocused: boolean,
270
+ isLink?: boolean,
271
+ isQuiet?: boolean,
272
+ isFirstItem?: boolean,
273
+ isLastItem?: boolean,
274
+ isSelected?: boolean,
275
+ isDisabled?: boolean,
276
+ isNextSelected?: boolean,
277
+ isPrevSelected?: boolean,
278
+ isPrevNotSelected?: boolean,
279
+ isNextNotSelected?: boolean,
280
+ selectionStyle?: 'highlight' | 'checkbox',
281
+ scale?: 'medium' | 'large'
282
+ }>({
283
+ outlineStyle: 'none',
284
+ boxSizing: 'border-box',
285
+ columnGap: 0,
286
+ paddingX: 0,
287
+ paddingY: 8,
288
+ backgroundColor: 'transparent',
289
+ color: {
290
+ default: baseColor('neutral-subdued'),
291
+ isSelected: baseColor('neutral'),
292
+ isDisabled: {
293
+ default: 'disabled',
294
+ forcedColors: 'GrayText'
295
+ }
296
+ },
297
+ position: 'relative',
298
+ gridColumnStart: 1,
299
+ gridColumnEnd: -1,
300
+ display: 'grid',
301
+ gridTemplateAreas: [
302
+ '. checkmark icon label actions actionmenu trailing-icon .',
303
+ '. . . description actions actionmenu trailing-icon .'
304
+ ],
305
+ gridTemplateColumns: [edgeToText(40), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'var(--trailing-icon-width)', edgeToText(40)],
306
+ gridTemplateRows: '1fr auto',
307
+ rowGap: {
308
+ ':has([slot=description])': space(1)
309
+ },
310
+ alignItems: 'baseline',
311
+ minHeight: {
312
+ default: 40,
313
+ scale: {
314
+ large: 50
315
+ }
316
+ },
317
+ textDecoration: 'none',
318
+ cursor: {
319
+ default: 'default',
320
+ isLink: 'pointer'
321
+ },
322
+ '--borderColor': {
323
+ type: 'borderColor',
324
+ value: {
325
+ default: 'gray-300',
326
+ isSelected: {
327
+ selectionStyle: {
328
+ highlight: 'blue-900',
329
+ checkbox: 'gray-300'
330
+ }
331
+ },
332
+ forcedColors: 'ButtonBorder'
333
+ }
334
+ },
335
+ borderTopWidth: 0,
336
+ borderBottomWidth: {
337
+ default: 1,
338
+ isLastItem: {
339
+ default: 1,
340
+ isQuiet: 0
341
+ }
342
+ },
343
+ borderStartWidth: 0,
344
+ borderEndWidth: 0,
345
+ borderStyle: 'solid',
346
+ borderColor: {
347
+ default: '--borderColor',
348
+ isNextSelected: 'transparent',
349
+ isSelected: 'transparent'
350
+ }
351
+ });
352
+
353
+ const listRowBackground = style<GridListItemRenderProps & {
354
+ isFirstItem?: boolean,
355
+ isLastItem?: boolean,
356
+ isQuiet?: boolean,
357
+ isPrevSelected?: boolean,
358
+ isNextSelected?: boolean,
359
+ isPrevNotSelected?: boolean,
360
+ isNextNotSelected?: boolean,
361
+ selectionStyle?: 'highlight' | 'checkbox'
362
+ }>({
363
+ ...focusRing(),
364
+ outlineOffset: -2,
365
+ position: 'absolute',
366
+ zIndex: -1,
367
+ top: {
368
+ default: 0,
369
+ isSelected: '[-1px]',
370
+ // Don't overlap focus ring of row above.
371
+ isPrevSelected: 0,
372
+ isFirstItem: 0
373
+ },
374
+ left: 0,
375
+ right: 0,
376
+ bottom: {
377
+ default: 0,
378
+ isSelected: '[-1px]'
379
+ },
380
+ backgroundColor: {
381
+ default: '--rowBackgroundColor',
382
+ isHovered: {
383
+ default: 'gray-900/5',
384
+ selectionStyle: {
385
+ checkbox: selectedBackground
386
+ }
387
+ },
388
+ isPressed: {
389
+ default: 'gray-900/10',
390
+ selectionStyle: {
391
+ checkbox: selectedActiveBackground
392
+ }
393
+ },
394
+ isSelected: {
395
+ selectionStyle: {
396
+ checkbox: {
397
+ default: selectedBackground,
398
+ isHovered: selectedActiveBackground,
399
+ isPressed: selectedActiveBackground,
400
+ isFocusVisible: selectedActiveBackground
401
+ },
402
+ highlight: {
403
+ // Use solid colors rather than transparent because the rows overlap.
404
+ default: colorMix('gray-25', 'blue-900', 10),
405
+ isHovered: colorMix('gray-25', 'blue-900', 15),
406
+ isPressed: colorMix('gray-25', 'blue-900', 15)
407
+ }
408
+ }
409
+ },
410
+ forcedColors: {
411
+ default: 'Background'
412
+ }
413
+ },
414
+ borderTopStartRadius: {
415
+ isFirstItem: {
416
+ isSelected: {
417
+ selectionStyle: {
418
+ checkbox: 'none',
419
+ highlight: 'default'
420
+ }
421
+ },
422
+ isQuiet: 'default',
423
+ isFocusVisible: 'default'
424
+ }
425
+ },
426
+ borderTopEndRadius: {
427
+ isFirstItem: {
428
+ isSelected: {
429
+ selectionStyle: {
430
+ checkbox: 'none',
431
+ highlight: 'default'
432
+ }
433
+ },
434
+ isQuiet: 'default',
435
+ isFocusVisible: 'default'
436
+ }
437
+ },
438
+ borderBottomStartRadius: {
439
+ isLastItem: {
440
+ isSelected: {
441
+ selectionStyle: {
442
+ checkbox: 'none',
443
+ highlight: 'default'
444
+ }
445
+ },
446
+ isQuiet: 'default',
447
+ isFocusVisible: 'default'
448
+ }
449
+ },
450
+ borderBottomEndRadius: {
451
+ isLastItem: {
452
+ isSelected: {
453
+ selectionStyle: {
454
+ checkbox: 'none',
455
+ highlight: 'default'
456
+ }
457
+ },
458
+ isQuiet: 'default',
459
+ isFocusVisible: 'default'
460
+ }
461
+ },
462
+ borderTopWidth: {
463
+ default: {
464
+ selectionStyle: {
465
+ checkbox: 0,
466
+ highlight: 1
467
+ }
468
+ },
469
+ isPrevSelected: 0
470
+ },
471
+ borderBottomWidth: {
472
+ default: {
473
+ selectionStyle: {
474
+ checkbox: 0,
475
+ highlight: 1
476
+ }
477
+ },
478
+ isNextSelected: 0
479
+ },
480
+ borderStartWidth: {
481
+ default: {
482
+ selectionStyle: {
483
+ checkbox: 0,
484
+ highlight: 1
485
+ }
486
+ }
487
+ },
488
+ borderEndWidth: {
489
+ default: {
490
+ selectionStyle: {
491
+ checkbox: 0,
492
+ highlight: 1
493
+ }
494
+ }
495
+ },
496
+ borderStyle: 'solid',
497
+ borderColor: {
498
+ default: 'transparent',
499
+ isSelected: {
500
+ selectionStyle: {
501
+ checkbox: 'transparent',
502
+ highlight: '--borderColor'
503
+ }
504
+ }
505
+ }
506
+ });
507
+
508
+ export let label = style({
509
+ gridArea: 'label',
510
+ alignSelf: 'center',
511
+ font: controlFont(),
512
+ color: 'inherit',
513
+ truncate: true,
514
+ whiteSpace: {
515
+ default: 'nowrap',
516
+ overflowMode: {
517
+ wrap: 'normal'
518
+ }
519
+ }
520
+ });
521
+
522
+ export let description = style({
523
+ gridArea: 'description',
524
+ alignSelf: 'center',
525
+ truncate: true,
526
+ whiteSpace: {
527
+ default: 'nowrap',
528
+ overflowMode: {
529
+ wrap: 'normal'
530
+ }
531
+ },
532
+ font: 'ui-sm',
533
+ color: {
534
+ default: baseColor('neutral-subdued'),
535
+ isDisabled: 'disabled'
536
+ },
537
+ transition: 'default'
538
+ });
539
+
540
+ export let iconCenterWrapper = style({
541
+ display: 'flex',
542
+ gridArea: 'icon',
543
+ gridRowEnd: 'span 2',
544
+ alignSelf: 'center',
545
+ alignItems: 'center'
546
+ });
547
+
548
+ export let icon = style({
549
+ display: 'block',
550
+ size: fontRelative(20),
551
+ // too small default icon size is wrong, it's like the icons are 1 tshirt size bigger than the rest of the component? check again after typography changes
552
+ // reminder, size of WF is applied via font size
553
+ marginEnd: 'text-to-visual',
554
+ '--iconPrimary': {
555
+ type: 'fill',
556
+ value: 'currentColor'
557
+ }
558
+ });
559
+
560
+ let image = style({
561
+ gridArea: 'icon',
562
+ gridRowEnd: 'span 2',
563
+ marginEnd: 'text-to-visual',
564
+ alignSelf: 'center',
565
+ borderRadius: 'sm',
566
+ width: 32,
567
+ aspectRatio: 'square',
568
+ objectFit: 'cover'
569
+ });
570
+
571
+ let actionButtonGroup = style({
572
+ gridArea: 'actions',
573
+ gridRowEnd: 'span 2',
574
+ alignSelf: 'center',
575
+ justifySelf: 'end',
576
+ marginStart: 'text-to-visual'
577
+ });
578
+
579
+ let listActionMenu = style({
580
+ gridArea: 'actionmenu',
581
+ gridRowEnd: 'span 2',
582
+ alignSelf: 'center'
583
+ });
584
+
585
+ const listCheckbox = style({
586
+ gridArea: 'checkmark',
587
+ gridRowEnd: 'span 2',
588
+ alignSelf: 'center',
589
+ marginEnd: 8,
590
+ visibility: {
591
+ default: 'visible',
592
+ isDisabled: 'hidden'
593
+ }
594
+ });
595
+
596
+ const listTrailingIcon = style({
597
+ gridArea: 'trailing-icon',
598
+ gridRowEnd: 'span 2',
599
+ alignSelf: 'center',
600
+ display: 'flex',
601
+ alignItems: 'center',
602
+ marginStart: 'text-to-visual'
603
+ });
604
+
605
+ const centeredWrapper = style({
606
+ display: 'flex',
607
+ alignItems: 'center',
608
+ justifyContent: 'center',
609
+ width: 'full',
610
+ height: 'full'
611
+ });
612
+
613
+ const loadingSpinnerWrapper = style({
614
+ padding: space(4)
615
+ });
616
+
617
+ const emptyStateWrapper = style({
618
+ display: 'flex',
619
+ alignItems: 'center',
620
+ justifyContent: 'center',
621
+ width: 'full',
622
+ height: 'full',
623
+ boxSizing: 'border-box',
624
+ padding: 16
625
+ });
626
+
627
+ function ListSelectionCheckbox({isDisabled}: {isDisabled: boolean}) {
628
+ let selectionContext = useSlottedContext(CheckboxContext, 'selection');
629
+ let isSelectionDisabled = isDisabled || !!selectionContext?.isDisabled;
630
+ return (
631
+ <div className={listCheckbox({isDisabled: isSelectionDisabled})}>
632
+ <Checkbox slot="selection" />
633
+ </div>
634
+ );
635
+ }
636
+
637
+ function isNextSelected(id: Key | undefined, state: ListState<unknown>) {
638
+ if (id == null || !state) {
639
+ return false;
640
+ }
641
+ let keyAfter = state.collection.getKeyAfter(id);
642
+ return keyAfter != null && state.selectionManager.isSelected(keyAfter);
643
+ }
644
+ function isPrevSelected(id: Key | undefined, state: ListState<unknown>) {
645
+ if (id == null || !state) {
646
+ return false;
647
+ }
648
+ let keyBefore = state.collection.getKeyBefore(id);
649
+ return keyBefore != null && state.selectionManager.isSelected(keyBefore);
650
+ }
651
+
652
+ function isFirstItem(id: Key | undefined, state: ListState<unknown>) {
653
+ if (id == null || !state) {
654
+ return false;
655
+ }
656
+ return state.collection.getFirstKey() === id;
657
+ }
658
+ function isLastItem(id: Key | undefined, state: ListState<unknown>) {
659
+ if (id == null || !state) {
660
+ return false;
661
+ }
662
+ return state.collection.getLastKey() === id;
663
+ }
664
+
665
+ export function ListViewItem(props: ListViewItemProps): ReactNode {
666
+ let ref = useRef(null);
667
+ let {hasChildItems, ...otherProps} = props;
668
+ let isLink = props.href != null;
669
+ let isLinkOut = isLink && props.target === '_blank';
670
+ let {isQuiet, selectionStyle, overflowMode, scale, hideLinkOutIcon = false} = useContext(InternalListViewContext);
671
+ let textValue = props.textValue || (typeof props.children === 'string' ? props.children : undefined);
672
+ let {direction} = useLocale();
673
+ let hasTrailingIcon = hasChildItems || (isLinkOut && !hideLinkOutIcon);
674
+
675
+ return (
676
+ <GridListItem
677
+ {...otherProps}
678
+ textValue={textValue}
679
+ ref={ref}
680
+ {...(hasTrailingIcon ? {'data-has-trailing-icon': ''} : {})}
681
+ className={renderProps => listitem({
682
+ ...renderProps,
683
+ isLink,
684
+ isQuiet,
685
+ scale,
686
+ selectionStyle,
687
+ isPrevNotSelected: !isPrevSelected(renderProps.id, renderProps.state),
688
+ isNextSelected: isNextSelected(renderProps.id, renderProps.state),
689
+ isNextNotSelected: !isNextSelected(renderProps.id, renderProps.state),
690
+ isFirstItem: isFirstItem(renderProps.id, renderProps.state),
691
+ isLastItem: isLastItem(renderProps.id, renderProps.state)
692
+ })}>
693
+ {(renderProps) => {
694
+ let {children} = props;
695
+ let {selectionMode, selectionBehavior, isDisabled, id, state} = renderProps;
696
+ return (
697
+ <Provider
698
+ values={[
699
+ [TextContext, {
700
+ slots: {
701
+ [DEFAULT_SLOT]: {styles: label({...renderProps, overflowMode})},
702
+ label: {styles: label({...renderProps, overflowMode})},
703
+ description: {styles: description({...renderProps, overflowMode})}
704
+ }
705
+ }],
706
+ [IconContext, {
707
+ slots: {
708
+ icon: {render: centerBaseline({slot: 'icon', styles: iconCenterWrapper}), styles: icon}
709
+ }
710
+ }],
711
+ [ImageContext, {styles: image}],
712
+ [ActionButtonGroupContext, {
713
+ styles: actionButtonGroup,
714
+ size: 'S',
715
+ isQuiet: true
716
+ }],
717
+ [ActionMenuContext, {
718
+ styles: listActionMenu,
719
+ isQuiet: true,
720
+ size: 'S',
721
+ isDisabled
722
+ }]
723
+ ]}>
724
+ <div
725
+ className={
726
+ listRowBackground({
727
+ ...renderProps,
728
+ selectionStyle,
729
+ isQuiet,
730
+ isPrevSelected: isPrevSelected(id, state),
731
+ isNextSelected: isNextSelected(id, state),
732
+ isPrevNotSelected: !isPrevSelected(id, state),
733
+ isNextNotSelected: !isNextSelected(id, state),
734
+ isFirstItem: isFirstItem(id, state),
735
+ isLastItem: isLastItem(id, state)
736
+ })
737
+ } />
738
+ {selectionMode !== 'none' && selectionBehavior === 'toggle' && (
739
+ <ListSelectionCheckbox isDisabled={isDisabled} />
740
+ )}
741
+ {typeof children === 'string' ? <Text slot="label">{children}</Text> : children}
742
+ {isLinkOut && !hideLinkOutIcon && (
743
+ <div className={listTrailingIcon}>
744
+ <LinkOutIcon
745
+ size="M"
746
+ className={style({
747
+ scaleX: {
748
+ direction: {
749
+ rtl: -1
750
+ }
751
+ },
752
+ '--iconPrimary': {
753
+ type: 'fill',
754
+ value: 'currentColor'
755
+ }
756
+ })({direction})} />
757
+ </div>
758
+ )}
759
+ {hasChildItems && !isLinkOut && (
760
+ <div className={listTrailingIcon}>
761
+ <Chevron
762
+ className={style({
763
+ scale: {
764
+ direction: {
765
+ ltr: '1',
766
+ rtl: '-1'
767
+ }
768
+ },
769
+ '--iconPrimary': {
770
+ type: 'fill',
771
+ value: 'currentColor'
772
+ }
773
+ })({direction})} />
774
+ </div>
775
+ )}
776
+ </Provider>
777
+ );
778
+ }}
779
+ </GridListItem>
780
+ );
781
+ }
782
+