ALFMOB-273: Source Chip styling from semantic Theme tokens#94
ALFMOB-273: Source Chip styling from semantic Theme tokens#94khoinguyen-mindera wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the SharedUI Chip component’s styling to be driven by semantic Theme.* tokens where available, and extracts the state→style resolution into a testable value type (ChipStyle). It also adds unit tests to cover the state→token mapping and counter-label logic.
Changes:
- Extract
ChipStylefromChipand rewireChip.bodyto consumeChipStyleproperties. - Replace hardcoded normal border width (
1.0) withCGFloat(Primitives.Border.borderWeightDefault)and map eligible colors through semanticTheme.*aliases. - Add
ChipStyleTeststo cover border/text/background color mapping, border width, height, and counter label boundaries.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Docs/Plans/ALFMOB-273-refactor-chip-tokens/scope.md | Scout report documenting existing token usage and remaining hardcoded constants. |
| Docs/Plans/ALFMOB-273-refactor-chip-tokens/plan.md | Plan defining semantic token mapping decisions and test strategy for ChipStyle. |
| Docs/Plans/ALFMOB-273-refactor-chip-tokens/phase-1-chip-tokens.md | Execution steps and acceptance criteria for the single-slice refactor + tests. |
| Docs/Plans/ALFMOB-273-refactor-chip-tokens/grill.md | Recorded decisions for semantic aliases and the ChipStyle extraction approach. |
| Docs/Plans/ALFMOB-273-refactor-chip-tokens/_status.md | Status tracking for the ticket workflow and verification checkpoints. |
| Alfie/AlfieKit/Sources/SharedUI/Components/Chips/Chip.swift | Implements ChipStyle, migrates styling to semantic tokens + border token, rewires Chip rendering. |
| Alfie/AlfieKit/Tests/SharedUITests/ChipStyleTests.swift | Adds unit coverage for state→style/token mapping and counter label formatting. |
|
Really clean refactor — extracting One thing: the PR also commits 5 internal planning docs under |
…arify disabled-border comment
Ticket
ALFMOB-273
Summary
ChipStylevalue type fromChip(mirrors theBadgeHelperpattern) so the state→style mapping is unit-testable without snapshotsTheme.*layer instead of raw primitives:borderSoft/contentContentPrimary/surfaceForegroundPrimary(border),contentContentPrimaryDisabled(text),surfaceBackgroundPrimary/surfaceForegroundPrimary(background)Primitives.Border.borderWeightDefaultinstead of a hardcoded1.0(consistent with Badge ALFMOB-269)neutrals600— noThemealias exists at that valueChipStyleTests(21 XCTest cases) covering every state→token mapping plus counter-label boundariesScreenshot