@eventcatalog/core 2.47.1 → 2.48.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/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/catalog-to-astro-content-directory.cjs +16 -1
- package/dist/catalog-to-astro-content-directory.js +2 -2
- package/dist/{chunk-SFA7F3CQ.js → chunk-IZMM7ZGY.js} +8 -1
- package/dist/{chunk-EXAALOQA.js → chunk-LDBRNJIL.js} +9 -1
- package/dist/{chunk-QWDFTW7H.js → chunk-M35UFAGG.js} +1 -1
- package/dist/{chunk-WWYOMQLW.js → chunk-WAVFA46U.js} +1 -1
- package/dist/{chunk-DCLTVJDP.js → chunk-XE6PFSH5.js} +2 -2
- package/dist/{chunk-YJYT2E6S.js → chunk-ZI5ZP7I2.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +54 -40
- package/dist/eventcatalog.js +6 -6
- package/dist/map-catalog-to-astro.cjs +9 -1
- package/dist/map-catalog-to-astro.js +1 -1
- package/dist/watcher.cjs +14 -17
- package/dist/watcher.js +2 -3
- package/eventcatalog/src/components/SideNav/ListViewSideBar/components/MessageList.tsx +1 -0
- package/eventcatalog/src/components/SideNav/ListViewSideBar/components/SpecificationList.tsx +2 -0
- package/eventcatalog/src/components/SideNav/ListViewSideBar/index.tsx +310 -106
- package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/index.tsx +86 -7
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +10 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +0 -2
- package/eventcatalog/tsconfig.json +1 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import { ChevronDoubleDownIcon, ChevronDoubleUpIcon } from '@heroicons/react/24/outline';
|
|
2
3
|
import { buildUrl } from '@utils/url-builder';
|
|
3
4
|
import type { CustomDocsNavProps, SidebarSection, SidebarItem } from './types';
|
|
4
5
|
import NestedItem from './components/NestedItem';
|
|
@@ -12,6 +13,7 @@ const CustomDocsNav: React.FC<CustomDocsNavProps> = ({ sidebarItems }) => {
|
|
|
12
13
|
const [searchTerm, setSearchTerm] = useState('');
|
|
13
14
|
const [debouncedSearchTerm, setDebouncedSearchTerm] = useState('');
|
|
14
15
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
16
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
15
17
|
const [collapsedGroups, setCollapsedGroups] = useState<{ [key: string]: boolean }>(() => {
|
|
16
18
|
if (typeof window !== 'undefined') {
|
|
17
19
|
const saved = window.localStorage.getItem(STORAGE_KEY);
|
|
@@ -126,6 +128,70 @@ const CustomDocsNav: React.FC<CustomDocsNavProps> = ({ sidebarItems }) => {
|
|
|
126
128
|
setSearchTerm(e.target.value);
|
|
127
129
|
}, []);
|
|
128
130
|
|
|
131
|
+
const collapseAll = useCallback(() => {
|
|
132
|
+
const newCollapsedState: { [key: string]: boolean } = {};
|
|
133
|
+
|
|
134
|
+
// Collapse all sections
|
|
135
|
+
filteredSidebarItems.forEach((section, index) => {
|
|
136
|
+
const sectionKey = `section-${index}`;
|
|
137
|
+
newCollapsedState[sectionKey] = true;
|
|
138
|
+
|
|
139
|
+
// Collapse all nested items in the section
|
|
140
|
+
const collapseNestedItems = (items: SidebarItem[], parentId: string) => {
|
|
141
|
+
items.forEach((item, itemIndex) => {
|
|
142
|
+
if (item.items && item.items.length > 0) {
|
|
143
|
+
const itemKey = `${parentId}-${itemIndex}`;
|
|
144
|
+
newCollapsedState[itemKey] = true;
|
|
145
|
+
collapseNestedItems(item.items, itemKey);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
if (section.items) {
|
|
151
|
+
collapseNestedItems(section.items, sectionKey);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
setCollapsedGroups(newCollapsedState);
|
|
156
|
+
setIsExpanded(false);
|
|
157
|
+
}, [filteredSidebarItems]);
|
|
158
|
+
|
|
159
|
+
const expandAll = useCallback(() => {
|
|
160
|
+
const newCollapsedState: { [key: string]: boolean } = {};
|
|
161
|
+
|
|
162
|
+
// Expand all sections
|
|
163
|
+
filteredSidebarItems.forEach((section, index) => {
|
|
164
|
+
const sectionKey = `section-${index}`;
|
|
165
|
+
newCollapsedState[sectionKey] = false;
|
|
166
|
+
|
|
167
|
+
// Expand all nested items in the section
|
|
168
|
+
const expandNestedItems = (items: SidebarItem[], parentId: string) => {
|
|
169
|
+
items.forEach((item, itemIndex) => {
|
|
170
|
+
if (item.items && item.items.length > 0) {
|
|
171
|
+
const itemKey = `${parentId}-${itemIndex}`;
|
|
172
|
+
newCollapsedState[itemKey] = false;
|
|
173
|
+
expandNestedItems(item.items, itemKey);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
if (section.items) {
|
|
179
|
+
expandNestedItems(section.items, sectionKey);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
setCollapsedGroups(newCollapsedState);
|
|
184
|
+
setIsExpanded(true);
|
|
185
|
+
}, [filteredSidebarItems]);
|
|
186
|
+
|
|
187
|
+
const toggleExpandCollapse = useCallback(() => {
|
|
188
|
+
if (isExpanded) {
|
|
189
|
+
collapseAll();
|
|
190
|
+
} else {
|
|
191
|
+
expandAll();
|
|
192
|
+
}
|
|
193
|
+
}, [isExpanded, collapseAll, expandAll]);
|
|
194
|
+
|
|
129
195
|
if (!isInitialized) return null;
|
|
130
196
|
|
|
131
197
|
const hasNoResults = debouncedSearchTerm && filteredSidebarItems.length === 0;
|
|
@@ -133,13 +199,26 @@ const CustomDocsNav: React.FC<CustomDocsNavProps> = ({ sidebarItems }) => {
|
|
|
133
199
|
return (
|
|
134
200
|
<nav ref={navRef} className="h-full text-gray-800 pt-4 overflow-y-auto">
|
|
135
201
|
<div className="mb-2 px-3 bg-white z-10">
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
202
|
+
<div className="flex gap-2">
|
|
203
|
+
<input
|
|
204
|
+
type="text"
|
|
205
|
+
value={searchTerm}
|
|
206
|
+
onChange={handleSearchChange}
|
|
207
|
+
placeholder="Quick search..."
|
|
208
|
+
className="flex-1 p-2 px-2 text-sm rounded-md border border-gray-200 h-[30px]"
|
|
209
|
+
/>
|
|
210
|
+
<button
|
|
211
|
+
onClick={toggleExpandCollapse}
|
|
212
|
+
title={isExpanded ? 'Collapse All' : 'Expand All'}
|
|
213
|
+
className="px-2 py-1 bg-gray-100 hover:bg-gray-200 rounded-md border border-gray-200 h-[30px] flex items-center justify-center"
|
|
214
|
+
>
|
|
215
|
+
{isExpanded ? (
|
|
216
|
+
<ChevronDoubleUpIcon className="h-4 w-4 text-gray-600" />
|
|
217
|
+
) : (
|
|
218
|
+
<ChevronDoubleDownIcon className="h-4 w-4 text-gray-600" />
|
|
219
|
+
)}
|
|
220
|
+
</button>
|
|
221
|
+
</div>
|
|
143
222
|
</div>
|
|
144
223
|
|
|
145
224
|
<div className="space-y-2 divide-y divide-gray-100/40 pb-4">
|
|
@@ -454,5 +454,15 @@ const canPageBeEmbedded = process.env.ENABLE_EMBED === 'true';
|
|
|
454
454
|
}
|
|
455
455
|
});
|
|
456
456
|
}
|
|
457
|
+
|
|
458
|
+
// Listen for custom sidebar toggle event from React components
|
|
459
|
+
window.addEventListener('sidebarToggle', (event) => {
|
|
460
|
+
const { action } = event.detail;
|
|
461
|
+
if (action === 'hide') {
|
|
462
|
+
hideSidebar();
|
|
463
|
+
} else if (action === 'show') {
|
|
464
|
+
showSidebar();
|
|
465
|
+
}
|
|
466
|
+
});
|
|
457
467
|
});
|
|
458
468
|
</script>
|
|
@@ -33,7 +33,6 @@ import { ArrowsRightLeftIcon } from '@heroicons/react/20/solid';
|
|
|
33
33
|
import { Box, Boxes } from 'lucide-react';
|
|
34
34
|
import type { CollectionTypes } from '@types';
|
|
35
35
|
|
|
36
|
-
import { ClientRouter } from 'astro:transitions';
|
|
37
36
|
import { render } from 'astro:content';
|
|
38
37
|
import type { CollectionEntry } from 'astro:content';
|
|
39
38
|
|
|
@@ -363,7 +362,6 @@ nodeGraphs.push({
|
|
|
363
362
|
{props?.collection === 'entities' && <EntitySideBar entity={props} />}
|
|
364
363
|
</aside>
|
|
365
364
|
</div>
|
|
366
|
-
<ClientRouter />
|
|
367
365
|
</main>
|
|
368
366
|
|
|
369
367
|
<style is:global>
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"@icons/*": ["src/icons/*"],
|
|
10
10
|
"@components/*": ["src/components/*"],
|
|
11
11
|
"@catalog/components/*": ["src/custom-defined-components/*"],
|
|
12
|
+
"@catalog/snippets/*": ["src/snippets/*"],
|
|
12
13
|
"@types": ["src/types/index.ts"],
|
|
13
14
|
"@utils/*": ["src/utils/*"],
|
|
14
15
|
"@layouts/*": ["src/layouts/*"],
|