This file provides guidance to AI coding assistants when working with code in this repository.
@eventjet/react-seatmaps is a React component library for rendering interactive SVG-based seatmaps in ticketing systems. It provides visualization of seats, volumes (large seating areas), rows, and blocks with support for user interactions and styling.
Structure: Monorepo (pnpm workspaces) with single package at packages/seatmaps/
All commands run from packages/seatmaps/:
pnpm build # Build CJS + ESM via tsdown
pnpm dev # Watch mode with tsdown
pnpm test # Run tests with Vitest
pnpm test:watch # Watch mode for tests
pnpm lint # ESLint
pnpm typecheck # TypeScript type checking
pnpm storybook # Start Storybook dev server on port 6006
pnpm build-storybook # Build static Storybook
pnpm clean # Remove dist/ directory
pnpm api # Update API report (api-extractor)
pnpm api:check # Check for API changes (CI)Root level:
pnpm build # Build all packages
pnpm test # Run all tests
pnpm lint # Lint all packages
pnpm clean # Clean all packages- Seatmap - Root SVG wrapper that auto-calculates viewBox via MutationObserver, wraps children in TextSizeController for responsive text
- Volume - General admission areas where guests can use any seat within the area (rectangle or ellipse shape) with labels, click handlers, disabled/active states
- Seat - Individual seats (square or circular) with dynamic text sizing based on name length
- Row - Groups seats horizontally with optional left/right labels
- Block - Generic group wrapper with transform support (translate + rotate)
- Badge - Circular badge for displaying counts
- SeatCountBadge / SeatCountBadgeOnEllipse - Badge variants positioned on volumes
- length.ts - Coordinate scaling (divides by 10)
- useTransform.ts - Memoized SVG transform strings
- textSize.tsx - Context-based responsive font sizing via TextSizeController
- calculations.ts - Math for badge positioning on ellipses
Uses Emotion (@emotion/react, @emotion/styled) for dynamic SVG styling. Emotion packages are peer dependencies.
- Single
tsconfig.json(ES2020, strict mode, JSX react-jsx, bundler module resolution) - tsdown handles CJS/ESM bundling →
dist/ - Tests and stories excluded from compilation
- Vitest with jsdom environment
- React Testing Library for component tests
- Test files:
*.test.tsxalongside source files
Uses @microsoft/api-extractor to detect breaking changes:
- Public API tracked in
api/react-seatmaps.api.md - Run
pnpm apito update the report after intentional API changes - CI runs
pnpm api:checkand fails if API changed without updating the report
- ESLint with flat config (eslint.config.js), includes React and React Hooks plugins
- Prettier configured: 4-space tabs, single quotes, trailing commas, 120 char line width
- Pre-commit hooks via husky + lint-staged run lint and format checks
- All SVG coordinates go through
l()function for scaling (length.ts)
Use Conventional Commits format — release-please uses these to determine version bumps and generate the changelog automatically:
fix: <description>— patch release (bug fix)feat: <description>— minor release (new feature)feat!: <description>orBREAKING CHANGE:in footer — major releasechore:,docs:,test:,refactor:— no release triggered
Releases are fully automated. After merging to master, release-please opens a Release PR that bumps package.json and updates CHANGELOG.md. Merging the Release PR creates the GitHub Release, which triggers CI to publish to npm.
Never manually create GitHub Releases or edit package.json version — let release-please manage both. The current published version is always visible in .release-please-manifest.json.
If the publish job is ever skipped or fails, trigger it manually via Actions → Release → Run workflow on master.