@sybilion/uilib 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/ui/AppHeader/AppHeader.styl.js +1 -1
- package/dist/esm/components/ui/AppHeader/appChromeAnchors.js +3 -1
- package/dist/esm/components/ui/Sidebar/Sidebar.styl.js +1 -1
- package/dist/esm/components/ui/WorkspaceAppSwitcher/WorkspaceAppSwitcher.js +62 -0
- package/dist/esm/components/ui/WorkspaceAppSwitcher/WorkspaceAppSwitcher.styl.js +7 -0
- package/dist/esm/components/ui/WorkspaceAppSwitcher/workspaceApp.types.js +4 -0
- package/dist/esm/components/ui/WorkspaceAppSwitcher/workspaceAppIcons.js +16 -0
- package/dist/esm/components/ui/WorkspaceAppSwitcher/workspaceAppPaths.js +29 -0
- package/dist/esm/components/ui/WorkspaceAppSwitcher/workspaceAppsConstants.js +4 -0
- package/dist/esm/components/ui/WorkspaceAppSwitcher/workspaceAppsLocalStorage.js +84 -0
- package/dist/esm/components/widgets/SybilionAppHeader/SybilionAppHeader.js +18 -0
- package/dist/esm/components/widgets/SybilionAppHeader/SybilionAppHeader.styl.js +7 -0
- package/dist/esm/index.js +8 -1
- package/dist/esm/types/src/components/ui/AppHeader/appChromeAnchors.d.ts +2 -0
- package/dist/esm/types/src/components/ui/AppHeader/index.d.ts +1 -1
- package/dist/esm/types/src/components/ui/WorkspaceAppSwitcher/WorkspaceAppSwitcher.d.ts +12 -0
- package/dist/esm/types/src/components/ui/WorkspaceAppSwitcher/index.d.ts +7 -0
- package/dist/esm/types/src/components/ui/WorkspaceAppSwitcher/workspaceApp.types.d.ts +19 -0
- package/dist/esm/types/src/components/ui/WorkspaceAppSwitcher/workspaceAppIcons.d.ts +9 -0
- package/dist/esm/types/src/components/ui/WorkspaceAppSwitcher/workspaceAppPaths.d.ts +3 -0
- package/dist/esm/types/src/components/ui/WorkspaceAppSwitcher/workspaceAppsConstants.d.ts +2 -0
- package/dist/esm/types/src/components/ui/WorkspaceAppSwitcher/workspaceAppsLocalStorage.d.ts +6 -0
- package/dist/esm/types/src/components/widgets/SybilionAppHeader/SybilionAppHeader.d.ts +14 -0
- package/dist/esm/types/src/components/widgets/SybilionAppHeader/index.d.ts +1 -0
- package/dist/esm/types/src/index.d.ts +2 -0
- package/docs/standalone-apps.md +195 -53
- package/package.json +1 -1
- package/src/components/ui/AppHeader/AppHeader.styl +5 -0
- package/src/components/ui/AppHeader/appChromeAnchors.ts +3 -0
- package/src/components/ui/AppHeader/index.ts +1 -1
- package/src/components/ui/Sidebar/Sidebar.styl +1 -1
- package/src/components/ui/WorkspaceAppSwitcher/WorkspaceAppSwitcher.styl +91 -0
- package/src/components/ui/WorkspaceAppSwitcher/WorkspaceAppSwitcher.styl.d.ts +15 -0
- package/src/components/ui/WorkspaceAppSwitcher/WorkspaceAppSwitcher.tsx +163 -0
- package/src/components/ui/WorkspaceAppSwitcher/index.ts +20 -0
- package/src/components/ui/WorkspaceAppSwitcher/workspaceApp.types.ts +21 -0
- package/src/components/ui/WorkspaceAppSwitcher/workspaceAppIcons.ts +27 -0
- package/src/components/ui/WorkspaceAppSwitcher/workspaceAppPaths.ts +34 -0
- package/src/components/ui/WorkspaceAppSwitcher/workspaceAppsConstants.ts +2 -0
- package/src/components/ui/WorkspaceAppSwitcher/workspaceAppsLocalStorage.ts +95 -0
- package/src/components/widgets/SybilionAppHeader/SybilionAppHeader.styl +53 -0
- package/src/components/widgets/SybilionAppHeader/SybilionAppHeader.styl.d.ts +10 -0
- package/src/components/widgets/SybilionAppHeader/SybilionAppHeader.tsx +74 -0
- package/src/components/widgets/SybilionAppHeader/index.ts +4 -0
- package/src/docs/pages/{StandaloneAppLayoutPage.styl → StandaloneAppLayoutPage/StandaloneAppLayoutPage.styl} +11 -21
- package/src/docs/pages/{StandaloneAppLayoutPage.styl.d.ts → StandaloneAppLayoutPage/StandaloneAppLayoutPage.styl.d.ts} +1 -0
- package/src/docs/pages/StandaloneAppLayoutPage/StandaloneAppLayoutPage.tsx +659 -0
- package/src/docs/registry.ts +2 -1
- package/src/index.ts +2 -0
- package/src/docs/pages/StandaloneAppLayoutPage.tsx +0 -242
- /package/dist/esm/types/src/docs/pages/{StandaloneAppLayoutPage.d.ts → StandaloneAppLayoutPage/StandaloneAppLayoutPage.d.ts} +0 -0
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { AppHeaderHost, AppHeaderPortal } from '#uilib/components/ui/AppHeader';
|
|
4
|
-
import { Gap } from '#uilib/components/ui/Gap/Gap';
|
|
5
|
-
import { NavUserHeader } from '#uilib/components/ui/NavUserHeader/NavUserHeader';
|
|
6
|
-
import {
|
|
7
|
-
AppShell,
|
|
8
|
-
AppShellMainContent,
|
|
9
|
-
PageContentSection,
|
|
10
|
-
} from '#uilib/components/ui/Page';
|
|
11
|
-
import { PageFooter } from '#uilib/components/ui/Page/PageFooter/PageFooter';
|
|
12
|
-
import { PageScroll } from '#uilib/components/ui/Page/PageScroll/PageScroll';
|
|
13
|
-
import {
|
|
14
|
-
Sidebar,
|
|
15
|
-
SidebarContent,
|
|
16
|
-
SidebarGroup,
|
|
17
|
-
SidebarMenu,
|
|
18
|
-
SidebarMenuButton,
|
|
19
|
-
SidebarMenuItem,
|
|
20
|
-
SidebarProvider,
|
|
21
|
-
SidebarTrigger,
|
|
22
|
-
} from '#uilib/components/ui/Sidebar/Sidebar';
|
|
23
|
-
import {
|
|
24
|
-
SidebarDatasetsItemsGrouped,
|
|
25
|
-
type SidebarDatasetsItemsGroupedDataset,
|
|
26
|
-
} from '#uilib/components/widgets/SidebarDatasetsItemsGrouped';
|
|
27
|
-
import { House } from 'lucide-react';
|
|
28
|
-
|
|
29
|
-
import { AppPageHeader } from '../components/AppPageHeader/AppPageHeader';
|
|
30
|
-
import { DocsHeaderActions } from '../docsHeaderActions';
|
|
31
|
-
import S from './StandaloneAppLayoutPage.styl';
|
|
32
|
-
|
|
33
|
-
const MOCK_DATASETS: SidebarDatasetsItemsGroupedDataset[] = [
|
|
34
|
-
{
|
|
35
|
-
id: 1,
|
|
36
|
-
name: 'Acetic Acid Price - China - Dollar/MT',
|
|
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: 1,
|
|
43
|
-
target_type: { id: 1, name: 'Commodity price' },
|
|
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: 'USD/MT' },
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
id: 2,
|
|
55
|
-
name: 'Freight index — spot volume (China)',
|
|
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: 2,
|
|
62
|
-
target_type: { id: 2, name: 'Freight index' },
|
|
63
|
-
trend: 0,
|
|
64
|
-
regular_price: '0',
|
|
65
|
-
sale_price: '0',
|
|
66
|
-
regions: [
|
|
67
|
-
{ id: 1, name: 'Asia' },
|
|
68
|
-
{ id: 2, name: 'China' },
|
|
69
|
-
],
|
|
70
|
-
unit: { id: 1, name: 'Index' },
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
id: 3,
|
|
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
|
-
type PreviewPanel = 'home' | 'datasets';
|
|
91
|
-
|
|
92
|
-
const TEST_HEADER_ID = 'test-header-id';
|
|
93
|
-
|
|
94
|
-
function DemoAppSidebar({
|
|
95
|
-
panel,
|
|
96
|
-
onSelectPanel,
|
|
97
|
-
selectedDatasetId,
|
|
98
|
-
onSelectDatasetId,
|
|
99
|
-
}: {
|
|
100
|
-
panel: PreviewPanel;
|
|
101
|
-
onSelectPanel: (p: PreviewPanel) => void;
|
|
102
|
-
selectedDatasetId: number | undefined;
|
|
103
|
-
onSelectDatasetId: (id: number | undefined) => void;
|
|
104
|
-
}) {
|
|
105
|
-
return (
|
|
106
|
-
<Sidebar
|
|
107
|
-
variant="inset"
|
|
108
|
-
collapsible="offcanvas"
|
|
109
|
-
style={{ maxHeight: '100%', height: '100%' }}
|
|
110
|
-
>
|
|
111
|
-
<SidebarContent>
|
|
112
|
-
<SidebarDatasetsItemsGrouped
|
|
113
|
-
preItems={
|
|
114
|
-
<SidebarMenuItem>
|
|
115
|
-
<SidebarMenuButton
|
|
116
|
-
type="button"
|
|
117
|
-
isActive={panel === 'home'}
|
|
118
|
-
onClick={() => onSelectPanel('home')}
|
|
119
|
-
>
|
|
120
|
-
<House size={16} strokeWidth={1.75} aria-hidden />
|
|
121
|
-
Home
|
|
122
|
-
</SidebarMenuButton>
|
|
123
|
-
</SidebarMenuItem>
|
|
124
|
-
}
|
|
125
|
-
groupBy="regions"
|
|
126
|
-
datasets={MOCK_DATASETS}
|
|
127
|
-
selectedDatasetId={selectedDatasetId}
|
|
128
|
-
onDatasetClick={id => {
|
|
129
|
-
onSelectDatasetId(id);
|
|
130
|
-
onSelectPanel('datasets');
|
|
131
|
-
}}
|
|
132
|
-
/>
|
|
133
|
-
</SidebarContent>
|
|
134
|
-
</Sidebar>
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function DemoMainBody({ panel }: { panel: PreviewPanel }) {
|
|
139
|
-
if (panel === 'home') {
|
|
140
|
-
return (
|
|
141
|
-
<div style={{ padding: 'var(--p-6)' }}>
|
|
142
|
-
<h2 style={{ margin: '0 0 0.5rem', fontSize: '1.125rem' }}>Home</h2>
|
|
143
|
-
<p style={{ margin: 0, color: 'var(--muted-foreground)' }}>
|
|
144
|
-
Preview: greenfield shell layout only (no SDK or auth). Real SPA uses
|
|
145
|
-
one top-level Router; this embed cannot nest MemoryRouter under docs
|
|
146
|
-
BrowserRouter — sidebar uses local state instead of{' '}
|
|
147
|
-
<code>NavLink</code> / <code>Routes</code>.
|
|
148
|
-
</p>
|
|
149
|
-
</div>
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return (
|
|
154
|
-
<div style={{ padding: 'var(--p-6)' }}>
|
|
155
|
-
<h2 style={{ margin: '0 0 0.5rem', fontSize: '1.125rem' }}>Datasets</h2>
|
|
156
|
-
<p style={{ margin: 0, color: 'var(--muted-foreground)' }}>
|
|
157
|
-
Use sidebar links and dataset rows; panel state stays inside this box.
|
|
158
|
-
</p>
|
|
159
|
-
</div>
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function StandaloneLayoutPreview() {
|
|
164
|
-
const [theme, setTheme] = useState<'light' | 'dark'>('light');
|
|
165
|
-
const [panel, setPanel] = useState<PreviewPanel>('home');
|
|
166
|
-
const [selectedDatasetId, setSelectedDatasetId] = useState<
|
|
167
|
-
number | undefined
|
|
168
|
-
>();
|
|
169
|
-
|
|
170
|
-
const onThemeToggle = useCallback(() => {
|
|
171
|
-
setTheme(t => (t === 'dark' ? 'light' : 'dark'));
|
|
172
|
-
}, []);
|
|
173
|
-
|
|
174
|
-
return (
|
|
175
|
-
<div className={S.preview}>
|
|
176
|
-
<PageScroll rootClassName={S.previewScrollRoot}>
|
|
177
|
-
<AppShell>
|
|
178
|
-
<DemoAppSidebar
|
|
179
|
-
panel={panel}
|
|
180
|
-
onSelectPanel={setPanel}
|
|
181
|
-
selectedDatasetId={selectedDatasetId}
|
|
182
|
-
onSelectDatasetId={setSelectedDatasetId}
|
|
183
|
-
/>
|
|
184
|
-
|
|
185
|
-
<AppShellMainContent
|
|
186
|
-
header={<AppHeaderHost anchorId={TEST_HEADER_ID} />}
|
|
187
|
-
footer={
|
|
188
|
-
<PageFooter
|
|
189
|
-
versionLink="#standalone-layout-preview"
|
|
190
|
-
versionLabel="0.0.0-preview"
|
|
191
|
-
/>
|
|
192
|
-
}
|
|
193
|
-
>
|
|
194
|
-
<AppHeaderPortal pageHeaderId={TEST_HEADER_ID}>
|
|
195
|
-
<SidebarTrigger />
|
|
196
|
-
<Gap />
|
|
197
|
-
<NavUserHeader
|
|
198
|
-
user={{
|
|
199
|
-
name: 'Preview User',
|
|
200
|
-
email: 'preview@example.com',
|
|
201
|
-
avatar: '',
|
|
202
|
-
}}
|
|
203
|
-
theme={theme}
|
|
204
|
-
onThemeToggle={onThemeToggle}
|
|
205
|
-
onLogout={() => undefined}
|
|
206
|
-
/>
|
|
207
|
-
</AppHeaderPortal>
|
|
208
|
-
<DemoMainBody panel={panel} />
|
|
209
|
-
</AppShellMainContent>
|
|
210
|
-
</AppShell>
|
|
211
|
-
</PageScroll>
|
|
212
|
-
</div>
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export default function StandaloneAppLayoutPage() {
|
|
217
|
-
return (
|
|
218
|
-
<>
|
|
219
|
-
<AppPageHeader
|
|
220
|
-
breadcrumbs={[{ label: 'Standalone app layout' }]}
|
|
221
|
-
title="Standalone app layout"
|
|
222
|
-
subheader={
|
|
223
|
-
<>
|
|
224
|
-
Live preview of AppShell + Sidebar + main column from
|
|
225
|
-
docs/standalone-apps.md §4. <br />
|
|
226
|
-
Full greenfield setup (deps, global CSS, SybilionAuthProvider, SDK)
|
|
227
|
-
lives in that doc — this page is layout only.
|
|
228
|
-
</>
|
|
229
|
-
}
|
|
230
|
-
actions={<DocsHeaderActions />}
|
|
231
|
-
/>
|
|
232
|
-
<PageContentSection title="Embedded mini-app (layout preview)">
|
|
233
|
-
<SidebarProvider
|
|
234
|
-
sidebarWidthStorageKey="uilib.docs.standaloneLayout.sidebarWidthPx"
|
|
235
|
-
persistSidebarWidthWithoutConsent
|
|
236
|
-
>
|
|
237
|
-
<StandaloneLayoutPreview />
|
|
238
|
-
</SidebarProvider>
|
|
239
|
-
</PageContentSection>
|
|
240
|
-
</>
|
|
241
|
-
);
|
|
242
|
-
}
|