@sentry/scraps 0.4.0 → 0.6.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 (352) hide show
  1. package/README.md +74 -8
  2. package/dist/alert/alert.js +0 -3
  3. package/dist/badge/badge.js +1 -2
  4. package/dist/badge/tag.js +4 -4
  5. package/dist/button/button.js +1 -0
  6. package/dist/button/index.d.ts +0 -1
  7. package/dist/button/index.js +0 -1
  8. package/dist/button/linkButton.js +1 -0
  9. package/dist/button/styles.js +157 -152
  10. package/dist/clipboard/copyToClipboardButton.d.ts +15 -0
  11. package/dist/clipboard/copyToClipboardButton.js +32 -0
  12. package/dist/clipboard/index.d.ts +1 -0
  13. package/dist/clipboard/index.js +1 -0
  14. package/dist/code/index.d.ts +1 -0
  15. package/dist/code/index.js +1 -0
  16. package/dist/codeBlock/codeBlock.d.ts +68 -0
  17. package/dist/codeBlock/codeBlock.js +243 -0
  18. package/dist/codeBlock/index.d.ts +2 -0
  19. package/dist/codeBlock/index.js +2 -0
  20. package/dist/codeBlock/prism.d.ts +11 -0
  21. package/dist/codeBlock/prism.js +101 -0
  22. package/dist/codeBlock/styles.d.ts +2 -0
  23. package/dist/codeBlock/styles.js +133 -0
  24. package/dist/compactSelect/compactSelect.d.ts +21 -0
  25. package/dist/compactSelect/compactSelect.js +150 -0
  26. package/dist/compactSelect/composite.d.ts +54 -0
  27. package/dist/compactSelect/composite.js +101 -0
  28. package/dist/compactSelect/control.d.ts +112 -0
  29. package/dist/compactSelect/control.js +355 -0
  30. package/dist/compactSelect/gridList/index.d.ts +46 -0
  31. package/dist/compactSelect/gridList/index.js +102 -0
  32. package/dist/compactSelect/gridList/option.d.ts +15 -0
  33. package/dist/compactSelect/gridList/option.js +111 -0
  34. package/dist/compactSelect/gridList/section.d.ts +15 -0
  35. package/dist/compactSelect/gridList/section.js +58 -0
  36. package/dist/compactSelect/highlightText.d.ts +6 -0
  37. package/dist/compactSelect/highlightText.js +33 -0
  38. package/dist/compactSelect/index.d.ts +9 -0
  39. package/dist/compactSelect/index.js +8 -0
  40. package/dist/compactSelect/list.d.ts +94 -0
  41. package/dist/compactSelect/list.js +167 -0
  42. package/dist/compactSelect/listBox/index.d.ts +84 -0
  43. package/dist/compactSelect/listBox/index.js +175 -0
  44. package/dist/compactSelect/listBox/option.d.ts +19 -0
  45. package/dist/compactSelect/listBox/option.js +101 -0
  46. package/dist/compactSelect/listBox/section.d.ts +21 -0
  47. package/dist/compactSelect/listBox/section.js +58 -0
  48. package/dist/compactSelect/menuComponents.d.ts +89 -0
  49. package/dist/compactSelect/menuComponents.js +117 -0
  50. package/dist/compactSelect/selectFilterContext.d.ts +2 -0
  51. package/dist/compactSelect/selectFilterContext.js +3 -0
  52. package/dist/compactSelect/styles.d.ts +39 -0
  53. package/dist/compactSelect/styles.js +155 -0
  54. package/dist/compactSelect/types.d.ts +1 -0
  55. package/dist/compactSelect/types.js +0 -0
  56. package/dist/compactSelect/useVirtualizedItems.d.ts +52 -0
  57. package/dist/compactSelect/useVirtualizedItems.js +74 -0
  58. package/dist/compactSelect/utils.d.ts +80 -0
  59. package/dist/compactSelect/utils.js +264 -0
  60. package/dist/confirm/index.d.ts +153 -0
  61. package/dist/confirm/index.js +132 -0
  62. package/dist/dateTime/config.d.ts +23 -0
  63. package/dist/dateTime/config.js +50 -0
  64. package/dist/dateTime/context.d.ts +18 -0
  65. package/dist/dateTime/context.js +46 -0
  66. package/dist/dateTime/dateTime.d.ts +6 -0
  67. package/dist/dateTime/dateTime.js +30 -0
  68. package/dist/dateTime/format.d.ts +24 -0
  69. package/dist/dateTime/format.js +45 -0
  70. package/dist/dateTime/index.d.ts +6 -0
  71. package/dist/dateTime/index.js +6 -0
  72. package/dist/dateTime/intlFormatter.d.ts +9 -0
  73. package/dist/dateTime/intlFormatter.js +16 -0
  74. package/dist/dateTime/parseDate.d.ts +3 -0
  75. package/dist/dateTime/parseDate.js +12 -0
  76. package/dist/descriptionList/descriptionList.js +4 -3
  77. package/dist/disclosure/disclosure.js +2 -2
  78. package/dist/dragHandle/dragHandle.d.ts +3 -1
  79. package/dist/dragHandle/dragHandle.js +8 -5
  80. package/dist/drawer/components.d.ts +46 -0
  81. package/dist/drawer/components.js +265 -0
  82. package/dist/drawer/globalDrawer.d.ts +106 -0
  83. package/dist/drawer/globalDrawer.js +173 -0
  84. package/dist/drawer/index.d.ts +3 -0
  85. package/dist/drawer/index.js +2 -0
  86. package/dist/drawer/useDrawerResizing.d.ts +19 -0
  87. package/dist/drawer/useDrawerResizing.js +111 -0
  88. package/dist/drawer/useDrawerWidth.d.ts +1 -0
  89. package/dist/drawer/useDrawerWidth.js +42 -0
  90. package/dist/dropdownMenu/content.d.ts +1 -0
  91. package/dist/dropdownMenu/content.js +1 -0
  92. package/dist/dropdownMenu/context.d.ts +39 -0
  93. package/dist/dropdownMenu/context.js +3 -0
  94. package/dist/dropdownMenu/dropdownMenu.d.ts +70 -0
  95. package/dist/dropdownMenu/dropdownMenu.js +109 -0
  96. package/dist/dropdownMenu/index.d.ts +2 -0
  97. package/dist/dropdownMenu/index.js +1 -0
  98. package/dist/dropdownMenu/item.d.ts +140 -0
  99. package/dist/dropdownMenu/item.js +142 -0
  100. package/dist/dropdownMenu/list.d.ts +85 -0
  101. package/dist/dropdownMenu/list.js +429 -0
  102. package/dist/dropdownMenu/search.d.ts +16 -0
  103. package/dist/dropdownMenu/search.js +16 -0
  104. package/dist/dropdownMenu/section.d.ts +21 -0
  105. package/dist/dropdownMenu/section.js +40 -0
  106. package/dist/dropdownMenu/separator.d.ts +7 -0
  107. package/dist/dropdownMenu/separator.js +15 -0
  108. package/dist/dropdownMenu/useDropdownMenuKeyboard.d.ts +24 -0
  109. package/dist/dropdownMenu/useDropdownMenuKeyboard.js +31 -0
  110. package/dist/dropdownMenu/useDropdownMenuRowLayout.d.ts +29 -0
  111. package/dist/dropdownMenu/useDropdownMenuRowLayout.js +64 -0
  112. package/dist/dropdownMenu/useDropdownRootMenuState.d.ts +13 -0
  113. package/dist/dropdownMenu/useDropdownRootMenuState.js +30 -0
  114. package/dist/dropdownMenu/useDropdownSubmenuState.d.ts +19 -0
  115. package/dist/dropdownMenu/useDropdownSubmenuState.js +25 -0
  116. package/dist/dropdownMenu/utils.d.ts +21 -0
  117. package/dist/dropdownMenu/utils.js +55 -0
  118. package/dist/duration/formatElapsedDuration.d.ts +4 -0
  119. package/dist/duration/formatElapsedDuration.js +10 -0
  120. package/dist/duration/getDuration.d.ts +68 -0
  121. package/dist/duration/getDuration.js +80 -0
  122. package/dist/duration/index.d.ts +2 -0
  123. package/dist/duration/index.js +2 -0
  124. package/dist/form/FormSearch.d.ts +19 -0
  125. package/dist/form/FormSearch.js +4 -0
  126. package/dist/form/autoSaveForm.d.ts +110 -0
  127. package/dist/form/autoSaveForm.js +100 -0
  128. package/dist/{formPresentation → form}/displayField.js +2 -2
  129. package/dist/form/field/baseField.d.ts +23 -0
  130. package/dist/form/field/baseField.js +116 -0
  131. package/dist/form/field/checkboxField.d.ts +11 -0
  132. package/dist/form/field/checkboxField.js +42 -0
  133. package/dist/form/field/checkboxGroupField.d.ts +16 -0
  134. package/dist/form/field/checkboxGroupField.js +80 -0
  135. package/dist/form/field/compactSelectField.d.ts +19 -0
  136. package/dist/form/field/compactSelectField.js +77 -0
  137. package/dist/{formPresentation → form/field}/fieldIds.js +1 -1
  138. package/dist/form/field/inputField.d.ts +19 -0
  139. package/dist/form/field/inputField.js +31 -0
  140. package/dist/{formPresentation → form/field}/meta.js +6 -6
  141. package/dist/form/field/numberField.d.ts +5 -0
  142. package/dist/form/field/numberField.js +11 -0
  143. package/dist/form/field/passwordField.d.ts +3 -0
  144. package/dist/form/field/passwordField.js +27 -0
  145. package/dist/form/field/radioGroupField.d.ts +16 -0
  146. package/dist/form/field/radioGroupField.js +92 -0
  147. package/dist/form/field/rangeField.d.ts +8 -0
  148. package/dist/form/field/rangeField.js +34 -0
  149. package/dist/form/field/selectAsyncField.d.ts +31 -0
  150. package/dist/form/field/selectAsyncField.js +22 -0
  151. package/dist/form/field/selectField.d.ts +9 -0
  152. package/dist/form/field/selectField.js +72 -0
  153. package/dist/form/field/switchField.d.ts +7 -0
  154. package/dist/form/field/switchField.js +37 -0
  155. package/dist/form/field/textAreaField.d.ts +7 -0
  156. package/dist/form/field/textAreaField.js +25 -0
  157. package/dist/{formPresentation → form}/formContext.js +1 -1
  158. package/dist/form/formErrorContext/index.d.ts +9 -0
  159. package/dist/form/formErrorContext/index.js +7 -0
  160. package/dist/form/index.d.ts +9 -0
  161. package/dist/form/index.js +8 -0
  162. package/dist/{formPresentation → form/layout}/base.d.ts +1 -1
  163. package/dist/{formPresentation → form/layout}/base.js +1 -1
  164. package/dist/form/layout/fieldGroup.d.ts +6 -0
  165. package/dist/form/layout/fieldGroup.js +60 -0
  166. package/dist/{formPresentation/fieldLayout.d.ts → form/layout/index.d.ts} +1 -1
  167. package/dist/{formPresentation/fieldLayout.js → form/layout/index.js} +3 -3
  168. package/dist/{formPresentation → form/layout}/useStackedLayout.js +1 -1
  169. package/dist/form/scrapsForm.d.ts +220 -0
  170. package/dist/form/scrapsForm.js +126 -0
  171. package/dist/fzf.d.ts +9 -0
  172. package/dist/fzf.js +155 -0
  173. package/dist/hotkey/hotkey.d.ts +9 -8
  174. package/dist/hotkey/hotkey.js +13 -6
  175. package/dist/hotkey/index.d.ts +2 -1
  176. package/dist/hotkey/index.js +2 -1
  177. package/dist/hotkey/keyMappings.d.ts +1 -15
  178. package/dist/hotkey/keyMappings.js +29 -174
  179. package/dist/hotkey/useHotkeys.d.ts +3 -47
  180. package/dist/hotkey/useHotkeys.js +8 -42
  181. package/dist/image/image.js +2 -1
  182. package/dist/info/infoTip.d.ts +1 -1
  183. package/dist/info/infoTip.js +4 -3
  184. package/dist/input/index.d.ts +0 -3
  185. package/dist/input/index.js +0 -2
  186. package/dist/input/input.d.ts +2 -0
  187. package/dist/input/input.js +2 -0
  188. package/dist/input/passwordManagerIgnoreProps.d.ts +11 -0
  189. package/dist/input/passwordManagerIgnoreProps.js +8 -0
  190. package/dist/layout/container.d.ts +8 -2
  191. package/dist/layout/container.js +2 -2
  192. package/dist/layout/index.d.ts +2 -2
  193. package/dist/layout/index.js +1 -1
  194. package/dist/layout/styles.d.ts +2 -1
  195. package/dist/layout/styles.js +11 -5
  196. package/dist/legacyDatetime.d.ts +21 -0
  197. package/dist/legacyDatetime.js +13 -0
  198. package/dist/link/index.d.ts +1 -1
  199. package/dist/link/index.js +1 -1
  200. package/dist/link/link.js +4 -3
  201. package/dist/link/linkBehaviorContext.d.ts +11 -0
  202. package/dist/link/linkBehaviorContext.js +48 -11
  203. package/dist/menu/index.d.ts +1 -1
  204. package/dist/menu/index.js +1 -1
  205. package/dist/menu/menu.d.ts +14 -8
  206. package/dist/menu/menu.js +163 -60
  207. package/dist/modal/components.d.ts +19 -0
  208. package/dist/modal/components.js +99 -0
  209. package/dist/modal/errorBoundary.d.ts +2 -0
  210. package/dist/modal/errorBoundary.js +35 -0
  211. package/dist/modal/index.d.ts +33 -0
  212. package/dist/modal/index.js +260 -0
  213. package/dist/modal/portal.d.ts +1 -0
  214. package/dist/modal/portal.js +10 -0
  215. package/dist/modal/state.d.ts +17 -0
  216. package/dist/modal/state.js +41 -0
  217. package/dist/modal/types.d.ts +75 -0
  218. package/dist/modal/types.js +0 -0
  219. package/dist/numberInput/index.d.ts +3 -0
  220. package/dist/numberInput/index.js +2 -0
  221. package/dist/{input → numberInput}/numberDragInput.d.ts +1 -1
  222. package/dist/{input → numberInput}/numberDragInput.js +1 -1
  223. package/dist/{input → numberInput}/numberInput.d.ts +1 -1
  224. package/dist/{input → numberInput}/numberInput.js +1 -1
  225. package/dist/overlayContext.d.ts +29 -0
  226. package/dist/overlayContext.js +7 -0
  227. package/dist/pagination/index.d.ts +1 -0
  228. package/dist/pagination/index.js +1 -0
  229. package/dist/pagination/pagination.d.ts +24 -0
  230. package/dist/pagination/pagination.js +63 -0
  231. package/dist/pictureInPicture/index.d.ts +2 -0
  232. package/dist/pictureInPicture/index.js +2 -0
  233. package/dist/pictureInPicture/pictureInPicture.d.ts +47 -0
  234. package/dist/pictureInPicture/pictureInPicture.js +100 -0
  235. package/dist/pictureInPicture/pictureInPicturePortal.d.ts +16 -0
  236. package/dist/pictureInPicture/pictureInPicturePortal.js +46 -0
  237. package/dist/pictureInPicture/portalContext.d.ts +2 -0
  238. package/dist/pictureInPicture/portalContext.js +3 -0
  239. package/dist/relativeTime/getRelativeDate.d.ts +14 -0
  240. package/dist/relativeTime/getRelativeDate.js +107 -0
  241. package/dist/relativeTime/index.d.ts +3 -0
  242. package/dist/relativeTime/index.js +3 -0
  243. package/dist/relativeTime/relativeTime.d.ts +55 -0
  244. package/dist/relativeTime/relativeTime.js +102 -0
  245. package/dist/relativeTime/useRelativeTimeFormatter.d.ts +2 -0
  246. package/dist/relativeTime/useRelativeTimeFormatter.js +10 -0
  247. package/dist/revealOnHover/revealOnHover.js +1 -1
  248. package/dist/segmentedControl/segmentedControl.js +1 -1
  249. package/dist/select/filter.d.ts +4 -0
  250. package/dist/select/filter.js +12 -0
  251. package/dist/select/index.d.ts +3 -0
  252. package/dist/select/index.js +2 -0
  253. package/dist/select/option.d.ts +16 -0
  254. package/dist/select/option.js +81 -0
  255. package/dist/select/reactSelectWrapper.d.ts +8 -0
  256. package/dist/select/reactSelectWrapper.js +25 -0
  257. package/dist/select/select.d.ts +79 -0
  258. package/dist/select/select.js +454 -0
  259. package/dist/select/styles.d.ts +9 -0
  260. package/dist/select/styles.js +27 -0
  261. package/dist/select/types.d.ts +60 -0
  262. package/dist/select/types.js +0 -0
  263. package/dist/select/virtualizedMenuList.d.ts +24 -0
  264. package/dist/select/virtualizedMenuList.js +123 -0
  265. package/dist/slideOverPanel.d.ts +20 -0
  266. package/dist/slideOverPanel.js +141 -0
  267. package/dist/splitPanel/splitPanel.d.ts +3 -1
  268. package/dist/splitPanel/splitPanel.js +2 -1
  269. package/dist/table/table.d.ts +1 -1
  270. package/dist/table/table.js +39 -20
  271. package/dist/table/useColumnResize.d.ts +6 -5
  272. package/dist/table/useColumnResize.js +5 -4
  273. package/dist/tabs/context.d.ts +9 -0
  274. package/dist/tabs/context.js +9 -0
  275. package/dist/tabs/index.d.ts +2 -0
  276. package/dist/tabs/index.js +1 -0
  277. package/dist/tabs/item.d.ts +24 -0
  278. package/dist/tabs/item.js +4 -0
  279. package/dist/tabs/tab.d.ts +22 -0
  280. package/dist/tabs/tab.js +208 -0
  281. package/dist/tabs/tabList.d.ts +18 -0
  282. package/dist/tabs/tabList.js +258 -0
  283. package/dist/tabs/tabPanels.d.ts +13 -0
  284. package/dist/tabs/tabPanels.js +62 -0
  285. package/dist/tabs/tabs.d.ts +53 -0
  286. package/dist/tabs/tabs.js +59 -0
  287. package/dist/tabs/utils.d.ts +3 -0
  288. package/dist/tabs/utils.js +6 -0
  289. package/dist/text/heading.d.ts +1 -1
  290. package/dist/text/heading.js +1 -1
  291. package/dist/text/prose.d.ts +2 -2
  292. package/dist/text/styles.js +1 -1
  293. package/dist/text/text.d.ts +1 -1
  294. package/dist/text/text.js +1 -1
  295. package/dist/theme/dark.js +9 -9
  296. package/dist/theme/light.js +9 -9
  297. package/dist/theme/theme.d.ts +34 -34
  298. package/dist/theme/theme.js +9 -0
  299. package/dist/theme/types.d.ts +20 -2
  300. package/dist/tooltip/tooltip.js +2 -5
  301. package/dist/translation/index.d.ts +1 -0
  302. package/dist/translation/index.js +1 -0
  303. package/dist/translation/translate.d.ts +9 -0
  304. package/dist/translation/translate.js +5 -0
  305. package/dist/translation/translationContext.d.ts +2 -1
  306. package/dist/translation/translationContext.js +2 -1
  307. package/dist/useMedia.d.ts +15 -0
  308. package/dist/useMedia.js +24 -0
  309. package/dist/useOnClickOutside.d.ts +2 -0
  310. package/dist/useOnClickOutside.js +22 -0
  311. package/dist/useOverlay.d.ts +1 -0
  312. package/dist/useOverlay.js +1 -0
  313. package/dist/useVirtualCollection.d.ts +154 -0
  314. package/dist/useVirtualCollection.js +143 -0
  315. package/dist/useVirtualRows.d.ts +26 -0
  316. package/dist/useVirtualRows.js +26 -0
  317. package/dist/virtualCollectionLayout.d.ts +51 -0
  318. package/dist/virtualCollectionLayout.js +49 -0
  319. package/fonts/OFL.txt +94 -0
  320. package/fonts/roboto-mono-variable-cyrillic-ext.woff2 +0 -0
  321. package/fonts/roboto-mono-variable-cyrillic.woff2 +0 -0
  322. package/fonts/roboto-mono-variable-greek.woff2 +0 -0
  323. package/fonts/roboto-mono-variable-latin-ext.woff2 +0 -0
  324. package/fonts/roboto-mono-variable-vietnamese.woff2 +0 -0
  325. package/fonts/roboto-mono-variable.woff2 +0 -0
  326. package/fonts/rubik-variable-cyrillic-ext.woff2 +0 -0
  327. package/fonts/rubik-variable-cyrillic.woff2 +0 -0
  328. package/fonts/rubik-variable-latin-ext.woff2 +0 -0
  329. package/fonts/rubik-variable.woff2 +0 -0
  330. package/fonts.css +211 -0
  331. package/package.json +140 -23
  332. package/dist/datetime.d.ts +0 -39
  333. package/dist/datetime.js +0 -20
  334. package/dist/formPresentation/index.d.ts +0 -8
  335. package/dist/formPresentation/index.js +0 -8
  336. package/dist/interactionStateLayer/index.d.ts +0 -1
  337. package/dist/interactionStateLayer/index.js +0 -1
  338. package/dist/interactionStateLayer/interactionStateLayer.d.ts +0 -23
  339. package/dist/interactionStateLayer/interactionStateLayer.js +0 -67
  340. package/dist/unreachable.d.ts +0 -1
  341. package/dist/unreachable.js +0 -4
  342. /package/dist/{formPresentation → form}/autoSaveContext.d.ts +0 -0
  343. /package/dist/{formPresentation → form}/autoSaveContext.js +0 -0
  344. /package/dist/{formPresentation → form}/displayField.d.ts +0 -0
  345. /package/dist/{formPresentation → form/field}/fieldIds.d.ts +0 -0
  346. /package/dist/{formPresentation → form/field}/groupContext.d.ts +0 -0
  347. /package/dist/{formPresentation → form/field}/groupContext.js +0 -0
  348. /package/dist/{formPresentation → form/field}/meta.d.ts +0 -0
  349. /package/dist/{formPresentation → form}/formContext.d.ts +0 -0
  350. /package/dist/{formPresentation → form}/icons.d.ts +0 -0
  351. /package/dist/{formPresentation → form}/icons.js +0 -0
  352. /package/dist/{formPresentation → form/layout}/useStackedLayout.d.ts +0 -0
@@ -0,0 +1,355 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from "react";
3
+ import is_prop_valid from "@emotion/is-prop-valid";
4
+ import { css, useTheme } from "@emotion/react";
5
+ import styled from "@emotion/styled";
6
+ import { FocusScope } from "@react-aria/focus";
7
+ import { useKeyboard } from "@react-aria/interactions";
8
+ import { mergeProps } from "@react-aria/utils";
9
+ import { Badge } from "../badge/index.js";
10
+ import { useBoundaryContext } from "../boundaryContext.js";
11
+ import { Button } from "../button/index.js";
12
+ import { Container, Flex, Stack } from "../layout/index.js";
13
+ import { ControlContext, Footer, Header, Search, Title } from "../menu/index.js";
14
+ import { Overlay, PositionWrapper } from "../overlay.js";
15
+ import { OverlayTrigger } from "../overlayTrigger.js";
16
+ import { Spinner } from "../spinner/index.js";
17
+ import { useTranslation } from "../translation/index.js";
18
+ import { useOverlay } from "../useOverlay.js";
19
+ import { getDisabledOptions, getHiddenOptions, getSearchConfig } from "./utils.js";
20
+ function nextFrameCallback(cb) {
21
+ if ('requestAnimationFrame' in window) window.requestAnimationFrame(()=>cb());
22
+ else setTimeout(()=>{
23
+ cb();
24
+ }, 1);
25
+ }
26
+ function Control({ autoFocus, trigger, triggerId, isOpen, onClose, isDismissable, onInteractOutside, shouldCloseOnInteractOutside, shouldCloseOnBlur, preventOverflowOptions, flipOptions, disabled, position = 'bottom-start', strategy = 'absolute', offset, hideOptions, menuTitle, maxMenuHeight = '32rem', menuWidth, menuMinWidth, menuHeight, menuHeaderTrailingItems, menuBody, menuFooter, onOpenChange, items = [], isOptionDisabled, value, size = 'md', search: searchConfig, clearable = false, onClear, loading = false, mode = 'list', children, menuRef, ...wrapperProps }) {
27
+ const { t } = useTranslation();
28
+ const wrapperRef = useRef(null);
29
+ const pendingAutoFocus = useRef(false);
30
+ const normalizedSearch = getSearchConfig(searchConfig);
31
+ const searchEnabled = void 0 !== normalizedSearch;
32
+ const searchFilter = 'function' == typeof normalizedSearch?.filter ? normalizedSearch.filter : void 0;
33
+ const highlightSearch = normalizedSearch?.highlight ?? false;
34
+ const [search, setSearch] = useState('');
35
+ const [searchInputValue, setSearchInputValue] = useState(search);
36
+ const searchRef = useRef(null);
37
+ const updateSearch = (newValue)=>{
38
+ normalizedSearch?.onChange?.(newValue);
39
+ setSearchInputValue(newValue);
40
+ if (normalizedSearch?.filter !== false) setSearch(newValue);
41
+ };
42
+ const selectableOptionCount = useMemo(()=>{
43
+ const { hidden: hiddenOptions } = getHiddenOptions(items, search, 1 / 0, searchFilter);
44
+ const disabledOptions = new Set(getDisabledOptions(items, isOptionDisabled));
45
+ return items.reduce((count, item)=>{
46
+ if ('options' in item) return count + item.options.filter((option)=>!hiddenOptions.has(option.key) && !disabledOptions.has(option.key)).length;
47
+ return count + (hiddenOptions.has(item.key) || disabledOptions.has(item.key) ? 0 : 1);
48
+ }, 0);
49
+ }, [
50
+ items,
51
+ search,
52
+ searchFilter,
53
+ isOptionDisabled
54
+ ]);
55
+ const { keyboardProps: searchKeyboardProps } = useKeyboard({
56
+ onKeyDown: (e)=>{
57
+ if ('ArrowDown' === e.key) {
58
+ e.preventDefault();
59
+ overlayRef.current?.querySelector(`li[role="${'grid' === mode ? 'row' : 'option'}"]`)?.focus();
60
+ }
61
+ if ('Enter' === e.key && !e.nativeEvent.isComposing) {
62
+ e.preventDefault();
63
+ const firstOption = overlayRef.current?.querySelector(`li[role="${'grid' === mode ? 'row' : 'option'}"]:not([aria-disabled="true"])`);
64
+ const focusOptionList = ()=>{
65
+ if (firstOption) return void firstOption.focus();
66
+ overlayRef.current?.querySelector(`ul[role="${'grid' === mode ? 'grid' : 'listbox'}"]`)?.focus();
67
+ };
68
+ if (selectableOptionCount > 0 && !loading) if (1 === selectableOptionCount && firstOption) firstOption.click();
69
+ else focusOptionList();
70
+ }
71
+ e.continuePropagation();
72
+ }
73
+ });
74
+ const overflowBoundaryId = useBoundaryContext();
75
+ const getOverflowBoundary = useCallback(()=>(overflowBoundaryId ? document.getElementById(overflowBoundaryId) : null) ?? document.querySelector('main') ?? document.getElementById('main') ?? void 0, [
76
+ overflowBoundaryId
77
+ ]);
78
+ const { isOpen: overlayIsOpen, state: overlayState, triggerRef, triggerProps: overlayTriggerProps, overlayRef, overlayProps } = useOverlay({
79
+ disableTrigger: disabled,
80
+ type: 'grid' === mode ? 'menu' : 'listbox',
81
+ position,
82
+ offset,
83
+ isOpen,
84
+ isDismissable,
85
+ onInteractOutside,
86
+ shouldCloseOnInteractOutside,
87
+ shouldCloseOnBlur,
88
+ preventOverflowOptions,
89
+ getOverflowBoundary,
90
+ flipOptions,
91
+ strategy,
92
+ onOpenChange: (open)=>{
93
+ pendingAutoFocus.current = open;
94
+ onOpenChange?.(open);
95
+ nextFrameCallback(()=>{
96
+ if (open) {
97
+ if (!pendingAutoFocus.current) return;
98
+ pendingAutoFocus.current = false;
99
+ if (searchEnabled) return void searchRef.current?.focus();
100
+ const firstSelectedOption = overlayRef.current?.querySelector(`li[role="${'grid' === mode ? 'row' : 'option'}"][aria-selected="true"]`);
101
+ if (firstSelectedOption) return void firstSelectedOption.focus();
102
+ overlayRef.current?.querySelector(`li[role="${'grid' === mode ? 'row' : 'option'}"]`)?.focus();
103
+ return;
104
+ }
105
+ onClose?.();
106
+ setSearchInputValue('');
107
+ setSearch('');
108
+ if (document.activeElement === document.body || wrapperRef.current?.contains(document.activeElement)) triggerRef.current?.focus();
109
+ });
110
+ }
111
+ });
112
+ const wasRefAvailable = useRef(false);
113
+ useEffect(()=>{
114
+ if (!triggerRef.current || wasRefAvailable.current) return;
115
+ wasRefAvailable.current = true;
116
+ if (autoFocus && !disabled) triggerRef.current.focus();
117
+ }, [
118
+ autoFocus,
119
+ disabled,
120
+ triggerRef
121
+ ]);
122
+ const [menuFullWidth, setMenuFullWidth] = useState();
123
+ const onSearchFocus = ()=>setMenuFullWidth(overlayRef.current?.offsetWidth);
124
+ const onSearchBlur = ()=>!search && setMenuFullWidth(void 0);
125
+ const triggerLabel = useMemo(()=>{
126
+ const values = Array.isArray(value) ? value : [
127
+ value
128
+ ];
129
+ const options = items.flatMap((item)=>{
130
+ if ('options' in item) return item.options;
131
+ return item;
132
+ }).filter((item)=>values.includes(item.value));
133
+ if (0 === options.length) return /*#__PURE__*/ jsx(TriggerLabel, {
134
+ children: t('None')
135
+ });
136
+ return /*#__PURE__*/ jsxs(Fragment, {
137
+ children: [
138
+ /*#__PURE__*/ jsx(TriggerLabel, {
139
+ children: options[0]?.label
140
+ }),
141
+ options.length > 1 && /*#__PURE__*/ jsx(StyledBadge, {
142
+ variant: "muted",
143
+ children: `+${options.length - 1}`
144
+ })
145
+ ]
146
+ });
147
+ }, [
148
+ items,
149
+ t,
150
+ value
151
+ ]);
152
+ const { keyboardProps: triggerKeyboardProps } = useKeyboard({
153
+ onKeyDown: (e)=>{
154
+ if ('ArrowDown' === e.key || 'ArrowUp' === e.key) {
155
+ e.preventDefault();
156
+ overlayState.open();
157
+ } else e.continuePropagation();
158
+ }
159
+ });
160
+ const hasSelection = useMemo(()=>{
161
+ if (void 0 === value) return false;
162
+ if (Array.isArray(value)) return value.length > 0;
163
+ return true;
164
+ }, [
165
+ value
166
+ ]);
167
+ const contextValue = useMemo(()=>({
168
+ overlayState,
169
+ overlayIsOpen,
170
+ search,
171
+ searchable: searchEnabled,
172
+ size,
173
+ disabled,
174
+ searchMatcher: searchFilter,
175
+ highlightSearch
176
+ }), [
177
+ overlayState,
178
+ overlayIsOpen,
179
+ search,
180
+ searchEnabled,
181
+ size,
182
+ disabled,
183
+ searchFilter,
184
+ highlightSearch
185
+ ]);
186
+ const showClearButton = clearable && (hasSelection || !!menuTitle);
187
+ const hasHeader = !!menuTitle || !!menuHeaderTrailingItems || showClearButton;
188
+ const theme = useTheme();
189
+ const mergedTriggerProps = mergeProps({
190
+ id: triggerId,
191
+ children: triggerLabel
192
+ }, triggerKeyboardProps, overlayTriggerProps);
193
+ return /*#__PURE__*/ jsx(ControlContext, {
194
+ value: contextValue,
195
+ children: /*#__PURE__*/ jsxs(Container, {
196
+ display: "flex",
197
+ width: "max-content",
198
+ position: "relative",
199
+ ...wrapperProps,
200
+ children: [
201
+ trigger ? trigger(mergedTriggerProps, overlayIsOpen) : /*#__PURE__*/ jsx(OverlayTrigger.Button, {
202
+ ...mergedTriggerProps
203
+ }),
204
+ /*#__PURE__*/ jsx(StyledPositionWrapper, {
205
+ visible: overlayIsOpen,
206
+ zIndex: theme.zIndex?.dropdown,
207
+ ...overlayProps,
208
+ children: overlayIsOpen && /*#__PURE__*/ jsx(StyledOverlay, {
209
+ ref: menuRef,
210
+ onFocusCapture: ()=>{
211
+ pendingAutoFocus.current = false;
212
+ },
213
+ width: menuWidth ?? menuFullWidth,
214
+ height: menuHeight,
215
+ minWidth: menuMinWidth ?? overlayProps.style?.minWidth,
216
+ maxWidth: overlayProps.style?.maxWidth ? `calc(${withUnits(overlayProps.style.maxWidth)} * 0.9)` : void 0,
217
+ maxHeight: overlayProps.style?.maxHeight,
218
+ maxHeightProp: maxMenuHeight,
219
+ "data-menu-has-header": hasHeader,
220
+ "data-menu-has-search": searchEnabled,
221
+ "data-menu-has-footer": !!menuFooter,
222
+ children: /*#__PURE__*/ jsxs(FocusScope, {
223
+ contain: true,
224
+ children: [
225
+ hasHeader && /*#__PURE__*/ jsx(Header, {
226
+ borderBottom: searchEnabled ? 'none' : 'secondary',
227
+ padding: searchEnabled ? 'xs lg 0 lg' : 'xs lg',
228
+ children: /*#__PURE__*/ jsxs(Flex, {
229
+ align: "center",
230
+ justify: "between",
231
+ gap: "xl",
232
+ minHeight: "24px",
233
+ children: [
234
+ menuTitle && /*#__PURE__*/ jsx(Title, {
235
+ children: menuTitle
236
+ }),
237
+ /*#__PURE__*/ jsxs(Flex, {
238
+ align: "center",
239
+ gap: "xs",
240
+ marginLeft: "auto",
241
+ children: [
242
+ loading && /*#__PURE__*/ jsx(StyledSpinner, {
243
+ size: 12
244
+ }),
245
+ 'function' == typeof menuHeaderTrailingItems ? menuHeaderTrailingItems({
246
+ closeOverlay: overlayState.close
247
+ }) : menuHeaderTrailingItems,
248
+ showClearButton && /*#__PURE__*/ jsx(ClearButton, {
249
+ onClick: ()=>onClear?.({
250
+ overlayState
251
+ }),
252
+ size: "zero",
253
+ variant: "transparent",
254
+ "aria-hidden": !hasSelection,
255
+ disabled: !hasSelection,
256
+ children: t('Clear')
257
+ })
258
+ ]
259
+ })
260
+ ]
261
+ })
262
+ }),
263
+ searchEnabled && /*#__PURE__*/ jsx(Search, {
264
+ ref: searchRef,
265
+ placeholder: normalizedSearch?.placeholder ?? 'Search…',
266
+ value: searchInputValue,
267
+ onFocus: onSearchFocus,
268
+ onBlur: onSearchBlur,
269
+ onChange: (e)=>updateSearch(e.target.value),
270
+ ...searchKeyboardProps
271
+ }),
272
+ 'function' == typeof menuBody ? menuBody({
273
+ closeOverlay: overlayState.close
274
+ }) : menuBody,
275
+ !hideOptions && /*#__PURE__*/ jsx(Stack, {
276
+ minHeight: "0",
277
+ children: children
278
+ }),
279
+ menuFooter && /*#__PURE__*/ jsx(Footer, {
280
+ children: /*#__PURE__*/ jsx(Container, {
281
+ width: "100%",
282
+ children: 'function' == typeof menuFooter ? menuFooter({
283
+ closeOverlay: overlayState.close,
284
+ resetSearch: ()=>updateSearch('')
285
+ }) : menuFooter
286
+ })
287
+ })
288
+ ]
289
+ })
290
+ })
291
+ })
292
+ ]
293
+ })
294
+ });
295
+ }
296
+ const TriggerLabel = styled('span')`
297
+ display: block;
298
+ width: 100%;
299
+ white-space: nowrap;
300
+ overflow: hidden;
301
+ text-overflow: ellipsis;
302
+ text-align: left;
303
+ `;
304
+ const StyledBadge = styled(Badge)`
305
+ margin-left: ${(p)=>p.theme.space.xs};
306
+ flex-shrink: 0;
307
+ top: auto;
308
+ `;
309
+ const StyledSpinner = styled(Spinner)`
310
+ display: flex;
311
+ align-items: center;
312
+ && {
313
+ margin: 0;
314
+ }
315
+ `;
316
+ const ClearButton = styled(Button)`
317
+ font-weight: ${(p)=>p.theme.font.weight.sans.regular};
318
+ color: ${(p)=>p.theme.tokens.content.secondary};
319
+ padding: 0 ${(p)=>p.theme.space.xs};
320
+ margin: 0 -${(p)=>p.theme.space.xs};
321
+
322
+ &[aria-hidden='true'] {
323
+ visibility: hidden;
324
+ }
325
+ `;
326
+ const withUnits = (value)=>'string' == typeof value ? value : `${value}px`;
327
+ const StyledOverlay = styled(Overlay, {
328
+ shouldForwardProp: (prop)=>is_prop_valid(prop)
329
+ })`
330
+ /* Should be a flex container so that when maxHeight is set (to avoid page overflow),
331
+ ListBoxWrap/GridListWrap will also shrink to fit */
332
+ display: flex;
333
+ flex-direction: column;
334
+ overflow: hidden;
335
+
336
+ ${(p)=>p.width && css`
337
+ width: ${withUnits(p.width)};
338
+ `}
339
+ ${(p)=>p.height && css`
340
+ height: ${withUnits(p.height)};
341
+ `}
342
+ ${(p)=>p.minWidth && css`
343
+ min-width: ${withUnits(p.minWidth)};
344
+ `}
345
+ max-width: ${(p)=>p.maxWidth ? `min(${withUnits(p.maxWidth)}, 100%)` : '100%'};
346
+ max-height: ${(p)=>p.maxHeight ? `min(${withUnits(p.maxHeight)}, ${withUnits(p.maxHeightProp)})` : withUnits(p.maxHeightProp)};
347
+ `;
348
+ const StyledPositionWrapper = styled(PositionWrapper, {
349
+ shouldForwardProp: (prop)=>is_prop_valid(prop)
350
+ })`
351
+ min-width: 100%;
352
+ display: ${(p)=>p.visible ? 'block' : 'none'};
353
+ z-index: ${(p)=>p?.zIndex};
354
+ `;
355
+ export { ClearButton, Control, TriggerLabel };
@@ -0,0 +1,46 @@
1
+ import type * as React from 'react';
2
+ import type { AriaGridListOptions } from '@react-aria/gridlist';
3
+ import type { ListState } from '@react-stately/list';
4
+ import type { CollectionChildren } from '@react-types/shared';
5
+ import type { ListItemBase } from '../types.js';
6
+ import { type GridListOptionProps } from './option.js';
7
+ interface GridListProps<T extends ListItemBase> extends Omit<React.HTMLAttributes<HTMLUListElement>, 'children'>, Omit<AriaGridListOptions<any>, 'disabledKeys' | 'selectedKeys' | 'defaultSelectedKeys' | 'onSelectionChange' | 'autoFocus'> {
8
+ /**
9
+ * Keyboard event handler, to be attached to the list (`ul`) element, to seamlessly
10
+ * move focus from one composite list to another when an arrow key is pressed. Returns
11
+ * a boolean indicating whether the keyboard event was intercepted. If yes, then no
12
+ * further callback function should be run.
13
+ */
14
+ keyDownHandler: (e: React.KeyboardEvent<HTMLUListElement>) => boolean;
15
+ /**
16
+ * Object containing the selection state and focus position, needed for
17
+ * `useGridList()`.
18
+ */
19
+ listState: ListState<T>;
20
+ children?: CollectionChildren<T>;
21
+ /**
22
+ * Text label to be rendered as heading on top of grid list.
23
+ */
24
+ label?: React.ReactNode;
25
+ size?: GridListOptionProps<ListItemBase>['size'];
26
+ /**
27
+ * Message to be displayed when some options are hidden due to `sizeLimit`.
28
+ */
29
+ sizeLimitMessage?: string;
30
+ /**
31
+ * If true, virtualization will be enabled for the list.
32
+ */
33
+ virtualized?: boolean;
34
+ }
35
+ /**
36
+ * A grid list with accessibile behaviors & attributes.
37
+ * https://react-spectrum.adobe.com/react-aria/useGridList.html
38
+ *
39
+ * Unlike list boxes, grid lists are two-dimensional. Users can press Arrow Up/Down to
40
+ * move between rows (options), and Arrow Left/Right to move between "columns". This is
41
+ * useful when the select options have smaller, interactive elements (buttons/links)
42
+ * inside. Grid lists allow users to focus on those child elements (using the Arrow
43
+ * Left/Right keys) and interact with them, which isn't possible with list boxes.
44
+ */
45
+ declare function GridList<T extends ListItemBase>({ listState, size, label, sizeLimitMessage, keyDownHandler, virtualized, ...props }: GridListProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
46
+ export { GridList };
@@ -0,0 +1,102 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { createElement } from "@emotion/react";
3
+ import { useContext, useId, useMemo, useRef } from "react";
4
+ import { useGridList } from "@react-aria/gridlist";
5
+ import { mergeProps } from "@react-aria/utils";
6
+ import { SelectFilterContext } from "../selectFilterContext.js";
7
+ import { ListLabel, ListSeparator, ListWrap, SizeLimitMessage } from "../styles.js";
8
+ import { useVirtualizedItems } from "../useVirtualizedItems.js";
9
+ import { hasVisibleLeadingItems } from "../utils.js";
10
+ import { Container } from "../../layout/index.js";
11
+ import { ControlContext, ReserveLeadingSlot } from "../../menu/index.js";
12
+ import { useTranslation } from "../../translation/index.js";
13
+ import { GridListOption } from "./option.js";
14
+ import { GridListSection } from "./section.js";
15
+ function GridList({ listState, size = 'md', label, sizeLimitMessage, keyDownHandler, virtualized, ...props }) {
16
+ const { t } = useTranslation();
17
+ const ref = useRef(null);
18
+ const labelId = useId();
19
+ const { gridProps } = useGridList({
20
+ ...props,
21
+ 'aria-labelledby': label ? labelId : props['aria-labelledby']
22
+ }, listState, ref);
23
+ const onKeyDown = (e)=>{
24
+ const continueCallback = keyDownHandler?.(e);
25
+ if (continueCallback && 'Escape' !== e.key) gridProps.onKeyDown?.(e);
26
+ };
27
+ const { overlayIsOpen, searchable } = useContext(ControlContext);
28
+ const hiddenOptions = useContext(SelectFilterContext);
29
+ const listItems = useMemo(()=>[
30
+ ...listState.collection
31
+ ].filter((node)=>{
32
+ if ('section' === node.type) return ![
33
+ ...node.childNodes
34
+ ].every((child)=>hiddenOptions.has(child.key));
35
+ return !hiddenOptions.has(node.key);
36
+ }), [
37
+ listState.collection,
38
+ hiddenOptions
39
+ ]);
40
+ const reserveLeadingSlot = useMemo(()=>hasVisibleLeadingItems(listItems, hiddenOptions), [
41
+ listItems,
42
+ hiddenOptions
43
+ ]);
44
+ const virtualizer = useVirtualizedItems({
45
+ listItems,
46
+ virtualized,
47
+ size
48
+ });
49
+ const mergedProps = mergeProps(gridProps, props);
50
+ return /*#__PURE__*/ jsxs(ReserveLeadingSlot, {
51
+ reserve: reserveLeadingSlot,
52
+ children: [
53
+ 0 !== listItems.length && /*#__PURE__*/ jsx(ListSeparator, {
54
+ role: "separator"
55
+ }),
56
+ 0 !== listItems.length && label && /*#__PURE__*/ jsx(ListLabel, {
57
+ id: labelId,
58
+ children: label
59
+ }),
60
+ overlayIsOpen && /*#__PURE__*/ jsx(Container, {
61
+ ref: virtualizer.scrollElementRef,
62
+ height: "100%",
63
+ overflowY: "auto",
64
+ children: /*#__PURE__*/ jsx(Container, {
65
+ ...virtualizer.wrapperProps,
66
+ children: /*#__PURE__*/ jsxs(ListWrap, {
67
+ ...mergedProps,
68
+ style: {
69
+ ...mergedProps.style,
70
+ ...virtualizer.listWrapStyle
71
+ },
72
+ onKeyDown: onKeyDown,
73
+ ref: ref,
74
+ children: [
75
+ virtualizer.items.map((row)=>{
76
+ const item = listItems[row.index];
77
+ if (!item) return null;
78
+ if ('section' === item.type) return /*#__PURE__*/ createElement(GridListSection, {
79
+ ...virtualizer.itemProps(row.index),
80
+ key: item.key,
81
+ node: item,
82
+ listState: listState,
83
+ size: size
84
+ });
85
+ return /*#__PURE__*/ jsx(GridListOption, {
86
+ ...virtualizer.itemProps(row.index),
87
+ node: item,
88
+ listState: listState,
89
+ size: size
90
+ }, item.key);
91
+ }),
92
+ !searchable && hiddenOptions.size > 0 && /*#__PURE__*/ jsx(SizeLimitMessage, {
93
+ children: sizeLimitMessage ?? t('Use search to find more options…')
94
+ })
95
+ ]
96
+ })
97
+ })
98
+ })
99
+ ]
100
+ });
101
+ }
102
+ export { GridList };
@@ -0,0 +1,15 @@
1
+ import type { AriaGridListItemOptions } from '@react-aria/gridlist';
2
+ import type { ListState } from '@react-stately/list';
3
+ import type { Node } from '@react-types/shared';
4
+ import type { ListItemBase } from '../types.js';
5
+ import type { FormSize } from '../../theme/index.js';
6
+ export interface GridListOptionProps<T extends ListItemBase> extends AriaGridListItemOptions {
7
+ listState: ListState<T>;
8
+ node: Node<T>;
9
+ size: FormSize;
10
+ }
11
+ /**
12
+ * A <li /> element with accessibile behaviors & attributes.
13
+ * https://react-spectrum.adobe.com/react-aria/useGridList.html
14
+ */
15
+ export declare function GridListOption<T extends ListItemBase>({ node, listState, size, }: GridListOptionProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,111 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { Fragment, useContext, useMemo, useRef, useState } from "react";
3
+ import { useGridListItem, useGridListSelectionCheckbox } from "@react-aria/gridlist";
4
+ import { useFocusWithin, useHover } from "@react-aria/interactions";
5
+ import { mergeProps } from "@react-aria/utils";
6
+ import { IconCheckmark } from "@sentry/icons/checkmark";
7
+ import { Checkbox } from "../../checkbox/index.js";
8
+ import { HighlightText } from "../highlightText.js";
9
+ import { LeadWrap, getOptionPaddingLeft } from "../styles.js";
10
+ import { ControlContext, ListItem, useReserveLeadingSlot } from "../../menu/index.js";
11
+ function GridListOption({ node, listState, size }) {
12
+ const ref = useRef(null);
13
+ const { label, details, trailingItems, priority, hideCheck, tooltip, tooltipOptions, selectionMode } = node.props;
14
+ const multiple = selectionMode ? 'multiple' === selectionMode : 'multiple' === listState.selectionManager.selectionMode;
15
+ const { rowProps, gridCellProps, isSelected, isDisabled, isPressed, isFocused } = useGridListItem({
16
+ node,
17
+ shouldSelectOnPressUp: true
18
+ }, listState, ref);
19
+ const { search, highlightSearch } = useContext(ControlContext);
20
+ const renderedLabel = highlightSearch && search && 'string' == typeof label ? /*#__PURE__*/ jsx(HighlightText, {
21
+ text: label,
22
+ query: search
23
+ }) : label;
24
+ const { checkboxProps: { isDisabled: _isDisabled, isSelected: _isSelected, onChange: _onChange, ...checkboxProps } } = useGridListSelectionCheckbox({
25
+ key: node.key
26
+ }, listState);
27
+ const { hoverProps } = useHover({
28
+ onHoverStart: ()=>ref.current?.focus({
29
+ preventScroll: true
30
+ })
31
+ });
32
+ const [isFocusWithin, setFocusWithin] = useState(false);
33
+ const { focusWithinProps } = useFocusWithin({
34
+ onFocusWithinChange: setFocusWithin
35
+ });
36
+ const rowPropsMerged = mergeProps(rowProps, hoverProps, focusWithinProps);
37
+ const labelPropsMemo = useMemo(()=>({
38
+ as: 'string' == typeof label ? 'p' : 'div'
39
+ }), [
40
+ label
41
+ ]);
42
+ const reserveLeadingSlot = useReserveLeadingSlot();
43
+ const { leadingItems } = node.props;
44
+ const leadingItemsMemo = useMemo(()=>{
45
+ const checkboxSize = 'xs' === size ? 'xs' : 'sm';
46
+ const leading = 'function' == typeof leadingItems ? leadingItems({
47
+ disabled: isDisabled,
48
+ isFocused,
49
+ isSelected
50
+ }) : leadingItems;
51
+ if (hideCheck) return leading;
52
+ return /*#__PURE__*/ jsxs(Fragment, {
53
+ children: [
54
+ /*#__PURE__*/ jsx(LeadWrap, {
55
+ role: "presentation",
56
+ children: multiple ? /*#__PURE__*/ jsx(Checkbox, {
57
+ ...checkboxProps,
58
+ size: checkboxSize,
59
+ checked: isSelected,
60
+ disabled: isDisabled,
61
+ readOnly: true
62
+ }) : isSelected && /*#__PURE__*/ jsx(IconCheckmark, {
63
+ size: checkboxSize,
64
+ variant: "accent",
65
+ ...checkboxProps
66
+ })
67
+ }),
68
+ leading || reserveLeadingSlot ? /*#__PURE__*/ jsx(LeadWrap, {
69
+ role: "presentation",
70
+ minWidth: reserveLeadingSlot ? '16px' : void 0,
71
+ children: leading
72
+ }) : null
73
+ ]
74
+ });
75
+ }, [
76
+ multiple,
77
+ isSelected,
78
+ isDisabled,
79
+ isFocused,
80
+ size,
81
+ leadingItems,
82
+ hideCheck,
83
+ reserveLeadingSlot
84
+ ]);
85
+ return /*#__PURE__*/ jsx(ListItem, {
86
+ ...rowPropsMerged,
87
+ ref: ref,
88
+ size: size,
89
+ label: renderedLabel,
90
+ details: details,
91
+ disabled: isDisabled,
92
+ isSelected: isSelected,
93
+ isPressed: isPressed,
94
+ isFocused: isFocusWithin,
95
+ priority: priority ? 'primary' : 'default',
96
+ innerWrapProps: {
97
+ ...gridCellProps,
98
+ paddingLeft: getOptionPaddingLeft({
99
+ hasCheck: !hideCheck,
100
+ hasLeadingItems: Boolean(leadingItems) || reserveLeadingSlot
101
+ })
102
+ },
103
+ labelProps: labelPropsMemo,
104
+ leadingItems: leadingItemsMemo,
105
+ trailingItems: trailingItems,
106
+ tooltip: tooltip,
107
+ tooltipOptions: tooltipOptions,
108
+ "data-test-id": node.key
109
+ });
110
+ }
111
+ export { GridListOption };
@@ -0,0 +1,15 @@
1
+ import type { ListState } from '@react-stately/list';
2
+ import type { Node } from '@react-types/shared';
3
+ import type { ListItemBase } from '../types.js';
4
+ import { type GridListOptionProps } from './option.js';
5
+ interface GridListSectionProps<T extends ListItemBase> {
6
+ listState: ListState<T>;
7
+ node: Node<T>;
8
+ size: GridListOptionProps<T>['size'];
9
+ }
10
+ /**
11
+ * A <li /> element that functions as a grid list section (renders a nested <ul />
12
+ * inside). https://react-spectrum.adobe.com/react-aria/useGridList.html
13
+ */
14
+ export declare function GridListSection<T extends ListItemBase>({ node, listState, size, }: GridListSectionProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
15
+ export {};