@sybilion/uilib 1.4.15 → 1.4.17

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 (40) hide show
  1. package/dist/agent-glossary/workspace.generated.ts +1 -0
  2. package/dist/agent-glossary/workspace.index.md +1 -0
  3. package/dist/agent-glossary/workspace.md +1 -0
  4. package/dist/esm/components/ui/AppHeader/AppHeader.js +1 -1
  5. package/dist/esm/components/ui/Chip/Chip.js +1 -1
  6. package/dist/esm/components/ui/Form/Form.js +96 -0
  7. package/dist/esm/components/ui/Form/Form.styl.js +7 -0
  8. package/dist/esm/components/widgets/DriverMap/DriverMap.js +8 -8
  9. package/dist/esm/components/widgets/PerformanceChart/PerformanceChart.js +2 -2
  10. package/dist/esm/components/widgets/PerformanceChart/PerformanceTable.js +2 -2
  11. package/dist/esm/components/widgets/SybilionAppHeader/SybilionAppHeader.styl.js +1 -1
  12. package/dist/esm/index.js +1 -0
  13. package/dist/esm/types/src/components/ui/Form/Form.d.ts +48 -0
  14. package/dist/esm/types/src/components/ui/Form/Form.example.d.ts +1 -0
  15. package/dist/esm/types/src/components/ui/Form/Form.types.d.ts +14 -0
  16. package/dist/esm/types/src/components/ui/Form/index.d.ts +2 -0
  17. package/dist/esm/types/src/components/widgets/DriverMap/DriverMap.d.ts +2 -1
  18. package/dist/esm/types/src/components/widgets/PerformanceChart/PerformanceChart.d.ts +2 -1
  19. package/dist/esm/types/src/components/widgets/PerformanceChart/PerformanceTable.d.ts +2 -1
  20. package/dist/esm/types/src/docs/pages/FormPage.d.ts +1 -0
  21. package/dist/esm/types/src/index.d.ts +1 -0
  22. package/dist/esm/types/tests/form.test.d.ts +1 -0
  23. package/package.json +9 -3
  24. package/src/components/ui/AppHeader/AppHeader.tsx +1 -0
  25. package/src/components/ui/Chip/Chip.tsx +3 -3
  26. package/src/components/ui/Form/AGENT.md +29 -0
  27. package/src/components/ui/Form/Form.example.tsx +193 -0
  28. package/src/components/ui/Form/Form.styl +12 -0
  29. package/src/components/ui/Form/Form.styl.d.ts +9 -0
  30. package/src/components/ui/Form/Form.tsx +231 -0
  31. package/src/components/ui/Form/Form.types.ts +32 -0
  32. package/src/components/ui/Form/index.ts +11 -0
  33. package/src/components/widgets/DriverMap/DriverMap.tsx +11 -10
  34. package/src/components/widgets/PerformanceChart/PerformanceChart.tsx +3 -0
  35. package/src/components/widgets/PerformanceChart/PerformanceTable.tsx +3 -1
  36. package/src/components/widgets/SybilionAppHeader/SybilionAppHeader.styl +7 -2
  37. package/src/docs/App/App.tsx +17 -18
  38. package/src/docs/pages/FormPage.tsx +21 -0
  39. package/src/docs/registry.ts +6 -0
  40. package/src/index.ts +1 -0
@@ -32,6 +32,7 @@ Entry point for \`@sybilion/uilib\`. Open linked AGENT.md before using a compone
32
32
  - [FileChip](src/components/ui/FileChip/AGENT.md) — FileChip is a compact row that represents a file with a format icon, name, and hint text. It supports an onClick hand…
33
33
  - [FlickeringGrid](src/components/ui/FlickeringGrid/AGENT.md) — FlickeringGrid is a purely decorative animated grid of squares that flicker at random. Place it behind content in a p…
34
34
  - [Foldable](src/components/ui/Foldable/AGENT.md) — Foldable is a collapsible section with a clickable header that shows or hides its content. Pass the header and conten…
35
+ - [Form](src/components/ui/Form/AGENT.md) — Validated forms via root Form with zod schema and inline field errors
35
36
  - [Gap](src/components/ui/Gap/AGENT.md) — Gap is a flex-grow spacer that absorbs remaining horizontal or vertical space inside a flex container. Render it betw…
36
37
  - [GridLayout](src/components/ui/GridLayout/AGENT.md) — GridLayout is a responsive CSS grid that fits as many columns as the container allows, with each cell keeping at leas…
37
38
  - [Image](src/components/ui/Image/AGENT.md) — Image is a thin wrapper around the native img element that loads a remote URL and accepts a fallback for when the req…
@@ -31,6 +31,7 @@ Entry point for `@sybilion/uilib`. Open linked AGENT.md before using a component
31
31
  - [FileChip](src/components/ui/FileChip/AGENT.md) — FileChip is a compact row that represents a file with a format icon, name, and hint text. It supports an onClick hand…
32
32
  - [FlickeringGrid](src/components/ui/FlickeringGrid/AGENT.md) — FlickeringGrid is a purely decorative animated grid of squares that flicker at random. Place it behind content in a p…
33
33
  - [Foldable](src/components/ui/Foldable/AGENT.md) — Foldable is a collapsible section with a clickable header that shows or hides its content. Pass the header and conten…
34
+ - [Form](src/components/ui/Form/AGENT.md) — Validated forms via root Form with zod schema and inline field errors
34
35
  - [Gap](src/components/ui/Gap/AGENT.md) — Gap is a flex-grow spacer that absorbs remaining horizontal or vertical space inside a flex container. Render it betw…
35
36
  - [GridLayout](src/components/ui/GridLayout/AGENT.md) — GridLayout is a responsive CSS grid that fits as many columns as the container allows, with each cell keeping at leas…
36
37
  - [Image](src/components/ui/Image/AGENT.md) — Image is a thin wrapper around the native img element that loads a remote URL and accepts a fallback for when the req…
@@ -31,6 +31,7 @@ Entry point for `@sybilion/uilib`. Open linked AGENT.md before using a component
31
31
  - [FileChip](src/components/ui/FileChip/AGENT.md) — FileChip is a compact row that represents a file with a format icon, name, and hint text. It supports an onClick hand…
32
32
  - [FlickeringGrid](src/components/ui/FlickeringGrid/AGENT.md) — FlickeringGrid is a purely decorative animated grid of squares that flicker at random. Place it behind content in a p…
33
33
  - [Foldable](src/components/ui/Foldable/AGENT.md) — Foldable is a collapsible section with a clickable header that shows or hides its content. Pass the header and conten…
34
+ - [Form](src/components/ui/Form/AGENT.md) — Validated forms via root Form with zod schema and inline field errors
34
35
  - [Gap](src/components/ui/Gap/AGENT.md) — Gap is a flex-grow spacer that absorbs remaining horizontal or vertical space inside a flex container. Render it betw…
35
36
  - [GridLayout](src/components/ui/GridLayout/AGENT.md) — GridLayout is a responsive CSS grid that fits as many columns as the container allows, with each cell keeping at leas…
36
37
  - [Image](src/components/ui/Image/AGENT.md) — Image is a thin wrapper around the native img element that loads a remote URL and accepts a fallback for when the req…
@@ -6,7 +6,7 @@ import S from './AppHeader.styl.js';
6
6
  import { PAGE_HEADER_ID } from './appChromeAnchors.js';
7
7
 
8
8
  function AppHeaderHost({ className, anchorId = PAGE_HEADER_ID, sticky, }) {
9
- return (jsx("header", { className: cn(S.root, sticky && S.sticky, className), id: anchorId }));
9
+ return (jsx("header", { className: cn(S.root, sticky && S.sticky, className), "data-sticky": sticky ? 'true' : 'false', id: anchorId }));
10
10
  }
11
11
  function AppHeaderPortal({ children, pageHeaderId = PAGE_HEADER_ID, }) {
12
12
  const [container, setContainer] = useState(null);
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import cn from 'classnames';
2
3
  import { TrendingUp, TrendingDown } from 'lucide-react';
3
4
  import S from './Chip.styl.js';
4
- import cn from 'classnames';
5
5
 
6
6
  function Chip({ className, variant = 'neutral', dot, trend, squared = false, children, ...props }) {
7
7
  const TrendIcon = trend === 'up' ? TrendingUp : trend === 'down' ? TrendingDown : null;
@@ -0,0 +1,96 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import cn from 'classnames';
3
+ import { createContext, useId, useContext } from 'react';
4
+ import { useForm, FormProvider, useFormContext, Controller, useFormState } from 'react-hook-form';
5
+ import { Label } from '../Label/Label.js';
6
+ import { zodResolver } from '@hookform/resolvers/zod';
7
+ import { Slot } from '@radix-ui/react-slot';
8
+ import S from './Form.styl.js';
9
+
10
+ const FormFieldContext = createContext(null);
11
+ const FormItemContext = createContext(null);
12
+ /**
13
+ * Root validated form. Owns `useForm`, applies `zodResolver(schema)` when `schema` is
14
+ * passed, and renders a native `<form>` wired to `onSubmit`. Wrap fields in {@link FormField}.
15
+ */
16
+ function Form({ schema, defaultValues, onSubmit, resolver, formOptions, form: externalForm, className, children, ...formHTMLProps }) {
17
+ const internalForm = useForm({
18
+ defaultValues,
19
+ resolver: resolver ??
20
+ (schema ? zodResolver(schema) : undefined),
21
+ ...formOptions,
22
+ });
23
+ const methods = externalForm ?? internalForm;
24
+ return (jsx(FormProvider, { ...methods, children: jsx("form", { "data-slot": "form", className: cn(className), onSubmit: methods.handleSubmit(onSubmit), ...formHTMLProps, children: children }) }));
25
+ }
26
+ /**
27
+ * Connects a field to react-hook-form via `Controller`. Reads `control` from the nearest
28
+ * {@link Form} context — do not pass `control` manually. Must wrap {@link FormItem} inside `render`.
29
+ */
30
+ function FormField({ ...props }) {
31
+ const { control } = useFormContext();
32
+ return (jsx(FormFieldContext.Provider, { value: { name: props.name }, children: jsx(Controller, { ...props, control: control }) }));
33
+ }
34
+ /** Vertical field shell; generates stable ids for label, control, description, and message. */
35
+ function FormItem({ className, ...props }) {
36
+ const id = useId();
37
+ return (jsx(FormItemContext.Provider, { value: { id }, children: jsx("div", { "data-slot": "form-item", className: cn(S.item, className), ...props }) }));
38
+ }
39
+ /**
40
+ * Field metadata for {@link FormLabel}, {@link FormControl}, {@link FormDescription}, and
41
+ * {@link FormMessage}. Requires {@link FormField} + {@link FormItem} ancestors.
42
+ */
43
+ function useFormField() {
44
+ const fieldContext = useContext(FormFieldContext);
45
+ const itemContext = useContext(FormItemContext);
46
+ const { getFieldState, control } = useFormContext();
47
+ const formState = useFormState({ control, name: fieldContext?.name });
48
+ const fieldState = getFieldState(fieldContext?.name ?? '', formState);
49
+ if (!fieldContext) {
50
+ throw new Error('useFormField should be used within <FormField>');
51
+ }
52
+ if (!itemContext) {
53
+ throw new Error('useFormField should be used within <FormItem>');
54
+ }
55
+ const { id } = itemContext;
56
+ return {
57
+ id,
58
+ name: fieldContext.name,
59
+ formItemId: `${id}-form-item`,
60
+ formDescriptionId: `${id}-form-item-description`,
61
+ formMessageId: `${id}-form-item-message`,
62
+ ...fieldState,
63
+ };
64
+ }
65
+ /** Accessible label linked to the control id from {@link FormItem}. */
66
+ function FormLabel({ className, ...props }) {
67
+ const { formItemId } = useFormField();
68
+ return (jsx(Label, { "data-slot": "form-label", className: cn(className), htmlFor: formItemId, ...props }));
69
+ }
70
+ /**
71
+ * Slot wrapper for the actual input. Forwards `id`, `aria-invalid`, and `aria-describedby`
72
+ * so uilib controls show validation styling (P-07 inline errors).
73
+ */
74
+ function FormControl({ ...props }) {
75
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
76
+ return (jsx(Slot, { "data-slot": "form-control", id: formItemId, "aria-describedby": error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId, "aria-invalid": !!error, ...props }));
77
+ }
78
+ /** Optional helper text below the label; referenced by `aria-describedby` on {@link FormControl}. */
79
+ function FormDescription({ className, ...props }) {
80
+ const { formDescriptionId } = useFormField();
81
+ return (jsx("p", { "data-slot": "form-description", id: formDescriptionId, className: cn(S.description, className), ...props }));
82
+ }
83
+ /**
84
+ * Inline validation message (`role="alert"`). Shows `fieldState.error.message` when present;
85
+ * omit for empty fields — never use toast for field errors.
86
+ */
87
+ function FormMessage({ className, children, ...props }) {
88
+ const { error, formMessageId } = useFormField();
89
+ const body = error ? String(error?.message ?? '') : children;
90
+ if (!body) {
91
+ return null;
92
+ }
93
+ return (jsx("p", { "data-slot": "form-message", id: formMessageId, role: "alert", className: cn(S.message, className), ...props, children: body }));
94
+ }
95
+
96
+ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
@@ -0,0 +1,7 @@
1
+ import styleInject from 'style-inject';
2
+
3
+ var css_248z = ".Form_item__zPDBr{display:flex;flex-direction:column;gap:var(--spacing-xs)}.Form_message__2ch7w{color:var(--destructive);font-size:var(--text-sm)}.Form_description__rVj8c{color:var(--muted-foreground);font-size:var(--text-sm)}";
4
+ var S = {"item":"Form_item__zPDBr","message":"Form_message__2ch7w","description":"Form_description__rVj8c"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
@@ -1,18 +1,18 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import cn from 'classnames';
3
- import { useRef, useState, useMemo, useEffect, useCallback } from 'react';
4
- import { WorldMap } from '../../ui/WorldMap/WorldMap.js';
5
- import useEvent from '../../../hooks/useEvent.js';
6
- import { Shimmer } from '@homecode/ui';
7
2
  import { DriverIcon } from './DriverIcon/DriverIcon.js';
8
- import constants from './DriverIcon/DriverIcon.constants.json.js';
9
3
  import { findMostSpecificRegion, getDriverCoordinates, hasValidCoords, calculateBadgeSizes } from './DriverMap.helpers.js';
4
+ import { useRef, useState, useMemo, useEffect, useCallback } from 'react';
10
5
  import S from './DriverMap.styl.js';
6
+ import { Shimmer } from '@homecode/ui';
7
+ import { WorldMap } from '../../ui/WorldMap/WorldMap.js';
8
+ import cn from 'classnames';
9
+ import constants from './DriverIcon/DriverIcon.constants.json.js';
11
10
  import { getHighestImportanceDriver } from './driverMapSelection.js';
11
+ import useEvent from '../../../hooks/useEvent.js';
12
12
 
13
13
  const delay = (ms) => new Promise(r => setTimeout(r, ms));
14
14
  const transitionDelay = () => delay(constants.FADE_DURATION);
15
- function DriverMap({ drivers, isLoading, setSelectedDriver, selectedDriver, }) {
15
+ function DriverMap({ className, drivers, isLoading, setSelectedDriver, selectedDriver, }) {
16
16
  const visibleDriversRef = useRef([]);
17
17
  const [showingDrivers, setShowingDrivers] = useState(drivers);
18
18
  const [badgeSizes, setBadgeSizes] = useState({});
@@ -113,7 +113,7 @@ function DriverMap({ drivers, isLoading, setSelectedDriver, selectedDriver, }) {
113
113
  callback: handleKeyDown,
114
114
  isCapture: true,
115
115
  });
116
- return (jsxs("div", { className: cn(S.root, isTransitioning && S.inTransition), children: [jsxs("div", { className: S.mapInner, children: [jsx(WorldMap, { className: S.mapWorld }), isLoading && jsx(Shimmer, { className: S.shimmerOverlay, size: "l" }), otherDrivers.map(driver => (jsx(DriverIcon, { isLoading: isLoading, isVisible: isVisible, driver: driver, size: badgeSizes[driver.id] || 's', isSelected: selectedDriver?.id === driver.id, onClick: () => setSelectedDriver(driver) }, driver.id)))] }), jsx("div", { className: S.worldDrivers, children: worldDrivers.map(driver => {
116
+ return (jsxs("div", { className: cn(S.root, isTransitioning && S.inTransition, className), children: [jsxs("div", { className: S.mapInner, children: [jsx(WorldMap, { className: S.mapWorld }), isLoading && jsx(Shimmer, { className: S.shimmerOverlay, size: "l" }), otherDrivers.map(driver => (jsx(DriverIcon, { isLoading: isLoading, isVisible: isVisible, driver: driver, size: badgeSizes[driver.id] || 's', isSelected: selectedDriver?.id === driver.id, onClick: () => setSelectedDriver(driver) }, driver.id)))] }), jsx("div", { className: S.worldDrivers, children: worldDrivers.map(driver => {
117
117
  const driverWithCoords = {
118
118
  ...driver,
119
119
  coordinates: driver.coordinates || {
@@ -48,7 +48,7 @@ function spaghettiForecastLineColor(id, index) {
48
48
  return SPAGHETTI_CUSTOM_PERFORMANCE_LINE_COLOR;
49
49
  return FORECAST_LINE_COLORS[index % FORECAST_LINE_COLORS.length];
50
50
  }
51
- function PerformanceChart({ performanceData, historicalData = [], combinedData = [], forecastData = {}, userSeries = [], spaghettiUserSeries = [], customPerformanceMatrix = null, customPerformanceLabel = null, loading = false, chartLoading = false, performanceSectionPending = false, isEmpty = false, perfFetchSettled = true, performanceDataLoading = false, performanceAnalysisId = null, statusHint = null, statusTone = 'muted', runAnalysisHint = false, timeRange: timeRangeProp, onTimeRangeChange, viewTab: viewTabProp, onViewTabChange, isDarkTheme = false, className, seriesInitKey, toolbarStart, onEditCustomPerformance, showAddEditCustomDataButton = false, addEditCustomDataDisabled = false, hiddenSeries: hiddenSeriesProp, onToggleLegendSeries, onEnsureSeriesVisible, onHiddenSeriesChange, }) {
51
+ function PerformanceChart({ performanceData, historicalData = [], combinedData = [], forecastData = {}, userSeries = [], spaghettiUserSeries = [], customPerformanceMatrix = null, customPerformanceLabel = null, loading = false, chartLoading = false, performanceSectionPending = false, isEmpty = false, perfFetchSettled = true, performanceDataLoading = false, performanceAnalysisId = null, statusHint = null, statusTone = 'muted', runAnalysisHint = false, timeRange: timeRangeProp, onTimeRangeChange, viewTab: viewTabProp, onViewTabChange, isDarkTheme = false, className, seriesInitKey, toolbarStart, onEditCustomPerformance, showAddEditCustomDataButton = false, addEditCustomDataDisabled = false, tableFullWidth, hiddenSeries: hiddenSeriesProp, onToggleLegendSeries, onEnsureSeriesVisible, onHiddenSeriesChange, }) {
52
52
  const [internalViewTab, setInternalViewTab] = useState('perHorizon');
53
53
  const [pinMonth, setPinMonth] = useState(undefined);
54
54
  const [spaghettiTimeRange, setSpaghettiTimeRange] = useState('All');
@@ -808,7 +808,7 @@ function PerformanceChart({ performanceData, historicalData = [], combinedData =
808
808
  if (v === 'perHorizon' || v === 'spaghetti') {
809
809
  handleViewTabChange(v);
810
810
  }
811
- }, className: S.viewTabs, children: [jsxs("div", { className: S.toolbarRow, children: [toolbarStart, jsxs(TabsList, { className: S.viewTabsList, children: [jsx(TabsTrigger, { value: "perHorizon", children: "Per horizon plot" }), jsx(TabsTrigger, { value: "spaghetti", children: "Spaghetti plots" })] }), jsx("div", { className: S.toolBarRight, children: viewTab === 'perHorizon' && performanceData && (jsx(HorizonsSelector, { selectedHorizon: selectedHorizon, onHorizonChange: setSelectedHorizon, availableHorizons: availableHorizons })) })] }), jsxs("div", { className: cn(S.perHorizonChartWrap, performanceSectionPending && S.perHorizonChartWrapLoading), children: [jsx(ChartAreaInteractive, { disableHistoricalAnimation: true, disableTimeRangeSelector: true, enableTimeRangeBrush: true, disableAnimation: isSpaghettiView, chartContainerClassName: S.chartContainer, chartData: perHorizonChartProps.chartData, forecastData: perHorizonChartProps.forecastData, timeRange: activeTimeRange, onTimeRangeChange: handlePerformanceChartTimeRangeChange, pinMonth: pinMonth, onPinMonthChange: updatePinMonth, isDarkTheme: isDarkTheme, loading: perHorizonChartProps.loading || chartLoading, yMin: perHorizonChartProps.yMin, yMax: perHorizonChartProps.yMax, autoScaleYAxis: false, maxVisibleItems: 2, preventDeselection: true, showLegend: false, footerActions: performanceUnderChartLegend ?? undefined, hasCombinedData: perHorizonChartProps.hasCombinedData, hiddenSeries: hiddenSeries, toggleLegendSeries: toggleLegendSeriesKey, ensureAnalysisSeriesVisible: ensureSeriesVisible }), showEmptyOverlay && (jsx("div", { className: S.chartEmptyOverlay, role: "status", "aria-live": "polite", children: jsx(ChartEmptyState, { variant: "inline", hint: runAnalysisHint ? ('Run a completed analysis to load performance data for an analysis.') : isEmpty ? (jsxs(Fragment, { children: ["No performance data for this dataset.", jsx("br", {}), "Please contact", ' ', jsx("a", { href: "mailto:support@sybilion.com", children: "support team" }), " to gain access to the latest performance data."] })) : undefined, status: statusHint ?? undefined, statusTone: statusTone }) })), performanceSectionPending && (jsx("div", { className: S.performanceLoadingLayer, "aria-busy": "true", "aria-live": "polite", children: jsx("div", { className: S.emptyState, children: jsx(TextShimmer, { as: "span", className: S.performanceLoadingText, children: "Loading performance data\u2026" }) }) }))] }), !performanceDataLoading && performanceData && (jsx(PerformanceTable, { forecastModels: forecastModelsData, adjustParameters: adjustParameters, onAdjustParametersChange: setAdjustParameters, customPerformance: customPerformanceTableRow, onEditCustomPerformance: onEditCustomPerformance, showAddEditCustomDataButton: showAddEditCustomDataButton, addEditCustomDataDisabled: addEditCustomDataDisabled }))] }) }));
811
+ }, className: S.viewTabs, children: [jsxs("div", { className: S.toolbarRow, children: [toolbarStart, jsxs(TabsList, { className: S.viewTabsList, children: [jsx(TabsTrigger, { value: "perHorizon", children: "Per horizon plot" }), jsx(TabsTrigger, { value: "spaghetti", children: "Spaghetti plots" })] }), jsx("div", { className: S.toolBarRight, children: viewTab === 'perHorizon' && performanceData && (jsx(HorizonsSelector, { selectedHorizon: selectedHorizon, onHorizonChange: setSelectedHorizon, availableHorizons: availableHorizons })) })] }), jsxs("div", { className: cn(S.perHorizonChartWrap, performanceSectionPending && S.perHorizonChartWrapLoading), children: [jsx(ChartAreaInteractive, { disableHistoricalAnimation: true, disableTimeRangeSelector: true, enableTimeRangeBrush: true, disableAnimation: isSpaghettiView, chartContainerClassName: S.chartContainer, chartData: perHorizonChartProps.chartData, forecastData: perHorizonChartProps.forecastData, timeRange: activeTimeRange, onTimeRangeChange: handlePerformanceChartTimeRangeChange, pinMonth: pinMonth, onPinMonthChange: updatePinMonth, isDarkTheme: isDarkTheme, loading: perHorizonChartProps.loading || chartLoading, yMin: perHorizonChartProps.yMin, yMax: perHorizonChartProps.yMax, autoScaleYAxis: false, maxVisibleItems: 2, preventDeselection: true, showLegend: false, footerActions: performanceUnderChartLegend ?? undefined, hasCombinedData: perHorizonChartProps.hasCombinedData, hiddenSeries: hiddenSeries, toggleLegendSeries: toggleLegendSeriesKey, ensureAnalysisSeriesVisible: ensureSeriesVisible }), showEmptyOverlay && (jsx("div", { className: S.chartEmptyOverlay, role: "status", "aria-live": "polite", children: jsx(ChartEmptyState, { variant: "inline", hint: runAnalysisHint ? ('Run a completed analysis to load performance data for an analysis.') : isEmpty ? (jsxs(Fragment, { children: ["No performance data for this dataset.", jsx("br", {}), "Please contact", ' ', jsx("a", { href: "mailto:support@sybilion.com", children: "support team" }), " to gain access to the latest performance data."] })) : undefined, status: statusHint ?? undefined, statusTone: statusTone }) })), performanceSectionPending && (jsx("div", { className: S.performanceLoadingLayer, "aria-busy": "true", "aria-live": "polite", children: jsx("div", { className: S.emptyState, children: jsx(TextShimmer, { as: "span", className: S.performanceLoadingText, children: "Loading performance data\u2026" }) }) }))] }), !performanceDataLoading && performanceData && (jsx(PerformanceTable, { forecastModels: forecastModelsData, adjustParameters: adjustParameters, onAdjustParametersChange: setAdjustParameters, customPerformance: customPerformanceTableRow, onEditCustomPerformance: onEditCustomPerformance, showAddEditCustomDataButton: showAddEditCustomDataButton, addEditCustomDataDisabled: addEditCustomDataDisabled, fullWidth: tableFullWidth }))] }) }));
812
812
  }
813
813
 
814
814
  export { PerformanceChart };
@@ -77,7 +77,7 @@ const getModelColor = (key) => {
77
77
  return 'var(--sb-cyan-400)';
78
78
  return FORECAST_LINE_COLORS[0];
79
79
  };
80
- function PerformanceTable({ forecastModels, adjustParameters, onAdjustParametersChange, customPerformance = null, onEditCustomPerformance, showAddEditCustomDataButton = false, addEditCustomDataDisabled = false, }) {
80
+ function PerformanceTable({ forecastModels, adjustParameters, onAdjustParametersChange, customPerformance = null, onEditCustomPerformance, showAddEditCustomDataButton = false, addEditCustomDataDisabled = false, fullWidth = true, }) {
81
81
  // Separate Sybilion AI model from drift model
82
82
  const { sybilionModel, driftModel } = useMemo(() => {
83
83
  const sybilion = forecastModels.find(model => model.key === 'model');
@@ -149,7 +149,7 @@ function PerformanceTable({ forecastModels, adjustParameters, onAdjustParameters
149
149
  };
150
150
  }, [customPerformance, driftModel, adjustParameters]);
151
151
  const showCustomActionsColumn = Boolean(customRow);
152
- return (jsx("div", { className: S.tableSection, children: jsx("div", { className: S.tableWrapper, children: jsx(PageXScroll, { size: "md", fullWidth: true, innerClassName: S.tableContainer, scrollbarClassName: S.scrollbar, children: jsxs(Table, { withPaddings: true, className: S.table, children: [jsx(TableHeader, { children: jsxs(TableRow, { children: [jsx(TableHead, { children: jsxs(TableCellValue, { children: ["Forecast", jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { children: jsx(InfoIcon, { size: 16, style: { cursor: 'help' } }) }) }), jsx(TooltipContent, { side: "top", maxWidth: 300, children: "Sybilion AI forecast vs other forecasting methods: MEAN, Seasonal, ARMA, ARIMA, Linear, Theta" })] })] }) }), jsx(TableHead, { children: "Accuracy" }), jsx(TableHead, { children: "Error" }), jsx(TableHead, { children: jsxs(TableCellValue, { children: ["ROI", jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { children: jsx(InfoIcon, { size: 16, style: { cursor: 'help' } }) }) }), jsx(TooltipContent, { side: "top", maxWidth: 300, children: "ROI is calculated using default contract annual price." })] })] }) }), jsx(TableHead, { children: jsxs(TableCellValue, { children: ["Benefit p/a", jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { children: jsx(InfoIcon, { size: 16, style: { cursor: 'help' } }) }) }), jsx(TooltipContent, { side: "top", maxWidth: 300, children: "Annual Benefit of using Sybilion AI forecast compared to alternative forecasting methods. Calculated using default assumptions: Procurement Volume \u20AC100,000,000 \u00B7 Variable Share 50% \u00B7 Controllable Share 60%" })] })] }) }), showCustomActionsColumn && jsx(TableHead, {})] }) }), jsxs(TableBody, { children: [sybilionRow && (jsx(ModelTableRow, { modelKey: sybilionRow.key, row: jsxs(TableRow, { children: [jsx(TableCell, { children: jsxs("div", { className: S.forecastCell, children: [jsx("span", { className: S.colorCircle, style: { backgroundColor: sybilionRow.color } }), sybilionRow.forecast] }) }), jsx(TableCell, { children: sybilionRow.accuracy }), jsx(TableCell, { children: sybilionRow.error }), jsx(TableCell, { children: sybilionRow.roi }), jsx(TableCell, { children: sybilionRow.benefit }), showCustomActionsColumn && jsx(TableCell, {})] }, sybilionRow.key) })), driftRow && (jsx(ModelTableRow, { modelKey: driftRow.key, row: jsxs(TableRow, { children: [jsx(TableCell, { children: jsxs("div", { className: S.forecastCell, children: [jsx("span", { className: S.colorCircle, style: { backgroundColor: driftRow.color } }), driftRow.forecast] }) }), jsx(TableCell, { children: driftRow.accuracy }), jsx(TableCell, { children: driftRow.error }), jsx(TableCell, { children: driftRow.roi }), jsx(TableCell, { children: driftRow.benefit }), showCustomActionsColumn && jsx(TableCell, {})] }, driftRow.key) })), customRow && (jsx(ModelTableRow, { modelKey: customRow.key, row: jsxs(TableRow, { children: [jsx(TableCell, { children: jsxs("div", { className: S.forecastCell, children: [jsx("span", { className: S.colorCircle, style: { backgroundColor: customRow.color } }), customRow.forecast] }) }), jsx(TableCell, { children: customRow.accuracy }), jsx(TableCell, { children: customRow.error }), jsx(TableCell, { children: customRow.roi }), jsx(TableCell, { children: customRow.benefit }), showCustomActionsColumn && (jsx(TableCell, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx(Button, { className: S.editCustomPerformanceButton, type: "button", variant: "ghost", icon: true, "aria-label": "Edit custom performance data", onClick: () => onEditCustomPerformance?.(), children: jsx(Pencil, { size: 16 }) }) }), jsx(TooltipContent, { side: "top", children: "Edit custom performance data" })] }) }))] }, customRow.key) })), showAddEditCustomDataButton && !customPerformance && (jsx(TableRow, { className: S.tableCustomDataFooterRow, children: jsx(TableCell, { colSpan: 5 + (showCustomActionsColumn ? 1 : 0), className: S.tableCustomDataFooterCell, children: jsxs(Button, { type: "button", variant: "ghost", size: "sm", disabled: addEditCustomDataDisabled, onClick: () => onEditCustomPerformance?.(), children: [jsx(TableIcon, { size: 16 }), "Add custom data"] }) }) }))] })] }) }) }) }));
152
+ return (jsx("div", { className: S.tableSection, children: jsx("div", { className: S.tableWrapper, children: jsx(PageXScroll, { size: "md", fullWidth: fullWidth, innerClassName: S.tableContainer, scrollbarClassName: S.scrollbar, children: jsxs(Table, { withPaddings: true, className: S.table, children: [jsx(TableHeader, { children: jsxs(TableRow, { children: [jsx(TableHead, { children: jsxs(TableCellValue, { children: ["Forecast", jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { children: jsx(InfoIcon, { size: 16, style: { cursor: 'help' } }) }) }), jsx(TooltipContent, { side: "top", maxWidth: 300, children: "Sybilion AI forecast vs other forecasting methods: MEAN, Seasonal, ARMA, ARIMA, Linear, Theta" })] })] }) }), jsx(TableHead, { children: "Accuracy" }), jsx(TableHead, { children: "Error" }), jsx(TableHead, { children: jsxs(TableCellValue, { children: ["ROI", jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { children: jsx(InfoIcon, { size: 16, style: { cursor: 'help' } }) }) }), jsx(TooltipContent, { side: "top", maxWidth: 300, children: "ROI is calculated using default contract annual price." })] })] }) }), jsx(TableHead, { children: jsxs(TableCellValue, { children: ["Benefit p/a", jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { children: jsx(InfoIcon, { size: 16, style: { cursor: 'help' } }) }) }), jsx(TooltipContent, { side: "top", maxWidth: 300, children: "Annual Benefit of using Sybilion AI forecast compared to alternative forecasting methods. Calculated using default assumptions: Procurement Volume \u20AC100,000,000 \u00B7 Variable Share 50% \u00B7 Controllable Share 60%" })] })] }) }), showCustomActionsColumn && jsx(TableHead, {})] }) }), jsxs(TableBody, { children: [sybilionRow && (jsx(ModelTableRow, { modelKey: sybilionRow.key, row: jsxs(TableRow, { children: [jsx(TableCell, { children: jsxs("div", { className: S.forecastCell, children: [jsx("span", { className: S.colorCircle, style: { backgroundColor: sybilionRow.color } }), sybilionRow.forecast] }) }), jsx(TableCell, { children: sybilionRow.accuracy }), jsx(TableCell, { children: sybilionRow.error }), jsx(TableCell, { children: sybilionRow.roi }), jsx(TableCell, { children: sybilionRow.benefit }), showCustomActionsColumn && jsx(TableCell, {})] }, sybilionRow.key) })), driftRow && (jsx(ModelTableRow, { modelKey: driftRow.key, row: jsxs(TableRow, { children: [jsx(TableCell, { children: jsxs("div", { className: S.forecastCell, children: [jsx("span", { className: S.colorCircle, style: { backgroundColor: driftRow.color } }), driftRow.forecast] }) }), jsx(TableCell, { children: driftRow.accuracy }), jsx(TableCell, { children: driftRow.error }), jsx(TableCell, { children: driftRow.roi }), jsx(TableCell, { children: driftRow.benefit }), showCustomActionsColumn && jsx(TableCell, {})] }, driftRow.key) })), customRow && (jsx(ModelTableRow, { modelKey: customRow.key, row: jsxs(TableRow, { children: [jsx(TableCell, { children: jsxs("div", { className: S.forecastCell, children: [jsx("span", { className: S.colorCircle, style: { backgroundColor: customRow.color } }), customRow.forecast] }) }), jsx(TableCell, { children: customRow.accuracy }), jsx(TableCell, { children: customRow.error }), jsx(TableCell, { children: customRow.roi }), jsx(TableCell, { children: customRow.benefit }), showCustomActionsColumn && (jsx(TableCell, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx(Button, { className: S.editCustomPerformanceButton, type: "button", variant: "ghost", icon: true, "aria-label": "Edit custom performance data", onClick: () => onEditCustomPerformance?.(), children: jsx(Pencil, { size: 16 }) }) }), jsx(TooltipContent, { side: "top", children: "Edit custom performance data" })] }) }))] }, customRow.key) })), showAddEditCustomDataButton && !customPerformance && (jsx(TableRow, { className: S.tableCustomDataFooterRow, children: jsx(TableCell, { colSpan: 5 + (showCustomActionsColumn ? 1 : 0), className: S.tableCustomDataFooterCell, children: jsxs(Button, { type: "button", variant: "ghost", size: "sm", disabled: addEditCustomDataDisabled, onClick: () => onEditCustomPerformance?.(), children: [jsx(TableIcon, { size: 16 }), "Add custom data"] }) }) }))] })] }) }) }) }));
153
153
  }
154
154
 
155
155
  export { PerformanceTable };
@@ -1,6 +1,6 @@
1
1
  import styleInject from 'style-inject';
2
2
 
3
- var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.SybilionAppHeader_actionsAnchor__ress2{align-items:center;display:flex;flex-shrink:0;gap:var(--p-2)}.SybilionAppHeader_pageActionsPortal__9C5ww{align-items:center;display:flex;flex-shrink:0;gap:var(--p-1)}.SybilionAppHeader_pageActionsPortal__9C5ww:empty{display:none}.SybilionAppHeader_logoArea__3HAhG{align-items:center;display:flex;gap:var(--p-2);left:40px;position:absolute;top:22px;z-index:10}@media (max-width:768px){.SybilionAppHeader_logoArea__3HAhG{left:22px}}@media (min-width:768px){[data-slot=sidebar-wrapper][data-state=expanded]:not([data-slot=app-shell] [data-slot=sidebar-wrapper]) [data-slot=app-shell]:not([data-slot=app-shell] [data-slot=app-shell]) .SybilionAppHeader_logoArea__3HAhG:not([data-slot=app-shell] [data-slot=app-shell] *){left:calc(var(--sidebar-width)*-1 + 52px);position:absolute}[data-slot=app-shell] [data-slot=sidebar-wrapper][data-state=expanded] [data-slot=app-shell] .SybilionAppHeader_logoArea__3HAhG{left:calc(var(--sidebar-width)*-1 + 44px);position:absolute}[data-slot=app-shell] [data-slot=sidebar-wrapper][data-state=collapsed] [data-slot=app-shell] .SybilionAppHeader_logoArea__3HAhG{left:var(--p-8);position:absolute}}.SybilionAppHeader_logoLink__bH-KX{align-items:center;color:var(--color-foreground);display:flex;font-size:1.5rem;font-weight:400;gap:.5rem;text-decoration:none;white-space:nowrap;width:-moz-fit-content;width:fit-content}.SybilionAppHeader_logoLink__bH-KX svg{display:inline-flex;flex-shrink:0;height:32px;transition:transform .1s ease-in-out;width:auto}.SybilionAppHeader_logoLink__bH-KX:hover svg{transform:scale(1.05)}";
3
+ var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.SybilionAppHeader_actionsAnchor__ress2{align-items:center;display:flex;flex-shrink:0;gap:var(--p-2)}.SybilionAppHeader_pageActionsPortal__9C5ww{align-items:center;display:flex;flex-shrink:0;gap:var(--p-1)}.SybilionAppHeader_pageActionsPortal__9C5ww:empty{display:none}.SybilionAppHeader_logoArea__3HAhG{align-items:center;display:flex;gap:var(--p-2);left:40px;position:absolute;top:22px;z-index:10}@media (max-width:768px){.SybilionAppHeader_logoArea__3HAhG{left:22px}}@media (min-width:768px){[data-slot=sidebar-wrapper][data-state=expanded]:not([data-slot=app-shell] [data-slot=sidebar-wrapper]) [data-slot=app-shell]:not([data-slot=app-shell] [data-slot=app-shell]) header[data-sticky=false] .SybilionAppHeader_logoArea__3HAhG:not([data-slot=app-shell] [data-slot=app-shell] *){left:52px;position:fixed;top:22px;top:calc(22px + var(--app-banner-height, 0px))}[data-slot=sidebar-wrapper][data-state=expanded]:not([data-slot=app-shell] [data-slot=sidebar-wrapper]) [data-slot=app-shell]:not([data-slot=app-shell] [data-slot=app-shell]) header[data-sticky=true] .SybilionAppHeader_logoArea__3HAhG:not([data-slot=app-shell] [data-slot=app-shell] *){left:calc(var(--sidebar-width)*-1 + 52px);position:absolute}[data-slot=app-shell] [data-slot=sidebar-wrapper][data-state=expanded] [data-slot=app-shell] .SybilionAppHeader_logoArea__3HAhG{left:calc(var(--sidebar-width)*-1 + 44px);position:absolute}[data-slot=app-shell] [data-slot=sidebar-wrapper][data-state=collapsed] [data-slot=app-shell] .SybilionAppHeader_logoArea__3HAhG{left:var(--p-8);position:absolute}}.SybilionAppHeader_logoLink__bH-KX{align-items:center;color:var(--color-foreground);display:flex;font-size:1.5rem;font-weight:400;gap:.5rem;text-decoration:none;white-space:nowrap;width:-moz-fit-content;width:fit-content}.SybilionAppHeader_logoLink__bH-KX svg{display:inline-flex;flex-shrink:0;height:32px;transition:transform .1s ease-in-out;width:auto}.SybilionAppHeader_logoLink__bH-KX:hover svg{transform:scale(1.05)}";
4
4
  var S = {"actionsAnchor":"SybilionAppHeader_actionsAnchor__ress2","pageActionsPortal":"SybilionAppHeader_pageActionsPortal__9C5ww","logoArea":"SybilionAppHeader_logoArea__3HAhG","logoLink":"SybilionAppHeader_logoLink__bH-KX"};
5
5
  styleInject(css_248z);
6
6
 
package/dist/esm/index.js CHANGED
@@ -54,6 +54,7 @@ export { DropZone } from './components/ui/DropZone/DropZone.js';
54
54
  export { FileChip } from './components/ui/FileChip/FileChip.js';
55
55
  export { FlickeringGrid } from './components/ui/FlickeringGrid/FlickeringGrid.js';
56
56
  export { Foldable } from './components/ui/Foldable/Foldable.js';
57
+ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from './components/ui/Form/Form.js';
57
58
  export { Gap } from './components/ui/Gap/Gap.js';
58
59
  export { GridLayout } from './components/ui/GridLayout/GridLayout.js';
59
60
  export { Image } from './components/ui/Image/Image.js';
@@ -0,0 +1,48 @@
1
+ import { type ComponentProps, type HTMLAttributes } from 'react';
2
+ import { type FieldPath, type FieldValues } from 'react-hook-form';
3
+ import { Label } from '#uilib/components/ui/Label';
4
+ import { Slot } from '@radix-ui/react-slot';
5
+ import type { FormFieldProps, FormProps } from './Form.types';
6
+ /**
7
+ * Root validated form. Owns `useForm`, applies `zodResolver(schema)` when `schema` is
8
+ * passed, and renders a native `<form>` wired to `onSubmit`. Wrap fields in {@link FormField}.
9
+ */
10
+ declare function Form<TFieldValues extends FieldValues>({ schema, defaultValues, onSubmit, resolver, formOptions, form: externalForm, className, children, ...formHTMLProps }: FormProps<TFieldValues>): import("react/jsx-runtime").JSX.Element;
11
+ /**
12
+ * Connects a field to react-hook-form via `Controller`. Reads `control` from the nearest
13
+ * {@link Form} context — do not pass `control` manually. Must wrap {@link FormItem} inside `render`.
14
+ */
15
+ declare function FormField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: FormFieldProps<TFieldValues, TName>): import("react/jsx-runtime").JSX.Element;
16
+ /** Vertical field shell; generates stable ids for label, control, description, and message. */
17
+ declare function FormItem({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
18
+ /**
19
+ * Field metadata for {@link FormLabel}, {@link FormControl}, {@link FormDescription}, and
20
+ * {@link FormMessage}. Requires {@link FormField} + {@link FormItem} ancestors.
21
+ */
22
+ declare function useFormField(): {
23
+ invalid: boolean;
24
+ isDirty: boolean;
25
+ isTouched: boolean;
26
+ isValidating: boolean;
27
+ error?: import("react-hook-form").FieldError;
28
+ id: string;
29
+ name: string;
30
+ formItemId: string;
31
+ formDescriptionId: string;
32
+ formMessageId: string;
33
+ };
34
+ /** Accessible label linked to the control id from {@link FormItem}. */
35
+ declare function FormLabel({ className, ...props }: ComponentProps<typeof Label>): import("react/jsx-runtime").JSX.Element;
36
+ /**
37
+ * Slot wrapper for the actual input. Forwards `id`, `aria-invalid`, and `aria-describedby`
38
+ * so uilib controls show validation styling (P-07 inline errors).
39
+ */
40
+ declare function FormControl({ ...props }: ComponentProps<typeof Slot>): import("react/jsx-runtime").JSX.Element;
41
+ /** Optional helper text below the label; referenced by `aria-describedby` on {@link FormControl}. */
42
+ declare function FormDescription({ className, ...props }: HTMLAttributes<HTMLParagraphElement>): import("react/jsx-runtime").JSX.Element;
43
+ /**
44
+ * Inline validation message (`role="alert"`). Shows `fieldState.error.message` when present;
45
+ * omit for empty fields — never use toast for field errors.
46
+ */
47
+ declare function FormMessage({ className, children, ...props }: HTMLAttributes<HTMLParagraphElement>): import("react/jsx-runtime").JSX.Element;
48
+ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField, };
@@ -0,0 +1 @@
1
+ export declare function FormExample(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import type { ControllerProps, DefaultValues, FieldPath, FieldValues, Resolver, SubmitHandler, UseFormProps, UseFormReturn } from 'react-hook-form';
3
+ import type { z } from 'zod';
4
+ export type FormProps<TFieldValues extends FieldValues = FieldValues> = Omit<ComponentPropsWithoutRef<'form'>, 'onSubmit' | 'children'> & {
5
+ schema?: z.ZodType<TFieldValues>;
6
+ defaultValues?: DefaultValues<TFieldValues>;
7
+ onSubmit: SubmitHandler<TFieldValues>;
8
+ resolver?: Resolver<TFieldValues>;
9
+ formOptions?: Omit<UseFormProps<TFieldValues>, 'defaultValues' | 'resolver'>;
10
+ form?: UseFormReturn<TFieldValues>;
11
+ children?: ReactNode;
12
+ className?: string;
13
+ };
14
+ export type FormFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = Omit<ControllerProps<TFieldValues, TName>, 'control'>;
@@ -0,0 +1,2 @@
1
+ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField, } from './Form';
2
+ export type { FormFieldProps, FormProps } from './Form.types';
@@ -1,8 +1,9 @@
1
1
  import type { DriverData } from './driverMapGeography';
2
2
  export interface DriverMapProps {
3
+ className?: string;
3
4
  drivers: DriverData[];
4
5
  isLoading: boolean;
5
6
  setSelectedDriver: (driver: DriverData) => void;
6
7
  selectedDriver: DriverData | null;
7
8
  }
8
- export declare function DriverMap({ drivers, isLoading, setSelectedDriver, selectedDriver, }: DriverMapProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function DriverMap({ className, drivers, isLoading, setSelectedDriver, selectedDriver, }: DriverMapProps): import("react/jsx-runtime").JSX.Element;
@@ -49,9 +49,10 @@ export type PerformanceChartProps = {
49
49
  onEditCustomPerformance?: () => void;
50
50
  showAddEditCustomDataButton?: boolean;
51
51
  addEditCustomDataDisabled?: boolean;
52
+ tableFullWidth?: boolean;
52
53
  hiddenSeries?: Set<string>;
53
54
  onToggleLegendSeries?: (key: string) => void;
54
55
  onEnsureSeriesVisible?: (key: string) => void;
55
56
  onHiddenSeriesChange?: (update: Set<string> | ((prev: Set<string>) => Set<string>)) => void;
56
57
  };
57
- export declare function PerformanceChart({ performanceData, historicalData, combinedData, forecastData, userSeries, spaghettiUserSeries, customPerformanceMatrix, customPerformanceLabel, loading, chartLoading, performanceSectionPending, isEmpty, perfFetchSettled, performanceDataLoading, performanceAnalysisId, statusHint, statusTone, runAnalysisHint, timeRange: timeRangeProp, onTimeRangeChange, viewTab: viewTabProp, onViewTabChange, isDarkTheme, className, seriesInitKey, toolbarStart, onEditCustomPerformance, showAddEditCustomDataButton, addEditCustomDataDisabled, hiddenSeries: hiddenSeriesProp, onToggleLegendSeries, onEnsureSeriesVisible, onHiddenSeriesChange, }: PerformanceChartProps): import("react/jsx-runtime").JSX.Element;
58
+ export declare function PerformanceChart({ performanceData, historicalData, combinedData, forecastData, userSeries, spaghettiUserSeries, customPerformanceMatrix, customPerformanceLabel, loading, chartLoading, performanceSectionPending, isEmpty, perfFetchSettled, performanceDataLoading, performanceAnalysisId, statusHint, statusTone, runAnalysisHint, timeRange: timeRangeProp, onTimeRangeChange, viewTab: viewTabProp, onViewTabChange, isDarkTheme, className, seriesInitKey, toolbarStart, onEditCustomPerformance, showAddEditCustomDataButton, addEditCustomDataDisabled, tableFullWidth, hiddenSeries: hiddenSeriesProp, onToggleLegendSeries, onEnsureSeriesVisible, onHiddenSeriesChange, }: PerformanceChartProps): import("react/jsx-runtime").JSX.Element;
@@ -26,6 +26,7 @@ interface PerformanceTableProps {
26
26
  /** Last row with Add custom data (hidden when custom row already present); per-horizon + spaghetti. */
27
27
  showAddEditCustomDataButton?: boolean;
28
28
  addEditCustomDataDisabled?: boolean;
29
+ fullWidth?: boolean;
29
30
  }
30
- export declare function PerformanceTable({ forecastModels, adjustParameters, onAdjustParametersChange, customPerformance, onEditCustomPerformance, showAddEditCustomDataButton, addEditCustomDataDisabled, }: PerformanceTableProps): import("react/jsx-runtime").JSX.Element;
31
+ export declare function PerformanceTable({ forecastModels, adjustParameters, onAdjustParametersChange, customPerformance, onEditCustomPerformance, showAddEditCustomDataButton, addEditCustomDataDisabled, fullWidth, }: PerformanceTableProps): import("react/jsx-runtime").JSX.Element;
31
32
  export {};
@@ -0,0 +1 @@
1
+ export default function FormPage(): import("react/jsx-runtime").JSX.Element;
@@ -35,6 +35,7 @@ export * from './components/ui/DropZone/DropZone';
35
35
  export * from './components/ui/FileChip';
36
36
  export * from './components/ui/FlickeringGrid';
37
37
  export * from './components/ui/Foldable';
38
+ export * from './components/ui/Form';
38
39
  export * from './components/ui/Gap/Gap';
39
40
  export * from './components/ui/GridLayout/GridLayout';
40
41
  export * from './components/ui/Image';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sybilion/uilib",
3
- "version": "1.4.15",
3
+ "version": "1.4.17",
4
4
  "description": "Sybilion Design System — React UI components (Webpack + Stylus)",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -125,11 +125,14 @@
125
125
  },
126
126
  "peerDependencies": {
127
127
  "@auth0/auth0-react": "^2.3.1",
128
+ "@hookform/resolvers": "^5.0.0",
128
129
  "@sybilion/platform-sdk": ">=0.0.1",
129
130
  "react": ">=18.0.0",
130
131
  "react-dom": ">=18.0.0",
132
+ "react-hook-form": "^7.55.0",
131
133
  "react-router-dom": ">=6.0.0",
132
- "vite": "^6.0.0"
134
+ "vite": "^6.0.0",
135
+ "zod": "^4.0.0"
133
136
  },
134
137
  "peerDependenciesMeta": {
135
138
  "@auth0/auth0-react": {
@@ -147,6 +150,7 @@
147
150
  "@babel/core": "^7.20.12",
148
151
  "@babel/preset-typescript": "^7.21.0",
149
152
  "@homecode/ui": "^4.30.6",
153
+ "@hookform/resolvers": "^5.0.0",
150
154
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
151
155
  "@rollup/plugin-alias": "^6.0.0",
152
156
  "@rollup/plugin-commonjs": "^24.0.1",
@@ -187,6 +191,7 @@
187
191
  "prettier": "^3.6.2",
188
192
  "react": "^19.0.0",
189
193
  "react-dom": "^19.1.1",
194
+ "react-hook-form": "^7.55.0",
190
195
  "react-markdown": "^10.1.0",
191
196
  "react-refresh": "^0.17.0",
192
197
  "react-router-dom": "^6.28.0",
@@ -206,7 +211,8 @@
206
211
  "vite": "^6.0.0",
207
212
  "webpack": "^5.75.0",
208
213
  "webpack-cli": "^5.0.1",
209
- "webpack-dev-server": "^5.2.3"
214
+ "webpack-dev-server": "^5.2.3",
215
+ "zod": "^4.0.0"
210
216
  },
211
217
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
212
218
  }
@@ -25,6 +25,7 @@ export function AppHeaderHost({
25
25
  return (
26
26
  <header
27
27
  className={cn(S.root, sticky && S.sticky, className)}
28
+ data-sticky={sticky ? 'true' : 'false'}
28
29
  id={anchorId}
29
30
  />
30
31
  );
@@ -1,8 +1,9 @@
1
+ import cn from 'classnames';
2
+
1
3
  import { TrendingDown, TrendingUp } from 'lucide-react';
2
4
 
3
- import { ChipProps } from './Chip.types';
4
5
  import S from './Chip.styl';
5
- import cn from 'classnames';
6
+ import { ChipProps } from './Chip.types';
6
7
 
7
8
  function Chip({
8
9
  className,
@@ -15,7 +16,6 @@ function Chip({
15
16
  }: ChipProps) {
16
17
  const TrendIcon =
17
18
  trend === 'up' ? TrendingUp : trend === 'down' ? TrendingDown : null;
18
-
19
19
  return (
20
20
  <span
21
21
  data-slot="chip"
@@ -0,0 +1,29 @@
1
+ ---
2
+ summary: Validated forms via root Form with zod schema and inline field errors
3
+ ---
4
+
5
+ Root `<Form>` owns schema validation, default values, and submit handling — it wraps react-hook-form and zodResolver internally and renders the native `<form>` element. Pair field primitives with uilib controls for inline validation errors.
6
+
7
+ ## When to use
8
+
9
+ - Demo forms validated with a zod schema.
10
+ - Controls that need `Controller` wiring (Select, Checkbox, custom inputs).
11
+ - Inline field errors after submit or blur.
12
+
13
+ ## When not to use
14
+
15
+ - Simple label-plus-input rows without validation — use `LabeledInput`.
16
+ - Page-level or session errors — use `Banner`.
17
+ - Success or info feedback — use Sonner toasts, not field errors.
18
+
19
+ ## Do
20
+
21
+ - Pass `schema`, `defaultValues`, and `onSubmit` to the root `Form`.
22
+ - Wrap each control in `FormControl` inside `FormItem`.
23
+ - Show validation messages with `FormMessage`.
24
+
25
+ ## Don't
26
+
27
+ - Call `useForm` or `zodResolver` in page code — the root `Form` handles that.
28
+ - Use `toast.error` for field validation failures.
29
+ - Render manual error `<p>` elements outside `FormMessage`.
@@ -0,0 +1,193 @@
1
+ import { useState } from 'react';
2
+
3
+ import { Button } from '#uilib/components/ui/Button';
4
+ import { Checkbox } from '#uilib/components/ui/Checkbox';
5
+ import { Dialog } from '#uilib/components/ui/Dialog';
6
+ import { Input } from '#uilib/components/ui/Input';
7
+ import { PageContentSection } from '#uilib/components/ui/Page';
8
+ import {
9
+ Select,
10
+ SelectContent,
11
+ SelectItem,
12
+ SelectTrigger,
13
+ SelectValue,
14
+ } from '#uilib/components/ui/Select';
15
+ import { Switch } from '#uilib/components/ui/Switch';
16
+ import { z } from 'zod';
17
+
18
+ import {
19
+ Form,
20
+ FormControl,
21
+ FormField,
22
+ FormItem,
23
+ FormLabel,
24
+ FormMessage,
25
+ } from './Form';
26
+
27
+ const REGION_OPTIONS = [
28
+ { value: 'eu-west', label: 'EU West' },
29
+ { value: 'us-east', label: 'US East' },
30
+ { value: 'apac', label: 'APAC' },
31
+ ] as const;
32
+
33
+ const schema = z.object({
34
+ name: z.string().min(1, 'Enter a name.'),
35
+ notes: z.string().optional(),
36
+ region: z.string().min(1, 'Pick a region.'),
37
+ notifications: z.boolean(),
38
+ termsAccepted: z.boolean().refine(value => value, {
39
+ message: 'Accept the terms to continue.',
40
+ }),
41
+ });
42
+
43
+ type FormValues = z.infer<typeof schema>;
44
+
45
+ const defaultValues: FormValues = {
46
+ name: '',
47
+ notes: '',
48
+ region: '',
49
+ notifications: false,
50
+ termsAccepted: false,
51
+ };
52
+
53
+ export function FormExample() {
54
+ const [dialogOpen, setDialogOpen] = useState(false);
55
+ const [submittedValues, setSubmittedValues] = useState<FormValues | null>(
56
+ null,
57
+ );
58
+
59
+ const handleSubmit = (values: FormValues) => {
60
+ setSubmittedValues(values);
61
+ setDialogOpen(true);
62
+ };
63
+
64
+ return (
65
+ <PageContentSection>
66
+ <Form
67
+ schema={schema}
68
+ defaultValues={defaultValues}
69
+ onSubmit={handleSubmit}
70
+ style={{
71
+ display: 'flex',
72
+ flexDirection: 'column',
73
+ gap: '1.25rem',
74
+ width: '300px',
75
+ }}
76
+ >
77
+ <FormField
78
+ name="name"
79
+ render={({ field }) => (
80
+ <FormItem>
81
+ <FormLabel>Name</FormLabel>
82
+ <FormControl>
83
+ <Input placeholder="Your name" {...field} />
84
+ </FormControl>
85
+ <FormMessage />
86
+ </FormItem>
87
+ )}
88
+ />
89
+
90
+ <FormField
91
+ name="notes"
92
+ render={({ field }) => (
93
+ <FormItem>
94
+ <FormLabel>Notes</FormLabel>
95
+ <FormControl>
96
+ <Input
97
+ type="textarea"
98
+ placeholder="Optional notes"
99
+ {...field}
100
+ />
101
+ </FormControl>
102
+ <FormMessage />
103
+ </FormItem>
104
+ )}
105
+ />
106
+
107
+ <FormField
108
+ name="region"
109
+ render={({ field }) => (
110
+ <FormItem>
111
+ <FormLabel>Region</FormLabel>
112
+ <Select
113
+ onValueChange={field.onChange}
114
+ value={field.value || undefined}
115
+ >
116
+ <FormControl>
117
+ <SelectTrigger style={{ width: '100%' }}>
118
+ <SelectValue placeholder="Pick a region" />
119
+ </SelectTrigger>
120
+ </FormControl>
121
+ <SelectContent>
122
+ {REGION_OPTIONS.map(option => (
123
+ <SelectItem key={option.value} value={option.value}>
124
+ {option.label}
125
+ </SelectItem>
126
+ ))}
127
+ </SelectContent>
128
+ </Select>
129
+ <FormMessage />
130
+ </FormItem>
131
+ )}
132
+ />
133
+
134
+ <FormField
135
+ name="notifications"
136
+ render={({ field }) => (
137
+ <FormItem>
138
+ <FormLabel>Email notifications</FormLabel>
139
+ <FormControl>
140
+ <Switch
141
+ checked={field.value}
142
+ onCheckedChange={field.onChange}
143
+ />
144
+ </FormControl>
145
+ <FormMessage />
146
+ </FormItem>
147
+ )}
148
+ />
149
+
150
+ <FormField
151
+ name="termsAccepted"
152
+ render={({ field }) => (
153
+ <FormItem>
154
+ <FormLabel>Terms</FormLabel>
155
+ <FormControl>
156
+ <Checkbox
157
+ checked={field.value}
158
+ onCheckedChange={field.onChange}
159
+ />
160
+ </FormControl>
161
+ <FormMessage />
162
+ </FormItem>
163
+ )}
164
+ />
165
+
166
+ <Button type="submit">Submit</Button>
167
+ </Form>
168
+
169
+ <Dialog
170
+ open={dialogOpen}
171
+ onOpenChange={setDialogOpen}
172
+ title="Submitted values"
173
+ content={
174
+ <pre
175
+ style={{
176
+ margin: 0,
177
+ whiteSpace: 'pre-wrap',
178
+ fontFamily: 'var(--font-mono, monospace)',
179
+ fontSize: 'var(--text-sm)',
180
+ }}
181
+ >
182
+ {submittedValues ? JSON.stringify(submittedValues, null, 2) : ''}
183
+ </pre>
184
+ }
185
+ footer={
186
+ <Button type="button" onClick={() => setDialogOpen(false)}>
187
+ Close
188
+ </Button>
189
+ }
190
+ />
191
+ </PageContentSection>
192
+ );
193
+ }
@@ -0,0 +1,12 @@
1
+ .item
2
+ display flex
3
+ flex-direction column
4
+ gap var(--spacing-xs)
5
+
6
+ .message
7
+ font-size var(--text-sm)
8
+ color var(--destructive)
9
+
10
+ .description
11
+ font-size var(--text-sm)
12
+ color var(--muted-foreground)
@@ -0,0 +1,9 @@
1
+ // This file is automatically generated.
2
+ // Please do not change this file!
3
+ interface CssExports {
4
+ 'description': string;
5
+ 'item': string;
6
+ 'message': string;
7
+ }
8
+ export const cssExports: CssExports;
9
+ export default cssExports;
@@ -0,0 +1,231 @@
1
+ import cn from 'classnames';
2
+ import {
3
+ type ComponentProps,
4
+ type HTMLAttributes,
5
+ createContext,
6
+ useContext,
7
+ useId,
8
+ } from 'react';
9
+ import {
10
+ Controller,
11
+ type FieldPath,
12
+ type FieldValues,
13
+ FormProvider,
14
+ type Resolver,
15
+ type UseFormReturn,
16
+ useForm,
17
+ useFormContext,
18
+ useFormState,
19
+ } from 'react-hook-form';
20
+
21
+ import { Label } from '#uilib/components/ui/Label';
22
+ import { zodResolver } from '@hookform/resolvers/zod';
23
+ import { Slot } from '@radix-ui/react-slot';
24
+
25
+ import S from './Form.styl';
26
+ import type { FormFieldProps, FormProps } from './Form.types';
27
+
28
+ type FormFieldContextValue<
29
+ TFieldValues extends FieldValues = FieldValues,
30
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
31
+ > = {
32
+ name: TName;
33
+ };
34
+
35
+ const FormFieldContext = createContext<FormFieldContextValue | null>(null);
36
+
37
+ type FormItemContextValue = {
38
+ id: string;
39
+ };
40
+
41
+ const FormItemContext = createContext<FormItemContextValue | null>(null);
42
+
43
+ /**
44
+ * Root validated form. Owns `useForm`, applies `zodResolver(schema)` when `schema` is
45
+ * passed, and renders a native `<form>` wired to `onSubmit`. Wrap fields in {@link FormField}.
46
+ */
47
+ function Form<TFieldValues extends FieldValues>({
48
+ schema,
49
+ defaultValues,
50
+ onSubmit,
51
+ resolver,
52
+ formOptions,
53
+ form: externalForm,
54
+ className,
55
+ children,
56
+ ...formHTMLProps
57
+ }: FormProps<TFieldValues>) {
58
+ const internalForm = useForm<TFieldValues>({
59
+ defaultValues,
60
+ resolver:
61
+ resolver ??
62
+ (schema ? (zodResolver(schema) as Resolver<TFieldValues>) : undefined),
63
+ ...formOptions,
64
+ });
65
+
66
+ const methods: UseFormReturn<TFieldValues> = externalForm ?? internalForm;
67
+
68
+ return (
69
+ <FormProvider {...methods}>
70
+ <form
71
+ data-slot="form"
72
+ className={cn(className)}
73
+ onSubmit={methods.handleSubmit(onSubmit)}
74
+ {...formHTMLProps}
75
+ >
76
+ {children}
77
+ </form>
78
+ </FormProvider>
79
+ );
80
+ }
81
+
82
+ /**
83
+ * Connects a field to react-hook-form via `Controller`. Reads `control` from the nearest
84
+ * {@link Form} context — do not pass `control` manually. Must wrap {@link FormItem} inside `render`.
85
+ */
86
+ function FormField<
87
+ TFieldValues extends FieldValues = FieldValues,
88
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
89
+ >({ ...props }: FormFieldProps<TFieldValues, TName>) {
90
+ const { control } = useFormContext<TFieldValues>();
91
+
92
+ return (
93
+ <FormFieldContext.Provider value={{ name: props.name }}>
94
+ <Controller {...props} control={control} />
95
+ </FormFieldContext.Provider>
96
+ );
97
+ }
98
+
99
+ /** Vertical field shell; generates stable ids for label, control, description, and message. */
100
+ function FormItem({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
101
+ const id = useId();
102
+
103
+ return (
104
+ <FormItemContext.Provider value={{ id }}>
105
+ <div data-slot="form-item" className={cn(S.item, className)} {...props} />
106
+ </FormItemContext.Provider>
107
+ );
108
+ }
109
+
110
+ /**
111
+ * Field metadata for {@link FormLabel}, {@link FormControl}, {@link FormDescription}, and
112
+ * {@link FormMessage}. Requires {@link FormField} + {@link FormItem} ancestors.
113
+ */
114
+ function useFormField() {
115
+ const fieldContext = useContext(FormFieldContext);
116
+ const itemContext = useContext(FormItemContext);
117
+ const { getFieldState, control } = useFormContext();
118
+ const formState = useFormState({ control, name: fieldContext?.name });
119
+ const fieldState = getFieldState(fieldContext?.name ?? '', formState);
120
+
121
+ if (!fieldContext) {
122
+ throw new Error('useFormField should be used within <FormField>');
123
+ }
124
+
125
+ if (!itemContext) {
126
+ throw new Error('useFormField should be used within <FormItem>');
127
+ }
128
+
129
+ const { id } = itemContext;
130
+
131
+ return {
132
+ id,
133
+ name: fieldContext.name,
134
+ formItemId: `${id}-form-item`,
135
+ formDescriptionId: `${id}-form-item-description`,
136
+ formMessageId: `${id}-form-item-message`,
137
+ ...fieldState,
138
+ };
139
+ }
140
+
141
+ /** Accessible label linked to the control id from {@link FormItem}. */
142
+ function FormLabel({ className, ...props }: ComponentProps<typeof Label>) {
143
+ const { formItemId } = useFormField();
144
+
145
+ return (
146
+ <Label
147
+ data-slot="form-label"
148
+ className={cn(className)}
149
+ htmlFor={formItemId}
150
+ {...props}
151
+ />
152
+ );
153
+ }
154
+
155
+ /**
156
+ * Slot wrapper for the actual input. Forwards `id`, `aria-invalid`, and `aria-describedby`
157
+ * so uilib controls show validation styling (P-07 inline errors).
158
+ */
159
+ function FormControl({ ...props }: ComponentProps<typeof Slot>) {
160
+ const { error, formItemId, formDescriptionId, formMessageId } =
161
+ useFormField();
162
+
163
+ return (
164
+ <Slot
165
+ data-slot="form-control"
166
+ id={formItemId}
167
+ aria-describedby={
168
+ error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId
169
+ }
170
+ aria-invalid={!!error}
171
+ {...props}
172
+ />
173
+ );
174
+ }
175
+
176
+ /** Optional helper text below the label; referenced by `aria-describedby` on {@link FormControl}. */
177
+ function FormDescription({
178
+ className,
179
+ ...props
180
+ }: HTMLAttributes<HTMLParagraphElement>) {
181
+ const { formDescriptionId } = useFormField();
182
+
183
+ return (
184
+ <p
185
+ data-slot="form-description"
186
+ id={formDescriptionId}
187
+ className={cn(S.description, className)}
188
+ {...props}
189
+ />
190
+ );
191
+ }
192
+
193
+ /**
194
+ * Inline validation message (`role="alert"`). Shows `fieldState.error.message` when present;
195
+ * omit for empty fields — never use toast for field errors.
196
+ */
197
+ function FormMessage({
198
+ className,
199
+ children,
200
+ ...props
201
+ }: HTMLAttributes<HTMLParagraphElement>) {
202
+ const { error, formMessageId } = useFormField();
203
+ const body = error ? String(error?.message ?? '') : children;
204
+
205
+ if (!body) {
206
+ return null;
207
+ }
208
+
209
+ return (
210
+ <p
211
+ data-slot="form-message"
212
+ id={formMessageId}
213
+ role="alert"
214
+ className={cn(S.message, className)}
215
+ {...props}
216
+ >
217
+ {body}
218
+ </p>
219
+ );
220
+ }
221
+
222
+ export {
223
+ Form,
224
+ FormControl,
225
+ FormDescription,
226
+ FormField,
227
+ FormItem,
228
+ FormLabel,
229
+ FormMessage,
230
+ useFormField,
231
+ };
@@ -0,0 +1,32 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import type {
3
+ ControllerProps,
4
+ DefaultValues,
5
+ FieldPath,
6
+ FieldValues,
7
+ Resolver,
8
+ SubmitHandler,
9
+ UseFormProps,
10
+ UseFormReturn,
11
+ } from 'react-hook-form';
12
+
13
+ import type { z } from 'zod';
14
+
15
+ export type FormProps<TFieldValues extends FieldValues = FieldValues> = Omit<
16
+ ComponentPropsWithoutRef<'form'>,
17
+ 'onSubmit' | 'children'
18
+ > & {
19
+ schema?: z.ZodType<TFieldValues>;
20
+ defaultValues?: DefaultValues<TFieldValues>;
21
+ onSubmit: SubmitHandler<TFieldValues>;
22
+ resolver?: Resolver<TFieldValues>;
23
+ formOptions?: Omit<UseFormProps<TFieldValues>, 'defaultValues' | 'resolver'>;
24
+ form?: UseFormReturn<TFieldValues>;
25
+ children?: ReactNode;
26
+ className?: string;
27
+ };
28
+
29
+ export type FormFieldProps<
30
+ TFieldValues extends FieldValues = FieldValues,
31
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
32
+ > = Omit<ControllerProps<TFieldValues, TName>, 'control'>;
@@ -0,0 +1,11 @@
1
+ export {
2
+ Form,
3
+ FormControl,
4
+ FormDescription,
5
+ FormField,
6
+ FormItem,
7
+ FormLabel,
8
+ FormMessage,
9
+ useFormField,
10
+ } from './Form';
11
+ export type { FormFieldProps, FormProps } from './Form.types';
@@ -1,23 +1,23 @@
1
- import cn from 'classnames';
2
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
-
4
- import { WorldMap } from '#uilib/components/ui/WorldMap';
5
- import useEvent from '#uilib/hooks/useEvent';
6
- import { Shimmer } from '@homecode/ui';
7
-
8
1
  import { BadgeSize, DriverIcon } from './DriverIcon/DriverIcon';
9
- import constants from './DriverIcon/DriverIcon.constants.json';
10
2
  import {
11
3
  calculateBadgeSizes,
12
4
  findMostSpecificRegion,
13
5
  getDriverCoordinates,
14
6
  hasValidCoords,
15
7
  } from './DriverMap.helpers';
16
- import S from './DriverMap.styl';
8
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
9
+
17
10
  import type { DriverData } from './driverMapGeography';
11
+ import S from './DriverMap.styl';
12
+ import { Shimmer } from '@homecode/ui';
13
+ import { WorldMap } from '#uilib/components/ui/WorldMap';
14
+ import cn from 'classnames';
15
+ import constants from './DriverIcon/DriverIcon.constants.json';
18
16
  import { getHighestImportanceDriver } from './driverMapSelection';
17
+ import useEvent from '#uilib/hooks/useEvent';
19
18
 
20
19
  export interface DriverMapProps {
20
+ className?: string;
21
21
  drivers: DriverData[];
22
22
  isLoading: boolean;
23
23
  setSelectedDriver: (driver: DriverData) => void;
@@ -29,6 +29,7 @@ const delay = (ms: number) => new Promise<void>(r => setTimeout(r, ms));
29
29
  const transitionDelay = () => delay(constants.FADE_DURATION);
30
30
 
31
31
  export function DriverMap({
32
+ className,
32
33
  drivers,
33
34
  isLoading,
34
35
  setSelectedDriver,
@@ -168,7 +169,7 @@ export function DriverMap({
168
169
  });
169
170
 
170
171
  return (
171
- <div className={cn(S.root, isTransitioning && S.inTransition)}>
172
+ <div className={cn(S.root, isTransitioning && S.inTransition, className)}>
172
173
  <div className={S.mapInner}>
173
174
  <WorldMap className={S.mapWorld} />
174
175
  {isLoading && <Shimmer className={S.shimmerOverlay} size="l" />}
@@ -147,6 +147,7 @@ export type PerformanceChartProps = {
147
147
  onEditCustomPerformance?: () => void;
148
148
  showAddEditCustomDataButton?: boolean;
149
149
  addEditCustomDataDisabled?: boolean;
150
+ tableFullWidth?: boolean;
150
151
 
151
152
  hiddenSeries?: Set<string>;
152
153
  onToggleLegendSeries?: (key: string) => void;
@@ -193,6 +194,7 @@ export function PerformanceChart({
193
194
  onEditCustomPerformance,
194
195
  showAddEditCustomDataButton = false,
195
196
  addEditCustomDataDisabled = false,
197
+ tableFullWidth,
196
198
 
197
199
  hiddenSeries: hiddenSeriesProp,
198
200
  onToggleLegendSeries,
@@ -1262,6 +1264,7 @@ export function PerformanceChart({
1262
1264
  onEditCustomPerformance={onEditCustomPerformance}
1263
1265
  showAddEditCustomDataButton={showAddEditCustomDataButton}
1264
1266
  addEditCustomDataDisabled={addEditCustomDataDisabled}
1267
+ fullWidth={tableFullWidth}
1265
1268
  />
1266
1269
  )}
1267
1270
  </Tabs>
@@ -87,6 +87,7 @@ interface PerformanceTableProps {
87
87
  /** Last row with Add custom data (hidden when custom row already present); per-horizon + spaghetti. */
88
88
  showAddEditCustomDataButton?: boolean;
89
89
  addEditCustomDataDisabled?: boolean;
90
+ fullWidth?: boolean;
90
91
  }
91
92
 
92
93
  // Calculate color for a model key
@@ -103,6 +104,7 @@ export function PerformanceTable({
103
104
  onEditCustomPerformance,
104
105
  showAddEditCustomDataButton = false,
105
106
  addEditCustomDataDisabled = false,
107
+ fullWidth = true,
106
108
  }: PerformanceTableProps) {
107
109
  // Separate Sybilion AI model from drift model
108
110
  const { sybilionModel, driftModel } = useMemo(() => {
@@ -197,7 +199,7 @@ export function PerformanceTable({
197
199
  <div className={S.tableWrapper}>
198
200
  <PageXScroll
199
201
  size="md"
200
- fullWidth
202
+ fullWidth={fullWidth}
201
203
  innerClassName={S.tableContainer}
202
204
  scrollbarClassName={S.scrollbar}
203
205
  >
@@ -28,9 +28,14 @@
28
28
  @media (max-width MOBILE)
29
29
  left 22px
30
30
 
31
- // Top-level shell: offset logo into sidebar column (same math as nested embed, but absolute — not fixed).
31
+ // Top-level shell + expanded sidebar: fixed logo when header scrolls; absolute when header is sticky.
32
32
  @media (min-width MOBILE)
33
- :global([data-slot='sidebar-wrapper'][data-state='expanded']:not([data-slot='app-shell'] [data-slot='sidebar-wrapper']) [data-slot='app-shell']:not([data-slot='app-shell'] [data-slot='app-shell'])) &:global(:not([data-slot='app-shell'] [data-slot='app-shell'] *))
33
+ :global([data-slot='sidebar-wrapper'][data-state='expanded']:not([data-slot='app-shell'] [data-slot='sidebar-wrapper']) [data-slot='app-shell']:not([data-slot='app-shell'] [data-slot='app-shell'])) :global(header[data-sticky='false']) &:global(:not([data-slot='app-shell'] [data-slot='app-shell'] *))
34
+ position fixed
35
+ left 52px
36
+ top calc(22px + var(--app-banner-height, 0px))
37
+
38
+ :global([data-slot='sidebar-wrapper'][data-state='expanded']:not([data-slot='app-shell'] [data-slot='sidebar-wrapper']) [data-slot='app-shell']:not([data-slot='app-shell'] [data-slot='app-shell'])) :global(header[data-sticky='true']) &:global(:not([data-slot='app-shell'] [data-slot='app-shell'] *))
34
39
  position absolute
35
40
  left calc(-1 * var(--sidebar-width) + 52px)
36
41
 
@@ -1,5 +1,12 @@
1
- import cn from 'classnames';
2
- import { useState } from 'react';
1
+ import {
2
+ AppBanner,
3
+ AppShell,
4
+ AppShellMainContent,
5
+ } from '#uilib/components/ui/Page';
6
+ import {
7
+ DOCS_CHAT_USER_KEY,
8
+ DOCS_SIDEBAR_WIDTH_LS_KEY,
9
+ } from '../docsConstants';
3
10
  import {
4
11
  Link,
5
12
  Navigate,
@@ -12,28 +19,20 @@ import {
12
19
 
13
20
  import { AppHeaderHost } from '#uilib/components/ui/AppHeader';
14
21
  import { Button } from '#uilib/components/ui/Button';
22
+ import { ChatProvider } from '#uilib/contexts/chat-context';
23
+ import type { ChatResponse } from '#uilib/types/chat-api.types';
24
+ import { DOC_DEFAULT_SLUG } from '../registry';
25
+ import { DocPage } from '../DocPage';
26
+ import { DocsSidebar } from '#uilib/docs/components/DocsSidebar/DocsSidebar';
15
27
  import { Logo } from '#uilib/components/ui/Logo';
16
- import {
17
- AppBanner,
18
- AppShell,
19
- AppShellMainContent,
20
- } from '#uilib/components/ui/Page';
21
28
  import { PageFooter } from '#uilib/components/ui/Page/PageFooter/PageFooter';
22
29
  import { PageScroll } from '#uilib/components/ui/Page/PageScroll/PageScroll';
30
+ import S from '../DocsShell.styl';
23
31
  import { SidebarProvider } from '#uilib/components/ui/Sidebar/Sidebar';
24
32
  import { SybilionAppHeader } from '#uilib/components/widgets/SybilionAppHeader';
25
- import { ChatProvider } from '#uilib/contexts/chat-context';
26
- import { DocsSidebar } from '#uilib/docs/components/DocsSidebar/DocsSidebar';
27
- import type { ChatResponse } from '#uilib/types/chat-api.types';
28
-
29
- import { DocPage } from '../DocPage';
30
- import S from '../DocsShell.styl';
31
- import {
32
- DOCS_CHAT_USER_KEY,
33
- DOCS_SIDEBAR_WIDTH_LS_KEY,
34
- } from '../docsConstants';
35
- import { DOC_DEFAULT_SLUG } from '../registry';
36
33
  import { ThemeToggle } from './ThemeToggle';
34
+ import cn from 'classnames';
35
+ import { useState } from 'react';
37
36
 
38
37
  async function mockDocsSendChatMessage(
39
38
  message: string,
@@ -0,0 +1,21 @@
1
+ import FormGuidance from '#uilib/components/ui/Form/AGENT.md';
2
+ import { FormExample } from '#uilib/components/ui/Form/Form.example';
3
+
4
+ import { AppPageHeader } from '../components/AppPageHeader/AppPageHeader';
5
+ import { DocsGuidance } from '../components/DocsGuidance/DocsGuidance';
6
+ import { DocsHeaderActions } from '../docsHeaderActions';
7
+
8
+ export default function FormPage() {
9
+ return (
10
+ <>
11
+ <AppPageHeader
12
+ breadcrumbs={[{ label: 'Form' }]}
13
+ title="Form"
14
+ subheader="Validated forms with react-hook-form and zod."
15
+ actions={<DocsHeaderActions />}
16
+ />
17
+ <DocsGuidance source={FormGuidance} />
18
+ <FormExample />
19
+ </>
20
+ );
21
+ }
@@ -278,6 +278,12 @@ export const DOC_REGISTRY: DocEntry[] = [
278
278
  section: 'Layout',
279
279
  load: () => import('./pages/FoldablePage'),
280
280
  },
281
+ {
282
+ slug: 'form',
283
+ title: 'Form',
284
+ section: 'Forms',
285
+ load: () => import('./pages/FormPage'),
286
+ },
281
287
  {
282
288
  slug: 'grid-layout',
283
289
  title: 'GridLayout',
package/src/index.ts CHANGED
@@ -40,6 +40,7 @@ export * from './components/ui/DropZone/DropZone';
40
40
  export * from './components/ui/FileChip';
41
41
  export * from './components/ui/FlickeringGrid';
42
42
  export * from './components/ui/Foldable';
43
+ export * from './components/ui/Form';
43
44
  export * from './components/ui/Gap/Gap';
44
45
  export * from './components/ui/GridLayout/GridLayout';
45
46
  export * from './components/ui/Image';