@redocly/theme 0.17.1 → 0.18.1
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 +53 -85
- package/lib/components/Catalog/Catalog.d.ts +1 -1
- package/lib/components/Catalog/useCatalog.d.ts +2 -1
- package/lib/components/Dropdown/Dropdown.d.ts +16 -0
- package/lib/components/Dropdown/Dropdown.js +113 -0
- package/lib/components/Dropdown/index.d.ts +1 -0
- package/lib/components/Dropdown/index.js +18 -0
- package/lib/components/Menu/MenuGroup.js +2 -0
- package/lib/components/Menu/MenuItem.js +2 -0
- package/lib/components/Menu/MobileMenu.d.ts +2 -9
- package/lib/components/Menu/MobileMenu.js +35 -65
- package/lib/components/Menu/MobileMenuGroup.js +2 -0
- package/lib/components/Menu/constants.d.ts +5 -0
- package/lib/components/Menu/constants.js +10 -0
- package/lib/components/Menu/hooks/use-mobile-menu-items.d.ts +2 -0
- package/lib/components/Menu/hooks/use-mobile-menu-items.js +83 -0
- package/lib/components/Menu/hooks/use-mobile-menu-levels.d.ts +5 -0
- package/lib/components/Menu/hooks/use-mobile-menu-levels.js +50 -0
- package/lib/components/Menu/types.d.ts +3 -0
- package/lib/components/Menu/types.js +3 -0
- package/lib/components/Menu/utils.d.ts +7 -0
- package/lib/components/Menu/utils.js +76 -0
- package/lib/components/Navbar/MobileUserProfile.d.ts +1 -1
- package/lib/components/Navbar/MobileUserProfile.js +4 -7
- package/lib/components/Navbar/Navbar.d.ts +0 -3
- package/lib/components/Navbar/Navbar.js +9 -12
- package/lib/components/Navbar/NavbarItem.d.ts +5 -1
- package/lib/components/Navbar/NavbarItem.js +15 -16
- package/lib/components/Navbar/NavbarMenu.js +1 -1
- package/lib/components/OpenApiDocs/Dropdown.js +5 -5
- package/lib/components/Product/Product.d.ts +7 -0
- package/lib/components/Product/Product.js +23 -0
- package/lib/components/Product/ProductPicker.d.ts +2 -0
- package/lib/components/Product/ProductPicker.js +83 -0
- package/lib/components/Product/index.d.ts +2 -0
- package/lib/components/Product/index.js +19 -0
- package/lib/components/Profile/UserProfile.js +54 -6
- package/lib/components/Search/InputWrapper.js +1 -7
- package/lib/components/Search/ProductTag.d.ts +6 -0
- package/lib/components/Search/ProductTag.js +61 -0
- package/lib/components/Search/SearchDialog.js +19 -4
- package/lib/components/Search/SearchItem.d.ts +2 -1
- package/lib/components/Search/SearchItem.js +13 -2
- package/lib/components/Search/index.d.ts +1 -0
- package/lib/components/Search/index.js +1 -0
- package/lib/components/Select/Select.d.ts +18 -0
- package/lib/components/Select/Select.js +118 -0
- package/lib/components/Select/index.d.ts +1 -0
- package/lib/components/Select/index.js +18 -0
- package/lib/components/Sidebar/DrilldownMenuItem.js +2 -9
- package/lib/components/Sidebar/SidebarItemIcon.d.ts +1 -0
- package/lib/components/Sidebar/SidebarItemIcon.js +16 -0
- package/lib/components/Sidebar/VersionPicker.d.ts +7 -0
- package/lib/components/Sidebar/VersionPicker.js +51 -0
- package/lib/components/Sidebar/index.d.ts +2 -0
- package/lib/components/Sidebar/index.js +2 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.js +3 -0
- package/lib/config.d.ts +952 -25
- package/lib/config.js +115 -2
- package/lib/globalStyle.js +177 -16
- package/lib/hooks/useThemeConfig.d.ts +1 -1
- package/lib/hooks/useThemeConfig.js +7 -2
- package/lib/mocks/hooks/index.d.ts +4 -3
- package/lib/mocks/hooks/index.js +6 -2
- package/lib/mocks/search.d.ts +1 -1
- package/lib/mocks/search.js +1 -1
- package/lib/types/portal/src/shared/types/catalog.d.ts +2 -24
- package/lib/types/portal/src/shared/types/nav.d.ts +4 -0
- package/lib/types/portal/src/shared/types/searchDocument.d.ts +2 -0
- package/lib/ui/darkColors.js +2 -0
- package/lib/ui/index.d.ts +0 -1
- package/lib/ui/index.js +0 -1
- package/package.json +1 -1
- package/src/I18n/LanguagePicker.tsx +62 -89
- package/src/components/Catalog/Catalog.tsx +1 -1
- package/src/components/Catalog/useCatalog.ts +2 -3
- package/src/components/Dropdown/Dropdown.tsx +138 -0
- package/src/components/Dropdown/index.ts +1 -0
- package/src/components/Menu/MenuGroup.tsx +2 -0
- package/src/components/Menu/MenuItem.tsx +2 -0
- package/src/components/Menu/MobileMenu.tsx +43 -96
- package/src/components/Menu/MobileMenuGroup.tsx +2 -0
- package/src/components/Menu/constants.ts +5 -0
- package/src/components/Menu/hooks/use-mobile-menu-items.ts +100 -0
- package/src/components/Menu/hooks/use-mobile-menu-levels.ts +55 -0
- package/src/components/Menu/types.ts +3 -0
- package/src/components/Menu/utils.ts +109 -0
- package/src/components/Navbar/MobileUserProfile.tsx +19 -20
- package/src/components/Navbar/Navbar.tsx +12 -22
- package/src/components/Navbar/NavbarItem.tsx +20 -15
- package/src/components/Navbar/NavbarMenu.tsx +1 -1
- package/src/components/OpenApiDocs/Dropdown.tsx +5 -5
- package/src/components/Product/Product.tsx +28 -0
- package/src/components/Product/ProductPicker.tsx +97 -0
- package/src/components/Product/index.ts +2 -0
- package/src/components/Profile/UserProfile.tsx +80 -21
- package/src/components/Search/InputWrapper.tsx +1 -7
- package/src/components/Search/ProductTag.tsx +46 -0
- package/src/components/Search/SearchDialog.tsx +21 -5
- package/src/components/Search/SearchItem.tsx +17 -3
- package/src/components/Search/index.ts +1 -0
- package/src/components/Select/Select.tsx +140 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/Sidebar/DrilldownMenuItem.tsx +2 -10
- package/src/components/Sidebar/SidebarItemIcon.tsx +10 -0
- package/src/components/Sidebar/VersionPicker.tsx +48 -0
- package/src/components/Sidebar/index.ts +2 -0
- package/src/components/index.ts +3 -0
- package/src/config.ts +140 -6
- package/src/globalStyle.ts +181 -16
- package/src/hooks/useThemeConfig.ts +18 -3
- package/src/mocks/hooks/index.ts +9 -3
- package/src/mocks/search.ts +1 -1
- package/src/types/portal/src/shared/types/catalog.ts +2 -26
- package/src/types/portal/src/shared/types/i18n.d.ts +3 -1
- package/src/types/portal/src/shared/types/nav.ts +41 -37
- package/src/types/portal/src/shared/types/searchDocument.ts +7 -4
- package/src/ui/darkColors.tsx +2 -0
- package/src/ui/index.tsx +0 -1
- package/lib/components/Navbar/NavbarDropdown.d.ts +0 -9
- package/lib/components/Navbar/NavbarDropdown.js +0 -40
- package/lib/components/Profile/UserProfileMenu.d.ts +0 -8
- package/lib/components/Profile/UserProfileMenu.js +0 -93
- package/src/components/Navbar/NavbarDropdown.tsx +0 -48
- package/src/components/Profile/UserProfileMenu.tsx +0 -97
package/src/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FromSchema } from 'json-schema-to-ts';
|
|
2
2
|
import type { MenuStyle, ResolvedNavLinkItem } from './types/portal';
|
|
3
|
-
import type {
|
|
3
|
+
import type { REDOCLY_TEAMS_RBAC } from './types/portal/src/shared/constants';
|
|
4
4
|
|
|
5
5
|
const logoConfigSchema = {
|
|
6
6
|
type: 'object',
|
|
@@ -89,7 +89,7 @@ const markdownConfigSchema = {
|
|
|
89
89
|
type: 'object',
|
|
90
90
|
properties: {
|
|
91
91
|
header: { type: 'string', default: 'On this page' },
|
|
92
|
-
depth: { type: '
|
|
92
|
+
depth: { type: 'integer', default: 3, minimum: 1 },
|
|
93
93
|
...hideConfigSchema.properties,
|
|
94
94
|
},
|
|
95
95
|
additionalProperties: false,
|
|
@@ -276,6 +276,17 @@ const navItemsSchema = {
|
|
|
276
276
|
},
|
|
277
277
|
} as const;
|
|
278
278
|
|
|
279
|
+
const productConfigSchema = {
|
|
280
|
+
type: 'object',
|
|
281
|
+
properties: {
|
|
282
|
+
name: { type: 'string' },
|
|
283
|
+
icon: { type: 'string' },
|
|
284
|
+
folder: { type: 'string' },
|
|
285
|
+
},
|
|
286
|
+
additionalProperties: false,
|
|
287
|
+
required: ['name', 'icon', 'folder'],
|
|
288
|
+
} as const;
|
|
289
|
+
|
|
279
290
|
const suggestedPageSchema = {
|
|
280
291
|
type: 'object',
|
|
281
292
|
properties: {
|
|
@@ -286,6 +297,93 @@ const suggestedPageSchema = {
|
|
|
286
297
|
required: ['page'],
|
|
287
298
|
} as const;
|
|
288
299
|
|
|
300
|
+
const catalogFilterSchema = {
|
|
301
|
+
type: 'object',
|
|
302
|
+
additionalProperties: false,
|
|
303
|
+
required: ['title', 'property'],
|
|
304
|
+
properties: {
|
|
305
|
+
type: { type: 'string', enum: ['select', 'checkboxes', 'date-range'] },
|
|
306
|
+
title: { type: 'string' },
|
|
307
|
+
titleTranslationKey: { type: 'string' },
|
|
308
|
+
property: { type: 'string' },
|
|
309
|
+
parentFilter: { type: 'string' },
|
|
310
|
+
missingCategoryName: { type: 'string' },
|
|
311
|
+
missingCategoryNameTranslationKey: { type: 'string' },
|
|
312
|
+
options: { type: 'array', items: { type: 'string' } },
|
|
313
|
+
},
|
|
314
|
+
} as const;
|
|
315
|
+
|
|
316
|
+
const scorecardConfigSchema = {
|
|
317
|
+
type: 'object',
|
|
318
|
+
additionalProperties: true,
|
|
319
|
+
required: ['levels'],
|
|
320
|
+
properties: {
|
|
321
|
+
failBuildIfBelowMinimum: { type: 'boolean', default: false },
|
|
322
|
+
levels: {
|
|
323
|
+
type: 'array',
|
|
324
|
+
items: {
|
|
325
|
+
type: 'object',
|
|
326
|
+
required: ['name'],
|
|
327
|
+
properties: {
|
|
328
|
+
name: { type: 'string' },
|
|
329
|
+
extends: { type: 'array', items: { type: 'string' } },
|
|
330
|
+
rules: {
|
|
331
|
+
type: 'object',
|
|
332
|
+
additionalProperties: {
|
|
333
|
+
type: ['object', 'string'],
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
additionalProperties: false,
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
targets: {
|
|
341
|
+
type: 'array',
|
|
342
|
+
items: {
|
|
343
|
+
type: 'object',
|
|
344
|
+
required: ['where'],
|
|
345
|
+
properties: {
|
|
346
|
+
minimumLevel: { type: 'string' },
|
|
347
|
+
where: {
|
|
348
|
+
type: 'object',
|
|
349
|
+
required: ['metadata'],
|
|
350
|
+
properties: {
|
|
351
|
+
metadata: { type: 'object', additionalProperties: { type: 'string' } },
|
|
352
|
+
},
|
|
353
|
+
additionalProperties: false,
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
additionalProperties: false,
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
} as const;
|
|
361
|
+
|
|
362
|
+
const catalogSchema = {
|
|
363
|
+
type: 'object',
|
|
364
|
+
additionalProperties: true,
|
|
365
|
+
required: ['slug', 'filters', 'groupByFirstFilter', 'items'],
|
|
366
|
+
properties: {
|
|
367
|
+
slug: { type: 'string' },
|
|
368
|
+
filters: { type: 'array', items: catalogFilterSchema },
|
|
369
|
+
groupByFirstFilter: { type: 'boolean' },
|
|
370
|
+
items: navItemsSchema,
|
|
371
|
+
requiredPermission: { type: 'string' },
|
|
372
|
+
separateVersions: { type: 'boolean' },
|
|
373
|
+
title: { type: 'string' },
|
|
374
|
+
titleTranslationKey: { type: 'string' },
|
|
375
|
+
description: { type: 'string' },
|
|
376
|
+
descriptionTranslationKey: { type: 'string' },
|
|
377
|
+
},
|
|
378
|
+
} as const;
|
|
379
|
+
|
|
380
|
+
const catalogsConfigSchema = {
|
|
381
|
+
type: 'object',
|
|
382
|
+
patternProperties: {
|
|
383
|
+
'.*': catalogSchema,
|
|
384
|
+
},
|
|
385
|
+
} as const;
|
|
386
|
+
|
|
289
387
|
export const themeConfigSchema = {
|
|
290
388
|
type: 'object',
|
|
291
389
|
properties: {
|
|
@@ -303,6 +401,10 @@ export const themeConfigSchema = {
|
|
|
303
401
|
},
|
|
304
402
|
additionalProperties: false,
|
|
305
403
|
},
|
|
404
|
+
products: {
|
|
405
|
+
type: 'object',
|
|
406
|
+
additionalProperties: productConfigSchema,
|
|
407
|
+
},
|
|
306
408
|
footer: {
|
|
307
409
|
type: 'object',
|
|
308
410
|
properties: {
|
|
@@ -532,15 +634,29 @@ export const themeConfigSchema = {
|
|
|
532
634
|
additionalProperties: false,
|
|
533
635
|
default: {},
|
|
534
636
|
},
|
|
637
|
+
catalog: catalogsConfigSchema,
|
|
638
|
+
scorecard: scorecardConfigSchema,
|
|
535
639
|
},
|
|
536
640
|
additionalProperties: true,
|
|
537
641
|
default: {},
|
|
538
642
|
} as const;
|
|
539
643
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
644
|
+
export const productThemeOverrideSchema = {
|
|
645
|
+
type: 'object',
|
|
646
|
+
properties: {
|
|
647
|
+
logo: themeConfigSchema.properties.logo,
|
|
648
|
+
navbar: themeConfigSchema.properties.navbar,
|
|
649
|
+
footer: themeConfigSchema.properties.footer,
|
|
650
|
+
sidebar: themeConfigSchema.properties.sidebar,
|
|
651
|
+
search: themeConfigSchema.properties.search,
|
|
652
|
+
codeSnippet: themeConfigSchema.properties.codeSnippet,
|
|
653
|
+
breadcrumbs: themeConfigSchema.properties.breadcrumbs,
|
|
654
|
+
},
|
|
655
|
+
additionalProperties: true,
|
|
656
|
+
default: {},
|
|
657
|
+
} as const;
|
|
658
|
+
|
|
659
|
+
export type ThemeConfig = FromSchema<typeof themeConfigSchema>;
|
|
544
660
|
|
|
545
661
|
export type ThemeUIConfig = ThemeConfig & {
|
|
546
662
|
auth?: {
|
|
@@ -559,6 +675,21 @@ export type ThemeUIConfig = ThemeConfig & {
|
|
|
559
675
|
breadcrumbs?: {
|
|
560
676
|
prefixItems?: ResolvedNavLinkItem[];
|
|
561
677
|
};
|
|
678
|
+
products?: {
|
|
679
|
+
[key: string]: ProductUiConfig;
|
|
680
|
+
};
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
export type ProductConfig = FromSchema<typeof productConfigSchema>;
|
|
684
|
+
export type ProductThemeOverrideConfig = Pick<
|
|
685
|
+
ThemeUIConfig,
|
|
686
|
+
'logo' | 'navbar' | 'footer' | 'sidebar' | 'search' | 'codeSnippet' | 'breadcrumbs'
|
|
687
|
+
>;
|
|
688
|
+
export type ProductUiConfig = ProductConfig & {
|
|
689
|
+
slug: string;
|
|
690
|
+
link: string;
|
|
691
|
+
[REDOCLY_TEAMS_RBAC]?: { [key: string]: string };
|
|
692
|
+
themeOverride?: ProductThemeOverrideConfig;
|
|
562
693
|
};
|
|
563
694
|
|
|
564
695
|
export type MarkdownConfig = FromSchema<typeof markdownConfigSchema>;
|
|
@@ -568,3 +699,6 @@ export type RudderstackAnalyticsConfig = FromSchema<typeof rudderstackAnalyticsC
|
|
|
568
699
|
export type SegmentAnalyticsConfig = FromSchema<typeof segmentAnalyticsConfigSchema>;
|
|
569
700
|
export type GtmAnalyticsConfig = FromSchema<typeof gtmAnalyticsConfigSchema>;
|
|
570
701
|
export type GoogleAnalyticsConfig = FromSchema<typeof googleAnalyticsConfigSchema>;
|
|
702
|
+
export type CatalogConfig = FromSchema<typeof catalogSchema>;
|
|
703
|
+
export type CatalogFilterConfig = FromSchema<typeof catalogFilterSchema>;
|
|
704
|
+
export type ScorecardConfig = FromSchema<typeof scorecardConfigSchema>;
|
package/src/globalStyle.ts
CHANGED
|
@@ -464,7 +464,7 @@ const sidebar = css`
|
|
|
464
464
|
/**
|
|
465
465
|
* @tokens Sidebar item icon
|
|
466
466
|
*/
|
|
467
|
-
--sidebar-item-icon-size:
|
|
467
|
+
--sidebar-item-icon-size: 20px;
|
|
468
468
|
--sidebar-item-icon-border-radius: 100%;
|
|
469
469
|
|
|
470
470
|
/**
|
|
@@ -1352,9 +1352,9 @@ const apiReferenceDocs = css`
|
|
|
1352
1352
|
*/
|
|
1353
1353
|
|
|
1354
1354
|
--schemas-mime-type-dropdown-padding: 0px 26px 0px 4px;
|
|
1355
|
-
--schemas-mime-type-dropdown-border: var(--dropdown-border); // @presenter Border
|
|
1356
|
-
--schemas-mime-type-dropdown-font-size: var(--dropdown-font-size); // @presenter FontSize
|
|
1357
|
-
--schemas-mime-type-dropdown-text-color: var(--dropdown-
|
|
1355
|
+
--schemas-mime-type-dropdown-border: var(--docs-dropdown-border); // @presenter Border
|
|
1356
|
+
--schemas-mime-type-dropdown-font-size: var(--docs-dropdown-font-size); // @presenter FontSize
|
|
1357
|
+
--schemas-mime-type-dropdown-text-color: var(--docs-dropdown-font-size); // @presenter Color
|
|
1358
1358
|
|
|
1359
1359
|
/**
|
|
1360
1360
|
* @tokens API Reference Schemas Discriminator Dropdown
|
|
@@ -1362,8 +1362,8 @@ const apiReferenceDocs = css`
|
|
|
1362
1362
|
|
|
1363
1363
|
--schemas-discriminator-dropdown-padding: 2px 24px 2px 8px;
|
|
1364
1364
|
--schemas-discriminator-dropdown-border: 1px solid var(--border-color); // @presenter Border
|
|
1365
|
-
--schemas-discriminator-font-size: var(--dropdown-font-size); // @presenter FontSize
|
|
1366
|
-
--schemas-discriminator-dropdown-text-color: var(--dropdown-text-color); // @presenter Color
|
|
1365
|
+
--schemas-discriminator-font-size: var(--docs-dropdown-font-size); // @presenter FontSize
|
|
1366
|
+
--schemas-discriminator-dropdown-text-color: var(--docs-dropdown-text-color); // @presenter Color
|
|
1367
1367
|
|
|
1368
1368
|
/**
|
|
1369
1369
|
* @tokens API Reference Schemas Titles
|
|
@@ -1632,7 +1632,7 @@ const navbar = css`
|
|
|
1632
1632
|
--navbar-item-font-size: 16px; // @presenter FontSize
|
|
1633
1633
|
--navbar-item-padding-horizontal: 16px; // @presenter Spacing
|
|
1634
1634
|
--navbar-item-padding-vertical: 8px; // @presenter Spacing
|
|
1635
|
-
--navbar-item-
|
|
1635
|
+
--navbar-item-gap: 5px;
|
|
1636
1636
|
--navbar-item-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
1637
1637
|
--navbar-item-font-weight: var(--font-weight-bold); // @presenter FontWeight
|
|
1638
1638
|
--navbar-item-hover-background-color: var(--color-primary-300);
|
|
@@ -1672,6 +1672,17 @@ const breadcrumbs = css`
|
|
|
1672
1672
|
// @tokens End
|
|
1673
1673
|
`
|
|
1674
1674
|
|
|
1675
|
+
const product = css`
|
|
1676
|
+
/**
|
|
1677
|
+
* @tokens Product
|
|
1678
|
+
*/
|
|
1679
|
+
--product-padding-horizontal: 8px; // @presenter Spacing
|
|
1680
|
+
--product-padding-vertical: 8px; // @presenter Spacing
|
|
1681
|
+
--product-logo-margin: 10px; // @presenter Spacing
|
|
1682
|
+
|
|
1683
|
+
// @tokens End
|
|
1684
|
+
`
|
|
1685
|
+
|
|
1675
1686
|
const mobileMenu = css`
|
|
1676
1687
|
/**
|
|
1677
1688
|
* @tokens Mobile Menu icons
|
|
@@ -2022,19 +2033,170 @@ const search = css`
|
|
|
2022
2033
|
// @tokens End
|
|
2023
2034
|
`;
|
|
2024
2035
|
|
|
2025
|
-
const
|
|
2026
|
-
--dropdown-font-size: 14px;
|
|
2027
|
-
--dropdown-text-color: var(--text-color);
|
|
2036
|
+
const docsDropdown = css`
|
|
2037
|
+
--docs-dropdown-font-size: 14px;
|
|
2038
|
+
--docs-dropdown-text-color: var(--text-color);
|
|
2028
2039
|
|
|
2029
|
-
--dropdown-padding-vertical: 8px;
|
|
2030
|
-
--dropdown-padding-left: 10px;
|
|
2031
|
-
--dropdown-padding-right: 26px;
|
|
2032
|
-
--dropdown-padding: var(--dropdown-padding-vertical) var(--dropdown-padding-right)
|
|
2033
|
-
var(--dropdown-padding-vertical) var(--dropdown-padding-left);
|
|
2040
|
+
--docs-dropdown-padding-vertical: 8px;
|
|
2041
|
+
--docs-dropdown-padding-left: 10px;
|
|
2042
|
+
--docs-dropdown-padding-right: 26px;
|
|
2043
|
+
--docs-dropdown-padding: var(--docs-dropdown-padding-vertical) var(--docs-dropdown-padding-right)
|
|
2044
|
+
var(--docs-dropdown-padding-vertical) var(--docs-dropdown-padding-left);
|
|
2034
2045
|
|
|
2035
|
-
--dropdown-border: none;
|
|
2046
|
+
--docs-dropdown-border: none;
|
|
2036
2047
|
`;
|
|
2037
2048
|
|
|
2049
|
+
const dropdown = css`
|
|
2050
|
+
--dropdown-font-size: 16px; // @presenter FontSize
|
|
2051
|
+
--dropdown-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
2052
|
+
--dropdown-line-height: var(--line-height-base); // @presenter LineHeight
|
|
2053
|
+
--dropdown-text-color: var(--text-color); // @presenter Color
|
|
2054
|
+
--dropdown-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
2055
|
+
|
|
2056
|
+
--dropdown-list-min-width: 100px;
|
|
2057
|
+
--dropdown-list-max-width: 300px;
|
|
2058
|
+
--dropdown-list-padding: 4px; // @presenter Spacing
|
|
2059
|
+
--dropdown-list-border-radius: var(--border-radius-lg); // @presenter BorderRadius
|
|
2060
|
+
--dropdown-list-background-color: var(--background-color); // @presenter Color
|
|
2061
|
+
--dropdown-list-box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05), 0px 6px 16px rgba(0, 0, 0, 0.08), 0px 3px 6px -4px rgba(0, 0, 0, 0.12); // @presenter Shadow
|
|
2062
|
+
|
|
2063
|
+
--dropdown-list-item-horizontal-padding: 16px; // @presenter Spacing
|
|
2064
|
+
--dropdown-list-item-vertical-padding: 8px; // @presenter Spacing
|
|
2065
|
+
--dropdown-list-item-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
2066
|
+
--dropdown-list-item-active-background-color: #0000000a; // @presenter Color
|
|
2067
|
+
--dropdown-list-item-separator-color: var(--border-color); // @presenter Color
|
|
2068
|
+
|
|
2069
|
+
/**
|
|
2070
|
+
* @tokens User profile menu dropdown
|
|
2071
|
+
* */
|
|
2072
|
+
|
|
2073
|
+
--profile-dropdown-font-size: var(--dropdown-font-size); // @presenter FontSize
|
|
2074
|
+
--profile-dropdown-font-weight: var(--dropdown-font-weight); // @presenter FontWeight
|
|
2075
|
+
--profile-dropdown-line-height: var(--dropdown-line-height); // @presenter LineHeight
|
|
2076
|
+
--profile-dropdown-text-color: var(--dropdown-text-color); // @presenter Color
|
|
2077
|
+
--profile-dropdown-border-radius: var(--dropdown-border-radius); // @presenter BorderRadius
|
|
2078
|
+
|
|
2079
|
+
--profile-dropdown-list-min-width: var(--dropdown-list-min-width);
|
|
2080
|
+
--profile-dropdown-list-max-width: var(--dropdown-list-max-width);
|
|
2081
|
+
--profile-dropdown-list-padding: var(--dropdown-list-padding); // @presenter Spacing
|
|
2082
|
+
--profile-dropdown-list-border-radius: var(--dropdown-list-border-radius); // @presenter BorderRadius
|
|
2083
|
+
--profile-dropdown-list-background-color: var(--dropdown-list-background-color); // @presenter Color
|
|
2084
|
+
--profile-dropdown-list-box-shadow: var(--dropdown-list-box-shadow); // @presenter Shadow
|
|
2085
|
+
|
|
2086
|
+
--profile-dropdown-list-item-horizontal-padding: var(--dropdown-list-item-horizontal-padding); // @presenter Spacing
|
|
2087
|
+
--profile-dropdown-list-item-vertical-padding: var(--dropdown-list-item-vertical-padding); // @presenter Spacing
|
|
2088
|
+
--profile-dropdown-list-item-border-radius: var(--dropdown-list-item-border-radius); // @presenter BorderRadius
|
|
2089
|
+
--profile-dropdown-list-item-active-background-color: var(--dropdown-list-item-active-background-color); // @presenter Color
|
|
2090
|
+
--profile-dropdown-list-item-separator-color: var(--dropdown-list-item-separator-color); // @presenter Color
|
|
2091
|
+
`
|
|
2092
|
+
|
|
2093
|
+
const select = css`
|
|
2094
|
+
--select-font-size: 16px; // @presenter FontSize
|
|
2095
|
+
--select-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
2096
|
+
--select-line-height: var(--line-height-base); // @presenter LineHeight
|
|
2097
|
+
--select-text-color: var(--text-color); // @presenter Color
|
|
2098
|
+
--select-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
2099
|
+
|
|
2100
|
+
--select-input-padding-horizontal: 16px; // @presenter Spacing
|
|
2101
|
+
--select-input-padding-vertical: 6px; // @presenter Spacing
|
|
2102
|
+
--select-input-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
2103
|
+
|
|
2104
|
+
--select-list-min-width: 100px;
|
|
2105
|
+
--select-list-max-width: 300px;
|
|
2106
|
+
--select-list-padding: 4px; // @presenter Spacing
|
|
2107
|
+
--select-list-border-radius: var(--border-radius-lg); // @presenter BorderRadius
|
|
2108
|
+
--select-list-background-color: var(--background-color); // @presenter Color
|
|
2109
|
+
--select-list-box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05), 0px 6px 16px rgba(0, 0, 0, 0.08), 0px 3px 6px -4px rgba(0, 0, 0, 0.12);
|
|
2110
|
+
|
|
2111
|
+
--select-list-item-horizontal-padding: 16px; // @presenter Spacing
|
|
2112
|
+
--select-list-item-vertical-padding: 8px; // @presenter Spacing
|
|
2113
|
+
--select-list-item-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
2114
|
+
--select-list-item-active-background-color: #0000000a; // @presenter Color
|
|
2115
|
+
|
|
2116
|
+
/**
|
|
2117
|
+
* @tokens Version picker
|
|
2118
|
+
* */
|
|
2119
|
+
|
|
2120
|
+
--version-picker-font-size: var(--font-size-base); // @presenter FontSize
|
|
2121
|
+
--version-picker-font-weight: var(--select-font-weight); // @presenter FontWeight
|
|
2122
|
+
--version-picker-line-height: var(--select-line-height); // @presenter LineHeight
|
|
2123
|
+
--version-picker-text-color: var(--select-text-color); // @presenter Color
|
|
2124
|
+
--version-picker-border-radius: var(--select-border-radius); // @presenter BorderRadius
|
|
2125
|
+
--version-picker-margin-vertical: 10px; // @presenter Spacing
|
|
2126
|
+
--version-picker-margin-horizontal: 15px; // @presenter Spacing
|
|
2127
|
+
|
|
2128
|
+
--version-picker-input-padding-horizontal: var(--select-input-padding-horizontal); // @presenter Spacing
|
|
2129
|
+
--version-picker-input-padding-vertical: var(--select-input-padding-vertical); // @presenter Spacing
|
|
2130
|
+
--version-picker-input-border: 1px solid var(--border-color); // @presenter Border
|
|
2131
|
+
--version-picker-input-border-radius: var(--select-input-border-radius); // @presenter BorderRadius
|
|
2132
|
+
|
|
2133
|
+
--version-picker-list-min-width: var(--select-list-min-width);
|
|
2134
|
+
--version-picker-list-max-width: var(--select-list-max-width);
|
|
2135
|
+
--version-picker-list-padding: var(--select-list-padding); // @presenter Spacing
|
|
2136
|
+
--version-picker-list-border-radius: var(--select-list-border-radius); // @presenter BorderRadius
|
|
2137
|
+
--version-picker-list-background-color: var(--select-list-background-color); // @presenter Color
|
|
2138
|
+
--version-picker-list-box-shadow: var(--select-list-box-shadow); // @presenter Shadow
|
|
2139
|
+
|
|
2140
|
+
--version-picker-list-item-horizontal-padding: var(--select-list-item-horizontal-padding); // @presenter Spacing
|
|
2141
|
+
--version-picker-list-item-vertical-padding: var(--select-list-item-vertical-padding); // @presenter Spacing
|
|
2142
|
+
--version-picker-list-item-border-radius: var(--select-list-item-border-radius); // @presenter BorderRadius
|
|
2143
|
+
--version-picker-list-item-active-background-color: var(--select-list-item-active-background-color); // @presenter Color
|
|
2144
|
+
|
|
2145
|
+
|
|
2146
|
+
/**
|
|
2147
|
+
* @tokens Language picker
|
|
2148
|
+
* */
|
|
2149
|
+
|
|
2150
|
+
--language-picker-font-size: var(--select-font-size); // @presenter FontSize
|
|
2151
|
+
--language-picker-font-weight: var(--select-font-weight); // @presenter FontWeight
|
|
2152
|
+
--language-picker-line-height: var(--select-line-height); // @presenter LineHeight
|
|
2153
|
+
--language-picker-text-color: var(--select-text-color); // @presenter Color
|
|
2154
|
+
--language-picker-border-radius: var(--select-border-radius); // @presenter BorderRadius
|
|
2155
|
+
|
|
2156
|
+
--language-picker-input-padding-horizontal: var(--select-input-padding-horizontal); // @presenter Spacing
|
|
2157
|
+
--language-picker-input-padding-vertical: var(--select-input-padding-vertical); // @presenter Spacing
|
|
2158
|
+
--language-picker-input-border-radius: var(--select-input-border-radius); // @presenter BorderRadius
|
|
2159
|
+
|
|
2160
|
+
--language-picker-list-min-width: var(--select-list-min-width);
|
|
2161
|
+
--language-picker-list-max-width: var(--select-list-max-width);
|
|
2162
|
+
--language-picker-list-padding: var(--select-list-padding); // @presenter Spacing
|
|
2163
|
+
--language-picker-list-border-radius: var(--select-list-border-radius); // @presenter BorderRadius
|
|
2164
|
+
--language-picker-list-background-color: var(--select-list-background-color); // @presenter Color
|
|
2165
|
+
--language-picker-list-box-shadow: var(--select-list-box-shadow); // @presenter Shadow
|
|
2166
|
+
|
|
2167
|
+
--language-picker-list-item-horizontal-padding: var(--select-list-item-horizontal-padding); // @presenter Spacing
|
|
2168
|
+
--language-picker-list-item-vertical-padding: var(--select-list-item-vertical-padding); // @presenter Spacing
|
|
2169
|
+
--language-picker-list-item-border-radius: var(--select-list-item-border-radius); // @presenter BorderRadius
|
|
2170
|
+
--language-picker-list-item-active-background-color: var(--select-list-item-active-background-color); // @presenter Color
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* @tokens Product picker
|
|
2174
|
+
* */
|
|
2175
|
+
|
|
2176
|
+
--product-picker-font-size: var(--select-font-size); // @presenter FontSize
|
|
2177
|
+
--product-picker-font-weight: var(--select-font-weight); // @presenter FontWeight
|
|
2178
|
+
--product-picker-line-height: var(--select-line-height); // @presenter LineHeight
|
|
2179
|
+
--product-picker-text-color: var(--select-text-color); // @presenter Color
|
|
2180
|
+
--product-picker-border-radius: var(--select-border-radius); // @presenter BorderRadius
|
|
2181
|
+
|
|
2182
|
+
--product-picker-input-padding-horizontal: var(--select-input-padding-horizontal); // @presenter Spacing
|
|
2183
|
+
--product-picker-input-padding-vertical: var(--select-input-padding-vertical); // @presenter Spacing
|
|
2184
|
+
--product-picker-input-border-radius: var(--select-input-border-radius); // @presenter BorderRadius
|
|
2185
|
+
|
|
2186
|
+
--product-picker-list-min-width: var(--select-list-min-width);
|
|
2187
|
+
--product-picker-list-max-width: var(--select-list-max-width);
|
|
2188
|
+
--product-picker-list-padding: var(--select-list-padding); // @presenter Spacing
|
|
2189
|
+
--product-picker-list-border-radius: var(--select-list-border-radius); // @presenter BorderRadius
|
|
2190
|
+
--product-picker-list-background-color: var(--select-list-background-color); // @presenter Color
|
|
2191
|
+
--product-picker-list-box-shadow: var(--select-list-box-shadow); // @presenter Shadow
|
|
2192
|
+
|
|
2193
|
+
--product-picker-list-item-horizontal-padding: var(--select-list-item-horizontal-padding); // @presenter Spacing
|
|
2194
|
+
--product-picker-list-item-vertical-padding: var(--select-list-item-vertical-padding); // @presenter Spacing
|
|
2195
|
+
--product-picker-list-item-border-radius: var(--select-list-item-border-radius); // @presenter BorderRadius
|
|
2196
|
+
--product-picker-list-item-active-background-color: var(--select-list-item-active-background-color); // @presenter Color
|
|
2197
|
+
`;
|
|
2198
|
+
|
|
2199
|
+
|
|
2038
2200
|
const lastUpdated = css`
|
|
2039
2201
|
--last-updated-text-color: var(--text-color);
|
|
2040
2202
|
--last-updated-font-size: var(--font-size-small);
|
|
@@ -2190,6 +2352,7 @@ export const styles = css`
|
|
|
2190
2352
|
${logo}
|
|
2191
2353
|
${badges}
|
|
2192
2354
|
${breadcrumbs}
|
|
2355
|
+
${product}
|
|
2193
2356
|
${toc}
|
|
2194
2357
|
${inputs}
|
|
2195
2358
|
${tooltip}
|
|
@@ -2198,6 +2361,8 @@ export const styles = css`
|
|
|
2198
2361
|
${markdown}
|
|
2199
2362
|
${search}
|
|
2200
2363
|
${dropdown}
|
|
2364
|
+
${docsDropdown}
|
|
2365
|
+
${select}
|
|
2201
2366
|
${apiReferencePanels}
|
|
2202
2367
|
${apiReferenceDocs}
|
|
2203
2368
|
${lastUpdated}
|
|
@@ -2,9 +2,24 @@ import { createContext, useContext } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type { ThemeUIConfig } from '@theme';
|
|
4
4
|
|
|
5
|
+
import { useCurrentProduct } from '@portal/hooks';
|
|
6
|
+
|
|
5
7
|
export const ThemeConfigContext = createContext<ThemeUIConfig>({} as ThemeUIConfig);
|
|
6
8
|
|
|
7
|
-
export function useThemeConfig<T extends Record<string, unknown>>(
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
export function useThemeConfig<T extends Record<string, unknown>>(
|
|
10
|
+
useProductConfig: boolean = true,
|
|
11
|
+
): T & NonNullable<ThemeUIConfig> {
|
|
12
|
+
const themeConfig = (useContext(ThemeConfigContext) as T & NonNullable<ThemeUIConfig>) || {};
|
|
13
|
+
|
|
14
|
+
const currentProduct = useCurrentProduct();
|
|
15
|
+
|
|
16
|
+
const mergedTheme =
|
|
17
|
+
useProductConfig && currentProduct?.themeOverride
|
|
18
|
+
? {
|
|
19
|
+
...themeConfig,
|
|
20
|
+
...currentProduct.themeOverride,
|
|
21
|
+
}
|
|
22
|
+
: themeConfig;
|
|
23
|
+
|
|
24
|
+
return mergedTheme;
|
|
10
25
|
}
|
package/src/mocks/hooks/index.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import type { ThemeUIConfig } from '@theme/config';
|
|
1
|
+
import type { CatalogConfig, ProductUiConfig, ThemeUIConfig } from '@theme/config';
|
|
2
2
|
import type { ResolvedNavItem, TFunction, Version } from '@theme/types/portal';
|
|
3
|
-
import type {
|
|
3
|
+
import type { FilteredCatalog } from '@theme/types/portal/src/shared/types/catalog';
|
|
4
4
|
interface PageLink {
|
|
5
5
|
label: string;
|
|
6
6
|
link: string;
|
|
7
7
|
type: 'link';
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function useThemeConfig<T extends Record<string, unknown>>(
|
|
10
|
+
export function useThemeConfig<T extends Record<string, unknown>>(
|
|
11
|
+
_useProductConfig: boolean = true,
|
|
12
|
+
): T & ThemeUIConfig {
|
|
11
13
|
return {
|
|
12
14
|
search: {
|
|
13
15
|
hide: false,
|
|
@@ -96,6 +98,10 @@ export function useI18nConfig() {
|
|
|
96
98
|
};
|
|
97
99
|
}
|
|
98
100
|
|
|
101
|
+
export function useCurrentProduct(): ProductUiConfig | undefined {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
99
105
|
export function usePageVersions(): { versions: Version[] } {
|
|
100
106
|
return {
|
|
101
107
|
versions: [
|
package/src/mocks/search.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CatalogFilterConfig } from "@theme/config";
|
|
2
2
|
|
|
3
3
|
export type FilteredCatalog = {
|
|
4
4
|
groups: { title: string; items: CatalogItem[] }[];
|
|
@@ -7,31 +7,7 @@ export type FilteredCatalog = {
|
|
|
7
7
|
setFilterTerm: (term: string) => void;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export type
|
|
11
|
-
type?: 'select' | 'checkboxes' | 'date-range';
|
|
12
|
-
title: string;
|
|
13
|
-
titleTranslationKey?: string;
|
|
14
|
-
property: string;
|
|
15
|
-
parentFilter?: string;
|
|
16
|
-
missingCategoryName?: string;
|
|
17
|
-
missingCategoryNameTranslationKey?: string;
|
|
18
|
-
options?: string[];
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type CatalogConfig = {
|
|
22
|
-
slug: string;
|
|
23
|
-
filters: Filter[];
|
|
24
|
-
groupByFirstFilter: boolean;
|
|
25
|
-
items: NavItem[];
|
|
26
|
-
requiredPermission?: string;
|
|
27
|
-
separateVersions?: boolean;
|
|
28
|
-
title?: string;
|
|
29
|
-
titleTranslationKey?: string;
|
|
30
|
-
description?: string;
|
|
31
|
-
descriptionTranslationKey?: string;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type ResolvedFilter = Omit<Filter, 'options'> & {
|
|
10
|
+
export type ResolvedFilter = Omit<CatalogFilterConfig, 'options'> & {
|
|
35
11
|
options: {
|
|
36
12
|
value: string;
|
|
37
13
|
count: number;
|