@redocly/theme 0.58.0-next.9 → 0.59.0-next.0
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/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +5 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +4 -4
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.d.ts +5 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +9 -7
- package/lib/components/CodeBlock/CodeBlock.d.ts +5 -12
- package/lib/components/CodeBlock/CodeBlockControls.d.ts +3 -3
- package/lib/components/CodeBlock/CodeBlockControls.js +1 -1
- package/lib/components/CodeBlock/CodeBlockDropdown.d.ts +2 -2
- package/lib/components/CodeBlock/CodeBlockDropdown.js +4 -13
- package/lib/components/CodeBlock/CodeBlockTabs.d.ts +2 -2
- package/lib/components/CodeBlock/CodeBlockTabs.js +4 -3
- package/lib/components/JsonViewer/JsonViewer.d.ts +1 -1
- package/lib/components/JsonViewer/JsonViewer.js +9 -10
- package/lib/components/PageActions/PageActions.d.ts +4 -1
- package/lib/components/PageActions/PageActions.js +2 -2
- package/lib/components/Panel/variables.js +1 -0
- package/lib/components/Tag/Tag.d.ts +3 -2
- package/lib/components/Tag/Tag.js +21 -5
- package/lib/components/Tag/variables.dark.js +135 -0
- package/lib/components/Tag/variables.js +120 -58
- package/lib/core/constants/catalog.js +4 -0
- package/lib/core/contexts/CodeSnippetContext.d.ts +14 -6
- package/lib/core/contexts/CodeSnippetContext.js +57 -14
- package/lib/core/hooks/use-codeblock-tabs-controls.d.ts +2 -2
- package/lib/core/hooks/use-local-state.js +22 -18
- package/lib/core/hooks/use-page-actions.d.ts +2 -1
- package/lib/core/hooks/use-page-actions.js +48 -6
- package/lib/core/hooks/use-tabs.d.ts +11 -6
- package/lib/core/hooks/use-tabs.js +117 -207
- package/lib/core/openapi/index.d.ts +1 -0
- package/lib/core/openapi/index.js +3 -1
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/open-api-server.d.ts +1 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/core/utils/tabs.d.ts +1 -0
- package/lib/core/utils/tabs.js +8 -0
- package/lib/icons/CursorIcon/CursorIcon.d.ts +9 -0
- package/lib/icons/CursorIcon/CursorIcon.js +22 -0
- package/lib/layouts/DocumentationLayout.js +1 -3
- package/lib/markdoc/components/CodeGroup/CodeGroup.js +49 -27
- package/lib/markdoc/components/Tabs/Tab.js +1 -1
- package/lib/markdoc/components/Tabs/TabList.d.ts +2 -14
- package/lib/markdoc/components/Tabs/TabList.js +65 -16
- package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -2
- package/lib/markdoc/components/Tabs/Tabs.js +11 -87
- package/lib/markdoc/tags/tabs.js +5 -0
- package/package.json +4 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +15 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +3 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +27 -18
- package/src/components/CodeBlock/CodeBlock.tsx +5 -11
- package/src/components/CodeBlock/CodeBlockControls.tsx +4 -7
- package/src/components/CodeBlock/CodeBlockDropdown.tsx +11 -20
- package/src/components/CodeBlock/CodeBlockTabs.tsx +8 -8
- package/src/components/JsonViewer/JsonViewer.tsx +16 -9
- package/src/components/PageActions/PageActions.tsx +6 -4
- package/src/components/Panel/variables.ts +1 -0
- package/src/components/Tag/Tag.tsx +33 -8
- package/src/components/Tag/variables.dark.ts +135 -0
- package/src/components/Tag/variables.ts +120 -58
- package/src/core/constants/catalog.ts +4 -0
- package/src/core/contexts/CodeSnippetContext.tsx +54 -18
- package/src/core/hooks/use-codeblock-tabs-controls.ts +2 -2
- package/src/core/hooks/use-local-state.ts +28 -19
- package/src/core/hooks/use-page-actions.ts +63 -6
- package/src/core/hooks/use-tabs.ts +160 -238
- package/src/core/openapi/index.ts +1 -0
- package/src/core/types/l10n.ts +13 -0
- package/src/core/types/open-api-server.ts +1 -0
- package/src/core/utils/index.ts +1 -0
- package/src/core/utils/tabs.ts +4 -0
- package/src/icons/CursorIcon/CursorIcon.tsx +35 -0
- package/src/layouts/DocumentationLayout.tsx +3 -10
- package/src/markdoc/components/CodeGroup/CodeGroup.tsx +81 -52
- package/src/markdoc/components/Tabs/Tab.tsx +1 -0
- package/src/markdoc/components/Tabs/TabList.tsx +85 -30
- package/src/markdoc/components/Tabs/Tabs.tsx +12 -125
- package/src/markdoc/tags/tabs.ts +5 -0
|
@@ -1,98 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useActiveTab = void 0;
|
|
3
4
|
exports.useTabs = useTabs;
|
|
4
5
|
const react_1 = require("react");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const [
|
|
6
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
7
|
+
const MORE_BUTTON_WIDTH = 80;
|
|
8
|
+
const TABS_GAP = 8;
|
|
9
|
+
function useTabs({ activeTab, onTabChange, totalTabs, containerRef }) {
|
|
10
|
+
const [tabs, setTabs] = (0, react_1.useState)({
|
|
11
|
+
visible: Array.from({ length: totalTabs }, (_, i) => i),
|
|
12
|
+
overflow: [],
|
|
13
|
+
});
|
|
10
14
|
const tabRefs = (0, react_1.useRef)([]);
|
|
15
|
+
const tabWidthsRef = (0, react_1.useRef)([]);
|
|
11
16
|
const tabLabelsRef = (0, react_1.useRef)([]);
|
|
12
|
-
const
|
|
13
|
-
const [ready, setReady] = (0, react_1.useState)(false);
|
|
14
|
-
const hasCalculatedOnce = (0, react_1.useRef)(false);
|
|
15
|
-
const lastWidthRef = (0, react_1.useRef)(0);
|
|
16
|
-
const originalOrderRef = (0, react_1.useRef)([]);
|
|
17
|
-
(0, react_1.useEffect)(() => {
|
|
18
|
-
originalOrderRef.current = Array.from({ length: totalTabs }, (_, i) => i);
|
|
19
|
-
}, [totalTabs]);
|
|
17
|
+
const allTabsHidden = (0, react_1.useMemo)(() => tabs.visible.length === 0, [tabs.visible]);
|
|
20
18
|
const setTabRef = (0, react_1.useCallback)((element, index) => {
|
|
21
19
|
tabRefs.current[index] = element;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
const width = element === null || element === void 0 ? void 0 : element.offsetWidth;
|
|
21
|
+
if (width) {
|
|
22
|
+
tabWidthsRef.current[index] = width;
|
|
23
|
+
}
|
|
24
|
+
const label = element === null || element === void 0 ? void 0 : element.getAttribute('data-label');
|
|
25
|
+
if (label) {
|
|
26
|
+
tabLabelsRef.current[index] = label;
|
|
27
27
|
}
|
|
28
|
-
}, []);
|
|
29
|
-
const getTabId = (0, react_1.useCallback)((label, index) => {
|
|
30
|
-
const cleanLabel = label.replace(/\s+/g, '-').toLowerCase();
|
|
31
|
-
return `${cleanLabel}-${index}`;
|
|
32
28
|
}, []);
|
|
33
29
|
const focusTab = (index) => {
|
|
34
30
|
const currentElement = tabRefs.current[index];
|
|
35
|
-
|
|
36
|
-
currentElement.focus();
|
|
37
|
-
}
|
|
31
|
+
currentElement === null || currentElement === void 0 ? void 0 : currentElement.focus();
|
|
38
32
|
};
|
|
39
33
|
const onTabSelect = (0, react_1.useCallback)((index) => {
|
|
40
34
|
var _a;
|
|
41
35
|
focusTab(index);
|
|
42
36
|
const label = (_a = tabRefs.current[index]) === null || _a === void 0 ? void 0 : _a.getAttribute('data-label');
|
|
43
37
|
if (label)
|
|
44
|
-
|
|
45
|
-
}, []);
|
|
46
|
-
const onTabClick = (0, react_1.useCallback)((labelOrIndex) => {
|
|
47
|
-
var _a;
|
|
48
|
-
let clickedIndex;
|
|
49
|
-
if (typeof labelOrIndex === 'string') {
|
|
50
|
-
clickedIndex = tabRefs.current.findIndex((ref) => (ref === null || ref === void 0 ? void 0 : ref.getAttribute('data-label')) === labelOrIndex);
|
|
51
|
-
if (clickedIndex === -1)
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
clickedIndex = labelOrIndex;
|
|
56
|
-
}
|
|
57
|
-
if (allTabsHidden) {
|
|
58
|
-
const label = tabLabelsRef.current[clickedIndex];
|
|
59
|
-
if (label) {
|
|
60
|
-
setActiveTab(label);
|
|
61
|
-
focusTab(clickedIndex);
|
|
62
|
-
}
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (overflowTabs.includes(clickedIndex)) {
|
|
66
|
-
const newVisibleTabs = [...visibleTabs];
|
|
67
|
-
const newOverflowTabs = [...overflowTabs];
|
|
68
|
-
const clickedIdxInOverflow = newOverflowTabs.indexOf(clickedIndex);
|
|
69
|
-
if (clickedIdxInOverflow !== -1) {
|
|
70
|
-
newOverflowTabs.splice(clickedIdxInOverflow, 1);
|
|
71
|
-
}
|
|
72
|
-
const lastVisible = newVisibleTabs.pop();
|
|
73
|
-
if (lastVisible !== undefined) {
|
|
74
|
-
newOverflowTabs.unshift(lastVisible);
|
|
75
|
-
}
|
|
76
|
-
newVisibleTabs.push(clickedIndex);
|
|
77
|
-
setVisibleTabs(newVisibleTabs);
|
|
78
|
-
setOverflowTabs(newOverflowTabs);
|
|
79
|
-
requestAnimationFrame(() => {
|
|
80
|
-
var _a;
|
|
81
|
-
const label = (_a = tabRefs.current[clickedIndex]) === null || _a === void 0 ? void 0 : _a.getAttribute('data-label');
|
|
82
|
-
if (label) {
|
|
83
|
-
setActiveTab(label);
|
|
84
|
-
focusTab(clickedIndex);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
const label = (_a = tabRefs.current[clickedIndex]) === null || _a === void 0 ? void 0 : _a.getAttribute('data-label');
|
|
90
|
-
if (label) {
|
|
91
|
-
setActiveTab(label);
|
|
92
|
-
focusTab(clickedIndex);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}, [visibleTabs, overflowTabs, allTabsHidden]);
|
|
38
|
+
onTabChange(label);
|
|
39
|
+
}, [onTabChange]);
|
|
96
40
|
const handleKeyboard = (0, react_1.useCallback)((event, index) => {
|
|
97
41
|
let newIndex = index;
|
|
98
42
|
if (event.key === 'ArrowRight') {
|
|
@@ -114,168 +58,134 @@ function useTabs({ initialTab, totalTabs, containerRef }) {
|
|
|
114
58
|
}
|
|
115
59
|
onTabSelect(newIndex);
|
|
116
60
|
}, [totalTabs, onTabSelect]);
|
|
61
|
+
const replaceLastVisibleTabWithClickedOverflowTab = (0, react_1.useCallback)((clickedIndex) => {
|
|
62
|
+
const { visible: visibleTabs, overflow: overflowTabs } = tabs;
|
|
63
|
+
// Indexes of visible tabs should be sorted(asc), to replace the last visible tab with the clicked tab
|
|
64
|
+
const newVisibleTabs = [...visibleTabs].sort((a, b) => a - b);
|
|
65
|
+
const newOverflowTabs = [...overflowTabs];
|
|
66
|
+
const clickedIdxInOverflow = newOverflowTabs.indexOf(clickedIndex);
|
|
67
|
+
if (clickedIdxInOverflow !== -1) {
|
|
68
|
+
const lastVisible = newVisibleTabs[newVisibleTabs.length - 1];
|
|
69
|
+
newOverflowTabs.splice(clickedIdxInOverflow, 1);
|
|
70
|
+
newOverflowTabs.unshift(lastVisible);
|
|
71
|
+
newVisibleTabs.splice(newVisibleTabs.length - 1, 1);
|
|
72
|
+
newVisibleTabs.unshift(clickedIndex);
|
|
73
|
+
}
|
|
74
|
+
setTabs({
|
|
75
|
+
visible: newVisibleTabs,
|
|
76
|
+
overflow: newOverflowTabs,
|
|
77
|
+
});
|
|
78
|
+
}, [tabs]);
|
|
79
|
+
const onTabClick = (0, react_1.useCallback)((labelOrIndex) => {
|
|
80
|
+
const clickedIndex = typeof labelOrIndex === 'string'
|
|
81
|
+
? tabRefs.current.findIndex((ref) => (ref === null || ref === void 0 ? void 0 : ref.getAttribute('data-label')) === labelOrIndex)
|
|
82
|
+
: labelOrIndex;
|
|
83
|
+
if (clickedIndex === -1)
|
|
84
|
+
return;
|
|
85
|
+
const hasOverflowTabs = tabs.overflow.length > 0;
|
|
86
|
+
if (hasOverflowTabs && !allTabsHidden && tabs.overflow.includes(clickedIndex)) {
|
|
87
|
+
replaceLastVisibleTabWithClickedOverflowTab(clickedIndex);
|
|
88
|
+
}
|
|
89
|
+
const label = tabLabelsRef.current[clickedIndex];
|
|
90
|
+
if (label) {
|
|
91
|
+
onTabChange(label);
|
|
92
|
+
focusTab(clickedIndex);
|
|
93
|
+
}
|
|
94
|
+
}, [allTabsHidden, tabs.overflow, onTabChange, replaceLastVisibleTabWithClickedOverflowTab]);
|
|
117
95
|
const calculateVisibleTabs = (0, react_1.useCallback)(() => {
|
|
118
96
|
const container = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
119
97
|
if (!container)
|
|
120
98
|
return;
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
setVisibleTabs(Array.from({ length: totalTabs }, (_, i) => i));
|
|
124
|
-
setOverflowTabs([]);
|
|
125
|
-
setAllTabsHidden(false);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const containerWidth = container.offsetWidth - 60;
|
|
129
|
-
const tabElements = container.querySelectorAll('[role="tab"]');
|
|
130
|
-
const moreButtonWidth = 80;
|
|
131
|
-
const safetyMargin = 20;
|
|
132
|
-
const tabWidths = Array.from(tabElements).map((el) => el.offsetWidth);
|
|
133
|
-
const tabLabels = Array.from(tabElements).map((el) => el.getAttribute('data-label') || '');
|
|
134
|
-
const tabTypes = Array.from(tabElements).map((el) => el.getAttribute('data-type') || '');
|
|
135
|
-
const hasLongLabels = tabLabels.some((label) => label.length > 30);
|
|
136
|
-
const minVisibleTabs = hasLongLabels ? 1 : 2;
|
|
99
|
+
const containerWidth = container.offsetWidth;
|
|
100
|
+
const tabWidths = tabWidthsRef.current;
|
|
137
101
|
const activeTabIndex = tabRefs.current.findIndex((ref) => (ref === null || ref === void 0 ? void 0 : ref.getAttribute('data-label')) === activeTab);
|
|
138
|
-
|
|
139
|
-
|
|
102
|
+
// Active tab should always be visible, so we include it at the beginning of the array
|
|
103
|
+
let tabsWidth = activeTabIndex !== -1 ? tabWidths[activeTabIndex] : 0;
|
|
104
|
+
const visible = activeTabIndex !== -1 ? [activeTabIndex] : [];
|
|
140
105
|
const overflow = [];
|
|
141
|
-
let
|
|
142
|
-
|
|
143
|
-
if (i
|
|
144
|
-
|
|
106
|
+
for (let i = 0; i < tabWidths.length; i++) {
|
|
107
|
+
// Skip active tab, it was added initially
|
|
108
|
+
if (i === activeTabIndex) {
|
|
109
|
+
continue;
|
|
145
110
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const tabsByType = new Map();
|
|
154
|
-
Array.from({ length: totalTabs }).forEach((_, i) => {
|
|
155
|
-
var _a;
|
|
156
|
-
const type = tabTypes[i] || 'default';
|
|
157
|
-
if (!tabsByType.has(type)) {
|
|
158
|
-
tabsByType.set(type, []);
|
|
111
|
+
const tabWidthWithGap = tabWidths[i] + TABS_GAP;
|
|
112
|
+
const projectedWidth = tabsWidth + tabWidthWithGap;
|
|
113
|
+
if (projectedWidth <= containerWidth) {
|
|
114
|
+
visible.push(i);
|
|
115
|
+
tabsWidth += tabWidthWithGap;
|
|
159
116
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const projectedWidth = typeCurrentWidth +
|
|
169
|
-
tabWidth +
|
|
170
|
-
(typeVisible.length > 0 ? moreButtonWidth + safetyMargin : 0);
|
|
171
|
-
if (projectedWidth <= containerWidth) {
|
|
172
|
-
typeVisible.push(tabIndex);
|
|
173
|
-
typeCurrentWidth += tabWidth;
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
typeOverflow.push(tabIndex);
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
tabIndices.slice(minVisibleTabs).forEach((tabIndex) => {
|
|
180
|
-
const tabWidth = tabWidths[tabIndex];
|
|
181
|
-
const projectedWidth = typeCurrentWidth + tabWidth + moreButtonWidth + safetyMargin;
|
|
182
|
-
if (projectedWidth <= containerWidth) {
|
|
183
|
-
typeVisible.push(tabIndex);
|
|
184
|
-
typeCurrentWidth += tabWidth;
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
typeOverflow.push(tabIndex);
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
visible.push(...typeVisible);
|
|
191
|
-
overflow.push(...typeOverflow);
|
|
192
|
-
currentWidth = typeCurrentWidth;
|
|
193
|
-
});
|
|
194
|
-
if (activeTabIndex !== -1 && !visible.includes(activeTabIndex)) {
|
|
195
|
-
if (visible.length > 0) {
|
|
117
|
+
else {
|
|
118
|
+
overflow.push(i);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (overflow.length > 0) {
|
|
122
|
+
tabsWidth += MORE_BUTTON_WIDTH;
|
|
123
|
+
// Remove tabs starting from the end of the array until the width of the visible tabs is less than the container width
|
|
124
|
+
while (tabsWidth > containerWidth && visible.length) {
|
|
196
125
|
const removed = visible.pop();
|
|
197
126
|
if (removed !== undefined) {
|
|
198
127
|
overflow.unshift(removed);
|
|
128
|
+
tabsWidth -= tabWidths[removed];
|
|
199
129
|
}
|
|
200
130
|
}
|
|
201
|
-
visible.push(activeTabIndex);
|
|
202
|
-
const activeOverflowIndex = overflow.indexOf(activeTabIndex);
|
|
203
|
-
if (activeOverflowIndex !== -1)
|
|
204
|
-
overflow.splice(activeOverflowIndex, 1);
|
|
205
131
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}, [containerRef,
|
|
132
|
+
setTabs({
|
|
133
|
+
visible,
|
|
134
|
+
overflow,
|
|
135
|
+
});
|
|
136
|
+
}, [containerRef, activeTab]);
|
|
211
137
|
(0, react_1.useEffect)(() => {
|
|
212
138
|
if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current))
|
|
213
139
|
return;
|
|
214
|
-
|
|
215
|
-
const allTabsReady = tabRefs.current.length === totalTabs && tabRefs.current.every((tab) => tab === null || tab === void 0 ? void 0 : tab.offsetWidth);
|
|
216
|
-
if (!allTabsReady) {
|
|
217
|
-
resizeTimeoutRef.current = requestAnimationFrame(ensureTabsReady);
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
calculateVisibleTabs();
|
|
221
|
-
hasCalculatedOnce.current = true;
|
|
222
|
-
};
|
|
223
|
-
resizeTimeoutRef.current = requestAnimationFrame(ensureTabsReady);
|
|
224
|
-
let resizeTimeout;
|
|
140
|
+
let resizeTimeout = requestAnimationFrame(calculateVisibleTabs);
|
|
225
141
|
const handleResize = () => {
|
|
226
|
-
if (!hasCalculatedOnce.current)
|
|
227
|
-
return;
|
|
228
142
|
if (resizeTimeout) {
|
|
229
143
|
cancelAnimationFrame(resizeTimeout);
|
|
230
144
|
}
|
|
231
|
-
resizeTimeout = requestAnimationFrame(
|
|
232
|
-
if (resizeTimeoutRef.current) {
|
|
233
|
-
cancelAnimationFrame(resizeTimeoutRef.current);
|
|
234
|
-
}
|
|
235
|
-
resizeTimeoutRef.current = requestAnimationFrame(() => {
|
|
236
|
-
const container = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
237
|
-
if (!container)
|
|
238
|
-
return;
|
|
239
|
-
const currentWidth = container.offsetWidth;
|
|
240
|
-
if (Math.abs(lastWidthRef.current - currentWidth) > 5) {
|
|
241
|
-
lastWidthRef.current = currentWidth;
|
|
242
|
-
calculateVisibleTabs();
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
});
|
|
145
|
+
resizeTimeout = requestAnimationFrame(calculateVisibleTabs);
|
|
246
146
|
};
|
|
247
|
-
const resizeObserver = new ResizeObserver(handleResize);
|
|
248
|
-
resizeObserver.observe(containerRef.current);
|
|
249
147
|
window.addEventListener('resize', handleResize);
|
|
250
148
|
return () => {
|
|
251
|
-
resizeObserver.disconnect();
|
|
252
149
|
window.removeEventListener('resize', handleResize);
|
|
253
|
-
|
|
254
|
-
cancelAnimationFrame(resizeTimeoutRef.current);
|
|
255
|
-
}
|
|
256
|
-
if (resizeTimeout) {
|
|
257
|
-
cancelAnimationFrame(resizeTimeout);
|
|
258
|
-
}
|
|
150
|
+
cancelAnimationFrame(resizeTimeout);
|
|
259
151
|
};
|
|
260
152
|
}, [containerRef, totalTabs, calculateVisibleTabs]);
|
|
261
|
-
(0, react_1.useEffect)(() => {
|
|
262
|
-
const raf = requestAnimationFrame(() => {
|
|
263
|
-
setReady(true);
|
|
264
|
-
calculateVisibleTabs();
|
|
265
|
-
});
|
|
266
|
-
return () => cancelAnimationFrame(raf);
|
|
267
|
-
}, [calculateVisibleTabs]);
|
|
268
153
|
return {
|
|
269
|
-
activeTab,
|
|
270
|
-
setActiveTab,
|
|
271
154
|
setTabRef,
|
|
272
155
|
onTabClick,
|
|
273
156
|
handleKeyboard,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
overflowTabs,
|
|
277
|
-
ready,
|
|
157
|
+
visibleTabs: tabs.visible,
|
|
158
|
+
overflowTabs: tabs.overflow,
|
|
278
159
|
allTabsHidden,
|
|
279
160
|
};
|
|
280
161
|
}
|
|
162
|
+
const useActiveTab = ({ initialTab, tabsId }) => {
|
|
163
|
+
const [searchParams, setSearchParams] = (0, react_router_dom_1.useSearchParams)();
|
|
164
|
+
const [activeTab, setActiveTab] = (0, react_1.useState)(getInitialTab({ initialTab, searchParams, tabsId }));
|
|
165
|
+
const prevActiveTabRef = (0, react_1.useRef)(activeTab);
|
|
166
|
+
(0, react_1.useEffect)(() => {
|
|
167
|
+
const hasActiveTabChanged = prevActiveTabRef.current !== activeTab;
|
|
168
|
+
if (!tabsId || !hasActiveTabChanged) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
prevActiveTabRef.current = activeTab;
|
|
172
|
+
setSearchParams((searchParams) => {
|
|
173
|
+
searchParams.set(tabsId, activeTab);
|
|
174
|
+
return searchParams;
|
|
175
|
+
});
|
|
176
|
+
}, [activeTab, setSearchParams, tabsId]);
|
|
177
|
+
return {
|
|
178
|
+
activeTab,
|
|
179
|
+
setActiveTab,
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
exports.useActiveTab = useActiveTab;
|
|
183
|
+
const getInitialTab = ({ initialTab, searchParams, tabsId }) => {
|
|
184
|
+
let resultTab = initialTab;
|
|
185
|
+
if (tabsId) {
|
|
186
|
+
const tabFromUrl = searchParams.get(tabsId);
|
|
187
|
+
resultTab = tabFromUrl ? tabFromUrl : resultTab;
|
|
188
|
+
}
|
|
189
|
+
return resultTab;
|
|
190
|
+
};
|
|
281
191
|
//# sourceMappingURL=use-tabs.js.map
|
|
@@ -4,6 +4,7 @@ export type { TFunction, TOptions } from '../types/l10n';
|
|
|
4
4
|
export type { SelectOption, SelectProps } from '../types/select';
|
|
5
5
|
export { IS_BROWSER } from '../utils/dom';
|
|
6
6
|
export { addLeadingSlash, removeLeadingSlash, getPathPrefix, combineUrls, addTrailingSlash, withPathPrefix, } from '../utils/urls';
|
|
7
|
+
export { capitalize } from '../utils/string';
|
|
7
8
|
export { typedMemo } from '../hoc/typedMemo';
|
|
8
9
|
export { useMount } from '../hooks/use-mount';
|
|
9
10
|
export { GlobalStyle } from '../styles/global';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ThemeDataContext = exports.isObject = exports.isNotNull = exports.isString = exports.isUndefined = exports.SecurityVariablesEnvSuffix = exports.useDialogHotKeys = exports.useSearchDialog = exports.useModalScrollLock = exports.useActiveSectionId = exports.useOutsideClick = exports.useThemeHooks = exports.useFocusTrap = exports.getUserAgent = exports.ClipboardService = exports.isPrimitive = exports.breakpoints = exports.GlobalStyle = exports.useMount = exports.typedMemo = exports.withPathPrefix = exports.addTrailingSlash = exports.combineUrls = exports.getPathPrefix = exports.removeLeadingSlash = exports.addLeadingSlash = exports.IS_BROWSER = void 0;
|
|
3
|
+
exports.ThemeDataContext = exports.isObject = exports.isNotNull = exports.isString = exports.isUndefined = exports.SecurityVariablesEnvSuffix = exports.useDialogHotKeys = exports.useSearchDialog = exports.useModalScrollLock = exports.useActiveSectionId = exports.useOutsideClick = exports.useThemeHooks = exports.useFocusTrap = exports.getUserAgent = exports.ClipboardService = exports.isPrimitive = exports.breakpoints = exports.GlobalStyle = exports.useMount = exports.typedMemo = exports.capitalize = exports.withPathPrefix = exports.addTrailingSlash = exports.combineUrls = exports.getPathPrefix = exports.removeLeadingSlash = exports.addLeadingSlash = exports.IS_BROWSER = void 0;
|
|
4
4
|
var dom_1 = require("../utils/dom");
|
|
5
5
|
Object.defineProperty(exports, "IS_BROWSER", { enumerable: true, get: function () { return dom_1.IS_BROWSER; } });
|
|
6
6
|
var urls_1 = require("../utils/urls");
|
|
@@ -10,6 +10,8 @@ Object.defineProperty(exports, "getPathPrefix", { enumerable: true, get: functio
|
|
|
10
10
|
Object.defineProperty(exports, "combineUrls", { enumerable: true, get: function () { return urls_1.combineUrls; } });
|
|
11
11
|
Object.defineProperty(exports, "addTrailingSlash", { enumerable: true, get: function () { return urls_1.addTrailingSlash; } });
|
|
12
12
|
Object.defineProperty(exports, "withPathPrefix", { enumerable: true, get: function () { return urls_1.withPathPrefix; } });
|
|
13
|
+
var string_1 = require("../utils/string");
|
|
14
|
+
Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return string_1.capitalize; } });
|
|
13
15
|
var typedMemo_1 = require("../hoc/typedMemo");
|
|
14
16
|
Object.defineProperty(exports, "typedMemo", { enumerable: true, get: function () { return typedMemo_1.typedMemo; } });
|
|
15
17
|
var use_mount_1 = require("../hooks/use-mount");
|
package/lib/core/types/l10n.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TOptions } from 'i18next';
|
|
2
|
-
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label';
|
|
2
|
+
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label';
|
|
3
3
|
export type Locale = {
|
|
4
4
|
code: string;
|
|
5
5
|
name: string;
|
package/lib/core/utils/index.js
CHANGED
|
@@ -53,4 +53,5 @@ __exportStar(require("./lang-to-name"), exports);
|
|
|
53
53
|
__exportStar(require("./enhanced-smoothstep"), exports);
|
|
54
54
|
__exportStar(require("./icon-resolver"), exports);
|
|
55
55
|
__exportStar(require("./dynamic"), exports);
|
|
56
|
+
__exportStar(require("./tabs"), exports);
|
|
56
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTabId(label: string, index: number): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTabId = getTabId;
|
|
4
|
+
function getTabId(label, index) {
|
|
5
|
+
const cleanLabel = label.replace(/\s+/g, '-').toLowerCase();
|
|
6
|
+
return `${cleanLabel}-${index}`;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=tabs.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../../icons/types';
|
|
3
|
+
export declare const CursorIcon: import("styled-components").StyledComponent<(props: IconProps) => React.JSX.Element, any, {
|
|
4
|
+
'data-component-name': string;
|
|
5
|
+
} & {
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & React.SVGProps<SVGSVGElement>, "data-component-name">;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CursorIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
10
|
+
react_1.default.createElement("path", { d: "M7.99956 15V8.0001L2 11.4999L7.99956 15Z", fill: "#939393" }),
|
|
11
|
+
react_1.default.createElement("path", { d: "M14 4.49979L7.99956 15V8.0001L14 4.49979Z", fill: "#E3E3E3" }),
|
|
12
|
+
react_1.default.createElement("path", { d: "M2 4.49979H14L7.99956 8.0001L2 4.49979Z", fill: "white" }),
|
|
13
|
+
react_1.default.createElement("path", { d: "M8.00025 1V4.49995L14 4.49979L8.00025 1Z", fill: "#444444" }),
|
|
14
|
+
react_1.default.createElement("path", { d: "M2 4.49979L8.00025 4.49995V1L2 4.49979ZM13.9999 11.4998L10.9999 9.74987L7.99956 15L13.9999 11.4998Z", fill: "#939393" }),
|
|
15
|
+
react_1.default.createElement("path", { d: "M14 4.49979L10.9999 9.74987L13.9999 11.4998L14 4.49979ZM7.99956 8.0001L2 11.4999V4.49979L7.99956 8.0001Z", fill: "#444444" })));
|
|
16
|
+
exports.CursorIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
17
|
+
'data-component-name': 'icons/CursorIcon/CursorIcon',
|
|
18
|
+
})) `
|
|
19
|
+
height: ${({ size }) => size || '16px'};
|
|
20
|
+
width: ${({ size }) => size || '16px'};
|
|
21
|
+
`;
|
|
22
|
+
//# sourceMappingURL=CursorIcon.js.map
|
|
@@ -12,13 +12,11 @@ const PageNavigation_1 = require("../components/PageNavigation/PageNavigation");
|
|
|
12
12
|
const LastUpdated_1 = require("../components/LastUpdated/LastUpdated");
|
|
13
13
|
const Breadcrumbs_1 = require("../components/Breadcrumbs/Breadcrumbs");
|
|
14
14
|
const CodeSnippetContext_1 = require("../core/contexts/CodeSnippetContext");
|
|
15
|
-
const use_local_state_1 = require("../core/hooks/use-local-state");
|
|
16
15
|
function DocumentationLayout({ tableOfContent, feedback, config, editPage, lastModified, nextPage, prevPage, className, children, }) {
|
|
17
16
|
var _a;
|
|
18
17
|
const { editPage: themeEditPage } = config || {};
|
|
19
18
|
const mergedConf = editPage ? Object.assign(Object.assign({}, themeEditPage), editPage) : undefined;
|
|
20
|
-
|
|
21
|
-
return (react_1.default.createElement(CodeSnippetContext_1.CodeSnippetContext.Provider, { value: { activeSnippetName, setActiveSnippetName } },
|
|
19
|
+
return (react_1.default.createElement(CodeSnippetContext_1.CodeSnippetProvider, null,
|
|
22
20
|
react_1.default.createElement(LayoutWrapper, { "data-component-name": "Layout/DocumentationLayout", className: className },
|
|
23
21
|
react_1.default.createElement(ContentWrapper, { withToc: !((_a = config === null || config === void 0 ? void 0 : config.toc) === null || _a === void 0 ? void 0 : _a.hide) },
|
|
24
22
|
react_1.default.createElement(Breadcrumbs, null),
|