Skip to content

Commit

Permalink
Remove DropdownButton and DropdownMenu from deprecated and update…
Browse files Browse the repository at this point in the history
… the usages across (#3544)

* Remove DropdownMenu and DropdownButton and update usages across

* copy ts expect from main and add changeset

* clean up

* unused ts expect
  • Loading branch information
broccolinisoup committed Jul 20, 2023
1 parent 8f7186a commit 134f265
Show file tree
Hide file tree
Showing 16 changed files with 248 additions and 633 deletions.
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}>
{children}
</Button>
)
},
anchorRef: externalAnchorRef,
placeholder,
placeholderText = 'Filter items',
Expand Down
Loading

0 comments on commit 134f265

Please sign in to comment.