Skip to content

Add SwatchPicker color field#91

Merged
czarandy merged 3 commits into
mainfrom
silver/issue-79-colorpicker-color-swatch-field-component-pick
Jul 10, 2026
Merged

Add SwatchPicker color field#91
czarandy merged 3 commits into
mainfrom
silver/issue-79-colorpicker-color-swatch-field-component-pick

Conversation

@czarandy

Copy link
Copy Markdown
Owner

Summary

  • Add SwatchPicker as a Field-integrated named theme color picker with accessible radiogroup keyboard behavior.
  • Add shared COLOR_NAMES / ColorName and derive Tag, Badge, and Schedule color types from it.
  • Add Badge gray palette support plus docs, Storybook examples, and tests.

Verification

  • pnpm typecheck
  • pnpm lint
  • pnpm test
  • pnpm build
  • pnpm build:storybook
  • pnpm build:site

Closes #79

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
silver-ui Ready Ready Preview, Comment Jul 10, 2026 2:48am
silver-ui-site Ready Ready Preview, Comment Jul 10, 2026 2:48am

@czarandy

Copy link
Copy Markdown
Owner Author
  1. Let's rename it to ColorSwatchPicker
  2. reduce spacing between items to silver-spacing-1
  3. add tooltips for each color on hover
  4. focus ring is offset too far from each circle, it should be closer in
  5. selected state should be an outer ring matching the internal color rather than an internal border
  6. needs a hover effect, maybe a transform to make it grow slightly

czarandy added 2 commits July 9, 2026 19:43
Pure rename, no behavior change. Renames the component, its props type, its
recipes (swatchPickerRecipe -> colorSwatchPickerRecipe, swatchRecipe ->
colorSwatchRecipe), the variants type, and the Storybook title.

Updates the public barrel export, the README component list, and the docs
site category list; both lists stay alphabetically ordered, so the entry
moves up under CheckboxInput.
Addresses review feedback on the swatch visuals and affordances:

- Spacing between swatches drops from spacing.2 to spacing.1.
- Each swatch gets a hover tooltip naming its color. Tooltips are hover-only
  (focusTrigger: 'never'): the color is already the swatch's accessible name,
  and a focus tooltip both collided with the group's keyboard hint and stayed
  open on the focused swatch while the pointer hovered a different one. For
  the same reason the tooltip is left out of aria-describedby, which would
  otherwise announce the color twice.
- The focus ring moves off the padded button and onto the circle itself, so it
  sits 2px out instead of 6px.
- Selection now draws an outer ring in the swatch's own accent color, separated
  from the circle by a background-colored gap, replacing the thick inner
  border. The color is threaded through a --swatch-ring custom property so one
  box-shadow serves all ten palette entries.
- Swatches grow to scale(1.12) on hover, suppressed when disabled and under
  prefers-reduced-motion.

The button keeps its spacing.1 padding, which is what reserves room for both
rings inside its own box, so neither can bleed onto a neighboring swatch.

Verified geometry in headless Chromium against Storybook (light and dark):
gap 4px, focus ring at 2px offset, selected ring spanning 2-4px, hover 32px ->
35.84px. Recipe tests assert on whole Panda class names rather than substrings,
since focusOffset is a prefix of focusOffsetLoose.
@czarandy

Copy link
Copy Markdown
Owner Author

🤖 Addressed feedback: Renamed SwatchPicker to ColorSwatchPicker and addressed all five review items: spacing.1 gap, hover-only per-color tooltips, focus ring tightened from 6px to 2px, selected state changed to an outer accent-colored ring, and a scale(1.12) hover grow — verified in headless Chromium and guarded by mutation-tested recipe assertions.

@czarandy czarandy merged commit 8df0e5b into main Jul 10, 2026
4 checks passed
@czarandy czarandy deleted the silver/issue-79-colorpicker-color-swatch-field-component-pick branch July 10, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ColorPicker / color-swatch field component (pick from the named theme palette)

1 participant