Skip to content

feat(webkit)!: give chip three kinds and hand presence to the consumer - #883

Open
gabriel-lisboa-azion wants to merge 8 commits into
mainfrom
feat/chip-kinds
Open

feat(webkit)!: give chip three kinds and hand presence to the consumer#883
gabriel-lisboa-azion wants to merge 8 commits into
mainfrom
feat/chip-kinds

Conversation

@gabriel-lisboa-azion

Copy link
Copy Markdown
Collaborator

What

Chip gains a kind axis covering the three jobs it actually does in a filter surface, so a consumer never has to restyle the component to get one of them:

kind Job Treatment
filled (default) a value that is applied raised surface, border, shadow — the loudest, because it is state
outlined a value the user could apply same border, no fill, no shadow — recedes to an offer without becoming disabled
dashed the control that creates a chip dashed outline, the standing "add another one of these" convention

The breaking part: presence is the consumer's

remove used to fade the chip to opacity: 0 and only then emit, so the chip decided its own disappearance. That could serve exactly one case — where removing a value also destroys the chip. A filter bar where a removed value stays on screen as an outlined offer was impossible: the instance stayed invisible forever.

remove now fires immediately and the chip stays mounted. Exit motion, where wanted, belongs to whatever owns the list — so table-applied-filters gains the TransitionGroup that actually destroys chips. That is why it ships in this PR: split apart, one half double-animates removal and the other un-animates it.

The inline style="transition: …" the old fade needed is gone too — an inline transition beats every transition-* class a consumer puts on the same element (see #881).

Also

  • The remove control is named after what it removes: aria-label="Remove Production", with a Tooltip carrying the same string, and a 24×24 target at medium (WCAG 2.5.8). A row of chips whose every button says "Remove" is unusable by voice or screen reader.
  • Enter/Space dispatch a real DOM click, so a Chip works as a Popover.Trigger / Dropdown.Trigger child from the keyboard.
  • Both sizes are now fixed heights (24px / 32px) rather than padding-driven, so a row of chips shares one baseline.
  • Adds the missing .size-limit.json row — chip now carries Tooltip, and nothing was measuring that. 4.27 KB gzipped against a 5 KB budget.

BREAKING CHANGE

  • remove no longer waits for a fade before emitting, and the chip no longer unmounts itself. A consumer relying on self-dismissal must now drop the chip from its own collection.
  • small is a fixed 24px (was 20px) and medium a fixed 32px (was ~30px from padding); medium uses text-label-sm.

Verification

33 chip tests pass, including the two that pin the new contract — "stays mounted after remove" and "declares no inline transition on the root". Catalog regenerated on this branch (not carried), so catalog:check is clean.

Adds kind: filled | outlined | dashed, fixes the two sizes at 24/32px, and
names the remove control after what it removes ("Remove $label") with a
tooltip carrying the same string and a 24x24 target.

The remove event now fires immediately and the chip stays mounted, so a
chip can survive its own removal (a filter chip that empties but remains).
The exit motion moves to table-applied-filters, which owns the
TransitionGroup that actually destroys chips.

Enter/Space now dispatch a real DOM click so a Chip works as a
Popover.Trigger child from the keyboard.

BREAKING CHANGE: remove no longer waits for a fade before emitting, and the
chip no longer unmounts itself — the consumer owns presence. Both sizes
changed to fixed heights (24px small, 32px medium) and medium now uses
text-label-sm.
Naming the remove control after what it removes brought Tooltip in as a
dependency, and chip had no size-limit row to catch that. It measures 4.27 KB
gzipped; the budget is 5 KB.
The Motion table named tooltip's animate-popup-scale-in/out utilities, and
the authoring ratchet reads that table per FILE — so it required classes in
chip.vue that belong to the component chip composes. The row now names the
owner and points at its spec instead of quoting its utilities, which is the
truer statement anyway: those tokens and their reduced-motion fallback are
tooltip's contract.
The chip's appearance changed on purpose — fixed 24/32px heights instead of
padding-driven, a pill radius, and text-label-sm at medium — so all six modes
diverged by 1.6-2.9%. Adds the snapshots for the new Types and Clickable
stories.
`filled` specified `bg-(--bg-surface-raised )` — with a stray space inside the
paren shorthand. The space terminates the Tailwind candidate, so the utility
compiled to no CSS at all and every `filled` chip has been fully transparent in
both themes, distinguishable from an `outlined` one only by its shadow.

The token would not have carried the distinction anyway: `--bg-surface-raised`
resolves to the same value as `--bg-surface` in the light theme, so the
applied/available contrast it was meant to express existed in dark only.

So all three kinds now share one fill (`--bg-surface`) and one border
(`--border-default`), per Figma, and differ only in elevation — `filled` keeps
`--shadow-sm`, which is the job it was already doing alone. The remove glyph
drops to `--text-muted` at rest and rises to `--text-default` on hover: at rest
it is punctuation after a label, on hover it is what is being aimed at.

Measured in Chromium against the Figma frames, both themes: fill #0a0a0a,
border #ffffff1a, 32px tall, 12px sides (4px trailing when removable), 24px
remove control.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant