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
@@ -42,494 +42,531 @@ function useCtx() {
42
42
  }
43
43
  exports.useCtx = useCtx;
44
44
  /**
45
- * @example Color palette CSS variables
45
+ * @example Colors
46
46
  *
47
- * Within the `Canvas` component, a color palette is made available as a set of
48
- * CSS variables, allowing you to conform to the theme of the current
49
- * environment:
47
+ * A full semantic color palette is exposed inside `Canvas` as `--color--*` CSS variables.
48
+ *
49
+ * 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.
50
+ *
51
+ * #### Token name shape
52
+ *
53
+ * Tokens follow one of two name shapes:
54
+ *
55
+ * | Shape | Meaning |
56
+ * | --- | --- |
57
+ * | `--color--{property}` | standalone (one `--` after color) |
58
+ * | `--color--{context}--{property}` | context pair (two `--` after color) |
59
+ *
60
+ * **Properties** are the role a color plays:
61
+ *
62
+ * | Property | Role |
63
+ * | --- | --- |
64
+ * | `surface` | backgrounds |
65
+ * | `ink` | text and icons |
66
+ * | `border` | 1px lines |
67
+ * | `outline` | focus rings and block-level rings |
68
+ * | `fill` / `track` | indicator fills and their backgrounds |
69
+ *
70
+ * **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.
71
+ *
72
+ * **Context tokens** describe a self-contained mini-environment (a primary CTA, a danger button). Contexts come in two shapes:
73
+ *
74
+ * 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.
75
+ * 2. **Single-property contexts**: focus (outline/border), progress (fill/track), highlight (surface), scrollbar (fill). Not surface+ink environments; the pairing rule doesn't apply.
76
+ *
77
+ * > [!WARNING] Never cross ink-owning contexts
78
+ * > 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.
79
+ *
80
+ * #### Defining custom colors
81
+ *
82
+ * 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:
83
+ *
84
+ * ```css
85
+ * .my-plugin {
86
+ * --my-brand: #4a90e2;
87
+ * }
88
+ *
89
+ * [data-color-scheme="dark"] .my-plugin {
90
+ * --my-brand: #6aa9ec;
91
+ * }
92
+ *
93
+ * .my-plugin__cta {
94
+ * background: var(--my-brand);
95
+ * color: var(--color--primary--ink);
96
+ * }
97
+ * ```
98
+ *
99
+ * 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.
100
+ *
101
+ * #### Available tokens
102
+ *
103
+ * A swatch for every available token, grouped by context.
104
+ *
105
+ * ```js
106
+ * <Canvas ctx={ctx}>
107
+ * <div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--spacing-l)' }}>
108
+ * <StateManager initial={true}>
109
+ * {(isOpen, setOpen) => (
110
+ * <Section
111
+ * title="Standalone"
112
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
113
+ * >
114
+ * <p>
115
+ * 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.
116
+ * </p>
117
+ * <Swatches
118
+ * tokens={[
119
+ * ['--color--surface', 'Page background everything else sits on'],
120
+ * ['--color--surface-hover', 'Hovered row inside lists and tables'],
121
+ * ['--color--surface-muted', 'Background of muted section panels and quiet cards'],
122
+ * ['--color--surface-raised', 'Elevated layer for modals, dropdowns and popovers'],
123
+ * ['--color--surface-raised-hover', 'Hovered option inside a dropdown menu'],
124
+ * ['--color--surface-raised-active', 'Focused or pressed option inside a dropdown menu'],
125
+ * ['--color--ink', 'Primary body text'],
126
+ * ['--color--ink-subtle', 'Secondary text, captions, helper labels'],
127
+ * ['--color--ink-hover', 'Toolbar icon and link fill on hover'],
128
+ * ['--color--ink-muted', 'Deemphasized text that should recede'],
129
+ * ['--color--ink-placeholder', 'Empty-input placeholder text'],
130
+ * ['--color--ink-primary', 'Theme-colored text and icons for branded labels'],
131
+ * ['--color--ink-link', 'Inline links and accent text'],
132
+ * ['--color--ink-danger', 'Error text or icon on a neutral surface'],
133
+ * ['--color--ink-warning', 'Warning text or icon on a neutral surface'],
134
+ * ['--color--ink-success', 'Success text or icon on a neutral surface'],
135
+ * ['--color--ink-disabled', 'Label color on disabled inputs and buttons'],
136
+ * ['--color--border', 'Default 1px divider between cards, rows and sections'],
137
+ * ['--color--border-hover', 'Border of an input or card when hovered'],
138
+ * ]}
139
+ * />
140
+ * </Section>
141
+ * )}
142
+ * </StateManager>
143
+ *
144
+ * <StateManager initial={false}>
145
+ * {(isOpen, setOpen) => (
146
+ * <Section
147
+ * title="Context: primary"
148
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
149
+ * >
150
+ * <p>
151
+ * 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>.
152
+ * </p>
153
+ * <Swatches
154
+ * tokens={[
155
+ * ['--color--primary--surface', 'Resting background of a primary call-to-action button'],
156
+ * ['--color--primary--surface-hover', 'Hovered primary button background'],
157
+ * ['--color--primary--surface-active', 'Pressed primary button background'],
158
+ * ['--color--primary--surface-muted', 'Muted variant of the primary surface'],
159
+ * ['--color--primary--surface-secondary', 'Quieter brand surface for accent badges and inline chips'],
160
+ * ['--color--primary--ink', 'Text and icon color sitting on any primary surface'],
161
+ * ['--color--primary--border', 'Thin border drawn on top of a primary surface'],
162
+ * ]}
163
+ * />
164
+ * </Section>
165
+ * )}
166
+ * </StateManager>
167
+ *
168
+ * <StateManager initial={false}>
169
+ * {(isOpen, setOpen) => (
170
+ * <Section
171
+ * title="Context: primary-soft"
172
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
173
+ * >
174
+ * <p>
175
+ * 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.
176
+ * </p>
177
+ * <Swatches
178
+ * tokens={[
179
+ * ['--color--primary-soft--surface', 'Resting background of secondary brand-tinted buttons'],
180
+ * ['--color--primary-soft--surface-hover', 'Hovered tinted button background'],
181
+ * ['--color--primary-soft--surface-active', 'Pressed tinted button background'],
182
+ * ['--color--primary-soft--ink', 'Text and icon color on a soft brand surface'],
183
+ * ['--color--primary-soft--border', 'Thin border drawn on top of a soft brand surface'],
184
+ * ]}
185
+ * />
186
+ * </Section>
187
+ * )}
188
+ * </StateManager>
189
+ *
190
+ * <StateManager initial={false}>
191
+ * {(isOpen, setOpen) => (
192
+ * <Section
193
+ * title="Context: selected"
194
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
195
+ * >
196
+ * <p>
197
+ * 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.
198
+ * </p>
199
+ * <Swatches
200
+ * tokens={[
201
+ * ['--color--selected--surface', 'Background of the currently active entry in a list or tree'],
202
+ * ['--color--selected--surface-hover', 'Hover on an entry that is already selected'],
203
+ * ['--color--selected--ink', 'Text and icon color inside the selected entry'],
204
+ * ['--color--selected--border', 'Border or outline ring drawn around a selected option or card'],
205
+ * ]}
206
+ * />
207
+ * </Section>
208
+ * )}
209
+ * </StateManager>
210
+ *
211
+ * <StateManager initial={false}>
212
+ * {(isOpen, setOpen) => (
213
+ * <Section
214
+ * title="Context: disabled"
215
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
216
+ * >
217
+ * <p>
218
+ * The flat, low-contrast pair applied to non-interactive controls: disabled buttons, disabled selects and disabled toggles.
219
+ * </p>
220
+ * <PairSwatches
221
+ * tokens={[
222
+ * ['--color--disabled--surface', '--color--disabled--ink', 'Disabled button or control: muted background with low-contrast label'],
223
+ * ]}
224
+ * />
225
+ * </Section>
226
+ * )}
227
+ * </StateManager>
228
+ *
229
+ * <StateManager initial={false}>
230
+ * {(isOpen, setOpen) => (
231
+ * <Section
232
+ * title="Context: danger"
233
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
234
+ * >
235
+ * <p>
236
+ * Reserved for destructive actions, such as Delete, Remove or Reset operations.
237
+ * </p>
238
+ * <PairSwatches
239
+ * tokens={[
240
+ * ['--color--danger--surface', '--color--danger--ink', 'Destructive action button: vivid red surface with white label'],
241
+ * ]}
242
+ * />
243
+ * </Section>
244
+ * )}
245
+ * </StateManager>
246
+ *
247
+ * <StateManager initial={false}>
248
+ * {(isOpen, setOpen) => (
249
+ * <Section
250
+ * title="Context: focus"
251
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
252
+ * >
253
+ * <p>
254
+ * 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.
255
+ * </p>
256
+ * <Swatches
257
+ * tokens={[
258
+ * ['--color--focus--border', 'Border color of the focused element'],
259
+ * ['--color--focus--outline', 'Soft outline ring drawn around the focused element'],
260
+ * ]}
261
+ * />
262
+ * </Section>
263
+ * )}
264
+ * </StateManager>
265
+ *
266
+ * <StateManager initial={false}>
267
+ * {(isOpen, setOpen) => (
268
+ * <Section
269
+ * title="Signal tones"
270
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
271
+ * >
272
+ * <p>
273
+ * 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.
274
+ * </p>
275
+ * <Swatches
276
+ * tokens={[
277
+ * ['--color--danger-soft--surface', 'Background of error banners and alert toasts'],
278
+ * ['--color--danger-soft--ink', 'Error message text and the icon inside an error panel'],
279
+ * ['--color--danger-soft--border', 'Border around an invalid input or alert toast'],
280
+ * ['--color--danger-soft--outline', 'Soft halo around an invalid field on focus'],
281
+ * ['--color--warning-soft--surface', 'Background of warning banners and plugin notices'],
282
+ * ['--color--warning-soft--ink', 'Text inside warning banners and warning toasts'],
283
+ * ['--color--warning-soft--border', 'Border around warning banners and modified-state pills'],
284
+ * ['--color--warning-soft--outline', 'Soft halo for warning emphasis'],
285
+ * ['--color--success-soft--surface', 'Background of success toasts'],
286
+ * ['--color--success-soft--ink', 'Text inside success toasts and success banners'],
287
+ * ['--color--success-soft--border', 'Border around success banners'],
288
+ * ['--color--success-soft--outline', 'Soft halo for success emphasis'],
289
+ * ]}
290
+ * />
291
+ * </Section>
292
+ * )}
293
+ * </StateManager>
294
+ *
295
+ * <StateManager initial={false}>
296
+ * {(isOpen, setOpen) => (
297
+ * <Section
298
+ * title="Context: highlight"
299
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
300
+ * >
301
+ * <p>
302
+ * The yellow marker pen for inline rich-text highlights inside Structured Text editors.
303
+ * </p>
304
+ * <Swatches
305
+ * tokens={[
306
+ * ['--color--highlight--surface', 'Background of a highlighted span inside a rich text editor'],
307
+ * ]}
308
+ * />
309
+ * </Section>
310
+ * )}
311
+ * </StateManager>
312
+ *
313
+ * <StateManager initial={false}>
314
+ * {(isOpen, setOpen) => (
315
+ * <Section
316
+ * title="Diffs"
317
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
318
+ * >
319
+ * <p>
320
+ * 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.
321
+ * </p>
322
+ * <Swatches
323
+ * tokens={[
324
+ * ['--color--diff-added--surface', 'Background of inline added text inside a text diff'],
325
+ * ['--color--diff-added--outline', 'Outline drawn around a block-level added revision panel'],
326
+ * ['--color--diff-added--ink', 'Left-border color of a positive rule when it was recently changed (vivid)'],
327
+ * ['--color--diff-added--ink-subtle', 'Left-border color of a positive rule when it was not recently changed'],
328
+ * ['--color--diff-removed--surface', 'Background of inline removed text inside a text diff'],
329
+ * ['--color--diff-removed--outline', 'Outline drawn around a block-level removed revision panel'],
330
+ * ['--color--diff-removed--ink', 'Left-border color of a negative rule when it was recently changed (vivid)'],
331
+ * ['--color--diff-removed--ink-subtle', 'Left-border color of a negative rule when it was not recently changed'],
332
+ * ['--color--diff-changed--surface', 'Background of inline changed text inside a text diff'],
333
+ * ['--color--diff-changed--outline', 'Outline drawn around a block-level changed revision panel'],
334
+ * ]}
335
+ * />
336
+ * </Section>
337
+ * )}
338
+ * </StateManager>
339
+ *
340
+ * <StateManager initial={false}>
341
+ * {(isOpen, setOpen) => (
342
+ * <Section
343
+ * title="Status"
344
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
345
+ * >
346
+ * <p>
347
+ * Publishing-workflow status dots. Ink-only because the colored dot is the whole marker, no surface or border needed.
348
+ * </p>
349
+ * <Swatches
350
+ * tokens={[
351
+ * ['--color--status-draft--ink', 'Dot color for records that exist only as a draft'],
352
+ * ['--color--status-outdated--ink', 'Dot color for published records with unpublished changes'],
353
+ * ['--color--status-published--ink', 'Dot color for fully published records'],
354
+ * ]}
355
+ * />
356
+ * </Section>
357
+ * )}
358
+ * </StateManager>
359
+ *
360
+ * <StateManager initial={false}>
361
+ * {(isOpen, setOpen) => (
362
+ * <Section
363
+ * title="Backdrop and overlay"
364
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
365
+ * >
366
+ * <p>
367
+ * 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.
368
+ * </p>
369
+ * <PairSwatches
370
+ * tokens={[
371
+ * ['--color--backdrop--surface', '--color--backdrop--ink', 'Full-screen modal dim with icon color for close controls'],
372
+ * ]}
373
+ * />
374
+ * <Swatches
375
+ * tokens={[
376
+ * ['--color--overlay--surface', 'Scrim painted over media thumbnails and image cards'],
377
+ * ['--color--overlay--surface-hover', 'Hover background of a reversed button floating on dark media'],
378
+ * ['--color--overlay--surface-active', 'Pressed background of a reversed button on dark media'],
379
+ * ['--color--overlay--ink', 'Text and icon color inside reversed buttons on overlay surfaces'],
380
+ * ]}
381
+ * />
382
+ * </Section>
383
+ * )}
384
+ * </StateManager>
385
+ *
386
+ * <StateManager initial={false}>
387
+ * {(isOpen, setOpen) => (
388
+ * <Section
389
+ * title="Stacked"
390
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
391
+ * >
392
+ * <p>
393
+ * 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.
394
+ * </p>
395
+ * <Swatches
396
+ * tokens={[
397
+ * ['--color--stacked--surface', 'Base layer of a dark inline panel'],
398
+ * ['--color--stacked--surface-upper', 'Inner detail panel sitting one layer above the base'],
399
+ * ['--color--stacked--surface-action', 'Resting background of action buttons inside a stacked panel (transparent)'],
400
+ * ['--color--stacked--surface-action-hover', 'Hovered action button inside a stacked panel'],
401
+ * ['--color--stacked--surface-action-active', 'Pressed action button inside a stacked panel'],
402
+ * ['--color--stacked--ink', 'Main text and values on a stacked surface'],
403
+ * ['--color--stacked--ink-subtle', 'Field labels and secondary text on a stacked surface'],
404
+ * ['--color--stacked--border', 'Column rules and dividers inside a stacked panel'],
405
+ * ]}
406
+ * />
407
+ * </Section>
408
+ * )}
409
+ * </StateManager>
410
+ *
411
+ * <StateManager initial={false}>
412
+ * {(isOpen, setOpen) => (
413
+ * <Section
414
+ * title="Progress"
415
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
416
+ * >
417
+ * <p>
418
+ * Horizontal progress bars used to report quota usage, upload advancement and similar percentage indicators.
419
+ * </p>
420
+ * <Swatches
421
+ * tokens={[
422
+ * ['--color--progress--track', 'Empty portion of the bar (the background track)'],
423
+ * ['--color--progress--fill', 'Filled portion of the bar, drawn in the brand color'],
424
+ * ['--color--progress--fill-hover', 'Fill color when the bar is hovered'],
425
+ * ]}
426
+ * />
427
+ * </Section>
428
+ * )}
429
+ * </StateManager>
430
+ *
431
+ * <StateManager initial={false}>
432
+ * {(isOpen, setOpen) => (
433
+ * <Section
434
+ * title="Tooltip"
435
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
436
+ * >
437
+ * <p>
438
+ * Small dark floating labels: the plain tooltip shown on hover, and the keyboard-hint variant that pairs a description with a keyboard shortcut.
439
+ * </p>
440
+ * <Swatches
441
+ * tokens={[
442
+ * ['--color--tooltip--surface', 'Background of standard and keyboard-hint tooltips'],
443
+ * ['--color--tooltip--surface-hover', 'Hover background for interactive controls living inside a tooltip'],
444
+ * ['--color--tooltip--ink', 'Primary text inside a tooltip'],
445
+ * ['--color--tooltip--ink-subtle', 'Secondary text inside a tooltip, e.g. the keyboard shortcut hint'],
446
+ * ]}
447
+ * />
448
+ * </Section>
449
+ * )}
450
+ * </StateManager>
451
+ *
452
+ * <StateManager initial={false}>
453
+ * {(isOpen, setOpen) => (
454
+ * <Section
455
+ * title="Code"
456
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
457
+ * >
458
+ * <p>
459
+ * The dark monospaced surface used by build logs, error traces and other terminal-style output.
460
+ * </p>
461
+ * <PairSwatches
462
+ * tokens={[
463
+ * ['--color--code--surface', '--color--code--ink', 'Dark monospaced surface with its text color'],
464
+ * ]}
465
+ * />
466
+ * </Section>
467
+ * )}
468
+ * </StateManager>
469
+ *
470
+ * <StateManager initial={false}>
471
+ * {(isOpen, setOpen) => (
472
+ * <Section
473
+ * title="Scrollbar"
474
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
475
+ * >
476
+ * <p>
477
+ * Tint applied globally to the native scrollbar thumb. Most visible in Firefox and on systems that keep scrollbars always on.
478
+ * </p>
479
+ * <Swatches
480
+ * tokens={[
481
+ * ['--color--scrollbar--fill', 'Color of the native scrollbar thumb across the whole app'],
482
+ * ]}
483
+ * />
484
+ * </Section>
485
+ * )}
486
+ * </StateManager>
487
+ *
488
+ * <StateManager initial={false}>
489
+ * {(isOpen, setOpen) => (
490
+ * <Section
491
+ * title="Field type groups"
492
+ * collapsible={{ isOpen, onToggle: () => setOpen((v) => !v) }}
493
+ * >
494
+ * <p>
495
+ * 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.
496
+ * </p>
497
+ * <PairSwatches
498
+ * tokens={[
499
+ * ['--color--field-group-text--surface', '--color--field-group-text--ink', 'Text / string / structured-text fields'],
500
+ * ['--color--field-group-rich-text--surface', '--color--field-group-rich-text--ink', 'Rich-text and single-block fields'],
501
+ * ['--color--field-group-media--surface', '--color--field-group-media--ink', 'File, gallery and video fields'],
502
+ * ['--color--field-group-datetime--surface', '--color--field-group-datetime--ink', 'Date and date-time fields'],
503
+ * ['--color--field-group-number--surface', '--color--field-group-number--ink', 'Integer and float fields'],
504
+ * ['--color--field-group-boolean--surface', '--color--field-group-boolean--ink', 'Boolean fields'],
505
+ * ['--color--field-group-location--surface', '--color--field-group-location--ink', 'Lat/lon fields'],
506
+ * ['--color--field-group-color--surface', '--color--field-group-color--ink', 'Color fields'],
507
+ * ['--color--field-group-seo--surface', '--color--field-group-seo--ink', 'Slug and SEO fields'],
508
+ * ['--color--field-group-reference--surface', '--color--field-group-reference--ink', 'Link and links fields'],
509
+ * ['--color--field-group-json--surface', '--color--field-group-json--ink', 'JSON fields'],
510
+ * ]}
511
+ * />
512
+ * </Section>
513
+ * )}
514
+ * </StateManager>
515
+ * </div>
516
+ * </Canvas>;
517
+ * ```
518
+ *
519
+ * @example Shadows
520
+ *
521
+ * Four ready-made `box-shadow` composites (raised, floating, lifted, ambient). Drop them straight into a `box-shadow` property.
50
522
  *
51
523
  * ```js
52
524
  * <Canvas ctx={ctx}>
53
- * <Section title="Text colors">
54
- * <table>
55
- * <tbody>
56
- * <tr>
57
- * <td>
58
- * <code>--base-body-color</code>
59
- * </td>
60
- * <td width="30%">
61
- * <div
62
- * style={{
63
- * width: '30px',
64
- * height: '30px',
65
- * background: 'var(--base-body-color)',
66
- * }}
67
- * />
68
- * </td>
69
- * </tr>
70
- * <tr>
71
- * <td>
72
- * <code>--light-body-color</code>
73
- * </td>
74
- * <td width="30%">
75
- * <div
76
- * style={{
77
- * width: '30px',
78
- * height: '30px',
79
- * background: 'var(--light-body-color)',
80
- * }}
81
- * />
82
- * </td>
83
- * </tr>
84
- * <tr>
85
- * <td>
86
- * <code>--placeholder-body-color</code>
87
- * </td>
88
- * <td width="30%">
89
- * <div
90
- * style={{
91
- * width: '30px',
92
- * height: '30px',
93
- * background: 'var(--placeholder-body-color)',
94
- * }}
95
- * />
96
- * </td>
97
- * </tr>
98
- * </tbody>
99
- * </table>
100
- * </Section>
101
- * <Section title="UI colors">
102
- * <table>
103
- * <tbody>
104
- * <tr>
105
- * <td>
106
- * <code>--light-bg-color</code>
107
- * </td>
108
- * <td width="30%">
109
- * <div
110
- * style={{
111
- * width: '30px',
112
- * height: '30px',
113
- * background: 'var(--light-bg-color)',
114
- * }}
115
- * />
116
- * </td>
117
- * </tr>
118
- * <tr>
119
- * <td>
120
- * <code>--lighter-bg-color</code>
121
- * </td>
122
- * <td width="30%">
123
- * <div
124
- * style={{
125
- * width: '30px',
126
- * height: '30px',
127
- * background: 'var(--lighter-bg-color)',
128
- * }}
129
- * />
130
- * </td>
131
- * </tr>
132
- * <tr>
133
- * <td>
134
- * <code>--disabled-bg-color</code>
135
- * </td>
136
- * <td width="30%">
137
- * <div
138
- * style={{
139
- * width: '30px',
140
- * height: '30px',
141
- * background: 'var(--disabled-bg-color)',
142
- * }}
143
- * />
144
- * </td>
145
- * </tr>
146
- * <tr>
147
- * <td>
148
- * <code>--border-color</code>
149
- * </td>
150
- * <td width="30%">
151
- * <div
152
- * style={{
153
- * width: '30px',
154
- * height: '30px',
155
- * background: 'var(--border-color)',
156
- * }}
157
- * />
158
- * </td>
159
- * </tr>
160
- * <tr>
161
- * <td>
162
- * <code>--darker-border-color</code>
163
- * </td>
164
- * <td width="30%">
165
- * <div
166
- * style={{
167
- * width: '30px',
168
- * height: '30px',
169
- * background: 'var(--darker-border-color)',
170
- * }}
171
- * />
172
- * </td>
173
- * </tr>
174
- * <tr>
175
- * <td>
176
- * <code>--alert-color</code>
177
- * </td>
178
- * <td width="30%">
179
- * <div
180
- * style={{
181
- * width: '30px',
182
- * height: '30px',
183
- * background: 'var(--alert-color)',
184
- * }}
185
- * />
186
- * </td>
187
- * </tr>
188
- * <tr>
189
- * <td>
190
- * <code>--warning-color</code>
191
- * </td>
192
- * <td width="30%">
193
- * <div
194
- * style={{
195
- * width: '30px',
196
- * height: '30px',
197
- * background: 'var(--warning-color)',
198
- * }}
199
- * />
200
- * </td>
201
- * </tr>
202
- * <tr>
203
- * <td>
204
- * <code>--notice-color</code>
205
- * </td>
206
- * <td width="30%">
207
- * <div
208
- * style={{
209
- * width: '30px',
210
- * height: '30px',
211
- * background: 'var(--notice-color)',
212
- * }}
213
- * />
214
- * </td>
215
- * </tr>
216
- * <tr>
217
- * <td>
218
- * <code>--warning-bg-color</code>
219
- * </td>
220
- * <td width="30%">
221
- * <div
222
- * style={{
223
- * width: '30px',
224
- * height: '30px',
225
- * background: 'var(--warning-bg-color)',
226
- * }}
227
- * />
228
- * </td>
229
- * </tr>
230
- * <tr>
231
- * <td>
232
- * <code>--add-color</code>
233
- * </td>
234
- * <td width="30%">
235
- * <div
236
- * style={{
237
- * width: '30px',
238
- * height: '30px',
239
- * background: 'var(--add-color)',
240
- * }}
241
- * />
242
- * </td>
243
- * </tr>
244
- * <tr>
245
- * <td>
246
- * <code>--remove-color</code>
247
- * </td>
248
- * <td width="30%">
249
- * <div
250
- * style={{
251
- * width: '30px',
252
- * height: '30px',
253
- * background: 'var(--remove-color)',
254
- * }}
255
- * />
256
- * </td>
257
- * </tr>
258
- * </tbody>
259
- * </table>
260
- * </Section>
261
- * <Section title="Project-specific colors">
262
- * <table>
263
- * <tbody>
264
- * <tr>
265
- * <td>
266
- * <code>--accent-color</code>
267
- * </td>
268
- * <td width="30%">
269
- * <div
270
- * style={{
271
- * width: '30px',
272
- * height: '30px',
273
- * background: 'var(--accent-color)',
274
- * }}
275
- * />
276
- * </td>
277
- * </tr>
278
- * <tr>
279
- * <td>
280
- * <code>--primary-color</code>
281
- * </td>
282
- * <td width="30%">
283
- * <div
284
- * style={{
285
- * width: '30px',
286
- * height: '30px',
287
- * background: 'var(--primary-color)',
288
- * }}
289
- * />
290
- * </td>
291
- * </tr>
292
- * <tr>
293
- * <td>
294
- * <code>--light-color</code>
295
- * </td>
296
- * <td width="30%">
297
- * <div
298
- * style={{
299
- * width: '30px',
300
- * height: '30px',
301
- * background: 'var(--light-color)',
302
- * }}
303
- * />
304
- * </td>
305
- * </tr>
306
- * <tr>
307
- * <td>
308
- * <code>--dark-color</code>
309
- * </td>
310
- * <td width="30%">
311
- * <div
312
- * style={{
313
- * width: '30px',
314
- * height: '30px',
315
- * background: 'var(--dark-color)',
316
- * }}
317
- * />
318
- * </td>
319
- * </tr>
320
- * </tbody>
321
- * </table>
322
- * </Section>
525
+ * <Swatches
526
+ * kind="shadow"
527
+ * tokens={['--shadow--raised', '--shadow--floating', '--shadow--lifted', '--shadow--ambient']}
528
+ * />
323
529
  * </Canvas>;
324
530
  * ```
325
531
  *
326
- * @example Typography CSS variables
532
+ * @example Typography
327
533
  *
328
- * Typography is a foundational element in UI design. Good typography
329
- * establishes a strong, cohesive visual hierarchy and presents content clearly
330
- * and efficiently to users. Within the `Canvas` component, a set of CSS
331
- * variables is available allowing your plugin to conform to the overall
332
- * look&feel of DatoCMS:
534
+ * 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:
333
535
  *
334
536
  * ```js
335
537
  * <Canvas ctx={ctx}>
336
- * <table>
337
- * <tbody>
338
- * <tr>
339
- * <td>
340
- * <code>--font-size-xxs</code>
341
- * </td>
342
- * <td>
343
- * <div style={{ fontSize: 'var(--font-size-xxs)' }}>
344
- * Size XXS
345
- * </div>
346
- * </td>
347
- * </tr>
348
- * <tr>
349
- * <td>
350
- * <code>--font-size-xs</code>
351
- * </td>
352
- * <td>
353
- * <div style={{ fontSize: 'var(--font-size-xs)' }}>Size XS</div>
354
- * </td>
355
- * </tr>
356
- * <tr>
357
- * <td>
358
- * <code>--font-size-s</code>
359
- * </td>
360
- * <td>
361
- * <div style={{ fontSize: 'var(--font-size-s)' }}>Size S</div>
362
- * </td>
363
- * </tr>
364
- * <tr>
365
- * <td>
366
- * <code>--font-size-m</code>
367
- * </td>
368
- * <td>
369
- * <div style={{ fontSize: 'var(--font-size-m)' }}>Size M</div>
370
- * </td>
371
- * </tr>
372
- * <tr>
373
- * <td>
374
- * <code>--font-size-l</code>
375
- * </td>
376
- * <td>
377
- * <div
378
- * style={{
379
- * fontSize: 'var(--font-size-l)',
380
- * fontWeight: 'var(--font-weight-bold)',
381
- * }}
382
- * >
383
- * Size L
384
- * </div>
385
- * </td>
386
- * </tr>
387
- * <tr>
388
- * <td>
389
- * <code>--font-size-xl</code>
390
- * </td>
391
- * <td>
392
- * <div
393
- * style={{
394
- * fontSize: 'var(--font-size-xl)',
395
- * fontWeight: 'var(--font-weight-bold)',
396
- * }}
397
- * >
398
- * Size XL
399
- * </div>
400
- * </td>
401
- * </tr>
402
- * <tr>
403
- * <td>
404
- * <code>--font-size-xxl</code>
405
- * </td>
406
- * <td>
407
- * <div
408
- * style={{
409
- * fontSize: 'var(--font-size-xxl)',
410
- * fontWeight: 'var(--font-weight-bold)',
411
- * }}
412
- * >
413
- * Size XXL
414
- * </div>
415
- * </td>
416
- * </tr>
417
- * <tr>
418
- * <td>
419
- * <code>--font-size-xxxl</code>
420
- * </td>
421
- * <td>
422
- * <div
423
- * style={{
424
- * fontSize: 'var(--font-size-xxxl)',
425
- * fontWeight: 'var(--font-weight-bold)',
426
- * }}
427
- * >
428
- * Size XXXL
429
- * </div>
430
- * </td>
431
- * </tr>
432
- * </tbody>
433
- * </table>
538
+ * <Swatches
539
+ * kind="font-size"
540
+ * tokens={[
541
+ * '--font-size-xxs',
542
+ * '--font-size-xs',
543
+ * '--font-size-s',
544
+ * '--font-size-m',
545
+ * '--font-size-l',
546
+ * '--font-size-xl',
547
+ * '--font-size-xxl',
548
+ * '--font-size-xxxl',
549
+ * ]}
550
+ * />
434
551
  * </Canvas>;
435
552
  * ```
436
553
  *
437
- * @example Spacing CSS variables
554
+ * @example Spacing
438
555
  *
439
- * The following CSS variables are available as well, to mimick the spacing
440
- * between elements used by the main DatoCMS application. Negative spacing
441
- * variables are available too (`--negative-spacing-<SIZE>`).
556
+ * 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>`).
442
557
  *
443
558
  * ```js
444
559
  * <Canvas ctx={ctx}>
445
- * <table>
446
- * <tbody>
447
- * <tr>
448
- * <td>
449
- * <code>--spacing-s</code>
450
- * </td>
451
- * <td>
452
- * <div
453
- * style={{
454
- * background: 'var(--accent-color)',
455
- * width: 'var(--spacing-s)',
456
- * height: 'var(--spacing-s)',
457
- * }}
458
- * />
459
- * </td>
460
- * </tr>
461
- * <tr>
462
- * <td>
463
- * <code>--spacing-m</code>
464
- * </td>
465
- * <td>
466
- * <div
467
- * style={{
468
- * background: 'var(--accent-color)',
469
- * width: 'var(--spacing-m)',
470
- * height: 'var(--spacing-m)',
471
- * }}
472
- * />
473
- * </td>
474
- * </tr>
475
- * <tr>
476
- * <td>
477
- * <code>--spacing-l</code>
478
- * </td>
479
- * <td>
480
- * <div
481
- * style={{
482
- * background: 'var(--accent-color)',
483
- * width: 'var(--spacing-l)',
484
- * height: 'var(--spacing-l)',
485
- * }}
486
- * />
487
- * </td>
488
- * </tr>
489
- * <tr>
490
- * <td>
491
- * <code>--spacing-xl</code>
492
- * </td>
493
- * <td>
494
- * <div
495
- * style={{
496
- * background: 'var(--accent-color)',
497
- * width: 'var(--spacing-xl)',
498
- * height: 'var(--spacing-xl)',
499
- * }}
500
- * />
501
- * </td>
502
- * </tr>
503
- * <tr>
504
- * <td>
505
- * <code>--spacing-xxl</code>
506
- * </td>
507
- * <td>
508
- * <div
509
- * style={{
510
- * background: 'var(--accent-color)',
511
- * width: 'var(--spacing-xxl)',
512
- * height: 'var(--spacing-xxl)',
513
- * }}
514
- * />
515
- * </td>
516
- * </tr>
517
- * <tr>
518
- * <td>
519
- * <code>--spacing-xxxl</code>
520
- * </td>
521
- * <td>
522
- * <div
523
- * style={{
524
- * background: 'var(--accent-color)',
525
- * width: 'var(--spacing-xxxl)',
526
- * height: 'var(--spacing-xxxl)',
527
- * }}
528
- * />
529
- * </td>
530
- * </tr>
531
- * </tbody>
532
- * </table>
560
+ * <Spacings
561
+ * tokens={[
562
+ * '--spacing-s',
563
+ * '--spacing-m',
564
+ * '--spacing-l',
565
+ * '--spacing-xl',
566
+ * '--spacing-xxl',
567
+ * '--spacing-xxxl',
568
+ * ]}
569
+ * />
533
570
  * </Canvas>;
534
571
  * ```
535
572
  */
@@ -546,6 +583,28 @@ function Canvas(_a) {
546
583
  }
547
584
  return undefined;
548
585
  }, [mode, noAutoResizer]);
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
+ var scrollbarFill = ctx.cssDesignTokens['--color--scrollbar--fill'];
591
+ (0, react_1.useEffect)(function () {
592
+ if (typeof document === 'undefined' || !scrollbarFill) {
593
+ return undefined;
594
+ }
595
+ var property = '--color--scrollbar--fill';
596
+ var root = document.documentElement;
597
+ var previous = root.style.getPropertyValue(property);
598
+ root.style.setProperty(property, scrollbarFill);
599
+ return function () {
600
+ if (previous) {
601
+ root.style.setProperty(property, previous);
602
+ }
603
+ else {
604
+ root.style.removeProperty(property);
605
+ }
606
+ };
607
+ }, [scrollbarFill]);
549
608
  return (react_1.default.createElement(exports.CtxContext.Provider, { value: ctx },
550
609
  react_1.default.createElement("div", { className: (0, classnames_1.default)(styles_module_css_json_1.default.themeVariables, styles_module_css_json_1.default.canvas), style: (0, generateStyleFromCtx_1.generateStyleFromCtx)(ctx) }, children)));
551
610
  }