@ayseaistudio/ui-components 3.11.9 → 3.12.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/dist/BarChart/BarChart.d.ts +34 -0
- package/dist/BarChart/BarChart.js +257 -0
- package/dist/BarChart/index.d.ts +2 -0
- package/dist/BarChart/index.js +1 -0
- package/dist/BarChart/style.css +317 -0
- package/dist/LineBarHorizontal/LineBarHorizontal.d.ts +25 -0
- package/dist/LineBarHorizontal/LineBarHorizontal.js +16 -0
- package/dist/LineBarHorizontal/index.d.ts +1 -0
- package/dist/LineBarHorizontal/index.js +1 -0
- package/dist/LineBarHorizontal/style.css +44 -0
- package/dist/LineBarVertical/LineBarVertical.d.ts +14 -0
- package/dist/LineBarVertical/LineBarVertical.js +10 -0
- package/dist/LineBarVertical/index.d.ts +1 -0
- package/dist/LineBarVertical/index.js +1 -0
- package/dist/LineBarVertical/style.css +33 -0
- package/dist/PieChart/PieChart.d.ts +38 -0
- package/dist/PieChart/PieChart.js +285 -0
- package/dist/PieChart/index.d.ts +1 -0
- package/dist/PieChart/index.js +1 -0
- package/dist/PieChart/style.css +59 -0
- package/dist/ValueDots/ValueDots.d.ts +15 -0
- package/dist/ValueDots/ValueDots.js +33 -0
- package/dist/ValueDots/index.d.ts +1 -0
- package/dist/ValueDots/index.js +1 -0
- package/dist/ValueDots/style.css +129 -0
- package/dist/ValueLabel/ValueLabel.d.ts +23 -0
- package/dist/ValueLabel/ValueLabel.js +14 -0
- package/dist/ValueLabel/index.d.ts +1 -0
- package/dist/ValueLabel/index.js +1 -0
- package/dist/ValueLabel/style.css +23 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./style.css";
|
|
3
|
+
export type LegendColour = "primary" | "secondary" | "fourth";
|
|
4
|
+
export type BarColour = "primary" | "secondary" | "tertiary" | "fourth";
|
|
5
|
+
export interface LegendItem {
|
|
6
|
+
label: string;
|
|
7
|
+
colour: LegendColour;
|
|
8
|
+
barClassName: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ChartSegment {
|
|
11
|
+
color: BarColour;
|
|
12
|
+
value: number;
|
|
13
|
+
label?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ChartColumn {
|
|
17
|
+
label: string;
|
|
18
|
+
segments: ChartSegment[];
|
|
19
|
+
}
|
|
20
|
+
export interface BaseBarChartProps {
|
|
21
|
+
legendItems: LegendItem[];
|
|
22
|
+
scaleValues?: string[];
|
|
23
|
+
data: ChartColumn[];
|
|
24
|
+
maxBarHeight?: number;
|
|
25
|
+
tooltipFormatter?: (columnLabel: string, segment: ChartSegment) => string;
|
|
26
|
+
valueLabelFormatter?: (value: number, segment: ChartSegment, columnLabel: string) => string;
|
|
27
|
+
showLegend?: boolean;
|
|
28
|
+
yTickCount?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface BarChartProps extends BaseBarChartProps {
|
|
31
|
+
grouped?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare const GroupedBarChart: (props: BaseBarChartProps) => React.JSX.Element;
|
|
34
|
+
export declare const BarChart: ({ grouped, ...rest }: BarChartProps) => React.JSX.Element;
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef, useState, useLayoutEffect, useEffect } from "react";
|
|
3
|
+
import { LineBarHorizontal } from "../LineBarHorizontal";
|
|
4
|
+
import { LineBarVertical } from "../LineBarVertical";
|
|
5
|
+
import { InfoTooltip } from "../InfoTooltip";
|
|
6
|
+
import { Label } from "../Label";
|
|
7
|
+
import "./style.css";
|
|
8
|
+
const DEFAULT_MAX_BAR_HEIGHT = 160;
|
|
9
|
+
const DEFAULT_TOOLTIP_FORMATTER = (columnLabel, segment) => {
|
|
10
|
+
const segmentLabel = segment.label || "Segment";
|
|
11
|
+
return `${columnLabel} - ${segmentLabel}: ${segment.value.toLocaleString("tr-TR")}`;
|
|
12
|
+
};
|
|
13
|
+
const niceCeilStep = (x) => {
|
|
14
|
+
if (!Number.isFinite(x) || x <= 0)
|
|
15
|
+
return 1;
|
|
16
|
+
const exp = Math.floor(Math.log10(x));
|
|
17
|
+
const f = x / Math.pow(10, exp);
|
|
18
|
+
let nf = 1;
|
|
19
|
+
if (f <= 1)
|
|
20
|
+
nf = 1;
|
|
21
|
+
else if (f <= 2)
|
|
22
|
+
nf = 2;
|
|
23
|
+
else if (f <= 2.5)
|
|
24
|
+
nf = 2.5;
|
|
25
|
+
else if (f <= 3)
|
|
26
|
+
nf = 3;
|
|
27
|
+
else if (f <= 4)
|
|
28
|
+
nf = 4;
|
|
29
|
+
else if (f <= 5)
|
|
30
|
+
nf = 5;
|
|
31
|
+
else if (f <= 6)
|
|
32
|
+
nf = 6;
|
|
33
|
+
else if (f <= 8)
|
|
34
|
+
nf = 8;
|
|
35
|
+
else
|
|
36
|
+
nf = 10;
|
|
37
|
+
return nf * Math.pow(10, exp);
|
|
38
|
+
};
|
|
39
|
+
const buildScaleValues = (max, tickCount) => {
|
|
40
|
+
const t = Math.max(2, tickCount);
|
|
41
|
+
const rawStep = max / (t - 1);
|
|
42
|
+
const step = niceCeilStep(rawStep);
|
|
43
|
+
const niceMax = step * (t - 1);
|
|
44
|
+
const fractionDigits = step >= 1 ? 0 : step >= 0.1 ? 1 : 2;
|
|
45
|
+
// üstten alta gelsin (UI böyle)
|
|
46
|
+
return Array.from({ length: t }, (_, i) => {
|
|
47
|
+
const v = Number((niceMax - i * step).toFixed(fractionDigits));
|
|
48
|
+
return v.toLocaleString("tr-TR", {
|
|
49
|
+
minimumFractionDigits: fractionDigits,
|
|
50
|
+
maximumFractionDigits: fractionDigits,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const BaseBarChart = ({ legendItems, scaleValues, data, maxBarHeight, tooltipFormatter = DEFAULT_TOOLTIP_FORMATTER, valueLabelFormatter, showLegend = true, yTickCount = 5, layout, }) => {
|
|
55
|
+
const grouped = layout === "grouped";
|
|
56
|
+
const cardRef = useRef(null);
|
|
57
|
+
const plotRef = useRef(null);
|
|
58
|
+
const barsRef = useRef(null);
|
|
59
|
+
const scrollRef = useRef(null);
|
|
60
|
+
const [hoveredSegment, setHoveredSegment] = useState(null);
|
|
61
|
+
const [tooltipPos, setTooltipPos] = useState({ x: 0, y: 0 });
|
|
62
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
63
|
+
const [plotHeight, setPlotHeight] = useState(DEFAULT_MAX_BAR_HEIGHT);
|
|
64
|
+
const dataAnimationKey = useMemo(() => data
|
|
65
|
+
.map((column) => `${column.label}:${column.segments
|
|
66
|
+
.map((segment) => `${segment.label ?? ""}=${Number(segment.value) || 0}`)
|
|
67
|
+
.join(",")}`)
|
|
68
|
+
.join("|"), [data]);
|
|
69
|
+
useLayoutEffect(() => {
|
|
70
|
+
const el = barsRef.current;
|
|
71
|
+
if (!el)
|
|
72
|
+
return;
|
|
73
|
+
const update = () => {
|
|
74
|
+
const h = el.clientHeight;
|
|
75
|
+
if (h > 0) {
|
|
76
|
+
setPlotHeight(h);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
update();
|
|
80
|
+
const ro = new ResizeObserver(update);
|
|
81
|
+
ro.observe(el);
|
|
82
|
+
return () => ro.disconnect();
|
|
83
|
+
}, []);
|
|
84
|
+
useLayoutEffect(() => {
|
|
85
|
+
const sc = scrollRef.current;
|
|
86
|
+
const root = cardRef.current; // .bar-chart
|
|
87
|
+
if (!sc || !root)
|
|
88
|
+
return;
|
|
89
|
+
const update = () => {
|
|
90
|
+
// horizontal scrollbar yüksekliği (varsa)
|
|
91
|
+
const sbh = Math.max(0, sc.offsetHeight - sc.clientHeight);
|
|
92
|
+
root.style.setProperty("--x-scrollbar-h", `${sbh}px`);
|
|
93
|
+
};
|
|
94
|
+
update();
|
|
95
|
+
const ro = new ResizeObserver(update);
|
|
96
|
+
ro.observe(sc);
|
|
97
|
+
// bazı browserlarda scrollbar görünürlüğü "layout"tan sonra netleşir
|
|
98
|
+
const raf = requestAnimationFrame(update);
|
|
99
|
+
return () => {
|
|
100
|
+
ro.disconnect();
|
|
101
|
+
cancelAnimationFrame(raf);
|
|
102
|
+
};
|
|
103
|
+
}, [data.length, grouped]);
|
|
104
|
+
const effectiveMaxBarHeight = useMemo(() => {
|
|
105
|
+
const desired = maxBarHeight ?? plotHeight; // maxBarHeight verilmişse onu iste
|
|
106
|
+
return Math.max(1, Math.min(desired, plotHeight)); // ama asla plotHeight'i aşmasın
|
|
107
|
+
}, [maxBarHeight, plotHeight]);
|
|
108
|
+
const yAxisTopOffset = useMemo(() => Math.max(0, plotHeight - effectiveMaxBarHeight), [plotHeight, effectiveMaxBarHeight]);
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
cardRef.current?.style.setProperty("--plot-h", `${effectiveMaxBarHeight}px`);
|
|
111
|
+
}, [effectiveMaxBarHeight]);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
const el = plotRef.current;
|
|
114
|
+
if (!el)
|
|
115
|
+
return;
|
|
116
|
+
const reduceMotion = typeof window !== "undefined" &&
|
|
117
|
+
window.matchMedia &&
|
|
118
|
+
window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
119
|
+
if (reduceMotion) {
|
|
120
|
+
setIsVisible(true);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
setIsVisible(false);
|
|
124
|
+
let io = null;
|
|
125
|
+
let raf = null;
|
|
126
|
+
raf = requestAnimationFrame(() => {
|
|
127
|
+
const root = el.closest(".frame-dashboard");
|
|
128
|
+
io = new IntersectionObserver(([entry]) => {
|
|
129
|
+
if (entry.isIntersecting) {
|
|
130
|
+
setIsVisible(true);
|
|
131
|
+
if (io)
|
|
132
|
+
io.disconnect();
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
root,
|
|
136
|
+
threshold: 0.05,
|
|
137
|
+
rootMargin: "80px",
|
|
138
|
+
});
|
|
139
|
+
io.observe(el);
|
|
140
|
+
const r = el.getBoundingClientRect();
|
|
141
|
+
if (r.top < window.innerHeight && r.bottom > 0) {
|
|
142
|
+
setIsVisible(true);
|
|
143
|
+
if (io)
|
|
144
|
+
io.disconnect();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
return () => {
|
|
148
|
+
if (raf !== null)
|
|
149
|
+
cancelAnimationFrame(raf);
|
|
150
|
+
if (io)
|
|
151
|
+
io.disconnect();
|
|
152
|
+
};
|
|
153
|
+
}, [dataAnimationKey, grouped]);
|
|
154
|
+
const dataMax = useMemo(() => {
|
|
155
|
+
const allValues = data.flatMap((c) => c.segments.map((s) => s.value));
|
|
156
|
+
return allValues.length > 0 ? Math.max(...allValues) : 1;
|
|
157
|
+
}, [data]);
|
|
158
|
+
const computedScaleValues = useMemo(() => {
|
|
159
|
+
if (scaleValues?.length)
|
|
160
|
+
return scaleValues;
|
|
161
|
+
return buildScaleValues(dataMax, yTickCount);
|
|
162
|
+
}, [scaleValues, dataMax, yTickCount]);
|
|
163
|
+
const maxValue = useMemo(() => {
|
|
164
|
+
const top = computedScaleValues?.[0] ?? "";
|
|
165
|
+
// tr-TR sayı formatını (1.234,5) parse et.
|
|
166
|
+
const topN = Number(top.replace(/\./g, "").replace(",", ".").replace(/\s/g, ""));
|
|
167
|
+
const scaleMax = Number.isFinite(topN) && topN > 0 ? topN : 0;
|
|
168
|
+
const resolvedMax = Math.max(dataMax, scaleMax);
|
|
169
|
+
return resolvedMax > 0 ? resolvedMax : 1;
|
|
170
|
+
}, [computedScaleValues, dataMax]);
|
|
171
|
+
const getSegmentHeight = (value) => {
|
|
172
|
+
if (!maxValue)
|
|
173
|
+
return "0px";
|
|
174
|
+
const normalizedHeight = (value / maxValue) * effectiveMaxBarHeight;
|
|
175
|
+
const clamped = Math.min(effectiveMaxBarHeight, Math.max(0, normalizedHeight));
|
|
176
|
+
return `${clamped}px`;
|
|
177
|
+
};
|
|
178
|
+
const defaultValueLabelText = (value) => {
|
|
179
|
+
const rawValue = Number(value) || 0;
|
|
180
|
+
const isInt = Math.abs(rawValue - Math.round(rawValue)) < 1e-9;
|
|
181
|
+
return rawValue.toLocaleString("tr-TR", {
|
|
182
|
+
minimumFractionDigits: 0,
|
|
183
|
+
maximumFractionDigits: isInt ? 0 : 2,
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
const tooltipText = hoveredSegment
|
|
187
|
+
? tooltipFormatter(hoveredSegment.columnLabel, hoveredSegment.segment)
|
|
188
|
+
: "";
|
|
189
|
+
const updateTooltipPosition = (event) => {
|
|
190
|
+
setTooltipPos({
|
|
191
|
+
x: event.clientX,
|
|
192
|
+
y: event.clientY,
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
const handleBarHover = (columnLabel, segment, event) => {
|
|
196
|
+
setHoveredSegment({ columnLabel, segment });
|
|
197
|
+
if (event) {
|
|
198
|
+
updateTooltipPosition(event);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
const handleBarLeave = () => {
|
|
202
|
+
setHoveredSegment(null);
|
|
203
|
+
};
|
|
204
|
+
return (_jsxs("div", { className: "bar-chart", ref: cardRef, children: [hoveredSegment && tooltipText && (_jsx("div", { className: "alma-tooltip alma-tooltip-visible", style: { left: tooltipPos.x, top: tooltipPos.y }, children: _jsx(InfoTooltip, { text: tooltipText, withIcon: true, className: "alma-tooltip-content" }) })), showLegend && (_jsx("div", { className: "bar-chart-header", children: _jsx("div", { className: "frame-2", children: legendItems.map(({ label, colour, barClassName }) => (_jsx(LineBarVertical, { className: barClassName, colour: colour, label: label }, label))) }) })), _jsx("div", { className: "bar-chart-body", children: _jsxs("div", { className: `chart-area ${isVisible ? "is-visible" : ""}`, ref: plotRef, children: [_jsx("div", { className: "y-axis", style: {
|
|
205
|
+
height: `${effectiveMaxBarHeight}px`,
|
|
206
|
+
marginTop: `${yAxisTopOffset}px`,
|
|
207
|
+
}, children: computedScaleValues.map((value, index) => {
|
|
208
|
+
const count = computedScaleValues.length;
|
|
209
|
+
const ratio = count <= 1 ? 0 : index / (count - 1);
|
|
210
|
+
const isFirst = index === 0;
|
|
211
|
+
const isLast = index === count - 1;
|
|
212
|
+
const translateY = isFirst ? "0%" : isLast ? "-100%" : "-50%";
|
|
213
|
+
return (_jsx("div", { className: "y-axis-tick", style: { top: `${ratio * 100}%`, transform: `translateY(${translateY})` }, children: _jsx(Label, { bold: "on", className: "label-3", color: "black", divClassName: "label-4", size: "small", spacing: "off", stroke: "off", text: value, version: "secondary" }) }, `${value}-${index}`));
|
|
214
|
+
}) }), _jsx("div", { className: "plot-scroll", ref: scrollRef, style: {
|
|
215
|
+
["--cols"]: data.length,
|
|
216
|
+
["--colMin"]: grouped ? "84px" : "56px",
|
|
217
|
+
}, children: _jsxs("div", { className: "plot-inner", children: [_jsx("div", { className: "bars-area", ref: barsRef, children: _jsx("div", { className: "attendance", children: data.length > 0 ? (data.map((column) => (_jsx("div", { className: `frame-6 ${grouped ? "frame-6-grouped" : ""}`, style: grouped
|
|
218
|
+
? { ["--segments"]: column.segments.length }
|
|
219
|
+
: undefined, children: column.segments.length > 0 ? (column.segments.map((segment, index) => {
|
|
220
|
+
const key = `${column.label}-${segment.label ?? index}`;
|
|
221
|
+
const animatedKey = `${dataAnimationKey}-${key}`;
|
|
222
|
+
const heightStr = getSegmentHeight(segment.value);
|
|
223
|
+
const currentHeight = parseFloat(heightStr) || 0;
|
|
224
|
+
const rawValue = Number(segment.value) || 0;
|
|
225
|
+
const valueText = valueLabelFormatter
|
|
226
|
+
? valueLabelFormatter(rawValue, segment, column.label)
|
|
227
|
+
: defaultValueLabelText(rawValue);
|
|
228
|
+
// 0 (veya 0'a çok yakın) değerleri yazdırma
|
|
229
|
+
const hasValue = rawValue > 0 && Boolean(valueText);
|
|
230
|
+
// Bar çok kısa olduğunda etiketi üstte göster.
|
|
231
|
+
const shouldPlaceLabelOutside = currentHeight < 26;
|
|
232
|
+
const animationDelayMs = Math.min(260, index * 35);
|
|
233
|
+
const motionStyle = {
|
|
234
|
+
transformOrigin: "bottom",
|
|
235
|
+
animation: `bar-rise-in 560ms cubic-bezier(0.16, 1, 0.3, 1) ${animationDelayMs}ms both`,
|
|
236
|
+
};
|
|
237
|
+
return (_jsxs("div", { style: {
|
|
238
|
+
width: "100%",
|
|
239
|
+
position: "relative",
|
|
240
|
+
display: "flex",
|
|
241
|
+
alignItems: "flex-end",
|
|
242
|
+
justifyContent: "center",
|
|
243
|
+
["--bar-h"]: heightStr,
|
|
244
|
+
...motionStyle,
|
|
245
|
+
}, children: [hasValue && (_jsx("span", { className: `bar-value-label ${shouldPlaceLabelOutside ? "outside" : "inside"}`, title: valueText, children: valueText })), _jsx(LineBarHorizontal, { className: "chart-bar", color: segment.color, label: false, version: "primary", style: {
|
|
246
|
+
height: heightStr,
|
|
247
|
+
width: "100%",
|
|
248
|
+
transition: "height 380ms ease",
|
|
249
|
+
}, onMouseEnter: (event) => handleBarHover(column.label, segment, event), onMouseLeave: handleBarLeave })] }, animatedKey));
|
|
250
|
+
})) : (_jsx("div", { style: { width: "100%", height: "2px" } })) }, column.label)))) : (_jsx("div", { style: { width: "100%", textAlign: "center", padding: "20px", color: "#999" }, children: "No data available" })) }) }), _jsx("div", { className: "x-axis", children: data.map((column) => (_jsx("div", { className: "x-axis-cell", children: _jsx(Label, { bold: "off", className: "label-5", color: "black", size: "small", spacing: "off", stroke: "off", text: column.label, version: "secondary" }) }, column.label))) })] }) })] }) })] }));
|
|
251
|
+
};
|
|
252
|
+
export const GroupedBarChart = (props) => {
|
|
253
|
+
return _jsx(BaseBarChart, { ...props, layout: "grouped" });
|
|
254
|
+
};
|
|
255
|
+
export const BarChart = ({ grouped = false, ...rest }) => {
|
|
256
|
+
return _jsx(BaseBarChart, { ...rest, layout: "grouped" });
|
|
257
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BarChart, GroupedBarChart } from "./BarChart";
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
.bar-chart {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
min-height: 0;
|
|
8
|
+
--x-scrollbar-h: 0px;
|
|
9
|
+
--x-axis-h: 32px;
|
|
10
|
+
--colGap: 24px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.bar-chart-body {
|
|
14
|
+
flex: 1;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
min-height: 0;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.bar-chart-header {
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
align-items: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.bar-chart-header .frame-2 {
|
|
28
|
+
align-items: flex-start;
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
flex: 0 0 auto;
|
|
31
|
+
gap: 12px;
|
|
32
|
+
padding: 0px 6px;
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.bar-chart .line-bar-vertical-instance {
|
|
37
|
+
height: 8px !important;
|
|
38
|
+
width: 24px !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.bar-chart .line-bar-vertical-wrapper .design-component-instance-node {
|
|
42
|
+
align-items: center !important;
|
|
43
|
+
justify-content: center !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.bar-chart .line-bar-vertical-2 {
|
|
47
|
+
background-color: #466212 !important;
|
|
48
|
+
height: 8px !important;
|
|
49
|
+
width: 24px !important;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.bar-chart .chart-area {
|
|
53
|
+
flex: 1;
|
|
54
|
+
display: flex;
|
|
55
|
+
padding: 6px;
|
|
56
|
+
padding-top: 0;
|
|
57
|
+
min-height: 0;
|
|
58
|
+
box-sizing: border-box;
|
|
59
|
+
align-items: stretch;
|
|
60
|
+
overflow-y: hidden;
|
|
61
|
+
opacity: 1;
|
|
62
|
+
transform: none;
|
|
63
|
+
clip-path: none;
|
|
64
|
+
transition: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.bar-chart .chart-area.is-visible {
|
|
68
|
+
opacity: 1;
|
|
69
|
+
transform: none;
|
|
70
|
+
clip-path: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.bar-chart .y-axis {
|
|
74
|
+
position: relative;
|
|
75
|
+
width: 48px;
|
|
76
|
+
flex-shrink: 0;
|
|
77
|
+
min-height: 0;
|
|
78
|
+
padding-bottom: 0;
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
height: var(--plot-h, calc(100% - var(--x-axis-h) - var(--x-scrollbar-h)));
|
|
81
|
+
align-self: flex-start;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.bar-chart .y-axis-tick {
|
|
85
|
+
position: absolute;
|
|
86
|
+
left: 0;
|
|
87
|
+
width: 100%;
|
|
88
|
+
display: flex;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.bar-chart .label-3 {
|
|
92
|
+
align-self: stretch !important;
|
|
93
|
+
display: flex !important;
|
|
94
|
+
flex: 0 0 auto !important;
|
|
95
|
+
flex-grow: 0 !important;
|
|
96
|
+
width: 100% !important;
|
|
97
|
+
height: auto !important;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.bar-chart .label-4 {
|
|
101
|
+
margin-top: unset !important;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* SCROLL CONTAINER */
|
|
105
|
+
.bar-chart .plot-scroll {
|
|
106
|
+
flex: 1;
|
|
107
|
+
min-width: 0;
|
|
108
|
+
min-height: 0;
|
|
109
|
+
height: 100%;
|
|
110
|
+
overflow-x: auto;
|
|
111
|
+
overflow-y: hidden;
|
|
112
|
+
-webkit-overflow-scrolling: touch;
|
|
113
|
+
padding-bottom: 0;
|
|
114
|
+
padding-right: 6px;
|
|
115
|
+
box-sizing: border-box;
|
|
116
|
+
scrollbar-width: thin;
|
|
117
|
+
scrollbar-color: #bfc3c9 #eceef1;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.bar-chart .plot-scroll::-webkit-scrollbar {
|
|
121
|
+
height: 8px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.bar-chart .plot-scroll::-webkit-scrollbar-track {
|
|
125
|
+
background: #eceef1;
|
|
126
|
+
border-radius: 999px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.bar-chart .plot-scroll::-webkit-scrollbar-thumb {
|
|
130
|
+
background: #bfc3c9;
|
|
131
|
+
border-radius: 999px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.bar-chart .plot-scroll::-webkit-scrollbar-thumb:hover {
|
|
135
|
+
background: #aeb3ba;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* İçerideki toplam genişlik = cols * minColWidth + gap'ler (scroll tetikler) */
|
|
139
|
+
.bar-chart .plot-inner {
|
|
140
|
+
min-width: calc(
|
|
141
|
+
(var(--cols, 1) * var(--colMin, 72px)) +
|
|
142
|
+
((var(--cols, 1) - 1) * var(--colGap, 24px))
|
|
143
|
+
);
|
|
144
|
+
height: 100%;
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
min-height: 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.bar-chart .bars-area {
|
|
151
|
+
flex: 1;
|
|
152
|
+
display: flex;
|
|
153
|
+
min-width: 0;
|
|
154
|
+
min-height: 0;
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* attendance artık grid ve kolonlar min genişlikten küçülmez */
|
|
159
|
+
.bar-chart .attendance {
|
|
160
|
+
display: grid;
|
|
161
|
+
grid-template-columns: repeat(var(--cols, 1), minmax(var(--colMin, 72px), 1fr));
|
|
162
|
+
column-gap: var(--colGap, 24px);
|
|
163
|
+
align-items: end;
|
|
164
|
+
width: 100%;
|
|
165
|
+
min-height: 0;
|
|
166
|
+
box-sizing: border-box;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.bar-chart .frame-6 {
|
|
170
|
+
display: flex;
|
|
171
|
+
flex-direction: column;
|
|
172
|
+
justify-content: flex-end;
|
|
173
|
+
min-width: 0;
|
|
174
|
+
min-height: 0;
|
|
175
|
+
position: relative;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* grouped mod: bir kolonun içindeki segmentler eşit paylaşılsın */
|
|
179
|
+
.bar-chart .frame-6-grouped {
|
|
180
|
+
display: grid;
|
|
181
|
+
grid-template-columns: repeat(var(--segments, 1), minmax(0, 1fr));
|
|
182
|
+
gap: 4px;
|
|
183
|
+
align-items: end;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.bar-chart .x-axis-cell {
|
|
187
|
+
min-width: 0;
|
|
188
|
+
display: flex;
|
|
189
|
+
align-items: flex-end;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* chart-bar shrink edebilsin */
|
|
193
|
+
.bar-chart .chart-bar {
|
|
194
|
+
align-items: flex-end !important;
|
|
195
|
+
width: 100% !important;
|
|
196
|
+
min-width: 0 !important;
|
|
197
|
+
min-height: 2px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.bar-chart .bar-value-label {
|
|
201
|
+
position: absolute;
|
|
202
|
+
left: 50%;
|
|
203
|
+
transform: translateX(-50%);
|
|
204
|
+
z-index: 2;
|
|
205
|
+
font-size: var(--b2-bold-font-size);
|
|
206
|
+
font-weight: var(--b2-bold-font-weight);
|
|
207
|
+
line-height: var(--b2-bold-line-height);
|
|
208
|
+
color: rgba(93, 93, 93, 1);
|
|
209
|
+
font-family: var(--b2-bold-font-family);
|
|
210
|
+
font-style: var(--b2-bold-font-style);
|
|
211
|
+
white-space: nowrap;
|
|
212
|
+
pointer-events: none;
|
|
213
|
+
max-width: calc(100% - 6px);
|
|
214
|
+
overflow: hidden;
|
|
215
|
+
text-overflow: ellipsis;
|
|
216
|
+
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.bar-chart .bar-value-label.inside {
|
|
220
|
+
top: calc(100% - var(--bar-h, 0px) + 6px);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.bar-chart .bar-value-label.outside {
|
|
224
|
+
/* bar'ın tepesinin üstüne sabit boşluk bırak (küçük barlarda border'a yapışmasın) */
|
|
225
|
+
bottom: calc(100% + 2px);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
@keyframes bar-rise-in {
|
|
229
|
+
0% {
|
|
230
|
+
opacity: 0;
|
|
231
|
+
transform: translateY(12px) scaleY(0.02);
|
|
232
|
+
}
|
|
233
|
+
100% {
|
|
234
|
+
opacity: 1;
|
|
235
|
+
transform: translateY(0) scaleY(1);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.bar-chart .alma-tooltip {
|
|
240
|
+
opacity: 0;
|
|
241
|
+
pointer-events: none;
|
|
242
|
+
position: fixed;
|
|
243
|
+
transform: translate(-50%, calc(-100% - 12px));
|
|
244
|
+
transition: opacity 0.2s ease;
|
|
245
|
+
z-index: 9999;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.bar-chart .alma-tooltip-visible {
|
|
249
|
+
opacity: 1;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.bar-chart .alma-tooltip-content {
|
|
253
|
+
max-width: 260px;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.bar-chart .alma-tooltip-content,
|
|
257
|
+
.bar-chart .alma-tooltip-content * {
|
|
258
|
+
font-size: 12px !important;
|
|
259
|
+
line-height: 1.35 !important;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.bar-chart .x-axis {
|
|
263
|
+
display: grid;
|
|
264
|
+
grid-template-columns: repeat(var(--cols, 1), minmax(var(--colMin, 72px), 1fr));
|
|
265
|
+
column-gap: var(--colGap, 24px);
|
|
266
|
+
padding: 2px -1px 0px 6px;
|
|
267
|
+
width: 100%;
|
|
268
|
+
box-sizing: border-box;
|
|
269
|
+
flex: 0 0 var(--x-axis-h);
|
|
270
|
+
height: var(--x-axis-h);
|
|
271
|
+
overflow: hidden;
|
|
272
|
+
align-items: end;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.bar-chart .label-wrapper {
|
|
276
|
+
align-items: flex-start;
|
|
277
|
+
display: flex;
|
|
278
|
+
flex: 1;
|
|
279
|
+
flex-direction: column;
|
|
280
|
+
gap: 10px;
|
|
281
|
+
position: relative;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.bar-chart .label-5 {
|
|
285
|
+
align-self: stretch !important;
|
|
286
|
+
display: flex !important;
|
|
287
|
+
flex: 0 0 auto !important;
|
|
288
|
+
left: unset !important;
|
|
289
|
+
padding: 0px 4px !important;
|
|
290
|
+
top: unset !important;
|
|
291
|
+
width: 100% !important;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.bar-chart .label-instance-wrapper {
|
|
295
|
+
align-items: flex-start;
|
|
296
|
+
display: flex;
|
|
297
|
+
flex: 1;
|
|
298
|
+
flex-direction: column;
|
|
299
|
+
gap: 10px;
|
|
300
|
+
position: relative;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/* Reduce motion */
|
|
304
|
+
@media (prefers-reduced-motion: reduce) {
|
|
305
|
+
.bar-chart .chart-area {
|
|
306
|
+
transition: none;
|
|
307
|
+
opacity: 1;
|
|
308
|
+
transform: none;
|
|
309
|
+
clip-path: none;
|
|
310
|
+
}
|
|
311
|
+
.bar-chart .chart-bar {
|
|
312
|
+
transition: none !important;
|
|
313
|
+
transform: none !important;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CSSProperties, MouseEventHandler } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import "./style.css";
|
|
4
|
+
interface Props {
|
|
5
|
+
label: boolean;
|
|
6
|
+
version: "primary";
|
|
7
|
+
color: "primary" | "secondary" | "tertiary" | "fourth";
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
11
|
+
onMouseLeave?: MouseEventHandler<HTMLDivElement>;
|
|
12
|
+
}
|
|
13
|
+
export declare const LineBarHorizontal: {
|
|
14
|
+
({ label, version, color, className, style, onMouseEnter, onMouseLeave, }: Props): React.JSX.Element;
|
|
15
|
+
propTypes: {
|
|
16
|
+
label: PropTypes.Requireable<boolean>;
|
|
17
|
+
version: PropTypes.Requireable<string>;
|
|
18
|
+
color: PropTypes.Requireable<string>;
|
|
19
|
+
className: PropTypes.Requireable<string>;
|
|
20
|
+
style: PropTypes.Requireable<object>;
|
|
21
|
+
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
+
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { Label } from "../Label";
|
|
4
|
+
import "./style.css";
|
|
5
|
+
export const LineBarHorizontal = ({ label = true, version, color, className = "", style, onMouseEnter, onMouseLeave, }) => {
|
|
6
|
+
return (_jsx("div", { className: `line-bar-horizontal color-${color} ${className}`, style: style, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: label && (_jsx(Label, { bold: "on", className: "label-14", color: "black", divClassName: "instance-node", size: "small", spacing: "off", stroke: "off", text: "Label", version: version })) }));
|
|
7
|
+
};
|
|
8
|
+
LineBarHorizontal.propTypes = {
|
|
9
|
+
label: PropTypes.bool,
|
|
10
|
+
version: PropTypes.oneOf(["primary"]),
|
|
11
|
+
color: PropTypes.oneOf(["primary", "secondary", "tertiary", "fourth"]),
|
|
12
|
+
className: PropTypes.string,
|
|
13
|
+
style: PropTypes.object,
|
|
14
|
+
onMouseEnter: PropTypes.func,
|
|
15
|
+
onMouseLeave: PropTypes.func,
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LineBarHorizontal } from "./LineBarHorizontal";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LineBarHorizontal } from "./LineBarHorizontal";
|