Skip to content

Commit

Permalink
Merge branch 'next-major' into mp/rm-warning-status
Browse files Browse the repository at this point in the history
  • Loading branch information
mperrotti authored Jun 19, 2023
2 parents e2518be + 318f9d6 commit 3de26ce
Show file tree
Hide file tree
Showing 24 changed files with 136 additions and 112 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-dancers-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Deprecates FilterList and FilteredSearch components
9 changes: 6 additions & 3 deletions docs/content/FilterList.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
---
componentId: filter_list
title: FilterList
status: Alpha
status: Deprecated
description: The FilterList component is a menu with filter options that filter the main content of the page.
---

import data from '../../src/FilterList/FilterList.docs.json'
import data from '../../src/deprecated/FilterList/FilterList.docs.json'

The FilterList component is a menu with filter options that filter the main content of the page.
## Deprecation

Use [ActionList](/ActionList) instead.

## Examples

Expand Down
13 changes: 9 additions & 4 deletions docs/content/FilteredSearch.mdx
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
---
componentId: filtered_search
title: FilteredSearch
status: Alpha
status: Deprecated
description: The FilteredSearch component helps style an ActionMenu and a TextInput side-by-side.
---

import data from '../../src/FilteredSearch/FilteredSearch.docs.json'

The FilteredSearch component helps style an ActionMenu and a TextInput side-by-side.
import data from '../../src/deprecated/FilteredSearch/FilteredSearch.docs.json'

**Note:** You _must_ use a `TextInput` and `ActionMenu` (or native `<details>` and `<summary>`) in order for this component to work properly.

## Deprecation

A new filter component is in progress.

Until the new filter component is ready, you can use Button + TextInput + ActionList to reproduce this pattern.

## Examples

```jsx live
Expand Down
8 changes: 4 additions & 4 deletions docs/src/@primer/gatsby-theme-doctocat/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@
url: /Details
- title: Dialog
url: /Dialog
- title: FilteredSearch
url: /FilteredSearch
- title: FilterList
url: /FilterList
- title: Flash
url: /Flash
- title: FormControl
Expand Down Expand Up @@ -190,6 +186,10 @@
url: /deprecated/Dropdown
- title: DropdownMenu
url: /deprecated/DropdownMenu
- title: FilteredSearch
url: /deprecated/FilteredSearch
- title: FilterList
url: /deprecated/FilterList
- title: Flex
url: /deprecated/Flex
- title: FormGroup
Expand Down
148 changes: 74 additions & 74 deletions generated/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -1641,80 +1641,6 @@
],
"subcomponents": []
},
"filter_list": {
"id": "filter_list",
"name": "FilterList",
"status": "alpha",
"a11yReviewed": false,
"stories": [
{
"id": "components-filterlist--default",
"code": "() => {\n const [selectedIndex, setSelectedIndex] = useState(0)\n return (\n <FilterList>\n <FilterList.Item\n selected={selectedIndex === 0}\n onClick={() => setSelectedIndex(0)}\n count={32}\n >\n First Filter\n </FilterList.Item>\n <FilterList.Item\n selected={selectedIndex === 1}\n onClick={() => setSelectedIndex(1)}\n count={16}\n >\n Second Filter\n </FilterList.Item>\n <FilterList.Item\n selected={selectedIndex === 2}\n onClick={() => setSelectedIndex(2)}\n >\n Third Filter\n </FilterList.Item>\n </FilterList>\n )\n}"
}
],
"props": [
{
"name": "sx",
"type": "SystemStyleObject"
}
],
"subcomponents": [
{
"name": "FilterList.Item",
"props": [
{
"name": "count",
"type": "number",
"description": "Number to be displayed in the list item"
},
{
"name": "selected",
"type": "boolean",
"description": "Whether the list item is selected or not"
},
{
"name": "small",
"type": "boolean",
"defaultValue": "false",
"description": "Whether the list item is small or not"
},
{
"name": "as",
"type": "React.ElementType",
"defaultValue": "'a'"
},
{
"name": "sx",
"type": "SystemStyleObject"
}
]
}
]
},
"filtered_search": {
"id": "filtered_search",
"name": "FilteredSearch",
"status": "alpha",
"a11yReviewed": false,
"stories": [
{
"id": "components-filteredsearch--default",
"code": "() => (\n <FilteredSearch>\n <ActionMenu>\n <ActionMenu.Button as=\"summary\">Filter</ActionMenu.Button>\n <ActionMenu.Overlay>\n <ActionList>\n <ActionList.Item>Item 1</ActionList.Item>\n <ActionList.Item>Item 2</ActionList.Item>\n <ActionList.Item>Item 3</ActionList.Item>\n </ActionList>\n </ActionMenu.Overlay>\n </ActionMenu>\n <TextInput aria-label=\"filtered-search\" leadingVisual={SearchIcon} />\n </FilteredSearch>\n)"
}
],
"props": [
{
"name": "children",
"type": "React.ReactNode",
"description": "FilteredSearch is expected to contain an `ActionMenu` followed by a `TextInput`."
},
{
"name": "sx",
"type": "SystemStyleObject"
}
],
"subcomponents": []
},
"flash": {
"id": "flash",
"name": "Flash",
Expand Down Expand Up @@ -5040,6 +4966,80 @@
}
]
},
"filter_list": {
"id": "filter_list",
"name": "FilterList",
"status": "deprecated",
"a11yReviewed": false,
"stories": [
{
"id": "components-filterlist--default",
"code": "() => {\n const [selectedIndex, setSelectedIndex] = useState(0)\n return (\n <FilterList>\n <FilterList.Item\n selected={selectedIndex === 0}\n onClick={() => setSelectedIndex(0)}\n count={32}\n >\n First Filter\n </FilterList.Item>\n <FilterList.Item\n selected={selectedIndex === 1}\n onClick={() => setSelectedIndex(1)}\n count={16}\n >\n Second Filter\n </FilterList.Item>\n <FilterList.Item\n selected={selectedIndex === 2}\n onClick={() => setSelectedIndex(2)}\n >\n Third Filter\n </FilterList.Item>\n </FilterList>\n )\n}"
}
],
"props": [
{
"name": "sx",
"type": "SystemStyleObject"
}
],
"subcomponents": [
{
"name": "FilterList.Item",
"props": [
{
"name": "count",
"type": "number",
"description": "Number to be displayed in the list item"
},
{
"name": "selected",
"type": "boolean",
"description": "Whether the list item is selected or not"
},
{
"name": "small",
"type": "boolean",
"defaultValue": "false",
"description": "Whether the list item is small or not"
},
{
"name": "as",
"type": "React.ElementType",
"defaultValue": "'a'"
},
{
"name": "sx",
"type": "SystemStyleObject"
}
]
}
]
},
"filtered_search": {
"id": "filtered_search",
"name": "FilteredSearch",
"status": "deprecated",
"a11yReviewed": false,
"stories": [
{
"id": "components-filteredsearch--default",
"code": "() => (\n <FilteredSearch>\n <ActionMenu>\n <ActionMenu.Button as=\"summary\">Filter</ActionMenu.Button>\n <ActionMenu.Overlay>\n <ActionList>\n <ActionList.Item>Item 1</ActionList.Item>\n <ActionList.Item>Item 2</ActionList.Item>\n <ActionList.Item>Item 3</ActionList.Item>\n </ActionList>\n </ActionMenu.Overlay>\n </ActionMenu>\n <TextInput aria-label=\"filtered-search\" leadingVisual={SearchIcon} />\n </FilteredSearch>\n)"
}
],
"props": [
{
"name": "children",
"type": "React.ReactNode",
"description": "FilteredSearch is expected to contain an `ActionMenu` followed by a `TextInput`."
},
{
"name": "sx",
"type": "SystemStyleObject"
}
],
"subcomponents": []
},
"drafts_button": {
"id": "drafts_button",
"name": "Button2",
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/__snapshots__/exports.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ exports[`@primer/react should not update exports without a semver change 1`] = `
"CounterLabel",
"Details",
"Dialog",
"FilterList",
"FilteredSearch",
"Flash",
"FormControl",
"Header",
Expand Down Expand Up @@ -117,6 +115,8 @@ exports[`@primer/react/decprecated should not update exports without a semver ch
"Dropdown",
"DropdownButton",
"DropdownMenu",
"FilterList",
"FilteredSearch",
"Fixed",
"Flex",
"FormGroup",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import {FilterList} from '..'
import {render, behavesAsComponent, checkExports} from '../utils/testing'
import {FilterList} from '../../deprecated'
import {render, behavesAsComponent, checkExports} from '../../utils/testing'
import {render as HTMLRender} from '@testing-library/react'
import {axe, toHaveNoViolations} from 'jest-axe'

Expand All @@ -9,7 +9,7 @@ expect.extend(toHaveNoViolations)
describe('FilterList', () => {
behavesAsComponent({Component: FilterList})

checkExports('FilterList', {
checkExports('deprecated/FilterList', {
default: FilterList,
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import FilterList from '../FilterList'
import FilterList from '../../deprecated/FilterList'

export function shouldAcceptCallWithNoProps() {
return <FilterList />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import {FilterList} from '..'
import {render, behavesAsComponent} from '../utils/testing'
import {FilterList} from '../../deprecated'
import {render, behavesAsComponent} from '../../utils/testing'
import {render as HTMLRender} from '@testing-library/react'
import {axe, toHaveNoViolations} from 'jest-axe'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import {FilteredSearch} from '..'
import {render, behavesAsComponent, checkExports} from '../utils/testing'
import {FilteredSearch} from '../../deprecated'
import {render, behavesAsComponent, checkExports} from '../../utils/testing'
import {render as HTMLRender} from '@testing-library/react'
import {axe, toHaveNoViolations} from 'jest-axe'

Expand All @@ -9,7 +9,7 @@ expect.extend(toHaveNoViolations)
describe('FilteredSearch', () => {
behavesAsComponent({Component: FilteredSearch})

checkExports('FilteredSearch', {
checkExports('deprecated/FilteredSearch', {
default: FilteredSearch,
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import FilteredSearch from '../FilteredSearch'
import FilteredSearch from '../../deprecated/FilteredSearch'

export function shouldAcceptCallWithNoProps() {
return <FilteredSearch />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "filter_list",
"name": "FilterList",
"status": "alpha",
"status": "deprecated",
"a11yReviewed": false,
"stories": [],
"props": [
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import styled from 'styled-components'
import {get} from '../constants'
import sx, {SxProp} from '../sx'
import {ComponentProps} from '../utils/types'
import {get} from '../../constants'
import sx, {SxProp} from '../../sx'
import {ComponentProps} from '../../utils/types'

const FilterListBase = styled.ul<SxProp>`
list-style-type: none;
Expand All @@ -13,6 +13,9 @@ const FilterListBase = styled.ul<SxProp>`

export type FilterListProps = ComponentProps<typeof FilterListBase>

/**
* @deprecated Use the ActionList component instead.
*/
const FilterList = ({children, ...rest}: React.PropsWithChildren<FilterListProps>) => {
const items = React.Children.map(children, child => {
return <li>{child}</li>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "filtered_search",
"name": "FilteredSearch",
"status": "alpha",
"status": "deprecated",
"a11yReviewed": false,
"stories": [],
"props": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import {Meta, ComponentStory} from '@storybook/react'
import FilteredSearch from './FilteredSearch'
import {ActionList} from '../ActionList'
import {ActionMenu} from '../ActionMenu'
import TextInput from '../TextInput'
import {ActionList} from '../../ActionList'
import {ActionMenu} from '../../ActionMenu'
import TextInput from '../../TextInput'
import {SearchIcon} from '@primer/octicons-react'

export default {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import styled from 'styled-components'
import {get} from '../constants'
import sx, {SxProp} from '../sx'
import {ComponentProps} from '../utils/types'
import {get} from '../../constants'
import sx, {SxProp} from '../../sx'
import {ComponentProps} from '../../utils/types'

/**
* @deprecated A new filter component is in progress.
* Until the new filter component is ready, you can use Button + TextInput + ActionList to reproduce this pattern.
*/
const FilteredSearch = styled.div<SxProp>`
display: flex;
align-items: stretch;
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions src/deprecated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,11 @@ export type {
ButtonCloseProps,
} from './Button'
// end of v35.0.0

// Deprecated in v36.0.0 in June 2023
// TODO: We can remove these 6 months after release: December 2023
export {default as FilterList} from './FilterList'
export type {FilterListProps, FilterListItemProps} from './FilterList'
export {default as FilteredSearch} from './FilteredSearch'
export type {FilteredSearchProps} from './FilteredSearch'
// end of v36.0.0
Loading

0 comments on commit 3de26ce

Please sign in to comment.