@redocly/theme 0.9.14 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Markdown/Tabs/Tabs.d.ts +7 -6
- package/lib/Markdown/Tabs/Tabs.js +4 -2
- package/lib/Sidebar/SeparatorItem.js +4 -0
- package/lib/Sidebar/SeparatorLine.js +1 -1
- package/lib/config.d.ts +4 -0
- package/lib/config.js +4 -0
- package/lib/globalStyle.js +7 -6
- package/lib/ui/Dropdown.js +4 -5
- package/package.json +1 -1
- package/src/Markdown/Tabs/Tabs.tsx +5 -3
- package/src/Sidebar/SeparatorItem.tsx +4 -0
- package/src/Sidebar/SeparatorLine.tsx +1 -1
- package/src/config.ts +4 -0
- package/src/globalStyle.ts +7 -6
- package/src/ui/Dropdown.tsx +4 -5
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
|
+
type Child = {
|
|
3
|
+
props: {
|
|
4
|
+
label: string;
|
|
5
|
+
} & TabsProps;
|
|
6
|
+
};
|
|
2
7
|
type TabsProps = PropsWithChildren<{
|
|
3
|
-
children:
|
|
4
|
-
props: {
|
|
5
|
-
label: string;
|
|
6
|
-
} & TabsProps;
|
|
7
|
-
}[];
|
|
8
|
+
children: Child[];
|
|
8
9
|
}>;
|
|
9
|
-
export declare function Tabs(
|
|
10
|
+
export declare function Tabs(props: TabsProps): JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -30,8 +30,10 @@ exports.Tabs = void 0;
|
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const Tab_1 = require("../../Markdown/Tabs/Tab");
|
|
33
|
-
function Tabs(
|
|
34
|
-
|
|
33
|
+
function Tabs(props) {
|
|
34
|
+
var _a;
|
|
35
|
+
const children = react_1.default.Children.toArray(props.children);
|
|
36
|
+
const [activeTab, setActiveTab] = (0, react_1.useState)((_a = children[0]) === null || _a === void 0 ? void 0 : _a.props.label);
|
|
35
37
|
const onTabSelect = (label) => setActiveTab(label);
|
|
36
38
|
return (react_1.default.createElement(TabsContainer, { "data-component-name": "Markdown/Tabs/Tabs" },
|
|
37
39
|
react_1.default.createElement(TabList, null, children.map((child) => {
|
|
@@ -17,6 +17,10 @@ exports.SeparatorItem = (0, styled_components_1.default)(MenuItemLabel_1.MenuIte
|
|
|
17
17
|
text-transform: var(--sidebar-item-separator-text-transform);
|
|
18
18
|
background: var(--sidebar-item-separator-background-color);
|
|
19
19
|
|
|
20
|
+
*:not(:first-child) > & {
|
|
21
|
+
margin-top: var(--sidebar-item-separator-offset);
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
:hover {
|
|
21
25
|
color: inherit;
|
|
22
26
|
background-color: inherit;
|
|
@@ -10,6 +10,6 @@ exports.SeparatorLine = styled_components_1.default.div.attrs(() => ({
|
|
|
10
10
|
})) `
|
|
11
11
|
height: 1px;
|
|
12
12
|
background-color: var(--sidebar-item-separator-line-color);
|
|
13
|
-
margin: var(--sidebar-item-padding-vertical) 0;
|
|
13
|
+
margin: var(--sidebar-item-separator-offset) 0 var(--sidebar-item-padding-vertical) 0;
|
|
14
14
|
`;
|
|
15
15
|
//# sourceMappingURL=SeparatorLine.js.map
|
package/lib/config.d.ts
CHANGED
|
@@ -451,6 +451,10 @@ export declare const themeConfigSchema: {
|
|
|
451
451
|
readonly feedback: {
|
|
452
452
|
readonly type: "object";
|
|
453
453
|
readonly properties: {
|
|
454
|
+
readonly hide: {
|
|
455
|
+
readonly type: "boolean";
|
|
456
|
+
readonly default: false;
|
|
457
|
+
};
|
|
454
458
|
readonly type: {
|
|
455
459
|
readonly type: "string";
|
|
456
460
|
readonly enum: readonly ["rating", "sentiment", "comment", "reasons"];
|
package/lib/config.js
CHANGED
package/lib/globalStyle.js
CHANGED
|
@@ -505,6 +505,7 @@ const sidebar = (0, styled_components_1.css) `
|
|
|
505
505
|
--sidebar-item-separator-text-color: var(--sidebar-item-text-color);
|
|
506
506
|
--sidebar-item-separator-background-color: var(--sidebar-background-color);
|
|
507
507
|
--sidebar-item-separator-line-color: var(--border-color); // but has line color
|
|
508
|
+
--sidebar-item-separator-offset: calc(var(--sidebar-spacing-unit) * 2);
|
|
508
509
|
|
|
509
510
|
/**
|
|
510
511
|
* @tokens Sidebar back button
|
|
@@ -561,7 +562,7 @@ const admonition = (0, styled_components_1.css) `
|
|
|
561
562
|
* @tokens Admonition type info
|
|
562
563
|
*/
|
|
563
564
|
|
|
564
|
-
--admonition-info-background-color: var(--color-
|
|
565
|
+
--admonition-info-background-color: var(--color-secondary-200); // @presenter Color
|
|
565
566
|
--admonition-info-heading-text-color: var(--text-color); // @presenter Color
|
|
566
567
|
--admonition-info-text-color: var(--text-color); // @presenter Color
|
|
567
568
|
--admonition-info-icon-color: var(--color-accent-900); // @presenter Color
|
|
@@ -1941,7 +1942,7 @@ const pages = (0, styled_components_1.css) `
|
|
|
1941
1942
|
const userProfile = (0, styled_components_1.css) `
|
|
1942
1943
|
|
|
1943
1944
|
/**
|
|
1944
|
-
* @tokens User Profile
|
|
1945
|
+
* @tokens User Profile
|
|
1945
1946
|
*/
|
|
1946
1947
|
|
|
1947
1948
|
--profile-name-font-family: var(--navbar-item-font-family); // @presenter FontFamily
|
|
@@ -1949,12 +1950,12 @@ const userProfile = (0, styled_components_1.css) `
|
|
|
1949
1950
|
--profile-name-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
1950
1951
|
--profile-name-line-height: var(--line-height-base); // @presenter LineHeight
|
|
1951
1952
|
--profile-name-text-color: var(--navbar-text-color); // @presenter Color
|
|
1952
|
-
|
|
1953
|
+
|
|
1953
1954
|
--profile-name-padding-horizontal: 0; // @presenter Spacing
|
|
1954
1955
|
--profile-name-padding-vertical: 0; // @presenter Spacing
|
|
1955
1956
|
--profile-name-margin-horizontal: 0; // @presenter Spacing
|
|
1956
1957
|
|
|
1957
|
-
--profile-avatar-width: 40px;
|
|
1958
|
+
--profile-avatar-width: 40px;
|
|
1958
1959
|
--profile-avatar-height: 40px;
|
|
1959
1960
|
--profile-avatar-border-radius: 50%; // @presenter BorderRadius
|
|
1960
1961
|
|
|
@@ -1982,7 +1983,7 @@ const userProfile = (0, styled_components_1.css) `
|
|
|
1982
1983
|
--profile-menu-item-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
1983
1984
|
--profile-menu-item-line-height: var(--line-height-base); // @presenter LineHeight
|
|
1984
1985
|
--profile-menu-item-text-align: left;
|
|
1985
|
-
|
|
1986
|
+
|
|
1986
1987
|
--profile-menu-item-padding-horizontal: 15px; // @presenter Spacing
|
|
1987
1988
|
--profile-menu-item-padding-vertical: 20px; // @presenter Spacing
|
|
1988
1989
|
|
|
@@ -1996,7 +1997,7 @@ const userProfile = (0, styled_components_1.css) `
|
|
|
1996
1997
|
--profile-menu-item-separator-line-color: var(--border-color); // @presenter Color
|
|
1997
1998
|
|
|
1998
1999
|
// @tokens End
|
|
1999
|
-
|
|
2000
|
+
|
|
2000
2001
|
`;
|
|
2001
2002
|
const modal = (0, styled_components_1.css) `
|
|
2002
2003
|
body:has(.modal) {
|
package/lib/ui/Dropdown.js
CHANGED
|
@@ -40,10 +40,9 @@ const DropDownHeader = styled_components_1.default.div `
|
|
|
40
40
|
display: flex;
|
|
41
41
|
justify-content: space-between;
|
|
42
42
|
align-items: center;
|
|
43
|
-
background: #fff;
|
|
44
43
|
padding: 8px 10px;
|
|
45
44
|
border-radius: 4px;
|
|
46
|
-
border: 1px solid
|
|
45
|
+
border: 1px solid var(--border-color);
|
|
47
46
|
font-weight: 600;
|
|
48
47
|
color: var(--text-color);
|
|
49
48
|
background: var(--color-secondary-200);
|
|
@@ -68,16 +67,16 @@ const IconWrapper = styled_components_1.default.span `
|
|
|
68
67
|
}
|
|
69
68
|
`;
|
|
70
69
|
const ListItem = styled_components_1.default.div `
|
|
71
|
-
background-color:
|
|
70
|
+
background-color: var(--color-secondary-200);
|
|
72
71
|
padding: 0.4em 10px;
|
|
73
72
|
font-size: 1em;
|
|
74
73
|
color: var(--text-color);
|
|
75
74
|
cursor: pointer;
|
|
76
75
|
&:hover {
|
|
77
|
-
background-color:
|
|
76
|
+
background-color: var(--color-secondary-300);
|
|
78
77
|
}
|
|
79
78
|
&.active {
|
|
80
|
-
background-color:
|
|
79
|
+
background-color: var(--color-secondary-300);
|
|
81
80
|
}
|
|
82
81
|
`;
|
|
83
82
|
const DropDownLink = (0, styled_components_1.default)(Link_1.Link) `
|
package/package.json
CHANGED
|
@@ -5,10 +5,12 @@ import type { PropsWithChildren } from 'react';
|
|
|
5
5
|
|
|
6
6
|
import { Tab } from '@theme/Markdown/Tabs/Tab';
|
|
7
7
|
|
|
8
|
-
type
|
|
8
|
+
type Child = { props: { label: string } & TabsProps };
|
|
9
|
+
type TabsProps = PropsWithChildren<{ children: Child[] }>;
|
|
9
10
|
|
|
10
|
-
export function Tabs(
|
|
11
|
-
const
|
|
11
|
+
export function Tabs(props: TabsProps): JSX.Element {
|
|
12
|
+
const children = React.Children.toArray(props.children) as Child[];
|
|
13
|
+
const [activeTab, setActiveTab] = useState(children[0]?.props.label);
|
|
12
14
|
const onTabSelect = (label: string) => setActiveTab(label);
|
|
13
15
|
|
|
14
16
|
return (
|
|
@@ -13,6 +13,10 @@ export const SeparatorItem = styled(MenuItemLabel).attrs(() => ({
|
|
|
13
13
|
text-transform: var(--sidebar-item-separator-text-transform);
|
|
14
14
|
background: var(--sidebar-item-separator-background-color);
|
|
15
15
|
|
|
16
|
+
*:not(:first-child) > & {
|
|
17
|
+
margin-top: var(--sidebar-item-separator-offset);
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
:hover {
|
|
17
21
|
color: inherit;
|
|
18
22
|
background-color: inherit;
|
|
@@ -5,5 +5,5 @@ export const SeparatorLine = styled.div.attrs(() => ({
|
|
|
5
5
|
}))`
|
|
6
6
|
height: 1px;
|
|
7
7
|
background-color: var(--sidebar-item-separator-line-color);
|
|
8
|
-
margin: var(--sidebar-item-padding-vertical) 0;
|
|
8
|
+
margin: var(--sidebar-item-separator-offset) 0 var(--sidebar-item-padding-vertical) 0;
|
|
9
9
|
`;
|
package/src/config.ts
CHANGED
package/src/globalStyle.ts
CHANGED
|
@@ -510,6 +510,7 @@ const sidebar = css`
|
|
|
510
510
|
--sidebar-item-separator-text-color: var(--sidebar-item-text-color);
|
|
511
511
|
--sidebar-item-separator-background-color: var(--sidebar-background-color);
|
|
512
512
|
--sidebar-item-separator-line-color: var(--border-color); // but has line color
|
|
513
|
+
--sidebar-item-separator-offset: calc(var(--sidebar-spacing-unit) * 2);
|
|
513
514
|
|
|
514
515
|
/**
|
|
515
516
|
* @tokens Sidebar back button
|
|
@@ -567,7 +568,7 @@ const admonition = css`
|
|
|
567
568
|
* @tokens Admonition type info
|
|
568
569
|
*/
|
|
569
570
|
|
|
570
|
-
--admonition-info-background-color: var(--color-
|
|
571
|
+
--admonition-info-background-color: var(--color-secondary-200); // @presenter Color
|
|
571
572
|
--admonition-info-heading-text-color: var(--text-color); // @presenter Color
|
|
572
573
|
--admonition-info-text-color: var(--text-color); // @presenter Color
|
|
573
574
|
--admonition-info-icon-color: var(--color-accent-900); // @presenter Color
|
|
@@ -1967,7 +1968,7 @@ const pages = css`
|
|
|
1967
1968
|
const userProfile = css`
|
|
1968
1969
|
|
|
1969
1970
|
/**
|
|
1970
|
-
* @tokens User Profile
|
|
1971
|
+
* @tokens User Profile
|
|
1971
1972
|
*/
|
|
1972
1973
|
|
|
1973
1974
|
--profile-name-font-family: var(--navbar-item-font-family); // @presenter FontFamily
|
|
@@ -1975,12 +1976,12 @@ const userProfile = css`
|
|
|
1975
1976
|
--profile-name-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
1976
1977
|
--profile-name-line-height: var(--line-height-base); // @presenter LineHeight
|
|
1977
1978
|
--profile-name-text-color: var(--navbar-text-color); // @presenter Color
|
|
1978
|
-
|
|
1979
|
+
|
|
1979
1980
|
--profile-name-padding-horizontal: 0; // @presenter Spacing
|
|
1980
1981
|
--profile-name-padding-vertical: 0; // @presenter Spacing
|
|
1981
1982
|
--profile-name-margin-horizontal: 0; // @presenter Spacing
|
|
1982
1983
|
|
|
1983
|
-
--profile-avatar-width: 40px;
|
|
1984
|
+
--profile-avatar-width: 40px;
|
|
1984
1985
|
--profile-avatar-height: 40px;
|
|
1985
1986
|
--profile-avatar-border-radius: 50%; // @presenter BorderRadius
|
|
1986
1987
|
|
|
@@ -2008,7 +2009,7 @@ const userProfile = css`
|
|
|
2008
2009
|
--profile-menu-item-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
2009
2010
|
--profile-menu-item-line-height: var(--line-height-base); // @presenter LineHeight
|
|
2010
2011
|
--profile-menu-item-text-align: left;
|
|
2011
|
-
|
|
2012
|
+
|
|
2012
2013
|
--profile-menu-item-padding-horizontal: 15px; // @presenter Spacing
|
|
2013
2014
|
--profile-menu-item-padding-vertical: 20px; // @presenter Spacing
|
|
2014
2015
|
|
|
@@ -2022,7 +2023,7 @@ const userProfile = css`
|
|
|
2022
2023
|
--profile-menu-item-separator-line-color: var(--border-color); // @presenter Color
|
|
2023
2024
|
|
|
2024
2025
|
// @tokens End
|
|
2025
|
-
|
|
2026
|
+
|
|
2026
2027
|
`;
|
|
2027
2028
|
|
|
2028
2029
|
const modal = css`
|
package/src/ui/Dropdown.tsx
CHANGED
|
@@ -34,10 +34,9 @@ const DropDownHeader = styled.div`
|
|
|
34
34
|
display: flex;
|
|
35
35
|
justify-content: space-between;
|
|
36
36
|
align-items: center;
|
|
37
|
-
background: #fff;
|
|
38
37
|
padding: 8px 10px;
|
|
39
38
|
border-radius: 4px;
|
|
40
|
-
border: 1px solid
|
|
39
|
+
border: 1px solid var(--border-color);
|
|
41
40
|
font-weight: 600;
|
|
42
41
|
color: var(--text-color);
|
|
43
42
|
background: var(--color-secondary-200);
|
|
@@ -65,16 +64,16 @@ const IconWrapper = styled.span`
|
|
|
65
64
|
`;
|
|
66
65
|
|
|
67
66
|
const ListItem = styled.div`
|
|
68
|
-
background-color:
|
|
67
|
+
background-color: var(--color-secondary-200);
|
|
69
68
|
padding: 0.4em 10px;
|
|
70
69
|
font-size: 1em;
|
|
71
70
|
color: var(--text-color);
|
|
72
71
|
cursor: pointer;
|
|
73
72
|
&:hover {
|
|
74
|
-
background-color:
|
|
73
|
+
background-color: var(--color-secondary-300);
|
|
75
74
|
}
|
|
76
75
|
&.active {
|
|
77
|
-
background-color:
|
|
76
|
+
background-color: var(--color-secondary-300);
|
|
78
77
|
}
|
|
79
78
|
`;
|
|
80
79
|
|