Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-esm-functional-size-tokens.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react-brand': patch
---

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.
3 changes: 3 additions & 0 deletions .github/workflows/integration_test_nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,13 @@ jobs:
run: |
rm ./${{ env.NEXTJS_FOLDER }}/app/page.tsx
cp ./packages/e2e/integration-tests/nextjs/page.tsx ./${{ env.NEXTJS_FOLDER }}/app
mkdir ./${{ env.NEXTJS_FOLDER }}/app/button-only
cp ./packages/e2e/integration-tests/nextjs/button-only/page.tsx ./${{ env.NEXTJS_FOLDER }}/app/button-only
cp ./packages/e2e/cypress.config.js ./${{ env.NEXTJS_FOLDER }}
mkdir ${{ env.NEXTJS_FOLDER }}/integration-tests
cp -r ./packages/e2e/integration-tests/fixtures ./${{ env.NEXTJS_FOLDER }}/integration-tests
cp -r ./packages/e2e/integration-tests/tests ./${{ env.NEXTJS_FOLDER }}/integration-tests
cp ./packages/e2e/integration-tests/nextjs/check-size-tokens.cy.ts ./${{ env.NEXTJS_FOLDER }}/integration-tests/tests

- name: Excluded cypress tests in-place
# includes temp workaround for cypress bug. remove when fixed
Expand Down
7 changes: 7 additions & 0 deletions packages/e2e/integration-tests/nextjs/button-only/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use client'

import {Button} from '../../integration-tests/fixtures'

export default function ButtonOnlyPage() {
return <Button data-testid="button-only">Button-only page</Button>
}
15 changes: 15 additions & 0 deletions packages/e2e/integration-tests/nextjs/check-size-tokens.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe('Size token integration tests', () => {
it('loads shared size tokens without Stack on the page', () => {
cy.visit('http://localhost:3000/button-only')

cy.get('[data-testid="button-only"]').should(button => {
const ownerWindow = button[0].ownerDocument.defaultView

if (!ownerWindow) throw new Error('Expected the Button document to have a window')

const controlSize = ownerWindow.getComputedStyle(button[0]).getPropertyValue('--brand-control-medium-size').trim()

expect(controlSize).not.to.equal('')
})
})
})
2 changes: 2 additions & 0 deletions packages/react/src/css/stylesheets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import './reset.css'
import '@primer/brand-primitives/lib/design-tokens/css/tokens/base/colors/color-scales-with-modes.css'
import '@primer/brand-primitives/lib/design-tokens/css/tokens/base/size/size.css'
import '@primer/brand-primitives/lib/design-tokens/css/tokens/base/typography/typography.css'
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/animation/base.css'
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/size/size.css'
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/typography/typography-responsive.css'
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/size/breakpoints.css'
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/size/border.css'
Expand Down
Loading