@sybilion/uilib 1.2.24 → 1.3.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.
Files changed (136) hide show
  1. package/dist/esm/components/ui/Chart/Chart.js +1 -0
  2. package/dist/esm/components/ui/Chart/components/BaseChartWrapper.js +7 -32
  3. package/dist/esm/components/ui/Chart/components/ChartEmptyState/ChartEmptyState.js +21 -0
  4. package/dist/esm/components/ui/Chart/components/ChartEmptyState/ChartEmptyState.styl.js +7 -0
  5. package/dist/esm/components/ui/Chart/tools/chartPlotGeometry.js +65 -0
  6. package/dist/esm/components/ui/ChartAreaInteractive/ChartAreaInteractive.helpers.js +37 -1
  7. package/dist/esm/components/ui/ChartAreaInteractive/ChartAreaInteractive.js +5 -2
  8. package/dist/esm/components/ui/ChartAreaInteractive/TimeRangeBrushLayer.js +205 -0
  9. package/dist/esm/components/ui/ChartAreaInteractive/TimeRangeBrushLayer.styl.js +7 -0
  10. package/dist/esm/components/ui/ChartAreaInteractive/TimeRangeBrushLayout.helpers.js +37 -0
  11. package/dist/esm/components/ui/ChartAreaInteractive/overlays/IntervalsOverlay/IntervalsOverlay.hooks.js +1 -0
  12. package/dist/esm/components/ui/ChartAreaInteractive/overlays/PinOverlay/PinOverlay.js +7 -60
  13. package/dist/esm/components/ui/ChartAreaInteractive/overlays/PinOverlay/PinOverlay.styl.js +2 -2
  14. package/dist/esm/components/ui/ChartAreaInteractive/overlays/ThresholdsOverlay/ThresholdsOverlay.hooks.js +1 -0
  15. package/dist/esm/components/ui/ChartAreaInteractive/overlays/useChartYRange.js +2 -4
  16. package/dist/esm/components/ui/Chat/ChatSheet/ChatSelector.js +1 -1
  17. package/dist/esm/components/ui/Chat/ChatSheet/ChatSelector.styl.js +1 -1
  18. package/dist/esm/components/ui/DropdownMenu/DropdownMenu.js +4 -4
  19. package/dist/esm/components/ui/TimeRangeControls/TimeRangeControls.js +7 -2
  20. package/dist/esm/components/ui/WorldMap/WorldMap.js +11 -0
  21. package/dist/esm/components/ui/WorldMap/WorldMap.styl.js +7 -0
  22. package/dist/esm/components/ui/WorldMap/map.svg.js +3 -0
  23. package/dist/esm/components/widgets/DriverCard/DriverCard.js +89 -0
  24. package/dist/esm/components/widgets/DriverCard/DriverCard.styl.js +7 -0
  25. package/dist/esm/components/widgets/DriverCard/DriverPerformanceChart.js +79 -0
  26. package/dist/esm/components/widgets/DriverCard/DriverPerformanceChart.styl.js +7 -0
  27. package/dist/esm/components/widgets/DriverCard/driverPerformanceChartData.js +50 -0
  28. package/dist/esm/components/widgets/DriverMap/DriverIcon/DriverIcon.constants.json.js +6 -0
  29. package/dist/esm/components/widgets/DriverMap/DriverIcon/DriverIcon.js +21 -0
  30. package/dist/esm/components/widgets/DriverMap/DriverIcon/DriverIcon.styl.js +7 -0
  31. package/dist/esm/components/widgets/DriverMap/DriverMap.helpers.js +107 -0
  32. package/dist/esm/components/widgets/DriverMap/DriverMap.js +129 -0
  33. package/dist/esm/components/widgets/DriverMap/DriverMap.styl.js +7 -0
  34. package/dist/esm/components/widgets/DriverMap/driverCategoryIcon.js +194 -0
  35. package/dist/esm/components/widgets/DriverMap/driverMapGeography.js +345 -0
  36. package/dist/esm/components/widgets/DriverMap/driverMapSelection.js +17 -0
  37. package/dist/esm/hooks/index.js +1 -0
  38. package/dist/esm/hooks/useEvent.js +0 -2
  39. package/dist/esm/index.js +7 -0
  40. package/dist/esm/types/src/components/ui/Chart/Chart.d.ts +1 -0
  41. package/dist/esm/types/src/components/ui/Chart/components/BaseChartWrapper.d.ts +2 -1
  42. package/dist/esm/types/src/components/ui/Chart/components/ChartEmptyState/ChartEmptyState.d.ts +14 -0
  43. package/dist/esm/types/src/components/ui/Chart/tools/chartPlotGeometry.d.ts +30 -0
  44. package/dist/esm/types/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.d.ts +1 -1
  45. package/dist/esm/types/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.helpers.d.ts +11 -2
  46. package/dist/esm/types/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.types.d.ts +2 -2
  47. package/dist/esm/types/src/components/ui/ChartAreaInteractive/TimeRangeBrushLayer.d.ts +15 -0
  48. package/dist/esm/types/src/components/ui/ChartAreaInteractive/TimeRangeBrushLayout.helpers.d.ts +14 -0
  49. package/dist/esm/types/src/components/ui/ChartAreaInteractive/overlays/PinOverlay/PinOverlay.d.ts +1 -1
  50. package/dist/esm/types/src/components/ui/DropdownMenu/DropdownMenu.d.ts +2 -2
  51. package/dist/esm/types/src/components/ui/Page/PageColumns/PageColumns.d.ts +1 -1
  52. package/dist/esm/types/src/components/ui/TimeRangeControls/TimeRangeControls.d.ts +5 -7
  53. package/dist/esm/types/src/components/ui/WorldMap/WorldMap.d.ts +4 -0
  54. package/dist/esm/types/src/components/ui/WorldMap/index.d.ts +2 -0
  55. package/dist/esm/types/src/components/widgets/DriverCard/DriverCard.d.ts +9 -0
  56. package/dist/esm/types/src/components/widgets/DriverCard/DriverPerformanceChart.d.ts +5 -0
  57. package/dist/esm/types/src/components/widgets/DriverCard/driverPerformanceChartData.d.ts +7 -0
  58. package/dist/esm/types/src/components/widgets/DriverCard/index.d.ts +1 -0
  59. package/dist/esm/types/src/components/widgets/DriverMap/DriverIcon/DriverIcon.d.ts +17 -0
  60. package/dist/esm/types/src/components/widgets/DriverMap/DriverMap.d.ts +8 -0
  61. package/dist/esm/types/src/components/widgets/DriverMap/DriverMap.helpers.d.ts +21 -0
  62. package/dist/esm/types/src/components/widgets/DriverMap/driverCategoryIcon.d.ts +1 -0
  63. package/dist/esm/types/src/components/widgets/DriverMap/driverMapGeography.d.ts +80 -0
  64. package/dist/esm/types/src/components/widgets/DriverMap/driverMapSelection.d.ts +3 -0
  65. package/dist/esm/types/src/components/widgets/DriverMap/index.d.ts +6 -0
  66. package/dist/esm/types/src/docs/pages/DriverMapPage.d.ts +1 -0
  67. package/dist/esm/types/src/docs/pages/PageColumnsPage.d.ts +1 -0
  68. package/dist/esm/types/src/docs/pages/WorldMapPage.d.ts +1 -0
  69. package/dist/esm/types/src/docs/registry.d.ts +1 -1
  70. package/dist/esm/types/src/hooks/index.d.ts +1 -0
  71. package/dist/esm/types/src/index.d.ts +3 -0
  72. package/package.json +1 -1
  73. package/src/components/ui/Chart/Chart.tsx +5 -0
  74. package/src/components/ui/Chart/components/BaseChartWrapper.tsx +8 -41
  75. package/src/components/ui/Chart/components/ChartEmptyState/ChartEmptyState.styl +60 -0
  76. package/src/components/ui/Chart/components/ChartEmptyState/ChartEmptyState.styl.d.ts +15 -0
  77. package/src/components/ui/Chart/components/ChartEmptyState/ChartEmptyState.tsx +66 -0
  78. package/src/components/ui/Chart/tools/chartPlotGeometry.ts +89 -0
  79. package/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.helpers.ts +44 -2
  80. package/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.tsx +14 -1
  81. package/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.types.ts +2 -3
  82. package/src/components/ui/ChartAreaInteractive/TimeRangeBrushLayer.styl +21 -0
  83. package/src/components/ui/ChartAreaInteractive/TimeRangeBrushLayer.styl.d.ts +9 -0
  84. package/src/components/ui/ChartAreaInteractive/TimeRangeBrushLayer.tsx +285 -0
  85. package/src/components/ui/ChartAreaInteractive/TimeRangeBrushLayout.helpers.ts +55 -0
  86. package/src/components/ui/ChartAreaInteractive/overlays/IntervalsOverlay/IntervalsOverlay.hooks.ts +1 -0
  87. package/src/components/ui/ChartAreaInteractive/overlays/PinOverlay/PinOverlay.styl +2 -7
  88. package/src/components/ui/ChartAreaInteractive/overlays/PinOverlay/PinOverlay.styl.d.ts +0 -1
  89. package/src/components/ui/ChartAreaInteractive/overlays/PinOverlay/PinOverlay.tsx +7 -71
  90. package/src/components/ui/ChartAreaInteractive/overlays/ThresholdsOverlay/ThresholdsOverlay.hooks.ts +1 -0
  91. package/src/components/ui/ChartAreaInteractive/overlays/useChartYRange.ts +2 -3
  92. package/src/components/ui/Chat/ChatSheet/ChatSelector.styl +3 -1
  93. package/src/components/ui/Chat/ChatSheet/ChatSelector.tsx +1 -1
  94. package/src/components/ui/DropdownMenu/DropdownMenu.tsx +4 -0
  95. package/src/components/ui/Page/PageColumns/PageColumns.tsx +1 -1
  96. package/src/components/ui/TimeRangeControls/TimeRangeControls.tsx +16 -17
  97. package/src/components/ui/WorldMap/WorldMap.styl +11 -0
  98. package/src/components/ui/WorldMap/WorldMap.styl.d.ts +7 -0
  99. package/src/components/ui/WorldMap/WorldMap.tsx +22 -0
  100. package/src/components/ui/WorldMap/index.ts +2 -0
  101. package/src/components/ui/WorldMap/map.svg +4337 -0
  102. package/src/components/ui/WorldMap/mapAspect.mixin.styl +3 -0
  103. package/src/components/ui/WorldMap/mapAspect.mixin.styl.d.ts +2 -0
  104. package/src/components/widgets/DriverCard/DriverCard.styl +169 -0
  105. package/src/components/widgets/DriverCard/DriverCard.styl.d.ts +40 -0
  106. package/src/components/widgets/DriverCard/DriverCard.tsx +219 -0
  107. package/src/components/widgets/DriverCard/DriverPerformanceChart.styl +43 -0
  108. package/src/components/widgets/DriverCard/DriverPerformanceChart.styl.d.ts +13 -0
  109. package/src/components/widgets/DriverCard/DriverPerformanceChart.tsx +150 -0
  110. package/src/components/widgets/DriverCard/driverPerformanceChartData.ts +64 -0
  111. package/src/components/widgets/DriverCard/index.ts +1 -0
  112. package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.constants.json +3 -0
  113. package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.styl +125 -0
  114. package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.styl.d.ts +22 -0
  115. package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.tsx +79 -0
  116. package/src/components/widgets/DriverMap/DriverMap.helpers.ts +164 -0
  117. package/src/components/widgets/DriverMap/DriverMap.styl +50 -0
  118. package/src/components/widgets/DriverMap/DriverMap.styl.d.ts +12 -0
  119. package/src/components/widgets/DriverMap/DriverMap.tsx +212 -0
  120. package/src/components/widgets/DriverMap/driverCategoryIcon.tsx +277 -0
  121. package/src/components/widgets/DriverMap/driverMapGeography.ts +478 -0
  122. package/src/components/widgets/DriverMap/driverMapSelection.ts +23 -0
  123. package/src/components/widgets/DriverMap/index.ts +16 -0
  124. package/src/docs/config/webpack.config.js +25 -9
  125. package/src/docs/pages/ChartAreaInteractivePage.tsx +2 -3
  126. package/src/docs/pages/DriverMapPage.tsx +268 -0
  127. package/src/docs/pages/PageColumnsPage.tsx +92 -0
  128. package/src/docs/pages/TimeRangeControlsPage.tsx +2 -3
  129. package/src/docs/pages/TooltipPage.tsx +14 -10
  130. package/src/docs/pages/WorldMapPage.styl +14 -0
  131. package/src/docs/pages/WorldMapPage.styl.d.ts +8 -0
  132. package/src/docs/pages/WorldMapPage.tsx +26 -0
  133. package/src/docs/registry.ts +18 -5
  134. package/src/hooks/index.ts +1 -0
  135. package/src/hooks/useEvent.ts +0 -2
  136. package/src/index.ts +3 -0
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Shared Recharts plot / margin math (DOM-agnostic except measurement entry points).
3
+ * Keeps BaseChartWrapper tooltip clamp and ChartAreaInteractive brush in sync.
4
+ */
5
+ export type ChartMargin = {
6
+ top: number;
7
+ right: number;
8
+ bottom: number;
9
+ left: number;
10
+ };
11
+ export declare const DEFAULT_CHART_MARGIN: ChartMargin;
12
+ export declare function resolveChartMargin(margin: Partial<ChartMargin> | undefined): ChartMargin;
13
+ /** Plot box inside `.recharts-wrapper` (Recharts cartesian convention). */
14
+ export declare function getPlotViewBox(wrapper: HTMLElement, m: ChartMargin): {
15
+ x: number;
16
+ y: number;
17
+ width: number;
18
+ height: number;
19
+ };
20
+ export type PlotRect = {
21
+ left: number;
22
+ top: number;
23
+ width: number;
24
+ height: number;
25
+ };
26
+ /**
27
+ * Plot area in `host` local px: prefer painted `.recharts-cartesian-grid`, else
28
+ * last `.recharts-wrapper` + margins. One `hostRect` read; grid/wrapper rects as needed.
29
+ */
30
+ export declare function measureHostRelativePlotRect(host: HTMLElement, margin: ChartMargin): PlotRect | null;
@@ -1,3 +1,3 @@
1
1
  import { ChartAreaInteractiveProps } from './ChartAreaInteractive.types';
2
2
  export declare const chartConfig: {};
3
- export declare function ChartAreaInteractive({ className, chartContainerClassName, legendClassName, xAxisClassName, yAxisClassName, timeRange, onTimeRangeChange, pinMonth, onPinMonthChange, onPreviewMonthChange, chartData, forecastData, error, loading, isDarkTheme, footerActions, mode, selectedForecast, upperQuantiles, lowerQuantiles, selectedLowerQuantile, selectedUpperQuantile, onLowerQuantileChange, onUpperQuantileChange, lowerThreshold, upperThreshold, onLowerThresholdChange, onUpperThresholdChange, discreteThresholdValues, headerActions, excludeLegendIds, loadingAnalyses, onLegendClick, onAnalysisSelect, disableTimeRangeSelector, forecastLineStyle, selectedAnalysisId, chartRenderId, toggleLegendSeries, ensureAnalysisSeriesVisible, overlayForecastData, hiddenSeries, disableForecastHistoricalBridge, ...restProps }: ChartAreaInteractiveProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ChartAreaInteractive({ className, chartContainerClassName, legendClassName, xAxisClassName, yAxisClassName, timeRange, onTimeRangeChange, pinMonth, onPinMonthChange, onPreviewMonthChange, chartData, forecastData, error, loading, isDarkTheme, footerActions, mode, selectedForecast, upperQuantiles, lowerQuantiles, selectedLowerQuantile, selectedUpperQuantile, onLowerQuantileChange, onUpperQuantileChange, lowerThreshold, upperThreshold, onLowerThresholdChange, onUpperThresholdChange, discreteThresholdValues, headerActions, excludeLegendIds, loadingAnalyses, onLegendClick, onAnalysisSelect, disableTimeRangeSelector, forecastLineStyle, selectedAnalysisId, chartRenderId, toggleLegendSeries, ensureAnalysisSeriesVisible, overlayForecastData, hiddenSeries, disableForecastHistoricalBridge, overlayElements: overlayElementsProp, ...restProps }: ChartAreaInteractiveProps): import("react/jsx-runtime").JSX.Element;
@@ -8,13 +8,22 @@ declare const timeRangeToMonths: {
8
8
  readonly '5y': 60;
9
9
  readonly All: 12;
10
10
  };
11
- export type TimeRange = keyof typeof timeRangeToMonths;
11
+ export type TimeRangePreset = keyof typeof timeRangeToMonths;
12
+ /** @deprecated Use `TimeRangePreset` or `string` for brush-encoded ranges. */
13
+ export type TimeRange = TimeRangePreset;
14
+ export declare const DRAG_TIME_RANGE_PREFIX: "__drag:";
15
+ export declare function encodeDragTimeRange(a: Date, b: Date): string;
16
+ export declare function parseDragTimeRange(s: string): {
17
+ start: Date;
18
+ end: Date;
19
+ } | null;
20
+ export declare function isTimeRangePreset(s: string): s is TimeRangePreset;
12
21
  export type FilterDataForTimeRangeOptions = {
13
22
  /** When set (e.g. selected forecast on Forecast tab), the window ends at the
14
23
  * latest point that has shared historical or that analysis — not at another run. */
15
24
  endDateAnchorAnalysisId?: number | null;
16
25
  };
17
- export declare const filterDataForTimeRange: (data: ChartDataPoint[], currentTimeRange: TimeRange, options?: FilterDataForTimeRangeOptions) => ChartDataPoint[];
26
+ export declare const filterDataForTimeRange: (data: ChartDataPoint[], currentTimeRange: string, options?: FilterDataForTimeRangeOptions) => ChartDataPoint[];
18
27
  export declare const shortDateFormatter: (value: string) => string;
19
28
  export declare const longDateFormatter: (value: string) => string;
20
29
  /**
@@ -1,7 +1,6 @@
1
1
  import { BaseChartWrapperProps } from '#uilib/components/ui/Chart/components/BaseChartWrapper';
2
2
  import type { ForecastData } from '#uilib/types/forecast-data';
3
3
  import { LegendPayload } from 'recharts';
4
- import { TimeRange } from './ChartAreaInteractive.helpers';
5
4
  export type OverlayMode = 'pin' | 'intervals' | 'thresholds';
6
5
  export interface ChartDataPoint {
7
6
  date: string;
@@ -22,7 +21,8 @@ export interface Analysis {
22
21
  }
23
22
  export interface ChartAreaInteractiveProps extends BaseChartWrapperProps {
24
23
  chartContainerClassName?: string;
25
- timeRange: TimeRange;
24
+ /** Preset (`6m`, `1y`, …, `All`) or `__drag:startMs,endMs` from chart brush. */
25
+ timeRange: string;
26
26
  onTimeRangeChange: (range: string) => void;
27
27
  pinMonth: string | undefined;
28
28
  onPinMonthChange: (month: string | undefined) => void;
@@ -0,0 +1,15 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { ChartDataPoint } from '#uilib/components/ui/ChartAreaInteractive/ChartAreaInteractive.types';
3
+ export interface TimeRangeBrushHostProps {
4
+ chartData: ChartDataPoint[];
5
+ onTimeRangeChange: (range: string) => void;
6
+ enabled: boolean;
7
+ /** Bumps layout sync when chart remounts (e.g. dataset / render id). */
8
+ layoutKey?: string | number | null;
9
+ children: ReactNode;
10
+ }
11
+ /**
12
+ * Wraps chart; pointerdown on SVG starts horizontal brush. Plot box tracks the
13
+ * painted grid / Recharts plot (see TimeRangeBrushLayout.helpers).
14
+ */
15
+ export declare function TimeRangeBrushHost({ chartData, onTimeRangeChange, enabled, layoutKey, children, }: TimeRangeBrushHostProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { type ChartMargin, type PlotRect, measureHostRelativePlotRect, resolveChartMargin } from '#uilib/components/ui/Chart/tools/chartPlotGeometry';
2
+ import type { ChartDataPoint } from '#uilib/components/ui/ChartAreaInteractive/ChartAreaInteractive.types';
3
+ /** Debounce for `window` resize only (RO uses rAF-coalesced sync). */
4
+ export declare const BRUSH_LAYOUT_RESIZE_DEBOUNCE_MS = 500;
5
+ export declare const BRUSH_MIN_DRAG_PX = 8;
6
+ export declare const BRUSH_DOUBLE_TAP_MS = 300;
7
+ export declare const BRUSH_DOUBLE_TAP_MAX_DIST_PX = 24;
8
+ export type { ChartMargin };
9
+ export { resolveChartMargin };
10
+ export type BrushPlotLayout = PlotRect;
11
+ /** Host-relative plot rect (grid-first, then wrapper + margins). */
12
+ export declare const measureBrushPlotLayout: typeof measureHostRelativePlotRect;
13
+ export declare function brushPlotLayoutsEqual(a: BrushPlotLayout | null, b: BrushPlotLayout | null): boolean;
14
+ export declare function brushClientXToDate(clientX: number, plotRect: DOMRect, chartData: ChartDataPoint[]): Date | null;
@@ -6,5 +6,5 @@ interface PinOverlayProps {
6
6
  onPreviewMonthChange?: (month: string | undefined) => void;
7
7
  className?: string;
8
8
  }
9
- export declare function PinOverlay({ baseChartProps, pinMonth, onPinMonthChange, onPreviewMonthChange, className, }: PinOverlayProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function PinOverlay({ baseChartProps, pinMonth, onPinMonthChange, onPreviewMonthChange: _onPreviewMonthChange, className, }: PinOverlayProps): import("react/jsx-runtime").JSX.Element;
10
10
  export {};
@@ -2,7 +2,7 @@ import type { DropdownMenuCheckboxItemProps, DropdownMenuContentProps, DropdownM
2
2
  declare function DropdownMenu({ ...props }: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
3
3
  declare function DropdownMenuPortal({ ...props }: DropdownMenuPortalProps): import("react/jsx-runtime").JSX.Element;
4
4
  declare function DropdownMenuTrigger({ ...props }: DropdownMenuTriggerProps): import("react/jsx-runtime").JSX.Element;
5
- declare function DropdownMenuContent({ className, sideOffset, elevation, ...props }: DropdownMenuContentProps): import("react/jsx-runtime").JSX.Element;
5
+ declare function DropdownMenuContent({ className, sideOffset, collisionPadding, elevation, ...props }: DropdownMenuContentProps): import("react/jsx-runtime").JSX.Element;
6
6
  declare function DropdownMenuGroup({ ...props }: DropdownMenuGroupProps): import("react/jsx-runtime").JSX.Element;
7
7
  declare function DropdownMenuItem({ className, inset, variant, ...props }: DropdownMenuItemProps): import("react/jsx-runtime").JSX.Element;
8
8
  declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: DropdownMenuCheckboxItemProps): import("react/jsx-runtime").JSX.Element;
@@ -13,5 +13,5 @@ declare function DropdownMenuSeparator({ className, ...props }: DropdownMenuSepa
13
13
  declare function DropdownMenuShortcut({ className, ...props }: DropdownMenuShortcutProps): import("react/jsx-runtime").JSX.Element;
14
14
  declare function DropdownMenuSub({ ...props }: DropdownMenuSubProps): import("react/jsx-runtime").JSX.Element;
15
15
  declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: DropdownMenuSubTriggerProps): import("react/jsx-runtime").JSX.Element;
16
- declare function DropdownMenuSubContent({ className, ...props }: DropdownMenuSubContentProps): import("react/jsx-runtime").JSX.Element;
16
+ declare function DropdownMenuSubContent({ className, collisionPadding, ...props }: DropdownMenuSubContentProps): import("react/jsx-runtime").JSX.Element;
17
17
  export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
@@ -1,5 +1,5 @@
1
1
  export declare function PageColumns({ columns, fill, className, }: {
2
2
  columns: React.ReactNode[];
3
- fill: 'left' | 'right' | 'all';
3
+ fill?: 'left' | 'right' | 'all';
4
4
  className?: string;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,9 @@
1
- import { TimeRange } from './TimeRangeControls.types';
2
- export declare const TimeRangeControls: import("react").MemoExoticComponent<({ timeRange, onTimeRangeChange, loading, }: {
3
- timeRange: TimeRange;
1
+ export type TimeRangeControlsProps = {
2
+ timeRange: string;
4
3
  onTimeRangeChange: (range: string) => void;
5
4
  loading?: boolean;
6
- }) => import("react/jsx-runtime").JSX.Element>;
7
- export declare const TimeRangeSelect: import("react").MemoExoticComponent<({ timeRange, onTimeRangeChange, loading, }: {
8
- timeRange: TimeRange;
9
- onTimeRangeChange: (range: string) => void;
5
+ };
6
+ export declare const TimeRangeControls: import("react").MemoExoticComponent<({ timeRange, onTimeRangeChange, loading }: TimeRangeControlsProps) => import("react/jsx-runtime").JSX.Element>;
7
+ export declare const TimeRangeSelect: import("react").MemoExoticComponent<({ timeRange, onTimeRangeChange, loading, }: TimeRangeControlsProps & {
10
8
  loading: boolean;
11
9
  }) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,4 @@
1
+ export type WorldMapProps = {
2
+ className?: string;
3
+ };
4
+ export declare function WorldMap({ className }: WorldMapProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { WorldMap } from './WorldMap';
2
+ export type { WorldMapProps } from './WorldMap';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { DriverData } from '../DriverMap/driverMapGeography';
3
+ export interface DriverCardProps {
4
+ selectedDriver: DriverData | null;
5
+ isLoading: boolean;
6
+ inQueue?: boolean;
7
+ driverSelector?: React.ReactNode;
8
+ }
9
+ export declare function DriverCard({ selectedDriver, isLoading, inQueue, driverSelector, }: DriverCardProps): import("react/jsx-runtime").JSX.Element;
@@ -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';
@@ -0,0 +1,17 @@
1
+ import type { DriverData } from '../driverMapGeography';
2
+ export declare const BADGE_SIZES: {
3
+ readonly s: "s";
4
+ readonly m: "m";
5
+ readonly l: "l";
6
+ };
7
+ export type BadgeSize = (typeof BADGE_SIZES)[keyof typeof BADGE_SIZES];
8
+ interface DriverIconProps {
9
+ driver: DriverData;
10
+ size: BadgeSize;
11
+ isSelected: boolean;
12
+ onClick: () => void;
13
+ isVisible: boolean;
14
+ isLoading?: boolean;
15
+ }
16
+ export declare function DriverIcon({ driver, size, isSelected, onClick, isVisible, isLoading, }: DriverIconProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { DriverData } from './driverMapGeography';
2
+ export interface DriverMapProps {
3
+ drivers: DriverData[];
4
+ isLoading: boolean;
5
+ setSelectedDriver: (driver: DriverData) => void;
6
+ selectedDriver: DriverData | null;
7
+ }
8
+ export declare function DriverMap({ drivers, isLoading, setSelectedDriver, selectedDriver, }: DriverMapProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { type BadgeSize } from './DriverIcon/DriverIcon';
2
+ import { type DriverData } from './driverMapGeography';
3
+ export declare const calculateBadgeSizes: (drivers: DriverData[]) => Record<string, BadgeSize>;
4
+ export declare const hasValidCoords: (coords: {
5
+ x: number;
6
+ y: number;
7
+ } | null | undefined) => boolean;
8
+ export declare const findMostSpecificRegion: (driver: DriverData) => {
9
+ name: string | null;
10
+ coordinates: {
11
+ x: number;
12
+ y: number;
13
+ } | null;
14
+ };
15
+ export declare const getDriverCoordinates: (driver: DriverData, specificRegion: {
16
+ name: string | null;
17
+ coordinates: {
18
+ x: number;
19
+ y: number;
20
+ } | null;
21
+ }, existingDrivers?: DriverData[]) => DriverData["coordinates"];
@@ -0,0 +1 @@
1
+ export declare const getCategoryIcon: (category: string | undefined | null) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,80 @@
1
+ export interface DriverData {
2
+ id: string;
3
+ name: string;
4
+ region: string[];
5
+ category: string;
6
+ isPublic: boolean;
7
+ importance: number;
8
+ direction: number;
9
+ lag: string;
10
+ coordinates: {
11
+ x: number;
12
+ y: number;
13
+ continent: string;
14
+ };
15
+ normalized_series?: {
16
+ [date: string]: number | null;
17
+ };
18
+ rawImportance?: any;
19
+ summary?: string;
20
+ src_region?: {
21
+ name: string;
22
+ coordinates: {
23
+ x: number;
24
+ y: number;
25
+ };
26
+ } | null;
27
+ tgt_region?: {
28
+ name: string;
29
+ coordinates: {
30
+ x: number;
31
+ y: number;
32
+ };
33
+ } | null;
34
+ }
35
+ export interface RegionMapping {
36
+ [key: string]: {
37
+ x: number;
38
+ y: number;
39
+ continent: string;
40
+ };
41
+ }
42
+ export interface AnalysisInfo {
43
+ id: string;
44
+ name: string;
45
+ driverCount: number;
46
+ path: string;
47
+ }
48
+ export interface DatasetInfo {
49
+ id: string;
50
+ name: string;
51
+ analyses: AnalysisInfo[];
52
+ }
53
+ interface GeographicCoordinates {
54
+ latitude: number;
55
+ longitude: number;
56
+ continent: string;
57
+ }
58
+ export declare const geographicCoordinates: {
59
+ [key: string]: GeographicCoordinates;
60
+ };
61
+ export declare function geographicToSVG(lat: number, lng: number): {
62
+ x: number;
63
+ y: number;
64
+ };
65
+ export declare function svgToPercentage(svgX: number, svgY: number): {
66
+ x: number;
67
+ y: number;
68
+ };
69
+ export declare function getContinentFromRegion(region: string): string | null;
70
+ export declare function getPreciseCoordinates(region: string): {
71
+ x: number;
72
+ y: number;
73
+ continent: string;
74
+ };
75
+ export declare function getResponsiveCoordinates(region: string, existingDrivers?: DriverData[], mapContainerWidth?: number, mapContainerHeight?: number): {
76
+ x: number;
77
+ y: number;
78
+ continent: string;
79
+ };
80
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { DriverData } from './driverMapGeography';
2
+ export declare const getDriverImportance: (driver: DriverData) => any;
3
+ export declare const getHighestImportanceDriver: (drivers: DriverData[]) => number | null;
@@ -0,0 +1,6 @@
1
+ export { DriverMap, type DriverMapProps } from './DriverMap';
2
+ export type { DriverData } from './driverMapGeography';
3
+ export { getCategoryIcon } from './driverCategoryIcon';
4
+ export { getDriverImportance, getHighestImportanceDriver, } from './driverMapSelection';
5
+ export { geographicCoordinates, geographicToSVG, getContinentFromRegion, getPreciseCoordinates, getResponsiveCoordinates, svgToPercentage, } from './driverMapGeography';
6
+ export type { BadgeSize } from './DriverIcon/DriverIcon';
@@ -0,0 +1 @@
1
+ export default function DriverMapPage(): 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;
@@ -8,7 +8,7 @@ export type DocEntry = {
8
8
  }>;
9
9
  };
10
10
  /** Sidebar group order */
11
- export declare const DOC_SECTION_ORDER: readonly ["Forms", "Feedback", "Layout", "Navigation", "Overlays", "Data display", "Charts", "Chat", "Media", "Misc"];
11
+ export declare const DOC_SECTION_ORDER: readonly ["Forms", "Feedback", "Layout", "Navigation", "Widgets", "Overlays", "Data display", "Charts", "Chat", "Media", "Misc"];
12
12
  export declare const DOC_DEFAULT_SLUG = "button";
13
13
  export declare const DOC_REGISTRY: DocEntry[];
14
14
  export declare const docPageComponents: Record<string, LazyExoticComponent<ComponentType<object>>>;
@@ -1 +1,2 @@
1
1
  export { useIsMobile } from './useIsMobile';
2
+ export { default as useEvent, type UseEventParams } from './useEvent';
@@ -58,8 +58,11 @@ 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';
65
+ export * from './components/widgets/DriverMap';
63
66
  export * from './components/widgets/SybilionAppHeader';
64
67
  export * from './components/widgets/SybilionAuthLayout';
65
68
  export * from './components/widgets/SybilionSignInPanel';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sybilion/uilib",
3
- "version": "1.2.24",
3
+ "version": "1.3.0",
4
4
  "description": "Sybilion Design System — React UI components (Webpack + Stylus)",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -21,3 +21,8 @@ export {
21
21
  ChartStyle,
22
22
  BaseChartWrapper,
23
23
  };
24
+ export {
25
+ ChartEmptyState,
26
+ type ChartEmptyStateProps,
27
+ type ChartEmptyStatusTone,
28
+ } 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
+ }