@primer/components 0.0.0-20211124581 → 0.0.0-2021113174023
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 -110
- package/dist/browser.esm.js +783 -738
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +781 -736
- 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 +55 -30
- 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.d.ts +2 -3
- package/lib/ActionList2/Divider.js +5 -10
- 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.d.ts +26 -0
- package/lib/ActionList2/Header.js +55 -0
- package/lib/ActionList2/Header.jsx +36 -0
- package/lib/ActionList2/Item.js +6 -24
- 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 +1 -10
- package/lib/ActionList2/List.jsx +41 -0
- package/lib/ActionList2/Selection.js +1 -14
- package/lib/ActionList2/Selection.jsx +50 -0
- package/lib/ActionList2/Visuals.jsx +48 -0
- package/lib/ActionList2/index.d.ts +2 -1
- 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 -12
- package/lib/Autocomplete/Autocomplete.jsx +100 -0
- package/lib/Autocomplete/AutocompleteContext.jsx +5 -0
- package/lib/Autocomplete/AutocompleteInput.d.ts +3 -12
- 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.d.ts +2 -1
- package/lib/Avatar.js +1 -1
- 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.d.ts +2 -1
- package/lib/BranchName.js +1 -1
- 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 -3
- 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 -4
- package/lib/Button/ButtonClose.js +1 -1
- package/lib/Button/ButtonClose.jsx +55 -0
- package/lib/Button/ButtonDanger.d.ts +3 -3
- 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 -3
- package/lib/Button/ButtonInvisible.js +6 -2
- package/lib/Button/ButtonInvisible.jsx +52 -0
- package/lib/Button/ButtonOutline.d.ts +3 -3
- package/lib/Button/ButtonOutline.js +6 -2
- package/lib/Button/ButtonOutline.jsx +63 -0
- package/lib/Button/ButtonPrimary.d.ts +3 -3
- 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 -2
- 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.d.ts +2 -1
- package/lib/Details.js +3 -1
- 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 -5
- package/lib/Dialog.js +1 -1
- package/lib/Dialog.jsx +131 -0
- package/lib/Dropdown.d.ts +165 -16
- package/lib/Dropdown.js +3 -3
- package/lib/Dropdown.jsx +134 -0
- package/lib/DropdownMenu/DropdownButton.d.ts +47 -4
- 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 +17 -0
- package/lib/EmojiPicker/EmojiPicker.js +202 -0
- package/lib/EmojiPicker/EmojiPicker.jsx +132 -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 -265
- 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.d.ts +2 -1
- package/lib/Heading.js +6 -1
- 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.d.ts +11 -16
- package/lib/ProgressBar.js +10 -6
- package/lib/ProgressBar.jsx +39 -0
- package/lib/SelectMenu/SelectMenu.d.ts +189 -35
- 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.d.ts +2 -1
- package/lib/Spinner.js +3 -1
- 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.d.ts +1 -8
- package/lib/TextInput.js +5 -16
- package/lib/TextInput.jsx +23 -0
- package/lib/TextInputWithTokens.d.ts +3 -12
- 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.d.ts +1 -1
- package/lib/Token/AvatarToken.jsx +54 -0
- package/lib/Token/IssueLabelToken.d.ts +1 -1
- 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.d.ts +0 -3
- package/lib/_TextInputWrapper.js +7 -18
- 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.d.ts +0 -1
- package/lib/drafts.js +20 -43
- 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 -8
- 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 +56 -31
- package/lib-esm/ActionList2/Divider.d.ts +2 -3
- package/lib-esm/ActionList2/Divider.js +5 -8
- package/lib-esm/ActionList2/Group.d.ts +2 -28
- package/lib-esm/ActionList2/Group.js +5 -52
- package/lib-esm/ActionList2/Header.d.ts +26 -0
- package/lib-esm/ActionList2/Header.js +44 -0
- package/lib-esm/ActionList2/Item.js +6 -22
- package/lib-esm/ActionList2/List.d.ts +1 -1
- package/lib-esm/ActionList2/List.js +1 -8
- package/lib-esm/ActionList2/Selection.js +1 -12
- package/lib-esm/ActionList2/index.d.ts +2 -1
- package/lib-esm/Autocomplete/Autocomplete.d.ts +3 -12
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +3 -12
- package/lib-esm/Avatar.d.ts +2 -1
- package/lib-esm/Avatar.js +2 -2
- package/lib-esm/BranchName.d.ts +2 -1
- package/lib-esm/BranchName.js +2 -2
- package/lib-esm/Breadcrumbs.d.ts +7 -8
- package/lib-esm/Breadcrumbs.js +13 -8
- package/lib-esm/Button/Button.d.ts +3 -3
- 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 -4
- package/lib-esm/Button/ButtonClose.js +2 -2
- package/lib-esm/Button/ButtonDanger.d.ts +3 -3
- package/lib-esm/Button/ButtonDanger.js +2 -2
- package/lib-esm/Button/ButtonInvisible.d.ts +3 -3
- package/lib-esm/Button/ButtonInvisible.js +2 -2
- package/lib-esm/Button/ButtonOutline.d.ts +3 -3
- package/lib-esm/Button/ButtonOutline.js +2 -2
- package/lib-esm/Button/ButtonPrimary.d.ts +3 -3
- 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 -2
- package/lib-esm/CounterLabel.d.ts +2 -1
- package/lib-esm/CounterLabel.js +2 -2
- package/lib-esm/Details.d.ts +2 -1
- package/lib-esm/Details.js +2 -1
- package/lib-esm/Dialog/Dialog.d.ts +9 -5
- package/lib-esm/Dialog/Dialog.js +12 -12
- package/lib-esm/Dialog.d.ts +5 -5
- package/lib-esm/Dialog.js +2 -2
- package/lib-esm/Dropdown.d.ts +165 -16
- package/lib-esm/Dropdown.js +4 -4
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +47 -4
- package/lib-esm/DropdownMenu/DropdownButton.js +1 -3
- package/lib-esm/EmojiPicker/EmojiPicker.d.ts +17 -0
- package/lib-esm/EmojiPicker/EmojiPicker.js +181 -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 -265
- 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/Heading.d.ts +2 -1
- package/lib-esm/Heading.js +6 -2
- 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/ProgressBar.d.ts +11 -16
- package/lib-esm/ProgressBar.js +11 -7
- package/lib-esm/SelectMenu/SelectMenu.d.ts +189 -35
- 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/Spinner.d.ts +2 -1
- package/lib-esm/Spinner.js +2 -1
- 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/TextInput.d.ts +1 -8
- package/lib-esm/TextInput.js +5 -16
- package/lib-esm/TextInputWithTokens.d.ts +3 -12
- package/lib-esm/Timeline.d.ts +393 -19
- package/lib-esm/Timeline.js +13 -12
- package/lib-esm/Token/AvatarToken.d.ts +1 -1
- package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
- 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/_TextInputWrapper.d.ts +0 -3
- package/lib-esm/_TextInputWrapper.js +7 -18
- package/lib-esm/drafts.d.ts +0 -1
- package/lib-esm/drafts.js +1 -2
- 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 -8
- package/lib-esm/utils/testing.js +0 -24
- package/package.json +6 -5
- package/lib/ActionList2/MenuContext.d.ts +0 -10
- package/lib/ActionList2/MenuContext.js +0 -15
- package/lib/ActionMenu2.d.ts +0 -310
- package/lib/ActionMenu2.js +0 -91
- package/lib/Checkbox.d.ts +0 -29
- package/lib/Checkbox.js +0 -64
- package/lib-esm/ActionList2/MenuContext.d.ts +0 -10
- package/lib-esm/ActionList2/MenuContext.js +0 -3
- package/lib-esm/ActionMenu2.d.ts +0 -310
- package/lib-esm/ActionMenu2.js +0 -67
- package/lib-esm/Checkbox.d.ts +0 -29
- package/lib-esm/Checkbox.js +0 -44
@@ -25,9 +25,7 @@ const DropdownButton = /*#__PURE__*/_react.default.forwardRef(({
|
|
25
25
|
type: "button"
|
26
26
|
}, props), children, /*#__PURE__*/_react.default.createElement(_StyledOcticon.default, {
|
27
27
|
icon: _octiconsReact.TriangleDownIcon,
|
28
|
-
|
29
|
-
ml: 1
|
30
|
-
}
|
28
|
+
ml: 1
|
31
29
|
})));
|
32
30
|
|
33
31
|
exports.DropdownButton = DropdownButton;
|
@@ -0,0 +1,14 @@
|
|
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.DropdownButton = void 0;
|
7
|
+
const react_1 = __importDefault(require("react"));
|
8
|
+
const octicons_react_1 = require("@primer/octicons-react");
|
9
|
+
const Button_1 = __importDefault(require("../Button/Button"));
|
10
|
+
const StyledOcticon_1 = __importDefault(require("../StyledOcticon"));
|
11
|
+
exports.DropdownButton = react_1.default.forwardRef(({ children, ...props }, ref) => (<Button_1.default ref={ref} type="button" {...props}>
|
12
|
+
{children}
|
13
|
+
<StyledOcticon_1.default icon={octicons_react_1.TriangleDownIcon} ml={1}/>
|
14
|
+
</Button_1.default>));
|
@@ -0,0 +1,70 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
22
|
+
exports.DropdownMenu = void 0;
|
23
|
+
const react_1 = __importStar(require("react"));
|
24
|
+
const List_1 = require("../ActionList/List");
|
25
|
+
const DropdownButton_1 = require("./DropdownButton");
|
26
|
+
const AnchoredOverlay_1 = require("../AnchoredOverlay");
|
27
|
+
const useProvidedRefOrCreate_1 = require("../hooks/useProvidedRefOrCreate");
|
28
|
+
const useProvidedStateOrCreate_1 = require("../hooks/useProvidedStateOrCreate");
|
29
|
+
/**
|
30
|
+
* A `DropdownMenu` provides an anchor (button by default) that will open a floating menu of selectable items. The menu can be
|
31
|
+
* opened and navigated using keyboard or mouse. When an item is selected, the menu will close and the `onChange` callback will be called.
|
32
|
+
* If the default anchor button is used, the anchor contents will be updated with the selection.
|
33
|
+
*/
|
34
|
+
function DropdownMenu({ renderAnchor = (props) => <DropdownButton_1.DropdownButton {...props}/>, anchorRef: externalAnchorRef, placeholder, selectedItem, onChange, overlayProps, items, open, onOpenChange, ...listProps }) {
|
35
|
+
const [combinedOpenState, setCombinedOpenState] = useProvidedStateOrCreate_1.useProvidedStateOrCreate(open, onOpenChange, false);
|
36
|
+
const onOpen = react_1.useCallback(() => setCombinedOpenState(true), [setCombinedOpenState]);
|
37
|
+
const onClose = react_1.useCallback(() => setCombinedOpenState(false), [setCombinedOpenState]);
|
38
|
+
const anchorRef = useProvidedRefOrCreate_1.useProvidedRefOrCreate(externalAnchorRef);
|
39
|
+
const renderMenuAnchor = react_1.useMemo(() => {
|
40
|
+
if (renderAnchor === null) {
|
41
|
+
return null;
|
42
|
+
}
|
43
|
+
return (props) => renderAnchor({
|
44
|
+
...props,
|
45
|
+
children: selectedItem?.text ?? placeholder
|
46
|
+
});
|
47
|
+
}, [placeholder, renderAnchor, selectedItem?.text]);
|
48
|
+
const itemsToRender = react_1.useMemo(() => {
|
49
|
+
return items.map(item => {
|
50
|
+
return {
|
51
|
+
...item,
|
52
|
+
role: 'option',
|
53
|
+
selected: item === selectedItem,
|
54
|
+
onAction: (itemFromAction, event) => {
|
55
|
+
item.onAction?.(itemFromAction, event);
|
56
|
+
if (event.defaultPrevented) {
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
onClose();
|
60
|
+
onChange?.(item === selectedItem ? undefined : item);
|
61
|
+
}
|
62
|
+
};
|
63
|
+
});
|
64
|
+
}, [items, onChange, onClose, selectedItem]);
|
65
|
+
return (<AnchoredOverlay_1.AnchoredOverlay renderAnchor={renderMenuAnchor} anchorRef={anchorRef} open={combinedOpenState} onOpen={onOpen} onClose={onClose} overlayProps={overlayProps}>
|
66
|
+
<List_1.List {...listProps} role="listbox" items={itemsToRender}/>
|
67
|
+
</AnchoredOverlay_1.AnchoredOverlay>);
|
68
|
+
}
|
69
|
+
exports.DropdownMenu = DropdownMenu;
|
70
|
+
DropdownMenu.displayName = 'DropdownMenu';
|
@@ -1,21 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
});
|
6
|
-
|
7
|
-
|
8
|
-
get: function () {
|
9
|
-
return _DropdownMenu.DropdownMenu;
|
10
|
-
}
|
11
|
-
});
|
12
|
-
Object.defineProperty(exports, "DropdownButton", {
|
13
|
-
enumerable: true,
|
14
|
-
get: function () {
|
15
|
-
return _DropdownButton.DropdownButton;
|
16
|
-
}
|
17
|
-
});
|
18
|
-
|
19
|
-
var _DropdownMenu = require("./DropdownMenu");
|
20
|
-
|
21
|
-
var _DropdownButton = require("./DropdownButton");
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.DropdownButton = exports.DropdownMenu = void 0;
|
4
|
+
var DropdownMenu_1 = require("./DropdownMenu");
|
5
|
+
Object.defineProperty(exports, "DropdownMenu", { enumerable: true, get: function () { return DropdownMenu_1.DropdownMenu; } });
|
6
|
+
var DropdownButton_1 = require("./DropdownButton");
|
7
|
+
Object.defineProperty(exports, "DropdownButton", { enumerable: true, get: function () { return DropdownButton_1.DropdownButton; } });
|
package/lib/DropdownStyles.js
CHANGED
@@ -1,15 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _constants = require("./constants");
|
9
|
-
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const constants_1 = require("./constants");
|
10
4
|
const getDirectionStyles = (theme, direction) => {
|
11
|
-
|
12
|
-
|
5
|
+
const map = {
|
6
|
+
w: `
|
13
7
|
top: 0;
|
14
8
|
right: 100%;
|
15
9
|
left: auto;
|
@@ -22,7 +16,7 @@ const getDirectionStyles = (theme, direction) => {
|
|
22
16
|
right: -16px;
|
23
17
|
left: auto;
|
24
18
|
border-color: transparent;
|
25
|
-
border-left-color: ${
|
19
|
+
border-left-color: ${constants_1.get('colors.border.default')(theme)};
|
26
20
|
}
|
27
21
|
|
28
22
|
&::after {
|
@@ -30,10 +24,10 @@ const getDirectionStyles = (theme, direction) => {
|
|
30
24
|
right: -14px;
|
31
25
|
left: auto;
|
32
26
|
border-color: transparent;
|
33
|
-
border-left-color: ${
|
27
|
+
border-left-color: ${constants_1.get('colors.border.default')(theme)};
|
34
28
|
}
|
35
29
|
`,
|
36
|
-
|
30
|
+
e: `
|
37
31
|
top: 0;
|
38
32
|
left: 100%;
|
39
33
|
width: auto;
|
@@ -44,17 +38,17 @@ const getDirectionStyles = (theme, direction) => {
|
|
44
38
|
top: 10px;
|
45
39
|
left: -16px;
|
46
40
|
border-color: transparent;
|
47
|
-
border-right-color: ${
|
41
|
+
border-right-color: ${constants_1.get('colors.border.default')(theme)};
|
48
42
|
}
|
49
43
|
|
50
44
|
&::after {
|
51
45
|
top: 11px;
|
52
46
|
left: -14px;
|
53
47
|
border-color: transparent;
|
54
|
-
border-right-color: ${
|
48
|
+
border-right-color: ${constants_1.get('colors.border.default')(theme)};
|
55
49
|
}
|
56
50
|
`,
|
57
|
-
|
51
|
+
ne: `
|
58
52
|
top: auto;
|
59
53
|
bottom: 100%;
|
60
54
|
left: 0;
|
@@ -69,7 +63,7 @@ const getDirectionStyles = (theme, direction) => {
|
|
69
63
|
&::before {
|
70
64
|
bottom: -8px;
|
71
65
|
left: 9px;
|
72
|
-
border-top: 8px solid ${
|
66
|
+
border-top: 8px solid ${constants_1.get('colors.border.default')(theme)};
|
73
67
|
border-bottom: 0;
|
74
68
|
border-left: 8px solid transparent;
|
75
69
|
}
|
@@ -77,13 +71,13 @@ const getDirectionStyles = (theme, direction) => {
|
|
77
71
|
&::after {
|
78
72
|
bottom: -7px;
|
79
73
|
left: 10px;
|
80
|
-
border-top: 7px solid ${
|
74
|
+
border-top: 7px solid ${constants_1.get('colors.border.default')(theme)};
|
81
75
|
border-right: 7px solid transparent;
|
82
76
|
border-bottom: 0;
|
83
77
|
border-left: 7px solid transparent;
|
84
78
|
}
|
85
79
|
`,
|
86
|
-
|
80
|
+
s: `
|
87
81
|
right: 50%;
|
88
82
|
left: auto;
|
89
83
|
transform: translateX(50%);
|
@@ -100,7 +94,7 @@ const getDirectionStyles = (theme, direction) => {
|
|
100
94
|
transform: translateX(50%);
|
101
95
|
}
|
102
96
|
`,
|
103
|
-
|
97
|
+
sw: `
|
104
98
|
right: 0;
|
105
99
|
left: auto;
|
106
100
|
|
@@ -116,7 +110,7 @@ const getDirectionStyles = (theme, direction) => {
|
|
116
110
|
left: auto;
|
117
111
|
}
|
118
112
|
`,
|
119
|
-
|
113
|
+
se: `
|
120
114
|
&::before {
|
121
115
|
top: -16px;
|
122
116
|
left: 9px;
|
@@ -127,9 +121,7 @@ const getDirectionStyles = (theme, direction) => {
|
|
127
121
|
left: 10px;
|
128
122
|
}
|
129
123
|
`
|
130
|
-
|
131
|
-
|
124
|
+
};
|
125
|
+
return map[direction];
|
132
126
|
};
|
133
|
-
|
134
|
-
var _default = getDirectionStyles;
|
135
|
-
exports.default = _default;
|
127
|
+
exports.default = getDirectionStyles;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
export interface EmojiPickerProps {
|
3
|
+
customCategories?: Array<EmojiCategory>;
|
4
|
+
onSelect?: (emoji: string) => void;
|
5
|
+
}
|
6
|
+
export interface Emoji {
|
7
|
+
name: string;
|
8
|
+
emoji: string;
|
9
|
+
}
|
10
|
+
export interface EmojiCategory {
|
11
|
+
id: number | string;
|
12
|
+
name: string;
|
13
|
+
categoryIcon: React.ReactNode;
|
14
|
+
emojis: Array<Emoji>;
|
15
|
+
}
|
16
|
+
declare const EmojiPicker: ({ customCategories, onSelect }: EmojiPickerProps) => JSX.Element;
|
17
|
+
export default EmojiPicker;
|
@@ -0,0 +1,202 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _octiconsReact = require("@primer/octicons-react");
|
9
|
+
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
11
|
+
|
12
|
+
var _ = require("..");
|
13
|
+
|
14
|
+
var _AnchoredOverlay = require("../AnchoredOverlay");
|
15
|
+
|
16
|
+
var _data = _interopRequireDefault(require("./data"));
|
17
|
+
|
18
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
19
|
+
|
20
|
+
var _constants = require("../constants");
|
21
|
+
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
|
+
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
25
|
+
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
27
|
+
|
28
|
+
const CategoryButton = (0, _styledComponents.default)(_.ButtonInvisible).withConfig({
|
29
|
+
displayName: "EmojiPicker__CategoryButton",
|
30
|
+
componentId: "sc-13xkiny-0"
|
31
|
+
})(["color:", ";background-color:transparent;border:0;border-radius:", ";box-shadow:none;padding:8px;flex:1;"], (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('radii.2'));
|
32
|
+
|
33
|
+
const EmojiPicker = ({
|
34
|
+
customCategories,
|
35
|
+
onSelect
|
36
|
+
}) => {
|
37
|
+
const emojiAnchor = (0, _react.useRef)(null);
|
38
|
+
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
39
|
+
const [frequentEmojis, setFrequentEmojis] = (0, _react.useState)([]);
|
40
|
+
(0, _react.useEffect)(() => {
|
41
|
+
if (isOpen) {
|
42
|
+
var _localStorage$getItem;
|
43
|
+
|
44
|
+
const lsEmojis = JSON.parse((_localStorage$getItem = localStorage.getItem('frequentEmojis')) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : '[]');
|
45
|
+
|
46
|
+
if (lsEmojis) {
|
47
|
+
setFrequentEmojis(lsEmojis);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}, [isOpen]);
|
51
|
+
|
52
|
+
const onEmojiClick = emoji => {
|
53
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(emoji.emoji);
|
54
|
+
setIsOpen(false);
|
55
|
+
};
|
56
|
+
|
57
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_.Button, {
|
58
|
+
ref: emojiAnchor,
|
59
|
+
onClick: () => setIsOpen(!isOpen)
|
60
|
+
}, /*#__PURE__*/_react.default.createElement(_.StyledOcticon, {
|
61
|
+
icon: _octiconsReact.SmileyIcon
|
62
|
+
})), /*#__PURE__*/_react.default.createElement(_AnchoredOverlay.AnchoredOverlay, {
|
63
|
+
anchorRef: emojiAnchor,
|
64
|
+
renderAnchor: null,
|
65
|
+
open: isOpen,
|
66
|
+
height: 'large',
|
67
|
+
width: 'medium'
|
68
|
+
}, /*#__PURE__*/_react.default.createElement(_.Box, {
|
69
|
+
sx: {
|
70
|
+
display: 'flex',
|
71
|
+
flex: 1,
|
72
|
+
flexDirection: 'column',
|
73
|
+
height: '100%'
|
74
|
+
}
|
75
|
+
}, /*#__PURE__*/_react.default.createElement(_.Box, {
|
76
|
+
sx: {
|
77
|
+
display: 'flex',
|
78
|
+
flex: 1,
|
79
|
+
flexDirection: 'row',
|
80
|
+
width: '100%'
|
81
|
+
}
|
82
|
+
}, frequentEmojis.length > 0 && /*#__PURE__*/_react.default.createElement(CategoryButton, null, /*#__PURE__*/_react.default.createElement(_.StyledOcticon, {
|
83
|
+
icon: _octiconsReact.ClockIcon,
|
84
|
+
color: "fg.muted"
|
85
|
+
})), customCategories === null || customCategories === void 0 ? void 0 : customCategories.map(category => {
|
86
|
+
if (category.emojis.length > 0) return /*#__PURE__*/_react.default.createElement(CategoryButton, {
|
87
|
+
key: category.id
|
88
|
+
}, category.categoryIcon);
|
89
|
+
}), /*#__PURE__*/_react.default.createElement(CategoryButton, null, /*#__PURE__*/_react.default.createElement(_octiconsReact.SmileyIcon, null)), /*#__PURE__*/_react.default.createElement(CategoryButton, null, /*#__PURE__*/_react.default.createElement(_octiconsReact.SquirrelIcon, null)), /*#__PURE__*/_react.default.createElement(CategoryButton, null, /*#__PURE__*/_react.default.createElement(_.StyledOcticon, {
|
90
|
+
icon: _octiconsReact.ImageIcon,
|
91
|
+
color: "fg.muted"
|
92
|
+
})), /*#__PURE__*/_react.default.createElement(CategoryButton, null, /*#__PURE__*/_react.default.createElement(_.StyledOcticon, {
|
93
|
+
icon: _octiconsReact.GlobeIcon,
|
94
|
+
color: "fg.muted"
|
95
|
+
})), /*#__PURE__*/_react.default.createElement(CategoryButton, null, /*#__PURE__*/_react.default.createElement(_.StyledOcticon, {
|
96
|
+
icon: _octiconsReact.OrganizationIcon,
|
97
|
+
color: "fg.muted"
|
98
|
+
})), /*#__PURE__*/_react.default.createElement(CategoryButton, null, /*#__PURE__*/_react.default.createElement(_.StyledOcticon, {
|
99
|
+
icon: _octiconsReact.LightBulbIcon,
|
100
|
+
color: "fg.muted"
|
101
|
+
})), /*#__PURE__*/_react.default.createElement(CategoryButton, null, /*#__PURE__*/_react.default.createElement(_.StyledOcticon, {
|
102
|
+
icon: _octiconsReact.HeartIcon,
|
103
|
+
color: "fg.muted"
|
104
|
+
})), /*#__PURE__*/_react.default.createElement(CategoryButton, null, /*#__PURE__*/_react.default.createElement(_.StyledOcticon, {
|
105
|
+
icon: _octiconsReact.LocationIcon,
|
106
|
+
color: "fg.muted"
|
107
|
+
}))), /*#__PURE__*/_react.default.createElement(_.TextInput, {
|
108
|
+
block: true,
|
109
|
+
width: "auto",
|
110
|
+
color: "fg.default"
|
111
|
+
}), /*#__PURE__*/_react.default.createElement(_.Box, {
|
112
|
+
sx: {
|
113
|
+
overflow: 'auto',
|
114
|
+
display: 'flex',
|
115
|
+
flexDirection: 'column',
|
116
|
+
width: '100%',
|
117
|
+
height: '100%',
|
118
|
+
p: 2
|
119
|
+
}
|
120
|
+
}, frequentEmojis.length > 0 && /*#__PURE__*/_react.default.createElement(_.Box, {
|
121
|
+
key: "frequently-used"
|
122
|
+
}, /*#__PURE__*/_react.default.createElement(_.Text, {
|
123
|
+
sx: {
|
124
|
+
fontSize: 0,
|
125
|
+
color: 'fg.muted'
|
126
|
+
}
|
127
|
+
}, "Frequently Used"), /*#__PURE__*/_react.default.createElement(_.Box, {
|
128
|
+
sx: {
|
129
|
+
display: 'flex',
|
130
|
+
flexDirection: 'row',
|
131
|
+
flexWrap: 'wrap',
|
132
|
+
width: '100%'
|
133
|
+
}
|
134
|
+
}, frequentEmojis.map(emoji => /*#__PURE__*/_react.default.createElement(_.Text, {
|
135
|
+
key: `emoji-${emoji.emoji}`,
|
136
|
+
sx: {
|
137
|
+
p: '10px',
|
138
|
+
borderRadius: 'radii.3',
|
139
|
+
flex: 1
|
140
|
+
}
|
141
|
+
}, emoji.emoji)))), customCategories === null || customCategories === void 0 ? void 0 : customCategories.map(category => {
|
142
|
+
if (category.emojis.length > 0) return /*#__PURE__*/_react.default.createElement(_.Box, {
|
143
|
+
key: `category-section-${category.id}`
|
144
|
+
}, /*#__PURE__*/_react.default.createElement(_.Text, {
|
145
|
+
sx: {
|
146
|
+
fontSize: 0,
|
147
|
+
color: 'fg.muted'
|
148
|
+
}
|
149
|
+
}, category.name), /*#__PURE__*/_react.default.createElement(_.Box, {
|
150
|
+
sx: {
|
151
|
+
display: 'flex',
|
152
|
+
flexDirection: 'row',
|
153
|
+
flexWrap: 'wrap',
|
154
|
+
width: '100%'
|
155
|
+
}
|
156
|
+
}, category.emojis.map(emoji => /*#__PURE__*/_react.default.createElement(_.ButtonInvisible, {
|
157
|
+
key: `emoji-${emoji.emoji}`,
|
158
|
+
sx: {
|
159
|
+
p: '10px',
|
160
|
+
borderRadius: 'radii.3',
|
161
|
+
flex: 1,
|
162
|
+
color: 'fg.muted'
|
163
|
+
},
|
164
|
+
onClick: () => onEmojiClick(emoji)
|
165
|
+
}, /*#__PURE__*/_react.default.createElement(_.Text, {
|
166
|
+
key: `emoji-${emoji.emoji}`,
|
167
|
+
sx: {
|
168
|
+
p: '10px',
|
169
|
+
borderRadius: 'radii.3',
|
170
|
+
flex: 1
|
171
|
+
}
|
172
|
+
}, emoji.emoji)))));
|
173
|
+
}), _data.default.map(category => /*#__PURE__*/_react.default.createElement(_.Box, {
|
174
|
+
key: category.id
|
175
|
+
}, /*#__PURE__*/_react.default.createElement(_.Text, {
|
176
|
+
sx: {
|
177
|
+
fontSize: 0,
|
178
|
+
color: 'fg.muted'
|
179
|
+
}
|
180
|
+
}, category.name), /*#__PURE__*/_react.default.createElement(_.Box, {
|
181
|
+
sx: {
|
182
|
+
display: 'flex',
|
183
|
+
flexDirection: 'row',
|
184
|
+
flexWrap: 'wrap',
|
185
|
+
width: '100%'
|
186
|
+
}
|
187
|
+
}, category.emojis.map(emoji => /*#__PURE__*/_react.default.createElement(_.ButtonInvisible, {
|
188
|
+
key: `emoji-${emoji.emoji}`,
|
189
|
+
sx: {
|
190
|
+
p: '10px',
|
191
|
+
borderRadius: 'radii.3',
|
192
|
+
flex: 1,
|
193
|
+
color: 'fg.muted'
|
194
|
+
},
|
195
|
+
onClick: () => onEmojiClick(emoji)
|
196
|
+
}, /*#__PURE__*/_react.default.createElement(_.Text, {
|
197
|
+
key: `emoji-${emoji.emoji}`
|
198
|
+
}, emoji.emoji))))))))));
|
199
|
+
};
|
200
|
+
|
201
|
+
var _default = EmojiPicker;
|
202
|
+
exports.default = _default;
|
@@ -0,0 +1,132 @@
|
|
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 octicons_react_1 = require("@primer/octicons-react");
|
26
|
+
const react_1 = __importStar(require("react"));
|
27
|
+
const __1 = require("..");
|
28
|
+
const AnchoredOverlay_1 = require("../AnchoredOverlay");
|
29
|
+
const data_1 = __importDefault(require("./data"));
|
30
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
31
|
+
const constants_1 = require("../constants");
|
32
|
+
const CategoryButton = styled_components_1.default(__1.ButtonInvisible) `
|
33
|
+
color: ${constants_1.get('colors.fg.muted')};
|
34
|
+
background-color: transparent;
|
35
|
+
border: 0;
|
36
|
+
border-radius: ${constants_1.get('radii.2')};
|
37
|
+
box-shadow: none;
|
38
|
+
padding: 8px;
|
39
|
+
flex: 1;
|
40
|
+
`;
|
41
|
+
const EmojiPicker = ({ customCategories, onSelect }) => {
|
42
|
+
const emojiAnchor = react_1.useRef(null);
|
43
|
+
const [isOpen, setIsOpen] = react_1.useState(false);
|
44
|
+
const [frequentEmojis, setFrequentEmojis] = react_1.useState([]);
|
45
|
+
react_1.useEffect(() => {
|
46
|
+
if (isOpen) {
|
47
|
+
const lsEmojis = JSON.parse(localStorage.getItem('frequentEmojis') ?? '[]');
|
48
|
+
if (lsEmojis) {
|
49
|
+
setFrequentEmojis(lsEmojis);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}, [isOpen]);
|
53
|
+
const onEmojiClick = (emoji) => {
|
54
|
+
onSelect?.(emoji.emoji);
|
55
|
+
setIsOpen(false);
|
56
|
+
};
|
57
|
+
return (<>
|
58
|
+
<__1.Button ref={emojiAnchor} onClick={() => setIsOpen(!isOpen)}>
|
59
|
+
<__1.StyledOcticon icon={octicons_react_1.SmileyIcon}/>
|
60
|
+
</__1.Button>
|
61
|
+
<AnchoredOverlay_1.AnchoredOverlay anchorRef={emojiAnchor} renderAnchor={null} open={isOpen} height={'large'} width={'medium'}>
|
62
|
+
<__1.Box sx={{ display: 'flex', flex: 1, flexDirection: 'column', height: '100%' }}>
|
63
|
+
<__1.Box sx={{ display: 'flex', flex: 1, flexDirection: 'row', width: '100%' }}>
|
64
|
+
{frequentEmojis.length > 0 && (<CategoryButton>
|
65
|
+
<__1.StyledOcticon icon={octicons_react_1.ClockIcon} color="fg.muted"/>
|
66
|
+
</CategoryButton>)}
|
67
|
+
{customCategories?.map(category => {
|
68
|
+
if (category.emojis.length > 0)
|
69
|
+
return <CategoryButton key={category.id}>{category.categoryIcon}</CategoryButton>;
|
70
|
+
})}
|
71
|
+
<CategoryButton>
|
72
|
+
<octicons_react_1.SmileyIcon />
|
73
|
+
</CategoryButton>
|
74
|
+
<CategoryButton>
|
75
|
+
<octicons_react_1.SquirrelIcon />
|
76
|
+
</CategoryButton>
|
77
|
+
<CategoryButton>
|
78
|
+
<__1.StyledOcticon icon={octicons_react_1.ImageIcon} color="fg.muted"/>
|
79
|
+
</CategoryButton>
|
80
|
+
<CategoryButton>
|
81
|
+
<__1.StyledOcticon icon={octicons_react_1.GlobeIcon} color="fg.muted"/>
|
82
|
+
</CategoryButton>
|
83
|
+
<CategoryButton>
|
84
|
+
<__1.StyledOcticon icon={octicons_react_1.OrganizationIcon} color="fg.muted"/>
|
85
|
+
</CategoryButton>
|
86
|
+
<CategoryButton>
|
87
|
+
<__1.StyledOcticon icon={octicons_react_1.LightBulbIcon} color="fg.muted"/>
|
88
|
+
</CategoryButton>
|
89
|
+
<CategoryButton>
|
90
|
+
<__1.StyledOcticon icon={octicons_react_1.HeartIcon} color="fg.muted"/>
|
91
|
+
</CategoryButton>
|
92
|
+
<CategoryButton>
|
93
|
+
<__1.StyledOcticon icon={octicons_react_1.LocationIcon} color="fg.muted"/>
|
94
|
+
</CategoryButton>
|
95
|
+
</__1.Box>
|
96
|
+
<__1.TextInput block width="auto" color="fg.default"/>
|
97
|
+
<__1.Box sx={{ overflow: 'auto', display: 'flex', flexDirection: 'column', width: '100%', height: '100%', p: 2 }}>
|
98
|
+
{frequentEmojis.length > 0 && (<__1.Box key="frequently-used">
|
99
|
+
<__1.Text sx={{ fontSize: 0, color: 'fg.muted' }}>Frequently Used</__1.Text>
|
100
|
+
<__1.Box sx={{ display: 'flex', flexDirection: 'row', flexWrap: 'wrap', width: '100%' }}>
|
101
|
+
{frequentEmojis.map(emoji => (<__1.Text key={`emoji-${emoji.emoji}`} sx={{ p: '10px', borderRadius: 'radii.3', flex: 1 }}>
|
102
|
+
{emoji.emoji}
|
103
|
+
</__1.Text>))}
|
104
|
+
</__1.Box>
|
105
|
+
</__1.Box>)}
|
106
|
+
{customCategories?.map(category => {
|
107
|
+
if (category.emojis.length > 0)
|
108
|
+
return (<__1.Box key={`category-section-${category.id}`}>
|
109
|
+
<__1.Text sx={{ fontSize: 0, color: 'fg.muted' }}>{category.name}</__1.Text>
|
110
|
+
<__1.Box sx={{ display: 'flex', flexDirection: 'row', flexWrap: 'wrap', width: '100%' }}>
|
111
|
+
{category.emojis.map(emoji => (<__1.ButtonInvisible key={`emoji-${emoji.emoji}`} sx={{ p: '10px', borderRadius: 'radii.3', flex: 1, color: 'fg.muted' }} onClick={() => onEmojiClick(emoji)}>
|
112
|
+
<__1.Text key={`emoji-${emoji.emoji}`} sx={{ p: '10px', borderRadius: 'radii.3', flex: 1 }}>
|
113
|
+
{emoji.emoji}
|
114
|
+
</__1.Text>
|
115
|
+
</__1.ButtonInvisible>))}
|
116
|
+
</__1.Box>
|
117
|
+
</__1.Box>);
|
118
|
+
})}
|
119
|
+
{data_1.default.map(category => (<__1.Box key={category.id}>
|
120
|
+
<__1.Text sx={{ fontSize: 0, color: 'fg.muted' }}>{category.name}</__1.Text>
|
121
|
+
<__1.Box sx={{ display: 'flex', flexDirection: 'row', flexWrap: 'wrap', width: '100%' }}>
|
122
|
+
{category.emojis.map(emoji => (<__1.ButtonInvisible key={`emoji-${emoji.emoji}`} sx={{ p: '10px', borderRadius: 'radii.3', flex: 1, color: 'fg.muted' }} onClick={() => onEmojiClick(emoji)}>
|
123
|
+
<__1.Text key={`emoji-${emoji.emoji}`}>{emoji.emoji}</__1.Text>
|
124
|
+
</__1.ButtonInvisible>))}
|
125
|
+
</__1.Box>
|
126
|
+
</__1.Box>))}
|
127
|
+
</__1.Box>
|
128
|
+
</__1.Box>
|
129
|
+
</AnchoredOverlay_1.AnchoredOverlay>
|
130
|
+
</>);
|
131
|
+
};
|
132
|
+
exports.default = EmojiPicker;
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
9
|
+
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
12
|
+
const EmojiPickerPanel = () => {
|
13
|
+
return /*#__PURE__*/_react.default.createElement("div", null);
|
14
|
+
};
|
15
|
+
|
16
|
+
EmojiPickerPanel.displayName = "EmojiPickerPanel";
|
17
|
+
var _default = EmojiPickerPanel;
|
18
|
+
exports.default = _default;
|
@@ -0,0 +1,10 @@
|
|
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 EmojiPickerPanel = () => {
|
8
|
+
return <div></div>;
|
9
|
+
};
|
10
|
+
exports.default = EmojiPickerPanel;
|