Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DropdownButton and DropdownMenu from deprecated and update the usages across #3544

Merged
merged 4 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/nine-news-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@primer/react': major
---

Remove `DropdownButton` and `DropdownMenu` from deprecated and update the usages across

<!-- Changed components: SelectPanel, ActionList -->
2 changes: 1 addition & 1 deletion docs/content/deprecated/ActionList.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ status: Deprecated
source: https://github.com/primer/react/tree/main/src/deprecated/ActionList
---

An `ActionList` is a list of items which can be activated or selected. `ActionList` is the base component for many of our menu-type components, including `DropdownMenu` and `ActionMenu`.
An `ActionList` is a list of items which can be activated or selected. `ActionList` is the base component for many of our menu-type components, including and `ActionMenu`.

## Deprecation

Expand Down
127 changes: 0 additions & 127 deletions docs/content/deprecated/DropdownMenu.mdx

This file was deleted.

2 changes: 0 additions & 2 deletions docs/src/@primer/gatsby-theme-doctocat/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@
url: /deprecated/ActionMenu
- title: Buttons (legacy)
url: /deprecated/Buttons
- title: DropdownMenu
url: /deprecated/DropdownMenu
- title: FilteredSearch
url: /deprecated/FilteredSearch
- title: FilterList
Expand Down
2 changes: 1 addition & 1 deletion src/ActionList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const Item = React.forwardRef<HTMLLIElement, ActionListItemProps>(

/** Infer item role based on the container */
let itemRole: ActionListItemProps['role']
if (container === 'ActionMenu' || container === 'DropdownMenu') {
if (container === 'ActionMenu') {
if (selectionVariant === 'single') itemRole = 'menuitemradio'
else if (selectionVariant === 'multiple') itemRole = 'menuitemcheckbox'
else itemRole = 'menuitem'
Expand Down
13 changes: 10 additions & 3 deletions src/SelectPanel/SelectPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {SearchIcon} from '@primer/octicons-react'
import {SearchIcon, TriangleDownIcon} from '@primer/octicons-react'
import React, {useCallback, useMemo} from 'react'
import {AnchoredOverlay, AnchoredOverlayProps} from '../AnchoredOverlay'
import {AnchoredOverlayWrapperAnchorProps} from '../AnchoredOverlay/AnchoredOverlay'
Expand All @@ -9,7 +9,7 @@ import {OverlayProps} from '../Overlay'
import {TextInputProps} from '../TextInput'
import {ItemProps} from '../deprecated/ActionList'
import {ItemInput} from '../deprecated/ActionList/List'
import {DropdownButton} from '../deprecated/DropdownMenu'
import {Button} from '../Button'
import {useProvidedRefOrCreate} from '../hooks'
import {FocusZoneHookSettings} from '../hooks/useFocusZone'
import {useId} from '../hooks/useId'
Expand Down Expand Up @@ -60,7 +60,14 @@ const focusZoneSettings: Partial<FocusZoneHookSettings> = {
export function SelectPanel({
open,
onOpenChange,
renderAnchor = props => <DropdownButton {...props} />,
renderAnchor = props => {
const {children, ...rest} = props
return (
<Button trailingAction={TriangleDownIcon} {...rest}>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshblack I think we can add this usage to the v36 discussion as an alternative to the removed DropdownButton ?

{children}
</Button>
)
},
anchorRef: externalAnchorRef,
placeholder,
placeholderText = 'Filter items',
Expand Down
Loading