@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.
- package/CHANGELOG.md +105 -492
- package/README.md +16 -16
- package/codemods/lib/modifyProps.js +7 -9
- package/codemods/lib/prettify.js +1 -1
- package/codemods/lib/replaceImportSource.js +5 -5
- package/dist/browser.esm.js +801 -1115
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +815 -1134
- package/dist/browser.umd.js.map +1 -1
- package/index.d.ts +940 -0
- package/lib/AvatarPair.js +5 -6
- package/lib/AvatarStack.js +10 -10
- package/lib/BaseStyles.js +19 -18
- package/lib/BorderBox.js +5 -4
- package/lib/Box.js +2 -2
- package/lib/BranchName.js +1 -1
- package/lib/{Breadcrumbs.js → Breadcrumb.js} +23 -33
- package/lib/Button/Button.js +3 -3
- package/lib/Button/ButtonClose.js +4 -4
- package/lib/Button/ButtonDanger.js +2 -2
- package/lib/Button/ButtonInvisible.js +3 -3
- package/lib/Button/ButtonOutline.js +2 -2
- package/lib/Button/ButtonPrimary.js +2 -2
- package/lib/Button/ButtonTableList.js +1 -1
- package/lib/CircleBadge.js +1 -1
- package/lib/CircleOcticon.js +7 -9
- package/lib/CounterLabel.js +2 -2
- package/lib/Dialog.js +14 -13
- package/lib/Dropdown.js +2 -2
- package/lib/DropdownStyles.js +6 -6
- package/lib/FilterList.js +1 -1
- package/lib/Flash.js +1 -1
- package/lib/Flex.js +0 -3
- package/lib/Grid.js +3 -4
- package/lib/Header.js +2 -3
- package/lib/Label.js +4 -4
- package/lib/Link.js +12 -1
- package/lib/Overlay.js +35 -120
- package/lib/Pagehead.js +1 -1
- package/lib/Pagination/Pagination.js +2 -3
- package/lib/Popover.js +3 -3
- package/lib/Portal/Portal.js +12 -20
- package/lib/Position.js +27 -46
- package/lib/ProgressBar.js +1 -1
- package/lib/SelectMenu/SelectMenu.js +4 -4
- package/lib/SelectMenu/SelectMenuContext.js +1 -1
- package/lib/SelectMenu/SelectMenuDivider.js +3 -3
- package/lib/SelectMenu/SelectMenuFilter.js +6 -6
- package/lib/SelectMenu/SelectMenuFooter.js +3 -3
- package/lib/SelectMenu/SelectMenuHeader.js +2 -2
- package/lib/SelectMenu/SelectMenuItem.js +4 -4
- package/lib/SelectMenu/SelectMenuList.js +3 -3
- package/lib/SelectMenu/SelectMenuLoadingAnimation.js +15 -4
- package/lib/SelectMenu/SelectMenuModal.js +7 -7
- package/lib/SelectMenu/SelectMenuTab.js +3 -3
- package/lib/SelectMenu/SelectMenuTabPanel.js +3 -3
- package/lib/SelectMenu/SelectMenuTabs.js +2 -2
- package/lib/SelectMenu/hooks/useKeyboardNav.js +0 -2
- package/lib/SideNav.js +12 -20
- package/lib/StateLabel.js +4 -4
- package/lib/SubNav.js +3 -5
- package/lib/TabNav.js +3 -3
- package/lib/TextInput.js +19 -24
- package/lib/ThemeProvider.js +15 -32
- package/lib/Timeline.js +29 -24
- package/lib/Tooltip.js +1 -2
- package/lib/UnderlineNav.js +2 -2
- package/lib/behaviors/anchoredPosition.js +9 -17
- package/lib/behaviors/focusTrap.js +14 -32
- package/lib/behaviors/focusZone.js +148 -218
- package/lib/constants.js +2 -3
- package/lib/hooks/index.js +1 -9
- package/lib/hooks/useAnchoredPosition.js +4 -11
- package/lib/hooks/useDialog.js +1 -1
- package/lib/hooks/useFocusTrap.js +8 -26
- package/lib/hooks/useFocusZone.js +7 -7
- package/lib/hooks/useMouseIntent.js +58 -0
- package/lib/hooks/useOnEscapePress.js +10 -53
- package/lib/hooks/useOnOutsideClick.js +35 -62
- package/lib/hooks/useOpenAndCloseFocus.js +1 -1
- package/lib/hooks/useOverlay.js +17 -5
- package/lib/hooks/useSafeTimeout.js +0 -1
- package/lib/index.js +12 -76
- package/lib/polyfills/eventListenerSignal.js +1 -6
- package/lib/stories/Button.stories.js +114 -0
- package/lib/stories/Overlay.stories.js +102 -0
- package/lib/stories/Portal.stories.js +108 -0
- package/lib/stories/ThemeProvider.stories.js +95 -0
- package/lib/stories/useAnchoredPosition.stories.js +349 -0
- package/lib/stories/useFocusTrap.stories.js +278 -0
- package/lib/stories/useFocusZone.stories.js +490 -0
- package/lib/theme-preval.js +2057 -5148
- package/lib/utils/deprecate.js +2 -3
- package/lib/utils/isNumeric.js +0 -1
- package/lib/utils/iterateFocusableElements.js +1 -1
- package/lib/utils/test-deprecations.js +0 -1
- package/lib/utils/test-matchers.js +12 -3
- package/lib/utils/testing.js +4 -4
- package/lib/utils/theme.js +1 -1
- package/lib/utils/uniqueId.js +0 -1
- package/lib-esm/AvatarPair.js +5 -6
- package/lib-esm/AvatarStack.js +11 -11
- package/lib-esm/BaseStyles.js +16 -16
- package/lib-esm/BorderBox.js +3 -5
- package/lib-esm/Box.js +2 -2
- package/lib-esm/BranchName.js +1 -1
- package/lib-esm/{Breadcrumbs.js → Breadcrumb.js} +22 -32
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/Button/ButtonClose.js +2 -2
- package/lib-esm/Button/ButtonInvisible.js +1 -1
- package/lib-esm/Button/ButtonTableList.js +1 -1
- package/lib-esm/CircleBadge.js +1 -1
- package/lib-esm/CircleOcticon.js +6 -9
- package/lib-esm/CounterLabel.js +2 -2
- package/lib-esm/Dialog.js +12 -10
- package/lib-esm/Dropdown.js +2 -2
- package/lib-esm/DropdownStyles.js +6 -6
- package/lib-esm/FilterList.js +1 -1
- package/lib-esm/Flash.js +1 -1
- package/lib-esm/Flex.js +0 -4
- package/lib-esm/Grid.js +2 -5
- package/lib-esm/Header.js +0 -1
- package/lib-esm/Label.js +2 -2
- package/lib-esm/Link.js +12 -1
- package/lib-esm/Overlay.js +37 -115
- package/lib-esm/Pagehead.js +1 -1
- package/lib-esm/Pagination/Pagination.js +2 -3
- package/lib-esm/Popover.js +3 -3
- package/lib-esm/Portal/Portal.js +12 -19
- package/lib-esm/Portal/index.js +1 -1
- package/lib-esm/Position.js +20 -45
- package/lib-esm/ProgressBar.js +1 -1
- package/lib-esm/SelectMenu/SelectMenu.js +3 -3
- package/lib-esm/SelectMenu/SelectMenuContext.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuDivider.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFilter.js +4 -4
- package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuHeader.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuItem.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuList.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.js +10 -5
- package/lib-esm/SelectMenu/SelectMenuModal.js +5 -5
- package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib-esm/SelectMenu/hooks/useKeyboardNav.js +0 -2
- package/lib-esm/SideNav.js +7 -16
- package/lib-esm/StateLabel.js +4 -4
- package/lib-esm/SubNav.js +4 -7
- package/lib-esm/TabNav.js +4 -5
- package/lib-esm/TextInput.js +17 -23
- package/lib-esm/ThemeProvider.js +16 -31
- package/lib-esm/Timeline.js +24 -19
- package/lib-esm/Tooltip.js +1 -2
- package/lib-esm/UnderlineNav.js +3 -4
- package/lib-esm/behaviors/anchoredPosition.js +9 -17
- package/lib-esm/behaviors/focusTrap.js +14 -32
- package/lib-esm/behaviors/focusZone.js +148 -213
- package/lib-esm/constants.js +1 -2
- package/lib-esm/hooks/index.js +1 -2
- package/lib-esm/hooks/useAnchoredPosition.js +5 -10
- package/lib-esm/hooks/useDialog.js +1 -1
- package/lib-esm/hooks/useFocusTrap.js +8 -25
- package/lib-esm/hooks/useFocusZone.js +5 -5
- package/lib-esm/hooks/useMouseIntent.js +50 -0
- package/lib-esm/hooks/useOnEscapePress.js +10 -53
- package/lib-esm/hooks/useOnOutsideClick.js +37 -62
- package/lib-esm/hooks/useOpenAndCloseFocus.js +1 -1
- package/lib-esm/hooks/useOverlay.js +16 -5
- package/lib-esm/hooks/useSafeTimeout.js +0 -1
- package/lib-esm/index.js +10 -19
- package/lib-esm/polyfills/eventListenerSignal.js +1 -6
- package/lib-esm/stories/Button.stories.js +79 -0
- package/lib-esm/stories/Overlay.stories.js +80 -0
- package/lib-esm/stories/Portal.stories.js +72 -0
- package/lib-esm/stories/ThemeProvider.stories.js +76 -0
- package/lib-esm/stories/useAnchoredPosition.stories.js +311 -0
- package/lib-esm/stories/useFocusTrap.stories.js +234 -0
- package/lib-esm/stories/useFocusZone.stories.js +445 -0
- package/lib-esm/theme-preval.js +2057 -5148
- package/lib-esm/utils/deprecate.js +2 -3
- package/lib-esm/utils/isNumeric.js +0 -1
- package/lib-esm/utils/iterateFocusableElements.js +1 -1
- package/lib-esm/utils/test-deprecations.js +1 -1
- package/lib-esm/utils/test-matchers.js +11 -3
- package/lib-esm/utils/testing.js +6 -6
- package/lib-esm/utils/theme.js +1 -1
- package/lib-esm/utils/types.js +0 -1
- package/lib-esm/utils/uniqueId.js +0 -1
- package/package.json +95 -103
- package/codemods/__tests__/deprecateUtilityComponents.js +0 -200
- package/codemods/__tests__/removeSystemProps.js +0 -225
- package/codemods/deprecateUtilityComponents.js +0 -111
- package/codemods/removeSystemProps.js +0 -312
- package/lib/ActionList/Divider.d.ts +0 -9
- package/lib/ActionList/Divider.js +0 -40
- package/lib/ActionList/Group.d.ts +0 -28
- package/lib/ActionList/Group.js +0 -35
- package/lib/ActionList/Header.d.ts +0 -29
- package/lib/ActionList/Header.js +0 -51
- package/lib/ActionList/Item.d.ts +0 -92
- package/lib/ActionList/Item.js +0 -288
- package/lib/ActionList/List.d.ts +0 -87
- package/lib/ActionList/List.js +0 -199
- package/lib/ActionList/index.d.ts +0 -17
- package/lib/ActionList/index.js +0 -29
- package/lib/ActionMenu.d.ts +0 -40
- package/lib/ActionMenu.js +0 -103
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +0 -61
- package/lib/AnchoredOverlay/AnchoredOverlay.js +0 -116
- package/lib/AnchoredOverlay/index.d.ts +0 -2
- package/lib/AnchoredOverlay/index.js +0 -13
- package/lib/Avatar.d.ts +0 -15
- package/lib/AvatarPair.d.ts +0 -8
- package/lib/AvatarStack.d.ts +0 -8
- package/lib/BaseStyles.d.ts +0 -14
- package/lib/BorderBox.d.ts +0 -7
- package/lib/Box.d.ts +0 -6
- package/lib/BranchName.d.ts +0 -6
- package/lib/Breadcrumbs.d.ts +0 -40
- package/lib/Button/Button.d.ts +0 -284
- package/lib/Button/ButtonBase.d.ts +0 -12
- package/lib/Button/ButtonClose.d.ts +0 -321
- package/lib/Button/ButtonDanger.d.ts +0 -284
- package/lib/Button/ButtonGroup.d.ts +0 -4
- package/lib/Button/ButtonInvisible.d.ts +0 -284
- package/lib/Button/ButtonOutline.d.ts +0 -284
- package/lib/Button/ButtonPrimary.d.ts +0 -284
- package/lib/Button/ButtonStyles.d.ts +0 -2
- package/lib/Button/ButtonTableList.d.ts +0 -6
- package/lib/Button/index.d.ts +0 -16
- package/lib/Caret.d.ts +0 -21
- package/lib/CircleBadge.d.ts +0 -25
- package/lib/CircleOcticon.d.ts +0 -391
- package/lib/CounterLabel.d.ts +0 -8
- package/lib/DatePicker/DatePicker.d.ts +0 -35
- package/lib/DatePicker/DatePicker.js +0 -37
- package/lib/DatePicker/DatePickerPanel.d.ts +0 -0
- package/lib/DatePicker/DatePickerPanel.js +0 -1
- package/lib/DatePicker/Day.d.ts +0 -12
- package/lib/DatePicker/Day.js +0 -44
- package/lib/DatePicker/Month.d.ts +0 -10
- package/lib/DatePicker/Month.js +0 -28
- package/lib/DatePicker/index.d.ts +0 -2
- package/lib/DatePicker/index.js +0 -13
- package/lib/Details.d.ts +0 -6
- package/lib/Dialog/ConfirmationDialog.d.ts +0 -44
- package/lib/Dialog/ConfirmationDialog.js +0 -191
- package/lib/Dialog/Dialog.d.ts +0 -167
- package/lib/Dialog/Dialog.js +0 -304
- package/lib/Dialog.d.ts +0 -406
- package/lib/Dropdown.d.ts +0 -1262
- package/lib/DropdownMenu/DropdownButton.d.ts +0 -323
- package/lib/DropdownMenu/DropdownButton.js +0 -31
- package/lib/DropdownMenu/DropdownMenu.d.ts +0 -43
- package/lib/DropdownMenu/DropdownMenu.js +0 -94
- package/lib/DropdownMenu/index.d.ts +0 -4
- package/lib/DropdownMenu/index.js +0 -21
- package/lib/DropdownStyles.d.ts +0 -3
- package/lib/FilterList.d.ts +0 -321
- package/lib/FilteredActionList/FilteredActionList.d.ts +0 -16
- package/lib/FilteredActionList/FilteredActionList.js +0 -163
- package/lib/FilteredActionList/index.d.ts +0 -2
- package/lib/FilteredActionList/index.js +0 -13
- package/lib/FilteredSearch.d.ts +0 -6
- package/lib/Flash.d.ts +0 -9
- package/lib/Flex.d.ts +0 -7
- package/lib/FormGroup.d.ts +0 -12
- package/lib/Grid.d.ts +0 -7
- package/lib/Header.d.ts +0 -24
- package/lib/Heading.d.ts +0 -6
- package/lib/Label.d.ts +0 -11
- package/lib/LabelGroup.d.ts +0 -6
- package/lib/Link.d.ts +0 -10
- package/lib/Overlay.d.ts +0 -62
- package/lib/Pagehead.d.ts +0 -6
- package/lib/Pagination/Pagination.d.ts +0 -24
- package/lib/Pagination/index.d.ts +0 -3
- package/lib/Pagination/model.d.ts +0 -26
- package/lib/PointerBox.d.ts +0 -11
- package/lib/Popover.d.ts +0 -21
- package/lib/Portal/Portal.d.ts +0 -25
- package/lib/Portal/index.d.ts +0 -4
- package/lib/Position.d.ts +0 -34
- package/lib/ProgressBar.d.ts +0 -21
- package/lib/SelectMenu/SelectMenu.d.ts +0 -1832
- package/lib/SelectMenu/SelectMenuContext.d.ts +0 -8
- package/lib/SelectMenu/SelectMenuDivider.d.ts +0 -6
- package/lib/SelectMenu/SelectMenuFilter.d.ts +0 -9
- package/lib/SelectMenu/SelectMenuFooter.d.ts +0 -6
- package/lib/SelectMenu/SelectMenuHeader.d.ts +0 -11
- package/lib/SelectMenu/SelectMenuItem.d.ts +0 -15
- package/lib/SelectMenu/SelectMenuList.d.ts +0 -6
- package/lib/SelectMenu/SelectMenuLoadingAnimation.d.ts +0 -7
- package/lib/SelectMenu/SelectMenuModal.d.ts +0 -15
- package/lib/SelectMenu/SelectMenuTab.d.ts +0 -14
- package/lib/SelectMenu/SelectMenuTabPanel.d.ts +0 -13
- package/lib/SelectMenu/SelectMenuTabs.d.ts +0 -11
- package/lib/SelectMenu/hooks/useKeyboardNav.d.ts +0 -2
- package/lib/SelectMenu/index.d.ts +0 -2
- package/lib/SelectPanel/SelectPanel.d.ts +0 -25
- package/lib/SelectPanel/SelectPanel.js +0 -147
- package/lib/SelectPanel/index.d.ts +0 -2
- package/lib/SelectPanel/index.js +0 -13
- package/lib/SideNav.d.ts +0 -31
- package/lib/Spinner.d.ts +0 -17
- package/lib/Spinner.js +0 -60
- package/lib/StateLabel.d.ts +0 -16
- package/lib/StyledOcticon.d.ts +0 -12
- package/lib/SubNav.d.ts +0 -32
- package/lib/TabNav.d.ts +0 -20
- package/lib/Text.d.ts +0 -6
- package/lib/TextInput.d.ts +0 -22
- package/lib/ThemeProvider.d.ts +0 -26
- package/lib/Timeline.d.ts +0 -407
- package/lib/Tooltip.d.ts +0 -18
- package/lib/Truncate.d.ts +0 -11
- package/lib/UnderlineNav.d.ts +0 -25
- package/lib/behaviors/anchoredPosition.d.ts +0 -89
- package/lib/behaviors/focusTrap.d.ts +0 -12
- package/lib/behaviors/focusZone.d.ts +0 -137
- package/lib/constants.d.ts +0 -20
- package/lib/hooks/index.d.ts +0 -11
- package/lib/hooks/useAnchoredPosition.d.ts +0 -20
- package/lib/hooks/useCombinedRefs.d.ts +0 -10
- package/lib/hooks/useCombinedRefs.js +0 -49
- package/lib/hooks/useDetails.d.ts +0 -17
- package/lib/hooks/useDialog.d.ts +0 -16
- package/lib/hooks/useFocusTrap.d.ts +0 -32
- package/lib/hooks/useFocusZone.d.ts +0 -23
- package/lib/hooks/useOnEscapePress.d.ts +0 -23
- package/lib/hooks/useOnOutsideClick.d.ts +0 -8
- package/lib/hooks/useOpenAndCloseFocus.d.ts +0 -7
- package/lib/hooks/useOverlay.d.ts +0 -14
- package/lib/hooks/useProvidedRefOrCreate.d.ts +0 -10
- package/lib/hooks/useProvidedStateOrCreate.d.ts +0 -10
- package/lib/hooks/useProvidedStateOrCreate.js +0 -27
- package/lib/hooks/useRenderForcingRef.d.ts +0 -8
- package/lib/hooks/useRenderForcingRef.js +0 -25
- package/lib/hooks/useResizeObserver.d.ts +0 -1
- package/lib/hooks/useResizeObserver.js +0 -20
- package/lib/hooks/useSafeTimeout.d.ts +0 -12
- package/lib/hooks/useScrollFlash.d.ts +0 -6
- package/lib/hooks/useScrollFlash.js +0 -29
- package/lib/index.d.ts +0 -111
- package/lib/polyfills/eventListenerSignal.d.ts +0 -6
- package/lib/sx.d.ts +0 -6
- package/lib/theme-preval.d.ts +0 -49
- package/lib/theme.d.ts +0 -2
- package/lib/utils/deprecate.d.ts +0 -18
- package/lib/utils/isNumeric.d.ts +0 -1
- package/lib/utils/iterateFocusableElements.d.ts +0 -42
- package/lib/utils/ssr.d.ts +0 -1
- package/lib/utils/ssr.js +0 -19
- package/lib/utils/test-deprecations.d.ts +0 -1
- package/lib/utils/test-helpers.d.ts +0 -0
- package/lib/utils/test-helpers.js +0 -9
- package/lib/utils/test-matchers.d.ts +0 -1
- package/lib/utils/testing.d.ts +0 -1028
- package/lib/utils/theme.d.ts +0 -9
- package/lib/utils/types.d.ts +0 -14
- package/lib/utils/uniqueId.d.ts +0 -1
- package/lib/utils/userAgent.d.ts +0 -1
- package/lib-esm/ActionList/Divider.d.ts +0 -9
- package/lib-esm/ActionList/Divider.js +0 -23
- package/lib-esm/ActionList/Group.d.ts +0 -28
- package/lib-esm/ActionList/Group.js +0 -24
- package/lib-esm/ActionList/Header.d.ts +0 -29
- package/lib-esm/ActionList/Header.js +0 -33
- package/lib-esm/ActionList/Item.d.ts +0 -92
- package/lib-esm/ActionList/Item.js +0 -253
- package/lib-esm/ActionList/List.d.ts +0 -87
- package/lib-esm/ActionList/List.js +0 -181
- package/lib-esm/ActionList/index.d.ts +0 -17
- package/lib-esm/ActionList/index.js +0 -18
- package/lib-esm/ActionMenu.d.ts +0 -40
- package/lib-esm/ActionMenu.js +0 -82
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +0 -61
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +0 -96
- package/lib-esm/AnchoredOverlay/index.d.ts +0 -2
- package/lib-esm/AnchoredOverlay/index.js +0 -1
- package/lib-esm/Avatar.d.ts +0 -15
- package/lib-esm/AvatarPair.d.ts +0 -8
- package/lib-esm/AvatarStack.d.ts +0 -8
- package/lib-esm/BaseStyles.d.ts +0 -14
- package/lib-esm/BorderBox.d.ts +0 -7
- package/lib-esm/Box.d.ts +0 -6
- package/lib-esm/BranchName.d.ts +0 -6
- package/lib-esm/Breadcrumbs.d.ts +0 -40
- package/lib-esm/Button/Button.d.ts +0 -284
- package/lib-esm/Button/ButtonBase.d.ts +0 -12
- package/lib-esm/Button/ButtonClose.d.ts +0 -321
- package/lib-esm/Button/ButtonDanger.d.ts +0 -284
- package/lib-esm/Button/ButtonGroup.d.ts +0 -4
- package/lib-esm/Button/ButtonInvisible.d.ts +0 -284
- package/lib-esm/Button/ButtonOutline.d.ts +0 -284
- package/lib-esm/Button/ButtonPrimary.d.ts +0 -284
- package/lib-esm/Button/ButtonStyles.d.ts +0 -2
- package/lib-esm/Button/ButtonTableList.d.ts +0 -6
- package/lib-esm/Button/index.d.ts +0 -16
- package/lib-esm/Caret.d.ts +0 -21
- package/lib-esm/CircleBadge.d.ts +0 -25
- package/lib-esm/CircleOcticon.d.ts +0 -391
- package/lib-esm/CounterLabel.d.ts +0 -8
- package/lib-esm/DatePicker/DatePicker.d.ts +0 -35
- package/lib-esm/DatePicker/DatePicker.js +0 -24
- package/lib-esm/DatePicker/DatePickerPanel.d.ts +0 -0
- package/lib-esm/DatePicker/DatePickerPanel.js +0 -0
- package/lib-esm/DatePicker/Day.d.ts +0 -12
- package/lib-esm/DatePicker/Day.js +0 -26
- package/lib-esm/DatePicker/Month.d.ts +0 -10
- package/lib-esm/DatePicker/Month.js +0 -13
- package/lib-esm/DatePicker/index.d.ts +0 -2
- package/lib-esm/DatePicker/index.js +0 -1
- package/lib-esm/Details.d.ts +0 -6
- package/lib-esm/Dialog/ConfirmationDialog.d.ts +0 -44
- package/lib-esm/Dialog/ConfirmationDialog.js +0 -169
- package/lib-esm/Dialog/Dialog.d.ts +0 -167
- package/lib-esm/Dialog/Dialog.js +0 -274
- package/lib-esm/Dialog.d.ts +0 -406
- package/lib-esm/Dropdown.d.ts +0 -1262
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +0 -323
- package/lib-esm/DropdownMenu/DropdownButton.js +0 -16
- package/lib-esm/DropdownMenu/DropdownMenu.d.ts +0 -43
- package/lib-esm/DropdownMenu/DropdownMenu.js +0 -77
- package/lib-esm/DropdownMenu/index.d.ts +0 -4
- package/lib-esm/DropdownMenu/index.js +0 -2
- package/lib-esm/DropdownStyles.d.ts +0 -3
- package/lib-esm/FilterList.d.ts +0 -321
- package/lib-esm/FilteredActionList/FilteredActionList.d.ts +0 -16
- package/lib-esm/FilteredActionList/FilteredActionList.js +0 -137
- package/lib-esm/FilteredActionList/index.d.ts +0 -2
- package/lib-esm/FilteredActionList/index.js +0 -1
- package/lib-esm/FilteredSearch.d.ts +0 -6
- package/lib-esm/Flash.d.ts +0 -9
- package/lib-esm/Flex.d.ts +0 -7
- package/lib-esm/FormGroup.d.ts +0 -12
- package/lib-esm/Grid.d.ts +0 -7
- package/lib-esm/Header.d.ts +0 -24
- package/lib-esm/Heading.d.ts +0 -6
- package/lib-esm/Label.d.ts +0 -11
- package/lib-esm/LabelGroup.d.ts +0 -6
- package/lib-esm/Link.d.ts +0 -10
- package/lib-esm/Overlay.d.ts +0 -62
- package/lib-esm/Pagehead.d.ts +0 -6
- package/lib-esm/Pagination/Pagination.d.ts +0 -24
- package/lib-esm/Pagination/index.d.ts +0 -3
- package/lib-esm/Pagination/model.d.ts +0 -26
- package/lib-esm/PointerBox.d.ts +0 -11
- package/lib-esm/Popover.d.ts +0 -21
- package/lib-esm/Portal/Portal.d.ts +0 -25
- package/lib-esm/Portal/index.d.ts +0 -4
- package/lib-esm/Position.d.ts +0 -34
- package/lib-esm/ProgressBar.d.ts +0 -21
- package/lib-esm/SelectMenu/SelectMenu.d.ts +0 -1832
- package/lib-esm/SelectMenu/SelectMenuContext.d.ts +0 -8
- package/lib-esm/SelectMenu/SelectMenuDivider.d.ts +0 -6
- package/lib-esm/SelectMenu/SelectMenuFilter.d.ts +0 -9
- package/lib-esm/SelectMenu/SelectMenuFooter.d.ts +0 -6
- package/lib-esm/SelectMenu/SelectMenuHeader.d.ts +0 -11
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +0 -15
- package/lib-esm/SelectMenu/SelectMenuList.d.ts +0 -6
- package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.d.ts +0 -7
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +0 -15
- package/lib-esm/SelectMenu/SelectMenuTab.d.ts +0 -14
- package/lib-esm/SelectMenu/SelectMenuTabPanel.d.ts +0 -13
- package/lib-esm/SelectMenu/SelectMenuTabs.d.ts +0 -11
- package/lib-esm/SelectMenu/hooks/useKeyboardNav.d.ts +0 -2
- package/lib-esm/SelectMenu/index.d.ts +0 -2
- package/lib-esm/SelectPanel/SelectPanel.d.ts +0 -25
- package/lib-esm/SelectPanel/SelectPanel.js +0 -127
- package/lib-esm/SelectPanel/index.d.ts +0 -2
- package/lib-esm/SelectPanel/index.js +0 -1
- package/lib-esm/SideNav.d.ts +0 -31
- package/lib-esm/Spinner.d.ts +0 -17
- package/lib-esm/Spinner.js +0 -46
- package/lib-esm/StateLabel.d.ts +0 -16
- package/lib-esm/StyledOcticon.d.ts +0 -12
- package/lib-esm/SubNav.d.ts +0 -32
- package/lib-esm/TabNav.d.ts +0 -20
- package/lib-esm/Text.d.ts +0 -6
- package/lib-esm/TextInput.d.ts +0 -22
- package/lib-esm/ThemeProvider.d.ts +0 -26
- package/lib-esm/Timeline.d.ts +0 -407
- package/lib-esm/Tooltip.d.ts +0 -18
- package/lib-esm/Truncate.d.ts +0 -11
- package/lib-esm/UnderlineNav.d.ts +0 -25
- package/lib-esm/behaviors/anchoredPosition.d.ts +0 -89
- package/lib-esm/behaviors/focusTrap.d.ts +0 -12
- package/lib-esm/behaviors/focusZone.d.ts +0 -137
- package/lib-esm/constants.d.ts +0 -20
- package/lib-esm/hooks/index.d.ts +0 -11
- package/lib-esm/hooks/useAnchoredPosition.d.ts +0 -20
- package/lib-esm/hooks/useCombinedRefs.d.ts +0 -10
- package/lib-esm/hooks/useCombinedRefs.js +0 -36
- package/lib-esm/hooks/useDetails.d.ts +0 -17
- package/lib-esm/hooks/useDialog.d.ts +0 -16
- package/lib-esm/hooks/useFocusTrap.d.ts +0 -32
- package/lib-esm/hooks/useFocusZone.d.ts +0 -23
- package/lib-esm/hooks/useOnEscapePress.d.ts +0 -23
- package/lib-esm/hooks/useOnOutsideClick.d.ts +0 -8
- package/lib-esm/hooks/useOpenAndCloseFocus.d.ts +0 -7
- package/lib-esm/hooks/useOverlay.d.ts +0 -14
- package/lib-esm/hooks/useProvidedRefOrCreate.d.ts +0 -10
- package/lib-esm/hooks/useProvidedStateOrCreate.d.ts +0 -10
- package/lib-esm/hooks/useProvidedStateOrCreate.js +0 -20
- package/lib-esm/hooks/useRenderForcingRef.d.ts +0 -8
- package/lib-esm/hooks/useRenderForcingRef.js +0 -18
- package/lib-esm/hooks/useResizeObserver.d.ts +0 -1
- package/lib-esm/hooks/useResizeObserver.js +0 -10
- package/lib-esm/hooks/useSafeTimeout.d.ts +0 -12
- package/lib-esm/hooks/useScrollFlash.d.ts +0 -6
- package/lib-esm/hooks/useScrollFlash.js +0 -22
- package/lib-esm/index.d.ts +0 -111
- package/lib-esm/polyfills/eventListenerSignal.d.ts +0 -6
- package/lib-esm/sx.d.ts +0 -6
- package/lib-esm/theme-preval.d.ts +0 -49
- package/lib-esm/theme.d.ts +0 -2
- package/lib-esm/utils/deprecate.d.ts +0 -18
- package/lib-esm/utils/isNumeric.d.ts +0 -1
- package/lib-esm/utils/iterateFocusableElements.d.ts +0 -42
- package/lib-esm/utils/ssr.d.ts +0 -1
- package/lib-esm/utils/ssr.js +0 -1
- package/lib-esm/utils/test-deprecations.d.ts +0 -1
- package/lib-esm/utils/test-helpers.d.ts +0 -0
- package/lib-esm/utils/test-helpers.js +0 -7
- package/lib-esm/utils/test-matchers.d.ts +0 -1
- package/lib-esm/utils/testing.d.ts +0 -1028
- package/lib-esm/utils/theme.d.ts +0 -9
- package/lib-esm/utils/types.d.ts +0 -14
- package/lib-esm/utils/uniqueId.d.ts +0 -1
- package/lib-esm/utils/userAgent.d.ts +0 -1
@@ -18,34 +18,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
18
18
|
* that should trap focus.
|
19
19
|
* @param settings {FocusTrapHookSettings}
|
20
20
|
*/
|
21
|
-
function useFocusTrap(settings
|
21
|
+
function useFocusTrap(settings) {
|
22
22
|
const containerRef = (0, _useProvidedRefOrCreate.useProvidedRefOrCreate)(settings === null || settings === void 0 ? void 0 : settings.containerRef);
|
23
23
|
const initialFocusRef = (0, _useProvidedRefOrCreate.useProvidedRefOrCreate)(settings === null || settings === void 0 ? void 0 : settings.initialFocusRef);
|
24
24
|
const disabled = settings === null || settings === void 0 ? void 0 : settings.disabled;
|
25
25
|
|
26
26
|
const abortController = _react.default.useRef();
|
27
27
|
|
28
|
-
const previousFocusedElement = _react.default.useRef(null); // If we are enabling a focus trap and haven't already stored the previously focused element
|
29
|
-
// go ahead an do that so we can restore later when the trap is disabled.
|
30
|
-
|
31
|
-
|
32
|
-
if (!previousFocusedElement.current && !(settings !== null && settings !== void 0 && settings.disabled)) {
|
33
|
-
previousFocusedElement.current = document.activeElement;
|
34
|
-
} // This function removes the event listeners that enable the focus trap and restores focus
|
35
|
-
// to the previously-focused element (if necessary).
|
36
|
-
|
37
|
-
|
38
|
-
function disableTrap() {
|
39
|
-
var _abortController$curr;
|
40
|
-
|
41
|
-
(_abortController$curr = abortController.current) === null || _abortController$curr === void 0 ? void 0 : _abortController$curr.abort();
|
42
|
-
|
43
|
-
if (settings !== null && settings !== void 0 && settings.restoreFocusOnCleanUp && previousFocusedElement.current instanceof HTMLElement) {
|
44
|
-
previousFocusedElement.current.focus();
|
45
|
-
previousFocusedElement.current = null;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
28
|
_react.default.useEffect(() => {
|
50
29
|
if (containerRef.current instanceof HTMLElement) {
|
51
30
|
if (!disabled) {
|
@@ -53,14 +32,17 @@ function useFocusTrap(settings, dependencies = []) {
|
|
53
32
|
|
54
33
|
abortController.current = (0, _focusTrap.focusTrap)(containerRef.current, (_initialFocusRef$curr = initialFocusRef.current) !== null && _initialFocusRef$curr !== void 0 ? _initialFocusRef$curr : undefined);
|
55
34
|
return () => {
|
56
|
-
|
35
|
+
var _abortController$curr;
|
36
|
+
|
37
|
+
(_abortController$curr = abortController.current) === null || _abortController$curr === void 0 ? void 0 : _abortController$curr.abort();
|
57
38
|
};
|
58
39
|
} else {
|
59
|
-
|
40
|
+
var _abortController$curr2;
|
41
|
+
|
42
|
+
(_abortController$curr2 = abortController.current) === null || _abortController$curr2 === void 0 ? void 0 : _abortController$curr2.abort();
|
60
43
|
}
|
61
44
|
}
|
62
|
-
},
|
63
|
-
[containerRef, initialFocusRef, disabled, ...dependencies]);
|
45
|
+
}, [containerRef, initialFocusRef, disabled]);
|
64
46
|
|
65
47
|
return {
|
66
48
|
containerRef,
|
@@ -11,16 +11,16 @@ var _focusZone = require("../behaviors/focusZone");
|
|
11
11
|
|
12
12
|
var _useProvidedRefOrCreate = require("./useProvidedRefOrCreate");
|
13
13
|
|
14
|
-
function _getRequireWildcardCache(
|
14
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
15
15
|
|
16
|
-
function _interopRequireWildcard(obj
|
16
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
17
17
|
|
18
|
-
function useFocusZone(settings = {}, dependencies
|
18
|
+
function useFocusZone(settings = {}, dependencies) {
|
19
19
|
const containerRef = (0, _useProvidedRefOrCreate.useProvidedRefOrCreate)(settings.containerRef);
|
20
20
|
const useActiveDescendant = !!settings.activeDescendantFocus;
|
21
21
|
const passedActiveDescendantRef = typeof settings.activeDescendantFocus === 'boolean' || !settings.activeDescendantFocus ? undefined : settings.activeDescendantFocus;
|
22
22
|
const activeDescendantControlRef = (0, _useProvidedRefOrCreate.useProvidedRefOrCreate)(passedActiveDescendantRef);
|
23
|
-
const disabled = settings.disabled;
|
23
|
+
const disabled = settings === null || settings === void 0 ? void 0 : settings.disabled;
|
24
24
|
|
25
25
|
const abortController = _react.default.useRef();
|
26
26
|
|
@@ -43,9 +43,9 @@ function useFocusZone(settings = {}, dependencies = []) {
|
|
43
43
|
|
44
44
|
(_abortController$curr2 = abortController.current) === null || _abortController$curr2 === void 0 ? void 0 : _abortController$curr2.abort();
|
45
45
|
}
|
46
|
-
}
|
47
|
-
|
48
|
-
|
46
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
47
|
+
|
48
|
+
}, dependencies !== null && dependencies !== void 0 ? dependencies : []);
|
49
49
|
return {
|
50
50
|
containerRef,
|
51
51
|
activeDescendantControlRef
|
@@ -0,0 +1,58 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = require("react");
|
9
|
+
|
10
|
+
/* adapted from: https://github.com/github/github/blob/a959c0d15c29b98c49b881f520c5947fe24eecb9/app/assets/modules/github/behaviors/button-outline.ts */
|
11
|
+
const useMouseIntent = () => {
|
12
|
+
(0, _react.useEffect)(() => {
|
13
|
+
let lastActiveElement = null;
|
14
|
+
let currentInputIsMouse = false;
|
15
|
+
|
16
|
+
function setClass() {
|
17
|
+
lastActiveElement = document.activeElement;
|
18
|
+
|
19
|
+
if (document.body) {
|
20
|
+
document.body.classList.toggle('intent-mouse', currentInputIsMouse);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
function onKeyDown() {
|
25
|
+
currentInputIsMouse = false;
|
26
|
+
}
|
27
|
+
|
28
|
+
function onMouseDown() {
|
29
|
+
currentInputIsMouse = true;
|
30
|
+
if (lastActiveElement === document.activeElement) setClass();
|
31
|
+
} // Use mousedown event to make sure outline is remove for holding and dragging
|
32
|
+
|
33
|
+
|
34
|
+
document.addEventListener('mousedown', onMouseDown, {
|
35
|
+
capture: true
|
36
|
+
});
|
37
|
+
document.addEventListener('keydown', onKeyDown, {
|
38
|
+
capture: true
|
39
|
+
});
|
40
|
+
document.addEventListener('focusin', setClass, {
|
41
|
+
capture: true
|
42
|
+
});
|
43
|
+
return () => {
|
44
|
+
document.removeEventListener('keydown', onKeyDown, {
|
45
|
+
capture: true
|
46
|
+
});
|
47
|
+
document.removeEventListener('focusin', setClass, {
|
48
|
+
capture: true
|
49
|
+
});
|
50
|
+
document.removeEventListener('mousedown', onMouseDown, {
|
51
|
+
capture: true
|
52
|
+
});
|
53
|
+
};
|
54
|
+
}, []);
|
55
|
+
};
|
56
|
+
|
57
|
+
var _default = useMouseIntent;
|
58
|
+
exports.default = _default;
|
@@ -7,63 +7,20 @@ exports.useOnEscapePress = void 0;
|
|
7
7
|
|
8
8
|
var _react = require("react");
|
9
9
|
|
10
|
-
const
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
function handleEscape(event) {
|
17
|
-
if (event.key === 'Escape' && !event.defaultPrevented) {
|
18
|
-
for (let i = handlers.length - 1; i >= 0; --i) {
|
19
|
-
handlers[i](event); // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
20
|
-
|
21
|
-
if (event.defaultPrevented) {
|
22
|
-
break;
|
23
|
-
}
|
10
|
+
const useOnEscapePress = ({
|
11
|
+
onEscape
|
12
|
+
}) => {
|
13
|
+
const handleEscape = (0, _react.useCallback)(e => {
|
14
|
+
if (e.key === 'Escape' && !e.defaultPrevented) {
|
15
|
+
onEscape(e);
|
24
16
|
}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
/**
|
28
|
-
* Sets up a `keydown` listener on `window.document`. If
|
29
|
-
* 1) The pressed key is "Escape", and
|
30
|
-
* 2) The event has not had `.preventDefault()` called
|
31
|
-
* The given callback will be executed.
|
32
|
-
*
|
33
|
-
* Note: If multiple `useOnEscapePress` hooks are active simultaneously, the
|
34
|
-
* callbacks will occur in reverse order. In other words, if a parent component
|
35
|
-
* and a child component both call `useOnEscapePress`, when the user presses
|
36
|
-
* Escape, the child component's callback will execute, followed by the parent's
|
37
|
-
* callback. Each callback has the chance to call `.preventDefault()` on the
|
38
|
-
* event to prevent further callbacks.
|
39
|
-
*
|
40
|
-
* @param callback {(e: KeyboardEvent) => void} The callback that gets executed
|
41
|
-
* when the Escape key is pressed. The KeyboardEvent generated by the Escape
|
42
|
-
* keypress is passed as the only argument.
|
43
|
-
*
|
44
|
-
* @param callbackDependencies {React.DependencyList} The dependencies of the given
|
45
|
-
* `onEscape` callback for memoization. Omit this param if the callback is already
|
46
|
-
* memoized. See `React.useCallback` for more info on memoization.
|
47
|
-
*/
|
48
|
-
|
49
|
-
|
50
|
-
const useOnEscapePress = (onEscape, callbackDependencies = [onEscape]) => {
|
51
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
52
|
-
const escapeCallback = (0, _react.useCallback)(onEscape, callbackDependencies);
|
17
|
+
}, [onEscape]);
|
53
18
|
(0, _react.useEffect)(() => {
|
54
|
-
|
55
|
-
document.addEventListener('keydown', handleEscape);
|
56
|
-
}
|
57
|
-
|
58
|
-
handlers.push(escapeCallback);
|
19
|
+
document.addEventListener('keydown', handleEscape);
|
59
20
|
return () => {
|
60
|
-
|
61
|
-
|
62
|
-
if (handlers.length === 0) {
|
63
|
-
document.removeEventListener('keydown', handleEscape);
|
64
|
-
}
|
21
|
+
document.removeEventListener('keydown', handleEscape);
|
65
22
|
};
|
66
|
-
}, [
|
23
|
+
}, [handleEscape]);
|
67
24
|
};
|
68
25
|
|
69
26
|
exports.useOnEscapePress = useOnEscapePress;
|
@@ -7,84 +7,57 @@ exports.useOnOutsideClick = void 0;
|
|
7
7
|
|
8
8
|
var _react = require("react");
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
const shouldCallClickHandler = ({
|
11
|
+
ignoreClickRefs,
|
12
|
+
containerRef,
|
13
|
+
e
|
14
|
+
}) => {
|
15
|
+
var _containerRef$current;
|
16
16
|
|
17
|
-
|
18
|
-
if (!event.defaultPrevented) {
|
19
|
-
for (const handler of Object.values(registry).reverse()) {
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
21
|
-
if (handler(event) === stopPropagation || event.defaultPrevented) {
|
22
|
-
break;
|
23
|
-
}
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
17
|
+
let shouldCallHandler = true; // don't call click handler if the mouse event was triggered by an auxiliary button (right click/wheel button/etc)
|
27
18
|
|
28
|
-
|
19
|
+
if (e instanceof MouseEvent && e.button > 0) {
|
20
|
+
shouldCallHandler = false;
|
21
|
+
} // don't call handler if the click happened inside of the container
|
29
22
|
|
30
|
-
function register(id, handler) {
|
31
|
-
registry[id] = handler;
|
32
|
-
}
|
33
23
|
|
34
|
-
|
35
|
-
|
36
|
-
}
|
24
|
+
if ((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 && _containerRef$current.contains(e.target)) {
|
25
|
+
shouldCallHandler = false; // don't call handler if click happened on an ignored ref
|
26
|
+
} else if (ignoreClickRefs) {
|
27
|
+
for (const ignoreRef of ignoreClickRefs) {
|
28
|
+
var _ignoreRef$current;
|
37
29
|
|
30
|
+
if (ignoreRef && (_ignoreRef$current = ignoreRef.current) !== null && _ignoreRef$current !== void 0 && _ignoreRef$current.contains(e.target)) {
|
31
|
+
shouldCallHandler = false; // if we encounter one, break early, we don't need to go through the rest
|
38
32
|
|
39
|
-
|
33
|
+
break;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
return shouldCallHandler;
|
39
|
+
};
|
40
40
|
|
41
41
|
const useOnOutsideClick = ({
|
42
42
|
containerRef,
|
43
43
|
ignoreClickRefs,
|
44
44
|
onClickOutside
|
45
45
|
}) => {
|
46
|
-
const
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
} // don't call handler if the click happened inside of the container
|
54
|
-
|
55
|
-
|
56
|
-
if ((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 && _containerRef$current.contains(event.target)) {
|
57
|
-
return stopPropagation;
|
58
|
-
} // don't call handler if click happened on an ignored ref
|
59
|
-
|
60
|
-
|
61
|
-
if (ignoreClickRefs && ignoreClickRefs.some(({
|
62
|
-
current
|
63
|
-
}) => current === null || current === void 0 ? void 0 : current.contains(event.target))) {
|
64
|
-
return stopPropagation;
|
46
|
+
const onOutsideClickInternal = (0, _react.useCallback)(e => {
|
47
|
+
if (shouldCallClickHandler({
|
48
|
+
ignoreClickRefs,
|
49
|
+
containerRef,
|
50
|
+
e
|
51
|
+
})) {
|
52
|
+
onClickOutside(e);
|
65
53
|
}
|
66
|
-
|
67
|
-
onClickOutside(event);
|
68
|
-
}, [containerRef, ignoreClickRefs, onClickOutside]);
|
54
|
+
}, [onClickOutside, containerRef, ignoreClickRefs]);
|
69
55
|
(0, _react.useEffect)(() => {
|
70
|
-
|
71
|
-
// use capture to ensure we get all events
|
72
|
-
document.addEventListener('mousedown', handleClick, {
|
73
|
-
capture: true
|
74
|
-
});
|
75
|
-
}
|
76
|
-
|
77
|
-
register(id, handler);
|
56
|
+
document.addEventListener('click', onOutsideClickInternal);
|
78
57
|
return () => {
|
79
|
-
|
80
|
-
|
81
|
-
if (Object.keys(registry).length === 0) {
|
82
|
-
document.removeEventListener('mousedown', handleClick, {
|
83
|
-
capture: true
|
84
|
-
});
|
85
|
-
}
|
58
|
+
document.removeEventListener('click', onOutsideClickInternal);
|
86
59
|
};
|
87
|
-
}, [
|
60
|
+
}, [onOutsideClickInternal]);
|
88
61
|
};
|
89
62
|
|
90
63
|
exports.useOnOutsideClick = useOnOutsideClick;
|
@@ -19,7 +19,7 @@ function useOpenAndCloseFocus({
|
|
19
19
|
|
20
20
|
if (initialFocusRef && initialFocusRef.current) {
|
21
21
|
initialFocusRef.current.focus();
|
22
|
-
} else if (containerRef.current) {
|
22
|
+
} else if (containerRef && containerRef.current) {
|
23
23
|
const firstItem = (0, _iterateFocusableElements.iterateFocusableElements)(containerRef.current).next().value;
|
24
24
|
firstItem === null || firstItem === void 0 ? void 0 : firstItem.focus();
|
25
25
|
}
|
package/lib/hooks/useOverlay.js
CHANGED
@@ -11,17 +11,23 @@ var _useOpenAndCloseFocus = require("./useOpenAndCloseFocus");
|
|
11
11
|
|
12
12
|
var _useOnEscapePress = require("./useOnEscapePress");
|
13
13
|
|
14
|
-
var
|
14
|
+
var _useAnchoredPosition = require("./useAnchoredPosition");
|
15
|
+
|
16
|
+
var _react = require("react");
|
15
17
|
|
16
18
|
const useOverlay = ({
|
17
|
-
|
19
|
+
anchorRef,
|
20
|
+
positionSettings = {},
|
21
|
+
positionDeps,
|
18
22
|
returnFocusRef,
|
19
23
|
initialFocusRef,
|
20
24
|
onEscape,
|
21
25
|
ignoreClickRefs,
|
22
26
|
onClickOutside
|
23
27
|
}) => {
|
24
|
-
const overlayRef = (0,
|
28
|
+
const overlayRef = (0, _react.useRef)(null);
|
29
|
+
positionSettings.anchorElementRef = anchorRef;
|
30
|
+
positionSettings.floatingElementRef = overlayRef;
|
25
31
|
(0, _useOpenAndCloseFocus.useOpenAndCloseFocus)({
|
26
32
|
containerRef: overlayRef,
|
27
33
|
returnFocusRef,
|
@@ -32,9 +38,15 @@ const useOverlay = ({
|
|
32
38
|
ignoreClickRefs,
|
33
39
|
onClickOutside
|
34
40
|
});
|
35
|
-
(0, _useOnEscapePress.useOnEscapePress)(
|
41
|
+
(0, _useOnEscapePress.useOnEscapePress)({
|
42
|
+
onEscape
|
43
|
+
});
|
44
|
+
const {
|
45
|
+
position
|
46
|
+
} = (0, _useAnchoredPosition.useAnchoredPosition)(positionSettings, positionDeps);
|
36
47
|
return {
|
37
|
-
ref: overlayRef
|
48
|
+
ref: overlayRef,
|
49
|
+
position
|
38
50
|
};
|
39
51
|
};
|
40
52
|
|
package/lib/index.js
CHANGED
@@ -99,6 +99,12 @@ Object.defineProperty(exports, "useDetails", {
|
|
99
99
|
return _useDetails.default;
|
100
100
|
}
|
101
101
|
});
|
102
|
+
Object.defineProperty(exports, "useMouseIntent", {
|
103
|
+
enumerable: true,
|
104
|
+
get: function () {
|
105
|
+
return _useMouseIntent.default;
|
106
|
+
}
|
107
|
+
});
|
102
108
|
Object.defineProperty(exports, "useSafeTimeout", {
|
103
109
|
enumerable: true,
|
104
110
|
get: function () {
|
@@ -129,30 +135,6 @@ Object.defineProperty(exports, "useOverlay", {
|
|
129
135
|
return _useOverlay.useOverlay;
|
130
136
|
}
|
131
137
|
});
|
132
|
-
Object.defineProperty(exports, "useConfirm", {
|
133
|
-
enumerable: true,
|
134
|
-
get: function () {
|
135
|
-
return _ConfirmationDialog.useConfirm;
|
136
|
-
}
|
137
|
-
});
|
138
|
-
Object.defineProperty(exports, "ConfirmationDialog", {
|
139
|
-
enumerable: true,
|
140
|
-
get: function () {
|
141
|
-
return _ConfirmationDialog.ConfirmationDialog;
|
142
|
-
}
|
143
|
-
});
|
144
|
-
Object.defineProperty(exports, "ActionList", {
|
145
|
-
enumerable: true,
|
146
|
-
get: function () {
|
147
|
-
return _ActionList.ActionList;
|
148
|
-
}
|
149
|
-
});
|
150
|
-
Object.defineProperty(exports, "ActionMenu", {
|
151
|
-
enumerable: true,
|
152
|
-
get: function () {
|
153
|
-
return _ActionMenu.ActionMenu;
|
154
|
-
}
|
155
|
-
});
|
156
138
|
Object.defineProperty(exports, "Avatar", {
|
157
139
|
enumerable: true,
|
158
140
|
get: function () {
|
@@ -177,16 +159,10 @@ Object.defineProperty(exports, "BranchName", {
|
|
177
159
|
return _BranchName.default;
|
178
160
|
}
|
179
161
|
});
|
180
|
-
Object.defineProperty(exports, "Breadcrumbs", {
|
181
|
-
enumerable: true,
|
182
|
-
get: function () {
|
183
|
-
return _Breadcrumbs.default;
|
184
|
-
}
|
185
|
-
});
|
186
162
|
Object.defineProperty(exports, "Breadcrumb", {
|
187
163
|
enumerable: true,
|
188
164
|
get: function () {
|
189
|
-
return
|
165
|
+
return _Breadcrumb.default;
|
190
166
|
}
|
191
167
|
});
|
192
168
|
Object.defineProperty(exports, "Button", {
|
@@ -279,18 +255,6 @@ Object.defineProperty(exports, "Dropdown", {
|
|
279
255
|
return _Dropdown.default;
|
280
256
|
}
|
281
257
|
});
|
282
|
-
Object.defineProperty(exports, "DropdownButton", {
|
283
|
-
enumerable: true,
|
284
|
-
get: function () {
|
285
|
-
return _DropdownMenu.DropdownButton;
|
286
|
-
}
|
287
|
-
});
|
288
|
-
Object.defineProperty(exports, "DropdownMenu", {
|
289
|
-
enumerable: true,
|
290
|
-
get: function () {
|
291
|
-
return _DropdownMenu.DropdownMenu;
|
292
|
-
}
|
293
|
-
});
|
294
258
|
Object.defineProperty(exports, "FilteredSearch", {
|
295
259
|
enumerable: true,
|
296
260
|
get: function () {
|
@@ -393,12 +357,6 @@ Object.defineProperty(exports, "SideNav", {
|
|
393
357
|
return _SideNav.default;
|
394
358
|
}
|
395
359
|
});
|
396
|
-
Object.defineProperty(exports, "Spinner", {
|
397
|
-
enumerable: true,
|
398
|
-
get: function () {
|
399
|
-
return _Spinner.default;
|
400
|
-
}
|
401
|
-
});
|
402
360
|
Object.defineProperty(exports, "StateLabel", {
|
403
361
|
enumerable: true,
|
404
362
|
get: function () {
|
@@ -459,18 +417,6 @@ Object.defineProperty(exports, "UnderlineNav", {
|
|
459
417
|
return _UnderlineNav.default;
|
460
418
|
}
|
461
419
|
});
|
462
|
-
Object.defineProperty(exports, "SSRProvider", {
|
463
|
-
enumerable: true,
|
464
|
-
get: function () {
|
465
|
-
return _ssr.SSRProvider;
|
466
|
-
}
|
467
|
-
});
|
468
|
-
Object.defineProperty(exports, "useSSRSafeId", {
|
469
|
-
enumerable: true,
|
470
|
-
get: function () {
|
471
|
-
return _ssr.useSSRSafeId;
|
472
|
-
}
|
473
|
-
});
|
474
420
|
|
475
421
|
var _theme = _interopRequireDefault(require("./theme"));
|
476
422
|
|
@@ -492,6 +438,8 @@ var _Position = _interopRequireWildcard(require("./Position"));
|
|
492
438
|
|
493
439
|
var _useDetails = _interopRequireDefault(require("./hooks/useDetails"));
|
494
440
|
|
441
|
+
var _useMouseIntent = _interopRequireDefault(require("./hooks/useMouseIntent"));
|
442
|
+
|
495
443
|
var _useSafeTimeout = _interopRequireDefault(require("./hooks/useSafeTimeout"));
|
496
444
|
|
497
445
|
var _useOnOutsideClick = require("./hooks/useOnOutsideClick");
|
@@ -502,12 +450,6 @@ var _useOnEscapePress = require("./hooks/useOnEscapePress");
|
|
502
450
|
|
503
451
|
var _useOverlay = require("./hooks/useOverlay");
|
504
452
|
|
505
|
-
var _ConfirmationDialog = require("./Dialog/ConfirmationDialog");
|
506
|
-
|
507
|
-
var _ActionList = require("./ActionList");
|
508
|
-
|
509
|
-
var _ActionMenu = require("./ActionMenu");
|
510
|
-
|
511
453
|
var _Avatar = _interopRequireDefault(require("./Avatar"));
|
512
454
|
|
513
455
|
var _AvatarPair = _interopRequireDefault(require("./AvatarPair"));
|
@@ -516,7 +458,7 @@ var _AvatarStack = _interopRequireDefault(require("./AvatarStack"));
|
|
516
458
|
|
517
459
|
var _BranchName = _interopRequireDefault(require("./BranchName"));
|
518
460
|
|
519
|
-
var
|
461
|
+
var _Breadcrumb = _interopRequireDefault(require("./Breadcrumb"));
|
520
462
|
|
521
463
|
var _Button = _interopRequireWildcard(require("./Button"));
|
522
464
|
|
@@ -534,8 +476,6 @@ var _Dialog = _interopRequireDefault(require("./Dialog"));
|
|
534
476
|
|
535
477
|
var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
536
478
|
|
537
|
-
var _DropdownMenu = require("./DropdownMenu");
|
538
|
-
|
539
479
|
var _FilteredSearch = _interopRequireDefault(require("./FilteredSearch"));
|
540
480
|
|
541
481
|
var _FilterList = _interopRequireDefault(require("./FilterList"));
|
@@ -570,8 +510,6 @@ var _SelectMenu = _interopRequireDefault(require("./SelectMenu"));
|
|
570
510
|
|
571
511
|
var _SideNav = _interopRequireDefault(require("./SideNav"));
|
572
512
|
|
573
|
-
var _Spinner = _interopRequireDefault(require("./Spinner"));
|
574
|
-
|
575
513
|
var _StateLabel = _interopRequireDefault(require("./StateLabel"));
|
576
514
|
|
577
515
|
var _StyledOcticon = _interopRequireDefault(require("./StyledOcticon"));
|
@@ -592,10 +530,8 @@ var _Truncate = _interopRequireDefault(require("./Truncate"));
|
|
592
530
|
|
593
531
|
var _UnderlineNav = _interopRequireDefault(require("./UnderlineNav"));
|
594
532
|
|
595
|
-
|
596
|
-
|
597
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
533
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
598
534
|
|
599
|
-
function _interopRequireWildcard(obj
|
535
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
600
536
|
|
601
537
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -22,10 +22,9 @@ function noop() {}
|
|
22
22
|
try {
|
23
23
|
const options = Object.create({}, {
|
24
24
|
signal: {
|
25
|
-
get() {
|
25
|
+
get: function () {
|
26
26
|
signalSupported = true;
|
27
27
|
}
|
28
|
-
|
29
28
|
}
|
30
29
|
});
|
31
30
|
window.addEventListener('test', noop, options);
|
@@ -39,10 +38,6 @@ function featureSupported() {
|
|
39
38
|
}
|
40
39
|
|
41
40
|
function monkeyPatch() {
|
42
|
-
if (typeof window === 'undefined') {
|
43
|
-
return;
|
44
|
-
}
|
45
|
-
|
46
41
|
const originalAddEventListener = EventTarget.prototype.addEventListener;
|
47
42
|
|
48
43
|
EventTarget.prototype.addEventListener = function (name, originalCallback, optionsOrCapture) {
|