@sybilion/uilib 1.3.41 → 1.3.43
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/RegionCoords/RegionSelector.js +2 -2
- package/dist/esm/types/src/components/ui/RegionCoords/RegionSelector.types.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/ui/ChartAreaInteractive/AGENT.md +19 -0
- package/src/components/ui/RegionCoords/RegionSelector.tsx +20 -18
- package/src/components/ui/RegionCoords/RegionSelector.types.ts +1 -1
- package/src/components/widgets/AGENT.md +21 -0
- package/src/components/widgets/DriverMap/AGENT.md +18 -0
- package/src/components/widgets/DriversComparisonChart/AGENT.md +18 -0
- package/src/components/widgets/PerformanceChart/AGENT.md +18 -0
- package/src/components/widgets/SidebarDatasetsItemsGrouped/AGENT.md +18 -0
|
@@ -6,7 +6,7 @@ import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuIte
|
|
|
6
6
|
import { CaretDownIcon } from '@phosphor-icons/react';
|
|
7
7
|
import S from './RegionSelector.styl.js';
|
|
8
8
|
|
|
9
|
-
function RegionSelector({ children, onSelect, className, regions: regionCoordinates, }) {
|
|
9
|
+
function RegionSelector({ children, onSelect, className, regions: regionCoordinates = {}, }) {
|
|
10
10
|
const [open, setOpen] = useState(false);
|
|
11
11
|
const handleRegionSelect = (regionName) => {
|
|
12
12
|
const coords = regionCoordinates[regionName];
|
|
@@ -16,7 +16,7 @@ function RegionSelector({ children, onSelect, className, regions: regionCoordina
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
const regions = Object.keys(regionCoordinates).sort();
|
|
19
|
-
return (jsxs("div", { className: cn(S.root, className), children: [children, jsxs(DropdownMenu, { open: open, onOpenChange: setOpen, children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button, { variant: "outline", size: "sm", className: S.button, children: jsx(CaretDownIcon, { size: 16 }) }) }), jsx(DropdownMenuContent, { align: "end", children: regions.map(region => (jsx(DropdownMenuItem, { onSelect: () => handleRegionSelect(region), children: region }, region))) })] })] }));
|
|
19
|
+
return (jsxs("div", { className: cn(S.root, className), children: [children, regions.length > 0 && (jsxs(DropdownMenu, { open: open, onOpenChange: setOpen, children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button, { variant: "outline", size: "sm", className: S.button, children: jsx(CaretDownIcon, { size: 16 }) }) }), jsx(DropdownMenuContent, { align: "end", children: regions.map(region => (jsx(DropdownMenuItem, { onSelect: () => handleRegionSelect(region), children: region }, region))) })] }))] }));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export { RegionSelector };
|
|
@@ -6,7 +6,7 @@ export interface RegionSelectorProps {
|
|
|
6
6
|
}) => void;
|
|
7
7
|
className?: string;
|
|
8
8
|
/** Region name → coordinates (app-defined; replaces app-only drivers catalog). */
|
|
9
|
-
regions
|
|
9
|
+
regions?: Record<string, {
|
|
10
10
|
longitude: number;
|
|
11
11
|
latitude: number;
|
|
12
12
|
}>;
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ChartAreaInteractive
|
|
2
|
+
|
|
3
|
+
Renders: time-series chart with historical line, forecast lines, optional pin / quantile-band / threshold overlays.
|
|
4
|
+
|
|
5
|
+
Use when: custom forecast UI with overlays or full chart control.
|
|
6
|
+
Not when: packaged performance or drivers-comparison views (use PerformanceChart or DriversComparisonChart).
|
|
7
|
+
|
|
8
|
+
Host provides:
|
|
9
|
+
|
|
10
|
+
- `chartData`, `forecastData` built from API
|
|
11
|
+
- `timeRange` / `onTimeRangeChange` or brush-only range
|
|
12
|
+
- Optional `mode`: pin | intervals | thresholds + overlay state
|
|
13
|
+
- Analysis selector and fetch outside widget
|
|
14
|
+
|
|
15
|
+
Report tile: `dataset_card` — host loads dataset + analysis; chart inside dashboard card.
|
|
16
|
+
|
|
17
|
+
Requires: `chartData`; `forecastData`; `loading`; `toggleLegendSeries` / `ensureAnalysisSeriesVisible` when legend is external.
|
|
18
|
+
|
|
19
|
+
Empty/loading: `loading`, `error`; empty data shows chart empty state via host message props.
|
|
@@ -17,7 +17,7 @@ export function RegionSelector({
|
|
|
17
17
|
children,
|
|
18
18
|
onSelect,
|
|
19
19
|
className,
|
|
20
|
-
regions: regionCoordinates,
|
|
20
|
+
regions: regionCoordinates = {},
|
|
21
21
|
}: RegionSelectorProps) {
|
|
22
22
|
const [open, setOpen] = useState(false);
|
|
23
23
|
|
|
@@ -34,23 +34,25 @@ export function RegionSelector({
|
|
|
34
34
|
return (
|
|
35
35
|
<div className={cn(S.root, className)}>
|
|
36
36
|
{children}
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
{regions.length > 0 && (
|
|
38
|
+
<DropdownMenu open={open} onOpenChange={setOpen}>
|
|
39
|
+
<DropdownMenuTrigger asChild>
|
|
40
|
+
<Button variant="outline" size="sm" className={S.button}>
|
|
41
|
+
<CaretDownIcon size={16} />
|
|
42
|
+
</Button>
|
|
43
|
+
</DropdownMenuTrigger>
|
|
44
|
+
<DropdownMenuContent align="end">
|
|
45
|
+
{regions.map(region => (
|
|
46
|
+
<DropdownMenuItem
|
|
47
|
+
key={region}
|
|
48
|
+
onSelect={() => handleRegionSelect(region)}
|
|
49
|
+
>
|
|
50
|
+
{region}
|
|
51
|
+
</DropdownMenuItem>
|
|
52
|
+
))}
|
|
53
|
+
</DropdownMenuContent>
|
|
54
|
+
</DropdownMenu>
|
|
55
|
+
)}
|
|
54
56
|
</div>
|
|
55
57
|
);
|
|
56
58
|
}
|
|
@@ -6,5 +6,5 @@ export interface RegionSelectorProps {
|
|
|
6
6
|
) => void;
|
|
7
7
|
className?: string;
|
|
8
8
|
/** Region name → coordinates (app-defined; replaces app-only drivers catalog). */
|
|
9
|
-
regions
|
|
9
|
+
regions?: Record<string, { longitude: number; latitude: number }>;
|
|
10
10
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!-- not a component — authoring guide only -->
|
|
2
|
+
|
|
3
|
+
# Widget `AGENT.md` authoring
|
|
4
|
+
|
|
5
|
+
Each component file ≤18 lines. Signal for LLM prompts — no noise.
|
|
6
|
+
|
|
7
|
+
**Include:** Renders (1 sentence); Use when / Not when; Host provides (3–5 bullets); Report tile (one line or "Not used"); Requires (prop names + role); Empty/loading (one line).
|
|
8
|
+
|
|
9
|
+
**Do not include:** import examples; type/doc/demo/glossary links; page-shell boilerplate; related-components lists unless choosing between exports; implementation/styling/keyboard notes unless binding-relevant; secrets, env vars, API URLs.
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
# Name
|
|
13
|
+
|
|
14
|
+
Renders: …
|
|
15
|
+
Use when: …
|
|
16
|
+
Not when: …
|
|
17
|
+
Host provides: …
|
|
18
|
+
Report tile: …
|
|
19
|
+
Requires: …
|
|
20
|
+
Empty/loading: …
|
|
21
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# DriverMap
|
|
2
|
+
|
|
3
|
+
Renders: world map with regional driver badges, bottom strip for world-level drivers, selection highlight.
|
|
4
|
+
|
|
5
|
+
Use when: geographic driver exploration for one analysis.
|
|
6
|
+
Not when: driver detail metrics card alone (pair with DriverCard) or normalized series chart (use DriversComparisonChart).
|
|
7
|
+
|
|
8
|
+
Host provides:
|
|
9
|
+
|
|
10
|
+
- `drivers` as `DriverData[]` from analysis API
|
|
11
|
+
- Controlled `selectedDriver` + `setSelectedDriver`
|
|
12
|
+
- `isLoading` while fetching drivers
|
|
13
|
+
|
|
14
|
+
Report tile: `drivers_map` — tile resolves analysis id, fetches drivers, passes list + selection (see EmbeddedAnalysisSelector pattern).
|
|
15
|
+
|
|
16
|
+
Requires: `drivers`; `isLoading`; `selectedDriver`; `setSelectedDriver`.
|
|
17
|
+
|
|
18
|
+
Empty/loading: `isLoading` shows overlay; empty `drivers` leaves map without badges.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# DriversComparisonChart
|
|
2
|
+
|
|
3
|
+
Renders: target vs drivers backtests chart with ChartAreaInteractive plus table; row click toggles series visibility.
|
|
4
|
+
|
|
5
|
+
Use when: drivers comparison tab with normalized target and driver series from backtests payload.
|
|
6
|
+
Not when: geographic map or performance horizons — use DriverMap or PerformanceChart.
|
|
7
|
+
|
|
8
|
+
Host provides:
|
|
9
|
+
|
|
10
|
+
- `payload`: BacktestsComponentPayload from platform SDK (host fetch per analysis)
|
|
11
|
+
- Optional `datasetHistorical` overlay
|
|
12
|
+
- `seriesInitKey` when selected analysis changes
|
|
13
|
+
|
|
14
|
+
Report tile: Not used in report tiles.
|
|
15
|
+
|
|
16
|
+
Requires: `payload` — target + driver normalized_series; `loading` / `chartLoading` — spinners; `seriesInitKey` — reset visible series on analysis change; `runAnalysisHint` / `statusHint` — empty/error text.
|
|
17
|
+
|
|
18
|
+
Empty/loading: loading props shimmer chart; null `payload` with `runAnalysisHint` prompts to run analysis.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# PerformanceChart
|
|
2
|
+
|
|
3
|
+
Renders: forecast performance on ChartAreaInteractive — per-horizon tab (24m window, MAE/MAPE table) and spaghetti tab (all horizons overlaid).
|
|
4
|
+
|
|
5
|
+
Use when: dataset performance tab with horizon selector and error metrics.
|
|
6
|
+
Not when: simple forecast card or driver backtests — use ChartAreaInteractive or DriversComparisonChart.
|
|
7
|
+
|
|
8
|
+
Host provides:
|
|
9
|
+
|
|
10
|
+
- `performanceData` (PerformanceChartPayload) and `historicalData` from performance API
|
|
11
|
+
- Analysis selection and fetch outside widget
|
|
12
|
+
- Optional `forecastData`, `customPerformanceMatrix`, `userSeries` for spaghetti
|
|
13
|
+
|
|
14
|
+
Report tile: Not used in report tiles.
|
|
15
|
+
|
|
16
|
+
Requires: `performanceData` — model/drift forecasts and metrics; `historicalData` — baseline series; `loading` / `chartLoading` / `performanceDataLoading` — spinners; `runAnalysisHint` / `statusHint` — empty states.
|
|
17
|
+
|
|
18
|
+
Empty/loading: loading props show shimmer/spinner; null `performanceData` with `runAnalysisHint` prompts to run analysis.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# SidebarDatasetsItemsGrouped
|
|
2
|
+
|
|
3
|
+
Renders: expandable sidebar groups of datasets (by target type, regions, or categories).
|
|
4
|
+
|
|
5
|
+
Use when: app shell needs grouped dataset navigation.
|
|
6
|
+
Not when: in-page or report content (no sidebar slot).
|
|
7
|
+
|
|
8
|
+
Host provides:
|
|
9
|
+
|
|
10
|
+
- `datasets` list (`SidebarDatasetsItemsGroupedDataset`)
|
|
11
|
+
- `groupBy`, `selectedDatasetId`, `onDatasetClick`
|
|
12
|
+
- Optional `preItems` / `postItems`, `defaultExpandedGroupNames`
|
|
13
|
+
|
|
14
|
+
Report tile: Not used in report tiles.
|
|
15
|
+
|
|
16
|
+
Requires: `datasets`; `groupBy`; `onDatasetClick` for navigation.
|
|
17
|
+
|
|
18
|
+
Empty/loading: empty `datasets` renders no groups; loading handled by host before pass-in.
|