datocms-react-ui 2.1.5 → 2.2.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/cjs/Button/styles.module.css.json +1 -1
  2. package/dist/cjs/ButtonGroup/Button/styles.module.css.json +1 -1
  3. package/dist/cjs/ButtonGroup/Group/styles.module.css.json +1 -1
  4. package/dist/cjs/Canvas/index.js +529 -470
  5. package/dist/cjs/Canvas/index.js.map +1 -1
  6. package/dist/cjs/Canvas/styles.module.css.json +1 -1
  7. package/dist/cjs/ContextInspector/styles.module.css.json +1 -1
  8. package/dist/cjs/Dropdown/styles.module.css.json +1 -1
  9. package/dist/cjs/FieldError/styles.module.css.json +1 -1
  10. package/dist/cjs/FieldHint/styles.module.css.json +1 -1
  11. package/dist/cjs/FormLabel/styles.module.css.json +1 -1
  12. package/dist/cjs/HotKey/styles.module.css.json +1 -1
  13. package/dist/cjs/Section/index.js +7 -6
  14. package/dist/cjs/Section/index.js.map +1 -1
  15. package/dist/cjs/Section/styles.module.css.json +1 -1
  16. package/dist/cjs/SelectInput/index.js +41 -22
  17. package/dist/cjs/SelectInput/index.js.map +1 -1
  18. package/dist/cjs/SidebarPanel/index.js +4 -11
  19. package/dist/cjs/SidebarPanel/index.js.map +1 -1
  20. package/dist/cjs/SidebarPanel/styles.module.css.json +1 -1
  21. package/dist/cjs/Spinner/styles.module.css.json +1 -1
  22. package/dist/cjs/SplitView/SplitViewSash/styles.module.css.json +1 -1
  23. package/dist/cjs/SwitchField/styles.module.css.json +1 -1
  24. package/dist/cjs/SwitchInput/styles.module.css.json +1 -1
  25. package/dist/cjs/TextInput/styles.module.css.json +1 -1
  26. package/dist/cjs/TextareaInput/styles.module.css.json +1 -1
  27. package/dist/cjs/Toolbar/Button/styles.module.css.json +1 -1
  28. package/dist/cjs/Toolbar/Toolbar/index.js +3 -3
  29. package/dist/cjs/Toolbar/Toolbar/styles.module.css.json +1 -1
  30. package/dist/cjs/Tooltip/TooltipContent/styles.module.css.json +1 -1
  31. package/dist/cjs/Tooltip/TooltipDelayGroup/index.js +2 -2
  32. package/dist/cjs/VerticalSplit/index.js +4 -4
  33. package/dist/cjs/VerticalSplit/styles.module.css.json +1 -1
  34. package/dist/cjs/generateStyleFromCtx/index.js +2 -2
  35. package/dist/cjs/generateStyleFromCtx/index.js.map +1 -1
  36. package/dist/cjs/icons.js +8 -8
  37. package/dist/cjs/icons.js.map +1 -1
  38. package/dist/esm/Button/styles.module.css.json +1 -1
  39. package/dist/esm/ButtonGroup/Button/styles.module.css.json +1 -1
  40. package/dist/esm/ButtonGroup/Group/styles.module.css.json +1 -1
  41. package/dist/esm/Canvas/index.d.ts +507 -470
  42. package/dist/esm/Canvas/index.js +529 -470
  43. package/dist/esm/Canvas/index.js.map +1 -1
  44. package/dist/esm/Canvas/styles.module.css.json +1 -1
  45. package/dist/esm/ContextInspector/styles.module.css.json +1 -1
  46. package/dist/esm/Dropdown/styles.module.css.json +1 -1
  47. package/dist/esm/FieldError/styles.module.css.json +1 -1
  48. package/dist/esm/FieldHint/styles.module.css.json +1 -1
  49. package/dist/esm/FormLabel/styles.module.css.json +1 -1
  50. package/dist/esm/HotKey/styles.module.css.json +1 -1
  51. package/dist/esm/Section/index.js +7 -6
  52. package/dist/esm/Section/index.js.map +1 -1
  53. package/dist/esm/Section/styles.module.css.json +1 -1
  54. package/dist/esm/SelectInput/index.js +41 -22
  55. package/dist/esm/SelectInput/index.js.map +1 -1
  56. package/dist/esm/SidebarPanel/index.d.ts +2 -2
  57. package/dist/esm/SidebarPanel/index.js +4 -11
  58. package/dist/esm/SidebarPanel/index.js.map +1 -1
  59. package/dist/esm/SidebarPanel/styles.module.css.json +1 -1
  60. package/dist/esm/Spinner/styles.module.css.json +1 -1
  61. package/dist/esm/SplitView/SplitViewSash/styles.module.css.json +1 -1
  62. package/dist/esm/SwitchField/styles.module.css.json +1 -1
  63. package/dist/esm/SwitchInput/styles.module.css.json +1 -1
  64. package/dist/esm/TextInput/styles.module.css.json +1 -1
  65. package/dist/esm/TextareaInput/styles.module.css.json +1 -1
  66. package/dist/esm/Toolbar/Button/styles.module.css.json +1 -1
  67. package/dist/esm/Toolbar/Toolbar/index.d.ts +3 -3
  68. package/dist/esm/Toolbar/Toolbar/index.js +3 -3
  69. package/dist/esm/Toolbar/Toolbar/styles.module.css.json +1 -1
  70. package/dist/esm/Tooltip/TooltipContent/styles.module.css.json +1 -1
  71. package/dist/esm/Tooltip/TooltipDelayGroup/index.d.ts +2 -2
  72. package/dist/esm/Tooltip/TooltipDelayGroup/index.js +2 -2
  73. package/dist/esm/VerticalSplit/index.d.ts +4 -4
  74. package/dist/esm/VerticalSplit/index.js +4 -4
  75. package/dist/esm/VerticalSplit/styles.module.css.json +1 -1
  76. package/dist/esm/generateStyleFromCtx/index.d.ts +1 -1
  77. package/dist/esm/generateStyleFromCtx/index.js +2 -2
  78. package/dist/esm/generateStyleFromCtx/index.js.map +1 -1
  79. package/dist/esm/icons.js +8 -8
  80. package/dist/esm/icons.js.map +1 -1
  81. package/dist/types/Canvas/index.d.ts +507 -470
  82. package/dist/types/SidebarPanel/index.d.ts +2 -2
  83. package/dist/types/Toolbar/Toolbar/index.d.ts +3 -3
  84. package/dist/types/Tooltip/TooltipDelayGroup/index.d.ts +2 -2
  85. package/dist/types/VerticalSplit/index.d.ts +4 -4
  86. package/dist/types/generateStyleFromCtx/index.d.ts +1 -1
  87. package/package.json +3 -3
  88. package/src/Button/styles.module.css +28 -19
  89. package/src/Button/styles.module.css.json +1 -1
  90. package/src/ButtonGroup/Button/styles.module.css +13 -17
  91. package/src/ButtonGroup/Button/styles.module.css.json +1 -1
  92. package/src/ButtonGroup/Group/styles.module.css +1 -1
  93. package/src/ButtonGroup/Group/styles.module.css.json +1 -1
  94. package/src/Canvas/index.tsx +532 -470
  95. package/src/Canvas/styles.module.css +32 -16
  96. package/src/Canvas/styles.module.css.json +1 -1
  97. package/src/ContextInspector/styles.module.css +10 -10
  98. package/src/ContextInspector/styles.module.css.json +1 -1
  99. package/src/Dropdown/styles.module.css +30 -28
  100. package/src/Dropdown/styles.module.css.json +1 -1
  101. package/src/FieldError/styles.module.css +1 -1
  102. package/src/FieldError/styles.module.css.json +1 -1
  103. package/src/FieldHint/styles.module.css +1 -1
  104. package/src/FieldHint/styles.module.css.json +1 -1
  105. package/src/FormLabel/styles.module.css +2 -2
  106. package/src/FormLabel/styles.module.css.json +1 -1
  107. package/src/HotKey/styles.module.css +1 -1
  108. package/src/HotKey/styles.module.css.json +1 -1
  109. package/src/Section/index.tsx +17 -16
  110. package/src/Section/styles.module.css +41 -35
  111. package/src/Section/styles.module.css.json +1 -1
  112. package/src/SelectInput/index.tsx +55 -27
  113. package/src/SidebarPanel/index.tsx +4 -29
  114. package/src/SidebarPanel/styles.module.css +5 -6
  115. package/src/SidebarPanel/styles.module.css.json +1 -1
  116. package/src/Spinner/styles.module.css +1 -1
  117. package/src/Spinner/styles.module.css.json +1 -1
  118. package/src/SplitView/SplitViewSash/styles.module.css +7 -7
  119. package/src/SplitView/SplitViewSash/styles.module.css.json +1 -1
  120. package/src/SwitchField/styles.module.css +1 -1
  121. package/src/SwitchField/styles.module.css.json +1 -1
  122. package/src/SwitchInput/styles.module.css +15 -13
  123. package/src/SwitchInput/styles.module.css.json +1 -1
  124. package/src/TextInput/styles.module.css +13 -11
  125. package/src/TextInput/styles.module.css.json +1 -1
  126. package/src/TextareaInput/styles.module.css +13 -11
  127. package/src/TextareaInput/styles.module.css.json +1 -1
  128. package/src/Toolbar/Badge/styles.module.css.json +5 -0
  129. package/src/Toolbar/Button/styles.module.css +4 -4
  130. package/src/Toolbar/Button/styles.module.css.json +1 -1
  131. package/src/Toolbar/DotsDropdown/styles.module.css.json +4 -0
  132. package/src/Toolbar/GoBack/styles.module.css.json +1 -0
  133. package/src/Toolbar/Pagination/styles.module.css.json +1 -0
  134. package/src/Toolbar/PrimaryButton/styles.module.css.json +5 -0
  135. package/src/Toolbar/Space/styles.module.css.json +1 -0
  136. package/src/Toolbar/Subtitle/styles.module.css.json +1 -0
  137. package/src/Toolbar/Toolbar/index.tsx +3 -3
  138. package/src/Toolbar/Toolbar/styles.module.css +2 -2
  139. package/src/Toolbar/Toolbar/styles.module.css.json +1 -1
  140. package/src/Tooltip/TooltipContent/styles.module.css +3 -2
  141. package/src/Tooltip/TooltipContent/styles.module.css.json +1 -1
  142. package/src/Tooltip/TooltipDelayGroup/index.tsx +2 -2
  143. package/src/VerticalSplit/index.tsx +4 -4
  144. package/src/VerticalSplit/styles.module.css +8 -11
  145. package/src/VerticalSplit/styles.module.css.json +1 -1
  146. package/src/base.css +17 -0
  147. package/src/generateStyleFromCtx/index.ts +7 -1
  148. package/src/icons.tsx +8 -0
  149. package/styles.css +1 -1
  150. package/types.json +601 -395
@@ -34,494 +34,531 @@ export type CanvasProps = {
34
34
  };
35
35
 
36
36
  /**
37
- * @example Color palette CSS variables
37
+ * @example Colors
38
38
  *
39
- * Within the `Canvas` component, a color palette is made available as a set of
40
- * CSS variables, allowing you to conform to the theme of the current
41
- * environment:
39
+ * A full semantic color palette is exposed inside `Canvas` as `--color--*` CSS variables.
40
+ *
41
+ * Regarding dark mode, `ctx.colorScheme` resolves to `'light'` or `'dark'`. The SDK runtime also sets `data-color-scheme` on `<html>` so selectors like `[data-color-scheme="dark"] {…}` work out of the box.
42
+ *
43
+ * #### Token name shape
44
+ *
45
+ * Tokens follow one of two name shapes:
46
+ *
47
+ * | Shape | Meaning |
48
+ * | --- | --- |
49
+ * | `--color--{property}` | standalone (one `--` after color) |
50
+ * | `--color--{context}--{property}` | context pair (two `--` after color) |
51
+ *
52
+ * **Properties** are the role a color plays:
53
+ *
54
+ * | Property | Role |
55
+ * | --- | --- |
56
+ * | `surface` | backgrounds |
57
+ * | `ink` | text and icons |
58
+ * | `border` | 1px lines |
59
+ * | `outline` | focus rings and block-level rings |
60
+ * | `fill` / `track` | indicator fills and their backgrounds |
61
+ *
62
+ * **Standalone tokens** are for neutral page chrome; use them by default. Elevated neutral surfaces (modals, dropdowns, popovers) are standalone too, with hover and active variants for the raised layer. Pair them with the standalone ink tokens.
63
+ *
64
+ * **Context tokens** describe a self-contained mini-environment (a primary CTA, a danger button). Contexts come in two shapes:
65
+ *
66
+ * 1. **Ink-owning contexts**: signal contexts (primary, primary-soft, danger, danger-soft, warning-soft, success-soft, selected) and dark/inverted elevation contexts (overlay, backdrop, stacked, tooltip, code). Each defines an ink balanced on its own surface, so always pair surface and ink from the *same* context.
67
+ * 2. **Single-property contexts**: focus (outline/border), progress (fill/track), highlight (surface), scrollbar (fill). Not surface+ink environments; the pairing rule doesn't apply.
68
+ *
69
+ * > [!WARNING] Never cross ink-owning contexts
70
+ * > Don't put a primary ink on a danger surface, or a danger-soft surface under a warning-soft ink. Each ink-owning context is contrast-balanced as a unit, and mixing produces illegible combinations, especially in dark mode.
71
+ *
72
+ * #### Defining custom colors
73
+ *
74
+ * Reserve custom colors for things genuinely outside the design system, such as brand illustrations, data-viz palettes, vendor-specific UI. Most needs ("primary button color", "error state") are already covered by tokens. When a custom color is justified, define it once per theme using the `[data-color-scheme="dark"]` selector that the SDK already sets:
75
+ *
76
+ * ```css
77
+ * .my-plugin {
78
+ * --my-brand: #4a90e2;
79
+ * }
80
+ *
81
+ * [data-color-scheme="dark"] .my-plugin {
82
+ * --my-brand: #6aa9ec;
83
+ * }
84
+ *
85
+ * .my-plugin__cta {
86
+ * background: var(--my-brand);
87
+ * color: var(--color--primary--ink);
88
+ * }
89
+ * ```
90
+ *
91
+ * For non-CSS branching (image sources, third-party widget themes, syntax-highlighting presets), branch on `ctx.colorScheme` directly, e.g. `<img src={ctx.colorScheme === 'dark' ? logoDark : logoLight} />`. On modern browsers, the CSS `light-dark()` function is a more concise alternative to the per-theme variable pattern above.
92
+ *
93
+ * #### Available tokens
94
+ *
95
+ * A swatch for every available token, grouped by context.
96
+ *
97
+ * ```js
98
+ * <Canvas ctx={ctx}>
99
+ * <div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--spacing-l)' }}>
100
+ * <StateManager initial={true}>
101
+ * {(isOpen, setOpen) => (
102
+ * <Section
103
+ * title="Standalone"
104
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
105
+ * >
106
+ * <p>
107
+ * One-level tokens that work on any neutral page. The <code>surface</code>, <code>ink</code> and <code>border</code> families cover the page background, body text and dividers; the <code>surface-raised</code> variants belong to the elevated layer used by modals, dropdowns and popovers. The tone-on-neutral inks (<code>ink-danger</code>, <code>ink-warning</code>, <code>ink-success</code>) color text and icons on a neutral surface; inside a toned panel use that context's own ink instead.
108
+ * </p>
109
+ * <Swatches
110
+ * tokens={[
111
+ * ['--color--surface', 'Page background everything else sits on'],
112
+ * ['--color--surface-hover', 'Hovered row inside lists and tables'],
113
+ * ['--color--surface-muted', 'Background of muted section panels and quiet cards'],
114
+ * ['--color--surface-raised', 'Elevated layer for modals, dropdowns and popovers'],
115
+ * ['--color--surface-raised-hover', 'Hovered option inside a dropdown menu'],
116
+ * ['--color--surface-raised-active', 'Focused or pressed option inside a dropdown menu'],
117
+ * ['--color--ink', 'Primary body text'],
118
+ * ['--color--ink-subtle', 'Secondary text, captions, helper labels'],
119
+ * ['--color--ink-hover', 'Toolbar icon and link fill on hover'],
120
+ * ['--color--ink-muted', 'Deemphasized text that should recede'],
121
+ * ['--color--ink-placeholder', 'Empty-input placeholder text'],
122
+ * ['--color--ink-primary', 'Theme-colored text and icons for branded labels'],
123
+ * ['--color--ink-link', 'Inline links and accent text'],
124
+ * ['--color--ink-danger', 'Error text or icon on a neutral surface'],
125
+ * ['--color--ink-warning', 'Warning text or icon on a neutral surface'],
126
+ * ['--color--ink-success', 'Success text or icon on a neutral surface'],
127
+ * ['--color--ink-disabled', 'Label color on disabled inputs and buttons'],
128
+ * ['--color--border', 'Default 1px divider between cards, rows and sections'],
129
+ * ['--color--border-hover', 'Border of an input or card when hovered'],
130
+ * ]}
131
+ * />
132
+ * </Section>
133
+ * )}
134
+ * </StateManager>
135
+ *
136
+ * <StateManager initial={false}>
137
+ * {(isOpen, setOpen) => (
138
+ * <Section
139
+ * title="Context: primary"
140
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
141
+ * >
142
+ * <p>
143
+ * The project's brand hue (the color the user picked for their DatoCMS project) at full strength. Reach for it on the main call-to-action button on a page, and on badges or navigation bars that need to stand out. The <code>surface-secondary</code> variant is a quieter brand surface step (for accent badges and inline action chips) that keeps the same white <code>ink</code>.
144
+ * </p>
145
+ * <Swatches
146
+ * tokens={[
147
+ * ['--color--primary--surface', 'Resting background of a primary call-to-action button'],
148
+ * ['--color--primary--surface-hover', 'Hovered primary button background'],
149
+ * ['--color--primary--surface-active', 'Pressed primary button background'],
150
+ * ['--color--primary--surface-muted', 'Muted variant of the primary surface'],
151
+ * ['--color--primary--surface-secondary', 'Quieter brand surface for accent badges and inline chips'],
152
+ * ['--color--primary--ink', 'Text and icon color sitting on any primary surface'],
153
+ * ['--color--primary--border', 'Thin border drawn on top of a primary surface'],
154
+ * ]}
155
+ * />
156
+ * </Section>
157
+ * )}
158
+ * </StateManager>
159
+ *
160
+ * <StateManager initial={false}>
161
+ * {(isOpen, setOpen) => (
162
+ * <Section
163
+ * title="Context: primary-soft"
164
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
165
+ * >
166
+ * <p>
167
+ * A soft panel in the same project brand hue: a pale brand surface paired with saturated brand ink. Quieter than primary, still clearly on-brand, for secondary actions, chips and tinted callouts.
168
+ * </p>
169
+ * <Swatches
170
+ * tokens={[
171
+ * ['--color--primary-soft--surface', 'Resting background of secondary brand-tinted buttons'],
172
+ * ['--color--primary-soft--surface-hover', 'Hovered tinted button background'],
173
+ * ['--color--primary-soft--surface-active', 'Pressed tinted button background'],
174
+ * ['--color--primary-soft--ink', 'Text and icon color on a soft brand surface'],
175
+ * ['--color--primary-soft--border', 'Thin border drawn on top of a soft brand surface'],
176
+ * ]}
177
+ * />
178
+ * </Section>
179
+ * )}
180
+ * </StateManager>
181
+ *
182
+ * <StateManager initial={false}>
183
+ * {(isOpen, setOpen) => (
184
+ * <Section
185
+ * title="Context: selected"
186
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
187
+ * >
188
+ * <p>
189
+ * The active selection state: the highlighted entry in a list or tree, the currently picked option in a radio or choice group, the chosen card in a gallery.
190
+ * </p>
191
+ * <Swatches
192
+ * tokens={[
193
+ * ['--color--selected--surface', 'Background of the currently active entry in a list or tree'],
194
+ * ['--color--selected--surface-hover', 'Hover on an entry that is already selected'],
195
+ * ['--color--selected--ink', 'Text and icon color inside the selected entry'],
196
+ * ['--color--selected--border', 'Border or outline ring drawn around a selected option or card'],
197
+ * ]}
198
+ * />
199
+ * </Section>
200
+ * )}
201
+ * </StateManager>
202
+ *
203
+ * <StateManager initial={false}>
204
+ * {(isOpen, setOpen) => (
205
+ * <Section
206
+ * title="Context: disabled"
207
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
208
+ * >
209
+ * <p>
210
+ * The flat, low-contrast pair applied to non-interactive controls: disabled buttons, disabled selects and disabled toggles.
211
+ * </p>
212
+ * <PairSwatches
213
+ * tokens={[
214
+ * ['--color--disabled--surface', '--color--disabled--ink', 'Disabled button or control: muted background with low-contrast label'],
215
+ * ]}
216
+ * />
217
+ * </Section>
218
+ * )}
219
+ * </StateManager>
220
+ *
221
+ * <StateManager initial={false}>
222
+ * {(isOpen, setOpen) => (
223
+ * <Section
224
+ * title="Context: danger"
225
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
226
+ * >
227
+ * <p>
228
+ * Reserved for destructive actions, such as Delete, Remove or Reset operations.
229
+ * </p>
230
+ * <PairSwatches
231
+ * tokens={[
232
+ * ['--color--danger--surface', '--color--danger--ink', 'Destructive action button: vivid red surface with white label'],
233
+ * ]}
234
+ * />
235
+ * </Section>
236
+ * )}
237
+ * </StateManager>
238
+ *
239
+ * <StateManager initial={false}>
240
+ * {(isOpen, setOpen) => (
241
+ * <Section
242
+ * title="Context: focus"
243
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
244
+ * >
245
+ * <p>
246
+ * The keyboard-focus ring drawn around inputs, buttons and any other focusable control. Pair <code>border</code> on the element itself with <code>outline</code> as a soft halo.
247
+ * </p>
248
+ * <Swatches
249
+ * tokens={[
250
+ * ['--color--focus--border', 'Border color of the focused element'],
251
+ * ['--color--focus--outline', 'Soft outline ring drawn around the focused element'],
252
+ * ]}
253
+ * />
254
+ * </Section>
255
+ * )}
256
+ * </StateManager>
257
+ *
258
+ * <StateManager initial={false}>
259
+ * {(isOpen, setOpen) => (
260
+ * <Section
261
+ * title="Signal tones"
262
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
263
+ * >
264
+ * <p>
265
+ * Soft panels for validation states and notifications: red for failures, amber for warnings, green for successes. Each <code>-soft</code> context is a pale surface paired with saturated ink, following the same four-property shape (surface, ink, border, outline), so you can swap the tone without touching layout. For a colored message on a plain neutral surface, reach for the standalone <code>ink-danger</code>, <code>ink-warning</code> and <code>ink-success</code> instead.
266
+ * </p>
267
+ * <Swatches
268
+ * tokens={[
269
+ * ['--color--danger-soft--surface', 'Background of error banners and alert toasts'],
270
+ * ['--color--danger-soft--ink', 'Error message text and the icon inside an error panel'],
271
+ * ['--color--danger-soft--border', 'Border around an invalid input or alert toast'],
272
+ * ['--color--danger-soft--outline', 'Soft halo around an invalid field on focus'],
273
+ * ['--color--warning-soft--surface', 'Background of warning banners and plugin notices'],
274
+ * ['--color--warning-soft--ink', 'Text inside warning banners and warning toasts'],
275
+ * ['--color--warning-soft--border', 'Border around warning banners and modified-state pills'],
276
+ * ['--color--warning-soft--outline', 'Soft halo for warning emphasis'],
277
+ * ['--color--success-soft--surface', 'Background of success toasts'],
278
+ * ['--color--success-soft--ink', 'Text inside success toasts and success banners'],
279
+ * ['--color--success-soft--border', 'Border around success banners'],
280
+ * ['--color--success-soft--outline', 'Soft halo for success emphasis'],
281
+ * ]}
282
+ * />
283
+ * </Section>
284
+ * )}
285
+ * </StateManager>
286
+ *
287
+ * <StateManager initial={false}>
288
+ * {(isOpen, setOpen) => (
289
+ * <Section
290
+ * title="Context: highlight"
291
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
292
+ * >
293
+ * <p>
294
+ * The yellow marker pen for inline rich-text highlights inside Structured Text editors.
295
+ * </p>
296
+ * <Swatches
297
+ * tokens={[
298
+ * ['--color--highlight--surface', 'Background of a highlighted span inside a rich text editor'],
299
+ * ]}
300
+ * />
301
+ * </Section>
302
+ * )}
303
+ * </StateManager>
304
+ *
305
+ * <StateManager initial={false}>
306
+ * {(isOpen, setOpen) => (
307
+ * <Section
308
+ * title="Diffs"
309
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
310
+ * >
311
+ * <p>
312
+ * Content-versioning palette across three intents: green for added, red for removed, blue for changed. Inline text diffs use the surface tint; block-level revision panels use the outline. For positive/negative rule indicators, the left-border tone depends on whether the rule was just edited: a subtle ink when stable, a vivid one when freshly changed. The changed variant has no ink stops, since rule borders are only ever green or red.
313
+ * </p>
314
+ * <Swatches
315
+ * tokens={[
316
+ * ['--color--diff-added--surface', 'Background of inline added text inside a text diff'],
317
+ * ['--color--diff-added--outline', 'Outline drawn around a block-level added revision panel'],
318
+ * ['--color--diff-added--ink', 'Left-border color of a positive rule when it was recently changed (vivid)'],
319
+ * ['--color--diff-added--ink-subtle', 'Left-border color of a positive rule when it was not recently changed'],
320
+ * ['--color--diff-removed--surface', 'Background of inline removed text inside a text diff'],
321
+ * ['--color--diff-removed--outline', 'Outline drawn around a block-level removed revision panel'],
322
+ * ['--color--diff-removed--ink', 'Left-border color of a negative rule when it was recently changed (vivid)'],
323
+ * ['--color--diff-removed--ink-subtle', 'Left-border color of a negative rule when it was not recently changed'],
324
+ * ['--color--diff-changed--surface', 'Background of inline changed text inside a text diff'],
325
+ * ['--color--diff-changed--outline', 'Outline drawn around a block-level changed revision panel'],
326
+ * ]}
327
+ * />
328
+ * </Section>
329
+ * )}
330
+ * </StateManager>
331
+ *
332
+ * <StateManager initial={false}>
333
+ * {(isOpen, setOpen) => (
334
+ * <Section
335
+ * title="Status"
336
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
337
+ * >
338
+ * <p>
339
+ * Publishing-workflow status dots. Ink-only because the colored dot is the whole marker, no surface or border needed.
340
+ * </p>
341
+ * <Swatches
342
+ * tokens={[
343
+ * ['--color--status-draft--ink', 'Dot color for records that exist only as a draft'],
344
+ * ['--color--status-outdated--ink', 'Dot color for published records with unpublished changes'],
345
+ * ['--color--status-published--ink', 'Dot color for fully published records'],
346
+ * ]}
347
+ * />
348
+ * </Section>
349
+ * )}
350
+ * </StateManager>
351
+ *
352
+ * <StateManager initial={false}>
353
+ * {(isOpen, setOpen) => (
354
+ * <Section
355
+ * title="Backdrop and overlay"
356
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
357
+ * >
358
+ * <p>
359
+ * Two scrims for two jobs. The backdrop is the full-screen dim painted behind a modal dialog. The overlay is the lighter scrim that sits on top of media or thumbnails and hosts reversed buttons designed to read against dark imagery.
360
+ * </p>
361
+ * <PairSwatches
362
+ * tokens={[
363
+ * ['--color--backdrop--surface', '--color--backdrop--ink', 'Full-screen modal dim with icon color for close controls'],
364
+ * ]}
365
+ * />
366
+ * <Swatches
367
+ * tokens={[
368
+ * ['--color--overlay--surface', 'Scrim painted over media thumbnails and image cards'],
369
+ * ['--color--overlay--surface-hover', 'Hover background of a reversed button floating on dark media'],
370
+ * ['--color--overlay--surface-active', 'Pressed background of a reversed button on dark media'],
371
+ * ['--color--overlay--ink', 'Text and icon color inside reversed buttons on overlay surfaces'],
372
+ * ]}
373
+ * />
374
+ * </Section>
375
+ * )}
376
+ * </StateManager>
377
+ *
378
+ * <StateManager initial={false}>
379
+ * {(isOpen, setOpen) => (
380
+ * <Section
381
+ * title="Stacked"
382
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
383
+ * >
384
+ * <p>
385
+ * Layered dark inline areas, the kind used for asset uploaders and audio/video players. The wrapper paints the base surface; an inner detail panel sits a layer up; transparent action buttons gain visibility on hover and press.
386
+ * </p>
387
+ * <Swatches
388
+ * tokens={[
389
+ * ['--color--stacked--surface', 'Base layer of a dark inline panel'],
390
+ * ['--color--stacked--surface-upper', 'Inner detail panel sitting one layer above the base'],
391
+ * ['--color--stacked--surface-action', 'Resting background of action buttons inside a stacked panel (transparent)'],
392
+ * ['--color--stacked--surface-action-hover', 'Hovered action button inside a stacked panel'],
393
+ * ['--color--stacked--surface-action-active', 'Pressed action button inside a stacked panel'],
394
+ * ['--color--stacked--ink', 'Main text and values on a stacked surface'],
395
+ * ['--color--stacked--ink-subtle', 'Field labels and secondary text on a stacked surface'],
396
+ * ['--color--stacked--border', 'Column rules and dividers inside a stacked panel'],
397
+ * ]}
398
+ * />
399
+ * </Section>
400
+ * )}
401
+ * </StateManager>
402
+ *
403
+ * <StateManager initial={false}>
404
+ * {(isOpen, setOpen) => (
405
+ * <Section
406
+ * title="Progress"
407
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
408
+ * >
409
+ * <p>
410
+ * Horizontal progress bars used to report quota usage, upload advancement and similar percentage indicators.
411
+ * </p>
412
+ * <Swatches
413
+ * tokens={[
414
+ * ['--color--progress--track', 'Empty portion of the bar (the background track)'],
415
+ * ['--color--progress--fill', 'Filled portion of the bar, drawn in the brand color'],
416
+ * ['--color--progress--fill-hover', 'Fill color when the bar is hovered'],
417
+ * ]}
418
+ * />
419
+ * </Section>
420
+ * )}
421
+ * </StateManager>
422
+ *
423
+ * <StateManager initial={false}>
424
+ * {(isOpen, setOpen) => (
425
+ * <Section
426
+ * title="Tooltip"
427
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
428
+ * >
429
+ * <p>
430
+ * Small dark floating labels: the plain tooltip shown on hover, and the keyboard-hint variant that pairs a description with a keyboard shortcut.
431
+ * </p>
432
+ * <Swatches
433
+ * tokens={[
434
+ * ['--color--tooltip--surface', 'Background of standard and keyboard-hint tooltips'],
435
+ * ['--color--tooltip--surface-hover', 'Hover background for interactive controls living inside a tooltip'],
436
+ * ['--color--tooltip--ink', 'Primary text inside a tooltip'],
437
+ * ['--color--tooltip--ink-subtle', 'Secondary text inside a tooltip, e.g. the keyboard shortcut hint'],
438
+ * ]}
439
+ * />
440
+ * </Section>
441
+ * )}
442
+ * </StateManager>
443
+ *
444
+ * <StateManager initial={false}>
445
+ * {(isOpen, setOpen) => (
446
+ * <Section
447
+ * title="Code"
448
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
449
+ * >
450
+ * <p>
451
+ * The dark monospaced surface used by build logs, error traces and other terminal-style output.
452
+ * </p>
453
+ * <PairSwatches
454
+ * tokens={[
455
+ * ['--color--code--surface', '--color--code--ink', 'Dark monospaced surface with its text color'],
456
+ * ]}
457
+ * />
458
+ * </Section>
459
+ * )}
460
+ * </StateManager>
461
+ *
462
+ * <StateManager initial={false}>
463
+ * {(isOpen, setOpen) => (
464
+ * <Section
465
+ * title="Scrollbar"
466
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
467
+ * >
468
+ * <p>
469
+ * Tint applied globally to the native scrollbar thumb. Most visible in Firefox and on systems that keep scrollbars always on.
470
+ * </p>
471
+ * <Swatches
472
+ * tokens={[
473
+ * ['--color--scrollbar--fill', 'Color of the native scrollbar thumb across the whole app'],
474
+ * ]}
475
+ * />
476
+ * </Section>
477
+ * )}
478
+ * </StateManager>
479
+ *
480
+ * <StateManager initial={false}>
481
+ * {(isOpen, setOpen) => (
482
+ * <Section
483
+ * title="Field type groups"
484
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
485
+ * >
486
+ * <p>
487
+ * Fixed-hue soft chips for field type group icons. Each context exposes a <code>surface</code> (chip background) and an <code>ink</code> (icon fill). The hues are not brand-adaptive — they are fixed across projects and automatically flip between a pale surface with saturated ink in light mode and a deep surface with bright ink in dark mode.
488
+ * </p>
489
+ * <PairSwatches
490
+ * tokens={[
491
+ * ['--color--field-group-text--surface', '--color--field-group-text--ink', 'Text / string / structured-text fields'],
492
+ * ['--color--field-group-rich-text--surface', '--color--field-group-rich-text--ink', 'Rich-text and single-block fields'],
493
+ * ['--color--field-group-media--surface', '--color--field-group-media--ink', 'File, gallery and video fields'],
494
+ * ['--color--field-group-datetime--surface', '--color--field-group-datetime--ink', 'Date and date-time fields'],
495
+ * ['--color--field-group-number--surface', '--color--field-group-number--ink', 'Integer and float fields'],
496
+ * ['--color--field-group-boolean--surface', '--color--field-group-boolean--ink', 'Boolean fields'],
497
+ * ['--color--field-group-location--surface', '--color--field-group-location--ink', 'Lat/lon fields'],
498
+ * ['--color--field-group-color--surface', '--color--field-group-color--ink', 'Color fields'],
499
+ * ['--color--field-group-seo--surface', '--color--field-group-seo--ink', 'Slug and SEO fields'],
500
+ * ['--color--field-group-reference--surface', '--color--field-group-reference--ink', 'Link and links fields'],
501
+ * ['--color--field-group-json--surface', '--color--field-group-json--ink', 'JSON fields'],
502
+ * ]}
503
+ * />
504
+ * </Section>
505
+ * )}
506
+ * </StateManager>
507
+ * </div>
508
+ * </Canvas>;
509
+ * ```
510
+ *
511
+ * @example Shadows
512
+ *
513
+ * Four ready-made `box-shadow` composites (raised, floating, lifted, ambient). Drop them straight into a `box-shadow` property.
42
514
  *
43
515
  * ```js
44
516
  * <Canvas ctx={ctx}>
45
- * <Section title="Text colors">
46
- * <table>
47
- * <tbody>
48
- * <tr>
49
- * <td>
50
- * <code>--base-body-color</code>
51
- * </td>
52
- * <td width="30%">
53
- * <div
54
- * style={{
55
- * width: '30px',
56
- * height: '30px',
57
- * background: 'var(--base-body-color)',
58
- * }}
59
- * />
60
- * </td>
61
- * </tr>
62
- * <tr>
63
- * <td>
64
- * <code>--light-body-color</code>
65
- * </td>
66
- * <td width="30%">
67
- * <div
68
- * style={{
69
- * width: '30px',
70
- * height: '30px',
71
- * background: 'var(--light-body-color)',
72
- * }}
73
- * />
74
- * </td>
75
- * </tr>
76
- * <tr>
77
- * <td>
78
- * <code>--placeholder-body-color</code>
79
- * </td>
80
- * <td width="30%">
81
- * <div
82
- * style={{
83
- * width: '30px',
84
- * height: '30px',
85
- * background: 'var(--placeholder-body-color)',
86
- * }}
87
- * />
88
- * </td>
89
- * </tr>
90
- * </tbody>
91
- * </table>
92
- * </Section>
93
- * <Section title="UI colors">
94
- * <table>
95
- * <tbody>
96
- * <tr>
97
- * <td>
98
- * <code>--light-bg-color</code>
99
- * </td>
100
- * <td width="30%">
101
- * <div
102
- * style={{
103
- * width: '30px',
104
- * height: '30px',
105
- * background: 'var(--light-bg-color)',
106
- * }}
107
- * />
108
- * </td>
109
- * </tr>
110
- * <tr>
111
- * <td>
112
- * <code>--lighter-bg-color</code>
113
- * </td>
114
- * <td width="30%">
115
- * <div
116
- * style={{
117
- * width: '30px',
118
- * height: '30px',
119
- * background: 'var(--lighter-bg-color)',
120
- * }}
121
- * />
122
- * </td>
123
- * </tr>
124
- * <tr>
125
- * <td>
126
- * <code>--disabled-bg-color</code>
127
- * </td>
128
- * <td width="30%">
129
- * <div
130
- * style={{
131
- * width: '30px',
132
- * height: '30px',
133
- * background: 'var(--disabled-bg-color)',
134
- * }}
135
- * />
136
- * </td>
137
- * </tr>
138
- * <tr>
139
- * <td>
140
- * <code>--border-color</code>
141
- * </td>
142
- * <td width="30%">
143
- * <div
144
- * style={{
145
- * width: '30px',
146
- * height: '30px',
147
- * background: 'var(--border-color)',
148
- * }}
149
- * />
150
- * </td>
151
- * </tr>
152
- * <tr>
153
- * <td>
154
- * <code>--darker-border-color</code>
155
- * </td>
156
- * <td width="30%">
157
- * <div
158
- * style={{
159
- * width: '30px',
160
- * height: '30px',
161
- * background: 'var(--darker-border-color)',
162
- * }}
163
- * />
164
- * </td>
165
- * </tr>
166
- * <tr>
167
- * <td>
168
- * <code>--alert-color</code>
169
- * </td>
170
- * <td width="30%">
171
- * <div
172
- * style={{
173
- * width: '30px',
174
- * height: '30px',
175
- * background: 'var(--alert-color)',
176
- * }}
177
- * />
178
- * </td>
179
- * </tr>
180
- * <tr>
181
- * <td>
182
- * <code>--warning-color</code>
183
- * </td>
184
- * <td width="30%">
185
- * <div
186
- * style={{
187
- * width: '30px',
188
- * height: '30px',
189
- * background: 'var(--warning-color)',
190
- * }}
191
- * />
192
- * </td>
193
- * </tr>
194
- * <tr>
195
- * <td>
196
- * <code>--notice-color</code>
197
- * </td>
198
- * <td width="30%">
199
- * <div
200
- * style={{
201
- * width: '30px',
202
- * height: '30px',
203
- * background: 'var(--notice-color)',
204
- * }}
205
- * />
206
- * </td>
207
- * </tr>
208
- * <tr>
209
- * <td>
210
- * <code>--warning-bg-color</code>
211
- * </td>
212
- * <td width="30%">
213
- * <div
214
- * style={{
215
- * width: '30px',
216
- * height: '30px',
217
- * background: 'var(--warning-bg-color)',
218
- * }}
219
- * />
220
- * </td>
221
- * </tr>
222
- * <tr>
223
- * <td>
224
- * <code>--add-color</code>
225
- * </td>
226
- * <td width="30%">
227
- * <div
228
- * style={{
229
- * width: '30px',
230
- * height: '30px',
231
- * background: 'var(--add-color)',
232
- * }}
233
- * />
234
- * </td>
235
- * </tr>
236
- * <tr>
237
- * <td>
238
- * <code>--remove-color</code>
239
- * </td>
240
- * <td width="30%">
241
- * <div
242
- * style={{
243
- * width: '30px',
244
- * height: '30px',
245
- * background: 'var(--remove-color)',
246
- * }}
247
- * />
248
- * </td>
249
- * </tr>
250
- * </tbody>
251
- * </table>
252
- * </Section>
253
- * <Section title="Project-specific colors">
254
- * <table>
255
- * <tbody>
256
- * <tr>
257
- * <td>
258
- * <code>--accent-color</code>
259
- * </td>
260
- * <td width="30%">
261
- * <div
262
- * style={{
263
- * width: '30px',
264
- * height: '30px',
265
- * background: 'var(--accent-color)',
266
- * }}
267
- * />
268
- * </td>
269
- * </tr>
270
- * <tr>
271
- * <td>
272
- * <code>--primary-color</code>
273
- * </td>
274
- * <td width="30%">
275
- * <div
276
- * style={{
277
- * width: '30px',
278
- * height: '30px',
279
- * background: 'var(--primary-color)',
280
- * }}
281
- * />
282
- * </td>
283
- * </tr>
284
- * <tr>
285
- * <td>
286
- * <code>--light-color</code>
287
- * </td>
288
- * <td width="30%">
289
- * <div
290
- * style={{
291
- * width: '30px',
292
- * height: '30px',
293
- * background: 'var(--light-color)',
294
- * }}
295
- * />
296
- * </td>
297
- * </tr>
298
- * <tr>
299
- * <td>
300
- * <code>--dark-color</code>
301
- * </td>
302
- * <td width="30%">
303
- * <div
304
- * style={{
305
- * width: '30px',
306
- * height: '30px',
307
- * background: 'var(--dark-color)',
308
- * }}
309
- * />
310
- * </td>
311
- * </tr>
312
- * </tbody>
313
- * </table>
314
- * </Section>
517
+ * <Swatches
518
+ * kind="shadow"
519
+ * tokens={['--shadow--raised', '--shadow--floating', '--shadow--lifted', '--shadow--ambient']}
520
+ * />
315
521
  * </Canvas>;
316
522
  * ```
317
523
  *
318
- * @example Typography CSS variables
524
+ * @example Typography
319
525
  *
320
- * Typography is a foundational element in UI design. Good typography
321
- * establishes a strong, cohesive visual hierarchy and presents content clearly
322
- * and efficiently to users. Within the `Canvas` component, a set of CSS
323
- * variables is available allowing your plugin to conform to the overall
324
- * look&feel of DatoCMS:
526
+ * Typography is a foundational element in UI design. Good typography establishes a strong, cohesive visual hierarchy and presents content clearly and efficiently to users. Within the `Canvas` component, a set of CSS variables is available allowing your plugin to conform to the overall look&feel of DatoCMS:
325
527
  *
326
528
  * ```js
327
529
  * <Canvas ctx={ctx}>
328
- * <table>
329
- * <tbody>
330
- * <tr>
331
- * <td>
332
- * <code>--font-size-xxs</code>
333
- * </td>
334
- * <td>
335
- * <div style={{ fontSize: 'var(--font-size-xxs)' }}>
336
- * Size XXS
337
- * </div>
338
- * </td>
339
- * </tr>
340
- * <tr>
341
- * <td>
342
- * <code>--font-size-xs</code>
343
- * </td>
344
- * <td>
345
- * <div style={{ fontSize: 'var(--font-size-xs)' }}>Size XS</div>
346
- * </td>
347
- * </tr>
348
- * <tr>
349
- * <td>
350
- * <code>--font-size-s</code>
351
- * </td>
352
- * <td>
353
- * <div style={{ fontSize: 'var(--font-size-s)' }}>Size S</div>
354
- * </td>
355
- * </tr>
356
- * <tr>
357
- * <td>
358
- * <code>--font-size-m</code>
359
- * </td>
360
- * <td>
361
- * <div style={{ fontSize: 'var(--font-size-m)' }}>Size M</div>
362
- * </td>
363
- * </tr>
364
- * <tr>
365
- * <td>
366
- * <code>--font-size-l</code>
367
- * </td>
368
- * <td>
369
- * <div
370
- * style={{
371
- * fontSize: 'var(--font-size-l)',
372
- * fontWeight: 'var(--font-weight-bold)',
373
- * }}
374
- * >
375
- * Size L
376
- * </div>
377
- * </td>
378
- * </tr>
379
- * <tr>
380
- * <td>
381
- * <code>--font-size-xl</code>
382
- * </td>
383
- * <td>
384
- * <div
385
- * style={{
386
- * fontSize: 'var(--font-size-xl)',
387
- * fontWeight: 'var(--font-weight-bold)',
388
- * }}
389
- * >
390
- * Size XL
391
- * </div>
392
- * </td>
393
- * </tr>
394
- * <tr>
395
- * <td>
396
- * <code>--font-size-xxl</code>
397
- * </td>
398
- * <td>
399
- * <div
400
- * style={{
401
- * fontSize: 'var(--font-size-xxl)',
402
- * fontWeight: 'var(--font-weight-bold)',
403
- * }}
404
- * >
405
- * Size XXL
406
- * </div>
407
- * </td>
408
- * </tr>
409
- * <tr>
410
- * <td>
411
- * <code>--font-size-xxxl</code>
412
- * </td>
413
- * <td>
414
- * <div
415
- * style={{
416
- * fontSize: 'var(--font-size-xxxl)',
417
- * fontWeight: 'var(--font-weight-bold)',
418
- * }}
419
- * >
420
- * Size XXXL
421
- * </div>
422
- * </td>
423
- * </tr>
424
- * </tbody>
425
- * </table>
530
+ * <Swatches
531
+ * kind="font-size"
532
+ * tokens={[
533
+ * '--font-size-xxs',
534
+ * '--font-size-xs',
535
+ * '--font-size-s',
536
+ * '--font-size-m',
537
+ * '--font-size-l',
538
+ * '--font-size-xl',
539
+ * '--font-size-xxl',
540
+ * '--font-size-xxxl',
541
+ * ]}
542
+ * />
426
543
  * </Canvas>;
427
544
  * ```
428
545
  *
429
- * @example Spacing CSS variables
546
+ * @example Spacing
430
547
  *
431
- * The following CSS variables are available as well, to mimick the spacing
432
- * between elements used by the main DatoCMS application. Negative spacing
433
- * variables are available too (`--negative-spacing-<SIZE>`).
548
+ * The following CSS variables are available as well, to mimick the spacing between elements used by the main DatoCMS application. Negative spacing variables are available too (`--negative-spacing-<SIZE>`).
434
549
  *
435
550
  * ```js
436
551
  * <Canvas ctx={ctx}>
437
- * <table>
438
- * <tbody>
439
- * <tr>
440
- * <td>
441
- * <code>--spacing-s</code>
442
- * </td>
443
- * <td>
444
- * <div
445
- * style={{
446
- * background: 'var(--accent-color)',
447
- * width: 'var(--spacing-s)',
448
- * height: 'var(--spacing-s)',
449
- * }}
450
- * />
451
- * </td>
452
- * </tr>
453
- * <tr>
454
- * <td>
455
- * <code>--spacing-m</code>
456
- * </td>
457
- * <td>
458
- * <div
459
- * style={{
460
- * background: 'var(--accent-color)',
461
- * width: 'var(--spacing-m)',
462
- * height: 'var(--spacing-m)',
463
- * }}
464
- * />
465
- * </td>
466
- * </tr>
467
- * <tr>
468
- * <td>
469
- * <code>--spacing-l</code>
470
- * </td>
471
- * <td>
472
- * <div
473
- * style={{
474
- * background: 'var(--accent-color)',
475
- * width: 'var(--spacing-l)',
476
- * height: 'var(--spacing-l)',
477
- * }}
478
- * />
479
- * </td>
480
- * </tr>
481
- * <tr>
482
- * <td>
483
- * <code>--spacing-xl</code>
484
- * </td>
485
- * <td>
486
- * <div
487
- * style={{
488
- * background: 'var(--accent-color)',
489
- * width: 'var(--spacing-xl)',
490
- * height: 'var(--spacing-xl)',
491
- * }}
492
- * />
493
- * </td>
494
- * </tr>
495
- * <tr>
496
- * <td>
497
- * <code>--spacing-xxl</code>
498
- * </td>
499
- * <td>
500
- * <div
501
- * style={{
502
- * background: 'var(--accent-color)',
503
- * width: 'var(--spacing-xxl)',
504
- * height: 'var(--spacing-xxl)',
505
- * }}
506
- * />
507
- * </td>
508
- * </tr>
509
- * <tr>
510
- * <td>
511
- * <code>--spacing-xxxl</code>
512
- * </td>
513
- * <td>
514
- * <div
515
- * style={{
516
- * background: 'var(--accent-color)',
517
- * width: 'var(--spacing-xxxl)',
518
- * height: 'var(--spacing-xxxl)',
519
- * }}
520
- * />
521
- * </td>
522
- * </tr>
523
- * </tbody>
524
- * </table>
552
+ * <Spacings
553
+ * tokens={[
554
+ * '--spacing-s',
555
+ * '--spacing-m',
556
+ * '--spacing-l',
557
+ * '--spacing-xl',
558
+ * '--spacing-xxl',
559
+ * '--spacing-xxxl',
560
+ * ]}
561
+ * />
525
562
  * </Canvas>;
526
563
  * ```
527
564
  */
@@ -546,6 +583,31 @@ export function Canvas({
546
583
  return undefined;
547
584
  }, [mode, noAutoResizer]);
548
585
 
586
+ // The semantic color tokens are only set on the canvas wrapper, so the page
587
+ // itself (`html`/`body`, outside the wrapper) can't reference them. Mirror
588
+ // the scrollbar token onto the document root so the page-level scrollbar can
589
+ // be themed too (consumed by the layered `html` rule in `base.css`).
590
+ const scrollbarFill = ctx.cssDesignTokens['--color--scrollbar--fill'];
591
+
592
+ useEffect(() => {
593
+ if (typeof document === 'undefined' || !scrollbarFill) {
594
+ return undefined;
595
+ }
596
+
597
+ const property = '--color--scrollbar--fill';
598
+ const root = document.documentElement;
599
+ const previous = root.style.getPropertyValue(property);
600
+ root.style.setProperty(property, scrollbarFill);
601
+
602
+ return () => {
603
+ if (previous) {
604
+ root.style.setProperty(property, previous);
605
+ } else {
606
+ root.style.removeProperty(property);
607
+ }
608
+ };
609
+ }, [scrollbarFill]);
610
+
549
611
  return (
550
612
  <CtxContext.Provider value={ctx}>
551
613
  <div