@primer/components 0.0.0-2021983515 → 0.0.0-2022530194733
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +105 -492
- package/README.md +16 -16
- package/codemods/lib/modifyProps.js +7 -9
- package/codemods/lib/prettify.js +1 -1
- package/codemods/lib/replaceImportSource.js +5 -5
- package/dist/browser.esm.js +889 -1279
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +839 -1234
- package/dist/browser.umd.js.map +1 -1
- package/index.d.ts +940 -0
- package/lib/AvatarPair.js +5 -6
- package/lib/AvatarStack.js +10 -10
- package/lib/BaseStyles.js +19 -18
- package/lib/BorderBox.js +5 -4
- package/lib/Box.js +2 -2
- package/lib/BranchName.js +1 -1
- package/lib/{Breadcrumbs.js → Breadcrumb.js} +23 -33
- package/lib/Button/Button.js +3 -3
- package/lib/Button/ButtonClose.js +4 -4
- package/lib/Button/ButtonDanger.js +2 -2
- package/lib/Button/ButtonInvisible.js +3 -3
- package/lib/Button/ButtonOutline.js +2 -2
- package/lib/Button/ButtonPrimary.js +2 -2
- package/lib/Button/ButtonTableList.js +1 -1
- package/lib/CircleBadge.js +1 -1
- package/lib/CircleOcticon.js +7 -9
- package/lib/CounterLabel.js +2 -2
- package/lib/Dialog.js +14 -13
- package/lib/Dropdown.js +2 -2
- package/lib/DropdownStyles.js +6 -6
- package/lib/FilterList.js +1 -1
- package/lib/Flash.js +1 -1
- package/lib/Flex.js +0 -3
- package/lib/Grid.js +3 -4
- package/lib/Header.js +2 -3
- package/lib/Label.js +4 -4
- package/lib/Link.js +12 -1
- package/lib/Overlay.js +36 -126
- package/lib/Pagehead.js +1 -1
- package/lib/Pagination/Pagination.js +2 -3
- package/lib/Popover.js +3 -3
- package/lib/Portal/Portal.js +12 -20
- package/lib/Position.js +27 -46
- package/lib/ProgressBar.js +1 -1
- package/lib/SelectMenu/SelectMenu.js +4 -4
- package/lib/SelectMenu/SelectMenuContext.js +1 -1
- package/lib/SelectMenu/SelectMenuDivider.js +3 -3
- package/lib/SelectMenu/SelectMenuFilter.js +6 -6
- package/lib/SelectMenu/SelectMenuFooter.js +3 -3
- package/lib/SelectMenu/SelectMenuHeader.js +2 -2
- package/lib/SelectMenu/SelectMenuItem.js +4 -4
- package/lib/SelectMenu/SelectMenuList.js +3 -3
- package/lib/SelectMenu/SelectMenuLoadingAnimation.js +15 -4
- package/lib/SelectMenu/SelectMenuModal.js +7 -7
- package/lib/SelectMenu/SelectMenuTab.js +3 -3
- package/lib/SelectMenu/SelectMenuTabPanel.js +3 -3
- package/lib/SelectMenu/SelectMenuTabs.js +2 -2
- package/lib/SelectMenu/hooks/useKeyboardNav.js +0 -2
- package/lib/SideNav.js +12 -20
- package/lib/StateLabel.js +4 -4
- package/lib/SubNav.js +3 -5
- package/lib/TabNav.js +3 -3
- package/lib/TextInput.js +59 -22
- package/lib/ThemeProvider.js +15 -32
- package/lib/Timeline.js +29 -24
- package/lib/Tooltip.js +1 -2
- package/lib/UnderlineNav.js +2 -2
- package/lib/behaviors/anchoredPosition.js +9 -17
- package/lib/behaviors/focusTrap.js +14 -32
- package/lib/behaviors/focusZone.js +148 -218
- package/lib/constants.js +2 -3
- package/lib/hooks/index.js +1 -9
- package/lib/hooks/useAnchoredPosition.js +4 -11
- package/lib/hooks/useDialog.js +1 -1
- package/lib/hooks/useFocusTrap.js +8 -26
- package/lib/hooks/useFocusZone.js +7 -7
- package/lib/hooks/useMouseIntent.js +58 -0
- package/lib/hooks/useOnEscapePress.js +10 -53
- package/lib/hooks/useOnOutsideClick.js +35 -62
- package/lib/hooks/useOpenAndCloseFocus.js +3 -8
- package/lib/hooks/useOverlay.js +19 -9
- package/lib/hooks/useSafeTimeout.js +0 -1
- package/lib/index.js +12 -112
- package/lib/polyfills/eventListenerSignal.js +1 -6
- package/lib/stories/Button.stories.js +114 -0
- package/lib/stories/Overlay.stories.js +102 -0
- package/lib/stories/Portal.stories.js +108 -0
- package/lib/stories/ThemeProvider.stories.js +95 -0
- package/lib/stories/useAnchoredPosition.stories.js +349 -0
- package/lib/stories/useFocusTrap.stories.js +278 -0
- package/lib/stories/useFocusZone.stories.js +490 -0
- package/lib/theme-preval.js +2057 -5148
- package/lib/utils/deprecate.js +2 -3
- package/lib/utils/isNumeric.js +0 -1
- package/lib/utils/iterateFocusableElements.js +1 -1
- package/lib/utils/test-deprecations.js +0 -1
- package/lib/utils/test-matchers.js +12 -3
- package/lib/utils/testing.js +4 -4
- package/lib/utils/theme.js +1 -1
- package/lib/utils/{types/AriaRole.js → types.js} +0 -0
- package/lib/utils/uniqueId.js +0 -1
- package/lib-esm/AvatarPair.js +5 -6
- package/lib-esm/AvatarStack.js +11 -11
- package/lib-esm/BaseStyles.js +16 -16
- package/lib-esm/BorderBox.js +3 -5
- package/lib-esm/Box.js +2 -2
- package/lib-esm/BranchName.js +1 -1
- package/lib-esm/{Breadcrumbs.js → Breadcrumb.js} +22 -32
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/Button/ButtonClose.js +2 -2
- package/lib-esm/Button/ButtonInvisible.js +1 -1
- package/lib-esm/Button/ButtonTableList.js +1 -1
- package/lib-esm/CircleBadge.js +1 -1
- package/lib-esm/CircleOcticon.js +6 -9
- package/lib-esm/CounterLabel.js +2 -2
- package/lib-esm/Dialog.js +12 -10
- package/lib-esm/Dropdown.js +2 -2
- package/lib-esm/DropdownStyles.js +6 -6
- package/lib-esm/FilterList.js +1 -1
- package/lib-esm/Flash.js +1 -1
- package/lib-esm/Flex.js +0 -4
- package/lib-esm/Grid.js +2 -5
- package/lib-esm/Header.js +0 -1
- package/lib-esm/Label.js +2 -2
- package/lib-esm/Link.js +12 -1
- package/lib-esm/Overlay.js +38 -119
- package/lib-esm/Pagehead.js +1 -1
- package/lib-esm/Pagination/Pagination.js +2 -3
- package/lib-esm/Popover.js +3 -3
- package/lib-esm/Portal/Portal.js +12 -19
- package/lib-esm/Portal/index.js +1 -1
- package/lib-esm/Position.js +20 -45
- package/lib-esm/ProgressBar.js +1 -1
- package/lib-esm/SelectMenu/SelectMenu.js +3 -3
- package/lib-esm/SelectMenu/SelectMenuContext.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuDivider.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFilter.js +4 -4
- package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuHeader.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuItem.js +2 -2
- package/lib-esm/SelectMenu/SelectMenuList.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.js +10 -5
- package/lib-esm/SelectMenu/SelectMenuModal.js +5 -5
- package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib-esm/SelectMenu/hooks/useKeyboardNav.js +0 -2
- package/lib-esm/SideNav.js +7 -16
- package/lib-esm/StateLabel.js +4 -4
- package/lib-esm/SubNav.js +4 -7
- package/lib-esm/TabNav.js +4 -5
- package/lib-esm/TextInput.js +49 -22
- package/lib-esm/ThemeProvider.js +16 -31
- package/lib-esm/Timeline.js +24 -19
- package/lib-esm/Tooltip.js +1 -2
- package/lib-esm/UnderlineNav.js +3 -4
- package/lib-esm/behaviors/anchoredPosition.js +9 -17
- package/lib-esm/behaviors/focusTrap.js +14 -32
- package/lib-esm/behaviors/focusZone.js +148 -213
- package/lib-esm/constants.js +1 -2
- package/lib-esm/hooks/index.js +1 -2
- package/lib-esm/hooks/useAnchoredPosition.js +5 -10
- package/lib-esm/hooks/useDialog.js +1 -1
- package/lib-esm/hooks/useFocusTrap.js +8 -25
- package/lib-esm/hooks/useFocusZone.js +5 -5
- package/lib-esm/hooks/useMouseIntent.js +50 -0
- package/lib-esm/hooks/useOnEscapePress.js +10 -53
- package/lib-esm/hooks/useOnOutsideClick.js +37 -62
- package/lib-esm/hooks/useOpenAndCloseFocus.js +3 -8
- package/lib-esm/hooks/useOverlay.js +18 -9
- package/lib-esm/hooks/useSafeTimeout.js +0 -1
- package/lib-esm/index.js +10 -22
- package/lib-esm/polyfills/eventListenerSignal.js +1 -6
- package/lib-esm/stories/Button.stories.js +79 -0
- package/lib-esm/stories/Overlay.stories.js +80 -0
- package/lib-esm/stories/Portal.stories.js +72 -0
- package/lib-esm/stories/ThemeProvider.stories.js +76 -0
- package/lib-esm/stories/useAnchoredPosition.stories.js +311 -0
- package/lib-esm/stories/useFocusTrap.stories.js +234 -0
- package/lib-esm/stories/useFocusZone.stories.js +445 -0
- package/lib-esm/theme-preval.js +2057 -5148
- package/lib-esm/utils/deprecate.js +2 -3
- package/lib-esm/utils/isNumeric.js +0 -1
- package/lib-esm/utils/iterateFocusableElements.js +1 -1
- package/lib-esm/utils/test-deprecations.js +1 -1
- package/lib-esm/utils/test-matchers.js +11 -3
- package/lib-esm/utils/testing.js +6 -6
- package/lib-esm/utils/theme.js +1 -1
- package/lib-esm/utils/{test-helpers.d.ts → types.js} +0 -0
- package/lib-esm/utils/uniqueId.js +0 -1
- package/package.json +95 -103
- package/codemods/__tests__/deprecateUtilityComponents.js +0 -200
- package/codemods/__tests__/removeSystemProps.js +0 -225
- package/codemods/deprecateUtilityComponents.js +0 -111
- package/codemods/removeSystemProps.js +0 -312
- package/lib/ActionList/Divider.d.ts +0 -9
- package/lib/ActionList/Divider.js +0 -40
- package/lib/ActionList/Group.d.ts +0 -28
- package/lib/ActionList/Group.js +0 -35
- package/lib/ActionList/Header.d.ts +0 -29
- package/lib/ActionList/Header.js +0 -51
- package/lib/ActionList/Item.d.ts +0 -92
- package/lib/ActionList/Item.js +0 -288
- package/lib/ActionList/List.d.ts +0 -88
- package/lib/ActionList/List.js +0 -199
- package/lib/ActionList/index.d.ts +0 -17
- package/lib/ActionList/index.js +0 -29
- package/lib/ActionMenu.d.ts +0 -40
- package/lib/ActionMenu.js +0 -103
- package/lib/AnchoredOverlay/AnchoredOverlay.d.ts +0 -62
- package/lib/AnchoredOverlay/AnchoredOverlay.js +0 -124
- package/lib/AnchoredOverlay/index.d.ts +0 -2
- package/lib/AnchoredOverlay/index.js +0 -13
- package/lib/Autocomplete/Autocomplete.d.ts +0 -40
- package/lib/Autocomplete/Autocomplete.js +0 -68
- package/lib/Autocomplete/AutocompleteContext.d.ts +0 -17
- package/lib/Autocomplete/AutocompleteContext.js +0 -11
- package/lib/Autocomplete/AutocompleteInput.d.ts +0 -9
- package/lib/Autocomplete/AutocompleteInput.js +0 -150
- package/lib/Autocomplete/AutocompleteMenu.d.ts +0 -71
- package/lib/Autocomplete/AutocompleteMenu.js +0 -223
- package/lib/Autocomplete/AutocompleteOverlay.d.ts +0 -17
- package/lib/Autocomplete/AutocompleteOverlay.js +0 -69
- package/lib/Autocomplete/index.d.ts +0 -2
- package/lib/Autocomplete/index.js +0 -15
- package/lib/Avatar.d.ts +0 -15
- package/lib/AvatarPair.d.ts +0 -8
- package/lib/AvatarStack.d.ts +0 -8
- package/lib/BaseStyles.d.ts +0 -14
- package/lib/BorderBox.d.ts +0 -7
- package/lib/Box.d.ts +0 -6
- package/lib/BranchName.d.ts +0 -6
- package/lib/Breadcrumbs.d.ts +0 -40
- package/lib/Button/Button.d.ts +0 -284
- package/lib/Button/ButtonBase.d.ts +0 -12
- package/lib/Button/ButtonClose.d.ts +0 -321
- package/lib/Button/ButtonDanger.d.ts +0 -284
- package/lib/Button/ButtonGroup.d.ts +0 -4
- package/lib/Button/ButtonInvisible.d.ts +0 -284
- package/lib/Button/ButtonOutline.d.ts +0 -284
- package/lib/Button/ButtonPrimary.d.ts +0 -284
- package/lib/Button/ButtonStyles.d.ts +0 -2
- package/lib/Button/ButtonTableList.d.ts +0 -6
- package/lib/Button/index.d.ts +0 -16
- package/lib/Caret.d.ts +0 -21
- package/lib/CircleBadge.d.ts +0 -25
- package/lib/CircleOcticon.d.ts +0 -391
- package/lib/CounterLabel.d.ts +0 -8
- package/lib/Details.d.ts +0 -6
- package/lib/Dialog/ConfirmationDialog.d.ts +0 -44
- package/lib/Dialog/ConfirmationDialog.js +0 -191
- package/lib/Dialog/Dialog.d.ts +0 -167
- package/lib/Dialog/Dialog.js +0 -304
- package/lib/Dialog.d.ts +0 -406
- package/lib/Dropdown.d.ts +0 -1262
- package/lib/DropdownMenu/DropdownButton.d.ts +0 -323
- package/lib/DropdownMenu/DropdownButton.js +0 -31
- package/lib/DropdownMenu/DropdownMenu.d.ts +0 -43
- package/lib/DropdownMenu/DropdownMenu.js +0 -94
- package/lib/DropdownMenu/index.d.ts +0 -4
- package/lib/DropdownMenu/index.js +0 -21
- package/lib/DropdownStyles.d.ts +0 -3
- package/lib/FilterList.d.ts +0 -321
- package/lib/FilteredActionList/FilteredActionList.d.ts +0 -16
- package/lib/FilteredActionList/FilteredActionList.js +0 -137
- package/lib/FilteredActionList/index.d.ts +0 -2
- package/lib/FilteredActionList/index.js +0 -13
- package/lib/FilteredSearch.d.ts +0 -6
- package/lib/Flash.d.ts +0 -9
- package/lib/Flex.d.ts +0 -7
- package/lib/FormGroup.d.ts +0 -12
- package/lib/Grid.d.ts +0 -7
- package/lib/Header.d.ts +0 -24
- package/lib/Heading.d.ts +0 -6
- package/lib/Label.d.ts +0 -11
- package/lib/LabelGroup.d.ts +0 -6
- package/lib/Link.d.ts +0 -10
- package/lib/Overlay.d.ts +0 -63
- package/lib/Pagehead.d.ts +0 -6
- package/lib/Pagination/Pagination.d.ts +0 -24
- package/lib/Pagination/index.d.ts +0 -3
- package/lib/Pagination/model.d.ts +0 -26
- package/lib/PointerBox.d.ts +0 -11
- package/lib/Popover.d.ts +0 -21
- package/lib/Portal/Portal.d.ts +0 -25
- package/lib/Portal/index.d.ts +0 -4
- package/lib/Position.d.ts +0 -34
- package/lib/ProgressBar.d.ts +0 -21
- package/lib/SelectMenu/SelectMenu.d.ts +0 -1832
- package/lib/SelectMenu/SelectMenuContext.d.ts +0 -8
- package/lib/SelectMenu/SelectMenuDivider.d.ts +0 -6
- package/lib/SelectMenu/SelectMenuFilter.d.ts +0 -9
- package/lib/SelectMenu/SelectMenuFooter.d.ts +0 -6
- package/lib/SelectMenu/SelectMenuHeader.d.ts +0 -11
- package/lib/SelectMenu/SelectMenuItem.d.ts +0 -15
- package/lib/SelectMenu/SelectMenuList.d.ts +0 -6
- package/lib/SelectMenu/SelectMenuLoadingAnimation.d.ts +0 -7
- package/lib/SelectMenu/SelectMenuModal.d.ts +0 -15
- package/lib/SelectMenu/SelectMenuTab.d.ts +0 -14
- package/lib/SelectMenu/SelectMenuTabPanel.d.ts +0 -13
- package/lib/SelectMenu/SelectMenuTabs.d.ts +0 -11
- package/lib/SelectMenu/hooks/useKeyboardNav.d.ts +0 -2
- package/lib/SelectMenu/index.d.ts +0 -2
- package/lib/SelectPanel/SelectPanel.d.ts +0 -25
- package/lib/SelectPanel/SelectPanel.js +0 -147
- package/lib/SelectPanel/index.d.ts +0 -2
- package/lib/SelectPanel/index.js +0 -13
- package/lib/SideNav.d.ts +0 -31
- package/lib/Spinner.d.ts +0 -17
- package/lib/Spinner.js +0 -60
- package/lib/StateLabel.d.ts +0 -16
- package/lib/StyledOcticon.d.ts +0 -12
- package/lib/SubNav.d.ts +0 -32
- package/lib/TabNav.d.ts +0 -20
- package/lib/Text.d.ts +0 -6
- package/lib/TextInput.d.ts +0 -14
- package/lib/TextInputWithTokens.d.ts +0 -323
- package/lib/TextInputWithTokens.js +0 -244
- package/lib/ThemeProvider.d.ts +0 -26
- package/lib/Timeline.d.ts +0 -407
- package/lib/Token/IssueLabelToken.d.ts +0 -14
- package/lib/Token/IssueLabelToken.js +0 -144
- package/lib/Token/ProfileToken.d.ts +0 -7
- package/lib/Token/ProfileToken.js +0 -53
- package/lib/Token/Token.d.ts +0 -15
- package/lib/Token/Token.js +0 -94
- package/lib/Token/TokenBase.d.ts +0 -17
- package/lib/Token/TokenBase.js +0 -108
- package/lib/Token/_RemoveTokenButton.d.ts +0 -12
- package/lib/Token/_RemoveTokenButton.js +0 -77
- package/lib/Token/_TokenTextContainer.d.ts +0 -3
- package/lib/Token/_TokenTextContainer.js +0 -28
- package/lib/Token/index.d.ts +0 -3
- package/lib/Token/index.js +0 -31
- package/lib/Tooltip.d.ts +0 -18
- package/lib/Truncate.d.ts +0 -11
- package/lib/UnderlineNav.d.ts +0 -25
- package/lib/_TextInputWrapper.d.ts +0 -10
- package/lib/_TextInputWrapper.js +0 -51
- package/lib/_UnstyledTextInput.d.ts +0 -2
- package/lib/_UnstyledTextInput.js +0 -20
- package/lib/behaviors/anchoredPosition.d.ts +0 -89
- package/lib/behaviors/focusTrap.d.ts +0 -12
- package/lib/behaviors/focusZone.d.ts +0 -137
- package/lib/constants.d.ts +0 -20
- package/lib/hooks/index.d.ts +0 -11
- package/lib/hooks/useAnchoredPosition.d.ts +0 -20
- package/lib/hooks/useCombinedRefs.d.ts +0 -10
- package/lib/hooks/useCombinedRefs.js +0 -49
- package/lib/hooks/useDetails.d.ts +0 -17
- package/lib/hooks/useDialog.d.ts +0 -16
- package/lib/hooks/useFocusTrap.d.ts +0 -32
- package/lib/hooks/useFocusZone.d.ts +0 -23
- package/lib/hooks/useOnEscapePress.d.ts +0 -23
- package/lib/hooks/useOnOutsideClick.d.ts +0 -8
- package/lib/hooks/useOpenAndCloseFocus.d.ts +0 -8
- package/lib/hooks/useOverlay.d.ts +0 -15
- package/lib/hooks/useProvidedRefOrCreate.d.ts +0 -10
- package/lib/hooks/useProvidedStateOrCreate.d.ts +0 -10
- package/lib/hooks/useProvidedStateOrCreate.js +0 -27
- package/lib/hooks/useRenderForcingRef.d.ts +0 -8
- package/lib/hooks/useRenderForcingRef.js +0 -25
- package/lib/hooks/useResizeObserver.d.ts +0 -1
- package/lib/hooks/useResizeObserver.js +0 -20
- package/lib/hooks/useSafeTimeout.d.ts +0 -12
- package/lib/hooks/useScrollFlash.d.ts +0 -6
- package/lib/hooks/useScrollFlash.js +0 -29
- package/lib/index.d.ts +0 -114
- package/lib/polyfills/eventListenerSignal.d.ts +0 -6
- package/lib/sx.d.ts +0 -6
- package/lib/theme-preval.d.ts +0 -49
- package/lib/theme.d.ts +0 -2
- package/lib/utils/deprecate.d.ts +0 -18
- package/lib/utils/isNumeric.d.ts +0 -1
- package/lib/utils/iterateFocusableElements.d.ts +0 -42
- package/lib/utils/scrollIntoViewingArea.d.ts +0 -1
- package/lib/utils/scrollIntoViewingArea.js +0 -39
- package/lib/utils/ssr.d.ts +0 -1
- package/lib/utils/ssr.js +0 -19
- package/lib/utils/test-deprecations.d.ts +0 -1
- package/lib/utils/test-helpers.d.ts +0 -0
- package/lib/utils/test-helpers.js +0 -9
- package/lib/utils/test-matchers.d.ts +0 -1
- package/lib/utils/testing.d.ts +0 -1028
- package/lib/utils/theme.d.ts +0 -9
- package/lib/utils/types/AriaRole.d.ts +0 -4
- package/lib/utils/types/ComponentProps.d.ts +0 -9
- package/lib/utils/types/ComponentProps.js +0 -1
- package/lib/utils/types/Flatten.d.ts +0 -4
- package/lib/utils/types/Flatten.js +0 -1
- package/lib/utils/types/Merge.d.ts +0 -19
- package/lib/utils/types/Merge.js +0 -1
- package/lib/utils/types/index.d.ts +0 -4
- package/lib/utils/types/index.js +0 -57
- package/lib/utils/uniqueId.d.ts +0 -1
- package/lib/utils/userAgent.d.ts +0 -1
- package/lib-esm/ActionList/Divider.d.ts +0 -9
- package/lib-esm/ActionList/Divider.js +0 -23
- package/lib-esm/ActionList/Group.d.ts +0 -28
- package/lib-esm/ActionList/Group.js +0 -24
- package/lib-esm/ActionList/Header.d.ts +0 -29
- package/lib-esm/ActionList/Header.js +0 -33
- package/lib-esm/ActionList/Item.d.ts +0 -92
- package/lib-esm/ActionList/Item.js +0 -253
- package/lib-esm/ActionList/List.d.ts +0 -88
- package/lib-esm/ActionList/List.js +0 -181
- package/lib-esm/ActionList/index.d.ts +0 -17
- package/lib-esm/ActionList/index.js +0 -18
- package/lib-esm/ActionMenu.d.ts +0 -40
- package/lib-esm/ActionMenu.js +0 -82
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.d.ts +0 -62
- package/lib-esm/AnchoredOverlay/AnchoredOverlay.js +0 -104
- package/lib-esm/AnchoredOverlay/index.d.ts +0 -2
- package/lib-esm/AnchoredOverlay/index.js +0 -1
- package/lib-esm/Autocomplete/Autocomplete.d.ts +0 -40
- package/lib-esm/Autocomplete/Autocomplete.js +0 -47
- package/lib-esm/Autocomplete/AutocompleteContext.d.ts +0 -17
- package/lib-esm/Autocomplete/AutocompleteContext.js +0 -2
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +0 -9
- package/lib-esm/Autocomplete/AutocompleteInput.js +0 -131
- package/lib-esm/Autocomplete/AutocompleteMenu.d.ts +0 -71
- package/lib-esm/Autocomplete/AutocompleteMenu.js +0 -204
- package/lib-esm/Autocomplete/AutocompleteOverlay.d.ts +0 -17
- package/lib-esm/Autocomplete/AutocompleteOverlay.js +0 -51
- package/lib-esm/Autocomplete/index.d.ts +0 -2
- package/lib-esm/Autocomplete/index.js +0 -1
- package/lib-esm/Avatar.d.ts +0 -15
- package/lib-esm/AvatarPair.d.ts +0 -8
- package/lib-esm/AvatarStack.d.ts +0 -8
- package/lib-esm/BaseStyles.d.ts +0 -14
- package/lib-esm/BorderBox.d.ts +0 -7
- package/lib-esm/Box.d.ts +0 -6
- package/lib-esm/BranchName.d.ts +0 -6
- package/lib-esm/Breadcrumbs.d.ts +0 -40
- package/lib-esm/Button/Button.d.ts +0 -284
- package/lib-esm/Button/ButtonBase.d.ts +0 -12
- package/lib-esm/Button/ButtonClose.d.ts +0 -321
- package/lib-esm/Button/ButtonDanger.d.ts +0 -284
- package/lib-esm/Button/ButtonGroup.d.ts +0 -4
- package/lib-esm/Button/ButtonInvisible.d.ts +0 -284
- package/lib-esm/Button/ButtonOutline.d.ts +0 -284
- package/lib-esm/Button/ButtonPrimary.d.ts +0 -284
- package/lib-esm/Button/ButtonStyles.d.ts +0 -2
- package/lib-esm/Button/ButtonTableList.d.ts +0 -6
- package/lib-esm/Button/index.d.ts +0 -16
- package/lib-esm/Caret.d.ts +0 -21
- package/lib-esm/CircleBadge.d.ts +0 -25
- package/lib-esm/CircleOcticon.d.ts +0 -391
- package/lib-esm/CounterLabel.d.ts +0 -8
- package/lib-esm/Details.d.ts +0 -6
- package/lib-esm/Dialog/ConfirmationDialog.d.ts +0 -44
- package/lib-esm/Dialog/ConfirmationDialog.js +0 -169
- package/lib-esm/Dialog/Dialog.d.ts +0 -167
- package/lib-esm/Dialog/Dialog.js +0 -274
- package/lib-esm/Dialog.d.ts +0 -406
- package/lib-esm/Dropdown.d.ts +0 -1262
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +0 -323
- package/lib-esm/DropdownMenu/DropdownButton.js +0 -16
- package/lib-esm/DropdownMenu/DropdownMenu.d.ts +0 -43
- package/lib-esm/DropdownMenu/DropdownMenu.js +0 -77
- package/lib-esm/DropdownMenu/index.d.ts +0 -4
- package/lib-esm/DropdownMenu/index.js +0 -2
- package/lib-esm/DropdownStyles.d.ts +0 -3
- package/lib-esm/FilterList.d.ts +0 -321
- package/lib-esm/FilteredActionList/FilteredActionList.d.ts +0 -16
- package/lib-esm/FilteredActionList/FilteredActionList.js +0 -109
- package/lib-esm/FilteredActionList/index.d.ts +0 -2
- package/lib-esm/FilteredActionList/index.js +0 -1
- package/lib-esm/FilteredSearch.d.ts +0 -6
- package/lib-esm/Flash.d.ts +0 -9
- package/lib-esm/Flex.d.ts +0 -7
- package/lib-esm/FormGroup.d.ts +0 -12
- package/lib-esm/Grid.d.ts +0 -7
- package/lib-esm/Header.d.ts +0 -24
- package/lib-esm/Heading.d.ts +0 -6
- package/lib-esm/Label.d.ts +0 -11
- package/lib-esm/LabelGroup.d.ts +0 -6
- package/lib-esm/Link.d.ts +0 -10
- package/lib-esm/Overlay.d.ts +0 -63
- package/lib-esm/Pagehead.d.ts +0 -6
- package/lib-esm/Pagination/Pagination.d.ts +0 -24
- package/lib-esm/Pagination/index.d.ts +0 -3
- package/lib-esm/Pagination/model.d.ts +0 -26
- package/lib-esm/PointerBox.d.ts +0 -11
- package/lib-esm/Popover.d.ts +0 -21
- package/lib-esm/Portal/Portal.d.ts +0 -25
- package/lib-esm/Portal/index.d.ts +0 -4
- package/lib-esm/Position.d.ts +0 -34
- package/lib-esm/ProgressBar.d.ts +0 -21
- package/lib-esm/SelectMenu/SelectMenu.d.ts +0 -1832
- package/lib-esm/SelectMenu/SelectMenuContext.d.ts +0 -8
- package/lib-esm/SelectMenu/SelectMenuDivider.d.ts +0 -6
- package/lib-esm/SelectMenu/SelectMenuFilter.d.ts +0 -9
- package/lib-esm/SelectMenu/SelectMenuFooter.d.ts +0 -6
- package/lib-esm/SelectMenu/SelectMenuHeader.d.ts +0 -11
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +0 -15
- package/lib-esm/SelectMenu/SelectMenuList.d.ts +0 -6
- package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.d.ts +0 -7
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +0 -15
- package/lib-esm/SelectMenu/SelectMenuTab.d.ts +0 -14
- package/lib-esm/SelectMenu/SelectMenuTabPanel.d.ts +0 -13
- package/lib-esm/SelectMenu/SelectMenuTabs.d.ts +0 -11
- package/lib-esm/SelectMenu/hooks/useKeyboardNav.d.ts +0 -2
- package/lib-esm/SelectMenu/index.d.ts +0 -2
- package/lib-esm/SelectPanel/SelectPanel.d.ts +0 -25
- package/lib-esm/SelectPanel/SelectPanel.js +0 -127
- package/lib-esm/SelectPanel/index.d.ts +0 -2
- package/lib-esm/SelectPanel/index.js +0 -1
- package/lib-esm/SideNav.d.ts +0 -31
- package/lib-esm/Spinner.d.ts +0 -17
- package/lib-esm/Spinner.js +0 -46
- package/lib-esm/StateLabel.d.ts +0 -16
- package/lib-esm/StyledOcticon.d.ts +0 -12
- package/lib-esm/SubNav.d.ts +0 -32
- package/lib-esm/TabNav.d.ts +0 -20
- package/lib-esm/Text.d.ts +0 -6
- package/lib-esm/TextInput.d.ts +0 -14
- package/lib-esm/TextInputWithTokens.d.ts +0 -323
- package/lib-esm/TextInputWithTokens.js +0 -219
- package/lib-esm/ThemeProvider.d.ts +0 -26
- package/lib-esm/Timeline.d.ts +0 -407
- package/lib-esm/Token/IssueLabelToken.d.ts +0 -14
- package/lib-esm/Token/IssueLabelToken.js +0 -124
- package/lib-esm/Token/ProfileToken.d.ts +0 -7
- package/lib-esm/Token/ProfileToken.js +0 -33
- package/lib-esm/Token/Token.d.ts +0 -15
- package/lib-esm/Token/Token.js +0 -73
- package/lib-esm/Token/TokenBase.d.ts +0 -17
- package/lib-esm/Token/TokenBase.js +0 -87
- package/lib-esm/Token/_RemoveTokenButton.d.ts +0 -12
- package/lib-esm/Token/_RemoveTokenButton.js +0 -60
- package/lib-esm/Token/_TokenTextContainer.d.ts +0 -3
- package/lib-esm/Token/_TokenTextContainer.js +0 -15
- package/lib-esm/Token/index.d.ts +0 -3
- package/lib-esm/Token/index.js +0 -3
- package/lib-esm/Tooltip.d.ts +0 -18
- package/lib-esm/Truncate.d.ts +0 -11
- package/lib-esm/UnderlineNav.d.ts +0 -25
- package/lib-esm/_TextInputWrapper.d.ts +0 -10
- package/lib-esm/_TextInputWrapper.js +0 -31
- package/lib-esm/_UnstyledTextInput.d.ts +0 -2
- package/lib-esm/_UnstyledTextInput.js +0 -7
- package/lib-esm/behaviors/anchoredPosition.d.ts +0 -89
- package/lib-esm/behaviors/focusTrap.d.ts +0 -12
- package/lib-esm/behaviors/focusZone.d.ts +0 -137
- package/lib-esm/constants.d.ts +0 -20
- package/lib-esm/hooks/index.d.ts +0 -11
- package/lib-esm/hooks/useAnchoredPosition.d.ts +0 -20
- package/lib-esm/hooks/useCombinedRefs.d.ts +0 -10
- package/lib-esm/hooks/useCombinedRefs.js +0 -36
- package/lib-esm/hooks/useDetails.d.ts +0 -17
- package/lib-esm/hooks/useDialog.d.ts +0 -16
- package/lib-esm/hooks/useFocusTrap.d.ts +0 -32
- package/lib-esm/hooks/useFocusZone.d.ts +0 -23
- package/lib-esm/hooks/useOnEscapePress.d.ts +0 -23
- package/lib-esm/hooks/useOnOutsideClick.d.ts +0 -8
- package/lib-esm/hooks/useOpenAndCloseFocus.d.ts +0 -8
- package/lib-esm/hooks/useOverlay.d.ts +0 -15
- package/lib-esm/hooks/useProvidedRefOrCreate.d.ts +0 -10
- package/lib-esm/hooks/useProvidedStateOrCreate.d.ts +0 -10
- package/lib-esm/hooks/useProvidedStateOrCreate.js +0 -20
- package/lib-esm/hooks/useRenderForcingRef.d.ts +0 -8
- package/lib-esm/hooks/useRenderForcingRef.js +0 -18
- package/lib-esm/hooks/useResizeObserver.d.ts +0 -1
- package/lib-esm/hooks/useResizeObserver.js +0 -10
- package/lib-esm/hooks/useSafeTimeout.d.ts +0 -12
- package/lib-esm/hooks/useScrollFlash.d.ts +0 -6
- package/lib-esm/hooks/useScrollFlash.js +0 -22
- package/lib-esm/index.d.ts +0 -114
- package/lib-esm/polyfills/eventListenerSignal.d.ts +0 -6
- package/lib-esm/sx.d.ts +0 -6
- package/lib-esm/theme-preval.d.ts +0 -49
- package/lib-esm/theme.d.ts +0 -2
- package/lib-esm/utils/deprecate.d.ts +0 -18
- package/lib-esm/utils/isNumeric.d.ts +0 -1
- package/lib-esm/utils/iterateFocusableElements.d.ts +0 -42
- package/lib-esm/utils/scrollIntoViewingArea.d.ts +0 -1
- package/lib-esm/utils/scrollIntoViewingArea.js +0 -30
- package/lib-esm/utils/ssr.d.ts +0 -1
- package/lib-esm/utils/ssr.js +0 -1
- package/lib-esm/utils/test-deprecations.d.ts +0 -1
- package/lib-esm/utils/test-helpers.js +0 -7
- package/lib-esm/utils/test-matchers.d.ts +0 -1
- package/lib-esm/utils/testing.d.ts +0 -1028
- package/lib-esm/utils/theme.d.ts +0 -9
- package/lib-esm/utils/types/AriaRole.d.ts +0 -4
- package/lib-esm/utils/types/AriaRole.js +0 -1
- package/lib-esm/utils/types/ComponentProps.d.ts +0 -9
- package/lib-esm/utils/types/ComponentProps.js +0 -1
- package/lib-esm/utils/types/Flatten.d.ts +0 -4
- package/lib-esm/utils/types/Flatten.js +0 -1
- package/lib-esm/utils/types/Merge.d.ts +0 -19
- package/lib-esm/utils/types/Merge.js +0 -1
- package/lib-esm/utils/types/index.d.ts +0 -4
- package/lib-esm/utils/types/index.js +0 -4
- package/lib-esm/utils/uniqueId.d.ts +0 -1
- package/lib-esm/utils/userAgent.d.ts +0 -1
@@ -1,225 +0,0 @@
|
|
1
|
-
import {defineInlineTest} from 'jscodeshift/dist/testUtils'
|
2
|
-
import removeSystemProps from '../removeSystemProps'
|
3
|
-
|
4
|
-
defineInlineTest(
|
5
|
-
removeSystemProps,
|
6
|
-
{},
|
7
|
-
`
|
8
|
-
import {Label} from '@primer/components'
|
9
|
-
const leftMargin = 2
|
10
|
-
export default () => (
|
11
|
-
<Label mr={1} ml={leftMargin}>
|
12
|
-
<Text>hi</Text>
|
13
|
-
</Label>
|
14
|
-
)
|
15
|
-
`.trim(),
|
16
|
-
`
|
17
|
-
import {Label} from '@primer/components'
|
18
|
-
const leftMargin = 2
|
19
|
-
export default () => (
|
20
|
-
<Label sx={{mr: 1, ml: leftMargin}}>
|
21
|
-
<Text>hi</Text>
|
22
|
-
</Label>
|
23
|
-
)
|
24
|
-
`.trim(),
|
25
|
-
'removeSystemProps'
|
26
|
-
)
|
27
|
-
|
28
|
-
defineInlineTest(
|
29
|
-
removeSystemProps,
|
30
|
-
{},
|
31
|
-
`
|
32
|
-
import {Button, StyledOcticon} from '@primer/components'
|
33
|
-
import {CheckIcon, ClippyIcon} from '@primer/octicons-react'
|
34
|
-
|
35
|
-
const ClipboardCopy = ({value}) => <Button px={2}>
|
36
|
-
{copied ? (
|
37
|
-
<StyledOcticon icon={CheckIcon} color="green.5" />
|
38
|
-
) : (
|
39
|
-
<StyledOcticon icon={ClippyIcon} color="gray.5" />
|
40
|
-
)}
|
41
|
-
</Button>
|
42
|
-
|
43
|
-
`.trim(),
|
44
|
-
`
|
45
|
-
import {Button, StyledOcticon} from '@primer/components'
|
46
|
-
import {CheckIcon, ClippyIcon} from '@primer/octicons-react'
|
47
|
-
|
48
|
-
const ClipboardCopy = ({value}) => (
|
49
|
-
<Button sx={{px: 2}}>
|
50
|
-
{copied ? (
|
51
|
-
<StyledOcticon icon={CheckIcon} sx={{color: 'green.5'}} />
|
52
|
-
) : (
|
53
|
-
<StyledOcticon icon={ClippyIcon} sx={{color: 'gray.5'}} />
|
54
|
-
)}
|
55
|
-
</Button>
|
56
|
-
)`.trim(),
|
57
|
-
'removeSystemProps'
|
58
|
-
)
|
59
|
-
|
60
|
-
defineInlineTest(
|
61
|
-
removeSystemProps,
|
62
|
-
{},
|
63
|
-
`
|
64
|
-
import {Link} from '@primer/components'
|
65
|
-
const siteMetadata = {shortName: 'inline-block'}
|
66
|
-
|
67
|
-
const link = <Link
|
68
|
-
display={[
|
69
|
-
// We only hide "Primer" on small viewports if a shortName is defined.
|
70
|
-
siteMetadata.shortName ? 'none' : 'inline-block',
|
71
|
-
null,
|
72
|
-
null,
|
73
|
-
'inline-block',
|
74
|
-
]}
|
75
|
-
href="https://primer.style"
|
76
|
-
color="blue.4"
|
77
|
-
fontFamily="mono"
|
78
|
-
>
|
79
|
-
Primer
|
80
|
-
</Link>
|
81
|
-
`.trim(),
|
82
|
-
`
|
83
|
-
import {Link} from '@primer/components'
|
84
|
-
const siteMetadata = {shortName: 'inline-block'}
|
85
|
-
|
86
|
-
const link = (
|
87
|
-
<Link
|
88
|
-
href="https://primer.style"
|
89
|
-
sx={{
|
90
|
-
display: [siteMetadata.shortName ? 'none' : 'inline-block', null, null, 'inline-block'],
|
91
|
-
color: 'blue.4',
|
92
|
-
fontFamily: 'mono'
|
93
|
-
}}
|
94
|
-
>
|
95
|
-
Primer
|
96
|
-
</Link>
|
97
|
-
)`.trim(),
|
98
|
-
'removeSystemProps'
|
99
|
-
)
|
100
|
-
|
101
|
-
defineInlineTest(
|
102
|
-
removeSystemProps,
|
103
|
-
{},
|
104
|
-
`
|
105
|
-
import {Label} from '@primer/components'
|
106
|
-
const leftMargin = 2
|
107
|
-
export default () => (
|
108
|
-
<Label mr={1} ml={leftMargin} sx={{p: 1}}>
|
109
|
-
<Text>hi</Text>
|
110
|
-
</Label>
|
111
|
-
)
|
112
|
-
`.trim(),
|
113
|
-
`
|
114
|
-
import {Label} from '@primer/components'
|
115
|
-
const leftMargin = 2
|
116
|
-
export default () => (
|
117
|
-
<Label sx={{p: 1, mr: 1, ml: leftMargin}}>
|
118
|
-
<Text>hi</Text>
|
119
|
-
</Label>
|
120
|
-
)
|
121
|
-
`.trim(),
|
122
|
-
'removeSystemProps'
|
123
|
-
)
|
124
|
-
|
125
|
-
defineInlineTest(
|
126
|
-
removeSystemProps,
|
127
|
-
{},
|
128
|
-
`
|
129
|
-
import {Label} from '@primer/components'
|
130
|
-
const leftMargin = 2
|
131
|
-
export default () => (
|
132
|
-
<Label mr={1} ml={leftMargin} sx={{p:3}}>
|
133
|
-
<Text>hi</Text>
|
134
|
-
</Label>
|
135
|
-
)
|
136
|
-
`.trim(),
|
137
|
-
`
|
138
|
-
import {Label} from '@primer/components'
|
139
|
-
const leftMargin = 2
|
140
|
-
export default () => (
|
141
|
-
<Label sx={{p: 3, mr: 1, ml: leftMargin}}>
|
142
|
-
<Text>hi</Text>
|
143
|
-
</Label>
|
144
|
-
)
|
145
|
-
`.trim(),
|
146
|
-
'removeSystemProps'
|
147
|
-
)
|
148
|
-
|
149
|
-
defineInlineTest(
|
150
|
-
removeSystemProps,
|
151
|
-
{},
|
152
|
-
`
|
153
|
-
import {Label} from '@primer/components'
|
154
|
-
const leftMargin = 2
|
155
|
-
const colorProps = {backgroundColor: 'red'}
|
156
|
-
const borderProps = {borderColor: 'red'}
|
157
|
-
export default () => (
|
158
|
-
<Label mr={1} ml={leftMargin} sx={{...colorProps, ...borderProps, p:3}}>
|
159
|
-
<Text>hi</Text>
|
160
|
-
</Label>
|
161
|
-
)
|
162
|
-
`.trim(),
|
163
|
-
`
|
164
|
-
import {Label} from '@primer/components'
|
165
|
-
const leftMargin = 2
|
166
|
-
const colorProps = {backgroundColor: 'red'}
|
167
|
-
const borderProps = {borderColor: 'red'}
|
168
|
-
export default () => (
|
169
|
-
<Label sx={{...colorProps, ...borderProps, p: 3, mr: 1, ml: leftMargin}}>
|
170
|
-
<Text>hi</Text>
|
171
|
-
</Label>
|
172
|
-
)
|
173
|
-
`.trim(),
|
174
|
-
'removeSystemProps'
|
175
|
-
)
|
176
|
-
|
177
|
-
defineInlineTest(
|
178
|
-
removeSystemProps,
|
179
|
-
{},
|
180
|
-
`
|
181
|
-
import {Label} from '@primer/components'
|
182
|
-
const leftMargin = 2
|
183
|
-
export default () => (
|
184
|
-
<Label mr={1} sx={{'&:hover': {textDecoration: 'none'}}}>
|
185
|
-
<Text>hi</Text>
|
186
|
-
</Label>
|
187
|
-
)
|
188
|
-
`.trim(),
|
189
|
-
`
|
190
|
-
import {Label} from '@primer/components'
|
191
|
-
const leftMargin = 2
|
192
|
-
export default () => (
|
193
|
-
<Label sx={{'&:hover': {textDecoration: 'none'}, mr: 1}}>
|
194
|
-
<Text>hi</Text>
|
195
|
-
</Label>
|
196
|
-
)
|
197
|
-
`.trim(),
|
198
|
-
'removeSystemProps'
|
199
|
-
)
|
200
|
-
|
201
|
-
defineInlineTest(
|
202
|
-
removeSystemProps,
|
203
|
-
{},
|
204
|
-
`
|
205
|
-
import {Label} from '@primer/components'
|
206
|
-
const leftMargin = 2
|
207
|
-
const colorProps = {dark: {backgroundColor: 'red'}}
|
208
|
-
export default () => (
|
209
|
-
<Label mr={1} ml={leftMargin} sx={{...colorProps.dark, p:3}}>
|
210
|
-
<Text>hi</Text>
|
211
|
-
</Label>
|
212
|
-
)
|
213
|
-
`.trim(),
|
214
|
-
`
|
215
|
-
import {Label} from '@primer/components'
|
216
|
-
const leftMargin = 2
|
217
|
-
const colorProps = {dark: {backgroundColor: 'red'}}
|
218
|
-
export default () => (
|
219
|
-
<Label sx={{...colorProps.dark, p: 3, mr: 1, ml: leftMargin}}>
|
220
|
-
<Text>hi</Text>
|
221
|
-
</Label>
|
222
|
-
)
|
223
|
-
`.trim(),
|
224
|
-
'removeSystemProps'
|
225
|
-
)
|
@@ -1,111 +0,0 @@
|
|
1
|
-
const prettify = require('./lib/prettify')
|
2
|
-
|
3
|
-
module.exports = (file, api) => {
|
4
|
-
const j = api.jscodeshift
|
5
|
-
const ast = j(file.source)
|
6
|
-
|
7
|
-
deprecateComponents(ast, j, '@primer/components', {
|
8
|
-
Flex: {
|
9
|
-
identifier: 'Box',
|
10
|
-
attributes: {
|
11
|
-
display: 'flex'
|
12
|
-
}
|
13
|
-
},
|
14
|
-
Grid: {
|
15
|
-
identifier: 'Box',
|
16
|
-
attributes: {
|
17
|
-
display: 'grid'
|
18
|
-
}
|
19
|
-
},
|
20
|
-
Position: {
|
21
|
-
identifier: 'Box',
|
22
|
-
attributes: {}
|
23
|
-
},
|
24
|
-
Absolute: {
|
25
|
-
identifier: 'Box',
|
26
|
-
attributes: {
|
27
|
-
position: 'absolute'
|
28
|
-
}
|
29
|
-
},
|
30
|
-
Relative: {
|
31
|
-
identifier: 'Box',
|
32
|
-
attributes: {
|
33
|
-
position: 'relative'
|
34
|
-
}
|
35
|
-
},
|
36
|
-
Fixed: {
|
37
|
-
identifier: 'Box',
|
38
|
-
attributes: {
|
39
|
-
position: 'fixed'
|
40
|
-
}
|
41
|
-
},
|
42
|
-
Sticky: {
|
43
|
-
identifier: 'Box',
|
44
|
-
attributes: {
|
45
|
-
position: 'sticky'
|
46
|
-
}
|
47
|
-
},
|
48
|
-
BorderBox: {
|
49
|
-
identifier: 'Box',
|
50
|
-
attributes: {
|
51
|
-
borderWidth: '1px',
|
52
|
-
borderStyle: 'solid',
|
53
|
-
borderColor: 'border.primary',
|
54
|
-
borderRadius: 2
|
55
|
-
}
|
56
|
-
}
|
57
|
-
})
|
58
|
-
|
59
|
-
return prettify(ast, file)
|
60
|
-
}
|
61
|
-
|
62
|
-
function deprecateComponents(ast, j, importSource, importMap) {
|
63
|
-
const imports = ast.find(j.ImportDeclaration, {source: {value: importSource}})
|
64
|
-
const importsByName = {}
|
65
|
-
|
66
|
-
imports.forEach(decl => {
|
67
|
-
j(decl)
|
68
|
-
.find(j.ImportSpecifier)
|
69
|
-
.forEach(spec => {
|
70
|
-
importsByName[spec.node.imported.name] = spec
|
71
|
-
})
|
72
|
-
})
|
73
|
-
|
74
|
-
for (const [from, to] of Object.entries(importMap)) {
|
75
|
-
rewriteImport(from, to.identifier, to.attributes)
|
76
|
-
}
|
77
|
-
|
78
|
-
function rewriteImport(from, to, attributes) {
|
79
|
-
imports.forEach(decl => {
|
80
|
-
j(decl)
|
81
|
-
.find(j.ImportSpecifier, {imported: {name: from}})
|
82
|
-
.forEach(spec => {
|
83
|
-
if (importsByName[to]) {
|
84
|
-
// if the destination import already exists and there are members
|
85
|
-
// in this identifier, then this one is a dupe
|
86
|
-
j(spec).remove()
|
87
|
-
} else {
|
88
|
-
// otherwise, we can safely rename this one to the new identifier
|
89
|
-
spec.node.imported.name = to
|
90
|
-
importsByName[to] = spec
|
91
|
-
}
|
92
|
-
})
|
93
|
-
})
|
94
|
-
|
95
|
-
ast.find(j.JSXOpeningElement, {name: {name: from}}).forEach(nodePath => {
|
96
|
-
for (const [attr, value] of Object.entries(attributes || {})) {
|
97
|
-
const expression = typeof value === 'string' ? j.literal(value) : j.jsxExpressionContainer(j.literal(value))
|
98
|
-
const attrExists = nodePath.value.attributes.find(a => a?.name?.name === attr)
|
99
|
-
if (!attrExists) {
|
100
|
-
nodePath.value.attributes.push(j.jsxAttribute(j.jsxIdentifier(attr), expression))
|
101
|
-
}
|
102
|
-
}
|
103
|
-
})
|
104
|
-
|
105
|
-
// replace all of the rewritten identifiers with member expressions
|
106
|
-
ast
|
107
|
-
.find(j.Identifier, {name: from})
|
108
|
-
.filter(id => id.parent.node.type !== 'ImportSpecifier')
|
109
|
-
.replaceWith(j.jsxIdentifier(to))
|
110
|
-
}
|
111
|
-
}
|
@@ -1,312 +0,0 @@
|
|
1
|
-
const prettify = require('./lib/prettify')
|
2
|
-
|
3
|
-
const COMMON = [
|
4
|
-
'margin',
|
5
|
-
'marginTop',
|
6
|
-
'marginRight',
|
7
|
-
'marginBottom',
|
8
|
-
'marginLeft',
|
9
|
-
'marginX',
|
10
|
-
'marginY',
|
11
|
-
'm',
|
12
|
-
'mt',
|
13
|
-
'mr',
|
14
|
-
'mb',
|
15
|
-
'ml',
|
16
|
-
'mx',
|
17
|
-
'my',
|
18
|
-
'padding',
|
19
|
-
'paddingTop',
|
20
|
-
'paddingRight',
|
21
|
-
'paddingBottom',
|
22
|
-
'paddingLeft',
|
23
|
-
'paddingX',
|
24
|
-
'paddingY',
|
25
|
-
'p',
|
26
|
-
'pt',
|
27
|
-
'pr',
|
28
|
-
'pb',
|
29
|
-
'pl',
|
30
|
-
'px',
|
31
|
-
'py',
|
32
|
-
'color',
|
33
|
-
'backgroundColor',
|
34
|
-
'opacity',
|
35
|
-
'bg',
|
36
|
-
'display'
|
37
|
-
]
|
38
|
-
|
39
|
-
const TYPOGRAPHY = [
|
40
|
-
'fontFamily',
|
41
|
-
'fontSize',
|
42
|
-
'fontWeight',
|
43
|
-
'lineHeight',
|
44
|
-
'letterSpacing',
|
45
|
-
'textAlign',
|
46
|
-
'fontStyle',
|
47
|
-
'whiteSpace'
|
48
|
-
]
|
49
|
-
|
50
|
-
const BORDER = [
|
51
|
-
'border',
|
52
|
-
'borderWidth',
|
53
|
-
'borderStyle',
|
54
|
-
'borderColor',
|
55
|
-
'borderRadius',
|
56
|
-
'borderTop',
|
57
|
-
'borderTopLeftRadius',
|
58
|
-
'borderTopRightRadius',
|
59
|
-
'borderRight',
|
60
|
-
'borderBottom',
|
61
|
-
'borderBottomLeftRadius',
|
62
|
-
'borderBottomRightRadius',
|
63
|
-
'borderLeft',
|
64
|
-
'borderX',
|
65
|
-
'borderY',
|
66
|
-
'borderTopWidth',
|
67
|
-
'borderTopColor',
|
68
|
-
'borderTopStyle',
|
69
|
-
'borderBottomWidth',
|
70
|
-
'borderBottomColor',
|
71
|
-
'borderBottomStyle',
|
72
|
-
'borderLeftWidth',
|
73
|
-
'borderLeftColor',
|
74
|
-
'borderLeftStyle',
|
75
|
-
'borderRightWidth',
|
76
|
-
'borderRightColor',
|
77
|
-
'borderRightStyle',
|
78
|
-
'boxShadow',
|
79
|
-
'textShadow'
|
80
|
-
]
|
81
|
-
|
82
|
-
const LAYOUT = [
|
83
|
-
'width',
|
84
|
-
'height',
|
85
|
-
'minWidth',
|
86
|
-
'minHeight',
|
87
|
-
'maxWidth',
|
88
|
-
'maxHeight',
|
89
|
-
'size',
|
90
|
-
'overflow',
|
91
|
-
'overflowX',
|
92
|
-
'overflowY',
|
93
|
-
'display',
|
94
|
-
'verticalAlign'
|
95
|
-
]
|
96
|
-
|
97
|
-
const POSITION = ['position', 'zIndex', 'top', 'right', 'bottom', 'left']
|
98
|
-
|
99
|
-
const FLEX = [
|
100
|
-
'alignItems',
|
101
|
-
'alignContent',
|
102
|
-
'justifyItems',
|
103
|
-
'justifyContent',
|
104
|
-
'flexWrap',
|
105
|
-
'flexDirection',
|
106
|
-
'flex',
|
107
|
-
'flexGrow',
|
108
|
-
'flexShrink',
|
109
|
-
'flexBasis',
|
110
|
-
'justifySelf',
|
111
|
-
'alignSelf',
|
112
|
-
'order'
|
113
|
-
]
|
114
|
-
|
115
|
-
// const GRID = [
|
116
|
-
// 'gridGap',
|
117
|
-
// 'gridColumnGap',
|
118
|
-
// 'gridRowGap',
|
119
|
-
// 'gridColumn',
|
120
|
-
// 'gridRow',
|
121
|
-
// 'gridAutoFlow',
|
122
|
-
// 'gridAutoColumns',
|
123
|
-
// 'gridAutoRows',
|
124
|
-
// 'gridTemplateColumns',
|
125
|
-
// 'gridTemplateRows',
|
126
|
-
// 'gridTemplateAreas',
|
127
|
-
// 'gridArea'
|
128
|
-
// ]
|
129
|
-
|
130
|
-
const stylePropsMap = {
|
131
|
-
Avatar: [...COMMON],
|
132
|
-
AvatarStack: [...COMMON],
|
133
|
-
BranchName: [...COMMON],
|
134
|
-
Breadcrumb: [...COMMON, ...FLEX],
|
135
|
-
Button: [...COMMON, ...LAYOUT, ...TYPOGRAPHY],
|
136
|
-
ButtonBase: [...COMMON, ...LAYOUT],
|
137
|
-
ButtonClose: [...COMMON, ...LAYOUT],
|
138
|
-
ButtonTableList: [...COMMON, ...TYPOGRAPHY, ...LAYOUT],
|
139
|
-
CircleBadge: [...COMMON],
|
140
|
-
CounterLabel: [...COMMON],
|
141
|
-
Details: [...COMMON],
|
142
|
-
Dialog: [...LAYOUT, ...COMMON, ...POSITION],
|
143
|
-
Dropdown: [...COMMON],
|
144
|
-
FilteredSearch: [...COMMON],
|
145
|
-
FilterList: [...COMMON],
|
146
|
-
Flash: [...COMMON],
|
147
|
-
FormGroup: [...COMMON],
|
148
|
-
FormGroupLabel: [...COMMON, ...TYPOGRAPHY],
|
149
|
-
Header: [...COMMON, ...BORDER],
|
150
|
-
HeaderItem: [...COMMON, ...BORDER],
|
151
|
-
Label: [...COMMON, ...BORDER],
|
152
|
-
LabelGroup: [...COMMON],
|
153
|
-
Link: [...COMMON, ...TYPOGRAPHY],
|
154
|
-
Overlay: [...COMMON],
|
155
|
-
Pagehead: [...COMMON],
|
156
|
-
Pagination: [...COMMON],
|
157
|
-
Popover: [...COMMON, ...LAYOUT, ...POSITION],
|
158
|
-
PopoverContent: [...COMMON, ...LAYOUT, ...POSITION, ...FLEX],
|
159
|
-
SelectMenu: [...COMMON],
|
160
|
-
SelectMenuDivider: [...COMMON],
|
161
|
-
SelectMenuFilter: [...COMMON],
|
162
|
-
SelectMenuFooter: [...COMMON],
|
163
|
-
SelectMenuHeader: [...COMMON, ...TYPOGRAPHY],
|
164
|
-
SelectMenuItem: [...COMMON],
|
165
|
-
SelectMenuList: [...COMMON],
|
166
|
-
SelectMenuLoadingAnimation: [...COMMON],
|
167
|
-
SelectMenuModal: [...COMMON],
|
168
|
-
SelectMenuTab: [...COMMON],
|
169
|
-
SelectMenuTabPanel: [...COMMON],
|
170
|
-
SelectMenuTabs: [...COMMON],
|
171
|
-
SideNav: [...COMMON],
|
172
|
-
Spinner: [...COMMON],
|
173
|
-
StateLabel: [...COMMON],
|
174
|
-
StyledOcticon: [...COMMON],
|
175
|
-
SubNav: [...COMMON, ...FLEX],
|
176
|
-
TabNav: [...COMMON],
|
177
|
-
TabNavLink: [...COMMON, ...TYPOGRAPHY],
|
178
|
-
TextInput: [...COMMON],
|
179
|
-
Timeline: [...COMMON],
|
180
|
-
Tooltip: [...COMMON],
|
181
|
-
Truncate: [...TYPOGRAPHY, ...COMMON],
|
182
|
-
UnderlineNav: [...COMMON]
|
183
|
-
}
|
184
|
-
|
185
|
-
const expressionToString = expression => {
|
186
|
-
if (expression.type === 'Literal') {
|
187
|
-
const expressionValue = expression.value
|
188
|
-
return typeof expressionValue === 'string' ? `"${expressionValue}"` : expressionValue
|
189
|
-
} else if (expression.type === 'Identifier') {
|
190
|
-
return expression.name
|
191
|
-
} else if (expression.type === 'Identifier') {
|
192
|
-
return expression.name
|
193
|
-
} else if (['null', 'undefined'].includes(expression.raw)) {
|
194
|
-
return expression.raw
|
195
|
-
} else {
|
196
|
-
const start = expression.start
|
197
|
-
const end = expression.end
|
198
|
-
const toks = expression.loc.tokens.filter(token => {
|
199
|
-
return token.type !== 'CommentLine' && token.start >= start && token.end <= end
|
200
|
-
})
|
201
|
-
const vals = toks.map(tok => {
|
202
|
-
return tok.type.label === 'string' ? `"${tok.value}"` : tok.value
|
203
|
-
})
|
204
|
-
return vals.join('')
|
205
|
-
}
|
206
|
-
}
|
207
|
-
|
208
|
-
const objectToString = (object, spreads = []) => {
|
209
|
-
const values = Object.values(object)
|
210
|
-
const keys = Object.keys(object)
|
211
|
-
const duples = keys.map(function (key, i) {
|
212
|
-
return [key, values[i]]
|
213
|
-
})
|
214
|
-
const accumulator = (string, duple) => {
|
215
|
-
const expression = duple[1]
|
216
|
-
const expressionString = expressionToString(expression)
|
217
|
-
return `${string} ${duple[0]}: ${expressionString},`
|
218
|
-
}
|
219
|
-
const objString = duples.reduce(accumulator, '')
|
220
|
-
const spreadsString = spreads.map(s => `...${s},`).join('')
|
221
|
-
return `{${spreadsString}${objString}}`
|
222
|
-
}
|
223
|
-
|
224
|
-
module.exports = (file, api) => {
|
225
|
-
const j = api.jscodeshift
|
226
|
-
const ast = j(file.source)
|
227
|
-
|
228
|
-
const importsByName = {}
|
229
|
-
|
230
|
-
ast
|
231
|
-
.find(j.ImportDeclaration, decl => decl.source.value.includes('@primer/components'))
|
232
|
-
.forEach(decl => {
|
233
|
-
j(decl)
|
234
|
-
.find(j.ImportSpecifier)
|
235
|
-
.forEach(spec => {
|
236
|
-
importsByName[spec.node.imported.name] = spec.node.local.name
|
237
|
-
})
|
238
|
-
})
|
239
|
-
|
240
|
-
ast
|
241
|
-
.find(j.JSXElement, {
|
242
|
-
openingElement: {
|
243
|
-
name: {
|
244
|
-
name: name => {
|
245
|
-
return name in stylePropsMap
|
246
|
-
}
|
247
|
-
}
|
248
|
-
}
|
249
|
-
})
|
250
|
-
.forEach(el => {
|
251
|
-
const sx = {}
|
252
|
-
const elementName = el.value?.openingElement?.name?.name
|
253
|
-
const elementNameScrubbed = elementName.replace('.', '')
|
254
|
-
const systemProps = stylePropsMap[elementNameScrubbed]
|
255
|
-
const attrNodes = j(el).find(j.JSXAttribute, {
|
256
|
-
name: name => {
|
257
|
-
const isInElement = name.start >= el.node.start && name.end <= el.value.openingElement.end
|
258
|
-
return systemProps && systemProps.includes(name.name) && isInElement
|
259
|
-
}
|
260
|
-
})
|
261
|
-
|
262
|
-
const sxNodes = j(el).find(j.JSXAttribute, {
|
263
|
-
name: name => {
|
264
|
-
const isInElement = name.start >= el.node.start && name.end <= el.value.openingElement.end
|
265
|
-
return name.name === 'sx' && isInElement
|
266
|
-
}
|
267
|
-
})
|
268
|
-
|
269
|
-
const existingSx = {}
|
270
|
-
const sxNodesArray = sxNodes.nodes() || []
|
271
|
-
const existingSxProps = sxNodesArray[0]?.value?.expression?.properties
|
272
|
-
existingSxProps &&
|
273
|
-
existingSxProps.forEach(p => {
|
274
|
-
const keyName = p?.key?.name
|
275
|
-
const keyValue = p?.key?.raw
|
276
|
-
if (!keyName && !keyValue) {
|
277
|
-
return
|
278
|
-
}
|
279
|
-
existingSx[keyName || keyValue] = p.value
|
280
|
-
})
|
281
|
-
const spreads =
|
282
|
-
existingSxProps &&
|
283
|
-
existingSxProps
|
284
|
-
.filter(p => p.type === 'SpreadElement')
|
285
|
-
.map(s => {
|
286
|
-
const argName = s?.argument?.name
|
287
|
-
const propName = s?.argument?.property?.name
|
288
|
-
const objectName = s?.argument?.object?.name
|
289
|
-
return argName || `${objectName}.${propName}`
|
290
|
-
})
|
291
|
-
|
292
|
-
attrNodes.forEach((attr, index) => {
|
293
|
-
const key = attr?.value?.name?.name
|
294
|
-
const literal = attr?.value?.value
|
295
|
-
const val = literal.type === 'JSXExpressionContainer' ? literal.expression : literal
|
296
|
-
if (key && val) {
|
297
|
-
sx[key] = val
|
298
|
-
}
|
299
|
-
if (index + 1 !== attrNodes.length) {
|
300
|
-
attr.prune()
|
301
|
-
} else {
|
302
|
-
const keys = Object.keys(sx)
|
303
|
-
if (keys.length > 0) {
|
304
|
-
sxNodes.forEach(node => node.prune())
|
305
|
-
j(attr).replaceWith(`sx={${objectToString({...existingSx, ...sx}, spreads)}}`)
|
306
|
-
}
|
307
|
-
}
|
308
|
-
})
|
309
|
-
})
|
310
|
-
|
311
|
-
return prettify(ast, file)
|
312
|
-
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
export declare const StyledDivider: import("styled-components").StyledComponent<"div", any, {}, never>;
|
3
|
-
/**
|
4
|
-
* Visually separates `Item`s or `Group`s in an `ActionList`.
|
5
|
-
*/
|
6
|
-
export declare function Divider(): JSX.Element;
|
7
|
-
export declare namespace Divider {
|
8
|
-
var renderItem: typeof Divider;
|
9
|
-
}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Divider = Divider;
|
7
|
-
exports.StyledDivider = void 0;
|
8
|
-
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
10
|
-
|
11
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
12
|
-
|
13
|
-
var _constants = require("../constants");
|
14
|
-
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
|
-
|
17
|
-
const StyledDivider = _styledComponents.default.div.withConfig({
|
18
|
-
displayName: "Divider__StyledDivider",
|
19
|
-
componentId: "sc-42656i-0"
|
20
|
-
})(["height:1px;background:", ";margin-top:calc(", " - 1px);margin-bottom:", ";"], (0, _constants.get)('colors.border.muted'), (0, _constants.get)('space.2'), (0, _constants.get)('space.2'));
|
21
|
-
/**
|
22
|
-
* Visually separates `Item`s or `Group`s in an `ActionList`.
|
23
|
-
*/
|
24
|
-
|
25
|
-
|
26
|
-
exports.StyledDivider = StyledDivider;
|
27
|
-
|
28
|
-
function Divider() {
|
29
|
-
return /*#__PURE__*/_react.default.createElement(StyledDivider, null);
|
30
|
-
}
|
31
|
-
|
32
|
-
Divider.displayName = "Divider";
|
33
|
-
|
34
|
-
/**
|
35
|
-
* `Divider` fulfills the `ItemPropsWithCustomRenderer` contract,
|
36
|
-
* so it can be used inline in an `ActionList`’s `items` prop.
|
37
|
-
* In other words, `items={[ActionList.Divider]}` is supported as a concise
|
38
|
-
* alternative to `items={[{renderItem: () => <ActionList.Divider />}]}`.
|
39
|
-
*/
|
40
|
-
Divider.renderItem = Divider;
|