@redocly/theme 0.63.0-next.4 → 0.63.0-next.6
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/variables.js +2 -2
- package/lib/components/Buttons/DownloadButton.d.ts +6 -0
- package/lib/components/Buttons/DownloadButton.js +20 -0
- package/lib/components/Buttons/EmailButton.js +6 -1
- package/lib/components/Buttons/NewTabButton.js +6 -1
- package/lib/components/Catalog/Catalog.js +114 -50
- package/lib/components/Catalog/CatalogAvatar.d.ts +5 -0
- package/lib/components/Catalog/CatalogAvatar.js +92 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +26 -7
- package/lib/components/Catalog/CatalogCardView/CatalogCardView.js +10 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +17 -17
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.js +4 -20
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.js +53 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.js +3 -17
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.js +30 -9
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +16 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +8 -4
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +11 -5
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.js +7 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +1 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +1 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.d.ts +4 -2
- package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.js +25 -8
- package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.d.ts +7 -0
- package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.js +24 -0
- package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.d.ts +6 -0
- package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.js +26 -0
- package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.d.ts +7 -0
- package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.js +30 -0
- package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.d.ts +13 -0
- package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.js +30 -0
- package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.d.ts +11 -0
- package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.js +21 -0
- package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.d.ts +7 -0
- package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.js +25 -0
- package/lib/components/Catalog/CatalogPageDescription.js +0 -6
- package/lib/components/Catalog/CatalogSelector.d.ts +0 -1
- package/lib/components/Catalog/CatalogSelector.js +50 -16
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +2 -1
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +20 -5
- package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +2 -23
- package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +2 -1
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +14 -6
- package/lib/components/Catalog/variables.js +78 -36
- package/lib/components/Filter/variables.js +1 -1
- package/lib/components/LoadMore/LoadMore.js +1 -0
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/PageActions/PageActions.js +1 -2
- package/lib/components/Search/SearchDialog.js +1 -1
- package/lib/components/SidebarActions/SidebarActions.js +1 -1
- package/lib/components/Tooltip/AnchorTooltip.js +5 -2
- package/lib/components/Tooltip/JsTooltip.js +5 -2
- package/lib/components/UserMenu/UserMenu.js +1 -3
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/hooks/use-is-truncated.d.ts +1 -0
- package/lib/core/hooks/use-is-truncated.js +19 -0
- package/lib/core/hooks/use-tabs.d.ts +1 -1
- package/lib/core/hooks/use-tabs.js +30 -17
- package/lib/core/types/hooks.d.ts +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/tooltip.d.ts +1 -0
- package/lib/core/utils/custom-catalog-options-casing.d.ts +15 -0
- package/lib/core/utils/custom-catalog-options-casing.js +32 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/markdoc/components/MarkdocExample/MarkdocExample.js +2 -2
- package/lib/markdoc/components/Tabs/Tabs.d.ts +1 -2
- package/lib/markdoc/components/Tabs/Tabs.js +9 -22
- package/package.json +4 -4
- package/src/components/Accordion/variables.ts +2 -2
- package/src/components/Buttons/DownloadButton.tsx +41 -0
- package/src/components/Buttons/EmailButton.tsx +18 -8
- package/src/components/Buttons/NewTabButton.tsx +19 -8
- package/src/components/Catalog/Catalog.tsx +157 -95
- package/src/components/Catalog/CatalogAvatar.tsx +68 -0
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +29 -5
- package/src/components/Catalog/CatalogCardView/CatalogCardView.tsx +10 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +17 -17
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.tsx +4 -21
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.tsx +82 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.tsx +4 -22
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.tsx +39 -10
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +19 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +8 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +12 -10
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +6 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +10 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +1 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +1 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilterContent.tsx +30 -6
- package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.tsx +31 -0
- package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.tsx +34 -0
- package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.tsx +40 -0
- package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.tsx +54 -0
- package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.tsx +34 -0
- package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.tsx +39 -0
- package/src/components/Catalog/CatalogPageDescription.tsx +0 -6
- package/src/components/Catalog/CatalogSelector.tsx +23 -21
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +37 -6
- package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +2 -26
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +24 -9
- package/src/components/Catalog/variables.ts +78 -36
- package/src/components/Filter/variables.ts +1 -1
- package/src/components/LoadMore/LoadMore.tsx +1 -0
- package/src/components/Menu/MenuItem.tsx +1 -0
- package/src/components/PageActions/PageActions.tsx +1 -2
- package/src/components/Search/SearchDialog.tsx +1 -1
- package/src/components/SidebarActions/SidebarActions.tsx +1 -0
- package/src/components/Tooltip/AnchorTooltip.tsx +5 -1
- package/src/components/Tooltip/JsTooltip.tsx +5 -1
- package/src/components/UserMenu/UserMenu.tsx +1 -3
- package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +1 -1
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/use-is-truncated.ts +20 -0
- package/src/core/hooks/use-tabs.ts +40 -21
- package/src/core/types/hooks.ts +1 -1
- package/src/core/types/l10n.ts +7 -0
- package/src/core/types/tooltip.ts +1 -0
- package/src/core/utils/custom-catalog-options-casing.ts +29 -0
- package/src/core/utils/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/markdoc/components/MarkdocExample/MarkdocExample.tsx +2 -6
- package/src/markdoc/components/Tabs/Tabs.tsx +4 -37
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { useInRouterContext } from 'react-router-dom';
|
|
3
|
-
import styled
|
|
3
|
+
import styled from 'styled-components';
|
|
4
4
|
|
|
5
5
|
import type { JSX } from 'react';
|
|
6
6
|
|
|
@@ -27,7 +27,6 @@ type TabsProps = {
|
|
|
27
27
|
className?: string;
|
|
28
28
|
size: TabsSize;
|
|
29
29
|
initialTab?: string;
|
|
30
|
-
forceReady?: boolean;
|
|
31
30
|
activeTab?: string;
|
|
32
31
|
};
|
|
33
32
|
|
|
@@ -43,11 +42,9 @@ type UseActiveTabFn = (
|
|
|
43
42
|
type TabsViewProps = Omit<TabsProps, 'children'> & {
|
|
44
43
|
childrenArray: React.ReactElement<TabItemProps>[];
|
|
45
44
|
initialTab: string;
|
|
46
|
-
isReady: boolean;
|
|
47
45
|
labelsHash: string;
|
|
48
46
|
useActiveTab: UseActiveTabFn;
|
|
49
47
|
containerRef: React.RefObject<HTMLUListElement | null>;
|
|
50
|
-
onReadyChange: (ready: boolean) => void;
|
|
51
48
|
externalActiveTab?: string;
|
|
52
49
|
};
|
|
53
50
|
|
|
@@ -57,26 +54,14 @@ export function Tabs({
|
|
|
57
54
|
className,
|
|
58
55
|
size,
|
|
59
56
|
initialTab: propInitialTab,
|
|
60
|
-
forceReady = false,
|
|
61
57
|
activeTab: controlledActiveTab,
|
|
62
58
|
}: TabsProps): JSX.Element {
|
|
63
59
|
const childrenArray = React.Children.toArray(children) as React.ReactElement<TabItemProps>[];
|
|
64
|
-
const [isReady, setIsReady] = useState(false);
|
|
65
60
|
const containerRef = useRef<HTMLUListElement | null>(null);
|
|
66
61
|
|
|
67
62
|
const initialTab = propInitialTab ?? childrenArray[0]?.props.label ?? '';
|
|
68
63
|
const labelsHash = childrenArray.map((c) => c.props.label).join('|');
|
|
69
64
|
|
|
70
|
-
const handleReadyChange = useCallback((ready: boolean) => {
|
|
71
|
-
setIsReady(ready);
|
|
72
|
-
}, []);
|
|
73
|
-
|
|
74
|
-
// Reset isReady when children change (new page/tabs)
|
|
75
|
-
// Use useLayoutEffect to run synchronously before paint
|
|
76
|
-
useLayoutEffect(() => {
|
|
77
|
-
setIsReady(false);
|
|
78
|
-
}, [labelsHash]);
|
|
79
|
-
|
|
80
65
|
const inRouter = useInRouterContext();
|
|
81
66
|
|
|
82
67
|
return (
|
|
@@ -87,10 +72,8 @@ export function Tabs({
|
|
|
87
72
|
childrenArray={childrenArray}
|
|
88
73
|
initialTab={initialTab}
|
|
89
74
|
useActiveTab={inRouter ? useActiveTabWithRouter : useActiveTabWithoutRouter}
|
|
90
|
-
isReady={isReady || forceReady}
|
|
91
75
|
labelsHash={labelsHash}
|
|
92
76
|
containerRef={containerRef}
|
|
93
|
-
onReadyChange={handleReadyChange}
|
|
94
77
|
externalActiveTab={controlledActiveTab}
|
|
95
78
|
/>
|
|
96
79
|
);
|
|
@@ -103,10 +86,8 @@ function TabsView({
|
|
|
103
86
|
childrenArray,
|
|
104
87
|
useActiveTab,
|
|
105
88
|
initialTab,
|
|
106
|
-
isReady,
|
|
107
89
|
labelsHash,
|
|
108
90
|
containerRef,
|
|
109
|
-
onReadyChange,
|
|
110
91
|
externalActiveTab,
|
|
111
92
|
}: TabsViewProps): JSX.Element {
|
|
112
93
|
const { activeTab, setActiveTab } = useActiveTab(initialTab, id, childrenArray);
|
|
@@ -118,12 +99,7 @@ function TabsView({
|
|
|
118
99
|
}, [externalActiveTab, activeTab, setActiveTab]);
|
|
119
100
|
|
|
120
101
|
return (
|
|
121
|
-
<TabsContainer
|
|
122
|
-
data-component-name="Markdoc/Tabs/Tabs"
|
|
123
|
-
className={className}
|
|
124
|
-
key={id}
|
|
125
|
-
$isReady={isReady}
|
|
126
|
-
>
|
|
102
|
+
<TabsContainer data-component-name="Markdoc/Tabs/Tabs" className={className} key={id}>
|
|
127
103
|
<TabList
|
|
128
104
|
key={labelsHash}
|
|
129
105
|
size={size}
|
|
@@ -131,7 +107,6 @@ function TabsView({
|
|
|
131
107
|
activeTab={activeTab}
|
|
132
108
|
onTabChange={setActiveTab}
|
|
133
109
|
containerRef={containerRef}
|
|
134
|
-
onReadyChange={onReadyChange}
|
|
135
110
|
/>
|
|
136
111
|
{childrenArray.map((child, index) => {
|
|
137
112
|
const { label } = child.props;
|
|
@@ -200,7 +175,7 @@ const useActiveTabWithoutRouter = (
|
|
|
200
175
|
};
|
|
201
176
|
};
|
|
202
177
|
|
|
203
|
-
const TabsContainer = styled.div
|
|
178
|
+
const TabsContainer = styled.div`
|
|
204
179
|
position: relative;
|
|
205
180
|
color: var(--md-tabs-container-text-color);
|
|
206
181
|
font-size: var(--md-tabs-container-font-size);
|
|
@@ -216,14 +191,6 @@ const TabsContainer = styled.div<{ $isReady: boolean }>`
|
|
|
216
191
|
margin: 0;
|
|
217
192
|
padding: 0;
|
|
218
193
|
}
|
|
219
|
-
|
|
220
|
-
${({ $isReady }) =>
|
|
221
|
-
!$isReady &&
|
|
222
|
-
css`
|
|
223
|
-
opacity: 0;
|
|
224
|
-
pointer-events: none;
|
|
225
|
-
overflow: hidden;
|
|
226
|
-
`}
|
|
227
194
|
`;
|
|
228
195
|
|
|
229
196
|
export const TabContent = styled.div`
|