@primer/components 0.0.0-2021102995710 → 0.0.0-202110303104
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 +4 -90
- package/dist/browser.esm.js +774 -718
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +772 -716
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Divider.jsx +29 -0
- package/lib/ActionList/Group.jsx +23 -0
- package/lib/ActionList/Header.jsx +66 -0
- package/lib/ActionList/Item.js +52 -27
- package/lib/ActionList/Item.jsx +311 -0
- package/lib/ActionList/List.jsx +138 -0
- package/lib/ActionList/index.js +12 -23
- package/lib/ActionList2/Description.jsx +29 -0
- package/lib/ActionList2/Divider.jsx +22 -0
- package/lib/ActionList2/Group.d.ts +2 -28
- package/lib/ActionList2/Group.js +6 -55
- package/lib/ActionList2/Group.jsx +25 -0
- package/lib/ActionList2/Header.jsx +36 -0
- package/lib/ActionList2/Item.jsx +174 -0
- package/lib/ActionList2/LinkItem.jsx +28 -0
- package/lib/ActionList2/List.d.ts +1 -1
- package/lib/ActionList2/List.js +2 -1
- package/lib/ActionList2/List.jsx +41 -0
- package/lib/ActionList2/Selection.jsx +50 -0
- package/lib/ActionList2/Visuals.jsx +48 -0
- package/lib/ActionList2/index.js +23 -41
- package/lib/ActionMenu.jsx +73 -0
- package/lib/AnchoredOverlay/AnchoredOverlay.jsx +100 -0
- package/lib/AnchoredOverlay/index.js +4 -12
- package/lib/Autocomplete/Autocomplete.d.ts +3 -3
- package/lib/Autocomplete/Autocomplete.jsx +100 -0
- package/lib/Autocomplete/AutocompleteContext.jsx +5 -0
- package/lib/Autocomplete/AutocompleteInput.d.ts +3 -3
- package/lib/Autocomplete/AutocompleteInput.jsx +113 -0
- package/lib/Autocomplete/AutocompleteMenu.jsx +190 -0
- package/lib/Autocomplete/AutocompleteOverlay.jsx +55 -0
- package/lib/Autocomplete/index.js +7 -14
- package/lib/Avatar.jsx +34 -0
- package/lib/AvatarPair.jsx +29 -0
- package/lib/AvatarStack.jsx +151 -0
- package/lib/BaseStyles.jsx +65 -0
- package/lib/BorderBox.jsx +18 -0
- package/lib/Box.jsx +10 -0
- package/lib/BranchName.jsx +20 -0
- package/lib/Breadcrumbs.d.ts +7 -8
- package/lib/Breadcrumbs.js +12 -7
- package/lib/Breadcrumbs.jsx +74 -0
- package/lib/Button/Button.d.ts +3 -2
- package/lib/Button/Button.js +6 -2
- package/lib/Button/Button.jsx +60 -0
- package/lib/Button/ButtonBase.d.ts +8 -5
- package/lib/Button/ButtonBase.js +5 -1
- package/lib/Button/ButtonBase.jsx +36 -0
- package/lib/Button/ButtonClose.d.ts +46 -3
- package/lib/Button/ButtonClose.js +1 -1
- package/lib/Button/ButtonClose.jsx +55 -0
- package/lib/Button/ButtonDanger.d.ts +3 -2
- package/lib/Button/ButtonDanger.js +6 -2
- package/lib/Button/ButtonDanger.jsx +63 -0
- package/lib/Button/ButtonGroup.jsx +55 -0
- package/lib/Button/ButtonInvisible.d.ts +3 -2
- package/lib/Button/ButtonInvisible.js +6 -2
- package/lib/Button/ButtonInvisible.jsx +52 -0
- package/lib/Button/ButtonOutline.d.ts +3 -2
- package/lib/Button/ButtonOutline.js +6 -2
- package/lib/Button/ButtonOutline.jsx +63 -0
- package/lib/Button/ButtonPrimary.d.ts +3 -2
- package/lib/Button/ButtonPrimary.js +6 -2
- package/lib/Button/ButtonPrimary.jsx +62 -0
- package/lib/Button/ButtonStyles.jsx +37 -0
- package/lib/Button/ButtonTableList.d.ts +2 -1
- package/lib/Button/ButtonTableList.js +1 -1
- package/lib/Button/ButtonTableList.jsx +49 -0
- package/lib/Button/index.js +21 -70
- package/lib/Caret.jsx +93 -0
- package/lib/CircleBadge.d.ts +5 -4
- package/lib/CircleBadge.js +1 -1
- package/lib/CircleBadge.jsx +43 -0
- package/lib/CircleOcticon.d.ts +1 -1
- package/lib/CircleOcticon.jsx +21 -0
- package/lib/CounterLabel.d.ts +2 -1
- package/lib/CounterLabel.js +1 -1
- package/lib/CounterLabel.jsx +44 -0
- package/lib/Details.jsx +21 -0
- package/lib/Dialog/ConfirmationDialog.jsx +146 -0
- package/lib/Dialog/Dialog.d.ts +9 -5
- package/lib/Dialog/Dialog.js +11 -17
- package/lib/Dialog/Dialog.jsx +273 -0
- package/lib/Dialog.d.ts +5 -4
- package/lib/Dialog.js +1 -1
- package/lib/Dialog.jsx +131 -0
- package/lib/Dropdown.d.ts +99 -10
- package/lib/Dropdown.js +3 -3
- package/lib/Dropdown.jsx +134 -0
- package/lib/DropdownMenu/DropdownButton.d.ts +47 -3
- package/lib/DropdownMenu/DropdownButton.js +1 -3
- package/lib/DropdownMenu/DropdownButton.jsx +14 -0
- package/lib/DropdownMenu/DropdownMenu.jsx +70 -0
- package/lib/DropdownMenu/index.js +6 -20
- package/lib/DropdownStyles.js +18 -26
- package/lib/EmojiPicker/EmojiPicker.d.ts +15 -0
- package/lib/EmojiPicker/EmojiPicker.js +205 -0
- package/lib/EmojiPicker/EmojiPicker.jsx +125 -0
- package/lib/EmojiPicker/EmojiPickerAnchor.d.ts +0 -0
- package/lib/EmojiPicker/EmojiPickerAnchor.js +1 -0
- package/lib/EmojiPicker/EmojiPickerAnchor.jsx +1 -0
- package/lib/EmojiPicker/EmojiPickerPanel.d.ts +3 -0
- package/lib/EmojiPicker/EmojiPickerPanel.js +18 -0
- package/lib/EmojiPicker/EmojiPickerPanel.jsx +10 -0
- package/lib/EmojiPicker/data.d.ts +9 -0
- package/lib/EmojiPicker/data.js +7254 -0
- package/lib/EmojiPicker/index.d.ts +2 -0
- package/lib/EmojiPicker/index.js +8 -0
- package/lib/FilterList.d.ts +303 -264
- package/lib/FilterList.js +6 -2
- package/lib/FilterList.jsx +63 -0
- package/lib/FilteredActionList/FilteredActionList.jsx +100 -0
- package/lib/FilteredActionList/index.js +4 -12
- package/lib/FilteredSearch.d.ts +2 -1
- package/lib/FilteredSearch.js +1 -1
- package/lib/FilteredSearch.jsx +29 -0
- package/lib/Flash.d.ts +2 -1
- package/lib/Flash.js +1 -1
- package/lib/Flash.jsx +70 -0
- package/lib/Flex.jsx +15 -0
- package/lib/FormGroup.d.ts +5 -4
- package/lib/FormGroup.js +2 -2
- package/lib/FormGroup.jsx +25 -0
- package/lib/Grid.jsx +15 -0
- package/lib/Header.d.ts +7 -6
- package/lib/Header.js +4 -4
- package/lib/Header.jsx +90 -0
- package/lib/Heading.jsx +21 -0
- package/lib/Label.d.ts +2 -1
- package/lib/Label.js +3 -2
- package/lib/Label.jsx +84 -0
- package/lib/LabelGroup.d.ts +2 -1
- package/lib/LabelGroup.js +1 -1
- package/lib/LabelGroup.jsx +19 -0
- package/lib/Link.d.ts +2 -1
- package/lib/Link.js +1 -1
- package/lib/Link.jsx +38 -0
- package/lib/NewButton/button-counter.jsx +14 -0
- package/lib/NewButton/button.js +42 -34
- package/lib/NewButton/button.jsx +278 -0
- package/lib/NewButton/index.js +5 -12
- package/lib/NewButton/types.js +2 -1
- package/lib/Overlay.d.ts +11 -14
- package/lib/Overlay.js +4 -3
- package/lib/Overlay.jsx +156 -0
- package/lib/Pagehead.d.ts +2 -1
- package/lib/Pagehead.js +1 -1
- package/lib/Pagehead.jsx +18 -0
- package/lib/Pagination/Pagination.js +1 -1
- package/lib/Pagination/Pagination.jsx +163 -0
- package/lib/Pagination/index.js +6 -12
- package/lib/Pagination/model.jsx +174 -0
- package/lib/PointerBox.jsx +25 -0
- package/lib/Popover.d.ts +5 -4
- package/lib/Popover.js +5 -4
- package/lib/Popover.jsx +210 -0
- package/lib/Portal/Portal.jsx +79 -0
- package/lib/Portal/index.js +5 -16
- package/lib/Position.d.ts +4 -4
- package/lib/Position.jsx +46 -0
- package/lib/ProgressBar.jsx +39 -0
- package/lib/SelectMenu/SelectMenu.d.ts +189 -21
- package/lib/SelectMenu/SelectMenu.js +3 -1
- package/lib/SelectMenu/SelectMenu.jsx +114 -0
- package/lib/SelectMenu/SelectMenuContext.jsx +5 -0
- package/lib/SelectMenu/SelectMenuDivider.d.ts +2 -1
- package/lib/SelectMenu/SelectMenuDivider.js +1 -1
- package/lib/SelectMenu/SelectMenuDivider.jsx +43 -0
- package/lib/SelectMenu/SelectMenuFilter.js +1 -1
- package/lib/SelectMenu/SelectMenuFilter.jsx +59 -0
- package/lib/SelectMenu/SelectMenuFooter.d.ts +2 -1
- package/lib/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib/SelectMenu/SelectMenuFooter.jsx +46 -0
- package/lib/SelectMenu/SelectMenuHeader.d.ts +2 -1
- package/lib/SelectMenu/SelectMenuHeader.js +1 -1
- package/lib/SelectMenu/SelectMenuHeader.jsx +44 -0
- package/lib/SelectMenu/SelectMenuItem.d.ts +3 -2
- package/lib/SelectMenu/SelectMenuItem.js +1 -1
- package/lib/SelectMenu/SelectMenuItem.jsx +143 -0
- package/lib/SelectMenu/SelectMenuList.d.ts +2 -1
- package/lib/SelectMenu/SelectMenuList.js +1 -1
- package/lib/SelectMenu/SelectMenuList.jsx +60 -0
- package/lib/SelectMenu/SelectMenuLoadingAnimation.d.ts +2 -2
- package/lib/SelectMenu/SelectMenuLoadingAnimation.js +1 -3
- package/lib/SelectMenu/SelectMenuLoadingAnimation.jsx +21 -0
- package/lib/SelectMenu/SelectMenuModal.d.ts +3 -2
- package/lib/SelectMenu/SelectMenuModal.js +1 -1
- package/lib/SelectMenu/SelectMenuModal.jsx +119 -0
- package/lib/SelectMenu/SelectMenuTab.d.ts +2 -1
- package/lib/SelectMenu/SelectMenuTab.js +1 -1
- package/lib/SelectMenu/SelectMenuTab.jsx +93 -0
- package/lib/SelectMenu/SelectMenuTabPanel.d.ts +2 -1
- package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib/SelectMenu/SelectMenuTabPanel.jsx +43 -0
- package/lib/SelectMenu/SelectMenuTabs.d.ts +2 -1
- package/lib/SelectMenu/SelectMenuTabs.js +1 -1
- package/lib/SelectMenu/SelectMenuTabs.jsx +58 -0
- package/lib/SelectMenu/hooks/useKeyboardNav.js +80 -96
- package/lib/SelectMenu/index.js +7 -14
- package/lib/SelectPanel/SelectPanel.jsx +105 -0
- package/lib/SelectPanel/index.js +4 -12
- package/lib/SideNav.d.ts +8 -11
- package/lib/SideNav.js +15 -8
- package/lib/SideNav.jsx +177 -0
- package/lib/Spinner.jsx +35 -0
- package/lib/StateLabel.d.ts +2 -1
- package/lib/StateLabel.js +5 -6
- package/lib/StateLabel.jsx +94 -0
- package/lib/StyledOcticon.d.ts +2 -1
- package/lib/StyledOcticon.js +3 -1
- package/lib/StyledOcticon.jsx +20 -0
- package/lib/SubNav.d.ts +11 -5
- package/lib/SubNav.js +12 -7
- package/lib/SubNav.jsx +104 -0
- package/lib/TabNav.d.ts +4 -3
- package/lib/TabNav.js +2 -2
- package/lib/TabNav.jsx +60 -0
- package/lib/Text.jsx +14 -0
- package/lib/TextInput.jsx +23 -0
- package/lib/TextInputWithTokens.d.ts +3 -3
- package/lib/TextInputWithTokens.jsx +218 -0
- package/lib/ThemeProvider.jsx +130 -0
- package/lib/Timeline.d.ts +393 -19
- package/lib/Timeline.js +13 -16
- package/lib/Timeline.jsx +124 -0
- package/lib/Token/AvatarToken.jsx +54 -0
- package/lib/Token/IssueLabelToken.jsx +125 -0
- package/lib/Token/Token.d.ts +1 -1
- package/lib/Token/Token.jsx +103 -0
- package/lib/Token/TokenBase.jsx +88 -0
- package/lib/Token/_RemoveTokenButton.jsx +108 -0
- package/lib/Token/_TokenTextContainer.jsx +49 -0
- package/lib/Token/index.js +11 -30
- package/lib/Tooltip.d.ts +2 -1
- package/lib/Tooltip.js +1 -1
- package/lib/Tooltip.jsx +246 -0
- package/lib/Truncate.d.ts +2 -1
- package/lib/Truncate.js +3 -1
- package/lib/Truncate.jsx +27 -0
- package/lib/UnderlineNav.d.ts +3 -2
- package/lib/UnderlineNav.js +2 -2
- package/lib/UnderlineNav.jsx +90 -0
- package/lib/_TextInputWrapper.jsx +120 -0
- package/lib/_UnstyledTextInput.jsx +22 -0
- package/lib/behaviors/anchoredPosition.js +205 -234
- package/lib/behaviors/focusTrap.js +121 -157
- package/lib/behaviors/focusZone.js +434 -509
- package/lib/behaviors/scrollIntoViewingArea.js +18 -35
- package/lib/constants.js +39 -43
- package/lib/drafts.js +20 -30
- package/lib/hooks/index.js +16 -60
- package/lib/hooks/useAnchoredPosition.js +32 -40
- package/lib/hooks/useCombinedRefs.js +32 -36
- package/lib/hooks/useDetails.jsx +39 -0
- package/lib/hooks/useDialog.js +72 -96
- package/lib/hooks/useFocusTrap.js +43 -60
- package/lib/hooks/useFocusZone.js +54 -50
- package/lib/hooks/useOnEscapePress.js +25 -36
- package/lib/hooks/useOnOutsideClick.jsx +61 -0
- package/lib/hooks/useOpenAndCloseFocus.js +22 -34
- package/lib/hooks/useOverlay.jsx +15 -0
- package/lib/hooks/useProvidedRefOrCreate.js +10 -14
- package/lib/hooks/useProvidedStateOrCreate.js +13 -16
- package/lib/hooks/useRenderForcingRef.js +13 -17
- package/lib/hooks/useResizeObserver.js +15 -18
- package/lib/hooks/useSafeTimeout.js +22 -30
- package/lib/hooks/useScrollFlash.js +16 -23
- package/lib/index.d.ts +2 -2
- package/lib/index.js +165 -652
- package/lib/polyfills/eventListenerSignal.js +37 -45
- package/lib/sx.js +10 -22
- package/lib/theme-preval.js +64 -3169
- package/lib/theme.js +3 -12
- package/lib/utils/create-slots.jsx +65 -0
- package/lib/utils/deprecate.jsx +59 -0
- package/lib/utils/isNumeric.jsx +7 -0
- package/lib/utils/iterateFocusableElements.js +63 -85
- package/lib/utils/ssr.jsx +6 -0
- package/lib/utils/test-deprecations.jsx +20 -0
- package/lib/utils/test-helpers.jsx +8 -0
- package/lib/utils/test-matchers.jsx +100 -0
- package/lib/utils/testing.d.ts +61 -28
- package/lib/utils/testing.js +0 -29
- package/lib/utils/testing.jsx +206 -0
- package/lib/utils/theme.js +33 -47
- package/lib/utils/types/AriaRole.js +2 -1
- package/lib/utils/types/ComponentProps.js +2 -1
- package/lib/utils/types/Flatten.js +2 -1
- package/lib/utils/types/KeyPaths.js +2 -1
- package/lib/utils/types/MandateProps.js +16 -1
- package/lib/utils/types/Merge.js +2 -1
- package/lib/utils/types/index.js +16 -69
- package/lib/utils/uniqueId.js +5 -8
- package/lib/utils/use-force-update.js +8 -14
- package/lib/utils/useIsomorphicLayoutEffect.js +8 -11
- package/lib/utils/userAgent.js +8 -12
- package/lib-esm/ActionList/Item.js +53 -28
- package/lib-esm/ActionList2/Group.d.ts +2 -28
- package/lib-esm/ActionList2/Group.js +5 -52
- package/lib-esm/ActionList2/List.d.ts +1 -1
- package/lib-esm/ActionList2/List.js +2 -1
- package/lib-esm/Autocomplete/Autocomplete.d.ts +3 -3
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +3 -3
- package/lib-esm/Breadcrumbs.d.ts +7 -8
- package/lib-esm/Breadcrumbs.js +13 -8
- package/lib-esm/Button/Button.d.ts +3 -2
- package/lib-esm/Button/Button.js +2 -2
- package/lib-esm/Button/ButtonBase.d.ts +8 -5
- package/lib-esm/Button/ButtonBase.js +3 -1
- package/lib-esm/Button/ButtonClose.d.ts +46 -3
- package/lib-esm/Button/ButtonClose.js +2 -2
- package/lib-esm/Button/ButtonDanger.d.ts +3 -2
- package/lib-esm/Button/ButtonDanger.js +2 -2
- package/lib-esm/Button/ButtonInvisible.d.ts +3 -2
- package/lib-esm/Button/ButtonInvisible.js +2 -2
- package/lib-esm/Button/ButtonOutline.d.ts +3 -2
- package/lib-esm/Button/ButtonOutline.js +2 -2
- package/lib-esm/Button/ButtonPrimary.d.ts +3 -2
- package/lib-esm/Button/ButtonPrimary.js +2 -2
- package/lib-esm/Button/ButtonTableList.d.ts +2 -1
- package/lib-esm/Button/ButtonTableList.js +2 -2
- package/lib-esm/CircleBadge.d.ts +5 -4
- package/lib-esm/CircleBadge.js +2 -2
- package/lib-esm/CircleOcticon.d.ts +1 -1
- package/lib-esm/CounterLabel.d.ts +2 -1
- package/lib-esm/CounterLabel.js +2 -2
- package/lib-esm/Dialog/Dialog.d.ts +9 -5
- package/lib-esm/Dialog/Dialog.js +12 -12
- package/lib-esm/Dialog.d.ts +5 -4
- package/lib-esm/Dialog.js +2 -2
- package/lib-esm/Dropdown.d.ts +99 -10
- package/lib-esm/Dropdown.js +4 -4
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +47 -3
- package/lib-esm/DropdownMenu/DropdownButton.js +1 -3
- package/lib-esm/EmojiPicker/EmojiPicker.d.ts +15 -0
- package/lib-esm/EmojiPicker/EmojiPicker.js +184 -0
- package/lib-esm/EmojiPicker/EmojiPickerAnchor.d.ts +0 -0
- package/lib-esm/EmojiPicker/EmojiPickerAnchor.js +0 -0
- package/lib-esm/EmojiPicker/EmojiPickerPanel.d.ts +3 -0
- package/lib-esm/EmojiPicker/EmojiPickerPanel.js +8 -0
- package/lib-esm/EmojiPicker/data.d.ts +9 -0
- package/lib-esm/EmojiPicker/data.js +5434 -0
- package/lib-esm/EmojiPicker/index.d.ts +2 -0
- package/lib-esm/EmojiPicker/index.js +1 -0
- package/lib-esm/FilterList.d.ts +303 -264
- package/lib-esm/FilterList.js +7 -3
- package/lib-esm/FilteredSearch.d.ts +2 -1
- package/lib-esm/FilteredSearch.js +2 -2
- package/lib-esm/Flash.d.ts +2 -1
- package/lib-esm/Flash.js +2 -2
- package/lib-esm/FormGroup.d.ts +5 -4
- package/lib-esm/FormGroup.js +3 -3
- package/lib-esm/Header.d.ts +7 -6
- package/lib-esm/Header.js +5 -5
- package/lib-esm/Label.d.ts +2 -1
- package/lib-esm/Label.js +4 -3
- package/lib-esm/LabelGroup.d.ts +2 -1
- package/lib-esm/LabelGroup.js +2 -2
- package/lib-esm/Link.d.ts +2 -1
- package/lib-esm/Link.js +2 -2
- package/lib-esm/NewButton/button.js +42 -31
- package/lib-esm/Overlay.d.ts +11 -14
- package/lib-esm/Overlay.js +3 -2
- package/lib-esm/Pagehead.d.ts +2 -1
- package/lib-esm/Pagehead.js +2 -2
- package/lib-esm/Pagination/Pagination.js +2 -2
- package/lib-esm/Popover.d.ts +5 -4
- package/lib-esm/Popover.js +5 -4
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/SelectMenu/SelectMenu.d.ts +189 -21
- package/lib-esm/SelectMenu/SelectMenu.js +2 -1
- package/lib-esm/SelectMenu/SelectMenuDivider.d.ts +2 -1
- package/lib-esm/SelectMenu/SelectMenuDivider.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuFilter.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuFooter.d.ts +2 -1
- package/lib-esm/SelectMenu/SelectMenuFooter.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuHeader.d.ts +2 -1
- package/lib-esm/SelectMenu/SelectMenuHeader.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +3 -2
- package/lib-esm/SelectMenu/SelectMenuItem.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuList.d.ts +2 -1
- package/lib-esm/SelectMenu/SelectMenuList.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.d.ts +2 -2
- package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.js +2 -3
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +3 -2
- package/lib-esm/SelectMenu/SelectMenuModal.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuTab.d.ts +2 -1
- package/lib-esm/SelectMenu/SelectMenuTab.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuTabPanel.d.ts +2 -1
- package/lib-esm/SelectMenu/SelectMenuTabPanel.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuTabs.d.ts +2 -1
- package/lib-esm/SelectMenu/SelectMenuTabs.js +2 -2
- package/lib-esm/SideNav.d.ts +8 -11
- package/lib-esm/SideNav.js +16 -8
- package/lib-esm/StateLabel.d.ts +2 -1
- package/lib-esm/StateLabel.js +6 -7
- package/lib-esm/StyledOcticon.d.ts +2 -1
- package/lib-esm/StyledOcticon.js +2 -1
- package/lib-esm/SubNav.d.ts +11 -5
- package/lib-esm/SubNav.js +13 -8
- package/lib-esm/TabNav.d.ts +4 -3
- package/lib-esm/TabNav.js +3 -3
- package/lib-esm/TextInputWithTokens.d.ts +3 -3
- package/lib-esm/Timeline.d.ts +393 -19
- package/lib-esm/Timeline.js +13 -12
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/Tooltip.d.ts +2 -1
- package/lib-esm/Tooltip.js +2 -2
- package/lib-esm/Truncate.d.ts +2 -1
- package/lib-esm/Truncate.js +2 -1
- package/lib-esm/UnderlineNav.d.ts +3 -2
- package/lib-esm/UnderlineNav.js +3 -3
- package/lib-esm/index.d.ts +2 -2
- package/lib-esm/index.js +1 -1
- package/lib-esm/theme-preval.js +366 -512
- package/lib-esm/utils/testing.d.ts +61 -28
- package/lib-esm/utils/testing.js +0 -24
- package/package.json +5 -4
- package/lib/Checkbox.d.ts +0 -29
- package/lib/Checkbox.js +0 -64
- package/lib-esm/Checkbox.d.ts +0 -29
- package/lib-esm/Checkbox.js +0 -44
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
+
}) : (function(o, m, k, k2) {
|
6
|
+
if (k2 === undefined) k2 = k;
|
7
|
+
o[k2] = m[k];
|
8
|
+
}));
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
+
}) : function(o, v) {
|
12
|
+
o["default"] = v;
|
13
|
+
});
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
+
if (mod && mod.__esModule) return mod;
|
16
|
+
var result = {};
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
+
__setModuleDefault(result, mod);
|
19
|
+
return result;
|
20
|
+
};
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
23
|
+
};
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
+
exports.List = exports.ListContext = void 0;
|
26
|
+
const react_1 = __importDefault(require("react"));
|
27
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
28
|
+
const sx_1 = __importStar(require("../sx"));
|
29
|
+
exports.ListContext = react_1.default.createContext({});
|
30
|
+
const ListBox = styled_components_1.default.ul(sx_1.default);
|
31
|
+
exports.List = react_1.default.forwardRef(({ variant = 'inset', selectionVariant, showDividers = false, sx: sxProp = {}, ...props }, forwardedRef) => {
|
32
|
+
const styles = {
|
33
|
+
margin: 0,
|
34
|
+
paddingInlineStart: 0,
|
35
|
+
paddingY: variant === 'inset' ? 2 : 0
|
36
|
+
};
|
37
|
+
return (<ListBox sx={sx_1.merge(styles, sxProp)} aria-multiselectable={selectionVariant === 'multiple' ? true : undefined} {...props} ref={forwardedRef}>
|
38
|
+
<exports.ListContext.Provider value={{ variant, selectionVariant, showDividers }}>{props.children}</exports.ListContext.Provider>
|
39
|
+
</ListBox>);
|
40
|
+
});
|
41
|
+
exports.List.displayName = 'ActionList';
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.Selection = void 0;
|
7
|
+
const react_1 = __importDefault(require("react"));
|
8
|
+
const octicons_react_1 = require("@primer/octicons-react");
|
9
|
+
const List_1 = require("./List");
|
10
|
+
const Group_1 = require("./Group");
|
11
|
+
const Visuals_1 = require("./Visuals");
|
12
|
+
const Selection = ({ selected }) => {
|
13
|
+
const { selectionVariant: listSelectionVariant } = react_1.default.useContext(List_1.ListContext);
|
14
|
+
const { selectionVariant: groupSelectionVariant } = react_1.default.useContext(Group_1.GroupContext);
|
15
|
+
/** selectionVariant in Group can override the selectionVariant in List root */
|
16
|
+
const selectionVariant = typeof groupSelectionVariant !== 'undefined' ? groupSelectionVariant : listSelectionVariant;
|
17
|
+
// if selectionVariant is not set on List, don't show selection
|
18
|
+
if (!selectionVariant) {
|
19
|
+
// to avoid confusion, fail loudly instead of silently ignoring
|
20
|
+
if (selected)
|
21
|
+
throw new Error('For Item to be selected, ActionList or ActionList.Group needs to have a selectionVariant defined');
|
22
|
+
return null;
|
23
|
+
}
|
24
|
+
if (selectionVariant === 'single') {
|
25
|
+
return <Visuals_1.LeadingVisualContainer>{selected && <octicons_react_1.CheckIcon />}</Visuals_1.LeadingVisualContainer>;
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* selectionVariant is multiple
|
29
|
+
* we use a svg instead of an input because there should not
|
30
|
+
* be an interactive element inside an option
|
31
|
+
* svg copied from primer/css
|
32
|
+
*/
|
33
|
+
return (<Visuals_1.LeadingVisualContainer sx={{
|
34
|
+
rect: {
|
35
|
+
fill: selected ? 'accent.fg' : 'canvas.default',
|
36
|
+
stroke: selected ? 'accent.fg' : 'border.default'
|
37
|
+
},
|
38
|
+
path: {
|
39
|
+
fill: 'fg.onEmphasis',
|
40
|
+
boxShadow: 'shadow.small',
|
41
|
+
opacity: selected ? 1 : 0
|
42
|
+
}
|
43
|
+
}}>
|
44
|
+
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
45
|
+
<rect x="2" y="2" width="12" height="12" rx="4"></rect>
|
46
|
+
<path fillRule="evenodd" strokeWidth="0" d="M4.03231 8.69862C3.84775 8.20646 4.49385 7.77554 4.95539 7.77554C5.41693 7.77554 6.80154 9.85246 6.80154 9.85246C6.80154 9.85246 10.2631 4.314 10.4938 4.08323C10.7246 3.85246 11.8785 4.08323 11.4169 5.00631C11.0081 5.82388 7.26308 11.4678 7.26308 11.4678C7.26308 11.4678 6.80154 12.1602 6.34 11.4678C5.87846 10.7755 4.21687 9.19077 4.03231 8.69862Z"/>
|
47
|
+
</svg>
|
48
|
+
</Visuals_1.LeadingVisualContainer>);
|
49
|
+
};
|
50
|
+
exports.Selection = Selection;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.TrailingVisual = exports.LeadingVisual = exports.LeadingVisualContainer = void 0;
|
7
|
+
const react_1 = __importDefault(require("react"));
|
8
|
+
const Box_1 = __importDefault(require("../Box"));
|
9
|
+
const sx_1 = require("../sx");
|
10
|
+
const constants_1 = require("../constants");
|
11
|
+
const Item_1 = require("./Item");
|
12
|
+
const LeadingVisualContainer = ({ sx = {}, ...props }) => {
|
13
|
+
return (<Box_1.default as="span" sx={sx_1.merge({
|
14
|
+
height: Item_1.TEXT_ROW_HEIGHT,
|
15
|
+
minWidth: constants_1.get('space.3'),
|
16
|
+
maxWidth: Item_1.TEXT_ROW_HEIGHT,
|
17
|
+
display: 'flex',
|
18
|
+
justifyContent: 'center',
|
19
|
+
alignItems: 'center',
|
20
|
+
flexShrink: 0,
|
21
|
+
marginRight: 2
|
22
|
+
}, sx)} {...props}/>);
|
23
|
+
};
|
24
|
+
exports.LeadingVisualContainer = LeadingVisualContainer;
|
25
|
+
const LeadingVisual = ({ sx = {}, ...props }) => {
|
26
|
+
return (<Item_1.Slot name="LeadingVisual">
|
27
|
+
{({ variant, disabled }) => (<exports.LeadingVisualContainer sx={sx_1.merge({
|
28
|
+
color: Item_1.getVariantStyles(variant, disabled).iconColor,
|
29
|
+
svg: { fontSize: 0 }
|
30
|
+
}, sx)} {...props}>
|
31
|
+
{props.children}
|
32
|
+
</exports.LeadingVisualContainer>)}
|
33
|
+
</Item_1.Slot>);
|
34
|
+
};
|
35
|
+
exports.LeadingVisual = LeadingVisual;
|
36
|
+
const TrailingVisual = ({ sx = {}, ...props }) => {
|
37
|
+
return (<Item_1.Slot name="TrailingVisual">
|
38
|
+
{({ variant, disabled }) => (<Box_1.default as="span" sx={sx_1.merge({
|
39
|
+
height: '20px',
|
40
|
+
flexShrink: 0,
|
41
|
+
color: Item_1.getVariantStyles(variant, disabled).annotationColor,
|
42
|
+
marginLeft: 2
|
43
|
+
}, sx)} {...props}>
|
44
|
+
{props.children}
|
45
|
+
</Box_1.default>)}
|
46
|
+
</Item_1.Slot>);
|
47
|
+
};
|
48
|
+
exports.TrailingVisual = TrailingVisual;
|
package/lib/ActionList2/index.js
CHANGED
@@ -1,47 +1,29 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
3
|
exports.ActionList = void 0;
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
var _LinkItem = require("./LinkItem");
|
15
|
-
|
16
|
-
var _Divider = require("./Divider");
|
17
|
-
|
18
|
-
var _Description = require("./Description");
|
19
|
-
|
20
|
-
var _Visuals = require("./Visuals");
|
21
|
-
|
4
|
+
const List_1 = require("./List");
|
5
|
+
const Group_1 = require("./Group");
|
6
|
+
const Item_1 = require("./Item");
|
7
|
+
const LinkItem_1 = require("./LinkItem");
|
8
|
+
const Divider_1 = require("./Divider");
|
9
|
+
const Description_1 = require("./Description");
|
10
|
+
const Visuals_1 = require("./Visuals");
|
22
11
|
/**
|
23
12
|
* Collection of list-related components.
|
24
13
|
*/
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
/** Icon (or similar) positioned before `Item` text. */
|
42
|
-
LeadingVisual: _Visuals.LeadingVisual,
|
43
|
-
|
44
|
-
/** Icon (or similar) positioned after `Item` text. */
|
45
|
-
TrailingVisual: _Visuals.TrailingVisual
|
14
|
+
exports.ActionList = Object.assign(List_1.List, {
|
15
|
+
/** Collects related `Items` in an `ActionList`. */
|
16
|
+
Group: Group_1.Group,
|
17
|
+
/** An actionable or selectable `Item` */
|
18
|
+
Item: Item_1.Item,
|
19
|
+
/** A `Item` that renders a full-size anchor inside ListItem */
|
20
|
+
LinkItem: LinkItem_1.LinkItem,
|
21
|
+
/** Visually separates `Item`s or `Group`s in an `ActionList`. */
|
22
|
+
Divider: Divider_1.Divider,
|
23
|
+
/** Secondary text which provides additional information about an `Item`. */
|
24
|
+
Description: Description_1.Description,
|
25
|
+
/** Icon (or similar) positioned before `Item` text. */
|
26
|
+
LeadingVisual: Visuals_1.LeadingVisual,
|
27
|
+
/** Icon (or similar) positioned after `Item` text. */
|
28
|
+
TrailingVisual: Visuals_1.TrailingVisual
|
46
29
|
});
|
47
|
-
exports.ActionList = ActionList;
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
+
}) : (function(o, m, k, k2) {
|
6
|
+
if (k2 === undefined) k2 = k;
|
7
|
+
o[k2] = m[k];
|
8
|
+
}));
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
+
}) : function(o, v) {
|
12
|
+
o["default"] = v;
|
13
|
+
});
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
+
if (mod && mod.__esModule) return mod;
|
16
|
+
var result = {};
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
+
__setModuleDefault(result, mod);
|
19
|
+
return result;
|
20
|
+
};
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
23
|
+
};
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
+
exports.ActionMenu = void 0;
|
26
|
+
const List_1 = require("./ActionList/List");
|
27
|
+
const Item_1 = require("./ActionList/Item");
|
28
|
+
const Divider_1 = require("./ActionList/Divider");
|
29
|
+
const Button_1 = __importDefault(require("./Button"));
|
30
|
+
const react_1 = __importStar(require("react"));
|
31
|
+
const AnchoredOverlay_1 = require("./AnchoredOverlay");
|
32
|
+
const useProvidedStateOrCreate_1 = require("./hooks/useProvidedStateOrCreate");
|
33
|
+
const hooks_1 = require("./hooks");
|
34
|
+
const ActionMenuItem = (props) => <Item_1.Item role="menuitem" {...props}/>;
|
35
|
+
ActionMenuItem.displayName = 'ActionMenu.Item';
|
36
|
+
const ActionMenuBase = ({ anchorContent, renderAnchor = (props) => <Button_1.default {...props}/>, anchorRef: externalAnchorRef, onAction, open, setOpen, overlayProps, items, ...listProps }) => {
|
37
|
+
const [combinedOpenState, setCombinedOpenState] = useProvidedStateOrCreate_1.useProvidedStateOrCreate(open, setOpen, false);
|
38
|
+
const anchorRef = hooks_1.useProvidedRefOrCreate(externalAnchorRef);
|
39
|
+
const onOpen = react_1.useCallback(() => setCombinedOpenState(true), [setCombinedOpenState]);
|
40
|
+
const onClose = react_1.useCallback(() => setCombinedOpenState(false), [setCombinedOpenState]);
|
41
|
+
const renderMenuAnchor = react_1.useMemo(() => {
|
42
|
+
if (renderAnchor === null) {
|
43
|
+
return null;
|
44
|
+
}
|
45
|
+
return (props) => {
|
46
|
+
return renderAnchor({
|
47
|
+
'aria-label': 'menu',
|
48
|
+
children: anchorContent,
|
49
|
+
...props
|
50
|
+
});
|
51
|
+
};
|
52
|
+
}, [anchorContent, renderAnchor]);
|
53
|
+
const itemsToRender = react_1.useMemo(() => {
|
54
|
+
return items.map(item => {
|
55
|
+
return {
|
56
|
+
...item,
|
57
|
+
role: 'menuitem',
|
58
|
+
onAction: (props, event) => {
|
59
|
+
const actionCallback = item.onAction ?? onAction;
|
60
|
+
actionCallback?.(props, event);
|
61
|
+
if (!event.defaultPrevented) {
|
62
|
+
onClose();
|
63
|
+
}
|
64
|
+
}
|
65
|
+
};
|
66
|
+
});
|
67
|
+
}, [items, onAction, onClose]);
|
68
|
+
return (<AnchoredOverlay_1.AnchoredOverlay renderAnchor={renderMenuAnchor} anchorRef={anchorRef} open={combinedOpenState} onOpen={onOpen} onClose={onClose} overlayProps={overlayProps}>
|
69
|
+
<List_1.List {...listProps} role="menu" items={itemsToRender}/>
|
70
|
+
</AnchoredOverlay_1.AnchoredOverlay>);
|
71
|
+
};
|
72
|
+
ActionMenuBase.displayName = 'ActionMenu';
|
73
|
+
exports.ActionMenu = Object.assign(ActionMenuBase, { Divider: Divider_1.Divider, Item: ActionMenuItem });
|
@@ -0,0 +1,100 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
+
}) : (function(o, m, k, k2) {
|
6
|
+
if (k2 === undefined) k2 = k;
|
7
|
+
o[k2] = m[k];
|
8
|
+
}));
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
+
}) : function(o, v) {
|
12
|
+
o["default"] = v;
|
13
|
+
});
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
+
if (mod && mod.__esModule) return mod;
|
16
|
+
var result = {};
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
+
__setModuleDefault(result, mod);
|
19
|
+
return result;
|
20
|
+
};
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
23
|
+
};
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
+
exports.AnchoredOverlay = void 0;
|
26
|
+
const react_1 = __importStar(require("react"));
|
27
|
+
const Overlay_1 = __importDefault(require("../Overlay"));
|
28
|
+
const useFocusTrap_1 = require("../hooks/useFocusTrap");
|
29
|
+
const useFocusZone_1 = require("../hooks/useFocusZone");
|
30
|
+
const hooks_1 = require("../hooks");
|
31
|
+
const ssr_1 = require("@react-aria/ssr");
|
32
|
+
/**
|
33
|
+
* An `AnchoredOverlay` provides an anchor that will open a floating overlay positioned relative to the anchor.
|
34
|
+
* The overlay can be opened and navigated using keyboard or mouse.
|
35
|
+
*/
|
36
|
+
const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, children, open, onOpen, onClose, height, width, overlayProps, focusTrapSettings, focusZoneSettings, side, align }) => {
|
37
|
+
const anchorRef = hooks_1.useProvidedRefOrCreate(externalAnchorRef);
|
38
|
+
const [overlayRef, updateOverlayRef] = hooks_1.useRenderForcingRef();
|
39
|
+
const anchorId = ssr_1.useSSRSafeId();
|
40
|
+
const onClickOutside = react_1.useCallback(() => onClose?.('click-outside'), [onClose]);
|
41
|
+
const onEscape = react_1.useCallback(() => onClose?.('escape'), [onClose]);
|
42
|
+
const onAnchorKeyDown = react_1.useCallback((event) => {
|
43
|
+
if (!event.defaultPrevented) {
|
44
|
+
if (!open && ['ArrowDown', 'ArrowUp', ' ', 'Enter'].includes(event.key)) {
|
45
|
+
onOpen?.('anchor-key-press');
|
46
|
+
event.preventDefault();
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}, [open, onOpen]);
|
50
|
+
const onAnchorClick = react_1.useCallback((event) => {
|
51
|
+
if (event.defaultPrevented || event.button !== 0) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
if (!open) {
|
55
|
+
onOpen?.('anchor-click');
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
onClose?.('anchor-click');
|
59
|
+
}
|
60
|
+
}, [open, onOpen, onClose]);
|
61
|
+
const { position } = hooks_1.useAnchoredPosition({
|
62
|
+
anchorElementRef: anchorRef,
|
63
|
+
floatingElementRef: overlayRef,
|
64
|
+
side,
|
65
|
+
align
|
66
|
+
}, [overlayRef.current]);
|
67
|
+
react_1.useEffect(() => {
|
68
|
+
// ensure overlay ref gets cleared when closed, so position can reset between closing/re-opening
|
69
|
+
if (!open && overlayRef.current) {
|
70
|
+
updateOverlayRef(null);
|
71
|
+
}
|
72
|
+
}, [open, overlayRef, updateOverlayRef]);
|
73
|
+
useFocusZone_1.useFocusZone({
|
74
|
+
containerRef: overlayRef,
|
75
|
+
disabled: !open || !position,
|
76
|
+
...focusZoneSettings
|
77
|
+
});
|
78
|
+
useFocusTrap_1.useFocusTrap({ containerRef: overlayRef, disabled: !open || !position, ...focusTrapSettings });
|
79
|
+
return (<>
|
80
|
+
{renderAnchor &&
|
81
|
+
renderAnchor({
|
82
|
+
ref: anchorRef,
|
83
|
+
id: anchorId,
|
84
|
+
'aria-labelledby': anchorId,
|
85
|
+
'aria-haspopup': 'true',
|
86
|
+
tabIndex: 0,
|
87
|
+
onClick: onAnchorClick,
|
88
|
+
onKeyDown: onAnchorKeyDown
|
89
|
+
})}
|
90
|
+
{open ? (<Overlay_1.default returnFocusRef={anchorRef} onClickOutside={onClickOutside} ignoreClickRefs={[anchorRef]} onEscape={onEscape} ref={updateOverlayRef} role="none" visibility={position ? 'visible' : 'hidden'} height={height} width={width} top={position?.top || 0} left={position?.left || 0} anchorSide={position?.anchorSide} {...overlayProps}>
|
91
|
+
{children}
|
92
|
+
</Overlay_1.default>) : null}
|
93
|
+
</>);
|
94
|
+
};
|
95
|
+
exports.AnchoredOverlay = AnchoredOverlay;
|
96
|
+
exports.AnchoredOverlay.displayName = 'AnchoredOverlay';
|
97
|
+
exports.AnchoredOverlay.defaultProps = {
|
98
|
+
side: 'outside-bottom',
|
99
|
+
align: 'start'
|
100
|
+
};
|
@@ -1,13 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
});
|
6
|
-
Object.defineProperty(exports, "AnchoredOverlay", {
|
7
|
-
enumerable: true,
|
8
|
-
get: function () {
|
9
|
-
return _AnchoredOverlay.AnchoredOverlay;
|
10
|
-
}
|
11
|
-
});
|
12
|
-
|
13
|
-
var _AnchoredOverlay = require("./AnchoredOverlay");
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AnchoredOverlay = void 0;
|
4
|
+
var AnchoredOverlay_1 = require("./AnchoredOverlay");
|
5
|
+
Object.defineProperty(exports, "AnchoredOverlay", { enumerable: true, get: function () { return AnchoredOverlay_1.AnchoredOverlay; } });
|
@@ -20,7 +20,7 @@ declare const _default: React.FC<{
|
|
20
20
|
} & {
|
21
21
|
as?: string | React.ComponentType<any> | undefined;
|
22
22
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
23
|
-
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "icon" | "
|
23
|
+
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "icon" | "sx" | "variant" | "className" | "disabled" | "contrast"> & {
|
24
24
|
className?: string | undefined;
|
25
25
|
icon?: React.ComponentType<{
|
26
26
|
className?: string | undefined;
|
@@ -38,9 +38,9 @@ declare const _default: React.FC<{
|
|
38
38
|
style?: React.CSSProperties | undefined;
|
39
39
|
title?: string | undefined;
|
40
40
|
block?: boolean | undefined;
|
41
|
+
sx?: import("../sx").BetterSystemStyleObject | undefined;
|
41
42
|
variant?: "small" | "large" | undefined;
|
42
43
|
role?: React.AriaRole | undefined;
|
43
|
-
sx?: import("../sx").BetterSystemStyleObject | undefined;
|
44
44
|
key?: React.Key | null | undefined;
|
45
45
|
defaultChecked?: boolean | undefined;
|
46
46
|
defaultValue?: string | number | readonly string[] | undefined;
|
@@ -295,7 +295,7 @@ declare const _default: React.FC<{
|
|
295
295
|
contrast?: boolean | undefined;
|
296
296
|
} & {
|
297
297
|
theme?: any;
|
298
|
-
}, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "
|
298
|
+
}, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "sx" | "variant" | "disabled" | "contrast">, string | number | symbol> & React.RefAttributes<HTMLInputElement>>, {
|
299
299
|
as?: React.ComponentType<any> | undefined;
|
300
300
|
}>;
|
301
301
|
Menu: typeof AutocompleteMenu;
|
@@ -0,0 +1,100 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
+
}) : (function(o, m, k, k2) {
|
6
|
+
if (k2 === undefined) k2 = k;
|
7
|
+
o[k2] = m[k];
|
8
|
+
}));
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
+
}) : function(o, v) {
|
12
|
+
o["default"] = v;
|
13
|
+
});
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
+
if (mod && mod.__esModule) return mod;
|
16
|
+
var result = {};
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
+
__setModuleDefault(result, mod);
|
19
|
+
return result;
|
20
|
+
};
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
23
|
+
};
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
+
const react_1 = __importStar(require("react"));
|
26
|
+
const ssr_1 = require("@react-aria/ssr");
|
27
|
+
const AutocompleteContext_1 = require("./AutocompleteContext");
|
28
|
+
const AutocompleteInput_1 = __importDefault(require("./AutocompleteInput"));
|
29
|
+
const AutocompleteMenu_1 = __importDefault(require("./AutocompleteMenu"));
|
30
|
+
const AutocompleteOverlay_1 = __importDefault(require("./AutocompleteOverlay"));
|
31
|
+
const initialState = {
|
32
|
+
inputValue: '',
|
33
|
+
showMenu: false,
|
34
|
+
isMenuDirectlyActivated: false,
|
35
|
+
autocompleteSuggestion: '',
|
36
|
+
selectedItemLength: 0
|
37
|
+
};
|
38
|
+
const reducer = (state, action) => {
|
39
|
+
const { type, payload } = action;
|
40
|
+
switch (type) {
|
41
|
+
case 'inputValue':
|
42
|
+
return { ...state, inputValue: payload };
|
43
|
+
case 'showMenu':
|
44
|
+
return { ...state, showMenu: payload };
|
45
|
+
case 'isMenuDirectlyActivated':
|
46
|
+
return { ...state, isMenuDirectlyActivated: payload };
|
47
|
+
case 'autocompleteSuggestion':
|
48
|
+
return { ...state, autocompleteSuggestion: payload };
|
49
|
+
case 'selectedItemLength':
|
50
|
+
return { ...state, selectedItemLength: payload };
|
51
|
+
default:
|
52
|
+
return state;
|
53
|
+
}
|
54
|
+
};
|
55
|
+
const Autocomplete = ({ children, id: idProp }) => {
|
56
|
+
const activeDescendantRef = react_1.useRef(null);
|
57
|
+
const scrollContainerRef = react_1.useRef(null);
|
58
|
+
const inputRef = react_1.useRef(null);
|
59
|
+
const [state, dispatch] = react_1.useReducer(reducer, initialState);
|
60
|
+
const { inputValue, showMenu, autocompleteSuggestion, isMenuDirectlyActivated, selectedItemLength } = state;
|
61
|
+
const setInputValue = react_1.useCallback((value) => {
|
62
|
+
dispatch({ type: 'inputValue', payload: value });
|
63
|
+
}, []);
|
64
|
+
const setShowMenu = react_1.useCallback((value) => {
|
65
|
+
dispatch({ type: 'showMenu', payload: value });
|
66
|
+
}, []);
|
67
|
+
const setAutocompleteSuggestion = react_1.useCallback((value) => {
|
68
|
+
dispatch({ type: 'autocompleteSuggestion', payload: value });
|
69
|
+
}, []);
|
70
|
+
const setIsMenuDirectlyActivated = react_1.useCallback((value) => {
|
71
|
+
dispatch({ type: 'isMenuDirectlyActivated', payload: value });
|
72
|
+
}, []);
|
73
|
+
const setSelectedItemLength = react_1.useCallback((value) => {
|
74
|
+
dispatch({ type: 'selectedItemLength', payload: value });
|
75
|
+
}, []);
|
76
|
+
const id = ssr_1.useSSRSafeId(idProp);
|
77
|
+
return (<AutocompleteContext_1.AutocompleteContext.Provider value={{
|
78
|
+
activeDescendantRef,
|
79
|
+
autocompleteSuggestion,
|
80
|
+
id,
|
81
|
+
inputRef,
|
82
|
+
inputValue,
|
83
|
+
isMenuDirectlyActivated,
|
84
|
+
scrollContainerRef,
|
85
|
+
selectedItemLength,
|
86
|
+
setAutocompleteSuggestion,
|
87
|
+
setInputValue,
|
88
|
+
setIsMenuDirectlyActivated,
|
89
|
+
setShowMenu,
|
90
|
+
setSelectedItemLength,
|
91
|
+
showMenu
|
92
|
+
}}>
|
93
|
+
{children}
|
94
|
+
</AutocompleteContext_1.AutocompleteContext.Provider>);
|
95
|
+
};
|
96
|
+
exports.default = Object.assign(Autocomplete, {
|
97
|
+
Input: AutocompleteInput_1.default,
|
98
|
+
Menu: AutocompleteMenu_1.default,
|
99
|
+
Overlay: AutocompleteOverlay_1.default
|
100
|
+
});
|
@@ -12,7 +12,7 @@ declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRef
|
|
12
12
|
} & {
|
13
13
|
as?: string | React.ComponentType<any> | undefined;
|
14
14
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
15
|
-
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "icon" | "
|
15
|
+
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "icon" | "sx" | "variant" | "className" | "disabled" | "contrast"> & {
|
16
16
|
className?: string | undefined;
|
17
17
|
icon?: React.ComponentType<{
|
18
18
|
className?: string | undefined;
|
@@ -30,9 +30,9 @@ declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRef
|
|
30
30
|
style?: React.CSSProperties | undefined;
|
31
31
|
title?: string | undefined;
|
32
32
|
block?: boolean | undefined;
|
33
|
+
sx?: import("../sx").BetterSystemStyleObject | undefined;
|
33
34
|
variant?: "small" | "large" | undefined;
|
34
35
|
role?: React.AriaRole | undefined;
|
35
|
-
sx?: import("../sx").BetterSystemStyleObject | undefined;
|
36
36
|
key?: React.Key | null | undefined;
|
37
37
|
defaultChecked?: boolean | undefined;
|
38
38
|
defaultValue?: string | number | readonly string[] | undefined;
|
@@ -287,6 +287,6 @@ declare const AutocompleteInput: PolymorphicForwardRefComponent<React.ForwardRef
|
|
287
287
|
contrast?: boolean | undefined;
|
288
288
|
} & {
|
289
289
|
theme?: any;
|
290
|
-
}, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "
|
290
|
+
}, "maxWidth" | "minWidth" | "width" | "theme" | "block" | "sx" | "variant" | "disabled" | "contrast">, string | number | symbol> & React.RefAttributes<HTMLInputElement>>, InternalAutocompleteInputProps>;
|
291
291
|
export declare type AutocompleteInputProps = ComponentProps<typeof AutocompleteInput>;
|
292
292
|
export default AutocompleteInput;
|