basalt-ui 2.23.0 β 2.24.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/CHANGELOG.md +41 -0
- package/MIGRATING.md +225 -12
- package/agent/agents/basalt-design-reviewer.md +2 -2
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/agent/skills/basalt-design/references/catalogue.md +22 -19
- package/agent/skills/basalt-design/references/states.md +39 -0
- package/dist/charts/Bars.d.ts.map +1 -1
- package/dist/charts/Bars.js +17 -2
- package/dist/charts/CartesianChart.d.ts.map +1 -1
- package/dist/charts/CartesianChart.js +7 -3
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +32 -6
- package/dist/charts/StackedArea.d.ts.map +1 -1
- package/dist/charts/StackedArea.js +5 -1
- package/dist/charts/chart-legend.module.css +16 -0
- package/dist/charts/compile.d.ts +2 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +47 -3
- package/dist/charts/legend.d.ts +0 -6
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +87 -35
- package/dist/charts/sparkline.module.css +59 -6
- package/dist/charts/sparkline.module.css.d.ts +1 -0
- package/dist/charts/state.js +1 -1
- package/dist/charts/types.d.ts +11 -0
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +19 -23
- package/dist/dashboard/bar-list.module.css +3 -15
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/meter-model.d.ts +30 -1
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +74 -5
- package/dist/dashboard/meter-parts.d.ts +8 -1
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +64 -21
- package/dist/dashboard/meter.d.ts +8 -1
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +14 -3
- package/dist/dashboard/meter.module.css +42 -2
- package/dist/dashboard/meter.module.css.d.ts +4 -0
- package/dist/dashboard/query-state.d.ts +7 -3
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +14 -6
- package/dist/dashboard/section.d.ts +2 -1
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.module.css +12 -0
- package/dist/dashboard/settings-section.d.ts +1 -1
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +3 -3
- package/dist/dashboard/stat-card.module.css +24 -10
- package/dist/dashboard/stat-group.module.css +8 -0
- package/dist/dashboard/stat-strip.d.ts +3 -2
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +83 -73
- package/dist/dashboard/stat-strip.module.css +22 -38
- package/dist/dashboard/stat-strip.module.css.d.ts +1 -0
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +19 -1
- package/dist/dashboard/widget-header.module.css +6 -0
- package/dist/guard/index.d.ts +2 -2
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +1 -12
- package/dist/table/data-table.js +1 -1
- package/dist/theme/controls.module.css +7 -2
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +7 -5
- package/dist/tokens/palette.d.ts +2 -2
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +2 -2
- package/llms.txt +3 -2
- package/package.json +1 -1
- package/src/charts/Bars.tsx +29 -2
- package/src/charts/CartesianChart.tsx +7 -3
- package/src/charts/Sparkline.tsx +66 -21
- package/src/charts/StackedArea.tsx +12 -1
- package/src/charts/chart-legend.module.css +16 -0
- package/src/charts/compile.ts +84 -2
- package/src/charts/legend.tsx +70 -3
- package/src/charts/sparkline.module.css +59 -6
- package/src/charts/sparkline.module.css.d.ts +1 -0
- package/src/charts/state.tsx +1 -1
- package/src/charts/types.ts +9 -0
- package/src/cli/shot/measure.ts +27 -27
- package/src/dashboard/bar-list.module.css +3 -15
- package/src/dashboard/empty-state.tsx +4 -2
- package/src/dashboard/meter-model.ts +124 -7
- package/src/dashboard/meter-parts.tsx +127 -31
- package/src/dashboard/meter.module.css +42 -2
- package/src/dashboard/meter.module.css.d.ts +4 -0
- package/src/dashboard/meter.tsx +22 -3
- package/src/dashboard/query-state.tsx +19 -8
- package/src/dashboard/section.module.css +12 -0
- package/src/dashboard/section.tsx +2 -1
- package/src/dashboard/settings-section.tsx +4 -4
- package/src/dashboard/stat-card.module.css +24 -10
- package/src/dashboard/stat-group.module.css +8 -0
- package/src/dashboard/stat-strip.module.css +22 -38
- package/src/dashboard/stat-strip.module.css.d.ts +1 -0
- package/src/dashboard/stat-strip.tsx +63 -43
- package/src/dashboard/widget-header.module.css +6 -0
- package/src/dashboard/widget-header.tsx +28 -1
- package/src/guard/index.ts +3 -14
- package/src/table/data-table.tsx +1 -1
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +6 -6
- package/src/theme/controls.module.css +7 -2
- package/src/theme/index.ts +7 -5
- package/src/tokens/palette.ts +2 -2
|
@@ -230,6 +230,12 @@
|
|
|
230
230
|
color: var(--vx-muted);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
/* A Section shell holds three sizes: the title (`md`), this note and the count tag (`xs`), and the
|
|
234
|
+
* body (`sm`). The note steps down to the count tag's rung instead of sitting between them. */
|
|
235
|
+
.root[data-tier='section'] .subtitle {
|
|
236
|
+
font-size: var(--vx-text-xs);
|
|
237
|
+
}
|
|
238
|
+
|
|
233
239
|
/* `data-placement` is read by wave-3 composers wanting a `bleed` layout (docs/CONTROLS-SPEC.md
|
|
234
240
|
* Β§2.2's `sparklinePlacement` composer mapping) β this primitive only ever sets `right`. */
|
|
235
241
|
.sparkline {
|
|
@@ -170,6 +170,14 @@ const BUBBLE_EDGE = 8
|
|
|
170
170
|
|
|
171
171
|
type BubblePos = { top: number; left: number }
|
|
172
172
|
|
|
173
|
+
/** The `basalt-card` container (`ChartCard`/`StatCard`/`Section`) the glyph sits in, if any. */
|
|
174
|
+
function cardOf(trigger: Element): Element | null {
|
|
175
|
+
for (let el = trigger.parentElement; el !== null; el = el.parentElement) {
|
|
176
|
+
if (getComputedStyle(el).containerName.split(/\s+/).includes('basalt-card')) return el
|
|
177
|
+
}
|
|
178
|
+
return null
|
|
179
|
+
}
|
|
180
|
+
|
|
173
181
|
/**
|
|
174
182
|
* Places the bubble in the VIEWPORT: below the glyph, flipped above when it would overflow the
|
|
175
183
|
* bottom edge, shifted sideways to stay inside the left and right edges. Re-places on scroll, resize
|
|
@@ -191,6 +199,8 @@ function useBubblePosition(
|
|
|
191
199
|
// is the same box the placement maths below positions.
|
|
192
200
|
const bubbleEl = bubbleRef.current
|
|
193
201
|
if (bubbleEl !== null && typeof bubbleEl.showPopover === 'function') bubbleEl.showPopover()
|
|
202
|
+
// The card is resolved once per open, not on every scroll re-place.
|
|
203
|
+
const card = triggerRef.current === null ? null : cardOf(triggerRef.current)
|
|
194
204
|
const place = () => {
|
|
195
205
|
const trigger = triggerRef.current
|
|
196
206
|
const bubble = bubbleRef.current
|
|
@@ -202,7 +212,24 @@ function useBubblePosition(
|
|
|
202
212
|
const viewH = document.documentElement.clientHeight
|
|
203
213
|
const below = t.bottom + BUBBLE_GAP
|
|
204
214
|
const above = t.top - BUBBLE_GAP - b.height
|
|
205
|
-
const
|
|
215
|
+
const overflows = below + b.height > viewH - BUBBLE_EDGE
|
|
216
|
+
// Inside a card the bubble never leaves the card's own box upward: above the header is the
|
|
217
|
+
// card above, and a bubble there covers that card's hero. It flips only into room the card
|
|
218
|
+
// itself owns; otherwise it stays below the glyph and slides up just far enough to fit.
|
|
219
|
+
const viewportFlip = above >= BUBBLE_EDGE ? above : below
|
|
220
|
+
let top = below
|
|
221
|
+
if (overflows) {
|
|
222
|
+
// A card scrolled partly off the top has a negative top: never place above the viewport edge.
|
|
223
|
+
const floor =
|
|
224
|
+
card === null ? BUBBLE_EDGE : Math.max(BUBBLE_EDGE, card.getBoundingClientRect().top)
|
|
225
|
+
if (above >= floor) top = above
|
|
226
|
+
else if (card !== null) {
|
|
227
|
+
const slid = Math.max(floor, viewH - BUBBLE_EDGE - b.height)
|
|
228
|
+
// Never cover the glyph itself: when the slid bubble would, take the viewport flip instead.
|
|
229
|
+
const covers = slid < t.bottom && slid + b.height > t.top
|
|
230
|
+
top = covers ? viewportFlip : slid
|
|
231
|
+
}
|
|
232
|
+
}
|
|
206
233
|
const left = Math.max(BUBBLE_EDGE, Math.min(t.left, viewW - BUBBLE_EDGE - b.width))
|
|
207
234
|
setPos((prev) => (prev?.top === top && prev.left === left ? prev : { top, left }))
|
|
208
235
|
}
|
package/src/guard/index.ts
CHANGED
|
@@ -862,8 +862,8 @@ export type GraceEntry = { since: string; promote: string; why: string }
|
|
|
862
862
|
|
|
863
863
|
/**
|
|
864
864
|
* Kinds still inside their grace minor β reported, not fatal, until the next minor promotes them.
|
|
865
|
-
* Empty since
|
|
866
|
-
*
|
|
865
|
+
* Empty since 2.24.0: `raw-spacing` and `inline-spacing` (since 2.16.0), the last tenants, promoted.
|
|
866
|
+
* It was empty once before, at 1.36.0, when `unknown-vx-token` promoted.
|
|
867
867
|
* See {@link GuardSeverity} for the doctrine and why basalt-ui in particular needs it.
|
|
868
868
|
*
|
|
869
869
|
* Adding a kind here is part of shipping it; removing the entry IS the promotion, and belongs in
|
|
@@ -900,18 +900,7 @@ export type GraceEntry = { since: string; promote: string; why: string }
|
|
|
900
900
|
* 'raw-font-family': { since: '1.4.0', promote: '1.5.0', why: 'introduced 1.4.0 β β¦' },
|
|
901
901
|
* }
|
|
902
902
|
*/
|
|
903
|
-
export const GRACE_PERIOD_KINDS: Partial<Record<GuardKind, GraceEntry>> = {
|
|
904
|
-
'raw-spacing': {
|
|
905
|
-
since: '2.16.0',
|
|
906
|
-
promote: '2.24.0',
|
|
907
|
-
why: 'The spacing scale moved to 8/12/16/20/24 in 2.16.0: a prop value equal to a NEW step (p={16}) is newly a finding.',
|
|
908
|
-
},
|
|
909
|
-
'inline-spacing': {
|
|
910
|
-
since: '2.16.0',
|
|
911
|
-
promote: '2.24.0',
|
|
912
|
-
why: 'The scale moved to 8/12/16/20/24 and the CSS micro ceiling dropped 10 β 7 in 2.16.0: a literal 8px/10px in CSS is newly a finding.',
|
|
913
|
-
},
|
|
914
|
-
}
|
|
903
|
+
export const GRACE_PERIOD_KINDS: Partial<Record<GuardKind, GraceEntry>> = {}
|
|
915
904
|
|
|
916
905
|
/** A kind's effective severity: consumer override first, then the grace table, then `error`. */
|
|
917
906
|
export function severityOf(kind: GuardKind, cfg: GuardConfig): GuardSeverity {
|
package/src/table/data-table.tsx
CHANGED
|
@@ -1790,7 +1790,7 @@ export function BasaltDataTable<T extends RowData>(props: BasaltDataTableProps<T
|
|
|
1790
1790
|
const errorNode = queryError !== undefined && (
|
|
1791
1791
|
<ErrorState
|
|
1792
1792
|
error={queryError.error}
|
|
1793
|
-
title="Could not load"
|
|
1793
|
+
title="Could not load rows"
|
|
1794
1794
|
tier="section"
|
|
1795
1795
|
retrying={queryError.fetchStatus === 'fetching'}
|
|
1796
1796
|
onRetry={() => void queryError.refetch()}
|
|
@@ -902,7 +902,7 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
|
|
|
902
902
|
indicator: {
|
|
903
903
|
boxShadow: "var(--vx-shadow-raised)",
|
|
904
904
|
outline: "1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)",
|
|
905
|
-
borderRadius: "max(0px,
|
|
905
|
+
borderRadius: "round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"
|
|
906
906
|
},
|
|
907
907
|
...props.size === "ctl" ? {
|
|
908
908
|
label: {
|
|
@@ -917,11 +917,11 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
|
|
|
917
917
|
"outputs": [
|
|
918
918
|
{
|
|
919
919
|
"probes": 2020,
|
|
920
|
-
"result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"max(0px,
|
|
920
|
+
"result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"}}",
|
|
921
921
|
},
|
|
922
922
|
{
|
|
923
923
|
"probes": 288,
|
|
924
|
-
"result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"max(0px,
|
|
924
|
+
"result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"},"label":{"display":"inline-flex","alignItems":"center","minHeight":"calc(var(--vx-space-control-height-ctl) * var(--mantine-scale) - 4px)"}}",
|
|
925
925
|
},
|
|
926
926
|
],
|
|
927
927
|
},
|
|
@@ -2235,7 +2235,7 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
|
|
|
2235
2235
|
indicator: {
|
|
2236
2236
|
boxShadow: "var(--vx-shadow-raised)",
|
|
2237
2237
|
outline: "1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)",
|
|
2238
|
-
borderRadius: "max(0px,
|
|
2238
|
+
borderRadius: "round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"
|
|
2239
2239
|
},
|
|
2240
2240
|
...props.size === "ctl" ? {
|
|
2241
2241
|
label: {
|
|
@@ -2250,11 +2250,11 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
|
|
|
2250
2250
|
"outputs": [
|
|
2251
2251
|
{
|
|
2252
2252
|
"probes": 2020,
|
|
2253
|
-
"result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"max(0px,
|
|
2253
|
+
"result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"}}",
|
|
2254
2254
|
},
|
|
2255
2255
|
{
|
|
2256
2256
|
"probes": 288,
|
|
2257
|
-
"result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"max(0px,
|
|
2257
|
+
"result": "{"root":{"backgroundColor":"color-mix(in srgb, var(--vx-ink) 8%, transparent)","padding":"2px","minWidth":"max-content"},"indicator":{"boxShadow":"var(--vx-shadow-raised)","outline":"1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)","borderRadius":"round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)"},"label":{"display":"inline-flex","alignItems":"center","minHeight":"calc(var(--vx-space-control-height-ctl) * var(--mantine-scale) - 4px)"}}",
|
|
2258
2258
|
},
|
|
2259
2259
|
],
|
|
2260
2260
|
},
|
|
@@ -368,8 +368,13 @@ html .badgeRoot {
|
|
|
368
368
|
|
|
369
369
|
/*
|
|
370
370
|
* Alert: an inline Code inside it sits one nested step (3px) under the Alert's own radius
|
|
371
|
-
* (craft-1/nested-radius-step)
|
|
371
|
+
* (craft-1/nested-radius-step), snapped down onto the radius scale (2, or 0 under a 5px Alert). The Code theme reads
|
|
372
|
+
* `--basalt-code-radius`; the Alert supplies it.
|
|
372
373
|
*/
|
|
373
374
|
.alertRoot {
|
|
374
|
-
--basalt-code-radius:
|
|
375
|
+
--basalt-code-radius: round(
|
|
376
|
+
down,
|
|
377
|
+
min(2px, max(0px, var(--alert-radius, var(--vx-radius-ctrl)) - 3px)),
|
|
378
|
+
2px
|
|
379
|
+
);
|
|
375
380
|
}
|
package/src/theme/index.ts
CHANGED
|
@@ -778,9 +778,10 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
|
|
|
778
778
|
// The track's padding is `SPACE_FIXED.segmentedTrackInset`, a plain literal β NOT a
|
|
779
779
|
// `--vx-space-*` var β because it is density-EXEMPT (see that constant's doc in
|
|
780
780
|
// `tokens/palette.ts`). The INDICATOR radius is the track's per-instance radius (`--sc-radius`,
|
|
781
|
-
// which Mantine sets on the root from the `radius` prop) minus 3 px
|
|
782
|
-
//
|
|
783
|
-
// and
|
|
781
|
+
// which Mantine sets on the root from the `radius` prop) minus 3 px, snapped DOWN onto the radius
|
|
782
|
+
// scale: `craft-1/nested-radius-step` wants nested surfaces β₯ 3 px apart, SPEC Β§ 8.1 rule 1 wants
|
|
783
|
+
// every radius on a Β§ 5 step, and the only step that satisfies both under a 6 px track is 2
|
|
784
|
+
// (`RADIUS_STEP.scaleXs`; 0 when the track is under 5 px). A custom `radius` therefore nests too.
|
|
784
785
|
SegmentedControl: ext<typeof SegmentedControl>({
|
|
785
786
|
defaultProps: { radius: radius.ctrl },
|
|
786
787
|
classNames: {
|
|
@@ -819,8 +820,9 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
|
|
|
819
820
|
// ink-12% fill sat one shade from the track and read as a hover state.
|
|
820
821
|
boxShadow: 'var(--vx-shadow-raised)',
|
|
821
822
|
outline: '1px solid color-mix(in srgb, var(--vx-ink) 14%, transparent)',
|
|
822
|
-
//
|
|
823
|
-
|
|
823
|
+
// Nested radius snapped to the scale (SPEC Β§ 8.1 rule 1): 2 when the track leaves a 3 px step, else 0.
|
|
824
|
+
// `--sc-radius` has no fallback: `defaultProps.radius` above guarantees Mantine sets it.
|
|
825
|
+
borderRadius: 'round(down,min(2px,max(0px,var(--sc-radius) - 3px)),2px)',
|
|
824
826
|
},
|
|
825
827
|
// Conditionally spread the WHOLE key (never a present `label: undefined`) β the package
|
|
826
828
|
// builds under `exactOptionalPropertyTypes`, which treats a key present-but-`undefined` as
|
package/src/tokens/palette.ts
CHANGED
|
@@ -241,8 +241,8 @@ export const RADIUS_STEP = {
|
|
|
241
241
|
/** SegmentedControl's active indicator, Kbd, Code β one step below the control radius. */
|
|
242
242
|
tight: DEFAULT_RADIUS_VALUES.tight, // 5
|
|
243
243
|
/** Progress bar, and the Mantine scale's `sm` step β two steps below the control radius. (No
|
|
244
|
-
* longer the SegmentedControl indicator: that is the track radius β 3 px
|
|
245
|
-
*
|
|
244
|
+
* longer the SegmentedControl indicator: that is the track radius β 3 px snapped down onto the
|
|
245
|
+
* scale, set in `theme/index.ts`.) */
|
|
246
246
|
fine: DEFAULT_RADIUS_VALUES.fine, // 4
|
|
247
247
|
/** The Mantine `radius` scale's `xs` step β independent of both anchors. */
|
|
248
248
|
scaleXs: 2,
|