@redocly/theme 0.18.3-patch.5 → 0.18.3-patch.7
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/I18n/LanguagePicker.js +17 -10
- package/lib/I18n/styledVariables.js +1 -0
- package/lib/components/Breadcrumbs/Breadcrumb.js +0 -4
- package/lib/components/Breadcrumbs/Breadcrumbs.js +5 -1
- package/lib/components/Breadcrumbs/styledVariables.js +2 -1
- package/lib/components/CodeBlock/styledVariables.js +1 -1
- package/lib/components/Filter/Filter.js +4 -11
- package/lib/components/LastUpdated/LastUpdated.js +1 -0
- package/lib/components/Markdown/styledVariables.js +2 -2
- package/lib/components/Product/ProductPicker.js +17 -5
- package/lib/components/Select/Select.d.ts +13 -6
- package/lib/components/Select/Select.js +22 -16
- package/lib/components/Select/styledVariables.js +2 -1
- package/lib/components/Sidebar/VersionPicker.d.ts +3 -3
- package/lib/components/Sidebar/VersionPicker.js +5 -4
- package/lib/components/Sidebar/styledVariables.js +5 -4
- package/lib/components/Tiles/TileHeader.js +1 -1
- package/lib/config.d.ts +28 -0
- package/lib/config.js +8 -0
- package/lib/globalStyle.js +12 -12
- package/package.json +1 -1
- package/src/I18n/LanguagePicker.tsx +22 -21
- package/src/I18n/styledVariables.ts +1 -0
- package/src/components/Breadcrumbs/Breadcrumb.tsx +0 -4
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +5 -1
- package/src/components/Breadcrumbs/styledVariables.ts +2 -1
- package/src/components/CodeBlock/styledVariables.ts +1 -1
- package/src/components/Filter/Filter.tsx +9 -20
- package/src/components/LastUpdated/LastUpdated.tsx +1 -2
- package/src/components/Markdown/styledVariables.ts +2 -2
- package/src/components/Product/ProductPicker.tsx +18 -12
- package/src/components/Select/Select.tsx +48 -26
- package/src/components/Select/styledVariables.ts +2 -1
- package/src/components/Sidebar/VersionPicker.tsx +5 -4
- package/src/components/Sidebar/styledVariables.ts +5 -4
- package/src/components/Tiles/TileHeader.ts +1 -1
- package/src/config.ts +8 -0
- package/src/globalStyle.ts +12 -12
|
@@ -21,14 +21,18 @@ const LanguagePicker = (props) => {
|
|
|
21
21
|
if (!locale) {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
const languageItems = locales.map((locale) => (
|
|
26
|
-
|
|
24
|
+
const value = locale.code;
|
|
25
|
+
const languageItems = locales.map((locale) => ({
|
|
26
|
+
element: react_1.default.createElement(LanguageItem, { role: "link" }, locale.name || locale.code || ''),
|
|
27
|
+
value: locale.code,
|
|
28
|
+
title: locale.name || locale.code || '',
|
|
29
|
+
}));
|
|
30
|
+
return (react_1.default.createElement(LanguageSelect, { value: value, options: languageItems, onChange: (value) => {
|
|
31
|
+
const newLangPathname = (0, utils_1.withPathPrefix)((0, utils_1.getPathnameForLocale)(location.pathname, defaultLocale, value, locales));
|
|
27
32
|
const newUrlWithLanguage = `${newLangPathname}${location.search}${location.hash}`;
|
|
28
33
|
history.push(newUrlWithLanguage);
|
|
29
|
-
props.onChangeLanguage(
|
|
30
|
-
},
|
|
31
|
-
return (react_1.default.createElement(LanguageSelect, { selected: selected, options: languageItems, triggerEvent: "hover", placement: props.placement, alignment: props.alignment, icon: react_1.default.createElement(icons_1.LanguageIcon, null), onlyIcon: props.onlyIcon, withArrow: false }));
|
|
34
|
+
props.onChangeLanguage(value);
|
|
35
|
+
}, triggerEvent: "hover", placement: props.placement, alignment: props.alignment, icon: react_1.default.createElement(icons_1.LanguageIcon, null), onlyIcon: props.onlyIcon, withArrow: false }));
|
|
32
36
|
};
|
|
33
37
|
exports.LanguagePicker = LanguagePicker;
|
|
34
38
|
const LanguageSelect = (0, styled_components_1.default)(Select_1.Select).attrs(() => ({
|
|
@@ -36,6 +40,13 @@ const LanguageSelect = (0, styled_components_1.default)(Select_1.Select).attrs((
|
|
|
36
40
|
'data-component-name': 'I18n/LanguagePicker',
|
|
37
41
|
},
|
|
38
42
|
})) `
|
|
43
|
+
--select-list-item-active-background-color: var(
|
|
44
|
+
--language-picker-list-item-active-background-color
|
|
45
|
+
);
|
|
46
|
+
--select-list-item-hover-background-color: var(
|
|
47
|
+
--language-picker-list-item-hover-background-color
|
|
48
|
+
);
|
|
49
|
+
|
|
39
50
|
display: none;
|
|
40
51
|
font-size: var(--language-picker-font-size);
|
|
41
52
|
font-weight: var(--language-picker-font-weight);
|
|
@@ -73,10 +84,6 @@ const LanguageSelect = (0, styled_components_1.default)(Select_1.Select).attrs((
|
|
|
73
84
|
padding: var(--language-picker-list-item-vertical-padding)
|
|
74
85
|
var(--language-picker-list-item-horizontal-padding);
|
|
75
86
|
}
|
|
76
|
-
|
|
77
|
-
:hover {
|
|
78
|
-
background-color: var(--language-picker-list-item-active-background-color);
|
|
79
|
-
}
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
${({ theme }) => theme.mediaQueries.medium} {
|
|
@@ -33,6 +33,7 @@ exports.languagePicker = (0, styled_components_1.css) `
|
|
|
33
33
|
--language-picker-list-item-vertical-padding: var(--select-list-item-vertical-padding); // @presenter Spacing
|
|
34
34
|
--language-picker-list-item-border-radius: var(--select-list-item-border-radius); // @presenter BorderRadius
|
|
35
35
|
--language-picker-list-item-active-background-color: var(--select-list-item-active-background-color); // @presenter Color
|
|
36
|
+
--language-picker-list-item-hover-background-color: var(--select-list-item-hover-background-color); // @presenter Color
|
|
36
37
|
|
|
37
38
|
// @tokens End
|
|
38
39
|
`;
|
|
@@ -18,10 +18,6 @@ const BreadcrumbText = styled_components_1.default.div `
|
|
|
18
18
|
const BreadcrumbWrapper = styled_components_1.default.div `
|
|
19
19
|
border-radius: var(--border-radius);
|
|
20
20
|
|
|
21
|
-
&:first-child {
|
|
22
|
-
padding-left: 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
21
|
${(props) => props.isLink &&
|
|
26
22
|
`
|
|
27
23
|
&:hover {
|
|
@@ -24,7 +24,7 @@ const Breadcrumbs = (props) => {
|
|
|
24
24
|
total_breadcrumbs: breadcrumbs.length,
|
|
25
25
|
});
|
|
26
26
|
} }),
|
|
27
|
-
isLast ? null : react_1.default.createElement("
|
|
27
|
+
isLast ? null : react_1.default.createElement("span", null, "/")));
|
|
28
28
|
})));
|
|
29
29
|
};
|
|
30
30
|
exports.Breadcrumbs = Breadcrumbs;
|
|
@@ -40,6 +40,10 @@ const Container = styled_components_1.default.div `
|
|
|
40
40
|
padding: var(--breadcrumbs-padding);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
> span {
|
|
44
|
+
padding: var(--breadcrumbs-gap);
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
@media print {
|
|
44
48
|
display: none;
|
|
45
49
|
}
|
|
@@ -11,7 +11,8 @@ exports.breadcrumbs = (0, styled_components_1.css) `
|
|
|
11
11
|
--breadcrumbs-font-size: var(--font-size-base); // @presenter FontSize
|
|
12
12
|
--breadcrumbs-active-text-color: var(--text-primary); // @presenter Color
|
|
13
13
|
--breadcrumbs-hover-text-decoration: underline; // @presenter TextDecoration
|
|
14
|
-
--breadcrumbs-padding: 0
|
|
14
|
+
--breadcrumbs-padding: 0; // @presenter Spacing
|
|
15
|
+
--breadcrumbs-gap: var(--spacing-xs);
|
|
15
16
|
--breadcrumbs-margin-bottom: var(--spacing-lg); // @presenter Spacing
|
|
16
17
|
|
|
17
18
|
// @tokens End
|
|
@@ -50,7 +50,7 @@ exports.code = (0, styled_components_1.css) `
|
|
|
50
50
|
--code-block-controls-text-color: var(--text-secondary); // @presenter Color
|
|
51
51
|
--code-block-controls-background-color: var(--bg-overlay); // @presenter Color
|
|
52
52
|
--code-block-controls-border: 1px solid var(--border-primary); // @presenter Border
|
|
53
|
-
--code-block-controls-padding: 0
|
|
53
|
+
--code-block-controls-padding: 0 var(--spacing-xs); // @presenter Spacing
|
|
54
54
|
--code-block-icon-controls-background-color: var(--code-block-controls-background-color);
|
|
55
55
|
--code-block-text-controls-background-color: var(--code-block-controls-background-color);
|
|
56
56
|
|
|
@@ -11,7 +11,7 @@ const hooks_1 = require("../../mocks/hooks");
|
|
|
11
11
|
const icons_1 = require("../../icons");
|
|
12
12
|
const Select_1 = require("../../components/Select");
|
|
13
13
|
function Filter({ filter, filterValuesCasing, }) {
|
|
14
|
-
var _a
|
|
14
|
+
var _a;
|
|
15
15
|
const { translate } = (0, hooks_1.useTranslate)();
|
|
16
16
|
const translationKeys = {
|
|
17
17
|
selectAll: 'theme.catalog.filters.select.all',
|
|
@@ -25,30 +25,23 @@ function Filter({ filter, filterValuesCasing, }) {
|
|
|
25
25
|
selectOptions = [
|
|
26
26
|
{
|
|
27
27
|
value: '',
|
|
28
|
-
|
|
28
|
+
element: (react_1.default.createElement(FilterOption, { key: "all", onClick: () => filter.selectOption('') },
|
|
29
29
|
react_1.default.createElement(FilterOptionLabel, null, translate(translationKeys.selectAll, 'All')),
|
|
30
30
|
react_1.default.createElement(FilterOptionCount, null, defaultOptionCount))),
|
|
31
31
|
},
|
|
32
32
|
];
|
|
33
33
|
selectOptions.push(...filter.filteredOptions.map((option) => ({
|
|
34
34
|
value: option.value,
|
|
35
|
-
|
|
35
|
+
element: (react_1.default.createElement(FilterOption, { key: option.value },
|
|
36
36
|
react_1.default.createElement(FilterOptionLabel, null, changeCasing(translate(option.value), filterValuesCasing)),
|
|
37
37
|
react_1.default.createElement(FilterOptionCount, null, option.count))),
|
|
38
38
|
})));
|
|
39
39
|
}
|
|
40
|
-
let selectedOptionComponent;
|
|
41
|
-
if (filter.type === 'select') {
|
|
42
|
-
const selectedOption = (_a = filter.selectedOptions.values().next()) === null || _a === void 0 ? void 0 : _a.value;
|
|
43
|
-
selectedOptionComponent =
|
|
44
|
-
((_b = selectOptions.find((option) => option.value === selectedOption)) === null || _b === void 0 ? void 0 : _b.component) ||
|
|
45
|
-
selectOptions[0].component;
|
|
46
|
-
}
|
|
47
40
|
return (react_1.default.createElement(FilterGroup, { key: filter.property + filter.title },
|
|
48
41
|
react_1.default.createElement(FilterTitle, null,
|
|
49
42
|
translate(filter.titleTranslationKey, filter.title),
|
|
50
43
|
" "),
|
|
51
|
-
filter.type === 'select' ? (react_1.default.createElement(StyledSelect, {
|
|
44
|
+
filter.type === 'select' ? (react_1.default.createElement(StyledSelect, { value: (_a = filter.selectedOptions.values().next()) === null || _a === void 0 ? void 0 : _a.value, onChange: (value) => filter.selectOption(value), options: selectOptions })) : filter.type === 'date-range' ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
52
45
|
react_1.default.createElement(DatePickerWrapper, null,
|
|
53
46
|
react_1.default.createElement("span", null, "From:"),
|
|
54
47
|
react_1.default.createElement(react_date_picker_1.DatePicker, { closeCalendar: true, format: "y-MM-dd", dayPlaceholder: "DD", monthPlaceholder: "MM", yearPlaceholder: "YYYY", value: filter.selectedOptions.from ? new Date(filter.selectedOptions.from) : null, minDetail: "decade", maxDate: new Date(), onChange: (from) => {
|
|
@@ -55,6 +55,7 @@ function LastUpdated(props) {
|
|
|
55
55
|
: translate(translationKey, 'Last updated on');
|
|
56
56
|
return (React.createElement(Wrapper, { className: props.className, "data-component-name": "LastUpdated/LastUpdated", rawOnPrint: format === 'timeago', "data-print-datetime": isoDate, "data-translation-key": translationKey },
|
|
57
57
|
text,
|
|
58
|
+
" ",
|
|
58
59
|
React.createElement("time", { dateTime: isoDate }, lastUpdatedString)));
|
|
59
60
|
}
|
|
60
61
|
exports.LastUpdated = LastUpdated;
|
|
@@ -149,7 +149,7 @@ exports.markdown = (0, styled_components_1.css) `
|
|
|
149
149
|
* @tokens Markdown Table
|
|
150
150
|
*/
|
|
151
151
|
|
|
152
|
-
--md-table-font-size: var(--font-size-
|
|
152
|
+
--md-table-font-size: var(--font-size-sm); // @presenter FontSize
|
|
153
153
|
--md-table-margin-vertical: 20px; // @presenter Spacing
|
|
154
154
|
--md-table-background-color: transparent; // @presenter Color
|
|
155
155
|
|
|
@@ -220,7 +220,7 @@ exports.markdown = (0, styled_components_1.css) `
|
|
|
220
220
|
`;
|
|
221
221
|
exports.mermaid = (0, styled_components_1.css) `
|
|
222
222
|
/**
|
|
223
|
-
* @tokens Mermaid
|
|
223
|
+
* @tokens Mermaid
|
|
224
224
|
*/
|
|
225
225
|
|
|
226
226
|
--mermaid-background-color: var(--bg-raised-light); // @presenter Color
|
|
@@ -7,7 +7,8 @@ exports.ProductPicker = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const hooks_1 = require("../../mocks/hooks");
|
|
10
|
-
const
|
|
10
|
+
const usePreloadHistory_1 = require("../../mocks/usePreloadHistory");
|
|
11
|
+
// import { Link } from '../../mocks/Link';
|
|
11
12
|
const icons_1 = require("../../icons");
|
|
12
13
|
const Select_1 = require("../Select");
|
|
13
14
|
const Product_1 = require("./Product");
|
|
@@ -15,11 +16,22 @@ const ProductPicker = () => {
|
|
|
15
16
|
var _a;
|
|
16
17
|
const globalData = (0, hooks_1.useGlobalData)();
|
|
17
18
|
const currentProduct = (0, hooks_1.useCurrentProduct)();
|
|
18
|
-
const currentProductComponent = currentProduct ? (
|
|
19
|
+
// const currentProductComponent = currentProduct ? (
|
|
20
|
+
// <Product product={currentProduct} />
|
|
21
|
+
// ) : (
|
|
22
|
+
// 'Products'
|
|
23
|
+
// );
|
|
24
|
+
const { push } = (0, usePreloadHistory_1.usePreloadHistory)();
|
|
19
25
|
const products = Object.values(((_a = globalData === null || globalData === void 0 ? void 0 : globalData.theme) === null || _a === void 0 ? void 0 : _a.products) || {});
|
|
20
|
-
const productComponents = products.map((product) => (
|
|
21
|
-
react_1.default.createElement(Product_1.Product, { product: product })
|
|
22
|
-
|
|
26
|
+
const productComponents = products.map((product) => ({
|
|
27
|
+
element: react_1.default.createElement(Product_1.Product, { product: product }),
|
|
28
|
+
value: product,
|
|
29
|
+
}));
|
|
30
|
+
return products.length ? (react_1.default.createElement(ProductSelect, { value: currentProduct, placeholder: "Products", options: productComponents, triggerEvent: "hover", onChange: (product) => {
|
|
31
|
+
if (!product)
|
|
32
|
+
return;
|
|
33
|
+
push(product.link);
|
|
34
|
+
} })) : null;
|
|
23
35
|
};
|
|
24
36
|
exports.ProductPicker = ProductPicker;
|
|
25
37
|
const ProductSelect = (0, styled_components_1.default)(Select_1.Select).attrs(() => ({
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export interface SelectProps {
|
|
3
|
-
|
|
4
|
-
options:
|
|
2
|
+
export interface SelectProps<T = any> {
|
|
3
|
+
value: T;
|
|
4
|
+
options: {
|
|
5
|
+
element: React.ReactNode | string;
|
|
6
|
+
value: T;
|
|
7
|
+
label?: string;
|
|
8
|
+
}[];
|
|
5
9
|
dataAttributes?: Record<string, string>;
|
|
6
10
|
className?: string;
|
|
7
11
|
withArrow?: boolean;
|
|
8
12
|
triggerEvent?: 'click' | 'hover';
|
|
9
|
-
onChange?: (value:
|
|
13
|
+
onChange?: (value: any) => void;
|
|
10
14
|
placement?: 'top' | 'bottom';
|
|
11
15
|
alignment?: 'start' | 'end';
|
|
12
16
|
icon?: React.ReactNode;
|
|
13
17
|
onlyIcon?: boolean;
|
|
18
|
+
placeholder?: string;
|
|
14
19
|
}
|
|
15
|
-
export declare
|
|
20
|
+
export declare function Select<T>({ className, value, options, dataAttributes, withArrow, triggerEvent, onChange, placement, alignment, icon, onlyIcon, placeholder, }: SelectProps<T>): JSX.Element;
|
|
16
21
|
export declare const SelectContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
22
|
export declare const SelectInput: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
23
|
export declare const SelectInputValue: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -20,4 +25,6 @@ export declare const SelectList: import("styled-components").StyledComponent<"ul
|
|
|
20
25
|
placement?: string | undefined;
|
|
21
26
|
alignment?: string | undefined;
|
|
22
27
|
}, never>;
|
|
23
|
-
export declare const SelectListItem: import("styled-components").StyledComponent<"li", any, {
|
|
28
|
+
export declare const SelectListItem: import("styled-components").StyledComponent<"li", any, {
|
|
29
|
+
selected: boolean;
|
|
30
|
+
}, never>;
|
|
@@ -31,10 +31,10 @@ const react_1 = __importStar(require("react"));
|
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const icons_1 = require("../../icons");
|
|
33
33
|
const hooks_1 = require("../../hooks");
|
|
34
|
-
|
|
35
|
-
const
|
|
34
|
+
function Select({ className, value, options, dataAttributes, withArrow = true, triggerEvent = 'click', onChange, placement, alignment, icon, onlyIcon, placeholder, }) {
|
|
35
|
+
const containerRef = (0, react_1.useRef)(null);
|
|
36
36
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
37
|
-
const [
|
|
37
|
+
// const [selectedIdx, setSelectedIdx] = useState<React.ReactNode | string>(selected);
|
|
38
38
|
const handleOpen = () => {
|
|
39
39
|
setIsOpen(true);
|
|
40
40
|
};
|
|
@@ -45,22 +45,23 @@ const Select = ({ className, selected, options, dataAttributes, withArrow = true
|
|
|
45
45
|
setIsOpen(!isOpen);
|
|
46
46
|
};
|
|
47
47
|
const handleSelect = (value) => {
|
|
48
|
-
|
|
48
|
+
// setSelectedIdx(options.findIndex(o => o.value === value));
|
|
49
49
|
setIsOpen(false);
|
|
50
50
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
51
51
|
};
|
|
52
|
-
(0, hooks_1.useOutsideClick)(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, [selected]);
|
|
57
|
-
|
|
52
|
+
(0, hooks_1.useOutsideClick)(containerRef, handleClose);
|
|
53
|
+
// useEffect(() => {
|
|
54
|
+
// handleSelect(selected);
|
|
55
|
+
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
|
+
// }, [selected]);
|
|
57
|
+
const selectedOption = options.find((option) => option.value === value);
|
|
58
|
+
return (react_1.default.createElement(exports.SelectContainer, Object.assign({}, dataAttributes, { "data-testid": "select", className: className, ref: containerRef, onPointerEnter: triggerEvent === 'hover' ? handleOpen : undefined, onPointerLeave: triggerEvent === 'hover' ? handleClose : undefined, onClick: triggerEvent === 'click' ? handleToggle : undefined }),
|
|
58
59
|
react_1.default.createElement(exports.SelectInput, null,
|
|
59
|
-
!onlyIcon && react_1.default.createElement(exports.SelectInputValue, null,
|
|
60
|
+
!onlyIcon && (react_1.default.createElement(exports.SelectInputValue, null, (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) || (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.element) || placeholder)),
|
|
60
61
|
icon,
|
|
61
62
|
withArrow ? isOpen ? react_1.default.createElement(icons_1.ArrowIcon, { direction: "up" }) : react_1.default.createElement(icons_1.ArrowIcon, { direction: "down" }) : null),
|
|
62
|
-
isOpen && (react_1.default.createElement(exports.SelectList, { placement: placement, alignment: alignment }, options.map((option, index) => (react_1.default.createElement(exports.SelectListItem, { key: index, onClick: () => handleSelect(option) }, option)))))));
|
|
63
|
-
}
|
|
63
|
+
isOpen && (react_1.default.createElement(exports.SelectList, { placement: placement, alignment: alignment }, options.map((option, index) => (react_1.default.createElement(exports.SelectListItem, { key: index, onClick: () => handleSelect(option.value), selected: option.value === value }, typeof option.element === 'string' ? react_1.default.createElement("div", null, option.element) : option.element)))))));
|
|
64
|
+
}
|
|
64
65
|
exports.Select = Select;
|
|
65
66
|
exports.SelectContainer = styled_components_1.default.div `
|
|
66
67
|
position: relative;
|
|
@@ -91,8 +92,8 @@ exports.SelectInputValue = styled_components_1.default.div `
|
|
|
91
92
|
`;
|
|
92
93
|
exports.SelectList = styled_components_1.default.ul `
|
|
93
94
|
position: absolute;
|
|
94
|
-
top: ${({ placement }) => (placement === 'top' ? 'auto' : '
|
|
95
|
-
bottom: ${({ placement }) => (placement === 'top' ? '
|
|
95
|
+
top: ${({ placement }) => (placement === 'top' ? 'auto' : '100%')};
|
|
96
|
+
bottom: ${({ placement }) => (placement === 'top' ? '100%' : 'auto')};
|
|
96
97
|
left: ${({ alignment }) => (alignment === 'start' ? '0' : 'auto')};
|
|
97
98
|
right: ${({ alignment }) => (alignment === 'end' ? '0' : 'auto')};
|
|
98
99
|
margin: 0;
|
|
@@ -117,7 +118,12 @@ exports.SelectListItem = styled_components_1.default.li `
|
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
:hover {
|
|
120
|
-
background-color: var(--select-list-item-
|
|
121
|
+
background-color: var(--select-list-item-hover-background-color);
|
|
121
122
|
}
|
|
123
|
+
|
|
124
|
+
${({ selected }) => selected &&
|
|
125
|
+
`
|
|
126
|
+
&, &:hover { background-color: var(--select-list-item-active-background-color); }
|
|
127
|
+
`}
|
|
122
128
|
`;
|
|
123
129
|
//# sourceMappingURL=Select.js.map
|
|
@@ -26,7 +26,8 @@ exports.select = (0, styled_components_1.css) `
|
|
|
26
26
|
--select-list-item-horizontal-padding: var(--spacing-base); // @presenter Spacing
|
|
27
27
|
--select-list-item-vertical-padding: var(--spacing-xs); // @presenter Spacing
|
|
28
28
|
--select-list-item-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
29
|
-
--select-list-item-active-background-color: var(--bg
|
|
29
|
+
--select-list-item-active-background-color: var(--color-primary-bg); // @presenter Color
|
|
30
|
+
--select-list-item-hover-background-color: var(--bg-raised); // @presenter Color
|
|
30
31
|
|
|
31
32
|
// @tokens End
|
|
32
33
|
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { SelectProps } from '../Select';
|
|
3
|
-
|
|
2
|
+
import { Select } from '../Select';
|
|
3
|
+
export declare const VersionPicker: import("styled-components").StyledComponent<typeof Select, any, {
|
|
4
4
|
dataAttributes: {
|
|
5
5
|
'data-component-name': string;
|
|
6
6
|
};
|
|
7
|
-
} & SelectProps
|
|
7
|
+
} & SelectProps<any>, "dataAttributes">;
|
|
@@ -11,6 +11,11 @@ exports.VersionPicker = (0, styled_components_1.default)(Select_1.Select).attrs(
|
|
|
11
11
|
'data-component-name': 'Sidebar/VersionPicker',
|
|
12
12
|
},
|
|
13
13
|
})) `
|
|
14
|
+
--select-list-item-active-background-color: var(
|
|
15
|
+
--version-picker-list-item-active-background-color
|
|
16
|
+
);
|
|
17
|
+
--select-list-item-hover-background-color: var(--version-picker-list-item-hover-background-color);
|
|
18
|
+
|
|
14
19
|
font-size: var(--version-picker-font-size);
|
|
15
20
|
font-weight: var(--version-picker-font-weight);
|
|
16
21
|
border-radius: var(--version-picker-border-radius);
|
|
@@ -42,10 +47,6 @@ exports.VersionPicker = (0, styled_components_1.default)(Select_1.Select).attrs(
|
|
|
42
47
|
padding: var(--version-picker-list-item-vertical-padding)
|
|
43
48
|
var(--version-picker-list-item-horizontal-padding);
|
|
44
49
|
}
|
|
45
|
-
|
|
46
|
-
:hover {
|
|
47
|
-
background-color: var(--version-picker-list-item-active-background-color);
|
|
48
|
-
}
|
|
49
50
|
}
|
|
50
51
|
`;
|
|
51
52
|
//# sourceMappingURL=VersionPicker.js.map
|
|
@@ -77,7 +77,7 @@ exports.sidebar = (0, styled_components_1.css) `
|
|
|
77
77
|
*/
|
|
78
78
|
--sidebar-item-border-radius: 6px; // @presenter BorderRadius
|
|
79
79
|
|
|
80
|
-
/**
|
|
80
|
+
/**
|
|
81
81
|
* @tokens Sidebar item icon
|
|
82
82
|
*/
|
|
83
83
|
--sidebar-item-icon-size: var(--spacing-xl);
|
|
@@ -163,7 +163,7 @@ exports.sidebar = (0, styled_components_1.css) `
|
|
|
163
163
|
--sidebar-back-padding-left: var(--spacing-xs); // @presenter Spacing
|
|
164
164
|
--sidebar-back-button-icon: none;
|
|
165
165
|
|
|
166
|
-
/**
|
|
166
|
+
/**
|
|
167
167
|
* @tokens Sidebar footer
|
|
168
168
|
*/
|
|
169
169
|
--sidebar-footer-padding-vertical: var(--spacing-sm); // @presenter Spacing
|
|
@@ -177,7 +177,7 @@ exports.sidebar = (0, styled_components_1.css) `
|
|
|
177
177
|
--sidebar-controls-collapsed-gap: var(--spacing-xs); // @presenter Spacing
|
|
178
178
|
--sidebar-controls-collapsed-padding-vertical: var(--spacing-xs); // @presenter Spacing
|
|
179
179
|
--sidebar-controls-collapsed-padding-horizontal: var(--spacing-xxs); // @presenter Spacing
|
|
180
|
-
|
|
180
|
+
|
|
181
181
|
// @tokens End
|
|
182
182
|
`;
|
|
183
183
|
exports.versionPicker = (0, styled_components_1.css) `
|
|
@@ -209,7 +209,8 @@ exports.versionPicker = (0, styled_components_1.css) `
|
|
|
209
209
|
--version-picker-list-item-vertical-padding: var(--select-list-item-vertical-padding); // @presenter Spacing
|
|
210
210
|
--version-picker-list-item-border-radius: var(--select-list-item-border-radius); // @presenter BorderRadius
|
|
211
211
|
--version-picker-list-item-active-background-color: var(--select-list-item-active-background-color); // @presenter Color
|
|
212
|
-
|
|
212
|
+
--version-picker-list-item-hover-background-color: var(--select-list-item-hover-background-color); // @presenter Color
|
|
213
|
+
|
|
213
214
|
// @tokens End
|
|
214
215
|
`;
|
|
215
216
|
//# sourceMappingURL=styledVariables.js.map
|
|
@@ -14,7 +14,7 @@ exports.TileHeader = styled_components_1.default.h3.attrs(({ className }) => ({
|
|
|
14
14
|
color: ${(props) => props.color || 'var(--h3-color)'};
|
|
15
15
|
font-family: var(--h3-font-family);
|
|
16
16
|
&& {
|
|
17
|
-
margin:
|
|
17
|
+
margin: 0 0 var(--h3-margin-bottom);
|
|
18
18
|
}
|
|
19
19
|
`;
|
|
20
20
|
//# sourceMappingURL=TileHeader.js.map
|
package/lib/config.d.ts
CHANGED
|
@@ -356,6 +356,20 @@ declare const scorecardConfigSchema: {
|
|
|
356
356
|
readonly type: "boolean";
|
|
357
357
|
readonly default: false;
|
|
358
358
|
};
|
|
359
|
+
readonly teamMetadataProperty: {
|
|
360
|
+
readonly type: "object";
|
|
361
|
+
readonly properties: {
|
|
362
|
+
readonly property: {
|
|
363
|
+
readonly type: "string";
|
|
364
|
+
};
|
|
365
|
+
readonly label: {
|
|
366
|
+
readonly type: "string";
|
|
367
|
+
};
|
|
368
|
+
readonly default: {
|
|
369
|
+
readonly type: "string";
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
};
|
|
359
373
|
readonly levels: {
|
|
360
374
|
readonly type: "array";
|
|
361
375
|
readonly items: {
|
|
@@ -1905,6 +1919,20 @@ export declare const themeConfigSchema: {
|
|
|
1905
1919
|
readonly type: "boolean";
|
|
1906
1920
|
readonly default: false;
|
|
1907
1921
|
};
|
|
1922
|
+
readonly teamMetadataProperty: {
|
|
1923
|
+
readonly type: "object";
|
|
1924
|
+
readonly properties: {
|
|
1925
|
+
readonly property: {
|
|
1926
|
+
readonly type: "string";
|
|
1927
|
+
};
|
|
1928
|
+
readonly label: {
|
|
1929
|
+
readonly type: "string";
|
|
1930
|
+
};
|
|
1931
|
+
readonly default: {
|
|
1932
|
+
readonly type: "string";
|
|
1933
|
+
};
|
|
1934
|
+
};
|
|
1935
|
+
};
|
|
1908
1936
|
readonly levels: {
|
|
1909
1937
|
readonly type: "array";
|
|
1910
1938
|
readonly items: {
|
package/lib/config.js
CHANGED
|
@@ -285,6 +285,14 @@ const scorecardConfigSchema = {
|
|
|
285
285
|
required: ['levels'],
|
|
286
286
|
properties: {
|
|
287
287
|
failBuildIfBelowMinimum: { type: 'boolean', default: false },
|
|
288
|
+
teamMetadataProperty: {
|
|
289
|
+
type: 'object',
|
|
290
|
+
properties: {
|
|
291
|
+
property: { type: 'string' },
|
|
292
|
+
label: { type: 'string' },
|
|
293
|
+
default: { type: 'string' },
|
|
294
|
+
},
|
|
295
|
+
},
|
|
288
296
|
levels: {
|
|
289
297
|
type: 'array',
|
|
290
298
|
items: {
|
package/lib/globalStyle.js
CHANGED
|
@@ -268,13 +268,13 @@ const typography = (0, styled_components_1.css) `
|
|
|
268
268
|
* @presenter LineHeight
|
|
269
269
|
*/
|
|
270
270
|
|
|
271
|
-
--line-height-base:
|
|
272
|
-
--line-height-xsm:
|
|
273
|
-
--line-height-sm:
|
|
274
|
-
--line-height-md:
|
|
275
|
-
--line-height-lg:
|
|
276
|
-
--line-height-xlg:
|
|
277
|
-
--line-height-xxlg:
|
|
271
|
+
--line-height-base: 24px;
|
|
272
|
+
--line-height-xsm: 20px;
|
|
273
|
+
--line-height-sm: 22px;
|
|
274
|
+
--line-height-md: 26px;
|
|
275
|
+
--line-height-lg: 28px;
|
|
276
|
+
--line-height-xlg: 30px;
|
|
277
|
+
--line-height-xxlg: 32px;
|
|
278
278
|
|
|
279
279
|
/**
|
|
280
280
|
* @tokens Font Sizes
|
|
@@ -417,7 +417,7 @@ const headingsTypography = (0, styled_components_1.css) `
|
|
|
417
417
|
--h3-font-family: var(--heading-font-family); // @presenter FontFamily
|
|
418
418
|
--h3-font-weight: var(--heading-font-weight); // @presenter FontWeight
|
|
419
419
|
--h3-font-size: 18px; // @presenter FontSize
|
|
420
|
-
--h3-line-height:
|
|
420
|
+
--h3-line-height: 22px; // @presenter LineHeight
|
|
421
421
|
--h3-margin-top: var(--heading-margin-top); // @presenter Spacing
|
|
422
422
|
--h3-margin-bottom: var(--heading-margin-bottom); // @presenter Spacing
|
|
423
423
|
--h3-text-color: var(--heading-text-color); // @presenter Color
|
|
@@ -589,9 +589,9 @@ const apiReferenceDocs = (0, styled_components_1.css) `
|
|
|
589
589
|
* @presenter Color
|
|
590
590
|
*/
|
|
591
591
|
|
|
592
|
-
--schema-recursive-text-color: var(--color-warning); // @presenter Color
|
|
592
|
+
--schema-recursive-text-color: var(--color-warning-active); // @presenter Color
|
|
593
593
|
--schema-recursive-background-color: var(--color-warning-bg); // @presenter Color
|
|
594
|
-
--schema-recursive-border-color: var(--color-warning-
|
|
594
|
+
--schema-recursive-border-color: var(--color-warning-active); // @presenter Color
|
|
595
595
|
|
|
596
596
|
/**
|
|
597
597
|
* @tokens GraphQL Docs Reference Schema Non null label
|
|
@@ -696,9 +696,9 @@ const badges = (0, styled_components_1.css) `
|
|
|
696
696
|
* @tokens Deprecated Badge
|
|
697
697
|
*/
|
|
698
698
|
|
|
699
|
-
--badge-deprecated-text-color: var(--color-warning); // @presenter Color
|
|
699
|
+
--badge-deprecated-text-color: var(--color-warning-active); // @presenter Color
|
|
700
700
|
--badge-deprecated-background-color: var(--color-warning-bg); // @presenter Color
|
|
701
|
-
--badge-deprecated-border-color: var(--color-warning-
|
|
701
|
+
--badge-deprecated-border-color: var(--color-warning-active); // @presenter Color
|
|
702
702
|
--badge-deprecated-border: 1px solid var(--badge-deprecated-border-color); // @presenter Border
|
|
703
703
|
--badge-deprecated-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
704
704
|
|
package/package.json
CHANGED
|
@@ -27,28 +27,25 @@ export const LanguagePicker = (props: LanguagePickerProps) => {
|
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const
|
|
31
|
-
const languageItems = locales.map((locale) => (
|
|
32
|
-
<LanguageItem
|
|
33
|
-
|
|
30
|
+
const value = locale.code;
|
|
31
|
+
const languageItems = locales.map((locale) => ({
|
|
32
|
+
element: <LanguageItem role="link">{locale.name || locale.code || ''}</LanguageItem>,
|
|
33
|
+
value: locale.code,
|
|
34
|
+
title: locale.name || locale.code || '',
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<LanguageSelect
|
|
39
|
+
value={value}
|
|
40
|
+
options={languageItems}
|
|
41
|
+
onChange={(value: string) => {
|
|
34
42
|
const newLangPathname = withPathPrefix(
|
|
35
|
-
getPathnameForLocale(location.pathname, defaultLocale,
|
|
43
|
+
getPathnameForLocale(location.pathname, defaultLocale, value, locales),
|
|
36
44
|
);
|
|
37
45
|
const newUrlWithLanguage = `${newLangPathname}${location.search}${location.hash}`;
|
|
38
46
|
history.push(newUrlWithLanguage);
|
|
39
|
-
props.onChangeLanguage(
|
|
47
|
+
props.onChangeLanguage(value);
|
|
40
48
|
}}
|
|
41
|
-
key={locale.code}
|
|
42
|
-
role="link"
|
|
43
|
-
>
|
|
44
|
-
{locale.name || locale.code || ''}
|
|
45
|
-
</LanguageItem>
|
|
46
|
-
));
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<LanguageSelect
|
|
50
|
-
selected={selected}
|
|
51
|
-
options={languageItems}
|
|
52
49
|
triggerEvent="hover"
|
|
53
50
|
placement={props.placement}
|
|
54
51
|
alignment={props.alignment}
|
|
@@ -64,6 +61,13 @@ const LanguageSelect = styled(Select).attrs(() => ({
|
|
|
64
61
|
'data-component-name': 'I18n/LanguagePicker',
|
|
65
62
|
},
|
|
66
63
|
}))`
|
|
64
|
+
--select-list-item-active-background-color: var(
|
|
65
|
+
--language-picker-list-item-active-background-color
|
|
66
|
+
);
|
|
67
|
+
--select-list-item-hover-background-color: var(
|
|
68
|
+
--language-picker-list-item-hover-background-color
|
|
69
|
+
);
|
|
70
|
+
|
|
67
71
|
display: none;
|
|
68
72
|
font-size: var(--language-picker-font-size);
|
|
69
73
|
font-weight: var(--language-picker-font-weight);
|
|
@@ -101,10 +105,6 @@ const LanguageSelect = styled(Select).attrs(() => ({
|
|
|
101
105
|
padding: var(--language-picker-list-item-vertical-padding)
|
|
102
106
|
var(--language-picker-list-item-horizontal-padding);
|
|
103
107
|
}
|
|
104
|
-
|
|
105
|
-
:hover {
|
|
106
|
-
background-color: var(--language-picker-list-item-active-background-color);
|
|
107
|
-
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
${({ theme }) => theme.mediaQueries.medium} {
|
|
@@ -116,4 +116,5 @@ const LanguageSelect = styled(Select).attrs(() => ({
|
|
|
116
116
|
background: var(--language-picker-hover-background-color);
|
|
117
117
|
}
|
|
118
118
|
`;
|
|
119
|
+
|
|
119
120
|
const LanguageItem = styled.div``;
|
|
@@ -31,6 +31,7 @@ export const languagePicker = css`
|
|
|
31
31
|
--language-picker-list-item-vertical-padding: var(--select-list-item-vertical-padding); // @presenter Spacing
|
|
32
32
|
--language-picker-list-item-border-radius: var(--select-list-item-border-radius); // @presenter BorderRadius
|
|
33
33
|
--language-picker-list-item-active-background-color: var(--select-list-item-active-background-color); // @presenter Color
|
|
34
|
+
--language-picker-list-item-hover-background-color: var(--select-list-item-hover-background-color); // @presenter Color
|
|
34
35
|
|
|
35
36
|
// @tokens End
|
|
36
37
|
`
|
|
@@ -31,7 +31,7 @@ export const Breadcrumbs = (props: { className?: string }) => {
|
|
|
31
31
|
});
|
|
32
32
|
}}
|
|
33
33
|
/>
|
|
34
|
-
{isLast ? null : <
|
|
34
|
+
{isLast ? null : <span>/</span>}
|
|
35
35
|
</React.Fragment>
|
|
36
36
|
);
|
|
37
37
|
})}
|
|
@@ -51,6 +51,10 @@ const Container = styled.div`
|
|
|
51
51
|
padding: var(--breadcrumbs-padding);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
> span {
|
|
55
|
+
padding: var(--breadcrumbs-gap);
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
@media print {
|
|
55
59
|
display: none;
|
|
56
60
|
}
|
|
@@ -9,7 +9,8 @@ export const breadcrumbs = css`
|
|
|
9
9
|
--breadcrumbs-font-size: var(--font-size-base); // @presenter FontSize
|
|
10
10
|
--breadcrumbs-active-text-color: var(--text-primary); // @presenter Color
|
|
11
11
|
--breadcrumbs-hover-text-decoration: underline; // @presenter TextDecoration
|
|
12
|
-
--breadcrumbs-padding: 0
|
|
12
|
+
--breadcrumbs-padding: 0; // @presenter Spacing
|
|
13
|
+
--breadcrumbs-gap: var(--spacing-xs);
|
|
13
14
|
--breadcrumbs-margin-bottom: var(--spacing-lg); // @presenter Spacing
|
|
14
15
|
|
|
15
16
|
// @tokens End
|
|
@@ -48,7 +48,7 @@ export const code = css`
|
|
|
48
48
|
--code-block-controls-text-color: var(--text-secondary); // @presenter Color
|
|
49
49
|
--code-block-controls-background-color: var(--bg-overlay); // @presenter Color
|
|
50
50
|
--code-block-controls-border: 1px solid var(--border-primary); // @presenter Border
|
|
51
|
-
--code-block-controls-padding: 0
|
|
51
|
+
--code-block-controls-padding: 0 var(--spacing-xs); // @presenter Spacing
|
|
52
52
|
--code-block-icon-controls-background-color: var(--code-block-controls-background-color);
|
|
53
53
|
--code-block-text-controls-background-color: var(--code-block-controls-background-color);
|
|
54
54
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { DatePicker } from 'react-date-picker';
|
|
4
4
|
|
|
5
|
-
import type { ReactNode } from 'react';
|
|
5
|
+
// import type { ReactNode } from 'react';
|
|
6
6
|
|
|
7
7
|
import type { ResolvedFilter } from '@theme/types/portal/src/shared/types/catalog';
|
|
8
8
|
import { useTranslate } from '@portal/hooks';
|
|
@@ -25,7 +25,7 @@ export function Filter({
|
|
|
25
25
|
|
|
26
26
|
if (!filter.parentUsed) return null;
|
|
27
27
|
|
|
28
|
-
let selectOptions: { value: string;
|
|
28
|
+
let selectOptions: { value: string; element: React.ReactNode }[] = [];
|
|
29
29
|
if (filter.type === 'select') {
|
|
30
30
|
const defaultOptionCount = filter.filteredOptions.reduce(
|
|
31
31
|
(acc, option) => acc + option.count,
|
|
@@ -34,8 +34,8 @@ export function Filter({
|
|
|
34
34
|
selectOptions = [
|
|
35
35
|
{
|
|
36
36
|
value: '',
|
|
37
|
-
|
|
38
|
-
<FilterOption key="all"
|
|
37
|
+
element: (
|
|
38
|
+
<FilterOption key="all" onClick={() => filter.selectOption('')}>
|
|
39
39
|
<FilterOptionLabel>{translate(translationKeys.selectAll, 'All')}</FilterOptionLabel>
|
|
40
40
|
<FilterOptionCount>{defaultOptionCount}</FilterOptionCount>
|
|
41
41
|
</FilterOption>
|
|
@@ -45,12 +45,8 @@ export function Filter({
|
|
|
45
45
|
selectOptions.push(
|
|
46
46
|
...filter.filteredOptions.map((option) => ({
|
|
47
47
|
value: option.value,
|
|
48
|
-
|
|
49
|
-
<FilterOption
|
|
50
|
-
key={option.value}
|
|
51
|
-
role="link"
|
|
52
|
-
onClick={() => filter.selectOption(option.value)}
|
|
53
|
-
>
|
|
48
|
+
element: (
|
|
49
|
+
<FilterOption key={option.value}>
|
|
54
50
|
<FilterOptionLabel>
|
|
55
51
|
{changeCasing(translate(option.value), filterValuesCasing)}
|
|
56
52
|
</FilterOptionLabel>
|
|
@@ -61,21 +57,14 @@ export function Filter({
|
|
|
61
57
|
);
|
|
62
58
|
}
|
|
63
59
|
|
|
64
|
-
let selectedOptionComponent: ReactNode;
|
|
65
|
-
if (filter.type === 'select') {
|
|
66
|
-
const selectedOption = (filter.selectedOptions as Set<any>).values().next()?.value;
|
|
67
|
-
selectedOptionComponent =
|
|
68
|
-
selectOptions.find((option) => option.value === selectedOption)?.component ||
|
|
69
|
-
selectOptions[0].component;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
60
|
return (
|
|
73
61
|
<FilterGroup key={filter.property + filter.title}>
|
|
74
62
|
<FilterTitle>{translate(filter.titleTranslationKey, filter.title)} </FilterTitle>
|
|
75
63
|
{filter.type === 'select' ? (
|
|
76
64
|
<StyledSelect
|
|
77
|
-
|
|
78
|
-
|
|
65
|
+
value={(filter.selectedOptions as Set<any>).values().next()?.value}
|
|
66
|
+
onChange={(value) => filter.selectOption(value)}
|
|
67
|
+
options={selectOptions}
|
|
79
68
|
/>
|
|
80
69
|
) : filter.type === 'date-range' ? (
|
|
81
70
|
<>
|
|
@@ -51,8 +51,7 @@ export function LastUpdated(props: LastUpdatedProps): JSX.Element | null {
|
|
|
51
51
|
data-print-datetime={isoDate}
|
|
52
52
|
data-translation-key={translationKey}
|
|
53
53
|
>
|
|
54
|
-
{text}
|
|
55
|
-
{/* TODO: fix issue with snapshot tests - they should not depend on current date */}
|
|
54
|
+
{text} {/* TODO: fix issue with snapshot tests - they should not depend on current date */}
|
|
56
55
|
<time dateTime={isoDate}>{lastUpdatedString}</time>
|
|
57
56
|
</Wrapper>
|
|
58
57
|
);
|
|
@@ -148,7 +148,7 @@ export const markdown = css`
|
|
|
148
148
|
* @tokens Markdown Table
|
|
149
149
|
*/
|
|
150
150
|
|
|
151
|
-
--md-table-font-size: var(--font-size-
|
|
151
|
+
--md-table-font-size: var(--font-size-sm); // @presenter FontSize
|
|
152
152
|
--md-table-margin-vertical: 20px; // @presenter Spacing
|
|
153
153
|
--md-table-background-color: transparent; // @presenter Color
|
|
154
154
|
|
|
@@ -220,7 +220,7 @@ export const markdown = css`
|
|
|
220
220
|
|
|
221
221
|
export const mermaid = css`
|
|
222
222
|
/**
|
|
223
|
-
* @tokens Mermaid
|
|
223
|
+
* @tokens Mermaid
|
|
224
224
|
*/
|
|
225
225
|
|
|
226
226
|
--mermaid-background-color: var(--bg-raised-light); // @presenter Color
|
|
@@ -4,7 +4,8 @@ import styled from 'styled-components';
|
|
|
4
4
|
import type { ThemeUIConfig } from '../../config';
|
|
5
5
|
|
|
6
6
|
import { useCurrentProduct, useGlobalData } from '@portal/hooks';
|
|
7
|
-
import {
|
|
7
|
+
import { usePreloadHistory } from '@portal/usePreloadHistory';
|
|
8
|
+
// import { Link } from '@portal/Link';
|
|
8
9
|
import { ArrowIcon } from '@theme/icons';
|
|
9
10
|
|
|
10
11
|
import { Select, SelectInput, SelectList, SelectListItem } from '../Select';
|
|
@@ -13,25 +14,30 @@ import { Product } from './Product';
|
|
|
13
14
|
export const ProductPicker = () => {
|
|
14
15
|
const globalData = useGlobalData() as { theme?: ThemeUIConfig };
|
|
15
16
|
const currentProduct = useCurrentProduct();
|
|
16
|
-
const currentProductComponent = currentProduct ? (
|
|
17
|
-
|
|
18
|
-
) : (
|
|
19
|
-
|
|
20
|
-
);
|
|
17
|
+
// const currentProductComponent = currentProduct ? (
|
|
18
|
+
// <Product product={currentProduct} />
|
|
19
|
+
// ) : (
|
|
20
|
+
// 'Products'
|
|
21
|
+
// );
|
|
22
|
+
const { push } = usePreloadHistory();
|
|
21
23
|
|
|
22
24
|
const products = Object.values(globalData?.theme?.products || {});
|
|
23
25
|
|
|
24
|
-
const productComponents = products.map((product) => (
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
));
|
|
26
|
+
const productComponents = products.map((product) => ({
|
|
27
|
+
element: <Product product={product} />,
|
|
28
|
+
value: product,
|
|
29
|
+
}));
|
|
29
30
|
|
|
30
31
|
return products.length ? (
|
|
31
32
|
<ProductSelect
|
|
32
|
-
|
|
33
|
+
value={currentProduct}
|
|
34
|
+
placeholder="Products"
|
|
33
35
|
options={productComponents}
|
|
34
36
|
triggerEvent="hover"
|
|
37
|
+
onChange={(product: typeof currentProduct) => {
|
|
38
|
+
if (!product) return;
|
|
39
|
+
push(product.link);
|
|
40
|
+
}}
|
|
35
41
|
/>
|
|
36
42
|
) : null;
|
|
37
43
|
};
|
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { ArrowIcon } from '@theme/icons';
|
|
5
5
|
import { useOutsideClick } from '@theme/hooks';
|
|
6
6
|
|
|
7
|
-
export interface SelectProps {
|
|
8
|
-
|
|
9
|
-
options:
|
|
7
|
+
export interface SelectProps<T = any> {
|
|
8
|
+
value: T;
|
|
9
|
+
options: {
|
|
10
|
+
element: React.ReactNode | string;
|
|
11
|
+
value: T;
|
|
12
|
+
label?: string;
|
|
13
|
+
}[];
|
|
10
14
|
dataAttributes?: Record<string, string>;
|
|
11
15
|
className?: string;
|
|
12
16
|
withArrow?: boolean;
|
|
13
17
|
triggerEvent?: 'click' | 'hover';
|
|
14
|
-
onChange?: (value:
|
|
18
|
+
onChange?: (value: any) => void;
|
|
15
19
|
placement?: 'top' | 'bottom';
|
|
16
20
|
alignment?: 'start' | 'end';
|
|
17
21
|
icon?: React.ReactNode;
|
|
18
22
|
onlyIcon?: boolean;
|
|
23
|
+
placeholder?: string;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
export
|
|
26
|
+
export function Select<T>({
|
|
22
27
|
className,
|
|
23
|
-
|
|
28
|
+
value,
|
|
24
29
|
options,
|
|
25
30
|
dataAttributes,
|
|
26
31
|
withArrow = true,
|
|
@@ -30,11 +35,12 @@ export const Select = ({
|
|
|
30
35
|
alignment,
|
|
31
36
|
icon,
|
|
32
37
|
onlyIcon,
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
placeholder,
|
|
39
|
+
}: SelectProps<T>) {
|
|
40
|
+
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
35
41
|
|
|
36
42
|
const [isOpen, setIsOpen] = useState<boolean>(false);
|
|
37
|
-
const [
|
|
43
|
+
// const [selectedIdx, setSelectedIdx] = useState<React.ReactNode | string>(selected);
|
|
38
44
|
|
|
39
45
|
const handleOpen = () => {
|
|
40
46
|
setIsOpen(true);
|
|
@@ -48,46 +54,56 @@ export const Select = ({
|
|
|
48
54
|
setIsOpen(!isOpen);
|
|
49
55
|
};
|
|
50
56
|
|
|
51
|
-
const handleSelect = (value:
|
|
52
|
-
|
|
57
|
+
const handleSelect = (value: T) => {
|
|
58
|
+
// setSelectedIdx(options.findIndex(o => o.value === value));
|
|
53
59
|
setIsOpen(false);
|
|
54
60
|
onChange?.(value);
|
|
55
61
|
};
|
|
56
62
|
|
|
57
|
-
useOutsideClick(
|
|
63
|
+
useOutsideClick(containerRef, handleClose);
|
|
58
64
|
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, [selected]);
|
|
65
|
+
// useEffect(() => {
|
|
66
|
+
// handleSelect(selected);
|
|
67
|
+
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
|
+
// }, [selected]);
|
|
69
|
+
|
|
70
|
+
const selectedOption = options.find((option) => option.value === value);
|
|
63
71
|
|
|
64
72
|
return (
|
|
65
73
|
<SelectContainer
|
|
66
74
|
{...dataAttributes}
|
|
67
75
|
data-testid="select"
|
|
68
76
|
className={className}
|
|
69
|
-
ref={
|
|
77
|
+
ref={containerRef}
|
|
70
78
|
onPointerEnter={triggerEvent === 'hover' ? handleOpen : undefined}
|
|
71
79
|
onPointerLeave={triggerEvent === 'hover' ? handleClose : undefined}
|
|
72
80
|
onClick={triggerEvent === 'click' ? handleToggle : undefined}
|
|
73
81
|
>
|
|
74
82
|
<SelectInput>
|
|
75
|
-
{!onlyIcon &&
|
|
83
|
+
{!onlyIcon && (
|
|
84
|
+
<SelectInputValue>
|
|
85
|
+
{selectedOption?.label || selectedOption?.element || placeholder}
|
|
86
|
+
</SelectInputValue>
|
|
87
|
+
)}
|
|
76
88
|
{icon}
|
|
77
89
|
{withArrow ? isOpen ? <ArrowIcon direction="up" /> : <ArrowIcon direction="down" /> : null}
|
|
78
90
|
</SelectInput>
|
|
79
91
|
{isOpen && (
|
|
80
92
|
<SelectList placement={placement} alignment={alignment}>
|
|
81
93
|
{options.map((option, index) => (
|
|
82
|
-
<SelectListItem
|
|
83
|
-
{
|
|
94
|
+
<SelectListItem
|
|
95
|
+
key={index}
|
|
96
|
+
onClick={() => handleSelect(option.value)}
|
|
97
|
+
selected={option.value === value}
|
|
98
|
+
>
|
|
99
|
+
{typeof option.element === 'string' ? <div>{option.element}</div> : option.element}
|
|
84
100
|
</SelectListItem>
|
|
85
101
|
))}
|
|
86
102
|
</SelectList>
|
|
87
103
|
)}
|
|
88
104
|
</SelectContainer>
|
|
89
105
|
);
|
|
90
|
-
}
|
|
106
|
+
}
|
|
91
107
|
|
|
92
108
|
export const SelectContainer = styled.div`
|
|
93
109
|
position: relative;
|
|
@@ -121,8 +137,8 @@ export const SelectInputValue = styled.div`
|
|
|
121
137
|
|
|
122
138
|
export const SelectList = styled.ul<{ placement?: string; alignment?: string }>`
|
|
123
139
|
position: absolute;
|
|
124
|
-
top: ${({ placement }) => (placement === 'top' ? 'auto' : '
|
|
125
|
-
bottom: ${({ placement }) => (placement === 'top' ? '
|
|
140
|
+
top: ${({ placement }) => (placement === 'top' ? 'auto' : '100%')};
|
|
141
|
+
bottom: ${({ placement }) => (placement === 'top' ? '100%' : 'auto')};
|
|
126
142
|
left: ${({ alignment }) => (alignment === 'start' ? '0' : 'auto')};
|
|
127
143
|
right: ${({ alignment }) => (alignment === 'end' ? '0' : 'auto')};
|
|
128
144
|
margin: 0;
|
|
@@ -140,7 +156,7 @@ export const SelectList = styled.ul<{ placement?: string; alignment?: string }>`
|
|
|
140
156
|
z-index: 1;
|
|
141
157
|
`;
|
|
142
158
|
|
|
143
|
-
export const SelectListItem = styled.li
|
|
159
|
+
export const SelectListItem = styled.li<{ selected: boolean }>`
|
|
144
160
|
border-radius: var(--select-list-item-border-radius);
|
|
145
161
|
|
|
146
162
|
& > * {
|
|
@@ -148,6 +164,12 @@ export const SelectListItem = styled.li`
|
|
|
148
164
|
}
|
|
149
165
|
|
|
150
166
|
:hover {
|
|
151
|
-
background-color: var(--select-list-item-
|
|
167
|
+
background-color: var(--select-list-item-hover-background-color);
|
|
152
168
|
}
|
|
169
|
+
|
|
170
|
+
${({ selected }) =>
|
|
171
|
+
selected &&
|
|
172
|
+
`
|
|
173
|
+
&, &:hover { background-color: var(--select-list-item-active-background-color); }
|
|
174
|
+
`}
|
|
153
175
|
`;
|
|
@@ -24,7 +24,8 @@ export const select = css`
|
|
|
24
24
|
--select-list-item-horizontal-padding: var(--spacing-base); // @presenter Spacing
|
|
25
25
|
--select-list-item-vertical-padding: var(--spacing-xs); // @presenter Spacing
|
|
26
26
|
--select-list-item-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
27
|
-
--select-list-item-active-background-color: var(--bg
|
|
27
|
+
--select-list-item-active-background-color: var(--color-primary-bg); // @presenter Color
|
|
28
|
+
--select-list-item-hover-background-color: var(--bg-raised); // @presenter Color
|
|
28
29
|
|
|
29
30
|
// @tokens End
|
|
30
31
|
`;
|
|
@@ -9,6 +9,11 @@ export const VersionPicker = styled(Select).attrs(() => ({
|
|
|
9
9
|
'data-component-name': 'Sidebar/VersionPicker',
|
|
10
10
|
},
|
|
11
11
|
}))<SelectProps>`
|
|
12
|
+
--select-list-item-active-background-color: var(
|
|
13
|
+
--version-picker-list-item-active-background-color
|
|
14
|
+
);
|
|
15
|
+
--select-list-item-hover-background-color: var(--version-picker-list-item-hover-background-color);
|
|
16
|
+
|
|
12
17
|
font-size: var(--version-picker-font-size);
|
|
13
18
|
font-weight: var(--version-picker-font-weight);
|
|
14
19
|
border-radius: var(--version-picker-border-radius);
|
|
@@ -40,9 +45,5 @@ export const VersionPicker = styled(Select).attrs(() => ({
|
|
|
40
45
|
padding: var(--version-picker-list-item-vertical-padding)
|
|
41
46
|
var(--version-picker-list-item-horizontal-padding);
|
|
42
47
|
}
|
|
43
|
-
|
|
44
|
-
:hover {
|
|
45
|
-
background-color: var(--version-picker-list-item-active-background-color);
|
|
46
|
-
}
|
|
47
48
|
}
|
|
48
49
|
`;
|
|
@@ -75,7 +75,7 @@ export const sidebar = css`
|
|
|
75
75
|
*/
|
|
76
76
|
--sidebar-item-border-radius: 6px; // @presenter BorderRadius
|
|
77
77
|
|
|
78
|
-
/**
|
|
78
|
+
/**
|
|
79
79
|
* @tokens Sidebar item icon
|
|
80
80
|
*/
|
|
81
81
|
--sidebar-item-icon-size: var(--spacing-xl);
|
|
@@ -161,7 +161,7 @@ export const sidebar = css`
|
|
|
161
161
|
--sidebar-back-padding-left: var(--spacing-xs); // @presenter Spacing
|
|
162
162
|
--sidebar-back-button-icon: none;
|
|
163
163
|
|
|
164
|
-
/**
|
|
164
|
+
/**
|
|
165
165
|
* @tokens Sidebar footer
|
|
166
166
|
*/
|
|
167
167
|
--sidebar-footer-padding-vertical: var(--spacing-sm); // @presenter Spacing
|
|
@@ -175,7 +175,7 @@ export const sidebar = css`
|
|
|
175
175
|
--sidebar-controls-collapsed-gap: var(--spacing-xs); // @presenter Spacing
|
|
176
176
|
--sidebar-controls-collapsed-padding-vertical: var(--spacing-xs); // @presenter Spacing
|
|
177
177
|
--sidebar-controls-collapsed-padding-horizontal: var(--spacing-xxs); // @presenter Spacing
|
|
178
|
-
|
|
178
|
+
|
|
179
179
|
// @tokens End
|
|
180
180
|
`;
|
|
181
181
|
|
|
@@ -208,6 +208,7 @@ export const versionPicker = css`
|
|
|
208
208
|
--version-picker-list-item-vertical-padding: var(--select-list-item-vertical-padding); // @presenter Spacing
|
|
209
209
|
--version-picker-list-item-border-radius: var(--select-list-item-border-radius); // @presenter BorderRadius
|
|
210
210
|
--version-picker-list-item-active-background-color: var(--select-list-item-active-background-color); // @presenter Color
|
|
211
|
-
|
|
211
|
+
--version-picker-list-item-hover-background-color: var(--select-list-item-hover-background-color); // @presenter Color
|
|
212
|
+
|
|
212
213
|
// @tokens End
|
|
213
214
|
`;
|
|
@@ -9,6 +9,6 @@ export const TileHeader = styled.h3.attrs<{ className?: string }>(({ className }
|
|
|
9
9
|
color: ${(props) => props.color || 'var(--h3-color)'};
|
|
10
10
|
font-family: var(--h3-font-family);
|
|
11
11
|
&& {
|
|
12
|
-
margin:
|
|
12
|
+
margin: 0 0 var(--h3-margin-bottom);
|
|
13
13
|
}
|
|
14
14
|
`;
|
package/src/config.ts
CHANGED
|
@@ -325,6 +325,14 @@ const scorecardConfigSchema = {
|
|
|
325
325
|
required: ['levels'],
|
|
326
326
|
properties: {
|
|
327
327
|
failBuildIfBelowMinimum: { type: 'boolean', default: false },
|
|
328
|
+
teamMetadataProperty: {
|
|
329
|
+
type: 'object',
|
|
330
|
+
properties: {
|
|
331
|
+
property: { type: 'string' },
|
|
332
|
+
label: { type: 'string' },
|
|
333
|
+
default: { type: 'string' },
|
|
334
|
+
},
|
|
335
|
+
},
|
|
328
336
|
levels: {
|
|
329
337
|
type: 'array',
|
|
330
338
|
items: {
|
package/src/globalStyle.ts
CHANGED
|
@@ -268,13 +268,13 @@ const typography = css`
|
|
|
268
268
|
* @presenter LineHeight
|
|
269
269
|
*/
|
|
270
270
|
|
|
271
|
-
--line-height-base:
|
|
272
|
-
--line-height-xsm:
|
|
273
|
-
--line-height-sm:
|
|
274
|
-
--line-height-md:
|
|
275
|
-
--line-height-lg:
|
|
276
|
-
--line-height-xlg:
|
|
277
|
-
--line-height-xxlg:
|
|
271
|
+
--line-height-base: 24px;
|
|
272
|
+
--line-height-xsm: 20px;
|
|
273
|
+
--line-height-sm: 22px;
|
|
274
|
+
--line-height-md: 26px;
|
|
275
|
+
--line-height-lg: 28px;
|
|
276
|
+
--line-height-xlg: 30px;
|
|
277
|
+
--line-height-xxlg: 32px;
|
|
278
278
|
|
|
279
279
|
/**
|
|
280
280
|
* @tokens Font Sizes
|
|
@@ -420,7 +420,7 @@ const headingsTypography = css`
|
|
|
420
420
|
--h3-font-family: var(--heading-font-family); // @presenter FontFamily
|
|
421
421
|
--h3-font-weight: var(--heading-font-weight); // @presenter FontWeight
|
|
422
422
|
--h3-font-size: 18px; // @presenter FontSize
|
|
423
|
-
--h3-line-height:
|
|
423
|
+
--h3-line-height: 22px; // @presenter LineHeight
|
|
424
424
|
--h3-margin-top: var(--heading-margin-top); // @presenter Spacing
|
|
425
425
|
--h3-margin-bottom: var(--heading-margin-bottom); // @presenter Spacing
|
|
426
426
|
--h3-text-color: var(--heading-text-color); // @presenter Color
|
|
@@ -594,9 +594,9 @@ const apiReferenceDocs = css`
|
|
|
594
594
|
* @presenter Color
|
|
595
595
|
*/
|
|
596
596
|
|
|
597
|
-
--schema-recursive-text-color: var(--color-warning); // @presenter Color
|
|
597
|
+
--schema-recursive-text-color: var(--color-warning-active); // @presenter Color
|
|
598
598
|
--schema-recursive-background-color: var(--color-warning-bg); // @presenter Color
|
|
599
|
-
--schema-recursive-border-color: var(--color-warning-
|
|
599
|
+
--schema-recursive-border-color: var(--color-warning-active); // @presenter Color
|
|
600
600
|
|
|
601
601
|
/**
|
|
602
602
|
* @tokens GraphQL Docs Reference Schema Non null label
|
|
@@ -702,9 +702,9 @@ const badges = css`
|
|
|
702
702
|
* @tokens Deprecated Badge
|
|
703
703
|
*/
|
|
704
704
|
|
|
705
|
-
--badge-deprecated-text-color: var(--color-warning); // @presenter Color
|
|
705
|
+
--badge-deprecated-text-color: var(--color-warning-active); // @presenter Color
|
|
706
706
|
--badge-deprecated-background-color: var(--color-warning-bg); // @presenter Color
|
|
707
|
-
--badge-deprecated-border-color: var(--color-warning-
|
|
707
|
+
--badge-deprecated-border-color: var(--color-warning-active); // @presenter Color
|
|
708
708
|
--badge-deprecated-border: 1px solid var(--badge-deprecated-border-color); // @presenter Border
|
|
709
709
|
--badge-deprecated-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
710
710
|
|