@x-plat/design-system 0.5.17 → 0.5.19
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/index.cjs +147 -27
- package/dist/components/Chart/index.css +74 -7
- package/dist/components/Chart/index.js +147 -27
- package/dist/components/Drawer/index.cjs +2 -4
- package/dist/components/Drawer/index.css +12 -0
- package/dist/components/Drawer/index.d.cts +2 -1
- package/dist/components/Drawer/index.d.ts +2 -1
- package/dist/components/Drawer/index.js +2 -4
- package/dist/components/Dropdown/index.cjs +2 -0
- package/dist/components/Dropdown/index.js +2 -0
- package/dist/components/PopOver/index.cjs +2 -0
- package/dist/components/PopOver/index.css +2 -1
- package/dist/components/PopOver/index.js +2 -0
- package/dist/components/Select/index.cjs +2 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/Skeleton/index.cjs +3 -2
- package/dist/components/Skeleton/index.d.cts +3 -2
- package/dist/components/Skeleton/index.d.ts +3 -2
- package/dist/components/Skeleton/index.js +3 -2
- package/dist/components/index.cjs +154 -33
- package/dist/components/index.css +88 -8
- package/dist/components/index.js +154 -33
- package/dist/index.cjs +158 -49
- package/dist/index.css +88 -8
- package/dist/index.js +158 -49
- package/dist/layout/Grid/FullGrid/index.cjs +2 -8
- package/dist/layout/Grid/FullGrid/index.d.cts +2 -1
- package/dist/layout/Grid/FullGrid/index.d.ts +2 -1
- package/dist/layout/Grid/FullGrid/index.js +2 -8
- package/dist/layout/Grid/FullScreen/index.cjs +2 -8
- package/dist/layout/Grid/FullScreen/index.d.cts +2 -1
- package/dist/layout/Grid/FullScreen/index.d.ts +2 -1
- package/dist/layout/Grid/FullScreen/index.js +2 -8
- package/dist/layout/Grid/index.cjs +4 -16
- package/dist/layout/Grid/index.js +4 -16
- package/dist/layout/index.cjs +4 -16
- package/dist/layout/index.js +4 -16
- package/package.json +1 -1
|
@@ -1826,6 +1826,7 @@
|
|
|
1826
1826
|
font-weight: 600;
|
|
1827
1827
|
fill: var(--semantic-text-inverse);
|
|
1828
1828
|
pointer-events: none;
|
|
1829
|
+
opacity: 1;
|
|
1829
1830
|
}
|
|
1830
1831
|
.lib-xplat-chart .chart-pie {
|
|
1831
1832
|
max-width: 300px;
|
|
@@ -1835,10 +1836,10 @@
|
|
|
1835
1836
|
cursor: pointer;
|
|
1836
1837
|
r: 0;
|
|
1837
1838
|
opacity: 0;
|
|
1838
|
-
transition: r 0.15s, opacity 0.15s;
|
|
1839
|
+
transition: r 0.15s ease-out, opacity 0.15s ease-out;
|
|
1839
1840
|
}
|
|
1840
1841
|
.lib-xplat-chart .chart-point:hover {
|
|
1841
|
-
r:
|
|
1842
|
+
r: 6;
|
|
1842
1843
|
opacity: 1;
|
|
1843
1844
|
}
|
|
1844
1845
|
.lib-xplat-chart .chart-svg:hover .chart-point {
|
|
@@ -1847,7 +1848,7 @@
|
|
|
1847
1848
|
}
|
|
1848
1849
|
.lib-xplat-chart .chart-bar {
|
|
1849
1850
|
cursor: pointer;
|
|
1850
|
-
transition: opacity 0.15s, filter 0.15s;
|
|
1851
|
+
transition: opacity 0.15s ease-out, filter 0.15s ease-out;
|
|
1851
1852
|
}
|
|
1852
1853
|
.lib-xplat-chart .chart-bar:hover {
|
|
1853
1854
|
opacity: 0.85;
|
|
@@ -1858,15 +1859,22 @@
|
|
|
1858
1859
|
stroke: var(--semantic-surface-neutral-default);
|
|
1859
1860
|
stroke-width: 2;
|
|
1860
1861
|
transition:
|
|
1861
|
-
opacity 0.15s,
|
|
1862
|
-
filter 0.15s,
|
|
1863
|
-
transform 0.15s;
|
|
1862
|
+
opacity 0.15s ease-out,
|
|
1863
|
+
filter 0.15s ease-out,
|
|
1864
|
+
transform 0.15s ease-out;
|
|
1864
1865
|
transform-origin: center;
|
|
1865
1866
|
}
|
|
1867
|
+
.lib-xplat-chart .chart-svg:hover .chart-slice {
|
|
1868
|
+
opacity: 0.5;
|
|
1869
|
+
}
|
|
1866
1870
|
.lib-xplat-chart .chart-slice:hover {
|
|
1867
|
-
opacity:
|
|
1871
|
+
opacity: 1 !important;
|
|
1872
|
+
transform: scale(1.03);
|
|
1868
1873
|
filter: brightness(1.05) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
|
|
1869
1874
|
}
|
|
1875
|
+
.lib-xplat-chart .chart-area {
|
|
1876
|
+
opacity: 1;
|
|
1877
|
+
}
|
|
1870
1878
|
.lib-xplat-chart .chart-tooltip {
|
|
1871
1879
|
position: absolute;
|
|
1872
1880
|
transform: translate(-50%, -100%);
|
|
@@ -1879,6 +1887,65 @@
|
|
|
1879
1887
|
white-space: nowrap;
|
|
1880
1888
|
pointer-events: none;
|
|
1881
1889
|
z-index: 10;
|
|
1890
|
+
animation: chart-tooltip-in 150ms ease-out;
|
|
1891
|
+
}
|
|
1892
|
+
.lib-xplat-chart .chart-bar-animate {
|
|
1893
|
+
animation: chart-bar-grow 800ms ease-out both;
|
|
1894
|
+
}
|
|
1895
|
+
.lib-xplat-chart .chart-slice-group-animate {
|
|
1896
|
+
animation: chart-slice-in 1000ms ease-out both;
|
|
1897
|
+
}
|
|
1898
|
+
.lib-xplat-chart .chart-pie-label-animate {
|
|
1899
|
+
animation: chart-fade-in 150ms ease-out both;
|
|
1900
|
+
}
|
|
1901
|
+
.lib-xplat-chart .chart-area[style*=animationDelay] {
|
|
1902
|
+
animation: chart-fade-in 800ms ease-out both;
|
|
1903
|
+
}
|
|
1904
|
+
@keyframes chart-bar-grow {
|
|
1905
|
+
from {
|
|
1906
|
+
transform: scaleY(0);
|
|
1907
|
+
}
|
|
1908
|
+
to {
|
|
1909
|
+
transform: scaleY(1);
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
@keyframes chart-slice-in {
|
|
1913
|
+
from {
|
|
1914
|
+
opacity: 0;
|
|
1915
|
+
transform: scale(0.8);
|
|
1916
|
+
}
|
|
1917
|
+
to {
|
|
1918
|
+
opacity: 1;
|
|
1919
|
+
transform: scale(1);
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
@keyframes chart-fade-in {
|
|
1923
|
+
from {
|
|
1924
|
+
opacity: 0;
|
|
1925
|
+
}
|
|
1926
|
+
to {
|
|
1927
|
+
opacity: 1;
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
@keyframes chart-tooltip-in {
|
|
1931
|
+
from {
|
|
1932
|
+
opacity: 0;
|
|
1933
|
+
transform: translate(-50%, -90%);
|
|
1934
|
+
}
|
|
1935
|
+
to {
|
|
1936
|
+
opacity: 1;
|
|
1937
|
+
transform: translate(-50%, -100%);
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1941
|
+
.lib-xplat-chart .chart-bar-animate,
|
|
1942
|
+
.lib-xplat-chart .chart-slice-group-animate,
|
|
1943
|
+
.lib-xplat-chart .chart-pie-label-animate,
|
|
1944
|
+
.lib-xplat-chart .chart-area {
|
|
1945
|
+
animation: none !important;
|
|
1946
|
+
opacity: 1 !important;
|
|
1947
|
+
transform: none !important;
|
|
1948
|
+
}
|
|
1882
1949
|
}
|
|
1883
1950
|
|
|
1884
1951
|
/* src/components/CheckBox/checkbox.scss */
|
|
@@ -2551,6 +2618,18 @@
|
|
|
2551
2618
|
transition: transform 0.25s ease;
|
|
2552
2619
|
z-index: 1001;
|
|
2553
2620
|
}
|
|
2621
|
+
.lib-xplat-drawer.sm {
|
|
2622
|
+
width: 280px;
|
|
2623
|
+
}
|
|
2624
|
+
.lib-xplat-drawer.md {
|
|
2625
|
+
width: 360px;
|
|
2626
|
+
}
|
|
2627
|
+
.lib-xplat-drawer.lg {
|
|
2628
|
+
width: 480px;
|
|
2629
|
+
}
|
|
2630
|
+
.lib-xplat-drawer.xl {
|
|
2631
|
+
width: 640px;
|
|
2632
|
+
}
|
|
2554
2633
|
.lib-xplat-drawer.right {
|
|
2555
2634
|
right: 0;
|
|
2556
2635
|
transform: translateX(100%);
|
|
@@ -2934,7 +3013,8 @@
|
|
|
2934
3013
|
/* src/components/PopOver/popOver.scss */
|
|
2935
3014
|
.lib-xplat-pop-over {
|
|
2936
3015
|
position: relative;
|
|
2937
|
-
width:
|
|
3016
|
+
width: 100%;
|
|
3017
|
+
height: 100%;
|
|
2938
3018
|
cursor: pointer;
|
|
2939
3019
|
user-select: none;
|
|
2940
3020
|
}
|
package/dist/components/index.js
CHANGED
|
@@ -2109,6 +2109,37 @@ var useChartSize = (ref) => {
|
|
|
2109
2109
|
}, [ref]);
|
|
2110
2110
|
return size;
|
|
2111
2111
|
};
|
|
2112
|
+
var prefersReducedMotion = () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2113
|
+
var useChartAnimation = (containerRef, dataKey) => {
|
|
2114
|
+
const [animate, setAnimate] = React5.useState(false);
|
|
2115
|
+
const prevDataKey = React5.useRef(dataKey);
|
|
2116
|
+
const hasAnimated = React5.useRef(false);
|
|
2117
|
+
React5.useEffect(() => {
|
|
2118
|
+
if (prefersReducedMotion()) return;
|
|
2119
|
+
const el = containerRef.current;
|
|
2120
|
+
if (!el) return;
|
|
2121
|
+
const observer = new IntersectionObserver(
|
|
2122
|
+
([entry]) => {
|
|
2123
|
+
if (entry.isIntersecting && !hasAnimated.current) {
|
|
2124
|
+
hasAnimated.current = true;
|
|
2125
|
+
setAnimate(true);
|
|
2126
|
+
}
|
|
2127
|
+
},
|
|
2128
|
+
{ threshold: 0.1 }
|
|
2129
|
+
);
|
|
2130
|
+
observer.observe(el);
|
|
2131
|
+
return () => observer.disconnect();
|
|
2132
|
+
}, [containerRef]);
|
|
2133
|
+
React5.useEffect(() => {
|
|
2134
|
+
if (dataKey !== prevDataKey.current) {
|
|
2135
|
+
prevDataKey.current = dataKey;
|
|
2136
|
+
if (prefersReducedMotion()) return;
|
|
2137
|
+
setAnimate(false);
|
|
2138
|
+
requestAnimationFrame(() => setAnimate(true));
|
|
2139
|
+
}
|
|
2140
|
+
}, [dataKey]);
|
|
2141
|
+
return animate || prefersReducedMotion();
|
|
2142
|
+
};
|
|
2112
2143
|
var useChartTooltip = (enabled) => {
|
|
2113
2144
|
const [tooltip, setTooltip] = React5.useState({
|
|
2114
2145
|
visible: false,
|
|
@@ -2174,7 +2205,7 @@ var AxisLabels = React5.memo(({ labels, count, chartW, height }) => {
|
|
|
2174
2205
|
}) });
|
|
2175
2206
|
});
|
|
2176
2207
|
AxisLabels.displayName = "AxisLabels";
|
|
2177
|
-
var LineChart = React5.memo(({ data, labels, width, height, onHover, onMove, onLeave }) => {
|
|
2208
|
+
var LineChart = React5.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
2178
2209
|
const entries = React5.useMemo(() => Object.entries(data), [data]);
|
|
2179
2210
|
const maxVal = React5.useMemo(() => {
|
|
2180
2211
|
const allValues = entries.flatMap(([, v]) => v);
|
|
@@ -2194,18 +2225,52 @@ var LineChart = React5.memo(({ data, labels, width, height, onHover, onMove, onL
|
|
|
2194
2225
|
[entries, count, chartW, chartH, maxVal]
|
|
2195
2226
|
);
|
|
2196
2227
|
const showPoints = count <= 100;
|
|
2228
|
+
const lineRefs = React5.useRef([]);
|
|
2229
|
+
React5.useEffect(() => {
|
|
2230
|
+
if (!animate) return;
|
|
2231
|
+
lineRefs.current.forEach((el) => {
|
|
2232
|
+
if (!el) return;
|
|
2233
|
+
const len = el.getTotalLength();
|
|
2234
|
+
el.style.strokeDasharray = `${len}`;
|
|
2235
|
+
el.style.strokeDashoffset = `${len}`;
|
|
2236
|
+
requestAnimationFrame(() => {
|
|
2237
|
+
el.style.transition = "stroke-dashoffset 1200ms ease-out 200ms";
|
|
2238
|
+
el.style.strokeDashoffset = "0";
|
|
2239
|
+
});
|
|
2240
|
+
});
|
|
2241
|
+
}, [animate, seriesPoints]);
|
|
2197
2242
|
return /* @__PURE__ */ jsxs196("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
|
|
2198
2243
|
/* @__PURE__ */ jsx305(GridLines, { width, height, chartH, maxVal }),
|
|
2199
2244
|
/* @__PURE__ */ jsx305(AxisLabels, { labels, count, chartW, height }),
|
|
2200
2245
|
entries.map(([key], di) => {
|
|
2201
2246
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
2202
2247
|
const color = palette[2];
|
|
2248
|
+
const areaColor = palette[0];
|
|
2203
2249
|
const points = seriesPoints[di];
|
|
2250
|
+
const gradientId = `line-gradient-${di}`;
|
|
2251
|
+
const polyPoints = points.map((p) => `${p.x},${p.y}`).join(" ");
|
|
2252
|
+
const areaD = `M ${points[0].x},${points[0].y} ${points.map((p) => `L ${p.x},${p.y}`).join(" ")} L ${points[points.length - 1].x},${PADDING.top + chartH} L ${points[0].x},${PADDING.top + chartH} Z`;
|
|
2204
2253
|
return /* @__PURE__ */ jsxs196("g", { children: [
|
|
2254
|
+
/* @__PURE__ */ jsx305("defs", { children: /* @__PURE__ */ jsxs196("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
2255
|
+
/* @__PURE__ */ jsx305("stop", { offset: "0%", stopColor: areaColor, stopOpacity: "0.2" }),
|
|
2256
|
+
/* @__PURE__ */ jsx305("stop", { offset: "100%", stopColor: areaColor, stopOpacity: "0" })
|
|
2257
|
+
] }) }),
|
|
2258
|
+
/* @__PURE__ */ jsx305(
|
|
2259
|
+
"path",
|
|
2260
|
+
{
|
|
2261
|
+
d: areaD,
|
|
2262
|
+
fill: `url(#${gradientId})`,
|
|
2263
|
+
className: "chart-area",
|
|
2264
|
+
style: animate ? { animationDelay: "600ms" } : { opacity: 1 }
|
|
2265
|
+
}
|
|
2266
|
+
),
|
|
2205
2267
|
/* @__PURE__ */ jsx305(
|
|
2206
2268
|
"polyline",
|
|
2207
2269
|
{
|
|
2208
|
-
|
|
2270
|
+
ref: (el) => {
|
|
2271
|
+
lineRefs.current[di] = el;
|
|
2272
|
+
},
|
|
2273
|
+
points: polyPoints,
|
|
2209
2274
|
fill: "none",
|
|
2210
2275
|
stroke: color,
|
|
2211
2276
|
strokeWidth: "2"
|
|
@@ -2230,7 +2295,7 @@ var LineChart = React5.memo(({ data, labels, width, height, onHover, onMove, onL
|
|
|
2230
2295
|
] });
|
|
2231
2296
|
});
|
|
2232
2297
|
LineChart.displayName = "LineChart";
|
|
2233
|
-
var CurveChart = React5.memo(({ data, labels, width, height, onHover, onMove, onLeave }) => {
|
|
2298
|
+
var CurveChart = React5.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
2234
2299
|
const entries = React5.useMemo(() => Object.entries(data), [data]);
|
|
2235
2300
|
const maxVal = React5.useMemo(() => {
|
|
2236
2301
|
const allValues = entries.flatMap(([, v]) => v);
|
|
@@ -2250,6 +2315,20 @@ var CurveChart = React5.memo(({ data, labels, width, height, onHover, onMove, on
|
|
|
2250
2315
|
[entries, count, chartW, chartH, maxVal]
|
|
2251
2316
|
);
|
|
2252
2317
|
const showPoints = count <= 100;
|
|
2318
|
+
const lineRefs = React5.useRef([]);
|
|
2319
|
+
React5.useEffect(() => {
|
|
2320
|
+
if (!animate) return;
|
|
2321
|
+
lineRefs.current.forEach((el) => {
|
|
2322
|
+
if (!el) return;
|
|
2323
|
+
const len = el.getTotalLength();
|
|
2324
|
+
el.style.strokeDasharray = `${len}`;
|
|
2325
|
+
el.style.strokeDashoffset = `${len}`;
|
|
2326
|
+
requestAnimationFrame(() => {
|
|
2327
|
+
el.style.transition = "stroke-dashoffset 1200ms ease-out 200ms";
|
|
2328
|
+
el.style.strokeDashoffset = "0";
|
|
2329
|
+
});
|
|
2330
|
+
});
|
|
2331
|
+
}, [animate, seriesPoints]);
|
|
2253
2332
|
return /* @__PURE__ */ jsxs196("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
|
|
2254
2333
|
/* @__PURE__ */ jsx305(GridLines, { width, height, chartH, maxVal }),
|
|
2255
2334
|
/* @__PURE__ */ jsx305(AxisLabels, { labels, count, chartW, height }),
|
|
@@ -2266,8 +2345,27 @@ var CurveChart = React5.memo(({ data, labels, width, height, onHover, onMove, on
|
|
|
2266
2345
|
/* @__PURE__ */ jsx305("stop", { offset: "0%", stopColor: areaColor, stopOpacity: "0.4" }),
|
|
2267
2346
|
/* @__PURE__ */ jsx305("stop", { offset: "100%", stopColor: areaColor, stopOpacity: "0.02" })
|
|
2268
2347
|
] }) }),
|
|
2269
|
-
/* @__PURE__ */ jsx305(
|
|
2270
|
-
|
|
2348
|
+
/* @__PURE__ */ jsx305(
|
|
2349
|
+
"path",
|
|
2350
|
+
{
|
|
2351
|
+
d: areaPath,
|
|
2352
|
+
fill: `url(#${gradientId})`,
|
|
2353
|
+
className: "chart-area",
|
|
2354
|
+
style: animate ? { animationDelay: "600ms" } : { opacity: 1 }
|
|
2355
|
+
}
|
|
2356
|
+
),
|
|
2357
|
+
/* @__PURE__ */ jsx305(
|
|
2358
|
+
"path",
|
|
2359
|
+
{
|
|
2360
|
+
ref: (el) => {
|
|
2361
|
+
lineRefs.current[di] = el;
|
|
2362
|
+
},
|
|
2363
|
+
d: linePath,
|
|
2364
|
+
fill: "none",
|
|
2365
|
+
stroke: color,
|
|
2366
|
+
strokeWidth: "2"
|
|
2367
|
+
}
|
|
2368
|
+
),
|
|
2271
2369
|
showPoints && points.map((p, i) => /* @__PURE__ */ jsx305(
|
|
2272
2370
|
"circle",
|
|
2273
2371
|
{
|
|
@@ -2287,7 +2385,7 @@ var CurveChart = React5.memo(({ data, labels, width, height, onHover, onMove, on
|
|
|
2287
2385
|
] });
|
|
2288
2386
|
});
|
|
2289
2387
|
CurveChart.displayName = "CurveChart";
|
|
2290
|
-
var BarChart = React5.memo(({ data, labels, width, height, onHover, onMove, onLeave }) => {
|
|
2388
|
+
var BarChart = React5.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
2291
2389
|
const entries = React5.useMemo(() => Object.entries(data), [data]);
|
|
2292
2390
|
const maxVal = React5.useMemo(() => {
|
|
2293
2391
|
const allValues = entries.flatMap(([, v]) => v);
|
|
@@ -2300,6 +2398,7 @@ var BarChart = React5.memo(({ data, labels, width, height, onHover, onMove, onLe
|
|
|
2300
2398
|
const groupW = chartW / count;
|
|
2301
2399
|
const barGap = groupCount > 1 ? 2 : 0;
|
|
2302
2400
|
const barW = Math.max(1, Math.min(32, (groupW * 0.7 - barGap * (groupCount - 1)) / groupCount));
|
|
2401
|
+
const baseline = PADDING.top + chartH;
|
|
2303
2402
|
const bars = React5.useMemo(
|
|
2304
2403
|
() => entries.map(
|
|
2305
2404
|
([, values], di) => values.map((v, i) => {
|
|
@@ -2325,12 +2424,17 @@ var BarChart = React5.memo(({ data, labels, width, height, onHover, onMove, onLe
|
|
|
2325
2424
|
return bars[di].map((b, i) => {
|
|
2326
2425
|
const r2 = Math.min(4, b.w / 2);
|
|
2327
2426
|
const d = b.h <= r2 ? `M ${b.x} ${b.y + b.h} V ${b.y} H ${b.x + b.w} V ${b.y + b.h} Z` : `M ${b.x} ${b.y + b.h} V ${b.y + r2} Q ${b.x} ${b.y} ${b.x + r2} ${b.y} H ${b.x + b.w - r2} Q ${b.x + b.w} ${b.y} ${b.x + b.w} ${b.y + r2} V ${b.y + b.h} Z`;
|
|
2427
|
+
const delay = 100 + i * 80;
|
|
2328
2428
|
return /* @__PURE__ */ jsx305(
|
|
2329
2429
|
"path",
|
|
2330
2430
|
{
|
|
2331
2431
|
d,
|
|
2332
2432
|
fill: color,
|
|
2333
|
-
className: "chart-bar"
|
|
2433
|
+
className: `chart-bar ${animate ? "chart-bar-animate" : ""}`,
|
|
2434
|
+
style: animate ? {
|
|
2435
|
+
transformOrigin: `${b.x + b.w / 2}px ${baseline}px`,
|
|
2436
|
+
animationDelay: `${delay}ms`
|
|
2437
|
+
} : void 0,
|
|
2334
2438
|
onMouseEnter: (e) => onHover(e, `${key}: ${labels[i]} \u2014 ${b.v}`),
|
|
2335
2439
|
onMouseMove: onMove,
|
|
2336
2440
|
onMouseLeave: onLeave
|
|
@@ -2343,7 +2447,7 @@ var BarChart = React5.memo(({ data, labels, width, height, onHover, onMove, onLe
|
|
|
2343
2447
|
});
|
|
2344
2448
|
BarChart.displayName = "BarChart";
|
|
2345
2449
|
var PieDonutChart = React5.memo(
|
|
2346
|
-
({ data, labels, width, height, isDoughnut, onHover, onMove, onLeave }) => {
|
|
2450
|
+
({ data, labels, width, height, animate, isDoughnut, onHover, onMove, onLeave }) => {
|
|
2347
2451
|
const entries = React5.useMemo(() => Object.entries(data), [data]);
|
|
2348
2452
|
const values = React5.useMemo(() => entries.flatMap(([, v]) => v), [entries]);
|
|
2349
2453
|
const total = React5.useMemo(() => values.reduce((a, b) => a + b, 0) || 1, [values]);
|
|
@@ -2383,20 +2487,34 @@ var PieDonutChart = React5.memo(
|
|
|
2383
2487
|
return { d, lx, ly, v, pct, angle, label: labels[i] || `${i + 1}` };
|
|
2384
2488
|
});
|
|
2385
2489
|
}, [values, total, cx, cy, r2, innerR, labels]);
|
|
2386
|
-
return /* @__PURE__ */ jsx305("svg", { viewBox: `0 0 ${size} ${size}`, className: "chart-svg chart-pie", children: sliceData.map((s, i) =>
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2490
|
+
return /* @__PURE__ */ jsx305("svg", { viewBox: `0 0 ${size} ${size}`, className: "chart-svg chart-pie", children: sliceData.map((s, i) => {
|
|
2491
|
+
const delay = i * 100;
|
|
2492
|
+
return /* @__PURE__ */ jsxs196("g", { className: animate ? "chart-slice-group-animate" : "", style: animate ? { animationDelay: `${delay}ms` } : void 0, children: [
|
|
2493
|
+
/* @__PURE__ */ jsx305(
|
|
2494
|
+
"path",
|
|
2495
|
+
{
|
|
2496
|
+
d: s.d,
|
|
2497
|
+
fill: PIE_COLORS[(i + colorOffset) % PIE_COLORS.length],
|
|
2498
|
+
className: "chart-slice",
|
|
2499
|
+
onMouseEnter: (e) => onHover(e, `${s.label}: ${s.v} (${s.pct}%)`),
|
|
2500
|
+
onMouseMove: onMove,
|
|
2501
|
+
onMouseLeave: onLeave
|
|
2502
|
+
}
|
|
2503
|
+
),
|
|
2504
|
+
s.angle > 0.2 && /* @__PURE__ */ jsx305(
|
|
2505
|
+
"text",
|
|
2506
|
+
{
|
|
2507
|
+
x: s.lx,
|
|
2508
|
+
y: s.ly,
|
|
2509
|
+
className: `chart-pie-label ${animate ? "chart-pie-label-animate" : ""}`,
|
|
2510
|
+
style: animate ? { animationDelay: `${delay + 150}ms` } : void 0,
|
|
2511
|
+
textAnchor: "middle",
|
|
2512
|
+
dominantBaseline: "central",
|
|
2513
|
+
children: s.v
|
|
2514
|
+
}
|
|
2515
|
+
)
|
|
2516
|
+
] }, i);
|
|
2517
|
+
}) });
|
|
2400
2518
|
}
|
|
2401
2519
|
);
|
|
2402
2520
|
PieDonutChart.displayName = "PieDonutChart";
|
|
@@ -2430,13 +2548,15 @@ var Chart = React5.memo((props) => {
|
|
|
2430
2548
|
const { width, height } = useChartSize(containerRef);
|
|
2431
2549
|
const stableData = React5.useMemo(() => data, [JSON.stringify(data)]);
|
|
2432
2550
|
const stableLabels = React5.useMemo(() => labels, [JSON.stringify(labels)]);
|
|
2551
|
+
const dataKey = React5.useMemo(() => JSON.stringify(labels), [labels]);
|
|
2552
|
+
const animate = useChartAnimation(containerRef, dataKey);
|
|
2433
2553
|
const ready = width > 0 && height > 0;
|
|
2434
2554
|
return /* @__PURE__ */ jsxs196("div", { className: "lib-xplat-chart", ref: containerRef, children: [
|
|
2435
|
-
ready && type === "line" && /* @__PURE__ */ jsx305(LineChart, { data: stableData, labels: stableLabels, width, height, onHover: show, onMove: move, onLeave: hide }),
|
|
2436
|
-
ready && type === "curve" && /* @__PURE__ */ jsx305(CurveChart, { data: stableData, labels: stableLabels, width, height, onHover: show, onMove: move, onLeave: hide }),
|
|
2437
|
-
ready && type === "bar" && /* @__PURE__ */ jsx305(BarChart, { data: stableData, labels: stableLabels, width, height, onHover: show, onMove: move, onLeave: hide }),
|
|
2438
|
-
ready && type === "pie" && /* @__PURE__ */ jsx305(PieDonutChart, { data: stableData, labels: stableLabels, width, height, onHover: show, onMove: move, onLeave: hide }),
|
|
2439
|
-
ready && type === "doughnut" && /* @__PURE__ */ jsx305(PieDonutChart, { data: stableData, labels: stableLabels, width, height, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
2555
|
+
ready && type === "line" && /* @__PURE__ */ jsx305(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2556
|
+
ready && type === "curve" && /* @__PURE__ */ jsx305(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2557
|
+
ready && type === "bar" && /* @__PURE__ */ jsx305(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2558
|
+
ready && type === "pie" && /* @__PURE__ */ jsx305(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2559
|
+
ready && type === "doughnut" && /* @__PURE__ */ jsx305(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
2440
2560
|
tooltip.visible && /* @__PURE__ */ jsx305(TooltipBubble, { x: tooltip.x, y: tooltip.y, containerWidth: width, children: tooltip.content })
|
|
2441
2561
|
] });
|
|
2442
2562
|
});
|
|
@@ -3248,7 +3368,7 @@ import { createPortal as createPortal2 } from "react-dom";
|
|
|
3248
3368
|
import { jsx as jsx320, jsxs as jsxs205 } from "react/jsx-runtime";
|
|
3249
3369
|
var ANIMATION_DURATION_MS2 = 250;
|
|
3250
3370
|
var Drawer = (props) => {
|
|
3251
|
-
const { isOpen, onClose, placement = "right",
|
|
3371
|
+
const { isOpen, onClose, placement = "right", size = "md", title, children } = props;
|
|
3252
3372
|
const [mounted, setMounted] = React16.useState(false);
|
|
3253
3373
|
const [visible, setVisible] = React16.useState(false);
|
|
3254
3374
|
React16.useEffect(() => {
|
|
@@ -3264,7 +3384,6 @@ var Drawer = (props) => {
|
|
|
3264
3384
|
if (typeof document === "undefined") return null;
|
|
3265
3385
|
if (!mounted) return null;
|
|
3266
3386
|
const stateClass = visible ? "enter" : "exit";
|
|
3267
|
-
const widthValue = typeof width === "number" ? `${width}px` : width;
|
|
3268
3387
|
return createPortal2(
|
|
3269
3388
|
/* @__PURE__ */ jsx320(
|
|
3270
3389
|
"div",
|
|
@@ -3274,8 +3393,7 @@ var Drawer = (props) => {
|
|
|
3274
3393
|
children: /* @__PURE__ */ jsxs205(
|
|
3275
3394
|
"div",
|
|
3276
3395
|
{
|
|
3277
|
-
className: clsx_default("lib-xplat-drawer", placement, stateClass),
|
|
3278
|
-
style: { width: widthValue },
|
|
3396
|
+
className: clsx_default("lib-xplat-drawer", placement, size, stateClass),
|
|
3279
3397
|
role: "dialog",
|
|
3280
3398
|
"aria-modal": "true",
|
|
3281
3399
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -3335,6 +3453,8 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3335
3453
|
React17.useLayoutEffect(() => {
|
|
3336
3454
|
if (!enabled) return;
|
|
3337
3455
|
calculatePosition();
|
|
3456
|
+
const raf = requestAnimationFrame(calculatePosition);
|
|
3457
|
+
return () => cancelAnimationFrame(raf);
|
|
3338
3458
|
}, [calculatePosition, enabled]);
|
|
3339
3459
|
React17.useEffect(() => {
|
|
3340
3460
|
if (!enabled) return;
|
|
@@ -4151,11 +4271,12 @@ var Select_default = Select;
|
|
|
4151
4271
|
|
|
4152
4272
|
// src/components/Skeleton/Skeleton.tsx
|
|
4153
4273
|
import { jsx as jsx333 } from "react/jsx-runtime";
|
|
4274
|
+
var toSizeVar = (token) => token === "full" ? "100%" : `var(--spacing-size-${token})`;
|
|
4154
4275
|
var Skeleton = (props) => {
|
|
4155
4276
|
const { variant = "text", width, height } = props;
|
|
4156
4277
|
const style = {
|
|
4157
|
-
width
|
|
4158
|
-
height
|
|
4278
|
+
...width != null && { width: toSizeVar(width) },
|
|
4279
|
+
...height != null && { height: toSizeVar(height) }
|
|
4159
4280
|
};
|
|
4160
4281
|
return /* @__PURE__ */ jsx333(
|
|
4161
4282
|
"div",
|