@sybilion/uilib 1.4.9 → 1.4.10
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/content-prompt.generated.ts +27 -0
- package/dist/agent-glossary/content.generated.ts +27 -0
- package/dist/agent-glossary/content.index.md +4 -0
- package/dist/agent-glossary/content.md +27 -0
- package/dist/agent-glossary/content.prompt.md +27 -0
- package/dist/agent-glossary/workspace.generated.ts +2 -2
- package/dist/agent-glossary/workspace.index.md +2 -2
- package/dist/agent-glossary/workspace.md +2 -2
- package/dist/esm/components/ui/AnalysesSelector/AnalysesSelector.js +2 -2
- package/dist/esm/components/ui/Button/Button.styl.js +1 -1
- package/dist/esm/components/ui/ButtonGroup/ButtonGroup.js +9 -0
- package/dist/esm/components/ui/ButtonGroup/ButtonGroup.styl.js +7 -0
- package/dist/esm/components/ui/Chart/Chart.js +3 -3
- package/dist/esm/components/ui/Chat/ChatPrompt/ChatPrompt.styl.js +1 -1
- package/dist/esm/components/ui/Chat/ChatPrompt/ChatPromptComposer.js +1 -1
- package/dist/esm/components/ui/Chat/ChatSheet/ChatSheet.js +13 -0
- package/dist/esm/components/ui/Chat/ChatSheet/useChatPanelChromeModel.js +10 -7
- package/dist/esm/components/ui/Chip/Chip.js +3 -4
- package/dist/esm/components/ui/Chip/Chip.styl.js +2 -2
- package/dist/esm/components/ui/FileChip/FileChip.js +1 -1
- package/dist/esm/components/ui/Page/pageScrollRestoration.js +22 -0
- package/dist/esm/components/ui/Page/usePageScrollRestoration.js +73 -0
- package/dist/esm/components/ui/Renamer/Renamer.js +1 -1
- package/dist/esm/components/ui/Renamer/Renamer.styl.js +1 -1
- package/dist/esm/components/ui/Sidebar/Sidebar.js +91 -73
- package/dist/esm/components/widgets/DriverCard/DriverCard.js +7 -7
- package/dist/esm/components/widgets/DriverCard/DriverPerformanceChart.js +3 -3
- package/dist/esm/components/widgets/DriverMap/DriverIcon/DriverIcon.js +2 -2
- package/dist/esm/components/widgets/DriverMap/DriverIcon/DriverIcon.styl.js +1 -1
- package/dist/esm/components/widgets/DriversComparisonChart/DriversComparisonChart.js +1 -0
- package/dist/esm/components/widgets/PerformanceChart/PerformanceTable.js +1 -0
- package/dist/esm/components/widgets/SybilionAppHeader/SybilionAppHeader.styl.js +1 -1
- package/dist/esm/index.js +4 -2
- package/dist/esm/types/src/components/ui/ButtonGroup/ButtonGroup.d.ts +3 -0
- package/dist/esm/types/src/components/ui/ButtonGroup/ButtonGroup.types.d.ts +3 -0
- package/dist/esm/types/src/components/ui/ButtonGroup/index.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Chip/Chip.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Chip/Chip.types.d.ts +4 -2
- package/dist/esm/types/src/components/ui/Page/index.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Page/pageScrollRestoration.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Page/usePageScrollRestoration.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Sidebar/Sidebar.d.ts +13 -6
- package/dist/esm/types/src/docs/pages/ButtonGroupPage.d.ts +1 -0
- package/dist/esm/types/src/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/ui/AnalysesSelector/AnalysesSelector.tsx +3 -3
- package/src/components/ui/AnalysisLineIcon/AGENT.md +1 -1
- package/src/components/ui/Avatar/AGENT.md +1 -1
- package/src/components/ui/Button/Button.styl +11 -5
- package/src/components/ui/ButtonGroup/AGENT.md +29 -0
- package/src/components/ui/ButtonGroup/ButtonGroup.styl +21 -0
- package/src/components/ui/{Badge/Badge.styl.d.ts → ButtonGroup/ButtonGroup.styl.d.ts} +0 -6
- package/src/components/ui/ButtonGroup/ButtonGroup.tsx +17 -0
- package/src/components/ui/ButtonGroup/ButtonGroup.types.ts +3 -0
- package/src/components/ui/ButtonGroup/index.ts +2 -0
- package/src/components/ui/Chat/ChatPrompt/ChatPrompt.styl +2 -0
- package/src/components/ui/Chat/ChatPrompt/ChatPromptComposer.tsx +1 -0
- package/src/components/ui/Chat/ChatSheet/ChatSheet.tsx +15 -0
- package/src/components/ui/Chat/ChatSheet/useChatPanelChromeModel.tsx +21 -9
- package/src/components/ui/Chip/AGENT.md +4 -3
- package/src/components/ui/Chip/Chip.styl +17 -0
- package/src/components/ui/Chip/Chip.styl.d.ts +2 -0
- package/src/components/ui/Chip/Chip.tsx +10 -6
- package/src/components/ui/Chip/Chip.types.ts +5 -2
- package/src/components/ui/FileChip/FileChip.tsx +1 -1
- package/src/components/ui/Page/index.ts +2 -0
- package/src/components/ui/Page/pageScrollRestoration.ts +22 -0
- package/src/components/ui/Page/usePageScrollRestoration.ts +90 -0
- package/src/components/ui/Renamer/Renamer.styl +1 -1
- package/src/components/ui/Renamer/Renamer.tsx +1 -0
- package/src/components/ui/Sidebar/Sidebar.tsx +158 -99
- package/src/components/widgets/DriverCard/DriverCard.tsx +12 -10
- package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.styl +1 -0
- package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.tsx +3 -3
- package/src/components/widgets/SybilionAppHeader/SybilionAppHeader.styl +2 -2
- package/src/docs/pages/ButtonGroupPage.tsx +45 -0
- package/src/docs/pages/ChipPage.tsx +37 -0
- package/src/docs/pages/VimeoEmbedPage.tsx +4 -5
- package/src/docs/registry.ts +6 -12
- package/src/index.ts +1 -1
- package/dist/esm/components/ui/Badge/Badge.js +0 -11
- package/dist/esm/components/ui/Badge/Badge.styl.js +0 -7
- package/dist/esm/types/src/components/ui/Badge/Badge.d.ts +0 -3
- package/dist/esm/types/src/components/ui/Badge/Badge.types.d.ts +0 -6
- package/dist/esm/types/src/components/ui/Badge/index.d.ts +0 -2
- package/dist/esm/types/src/docs/pages/BadgePage.d.ts +0 -1
- package/dist/esm/types/src/docs/pages/TogglePage.d.ts +0 -1
- package/src/components/ui/Badge/AGENT.md +0 -16
- package/src/components/ui/Badge/Badge.styl +0 -95
- package/src/components/ui/Badge/Badge.tsx +0 -31
- package/src/components/ui/Badge/Badge.types.ts +0 -7
- package/src/components/ui/Badge/index.ts +0 -2
- package/src/docs/pages/BadgePage.tsx +0 -30
- package/src/docs/pages/TogglePage.tsx +0 -27
|
@@ -100,23 +100,31 @@ export type SetSidebarOpenOptions = {
|
|
|
100
100
|
layoutAutoClose?: boolean;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
type
|
|
104
|
-
isOpen: boolean;
|
|
103
|
+
type SidebarActionsContextProps = {
|
|
105
104
|
setOpen: (open: boolean, options?: SetSidebarOpenOptions) => void;
|
|
106
105
|
toggleSidebar: () => void;
|
|
107
|
-
sidebarWidthPx: number;
|
|
108
106
|
setSidebarWidthPx: (px: number, options?: SetPanelWidthOptions) => void;
|
|
109
|
-
chatWidthPx: number;
|
|
110
107
|
setChatWidthPx: (px: number, options?: SetPanelWidthOptions) => void;
|
|
111
|
-
chatPanelOpen: boolean;
|
|
112
108
|
setChatPanelOpen: (open: boolean) => void;
|
|
113
109
|
getShellWidth: () => number;
|
|
110
|
+
/** Read shell chat open without subscribing to SidebarStateContext. */
|
|
111
|
+
getChatPanelOpen: () => boolean;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
type SidebarStateContextProps = {
|
|
115
|
+
isOpen: boolean;
|
|
116
|
+
sidebarWidthPx: number;
|
|
117
|
+
chatWidthPx: number;
|
|
118
|
+
chatPanelOpen: boolean;
|
|
114
119
|
/** Portal target for the AI chat side panel (right column). */
|
|
115
120
|
chatPanelContainer: HTMLDivElement | null;
|
|
116
121
|
/** App shell wrapper; used to set `--chat-panel-width` (and `--chat-panel-height` on mobile only). */
|
|
117
122
|
sidebarWrapperRef: RefObject<HTMLDivElement | null>;
|
|
118
123
|
};
|
|
119
124
|
|
|
125
|
+
type SidebarContextProps = SidebarStateContextProps &
|
|
126
|
+
SidebarActionsContextProps;
|
|
127
|
+
|
|
120
128
|
type SidebarProps = ComponentProps<'div'> & {
|
|
121
129
|
defaultOpen?: boolean;
|
|
122
130
|
open?: boolean;
|
|
@@ -128,17 +136,43 @@ type SidebarProps = ComponentProps<'div'> & {
|
|
|
128
136
|
brandText?: string;
|
|
129
137
|
};
|
|
130
138
|
|
|
131
|
-
const
|
|
139
|
+
const SidebarActionsContext = createContext<SidebarActionsContextProps | null>(
|
|
140
|
+
null,
|
|
141
|
+
);
|
|
142
|
+
const SidebarStateContext = createContext<SidebarStateContextProps | null>(
|
|
143
|
+
null,
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
function useSidebarActions() {
|
|
147
|
+
const context = useContext(SidebarActionsContext);
|
|
148
|
+
if (!context) {
|
|
149
|
+
throw new Error('useSidebarActions must be used within a SidebarProvider.');
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return context;
|
|
153
|
+
}
|
|
132
154
|
|
|
133
|
-
function
|
|
134
|
-
const context = useContext(
|
|
155
|
+
function useSidebarState() {
|
|
156
|
+
const context = useContext(SidebarStateContext);
|
|
135
157
|
if (!context) {
|
|
136
|
-
throw new Error('
|
|
158
|
+
throw new Error('useSidebarState must be used within a SidebarProvider.');
|
|
137
159
|
}
|
|
138
160
|
|
|
139
161
|
return context;
|
|
140
162
|
}
|
|
141
163
|
|
|
164
|
+
function useSidebar(): SidebarContextProps {
|
|
165
|
+
const actions = useSidebarActions();
|
|
166
|
+
const state = useSidebarState();
|
|
167
|
+
return useMemo(
|
|
168
|
+
() => ({
|
|
169
|
+
...state,
|
|
170
|
+
...actions,
|
|
171
|
+
}),
|
|
172
|
+
[state, actions],
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
142
176
|
function SidebarProvider({
|
|
143
177
|
defaultOpen = (getCookie('isSidebarOpen') as unknown as boolean) ?? true,
|
|
144
178
|
className,
|
|
@@ -184,10 +218,14 @@ function SidebarProvider({
|
|
|
184
218
|
const [chatPanelOpen, _setChatPanelOpen] = useState(false);
|
|
185
219
|
const sidebarWidthRef = useRef(sidebarWidthPx);
|
|
186
220
|
const chatWidthRef = useRef(chatWidthPx);
|
|
221
|
+
const isOpenRef = useRef(isOpen);
|
|
222
|
+
const chatPanelOpenRef = useRef(chatPanelOpen);
|
|
187
223
|
/** Left nav was auto-closed because chat opened on a narrow shell; reopen when chat closes. */
|
|
188
224
|
const sidebarAutoClosedForChatRef = useRef(false);
|
|
189
225
|
sidebarWidthRef.current = sidebarWidthPx;
|
|
190
226
|
chatWidthRef.current = chatWidthPx;
|
|
227
|
+
isOpenRef.current = isOpen;
|
|
228
|
+
chatPanelOpenRef.current = chatPanelOpen;
|
|
191
229
|
|
|
192
230
|
const mergeWrapperRef = useCallback((el: HTMLDivElement | null) => {
|
|
193
231
|
wrapperRef.current = el;
|
|
@@ -204,40 +242,39 @@ function SidebarProvider({
|
|
|
204
242
|
return typeof window !== 'undefined' ? window.innerWidth : 1200;
|
|
205
243
|
}, []);
|
|
206
244
|
|
|
245
|
+
const getChatPanelOpen = useCallback(
|
|
246
|
+
(): boolean => chatPanelOpenRef.current,
|
|
247
|
+
[],
|
|
248
|
+
);
|
|
249
|
+
|
|
207
250
|
const setSidebarWidthPx = useCallback(
|
|
208
251
|
(px: number, options?: SetPanelWidthOptions) => {
|
|
209
252
|
const persist = options?.persist !== false;
|
|
210
253
|
const shellW = getShellWidth();
|
|
211
254
|
const next = clampSidebarWidthPx(px, shellW, {
|
|
212
|
-
chatPanelOpen,
|
|
213
|
-
chatWidthPx,
|
|
255
|
+
chatPanelOpen: chatPanelOpenRef.current,
|
|
256
|
+
chatWidthPx: chatWidthRef.current,
|
|
214
257
|
});
|
|
215
258
|
_setSidebarWidthPx(next);
|
|
216
259
|
if (persist && allowPersistSidebarWidth) {
|
|
217
260
|
LS.set(sidebarLsKey, next);
|
|
218
261
|
}
|
|
219
262
|
},
|
|
220
|
-
[
|
|
221
|
-
getShellWidth,
|
|
222
|
-
chatPanelOpen,
|
|
223
|
-
chatWidthPx,
|
|
224
|
-
sidebarLsKey,
|
|
225
|
-
allowPersistSidebarWidth,
|
|
226
|
-
],
|
|
263
|
+
[getShellWidth, sidebarLsKey, allowPersistSidebarWidth],
|
|
227
264
|
);
|
|
228
265
|
|
|
229
266
|
const setChatWidthPx = useCallback(
|
|
230
267
|
(px: number, options?: SetPanelWidthOptions) => {
|
|
231
268
|
const persist = options?.persist !== false;
|
|
232
269
|
const shellW = getShellWidth();
|
|
233
|
-
const effectiveSidebarW =
|
|
270
|
+
const effectiveSidebarW = isOpenRef.current ? sidebarWidthRef.current : 0;
|
|
234
271
|
const next = clampChatWidthPx(px, shellW, effectiveSidebarW);
|
|
235
272
|
_setChatWidthPx(next);
|
|
236
273
|
if (persist && getCookiePreferences(userId)?.functional) {
|
|
237
274
|
LS.set(CHAT_WIDTH_STORAGE_KEY, next);
|
|
238
275
|
}
|
|
239
276
|
},
|
|
240
|
-
[getShellWidth,
|
|
277
|
+
[getShellWidth, userId],
|
|
241
278
|
);
|
|
242
279
|
|
|
243
280
|
const handleShellResize = useCallback(
|
|
@@ -251,14 +288,22 @@ function SidebarProvider({
|
|
|
251
288
|
const cScaled = Math.round((c * shellW) / prev);
|
|
252
289
|
const effS = (navOpen: boolean, sidebarPx: number) =>
|
|
253
290
|
navOpen ? sidebarPx : 0;
|
|
254
|
-
let cNext = clampChatWidthPx(
|
|
291
|
+
let cNext = clampChatWidthPx(
|
|
292
|
+
cScaled,
|
|
293
|
+
shellW,
|
|
294
|
+
effS(isOpenRef.current, sScaled),
|
|
295
|
+
);
|
|
255
296
|
let sNext = clampSidebarWidthPx(sScaled, shellW, {
|
|
256
|
-
chatPanelOpen,
|
|
297
|
+
chatPanelOpen: chatPanelOpenRef.current,
|
|
257
298
|
chatWidthPx: cNext,
|
|
258
299
|
});
|
|
259
|
-
cNext = clampChatWidthPx(
|
|
300
|
+
cNext = clampChatWidthPx(
|
|
301
|
+
cScaled,
|
|
302
|
+
shellW,
|
|
303
|
+
effS(isOpenRef.current, sNext),
|
|
304
|
+
);
|
|
260
305
|
sNext = clampSidebarWidthPx(sScaled, shellW, {
|
|
261
|
-
chatPanelOpen,
|
|
306
|
+
chatPanelOpen: chatPanelOpenRef.current,
|
|
262
307
|
chatWidthPx: cNext,
|
|
263
308
|
});
|
|
264
309
|
_setSidebarWidthPx(sNext);
|
|
@@ -272,7 +317,7 @@ function SidebarProvider({
|
|
|
272
317
|
}
|
|
273
318
|
prevShellWidthRef.current = shellW;
|
|
274
319
|
},
|
|
275
|
-
[
|
|
320
|
+
[userId, sidebarLsKey, allowPersistSidebarWidth],
|
|
276
321
|
);
|
|
277
322
|
|
|
278
323
|
const fitPanelWidthsToShell = useCallback(() => {
|
|
@@ -280,15 +325,15 @@ function SidebarProvider({
|
|
|
280
325
|
if (shellW <= 0) return;
|
|
281
326
|
const s = sidebarWidthRef.current;
|
|
282
327
|
const c = chatWidthRef.current;
|
|
283
|
-
const effS =
|
|
328
|
+
const effS = isOpenRef.current ? s : 0;
|
|
284
329
|
let cNext = clampChatWidthPx(c, shellW, effS);
|
|
285
330
|
let sNext = clampSidebarWidthPx(s, shellW, {
|
|
286
|
-
chatPanelOpen,
|
|
331
|
+
chatPanelOpen: chatPanelOpenRef.current,
|
|
287
332
|
chatWidthPx: cNext,
|
|
288
333
|
});
|
|
289
|
-
cNext = clampChatWidthPx(c, shellW,
|
|
334
|
+
cNext = clampChatWidthPx(c, shellW, isOpenRef.current ? sNext : 0);
|
|
290
335
|
sNext = clampSidebarWidthPx(s, shellW, {
|
|
291
|
-
chatPanelOpen,
|
|
336
|
+
chatPanelOpen: chatPanelOpenRef.current,
|
|
292
337
|
chatWidthPx: cNext,
|
|
293
338
|
});
|
|
294
339
|
if (sNext !== s || cNext !== c) {
|
|
@@ -301,14 +346,7 @@ function SidebarProvider({
|
|
|
301
346
|
LS.set(CHAT_WIDTH_STORAGE_KEY, cNext);
|
|
302
347
|
}
|
|
303
348
|
}
|
|
304
|
-
}, [
|
|
305
|
-
chatPanelOpen,
|
|
306
|
-
getShellWidth,
|
|
307
|
-
isOpen,
|
|
308
|
-
userId,
|
|
309
|
-
sidebarLsKey,
|
|
310
|
-
allowPersistSidebarWidth,
|
|
311
|
-
]);
|
|
349
|
+
}, [getShellWidth, userId, sidebarLsKey, allowPersistSidebarWidth]);
|
|
312
350
|
|
|
313
351
|
useLayoutEffect(() => {
|
|
314
352
|
if (!shellEl || isSidebarSheetLayout) return;
|
|
@@ -328,36 +366,39 @@ function SidebarProvider({
|
|
|
328
366
|
if (isSidebarSheetLayout) return;
|
|
329
367
|
const shellW = getShellWidth();
|
|
330
368
|
const layoutAfterOpen = {
|
|
331
|
-
mainSidebarOpen: openingMain ||
|
|
332
|
-
chatPanelOpen: openingChat ||
|
|
333
|
-
sidebarWidthPx,
|
|
334
|
-
chatWidthPx,
|
|
369
|
+
mainSidebarOpen: openingMain || isOpenRef.current,
|
|
370
|
+
chatPanelOpen: openingChat || chatPanelOpenRef.current,
|
|
371
|
+
sidebarWidthPx: sidebarWidthRef.current,
|
|
372
|
+
chatWidthPx: chatWidthRef.current,
|
|
335
373
|
};
|
|
336
374
|
if (shellFitsSidebarsLayout(shellW, layoutAfterOpen)) return;
|
|
337
|
-
if (openingMain &&
|
|
375
|
+
if (openingMain && chatPanelOpenRef.current) {
|
|
338
376
|
_setChatPanelOpen(false);
|
|
339
377
|
if (typeof window !== 'undefined') {
|
|
340
378
|
window.dispatchEvent(new CustomEvent(DISMISS_CHAT_FOR_LAYOUT_EVENT));
|
|
341
379
|
}
|
|
342
|
-
} else if (openingChat &&
|
|
380
|
+
} else if (openingChat && isOpenRef.current) {
|
|
343
381
|
sidebarAutoClosedForChatRef.current = true;
|
|
344
382
|
setIsOpen(false);
|
|
345
383
|
}
|
|
346
384
|
},
|
|
347
|
-
[
|
|
348
|
-
isSidebarSheetLayout,
|
|
349
|
-
getShellWidth,
|
|
350
|
-
isOpen,
|
|
351
|
-
chatPanelOpen,
|
|
352
|
-
sidebarWidthPx,
|
|
353
|
-
chatWidthPx,
|
|
354
|
-
],
|
|
385
|
+
[isSidebarSheetLayout, getShellWidth],
|
|
355
386
|
);
|
|
356
387
|
|
|
357
388
|
const setChatPanelOpen = useCallback(
|
|
358
389
|
(open: boolean) => {
|
|
359
390
|
if (open) {
|
|
360
391
|
closeOppositeSidebarIfNoSpace(false, true);
|
|
392
|
+
const shellW = getShellWidth();
|
|
393
|
+
if (shellW > 0 && !isSidebarSheetLayout) {
|
|
394
|
+
const navOpenAfter =
|
|
395
|
+
isOpenRef.current && !sidebarAutoClosedForChatRef.current;
|
|
396
|
+
const effNav = navOpenAfter ? sidebarWidthRef.current : 0;
|
|
397
|
+
const cNext = clampChatWidthPx(chatWidthRef.current, shellW, effNav);
|
|
398
|
+
if (cNext !== chatWidthRef.current) {
|
|
399
|
+
_setChatWidthPx(cNext);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
361
402
|
_setChatPanelOpen(true);
|
|
362
403
|
return;
|
|
363
404
|
}
|
|
@@ -370,7 +411,12 @@ function SidebarProvider({
|
|
|
370
411
|
}
|
|
371
412
|
}
|
|
372
413
|
},
|
|
373
|
-
[
|
|
414
|
+
[
|
|
415
|
+
closeOppositeSidebarIfNoSpace,
|
|
416
|
+
getShellWidth,
|
|
417
|
+
isSidebarSheetLayout,
|
|
418
|
+
userId,
|
|
419
|
+
],
|
|
374
420
|
);
|
|
375
421
|
|
|
376
422
|
const setOpen = useCallback(
|
|
@@ -407,7 +453,10 @@ function SidebarProvider({
|
|
|
407
453
|
[isSidebarSheetLayout, userId, closeOppositeSidebarIfNoSpace],
|
|
408
454
|
);
|
|
409
455
|
|
|
410
|
-
const toggleSidebar = useCallback(
|
|
456
|
+
const toggleSidebar = useCallback(
|
|
457
|
+
() => setOpen(!isOpenRef.current),
|
|
458
|
+
[setOpen],
|
|
459
|
+
);
|
|
411
460
|
|
|
412
461
|
useEffect(() => {
|
|
413
462
|
const shell = wrapperRef.current;
|
|
@@ -452,67 +501,73 @@ function SidebarProvider({
|
|
|
452
501
|
},
|
|
453
502
|
});
|
|
454
503
|
|
|
455
|
-
const
|
|
504
|
+
const sidebarActionsValue = useMemo<SidebarActionsContextProps>(
|
|
456
505
|
() => ({
|
|
457
|
-
isOpen,
|
|
458
506
|
setOpen,
|
|
459
507
|
toggleSidebar,
|
|
460
|
-
sidebarWidthPx,
|
|
461
508
|
setSidebarWidthPx,
|
|
462
|
-
chatWidthPx,
|
|
463
509
|
setChatWidthPx,
|
|
464
|
-
chatPanelOpen,
|
|
465
510
|
setChatPanelOpen,
|
|
466
511
|
getShellWidth,
|
|
467
|
-
|
|
468
|
-
sidebarWrapperRef: wrapperRef,
|
|
512
|
+
getChatPanelOpen,
|
|
469
513
|
}),
|
|
470
514
|
[
|
|
471
|
-
isOpen,
|
|
472
515
|
setOpen,
|
|
473
516
|
toggleSidebar,
|
|
474
|
-
sidebarWidthPx,
|
|
475
517
|
setSidebarWidthPx,
|
|
476
|
-
chatWidthPx,
|
|
477
518
|
setChatWidthPx,
|
|
478
|
-
|
|
519
|
+
setChatPanelOpen,
|
|
479
520
|
getShellWidth,
|
|
480
|
-
|
|
521
|
+
getChatPanelOpen,
|
|
481
522
|
],
|
|
482
523
|
);
|
|
483
524
|
|
|
525
|
+
const sidebarStateValue = useMemo<SidebarStateContextProps>(
|
|
526
|
+
() => ({
|
|
527
|
+
isOpen,
|
|
528
|
+
sidebarWidthPx,
|
|
529
|
+
chatWidthPx,
|
|
530
|
+
chatPanelOpen,
|
|
531
|
+
chatPanelContainer,
|
|
532
|
+
sidebarWrapperRef: wrapperRef,
|
|
533
|
+
}),
|
|
534
|
+
[isOpen, sidebarWidthPx, chatWidthPx, chatPanelOpen, chatPanelContainer],
|
|
535
|
+
);
|
|
536
|
+
|
|
484
537
|
return (
|
|
485
|
-
<
|
|
486
|
-
<
|
|
487
|
-
<
|
|
488
|
-
ref={mergeWrapperRef}
|
|
489
|
-
data-slot="sidebar-wrapper"
|
|
490
|
-
data-state={isOpen ? 'expanded' : 'collapsed'}
|
|
491
|
-
style={
|
|
492
|
-
{
|
|
493
|
-
'--sidebar-width': `${sidebarWidthPx}px`,
|
|
494
|
-
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
|
|
495
|
-
...style,
|
|
496
|
-
} as CSSProperties
|
|
497
|
-
}
|
|
498
|
-
className={cn(S.sidebarWrapper, className)}
|
|
499
|
-
{...props}
|
|
500
|
-
>
|
|
538
|
+
<SidebarActionsContext.Provider value={sidebarActionsValue}>
|
|
539
|
+
<SidebarStateContext.Provider value={sidebarStateValue}>
|
|
540
|
+
<TooltipProvider delayDuration={0}>
|
|
501
541
|
<div
|
|
502
|
-
|
|
503
|
-
|
|
542
|
+
ref={mergeWrapperRef}
|
|
543
|
+
data-slot="sidebar-wrapper"
|
|
544
|
+
data-state={isOpen ? 'expanded' : 'collapsed'}
|
|
545
|
+
style={
|
|
546
|
+
{
|
|
547
|
+
'--sidebar-width': `${sidebarWidthPx}px`,
|
|
548
|
+
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
|
|
549
|
+
...style,
|
|
550
|
+
} as CSSProperties
|
|
551
|
+
}
|
|
552
|
+
className={cn(S.sidebarWrapper, className)}
|
|
553
|
+
{...props}
|
|
504
554
|
>
|
|
505
|
-
|
|
555
|
+
<div
|
|
556
|
+
className={S.sidebarMainShell}
|
|
557
|
+
// style={{ viewTransitionName: 'sidebar-gap' }}
|
|
558
|
+
>
|
|
559
|
+
{children}
|
|
560
|
+
</div>
|
|
561
|
+
<div
|
|
562
|
+
ref={onChatPanelMount}
|
|
563
|
+
className={S.chatPanelMount}
|
|
564
|
+
data-slot="chat-panel-mount"
|
|
565
|
+
// style={{ viewTransitionName: 'sidebar-container' }}
|
|
566
|
+
/>
|
|
506
567
|
</div>
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
data-slot="chat-panel-mount"
|
|
511
|
-
// style={{ viewTransitionName: 'sidebar-container' }}
|
|
512
|
-
/>
|
|
513
|
-
</div>
|
|
514
|
-
</TooltipProvider>
|
|
515
|
-
</SidebarContext.Provider>
|
|
568
|
+
</TooltipProvider>
|
|
569
|
+
</SidebarStateContext.Provider>
|
|
570
|
+
</SidebarActionsContext.Provider>
|
|
516
571
|
);
|
|
517
572
|
}
|
|
518
573
|
|
|
@@ -530,7 +585,8 @@ function Sidebar({
|
|
|
530
585
|
...props
|
|
531
586
|
}: SidebarProps) {
|
|
532
587
|
const isSidebarSheetLayout = useIsSidebarSheetLayout();
|
|
533
|
-
const { isOpen
|
|
588
|
+
const { isOpen } = useSidebarState();
|
|
589
|
+
const { setOpen } = useSidebarActions();
|
|
534
590
|
|
|
535
591
|
const prevSheetLayoutRef = useRef(isSidebarSheetLayout);
|
|
536
592
|
|
|
@@ -605,7 +661,7 @@ function SidebarTrigger({
|
|
|
605
661
|
onClick,
|
|
606
662
|
...props
|
|
607
663
|
}: ComponentProps<typeof Button>) {
|
|
608
|
-
const { toggleSidebar } =
|
|
664
|
+
const { toggleSidebar } = useSidebarActions();
|
|
609
665
|
|
|
610
666
|
return (
|
|
611
667
|
<Button
|
|
@@ -627,7 +683,7 @@ function SidebarTrigger({
|
|
|
627
683
|
}
|
|
628
684
|
|
|
629
685
|
function SidebarRail({ className, ...props }: ComponentProps<'button'>) {
|
|
630
|
-
const { toggleSidebar } =
|
|
686
|
+
const { toggleSidebar } = useSidebarActions();
|
|
631
687
|
|
|
632
688
|
return (
|
|
633
689
|
<button
|
|
@@ -728,8 +784,8 @@ function SidebarResizeHandle({
|
|
|
728
784
|
side = 'left',
|
|
729
785
|
...props
|
|
730
786
|
}: ComponentProps<'div'> & { side?: 'left' | 'right' }) {
|
|
731
|
-
const { isOpen, sidebarWidthPx
|
|
732
|
-
|
|
787
|
+
const { isOpen, sidebarWidthPx } = useSidebarState();
|
|
788
|
+
const { setSidebarWidthPx, getShellWidth } = useSidebarActions();
|
|
733
789
|
const isSidebarSheetLayout = useIsSidebarSheetLayout();
|
|
734
790
|
|
|
735
791
|
const edge: 'leading' | 'trailing' = side === 'left' ? 'trailing' : 'leading';
|
|
@@ -966,7 +1022,8 @@ function SidebarMenuSubButton({
|
|
|
966
1022
|
tooltip?: string | ComponentProps<typeof TooltipContent>;
|
|
967
1023
|
}) {
|
|
968
1024
|
const Comp = asChild ? Slot : 'a';
|
|
969
|
-
const { isOpen
|
|
1025
|
+
const { isOpen } = useSidebarState();
|
|
1026
|
+
const { setOpen } = useSidebarActions();
|
|
970
1027
|
const isSidebarSheetLayout = useIsSidebarSheetLayout();
|
|
971
1028
|
|
|
972
1029
|
const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
|
|
@@ -1028,4 +1085,6 @@ export {
|
|
|
1028
1085
|
SidebarSeparator,
|
|
1029
1086
|
SidebarTrigger,
|
|
1030
1087
|
useSidebar,
|
|
1088
|
+
useSidebarActions,
|
|
1089
|
+
useSidebarState,
|
|
1031
1090
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { Card, CardContent } from '../../ui/Card';
|
|
2
|
-
import { CoffeeIcon, TrendDownIcon, TrendUpIcon } from '@phosphor-icons/react';
|
|
3
1
|
import React, { useMemo } from 'react';
|
|
4
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/Tooltip';
|
|
5
2
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import {
|
|
3
|
+
import { CoffeeIcon, TrendDownIcon, TrendUpIcon } from '@phosphor-icons/react';
|
|
4
|
+
|
|
5
|
+
import { Card, CardContent } from '../../ui/Card';
|
|
6
|
+
import { Chip } from '../../ui/Chip';
|
|
9
7
|
import { LabelWithId } from '../../ui/LabelWithId';
|
|
10
|
-
import S from './DriverCard.styl';
|
|
11
8
|
import { Skeleton } from '../../ui/Skeleton';
|
|
9
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/Tooltip';
|
|
12
10
|
import { getCategoryIcon } from '../DriverMap/driverCategoryIcon';
|
|
11
|
+
import type { DriverData } from '../DriverMap/driverMapGeography';
|
|
12
|
+
import S from './DriverCard.styl';
|
|
13
|
+
import { DriverPerformanceChart } from './DriverPerformanceChart';
|
|
13
14
|
|
|
14
15
|
export interface DriverCardProps {
|
|
15
16
|
selectedDriver: DriverData | null;
|
|
@@ -199,13 +200,14 @@ export function DriverCard({
|
|
|
199
200
|
|
|
200
201
|
{/* Direction and Lag Information */}
|
|
201
202
|
<div className={S.directionLagSection}>
|
|
202
|
-
<
|
|
203
|
-
variant={direction > 0 ? '
|
|
203
|
+
<Chip
|
|
204
|
+
variant={direction > 0 ? 'positive' : 'negative'}
|
|
205
|
+
squared
|
|
204
206
|
className={S.directionBadge}
|
|
205
207
|
>
|
|
206
208
|
<DirectionIcon className={S.trendIcon} />
|
|
207
209
|
{directionText} correlation
|
|
208
|
-
</
|
|
210
|
+
</Chip>
|
|
209
211
|
|
|
210
212
|
<span className={S.lagInfo}>Lag: {lag}</span>
|
|
211
213
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Chip } from '#uilib/components/ui/Chip';
|
|
4
4
|
import {
|
|
5
5
|
Tooltip,
|
|
6
6
|
TooltipContent,
|
|
@@ -57,9 +57,9 @@ export function DriverIcon({
|
|
|
57
57
|
zIndex: isSelected ? 2 : '',
|
|
58
58
|
}}
|
|
59
59
|
>
|
|
60
|
-
<
|
|
60
|
+
<Chip variant="neutral" squared className={S.badge}>
|
|
61
61
|
<div className={S.icon}>{getCategoryIcon(driver.category)}</div>
|
|
62
|
-
</
|
|
62
|
+
</Chip>
|
|
63
63
|
</button>
|
|
64
64
|
</TooltipTrigger>
|
|
65
65
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Button } from '#uilib/components/ui/Button';
|
|
4
|
+
import { ButtonGroup } from '#uilib/components/ui/ButtonGroup';
|
|
5
|
+
import buttonGroupGuidance from '#uilib/components/ui/ButtonGroup/AGENT.md';
|
|
6
|
+
import { PageContentSection } from '#uilib/components/ui/Page';
|
|
7
|
+
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
8
|
+
|
|
9
|
+
import { AppPageHeader } from '../components/AppPageHeader/AppPageHeader';
|
|
10
|
+
import { DocsGuidance } from '../components/DocsGuidance/DocsGuidance';
|
|
11
|
+
import { DocsHeaderActions } from '../docsHeaderActions';
|
|
12
|
+
|
|
13
|
+
export default function ButtonGroupPage() {
|
|
14
|
+
const [value, setValue] = useState('day');
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<AppPageHeader
|
|
19
|
+
breadcrumbs={[{ label: 'ButtonGroup' }]}
|
|
20
|
+
title="ButtonGroup"
|
|
21
|
+
subheader="Mold adjacent buttons into a segmented control."
|
|
22
|
+
actions={<DocsHeaderActions />}
|
|
23
|
+
/>
|
|
24
|
+
<DocsGuidance source={buttonGroupGuidance} />
|
|
25
|
+
<PageContentSection
|
|
26
|
+
style={{ display: 'flex', flexDirection: 'column', gap: '2rem' }}
|
|
27
|
+
>
|
|
28
|
+
<section>
|
|
29
|
+
<ButtonGroup>
|
|
30
|
+
{['day', 'week', 'month'].map(item => (
|
|
31
|
+
<Button
|
|
32
|
+
key={item}
|
|
33
|
+
type="button"
|
|
34
|
+
variant={item === value ? 'default' : 'outline'}
|
|
35
|
+
onClick={() => setValue(item)}
|
|
36
|
+
>
|
|
37
|
+
{item}
|
|
38
|
+
</Button>
|
|
39
|
+
))}
|
|
40
|
+
</ButtonGroup>
|
|
41
|
+
</section>
|
|
42
|
+
</PageContentSection>
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -15,6 +15,7 @@ const VARIANTS: ChipVariant[] = [
|
|
|
15
15
|
'accent',
|
|
16
16
|
'positive',
|
|
17
17
|
'negative',
|
|
18
|
+
'yellow',
|
|
18
19
|
];
|
|
19
20
|
|
|
20
21
|
export default function ChipPage() {
|
|
@@ -111,6 +112,42 @@ export default function ChipPage() {
|
|
|
111
112
|
<Chip variant="positive">▲ 1.2%</Chip>
|
|
112
113
|
</div>
|
|
113
114
|
</section>
|
|
115
|
+
<section>
|
|
116
|
+
<h3 style={{ marginBottom: '1rem' }}>Squared</h3>
|
|
117
|
+
<p
|
|
118
|
+
style={{
|
|
119
|
+
marginBottom: '0.75rem',
|
|
120
|
+
color: 'var(--muted-foreground)',
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
Pass <code>squared</code> for compact label badges in lists, tables,
|
|
124
|
+
and cards.
|
|
125
|
+
</p>
|
|
126
|
+
<div
|
|
127
|
+
style={{
|
|
128
|
+
display: 'flex',
|
|
129
|
+
flexWrap: 'wrap',
|
|
130
|
+
gap: '0.75rem',
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<Chip variant="neutral" squared>
|
|
135
|
+
Default
|
|
136
|
+
</Chip>
|
|
137
|
+
<Chip variant="line" squared>
|
|
138
|
+
Outline
|
|
139
|
+
</Chip>
|
|
140
|
+
<Chip variant="negative" squared>
|
|
141
|
+
Red
|
|
142
|
+
</Chip>
|
|
143
|
+
<Chip variant="positive" squared>
|
|
144
|
+
Green
|
|
145
|
+
</Chip>
|
|
146
|
+
<Chip variant="yellow" squared>
|
|
147
|
+
Yellow
|
|
148
|
+
</Chip>
|
|
149
|
+
</div>
|
|
150
|
+
</section>
|
|
114
151
|
<section>
|
|
115
152
|
<h3 style={{ marginBottom: '1rem' }}>Dot</h3>
|
|
116
153
|
<p
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { PageContentSection } from '#uilib/components/ui/Page';
|
|
2
|
-
import { VimeoEmbed } from '#uilib/components/ui/VimeoEmbed';
|
|
3
|
-
import vimeoEmbedGuidance from '#uilib/components/ui/VimeoEmbed/AGENT.md';
|
|
4
|
-
|
|
5
1
|
import { AppPageHeader } from '../components/AppPageHeader/AppPageHeader';
|
|
6
2
|
import { DocsGuidance } from '../components/DocsGuidance/DocsGuidance';
|
|
7
3
|
import { DocsHeaderActions } from '../docsHeaderActions';
|
|
4
|
+
import { PageContentSection } from '#uilib/components/ui/Page';
|
|
5
|
+
import { VimeoEmbed } from '#uilib/components/ui/VimeoEmbed';
|
|
6
|
+
import vimeoEmbedGuidance from '#uilib/components/ui/VimeoEmbed/AGENT.md';
|
|
8
7
|
|
|
9
8
|
export default function VimeoEmbedPage() {
|
|
10
9
|
return (
|
|
@@ -17,7 +16,7 @@ export default function VimeoEmbedPage() {
|
|
|
17
16
|
/>
|
|
18
17
|
<DocsGuidance source={vimeoEmbedGuidance} />
|
|
19
18
|
<PageContentSection style={{ maxWidth: 560 }}>
|
|
20
|
-
<VimeoEmbed videoId="
|
|
19
|
+
<VimeoEmbed videoId="1202135779" videoHash="e26adba036" />
|
|
21
20
|
</PageContentSection>
|
|
22
21
|
</>
|
|
23
22
|
);
|