@sybilion/uilib 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +8 -8
  2. package/assets/{mini-app-global.css → standalone-global.css} +1 -1
  3. package/dist/esm/components/ui/Sidebar/Sidebar.styl.js +2 -2
  4. package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.js +48 -0
  5. package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.styl.js +7 -0
  6. package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/groupSidebarDatasets.js +38 -0
  7. package/dist/esm/index.js +5 -5
  8. package/dist/esm/sybilion-auth/SybilionAuthProvider.js +185 -0
  9. package/dist/esm/sybilion-auth/authPaths.js +7 -0
  10. package/dist/esm/sybilion-auth/exchangeSybilionToken.js +40 -0
  11. package/dist/esm/types/src/components/ui/Input/Input.d.ts +1 -1
  12. package/dist/esm/types/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.d.ts +11 -0
  13. package/dist/esm/types/src/components/widgets/SidebarDatasetsItemsGrouped/groupSidebarDatasets.d.ts +8 -0
  14. package/dist/esm/types/src/components/widgets/SidebarDatasetsItemsGrouped/index.d.ts +3 -0
  15. package/dist/esm/types/src/docs/pages/SidebarDatasetsItemsGroupedPage.d.ts +1 -0
  16. package/dist/esm/types/src/docs/pages/SybilionAuthProviderPage.d.ts +1 -0
  17. package/dist/esm/types/src/index.d.ts +3 -1
  18. package/dist/esm/types/src/sybilion-auth/SybilionAuthProvider.d.ts +39 -0
  19. package/dist/esm/types/src/sybilion-auth/authPaths.d.ts +3 -0
  20. package/dist/esm/types/src/sybilion-auth/exchangeSybilionToken.d.ts +2 -0
  21. package/dist/esm/types/src/sybilion-auth/index.d.ts +4 -0
  22. package/dist/esm/types/src/{mini-app/miniAppDataTypes.d.ts → types/sybilionDatasetSnapshots.d.ts} +5 -8
  23. package/docs/standalone-apps.md +65 -0
  24. package/package.json +10 -3
  25. package/src/components/ui/Sidebar/Sidebar.styl +0 -25
  26. package/src/components/ui/Sidebar/Sidebar.styl.d.ts +0 -1
  27. package/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.styl +29 -0
  28. package/src/{mini-app/MiniAppRoot.styl.d.ts → components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.styl.d.ts} +4 -2
  29. package/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.tsx +128 -0
  30. package/src/components/widgets/SidebarDatasetsItemsGrouped/groupSidebarDatasets.ts +51 -0
  31. package/src/components/widgets/SidebarDatasetsItemsGrouped/index.ts +10 -0
  32. package/src/docs/pages/SidebarDatasetsItemsGroupedPage.tsx +136 -0
  33. package/src/docs/pages/SybilionAuthProviderPage.tsx +37 -0
  34. package/src/docs/registry.ts +9 -3
  35. package/src/index.ts +3 -1
  36. package/src/sybilion-auth/SybilionAuthProvider.tsx +322 -0
  37. package/src/sybilion-auth/authPaths.ts +6 -0
  38. package/src/sybilion-auth/exchangeSybilionToken.ts +47 -0
  39. package/src/sybilion-auth/index.ts +16 -0
  40. package/src/{mini-app/miniAppDataTypes.ts → types/sybilionDatasetSnapshots.ts} +5 -8
  41. package/dist/esm/mini-app/MiniAppRoot.js +0 -82
  42. package/dist/esm/mini-app/MiniAppRoot.styl.js +0 -7
  43. package/dist/esm/mini-app/miniAppChatBridge.js +0 -45
  44. package/dist/esm/mini-app/miniAppDataClient.js +0 -98
  45. package/dist/esm/mini-app/miniAppProtocol.js +0 -153
  46. package/dist/esm/mini-app/miniAppThemeConfig.js +0 -40
  47. package/dist/esm/types/src/docs/pages/MiniAppRootPage.d.ts +0 -1
  48. package/dist/esm/types/src/mini-app/MiniAppRoot.d.ts +0 -18
  49. package/dist/esm/types/src/mini-app/index.d.ts +0 -10
  50. package/dist/esm/types/src/mini-app/miniAppChatBridge.d.ts +0 -6
  51. package/dist/esm/types/src/mini-app/miniAppDataClient.d.ts +0 -16
  52. package/dist/esm/types/src/mini-app/miniAppProtocol.d.ts +0 -89
  53. package/dist/esm/types/src/mini-app/miniAppThemeConfig.d.ts +0 -3
  54. package/docs/workspace-mini-apps.md +0 -51
  55. package/src/docs/pages/MiniAppRootPage.tsx +0 -58
  56. package/src/mini-app/MiniAppRoot.styl +0 -24
  57. package/src/mini-app/MiniAppRoot.tsx +0 -150
  58. package/src/mini-app/index.ts +0 -43
  59. package/src/mini-app/miniAppChatBridge.ts +0 -55
  60. package/src/mini-app/miniAppDataClient.ts +0 -165
  61. package/src/mini-app/miniAppProtocol.ts +0 -247
  62. package/src/mini-app/miniAppThemeConfig.ts +0 -45
@@ -0,0 +1,65 @@
1
+ # Standalone Sybilion apps (@sybilion/uilib)
2
+
3
+ Greenfield SPA on **your own origin**: `@sybilion/uilib` for layout/UI, `**SybilionAuthProvider`\*\* + Sybilion API for data—no iframe in the main client.
4
+
5
+ **Agents / humans:** Use `AppShell` + `AppShellMainContent`; stick to uilib spacing primitives (no random root horizontal gutters).
6
+
7
+ ## 1. Dependencies and global CSS
8
+
9
+ ```bash
10
+ yarn add react react-dom react-router-dom @auth0/auth0-react @sybilion/uilib
11
+ ```
12
+
13
+ Import tokens/fonts once:
14
+
15
+ ```ts
16
+ import '@sybilion/uilib/standalone-global.css';
17
+ ```
18
+
19
+ ## 2. Layout (AppShell)
20
+
21
+ Pattern: `[src/docs/DocsShell.tsx](https://github.com/Mir-Insight/uilib/blob/main/src/docs/DocsShell.tsx)` — `PageScroll` → `AppShell` → sidebar → `AppShellMainContent` with `AppHeaderHost`, `PageFooter`, main content (`Outlet` / routes). Add `Theme` and optional `SidebarProvider` from `@homecode/ui`.
22
+
23
+ ## 3. Auth (`SybilionAuthProvider`)
24
+
25
+ Use inside `BrowserRouter` if redirects hit a callback route.
26
+
27
+ Env vars depend on bundler—for **Vite** only `import.meta.env.VITE_`\* is exposed client-side:
28
+
29
+ ```tsx
30
+ import { SybilionAuthProvider } from '@sybilion/uilib';
31
+
32
+ const apiBaseUrl = import.meta.env.VITE_SYBILION_API_BASE_URL as string;
33
+ const auth0Domain = import.meta.env.VITE_AUTH0_DOMAIN as string;
34
+ const auth0ClientId = import.meta.env.VITE_AUTH0_CLIENT_ID as string;
35
+
36
+ <SybilionAuthProvider
37
+ apiBaseUrl={apiBaseUrl}
38
+ auth0Domain={auth0Domain}
39
+ auth0ClientId={auth0ClientId}
40
+ redirectUri={window.location.origin}
41
+ >
42
+ <App />
43
+ </SybilionAuthProvider>;
44
+ ```
45
+
46
+ **Flow:** Auth0 SPA → `POST {apiBaseUrl}/v1/auth/login` with `{ identity: "<Auth0 AT>", type: "auth0" }` → Sybilion JWT in response (`data.token` or `token`) → Bearer on API calls.
47
+
48
+ **Defaults** for `authorizationParams` match sybilion-client (Management audience + `openid profile email offline_access …`); override if your Auth0 SPA needs a Resource Server audience (backend confirms).
49
+
50
+ | Layer | Configure |
51
+ | ---------------- | ------------------------------------------------------------------------------------- |
52
+ | **Auth0** | Callback, logout, and web origins → your URLs (+ previews). |
53
+ | **Sybilion API** | CORS → your deploy `Origin`. |
54
+ | **App** | `apiBaseUrl`, Auth0 `domain` / `clientId`, redirect usually `window.location.origin`. |
55
+
56
+ **Hooks:** `useSybilionAuth()`, `useSybilionApiFetch()` (or `createSybilionApiFetch` / `sybilionApiFetch` helpers).
57
+
58
+ ## 4. Data
59
+
60
+ Fetch Sybilion API with the JWT above—no host `postMessage` bridge.
61
+
62
+ ## Related
63
+
64
+ - [auth0-configuration-guide.md](https://github.com/Mir-Insight/sybilion-client/blob/main/docs/auth0-configuration-guide.md)
65
+ - [server-auth-verification.md](https://github.com/Mir-Insight/sybilion-client/blob/main/docs/server-auth-verification.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sybilion/uilib",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Sybilion Design System — React UI components (Webpack + Stylus)",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -30,7 +30,7 @@
30
30
  "default": "./src/index.ts"
31
31
  },
32
32
  "./src/*": "./src/*",
33
- "./mini-app-global.css": "./assets/mini-app-global.css"
33
+ "./standalone-global.css": "./assets/standalone-global.css"
34
34
  },
35
35
  "files": [
36
36
  "assets",
@@ -76,6 +76,7 @@
76
76
  },
77
77
  "homepage": "https://github.com/Mir-Insight/uilib#readme",
78
78
  "dependencies": {
79
+ "@homecode/ui": "^4.17.0",
79
80
  "@phosphor-icons/react": "^2.1.10",
80
81
  "@radix-ui/react-avatar": "^1.1.10",
81
82
  "@radix-ui/react-checkbox": "^1.3.3",
@@ -104,12 +105,18 @@
104
105
  "vaul": "^1.1.2"
105
106
  },
106
107
  "peerDependencies": {
107
- "@homecode/ui": ">=4.17.0",
108
+ "@auth0/auth0-react": "^2.3.1",
108
109
  "react": ">=18.0.0",
109
110
  "react-dom": ">=18.0.0",
110
111
  "react-router-dom": ">=6.0.0"
111
112
  },
113
+ "peerDependenciesMeta": {
114
+ "@auth0/auth0-react": {
115
+ "optional": true
116
+ }
117
+ },
112
118
  "devDependencies": {
119
+ "@auth0/auth0-react": "^2.3.1",
113
120
  "@babel/core": "^7.20.12",
114
121
  "@babel/preset-typescript": "^7.21.0",
115
122
  "@homecode/ui": "^4.30.6",
@@ -219,31 +219,6 @@
219
219
  padding 0
220
220
  padding-top 40px
221
221
 
222
- // Sidebar group label
223
- .sidebarGroupLabel
224
- color var(--sidebar-foreground)
225
- opacity 0.7
226
- display flex
227
- height 2rem
228
- flex-shrink 0
229
- align-items center
230
- border-radius 0.375rem
231
- padding-left 0.5rem
232
- padding-right 0.5rem
233
- font-size 0.75rem
234
- font-weight 500
235
- outline none
236
- transition margin 200ms ease-linear, opacity 200ms ease-linear
237
- &:focus-visible
238
- box-shadow 0 0 0 2px var(--sidebar-ring)
239
- & > svg
240
- width 1rem
241
- height 1rem
242
- flex-shrink 0
243
- &[data-collapsible="icon"]
244
- margin-top -2rem
245
- opacity 0
246
-
247
222
  // Sidebar group action
248
223
  .sidebarGroupAction
249
224
  color var(--sidebar-foreground)
@@ -11,7 +11,6 @@ interface CssExports {
11
11
  'sidebarFooter': string;
12
12
  'sidebarGroup': string;
13
13
  'sidebarGroupAction': string;
14
- 'sidebarGroupLabel': string;
15
14
  'sidebarHeader': string;
16
15
  'sidebarInput': string;
17
16
  'sidebarMainShell': string;
@@ -0,0 +1,29 @@
1
+ .chevronContainer
2
+ margin-left auto
3
+
4
+ .subMenuContainer
5
+ position relative
6
+
7
+ .subMenuBorder
8
+ position absolute
9
+ left var(--p-5)
10
+ top 0
11
+ bottom 26px
12
+ width 1px
13
+ background var(--sidebar-border)
14
+
15
+ .subMenuItem
16
+ position relative
17
+ margin-left var(--p-6)
18
+
19
+ &::before
20
+ content ''
21
+ position absolute
22
+ left calc(var(--p-1) * -1)
23
+ top var(--p-2)
24
+ bottom 0
25
+ width var(--p-3)
26
+ height var(--p-3)
27
+ border-left 1px solid var(--sidebar-border)
28
+ border-bottom 1px solid var(--sidebar-border)
29
+ border-bottom-left-radius var(--p-2)
@@ -1,8 +1,10 @@
1
1
  // This file is automatically generated.
2
2
  // Please do not change this file!
3
3
  interface CssExports {
4
- 'inner': string;
5
- 'root': string;
4
+ 'chevronContainer': string;
5
+ 'subMenuBorder': string;
6
+ 'subMenuContainer': string;
7
+ 'subMenuItem': string;
6
8
  }
7
9
  export const cssExports: CssExports;
8
10
  export default cssExports;
@@ -0,0 +1,128 @@
1
+ import { useEffect, useMemo, useState } from 'react';
2
+
3
+ import {
4
+ SidebarGroup,
5
+ SidebarMenu,
6
+ SidebarMenuButton,
7
+ SidebarMenuItem,
8
+ SidebarMenuSub,
9
+ SidebarMenuSubButton,
10
+ SidebarMenuSubItem,
11
+ } from '#uilib/components/ui/Sidebar/Sidebar';
12
+ import { SmartTextTruncate } from '#uilib/components/ui/SmartTextTruncate';
13
+ import { ChevronDown, ChevronRight, PackageOpen } from 'lucide-react';
14
+
15
+ import S from './SidebarDatasetsItemsGrouped.styl';
16
+ import {
17
+ type SidebarDatasetsItemsGroupBy,
18
+ type SidebarDatasetsItemsGroupedDataset,
19
+ groupSidebarDatasets,
20
+ } from './groupSidebarDatasets';
21
+
22
+ export type SidebarDatasetsItemsGroupedProps = {
23
+ groupBy: SidebarDatasetsItemsGroupBy;
24
+ datasets: SidebarDatasetsItemsGroupedDataset[];
25
+ selectedDatasetId?: number;
26
+ onDatasetClick?: (datasetId: number) => void;
27
+ /** When omitted, all groups start expanded. */
28
+ defaultExpandedGroupNames?: string[];
29
+ className?: string;
30
+ };
31
+
32
+ export function SidebarDatasetsItemsGrouped({
33
+ groupBy,
34
+ datasets,
35
+ selectedDatasetId,
36
+ onDatasetClick,
37
+ defaultExpandedGroupNames,
38
+ className,
39
+ }: SidebarDatasetsItemsGroupedProps) {
40
+ const grouped = useMemo(
41
+ () => groupSidebarDatasets(datasets, groupBy),
42
+ [datasets, groupBy],
43
+ );
44
+
45
+ const [expanded, setExpanded] = useState<Set<string>>(new Set());
46
+
47
+ useEffect(() => {
48
+ if (defaultExpandedGroupNames !== undefined) {
49
+ setExpanded(new Set(defaultExpandedGroupNames));
50
+ } else {
51
+ setExpanded(new Set(grouped.map(([name]) => name)));
52
+ }
53
+ }, [grouped, defaultExpandedGroupNames]);
54
+
55
+ useEffect(() => {
56
+ if (selectedDatasetId == null) return;
57
+ const groupName = grouped.find(([, ds]) =>
58
+ ds.some(d => d.id === selectedDatasetId),
59
+ )?.[0];
60
+ if (groupName) {
61
+ setExpanded(prev => new Set(prev).add(groupName));
62
+ }
63
+ }, [selectedDatasetId, grouped]);
64
+
65
+ const toggleGroup = (name: string) => {
66
+ setExpanded(prev => {
67
+ const next = new Set(prev);
68
+ if (next.has(name)) next.delete(name);
69
+ else next.add(name);
70
+ return next;
71
+ });
72
+ };
73
+
74
+ return (
75
+ <SidebarGroup className={className}>
76
+ <SidebarMenu>
77
+ {grouped.map(([groupName, groupDatasets]) => {
78
+ const isExpanded = expanded.has(groupName);
79
+ const parentActive = groupDatasets.some(
80
+ d => d.id === selectedDatasetId,
81
+ );
82
+
83
+ return (
84
+ <SidebarMenuItem key={groupName}>
85
+ <SidebarMenuButton
86
+ type="button"
87
+ isActive={parentActive}
88
+ onClick={() => toggleGroup(groupName)}
89
+ >
90
+ <PackageOpen strokeWidth={1.5} size={16} />
91
+ <SmartTextTruncate>{groupName}</SmartTextTruncate>
92
+ <div className={S.chevronContainer}>
93
+ {isExpanded ? (
94
+ <ChevronDown size={12} />
95
+ ) : (
96
+ <ChevronRight size={12} />
97
+ )}
98
+ </div>
99
+ </SidebarMenuButton>
100
+ {isExpanded && (
101
+ <SidebarMenuSub className={S.subMenuContainer}>
102
+ <div className={S.subMenuBorder} />
103
+ {groupDatasets.map(dataset => (
104
+ <SidebarMenuSubItem
105
+ key={dataset.id}
106
+ className={S.subMenuItem}
107
+ >
108
+ <SidebarMenuSubButton
109
+ href={`#dataset-${dataset.id}`}
110
+ isActive={dataset.id === selectedDatasetId}
111
+ onClick={e => {
112
+ e.preventDefault();
113
+ onDatasetClick?.(dataset.id);
114
+ }}
115
+ >
116
+ <SmartTextTruncate>{dataset.name}</SmartTextTruncate>
117
+ </SidebarMenuSubButton>
118
+ </SidebarMenuSubItem>
119
+ ))}
120
+ </SidebarMenuSub>
121
+ )}
122
+ </SidebarMenuItem>
123
+ );
124
+ })}
125
+ </SidebarMenu>
126
+ </SidebarGroup>
127
+ );
128
+ }
@@ -0,0 +1,51 @@
1
+ import type { SybilionDatasetSnapshot } from '#uilib/types/sybilionDatasetSnapshots';
2
+
3
+ export type SidebarDatasetsItemsGroupedDataset = SybilionDatasetSnapshot;
4
+
5
+ export type SidebarDatasetsItemsGroupBy =
6
+ | 'target_type'
7
+ | 'regions'
8
+ | 'categories';
9
+
10
+ export type GroupedSidebarDatasetsEntry = readonly [
11
+ groupName: string,
12
+ datasets: SidebarDatasetsItemsGroupedDataset[],
13
+ ];
14
+
15
+ export function groupSidebarDatasets(
16
+ datasets: SidebarDatasetsItemsGroupedDataset[],
17
+ groupBy: SidebarDatasetsItemsGroupBy,
18
+ ): GroupedSidebarDatasetsEntry[] {
19
+ const grouped: Record<string, SidebarDatasetsItemsGroupedDataset[]> = {};
20
+
21
+ datasets.forEach(dataset => {
22
+ if (groupBy === 'target_type') {
23
+ const key = dataset.target_type?.name || 'Unknown';
24
+ if (!grouped[key]) grouped[key] = [];
25
+ grouped[key].push(dataset);
26
+ } else if (groupBy === 'regions') {
27
+ if (dataset.regions && dataset.regions.length > 0) {
28
+ const mostSpecificRegion = dataset.regions[dataset.regions.length - 1];
29
+ const key = mostSpecificRegion.name || 'Unknown';
30
+ if (!grouped[key]) grouped[key] = [];
31
+ grouped[key].push(dataset);
32
+ } else {
33
+ const key = 'No Region';
34
+ if (!grouped[key]) grouped[key] = [];
35
+ grouped[key].push(dataset);
36
+ }
37
+ } else {
38
+ const key = dataset.category?.name || 'Unknown';
39
+ if (!grouped[key]) grouped[key] = [];
40
+ grouped[key].push(dataset);
41
+ }
42
+ });
43
+
44
+ return Object.entries(grouped)
45
+ .map(
46
+ ([name, ds]) =>
47
+ [name, [...ds].sort((a, b) => a.name.localeCompare(b.name))] as const,
48
+ )
49
+ .filter(([, ds]) => ds.length > 0)
50
+ .sort((a, b) => a[0].localeCompare(b[0]));
51
+ }
@@ -0,0 +1,10 @@
1
+ export {
2
+ SidebarDatasetsItemsGrouped,
3
+ type SidebarDatasetsItemsGroupedProps,
4
+ } from './SidebarDatasetsItemsGrouped';
5
+ export type {
6
+ GroupedSidebarDatasetsEntry,
7
+ SidebarDatasetsItemsGroupBy,
8
+ SidebarDatasetsItemsGroupedDataset,
9
+ } from './groupSidebarDatasets';
10
+ export { groupSidebarDatasets } from './groupSidebarDatasets';
@@ -0,0 +1,136 @@
1
+ import { useState } from 'react';
2
+
3
+ import { PageContentSection } from '#uilib/components/ui/Page';
4
+ import { ToggleGroup, ToggleGroupItem } from '#uilib/components/ui/ToggleGroup';
5
+ import {
6
+ type SidebarDatasetsItemsGroupBy,
7
+ SidebarDatasetsItemsGrouped,
8
+ type SidebarDatasetsItemsGroupedDataset,
9
+ } from '#uilib/components/widgets/SidebarDatasetsItemsGrouped';
10
+
11
+ import { AppPageHeader } from '../components/AppPageHeader/AppPageHeader';
12
+ import { DocsHeaderActions } from '../docsHeaderActions';
13
+
14
+ const MOCK_DATASETS: SidebarDatasetsItemsGroupedDataset[] = [
15
+ {
16
+ id: 1,
17
+ name: 'Acetic Acid Price - China - Dollar/MT',
18
+ status: 'active',
19
+ created_at: '2024-01-01',
20
+ updated_at: '2024-01-02',
21
+ keywords: '',
22
+ category: { id: 10, name: 'Chemicals' },
23
+ target_type_id: 1,
24
+ target_type: { id: 1, name: 'Commodity price' },
25
+ trend: 0,
26
+ regular_price: '0',
27
+ sale_price: '0',
28
+ regions: [
29
+ { id: 1, name: 'Asia' },
30
+ { id: 2, name: 'China' },
31
+ ],
32
+ unit: { id: 1, name: 'USD/MT' },
33
+ },
34
+ {
35
+ id: 2,
36
+ name: 'Freight index — spot volume (China)',
37
+ status: 'active',
38
+ created_at: '2024-01-01',
39
+ updated_at: '2024-01-02',
40
+ keywords: '',
41
+ category: { id: 10, name: 'Chemicals' },
42
+ target_type_id: 2,
43
+ target_type: { id: 2, name: 'Freight index' },
44
+ trend: 0,
45
+ regular_price: '0',
46
+ sale_price: '0',
47
+ regions: [
48
+ { id: 1, name: 'Asia' },
49
+ { id: 2, name: 'China' },
50
+ ],
51
+ unit: { id: 1, name: 'Index' },
52
+ },
53
+ {
54
+ id: 3,
55
+ name: 'Generic industrial chemical — spot volume (Germany)',
56
+ status: 'active',
57
+ created_at: '2024-01-01',
58
+ updated_at: '2024-01-02',
59
+ keywords: '',
60
+ category: { id: 10, name: 'Chemicals' },
61
+ target_type_id: 1,
62
+ target_type: { id: 1, name: 'Commodity price' },
63
+ trend: 0,
64
+ regular_price: '0',
65
+ sale_price: '0',
66
+ regions: [
67
+ { id: 3, name: 'Europe' },
68
+ { id: 4, name: 'Germany' },
69
+ ],
70
+ unit: { id: 1, name: 'MT' },
71
+ },
72
+ {
73
+ id: 4,
74
+ name: 'Ethanol Price Europe Per Kg In USD',
75
+ status: 'active',
76
+ created_at: '2024-01-01',
77
+ updated_at: '2024-01-02',
78
+ keywords: '',
79
+ category: { id: 11, name: 'Energy' },
80
+ target_type_id: 1,
81
+ target_type: { id: 1, name: 'Commodity price' },
82
+ trend: 0,
83
+ regular_price: '0',
84
+ sale_price: '0',
85
+ regions: [{ id: 5, name: 'Europe' }],
86
+ unit: { id: 1, name: 'USD/kg' },
87
+ },
88
+ ];
89
+
90
+ export default function SidebarDatasetsItemsGroupedPage() {
91
+ const [groupBy, setGroupBy] =
92
+ useState<SidebarDatasetsItemsGroupBy>('regions');
93
+ const [selectedDatasetId, setSelectedDatasetId] = useState<number>(1);
94
+
95
+ return (
96
+ <>
97
+ <AppPageHeader
98
+ breadcrumbs={[{ label: 'SidebarDatasetsItemsGrouped' }]}
99
+ title="SidebarDatasetsItemsGrouped"
100
+ subheader="Datasets sidebar: collapsible groups and nested rows."
101
+ actions={<DocsHeaderActions />}
102
+ />
103
+ <PageContentSection>
104
+ <ToggleGroup
105
+ type="single"
106
+ value={groupBy}
107
+ onValueChange={val => {
108
+ if (val) setGroupBy(val as SidebarDatasetsItemsGroupBy);
109
+ }}
110
+ >
111
+ <ToggleGroupItem value="target_type">Target type</ToggleGroupItem>
112
+ <ToggleGroupItem value="regions">Regions</ToggleGroupItem>
113
+ <ToggleGroupItem value="categories">Categories</ToggleGroupItem>
114
+ </ToggleGroup>
115
+ <div
116
+ style={{
117
+ maxWidth: 420,
118
+ marginTop: 16,
119
+ padding: 12,
120
+ background: 'var(--sidebar)',
121
+ color: 'var(--sidebar-foreground)',
122
+ border: '1px solid var(--border)',
123
+ borderRadius: 'var(--p-4)',
124
+ }}
125
+ >
126
+ <SidebarDatasetsItemsGrouped
127
+ groupBy={groupBy}
128
+ datasets={MOCK_DATASETS}
129
+ selectedDatasetId={selectedDatasetId}
130
+ onDatasetClick={setSelectedDatasetId}
131
+ />
132
+ </div>
133
+ </PageContentSection>
134
+ </>
135
+ );
136
+ }
@@ -0,0 +1,37 @@
1
+ import { PageContentSection } from '#uilib/components/ui/Page';
2
+
3
+ import { AppPageHeader } from '../components/AppPageHeader/AppPageHeader';
4
+ import { DocsHeaderActions } from '../docsHeaderActions';
5
+
6
+ export default function SybilionAuthProviderPage() {
7
+ return (
8
+ <>
9
+ <AppPageHeader
10
+ breadcrumbs={[{ label: 'SybilionAuthProvider' }]}
11
+ title="SybilionAuthProvider"
12
+ subheader="Auth0 SPA → POST /v1/auth/login → Sybilion JWT. Greenfield installs: docs/standalone-apps.md (yarn add line includes @auth0/auth0-react)."
13
+ actions={<DocsHeaderActions />}
14
+ />
15
+ <PageContentSection title="Exports">
16
+ <p style={{ marginTop: 0 }}>
17
+ From <code>@sybilion/uilib</code>:
18
+ </p>
19
+ <ul>
20
+ <li>
21
+ <code>SybilionAuthProvider</code>
22
+ </li>
23
+ <li>
24
+ <code>useSybilionAuth</code>
25
+ </li>
26
+ <li>
27
+ <code>useSybilionApiFetch</code>,{' '}
28
+ <code>createSybilionApiFetch</code>, <code>sybilionApiFetch</code>
29
+ </li>
30
+ <li>
31
+ <code>exchangeAuth0AccessTokenForSybilionJwt</code> (advanced)
32
+ </li>
33
+ </ul>
34
+ </PageContentSection>
35
+ </>
36
+ );
37
+ }
@@ -157,10 +157,10 @@ export const DOC_REGISTRY: DocEntry[] = [
157
157
  load: () => import('./pages/InteractiveContentPage'),
158
158
  },
159
159
  {
160
- slug: 'mini-app-root',
161
- title: 'MiniAppRoot',
160
+ slug: 'sybilion-auth-provider',
161
+ title: 'SybilionAuthProvider',
162
162
  section: 'Layout',
163
- load: () => import('./pages/MiniAppRootPage'),
163
+ load: () => import('./pages/SybilionAuthProviderPage'),
164
164
  },
165
165
  {
166
166
  slug: 'label',
@@ -252,6 +252,12 @@ export const DOC_REGISTRY: DocEntry[] = [
252
252
  section: 'Layout',
253
253
  load: () => import('./pages/SidebarPage'),
254
254
  },
255
+ {
256
+ slug: 'sidebar-datasets-items-grouped',
257
+ title: 'SidebarDatasetsItemsGrouped',
258
+ section: 'Navigation',
259
+ load: () => import('./pages/SidebarDatasetsItemsGroupedPage'),
260
+ },
255
261
  {
256
262
  slug: 'skeleton',
257
263
  title: 'Skeleton',
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
- export * from './mini-app';
1
+ export * from './sybilion-auth';
2
+ export * from './types/sybilionDatasetSnapshots';
2
3
  export * from './contexts/chat-context';
3
4
  export * from './types/chat-api.types';
4
5
  export * from './components/ui/AnalysesSelector';
@@ -53,3 +54,4 @@ export * from './components/ui/Toggle';
53
54
  export * from './components/ui/ToggleGroup';
54
55
  export * from './components/ui/Tooltip';
55
56
  export * from './components/ui/VimeoEmbed';
57
+ export * from './components/widgets/SidebarDatasetsItemsGrouped';