Repository navigation
[CLOV-CSS] Migrate bpk-component-datatable to CSS custom properties - #4936
Conversation
|
Visit https://backpack.github.io/storybook-prs/4936 to see this build running in a browser. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Migrates component styling toward CSS custom properties with SASS token fallbacks to improve themeability (incl. dark mode), and adds/expands Storybook dark-mode visual coverage.
Changes:
- Updated SCSS in datatable (and some related components) to use
var(--bpk-*)with SASS fallbacks. - Added new dark-mode visual regression stories/wrappers for Percy/Storybook.
- Introduced expanded radio theme attribute exports (including a legacy deprecated key).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/backpack-web/src/bpk-component-tooltip/src/BpkTooltip.stories.tsx | Adds a dark-mode visual test story using BpkDarkExampleWrapper. |
| packages/backpack-web/src/bpk-component-tooltip/src/BpkTooltip.module.scss | Migrates tooltip colors to CSS custom properties with SASS fallbacks; documents token gaps. |
| packages/backpack-web/src/bpk-component-select/src/BpkSelect.stories.tsx | Adds a dark-mode visual test story and imports BpkDarkExampleWrapper. |
| packages/backpack-web/src/bpk-component-select/src/BpkSelect.module.scss | Documents token gaps for non-migratable dimension/hairline tokens. |
| packages/backpack-web/src/bpk-component-radio/src/themeAttributes.tsx | Replaces legacy theme attributes export with a new combined list + deprecation notes. |
| packages/backpack-web/src/bpk-component-radio/src/themeAttributes.ts | Removes the previous legacy-only theme attributes file. |
| packages/backpack-web/src/bpk-component-radio/src/themeAttributes-test.ts | Updates tests to cover both legacy and new radio theme attribute exports. |
| packages/backpack-web/src/bpk-component-radio/src/BpkRadio.stories.tsx | Adds a dark-mode story for radio group example. |
| packages/backpack-web/src/bpk-component-radio/src/BpkRadio.module.scss | Migrates radio colors to CSS custom properties and updates checked indicator styling. |
| packages/backpack-web/src/bpk-component-datatable/src/BpkDataTableHeader.module.scss | Migrates sort icon colors to CSS custom properties; documents line-height token gap. |
| packages/backpack-web/src/bpk-component-datatable/src/BpkDataTable.stories.tsx | Adds a dark-mode visual test story using BpkDarkExampleWrapper. |
| packages/backpack-web/src/bpk-component-datatable/src/BpkDataTable.module.scss | Migrates datatable borders/colors to CSS custom properties and replaces accent border mixins with inset box-shadow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| import { ArgTypes, Markdown } from '@storybook/addon-docs/blocks'; | ||
|
|
||
| import { BpkDarkExampleWrapper } from 'bpk-storybook-utils'; |
There was a problem hiding this comment.
Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.
| export const allRadioThemeAttributes = [ | ||
| 'privateRadioBgDefaultDisabled', | ||
| 'privateRadioBgDefaultOn', | ||
| 'privateRadioBgOnContrastOff', | ||
| 'privateRadioBgOnContrastOn', | ||
| 'privateRadioBorder', | ||
| 'privateRadioBorderDefaultOff', | ||
| ]; |
There was a problem hiding this comment.
Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.
| --bpk-radio-checked-color, | ||
| tokens.$bpk-text-link-day | ||
| ); | ||
| background: var(--bpk-text-deprecated-link, tokens.$bpk-text-link-day); |
There was a problem hiding this comment.
Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.
| // Datatable accent border = $bpk-border-size-xl * 2 = 6px | ||
| box-shadow: | ||
| calc(var(--bpk-border-3, tokens.$bpk-border-size-xl) * 2) 0 0 0 | ||
| var(--bpk-core-accent, tokens.$bpk-core-accent-day) inset; |
There was a problem hiding this comment.
Not a new risk — the previous borders.bpk-border-left/bpk-border-right mixin (_borders.scss) already implemented these as box-shadow: $offset-x 0 0 0 $color inset; internally. This PR inlines the same box-shadow approach directly (since the shared mixin doesn't support CSS var colors) rather than introducing box-shadow where there wasn't one before. No other box-shadow is used on this element, so there's no clobbering risk beyond what already existed pre-migration.
| const VisualTestDarkExample = () => ( | ||
| <BpkDarkExampleWrapper> |
There was a problem hiding this comment.
Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.
e630f79 to
69eea60
Compare
|
Visit https://backpack.github.io/storybook-prs/4936 to see this build running in a browser. |
e630f79 to
907c756
Compare
|
Visit https://backpack.github.io/storybook-prs/4936 to see this build running in a browser. |
907c756 to
399135c
Compare
|
Visit https://backpack.github.io/storybook-prs/4936 to see this build running in a browser. |
399135c to
14d1b09
Compare
Migrates bpk-component-datatable SCSS to CSS custom properties with SASS fallbacks. Token migrations: - bpk-border-size-sm -> var(--bpk-border-1) - bpk-border-size-xl -> var(--bpk-border-3) via calc() for doubled accent border - bpk-canvas-contrast-day -> var(--bpk-canvas-contrast) - bpk-core-accent-day -> var(--bpk-core-accent) - bpk-line-day -> var(--bpk-other-line-default) - bpk-status-warning-fill-day -> var(--bpk-surface-warning-fill) - bpk-text-primary-day -> var(--bpk-text-primary) Gap tokens (no CSS var equivalent, documented with comments): - bpk-line-height-xs: typography line-height - bpk-one-pixel-rem: hairline border utility Adds VisualTestDark story using BpkDarkExampleWrapper. Closes #4822 Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
14d1b09 to
4ce9abe
Compare
|
Visit https://backpack.github.io/storybook-prs/4936 to see this build running in a browser. |
|
Token value audit — verified every new CSS var introduced in this PR against
All new/old values match — no visual regression risk from this migration. |
Was failing the scss/dollar-variable-empty-line-before lint rule in CI.
|
Visit https://backpack.github.io/storybook-prs/4936 to see this build running in a browser. |
Summary
bpk-component-datatableSCSS files to use CSS custom properties (var()) with SASS token fallbacks, enabling light/dark mode support$bpk-line-height-xs,$bpk-one-pixel-rem) documented with comments as having no CSS var equivalentVisualTestDarkstory usingBpkDarkExampleWrapperfor Percy dark mode snapshotsToken migrations:
$bpk-border-size-smvar(--bpk-border-1)$bpk-border-size-xlvar(--bpk-border-3)viacalc()(doubled for accent border)$bpk-canvas-contrast-dayvar(--bpk-canvas-contrast)$bpk-core-accent-dayvar(--bpk-core-accent)$bpk-line-dayvar(--bpk-other-line-default)$bpk-status-warning-fill-dayvar(--bpk-surface-warning-fill)$bpk-text-primary-dayvar(--bpk-text-primary)Closes #4822
Test plan
var()declarations with SASS fallbacks🤖 Generated with Claude Code