@procore/core-react 12.37.0 → 12.39.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 (327) hide show
  1. package/.jest/testShims.js +6 -0
  2. package/CHANGELOG.md +64 -0
  3. package/dist/AnchorNavigation/AnchorNavigation.styles.js +3 -3
  4. package/dist/Avatar/Avatar.styles.js +6 -6
  5. package/dist/Avatar/Avatar.styles.js.map +1 -1
  6. package/dist/AvatarStack/AvatarStack.js +65 -25
  7. package/dist/AvatarStack/AvatarStack.js.map +1 -1
  8. package/dist/AvatarStack/AvatarStack.styles.js +8 -8
  9. package/dist/AvatarStack/AvatarStack.styles.js.map +1 -1
  10. package/dist/AvatarStack/useAvatarPopover.d.ts +14 -0
  11. package/dist/AvatarStack/useAvatarPopover.js +57 -0
  12. package/dist/AvatarStack/useAvatarPopover.js.map +1 -0
  13. package/dist/AvatarStack/useAvatarPopover.types.d.ts +4 -0
  14. package/dist/AvatarStack/useAvatarPopover.types.js +2 -0
  15. package/dist/AvatarStack/useAvatarPopover.types.js.map +1 -0
  16. package/dist/Badge/Badge.styles.js +2 -2
  17. package/dist/BadgePill/BadgePill.styles.js +4 -4
  18. package/dist/Banner/Banner.d.ts +2 -1
  19. package/dist/Banner/Banner.js +53 -34
  20. package/dist/Banner/Banner.js.map +1 -1
  21. package/dist/Banner/Banner.styles.js +10 -10
  22. package/dist/Banner/Banner.types.d.ts +6 -0
  23. package/dist/Banner/Banner.types.js.map +1 -1
  24. package/dist/Banner/index.d.ts +1 -1
  25. package/dist/Banner/index.js.map +1 -1
  26. package/dist/Box/Box.styles.js +1 -1
  27. package/dist/Breadcrumbs/Breadcrumbs.styles.js +4 -4
  28. package/dist/Button/Button.styles.js +5 -5
  29. package/dist/Calendar/Calendar.styles.js +9 -9
  30. package/dist/Card/Card.styles.js +1 -1
  31. package/dist/Checkbox/Checkbox.d.ts +0 -1
  32. package/dist/Checkbox/Checkbox.js +5 -6
  33. package/dist/Checkbox/Checkbox.js.map +1 -1
  34. package/dist/Checkbox/Checkbox.styles.js +6 -6
  35. package/dist/ContactItem/ContactItem.styles.js +5 -5
  36. package/dist/Content/Content.styles.js +2 -2
  37. package/dist/DateInput/DateInput.js +12 -2
  38. package/dist/DateInput/DateInput.js.map +1 -1
  39. package/dist/DateInput/DateInput.styles.js +6 -6
  40. package/dist/DateSelect/DateSelect.types.d.ts +1 -1
  41. package/dist/DateSelect/DateSelect.types.js.map +1 -1
  42. package/dist/DetailPage/DetailPage.styles.js +7 -7
  43. package/dist/Dropdown/Dropdown.styles.js +3 -3
  44. package/dist/DropdownFlyout/DropdownFlyout.styles.js +4 -4
  45. package/dist/Dropzone/Dropzone.js +1 -1
  46. package/dist/Dropzone/Dropzone.styles.js +9 -9
  47. package/dist/EmptyState/EmptyState.styles.js +6 -6
  48. package/dist/Field/Field.styles.js +3 -3
  49. package/dist/FileList/FileList.js +3 -7
  50. package/dist/FileList/FileList.js.map +1 -1
  51. package/dist/FileList/FileList.styles.d.ts +0 -1
  52. package/dist/FileList/FileList.styles.js +3 -7
  53. package/dist/FileList/FileList.styles.js.map +1 -1
  54. package/dist/FileSelect/FileExplorer/FileExplorer.styles.js +9 -9
  55. package/dist/FileSelect/FileExplorer/FileExplorerSidebar.js +3 -1
  56. package/dist/FileSelect/FileExplorer/FileExplorerSidebar.js.map +1 -1
  57. package/dist/FileSelect/FileExplorer/FileExplorerSidebar.styles.js +3 -3
  58. package/dist/FileSelect/FileSelect.styles.js +2 -2
  59. package/dist/FileSelect/FileSelectDropzone/FileSelectDropzone.styles.js +3 -3
  60. package/dist/FileSelect/FileTokenList/FileTokenList.styles.js +2 -2
  61. package/dist/FileSelect/GridSource/GridSource.styles.js +6 -6
  62. package/dist/FileSelect/LocalSource/LocalSource.styles.js +4 -4
  63. package/dist/FileSelect/SourceItem/SourceItem.js +10 -5
  64. package/dist/FileSelect/SourceItem/SourceItem.js.map +1 -1
  65. package/dist/FileSelect/SourceItem/SourceItem.styles.js +3 -3
  66. package/dist/FileSelect/ThumbnailList/ThumbnailList.styles.js +6 -6
  67. package/dist/FileSelect/TreeSource/TreeSource.styles.js +1 -1
  68. package/dist/FileToken/FileToken.styles.js +4 -4
  69. package/dist/FilterToken/FilterToken.styles.js +5 -5
  70. package/dist/FlexList/FlexList.styles.js +1 -1
  71. package/dist/Form/Form.js +74 -58
  72. package/dist/Form/Form.js.map +1 -1
  73. package/dist/Form/Form.styles.d.ts +0 -14
  74. package/dist/Form/Form.styles.js +14 -24
  75. package/dist/Form/Form.styles.js.map +1 -1
  76. package/dist/Form/Form.types.d.ts +22 -2
  77. package/dist/Form/Form.types.js.map +1 -1
  78. package/dist/Form/FormFieldTooltip.js +4 -11
  79. package/dist/Form/FormFieldTooltip.js.map +1 -1
  80. package/dist/Form/StyledFormikForm.styles.js +2 -2
  81. package/dist/Form/stories/util.js +1 -12
  82. package/dist/Form/stories/util.js.map +1 -1
  83. package/dist/GhostPlaceholder/GhostPlaceholder.styles.js +2 -2
  84. package/dist/Grid/Grid.styles.js +2 -2
  85. package/dist/GroupSelect/GroupSelect.js +5 -4
  86. package/dist/GroupSelect/GroupSelect.js.map +1 -1
  87. package/dist/GroupSelect/GroupSelect.styles.js +1 -1
  88. package/dist/GroupSelect/GroupSelect.types.d.ts +5 -5
  89. package/dist/GroupSelect/GroupSelect.types.js.map +1 -1
  90. package/dist/Input/Input.styles.js +1 -1
  91. package/dist/Link/Link.styles.js +1 -1
  92. package/dist/ListPage/ListPage.styles.js +8 -8
  93. package/dist/Loader/Loader.styles.js +2 -2
  94. package/dist/Menu/Menu.js +1 -5
  95. package/dist/Menu/Menu.js.map +1 -1
  96. package/dist/MenuImperative/MenuImperative.js +7 -10
  97. package/dist/MenuImperative/MenuImperative.js.map +1 -1
  98. package/dist/MenuImperative/MenuImperative.styles.d.ts +2 -3
  99. package/dist/MenuImperative/MenuImperative.styles.js +26 -25
  100. package/dist/MenuImperative/MenuImperative.styles.js.map +1 -1
  101. package/dist/MenuImperative/MenuImperative.types.d.ts +4 -0
  102. package/dist/MenuImperative/MenuImperative.types.js.map +1 -1
  103. package/dist/MenuImperative/sensors.js +16 -58
  104. package/dist/MenuImperative/sensors.js.map +1 -1
  105. package/dist/Modal/Modal.styles.js +13 -13
  106. package/dist/MultiSelect/MultiSelect.js +50 -28
  107. package/dist/MultiSelect/MultiSelect.js.map +1 -1
  108. package/dist/MultiSelect/MultiSelect.styles.d.ts +1 -0
  109. package/dist/MultiSelect/MultiSelect.styles.js +12 -8
  110. package/dist/MultiSelect/MultiSelect.styles.js.map +1 -1
  111. package/dist/MultiSelect/MultiSelect.types.d.ts +31 -1
  112. package/dist/MultiSelect/MultiSelect.types.js.map +1 -1
  113. package/dist/NextMenu/NextMenu.styles.js +3 -3
  114. package/dist/Notation/Notation.js +1 -1
  115. package/dist/NumberInput/NumberInput.styles.js +7 -7
  116. package/dist/Overlay/OverlayArrow.styles.js +1 -1
  117. package/dist/OverlayTrigger/OverlayTrigger.js +4 -2
  118. package/dist/OverlayTrigger/OverlayTrigger.js.map +1 -1
  119. package/dist/OverlayTrigger/OverlayTrigger.types.d.ts +8 -0
  120. package/dist/OverlayTrigger/OverlayTrigger.types.js.map +1 -1
  121. package/dist/OverlayTrigger/a11yPresets.js +5 -3
  122. package/dist/OverlayTrigger/a11yPresets.js.map +1 -1
  123. package/dist/PageLayout/PageLayout.js +31 -12
  124. package/dist/PageLayout/PageLayout.js.map +1 -1
  125. package/dist/PageLayout/PageLayout.styles.d.ts +1 -0
  126. package/dist/PageLayout/PageLayout.styles.js +17 -17
  127. package/dist/PageLayout/PageLayout.styles.js.map +1 -1
  128. package/dist/PageLayout/PageLayout.types.d.ts +10 -0
  129. package/dist/PageLayout/PageLayout.types.js.map +1 -1
  130. package/dist/PageTemplate/PageFooterTemplate/PageFooterTemplate.styles.js +1 -1
  131. package/dist/PageTemplate/PageHeaderTemplate/PageHeaderTemplate.styles.js +3 -3
  132. package/dist/PageTemplate/PagePaneTemplate/PagePaneTemplate.styles.js +2 -2
  133. package/dist/PageTemplate/PageTemplate/PageTemplate.styles.js +3 -3
  134. package/dist/Pagination/Pagination.styles.js +5 -5
  135. package/dist/Panel/Panel.styles.js +11 -11
  136. package/dist/Pill/Pill.styles.js +3 -3
  137. package/dist/PillSelect/PillSelect.js +4 -3
  138. package/dist/PillSelect/PillSelect.js.map +1 -1
  139. package/dist/PillSelect/PillSelect.styles.js +4 -4
  140. package/dist/Popover/Popover.js +2 -1
  141. package/dist/Popover/Popover.js.map +1 -1
  142. package/dist/Popover/Popover.styles.js +2 -2
  143. package/dist/Portal/Portal.styles.js +1 -1
  144. package/dist/ProgressBar/ProgressBar.styles.js +2 -2
  145. package/dist/RadioButton/RadioButton.styles.js +3 -3
  146. package/dist/Required/Required.styles.js +3 -3
  147. package/dist/Search/Search.styles.js +5 -5
  148. package/dist/Section/Section.styles.js +9 -9
  149. package/dist/Section/Section.styles.js.map +1 -1
  150. package/dist/SegmentedController/SegmentedController.js +1 -2
  151. package/dist/SegmentedController/SegmentedController.js.map +1 -1
  152. package/dist/SegmentedController/SegmentedController.styles.js +4 -4
  153. package/dist/Select/Select.d.ts +3 -4
  154. package/dist/Select/Select.js +37 -15
  155. package/dist/Select/Select.js.map +1 -1
  156. package/dist/Select/Select.styles.js +9 -9
  157. package/dist/Select/Select.styles.js.map +1 -1
  158. package/dist/Select/Select.types.d.ts +20 -0
  159. package/dist/Select/Select.types.js.map +1 -1
  160. package/dist/Select/index.d.ts +1 -1
  161. package/dist/Select/index.js.map +1 -1
  162. package/dist/Semantic/Semantic.styles.js +9 -9
  163. package/dist/Slider/Slider.styles.js +5 -5
  164. package/dist/Spinner/Spinner.js +21 -6
  165. package/dist/Spinner/Spinner.js.map +1 -1
  166. package/dist/Spinner/Spinner.styles.js +7 -7
  167. package/dist/SplitViewCard/SplitViewCard.js +13 -0
  168. package/dist/SplitViewCard/SplitViewCard.js.map +1 -1
  169. package/dist/SplitViewCard/SplitViewCard.styles.js +8 -8
  170. package/dist/SuperSelect/SuperSelect.components.js +6 -15
  171. package/dist/SuperSelect/SuperSelect.components.js.map +1 -1
  172. package/dist/SuperSelect/SuperSelect.js +1 -1
  173. package/dist/SuperSelect/SuperSelect.js.map +1 -1
  174. package/dist/SuperSelect/SuperSelect.presets.styles.js +1 -1
  175. package/dist/SuperSelect/SuperSelect.styles.js +38 -38
  176. package/dist/SuperSelect/SuperSelect.types.d.ts +0 -3
  177. package/dist/SuperSelect/SuperSelect.types.js.map +1 -1
  178. package/dist/SuperSelect/useSuperSelect.d.ts +1 -1
  179. package/dist/SuperSelect/useSuperSelect.js +19 -52
  180. package/dist/SuperSelect/useSuperSelect.js.map +1 -1
  181. package/dist/Switch/Switch.styles.js +4 -4
  182. package/dist/Table/Table.styles.d.ts +1 -1
  183. package/dist/Table/Table.styles.js +28 -28
  184. package/dist/TableShelf/TableShelf.styles.js +5 -5
  185. package/dist/Tabs/Tabs.styles.js +15 -15
  186. package/dist/Tearsheet/Tearsheet.styles.js +17 -28
  187. package/dist/Tearsheet/Tearsheet.styles.js.map +1 -1
  188. package/dist/Tearsheet/storybook/PageLayoutDemo.js +11 -2
  189. package/dist/Tearsheet/storybook/PageLayoutDemo.js.map +1 -1
  190. package/dist/TextArea/TextArea.styles.js +1 -1
  191. package/dist/TextEditorOutput/TextEditorOutput.styles.js +1 -1
  192. package/dist/Thumbnail/Thumbnail.styles.js +17 -17
  193. package/dist/ThumbnailGrid/ThumbnailGrid.styles.js +7 -7
  194. package/dist/TieredSelect/TieredSelect.styles.js +9 -9
  195. package/dist/Tile/Tile.styles.js +8 -8
  196. package/dist/Title/Title.styles.js +7 -7
  197. package/dist/Toast/Toast.styles.js +3 -3
  198. package/dist/ToggleButton/ToggleButton.styles.js +1 -1
  199. package/dist/Token/Token.styles.js +3 -3
  200. package/dist/ToolHeader/ToolHeader.styles.js +6 -6
  201. package/dist/ToolLandingPage/ToolLandingPage.styles.js +3 -3
  202. package/dist/Tooltip/Tooltip.d.ts +4 -2
  203. package/dist/Tooltip/Tooltip.js +30 -5
  204. package/dist/Tooltip/Tooltip.js.map +1 -1
  205. package/dist/Tooltip/Tooltip.styles.d.ts +1 -0
  206. package/dist/Tooltip/Tooltip.styles.js +12 -4
  207. package/dist/Tooltip/Tooltip.styles.js.map +1 -1
  208. package/dist/Tooltip/Tooltip.types.d.ts +8 -0
  209. package/dist/Tooltip/Tooltip.types.js.map +1 -1
  210. package/dist/Tree/Tree.js +1 -1
  211. package/dist/Tree/Tree.styles.js +10 -10
  212. package/dist/Typeahead/Typeahead.styles.js +3 -3
  213. package/dist/Typography/Typography.styles.js +1 -1
  214. package/dist/Typography/Typography.table.story.js +2 -2
  215. package/dist/_hooks/I18n.d.ts +65 -67
  216. package/dist/_hooks/IntersectionObserver/createIntersectionObserver.d.ts +0 -1
  217. package/dist/_hooks/IntersectionObserver/createIntersectionObserver.js +0 -1
  218. package/dist/_hooks/IntersectionObserver/createIntersectionObserver.js.map +1 -1
  219. package/dist/_locales/de-DE.json +3 -1
  220. package/dist/_locales/en-AU.json +3 -1
  221. package/dist/_locales/en-CA.json +3 -1
  222. package/dist/_locales/en-GB.json +3 -1
  223. package/dist/_locales/en.json +5 -2
  224. package/dist/_locales/es-ES.json +3 -1
  225. package/dist/_locales/es.json +3 -1
  226. package/dist/_locales/fr-CA.json +3 -1
  227. package/dist/_locales/fr-FR.json +3 -1
  228. package/dist/_locales/is-IS.json +3 -1
  229. package/dist/_locales/it-IT.json +3 -1
  230. package/dist/_locales/ja-JP.json +3 -1
  231. package/dist/_locales/pl-PL.json +3 -1
  232. package/dist/_locales/pseudo.json +5 -2
  233. package/dist/_locales/pt-BR.json +3 -1
  234. package/dist/_locales/pt-PT.json +5 -3
  235. package/dist/_locales/th-TH.json +3 -1
  236. package/dist/_locales/zh-SG.json +3 -1
  237. package/dist/_locales/zh-TW.json +3 -1
  238. package/dist/_storyHelpers_/components/Deprecation.styles.js +1 -1
  239. package/dist/_storyHelpers_/components/StoryGrid.js +3 -3
  240. package/dist/_styles/mixins.d.ts +13 -1
  241. package/dist/_styles/mixins.js +15 -1
  242. package/dist/_styles/mixins.js.map +1 -1
  243. package/dist/_typedoc/AnchorNavigation/AnchorNavigation.types.json +3 -3
  244. package/dist/_typedoc/Avatar/Avatar.types.json +20 -20
  245. package/dist/_typedoc/AvatarStack/AvatarStack.types.json +24 -24
  246. package/dist/_typedoc/Badge/Badge.types.json +6 -6
  247. package/dist/_typedoc/Banner/Banner.types.json +39 -13
  248. package/dist/_typedoc/Box/Box.types.json +68 -68
  249. package/dist/_typedoc/Breadcrumbs/Breadcrumbs.types.json +10 -10
  250. package/dist/_typedoc/Button/Button.types.json +13 -13
  251. package/dist/_typedoc/Calendar/Calendar.types.json +80 -80
  252. package/dist/_typedoc/Card/Card.types.json +6 -6
  253. package/dist/_typedoc/Checkbox/Checkbox.types.json +8 -8
  254. package/dist/_typedoc/ContactItem/ContactItem.types.json +9 -9
  255. package/dist/_typedoc/DateInput/DateInput.types.json +35 -35
  256. package/dist/_typedoc/DateSelect/DateSelect.types.json +13 -13
  257. package/dist/_typedoc/DetailPage/DetailPage.types.json +5 -5
  258. package/dist/_typedoc/Dropdown/Dropdown.types.json +37 -37
  259. package/dist/_typedoc/DropdownFlyout/DropdownFlyout.types.json +31 -31
  260. package/dist/_typedoc/Dropzone/Dropzone.types.json +44 -44
  261. package/dist/_typedoc/EmptyState/EmptyState.types.json +16 -16
  262. package/dist/_typedoc/FileList/FileList.types.json +9 -9
  263. package/dist/_typedoc/FileSelect/FileSelect.types.json +27 -27
  264. package/dist/_typedoc/FileSelect/GridSource/GridSource.types.json +20 -20
  265. package/dist/_typedoc/FileSelect/LocalSource/LocalSource.types.json +14 -14
  266. package/dist/_typedoc/FileSelect/TreeSource/TreeSource.types.json +9 -9
  267. package/dist/_typedoc/Flex/Flex.types.json +27 -27
  268. package/dist/_typedoc/FlexList/FlexList.types.json +30 -30
  269. package/dist/_typedoc/Form/Form.types.json +862 -762
  270. package/dist/_typedoc/GhostPlaceholder/GhostPlaceholder.types.json +12 -12
  271. package/dist/_typedoc/Grid/Grid.types.json +8 -8
  272. package/dist/_typedoc/GroupSelect/GroupSelect.types.json +75 -55
  273. package/dist/_typedoc/Input/Input.types.json +2 -2
  274. package/dist/_typedoc/Link/Link.types.json +1 -1
  275. package/dist/_typedoc/ListPage/ListPage.types.json +13 -13
  276. package/dist/_typedoc/Menu/Menu.types.json +62 -62
  277. package/dist/_typedoc/MenuImperative/MenuImperative.types.json +77 -77
  278. package/dist/_typedoc/Modal/Modal.types.json +46 -46
  279. package/dist/_typedoc/MultiSelect/MultiSelect.types.json +52 -32
  280. package/dist/_typedoc/NextTile/NextTile.types.json +32 -32
  281. package/dist/_typedoc/Notation/Notation.types.json +4 -4
  282. package/dist/_typedoc/NumberInput/NumberInput.types.json +48 -48
  283. package/dist/_typedoc/OverlayTrigger/OverlayTrigger.types.json +42 -32
  284. package/dist/_typedoc/PageLayout/PageLayout.types.json +46 -26
  285. package/dist/_typedoc/Pagination/Pagination.types.json +7 -7
  286. package/dist/_typedoc/Panel/Panel.types.json +30 -30
  287. package/dist/_typedoc/Pill/Pill.types.json +2 -2
  288. package/dist/_typedoc/PillSelect/PillSelect.types.json +49 -49
  289. package/dist/_typedoc/Popover/Popover.types.json +15 -15
  290. package/dist/_typedoc/ProgressBar/ProgressBar.types.json +7 -7
  291. package/dist/_typedoc/RadioButton/RadioButton.types.json +6 -6
  292. package/dist/_typedoc/Required/Required.types.json +5 -5
  293. package/dist/_typedoc/Search/Search.types.json +18 -18
  294. package/dist/_typedoc/Section/Section.types.json +15 -15
  295. package/dist/_typedoc/SegmentedController/SegmentedController.types.json +21 -21
  296. package/dist/_typedoc/Select/Select.types.json +141 -60
  297. package/dist/_typedoc/SettingsPage/SettingsPage.types.json +10 -10
  298. package/dist/_typedoc/Slider/Slider.types.json +6 -6
  299. package/dist/_typedoc/Spinner/Spinner.types.json +9 -9
  300. package/dist/_typedoc/SplitViewCard/SplitViewCard.types.json +14 -14
  301. package/dist/_typedoc/Table/Table.types.json +102 -102
  302. package/dist/_typedoc/Tabs/Tabs.types.json +20 -20
  303. package/dist/_typedoc/Tearsheet/Tearsheet.types.json +17 -17
  304. package/dist/_typedoc/TextArea/TextArea.types.json +3 -3
  305. package/dist/_typedoc/TextEditor/TextEditor.types.json +11 -11
  306. package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +4 -4
  307. package/dist/_typedoc/Thumbnail/Thumbnail.types.json +19 -19
  308. package/dist/_typedoc/TieredDropdown/TieredDropdown.types.json +43 -43
  309. package/dist/_typedoc/TieredSelect/TieredSelect.types.json +29 -29
  310. package/dist/_typedoc/Tile/Tile.types.json +8 -8
  311. package/dist/_typedoc/Title/Title.types.json +1 -1
  312. package/dist/_typedoc/Toast/Toast.types.json +4 -4
  313. package/dist/_typedoc/ToggleButton/ToggleButton.types.json +4 -4
  314. package/dist/_typedoc/Token/Token.types.json +7 -7
  315. package/dist/_typedoc/ToolHeader/ToolHeader.types.json +10 -10
  316. package/dist/_typedoc/ToolLandingPage/ToolLandingPage.types.json +8 -8
  317. package/dist/_typedoc/Tooltip/Tooltip.types.json +25 -14
  318. package/dist/_typedoc/Tree/Tree.types.json +88 -88
  319. package/dist/_typedoc/Typeahead/Typeahead.types.json +2 -2
  320. package/dist/_typedoc/Typography/Typography.types.json +9 -9
  321. package/dist/_typedoc/_utils/types.json +3 -3
  322. package/dist/_utils/scrollIntoView.js +21 -7
  323. package/dist/_utils/scrollIntoView.js.map +1 -1
  324. package/package.json +9 -8
  325. package/dist/Checkbox/CheckboxTooltip.d.ts +0 -4
  326. package/dist/Checkbox/CheckboxTooltip.js +0 -26
  327. package/dist/Checkbox/CheckboxTooltip.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"OverlayTrigger.js","names":["arrow","floatingArrow","flip","floatingFlip","limitShift","offset","floatingOffset","shift","floatingShift","size","floatingSize","FocusScope","useId","React","Arrow","arrowSize","useOverlay","Portal","useClickOutside","DelayedToggleContext","useDelayedToggle","useDelayedToggleContext","Trigger","useTrigger","useVisibility","mergeRefs","useOverlayTriggerA11y","ClickOutside","_ref","container","onClickOutside","refs","createElement","Fragment","OverlayTrigger","forwardRef","_ref2","ref","_ref2$afterHide","afterHide","_ref2$afterShow","afterShow","ariaDescribedby","ariaDetails","ariaLabel","ariaLabelledby","autoFocus","_ref2$beforeHide","beforeHide","_ref2$beforeShow","beforeShow","_ref2$canFlip","canFlip","children","_ref2$clickOutsideIgn","clickOutsideIgnoreRefs","containFocus","_ref2$hideDelay","hideDelay","hideKeys_","hideKeys","_ref2$initialIsVisibl","initialIsVisible","overlay","_ref2$padding","padding","_ref2$placement","placement","_ref2$restoreFocusOnH","restoreFocusOnHide","_ref2$showDelay","showDelay","_ref2$showKeys","showKeys","_ref2$shrinkOverlay","shrinkOverlay","trackAriaExpanded","_ref2$trigger","trigger","_ref2$arrow","overlayApiRef","overlayRef","role","_ref2$passA11yPropsTo","passA11yPropsToOverlay","isDialogRole","includes","console","warn","concat","target","triggerElRef","useRef","overlayElRef","_React$useState","useState","_React$useState2","_slicedToArray","referenceElement","setReferenceElement","clickedOutsideRef","visibility","useImperativeHandle","show","hide","triggers","useMemo","Array","isArray","useEffect","indexOf","isVisible","current","focus","delayedToggle","beforeDisable","beforeEnable","disableDelay","enableDelay","isEnabled","onDisable","onEnable","triggerApi","enable","disable","enableKeys","disableKeys","triggerRef","hasHoverTrigger","onKeyDown","e","key","preventDefault","stopPropagation","document","addEventListener","removeEventListener","triggerElement","overlayId","_useOverlayTriggerA","canPropOverlayUp","isValidElement","id","isOpen","wrapperProps","overlayProps","portalProps","triggerProps","focusScopeProps","labelProps","hasAriaExpanded","wrappedTriggerElement","cloneElement","_objectSpread","open","Provider","value","event","_toConsumableArray","_extends","TriggerOverlay","contain","restoreFocus","overlayCloneProps","CloseOnFocus","_ref3","style","height","position","top","width","onFocus","opacity","useOverlayTriggerContext","_useDelayedToggleCont","toggle","_ref4","arrowRef","arrowPadding","middleware","mainAxis","limiter","apply","_ref5","elements","Object","assign","floating","minWidth","reference","getBoundingClientRect","element","filter","_useOverlay","isPositioned","overlayStyle","referenceRefCallback","referenceRef","middlewareData","currentPlacement","mergedRefs","shownStyles","left"],"sources":["../../src/OverlayTrigger/OverlayTrigger.tsx"],"sourcesContent":["import {\n arrow as floatingArrow,\n flip as floatingFlip,\n limitShift,\n offset as floatingOffset,\n shift as floatingShift,\n size as floatingSize,\n} from '@floating-ui/react-dom'\nimport { FocusScope } from '@react-aria/focus'\nimport { useId } from '@react-aria/utils'\nimport React from 'react'\nimport { Arrow } from '../Overlay/OverlayArrow'\nimport { arrowSize } from '../Overlay/OverlayArrow.styles'\nimport type { OverlayMiddleware } from '../Overlay/useOverlay'\nimport { useOverlay } from '../Overlay/useOverlay'\nimport { Portal } from '../Portal'\nimport type { ClickOutsideConfig } from '../_hooks/ClickOutside'\nimport { useClickOutside } from '../_hooks/ClickOutside'\nimport {\n DelayedToggleContext,\n useDelayedToggle,\n useDelayedToggleContext,\n} from '../_hooks/DelayedToggle'\nimport type { TriggerApi } from '../_hooks/Trigger'\nimport { Trigger, useTrigger } from '../_hooks/Trigger'\nimport { useVisibility } from '../_hooks/Visibility'\nimport { mergeRefs } from '../_utils/mergeRefs'\nimport type { Placement } from '../_utils/placement'\nimport type { ReactElementWithRef } from '../_utils/types'\nimport { useOverlayTriggerA11y } from './a11yPresets'\nimport type {\n DeprecatedOverlayTriggerRef,\n OverlayTriggerProps,\n} from './OverlayTrigger.types'\n\nconst ClickOutside = ({\n container,\n onClickOutside,\n refs,\n}: ClickOutsideConfig) => {\n useClickOutside({\n onClickOutside,\n refs,\n container,\n })\n\n return <></>\n}\n\n/**\n\n @since 10.19.0\n\n @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-overlaytrigger--demo)\n\n */\nexport const OverlayTrigger = React.forwardRef<\n DeprecatedOverlayTriggerRef,\n OverlayTriggerProps\n>(function OverlayTrigger(\n {\n afterHide = () => {},\n afterShow = () => {},\n ['aria-describedby']: ariaDescribedby,\n ['aria-details']: ariaDetails,\n ['aria-label']: ariaLabel,\n ['aria-labelledby']: ariaLabelledby,\n autoFocus,\n beforeHide = () => true,\n beforeShow = () => true,\n canFlip = true,\n children,\n clickOutsideIgnoreRefs = [],\n containFocus,\n container,\n hideDelay = 100,\n hideKeys: hideKeys_,\n initialIsVisible = false,\n overlay,\n padding = 2,\n placement = 'top',\n restoreFocusOnHide = true, // TODO: change default to be false, but that is a breaking change\n showDelay = 0,\n showKeys = ['ArrowDown', 'Down'],\n shrinkOverlay = false,\n trackAriaExpanded,\n trigger = 'click',\n arrow = false,\n overlayRef: overlayApiRef,\n role,\n passA11yPropsToOverlay = false,\n },\n ref\n) {\n const isDialogRole = role === 'dialog'\n\n if (isDialogRole && (trigger === 'hover' || trigger?.includes('hover'))) {\n console.warn(\n `@procore/core-react: OverlayTigger has role ${role} and a hover trigger, this may cause weird focus management and is unrecommended. Review autoFocus prop.`\n )\n }\n\n const hideKeys = hideKeys_ ?? {\n // Note by default OverlayTrigger closes on tab. Dialog role changes the default.\n overlay:\n containFocus ?? isDialogRole\n ? ['Escape', 'Esc']\n : ['Escape', 'Esc', 'Tab'],\n target: ['Escape', 'Esc'],\n }\n\n const triggerElRef = React.useRef<HTMLElement>(null)\n const overlayElRef = React.useRef<HTMLElement>(null)\n const [referenceElement, setReferenceElement] =\n React.useState<HTMLElement | null>(null)\n const clickedOutsideRef = React.useRef(true)\n\n const visibility = useVisibility({\n afterHide,\n afterShow,\n initialIsVisible,\n })\n\n React.useImperativeHandle(overlayApiRef, () => ({\n show: visibility.show,\n hide: visibility.hide,\n }))\n\n const triggers = React.useMemo(\n () => (Array.isArray(trigger) ? trigger : [trigger]),\n [trigger]\n )\n\n React.useEffect(() => {\n if (triggers.indexOf('none') >= 0 && visibility.isVisible) {\n visibility.hide()\n }\n if (triggers.indexOf('always') >= 0 && !visibility.isVisible) {\n visibility.show()\n }\n }, [triggers, visibility.isVisible])\n\n // TODO delete in a separate branch for testing and rely only on FocusScope\n React.useEffect(() => {\n if (\n [true, 'core-react'].includes(restoreFocusOnHide) &&\n !visibility.isVisible &&\n !clickedOutsideRef.current\n ) {\n triggerElRef.current && triggerElRef.current.focus()\n }\n\n clickedOutsideRef.current = false\n }, [restoreFocusOnHide, triggerElRef, visibility.isVisible])\n\n const delayedToggle = useDelayedToggle({\n beforeDisable: beforeHide,\n beforeEnable: beforeShow,\n disableDelay: hideDelay,\n enableDelay: showDelay,\n isEnabled: visibility.isVisible,\n onDisable: visibility.hide,\n onEnable: visibility.show,\n })\n\n const triggerApi = useTrigger({\n isEnabled: visibility.isVisible,\n enable: delayedToggle.enable,\n disable: delayedToggle.disable,\n enableKeys: showKeys,\n disableKeys: hideKeys.target,\n trigger,\n triggerRef: triggerElRef,\n })\n\n // Enable Escape key dismissal for hover-triggered overlays.\n React.useEffect(() => {\n const hasHoverTrigger = triggers.includes('hover')\n if (!visibility.isVisible || !hasHoverTrigger) return\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Escape' && e.key !== 'Esc') return\n\n delayedToggle.disable(e)\n e.preventDefault()\n e.stopPropagation()\n }\n\n document.addEventListener('keydown', onKeyDown, true)\n return () => {\n document.removeEventListener('keydown', onKeyDown, true)\n }\n }, [triggers, visibility.isVisible, delayedToggle])\n\n const triggerElement =\n typeof children === 'function'\n ? (children as (props: TriggerApi) => ReactElementWithRef)(triggerApi)\n : (children as ReactElementWithRef)\n\n const overlayId = useId()\n\n const {\n wrapperProps,\n overlayProps,\n portalProps,\n triggerProps,\n focusScopeProps,\n // Does not use. User needs to wire up when using dialog role!\n labelProps,\n } = useOverlayTriggerA11y({\n canPropOverlayUp: React.isValidElement(overlay) && passA11yPropsToOverlay,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n id: overlayId,\n isOpen: visibility.isVisible,\n role,\n })\n\n const hasAriaExpanded = trackAriaExpanded\n ? { 'aria-expanded': triggerApi.isVisible }\n : {}\n\n const wrappedTriggerElement = React.cloneElement(triggerElement, {\n ...hasAriaExpanded,\n open: triggerApi.isVisible,\n ref: triggerElement.ref\n ? mergeRefs(triggerElement.ref, ref, triggerElRef, setReferenceElement)\n : mergeRefs(ref, triggerElRef, setReferenceElement),\n ...triggerProps,\n })\n\n return (\n <DelayedToggleContext.Provider value={delayedToggle}>\n {wrappedTriggerElement}\n {visibility.isVisible && (\n <>\n <ClickOutside\n {...{\n container: container,\n onClickOutside: (event) => {\n clickedOutsideRef.current = true\n delayedToggle.disable(event)\n },\n refs: [overlayElRef, triggerElRef, ...clickOutsideIgnoreRefs],\n }}\n />\n <Portal container={container} {...portalProps}>\n <Trigger\n {...{\n isEnabled: visibility.isVisible,\n enable: delayedToggle.enable,\n disable: delayedToggle.disable,\n disableKeys: hideKeys.overlay,\n trigger: trigger === 'click' ? 'none' : trigger,\n triggerRef: overlayElRef,\n }}\n >\n <TriggerOverlay\n autoFocus={autoFocus ?? focusScopeProps.autoFocus}\n containFocus={containFocus ?? focusScopeProps.contain}\n restoreFocus={[true, 'react-aria-focus-scope'].includes(\n restoreFocusOnHide\n )}\n ref={overlayElRef}\n referenceElement={referenceElement}\n overlay={overlay}\n shrinkOverlay={shrinkOverlay}\n placement={placement}\n padding={padding}\n canFlip={canFlip}\n arrow={arrow}\n wrapperProps={wrapperProps}\n overlayCloneProps={overlayProps}\n />\n </Trigger>\n </Portal>\n </>\n )}\n </DelayedToggleContext.Provider>\n )\n})\n\nexport function CloseOnFocus({ hide }: { hide: (event: any) => any }) {\n return (\n // in IE, the hidden input's cursor appears right under the menu\n // this positions it arbitrarily away where it won't be noticed\n <div\n style={{\n height: 0,\n position: 'absolute',\n top: 1000,\n width: 0,\n }}\n >\n <input onFocus={hide} style={{ opacity: 0 }} />\n </div>\n )\n}\n\nexport function useOverlayTriggerContext() {\n const { enable: show, disable: hide, toggle } = useDelayedToggleContext()\n\n return {\n hide,\n show,\n toggle,\n }\n}\n\ninterface TriggerOverlayProps {\n containFocus?: boolean\n autoFocus?: boolean\n restoreFocus?: boolean\n placement: Placement\n canFlip?: boolean\n arrow?: boolean\n padding: number\n shrinkOverlay: boolean\n overlay: React.ReactNode\n overlayCloneProps: any\n wrapperProps: Record<string, unknown>\n referenceElement: HTMLElement | null\n}\n\nexport const TriggerOverlay = React.forwardRef<\n HTMLElement,\n TriggerOverlayProps\n>(function (\n {\n autoFocus,\n containFocus,\n restoreFocus,\n placement,\n canFlip,\n arrow,\n padding,\n shrinkOverlay,\n overlay,\n referenceElement,\n wrapperProps,\n overlayCloneProps,\n },\n ref\n) {\n const arrowRef = React.useRef<HTMLDivElement>(null)\n\n const arrowPadding = arrowSize / 2 + 1\n const middleware = [\n floatingOffset({ mainAxis: arrow ? padding + arrowPadding : padding }),\n canFlip ? floatingFlip() : null,\n floatingShift({ limiter: limitShift() }),\n !shrinkOverlay\n ? floatingSize({\n apply({ elements }) {\n Object.assign(elements.floating.style, {\n minWidth: `${elements.reference.getBoundingClientRect().width}px`,\n })\n },\n })\n : null,\n floatingArrow({\n element: arrowRef,\n padding: 6,\n }),\n ].filter((middleware) => middleware !== null) as OverlayMiddleware[]\n\n const {\n isPositioned,\n overlayStyle,\n referenceRef: referenceRefCallback,\n overlayRef,\n middlewareData,\n placement: currentPlacement,\n } = useOverlay({\n middleware,\n placement,\n })\n\n React.useEffect(() => {\n referenceRefCallback(referenceElement)\n }, [referenceElement, referenceRefCallback])\n\n const mergedRefs = mergeRefs(ref, overlayRef)\n\n // TODO could just move clone and clone props to parent\n if (!React.isValidElement(overlay) && overlayCloneProps) {\n console.warn(\n 'PLEASE REPORT ISSUE @procore/core-react: OverlayTrigger TriggerOverlay is not a valid React element but wants to clone \"overlay\" with props. Cannot pass props to the element.'\n )\n }\n\n const shownStyles: React.CSSProperties = {\n ...overlayStyle,\n left: isPositioned ? overlayStyle.left : '-99999px',\n top: isPositioned ? overlayStyle.top : '-99999px',\n }\n\n return (\n <FocusScope\n autoFocus={autoFocus}\n contain={containFocus}\n restoreFocus={restoreFocus}\n >\n <div\n data-qa=\"core-overlay-trigger-overlay-wrapper\"\n ref={mergedRefs}\n style={shownStyles}\n {...wrapperProps}\n >\n {React.isValidElement(overlay)\n ? React.cloneElement(overlay, overlayCloneProps)\n : overlay}\n {arrow && (\n <Arrow\n ref={arrowRef}\n arrow={middlewareData.arrow}\n placement={currentPlacement}\n />\n )}\n </div>\n </FocusScope>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SACEA,KAAK,IAAIC,aAAa,EACtBC,IAAI,IAAIC,YAAY,EACpBC,UAAU,EACVC,MAAM,IAAIC,cAAc,EACxBC,KAAK,IAAIC,aAAa,EACtBC,IAAI,IAAIC,YAAY,QACf,wBAAwB;AAC/B,SAASC,UAAU,QAAQ,mBAAmB;AAC9C,SAASC,KAAK,QAAQ,mBAAmB;AACzC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,yBAAyB;AAC/C,SAASC,SAAS,QAAQ,gCAAgC;AAE1D,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,MAAM,QAAQ,WAAW;AAElC,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SACEC,oBAAoB,EACpBC,gBAAgB,EAChBC,uBAAuB,QAClB,yBAAyB;AAEhC,SAASC,OAAO,EAAEC,UAAU,QAAQ,mBAAmB;AACvD,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,SAAS,QAAQ,qBAAqB;AAG/C,SAASC,qBAAqB,QAAQ,eAAe;AAMrD,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAIQ;EAAA,IAHxBC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,IAAI,GAAAH,IAAA,CAAJG,IAAI;EAEJb,eAAe,CAAC;IACdY,cAAc,EAAdA,cAAc;IACdC,IAAI,EAAJA,IAAI;IACJF,SAAS,EAATA;EACF,CAAC,CAAC;EA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,KAAK;IACJuB,GAAG,EAAE4I,QAAS;IACdjL,KAAK,EAAEsM,cAAc,CAACtM,KAAM;IAC5BmE,SAAS,EAAEoI;EAAiB,CAC7B,CAEA,CACK,CAAC;AAEjB,CAAC,CAAC"}
1
+ {"version":3,"file":"OverlayTrigger.js","names":["arrow","floatingArrow","flip","floatingFlip","limitShift","offset","floatingOffset","shift","floatingShift","size","floatingSize","FocusScope","useId","React","Arrow","arrowSize","useOverlay","Portal","useClickOutside","DelayedToggleContext","useDelayedToggle","useDelayedToggleContext","Trigger","useTrigger","useVisibility","mergeRefs","useOverlayTriggerA11y","ClickOutside","_ref","container","onClickOutside","refs","createElement","Fragment","OverlayTrigger","forwardRef","_ref2","ref","_ref2$afterHide","afterHide","_ref2$afterShow","afterShow","ariaDescribedby","ariaDetails","ariaLabel","ariaLabelledby","autoFocus","_ref2$beforeHide","beforeHide","_ref2$beforeShow","beforeShow","_ref2$canFlip","canFlip","children","_ref2$clickOutsideIgn","clickOutsideIgnoreRefs","containFocus","_ref2$hideDelay","hideDelay","hideKeys_","hideKeys","_ref2$initialIsVisibl","initialIsVisible","overlay","_ref2$padding","padding","_ref2$placement","placement","_ref2$restoreFocusOnH","restoreFocusOnHide","_ref2$showDelay","showDelay","_ref2$showKeys","showKeys","_ref2$shrinkOverlay","shrinkOverlay","trackAriaExpanded","_ref2$trigger","trigger","_ref2$arrow","overlayApiRef","overlayRef","role","_ref2$passA11yPropsTo","passA11yPropsToOverlay","overlayIdProp","overlayId","isDialogRole","includes","console","warn","concat","target","triggerElRef","useRef","overlayElRef","_React$useState","useState","_React$useState2","_slicedToArray","referenceElement","setReferenceElement","clickedOutsideRef","visibility","useImperativeHandle","show","hide","triggers","useMemo","Array","isArray","useEffect","indexOf","isVisible","current","focus","delayedToggle","beforeDisable","beforeEnable","disableDelay","enableDelay","isEnabled","onDisable","onEnable","triggerApi","enable","disable","enableKeys","disableKeys","triggerRef","hasHoverTrigger","onKeyDown","e","key","preventDefault","stopPropagation","document","addEventListener","removeEventListener","triggerElement","defaultOverlayId","_useOverlayTriggerA","canPropOverlayUp","isValidElement","id","isOpen","wrapperProps","overlayProps","portalProps","triggerProps","focusScopeProps","labelProps","hasAriaExpanded","wrappedTriggerElement","cloneElement","_objectSpread","open","Provider","value","event","_toConsumableArray","_extends","TriggerOverlay","contain","restoreFocus","overlayCloneProps","CloseOnFocus","_ref3","style","height","position","top","width","onFocus","opacity","useOverlayTriggerContext","_useDelayedToggleCont","toggle","_ref4","arrowRef","arrowPadding","middleware","mainAxis","limiter","apply","_ref5","elements","Object","assign","floating","minWidth","reference","getBoundingClientRect","element","filter","_useOverlay","isPositioned","overlayStyle","referenceRefCallback","referenceRef","middlewareData","currentPlacement","mergedRefs","shownStyles","left"],"sources":["../../src/OverlayTrigger/OverlayTrigger.tsx"],"sourcesContent":["import {\n arrow as floatingArrow,\n flip as floatingFlip,\n limitShift,\n offset as floatingOffset,\n shift as floatingShift,\n size as floatingSize,\n} from '@floating-ui/react-dom'\nimport { FocusScope } from '@react-aria/focus'\nimport { useId } from '@react-aria/utils'\nimport React from 'react'\nimport { Arrow } from '../Overlay/OverlayArrow'\nimport { arrowSize } from '../Overlay/OverlayArrow.styles'\nimport type { OverlayMiddleware } from '../Overlay/useOverlay'\nimport { useOverlay } from '../Overlay/useOverlay'\nimport { Portal } from '../Portal'\nimport type { ClickOutsideConfig } from '../_hooks/ClickOutside'\nimport { useClickOutside } from '../_hooks/ClickOutside'\nimport {\n DelayedToggleContext,\n useDelayedToggle,\n useDelayedToggleContext,\n} from '../_hooks/DelayedToggle'\nimport type { TriggerApi } from '../_hooks/Trigger'\nimport { Trigger, useTrigger } from '../_hooks/Trigger'\nimport { useVisibility } from '../_hooks/Visibility'\nimport { mergeRefs } from '../_utils/mergeRefs'\nimport type { Placement } from '../_utils/placement'\nimport type { ReactElementWithRef } from '../_utils/types'\nimport { useOverlayTriggerA11y } from './a11yPresets'\nimport type {\n DeprecatedOverlayTriggerRef,\n OverlayTriggerProps,\n} from './OverlayTrigger.types'\n\nconst ClickOutside = ({\n container,\n onClickOutside,\n refs,\n}: ClickOutsideConfig) => {\n useClickOutside({\n onClickOutside,\n refs,\n container,\n })\n\n return <></>\n}\n\n/**\n\n @since 10.19.0\n\n @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-overlaytrigger--demo)\n\n */\nexport const OverlayTrigger = React.forwardRef<\n DeprecatedOverlayTriggerRef,\n OverlayTriggerProps\n>(function OverlayTrigger(\n {\n afterHide = () => {},\n afterShow = () => {},\n ['aria-describedby']: ariaDescribedby,\n ['aria-details']: ariaDetails,\n ['aria-label']: ariaLabel,\n ['aria-labelledby']: ariaLabelledby,\n autoFocus,\n beforeHide = () => true,\n beforeShow = () => true,\n canFlip = true,\n children,\n clickOutsideIgnoreRefs = [],\n containFocus,\n container,\n hideDelay = 100,\n hideKeys: hideKeys_,\n initialIsVisible = false,\n overlay,\n padding = 2,\n placement = 'top',\n restoreFocusOnHide = true, // TODO: change default to be false, but that is a breaking change\n showDelay = 0,\n showKeys = ['ArrowDown', 'Down'],\n shrinkOverlay = false,\n trackAriaExpanded,\n trigger = 'click',\n arrow = false,\n overlayRef: overlayApiRef,\n role,\n passA11yPropsToOverlay = false,\n overlayId: overlayIdProp,\n },\n ref\n) {\n const isDialogRole = role === 'dialog'\n\n if (isDialogRole && (trigger === 'hover' || trigger?.includes('hover'))) {\n console.warn(\n `@procore/core-react: OverlayTigger has role ${role} and a hover trigger, this may cause weird focus management and is unrecommended. Review autoFocus prop.`\n )\n }\n\n const hideKeys = hideKeys_ ?? {\n // Note by default OverlayTrigger closes on tab. Dialog role changes the default.\n overlay:\n containFocus ?? isDialogRole\n ? ['Escape', 'Esc']\n : ['Escape', 'Esc', 'Tab'],\n target: ['Escape', 'Esc'],\n }\n\n const triggerElRef = React.useRef<HTMLElement>(null)\n const overlayElRef = React.useRef<HTMLElement>(null)\n const [referenceElement, setReferenceElement] =\n React.useState<HTMLElement | null>(null)\n const clickedOutsideRef = React.useRef(true)\n\n const visibility = useVisibility({\n afterHide,\n afterShow,\n initialIsVisible,\n })\n\n React.useImperativeHandle(overlayApiRef, () => ({\n show: visibility.show,\n hide: visibility.hide,\n }))\n\n const triggers = React.useMemo(\n () => (Array.isArray(trigger) ? trigger : [trigger]),\n [trigger]\n )\n\n React.useEffect(() => {\n if (triggers.indexOf('none') >= 0 && visibility.isVisible) {\n visibility.hide()\n }\n if (triggers.indexOf('always') >= 0 && !visibility.isVisible) {\n visibility.show()\n }\n }, [triggers, visibility.isVisible])\n\n // TODO delete in a separate branch for testing and rely only on FocusScope\n React.useEffect(() => {\n if (\n [true, 'core-react'].includes(restoreFocusOnHide) &&\n !visibility.isVisible &&\n !clickedOutsideRef.current\n ) {\n triggerElRef.current && triggerElRef.current.focus()\n }\n\n clickedOutsideRef.current = false\n }, [restoreFocusOnHide, triggerElRef, visibility.isVisible])\n\n const delayedToggle = useDelayedToggle({\n beforeDisable: beforeHide,\n beforeEnable: beforeShow,\n disableDelay: hideDelay,\n enableDelay: showDelay,\n isEnabled: visibility.isVisible,\n onDisable: visibility.hide,\n onEnable: visibility.show,\n })\n\n const triggerApi = useTrigger({\n isEnabled: visibility.isVisible,\n enable: delayedToggle.enable,\n disable: delayedToggle.disable,\n enableKeys: showKeys,\n disableKeys: hideKeys.target,\n trigger,\n triggerRef: triggerElRef,\n })\n\n // Enable Escape key dismissal for hover-triggered overlays.\n React.useEffect(() => {\n const hasHoverTrigger = triggers.includes('hover')\n if (!visibility.isVisible || !hasHoverTrigger) return\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Escape' && e.key !== 'Esc') return\n\n delayedToggle.disable(e)\n e.preventDefault()\n e.stopPropagation()\n }\n\n document.addEventListener('keydown', onKeyDown, true)\n return () => {\n document.removeEventListener('keydown', onKeyDown, true)\n }\n }, [triggers, visibility.isVisible, delayedToggle])\n\n const triggerElement =\n typeof children === 'function'\n ? (children as (props: TriggerApi) => ReactElementWithRef)(triggerApi)\n : (children as ReactElementWithRef)\n\n const defaultOverlayId = useId()\n const overlayId = overlayIdProp ?? defaultOverlayId\n\n const {\n wrapperProps,\n overlayProps,\n portalProps,\n triggerProps,\n focusScopeProps,\n // Does not use. User needs to wire up when using dialog role!\n labelProps,\n } = useOverlayTriggerA11y({\n canPropOverlayUp: React.isValidElement(overlay) && passA11yPropsToOverlay,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n id: overlayId,\n isOpen: visibility.isVisible,\n role,\n })\n\n const hasAriaExpanded = trackAriaExpanded\n ? { 'aria-expanded': triggerApi.isVisible }\n : {}\n\n const wrappedTriggerElement = React.cloneElement(triggerElement, {\n ...hasAriaExpanded,\n open: triggerApi.isVisible,\n ref: triggerElement.ref\n ? mergeRefs(triggerElement.ref, ref, triggerElRef, setReferenceElement)\n : mergeRefs(ref, triggerElRef, setReferenceElement),\n ...triggerProps,\n })\n\n return (\n <DelayedToggleContext.Provider value={delayedToggle}>\n {wrappedTriggerElement}\n {visibility.isVisible && (\n <>\n <ClickOutside\n {...{\n container: container,\n onClickOutside: (event) => {\n clickedOutsideRef.current = true\n delayedToggle.disable(event)\n },\n refs: [overlayElRef, triggerElRef, ...clickOutsideIgnoreRefs],\n }}\n />\n <Portal container={container} {...portalProps}>\n <Trigger\n {...{\n isEnabled: visibility.isVisible,\n enable: delayedToggle.enable,\n disable: delayedToggle.disable,\n disableKeys: hideKeys.overlay,\n trigger: trigger === 'click' ? 'none' : trigger,\n triggerRef: overlayElRef,\n }}\n >\n <TriggerOverlay\n autoFocus={autoFocus ?? focusScopeProps.autoFocus}\n containFocus={containFocus ?? focusScopeProps.contain}\n restoreFocus={[true, 'react-aria-focus-scope'].includes(\n restoreFocusOnHide\n )}\n ref={overlayElRef}\n referenceElement={referenceElement}\n overlay={overlay}\n shrinkOverlay={shrinkOverlay}\n placement={placement}\n padding={padding}\n canFlip={canFlip}\n arrow={arrow}\n wrapperProps={wrapperProps}\n overlayCloneProps={overlayProps}\n />\n </Trigger>\n </Portal>\n </>\n )}\n </DelayedToggleContext.Provider>\n )\n})\n\nexport function CloseOnFocus({ hide }: { hide: (event: any) => any }) {\n return (\n // in IE, the hidden input's cursor appears right under the menu\n // this positions it arbitrarily away where it won't be noticed\n <div\n style={{\n height: 0,\n position: 'absolute',\n top: 1000,\n width: 0,\n }}\n >\n <input onFocus={hide} style={{ opacity: 0 }} />\n </div>\n )\n}\n\nexport function useOverlayTriggerContext() {\n const { enable: show, disable: hide, toggle } = useDelayedToggleContext()\n\n return {\n hide,\n show,\n toggle,\n }\n}\n\ninterface TriggerOverlayProps {\n containFocus?: boolean\n autoFocus?: boolean\n restoreFocus?: boolean\n placement: Placement\n canFlip?: boolean\n arrow?: boolean\n padding: number\n shrinkOverlay: boolean\n overlay: React.ReactNode\n overlayCloneProps: any\n wrapperProps: Record<string, unknown>\n referenceElement: HTMLElement | null\n}\n\nexport const TriggerOverlay = React.forwardRef<\n HTMLElement,\n TriggerOverlayProps\n>(function (\n {\n autoFocus,\n containFocus,\n restoreFocus,\n placement,\n canFlip,\n arrow,\n padding,\n shrinkOverlay,\n overlay,\n referenceElement,\n wrapperProps,\n overlayCloneProps,\n },\n ref\n) {\n const arrowRef = React.useRef<HTMLDivElement>(null)\n\n const arrowPadding = arrowSize / 2 + 1\n const middleware = [\n floatingOffset({ mainAxis: arrow ? padding + arrowPadding : padding }),\n canFlip ? floatingFlip() : null,\n floatingShift({ limiter: limitShift() }),\n !shrinkOverlay\n ? floatingSize({\n apply({ elements }) {\n Object.assign(elements.floating.style, {\n minWidth: `${elements.reference.getBoundingClientRect().width}px`,\n })\n },\n })\n : null,\n floatingArrow({\n element: arrowRef,\n padding: 6,\n }),\n ].filter((middleware) => middleware !== null) as OverlayMiddleware[]\n\n const {\n isPositioned,\n overlayStyle,\n referenceRef: referenceRefCallback,\n overlayRef,\n middlewareData,\n placement: currentPlacement,\n } = useOverlay({\n middleware,\n placement,\n })\n\n React.useEffect(() => {\n referenceRefCallback(referenceElement)\n }, [referenceElement, referenceRefCallback])\n\n const mergedRefs = mergeRefs(ref, overlayRef)\n\n // TODO could just move clone and clone props to parent\n if (!React.isValidElement(overlay) && overlayCloneProps) {\n console.warn(\n 'PLEASE REPORT ISSUE @procore/core-react: OverlayTrigger TriggerOverlay is not a valid React element but wants to clone \"overlay\" with props. Cannot pass props to the element.'\n )\n }\n\n const shownStyles: React.CSSProperties = {\n ...overlayStyle,\n left: isPositioned ? overlayStyle.left : '-99999px',\n top: isPositioned ? overlayStyle.top : '-99999px',\n }\n\n return (\n <FocusScope\n autoFocus={autoFocus}\n contain={containFocus}\n restoreFocus={restoreFocus}\n >\n <div\n data-qa=\"core-overlay-trigger-overlay-wrapper\"\n ref={mergedRefs}\n style={shownStyles}\n {...wrapperProps}\n >\n {React.isValidElement(overlay)\n ? React.cloneElement(overlay, overlayCloneProps)\n : overlay}\n {arrow && (\n <Arrow\n ref={arrowRef}\n arrow={middlewareData.arrow}\n placement={currentPlacement}\n />\n )}\n </div>\n </FocusScope>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SACEA,KAAK,IAAIC,aAAa,EACtBC,IAAI,IAAIC,YAAY,EACpBC,UAAU,EACVC,MAAM,IAAIC,cAAc,EACxBC,KAAK,IAAIC,aAAa,EACtBC,IAAI,IAAIC,YAAY,QACf,wBAAwB;AAC/B,SAASC,UAAU,QAAQ,mBAAmB;AAC9C,SAASC,KAAK,QAAQ,mBAAmB;AACzC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,yBAAyB;AAC/C,SAASC,SAAS,QAAQ,gCAAgC;AAE1D,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,MAAM,QAAQ,WAAW;AAElC,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SACEC,oBAAoB,EACpBC,gBAAgB,EAChBC,uBAAuB,QAClB,yBAAyB;AAEhC,SAASC,OAAO,EAAEC,UAAU,QAAQ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,EAAEyB,YAAY,GAAGC,YAAY,CAAC1B,GAAG,GAAG;EAAU,EAClD;EAED,oBACE9J,KAAA,CAAAmB,aAAA,CAACrB,UAAU;IACTmC,SAAS,EAAEA,SAAU;IACrBqH,OAAO,EAAE3G,YAAa;IACtB4G,YAAY,EAAEA;EAAa,gBAE3BvJ,KAAA,CAAAmB,aAAA,QAAAiI,QAAA;IACE,WAAQ,sCAAsC;IAC9C5H,GAAG,EAAEqK,UAAW;IAChBlC,KAAK,EAAEmC;EAAY,GACfzD,YAAY,GAEf,aAAArI,KAAK,CAACkI,cAAc,CAAChF,OAAO,CAAC,gBAC1BlD,KAAK,CAAC6I,YAAY,CAAC3F,OAAO,EAAEsG,iBAAiB,CAAC,GAC9CtG,OAAO,EACV/D,KAAK,iBACJa,KAAA,CAAAmB,aAAA,CAAClB,KAAK;IACJuB,GAAG,EAAE8I,QAAS;IACdnL,KAAK,EAAEwM,cAAc,CAACxM,KAAM;IAC5BmE,SAAS,EAAEsI;EAAiB,CAC7B,CAEA,CACK,CAAC;AAEjB,CAAC,CAAC"}
@@ -108,6 +108,14 @@ export interface OverlayTriggerProps extends PickedOverlayProps, PickedTriggerPr
108
108
  * @since 11.5.0
109
109
  */
110
110
  passA11yPropsToOverlay?: boolean;
111
+ /**
112
+ * Optional id for the overlay element.
113
+ * Useful when the parent component needs a stable id
114
+ * to link the trigger (aria-controls) with the overlay (e.g. listbox).
115
+ *
116
+ * @since 12.36.1
117
+ */
118
+ overlayId?: string;
111
119
  }
112
120
  export interface OverlayTriggerRef {
113
121
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"OverlayTrigger.types.js","names":[],"sources":["../../src/OverlayTrigger/OverlayTrigger.types.ts"],"sourcesContent":["import type { OverlayProps } from '../Overlay/Overlay'\nimport type { PortalProps } from '../Portal/Portal.types'\nimport type { BeforeCallback } from '../_hooks/DelayedCallback'\nimport type { TriggerRenderProps } from '../_hooks/Trigger'\nimport type { VisibilityConfig } from '../_hooks/Visibility'\n\nexport type OverlayTriggerRole =\n | 'dialog'\n | 'menu'\n | 'listbox'\n | 'tooltip'\n | 'none'\n\nexport type PickedOverlayProps = Pick<\n OverlayProps,\n 'canFlip' | 'padding' | 'placement' | 'shrinkOverlay' | 'arrow'\n>\n\nexport type PickedTriggerProps = Pick<\n TriggerRenderProps,\n 'children' | 'trigger'\n>\n\nexport type PickedTriggerRenderProps = Pick<TriggerRenderProps, 'children'>\n\nexport type PickedVisibilityProps = Pick<\n VisibilityConfig,\n 'afterHide' | 'afterShow' | 'initialIsVisible'\n>\n\nexport interface OverlayTriggerProps\n extends PickedOverlayProps,\n PickedTriggerProps,\n PickedTriggerRenderProps,\n PickedVisibilityProps,\n Pick<PortalProps, 'container'> {\n ['aria-describedby']?: string\n ['aria-details']?: string\n ['aria-label']?: string\n ['aria-labelledby']?: string\n /**\n * Boolean to enable code to apply aria-expanded to the source element\n * @since 12.24.0\n */\n trackAriaExpanded?: boolean\n /**\n * The callback to run before the overlay is hidden. Returning\n * `false` will prevent hiding.\n * ```\n * (e: event) => boolean | Promise | undefined\n * ```\n * @since 10.19.0\n */\n beforeHide?: BeforeCallback\n /**\n * The callback to run before the overlay is shown. Returning\n * `false` will prevent showing.\n * ```\n * (e: event) => boolean | Promise | undefined\n * ```\n * @since 10.19.0\n */\n beforeShow?: BeforeCallback\n\n /**\n * Additional refs to check for clickOutside behavior\n * @since 10.19.0\n */\n clickOutsideIgnoreRefs?: React.RefObject<HTMLElement>[]\n\n /**\n * The delay when hiding the overlay\n * @since 10.19.0\n */\n hideDelay?: number\n\n /**\n * Keys to hide the overlay when the overlay is focused\n * @a11y OverlayTrigger by default closes on tab. To remove tab from closing\n * and have only Esc keys, set \"containFocus\" to true, or opt-in to a full dialog role.\n * @since 10.19.0\n */\n hideKeys?: {\n overlay: string[]\n target: string[]\n }\n overlay: React.ReactNode\n\n /**\n * Restore focus to the target after the overlay is hidden.\n * 'core-react' will use internal logic to restore focus,\n * 'react-aria-focus-scope' will use 'FocusScope' component from '@react-aria',\n * true will use both.\n * @default true\n * @since 10.19.0\n */\n restoreFocusOnHide?: boolean | 'core-react' | 'react-aria-focus-scope'\n\n /**\n * The delay when showing the overlay\n * @since 10.19.0\n */\n showDelay?: number\n\n /**\n * Keys to show the overlay when the target is focused\n * @since 10.19.0\n */\n showKeys?: string[]\n\n /**\n * Toggles overlay visibility\n * @since 11.2.0\n */\n overlayRef?: React.Ref<OverlayTriggerRef>\n\n /**\n * Accessibility props.\n * @a11y May opionate \"autoFocus\" and \"containFocus\"\n * @since 11.2.0\n */\n role?: OverlayTriggerRole\n\n /**\n * Whether to auto focus the first focusable element in the overlay on mount.\n * True by default for role \"dialog\"\n * @since 11.5.0\n */\n autoFocus?: boolean\n\n /**\n * Whether to contain focus inside the overlay, so users cannot move focus outside, for example in a modal dialog.\n * True by default for role \"dialog\"\n * @since 11.5.0\n * */\n containFocus?: boolean\n\n /**\n * By default, role and id are applied to wrapper. But has knowledge of\n * Set to true, if you want OverlayTrigger to place them on your overlay component.\n *\n * @default false\n * @since 11.5.0\n */\n passA11yPropsToOverlay?: boolean\n}\n\nexport interface OverlayTriggerRef {\n /**\n * Show visibility\n * @since 11.2.0\n */\n show: () => void\n /**\n * Hide overlay\n * @since 11.2.0\n */\n hide: () => void\n}\n\n/**\n * @deprecatedSince 11.2.0\n * @deprecated To be replaced by OverlayTriggerProps#overlayRef in future release\n */\nexport type DeprecatedOverlayTriggerRef = HTMLElement\n"],"mappings":""}
1
+ {"version":3,"file":"OverlayTrigger.types.js","names":[],"sources":["../../src/OverlayTrigger/OverlayTrigger.types.ts"],"sourcesContent":["import type { OverlayProps } from '../Overlay/Overlay'\nimport type { PortalProps } from '../Portal/Portal.types'\nimport type { BeforeCallback } from '../_hooks/DelayedCallback'\nimport type { TriggerRenderProps } from '../_hooks/Trigger'\nimport type { VisibilityConfig } from '../_hooks/Visibility'\n\nexport type OverlayTriggerRole =\n | 'dialog'\n | 'menu'\n | 'listbox'\n | 'tooltip'\n | 'none'\n\nexport type PickedOverlayProps = Pick<\n OverlayProps,\n 'canFlip' | 'padding' | 'placement' | 'shrinkOverlay' | 'arrow'\n>\n\nexport type PickedTriggerProps = Pick<\n TriggerRenderProps,\n 'children' | 'trigger'\n>\n\nexport type PickedTriggerRenderProps = Pick<TriggerRenderProps, 'children'>\n\nexport type PickedVisibilityProps = Pick<\n VisibilityConfig,\n 'afterHide' | 'afterShow' | 'initialIsVisible'\n>\n\nexport interface OverlayTriggerProps\n extends PickedOverlayProps,\n PickedTriggerProps,\n PickedTriggerRenderProps,\n PickedVisibilityProps,\n Pick<PortalProps, 'container'> {\n ['aria-describedby']?: string\n ['aria-details']?: string\n ['aria-label']?: string\n ['aria-labelledby']?: string\n /**\n * Boolean to enable code to apply aria-expanded to the source element\n * @since 12.24.0\n */\n trackAriaExpanded?: boolean\n /**\n * The callback to run before the overlay is hidden. Returning\n * `false` will prevent hiding.\n * ```\n * (e: event) => boolean | Promise | undefined\n * ```\n * @since 10.19.0\n */\n beforeHide?: BeforeCallback\n /**\n * The callback to run before the overlay is shown. Returning\n * `false` will prevent showing.\n * ```\n * (e: event) => boolean | Promise | undefined\n * ```\n * @since 10.19.0\n */\n beforeShow?: BeforeCallback\n\n /**\n * Additional refs to check for clickOutside behavior\n * @since 10.19.0\n */\n clickOutsideIgnoreRefs?: React.RefObject<HTMLElement>[]\n\n /**\n * The delay when hiding the overlay\n * @since 10.19.0\n */\n hideDelay?: number\n\n /**\n * Keys to hide the overlay when the overlay is focused\n * @a11y OverlayTrigger by default closes on tab. To remove tab from closing\n * and have only Esc keys, set \"containFocus\" to true, or opt-in to a full dialog role.\n * @since 10.19.0\n */\n hideKeys?: {\n overlay: string[]\n target: string[]\n }\n overlay: React.ReactNode\n\n /**\n * Restore focus to the target after the overlay is hidden.\n * 'core-react' will use internal logic to restore focus,\n * 'react-aria-focus-scope' will use 'FocusScope' component from '@react-aria',\n * true will use both.\n * @default true\n * @since 10.19.0\n */\n restoreFocusOnHide?: boolean | 'core-react' | 'react-aria-focus-scope'\n\n /**\n * The delay when showing the overlay\n * @since 10.19.0\n */\n showDelay?: number\n\n /**\n * Keys to show the overlay when the target is focused\n * @since 10.19.0\n */\n showKeys?: string[]\n\n /**\n * Toggles overlay visibility\n * @since 11.2.0\n */\n overlayRef?: React.Ref<OverlayTriggerRef>\n\n /**\n * Accessibility props.\n * @a11y May opionate \"autoFocus\" and \"containFocus\"\n * @since 11.2.0\n */\n role?: OverlayTriggerRole\n\n /**\n * Whether to auto focus the first focusable element in the overlay on mount.\n * True by default for role \"dialog\"\n * @since 11.5.0\n */\n autoFocus?: boolean\n\n /**\n * Whether to contain focus inside the overlay, so users cannot move focus outside, for example in a modal dialog.\n * True by default for role \"dialog\"\n * @since 11.5.0\n * */\n containFocus?: boolean\n\n /**\n * By default, role and id are applied to wrapper. But has knowledge of\n * Set to true, if you want OverlayTrigger to place them on your overlay component.\n *\n * @default false\n * @since 11.5.0\n */\n passA11yPropsToOverlay?: boolean\n /**\n * Optional id for the overlay element.\n * Useful when the parent component needs a stable id\n * to link the trigger (aria-controls) with the overlay (e.g. listbox).\n *\n * @since 12.36.1\n */\n overlayId?: string\n}\n\nexport interface OverlayTriggerRef {\n /**\n * Show visibility\n * @since 11.2.0\n */\n show: () => void\n /**\n * Hide overlay\n * @since 11.2.0\n */\n hide: () => void\n}\n\n/**\n * @deprecatedSince 11.2.0\n * @deprecated To be replaced by OverlayTriggerProps#overlayRef in future release\n */\nexport type DeprecatedOverlayTriggerRef = HTMLElement\n"],"mappings":""}
@@ -43,12 +43,14 @@ var a11yPresets = {
43
43
  getTriggerProps: function getTriggerProps(_ref4) {
44
44
  var isVisible = _ref4.isVisible,
45
45
  overlayId = _ref4.overlayId;
46
- return isVisible ? {
47
- 'aria-describedby': overlayId
48
- } : {};
46
+ return {
47
+ 'aria-describedby': isVisible ? overlayId : undefined
48
+ // 'aria-expanded': isVisible,
49
+ };
49
50
  }
50
51
  }
51
52
  };
53
+
52
54
  export function getA11yPreset(role) {
53
55
  switch (role) {
54
56
  case 'dialog':
@@ -1 +1 @@
1
- {"version":3,"file":"a11yPresets.js","names":["ariaHideOutside","useId","useLabels","React","emptyObj","returnEmpty","a11yPresets","haspopup","getOverlayProps","_ref","role","overlayId","id","getTriggerProps","_ref2","isVisible","undefined","tooltip","_ref3","_ref4","getA11yPreset","useLabelled","props","_ref5","ariaDescribedby","ariaDetails","ariaLabelledby","ariaLabel","ariaLabelOnly","labelledId","widgetId","fieldProps","descriptionProps","labelProps","widgetProps","_objectSpread","useLabelledPopup","_ref6","_getA11yPreset$getTri","_getA11yPreset","_getA11yPreset$getOve","_getA11yPreset2","id_","isOpen","_ref6$type","type","popupRole","popupId_","popupId","presetArgs","triggerProps","call","overlayProps","_useLabelled","popupProps","useModalDialogLike","_ref7","isModal","ref","_ref7$role","_useLabelled2","dialogProps","tabIndex","useLayoutEffect","current","focusScopeProps","autoFocus","contain","restoreFocus","useOverlayTriggerA11y","_ref8","alwaysAriaVisible","canPropOverlayUp","isDialog","_getA11yPreset3","overlayA11yProps","wrapperA11yProps","_useModalDialogLike","portalProps","wrapperFinalProps","focusScopeFinalProps","wrapperProps"],"sources":["../../src/OverlayTrigger/a11yPresets.ts"],"sourcesContent":["import { ariaHideOutside } from '@react-aria/overlays'\nimport { useId, useLabels } from '@react-aria/utils'\nimport type { AriaAttributes } from 'react'\nimport React from 'react'\nimport type { OverlayTriggerRole } from './OverlayTrigger.types'\n\nconst emptyObj = {}\nconst returnEmpty: GetA11yProps = () => ({})\n\ntype GetA11yProps = (props: {\n role: OverlayTriggerRole\n isVisible: boolean\n overlayId: string\n}) => AriaAttributes & { id?: string }\n\nconst a11yPresets: Record<\n 'tooltip' | 'haspopup',\n {\n getOverlayProps: GetA11yProps\n getTriggerProps: GetA11yProps\n }\n> = {\n haspopup: {\n getOverlayProps: ({ role, overlayId }) => ({\n id: overlayId,\n role,\n }),\n getTriggerProps: ({ role, isVisible, overlayId }) => ({\n 'aria-expanded': isVisible,\n 'aria-controls': isVisible ? overlayId : undefined,\n 'aria-haspopup': role as 'dialog' | 'listbox' | 'menu',\n }),\n },\n tooltip: {\n getOverlayProps: ({ overlayId }) => ({\n role: 'tooltip',\n id: overlayId,\n }),\n getTriggerProps: ({ isVisible, overlayId }) =>\n isVisible\n ? {\n 'aria-describedby': overlayId,\n }\n : {},\n },\n}\n\nexport function getA11yPreset(role?: OverlayTriggerRole) {\n switch (role) {\n case 'dialog':\n case 'listbox':\n case 'menu':\n return a11yPresets.haspopup\n case 'tooltip':\n return a11yPresets.tooltip\n case 'none':\n return {\n getOverlayProps: (() => ({ role: 'none' })) as GetA11yProps,\n getTriggerProps: returnEmpty,\n }\n default:\n return {\n getOverlayProps: returnEmpty,\n getTriggerProps: returnEmpty,\n }\n }\n}\n\ntype LabelConfig = {\n 'aria-describedby'?: string\n 'aria-details'?: string\n 'aria-labelledby'?: string\n 'aria-label'?: string\n /**\n * ID for the widget itself\n */\n id?: string\n}\n\ntype DialogBase = LabelConfig & {\n isOpen: boolean\n role?: 'dialog'\n}\n\ntype NonModalDialogConfig = DialogBase & {\n isModal?: never | false\n}\n\ntype ModalDialogConfig = DialogBase & {\n /**\n *\n * To enable `ariaHideOutside`. Set `isModal` to false to disable.\n * @a11y Replicates `aria-modal` inert outside content\n * @default false\n */\n isModal: true\n ref: React.RefObject<HTMLElement>\n}\n\ntype ModalDialogLikeConfig = NonModalDialogConfig | ModalDialogConfig\n\ntype OverlayTriggerA11yConfig = LabelConfig & {\n /**\n * Assure `aria-hidden` is not applied. A code side-effect\n * from `ariaHideOutside` hiding everthing outside the scope.\n */\n alwaysAriaVisible?: boolean\n /**\n * When properties should be passed to the overlay UI itself,\n * and not the wrapper element.\n */\n canPropOverlayUp: boolean\n isOpen: boolean\n role?: OverlayTriggerRole\n // ref: React.RefObject<HTMLElement> // Only necessary for modal\n}\n\n/**\n * Manages labelling for an element and the other DOM. Defaults an ID for `aria-labelledby` usage.\n *\n * When `aria-label` and `aria-labelledby` both exist, it combines them into `aria-labelledby` for a screen reader chain.\n * @link [W3 naming with aria-labelledby](https://www.w3.org/WAI/ARIA/apg/practices/names-and-descriptions/#naming_with_aria-labelledby)\n */\nexport function useLabelled(props?: LabelConfig) {\n const {\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n id,\n } = props || (emptyObj as LabelConfig)\n const ariaLabelOnly = ariaLabel && !ariaLabelledby\n\n // Generate an ID. We want to use this unless they are using only aria-label\n const labelledId = useId(ariaLabelledby)\n\n // Merges aria-label and aria-labelledby into aria-labelledby when both exist\n const widgetId = useId(id)\n let fieldProps = useLabels({\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelOnly ? undefined : labelledId,\n id: widgetId,\n })\n\n return {\n descriptionProps: { id: ariaDescribedby },\n labelProps: { id: ariaLabelOnly ? undefined : labelledId },\n widgetProps: {\n ...fieldProps,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n },\n }\n}\n\n/**\n * Cover the label links for the trigger (button), the popup element (dialog), and the popup element title (heading).\n * Similar to [React Aria useOverlayTrigger](https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/overlays/src/useOverlayTrigger.ts)\n * but with element title support.\n * @link [MDN aria-haspopup](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup)\n */\nexport function useLabelledPopup({\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n id: id_,\n isOpen,\n type = 'button',\n popupRole,\n popupId: popupId_,\n}: LabelConfig & {\n isOpen: boolean\n popupId?: string\n type?: 'button' | 'combobox' // Role? Not used. Show concept that popups manage 2 roles\n popupRole: 'dialog' | 'menu' | 'listbox'\n}) {\n /** Web spec default for aria-haspopup=true is menu, unless element has role combobox, which have an implicit aria-haspopup value of listbox. */\n // const popupRole = popupRole_ || type === 'combobox' ? 'listbox' : 'menu'\n const id = useId(id_)\n const popupId = useId(popupId_)\n\n const presetArgs = {\n isVisible: isOpen,\n role: popupRole,\n overlayId: popupId,\n }\n\n const triggerProps = getA11yPreset(popupRole).getTriggerProps?.(presetArgs)\n const overlayProps = getA11yPreset(popupRole).getOverlayProps?.(presetArgs)\n\n const { labelProps, widgetProps } = useLabelled({\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n id,\n })\n\n return {\n labelProps,\n popupProps: { role: popupRole, ...widgetProps, ...overlayProps },\n triggerProps,\n }\n}\n\n/**\n * For dialog experiences:\n * - Has role dialog and aria linked title props\n * - Focus management props to work with FocusScope\n *\n * For modal dialog experiences (full screen locked experiences):\n * - Hides old and new content outside with aria-hidden with ariaHideOutside (like aria-modal)\n * - (it will in breaking) Prevent scroll\n *\n * For either experiences, you still MUST support:\n * - have Escape key to close (It should!)\n * - have click outside, like scrim click\n *\n * _More about 'modal dialog' and `isModal` not using `aria-modal`:_\n * Setting aria-modal=\"true\" tells assistive technologies to let the user know the ability to interact with,\n * or access other content on the page requires the modal dialog to be closed or otherwise lose focus.\n * Modal dialogs are when content is displayed and the user's interaction is limited to only that section until it is dismissed.\n * [MDN aria modal](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-modal).\n * To support the most, like Narrator in Edge, Core React uses `ariaHideOutside` to set `aria-hidden` on\n * all elements outside the dialog, and **all elements outside added while opened**, so the dialog will act as a\n * _modal_ even without `aria-modal` on the dialog itself. See Future Considerations below.\n * [Screen Reader aria modal support table](https://a11ysupport.io/tech/aria/aria-modal_attribute) - [MS Narrator Edge aria modal support](https://a11ysupport.io/tests/apg__modal-dialog-example/aria__aria-modal_attribute/convey_presence/narrator/edge)\n * _Future Considerations:_ Replace ariaHideOutside with aria-modal=\"true\".\n * Using aria-modal, then we would need to involve Portal and so tooltips\n * or Toasts could mount within the visible aria-modal container.\n */\n\nexport function useModalDialogLike({\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n id,\n isModal,\n isOpen,\n // @ts-expect-error\n ref,\n role = 'dialog',\n}: ModalDialogLikeConfig) {\n const { labelProps, widgetProps } = useLabelled({\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n })\n\n const dialogProps = {\n // 'aria-modal': true,\n ...widgetProps,\n id,\n role,\n tabIndex: -1,\n }\n\n // usePreventScroll({\n // isDisabled: isModal ? !isOpen : true,\n // })\n\n // Fills aria-modal=true\n React.useLayoutEffect(() => {\n if (isModal && isOpen && ref.current) {\n // Could add additional visible element refs here\n return ariaHideOutside([ref.current])\n }\n }, [isModal, isOpen, ref])\n\n return {\n dialogProps,\n labelProps,\n focusScopeProps: {\n autoFocus: true,\n contain: true,\n restoreFocus: true,\n },\n }\n}\n\n/**\n * Takes many roles and determines props necessary for DOM/components.\n * **Side effect of role=\"dialog\"**, current and any content added later\n * outside of the element (like by portals) will get `aria-hidden=true`\n * to replace the `aria-modal=true` `inert` nature.\n * @see useModalDialogLike */\nexport function useOverlayTriggerA11y({\n alwaysAriaVisible,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n // can we remove this? have it role based? be optional?\n canPropOverlayUp,\n id: id_,\n isOpen,\n role,\n}: OverlayTriggerA11yConfig) {\n const isDialog = role === 'dialog'\n\n const id = useId(id_)\n\n const { getTriggerProps, getOverlayProps } = getA11yPreset(role)\n\n const triggerProps = getTriggerProps?.({\n isVisible: isOpen,\n role: role!,\n overlayId: id,\n })\n\n const overlayA11yProps = getOverlayProps?.({\n isVisible: isOpen,\n role: role!,\n overlayId: id,\n })\n\n const wrapperA11yProps = !canPropOverlayUp ? overlayA11yProps : emptyObj\n const overlayProps = canPropOverlayUp ? overlayA11yProps : emptyObj\n\n const { dialogProps, labelProps, focusScopeProps } = useModalDialogLike({\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n id,\n isModal: false,\n isOpen,\n })\n\n /** This is a code side-effect from ariaHideOutside hiding everthing */\n const portalProps =\n role === 'tooltip' || alwaysAriaVisible // || !role\n ? { 'data-react-aria-top-layer': true, 'data-live-announcer': true }\n : emptyObj\n\n /**\n * If it is a dialog, we can merge the dialog props with any haspopup props\n */\n const wrapperFinalProps = isDialog\n ? {\n ...wrapperA11yProps,\n ...dialogProps,\n }\n : wrapperA11yProps\n\n /**\n * If it is a dialog, we have opinions on `FocusScope` props.\n */\n const focusScopeFinalProps = isDialog\n ? focusScopeProps\n : (emptyObj as {\n autoFocus?: boolean\n contain?: boolean\n restoreFocus?: boolean\n })\n\n return {\n focusScopeProps: focusScopeFinalProps,\n labelProps,\n overlayProps,\n portalProps,\n triggerProps,\n wrapperProps: wrapperFinalProps,\n }\n}\n\n// WIP Example combobox\n// function useCombox({\n// controls,\n// isOpen = false,\n// }: {\n// controls: 'dialog' | 'menu' | 'listbox'\n// isOpen: boolean\n// }) {\n// const { labelProps, popupProps, triggerProps } = useLabelledPopup({\n// role: controls,\n// type: 'combobox',\n// isOpen,\n// })\n// dispatch between elements.\n// NOTE combobox has two labels, that could be different\n// one for the trigger input (typically the form label)\n// second for the thing it controls (listbox, dialog)\n// - label id=1\n// - input role='combobox' aria-labelledby=1\n// - div role={controls} aria-label\n// Also, any icon only buttons like clear or open should have a\n// label and -1 tabindex. No nested interactive roles.\n// }\n"],"mappings":";;;;;;AAAA,SAASA,eAAe,QAAQ,sBAAsB;AACtD,SAASC,KAAK,EAAEC,SAAS,QAAQ,mBAAmB;AAEpD,OAAOC,KAAK,MAAM,OAAO;AAGzB,IAAMC,QAAQ,GAAG,CAAC,CAAC;AACnB,IAAMC,WAAyB,GAAG,SAA5BA,WAAyBA,CAAA;EAAA,O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ACrC/C,UAAU,EAAVA,UAAU;IACVmB,YAAY,EAAZA,YAAY;IACZ0B,WAAW,EAAXA,WAAW;IACX5B,YAAY,EAAZA,YAAY;IACZ+B,YAAY,EAAEF;EAChB,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"a11yPresets.js","names":["ariaHideOutside","useId","useLabels","React","emptyObj","returnEmpty","a11yPresets","haspopup","getOverlayProps","_ref","role","overlayId","id","getTriggerProps","_ref2","isVisible","undefined","tooltip","_ref3","_ref4","getA11yPreset","useLabelled","props","_ref5","ariaDescribedby","ariaDetails","ariaLabelledby","ariaLabel","ariaLabelOnly","labelledId","widgetId","fieldProps","descriptionProps","labelProps","widgetProps","_objectSpread","useLabelledPopup","_ref6","_getA11yPreset$getTri","_getA11yPreset","_getA11yPreset$getOve","_getA11yPreset2","id_","isOpen","_ref6$type","type","popupRole","popupId_","popupId","presetArgs","triggerProps","call","overlayProps","_useLabelled","popupProps","useModalDialogLike","_ref7","isModal","ref","_ref7$role","_useLabelled2","dialogProps","tabIndex","useLayoutEffect","current","focusScopeProps","autoFocus","contain","restoreFocus","useOverlayTriggerA11y","_ref8","alwaysAriaVisible","canPropOverlayUp","isDialog","_getA11yPreset3","overlayA11yProps","wrapperA11yProps","_useModalDialogLike","portalProps","wrapperFinalProps","focusScopeFinalProps","wrapperProps"],"sources":["../../src/OverlayTrigger/a11yPresets.ts"],"sourcesContent":["import { ariaHideOutside } from '@react-aria/overlays'\nimport { useId, useLabels } from '@react-aria/utils'\nimport type { AriaAttributes } from 'react'\nimport React from 'react'\nimport type { OverlayTriggerRole } from './OverlayTrigger.types'\n\nconst emptyObj = {}\nconst returnEmpty: GetA11yProps = () => ({})\n\ntype GetA11yProps = (props: {\n role: OverlayTriggerRole\n isVisible: boolean\n overlayId: string\n}) => AriaAttributes & { id?: string }\n\nconst a11yPresets: Record<\n 'tooltip' | 'haspopup',\n {\n getOverlayProps: GetA11yProps\n getTriggerProps: GetA11yProps\n }\n> = {\n haspopup: {\n getOverlayProps: ({ role, overlayId }) => ({\n id: overlayId,\n role,\n }),\n getTriggerProps: ({ role, isVisible, overlayId }) => ({\n 'aria-expanded': isVisible,\n 'aria-controls': isVisible ? overlayId : undefined,\n 'aria-haspopup': role as 'dialog' | 'listbox' | 'menu',\n }),\n },\n tooltip: {\n getOverlayProps: ({ overlayId }) => ({\n role: 'tooltip',\n id: overlayId,\n }),\n getTriggerProps: ({ isVisible, overlayId }) => ({\n 'aria-describedby': isVisible ? overlayId : undefined,\n // 'aria-expanded': isVisible,\n }),\n },\n}\n\nexport function getA11yPreset(role?: OverlayTriggerRole) {\n switch (role) {\n case 'dialog':\n case 'listbox':\n case 'menu':\n return a11yPresets.haspopup\n case 'tooltip':\n return a11yPresets.tooltip\n case 'none':\n return {\n getOverlayProps: (() => ({ role: 'none' })) as GetA11yProps,\n getTriggerProps: returnEmpty,\n }\n default:\n return {\n getOverlayProps: returnEmpty,\n getTriggerProps: returnEmpty,\n }\n }\n}\n\ntype LabelConfig = {\n 'aria-describedby'?: string\n 'aria-details'?: string\n 'aria-labelledby'?: string\n 'aria-label'?: string\n /**\n * ID for the widget itself\n */\n id?: string\n}\n\ntype DialogBase = LabelConfig & {\n isOpen: boolean\n role?: 'dialog'\n}\n\ntype NonModalDialogConfig = DialogBase & {\n isModal?: never | false\n}\n\ntype ModalDialogConfig = DialogBase & {\n /**\n *\n * To enable `ariaHideOutside`. Set `isModal` to false to disable.\n * @a11y Replicates `aria-modal` inert outside content\n * @default false\n */\n isModal: true\n ref: React.RefObject<HTMLElement>\n}\n\ntype ModalDialogLikeConfig = NonModalDialogConfig | ModalDialogConfig\n\ntype OverlayTriggerA11yConfig = LabelConfig & {\n /**\n * Assure `aria-hidden` is not applied. A code side-effect\n * from `ariaHideOutside` hiding everthing outside the scope.\n */\n alwaysAriaVisible?: boolean\n /**\n * When properties should be passed to the overlay UI itself,\n * and not the wrapper element.\n */\n canPropOverlayUp: boolean\n isOpen: boolean\n role?: OverlayTriggerRole\n // ref: React.RefObject<HTMLElement> // Only necessary for modal\n}\n\n/**\n * Manages labelling for an element and the other DOM. Defaults an ID for `aria-labelledby` usage.\n *\n * When `aria-label` and `aria-labelledby` both exist, it combines them into `aria-labelledby` for a screen reader chain.\n * @link [W3 naming with aria-labelledby](https://www.w3.org/WAI/ARIA/apg/practices/names-and-descriptions/#naming_with_aria-labelledby)\n */\nexport function useLabelled(props?: LabelConfig) {\n const {\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n id,\n } = props || (emptyObj as LabelConfig)\n const ariaLabelOnly = ariaLabel && !ariaLabelledby\n\n // Generate an ID. We want to use this unless they are using only aria-label\n const labelledId = useId(ariaLabelledby)\n\n // Merges aria-label and aria-labelledby into aria-labelledby when both exist\n const widgetId = useId(id)\n let fieldProps = useLabels({\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelOnly ? undefined : labelledId,\n id: widgetId,\n })\n\n return {\n descriptionProps: { id: ariaDescribedby },\n labelProps: { id: ariaLabelOnly ? undefined : labelledId },\n widgetProps: {\n ...fieldProps,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n },\n }\n}\n\n/**\n * Cover the label links for the trigger (button), the popup element (dialog), and the popup element title (heading).\n * Similar to [React Aria useOverlayTrigger](https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/overlays/src/useOverlayTrigger.ts)\n * but with element title support.\n * @link [MDN aria-haspopup](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup)\n */\nexport function useLabelledPopup({\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n id: id_,\n isOpen,\n type = 'button',\n popupRole,\n popupId: popupId_,\n}: LabelConfig & {\n isOpen: boolean\n popupId?: string\n type?: 'button' | 'combobox' // Role? Not used. Show concept that popups manage 2 roles\n popupRole: 'dialog' | 'menu' | 'listbox'\n}) {\n /** Web spec default for aria-haspopup=true is menu, unless element has role combobox, which have an implicit aria-haspopup value of listbox. */\n // const popupRole = popupRole_ || type === 'combobox' ? 'listbox' : 'menu'\n const id = useId(id_)\n const popupId = useId(popupId_)\n\n const presetArgs = {\n isVisible: isOpen,\n role: popupRole,\n overlayId: popupId,\n }\n\n const triggerProps = getA11yPreset(popupRole).getTriggerProps?.(presetArgs)\n const overlayProps = getA11yPreset(popupRole).getOverlayProps?.(presetArgs)\n\n const { labelProps, widgetProps } = useLabelled({\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n id,\n })\n\n return {\n labelProps,\n popupProps: { role: popupRole, ...widgetProps, ...overlayProps },\n triggerProps,\n }\n}\n\n/**\n * For dialog experiences:\n * - Has role dialog and aria linked title props\n * - Focus management props to work with FocusScope\n *\n * For modal dialog experiences (full screen locked experiences):\n * - Hides old and new content outside with aria-hidden with ariaHideOutside (like aria-modal)\n * - (it will in breaking) Prevent scroll\n *\n * For either experiences, you still MUST support:\n * - have Escape key to close (It should!)\n * - have click outside, like scrim click\n *\n * _More about 'modal dialog' and `isModal` not using `aria-modal`:_\n * Setting aria-modal=\"true\" tells assistive technologies to let the user know the ability to interact with,\n * or access other content on the page requires the modal dialog to be closed or otherwise lose focus.\n * Modal dialogs are when content is displayed and the user's interaction is limited to only that section until it is dismissed.\n * [MDN aria modal](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-modal).\n * To support the most, like Narrator in Edge, Core React uses `ariaHideOutside` to set `aria-hidden` on\n * all elements outside the dialog, and **all elements outside added while opened**, so the dialog will act as a\n * _modal_ even without `aria-modal` on the dialog itself. See Future Considerations below.\n * [Screen Reader aria modal support table](https://a11ysupport.io/tech/aria/aria-modal_attribute) - [MS Narrator Edge aria modal support](https://a11ysupport.io/tests/apg__modal-dialog-example/aria__aria-modal_attribute/convey_presence/narrator/edge)\n * _Future Considerations:_ Replace ariaHideOutside with aria-modal=\"true\".\n * Using aria-modal, then we would need to involve Portal and so tooltips\n * or Toasts could mount within the visible aria-modal container.\n */\n\nexport function useModalDialogLike({\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n id,\n isModal,\n isOpen,\n // @ts-expect-error\n ref,\n role = 'dialog',\n}: ModalDialogLikeConfig) {\n const { labelProps, widgetProps } = useLabelled({\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n })\n\n const dialogProps = {\n // 'aria-modal': true,\n ...widgetProps,\n id,\n role,\n tabIndex: -1,\n }\n\n // usePreventScroll({\n // isDisabled: isModal ? !isOpen : true,\n // })\n\n // Fills aria-modal=true\n React.useLayoutEffect(() => {\n if (isModal && isOpen && ref.current) {\n // Could add additional visible element refs here\n return ariaHideOutside([ref.current])\n }\n }, [isModal, isOpen, ref])\n\n return {\n dialogProps,\n labelProps,\n focusScopeProps: {\n autoFocus: true,\n contain: true,\n restoreFocus: true,\n },\n }\n}\n\n/**\n * Takes many roles and determines props necessary for DOM/components.\n * **Side effect of role=\"dialog\"**, current and any content added later\n * outside of the element (like by portals) will get `aria-hidden=true`\n * to replace the `aria-modal=true` `inert` nature.\n * @see useModalDialogLike */\nexport function useOverlayTriggerA11y({\n alwaysAriaVisible,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n // can we remove this? have it role based? be optional?\n canPropOverlayUp,\n id: id_,\n isOpen,\n role,\n}: OverlayTriggerA11yConfig) {\n const isDialog = role === 'dialog'\n\n const id = useId(id_)\n\n const { getTriggerProps, getOverlayProps } = getA11yPreset(role)\n\n const triggerProps = getTriggerProps?.({\n isVisible: isOpen,\n role: role!,\n overlayId: id,\n })\n\n const overlayA11yProps = getOverlayProps?.({\n isVisible: isOpen,\n role: role!,\n overlayId: id,\n })\n\n const wrapperA11yProps = !canPropOverlayUp ? overlayA11yProps : emptyObj\n const overlayProps = canPropOverlayUp ? overlayA11yProps : emptyObj\n\n const { dialogProps, labelProps, focusScopeProps } = useModalDialogLike({\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n id,\n isModal: false,\n isOpen,\n })\n\n /** This is a code side-effect from ariaHideOutside hiding everthing */\n const portalProps =\n role === 'tooltip' || alwaysAriaVisible // || !role\n ? { 'data-react-aria-top-layer': true, 'data-live-announcer': true }\n : emptyObj\n\n /**\n * If it is a dialog, we can merge the dialog props with any haspopup props\n */\n const wrapperFinalProps = isDialog\n ? {\n ...wrapperA11yProps,\n ...dialogProps,\n }\n : wrapperA11yProps\n\n /**\n * If it is a dialog, we have opinions on `FocusScope` props.\n */\n const focusScopeFinalProps = isDialog\n ? focusScopeProps\n : (emptyObj as {\n autoFocus?: boolean\n contain?: boolean\n restoreFocus?: boolean\n })\n\n return {\n focusScopeProps: focusScopeFinalProps,\n labelProps,\n overlayProps,\n portalProps,\n triggerProps,\n wrapperProps: wrapperFinalProps,\n }\n}\n\n// WIP Example combobox\n// function useCombox({\n// controls,\n// isOpen = false,\n// }: {\n// controls: 'dialog' | 'menu' | 'listbox'\n// isOpen: boolean\n// }) {\n// const { labelProps, popupProps, triggerProps } = useLabelledPopup({\n// role: controls,\n// type: 'combobox',\n// isOpen,\n// })\n// dispatch between elements.\n// NOTE combobox has two labels, that could be different\n// one for the trigger input (typically the form label)\n// second for the thing it controls (listbox, dialog)\n// - label id=1\n// - input role='combobox' aria-labelledby=1\n// - div role={controls} aria-label\n// Also, any icon only buttons like clear or open should have a\n// label and -1 tabindex. No n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;EAEd;AACF;AACA;EACE,IAAM2E,iBAAiB,GAAGN,QAAQ,GAAAtC,aAAA,CAAAA,aAAA,KAEzByC,gBAAgB,GAChBf,WAAW,IAEhBe,gBAAgB;;EAEpB;AACF;AACA;EACE,IAAMI,oBAAoB,GAAGP,QAAQ,GACjCR,eAAe,GACd7D,QAIC;EAEN,OAAO;IACL6D,eAAe,EAAEe,oBAAoB;IACrC/C,UAAU,EAAVA,UAAU;IACVmB,YAAY,EAAZA,YAAY;IACZ0B,WAAW,EAAXA,WAAW;IACX5B,YAAY,EAAZA,YAAY;IACZ+B,YAAY,EAAEF;EAChB,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -3,7 +3,7 @@ var _excluded = ["gutterX"],
3
3
  _excluded2 = ["transparent"],
4
4
  _excluded3 = ["children"],
5
5
  _excluded4 = ["minSections"],
6
- _excluded5 = ["children", "open"];
6
+ _excluded5 = ["children", "open", "focusOnOpen", "restoreFocusOnClose"];
7
7
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
8
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
9
9
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -27,6 +27,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
27
27
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
28
28
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
29
29
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
30
+ import { FocusScope } from '@react-aria/focus';
30
31
  import throttle from 'lodash.throttle';
31
32
  import React from 'react';
32
33
  import { AnchorNavigation } from '../AnchorNavigation/AnchorNavigation';
@@ -214,8 +215,13 @@ var PageFooter = /*#__PURE__*/React.forwardRef(function PageFooter(props, ref) {
214
215
  }));
215
216
  });
216
217
  var PageAside = /*#__PURE__*/React.forwardRef(function PageAside(_ref5, ref) {
218
+ var _ref6;
217
219
  var children = _ref5.children,
218
220
  controlledIsOpen = _ref5.open,
221
+ _ref5$focusOnOpen = _ref5.focusOnOpen,
222
+ focusOnOpen = _ref5$focusOnOpen === void 0 ? false : _ref5$focusOnOpen,
223
+ _ref5$restoreFocusOnC = _ref5.restoreFocusOnClose,
224
+ restoreFocusOnClose = _ref5$restoreFocusOnC === void 0 ? false : _ref5$restoreFocusOnC,
219
225
  props = _objectWithoutProperties(_ref5, _excluded5);
220
226
  var _React$useContext5 = React.useContext(PageContext),
221
227
  _React$useContext5$as = _React$useContext5.aside,
@@ -229,6 +235,8 @@ var PageAside = /*#__PURE__*/React.forwardRef(function PageAside(_ref5, ref) {
229
235
  footerRef = _React$useContext7.footerRef,
230
236
  containerRef = _React$useContext7.containerRef;
231
237
  var innerRef = React.useRef(null);
238
+ var panelRef = React.useRef(null);
239
+ var prevIsOpenRef = React.useRef((_ref6 = controlledIsOpen !== null && controlledIsOpen !== void 0 ? controlledIsOpen : contextIsOpen) !== null && _ref6 !== void 0 ? _ref6 : false);
232
240
  var _React$useState3 = React.useState(null),
233
241
  _React$useState4 = _slicedToArray(_React$useState3, 2),
234
242
  topOffset = _React$useState4[0],
@@ -270,39 +278,46 @@ var PageAside = /*#__PURE__*/React.forwardRef(function PageAside(_ref5, ref) {
270
278
  useUpdateEffect(function () {
271
279
  ;
272
280
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
281
+ var wasOpen, isRealOpenTransition, _panelRef$current;
273
282
  return _regeneratorRuntime().wrap(function _callee$(_context) {
274
283
  while (1) switch (_context.prev = _context.next) {
275
284
  case 0:
285
+ wasOpen = prevIsOpenRef.current;
286
+ prevIsOpenRef.current = contextIsOpen;
276
287
  if (!contextIsOpen) {
277
- _context.next = 9;
288
+ _context.next = 13;
278
289
  break;
279
290
  }
291
+ isRealOpenTransition = !wasOpen;
280
292
  setIsOpen(true);
281
293
 
282
294
  // allow browsers to recalculate the layout
283
- _context.next = 4;
295
+ _context.next = 7;
284
296
  return wait(0);
285
- case 4:
297
+ case 7:
286
298
  setAnimationStatus('opening');
287
- _context.next = 7;
299
+ _context.next = 10;
288
300
  return wait(animationDuration.panel);
289
- case 7:
301
+ case 10:
290
302
  setAnimationStatus('open');
303
+ if (focusOnOpen && isRealOpenTransition) {
304
+ (_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.focus();
305
+ }
291
306
  return _context.abrupt("return");
292
- case 9:
307
+ case 13:
293
308
  setAnimationStatus('closing');
294
- _context.next = 12;
309
+ _context.next = 16;
295
310
  return wait(animationDuration.panel);
296
- case 12:
311
+ case 16:
297
312
  setAnimationStatus('closed');
298
313
  setIsOpen(false);
299
- case 14:
314
+ case 18:
300
315
  case "end":
301
316
  return _context.stop();
302
317
  }
303
318
  }, _callee);
304
319
  }))();
305
- }, [contextIsOpen]);
320
+ }, [contextIsOpen, focusOnOpen]);
306
321
  function calculateOffsets() {
307
322
  calculateHorizontalOffsets();
308
323
  calculateVerticalOffsets();
@@ -351,7 +366,11 @@ var PageAside = /*#__PURE__*/React.forwardRef(function PageAside(_ref5, ref) {
351
366
  }), /*#__PURE__*/React.createElement(StyledAsideFluidContainer, {
352
367
  $open: asideOpen,
353
368
  $closed: asideClosed
369
+ }, /*#__PURE__*/React.createElement(FocusScope, {
370
+ restoreFocus: restoreFocusOnClose
354
371
  }, /*#__PURE__*/React.createElement(StyledAsidePanel, {
372
+ ref: panelRef,
373
+ tabIndex: -1,
355
374
  $offsetTop: topOffset,
356
375
  $rightOffset: rightOffset,
357
376
  $minusHeight: (topOffset !== null && topOffset !== void 0 ? topOffset : 0) + bottomOffset,
@@ -359,7 +378,7 @@ var PageAside = /*#__PURE__*/React.forwardRef(function PageAside(_ref5, ref) {
359
378
  $opening: animationStatus === 'opening',
360
379
  $closed: animationStatus === 'closed',
361
380
  $altAnimation: tearsheetPlacement === 'left'
362
- }, children))) : null;
381
+ }, children)))) : null;
363
382
  });
364
383
  var PageContainer = /*#__PURE__*/React.forwardRef(function PageContainer(props, ref) {
365
384
  var _React$useState11 = React.useState(defaultAsideIsOpen),