@sybilion/uilib 1.2.26 → 1.3.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/esm/components/ui/Chart/Chart.js +5 -0
- package/dist/esm/components/ui/Chart/components/BaseChartWrapper.js +7 -32
- package/dist/esm/components/ui/Chart/components/ChartEmptyState/ChartEmptyState.js +21 -0
- package/dist/esm/components/ui/Chart/components/ChartEmptyState/ChartEmptyState.styl.js +7 -0
- package/dist/esm/components/ui/Chart/lightweight/LightweightForecastChart.js +460 -0
- package/dist/esm/components/ui/Chart/lightweight/LightweightForecastChart.styl.js +7 -0
- package/dist/esm/components/ui/Chart/lightweight/chartTime.js +16 -0
- package/dist/esm/components/ui/Chart/lightweight/lightweightForecastChart.helpers.js +114 -0
- package/dist/esm/components/ui/Chart/lightweight/quantileBandCustomSeries.js +147 -0
- package/dist/esm/components/ui/Chart/quantileBandConeChartData.js +131 -0
- package/dist/esm/components/ui/Chart/tools/chartPlotGeometry.js +65 -0
- package/dist/esm/components/ui/ChartAreaInteractive/ChartAreaInteractive.helpers.js +37 -1
- package/dist/esm/components/ui/ChartAreaInteractive/ChartAreaInteractive.js +5 -2
- package/dist/esm/components/ui/ChartAreaInteractive/TimeRangeBrushLayer.js +205 -0
- package/dist/esm/components/ui/ChartAreaInteractive/TimeRangeBrushLayer.styl.js +7 -0
- package/dist/esm/components/ui/ChartAreaInteractive/TimeRangeBrushLayout.helpers.js +37 -0
- package/dist/esm/components/ui/ChartAreaInteractive/overlays/IntervalsOverlay/IntervalsOverlay.hooks.js +1 -0
- package/dist/esm/components/ui/ChartAreaInteractive/overlays/PinOverlay/PinOverlay.js +7 -60
- package/dist/esm/components/ui/ChartAreaInteractive/overlays/PinOverlay/PinOverlay.styl.js +2 -2
- package/dist/esm/components/ui/ChartAreaInteractive/overlays/ThresholdsOverlay/ThresholdsOverlay.hooks.js +1 -0
- package/dist/esm/components/ui/ChartAreaInteractive/overlays/useChartYRange.js +2 -4
- package/dist/esm/components/ui/ChartAreaInteractive/overlays/useQuantileBands.js +4 -102
- package/dist/esm/components/ui/TimeRangeControls/TimeRangeControls.js +7 -2
- package/dist/esm/components/ui/WorldMap/WorldMap.js +11 -0
- package/dist/esm/components/ui/WorldMap/WorldMap.styl.js +7 -0
- package/dist/esm/components/widgets/DriverCard/DriverCard.js +89 -0
- package/dist/esm/components/widgets/DriverCard/DriverCard.styl.js +7 -0
- package/dist/esm/components/widgets/DriverCard/DriverPerformanceChart.js +83 -0
- package/dist/esm/components/widgets/DriverCard/DriverPerformanceChart.styl.js +7 -0
- package/dist/esm/components/widgets/DriverCard/driverPerformanceChartData.js +50 -0
- package/dist/esm/components/widgets/DriverMap/DriverMap.js +2 -2
- package/dist/esm/components/widgets/DriverMap/DriverMap.styl.js +2 -2
- package/dist/esm/index.js +4 -2
- package/dist/esm/types/src/components/ui/Chart/Chart.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Chart/components/BaseChartWrapper.d.ts +2 -1
- package/dist/esm/types/src/components/ui/Chart/components/ChartEmptyState/ChartEmptyState.d.ts +14 -0
- package/dist/esm/types/src/components/ui/Chart/lightweight/LightweightForecastChart.d.ts +26 -0
- package/dist/esm/types/src/components/ui/Chart/lightweight/chartTime.d.ts +5 -0
- package/dist/esm/types/src/components/ui/Chart/lightweight/lightweightForecastChart.helpers.d.ts +13 -0
- package/dist/esm/types/src/components/ui/Chart/lightweight/quantileBandCustomSeries.d.ts +24 -0
- package/dist/esm/types/src/components/ui/Chart/quantileBandConeChartData.d.ts +7 -0
- package/dist/esm/types/src/components/ui/Chart/tools/chartPlotGeometry.d.ts +30 -0
- package/dist/esm/types/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.d.ts +1 -1
- package/dist/esm/types/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.helpers.d.ts +11 -2
- package/dist/esm/types/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.types.d.ts +2 -2
- package/dist/esm/types/src/components/ui/ChartAreaInteractive/TimeRangeBrushLayer.d.ts +15 -0
- package/dist/esm/types/src/components/ui/ChartAreaInteractive/TimeRangeBrushLayout.helpers.d.ts +14 -0
- package/dist/esm/types/src/components/ui/ChartAreaInteractive/overlays/PinOverlay/PinOverlay.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Page/PageColumns/PageColumns.d.ts +1 -1
- package/dist/esm/types/src/components/ui/TimeRangeControls/TimeRangeControls.d.ts +5 -7
- package/dist/esm/types/src/components/ui/WorldMap/WorldMap.d.ts +4 -0
- package/dist/esm/types/src/components/ui/WorldMap/index.d.ts +2 -0
- package/dist/esm/types/src/components/widgets/DriverCard/DriverCard.d.ts +9 -0
- package/dist/esm/types/src/components/widgets/DriverCard/DriverPerformanceChart.d.ts +5 -0
- package/dist/esm/types/src/components/widgets/DriverCard/driverPerformanceChartData.d.ts +7 -0
- package/dist/esm/types/src/components/widgets/DriverCard/index.d.ts +1 -0
- package/dist/esm/types/src/components/widgets/DriverMap/index.d.ts +0 -2
- package/dist/esm/types/src/docs/pages/LightweightChartPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/PageColumnsPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/WorldMapPage.d.ts +1 -0
- package/dist/esm/types/src/index.d.ts +2 -0
- package/package.json +3 -2
- package/src/components/ui/Chart/Chart.tsx +9 -0
- package/src/components/ui/Chart/components/BaseChartWrapper.tsx +8 -41
- package/src/components/ui/Chart/components/ChartEmptyState/ChartEmptyState.styl +60 -0
- package/src/components/ui/Chart/components/ChartEmptyState/ChartEmptyState.styl.d.ts +15 -0
- package/src/components/ui/Chart/components/ChartEmptyState/ChartEmptyState.tsx +66 -0
- package/src/components/ui/Chart/lightweight/LightweightForecastChart.styl +25 -0
- package/src/components/ui/Chart/lightweight/LightweightForecastChart.styl.d.ts +11 -0
- package/src/components/ui/Chart/lightweight/LightweightForecastChart.tsx +721 -0
- package/src/components/ui/Chart/lightweight/chartTime.ts +18 -0
- package/src/components/ui/Chart/lightweight/lightweightForecastChart.helpers.ts +141 -0
- package/src/components/ui/Chart/lightweight/quantileBandCustomSeries.ts +215 -0
- package/src/components/ui/Chart/quantileBandConeChartData.ts +171 -0
- package/src/components/ui/Chart/tools/chartPlotGeometry.ts +89 -0
- package/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.helpers.ts +44 -2
- package/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.tsx +14 -1
- package/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.types.ts +2 -3
- package/src/components/ui/ChartAreaInteractive/TimeRangeBrushLayer.styl +21 -0
- package/src/components/{widgets/DriverMap/LoadingSpinner/LoadingSpinner.styl.d.ts → ui/ChartAreaInteractive/TimeRangeBrushLayer.styl.d.ts} +3 -3
- package/src/components/ui/ChartAreaInteractive/TimeRangeBrushLayer.tsx +285 -0
- package/src/components/ui/ChartAreaInteractive/TimeRangeBrushLayout.helpers.ts +55 -0
- package/src/components/ui/ChartAreaInteractive/overlays/IntervalsOverlay/IntervalsOverlay.hooks.ts +1 -0
- package/src/components/ui/ChartAreaInteractive/overlays/PinOverlay/PinOverlay.styl +2 -7
- package/src/components/ui/ChartAreaInteractive/overlays/PinOverlay/PinOverlay.styl.d.ts +0 -1
- package/src/components/ui/ChartAreaInteractive/overlays/PinOverlay/PinOverlay.tsx +7 -71
- package/src/components/ui/ChartAreaInteractive/overlays/ThresholdsOverlay/ThresholdsOverlay.hooks.ts +1 -0
- package/src/components/ui/ChartAreaInteractive/overlays/useChartYRange.ts +2 -3
- package/src/components/ui/ChartAreaInteractive/overlays/useQuantileBands.ts +5 -131
- package/src/components/ui/Page/PageColumns/PageColumns.tsx +1 -1
- package/src/components/ui/TimeRangeControls/TimeRangeControls.tsx +16 -17
- package/src/components/{widgets/DriverMap/MapBackground/MapBackground.styl → ui/WorldMap/WorldMap.styl} +1 -3
- package/src/components/{widgets/DriverMap/MapBackground/MapBackground.styl.d.ts → ui/WorldMap/WorldMap.styl.d.ts} +1 -1
- package/src/components/ui/WorldMap/WorldMap.tsx +22 -0
- package/src/components/ui/WorldMap/index.ts +2 -0
- package/src/components/widgets/DriverCard/DriverCard.styl +169 -0
- package/src/components/widgets/DriverCard/DriverCard.styl.d.ts +40 -0
- package/src/components/widgets/DriverCard/DriverCard.tsx +219 -0
- package/src/components/widgets/DriverCard/DriverPerformanceChart.styl +43 -0
- package/src/components/widgets/DriverCard/DriverPerformanceChart.styl.d.ts +13 -0
- package/src/components/widgets/DriverCard/DriverPerformanceChart.tsx +150 -0
- package/src/components/widgets/DriverCard/driverPerformanceChartData.ts +64 -0
- package/src/components/widgets/DriverCard/index.ts +1 -0
- package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.tsx +0 -2
- package/src/components/widgets/DriverMap/DriverMap.styl +6 -1
- package/src/components/widgets/DriverMap/DriverMap.styl.d.ts +1 -0
- package/src/components/widgets/DriverMap/DriverMap.tsx +2 -4
- package/src/components/widgets/DriverMap/driverCategoryIcon.tsx +0 -2
- package/src/components/widgets/DriverMap/index.ts +0 -2
- package/src/declarations.d.ts +2 -0
- package/src/docs/config/webpack.config.js +26 -3
- package/src/docs/index.tsx +1 -1
- package/src/docs/pages/ChartAreaInteractivePage.tsx +2 -3
- package/src/docs/pages/DriverMapPage.tsx +214 -60
- package/src/docs/pages/LightweightChartPage.styl +18 -0
- package/src/docs/pages/LightweightChartPage.styl.d.ts +10 -0
- package/src/docs/pages/LightweightChartPage.tsx +195 -0
- package/src/docs/pages/PageColumnsPage.tsx +92 -0
- package/src/docs/pages/TimeRangeControlsPage.tsx +2 -3
- package/src/docs/pages/WorldMapPage.styl +14 -0
- package/src/docs/pages/WorldMapPage.styl.d.ts +8 -0
- package/src/docs/pages/WorldMapPage.tsx +26 -0
- package/src/docs/registry.ts +19 -1
- package/src/index.ts +2 -0
- package/dist/esm/components/widgets/DriverMap/LoadingSpinner/LoadingSpinner.js +0 -8
- package/dist/esm/components/widgets/DriverMap/LoadingSpinner/LoadingSpinner.styl.js +0 -7
- package/dist/esm/components/widgets/DriverMap/MapBackground/MapBackground.js +0 -10
- package/dist/esm/components/widgets/DriverMap/MapBackground/MapBackground.styl.js +0 -7
- package/dist/esm/types/src/components/widgets/DriverMap/LoadingSpinner/LoadingSpinner.d.ts +0 -1
- package/dist/esm/types/src/components/widgets/DriverMap/MapBackground/MapBackground.d.ts +0 -1
- package/src/components/widgets/DriverMap/LoadingSpinner/LoadingSpinner.styl +0 -24
- package/src/components/widgets/DriverMap/LoadingSpinner/LoadingSpinner.tsx +0 -11
- package/src/components/widgets/DriverMap/MapBackground/MapBackground.tsx +0 -18
- /package/dist/esm/components/{widgets/DriverMap/MapBackground → ui/WorldMap}/map.svg.js +0 -0
- /package/src/components/{widgets/DriverMap/MapBackground → ui/WorldMap}/map.svg +0 -0
- /package/src/components/{widgets/DriverMap/MapBackground → ui/WorldMap}/mapAspect.mixin.styl +0 -0
- /package/src/components/{widgets/DriverMap/MapBackground → ui/WorldMap}/mapAspect.mixin.styl.d.ts +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DriverData } from '../DriverMap/driverMapGeography';
|
|
2
|
+
export interface DriverPerformanceChartProps {
|
|
3
|
+
driver: DriverData;
|
|
4
|
+
}
|
|
5
|
+
export declare function DriverPerformanceChart({ driver, }: DriverPerformanceChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DriverData } from '../DriverMap/driverMapGeography';
|
|
2
|
+
export type DriverPerformanceChartPoint = {
|
|
3
|
+
date: Date;
|
|
4
|
+
value: number;
|
|
5
|
+
};
|
|
6
|
+
/** Last non-null points from `normalized_series`, or deterministic fallback sample. */
|
|
7
|
+
export declare function generateDriverChartData(driver: DriverData, precision?: number): DriverPerformanceChartPoint[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DriverCard, type DriverCardProps } from './DriverCard';
|
|
@@ -3,6 +3,4 @@ export type { DriverData } from './driverMapGeography';
|
|
|
3
3
|
export { getCategoryIcon } from './driverCategoryIcon';
|
|
4
4
|
export { getDriverImportance, getHighestImportanceDriver, } from './driverMapSelection';
|
|
5
5
|
export { geographicCoordinates, geographicToSVG, getContinentFromRegion, getPreciseCoordinates, getResponsiveCoordinates, svgToPercentage, } from './driverMapGeography';
|
|
6
|
-
export { MapBackground } from './MapBackground/MapBackground';
|
|
7
|
-
export { LoadingSpinner } from './LoadingSpinner/LoadingSpinner';
|
|
8
6
|
export type { BadgeSize } from './DriverIcon/DriverIcon';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function LightweightChartPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function PageColumnsPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function WorldMapPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -58,8 +58,10 @@ export * from './components/ui/Toggle';
|
|
|
58
58
|
export * from './components/ui/ToggleGroup';
|
|
59
59
|
export * from './components/ui/Tooltip';
|
|
60
60
|
export * from './components/ui/VimeoEmbed';
|
|
61
|
+
export * from './components/ui/WorldMap';
|
|
61
62
|
export * from './components/ui/WorkspaceAppSwitcher';
|
|
62
63
|
export * from './components/widgets/SidebarDatasetsItemsGrouped';
|
|
64
|
+
export * from './components/widgets/DriverCard';
|
|
63
65
|
export * from './components/widgets/DriverMap';
|
|
64
66
|
export * from './components/widgets/SybilionAppHeader';
|
|
65
67
|
export * from './components/widgets/SybilionAuthLayout';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sybilion/uilib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Sybilion Design System — React UI components (Webpack + Stylus)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
101
101
|
"@vimeo/player": "^2.29.3",
|
|
102
102
|
"classnames": "^2.3.2",
|
|
103
|
+
"lightweight-charts": "^5.0.9",
|
|
103
104
|
"lucide-react": "^0.546.0",
|
|
104
105
|
"motion": "^12.23.12",
|
|
105
106
|
"recharts": "^3.2.1",
|
|
@@ -130,7 +131,7 @@
|
|
|
130
131
|
},
|
|
131
132
|
"devDependencies": {
|
|
132
133
|
"@auth0/auth0-react": "^2.3.1",
|
|
133
|
-
"@sybilion/platform-sdk": "file:../sdk",
|
|
134
|
+
"@sybilion/platform-sdk": "file:../platform-sdk",
|
|
134
135
|
"@babel/core": "^7.20.12",
|
|
135
136
|
"@babel/preset-typescript": "^7.21.0",
|
|
136
137
|
"@homecode/ui": "^4.30.6",
|
|
@@ -21,3 +21,12 @@ export {
|
|
|
21
21
|
ChartStyle,
|
|
22
22
|
BaseChartWrapper,
|
|
23
23
|
};
|
|
24
|
+
export {
|
|
25
|
+
LightweightForecastChart,
|
|
26
|
+
type LightweightForecastChartProps,
|
|
27
|
+
} from './lightweight/LightweightForecastChart';
|
|
28
|
+
export {
|
|
29
|
+
ChartEmptyState,
|
|
30
|
+
type ChartEmptyStateProps,
|
|
31
|
+
type ChartEmptyStatusTone,
|
|
32
|
+
} from './components/ChartEmptyState/ChartEmptyState';
|
|
@@ -9,15 +9,7 @@ import {
|
|
|
9
9
|
useState,
|
|
10
10
|
} from 'react';
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
ChartConfig,
|
|
14
|
-
ChartContainer,
|
|
15
|
-
ChartTooltip,
|
|
16
|
-
ChartTooltipContent,
|
|
17
|
-
CustomChartLegend,
|
|
18
|
-
} from '#uilib/components/ui/Chart/Chart';
|
|
19
12
|
import type { QuantileBandConfig } from '#uilib/components/ui/Chart/chartForecastVisualization.types';
|
|
20
|
-
import { QuantileBands } from '#uilib/components/ui/Chart/components/QuantileBands';
|
|
21
13
|
import { ChartDataPoint } from '#uilib/components/ui/ChartAreaInteractive/ChartAreaInteractive.types';
|
|
22
14
|
import {
|
|
23
15
|
ChartLines,
|
|
@@ -26,47 +18,22 @@ import {
|
|
|
26
18
|
} from '#uilib/components/ui/ChartAreaInteractive/ChartLines';
|
|
27
19
|
import { Skeleton } from '#uilib/components/ui/Skeleton';
|
|
28
20
|
import { chartRenderQueue } from '#uilib/utils/chartRenderQueue';
|
|
29
|
-
import { ComposedChart, LineChart } from 'recharts';
|
|
21
|
+
import { ComposedChart, LineChart, Tooltip as ChartTooltip } from 'recharts';
|
|
22
|
+
|
|
23
|
+
import type { ChartConfig } from '../Chart.types';
|
|
24
|
+
import { ChartContainer } from './ChartContainer';
|
|
25
|
+
import { ChartTooltipContent } from './ChartTooltipContent';
|
|
26
|
+
import { CustomChartLegend } from './CustomChartLegend/CustomChartLegend';
|
|
27
|
+
import { QuantileBands } from './QuantileBands';
|
|
30
28
|
import { LegendPayload } from 'recharts/types/component/DefaultLegendContent';
|
|
31
29
|
|
|
30
|
+
import { getPlotViewBox, resolveChartMargin } from '../tools/chartPlotGeometry';
|
|
32
31
|
import { formatDate } from '../tools/formatters';
|
|
33
32
|
import S from './BaseChartWrapper.styl';
|
|
34
33
|
import { ChartAxes } from './ChartAxes';
|
|
35
34
|
import { ChartGrid } from './ChartGrid';
|
|
36
35
|
import { LegendSvg } from './LegendSvg/LegendSvg';
|
|
37
36
|
|
|
38
|
-
type ChartMargin = { top: number; right: number; bottom: number; left: number };
|
|
39
|
-
|
|
40
|
-
const DEFAULT_CHART_MARGIN: ChartMargin = {
|
|
41
|
-
top: 5,
|
|
42
|
-
right: 5,
|
|
43
|
-
bottom: 5,
|
|
44
|
-
left: 5,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
function resolveChartMargin(
|
|
48
|
-
margin: Partial<ChartMargin> | undefined,
|
|
49
|
-
): ChartMargin {
|
|
50
|
-
return {
|
|
51
|
-
top: margin?.top ?? DEFAULT_CHART_MARGIN.top,
|
|
52
|
-
right: margin?.right ?? DEFAULT_CHART_MARGIN.right,
|
|
53
|
-
bottom: margin?.bottom ?? DEFAULT_CHART_MARGIN.bottom,
|
|
54
|
-
left: margin?.left ?? DEFAULT_CHART_MARGIN.left,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Plot box inside `.recharts-wrapper`, same convention as Recharts cartesian viewBox. */
|
|
59
|
-
function getPlotViewBox(wrapper: HTMLElement, m: ChartMargin) {
|
|
60
|
-
const w = wrapper.clientWidth;
|
|
61
|
-
const h = wrapper.clientHeight;
|
|
62
|
-
return {
|
|
63
|
-
x: m.left,
|
|
64
|
-
y: m.top,
|
|
65
|
-
width: Math.max(0, w - m.left - m.right),
|
|
66
|
-
height: Math.max(0, h - m.top - m.bottom),
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
37
|
function clampTooltipTranslate(args: {
|
|
71
38
|
coordinate: { x: number; y: number };
|
|
72
39
|
viewBox: { x: number; y: number; width: number; height: number };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
@import '../../../../../lib/theme.styl'
|
|
2
|
+
|
|
3
|
+
.root
|
|
4
|
+
display flex
|
|
5
|
+
flex-direction column
|
|
6
|
+
gap var(--p-1)
|
|
7
|
+
max-width 42rem
|
|
8
|
+
padding 0 var(--p-3)
|
|
9
|
+
|
|
10
|
+
border-radius var(--p-4)
|
|
11
|
+
backdrop-filter blur(4px)
|
|
12
|
+
box-shadow 0 0 0 2px var(--page-color)
|
|
13
|
+
pointer-events auto
|
|
14
|
+
|
|
15
|
+
.rootPanel
|
|
16
|
+
width 100%
|
|
17
|
+
min-height var(--chart-height)
|
|
18
|
+
justify-content center
|
|
19
|
+
padding var(--p-6)
|
|
20
|
+
border-radius var(--radius-md)
|
|
21
|
+
background var(--muted) / 0.35
|
|
22
|
+
|
|
23
|
+
.rootInline
|
|
24
|
+
width fit-content
|
|
25
|
+
max-width 100%
|
|
26
|
+
|
|
27
|
+
.rootAlignCenter
|
|
28
|
+
align-items center
|
|
29
|
+
text-align center
|
|
30
|
+
|
|
31
|
+
.rootAlignStart
|
|
32
|
+
align-items flex-start
|
|
33
|
+
text-align left
|
|
34
|
+
|
|
35
|
+
.hint
|
|
36
|
+
font-size 14px
|
|
37
|
+
line-height 1.5
|
|
38
|
+
font-weight 400
|
|
39
|
+
color var(--muted-foreground)
|
|
40
|
+
margin 0
|
|
41
|
+
|
|
42
|
+
a
|
|
43
|
+
color var(--sb-cyan-400)
|
|
44
|
+
text-decoration underline
|
|
45
|
+
font-weight 500
|
|
46
|
+
|
|
47
|
+
&:hover
|
|
48
|
+
opacity 0.9
|
|
49
|
+
|
|
50
|
+
.status
|
|
51
|
+
font-size 14px
|
|
52
|
+
line-height 1.5
|
|
53
|
+
font-weight 400
|
|
54
|
+
margin 0
|
|
55
|
+
|
|
56
|
+
.statusMuted
|
|
57
|
+
color var(--muted-foreground)
|
|
58
|
+
|
|
59
|
+
.statusDestructive
|
|
60
|
+
color var(--destructive)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// This file is automatically generated.
|
|
2
|
+
// Please do not change this file!
|
|
3
|
+
interface CssExports {
|
|
4
|
+
'hint': string;
|
|
5
|
+
'root': string;
|
|
6
|
+
'rootAlignCenter': string;
|
|
7
|
+
'rootAlignStart': string;
|
|
8
|
+
'rootInline': string;
|
|
9
|
+
'rootPanel': string;
|
|
10
|
+
'status': string;
|
|
11
|
+
'statusDestructive': string;
|
|
12
|
+
'statusMuted': string;
|
|
13
|
+
}
|
|
14
|
+
export const cssExports: CssExports;
|
|
15
|
+
export default cssExports;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import S from './ChartEmptyState.styl';
|
|
5
|
+
|
|
6
|
+
export type ChartEmptyStatusTone = 'muted' | 'destructive';
|
|
7
|
+
|
|
8
|
+
export interface ChartEmptyStateProps {
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Primary guidance (muted). */
|
|
11
|
+
hint?: ReactNode;
|
|
12
|
+
/** Status / technical detail. */
|
|
13
|
+
status?: ReactNode;
|
|
14
|
+
statusTone?: ChartEmptyStatusTone;
|
|
15
|
+
/** `panel`: chart-sized block with light fill. `inline`: text only (e.g. above chart). */
|
|
16
|
+
variant?: 'panel' | 'inline';
|
|
17
|
+
align?: 'center' | 'start';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function isNonEmpty(node: ReactNode): boolean {
|
|
21
|
+
if (node == null || node === false) return false;
|
|
22
|
+
if (typeof node === 'string') return node.trim().length > 0;
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function ChartEmptyState({
|
|
27
|
+
className,
|
|
28
|
+
hint,
|
|
29
|
+
status,
|
|
30
|
+
statusTone = 'muted',
|
|
31
|
+
variant = 'panel',
|
|
32
|
+
align = 'center',
|
|
33
|
+
}: ChartEmptyStateProps) {
|
|
34
|
+
const hasHint = isNonEmpty(hint);
|
|
35
|
+
const hasStatus = isNonEmpty(status);
|
|
36
|
+
|
|
37
|
+
if (!hasHint && !hasStatus) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
className={cn(
|
|
44
|
+
S.root,
|
|
45
|
+
variant === 'panel' && S.rootPanel,
|
|
46
|
+
variant === 'inline' && S.rootInline,
|
|
47
|
+
align === 'start' && S.rootAlignStart,
|
|
48
|
+
align === 'center' && S.rootAlignCenter,
|
|
49
|
+
className,
|
|
50
|
+
)}
|
|
51
|
+
>
|
|
52
|
+
{hasHint && <div className={S.hint}>{hint}</div>}
|
|
53
|
+
{hasStatus && (
|
|
54
|
+
<div
|
|
55
|
+
className={cn(
|
|
56
|
+
S.status,
|
|
57
|
+
statusTone === 'destructive' && S.statusDestructive,
|
|
58
|
+
statusTone === 'muted' && S.statusMuted,
|
|
59
|
+
)}
|
|
60
|
+
>
|
|
61
|
+
{status}
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.root
|
|
2
|
+
display flex
|
|
3
|
+
flex-direction column
|
|
4
|
+
gap 12px
|
|
5
|
+
width 100%
|
|
6
|
+
|
|
7
|
+
.shell
|
|
8
|
+
position relative
|
|
9
|
+
width 100%
|
|
10
|
+
|
|
11
|
+
.host
|
|
12
|
+
display block
|
|
13
|
+
width 100%
|
|
14
|
+
box-sizing border-box
|
|
15
|
+
|
|
16
|
+
:global(#tv-attr-logo)
|
|
17
|
+
display none
|
|
18
|
+
|
|
19
|
+
.tooltipMove
|
|
20
|
+
position absolute
|
|
21
|
+
z-index 5
|
|
22
|
+
pointer-events none
|
|
23
|
+
|
|
24
|
+
.footer
|
|
25
|
+
width 100%
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is automatically generated.
|
|
2
|
+
// Please do not change this file!
|
|
3
|
+
interface CssExports {
|
|
4
|
+
'footer': string;
|
|
5
|
+
'host': string;
|
|
6
|
+
'root': string;
|
|
7
|
+
'shell': string;
|
|
8
|
+
'tooltipMove': string;
|
|
9
|
+
}
|
|
10
|
+
export const cssExports: CssExports;
|
|
11
|
+
export default cssExports;
|