kaleido-ui 0.1.130 → 0.1.131
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/dist/web/index.cjs +8 -1
- package/dist/web/index.d.cts +9 -1
- package/dist/web/index.d.ts +9 -1
- package/dist/web/index.js +8 -1
- package/package.json +1 -1
package/dist/web/index.cjs
CHANGED
|
@@ -9820,12 +9820,19 @@ function TrendChart({
|
|
|
9820
9820
|
empty,
|
|
9821
9821
|
formatValue = defaultFormat,
|
|
9822
9822
|
height = 220,
|
|
9823
|
+
view: controlledView,
|
|
9824
|
+
onViewChange,
|
|
9823
9825
|
className,
|
|
9824
9826
|
...head
|
|
9825
9827
|
}) {
|
|
9826
9828
|
const [containerRef, width] = useElementWidth();
|
|
9827
9829
|
const [active, setActive] = (0, import_react26.useState)(null);
|
|
9828
|
-
const [
|
|
9830
|
+
const [ownView, setOwnView] = (0, import_react26.useState)("chart");
|
|
9831
|
+
const view = controlledView ?? ownView;
|
|
9832
|
+
const setView = (next) => {
|
|
9833
|
+
if (controlledView === void 0) setOwnView(next);
|
|
9834
|
+
onViewChange?.(next);
|
|
9835
|
+
};
|
|
9829
9836
|
const styledSeries = allSeries.map((s, index) => ({ ...s, texture: s.texture ?? (index === 0 ? "solid" : "hatch") }));
|
|
9830
9837
|
const visibility = useSeriesVisibility(allSeries.map((s) => s.id));
|
|
9831
9838
|
const series = styledSeries.filter((s) => visibility.isVisible(s.id));
|
package/dist/web/index.d.cts
CHANGED
|
@@ -2728,6 +2728,7 @@ interface ChartFrameProps extends ChartTitleProps, ChartViewsProps {
|
|
|
2728
2728
|
children: ReactNode;
|
|
2729
2729
|
className?: string;
|
|
2730
2730
|
}
|
|
2731
|
+
type ChartView = 'chart' | 'table';
|
|
2731
2732
|
/**
|
|
2732
2733
|
* A chart's frame: the title and the chart / table switch on one line, then
|
|
2733
2734
|
* the plot with its legend under it — or, one segment away, the same numbers
|
|
@@ -2781,6 +2782,13 @@ interface TrendChartProps extends ChartTitleProps {
|
|
|
2781
2782
|
formatValue?: (value: number) => string;
|
|
2782
2783
|
/** Plot height in px, axes included. */
|
|
2783
2784
|
height?: number;
|
|
2785
|
+
/**
|
|
2786
|
+
* Chart or table, controlled. Leave both out and the chart keeps its own
|
|
2787
|
+
* view; pass them when the host keeps the view in its own state (an address,
|
|
2788
|
+
* a saved preference), so the chart's switch is the only one on screen.
|
|
2789
|
+
*/
|
|
2790
|
+
view?: ChartView;
|
|
2791
|
+
onViewChange?: (view: ChartView) => void;
|
|
2784
2792
|
className?: string;
|
|
2785
2793
|
}
|
|
2786
2794
|
/**
|
|
@@ -2811,7 +2819,7 @@ declare function trendChartLabelIndices(count: number, maxLabels: number): numbe
|
|
|
2811
2819
|
* It draws nothing when there are no points: an empty period is the consumer's
|
|
2812
2820
|
* empty state, passed as `empty`, not a frame with no bars in it.
|
|
2813
2821
|
*/
|
|
2814
|
-
declare function TrendChart({ points, series: allSeries, scaleLabel, label, empty, formatValue, height, className, ...head }: TrendChartProps): react_jsx_runtime.JSX.Element;
|
|
2822
|
+
declare function TrendChart({ points, series: allSeries, scaleLabel, label, empty, formatValue, height, view: controlledView, onViewChange, className, ...head }: TrendChartProps): react_jsx_runtime.JSX.Element;
|
|
2815
2823
|
|
|
2816
2824
|
interface LineChartProps extends ChartTitleProps {
|
|
2817
2825
|
/** One datum per x position, in order (usually time). */
|
package/dist/web/index.d.ts
CHANGED
|
@@ -2728,6 +2728,7 @@ interface ChartFrameProps extends ChartTitleProps, ChartViewsProps {
|
|
|
2728
2728
|
children: ReactNode;
|
|
2729
2729
|
className?: string;
|
|
2730
2730
|
}
|
|
2731
|
+
type ChartView = 'chart' | 'table';
|
|
2731
2732
|
/**
|
|
2732
2733
|
* A chart's frame: the title and the chart / table switch on one line, then
|
|
2733
2734
|
* the plot with its legend under it — or, one segment away, the same numbers
|
|
@@ -2781,6 +2782,13 @@ interface TrendChartProps extends ChartTitleProps {
|
|
|
2781
2782
|
formatValue?: (value: number) => string;
|
|
2782
2783
|
/** Plot height in px, axes included. */
|
|
2783
2784
|
height?: number;
|
|
2785
|
+
/**
|
|
2786
|
+
* Chart or table, controlled. Leave both out and the chart keeps its own
|
|
2787
|
+
* view; pass them when the host keeps the view in its own state (an address,
|
|
2788
|
+
* a saved preference), so the chart's switch is the only one on screen.
|
|
2789
|
+
*/
|
|
2790
|
+
view?: ChartView;
|
|
2791
|
+
onViewChange?: (view: ChartView) => void;
|
|
2784
2792
|
className?: string;
|
|
2785
2793
|
}
|
|
2786
2794
|
/**
|
|
@@ -2811,7 +2819,7 @@ declare function trendChartLabelIndices(count: number, maxLabels: number): numbe
|
|
|
2811
2819
|
* It draws nothing when there are no points: an empty period is the consumer's
|
|
2812
2820
|
* empty state, passed as `empty`, not a frame with no bars in it.
|
|
2813
2821
|
*/
|
|
2814
|
-
declare function TrendChart({ points, series: allSeries, scaleLabel, label, empty, formatValue, height, className, ...head }: TrendChartProps): react_jsx_runtime.JSX.Element;
|
|
2822
|
+
declare function TrendChart({ points, series: allSeries, scaleLabel, label, empty, formatValue, height, view: controlledView, onViewChange, className, ...head }: TrendChartProps): react_jsx_runtime.JSX.Element;
|
|
2815
2823
|
|
|
2816
2824
|
interface LineChartProps extends ChartTitleProps {
|
|
2817
2825
|
/** One datum per x position, in order (usually time). */
|
package/dist/web/index.js
CHANGED
|
@@ -9541,12 +9541,19 @@ function TrendChart({
|
|
|
9541
9541
|
empty,
|
|
9542
9542
|
formatValue = defaultFormat,
|
|
9543
9543
|
height = 220,
|
|
9544
|
+
view: controlledView,
|
|
9545
|
+
onViewChange,
|
|
9544
9546
|
className,
|
|
9545
9547
|
...head
|
|
9546
9548
|
}) {
|
|
9547
9549
|
const [containerRef, width] = useElementWidth();
|
|
9548
9550
|
const [active, setActive] = useState19(null);
|
|
9549
|
-
const [
|
|
9551
|
+
const [ownView, setOwnView] = useState19("chart");
|
|
9552
|
+
const view = controlledView ?? ownView;
|
|
9553
|
+
const setView = (next) => {
|
|
9554
|
+
if (controlledView === void 0) setOwnView(next);
|
|
9555
|
+
onViewChange?.(next);
|
|
9556
|
+
};
|
|
9550
9557
|
const styledSeries = allSeries.map((s, index) => ({ ...s, texture: s.texture ?? (index === 0 ? "solid" : "hatch") }));
|
|
9551
9558
|
const visibility = useSeriesVisibility(allSeries.map((s) => s.id));
|
|
9552
9559
|
const series = styledSeries.filter((s) => visibility.isVisible(s.id));
|
package/package.json
CHANGED