@redocly/theme 0.65.0-next.1 → 0.65.0-next.2

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.
Files changed (43) hide show
  1. package/lib/components/Button/variables.js +3 -3
  2. package/lib/components/CodeBlock/CodeBlockContainer.js +12 -7
  3. package/lib/components/CodeBlock/variables.dark.d.ts +1 -0
  4. package/lib/components/CodeBlock/variables.dark.js +8 -0
  5. package/lib/components/CodeBlock/variables.js +3 -1
  6. package/lib/components/Menu/MenuItem.js +15 -26
  7. package/lib/components/Menu/variables.dark.js +2 -0
  8. package/lib/components/Menu/variables.js +3 -1
  9. package/lib/components/PageNavigation/NavigationButton.js +19 -11
  10. package/lib/components/PageNavigation/PageNavigation.js +6 -0
  11. package/lib/components/PageNavigation/variables.d.ts +1 -0
  12. package/lib/components/PageNavigation/variables.js +27 -0
  13. package/lib/components/Search/variables.js +2 -2
  14. package/lib/core/hooks/use-modal-scroll-lock.js +21 -10
  15. package/lib/core/hooks/use-page-actions.js +43 -24
  16. package/lib/core/styles/dark.js +2 -0
  17. package/lib/core/styles/global.js +9 -5
  18. package/lib/core/styles/palette.dark.js +2 -0
  19. package/lib/core/styles/palette.js +16 -0
  20. package/lib/core/types/catalog.d.ts +1 -1
  21. package/lib/icons/LinkIcon/LinkIcon.js +6 -6
  22. package/lib/markdoc/components/Heading/Heading.js +7 -1
  23. package/package.json +2 -2
  24. package/src/components/Button/variables.ts +3 -3
  25. package/src/components/CodeBlock/CodeBlockContainer.tsx +12 -7
  26. package/src/components/CodeBlock/variables.dark.ts +5 -0
  27. package/src/components/CodeBlock/variables.ts +3 -1
  28. package/src/components/Menu/MenuItem.tsx +15 -26
  29. package/src/components/Menu/variables.dark.ts +2 -0
  30. package/src/components/Menu/variables.ts +3 -1
  31. package/src/components/PageNavigation/NavigationButton.tsx +24 -22
  32. package/src/components/PageNavigation/PageNavigation.tsx +6 -0
  33. package/src/components/PageNavigation/variables.ts +24 -0
  34. package/src/components/Search/variables.ts +2 -2
  35. package/src/core/hooks/use-modal-scroll-lock.ts +30 -14
  36. package/src/core/hooks/use-page-actions.ts +70 -33
  37. package/src/core/styles/dark.ts +2 -0
  38. package/src/core/styles/global.ts +9 -5
  39. package/src/core/styles/palette.dark.ts +2 -0
  40. package/src/core/styles/palette.ts +16 -0
  41. package/src/core/types/catalog.ts +1 -1
  42. package/src/icons/LinkIcon/LinkIcon.tsx +19 -6
  43. package/src/markdoc/components/Heading/Heading.tsx +7 -1
@@ -7,17 +7,17 @@ exports.LinkIcon = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const utils_1 = require("../../core/utils");
10
- const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
11
- react_1.default.createElement("path", { d: "M14.625 3.37992C14.3463 3.10024 14.0151 2.87833 13.6505 2.72692C13.2858 2.5755 12.8949 2.49756 12.5 2.49756C12.1052 2.49756 11.7142 2.5755 11.3496 2.72692C10.9849 2.87833 10.6537 3.10024 10.375 3.37992L11.085 4.08992C11.2712 3.90378 11.4922 3.75611 11.7354 3.65537C11.9786 3.55463 12.2393 3.50278 12.5025 3.50278C12.7658 3.50278 13.0264 3.55463 13.2697 3.65537C13.5129 3.75611 13.7339 3.90378 13.92 4.08992C14.1062 4.27607 14.2538 4.49706 14.3546 4.74028C14.4553 4.98349 14.5072 5.24417 14.5072 5.50742C14.5072 5.77068 14.4553 6.03135 14.3546 6.27457C14.2538 6.51778 14.1062 6.73878 13.92 6.92492L9.92002 10.9249C9.54473 11.3009 9.03548 11.5123 8.50428 11.5128C7.97309 11.5133 7.46346 11.3027 7.08752 10.9274C6.71157 10.5521 6.5001 10.0429 6.49964 9.51169C6.49917 8.98049 6.70973 8.47087 7.08502 8.09492L7.79002 7.38492L7.08502 6.67492L6.37502 7.38492C6.09534 7.66363 5.87343 7.99481 5.72201 8.35947C5.57059 8.72412 5.49265 9.11508 5.49265 9.50992C5.49265 9.90477 5.57059 10.2957 5.72201 10.6604C5.87343 11.025 6.09534 11.3562 6.37502 11.6349C6.94076 12.1934 7.70505 12.5045 8.50002 12.4999C8.89637 12.5016 9.28913 12.4246 9.65558 12.2736C10.022 12.1225 10.3549 11.9004 10.635 11.6199L14.635 7.61992C15.1955 7.0561 15.5093 6.29286 15.5074 5.49785C15.5055 4.70285 15.1881 3.9411 14.625 3.37992Z" }),
12
- react_1.default.createElement("path", { d: "M2.09502 12.4099C1.90831 12.2241 1.76016 12.0032 1.65907 11.7599C1.55798 11.5167 1.50593 11.2559 1.50593 10.9924C1.50593 10.729 1.55798 10.4682 1.65907 10.2249C1.76016 9.98165 1.90831 9.76076 2.09502 9.57492L6.09502 5.57492C6.28085 5.38822 6.50174 5.24007 6.745 5.13898C6.98826 5.03788 7.24909 4.98584 7.51252 4.98584C7.77594 4.98584 8.03677 5.03788 8.28003 5.13898C8.52329 5.24007 8.74418 5.38822 8.93002 5.57492C9.11554 5.76222 9.26158 5.98486 9.35949 6.22963C9.4574 6.47441 9.50519 6.73634 9.50002 6.99992C9.50154 7.26433 9.45062 7.52641 9.35021 7.771C9.2498 8.0156 9.10188 8.23786 8.91502 8.42492L7.85502 9.49992L8.56501 10.2099L9.62502 9.14992C10.1893 8.58568 10.5063 7.82039 10.5063 7.02242C10.5063 6.22446 10.1893 5.45917 9.62502 4.89492C9.06077 4.33068 8.29548 4.01368 7.49752 4.01368C6.69955 4.01368 5.93426 4.33068 5.37002 4.89492L1.37002 8.89492C1.08958 9.17373 0.867037 9.50522 0.715177 9.87033C0.563316 10.2354 0.485138 10.627 0.485138 11.0224C0.485138 11.4179 0.563316 11.8094 0.715177 12.1745C0.867037 12.5396 1.08958 12.8711 1.37002 13.1499C1.93943 13.7042 2.70546 14.0099 3.50002 13.9999C4.30157 14.0007 5.07087 13.6843 5.64002 13.1199L4.93002 12.4099C4.74418 12.5966 4.52329 12.7448 4.28003 12.8459C4.03677 12.947 3.77594 12.999 3.51252 12.999C3.24909 12.999 2.98826 12.947 2.745 12.8459C2.50174 12.7448 2.28085 12.5966 2.09502 12.4099Z" })));
10
+ const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
11
+ react_1.default.createElement("path", { d: "M0 4C0 1.79086 1.79086 0 4 0H16C18.2091 0 20 1.79086 20 4V16C20 18.2091 18.2091 20 16 20H4C1.79086 20 0 18.2091 0 16V4Z", fill: "var(--layer-color)" }),
12
+ react_1.default.createElement("path", { d: "M7.37318 9.56229H12.6232C12.7392 9.56229 12.8505 9.60838 12.9325 9.69043C13.0146 9.77247 13.0607 9.88375 13.0607 9.99979C13.0607 10.1158 13.0146 10.2271 12.9325 10.3091C12.8505 10.3912 12.7392 10.4373 12.6232 10.4373H7.37318C7.25714 10.4373 7.14586 10.3912 7.06382 10.3091C6.98177 10.2271 6.93568 10.1158 6.93568 9.99979C6.93568 9.88375 6.98177 9.77247 7.06382 9.69043C7.14586 9.60838 7.25714 9.56229 7.37318 9.56229ZM8.6853 12.1875H6.4978C5.91764 12.1875 5.36124 11.957 4.95101 11.5468C4.54077 11.1366 4.3103 10.5802 4.3103 10C4.3103 9.41984 4.54077 8.86344 4.95101 8.4532C5.36124 8.04297 5.91764 7.8125 6.4978 7.8125H8.6853C8.80133 7.8125 8.91262 7.76641 8.99466 7.68436C9.07671 7.60231 9.1228 7.49103 9.1228 7.375C9.1228 7.25897 9.07671 7.14769 8.99466 7.06564C8.91262 6.98359 8.80133 6.9375 8.6853 6.9375H6.4978C5.68558 6.9375 4.90662 7.26016 4.33229 7.83449C3.75796 8.40882 3.4353 9.18777 3.4353 10C3.4353 10.8122 3.75796 11.5912 4.33229 12.1655C4.90662 12.7398 5.68558 13.0625 6.4978 13.0625H8.6853C8.80133 13.0625 8.91262 13.0164 8.99466 12.9344C9.07671 12.8523 9.1228 12.741 9.1228 12.625C9.1228 12.509 9.07671 12.3977 8.99466 12.3156C8.91262 12.2336 8.80133 12.1875 8.6853 12.1875ZM13.4982 6.9375H11.3107C11.1946 6.9375 11.0834 6.98359 11.0013 7.06564C10.9193 7.14769 10.8732 7.25897 10.8732 7.375C10.8732 7.49103 10.9193 7.60231 11.0013 7.68436C11.0834 7.76641 11.1946 7.8125 11.3107 7.8125H13.4982C14.0783 7.8125 14.6347 8.04297 15.045 8.4532C15.4552 8.86344 15.6857 9.41984 15.6857 10C15.6857 10.5802 15.4552 11.1366 15.045 11.5468C14.6347 11.957 14.0783 12.1875 13.4982 12.1875H11.3107C11.1946 12.1875 11.0834 12.2336 11.0013 12.3156C10.9193 12.3977 10.8732 12.509 10.8732 12.625C10.8732 12.741 10.9193 12.8523 11.0013 12.9344C11.0834 13.0164 11.1946 13.0625 11.3107 13.0625H13.4982C14.3104 13.0625 15.0894 12.7398 15.6637 12.1655C16.238 11.5912 16.5607 10.8122 16.5607 10C16.5607 9.18777 16.238 8.40882 15.6637 7.83449C15.0894 7.26016 14.3104 6.9375 13.4982 6.9375Z", fill: "var(--icon-color-primary)" })));
13
13
  exports.LinkIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
14
14
  'data-component-name': 'icons/LinkIcon/LinkIcon',
15
15
  })) `
16
- path {
16
+ path:last-of-type {
17
17
  fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
18
18
  }
19
19
 
20
- height: ${({ size }) => size || '16px'};
21
- width: ${({ size }) => size || '16px'};
20
+ height: ${({ size }) => size || '20px'};
21
+ width: ${({ size }) => size || '20px'};
22
22
  `;
23
23
  //# sourceMappingURL=LinkIcon.js.map
@@ -76,7 +76,7 @@ function Heading({ level, id, children, 'data-source': dataSource, 'data-hash':
76
76
  const pageProps = usePageProps();
77
77
  const isMarkdownPage = ((_a = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _a === void 0 ? void 0 : _a.type) === 'markdown' || ((_b = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _b === void 0 ? void 0 : _b.type) === 'asciidoc';
78
78
  const linkEl = (react_1.default.createElement("a", { "aria-label": `link to ${id}`, href: `#${id}`, className: (0, utils_1.concatClassNames)('anchor', 'before') },
79
- react_1.default.createElement(LinkIcon_1.LinkIcon, { size: "14px", color: "--heading-anchor-color" })));
79
+ react_1.default.createElement(LinkIcon_1.LinkIcon, { color: "--heading-anchor-color" })));
80
80
  return (0, react_1.createElement)(`h${level}`, {
81
81
  id,
82
82
  className: (0, utils_1.concatClassNames)('heading-anchor', mdClassName, className),
@@ -92,6 +92,12 @@ const HeadingContentWrapper = styled_components_1.default.div `
92
92
  display: flex;
93
93
  gap: var(--spacing-xs);
94
94
 
95
+ & > .anchor {
96
+ display: flex;
97
+ align-items: center;
98
+ height: 1lh;
99
+ }
100
+
95
101
  & > span {
96
102
  display: flex;
97
103
  align-items: flex-start;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.65.0-next.1",
3
+ "version": "0.65.0-next.2",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -63,7 +63,7 @@
63
63
  "vitest": "4.0.10",
64
64
  "vitest-when": "0.6.2",
65
65
  "webpack": "5.105.2",
66
- "@redocly/realm-asyncapi-sdk": "0.11.0-next.1"
66
+ "@redocly/realm-asyncapi-sdk": "0.11.0-next.2"
67
67
  },
68
68
  "dependencies": {
69
69
  "@tanstack/react-query": "5.62.3",
@@ -47,9 +47,9 @@ export const button = css`
47
47
  --button-content-color-custom-hover: var(--color-warm-grey-11); // @presenter Color
48
48
  --button-bg-color-custom: var(--color-white); // @presenter Color
49
49
 
50
- --button-content-color-link: var(--link-color-primary);
51
- --button-content-color-link-hover: var(--link-color-primary-hover);
52
- --button-content-color-link-pressed: var(--link-color-primary-pressed);
50
+ --button-content-color-link: var(--color-primary-base, var(--button-content-color-link-legacy));
51
+ --button-content-color-link-hover: var(--color-primary-active, var(--button-content-color-link-hover-legacy));
52
+ --button-content-color-link-pressed: var(--color-primary-base, var(--button-content-color-link-pressed-legacy));
53
53
 
54
54
  /**
55
55
  * @tokens Button default values
@@ -47,18 +47,21 @@ const CodeBlockContainerComponent = styled.pre<CodeBlockContainerProps>`
47
47
  }
48
48
 
49
49
  .highlighted {
50
- background: var(--layer-color-hover);
50
+ background: var(--code-block-highlighted-bg-color);
51
51
  margin-left: calc(var(--spacing-sm) * -1);
52
52
  padding-left: var(--spacing-sm);
53
53
  width: calc(100% + var(--spacing-sm));
54
54
  display: inline-block;
55
+ border-left: var(--code-block-highlighted-border-left);
55
56
 
56
57
  &.error {
57
- background: var(--color-raspberry-2);
58
+ background: var(--color-error-bg);
59
+ border-left: 1px solid var(--color-error-base);
58
60
  }
59
61
 
60
62
  &.warning {
61
- background: var(--color-carrot-2);
63
+ background: var(--color-warning-bg);
64
+ border-left: 1px solid var(--color-warning-base);
62
65
  }
63
66
  }
64
67
 
@@ -97,18 +100,20 @@ const CodeBlockContainerComponent = styled.pre<CodeBlockContainerProps>`
97
100
  display: inline-block;
98
101
 
99
102
  &.add {
100
- background: var(--color-grass-2);
103
+ background: var(--color-success-bg);
104
+ border-left: 1px solid var(--color-success-base);
101
105
  &:before {
102
106
  content: attr(data-line-number) ' +';
103
- color: var(--color-grass-7);
107
+ color: var(--color-success-active);
104
108
  }
105
109
  }
106
110
  &.remove {
107
- background: var(--color-raspberry-2);
111
+ background: var(--color-error-bg);
112
+ border-left: 1px solid var(--color-error-base);
108
113
 
109
114
  &:before {
110
115
  content: attr(data-line-number) ' -';
111
- color: var(--color-raspberry-7);
116
+ color: var(--color-error-active);
112
117
  }
113
118
  }
114
119
  }
@@ -0,0 +1,5 @@
1
+ import { css } from 'styled-components';
2
+
3
+ export const codeBlockDarkMode = css`
4
+ --code-block-highlighted-bg-color: var(--color-brand-subtle-2, var(--code-block-highlighted-bg-color-legacy)); // @presenter Color
5
+ `;
@@ -60,6 +60,8 @@ export const code = css`
60
60
  --code-block-margin: 0;
61
61
  --code-block-max-height: calc(100vh - 300px); // Where 300 is combined value of navbar, code block heading, controls height and paddings
62
62
  --code-block-word-break: initial;
63
+ --code-block-highlighted-border-left: 1px solid var(--color-primary-base, var(--color-warm-grey-11)); // @presenter Color
64
+ --code-block-highlighted-bg-color: var(--color-primary-bg, var(--code-block-highlighted-bg-color-legacy)); // @presenter Color
63
65
 
64
66
  /**
65
67
  * @tokens Code Block controls
@@ -91,7 +93,7 @@ export const code = css`
91
93
  --code-block-tokens-constant-color: var(--code-block-tokens-default-color); // @presenter Color
92
94
  --code-block-tokens-symbol-color: var(--code-block-tokens-default-color); // @presenter Color
93
95
  --code-block-tokens-boolean-color: var(--color-green-7); // @presenter Color
94
- --code-block-tokens-string-color: var(--color-blue-7); // @presenter Color
96
+ --code-block-tokens-string-color: var(--color-primary-active, var(--code-block-tokens-string-color-legacy)); // @presenter Color
95
97
  --code-block-tokens-property-string-color: var(--color-blue-7); // @presenter Color
96
98
  --code-block-tokens-selector-color: var(--code-block-tokens-string-color); // @presenter Color
97
99
  --code-block-tokens-attr-name-color: var(--code-block-tokens-string-color); // @presenter Color
@@ -256,7 +256,7 @@ const MenuItemNestedWrapper = styled.div<{
256
256
  (var(--menu-item-label-chevron-size) / 2 - 1px) +
257
257
  var(--menu-item-nested-offset) * ${depth})
258
258
  `};
259
- border: 0.5px solid var(--border-color-primary);
259
+ border: 0.5px solid var(--menu-item-border-color-hover);
260
260
  }
261
261
  `;
262
262
 
@@ -286,6 +286,18 @@ const MenuItemLabelWrapper = styled.li<{
286
286
  ${depth ? 'var(--menu-item-nested-offset) * ' + depth : '0px'}
287
287
  )`};
288
288
 
289
+ &:hover {
290
+ color: var(--menu-item-color-hover);
291
+ background: var(--menu-item-bg-color-hover);
292
+
293
+ ${ChevronDownIcon} path {
294
+ fill: var(--menu-item-color-hover);
295
+ }
296
+ ${ChevronRightIcon} path {
297
+ fill: var(--menu-item-color-hover);
298
+ }
299
+ }
300
+
289
301
  ${({ active, deprecated }) =>
290
302
  active &&
291
303
  css`
@@ -301,7 +313,8 @@ const MenuItemLabelWrapper = styled.li<{
301
313
  }
302
314
 
303
315
  &:hover {
304
- background: var(--menu-item-bg-color-active);
316
+ color: var(--menu-item-color-active-hover);
317
+ background: var(--menu-item-bg-color-active-hover);
305
318
  }
306
319
  `};
307
320
 
@@ -315,30 +328,6 @@ const MenuItemLabelWrapper = styled.li<{
315
328
  }
316
329
  `};
317
330
 
318
- &:hover {
319
- color: var(--menu-item-color-hover);
320
- background: var(--menu-item-bg-color-hover);
321
-
322
- ${ChevronDownIcon} path {
323
- fill: var(--menu-item-color-hover);
324
- }
325
- ${ChevronRightIcon} path {
326
- fill: var(--menu-item-color-hover);
327
- }
328
- }
329
-
330
- &:active {
331
- color: var(--menu-item-color-active);
332
- background: var(--menu-item-bg-color-active);
333
-
334
- ${ChevronDownIcon} path {
335
- fill: var(--menu-item-color-active);
336
- }
337
- ${ChevronRightIcon} path {
338
- fill: var(--menu-item-color-active);
339
- }
340
- }
341
-
342
331
  &:empty {
343
332
  padding: 0;
344
333
  }
@@ -7,4 +7,6 @@ export const menuDarkMode = css`
7
7
  --menu-content-color-disabled: var(--text-color-disabled); // @presenter Color
8
8
 
9
9
  --menu-item-bg-color-active: var(--color-primary-bg, var(--menu-item-bg-color-active-legacy)); // @presenter Color
10
+
11
+ --menu-item-border-color-hover: color-mix(in srgb, var(--color-black) 8%, transparent); // @presenter Color
10
12
  `;
@@ -33,7 +33,9 @@ export const menu = css`
33
33
 
34
34
  --menu-item-color-hover: var(--tree-content-color-hover); // @presenter Color
35
35
  --menu-item-color-active: var(--color-primary-text, var(--menu-item-color-active-legacy)); // @presenter Color
36
-
36
+ --menu-item-color-active-hover: var(--color-primary-text, var(--menu-item-color-active-hover-legacy)); // @presenter Color
37
+ --menu-item-bg-color-active-hover: var(--color-primary-bg, var(--menu-item-bg-color-active-hover-legacy)); // @presenter Color
38
+ --menu-item-border-color-hover: color-mix(in srgb, var(--color-warm-grey-11) 6%, transparent); // @presenter Color
37
39
  /**
38
40
  * @tokens Menu item spacing
39
41
  * @presenter Spacing
@@ -4,8 +4,8 @@ import styled from 'styled-components';
4
4
  import type { JSX } from 'react';
5
5
 
6
6
  import { ArrowRightIcon } from '@redocly/theme/icons/ArrowRightIcon/ArrowRightIcon';
7
- import { Button } from '@redocly/theme/components/Button/Button';
8
7
  import { ArrowLeftIcon } from '@redocly/theme/icons/ArrowLeftIcon/ArrowLeftIcon';
8
+ import { Button } from '@redocly/theme/components/Button/Button';
9
9
 
10
10
  type NavigationButtonPosition = 'left' | 'right';
11
11
 
@@ -34,35 +34,37 @@ export function NavigationButton({
34
34
  data-translation-key={translationKey}
35
35
  position={position}
36
36
  >
37
- <NavigationButtonLabel>{text}</NavigationButtonLabel>
38
- <StyledNavigationButton
39
- size="large"
40
- to={link}
41
- extraClass={className}
42
- variant="link"
43
- icon={icon}
44
- iconPosition={position}
45
- >
46
- {label}
47
- </StyledNavigationButton>
37
+ <PageNavigationTitle>{label}</PageNavigationTitle>
38
+ <Button to={link} extraClass={className} variant="link" icon={icon} iconPosition={position}>
39
+ {text}
40
+ </Button>
48
41
  </NavigationButtonWrapper>
49
42
  );
50
43
  }
51
44
 
52
- const NavigationButtonWrapper = styled.div<{ position: NavigationButtonPosition }>`
45
+ const NavigationButtonWrapper = styled.div<{
46
+ position: NavigationButtonPosition;
47
+ }>`
53
48
  display: flex;
54
49
  flex-direction: column;
50
+ width: var(--page-navigation-button-width);
55
51
  text-align: ${({ position }) => position};
56
- `;
52
+ padding: var(--page-navigation-button-padding);
53
+ gap: var(--page-navigation-button-gap);
54
+ border: var(--page-navigation-button-border);
55
+ border-radius: var(--page-navigation-button-border-radius);
56
+ min-width: var(--page-navigation-button-min-width);
57
57
 
58
- const StyledNavigationButton = styled(Button)`
59
- text-wrap: wrap;
60
- padding-left: 0;
61
- padding-right: 0;
58
+ &:hover {
59
+ border: var(--page-navigation-button-border-hover);
60
+ }
62
61
  `;
63
62
 
64
- const NavigationButtonLabel = styled.span`
65
- font-size: var(--font-size-sm);
66
- line-height: var(--line-height-sm);
67
- font-weight: var(--font-weight-regular);
63
+ const PageNavigationTitle = styled.p`
64
+ font-size: var(--page-navigation-button-title-font-size);
65
+ font-weight: var(--page-navigation-button-title-font-weight);
66
+ line-height: var(--page-navigation-button-title-line-height);
67
+ color: var(--page-navigation-button-title-color);
68
+ text-wrap: wrap;
69
+ margin: 0;
68
70
  `;
@@ -4,6 +4,7 @@ import styled from 'styled-components';
4
4
  import type { JSX } from 'react';
5
5
  import type { ResolvedNavItemWithLink } from '@redocly/config';
6
6
 
7
+ import { breakpoints } from '@redocly/theme/core/utils';
7
8
  import { useThemeConfig } from '@redocly/theme/core/hooks';
8
9
  import { NextButton } from '@redocly/theme/components/PageNavigation/NextButton';
9
10
  import { PreviousButton } from '@redocly/theme/components/PageNavigation/PreviousButton';
@@ -41,8 +42,13 @@ const PageNavigationWrapper = styled.div`
41
42
  justify-content: space-between;
42
43
  margin: 25px 0;
43
44
  width: 100%;
45
+ gap: var(--page-navigations-wrapper-gap);
44
46
 
45
47
  @media print {
46
48
  display: none;
47
49
  }
50
+
51
+ @media screen and (max-width: ${breakpoints.small}) {
52
+ flex-direction: column;
53
+ }
48
54
  `;
@@ -0,0 +1,24 @@
1
+ import { css } from 'styled-components';
2
+
3
+ export const pageNavigation = css`
4
+ /**
5
+ * @tokens Page Navigation
6
+ */
7
+
8
+ --page-navigations-wrapper-gap: var(--spacing-base); // @presenter Spacing
9
+
10
+ --page-navigation-button-width: var(--container-max-width); // @presenter Width
11
+ --page-navigation-button-padding: var(--spacing-sm) var(--spacing-base); // @presenter Spacing
12
+ --page-navigation-button-title-font-size: var(--font-size-lg); // @presenter FontSize
13
+ --page-navigation-button-title-font-weight: var(--font-weight-medium); // @presenter FontWeight
14
+ --page-navigation-button-title-line-height: var(--line-height-lg); // @presenter LineHeight
15
+ --page-navigation-button-title-color: var(--text-color-primary); // @presenter Color
16
+ --page-navigation-button-gap: var(--spacing-xxs); // @presenter Spacing
17
+ --page-navigation-button-border-radius: var(--border-radius-xl); // @presenter BorderRadius
18
+ --page-navigation-button-border-color: var(--border-color-secondary); // @presenter Color
19
+ --page-navigation-button-border: var(--border-width) var(--border-style) var(--page-navigation-button-border-color); // @presenter Border
20
+ --page-navigation-button-border-color-hover: var(--color-primary-base, var(--color-warm-grey-11)); // @presenter Color
21
+ --page-navigation-button-border-hover: var(--border-width) var(--border-style) var(--page-navigation-button-border-color-hover); // @presenter Border
22
+ --page-navigation-button-min-width: 220px; // @presenter Width
23
+ // @tokens End
24
+ `;
@@ -164,7 +164,7 @@ export const search = css`
164
164
  --search-ai-text-line-height: var(--line-height-lg);
165
165
  --search-ai-thinking-text-margin: var(--md-pre-margin) 0;
166
166
 
167
- --search-ai-user-bg-color: var(--color-blue-6);
167
+ --search-ai-user-bg-color: var(--color-primary-base, var(--search-ai-user-bg-color-legacy));
168
168
  --search-ai-user-text-color: var(--color-static-white);
169
169
  --search-ai-assistant-bg-color: var(--layer-color);
170
170
  --search-ai-assistant-text-color: var(--text-color-primary);
@@ -247,7 +247,7 @@ export const search = css`
247
247
  --search-ai-conversation-input-border-radius: var(--border-radius-lg);
248
248
  --search-ai-conversation-input-font-size: var(--font-size-base);
249
249
  --search-ai-conversation-input-placeholder-color: var(--search-input-placeholder-color);
250
- --search-ai-conversation-input-border-color-focus: var(--color-blue-6);
250
+ --search-ai-conversation-input-border-color-focus: var(--color-primary-base, var(--search-ai-conversation-input-border-color-focus-legacy));
251
251
  --search-ai-conversation-input-border-color-disabled: var(--border-color-secondary);
252
252
 
253
253
  --search-ai-conversation-input-send-button-right: 12px;
@@ -1,40 +1,56 @@
1
- import { useEffect } from 'react';
1
+ import { useEffect, useRef } from 'react';
2
2
 
3
3
  export function useModalScrollLock(isOpen: boolean): void {
4
+ const originalBodyStylesRef = useRef<{
5
+ overflow: string;
6
+ paddingRight: string;
7
+ scrollbarWidth: string | null;
8
+ } | null>(null);
9
+
4
10
  useEffect(() => {
5
11
  if (typeof window === 'undefined' || typeof document === 'undefined') {
6
12
  return;
7
13
  }
8
14
 
9
15
  const { body, documentElement } = document;
10
- const originalOverflow = body.style.overflow;
11
- const originalPaddingRight = body.style.paddingRight;
12
- const originalScrollbarWidth =
13
- documentElement.style.getPropertyValue('--modal-scrollbar-width');
14
-
15
- const restoreScrollState = () => {
16
- body.style.overflow = originalOverflow;
17
- body.style.paddingRight = originalPaddingRight;
18
- if (originalScrollbarWidth) {
19
- documentElement.style.setProperty('--modal-scrollbar-width', originalScrollbarWidth);
16
+
17
+ const restoreOriginalBodyStyles = () => {
18
+ if (!originalBodyStylesRef.current) return;
19
+
20
+ const { overflow, paddingRight, scrollbarWidth } = originalBodyStylesRef.current;
21
+
22
+ body.style.overflow = overflow;
23
+ body.style.paddingRight = paddingRight;
24
+ if (scrollbarWidth) {
25
+ documentElement.style.setProperty('--modal-scrollbar-width', scrollbarWidth);
20
26
  } else {
21
27
  documentElement.style.removeProperty('--modal-scrollbar-width');
22
28
  }
29
+
30
+ originalBodyStylesRef.current = null;
23
31
  };
24
32
 
25
- if (isOpen) {
26
- const scrollbarWidth = window.innerWidth - documentElement.clientWidth;
33
+ if (isOpen && !originalBodyStylesRef.current) {
34
+ originalBodyStylesRef.current = {
35
+ overflow: body.style.overflow,
36
+ paddingRight: body.style.paddingRight,
37
+ scrollbarWidth: documentElement.style.getPropertyValue('--modal-scrollbar-width') || null,
38
+ };
27
39
 
40
+ const scrollbarWidth = window.innerWidth - documentElement.clientWidth;
28
41
  body.style.overflow = 'hidden';
29
42
 
30
43
  if (scrollbarWidth > 0) {
31
44
  body.style.paddingRight = `${scrollbarWidth}px`;
32
45
  documentElement.style.setProperty('--modal-scrollbar-width', `${scrollbarWidth}px`);
33
46
  }
47
+ } else if (!isOpen && originalBodyStylesRef.current) {
48
+ restoreOriginalBodyStyles();
34
49
  }
35
50
 
51
+ // Cleanup only if component unmounts while modal is open
36
52
  return () => {
37
- restoreScrollState();
53
+ restoreOriginalBodyStyles();
38
54
  };
39
55
  }, [isOpen]);
40
56
  }
@@ -64,21 +64,14 @@ export function usePageActions(
64
64
  const openApiSharedData = usePageSharedData<
65
65
  { options: { excludeFromSearch: boolean } } | undefined
66
66
  >('openAPIDocsStore');
67
+ const openapiExcludeFromSearch = openApiSharedData?.options?.excludeFromSearch;
67
68
  const mcpConfig = useMCPConfig();
68
69
 
69
- const shouldHideAllActions = shouldHidePageActions(
70
- pageProps,
71
- themeConfig,
72
- openApiSharedData?.options?.excludeFromSearch,
73
- );
74
70
  const { isPublic } = usePageData() || {};
75
71
 
76
72
  const createMCPHandler = useCallback(
77
73
  (clientType: MCPClientType, requiresMcpUrl: boolean = false) =>
78
- () => {
79
- if (requiresMcpUrl && !mcpUrl) return null;
80
- if (!requiresMcpUrl && (mcpUrl || mcpConfig.isMcpDisabled)) return null;
81
-
74
+ (): PageAction => {
82
75
  const config = requiresMcpUrl
83
76
  ? { serverName: mcpConfig.serverName, url: mcpUrl || '' }
84
77
  : { serverName: mcpConfig.serverName, url: mcpConfig.serverUrl || '' };
@@ -107,9 +100,14 @@ export function usePageActions(
107
100
  );
108
101
 
109
102
  const result: PageAction[] = useMemo(() => {
110
- if (shouldHideAllActions) {
111
- return [];
112
- }
103
+ const hideActionContext: ShouldHideActionContext = {
104
+ pageProps,
105
+ themeConfig,
106
+ openapiExcludeFromSearch,
107
+ isPublic,
108
+ mcpUrl,
109
+ isMcpDisabled: mcpConfig.isMcpDisabled,
110
+ };
113
111
 
114
112
  const origin = IS_BROWSER
115
113
  ? window.location.origin
@@ -121,7 +119,7 @@ export function usePageActions(
121
119
  ? combineUrls(origin, pathname, 'index.html.md')
122
120
  : combineUrls(origin, removeTrailingSlash(pathname) + '.md');
123
121
 
124
- const actionHandlers: Record<PageActionType, () => PageAction | null> = {
122
+ const actionHandlers: Record<PageActionType, () => PageAction> = {
125
123
  'docs-mcp-cursor': createMCPHandler('cursor', false),
126
124
  'docs-mcp-vscode': createMCPHandler('vscode', false),
127
125
  'mcp-cursor': createMCPHandler('cursor', true),
@@ -169,9 +167,6 @@ export function usePageActions(
169
167
  }),
170
168
 
171
169
  chatgpt: () => {
172
- if (!isPublic) {
173
- return null;
174
- }
175
170
  const link = getExternalAiPromptLink('https://chat.openai.com', mdPageUrl);
176
171
  return {
177
172
  buttonText: translate('page.actions.chatGptButtonText', 'Open in ChatGPT'),
@@ -192,9 +187,6 @@ export function usePageActions(
192
187
  },
193
188
 
194
189
  claude: () => {
195
- if (!isPublic) {
196
- return null;
197
- }
198
190
  const link = getExternalAiPromptLink('https://claude.ai/new', mdPageUrl);
199
191
  return {
200
192
  buttonText: translate('page.actions.claudeButtonText', 'Open in Claude'),
@@ -216,15 +208,18 @@ export function usePageActions(
216
208
  };
217
209
 
218
210
  return (themeConfig.navigation?.actions?.items || actions || DEFAULT_ENABLED_ACTIONS)
219
- .map((action) => actionHandlers[action]?.())
220
- .filter((action): action is PageAction => action !== null);
211
+ .filter((action) => !shouldHideAction(action, hideActionContext))
212
+ .map((action) => actionHandlers[action]());
221
213
  }, [
222
- shouldHideAllActions,
214
+ pageProps,
215
+ themeConfig,
216
+ openapiExcludeFromSearch,
217
+ isPublic,
218
+ mcpUrl,
219
+ mcpConfig.isMcpDisabled,
223
220
  pageSlug,
224
- themeConfig.navigation?.actions?.items,
225
221
  actions,
226
222
  translate,
227
- isPublic,
228
223
  createMCPHandler,
229
224
  telemetry,
230
225
  ]);
@@ -285,35 +280,77 @@ function createMCPAction({
285
280
  };
286
281
  }
287
282
 
288
- function shouldHidePageActions(
289
- pageProps: PageProps,
290
- themeConfig: UiAccessibleConfig,
291
- openapiExcludeFromSearch?: boolean,
283
+ type ShouldHideActionContext = {
284
+ pageProps: PageProps;
285
+ themeConfig: UiAccessibleConfig;
286
+ openapiExcludeFromSearch?: boolean;
287
+ isPublic?: boolean;
288
+ mcpUrl?: string;
289
+ isMcpDisabled: boolean;
290
+ };
291
+
292
+ function shouldHideAction(
293
+ action: PageActionType,
294
+ {
295
+ pageProps,
296
+ themeConfig,
297
+ openapiExcludeFromSearch,
298
+ isPublic,
299
+ mcpUrl,
300
+ isMcpDisabled,
301
+ }: ShouldHideActionContext,
292
302
  ): boolean {
293
303
  // Can't use any actions if search is globally disabled (markdown files are not generated)
294
304
  if (themeConfig.search?.hide) {
295
305
  return true;
296
306
  }
297
-
298
307
  // Can't use any actions if no markdown files are generated for LLMs
299
308
  if (pageProps?.seo?.llmstxt?.hide) {
300
309
  return true;
301
310
  }
302
-
303
311
  // Page actions are explicitly disabled in config
304
312
  if (themeConfig.navigation?.actions?.hide) {
305
313
  return true;
306
314
  }
307
315
 
308
- // Page is excluded from search
309
316
  const isOpenApiPage =
310
317
  pageProps?.metadata?.type === 'openapi' || pageProps?.metadata?.subType === 'openapi-operation';
311
318
  const isPageExcludedFromSearch =
312
319
  pageProps?.frontmatter?.excludeFromSearch || (isOpenApiPage && openapiExcludeFromSearch);
313
320
 
314
- if (isPageExcludedFromSearch) {
321
+ // Page excluded from search: only explicit MCP connect actions remain visible,
322
+ // since they don't depend on the page's markdown.
323
+ if (isPageExcludedFromSearch && action !== 'mcp-cursor' && action !== 'mcp-vscode') {
315
324
  return true;
316
325
  }
317
326
 
318
- return false;
327
+ return shouldHideActionByType(action, { isPublic, mcpUrl, isMcpDisabled });
328
+ }
329
+
330
+ function shouldHideActionByType(
331
+ action: PageActionType,
332
+ {
333
+ isPublic,
334
+ mcpUrl,
335
+ isMcpDisabled,
336
+ }: Pick<ShouldHideActionContext, 'isPublic' | 'mcpUrl' | 'isMcpDisabled'>,
337
+ ): boolean {
338
+ switch (action) {
339
+ case 'chatgpt':
340
+ case 'claude':
341
+ return !isPublic;
342
+ case 'docs-mcp-cursor':
343
+ case 'docs-mcp-vscode':
344
+ return Boolean(mcpUrl) || isMcpDisabled;
345
+ case 'mcp-cursor':
346
+ case 'mcp-vscode':
347
+ return !mcpUrl;
348
+ case 'copy':
349
+ case 'view':
350
+ return false;
351
+ default: {
352
+ action satisfies never;
353
+ return true;
354
+ }
355
+ }
319
356
  }