@primer/components 0.0.0-202110303104 → 0.0.0-2021103082237
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 +90 -4
- package/dist/browser.esm.js +738 -779
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +736 -777
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.js +27 -52
- package/lib/ActionList/index.js +23 -12
- package/lib/ActionList2/Group.d.ts +28 -2
- package/lib/ActionList2/Group.js +55 -6
- package/lib/ActionList2/List.d.ts +1 -1
- package/lib/ActionList2/List.js +1 -2
- package/lib/ActionList2/index.js +41 -23
- package/lib/AnchoredOverlay/index.js +12 -4
- package/lib/Autocomplete/Autocomplete.d.ts +11 -3
- package/lib/Autocomplete/AutocompleteInput.d.ts +11 -3
- package/lib/Autocomplete/index.js +14 -7
- package/lib/Breadcrumbs.d.ts +8 -7
- package/lib/Breadcrumbs.js +7 -12
- package/lib/Button/Button.d.ts +2 -3
- package/lib/Button/Button.js +2 -6
- package/lib/Button/ButtonBase.d.ts +5 -8
- package/lib/Button/ButtonBase.js +1 -5
- package/lib/Button/ButtonClose.d.ts +3 -46
- package/lib/Button/ButtonClose.js +1 -1
- package/lib/Button/ButtonDanger.d.ts +2 -3
- package/lib/Button/ButtonDanger.js +2 -6
- package/lib/Button/ButtonInvisible.d.ts +2 -3
- package/lib/Button/ButtonInvisible.js +2 -6
- package/lib/Button/ButtonOutline.d.ts +2 -3
- package/lib/Button/ButtonOutline.js +2 -6
- package/lib/Button/ButtonPrimary.d.ts +2 -3
- package/lib/Button/ButtonPrimary.js +2 -6
- package/lib/Button/ButtonTableList.d.ts +1 -2
- package/lib/Button/ButtonTableList.js +1 -1
- package/lib/Button/index.js +70 -21
- package/lib/Checkbox.d.ts +29 -0
- package/lib/Checkbox.js +64 -0
- package/lib/CircleBadge.d.ts +4 -5
- package/lib/CircleBadge.js +1 -1
- package/lib/CircleOcticon.d.ts +1 -1
- package/lib/CounterLabel.d.ts +1 -2
- package/lib/CounterLabel.js +1 -1
- package/lib/Dialog/Dialog.d.ts +5 -9
- package/lib/Dialog/Dialog.js +17 -11
- package/lib/Dialog.d.ts +4 -5
- package/lib/Dialog.js +1 -1
- package/lib/Dropdown.d.ts +10 -99
- package/lib/Dropdown.js +3 -3
- package/lib/DropdownMenu/DropdownButton.d.ts +3 -47
- package/lib/DropdownMenu/DropdownButton.js +3 -1
- package/lib/DropdownMenu/index.js +20 -6
- package/lib/DropdownStyles.js +26 -18
- package/lib/FilterList.d.ts +264 -303
- package/lib/FilterList.js +2 -6
- package/lib/FilteredActionList/index.js +12 -4
- package/lib/FilteredSearch.d.ts +1 -2
- package/lib/FilteredSearch.js +1 -1
- package/lib/Flash.d.ts +1 -2
- package/lib/Flash.js +1 -1
- package/lib/FormGroup.d.ts +4 -5
- package/lib/FormGroup.js +2 -2
- package/lib/Header.d.ts +6 -7
- package/lib/Header.js +4 -4
- package/lib/Label.d.ts +1 -2
- package/lib/Label.js +2 -3
- package/lib/LabelGroup.d.ts +1 -2
- package/lib/LabelGroup.js +1 -1
- package/lib/Link.d.ts +1 -2
- package/lib/Link.js +1 -1
- package/lib/NewButton/button.js +34 -42
- package/lib/NewButton/index.js +12 -5
- package/lib/NewButton/types.js +1 -2
- package/lib/Overlay.d.ts +14 -11
- package/lib/Overlay.js +3 -4
- package/lib/Pagehead.d.ts +1 -2
- package/lib/Pagehead.js +1 -1
- package/lib/Pagination/Pagination.js +1 -1
- package/lib/Pagination/index.js +12 -6
- package/lib/Popover.d.ts +4 -5
- package/lib/Popover.js +4 -5
- package/lib/Portal/index.js +16 -5
- package/lib/Position.d.ts +4 -4
- package/lib/SelectMenu/SelectMenu.d.ts +29 -189
- package/lib/SelectMenu/SelectMenu.js +1 -3
- package/lib/SelectMenu/SelectMenuDivider.d.ts +1 -2
- package/lib/SelectMenu/SelectMenuDivider.js +1 -1
- package/lib/SelectMenu/SelectMenuFilter.js +1 -1
- package/lib/SelectMenu/SelectMenuFooter.d.ts +1 -2
- package/lib/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib/SelectMenu/SelectMenuHeader.d.ts +1 -2
- package/lib/SelectMenu/SelectMenuHeader.js +1 -1
- package/lib/SelectMenu/SelectMenuItem.d.ts +2 -3
- package/lib/SelectMenu/SelectMenuItem.js +1 -1
- package/lib/SelectMenu/SelectMenuList.d.ts +1 -2
- package/lib/SelectMenu/SelectMenuList.js +1 -1
- package/lib/SelectMenu/SelectMenuLoadingAnimation.d.ts +2 -2
- package/lib/SelectMenu/SelectMenuLoadingAnimation.js +3 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +2 -3
- package/lib/SelectMenu/SelectMenuModal.js +1 -1
- package/lib/SelectMenu/SelectMenuTab.d.ts +1 -2
- package/lib/SelectMenu/SelectMenuTab.js +1 -1
- package/lib/SelectMenu/SelectMenuTabPanel.d.ts +1 -2
- package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib/SelectMenu/SelectMenuTabs.d.ts +1 -2
- package/lib/SelectMenu/SelectMenuTabs.js +1 -1
- package/lib/SelectMenu/hooks/useKeyboardNav.js +96 -80
- package/lib/SelectMenu/index.js +14 -7
- package/lib/SelectPanel/index.js +12 -4
- package/lib/SideNav.d.ts +11 -8
- package/lib/SideNav.js +8 -15
- package/lib/StateLabel.d.ts +1 -2
- package/lib/StateLabel.js +6 -5
- package/lib/StyledOcticon.d.ts +1 -2
- package/lib/StyledOcticon.js +1 -3
- package/lib/SubNav.d.ts +5 -11
- package/lib/SubNav.js +7 -12
- package/lib/TabNav.d.ts +3 -4
- package/lib/TabNav.js +2 -2
- package/lib/TextInput.d.ts +8 -1
- package/lib/TextInput.js +17 -5
- package/lib/TextInputWithTokens.d.ts +11 -3
- package/lib/Timeline.d.ts +19 -393
- package/lib/Timeline.js +16 -13
- package/lib/Token/Token.d.ts +1 -1
- package/lib/Token/index.js +30 -11
- package/lib/Tooltip.d.ts +1 -2
- package/lib/Tooltip.js +1 -1
- package/lib/Truncate.d.ts +1 -2
- package/lib/Truncate.js +1 -3
- package/lib/UnderlineNav.d.ts +2 -3
- package/lib/UnderlineNav.js +2 -2
- package/lib/_TextInputWrapper.d.ts +3 -0
- package/lib/_TextInputWrapper.js +18 -7
- package/lib/behaviors/anchoredPosition.js +234 -205
- package/lib/behaviors/focusTrap.js +157 -121
- package/lib/behaviors/focusZone.js +509 -434
- package/lib/behaviors/scrollIntoViewingArea.js +35 -18
- package/lib/constants.js +43 -39
- package/lib/drafts.js +30 -20
- package/lib/hooks/index.js +60 -16
- package/lib/hooks/useAnchoredPosition.js +40 -32
- package/lib/hooks/useCombinedRefs.js +36 -32
- package/lib/hooks/useDialog.js +96 -72
- package/lib/hooks/useFocusTrap.js +60 -43
- package/lib/hooks/useFocusZone.js +50 -54
- package/lib/hooks/useOnEscapePress.js +36 -25
- package/lib/hooks/useOpenAndCloseFocus.js +34 -22
- package/lib/hooks/useProvidedRefOrCreate.js +14 -10
- package/lib/hooks/useProvidedStateOrCreate.js +16 -13
- package/lib/hooks/useRenderForcingRef.js +17 -13
- package/lib/hooks/useResizeObserver.js +18 -15
- package/lib/hooks/useSafeTimeout.js +30 -22
- package/lib/hooks/useScrollFlash.js +23 -16
- package/lib/index.d.ts +2 -2
- package/lib/index.js +652 -165
- package/lib/polyfills/eventListenerSignal.js +45 -37
- package/lib/sx.js +22 -10
- package/lib/theme-preval.js +3169 -64
- package/lib/theme.js +12 -3
- package/lib/utils/iterateFocusableElements.js +85 -63
- package/lib/utils/testing.d.ts +28 -61
- package/lib/utils/testing.js +29 -0
- package/lib/utils/theme.js +47 -33
- package/lib/utils/types/AriaRole.js +1 -2
- package/lib/utils/types/ComponentProps.js +1 -2
- package/lib/utils/types/Flatten.js +1 -2
- package/lib/utils/types/KeyPaths.js +1 -2
- package/lib/utils/types/MandateProps.js +1 -16
- package/lib/utils/types/Merge.js +1 -2
- package/lib/utils/types/index.js +69 -16
- package/lib/utils/uniqueId.js +8 -5
- package/lib/utils/use-force-update.js +14 -8
- package/lib/utils/useIsomorphicLayoutEffect.js +11 -8
- package/lib/utils/userAgent.js +12 -8
- package/lib-esm/ActionList/Item.js +28 -53
- package/lib-esm/ActionList2/Group.d.ts +28 -2
- package/lib-esm/ActionList2/Group.js +52 -5
- package/lib-esm/ActionList2/List.d.ts +1 -1
- package/lib-esm/ActionList2/List.js +1 -2
- package/lib-esm/Autocomplete/Autocomplete.d.ts +11 -3
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +11 -3
- package/lib-esm/Breadcrumbs.d.ts +8 -7
- package/lib-esm/Breadcrumbs.js +8 -13
- package/lib-esm/Button/Button.d.ts +2 -3
- package/lib-esm/Button/Button.js +2 -2
- package/lib-esm/Button/ButtonBase.d.ts +5 -8
- package/lib-esm/Button/ButtonBase.js +1 -3
- package/lib-esm/Button/ButtonClose.d.ts +3 -46
- package/lib-esm/Button/ButtonClose.js +2 -2
- package/lib-esm/Button/ButtonDanger.d.ts +2 -3
- package/lib-esm/Button/ButtonDanger.js +2 -2
- package/lib-esm/Button/ButtonInvisible.d.ts +2 -3
- package/lib-esm/Button/ButtonInvisible.js +2 -2
- package/lib-esm/Button/ButtonOutline.d.ts +2 -3
- package/lib-esm/Button/ButtonOutline.js +2 -2
- package/lib-esm/Button/ButtonPrimary.d.ts +2 -3
- package/lib-esm/Button/ButtonPrimary.js +2 -2
- package/lib-esm/Button/ButtonTableList.d.ts +1 -2
- package/lib-esm/Button/ButtonTableList.js +2 -2
- package/lib-esm/Checkbox.d.ts +29 -0
- package/lib-esm/Checkbox.js +44 -0
- package/lib-esm/CircleBadge.d.ts +4 -5
- package/lib-esm/CircleBadge.js +2 -2
- package/lib-esm/CircleOcticon.d.ts +1 -1
- package/lib-esm/CounterLabel.d.ts +1 -2
- package/lib-esm/CounterLabel.js +2 -2
- package/lib-esm/Dialog/Dialog.d.ts +5 -9
- package/lib-esm/Dialog/Dialog.js +12 -12
- package/lib-esm/Dialog.d.ts +4 -5
- package/lib-esm/Dialog.js +2 -2
- package/lib-esm/Dropdown.d.ts +10 -99
- package/lib-esm/Dropdown.js +4 -4
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +3 -47
- package/lib-esm/DropdownMenu/DropdownButton.js +3 -1
- package/lib-esm/FilterList.d.ts +264 -303
- package/lib-esm/FilterList.js +3 -7
- package/lib-esm/FilteredSearch.d.ts +1 -2
- package/lib-esm/FilteredSearch.js +2 -2
- package/lib-esm/Flash.d.ts +1 -2
- package/lib-esm/Flash.js +2 -2
- package/lib-esm/FormGroup.d.ts +4 -5
- package/lib-esm/FormGroup.js +3 -3
- package/lib-esm/Header.d.ts +6 -7
- package/lib-esm/Header.js +5 -5
- package/lib-esm/Label.d.ts +1 -2
- package/lib-esm/Label.js +3 -4
- package/lib-esm/LabelGroup.d.ts +1 -2
- package/lib-esm/LabelGroup.js +2 -2
- package/lib-esm/Link.d.ts +1 -2
- package/lib-esm/Link.js +2 -2
- package/lib-esm/NewButton/button.js +31 -42
- package/lib-esm/Overlay.d.ts +14 -11
- package/lib-esm/Overlay.js +2 -3
- package/lib-esm/Pagehead.d.ts +1 -2
- package/lib-esm/Pagehead.js +2 -2
- package/lib-esm/Pagination/Pagination.js +2 -2
- package/lib-esm/Popover.d.ts +4 -5
- package/lib-esm/Popover.js +4 -5
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/SelectMenu/SelectMenu.d.ts +29 -189
- package/lib-esm/SelectMenu/SelectMenu.js +1 -2
- package/lib-esm/SelectMenu/SelectMenuDivider.d.ts +1 -2
- package/lib-esm/SelectMenu/SelectMenuDivider.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuFilter.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuFooter.d.ts +1 -2
- package/lib-esm/SelectMenu/SelectMenuFooter.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuHeader.d.ts +1 -2
- package/lib-esm/SelectMenu/SelectMenuHeader.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +2 -3
- package/lib-esm/SelectMenu/SelectMenuItem.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuList.d.ts +1 -2
- package/lib-esm/SelectMenu/SelectMenuList.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.d.ts +2 -2
- package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.js +3 -2
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +2 -3
- package/lib-esm/SelectMenu/SelectMenuModal.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuTab.d.ts +1 -2
- package/lib-esm/SelectMenu/SelectMenuTab.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuTabPanel.d.ts +1 -2
- package/lib-esm/SelectMenu/SelectMenuTabPanel.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuTabs.d.ts +1 -2
- package/lib-esm/SelectMenu/SelectMenuTabs.js +2 -2
- package/lib-esm/SideNav.d.ts +11 -8
- package/lib-esm/SideNav.js +8 -16
- package/lib-esm/StateLabel.d.ts +1 -2
- package/lib-esm/StateLabel.js +7 -6
- package/lib-esm/StyledOcticon.d.ts +1 -2
- package/lib-esm/StyledOcticon.js +1 -2
- package/lib-esm/SubNav.d.ts +5 -11
- package/lib-esm/SubNav.js +8 -13
- package/lib-esm/TabNav.d.ts +3 -4
- package/lib-esm/TabNav.js +3 -3
- package/lib-esm/TextInput.d.ts +8 -1
- package/lib-esm/TextInput.js +17 -5
- package/lib-esm/TextInputWithTokens.d.ts +11 -3
- package/lib-esm/Timeline.d.ts +19 -393
- package/lib-esm/Timeline.js +12 -13
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/Tooltip.d.ts +1 -2
- package/lib-esm/Tooltip.js +2 -2
- package/lib-esm/Truncate.d.ts +1 -2
- package/lib-esm/Truncate.js +1 -2
- package/lib-esm/UnderlineNav.d.ts +2 -3
- package/lib-esm/UnderlineNav.js +3 -3
- package/lib-esm/_TextInputWrapper.d.ts +3 -0
- package/lib-esm/_TextInputWrapper.js +18 -7
- package/lib-esm/index.d.ts +2 -2
- package/lib-esm/index.js +1 -1
- package/lib-esm/theme-preval.js +512 -366
- package/lib-esm/utils/testing.d.ts +28 -61
- package/lib-esm/utils/testing.js +24 -0
- package/package.json +5 -6
- package/lib/ActionList/Divider.jsx +0 -29
- package/lib/ActionList/Group.jsx +0 -23
- package/lib/ActionList/Header.jsx +0 -66
- package/lib/ActionList/Item.jsx +0 -311
- package/lib/ActionList/List.jsx +0 -138
- package/lib/ActionList2/Description.jsx +0 -29
- package/lib/ActionList2/Divider.jsx +0 -22
- package/lib/ActionList2/Group.jsx +0 -25
- package/lib/ActionList2/Header.jsx +0 -36
- package/lib/ActionList2/Item.jsx +0 -174
- package/lib/ActionList2/LinkItem.jsx +0 -28
- package/lib/ActionList2/List.jsx +0 -41
- package/lib/ActionList2/Selection.jsx +0 -50
- package/lib/ActionList2/Visuals.jsx +0 -48
- package/lib/ActionMenu.jsx +0 -73
- package/lib/AnchoredOverlay/AnchoredOverlay.jsx +0 -100
- package/lib/Autocomplete/Autocomplete.jsx +0 -100
- package/lib/Autocomplete/AutocompleteContext.jsx +0 -5
- package/lib/Autocomplete/AutocompleteInput.jsx +0 -113
- package/lib/Autocomplete/AutocompleteMenu.jsx +0 -190
- package/lib/Autocomplete/AutocompleteOverlay.jsx +0 -55
- package/lib/Avatar.jsx +0 -34
- package/lib/AvatarPair.jsx +0 -29
- package/lib/AvatarStack.jsx +0 -151
- package/lib/BaseStyles.jsx +0 -65
- package/lib/BorderBox.jsx +0 -18
- package/lib/Box.jsx +0 -10
- package/lib/BranchName.jsx +0 -20
- package/lib/Breadcrumbs.jsx +0 -74
- package/lib/Button/Button.jsx +0 -60
- package/lib/Button/ButtonBase.jsx +0 -36
- package/lib/Button/ButtonClose.jsx +0 -55
- package/lib/Button/ButtonDanger.jsx +0 -63
- package/lib/Button/ButtonGroup.jsx +0 -55
- package/lib/Button/ButtonInvisible.jsx +0 -52
- package/lib/Button/ButtonOutline.jsx +0 -63
- package/lib/Button/ButtonPrimary.jsx +0 -62
- package/lib/Button/ButtonStyles.jsx +0 -37
- package/lib/Button/ButtonTableList.jsx +0 -49
- package/lib/Caret.jsx +0 -93
- package/lib/CircleBadge.jsx +0 -43
- package/lib/CircleOcticon.jsx +0 -21
- package/lib/CounterLabel.jsx +0 -44
- package/lib/Details.jsx +0 -21
- package/lib/Dialog/ConfirmationDialog.jsx +0 -146
- package/lib/Dialog/Dialog.jsx +0 -273
- package/lib/Dialog.jsx +0 -131
- package/lib/Dropdown.jsx +0 -134
- package/lib/DropdownMenu/DropdownButton.jsx +0 -14
- package/lib/DropdownMenu/DropdownMenu.jsx +0 -70
- package/lib/EmojiPicker/EmojiPicker.d.ts +0 -15
- package/lib/EmojiPicker/EmojiPicker.js +0 -205
- package/lib/EmojiPicker/EmojiPicker.jsx +0 -125
- package/lib/EmojiPicker/EmojiPickerAnchor.d.ts +0 -0
- package/lib/EmojiPicker/EmojiPickerAnchor.js +0 -1
- package/lib/EmojiPicker/EmojiPickerAnchor.jsx +0 -1
- package/lib/EmojiPicker/EmojiPickerPanel.d.ts +0 -3
- package/lib/EmojiPicker/EmojiPickerPanel.js +0 -18
- package/lib/EmojiPicker/EmojiPickerPanel.jsx +0 -10
- package/lib/EmojiPicker/data.d.ts +0 -9
- package/lib/EmojiPicker/data.js +0 -7254
- package/lib/EmojiPicker/index.d.ts +0 -2
- package/lib/EmojiPicker/index.js +0 -8
- package/lib/FilterList.jsx +0 -63
- package/lib/FilteredActionList/FilteredActionList.jsx +0 -100
- package/lib/FilteredSearch.jsx +0 -29
- package/lib/Flash.jsx +0 -70
- package/lib/Flex.jsx +0 -15
- package/lib/FormGroup.jsx +0 -25
- package/lib/Grid.jsx +0 -15
- package/lib/Header.jsx +0 -90
- package/lib/Heading.jsx +0 -21
- package/lib/Label.jsx +0 -84
- package/lib/LabelGroup.jsx +0 -19
- package/lib/Link.jsx +0 -38
- package/lib/NewButton/button-counter.jsx +0 -14
- package/lib/NewButton/button.jsx +0 -278
- package/lib/Overlay.jsx +0 -156
- package/lib/Pagehead.jsx +0 -18
- package/lib/Pagination/Pagination.jsx +0 -163
- package/lib/Pagination/model.jsx +0 -174
- package/lib/PointerBox.jsx +0 -25
- package/lib/Popover.jsx +0 -210
- package/lib/Portal/Portal.jsx +0 -79
- package/lib/Position.jsx +0 -46
- package/lib/ProgressBar.jsx +0 -39
- package/lib/SelectMenu/SelectMenu.jsx +0 -114
- package/lib/SelectMenu/SelectMenuContext.jsx +0 -5
- package/lib/SelectMenu/SelectMenuDivider.jsx +0 -43
- package/lib/SelectMenu/SelectMenuFilter.jsx +0 -59
- package/lib/SelectMenu/SelectMenuFooter.jsx +0 -46
- package/lib/SelectMenu/SelectMenuHeader.jsx +0 -44
- package/lib/SelectMenu/SelectMenuItem.jsx +0 -143
- package/lib/SelectMenu/SelectMenuList.jsx +0 -60
- package/lib/SelectMenu/SelectMenuLoadingAnimation.jsx +0 -21
- package/lib/SelectMenu/SelectMenuModal.jsx +0 -119
- package/lib/SelectMenu/SelectMenuTab.jsx +0 -93
- package/lib/SelectMenu/SelectMenuTabPanel.jsx +0 -43
- package/lib/SelectMenu/SelectMenuTabs.jsx +0 -58
- package/lib/SelectPanel/SelectPanel.jsx +0 -105
- package/lib/SideNav.jsx +0 -177
- package/lib/Spinner.jsx +0 -35
- package/lib/StateLabel.jsx +0 -94
- package/lib/StyledOcticon.jsx +0 -20
- package/lib/SubNav.jsx +0 -104
- package/lib/TabNav.jsx +0 -60
- package/lib/Text.jsx +0 -14
- package/lib/TextInput.jsx +0 -23
- package/lib/TextInputWithTokens.jsx +0 -218
- package/lib/ThemeProvider.jsx +0 -130
- package/lib/Timeline.jsx +0 -124
- package/lib/Token/AvatarToken.jsx +0 -54
- package/lib/Token/IssueLabelToken.jsx +0 -125
- package/lib/Token/Token.jsx +0 -103
- package/lib/Token/TokenBase.jsx +0 -88
- package/lib/Token/_RemoveTokenButton.jsx +0 -108
- package/lib/Token/_TokenTextContainer.jsx +0 -49
- package/lib/Tooltip.jsx +0 -246
- package/lib/Truncate.jsx +0 -27
- package/lib/UnderlineNav.jsx +0 -90
- package/lib/_TextInputWrapper.jsx +0 -120
- package/lib/_UnstyledTextInput.jsx +0 -22
- package/lib/hooks/useDetails.jsx +0 -39
- package/lib/hooks/useOnOutsideClick.jsx +0 -61
- package/lib/hooks/useOverlay.jsx +0 -15
- package/lib/utils/create-slots.jsx +0 -65
- package/lib/utils/deprecate.jsx +0 -59
- package/lib/utils/isNumeric.jsx +0 -7
- package/lib/utils/ssr.jsx +0 -6
- package/lib/utils/test-deprecations.jsx +0 -20
- package/lib/utils/test-helpers.jsx +0 -8
- package/lib/utils/test-matchers.jsx +0 -100
- package/lib/utils/testing.jsx +0 -206
- package/lib-esm/EmojiPicker/EmojiPicker.d.ts +0 -15
- package/lib-esm/EmojiPicker/EmojiPicker.js +0 -184
- package/lib-esm/EmojiPicker/EmojiPickerAnchor.d.ts +0 -0
- package/lib-esm/EmojiPicker/EmojiPickerAnchor.js +0 -0
- package/lib-esm/EmojiPicker/EmojiPickerPanel.d.ts +0 -3
- package/lib-esm/EmojiPicker/EmojiPickerPanel.js +0 -8
- package/lib-esm/EmojiPicker/data.d.ts +0 -9
- package/lib-esm/EmojiPicker/data.js +0 -5434
- package/lib-esm/EmojiPicker/index.d.ts +0 -2
- package/lib-esm/EmojiPicker/index.js +0 -1
package/lib/Pagination/model.jsx
DELETED
@@ -1,174 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.buildComponentData = exports.buildPaginationModel = void 0;
|
4
|
-
function buildPaginationModel(pageCount, currentPage, showPages, marginPageCount, surroundingPageCount) {
|
5
|
-
const pages = [];
|
6
|
-
if (showPages) {
|
7
|
-
const pageNums = [];
|
8
|
-
const addPage = (n) => {
|
9
|
-
if (n >= 1 && n <= pageCount) {
|
10
|
-
pageNums.push(n);
|
11
|
-
}
|
12
|
-
};
|
13
|
-
// Start by defining the window of pages to show around the current page.
|
14
|
-
// If the window goes off either edge, shift it until it fits.
|
15
|
-
let extentLeft = currentPage - surroundingPageCount;
|
16
|
-
let extentRight = currentPage + surroundingPageCount;
|
17
|
-
if (extentLeft < 1 && extentRight > pageCount) {
|
18
|
-
// Our window is larger than the entire range,
|
19
|
-
// so simply display every page.
|
20
|
-
extentLeft = 1;
|
21
|
-
extentRight = pageCount;
|
22
|
-
}
|
23
|
-
else if (extentLeft < 1) {
|
24
|
-
while (extentLeft < 1) {
|
25
|
-
extentLeft++;
|
26
|
-
extentRight++;
|
27
|
-
}
|
28
|
-
}
|
29
|
-
else if (extentRight > pageCount) {
|
30
|
-
while (extentRight > pageCount) {
|
31
|
-
extentLeft--;
|
32
|
-
extentRight--;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
// Next, include the pages in the margins.
|
36
|
-
// If a margin page is already covered in the window,
|
37
|
-
// extend the window to the other direction.
|
38
|
-
for (let i = 1; i <= marginPageCount; i++) {
|
39
|
-
const leftPage = i;
|
40
|
-
const rightPage = pageCount - (i - 1);
|
41
|
-
if (leftPage >= extentLeft) {
|
42
|
-
extentRight++;
|
43
|
-
}
|
44
|
-
else {
|
45
|
-
addPage(leftPage);
|
46
|
-
}
|
47
|
-
if (rightPage <= extentRight) {
|
48
|
-
extentLeft--;
|
49
|
-
}
|
50
|
-
else {
|
51
|
-
addPage(rightPage);
|
52
|
-
}
|
53
|
-
}
|
54
|
-
for (let i = extentLeft; i <= extentRight; i++) {
|
55
|
-
addPage(i);
|
56
|
-
}
|
57
|
-
const sorted = pageNums
|
58
|
-
.slice()
|
59
|
-
.sort((a, b) => a - b)
|
60
|
-
.filter((item, idx, ary) => !idx || item !== ary[idx - 1]);
|
61
|
-
for (let idx = 0; idx < sorted.length; idx++) {
|
62
|
-
const num = sorted[idx];
|
63
|
-
const selected = num === currentPage;
|
64
|
-
if (idx === 0) {
|
65
|
-
if (num !== 1) {
|
66
|
-
// If the first page isn't page one,
|
67
|
-
// we need to add a break
|
68
|
-
pages.push({
|
69
|
-
type: 'BREAK',
|
70
|
-
num: 1
|
71
|
-
});
|
72
|
-
}
|
73
|
-
pages.push({
|
74
|
-
type: 'NUM',
|
75
|
-
num,
|
76
|
-
selected
|
77
|
-
});
|
78
|
-
}
|
79
|
-
else {
|
80
|
-
const last = sorted[idx - 1];
|
81
|
-
const delta = num - last;
|
82
|
-
if (delta === 1) {
|
83
|
-
pages.push({
|
84
|
-
type: 'NUM',
|
85
|
-
num,
|
86
|
-
selected
|
87
|
-
});
|
88
|
-
}
|
89
|
-
else {
|
90
|
-
// We skipped some, so add a break
|
91
|
-
pages.push({
|
92
|
-
type: 'BREAK',
|
93
|
-
num: num - 1
|
94
|
-
});
|
95
|
-
pages.push({
|
96
|
-
type: 'NUM',
|
97
|
-
num,
|
98
|
-
selected
|
99
|
-
});
|
100
|
-
}
|
101
|
-
}
|
102
|
-
}
|
103
|
-
const lastPage = pages[pages.length - 1];
|
104
|
-
if (lastPage.type === 'NUM' && lastPage.num !== pageCount) {
|
105
|
-
// The last page we rendered wasn't the actual last page,
|
106
|
-
// so we need an additional break
|
107
|
-
pages.push({
|
108
|
-
type: 'BREAK',
|
109
|
-
num: pageCount
|
110
|
-
});
|
111
|
-
}
|
112
|
-
}
|
113
|
-
const prev = { type: 'PREV', num: currentPage - 1, disabled: currentPage === 1 };
|
114
|
-
const next = { type: 'NEXT', num: currentPage + 1, disabled: currentPage === pageCount };
|
115
|
-
return [prev, ...pages, next];
|
116
|
-
}
|
117
|
-
exports.buildPaginationModel = buildPaginationModel;
|
118
|
-
function buildComponentData(page, hrefBuilder, onClick) {
|
119
|
-
const props = {};
|
120
|
-
let content = '';
|
121
|
-
let key = '';
|
122
|
-
switch (page.type) {
|
123
|
-
case 'PREV': {
|
124
|
-
key = 'page-prev';
|
125
|
-
content = 'Previous';
|
126
|
-
if (page.disabled) {
|
127
|
-
Object.assign(props, { as: 'span', 'aria-disabled': 'true' });
|
128
|
-
}
|
129
|
-
else {
|
130
|
-
Object.assign(props, {
|
131
|
-
rel: 'prev',
|
132
|
-
href: hrefBuilder(page.num),
|
133
|
-
'aria-label': 'Previous Page',
|
134
|
-
onClick
|
135
|
-
});
|
136
|
-
}
|
137
|
-
break;
|
138
|
-
}
|
139
|
-
case 'NEXT': {
|
140
|
-
key = 'page-next';
|
141
|
-
content = 'Next';
|
142
|
-
if (page.disabled) {
|
143
|
-
Object.assign(props, { as: 'span', 'aria-disabled': 'true' });
|
144
|
-
}
|
145
|
-
else {
|
146
|
-
Object.assign(props, {
|
147
|
-
rel: 'next',
|
148
|
-
href: hrefBuilder(page.num),
|
149
|
-
'aria-label': 'Next Page',
|
150
|
-
onClick
|
151
|
-
});
|
152
|
-
}
|
153
|
-
break;
|
154
|
-
}
|
155
|
-
case 'NUM': {
|
156
|
-
key = `page-${page.num}`;
|
157
|
-
content = String(page.num);
|
158
|
-
if (page.selected) {
|
159
|
-
Object.assign(props, { as: 'em', 'aria-current': 'page' });
|
160
|
-
}
|
161
|
-
else {
|
162
|
-
Object.assign(props, { href: hrefBuilder(page.num), 'aria-label': `Page ${page.num}`, onClick });
|
163
|
-
}
|
164
|
-
break;
|
165
|
-
}
|
166
|
-
case 'BREAK': {
|
167
|
-
key = `page-${page.num}-break`;
|
168
|
-
content = '…';
|
169
|
-
Object.assign(props, { as: 'span', 'aria-disabled': true });
|
170
|
-
}
|
171
|
-
}
|
172
|
-
return { props, key, content };
|
173
|
-
}
|
174
|
-
exports.buildComponentData = buildComponentData;
|
package/lib/PointerBox.jsx
DELETED
@@ -1,25 +0,0 @@
|
|
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
|
-
const react_1 = __importDefault(require("react"));
|
7
|
-
const BorderBox_1 = __importDefault(require("./BorderBox"));
|
8
|
-
const Caret_1 = __importDefault(require("./Caret"));
|
9
|
-
function PointerBox(props) {
|
10
|
-
// don't destructure these, just grab them
|
11
|
-
const { bg, border, borderColor, theme } = props;
|
12
|
-
const { caret, children, ...boxProps } = props;
|
13
|
-
const caretProps = {
|
14
|
-
bg,
|
15
|
-
borderColor,
|
16
|
-
borderWidth: border,
|
17
|
-
location: caret,
|
18
|
-
theme
|
19
|
-
};
|
20
|
-
return (<BorderBox_1.default sx={{ position: 'relative' }} {...boxProps}>
|
21
|
-
{children}
|
22
|
-
<Caret_1.default {...caretProps}/>
|
23
|
-
</BorderBox_1.default>);
|
24
|
-
}
|
25
|
-
exports.default = PointerBox;
|
package/lib/Popover.jsx
DELETED
@@ -1,210 +0,0 @@
|
|
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
|
-
const classnames_1 = __importDefault(require("classnames"));
|
7
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
8
|
-
const Box_1 = __importDefault(require("./Box"));
|
9
|
-
const constants_1 = require("./constants");
|
10
|
-
const sx_1 = __importDefault(require("./sx"));
|
11
|
-
const Popover = styled_components_1.default.div.attrs(({ className, caret }) => {
|
12
|
-
return {
|
13
|
-
className: classnames_1.default(className, `caret-pos--${caret}`)
|
14
|
-
};
|
15
|
-
}) `
|
16
|
-
position: ${props => (props.relative ? 'relative' : 'absolute')};
|
17
|
-
z-index: 100;
|
18
|
-
display: ${props => (props.open ? 'block' : 'none')};
|
19
|
-
|
20
|
-
${constants_1.COMMON};
|
21
|
-
${constants_1.LAYOUT};
|
22
|
-
${constants_1.POSITION};
|
23
|
-
${sx_1.default};
|
24
|
-
`;
|
25
|
-
const PopoverContent = styled_components_1.default(Box_1.default) `
|
26
|
-
border: 1px solid ${constants_1.get('colors.border.default')};
|
27
|
-
border-radius: ${constants_1.get('radii.2')};
|
28
|
-
position: relative;
|
29
|
-
width: 232px;
|
30
|
-
margin-right: auto;
|
31
|
-
margin-left: auto;
|
32
|
-
padding: ${constants_1.get('space.4')};
|
33
|
-
background-color: ${constants_1.get('colors.canvas.overlay')};
|
34
|
-
|
35
|
-
${constants_1.COMMON};
|
36
|
-
${constants_1.LAYOUT};
|
37
|
-
|
38
|
-
// Carets
|
39
|
-
&::before,
|
40
|
-
&::after {
|
41
|
-
position: absolute;
|
42
|
-
left: 50%;
|
43
|
-
display: inline-block;
|
44
|
-
content: '';
|
45
|
-
}
|
46
|
-
|
47
|
-
&::before {
|
48
|
-
top: -${constants_1.get('space.3')};
|
49
|
-
margin-left: -9px;
|
50
|
-
border: ${constants_1.get('space.2')} solid transparent; // TODO: solid?
|
51
|
-
border-bottom-color: ${constants_1.get('colors.border.default')};
|
52
|
-
}
|
53
|
-
|
54
|
-
&::after {
|
55
|
-
top: -14px;
|
56
|
-
margin-left: -${constants_1.get('space.2')};
|
57
|
-
border: 7px solid transparent; // todo: solid
|
58
|
-
border-bottom-color: ${constants_1.get('colors.canvas.overlay')};
|
59
|
-
}
|
60
|
-
|
61
|
-
// Bottom-oriented carets
|
62
|
-
${Popover}.caret-pos--bottom & ,
|
63
|
-
${Popover}.caret-pos--bottom-right & ,
|
64
|
-
${Popover}.caret-pos--bottom-left & {
|
65
|
-
&::before,
|
66
|
-
&::after {
|
67
|
-
top: auto;
|
68
|
-
border-bottom-color: transparent;
|
69
|
-
}
|
70
|
-
|
71
|
-
&::before {
|
72
|
-
bottom: -${constants_1.get('space.3')};
|
73
|
-
border-top-color: ${constants_1.get('colors.border.default')};
|
74
|
-
}
|
75
|
-
|
76
|
-
&::after {
|
77
|
-
bottom: -14px;
|
78
|
-
// stylelint-disable-next-line primer/borders
|
79
|
-
border-top-color: ${constants_1.get('colors.canvas.overlay')};
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
// Top & Bottom: Right-oriented carets
|
84
|
-
${Popover}.caret-pos--top-right & ,
|
85
|
-
${Popover}.caret-pos--bottom-right & {
|
86
|
-
right: -9px;
|
87
|
-
margin-right: 0;
|
88
|
-
|
89
|
-
&::before,
|
90
|
-
&::after {
|
91
|
-
left: auto;
|
92
|
-
margin-left: 0;
|
93
|
-
}
|
94
|
-
|
95
|
-
&::before {
|
96
|
-
right: 20px;
|
97
|
-
}
|
98
|
-
|
99
|
-
&::after {
|
100
|
-
right: 21px;
|
101
|
-
}
|
102
|
-
}
|
103
|
-
|
104
|
-
// Top & Bottom: Left-oriented carets
|
105
|
-
${Popover}.caret-pos--top-left & ,
|
106
|
-
${Popover}.caret-pos--bottom-left & {
|
107
|
-
left: -9px;
|
108
|
-
margin-left: 0;
|
109
|
-
|
110
|
-
&::before,
|
111
|
-
&::after {
|
112
|
-
left: ${constants_1.get('space.4')};
|
113
|
-
margin-left: 0;
|
114
|
-
}
|
115
|
-
|
116
|
-
&::after {
|
117
|
-
left: calc(${constants_1.get('space.4')} + 1px);
|
118
|
-
}
|
119
|
-
}
|
120
|
-
|
121
|
-
// Right- & Left-oriented carets
|
122
|
-
${Popover}.caret-pos--right & ,
|
123
|
-
${Popover}.caret-pos--right-top & ,
|
124
|
-
${Popover}.caret-pos--right-bottom & ,
|
125
|
-
${Popover}.caret-pos--left & ,
|
126
|
-
${Popover}.caret-pos--left-top & ,
|
127
|
-
${Popover}.caret-pos--left-bottom & {
|
128
|
-
&::before,
|
129
|
-
&::after {
|
130
|
-
top: 50%;
|
131
|
-
left: auto;
|
132
|
-
margin-left: 0;
|
133
|
-
border-bottom-color: transparent;
|
134
|
-
}
|
135
|
-
|
136
|
-
&::before {
|
137
|
-
// stylelint-disable-next-line primer/spacing
|
138
|
-
margin-top: calc((${constants_1.get('space.2')} + 1px) * -1);
|
139
|
-
}
|
140
|
-
|
141
|
-
&::after {
|
142
|
-
margin-top: -${constants_1.get('space.2')};
|
143
|
-
}
|
144
|
-
}
|
145
|
-
|
146
|
-
// Right-oriented carets
|
147
|
-
${Popover}.caret-pos--right & ,
|
148
|
-
${Popover}.caret-pos--right-top & ,
|
149
|
-
${Popover}.caret-pos--right-bottom & {
|
150
|
-
&::before {
|
151
|
-
right: -${constants_1.get('space.3')};
|
152
|
-
border-left-color: ${constants_1.get('colors.border.default')};
|
153
|
-
}
|
154
|
-
|
155
|
-
&::after {
|
156
|
-
right: -14px;
|
157
|
-
// stylelint-disable-next-line primer/borders
|
158
|
-
border-left-color: ${constants_1.get('colors.canvas.overlay')};
|
159
|
-
}
|
160
|
-
}
|
161
|
-
|
162
|
-
// Left-oriented carets
|
163
|
-
${Popover}.caret-pos--left & ,
|
164
|
-
${Popover}.caret-pos--left-top & ,
|
165
|
-
${Popover}.caret-pos--left-bottom & {
|
166
|
-
&::before {
|
167
|
-
left: -${constants_1.get('space.3')};
|
168
|
-
border-right-color: ${constants_1.get('colors.border.default')};
|
169
|
-
}
|
170
|
-
|
171
|
-
&::after {
|
172
|
-
left: -14px;
|
173
|
-
// stylelint-disable-next-line primer/borders
|
174
|
-
border-right-color: ${constants_1.get('colors.canvas.overlay')};
|
175
|
-
}
|
176
|
-
}
|
177
|
-
|
178
|
-
// Right & Left: Top-oriented carets
|
179
|
-
${Popover}.caret-pos--right-top & ,
|
180
|
-
${Popover}.caret-pos--left-top & {
|
181
|
-
&::before,
|
182
|
-
&::after {
|
183
|
-
top: ${constants_1.get('space.4')};
|
184
|
-
}
|
185
|
-
}
|
186
|
-
|
187
|
-
// Right & Left: Bottom-oriented carets
|
188
|
-
${Popover}.caret-pos--right-bottom & ,
|
189
|
-
${Popover}.caret-pos--left-bottom & {
|
190
|
-
&::before,
|
191
|
-
&::after {
|
192
|
-
top: auto;
|
193
|
-
}
|
194
|
-
|
195
|
-
&::before {
|
196
|
-
bottom: ${constants_1.get('space.3')};
|
197
|
-
}
|
198
|
-
|
199
|
-
&::after {
|
200
|
-
bottom: calc(${constants_1.get('space.3')} + 1px);
|
201
|
-
}
|
202
|
-
}
|
203
|
-
|
204
|
-
${sx_1.default};
|
205
|
-
`;
|
206
|
-
Popover.defaultProps = {
|
207
|
-
caret: 'top'
|
208
|
-
};
|
209
|
-
PopoverContent.displayName = 'Popover.Content';
|
210
|
-
exports.default = Object.assign(Popover, { Content: PopoverContent });
|
package/lib/Portal/Portal.jsx
DELETED
@@ -1,79 +0,0 @@
|
|
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.Portal = exports.registerPortalRoot = void 0;
|
7
|
-
const react_1 = __importDefault(require("react"));
|
8
|
-
const react_dom_1 = require("react-dom");
|
9
|
-
const useIsomorphicLayoutEffect_1 = __importDefault(require("../utils/useIsomorphicLayoutEffect"));
|
10
|
-
const PRIMER_PORTAL_ROOT_ID = '__primerPortalRoot__';
|
11
|
-
const DEFAULT_PORTAL_CONTAINER_NAME = '__default__';
|
12
|
-
const portalRootRegistry = {};
|
13
|
-
/**
|
14
|
-
* Register a container to serve as a portal root.
|
15
|
-
* @param root The element that will be the root for portals created in this container
|
16
|
-
* @param name The name of the container, to be used with the `containerName` prop on the Portal Component.
|
17
|
-
* If name is not specified, registers the default portal root.
|
18
|
-
*/
|
19
|
-
function registerPortalRoot(root, name = DEFAULT_PORTAL_CONTAINER_NAME) {
|
20
|
-
portalRootRegistry[name] = root;
|
21
|
-
}
|
22
|
-
exports.registerPortalRoot = registerPortalRoot;
|
23
|
-
// Ensures that a default portal root exists and is registered. If a DOM element exists
|
24
|
-
// with id __primerPortalRoot__, allow that element to serve as the default portal root.
|
25
|
-
// Otherwise, create that element and attach it to the end of document.body.
|
26
|
-
function ensureDefaultPortal() {
|
27
|
-
const existingDefaultPortalContainer = portalRootRegistry[DEFAULT_PORTAL_CONTAINER_NAME];
|
28
|
-
if (!existingDefaultPortalContainer || !document.body.contains(existingDefaultPortalContainer)) {
|
29
|
-
let defaultPortalContainer = document.getElementById(PRIMER_PORTAL_ROOT_ID);
|
30
|
-
if (!(defaultPortalContainer instanceof Element)) {
|
31
|
-
defaultPortalContainer = document.createElement('div');
|
32
|
-
defaultPortalContainer.setAttribute('id', PRIMER_PORTAL_ROOT_ID);
|
33
|
-
defaultPortalContainer.style.position = 'absolute';
|
34
|
-
defaultPortalContainer.style.top = '0';
|
35
|
-
defaultPortalContainer.style.left = '0';
|
36
|
-
const suitablePortalRoot = document.querySelector('[data-portal-root]');
|
37
|
-
if (suitablePortalRoot) {
|
38
|
-
suitablePortalRoot.appendChild(defaultPortalContainer);
|
39
|
-
}
|
40
|
-
else {
|
41
|
-
document.body.appendChild(defaultPortalContainer);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
registerPortalRoot(defaultPortalContainer);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
/**
|
48
|
-
* Creates a React Portal, placing all children in a separate physical DOM root node.
|
49
|
-
* @see https://reactjs.org/docs/portals.html
|
50
|
-
*/
|
51
|
-
const Portal = ({ children, onMount, containerName: _containerName }) => {
|
52
|
-
const hostElement = document.createElement('div');
|
53
|
-
// Portaled content should get their own stacking context so they don't interfere
|
54
|
-
// with each other in unexpected ways. One should never find themselves tempted
|
55
|
-
// to change the zIndex to a value other than "1".
|
56
|
-
hostElement.style.position = 'relative';
|
57
|
-
hostElement.style.zIndex = '1';
|
58
|
-
const elementRef = react_1.default.useRef(hostElement);
|
59
|
-
useIsomorphicLayoutEffect_1.default(() => {
|
60
|
-
let containerName = _containerName;
|
61
|
-
if (containerName === undefined) {
|
62
|
-
containerName = DEFAULT_PORTAL_CONTAINER_NAME;
|
63
|
-
ensureDefaultPortal();
|
64
|
-
}
|
65
|
-
const parentElement = portalRootRegistry[containerName];
|
66
|
-
if (!parentElement) {
|
67
|
-
throw new Error(`Portal container '${_containerName}' is not yet registered. Container must be registered with registerPortal before use.`);
|
68
|
-
}
|
69
|
-
const element = elementRef.current;
|
70
|
-
parentElement.appendChild(element);
|
71
|
-
onMount?.();
|
72
|
-
return () => {
|
73
|
-
parentElement.removeChild(element);
|
74
|
-
};
|
75
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
76
|
-
}, [elementRef]);
|
77
|
-
return react_dom_1.createPortal(children, elementRef.current);
|
78
|
-
};
|
79
|
-
exports.Portal = Portal;
|
package/lib/Position.jsx
DELETED
@@ -1,46 +0,0 @@
|
|
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.Sticky = exports.Relative = exports.Fixed = exports.Absolute = void 0;
|
7
|
-
const react_1 = __importDefault(require("react"));
|
8
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
9
|
-
const Box_1 = __importDefault(require("./Box"));
|
10
|
-
/**
|
11
|
-
* @deprecated Use the Box component instead (i.e. <Position> → <Box>)
|
12
|
-
*/
|
13
|
-
const Position = styled_components_1.default(Box_1.default) ``;
|
14
|
-
/**
|
15
|
-
* @deprecated Use the Box component instead (i.e. <Absolute> → <Box position="absolute">)
|
16
|
-
*/
|
17
|
-
exports.default = Position;
|
18
|
-
/**
|
19
|
-
* @deprecated Use the Box component instead (i.e. <Absolute> → <Box position="absolute">)
|
20
|
-
*/
|
21
|
-
exports.Absolute = react_1.default.forwardRef((props, ref) => {
|
22
|
-
return <Position {...props} position="absolute" ref={ref}/>;
|
23
|
-
});
|
24
|
-
exports.Absolute.displayName = 'Absolute';
|
25
|
-
/**
|
26
|
-
* @deprecated Use the Box component instead (i.e. <Fixed> → <Box position="fixed">)
|
27
|
-
*/
|
28
|
-
exports.Fixed = react_1.default.forwardRef((props, ref) => {
|
29
|
-
return <Position {...props} position="fixed" ref={ref}/>;
|
30
|
-
});
|
31
|
-
exports.Fixed.displayName = 'Fixed';
|
32
|
-
/**
|
33
|
-
* @deprecated Use the Box component instead (i.e. <Relative> → <Box position="relative">)
|
34
|
-
*/
|
35
|
-
exports.Relative = react_1.default.forwardRef((props, ref) => {
|
36
|
-
return <Position {...props} position="relative" ref={ref}/>;
|
37
|
-
});
|
38
|
-
exports.Relative.displayName = 'Relative';
|
39
|
-
/**
|
40
|
-
* @deprecated Use the Box component instead (i.e. <Sticky> → <Box position="sticky">)
|
41
|
-
*/
|
42
|
-
exports.Sticky = react_1.default.forwardRef((props, ref) => {
|
43
|
-
return <Position {...props} position="sticky" ref={ref}/>;
|
44
|
-
});
|
45
|
-
exports.Sticky.defaultProps = { top: 0, zIndex: 1 };
|
46
|
-
exports.Sticky.displayName = 'Sticky';
|
package/lib/ProgressBar.jsx
DELETED
@@ -1,39 +0,0 @@
|
|
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
|
-
const react_1 = __importDefault(require("react"));
|
7
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
8
|
-
const styled_system_1 = require("styled-system");
|
9
|
-
const constants_1 = require("./constants");
|
10
|
-
const sx_1 = __importDefault(require("./sx"));
|
11
|
-
const Bar = styled_components_1.default.span `
|
12
|
-
width: ${props => (props.progress ? `${props.progress}%` : 0)};
|
13
|
-
${constants_1.COMMON}
|
14
|
-
`;
|
15
|
-
const sizeMap = {
|
16
|
-
small: '5px',
|
17
|
-
large: '10px',
|
18
|
-
default: '8px'
|
19
|
-
};
|
20
|
-
const ProgressContainer = styled_components_1.default.span `
|
21
|
-
display: ${props => (props.inline ? 'inline-flex' : 'flex')};
|
22
|
-
overflow: hidden;
|
23
|
-
background-color: ${constants_1.get('colors.border.default')};
|
24
|
-
border-radius: ${constants_1.get('radii.1')};
|
25
|
-
height: ${props => sizeMap[props.barSize || 'default']};
|
26
|
-
${constants_1.COMMON}
|
27
|
-
${styled_system_1.width}
|
28
|
-
${sx_1.default};
|
29
|
-
`;
|
30
|
-
function ProgressBar({ progress, bg, theme, ...rest }) {
|
31
|
-
return (<ProgressContainer theme={theme} {...rest}>
|
32
|
-
<Bar progress={progress} bg={bg} theme={theme}/>
|
33
|
-
</ProgressContainer>);
|
34
|
-
}
|
35
|
-
ProgressBar.defaultProps = {
|
36
|
-
bg: 'success.emphasis',
|
37
|
-
barSize: 'default'
|
38
|
-
};
|
39
|
-
exports.default = ProgressBar;
|
@@ -1,114 +0,0 @@
|
|
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 styled_components_1 = __importDefault(require("styled-components"));
|
27
|
-
const constants_1 = require("../constants");
|
28
|
-
const sx_1 = __importDefault(require("../sx"));
|
29
|
-
const useKeyboardNav_1 = __importDefault(require("./hooks/useKeyboardNav"));
|
30
|
-
const SelectMenuContext_1 = require("./SelectMenuContext");
|
31
|
-
const SelectMenuDivider_1 = __importDefault(require("./SelectMenuDivider"));
|
32
|
-
const SelectMenuFilter_1 = __importDefault(require("./SelectMenuFilter"));
|
33
|
-
const SelectMenuFooter_1 = __importDefault(require("./SelectMenuFooter"));
|
34
|
-
const SelectMenuHeader_1 = __importDefault(require("./SelectMenuHeader"));
|
35
|
-
const SelectMenuItem_1 = __importDefault(require("./SelectMenuItem"));
|
36
|
-
const SelectMenuList_1 = __importDefault(require("./SelectMenuList"));
|
37
|
-
const SelectMenuLoadingAnimation_1 = __importDefault(require("./SelectMenuLoadingAnimation"));
|
38
|
-
const SelectMenuModal_1 = __importDefault(require("./SelectMenuModal"));
|
39
|
-
const SelectMenuTab_1 = __importDefault(require("./SelectMenuTab"));
|
40
|
-
const SelectMenuTabPanel_1 = __importDefault(require("./SelectMenuTabPanel"));
|
41
|
-
const SelectMenuTabs_1 = __importDefault(require("./SelectMenuTabs"));
|
42
|
-
const wrapperStyles = `
|
43
|
-
// Remove marker added by the display: list-item browser default
|
44
|
-
> summary {
|
45
|
-
list-style: none;
|
46
|
-
}
|
47
|
-
// Remove marker added by details polyfill
|
48
|
-
> summary::before {
|
49
|
-
display: none;
|
50
|
-
}
|
51
|
-
// Remove marker added by Chrome
|
52
|
-
> summary::-webkit-details-marker {
|
53
|
-
display: none;
|
54
|
-
}
|
55
|
-
`;
|
56
|
-
const StyledSelectMenu = styled_components_1.default.details `
|
57
|
-
${wrapperStyles}
|
58
|
-
${constants_1.COMMON}
|
59
|
-
${sx_1.default};
|
60
|
-
`;
|
61
|
-
// 'as' is spread out because we don't want users to be able to change the tag.
|
62
|
-
const SelectMenu = react_1.default.forwardRef(({ children, initialTab = '', as: _ignoredAs, ...rest }, forwardedRef) => {
|
63
|
-
const backupRef = react_1.useRef(null);
|
64
|
-
const ref = forwardedRef ?? backupRef;
|
65
|
-
const [selectedTab, setSelectedTab] = react_1.useState(initialTab);
|
66
|
-
const [open, setOpen] = react_1.useState(false);
|
67
|
-
const menuProviderValues = {
|
68
|
-
selectedTab,
|
69
|
-
setSelectedTab,
|
70
|
-
setOpen,
|
71
|
-
open,
|
72
|
-
initialTab
|
73
|
-
};
|
74
|
-
const onClickOutside = react_1.useCallback(event => {
|
75
|
-
if ('current' in ref && ref.current && !ref.current.contains(event.target)) {
|
76
|
-
if (!event.defaultPrevented) {
|
77
|
-
setOpen(false);
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}, [ref, setOpen]);
|
81
|
-
// handles the overlay behavior - closing the menu when clicking outside of it
|
82
|
-
react_1.useEffect(() => {
|
83
|
-
if (open) {
|
84
|
-
document.addEventListener('click', onClickOutside);
|
85
|
-
return () => {
|
86
|
-
document.removeEventListener('click', onClickOutside);
|
87
|
-
};
|
88
|
-
}
|
89
|
-
}, [open, onClickOutside]);
|
90
|
-
function toggle(event) {
|
91
|
-
setOpen(event.target.open);
|
92
|
-
}
|
93
|
-
useKeyboardNav_1.default(ref, open, setOpen);
|
94
|
-
return (<SelectMenuContext_1.MenuContext.Provider value={menuProviderValues}>
|
95
|
-
<StyledSelectMenu ref={ref} {...rest} open={open} onToggle={toggle}>
|
96
|
-
{children}
|
97
|
-
</StyledSelectMenu>
|
98
|
-
</SelectMenuContext_1.MenuContext.Provider>);
|
99
|
-
});
|
100
|
-
SelectMenu.displayName = 'SelectMenu';
|
101
|
-
exports.default = Object.assign(SelectMenu, {
|
102
|
-
MenuContext: SelectMenuContext_1.MenuContext,
|
103
|
-
List: SelectMenuList_1.default,
|
104
|
-
Divider: SelectMenuDivider_1.default,
|
105
|
-
Filter: SelectMenuFilter_1.default,
|
106
|
-
Footer: SelectMenuFooter_1.default,
|
107
|
-
Item: SelectMenuItem_1.default,
|
108
|
-
Modal: SelectMenuModal_1.default,
|
109
|
-
Tabs: SelectMenuTabs_1.default,
|
110
|
-
Tab: SelectMenuTab_1.default,
|
111
|
-
TabPanel: SelectMenuTabPanel_1.default,
|
112
|
-
Header: SelectMenuHeader_1.default,
|
113
|
-
LoadingAnimation: SelectMenuLoadingAnimation_1.default
|
114
|
-
});
|