# Motion Phase A — Filters & Dropdowns Design

**Date:** 2026-08-07  
**Branch:** `feature/ui-ux-revamp`  
**Status:** Approved for planning  
**Scope:** Phase A only (Phase B — full UI kit Motion pass — deferred)

## Goal

Replace basic/native filter dropdowns with a premium Motion.dev experience that matches the purple inset-shell UI, while keeping filter logic, APIs, and accessibility intact.

## Decisions (locked)

| Decision | Choice |
|----------|--------|
| Sequencing | Phase A (filters/dropdowns) now; Phase B (full kit) later |
| Architecture | Radix + Motion layer (not custom menus from scratch) |
| Long lists | Hybrid: searchable combobox when `options.length > 12` |
| Motion feel | Premium presence — soft springs, fade+scale overlays; no bounce-heavy demos |
| Reduced motion | Honor `prefers-reduced-motion` everywhere |

## Motion system extensions

Extend `lib/motion.ts` (keep existing tokens):

- `overlayEnter` / `overlayExit` — menus, select content, popovers (fade + slight scale, ~180–220ms, `easeOutExpo` / `springSoft`)
- `press` — tap scale ≈ 0.98 for triggers
- `hoverLift` — reserved for Phase B cards; optional light use on filter triggers if it helps consistency

Rules:

- Prefer opacity + translateY/scale; avoid layout thrash on dense filter rows
- Disable transform animations when `useReducedMotion()` is true; opacity-only or instant is fine
- Reuse tokens — no one-off durations scattered in page files

## Components

### 1. Upgrade `components/ui/select.tsx`

- Keep `@radix-ui/react-select` API
- Animate `SelectContent` with Motion (`AnimatePresence` / mount enter-exit)
- Style active/selected item with primary purple (no browser blue highlight)
- Chevron rotate on open; checkmark can use a short scale-in
- Visual: rounded-xl panel, soft shadow, stone/purple tokens, light + dark

### 2. Upgrade `components/ui/dropdown-menu.tsx`

- Same overlay motion language as Select
- Item hover/focus uses accent surface; no harsh flash
- Used by row actions (Users, Projects) — benefit comes “for free” from the primitive

### 3. New `components/ui/combobox.tsx`

- Built from existing `Popover` + `Command` (`cmdk`)
- Searchable list, keyboard nav, empty state (“No results”)
- Motion panel enter/exit matching Select
- Props oriented around `value`, `onValueChange`, `options: { value, label }[]`, `placeholder`, `disabled`, `className`

### 4. New `components/ui/filter-select.tsx`

Single filter-bar API:

```tsx
<FilterSelect
  value={value}
  onValueChange={setValue}
  options={[{ value: 'all', label: 'All Managers' }, ...]}
  placeholder="All Managers"
  searchThreshold={12} // default
  className="..."
/>
```

Behavior:

- If `options.length <= searchThreshold` → render Motion `Select`
- If `options.length > searchThreshold` → render `Combobox`
- Callers do not choose mode; hybrid is automatic

## Migration targets (native `<select>` → `FilterSelect`)

| Location | Notes |
|----------|--------|
| `app/dashboard/users/page.tsx` | Priority — Roles, Departments, Designations, Managers, Employment, Status, Tech, etc. |
| `app/dashboard/projects/page.tsx` | Filter selects |
| `app/dashboard/departments/page.tsx` | Filter + dialog selects where native |
| `app/dashboard/designations/page.tsx` | Filter + dialog selects where native |
| `app/dashboard/logged-hours/page.tsx` | User picker |
| `components/users/it-work-history.tsx` | Native selects in UI |

### Explicitly out of Phase A

- `components/ui/rich-text-editor.tsx` font size/family native select
- Full Motion pass on inputs, tabs, toasts, checkboxes, switches, tables, accordions (Phase B)
- Business logic / API / filter predicate changes
- Replacing Radix Select already used in modals with Combobox unless those option lists exceed threshold and are migrated to `FilterSelect` for consistency

Modals that already import `@/components/ui/select` get visual/motion upgrades via the shared Select primitive only.

## Constraints

- No auth, API, or filter-value semantics changes — same strings/handlers
- Keyboard and screen-reader parity via Radix / cmdk
- Light and dark theme parity
- Performance: no continuous animations on closed menus; animate only open/close and micro-interactions
- Stay on `feature/ui-ux-revamp`

## Acceptance criteria

1. Users page filter bar never shows a browser-default `<select>` menu
2. Opening a short filter shows a polished Motion Select; opening Managers (long list) shows searchable Combobox
3. Dropdown menus (row actions) share the same overlay motion language
4. Purple primary active/selected states; no default blue OS highlight
5. `prefers-reduced-motion` reduces or removes transform animations
6. `npx tsc --noEmit` passes

## Non-goals (Phase B later)

Buttons (beyond current), cards, modals/dialogs polish beyond Select content, form inputs, checkbox/radio/switch, tooltips/popovers Motion, tabs, sidebar extras, tables, accordions, toasts, page-transition upgrades beyond current shell.
