@sybilion/uilib 1.4.16 → 1.4.18
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/agent-glossary/workspace.generated.ts +1 -0
- package/dist/agent-glossary/workspace.index.md +1 -0
- package/dist/agent-glossary/workspace.md +1 -0
- package/dist/esm/components/ui/AppHeader/AppHeader.js +1 -1
- package/dist/esm/components/ui/Chip/Chip.js +1 -1
- package/dist/esm/components/ui/Form/Form.js +96 -0
- package/dist/esm/components/ui/Form/Form.styl.js +7 -0
- package/dist/esm/components/widgets/DriversComparisonChart/DriversComparisonChart.js +5 -18
- package/dist/esm/components/widgets/DriversComparisonChart/DriversComparisonChart.styl.js +1 -1
- package/dist/esm/components/widgets/DriversComparisonChart/driversComparisonChart.helpers.js +22 -5
- package/dist/esm/components/widgets/SybilionAppHeader/SybilionAppHeader.styl.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/types/src/components/ui/Form/Form.d.ts +48 -0
- package/dist/esm/types/src/components/ui/Form/Form.example.d.ts +1 -0
- package/dist/esm/types/src/components/ui/Form/Form.types.d.ts +14 -0
- package/dist/esm/types/src/components/ui/Form/index.d.ts +2 -0
- package/dist/esm/types/src/components/widgets/DriversComparisonChart/driversComparisonChart.helpers.d.ts +10 -0
- package/dist/esm/types/src/docs/pages/FormPage.d.ts +1 -0
- package/dist/esm/types/src/index.d.ts +1 -0
- package/dist/esm/types/tests/form.test.d.ts +1 -0
- package/package.json +9 -3
- package/src/components/ui/AppHeader/AppHeader.tsx +1 -0
- package/src/components/ui/Chip/Chip.tsx +3 -3
- package/src/components/ui/Form/AGENT.md +29 -0
- package/src/components/ui/Form/Form.example.tsx +193 -0
- package/src/components/ui/Form/Form.styl +12 -0
- package/src/components/ui/Form/Form.styl.d.ts +9 -0
- package/src/components/ui/Form/Form.tsx +231 -0
- package/src/components/ui/Form/Form.types.ts +32 -0
- package/src/components/ui/Form/index.ts +11 -0
- package/src/components/widgets/DriversComparisonChart/DriversComparisonChart.styl +4 -4
- package/src/components/widgets/DriversComparisonChart/DriversComparisonChart.tsx +21 -37
- package/src/components/widgets/DriversComparisonChart/driversComparisonChart.helpers.test.ts +49 -0
- package/src/components/widgets/DriversComparisonChart/driversComparisonChart.helpers.ts +40 -9
- package/src/components/widgets/SybilionAppHeader/SybilionAppHeader.styl +7 -2
- package/src/docs/App/App.tsx +17 -18
- package/src/docs/pages/FormPage.tsx +21 -0
- package/src/docs/registry.ts +6 -0
- package/src/index.ts +1 -0
|
@@ -21,6 +21,45 @@ export function formatSeriesImportance(value: number | null): string {
|
|
|
21
21
|
return `${value.toFixed(1)}%`;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
function driverImportanceSortKey(
|
|
25
|
+
importance: number | null | undefined,
|
|
26
|
+
): number {
|
|
27
|
+
return typeof importance === 'number' && Number.isFinite(importance)
|
|
28
|
+
? importance
|
|
29
|
+
: -Infinity;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Higher importance first; ties broken by driver id for stable ordering. */
|
|
33
|
+
export function compareDriversByImportance<
|
|
34
|
+
T extends { id?: string | number; importance?: number | null },
|
|
35
|
+
>(a: T, b: T): number {
|
|
36
|
+
const importanceDelta =
|
|
37
|
+
driverImportanceSortKey(b.importance) -
|
|
38
|
+
driverImportanceSortKey(a.importance);
|
|
39
|
+
if (importanceDelta !== 0) return importanceDelta;
|
|
40
|
+
return String(a.id).localeCompare(String(b.id));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function sortDriversByImportance<
|
|
44
|
+
T extends { id?: string | number; importance?: number | null },
|
|
45
|
+
>(drivers: T[]): T[] {
|
|
46
|
+
return [...drivers].sort(compareDriversByImportance);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function getDriversWithDataSortedByImportance(
|
|
50
|
+
drivers: BacktestsComponentPayload['drivers'] | undefined,
|
|
51
|
+
): NonNullable<BacktestsComponentPayload['drivers']> {
|
|
52
|
+
return sortDriversByImportance(
|
|
53
|
+
(drivers ?? []).filter(
|
|
54
|
+
d =>
|
|
55
|
+
d.normalized_series &&
|
|
56
|
+
Object.keys(d.normalized_series).some(
|
|
57
|
+
key => d.normalized_series![key] != null,
|
|
58
|
+
),
|
|
59
|
+
),
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
24
63
|
export function resolveDriverLagLabel(driver: {
|
|
25
64
|
lag?: string | null;
|
|
26
65
|
overall_lag?: string | null;
|
|
@@ -165,15 +204,7 @@ export function mergeBacktestsChartData(
|
|
|
165
204
|
});
|
|
166
205
|
|
|
167
206
|
if (payload.drivers?.length) {
|
|
168
|
-
const sorted =
|
|
169
|
-
.filter(
|
|
170
|
-
d =>
|
|
171
|
-
d.normalized_series &&
|
|
172
|
-
Object.keys(d.normalized_series).some(
|
|
173
|
-
key => d.normalized_series![key] != null,
|
|
174
|
-
),
|
|
175
|
-
)
|
|
176
|
-
.sort((a, b) => String(a.id).localeCompare(String(b.id)));
|
|
207
|
+
const sorted = getDriversWithDataSortedByImportance(payload.drivers);
|
|
177
208
|
|
|
178
209
|
sorted.forEach((driver, idx) => {
|
|
179
210
|
const fid = DRIVER_FORECAST_ID_BASE + idx;
|
|
@@ -28,9 +28,14 @@
|
|
|
28
28
|
@media (max-width MOBILE)
|
|
29
29
|
left 22px
|
|
30
30
|
|
|
31
|
-
// Top-level shell
|
|
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
|
|
package/src/docs/App/App.tsx
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
}
|
package/src/docs/registry.ts
CHANGED
|
@@ -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';
|