@redocly/theme 0.19.2 → 0.19.4
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/Button/Button.js +1 -0
- package/lib/components/Button/styledVariables.js +2 -0
- package/lib/components/Catalog/Catalog.d.ts +3 -1
- package/lib/components/Catalog/Catalog.js +9 -9
- package/lib/components/Catalog/styledVariables.js +4 -2
- package/lib/components/Catalog/useCatalog.js +2 -2
- package/lib/components/Panel/styledVariables.js +1 -0
- package/lib/config.d.ts +2 -2
- package/lib/config.js +1 -1
- package/package.json +1 -1
- package/src/components/Button/Button.tsx +1 -0
- package/src/components/Button/styledVariables.ts +2 -0
- package/src/components/Catalog/Catalog.tsx +21 -19
- package/src/components/Catalog/styledVariables.ts +4 -2
- package/src/components/Catalog/useCatalog.ts +1 -1
- package/src/components/Panel/styledVariables.ts +1 -0
- package/src/config.ts +1 -1
|
@@ -69,6 +69,7 @@ exports.baseButtonStyles = (0, styled_components_1.css) `
|
|
|
69
69
|
font-family: var(--button-font-family);
|
|
70
70
|
font-weight: var(--button-font-weight);
|
|
71
71
|
box-shadow: var(--button-box-shadow);
|
|
72
|
+
text-wrap: var(--button-text-wrap);
|
|
72
73
|
|
|
73
74
|
&:hover {
|
|
74
75
|
box-shadow: var(--button-hover-box-shadow);
|
|
@@ -10,5 +10,7 @@ export declare const FilterControls: import("styled-components").StyledComponent
|
|
|
10
10
|
export declare const CatalogPageContent: import("styled-components").StyledComponent<"main", any, {}, never>;
|
|
11
11
|
export declare const CatalogTitle: import("styled-components").StyledComponent<"h2", any, {}, never>;
|
|
12
12
|
export declare const CatalogDescription: import("styled-components").StyledComponent<"p", any, {}, never>;
|
|
13
|
-
export declare const CatalogPageWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
13
|
+
export declare const CatalogPageWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
14
|
+
withoutFilters?: boolean | undefined;
|
|
15
|
+
}, never>;
|
|
14
16
|
export declare const CatalogPageDescriptionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -27,10 +27,10 @@ function Catalog(props) {
|
|
|
27
27
|
const { translate } = (0, index_1.useTranslate)();
|
|
28
28
|
(0, useModalScrollLock_1.default)(isAddingFilter);
|
|
29
29
|
return (react_1.default.createElement(Highlight_1.HighlightContext.Provider, { value: [filterTerm] },
|
|
30
|
-
react_1.default.createElement(exports.CatalogPageWrapper,
|
|
31
|
-
react_1.default.createElement(FilterTagsWrapper, null,
|
|
30
|
+
react_1.default.createElement(exports.CatalogPageWrapper, { withoutFilters: !filters.length },
|
|
31
|
+
!!filters.length && (react_1.default.createElement(FilterTagsWrapper, null,
|
|
32
32
|
react_1.default.createElement(Button_1.Button, { variant: "text", size: "small", icon: react_1.default.createElement(PlusIcon_1.PlusIcon, null), onClick: () => setIsAddingFilter(true) }, translate(translationKeys.addFilter, 'Add filter')),
|
|
33
|
-
react_1.default.createElement(FilterTags_1.FilterTags, { filters: filters })),
|
|
33
|
+
react_1.default.createElement(FilterTags_1.FilterTags, { filters: filters }))),
|
|
34
34
|
react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setFilterTerm, filters: filters, filterTerm: filterTerm, isMobile: false, filterValuesCasing: catalogConfig.filterValuesCasing }),
|
|
35
35
|
isAddingFilter && (react_1.default.createElement(FilterPopover_1.FilterPopover, { setIsAddingFilter: setIsAddingFilter, filters: filters, filterValuesCasing: catalogConfig.filterValuesCasing })),
|
|
36
36
|
react_1.default.createElement(exports.CatalogPageContent, null,
|
|
@@ -101,16 +101,13 @@ exports.CatalogTitle = (0, styled_components_1.default)(H2_1.H2) `
|
|
|
101
101
|
color: var(--catalog-title-text-color);
|
|
102
102
|
font-weight: var(--catalog-title-font-weight);
|
|
103
103
|
font-size: var(--catalog-title-font-size);
|
|
104
|
-
|
|
105
|
-
&& {
|
|
106
|
-
margin: 0;
|
|
107
|
-
}
|
|
104
|
+
margin: var(--catalog-title-margin);
|
|
108
105
|
`;
|
|
109
106
|
exports.CatalogDescription = styled_components_1.default.p `
|
|
110
107
|
color: var(--catalog-description-text-color);
|
|
111
108
|
font-weight: var(--catalog-description-font-weight);
|
|
112
109
|
font-size: var(--catalog-description-font-size);
|
|
113
|
-
margin: var(--catalog-description-margin
|
|
110
|
+
margin: var(--catalog-description-margin);
|
|
114
111
|
`;
|
|
115
112
|
exports.CatalogPageWrapper = styled_components_1.default.div `
|
|
116
113
|
--sidebar-width: var(--catalog-sidebar-width, 285px);
|
|
@@ -119,7 +116,6 @@ exports.CatalogPageWrapper = styled_components_1.default.div `
|
|
|
119
116
|
flex-direction: column;
|
|
120
117
|
|
|
121
118
|
font-weight: var(--font-weight-regular);
|
|
122
|
-
padding: 0;
|
|
123
119
|
|
|
124
120
|
color: var(--text-secondary);
|
|
125
121
|
font-size: var(--font-size-base);
|
|
@@ -138,8 +134,11 @@ exports.CatalogPageWrapper = styled_components_1.default.div `
|
|
|
138
134
|
font-weight: var(--link-font-weight);
|
|
139
135
|
}
|
|
140
136
|
|
|
137
|
+
padding: ${({ withoutFilters }) => (withoutFilters ? 'var(--spacing-base) 0 0 0' : '0')};
|
|
138
|
+
|
|
141
139
|
${({ theme }) => theme.mediaQueries.medium} {
|
|
142
140
|
flex-direction: row;
|
|
141
|
+
padding: 0;
|
|
143
142
|
}
|
|
144
143
|
`;
|
|
145
144
|
const FilterTagsWrapper = styled_components_1.default.div.attrs({ 'data-cy': 'Catalog/FilterTags' }) `
|
|
@@ -172,6 +171,7 @@ const FilterTagsWrapper = styled_components_1.default.div.attrs({ 'data-cy': 'Ca
|
|
|
172
171
|
}
|
|
173
172
|
`;
|
|
174
173
|
exports.CatalogPageDescriptionWrapper = styled_components_1.default.div `
|
|
174
|
+
margin: var(--catalog-heading-margin);
|
|
175
175
|
display: none;
|
|
176
176
|
|
|
177
177
|
${({ theme }) => theme.mediaQueries.medium} {
|
|
@@ -14,12 +14,15 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
14
14
|
--mobile-catalog-filter-padding-vertical: var(--spacing-sm);
|
|
15
15
|
--mobile-catalog-filter-padding-horizontal: var(--spacing-base);
|
|
16
16
|
|
|
17
|
+
--catalog-heading-margin: 0 0 var(--spacing-xl) 0;
|
|
18
|
+
|
|
17
19
|
/**
|
|
18
20
|
* @tokens Catalog page title
|
|
19
21
|
*/
|
|
20
22
|
--catalog-title-text-color: var(--text-primary);
|
|
21
23
|
--catalog-title-font-weight: var(--font-weight-bold);
|
|
22
24
|
--catalog-title-font-size: var(--font-size-heading-3);
|
|
25
|
+
--catalog-title-margin: 0 0 var(--spacing-sm) 0;
|
|
23
26
|
|
|
24
27
|
/**
|
|
25
28
|
* @tokens Catalog page description
|
|
@@ -27,8 +30,7 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
27
30
|
--catalog-description-text-color: var(--text-secondary);
|
|
28
31
|
--catalog-description-font-weight: var(--font-weight-regular);
|
|
29
32
|
--catalog-description-font-size: var(--font-size-base);
|
|
30
|
-
--catalog-description-margin
|
|
31
|
-
--catalog-description-margin-bottom: var(--spacing-xl);
|
|
33
|
+
--catalog-description-margin: 0 0 var(--spacing-sm) 0;
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
36
|
* @tokens Catalog page separator
|
|
@@ -119,8 +119,8 @@ function useCatalog(items, config) {
|
|
|
119
119
|
return React.useMemo(() => {
|
|
120
120
|
var _a;
|
|
121
121
|
const filters = filtersWithOptions.map((filter, idx) => {
|
|
122
|
-
var _a, _b, _c;
|
|
123
|
-
return (Object.assign(Object.assign({}, filter), { toggleOption: (value) => toggleOption(idx, value), selectOption: (value) => selectOption(idx, value), selectedOptions: (_a = filtersState[idx]) !== null && _a !== void 0 ? _a : new Set(), isFilterUsed: ((_c = (_b = filtersState[idx]) === null || _b === void 0 ? void 0 : _b.size) !== null && _c !== void 0 ? _c : 0) > 0 || !!filtersState[idx].from }));
|
|
122
|
+
var _a, _b, _c, _d;
|
|
123
|
+
return (Object.assign(Object.assign({}, filter), { toggleOption: (value) => toggleOption(idx, value), selectOption: (value) => selectOption(idx, value), selectedOptions: (_a = filtersState[idx]) !== null && _a !== void 0 ? _a : new Set(), isFilterUsed: ((_c = (_b = filtersState[idx]) === null || _b === void 0 ? void 0 : _b.size) !== null && _c !== void 0 ? _c : 0) > 0 || !!((_d = filtersState[idx]) === null || _d === void 0 ? void 0 : _d.from) }));
|
|
124
124
|
});
|
|
125
125
|
const filteredItems = filterItems(normalizedItems, filters, filterTerm);
|
|
126
126
|
// add more information to filters state which is known only after filtering items
|
|
@@ -445,6 +445,7 @@ exports.apiReferencePanels = (0, styled_components_1.css) `
|
|
|
445
445
|
--panel-try-it-action-button-font-weight: var(--font-weight-bold); // @presenter FontWeight
|
|
446
446
|
--panel-try-it-action-button-font-size: var(--panel-font-size); // @presenter FontSize
|
|
447
447
|
--panel-try-it-action-button-text-color: var(--text-light-solid); // @presenter Color
|
|
448
|
+
--panel-try-it-action-button-text-wrap: var(--button-text-wrap);
|
|
448
449
|
--panel-try-it-action-button-background-color: var(--color-primary); // @presenter Color
|
|
449
450
|
--panel-try-it-action-button-border-color: var(--color-primary); // @presenter Color
|
|
450
451
|
|
package/lib/config.d.ts
CHANGED
|
@@ -356,7 +356,7 @@ declare const scorecardConfigSchema: {
|
|
|
356
356
|
declare const catalogSchema: {
|
|
357
357
|
readonly type: "object";
|
|
358
358
|
readonly additionalProperties: true;
|
|
359
|
-
readonly required: readonly ["slug", "
|
|
359
|
+
readonly required: readonly ["slug", "items"];
|
|
360
360
|
readonly properties: {
|
|
361
361
|
readonly slug: {
|
|
362
362
|
readonly type: "string";
|
|
@@ -1590,7 +1590,7 @@ export declare const themeConfigSchema: {
|
|
|
1590
1590
|
readonly '.*': {
|
|
1591
1591
|
readonly type: "object";
|
|
1592
1592
|
readonly additionalProperties: true;
|
|
1593
|
-
readonly required: readonly ["slug", "
|
|
1593
|
+
readonly required: readonly ["slug", "items"];
|
|
1594
1594
|
readonly properties: {
|
|
1595
1595
|
readonly slug: {
|
|
1596
1596
|
readonly type: "string";
|
package/lib/config.js
CHANGED
|
@@ -314,7 +314,7 @@ const scorecardConfigSchema = {
|
|
|
314
314
|
const catalogSchema = {
|
|
315
315
|
type: 'object',
|
|
316
316
|
additionalProperties: true,
|
|
317
|
-
required: ['slug', '
|
|
317
|
+
required: ['slug', 'items'],
|
|
318
318
|
properties: {
|
|
319
319
|
slug: { type: 'string' },
|
|
320
320
|
filters: { type: 'array', items: catalogFilterSchema },
|
package/package.json
CHANGED
|
@@ -65,6 +65,7 @@ export const baseButtonStyles = css`
|
|
|
65
65
|
font-family: var(--button-font-family);
|
|
66
66
|
font-weight: var(--button-font-weight);
|
|
67
67
|
box-shadow: var(--button-box-shadow);
|
|
68
|
+
text-wrap: var(--button-text-wrap);
|
|
68
69
|
|
|
69
70
|
&:hover {
|
|
70
71
|
box-shadow: var(--button-hover-box-shadow);
|
|
@@ -35,18 +35,20 @@ export default function Catalog(props: {
|
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
37
|
<HighlightContext.Provider value={[filterTerm]}>
|
|
38
|
-
<CatalogPageWrapper>
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
<CatalogPageWrapper withoutFilters={!filters.length}>
|
|
39
|
+
{!!filters.length && (
|
|
40
|
+
<FilterTagsWrapper>
|
|
41
|
+
<Button
|
|
42
|
+
variant="text"
|
|
43
|
+
size="small"
|
|
44
|
+
icon={<PlusIcon />}
|
|
45
|
+
onClick={() => setIsAddingFilter(true)}
|
|
46
|
+
>
|
|
47
|
+
{translate(translationKeys.addFilter, 'Add filter')}
|
|
48
|
+
</Button>
|
|
49
|
+
<FilterTags filters={filters} />
|
|
50
|
+
</FilterTagsWrapper>
|
|
51
|
+
)}
|
|
50
52
|
<FilterContent
|
|
51
53
|
setFilterTerm={setFilterTerm}
|
|
52
54
|
filters={filters}
|
|
@@ -152,27 +154,23 @@ export const CatalogTitle = styled(H2)`
|
|
|
152
154
|
color: var(--catalog-title-text-color);
|
|
153
155
|
font-weight: var(--catalog-title-font-weight);
|
|
154
156
|
font-size: var(--catalog-title-font-size);
|
|
155
|
-
|
|
156
|
-
&& {
|
|
157
|
-
margin: 0;
|
|
158
|
-
}
|
|
157
|
+
margin: var(--catalog-title-margin);
|
|
159
158
|
`;
|
|
160
159
|
|
|
161
160
|
export const CatalogDescription = styled.p`
|
|
162
161
|
color: var(--catalog-description-text-color);
|
|
163
162
|
font-weight: var(--catalog-description-font-weight);
|
|
164
163
|
font-size: var(--catalog-description-font-size);
|
|
165
|
-
margin: var(--catalog-description-margin
|
|
164
|
+
margin: var(--catalog-description-margin);
|
|
166
165
|
`;
|
|
167
166
|
|
|
168
|
-
export const CatalogPageWrapper = styled.div
|
|
167
|
+
export const CatalogPageWrapper = styled.div<{ withoutFilters?: boolean }>`
|
|
169
168
|
--sidebar-width: var(--catalog-sidebar-width, 285px);
|
|
170
169
|
|
|
171
170
|
display: flex;
|
|
172
171
|
flex-direction: column;
|
|
173
172
|
|
|
174
173
|
font-weight: var(--font-weight-regular);
|
|
175
|
-
padding: 0;
|
|
176
174
|
|
|
177
175
|
color: var(--text-secondary);
|
|
178
176
|
font-size: var(--font-size-base);
|
|
@@ -191,8 +189,11 @@ export const CatalogPageWrapper = styled.div`
|
|
|
191
189
|
font-weight: var(--link-font-weight);
|
|
192
190
|
}
|
|
193
191
|
|
|
192
|
+
padding: ${({ withoutFilters }) => (withoutFilters ? 'var(--spacing-base) 0 0 0' : '0')};
|
|
193
|
+
|
|
194
194
|
${({ theme }) => theme.mediaQueries.medium} {
|
|
195
195
|
flex-direction: row;
|
|
196
|
+
padding: 0;
|
|
196
197
|
}
|
|
197
198
|
`;
|
|
198
199
|
|
|
@@ -227,6 +228,7 @@ const FilterTagsWrapper = styled.div.attrs({ 'data-cy': 'Catalog/FilterTags' })`
|
|
|
227
228
|
`;
|
|
228
229
|
|
|
229
230
|
export const CatalogPageDescriptionWrapper = styled.div`
|
|
231
|
+
margin: var(--catalog-heading-margin);
|
|
230
232
|
display: none;
|
|
231
233
|
|
|
232
234
|
${({ theme }) => theme.mediaQueries.medium} {
|
|
@@ -12,12 +12,15 @@ export const catalog = css`
|
|
|
12
12
|
--mobile-catalog-filter-padding-vertical: var(--spacing-sm);
|
|
13
13
|
--mobile-catalog-filter-padding-horizontal: var(--spacing-base);
|
|
14
14
|
|
|
15
|
+
--catalog-heading-margin: 0 0 var(--spacing-xl) 0;
|
|
16
|
+
|
|
15
17
|
/**
|
|
16
18
|
* @tokens Catalog page title
|
|
17
19
|
*/
|
|
18
20
|
--catalog-title-text-color: var(--text-primary);
|
|
19
21
|
--catalog-title-font-weight: var(--font-weight-bold);
|
|
20
22
|
--catalog-title-font-size: var(--font-size-heading-3);
|
|
23
|
+
--catalog-title-margin: 0 0 var(--spacing-sm) 0;
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* @tokens Catalog page description
|
|
@@ -25,8 +28,7 @@ export const catalog = css`
|
|
|
25
28
|
--catalog-description-text-color: var(--text-secondary);
|
|
26
29
|
--catalog-description-font-weight: var(--font-weight-regular);
|
|
27
30
|
--catalog-description-font-size: var(--font-size-base);
|
|
28
|
-
--catalog-description-margin
|
|
29
|
-
--catalog-description-margin-bottom: var(--spacing-xl);
|
|
31
|
+
--catalog-description-margin: 0 0 var(--spacing-sm) 0;
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* @tokens Catalog page separator
|
|
@@ -121,7 +121,7 @@ export function useCatalog(items: ResolvedNavItem[], config: CatalogConfig): Fil
|
|
|
121
121
|
selectOption: (value: string) => selectOption(idx, value),
|
|
122
122
|
selectedOptions: filtersState[idx] ?? new Set<string>(),
|
|
123
123
|
isFilterUsed:
|
|
124
|
-
((filtersState[idx] as any)?.size ?? 0) > 0 || !!(filtersState[idx] as any)
|
|
124
|
+
((filtersState[idx] as any)?.size ?? 0) > 0 || !!(filtersState[idx] as any)?.from,
|
|
125
125
|
}));
|
|
126
126
|
|
|
127
127
|
const filteredItems = filterItems(normalizedItems, filters, filterTerm);
|
|
@@ -444,6 +444,7 @@ export const apiReferencePanels = css`
|
|
|
444
444
|
--panel-try-it-action-button-font-weight: var(--font-weight-bold); // @presenter FontWeight
|
|
445
445
|
--panel-try-it-action-button-font-size: var(--panel-font-size); // @presenter FontSize
|
|
446
446
|
--panel-try-it-action-button-text-color: var(--text-light-solid); // @presenter Color
|
|
447
|
+
--panel-try-it-action-button-text-wrap: var(--button-text-wrap);
|
|
447
448
|
--panel-try-it-action-button-background-color: var(--color-primary); // @presenter Color
|
|
448
449
|
--panel-try-it-action-button-border-color: var(--color-primary); // @presenter Color
|
|
449
450
|
|
package/src/config.ts
CHANGED
|
@@ -354,7 +354,7 @@ const scorecardConfigSchema = {
|
|
|
354
354
|
const catalogSchema = {
|
|
355
355
|
type: 'object',
|
|
356
356
|
additionalProperties: true,
|
|
357
|
-
required: ['slug', '
|
|
357
|
+
required: ['slug', 'items'],
|
|
358
358
|
properties: {
|
|
359
359
|
slug: { type: 'string' },
|
|
360
360
|
filters: { type: 'array', items: catalogFilterSchema },
|