Skip to content

Commit

Permalink
Merge branch 'main' into css_modules_remove_feature_flag_text
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrohan authored Dec 4, 2024
2 parents dd52bbe + e2a85e0 commit 9b71733
Show file tree
Hide file tree
Showing 135 changed files with 943 additions and 483 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-jokes-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

BugFix: Fix issue in ButtonGroup Overlay screenshots by updating the selector to use `:is(button, a)` and `:first-of-type` and `:last-of-type` pseudo-classes.
5 changes: 5 additions & 0 deletions .changeset/empty-crews-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": minor
---

Convert SegmentedControl to use CSS modules behind feature flag
5 changes: 5 additions & 0 deletions .changeset/large-rats-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

docs: fix *.docs.json story ids
5 changes: 5 additions & 0 deletions .changeset/quick-chairs-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": minor
---

Convert `Pagination` component to use CSS modules
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.
44 changes: 44 additions & 0 deletions e2e/components/BaseStyles.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {test, expect} from '@playwright/test'
import {visit} from '../test-helpers/storybook'
import {themes} from '../test-helpers/themes'

const stories = [
{
id: 'behaviors-basestyles-dev--default',
title: 'Dev Default',
},
] as const

test.describe('BaseStyles', () => {
for (const story of stories) {
test.describe(story.title, () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: story.id,
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
`BaseStyles.${story.title}.${theme}.png`,
)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: story.id,
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})
}
})
292 changes: 61 additions & 231 deletions e2e/components/UnderlinePanels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,244 +2,74 @@ import {test, expect} from '@playwright/test'
import {visit} from '../test-helpers/storybook'
import {themes} from '../test-helpers/themes'

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

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

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

test.describe('Labelled By External Element', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'experimental-components-underlinepanels-features--labelled-by-external-element',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`UnderlineNav.Labelled By External Element.${theme}.png`)
})

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

test.describe('Selected Tab', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'experimental-components-underlinepanels-features--selected-tab',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`UnderlineNav.Selected Tab.${theme}.png`)
})
const stories: Array<{title: string; id: string}> = [
{
title: 'Default',
id: 'experimental-components-underlinepanels--default',
},
{
title: 'Dev Default',
id: 'experimental-components-underlinepanels-dev--default',
},
{
title: 'Labelled By External Element',
id: 'experimental-components-underlinepanels-features--labelled-by-external-element',
},
{
title: 'Selected Tab',
id: 'experimental-components-underlinepanels-features--selected-tab',
},
{
title: 'With Counters',
id: 'experimental-components-underlinepanels-features--with-counters',
},
{
title: 'With Counters In Loading State',
id: 'experimental-components-underlinepanels-features--with-counters-in-loading-state',
},
{
title: 'With Icons',
id: 'experimental-components-underlinepanels-features--with-icons',
},
{
title: 'With Icons Hidden On Narrow Screen',
id: 'experimental-components-underlinepanels-features--with-icons-hidden-on-narrow-screen',
},
]

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

test.describe('With Counters', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'experimental-components-underlinepanels-features--with-counters',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`UnderlineNav.With Counters.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'experimental-components-underlinepanels-features--with-counters',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations({
rules: {
'color-contrast': {
enabled: theme !== 'dark_dimmed',
test.describe('UnderlinePanels', () => {
for (const story of stories) {
test.describe(story.title, () => {
for (const theme of themes) {
test.describe(theme, () => {
test('@vrt', async ({page}) => {
await visit(page, {
id: story.id,
globals: {
colorScheme: theme,
},
},
})
})
})
}
})
})

test.describe('With Counters In Loading State', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'experimental-components-underlinepanels-features--with-counters-in-loading-state',
globals: {
colorScheme: theme,
},
expect(await page.screenshot()).toMatchSnapshot(`UnderlinePanels.${story.title}.${theme}.png`)
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`UnderlineNav.With Counters In Loading State.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'experimental-components-underlinepanels-features--with-counters-in-loading-state',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations({
rules: {
'color-contrast': {
enabled: theme !== 'dark_dimmed',
test('@aat', async ({page}) => {
await visit(page, {
id: story.id,
globals: {
colorScheme: theme,
},
},
})
})
})
}
})

test.describe('With Icons', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'experimental-components-underlinepanels-features--with-icons',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`UnderlineNav.With Icons.${theme}.png`)
})

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

test.describe('With Icons Hidden On Narrow Screen', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'experimental-components-underlinepanels-features--with-icons-hidden-on-narrow-screen',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(
`UnderlineNav.With Icons Hidden On Narrow Screen.${theme}.png`,
)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'experimental-components-underlinepanels-features--with-icons-hidden-on-narrow-screen',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations({
rules: {
'color-contrast': {
enabled: theme !== 'dark_dimmed',
})
await expect(page).toHaveNoViolations({
rules: {
'color-contrast': {
enabled: theme !== 'dark_dimmed',
},
},
},
})
})
})
})
}
})
}
})
}
})
6 changes: 5 additions & 1 deletion packages/react/script/components-json/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Component = {
| '@primer/react/experimental'
| '@primer/react/drafts'
stories: Array<{id: string; code?: string}>
source?: string
}

const ajv = new Ajv()
Expand Down Expand Up @@ -114,7 +115,10 @@ const components = docsFiles.map(docsFilepath => {
}

// TODO: Provide default type and description for sx and ref props
return docs
return {
source: `https://github.com/primer/react/tree/main/packages/react/${docsFilepath.substring(0, docsFilepath.lastIndexOf('/'))}`,
...docs,
}
})

const data = {schemaVersion: 2, components: keyBy(components, 'id')}
Expand Down
Loading

0 comments on commit 9b71733

Please sign in to comment.