@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,13 +15,23 @@ 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
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ 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
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
36
|
var t = {};
|
|
27
37
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -15,13 +15,23 @@ 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
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ 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
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ 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
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.HtmlBlock = HtmlBlock;
|
|
27
37
|
const React = __importStar(require("react"));
|
|
@@ -15,13 +15,23 @@ 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
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.InlineSvg = InlineSvg;
|
|
27
37
|
const React = __importStar(require("react"));
|
|
@@ -15,13 +15,23 @@ 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
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -6,8 +6,10 @@ type TabListProps = {
|
|
|
6
6
|
size: TabsSize;
|
|
7
7
|
activeTab: string;
|
|
8
8
|
onTabChange: (tab: string) => void;
|
|
9
|
+
containerRef: React.RefObject<HTMLUListElement | null>;
|
|
10
|
+
onReadyChange?: (isReady: boolean) => void;
|
|
9
11
|
};
|
|
10
|
-
export declare function TabList({ childrenArray, size, activeTab, onTabChange, }: TabListProps): JSX.Element;
|
|
12
|
+
export declare function TabList({ childrenArray, size, activeTab, onTabChange, containerRef, onReadyChange, }: TabListProps): JSX.Element;
|
|
11
13
|
export declare const TabListContainer: import("styled-components").StyledComponent<"ul", any, {}, never>;
|
|
12
14
|
export declare const TabItem: import("styled-components").StyledComponent<"li", any, {
|
|
13
15
|
active?: boolean;
|
|
@@ -15,13 +15,23 @@ 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
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.TabButtonLink = exports.TabItem = exports.TabListContainer = void 0;
|
|
27
37
|
exports.TabList = TabList;
|
|
@@ -34,47 +44,144 @@ const DropdownMenuItem_1 = require("../../../components/Dropdown/DropdownMenuIte
|
|
|
34
44
|
const Button_1 = require("../../../components/Button/Button");
|
|
35
45
|
const hooks_1 = require("../../../core/hooks");
|
|
36
46
|
const utils_1 = require("../../../core/utils");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Calculates optimal dropdown position relative to viewport to ensure visibility.
|
|
49
|
+
* Positions below the button by default, but moves above if insufficient space.
|
|
50
|
+
* Adjusts horizontal position to prevent overflow off screen edges.
|
|
51
|
+
*/
|
|
52
|
+
const calculateDropdownPosition = (buttonRect, dropdownRect) => {
|
|
53
|
+
const gap = 4;
|
|
54
|
+
const margin = 16;
|
|
55
|
+
const spaceBelow = window.innerHeight - buttonRect.bottom;
|
|
56
|
+
const spaceAbove = buttonRect.top;
|
|
57
|
+
// Position below button, or above if dropdown doesn't fit below
|
|
58
|
+
const top = spaceBelow < dropdownRect.height + gap && spaceAbove > spaceBelow
|
|
59
|
+
? buttonRect.top - gap
|
|
60
|
+
: buttonRect.bottom + gap;
|
|
61
|
+
// Align with button left edge, adjust if overflows screen
|
|
62
|
+
const idealLeft = buttonRect.left;
|
|
63
|
+
const rightEdge = idealLeft + dropdownRect.width;
|
|
64
|
+
const overflowsRight = rightEdge > window.innerWidth - margin;
|
|
65
|
+
const left = overflowsRight
|
|
66
|
+
? window.innerWidth - dropdownRect.width - margin
|
|
67
|
+
: Math.max(margin, idealLeft);
|
|
68
|
+
return { top, left };
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Manages dropdown positioning and updates on scroll/resize events for TabList.
|
|
72
|
+
*/
|
|
73
|
+
const useDropdownPosition = (hasOverflow, dropdownRef) => {
|
|
74
|
+
const [dropdownPosition, setDropdownPosition] = (0, react_1.useState)({});
|
|
75
|
+
const [isDropdownOpen, setIsDropdownOpen] = (0, react_1.useState)(false);
|
|
76
|
+
const updateDropdownPosition = (0, react_1.useCallback)(() => {
|
|
77
|
+
if (!dropdownRef.current)
|
|
78
|
+
return;
|
|
79
|
+
const button = dropdownRef.current.querySelector('button');
|
|
80
|
+
const dropdownMenu = dropdownRef.current.querySelector('div:last-child');
|
|
81
|
+
if (!button || !dropdownMenu)
|
|
82
|
+
return;
|
|
83
|
+
const buttonRect = button.getBoundingClientRect();
|
|
84
|
+
const dropdownRect = dropdownMenu.getBoundingClientRect();
|
|
85
|
+
const position = calculateDropdownPosition(buttonRect, dropdownRect);
|
|
86
|
+
setDropdownPosition(position);
|
|
87
|
+
}, [dropdownRef]);
|
|
88
|
+
// Track when dropdown menu appears and recalculate position
|
|
89
|
+
(0, react_1.useEffect)(() => {
|
|
90
|
+
if (!hasOverflow || !isDropdownOpen || !dropdownRef.current)
|
|
91
|
+
return;
|
|
92
|
+
const dropdownMenu = dropdownRef.current.querySelector('div:last-child');
|
|
93
|
+
if (!dropdownMenu)
|
|
94
|
+
return;
|
|
95
|
+
// ResizeObserver tracks both initial render and size changes
|
|
96
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
97
|
+
updateDropdownPosition();
|
|
98
|
+
});
|
|
99
|
+
resizeObserver.observe(dropdownMenu);
|
|
100
|
+
return () => resizeObserver.disconnect();
|
|
101
|
+
}, [hasOverflow, isDropdownOpen, dropdownRef, updateDropdownPosition]);
|
|
102
|
+
// Update position on scroll/resize
|
|
103
|
+
(0, react_1.useEffect)(() => {
|
|
104
|
+
if (!hasOverflow || !isDropdownOpen)
|
|
105
|
+
return;
|
|
106
|
+
window.addEventListener('scroll', updateDropdownPosition, true);
|
|
107
|
+
window.addEventListener('resize', updateDropdownPosition);
|
|
108
|
+
return () => {
|
|
109
|
+
window.removeEventListener('scroll', updateDropdownPosition, true);
|
|
110
|
+
window.removeEventListener('resize', updateDropdownPosition);
|
|
111
|
+
};
|
|
112
|
+
}, [hasOverflow, isDropdownOpen, updateDropdownPosition]);
|
|
113
|
+
return {
|
|
114
|
+
dropdownPosition,
|
|
115
|
+
isDropdownOpen,
|
|
116
|
+
setIsDropdownOpen,
|
|
117
|
+
setDropdownPosition,
|
|
118
|
+
updateDropdownPosition,
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
const renderTab = (child, index, size, setTabRef, handleKeyboard, onTabClick) => {
|
|
122
|
+
const { label, icon } = child.props;
|
|
123
|
+
const tabId = (0, utils_1.getTabId)(label, index);
|
|
124
|
+
return (react_1.default.createElement(Tab_1.Tab, { key: `key-${tabId}`, tabId: tabId, label: label, icon: icon, size: size, disabled: child.props.disable, setRef: (el) => setTabRef(el, index), onKeyDown: (event) => handleKeyboard(event, index), onClick: () => {
|
|
125
|
+
var _a, _b;
|
|
126
|
+
(_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
127
|
+
onTabClick(label);
|
|
128
|
+
} }));
|
|
129
|
+
};
|
|
130
|
+
function TabList({ childrenArray, size, activeTab, onTabChange, containerRef, onReadyChange, }) {
|
|
131
|
+
const dropdownRef = (0, react_1.useRef)(null);
|
|
132
|
+
const totalTabs = childrenArray.length;
|
|
133
|
+
const { overflowTabs, visibleTabs, handleKeyboard, onTabClick, setTabRef, isReady } = (0, hooks_1.useTabs)({
|
|
40
134
|
activeTab,
|
|
41
135
|
onTabChange,
|
|
42
|
-
containerRef
|
|
43
|
-
totalTabs
|
|
136
|
+
containerRef,
|
|
137
|
+
totalTabs,
|
|
44
138
|
});
|
|
139
|
+
(0, react_1.useEffect)(() => {
|
|
140
|
+
onReadyChange === null || onReadyChange === void 0 ? void 0 : onReadyChange(isReady);
|
|
141
|
+
}, [isReady, onReadyChange]);
|
|
45
142
|
const { highlightStyle } = useHighlightBarAnimation({
|
|
46
143
|
activeTab,
|
|
47
144
|
childrenArray,
|
|
48
145
|
overflowTabs,
|
|
49
|
-
tabsContainerRef,
|
|
146
|
+
tabsContainerRef: containerRef,
|
|
50
147
|
visibleTabs,
|
|
51
148
|
});
|
|
52
|
-
|
|
149
|
+
const hasOverflow = overflowTabs.length > 0;
|
|
150
|
+
const isMoreActive = hasOverflow &&
|
|
151
|
+
overflowTabs.some((i) => childrenArray[i] && activeTab === childrenArray[i].props.label);
|
|
152
|
+
// Show as selector when no visible tabs (all tabs in dropdown)
|
|
153
|
+
const showAsSelector = visibleTabs.length === 0 && hasOverflow;
|
|
154
|
+
const { dropdownPosition, setIsDropdownOpen, setDropdownPosition } = useDropdownPosition(hasOverflow, dropdownRef);
|
|
155
|
+
return (react_1.default.createElement(exports.TabListContainer, { role: "tablist", ref: containerRef },
|
|
53
156
|
react_1.default.createElement(HighlightBar, { size: size, style: highlightStyle },
|
|
54
157
|
react_1.default.createElement("div", null)),
|
|
55
158
|
childrenArray.map((child, index) => {
|
|
56
|
-
|
|
159
|
+
// Show all tabs before ready (for measurement), then only visible ones
|
|
160
|
+
const shouldRender = !isReady || visibleTabs.includes(index);
|
|
161
|
+
if (!shouldRender)
|
|
57
162
|
return null;
|
|
58
|
-
|
|
59
|
-
const tabId = (0, utils_1.getTabId)(label, index);
|
|
60
|
-
return (react_1.default.createElement(Tab_1.Tab, { key: `key-${tabId}`, tabId: tabId, label: label, icon: icon, size: size, disabled: child.props.disable, setRef: (el) => setTabRef(el, index), onKeyDown: (event) => handleKeyboard(event, index), onClick: () => {
|
|
61
|
-
var _a, _b;
|
|
62
|
-
(_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
63
|
-
onTabClick(label);
|
|
64
|
-
} }));
|
|
163
|
+
return renderTab(child, index, size, setTabRef, handleKeyboard, onTabClick);
|
|
65
164
|
}),
|
|
66
|
-
react_1.default.createElement(exports.TabItem, { size: size, active:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
165
|
+
hasOverflow && (react_1.default.createElement(exports.TabItem, { size: size, active: isMoreActive || showAsSelector, tabIndex: 0, className: "dropdown-tab" },
|
|
166
|
+
react_1.default.createElement(DropdownWrapper, { "$top": dropdownPosition.top, "$left": dropdownPosition.left, onClickCapture: () => {
|
|
167
|
+
setIsDropdownOpen(true);
|
|
168
|
+
} },
|
|
169
|
+
react_1.default.createElement(FixedPositionDropdown, { ref: dropdownRef, trigger: react_1.default.createElement(exports.TabButtonLink, { size: size, className: isMoreActive || showAsSelector ? 'active' : undefined }, showAsSelector ? react_1.default.createElement(TabButtonText, null, activeTab) : 'More'), alignment: "start", withArrow: true, onClose: () => {
|
|
170
|
+
setIsDropdownOpen(false);
|
|
171
|
+
setDropdownPosition({});
|
|
172
|
+
} },
|
|
173
|
+
react_1.default.createElement(DropdownMenu_1.DropdownMenu, null, overflowTabs.map((index) => {
|
|
174
|
+
const child = childrenArray[index];
|
|
175
|
+
if (!child)
|
|
176
|
+
return null;
|
|
177
|
+
const { label } = child.props;
|
|
178
|
+
const tabId = (0, utils_1.getTabId)(label, index);
|
|
179
|
+
return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { key: `more-${tabId}`, active: activeTab === label, onAction: () => {
|
|
180
|
+
var _a, _b;
|
|
181
|
+
(_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
182
|
+
onTabClick(index);
|
|
183
|
+
}, disabled: child.props.disable }, label));
|
|
184
|
+
}))))))));
|
|
78
185
|
}
|
|
79
186
|
const useHighlightBarAnimation = (props) => {
|
|
80
187
|
const { childrenArray, activeTab, tabsContainerRef, visibleTabs, overflowTabs } = props;
|
|
@@ -89,18 +196,11 @@ const useHighlightBarAnimation = (props) => {
|
|
|
89
196
|
setHighlightStyle({ left: 0, width: 0 });
|
|
90
197
|
return;
|
|
91
198
|
}
|
|
92
|
-
|
|
93
|
-
if (!activeTabElement)
|
|
94
|
-
return;
|
|
199
|
+
// Remove active class from all tabs first
|
|
95
200
|
container.querySelectorAll('[data-label]').forEach((el) => {
|
|
96
201
|
el.classList.remove('active');
|
|
97
202
|
});
|
|
98
|
-
|
|
99
|
-
if (visibleTabs.includes(activeIndex)) {
|
|
100
|
-
activeTabElement.classList.add('active');
|
|
101
|
-
setHighlightStyle({ left: offsetLeft, width: offsetWidth });
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
203
|
+
// Check if active tab is in overflow first
|
|
104
204
|
if (overflowTabs.includes(activeIndex)) {
|
|
105
205
|
const moreButton = container.querySelector('button');
|
|
106
206
|
if (!moreButton)
|
|
@@ -113,6 +213,16 @@ const useHighlightBarAnimation = (props) => {
|
|
|
113
213
|
});
|
|
114
214
|
return;
|
|
115
215
|
}
|
|
216
|
+
// Active tab is visible, find its element
|
|
217
|
+
const activeTabElement = container.querySelector(`[data-label="${activeTab}"]`);
|
|
218
|
+
if (!activeTabElement)
|
|
219
|
+
return;
|
|
220
|
+
const { offsetLeft, offsetWidth } = activeTabElement;
|
|
221
|
+
if (visibleTabs.includes(activeIndex)) {
|
|
222
|
+
activeTabElement.classList.add('active');
|
|
223
|
+
setHighlightStyle({ left: offsetLeft, width: offsetWidth });
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
116
226
|
}, [activeTab, childrenArray, visibleTabs, overflowTabs, tabsContainerRef]);
|
|
117
227
|
return { highlightStyle };
|
|
118
228
|
};
|
|
@@ -122,15 +232,11 @@ exports.TabListContainer = styled_components_1.default.ul `
|
|
|
122
232
|
gap: var(--md-tabs-gap);
|
|
123
233
|
width: 100%;
|
|
124
234
|
min-width: 0;
|
|
125
|
-
position: relative;
|
|
126
235
|
|
|
127
236
|
&::before {
|
|
128
237
|
content: '';
|
|
129
238
|
position: absolute;
|
|
130
|
-
|
|
131
|
-
left: 0px;
|
|
132
|
-
right: 0px;
|
|
133
|
-
bottom: 0px;
|
|
239
|
+
inset: 0;
|
|
134
240
|
border: var(--md-tabs-border);
|
|
135
241
|
border-width: var(--md-tabs-border-width);
|
|
136
242
|
pointer-events: none;
|
|
@@ -138,11 +244,17 @@ exports.TabListContainer = styled_components_1.default.ul `
|
|
|
138
244
|
|
|
139
245
|
&& {
|
|
140
246
|
padding: var(--md-tabs-padding);
|
|
141
|
-
margin-block-end: 0;
|
|
142
247
|
margin: 0;
|
|
143
248
|
|
|
144
249
|
& > li {
|
|
145
|
-
margin-bottom:
|
|
250
|
+
margin-bottom: 0;
|
|
251
|
+
flex-shrink: 0;
|
|
252
|
+
|
|
253
|
+
&.dropdown-tab {
|
|
254
|
+
flex-shrink: 1;
|
|
255
|
+
min-width: 0;
|
|
256
|
+
max-width: 100%;
|
|
257
|
+
}
|
|
146
258
|
}
|
|
147
259
|
}
|
|
148
260
|
`;
|
|
@@ -152,7 +264,7 @@ exports.TabItem = styled_components_1.default.li `
|
|
|
152
264
|
cursor: pointer;
|
|
153
265
|
align-items: center;
|
|
154
266
|
padding: var(--md-tabs-tab-wrapper-padding);
|
|
155
|
-
z-index:
|
|
267
|
+
z-index: var(--z-index-surface);
|
|
156
268
|
|
|
157
269
|
${({ active, size }) => active
|
|
158
270
|
? (0, styled_components_1.css) `
|
|
@@ -189,6 +301,46 @@ exports.TabItem = styled_components_1.default.li `
|
|
|
189
301
|
}
|
|
190
302
|
}
|
|
191
303
|
`;
|
|
304
|
+
const DropdownWrapper = styled_components_1.default.div.attrs((props) => ({
|
|
305
|
+
style: Object.assign(Object.assign({}, (props.$top !== undefined && { '--dropdown-top': `${props.$top}px` })), (props.$left !== undefined && { '--dropdown-left': `${props.$left}px` })),
|
|
306
|
+
})) `
|
|
307
|
+
position: static;
|
|
308
|
+
z-index: var(--z-index-raised);
|
|
309
|
+
width: 100%;
|
|
310
|
+
min-width: 0;
|
|
311
|
+
`;
|
|
312
|
+
const FixedPositionDropdown = (0, styled_components_1.default)(Dropdown_1.Dropdown) `
|
|
313
|
+
position: static;
|
|
314
|
+
width: 100%;
|
|
315
|
+
min-width: 0;
|
|
316
|
+
|
|
317
|
+
> div:first-child {
|
|
318
|
+
width: 100%;
|
|
319
|
+
min-width: 0;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
> div:last-child {
|
|
323
|
+
position: fixed;
|
|
324
|
+
top: var(--dropdown-top, 0);
|
|
325
|
+
left: var(--dropdown-left, 0);
|
|
326
|
+
right: auto;
|
|
327
|
+
bottom: auto;
|
|
328
|
+
transform: none;
|
|
329
|
+
padding-top: 0;
|
|
330
|
+
max-width: min(400px, calc(100vw - 32px));
|
|
331
|
+
max-height: calc(100vh - var(--dropdown-top, 0) - 32px);
|
|
332
|
+
overflow-y: auto;
|
|
333
|
+
z-index: var(--z-index-raised);
|
|
334
|
+
|
|
335
|
+
ul {
|
|
336
|
+
li {
|
|
337
|
+
overflow: hidden;
|
|
338
|
+
text-overflow: ellipsis;
|
|
339
|
+
white-space: nowrap;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
`;
|
|
192
344
|
const HighlightBar = styled_components_1.default.div `
|
|
193
345
|
position: absolute;
|
|
194
346
|
top: 0;
|
|
@@ -208,11 +360,19 @@ const HighlightBar = styled_components_1.default.div `
|
|
|
208
360
|
border-radius: var(--md-tabs-${({ size }) => size}-active-tab-border-radius);
|
|
209
361
|
}
|
|
210
362
|
`;
|
|
363
|
+
const TabButtonText = styled_components_1.default.span `
|
|
364
|
+
overflow: hidden;
|
|
365
|
+
text-overflow: ellipsis;
|
|
366
|
+
white-space: nowrap;
|
|
367
|
+
flex: 1;
|
|
368
|
+
min-width: 0;
|
|
369
|
+
`;
|
|
211
370
|
exports.TabButtonLink = (0, styled_components_1.default)(Button_1.Button) `
|
|
212
371
|
color: var(--md-tabs-tab-text-color);
|
|
213
372
|
font-family: var(--md-tabs-tab-font-family);
|
|
214
373
|
font-style: var(--md-tabs-tab-font-style);
|
|
215
374
|
background-color: var(--md-tabs-tab-bg-color);
|
|
375
|
+
width: 100%;
|
|
216
376
|
|
|
217
377
|
transition:
|
|
218
378
|
background-color 300ms ease-in-out,
|
|
@@ -231,9 +391,9 @@ exports.TabButtonLink = (0, styled_components_1.default)(Button_1.Button) `
|
|
|
231
391
|
|
|
232
392
|
&.active {
|
|
233
393
|
color: var(--md-tabs-active-tab-text-color);
|
|
234
|
-
font-size: var(--md-tabs-${({ size }) => size}-active-tab-font-size);
|
|
235
394
|
font-family: var(--md-tabs-active-tab-font-family);
|
|
236
395
|
font-style: var(--md-tabs-active-tab-font-style);
|
|
396
|
+
font-size: var(--md-tabs-${({ size }) => size}-active-tab-font-size);
|
|
237
397
|
font-weight: var(--md-tabs-${({ size }) => size}-active-tab-font-weight);
|
|
238
398
|
line-height: var(--md-tabs-${({ size }) => size}-active-tab-line-height);
|
|
239
399
|
background-color: var(--md-tabs-active-tab-bg-color);
|
|
@@ -243,12 +403,12 @@ exports.TabButtonLink = (0, styled_components_1.default)(Button_1.Button) `
|
|
|
243
403
|
|
|
244
404
|
&:hover {
|
|
245
405
|
color: var(--md-tabs-hover-tab-text-color);
|
|
246
|
-
font-size: var(--md-tabs-${({ size }) => size}-hover-tab-font-size);
|
|
247
406
|
font-family: var(--md-tabs-hover-tab-font-family);
|
|
248
407
|
font-style: var(--md-tabs-hover-tab-font-style);
|
|
408
|
+
font-size: var(--md-tabs-${({ size }) => size}-hover-tab-font-size);
|
|
249
409
|
font-weight: var(--md-tabs-${({ size }) => size}-hover-tab-font-weight);
|
|
250
|
-
background-color: var(--md-tabs-hover-tab-bg-color);
|
|
251
410
|
line-height: var(--md-tabs-${({ size }) => size}-hover-tab-line-height);
|
|
411
|
+
background-color: var(--md-tabs-hover-tab-bg-color);
|
|
252
412
|
border-radius: var(--md-tabs-${({ size }) => size}-hover-tab-border-radius);
|
|
253
413
|
padding: var(--md-tabs-${({ size }) => size}-hover-tab-padding);
|
|
254
414
|
}
|
|
@@ -17,7 +17,8 @@ type TabsProps = {
|
|
|
17
17
|
className?: string;
|
|
18
18
|
size: TabsSize;
|
|
19
19
|
initialTab?: string;
|
|
20
|
+
forceReady?: boolean;
|
|
20
21
|
};
|
|
21
|
-
export declare function Tabs({ id, children, className, size, initialTab: propInitialTab, }: TabsProps): JSX.Element;
|
|
22
|
+
export declare function Tabs({ id, children, className, size, initialTab: propInitialTab, forceReady, }: TabsProps): JSX.Element;
|
|
22
23
|
export declare const TabContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
23
24
|
export {};
|