Skip to content

Commit

Permalink
Merge branch 'next-major' into mp/deprecate-old-filter-components
Browse files Browse the repository at this point in the history
  • Loading branch information
mperrotti authored Jun 19, 2023
2 parents 9de8956 + 98ea43f commit aa55f25
Show file tree
Hide file tree
Showing 133 changed files with 235 additions and 2,019 deletions.
7 changes: 7 additions & 0 deletions .changeset/flat-onions-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@primer/react": major
---

- Changes `leadingIcon` and `trailingIcon` to `leadingVisual` and `trailingVisual`
- Removes `Button.Counter` as a child component, replacing it with a `count` prop. This change allows us to use the `trailingVisual` slot for counters.
- Removes the `outline` button variant as we wish to only support `invisible` buttons.
5 changes: 5 additions & 0 deletions .changeset/great-spies-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Remove deprecated `extralarge` variant from `Token` and `TextInputWithToken` component
5 changes: 5 additions & 0 deletions .changeset/nasty-bottles-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Update minimum version for react and react-dom to v18
5 changes: 5 additions & 0 deletions .changeset/popular-rivers-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Remove support for `activeClassName` for Breadcrumb, SubNav, TabNav, UnderlineNav
5 changes: 5 additions & 0 deletions .changeset/weak-jokes-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

FilteredActionList now uses new ActionList as a base, and SelectPanel reflects those changes.
26 changes: 0 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ jobs:
run: npm run lint:md

test:
strategy:
fail-fast: false
matrix:
react: [17, 18]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -69,30 +65,16 @@ jobs:
node-version: 18
cache: 'npm'

- name: Set React version
run: node script/set-react-version.js ${{ matrix.react }}

- name: Install dependencies
if: ${{ matrix.react == 17 }}
run: npm install --legacy-peer-deps

- name: Install dependencies
if: ${{ matrix.react == 18 }}
run: npm ci

- name: Build
run: npm run build

- name: Test
run: npm run test -- --coverage
env:
REACT_VERSION_17: ${{ matrix.react == 17 }}

type-check:
strategy:
fail-fast: false
matrix:
react: [17, 18]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -104,15 +86,7 @@ jobs:
node-version: 18
cache: 'npm'

- name: Set React version
run: node script/set-react-version.js ${{ matrix.react }}

- name: Install dependencies
if: ${{ matrix.react == 17 }}
run: npm install --legacy-peer-deps

- name: Install dependencies
if: ${{ matrix.react != 17 }}
run: npm ci

- name: Type check
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
2 changes: 1 addition & 1 deletion docs/content/ActionMenu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const Example = () => {

return (
<ActionMenu>
<ActionMenu.Button leadingIcon={selectedType.icon}>{selectedType.name}</ActionMenu.Button>
<ActionMenu.Button leadingVisual={selectedType.icon}>{selectedType.name}</ActionMenu.Button>
<ActionMenu.Overlay width="medium">
<ActionList selectionVariant="single">
{fieldTypes.map((type, index) => (
Expand Down
5 changes: 0 additions & 5 deletions docs/content/Breadcrumbs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ Breadcrumbs are used to show taxonomical context on pages that are many levels d
- Do not have a section-level navigation
- May need the ability to quickly go back to the previous (parent) page

To use Breadcrumbs with [react-router](https://github.com/ReactTraining/react-router) or
[react-router-dom](https://www.npmjs.com/package/react-router-dom), pass
`as={NavLink}` and omit the `selected` prop.
This ensures that the NavLink gets `activeClassName='selected'`

## Examples

```jsx live
Expand Down
25 changes: 6 additions & 19 deletions docs/content/Button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ The `danger` variant of `Button` is used to warn users about potentially destruc
<Button variant="danger">Danger</Button>
```

### Outline button

The `outline` variant of `Button` is typically used as a secondary button

```jsx live
<Button variant="outline">Outline</Button>
```

### Invisible button

The `invisible` variant of `Button` indicates that the action is a low priority one.
Expand Down Expand Up @@ -68,11 +60,11 @@ It is recommended to use an octicon here.

```jsx live
<>
<Button leadingIcon={SearchIcon}>Search</Button>
<Button trailingIcon={SearchIcon} sx={{mt: 2}}>
<Button leadingVisual={SearchIcon}>Search</Button>
<Button trailingVisual={SearchIcon} sx={{mt: 2}}>
Search
</Button>
<Button leadingIcon={SearchIcon} trailingIcon={CheckIcon} sx={{mt: 2}}>
<Button leadingVisual={SearchIcon} trailingVisual={CheckIcon} sx={{mt: 2}}>
Search
</Button>
</>
Expand All @@ -98,17 +90,12 @@ A separate component called `IconButton` is used if the action shows only an ico
</>
```

### Counter component
### Button with counter

A common use case for primer is a button with a counter component which shows the child count value.
We provide `Button.Counter` as a composite component which requires you to provide a number as child.
The counter will match the `variant` styles of the parent button.
To show a count value as a trailing visual inside `Button`, pass a value to the `count` prop. The counter will match the `variant` styles of the parent button.

```jsx live
<Button>
Watch
<Button.Counter>1</Button.Counter>
</Button>
<Button count="1">Watch</Button>
```

### Block button
Expand Down
26 changes: 12 additions & 14 deletions docs/content/SelectPanel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,18 @@ A `SelectPanel` provides an anchor that will open an overlay with a list of sele

```javascript live noinline
function getColorCircle(color) {
return function () {
return (
<Box
borderWidth="1px"
borderStyle="solid"
bg={color}
borderColor={color}
width={14}
height={14}
borderRadius={10}
margin="auto"
/>
)
}
return (
<Box
borderWidth="1px"
borderStyle="solid"
bg={color}
borderColor={color}
width={14}
height={14}
borderRadius={10}
margin="auto"
/>
)
}

const items = [
Expand Down
7 changes: 0 additions & 7 deletions docs/content/SubNav.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ status: Alpha

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

Use the SubNav component for navigation on a dashboard-type interface with another set of navigation components above it. This helps distinguish navigation hierarchy.

To use SubNav with [react-router](https://github.com/ReactTraining/react-router) or
[react-router-dom](https://www.npmjs.com/package/react-router-dom), pass
`as={NavLink}` and omit the `selected` prop.
This ensures that the NavLink gets `activeClassName='selected'`

**Attention:** Make sure to properly label your `SubNav` with an `aria-label` to provide context about the type of navigation contained in `SubNav`.

## Examples
Expand Down
5 changes: 0 additions & 5 deletions docs/content/TabNav.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ status: Alpha

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

To use TabNav with [react-router](https://github.com/ReactTraining/react-router) or
[react-router-dom](https://www.npmjs.com/package/react-router-dom), pass
`as={NavLink}` and omit the `selected` prop.
This ensures that the NavLink gets `activeClassName='selected'`

**Attention:** Make sure to properly label your `TabNav` with an `aria-label` to provide context about the type of navigation contained in `TabNav`.

## Examples
Expand Down
5 changes: 0 additions & 5 deletions docs/content/UnderlineNav.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ Use the UnderlineNav component to style navigation with a minimal underlined sel

UnderlineNav is deprecated and will be replaced by the draft `UnderlineNav` in the next major release. See [the draft UnderlineNav's docs](/drafts/UnderlineNav2) for more details.

To use UnderlineNav with [react-router](https://github.com/ReactTraining/react-router) or
[react-router-dom](https://www.npmjs.com/package/react-router-dom), pass
`as={NavLink}` and omit the `selected` prop.
This ensures that the NavLink gets `activeClassName='selected'`

**Attention:** Make sure to properly label your `UnderlineNav` with an `aria-label` to provide context about the type of navigation contained in `UnderlineNav`.

## Examples
Expand Down
8 changes: 4 additions & 4 deletions docs/content/drafts/PageHeader.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ import {PageHeader} from '@primer/react/drafts'
<PageHeader.Actions>
<IconButton aria-label="Workflows" icon={WorkflowIcon} />
<IconButton aria-label="Insights" icon={GraphIcon} />
<Button variant="primary" trailingIcon={TriangleDownIcon}>
<Button variant="primary" trailingVisual={TriangleDownIcon}>
Add Item
</Button>
<IconButton aria-label="Settings" icon={GearIcon} />
Expand Down Expand Up @@ -212,7 +212,7 @@ import {PageHeader} from '@primer/react/drafts'
<PageHeader.ParentLink href="http://github.com">Parent Link</PageHeader.ParentLink>

<PageHeader.ContextAreaActions>
<Button size="small" leadingIcon={GitBranchIcon}>
<Button size="small" leadingVisual={GitBranchIcon}>
Main
</Button>
<IconButton size="small" aria-label="More Options" icon={KebabHorizontalIcon} />
Expand Down Expand Up @@ -241,7 +241,7 @@ import {PageHeader} from '@primer/react/drafts'
</PageHeader.ContextBar>

<PageHeader.ContextAreaActions>
<Button size="small" leadingIcon={GitBranchIcon}>
<Button size="small" leadingVisual={GitBranchIcon}>
Main
</Button>
<IconButton size="small" aria-label="More Options" icon={KebabHorizontalIcon} />
Expand Down Expand Up @@ -274,7 +274,7 @@ import {PageHeader} from '@primer/react/drafts'
</PageHeader.ContextBar>

<PageHeader.ContextAreaActions hidden={false}>
<Button size="small" leadingIcon={GitBranchIcon}>
<Button size="small" leadingVisual={GitBranchIcon}>
Main
</Button>
<IconButton size="small" aria-label="More Options" icon={KebabHorizontalIcon} />
Expand Down
34 changes: 0 additions & 34 deletions e2e/components/Button.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,40 +275,6 @@ test.describe('Button', () => {
}
})

test.describe('Outline', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-button-features--outline',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`Button.Outline.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-button-features--outline',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations({
rules: {
'color-contrast': {
enabled: theme !== 'dark_dimmed',
},
},
})
})
})
}
})

test.describe('Primary', () => {
for (const theme of themes) {
test.describe(theme, () => {
Expand Down
34 changes: 0 additions & 34 deletions e2e/components/LinkButton.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,40 +241,6 @@ test.describe('LinkButton', () => {
}
})

test.describe('Outline', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-linkbutton-features--outline',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`LinkButton.Outline.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-linkbutton-features--outline',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations({
rules: {
'color-contrast': {
enabled: theme !== 'dark_dimmed',
},
},
})
})
})
}
})

test.describe('Primary', () => {
for (const theme of themes) {
test.describe(theme, () => {
Expand Down
25 changes: 7 additions & 18 deletions generated/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,12 @@
"type": "React.ReactNode",
"description": "The content of the button."
},
{
"name": "count",
"required": true,
"type": "number | string",
"description": "For counter buttons, the number to display."
},
{
"name": "variant",
"type": "| 'default'\n| 'primary'\n| 'danger'\n| 'outline'\n| 'invisible'",
Expand Down Expand Up @@ -922,24 +928,7 @@
"passthrough": {
"element": "button",
"url": "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes"
},
"subcomponents": [
{
"name": "Button.Counter",
"props": [
{
"name": "children",
"required": true,
"type": "number",
"description": "The counter value."
},
{
"name": "sx",
"type": "SystemStyleObject"
}
]
}
]
}
},
"icon_button": {
"id": "icon_button",
Expand Down
Loading

0 comments on commit aa55f25

Please sign in to comment.