@primer/components 0.0.0-20219922627 → 0.0.0-2022530201059

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 (531) hide show
  1. package/CHANGELOG.md +105 -492
  2. package/README.md +16 -16
  3. package/codemods/lib/modifyProps.js +7 -9
  4. package/codemods/lib/prettify.js +1 -1
  5. package/codemods/lib/replaceImportSource.js +5 -5
  6. package/dist/browser.esm.js +801 -1115
  7. package/dist/browser.esm.js.map +1 -1
  8. package/dist/browser.umd.js +815 -1134
  9. package/dist/browser.umd.js.map +1 -1
  10. package/index.d.ts +940 -0
  11. package/lib/AvatarPair.js +5 -6
  12. package/lib/AvatarStack.js +10 -10
  13. package/lib/BaseStyles.js +19 -18
  14. package/lib/BorderBox.js +5 -4
  15. package/lib/Box.js +2 -2
  16. package/lib/BranchName.js +1 -1
  17. package/lib/{Breadcrumbs.js → Breadcrumb.js} +23 -33
  18. package/lib/Button/Button.js +3 -3
  19. package/lib/Button/ButtonClose.js +4 -4
  20. package/lib/Button/ButtonDanger.js +2 -2
  21. package/lib/Button/ButtonInvisible.js +3 -3
  22. package/lib/Button/ButtonOutline.js +2 -2
  23. package/lib/Button/ButtonPrimary.js +2 -2
  24. package/lib/Button/ButtonTableList.js +1 -1
  25. package/lib/CircleBadge.js +1 -1
  26. package/lib/CircleOcticon.js +7 -9
  27. package/lib/CounterLabel.js +2 -2
  28. package/lib/Dialog.js +14 -13
  29. package/lib/Dropdown.js +2 -2
  30. package/lib/DropdownStyles.js +6 -6
  31. package/lib/FilterList.js +1 -1
  32. package/lib/Flash.js +1 -1
  33. package/lib/Flex.js +0 -3
  34. package/lib/Grid.js +3 -4
  35. package/lib/Header.js +2 -3
  36. package/lib/Label.js +4 -4
  37. package/lib/Link.js +12 -1
  38. package/lib/Overlay.js +35 -120
  39. package/lib/Pagehead.js +1 -1
  40. package/lib/Pagination/Pagination.js +2 -3
  41. package/lib/Popover.js +3 -3
  42. package/lib/Portal/Portal.js +12 -20
  43. package/lib/Position.js +27 -46
  44. package/lib/ProgressBar.js +1 -1
  45. package/lib/SelectMenu/SelectMenu.js +4 -4
  46. package/lib/SelectMenu/SelectMenuContext.js +1 -1
  47. package/lib/SelectMenu/SelectMenuDivider.js +3 -3
  48. package/lib/SelectMenu/SelectMenuFilter.js +6 -6
  49. package/lib/SelectMenu/SelectMenuFooter.js +3 -3
  50. package/lib/SelectMenu/SelectMenuHeader.js +2 -2
  51. package/lib/SelectMenu/SelectMenuItem.js +4 -4
  52. package/lib/SelectMenu/SelectMenuList.js +3 -3
  53. package/lib/SelectMenu/SelectMenuLoadingAnimation.js +15 -4
  54. package/lib/SelectMenu/SelectMenuModal.js +7 -7
  55. package/lib/SelectMenu/SelectMenuTab.js +3 -3
  56. package/lib/SelectMenu/SelectMenuTabPanel.js +3 -3
  57. package/lib/SelectMenu/SelectMenuTabs.js +2 -2
  58. package/lib/SelectMenu/hooks/useKeyboardNav.js +0 -2
  59. package/lib/SideNav.js +12 -20
  60. package/lib/StateLabel.js +4 -4
  61. package/lib/SubNav.js +3 -5
  62. package/lib/TabNav.js +3 -3
  63. package/lib/TextInput.js +19 -24
  64. package/lib/ThemeProvider.js +15 -32
  65. package/lib/Timeline.js +29 -24
  66. package/lib/Tooltip.js +1 -2
  67. package/lib/UnderlineNav.js +2 -2
  68. package/lib/behaviors/anchoredPosition.js +9 -17
  69. package/lib/behaviors/focusTrap.js +14 -32
  70. package/lib/behaviors/focusZone.js +148 -218
  71. package/lib/constants.js +2 -3
  72. package/lib/hooks/index.js +1 -9
  73. package/lib/hooks/useAnchoredPosition.js +4 -11
  74. package/lib/hooks/useDialog.js +1 -1
  75. package/lib/hooks/useFocusTrap.js +8 -26
  76. package/lib/hooks/useFocusZone.js +7 -7
  77. package/lib/hooks/useMouseIntent.js +58 -0
  78. package/lib/hooks/useOnEscapePress.js +10 -53
  79. package/lib/hooks/useOnOutsideClick.js +35 -62
  80. package/lib/hooks/useOpenAndCloseFocus.js +1 -1
  81. package/lib/hooks/useOverlay.js +17 -5
  82. package/lib/hooks/useSafeTimeout.js +0 -1
  83. package/lib/index.js +12 -76
  84. package/lib/polyfills/eventListenerSignal.js +1 -6
  85. package/lib/stories/Button.stories.js +114 -0
  86. package/lib/stories/Overlay.stories.js +102 -0
  87. package/lib/stories/Portal.stories.js +108 -0
  88. package/lib/stories/ThemeProvider.stories.js +95 -0
  89. package/lib/stories/useAnchoredPosition.stories.js +349 -0
  90. package/lib/stories/useFocusTrap.stories.js +278 -0
  91. package/lib/stories/useFocusZone.stories.js +490 -0
  92. package/lib/theme-preval.js +2057 -5148
  93. package/lib/utils/deprecate.js +2 -3
  94. package/lib/utils/isNumeric.js +0 -1
  95. package/lib/utils/iterateFocusableElements.js +1 -1
  96. package/lib/utils/test-deprecations.js +0 -1
  97. package/lib/utils/test-matchers.js +12 -3
  98. package/lib/utils/testing.js +4 -4
  99. package/lib/utils/theme.js +1 -1
  100. package/lib/utils/uniqueId.js +0 -1
  101. package/lib-esm/AvatarPair.js +5 -6
  102. package/lib-esm/AvatarStack.js +11 -11
  103. package/lib-esm/BaseStyles.js +16 -16
  104. package/lib-esm/BorderBox.js +3 -5
  105. package/lib-esm/Box.js +2 -2
  106. package/lib-esm/BranchName.js +1 -1
  107. package/lib-esm/{Breadcrumbs.js → Breadcrumb.js} +22 -32
  108. package/lib-esm/Button/Button.js +1 -1
  109. package/lib-esm/Button/ButtonClose.js +2 -2
  110. package/lib-esm/Button/ButtonInvisible.js +1 -1
  111. package/lib-esm/Button/ButtonTableList.js +1 -1
  112. package/lib-esm/CircleBadge.js +1 -1
  113. package/lib-esm/CircleOcticon.js +6 -9
  114. package/lib-esm/CounterLabel.js +2 -2
  115. package/lib-esm/Dialog.js +12 -10
  116. package/lib-esm/Dropdown.js +2 -2
  117. package/lib-esm/DropdownStyles.js +6 -6
  118. package/lib-esm/FilterList.js +1 -1
  119. package/lib-esm/Flash.js +1 -1
  120. package/lib-esm/Flex.js +0 -4
  121. package/lib-esm/Grid.js +2 -5
  122. package/lib-esm/Header.js +0 -1
  123. package/lib-esm/Label.js +2 -2
  124. package/lib-esm/Link.js +12 -1
  125. package/lib-esm/Overlay.js +37 -115
  126. package/lib-esm/Pagehead.js +1 -1
  127. package/lib-esm/Pagination/Pagination.js +2 -3
  128. package/lib-esm/Popover.js +3 -3
  129. package/lib-esm/Portal/Portal.js +12 -19
  130. package/lib-esm/Portal/index.js +1 -1
  131. package/lib-esm/Position.js +20 -45
  132. package/lib-esm/ProgressBar.js +1 -1
  133. package/lib-esm/SelectMenu/SelectMenu.js +3 -3
  134. package/lib-esm/SelectMenu/SelectMenuContext.js +1 -1
  135. package/lib-esm/SelectMenu/SelectMenuDivider.js +1 -1
  136. package/lib-esm/SelectMenu/SelectMenuFilter.js +4 -4
  137. package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
  138. package/lib-esm/SelectMenu/SelectMenuHeader.js +2 -2
  139. package/lib-esm/SelectMenu/SelectMenuItem.js +2 -2
  140. package/lib-esm/SelectMenu/SelectMenuList.js +1 -1
  141. package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.js +10 -5
  142. package/lib-esm/SelectMenu/SelectMenuModal.js +5 -5
  143. package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
  144. package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
  145. package/lib-esm/SelectMenu/hooks/useKeyboardNav.js +0 -2
  146. package/lib-esm/SideNav.js +7 -16
  147. package/lib-esm/StateLabel.js +4 -4
  148. package/lib-esm/SubNav.js +4 -7
  149. package/lib-esm/TabNav.js +4 -5
  150. package/lib-esm/TextInput.js +17 -23
  151. package/lib-esm/ThemeProvider.js +16 -31
  152. package/lib-esm/Timeline.js +24 -19
  153. package/lib-esm/Tooltip.js +1 -2
  154. package/lib-esm/UnderlineNav.js +3 -4
  155. package/lib-esm/behaviors/anchoredPosition.js +9 -17
  156. package/lib-esm/behaviors/focusTrap.js +14 -32
  157. package/lib-esm/behaviors/focusZone.js +148 -213
  158. package/lib-esm/constants.js +1 -2
  159. package/lib-esm/hooks/index.js +1 -2
  160. package/lib-esm/hooks/useAnchoredPosition.js +5 -10
  161. package/lib-esm/hooks/useDialog.js +1 -1
  162. package/lib-esm/hooks/useFocusTrap.js +8 -25
  163. package/lib-esm/hooks/useFocusZone.js +5 -5
  164. package/lib-esm/hooks/useMouseIntent.js +50 -0
  165. package/lib-esm/hooks/useOnEscapePress.js +10 -53
  166. package/lib-esm/hooks/useOnOutsideClick.js +37 -62
  167. package/lib-esm/hooks/useOpenAndCloseFocus.js +1 -1
  168. package/lib-esm/hooks/useOverlay.js +16 -5
  169. package/lib-esm/hooks/useSafeTimeout.js +0 -1
  170. package/lib-esm/index.js +10 -19
  171. package/lib-esm/polyfills/eventListenerSignal.js +1 -6
  172. package/lib-esm/stories/Button.stories.js +79 -0
  173. package/lib-esm/stories/Overlay.stories.js +80 -0
  174. package/lib-esm/stories/Portal.stories.js +72 -0
  175. package/lib-esm/stories/ThemeProvider.stories.js +76 -0
  176. package/lib-esm/stories/useAnchoredPosition.stories.js +311 -0
  177. package/lib-esm/stories/useFocusTrap.stories.js +234 -0
  178. package/lib-esm/stories/useFocusZone.stories.js +445 -0
  179. package/lib-esm/theme-preval.js +2057 -5148
  180. package/lib-esm/utils/deprecate.js +2 -3
  181. package/lib-esm/utils/isNumeric.js +0 -1
  182. package/lib-esm/utils/iterateFocusableElements.js +1 -1
  183. package/lib-esm/utils/test-deprecations.js +1 -1
  184. package/lib-esm/utils/test-matchers.js +11 -3
  185. package/lib-esm/utils/testing.js +6 -6
  186. package/lib-esm/utils/theme.js +1 -1
  187. package/lib-esm/utils/types.js +0 -1
  188. package/lib-esm/utils/uniqueId.js +0 -1
  189. package/package.json +95 -103
  190. package/codemods/__tests__/deprecateUtilityComponents.js +0 -200
  191. package/codemods/__tests__/removeSystemProps.js +0 -225
  192. package/codemods/deprecateUtilityComponents.js +0 -111
  193. package/codemods/removeSystemProps.js +0 -312
  194. package/lib/ActionList/Divider.d.ts +0 -9
  195. package/lib/ActionList/Divider.js +0 -40
  196. package/lib/ActionList/Group.d.ts +0 -28
  197. package/lib/ActionList/Group.js +0 -35
  198. package/lib/ActionList/Header.d.ts +0 -29
  199. package/lib/ActionList/Header.js +0 -51
  200. package/lib/ActionList/Item.d.ts +0 -92
  201. package/lib/ActionList/Item.js +0 -288
  202. package/lib/ActionList/List.d.ts +0 -87
  203. package/lib/ActionList/List.js +0 -199
  204. package/lib/ActionList/index.d.ts +0 -17
  205. package/lib/ActionList/index.js +0 -29
  206. package/lib/ActionMenu.d.ts +0 -40
  207. package/lib/ActionMenu.js +0 -103
  208. package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +0 -61
  209. package/lib/AnchoredOverlay/AnchoredOverlay.js +0 -116
  210. package/lib/AnchoredOverlay/index.d.ts +0 -2
  211. package/lib/AnchoredOverlay/index.js +0 -13
  212. package/lib/Avatar.d.ts +0 -15
  213. package/lib/AvatarPair.d.ts +0 -8
  214. package/lib/AvatarStack.d.ts +0 -8
  215. package/lib/BaseStyles.d.ts +0 -14
  216. package/lib/BorderBox.d.ts +0 -7
  217. package/lib/Box.d.ts +0 -6
  218. package/lib/BranchName.d.ts +0 -6
  219. package/lib/Breadcrumbs.d.ts +0 -40
  220. package/lib/Button/Button.d.ts +0 -284
  221. package/lib/Button/ButtonBase.d.ts +0 -12
  222. package/lib/Button/ButtonClose.d.ts +0 -321
  223. package/lib/Button/ButtonDanger.d.ts +0 -284
  224. package/lib/Button/ButtonGroup.d.ts +0 -4
  225. package/lib/Button/ButtonInvisible.d.ts +0 -284
  226. package/lib/Button/ButtonOutline.d.ts +0 -284
  227. package/lib/Button/ButtonPrimary.d.ts +0 -284
  228. package/lib/Button/ButtonStyles.d.ts +0 -2
  229. package/lib/Button/ButtonTableList.d.ts +0 -6
  230. package/lib/Button/index.d.ts +0 -16
  231. package/lib/Caret.d.ts +0 -21
  232. package/lib/CircleBadge.d.ts +0 -25
  233. package/lib/CircleOcticon.d.ts +0 -391
  234. package/lib/CounterLabel.d.ts +0 -8
  235. package/lib/DatePicker/DatePicker.d.ts +0 -35
  236. package/lib/DatePicker/DatePicker.js +0 -37
  237. package/lib/DatePicker/DatePickerPanel.d.ts +0 -0
  238. package/lib/DatePicker/DatePickerPanel.js +0 -1
  239. package/lib/DatePicker/Day.d.ts +0 -12
  240. package/lib/DatePicker/Day.js +0 -44
  241. package/lib/DatePicker/Month.d.ts +0 -10
  242. package/lib/DatePicker/Month.js +0 -28
  243. package/lib/DatePicker/index.d.ts +0 -2
  244. package/lib/DatePicker/index.js +0 -13
  245. package/lib/Details.d.ts +0 -6
  246. package/lib/Dialog/ConfirmationDialog.d.ts +0 -44
  247. package/lib/Dialog/ConfirmationDialog.js +0 -191
  248. package/lib/Dialog/Dialog.d.ts +0 -167
  249. package/lib/Dialog/Dialog.js +0 -304
  250. package/lib/Dialog.d.ts +0 -406
  251. package/lib/Dropdown.d.ts +0 -1262
  252. package/lib/DropdownMenu/DropdownButton.d.ts +0 -323
  253. package/lib/DropdownMenu/DropdownButton.js +0 -31
  254. package/lib/DropdownMenu/DropdownMenu.d.ts +0 -43
  255. package/lib/DropdownMenu/DropdownMenu.js +0 -94
  256. package/lib/DropdownMenu/index.d.ts +0 -4
  257. package/lib/DropdownMenu/index.js +0 -21
  258. package/lib/DropdownStyles.d.ts +0 -3
  259. package/lib/FilterList.d.ts +0 -321
  260. package/lib/FilteredActionList/FilteredActionList.d.ts +0 -16
  261. package/lib/FilteredActionList/FilteredActionList.js +0 -163
  262. package/lib/FilteredActionList/index.d.ts +0 -2
  263. package/lib/FilteredActionList/index.js +0 -13
  264. package/lib/FilteredSearch.d.ts +0 -6
  265. package/lib/Flash.d.ts +0 -9
  266. package/lib/Flex.d.ts +0 -7
  267. package/lib/FormGroup.d.ts +0 -12
  268. package/lib/Grid.d.ts +0 -7
  269. package/lib/Header.d.ts +0 -24
  270. package/lib/Heading.d.ts +0 -6
  271. package/lib/Label.d.ts +0 -11
  272. package/lib/LabelGroup.d.ts +0 -6
  273. package/lib/Link.d.ts +0 -10
  274. package/lib/Overlay.d.ts +0 -62
  275. package/lib/Pagehead.d.ts +0 -6
  276. package/lib/Pagination/Pagination.d.ts +0 -24
  277. package/lib/Pagination/index.d.ts +0 -3
  278. package/lib/Pagination/model.d.ts +0 -26
  279. package/lib/PointerBox.d.ts +0 -11
  280. package/lib/Popover.d.ts +0 -21
  281. package/lib/Portal/Portal.d.ts +0 -25
  282. package/lib/Portal/index.d.ts +0 -4
  283. package/lib/Position.d.ts +0 -34
  284. package/lib/ProgressBar.d.ts +0 -21
  285. package/lib/SelectMenu/SelectMenu.d.ts +0 -1832
  286. package/lib/SelectMenu/SelectMenuContext.d.ts +0 -8
  287. package/lib/SelectMenu/SelectMenuDivider.d.ts +0 -6
  288. package/lib/SelectMenu/SelectMenuFilter.d.ts +0 -9
  289. package/lib/SelectMenu/SelectMenuFooter.d.ts +0 -6
  290. package/lib/SelectMenu/SelectMenuHeader.d.ts +0 -11
  291. package/lib/SelectMenu/SelectMenuItem.d.ts +0 -15
  292. package/lib/SelectMenu/SelectMenuList.d.ts +0 -6
  293. package/lib/SelectMenu/SelectMenuLoadingAnimation.d.ts +0 -7
  294. package/lib/SelectMenu/SelectMenuModal.d.ts +0 -15
  295. package/lib/SelectMenu/SelectMenuTab.d.ts +0 -14
  296. package/lib/SelectMenu/SelectMenuTabPanel.d.ts +0 -13
  297. package/lib/SelectMenu/SelectMenuTabs.d.ts +0 -11
  298. package/lib/SelectMenu/hooks/useKeyboardNav.d.ts +0 -2
  299. package/lib/SelectMenu/index.d.ts +0 -2
  300. package/lib/SelectPanel/SelectPanel.d.ts +0 -25
  301. package/lib/SelectPanel/SelectPanel.js +0 -147
  302. package/lib/SelectPanel/index.d.ts +0 -2
  303. package/lib/SelectPanel/index.js +0 -13
  304. package/lib/SideNav.d.ts +0 -31
  305. package/lib/Spinner.d.ts +0 -17
  306. package/lib/Spinner.js +0 -60
  307. package/lib/StateLabel.d.ts +0 -16
  308. package/lib/StyledOcticon.d.ts +0 -12
  309. package/lib/SubNav.d.ts +0 -32
  310. package/lib/TabNav.d.ts +0 -20
  311. package/lib/Text.d.ts +0 -6
  312. package/lib/TextInput.d.ts +0 -22
  313. package/lib/ThemeProvider.d.ts +0 -26
  314. package/lib/Timeline.d.ts +0 -407
  315. package/lib/Tooltip.d.ts +0 -18
  316. package/lib/Truncate.d.ts +0 -11
  317. package/lib/UnderlineNav.d.ts +0 -25
  318. package/lib/behaviors/anchoredPosition.d.ts +0 -89
  319. package/lib/behaviors/focusTrap.d.ts +0 -12
  320. package/lib/behaviors/focusZone.d.ts +0 -137
  321. package/lib/constants.d.ts +0 -20
  322. package/lib/hooks/index.d.ts +0 -11
  323. package/lib/hooks/useAnchoredPosition.d.ts +0 -20
  324. package/lib/hooks/useCombinedRefs.d.ts +0 -10
  325. package/lib/hooks/useCombinedRefs.js +0 -49
  326. package/lib/hooks/useDetails.d.ts +0 -17
  327. package/lib/hooks/useDialog.d.ts +0 -16
  328. package/lib/hooks/useFocusTrap.d.ts +0 -32
  329. package/lib/hooks/useFocusZone.d.ts +0 -23
  330. package/lib/hooks/useOnEscapePress.d.ts +0 -23
  331. package/lib/hooks/useOnOutsideClick.d.ts +0 -8
  332. package/lib/hooks/useOpenAndCloseFocus.d.ts +0 -7
  333. package/lib/hooks/useOverlay.d.ts +0 -14
  334. package/lib/hooks/useProvidedRefOrCreate.d.ts +0 -10
  335. package/lib/hooks/useProvidedStateOrCreate.d.ts +0 -10
  336. package/lib/hooks/useProvidedStateOrCreate.js +0 -27
  337. package/lib/hooks/useRenderForcingRef.d.ts +0 -8
  338. package/lib/hooks/useRenderForcingRef.js +0 -25
  339. package/lib/hooks/useResizeObserver.d.ts +0 -1
  340. package/lib/hooks/useResizeObserver.js +0 -20
  341. package/lib/hooks/useSafeTimeout.d.ts +0 -12
  342. package/lib/hooks/useScrollFlash.d.ts +0 -6
  343. package/lib/hooks/useScrollFlash.js +0 -29
  344. package/lib/index.d.ts +0 -111
  345. package/lib/polyfills/eventListenerSignal.d.ts +0 -6
  346. package/lib/sx.d.ts +0 -6
  347. package/lib/theme-preval.d.ts +0 -49
  348. package/lib/theme.d.ts +0 -2
  349. package/lib/utils/deprecate.d.ts +0 -18
  350. package/lib/utils/isNumeric.d.ts +0 -1
  351. package/lib/utils/iterateFocusableElements.d.ts +0 -42
  352. package/lib/utils/ssr.d.ts +0 -1
  353. package/lib/utils/ssr.js +0 -19
  354. package/lib/utils/test-deprecations.d.ts +0 -1
  355. package/lib/utils/test-helpers.d.ts +0 -0
  356. package/lib/utils/test-helpers.js +0 -9
  357. package/lib/utils/test-matchers.d.ts +0 -1
  358. package/lib/utils/testing.d.ts +0 -1028
  359. package/lib/utils/theme.d.ts +0 -9
  360. package/lib/utils/types.d.ts +0 -14
  361. package/lib/utils/uniqueId.d.ts +0 -1
  362. package/lib/utils/userAgent.d.ts +0 -1
  363. package/lib-esm/ActionList/Divider.d.ts +0 -9
  364. package/lib-esm/ActionList/Divider.js +0 -23
  365. package/lib-esm/ActionList/Group.d.ts +0 -28
  366. package/lib-esm/ActionList/Group.js +0 -24
  367. package/lib-esm/ActionList/Header.d.ts +0 -29
  368. package/lib-esm/ActionList/Header.js +0 -33
  369. package/lib-esm/ActionList/Item.d.ts +0 -92
  370. package/lib-esm/ActionList/Item.js +0 -253
  371. package/lib-esm/ActionList/List.d.ts +0 -87
  372. package/lib-esm/ActionList/List.js +0 -181
  373. package/lib-esm/ActionList/index.d.ts +0 -17
  374. package/lib-esm/ActionList/index.js +0 -18
  375. package/lib-esm/ActionMenu.d.ts +0 -40
  376. package/lib-esm/ActionMenu.js +0 -82
  377. package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +0 -61
  378. package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +0 -96
  379. package/lib-esm/AnchoredOverlay/index.d.ts +0 -2
  380. package/lib-esm/AnchoredOverlay/index.js +0 -1
  381. package/lib-esm/Avatar.d.ts +0 -15
  382. package/lib-esm/AvatarPair.d.ts +0 -8
  383. package/lib-esm/AvatarStack.d.ts +0 -8
  384. package/lib-esm/BaseStyles.d.ts +0 -14
  385. package/lib-esm/BorderBox.d.ts +0 -7
  386. package/lib-esm/Box.d.ts +0 -6
  387. package/lib-esm/BranchName.d.ts +0 -6
  388. package/lib-esm/Breadcrumbs.d.ts +0 -40
  389. package/lib-esm/Button/Button.d.ts +0 -284
  390. package/lib-esm/Button/ButtonBase.d.ts +0 -12
  391. package/lib-esm/Button/ButtonClose.d.ts +0 -321
  392. package/lib-esm/Button/ButtonDanger.d.ts +0 -284
  393. package/lib-esm/Button/ButtonGroup.d.ts +0 -4
  394. package/lib-esm/Button/ButtonInvisible.d.ts +0 -284
  395. package/lib-esm/Button/ButtonOutline.d.ts +0 -284
  396. package/lib-esm/Button/ButtonPrimary.d.ts +0 -284
  397. package/lib-esm/Button/ButtonStyles.d.ts +0 -2
  398. package/lib-esm/Button/ButtonTableList.d.ts +0 -6
  399. package/lib-esm/Button/index.d.ts +0 -16
  400. package/lib-esm/Caret.d.ts +0 -21
  401. package/lib-esm/CircleBadge.d.ts +0 -25
  402. package/lib-esm/CircleOcticon.d.ts +0 -391
  403. package/lib-esm/CounterLabel.d.ts +0 -8
  404. package/lib-esm/DatePicker/DatePicker.d.ts +0 -35
  405. package/lib-esm/DatePicker/DatePicker.js +0 -24
  406. package/lib-esm/DatePicker/DatePickerPanel.d.ts +0 -0
  407. package/lib-esm/DatePicker/DatePickerPanel.js +0 -0
  408. package/lib-esm/DatePicker/Day.d.ts +0 -12
  409. package/lib-esm/DatePicker/Day.js +0 -26
  410. package/lib-esm/DatePicker/Month.d.ts +0 -10
  411. package/lib-esm/DatePicker/Month.js +0 -13
  412. package/lib-esm/DatePicker/index.d.ts +0 -2
  413. package/lib-esm/DatePicker/index.js +0 -1
  414. package/lib-esm/Details.d.ts +0 -6
  415. package/lib-esm/Dialog/ConfirmationDialog.d.ts +0 -44
  416. package/lib-esm/Dialog/ConfirmationDialog.js +0 -169
  417. package/lib-esm/Dialog/Dialog.d.ts +0 -167
  418. package/lib-esm/Dialog/Dialog.js +0 -274
  419. package/lib-esm/Dialog.d.ts +0 -406
  420. package/lib-esm/Dropdown.d.ts +0 -1262
  421. package/lib-esm/DropdownMenu/DropdownButton.d.ts +0 -323
  422. package/lib-esm/DropdownMenu/DropdownButton.js +0 -16
  423. package/lib-esm/DropdownMenu/DropdownMenu.d.ts +0 -43
  424. package/lib-esm/DropdownMenu/DropdownMenu.js +0 -77
  425. package/lib-esm/DropdownMenu/index.d.ts +0 -4
  426. package/lib-esm/DropdownMenu/index.js +0 -2
  427. package/lib-esm/DropdownStyles.d.ts +0 -3
  428. package/lib-esm/FilterList.d.ts +0 -321
  429. package/lib-esm/FilteredActionList/FilteredActionList.d.ts +0 -16
  430. package/lib-esm/FilteredActionList/FilteredActionList.js +0 -137
  431. package/lib-esm/FilteredActionList/index.d.ts +0 -2
  432. package/lib-esm/FilteredActionList/index.js +0 -1
  433. package/lib-esm/FilteredSearch.d.ts +0 -6
  434. package/lib-esm/Flash.d.ts +0 -9
  435. package/lib-esm/Flex.d.ts +0 -7
  436. package/lib-esm/FormGroup.d.ts +0 -12
  437. package/lib-esm/Grid.d.ts +0 -7
  438. package/lib-esm/Header.d.ts +0 -24
  439. package/lib-esm/Heading.d.ts +0 -6
  440. package/lib-esm/Label.d.ts +0 -11
  441. package/lib-esm/LabelGroup.d.ts +0 -6
  442. package/lib-esm/Link.d.ts +0 -10
  443. package/lib-esm/Overlay.d.ts +0 -62
  444. package/lib-esm/Pagehead.d.ts +0 -6
  445. package/lib-esm/Pagination/Pagination.d.ts +0 -24
  446. package/lib-esm/Pagination/index.d.ts +0 -3
  447. package/lib-esm/Pagination/model.d.ts +0 -26
  448. package/lib-esm/PointerBox.d.ts +0 -11
  449. package/lib-esm/Popover.d.ts +0 -21
  450. package/lib-esm/Portal/Portal.d.ts +0 -25
  451. package/lib-esm/Portal/index.d.ts +0 -4
  452. package/lib-esm/Position.d.ts +0 -34
  453. package/lib-esm/ProgressBar.d.ts +0 -21
  454. package/lib-esm/SelectMenu/SelectMenu.d.ts +0 -1832
  455. package/lib-esm/SelectMenu/SelectMenuContext.d.ts +0 -8
  456. package/lib-esm/SelectMenu/SelectMenuDivider.d.ts +0 -6
  457. package/lib-esm/SelectMenu/SelectMenuFilter.d.ts +0 -9
  458. package/lib-esm/SelectMenu/SelectMenuFooter.d.ts +0 -6
  459. package/lib-esm/SelectMenu/SelectMenuHeader.d.ts +0 -11
  460. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +0 -15
  461. package/lib-esm/SelectMenu/SelectMenuList.d.ts +0 -6
  462. package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.d.ts +0 -7
  463. package/lib-esm/SelectMenu/SelectMenuModal.d.ts +0 -15
  464. package/lib-esm/SelectMenu/SelectMenuTab.d.ts +0 -14
  465. package/lib-esm/SelectMenu/SelectMenuTabPanel.d.ts +0 -13
  466. package/lib-esm/SelectMenu/SelectMenuTabs.d.ts +0 -11
  467. package/lib-esm/SelectMenu/hooks/useKeyboardNav.d.ts +0 -2
  468. package/lib-esm/SelectMenu/index.d.ts +0 -2
  469. package/lib-esm/SelectPanel/SelectPanel.d.ts +0 -25
  470. package/lib-esm/SelectPanel/SelectPanel.js +0 -127
  471. package/lib-esm/SelectPanel/index.d.ts +0 -2
  472. package/lib-esm/SelectPanel/index.js +0 -1
  473. package/lib-esm/SideNav.d.ts +0 -31
  474. package/lib-esm/Spinner.d.ts +0 -17
  475. package/lib-esm/Spinner.js +0 -46
  476. package/lib-esm/StateLabel.d.ts +0 -16
  477. package/lib-esm/StyledOcticon.d.ts +0 -12
  478. package/lib-esm/SubNav.d.ts +0 -32
  479. package/lib-esm/TabNav.d.ts +0 -20
  480. package/lib-esm/Text.d.ts +0 -6
  481. package/lib-esm/TextInput.d.ts +0 -22
  482. package/lib-esm/ThemeProvider.d.ts +0 -26
  483. package/lib-esm/Timeline.d.ts +0 -407
  484. package/lib-esm/Tooltip.d.ts +0 -18
  485. package/lib-esm/Truncate.d.ts +0 -11
  486. package/lib-esm/UnderlineNav.d.ts +0 -25
  487. package/lib-esm/behaviors/anchoredPosition.d.ts +0 -89
  488. package/lib-esm/behaviors/focusTrap.d.ts +0 -12
  489. package/lib-esm/behaviors/focusZone.d.ts +0 -137
  490. package/lib-esm/constants.d.ts +0 -20
  491. package/lib-esm/hooks/index.d.ts +0 -11
  492. package/lib-esm/hooks/useAnchoredPosition.d.ts +0 -20
  493. package/lib-esm/hooks/useCombinedRefs.d.ts +0 -10
  494. package/lib-esm/hooks/useCombinedRefs.js +0 -36
  495. package/lib-esm/hooks/useDetails.d.ts +0 -17
  496. package/lib-esm/hooks/useDialog.d.ts +0 -16
  497. package/lib-esm/hooks/useFocusTrap.d.ts +0 -32
  498. package/lib-esm/hooks/useFocusZone.d.ts +0 -23
  499. package/lib-esm/hooks/useOnEscapePress.d.ts +0 -23
  500. package/lib-esm/hooks/useOnOutsideClick.d.ts +0 -8
  501. package/lib-esm/hooks/useOpenAndCloseFocus.d.ts +0 -7
  502. package/lib-esm/hooks/useOverlay.d.ts +0 -14
  503. package/lib-esm/hooks/useProvidedRefOrCreate.d.ts +0 -10
  504. package/lib-esm/hooks/useProvidedStateOrCreate.d.ts +0 -10
  505. package/lib-esm/hooks/useProvidedStateOrCreate.js +0 -20
  506. package/lib-esm/hooks/useRenderForcingRef.d.ts +0 -8
  507. package/lib-esm/hooks/useRenderForcingRef.js +0 -18
  508. package/lib-esm/hooks/useResizeObserver.d.ts +0 -1
  509. package/lib-esm/hooks/useResizeObserver.js +0 -10
  510. package/lib-esm/hooks/useSafeTimeout.d.ts +0 -12
  511. package/lib-esm/hooks/useScrollFlash.d.ts +0 -6
  512. package/lib-esm/hooks/useScrollFlash.js +0 -22
  513. package/lib-esm/index.d.ts +0 -111
  514. package/lib-esm/polyfills/eventListenerSignal.d.ts +0 -6
  515. package/lib-esm/sx.d.ts +0 -6
  516. package/lib-esm/theme-preval.d.ts +0 -49
  517. package/lib-esm/theme.d.ts +0 -2
  518. package/lib-esm/utils/deprecate.d.ts +0 -18
  519. package/lib-esm/utils/isNumeric.d.ts +0 -1
  520. package/lib-esm/utils/iterateFocusableElements.d.ts +0 -42
  521. package/lib-esm/utils/ssr.d.ts +0 -1
  522. package/lib-esm/utils/ssr.js +0 -1
  523. package/lib-esm/utils/test-deprecations.d.ts +0 -1
  524. package/lib-esm/utils/test-helpers.d.ts +0 -0
  525. package/lib-esm/utils/test-helpers.js +0 -7
  526. package/lib-esm/utils/test-matchers.d.ts +0 -1
  527. package/lib-esm/utils/testing.d.ts +0 -1028
  528. package/lib-esm/utils/theme.d.ts +0 -9
  529. package/lib-esm/utils/types.d.ts +0 -14
  530. package/lib-esm/utils/uniqueId.d.ts +0 -1
  531. package/lib-esm/utils/userAgent.d.ts +0 -1
@@ -8,7 +8,7 @@ import sx from './sx';
8
8
  const TooltipBase = styled.span.withConfig({
9
9
  displayName: "Tooltip__TooltipBase",
10
10
  componentId: "kp39nc-0"
11
- })(["position:relative;&::before{position:absolute;z-index:1000001;display:none;width:0px;height:0px;color:", ";pointer-events:none;content:'';border:6px solid transparent;opacity:0;}&::after{position:absolute;z-index:1000000;display:none;padding:0.5em 0.75em;font:normal normal 11px/1.5 ", ";-webkit-font-smoothing:subpixel-antialiased;color:", ";text-align:center;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:", ";border-radius:", ";opacity:0;}@keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}&:hover,&:active,&:focus{&::before,&::after{display:inline-block;text-decoration:none;animation-name:tooltip-appear;animation-duration:0.1s;animation-fill-mode:forwards;animation-timing-function:ease-in;animation-delay:0.4s;}}&.tooltipped-no-delay:hover,&.tooltipped-no-delay:active,&.tooltipped-no-delay:focus{&::before,&::after{animation-delay:0s;}}&.tooltipped-multiline:hover,&.tooltipped-multiline:active,&.tooltipped-multiline:focus{&::after{display:table-cell;}}&.tooltipped-s,&.tooltipped-se,&.tooltipped-sw{&::after{top:100%;right:50%;margin-top:6px;}&::before{top:auto;right:50%;bottom:-7px;margin-right:-6px;border-bottom-color:", ";}}&.tooltipped-se{&::after{right:auto;left:50%;margin-left:-", ";}}&.tooltipped-sw::after{margin-right:-", ";}&.tooltipped-n,&.tooltipped-ne,&.tooltipped-nw{&::after{right:50%;bottom:100%;margin-bottom:6px;}&::before{top:-7px;right:50%;bottom:auto;margin-right:-6px;border-top-color:", ";}}&.tooltipped-ne{&::after{right:auto;left:50%;margin-left:-", ";}}&.tooltipped-nw::after{margin-right:-", ";}&.tooltipped-s::after,&.tooltipped-n::after{transform:translateX(50%);}&.tooltipped-w{&::after{right:100%;bottom:50%;margin-right:6px;transform:translateY(50%);}&::before{top:50%;bottom:50%;left:-7px;margin-top:-6px;border-left-color:", ";}}&.tooltipped-e{&::after{bottom:50%;left:100%;margin-left:6px;transform:translateY(50%);}&::before{top:50%;right:-7px;bottom:50%;margin-top:-6px;border-right-color:", ";}}&.tooltipped-multiline{&::after{width:max-content;max-width:250px;word-wrap:break-word;white-space:pre-line;border-collapse:separate;}&.tooltipped-s::after,&.tooltipped-n::after{right:auto;left:50%;transform:translateX(-50%);}&.tooltipped-w::after,&.tooltipped-e::after{right:100%;}}&.tooltipped-align-right-2::after{right:0;margin-right:0;}&.tooltipped-align-right-2::before{right:15px;}&.tooltipped-align-left-2::after{left:0;margin-left:0;}&.tooltipped-align-left-2::before{left:10px;}", ";", ";"], get('colors.neutral.emphasisPlus'), get('fonts.normal'), get('colors.fg.onEmphasis'), get('colors.neutral.emphasisPlus'), get('radii.1'), get('colors.neutral.emphasisPlus'), get('space.3'), get('space.3'), get('colors.neutral.emphasisPlus'), get('space.3'), get('space.3'), get('colors.neutral.emphasisPlus'), get('colors.neutral.emphasisPlus'), COMMON, sx);
11
+ })(["position:relative;&::before{position:absolute;z-index:1000001;display:none;width:0px;height:0px;color:", ";pointer-events:none;content:'';border:6px solid transparent;opacity:0;}&::after{position:absolute;z-index:1000000;display:none;padding:0.5em 0.75em;font:normal normal 11px/1.5 ", ";-webkit-font-smoothing:subpixel-antialiased;color:", ";text-align:center;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:", ";border-radius:", ";opacity:0;}@keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}&:hover,&:active,&:focus{&::before,&::after{display:inline-block;text-decoration:none;animation-name:tooltip-appear;animation-duration:0.1s;animation-fill-mode:forwards;animation-timing-function:ease-in;animation-delay:0.4s;}}&.tooltipped-no-delay:hover,&.tooltipped-no-delay:active,&.tooltipped-no-delay:focus{&::before,&::after{animation-delay:0s;}}&.tooltipped-multiline:hover,&.tooltipped-multiline:active,&.tooltipped-multiline:focus{&::after{display:table-cell;}}&.tooltipped-s,&.tooltipped-se,&.tooltipped-sw{&::after{top:100%;right:50%;margin-top:6px;}&::before{top:auto;right:50%;bottom:-7px;margin-right:-6px;border-bottom-color:", ";}}&.tooltipped-se{&::after{right:auto;left:50%;margin-left:-", ";}}&.tooltipped-sw::after{margin-right:-", ";}&.tooltipped-n,&.tooltipped-ne,&.tooltipped-nw{&::after{right:50%;bottom:100%;margin-bottom:6px;}&::before{top:-7px;right:50%;bottom:auto;margin-right:-6px;border-top-color:", ";}}&.tooltipped-ne{&::after{right:auto;left:50%;margin-left:-", ";}}&.tooltipped-nw::after{margin-right:-", ";}&.tooltipped-s::after,&.tooltipped-n::after{transform:translateX(50%);}&.tooltipped-w{&::after{right:100%;bottom:50%;margin-right:6px;transform:translateY(50%);}&::before{top:50%;bottom:50%;left:-7px;margin-top:-6px;border-left-color:", ";}}&.tooltipped-e{&::after{bottom:50%;left:100%;margin-left:6px;transform:translateY(50%);}&::before{top:50%;right:-7px;bottom:50%;margin-top:-6px;border-right-color:", ";}}&.tooltipped-multiline{&::after{width:max-content;max-width:250px;word-wrap:break-word;white-space:pre-line;border-collapse:separate;}&.tooltipped-s::after,&.tooltipped-n::after{right:auto;left:50%;transform:translateX(-50%);}&.tooltipped-w::after,&.tooltipped-e::after{right:100%;}}&.tooltipped-align-right-2::after{right:0;margin-right:0;}&.tooltipped-align-right-2::before{right:15px;}&.tooltipped-align-left-2::after{left:0;margin-left:0;}&.tooltipped-align-left-2::before{left:10px;}", ";", ";"], get('colors.tooltip.bg'), get('fonts.normal'), get('colors.tooltip.text'), get('colors.tooltip.bg'), get('radii.1'), get('colors.tooltip.bg'), get('space.3'), get('space.3'), get('colors.tooltip.bg'), get('space.3'), get('space.3'), get('colors.tooltip.bg'), get('colors.tooltip.bg'), COMMON, sx);
12
12
 
13
13
  function Tooltip({
14
14
  direction = 'n',
@@ -22,7 +22,6 @@ function Tooltip({
22
22
  }) {
23
23
  const classes = classnames(className, `tooltipped-${direction}`, align && `tooltipped-align-${align}-2`, noDelay && 'tooltipped-no-delay', wrap && 'tooltipped-multiline');
24
24
  return /*#__PURE__*/React.createElement(TooltipBase, _extends({
25
- role: "tooltip",
26
25
  "aria-label": text
27
26
  }, rest, {
28
27
  className: classes
@@ -1,7 +1,6 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- import classnames from 'classnames'; // eslint-disable-next-line import/no-namespace
4
-
3
+ import classnames from 'classnames';
5
4
  import React from 'react';
6
5
  import styled from 'styled-components';
7
6
  import { COMMON, get } from './constants';
@@ -11,7 +10,7 @@ const SELECTED_CLASS = 'selected';
11
10
  const UnderlineNavBase = styled.nav.withConfig({
12
11
  displayName: "UnderlineNav__UnderlineNavBase",
13
12
  componentId: "zrnxqt-0"
14
- })(["display:flex;justify-content:space-between;border-bottom:1px solid ", ";&.UnderlineNav--right{justify-content:flex-end;.UnderlineNav-item{margin-right:0;margin-left:", ";}.UnderlineNav-actions{flex:1 1 auto;}}&.UnderlineNav--full{display:block;}.UnderlineNav-body{display:flex;margin-bottom:-1px;}.UnderlineNav-actions{align-self:center;}", ";", ";"], get('colors.border.muted'), get('space.3'), COMMON, sx);
13
+ })(["display:flex;justify-content:space-between;border-bottom:1px solid ", ";&.UnderlineNav--right{justify-content:flex-end;.UnderlineNav-item{margin-right:0;margin-left:", ";}.UnderlineNav-actions{flex:1 1 auto;}}&.UnderlineNav--full{display:block;}.UnderlineNav-body{display:flex;margin-bottom:-1px;}.UnderlineNav-actions{align-self:center;}", ";", ";"], get('colors.border.secondary'), get('space.3'), COMMON, sx);
15
14
 
16
15
  function UnderlineNav({
17
16
  actions,
@@ -42,7 +41,7 @@ const UnderlineNavLink = styled.a.attrs(props => ({
42
41
  })).withConfig({
43
42
  displayName: "UnderlineNav__UnderlineNavLink",
44
43
  componentId: "zrnxqt-1"
45
- })(["padding:", " ", ";margin-right:", ";font-size:", ";line-height:", ";color:", ";text-align:center;border-bottom:2px solid transparent;text-decoration:none;&:hover,&:focus{color:", ";text-decoration:none;border-bottom-color:", ";transition:0.2s ease;.UnderlineNav-octicon{color:", ";}}&.selected{color:", ";border-bottom-color:", ";.UnderlineNav-octicon{color:", ";}}", ";", ";"], get('space.3'), get('space.2'), get('space.3'), get('fontSizes.1'), get('lineHeights.default'), get('colors.fg.default'), get('colors.fg.default'), get('colors.neutral.muted'), get('colors.fg.muted'), get('colors.fg.default'), get('colors.primer.border.active'), get('colors.fg.default'), COMMON, sx);
44
+ })(["padding:", " ", ";margin-right:", ";font-size:", ";line-height:", ";color:", ";text-align:center;border-bottom:2px solid transparent;text-decoration:none;&:hover,&:focus{color:", ";text-decoration:none;border-bottom-color:", ";transition:0.2s ease;.UnderlineNav-octicon{color:", ";}}&.selected{color:", ";border-bottom-color:", ";.UnderlineNav-octicon{color:", ";}}", ";", ";"], get('space.3'), get('space.2'), get('space.3'), get('fontSizes.1'), get('lineHeights.default'), get('colors.underlinenav.text'), get('colors.underlinenav.textHover'), get('colors.border.tertiary'), get('colors.text.tertiary'), get('colors.underlinenav.textActive'), get('colors.underlinenav.borderActive'), get('colors.underlinenav.iconActive'), COMMON, sx);
46
45
  UnderlineNavLink.displayName = 'UnderlineNav.Link';
47
46
  export default Object.assign(UnderlineNav, {
48
47
  Link: UnderlineNavLink
@@ -45,7 +45,7 @@ export function getAnchoredPosition(floatingElement, anchorElement, settings = {
45
45
  function getPositionedParent(element) {
46
46
  let parentNode = element.parentNode;
47
47
 
48
- while (parentNode !== null) {
48
+ while (parentNode != undefined) {
49
49
  if (parentNode instanceof HTMLElement && getComputedStyle(parentNode).position !== 'static') {
50
50
  return parentNode;
51
51
  }
@@ -58,15 +58,15 @@ function getPositionedParent(element) {
58
58
  /**
59
59
  * Returns the rectangle (relative to the window) that will clip the given element
60
60
  * if it is rendered outside of its bounds.
61
- * @param element
62
- * @returns
61
+ * @param element
62
+ * @returns
63
63
  */
64
64
 
65
65
 
66
66
  function getClippingRect(element) {
67
67
  let parentNode = element;
68
68
 
69
- while (parentNode !== null) {
69
+ while (parentNode != undefined) {
70
70
  if (parentNode === document.body) {
71
71
  break;
72
72
  }
@@ -152,7 +152,6 @@ function pureCalculateAnchoredPosition(viewportRect, relativePosition, floatingR
152
152
  height: viewportRect.height
153
153
  };
154
154
  let pos = calculatePosition(floatingRect, anchorRect, side, align, anchorOffset, alignmentOffset);
155
- let anchorSide = side;
156
155
  pos.top -= relativePosition.top;
157
156
  pos.left -= relativePosition.left; // Handle screen overflow
158
157
 
@@ -170,7 +169,6 @@ function pureCalculateAnchoredPosition(viewportRect, relativePosition, floatingR
170
169
  pos = calculatePosition(floatingRect, anchorRect, nextSide, align, anchorOffset, alignmentOffset);
171
170
  pos.top -= relativePosition.top;
172
171
  pos.left -= relativePosition.left;
173
- anchorSide = nextSide;
174
172
  }
175
173
  } // At this point we've flipped the position if applicable. Now just nudge until it's on-screen.
176
174
 
@@ -197,9 +195,7 @@ function pureCalculateAnchoredPosition(viewportRect, relativePosition, floatingR
197
195
  }
198
196
  }
199
197
 
200
- return { ...pos,
201
- anchorSide
202
- };
198
+ return pos;
203
199
  }
204
200
  /**
205
201
  * Given a floating element and an anchor element, return coordinates for the
@@ -237,8 +233,7 @@ function calculatePosition(elementDimensions, anchorPosition, side, align, ancho
237
233
  left = anchorPosition.left + alignmentOffset;
238
234
  } else if (align === 'center') {
239
235
  left = anchorPosition.left - (elementDimensions.width - anchorPosition.width) / 2 + alignmentOffset;
240
- } else {
241
- // end
236
+ } else if (align === 'end') {
242
237
  left = anchorRight - elementDimensions.width - alignmentOffset;
243
238
  }
244
239
  }
@@ -248,8 +243,7 @@ function calculatePosition(elementDimensions, anchorPosition, side, align, ancho
248
243
  top = anchorPosition.top + alignmentOffset;
249
244
  } else if (align === 'center') {
250
245
  top = anchorPosition.top - (elementDimensions.height - anchorPosition.height) / 2 + alignmentOffset;
251
- } else {
252
- // end
246
+ } else if (align === 'end') {
253
247
  top = anchorBottom - elementDimensions.height - alignmentOffset;
254
248
  }
255
249
  }
@@ -271,8 +265,7 @@ function calculatePosition(elementDimensions, anchorPosition, side, align, ancho
271
265
  left = anchorPosition.left + alignmentOffset;
272
266
  } else if (align === 'center') {
273
267
  left = anchorPosition.left - (elementDimensions.width - anchorPosition.width) / 2 + alignmentOffset;
274
- } else {
275
- // end
268
+ } else if (align === 'end') {
276
269
  left = anchorRight - elementDimensions.width - alignmentOffset;
277
270
  }
278
271
  } else if (side === 'inside-left' || side === 'inside-right' || side === 'inside-center') {
@@ -280,8 +273,7 @@ function calculatePosition(elementDimensions, anchorPosition, side, align, ancho
280
273
  top = anchorPosition.top + alignmentOffset;
281
274
  } else if (align === 'center') {
282
275
  top = anchorPosition.top - (elementDimensions.height - anchorPosition.height) / 2 + alignmentOffset;
283
- } else {
284
- // end
276
+ } else if (align === 'end') {
285
277
  top = anchorBottom - elementDimensions.height - alignmentOffset;
286
278
  }
287
279
  }
@@ -51,10 +51,11 @@ export function focusTrap(container, initialFocus, abortSignal) {
51
51
  let lastFocusedChild = undefined; // Ensure focus remains in the trap zone by checking that a given recently-focused
52
52
  // element is inside the trap zone. If it isn't, redirect focus to a suitable
53
53
  // element within the trap zone. If need to redirect focus and a suitable element
54
- // is not found, focus the container.
54
+ // is not found, blur the recently-focused element so that focus doesn't leave the
55
+ // trap zone.
55
56
 
56
57
  function ensureTrapZoneHasFocus(focusedElement) {
57
- if (focusedElement instanceof HTMLElement && document.contains(container)) {
58
+ if (focusedElement instanceof HTMLElement) {
58
59
  if (container.contains(focusedElement)) {
59
60
  // If a child of the trap zone was focused, remember it
60
61
  lastFocusedChild = focusedElement;
@@ -63,33 +64,16 @@ export function focusTrap(container, initialFocus, abortSignal) {
63
64
  if (lastFocusedChild && isTabbable(lastFocusedChild) && container.contains(lastFocusedChild)) {
64
65
  lastFocusedChild.focus();
65
66
  return;
66
- } else if (initialFocus && container.contains(initialFocus)) {
67
- initialFocus.focus();
68
- return;
69
67
  } else {
70
- // Ensure the container is focusable:
71
- // - Either the container already has a `tabIndex`
72
- // - Or provide a temporary `tabIndex`
73
- const containerNeedsTemporaryTabIndex = container.getAttribute('tabindex') === null;
74
-
75
- if (containerNeedsTemporaryTabIndex) {
76
- container.setAttribute('tabindex', '-1');
77
- } // Focus the container.
78
-
79
-
80
- container.focus(); // If a temporary `tabIndex` was provided, remove it.
81
-
82
- if (containerNeedsTemporaryTabIndex) {
83
- // Once focus has moved from the container to a child within the FocusTrap,
84
- // the container can be made un-refocusable by removing `tabIndex`.
85
- container.addEventListener('blur', () => container.removeAttribute('tabindex'), {
86
- once: true
87
- }); // NB: If `tabIndex` was removed *before* `blur`, then certain browsers (e.g. Chrome)
88
- // would consider `body` the `activeElement`, and as a result, keyboard navigation
89
- // between children would break, since `body` is outside the `FocusTrap`.
68
+ const toFocus = initialFocus && container.contains(initialFocus) ? initialFocus : getFocusableChild(container);
69
+
70
+ if (toFocus) {
71
+ toFocus.focus();
72
+ return;
73
+ } else {
74
+ // no element focusable within trap, blur the external element instead
75
+ focusedElement.blur();
90
76
  }
91
-
92
- return;
93
77
  }
94
78
  }
95
79
  }
@@ -141,12 +125,10 @@ export function focusTrap(container, initialFocus, abortSignal) {
141
125
  tryReactivate();
142
126
  }); // Prevent focus leaving the trap container
143
127
 
144
- document.addEventListener('focus', event => {
128
+ document.addEventListener('focusin', event => {
145
129
  ensureTrapZoneHasFocus(event.target);
146
- }, // use capture to ensure we get all events. focus events do not bubble
147
- {
148
- signal: wrappingController.signal,
149
- capture: true
130
+ }, {
131
+ signal: wrappingController.signal
150
132
  }); // focus the first element
151
133
 
152
134
  ensureTrapZoneHasFocus(document.activeElement);