# Poker Arena components

Mirror of `ds/project/components/index.d.ts` and `bundle.js` (namespace `PokerArena`, React 18). Native CSS only: custom-property tokens, native nesting, `@layer tokens, base, shared, components`, `color-mix()` in bundle.css only, `@property`, `linear()`, `@starting-style`, view transitions and `offset-path`. Class names map one to one onto a CSS Module per component: `.Button_root` is `styles.root` in `Button.module.css`, `.Button_primary` is `styles.primary`.

Theming: `data-theme` (arena, felt, arcade, calm), `data-mode` (light, dark) and `data-accent` (indigo, pink, teal, orange, green, blue) on the one `.arena` root.

## Shared classes

Defined in `@layer shared` in bundle.css. Apply them next to the component class.

### .focus-ring

Solid 3px focus outline on keyboard focus. Every interactive element.

Tokens: `focus`

```css
  .focus-ring:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
  }
```

### .card-shadow

Soft lift for panels such as TicketPanel.

Tokens: `shadow-soft`

```css
  .card-shadow { box-shadow: var(--shadow-soft); }
```

### .hard-shadow

The signature ink ring plus accent-2 offset. Selected card, table, Modal.

Tokens: `shadow-hard`, `edge`, `accent-2`

```css
  .hard-shadow { box-shadow: var(--shadow-hard); }
```

### .hard-shadow-sm

Small hard shadow: seat cards, the NavBar mark.

Tokens: `shadow-hard-sm`, `edge`, `accent-2`

```css
  .hard-shadow-sm { box-shadow: var(--shadow-hard-sm); }
```

### .pressed

Pressed state of a hard-shadow element.

Tokens: `shadow-pressed`, `edge`, `accent-2`

```css
  .pressed { box-shadow: var(--shadow-pressed); translate: 2px 3px; }
```

### .pill

Fully rounded ends: badges, chips, timer, tags.

Tokens: `radius-pill`

```css
  .pill { border-radius: var(--radius-pill); }
```

### .visually-hidden

Hidden on screen, read by screen readers: radio inputs in Deck, labels in NavBar.

Tokens: none

```css
  .visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
```

### .reduced-motion

On ArenaRoot. Under prefers-reduced-motion it removes movement and turns transitions into a 150 ms crossfade.

Tokens: `dur-crossfade`

```css
  @media (prefers-reduced-motion: reduce) {
    .reduced-motion, .reduced-motion * {
      animation: none !important;
      transition-property: opacity, color, background-color, border-color, box-shadow !important;
      transition-duration: var(--dur-crossfade) !important;
      transition-delay: 0ms !important;
      translate: none !important;
      scale: none !important;
      --lift: 0px;
      --squash: 1;
    }
    ::view-transition-group(*) { animation-duration: var(--dur-crossfade); }
    ::view-transition-old(root), ::view-transition-new(root) { animation: var(--dur-crossfade) linear both fade; }
  }
```

## Motion entries

From `design-motion.json`. Registered properties: `--lift` (<length>), `--squash` (<number>), `--flip` (<angle>), `--burst` (<number>), `--i` (<integer>, inherits). Stagger delay: `calc(var(--i) * var(--stagger))`.

| Entry | Duration | Easing | Delay | Technique | Reduced motion |
| --- | --- | --- | --- | --- | --- |
| anticipation-lift | 300 ms | `var(--ease-spring)` | `0ms` | @property | none |
| card-pick-squash | 320 ms | `var(--ease-squash)` | `0ms` | @property | 150 ms opacity crossfade |
| staggered-flip | 420 ms | `var(--ease-in-out)` | `calc(var(--i) * var(--stagger))` | @property + view-transition | 150 ms opacity crossfade, no stagger |
| reveal-countdown | 3000 ms | `var(--ease-out)` | `0ms` | @starting-style | Numbers swap with a 150 ms opacity crossfade, no scale |
| consensus-confetti | 1400 ms | `var(--ease-out)` | `calc(var(--i) * 20ms)` | @property | none |
| throwable-arc | 900 ms | `cubic-bezier(.33,0,.67,1)` | `0ms` | offset-path | none |
| toast-in-out | 180 ms | `var(--ease-out)` | `0ms` | @starting-style | 150 ms opacity only |
| modal-open | 180 ms | `var(--ease-out)` | `0ms` | @starting-style | 150 ms opacity only |
| argue-panel-slide | 320 ms | `var(--ease-out)` | `0ms` | @starting-style | 150 ms opacity only |
| page-transition | 260 ms | `var(--ease-out)` | `0ms` | view-transition | 150 ms root crossfade, no slide |

## ArenaRoot

The provider every Poker Arena screen sits inside: it holds the theme, mode and accent and renders the .arena root with data-theme, data-mode and data-accent.

```html
<x-import component-from-global-scope="PokerArena.ArenaRoot" theme="felt" mode="dark"></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `theme` | `'arena' \| 'felt' \| 'arcade' \| 'calm'` | 'arena' | Starting theme. |
| `mode` | `'light' \| 'dark'` | 'light' | Starting mode. |
| `accent` | `'indigo' \| 'pink' \| 'teal' \| 'orange' \| 'green' \| 'blue'` | undefined | Accent preset; leave it out for the theme's own accent. |
| `onChange` | `(next: { theme: string; mode: string; accent?: string }) => void` | undefined | Called when NavBar or useArena changes a value. |
| `as` | `keyof JSX.IntrinsicElements` | 'div' | Element to render. |
| `className` | `string` | undefined | Extra class. |
| `style` | `React.CSSProperties` | undefined | Inline style. |
| `children` | `React.ReactNode` | undefined | The screen. |

- Variants and states: 4 themes x 2 modes, plus 6 accent presets
- Tokens: `bg`, `text`, `font-ui`, `body-size`, `body-lh`
- Shared classes: `.reduced-motion`
- Motion: page-transition
- CSS Module: `ArenaRoot.module.css`, classes `.ArenaRoot_*` in bundle.css

## NavBar

The top bar: brand, page links, the signed-in person and the theme picker, accent picker and light or dark toggle, all wired to ArenaRoot.

```html
<x-import component-from-global-scope="PokerArena.NavBar"></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `brand` | `string` | 'Poker Arena' | Brand text beside the mark. |
| `brandHref` | `string` | '#' | Brand link. |
| `links` | `Array<{ label: string; href?: string; current?: boolean }>` | [] | Page links; current sets aria-current="page". |
| `user` | `{ name: string; seed?: string }` | undefined | Signed-in person, shown as an Avatar. |
| `controls` | `boolean` | true | Show the theme segmented control, the accent swatches (Theme default first, which clears the accent) and the mode toggle. |
| `className` | `string` | undefined | Extra class. |

- Variants and states: with or without controls, link current state, mode toggle pressed, accent Theme default, collapsed behind a Menu button under 600px
- Tokens: `surface`, `text`, `muted`, `hairline`, `border`, `accent`, `accent-fg`, `focus`, `font-display`, `radius-md`, `shadow-hard-sm`
- Shared classes: `.focus-ring`, `.visually-hidden`, `.hard-shadow-sm`
- Motion: none
- CSS Module: `NavBar.module.css`, classes `.NavBar_*` in bundle.css

## Button

Buttons for actions; primary is the one thing a view is for, with an ink edge and a drop shadow that presses down.

```html
<x-import component-from-global-scope="PokerArena.Button" variant="primary">Save</x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `variant` | `'primary' \| 'secondary' \| 'ghost' \| 'danger'` | 'primary' | Visual weight. |
| `size` | `'sm' \| 'md' \| 'lg'` | 'md' | Height 32, 40 or 52. |
| `disabled` | `boolean` | false | Disables; on a link sets aria-disabled and drops href. |
| `icon` | `React.ReactNode` | undefined | Leading icon; alone it makes an icon button, so pass aria-label. |
| `href` | `string` | undefined | Renders an <a> instead of a <button>. |
| `type` | `'button' \| 'submit' \| 'reset'` | 'button' | Button type. |
| `className` | `string` | undefined | Extra class. |
| `children` | `React.ReactNode` | undefined | Label, verb first, sentence case. |

- Variants and states: primary, secondary, ghost, danger, sm, md, lg, hover, active (pressed), focus, disabled, icon only, link
- Tokens: `accent`, `accent-hover`, `accent-fg`, `edge`, `shadow-button`, `surface`, `surface-2`, `text`, `border`, `danger`, `focus`, `radius-md`, `dur-fast`, `ease-out`
- Shared classes: `.focus-ring`
- Motion: none
- CSS Module: `Button.module.css`, classes `.Button_*` in bundle.css

## Input

A labelled text field with an optional hint and an error message tied to it by aria-describedby.

```html
<x-import component-from-global-scope="PokerArena.Input" label="Room name" hint="Guests see this"></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `label` | `string` | required | Visible label. |
| `hint` | `string` | undefined | Help text under the field. |
| `error` | `string` | undefined | Error text; also sets aria-invalid and the danger border. |
| `id` | `string` | auto | Field id. |
| `className` | `string` | undefined | Extra class on the wrapper. |
| `...rest` | `React.InputHTMLAttributes<HTMLInputElement>` | - | Passed to the <input>. |

- Variants and states: default, with hint, error, disabled
- Tokens: `surface`, `text`, `muted`, `border`, `danger`, `focus`, `radius-md`, `small-size`
- Shared classes: `.focus-ring`
- Motion: none
- CSS Module: `Input.module.css`, classes `.Input_*` in bundle.css

## Badge

A short status label; tone always comes with words and, where it helps, an icon.

```html
<x-import component-from-global-scope="PokerArena.Badge" tone="live">Voting now</x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `tone` | `'neutral' \| 'success' \| 'warning' \| 'danger' \| 'live' \| 'invite-only' \| 'public' \| 'high' \| 'low'` | 'neutral' | Meaning. |
| `icon` | `false` | undefined | Pass false to hide the default icon. |
| `className` | `string` | undefined | Extra class. |
| `children` | `React.ReactNode` | tone default | Text; defaults to Voting now, Invite only, Public, High, Low and so on. |

- Variants and states: neutral, success, warning, danger, live, invite-only, public, high, low
- Tokens: `surface-2`, `text`, `success-bg`, `success-fg`, `surface`, `warning`, `danger`, `live-bg`, `live-fg`, `border`, `high-bg`, `high-fg`, `low-bg`, `low-fg`, `radius-pill`
- Shared classes: `.pill`
- Motion: none
- CSS Module: `Badge.module.css`, classes `.Badge_*` in bundle.css

## Chip

A compact tag for filters and labels, optionally selectable and removable.

```html
<x-import component-from-global-scope="PokerArena.Chip" selected="true">Backend</x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `selected` | `boolean` | false | Selected look; with onClick sets aria-pressed. |
| `onClick` | `() => void` | undefined | Makes the chip a toggle button. |
| `onRemove` | `() => void` | undefined | Shows a remove button labelled "Remove <text>". |
| `className` | `string` | undefined | Extra class. |
| `children` | `React.ReactNode` | undefined | Label. |

- Variants and states: default, selected, removable, toggle (unselected toggle has a border)
- Tokens: `surface-2`, `text`, `hairline`, `accent`, `accent-fg`, `edge`, `focus`, `radius-pill`
- Shared classes: `.pill`, `.focus-ring`
- Motion: none
- CSS Module: `Chip.module.css`, classes `.Chip_*` in bundle.css

## Avatar

A generated face from a seed, drawn as inline SVG so it recolours with the theme.

```html
<x-import component-from-global-scope="PokerArena.Avatar" seed="Mia" size="lg"></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `seed` | `string` | name | Any stable string; same seed, same face. |
| `name` | `string` | undefined | Accessible name; without it the avatar is decorative. |
| `size` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | 'md' | 24, 32, 40, 56 or 80 px. |
| `className` | `string` | undefined | Extra class. |

- Variants and states: xs, sm, md, lg, xl, 6 tones (hair and face tint) x 3 eyes x 3 mouths x 3 hair shapes
- Tokens: `card-face`, `card-fg`, `accent`, `accent-2`, `success`, `warning`, `card-back`, `low-fg`
- Shared classes: none
- Motion: none
- CSS Module: `Avatar.module.css`, classes `.Avatar_*` in bundle.css

## PlayingCard

One estimate card, face up or down, with every state the table needs from vote to consensus.

```html
<x-import component-from-global-scope="PokerArena.PlayingCard" value="5" state="selected"></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `value` | `string` | undefined | Card value, such as 3 or ?; coffee draws the cup icon, read as Coffee break. |
| `state` | `'face-down' \| 'default' \| 'hover' \| 'selected' \| 'focus' \| 'voted' \| 'revealed' \| 'consensus' \| 'high' \| 'low'` | 'default' | Visual state; hover and focus are forced looks for showcases. |
| `size` | `'xs' \| 'sm' \| 'md' \| 'lg'` | 'md' | Width 30, 44, 64 or 88 px. |
| `index` | `number` | undefined | Seat index; sets --i for the staggered flip. |
| `onClick` | `() => void` | undefined | Makes it a button with aria-pressed. |
| `className` | `string` | undefined | Extra class. |

- Variants and states: face-down, default, hover, selected, focus, voted, revealed, consensus, high, low, xs, sm, md, lg
- Tokens: `card-face`, `card-fg`, `card-back`, `card-back-dot`, `edge`, `accent-2`, `accent-2-fg`, `focus`, `success-bg`, `success-fg`, `high-bg`, `high-fg`, `low-bg`, `low-fg`, `surface`, `text`, `shadow-hard`, `shadow-hard-sm`, `glow-consensus`, `radius-card`, `font-num`, `dur-flip`, `stagger`, `ease-in-out`, `ease-squash`, `ease-spring`
- Shared classes: `.focus-ring`, `.pill`
- Motion: anticipation-lift, card-pick-squash, staggered-flip
- CSS Module: `PlayingCard.module.css`, classes `.PlayingCard_*` in bundle.css

## Deck

The hand of cards a person votes with: a fieldset of real radio inputs, the hours deck by default: 1 2 3 5 8 13 21 34 ? and a coffee card.

```html
<x-import component-from-global-scope="PokerArena.Deck" deck="hours"></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `deck` | `'hours' \| 'fibonacci' \| 'tshirt'` | 'hours' | Built-in deck: hours is 1 2 3 5 8 13 21 34 ? coffee, fibonacci is the points deck. |
| `values` | `string[]` | undefined | Custom values; overrides deck. |
| `value` | `string` | undefined | Controlled value. |
| `defaultValue` | `string` | undefined | Uncontrolled starting value. |
| `onChange` | `(value: string) => void` | undefined | Called with the picked value. |
| `name` | `string` | auto | Radio group name. |
| `legend` | `string` | 'Your estimate (<unit>)' | Visible legend. |
| `unit` | `'hours' \| 'points' \| 'none'` | from deck | Unit read out with each value (1 hour, 5 points). |
| `disabled` | `boolean` | false | Locks the deck, for example after the reveal. |
| `className` | `string` | undefined | Extra class. |

- Variants and states: hours: 1 2 3 5 8 13 21 34 ? coffee (stroke cup icon, read as Coffee break), fibonacci (points: 0 1 2 3 5 8 13 21 34 ?), tshirt, unpicked, hover, focus, checked, disabled
- Tokens: `card-face`, `card-fg`, `edge`, `accent-2`, `accent-2-fg`, `focus`, `text`, `shadow-hard`, `shadow-hard-sm`, `radius-card`, `font-num`, `ease-spring`, `ease-squash`, `dur-base`, `dur-slow`
- Shared classes: `.visually-hidden`, `.focus-ring`
- Motion: anticipation-lift, card-pick-squash
- CSS Module: `Deck.module.css`, classes `.Deck_*` in bundle.css

## Seat

One person at the table: their card slot, face, name and a status line in words.

```html
<x-import component-from-global-scope="PokerArena.Seat" name="Theo" state="voted"></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `name` | `string` | required | Display name. |
| `seed` | `string` | name | Avatar seed. |
| `state` | `'idle' \| 'thinking' \| 'voted' \| 'away' \| 'revealed'` | 'idle' | Where they are in the round. |
| `value` | `string` | undefined | Their card once revealed. |
| `result` | `'high' \| 'low' \| 'consensus'` | undefined | Outcome after the reveal. |
| `host` | `boolean` | false | Shows the host crown. |
| `you` | `boolean` | false | Marks the current person with a You tag. |
| `index` | `number` | undefined | Seat index; sets --i for the stagger. |
| `className` | `string` | undefined | Extra class. |

- Variants and states: idle, thinking, voted, away, host, you, revealed value, high, low, consensus
- Tokens: `text`, `muted`, `border`, `accent`, `accent-fg`, `accent-2`, `accent-2-fg`, `edge`, `radius-pill`, `radius-sm`, `stagger`
- Shared classes: `.visually-hidden`, `.pill`
- Motion: staggered-flip
- CSS Module: `Seat.module.css`, classes `.Seat_*` in bundle.css

## TicketPanel

The ticket being estimated: key, status, title and description, with room for extra content.

```html
<x-import component-from-global-scope="PokerArena.TicketPanel" ticketKey="PA-101" title="Let guests export their trip history as CSV"></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ticketKey` | `string` | undefined | Ticket key, such as PA-101. |
| `href` | `string` | undefined | Link for the key. |
| `title` | `string` | required | Ticket title. |
| `description` | `string` | undefined | Short description. |
| `status` | `string` | undefined | Badge text. |
| `statusTone` | `BadgeProps['tone']` | 'live' | Badge tone. |
| `className` | `string` | undefined | Extra class. |
| `children` | `React.ReactNode` | undefined | Extra content under the description. |

- Variants and states: with link, with status, with children
- Tokens: `surface`, `hairline`, `accent`, `text`, `muted`, `shadow-soft`, `radius-lg`, `font-display`, `font-num`
- Shared classes: `.hard-shadow-sm`, `.focus-ring`
- Motion: none
- CSS Module: `TicketPanel.module.css`, classes `.TicketPanel_*` in bundle.css

## ArgueItem

One person explaining an outlier vote after the reveal: face, name, value, High or Low, and their reason.

```html
<x-import component-from-global-scope="PokerArena.ArgueItem" name="Rafi" value="13" outlier="high" reason="The export touches three services."></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `name` | `string` | required | Display name. |
| `seed` | `string` | name | Avatar seed. |
| `value` | `string` | required | Their card. |
| `outlier` | `'high' \| 'low'` | undefined | Outlier badge. |
| `reason` | `string` | required | What they said. |
| `index` | `number` | undefined | Order in the list; sets --i for the slide-in stagger. |
| `className` | `string` | undefined | Extra class. |

- Variants and states: high, low, no outlier
- Tokens: `surface`, `hairline`, `text`, `high-bg`, `high-fg`, `low-bg`, `low-fg`, `radius-lg`, `font-num`, `dur-slow`, `ease-out`, `stagger`
- Shared classes: `.pill`
- Motion: argue-panel-slide
- CSS Module: `ArgueItem.module.css`, classes `.ArgueItem_*` in bundle.css

## Timer

A round timer showing minutes and seconds, turning to the warning style with the word Low near the end.

```html
<x-import component-from-global-scope="PokerArena.Timer" seconds="95"></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `seconds` | `number` | 0 | Seconds left; the component does not count down itself. |
| `lowAt` | `number` | 30 | Seconds at which it turns low. |
| `label` | `string` | 'Time left' | Accessible label prefix. |
| `className` | `string` | undefined | Extra class. |

- Variants and states: normal, low
- Tokens: `surface`, `text`, `border`, `warning`, `font-num`, `radius-pill`
- Shared classes: `.pill`
- Motion: reveal-countdown
- CSS Module: `Timer.module.css`, classes `.Timer_*` in bundle.css

## Toast

A brief message after something happens, such as a copied link or a person joining.

```html
<x-import component-from-global-scope="PokerArena.Toast" tone="success" title="Invite link copied"></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `tone` | `'neutral' \| 'success' \| 'warning' \| 'danger'` | 'neutral' | Meaning; danger uses role alert. |
| `title` | `string` | undefined | First line. |
| `onClose` | `() => void` | undefined | Shows a Dismiss button. |
| `className` | `string` | undefined | Extra class. |
| `children` | `React.ReactNode` | undefined | Second line. |

- Variants and states: neutral, success, warning, danger, dismissible
- Tokens: `surface`, `text`, `muted`, `edge`, `surface-2`, `success-bg`, `success-fg`, `high-bg`, `high-fg`, `danger`, `shadow-hard-sm`, `radius-md`, `dur-base`, `ease-out`
- Shared classes: `.focus-ring`
- Motion: toast-in-out
- CSS Module: `Toast.module.css`, classes `.Toast_*` in bundle.css

## Modal

A dialog for one focused task or confirmation, with a title, body and footer actions.

```html
<x-import component-from-global-scope="PokerArena.Modal" open="true" title="End this room?"></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `open` | `boolean` | false | Shows the dialog. |
| `title` | `string` | required | Heading; focused on open. |
| `onClose` | `() => void` | undefined | Close button, Esc and backdrop click. |
| `footer` | `React.ReactNode` | undefined | Actions, primary last. |
| `inline` | `boolean` | false | Renders in flow, not as a modal, and never moves focus: for previews and artboards. |
| `className` | `string` | undefined | Extra class. |
| `children` | `React.ReactNode` | undefined | Body. |

- Variants and states: open (native modal dialog: focus trap, inert page, Esc, focus back to the trigger), closed, inline
- Tokens: `surface`, `text`, `edge`, `hairline`, `surface-2`, `shadow-hard`, `radius-xl`, `radius-md`, `font-display`, `dur-base`, `ease-out`
- Shared classes: `.hard-shadow`, `.focus-ring`
- Motion: modal-open
- CSS Module: `Modal.module.css`, classes `.Modal_*` in bundle.css

## ThemeShowcase

A small table scene in one theme and mode, used to compare themes side by side.

```html
<x-import component-from-global-scope="PokerArena.ThemeShowcase" theme="arcade" mode="dark"></x-import>
```

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `theme` | `'arena' \| 'felt' \| 'arcade' \| 'calm'` | 'arena' | Theme to show. |
| `mode` | `'light' \| 'dark'` | 'light' | Mode to show. |
| `accent` | `'indigo' \| 'pink' \| 'teal' \| 'orange' \| 'green' \| 'blue'` | undefined | Optional accent preset. |
| `className` | `string` | undefined | Extra class. |

- Variants and states: arena, felt, arcade, calm, light, dark
- Tokens: `bg`, `text`, `muted`, `hairline`, `table`, `edge`, `radius-xl`, `radius-table`, `font-display`
- Shared classes: none
- Motion: staggered-flip
- CSS Module: `ThemeShowcase.module.css`, classes `.ThemeShowcase_*` in bundle.css
