basalt-ui 1.30.0 → 1.30.1
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 +8 -0
- package/MIGRATING.md +240 -30
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/kinds/BandStrip.d.ts +5 -3
- package/dist/charts/kinds/BandStrip.d.ts.map +1 -1
- package/dist/charts/kinds/Bars.d.ts +4 -2
- package/dist/charts/kinds/Bars.d.ts.map +1 -1
- package/dist/charts/kinds/Donut.d.ts +4 -2
- package/dist/charts/kinds/Donut.d.ts.map +1 -1
- package/dist/charts/kinds/DualPanel.d.ts +4 -2
- package/dist/charts/kinds/DualPanel.d.ts.map +1 -1
- package/dist/charts/kinds/Heatmap.d.ts +5 -2
- package/dist/charts/kinds/Heatmap.d.ts.map +1 -1
- package/dist/charts/kinds/MirroredBars.d.ts +4 -2
- package/dist/charts/kinds/MirroredBars.d.ts.map +1 -1
- package/dist/charts/kinds/MultiLine.d.ts +4 -2
- package/dist/charts/kinds/MultiLine.d.ts.map +1 -1
- package/dist/charts/kinds/StackedArea.d.ts +4 -2
- package/dist/charts/kinds/StackedArea.d.ts.map +1 -1
- package/dist/charts/kinds/ZonedLine.d.ts +4 -2
- package/dist/charts/kinds/ZonedLine.d.ts.map +1 -1
- package/dist/charts/primitives/CartesianChart.d.ts +4 -1
- package/dist/charts/primitives/CartesianChart.d.ts.map +1 -1
- package/dist/charts/primitives/ChartFrame.d.ts +9 -8
- package/dist/charts/primitives/ChartFrame.d.ts.map +1 -1
- package/dist/charts/primitives/ChartFrame.js +21 -14
- package/dist/charts/primitives/chart-frame-layout.d.ts +63 -9
- package/dist/charts/primitives/chart-frame-layout.d.ts.map +1 -1
- package/dist/charts/primitives/chart-frame-layout.js +30 -6
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/src/charts/index.ts +1 -0
- package/src/charts/kinds/BandStrip.tsx +5 -3
- package/src/charts/kinds/Bars.tsx +4 -2
- package/src/charts/kinds/Donut.tsx +4 -2
- package/src/charts/kinds/DualPanel.tsx +4 -2
- package/src/charts/kinds/Heatmap.tsx +5 -2
- package/src/charts/kinds/MirroredBars.tsx +4 -2
- package/src/charts/kinds/MultiLine.tsx +4 -2
- package/src/charts/kinds/StackedArea.tsx +4 -2
- package/src/charts/kinds/ZonedLine.tsx +4 -2
- package/src/charts/primitives/CartesianChart.tsx +4 -1
- package/src/charts/primitives/ChartFrame.tsx +33 -34
- package/src/charts/primitives/chart-frame-layout.ts +89 -16
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { BasaltProps } from '../../common/props.js';
|
|
2
2
|
import type { CursorResolution } from '../cursor/resolve.js';
|
|
3
3
|
import type { CartesianTooltipConfig, AxisConfig } from '../primitives/CartesianChart.js';
|
|
4
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame.js';
|
|
4
5
|
import type { XZoneSpec } from '../primitives/XZoneRects.js';
|
|
5
6
|
import type { ZoneSpec } from '../primitives/ZoneRects.js';
|
|
6
7
|
import type { ChartState } from '../primitives/ChartPending.js';
|
|
7
8
|
import type { ChartLegendConfig, ChartSeries } from '../series.js';
|
|
8
9
|
export type MultiLineProps<T> = BasaltProps & {
|
|
9
10
|
data: T[];
|
|
10
|
-
/**
|
|
11
|
-
|
|
11
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
12
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
13
|
+
height?: number | ResponsiveChartHeight;
|
|
12
14
|
chartId: string;
|
|
13
15
|
/** Extracts the x-axis category (date string) from a data point. */
|
|
14
16
|
getX: (d: T) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiLine.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/MultiLine.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,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;IAClB,gGAAgG;IAChG,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;4FACwF;IACxF,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AA6BD;;;;;;;;;;;;;GAaG;AACH,iBAAS,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,+BAkElD;AA4ID,eAAO,MAAM,SAAS,EAAoB,OAAO,cAAc,CAAA"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { BasaltProps } from '../../common/props.js';
|
|
2
2
|
import type { CursorResolution } from '../cursor/resolve.js';
|
|
3
3
|
import type { AxisConfig } from '../primitives/CartesianChart.js';
|
|
4
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame.js';
|
|
4
5
|
import type { ChartState } from '../primitives/ChartPending.js';
|
|
5
6
|
import type { ChartLegendConfig, ChartSeries } from '../series.js';
|
|
6
7
|
export type StackedAreaProps<T> = BasaltProps & {
|
|
7
8
|
data: T[];
|
|
8
|
-
/**
|
|
9
|
-
|
|
9
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
10
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
11
|
+
height?: number | ResponsiveChartHeight;
|
|
10
12
|
chartId: string;
|
|
11
13
|
getX: (d: T) => string;
|
|
12
14
|
/** The stacked bands, bottom to top — the single source of truth for color, legend, and tooltip
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackedArea.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/StackedArea.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,8BAA8B,CAAA;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM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CAAA;IAC1E,6DAA6D;IAC7D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAA;IACjC;iDAC6C;IAC7C,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,CAAA;IAC1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC;4CACwC;IACxC,MAAM,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAAA;IAClC,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gGAAgG;IAChG,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;4FACwF;IACxF,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AAaD;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,+BA4GtD;AAoED,eAAO,MAAM,WAAW,EAAsB,OAAO,gBAAgB,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BasaltProps } from '../../common/props.js';
|
|
2
2
|
import type { CursorResolution } from '../cursor/resolve.js';
|
|
3
3
|
import type { CartesianTooltipConfig, AxisConfig } from '../primitives/CartesianChart.js';
|
|
4
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame.js';
|
|
4
5
|
import type { XZoneSpec } from '../primitives/XZoneRects.js';
|
|
5
6
|
import type { ZoneSpec } from '../primitives/ZoneRects.js';
|
|
6
7
|
import type { ChartState } from '../primitives/ChartPending.js';
|
|
@@ -20,8 +21,9 @@ export type ZonedLineRefLine = {
|
|
|
20
21
|
};
|
|
21
22
|
export type ZonedLineProps<T> = BasaltProps & {
|
|
22
23
|
data: T[];
|
|
23
|
-
/**
|
|
24
|
-
|
|
24
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
25
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
26
|
+
height?: number | ResponsiveChartHeight;
|
|
25
27
|
chartId: string;
|
|
26
28
|
/** Extracts the x-axis category (date string) from a data point. */
|
|
27
29
|
getX: (d: T) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZonedLine.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/ZonedLine.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAe,MAAM,8BAA8B,CAAA;AAEnG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAG/D,mFAAmF;AACnF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,0EAA0E;AAC1E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,oDAAoD;IACpD,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,WAAW,GAAG;IAC5C,IAAI,EAAE,CAAC,EAAE,CAAA;IACT
|
|
1
|
+
{"version":3,"file":"ZonedLine.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/ZonedLine.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAA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;IAClB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAA;IACpB,UAAU,CAAC,EAAE,kBAAkB,EAAE,CAAA;IACjC,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC7B,2FAA2F;IAC3F,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;wBAEoB;IACpB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,CAAA;IAC1E,6DAA6D;IAC7D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAA;IACjC;iDAC6C;IAC7C,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,CAAA;IAC1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC;qGACiG;IACjG,OAAO,CAAC,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC3B;4CACwC;IACxC,MAAM,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAAA;IAClC,qGAAqG;IACrG,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gGAAgG;IAChG,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;4FACwF;IACxF,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AAeD;;;;;;;;;;;;GAYG;AACH,iBAAS,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,+BA6ElD;AAyGD,eAAO,MAAM,SAAS,EAAoB,OAAO,cAAc,CAAA"}
|
|
@@ -4,6 +4,7 @@ import type { BasaltProps } from '../../common/props.js';
|
|
|
4
4
|
import type { ChartMargin } from '../../tokens/index.js';
|
|
5
5
|
import type { CursorResolution } from '../cursor/resolve.js';
|
|
6
6
|
import type { ChartLegendConfig, ChartSeries } from '../series.js';
|
|
7
|
+
import type { ResponsiveChartHeight } from './ChartFrame.js';
|
|
7
8
|
import type { ChartState } from './ChartPending.js';
|
|
8
9
|
import type { XZoneSpec } from './XZoneRects.js';
|
|
9
10
|
import type { ZoneSpec } from './ZoneRects.js';
|
|
@@ -186,7 +187,9 @@ export type CartesianChartProps<T> = BasaltProps & {
|
|
|
186
187
|
dashed?: boolean;
|
|
187
188
|
axis?: 'left' | 'right';
|
|
188
189
|
}[];
|
|
189
|
-
|
|
190
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
191
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
192
|
+
height?: number | ResponsiveChartHeight;
|
|
190
193
|
aspectRatio?: number;
|
|
191
194
|
fill?: boolean;
|
|
192
195
|
legend?: ChartLegendConfig | false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/CartesianChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAKzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/CartesianChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE/D,OAAO,KAAK,EAAE,SAAS,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AAS,WAAW,CAAC,CAAC,CAAC,EAAE;AACjC;;;;;;GAMG;AACH,WAAW,GAAE,SAAS,MAAM,EAAO,GAClC,CAAC,MAAM,EAAE,MAAM,CAAC,CAkDlB;AAmCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,EAChC,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,MAAM,EACN,CAAC,EACD,EAAE,EACF,MAAM,EACN,WAAW,EACX,OAAqB,EACrB,YAAY,EACZ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,WAAW,EACX,IAAI,EACJ,MAAM,EACN,OAAO,EACP,MAAM,EAAE,cAAc,EACtB,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,SAAS,CAiDpC"}
|
|
@@ -5,7 +5,7 @@ import type { ResponsiveChartHeight } from './chart-frame-layout.js';
|
|
|
5
5
|
import type { ChartState } from './ChartPending.js';
|
|
6
6
|
/** Re-exported for `ChartFrame.test.tsx` and any other consumer that previously reached these
|
|
7
7
|
* through `ChartFrame` — the layout math itself lives in `./chart-frame-layout` (pure, DOM-free). */
|
|
8
|
-
export { legendEntryCap, resolvePlotRect, resolveChartTier } from './chart-frame-layout.js';
|
|
8
|
+
export { legendEntryCap, resolveLegendRollup, resolvePlotRect, resolveChartTier, } from './chart-frame-layout.js';
|
|
9
9
|
export type { ResponsiveChartHeight } from './chart-frame-layout.js';
|
|
10
10
|
/** Legend configuration for {@link ChartFrame}. Omit entirely (or pass `{}`) for the default
|
|
11
11
|
* bottom-placed legend; pass `false` only for the sparkline exemption. */
|
|
@@ -15,13 +15,14 @@ export type ChartFrameLegend = {
|
|
|
15
15
|
/**
|
|
16
16
|
* Wrap cap → "+N more" rollup at high cardinality.
|
|
17
17
|
*
|
|
18
|
-
* An explicit value WINS OUTRIGHT —
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* ({@link
|
|
18
|
+
* An explicit value WINS OUTRIGHT — over the phone tier's two-row default (`chartTierMetrics`)
|
|
19
|
+
* AND over a `fill` frame's measured fit (`legendEntryCap`). 1.30.0 fixed only the first half:
|
|
20
|
+
* the fit still ran `Math.min(fitted, caller)` on top, so meteo's 7-entry meteogram legend in a
|
|
21
|
+
* 150px docked row rendered 2 entries at `maxRows` 3, 6 AND 99 — five series drawn in colours
|
|
22
|
+
* nothing named. Both losers are DEFAULTS (the tier's, and `VX.minPlotHeight`); this is the one
|
|
23
|
+
* number a caller stated, so under `fill` the PLOT yields the height instead
|
|
24
|
+
* ({@link resolvePlotRect}'s `legendWins`). State a number too large for the box and the plot
|
|
25
|
+
* gets what is left — visible, and yours.
|
|
25
26
|
*/
|
|
26
27
|
maxRows?: number;
|
|
27
28
|
/** Visually separate role: series | overlay | reference. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartFrame.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/ChartFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"ChartFrame.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/ChartFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAOhF,OAAO,KAAK,EA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;;;;;OAWG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;oDACgD;IAChD,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,SAAS,CAAA;CACxC,CAAA;AAED,0FAA0F;AAC1F,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAC5B,CAAA;AAcD;oFACoF;AACpF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;CAC1C,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,iBAAiB,GAAG,KAAK,GAAG,SAAS,EAC7C,KAAK,CAAC,EAAE,qBAAqB,EAC7B,WAAW,CAAC,EAAE,MAAM,GACnB,gBAAgB,GAAG,KAAK,CAU1B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,MAAM,EACN,WAAW,EACX,IAAY,EACZ,QAA4B,EAC5B,OAAO,EACP,MAAW,EACX,SAAS,EACT,SAAiB,EACjB,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE,eAAe,GAAG,SAAS,CAuG7B"}
|
|
@@ -4,16 +4,20 @@ import { VX } from "../../tokens/index.js";
|
|
|
4
4
|
import { useChartSize } from "../hooks/useChartSize.js";
|
|
5
5
|
import { deriveLegend } from "../series.js";
|
|
6
6
|
import {
|
|
7
|
-
legendEntryCap,
|
|
8
7
|
resolveChartTier,
|
|
9
8
|
resolveFrameHeight,
|
|
10
|
-
|
|
9
|
+
resolveLegendRollup,
|
|
11
10
|
resolvePlotRect
|
|
12
11
|
} from "./chart-frame-layout.js";
|
|
13
12
|
import { ChartTierProvider } from "./chart-tier.js";
|
|
14
13
|
import { ChartLegend } from "./ChartLegend.js";
|
|
15
14
|
import { ChartEmpty, ChartError, ChartPending, resolveChartState } from "./ChartPending.js";
|
|
16
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
legendEntryCap,
|
|
17
|
+
resolveLegendRollup as resolveLegendRollup2,
|
|
18
|
+
resolvePlotRect as resolvePlotRect2,
|
|
19
|
+
resolveChartTier as resolveChartTier2
|
|
20
|
+
} from "./chart-frame-layout.js";
|
|
17
21
|
const DEFAULT_HEIGHT = 240;
|
|
18
22
|
const DEFAULT_MIN_WIDTH = 200;
|
|
19
23
|
const outerStyle = (fill, vertical) => ({
|
|
@@ -71,22 +75,24 @@ function ChartFrame({
|
|
|
71
75
|
const resolvedHeight = fill ? containerH : aspectRatio !== void 0 ? Math.round(containerW / aspectRatio) : resolveFrameHeight(height ?? DEFAULT_HEIGHT, containerW);
|
|
72
76
|
const sideLegendWidth = legendVisible && vertical ? legendW : 0;
|
|
73
77
|
const topBottomLegendHeight = legendVisible && !vertical ? legendH : 0;
|
|
78
|
+
const legendItems = legend === false ? [] : deriveLegend(series);
|
|
79
|
+
const togglable = legend !== false && (legend.toggle ?? legendItems.length > 1);
|
|
80
|
+
const { maxRows, legendWins } = resolveLegendRollup({
|
|
81
|
+
...legend !== false && legend.maxRows !== void 0 && { statedMaxRows: legend.maxRows },
|
|
82
|
+
tier,
|
|
83
|
+
fillBand: legendVisible && fill && !vertical,
|
|
84
|
+
items: legendItems,
|
|
85
|
+
containerW,
|
|
86
|
+
available: resolvedHeight - VX.minPlotHeight
|
|
87
|
+
});
|
|
74
88
|
const plot = resolvePlotRect({
|
|
75
89
|
containerW,
|
|
76
90
|
resolvedHeight,
|
|
77
91
|
minWidth,
|
|
78
92
|
sideLegendWidth,
|
|
79
|
-
topBottomLegendHeight
|
|
93
|
+
topBottomLegendHeight,
|
|
94
|
+
...legendWins && { legendWins }
|
|
80
95
|
});
|
|
81
|
-
const legendItems = legend === false ? [] : deriveLegend(series);
|
|
82
|
-
const togglable = legend !== false && (legend.toggle ?? legendItems.length > 1);
|
|
83
|
-
const callerMaxRows = legend === false ? void 0 : resolveLegendMaxRows({ callerMaxRows: legend.maxRows, tier });
|
|
84
|
-
const maxRows = legend === false ? void 0 : fill && !vertical ? legendEntryCap({
|
|
85
|
-
items: legendItems,
|
|
86
|
-
containerW,
|
|
87
|
-
available: resolvedHeight - VX.minPlotHeight,
|
|
88
|
-
...callerMaxRows !== void 0 && { callerMaxRows }
|
|
89
|
-
}) : callerMaxRows;
|
|
90
96
|
const legendNode = legend === false || resolvedState !== null ? null : /* @__PURE__ */ jsx("div", { ref: legendRef, style: legendWrapperStyle(vertical), children: /* @__PURE__ */ jsx(
|
|
91
97
|
ChartLegend,
|
|
92
98
|
{
|
|
@@ -126,8 +132,9 @@ function ChartFrame({
|
|
|
126
132
|
}
|
|
127
133
|
export {
|
|
128
134
|
ChartFrame,
|
|
129
|
-
|
|
135
|
+
legendEntryCap,
|
|
130
136
|
resolveChartTier2 as resolveChartTier,
|
|
131
137
|
resolveLegend,
|
|
138
|
+
resolveLegendRollup2 as resolveLegendRollup,
|
|
132
139
|
resolvePlotRect2 as resolvePlotRect
|
|
133
140
|
};
|
|
@@ -75,7 +75,7 @@ export type ChartTierMetrics = {
|
|
|
75
75
|
/** Floating tooltip `minWidth`, px. */
|
|
76
76
|
tooltipMinWidth: number;
|
|
77
77
|
/** Default entry cap on the legend, or `undefined` for no default cap. An explicit
|
|
78
|
-
* `legend.maxRows`
|
|
78
|
+
* `legend.maxRows` replaces it outright ({@link resolveLegendMaxRows}). */
|
|
79
79
|
legendMaxRows: number | undefined;
|
|
80
80
|
/** Per-side margin FLOORS (`VX.margin` is a floor, never a ceiling — §1). */
|
|
81
81
|
margin: ChartMargin;
|
|
@@ -93,14 +93,49 @@ export declare function chartTierMetrics(tier: ChartTier): ChartTierMetrics;
|
|
|
93
93
|
* panel on a 1440px desktop is "a phone", so a six-series legend rolled up to two rows + `+4 more`
|
|
94
94
|
* with no way to say no. `margin` and `xLabelRotate` always had that escape; the legend did not.
|
|
95
95
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
96
|
+
* The measured {@link legendEntryCap} a `fill` frame applies is NOT a second ceiling on top of
|
|
97
|
+
* this: it resolves an ABSENT cap only. 1.30.0 ran it over the caller's number as well
|
|
98
|
+
* (`Math.min(fitted, caller)`), which made "wins outright" false again in the one place it was
|
|
99
|
+
* needed — meteo measured a 7-entry legend pinned to 2 entries at `maxRows` 3, 6 AND 99, with 5
|
|
100
|
+
* series drawn in colours the legend refused to name. The fit is not physics either: it derives
|
|
101
|
+
* from `VX.minPlotHeight`, which is a framework DEFAULT about the plot. Two defaults do not
|
|
102
|
+
* outvote the one number a caller stated, so the PLOT yields the height instead
|
|
103
|
+
* ({@link resolvePlotRect}'s `legendWins`) — visibly, in the frame the caller sized.
|
|
99
104
|
*/
|
|
100
105
|
export declare function resolveLegendMaxRows(input: {
|
|
101
106
|
callerMaxRows?: number | undefined;
|
|
102
107
|
tier: ChartTier;
|
|
103
108
|
}): number | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* The whole legend-cap decision in one place: which cap `ChartLegend` gets, and whether the plot
|
|
111
|
+
* pays for it.
|
|
112
|
+
*
|
|
113
|
+
* It lives here rather than inline in `ChartFrame` because the COMPOSITION is what broke. 1.30.0
|
|
114
|
+
* had both halves right on their own — {@link resolveLegendMaxRows} honoured a stated cap,
|
|
115
|
+
* {@link legendEntryCap} measured a fit — and then ran the second over the first, which no test
|
|
116
|
+
* could see because neither pure function was wrong and the frame that combined them needs a
|
|
117
|
+
* `ResizeObserver` to test. Now the combination is a pure function too.
|
|
118
|
+
*
|
|
119
|
+
* Three cases, in order:
|
|
120
|
+
* 1. The caller STATED a number → it is the cap, and on a `fill` band the plot yields
|
|
121
|
+
* (`legendWins`). Nothing measured or defaulted trims it.
|
|
122
|
+
* 2. No `fill` band → the tier's default (or none), because the frame simply grows.
|
|
123
|
+
* 3. A `fill` band with nothing stated → the measured fit, bounded by the tier's default.
|
|
124
|
+
*/
|
|
125
|
+
export declare function resolveLegendRollup(input: {
|
|
126
|
+
/** The caller's own `legend.maxRows`. */
|
|
127
|
+
statedMaxRows?: number | undefined;
|
|
128
|
+
tier: ChartTier;
|
|
129
|
+
/** A visible top/bottom legend on a `fill` frame — the one shape whose box cannot grow. */
|
|
130
|
+
fillBand: boolean;
|
|
131
|
+
items: readonly LegendEntry[];
|
|
132
|
+
containerW: number;
|
|
133
|
+
/** Frame height the legend may consume — `resolvedHeight - VX.minPlotHeight`. */
|
|
134
|
+
available: number;
|
|
135
|
+
}): {
|
|
136
|
+
maxRows: number | undefined;
|
|
137
|
+
legendWins: boolean;
|
|
138
|
+
};
|
|
104
139
|
/**
|
|
105
140
|
* Resolve the plot rect from the measured box and the measured legend band. Pure and exported so
|
|
106
141
|
* the two floors below are testable without a `ResizeObserver`.
|
|
@@ -115,9 +150,11 @@ export declare function resolveLegendMaxRows(input: {
|
|
|
115
150
|
* `height={240}` toward zero and the body stopped rendering entirely. The plot stops at
|
|
116
151
|
* `VX.minPlotHeight` and the frame's own box grows by the difference instead — it is a flex
|
|
117
152
|
* column with `height: auto`, so that growth is automatic. Under `fill` the box CANNOT grow, so
|
|
118
|
-
* the legend is capped instead ({@link legendEntryCap})
|
|
119
|
-
*
|
|
120
|
-
*
|
|
153
|
+
* the legend is capped instead ({@link legendEntryCap}) — UNLESS the caller stated
|
|
154
|
+
* `legend.maxRows`, which is `legendWins`: there the floor itself yields, because a floor is a
|
|
155
|
+
* default and the caller's number is not. An unmeasured box (`resolvedHeight <= 0`, i.e. a
|
|
156
|
+
* `fill` frame before its first measurement) stays at 0 and renders nothing, exactly as before —
|
|
157
|
+
* the floor must never invent a height for a box nobody has measured.
|
|
121
158
|
*/
|
|
122
159
|
export declare function resolvePlotRect(input: {
|
|
123
160
|
containerW: number;
|
|
@@ -125,6 +162,15 @@ export declare function resolvePlotRect(input: {
|
|
|
125
162
|
minWidth: number;
|
|
126
163
|
sideLegendWidth: number;
|
|
127
164
|
topBottomLegendHeight: number;
|
|
165
|
+
/**
|
|
166
|
+
* The caller stated `legend.maxRows` on a `fill` frame, so the legend takes the rows it asked
|
|
167
|
+
* for and the plot takes what is left — `VX.minPlotHeight` stops being a floor. Without this the
|
|
168
|
+
* honoured cap would push the frame's content PAST its own cell (the plot holds 120px, the legend
|
|
169
|
+
* band adds its own) and paint over whatever sits below it; with it, the cost of the caller's
|
|
170
|
+
* number lands where they can see it. Spend the whole box on legend rows and there is no plot
|
|
171
|
+
* left to draw — that is their arithmetic, made visible rather than silently rolled up.
|
|
172
|
+
*/
|
|
173
|
+
legendWins?: boolean;
|
|
128
174
|
}): {
|
|
129
175
|
width: number;
|
|
130
176
|
height: number;
|
|
@@ -138,13 +184,21 @@ export declare function resolvePlotRect(input: {
|
|
|
138
184
|
* MEASURING the labels, not from assuming one entry per row — otherwise a five-entry legend that
|
|
139
185
|
* fits on one line would roll up to `+2 more` in every 240px cell, moving rendering for charts
|
|
140
186
|
* that never had the bug. Returns `undefined` when the whole legend already fits.
|
|
187
|
+
*
|
|
188
|
+
* This resolves an ABSENT cap. A caller who stated `legend.maxRows` never reaches here at all —
|
|
189
|
+
* `ChartFrame` routes around it — because `Math.min`-ing a stated number against this one made the
|
|
190
|
+
* documented escape inert in exactly the narrow `fill` panel it exists for
|
|
191
|
+
* ({@link resolveLegendMaxRows}).
|
|
141
192
|
*/
|
|
142
193
|
export declare function legendEntryCap(input: {
|
|
143
194
|
items: readonly LegendEntry[];
|
|
144
195
|
containerW: number;
|
|
145
196
|
/** Frame height the legend may consume — `resolvedHeight - VX.minPlotHeight`. */
|
|
146
197
|
available: number;
|
|
147
|
-
/**
|
|
148
|
-
|
|
198
|
+
/**
|
|
199
|
+
* The cap that applies when nothing explicit was stated — today only the tier's own default
|
|
200
|
+
* ({@link chartTierMetrics}). Two defaults contending: the smaller wins.
|
|
201
|
+
*/
|
|
202
|
+
defaultMaxRows?: number;
|
|
149
203
|
}): number | undefined;
|
|
150
204
|
//# sourceMappingURL=chart-frame-layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-frame-layout.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/chart-frame-layout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAUhD;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;AAE3C;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAE9D;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,uGAAuG;IACvG,IAAI,EAAE,MAAM,CAAA;IACZ,iDAAiD;IACjD,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,qBAAqB;IACrB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,sBAAsB;IACtB,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,CAAA;AAiBD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,GAAG,qBAAqB,EACtC,UAAU,EAAE,MAAM,GACjB,MAAM,CAQR;AAqBD;6FAC6F;AAC7F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,2FAA2F;IAC3F,IAAI,EAAE,SAAS,CAAA;IACf;uFACmF;IACnF,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAA;IACtB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC,eAAe,EAAE,MAAM,CAAA;IACvB;
|
|
1
|
+
{"version":3,"file":"chart-frame-layout.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/chart-frame-layout.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
|
function resolveLegendMaxRows(input) {
|
|
53
53
|
return input.callerMaxRows ?? chartTierMetrics(input.tier).legendMaxRows;
|
|
54
54
|
}
|
|
55
|
+
function resolveLegendRollup(input) {
|
|
56
|
+
const { statedMaxRows, tier, fillBand, items, containerW, available } = input;
|
|
57
|
+
if (statedMaxRows !== void 0) return { maxRows: statedMaxRows, legendWins: fillBand };
|
|
58
|
+
const tierMaxRows = resolveLegendMaxRows({ callerMaxRows: void 0, tier });
|
|
59
|
+
if (!fillBand) return { maxRows: tierMaxRows, legendWins: false };
|
|
60
|
+
return {
|
|
61
|
+
maxRows: legendEntryCap({
|
|
62
|
+
items,
|
|
63
|
+
containerW,
|
|
64
|
+
available,
|
|
65
|
+
...tierMaxRows !== void 0 && { defaultMaxRows: tierMaxRows }
|
|
66
|
+
}),
|
|
67
|
+
legendWins: false
|
|
68
|
+
};
|
|
69
|
+
}
|
|
55
70
|
function resolvePlotRect(input) {
|
|
56
|
-
const {
|
|
71
|
+
const {
|
|
72
|
+
containerW,
|
|
73
|
+
resolvedHeight,
|
|
74
|
+
minWidth,
|
|
75
|
+
sideLegendWidth,
|
|
76
|
+
topBottomLegendHeight,
|
|
77
|
+
legendWins = false
|
|
78
|
+
} = input;
|
|
79
|
+
const plotFloor = legendWins ? 0 : VX.minPlotHeight;
|
|
57
80
|
return {
|
|
58
81
|
width: containerW === 0 ? minWidth : Math.max(containerW - sideLegendWidth, 1),
|
|
59
|
-
height: resolvedHeight <= 0 ? 0 : Math.max(resolvedHeight - topBottomLegendHeight,
|
|
82
|
+
height: resolvedHeight <= 0 ? 0 : Math.max(resolvedHeight - topBottomLegendHeight, plotFloor)
|
|
60
83
|
};
|
|
61
84
|
}
|
|
62
85
|
const legendBandHeight = (rows) => LEGEND_PAD_Y + rows * LEGEND_LINE_H + Math.max(rows - 1, 0) * VX.legendGap;
|
|
@@ -83,17 +106,17 @@ function entriesWithinRows(items, width, rows) {
|
|
|
83
106
|
return fitted;
|
|
84
107
|
}
|
|
85
108
|
function legendEntryCap(input) {
|
|
86
|
-
const { items, containerW, available,
|
|
87
|
-
if (containerW <= 0 || items.length === 0) return
|
|
109
|
+
const { items, containerW, available, defaultMaxRows } = input;
|
|
110
|
+
if (containerW <= 0 || items.length === 0) return defaultMaxRows;
|
|
88
111
|
const rows = Math.max(
|
|
89
112
|
1,
|
|
90
113
|
Math.floor((available - LEGEND_PAD_Y + VX.legendGap) / (LEGEND_LINE_H + VX.legendGap))
|
|
91
114
|
);
|
|
92
115
|
if (legendBandHeight(rows) <= available && entriesWithinRows(items, containerW, rows) >= items.length) {
|
|
93
|
-
return
|
|
116
|
+
return defaultMaxRows;
|
|
94
117
|
}
|
|
95
118
|
const fitted = Math.max(1, entriesWithinRows(items, containerW, rows));
|
|
96
|
-
return
|
|
119
|
+
return defaultMaxRows === void 0 ? fitted : Math.min(fitted, defaultMaxRows);
|
|
97
120
|
}
|
|
98
121
|
export {
|
|
99
122
|
chartTierMetrics,
|
|
@@ -101,5 +124,6 @@ export {
|
|
|
101
124
|
resolveChartTier,
|
|
102
125
|
resolveFrameHeight,
|
|
103
126
|
resolveLegendMaxRows,
|
|
127
|
+
resolveLegendRollup,
|
|
104
128
|
resolvePlotRect
|
|
105
129
|
};
|
package/llms.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# basalt-ui v1.30.
|
|
1
|
+
# basalt-ui v1.30.1
|
|
2
2
|
# Opinionated framework for Mantine-based React apps — theme, app shell, visx charts, toolchain presets
|
|
3
3
|
#
|
|
4
4
|
# basalt-ui is an opinionated framework for Mantine-based React apps.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
# ./tokens.css subpath. Guide: docs/FRAMEWORK-FREE.md in the repo.
|
|
20
20
|
|
|
21
21
|
Package: basalt-ui
|
|
22
|
-
Version: 1.30.
|
|
22
|
+
Version: 1.30.1
|
|
23
23
|
|
|
24
24
|
## basalt-ui
|
|
25
25
|
Import: import { ... } from 'basalt-ui'
|
package/package.json
CHANGED
package/src/charts/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { useBandPlot } from '../hooks/useBandPlot'
|
|
|
10
10
|
import type { BandFold, BandTooltipConfig } from '../hooks/useBandPlot'
|
|
11
11
|
import { AxisBottomDate } from '../primitives/Axes'
|
|
12
12
|
import { ChartFrame, resolveLegend } from '../primitives/ChartFrame'
|
|
13
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame'
|
|
13
14
|
import {
|
|
14
15
|
ChartTooltipFloat,
|
|
15
16
|
TooltipBody,
|
|
@@ -94,9 +95,10 @@ export type BandStripProps<T> = BasaltProps & {
|
|
|
94
95
|
series: readonly BandStripSeries<T>[]
|
|
95
96
|
/** Which state each datum is in. */
|
|
96
97
|
getBand: (d: T) => BandSpan
|
|
97
|
-
/**
|
|
98
|
-
*
|
|
99
|
-
|
|
98
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`), forwarded to `ChartFrame`.
|
|
99
|
+
* The band row gets whatever the measured margins and legend band leave. Default 240.
|
|
100
|
+
* `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
101
|
+
height?: number | ResponsiveChartHeight
|
|
100
102
|
/** Fill the parent flex/grid cell's measured height instead of a fixed one. */
|
|
101
103
|
fill?: boolean
|
|
102
104
|
/** X tick label formatter. Default `fmtAxisDate` (DD.MM). */
|
|
@@ -7,6 +7,7 @@ import { VX } from '../../tokens'
|
|
|
7
7
|
import type { ChartMargin } from '../../tokens'
|
|
8
8
|
import { CartesianChart } from '../primitives/CartesianChart'
|
|
9
9
|
import type { AxisConfig, CartesianTooltipConfig, PlotContext } from '../primitives/CartesianChart'
|
|
10
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame'
|
|
10
11
|
import type { ZoneSpec } from '../primitives/ZoneRects'
|
|
11
12
|
import type { ChartState } from '../primitives/ChartPending'
|
|
12
13
|
import { curveFor, LINE_OVERLAY_STROKE_WIDTH } from '../series'
|
|
@@ -65,8 +66,9 @@ export type BarsRefLine = {
|
|
|
65
66
|
|
|
66
67
|
export type BarsProps<T> = BasaltProps & {
|
|
67
68
|
data: T[]
|
|
68
|
-
/**
|
|
69
|
-
|
|
69
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
70
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
71
|
+
height?: number | ResponsiveChartHeight
|
|
70
72
|
chartId: string
|
|
71
73
|
getX: (d: T) => string
|
|
72
74
|
/** Generic value accessor — given a data point and a bar/line key, returns the value or null. */
|
|
@@ -6,6 +6,7 @@ import { assertRequiredProps } from '../../common/validate'
|
|
|
6
6
|
import type { BasaltProps } from '../../common/props'
|
|
7
7
|
import { ChartTooltipFloat, TooltipBody, TooltipRow } from '../primitives/ChartTooltip'
|
|
8
8
|
import { ChartFrame } from '../primitives/ChartFrame'
|
|
9
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame'
|
|
9
10
|
import type { ChartState } from '../primitives/ChartPending'
|
|
10
11
|
import { VX } from '../../tokens'
|
|
11
12
|
import type { SeriesStyle } from '../series'
|
|
@@ -20,8 +21,9 @@ export type DonutDatum<K extends string = SeriesKey> = { key: K; value: number }
|
|
|
20
21
|
|
|
21
22
|
export type DonutProps<K extends string = SeriesKey> = BasaltProps & {
|
|
22
23
|
data: DonutDatum<K>[]
|
|
23
|
-
/**
|
|
24
|
-
|
|
24
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
25
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
26
|
+
height?: number | ResponsiveChartHeight
|
|
25
27
|
colorForKey: (key: K) => string
|
|
26
28
|
formatValue: (v: number) => string
|
|
27
29
|
seriesLabel?: (key: string) => string
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
TooltipRow,
|
|
16
16
|
} from '../primitives/ChartTooltip'
|
|
17
17
|
import { ChartFrame, resolveLegend } from '../primitives/ChartFrame'
|
|
18
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame'
|
|
18
19
|
import { Crosshair, SeriesDot } from '../primitives/Crosshair'
|
|
19
20
|
import { HoverOverlay } from '../primitives/HoverOverlay'
|
|
20
21
|
import { ZoneRects } from '../primitives/ZoneRects'
|
|
@@ -31,8 +32,9 @@ import { smartTicks, xLabelPxFor } from '../utils/ticks'
|
|
|
31
32
|
|
|
32
33
|
export type DualPanelProps<T> = BasaltProps & {
|
|
33
34
|
data: T[]
|
|
34
|
-
/**
|
|
35
|
-
|
|
35
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
36
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
37
|
+
height?: number | ResponsiveChartHeight
|
|
36
38
|
chartId: string
|
|
37
39
|
getX: (d: T) => string
|
|
38
40
|
/** X tick label formatter. Default `fmtAxisDate` (DD.MM) — same default `CartesianChart` uses,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
TooltipRow,
|
|
11
11
|
} from '../primitives/ChartTooltip'
|
|
12
12
|
import { ChartFrame } from '../primitives/ChartFrame'
|
|
13
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame'
|
|
13
14
|
import { useChartTierMetrics } from '../primitives/chart-tier'
|
|
14
15
|
import type { ChartState } from '../primitives/ChartPending'
|
|
15
16
|
import { maxTextWidth } from '../utils/measure-text'
|
|
@@ -24,8 +25,10 @@ type HeatmapTip = HeatmapCell & { anchor: { x: number; y: number } }
|
|
|
24
25
|
|
|
25
26
|
export type HeatmapProps<T> = BasaltProps & {
|
|
26
27
|
data: T[]
|
|
27
|
-
/**
|
|
28
|
-
|
|
28
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Used when neither
|
|
29
|
+
* `aspectRatio` nor `fill` is set. Default 240. `ChartFrameProps.height` owns the law —
|
|
30
|
+
* steps resolve off the MEASURED width. */
|
|
31
|
+
height?: number | ResponsiveChartHeight
|
|
29
32
|
/** height = Math.round(containerWidth / aspectRatio). Ignored when `fill` is set. */
|
|
30
33
|
aspectRatio?: number
|
|
31
34
|
/** Fill the parent flex/grid cell's measured height instead of a fixed/derived one. */
|
|
@@ -12,6 +12,7 @@ import type { BandFold, BandTooltipConfig } from '../hooks/useBandPlot'
|
|
|
12
12
|
import { probeAxisLabels } from '../layout/auto-margin'
|
|
13
13
|
import { AxisBottomDate, AxisLeftNumeric } from '../primitives/Axes'
|
|
14
14
|
import { ChartFrame, resolveLegend } from '../primitives/ChartFrame'
|
|
15
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame'
|
|
15
16
|
import {
|
|
16
17
|
ChartTooltipFloat,
|
|
17
18
|
TooltipBody,
|
|
@@ -79,8 +80,9 @@ export type MirroredBarsProps<T> = BasaltProps & {
|
|
|
79
80
|
/** Per-datum bar opacity — a real but qualified measurement (a short bucket, a partial interval)
|
|
80
81
|
* drawn dimmer. Default 1. */
|
|
81
82
|
getBarOpacity?: (d: T) => number
|
|
82
|
-
/**
|
|
83
|
-
|
|
83
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
84
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
85
|
+
height?: number | ResponsiveChartHeight
|
|
84
86
|
fill?: boolean
|
|
85
87
|
formatX?: (key: string) => string
|
|
86
88
|
xTickValues?: (keys: readonly string[], plotWidth: number) => readonly string[]
|