@sybilion/uilib 1.0.32 → 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 (72) 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/ChartAreaInteractive/ChartAreaInteractive.constants.js +11 -0
  4. package/dist/esm/components/ui/ChartAreaInteractive/ChartAreaInteractive.js +2 -1
  5. package/dist/esm/components/ui/Sidebar/Sidebar.js +1 -8
  6. package/dist/esm/components/ui/Sidebar/Sidebar.styl.js +2 -2
  7. package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.js +48 -0
  8. package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.styl.js +7 -0
  9. package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/groupSidebarDatasets.js +38 -0
  10. package/dist/esm/index.js +6 -6
  11. package/dist/esm/sybilion-auth/SybilionAuthProvider.js +185 -0
  12. package/dist/esm/sybilion-auth/authPaths.js +7 -0
  13. package/dist/esm/sybilion-auth/exchangeSybilionToken.js +40 -0
  14. package/dist/esm/types/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.constants.d.ts +9 -0
  15. package/dist/esm/types/src/components/ui/Input/Input.d.ts +1 -1
  16. package/dist/esm/types/src/components/ui/Sidebar/Sidebar.d.ts +1 -5
  17. package/dist/esm/types/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.d.ts +11 -0
  18. package/dist/esm/types/src/components/widgets/SidebarDatasetsItemsGrouped/groupSidebarDatasets.d.ts +8 -0
  19. package/dist/esm/types/src/components/widgets/SidebarDatasetsItemsGrouped/index.d.ts +3 -0
  20. package/dist/esm/types/src/docs/pages/SidebarDatasetsItemsGroupedPage.d.ts +1 -0
  21. package/dist/esm/types/src/docs/pages/SybilionAuthProviderPage.d.ts +1 -0
  22. package/dist/esm/types/src/index.d.ts +3 -1
  23. package/dist/esm/types/src/sybilion-auth/SybilionAuthProvider.d.ts +39 -0
  24. package/dist/esm/types/src/sybilion-auth/authPaths.d.ts +3 -0
  25. package/dist/esm/types/src/sybilion-auth/exchangeSybilionToken.d.ts +2 -0
  26. package/dist/esm/types/src/sybilion-auth/index.d.ts +4 -0
  27. package/dist/esm/types/src/{mini-app/miniAppDataTypes.d.ts → types/sybilionDatasetSnapshots.d.ts} +5 -8
  28. package/docs/standalone-apps.md +65 -0
  29. package/package.json +10 -3
  30. package/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.constants.ts +9 -0
  31. package/src/components/ui/ChartAreaInteractive/ChartAreaInteractive.tsx +2 -1
  32. package/src/components/ui/Sidebar/Sidebar.styl +0 -30
  33. package/src/components/ui/Sidebar/Sidebar.styl.d.ts +0 -2
  34. package/src/components/ui/Sidebar/Sidebar.tsx +0 -30
  35. package/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.styl +29 -0
  36. package/src/{mini-app/MiniAppRoot.styl.d.ts → components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.styl.d.ts} +4 -2
  37. package/src/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.tsx +128 -0
  38. package/src/components/widgets/SidebarDatasetsItemsGrouped/groupSidebarDatasets.ts +51 -0
  39. package/src/components/widgets/SidebarDatasetsItemsGrouped/index.ts +10 -0
  40. package/src/docs/components/DocsSidebar/DocsSidebar.tsx +47 -50
  41. package/src/docs/pages/SidebarDatasetsItemsGroupedPage.tsx +136 -0
  42. package/src/docs/pages/SidebarPage.tsx +21 -28
  43. package/src/docs/pages/SybilionAuthProviderPage.tsx +37 -0
  44. package/src/docs/registry.ts +9 -3
  45. package/src/index.ts +3 -1
  46. package/src/sybilion-auth/SybilionAuthProvider.tsx +322 -0
  47. package/src/sybilion-auth/authPaths.ts +6 -0
  48. package/src/sybilion-auth/exchangeSybilionToken.ts +47 -0
  49. package/src/sybilion-auth/index.ts +16 -0
  50. package/src/{mini-app/miniAppDataTypes.ts → types/sybilionDatasetSnapshots.ts} +5 -8
  51. package/dist/esm/mini-app/MiniAppRoot.js +0 -82
  52. package/dist/esm/mini-app/MiniAppRoot.styl.js +0 -7
  53. package/dist/esm/mini-app/miniAppChatBridge.js +0 -45
  54. package/dist/esm/mini-app/miniAppDataClient.js +0 -98
  55. package/dist/esm/mini-app/miniAppProtocol.js +0 -153
  56. package/dist/esm/mini-app/miniAppThemeConfig.js +0 -40
  57. package/dist/esm/types/src/docs/pages/MiniAppRootPage.d.ts +0 -1
  58. package/dist/esm/types/src/mini-app/MiniAppRoot.d.ts +0 -18
  59. package/dist/esm/types/src/mini-app/index.d.ts +0 -10
  60. package/dist/esm/types/src/mini-app/miniAppChatBridge.d.ts +0 -6
  61. package/dist/esm/types/src/mini-app/miniAppDataClient.d.ts +0 -16
  62. package/dist/esm/types/src/mini-app/miniAppProtocol.d.ts +0 -89
  63. package/dist/esm/types/src/mini-app/miniAppThemeConfig.d.ts +0 -3
  64. package/docs/workspace-mini-apps.md +0 -51
  65. package/src/docs/pages/MiniAppRootPage.tsx +0 -58
  66. package/src/mini-app/MiniAppRoot.styl +0 -24
  67. package/src/mini-app/MiniAppRoot.tsx +0 -150
  68. package/src/mini-app/index.ts +0 -43
  69. package/src/mini-app/miniAppChatBridge.ts +0 -55
  70. package/src/mini-app/miniAppDataClient.ts +0 -165
  71. package/src/mini-app/miniAppProtocol.ts +0 -247
  72. package/src/mini-app/miniAppThemeConfig.ts +0 -45
@@ -6,7 +6,6 @@ import {
6
6
  Sidebar,
7
7
  SidebarContent,
8
8
  SidebarGroup,
9
- SidebarGroupContent,
10
9
  SidebarMenu,
11
10
  SidebarMenuButton,
12
11
  SidebarMenuItem,
@@ -106,58 +105,56 @@ export function DocsSidebar() {
106
105
  />
107
106
  </SidebarMenu>
108
107
  <SidebarGroup>
109
- <SidebarGroupContent>
110
- <SidebarMenu>
111
- {DOC_SECTION_ORDER.map(section => {
112
- const entries = bySection.get(section);
113
- if (!entries?.length) return null;
108
+ <SidebarMenu>
109
+ {DOC_SECTION_ORDER.map(section => {
110
+ const entries = bySection.get(section);
111
+ if (!entries?.length) return null;
114
112
 
115
- const filteredEntries = isFiltering
116
- ? entries.filter(e => entryMatchesQuery(e, q))
117
- : entries;
118
- if (!filteredEntries.length) return null;
113
+ const filteredEntries = isFiltering
114
+ ? entries.filter(e => entryMatchesQuery(e, q))
115
+ : entries;
116
+ if (!filteredEntries.length) return null;
119
117
 
120
- const isExpanded = isFiltering || expandedSections.has(section);
121
- const sectionHasActive = entries.some(
122
- e => location.pathname === `/docs/${e.slug}`,
123
- );
118
+ const isExpanded = isFiltering || expandedSections.has(section);
119
+ const sectionHasActive = entries.some(
120
+ e => location.pathname === `/docs/${e.slug}`,
121
+ );
124
122
 
125
- return (
126
- <SidebarMenuItem key={section}>
127
- <SidebarMenuButton
128
- type="button"
129
- onClick={() => {
130
- if (!isFiltering) toggleSection(section);
131
- }}
132
- isActive={sectionHasActive}
133
- >
134
- <span>{section}</span>
135
- {isFiltering ? null : renderSectionChevron(isExpanded)}
136
- </SidebarMenuButton>
137
- {isExpanded ? (
138
- <SidebarMenuSub>
139
- {filteredEntries.map(e => {
140
- const to = `/docs/${e.slug}`;
141
- const isActive = location.pathname === to;
142
- return (
143
- <SidebarMenuSubItem key={e.slug}>
144
- <SidebarMenuSubButton
145
- asChild
146
- isActive={isActive}
147
- size="md"
148
- >
149
- <Link to={to}>{e.title}</Link>
150
- </SidebarMenuSubButton>
151
- </SidebarMenuSubItem>
152
- );
153
- })}
154
- </SidebarMenuSub>
155
- ) : null}
156
- </SidebarMenuItem>
157
- );
158
- })}
159
- </SidebarMenu>
160
- </SidebarGroupContent>
123
+ return (
124
+ <SidebarMenuItem key={section}>
125
+ <SidebarMenuButton
126
+ type="button"
127
+ onClick={() => {
128
+ if (!isFiltering) toggleSection(section);
129
+ }}
130
+ isActive={sectionHasActive}
131
+ >
132
+ <span>{section}</span>
133
+ {isFiltering ? null : renderSectionChevron(isExpanded)}
134
+ </SidebarMenuButton>
135
+ {isExpanded ? (
136
+ <SidebarMenuSub>
137
+ {filteredEntries.map(e => {
138
+ const to = `/docs/${e.slug}`;
139
+ const isActive = location.pathname === to;
140
+ return (
141
+ <SidebarMenuSubItem key={e.slug}>
142
+ <SidebarMenuSubButton
143
+ asChild
144
+ isActive={isActive}
145
+ size="md"
146
+ >
147
+ <Link to={to}>{e.title}</Link>
148
+ </SidebarMenuSubButton>
149
+ </SidebarMenuSubItem>
150
+ );
151
+ })}
152
+ </SidebarMenuSub>
153
+ ) : null}
154
+ </SidebarMenuItem>
155
+ );
156
+ })}
157
+ </SidebarMenu>
161
158
  </SidebarGroup>
162
159
  </SidebarContent>
163
160
  </Sidebar>
@@ -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
+ }
@@ -1,8 +1,6 @@
1
1
  import { PageContentSection } from '#uilib/components/ui/Page';
2
2
  import {
3
3
  SidebarGroup,
4
- SidebarGroupContent,
5
- SidebarGroupLabel,
6
4
  SidebarMenu,
7
5
  SidebarMenuButton,
8
6
  SidebarMenuItem,
@@ -20,32 +18,27 @@ export default function SidebarPage() {
20
18
  subheader="Sidebar menu primitives (isolated preview)."
21
19
  actions={<DocsHeaderActions />}
22
20
  />
23
- <PageContentSection
24
- style={{
25
- border: '1px solid var(--border)',
26
- borderRadius: 8,
27
- padding: 12,
28
- maxWidth: 280,
29
- background: 'var(--sidebar)',
30
- color: 'var(--sidebar-foreground)',
31
- }}
32
- >
33
- <SidebarGroup>
34
- <SidebarGroupLabel>Demo</SidebarGroupLabel>
35
- <SidebarGroupContent>
36
- <SidebarMenu>
37
- <SidebarMenuItem>
38
- <SidebarMenuButton type="button" isActive>
39
- Active item
40
- </SidebarMenuButton>
41
- </SidebarMenuItem>
42
- <SidebarMenuItem>
43
- <SidebarMenuButton type="button">
44
- Another item
45
- </SidebarMenuButton>
46
- </SidebarMenuItem>
47
- </SidebarMenu>
48
- </SidebarGroupContent>
21
+ <PageContentSection>
22
+ <SidebarGroup
23
+ style={{
24
+ maxWidth: 320,
25
+ padding: 12,
26
+ background: 'var(--sidebar)',
27
+ color: 'var(--sidebar-foreground)',
28
+ border: '1px solid var(--border)',
29
+ borderRadius: 'var(--p-4)',
30
+ }}
31
+ >
32
+ <SidebarMenu>
33
+ <SidebarMenuItem>
34
+ <SidebarMenuButton type="button" isActive>
35
+ Active item
36
+ </SidebarMenuButton>
37
+ </SidebarMenuItem>
38
+ <SidebarMenuItem>
39
+ <SidebarMenuButton type="button">Another item</SidebarMenuButton>
40
+ </SidebarMenuItem>
41
+ </SidebarMenu>
49
42
  </SidebarGroup>
50
43
  </PageContentSection>
51
44
  </>
@@ -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';