Skip to content

[CLOV-1341][BpkChip]Theming support to BpkChip#4272

Merged
kerrie-wu merged 7 commits intomainfrom
theme-bpkChip
Mar 13, 2026
Merged

[CLOV-1341][BpkChip]Theming support to BpkChip#4272
kerrie-wu merged 7 commits intomainfrom
theme-bpkChip

Conversation

@kerrie-wu
Copy link
Contributor

@kerrie-wu kerrie-wu commented Mar 11, 2026

Summary

Adds full theming support to BpkChip via CSS custom properties, enabling consumers to override colours, borders, and border-radius through BpkThemeProvider.

What changed

packages/bpk-mixins/_chips.scss

  • Replaced hard-coded colour and border values with bpk-themeable-property calls across all three chip variants (default, on-dark, on-image) — covering background, text, hover, active, and selected states.
  • Added a private bpk-chip-themeable-border helper mixin to work around the limitation that bpk-border-sm (which uses box-shadow shorthand) cannot accept a CSS variable directly. The two-line fallback pattern (box-shadow with literal fallback + box-shadow with var()) is applied instead.
  • Made border-radius themeable via --bpk-chip-border-radius.

packages/bpk-component-chip/src/themeAttributes.ts

  • Default export is unchanged (backward compatible — existing consumers relying on the original 8 selected-state attributes are unaffected).
  • Added four new named exports:
    • chipBorderRadiusThemeAttributes['chipBorderRadius']
    • chipDefaultThemeAttributes — 10 attributes covering all default variant states
    • chipOnDarkThemeAttributes — 9 attributes covering all on-dark variant states
    • chipOnImageThemeAttributes — 8 attributes covering all on-image variant states

packages/bpk-component-chip/index.ts

  • Re-exports the four new named exports so consumers can import them directly from the package.

packages/bpk-component-chip/src/themeAttributes-test.ts

  • Extended test coverage for all new named exports.

examples/bpk-component-chip/examples.tsx

  • Added ThemedExample Storybook story demonstrating a custom theme override using BpkThemeProvider with chipDefaultBorderColor, chipDefaultSelectedBackgroundColor, chipBorderRadius, and related attributes.

Non-breaking

  • Default CSS fallback values exactly match the previous hard-coded token values — no visual change when no theme is applied.
  • Default themeAttributes export is preserved as-is.

Remember to include the following changes:

  • Ensure the PR title includes the name of the component you are changing so it's clear in the release notes for consumers of the changes in the version e.g [Clover-123][BpkButton] Updating the colour
  • README.md (If you have created a new component)
  • Component README.md
  • Tests
  • Accessibility tests
    • The following checks were performed:
      • Ability to navigate using a keyboard only
      • Zoom functionality (Deque University explanation):
        • The page SHOULD be functional AND readable when only the text is magnified to 200% of its initial size
        • Pages must reflow as zoom increases up to 400% so that content continues to be presented in only one column i.e. Content MUST NOT require scrolling in two directions (both vertically and horizontally)
      • Ability to navigate using a screen reader only
  • Storybook examples created/updated
  • For breaking changes or deprecating components/properties, migration guides added to the description of the PR. If the guide has large changes, consider creating a new Markdown page inside the component's docs folder and link it here

Copilot AI review requested due to automatic review settings March 11, 2026 06:54
@kerrie-wu kerrie-wu added the minor Non breaking change label Mar 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds broader theming support for BpkChip by switching more chip styles to CSS-variable-backed mixins, exposing new theme attribute groupings for consumers, and providing a Storybook example demonstrating overrides.

Changes:

  • Updated chip SCSS mixin to make border-radius, colors, and borders themeable via CSS variable fallbacks.
  • Expanded bpk-component-chip theme attribute exports (while preserving the original default export for backward compatibility) and added tests.
  • Added a new Storybook “Themed” example demonstrating chip theme overrides via BpkThemeProvider.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/bpk-mixins/_chips.scss Applies bpk-themeable-property/CSS var fallbacks across chip variants and introduces a helper for themeable borders.
packages/bpk-component-chip/src/themeAttributes.ts Keeps the legacy default export intact and adds new grouped theme attribute exports.
packages/bpk-component-chip/src/themeAttributes-test.ts Verifies backward compatibility and coverage for newly exported theme attribute groups.
packages/bpk-component-chip/index.ts Re-exports new theme attribute groupings from the package entry point.
examples/bpk-component-chip/stories.tsx Adds a new “Themed” story entry.
examples/bpk-component-chip/examples.tsx Implements the new ThemedExample using BpkThemeProvider.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4272 to see this build running in a browser.

@skyscanner-backpack-bot
Copy link

skyscanner-backpack-bot bot commented Mar 11, 2026

Warnings
⚠️

Package source files (e.g. packages/package-name/src/Component.js) were updated, but snapshots weren't. Have you checked that the tests still pass?

Browser support

If this is a visual change, make sure you've tested it in multiple browsers.

Generated by 🚫 dangerJS against 1d0615a

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4272 to see this build running in a browser.

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4272 to see this build running in a browser.

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4272 to see this build running in a browser.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

</BpkText>
<BpkThemeProvider
theme={{
chipBorderRadius: '1rem',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use borderRadiusLg for chipBorderRadius

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks .Update in 1d0615a

@include utils.bpk-themeable-property(
border-radius,
--bpk-chip-border-radius,
tokens.$bpk-border-radius-xs * 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can use $bpk-border-radius-sm instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks .Update in 1d0615a

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4272 to see this build running in a browser.

@kerrie-wu kerrie-wu merged commit bf3807e into main Mar 13, 2026
15 checks passed
@kerrie-wu kerrie-wu deleted the theme-bpkChip branch March 13, 2026 03:18
kerrie-wu added a commit that referenced this pull request Mar 13, 2026
* themable bpkChip

* hover color

* delete skill

* hover fallbaock

* change to _border

* update readme

* update boder token using
Ezreal Yang (Supremeyh) added a commit that referenced this pull request Mar 16, 2026
* default export autosuggest

* modify migartion

* modify migration doc

* change autosuggest storybook name

* [CLOV-1340] [BpkBadge] BpkBadge Themeability Enhancements (#4270)

* [CLOV-1340] [BpkBadge] BpkBadge Themeability Enhancements

* update readme

* Update examples/bpk-component-badge/examples.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* add allBadgeThemeAttributes

* themeable property mixin

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* [BpkButton]Add loading prop for BpkButton (#4275)

* add loading state for BpkButton

* fix test and comments

* revert comments

* remove dead code

* fix bpkbutton link style

* update example text

* [CLOV-1341][BpkChip]Theming support to  BpkChip (#4272)

* themable bpkChip

* hover color

* delete skill

* hover fallbaock

* change to _border

* update readme

* update boder token using

* [CLOV-90] TS migration of bpk-component-table (#4123)

* initiate SDD

* add speckit command for copilot

* [TypeScript] Migrate bpk-component-table to TypeScript

Migrated bpk-component-table from Flow to TypeScript with zero API changes.

## Summary
- Migrated 6 table components to TypeScript (.js → .tsx)
- Migrated 7 test files to TypeScript (.js → .tsx)
- Migrated examples and stories to TypeScript
- Added TypeScript type exports for all components
- Updated README with TypeScript usage section

## Changes
- All Flow annotations removed
- TypeScript type definitions added inline in component files
- PropTypes retained for runtime validation
- Rest props pattern: [rest: string]: any; // Inexact rest
- Entry point migrated: index.js → index.ts

## Testing
- ✅ All 24 tests passing (100% pass rate)
- ✅ Test coverage: 100% (branches, functions, lines, statements)
- ✅ All snapshots byte-identical
- ✅ Accessibility tests passing with jest-axe
- ✅ Build successful

## Type Definitions
All components now export TypeScript types:
- BpkTableProps, BpkTableHeadProps, BpkTableBodyProps
- BpkTableRowProps, BpkTableCellProps, BpkTableHeadCellProps

## Breaking Changes
None - This is a PATCH version migration with zero API changes.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* [Docs] Add TypeScript migration specification documents

Added comprehensive documentation for bpk-component-table TypeScript migration:
- spec.md: Feature specification with requirements and success criteria
- plan.md: Implementation plan with constitution compliance
- tasks.md: Detailed task breakdown with completion tracking
- research.md: Flow to TypeScript type mapping research
- api-design.md: TypeScript type definitions for all components
- styling-guide.md: Confirmed zero styling changes
- checklists/requirements.md: Specification quality validation
- MIGRATION_COMPLETE.md: Final migration summary

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* [License] Add Apache 2.0 license headers to speckit scripts

Added missing license headers to all speckit bash scripts:
- check-prerequisites.sh
- common.sh
- create-new-feature.sh
- setup-plan.sh
- update-agent-context.sh

Updated constitution.md to document license header requirement:
- Added NON-NEGOTIABLE license header requirement in Section II
- Included template for TypeScript/JavaScript files
- Included guidance for bash scripts (# comments after shebang)
- Ensures legal compliance and proper attribution

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* [Docs] Document TypeScript file extension patterns for bpk-component-table

Add comprehensive documentation for proper TypeScript file extension usage:
- Update spec.md with User Story 6 (File Extension Correctness) and MIG-012
- Add file extension analysis to research.md confirming all files correctly named
- Create implementation plan.md documenting verification process
- Update requirements checklist with file extension guidance

Key findings:
- index.ts correctly uses .ts (no JSX)
- All component/test/example files correctly use .tsx (contain JSX)
- No code changes needed - migration already follows best practices

This documentation serves as reference for future TypeScript migrations.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* update requirement for liscence header

* change header template

* change plan template for examples

* optimize document

* change api type to inherite html element

* fix storybook api doc missing and delete propTypes

* add comment to template

* delete spec

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

* Create skill to migrate to v42 (#4277)

* Create skill to migrate to v42

* add more detail for autosuggest migration

* update skills

---------

Co-authored-by: Kerrie Wu <kerrie.wu@skyscanner.net>
Co-authored-by: kerrie-wu <52308828+kerrie-wu@users.noreply.github.com>

* add using skills guide in migration doc

---------

Co-authored-by: Faye <faye.xiao@skyscanner.net>
Co-authored-by: Ezreal Yang <supremeyh@126.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: GC Zhu <171069086@qq.com>
Co-authored-by: IrinaWei <irina.wei@skyscanner.net>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Jaume Salgado <jaume.salgado@skyscanner.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Non breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants