ingred-ui 33.18.2-canary.2 → 33.19.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/dist/components/Chart/BarLineChart/BarLineChart.d.ts +4 -0
- package/dist/components/Chart/BarLineChart/index.d.ts +2 -0
- package/dist/components/Chart/BarLineChart/types.d.ts +56 -0
- package/dist/components/Chart/index.d.ts +4 -0
- package/dist/components/Chart/internal/ChartAxis.d.ts +4 -0
- package/dist/components/Chart/internal/ChartBar.d.ts +3 -2
- package/dist/components/Chart/internal/ChartLegend.d.ts +2 -0
- package/dist/components/Chart/internal/ChartLineSeries.d.ts +2 -0
- package/dist/components/Chart/internal/ChartTooltip.d.ts +5 -1
- package/dist/components/Chart/internal/clampTooltipPosition.d.ts +1 -0
- package/dist/components/Chart/internal/filterVisibleSeries.d.ts +2 -1
- package/dist/components/Chart/internal/getAreaPath.d.ts +1 -1
- package/dist/components/Chart/internal/getBarLineChartSeries.d.ts +21 -0
- package/dist/components/Chart/internal/getBarSegments.d.ts +2 -2
- package/dist/components/Chart/internal/getChartLayout.d.ts +2 -0
- package/dist/components/Chart/internal/getLineSeries.d.ts +4 -4
- package/dist/components/Chart/internal/getReferenceLineGeometry.d.ts +7 -0
- package/dist/components/Chart/internal/hasBarLineChartData.d.ts +2 -0
- package/dist/components/Chart/internal/hasChartData.d.ts +1 -1
- package/dist/components/Chart/internal/hasLineChartData.d.ts +1 -1
- package/dist/components/Chart/internal/utils/scale.d.ts +1 -1
- package/dist/components/Chart/types.d.ts +1 -1
- package/dist/index.es.js +684 -687
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +686 -689
- package/dist/index.js.map +1 -1
- package/dist/themes/palette.d.ts +4 -0
- package/package.json +25 -46
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ChartReferenceLine, ChartSeries } from "../types";
|
|
2
|
+
import { BarChartLayout } from "../BarChart/types";
|
|
3
|
+
export type BarLineChartProps = {
|
|
4
|
+
/** X 軸のカテゴリラベル */
|
|
5
|
+
categories: string[];
|
|
6
|
+
/**
|
|
7
|
+
* 左軸に描画する棒系列。
|
|
8
|
+
* `label` が `lineSeries` と同じでも内部で区別する。
|
|
9
|
+
*/
|
|
10
|
+
barSeries: ChartSeries[];
|
|
11
|
+
/**
|
|
12
|
+
* 右軸に描画する折れ線系列。
|
|
13
|
+
* `label` が `barSeries` と同じでも内部で区別する。
|
|
14
|
+
*/
|
|
15
|
+
lineSeries: ChartSeries[];
|
|
16
|
+
/**
|
|
17
|
+
* 棒のレイアウト。凡例 OFF でも grouped / stacked は維持する。
|
|
18
|
+
* カテゴリ位置(折れ線)は動かさない。
|
|
19
|
+
* - single: 系列 1 本(デフォルト)
|
|
20
|
+
* - grouped: 系列を横並びで比較。非表示はフェード後に残りが詰まって幅を広げる
|
|
21
|
+
* - stacked: 系列を積み上げて構成比を比較。非表示はフェード後に滑って積み直す
|
|
22
|
+
*/
|
|
23
|
+
barLayout?: BarChartLayout;
|
|
24
|
+
/**
|
|
25
|
+
* theme.palette.chart.colorSchemes のキー。
|
|
26
|
+
* 未指定時は palette.chart.series(デフォルト)を使う。
|
|
27
|
+
*/
|
|
28
|
+
colorScheme?: string;
|
|
29
|
+
/** 左軸(棒)の数値表示。未指定時は toLocaleString() */
|
|
30
|
+
barValueFormatter?: (value: number) => string;
|
|
31
|
+
/** 右軸(折れ線)の数値表示。未指定時は toLocaleString() */
|
|
32
|
+
lineValueFormatter?: (value: number) => string;
|
|
33
|
+
/** 系列が 2 本以上のとき凡例を表示。デフォルト true */
|
|
34
|
+
showLegend?: boolean;
|
|
35
|
+
/** 折れ線のデータ点にマーカーを表示。デフォルト true */
|
|
36
|
+
showPoints?: boolean;
|
|
37
|
+
/** 凡例クリックで系列の表示/非表示を切り替え。デフォルト true */
|
|
38
|
+
interactiveLegend?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 値軸上の参照線。
|
|
41
|
+
* `axis: "secondary"` は右軸(折れ線)スケールに乗せる。
|
|
42
|
+
*/
|
|
43
|
+
referenceLines?: ChartReferenceLine[];
|
|
44
|
+
/**
|
|
45
|
+
* 棒の太さ(カテゴリスロット幅に対する比率 0–1)。
|
|
46
|
+
* BarChart の barWidthRatio と同じ。
|
|
47
|
+
*/
|
|
48
|
+
barWidthRatio?: number;
|
|
49
|
+
/** true の間、チャートの代わりにローディング表示 */
|
|
50
|
+
loading?: boolean;
|
|
51
|
+
/** 描画可能なデータがないときのメッセージ。未指定時は「データがありません」 */
|
|
52
|
+
emptyMessage?: string;
|
|
53
|
+
"aria-label": string;
|
|
54
|
+
height?: number;
|
|
55
|
+
className?: string;
|
|
56
|
+
};
|
|
@@ -4,6 +4,8 @@ export { LineChart } from "./LineChart";
|
|
|
4
4
|
export type { LineChartProps } from "./LineChart";
|
|
5
5
|
export { AreaChart } from "./AreaChart";
|
|
6
6
|
export type { AreaChartLayout, AreaChartProps } from "./AreaChart";
|
|
7
|
+
export { BarLineChart } from "./BarLineChart";
|
|
8
|
+
export type { BarLineChartProps } from "./BarLineChart";
|
|
7
9
|
export type { BarSegment, BarChartOrientation, ChartHoverState, ChartReferenceLine, ChartReferenceLineAxis, ChartSeries, ResolvedChartSeries, } from "./types";
|
|
8
10
|
export type { LinePoint, LinePathSegment, LineSeriesGeometry, } from "./internal/getLineSeries";
|
|
9
11
|
export { computeYTicks, computeMaxStackedTotal } from "./internal/utils";
|
|
@@ -20,3 +22,5 @@ export { computeAchievementPercent, formatAchievementPercent, getTooltipReferenc
|
|
|
20
22
|
export type { ChartTooltipReferenceMetric } from "./internal/tooltipReferenceMetrics";
|
|
21
23
|
export { computeAreaChartMaxValue, getAreaSegments, getOverlayAreaPath, getStackedAreaPath, toStackedLineSeries, } from "./internal/getAreaPath";
|
|
22
24
|
export type { AreaPathSegment } from "./internal/getAreaPath";
|
|
25
|
+
export { hasBarLineChartData } from "./internal/hasBarLineChartData";
|
|
26
|
+
export { getBarLineChartAxisSeries, getBarLineChartDrawBarSeries, getBarLineChartReferenceLineLegendItems, getBarLineSeriesDisplayLabel, getBarLineSeriesKey, } from "./internal/getBarLineChartSeries";
|
|
@@ -13,6 +13,10 @@ type ChartValueAxisProps = {
|
|
|
13
13
|
ticks: number[];
|
|
14
14
|
maxValue: number;
|
|
15
15
|
valueFormatter: (value: number) => string;
|
|
16
|
+
/** start: 左(または下)、end: 右軸。デフォルト start */
|
|
17
|
+
position?: "start" | "end";
|
|
18
|
+
/** グリッド線を描画するか。右軸では通常 false */
|
|
19
|
+
showGrid?: boolean;
|
|
16
20
|
};
|
|
17
21
|
export declare const ChartValueAxis: React.FC<ChartValueAxisProps>;
|
|
18
22
|
type ChartCategoryLabelsProps = {
|
|
@@ -7,8 +7,9 @@ type ChartBarProps = {
|
|
|
7
7
|
enterIndex: number;
|
|
8
8
|
durationMs: number;
|
|
9
9
|
staggerMs: number;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
onPointerMove?: (event: React.PointerEvent<SVGRectElement>) => void;
|
|
12
|
+
onPointerLeave?: () => void;
|
|
12
13
|
};
|
|
13
14
|
export declare const ChartBar: React.FC<ChartBarProps>;
|
|
14
15
|
export {};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { ResolvedChartSeries } from "../types";
|
|
3
3
|
import { ChartTooltipReferenceMetric } from "./tooltipReferenceMetrics";
|
|
4
|
+
export type ChartTooltipDataset = Pick<ResolvedChartSeries, "label" | "color" | "data"> & {
|
|
5
|
+
id?: string;
|
|
6
|
+
formatValue?: (value: number) => string;
|
|
7
|
+
};
|
|
4
8
|
type ChartTooltipProps = {
|
|
5
9
|
label: string;
|
|
6
|
-
datasets:
|
|
10
|
+
datasets: ChartTooltipDataset[];
|
|
7
11
|
categoryIndex: number;
|
|
8
12
|
clientX: number;
|
|
9
13
|
clientY: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ResolvedChartSeries } from "../types";
|
|
2
2
|
export declare function filterVisibleSeries(series: ResolvedChartSeries[], hiddenLabels: ReadonlySet<string>): ResolvedChartSeries[];
|
|
3
|
-
|
|
3
|
+
/** pendingLabels: exit アニメ中など、まだ hidden に入っていない非表示予定の系列 */
|
|
4
|
+
export declare function toggleSeriesVisibility(hiddenLabels: ReadonlySet<string>, label: string, seriesLabels: readonly string[], pendingLabels?: ReadonlySet<string>): ReadonlySet<string>;
|
|
4
5
|
/** exit アニメーション完了後に hidden 集合へ系列を追加する(既存の hidden を保持する) */
|
|
5
6
|
export declare function commitHiddenSeriesLabel(hiddenLabels: ReadonlySet<string>, label: string): ReadonlySet<string>;
|
|
@@ -25,7 +25,7 @@ export declare function getStackedAreaPath(upperPoints: readonly {
|
|
|
25
25
|
x: number;
|
|
26
26
|
y: number;
|
|
27
27
|
}[]): string;
|
|
28
|
-
export declare function computeAreaChartMaxValue(series: readonly Pick<ResolvedChartSeries, "data">[], layout: AreaChartLayout): number;
|
|
28
|
+
export declare function computeAreaChartMaxValue(series: readonly Pick<ResolvedChartSeries, "data">[], layout: AreaChartLayout, categoryCount?: number): number;
|
|
29
29
|
export declare function toStackedLineSeries(series: readonly ResolvedChartSeries[]): ResolvedChartSeries[];
|
|
30
30
|
export declare function getOverlayAreaSegments(item: ResolvedChartSeries, chartLayout: ChartLayout, maxValue: number): AreaPathSegment[];
|
|
31
31
|
export declare function getStackedAreaSegments(series: readonly ResolvedChartSeries[], chartLayout: ChartLayout, maxValue: number, categoryCount?: number): AreaPathSegment[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BarChartLayout } from "../BarChart/types";
|
|
2
|
+
import { ChartReferenceLine } from "../types";
|
|
3
|
+
import { ReferenceLineLegendItem } from "./getReferenceLineGeometry";
|
|
4
|
+
export type BarLineSeriesKind = "bar" | "line";
|
|
5
|
+
export declare function getBarLineSeriesKey(kind: BarLineSeriesKind, label: string): string;
|
|
6
|
+
export declare function getBarLineSeriesDisplayLabel(seriesKey: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* 軸スケール用の系列。
|
|
9
|
+
* BarLineChart は棒と線で「最後の 1 本」が別グループに残るため、
|
|
10
|
+
* 片方を全部隠しても空配列で max=1 にしない。
|
|
11
|
+
*/
|
|
12
|
+
export declare function getBarLineChartAxisSeries<T>(visible: readonly T[], all: readonly T[]): readonly T[];
|
|
13
|
+
/**
|
|
14
|
+
* 棒の幾何計算に含める系列。
|
|
15
|
+
* 非表示は除く。grouped は残りが幅を分け合い、stacked は積み直す。
|
|
16
|
+
*/
|
|
17
|
+
export declare function getBarLineChartDrawBarSeries<T extends {
|
|
18
|
+
label: string;
|
|
19
|
+
}>(series: readonly T[], hiddenLabels: ReadonlySet<string>, _layout: BarChartLayout): T[];
|
|
20
|
+
/** BarLineChart は左右軸の参照線を両方凡例に出す */
|
|
21
|
+
export declare function getBarLineChartReferenceLineLegendItems(lines: readonly ChartReferenceLine[] | undefined, primaryFormatter: (value: number) => string, secondaryFormatter: (value: number) => string, defaultColor: string): ReferenceLineLegendItem[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BarChartLayout } from "../BarChart/types";
|
|
2
2
|
import { BarChartOrientation, BarSegment, ResolvedChartSeries } from "../types";
|
|
3
3
|
import { ChartLayout } from "./getChartLayout";
|
|
4
|
-
export declare function computeChartMaxValue(series: ResolvedChartSeries[], layout: BarChartLayout): number;
|
|
5
|
-
export declare function getBarSegments(series: ResolvedChartSeries[], layout: BarChartLayout, chartLayout: ChartLayout, maxValue: number, orientation?: BarChartOrientation): BarSegment[];
|
|
4
|
+
export declare function computeChartMaxValue(series: ResolvedChartSeries[], layout: BarChartLayout, categoryCount?: number): number;
|
|
5
|
+
export declare function getBarSegments(series: ResolvedChartSeries[], layout: BarChartLayout, chartLayout: ChartLayout, maxValue: number, orientation?: BarChartOrientation, categoryCount?: number): BarSegment[];
|
|
@@ -15,6 +15,8 @@ export type ChartLayoutOptions = {
|
|
|
15
15
|
layoutConfig?: ChartLayoutConfig;
|
|
16
16
|
/** ResizeObserver で測定したコンテナ幅 */
|
|
17
17
|
containerWidth?: number;
|
|
18
|
+
/** 右軸ラベル用に paddingRight を広げる(BarLineChart) */
|
|
19
|
+
endValueAxis?: boolean;
|
|
18
20
|
};
|
|
19
21
|
export type ChartLayout = {
|
|
20
22
|
width: number;
|
|
@@ -19,10 +19,10 @@ export type LineSeriesGeometry = {
|
|
|
19
19
|
points: LinePoint[];
|
|
20
20
|
};
|
|
21
21
|
/** Y 軸は 0 起点。負の値を含む場合のスケール調整は未対応。 */
|
|
22
|
-
export declare function computeLineChartMaxValue(series: readonly Pick<ResolvedChartSeries, "data">[]): number;
|
|
22
|
+
export declare function computeLineChartMaxValue(series: readonly Pick<ResolvedChartSeries, "data">[], categoryCount?: number): number;
|
|
23
23
|
export declare function getCategoryCenterX(categoryIndex: number, chartLayout: Pick<ChartLayout, "paddingLeft" | "slotWidth">): number;
|
|
24
24
|
export declare function getValueY(value: number, maxValue: number, chartLayout: Pick<ChartLayout, "paddingTop" | "chartHeight">): number;
|
|
25
25
|
export declare function pathFromPoints(points: readonly LinePoint[]): string;
|
|
26
|
-
export declare function getLinePathSegments(item: ResolvedChartSeries, chartLayout: ChartLayout, maxValue: number): LinePathSegment[];
|
|
27
|
-
export declare function getLineSeriesGeometry(item: ResolvedChartSeries, chartLayout: ChartLayout, maxValue: number): LineSeriesGeometry;
|
|
28
|
-
export declare function getLinePoints(item: ResolvedChartSeries, chartLayout: ChartLayout, maxValue: number): LinePoint[];
|
|
26
|
+
export declare function getLinePathSegments(item: ResolvedChartSeries, chartLayout: ChartLayout, maxValue: number, categoryCount?: number): LinePathSegment[];
|
|
27
|
+
export declare function getLineSeriesGeometry(item: ResolvedChartSeries, chartLayout: ChartLayout, maxValue: number, categoryCount?: number): LineSeriesGeometry;
|
|
28
|
+
export declare function getLinePoints(item: ResolvedChartSeries, chartLayout: ChartLayout, maxValue: number, categoryCount?: number): LinePoint[];
|
|
@@ -10,8 +10,15 @@ export declare function isReferenceLineInScale(value: number, maxValue: number):
|
|
|
10
10
|
export declare function getValueX(value: number, maxValue: number, chartLayout: Pick<ChartLayout, "paddingLeft" | "chartWidth">): number;
|
|
11
11
|
export declare function getReferenceLineGeometry(value: number, maxValue: number, chartLayout: Pick<ChartLayout, "paddingLeft" | "paddingTop" | "chartWidth" | "chartHeight">, orientation: BarChartOrientation, _axis?: ChartReferenceLineAxis): ChartReferenceLineGeometry | null;
|
|
12
12
|
export type ReferenceLineLegendItem = {
|
|
13
|
+
/** 凡例の React key。label が重複しても一意にする */
|
|
14
|
+
id?: string;
|
|
13
15
|
label: string;
|
|
14
16
|
color: string;
|
|
15
17
|
};
|
|
16
18
|
/** 参照線を凡例用アイテムに変換する(スケール外でも凡例には残す) */
|
|
17
19
|
export declare function getReferenceLineLegendItems(lines: readonly ChartReferenceLine[] | undefined, valueFormatter: (value: number) => string, defaultColor: string): ReferenceLineLegendItem[];
|
|
20
|
+
/** SVG stroke-dasharray を凡例スウォッチの background に変換する */
|
|
21
|
+
export declare function getReferenceLineSwatchBackground(color: string, dasharray: string): {
|
|
22
|
+
backgroundColor: string;
|
|
23
|
+
backgroundImage: string;
|
|
24
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function computeYTicks(maxValue: number, tickCount: number): number[];
|
|
2
|
-
export declare function computeMaxStackedTotal(datasets: (number | null)[][]): number;
|
|
2
|
+
export declare function computeMaxStackedTotal(datasets: (number | null)[][], categoryCount?: number): number;
|
|
@@ -33,7 +33,7 @@ export type ChartReferenceLine = {
|
|
|
33
33
|
label?: string;
|
|
34
34
|
/** 未指定時は theme.palette.chart.referenceLine.color */
|
|
35
35
|
color?: string;
|
|
36
|
-
/**
|
|
36
|
+
/** BarLineChart の右軸用。他チャートでは primary のみ有効。 */
|
|
37
37
|
axis?: ChartReferenceLineAxis;
|
|
38
38
|
/**
|
|
39
39
|
* tooltip に達成率(表示値合計 / 目標)を出す。
|