@primer/components 0.0.0-2021983515 → 0.0.0-2022530194733
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 +889 -1279
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +839 -1234
- 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 +36 -126
- 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 +59 -22
- 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 +3 -8
- package/lib/hooks/useOverlay.js +19 -9
- package/lib/hooks/useSafeTimeout.js +0 -1
- package/lib/index.js +12 -112
- 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/{types/AriaRole.js → types.js} +0 -0
- 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 +38 -119
- 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 +49 -22
- 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 +3 -8
- package/lib-esm/hooks/useOverlay.js +18 -9
- package/lib-esm/hooks/useSafeTimeout.js +0 -1
- package/lib-esm/index.js +10 -22
- 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/{test-helpers.d.ts → types.js} +0 -0
- 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 -88
- 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 -62
- package/lib/AnchoredOverlay/AnchoredOverlay.js +0 -124
- package/lib/AnchoredOverlay/index.d.ts +0 -2
- package/lib/AnchoredOverlay/index.js +0 -13
- package/lib/Autocomplete/Autocomplete.d.ts +0 -40
- package/lib/Autocomplete/Autocomplete.js +0 -68
- package/lib/Autocomplete/AutocompleteContext.d.ts +0 -17
- package/lib/Autocomplete/AutocompleteContext.js +0 -11
- package/lib/Autocomplete/AutocompleteInput.d.ts +0 -9
- package/lib/Autocomplete/AutocompleteInput.js +0 -150
- package/lib/Autocomplete/AutocompleteMenu.d.ts +0 -71
- package/lib/Autocomplete/AutocompleteMenu.js +0 -223
- package/lib/Autocomplete/AutocompleteOverlay.d.ts +0 -17
- package/lib/Autocomplete/AutocompleteOverlay.js +0 -69
- package/lib/Autocomplete/index.d.ts +0 -2
- package/lib/Autocomplete/index.js +0 -15
- 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/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 -137
- 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 -63
- 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 -14
- package/lib/TextInputWithTokens.d.ts +0 -323
- package/lib/TextInputWithTokens.js +0 -244
- package/lib/ThemeProvider.d.ts +0 -26
- package/lib/Timeline.d.ts +0 -407
- package/lib/Token/IssueLabelToken.d.ts +0 -14
- package/lib/Token/IssueLabelToken.js +0 -144
- package/lib/Token/ProfileToken.d.ts +0 -7
- package/lib/Token/ProfileToken.js +0 -53
- package/lib/Token/Token.d.ts +0 -15
- package/lib/Token/Token.js +0 -94
- package/lib/Token/TokenBase.d.ts +0 -17
- package/lib/Token/TokenBase.js +0 -108
- package/lib/Token/_RemoveTokenButton.d.ts +0 -12
- package/lib/Token/_RemoveTokenButton.js +0 -77
- package/lib/Token/_TokenTextContainer.d.ts +0 -3
- package/lib/Token/_TokenTextContainer.js +0 -28
- package/lib/Token/index.d.ts +0 -3
- package/lib/Token/index.js +0 -31
- package/lib/Tooltip.d.ts +0 -18
- package/lib/Truncate.d.ts +0 -11
- package/lib/UnderlineNav.d.ts +0 -25
- package/lib/_TextInputWrapper.d.ts +0 -10
- package/lib/_TextInputWrapper.js +0 -51
- package/lib/_UnstyledTextInput.d.ts +0 -2
- package/lib/_UnstyledTextInput.js +0 -20
- 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 -8
- package/lib/hooks/useOverlay.d.ts +0 -15
- 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 -114
- 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/scrollIntoViewingArea.d.ts +0 -1
- package/lib/utils/scrollIntoViewingArea.js +0 -39
- 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/AriaRole.d.ts +0 -4
- package/lib/utils/types/ComponentProps.d.ts +0 -9
- package/lib/utils/types/ComponentProps.js +0 -1
- package/lib/utils/types/Flatten.d.ts +0 -4
- package/lib/utils/types/Flatten.js +0 -1
- package/lib/utils/types/Merge.d.ts +0 -19
- package/lib/utils/types/Merge.js +0 -1
- package/lib/utils/types/index.d.ts +0 -4
- package/lib/utils/types/index.js +0 -57
- 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 -88
- 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 -62
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +0 -104
- package/lib-esm/AnchoredOverlay/index.d.ts +0 -2
- package/lib-esm/AnchoredOverlay/index.js +0 -1
- package/lib-esm/Autocomplete/Autocomplete.d.ts +0 -40
- package/lib-esm/Autocomplete/Autocomplete.js +0 -47
- package/lib-esm/Autocomplete/AutocompleteContext.d.ts +0 -17
- package/lib-esm/Autocomplete/AutocompleteContext.js +0 -2
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +0 -9
- package/lib-esm/Autocomplete/AutocompleteInput.js +0 -131
- package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +0 -71
- package/lib-esm/Autocomplete/AutocompleteMenu.js +0 -204
- package/lib-esm/Autocomplete/AutocompleteOverlay.d.ts +0 -17
- package/lib-esm/Autocomplete/AutocompleteOverlay.js +0 -51
- package/lib-esm/Autocomplete/index.d.ts +0 -2
- package/lib-esm/Autocomplete/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/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 -109
- 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 -63
- 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 -14
- package/lib-esm/TextInputWithTokens.d.ts +0 -323
- package/lib-esm/TextInputWithTokens.js +0 -219
- package/lib-esm/ThemeProvider.d.ts +0 -26
- package/lib-esm/Timeline.d.ts +0 -407
- package/lib-esm/Token/IssueLabelToken.d.ts +0 -14
- package/lib-esm/Token/IssueLabelToken.js +0 -124
- package/lib-esm/Token/ProfileToken.d.ts +0 -7
- package/lib-esm/Token/ProfileToken.js +0 -33
- package/lib-esm/Token/Token.d.ts +0 -15
- package/lib-esm/Token/Token.js +0 -73
- package/lib-esm/Token/TokenBase.d.ts +0 -17
- package/lib-esm/Token/TokenBase.js +0 -87
- package/lib-esm/Token/_RemoveTokenButton.d.ts +0 -12
- package/lib-esm/Token/_RemoveTokenButton.js +0 -60
- package/lib-esm/Token/_TokenTextContainer.d.ts +0 -3
- package/lib-esm/Token/_TokenTextContainer.js +0 -15
- package/lib-esm/Token/index.d.ts +0 -3
- package/lib-esm/Token/index.js +0 -3
- 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/_TextInputWrapper.d.ts +0 -10
- package/lib-esm/_TextInputWrapper.js +0 -31
- package/lib-esm/_UnstyledTextInput.d.ts +0 -2
- package/lib-esm/_UnstyledTextInput.js +0 -7
- 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 -8
- package/lib-esm/hooks/useOverlay.d.ts +0 -15
- 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 -114
- 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/scrollIntoViewingArea.d.ts +0 -1
- package/lib-esm/utils/scrollIntoViewingArea.js +0 -30
- 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.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/AriaRole.d.ts +0 -4
- package/lib-esm/utils/types/AriaRole.js +0 -1
- package/lib-esm/utils/types/ComponentProps.d.ts +0 -9
- package/lib-esm/utils/types/ComponentProps.js +0 -1
- package/lib-esm/utils/types/Flatten.d.ts +0 -4
- package/lib-esm/utils/types/Flatten.js +0 -1
- package/lib-esm/utils/types/Merge.d.ts +0 -19
- package/lib-esm/utils/types/Merge.js +0 -1
- package/lib-esm/utils/types/index.d.ts +0 -4
- package/lib-esm/utils/types/index.js +0 -4
- package/lib-esm/utils/uniqueId.d.ts +0 -1
- package/lib-esm/utils/userAgent.d.ts +0 -1
@@ -1,88 +0,0 @@
|
|
1
|
-
import React, { Key } from 'react';
|
2
|
-
import type { AriaRole } from '../utils/types';
|
3
|
-
import { Group, GroupProps } from './Group';
|
4
|
-
import { ItemProps } from './Item';
|
5
|
-
import { Merge } from '../utils/types/Merge';
|
6
|
-
declare type RenderItemFn = (props: ItemProps) => React.ReactElement;
|
7
|
-
export declare type ItemInput = Merge<React.ComponentPropsWithoutRef<'div'>, ItemProps> | ((Partial<ItemProps> & {
|
8
|
-
renderItem: RenderItemFn;
|
9
|
-
}) & {
|
10
|
-
key?: Key;
|
11
|
-
});
|
12
|
-
/**
|
13
|
-
* Contract for props passed to the `List` component.
|
14
|
-
*/
|
15
|
-
export interface ListPropsBase {
|
16
|
-
/**
|
17
|
-
* A collection of `Item` props and `Item`-level custom `Item` renderers.
|
18
|
-
*/
|
19
|
-
items: ItemInput[];
|
20
|
-
/**
|
21
|
-
* The ARIA role describing the function of `List` component. `listbox` is a common value.
|
22
|
-
*/
|
23
|
-
role?: AriaRole;
|
24
|
-
/**
|
25
|
-
* id to attach to the base DOM node of the list
|
26
|
-
*/
|
27
|
-
id?: string;
|
28
|
-
/**
|
29
|
-
* A `List`-level custom `Item` renderer. Every `Item` within this `List`
|
30
|
-
* without a `Group`-level or `Item`-level custom `Item` renderer will be
|
31
|
-
* rendered using this function component.
|
32
|
-
*/
|
33
|
-
renderItem?: RenderItemFn;
|
34
|
-
/**
|
35
|
-
* A `List`-level custom `Group` renderer. Every `Group` within this `List`
|
36
|
-
* without a `Group`-level custom `Item` renderer will be rendered using
|
37
|
-
* this function component.
|
38
|
-
*/
|
39
|
-
renderGroup?: typeof Group;
|
40
|
-
/**
|
41
|
-
* Style variations. Usage is discretionary.
|
42
|
-
*
|
43
|
-
* - `"inset"` - `List` children are offset (vertically and horizontally) from `List`’s edges
|
44
|
-
* - `"full"` - `List` children are flush (vertically and horizontally) with `List` edges
|
45
|
-
*/
|
46
|
-
variant?: 'inset' | 'full';
|
47
|
-
/**
|
48
|
-
* For `Item`s which can be selected, whether `multiple` `Item`s or a `single` `Item` can be selected
|
49
|
-
*/
|
50
|
-
selectionVariant?: 'single' | 'multiple';
|
51
|
-
/**
|
52
|
-
* Whether to display a divider above each `Item` in this `List` when it does not follow a `Header` or `Divider`.
|
53
|
-
*/
|
54
|
-
showItemDividers?: boolean;
|
55
|
-
}
|
56
|
-
/**
|
57
|
-
* Contract for props passed to the `List` component, when its `Item`s are collected in `Group`s.
|
58
|
-
*/
|
59
|
-
export interface GroupedListProps extends ListPropsBase {
|
60
|
-
/**
|
61
|
-
* A collection of `Group` props (except `items`), plus a unique group identifier
|
62
|
-
* and `Group`-level custom `Item` or `Group` renderers.
|
63
|
-
*/
|
64
|
-
groupMetadata: ((Omit<GroupProps, 'items'> | Omit<Partial<GroupProps> & {
|
65
|
-
renderItem?: RenderItemFn;
|
66
|
-
renderGroup?: typeof Group;
|
67
|
-
}, 'items'>) & {
|
68
|
-
groupId: string;
|
69
|
-
})[];
|
70
|
-
/**
|
71
|
-
* A collection of `Item` props, plus associated group identifiers
|
72
|
-
* and `Item`-level custom `Item` renderers.
|
73
|
-
*/
|
74
|
-
items: ((ItemProps | (Partial<ItemProps> & {
|
75
|
-
renderItem: RenderItemFn;
|
76
|
-
})) & {
|
77
|
-
groupId: string;
|
78
|
-
})[];
|
79
|
-
}
|
80
|
-
/**
|
81
|
-
* Contract for props passed to the `List` component.
|
82
|
-
*/
|
83
|
-
export declare type ListProps = ListPropsBase | GroupedListProps;
|
84
|
-
/**
|
85
|
-
* Lists `Item`s, either grouped or ungrouped, with a `Divider` between each `Group`.
|
86
|
-
*/
|
87
|
-
export declare const List: React.ForwardRefExoticComponent<ListProps & React.RefAttributes<HTMLDivElement>>;
|
88
|
-
export {};
|
@@ -1,181 +0,0 @@
|
|
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
|
-
|
3
|
-
import React from 'react';
|
4
|
-
import { Group } from './Group';
|
5
|
-
import { Item } from './Item';
|
6
|
-
import { Divider } from './Divider';
|
7
|
-
import styled from 'styled-components';
|
8
|
-
import { get } from '../constants';
|
9
|
-
import { hasActiveDescendantAttribute } from '../behaviors/focusZone';
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Asserts that the given value fulfills the `GroupedListProps` contract.
|
13
|
-
* @param props A value which fulfills either the `ListPropsBase` or the `GroupedListProps` contract.
|
14
|
-
*/
|
15
|
-
function isGroupedListProps(props) {
|
16
|
-
return 'groupMetadata' in props;
|
17
|
-
}
|
18
|
-
/**
|
19
|
-
* Contract for props passed to the `List` component.
|
20
|
-
*/
|
21
|
-
|
22
|
-
|
23
|
-
const StyledList = styled.div.withConfig({
|
24
|
-
displayName: "List__StyledList",
|
25
|
-
componentId: "yr2k7d-0"
|
26
|
-
})(["font-size:", ";line-height:20px;&[", "],&:focus-within{--item-hover-bg-override:none;--item-hover-divider-border-color-override:", ";}"], get('fontSizes.1'), hasActiveDescendantAttribute, get('colors.border.muted'));
|
27
|
-
/**
|
28
|
-
* Returns `sx` prop values for `List` children matching the given `List` style variation.
|
29
|
-
* @param variant `List` style variation.
|
30
|
-
*/
|
31
|
-
|
32
|
-
function useListVariant(variant = 'inset') {
|
33
|
-
switch (variant) {
|
34
|
-
case 'full':
|
35
|
-
return {
|
36
|
-
headerStyle: {
|
37
|
-
paddingX: get('space.2')
|
38
|
-
},
|
39
|
-
itemStyle: {
|
40
|
-
borderRadius: 0
|
41
|
-
}
|
42
|
-
};
|
43
|
-
|
44
|
-
default:
|
45
|
-
return {
|
46
|
-
firstGroupStyle: {
|
47
|
-
marginTop: get('space.2')
|
48
|
-
},
|
49
|
-
lastGroupStyle: {
|
50
|
-
marginBottom: get('space.2')
|
51
|
-
},
|
52
|
-
itemStyle: {
|
53
|
-
marginX: get('space.2')
|
54
|
-
}
|
55
|
-
};
|
56
|
-
}
|
57
|
-
}
|
58
|
-
/**
|
59
|
-
* Lists `Item`s, either grouped or ungrouped, with a `Divider` between each `Group`.
|
60
|
-
*/
|
61
|
-
|
62
|
-
|
63
|
-
export const List = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
64
|
-
// Get `sx` prop values for `List` children matching the given `List` style variation.
|
65
|
-
const {
|
66
|
-
firstGroupStyle,
|
67
|
-
lastGroupStyle,
|
68
|
-
headerStyle,
|
69
|
-
itemStyle
|
70
|
-
} = useListVariant(props.variant);
|
71
|
-
/**
|
72
|
-
* Render a `Group` using the first of the following renderers that is defined:
|
73
|
-
* A `Group`-level or `List`-level custom `Group` renderer, or
|
74
|
-
* the default `Group` renderer.
|
75
|
-
*/
|
76
|
-
|
77
|
-
const renderGroup = groupProps => {
|
78
|
-
var _ref;
|
79
|
-
|
80
|
-
const GroupComponent = ((_ref = 'renderGroup' in groupProps && groupProps.renderGroup) !== null && _ref !== void 0 ? _ref : props.renderGroup) || Group;
|
81
|
-
return /*#__PURE__*/React.createElement(GroupComponent, _extends({}, groupProps, {
|
82
|
-
key: groupProps.groupId
|
83
|
-
}));
|
84
|
-
};
|
85
|
-
/**
|
86
|
-
* Render an `Item` using the first of the following renderers that is defined:
|
87
|
-
* An `Item`-level, `Group`-level, or `List`-level custom `Item` renderer,
|
88
|
-
* or the default `Item` renderer.
|
89
|
-
*/
|
90
|
-
|
91
|
-
|
92
|
-
const renderItem = (itemProps, item, itemIndex) => {
|
93
|
-
var _ref2, _ref3, _itemProps$id;
|
94
|
-
|
95
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
96
|
-
const ItemComponent = 'renderItem' in itemProps && itemProps.renderItem || props.renderItem || Item;
|
97
|
-
const key = (_ref2 = (_ref3 = 'key' in itemProps ? itemProps.key : undefined) !== null && _ref3 !== void 0 ? _ref3 : (_itemProps$id = itemProps.id) === null || _itemProps$id === void 0 ? void 0 : _itemProps$id.toString()) !== null && _ref2 !== void 0 ? _ref2 : itemIndex.toString();
|
98
|
-
return /*#__PURE__*/React.createElement(ItemComponent, _extends({
|
99
|
-
showDivider: props.showItemDividers,
|
100
|
-
selectionVariant: props.selectionVariant
|
101
|
-
}, itemProps, {
|
102
|
-
key: key,
|
103
|
-
sx: { ...itemStyle,
|
104
|
-
...itemProps.sx
|
105
|
-
},
|
106
|
-
item: item
|
107
|
-
}));
|
108
|
-
};
|
109
|
-
/**
|
110
|
-
* An array of `Group`s, each with an associated `Header` and with an array of `Item`s belonging to that `Group`.
|
111
|
-
*/
|
112
|
-
|
113
|
-
|
114
|
-
let groups = []; // Collect rendered `Item`s into `Group`s, avoiding excess iteration over the lists of `items` and `groupMetadata`:
|
115
|
-
|
116
|
-
if (!isGroupedListProps(props)) {
|
117
|
-
// When no `groupMetadata`s is provided, collect rendered `Item`s into a single anonymous `Group`.
|
118
|
-
groups = [{
|
119
|
-
items: props.items.map((item, index) => renderItem(item, item, index)),
|
120
|
-
groupId: '0'
|
121
|
-
}];
|
122
|
-
} else {
|
123
|
-
// When `groupMetadata` is provided, collect rendered `Item`s into their associated `Group`s.
|
124
|
-
|
125
|
-
/**
|
126
|
-
* A map of group identifiers to `Group`s, each with an associated array of `Item`s belonging to that `Group`.
|
127
|
-
*/
|
128
|
-
const groupMap = props.groupMetadata.reduce((groupAccumulator, groupMetadata) => groupAccumulator.set(groupMetadata.groupId, groupMetadata), new Map());
|
129
|
-
|
130
|
-
for (const itemProps of props.items) {
|
131
|
-
var _group$items$length, _group$items, _group$items2;
|
132
|
-
|
133
|
-
// Look up the group associated with the current item.
|
134
|
-
const group = groupMap.get(itemProps.groupId);
|
135
|
-
const itemIndex = (_group$items$length = group === null || group === void 0 ? void 0 : (_group$items = group.items) === null || _group$items === void 0 ? void 0 : _group$items.length) !== null && _group$items$length !== void 0 ? _group$items$length : 0; // Upsert the group to include the current item (rendered).
|
136
|
-
|
137
|
-
groupMap.set(itemProps.groupId, { ...group,
|
138
|
-
items: [...((_group$items2 = group === null || group === void 0 ? void 0 : group.items) !== null && _group$items2 !== void 0 ? _group$items2 : []), renderItem({
|
139
|
-
showDivider: group === null || group === void 0 ? void 0 : group.showItemDividers,
|
140
|
-
...(group && 'renderItem' in group && {
|
141
|
-
renderItem: group.renderItem
|
142
|
-
}),
|
143
|
-
...itemProps
|
144
|
-
}, itemProps, itemIndex)]
|
145
|
-
});
|
146
|
-
}
|
147
|
-
|
148
|
-
groups = [...groupMap.values()];
|
149
|
-
}
|
150
|
-
|
151
|
-
return /*#__PURE__*/React.createElement(StyledList, _extends({}, props, {
|
152
|
-
ref: forwardedRef
|
153
|
-
}), groups.map(({
|
154
|
-
header,
|
155
|
-
...groupProps
|
156
|
-
}, index) => {
|
157
|
-
const hasFilledHeader = (header === null || header === void 0 ? void 0 : header.variant) === 'filled';
|
158
|
-
const shouldShowDivider = index > 0 && !hasFilledHeader;
|
159
|
-
return /*#__PURE__*/React.createElement(React.Fragment, {
|
160
|
-
key: groupProps.groupId
|
161
|
-
}, shouldShowDivider ? /*#__PURE__*/React.createElement(Divider, {
|
162
|
-
key: `${groupProps.groupId}-divider`
|
163
|
-
}) : null, renderGroup({
|
164
|
-
sx: { ...(index === 0 && firstGroupStyle),
|
165
|
-
...(index === groups.length - 1 && lastGroupStyle),
|
166
|
-
...(index > 0 && !shouldShowDivider && {
|
167
|
-
mt: 2
|
168
|
-
})
|
169
|
-
},
|
170
|
-
...(header && {
|
171
|
-
header: { ...header,
|
172
|
-
sx: { ...headerStyle,
|
173
|
-
...header.sx
|
174
|
-
}
|
175
|
-
}
|
176
|
-
}),
|
177
|
-
...groupProps
|
178
|
-
}));
|
179
|
-
}));
|
180
|
-
});
|
181
|
-
List.displayName = 'ActionList';
|
@@ -1,17 +0,0 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
import { Group } from './Group';
|
3
|
-
import { Divider } from './Divider';
|
4
|
-
export type { ListProps as ActionListProps } from './List';
|
5
|
-
export type { GroupProps } from './Group';
|
6
|
-
export type { ItemProps } from './Item';
|
7
|
-
/**
|
8
|
-
* Collection of list-related components.
|
9
|
-
*/
|
10
|
-
export declare const ActionList: import("react").ForwardRefExoticComponent<import("./List").ListProps & import("react").RefAttributes<HTMLDivElement>> & {
|
11
|
-
/** Collects related `Items` in an `ActionList`. */
|
12
|
-
Group: typeof Group;
|
13
|
-
/** An actionable or selectable `Item` with an optional icon and description. */
|
14
|
-
Item: import("@radix-ui/react-polymorphic").ForwardRefComponent<"div", import("./Item").ItemProps>;
|
15
|
-
/** Visually separates `Item`s or `Group`s in an `ActionList`. */
|
16
|
-
Divider: typeof Divider;
|
17
|
-
};
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { List } from './List';
|
2
|
-
import { Group } from './Group';
|
3
|
-
import { Item } from './Item';
|
4
|
-
import { Divider } from './Divider';
|
5
|
-
|
6
|
-
/**
|
7
|
-
* Collection of list-related components.
|
8
|
-
*/
|
9
|
-
export const ActionList = Object.assign(List, {
|
10
|
-
/** Collects related `Items` in an `ActionList`. */
|
11
|
-
Group,
|
12
|
-
|
13
|
-
/** An actionable or selectable `Item` with an optional icon and description. */
|
14
|
-
Item,
|
15
|
-
|
16
|
-
/** Visually separates `Item`s or `Group`s in an `ActionList`. */
|
17
|
-
Divider
|
18
|
-
});
|
package/lib-esm/ActionMenu.d.ts
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
import { GroupedListProps, ListPropsBase } from './ActionList/List';
|
2
|
-
import { ItemProps } from './ActionList/Item';
|
3
|
-
import { Divider } from './ActionList/Divider';
|
4
|
-
import React from 'react';
|
5
|
-
import { OverlayProps } from './Overlay';
|
6
|
-
import { AnchoredOverlayWrapperAnchorProps } from './AnchoredOverlay/AnchoredOverlay';
|
7
|
-
interface ActionMenuBaseProps extends Partial<Omit<GroupedListProps, keyof ListPropsBase>>, ListPropsBase {
|
8
|
-
/**
|
9
|
-
* Content that is passed into the renderAnchor component, which is a button by default.
|
10
|
-
*/
|
11
|
-
anchorContent?: React.ReactNode;
|
12
|
-
/**
|
13
|
-
* A callback that triggers both on clicks and keyboard events. This callback will be overridden by item level `onAction` callbacks.
|
14
|
-
*/
|
15
|
-
onAction?: (props: ItemProps, event?: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>) => void;
|
16
|
-
/**
|
17
|
-
* If defined, will control the open/closed state of the overlay. Must be used in conjuction with `setOpen`.
|
18
|
-
*/
|
19
|
-
open?: boolean;
|
20
|
-
/**
|
21
|
-
* If defined, will control the open/closed state of the overlay. Must be used in conjuction with `open`.
|
22
|
-
*/
|
23
|
-
setOpen?: (s: boolean) => void;
|
24
|
-
/**
|
25
|
-
* Props to be spread on the internal `Overlay` component.
|
26
|
-
*/
|
27
|
-
overlayProps?: Partial<OverlayProps>;
|
28
|
-
}
|
29
|
-
export declare type ActionMenuProps = ActionMenuBaseProps & AnchoredOverlayWrapperAnchorProps;
|
30
|
-
export declare const ActionMenu: {
|
31
|
-
({ anchorContent, renderAnchor, anchorRef: externalAnchorRef, onAction, open, setOpen, overlayProps, items, ...listProps }: ActionMenuProps): JSX.Element;
|
32
|
-
displayName: string;
|
33
|
-
} & {
|
34
|
-
Divider: typeof Divider;
|
35
|
-
Item: {
|
36
|
-
(props: ItemProps): JSX.Element;
|
37
|
-
displayName: string;
|
38
|
-
};
|
39
|
-
};
|
40
|
-
export {};
|
package/lib-esm/ActionMenu.js
DELETED
@@ -1,82 +0,0 @@
|
|
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
|
-
|
3
|
-
import { List } from './ActionList/List';
|
4
|
-
import { Item } from './ActionList/Item';
|
5
|
-
import { Divider } from './ActionList/Divider';
|
6
|
-
import Button from './Button';
|
7
|
-
import React, { useCallback, useMemo } from 'react';
|
8
|
-
import { AnchoredOverlay } from './AnchoredOverlay';
|
9
|
-
import { useProvidedStateOrCreate } from './hooks/useProvidedStateOrCreate';
|
10
|
-
import { useProvidedRefOrCreate } from './hooks';
|
11
|
-
|
12
|
-
const ActionMenuItem = props => /*#__PURE__*/React.createElement(Item, _extends({
|
13
|
-
role: "menuitem"
|
14
|
-
}, props));
|
15
|
-
|
16
|
-
ActionMenuItem.displayName = "ActionMenuItem";
|
17
|
-
ActionMenuItem.displayName = 'ActionMenu.Item';
|
18
|
-
|
19
|
-
const ActionMenuBase = ({
|
20
|
-
anchorContent,
|
21
|
-
renderAnchor = props => /*#__PURE__*/React.createElement(Button, props),
|
22
|
-
anchorRef: externalAnchorRef,
|
23
|
-
onAction,
|
24
|
-
open,
|
25
|
-
setOpen,
|
26
|
-
overlayProps,
|
27
|
-
items,
|
28
|
-
...listProps
|
29
|
-
}) => {
|
30
|
-
const [combinedOpenState, setCombinedOpenState] = useProvidedStateOrCreate(open, setOpen, false);
|
31
|
-
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
32
|
-
const onOpen = useCallback(() => setCombinedOpenState(true), [setCombinedOpenState]);
|
33
|
-
const onClose = useCallback(() => setCombinedOpenState(false), [setCombinedOpenState]);
|
34
|
-
const renderMenuAnchor = useMemo(() => {
|
35
|
-
if (renderAnchor === null) {
|
36
|
-
return null;
|
37
|
-
}
|
38
|
-
|
39
|
-
return props => {
|
40
|
-
return renderAnchor({
|
41
|
-
'aria-label': 'menu',
|
42
|
-
children: anchorContent,
|
43
|
-
...props
|
44
|
-
});
|
45
|
-
};
|
46
|
-
}, [anchorContent, renderAnchor]);
|
47
|
-
const itemsToRender = useMemo(() => {
|
48
|
-
return items.map(item => {
|
49
|
-
return { ...item,
|
50
|
-
role: 'menuitem',
|
51
|
-
onAction: (props, event) => {
|
52
|
-
var _item$onAction;
|
53
|
-
|
54
|
-
const actionCallback = (_item$onAction = item.onAction) !== null && _item$onAction !== void 0 ? _item$onAction : onAction;
|
55
|
-
actionCallback === null || actionCallback === void 0 ? void 0 : actionCallback(props, event);
|
56
|
-
|
57
|
-
if (!event.defaultPrevented) {
|
58
|
-
onClose();
|
59
|
-
}
|
60
|
-
}
|
61
|
-
};
|
62
|
-
});
|
63
|
-
}, [items, onAction, onClose]);
|
64
|
-
return /*#__PURE__*/React.createElement(AnchoredOverlay, {
|
65
|
-
renderAnchor: renderMenuAnchor,
|
66
|
-
anchorRef: anchorRef,
|
67
|
-
open: combinedOpenState,
|
68
|
-
onOpen: onOpen,
|
69
|
-
onClose: onClose,
|
70
|
-
overlayProps: overlayProps
|
71
|
-
}, /*#__PURE__*/React.createElement(List, _extends({}, listProps, {
|
72
|
-
role: "menu",
|
73
|
-
items: itemsToRender
|
74
|
-
})));
|
75
|
-
};
|
76
|
-
|
77
|
-
ActionMenuBase.displayName = "ActionMenuBase";
|
78
|
-
ActionMenuBase.displayName = 'ActionMenu';
|
79
|
-
export const ActionMenu = Object.assign(ActionMenuBase, {
|
80
|
-
Divider,
|
81
|
-
Item: ActionMenuItem
|
82
|
-
});
|
@@ -1,62 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { OverlayProps } from '../Overlay';
|
3
|
-
import { FocusTrapHookSettings } from '../hooks/useFocusTrap';
|
4
|
-
import { FocusZoneHookSettings } from '../hooks/useFocusZone';
|
5
|
-
import { PositionSettings } from '../behaviors/anchoredPosition';
|
6
|
-
interface AnchoredOverlayPropsWithAnchor {
|
7
|
-
/**
|
8
|
-
* A custom function component used to render the anchor element.
|
9
|
-
* Will receive the selected text as `children` prop when an item is activated.
|
10
|
-
*/
|
11
|
-
renderAnchor: <T extends React.HTMLAttributes<HTMLElement>>(props: T) => JSX.Element;
|
12
|
-
/**
|
13
|
-
* An override to the internal ref that will be spread on to the renderAnchor
|
14
|
-
*/
|
15
|
-
anchorRef?: React.RefObject<HTMLElement>;
|
16
|
-
}
|
17
|
-
interface AnchoredOverlayPropsWithoutAnchor {
|
18
|
-
/**
|
19
|
-
* A custom function component used to render the anchor element.
|
20
|
-
* When renderAnchor is null, an anchorRef is required.
|
21
|
-
*/
|
22
|
-
renderAnchor: null;
|
23
|
-
/**
|
24
|
-
* An override to the internal renderAnchor ref that will be used to position the overlay.
|
25
|
-
* When renderAnchor is null this can be used to make an anchor that is detached from ActionMenu.
|
26
|
-
*/
|
27
|
-
anchorRef: React.RefObject<HTMLElement>;
|
28
|
-
}
|
29
|
-
export declare type AnchoredOverlayWrapperAnchorProps = Partial<AnchoredOverlayPropsWithAnchor> | AnchoredOverlayPropsWithoutAnchor;
|
30
|
-
interface AnchoredOverlayBaseProps extends Pick<OverlayProps, 'height' | 'width'> {
|
31
|
-
/**
|
32
|
-
* Determines whether the overlay portion of the component should be shown or not
|
33
|
-
*/
|
34
|
-
open: boolean;
|
35
|
-
/**
|
36
|
-
* A callback which is called whenever the overlay is currently closed and an "open gesture" is detected.
|
37
|
-
*/
|
38
|
-
onOpen?: (gesture: 'anchor-click' | 'anchor-key-press') => unknown;
|
39
|
-
/**
|
40
|
-
* A callback which is called whenever the overlay is currently open and a "close gesture" is detected.
|
41
|
-
*/
|
42
|
-
onClose?: (gesture: 'anchor-click' | 'click-outside' | 'escape') => unknown;
|
43
|
-
/**
|
44
|
-
* Props to be spread on the internal `Overlay` component.
|
45
|
-
*/
|
46
|
-
overlayProps?: Partial<OverlayProps>;
|
47
|
-
/**
|
48
|
-
* Settings to apply to the Focus Zone on the internal `Overlay` component.
|
49
|
-
*/
|
50
|
-
focusTrapSettings?: Partial<FocusTrapHookSettings>;
|
51
|
-
/**
|
52
|
-
* Settings to apply to the Focus Zone on the internal `Overlay` component.
|
53
|
-
*/
|
54
|
-
focusZoneSettings?: Partial<FocusZoneHookSettings>;
|
55
|
-
}
|
56
|
-
export declare type AnchoredOverlayProps = AnchoredOverlayBaseProps & (AnchoredOverlayPropsWithAnchor | AnchoredOverlayPropsWithoutAnchor) & Partial<Pick<PositionSettings, 'align' | 'side'>>;
|
57
|
-
/**
|
58
|
-
* An `AnchoredOverlay` provides an anchor that will open a floating overlay positioned relative to the anchor.
|
59
|
-
* The overlay can be opened and navigated using keyboard or mouse.
|
60
|
-
*/
|
61
|
-
export declare const AnchoredOverlay: React.FC<AnchoredOverlayProps>;
|
62
|
-
export {};
|
@@ -1,104 +0,0 @@
|
|
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
|
-
|
3
|
-
import React, { useCallback, useEffect } from 'react';
|
4
|
-
import Overlay from '../Overlay';
|
5
|
-
import { useFocusTrap } from '../hooks/useFocusTrap';
|
6
|
-
import { useFocusZone } from '../hooks/useFocusZone';
|
7
|
-
import { useAnchoredPosition, useProvidedRefOrCreate, useRenderForcingRef } from '../hooks';
|
8
|
-
import { useSSRSafeId } from '@react-aria/ssr';
|
9
|
-
|
10
|
-
/**
|
11
|
-
* An `AnchoredOverlay` provides an anchor that will open a floating overlay positioned relative to the anchor.
|
12
|
-
* The overlay can be opened and navigated using keyboard or mouse.
|
13
|
-
*/
|
14
|
-
export const AnchoredOverlay = ({
|
15
|
-
renderAnchor,
|
16
|
-
anchorRef: externalAnchorRef,
|
17
|
-
children,
|
18
|
-
open,
|
19
|
-
onOpen,
|
20
|
-
onClose,
|
21
|
-
height,
|
22
|
-
width,
|
23
|
-
overlayProps,
|
24
|
-
focusTrapSettings,
|
25
|
-
focusZoneSettings,
|
26
|
-
side,
|
27
|
-
align
|
28
|
-
}) => {
|
29
|
-
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
30
|
-
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
31
|
-
const anchorId = useSSRSafeId();
|
32
|
-
const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('click-outside'), [onClose]);
|
33
|
-
const onEscape = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('escape'), [onClose]);
|
34
|
-
const onAnchorKeyDown = useCallback(event => {
|
35
|
-
if (!event.defaultPrevented) {
|
36
|
-
if (!open && ['ArrowDown', 'ArrowUp', ' ', 'Enter'].includes(event.key)) {
|
37
|
-
onOpen === null || onOpen === void 0 ? void 0 : onOpen('anchor-key-press');
|
38
|
-
event.preventDefault();
|
39
|
-
}
|
40
|
-
}
|
41
|
-
}, [open, onOpen]);
|
42
|
-
const onAnchorClick = useCallback(event => {
|
43
|
-
if (event.defaultPrevented || event.button !== 0) {
|
44
|
-
return;
|
45
|
-
}
|
46
|
-
|
47
|
-
if (!open) {
|
48
|
-
onOpen === null || onOpen === void 0 ? void 0 : onOpen('anchor-click');
|
49
|
-
} else {
|
50
|
-
onClose === null || onClose === void 0 ? void 0 : onClose('anchor-click');
|
51
|
-
}
|
52
|
-
}, [open, onOpen, onClose]);
|
53
|
-
const {
|
54
|
-
position
|
55
|
-
} = useAnchoredPosition({
|
56
|
-
anchorElementRef: anchorRef,
|
57
|
-
floatingElementRef: overlayRef,
|
58
|
-
side,
|
59
|
-
align
|
60
|
-
}, [overlayRef.current]);
|
61
|
-
useEffect(() => {
|
62
|
-
// ensure overlay ref gets cleared when closed, so position can reset between closing/re-opening
|
63
|
-
if (!open && overlayRef.current) {
|
64
|
-
updateOverlayRef(null);
|
65
|
-
}
|
66
|
-
}, [open, overlayRef, updateOverlayRef]);
|
67
|
-
useFocusZone({
|
68
|
-
containerRef: overlayRef,
|
69
|
-
disabled: !open || !position,
|
70
|
-
...focusZoneSettings
|
71
|
-
});
|
72
|
-
useFocusTrap({
|
73
|
-
containerRef: overlayRef,
|
74
|
-
disabled: !open || !position,
|
75
|
-
...focusTrapSettings
|
76
|
-
});
|
77
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, renderAnchor && renderAnchor({
|
78
|
-
ref: anchorRef,
|
79
|
-
id: anchorId,
|
80
|
-
'aria-labelledby': anchorId,
|
81
|
-
'aria-haspopup': 'true',
|
82
|
-
tabIndex: 0,
|
83
|
-
onClick: onAnchorClick,
|
84
|
-
onKeyDown: onAnchorKeyDown
|
85
|
-
}), open ? /*#__PURE__*/React.createElement(Overlay, _extends({
|
86
|
-
returnFocusRef: anchorRef,
|
87
|
-
onClickOutside: onClickOutside,
|
88
|
-
ignoreClickRefs: [anchorRef],
|
89
|
-
onEscape: onEscape,
|
90
|
-
ref: updateOverlayRef,
|
91
|
-
role: "none",
|
92
|
-
visibility: position ? 'visible' : 'hidden',
|
93
|
-
height: height,
|
94
|
-
width: width,
|
95
|
-
top: (position === null || position === void 0 ? void 0 : position.top) || 0,
|
96
|
-
left: (position === null || position === void 0 ? void 0 : position.left) || 0,
|
97
|
-
anchorSide: position === null || position === void 0 ? void 0 : position.anchorSide
|
98
|
-
}, overlayProps), children) : null);
|
99
|
-
};
|
100
|
-
AnchoredOverlay.displayName = 'AnchoredOverlay';
|
101
|
-
AnchoredOverlay.defaultProps = {
|
102
|
-
side: 'outside-bottom',
|
103
|
-
align: 'start'
|
104
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export { AnchoredOverlay } from './AnchoredOverlay';
|
@@ -1,40 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { ComponentProps } from '../utils/types';
|
3
|
-
import AutocompleteMenu from './AutocompleteMenu';
|
4
|
-
declare const Autocomplete: React.FC<{
|
5
|
-
id?: string;
|
6
|
-
}>;
|
7
|
-
export declare type AutocompleteProps = ComponentProps<typeof Autocomplete>;
|
8
|
-
export type { AutocompleteInputProps } from './AutocompleteInput';
|
9
|
-
export type { AutocompleteMenuProps } from './AutocompleteMenu';
|
10
|
-
export type { AutocompleteOverlayProps } from './AutocompleteOverlay';
|
11
|
-
declare const _default: React.FC<{
|
12
|
-
id?: string | undefined;
|
13
|
-
}> & {
|
14
|
-
AutocompleteContext: React.Context<{
|
15
|
-
activeDescendantRef?: React.MutableRefObject<HTMLElement | null> | undefined;
|
16
|
-
autocompleteSuggestion?: string | undefined;
|
17
|
-
id?: string | undefined;
|
18
|
-
inputRef?: React.MutableRefObject<HTMLInputElement | null> | undefined;
|
19
|
-
inputValue?: string | undefined;
|
20
|
-
isMenuDirectlyActivated?: boolean | undefined;
|
21
|
-
scrollContainerRef?: React.MutableRefObject<HTMLElement | null> | undefined;
|
22
|
-
selectedItemLength?: number | undefined;
|
23
|
-
setAutocompleteSuggestion?: React.Dispatch<React.SetStateAction<string>> | undefined;
|
24
|
-
setInputValue?: React.Dispatch<React.SetStateAction<string>> | undefined;
|
25
|
-
setIsMenuDirectlyActivated?: React.Dispatch<React.SetStateAction<boolean>> | undefined;
|
26
|
-
setSelectedItemLength?: React.Dispatch<React.SetStateAction<number | undefined>> | undefined;
|
27
|
-
setShowMenu?: React.Dispatch<React.SetStateAction<boolean>> | undefined;
|
28
|
-
showMenu?: boolean | undefined;
|
29
|
-
}>;
|
30
|
-
Input: import("@radix-ui/react-polymorphic").ForwardRefComponent<"input", {
|
31
|
-
as?: React.ComponentType<any> | undefined;
|
32
|
-
}>;
|
33
|
-
Menu: typeof AutocompleteMenu;
|
34
|
-
Overlay: React.FC<{
|
35
|
-
menuAnchorRef?: React.RefObject<HTMLElement> | undefined;
|
36
|
-
overlayProps?: Partial<import("..").OverlayProps> | undefined;
|
37
|
-
children?: React.ReactNode;
|
38
|
-
} & Pick<React.AriaAttributes, "aria-labelledby">>;
|
39
|
-
};
|
40
|
-
export default _default;
|