Skip to content

feat(list-selectable): add cornerTag prop with Highlight Corner Tag (MR-490)#1241

Closed
leonardodouradol wants to merge 1 commit into
ocean-ds:masterfrom
leonardodouradol:feat/list-selectable-corner-tag
Closed

feat(list-selectable): add cornerTag prop with Highlight Corner Tag (MR-490)#1241
leonardodouradol wants to merge 1 commit into
ocean-ds:masterfrom
leonardodouradol:feat/list-selectable-corner-tag

Conversation

@leonardodouradol
Copy link
Copy Markdown
Collaborator

Re-open of #1240 targeting master. Original author: @igor-monteiro-almeida.

Summary

Adds support for the Highlight Corner Tag in ListSelectable (and ListReadOnly via isSelectableDisabled). The new CornerTag lives as an internal subcomponent under src/CornerTag/ (not exported publicly in this release) and is rendered as an overlay at the top-right corner of card containers.

  • New CornerTag component with primaryDown / complementaryPure colors (tokens: $color-brand-primary-down / $color-complementary-pure)
  • ListSelectable receives a new cornerTag prop via discriminated union: only allowed when type='card'; type='text' sets cornerTag?: never to block at compile-time (per spec OQ-S6 — no runtime warns)
  • ListContainer renders CornerTag conditionally for type='card' (single source of truth)
  • ListReadOnly accepts and forwards cornerTag (covers isSelectableDisabled flow)
  • Stories cover all V-02..V-14 variants from the spec
  • Unit tests cover CornerTag standalone + 16 ListSelectable variants
  • 722 tests passing in full ocean-react suite — zero regressions

Spec & PRD

API contract

<ListSelectable
  type="card"
  title="Plano Premium"
  description="R$ 49,90/mês"
  checkbox={{ id: 'plan-1' }}
  cornerTag={{ label: 'Recomendado' }}                       // primaryDown (default)
/>

<ListSelectable
  type="card"
  title="Plano Plus"
  radio={{ id: 'plan-2', name: 'plan' }}
  cornerTag={{ label: 'Novo', color: 'complementaryPure' }}
/>

type='text' + cornerTag is blocked by TypeScript (discriminated union).

Test plan

  • yarn lint — zero errors on changed files
  • yarn jest (ocean-react) — 722/722 passing, 64 suites, zero regressions
  • CornerTag unit tests — primaryDown/complementaryPure colors, empty label, long label, custom className
  • ListSelectable unit tests — V-02..V-14 variants (only inline / only corner / both / none / type=text / disabled / loading / selected / error / checkbox / radio / complementaryPure / forwarded to ListReadOnly when isSelectableDisabled)
  • Visual regression (Storybook snapshots) — to be checked by reviewer
  • A11y review — span + aria-label, no role="status", reading order after card content

Decisions resolved during the spec

  • cornerTag is a discriminated-union prop — type='text' blocks usage at compile-time
  • CornerTag is internal-only (not exported in src/index.ts this release; future export is a follow-up when consumers like CardGroup need it)
  • Tokens reused from existing scss: $color-brand-primary-down, $color-complementary-pure, $font-family-base, $font-weight-extrabold, $font-size-xxxs
  • ListContainer (shared) is the single source of truth — ListSelectable and ListReadOnly both inherit support automatically

…MR-490)

Adds support for the Highlight Corner Tag in ListSelectable, ListReadOnly and the
shared ListContainer. The new CornerTag component lives as an internal subcomponent
under src/CornerTag (not exported publicly in this release) and is rendered as an
overlay at the top-right corner of card containers.

- New CornerTag component with primaryDown/complementaryPure colors
- ListSelectable receives a cornerTag prop via discriminated union: only allowed
  when type='card'; type='text' sets cornerTag?: never to block at compile-time
- ListContainer renders CornerTag conditionally for type='card'
- ListReadOnly accepts and forwards cornerTag (covers isSelectableDisabled)
- New stories cover all V-02..V-14 variants from the spec
- Unit tests cover CornerTag standalone + 16 ListSelectable variants
- SCSS uses tokens: $color-brand-primary-down / $color-complementary-pure

Spec: https://github.com/Pagnet/pagnet/issues/16178#issuecomment-4343595459

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant