@soroush.design/mcp 0.1.2 → 0.1.3

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.
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@ let _modelcontextprotocol_sdk_server_mcp_js = require("@modelcontextprotocol/sdk
3
3
  let zod = require("zod");
4
4
  // src/content.ts
5
5
  const content = {
6
- "version": "2.0.0",
6
+ "version": "2.1.2",
7
7
  "components": [
8
8
  {
9
9
  "name": "ScrollArea",
@@ -654,7 +654,7 @@ const content = {
654
654
  "importPath": "import { MenuItem } from '@soroush.tech/design-system/MenuItem'",
655
655
  "summary": "A row of a list, in one of two roles:",
656
656
  "intro": "A row of a list, in one of two roles:\n\n- **An option of [`Select`](https://docs.soroush.tech/design-system/components/select/)'s listbox**, rendered as a semantic\n `<li role=\"option\">`. Inside a `Select` the selection, highlight, density, and accent props are\n injected automatically - you only supply `value` and the label. On its own it renders a styled,\n static row.\n- **A menu row** inside a [`MenuList`](https://docs.soroush.tech/design-system/components/menu/): a `menuitem` (or `menuitemradio` /\n `menuitemcheckbox`) with a leading icon column, its label and a trailing shortcut, chosen by a\n click, Enter or Space.\n\n```tsx\nimport { Select } from '@soroush.tech/design-system/Select'\nimport { MenuItem } from '@soroush.tech/design-system/MenuItem'\n\n;<Select placeholder=\"Pick a platform\">\n <MenuItem value=\"web\">Web</MenuItem>\n <MenuItem value=\"android\">Android</MenuItem>\n <MenuItem value=\"ios\">iOS</MenuItem>\n</Select>\n```\n\n```tsx\nimport { MenuList } from '@soroush.tech/design-system/Menu'\nimport { MenuItem } from '@soroush.tech/design-system/MenuItem'\n\n;<MenuList aria-label=\"File\" onSelect={run}>\n <MenuItem value=\"open\" startIcon={<Icon name=\"folder\" size=\"sm\" />} shortcut=\"Control+O\">\n Open...\n </MenuItem>\n <MenuItem value=\"share\" disabled note=\"Coming later\">\n Share...\n </MenuItem>\n <MenuItem value=\"wrap\" role=\"menuitemcheckbox\" selected={isWrapped}>\n Wrap lines\n </MenuItem>\n</MenuList>\n```",
657
- "api": "## Props\n\n| Prop | Type | Default | Description |\n| ----------------------- | ----------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `value` | `string \\| number` | - | The value this row represents - reported to `Select`'s `onChange` or `MenuList`'s `onSelect`. **Required inside a `Select`.** |\n| `children` | `ReactNode` | - | The row label. |\n| `as` | `ElementType` | `'li'` | The element used for the root node. |\n| `disabled` | `boolean` | `false` | Disables the row - it cannot be highlighted or chosen. In a menu the keys skip it. |\n| `selected` | `boolean` | `false` | Marks the row as the current selection. **Injected by `Select`**; in a menu it sets `aria-checked` on `menuitemradio` / `menuitemcheckbox` rows and ticks them. |\n| `highlighted` | `boolean` | `false` | Marks the option as the keyboard-highlighted row. **Injected by `Select`.** |\n| `multiple` | `boolean` | `false` | Reserves a leading checkmark slot for multi-select menus. **Injected by `Select`.** |\n| `color` | `keyof Theme['palette']` | `'primary'` | Accent color for hover/selected shading - resolves to `theme.palette[color]`. |\n| `textColor` | `keyof Theme['text']` | color's `main` | Base text color of the row - resolves against `theme.text`. Falls back to the accent color's `main`. |\n| `size` | `keyof Theme['sizes']` | `'md'` | Density token - resolves against `theme.sizes`. |\n| `dense` | `boolean` | `false` | Compact vertical padding, independent of `size`. |\n| `disableGutters` | `boolean` | `false` | Remove the left and right padding. |\n| `divider` | `boolean` | `false` | Add a 1px bottom border to separate the row. |\n| `autoFocus` | `boolean` | `false` | Focus the row on first mount, and whenever `autoFocus` flips from `false` to `true`. |\n| `focusVisibleClassName` | `string` | - | Class applied only while the row has keyboard focus - a `:focus-visible` hook. |\n| `onSelect` | `(value: string \\| number) => void` | - | Fired with `value` when the option is chosen. **Injected by `Select`.** |\n| `id` | `string` | - | DOM id. `Select` assigns one so the trigger can reference it via `aria-activedescendant`. |\n\n### Menu row props\n\nUsed inside a `MenuList`; ignored by `Select`. `color`, `textColor`, `size` and `dense` default to\nthe `MenuList`'s own.\n\n| Prop | Type | Default | Description |\n| ------------------------------- | ----------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `role` | `'menuitem' \\| 'menuitemradio' \\| 'menuitemcheckbox'` | `'menuitem'` | A command, the current choice of a group, or an on/off setting. |\n| `startIcon` | `ReactNode` | - | An icon in the leading column. Every row keeps the column, so labels line up; a checked row shows a tick there. |\n| `shortcut` | `ReactNode` | - | The row's keyboard shortcut, shown quieter at its end and kept out of its name. A string is also given to the row as `aria-keyshortcuts`. |\n| `aria-keyshortcuts` | `string` | - | What a screen reader hears of the row's keys - the `aria-keyshortcuts` form, such as `Control+=` - where it differs from what `shortcut` shows (`Ctrl+=`). It wins over a string `shortcut`. |\n| `note` | `string` | - | Why the row is off - its tooltip and accessible description. |\n| `onClick` | `(event) => void` | - | Fired when the row is chosen, by a click, Enter or Space. |\n| `submenu` | `ReactNode` | - | The rows of a submenu this row opens, beside it. `null` or `[]` is a submenu with nothing in it yet. A row with a submenu opens it rather than being chosen. |\n| `emptyLabel` | `ReactNode` | - | Shown as one disabled row in an empty submenu (\"Coming soon\"); without it, the submenu stays empty. |\n| `secondaryAction` | `ReactNode` | - | A control of the row's own beside it - a close button. It sits with the row in its `role=\"none\"` entry, out of the arrow keys and hidden from assistive technology (a menu owns rows alone): give it `tabIndex={-1}`, and the row a key of its own through `MenuList`'s `onKeyDown`. |\n| `shouldAnnounceSecondaryAction` | `boolean` | `false` | Leaves `secondaryAction` in the accessibility tree - a screen reader finds the control by its own name. A menu owns rows alone, so a control beside a row is an exception a tool may report; name it and keep it out of the tab order. |\n\n### Submenus\n\n```tsx\n<MenuItem\n submenu={[\n <MenuItem key=\"main\" value=\"main\" role=\"menuitemradio\" selected>\n main\n </MenuItem>,\n <MenuItem key=\"feat\" value=\"feat/menu\" role=\"menuitemradio\">\n feat/menu\n </MenuItem>,\n ]}\n>\n Local branches\n</MenuItem>\n<MenuItem submenu={null} emptyLabel=\"Coming soon\">\n Remote branches\n</MenuItem>\n```\n\nA row can't contain rows, so the row and its submenu sit side by side in a `role=\"none\"` entry;\nthe row is `aria-haspopup=\"menu\"` with `aria-expanded`, and shows a chevron that mirrors right to\nleft.\n\n- **Focus decides the submenu.** A row opens its submenu when it takes focus - by the keys or by\n the pointer, which moves focus as it goes - so it is already open when Right is pressed. Focus\n moving to a sibling row closes it.\n- **Keys.** Right, Enter or Space go into the submenu's first enabled row; Left or Escape close it\n and come back to the row. Right to left, Left and Right swap. Each list moves only between its\n own rows.\n- **Choosing** a row anywhere in a submenu is the outer list's choice (`onSelect`) and, in a\n `Menu`, closes the whole menu.\n- **Placement.** Beside the row, on the side away from the menu's `align` edge (to the right of a\n start-aligned menu, left to right), or the other side when the window has no room - and a\n submenu that opened the other way takes its own submenus that way too, so they go on away\n from the menu rather than back over it. With room on neither side - a phone-width window - it\n opens under the row instead, or over it near the bottom, so it never covers the row it came\n from.\n\n### Rows from data\n\nRows can come as data instead - see [`MenuItems`](https://docs.soroush.tech/design-system/api/menu-items/).\n\n## Notes\n\n- `color` and `textColor` are supplied by `Select` (from its own props), but an item's own value\n **wins** - set them on a `MenuItem` to override the row's accent or text color.\n- Hover and selected shading are derived from `theme.palette[color]` with hex-suffix opacity, so\n the row stays on-theme in both color schemes.\n- `mousedown` is prevented so clicking an option does not blur `Select`'s trigger - the trigger\n keeps focus for its `aria-activedescendant` model. A menu row takes focus itself instead, and the\n pointer moves focus as it goes, so one row is highlighted at a time.\n- A disabled menu row keeps pointer events, so its `note` tooltip shows on hover.\n",
657
+ "api": "## Props\n\n| Prop | Type | Default | Description |\n| ----------------------- | ----------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `value` | `string \\| number` | - | The value this row represents - reported to `Select`'s `onChange` or `MenuList`'s `onSelect`. **Required inside a `Select`.** |\n| `children` | `ReactNode` | - | The row label. |\n| `as` | `ElementType` | `'li'` | The element used for the root node. |\n| `disabled` | `boolean` | `false` | Disables the row - it cannot be highlighted or chosen. In a menu the keys skip it. |\n| `selected` | `boolean` | `false` | Marks the row as the current selection. **Injected by `Select`**; in a menu it sets `aria-checked` on `menuitemradio` / `menuitemcheckbox` rows and ticks them. |\n| `highlighted` | `boolean` | `false` | Marks the option as the keyboard-highlighted row. **Injected by `Select`.** |\n| `multiple` | `boolean` | `false` | Reserves a leading checkmark slot for multi-select menus. **Injected by `Select`.** |\n| `color` | `keyof Theme['palette']` | `'primary'` | Accent color for hover/selected shading - resolves to `theme.palette[color]`. |\n| `textColor` | `keyof Theme['text']` | color's `main` | Base text color of the row - resolves against `theme.text`. Falls back to the accent color's `main`. |\n| `size` | `keyof Theme['sizes']` | `'md'` | Density token - resolves against `theme.sizes`. |\n| `dense` | `boolean` | `false` | Compact vertical padding, independent of `size`. |\n| `disableGutters` | `boolean` | `false` | Remove the left and right padding. |\n| `divider` | `boolean` | `false` | Add a 1px bottom border to separate the row. |\n| `autoFocus` | `boolean` | `false` | Focus the row on first mount, and whenever `autoFocus` flips from `false` to `true`. |\n| `focusVisibleClassName` | `string` | - | Class applied only while the row has keyboard focus - a `:focus-visible` hook. |\n| `onSelect` | `(value: string \\| number) => void` | - | Fired with `value` when the option is chosen. **Injected by `Select`.** |\n| `id` | `string` | - | DOM id. `Select` assigns one so the trigger can reference it via `aria-activedescendant`. |\n\n### Menu row props\n\nUsed inside a `MenuList`; ignored by `Select`. `color`, `textColor`, `size` and `dense` default to\nthe `MenuList`'s own.\n\n| Prop | Type | Default | Description |\n| ------------------------------- | ----------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `role` | `'menuitem' \\| 'menuitemradio' \\| 'menuitemcheckbox'` | `'menuitem'` | A command, the current choice of a group, or an on/off setting. |\n| `startIcon` | `ReactNode` | - | An icon in the leading column. Every row keeps the column, so labels line up; a checked row shows a tick there. |\n| `shortcut` | `ReactNode` | - | The row's keyboard shortcut, shown quieter at its end and kept out of its name. A string is also given to the row as `aria-keyshortcuts`. |\n| `aria-keyshortcuts` | `string` | - | What a screen reader hears of the row's keys - the `aria-keyshortcuts` form, such as `Control+=` - where it differs from what `shortcut` shows (`Ctrl+=`). It wins over a string `shortcut`. |\n| `note` | `string` | - | Why the row is off - shown by a `Tooltip` beside the row (it takes no click, and opens over a disabled row) and the row's accessible description, open or closed. Never a native `title`. |\n| `onClick` | `(event) => void` | - | Fired when the row is chosen, by a click, Enter or Space. |\n| `submenu` | `ReactNode` | - | The rows of a submenu this row opens, beside it. `null` or `[]` is a submenu with nothing in it yet. A row with a submenu opens it rather than being chosen. |\n| `emptyLabel` | `ReactNode` | - | Shown as one disabled row in an empty submenu (\"Coming soon\"); without it, the submenu stays empty. |\n| `secondaryAction` | `ReactNode` | - | A control of the row's own beside it - a close button. It sits with the row in its `role=\"none\"` entry, out of the arrow keys and hidden from assistive technology (a menu owns rows alone): give it `tabIndex={-1}`, and the row a key of its own through `MenuList`'s `onKeyDown`. |\n| `shouldAnnounceSecondaryAction` | `boolean` | `false` | Leaves `secondaryAction` in the accessibility tree - a screen reader finds the control by its own name. A menu owns rows alone, so a control beside a row is an exception a tool may report; name it and keep it out of the tab order. |\n\n### Submenus\n\n```tsx\n<MenuItem\n submenu={[\n <MenuItem key=\"main\" value=\"main\" role=\"menuitemradio\" selected>\n main\n </MenuItem>,\n <MenuItem key=\"feat\" value=\"feat/menu\" role=\"menuitemradio\">\n feat/menu\n </MenuItem>,\n ]}\n>\n Local branches\n</MenuItem>\n<MenuItem submenu={null} emptyLabel=\"Coming soon\">\n Remote branches\n</MenuItem>\n```\n\nA row can't contain rows, so the row and its submenu sit side by side in a `role=\"none\"` entry;\nthe row is `aria-haspopup=\"menu\"` with `aria-expanded`, and shows a chevron that mirrors right to\nleft.\n\n- **Focus decides the submenu.** A row opens its submenu when it takes focus - by the keys or by\n the pointer, which moves focus as it goes - so it is already open when Right is pressed. Focus\n moving to a sibling row closes it.\n- **Keys.** Right, Enter or Space go into the submenu's first enabled row; Left or Escape close it\n and come back to the row. Right to left, Left and Right swap. Each list moves only between its\n own rows.\n- **Choosing** a row anywhere in a submenu is the outer list's choice (`onSelect`) and, in a\n `Menu`, closes the whole menu.\n- **Placement.** Beside the row, on the side away from the menu's `align` edge (to the right of a\n start-aligned menu, left to right), or the other side when the window has no room - and a\n submenu that opened the other way takes its own submenus that way too, so they go on away\n from the menu rather than back over it. With room on neither side - a phone-width window - it\n opens under the row instead, or over it near the bottom, so it never covers the row it came\n from.\n\n### Rows from data\n\nRows can come as data instead - see [`MenuItems`](https://docs.soroush.tech/design-system/api/menu-items/).\n\n## Notes\n\n- `color` and `textColor` are supplied by `Select` (from its own props), but an item's own value\n **wins** - set them on a `MenuItem` to override the row's accent or text color.\n- Hover and selected shading are derived from `theme.palette[color]` with hex-suffix opacity, so\n the row stays on-theme in both color schemes.\n- `mousedown` is prevented so clicking an option does not blur `Select`'s trigger - the trigger\n keeps focus for its `aria-activedescendant` model. A menu row takes focus itself instead, and the\n pointer moves focus as it goes, so one row is highlighted at a time.\n- A disabled menu row keeps pointer events, so its `note` tooltip shows on hover; the row sits in an entry (`role=\"none\"`) with the description the tooltip keeps for it.\n",
658
658
  "examples": "",
659
659
  "url": "https://docs.soroush.tech/design-system/components/menu-item/"
660
660
  },
@@ -759,7 +759,7 @@ const content = {
759
759
  "importPath": "import { Menu } from '@soroush.tech/design-system/Menu'",
760
760
  "summary": "A trigger and the [`MenuList`](https://docs.soroush.tech/design-system/api/menu-list/) of commands it opens.",
761
761
  "intro": "A trigger and the [`MenuList`](https://docs.soroush.tech/design-system/api/menu-list/) of commands it opens. It isn't modal: no\nfocus trap, no scroll lock, nothing laid over the page, so the pointer passes over it and the\npage stays usable around it. The list is placed `position: fixed` in the window, under the\ntrigger, so a panel that scrolls or clips its content can't cut it off - but it stays inside the\nmenu's own box in the DOM, so focus moving inside it is still focus inside the menu.\n\n```tsx\nimport { Menu, MenuDivider } from '@soroush.tech/design-system/Menu'\nimport { MenuItem } from '@soroush.tech/design-system/MenuItem'\nimport { Button } from '@soroush.tech/design-system/Button'\n\n;<Menu trigger={<Button variant=\"text\">main</Button>} onSelect={run}>\n <MenuItem value=\"new\">New branch...</MenuItem>\n <MenuItem value=\"checkout\" disabled note=\"Coming later\">\n Checkout tag or revision...\n </MenuItem>\n <MenuDivider />\n <MenuItem value=\"rename\">Rename...</MenuItem>\n</Menu>\n```",
762
- "api": "## Props\n\n| Prop | Type | Default | Description |\n| ----------------- | ------------------------------------------ | ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `trigger` | `ReactElement` | - | The element that opens the menu - a `Button`, a `Pressable`. It is given `aria-haspopup`, `aria-expanded` and `aria-controls`; its own `onClick` / `onKeyDown` still run. **Required.** |\n| `children` | `ReactNode` | - | `MenuItem` rows and `MenuDivider`s. |\n| `isOpen` | `boolean` | - | Controlled open state. When set, the menu only asks to open or close, through `onOpen` / `onClose`. |\n| `defaultOpen` | `boolean` | `false` | Uncontrolled initial open state. |\n| `onOpen` | `() => void` | - | Fired when the menu asks to open. |\n| `onClose` | `(event, reason: MenuCloseReason) => void` | - | Fired when the menu asks to close: `'escapeKey'`, `'select'` (a row chosen), `'triggerClick'` or `'blur'`. |\n| `onStep` | `(step: -1 \\| 1) => void` | - | Fired when Left or Right has nowhere further to go inside the menu, so a menu bar can step to the next menu. Swapped right to left. |\n| `onSelect` | `(value: string \\| number) => void` | - | Fired with a row's `value` when a row that has one is chosen. |\n| `align` | `'start' \\| 'end'` | `'start'` | Which edge of the trigger the list lines up with. Mirrored right to left. |\n| `marginThreshold` | `keyof Theme['space']` | `2` | The least room between the list and the window's edge. |\n| `elevation` | `PaperElevation` (0-24) | `8` | Shadow depth of the surface. |\n| `borderRadius` | `keyof Theme['radii']` | `theme.defaults.surfaceRadius`, else square | Corner radius of the list. |\n| `layer` | `keyof Theme['zOrder']` | `'modal'` | Stacking layer - `modal` keeps a menu opened in a dialog above it. |\n| `emptyLabel` | `ReactNode` | - | Shown as one disabled row when the menu has no rows (\"Coming soon\"); without it, the list stays empty. |\n| `color` | `keyof Theme['palette']` | - | Accent color for every row. |\n| `textColor` | `keyof Theme['text']` | - | Base text color for every row. |\n| `size` | `keyof Theme['sizes']` | - | Density token for every row. |\n| `dense` | `boolean` | - | Compact vertical padding for every row. |\n| `aria-label` | `string` | trigger's name | Names the list. Without it the trigger names it (`aria-labelledby`). |\n| `className` | `string` | - | Class on the menu's root. |\n\n## Keyboard\n\n| Where | Key | Does |\n| ----------- | ------------------- | ---------------------------------------------------------------------------- |\n| The trigger | Enter / Space | Opens the menu (a click), focusing the checked row or the first enabled one |\n| The trigger | ArrowDown / ArrowUp | Opens the menu, focusing the checked row or the first enabled one |\n| The list | Escape | Closes the menu and gives focus back to the trigger |\n| The list | Enter / Space | Chooses the focused row, closes the menu and gives focus back to the trigger |\n| The list | Left / Right | `onStep(-1)` / `onStep(1)`, when set |\n| The list | Tab | Focus leaves - the menu closes and focus stays where it went |\n\nThe arrow keys, Home, End and type-ahead inside the list are [`MenuList`](https://docs.soroush.tech/design-system/api/menu-list/)'s.\n\n## Notes\n\n- **Placement.** Under the trigger, lined up with its start or end edge; above it when there's\n no room below; moved only as far as it must to stay `marginThreshold` inside the window. It\n follows the trigger on scroll and resize, and is hidden until first placed so it never shows at\n the wrong spot. It can't grow taller than the window.\n- **Not portaled, not `Popover`.** `Popover` is a modal - it moves focus in, traps it and hides\n the rest of the page from assistive technology, which suits a dialog and not a menu. The list is\n fixed in the window instead, inside the menu's box, so closing when focus leaves works and rows\n are found by their nearest `role=\"menu\"`. An ancestor with a `transform`, `filter` or\n `contain` - a zoom wrapper, a sliding drawer - makes itself the containing block of\n `position: fixed`; the list measures where it landed and moves back by the difference, so it\n still opens against its trigger. A scaling transform still scales it.\n- **Submenus.** A `MenuItem` with `submenu` opens a nested list beside it, placed and drawn\n the way the menu's own list is - see [`MenuItem`'s submenus](https://docs.soroush.tech/design-system/api/menu-item/#submenus).\n Escape in a submenu closes only that submenu.\n- **A menu bar.** Hold `isOpen` for each menu and step between them with `onStep`.\n- The list renders nothing until the menu opens, so it costs nothing on the server.\n",
762
+ "api": "## Props\n\n| Prop | Type | Default | Description |\n| ----------------- | ------------------------------------------ | ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `trigger` | `ReactElement` | - | The element that opens the menu - a `Button`, a `Pressable`. It is given `aria-haspopup`, `aria-expanded` and `aria-controls`; its own `onClick` / `onKeyDown` still run. **Required.** |\n| `children` | `ReactNode` | - | `MenuItem` rows and `MenuDivider`s. |\n| `isOpen` | `boolean` | - | Controlled open state. When set, the menu only asks to open or close, through `onOpen` / `onClose`. |\n| `defaultOpen` | `boolean` | `false` | Uncontrolled initial open state. |\n| `onOpen` | `() => void` | - | Fired when the menu asks to open. |\n| `onClose` | `(event, reason: MenuCloseReason) => void` | - | Fired when the menu asks to close: `'escapeKey'`, `'select'` (a row chosen), `'triggerClick'` or `'blur'`. |\n| `onStep` | `(step: -1 \\| 1) => void` | - | Fired when Left or Right has nowhere further to go inside the menu, so a menu bar can step to the next menu. Swapped right to left. |\n| `onSelect` | `(value: string \\| number) => void` | - | Fired with a row's `value` when a row that has one is chosen. |\n| `align` | `'start' \\| 'end'` | `'start'` | Which edge of the trigger the list lines up with. Mirrored right to left. |\n| `marginThreshold` | `keyof Theme['space']` | `2` | The least room between the list and the window's edge. |\n| `elevation` | `PaperElevation` (0-24) | `8` | Shadow depth of the surface. |\n| `borderRadius` | `keyof Theme['radii']` | `theme.defaults.surfaceRadius`, else square | Corner radius of the list. |\n| `layer` | `keyof Theme['zOrder']` | `'modal'` | Stacking layer - `modal` keeps a menu opened in a dialog above it. |\n| `emptyLabel` | `ReactNode` | - | Shown as one disabled row when the menu has no rows (\"Coming soon\"); without it, the list stays empty. |\n| `color` | `keyof Theme['palette']` | - | Accent color for every row. |\n| `textColor` | `keyof Theme['text']` | - | Base text color for every row. |\n| `size` | `keyof Theme['sizes']` | - | Density token for every row. |\n| `dense` | `boolean` | - | Compact vertical padding for every row. |\n| `aria-label` | `string` | trigger's name | Names the list. Without it the trigger names it (`aria-labelledby`). |\n| `className` | `string` | - | Class on the menu's root. |\n| `slotProps` | `{ list? }` | - | Props for a part: `list` is the `role=\"menu\"` list - and every submenu's - for the app's `data-*`, class and `aria-*`; an `onKeyDown` runs before the list's own. Its `role`, `id` and name are the menu's. |\n\n## Keyboard\n\n| Where | Key | Does |\n| ----------- | ------------------- | ---------------------------------------------------------------------------- |\n| The trigger | Enter / Space | Opens the menu (a click), focusing the checked row or the first enabled one |\n| The trigger | ArrowDown / ArrowUp | Opens the menu, focusing the checked row or the first enabled one |\n| The list | Escape | Closes the menu and gives focus back to the trigger |\n| The list | Enter / Space | Chooses the focused row, closes the menu and gives focus back to the trigger |\n| The list | Left / Right | `onStep(-1)` / `onStep(1)`, when set |\n| The list | Tab | Focus leaves - the menu closes and focus stays where it went |\n\nThe arrow keys, Home, End and type-ahead inside the list are [`MenuList`](https://docs.soroush.tech/design-system/api/menu-list/)'s.\n\n## Notes\n\n- **Placement.** Under the trigger, lined up with its start or end edge; above it when there's\n no room below; moved only as far as it must to stay `marginThreshold` inside the window. It\n follows the trigger on scroll and resize, and is hidden until first placed so it never shows at\n the wrong spot. It can't grow taller than the window.\n- **Not portaled, not `Popover`.** `Popover` is a modal - it moves focus in, traps it and hides\n the rest of the page from assistive technology, which suits a dialog and not a menu. The list is\n fixed in the window instead, inside the menu's box, so closing when focus leaves works and rows\n are found by their nearest `role=\"menu\"`. An ancestor with a `transform`, `filter` or\n `contain` - a zoom wrapper, a sliding drawer - makes itself the containing block of\n `position: fixed`; the list measures where it landed and moves back by the difference, so it\n still opens against its trigger. A scaling transform still scales it.\n- **Submenus.** A `MenuItem` with `submenu` opens a nested list beside it, placed and drawn\n the way the menu's own list is - see [`MenuItem`'s submenus](https://docs.soroush.tech/design-system/api/menu-item/#submenus).\n Escape in a submenu closes only that submenu.\n- **A menu bar.** Hold `isOpen` for each menu and step between them with `onStep`.\n- The list renders nothing until the menu opens, so it costs nothing on the server.\n",
763
763
  "examples": "",
764
764
  "url": "https://docs.soroush.tech/design-system/components/menu/"
765
765
  },
@@ -773,7 +773,7 @@ const content = {
773
773
  "importPath": "import { ContextMenu } from '@soroush.tech/design-system/Menu'",
774
774
  "summary": "A [`MenuList`](https://docs.soroush.tech/design-system/api/menu-list/) opened by a right-click over its target, at the pointer - or, from the keyboard, by the context-menu key or Shift+F10 at the focused element.",
775
775
  "intro": "A [`MenuList`](https://docs.soroush.tech/design-system/api/menu-list/) opened by a right-click over its target, at the pointer - or,\nfrom the keyboard, by the context-menu key or Shift+F10 at the focused element. It is placed and\ncloses as [`Menu`](https://docs.soroush.tech/design-system/components/menu/) does, and gives focus back to where it was. The browser's own\ncontext menu is held back only when this one opens.\n\n```tsx\nimport { ContextMenu } from '@soroush.tech/design-system/Menu'\nimport { MenuItem } from '@soroush.tech/design-system/MenuItem'\n\n;<ContextMenu target={<Canvas />} aria-label=\"Canvas\" onSelect={run}>\n <MenuItem value=\"paste\" shortcut=\"Control+V\">\n Paste\n </MenuItem>\n <MenuItem value=\"select-all\">Select all</MenuItem>\n</ContextMenu>\n```\n\nRows can come as data instead, with `items` - the same entries\n[`MenuItems`](https://docs.soroush.tech/design-system/api/menu-items/) renders:\n\n```tsx\n<ContextMenu\n target={<Canvas />}\n items={[\n { value: 'paste', label: 'Paste', shortcut: 'Control+V' },\n { type: 'divider' },\n { label: 'Align', submenu: [{ value: 'left', label: 'Left' }] },\n ]}\n/>\n```",
776
- "api": "## Props\n\n| Prop | Type | Default | Description |\n| ----------------- | ------------------------------------------ | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |\n| `target` | `ReactElement` | - | The element whose right-click opens the menu. Its own `onContextMenu` / `onKeyDown` still run. **Required.** |\n| `children` | `ReactNode` | - | `MenuItem` rows and `MenuDivider`s. |\n| `items` | `MenuItemData[]` | - | The rows as data, in place of `children`. |\n| `onClose` | `(event, reason: MenuCloseReason) => void` | - | Fired when the menu closes: `'escapeKey'`, `'select'` or `'blur'`. |\n| `onSelect` | `(value: string \\| number) => void` | - | Fired with a row's `value` when a row that has one is chosen. |\n| `marginThreshold` | `keyof Theme['space']` | `2` | The least room between the list and the window's edge. |\n| `elevation` | `PaperElevation` (0-24) | `8` | Shadow depth of the surface. |\n| `borderRadius` | `keyof Theme['radii']` | `theme.defaults.surfaceRadius`, else square | Corner radius of the list. |\n| `layer` | `keyof Theme['zOrder']` | `'modal'` | Stacking layer. |\n| `emptyLabel` | `ReactNode` | - | Shown as one disabled row when the menu has no rows; without it, the list stays empty. |\n| `color` | `keyof Theme['palette']` | - | Accent color for every row. |\n| `textColor` | `keyof Theme['text']` | - | Base text color for every row. |\n| `size` | `keyof Theme['sizes']` | - | Density token for every row. |\n| `dense` | `boolean` | - | Compact vertical padding for every row. |\n| `aria-label` | `string` | - | Names the list. |\n| `className` | `string` | - | Class on the menu's root. |\n\n## Notes\n\n- **Placement.** Its top-left corner at the pointer (top-right, right to left), moved above or to\n the other side where the window has no room, and kept `marginThreshold` inside it. From the\n keyboard it opens at the focused element's bottom start corner.\n- **Layout.** The root is `display: contents`, so wrapping a target changes nothing about how it\n lays out. Its surface has a `paper` slot of its own, over `Menu`'s:\n `theme.components.Menu.styleOverrides.paper` styles every menu's surface,\n `theme.components.ContextMenu.styleOverrides.paper` only this one's.\n- Submenus, the keys inside the list and focus following the pointer are the same as in a `Menu`.\n",
776
+ "api": "## Props\n\n| Prop | Type | Default | Description |\n| ----------------- | ------------------------------------------ | ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `target` | `ReactElement` | - | The element whose right-click opens the menu. Its own `onContextMenu` / `onKeyDown` still run. Optional when the app opens the menu with `isOpen` and `anchorPosition`. |\n| `isOpen` | `boolean` | - | Whether it is open, when the app decides: it opens at `anchorPosition`, asks to close through `onClose`, and a right-click on `target` is the app's. |\n| `anchorPosition` | `{ top, left }` | - | With `isOpen`: a point in the window (client coordinates, as Popover's) to open at. A changed point moves the open list. Without one it stays closed. |\n| `children` | `ReactNode` | - | `MenuItem` rows and `MenuDivider`s. |\n| `items` | `MenuItemData[]` | - | The rows as data, in place of `children`. |\n| `onClose` | `(event, reason: MenuCloseReason) => void` | - | Fired when the menu closes: `'escapeKey'`, `'select'` or `'blur'`. |\n| `onSelect` | `(value: string \\| number) => void` | - | Fired with a row's `value` when a row that has one is chosen. |\n| `marginThreshold` | `keyof Theme['space']` | `2` | The least room between the list and the window's edge. |\n| `elevation` | `PaperElevation` (0-24) | `8` | Shadow depth of the surface. |\n| `borderRadius` | `keyof Theme['radii']` | `theme.defaults.surfaceRadius`, else square | Corner radius of the list. |\n| `layer` | `keyof Theme['zOrder']` | `'modal'` | Stacking layer. |\n| `emptyLabel` | `ReactNode` | - | Shown as one disabled row when the menu has no rows; without it, the list stays empty. |\n| `color` | `keyof Theme['palette']` | - | Accent color for every row. |\n| `textColor` | `keyof Theme['text']` | - | Base text color for every row. |\n| `size` | `keyof Theme['sizes']` | - | Density token for every row. |\n| `dense` | `boolean` | - | Compact vertical padding for every row. |\n| `aria-label` | `string` | - | Names the list. |\n| `className` | `string` | - | Class on the menu's root. |\n| `slotProps` | `{ list? }` | - | Props for a part: `list` is the `role=\"menu\"` list - and every submenu's - for the app's `data-*`, class and `aria-*`; an `onKeyDown` runs before the list's own. Its `role`, `id` and name are the menu's. |\n\n## Notes\n\n- **Placement.** Its top-left corner at the pointer (top-right, right to left), moved above or to\n the other side where the window has no room, and kept `marginThreshold` inside it. From the\n keyboard it opens at the focused element's bottom start corner.\n- **Layout.** The root is `display: contents`, so wrapping a target changes nothing about how it\n lays out. Its surface has a `paper` slot of its own, over `Menu`'s:\n `theme.components.Menu.styleOverrides.paper` styles every menu's surface,\n `theme.components.ContextMenu.styleOverrides.paper` only this one's.\n- Submenus, the keys inside the list and focus following the pointer are the same as in a `Menu`.\n",
777
777
  "examples": "",
778
778
  "url": "https://docs.soroush.tech/design-system/api/context-menu/"
779
779
  },
@@ -869,7 +869,7 @@ const content = {
869
869
  "importPath": "import { Tabs } from '@soroush.tech/design-system/Tabs'",
870
870
  "summary": "A row of tabs.",
871
871
  "intro": "A row of tabs. By default it is a `tablist`: one tab in the page's tab order, the arrow keys of\nits orientation moving between tabs, Enter or Space selecting. With `as=\"nav\"` the same look\nis a navigation of buttons or links, the current one marked `aria-current=\"page\"`. The row can\ncarry content of its own before and after the tabs - an icon, a toolbar, a \"+\" button.\n\n```tsx\nimport { Tab, Tabs } from '@soroush.tech/design-system/Tabs'\n\n;<Tabs value={value} onChange={setValue} textColor=\"secondary\" color=\"secondary\" aria-label=\"Items\">\n <Tab value=\"one\" label=\"Item One\" />\n <Tab value=\"two\" label=\"Item Two\" icon={<Icon name=\"folder\" size=\"sm\" />} />\n <Tab value=\"three\" label=\"Item Three\" disabled />\n</Tabs>\n```\n\n`Tabs` holds its own value (`defaultValue`) or takes it (`value` / `onChange`). To show a panel for\neach tab, put the tabs in a `TabContext` as a `TabList` - it links each tab to its `TabPanel`:\n\n```tsx\nimport { Tab, TabContext, TabList, TabPanel } from '@soroush.tech/design-system/Tabs'\n\n;<TabContext value={value}>\n <TabList onChange={setValue} aria-label=\"Items\">\n <Tab label=\"Item One\" value=\"1\" />\n <Tab label=\"Item Two\" value=\"2\" />\n </TabList>\n <TabPanel value=\"1\">...</TabPanel>\n <TabPanel value=\"2\">...</TabPanel>\n</TabContext>\n```\n\nThe family: `Tabs`, `Tab`, `TabContext`, `TabList`, `TabPanel` and `TabScrollButton`.",
872
- "api": "## Tabs props\n\n| Prop | Type | Default | Description |\n| --------------------- | -------------------------------------------------------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `children` | `ReactNode` | - | `Tab`s. |\n| `value` | `string \\| number \\| null` | - | The selected tab's value - `null` for none. Controlled with `onChange`. |\n| `defaultValue` | `string \\| number \\| null` | - | The selected tab's value at first, when uncontrolled. |\n| `onChange` | `(value: string \\| number) => void` | - | Fired with a tab's value when it is chosen. |\n| `onTabClose` | `(value: string \\| number) => void` | - | Fired with a closable tab's value when its close button, a middle click or Delete closes it. Removing it and picking the next selection are the app's. |\n| `shouldAnnounceClose` | `boolean` | `false` | Names each closable tab's close button, and the one in the overflow menu, by its `closeLabel` for assistive technology - a button found and pressed by name, still out of the tab order. It is beside the tab, not inside it. Without it, the button is the pointer's alone and Delete closes the focused tab. |\n| `as` | `'div' \\| 'nav'` | `'div'` | `'nav'` makes it a navigation (`aria-current=\"page\"`) rather than a `tablist`. |\n| `orientation` | `'horizontal' \\| 'vertical'` | `'horizontal'` | Vertical tabs stack, with Up and Down for the keys. |\n| `variant` | `keyof TabsVariants` | `'underline'` | `'underline'` - an indicator slides under the selected tab; `'boxed'` - the selected tab is outlined on a raised ground; `'enclosed'` - the selected tab is outlined on its top and sides, open onto the divider; `'tonal'` - the tabs sit in a rounded container, the selected one a tinted pill, with no divider. Augmentable. |\n| `color` | `keyof Theme['palette']` | `'primary'` | The indicator's or outline's color. |\n| `textColor` | `keyof Theme['text']` | `'primary'` | The labels' color. |\n| `size` | `keyof Theme['sizes']` | `'md'` | Density token. |\n| `fullWidth` | `boolean` | `false` | The tabs share the row's width equally. |\n| `isCentered` | `boolean` | `false` | The tabs sit in the middle of the row. |\n| `shouldSelectOnFocus` | `boolean` | `false` | Moving focus with the arrow keys selects as it goes. |\n| `hasDivider` | `boolean` | `true`, `false` when boxed | A line along the row's foot (a column's end side), under its own content too. In the enclosed look it runs round the selected tab; without it there is no border - the selected tab stands out by `selectedBg`. |\n| `bg` | `keyof Theme['background']` | - | The tab strip's ground. |\n| `selectedBg` | `keyof Theme['background']` | `'paper'` boxed or enclosed without a divider | The selected tab's ground. Give its `TabPanel` the same `bg` and the two read as one. |\n| `slots` | `{ scrollButton?: ComponentType<TabScrollButtonProps> }` | - | A scroll button of your own, in place of `TabScrollButton` - given the same props. |\n| `startContent` | `ReactNode` | - | Before the tabs, a space from them. Keeps its own tab stops; the arrow keys don't reach it. |\n| `endContent` | `ReactNode` | - | After the tabs, a space from them. Keeps its own tab stops; the arrow keys don't reach it. |\n| `action` | `Ref<TabsActions>` | - | `updateIndicator()` - re-measures the selected tab after a font loads or a label changes. |\n| `aria-label` | `string` | - | Names the tablist (or the navigation). |\n| `aria-labelledby` | `string` | - | Names it after another element. |\n\nPlus the styled-system **space** props (`m`, `p`, ...) on the row.\n\n### Scrolling tabs\n\n```tsx\n<Tabs overflowBehavior=\"scroll\" scrollButtons=\"auto\" aria-label=\"Components\">\n {components.map((name) => (\n <Tab key={name} value={name} label={name} />\n ))}\n</Tabs>\n```\n\nWith `overflowBehavior=\"scroll\"` the list scrolls along its orientation when its tabs don't fit.\n\n| Prop | Type | Default | Description |\n| --------------------------------- | ------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `overflowBehavior` | `'scroll' \\| 'menu' \\| 'none'` | `'none'` | What the row does when its tabs don't fit - scroll, or list the ones that don't in a menu (below). |\n| `scrollButtons` | `'auto' \\| 'always' \\| 'never'` | `'auto'` | `auto` - shown while the tabs overflow, each only while tabs are out of view its way; `always` - both, the one at an end disabled; `never` - none. |\n| `shouldShowScrollButtonsOnMobile` | `boolean` | `false` | Show the buttons on narrow screens too, where swiping does the job. |\n| `hasVisibleScrollbar` | `boolean` | `false` | Show the list's scrollbar. |\n\n- A button scrolls by the list's visible size - smoothly, unless the user prefers reduced motion.\n- The buttons are `aria-hidden` and out of the tab order: the arrow keys already reach every tab.\n- Selecting a tab, by key, click or `value`, scrolls it fully into view.\n- Vertical tabs scroll up and down; right to left, the buttons and scrolling are mirrored.\n- `action.updateOverflow()` re-reads the overflow, as `updateIndicator()` re-measures.\n\n### Tabs that don't fit go to a menu\n\n```tsx\n<Tabs overflowBehavior=\"menu\" overflowLabel=\"More tabs\" aria-label=\"Files\">\n {files.map((name) => (\n <Tab key={name} value={name} label={name} closeLabel={`Close ${name}`} />\n ))}\n</Tabs>\n```\n\nWith `overflowBehavior=\"menu\"` the row draws the tabs that fit **whole** and lists the rest in a\n`Menu` behind a button at the list's end. Nothing scrolls, and no tab is cut by the edge.\n\n| Prop | Type | Default | Description |\n| --------------- | -------- | ------- | ------------------------------------------------------------------------------ |\n| `overflowLabel` | `string` | - | Names the button that opens the menu of the tabs that don't fit (\"More tabs\"). |\n\n- **The rule:** the tab in the page's tab order - the selected one, or the first enabled one -\n counts first, then the others in order while the next still fits whole with the gap. The first\n that doesn't ends the row, and every one after it goes to the menu, even a later short one, so\n the row never reads out of order. The kept tab is drawn even when it alone is larger than the\n room, cut by the list.\n- **The room** is the list's size along its orientation less its padding, so `startContent`,\n `endContent` and the button take theirs first. Each tab's size is remembered from when it was\n drawn, so one put in the menu comes back when the room grows; the row is measured after every\n render and whenever the list resizes. Vertical tabs fit down the column.\n- **The menu** lines up with the list's end, mirrored right to left. Each hidden tab is a row -\n its label, or its icon - and choosing one selects it, which brings it into the row. A closable\n tab's row has its ✕ beside it (`MenuItem`'s `secondaryAction`) - the pointer's, hidden from\n assistive technology as a tab's is - and Delete on the row closes it too; both fire\n `onTabClose`.\n- Prerendered, or wherever nothing is laid out (jsdom), every tab is drawn and the button isn't.\n- `action.updateOverflow()` measures again.\n\n## Tab, TabContext, TabList and TabPanel\n\n- `Tab` - one tab: its label, icons, and close button.\n- `TabContext` - holds the value for a `TabList` and its panels.\n- `TabList` - the `Tabs` of a `TabContext`, each tab linked to its panel.\n- `TabPanel` - the content a tab shows.\n\n## Keyboard\n\n| Key | Does |\n| ----------------------------------------------- | --------------------------------------------------------------------------------------------- |\n| Right / Left (horizontal), Down / Up (vertical) | The next / previous enabled tab, coming round at the ends. Left and Right swap right to left. |\n| Home / End | The first / last enabled tab |\n| Enter / Space | Selects the focused tab |\n| Tab | Leaves the tabs - into `endContent`, or the panel |\n\nA navigation (`as=\"nav\"`) keeps every tab in the page's tab order instead, as links are.\n\n## Notes\n\n- Every tab keeps the same width selected or not - its border is there, transparent, until it\n is selected - so nothing in the row moves when the selection or the pointer does.\n- The divider is drawn inside the row, so it adds no height. It runs under `startContent` and\n `endContent` too - the space between them and the tabs is theirs, so the line carries on\n through it. The enclosed look draws it piece by piece, the selected tab leaving its piece out,\n so the opening shows whatever is behind the row - a page, a `Paper`, a `Card`.\n- `TabsVariants` is augmentable, as `ButtonVariants` is: register a look, then style it through\n `theme.components.Tabs.variants`.\n- A tab points `aria-controls` at its panel only in a `TabList`, whose `TabContext` is where\n `TabPanel`s live - tabs that hold their own value have no panel to point at.\n",
872
+ "api": "## Tabs props\n\n| Prop | Type | Default | Description |\n| --------------------- | -------------------------------------------------------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `children` | `ReactNode` | - | `Tab`s. |\n| `value` | `string \\| number \\| null` | - | The selected tab's value - `null` for none. Controlled with `onChange`. |\n| `defaultValue` | `string \\| number \\| null` | - | The selected tab's value at first, when uncontrolled. |\n| `onChange` | `(value: string \\| number) => void` | - | Fired with a tab's value when it is chosen. |\n| `onTabClose` | `(value: string \\| number) => void` | - | Fired with a closable tab's value when its close button, a middle click or Delete closes it. Removing it and picking the next selection are the app's. |\n| `shouldAnnounceClose` | `boolean` | `false` | Names each closable tab's close button, and the one in the overflow menu, by its `closeLabel` for assistive technology - a button found and pressed by name, still out of the tab order. It is beside the tab, not inside it. Without it, the button is the pointer's alone and Delete closes the focused tab. |\n| `as` | `'div' \\| 'nav'` | `'div'` | `'nav'` makes it a navigation (`aria-current=\"page\"`) rather than a `tablist`. |\n| `orientation` | `'horizontal' \\| 'vertical'` | `'horizontal'` | Vertical tabs stack, with Up and Down for the keys. |\n| `variant` | `keyof TabsVariants` | `'underline'` | `'underline'` - an indicator slides under the selected tab; `'boxed'` - the selected tab is outlined on a raised ground; `'enclosed'` - the selected tab is outlined on its top and sides, open onto the divider; `'tonal'` - the tabs sit in a rounded container, the selected one a tinted pill, with no divider. Augmentable. |\n| `color` | `keyof Theme['palette']` | `'primary'` | The indicator's or outline's color. |\n| `textColor` | `keyof Theme['text']` | `'primary'` | The labels' color. |\n| `size` | `keyof Theme['sizes']` | `'md'` | Density token. |\n| `fullWidth` | `boolean` | `false` | The tabs share the row's width equally. |\n| `isCentered` | `boolean` | `false` | The tabs sit in the middle of the row. |\n| `shouldSelectOnFocus` | `boolean` | `false` | Moving focus with the arrow keys selects as it goes. |\n| `hasDivider` | `boolean` | `true`, `false` when boxed | A line along the row's foot (a column's end side), under its own content too. In the enclosed look it runs round the selected tab; without it there is no border - the selected tab stands out by `selectedBg`. |\n| `bg` | `keyof Theme['background']` | - | The tab strip's ground. |\n| `selectedBg` | `keyof Theme['background']` | `'paper'` boxed or enclosed without a divider | The selected tab's ground. Give its `TabPanel` the same `bg` and the two read as one. |\n| `slots` | `{ scrollButton?: ComponentType<TabScrollButtonProps> }` | - | A scroll button of your own, in place of `TabScrollButton` - given the same props. |\n| `startContent` | `ReactNode` | - | Before the tabs, a space from them. Keeps its own tab stops; the arrow keys don't reach it. |\n| `endContent` | `ReactNode` | - | After the tabs, a space from them. Keeps its own tab stops; the arrow keys don't reach it. |\n| `action` | `Ref<TabsActions>` | - | `updateIndicator()` - re-measures the selected tab after a font loads or a label changes. |\n| `aria-label` | `string` | - | Names the tablist (or the navigation). |\n| `aria-labelledby` | `string` | - | Names it after another element. |\n\nPlus the styled-system **space** props (`m`, `p`, ...) on the row.\n\n### Scrolling tabs\n\n```tsx\n<Tabs overflowBehavior=\"scroll\" scrollButtons=\"auto\" aria-label=\"Components\">\n {components.map((name) => (\n <Tab key={name} value={name} label={name} />\n ))}\n</Tabs>\n```\n\nWith `overflowBehavior=\"scroll\"` the list scrolls along its orientation when its tabs don't fit.\n\n| Prop | Type | Default | Description |\n| --------------------------------- | ------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `overflowBehavior` | `'scroll' \\| 'menu' \\| 'none'` | `'none'` | What the row does when its tabs don't fit - scroll, or list the ones that don't in a menu (below). |\n| `scrollButtons` | `'auto' \\| 'always' \\| 'never'` | `'auto'` | `auto` - shown while the tabs overflow, each only while tabs are out of view its way; `always` - both, the one at an end disabled; `never` - none. |\n| `shouldShowScrollButtonsOnMobile` | `boolean` | `false` | Show the buttons on narrow screens too, where swiping does the job. |\n| `hasVisibleScrollbar` | `boolean` | `false` | Show the list's scrollbar. |\n\n- A button scrolls by the list's visible size - smoothly, unless the user prefers reduced motion.\n- The buttons are `aria-hidden` and out of the tab order: the arrow keys already reach every tab.\n- Selecting a tab, by key, click or `value`, scrolls it fully into view.\n- Vertical tabs scroll up and down; right to left, the buttons and scrolling are mirrored.\n- `action.updateOverflow()` re-reads the overflow, as `updateIndicator()` re-measures.\n\n### Tabs that don't fit go to a menu\n\n```tsx\n<Tabs overflowBehavior=\"menu\" overflowLabel=\"More tabs\" aria-label=\"Files\">\n {files.map((name) => (\n <Tab key={name} value={name} label={name} closeLabel={`Close ${name}`} />\n ))}\n</Tabs>\n```\n\nWith `overflowBehavior=\"menu\"` the row draws the tabs that fit **whole** and lists the rest in a\n`Menu` behind a button at the list's end. Nothing scrolls, and no tab is cut by the edge.\n\n| Prop | Type | Default | Description |\n| --------------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------- |\n| `overflowLabel` | `string` | - | Names the button that opens the menu of the tabs that don't fit (\"More tabs\"), and the menu. Shown as a hint by a tooltip. |\n\n- **The rule:** the tab in the page's tab order - the selected one, or the first enabled one -\n counts first, then the others in order while the next still fits whole with the gap. The first\n that doesn't ends the row, and every one after it goes to the menu, even a later short one, so\n the row never reads out of order. The kept tab is drawn even when it alone is larger than the\n room, cut by the list.\n- **The room** is the list's size along its orientation less its padding, so `startContent`,\n `endContent` and the button take theirs first. Each tab's size is remembered from when it was\n drawn, so one put in the menu comes back when the room grows; the row is measured after every\n render and whenever the list resizes. Vertical tabs fit down the column.\n- **The menu** lines up with the list's end, mirrored right to left. Each hidden tab is a row -\n its label, or its icon - and choosing one selects it, which brings it into the row. A closable\n tab's row has its ✕ beside it (`MenuItem`'s `secondaryAction`) - the pointer's, hidden from\n assistive technology as a tab's is - and Delete on the row closes it too; both fire\n `onTabClose`.\n- Prerendered, or wherever nothing is laid out (jsdom), every tab is drawn and the button isn't.\n- `action.updateOverflow()` measures again.\n\n## Tab, TabContext, TabList and TabPanel\n\n- `Tab` - one tab: its label, icons, and close button.\n- `TabContext` - holds the value for a `TabList` and its panels.\n- `TabList` - the `Tabs` of a `TabContext`, each tab linked to its panel.\n- `TabPanel` - the content a tab shows.\n\n## Keyboard\n\n| Key | Does |\n| ----------------------------------------------- | --------------------------------------------------------------------------------------------- |\n| Right / Left (horizontal), Down / Up (vertical) | The next / previous enabled tab, coming round at the ends. Left and Right swap right to left. |\n| Home / End | The first / last enabled tab |\n| Enter / Space | Selects the focused tab |\n| Tab | Leaves the tabs - into `endContent`, or the panel |\n\nA navigation (`as=\"nav\"`) keeps every tab in the page's tab order instead, as links are.\n\n## Notes\n\n- Every tab keeps the same width selected or not - its border is there, transparent, until it\n is selected - so nothing in the row moves when the selection or the pointer does.\n- The divider is drawn inside the row, so it adds no height. It runs under `startContent` and\n `endContent` too - the space between them and the tabs is theirs, so the line carries on\n through it. The enclosed look draws it piece by piece, the selected tab leaving its piece out,\n so the opening shows whatever is behind the row - a page, a `Paper`, a `Card`.\n- `TabsVariants` is augmentable, as `ButtonVariants` is: register a look, then style it through\n `theme.components.Tabs.variants`.\n- A tab points `aria-controls` at its panel only in a `TabList`, whose `TabContext` is where\n `TabPanel`s live - tabs that hold their own value have no panel to point at.\n",
873
873
  "examples": "",
874
874
  "url": "https://docs.soroush.tech/design-system/components/tabs/"
875
875
  },
@@ -1162,7 +1162,7 @@ const content = {
1162
1162
  "importPath": "import { Tooltip } from '@soroush.tech/design-system/Tooltip'",
1163
1163
  "summary": "A short description of one child, shown on hover, keyboard focus and a long touch - a `role=\"tooltip\"` in a `Portal`, placed beside its child and flipped for want of room.",
1164
1164
  "intro": "A short description of one child, shown on hover, keyboard focus and a long touch - a\n`role=\"tooltip\"` in a `Portal`, placed beside its child and flipped for want of room. It opens and\ncloses after their delays, stays open while the pointer is on the tooltip itself (so its text can be\nread and selected), closes on Escape, and never takes or traps the focus. The text is yours: no\nbuilt-in English.\n\n```tsx\nimport { Tooltip } from '@soroush.tech/design-system/Tooltip'\n\n;<Tooltip title=\"Save the page\" placement=\"bottom\" hasArrow>\n <IconButton aria-label=\"Save\">...</IconButton>\n</Tooltip>\n```",
1165
- "api": "## Props\n\n| Prop | Type | Default | Description |\n| --------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |\n| `children` | `ReactElement` | - | The one element it is about. It holds a `ref` and takes the handlers. |\n| `title` | `ReactNode` | - | What it says. Nothing says no tooltip. |\n| `placement` | `'top' \\| 'bottom' \\| 'left' \\| 'right' \\| 'auto'`, each with `-start` or `-end` | `'top'` | The side of the child, and the end it lines up with; `auto` takes the side with the most room. Flips for want of room. |\n| `slots` | `{ root?, arrow? }` | - | The element a part is drawn as - the surface or the arrow. It keeps its styles. |\n| `slotProps` | `{ root?, arrow? }` | - | Props for a part, put first: the tooltip's own `ref`, `id`, `role`, pointer handlers and the arrow's position win. |\n| `hasArrow` | `boolean` | `false` | An arrow towards the middle of the child. |\n| `enterDelay` / `leaveDelay` | `number` | `100` / `0` | In milliseconds: before it opens, and after the pointer or focus has left. |\n| `enterTouchDelay` / `leaveTouchDelay` | `number` | `700` / `1500` | How long a touch is held to open it, and how long after it ends it closes. |\n| `shouldDescribeChild` | `boolean` | `false` | Describes the child (`aria-describedby`, while open) instead of naming it (`aria-label`). |\n| `isOpen` / `defaultOpen` | `boolean` | `false` | Controlled with `onOpen` and `onClose`, or at first. |\n| `onOpen` / `onClose` | `(event) => void` | - | Fired when it asks to open or close - once each, however often it is asked. |\n| `shouldOpenOnHover` / `shouldOpenOnFocus` / `shouldOpenOnTouch` | `boolean` | `true` | What opens it. Focus is keyboard focus: a press with the pointer is not. |\n| `layer` | `keyof Theme['zOrder']` | `'tooltip'` | Stacking layer. |\n| `borderRadius` | `keyof Theme['radii']` | `theme.defaults.surfaceRadius`, else square | Corner radius. |\n| `bg` | `keyof Theme['background']` | `'modal'` | Background. |\n| `textColor` | `keyof Theme['text']` | `theme.defaults.textColor`, else `'initial'` | Text color. |\n| `className`, `data-testid` | | | On the tooltip. |\n\n## Naming and describing\n\nBy default a text `title` names its child (`aria-label`) - for an icon with no text of its own - unless the\nchild already has a name. With `shouldDescribeChild` it describes it instead: the child gets\n`aria-describedby` for as long as the tooltip is open, added to a description it already has.\n\n## Customization\n\n`theme.components.Tooltip` styles the `root` (the surface) and the `arrow`. Its `defaultProps` set every\nprop above but `title` and `isOpen`. The arrow takes the surface's background. The `tooltip` key of `theme.zOrder` is its layer.\n\n## Server rendering\n\nThe tooltip is drawn in a `Portal`, which renders nothing on the server: it is absent from server-rendered and prerendered HTML, and mounts on the client when it opens (on a click, hover, focus or key, or when the app sets it open). One that starts open, by its open prop, is still closed in the static HTML and opens on hydration. Its trigger renders on the server as usual.\n\n## Accessibility\n\n- `role=\"tooltip\"`, with the child named or described by it.\n- Opens on keyboard focus and closes on Escape; stays open while hovered (WCAG 1.4.13: dismissible,\n hoverable, persistent).\n- Never takes the focus, and holds nothing that needs it: a tooltip is for text, not controls.\n- Placed by `useAnchoredPlacement`, shared with `Menu`: it follows its child as the page scrolls.\n",
1165
+ "api": "## Props\n\n| Prop | Type | Default | Description |\n| --------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `children` | `ReactElement?` | - | The one element it is about. It holds a `ref` and takes the handlers. None with `anchorPosition`. |\n| `anchorPosition` | `{ top, left }` | - | A point in the window (client coordinates, as Popover's) to place it at, not beside the child - with no child, `isOpen` opens it. |\n| `title` | `ReactNode` | - | What it says. Nothing says no tooltip. |\n| `placement` | `'top' \\| 'bottom' \\| 'left' \\| 'right' \\| 'auto'`, each with `-start` or `-end` | `'top'` | The side of the child, and the end it lines up with; `auto` takes the side with the most room. Flips for want of room. |\n| `slots` | `{ root?, arrow? }` | - | The element a part is drawn as - the surface or the arrow. It keeps its styles. |\n| `slotProps` | `{ root?, arrow? }` | - | Props for a part, put first: the tooltip's own `ref`, `id`, `role`, pointer handlers and the arrow's position win. |\n| `hasArrow` | `boolean` | `false` | An arrow towards the middle of the child. |\n| `enterDelay` / `leaveDelay` | `number` | `100` / `0` | In milliseconds: before it opens, and after the pointer or focus has left. |\n| `enterTouchDelay` / `leaveTouchDelay` | `number` | `700` / `1500` | How long a touch is held to open it, and how long after it ends it closes. |\n| `shouldDescribeChild` | `boolean` | `false` | Describes the child (`aria-describedby`, while open) instead of naming it (`aria-label`). |\n| `isDescriptionPersistent` | `boolean` | `false` | With `shouldDescribeChild`: describes the child all the time, by a hidden copy of the `title`, as a native `title` does. |\n| `isOpen` / `defaultOpen` | `boolean` | `false` | Controlled with `onOpen` and `onClose`, or at first. |\n| `onOpen` / `onClose` | `(event) => void` | - | Fired when it asks to open or close - once each, however often it is asked. |\n| `isInteractive` | `boolean` | `true` | Whether the pointer can move onto the tooltip, which then stays open. With `false` it takes no pointer events - a click goes to what is under it. |\n| `shouldWrapDisabledChild` | `boolean` | `true` | Whether a disabled child (`disabled`) is wrapped for the pointer handlers and the placement. Leave it out for a child only marked disabled that still takes the pointer - a menu row. |\n| `shouldOpenOnHover` / `shouldOpenOnFocus` / `shouldOpenOnTouch` | `boolean` | `true` | What opens it. Focus is keyboard focus: a press with the pointer is not. |\n| `layer` | `keyof Theme['zOrder']` | `'tooltip'` | Stacking layer. |\n| `borderRadius` | `keyof Theme['radii']` | `theme.defaults.surfaceRadius`, else square | Corner radius. |\n| `bg` | `keyof Theme['background']` | `'modal'` | Background. |\n| `textColor` | `keyof Theme['text']` | `theme.defaults.textColor`, else `'initial'` | Text color. |\n| `className`, `data-testid` | | | On the tooltip. |\n\n## Naming and describing\n\nBy default a text `title` names its child (`aria-label`) - for an icon with no text of its own - unless the\nchild already has a name. With `shouldDescribeChild` it describes it instead: the child gets\n`aria-describedby` for as long as the tooltip is open, added to a description it already has.\n\nWith `isDescriptionPersistent` as well, the description holds while the tooltip is closed, as that of a\nnative `title` does: a visually hidden copy of the `title` is rendered beside the child, outside the\n`Portal`, and the child points at it the whole time (the open tooltip is then not read a second time).\nIt is in the server-rendered HTML. It is one more element beside the child, which a parent that counts\nits children will see.\n\n## What a parent hands it\n\nA parent that clones its child - a `Menu` with a `Tooltip` for its trigger - hands the clone to the\n`Tooltip`. It goes on to the child: the `ref`, the `id`, `aria-*`, handlers and anything else the tooltip\ndoes not take itself. The child's own handler and the one it was handed both run, the child's first, and a\ndescription it was handed is added to its own and the tooltip's; anything else replaces what the child had,\nas a clone would. So `<Menu trigger={<Tooltip title=\"More\"><IconButton /></Tooltip>}>` opens, names and\nplaces the menu as a bare button would. A child hidden from assistive technology (`aria-hidden`) is not\nnamed by the title.\n\n## At a point\n\nWith `anchorPosition` the tooltip is placed at a point in the window, not beside a child - for a hint\nthat depends on where the pointer is, such as a canvas. It needs no child, and is open when `isOpen` says\nso; with a `title` that changes as the point does, it follows both. It keeps its gap from the point, and\nflips to the other side for want of room, as it does around a child. With a child and a point, the point\nwins, and neither the child's hover, focus and touch nor the pointer on the tooltip open or close it (an open asked for just before is dropped): `isOpen` does. Escape still asks it to close, through `onClose`. Nothing describes or names a child it does not have.\n\n## A tooltip that is not interactive\n\nBy default the pointer can move onto the tooltip and it stays open, so its text can be read and selected\n(WCAG 1.4.13), and a click on it is a click on the tooltip. For a text hint that holds nothing to use, set\n`isInteractive={false}`: the surface takes no pointer events, so a click goes to what is under it, and the\ntooltip closes as the pointer leaves the child.\n\nA press of the child closes the tooltip as a native `title` goes away: a mouse or pen press, not a touch,\nwhich is left to its long press. A press anywhere else cannot let a click through - the click goes to what\nwas under the pointer when it went down, which is the tooltip - so only `isInteractive={false}` does.\n\n## A group of tooltips\n\nAround a toolbar or a rail, a tooltip that waits its `enterDelay` for every icon is slow. Wrap them in\n`TooltipGroup` and the next one opens at once while another is open, or within `skipDelayDuration`\n(milliseconds, 300 by default) of the last one closing; after that the tooltip's own `enterDelay` applies\nagain. A tooltip that opens closes the one still showing, so two are never up together.\n\n```tsx\n<TooltipGroup skipDelayDuration={300}>\n <Tooltip title=\"Layers\">\n <IconButton aria-label=\"Layers\" />\n </Tooltip>\n <Tooltip title=\"Assets\">\n <IconButton aria-label=\"Assets\" />\n </Tooltip>\n</TooltipGroup>\n```\n\nIt renders nothing of its own and takes hover and keyboard focus; a touch keeps `enterTouchDelay`. The\nnearest group wins. Tooltips outside a group are unchanged, and a tooltip whose `isOpen` the app controls\nis left alone: the group neither opens nor closes it, and it does not start the window.\n\nTo group every tooltip of an app at once, with no wrapper, set `skipDelayDuration` in\n`theme.components.Tooltip.defaultProps` (milliseconds; unset or 0 is off). Every tooltip under that\ntheme then shares one window by the same rule, and a `TooltipGroup` around a tooltip wins over it.\n\n## A disabled child\n\nA disabled control sends no pointer events of its own (React holds them back), so a `Tooltip` around\none would never open. When the child has `disabled`, the tooltip wraps it in an inline-grid `span` and\nlistens, and is placed, on that. The control keeps its own `ref`; nothing else changes, and a child that\nis not disabled is not wrapped. A disabled control cannot take the focus, so it opens on hover and touch.\n\n## Customization\n\n`theme.components.Tooltip` styles the `root` (the surface) and the `arrow`. Its `defaultProps` set `placement`,\n`hasArrow`, `layer`, `borderRadius`, `bg`, `textColor`, `enterDelay`, `leaveDelay`, `enterTouchDelay`,\n`leaveTouchDelay`, `shouldDescribeChild`, `isDescriptionPersistent`, `shouldWrapDisabledChild`,\n`isInteractive`, `skipDelayDuration`, `shouldOpenOnHover`, `shouldOpenOnFocus` and `shouldOpenOnTouch` - not `children`, `title`, `anchorPosition`, `isOpen` or the\nhandlers. The arrow takes the surface's background. The `tooltip` key of `theme.zOrder` is its layer.\n\n## Server rendering\n\nThe tooltip is drawn in a `Portal`, which renders nothing on the server: it is absent from server-rendered and prerendered HTML, and mounts on the client when it opens (on a click, hover, focus or key, or when the app sets it open). One that starts open, by its open prop, is still closed in the static HTML and opens on hydration. Its trigger renders on the server as usual.\n\n## Accessibility\n\n- `role=\"tooltip\"`, with the child named or described by it.\n- Opens on keyboard focus and closes on Escape; stays open while hovered (WCAG 1.4.13: dismissible,\n hoverable, persistent) - unless `isInteractive={false}`, for a hint with nothing in it to use.\n- Never takes the focus, and holds nothing that needs it: a tooltip is for text, not controls.\n- Placed by `useAnchoredPlacement`, shared with `Menu`: it follows its child as the page scrolls.\n",
1166
1166
  "examples": "",
1167
1167
  "url": "https://docs.soroush.tech/design-system/components/tooltip/"
1168
1168
  },
@@ -1349,19 +1349,19 @@ const content = {
1349
1349
  "id": "setup",
1350
1350
  "title": "New app setup",
1351
1351
  "summary": "End-to-end checklist for a new app: fonts, global reset, providers, theme.",
1352
- "body": "# New-app checklist\n\nReference wiring: `diffChroma/apps/dashboard` (Next.js 15 App Router, React 19, pnpm workspace).\n\n## 1. Install\n\n```jsonc\n// package.json\n\"dependencies\": {\n \"@soroush.tech/design-system\": \"^1.3.1\",\n \"@emotion/cache\": \"^11.14.0\",\n \"react\": \"^19.2.8\",\n \"react-dom\": \"^19.2.8\"\n}\n```\n\n`@emotion/react` and `@emotion/styled` come in as transitive deps of the design\nsystem - don't add them directly. `@emotion/cache` is direct, only because the\nNext.js SSR registry needs `createCache`.\n\n## 2. Theme\n\nCopy `theme.ts` to the app root (`apps/<app>/theme.ts`) so it imports as `@/theme`.\nIt exports `light` and `dark`. The color ramps at the top (`carbonBlack`,\n`cyberCyan`, `kineticGreen`, `forestGreen`, `solarAmber`, `neonRed`, `softGreen`,\n`deepCrimson`, `lightSurface`, `kineticSurface`, `blackAlpha`) are mirrored from the\nsoroush.tech web app (`core` repo, `apps/web/src/theme/colors`) - that mirroring is\nthe whole point of the file. If a ramp changes upstream, change it in every app.\n\n## 3. Provider\n\nCopy `providers.tsx` to `app/providers.tsx`. Two things it does:\n\n- **Emotion SSR registry** - collects styles inserted during the server render and\n re-injects them via `useServerInsertedHTML`, so server markup arrives styled.\n Without it you get an unstyled flash on every hard navigation.\n- **Global reset** - `border-box` everywhere, zero body margin,\n `background.primary` / `text.initial` / `fonts.body` on `<body>`.\n\nChange the cache key (`createCache({ key: \"dc\" })`) to a short app-specific prefix. Under a\nstrict Content Security Policy, give the cache the response's nonce too\n(`createCache({ key: \"dc\", nonce })`) - every style tag Emotion inserts then carries it.\n\nThen in `app/layout.tsx`:\n\n```tsx\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\">\n <body>\n <Providers>\n <TopBar />\n {children}\n </Providers>\n </body>\n </html>\n )\n}\n```\n\n`<Providers>` wraps everything including the chrome. Route groups then supply their\nown inner layout (rail + `Main`).\n\n## 4. Fonts - known gap\n\n`theme.fonts` names _Space Grotesk_ and _JetBrains Mono_, but DiffChroma never loads\nthem, so it silently renders in system sans/mono. If the new app should actually look\nright, load them - `@fontsource-variable/space-grotesk` + `@fontsource-variable/jetbrains-mono`\nimported once in the root layout, or `next/font` - and consider backporting the same\nfix to DiffChroma. Skipping this and matching DiffChroma exactly is also a valid\nchoice; just make it deliberately.\n\n## 5. Layout scaffold\n\n```\ncomponents/\n chrome/constants.ts TOPBAR_HEIGHT = \"3.5rem\"\n chrome/TopBar.tsx sticky AppBar, brand wordmark, breadcrumb, session cluster\n chrome/Main.tsx 1600px column, 20→40px gutters\n chrome/<Rail>.tsx optional icon rail, bottom bar on mobile\n ui.tsx NavLink, TokenCode, StatusBadge + STATUS_TONE map\n PageCard.tsx PageHeader.tsx SectionLabel.tsx Pill.tsx\n StatStrip.tsx TabNav.tsx SettingCard.tsx SearchInput.tsx Skeletons.tsx\n```\n\nSources in `layout-kit.md`.\n\n## 6. tsconfig\n\n`@/*` path alias to the app root - every import above assumes it.\n\n## 7. Verify\n\n`pnpm typecheck` (`tsc --noEmit`) catches the common mistakes: a `tone` string that\nisn't a `PaletteColor`, a `theme.text.*` key that doesn't exist, a missing\n`shouldForwardProp`. The theme is fully typed - lean on it instead of eyeballing.\n"
1352
+ "body": "# New-app checklist\n\nReference wiring: a Next.js App Router app on React 19.\n\n## 1. Install\n\n```jsonc\n// package.json\n\"dependencies\": {\n \"@soroush.tech/design-system\": \"^2.1.2\",\n \"@emotion/cache\": \"^11.14.0\",\n \"react\": \"^19.2.8\",\n \"react-dom\": \"^19.2.8\"\n}\n```\n\n`@emotion/react` and `@emotion/styled` come in as transitive deps of the design\nsystem - don't add them directly. `@emotion/cache` is direct, only because the\nNext.js SSR registry needs `createCache`.\n\n## 2. Theme\n\nCopy `theme.ts` to the app root so it imports as `@/theme`.\nIt exports `light` and `dark`. The color ramps at the top (`carbonBlack`,\n`cyberCyan`, `kineticGreen`, `forestGreen`, `solarAmber`, `neonRed`, `softGreen`,\n`deepCrimson`, `lightSurface`, `kineticSurface`, `blackAlpha`) are the brand: every\napp that copies them shares one color set. Change which ramp fills a palette slot if\nthe app needs to, never the ramp values.\n\n## 3. Provider\n\nCopy `providers.tsx` to `app/providers.tsx`. Two things it does:\n\n- **Emotion SSR registry** - collects styles inserted during the server render and\n re-injects them via `useServerInsertedHTML`, so server markup arrives styled.\n Without it you get an unstyled flash on every hard navigation.\n- **Global reset** - `border-box` everywhere, zero body margin,\n `background.primary` / `text.initial` / `fonts.body` on `<body>`.\n\nChange the cache key (`createCache({ key: \"dc\" })`) to a short app-specific prefix. Under a\nstrict Content Security Policy, give the cache the response's nonce too\n(`createCache({ key: \"dc\", nonce })`) - every style tag Emotion inserts then carries it.\n\nThen in `app/layout.tsx`:\n\n```tsx\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\">\n <body>\n <Providers>\n <TopBar />\n {children}\n </Providers>\n </body>\n </html>\n )\n}\n```\n\n`<Providers>` wraps everything including the chrome. Route groups then supply their\nown inner layout (rail + `Main`).\n\n## 4. Fonts\n\n`theme.fonts` names _Space Grotesk_ and _JetBrains Mono_, but the package does not\nload them. An app that never loads them renders in the system sans and mono fonts.\nTo get the intended look, load them once in the root layout -\n`@fontsource-variable/space-grotesk` + `@fontsource-variable/jetbrains-mono`, or\n`next/font`. Leaving the system fonts is also a valid choice; just make it deliberately.\n\n## 5. Layout scaffold\n\n```\ncomponents/\n chrome/constants.ts TOPBAR_HEIGHT = \"3.5rem\"\n chrome/TopBar.tsx sticky AppBar, brand wordmark, breadcrumb, session cluster\n chrome/Main.tsx 1600px column, 20→40px gutters\n chrome/<Rail>.tsx optional icon rail, bottom bar on mobile\n ui.tsx NavLink, TokenCode, StatusBadge + STATUS_TONE map\n PageCard.tsx PageHeader.tsx SectionLabel.tsx Pill.tsx\n StatStrip.tsx TabNav.tsx SettingCard.tsx SearchInput.tsx Skeletons.tsx\n```\n\nSources in `layout-kit.md`.\n\n## 6. tsconfig\n\n`@/*` path alias to the app root - every import above assumes it.\n\n## 7. Verify\n\n`pnpm typecheck` (`tsc --noEmit`) catches the common mistakes: a `tone` string that\nisn't a `PaletteColor`, a `theme.text.*` key that doesn't exist, a missing\n`shouldForwardProp`. The theme is fully typed - lean on it instead of eyeballing.\n"
1353
1353
  },
1354
1354
  {
1355
1355
  "id": "layout-kit",
1356
1356
  "title": "App layout kit",
1357
1357
  "summary": "App-level components to copy verbatim - PageCard, PageHeader, Pill, StatusBadge, TabNav and friends.",
1358
- "body": "# App-level layout kit\n\nThese live in the app (`components/`), not the package. They're the shared vocabulary\nthat makes two apps read as one product. Copy them verbatim; adjust only the nav\nitems and brand wordmark.\n\nPage anatomy, in order:\n\n```\nAppBar (TopBar) → rail/sidebar (optional) → Main column\n └─ PageHeader\n └─ SectionLabel (optional)\n └─ PageCard / PageCard flush\n```\n\n---\n\n## Main - the page column\n\nMax 1600px, centered, 20px → 40px gutters at 600px, 48px bottom padding.\n\n```tsx\n'use client'\nimport { styled } from '@soroush.tech/design-system'\nimport { TOPBAR_HEIGHT } from './constants'\n\nconst MainRoot = styled('main')(({ theme }) => ({\n width: '100%',\n maxWidth: '1600px',\n margin: '0 auto',\n padding: '0 20px 48px',\n minHeight: `calc(100vh - ${TOPBAR_HEIGHT} - 1px)`,\n [theme.breakpoints.up('sm')]: { padding: '0 40px 48px' },\n}))\n\nexport function Main({ children }: { children: React.ReactNode }) {\n return <MainRoot>{children}</MainRoot>\n}\n```\n\n`components/chrome/constants.ts`: `export const TOPBAR_HEIGHT = \"3.5rem\";`\n\n## PageCard - the content surface\n\nWhite paper, 5px radius, hairline shadow, 20 → 30px padding from `md` (840px).\n`flush` drops the padding for children that own their own (tables, setting rows,\nlist rows).\n\n```tsx\n'use client'\nimport { styled } from '@soroush.tech/design-system'\n\nexport const PageCard = styled('section', {\n shouldForwardProp: (prop) => prop !== 'flush',\n})<{ flush?: boolean }>(({ theme, flush }) => ({\n backgroundColor: theme.background.paper,\n borderRadius: '5px',\n boxShadow: 'rgba(0, 0, 0, 0.05) 0 1px 3px 0',\n padding: flush ? 0 : '20px',\n [theme.breakpoints.up('md')]: { padding: flush ? 0 : '30px' },\n}))\n```\n\n## PageHeader - 32px title left, actions right\n\n```tsx\n'use client'\nimport { styled } from '@soroush.tech/design-system'\n\nconst Root = styled('section')({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexWrap: 'wrap',\n gap: '10px',\n margin: '40px 0 24px',\n})\n\nconst Title = styled('h1')(({ theme }) => ({\n margin: 0,\n fontSize: '32px',\n lineHeight: '40px',\n fontWeight: theme.fontWeights.bold,\n color: theme.text.initial,\n}))\n\nconst Actions = styled('div')({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: '10px',\n whiteSpace: 'nowrap',\n})\n\nexport function PageHeader({\n title,\n actions,\n}: {\n title: React.ReactNode\n actions?: React.ReactNode\n}) {\n return (\n <Root>\n <Title>{title}</Title>\n {actions && <Actions>{actions}</Actions>}\n </Root>\n )\n}\n```\n\n## SectionLabel - uppercase group heading above a card group\n\nThe `0.35em` tracking is the signature; don't soften it.\n\n```tsx\nimport { styled } from '@soroush.tech/design-system'\n\nexport const SectionLabel = styled('h3')(({ theme }) => ({\n margin: 0,\n fontSize: '13px',\n lineHeight: '20px',\n fontWeight: theme.fontWeights.extraBold,\n letterSpacing: '0.35em',\n textTransform: 'uppercase',\n color: theme.text.secondary,\n}))\n```\n\n## Pill - small rounded chip (counts, branches, severities)\n\nGhost by default (10% tint + 25% inset ring), `filled` for emphasis.\n\n```tsx\n'use client'\nimport { styled } from '@soroush.tech/design-system'\nimport type { PaletteColor } from '@soroush.tech/design-system'\nimport { alpha } from '@soroush.tech/design-system/utils'\n\nconst PillRoot = styled('span', {\n shouldForwardProp: (prop) => prop !== 'tone' && prop !== 'filled',\n})<{ tone: PaletteColor; filled: boolean }>(({ theme, tone, filled }) => ({\n display: 'inline-block',\n padding: '4px 12px',\n fontSize: '12px',\n lineHeight: '12px',\n fontWeight: theme.fontWeights.bold,\n whiteSpace: 'nowrap',\n textTransform: 'capitalize',\n borderRadius: '3em',\n ...(filled\n ? { color: theme.palette[tone].contrastText, backgroundColor: theme.palette[tone].main }\n : {\n color: theme.palette[tone].main,\n backgroundColor: alpha(theme.palette[tone].main, 0.1),\n boxShadow: `inset 0 0 0 1px ${alpha(theme.palette[tone].main, 0.25)}`,\n }),\n}))\n\nexport function Pill({\n children,\n tone = 'default',\n filled = false,\n}: {\n children: React.ReactNode\n tone?: PaletteColor\n filled?: boolean\n}) {\n return (\n <PillRoot tone={tone} filled={filled}>\n {children}\n </PillRoot>\n )\n}\n```\n\n## StatusBadge - squared mono chip for machine states\n\nPill is for human labels, StatusBadge for enum values. The tone map is the pattern\nworth copying: statuses map to palette slots in one table, so adding a status is one line.\n\n```tsx\nimport { styled } from '@soroush.tech/design-system'\nimport type { PaletteColor } from '@soroush.tech/design-system'\n\nconst STATUS_TONE: Record<string, PaletteColor> = {\n PASSED: 'success',\n APPROVED: 'success',\n UNCHANGED: 'success',\n REJECTED: 'error',\n ERROR: 'error',\n PENDING_REVIEW: 'warning',\n CHANGED: 'warning',\n NEW: 'warning',\n QUEUED: 'info',\n RENDERING: 'info',\n COMPARING: 'info',\n PENDING: 'info',\n}\n\nconst BadgeRoot = styled('span', { shouldForwardProp: (prop) => prop !== 'tone' })<{\n tone: PaletteColor\n}>(({ theme, tone }) => ({\n display: 'inline-block',\n padding: '2px 10px',\n fontFamily: theme.fonts.mono,\n fontSize: theme.fontSizes[0],\n fontWeight: theme.fontWeights.semiBold,\n letterSpacing: theme.letterSpacings.wide,\n whiteSpace: 'nowrap',\n color: theme.palette[tone].main,\n border: `${theme.borderWidths.thin} solid ${theme.palette[tone].main}`,\n borderRadius: theme.radii.sm,\n}))\n\nexport function StatusBadge({ status }: { status: string }) {\n return (\n <BadgeRoot tone={STATUS_TONE[status] ?? 'default'}>{status.replaceAll('_', ' ')}</BadgeRoot>\n )\n}\n```\n\n## StatStrip - 28px figures with labels, groups split by a stretched divider\n\nStacks on mobile, 25px-gapped row at 800px.\n\n```tsx\nimport { styled } from '@soroush.tech/design-system'\n\nconst Value = styled('div')(({ theme }) => ({\n fontSize: '28px',\n lineHeight: '28px',\n fontWeight: theme.fontWeights.normal,\n color: theme.text.initial,\n marginBottom: '4px',\n}))\nconst Label = styled('div')(({ theme }) => ({\n fontSize: '14px',\n lineHeight: '20px',\n color: theme.text.secondary,\n}))\nexport const StatDivider = styled('div')(({ theme }) => ({\n alignSelf: 'stretch',\n width: '1px',\n backgroundColor: theme.border.default,\n}))\n```\n\n`<StatStrip primary={{label, value}} items={[...]} />` - one lead figure, a divider,\nthen the rest.\n\n## TabNav - underline tab strip (the library has no Tabs)\n\nBuilt on `Pressable`; active tab is a 3px inset bottom shadow in primary.\n\n```tsx\nimport { styled } from '@soroush.tech/design-system'\nimport { Pressable } from '@soroush.tech/design-system/Pressable'\n\nconst Bar = styled('nav')(({ theme }) => ({\n display: 'flex',\n flexDirection: 'row',\n width: '100%',\n boxShadow: `inset 0 -1px 0 ${theme.border.default}`,\n}))\n\nconst Tab = styled(Pressable, { shouldForwardProp: (prop) => prop !== 'isActive' })<{\n isActive: boolean\n}>(({ theme, isActive }) => ({\n padding: '10px 20px',\n fontSize: theme.fontSizes[1],\n fontWeight: theme.fontWeights.bold,\n lineHeight: '20px',\n color: isActive ? theme.palette.primary.main : theme.text.secondary,\n boxShadow: isActive ? `inset 0 -3px 0 0 ${theme.palette.primary.main}` : 'none',\n '&:hover': { color: theme.palette.primary.main },\n}))\n```\n\nSet `aria-current=\"page\"` on the active tab and `aria-label` on the `<nav>`.\n\n## SettingCard / SettingGroup - icon | body | right action rows\n\n`SettingGroup` is just `<PageCard flush>`; each `SettingCard` is a row with a\nhairline `borderBottom` (`&:last-of-type` clears it). Layout: 48px icon box +\n20px gutter, body `flex: 1 1 240px` capped at 600px, actions pushed right with\n`marginLeft: auto` at 800px and full-width stacked below on mobile.\nTitle carries an optional inline `\": Status\"` in a palette tone.\n\n## SearchInput - TextInput with an absolutely positioned magnifier\n\n`<Icon name=\"zoom_in\" color=\"secondary\" size=\"1rem\" />` at `left: 10px`,\n`top: 50%`, `translateY(-50%)`, `pointerEvents: none`; the `TextInput` gets\n`fullWidth pl={4} size=\"sm\"` and an explicit `aria-label`. Wrapper caps at 320px.\n\n## TopBar - sticky AppBar\n\n```tsx\n<AppBar position=\"sticky\" top={0} height={TOPBAR_HEIGHT} size=\"sm\"\n color=\"appBar\" blur borderBottom=\"1px solid\" borderColor=\"default\">\n <Flex flexDirection=\"row\" alignItems=\"center\" justifyContent=\"space-between\" gap={2} height=\"100%\">\n```\n\nBrand wordmark: mono, bold, `letterSpacings.wide`, `fontSizes[2]`, `text.initial`,\nhovering to `text.primary` - with a glyph prefix (`◧ DIFFCHROMA`). Breadcrumb is a\n`<Sep>/</Sep>` separator in `text.secondary` plus a `NavLink`. Right cluster: user\nemail in `variant=\"caption\" color=\"secondary\" fontFamily=\"mono\"` + a\n`variant=\"text\" size=\"sm\"` action.\n\nGate anything reading `localStorage` behind a `mounted` state - it's unreadable\nduring SSR/hydration and will mismatch.\n\n## ProjectRail - icon rail, 60px, sticky under the AppBar\n\nBottom bar on mobile (`space-evenly`, labels only, 14px), vertical rail at 600px\n(icons appear, labels shrink to 11px, `position: sticky; top: TOPBAR_HEIGHT`,\n`height: calc(100vh - TOPBAR_HEIGHT)`, 2rem top padding, 2.25rem item gap).\nActive item is `palette.primary.main` + bold; hover lifts `translateY(-1px)` over\n150ms. The icon takes `color=\"inherit\"` so the link drives it.\n\nRail item shape: `{ segment, label, icon: IconName }`. Active segment is derived\nfrom the pathname, defaulting to the first item.\n\n## NavLink / TokenCode - the two text primitives\n\n```tsx\nimport NextLink from 'next/link'\nimport { styled } from '@soroush.tech/design-system'\n\nexport const NavLink = styled(NextLink)(({ theme }) => ({\n color: theme.text.primary,\n textDecoration: 'none',\n '&:hover': { textDecoration: 'underline' },\n}))\n\nexport const TokenCode = styled('code')(({ theme }) => ({\n fontFamily: theme.fonts.mono,\n fontSize: theme.fontSizes[0],\n color: theme.text.primary,\n backgroundColor: theme.background.terminal,\n border: `${theme.borderWidths.thin} solid ${theme.border.default}`,\n borderRadius: theme.radii.sm,\n padding: '4px 8px',\n wordBreak: 'break-all',\n}))\n```\n\n---\n\n## Page composition template\n\n```tsx\n\"use client\";\n\nexport default function BuildsPage() {\n const [builds, setBuilds] = useState<BuildRow[] | null>(null);\n\n if (!builds) {\n return (\n <>\n <PageHeader title=\"Builds\" />\n <PageCard flush><BuildRowsSkeleton /></PageCard>\n </>\n );\n }\n\n return (\n <>\n <PageHeader title=\"Builds\" actions={<BranchFilter ... />} />\n <PageCard flush>\n {visible.map((build) => <BuildListRow key={build.id} build={build} />)}\n {visible.length === 0 && (\n <Typography variant=\"body2\" color=\"secondary\" p={3} as=\"div\">\n No builds yet - run the DiffChroma action or `pnpm simulate`.\n </Typography>\n )}\n </PageCard>\n </>\n );\n}\n```\n\nThree things to keep: the loading branch renders the _same_ header with a\nshape-matched skeleton (no spinner, no layout shift); the empty state is a\n`body2 / secondary / p={3}` line inside the card, never a blank card; and it says\nwhat to do next, not just \"no data\".\n"
1358
+ "body": "# App-level layout kit\n\nThese live in the app (`components/`), not the package. They're the shared vocabulary\nthat makes two apps read as one product. Copy them verbatim; adjust only the nav\nitems and brand wordmark.\n\nPage anatomy, in order:\n\n```\nAppBar (TopBar) → rail/sidebar (optional) → Main column\n └─ PageHeader\n └─ SectionLabel (optional)\n └─ PageCard / PageCard flush\n```\n\n---\n\n## Main - the page column\n\nMax 1600px, centered, 20px → 40px gutters at 600px, 48px bottom padding.\n\n```tsx\n'use client'\nimport { styled } from '@soroush.tech/design-system'\nimport { TOPBAR_HEIGHT } from './constants'\n\nconst MainRoot = styled('main')(({ theme }) => ({\n width: '100%',\n maxWidth: '1600px',\n margin: '0 auto',\n padding: '0 20px 48px',\n minHeight: `calc(100vh - ${TOPBAR_HEIGHT} - 1px)`,\n [theme.breakpoints.up('sm')]: { padding: '0 40px 48px' },\n}))\n\nexport function Main({ children }: { children: React.ReactNode }) {\n return <MainRoot>{children}</MainRoot>\n}\n```\n\n`components/chrome/constants.ts`: `export const TOPBAR_HEIGHT = \"3.5rem\";`\n\n## PageCard - the content surface\n\nWhite paper, 5px radius, hairline shadow, 20 → 30px padding from `md` (840px).\n`flush` drops the padding for children that own their own (tables, setting rows,\nlist rows).\n\n```tsx\n'use client'\nimport { styled } from '@soroush.tech/design-system'\n\nexport const PageCard = styled('section', {\n shouldForwardProp: (prop) => prop !== 'flush',\n})<{ flush?: boolean }>(({ theme, flush }) => ({\n backgroundColor: theme.background.paper,\n borderRadius: '5px',\n boxShadow: 'rgba(0, 0, 0, 0.05) 0 1px 3px 0',\n padding: flush ? 0 : '20px',\n [theme.breakpoints.up('md')]: { padding: flush ? 0 : '30px' },\n}))\n```\n\n## PageHeader - 32px title left, actions right\n\n```tsx\n'use client'\nimport { styled } from '@soroush.tech/design-system'\n\nconst Root = styled('section')({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexWrap: 'wrap',\n gap: '10px',\n margin: '40px 0 24px',\n})\n\nconst Title = styled('h1')(({ theme }) => ({\n margin: 0,\n fontSize: '32px',\n lineHeight: '40px',\n fontWeight: theme.fontWeights.bold,\n color: theme.text.initial,\n}))\n\nconst Actions = styled('div')({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: '10px',\n whiteSpace: 'nowrap',\n})\n\nexport function PageHeader({\n title,\n actions,\n}: {\n title: React.ReactNode\n actions?: React.ReactNode\n}) {\n return (\n <Root>\n <Title>{title}</Title>\n {actions && <Actions>{actions}</Actions>}\n </Root>\n )\n}\n```\n\n## SectionLabel - uppercase group heading above a card group\n\nThe `0.35em` tracking is the signature; don't soften it.\n\n```tsx\nimport { styled } from '@soroush.tech/design-system'\n\nexport const SectionLabel = styled('h3')(({ theme }) => ({\n margin: 0,\n fontSize: '13px',\n lineHeight: '20px',\n fontWeight: theme.fontWeights.extraBold,\n letterSpacing: '0.35em',\n textTransform: 'uppercase',\n color: theme.text.secondary,\n}))\n```\n\n## Pill - small rounded chip (counts, branches, severities)\n\nGhost by default (10% tint + 25% inset ring), `filled` for emphasis.\n\n```tsx\n'use client'\nimport { styled } from '@soroush.tech/design-system'\nimport type { PaletteColor } from '@soroush.tech/design-system'\nimport { alpha } from '@soroush.tech/design-system/utils'\n\nconst PillRoot = styled('span', {\n shouldForwardProp: (prop) => prop !== 'tone' && prop !== 'filled',\n})<{ tone: PaletteColor; filled: boolean }>(({ theme, tone, filled }) => ({\n display: 'inline-block',\n padding: '4px 12px',\n fontSize: '12px',\n lineHeight: '12px',\n fontWeight: theme.fontWeights.bold,\n whiteSpace: 'nowrap',\n textTransform: 'capitalize',\n borderRadius: '3em',\n ...(filled\n ? { color: theme.palette[tone].contrastText, backgroundColor: theme.palette[tone].main }\n : {\n color: theme.palette[tone].main,\n backgroundColor: alpha(theme.palette[tone].main, 0.1),\n boxShadow: `inset 0 0 0 1px ${alpha(theme.palette[tone].main, 0.25)}`,\n }),\n}))\n\nexport function Pill({\n children,\n tone = 'default',\n filled = false,\n}: {\n children: React.ReactNode\n tone?: PaletteColor\n filled?: boolean\n}) {\n return (\n <PillRoot tone={tone} filled={filled}>\n {children}\n </PillRoot>\n )\n}\n```\n\n## StatusBadge - squared mono chip for machine states\n\nPill is for human labels, StatusBadge for enum values. The tone map is the pattern\nworth copying: statuses map to palette slots in one table, so adding a status is one line.\n\n```tsx\nimport { styled } from '@soroush.tech/design-system'\nimport type { PaletteColor } from '@soroush.tech/design-system'\n\nconst STATUS_TONE: Record<string, PaletteColor> = {\n PASSED: 'success',\n APPROVED: 'success',\n UNCHANGED: 'success',\n REJECTED: 'error',\n ERROR: 'error',\n PENDING_REVIEW: 'warning',\n CHANGED: 'warning',\n NEW: 'warning',\n QUEUED: 'info',\n RENDERING: 'info',\n COMPARING: 'info',\n PENDING: 'info',\n}\n\nconst BadgeRoot = styled('span', { shouldForwardProp: (prop) => prop !== 'tone' })<{\n tone: PaletteColor\n}>(({ theme, tone }) => ({\n display: 'inline-block',\n padding: '2px 10px',\n fontFamily: theme.fonts.mono,\n fontSize: theme.fontSizes[0],\n fontWeight: theme.fontWeights.semiBold,\n letterSpacing: theme.letterSpacings.wide,\n whiteSpace: 'nowrap',\n color: theme.palette[tone].main,\n border: `${theme.borderWidths.thin} solid ${theme.palette[tone].main}`,\n borderRadius: theme.radii.sm,\n}))\n\nexport function StatusBadge({ status }: { status: string }) {\n return (\n <BadgeRoot tone={STATUS_TONE[status] ?? 'default'}>{status.replaceAll('_', ' ')}</BadgeRoot>\n )\n}\n```\n\n## StatStrip - 28px figures with labels, groups split by a stretched divider\n\nStacks on mobile, 25px-gapped row at 800px.\n\n```tsx\nimport { styled } from '@soroush.tech/design-system'\n\nconst Value = styled('div')(({ theme }) => ({\n fontSize: '28px',\n lineHeight: '28px',\n fontWeight: theme.fontWeights.normal,\n color: theme.text.initial,\n marginBottom: '4px',\n}))\nconst Label = styled('div')(({ theme }) => ({\n fontSize: '14px',\n lineHeight: '20px',\n color: theme.text.secondary,\n}))\nexport const StatDivider = styled('div')(({ theme }) => ({\n alignSelf: 'stretch',\n width: '1px',\n backgroundColor: theme.border.default,\n}))\n```\n\n`<StatStrip primary={{label, value}} items={[...]} />` - one lead figure, a divider,\nthen the rest.\n\n## TabNav - underline tab strip (the library has no Tabs)\n\nBuilt on `Pressable`; active tab is a 3px inset bottom shadow in primary.\n\n```tsx\nimport { styled } from '@soroush.tech/design-system'\nimport { Pressable } from '@soroush.tech/design-system/Pressable'\n\nconst Bar = styled('nav')(({ theme }) => ({\n display: 'flex',\n flexDirection: 'row',\n width: '100%',\n boxShadow: `inset 0 -1px 0 ${theme.border.default}`,\n}))\n\nconst Tab = styled(Pressable, { shouldForwardProp: (prop) => prop !== 'isActive' })<{\n isActive: boolean\n}>(({ theme, isActive }) => ({\n padding: '10px 20px',\n fontSize: theme.fontSizes[1],\n fontWeight: theme.fontWeights.bold,\n lineHeight: '20px',\n color: isActive ? theme.palette.primary.main : theme.text.secondary,\n boxShadow: isActive ? `inset 0 -3px 0 0 ${theme.palette.primary.main}` : 'none',\n '&:hover': { color: theme.palette.primary.main },\n}))\n```\n\nSet `aria-current=\"page\"` on the active tab and `aria-label` on the `<nav>`.\n\n## SettingCard / SettingGroup - icon | body | right action rows\n\n`SettingGroup` is just `<PageCard flush>`; each `SettingCard` is a row with a\nhairline `borderBottom` (`&:last-of-type` clears it). Layout: 48px icon box +\n20px gutter, body `flex: 1 1 240px` capped at 600px, actions pushed right with\n`marginLeft: auto` at 800px and full-width stacked below on mobile.\nTitle carries an optional inline `\": Status\"` in a palette tone.\n\n## SearchInput - TextInput with an absolutely positioned magnifier\n\n`<Icon name=\"zoom_in\" color=\"secondary\" size=\"1rem\" />` at `left: 10px`,\n`top: 50%`, `translateY(-50%)`, `pointerEvents: none`; the `TextInput` gets\n`fullWidth pl={4} size=\"sm\"` and an explicit `aria-label`. Wrapper caps at 320px.\n\n## TopBar - sticky AppBar\n\n```tsx\n<AppBar position=\"sticky\" top={0} height={TOPBAR_HEIGHT} size=\"sm\"\n color=\"appBar\" blur borderBottom=\"1px solid\" borderColor=\"default\">\n <Flex flexDirection=\"row\" alignItems=\"center\" justifyContent=\"space-between\" gap={2} height=\"100%\">\n```\n\nBrand wordmark: mono, bold, `letterSpacings.wide`, `fontSizes[2]`, `text.initial`,\nhovering to `text.primary` - with a glyph prefix (`◧ MY APP`). Breadcrumb is a\n`<Sep>/</Sep>` separator in `text.secondary` plus a `NavLink`. Right cluster: user\nemail in `variant=\"caption\" color=\"secondary\" fontFamily=\"mono\"` + a\n`variant=\"text\" size=\"sm\"` action.\n\nGate anything reading `localStorage` behind a `mounted` state - it's unreadable\nduring SSR/hydration and will mismatch.\n\n## ProjectRail - icon rail, 60px, sticky under the AppBar\n\nBottom bar on mobile (`space-evenly`, labels only, 14px), vertical rail at 600px\n(icons appear, labels shrink to 11px, `position: sticky; top: TOPBAR_HEIGHT`,\n`height: calc(100vh - TOPBAR_HEIGHT)`, 2rem top padding, 2.25rem item gap).\nActive item is `palette.primary.main` + bold; hover lifts `translateY(-1px)` over\n150ms. The icon takes `color=\"inherit\"` so the link drives it.\n\nRail item shape: `{ segment, label, icon: IconName }`. Active segment is derived\nfrom the pathname, defaulting to the first item.\n\n## NavLink / TokenCode - the two text primitives\n\n```tsx\nimport NextLink from 'next/link'\nimport { styled } from '@soroush.tech/design-system'\n\nexport const NavLink = styled(NextLink)(({ theme }) => ({\n color: theme.text.primary,\n textDecoration: 'none',\n '&:hover': { textDecoration: 'underline' },\n}))\n\nexport const TokenCode = styled('code')(({ theme }) => ({\n fontFamily: theme.fonts.mono,\n fontSize: theme.fontSizes[0],\n color: theme.text.primary,\n backgroundColor: theme.background.terminal,\n border: `${theme.borderWidths.thin} solid ${theme.border.default}`,\n borderRadius: theme.radii.sm,\n padding: '4px 8px',\n wordBreak: 'break-all',\n}))\n```\n\n---\n\n## Page composition template\n\n```tsx\n\"use client\";\n\nexport default function BuildsPage() {\n const [builds, setBuilds] = useState<BuildRow[] | null>(null);\n\n if (!builds) {\n return (\n <>\n <PageHeader title=\"Builds\" />\n <PageCard flush><BuildRowsSkeleton /></PageCard>\n </>\n );\n }\n\n return (\n <>\n <PageHeader title=\"Builds\" actions={<BranchFilter ... />} />\n <PageCard flush>\n {visible.map((build) => <BuildListRow key={build.id} build={build} />)}\n {visible.length === 0 && (\n <Typography variant=\"body2\" color=\"secondary\" p={3} as=\"div\">\n No builds yet - push a commit to start the first one.\n </Typography>\n )}\n </PageCard>\n </>\n );\n}\n```\n\nThree things to keep: the loading branch renders the _same_ header with a\nshape-matched skeleton (no spinner, no layout shift); the empty state is a\n`body2 / secondary / p={3}` line inside the card, never a blank card; and it says\nwhat to do next, not just \"no data\".\n"
1359
1359
  },
1360
1360
  {
1361
1361
  "id": "brand-theme",
1362
1362
  "title": "Brand theme (theme.ts)",
1363
1363
  "summary": "The brand light and dark theme, ready to drop into an app as theme.ts.",
1364
- "body": "Copy this verbatim into your app as `theme.ts`.\n\n```ts\nimport type { Theme } from '@soroush.tech/design-system'\nimport { baseTheme, createTheme } from '@soroush.tech/design-system/theme'\nimport { alpha, generateBoxShadow } from '@soroush.tech/design-system/utils'\n\n// Brand color ramps, mirrored from the soroush.tech web app (core repo,\n// apps/web/src/theme/colors) so both apps share one color set.\nconst blackAlpha = {\n 0: '#00000000',\n 100: '#0000001A',\n 300: '#0000004D',\n 500: '#00000080',\n 700: '#000000B3',\n} as const\n\nconst carbonBlack = {\n 100: '#F2F3F4',\n 200: '#D7D8DA',\n 400: '#8F9094',\n 500: '#5E6065',\n 800: '#111214',\n 900: '#000000',\n} as const\n\nconst cyberCyan = {\n 400: '#33D9FF',\n 600: '#00B8D9',\n 700: '#0099CC',\n 800: '#0071A4',\n 900: '#004D70',\n} as const\n\nconst deepCrimson = {\n 100: '#ffdad6',\n 600: '#ba1a1a',\n 700: '#93000a',\n} as const\n\nconst forestGreen = {\n 400: '#1cac31',\n 500: '#007318',\n 600: '#006e17',\n 700: '#00530f',\n 800: '#003d0b',\n} as const\n\nconst kineticGreen = {\n 100: '#E8FFE5',\n 300: '#9CFF93',\n 500: '#00FC40',\n 700: '#009928',\n 800: '#006413',\n} as const\n\nconst kineticSurface = {\n 100: '#FFFFFF',\n 300: '#9C9C9C',\n 500: '#363636',\n 600: '#262626',\n 700: '#1A1A1A',\n 800: '#131313',\n 900: '#0E0E0E',\n} as const\n\nconst lightSurface = {\n 100: '#ffffff',\n 200: '#f9f9f9',\n 300: '#f3f3f3',\n 400: '#eeeeee',\n 600: '#e2e2e2',\n 800: '#c4c7c7',\n 900: '#444748',\n 950: '#1a1c1c',\n} as const\n\nconst neonRed = {\n 300: '#FF9590',\n 500: '#FF3B30',\n 600: '#E0251A',\n 700: '#D70015',\n} as const\n\nconst softGreen = {\n 200: '#d4f9d2',\n 400: '#b3eeb1',\n 600: '#5acc57',\n 700: '#3aaa37',\n} as const\n\nconst solarAmber = {\n 200: '#FFF0A0',\n 400: '#FFD930',\n 500: '#FFD60A',\n 600: '#CCA800',\n 800: '#8C6D00',\n} as const\n\nconst lightShadows = Array.from({ length: 25 }, (_, elevation) =>\n generateBoxShadow(elevation, blackAlpha[100])\n)\nconst darkShadows = Array.from({ length: 25 }, (_, elevation) =>\n generateBoxShadow(elevation, '#00000066')\n)\n\n// Chromatic-style pill buttons app-wide; label loses the uppercase treatment.\nconst components: Theme['components'] = {\n Button: {\n styleOverrides: {\n root: { borderRadius: '3em' },\n },\n },\n}\n\nconst typographyOverrides = {\n button: {\n element: 'span',\n fontSize: 1,\n fontWeight: 'extraBold',\n letterSpacing: 'normal',\n textTransform: 'none',\n },\n} as const\n\n/** Default theme: white surfaces, brand green accents. */\nexport const light: Theme = createTheme(baseTheme, {\n name: 'light',\n colorScheme: 'light',\n logoFilter: 'brightness(0)',\n portraitBlend: 'multiply',\n portraitOpacity: 1,\n shadow: { color: carbonBlack[900], opacity: 0.1 },\n components,\n typography: typographyOverrides,\n palette: {\n default: {\n main: carbonBlack[500],\n light: carbonBlack[400],\n dark: carbonBlack[800],\n contrastText: lightSurface[100],\n },\n primary: {\n main: forestGreen[600],\n light: softGreen[200],\n dark: forestGreen[700],\n contrastText: lightSurface[100],\n },\n secondary: {\n main: softGreen[600],\n light: softGreen[200],\n dark: softGreen[700],\n contrastText: lightSurface[100],\n },\n success: {\n main: kineticGreen[700],\n light: kineticGreen[100],\n dark: kineticGreen[800],\n contrastText: lightSurface[100],\n },\n error: {\n main: deepCrimson[600],\n light: deepCrimson[100],\n dark: deepCrimson[700],\n contrastText: lightSurface[100],\n },\n info: {\n main: cyberCyan[800],\n light: '#E0FAFF',\n dark: cyberCyan[900],\n contrastText: lightSurface[100],\n },\n warning: {\n main: solarAmber[600],\n light: solarAmber[200],\n dark: solarAmber[800],\n contrastText: lightSurface[100],\n },\n },\n background: {\n backdrop: blackAlpha[500],\n appBar: alpha(lightSurface[100], 0.85),\n glass: alpha(lightSurface[100], 0.3),\n modal: lightSurface[100],\n default: lightSurface[400],\n primary: lightSurface[200],\n secondary: lightSurface[300],\n paper: lightSurface[100],\n terminal: lightSurface[400],\n grid: alpha(softGreen[600], 0.2),\n transparent: blackAlpha[0],\n scrollbar: blackAlpha[300],\n scrollbarTrack: alpha(lightSurface[300], 0.5),\n },\n text: {\n inherit: 'inherit',\n initial: lightSurface[950],\n primary: forestGreen[600],\n secondary: lightSurface[900],\n disabled: alpha(lightSurface[950], 0.45),\n error: deepCrimson[600],\n success: kineticGreen[700],\n info: cyberCyan[800],\n warning: solarAmber[800],\n },\n border: {\n default: alpha(lightSurface[950], 0.14),\n light: alpha(forestGreen[500], 0.1),\n primary: forestGreen[600],\n dark: forestGreen[800],\n },\n skeleton: {\n highlight: alpha(lightSurface[100], 0.65),\n },\n shadows: lightShadows,\n})\n\nexport const dark: Theme = createTheme(baseTheme, {\n name: 'dark',\n colorScheme: 'dark',\n logoFilter: 'brightness(0) invert(1)',\n portraitBlend: 'screen',\n portraitOpacity: 0.8,\n shadow: { color: carbonBlack[900], opacity: 0.4 },\n components,\n typography: typographyOverrides,\n palette: {\n default: {\n main: kineticSurface[600],\n light: kineticSurface[500],\n dark: kineticSurface[900],\n contrastText: carbonBlack[100],\n },\n primary: {\n main: kineticGreen[500],\n light: kineticGreen[300],\n dark: kineticGreen[800],\n contrastText: carbonBlack[900],\n },\n secondary: {\n main: softGreen[400],\n light: softGreen[200],\n dark: softGreen[600],\n contrastText: carbonBlack[900],\n },\n success: {\n main: kineticGreen[700],\n light: kineticGreen[500],\n dark: kineticGreen[800],\n contrastText: kineticSurface[100],\n },\n error: {\n main: neonRed[500],\n light: neonRed[300],\n dark: neonRed[600],\n contrastText: kineticSurface[100],\n },\n info: {\n main: cyberCyan[600],\n light: cyberCyan[400],\n dark: cyberCyan[700],\n contrastText: carbonBlack[900],\n },\n warning: {\n main: solarAmber[400],\n light: solarAmber[200],\n dark: solarAmber[600],\n contrastText: carbonBlack[900],\n },\n },\n background: {\n backdrop: blackAlpha[700],\n appBar: blackAlpha[700],\n glass: blackAlpha[300],\n modal: kineticSurface[800],\n default: kineticSurface[600],\n primary: kineticSurface[900],\n secondary: kineticSurface[700],\n paper: kineticSurface[800],\n terminal: carbonBlack[900],\n grid: alpha(kineticGreen[500], 0.06),\n transparent: blackAlpha[0],\n scrollbar: alpha(lightSurface[100], 0.4),\n scrollbarTrack: alpha(kineticSurface[600], 0.5),\n },\n text: {\n inherit: 'inherit',\n initial: kineticSurface[100],\n primary: kineticGreen[500],\n secondary: kineticSurface[300],\n disabled: kineticSurface[500],\n error: neonRed[700],\n success: kineticGreen[700],\n info: cyberCyan[600],\n warning: solarAmber[800],\n },\n border: {\n default: kineticSurface[600],\n light: alpha(kineticGreen[100], 0.1),\n primary: kineticGreen[500],\n dark: kineticGreen[800],\n },\n skeleton: {\n highlight: alpha(kineticSurface[500], 0.65),\n },\n shadows: darkShadows,\n})\n```\n"
1364
+ "body": "Copy this verbatim into your app as `theme.ts`.\n\n```ts\nimport type { Theme } from '@soroush.tech/design-system'\nimport { baseTheme, createTheme } from '@soroush.tech/design-system/theme'\nimport { alpha, generateBoxShadow } from '@soroush.tech/design-system/utils'\n\n// Brand color ramps. Every app that copies them shares one color set, so change which\n// ramp fills a palette slot, never the ramp values.\nconst blackAlpha = {\n 0: '#00000000',\n 100: '#0000001A',\n 300: '#0000004D',\n 500: '#00000080',\n 700: '#000000B3',\n} as const\n\nconst carbonBlack = {\n 100: '#F2F3F4',\n 200: '#D7D8DA',\n 400: '#8F9094',\n 500: '#5E6065',\n 800: '#111214',\n 900: '#000000',\n} as const\n\nconst cyberCyan = {\n 400: '#33D9FF',\n 600: '#00B8D9',\n 700: '#0099CC',\n 800: '#0071A4',\n 900: '#004D70',\n} as const\n\nconst deepCrimson = {\n 100: '#ffdad6',\n 600: '#ba1a1a',\n 700: '#93000a',\n} as const\n\nconst forestGreen = {\n 400: '#1cac31',\n 500: '#007318',\n 600: '#006e17',\n 700: '#00530f',\n 800: '#003d0b',\n} as const\n\nconst kineticGreen = {\n 100: '#E8FFE5',\n 300: '#9CFF93',\n 500: '#00FC40',\n 700: '#009928',\n 800: '#006413',\n} as const\n\nconst kineticSurface = {\n 100: '#FFFFFF',\n 300: '#9C9C9C',\n 500: '#363636',\n 600: '#262626',\n 700: '#1A1A1A',\n 800: '#131313',\n 900: '#0E0E0E',\n} as const\n\nconst lightSurface = {\n 100: '#ffffff',\n 200: '#f9f9f9',\n 300: '#f3f3f3',\n 400: '#eeeeee',\n 600: '#e2e2e2',\n 800: '#c4c7c7',\n 900: '#444748',\n 950: '#1a1c1c',\n} as const\n\nconst neonRed = {\n 300: '#FF9590',\n 500: '#FF3B30',\n 600: '#E0251A',\n 700: '#D70015',\n} as const\n\nconst softGreen = {\n 200: '#d4f9d2',\n 400: '#b3eeb1',\n 600: '#5acc57',\n 700: '#3aaa37',\n} as const\n\nconst solarAmber = {\n 200: '#FFF0A0',\n 400: '#FFD930',\n 500: '#FFD60A',\n 600: '#CCA800',\n 800: '#8C6D00',\n} as const\n\nconst lightShadows = Array.from({ length: 25 }, (_, elevation) =>\n generateBoxShadow(elevation, blackAlpha[100])\n)\nconst darkShadows = Array.from({ length: 25 }, (_, elevation) =>\n generateBoxShadow(elevation, '#00000066')\n)\n\n// Chromatic-style pill buttons app-wide; label loses the uppercase treatment.\nconst components: Theme['components'] = {\n Button: {\n styleOverrides: {\n root: { borderRadius: '3em' },\n },\n },\n}\n\nconst typographyOverrides = {\n button: {\n element: 'span',\n fontSize: 1,\n fontWeight: 'extraBold',\n letterSpacing: 'normal',\n textTransform: 'none',\n },\n} as const\n\n/** Default theme: white surfaces, brand green accents. */\nexport const light: Theme = createTheme(baseTheme, {\n name: 'light',\n colorScheme: 'light',\n logoFilter: 'brightness(0)',\n portraitBlend: 'multiply',\n portraitOpacity: 1,\n shadow: { color: carbonBlack[900], opacity: 0.1 },\n components,\n typography: typographyOverrides,\n palette: {\n default: {\n main: carbonBlack[500],\n light: carbonBlack[400],\n dark: carbonBlack[800],\n contrastText: lightSurface[100],\n },\n primary: {\n main: forestGreen[600],\n light: softGreen[200],\n dark: forestGreen[700],\n contrastText: lightSurface[100],\n },\n secondary: {\n main: softGreen[600],\n light: softGreen[200],\n dark: softGreen[700],\n contrastText: lightSurface[100],\n },\n success: {\n main: kineticGreen[700],\n light: kineticGreen[100],\n dark: kineticGreen[800],\n contrastText: lightSurface[100],\n },\n error: {\n main: deepCrimson[600],\n light: deepCrimson[100],\n dark: deepCrimson[700],\n contrastText: lightSurface[100],\n },\n info: {\n main: cyberCyan[800],\n light: '#E0FAFF',\n dark: cyberCyan[900],\n contrastText: lightSurface[100],\n },\n warning: {\n main: solarAmber[600],\n light: solarAmber[200],\n dark: solarAmber[800],\n contrastText: lightSurface[100],\n },\n },\n background: {\n backdrop: blackAlpha[500],\n appBar: alpha(lightSurface[100], 0.85),\n glass: alpha(lightSurface[100], 0.3),\n modal: lightSurface[100],\n default: lightSurface[400],\n primary: lightSurface[200],\n secondary: lightSurface[300],\n paper: lightSurface[100],\n terminal: lightSurface[400],\n grid: alpha(softGreen[600], 0.2),\n transparent: blackAlpha[0],\n scrollbar: blackAlpha[300],\n scrollbarTrack: alpha(lightSurface[300], 0.5),\n },\n text: {\n inherit: 'inherit',\n initial: lightSurface[950],\n primary: forestGreen[600],\n secondary: lightSurface[900],\n disabled: alpha(lightSurface[950], 0.45),\n error: deepCrimson[600],\n success: kineticGreen[700],\n info: cyberCyan[800],\n warning: solarAmber[800],\n },\n border: {\n default: alpha(lightSurface[950], 0.14),\n light: alpha(forestGreen[500], 0.1),\n primary: forestGreen[600],\n dark: forestGreen[800],\n },\n skeleton: {\n highlight: alpha(lightSurface[100], 0.65),\n },\n shadows: lightShadows,\n})\n\nexport const dark: Theme = createTheme(baseTheme, {\n name: 'dark',\n colorScheme: 'dark',\n logoFilter: 'brightness(0) invert(1)',\n portraitBlend: 'screen',\n portraitOpacity: 0.8,\n shadow: { color: carbonBlack[900], opacity: 0.4 },\n components,\n typography: typographyOverrides,\n palette: {\n default: {\n main: kineticSurface[600],\n light: kineticSurface[500],\n dark: kineticSurface[900],\n contrastText: carbonBlack[100],\n },\n primary: {\n main: kineticGreen[500],\n light: kineticGreen[300],\n dark: kineticGreen[800],\n contrastText: carbonBlack[900],\n },\n secondary: {\n main: softGreen[400],\n light: softGreen[200],\n dark: softGreen[600],\n contrastText: carbonBlack[900],\n },\n success: {\n main: kineticGreen[700],\n light: kineticGreen[500],\n dark: kineticGreen[800],\n contrastText: kineticSurface[100],\n },\n error: {\n main: neonRed[500],\n light: neonRed[300],\n dark: neonRed[600],\n contrastText: kineticSurface[100],\n },\n info: {\n main: cyberCyan[600],\n light: cyberCyan[400],\n dark: cyberCyan[700],\n contrastText: carbonBlack[900],\n },\n warning: {\n main: solarAmber[400],\n light: solarAmber[200],\n dark: solarAmber[600],\n contrastText: carbonBlack[900],\n },\n },\n background: {\n backdrop: blackAlpha[700],\n appBar: blackAlpha[700],\n glass: blackAlpha[300],\n modal: kineticSurface[800],\n default: kineticSurface[600],\n primary: kineticSurface[900],\n secondary: kineticSurface[700],\n paper: kineticSurface[800],\n terminal: carbonBlack[900],\n grid: alpha(kineticGreen[500], 0.06),\n transparent: blackAlpha[0],\n scrollbar: alpha(lightSurface[100], 0.4),\n scrollbarTrack: alpha(kineticSurface[600], 0.5),\n },\n text: {\n inherit: 'inherit',\n initial: kineticSurface[100],\n primary: kineticGreen[500],\n secondary: kineticSurface[300],\n disabled: kineticSurface[500],\n error: neonRed[700],\n success: kineticGreen[700],\n info: cyberCyan[600],\n warning: solarAmber[800],\n },\n border: {\n default: kineticSurface[600],\n light: alpha(kineticGreen[100], 0.1),\n primary: kineticGreen[500],\n dark: kineticGreen[800],\n },\n skeleton: {\n highlight: alpha(kineticSurface[500], 0.65),\n },\n shadows: darkShadows,\n})\n```\n"
1365
1365
  },
1366
1366
  {
1367
1367
  "id": "providers",
@@ -1373,7 +1373,7 @@ const content = {
1373
1373
  "id": "design-system-overview",
1374
1374
  "title": "Design system overview",
1375
1375
  "summary": "The package README: what ships, the import contract, and the component inventory.",
1376
- "body": "**Your design system. Your tokens. Your rules.**\nA fully typed React component library where nothing is hardcoded - every color, scale, and default belongs to you, not the package.\n\nTired of forking a component library just to change a color? Every token here is designed to be overridden - theming isn't an afterthought, it's the whole point.\n\n## Install\n\n```sh\nnpm i @soroush.tech/design-system\n```\n\n`react` and `react-dom` are peer dependencies. Emotion is an internal implementation detail - it ships as a regular dependency, not a peer, so you never install it yourself.\n\n---\n\n## Use it with AI tools\n\nAn MCP server serves this library's component inventory, every component's props\nreference, and the live token contract, so an AI assistant writes against the real API\ninstead of guessing:\n\n```sh\nclaude mcp add --transport http soroush https://mcp.soroush.design/mcp\n```\n\nIt also runs locally over stdio (`npx -y @soroush.design/mcp`). Claude Code users can\ninstall the plugin instead, which adds a house-style skill and a UI review agent on top\nof the same server:\n\n```sh\nclaude plugin marketplace add soroush-tech/design-system\nclaude plugin install soroush-design-system@soroush-tech\n```\n\nAny other tool can read [docs.soroush.tech/llms.txt](https://docs.soroush.tech/llms.txt).\nSee [`@soroush.design/mcp`](../mcp) for the full tool list.\n\n---\n\n## Importing\n\nImport components by subpath, styling primitives from the barrel:\n\n```ts\nimport { Typography } from '@soroush.tech/design-system/Typography'\nimport { Flex } from '@soroush.tech/design-system/Flex'\n```\n\nStyling primitives (the engine) come from the barrel `@soroush.tech/design-system` - `styled`, `css`, `keyframes`, the `Theme` type, styled-system functions, and `createShouldForwardProp`. The barrel (`src/index.ts`) is the engine abstraction layer: to swap the CSS-in-JS engine, only that file changes.\n\n```ts\nimport { styled, css, type Theme } from '@soroush.tech/design-system'\n```\n\n`ThemeProvider` and the theme-value hooks (`useTheme`, `useDefaultProps`, `withTheme`) live at their own subpath:\n\n```ts\nimport { ThemeProvider, useTheme } from '@soroush.tech/design-system/theme'\n```\n\nStyle-computation helpers (`useStyle`, `withStyles`, `StylesConsumer`) - resolving a `StyleInput`/`StyleFactory` into a `CSSObject` - live at their own subpath:\n\n```ts\nimport { useStyle } from '@soroush.tech/design-system/style'\n```\n\nRaw engine primitives for building your own global styles - `Global`, `globalStyles`, and the SSR-only `CacheProvider`/`styleCache` pairing - live at their own subpath, not the barrel:\n\n```ts\nimport { Global, globalStyles, CacheProvider, styleCache } from '@soroush.tech/design-system/engine'\n```\n\n`Global` (retyped against this package's `Theme`) applies app-wide CSS and should render inside `ThemeProvider` so it resolves against the active theme. `globalStyles(theme)` is the base reset this package owns - box-sizing, margin/table resets, and theme-driven body colors - compose it into your own `Global` styles array alongside your app's own concerns (font-family, webfont loading, and anything else app-specific stay entirely app policy).\n\nThe component catalog - every component as data, for tools that place and write components (a\ndesign tool's palette, a source writer) - lives at its own subpath and loads in plain Node\n([docs](./docs/catalog.md)):\n\n```ts\nimport { catalog } from '@soroush.tech/design-system/catalog'\n```\n\nSSR critical-CSS extraction (e.g. with `@emotion/server`) is a separate, opt-in concern most apps never need - that's what `CacheProvider` and its paired `styleCache` instance are for.\n\nUnder a strict Content Security Policy, bring your own cache with the response's nonce - `createCache({ key: 'app', nonce })` from `@emotion/cache`, given to `CacheProvider` above `ThemeProvider` - and every style tag the engine inserts carries it. The shipped `styleCache` has no nonce.\n\nThe Emotion packages are regular dependencies of this package, not peers, on purpose: nothing of Emotion is on the public surface, so an app installs nothing extra and has no version to keep in step. An app that brings its own `@emotion/react` of another major gets two copies - the components keep working, as they style through their own copy and `ThemeProvider` - at the cost of the duplicate in the bundle and Emotion's one-time development warning.\n\n---\n\n## Component inventory\n\n### Layout & surfaces\n\n| Component | Purpose |\n| ------------ | ----------------------------------------------------------------------- |\n| `ScrollArea` | A scrolling area with scrollbars drawn over its content, shown on hover |\n| `View` | Styled `div` primitive - the base building block |\n| `Flex` | `View` with flexbox defaults |\n| `Grid` | CSS grid container |\n| `Paper` | Elevated surface with background and shadow |\n| `Card` | Content container built on `Paper` |\n| `Quote` | Bordered quote / terminal-panel surface on `View` |\n| `AppBar` | Top application bar |\n| `Drawer` | Slide-in side panel |\n\n### Content & data display\n\n| Component | Purpose |\n| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `Typography` | Text with variant → element mapping - the reference implementation for all components |\n| `Link` | Anchor with theme-aware styling |\n| `Icon` | Icon renderer |\n| `Image` | Image with styled-system props |\n| `Avatar` | User/entity avatar |\n| `Table` | Compound data table - exports `TableContainer`, `TableHead`, `TableBody`, `TableFooter`, `TableRow`, `TableCell`, `TablePagination`, `TablePaginationActions`, `TableSortLabel`, and `TableControl` from `@soroush.tech/design-system/Table` |\n| `Accordion` | A heading that opens and closes a region - exports `AccordionSummary`, `AccordionDetails`, `AccordionActions` and `AccordionGroup` from `@soroush.tech/design-system/Accordion` |\n\n### Inputs & forms\n\n| Component | Purpose |\n| ---------------------------------------------------- | ----------------------------------------------------------------------------------------- |\n| `Autocomplete` | A field whose text finds an option in a list - one, several as chips, or free text |\n| `Fab` | A floating action button: the one main action of a page, circular or extended |\n| `Button`, `ButtonGroup`, `ToggleButton` | Actions and toggles |\n| `TextInput` | Text field |\n| `Checkbox`, `Radio`, `Switch` | Selection controls |\n| `RangeInput` | A slider - one value on a range, or two or more thumbs for a range of values |\n| `TransferList` | Two lists and the buttons that move the checked items from one to the other |\n| `NumberInput` | A field for a number - read in its locale, clamped to a range, stepped by keys or buttons |\n| `Rating` | A row of icons the user sets as a rating, or a read-only display of one |\n| `NativeSelect` | Low-level platform `<select>` - not recommended; use `Select native` |\n| `Select` | The select to use - custom listbox, or `native` for the platform picker |\n| `MenuItem` | Option row for `Select`'s listbox, and a menu row in a `MenuList` |\n| `Form`, `FormControl`, `FormLabel`, `FormHelperText` | Form composition and labeling |\n| `Pagination` | Page navigation control |\n\n### Navigation & menus\n\n| Component | Purpose |\n| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `NavTree` | A tree of links to the pages of a site - groups of links, which can fold |\n| `Breadcrumbs` | The trail of links from a site's root to the current page - a long one collapses behind a button that shows it all |\n| `Menu` | A trigger and the list of commands it opens - exports `MenuList` (the `role=\"menu\"` list that owns the keyboard), `MenuDivider`, `MenuItems` (rows from data) and `ContextMenu` (the same list, opened at the pointer by a right-click) from `@soroush.tech/design-system/Menu` |\n| `Tabs` | A row of tabs - exports `Tab`, `TabContext` (holds the value for a `TabList` and its panels), `TabList` (the `Tabs` of a `TabContext`), `TabPanel` (the content a tab shows) and `TabScrollButton` from `@soroush.tech/design-system/Tabs` |\n\n### Feedback\n\n| Component | Purpose |\n| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- |\n| `FabMenu` | A fab that opens a stack of actions from the corner of a page |\n| `Snackbar` | A transient message in a corner of the window, with auto-hide and an action |\n| `Alert` | An inline message with a severity, an icon, a title and an action - exports `AlertTitle` from `@soroush.tech/design-system/Alert` |\n| `Badge` | A count or a dot anchored over another element |\n| `Chip` | A compact tag: a label, an icon or avatar, a click and a delete |\n| `CircularProgress`, `LinearProgress` | Determinate/indeterminate progress indicators |\n| `Skeleton` | Loading placeholder with pulse/wave animations |\n| `Backdrop` | Dimmed overlay behind modal surfaces |\n\n### Transitions\n\n| Component | Purpose |\n| ------------------------------- | ------------------------------------------------------------------ |\n| `Collapse` | Opens and closes its content by its height, or its width |\n| `Fade`, `Grow`, `Slide`, `Zoom` | Show and hide one child by opacity, scale, an edge or from nothing |\n\n### Overlay & behavior primitives\n\n| Component | Purpose |\n| --------------- | ----------------------------------------------------------------------------------- |\n| `Tooltip` | A short description of one element, shown on hover, keyboard focus and a long touch |\n| `Portal` | Renders children into a DOM node outside the parent hierarchy |\n| `FocusTrap` | Keeps focus inside a subtree |\n| `Modal` | Dialog primitive composing `Portal`, `Backdrop`, and `FocusTrap` |\n| `Popover` | Anchored floating surface built on `Modal` |\n| `ThemeProvider` | Supplies the theme and global styles to the app |\n\n---\n\n## Theme tokens\n\nComponents never hardcode colors or sizes - props resolve against scales on the `Theme` object:\n\n| Group | Scales |\n| ------------------ | ------------------------------------------------------------------------------------------------------------- |\n| Color | `palette` (main/light/dark/contrastText per color) · `text` · `background` · `border` · `colorScheme` |\n| Typography | `typography` (variant map) · `fonts` · `fontSizes` · `fontWeights` · `lineHeights` · `letterSpacings` |\n| Space & shape | `space` · `sizes` · `radii` · `borderWidths` · `shadows` |\n| Layout | `breakpoints` (xs/sm/md/lg/xl window classes) · `layout` (columns, margins, panels, top bar per class) |\n| Component scales | `avatar` (size steps) · `skeleton` (wave highlight) |\n| Layering & effects | `zOrder` (appBar/drawer/modal/snackbar/tooltip) · `blur` · `logoFilter` · `portraitBlend` · `portraitOpacity` |\n\nProp types are derived from the interface (`keyof Theme['text']`), so adding a token to `themes.ts` propagates everywhere automatically. See [`design-system.md`](./design-system.md) for the full scale table and the palette rules.\n\n---\n\n## Theming\n\nThe theme belongs to you - the package only ships defaults. This section is the overview; the full guides are [`docs/theming.md`](./docs/theming.md) and [`docs/customization.md`](./docs/customization.md).\n\n### One theme, yours\n\n`ThemeProvider` provides exactly one theme - the built-in dark theme when you pass nothing. Bring one theme, or as many as you like: switching between them is your state, not the provider's.\n\n```tsx\nimport { ThemeProvider } from '@soroush.tech/design-system/theme'\nimport { baseTheme, createTheme } from '@soroush.tech/design-system/theme'\n\n// Zero-config: the built-in `baseTheme`.\n<ThemeProvider>{app}</ThemeProvider>\n\n// Your theme - written from scratch or extended from the base.\nconst brand = createTheme(baseTheme, { palette: { primary: { main: '#00ff88' } } })\n<ThemeProvider theme={brand}>{app}</ThemeProvider>\n\n// Mode switching is app policy - own the state and pass the active theme:\nconst [isDark, setIsDark] = useState(true)\n<ThemeProvider theme={isDark ? brandDark : brandLight}>{app}</ThemeProvider>\n```\n\n`createTheme(base, overrides)` (exported from `@soroush.tech/design-system/theme`) is the merge primitive: plain objects recurse, arrays (`shadows`, `fontSizes`) and functions replace wholesale, `undefined` values are ignored - keys are added or replaced, never removed.\n\n### Breakpoints and layout\n\n`theme.breakpoints` are Material 3's window classes, each a range from its start until the next:\n`xs` 0-599px (compact, the base), `sm` 600-839 (medium), `md` 840-1199 (expanded), `lg`\n1200-1599 (large), `xl` 1600+ (extra-large). Responsive props use them by name or position -\n`p={{ xs: 2, md: 4 }}`, `p={[2, 3, 4]}` - and `cqSm`-style keys write container queries;\n`theme.breakpoints.up('md')` and its siblings write queries for hand-written styles. Everything is\nCSS, so pages work with JavaScript off. `theme.layout` holds the layout tokens per class (columns,\nmargins, gutters, side panels, top bar); `Grid` and `Flex` apply the column grid with\n`layout` / `layout={{ lg: { columns: 16 } }}`, and apps place `AppBar`, `Sidebar` and `Drawer`\nthemselves. The full guide is the\n[Breakpoints and layout](./docs/theming.md#breakpoints-and-layout) section of the theming guide.\n\n### Component defaults\n\nComponents carry visible literal fallbacks (`size = 'md'`, `variant = 'outside'`, ...) resolved through `themeDefault(theme, key, fallback)` - so every default, including behavioral variants, is overridable via the optional `theme.defaults` map or the provider's `defaults` prop:\n\n| Key | Fallback | Drives |\n| -------------------------------------------- | ---------------------------------- | -------------------------------------- |\n| `size` / `compactSize` | `'md'` / `'sm'` | sized components / dense table actions |\n| `color` / `neutralColor` | `'primary'` / `'default'` | accent controls / toggle controls |\n| `textColor` / `accentTextColor` | `'initial'` / `'primary'` | body text / icons + input labels |\n| `bg` / `surfaceBg` / `inputBg` | `'default'`/`'paper'`/`'terminal'` | switch track / paper surfaces / inputs |\n| `borderRadius` / `surfaceRadius` | `'md'` / `'sq'` | grouped controls / surfaces |\n| `avatarSize` / `borderColor` / `borderWidth` | `'md'` / `'primary'` / `'thin'` | avatars and rings |\n| `iconSize` | `'lg'` | Icon default glyph size (`theme.icon`) |\n| `inputMinWidth` | `'12rem'` | least width of an input not full width |\n| `buttonVariant` / `switchVariant` | `'contained'` / `'outside'` | Button / Switch visual variants |\n| `inputVariant` | `'default'` | TextInput, Select, NativeSelect frames |\n| `avatarVariant` / `cardVariant` | `'circular'` / `'paper'` | Avatar shape / Card treatment |\n| `linkUnderline` | `'always'` | Link underline behavior |\n| `paginationVariant` / `paginationShape` | `'text'` / `'circular'` | Pagination items |\n\nThe built-in themes carry no `defaults` - the literals apply. A theme with entirely different size or palette keys stays valid by pointing the keys at its own tokens:\n\n```tsx\n<ThemeProvider defaults={{ size: 'compact', color: 'brand', switchVariant: 'inside' }}>\n```\n\n### Per-component customization (`theme.components`)\n\nCustomize one component for the whole app - default prop values, per-slot CSS, and new variant values - without wrapping or forking:\n\n```tsx\nconst brand = createTheme(baseTheme, {\n components: {\n Button: {\n // Buttons default to sm + rounded; explicit props and ButtonGroup still win.\n defaultProps: { size: 'sm', shape: 'rounded' },\n\n // Per-slot CSS merged after Button's own styles - the theme wins the cascade,\n // but per-instance props (m, p, width, ...) still beat the theme.\n styleOverrides: {\n root: ({ theme, ownerState }) => ({\n letterSpacing: theme.letterSpacings.wide,\n ...(ownerState.variant === 'contained' && { textTransform: 'none' }),\n }),\n label: { fontStyle: 'italic' },\n },\n\n // A new variant value - register it first so it typechecks:\n // declare module '@soroush.tech/design-system/theme' { interface ButtonVariants { dashed: true } }\n variants: [\n {\n props: { variant: 'dashed' },\n style: ({ theme }) => ({\n backgroundColor: 'transparent',\n border: `${theme.borderWidths.thin} dashed ${theme.border.primary}`,\n }),\n },\n ],\n },\n },\n})\n```\n\nStyle callbacks receive `{ theme, ownerState }`, where `ownerState` is the styled root's **resolved** props (after group context, `defaultProps`, and `theme.defaults`). `defaultProps` sits in the standard precedence chain: explicit prop → group context → `defaultProps` → `theme.defaults.*` → the component's literal fallback. `variants` arrays are replaced wholesale by `createTheme`, never merged.\n\nYour own components can join the same mechanism: create their roots with this package's `styled(tag, { name: 'MyWidget', slot: 'root' })` and register the name by augmenting `ThemeComponents`. Zero-config themes pay nothing - the resolver bails out on the first check when `theme.components` is absent.\n\n### Extending tokens (declaration merging)\n\nEvery scale is an open interface declared on `@soroush.tech/design-system/theme`, so you can add palette colors, tokens, or whole scales - and every component prop union (`color`, `bg`, `size`, ...) widens automatically:\n\n```ts\nimport type { PaletteEntry } from '@soroush.tech/design-system/theme'\n\ndeclare module '@soroush.tech/design-system/theme' {\n interface ThemePalette {\n brand: PaletteEntry // new palette color\n }\n interface ThemeBackground {\n tertiary: string // new background token\n }\n interface Theme {\n elevations: Record<'low' | 'mid' | 'high', string> // whole new scale\n }\n}\n```\n\nThen supply the values with `createTheme` and use the new keys:\n\n```tsx\nconst brandDark = createTheme(baseTheme, {\n palette: { brand: { main: '#00ff88', light: '#66ffb2', dark: '#00b25f', contrastText: '#000' } },\n background: { tertiary: '#101418' },\n elevations: { low: '0 1px 2px', mid: '0 2px 6px', high: '0 6px 18px' },\n})\n\n<ThemeProvider theme={brandDark}>\n <Button color=\"brand\" />\n <View bg=\"tertiary\" />\n</ThemeProvider>\n```\n\nNotes: new object-valued keys (like a `PaletteEntry`) must be supplied complete - components read `.main`/`.contrastText` at runtime; and TypeScript cannot verify at runtime that an augmented token was actually supplied, so always pair an augmentation with the matching override.\n\n---\n\n## Adding a component\n\nScaffold with the skill - it reads the live `Typography` files and `design-system.md` so output matches the codebase:\n\n```\n/new_theme_component ComponentName\n```\n\nThen work through the checklist at the bottom of [`design-system.md`](./design-system.md).\n\n---\n\nThe library takes inspiration from [Material UI](https://mui.com/) - its component vocabulary and prop conventions will feel familiar - but it is written entirely in house. It is not a clone or a fork: every component is built from scratch on our own engine and token system, and the API is free to diverge wherever it serves its consumers better.\n\n---\n\n## Release notes\n\nPer-version notes for every published release live in\n[`release-notes/`](https://github.com/soroush-tech/design-system/tree/main/packages/design-system/release-notes).\n",
1376
+ "body": "**Your design system. Your tokens. Your rules.**\nA fully typed React component library where nothing is hardcoded - every color, scale, and default belongs to you, not the package.\n\nTired of forking a component library just to change a color? Every token here is designed to be overridden - theming isn't an afterthought, it's the whole point.\n\n## Install\n\n```sh\nnpm i @soroush.tech/design-system\n```\n\n`react` and `react-dom` are peer dependencies. Emotion is an internal implementation detail - it ships as a regular dependency, not a peer, so you never install it yourself.\n\n---\n\n## Use it with AI tools\n\nTwo skills teach a coding agent how to build with this library: a house-style skill, and a\nWCAG 2.2 AA skill for contrast, labels, landmarks and accessibility tests. Both install for\nwhichever agents you use:\n\n```sh\nnpx skills add soroush-tech/design-system\n```\n\nAn MCP server serves this library's component inventory, every component's props\nreference, and the live token contract, so an AI assistant writes against the real API\ninstead of guessing. Add the hosted server, `https://mcp.soroush.design/mcp`, to any MCP\nclient; in Claude Code:\n\n```sh\nclaude mcp add --transport http soroush https://mcp.soroush.design/mcp\n```\n\nIt also runs locally over stdio (`npx -y @soroush.design/mcp`). Claude Code users can\ninstall the plugin instead, which brings the skills, the server and a UI review agent in\none step:\n\n```sh\nclaude plugin marketplace add soroush-tech/design-system\nclaude plugin install soroush-design-system@soroush-tech\n```\n\nAny other tool can read [docs.soroush.tech/llms.txt](https://docs.soroush.tech/llms.txt).\nSee [`@soroush.design/mcp`](../mcp) for the full tool list.\n\n---\n\n## Importing\n\nImport components by subpath, styling primitives from the barrel:\n\n```ts\nimport { Typography } from '@soroush.tech/design-system/Typography'\nimport { Flex } from '@soroush.tech/design-system/Flex'\n```\n\nStyling primitives (the engine) come from the barrel `@soroush.tech/design-system` - `styled`, `css`, `keyframes`, the `Theme` type, styled-system functions, and `createShouldForwardProp`. The barrel (`src/index.ts`) is the engine abstraction layer: to swap the CSS-in-JS engine, only that file changes.\n\n```ts\nimport { styled, css, type Theme } from '@soroush.tech/design-system'\n```\n\n`ThemeProvider` and the theme-value hooks (`useTheme`, `useDefaultProps`, `withTheme`) live at their own subpath:\n\n```ts\nimport { ThemeProvider, useTheme } from '@soroush.tech/design-system/theme'\n```\n\nStyle-computation helpers (`useStyle`, `withStyles`, `StylesConsumer`) - resolving a `StyleInput`/`StyleFactory` into a `CSSObject` - live at their own subpath:\n\n```ts\nimport { useStyle } from '@soroush.tech/design-system/style'\n```\n\nRaw engine primitives for building your own global styles - `Global`, `globalStyles`, and the SSR-only `CacheProvider`/`styleCache` pairing - live at their own subpath, not the barrel:\n\n```ts\nimport { Global, globalStyles, CacheProvider, styleCache } from '@soroush.tech/design-system/engine'\n```\n\n`Global` (retyped against this package's `Theme`) applies app-wide CSS and should render inside `ThemeProvider` so it resolves against the active theme. `globalStyles(theme)` is the base reset this package owns - box-sizing, margin/table resets, and theme-driven body colors - compose it into your own `Global` styles array alongside your app's own concerns (font-family, webfont loading, and anything else app-specific stay entirely app policy).\n\nThe component catalog - every component as data, for tools that place and write components (a\ndesign tool's palette, a source writer) - lives at its own subpath and loads in plain Node\n([docs](./docs/catalog.md)):\n\n```ts\nimport { catalog } from '@soroush.tech/design-system/catalog'\n```\n\nSSR critical-CSS extraction (e.g. with `@emotion/server`) is a separate, opt-in concern most apps never need - that's what `CacheProvider` and its paired `styleCache` instance are for.\n\nUnder a strict Content Security Policy, bring your own cache with the response's nonce - `createCache({ key: 'app', nonce })` from `@emotion/cache`, given to `CacheProvider` above `ThemeProvider` - and every style tag the engine inserts carries it. The shipped `styleCache` has no nonce.\n\nThe Emotion packages are regular dependencies of this package, not peers, on purpose: nothing of Emotion is on the public surface, so an app installs nothing extra and has no version to keep in step. An app that brings its own `@emotion/react` of another major gets two copies - the components keep working, as they style through their own copy and `ThemeProvider` - at the cost of the duplicate in the bundle and Emotion's one-time development warning.\n\n---\n\n## Component inventory\n\n### Layout & surfaces\n\n| Component | Purpose |\n| ------------ | ----------------------------------------------------------------------- |\n| `ScrollArea` | A scrolling area with scrollbars drawn over its content, shown on hover |\n| `View` | Styled `div` primitive - the base building block |\n| `Flex` | `View` with flexbox defaults |\n| `Grid` | CSS grid container |\n| `Paper` | Elevated surface with background and shadow |\n| `Card` | Content container built on `Paper` |\n| `Quote` | Bordered quote / terminal-panel surface on `View` |\n| `AppBar` | Top application bar |\n| `Drawer` | Slide-in side panel |\n\n### Content & data display\n\n| Component | Purpose |\n| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `Typography` | Text with variant → element mapping - the reference implementation for all components |\n| `Link` | Anchor with theme-aware styling |\n| `Icon` | Icon renderer |\n| `Image` | Image with styled-system props |\n| `Avatar` | User/entity avatar |\n| `Table` | Compound data table - exports `TableContainer`, `TableHead`, `TableBody`, `TableFooter`, `TableRow`, `TableCell`, `TablePagination`, `TablePaginationActions`, `TableSortLabel`, and `TableControl` from `@soroush.tech/design-system/Table` |\n| `Accordion` | A heading that opens and closes a region - exports `AccordionSummary`, `AccordionDetails`, `AccordionActions` and `AccordionGroup` from `@soroush.tech/design-system/Accordion` |\n\n### Inputs & forms\n\n| Component | Purpose |\n| ---------------------------------------------------- | ----------------------------------------------------------------------------------------- |\n| `Autocomplete` | A field whose text finds an option in a list - one, several as chips, or free text |\n| `Fab` | A floating action button: the one main action of a page, circular or extended |\n| `Button`, `ButtonGroup`, `ToggleButton` | Actions and toggles |\n| `TextInput` | Text field |\n| `Checkbox`, `Radio`, `Switch` | Selection controls |\n| `RangeInput` | A slider - one value on a range, or two or more thumbs for a range of values |\n| `TransferList` | Two lists and the buttons that move the checked items from one to the other |\n| `NumberInput` | A field for a number - read in its locale, clamped to a range, stepped by keys or buttons |\n| `Rating` | A row of icons the user sets as a rating, or a read-only display of one |\n| `NativeSelect` | Low-level platform `<select>` - not recommended; use `Select native` |\n| `Select` | The select to use - custom listbox, or `native` for the platform picker |\n| `MenuItem` | Option row for `Select`'s listbox, and a menu row in a `MenuList` |\n| `Form`, `FormControl`, `FormLabel`, `FormHelperText` | Form composition and labeling |\n| `Pagination` | Page navigation control |\n\n### Navigation & menus\n\n| Component | Purpose |\n| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `NavTree` | A tree of links to the pages of a site - groups of links, which can fold |\n| `Breadcrumbs` | The trail of links from a site's root to the current page - a long one collapses behind a button that shows it all |\n| `Menu` | A trigger and the list of commands it opens - exports `MenuList` (the `role=\"menu\"` list that owns the keyboard), `MenuDivider`, `MenuItems` (rows from data) and `ContextMenu` (the same list, opened at the pointer by a right-click) from `@soroush.tech/design-system/Menu` |\n| `Tabs` | A row of tabs - exports `Tab`, `TabContext` (holds the value for a `TabList` and its panels), `TabList` (the `Tabs` of a `TabContext`), `TabPanel` (the content a tab shows) and `TabScrollButton` from `@soroush.tech/design-system/Tabs` |\n\n### Feedback\n\n| Component | Purpose |\n| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- |\n| `FabMenu` | A fab that opens a stack of actions from the corner of a page |\n| `Snackbar` | A transient message in a corner of the window, with auto-hide and an action |\n| `Alert` | An inline message with a severity, an icon, a title and an action - exports `AlertTitle` from `@soroush.tech/design-system/Alert` |\n| `Badge` | A count or a dot anchored over another element |\n| `Chip` | A compact tag: a label, an icon or avatar, a click and a delete |\n| `CircularProgress`, `LinearProgress` | Determinate/indeterminate progress indicators |\n| `Skeleton` | Loading placeholder with pulse/wave animations |\n| `Backdrop` | Dimmed overlay behind modal surfaces |\n\n### Transitions\n\n| Component | Purpose |\n| ------------------------------- | ------------------------------------------------------------------ |\n| `Collapse` | Opens and closes its content by its height, or its width |\n| `Fade`, `Grow`, `Slide`, `Zoom` | Show and hide one child by opacity, scale, an edge or from nothing |\n\n### Overlay & behavior primitives\n\n| Component | Purpose |\n| --------------- | ----------------------------------------------------------------------------------- |\n| `Tooltip` | A short description of one element, shown on hover, keyboard focus and a long touch |\n| `Portal` | Renders children into a DOM node outside the parent hierarchy |\n| `FocusTrap` | Keeps focus inside a subtree |\n| `Modal` | Dialog primitive composing `Portal`, `Backdrop`, and `FocusTrap` |\n| `Popover` | Anchored floating surface built on `Modal` |\n| `ThemeProvider` | Supplies the theme and global styles to the app |\n\n---\n\n## Theme tokens\n\nComponents never hardcode colors or sizes - props resolve against scales on the `Theme` object:\n\n| Group | Scales |\n| ------------------ | ------------------------------------------------------------------------------------------------------------- |\n| Color | `palette` (main/light/dark/contrastText per color) · `text` · `background` · `border` · `colorScheme` |\n| Typography | `typography` (variant map) · `fonts` · `fontSizes` · `fontWeights` · `lineHeights` · `letterSpacings` |\n| Space & shape | `space` · `sizes` · `radii` · `borderWidths` · `shadows` |\n| Layout | `breakpoints` (xs/sm/md/lg/xl window classes) · `layout` (columns, margins, panels, top bar per class) |\n| Component scales | `avatar` (size steps) · `skeleton` (wave highlight) |\n| Layering & effects | `zOrder` (appBar/drawer/modal/snackbar/tooltip) · `blur` · `logoFilter` · `portraitBlend` · `portraitOpacity` |\n\nProp types are derived from the interface (`keyof Theme['text']`), so adding a token to `themes.ts` propagates everywhere automatically. See [`design-system.md`](./design-system.md) for the full scale table and the palette rules.\n\n---\n\n## Theming\n\nThe theme belongs to you - the package only ships defaults. This section is the overview; the full guides are [`docs/theming.md`](./docs/theming.md) and [`docs/customization.md`](./docs/customization.md).\n\n### One theme, yours\n\n`ThemeProvider` provides exactly one theme - the built-in dark theme when you pass nothing. Bring one theme, or as many as you like: switching between them is your state, not the provider's.\n\n```tsx\nimport { ThemeProvider } from '@soroush.tech/design-system/theme'\nimport { baseTheme, createTheme } from '@soroush.tech/design-system/theme'\n\n// Zero-config: the built-in `baseTheme`.\n<ThemeProvider>{app}</ThemeProvider>\n\n// Your theme - written from scratch or extended from the base.\nconst brand = createTheme(baseTheme, { palette: { primary: { main: '#00ff88' } } })\n<ThemeProvider theme={brand}>{app}</ThemeProvider>\n\n// Mode switching is app policy - own the state and pass the active theme:\nconst [isDark, setIsDark] = useState(true)\n<ThemeProvider theme={isDark ? brandDark : brandLight}>{app}</ThemeProvider>\n```\n\n`createTheme(base, overrides)` (exported from `@soroush.tech/design-system/theme`) is the merge primitive: plain objects recurse, arrays (`shadows`, `fontSizes`) and functions replace wholesale, `undefined` values are ignored - keys are added or replaced, never removed.\n\n### Breakpoints and layout\n\n`theme.breakpoints` are Material 3's window classes, each a range from its start until the next:\n`xs` 0-599px (compact, the base), `sm` 600-839 (medium), `md` 840-1199 (expanded), `lg`\n1200-1599 (large), `xl` 1600+ (extra-large). Responsive props use them by name or position -\n`p={{ xs: 2, md: 4 }}`, `p={[2, 3, 4]}` - and `cqSm`-style keys write container queries;\n`theme.breakpoints.up('md')` and its siblings write queries for hand-written styles. Everything is\nCSS, so pages work with JavaScript off. `theme.layout` holds the layout tokens per class (columns,\nmargins, gutters, side panels, top bar); `Grid` and `Flex` apply the column grid with\n`layout` / `layout={{ lg: { columns: 16 } }}`, and apps place `AppBar`, `Sidebar` and `Drawer`\nthemselves. The full guide is the\n[Breakpoints and layout](./docs/theming.md#breakpoints-and-layout) section of the theming guide.\n\n### Component defaults\n\nComponents carry visible literal fallbacks (`size = 'md'`, `variant = 'outside'`, ...) resolved through `themeDefault(theme, key, fallback)` - so every default, including behavioral variants, is overridable via the optional `theme.defaults` map or the provider's `defaults` prop:\n\n| Key | Fallback | Drives |\n| -------------------------------------------- | ---------------------------------- | -------------------------------------- |\n| `size` / `compactSize` | `'md'` / `'sm'` | sized components / dense table actions |\n| `color` / `neutralColor` | `'primary'` / `'default'` | accent controls / toggle controls |\n| `textColor` / `accentTextColor` | `'initial'` / `'primary'` | body text / icons + input labels |\n| `bg` / `surfaceBg` / `inputBg` | `'default'`/`'paper'`/`'terminal'` | switch track / paper surfaces / inputs |\n| `borderRadius` / `surfaceRadius` | `'md'` / `'sq'` | grouped controls / surfaces |\n| `avatarSize` / `borderColor` / `borderWidth` | `'md'` / `'primary'` / `'thin'` | avatars and rings |\n| `iconSize` | `'lg'` | Icon default glyph size (`theme.icon`) |\n| `inputMinWidth` | `'12rem'` | least width of an input not full width |\n| `buttonVariant` / `switchVariant` | `'contained'` / `'outside'` | Button / Switch visual variants |\n| `inputVariant` | `'default'` | TextInput, Select, NativeSelect frames |\n| `avatarVariant` / `cardVariant` | `'circular'` / `'paper'` | Avatar shape / Card treatment |\n| `linkUnderline` | `'always'` | Link underline behavior |\n| `paginationVariant` / `paginationShape` | `'text'` / `'circular'` | Pagination items |\n\nThe built-in themes carry no `defaults` - the literals apply. A theme with entirely different size or palette keys stays valid by pointing the keys at its own tokens:\n\n```tsx\n<ThemeProvider defaults={{ size: 'compact', color: 'brand', switchVariant: 'inside' }}>\n```\n\n### Per-component customization (`theme.components`)\n\nCustomize one component for the whole app - default prop values, per-slot CSS, and new variant values - without wrapping or forking:\n\n```tsx\nconst brand = createTheme(baseTheme, {\n components: {\n Button: {\n // Buttons default to sm + rounded; explicit props and ButtonGroup still win.\n defaultProps: { size: 'sm', shape: 'rounded' },\n\n // Per-slot CSS merged after Button's own styles - the theme wins the cascade,\n // but per-instance props (m, p, width, ...) still beat the theme.\n styleOverrides: {\n root: ({ theme, ownerState }) => ({\n letterSpacing: theme.letterSpacings.wide,\n ...(ownerState.variant === 'contained' && { textTransform: 'none' }),\n }),\n label: { fontStyle: 'italic' },\n },\n\n // A new variant value - register it first so it typechecks:\n // declare module '@soroush.tech/design-system/theme' { interface ButtonVariants { dashed: true } }\n variants: [\n {\n props: { variant: 'dashed' },\n style: ({ theme }) => ({\n backgroundColor: 'transparent',\n border: `${theme.borderWidths.thin} dashed ${theme.border.primary}`,\n }),\n },\n ],\n },\n },\n})\n```\n\nStyle callbacks receive `{ theme, ownerState }`, where `ownerState` is the styled root's **resolved** props (after group context, `defaultProps`, and `theme.defaults`). `defaultProps` sits in the standard precedence chain: explicit prop → group context → `defaultProps` → `theme.defaults.*` → the component's literal fallback. `variants` arrays are replaced wholesale by `createTheme`, never merged.\n\nYour own components can join the same mechanism: create their roots with this package's `styled(tag, { name: 'MyWidget', slot: 'root' })` and register the name by augmenting `ThemeComponents`. Zero-config themes pay nothing - the resolver bails out on the first check when `theme.components` is absent.\n\n### Extending tokens (declaration merging)\n\nEvery scale is an open interface declared on `@soroush.tech/design-system/theme`, so you can add palette colors, tokens, or whole scales - and every component prop union (`color`, `bg`, `size`, ...) widens automatically:\n\n```ts\nimport type { PaletteEntry } from '@soroush.tech/design-system/theme'\n\ndeclare module '@soroush.tech/design-system/theme' {\n interface ThemePalette {\n brand: PaletteEntry // new palette color\n }\n interface ThemeBackground {\n tertiary: string // new background token\n }\n interface Theme {\n elevations: Record<'low' | 'mid' | 'high', string> // whole new scale\n }\n}\n```\n\nThen supply the values with `createTheme` and use the new keys:\n\n```tsx\nconst brandDark = createTheme(baseTheme, {\n palette: { brand: { main: '#00ff88', light: '#66ffb2', dark: '#00b25f', contrastText: '#000' } },\n background: { tertiary: '#101418' },\n elevations: { low: '0 1px 2px', mid: '0 2px 6px', high: '0 6px 18px' },\n})\n\n<ThemeProvider theme={brandDark}>\n <Button color=\"brand\" />\n <View bg=\"tertiary\" />\n</ThemeProvider>\n```\n\nNotes: new object-valued keys (like a `PaletteEntry`) must be supplied complete - components read `.main`/`.contrastText` at runtime; and TypeScript cannot verify at runtime that an augmented token was actually supplied, so always pair an augmentation with the matching override.\n\n---\n\n## Adding a component\n\nScaffold with the skill - it reads the live `Typography` files and `design-system.md` so output matches the codebase:\n\n```\n/new_theme_component ComponentName\n```\n\nThen work through the checklist at the bottom of [`design-system.md`](./design-system.md).\n\n---\n\nThe library takes inspiration from [Material UI](https://mui.com/) - its component vocabulary and prop conventions will feel familiar - but it is written entirely in house. It is not a clone or a fork: every component is built from scratch on our own engine and token system, and the API is free to diverge wherever it serves its consumers better.\n\n---\n\n## Release notes\n\nPer-version notes for every published release live in\n[`release-notes/`](https://github.com/soroush-tech/design-system/tree/main/packages/design-system/release-notes).\n",
1377
1377
  "url": "https://docs.soroush.tech/design-system/"
1378
1378
  },
1379
1379
  {