@nimiplatform/app-tools 0.1.3 → 0.2.1
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/LICENSE +198 -6
- package/README.md +83 -27
- package/bin/nimi-app.mjs +328 -45
- package/lib/app-access-declaration.mjs +49 -0
- package/lib/app-doctor-update.mjs +411 -149
- package/lib/app-pack.mjs +402 -0
- package/lib/app-project-lifecycle.mjs +1141 -0
- package/lib/app-scaffold-capabilities.mjs +769 -0
- package/lib/app-scaffold-default-source.mjs +21 -0
- package/lib/app-scaffold-profiles.mjs +1093 -0
- package/lib/app-scaffold.mjs +1266 -813
- package/lib/index.mjs +195 -42
- package/lib/simulator-conformance-ast.mjs +498 -0
- package/lib/simulator-conformance-css.mjs +116 -0
- package/lib/simulator-conformance-graph.mjs +757 -0
- package/lib/simulator-conformance.d.mts +14 -0
- package/lib/simulator-conformance.mjs +203 -0
- package/lib/simulator-css-profile.d.mts +27 -0
- package/lib/simulator-css-profile.mjs +531 -0
- package/lib/simulator-kit-export-resolution.mjs +70 -0
- package/lib/simulator-manifest.mjs +334 -0
- package/lib/windows-powershell.mjs +7 -0
- package/package.json +66 -3
- package/scripts/dev-shell.mjs +465 -0
- package/scripts/sync-app-source.mjs +300 -0
- package/scripts/sync-scaffold-versions.mjs +91 -0
- package/templates/app-source/LICENSE +21 -0
- package/templates/app-source/src/ai-studio-core/ai-config.ts +100 -0
- package/templates/app-source/src/ai-studio-core/ai-studio-core.css +338 -0
- package/templates/app-source/src/ai-studio-core/contexts.tsx +61 -0
- package/templates/app-source/src/ai-studio-core/history-policy.ts +447 -0
- package/templates/app-source/src/ai-studio-core/history.ts +824 -0
- package/templates/app-source/src/ai-studio-core/host-context.tsx +79 -0
- package/templates/app-source/src/ai-studio-core/index.ts +214 -0
- package/templates/app-source/src/ai-studio-core/messages/en.json +310 -0
- package/templates/app-source/src/ai-studio-core/messages/index.ts +47 -0
- package/templates/app-source/src/ai-studio-core/messages/zh.json +310 -0
- package/templates/app-source/src/ai-studio-core/module-registration.ts +109 -0
- package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +65 -0
- package/templates/app-source/src/ai-studio-core/parameter-fields.tsx +247 -0
- package/templates/app-source/src/ai-studio-core/parameters.ts +110 -0
- package/templates/app-source/src/ai-studio-core/prompt-drafts.ts +69 -0
- package/templates/app-source/src/ai-studio-core/run-target.ts +123 -0
- package/templates/app-source/src/ai-studio-core/runtime-dispatcher.ts +35 -0
- package/templates/app-source/src/ai-studio-core/runtime-types.ts +86 -0
- package/templates/app-source/src/ai-studio-core/runtime.ts +306 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-admission.ts +38 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-ai-config.tsx +30 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-artifact-preview.ts +40 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-composer.tsx +257 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-history.tsx +676 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-input.ts +19 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-output.tsx +291 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +413 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +174 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-studio-result.tsx +449 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-surface.tsx +45 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +494 -0
- package/templates/app-source/src/ai-studio-core/studio-directives.ts +33 -0
- package/templates/app-source/src/ai-studio-core/workspace.tsx +381 -0
- package/templates/app-source/src/product-modules/agent-center/index.tsx +27 -0
- package/templates/app-source/src/product-modules/agent-conversation/index.tsx +19 -0
- package/templates/app-source/src/product-modules/agent-realtime/index.tsx +29 -0
- package/templates/app-source/src/product-modules/kit-recipes/gallery.tsx +142 -0
- package/templates/app-source/src/product-modules/kit-recipes/index.tsx +19 -0
- package/templates/app-source/src/product-modules/kit-recipes/kit-component-gallery-data-recipes.tsx +336 -0
- package/templates/app-source/src/product-modules/kit-recipes/kit-component-gallery-demos.tsx +165 -0
- package/templates/app-source/src/product-modules/kit-recipes/kit-component-gallery-recipes.tsx +682 -0
- package/templates/app-source/src/product-modules/kit-recipes/kit-component-gallery-surface.tsx +341 -0
- package/templates/app-source/src/studio-modules/studio-create/descriptors.ts +26 -0
- package/templates/app-source/src/studio-modules/studio-create/index.ts +14 -0
- package/templates/app-source/src/studio-modules/studio-create/messages/en.json +67 -0
- package/templates/app-source/src/studio-modules/studio-create/messages/index.ts +5 -0
- package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +67 -0
- package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +153 -0
- package/templates/app-source/src/studio-modules/studio-create/parameters.ts +70 -0
- package/templates/app-source/src/studio-modules/studio-create/registration.ts +46 -0
- package/templates/app-source/src/studio-modules/studio-create/runtime.ts +339 -0
- package/templates/app-source/src/studio-modules/studio-media/descriptors.ts +22 -0
- package/templates/app-source/src/studio-modules/studio-media/index.ts +12 -0
- package/templates/app-source/src/studio-modules/studio-media/messages/en.json +82 -0
- package/templates/app-source/src/studio-modules/studio-media/messages/index.ts +5 -0
- package/templates/app-source/src/studio-modules/studio-media/messages/zh.json +82 -0
- package/templates/app-source/src/studio-modules/studio-media/parameter-panel.tsx +283 -0
- package/templates/app-source/src/studio-modules/studio-media/parameters.ts +94 -0
- package/templates/app-source/src/studio-modules/studio-media/registration.ts +44 -0
- package/templates/app-source/src/studio-modules/studio-media/runtime.ts +113 -0
- package/templates/app-source/src/studio-modules/studio-voice/descriptors.ts +28 -0
- package/templates/app-source/src/studio-modules/studio-voice/index.ts +16 -0
- package/templates/app-source/src/studio-modules/studio-voice/messages/en.json +99 -0
- package/templates/app-source/src/studio-modules/studio-voice/messages/index.ts +5 -0
- package/templates/app-source/src/studio-modules/studio-voice/messages/zh.json +99 -0
- package/templates/app-source/src/studio-modules/studio-voice/parameter-panel.tsx +284 -0
- package/templates/app-source/src/studio-modules/studio-voice/parameters.ts +116 -0
- package/templates/app-source/src/studio-modules/studio-voice/registration.ts +59 -0
- package/templates/app-source/src/studio-modules/studio-voice/runtime.ts +347 -0
- package/templates/app-source/src/workbench-core/empty-state.tsx +31 -0
- package/templates/app-source/src/workbench-core/index.ts +17 -0
- package/templates/app-source/src/workbench-core/runtime-gate.tsx +131 -0
- package/templates/app-source/src/workbench-core/workbench-core.css +255 -0
- package/templates/app-source/src/workbench-core/workbench-core.tsx +140 -0
- package/templates/app-source.manifest.json +333 -0
- package/templates/default-starter/AGENTS.md +33 -0
- package/templates/default-starter/LICENSE +21 -0
- package/templates/default-starter/README.md +41 -0
- package/templates/default-starter/SECURITY.md +5 -0
- package/templates/default-starter/index.html +12 -0
- package/templates/default-starter/scripts/validate.mjs +26 -0
- package/templates/default-starter/src/shell/App.tsx +27 -0
- package/templates/default-starter/src/shell/auth/app-identity.ts +3 -0
- package/templates/default-starter/src/shell/auth/local-app-client.ts +18 -0
- package/templates/default-starter/src/shell/auth/runtime-platform.ts +110 -0
- package/templates/default-starter/src/shell/authenticated-shell.tsx +20 -0
- package/templates/default-starter/src/shell/workbench-target-adapter.ts +40 -0
- package/templates/default-starter/src/styles.css +26 -0
- package/templates/default-starter/src-tauri/Cargo.toml +17 -0
- package/templates/default-starter/src-tauri/build.rs +5 -0
- package/templates/default-starter/src-tauri/capabilities/default.json +7 -0
- package/templates/default-starter/src-tauri/tauri.conf.json +26 -0
- package/templates/default-starter/tsconfig.json +18 -0
- package/templates/default-starter.manifest.json +99 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
@scope (.nimi-ui-module--lab) {
|
|
2
|
+
@scope (.nimi-workbench-host) {
|
|
3
|
+
:scope {
|
|
4
|
+
display: block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
min-width: 0;
|
|
7
|
+
height: 100%;
|
|
8
|
+
min-height: 100%;
|
|
9
|
+
overflow: clip;
|
|
10
|
+
container-name: nimi-workbench-surface;
|
|
11
|
+
container-type: size;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.lab-main-surface {
|
|
15
|
+
height: 100%;
|
|
16
|
+
min-height: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.app-shell {
|
|
20
|
+
position: relative;
|
|
21
|
+
height: 100%;
|
|
22
|
+
min-height: 100%;
|
|
23
|
+
overflow: clip;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
isolation: isolate;
|
|
27
|
+
background: var(--nimi-surface-canvas);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.workbench {
|
|
31
|
+
--nimi-ui-module-lab-workbench-rail-item-size: 44px;
|
|
32
|
+
position: relative;
|
|
33
|
+
min-height: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
background:
|
|
37
|
+
radial-gradient(circle at 16% 18%, var(--nimi-ambient-mesh-color-1), transparent 34%),
|
|
38
|
+
radial-gradient(circle at 26% 92%, var(--nimi-ambient-mesh-color-4), transparent 31%),
|
|
39
|
+
radial-gradient(circle at 92% 18%, var(--nimi-ambient-mesh-color-2), transparent 34%),
|
|
40
|
+
linear-gradient(115deg, var(--nimi-ambient-mesh-base-start) 0%, var(--nimi-app-background) 48%, var(--nimi-ambient-mesh-base-end) 100%);
|
|
41
|
+
color: var(--nimi-text-primary);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.workbench__body {
|
|
45
|
+
display: grid;
|
|
46
|
+
grid-template-columns: 72px minmax(0, 1fr);
|
|
47
|
+
height: 100%;
|
|
48
|
+
min-height: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.workbench__main,
|
|
52
|
+
.workbench__content,
|
|
53
|
+
.workbench__content > * {
|
|
54
|
+
min-width: 0;
|
|
55
|
+
min-height: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.workbench__main {
|
|
59
|
+
display: grid;
|
|
60
|
+
min-height: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.workbench__content {
|
|
64
|
+
display: grid;
|
|
65
|
+
height: 100%;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.workbench__body > .workbench-side-nav {
|
|
69
|
+
display: grid;
|
|
70
|
+
align-content: stretch;
|
|
71
|
+
justify-items: center;
|
|
72
|
+
width: 72px;
|
|
73
|
+
min-width: 72px;
|
|
74
|
+
padding: 24px 14px 18px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.workbench__body > .workbench-side-nav nav {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
gap: 8px;
|
|
81
|
+
height: 100%;
|
|
82
|
+
margin: 0;
|
|
83
|
+
padding: 0;
|
|
84
|
+
list-style: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.workbench__body > .workbench-side-nav ul {
|
|
88
|
+
display: grid;
|
|
89
|
+
gap: 8px;
|
|
90
|
+
margin: 0;
|
|
91
|
+
padding: 0;
|
|
92
|
+
list-style: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.workbench__body > .workbench-side-nav [data-nav-placement="bottom"] {
|
|
96
|
+
margin-top: auto;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.workbench__body > .workbench-side-nav [data-workbench-rail-item],
|
|
100
|
+
.workbench__body > .workbench-side-nav [data-workbench-account-trigger] {
|
|
101
|
+
display: grid;
|
|
102
|
+
place-items: center;
|
|
103
|
+
width: var(--nimi-ui-module-lab-workbench-rail-item-size);
|
|
104
|
+
height: var(--nimi-ui-module-lab-workbench-rail-item-size);
|
|
105
|
+
border: 0;
|
|
106
|
+
border-radius: var(--nimi-radius-lg);
|
|
107
|
+
background: transparent;
|
|
108
|
+
color: var(--nimi-text-secondary);
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.workbench__body > .workbench-side-nav [data-workbench-rail-item]:hover,
|
|
113
|
+
.workbench__body > .workbench-side-nav [data-workbench-account-trigger]:hover {
|
|
114
|
+
background: var(--nimi-action-ghost-hover);
|
|
115
|
+
color: var(--nimi-text-primary);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.workbench__body > .workbench-side-nav [data-workbench-rail-item][aria-current="page"],
|
|
119
|
+
.workbench__body > .workbench-side-nav [data-workbench-account-trigger][data-open="true"] {
|
|
120
|
+
background: var(--nimi-action-primary-bg);
|
|
121
|
+
color: var(--nimi-action-primary-text);
|
|
122
|
+
box-shadow: 0 14px 26px color-mix(in srgb, var(--nimi-action-primary-bg) 24%, transparent);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.workbench__body > .workbench-side-nav [data-workbench-rail-label] {
|
|
126
|
+
position: absolute;
|
|
127
|
+
width: 1px;
|
|
128
|
+
height: 1px;
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
clip: rect(0 0 0 0);
|
|
131
|
+
white-space: nowrap;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.runtime-check-screen,
|
|
135
|
+
.runtime-unavailable-screen {
|
|
136
|
+
min-height: 100cqh;
|
|
137
|
+
position: relative;
|
|
138
|
+
display: grid;
|
|
139
|
+
place-items: center;
|
|
140
|
+
padding: 24px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.runtime-alert-copy {
|
|
144
|
+
display: grid;
|
|
145
|
+
gap: 4px;
|
|
146
|
+
min-width: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.runtime-alert-copy strong,
|
|
150
|
+
.runtime-alert-copy span {
|
|
151
|
+
min-width: 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.runtime-unavailable-panel {
|
|
155
|
+
width: min(560px, 100%);
|
|
156
|
+
display: grid;
|
|
157
|
+
gap: 18px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.runtime-unavailable-heading {
|
|
161
|
+
display: grid;
|
|
162
|
+
gap: 10px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.runtime-unavailable-heading h1 {
|
|
166
|
+
margin: 0;
|
|
167
|
+
letter-spacing: 0;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.runtime-action-hint {
|
|
171
|
+
margin: 0;
|
|
172
|
+
color: var(--nimi-text-secondary);
|
|
173
|
+
font-size: 13px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.workbench-empty-state {
|
|
177
|
+
display: grid;
|
|
178
|
+
place-items: center;
|
|
179
|
+
min-width: 0;
|
|
180
|
+
min-height: 100%;
|
|
181
|
+
padding: 24px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.workbench-empty-state__panel {
|
|
185
|
+
box-sizing: border-box;
|
|
186
|
+
display: grid;
|
|
187
|
+
gap: 16px;
|
|
188
|
+
width: min(680px, 100%);
|
|
189
|
+
padding: 28px;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.workbench-empty-state__eyebrow,
|
|
193
|
+
.workbench-empty-state__description,
|
|
194
|
+
.workbench-empty-state__heading h1,
|
|
195
|
+
.workbench-empty-state__panel h2 {
|
|
196
|
+
margin: 0;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.workbench-empty-state__eyebrow {
|
|
200
|
+
color: var(--nimi-text-muted);
|
|
201
|
+
font-size: 12px;
|
|
202
|
+
font-weight: var(--nimi-type-label-weight);
|
|
203
|
+
letter-spacing: 0.08em;
|
|
204
|
+
text-transform: uppercase;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.workbench-empty-state__heading {
|
|
208
|
+
display: flex;
|
|
209
|
+
align-items: center;
|
|
210
|
+
flex-wrap: wrap;
|
|
211
|
+
justify-content: space-between;
|
|
212
|
+
gap: 16px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.workbench-empty-state__heading h1 {
|
|
216
|
+
color: var(--nimi-text-primary);
|
|
217
|
+
font-size: 28px;
|
|
218
|
+
font-weight: var(--nimi-type-page-title-weight);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.workbench-empty-state__panel h2 {
|
|
222
|
+
color: var(--nimi-text-primary);
|
|
223
|
+
font-size: 20px;
|
|
224
|
+
font-weight: var(--nimi-type-page-title-weight);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.workbench-empty-state__description {
|
|
228
|
+
color: var(--nimi-text-secondary);
|
|
229
|
+
font-size: 14px;
|
|
230
|
+
line-height: 1.6;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@scope (.nimi-workbench-host) {
|
|
235
|
+
@container nimi-workbench-surface (max-width: 720px) {
|
|
236
|
+
.workbench__body {
|
|
237
|
+
grid-template-columns: 48px minmax(0, 1fr);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.workbench__body > .workbench-side-nav {
|
|
241
|
+
display: grid;
|
|
242
|
+
width: 48px;
|
|
243
|
+
min-width: 48px;
|
|
244
|
+
padding: 12px 2px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.workbench__body > .workbench-side-nav [data-workbench-rail-item],
|
|
248
|
+
.workbench__body > .workbench-side-nav [data-workbench-account-trigger] {
|
|
249
|
+
width: 40px;
|
|
250
|
+
height: 40px;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { Button, Tooltip } from '@nimiplatform/kit/ui';
|
|
3
|
+
|
|
4
|
+
// @nimi-authority: rule.nimi.platform.app-ecosystem.p-scaf-019c
|
|
5
|
+
|
|
6
|
+
export type WorkbenchNavigationIconProps = {
|
|
7
|
+
readonly size?: number;
|
|
8
|
+
readonly strokeWidth?: number;
|
|
9
|
+
readonly 'aria-hidden'?: boolean | 'true' | 'false';
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type WorkbenchNavigationItem<TViewId extends string> = {
|
|
13
|
+
readonly id: TViewId;
|
|
14
|
+
readonly label: string;
|
|
15
|
+
readonly icon: ComponentType<WorkbenchNavigationIconProps>;
|
|
16
|
+
readonly semanticId?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type WorkbenchNavigationGroup<TViewId extends string> = {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly items: readonly WorkbenchNavigationItem<TViewId>[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type WorkbenchCoreProps<TViewId extends string> = {
|
|
25
|
+
readonly activeViewId: TViewId | null;
|
|
26
|
+
readonly navigationLabel: string;
|
|
27
|
+
readonly navigationGroups: readonly WorkbenchNavigationGroup<TViewId>[];
|
|
28
|
+
readonly bottomNavigationItems?: readonly WorkbenchNavigationItem<TViewId>[];
|
|
29
|
+
readonly onSelectView: (viewId: TViewId) => void;
|
|
30
|
+
readonly accountSlot?: ReactNode;
|
|
31
|
+
readonly rootTestId?: string;
|
|
32
|
+
readonly children: ReactNode;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export function WorkbenchCore<TViewId extends string>({
|
|
36
|
+
activeViewId,
|
|
37
|
+
navigationLabel,
|
|
38
|
+
navigationGroups,
|
|
39
|
+
bottomNavigationItems = [],
|
|
40
|
+
onSelectView,
|
|
41
|
+
accountSlot,
|
|
42
|
+
rootTestId,
|
|
43
|
+
children,
|
|
44
|
+
}: WorkbenchCoreProps<TViewId>) {
|
|
45
|
+
return (
|
|
46
|
+
<main className="workbench" data-testid={rootTestId}>
|
|
47
|
+
<div className="workbench__body">
|
|
48
|
+
<aside className="workbench-side-nav" aria-label={navigationLabel}>
|
|
49
|
+
<nav className="workbench-side-nav__groups" aria-label={navigationLabel}>
|
|
50
|
+
{navigationGroups.map((group) => (
|
|
51
|
+
<WorkbenchNavigationList
|
|
52
|
+
key={group.id}
|
|
53
|
+
activeViewId={activeViewId}
|
|
54
|
+
items={group.items}
|
|
55
|
+
onSelectView={onSelectView}
|
|
56
|
+
/>
|
|
57
|
+
))}
|
|
58
|
+
{(bottomNavigationItems.length > 0 || accountSlot) ? (
|
|
59
|
+
<div className="workbench-side-nav__group" data-nav-placement="bottom">
|
|
60
|
+
<ul>
|
|
61
|
+
{bottomNavigationItems.map((item) => (
|
|
62
|
+
<WorkbenchNavigationListItem
|
|
63
|
+
key={item.id}
|
|
64
|
+
active={activeViewId === item.id}
|
|
65
|
+
item={item}
|
|
66
|
+
onSelectView={onSelectView}
|
|
67
|
+
/>
|
|
68
|
+
))}
|
|
69
|
+
{accountSlot ? (
|
|
70
|
+
<li className="workbench-side-nav__account">{accountSlot}</li>
|
|
71
|
+
) : null}
|
|
72
|
+
</ul>
|
|
73
|
+
</div>
|
|
74
|
+
) : null}
|
|
75
|
+
</nav>
|
|
76
|
+
</aside>
|
|
77
|
+
<div className="workbench__main">
|
|
78
|
+
<div className="workbench__content">{children}</div>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</main>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function WorkbenchNavigationList<TViewId extends string>({
|
|
86
|
+
activeViewId,
|
|
87
|
+
items,
|
|
88
|
+
onSelectView,
|
|
89
|
+
}: {
|
|
90
|
+
readonly activeViewId: TViewId | null;
|
|
91
|
+
readonly items: readonly WorkbenchNavigationItem<TViewId>[];
|
|
92
|
+
readonly onSelectView: (viewId: TViewId) => void;
|
|
93
|
+
}) {
|
|
94
|
+
return (
|
|
95
|
+
<div className="workbench-side-nav__group">
|
|
96
|
+
<ul>
|
|
97
|
+
{items.map((item) => (
|
|
98
|
+
<WorkbenchNavigationListItem
|
|
99
|
+
key={item.id}
|
|
100
|
+
active={activeViewId === item.id}
|
|
101
|
+
item={item}
|
|
102
|
+
onSelectView={onSelectView}
|
|
103
|
+
/>
|
|
104
|
+
))}
|
|
105
|
+
</ul>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function WorkbenchNavigationListItem<TViewId extends string>({
|
|
111
|
+
active,
|
|
112
|
+
item,
|
|
113
|
+
onSelectView,
|
|
114
|
+
}: {
|
|
115
|
+
readonly active: boolean;
|
|
116
|
+
readonly item: WorkbenchNavigationItem<TViewId>;
|
|
117
|
+
readonly onSelectView: (viewId: TViewId) => void;
|
|
118
|
+
}) {
|
|
119
|
+
const Icon = item.icon;
|
|
120
|
+
return (
|
|
121
|
+
<li>
|
|
122
|
+
<Tooltip content={item.label} placement="right" className="w-full">
|
|
123
|
+
<Button
|
|
124
|
+
type="button"
|
|
125
|
+
tone="ghost"
|
|
126
|
+
size="sm"
|
|
127
|
+
data-nimi-semantic-id={item.semanticId}
|
|
128
|
+
data-workbench-rail-item=""
|
|
129
|
+
className={active ? 'workbench-side-nav__item workbench-side-nav__item--active' : 'workbench-side-nav__item'}
|
|
130
|
+
onClick={() => onSelectView(item.id)}
|
|
131
|
+
aria-label={item.label}
|
|
132
|
+
aria-current={active ? 'page' : undefined}
|
|
133
|
+
>
|
|
134
|
+
<Icon size={18} strokeWidth={1.9} aria-hidden="true" />
|
|
135
|
+
<span className="workbench-side-nav__item-label" data-workbench-rail-label="">{item.label}</span>
|
|
136
|
+
</Button>
|
|
137
|
+
</Tooltip>
|
|
138
|
+
</li>
|
|
139
|
+
);
|
|
140
|
+
}
|