Skip to content

Commit

Permalink
Merge branch 'main' into tylerjdev/action-list-a11y-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerJDev authored Feb 20, 2024
2 parents eab6fd9 + 9723020 commit 8b4f311
Show file tree
Hide file tree
Showing 450 changed files with 10,979 additions and 11,889 deletions.
5 changes: 0 additions & 5 deletions .changeset/fresh-parents-kiss.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/honest-kings-occur.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/hot-hounds-speak.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/khaki-zebras-smile.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/polite-rockets-yawn.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/purple-bees-warn.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/sharp-starfishes-battle.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/slow-owls-report.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/strange-starfishes-work.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/violet-ligers-double.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/witty-kangaroos-beg.md

This file was deleted.

6 changes: 4 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports = {
'consumer-test/**/*',
'contributor-docs/adrs/*',
'examples/nextjs/**',
'examples/codesandbox/**',
// Note: this file is inlined from an external dependency
'packages/react/src/utils/polymorphic.ts',
'storybook-static',
Expand Down Expand Up @@ -112,8 +113,9 @@ module.exports = {
files: ['**/*.{ts,tsx}'],
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'@typescript-eslint/no-explicit-any': 2,
'@typescript-eslint/no-unnecessary-condition': 2,
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
- name: Install dependencies
run: npm ci

- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PRIMER_APP_ID_SHARED }}
private-key: ${{ secrets.PRIMER_APP_PRIVATE_KEY_SHARED }}

- name: Create release pull request or publish to npm
id: changesets
# Uses SHA for security hardening
Expand All @@ -39,7 +45,7 @@ jobs:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}

release-next-major:
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.
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.
6 changes: 4 additions & 2 deletions contributor-docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ Here's an example of a basic component written in the style of Primer react comp
```tsx
import React from 'react'
import Box from '../Box'
import {BetterSystemStyleObject, SxProp, merge} from '../sx'
import type {BetterSystemStyleObject, SxProp} from '../sx'
import {merge} from '../sx'

export type ComponentProps = {
prop?: 'value1' | 'value2'
Expand Down Expand Up @@ -156,7 +157,8 @@ Each component should accept a prop called `sx` that allows for setting theme-aw
To add the `sx` prop to your component: import the default export from the `sx` module, add it to your style definition, and add the appropriate prop types. **The `sx` prop should go at the _very end_ of your style definition.**

```tsx
import sx, {SxProp} from './sx'
import type {SxProp} from './sx'
import sx from './sx'

const Component = styled.div<SxProp>`
// additional styles here
Expand Down
6 changes: 6 additions & 0 deletions docs/content/Tooltip.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ import DeprecationBanner from '../components/DeprecationBanner'

<DeprecationBanner replacementUrl={'/components/tooltip/react/latest'} />

## Deprecation

Use [the next version of Tooltip](/TooltipV2) for accessibility improvements.

The Tooltip component adds a tooltip to add context to interactive elements on the page.

## Usage

**_⚠️ Usage warning! ⚠️_**

Tooltips as a UI pattern should be our last resort for conveying information because it is hidden by default and often with zero or little visual indicator of its existence.
Expand Down
20 changes: 14 additions & 6 deletions docs/content/drafts/Tooltip.mdx → docs/content/TooltipV2.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
---
componentId: tooltip_v2
title: Tooltip v2
status: Draft
source: https://github.com/primer/react/tree/main/packages/react/src/drafts/Tooltip.tsx
status: Beta
a11yReviewed: true
source: https://github.com/primer/react/tree/main/packages/react/src/TooltipV2/Tooltip.tsx
---

import data from '../../../packages/react/src/drafts/Tooltip/Tooltip.docs.json'
import data from '../../packages/react/src/TooltipV2/Tooltip.docs.json'

```js
//👇 Notice the new bundle, `next`👇
import {Tooltip} from '@primer/react/next'
```

## Usage

The Tooltip component is used to add context to interactive elements on the page.

Expand All @@ -23,7 +31,7 @@ Tooltip should only be used on an element that is interactive such as a button o

Default tooltip is suitable for interactive controls that require additional context.

```jsx live
```jsx live next
<Tooltip text="This change cannot be undone.">
<Button>Delete</Button>
</Tooltip>
Expand All @@ -33,7 +41,7 @@ Default tooltip is suitable for interactive controls that require additional con

Tooltip can be used to label interactive controls that has no visible text label such as interactive icon links.

```jsx live
```jsx live next
<Tooltip text="Contribution Documentation for 'Primer React'" type="label">
<Link href="https://github.com/primer/react/contributor-docs/CONTRIBUTING.md" sx={{ml: 1, color: 'fg.muted'}}>
<Octicon icon={BookIcon} sx={{color: 'fg.muted'}} />
Expand All @@ -43,7 +51,7 @@ Tooltip can be used to label interactive controls that has no visible text label

### With direction

```jsx live
```jsx live next
<Box sx={{padding: 5, display: 'flex', gap: '8px'}}>
<Tooltip direction="n" text="Supplementary text">
<Button>North</Button>
Expand Down
2 changes: 1 addition & 1 deletion docs/content/UnderlineNav.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: UnderlineNav
componentId: underline_nav
status: Alpha
status: Beta
a11yReviewed: true
description: Use an underlined nav to allow tab like navigation with overflow behaviour in your UI.
source: https://github.com/primer/react/tree/main/packages/react/src/UnderlineNav
Expand Down
2 changes: 1 addition & 1 deletion docs/content/deprecated/UnderlineNav.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Use [the new version of UnderlineNav](/components/react/underline-nav/latest) wi

## Examples

```jsx live
```jsx live deprecated
<UnderlineNav aria-label="Main">
<UnderlineNav.Link href="#home" selected>
Home
Expand Down
4 changes: 4 additions & 0 deletions docs/src/@primer/gatsby-theme-doctocat/live-code-scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import * as octicons from '@primer/octicons-react'
import * as primerComponents from '@primer/react'
import * as drafts from '@primer/react/drafts'
import * as deprecated from '@primer/react/deprecated'
import * as experimental from '@primer/react/experimental'
import * as next from '@primer/react/next'
import {Placeholder} from '@primer/react/Placeholder'
import React from 'react'
import State from '../../../components/State'
Expand All @@ -24,7 +26,9 @@ export default function resolveScope(metastring) {
...primerComponents,
...octiconComponents,
...(metastring.includes('drafts') ? drafts : {}),
...(metastring.includes('experimental') ? experimental : {}),
...(metastring.includes('deprecated') ? deprecated : {}),
...(metastring.includes('next') ? next : {}),
ReactRouterLink,
State,
Placeholder,
Expand Down
4 changes: 2 additions & 2 deletions docs/src/@primer/gatsby-theme-doctocat/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
url: /Token
- title: Tooltip
url: /Tooltip
- title: Tooltip v2
url: /TooltipV2
- title: TreeView
url: /TreeView
- title: Truncate
Expand All @@ -170,8 +172,6 @@
url: /drafts/PageHeader
- title: SelectPanel v2
url: /drafts/SelectPanel
- title: Tooltip v2
url: /drafts/Tooltip
- title: Deprecated
children:
- title: ActionList (legacy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,28 @@ import {test, expect} from '@playwright/test'
import {visit} from '../test-helpers/storybook'
import {themes} from '../test-helpers/themes'

test.describe('Tooltip--experimental', () => {
test.describe('TooltipV2', () => {
test.describe('Default', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip--default',
id: 'components-tooltipv2--default',
globals: {
colorScheme: theme,
},
})

// Default state
await page.keyboard.press('Tab')
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`Tooltip--experimental.Default.${theme}.png`,
{
threshold: 0.1,
},
)
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(`TooltipV2.Default.${theme}.png`, {
threshold: 0.1,
})
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip--default',
id: 'components-tooltipv2--default',
globals: {
colorScheme: theme,
},
Expand All @@ -42,7 +39,7 @@ test.describe('Tooltip--experimental', () => {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--anchor-has-margin',
id: 'components-tooltipv2-features--anchor-has-margin',
globals: {
colorScheme: theme,
},
Expand All @@ -51,7 +48,7 @@ test.describe('Tooltip--experimental', () => {
// Default state
await page.keyboard.press('Tab')
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`Tooltip--experimental.Anchor Has Margin.${theme}.png`,
`TooltipV2.Anchor Has Margin.${theme}.png`,
{
threshold: 0.1,
},
Expand All @@ -60,7 +57,7 @@ test.describe('Tooltip--experimental', () => {

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--anchor-has-margin',
id: 'components-tooltipv2-features--anchor-has-margin',
globals: {
colorScheme: theme,
},
Expand All @@ -76,7 +73,7 @@ test.describe('Tooltip--experimental', () => {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--calculated-direction',
id: 'components-tooltipv2-features--calculated-direction',
globals: {
colorScheme: theme,
},
Expand All @@ -85,7 +82,7 @@ test.describe('Tooltip--experimental', () => {
// Default state
await page.keyboard.press('Tab')
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`Tooltip--experimental.Calculated Direction.${theme}.png`,
`TooltipV2.Calculated Direction.${theme}.png`,
{
threshold: 0.1,
},
Expand All @@ -94,7 +91,7 @@ test.describe('Tooltip--experimental', () => {

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--calculated-direction',
id: 'components-tooltipv2-features--calculated-direction',
globals: {
colorScheme: theme,
},
Expand All @@ -110,7 +107,7 @@ test.describe('Tooltip--experimental', () => {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--icon-button-with-description',
id: 'components-tooltipv2-features--icon-button-with-description',
globals: {
colorScheme: theme,
},
Expand All @@ -119,7 +116,7 @@ test.describe('Tooltip--experimental', () => {
// Default state
await page.keyboard.press('Tab')
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`Tooltip--experimental.Icon Button With Description.${theme}.png`,
`TooltipV2.Icon Button With Description.${theme}.png`,
{
threshold: 0.1,
},
Expand All @@ -128,7 +125,7 @@ test.describe('Tooltip--experimental', () => {

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--icon-button-with-description',
id: 'components-tooltipv2-features--icon-button-with-description',
globals: {
colorScheme: theme,
},
Expand All @@ -144,25 +141,22 @@ test.describe('Tooltip--experimental', () => {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--label-type',
id: 'components-tooltipv2-features--label-type',
globals: {
colorScheme: theme,
},
})

// Default state
await page.keyboard.press('Tab')
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`Tooltip--experimental.Label Type.${theme}.png`,
{
threshold: 0.1,
},
)
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(`TooltipV2.Label Type.${theme}.png`, {
threshold: 0.1,
})
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--label-type',
id: 'components-tooltipv2-features--label-type',
globals: {
colorScheme: theme,
},
Expand Down
Loading

0 comments on commit 8b4f311

Please sign in to comment.