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