@redocly/theme 0.59.0-next.1 → 0.59.0-next.2
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/Accordion/Accordion.js +17 -7
- package/lib/components/Accordion/AccordionBody.js +17 -7
- package/lib/components/Admonition/Admonition.js +17 -7
- package/lib/components/Badge/Badge.js +17 -7
- package/lib/components/Breadcrumbs/Breadcrumb.js +17 -7
- package/lib/components/Breadcrumbs/BreadcrumbDropdown.js +17 -7
- package/lib/components/Button/Button.js +17 -7
- package/lib/components/Buttons/AIAssistantButton.js +17 -7
- package/lib/components/Buttons/CopyButton.js +17 -7
- package/lib/components/Catalog/Catalog.d.ts +6 -0
- package/lib/components/Catalog/Catalog.js +7 -6
- package/lib/components/Catalog/CatalogEntities.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +17 -7
- package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +17 -7
- package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.js +17 -7
- package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.js +17 -7
- package/lib/components/Catalog/CatalogFilter/CatalogFilterSelect.js +17 -7
- package/lib/components/Catalog/CatalogSortButton.js +17 -7
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +17 -7
- package/lib/components/Catalog/CatalogViewModeToggle.js +17 -7
- package/lib/components/CatalogClassic/CatalogClassicActions.js +17 -7
- package/lib/components/CatalogClassic/CatalogClassicCard.js +17 -7
- package/lib/components/CatalogClassic/CatalogClassicHighlight.js +17 -7
- package/lib/components/CatalogClassic/CatalogClassicVirtualizedGroups.js +17 -7
- package/lib/components/CodeBlock/CodeBlock.js +17 -7
- package/lib/components/CodeBlock/CodeBlockContainer.js +17 -7
- package/lib/components/CodeBlock/CodeBlockTabs.js +17 -7
- package/lib/components/Dropdown/Dropdown.d.ts +16 -2
- package/lib/components/Dropdown/Dropdown.js +22 -12
- package/lib/components/Dropdown/DropdownMenuItem.js +17 -7
- package/lib/components/Feedback/Comment.js +17 -7
- package/lib/components/Feedback/Feedback.js +17 -7
- package/lib/components/Feedback/Mood.js +17 -7
- package/lib/components/Feedback/Rating.js +17 -7
- package/lib/components/Feedback/Reasons.js +17 -7
- package/lib/components/Feedback/Scale.js +17 -7
- package/lib/components/Feedback/Sentiment.js +17 -7
- package/lib/components/Feedback/Stars.js +17 -7
- package/lib/components/Filter/FilterContent.js +17 -7
- package/lib/components/Filter/FilterInput.js +17 -7
- package/lib/components/Image/Image.js +17 -7
- package/lib/components/JsonViewer/JsonViewer.js +17 -7
- package/lib/components/JsonViewer/helpers.js +17 -7
- package/lib/components/LastUpdated/LastUpdated.js +17 -7
- package/lib/components/Link/Link.js +17 -7
- package/lib/components/Markdown/Markdown.js +17 -7
- package/lib/components/Marker/Marker.js +17 -7
- package/lib/components/Menu/MenuContainer.js +17 -7
- package/lib/components/Menu/MenuItem.js +18 -8
- package/lib/components/Menu/MenuMobile.js +17 -7
- package/lib/components/PageActions/PageActions.js +17 -7
- package/lib/components/PageNavigation/NextButton.js +17 -7
- package/lib/components/Panel/Panel.js +17 -7
- package/lib/components/Panel/PanelBody.js +17 -7
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +17 -7
- package/lib/components/Search/SearchAiConversationInput.d.ts +2 -1
- package/lib/components/Search/SearchAiConversationInput.js +28 -10
- package/lib/components/Search/SearchAiDialog.js +17 -7
- package/lib/components/Search/SearchDialog.js +23 -10
- package/lib/components/Search/SearchFilter.js +17 -7
- package/lib/components/Search/SearchGroups.js +17 -7
- package/lib/components/Search/SearchHighlight.js +17 -7
- package/lib/components/Search/SearchItem.js +17 -7
- package/lib/components/Search/SearchRecent.js +17 -7
- package/lib/components/Search/SearchShortcut.js +17 -7
- package/lib/components/Search/SearchSuggestedPages.js +17 -7
- package/lib/components/Search/SearchTrigger.js +17 -7
- package/lib/components/Search/variables.js +5 -1
- package/lib/components/Segmented/Segmented.js +17 -7
- package/lib/components/Select/Select.js +17 -7
- package/lib/components/Select/SelectInput.js +17 -7
- package/lib/components/Sidebar/Sidebar.js +17 -7
- package/lib/components/SidebarActions/styled.js +17 -7
- package/lib/components/SkipContent/SkipContent.js +17 -7
- package/lib/components/Switch/Switch.js +17 -7
- package/lib/components/TableOfContent/TableOfContent.js +17 -7
- package/lib/components/Tooltip/Tooltip.js +17 -7
- package/lib/components/VersionPicker/VersionPicker.js +17 -7
- package/lib/core/constants/search.d.ts +5 -4
- package/lib/core/constants/search.js +4 -5
- package/lib/core/contexts/CodeSnippetContext.js +17 -7
- package/lib/core/hooks/use-tabs.d.ts +3 -2
- package/lib/core/hooks/use-tabs.js +115 -57
- package/lib/core/templates/Markdown.js +17 -7
- package/lib/core/types/hooks.d.ts +6 -3
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/utils/download-code-walkthrough.js +17 -7
- package/lib/core/utils/get-file-icon.js +17 -7
- package/lib/icons/AiStarsIcon/AiStarsIcon.js +11 -2
- package/lib/icons/GenericIcon/GenericIcon.js +17 -7
- package/lib/icons/RedoclyIcon/RedoclyIcon.js +4 -7
- package/lib/icons/Spinner/Spinner.js +17 -7
- package/lib/index.js +17 -7
- package/lib/layouts/OIDCForbidden.js +17 -7
- package/lib/layouts/ThreePanelLayout.js +17 -7
- package/lib/markdoc/components/Cards/Cards.js +17 -7
- package/lib/markdoc/components/CodeGroup/CodeGroup.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodeToggle.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/Input.js +17 -7
- package/lib/markdoc/components/Heading/Heading.js +17 -7
- package/lib/markdoc/components/HtmlBlock/HtmlBlock.js +17 -7
- package/lib/markdoc/components/InlineSvg/InlineSvg.js +17 -7
- package/lib/markdoc/components/MarkdocExample/MarkdocExample.js +17 -7
- package/lib/markdoc/components/Tabs/TabList.d.ts +3 -1
- package/lib/markdoc/components/Tabs/TabList.js +214 -54
- package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tabs.js +74 -19
- package/lib/markdoc/default.d.ts +104 -1
- package/lib/markdoc/default.js +17 -7
- package/package.json +5 -5
- package/src/components/Catalog/Catalog.tsx +15 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
- package/src/components/Dropdown/Dropdown.tsx +84 -79
- package/src/components/Menu/MenuItem.tsx +1 -0
- package/src/components/Search/SearchAiConversationInput.tsx +12 -2
- package/src/components/Search/SearchDialog.tsx +6 -3
- package/src/components/Search/variables.ts +5 -1
- package/src/core/constants/search.ts +8 -4
- package/src/core/hooks/use-tabs.ts +168 -86
- package/src/core/types/hooks.ts +6 -1
- package/src/core/types/l10n.ts +1 -0
- package/src/icons/AiStarsIcon/AiStarsIcon.tsx +11 -2
- package/src/icons/RedoclyIcon/RedoclyIcon.tsx +4 -22
- package/src/markdoc/components/Tabs/TabList.tsx +312 -105
- package/src/markdoc/components/Tabs/Tabs.tsx +136 -11
|
@@ -15,21 +15,29 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
28
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
36
|
exports.TabContent = exports.TabsSize = void 0;
|
|
30
37
|
exports.Tabs = Tabs;
|
|
31
38
|
const react_1 = __importStar(require("react"));
|
|
32
|
-
const
|
|
39
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
40
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
33
41
|
const hooks_1 = require("../../../core/hooks");
|
|
34
42
|
const TabList_1 = require("../../../markdoc/components/Tabs/TabList");
|
|
35
43
|
const utils_1 = require("../../../core/utils");
|
|
@@ -38,22 +46,62 @@ var TabsSize;
|
|
|
38
46
|
TabsSize["SMALL"] = "small";
|
|
39
47
|
TabsSize["MEDIUM"] = "medium";
|
|
40
48
|
})(TabsSize || (exports.TabsSize = TabsSize = {}));
|
|
41
|
-
function Tabs({ id, children, className, size, initialTab: propInitialTab, }) {
|
|
49
|
+
function Tabs({ id, children, className, size, initialTab: propInitialTab, forceReady = false, }) {
|
|
42
50
|
var _a, _b;
|
|
43
|
-
const
|
|
51
|
+
const childrenArray = react_1.default.Children.toArray(children);
|
|
52
|
+
const [isReady, setIsReady] = (0, react_1.useState)(false);
|
|
53
|
+
const containerRef = (0, react_1.useRef)(null);
|
|
44
54
|
const initialTab = (_b = propInitialTab !== null && propInitialTab !== void 0 ? propInitialTab : (_a = childrenArray[0]) === null || _a === void 0 ? void 0 : _a.props.label) !== null && _b !== void 0 ? _b : '';
|
|
45
|
-
const
|
|
46
|
-
(0, react_1.
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
const labelsHash = childrenArray.map((c) => c.props.label).join('|');
|
|
56
|
+
const handleReadyChange = (0, react_1.useCallback)((ready) => {
|
|
57
|
+
setIsReady(ready);
|
|
58
|
+
}, []);
|
|
59
|
+
// Reset isReady when children change (new page/tabs)
|
|
60
|
+
// Use useLayoutEffect to run synchronously before paint
|
|
61
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
62
|
+
setIsReady(false);
|
|
63
|
+
}, [labelsHash]);
|
|
64
|
+
const inRouter = (0, react_router_dom_1.useInRouterContext)();
|
|
65
|
+
return (react_1.default.createElement(TabsView, { id: id, className: className, size: size, childrenArray: childrenArray, initialTab: initialTab, useActiveTab: inRouter ? useActiveTabWithRouter : useActiveTabWithoutRouter, isReady: isReady || forceReady, labelsHash: labelsHash, containerRef: containerRef, onReadyChange: handleReadyChange }));
|
|
66
|
+
}
|
|
67
|
+
function TabsView({ id, className, size, childrenArray, useActiveTab, initialTab, isReady, labelsHash, containerRef, onReadyChange, }) {
|
|
68
|
+
const { activeTab, setActiveTab } = useActiveTab(initialTab, id, childrenArray);
|
|
69
|
+
return (react_1.default.createElement(TabsContainer, { "data-component-name": "Markdoc/Tabs/Tabs", className: className, key: id, "$isReady": isReady },
|
|
70
|
+
react_1.default.createElement(TabList_1.TabList, { key: labelsHash, size: size, childrenArray: childrenArray, activeTab: activeTab, onTabChange: setActiveTab, containerRef: containerRef, onReadyChange: onReadyChange }),
|
|
51
71
|
childrenArray.map((child, index) => {
|
|
52
72
|
const { label } = child.props;
|
|
53
73
|
const tabId = (0, utils_1.getTabId)(label, index);
|
|
54
74
|
return label === activeTab ? (react_1.default.createElement(exports.TabContent, { key: `content-${tabId}`, id: `panel-${tabId}`, "aria-labelledby": `tab-${tabId}`, tabIndex: 0, role: "tabpanel" }, child.props.children)) : null;
|
|
55
75
|
})));
|
|
56
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Validates that the active tab exists in children and resets to initial tab if not found.
|
|
79
|
+
* Ensures tab state remains consistent when tab structure changes.
|
|
80
|
+
*/
|
|
81
|
+
function useValidateActiveTab(activeTab, setActiveTab, childrenArray, initialTab) {
|
|
82
|
+
(0, react_1.useEffect)(() => {
|
|
83
|
+
const availableLabels = childrenArray.map((child) => child.props.label);
|
|
84
|
+
if (activeTab && !availableLabels.includes(activeTab) && availableLabels.length > 0) {
|
|
85
|
+
setActiveTab(initialTab);
|
|
86
|
+
}
|
|
87
|
+
}, [childrenArray, activeTab, initialTab, setActiveTab]);
|
|
88
|
+
}
|
|
89
|
+
const useActiveTabWithRouter = (initialTab, tabsId, childrenArray) => {
|
|
90
|
+
const { activeTab, setActiveTab } = (0, hooks_1.useActiveTab)({ initialTab, tabsId });
|
|
91
|
+
useValidateActiveTab(activeTab, setActiveTab, childrenArray, initialTab);
|
|
92
|
+
return {
|
|
93
|
+
activeTab,
|
|
94
|
+
setActiveTab,
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
const useActiveTabWithoutRouter = (initialTab, _tabsId, childrenArray) => {
|
|
98
|
+
const [activeTab, setActiveTab] = (0, react_1.useState)(initialTab);
|
|
99
|
+
useValidateActiveTab(activeTab, setActiveTab, childrenArray, initialTab);
|
|
100
|
+
return {
|
|
101
|
+
activeTab,
|
|
102
|
+
setActiveTab,
|
|
103
|
+
};
|
|
104
|
+
};
|
|
57
105
|
const TabsContainer = styled_components_1.default.div `
|
|
58
106
|
position: relative;
|
|
59
107
|
color: var(--md-tabs-container-text-color);
|
|
@@ -70,6 +118,13 @@ const TabsContainer = styled_components_1.default.div `
|
|
|
70
118
|
margin: 0;
|
|
71
119
|
padding: 0;
|
|
72
120
|
}
|
|
121
|
+
|
|
122
|
+
${({ $isReady }) => !$isReady &&
|
|
123
|
+
(0, styled_components_1.css) `
|
|
124
|
+
opacity: 0;
|
|
125
|
+
pointer-events: none;
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
`}
|
|
73
128
|
`;
|
|
74
129
|
exports.TabContent = styled_components_1.default.div `
|
|
75
130
|
color: var(--md-tabs-content-text-color);
|
package/lib/markdoc/default.d.ts
CHANGED
|
@@ -4,8 +4,111 @@ export * from '../markdoc/attributes/img-srcset';
|
|
|
4
4
|
export * from '../markdoc/attributes/relative-path';
|
|
5
5
|
export * from '../markdoc/attributes/svg-content';
|
|
6
6
|
export * as components from '../markdoc/components/default';
|
|
7
|
+
import { admonition } from '../markdoc/tags/admonition';
|
|
8
|
+
import { html } from '../markdoc/tags/html';
|
|
9
|
+
import { markdocExample } from '../markdoc/tags/markdoc-example';
|
|
10
|
+
import { partial } from '../markdoc/tags/partial';
|
|
11
|
+
import { tab } from '../markdoc/tags/tab';
|
|
12
|
+
import { tabs } from '../markdoc/tags/tabs';
|
|
13
|
+
import { debug } from '../markdoc/tags/debug';
|
|
14
|
+
import { codeSnippet } from '../markdoc/tags/code-snippet';
|
|
15
|
+
import { inlineSvg } from '../markdoc/tags/inline-svg';
|
|
16
|
+
import { cards } from '../markdoc/tags/cards';
|
|
17
|
+
import { card } from '../markdoc/tags/card';
|
|
18
|
+
import { img } from '../markdoc/tags/img';
|
|
19
|
+
import { codeWalkthrough } from '../markdoc/tags/code-walkthrough';
|
|
20
|
+
import { codeStep } from '../markdoc/tags/code-step';
|
|
21
|
+
import { input } from '../markdoc/tags/input';
|
|
22
|
+
import { toggle } from '../markdoc/tags/code-toggle';
|
|
23
|
+
import { codeGroup } from '../markdoc/tags/code-group';
|
|
24
|
+
import { icon } from '../markdoc/tags/icon';
|
|
7
25
|
export declare const tags: {
|
|
8
|
-
[
|
|
26
|
+
[admonition.tagName]: import("@markdoc/markdoc").Schema & {
|
|
27
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
28
|
+
resolver?: string;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
[debug.tagName]: import("@markdoc/markdoc").Schema & {
|
|
32
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
33
|
+
resolver?: string;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
[html.tagName]: import("@markdoc/markdoc").Schema & {
|
|
37
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
38
|
+
resolver?: string;
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
[markdocExample.tagName]: import("@markdoc/markdoc").Schema & {
|
|
42
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
43
|
+
resolver?: string;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
46
|
+
[partial.tagName]: import("@markdoc/markdoc").Schema & {
|
|
47
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
48
|
+
resolver?: string;
|
|
49
|
+
}>;
|
|
50
|
+
};
|
|
51
|
+
[tab.tagName]: import("@markdoc/markdoc").Schema & {
|
|
52
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
53
|
+
resolver?: string;
|
|
54
|
+
}>;
|
|
55
|
+
};
|
|
56
|
+
[tabs.tagName]: import("@markdoc/markdoc").Schema & {
|
|
57
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
58
|
+
resolver?: string;
|
|
59
|
+
}>;
|
|
60
|
+
};
|
|
61
|
+
[codeSnippet.tagName]: import("@markdoc/markdoc").Schema & {
|
|
62
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
63
|
+
resolver?: string;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
[inlineSvg.tagName]: import("@markdoc/markdoc").Schema & {
|
|
67
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
68
|
+
resolver?: string;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
[cards.tagName]: import("@markdoc/markdoc").Schema & {
|
|
72
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
73
|
+
resolver?: string;
|
|
74
|
+
}>;
|
|
75
|
+
};
|
|
76
|
+
[card.tagName]: import("@markdoc/markdoc").Schema & {
|
|
77
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
78
|
+
resolver?: string;
|
|
79
|
+
}>;
|
|
80
|
+
};
|
|
81
|
+
[img.tagName]: import("@markdoc/markdoc").Schema & {
|
|
82
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
83
|
+
resolver?: string;
|
|
84
|
+
}>;
|
|
85
|
+
};
|
|
86
|
+
[codeWalkthrough.tagName]: import("@markdoc/markdoc").Schema & {
|
|
87
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
88
|
+
resolver?: string;
|
|
89
|
+
}>;
|
|
90
|
+
};
|
|
91
|
+
[codeStep.tagName]: import("@markdoc/markdoc").Schema & {
|
|
92
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
93
|
+
resolver?: string;
|
|
94
|
+
}>;
|
|
95
|
+
};
|
|
96
|
+
[toggle.tagName]: import("@markdoc/markdoc").Schema & {
|
|
97
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
98
|
+
resolver?: string;
|
|
99
|
+
}>;
|
|
100
|
+
};
|
|
101
|
+
[input.tagName]: import("@markdoc/markdoc").Schema & {
|
|
102
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
103
|
+
resolver?: string;
|
|
104
|
+
}>;
|
|
105
|
+
};
|
|
106
|
+
[codeGroup.tagName]: import("@markdoc/markdoc").Schema & {
|
|
107
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
108
|
+
resolver?: string;
|
|
109
|
+
}>;
|
|
110
|
+
};
|
|
111
|
+
[icon.tagName]: import("@markdoc/markdoc").Schema & {
|
|
9
112
|
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
10
113
|
resolver?: string;
|
|
11
114
|
}>;
|
package/lib/markdoc/default.js
CHANGED
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
20
|
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
39
|
exports.tags = exports.components = void 0;
|
|
30
40
|
/* Attributes */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.59.0-next.
|
|
3
|
+
"version": "0.59.0-next.2",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"styled-system": "5.1.5",
|
|
64
64
|
"ts-node": "10.9.2",
|
|
65
65
|
"ts-node-dev": "2.0.0",
|
|
66
|
-
"tsc-alias": "1.8.
|
|
66
|
+
"tsc-alias": "1.8.16",
|
|
67
67
|
"tsconfig-paths": "4.2.0",
|
|
68
68
|
"tsconfig-paths-webpack-plugin": "3.5.2",
|
|
69
|
-
"typescript": "5.
|
|
69
|
+
"typescript": "5.9.3",
|
|
70
70
|
"vitest": "3.2.4",
|
|
71
71
|
"vitest-when": "0.6.2",
|
|
72
72
|
"webpack": "5.94.0"
|
|
@@ -84,10 +84,10 @@
|
|
|
84
84
|
"lodash.debounce": "^4.0.8",
|
|
85
85
|
"lodash.throttle": "4.1.1",
|
|
86
86
|
"nprogress": "0.2.0",
|
|
87
|
-
"openapi-sampler": "1.6.
|
|
87
|
+
"openapi-sampler": "1.6.2",
|
|
88
88
|
"react-calendar": "5.1.0",
|
|
89
89
|
"react-date-picker": "11.0.0",
|
|
90
|
-
"@redocly/config": "0.
|
|
90
|
+
"@redocly/config": "0.36.0",
|
|
91
91
|
"@redocly/realm-asyncapi-sdk": "0.5.0-next.0"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
@@ -20,8 +20,11 @@ import { CatalogViewModeToggle } from '@redocly/theme/components/Catalog/Catalog
|
|
|
20
20
|
import { CatalogSortButton } from '@redocly/theme/components/Catalog/CatalogSortButton';
|
|
21
21
|
import { CatalogEntities } from '@redocly/theme/components/Catalog/CatalogEntities';
|
|
22
22
|
|
|
23
|
+
type CatalogFiltersWithCounts = Record<string, { value: string; count: number }[]>;
|
|
24
|
+
|
|
23
25
|
export type CatalogProps = {
|
|
24
26
|
catalogConfig: CatalogEntityConfig;
|
|
27
|
+
filters?: CatalogFiltersWithCounts;
|
|
25
28
|
entitiesTypes: string[];
|
|
26
29
|
initialEntitiesList?: BffCatalogEntityList;
|
|
27
30
|
catalogSwitcherItems: CatalogSwitcherItem[];
|
|
@@ -29,9 +32,11 @@ export type CatalogProps = {
|
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
const customCatalogOptionsCasing = (str: string): string => {
|
|
32
|
-
|
|
35
|
+
const trimmedStr = str.trim();
|
|
36
|
+
if (!trimmedStr) return trimmedStr;
|
|
37
|
+
|
|
38
|
+
const words = trimmedStr.split(/[\s-_]+/);
|
|
33
39
|
|
|
34
|
-
const words = str.split(/[\s-_]+/);
|
|
35
40
|
return words
|
|
36
41
|
.map((word, index) => {
|
|
37
42
|
if (index === 0 && word.toLowerCase() === 'api') {
|
|
@@ -45,6 +50,7 @@ const customCatalogOptionsCasing = (str: string): string => {
|
|
|
45
50
|
export function Catalog(props: CatalogProps): JSX.Element {
|
|
46
51
|
const {
|
|
47
52
|
catalogConfig,
|
|
53
|
+
filters: serverFilters,
|
|
48
54
|
entitiesTypes,
|
|
49
55
|
initialEntitiesList,
|
|
50
56
|
catalogSwitcherItems,
|
|
@@ -72,7 +78,12 @@ export function Catalog(props: CatalogProps): JSX.Element {
|
|
|
72
78
|
onChangeCollapseSidebarClick,
|
|
73
79
|
layout,
|
|
74
80
|
collapsedSidebar,
|
|
75
|
-
} = useCatalog(
|
|
81
|
+
} = useCatalog(
|
|
82
|
+
catalogConfig,
|
|
83
|
+
serverFilters,
|
|
84
|
+
initialEntitiesList?.page.total || 0,
|
|
85
|
+
initialViewMode,
|
|
86
|
+
);
|
|
76
87
|
|
|
77
88
|
return (
|
|
78
89
|
<>
|
|
@@ -94,7 +105,7 @@ export function Catalog(props: CatalogProps): JSX.Element {
|
|
|
94
105
|
filters={filters}
|
|
95
106
|
filterTerm={searchQuery}
|
|
96
107
|
hideSearch={true}
|
|
97
|
-
showCounter={
|
|
108
|
+
showCounter={true}
|
|
98
109
|
filterValuesCasing={customCatalogOptionsCasing}
|
|
99
110
|
/>
|
|
100
111
|
}
|
|
@@ -46,7 +46,7 @@ export function CatalogEntityApiDescriptionRelations({
|
|
|
46
46
|
}: CatalogEntityApiDescriptionRelationsProps): JSX.Element {
|
|
47
47
|
return (
|
|
48
48
|
<div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations">
|
|
49
|
-
<Tabs key={entity.id} size={TabsSize.MEDIUM}>
|
|
49
|
+
<Tabs key={entity.id} forceReady={relations.length > 0} size={TabsSize.MEDIUM}>
|
|
50
50
|
<TabItem
|
|
51
51
|
label="Operations"
|
|
52
52
|
icon={<MoleculesIcon />}
|
package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx
CHANGED
|
@@ -74,7 +74,7 @@ export function CatalogEntityTeamRelations({
|
|
|
74
74
|
}: CatalogEntityTeamRelationsProps): JSX.Element {
|
|
75
75
|
return (
|
|
76
76
|
<div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations">
|
|
77
|
-
<Tabs size={TabsSize.MEDIUM}>
|
|
77
|
+
<Tabs forceReady={relations.length > 0} size={TabsSize.MEDIUM}>
|
|
78
78
|
<TabItem label="Members" icon={<PeopleIcon />} onClick={() => setFilter('type:user')}>
|
|
79
79
|
<CatalogEntityRelationsTable
|
|
80
80
|
key="members-table"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { cloneElement, useRef } from 'react';
|
|
1
|
+
import React, { cloneElement, useRef, forwardRef } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import type { PropsWithChildren, ReactElement
|
|
4
|
+
import type { PropsWithChildren, ReactElement } from 'react';
|
|
5
5
|
|
|
6
6
|
import { useOutsideClick, useControlledState } from '@redocly/theme/core/hooks';
|
|
7
7
|
import { ChevronDownIcon } from '@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon';
|
|
@@ -32,84 +32,89 @@ export type DropdownProps = PropsWithChildren<{
|
|
|
32
32
|
onClose?: () => void;
|
|
33
33
|
}>;
|
|
34
34
|
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
placement={placement}
|
|
104
|
-
alignment={alignment}
|
|
105
|
-
isOpen={isOpen}
|
|
106
|
-
onClick={closeOnClick ? handleChildClick : undefined}
|
|
35
|
+
export const Dropdown = forwardRef<HTMLDivElement, DropdownProps>(
|
|
36
|
+
(
|
|
37
|
+
{
|
|
38
|
+
children,
|
|
39
|
+
className,
|
|
40
|
+
active,
|
|
41
|
+
trigger,
|
|
42
|
+
triggerEvent = 'click',
|
|
43
|
+
closeOnClick = true,
|
|
44
|
+
withArrow,
|
|
45
|
+
dataAttributes,
|
|
46
|
+
placement,
|
|
47
|
+
alignment,
|
|
48
|
+
onClick,
|
|
49
|
+
onClose,
|
|
50
|
+
},
|
|
51
|
+
ref,
|
|
52
|
+
) => {
|
|
53
|
+
const dropdownRef = useRef<HTMLDivElement | null>(null);
|
|
54
|
+
const [isOpen, setIsOpen] = useControlledState<boolean>(false, active);
|
|
55
|
+
|
|
56
|
+
const handleOpen = () => {
|
|
57
|
+
setIsOpen(true);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const handleClose = () => {
|
|
61
|
+
setIsOpen(false);
|
|
62
|
+
onClose?.();
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const handleChildClick = () => {
|
|
66
|
+
handleClose();
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const handleToggle = (event: React.UIEvent) => {
|
|
70
|
+
event.stopPropagation();
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
setIsOpen(!isOpen);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const handleKeyDown = (event: React.KeyboardEvent) => {
|
|
76
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
77
|
+
handleToggle(event);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
useOutsideClick((ref as React.RefObject<HTMLElement | null>) || dropdownRef, handleClose);
|
|
82
|
+
|
|
83
|
+
const triggerChild = React.Children.only(trigger) as ReactElement<TriggerProps>;
|
|
84
|
+
|
|
85
|
+
const dropdownTrigger = cloneElement(triggerChild, {
|
|
86
|
+
onClick: triggerEvent === 'click' ? handleToggle : undefined,
|
|
87
|
+
icon: withArrow ? isOpen ? <ChevronUpIcon /> : <ChevronDownIcon /> : undefined,
|
|
88
|
+
...(withArrow ? { iconPosition: 'right' } : {}),
|
|
89
|
+
...triggerChild.props,
|
|
90
|
+
onKeyDown: triggerEvent === 'click' ? handleKeyDown : undefined,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<DropdownWrapper
|
|
95
|
+
data-component-name="Dropdown/Dropdown"
|
|
96
|
+
data-testid="dropdown"
|
|
97
|
+
{...dataAttributes}
|
|
98
|
+
className={className}
|
|
99
|
+
ref={ref || dropdownRef}
|
|
100
|
+
onPointerEnter={triggerEvent === 'hover' ? handleOpen : undefined}
|
|
101
|
+
onPointerLeave={triggerEvent === 'hover' ? handleClose : undefined}
|
|
102
|
+
onClick={onClick}
|
|
107
103
|
>
|
|
108
|
-
{
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
104
|
+
{dropdownTrigger}
|
|
105
|
+
|
|
106
|
+
<ChildrenWrapper
|
|
107
|
+
placement={placement}
|
|
108
|
+
alignment={alignment}
|
|
109
|
+
isOpen={isOpen}
|
|
110
|
+
onClick={closeOnClick ? handleChildClick : undefined}
|
|
111
|
+
>
|
|
112
|
+
{children}
|
|
113
|
+
</ChildrenWrapper>
|
|
114
|
+
</DropdownWrapper>
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
);
|
|
113
118
|
|
|
114
119
|
const DropdownWrapper = styled.div`
|
|
115
120
|
--button-gap: var(--spacing-xxs);
|
|
@@ -82,6 +82,7 @@ export function MenuItem(props: React.PropsWithChildren<MenuItemProps>): JSX.Ele
|
|
|
82
82
|
role={item.link ? 'none' : 'link'}
|
|
83
83
|
tabIndex={!item.link ? 0 : undefined}
|
|
84
84
|
data-testid="menu-item-label"
|
|
85
|
+
data-active={item.active}
|
|
85
86
|
>
|
|
86
87
|
{hasChevron ? <ChevronWrapper>{chevron}</ChevronWrapper> : null}
|
|
87
88
|
<MenuItemIcon icon={item.icon} srcSet={item.srcSet} />
|
|
@@ -13,6 +13,7 @@ type SearchAiConversationInputProps = {
|
|
|
13
13
|
isGeneratingResponse: boolean;
|
|
14
14
|
placeholder?: string;
|
|
15
15
|
className?: string;
|
|
16
|
+
disabled?: boolean;
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
export function SearchAiConversationInput({
|
|
@@ -20,6 +21,7 @@ export function SearchAiConversationInput({
|
|
|
20
21
|
onMessageSent,
|
|
21
22
|
className,
|
|
22
23
|
placeholder,
|
|
24
|
+
disabled,
|
|
23
25
|
}: SearchAiConversationInputProps): JSX.Element {
|
|
24
26
|
const { useTranslate } = useThemeHooks();
|
|
25
27
|
const { translate } = useTranslate();
|
|
@@ -36,6 +38,8 @@ export function SearchAiConversationInput({
|
|
|
36
38
|
}, [isGeneratingResponse]);
|
|
37
39
|
|
|
38
40
|
const handleSendMessage = () => {
|
|
41
|
+
if (disabled) return;
|
|
42
|
+
|
|
39
43
|
setQuery('');
|
|
40
44
|
onMessageSent(query);
|
|
41
45
|
};
|
|
@@ -46,7 +50,7 @@ export function SearchAiConversationInput({
|
|
|
46
50
|
}
|
|
47
51
|
};
|
|
48
52
|
|
|
49
|
-
const isDisabled = isGeneratingResponse || query.trim().length === 0;
|
|
53
|
+
const isDisabled = disabled || isGeneratingResponse || query.trim().length === 0;
|
|
50
54
|
|
|
51
55
|
return (
|
|
52
56
|
<SearchAiConversationInputWrapper
|
|
@@ -62,7 +66,7 @@ export function SearchAiConversationInput({
|
|
|
62
66
|
onChange={(e) => setQuery(e.target.value)}
|
|
63
67
|
onKeyUp={handleOnKeyUp}
|
|
64
68
|
value={query}
|
|
65
|
-
disabled={isGeneratingResponse}
|
|
69
|
+
disabled={disabled || isGeneratingResponse}
|
|
66
70
|
maxLength={AI_SEARCH_MAX_MESSAGE_LENGTH}
|
|
67
71
|
/>
|
|
68
72
|
|
|
@@ -111,6 +115,10 @@ const ConversationInput = styled.input`
|
|
|
111
115
|
border-color: var(--search-ai-conversation-input-border-color-focus);
|
|
112
116
|
}
|
|
113
117
|
|
|
118
|
+
&:disabled {
|
|
119
|
+
background-color: var(--search-ai-conversation-input-bg-color-disabled);
|
|
120
|
+
}
|
|
121
|
+
|
|
114
122
|
&:focus:disabled {
|
|
115
123
|
border-color: var(--search-ai-conversation-input-border-color-disabled);
|
|
116
124
|
}
|
|
@@ -126,6 +134,8 @@ const SendButton = styled(Button)`
|
|
|
126
134
|
display: flex;
|
|
127
135
|
align-items: center;
|
|
128
136
|
justify-content: center;
|
|
137
|
+
border-radius: var(--search-ai-conversation-input-send-button-border-radius);
|
|
138
|
+
padding: var(--search-ai-conversation-input-send-button-padding);
|
|
129
139
|
|
|
130
140
|
&:hover {
|
|
131
141
|
background-color: var(--search-ai-conversation-input-send-button-bg-color-hover);
|