diff --git a/package.json b/package.json index bc3de87e4da..c09a7f053d9 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@babel/preset-react": "^7.24.7", "@babel/preset-typescript": "^7.24.7", "@codecademy/eslint-config": "8.0.0", + "@codecademy/gamut": "workspace:*", "@codecademy/prettier-config": "^0.2.0", "@codecademy/tsconfig": "^0.3.0", "@commander-js/extra-typings": "^14.0.0", diff --git a/packages/gamut-styles/CHANGELOG.md b/packages/gamut-styles/CHANGELOG.md index d8686d34edd..5913d55f8aa 100644 --- a/packages/gamut-styles/CHANGELOG.md +++ b/packages/gamut-styles/CHANGELOG.md @@ -1,6 +1,6 @@ # 18.0.0 (2026-05-14) -### ⚠️ Breaking Changes +### ⚠️ Breaking Changes - Updates LXStudio theme to new guidelines ([#3341](https://github.com/Codecademy/gamut/pull/3341)) diff --git a/packages/gamut-tests/CHANGELOG.md b/packages/gamut-tests/CHANGELOG.md index 4e4f9ddb3da..92146696116 100644 --- a/packages/gamut-tests/CHANGELOG.md +++ b/packages/gamut-tests/CHANGELOG.md @@ -6,7 +6,7 @@ # 6.0.0 (2026-05-04) -### ⚠️ Breaking Changes +### ⚠️ Breaking Changes - remove setupEnzyme and remove deprecated comment for RadialProgress ([#3337](https://github.com/Codecademy/gamut/pull/3337)) diff --git a/packages/gamut/agent-tools/.claude-plugin/marketplace.json b/packages/gamut/agent-tools/.claude-plugin/marketplace.json new file mode 100644 index 00000000000..94dd30ebc4c --- /dev/null +++ b/packages/gamut/agent-tools/.claude-plugin/marketplace.json @@ -0,0 +1,16 @@ +{ + "name": "gamut-design-system", + "owner": { + "name": "Codecademy" + }, + "metadata": { + "description": "Local marketplace for @codecademy/gamut agent tools." + }, + "plugins": [ + { + "name": "gamut-design-system", + "source": "./", + "description": "Gamut design system agent tools: skills and rules for AI-assisted development." + } + ] +} diff --git a/packages/gamut/agent-tools/.claude-plugin/plugin.json b/packages/gamut/agent-tools/.claude-plugin/plugin.json new file mode 100644 index 00000000000..1061b0b02f3 --- /dev/null +++ b/packages/gamut/agent-tools/.claude-plugin/plugin.json @@ -0,0 +1,7 @@ +{ + "name": "gamut-design-system", + "version": "0.0.1", + "description": "Gamut design system agent tools: skills and rules for AI-assisted development.", + "license": "MIT", + "keywords": ["codecademy", "gamut", "design-system", "agent-skills"] +} diff --git a/packages/gamut/agent-tools/.cursor-plugin/plugin.json b/packages/gamut/agent-tools/.cursor-plugin/plugin.json new file mode 100644 index 00000000000..a77ec0e83d6 --- /dev/null +++ b/packages/gamut/agent-tools/.cursor-plugin/plugin.json @@ -0,0 +1,7 @@ +{ + "name": "gamut-design-system", + "displayName": "Gamut Design System", + "version": "0.0.1", + "description": "Gamut design system agent tools: skills, rules, and guidelines for AI-assisted development.", + "keywords": ["codecademy", "gamut", "design-system", "agent-skills"] +} diff --git a/packages/gamut/agent-tools/DESIGN.Codecademy.md b/packages/gamut/agent-tools/DESIGN.Codecademy.md new file mode 100644 index 00000000000..ea9f5f0560b --- /dev/null +++ b/packages/gamut/agent-tools/DESIGN.Codecademy.md @@ -0,0 +1,643 @@ +--- +version: alpha +name: Codecademy Design System +description: Design tokens for codecademy.com +colors: + # palette — raw swatches; set once on :root and then always reference by token name, never use hex values directly in code + hyper-500: "#3A10E5" + hyper-400: "#5533FF" + navy-900: "#0A0D1C" + navy-800: "#10162F" + navy-700: "#31374C" + navy-600: "#4C5063" + navy-500: "#686C7C" + navy-300: "#BCBEC5" + navy-200: "#E2E3E6" + navy-100: "#F5F6F7" + yellow-500: "#FFD300" + yellow-400: "#CCA900" + yellow-0: "#FFFAE5" + yellow-900: "#211B00" + green-700: "#008A27" + green-400: "#AEE938" + green-0: "#F5FFE3" + green-900: "#151C07" + red-600: "#BE1809" + red-500: "#E91C11" + red-400: "#DC5879" + red-300: "#E85D7F" + red-0: "#FBF1F0" + red-900: "#280503" + beige: "#FFF0E5" + white: "#ffffff" + black: "#000000" + # semantic aliases (light mode) — use these in code, not palette swatches or hex values + text: "{colors.navy-800}" + text-accent: "{colors.navy-900}" + text-secondary: "{colors.navy-600}" + text-disabled: "{colors.navy-500}" + background: "{colors.white}" + background-primary: "{colors.beige}" + background-contrast: "{colors.white}" + background-selected: "{colors.navy-100}" + background-hover: "{colors.navy-200}" + background-disabled: "{colors.navy-200}" + background-success: "{colors.green-0}" + background-warning: "{colors.yellow-0}" + background-error: "{colors.red-0}" + primary: "{colors.hyper-500}" + primary-hover: "{colors.hyper-400}" + primary-inverse: "{colors.yellow-500}" + secondary: "{colors.navy-800}" + secondary-hover: "{colors.navy-700}" + interface: "{colors.hyper-500}" + interface-hover: "{colors.hyper-400}" + danger: "{colors.red-500}" + danger-hover: "{colors.red-600}" + feedback-error: "{colors.red-600}" + feedback-success: "{colors.green-700}" + feedback-warning: "{colors.yellow-500}" + border-primary: "{colors.navy-800}" + border-secondary: "{colors.navy-600}" + border-tertiary: "{colors.navy-300}" + border-disabled: "{colors.navy-500}" + shadow-primary: "{colors.navy-800}" + shadow-secondary: "{colors.navy-600}" +typography: + base: + fontFamily: '"Apercu", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif' + fontSize: "1rem" + fontWeight: "400" + lineHeight: "1.5" + accent: + fontFamily: '"Suisse", "Apercu", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif' + fontSize: "0.875rem" + fontWeight: "400" + lineHeight: "1.5" + title: + fontFamily: '"Apercu", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif' + fontSize: "2.125rem" + fontWeight: "700" + lineHeight: "1.2" + hankenGrotesk: + fontFamily: '"Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif' + monospace: + fontFamily: 'Monaco, Menlo, "Ubuntu Mono", "Droid Sans Mono", Consolas, monospace' +rounded: + none: "0px" + sm: "2px" + md: "4px" + lg: "8px" + xl: "16px" + full: "999px" +spacing: + "0": "0" + "4": "0.25rem" + "8": "0.5rem" + "12": "0.75rem" + "16": "1rem" + "24": "1.5rem" + "32": "2rem" + "40": "2.5rem" + "48": "3rem" + "64": "4rem" + "96": "6rem" +components: + FillButton: + backgroundColor: "{colors.primary}" + textColor: "{colors.white}" + rounded: "{rounded.md}" + FillButton-hover: + backgroundColor: "{colors.primary-hover}" + textColor: "{colors.white}" + FillButton-danger: + backgroundColor: "{colors.danger}" + textColor: "{colors.white}" + rounded: "{rounded.md}" + FillButton-danger-hover: + backgroundColor: "{colors.danger-hover}" + textColor: "{colors.white}" + StrokeButton: + backgroundColor: "transparent" + textColor: "{colors.secondary}" + rounded: "{rounded.md}" + CTAButton: + backgroundColor: "{colors.primary}" + textColor: "{colors.white}" + rounded: "{rounded.md}" + CTAButton-inverse: + backgroundColor: "{colors.primary-inverse}" + textColor: "{colors.secondary}" + rounded: "{rounded.md}" + TextButton: + backgroundColor: "transparent" + textColor: "{colors.primary}" + TextButton-hover: + textColor: "{colors.primary-hover}" + Card: + backgroundColor: "{colors.background}" + rounded: "{rounded.none}" + Card-interactive: + rounded: "{rounded.md}" + Card-elevated: + backgroundColor: "{colors.background-primary}" + rounded: "{rounded.lg}" + Card-beige: + backgroundColor: "{colors.beige}" + rounded: "{rounded.lg}" + Input: + backgroundColor: "{colors.background}" + textColor: "{colors.text}" + rounded: "{rounded.md}" + Checkbox: + backgroundColor: "{colors.interface}" + rounded: "{rounded.sm}" + Checkbox-hover: + backgroundColor: "{colors.interface-hover}" + Headline: + textColor: "{colors.text-accent}" + typography: "{typography.title}" + Tag-success: + backgroundColor: "{colors.feedback-success}" + textColor: "{colors.white}" + rounded: "{rounded.sm}" + Tag-warning: + backgroundColor: "{colors.feedback-warning}" + textColor: "{colors.text}" + rounded: "{rounded.sm}" + Alert-error: + backgroundColor: "{colors.background-error}" + textColor: "{colors.feedback-error}" + Alert-success: + backgroundColor: "{colors.background-success}" + textColor: "{colors.text}" + Alert-warning: + backgroundColor: "{colors.background-warning}" + textColor: "{colors.text}" +--- + +# Codecademy + +This file defines the visual design tokens for codecademy.com, implemented using the Gamut design system (`@codecademy/gamut`, `@codecademy/gamut-styles`). Gamut ships 52 components with Figma ↔ code mappings via Figma Code Connect. + +**Figma file**: https://www.figma.com/design/ReGfRNillGABAj5SlITalN/📐-Gamut +**Storybook**: https://gamut.codecademy.com + +--- + +## Visual Theme & Atmosphere + +Codecademy communicates **logic with personality** — structured and trustworthy enough for a learning platform, with creative moments that feel engaging and human. The design voice is: *"we are ruled by logic, but are creative and a bit unexpected as well."* + +**Density**: Medium. Information-dense layouts use careful whitespace and strong typographic hierarchy to stay readable. Avoid cramped or overly airy layouts. + +**Design philosophy**: +- Components are color mode–aware by default — never hardcode hex values for adaptive UI +- Every component works across all themes without modification +- Mobile-first responsive design built on a 12-column grid +- Accessibility is guaranteed by design: semantic color tokens meet contrast requirements per mode automatically + +--- + +## Themes + +Codecademy products use one of four Gamut themes, all sharing the same core visual identity. Token aliases resolve to the right values per theme automatically — components require no modification. + +| Theme | Use case | Base font | Dark mode | +|---|---|---|---| +| **Core** | Codecademy (default) | Apercu | ✓ light + dark | +| **Admin** | Codecademy admin tools | Apercu | ✓ light + dark | +| **Platform** | Codecademy learning environment | Apercu | ✓ light + dark | +| **LX Studio** | LX Studio application | Hanken Grotesk | light only | + +The active theme is set at the app root via ``. When designing, know which theme your screen targets — it affects primary colors, font families, and available color weights. + +**Font licensing**: Apercu is licensed for codecademy.com only. LX Studio uses Hanken Grotesk. + +For Percipio projects, use `DESIGN.Percipio.md` from the same package instead. + +### LX Studio theme overrides + +LX Studio extends Core with these differences: + +**Font**: All families → `"Hanken Grotesk"` (no Apercu, no Suisse). + +**Border radii** (all values shift up one step): + +| Token | Core | LX Studio | +|---|---|---| +| `sm` | 2px | 4px | +| `md` | 4px | 8px | +| `lg` | 8px | 12px | + +**Semantic color overrides (light mode)**: + +| Token | Core value | LX Studio value | +|---|---|---| +| `primary` | hyper-500 `#3A10E5` | `#5628FE` (lxStudioPurple) | +| `primary-hover` | hyper-400 `#5533FF` | `#7955FC` (lxStudioPurpleHover) | +| `interface` | hyper-500 | hyper-500 (unchanged) | +| `feedback-success` | green-700 `#008A27` | `#06844F` (lxStudioSuccess) | +| `background-primary` | beige `#FFF0E5` | `#FAFBFC` (lxStudioBgPrimary) | +| `shadow-primary` | navy-800 | navy-200 | +| `border-primary` | navy-800 | navy-400 | +| `border-disabled` | navy-500 | navy-300 | + +--- + +## Semantic Color Aliases + +Use these token names when specifying colors in designs. They resolve to the correct raw value for the active theme and color mode automatically. **Never hardcode hex values** for anything that needs to adapt across modes. + +### Text + +| Token | Light | Dark | Use for | +|---|---|---|---| +| `text` | navy-800 `#10162F` at 100% | white `#ffffff` | Default body and UI text | +| `text-accent` | navy-900 `#0A0D1C` | beige `#FFF0E5` | Stronger emphasis text | +| `text-secondary` | navy-800 at 75% | white at 65% | Supporting / secondary copy | +| `text-disabled` | navy-800 at 63% | white at 50% | Disabled state labels | + +### Background + +| Token | Light | Dark | Use for | +|---|---|---|---| +| `background` | white `#ffffff` | navy-800 `#10162F` | Default page/component background | +| `background-primary` | beige `#FFF0E5` | navy-900 `#0A0D1C` | Slightly elevated surfaces | +| `background-contrast` | white | black `#000000` | Maximum contrast surface | +| `background-selected` | navy-800 at 4% | white at 4% | Selected row / item | +| `background-hover` | navy-800 at 12% | white at 9% | Hover state overlay | +| `background-disabled` | navy-800 at 12% | white at 9% | Disabled surface | +| `background-success` | green-0 `#F5FFE3` | green-900 `#151C07` | Success state container | +| `background-warning` | yellow-0 `#FFFAE5` | yellow-900 `#211B00` | Warning state container | +| `background-error` | red-0 `#FBF1F0` | red-900 `#280503` | Error state container | + +### Interactive + +| Token | Light | Dark | Use for | +|---|---|---|---| +| `primary` | hyper-500 `#3A10E5` | yellow-500 `#FFD300` | Primary CTA, links, focus rings | +| `primary-hover` | hyper-400 `#5533FF` | yellow-400 `#CCA900` | Hover state of primary interactive | +| `primary-inverse` | yellow-500 `#FFD300` | hyper-500 `#3A10E5` | Primary on a colored background | +| `secondary` | navy-800 `#10162F` | white `#ffffff` | Secondary CTA, ghost buttons | +| `secondary-hover` | navy-800 at 86% | white at 80% | Hover state of secondary interactive | +| `interface` | hyper-500 `#3A10E5` | yellow-500 `#FFD300` | UI affordances (checkboxes, toggles, sliders) | +| `interface-hover` | hyper-400 `#5533FF` | yellow-400 `#CCA900` | Hover on interface elements | +| `danger` | red-500 `#E91C11` | red-300 `#E85D7F` | Destructive actions, error states | +| `danger-hover` | red-600 `#BE1809` | red-400 `#DC5879` | Hover on danger interactive | + +### Border + +| Token | Light | Dark | Use for | +|---|---|---|---| +| `border-primary` | navy-800 `#10162F` | white `#ffffff` | Strong borders, dividers | +| `border-secondary` | navy-800 at 75% | white at 65% | Medium-weight borders | +| `border-tertiary` | navy-800 at 28% | white at 20% | Subtle borders, separators | +| `border-disabled` | navy-800 at 63% | white at 50% | Disabled input borders | + +### Feedback + +| Token | Light | Dark | Use for | +|---|---|---|---| +| `feedback-error` | red-600 `#BE1809` | red-300 `#E85D7F` | Error messages, validation | +| `feedback-success` | green-700 `#008A27` | green-400 `#AEE938` | Success messages, confirmations | +| `feedback-warning` | yellow `#FFD300` | yellow-0 `#FFFAE5` | Warning messages, caution states | + +### Shadow + +| Token | Light | Dark | +|---|---|---| +| `shadow-primary` | navy-800 | white | +| `shadow-secondary` | navy-800 at 75% | white at 65% | + +--- + +## Raw Color Palette + +All colors available as static tokens regardless of color mode. Use these only when a color should be **fixed** and not adapt to dark mode. + +### Core Palette + +| Name | Weights available | Notes | +|---|---|---| +| `navy` | 100–900 | 100–700 are rgba transparencies of `#10162F`; 800 = `#10162F`; 900 = `#0A0D1C` | +| `white` | 100–700 | rgba transparencies of `#ffffff` (no solid white weight — use `white` for `#fff`) | +| `blue` | 0, 100, 300, 400, 500, 800 | 500 = `#1557FF` | +| `hyper` | 400, 500 | 500 = `#3A10E5` (purple-blue), 400 = `#5533FF` | +| `green` | 0, 100, 400, 700, 900 | 700 = `#008A27` | +| `yellow` | 0, 400, 500, 900 | 500 = `#FFD300` | +| `red` | 0, 300, 400, 500, 600, 900 | 500 = `#E91C11` | +| `gray` | 100, 200, 300, 600, 800, 900 | | +| `pink` | 0, 400 | 400 = `#F966FF` | +| `orange` | 100, 500 | 500 = `#FF8C00` | +| `beige` | 100 (alias: `beige`) | `#FFF0E5` | +| `black` | — | `#000000` | +| `white` (solid) | — | `#ffffff` | + +**Named aliases** (shorthand for common weights): +`beige`, `blue`, `green`, `hyper`, `lightBlue`, `lightGreen`, `navy`, `orange`, `paleBlue`, `paleGreen`, `palePink`, `paleRed`, `paleYellow`, `pink`, `red`, `yellow`, `black`, `white` + +### Platform-only additions +`lightBeige` (`#FFFBF8`), `gold` (`#8A7300`), `teal` (`#006D82`), `purple` (`#B3CCFF`) + +### LX Studio additions +`lxStudioPurple` (`#5628FE`), `lxStudioPurpleHover` (`#7955FC`), `lxStudioSuccess` (`#06844F`) + +--- + +## Typography + +### Typefaces + +| Token | Core / Admin / Platform | LX Studio | Use for | +|---|---|---|---| +| `base` | Apercu Pro (CSS: `Apercu`) | Hanken Grotesk | All default UI text, headlines, body copy | +| `accent` | Suisse Intl Mono (CSS: `Suisse`); falls back to `Apercu` | Hanken Grotesk | Code, captions, labels, lists, technical context | +| `monospace` | Monaco, Menlo, Ubuntu Mono, Droid Sans Mono, Consolas | Monaco, Menlo, Ubuntu Mono, Droid Sans Mono, Consolas | Code editor contexts | +| `system` | System UI fonts | System UI fonts | Performance-critical surfaces | + +**Apercu is licensed for codecademy.com only.** LX Studio uses Hanken Grotesk for both `base` and `accent`. + +### Rules + +- **Apercu Bold** for headlines, sub-headlines, CTAs, and buttons. +- **Apercu Regular** for body text, UI labels, and menu items. +- **Apercu Italic** to emphasize text within a Regular paragraph — not Bold. +- **Suisse** sparingly: code snippets, enumerated items, quotations, captions. Reads 10–15% large for its point size — size down relative to Apercu (14px Suisse ≈ 16px Apercu visually). +- Text is **left-aligned** by default. Center-align only for short marketing headlines. Never right-align. +- Do not adjust letter-spacing. + +### Font size scale + +| Token key | Size | Common use | +|---|---|---| +| `64` | 64px | Hero / display | +| `44` | 44px | Page titles | +| `34` | 34px | Section titles | +| `26` | 26px | Sub-section titles | +| `22` | 22px | Card titles, large UI labels | +| `20` | 20px | Secondary titles | +| `18` | 18px | Large body, intro text | +| `16` | 16px | Default body text | +| `14` | 14px | Small body, captions, labels | + +### Font weight scale + +| Token | Value | Use | +|---|---|---| +| `base` | 400 | Body text, UI labels | +| `title` | 700 | Headlines, CTAs, buttons | + +### Line height scale + +| Token | Value | Use | +|---|---|---| +| `base` | 1.5 | Body text (150% — aim for 150–175% of font size) | +| `spacedTitle` | 1.3 | Sub-headlines and medium titles | +| `title` | 1.2 | Large headlines (aim for 100–110% of font size) | + +### Line length + +Target 45–85 characters per line; 66 characters is ideal for web body text. Max 50 characters for multi-column layouts. + +--- + +## Spacing Scale + +All spacing is multiples of 4px, placed on an 8px grid. + +| Token | Value | +|---|---| +| `0` | 0 | +| `4` | 4px | +| `8` | 8px | +| `12` | 12px | +| `16` | 16px | +| `24` | 24px | +| `32` | 32px | +| `40` | 40px | +| `48` | 48px | +| `64` | 64px | +| `96` | 96px | + +--- + +## Depth & Elevation + +Gamut uses border-based and shadow-based depth cues rather than a rigid z-elevation tier system. + +### Shadow tokens + +Shadow props accept standard CSS `box-shadow` syntax. Always use `shadow-primary` / `shadow-secondary` color tokens so shadows remain visible in both light and dark modes. + +``` +box-shadow: 0 4px 0 → Card "outline" shadow +box-shadow: 0 0 4px rgba(0,0,0,.15) → Subtle ambient shadow +``` + +### Card shadow variants + +| Variant | Effect | Use for | +|---|---|---| +| `none` (default) | No shadow | Static / non-interactive cards | +| `outline` | Solid shadow on bottom + left/right using border color | Standard clickable cards | +| `patternLeft` | Decorative checker pattern on bottom + left | Stylized content cards | +| `patternRight` | Decorative checker pattern on bottom + right | Stylized content cards | + +Interactive cards (`isInteractive` prop) gain a shadow on hover and `borderRadius: md`. Cards with a pattern drop the pattern on hover. + +### Z-index + +| Token | Value | Use | +|---|---|---| +| `headerZ` | 15 | Global page header | + +--- + +## Border Radius Scale + +| Token | Value | Use | +|---|---|---| +| `none` | 0px | Square / non-interactive elements | +| `sm` | 2px | Subtle rounding, tags | +| `md` | 4px | Default buttons, inputs, interactive cards | +| `lg` | 8px | Cards, panels | +| `xl` | 16px | Large cards, modals | +| `full` | 999px | Pills, avatars, circular elements | + +--- + +## Responsive Behavior + +Mobile-first. Apply styles from the named breakpoint and up. + +### Breakpoints & screen sizes + +| Token | Min-width | Screen dimensions | Max content | Fold height | +|---|---|---|---|---| +| _(base)_ | 0 | 320×480 | 288px | 440px | +| `xs` | 480px | 480×900 | 448px | 440px | +| `sm` | 768px | 768×1024 | 704px | 680px | +| `md` | 1024px | 1024×768 | 896px | 680px | +| `lg` | 1200px | 1200×900 | 1072px | 680px | +| `xl` | 1440px | 1440×900 | 1248px | 680px | + +Container query variants (`c_xs` through `c_xl`) mirror these values but trigger on component container size, not viewport. + +### Grid + +12-column grid at all breakpoints. The designer specifies how many columns a section spans per breakpoint. + +| Usage | Recommended values | +|---|---| +| Horizontal margins | 64px (lg+), 48px (md), 32px (sm/xs), 16px (base) | +| Column gaps (gutters) | 32px (lg+), 24px (md), 16px (sm/xs), 8px (base) | +| Row gaps | 32px (lg+), 24px (md), 16px (sm/xs), 8px (base) | + +### Touch targets + +Minimum interactive touch target: **44×44px** on mobile breakpoints. + +### Collapsing strategies + +- Begin design work at 1440px (XL), then adapt to smaller sizes. +- Wider multi-column layouts collapse to fewer columns — do not simply stretch or squish. +- Elements not in an explicit lockup (e.g., catalog cards) should align on one axis (usually left) rather than fill column widths. +- Avoid dense or small components in the base (mobile) breakpoint. + +--- + +## Component Library + +Components are organized into three tiers: + +### Atoms — foundational, single-purpose + +Badge, Button (FillButton, StrokeButton, CTAButton, TextButton, IconButton), ButtonBase, Card, Checkbox, CodeBlock, ColorMode, Drawer, FlexBox, FormGroup, GridBox, HiddenText, Icon, Input, Label, Loader, Radio, Select, Spinner, Tag, TextArea, Toggle, Tooltip + +### Molecules — composed of atoms, handle a discrete task + +Alert, Anchor, Breadcrumbs, Coachmark, Disclosure, GridForm, Markdown, Menu, Modal, Pagination, Popover, ProgressBar, Table, Tabs, Toast, Toaster, Video + +### Organisms — page-level compositions + +ContentContainer, GridContainer, Layout, LayoutGrid + +### Key component patterns + +#### Buttons + +| Variant | Component | Use for | +|---|---|---| +| Primary action | `FillButton` | Solid fill, high-emphasis CTA | +| Secondary action | `StrokeButton` | Outlined, secondary CTA | +| Marketing CTA | `CTAButton` | High-visibility promotional actions | +| Tertiary / inline | `TextButton` | Low-emphasis, inline text actions | +| Icon-only | `IconButton` | Compact actions with icon only | + +All button variants support sizes: `small`, `normal` (default), `large`. They accept an `icon` prop (leading or trailing) and a `disabled` prop. Passing `href` renders the button as an `` tag. + +**States**: default → hover (`primary-hover` / `secondary-hover`) → active → disabled (`text-disabled` + `background-disabled`). + +#### Cards + +Cards support: +- **Background variants**: `default` (ColorMode-responsive), `white`, `yellow`, `beige` (light contexts), `navy`, `hyper` (dark contexts) +- **Shadow variants**: `none` (default), `outline`, `patternLeft`, `patternRight` +- **Interaction**: wrap in `` and add `isInteractive` for hover shadow + `borderRadius: md` +- **Border radius**: defaults to `none` (non-interactive); override with the `borderRadius` prop as needed + +#### Color-aware components + +- **``** — wraps a subtree in an explicit color mode. +- **``** — applies a background color and automatically switches the color mode inside to maintain accessible contrast. Prefer this over setting a raw `bg` prop on any content-bearing surface. + +--- + +## Global Elements + +| Token | Value | Use | +|---|---|---| +| `headerHeight` | 4rem (64px) base, 5rem (80px) at `md`+ | Global page header height | +| `headerZ` | 15 | Z-index for global page headers | + +--- + +## Do's and Don'ts + +### Colors + +- **Do** use semantic color aliases (`primary`, `text`, `background`, etc.) for any UI that must adapt to color mode or theme. +- **Do** use `` when setting a section background — it adjusts the inner color mode for contrast automatically. +- **Don't** hardcode hex values for anything adaptive. +- **Don't** use navy or white semi-transparent swatches where they may overlap unpredictably. + +### Typography + +- **Do** use `title` weight (700) for headlines, CTAs, and buttons. +- **Do** keep body text at 150–175% line height for readability. +- **Do** use Suisse sparingly — as an accent for code, captions, and lists only. +- **Don't** use Apercu Bold to emphasize text *within* a paragraph — use Italic instead. +- **Don't** adjust letter-spacing. +- **Don't** right-align text in normal circumstances. +- **Don't** center-align body paragraphs with long line lengths. + +### Layout & Spacing + +- **Do** use multiples of 8px for block-element spacing (4px only for inline / typographic relationships). +- **Do** begin design work at 1440px (XL), then adapt down to each breakpoint. +- **Do** align elements to the 12-column grid. +- **Don't** stretch elements to fill wider space — maintain proper line lengths and component widths. + +### Components + +- **Do** use `FillButton` for primary actions and `StrokeButton` for secondary actions. +- **Do** add `isInteractive` to any `Card` that is wrapped in an ``. +- **Don't** use `CTAButton` for standard UI actions — reserve it for marketing/high-visibility promotions. +- **Don't** use `` without an actual color value — it's not a neutral wrapper. + +--- + +## Agent Prompt Guide + +Quick color/token reference for generating or specifying UI: + +| Scenario | Tokens | +|---|---| +| Primary button (light) | `bg: primary (#3A10E5)`, `color: white`, `hover: primary-hover (#5533FF)` | +| Primary button (dark) | `bg: primary (#FFD300)`, `color: navy-800`, `hover: primary-hover (#CCA900)` | +| Body text | `color: text`, `font: base (Apercu Pro)`, `size: 16px`, `weight: 400`, `lineHeight: base (1.5)` | +| Headline | `color: text-accent`, `font: base`, `size: 34–64px`, `weight: title (700)`, `lineHeight: title (1.2)` | +| Caption / label | `color: text-secondary`, `font: accent (Suisse Int'l Mono)`, `size: 14px` | +| Card default | `bg: background`, `borderRadius: none` — add `isInteractive` for hover shadow + `borderRadius: md` | +| Error state | `color: feedback-error`, `bg: background-error`, `border: danger` | +| Success state | `color: feedback-success`, `bg: background-success` | +| Disabled state | `color: text-disabled`, `bg: background-disabled`, `border: border-disabled` | + +### Component token cheatsheet + +``` +FillButton → bg: primary, color: white, hover: primary-hover +StrokeButton → bg: transparent, border: secondary, hover: secondary-hover +CTAButton → high-visibility; use primary-inverse on colored surfaces +Card (light) → variant: "default" | "white" | "yellow" | "beige" +Card (dark) → variant: "navy" | "hyper" +Alert (error) → uses feedback-error + background-error +Alert (success) → uses feedback-success + background-success +Alert (warning) → uses feedback-warning + background-warning +ColorMode → +Background → — auto-flips color mode for contrast +``` + +--- + +## Figma ↔ Code Mapping + +52 components have Code Connect entries in `packages/code-connect/`. These appear as live code snippets in Figma's inspect panel when you select a component. + +Figma layer names use emojis as visual shorthand (e.g. `✏️ label`, `👁 leading icon`, `↳ trailing icon`). These map to named props in the React components. + +To publish updated code snippets after changing a component: +``` +npx figma connect publish --token +``` diff --git a/packages/gamut/agent-tools/DESIGN.LXStudio.md b/packages/gamut/agent-tools/DESIGN.LXStudio.md new file mode 100644 index 00000000000..63878fb41b7 --- /dev/null +++ b/packages/gamut/agent-tools/DESIGN.LXStudio.md @@ -0,0 +1,444 @@ +--- +version: alpha +name: LX Studio Design System +description: Design tokens for the Skillsoft LX Studio authoring platform. +colors: + # LX Studio additions — custom brand tokens + lxStudioPurple: "#5628FE" + lxStudioPurpleHover: "#7955FC" + lxStudioSuccess: "#06844F" + lxStudioBgPrimary: "#FAFBFC" + # core palette — referenced by semantic aliases below + hyper-500: "#3A10E5" + hyper-400: "#5533FF" + navy-900: "#0A0D1C" + navy-800: "#10162F" + navy-700: "#31374C" + navy-600: "#4C5063" + navy-500: "#686C7C" + navy-400: "#8F919D" + navy-300: "#BCBEC5" + navy-200: "#E2E3E6" + navy-100: "#F5F6F7" + yellow-500: "#FFD300" + yellow-0: "#FFFAE5" + green-700: "#008A27" + green-0: "#F5FFE3" + red-600: "#BE1809" + red-500: "#E91C11" + red-0: "#FBF1F0" + white: "#ffffff" + # semantic aliases — use these in code, not palette swatches or hex values + text: "{colors.navy-800}" + text-accent: "{colors.navy-900}" + text-secondary: "{colors.navy-600}" + text-disabled: "{colors.navy-500}" + background: "{colors.white}" + background-primary: "{colors.lxStudioBgPrimary}" + background-contrast: "{colors.white}" + background-selected: "{colors.navy-100}" + background-hover: "{colors.navy-200}" + background-disabled: "{colors.navy-200}" + background-success: "{colors.green-0}" + background-warning: "{colors.yellow-0}" + background-error: "{colors.red-0}" + primary: "{colors.lxStudioPurple}" + primary-hover: "{colors.lxStudioPurpleHover}" + primary-inverse: "{colors.yellow-500}" + secondary: "{colors.navy-800}" + secondary-hover: "{colors.navy-700}" + interface: "{colors.hyper-500}" + interface-hover: "{colors.hyper-400}" + danger: "{colors.red-500}" + danger-hover: "{colors.red-600}" + feedback-error: "{colors.red-600}" + feedback-success: "{colors.lxStudioSuccess}" + feedback-warning: "{colors.yellow-500}" + border-primary: "{colors.navy-400}" + border-secondary: "{colors.navy-600}" + border-tertiary: "{colors.navy-800}" + border-disabled: "{colors.navy-300}" + shadow-primary: "{colors.navy-200}" + shadow-secondary: "{colors.navy-600}" +typography: + base: + fontFamily: '"Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif' + fontSize: "1rem" + fontWeight: "400" + lineHeight: "1.5" + accent: + fontFamily: '"Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif' + fontSize: "0.875rem" + fontWeight: "400" + lineHeight: "1.5" + title: + fontFamily: '"Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif' + fontSize: "2.125rem" + fontWeight: "700" + lineHeight: "1.2" + monospace: + fontFamily: 'Monaco, Menlo, "Ubuntu Mono", "Droid Sans Mono", Consolas, monospace' +rounded: + none: "0px" + sm: "4px" + md: "8px" + lg: "12px" + xl: "16px" + full: "999px" +components: + FillButton: + backgroundColor: "{colors.primary}" + textColor: "{colors.white}" + rounded: "{rounded.md}" + FillButton-hover: + backgroundColor: "{colors.primary-hover}" + textColor: "{colors.white}" + FillButton-danger: + backgroundColor: "{colors.danger}" + textColor: "{colors.white}" + rounded: "{rounded.md}" + FillButton-danger-hover: + backgroundColor: "{colors.danger-hover}" + textColor: "{colors.white}" + StrokeButton: + backgroundColor: "transparent" + textColor: "{colors.secondary}" + rounded: "{rounded.md}" + Input: + backgroundColor: "{colors.background}" + textColor: "{colors.text}" + rounded: "{rounded.md}" + borderColor: "{colors.border-primary}" + Checkbox: + backgroundColor: "{colors.interface}" + rounded: "{rounded.sm}" + Checkbox-hover: + backgroundColor: "{colors.interface-hover}" + Alert-error: + backgroundColor: "{colors.background-error}" + textColor: "{colors.feedback-error}" + Alert-success: + backgroundColor: "{colors.background-success}" + textColor: "{colors.text}" + Alert-warning: + backgroundColor: "{colors.background-warning}" + textColor: "{colors.text}" +--- + +# LX Studio + +This file defines the visual design tokens for the Skillsoft LX Studio authoring platform, implemented using the Gamut design system (`@codecademy/gamut`, `@codecademy/gamut-styles`). LX Studio uses a dedicated Gamut theme that extends Core with its own brand colors, typography, and border radii — all Gamut components work without modification. + +**Storybook**: https://gamut.codecademy.com + +--- + +## Visual Theme & Atmosphere + +LX Studio communicates **modern professional craft** — clean, precise, and tool-like. As an authoring environment for learning content creators, the interface must feel capable and unobtrusive. The design voice prioritizes clarity and control over personality. + +**Density**: Medium. Layouts are information-dense but well-spaced; generous border radii and soft shadows reduce visual weight. + +**Design philosophy**: +- Light mode only — no dark mode support +- Larger border radii than Core give the UI a softer, more modern feel +- Brand purple (`lxStudioPurple`) drives primary CTAs; `hyper-500` drives interface affordances (checkboxes, toggles) +- Shadows are soft (navy-200) rather than hard (navy-800 in Core light mode) +- Hanken Grotesk replaces Apercu and Suisse across all font roles + +--- + +## Themes + +LX Studio uses a single Gamut theme — light mode only. + +| Theme | Use case | Base font | Dark mode | +|---|---|---|---| +| **LX Studio** | Skillsoft LX Studio authoring platform | Hanken Grotesk | light only | + +The active theme is set at the app root via ``. + +--- + +## Semantic Color Aliases + +Use these token names when specifying colors. LX Studio is light mode only — there are no dark mode counterparts. + +### Text + +| Token | Value | Use for | +|---|---|---| +| `text` | `#10162F` (navy-800) | Default body and UI text | +| `text-accent` | `#0A0D1C` (navy-900) | Stronger emphasis text | +| `text-secondary` | `#4C5063` (navy-600) | Supporting / secondary copy | +| `text-disabled` | `#686C7C` (navy-500) | Disabled state labels | + +### Background + +| Token | Value | Use for | +|---|---|---| +| `background` | `#ffffff` | Default page/component background | +| `background-primary` | `#FAFBFC` (lxStudioBgPrimary) | Slightly elevated surfaces | +| `background-contrast` | `#ffffff` | Maximum contrast surface | +| `background-selected` | `#F5F6F7` (navy-100) | Selected row / item | +| `background-hover` | `#E2E3E6` (navy-200) | Hover state overlay | +| `background-disabled` | `#E2E3E6` (navy-200) | Disabled surface | +| `background-success` | `#F5FFE3` (green-0) | Success state container | +| `background-warning` | `#FFFAE5` (yellow-0) | Warning state container | +| `background-error` | `#FBF1F0` (red-0) | Error state container | + +### Interactive + +| Token | Value | Use for | +|---|---|---| +| `primary` | `#5628FE` (lxStudioPurple) | Primary CTA, links, focus rings | +| `primary-hover` | `#7955FC` (lxStudioPurpleHover) | Hover state of primary interactive | +| `primary-inverse` | `#FFD300` (yellow-500) | Primary on a colored background | +| `secondary` | `#10162F` (navy-800) | Secondary CTA, ghost buttons | +| `secondary-hover` | `#31374C` (navy-700) | Hover state of secondary interactive | +| `interface` | `#3A10E5` (hyper-500) | UI affordances (checkboxes, toggles, sliders) | +| `interface-hover` | `#5533FF` (hyper-400) | Hover on interface elements | +| `danger` | `#E91C11` (red-500) | Destructive actions, error states | +| `danger-hover` | `#BE1809` (red-600) | Hover on danger interactive | + +**Key distinction**: `primary` (lxStudioPurple `#5628FE`) differs from `interface` (hyper-500 `#3A10E5`). Buttons and links use the lighter LX Studio purple; checkboxes, toggles, and sliders use the deeper hyper purple. + +### Border + +| Token | Value | Use for | +|---|---|---| +| `border-primary` | `#8F919D` (navy-400) | Standard input and card borders | +| `border-secondary` | `#4C5063` (navy-600) | Medium-weight borders | +| `border-tertiary` | `#10162F` (navy-800) | Strong structural borders | +| `border-disabled` | `#BCBEC5` (navy-300) | Disabled input borders | + +LX Studio's `border-primary` is mid-gray (navy-400) rather than Core's near-black navy-800 — borders are softer and less prominent. + +### Feedback + +| Token | Value | Use for | +|---|---|---| +| `feedback-error` | `#BE1809` (red-600) | Error messages, validation | +| `feedback-success` | `#06844F` (lxStudioSuccess) | Success messages, confirmations | +| `feedback-warning` | `#FFD300` (yellow-500) | Warning messages, caution states | + +### Shadow + +| Token | Value | +|---|---| +| `shadow-primary` | `#E2E3E6` (navy-200) | +| `shadow-secondary` | `#4C5063` (navy-600) | + +LX Studio shadows are soft — use `shadow-primary` for standard elevated surfaces. This matches Percipio's shadow weight, not Core's hard navy-800 shadow. + +--- + +## LX Studio Color Palette + +LX Studio adds four named colors to the core palette. Use semantic aliases in code, not these raw names. + +| Named color | Value | Mapped to | +|---|---|---| +| `lxStudioPurple` | `#5628FE` | `primary` | +| `lxStudioPurpleHover` | `#7955FC` | `primary-hover` | +| `lxStudioSuccess` | `#06844F` | `feedback-success` | +| `lxStudioBgPrimary` | `#FAFBFC` | `background-primary` | + +The full core swatch palette (navy, hyper, blue, green, yellow, red, etc.) is also available. Raw swatches should only be used for fixed colors that must not adapt (illustrations, data viz, etc.). + +--- + +## Typography + +### Typefaces + +LX Studio uses **Hanken Grotesk** for all font roles. There is no Apercu and no Suisse. + +| Token | Font | Use for | +|---|---|---| +| `base` | `"Hanken Grotesk"`, sans-serif fallback | All default UI text, headlines, body copy | +| `accent` | `"Hanken Grotesk"`, sans-serif fallback | Labels, captions, technical context (same as base in LX Studio) | +| `monospace` | Monaco, Menlo, Ubuntu Mono, Droid Sans Mono, Consolas | Code editor contexts | +| `system` | System UI fonts | Performance-critical surfaces | + +Hanken Grotesk is served from `https://www.codecademy.com/gamut/` in four variants: regular, italic, bold, bold-italic. + +### Rules + +- **Hanken Grotesk Bold (700)** for headlines, sub-headlines, CTAs, and buttons. +- **Hanken Grotesk Regular (400)** for body text, UI labels, and menu items. +- Text is **left-aligned** by default. Center-align only for short marketing headlines. Never right-align. +- Do not adjust letter-spacing. +- No separate accent typeface — Hanken Grotesk is used uniformly for `base` and `accent`. + +### Font weight scale + +| Token | Value | Use | +|---|---|---| +| `base` | 400 | Body text, UI labels | +| `title` | 700 | Headlines, CTAs, buttons | + +### Font size scale + +Shared with Core — all sizes are identical. + +| Token key | Size | Common use | +|---|---|---| +| `64` | 64px | Hero / display | +| `44` | 44px | Page titles | +| `34` | 34px | Section titles | +| `26` | 26px | Sub-section titles | +| `22` | 22px | Card titles, large UI labels | +| `20` | 20px | Secondary titles | +| `18` | 18px | Large body, intro text | +| `16` | 16px | Default body text | +| `14` | 14px | Small body, captions, labels | + +### Line height scale + +Shared with Core. + +| Token | Value | Use | +|---|---|---| +| `base` | 1.5 | Body text | +| `spacedTitle` | 1.3 | Sub-headlines and medium titles | +| `title` | 1.2 | Large headlines | + +### Line length + +Target 45–85 characters per line; 66 characters is ideal. Max 50 for multi-column layouts. + +--- + +## Spacing Scale + +Identical to Core. All spacing is multiples of 4px on an 8px grid. + +| Token | Value | +|---|---| +| `0` | 0 | +| `4` | 4px | +| `8` | 8px | +| `12` | 12px | +| `16` | 16px | +| `24` | 24px | +| `32` | 32px | +| `40` | 40px | +| `48` | 48px | +| `64` | 64px | +| `96` | 96px | + +--- + +## Border Radius Scale + +LX Studio uses larger border radii than Core — everything is one step softer. + +| Token | LX Studio | Core | Use | +|---|---|---|---| +| `none` | 0px | 0px | Square / non-interactive elements | +| `sm` | **4px** | 2px | Subtle rounding, tags, checkboxes | +| `md` | **8px** | 4px | Default buttons, inputs, interactive cards | +| `lg` | **12px** | 8px | Cards, panels | +| `xl` | 16px | 16px | Large cards, modals | +| `full` | 999px | 999px | Pills, avatars, circular elements | + +--- + +## Responsive Behavior + +Identical to Core. Mobile-first, apply styles from the named breakpoint up. + +| Token | Min-width | Max content | +|---|---|---| +| _(base)_ | 0 | 288px | +| `xs` | 480px | 448px | +| `sm` | 768px | 704px | +| `md` | 1024px | 896px | +| `lg` | 1200px | 1072px | +| `xl` | 1440px | 1248px | + +12-column grid at all breakpoints. + +| Usage | Recommended values | +|---|---| +| Horizontal margins | 64px (lg+), 48px (md), 32px (sm/xs), 16px (base) | +| Column gaps (gutters) | 32px (lg+), 24px (md), 16px (sm/xs), 8px (base) | +| Row gaps | 32px (lg+), 24px (md), 16px (sm/xs), 8px (base) | + +Minimum interactive touch target: **44×44px** on mobile breakpoints. + +--- + +## Component Library + +Same component library as Codecademy — all atoms, molecules, and organisms apply. Token values resolve differently per theme automatically. + +Key LX Studio-specific visual differences: +- `FillButton` uses `#5628FE` (lxStudioPurple) instead of hyper-500 +- `FillButton` hover shifts to `#7955FC` (lxStudioPurpleHover) — lighter, not darker, on hover +- `Checkbox` / `Toggle` use `hyper-500` (`#3A10E5`) — not the brand purple +- All interactive elements have `borderRadius: md` (8px) instead of Core's 4px +- `Card` shadows use navy-200 (soft) rather than navy-800 (hard) +- No `Card-beige` variant — LX Studio `background-primary` is off-white, not beige + +--- + +## Do's and Don'ts + +### Colors + +- **Do** use semantic color aliases (`primary`, `text`, `background`, etc.) — never hardcode hex values. +- **Do** use `lxStudioPurple` (`#5628FE`) via `primary` for buttons and links. +- **Do** use `hyper-500` (`#3A10E5`) via `interface` for checkboxes, toggles, and sliders. +- **Don't** use `primary` and `interface` interchangeably — they are intentionally different purples. +- **Don't** attempt dark mode — LX Studio is light only. +- **Don't** use the Percipio or Codecademy primary blue/hyper colors directly; go through semantic aliases. + +### Typography + +- **Do** use Hanken Grotesk Bold (700) for headlines, CTAs, and buttons. +- **Do** keep body text at 150–175% line height for readability. +- **Don't** use Apercu or Suisse — those fonts are not available in LX Studio. +- **Don't** right-align or center-align body paragraphs. +- **Don't** adjust letter-spacing. + +### Layout & Spacing + +- **Do** use multiples of 8px for block-element spacing (4px only for inline / typographic relationships). +- **Do** begin design work at 1440px (XL), then adapt down. +- **Do** align elements to the 12-column grid. +- **Do** apply the larger `md` border radius (8px) to buttons and inputs — it defines the LX Studio feel. + +--- + +## Agent Prompt Guide + +Quick color/token reference for generating or specifying LX Studio UI: + +| Scenario | Tokens | +|---|---| +| Primary button | `bg: primary (#5628FE)`, `color: white`, `hover: primary-hover (#7955FC)`, `borderRadius: md (8px)` | +| Body text | `color: text (#10162F)`, `font: Hanken Grotesk`, `size: 16px`, `weight: 400`, `lineHeight: base (1.5)` | +| Headline | `color: text-accent (#0A0D1C)`, `font: Hanken Grotesk`, `size: 34–64px`, `weight: 700`, `lineHeight: title (1.2)` | +| Secondary text | `color: text-secondary (#4C5063)` | +| Disabled text | `color: text-disabled (#686C7C)` | +| Elevated surface | `bg: background-primary (#FAFBFC)` | +| Card default | `bg: background (#ffffff)`, `borderRadius: none` — add `isInteractive` for hover shadow + `borderRadius: md (8px)` | +| Checkbox / toggle | `interface (#3A10E5)`, `hover: interface-hover (#5533FF)` | +| Error state | `color: feedback-error (#BE1809)`, `bg: background-error (#FBF1F0)`, `border: danger` | +| Success state | `color: feedback-success (#06844F)`, `bg: background-success (#F5FFE3)` | +| Warning state | `color: feedback-warning (#FFD300)`, `bg: background-warning (#FFFAE5)` | +| Disabled state | `color: text-disabled (#686C7C)`, `bg: background-disabled (#E2E3E6, navy-200)`, `border: border-disabled` | + +### Component token cheatsheet + +``` +FillButton → bg: primary (#5628FE), color: white, hover: primary-hover (#7955FC), radius: 8px +StrokeButton → bg: transparent, border: secondary (#10162F) +Checkbox/Toggle → interface (#3A10E5), hover: interface-hover (#5533FF), radius: 4px +Card → bg: background, shadow: shadow-primary (#E2E3E6, navy-200, soft), radius: none +Alert (error) → uses feedback-error + background-error +Alert (success) → uses feedback-success + background-success +Alert (warning) → uses feedback-warning + background-warning +``` diff --git a/packages/gamut/agent-tools/DESIGN.Percipio.md b/packages/gamut/agent-tools/DESIGN.Percipio.md new file mode 100644 index 00000000000..d22d53f81ba --- /dev/null +++ b/packages/gamut/agent-tools/DESIGN.Percipio.md @@ -0,0 +1,435 @@ +--- +version: alpha +name: Percipio Design System +description: Design tokens for the Skillsoft Percipio platform. +colors: + # palette — raw swatches; set once on :root and then always reference by token name, never use hex values directly in code + percipioTextPrimary: "#222325" + percipioTextSecondary: "#595A5C" + percipioTextDisabled: "#AFB6C2" + percipioActionPrimary: "#0073C4" + percipioActionPrimaryHover: "#141C36" + percipioActionSecondary: "#6A6E75" + percipioActionSecondaryHover: "#7F8288" + percipioActionDangerHover: "#A52020" + percipioDanger: "#B83C3C" + percipioFeedbackSuccess: "#1B8057" + percipioFeedbackWarning: "#EF5B0D" + percipioBgPrimary: "#FAFBFC" + percipioBgSuccess: "#EEF7F3" + percipioBgWarning: "#FFF7E0" + percipioBgError: "#FFF1F5" + navy-800: "#10162F" + navy-400: "#8F919D" + navy-300: "#BCBEC5" + navy-200: "#E2E3E6" + navy-100: "#F5F6F7" + white: "#ffffff" + # semantic aliases — use these in code, not palette swatches or hex values + text: "{colors.percipioTextPrimary}" + text-accent: "{colors.percipioTextPrimary}" + text-secondary: "{colors.percipioTextSecondary}" + text-disabled: "{colors.percipioTextDisabled}" + background: "{colors.white}" + background-primary: "{colors.percipioBgPrimary}" + background-selected: "{colors.navy-100}" + background-hover: "{colors.navy-200}" + background-disabled: "{colors.navy-200}" + background-success: "{colors.percipioBgSuccess}" + background-warning: "{colors.percipioBgWarning}" + background-error: "{colors.percipioBgError}" + primary: "{colors.percipioActionPrimary}" + primary-hover: "{colors.percipioActionPrimaryHover}" + primary-inverse: "{colors.white}" + secondary: "{colors.percipioActionSecondary}" + secondary-hover: "{colors.percipioActionSecondaryHover}" + interface: "{colors.percipioActionPrimary}" + interface-hover: "{colors.percipioActionPrimaryHover}" + danger: "{colors.percipioDanger}" + danger-hover: "{colors.percipioActionDangerHover}" + feedback-error: "{colors.percipioDanger}" + feedback-success: "{colors.percipioFeedbackSuccess}" + feedback-warning: "{colors.percipioFeedbackWarning}" + border-primary: "{colors.navy-400}" + border-secondary: "{colors.navy-200}" + border-tertiary: "{colors.navy-800}" + border-disabled: "{colors.navy-300}" + shadow-primary: "{colors.navy-200}" + shadow-secondary: "{colors.navy-400}" +typography: + base: + fontFamily: '"Roboto", sans-serif' + fontSize: "1rem" + fontWeight: "400" + lineHeight: "1.5" + accent: + fontFamily: '"Roboto", sans-serif' + fontSize: "0.875rem" + fontWeight: "400" + lineHeight: "1.5" + title: + fontFamily: '"Roboto", sans-serif' + fontSize: "2.125rem" + fontWeight: "500" + lineHeight: "1.2" + monospace: + fontFamily: '"Roboto Mono", monospace' +components: + FillButton: + backgroundColor: "{colors.primary}" + textColor: "{colors.primary-inverse}" + rounded: "{rounded.md}" + FillButton-hover: + backgroundColor: "{colors.primary-hover}" + textColor: "{colors.primary-inverse}" + FillButton-danger: + backgroundColor: "{colors.danger}" + textColor: "{colors.white}" + rounded: "{rounded.md}" + FillButton-danger-hover: + backgroundColor: "{colors.danger-hover}" + textColor: "{colors.white}" + StrokeButton: + backgroundColor: "transparent" + textColor: "{colors.secondary}" + rounded: "{rounded.md}" + Input: + backgroundColor: "{colors.background}" + textColor: "{colors.text}" + rounded: "{rounded.md}" + borderColor: "{colors.border-primary}" + Checkbox: + backgroundColor: "{colors.interface}" + rounded: "{rounded.sm}" + Checkbox-hover: + backgroundColor: "{colors.interface-hover}" + Alert-error: + backgroundColor: "{colors.background-error}" + textColor: "{colors.feedback-error}" + Alert-success: + backgroundColor: "{colors.background-success}" + textColor: "{colors.text}" + Alert-warning: + backgroundColor: "{colors.background-warning}" + textColor: "{colors.text}" +--- + +# Percipio + +This file defines the visual design tokens for the Skillsoft Percipio platform, implemented using the Gamut design system (`@codecademy/gamut`, `@codecademy/gamut-styles`). Percipio uses a dedicated Gamut theme that applies its own colors and typography — all Gamut components work without modification. + +**Storybook**: https://gamut.codecademy.com + +--- + +## Visual Theme & Atmosphere + +Percipio communicates **professional clarity** — clean, trustworthy, and enterprise-ready. The design voice is more neutral and corporate than Codecademy: less playful, more functional. Primary blue drives interactive affordances; neutral grays define text and structure. + +**Density**: Medium. Consistent with Codecademy layouts but with softer shadows and a lighter overall feel due to the muted neutral palette. + +**Design philosophy**: +- Light mode only — no dark mode support +- Primary blue (`percipioActionPrimary`) replaces Codecademy's `hyper-500` for all interactive elements +- Text is near-black dark gray rather than navy +- Shadows are soft and minimal (navy at low opacity) rather than hard borders +- Title font weight is 500 (medium) rather than 700 (bold) — Percipio headlines are less heavy + +--- + +## Themes + +Percipio uses a single Gamut theme — light mode only. + +| Theme | Use case | Base font | Dark mode | +|---|---|---|---| +| **Percipio** | Skillsoft Percipio platform | Roboto | light only | + +The active theme is set at the app root via ``. + +--- + +## Semantic Color Aliases + +Use these token names when specifying colors. Percipio is light mode only — there are no dark mode counterparts. + +### Text + +| Token | Value | Use for | +|---|---|---| +| `text` | `#222325` | Default body and UI text | +| `text-accent` | `#222325` | Emphasis text (same value as `text` in Percipio) | +| `text-secondary` | `#595A5C` | Supporting / secondary copy | +| `text-disabled` | `#AFB6C2` | Disabled state labels | + +### Background + +| Token | Value | Use for | +|---|---|---| +| `background` | `#ffffff` | Default page/component background | +| `background-primary` | `#FAFBFC` | Slightly elevated surfaces | +| `background-selected` | `#F5F6F7` (navy-100) | Selected row / item | +| `background-hover` | `#E2E3E6` (navy-200) | Hover state overlay | +| `background-disabled` | `#E2E3E6` (navy-200) | Disabled surface | +| `background-success` | `#EEF7F3` | Success state container | +| `background-warning` | `#FFF7E0` | Warning state container | +| `background-error` | `#FFF1F5` | Error state container | + +### Interactive + +| Token | Value | Use for | +|---|---|---| +| `primary` | `#0073C4` | Primary CTA, links, focus rings | +| `primary-hover` | `#141C36` | Hover state of primary interactive | +| `primary-inverse` | `#ffffff` | Primary on a colored background | +| `secondary` | `#6A6E75` | Secondary CTA, ghost buttons | +| `secondary-hover` | `#7F8288` | Hover state of secondary interactive | +| `interface` | `#0073C4` | UI affordances (checkboxes, toggles, sliders) | +| `interface-hover` | `#141C36` | Hover on interface elements | +| `danger` | `#B83C3C` | Destructive actions, error states | +| `danger-hover` | `#A52020` | Hover on danger interactive | + +### Border + +Percipio's border weights use a non-standard order: `primary` is mid-weight, `secondary` is very light, `tertiary` is the strongest (solid navy). Use them for their semantic intent, not their numeric rank. + +| Token | Value | Use for | +|---|---|---| +| `border-primary` | `#8F919D` (navy-400) | Standard input and card borders | +| `border-secondary` | `#E2E3E6` (navy-200) | Subtle dividers, section separators | +| `border-tertiary` | `#10162F` (navy-800) | Strong structural borders | +| `border-disabled` | `#BCBEC5` (navy-300) | Disabled input borders | + +### Feedback + +| Token | Value | Use for | +|---|---|---| +| `feedback-error` | `#B83C3C` | Error messages, validation | +| `feedback-success` | `#1B8057` | Success messages, confirmations | +| `feedback-warning` | `#EF5B0D` | Warning messages, caution states | + +### Shadow + +| Token | Value | +|---|---| +| `shadow-primary` | `#E2E3E6` (navy-200) | +| `shadow-secondary` | `#8F919D` (navy-400) | + +Percipio shadows are softer than Codecademy's — use `shadow-primary` for standard elevated surfaces. + +--- + +## Percipio Color Palette + +Percipio introduces its own named semantic colors. These are the source values behind the aliases above. Use the semantic aliases in designs, not the raw named colors. + +| Named color | Value | Mapped to | +|---|---|---| +| `percipioTextPrimary` | `#222325` | `text`, `text-accent` | +| `percipioTextSecondary` | `#595A5C` | `text-secondary` | +| `percipioTextDisabled` | `#AFB6C2` | `text-disabled` | +| `percipioActionPrimary` | `#0073C4` | `primary`, `interface` | +| `percipioActionPrimaryHover` | `#141C36` | `primary-hover`, `interface-hover` | +| `percipioActionSecondary` | `#6A6E75` | `secondary` | +| `percipioActionSecondaryHover` | `#7F8288` | `secondary-hover` | +| `percipioActionDangerHover` | `#A52020` | `danger-hover` | +| `percipioDanger` | `#B83C3C` | `danger`, `feedback-error` | +| `percipioFeedbackSuccess` | `#1B8057` | `feedback-success` | +| `percipioFeedbackWarning` | `#EF5B0D` | `feedback-warning` | +| `percipioBgPrimary` | `#FAFBFC` | `background-primary` | +| `percipioBgSuccess` | `#EEF7F3` | `background-success` | +| `percipioBgWarning` | `#FFF7E0` | `background-warning` | +| `percipioBgError` | `#FFF1F5` | `background-error` | + +The full core swatch palette (navy, blue, green, yellow, red, etc.) is also available, but the semantic aliases above are how Percipio maps them. Raw swatches should only be used for fixed colors that must not adapt (illustrations, data viz, etc.). + +--- + +## Typography + +### Typefaces + +All font families in Percipio use **Roboto**. There is no separate accent or display typeface. + +| Token | Font | Use for | +|---|---|---| +| `base` | `"Roboto", sans-serif` | All default UI text, headlines, body copy | +| `accent` | `"Roboto", sans-serif` | Labels, captions (same as base in Percipio) | +| `monospace` | `"Roboto Mono", monospace` | Code editor contexts | +| `system` | `"Roboto", sans-serif` | Performance-critical surfaces | + +### Rules + +- **Roboto Medium (500)** for headlines, sub-headlines, CTAs, and buttons — not Bold (700). +- **Roboto Regular (400)** for body text, UI labels, and menu items. +- Text is **left-aligned** by default. Center-align only for short marketing headlines. Never right-align. +- Do not adjust letter-spacing. + +### Font weight scale + +Percipio overrides the title weight from Core's 700 to 500 (medium). This gives Percipio a lighter, less heavy headline style. + +| Token | Value | Use | +|---|---|---| +| `base` | 400 | Body text, UI labels | +| `title` | **500** | Headlines, CTAs, buttons _(differs from Codecademy's 700)_ | + +### Font size scale + +Shared with Core — all sizes are identical. + +| Token key | Size | Common use | +|---|---|---| +| `64` | 64px | Hero / display | +| `44` | 44px | Page titles | +| `34` | 34px | Section titles | +| `26` | 26px | Sub-section titles | +| `22` | 22px | Card titles, large UI labels | +| `20` | 20px | Secondary titles | +| `18` | 18px | Large body, intro text | +| `16` | 16px | Default body text | +| `14` | 14px | Small body, captions, labels | + +### Line height scale + +Shared with Core. + +| Token | Value | Use | +|---|---|---| +| `base` | 1.5 | Body text | +| `spacedTitle` | 1.3 | Sub-headlines and medium titles | +| `title` | 1.2 | Large headlines | + +### Line length + +Target 45–85 characters per line; 66 characters is ideal. Max 50 for multi-column layouts. + +--- + +## Spacing Scale + +Identical to Core. All spacing is multiples of 4px on an 8px grid. + +| Token | Value | +|---|---| +| `0` | 0 | +| `4` | 4px | +| `8` | 8px | +| `12` | 12px | +| `16` | 16px | +| `24` | 24px | +| `32` | 32px | +| `40` | 40px | +| `48` | 48px | +| `64` | 64px | +| `96` | 96px | + +--- + +## Border Radius Scale + +Identical to Core. + +| Token | Value | Use | +|---|---|---| +| `none` | 0px | Square / non-interactive elements | +| `sm` | 2px | Subtle rounding, tags | +| `md` | 4px | Default buttons, inputs, interactive cards | +| `lg` | 8px | Cards, panels | +| `xl` | 16px | Large cards, modals | +| `full` | 999px | Pills, avatars, circular elements | + +--- + +## Responsive Behavior + +Identical to Core. Mobile-first, apply styles from the named breakpoint up. + +| Token | Min-width | Max content | +|---|---|---| +| _(base)_ | 0 | 288px | +| `xs` | 480px | 448px | +| `sm` | 768px | 704px | +| `md` | 1024px | 896px | +| `lg` | 1200px | 1072px | +| `xl` | 1440px | 1248px | + +12-column grid at all breakpoints. + +| Usage | Recommended values | +|---|---| +| Horizontal margins | 64px (lg+), 48px (md), 32px (sm/xs), 16px (base) | +| Column gaps (gutters) | 32px (lg+), 24px (md), 16px (sm/xs), 8px (base) | +| Row gaps | 32px (lg+), 24px (md), 16px (sm/xs), 8px (base) | + +Minimum interactive touch target: **44×44px** on mobile breakpoints. + +--- + +## Component Library + +Same component library as Codecademy — all atoms, molecules, and organisms apply. Token values resolve differently per theme automatically. + +Key Percipio-specific visual differences: +- `FillButton` uses `#0073C4` (blue) instead of hyper-purple +- `FillButton` hover shifts to near-black `#141C36` rather than a lighter purple +- `Checkbox` / `Toggle` use the same blue `#0073C4` +- `Card` has softer shadows (navy-200 vs navy-800 in Codecademy light mode) +- Card shadow patterns (`patternLeft`, `patternRight`) are available but rarely used in Percipio UIs + +--- + +## Do's and Don'ts + +### Colors + +- **Do** use semantic color aliases (`primary`, `text`, `background`, etc.) — never hardcode hex values. +- **Do** use `#0073C4` blue as the only primary interactive color. +- **Don't** use Codecademy's hyper-purple or yellow in Percipio contexts. +- **Don't** attempt dark mode — Percipio is light only. + +### Typography + +- **Do** use title weight (500) for headlines, CTAs, and buttons — not 700. +- **Do** keep body text at 150–175% line height for readability. +- **Don't** use a separate accent typeface — Roboto is used uniformly for base and accent. +- **Don't** right-align or center-align body paragraphs. +- **Don't** adjust letter-spacing. + +### Layout & Spacing + +- **Do** use multiples of 8px for block-element spacing (4px only for inline / typographic relationships). +- **Do** begin design work at 1440px (XL), then adapt down. +- **Do** align elements to the 12-column grid. + +--- + +## Agent Prompt Guide + +Quick color/token reference for generating or specifying Percipio UI: + +| Scenario | Tokens | +|---|---| +| Primary button | `bg: primary (#0073C4)`, `color: white`, `hover: primary-hover (#141C36)` | +| Body text | `color: text (#222325)`, `font: Roboto`, `size: 16px`, `weight: 400`, `lineHeight: base (1.5)` | +| Headline | `color: text (#222325)`, `font: Roboto`, `size: 34–64px`, `weight: title (500)`, `lineHeight: title (1.2)` | +| Secondary text | `color: text-secondary (#595A5C)` | +| Disabled text | `color: text-disabled (#AFB6C2)` | +| Elevated surface | `bg: background-primary (#FAFBFC)` | +| Card default | `bg: background (#ffffff)`, `borderRadius: none` — add `isInteractive` for hover shadow + `borderRadius: md` | +| Error state | `color: feedback-error (#B83C3C)`, `bg: background-error (#FFF1F5)`, `border: danger` | +| Success state | `color: feedback-success (#1B8057)`, `bg: background-success (#EEF7F3)` | +| Warning state | `color: feedback-warning (#EF5B0D)`, `bg: background-warning (#FFF7E0)` | +| Disabled state | `color: text-disabled (#AFB6C2)`, `bg: background-disabled (#E2E3E6, navy-200)`, `border: border-disabled` | + +### Component token cheatsheet + +``` +FillButton → bg: primary (#0073C4), color: white, hover: primary-hover (#141C36) +StrokeButton → bg: transparent, border: secondary (#6A6E75) +Checkbox/Toggle → interface (#0073C4), hover: interface-hover (#141C36) +Card → bg: background, shadow: shadow-primary (#E2E3E6, navy-200, soft) +Alert (error) → uses feedback-error + background-error +Alert (success) → uses feedback-success + background-success +Alert (warning) → uses feedback-warning + background-warning +``` diff --git a/packages/gamut/agent-tools/DESIGN.md b/packages/gamut/agent-tools/DESIGN.md new file mode 100644 index 00000000000..7348c62f892 --- /dev/null +++ b/packages/gamut/agent-tools/DESIGN.md @@ -0,0 +1 @@ +DEPRECATED. Use the appropriate DESIGN.*.md from https://github.com/Codecademy/gamut/pull/3329 instead. diff --git a/packages/gamut/agent-tools/agents/.gitkeep b/packages/gamut/agent-tools/agents/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/gamut/agent-tools/commands/gamut-review.md b/packages/gamut/agent-tools/commands/gamut-review.md new file mode 100644 index 00000000000..9284a3b155d --- /dev/null +++ b/packages/gamut/agent-tools/commands/gamut-review.md @@ -0,0 +1,246 @@ +--- +description: Use this command when auditing existing code for Gamut usage — dependencies, GamutProvider, deep imports, hardcoded hex colors, and test patterns — and you need a consolidated report with pointers to the matching Gamut skills. +argument-hint: [path] +allowed-tools: Read Glob Grep +--- + +This is an audit of existing code at `$ARGUMENTS` (default: current working directory). Your job is to find violations and misuse, not to generate new code. + +When `DESIGN.md` is present at the audit root, use it as the authoritative reference for product design intent, token names, and component patterns. It is copied from `DESIGN.Codecademy.md`, `DESIGN.Percipio.md`, or `DESIGN.LXStudio.md` in `@codecademy/gamut` agent-tools (via `gamut plugin install --theme `). When a finding maps to a skill, note it in the report so the developer knows where to get remediation guidance. + +Run Check 0 first, then Checks 1–5, then print a single consolidated report using the format at the end of this file. + +--- + +## Check 0 — DESIGN.md present + +Resolve the audit root: `$ARGUMENTS` if provided, otherwise the current working directory. Look for `DESIGN.md` at that root (not inside `node_modules` or package subfolders unless the audit path is explicitly that folder). + +| Result | Action | +| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Found | Report `✓ DESIGN.md present ()`. Proceed with Checks 1–5 using this file for product/theme context. | +| Missing | Report `✗ DESIGN.md not found` as a blocking finding. Include remediation: from the repo root run `gamut plugin install cursor --theme core` (or `percipio`, `lxstudio`, `admin`, `platform`; also `claude`), or manually copy the matching `DESIGN.*.md` from `@codecademy/gamut` agent-tools and rename to `DESIGN.md`. Still run Checks 1–3 and 5. For Check 4, list hex violations with `palette:` / `semantic:` only where Appendix A/B apply without product YAML — prefix the Hardcoded colors section with `⚠ low confidence — no DESIGN.md` and do not assume Codecademy Core semantics; do not use Appendix B shortcuts as authoritative. | + +--- + +## Check 1 — Dependencies + +Read `package.json` (and `package.json` in `$ARGUMENTS` if a path was given). Inspect `dependencies`, `devDependencies`, and `peerDependencies` combined. + +| Package | Expectation | +| -------------------------- | ------------------------------------------------------- | +| `@codecademy/gamut` | Required — core component library | +| `@codecademy/gamut-styles` | Recommended — design tokens and theme primitives | +| `@codecademy/variance` | Recommended — style-prop system used by Gamut internals | + +--- + +## Check 2 — Setup + +Search source files (`.ts`, `.tsx`, `.js`, `.jsx`) for these symbols. Skip `node_modules`, `dist`, `.next`, `build`, `.turbo`. + +| Symbol | Expectation | +| --------------- | ------------------------------------------------------------------- | +| `GamutProvider` | Required — must appear at least once (app root wrapper) | +| `ColorMode` | Recommended — enables semantic light/dark theming | +| `Background` | Recommended — semantic surface color via `@codecademy/gamut-styles` | + +For each found symbol report the first file path where it appears. + +--- + +## Check 3 — Import patterns + +Grep source files for any of these patterns. Each match is an error. + +| Pattern | Reason | +| ------------------------------- | ----------------------------------------------------------------------- | +| `@codecademy/gamut/dist/` | Deep dist import — bypasses public API and breaks on internal refactors | +| `@codecademy/gamut/src/` | Deep src import — not part of the published package | +| `@codecademy/gamut-styles/src/` | Deep src import — use the package root | +| `@codecademy/variance/src/` | Deep src import — use the package root | + +Report each violation as `file:line`. + +--- + +## Check 4 — Hardcoded colors (semantic-first) + +Rule: Inline hex literals in application UI code are violations. Remediation is not “replace hex with `navy-800`” — prefer semantic ColorMode tokens (`text`, `background`, `primary`, …) so light/dark and theme switches stay correct. Reserve raw palette tokens for colors that must stay fixed and for `bg` on `` from `@codecademy/gamut-styles` (section surfaces with content). + +Align findings with project docs and Storybook: + +- [@codecademy/gamut agent-tools `guidelines/foundations/color.md`](https://github.com/Codecademy/gamut/blob/main/packages/gamut/agent-tools/guidelines/foundations/color.md) — decision guide and semantic tables. +- [Foundations / ColorMode](https://gamut.codecademy.com/?path=/docs-foundations-colormode--page) — aliases per mode; `` behavior. +- [Meta / Best practices](https://gamut.codecademy.com/?path=/docs-meta-best-practices--page) — semantic colors + `css` / `variant` / `states` from `gamut-styles`. +- Foundations / Theme stories (Core, Admin, Platform, Percipio, LX Studio) — verify hex ↔ semantic if the product is not Codecademy Core. + +Theme context: If Check 0 passed, infer product/theme from root `DESIGN.md` and `GamutProvider` / app config. If Check 0 failed, follow the low-confidence rules in Check 0 — do not assume Codecademy Core semantics. If `DESIGN.md` exists but theme is still unclear, add a report note to confirm against the correct theme Storybook page. + +Discovery: Grep source files (`.ts`, `.tsx`, `.js`, `.jsx`, `.css`, `.scss`, `.less`) for inline hex literals (`#RGB` or `#RRGGBB`). Comparison is case-insensitive. Skip `node_modules`, `dist`, `.next`, `build`, `.turbo` (same spirit as other checks). + +### Workflow (each hex match) + +1. Context — Inspect the surrounding line(s): CSS property (`color`, `background`, `border-color`, …), JSX prop (`color`, `bg`, `borderColor`, SVG fill), or asset. Note whether the subtree is a section with content (candidate for `` + palette `bg`) vs component chrome (prefer semantics). +2. Identify palette — Normalize hex (case-insensitive); map to a Gamut palette name using Appendix A below. If missing from the appendix, match against `DESIGN.md` / `packages/gamut-styles` palette definitions. +3. Recommend semantic first — Use Appendix B (Core light literals from `color.md`) plus role: + - Body / UI foreground → `text`; strong emphasis → `text-accent`. + - Page or card fill → `background` / `background-primary` / state surfaces (`background-success`, `background-warning`, `background-error`). + - CTAs, links, hyper accents → `primary` (+ `primary-hover` on hover); toggles / checkboxes → `interface`. + - Ghost / secondary buttons → `secondary`. + - Destructive → `danger` / `danger-hover`. + - Dividers / outlines → `border-primary` / `border-secondary` / `border-tertiary`. + - Inline feedback copy → `feedback-error` / `feedback-success` / `feedback-warning`. + - Disambiguation: `#FFD300` — warning copy → `feedback-warning`; yellow accent on top of primary-colored surfaces → `primary-inverse`. + - Same hex can map to multiple semantics (e.g. `#10162F` → `text` vs `border-primary` vs `secondary`): pick from property + component role. +4. When palette-only is OK — `bg` prop on `` (``, etc.) is the primary place for fixed surface palette colors on sections (see `color.md` decision guide + ColorMode docs). After replacing hex there, use a named palette token, not hex. Exceptions (flag with rationale): charts/data viz, third-party widgets, exported static illustrations — still prefer tokens over hex when feasible. + +Severity: Hex on adaptive UI (random wrappers, `styled-components`, inline `style`) → error. Hex inside documented exceptions → warning with note. + +Reporting: For each match outside token definition files: + +`file:line 'HEX' → semantic: | palette: | note: ` + +Use `semantic: (n/a)` only when no semantic applies (e.g. pure illustration); still give `palette: …`. If unmappable: `→ no Gamut token`. + +Ignore hex inside design token definition files (e.g. `variables/colors.ts`, `_colors.scss`) — source of truth, not violations. + +### Appendix B — Core light: hex → suggested semantic (shortcut) + +Use with step 3; verify for non-Core themes. Opacity variants in `color.md` are not listed here — keep using the named semantic token. + +| Hex (normalized) | Typical semantic direction | +| ---------------- | ------------------------------------------------------------------------------------------------------------------------ | +| `#10162f` | `text`, `border-primary`, or `secondary` (by role) | +| `#0a0d1c` | `text-accent` | +| `#ffffff` | `background` (fills), `secondary` (inverse ghost on dark — rare in light-only grep context) | +| `#fff0e5` | `background-primary` | +| `#f5ffe3` | `background-success` | +| `#fffae5` | `background-warning` | +| `#fbf1f0` | `background-error` | +| `#3a10e5` | `primary`, `interface` (controls vs marketing CTA — prefer `primary` for links/buttons) | +| `#5533ff` | `primary-hover`, `interface-hover` | +| `#ffd300` | `feedback-warning` or `primary-inverse` (see disambiguation above) | +| `#cca900` | Often pairs with hover in dark mode; in light UI as literal hex → check palette appendix (`yellow-400`) then assign role | +| `#e91c11` | `danger` | +| `#be1809` | `danger-hover`, `feedback-error` | +| `#008a27` | `feedback-success` | + +Hexes with no row above still get Appendix A palette id + role-based semantic guess (e.g. blue scale → often decorative or legacy marketing; prefer design review unless mapping clearly to `primary`). + +### Appendix A — Hex → palette token (identification only) + +Case-insensitive. Use to label `palette:` in the report; do not stop at this step without Appendix B / role triage. + +| Hex | Token | +| --------- | -------------------------- | +| `#000000` | `black` | +| `#ffffff` | `white` | +| `#10162f` | `navy` / `navy-800` | +| `#0a0d1c` | `navy-900` | +| `#fff0e5` | `beige-100` | +| `#f5fcff` | `blue-0` | +| `#d3f2ff` | `blue-100` | +| `#66c4ff` | `blue-300` | +| `#3388ff` | `blue-400` | +| `#1557ff` | `blue-500` | +| `#1d2340` | `blue-800` | +| `#f5ffe3` | `green-0` | +| `#eafdc6` | `green-100` | +| `#aee938` | `green-400` / `lightGreen` | +| `#008a27` | `green-700` | +| `#151c07` | `green-900` | +| `#fffae5` | `yellow-0` | +| `#cca900` | `yellow-400` | +| `#ffd300` | `yellow-500` / `yellow` | +| `#211b00` | `yellow-900` | +| `#fff5ff` | `pink-0` | +| `#f966ff` | `pink-400` / `pink` | +| `#fbf1f0` | `red-0` | +| `#e85d7f` | `red-300` | +| `#dc5879` | `red-400` / `paleRed` | +| `#e91c11` | `red-500` / `red` | +| `#be1809` | `red-600` | +| `#280503` | `red-900` | +| `#ffe8cc` | `orange-100` | +| `#ff8c00` | `orange-500` / `orange` | +| `#5533ff` | `hyper-400` | +| `#3a10e5` | `hyper-500` / `hyper` | +| `#f5f5f5` | `gray-100` | +| `#eeeeee` | `gray-200` | +| `#e0e0e0` | `gray-300` | +| `#9e9e9e` | `gray-600` | +| `#616161` | `gray-800` | +| `#424242` | `gray-900` | +| `#fffbf8` | `beige-0` | +| `#8a7300` | `gold-800` / `gold` | +| `#d14900` | `orange-800` | +| `#ca00d1` | `pink-800` | +| `#006d82` | `teal-500` / `teal` | +| `#b3ccff` | `purple-300` / `purple` | + +--- + +## Check 5 — Test setup + +Grep test files (`/__tests__//*.{ts,tsx}`, `**/*.test.{ts,tsx}`, `**/*.spec.{ts,tsx}`) for these patterns. Skip `node_modules`, `dist`. + +| Pattern | Verdict | Reason | +| ----------------------------------------------------- | ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `jest.mock\(.*@codecademy/gamut` | Error | Manual mocking bypasses theme context and produces false-positive tests; prefer `setupRtl` from `@codecademy/gamut-tests` (or a harness + `setupRtl`); use raw `MockGamutProvider` + `render` only for rare one-offs or Storybook mocks | +| `jest.mock\(.*@codecademy/gamut-styles` | Error | Same issue as above — mocking gamut-styles breaks token resolution | +| `from '@codecademy/gamut-tests'` | Good — report count of files using it | Correct import for `setupRtl` and `MockGamutProvider` | +| `from 'component-test-setup'` (without gamut-tests) | Warning | Should import `setupRtl` from `@codecademy/gamut-tests`, not directly from `component-test-setup` — the gamut-tests wrapper adds `MockGamutProvider` automatically | +| `new GamutProvider` or ` +══════════════════════════════════════════════════ + +DESIGN.md + ✓ present /DESIGN.md + ✗ missing run: gamut plugin install cursor --theme [blocking for color audit] + +Dependencies + ✓ @codecademy/gamut + ⚠ @codecademy/gamut-styles not found — recommended + ✗ @codecademy/variance not found — recommended + +Setup + ✓ GamutProvider found (src/App.tsx) + ⚠ ColorMode not found — use ColorMode for light/dark theming [→ gamut-color-mode] + ⚠ Background not found — use for semantic surfaces [→ gamut-color-mode] + +Import patterns + ✓ Deep dist imports none found + ✗ Deep src imports 2 occurrences + src/Thing.tsx:7 + src/Other.tsx:12 + +Hardcoded colors [→ gamut-color-mode] + ✗ src/Card.tsx:22 '#10162F' → semantic: text | palette: navy-800 | note: Core light body copy + ⚠ src/Hero.tsx:14 '#1557FF' → semantic: primary (if link/CTA) | palette: blue-500 | note: no exact semantic; confirm theme + ⚠ src/Nav.tsx:8 '#BADA55' → semantic: (n/a) | palette: — | note: no Gamut token + +Test setup [→ gamut-testing] + ✓ @codecademy/gamut-tests used in 12 test files + ✗ jest.mock(@codecademy/gamut) 2 occurrences — remove; prefer setupRtl (or harness + setupRtl) + src/components/Foo/__tests__/Foo.test.tsx:3 + src/components/Bar/__tests__/Bar.test.tsx:5 + ⚠ direct component-test-setup import 1 occurrence — import from @codecademy/gamut-tests + src/components/Baz/__tests__/Baz.test.tsx:2 + +══════════════════════════════════════════════════ + error(s), warning(s) found. (or "All checks passed." if none) +``` + +Icons: `✓` = pass, `⚠` = warning (recommended, not required), `✗` = error (required). +`[→ skill-name]` annotations indicate which Gamut skill has remediation guidance for that category. + +After printing the report, offer one sentence of prioritized next-step advice based on what was found. diff --git a/packages/gamut/agent-tools/guidelines/components/buttons.md b/packages/gamut/agent-tools/guidelines/components/buttons.md new file mode 100644 index 00000000000..15bdb1cd45e --- /dev/null +++ b/packages/gamut/agent-tools/guidelines/components/buttons.md @@ -0,0 +1,91 @@ +# Buttons + +Agent reference: which button component and which `variant` to use. Colors are wired inside each atom — consumers do not pass `color`, `bg`, hex, or semantic token names on stock buttons. + +Related docs: [overview.md](../overview.md) (reading order) · [foundations/color.md](../foundations/color.md) and `gamut-color-mode` skill — semantic tokens for custom styled controls only, not stock button atoms · [foundations/modes.md](../foundations/modes.md) — ColorMode / `` when placing buttons on colored surfaces + +Storybook (UX source of truth): + +- [Atoms / Buttons / Button](https://gamut.codecademy.com/?path=/docs-atoms-buttons-button--docs) — variants, light/dark examples +- [FillButton](https://gamut.codecademy.com/?path=/docs-atoms-buttons-fillbutton--docs) · [StrokeButton](https://gamut.codecademy.com/?path=/docs-atoms-buttons-strokebutton--docs) · [TextButton](https://gamut.codecademy.com/?path=/docs-atoms-buttons-textbutton--docs) · [IconButton](https://gamut.codecademy.com/?path=/docs-atoms-buttons-iconbutton--docs) · [CTAButton](https://gamut.codecademy.com/?path=/docs-atoms-buttons-ctabutton--docs) +- [Meta / Best practices](https://gamut.codecademy.com/?path=/docs-meta-best-practices--page) — semantic tokens for custom `css` / `variant` / `states`, not prebuilt atoms +- [UX Writing / Component guidelines / Buttons](https://gamut.codecademy.com/?path=/docs-ux-writing-component-guidelines-buttons--docs) — label copy + +## Component selection + +| Component | Use for | Default `variant` | +| -------------- | --------------------------------------------- | ------------------------------------------------ | +| `FillButton` | Primary / high-emphasis actions | `primary` | +| `StrokeButton` | Secondary / outlined actions | `primary` (often pass `secondary` per Storybook) | +| `TextButton` | Low-emphasis, inline actions | `primary` | +| `IconButton` | Icon-only; requires `tip` and accessible name | `secondary` | +| `CTAButton` | Marketing / high-visibility CTA only | `primary` (only option) | + +## `variant` prop + +Shared by `FillButton`, `StrokeButton`, `TextButton`, and `IconButton`. `CTAButton` only supports `primary`. + +| `variant` | Typical use | +| ----------- | ------------------------------ | +| `primary` | Submit, main CTA | +| `secondary` | Close, cancel, low priority | +| `danger` | Destructive actions | +| `interface` | Controls styled like UI chrome | + +```tsx +Submit +Cancel + +Try Pro for free +``` + +## Sizes + +`small` | `normal` (default) | `large` + +## Key props + +| Prop | Type | Effect | +| -------------- | ----------------------------------------------------- | ------------------------------------------------ | +| `variant` | `"primary" \| "secondary" \| "danger" \| "interface"` | Color emphasis (see table above) | +| `size` | `"small" \| "normal" \| "large"` | Padding and font size | +| `icon` | Icon component | Leading or trailing icon (Fill, Stroke, Text) | +| `iconPosition` | `"left" \| "right"` | Defaults to left | +| `disabled` | boolean | Disabled state styling | +| `href` | string | Renders as `` tag | +| `tip` | string | Required on `IconButton` (tooltip + hover label) | + +## States + +Hover, active, and disabled colors are handled by the component. Do not override state colors with `color` / `bg` props. + +## Accessibility — `disabled` vs `aria-disabled` + +| Situation | Use | Why | +| --------------------------------------------------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Button should not be activatable (default) | `disabled` prop | Renders native `disabled` on `