Skip to content

Add Collapsible, PreviewCard, and Drawer components#113

Merged
jaymantri merged 3 commits intomainfrom
feature/collapsible-component
Feb 27, 2026
Merged

Add Collapsible, PreviewCard, and Drawer components#113
jaymantri merged 3 commits intomainfrom
feature/collapsible-component

Conversation

@jaymantri
Copy link
Contributor

@jaymantri jaymantri commented Feb 27, 2026

Summary

  • Collapsible — wraps Base UI Collapsible with animated expand/collapse via CSS grid transition
  • PreviewCard — wraps Base UI PreviewCard for hover-triggered popups (link previews, user cards)
  • Drawer — wraps Base UI Drawer with direction-aware CSS (data-swipe-direction handles bottom sheets, left/right panels), swipe-to-dismiss, and snap point support

All three follow the compound component pattern with analytics tracking (useTrackedOpenChange), display names, Playwright CT tests, and Storybook stories. Demo page sections alphabetized.

Test plan

  • Playwright CT tests pass for all three components (26 tests total)
  • Storybook stories render correctly
  • Demo page shows realistic use cases (bottom sheet, side panel from table row)
  • Visual review of bottom sheet (full-width, slides up)
  • Visual review of right panel (slides in from right, swipe-to-dismiss right)

BREAKING CHANGE: 20 tokens removed, 12 added, values changed on --border-primary.

## Token Rename Map

Old Token                        → New Token
--border-tertiary                → --border-primary
--border-inverted                → --border-inverse
--surface-inverted               → --surface-inverse
--surface-inverted-hover         → --surface-inverse-hover
--surface-strong                 → --surface-neutral
--surface-elevated               → --surface-panel
--surface-sunken                 → --surface-secondary
--text-surface                   → --text-inverse
--icon-surface                   → --icon-inverse
--icon-inverted                  → --icon-inverse
--input-focus (color)            → --state-focus
--input-focus-critical (color)   → --state-focus-critical

Note: --input-focus/--input-focus-critical in _effects.scss (full
box-shadow values) are unchanged. Only the color tokens moved to state-*.

## New Tokens

--border-focus    Solid border for focus outlines (split from old --border-primary)
--stroke-primary  Solid stroke for charts/data visualization only
--surface-panel   Background for floating UI: dialogs, tooltips, popovers, action bars
--text-link       Link text color

## Removed Tokens (no replacement)

--border-hover, --text-muted, --surface-active, --surface-selected,
--surface-inverted-backdrop, --icon-info-inverted, --icon-success-inverted,
--icon-warning-inverted, --icon-critical-inverted

## Silent Value Change: --border-primary

--border-primary still exists but changed value from solid to alpha:
- Light: #1A1A1A → rgba(38, 38, 35, 0.10)
- Dark: #F8F8F7 → rgba(244, 244, 245, 0.10)

This will NOT surface as a build error. Consumers using --border-primary
directly should audit:
- Focus outlines → switch to --border-focus
- Chart strokes → switch to --stroke-primary
- Default UI borders (dividers, card edges) → no action, alpha is correct

## Dark Mode Surface Recalibration

--surface-panel: #111111 → #212121 (lifts panels above --surface-primary)
--surface-secondary: #282828 → #111111 (recedes behind --surface-primary)

## Consumer Migration

No sequencing required. Bump Origin, find-and-replace old token names,
audit --border-primary and --input-focus usage, test dark mode.

Made-with: Cursor
Single-panel show/hide component — simpler alternative to Accordion
for standalone sections like advanced settings or optional details.

- Root, Trigger, Panel parts following compound component pattern
- Default chevron icon with hideIcon and icon override props
- Animated height transition matching Accordion (200ms ease-out)
- Reduced motion support
- Analytics tracking via analyticsName prop
- 12 Playwright CT tests covering core, keyboard, controlled, disabled
- Storybook stories for all variants
- Exported from package index

Made-with: Cursor
@vercel
Copy link

vercel bot commented Feb 27, 2026

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

Project Deployment Actions Updated (UTC)
origin-storybook Ready Ready Preview, Comment Feb 27, 2026 7:49am

Request Review

@jaymantri jaymantri changed the title Add Collapsible component Add Collapsible, PreviewCard, and Drawer components Feb 27, 2026
Both follow the compound component pattern with analytics tracking,
display names, and direction-aware CSS (Drawer handles bottom/left/right
via data-swipe-direction). Demo page sections alphabetized.

Code review fixes: unified index.ts namespace pattern across all three
components, added Collapsible displayName and useTrackedOpenChange,
removed no-op box-shadow transition from Drawer, added JSDoc to
Collapsible.Trigger documenting inner span structure, made PreviewCard
max-width configurable via --preview-card-max-width custom property.

Made-with: Cursor
@jaymantri jaymantri force-pushed the feature/collapsible-component branch from fe2bdb0 to 787c93d Compare February 27, 2026 07:48
@jaymantri jaymantri merged commit efa8afd into main Feb 27, 2026
6 checks passed
@jaymantri jaymantri deleted the feature/collapsible-component branch February 27, 2026 16:58
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