basalt-ui 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +30 -0
- package/README.md +47 -5
- package/agent/rules/basalt-app.md +126 -0
- package/agent/rules/basalt-content.md +3 -1
- package/agent/skills/basalt-app/SKILL.md +28 -7
- package/dist/agent/part-list.d.ts.map +1 -1
- package/dist/agent/part-list.js +17 -7
- package/dist/agent/stick-to-bottom.js +2 -2
- package/dist/agent-chat/thread-detail-panel.d.ts.map +1 -1
- package/dist/agent-chat/thread-detail-panel.js +37 -33
- package/dist/agent-chat/thread-message.d.ts.map +1 -1
- package/dist/agent-chat/thread-message.js +8 -5
- package/dist/agent-chat/thread-outcome-card.js +3 -3
- package/dist/agent-chat/thread-workspace.js +1 -1
- package/dist/charts/primitives/ChartLegend.js +2 -0
- package/dist/charts/primitives/ChartTooltip.js +2 -1
- package/dist/cli/index.d.ts +15 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +29 -7
- package/dist/connectivity/connectivity-indicator.d.ts.map +1 -1
- package/dist/connectivity/connectivity-indicator.js +3 -3
- package/dist/content/article-card.module.css +7 -5
- package/dist/content/article-layout.module.css +16 -12
- package/dist/content/callout.module.css +4 -4
- package/dist/content/code-block.module.css +8 -7
- package/dist/content/guide.module.css +3 -3
- package/dist/content/mermaid.module.css +2 -2
- package/dist/content/prose.module.css +59 -29
- package/dist/content/reading-progress.module.css +2 -0
- package/dist/content/toc.module.css +6 -3
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +10 -2
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +3 -16
- package/dist/dashboard/settings-section.js +2 -2
- package/dist/dashboard/settings-section.module.css +2 -2
- package/dist/dashboard/stat-card.js +2 -1
- package/dist/data/virtual-list.d.ts.map +1 -1
- package/dist/data/virtual-list.js +12 -2
- package/dist/forms/FormErrorSummary.js +2 -2
- package/dist/guard/index.d.ts +20 -4
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +250 -37
- package/dist/guard/types.d.ts +24 -3
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/provider/index.d.ts +30 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +32 -7
- package/dist/provider/lab-theme.d.ts +39 -0
- package/dist/provider/lab-theme.d.ts.map +1 -0
- package/dist/provider/lab-theme.js +52 -0
- package/dist/shell/app-header.module.css +2 -2
- package/dist/shell/app-mobile-nav.module.css +1 -1
- package/dist/shell/app-sidebar-account.d.ts.map +1 -1
- package/dist/shell/app-sidebar-account.js +4 -2
- package/dist/shell/app-sidebar.d.ts.map +1 -1
- package/dist/shell/app-sidebar.js +4 -2
- package/dist/shell/app-sidebar.module.css +36 -26
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +11 -4
- package/dist/shell/sidebar-search.module.css +16 -4
- package/dist/styles.css +1 -1
- package/dist/surfaces.d.ts +15 -11
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +4 -3
- package/dist/theme/controls.module.css +1 -1
- package/dist/theme/floating.module.css +1 -1
- package/dist/theme/index.d.ts +116 -11
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +703 -566
- package/dist/theme/nav-link.module.css +1 -1
- package/dist/theme/use-basalt-spacing.d.ts +3 -0
- package/dist/theme/use-basalt-spacing.d.ts.map +1 -0
- package/dist/theme/use-basalt-spacing.js +8 -0
- package/dist/theme-lab/derive-controls.d.ts +13 -0
- package/dist/theme-lab/derive-controls.d.ts.map +1 -0
- package/dist/theme-lab/derive-controls.js +137 -0
- package/dist/theme-lab/derive-state.d.ts +55 -0
- package/dist/theme-lab/derive-state.d.ts.map +1 -0
- package/dist/theme-lab/derive-state.js +81 -0
- package/dist/theme-lab/index.d.ts +12 -2
- package/dist/theme-lab/index.d.ts.map +1 -1
- package/dist/theme-lab/index.js +13 -62
- package/dist/theme-toggle/index.d.ts.map +1 -1
- package/dist/theme-toggle/index.js +3 -2
- package/dist/tokens/derive.d.ts +89 -0
- package/dist/tokens/derive.d.ts.map +1 -0
- package/dist/tokens/derive.js +250 -0
- package/dist/tokens/hct.d.ts +34 -0
- package/dist/tokens/hct.d.ts.map +1 -0
- package/dist/tokens/hct.js +159 -0
- package/dist/tokens/index.d.ts +71 -7
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +284 -46
- package/dist/tokens/palette.d.ts +984 -167
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +617 -119
- package/dist/vite-color-mix.d.ts +30 -0
- package/dist/vite-color-mix.d.ts.map +1 -0
- package/dist/vite-color-mix.js +80 -0
- package/dist/vite.d.ts +82 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +312 -0
- package/llms.txt +5 -4
- package/package.json +24 -9
- package/src/agent/part-list.tsx +13 -7
- package/src/agent/stick-to-bottom.tsx +2 -2
- package/src/agent-chat/thread-detail-panel.tsx +13 -10
- package/src/agent-chat/thread-message.tsx +8 -5
- package/src/agent-chat/thread-outcome-card.tsx +2 -2
- package/src/agent-chat/thread-workspace.tsx +2 -2
- package/src/charts/primitives/ChartLegend.tsx +2 -2
- package/src/charts/primitives/ChartTooltip.tsx +2 -2
- package/src/cli/check-theme.test.ts +18 -0
- package/src/cli/index.ts +55 -5
- package/src/connectivity/connectivity-indicator.tsx +8 -2
- package/src/content/article-card.module.css +7 -5
- package/src/content/article-layout.module.css +16 -12
- package/src/content/callout.module.css +4 -4
- package/src/content/code-block.module.css +8 -7
- package/src/content/guide.module.css +3 -3
- package/src/content/mermaid.module.css +2 -2
- package/src/content/prose.module.css +59 -29
- package/src/content/prose.module.css.test.ts +55 -0
- package/src/content/reading-progress.module.css +2 -0
- package/src/content/toc.module.css +6 -3
- package/src/dashboard/delta-badge.tsx +10 -4
- package/src/dashboard/empty-state.tsx +3 -16
- package/src/dashboard/settings-section.module.css +2 -2
- package/src/dashboard/settings-section.tsx +2 -2
- package/src/dashboard/stat-card.tsx +2 -2
- package/src/data/virtual-list.tsx +12 -2
- package/src/forms/FormErrorSummary.tsx +1 -1
- package/src/guard/check-source.test.ts +416 -5
- package/src/guard/index.ts +367 -45
- package/src/guard/types.ts +24 -2
- package/src/index.ts +1 -0
- package/src/provider/index.test.tsx +100 -0
- package/src/provider/index.tsx +79 -7
- package/src/provider/lab-theme.test.ts +147 -0
- package/src/provider/lab-theme.ts +166 -0
- package/src/shell/app-header.module.css +2 -2
- package/src/shell/app-mobile-nav.module.css +1 -1
- package/src/shell/app-sidebar-account.tsx +9 -2
- package/src/shell/app-sidebar.module.css +36 -26
- package/src/shell/app-sidebar.tsx +12 -2
- package/src/shell/index.tsx +14 -3
- package/src/shell/sidebar-search.module.css +16 -4
- package/src/styles.css +1 -1
- package/src/surfaces.ts +17 -10
- package/src/theme/contrast.test.ts +19 -3
- package/src/theme/controls.module.css +1 -1
- package/src/theme/density-option.test.ts +96 -0
- package/src/theme/density-relations.test.ts +428 -0
- package/src/theme/derive-theme.test.ts +101 -0
- package/src/theme/floating.module.css +1 -1
- package/src/theme/fonts-option.test.ts +69 -0
- package/src/theme/index.ts +930 -563
- package/src/theme/nav-link.module.css +1 -1
- package/src/theme/radius-option.test.ts +86 -0
- package/src/theme/radius.test.ts +132 -0
- package/src/theme/spacing.test.ts +432 -0
- package/src/theme/use-basalt-spacing.test.tsx +51 -0
- package/src/theme/use-basalt-spacing.ts +38 -0
- package/src/theme-lab/derive-controls.test.ts +94 -0
- package/src/theme-lab/derive-controls.tsx +227 -0
- package/src/theme-lab/derive-state.test.ts +71 -0
- package/src/theme-lab/derive-state.ts +163 -0
- package/src/theme-lab/index.tsx +29 -68
- package/src/theme-lab/theme-lab.test.ts +4 -18
- package/src/theme-toggle/index.tsx +9 -4
- package/src/tokens/build-fonts-css.test.ts +51 -0
- package/src/tokens/build-radius-css.test.ts +25 -0
- package/src/tokens/density.test.ts +274 -0
- package/src/tokens/derive-radius.test.ts +62 -0
- package/src/tokens/derive.test.ts +30 -0
- package/src/tokens/derive.ts +481 -0
- package/src/tokens/hct.ts +231 -0
- package/src/tokens/index.ts +395 -45
- package/src/tokens/palette.test.ts +114 -0
- package/src/tokens/palette.ts +1118 -180
- package/src/vite-color-mix.test.ts +46 -0
- package/src/vite-color-mix.ts +137 -0
- package/src/vite.test.ts +192 -0
- package/src/vite.ts +502 -1
package/dist/theme/index.js
CHANGED
|
@@ -44,13 +44,22 @@ import {
|
|
|
44
44
|
Timeline,
|
|
45
45
|
Tooltip
|
|
46
46
|
} from "@mantine/core";
|
|
47
|
-
import {
|
|
48
|
-
|
|
47
|
+
import {
|
|
48
|
+
BP,
|
|
49
|
+
buildPaletteData,
|
|
50
|
+
deriveRadius,
|
|
51
|
+
deriveSpacing,
|
|
52
|
+
RADIUS_STEP,
|
|
53
|
+
SPACE_FIXED
|
|
54
|
+
} from "../tokens/palette.js";
|
|
55
|
+
import { DEFAULT_DERIVE_CONFIG, isDefaultDeriveConfig, resolveDeriveConfig } from "../tokens/derive.js";
|
|
56
|
+
import { pxRem, VX } from "../tokens/index.js";
|
|
49
57
|
import controlsClasses from "./controls.module.css";
|
|
50
58
|
import floatingClasses from "./floating.module.css";
|
|
51
59
|
import navLinkClasses from "./nav-link.module.css";
|
|
52
60
|
import segmentedControlClasses from "./segmented-control.module.css";
|
|
53
61
|
import timelineClasses from "./timeline.module.css";
|
|
62
|
+
import { useBasaltSpacing } from "./use-basalt-spacing.js";
|
|
54
63
|
function hexToRgb(h) {
|
|
55
64
|
const n = Number.parseInt(h.slice(1), 16);
|
|
56
65
|
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
@@ -78,28 +87,23 @@ function pinShades(tuple, overrides) {
|
|
|
78
87
|
for (const [i, hex] of Object.entries(overrides)) out[Number(i)] = hex;
|
|
79
88
|
return out;
|
|
80
89
|
}
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"#18181b",
|
|
99
|
-
// deeper than body (= BP.darkGray[0])
|
|
100
|
-
"#09090b"
|
|
101
|
-
// darkest extreme
|
|
102
|
-
];
|
|
90
|
+
const DEFAULT_PALETTE_DATA = buildPaletteData(DEFAULT_DERIVE_CONFIG);
|
|
91
|
+
const DEFAULT_RADIUS_VALUES = deriveRadius(0);
|
|
92
|
+
const DEFAULT_SPACE_VALUES = deriveSpacing(0);
|
|
93
|
+
function buildDarkTuple(data) {
|
|
94
|
+
return [
|
|
95
|
+
data.INK.ink.dark,
|
|
96
|
+
data.INK.ink2.dark,
|
|
97
|
+
data.INK.muted.dark,
|
|
98
|
+
data.INK.faint.dark,
|
|
99
|
+
data.SURFACE.border.dark,
|
|
100
|
+
data.SURFACE.panelHover.dark,
|
|
101
|
+
data.SURFACE.panel.dark,
|
|
102
|
+
data.SURFACE.bg.dark,
|
|
103
|
+
BP.darkGray[0],
|
|
104
|
+
"#09090b"
|
|
105
|
+
];
|
|
106
|
+
}
|
|
103
107
|
function onColor(theme, color) {
|
|
104
108
|
const name = color ?? theme.primaryColor;
|
|
105
109
|
if (!Object.prototype.hasOwnProperty.call(theme.colors, name)) return void 0;
|
|
@@ -123,14 +127,14 @@ function contrastRatio(a, b) {
|
|
|
123
127
|
function legibleOn(background, theme) {
|
|
124
128
|
return contrastRatio(background, theme.white) >= contrastRatio(background, theme.black) ? "var(--mantine-color-white)" : "var(--mantine-color-black)";
|
|
125
129
|
}
|
|
126
|
-
function onColorVars(theme, colorScheme) {
|
|
130
|
+
function onColorVars(theme, colorScheme, data) {
|
|
127
131
|
const shade = getPrimaryShade(theme, colorScheme);
|
|
128
132
|
const vars = {};
|
|
129
133
|
for (const [name, tuple] of Object.entries(theme.colors)) {
|
|
130
134
|
if (!Array.isArray(tuple)) continue;
|
|
131
135
|
const filled = tuple[shade];
|
|
132
136
|
if (typeof filled !== "string") continue;
|
|
133
|
-
vars[`--vx-on-${name}`] = name === theme.primaryColor ? `var(--vx-onAccent, ${ACCENT.onAccent[colorScheme]})` : legibleOn(filled, theme);
|
|
137
|
+
vars[`--vx-on-${name}`] = name === theme.primaryColor ? `var(--vx-onAccent, ${data.ACCENT.onAccent[colorScheme]})` : legibleOn(filled, theme);
|
|
134
138
|
}
|
|
135
139
|
return vars;
|
|
136
140
|
}
|
|
@@ -153,503 +157,600 @@ const basaltVariantColorResolver = (input) => {
|
|
|
153
157
|
border: "none"
|
|
154
158
|
};
|
|
155
159
|
};
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
fontFamily: "var(--basalt-font-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
//
|
|
228
|
-
//
|
|
229
|
-
//
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
160
|
+
function buildTheme(data, options = {}) {
|
|
161
|
+
const { radius = DEFAULT_RADIUS_VALUES, spacing = DEFAULT_SPACE_VALUES } = options;
|
|
162
|
+
const { ACCENT, FILL } = data;
|
|
163
|
+
return createTheme({
|
|
164
|
+
primaryColor: "blue",
|
|
165
|
+
// ONE shade in both schemes — a filled control is a SURFACE, and the accent surface is the same
|
|
166
|
+
// hex either way (see `ACCENT.accentFill`). The scheme-inverting half of the accent lives in
|
|
167
|
+
// Mantine's dark `--mantine-color-{c}-text`, which is hardcoded to shade 4 = `ACCENT.accent.dark`.
|
|
168
|
+
primaryShade: 6,
|
|
169
|
+
autoContrast: true,
|
|
170
|
+
luminanceThreshold: 0.45,
|
|
171
|
+
// Force the `light` variant to a faint, AA-legible tint in both schemes (see resolver above).
|
|
172
|
+
variantColorResolver: basaltVariantColorResolver,
|
|
173
|
+
white: "#ffffff",
|
|
174
|
+
black: "#18181b",
|
|
175
|
+
// The three-font system (docs/DESIGN-SPEC.md §3): Nunito Sans body / Hubot Sans condensed
|
|
176
|
+
// headings / JetBrains Mono for numerals + micro-labels. The `--basalt-font-*` vars stay the
|
|
177
|
+
// override seam (shipped in styles.css, with system-font fallback chains).
|
|
178
|
+
fontFamily: "var(--basalt-font-sans, ui-sans-serif, system-ui, sans-serif)",
|
|
179
|
+
fontFamilyMonospace: "var(--basalt-font-mono, ui-monospace, 'SF Mono', Menlo, monospace)",
|
|
180
|
+
headings: {
|
|
181
|
+
fontFamily: "var(--basalt-font-head, var(--basalt-font-sans, ui-sans-serif, sans-serif))",
|
|
182
|
+
fontWeight: "550"
|
|
183
|
+
},
|
|
184
|
+
// Control radius tier (docs/DESIGN-SPEC.md §4: inputs, search, buttons, segmented track, icon
|
|
185
|
+
// buttons ≥28px sit at ~6px). `radius.md` = 0.375rem = 6px, mirrored by `--vx-radius-ctrl` — every
|
|
186
|
+
// control without its own explicit `radius` prop (Button, ActionIcon, TextInput, NumberInput,
|
|
187
|
+
// PasswordInput, Select, Textarea) falls back to this default. Card/Paper bypass this scale
|
|
188
|
+
// entirely — they resolve straight to `var(--vx-radius-card)` (7px, see the
|
|
189
|
+
// `components.Card`/`Paper` overrides below).
|
|
190
|
+
defaultRadius: "md",
|
|
191
|
+
// Named weight ladder (v9 fontWeights).
|
|
192
|
+
fontWeights: { regular: "400", medium: "500", semibold: "600", bold: "700" },
|
|
193
|
+
// The OWNED type scale — Mantine's xs…xl re-expressed from the single `VX.text` ladder
|
|
194
|
+
// (`tokens/index.ts`), so `<Text size="sm">` and a `--vx-text-sm` CSS module read the same step.
|
|
195
|
+
// Passed through Mantine's `rem()` (→ `calc(Xrem * var(--mantine-scale))`) rather than raw px, so
|
|
196
|
+
// the component surface honors the user's browser font-size and Mantine's own scale factor —
|
|
197
|
+
// the px numbers in `VX.text` exist only for inline styles and visx SVG, which can't take `var()`.
|
|
198
|
+
// `md` is the body step. Mantine's default ladder (12/14/16/18/20) is now fully replaced.
|
|
199
|
+
fontSizes: {
|
|
200
|
+
xs: rem(VX.text.xs),
|
|
201
|
+
sm: rem(VX.text.sm),
|
|
202
|
+
md: rem(VX.text.md),
|
|
203
|
+
lg: rem(VX.text.lg),
|
|
204
|
+
xl: rem(VX.text.xl)
|
|
205
|
+
},
|
|
206
|
+
// Deliberate, OWNED spacing + radius scales — the single edit point, not inherited Mantine
|
|
207
|
+
// defaults. Denser than Mantine's stock lg/xl for a tighter, data-driven surface. 10 12 16 18 24.
|
|
208
|
+
// Reads `spacing.scale`, NOT `spacing.anchors` — a scale stop tracks density independently of
|
|
209
|
+
// any component anchor even where the level-0 numbers coincide (see `SPACE_SCALE`'s doc in
|
|
210
|
+
// `tokens/palette.ts`).
|
|
211
|
+
spacing: {
|
|
212
|
+
xs: pxRem(spacing.scale.xs),
|
|
213
|
+
sm: pxRem(spacing.scale.sm),
|
|
214
|
+
md: pxRem(spacing.scale.md),
|
|
215
|
+
lg: pxRem(spacing.scale.lg),
|
|
216
|
+
xl: pxRem(spacing.scale.xl)
|
|
217
|
+
},
|
|
218
|
+
// 2 4 6 16 32 — the size scale; `md` = `radius.ctrl` (6px at level 0) is the control-radius
|
|
219
|
+
// default (`defaultRadius: 'md'`, inputs/buttons). Card/Paper/Popover/Modal/Notification read
|
|
220
|
+
// `--vx-radius-*` directly instead (7px cards / 6px controls at level 0), so the larger steps of
|
|
221
|
+
// this scale no longer mirror either anchor — `xs`/`lg`/`xl` are independent `RADIUS_STEP`
|
|
222
|
+
// constants (fixed regardless of the radius knob), `sm` shares `radius.fine` with the Progress
|
|
223
|
+
// bar (see below).
|
|
224
|
+
radius: {
|
|
225
|
+
xs: pxRem(RADIUS_STEP.scaleXs),
|
|
226
|
+
sm: pxRem(radius.fine),
|
|
227
|
+
md: pxRem(radius.ctrl),
|
|
228
|
+
lg: pxRem(RADIUS_STEP.scaleLg),
|
|
229
|
+
xl: pxRem(RADIUS_STEP.scaleXl)
|
|
230
|
+
},
|
|
231
|
+
// Shade 6 (= `primaryShade`) is pinned to the FILL BAND for every family, so the JS ramp and the
|
|
232
|
+
// `--vx-fill-*` tokens hold the SAME hex. That keeps `-filled` / `-text`(light) / `-outline`
|
|
233
|
+
// internally consistent, and lets the on-color be measured straight off the tuple (below).
|
|
234
|
+
colors: {
|
|
235
|
+
dark: buildDarkTuple(data),
|
|
236
|
+
gray: pinShades(ramp10(BP.gray), { 6: FILL.gray }),
|
|
237
|
+
blue: pinShades(ramp10(BP.blue), { 4: ACCENT.accent.dark, 6: ACCENT.accentFill.light }),
|
|
238
|
+
cyan: pinShades(ramp10(BP.cerulean), { 6: FILL.cyan }),
|
|
239
|
+
teal: pinShades(ramp10(BP.turquoise), { 6: FILL.teal }),
|
|
240
|
+
green: pinShades(ramp10(BP.forest), { 6: FILL.green }),
|
|
241
|
+
lime: pinShades(ramp10(BP.lime), { 6: FILL.lime }),
|
|
242
|
+
yellow: pinShades(ramp10(BP.gold), { 6: FILL.yellow }),
|
|
243
|
+
orange: pinShades(ramp10(BP.orange), { 6: FILL.orange }),
|
|
244
|
+
red: pinShades(ramp10(BP.red), { 6: FILL.red }),
|
|
245
|
+
pink: pinShades(ramp10(BP.rose), { 6: FILL.pink }),
|
|
246
|
+
grape: pinShades(ramp10(BP.violet), { 6: FILL.grape }),
|
|
247
|
+
violet: pinShades(ramp10(BP.violet), { 6: FILL.violet }),
|
|
248
|
+
indigo: pinShades(ramp10(BP.indigo), { 6: FILL.indigo })
|
|
249
|
+
},
|
|
250
|
+
components: {
|
|
251
|
+
// Depth = `shadow-card` (a whisper shadow + a 1px ring baked into the SAME value) — never a
|
|
252
|
+
// separate `border` property (docs/DESIGN-SPEC.md doctrine inversion #1). Cards carry no
|
|
253
|
+
// `withBorder` at all; the ring lives inside `--vx-shadow-card`.
|
|
254
|
+
// ONE card identity, enforced at the theme so NO component can diverge. Every card-like
|
|
255
|
+
// surface — Mantine `Card`, a bare `Paper` used as a card, and the Mantine-free `ChartCard` —
|
|
256
|
+
// resolves to the SAME three tokens:
|
|
257
|
+
// • background → `--vx-surface-panel` (the panel surface, NOT the page body).
|
|
258
|
+
// • depth → `--vx-shadow-card` (whisper shadow + ring, replaces `withBorder`).
|
|
259
|
+
// • radius → `--vx-radius-card` (7px).
|
|
260
|
+
// This is the single source the user's "strict surface across components" demands; the
|
|
261
|
+
// `raw-surface` guard then stops consumers re-overriding any of it inline.
|
|
262
|
+
Card: Card.extend({
|
|
263
|
+
styles: {
|
|
264
|
+
root: {
|
|
265
|
+
backgroundColor: "var(--vx-surface-panel)",
|
|
266
|
+
boxShadow: "var(--vx-shadow-card)",
|
|
267
|
+
borderRadius: "var(--vx-radius-card)"
|
|
268
|
+
}
|
|
243
269
|
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
270
|
+
}),
|
|
271
|
+
Paper: Paper.extend({
|
|
272
|
+
styles: {
|
|
273
|
+
root: {
|
|
274
|
+
backgroundColor: "var(--vx-surface-panel)",
|
|
275
|
+
boxShadow: "var(--vx-shadow-card)",
|
|
276
|
+
borderRadius: "var(--vx-radius-card)"
|
|
277
|
+
}
|
|
252
278
|
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
279
|
+
}),
|
|
280
|
+
// Mantine's default Badge radius is a full 1000px pill; the spec's delta/status badges sit at
|
|
281
|
+
// radius 6 (docs/DESIGN-SPEC.md §4/§5). Count badges (radius 5) are a distinct, smaller-radius
|
|
282
|
+
// usage left to the call site (`radius={5}` prop) since Badge has no state to key off here.
|
|
283
|
+
Badge: Badge.extend({ defaultProps: { radius: radius.ctrl } }),
|
|
284
|
+
// Alert renders its title in the body font by default; bring it onto the head-font idiom
|
|
285
|
+
// (docs/DESIGN-SPEC.md §5) like every other titled surface. Radius/padding/color tint are
|
|
286
|
+
// already on-system (defaultRadius 'md' control tier + the variant color resolver), so only
|
|
287
|
+
// the title font is overridden.
|
|
288
|
+
Alert: Alert.extend({
|
|
289
|
+
styles: {
|
|
290
|
+
title: {
|
|
291
|
+
fontFamily: "var(--basalt-font-head)",
|
|
292
|
+
fontWeight: 550,
|
|
293
|
+
fontStretch: "88%"
|
|
294
|
+
}
|
|
269
295
|
}
|
|
270
|
-
}
|
|
271
|
-
}),
|
|
272
|
-
// "Ink earns its color" — a nav selection is UI state, not the identity accent on the LABEL.
|
|
273
|
-
// The active item is panel bg + `shadow-card` (forced here at the THEME level via NavLink's
|
|
274
|
-
// `--nl-*` vars, so it holds for every render path — including a consumer's router `<Link>`
|
|
275
|
-
// via `renderNavLink`, which never sees the shell CSS module); the active ICON is
|
|
276
|
-
// accent-colored via `nav-link.module.css` (targets the `[data-position='left']` leftSection,
|
|
277
|
-
// which the flat `vars`/`styles` API can't express conditionally on `[data-active]`).
|
|
278
|
-
NavLink: NavLink.extend({
|
|
279
|
-
vars: () => ({
|
|
280
|
-
root: {
|
|
281
|
-
"--nl-bg": "var(--vx-surface-panel)",
|
|
282
|
-
"--nl-color": "var(--vx-ink)",
|
|
283
|
-
"--nl-hover": "color-mix(in srgb, var(--vx-ink) 6%, transparent)"
|
|
284
|
-
},
|
|
285
|
-
children: {}
|
|
286
296
|
}),
|
|
287
|
-
//
|
|
288
|
-
//
|
|
289
|
-
//
|
|
290
|
-
//
|
|
291
|
-
//
|
|
292
|
-
//
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
Textarea: Textarea.extend({ defaultProps: { size: "md" } }),
|
|
331
|
-
// PillsInput (MultiSelect/TagsInput's outer field) renders `InputBase` internally but under
|
|
332
|
-
// its OWN `__staticSelector: 'PillsInput'`, so it never reads `theme.components.Input` — the
|
|
333
|
-
// field idiom above never reached it. `PillsInput.classes === InputBase.classes`, so the SAME
|
|
334
|
-
// part names apply here; reusing both control classes picks up the exact `[data-variant]` rules
|
|
335
|
-
// in controls.module.css for free, no new CSS needed. Both slots are required — `wrapper` alone
|
|
336
|
-
// would land the vars but leave the field flat, since the depth lives on `input`.
|
|
337
|
-
PillsInput: PillsInput.extend({
|
|
338
|
-
classNames: { wrapper: controlsClasses.inputWrapper, input: controlsClasses.input }
|
|
339
|
-
}),
|
|
340
|
-
// Button / ActionIcon (`default` variant): same `shadow-card` depth as every other control
|
|
341
|
-
// surface (docs/DESIGN-SPEC.md §5: "search trigger … panel + shadow-card", "icon button …
|
|
342
|
-
// panel + shadow-card"; doctrine inversion #1). Background already resolves through the shared
|
|
343
|
-
// `--mantine-color-default` var (→ `--vx-surface-panel`, see cssVariablesResolver below) and
|
|
344
|
-
// the border through `--mantine-color-default-border` (→ transparent, same resolver) — neither
|
|
345
|
-
// component had a `.extend()` block at all before this, which is why they never picked up
|
|
346
|
-
// either. Only the shadow needs adding here, in controls.module.css: Mantine's own
|
|
347
|
-
// `[data-variant='default']` rule never declares a `box-shadow`, so no specificity fight is
|
|
348
|
-
// needed to win one. `filled`/`subtle`/`light` variants are untouched — scoped by attribute
|
|
349
|
-
// selector in the CSS, not here.
|
|
350
|
-
Button: Button.extend({ classNames: { root: controlsClasses.buttonRoot } }),
|
|
351
|
-
ActionIcon: ActionIcon.extend({ classNames: { root: controlsClasses.actionIconRoot } }),
|
|
352
|
-
// CheckboxCard / RadioCard (`withBorder`, true by default): same live regression as Button/
|
|
353
|
-
// ActionIcon before this pass — Mantine ships `border: 1px solid transparent` as the BASE
|
|
354
|
-
// `[data-with-border]` declaration, but its own `:where([data-mantine-color-scheme=…])` block
|
|
355
|
-
// re-colors that to gray-3/dark-4 (pinned to `--vx-surface-border` by the strict-surface lever
|
|
356
|
-
// below), landing a real, flat hairline with no shadow at all — the exact "flat and edgeless"
|
|
357
|
-
// symptom, just via a different mechanism (`[data-with-border]`, not the `default`-variant
|
|
358
|
-
// border var). `.checkboxCardRoot[data-with-border]` / `.radioCardRoot[data-with-border]` are
|
|
359
|
-
// real attribute selectors ((0,2,0)) — Mantine's own rule wraps the same attribute in `:where()`
|
|
360
|
-
// (0 specificity, landing at (0,1,0) total), so no `html[…]` prefix fight is needed here either.
|
|
361
|
-
// Neither component sets a background of its own, so panel bg is added alongside the shadow —
|
|
362
|
-
// the same panel-bg + shadow-card + no-border triad as Card/Paper.
|
|
363
|
-
CheckboxCard: CheckboxCard.extend({
|
|
364
|
-
classNames: { card: controlsClasses.checkboxCardRoot }
|
|
365
|
-
}),
|
|
366
|
-
RadioCard: RadioCard.extend({
|
|
367
|
-
classNames: { card: controlsClasses.radioCardRoot }
|
|
368
|
-
}),
|
|
369
|
-
// Chip: unlike Button/Input, Chip has no literal `variant="default"` — its OWN default (no
|
|
370
|
-
// `variant` prop passed) resolves internally to `variant: 'filled'` (Chip's neutral/unselected
|
|
371
|
-
// look, NOT a "loud" filled color — `light`/`outline` are the other two Chip variants). The
|
|
372
|
-
// unchecked `filled`-variant label already ships a transparent border (`gray-1`/`dark-5` tint,
|
|
373
|
-
// no shadow) — borderless but flat, the same symptom as CheckboxCard/RadioCard above. The class
|
|
374
|
-
// is wired conditionally (function-form `classNames`, same pattern as the `vars` on-color
|
|
375
|
-
// re-points below) so it NEVER reaches a consumer-chosen `light`/`outline` Chip.
|
|
376
|
-
Chip: Chip.extend({
|
|
377
|
-
classNames: (_theme, props) => (props.variant ?? "filled") === "filled" ? { label: controlsClasses.chipLabel } : {}
|
|
378
|
-
}),
|
|
379
|
-
// Track = ink-6% tint, radius 7, 2px padding; active segment = panel bg + `shadow-ctrl`,
|
|
380
|
-
// radius 5. `--sc-radius`/`--sc-color` don't reach the root track background (Mantine
|
|
381
|
-
// hardcodes that to a raw gray step), so it's forced via `styles.root` same as Card/Paper.
|
|
382
|
-
// The active-only ink label color + weight can't live in the flat `styles.label` object
|
|
383
|
-
// (applies to every option regardless of state), so it's in segmented-control.module.css
|
|
384
|
-
// instead — same pattern as NavLink's active-icon accent.
|
|
385
|
-
SegmentedControl: SegmentedControl.extend({
|
|
386
|
-
defaultProps: { radius: 7 },
|
|
387
|
-
classNames: { label: segmentedControlClasses.label },
|
|
388
|
-
styles: {
|
|
389
|
-
root: {
|
|
390
|
-
backgroundColor: "color-mix(in srgb, var(--vx-ink) 6%, transparent)",
|
|
391
|
-
padding: 2
|
|
392
|
-
},
|
|
393
|
-
indicator: {
|
|
394
|
-
backgroundColor: "var(--vx-surface-panel)",
|
|
395
|
-
boxShadow: "var(--vx-shadow-ctrl)",
|
|
396
|
-
borderRadius: 5
|
|
297
|
+
// "Ink earns its color" — a nav selection is UI state, not the identity accent on the LABEL.
|
|
298
|
+
// The active item is panel bg + `shadow-card` (forced here at the THEME level via NavLink's
|
|
299
|
+
// `--nl-*` vars, so it holds for every render path — including a consumer's router `<Link>`
|
|
300
|
+
// via `renderNavLink`, which never sees the shell CSS module); the active ICON is
|
|
301
|
+
// accent-colored via `nav-link.module.css` (targets the `[data-position='left']` leftSection,
|
|
302
|
+
// which the flat `vars`/`styles` API can't express conditionally on `[data-active]`).
|
|
303
|
+
NavLink: NavLink.extend({
|
|
304
|
+
vars: () => ({
|
|
305
|
+
root: {
|
|
306
|
+
"--nl-bg": "var(--vx-surface-panel)",
|
|
307
|
+
"--nl-color": "var(--vx-ink)",
|
|
308
|
+
"--nl-hover": "color-mix(in srgb, var(--vx-ink) 6%, transparent)"
|
|
309
|
+
},
|
|
310
|
+
children: {}
|
|
311
|
+
}),
|
|
312
|
+
// Dense, rounded nav rows — applied at the THEME level so they survive EVERY render path,
|
|
313
|
+
// including a consumer's router `<Link>` via `renderNavLink`, which never sees the shell CSS
|
|
314
|
+
// module (the module's `.link` only reaches the shell's own fallback `<NavLink>`). Same
|
|
315
|
+
// reasoning as the `--nl-*` fill above: layout is single-sourced here, not in two places.
|
|
316
|
+
// The active-weight/shadow/icon-accent state selectors can't live in `styles` (flat inline
|
|
317
|
+
// props only) — they're in nav-link.module.css, wired via `classNames` so they reach the
|
|
318
|
+
// same every-render-path scope.
|
|
319
|
+
classNames: { root: navLinkClasses.root },
|
|
320
|
+
styles: {
|
|
321
|
+
root: {
|
|
322
|
+
// Row geometry (docs/DESIGN-SPEC.md §5): 6px 10px padding lands ~29-30px rows. Mantine
|
|
323
|
+
// v9 hardcodes NavLink padding (`8px var(--mantine-spacing-sm)` — there is NO
|
|
324
|
+
// `--nl-padding` var), so the spec padding is forced inline here, where it wins
|
|
325
|
+
// deterministically on every render path.
|
|
326
|
+
padding: "var(--vx-space-row-inset-y) var(--vx-space-row-inset-x)",
|
|
327
|
+
// The body step on the ROOT, not just the label: the body element sizes itself from the
|
|
328
|
+
// root's inherited line-height (which, left at the default 1.55, alone pushed rows to
|
|
329
|
+
// ~37px). The tightened 1.35 keeps rows compact as the scale grows. Reads
|
|
330
|
+
// `--vx-space-row-line-height` (density-tracking, ADDITIVE law — see `deriveSpacing`'s
|
|
331
|
+
// doc in `tokens/palette.ts` for why this one differs from the padding's multiplier).
|
|
332
|
+
fontSize: VX.text.md,
|
|
333
|
+
lineHeight: "var(--vx-space-row-line-height)",
|
|
334
|
+
// Nav rows sit in the 5-6px radius tier (docs/DESIGN-SPEC.md §4), not square.
|
|
335
|
+
borderRadius: "var(--vx-radius-ctrl)"
|
|
336
|
+
},
|
|
337
|
+
// Mantine pins the label at `font-size-sm` explicitly, so the root value alone
|
|
338
|
+
// doesn't reach it.
|
|
339
|
+
label: { fontSize: VX.text.md, lineHeight: "var(--vx-space-row-line-height)" }
|
|
397
340
|
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
341
|
+
}),
|
|
342
|
+
// Field idiom (docs/DESIGN-SPEC.md §5): field surface + `shadow-card` depth + faint placeholder,
|
|
343
|
+
// accent border + subtle accent ring on focus — see controls.module.css. The two slots carry
|
|
344
|
+
// different halves of it: the `wrapper` is where Mantine declares the `--input-*` vars, the
|
|
345
|
+
// `input` is the box that actually paints the surface (bg + radius) and therefore the only
|
|
346
|
+
// legal home for the shadow's ring. Theming the base `Input` covers
|
|
347
|
+
// TextInput/NumberInput/PasswordInput/Select/Textarea, which all render it internally (only
|
|
348
|
+
// `size` needs per-component defaults, since each resolves its own).
|
|
349
|
+
Input: Input.extend({
|
|
350
|
+
defaultProps: { size: "md" },
|
|
351
|
+
// Density coupling: Input's OWN `varsResolver` sets `--input-height` to
|
|
352
|
+
// `getSize(props.size, 'input-height')` (`@mantine/core/esm/components/Input/Input.mjs`),
|
|
353
|
+
// which resolves to Mantine's global, non-retunable
|
|
354
|
+
// `--input-height-md: calc(2.625rem * var(--mantine-scale))` — IDENTICAL in both
|
|
355
|
+
// `styles.css` and the `styles.layer.css` variant Basalt consumers actually load (verified
|
|
356
|
+
// in the installed package, not assumed). It is rem-relative to the root font size AND
|
|
357
|
+
// scale-aware, not a flat px — so the override must reconstruct BOTH halves, not just the
|
|
358
|
+
// number: `--vx-space-input-height` (`tokens/index.ts`) already carries the rem half (via
|
|
359
|
+
// `pxRem`, the same conversion the `spacing`/`radius` scales use), and the
|
|
360
|
+
// `calc(... * var(--mantine-scale))` wrapper here supplies the scale half — the tokens
|
|
361
|
+
// layer stays Mantine-free, so it cannot reference `--mantine-scale` itself; this
|
|
362
|
+
// Mantine-coupled call site is where that coupling is legitimate. Flattening either half into a bare px value
|
|
363
|
+
// would desync input height from a user's root-font-size accessibility setting and from
|
|
364
|
+
// Mantine's global `--mantine-scale` knob — a real regression, not a cosmetic one. Theme
|
|
365
|
+
// `vars` here merges AFTER a component's own `varsResolver` (Mantine `useStyles`'s
|
|
366
|
+
// `mergeVars`, confirmed in `core/styles-api/use-styles/use-styles.mjs`), so re-pointing
|
|
367
|
+
// `--input-height` here wins on every render path — same established pattern as NavLink's
|
|
368
|
+
// `--nl-*` fill / Checkbox's `--checkbox-icon-color` above. Scoped to `size === 'md'` (the
|
|
369
|
+
// framework's own default, set by `defaultProps` above): a caller that explicitly requests a
|
|
370
|
+
// different size (e.g. `size="xs"`, see the iOS-floor note above) keeps Mantine's own static
|
|
371
|
+
// height for that size — `undefined` here means "leave Mantine's value alone" (`mergeVars`
|
|
372
|
+
// strips it before merging).
|
|
373
|
+
vars: (_theme, props) => ({
|
|
374
|
+
wrapper: {
|
|
375
|
+
"--input-height": props.size === "md" ? "calc(var(--vx-space-input-height) * var(--mantine-scale))" : void 0
|
|
376
|
+
}
|
|
377
|
+
}),
|
|
378
|
+
classNames: { wrapper: controlsClasses.inputWrapper, input: controlsClasses.input }
|
|
379
|
+
}),
|
|
380
|
+
TextInput: TextInput.extend({ defaultProps: { size: "md" } }),
|
|
381
|
+
NumberInput: NumberInput.extend({ defaultProps: { size: "md" } }),
|
|
382
|
+
PasswordInput: PasswordInput.extend({ defaultProps: { size: "md" } }),
|
|
383
|
+
Select: Select.extend({ defaultProps: { size: "md" } }),
|
|
384
|
+
Textarea: Textarea.extend({ defaultProps: { size: "md" } }),
|
|
385
|
+
// PillsInput (MultiSelect/TagsInput's outer field) renders `InputBase` internally but under
|
|
386
|
+
// its OWN `__staticSelector: 'PillsInput'`, so it never reads `theme.components.Input` — the
|
|
387
|
+
// field idiom above never reached it. `PillsInput.classes === InputBase.classes`, so the SAME
|
|
388
|
+
// part names apply here; reusing both control classes picks up the exact `[data-variant]` rules
|
|
389
|
+
// in controls.module.css for free, no new CSS needed. Both slots are required — `wrapper` alone
|
|
390
|
+
// would land the vars but leave the field flat, since the depth lives on `input`.
|
|
391
|
+
PillsInput: PillsInput.extend({
|
|
392
|
+
classNames: { wrapper: controlsClasses.inputWrapper, input: controlsClasses.input }
|
|
393
|
+
}),
|
|
394
|
+
// Button / ActionIcon (`default` variant): same `shadow-card` depth as every other control
|
|
395
|
+
// surface (docs/DESIGN-SPEC.md §5: "search trigger … panel + shadow-card", "icon button …
|
|
396
|
+
// panel + shadow-card"; doctrine inversion #1). Background already resolves through the shared
|
|
397
|
+
// `--mantine-color-default` var (→ `--vx-surface-panel`, see cssVariablesResolver below) and
|
|
398
|
+
// the border through `--mantine-color-default-border` (→ transparent, same resolver) — neither
|
|
399
|
+
// component had a `.extend()` block at all before this, which is why they never picked up
|
|
400
|
+
// either. Only the shadow needs adding here, in controls.module.css: Mantine's own
|
|
401
|
+
// `[data-variant='default']` rule never declares a `box-shadow`, so no specificity fight is
|
|
402
|
+
// needed to win one. `filled`/`subtle`/`light` variants are untouched — scoped by attribute
|
|
403
|
+
// selector in the CSS, not here.
|
|
404
|
+
//
|
|
405
|
+
// Density coupling: mirrors Input's `--input-height` override above — Mantine's OWN
|
|
406
|
+
// `--button-height-md`/`--ai-size` (via `--ai-size-md`) are global, non-retunable statics
|
|
407
|
+
// (`getSize(size, 'button-height'/'ai-size')`, `@mantine/core/esm/components/{Button,
|
|
408
|
+
// ActionIcon}/{Button,ActionIcon}.mjs`), so a `size="md"` Button/ActionIcon placed beside a
|
|
409
|
+
// `size="md"` Input (the framework's own default, set by `defaultProps` above) only matched the
|
|
410
|
+
// Input's height at density level 0 — every other level left the two heights diverging by as
|
|
411
|
+
// much as 13px. `--vx-space-control-height` (`tokens/index.ts`) is single-sourced from the
|
|
412
|
+
// SAME `SPACE_ANCHORS_BASE.controlHeight` anchor `--vx-space-input-height` reads (see that
|
|
413
|
+
// anchor's doc in `tokens/palette.ts`), so the two can never drift. Scoped to `size === 'md'`,
|
|
414
|
+
// same rationale as Input's override: `undefined` leaves an explicitly different size (e.g.
|
|
415
|
+
// `size="xs"`) on Mantine's own static height.
|
|
416
|
+
Button: Button.extend({
|
|
417
|
+
classNames: { root: controlsClasses.buttonRoot },
|
|
418
|
+
vars: (_theme, props) => ({
|
|
419
|
+
root: {
|
|
420
|
+
"--button-height": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0
|
|
421
|
+
}
|
|
422
|
+
})
|
|
423
|
+
}),
|
|
424
|
+
ActionIcon: ActionIcon.extend({
|
|
425
|
+
classNames: { root: controlsClasses.actionIconRoot },
|
|
426
|
+
vars: (_theme, props) => ({
|
|
427
|
+
root: {
|
|
428
|
+
"--ai-size": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0
|
|
429
|
+
}
|
|
430
|
+
})
|
|
431
|
+
}),
|
|
432
|
+
// CheckboxCard / RadioCard (`withBorder`, true by default): same live regression as Button/
|
|
433
|
+
// ActionIcon before this pass — Mantine ships `border: 1px solid transparent` as the BASE
|
|
434
|
+
// `[data-with-border]` declaration, but its own `:where([data-mantine-color-scheme=…])` block
|
|
435
|
+
// re-colors that to gray-3/dark-4 (pinned to `--vx-surface-border` by the strict-surface lever
|
|
436
|
+
// below), landing a real, flat hairline with no shadow at all — the exact "flat and edgeless"
|
|
437
|
+
// symptom, just via a different mechanism (`[data-with-border]`, not the `default`-variant
|
|
438
|
+
// border var). `.checkboxCardRoot[data-with-border]` / `.radioCardRoot[data-with-border]` are
|
|
439
|
+
// real attribute selectors ((0,2,0)) — Mantine's own rule wraps the same attribute in `:where()`
|
|
440
|
+
// (0 specificity, landing at (0,1,0) total), so no `html[…]` prefix fight is needed here either.
|
|
441
|
+
// Neither component sets a background of its own, so panel bg is added alongside the shadow —
|
|
442
|
+
// the same panel-bg + shadow-card + no-border triad as Card/Paper.
|
|
443
|
+
CheckboxCard: CheckboxCard.extend({
|
|
444
|
+
classNames: { card: controlsClasses.checkboxCardRoot }
|
|
445
|
+
}),
|
|
446
|
+
RadioCard: RadioCard.extend({
|
|
447
|
+
classNames: { card: controlsClasses.radioCardRoot }
|
|
448
|
+
}),
|
|
449
|
+
// Chip: unlike Button/Input, Chip has no literal `variant="default"` — its OWN default (no
|
|
450
|
+
// `variant` prop passed) resolves internally to `variant: 'filled'` (Chip's neutral/unselected
|
|
451
|
+
// look, NOT a "loud" filled color — `light`/`outline` are the other two Chip variants). The
|
|
452
|
+
// unchecked `filled`-variant label already ships a transparent border (`gray-1`/`dark-5` tint,
|
|
453
|
+
// no shadow) — borderless but flat, the same symptom as CheckboxCard/RadioCard above. The class
|
|
454
|
+
// is wired conditionally (function-form `classNames`, same pattern as the `vars` on-color
|
|
455
|
+
// re-points below) so it NEVER reaches a consumer-chosen `light`/`outline` Chip.
|
|
456
|
+
Chip: Chip.extend({
|
|
457
|
+
classNames: (_theme, props) => (props.variant ?? "filled") === "filled" ? { label: controlsClasses.chipLabel } : {}
|
|
458
|
+
}),
|
|
459
|
+
// Track = ink-6% tint, radius 7, 2px padding; active segment = panel bg + `shadow-ctrl`,
|
|
460
|
+
// radius 5. `--sc-radius`/`--sc-color` don't reach the root track background (Mantine
|
|
461
|
+
// hardcodes that to a raw gray step), so it's forced via `styles.root` same as Card/Paper.
|
|
462
|
+
// The active-only ink label color + weight can't live in the flat `styles.label` object
|
|
463
|
+
// (applies to every option regardless of state), so it's in segmented-control.module.css
|
|
464
|
+
// instead — same pattern as NavLink's active-icon accent.
|
|
465
|
+
//
|
|
466
|
+
// The track's padding is `SPACE_FIXED.segmentedTrackInset`, a plain literal — NOT a
|
|
467
|
+
// `--vx-space-*` var — because it is density-EXEMPT: it is load-bearing for the nested-corner
|
|
468
|
+
// law (`RADIUS.card === RADIUS_STEP.tight + segmentedTrackInset`, see that constant's doc in
|
|
469
|
+
// `tokens/palette.ts`), and `radius.card`/`RADIUS_STEP.tight` two lines below already track the
|
|
470
|
+
// RADIUS knob together, so the inset between them must stay fixed at exactly 2 regardless of
|
|
471
|
+
// density.
|
|
472
|
+
SegmentedControl: SegmentedControl.extend({
|
|
473
|
+
defaultProps: { radius: radius.card },
|
|
474
|
+
classNames: { label: segmentedControlClasses.label },
|
|
475
|
+
styles: {
|
|
476
|
+
root: {
|
|
477
|
+
backgroundColor: "color-mix(in srgb, var(--vx-ink) 6%, transparent)",
|
|
478
|
+
padding: `${SPACE_FIXED.segmentedTrackInset}px`
|
|
479
|
+
},
|
|
480
|
+
indicator: {
|
|
481
|
+
backgroundColor: "var(--vx-surface-panel)",
|
|
482
|
+
boxShadow: "var(--vx-shadow-ctrl)",
|
|
483
|
+
borderRadius: "var(--vx-radius-tight)"
|
|
484
|
+
}
|
|
434
485
|
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
// by the resolver below, so dropdown and arrow always share the same edge color.)
|
|
445
|
-
// Tooltip is a standalone floating primitive (not Popover-based) — themed directly. Its arrow
|
|
446
|
-
// ships border-less (`border: 0`), so the same edge is applied inline to keep the ring closed.
|
|
447
|
-
Tooltip: Tooltip.extend({
|
|
448
|
-
defaultProps: { radius: 8 },
|
|
449
|
-
styles: {
|
|
450
|
-
tooltip: {
|
|
451
|
-
backgroundColor: "var(--vx-surface-overlay)",
|
|
452
|
-
color: "var(--vx-ink)",
|
|
453
|
-
border: "1px solid var(--vx-surface-border)",
|
|
454
|
-
boxShadow: "var(--vx-shadow-overlay)"
|
|
455
|
-
},
|
|
456
|
-
arrow: { border: "1px solid var(--vx-surface-border)" }
|
|
457
|
-
}
|
|
458
|
-
}),
|
|
459
|
-
// Popover is the shared floating primitive underneath Menu (Menu renders `<Popover>`
|
|
460
|
-
// internally with no `radius`/`shadow` of its own), so theming it here covers both.
|
|
461
|
-
Popover: Popover.extend({
|
|
462
|
-
defaultProps: { radius: 8 },
|
|
463
|
-
styles: {
|
|
464
|
-
dropdown: {
|
|
465
|
-
backgroundColor: "var(--vx-surface-overlay)",
|
|
466
|
-
border: "1px solid var(--vx-surface-border)",
|
|
467
|
-
boxShadow: "var(--vx-shadow-overlay)"
|
|
486
|
+
}),
|
|
487
|
+
// Track = ink-8%; leader/section fill colors are a per-usage `color` prop (left to consumers).
|
|
488
|
+
Progress: Progress.extend({
|
|
489
|
+
// `size` is a NUMBER, not a `var()` string — same rem()-comma-trap reasoning as Timeline's
|
|
490
|
+
// `bulletSize`/`lineWidth` below, so it reads the resolved `spacing.step.progressBarSize`
|
|
491
|
+
// (density-tracking) rather than a hand-typed literal.
|
|
492
|
+
defaultProps: { size: spacing.step.progressBarSize, radius: radius.fine },
|
|
493
|
+
styles: {
|
|
494
|
+
root: { backgroundColor: "color-mix(in srgb, var(--vx-ink) 8%, transparent)" }
|
|
468
495
|
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
496
|
+
}),
|
|
497
|
+
// Activity-feed idiom: 20-24px bullet, hairline connecting line (not Mantine's heavy default),
|
|
498
|
+
// head-weight title, muted body — zero call-site work for an on-spec Timeline. `bulletSize`/
|
|
499
|
+
// `lineWidth` land through Timeline's OWN `varsResolver` (real component vars, not our `styles`
|
|
500
|
+
// object), so they aren't subject to the custom-property stripping below. The bullet's
|
|
501
|
+
// panel/hairline/accent-active treatment and the line's divider color ARE custom-property
|
|
502
|
+
// declarations / state-selectors — both unreachable from a flat `styles` object (same
|
|
503
|
+
// reasoning as SegmentedControl's active-label rule and NavLink's active-icon rule) — so they
|
|
504
|
+
// live in `timeline.module.css` instead. `TimelineItem` renders through the PARENT Timeline's
|
|
505
|
+
// style context (`ctx.getStyles`), so `item`/`itemBullet`/`itemTitle`/`itemContent` are all
|
|
506
|
+
// themed from this ONE extend — no separate `TimelineItem` override needed.
|
|
507
|
+
Timeline: Timeline.extend({
|
|
508
|
+
// NUMBERS, not `var()` strings: `bulletSize`/`lineWidth` land through Timeline's own
|
|
509
|
+
// `rem()` conversion (`@mantine/core/esm/core/utils/units-converters/rem.mjs` splits on `,`
|
|
510
|
+
// and ` ` before checking numerics), which passes a bare `var(--x)` through intact but
|
|
511
|
+
// silently mangles a `var(--x, <fallback>)` into garbage CSS — never add a fallback here.
|
|
512
|
+
defaultProps: { bulletSize: spacing.step.timelineBullet, lineWidth: SPACE_FIXED.hairline },
|
|
513
|
+
// The active bullet's icon sits on the accent fill — on-color, not a baked white (see above).
|
|
514
|
+
vars: (theme, props) => ({ root: { "--tl-icon-color": onColorFor(theme, props) } }),
|
|
515
|
+
classNames: {
|
|
516
|
+
item: timelineClasses.item,
|
|
517
|
+
itemBullet: timelineClasses.itemBullet
|
|
491
518
|
},
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
boxShadow: "var(--vx-shadow-overlay)"
|
|
519
|
+
styles: {
|
|
520
|
+
itemTitle: {
|
|
521
|
+
fontSize: VX.text.md,
|
|
522
|
+
fontWeight: 600,
|
|
523
|
+
color: "var(--vx-ink)"
|
|
524
|
+
},
|
|
525
|
+
itemContent: {
|
|
526
|
+
fontSize: VX.text.md,
|
|
527
|
+
color: "var(--vx-muted)"
|
|
528
|
+
}
|
|
503
529
|
}
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
},
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
530
|
+
}),
|
|
531
|
+
// ── Floating layer (docs/DESIGN-SPEC.md §5) ─────────────────────────────────────────────
|
|
532
|
+
// ONE idiom for every detached surface: overlay surface + a REAL 1px `--vx-surface-border`
|
|
533
|
+
// border + the overlay elevation shadow. The border must be a real `border` property (never
|
|
534
|
+
// "ring in the shadow" like cards): Mantine's arrow is a rotated square that draws
|
|
535
|
+
// `1px solid var(--popover-border-color)` and inherits the dropdown's background — with
|
|
536
|
+
// `border: 'none'` on the dropdown the arrow rendered as a broken floating diamond edge.
|
|
537
|
+
// (`--popover-border-color` resolves to gray-2/dark-4, both pinned to `--vx-surface-border`
|
|
538
|
+
// by the resolver below, so dropdown and arrow always share the same edge color.)
|
|
539
|
+
// Tooltip is a standalone floating primitive (not Popover-based) — themed directly. Its arrow
|
|
540
|
+
// ships border-less (`border: 0`), so the same edge is applied inline to keep the ring closed.
|
|
541
|
+
Tooltip: Tooltip.extend({
|
|
542
|
+
defaultProps: { radius: radius.floating },
|
|
543
|
+
styles: {
|
|
544
|
+
tooltip: {
|
|
545
|
+
backgroundColor: "var(--vx-surface-overlay)",
|
|
546
|
+
color: "var(--vx-ink)",
|
|
547
|
+
border: "1px solid var(--vx-surface-border)",
|
|
548
|
+
boxShadow: "var(--vx-shadow-overlay)"
|
|
549
|
+
},
|
|
550
|
+
arrow: { border: "1px solid var(--vx-surface-border)" }
|
|
522
551
|
}
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
fontFamily: "var(--basalt-font-head)",
|
|
535
|
-
fontWeight: 550,
|
|
536
|
-
fontStretch: "88%"
|
|
552
|
+
}),
|
|
553
|
+
// Popover is the shared floating primitive underneath Menu (Menu renders `<Popover>`
|
|
554
|
+
// internally with no `radius`/`shadow` of its own), so theming it here covers both.
|
|
555
|
+
Popover: Popover.extend({
|
|
556
|
+
defaultProps: { radius: radius.floating },
|
|
557
|
+
styles: {
|
|
558
|
+
dropdown: {
|
|
559
|
+
backgroundColor: "var(--vx-surface-overlay)",
|
|
560
|
+
border: "1px solid var(--vx-surface-border)",
|
|
561
|
+
boxShadow: "var(--vx-shadow-overlay)"
|
|
562
|
+
}
|
|
537
563
|
}
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
564
|
+
}),
|
|
565
|
+
// Menu rows: 13px, radius 6, ghost ink-6% hover (floating.module.css — custom properties are
|
|
566
|
+
// stripped from `styles` objects, and Menu's internal Popover does NOT consume
|
|
567
|
+
// `components.Popover.styles`, so the dropdown surface is repeated here). Menu.Label = the
|
|
568
|
+
// mono micro-label idiom; dividers use the layout-divider token.
|
|
569
|
+
Menu: Menu.extend({
|
|
570
|
+
classNames: { item: floatingClasses.menuItem },
|
|
571
|
+
styles: {
|
|
572
|
+
dropdown: {
|
|
573
|
+
backgroundColor: "var(--vx-surface-overlay)",
|
|
574
|
+
border: "1px solid var(--vx-surface-border)",
|
|
575
|
+
boxShadow: "var(--vx-shadow-overlay)"
|
|
576
|
+
},
|
|
577
|
+
item: {
|
|
578
|
+
fontSize: VX.text.md,
|
|
579
|
+
borderRadius: "var(--vx-radius-ctrl)",
|
|
580
|
+
padding: "var(--vx-space-row-inset-y) var(--vx-space-row-inset-x)"
|
|
581
|
+
},
|
|
582
|
+
label: {
|
|
583
|
+
fontFamily: "var(--basalt-font-mono)",
|
|
584
|
+
fontSize: VX.text.micro,
|
|
585
|
+
fontWeight: 500,
|
|
586
|
+
letterSpacing: "0.06em",
|
|
587
|
+
textTransform: "uppercase",
|
|
588
|
+
color: "var(--vx-faint)"
|
|
589
|
+
},
|
|
590
|
+
divider: { borderColor: "var(--vx-divider)" }
|
|
551
591
|
}
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
592
|
+
}),
|
|
593
|
+
// Combobox is the floating primitive underneath Select/Autocomplete/MultiSelect — like Menu,
|
|
594
|
+
// it doesn't consume `components.Popover.styles`, so the overlay dropdown idiom is repeated.
|
|
595
|
+
Combobox: Combobox.extend({
|
|
596
|
+
styles: {
|
|
597
|
+
dropdown: {
|
|
598
|
+
backgroundColor: "var(--vx-surface-overlay)",
|
|
599
|
+
border: "1px solid var(--vx-surface-border)",
|
|
600
|
+
boxShadow: "var(--vx-shadow-overlay)"
|
|
601
|
+
}
|
|
559
602
|
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
603
|
+
}),
|
|
604
|
+
// Modal/Drawer: overlay surface + overlay shadow on the content. The header goes transparent —
|
|
605
|
+
// Mantine paints it `--mantine-color-body`, which read as a grey band over the overlay
|
|
606
|
+
// surface. Title = head font; close button = the ghost idiom (floating.module.css).
|
|
607
|
+
Modal: Modal.extend({
|
|
608
|
+
defaultProps: { radius: radius.floating },
|
|
609
|
+
classNames: { close: floatingClasses.closeButton },
|
|
610
|
+
styles: {
|
|
611
|
+
content: {
|
|
612
|
+
backgroundColor: "var(--vx-surface-overlay)",
|
|
613
|
+
boxShadow: "var(--vx-shadow-overlay)"
|
|
614
|
+
},
|
|
615
|
+
header: { backgroundColor: "transparent" },
|
|
616
|
+
title: {
|
|
617
|
+
fontFamily: "var(--basalt-font-head)",
|
|
618
|
+
fontWeight: 550,
|
|
619
|
+
fontStretch: "88%"
|
|
620
|
+
}
|
|
576
621
|
}
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
// an upstream type gap, so the var it actually paints the active tab with is otherwise
|
|
592
|
-
// unreachable from the theme.
|
|
593
|
-
vars: (theme, props) => ({ root: { "--tabs-text-color": onColorFor(theme, props) } })
|
|
594
|
-
}),
|
|
595
|
-
// ── ON-COLOR re-points (see the ON-COLOR doctrine above) ────────────────────────────────
|
|
596
|
-
// These components never reach `variantColorResolver` — each calls Mantine's `getContrastColor`
|
|
597
|
-
// straight from its own `varsResolver`, so each bakes the same scheme-blind white into its ONE
|
|
598
|
-
// foreground var. Theme `vars` merge AFTER a component's own `varsResolver` (Mantine
|
|
599
|
-
// `useStyles`), so re-pointing that var here wins on every render path. Without this, a dark-mode
|
|
600
|
-
// Checkbox/Radio paints a white checkmark on the light accent fill — invisible.
|
|
601
|
-
Checkbox: Checkbox.extend({
|
|
602
|
-
vars: (theme, props) => ({
|
|
603
|
-
root: {
|
|
604
|
-
// `iconColor` is an explicit call-site override, and `outline` paints the mark in the
|
|
605
|
-
// color itself on a transparent box — neither is an on-color surface.
|
|
606
|
-
"--checkbox-icon-color": props.iconColor || props.variant === "outline" ? void 0 : onColorFor(theme, props)
|
|
622
|
+
}),
|
|
623
|
+
Drawer: Drawer.extend({
|
|
624
|
+
classNames: { close: floatingClasses.closeButton },
|
|
625
|
+
styles: {
|
|
626
|
+
content: {
|
|
627
|
+
backgroundColor: "var(--vx-surface-overlay)",
|
|
628
|
+
boxShadow: "var(--vx-shadow-overlay)"
|
|
629
|
+
},
|
|
630
|
+
header: { backgroundColor: "transparent" },
|
|
631
|
+
title: {
|
|
632
|
+
fontFamily: "var(--basalt-font-head)",
|
|
633
|
+
fontWeight: 550,
|
|
634
|
+
fontStretch: "88%"
|
|
635
|
+
}
|
|
607
636
|
}
|
|
608
|
-
})
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
637
|
+
}),
|
|
638
|
+
// Kbd/Code share the ink-tint idiom (docs/DESIGN-SPEC.md §2: "segmented-control track /
|
|
639
|
+
// count-badge bg: ink 6–8%") — mono, ink-7% bg, radius 5.
|
|
640
|
+
// Flat mono chip (mock's ⌘K badge) — Mantine's default Kbd draws a 3px "keyboard key" bottom
|
|
641
|
+
// border that reads as a heavy off-system rule, so the border goes entirely.
|
|
642
|
+
Kbd: Kbd.extend({
|
|
643
|
+
styles: {
|
|
644
|
+
root: {
|
|
645
|
+
backgroundColor: "color-mix(in srgb, var(--vx-ink) 7%, transparent)",
|
|
646
|
+
border: "none",
|
|
647
|
+
color: "var(--vx-ink2)",
|
|
648
|
+
borderRadius: "var(--vx-radius-tight)"
|
|
649
|
+
}
|
|
614
650
|
}
|
|
615
|
-
})
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
Stepper: Stepper.extend({
|
|
623
|
-
vars: (theme, props) => ({ root: { "--stepper-icon-color": onColorFor(theme, props) } })
|
|
624
|
-
}),
|
|
625
|
-
Indicator: Indicator.extend({
|
|
626
|
-
vars: (theme, props) => ({ root: { "--indicator-text-color": onColorFor(theme, props) } })
|
|
627
|
-
}),
|
|
628
|
-
// Accordion (default variant): hairline separators between items only — the color retune AND
|
|
629
|
-
// the last item's outer border-bottom drop both live in controls.module.css.
|
|
630
|
-
Accordion: Accordion.extend({ classNames: { item: controlsClasses.accordionItem } }),
|
|
631
|
-
// Parents faint, separator line-colored — the current-page treatment (head font, weight) is a
|
|
632
|
-
// shell-level concern (AppBreadcrumbs), not this generic Mantine primitive.
|
|
633
|
-
Breadcrumbs: Breadcrumbs.extend({
|
|
634
|
-
styles: {
|
|
635
|
-
breadcrumb: { color: "var(--vx-faint)" },
|
|
636
|
-
separator: { color: "var(--vx-surface-border)" }
|
|
637
|
-
}
|
|
638
|
-
}),
|
|
639
|
-
// Card idiom — same panel + shadow-card as every other surface.
|
|
640
|
-
Notification: Notification.extend({
|
|
641
|
-
defaultProps: { radius: 8 },
|
|
642
|
-
styles: {
|
|
643
|
-
root: {
|
|
644
|
-
backgroundColor: "var(--vx-surface-panel)",
|
|
645
|
-
boxShadow: "var(--vx-shadow-card)"
|
|
651
|
+
}),
|
|
652
|
+
Code: Code.extend({
|
|
653
|
+
styles: {
|
|
654
|
+
root: {
|
|
655
|
+
backgroundColor: "color-mix(in srgb, var(--vx-ink) 7%, transparent)",
|
|
656
|
+
borderRadius: "var(--vx-radius-tight)"
|
|
657
|
+
}
|
|
646
658
|
}
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
659
|
+
}),
|
|
660
|
+
// Header cells become a micro-label (mono, uppercase, faint) — numeral/tabular styling for
|
|
661
|
+
// body cells is a per-table call-site concern, left to consumers. `--table-border-color`
|
|
662
|
+
// drives row separators AND the opt-in `withTableBorder` outer border — both drop to the
|
|
663
|
+
// hairline (Mantine's default reads gray-3/dark-4 = the STRONG line, too heavy in a card).
|
|
664
|
+
Table: Table.extend({
|
|
665
|
+
classNames: { table: controlsClasses.tableRoot },
|
|
666
|
+
styles: {
|
|
667
|
+
th: {
|
|
668
|
+
fontFamily: "var(--basalt-font-mono)",
|
|
669
|
+
fontSize: VX.text.micro,
|
|
670
|
+
fontWeight: 500,
|
|
671
|
+
letterSpacing: "0.06em",
|
|
672
|
+
textTransform: "uppercase",
|
|
673
|
+
color: "var(--vx-faint)"
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}),
|
|
677
|
+
// The v9 thumb indicator is a center dot painted in the TRACK color — over the remapped
|
|
678
|
+
// neutral track it read as an artifact, so it's disabled: clean track, plain thumb, accent
|
|
679
|
+
// fill when checked (`--switch-color` defaults to the primary filled shade = the accent).
|
|
680
|
+
Switch: Switch.extend({ defaultProps: { withThumbIndicator: false } }),
|
|
681
|
+
// The tab-list bottom rule (and the inactive-tab hover underline) is a layout separator, not
|
|
682
|
+
// control chrome — it reads the divider token instead of the heavy gray-3/dark-4 line
|
|
683
|
+
// (controls.module.css; custom properties are stripped from `styles` objects). The active tab
|
|
684
|
+
// underline keeps `--tabs-color` (accent) untouched.
|
|
685
|
+
Tabs: Tabs.extend({
|
|
686
|
+
classNames: { root: controlsClasses.tabsRoot },
|
|
687
|
+
// The on-color re-point (see below). Cast: Mantine's `TabsCssVariables` type declares only
|
|
688
|
+
// `--tabs-color` / `--tabs-radius`, yet Tabs' OWN varsResolver writes `--tabs-text-color` —
|
|
689
|
+
// an upstream type gap, so the var it actually paints the active tab with is otherwise
|
|
690
|
+
// unreachable from the theme.
|
|
691
|
+
vars: (theme, props) => ({ root: { "--tabs-text-color": onColorFor(theme, props) } })
|
|
692
|
+
}),
|
|
693
|
+
// ── ON-COLOR re-points (see the ON-COLOR doctrine above) ────────────────────────────────
|
|
694
|
+
// These components never reach `variantColorResolver` — each calls Mantine's `getContrastColor`
|
|
695
|
+
// straight from its own `varsResolver`, so each bakes the same scheme-blind white into its ONE
|
|
696
|
+
// foreground var. Theme `vars` merge AFTER a component's own `varsResolver` (Mantine
|
|
697
|
+
// `useStyles`), so re-pointing that var here wins on every render path. Without this, a dark-mode
|
|
698
|
+
// Checkbox/Radio paints a white checkmark on the light accent fill — invisible.
|
|
699
|
+
Checkbox: Checkbox.extend({
|
|
700
|
+
vars: (theme, props) => ({
|
|
701
|
+
root: {
|
|
702
|
+
// `iconColor` is an explicit call-site override, and `outline` paints the mark in the
|
|
703
|
+
// color itself on a transparent box — neither is an on-color surface.
|
|
704
|
+
"--checkbox-icon-color": props.iconColor || props.variant === "outline" ? void 0 : onColorFor(theme, props)
|
|
705
|
+
}
|
|
706
|
+
})
|
|
707
|
+
}),
|
|
708
|
+
Radio: Radio.extend({
|
|
709
|
+
vars: (theme, props) => ({
|
|
710
|
+
root: {
|
|
711
|
+
"--radio-icon-color": props.iconColor || props.variant === "outline" ? void 0 : onColorFor(theme, props)
|
|
712
|
+
}
|
|
713
|
+
})
|
|
714
|
+
}),
|
|
715
|
+
Pagination: Pagination.extend({
|
|
716
|
+
vars: (theme, props) => ({
|
|
717
|
+
root: { "--pagination-active-color": onColorFor(theme, props) }
|
|
718
|
+
})
|
|
719
|
+
}),
|
|
720
|
+
Stepper: Stepper.extend({
|
|
721
|
+
vars: (theme, props) => ({ root: { "--stepper-icon-color": onColorFor(theme, props) } })
|
|
722
|
+
}),
|
|
723
|
+
Indicator: Indicator.extend({
|
|
724
|
+
vars: (theme, props) => ({ root: { "--indicator-text-color": onColorFor(theme, props) } })
|
|
725
|
+
}),
|
|
726
|
+
// Accordion (default variant): hairline separators between items only — the color retune AND
|
|
727
|
+
// the last item's outer border-bottom drop both live in controls.module.css.
|
|
728
|
+
Accordion: Accordion.extend({ classNames: { item: controlsClasses.accordionItem } }),
|
|
729
|
+
// Parents faint, separator line-colored — the current-page treatment (head font, weight) is a
|
|
730
|
+
// shell-level concern (AppBreadcrumbs), not this generic Mantine primitive.
|
|
731
|
+
Breadcrumbs: Breadcrumbs.extend({
|
|
732
|
+
styles: {
|
|
733
|
+
breadcrumb: { color: "var(--vx-faint)" },
|
|
734
|
+
separator: { color: "var(--vx-surface-border)" }
|
|
735
|
+
}
|
|
736
|
+
}),
|
|
737
|
+
// Card idiom — same panel + shadow-card as every other surface.
|
|
738
|
+
Notification: Notification.extend({
|
|
739
|
+
defaultProps: { radius: radius.floating },
|
|
740
|
+
styles: {
|
|
741
|
+
root: {
|
|
742
|
+
backgroundColor: "var(--vx-surface-panel)",
|
|
743
|
+
boxShadow: "var(--vx-shadow-card)"
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
})
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
const baseTheme = buildTheme(DEFAULT_PALETTE_DATA);
|
|
751
|
+
function accentBridge(theme, side, data) {
|
|
652
752
|
const c = theme.primaryColor;
|
|
753
|
+
const { ACCENT } = data;
|
|
653
754
|
return {
|
|
654
755
|
[`--mantine-color-${c}-filled`]: `var(--vx-accentFill, ${ACCENT.accentFill[side]})`,
|
|
655
756
|
[`--mantine-color-${c}-filled-hover`]: `var(--vx-accentFillHover, ${ACCENT.accentFillHover[side]})`,
|
|
@@ -658,76 +759,112 @@ function accentBridge(theme, side) {
|
|
|
658
759
|
[`--mantine-color-${c}-light-color`]: `var(--vx-accent, ${ACCENT.accent[side]})`
|
|
659
760
|
};
|
|
660
761
|
}
|
|
661
|
-
function familyBridge() {
|
|
762
|
+
function familyBridge(data) {
|
|
662
763
|
const vars = {};
|
|
663
|
-
for (const [name, hex] of Object.entries(FILL)) {
|
|
764
|
+
for (const [name, hex] of Object.entries(data.FILL)) {
|
|
664
765
|
vars[`--mantine-color-${name}-filled`] = `var(--vx-fill-${name}, ${hex})`;
|
|
665
766
|
vars[`--mantine-color-${name}-filled-hover`] = `var(--vx-fillHover-${name}, color-mix(in srgb, ${hex} 88%, #000))`;
|
|
666
767
|
}
|
|
667
768
|
return vars;
|
|
668
769
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
770
|
+
function buildCssVariablesResolver(data) {
|
|
771
|
+
const { INK, NEUTRAL, SURFACE } = data;
|
|
772
|
+
return (theme) => ({
|
|
773
|
+
variables: {},
|
|
774
|
+
light: {
|
|
775
|
+
...onColorVars(theme, "light", data),
|
|
776
|
+
...familyBridge(data),
|
|
777
|
+
...accentBridge(theme, "light", data),
|
|
778
|
+
"--mantine-color-body": `var(--vx-surface-bg, ${SURFACE.bg.light})`,
|
|
779
|
+
// page background
|
|
780
|
+
"--mantine-color-default": `var(--vx-surface-panel, ${SURFACE.panel.light})`,
|
|
781
|
+
// cards / default controls
|
|
782
|
+
"--mantine-color-default-hover": `var(--vx-surface-elevated, ${SURFACE.elevated.light})`,
|
|
783
|
+
// THE central lever for doctrine inversion #1 on CONTROLS (docs/DESIGN-SPEC.md §8): depth is
|
|
784
|
+
// `shadow-card`, never a hairline, for every `variant="default"` control — not just Card/Paper.
|
|
785
|
+
// `defaultVariantColorsResolver`'s `variant === 'default'` branch reads this ONE var for every
|
|
786
|
+
// component that uses it (Button, ActionIcon, Chip, CheckboxCard, RadioCard, …), so pointing it
|
|
787
|
+
// at `transparent` kills the stock 1px hairline everywhere at once. `transparent`, not `border:
|
|
788
|
+
// none` — the 1px border BOX stays, so focus/error can recolor the same box with no layout
|
|
789
|
+
// shift and `[data-error]` still wins a visible border.
|
|
790
|
+
"--mantine-color-default-border": "transparent",
|
|
791
|
+
"--mantine-color-dimmed": `var(--vx-neutral, ${NEUTRAL.neutral.light})`,
|
|
792
|
+
// secondary / muted text
|
|
793
|
+
"--mantine-color-text": `var(--vx-ink, ${INK.ink.light})`,
|
|
794
|
+
// primary body/heading text
|
|
795
|
+
"--app-shell-border-color": `var(--vx-surface-border, ${SURFACE.border.light})`,
|
|
796
|
+
// THE strict-surface lever. Mantine components do NOT chain border/surface colors through
|
|
797
|
+
// `--mantine-color-default-*`; each hardcodes a RAW ramp step (`--mantine-color-gray-{2,3,4}`
|
|
798
|
+
// on light) directly — which is why AppShell/Table/Input/Divider/Tabs/Popover/Accordion borders
|
|
799
|
+
// render an off-system color while cards use the hairline. Collapse the border-class ramp
|
|
800
|
+
// steps onto the ONE "line" token so EVERY component's border is identical and the agent
|
|
801
|
+
// cannot reintroduce a divergent border. (Hover/subtle BG steps are handled below.)
|
|
802
|
+
"--mantine-color-gray-2": `var(--vx-surface-border, ${SURFACE.border.light})`,
|
|
803
|
+
"--mantine-color-gray-3": `var(--vx-surface-border, ${SURFACE.border.light})`,
|
|
804
|
+
"--mantine-color-gray-4": `var(--vx-surface-border, ${SURFACE.border.light})`,
|
|
805
|
+
// Hover/subtle/striped/track surfaces read `gray-0/1` raw → the dedicated subtle token (a faint
|
|
806
|
+
// step below panel, so hover is actually visible). Dark hover uses the generator-derived
|
|
807
|
+
// dark-5/6/7 steps (`buildDarkTuple`), already on-identity.
|
|
808
|
+
"--mantine-color-gray-0": `var(--vx-surface-subtle, ${SURFACE.subtle.light})`,
|
|
809
|
+
"--mantine-color-gray-1": `var(--vx-surface-subtle, ${SURFACE.subtle.light})`
|
|
810
|
+
},
|
|
811
|
+
dark: {
|
|
812
|
+
...onColorVars(theme, "dark", data),
|
|
813
|
+
...familyBridge(data),
|
|
814
|
+
...accentBridge(theme, "dark", data),
|
|
815
|
+
"--mantine-color-body": `var(--vx-surface-bg, ${SURFACE.bg.dark})`,
|
|
816
|
+
"--mantine-color-default": `var(--vx-surface-panel, ${SURFACE.panel.dark})`,
|
|
817
|
+
"--mantine-color-default-hover": `var(--vx-surface-elevated, ${SURFACE.elevated.dark})`,
|
|
818
|
+
// See the light block above — same lever, both schemes.
|
|
819
|
+
"--mantine-color-default-border": "transparent",
|
|
820
|
+
"--mantine-color-dimmed": `var(--vx-neutral, ${NEUTRAL.neutral.dark})`,
|
|
821
|
+
"--mantine-color-text": `var(--vx-ink, ${INK.ink.dark})`,
|
|
822
|
+
"--app-shell-border-color": `var(--vx-surface-border, ${SURFACE.border.dark})`,
|
|
823
|
+
// Dark components read `--mantine-color-dark-4` (border) raw. `buildDarkTuple` already sets
|
|
824
|
+
// dark-4, but to a slightly lighter step than the hairline token, so layout borders read
|
|
825
|
+
// marginally heavier than card borders. Pin dark-4 to the SAME "line" token for parity.
|
|
826
|
+
"--mantine-color-dark-4": `var(--vx-surface-border, ${SURFACE.border.dark})`
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
const cssVariablesResolver = buildCssVariablesResolver(DEFAULT_PALETTE_DATA);
|
|
831
|
+
function hasFontsConfig(fonts) {
|
|
832
|
+
return fonts !== void 0 && Object.values(fonts).some((value) => value !== void 0);
|
|
833
|
+
}
|
|
834
|
+
function createBasaltTheme(overrides, options) {
|
|
835
|
+
const resolvedConfig = resolveDeriveConfig(options?.derive);
|
|
836
|
+
const radiusLevel = options?.radius ?? 0;
|
|
837
|
+
const radiusValues = deriveRadius(radiusLevel);
|
|
838
|
+
const isDefaultRadius = radiusLevel === 0;
|
|
839
|
+
const densityLevel = options?.density ?? 0;
|
|
840
|
+
const spaceValues = deriveSpacing(densityLevel);
|
|
841
|
+
const isDefaultDensity = densityLevel === 0;
|
|
842
|
+
const isDefaultDerive = isDefaultDeriveConfig(resolvedConfig);
|
|
843
|
+
let theme;
|
|
844
|
+
if (isDefaultDerive && isDefaultRadius && isDefaultDensity) {
|
|
845
|
+
theme = baseTheme;
|
|
846
|
+
} else {
|
|
847
|
+
const paletteData = isDefaultDerive ? DEFAULT_PALETTE_DATA : buildPaletteData(resolvedConfig);
|
|
848
|
+
theme = mergeThemeOverrides(
|
|
849
|
+
buildTheme(paletteData, { radius: radiusValues, spacing: spaceValues }),
|
|
850
|
+
{
|
|
851
|
+
other: {
|
|
852
|
+
...isDefaultDerive ? {} : { basaltDerive: resolvedConfig },
|
|
853
|
+
...isDefaultRadius ? {} : { basaltRadius: radiusValues },
|
|
854
|
+
...isDefaultDensity ? {} : { basaltDensity: spaceValues }
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
);
|
|
858
|
+
}
|
|
859
|
+
const fontsConfig = options?.fonts;
|
|
860
|
+
if (hasFontsConfig(fontsConfig)) {
|
|
861
|
+
theme = mergeThemeOverrides(theme, { other: { basaltFonts: fontsConfig } });
|
|
724
862
|
}
|
|
725
|
-
|
|
726
|
-
function createBasaltTheme(overrides) {
|
|
727
|
-
return overrides ? mergeThemeOverrides(baseTheme, overrides) : baseTheme;
|
|
863
|
+
return overrides ? mergeThemeOverrides(theme, overrides) : theme;
|
|
728
864
|
}
|
|
729
865
|
export {
|
|
730
866
|
baseTheme,
|
|
731
867
|
createBasaltTheme,
|
|
732
|
-
cssVariablesResolver
|
|
868
|
+
cssVariablesResolver,
|
|
869
|
+
useBasaltSpacing
|
|
733
870
|
};
|