@codecademy/gamut 68.6.1-alpha.f6b2ce.0 → 68.6.2-alpha.1fc7ca.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/Modals/elements.d.ts +186 -1
  2. package/dist/Modals/elements.js +3 -3
  3. package/dist/{InternalFloatingCard/InternalFloatingCard.d.ts → PatternBackdrop/PatternBackdrop.d.ts} +8 -24
  4. package/dist/PatternBackdrop/PatternBackdrop.js +42 -0
  5. package/dist/Toast/Toast.js +4 -4
  6. package/package.json +8 -11
  7. package/agent-tools/.claude-plugin/marketplace.json +0 -16
  8. package/agent-tools/.claude-plugin/plugin.json +0 -7
  9. package/agent-tools/.cursor-plugin/plugin.json +0 -7
  10. package/agent-tools/DESIGN.Codecademy.md +0 -696
  11. package/agent-tools/DESIGN.LXStudio.md +0 -512
  12. package/agent-tools/DESIGN.Percipio.md +0 -513
  13. package/agent-tools/DESIGN.md +0 -1
  14. package/agent-tools/agents/.gitkeep +0 -0
  15. package/agent-tools/commands/gamut-review.md +0 -259
  16. package/agent-tools/guidelines/components/animations.md +0 -74
  17. package/agent-tools/guidelines/components/buttons.md +0 -95
  18. package/agent-tools/guidelines/components/card.md +0 -19
  19. package/agent-tools/guidelines/components/coachmark.md +0 -21
  20. package/agent-tools/guidelines/components/data-table.md +0 -79
  21. package/agent-tools/guidelines/components/forms.md +0 -106
  22. package/agent-tools/guidelines/components/loading-states.md +0 -17
  23. package/agent-tools/guidelines/components/menu.md +0 -58
  24. package/agent-tools/guidelines/components/overview.md +0 -124
  25. package/agent-tools/guidelines/components/radial-progress.md +0 -13
  26. package/agent-tools/guidelines/components/select.md +0 -23
  27. package/agent-tools/guidelines/components/tooltips.md +0 -22
  28. package/agent-tools/guidelines/components/video.md +0 -29
  29. package/agent-tools/guidelines/foundations/color.md +0 -168
  30. package/agent-tools/guidelines/foundations/modes.md +0 -69
  31. package/agent-tools/guidelines/foundations/spacing.md +0 -107
  32. package/agent-tools/guidelines/foundations/typography.md +0 -82
  33. package/agent-tools/guidelines/overview-icons.md +0 -19
  34. package/agent-tools/guidelines/overview-illustrations.md +0 -7
  35. package/agent-tools/guidelines/overview-patterns.md +0 -7
  36. package/agent-tools/guidelines/overview.md +0 -84
  37. package/agent-tools/guidelines/setup.md +0 -83
  38. package/agent-tools/rules/accessibility.mdc +0 -78
  39. package/agent-tools/skills/gamut-accessibility/SKILL.md +0 -224
  40. package/agent-tools/skills/gamut-color-mode/SKILL.md +0 -149
  41. package/agent-tools/skills/gamut-components/SKILL.md +0 -46
  42. package/agent-tools/skills/gamut-forms/SKILL.md +0 -101
  43. package/agent-tools/skills/gamut-style-utilities/SKILL.md +0 -111
  44. package/agent-tools/skills/gamut-system-props/SKILL.md +0 -225
  45. package/agent-tools/skills/gamut-testing/SKILL.md +0 -225
  46. package/agent-tools/skills/gamut-theming/SKILL.md +0 -63
  47. package/agent-tools/skills/gamut-typography/SKILL.md +0 -79
  48. package/bin/commands/plugin/install.mjs +0 -213
  49. package/bin/commands/plugin/list.mjs +0 -73
  50. package/bin/commands/plugin/remove.mjs +0 -108
  51. package/bin/commands/plugin/update.mjs +0 -59
  52. package/bin/gamut.mjs +0 -96
  53. package/bin/lib/claude.mjs +0 -52
  54. package/bin/lib/cursor.mjs +0 -40
  55. package/bin/lib/design.mjs +0 -71
  56. package/bin/lib/io.mjs +0 -14
  57. package/bin/lib/resolve-plugin-dir.mjs +0 -38
  58. package/bin/lib/run-command.mjs +0 -22
  59. package/dist/InternalFloatingCard/InternalFloatingCard.js +0 -98
@@ -1,106 +0,0 @@
1
- # Forms
2
-
3
- Gamut provides two form organisms — `GridForm` and `ConnectedForm` — that handle layout, validation, submission state, and field registration. Always use one of these organisms for functional forms. Do not compose forms from individual form atoms when the interface needs submit, validation, reset, or dirty tracking.
4
-
5
- Related: [`skills/gamut-forms/SKILL.md`](../../skills/gamut-forms/SKILL.md) (accessibility wiring) · [`skills/gamut-accessibility/SKILL.md`](../../skills/gamut-accessibility/SKILL.md) (universal ARIA)
6
-
7
- ## When to use each
8
-
9
- | Component | Use when |
10
- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
- | `GridForm` | Declarative, config-driven form. Pass `fields` (and optional `sections`) plus `submit` — layout, labels, validation, and submit button are automatic. Best for settings pages, profile forms, and CRUD dialogs. |
12
- | `ConnectedForm` | Full layout control with managed form state. Provides `react-hook-form` context; compose with `ConnectedFormGroup` and connected inputs. Best for tabs, custom columns, or content interleaved with fields. |
13
-
14
- ## Rules
15
-
16
- 1. Never use bare form atoms for functional forms. `Input`, `Select`, `Checkbox`, `Radio`, `TextArea`, `FormGroup`, and `FormGroupLabel` are building blocks _inside_ organisms. Use them standalone only when there is no submit step (e.g. live search filter, immediate callback toggle).
17
- 2. Prefer `GridForm` over `ConnectedForm` when the layout fits a grid.
18
- 3. Always provide `defaultValues`. Omitting defaults causes uncontrolled-to-controlled warnings and broken resets.
19
- 4. Use `validation="onChange"` when the submit button should stay disabled until required fields are valid. Default `"onSubmit"` validates only on submit.
20
- 5. `GridForm` sections — use `GridFormSectionProps` (`title`, `as`, `fields`) to group fields under headings in one form, not multiple separate forms.
21
- 6. Import connected inputs from `@codecademy/gamut`. `ConnectedInput`, `ConnectedSelect`, `ConnectedCheckbox`, `ConnectedRadioGroup`, `ConnectedTextArea`, `ConnectedFormGroup`, `SubmitButton`.
22
- 7. `hideLabel: true` on checkbox/radio fields with no `label`. Without it, `FormGroupLabel` renders a stray "(optional)" or "\*" row above the control.
23
- 8. `hideLabel: true` on toggle (`custom` type) fields. `Toggle` renders its own inline label; a `FormGroupLabel` above is redundant.
24
-
25
- ## GridForm example
26
-
27
- ```tsx
28
- import { GridForm } from '@codecademy/gamut';
29
-
30
- <GridForm
31
- fields={[
32
- {
33
- title: 'General',
34
- as: 'h2',
35
- variant: 'title-sm',
36
- fields: [
37
- {
38
- name: 'orgName',
39
- label: 'Organization Name',
40
- type: 'text',
41
- size: 6,
42
- defaultValue: 'Acme Corp',
43
- },
44
- {
45
- name: 'emailNotifs',
46
- description: 'Receive email notifications',
47
- type: 'checkbox',
48
- size: 12,
49
- defaultValue: true,
50
- hideLabel: true,
51
- },
52
- ],
53
- },
54
- ]}
55
- submit={{ contents: 'Save Settings', size: 12 }}
56
- onSubmit={(values) => console.log(values)}
57
- validation="onChange"
58
- />;
59
- ```
60
-
61
- ## ConnectedForm example (`useConnectedForm`)
62
-
63
- Prefer `useConnectedForm` for custom layouts — it types `ConnectedForm` / `ConnectedFormGroup` from `defaultValues` and spreads `connectedFormProps` (defaults + `validationRules`).
64
-
65
- ```tsx
66
- import {
67
- ConnectedForm,
68
- ConnectedFormGroup,
69
- ConnectedInput,
70
- SubmitButton,
71
- useConnectedForm,
72
- } from '@codecademy/gamut';
73
-
74
- export const ProfileForm = () => {
75
- const { ConnectedFormGroup, ConnectedForm, connectedFormProps } =
76
- useConnectedForm({
77
- defaultValues: { displayName: '' },
78
- validationRules: {
79
- displayName: { required: 'Display name is required' },
80
- },
81
- });
82
-
83
- return (
84
- <ConnectedForm
85
- onSubmit={(values) => console.log(values)}
86
- validation="onChange"
87
- {...connectedFormProps}
88
- >
89
- <ConnectedFormGroup
90
- name="displayName"
91
- label="Display Name"
92
- field={{ component: ConnectedInput }}
93
- />
94
- <SubmitButton>Save</SubmitButton>
95
- </ConnectedForm>
96
- );
97
- };
98
- ```
99
-
100
- ## Quick reference
101
-
102
- | Layer | Components | When to use directly |
103
- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------- |
104
- | Organisms | `GridForm`, `ConnectedForm` | Always for functional forms |
105
- | Connected inputs | `ConnectedInput`, `ConnectedSelect`, `ConnectedCheckbox`, `ConnectedRadioGroup`, `ConnectedTextArea`, `ConnectedFormGroup`, `SubmitButton` | Only inside `ConnectedForm` |
106
- | Atoms | `Input`, `Select`, `Checkbox`, `Radio`, `TextArea`, `FormGroup`, `FormGroupLabel`, `FormError` | Standalone display / live filters only |
@@ -1,17 +0,0 @@
1
- # Loading states
2
-
3
- Use `Shimmer` or `Spinner` for loading states. Do not use `FeatureShimmer` as a loading indicator.
4
-
5
- Storybook: [Atoms / Shimmer](https://gamut.codecademy.com/?path=/docs-atoms-shimmer--docs) · [Spinner](https://gamut.codecademy.com/?path=/docs-atoms-spinner--docs)
6
-
7
- ## Components
8
-
9
- | Component | Use for |
10
- | ---------------- | --------------------------------------------------------------------------------------------------------------------- |
11
- | `Shimmer` | Skeleton placeholders for content being loaded |
12
- | `Spinner` | Indeterminate spinner for active loading |
13
- | `FeatureShimmer` | Not a loader. Draws attention to secondary new features on a page. Do not use as a general-purpose loading indicator. |
14
-
15
- ## Rule
16
-
17
- `Shimmer` and `Spinner` are the only true loading indicators. `FeatureShimmer` is for new-feature surfacing only.
@@ -1,58 +0,0 @@
1
- # Menu
2
-
3
- `Menu` and `MenuItem` from `@codecademy/gamut` are stateless — the consumer manages `active` and `disabled` state.
4
-
5
- Related: [`skills/gamut-accessibility/SKILL.md`](../../skills/gamut-accessibility/SKILL.md)
6
-
7
- Storybook: [Molecules / Menu](https://gamut.codecademy.com/?path=/docs-molecules-menu--docs)
8
-
9
- ## Variants — always set explicitly
10
-
11
- Always pass the `variant` prop. Relying on the default produces the wrong variant for persistent navigation.
12
-
13
- | Variant | Use for | Rendering |
14
- | --------- | ------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
15
- | `fixed` | Persistent inline navigation — sidebars, primary nav, footer nav, any menu that does not open/close on interaction. | Must use `as="nav"` for accessible navigation. |
16
- | `popover` | Temporary surfaces — overflow menus, action menus, kebab menus, dismiss on outside click. | Default popover surface. |
17
-
18
- ### Fixed (sidebar / persistent navigation)
19
-
20
- ```tsx
21
- <Menu variant="fixed" as="nav">
22
- <MenuItem
23
- active={activeId === 'overview'}
24
- onClick={() => setActive('overview')}
25
- >
26
- Overview
27
- </MenuItem>
28
- <MenuItem
29
- active={activeId === 'settings'}
30
- onClick={() => setActive('settings')}
31
- >
32
- Settings
33
- </MenuItem>
34
- </Menu>
35
- ```
36
-
37
- ### Popover (overflow / action menu)
38
-
39
- ```tsx
40
- <Menu variant="popover">
41
- <MenuItem onClick={handleEdit}>Edit</MenuItem>
42
- <MenuItem disabled label="Owner permissions required" onClick={handleDelete}>
43
- Delete
44
- </MenuItem>
45
- </Menu>
46
- ```
47
-
48
- ## `MenuItem` state
49
-
50
- - `active: boolean` — currently selected item; drive from your state.
51
- - `disabled: boolean` — unavailable for interaction.
52
- - `label: string` — when `disabled`, renders a `ToolTip` explaining why. Provide for any disabled item users might question.
53
-
54
- ## Do not stretch `Menu` in flex layouts
55
-
56
- `Menu` is a flex column sized to its content. If an ancestor is a flex child that stretches (`flex={1}`, `height: 100%`, `alignSelf: stretch`), the menu expands and items spread apart.
57
-
58
- Rule: Wrap `Menu` in a block-level container with intrinsic height (`as="nav"` on a fixed menu, `Box`, or `div`). Do not use `FlexBox` as the immediate wrapper, and do not apply stretch on ancestors between `Menu` and the sidebar scroll container.
@@ -1,124 +0,0 @@
1
- # Components
2
-
3
- 52 components have Figma ↔ code mappings via Figma Code Connect (`packages/code-connect/`). Live code snippets appear in Figma's inspect panel when you select a component.
4
-
5
- ## Core rules
6
-
7
- - Always use existing Gamut components from `packages/gamut/src` rather than one-off equivalents. See the quick reference table below.
8
- - Apply exact sizing, variant, and props from the source. Never rely on defaults when the design or prompt specifies a value (e.g. `size="small"` on `Input`, `sizeVariant="small"` on `Select`).
9
- - When unsure, reference `Badge`, `Tag`, or button atoms in `packages/gamut/src`.
10
-
11
- ## Forms vs. standalone inputs
12
-
13
- Functional forms — submit/save bundling multiple fields, validation, errors, or dirty tracking — must use `GridForm` or `ConnectedForm`. Read [forms.md](forms.md) before building any functional form.
14
-
15
- Standalone inputs — live search, real-time filters, single controls that update state immediately — use bare atoms (`Input`, `Select`, `Checkbox`, `Radio`, `TextArea`, `FormGroup`). No organism when there is no submit step.
16
-
17
- The test: submit/save bundled values → organism. Real-time state with no submit → atom.
18
-
19
- ## Component discovery
20
-
21
- Before custom markup for any UI pattern:
22
-
23
- 1. Enumerate exports — check `@codecademy/gamut` public API or `index.d.ts`.
24
- 2. Prefer Gamut over raw HTML — e.g. `Menu` for nav, `DataTable` for tables, `Tabs` for tabs. Do not rebuild from `<ul>` / `<motion.div>` when a primitive exists.
25
- 3. Read type definitions for props before custom wrappers.
26
- 4. Never build custom media players — use `Video` ([video.md](video.md)).
27
- 5. When no Gamut component exists, comment: `{/* No Gamut component for [pattern] — custom markup */}`
28
-
29
- ### Quick reference
30
-
31
- | UI Pattern | Gamut component(s) | Guide |
32
- | --------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------ |
33
- | Buttons | `FillButton`, `StrokeButton`, `TextButton`, `IconButton`, `CTAButton` | [buttons.md](buttons.md) |
34
- | Links | `Anchor` | — |
35
- | Typography | `Text` | [`gamut-typography` skill](../../skills/gamut-typography/SKILL.md) |
36
- | Markdown | `Markdown` | — |
37
- | Layout | `Box`, `FlexBox`, `GridBox`, `Layout`, `LayoutGrid` | [spacing.md](../foundations/spacing.md) |
38
- | Animations | `Rotation`, `ExpandInCollapseOut`, `FadeInSlideOut` | [animations.md](animations.md) |
39
- | Page containers | `ContentContainer`, `GridContainer` | — |
40
- | Navigation / menus | `Menu`, `MenuItem`, `MenuSeparator` | [menu.md](menu.md) |
41
- | Breadcrumbs | `Breadcrumbs` | — |
42
- | Pagination | `Pagination` | — |
43
- | Tabs | `Tabs` | [`gamut-accessibility` skill](../../skills/gamut-accessibility/SKILL.md) |
44
- | Accordions | `Disclosure` | — |
45
- | Data tables | `DataTable`, `DataList` | [data-table.md](data-table.md) |
46
- | Lists | `List` | — |
47
- | Cards | `Card` | [card.md](card.md) |
48
- | Charts | `BarChart` | — |
49
- | Modals | `Dialog` (binary confirm/cancel); `Modal` (multi-view, complex) | [`gamut-accessibility` skill](../../skills/gamut-accessibility/SKILL.md) |
50
- | Drawers / flyouts | `Drawer`, `Flyout` | [`gamut-accessibility` skill](../../skills/gamut-accessibility/SKILL.md) |
51
- | Overlays / focus trap | `Overlay`, `FocusTrap` | [`gamut-accessibility` skill](../../skills/gamut-accessibility/SKILL.md) |
52
- | Popovers | `Popover`, `PopoverContainer` | — |
53
- | Tooltips | `ToolTip`, `InfoTip`, `PreviewTip` | [tooltips.md](tooltips.md) |
54
- | Onboarding | `Coachmark` | [coachmark.md](coachmark.md) |
55
- | Alerts / toasts | `Alert`, `Toast`, `Toaster` | — |
56
- | Badges / tags | `Badge`, `Tag` | — |
57
- | Progress | `ProgressBar`, `RadialProgress` | [radial-progress.md](radial-progress.md) |
58
- | Loading | `Shimmer`, `Spinner` | [loading-states.md](loading-states.md) |
59
- | Video | `Video` | [video.md](video.md) |
60
- | Forms | `GridForm`, `ConnectedForm` | [forms.md](forms.md) |
61
- | Standalone inputs | `Input`, `Select`, `Checkbox`, `Radio`, `TextArea`, `FormGroup` | Forms breadcrumb above |
62
- | Rich select | `SelectDropdown` | [select.md](select.md) |
63
- | Date | `DatePicker` | [`gamut-forms` skill](../../skills/gamut-forms/SKILL.md) |
64
- | Toggle (standalone) | `Toggle` | — |
65
- | Screen reader text | `HiddenText` | — |
66
- | Skip link | `SkipToContent` | — |
67
- | Dark / light regions | `ColorMode`, `Background` | [modes.md](../foundations/modes.md) |
68
-
69
- ## Validate variant props
70
-
71
- `Card`, `Badge`, `Tag`, and `Alert` accept specific `variant` values. Invalid strings (e.g. `"navy-on-white"`) crash `parseToHsl()` at runtime. Inspect prop types in `@codecademy/gamut` before using variant/color props. See [card.md](card.md) for `Card` variants.
72
-
73
- ## Catalog by layer
74
-
75
- ### Atoms
76
-
77
- Badge, FillButton, StrokeButton, CTAButton, TextButton, IconButton, Card, Checkbox, CodeBlock, Drawer, FlexBox, FormGroup, GridBox, HiddenText, Icon, Input, Label, Loader, Radio, Select, Spinner, Tag, TextArea, Toggle, Tooltip
78
-
79
- ### Molecules
80
-
81
- Alert, Anchor, Breadcrumbs, Coachmark, Disclosure, GridForm, Markdown, Menu, Modal, Pagination, Popover, ProgressBar, Table, Tabs, Toast, Toaster, Video
82
-
83
- ### Organisms
84
-
85
- ContentContainer, GridContainer, Layout, LayoutGrid
86
-
87
- ## Key patterns
88
-
89
- ### Buttons
90
-
91
- [buttons.md](buttons.md) — `FillButton` primary, `StrokeButton` secondary.
92
-
93
- ### Forms and accessibility
94
-
95
- [forms.md](forms.md) · [`gamut-forms` skill](../../skills/gamut-forms/SKILL.md) · [`gamut-accessibility` skill](../../skills/gamut-accessibility/SKILL.md)
96
-
97
- ### Cards
98
-
99
- See [card.md](card.md). Variants include `default`, `white`, `yellow`, `hyper`, `navy`. Confirm against `DESIGN.md` for theme-specific surfaces.
100
- `FormGroup`, `GridForm`, `ConnectedForm`, tips, dialogs, composite widgets: [`skills/gamut-forms/SKILL.md`](../../skills/gamut-forms/SKILL.md) (forms) · [`skills/gamut-accessibility/SKILL.md`](../../skills/gamut-accessibility/SKILL.md) (overlays, composites, checklists) · Storybook [Meta / Best practices](https://gamut.codecademy.com/?path=/docs-meta-best-practices--page).
101
-
102
- - Background variants: `default` (ColorMode-responsive), `white`, `yellow`, `beige`, `navy`, `hyper`
103
- - Shadow variants: `none` (default), `outline`, `patternLeft`, `patternRight`
104
- - Add `isInteractive` when wrapping in `<Anchor>` — enables hover shadow + `borderRadius: md`
105
- - Default `borderRadius` is `none`; override with `borderRadius` prop
106
-
107
- ### Color-aware regions
108
-
109
- [foundations/modes.md](../foundations/modes.md) — `<ColorMode mode="light|dark|system">`, `<Background bg="…">`.
110
-
111
- ### Alerts
112
-
113
- | Variant | Tokens |
114
- | ------- | ----------------------------------------- |
115
- | Error | `feedback-error` + `background-error` |
116
- | Success | `feedback-success` + `background-success` |
117
- | Warning | `feedback-warning` + `background-warning` |
118
-
119
- ## Global tokens
120
-
121
- | Token | Value | Use |
122
- | -------------- | ----------------------- | ------------------ |
123
- | `headerHeight` | 64px (base), 80px (md+) | Global page header |
124
- | `headerZ` | 15 | Header z-index |
@@ -1,13 +0,0 @@
1
- # RadialProgress
2
-
3
- Storybook: [Molecules / RadialProgress](https://gamut.codecademy.com/?path=/docs-molecules-radialprogress--docs)
4
-
5
- ## Labels as `children` by default
6
-
7
- `RadialProgress` renders children in a centered overlay inside the ring. Place the label (e.g. percentage text) as a child, not as a sibling below the component, unless the design explicitly places it outside the ring.
8
-
9
- ```tsx
10
- <RadialProgress percent={75}>
11
- <Text>75%</Text>
12
- </RadialProgress>
13
- ```
@@ -1,23 +0,0 @@
1
- # Select vs. SelectDropdown
2
-
3
- `Select` is a native select suitable for most dropdown needs. Prefer `Select` over `SelectDropdown` for simple lists.
4
-
5
- Storybook: [Atoms / Select](https://gamut.codecademy.com/?path=/docs-atoms-select--docs) · [Organisms / SelectDropdown](https://gamut.codecademy.com/?path=/docs-organisms-selectdropdown--docs)
6
-
7
- ## When to use `SelectDropdown`
8
-
9
- Only when you need:
10
-
11
- - Searchable/filterable options (`isSearchable`)
12
- - Multi-select (`multiple`)
13
- - Option subtitles, right labels, icons, abbreviations
14
- - Grouped options with dividers and group labels
15
- - Custom option styling
16
-
17
- ## When to use `Select`
18
-
19
- Plain option lists with no enrichment — simpler, more performant, and more accessible.
20
-
21
- ## Sizing
22
-
23
- Apply exact sizing from the design (e.g. `sizeVariant="small"` on `Select`) — do not rely on defaults when the source specifies a value.
@@ -1,22 +0,0 @@
1
- # ToolTip and InfoTip
2
-
3
- Related: [`skills/gamut-accessibility/SKILL.md`](../../skills/gamut-accessibility/SKILL.md) (`aria-describedby`, `InfoTip` labeling)
4
-
5
- Storybook: [Molecules / ToolTip](https://gamut.codecademy.com/?path=/docs-molecules-tips-tooltip--docs) · [InfoTip](https://gamut.codecademy.com/?path=/docs-molecules-tips-infotip--docs)
6
-
7
- ## Use `placement: 'floating'` inside overflow containers
8
-
9
- `ToolTip` defaults to `placement: 'inline'`, which is clipped by ancestors with `overflow: hidden` (e.g. `DataTable` rows).
10
-
11
- When an `IconButton` or `ToolTip` is inside a table, card, or clipping container:
12
-
13
- - `tipProps={{ placement: 'floating' }}` on `IconButton`
14
- - `placement="floating"` on `ToolTip` directly
15
-
16
- This renders the tooltip in a floating layer above surrounding content.
17
-
18
- ## Use `alignment="bottom-*"` near the top of the viewport
19
-
20
- Tips default to opening above the trigger. Near the page top (e.g. in a heading), the tip can clip.
21
-
22
- Pass `alignment="bottom-right"` or `"bottom-left"` so the tip opens downward.
@@ -1,29 +0,0 @@
1
- # Video
2
-
3
- Never build custom media players. Gamut exports `Video` (built on `@vidstack/react`) with controls, poster support, text tracks, and accessibility.
4
-
5
- Storybook: [Molecules / Video](https://gamut.codecademy.com/?path=/docs-molecules-video--docs)
6
-
7
- ## Rule
8
-
9
- Before constructing `<video>`, image + play-button overlays, or third-party embed wrappers, use `Video`.
10
-
11
- ## Common props
12
-
13
- | Prop | Purpose |
14
- | ------------------ | ------------------- |
15
- | `videoUrl` | Video source |
16
- | `placeholderImage` | Poster thumbnail |
17
- | `videoTitle` | Accessibility title |
18
- | `controls` | Standard player UI |
19
-
20
- ```tsx
21
- import { Video } from '@codecademy/gamut';
22
-
23
- <Video
24
- videoUrl="https://example.com/video.mp4"
25
- placeholderImage="https://example.com/poster.jpg"
26
- videoTitle="Course introduction"
27
- controls
28
- />;
29
- ```
@@ -1,168 +0,0 @@
1
- # Color
2
-
3
- Use semantic aliases for UI that should respond to color mode (light/dark) and theme (Core, Admin, Platform, Percipio, LX Studio). The same semantic token names (`text`, `primary`, `background`, …) exist across themes; resolved palette values and hex differ by `GamutProvider` theme and active ColorMode. Never assume Codecademy Core hex when advising another product.
4
-
5
- Prefer `css` / `variant` / `states` from `@codecademy/gamut-styles` with semantic names (see Storybook [Best practices](https://gamut.codecademy.com/?path=/docs-meta-best-practices--page)).
6
-
7
- Related: [`setup.md`](../setup.md) (which theme to import) · [`gamut-theming` skill](../../skills/gamut-theming/SKILL.md) · [`gamut-style-utilities` skill](../../skills/gamut-style-utilities/SKILL.md) · [`gamut-color-mode` skill](../../skills/gamut-color-mode/SKILL.md) · [`modes.md`](modes.md) (`<ColorMode>`, `<Background>`)
8
-
9
- Percipio, LX Studio, Admin, and Platform override subsets of semantic mappings while keeping the shared alias API — see theme sources below before hardcoding palette names or hex.
10
-
11
- ## Semantic aliases (theme-stable names)
12
-
13
- These tokens describe roles. Actual colors come from the active theme + ColorMode.
14
-
15
- ### Text
16
-
17
- | Token | Use for | Notes |
18
- | ---------------- | --------------------------- | -------------------------- |
19
- | `text` | Default body and UI text | |
20
- | `text-accent` | Stronger emphasis text | |
21
- | `text-secondary` | Supporting / secondary copy | Often opacity on base text |
22
- | `text-disabled` | Disabled state labels | |
23
-
24
- ### Background
25
-
26
- | Token | Use for | Notes |
27
- | --------------------- | --------------------------------- | ------------------------- |
28
- | `background` | Default page/component background | |
29
- | `background-primary` | Slightly elevated surfaces | |
30
- | `background-contrast` | Maximum contrast surface | |
31
- | `background-selected` | Selected row / item | Often low-opacity overlay |
32
- | `background-hover` | Hover state overlay | |
33
- | `background-disabled` | Disabled surface | |
34
- | `background-success` | Success state container | |
35
- | `background-warning` | Warning state container | |
36
- | `background-error` | Error state container | |
37
-
38
- ### Interactive
39
-
40
- | Token | Use for | Notes |
41
- | ----------------- | ----------------------------------------- | ---------------------------- |
42
- | `primary` | Primary CTA, links, focus accents | Pairs with `primary-hover` |
43
- | `primary-hover` | Hover on primary interactive | |
44
- | `primary-inverse` | Accent on top of primary-colored surfaces | |
45
- | `secondary` | Secondary CTA, ghost buttons | Pairs with `secondary-hover` |
46
- | `secondary-hover` | Hover on secondary interactive | |
47
- | `danger` | Destructive actions, error emphasis | Pairs with `danger-hover` |
48
- | `danger-hover` | Hover on danger interactive | |
49
-
50
- ### Border
51
-
52
- | Token | Use for | Notes |
53
- | ------------------ | -------------------------- | ----- |
54
- | `border-primary` | Strong borders, dividers | |
55
- | `border-secondary` | Medium-weight borders | |
56
- | `border-tertiary` | Subtle borders, separators | |
57
- | `border-disabled` | Disabled input borders | |
58
-
59
- ### Feedback
60
-
61
- | Token | Use for | Notes |
62
- | ------------------ | -------------------------- | ----- |
63
- | `feedback-error` | Error messages, validation | |
64
- | `feedback-success` | Success messages | |
65
- | `feedback-warning` | Warning messages | |
66
-
67
- ## Where resolved colors are documented
68
-
69
- Use these instead of memorizing hex:
70
-
71
- - Storybook [ColorMode](https://gamut.codecademy.com/?path=/docs-foundations-colormode--page) — how aliases map per light/dark for reference layouts.
72
- - Storybook Foundations → Theme — per-product tables and guidance:
73
- - [Core Theme](https://gamut.codecademy.com/?path=/docs-foundations-theme-core-theme--docs)
74
- - [Admin Theme](https://gamut.codecademy.com/?path=/docs-foundations-theme-admin-theme--docs)
75
- - [Platform Theme](https://gamut.codecademy.com/?path=/docs-foundations-theme-platform-theme--docs)
76
- - [Percipio Theme](https://gamut.codecademy.com/?path=/docs-foundations-theme-percipio-theme--docs)
77
- - [LX Studio Theme](https://gamut.codecademy.com/?path=/docs-foundations-theme-lx-studio-theme--docs)
78
- - [Creating Themes](https://gamut.codecademy.com/?path=/docs-foundations-theme-creating-themes--docs) — authoring new themes in `gamut-styles`
79
- - Product design YAML (root `DESIGN.md` from agent-tools): [`DESIGN.Codecademy.md`](../../DESIGN.Codecademy.md), [`DESIGN.Percipio.md`](../../DESIGN.Percipio.md), [`DESIGN.LXStudio.md`](../../DESIGN.LXStudio.md) — semantic ↔ palette for that product.
80
- - Source: theme definitions in [`packages/gamut-styles/src/themes`](https://github.com/Codecademy/gamut/tree/main/packages/gamut-styles/src/themes), palette scales in [`packages/gamut-styles/src/variables`](https://github.com/Codecademy/gamut/tree/main/packages/gamut-styles/src/variables).
81
-
82
- ## Codecademy Core — illustrative light/dark hex only
83
-
84
- The tables below are not valid for Percipio, LX Studio, or other themes. They are a quick mental model for Codecademy Core defaults only.
85
-
86
- ### Text
87
-
88
- | Token | Light | Dark |
89
- | ---------------- | ------------ | --------- |
90
- | `text` | `#10162F` | `#ffffff` |
91
- | `text-accent` | `#0A0D1C` | `#FFF0E5` |
92
- | `text-secondary` | navy-800 75% | white 65% |
93
- | `text-disabled` | navy-800 63% | white 50% |
94
-
95
- ### Background
96
-
97
- | Token | Light | Dark |
98
- | --------------------- | ------------ | --------- |
99
- | `background` | `#ffffff` | `#10162F` |
100
- | `background-primary` | `#FFF0E5` | `#0A0D1C` |
101
- | `background-contrast` | white | black |
102
- | `background-selected` | navy-800 4% | white 4% |
103
- | `background-hover` | navy-800 12% | white 9% |
104
- | `background-disabled` | navy-800 12% | white 9% |
105
- | `background-success` | `#F5FFE3` | `#151C07` |
106
- | `background-warning` | `#FFFAE5` | `#211B00` |
107
- | `background-error` | `#FBF1F0` | `#280503` |
108
-
109
- ### Interactive
110
-
111
- | Token | Light | Dark |
112
- | ----------------- | ------------ | --------- |
113
- | `primary` | `#3A10E5` | `#FFD300` |
114
- | `primary-hover` | `#5533FF` | `#CCA900` |
115
- | `primary-inverse` | `#FFD300` | `#3A10E5` |
116
- | `secondary` | `#10162F` | `#ffffff` |
117
- | `secondary-hover` | navy-800 86% | white 80% |
118
- | `danger` | `#E91C11` | `#E85D7F` |
119
- | `danger-hover` | `#BE1809` | `#DC5879` |
120
-
121
- ### Border
122
-
123
- | Token | Light | Dark |
124
- | ------------------ | ------------ | --------- |
125
- | `border-primary` | `#10162F` | `#ffffff` |
126
- | `border-secondary` | navy-800 75% | white 65% |
127
- | `border-tertiary` | navy-800 28% | white 20% |
128
- | `border-disabled` | navy-800 63% | white 50% |
129
-
130
- ### Feedback
131
-
132
- | Token | Light | Dark |
133
- | ------------------ | --------- | --------- |
134
- | `feedback-error` | `#BE1809` | `#E85D7F` |
135
- | `feedback-success` | `#008A27` | `#AEE938` |
136
- | `feedback-warning` | `#FFD300` | `#FFFAE5` |
137
-
138
- ## Raw palette (Core-centric reference)
139
-
140
- Raw tokens name fixed swatches (surfaces, illustration, `<Background bg="…">` on Codecademy). Palette keys and hex vary by theme — Percipio and others add or remap scales (`percipioPalette`, etc.). Confirm allowed keys in the active theme or `DESIGN.md` before using a raw token in a non-Core app.
141
-
142
- For Codecademy Core defaults:
143
-
144
- | Name | Weights | Key values (illustrative) |
145
- | -------- | -------------------------- | -------------------------------- |
146
- | `navy` | 100–900 | 800 = `#10162F`, 900 = `#0A0D1C` |
147
- | `hyper` | 400, 500 | 500 = `#3A10E5`, 400 = `#5533FF` |
148
- | `yellow` | 0, 400, 500, 900 | 500 = `#FFD300` |
149
- | `red` | 0, 300, 400, 500, 600, 900 | 500 = `#E91C11` |
150
- | `green` | 0, 100, 400, 700, 900 | 700 = `#008A27` |
151
- | `blue` | 0, 100, 300, 400, 500, 800 | 500 = `#1557FF` |
152
- | `beige` | — | `#FFF0E5` |
153
- | `pink` | 0, 400 | 400 = `#F966FF` |
154
- | `orange` | 100, 500 | 500 = `#FF8C00` |
155
-
156
- Named shorthand aliases commonly used on Core surfaces: `beige`, `blue`, `green`, `hyper`, `navy`, `orange`, `pink`, `red`, `yellow`, `black`, `white`
157
-
158
- ## Decision guide
159
-
160
- ```
161
- Which product theme is GamutProvider using?
162
- └─ Unknown → check setup.md / DESIGN.md / Storybook theme page before assuming hex or palette name
163
-
164
- Coloring UI text or backgrounds?
165
- └─ Must adapt to light/dark OR theme? → semantic alias (text, background, primary, …)
166
- └─ Must stay fixed regardless of mode? → raw palette token (confirm key exists in that theme)
167
- └─ Section background with content inside? → <Background bg="…"> (see modes.md)
168
- ```
@@ -1,69 +0,0 @@
1
- # Color Modes
2
-
3
- Gamut uses semantic color aliases so components adapt to light/dark mode without configuration. See [color.md](color.md) for the full alias reference and decision guide.
4
-
5
- Product tokens: Semantic mappings vary by theme. Confirm aliases and palette keys against root `DESIGN.md` and the active theme Storybook page — do not assume Codecademy Core values in Percipio, LX Studio, or other products.
6
-
7
- Deep reference: [`skills/gamut-color-mode/SKILL.md`](../../skills/gamut-color-mode/SKILL.md) · Storybook [ColorMode](https://gamut.codecademy.com/?path=/docs-foundations-colormode--page)
8
-
9
- ## When to use the color mode system
10
-
11
- For any dark or light region — sidebars, footers, hero bands, callouts, panels, whole-app dark mode — use `ColorMode` or `Background` from `@codecademy/gamut-styles`. Do not handle these with custom CSS, hardcoded `rgba`, or manual color swaps.
12
-
13
- | Component | Use when |
14
- | ------------ | ----------------------------------------------------------------------------------------------- |
15
- | `ColorMode` | You know the mode (`light`, `dark`, or `system` for OS preference). |
16
- | `Background` | Background color is a palette token and Gamut should pick the best contrast mode automatically. |
17
-
18
- ## Rules
19
-
20
- 1. Never override Gamut colors with custom CSS when a `ColorMode` or `Background` wrapper achieves the same result via tokens.
21
- 2. Prefer `ColorMode` over `Background` when the intended mode is known (e.g. sidebar always dark). Use `Background` when the surface color is fixed and mode should adapt.
22
- 3. `ColorMode` has no `as` prop — nest semantic elements inside (`<nav>`, `<aside>`, `<footer>`).
23
- 4. System props work on `ColorMode` — `p`, `m`, `width`, `position`, etc. without extra wrappers.
24
- 5. `mode="system"` follows OS `prefers-color-scheme`. For in-app theme toggles, pass `mode="light"` or `mode="dark"` from your own state.
25
-
26
- ## `<ColorMode>`
27
-
28
- ```tsx
29
- import { ColorMode } from '@codecademy/gamut-styles';
30
-
31
- <ColorMode mode="light">{children}</ColorMode>
32
- <ColorMode mode="dark">{children}</ColorMode>
33
- <ColorMode mode="system">{children}</ColorMode>
34
- ```
35
-
36
- Props: `mode="light" | "dark" | "system"`
37
-
38
- ## `<Background>`
39
-
40
- Use `<Background>` — not a raw `bg` on layout — for colored sections with text or interactive children. Pass a palette token to `bg` (e.g. `hyper`, `navy`), not a semantic alias.
41
-
42
- ```tsx
43
- import { Background } from '@codecademy/gamut-styles';
44
-
45
- <Background bg="hyper">{children}</Background>;
46
- ```
47
-
48
- Nesting is supported — each `<Background>` creates its own accessible color context.
49
-
50
- ## Hooks
51
-
52
- | Hook | Returns | Use |
53
- | ---------------------- | ------------------------------------- | ---------------------------------------------------------- |
54
- | `useCurrentMode()` | `"light" \| "dark"` | Active mode key only |
55
- | `useColorModes()` | mode key, colors, all modes, resolver | Full mode data + `getColorValue` |
56
- | `usePrefersDarkMode()` | `boolean` | OS dark preference (prefer `mode="system"` on `ColorMode`) |
57
-
58
- Import from `@codecademy/gamut-styles`.
59
-
60
- ## Example (Core theme)
61
-
62
- Core light/dark semantic mappings are documented in Storybook [ColorMode](https://gamut.codecademy.com/?path=/docs-foundations-colormode--page). Other themes remap the same alias names to different palette values — verify in `DESIGN.md` and the product theme story before hardcoding palette fallbacks.
63
- Storybook: [Foundations / ColorMode](https://gamut.codecademy.com/?path=/docs-foundations-colormode--page) · [Meta / Best practices](https://gamut.codecademy.com/?path=/docs-meta-best-practices--page)
64
-
65
- ## Common mistakes
66
-
67
- - Do not use raw palette tokens (`navy-400`, `white`) for text/backgrounds that must adapt across modes — use semantic aliases.
68
- - Do not use a raw `bg` prop on colored sections with content — use `<Background>`.
69
- - Do not wire `usePrefersDarkMode()` into `ColorMode` when `mode="system"` suffices.