@sybilion/uilib 1.4.13 → 1.4.15

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 (136) hide show
  1. package/dist/agent-glossary/content-prompt.generated.ts +28 -23
  2. package/dist/agent-glossary/content.generated.ts +28 -23
  3. package/dist/agent-glossary/content.index.md +1 -1
  4. package/dist/agent-glossary/content.md +28 -23
  5. package/dist/agent-glossary/content.prompt.md +28 -23
  6. package/dist/agent-glossary/workspace.generated.ts +1 -1
  7. package/dist/agent-glossary/workspace.index.md +1 -1
  8. package/dist/agent-glossary/workspace.md +1 -1
  9. package/dist/esm/components/ui/Chat/ChatChrome/ChatChrome.js +28 -3
  10. package/dist/esm/components/ui/Chat/ChatSheet/useChatPanelChromeModel.js +31 -1
  11. package/dist/esm/components/ui/DropdownMenu/DropdownMenu.styl.js +2 -2
  12. package/dist/esm/components/ui/Page/Breadcrumbs/Breadcrumbs.js +28 -1
  13. package/dist/esm/components/ui/PanelResizeHandle/PanelResizeHandle.js +50 -0
  14. package/dist/esm/components/ui/Sidebar/Sidebar.styl.js +3 -3
  15. package/dist/esm/components/ui/Sidebar/SidebarAside.js +36 -0
  16. package/dist/esm/components/ui/Sidebar/SidebarContent/SidebarContent.js +13 -0
  17. package/dist/esm/components/ui/Sidebar/SidebarContent/SidebarContent.styl.js +7 -0
  18. package/dist/esm/components/ui/Sidebar/SidebarFooter/SidebarFooter.js +9 -0
  19. package/dist/esm/components/ui/Sidebar/SidebarFooter/SidebarFooter.styl.js +7 -0
  20. package/dist/esm/components/ui/Sidebar/SidebarGroup/SidebarGroup.js +9 -0
  21. package/dist/esm/components/ui/Sidebar/SidebarGroup/SidebarGroup.styl.js +7 -0
  22. package/dist/esm/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.js +11 -0
  23. package/dist/esm/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.styl.js +7 -0
  24. package/dist/esm/components/ui/Sidebar/SidebarMenu/SidebarMenu.js +15 -0
  25. package/dist/esm/components/ui/Sidebar/SidebarMenu/SidebarMenu.styl.js +7 -0
  26. package/dist/esm/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.js +11 -0
  27. package/dist/esm/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.styl.js +7 -0
  28. package/dist/esm/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.js +16 -0
  29. package/dist/esm/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.styl.js +7 -0
  30. package/dist/esm/components/ui/Sidebar/SidebarMenuSub/SidebarMenuSub.js +12 -0
  31. package/dist/esm/components/ui/Sidebar/SidebarMenuSub/SidebarMenuSub.styl.js +7 -0
  32. package/dist/esm/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.js +32 -0
  33. package/dist/esm/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.styl.js +7 -0
  34. package/dist/esm/components/ui/Sidebar/SidebarProvider/SidebarProvider.js +314 -0
  35. package/dist/esm/components/ui/Sidebar/SidebarProvider/SidebarProvider.styl.js +7 -0
  36. package/dist/esm/components/ui/Sidebar/SidebarRail/SidebarRail.js +11 -0
  37. package/dist/esm/components/ui/Sidebar/SidebarRail/SidebarRail.styl.js +7 -0
  38. package/dist/esm/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.js +26 -0
  39. package/dist/esm/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.styl.js +7 -0
  40. package/dist/esm/components/ui/Sidebar/SidebarSeparator/SidebarSeparator.js +10 -0
  41. package/dist/esm/components/ui/Sidebar/SidebarSeparator/SidebarSeparator.styl.js +7 -0
  42. package/dist/esm/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.js +16 -0
  43. package/dist/esm/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.styl.js +7 -0
  44. package/dist/esm/components/ui/Sidebar/sidebarConstants.js +7 -0
  45. package/dist/esm/components/ui/Sidebar/sidebarContext.js +28 -0
  46. package/dist/esm/components/ui/Sidebar/sidebarUtils.js +41 -0
  47. package/dist/esm/components/widgets/DriversComparisonChart/DriversComparisonChart.js +26 -5
  48. package/dist/esm/components/widgets/PerformanceChart/PerformanceTable.js +26 -4
  49. package/dist/esm/components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.js +28 -1
  50. package/dist/esm/index.js +18 -1
  51. package/dist/esm/types/src/components/ui/PanelResizeHandle/PanelResizeHandle.d.ts +9 -0
  52. package/dist/esm/types/src/components/ui/Sidebar/Sidebar.d.ts +19 -106
  53. package/dist/esm/types/src/components/ui/Sidebar/Sidebar.types.d.ts +41 -0
  54. package/dist/esm/types/src/components/ui/Sidebar/SidebarAside.d.ts +2 -0
  55. package/dist/esm/types/src/components/ui/Sidebar/SidebarContent/SidebarContent.d.ts +3 -0
  56. package/dist/esm/types/src/components/ui/Sidebar/SidebarFooter/SidebarFooter.d.ts +2 -0
  57. package/dist/esm/types/src/components/ui/Sidebar/SidebarGroup/SidebarGroup.d.ts +2 -0
  58. package/dist/esm/types/src/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.d.ts +4 -0
  59. package/dist/esm/types/src/components/ui/Sidebar/SidebarMenu/SidebarMenu.d.ts +4 -0
  60. package/dist/esm/types/src/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.d.ts +5 -0
  61. package/dist/esm/types/src/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.d.ts +10 -0
  62. package/dist/esm/types/src/components/ui/Sidebar/SidebarMenuSub/SidebarMenuSub.d.ts +3 -0
  63. package/dist/esm/types/src/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.d.ts +9 -0
  64. package/dist/esm/types/src/components/ui/Sidebar/SidebarProvider/SidebarProvider.d.ts +11 -0
  65. package/dist/esm/types/src/components/ui/Sidebar/SidebarRail/SidebarRail.d.ts +2 -0
  66. package/dist/esm/types/src/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.d.ts +4 -0
  67. package/dist/esm/types/src/components/ui/Sidebar/SidebarSeparator/SidebarSeparator.d.ts +3 -0
  68. package/dist/esm/types/src/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.d.ts +3 -0
  69. package/dist/esm/types/src/components/ui/Sidebar/sidebarConstants.d.ts +5 -0
  70. package/dist/esm/types/src/components/ui/Sidebar/sidebarContext.d.ts +7 -0
  71. package/dist/esm/types/src/components/ui/Sidebar/sidebarUtils.d.ts +3 -0
  72. package/package.json +1 -1
  73. package/src/components/ui/ChartAreaInteractive/AGENT.md +0 -4
  74. package/src/components/ui/Chat/ChatChrome/ChatChrome.tsx +5 -2
  75. package/src/components/ui/DropdownMenu/DropdownMenu.styl +4 -1
  76. package/src/components/ui/PanelResizeHandle/PanelResizeHandle.tsx +89 -0
  77. package/src/components/ui/Sidebar/Sidebar.styl +23 -621
  78. package/src/components/ui/Sidebar/Sidebar.styl.d.ts +0 -33
  79. package/src/components/ui/Sidebar/Sidebar.tsx +25 -1145
  80. package/src/components/ui/Sidebar/Sidebar.types.ts +46 -0
  81. package/src/components/ui/Sidebar/SidebarAside.tsx +92 -0
  82. package/src/components/ui/Sidebar/SidebarContent/SidebarContent.styl +27 -0
  83. package/src/components/ui/Sidebar/SidebarContent/SidebarContent.styl.d.ts +7 -0
  84. package/src/components/ui/Sidebar/SidebarContent/SidebarContent.tsx +29 -0
  85. package/src/components/ui/Sidebar/SidebarFooter/SidebarFooter.styl +7 -0
  86. package/src/components/ui/Sidebar/SidebarFooter/SidebarFooter.styl.d.ts +7 -0
  87. package/src/components/ui/Sidebar/SidebarFooter/SidebarFooter.tsx +15 -0
  88. package/src/components/ui/Sidebar/SidebarGroup/SidebarGroup.styl +10 -0
  89. package/src/components/ui/Sidebar/SidebarGroup/SidebarGroup.styl.d.ts +7 -0
  90. package/src/components/ui/Sidebar/SidebarGroup/SidebarGroup.tsx +15 -0
  91. package/src/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.styl +34 -0
  92. package/src/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.styl.d.ts +7 -0
  93. package/src/components/ui/Sidebar/SidebarGroupAction/SidebarGroupAction.tsx +23 -0
  94. package/src/components/ui/Sidebar/SidebarMenu/SidebarMenu.styl +60 -0
  95. package/src/components/ui/Sidebar/SidebarMenu/SidebarMenu.styl.d.ts +12 -0
  96. package/src/components/ui/Sidebar/SidebarMenu/SidebarMenu.tsx +40 -0
  97. package/src/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.styl +73 -0
  98. package/src/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.styl.d.ts +8 -0
  99. package/src/components/ui/Sidebar/SidebarMenuAction/SidebarMenuAction.tsx +31 -0
  100. package/src/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.styl +107 -0
  101. package/src/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.styl.d.ts +15 -0
  102. package/src/components/ui/Sidebar/SidebarMenuButton/SidebarMenuButton.tsx +82 -0
  103. package/src/components/ui/Sidebar/SidebarMenuSub/SidebarMenuSub.styl +39 -0
  104. package/src/components/ui/Sidebar/SidebarMenuSub/SidebarMenuSub.styl.d.ts +8 -0
  105. package/src/components/ui/Sidebar/SidebarMenuSub/SidebarMenuSub.tsx +29 -0
  106. package/src/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.styl +71 -0
  107. package/src/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.styl.d.ts +8 -0
  108. package/src/components/ui/Sidebar/SidebarMenuSubButton/SidebarMenuSubButton.tsx +80 -0
  109. package/src/components/ui/Sidebar/SidebarProvider/SidebarProvider.styl +45 -0
  110. package/src/components/ui/Sidebar/SidebarProvider/SidebarProvider.styl.d.ts +9 -0
  111. package/src/components/ui/Sidebar/SidebarProvider/SidebarProvider.tsx +447 -0
  112. package/src/components/ui/Sidebar/SidebarRail/SidebarRail.styl +42 -0
  113. package/src/components/ui/Sidebar/SidebarRail/SidebarRail.styl.d.ts +7 -0
  114. package/src/components/ui/Sidebar/SidebarRail/SidebarRail.tsx +22 -0
  115. package/src/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.styl +37 -0
  116. package/src/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.styl.d.ts +7 -0
  117. package/src/components/ui/Sidebar/SidebarResizeHandle/SidebarResizeHandle.tsx +54 -0
  118. package/src/components/ui/Sidebar/SidebarSeparator/SidebarSeparator.styl +7 -0
  119. package/src/components/ui/Sidebar/SidebarSeparator/SidebarSeparator.styl.d.ts +7 -0
  120. package/src/components/ui/Sidebar/SidebarSeparator/SidebarSeparator.tsx +20 -0
  121. package/src/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.styl +11 -0
  122. package/src/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.styl.d.ts +7 -0
  123. package/src/components/ui/Sidebar/SidebarTrigger/SidebarTrigger.tsx +34 -0
  124. package/src/components/ui/Sidebar/sidebarConstants.ts +6 -0
  125. package/src/components/ui/Sidebar/sidebarContext.tsx +46 -0
  126. package/src/components/ui/Sidebar/sidebarUtils.ts +47 -0
  127. package/src/components/widgets/DriverMap/AGENT.md +0 -4
  128. package/src/components/widgets/DriversComparisonChart/AGENT.md +0 -4
  129. package/src/components/widgets/PerformanceChart/AGENT.md +0 -4
  130. package/src/components/widgets/SidebarDatasetsItemsGrouped/AGENT.md +28 -11
  131. package/src/docs/components/DocsGuidance/DocsGuidance.styl +1 -0
  132. package/src/docs/components/DocsSidebar/DocsSidebar.tsx +14 -8
  133. package/src/docs/pages/SmartTextTruncatePage.styl +2 -14
  134. package/src/docs/pages/SmartTextTruncatePage.styl.d.ts +0 -1
  135. package/src/docs/pages/SmartTextTruncatePage.tsx +0 -6
  136. package/dist/esm/components/ui/Sidebar/Sidebar.js +0 -541
@@ -0,0 +1,34 @@
1
+ import cn from 'classnames';
2
+ import { ComponentProps } from 'react';
3
+
4
+ import { Button } from '#uilib/components/ui/Button';
5
+ import { PanelLeft } from 'lucide-react';
6
+
7
+ import S from './SidebarTrigger.styl';
8
+ import { useSidebarActions } from '../sidebarContext';
9
+
10
+ export function SidebarTrigger({
11
+ className,
12
+ onClick,
13
+ ...props
14
+ }: ComponentProps<typeof Button>) {
15
+ const { toggleSidebar } = useSidebarActions();
16
+
17
+ return (
18
+ <Button
19
+ data-sidebar="trigger"
20
+ data-slot="sidebar-trigger"
21
+ variant="ghost"
22
+ icon
23
+ className={cn(S.sidebarTrigger, className)}
24
+ onClick={event => {
25
+ onClick?.(event);
26
+ toggleSidebar();
27
+ }}
28
+ {...props}
29
+ >
30
+ <PanelLeft size={20} strokeWidth={1.5} className="text-foreground" />
31
+ {/* <span className="sr-only">Toggle Sidebar</span> */}
32
+ </Button>
33
+ );
34
+ }
@@ -0,0 +1,6 @@
1
+ export const SIDEBAR_WIDTH_MOBILE = '18rem';
2
+ export const SIDEBAR_WIDTH_ICON = '3rem';
3
+ export const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
4
+
5
+ /** Fired when nav open closes chat for layout; ChatSheet clears `?chat=` so URL sync does not reopen chat. */
6
+ export const DISMISS_CHAT_FOR_LAYOUT_EVENT = 'sybilion:dismiss-chat-for-layout';
@@ -0,0 +1,46 @@
1
+ import { createContext, useContext, useMemo } from 'react';
2
+
3
+ import type {
4
+ SidebarActionsContextProps,
5
+ SidebarContextProps,
6
+ SidebarStateContextProps,
7
+ } from './Sidebar.types';
8
+
9
+ const SidebarActionsContext = createContext<SidebarActionsContextProps | null>(
10
+ null,
11
+ );
12
+ const SidebarStateContext = createContext<SidebarStateContextProps | null>(
13
+ null,
14
+ );
15
+
16
+ export function useSidebarActions() {
17
+ const context = useContext(SidebarActionsContext);
18
+ if (!context) {
19
+ throw new Error('useSidebarActions must be used within a SidebarProvider.');
20
+ }
21
+
22
+ return context;
23
+ }
24
+
25
+ export function useSidebarState() {
26
+ const context = useContext(SidebarStateContext);
27
+ if (!context) {
28
+ throw new Error('useSidebarState must be used within a SidebarProvider.');
29
+ }
30
+
31
+ return context;
32
+ }
33
+
34
+ export function useSidebar(): SidebarContextProps {
35
+ const actions = useSidebarActions();
36
+ const state = useSidebarState();
37
+ return useMemo(
38
+ () => ({
39
+ ...state,
40
+ ...actions,
41
+ }),
42
+ [state, actions],
43
+ );
44
+ }
45
+
46
+ export { SidebarActionsContext, SidebarStateContext };
@@ -0,0 +1,47 @@
1
+ import {
2
+ CHAT_WIDTH_DEFAULT_PX,
3
+ CHAT_WIDTH_MIN_PX,
4
+ CHAT_WIDTH_STORAGE_KEY,
5
+ SIDEBAR_WIDTH_DEFAULT_PX,
6
+ SIDEBAR_WIDTH_MIN_PX,
7
+ SIDEBAR_WIDTH_STORAGE_KEY_PCT,
8
+ SIDEBAR_WIDTH_STORAGE_KEY_PX,
9
+ clampSidebarWidthPx,
10
+ defaultChatWidthPx,
11
+ } from '#uilib/hooks/panelWidth';
12
+ import { LS } from '@homecode/ui';
13
+
14
+ export function isEditableKeyboardTarget(el: Element | null): boolean {
15
+ if (!el) return false;
16
+ if (el instanceof HTMLElement && el.isContentEditable) return true;
17
+ const tag = el.tagName;
18
+ return tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT';
19
+ }
20
+
21
+ export function readInitialSidebarWidthPx(storageKeyPx: string): number {
22
+ if (typeof window === 'undefined') return SIDEBAR_WIDTH_DEFAULT_PX;
23
+ const stored = LS.get(storageKeyPx);
24
+ if (typeof stored === 'number' && stored >= SIDEBAR_WIDTH_MIN_PX) {
25
+ return stored;
26
+ }
27
+ if (storageKeyPx === SIDEBAR_WIDTH_STORAGE_KEY_PX) {
28
+ const legacyPct = LS.get(SIDEBAR_WIDTH_STORAGE_KEY_PCT);
29
+ if (typeof legacyPct === 'number' && legacyPct > 0) {
30
+ const w = window.innerWidth;
31
+ return clampSidebarWidthPx(Math.round((legacyPct / 100) * w), w, {
32
+ chatPanelOpen: false,
33
+ chatWidthPx: 0,
34
+ });
35
+ }
36
+ }
37
+ return SIDEBAR_WIDTH_DEFAULT_PX;
38
+ }
39
+
40
+ export function readInitialChatWidthPx(): number {
41
+ if (typeof window === 'undefined') return CHAT_WIDTH_DEFAULT_PX;
42
+ const stored = LS.get(CHAT_WIDTH_STORAGE_KEY);
43
+ if (typeof stored === 'number' && stored >= CHAT_WIDTH_MIN_PX) {
44
+ return stored;
45
+ }
46
+ return defaultChatWidthPx(window.innerWidth);
47
+ }
@@ -18,10 +18,6 @@ DriverMap renders a world map with regional driver badges, a bottom strip for wo
18
18
  - Pass isLoading to both the map and the card so their loading states stay in sync.
19
19
  - Provide a driverSelector in DriverCard so users can page through drivers without using the map.
20
20
 
21
- ## Report tile
22
-
23
- - `drivers_map` — tile resolves analysis id, fetches drivers, passes list + selection.
24
-
25
21
  ## Host provides
26
22
 
27
23
  - `drivers` as `DriverData[]` from analysis API
@@ -16,10 +16,6 @@ DriversComparisonChart plots a normalized target line against the normalized ser
16
16
  - Provide a statusHint when the payload is empty so users understand why the chart is blank.
17
17
  - Control viewTab from the page when an external Lagged/Overlapped switcher should stay in sync.
18
18
 
19
- ## Report tile
20
-
21
- - `drivers_comparison_chart` — host loads normalized backtests payload + dataset historical.
22
-
23
19
  ## Host provides
24
20
 
25
21
  - `payload`: BacktestsComponentPayload from platform SDK (host fetch per analysis)
@@ -14,10 +14,6 @@ PerformanceChart is a widget for evaluating forecast accuracy. It plots per-hori
14
14
 
15
15
  - Wire the loading, empty, and hint props to your data-fetch state so the widget shows the right placeholder.
16
16
 
17
- ## Report tile
18
-
19
- - `performance_chart` — host loads performance payload + dataset series.
20
-
21
17
  ## Host provides
22
18
 
23
19
  - `performanceData` (PerformanceChartPayload) and `historicalData` from performance API
@@ -1,18 +1,35 @@
1
- # SidebarDatasetsItemsGrouped
1
+ SidebarDatasetsItemsGrouped renders expandable sidebar groups of datasets, bucketed by target type, region, or category. Each group toggles open to show dataset links with selection highlight; the group containing the selected dataset opens automatically.
2
2
 
3
- Renders: expandable sidebar groups of datasets (by target type, regions, or categories).
3
+ ## When to use
4
4
 
5
- Use when: app shell needs grouped dataset navigation.
6
- Not when: in-page or report content (no sidebar slot).
5
+ - When the app shell sidebar needs grouped dataset navigation instead of a flat list.
6
+ - To let users browse datasets by target type, region, or category with collapsible sections.
7
+ - When selection should highlight both the active dataset and its parent group.
8
+ - Alongside `preItems` / `postItems` to sandwich custom nav entries around the grouped list.
7
9
 
8
- Host provides:
10
+ ## When not to use
9
11
 
10
- - `datasets` list (`SidebarDatasetsItemsGroupedDataset`)
11
- - `groupBy`, `selectedDatasetId`, `onDatasetClick`
12
- - Optional `preItems` / `postItems`, `defaultExpandedGroupNames`
12
+ - In-page or report content where no sidebar slot exists.
13
+ - For a flat dataset list without grouping; render individual `SidebarMenuItem` entries instead.
14
+ - When datasets lack the metadata needed for the chosen `groupBy` key (regions, categories, or target type).
13
15
 
14
- Report tile: Not used in report tiles.
16
+ ## Do
15
17
 
16
- Requires: `datasets`; `groupBy`; `onDatasetClick` for navigation.
18
+ - Pass `selectedDatasetId` and `onDatasetClick` so clicks navigate and the active dataset stays highlighted.
19
+ - Set `defaultExpandedGroupNames` when specific groups should start open; omit it to start collapsed and rely on auto-expand for the selected dataset's group.
20
+ - Handle loading before passing `datasets`; the widget has no built-in loading state.
17
21
 
18
- Empty/loading: empty `datasets` renders no groups; loading handled by host before pass-in.
22
+ ## Host provides
23
+
24
+ - `datasets` as `SidebarDatasetsItemsGroupedDataset[]` from the datasets API
25
+ - `groupBy` — `'target_type'`, `'regions'`, or `'categories'`
26
+ - `selectedDatasetId` and `onDatasetClick` for controlled navigation
27
+ - Optional `preItems` / `postItems`, `defaultExpandedGroupNames`, `className`
28
+
29
+ ## Requires
30
+
31
+ - `datasets`; `groupBy`; `onDatasetClick` for navigation.
32
+
33
+ ## Empty/loading
34
+
35
+ - Empty `datasets` renders no groups; loading is handled by the host before pass-in.
@@ -2,6 +2,7 @@
2
2
  display block
3
3
  padding-top var(--p-1)
4
4
  padding-bottom var(--p-10)
5
+ user-select text
5
6
 
6
7
  .markdown
7
8
  display block
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useMemo, useState } from 'react';
2
- import { Link, useLocation } from 'react-router-dom';
2
+ import { Link, useLocation, useNavigate } from 'react-router-dom';
3
3
 
4
4
  import { Input } from '#uilib/components/ui/Input';
5
5
  import {
@@ -53,7 +53,7 @@ export function DocsSidebar() {
53
53
  const [sidebarSearch, setSidebarSearch] = useState('');
54
54
  const q = sidebarSearch.trim().toLowerCase();
55
55
  const isFiltering = q.length > 0;
56
-
56
+ const navigate = useNavigate();
57
57
  const activeSection = useMemo(
58
58
  () => sectionForPathname(location.pathname),
59
59
  [location.pathname],
@@ -80,6 +80,14 @@ export function DocsSidebar() {
80
80
  });
81
81
  };
82
82
 
83
+ const handleSubItemClick = (
84
+ e: React.MouseEvent<HTMLAnchorElement>,
85
+ to: string,
86
+ ) => {
87
+ e.preventDefault();
88
+ navigate(to);
89
+ };
90
+
83
91
  return (
84
92
  <Sidebar
85
93
  variant="inset"
@@ -126,7 +134,7 @@ export function DocsSidebar() {
126
134
  >
127
135
  {section}
128
136
  </SidebarMenuButton>
129
- {isExpanded ? (
137
+ {isExpanded && (
130
138
  <SidebarMenuSub>
131
139
  {filteredEntries.map(e => {
132
140
  const to = `/docs/${e.slug}`;
@@ -134,19 +142,17 @@ export function DocsSidebar() {
134
142
  return (
135
143
  <SidebarMenuSubItem key={e.slug}>
136
144
  <SidebarMenuSubButton
137
- asChild
138
145
  isActive={isActive}
139
146
  size="md"
147
+ onClick={e => handleSubItemClick(e, to)}
140
148
  >
141
- <Link to={to}>
142
- <SmartTextTruncate>{e.title}</SmartTextTruncate>
143
- </Link>
149
+ {e.title}
144
150
  </SidebarMenuSubButton>
145
151
  </SidebarMenuSubItem>
146
152
  );
147
153
  })}
148
154
  </SidebarMenuSub>
149
- ) : null}
155
+ )}
150
156
  </SidebarMenuItem>
151
157
  );
152
158
  })}
@@ -3,29 +3,16 @@
3
3
  color var(--muted-foreground)
4
4
  font-size 0.875rem
5
5
 
6
- .resizableDemo
7
- resize horizontal
8
- overflow auto
9
- width 200px
10
- min-width 60px
11
- max-width 100%
12
- border 1px solid var(--border)
13
- border-radius var(--p-2)
14
- padding var(--p-2)
15
- margin-bottom var(--p-6)
16
-
17
6
  .resizableListDemo
18
7
  resize horizontal
19
8
  overflow auto
20
9
  width 280px
21
10
  min-width 120px
22
11
  max-width 100%
12
+ max-height 300px
23
13
  border 1px solid var(--border)
24
14
  border-radius var(--p-2)
25
15
  padding var(--p-2)
26
- display flex
27
- flex-direction column
28
- gap var(--p-1)
29
16
 
30
17
  &:active
31
18
  border 1px solid var(--brand-color)
@@ -33,3 +20,4 @@
33
20
  .demoText
34
21
  display block
35
22
  width 100%
23
+ margin-bottom var(--p-1)
@@ -2,7 +2,6 @@
2
2
  // Please do not change this file!
3
3
  interface CssExports {
4
4
  'demoText': string;
5
- 'resizableDemo': string;
6
5
  'resizableListDemo': string;
7
6
  'sectionLabel': string;
8
7
  }
@@ -28,12 +28,6 @@ export default function SmartTextTruncatePage() {
28
28
  />
29
29
  <DocsGuidance source={smartTextTruncateGuidance} />
30
30
  <PageContentSection>
31
- <p className={S.sectionLabel}>Single item</p>
32
- <div className={S.resizableDemo} data-smart-text-truncate-resize-root>
33
- <SmartTextTruncate className={S.demoText}>{LONG}</SmartTextTruncate>
34
- </div>
35
-
36
- <p className={S.sectionLabel}>List stress test (50 items)</p>
37
31
  <div
38
32
  className={S.resizableListDemo}
39
33
  data-smart-text-truncate-resize-root