@redocly/theme 0.58.0-next.7 → 0.58.0-next.8
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/core/openapi/index.d.ts +1 -1
- package/lib/core/types/search.d.ts +2 -3
- package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tabs.js +3 -2
- package/package.json +3 -3
- package/src/core/openapi/index.ts +1 -1
- package/src/core/types/search.ts +3 -3
- package/src/markdoc/components/Tabs/Tabs.tsx +10 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { UserClaims } from '../types/user-claims';
|
|
2
|
-
export type {
|
|
2
|
+
export type { OperationParameter, ParameterHighlight } from '../types/search';
|
|
3
3
|
export type { TFunction, TOptions } from '../types/l10n';
|
|
4
4
|
export type { SelectOption, SelectProps } from '../types/select';
|
|
5
5
|
export { IS_BROWSER } from '../utils/dom';
|
|
@@ -13,7 +13,7 @@ export type OperationParameter = {
|
|
|
13
13
|
example: string | undefined;
|
|
14
14
|
enum: string[] | undefined;
|
|
15
15
|
};
|
|
16
|
-
export type
|
|
16
|
+
export type SearchHit = {
|
|
17
17
|
id: string;
|
|
18
18
|
url: string;
|
|
19
19
|
title: string | string[];
|
|
@@ -24,7 +24,6 @@ export type SearchDocument = {
|
|
|
24
24
|
deprecated?: boolean;
|
|
25
25
|
security?: string[];
|
|
26
26
|
parameters?: OperationParameter[];
|
|
27
|
-
metadata?: Record<string, any>;
|
|
28
27
|
version?: string;
|
|
29
28
|
versionFolderId?: string;
|
|
30
29
|
isDefaultVersion?: boolean;
|
|
@@ -48,7 +47,7 @@ export type ParameterHighlight = {
|
|
|
48
47
|
path: string[];
|
|
49
48
|
};
|
|
50
49
|
export type SearchItemData = {
|
|
51
|
-
document:
|
|
50
|
+
document: SearchHit;
|
|
52
51
|
highlight: Record<string, string> & {
|
|
53
52
|
parameters?: ParameterHighlight[];
|
|
54
53
|
path?: string[];
|
|
@@ -16,7 +16,8 @@ type TabsProps = {
|
|
|
16
16
|
className?: string;
|
|
17
17
|
size: TabsSize;
|
|
18
18
|
forceReady?: boolean;
|
|
19
|
+
initialTab?: string;
|
|
19
20
|
};
|
|
20
|
-
export declare function Tabs({ children, className, size, forceReady }: TabsProps): JSX.Element;
|
|
21
|
+
export declare function Tabs({ children, className, size, forceReady, initialTab: propInitialTab, }: TabsProps): JSX.Element;
|
|
21
22
|
export declare const TabContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
22
23
|
export {};
|
|
@@ -34,7 +34,7 @@ var TabsSize;
|
|
|
34
34
|
TabsSize["SMALL"] = "small";
|
|
35
35
|
TabsSize["MEDIUM"] = "medium";
|
|
36
36
|
})(TabsSize || (exports.TabsSize = TabsSize = {}));
|
|
37
|
-
function Tabs({ children, className, size, forceReady = false }) {
|
|
37
|
+
function Tabs({ children, className, size, forceReady = false, initialTab: propInitialTab, }) {
|
|
38
38
|
var _a, _b;
|
|
39
39
|
const [childrenArray, setChildrenArray] = (0, react_1.useState)(react_1.default.Children.toArray(children));
|
|
40
40
|
(0, react_1.useEffect)(() => {
|
|
@@ -42,7 +42,8 @@ function Tabs({ children, className, size, forceReady = false }) {
|
|
|
42
42
|
}, [children]);
|
|
43
43
|
const tabsContainerRef = (0, react_1.useRef)(null);
|
|
44
44
|
const [isAnimating, setIsAnimating] = (0, react_1.useState)(false);
|
|
45
|
-
const
|
|
45
|
+
const defaultInitialTab = (_b = (_a = childrenArray[0]) === null || _a === void 0 ? void 0 : _a.props.label) !== null && _b !== void 0 ? _b : '';
|
|
46
|
+
const initialTab = propInitialTab !== null && propInitialTab !== void 0 ? propInitialTab : defaultInitialTab;
|
|
46
47
|
const { activeTab, setTabRef, onTabClick, handleKeyboard, getTabId, visibleTabs, overflowTabs, ready, allTabsHidden, } = (0, hooks_1.useTabs)({
|
|
47
48
|
initialTab,
|
|
48
49
|
totalTabs: childrenArray.length,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.58.0-next.
|
|
3
|
+
"version": "0.58.0-next.8",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"openapi-sampler": "1.6.1",
|
|
88
88
|
"react-calendar": "5.1.0",
|
|
89
89
|
"react-date-picker": "11.0.0",
|
|
90
|
-
"@redocly/config": "0.
|
|
91
|
-
"@redocly/realm-asyncapi-sdk": "0.4.0-next.
|
|
90
|
+
"@redocly/config": "0.35.0",
|
|
91
|
+
"@redocly/realm-asyncapi-sdk": "0.4.0-next.3"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
94
|
"watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// the overall bundle size by avoiding importing the entire theme package
|
|
6
6
|
// when only specific functionality is needed.
|
|
7
7
|
export type { UserClaims } from '../types/user-claims';
|
|
8
|
-
export type {
|
|
8
|
+
export type { OperationParameter, ParameterHighlight } from '../types/search';
|
|
9
9
|
export type { TFunction, TOptions } from '../types/l10n';
|
|
10
10
|
export type { SelectOption, SelectProps } from '../types/select';
|
|
11
11
|
export { IS_BROWSER } from '../utils/dom';
|
package/src/core/types/search.ts
CHANGED
|
@@ -15,7 +15,8 @@ export type OperationParameter = {
|
|
|
15
15
|
enum: string[] | undefined;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
// TODO: review SearchHit type as it might contain properties that are not in the search results
|
|
19
|
+
export type SearchHit = {
|
|
19
20
|
id: string;
|
|
20
21
|
url: string;
|
|
21
22
|
title: string | string[];
|
|
@@ -26,7 +27,6 @@ export type SearchDocument = {
|
|
|
26
27
|
deprecated?: boolean;
|
|
27
28
|
security?: string[];
|
|
28
29
|
parameters?: OperationParameter[];
|
|
29
|
-
metadata?: Record<string, any>;
|
|
30
30
|
version?: string;
|
|
31
31
|
versionFolderId?: string;
|
|
32
32
|
isDefaultVersion?: boolean;
|
|
@@ -47,7 +47,7 @@ export type ParameterHighlight = {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
export type SearchItemData = {
|
|
50
|
-
document:
|
|
50
|
+
document: SearchHit;
|
|
51
51
|
highlight: Record<string, string> & { parameters?: ParameterHighlight[]; path?: string[] };
|
|
52
52
|
};
|
|
53
53
|
|
|
@@ -24,9 +24,16 @@ type TabsProps = {
|
|
|
24
24
|
className?: string;
|
|
25
25
|
size: TabsSize;
|
|
26
26
|
forceReady?: boolean;
|
|
27
|
+
initialTab?: string;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
|
-
export function Tabs({
|
|
30
|
+
export function Tabs({
|
|
31
|
+
children,
|
|
32
|
+
className,
|
|
33
|
+
size,
|
|
34
|
+
forceReady = false,
|
|
35
|
+
initialTab: propInitialTab,
|
|
36
|
+
}: TabsProps): JSX.Element {
|
|
30
37
|
const [childrenArray, setChildrenArray] = useState<React.ReactElement<TabItemProps>[]>(
|
|
31
38
|
React.Children.toArray(children) as React.ReactElement<TabItemProps>[],
|
|
32
39
|
);
|
|
@@ -36,7 +43,8 @@ export function Tabs({ children, className, size, forceReady = false }: TabsProp
|
|
|
36
43
|
}, [children]);
|
|
37
44
|
const tabsContainerRef = useRef<HTMLUListElement>(null);
|
|
38
45
|
const [isAnimating, setIsAnimating] = useState<boolean>(false);
|
|
39
|
-
const
|
|
46
|
+
const defaultInitialTab = childrenArray[0]?.props.label ?? '';
|
|
47
|
+
const initialTab = propInitialTab ?? defaultInitialTab;
|
|
40
48
|
const {
|
|
41
49
|
activeTab,
|
|
42
50
|
setTabRef,
|