Skip to content

Commit 48d8117

Browse files
committed
backfill missing control tokens
1 parent e61d466 commit 48d8117

5 files changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react-brand': patch
3+
---
4+
5+
Fixed missing size and animation tokens in tree-shaken ESM component bundles like `Button`. Now all control tokens are loaded globally as a side-effect.

.github/workflows/integration_test_nextjs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ jobs:
9696
run: |
9797
rm ./${{ env.NEXTJS_FOLDER }}/app/page.tsx
9898
cp ./packages/e2e/integration-tests/nextjs/page.tsx ./${{ env.NEXTJS_FOLDER }}/app
99+
mkdir ./${{ env.NEXTJS_FOLDER }}/app/button-only
100+
cp ./packages/e2e/integration-tests/nextjs/button-only/page.tsx ./${{ env.NEXTJS_FOLDER }}/app/button-only
99101
cp ./packages/e2e/cypress.config.js ./${{ env.NEXTJS_FOLDER }}
100102
mkdir ${{ env.NEXTJS_FOLDER }}/integration-tests
101103
cp -r ./packages/e2e/integration-tests/fixtures ./${{ env.NEXTJS_FOLDER }}/integration-tests
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use client'
2+
3+
import {Button} from '../../integration-tests/fixtures'
4+
5+
export default function ButtonOnlyPage() {
6+
return <Button data-testid="button-only">Button-only page</Button>
7+
}

packages/e2e/integration-tests/tests/check-warnings.cy.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,18 @@ describe('Integration tests', () => {
2424
expect(windowWarningSpy).to.not.be.called
2525
})
2626
})
27+
28+
it('loads shared size tokens without Stack on the page', () => {
29+
cy.visit('http://localhost:3000/button-only')
30+
31+
cy.get('[data-testid="button-only"]').should(button => {
32+
const ownerWindow = button[0].ownerDocument.defaultView
33+
34+
if (!ownerWindow) throw new Error('Expected the Button document to have a window')
35+
36+
const controlSize = ownerWindow.getComputedStyle(button[0]).getPropertyValue('--brand-control-medium-size').trim()
37+
38+
expect(controlSize).not.to.equal('')
39+
})
40+
})
2741
})

packages/react/src/css/stylesheets.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import './reset.css'
99
import '@primer/brand-primitives/lib/design-tokens/css/tokens/base/colors/color-scales-with-modes.css'
1010
import '@primer/brand-primitives/lib/design-tokens/css/tokens/base/size/size.css'
1111
import '@primer/brand-primitives/lib/design-tokens/css/tokens/base/typography/typography.css'
12+
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/animation/base.css'
13+
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/size/size.css'
1214
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/typography/typography-responsive.css'
1315
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/size/breakpoints.css'
1416
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/size/border.css'

0 commit comments

Comments
 (0)