@redocly/theme 0.38.1 → 0.38.3

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.
@@ -101,15 +101,15 @@ function Mood({ settings, onSubmit, className }) {
101
101
  React.createElement(StyledFormMandatoryFields, null,
102
102
  React.createElement(Label, { "data-translation-key": "theme.feedback.settings.label" }, label || translate('theme.feedback.settings.label', 'Was this helpful?')),
103
103
  React.createElement(StyledMandatoryFieldContainer, null,
104
- React.createElement(Button_1.Button, { type: "button", variant: score === MOOD_STATES.SATISFIED ? 'primary' : 'secondary', size: "medium", onClick: () => {
105
- setScore(MOOD_STATES.SATISFIED);
106
- }, icon: React.createElement(FaceSatisfiedIcon_1.FaceSatisfiedIcon, null) }),
104
+ React.createElement(Button_1.Button, { type: "button", size: "medium", variant: score === MOOD_STATES.DISSATISFIED ? 'primary' : 'secondary', tone: score === MOOD_STATES.DISSATISFIED ? 'danger' : 'default', onClick: () => {
105
+ setScore(MOOD_STATES.DISSATISFIED);
106
+ }, icon: React.createElement(FaceDissatisfiedIcon_1.FaceDissatisfiedIcon, null) }),
107
107
  React.createElement(Button_1.Button, { type: "button", variant: score === MOOD_STATES.NEUTRAL ? 'primary' : 'secondary', size: "medium", onClick: () => {
108
108
  setScore(MOOD_STATES.NEUTRAL);
109
109
  }, icon: React.createElement(FaceNeutralIcon_1.FaceNeutralIcon, null) }),
110
- React.createElement(Button_1.Button, { type: "button", size: "medium", variant: score === MOOD_STATES.DISSATISFIED ? 'primary' : 'secondary', tone: score === MOOD_STATES.DISSATISFIED ? 'danger' : 'default', onClick: () => {
111
- setScore(MOOD_STATES.DISSATISFIED);
112
- }, icon: React.createElement(FaceDissatisfiedIcon_1.FaceDissatisfiedIcon, null) }))),
110
+ React.createElement(Button_1.Button, { type: "button", variant: score === MOOD_STATES.SATISFIED ? 'primary' : 'secondary', size: "medium", onClick: () => {
111
+ setScore(MOOD_STATES.SATISFIED);
112
+ }, icon: React.createElement(FaceSatisfiedIcon_1.FaceSatisfiedIcon, null) }))),
113
113
  (displayReasons || displayComment) && (React.createElement(StyledFormOptionalFields, null,
114
114
  displayReasons && (React.createElement(Reasons_1.Reasons, { settings: {
115
115
  label: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.label,
@@ -37,6 +37,12 @@ const FooterCopyrightWrapper = styled_components_1.default.div `
37
37
  @media screen and (min-width: ${utils_1.breakpoints.medium}) {
38
38
  margin-top: 0;
39
39
  }
40
+
41
+ @media screen and (min-width: ${utils_1.breakpoints.max}) {
42
+ max-width: var(--container-max-width);
43
+ margin-left: auto;
44
+ margin-right: auto;
45
+ }
40
46
  `;
41
47
  const FooterColumnsSection = styled_components_1.default.div `
42
48
  display: flex;
@@ -47,6 +53,13 @@ const FooterColumnsSection = styled_components_1.default.div `
47
53
  @media screen and (min-width: ${utils_1.breakpoints.small}) {
48
54
  flex-direction: row;
49
55
  }
56
+
57
+ @media screen and (min-width: ${utils_1.breakpoints.max}) {
58
+ max-width: var(--container-max-width);
59
+ width: 100%;
60
+ margin-left: auto;
61
+ margin-right: auto;
62
+ }
50
63
  `;
51
64
  const FooterWrapper = styled_components_1.default.footer `
52
65
  padding: var(--mobile-footer-padding-vertical) var(--mobile-footer-padding-horizontal);
@@ -90,6 +90,12 @@ const NavbarRow = styled_components_1.default.div `
90
90
  width: 100%;
91
91
  gap: 8px;
92
92
  max-width: var(--navbar-container-max-width);
93
+
94
+ @media screen and (min-width: ${utils_1.breakpoints.max}) {
95
+ max-width: var(--container-max-width);
96
+ margin-left: auto;
97
+ margin-right: auto;
98
+ }
93
99
  `;
94
100
  const MobileMenuButton = (0, styled_components_1.default)(Button_1.Button) `
95
101
  margin-left: 0px !important;
@@ -0,0 +1,6 @@
1
+ export type SwitchProps = {
2
+ value: boolean;
3
+ onChange: (value: boolean) => void;
4
+ disabled?: boolean;
5
+ };
6
+ export declare function Switch({ value, disabled, onChange }: SwitchProps): JSX.Element;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.Switch = void 0;
30
+ const react_1 = __importDefault(require("react"));
31
+ const styled_components_1 = __importStar(require("styled-components"));
32
+ function Switch({ value = false, disabled = false, onChange }) {
33
+ const handleClick = () => {
34
+ if (disabled)
35
+ return;
36
+ onChange(!value);
37
+ };
38
+ return (react_1.default.createElement(SwitchWrapper, { onClick: handleClick, role: "switch", selected: value, disabled: disabled },
39
+ react_1.default.createElement(Knob, { selected: value })));
40
+ }
41
+ exports.Switch = Switch;
42
+ const SwitchWrapper = styled_components_1.default.div `
43
+ width: var(--switch-width);
44
+ height: var(--switch-height);
45
+ border-radius: var(--switch-border-radius);
46
+ background-color: ${({ selected, disabled }) => disabled
47
+ ? 'var(--switch-bg-color-disabled)'
48
+ : selected
49
+ ? 'var(--switch-bg-color-selected)'
50
+ : 'var(--switch-bg-color)'};
51
+ display: flex;
52
+ align-items: center;
53
+ padding: var(--switch-padding);
54
+ cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
55
+ transition: var(--switch-bg-transition);
56
+
57
+ ${({ disabled }) => !disabled &&
58
+ (0, styled_components_1.css) `
59
+ &:hover {
60
+ background-color: var(--switch-bg-color-hover);
61
+ }
62
+ `}
63
+
64
+ &:active {
65
+ background-color: var(--switch-bg-color-pressed);
66
+ }
67
+ `;
68
+ const Knob = styled_components_1.default.div `
69
+ width: var(--switch-knob-width);
70
+ height: var(--switch-knob-height);
71
+ border-radius: var(--switch-knob-border-radius);
72
+ background-color: ${({ selected }) => selected ? 'var(--switch-knob-bg-color-selected)' : 'var(--switch-knob-bg-color)'};
73
+ transform: ${({ selected }) => selected ? 'translateX(var(--switch-knob-width))' : 'translateX(0)'};
74
+ transition: var(--switch-knob-transition);
75
+ `;
76
+ //# sourceMappingURL=Switch.js.map
@@ -0,0 +1 @@
1
+ export declare const switcher: import("styled-components").FlattenSimpleInterpolation;
@@ -0,0 +1 @@
1
+ export declare const switcherDarkMode: import("styled-components").FlattenSimpleInterpolation;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.switcherDarkMode = void 0;
4
+ const styled_components_1 = require("styled-components");
5
+ exports.switcherDarkMode = (0, styled_components_1.css) `
6
+ --switch-bg-color: var(--color-warm-grey-6); // @presenter Color
7
+ --switch-bg-color-selected: var(--color-warm-grey-6); // @presenter Color
8
+ --switch-bg-color-hover: var(--color-warm-grey-7); // @presenter Color
9
+ --switch-bg-color-pressed: var(--color-warm-grey-7); // @presenter Color
10
+ --switch-bg-color-disabled: var(--color-warm-grey-5); // @presenter Color
11
+ --switch-knob-bg-color: var(--color-warm-grey-8); // @presenter Color
12
+ --switch-knob-bg-color-selected: var(--color-warm-grey-11); // @presenter Color
13
+ --switch-border-radius: var(--border-radius); // @presenter BorderRadius
14
+ --switch-knob-border-radius: calc(var(--border-radius) / 2); // @presenter BorderRadius
15
+ --switch-width: 32px; // @presenter Width
16
+ --switch-height: 18px; // @presenter Height
17
+ --switch-padding: calc(var(--spacing-xxs) / 2); // @presenter Padding
18
+ --switch-bg-transition: background-color 0.3s; // @presenter Transition
19
+ --switch-knob-height: 14px; // @presenter Height
20
+ --switch-knob-width: 14px; // @presenter Width
21
+ --switch-knob-transition: all 0.3s; // @presenter Transition
22
+ `;
23
+ //# sourceMappingURL=variables.dark.js.map
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.switcher = void 0;
4
+ const styled_components_1 = require("styled-components");
5
+ exports.switcher = (0, styled_components_1.css) `
6
+ --switch-bg-color: var(--color-warm-grey-4); // @presenter Color
7
+ --switch-bg-color-selected: var(--color-warm-grey-9); // @presenter Color
8
+ --switch-bg-color-hover: var(--color-warm-grey-5); // @presenter Color
9
+ --switch-bg-color-pressed: var(--color-warm-grey-6); // @presenter Color
10
+ --switch-bg-color-disabled: var(--color-warm-grey-3); // @presenter Color
11
+ --switch-knob-bg-color: var(--color-white); // @presenter Color
12
+ --switch-knob-bg-color-selected: var(--color-white); // @presenter Color
13
+ --switch-border-radius: var(--border-radius); // @presenter BorderRadius
14
+ --switch-knob-border-radius: calc(var(--border-radius) / 2); // @presenter BorderRadius
15
+ --switch-width: 32px; // @presenter Width
16
+ --switch-height: 18px; // @presenter Height
17
+ --switch-padding: calc(var(--spacing-xxs) / 2); // @presenter Padding
18
+ --switch-bg-transition: background-color 0.3s; // @presenter Transition
19
+ --switch-knob-height: 14px; // @presenter Height
20
+ --switch-knob-width: 14px; // @presenter Width
21
+ --switch-knob-transition: transform 0.3s; // @presenter Transition
22
+ `;
23
+ //# sourceMappingURL=variables.js.map
@@ -10,6 +10,7 @@ const variables_dark_5 = require("../../components/Segmented/variables.dark");
10
10
  const variables_dark_6 = require("../../icons/CheckboxIcon/variables.dark");
11
11
  const variables_dark_7 = require("../../components/Tag/variables.dark");
12
12
  const variables_dark_8 = require("../../components/StatusCode/variables.dark");
13
+ const variables_dark_9 = require("../../components/Switch/variables.dark");
13
14
  const replayDarkMode = (0, styled_components_1.css) `
14
15
  /**
15
16
  * @tokens Replay Colors
@@ -299,6 +300,8 @@ exports.darkMode = (0, styled_components_1.css) `
299
300
  ${variables_dark_2.mermaidDarkMode}
300
301
  ${variables_dark_1.scorecardDarkMode}
301
302
  ${replayDarkMode}
303
+ ${variables_dark_9.switcherDarkMode}
304
+
302
305
 
303
306
  /**
304
307
  * @tokens Dark Theme Scrollbar Config
@@ -36,6 +36,7 @@ const variables_30 = require("../../components/UserMenu/variables");
36
36
  const variables_31 = require("../../components/Tags/variables");
37
37
  const variables_32 = require("../../components/VersionPicker/variables");
38
38
  const variables_33 = require("../../components/DatePicker/variables");
39
+ const variables_34 = require("../../components/Switch/variables");
39
40
  const themeColors = (0, styled_components_1.css) `
40
41
  /* === Palette === */
41
42
  /**
@@ -383,6 +384,7 @@ const sizeAndSpace = (0, styled_components_1.css) `
383
384
  */
384
385
 
385
386
  --container-width: 1200px;
387
+ --container-max-width: 1504px;
386
388
 
387
389
  /**
388
390
  * @tokens Space
@@ -1177,6 +1179,7 @@ exports.styles = (0, styled_components_1.css) `
1177
1179
  ${icon}
1178
1180
  ${tree}
1179
1181
  ${variables_29.segmented}
1182
+ ${variables_34.switcher}
1180
1183
  ${variables_14.checkbox}
1181
1184
  ${variables_3.feedback}
1182
1185
  ${variables_2.scorecard}
@@ -2,5 +2,6 @@ export type Breakpoints = {
2
2
  small: `${number}px`;
3
3
  medium: `${number}px`;
4
4
  large: `${number}px`;
5
+ max: `${number}px`;
5
6
  };
6
7
  export declare const breakpoints: Breakpoints;
@@ -1,5 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.breakpoints = void 0;
4
- exports.breakpoints = { small: '672px', medium: '960px', large: '1280px' };
4
+ exports.breakpoints = {
5
+ small: '672px',
6
+ medium: '960px',
7
+ large: '1280px',
8
+ max: '1504px',
9
+ };
5
10
  //# sourceMappingURL=media-css.js.map
package/lib/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './components/JsonViewer/JsonViewer';
5
5
  export * from './components/Tag/Tag';
6
6
  export * from './components/TableOfContent/TableOfContent';
7
7
  export * from './components/ColorModeSwitcher/ColorModeSwitcher';
8
+ export * from './components/Switch/Switch';
8
9
  export * from './components/Select/Select';
9
10
  export * from './components/Badge/Badge';
10
11
  export * from './components/Dropdown/Dropdown';
package/lib/index.js CHANGED
@@ -35,6 +35,7 @@ __exportStar(require("./components/JsonViewer/JsonViewer"), exports);
35
35
  __exportStar(require("./components/Tag/Tag"), exports);
36
36
  __exportStar(require("./components/TableOfContent/TableOfContent"), exports);
37
37
  __exportStar(require("./components/ColorModeSwitcher/ColorModeSwitcher"), exports);
38
+ __exportStar(require("./components/Switch/Switch"), exports);
38
39
  __exportStar(require("./components/Select/Select"), exports);
39
40
  __exportStar(require("./components/Badge/Badge"), exports);
40
41
  __exportStar(require("./components/Dropdown/Dropdown"), exports);
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PageLayout = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
+ const utils_1 = require("../core/utils");
9
10
  function PageLayout({ sidebar, children, }) {
10
11
  return (react_1.default.createElement(Container, { "data-component-name": "Layout/PageLayout" },
11
12
  sidebar,
@@ -16,6 +17,12 @@ const Container = styled_components_1.default.div `
16
17
  display: flex;
17
18
  flex-direction: row;
18
19
  min-height: calc(100vh - var(--navbar-height));
20
+
21
+ @media screen and (min-width: ${utils_1.breakpoints.max}) {
22
+ max-width: var(--container-max-width);
23
+ margin-left: auto;
24
+ margin-right: auto;
25
+ }
19
26
  `;
20
27
  const ContentContainer = styled_components_1.default.div `
21
28
  flex: 1 0 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.38.1",
3
+ "version": "0.38.3",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -124,12 +124,13 @@ export function Mood({ settings, onSubmit, className }: MoodProps): JSX.Element
124
124
  <StyledMandatoryFieldContainer>
125
125
  <Button
126
126
  type="button"
127
- variant={score === MOOD_STATES.SATISFIED ? 'primary' : 'secondary'}
128
127
  size="medium"
128
+ variant={score === MOOD_STATES.DISSATISFIED ? 'primary' : 'secondary'}
129
+ tone={score === MOOD_STATES.DISSATISFIED ? 'danger' : 'default'}
129
130
  onClick={() => {
130
- setScore(MOOD_STATES.SATISFIED);
131
+ setScore(MOOD_STATES.DISSATISFIED);
131
132
  }}
132
- icon={<FaceSatisfiedIcon />}
133
+ icon={<FaceDissatisfiedIcon />}
133
134
  />
134
135
  <Button
135
136
  type="button"
@@ -142,13 +143,12 @@ export function Mood({ settings, onSubmit, className }: MoodProps): JSX.Element
142
143
  />
143
144
  <Button
144
145
  type="button"
146
+ variant={score === MOOD_STATES.SATISFIED ? 'primary' : 'secondary'}
145
147
  size="medium"
146
- variant={score === MOOD_STATES.DISSATISFIED ? 'primary' : 'secondary'}
147
- tone={score === MOOD_STATES.DISSATISFIED ? 'danger' : 'default'}
148
148
  onClick={() => {
149
- setScore(MOOD_STATES.DISSATISFIED);
149
+ setScore(MOOD_STATES.SATISFIED);
150
150
  }}
151
- icon={<FaceDissatisfiedIcon />}
151
+ icon={<FaceSatisfiedIcon />}
152
152
  />
153
153
  </StyledMandatoryFieldContainer>
154
154
  </StyledFormMandatoryFields>
@@ -56,6 +56,12 @@ const FooterCopyrightWrapper = styled.div`
56
56
  @media screen and (min-width: ${breakpoints.medium}) {
57
57
  margin-top: 0;
58
58
  }
59
+
60
+ @media screen and (min-width: ${breakpoints.max}) {
61
+ max-width: var(--container-max-width);
62
+ margin-left: auto;
63
+ margin-right: auto;
64
+ }
59
65
  `;
60
66
 
61
67
  const FooterColumnsSection = styled.div`
@@ -67,6 +73,13 @@ const FooterColumnsSection = styled.div`
67
73
  @media screen and (min-width: ${breakpoints.small}) {
68
74
  flex-direction: row;
69
75
  }
76
+
77
+ @media screen and (min-width: ${breakpoints.max}) {
78
+ max-width: var(--container-max-width);
79
+ width: 100%;
80
+ margin-left: auto;
81
+ margin-right: auto;
82
+ }
70
83
  `;
71
84
 
72
85
  const FooterWrapper = styled.footer<{ withColumns?: boolean }>`
@@ -109,6 +109,12 @@ const NavbarRow = styled.div`
109
109
  width: 100%;
110
110
  gap: 8px;
111
111
  max-width: var(--navbar-container-max-width);
112
+
113
+ @media screen and (min-width: ${breakpoints.max}) {
114
+ max-width: var(--container-max-width);
115
+ margin-left: auto;
116
+ margin-right: auto;
117
+ }
112
118
  `;
113
119
 
114
120
  const MobileMenuButton = styled(Button)`
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import styled, { css } from 'styled-components';
3
+
4
+ export type SwitchProps = {
5
+ value: boolean;
6
+ onChange: (value: boolean) => void;
7
+ disabled?: boolean;
8
+ };
9
+
10
+ export function Switch({ value = false, disabled = false, onChange }: SwitchProps): JSX.Element {
11
+ const handleClick = () => {
12
+ if (disabled) return;
13
+ onChange(!value);
14
+ };
15
+
16
+ return (
17
+ <SwitchWrapper onClick={handleClick} role="switch" selected={value} disabled={disabled}>
18
+ <Knob selected={value} />
19
+ </SwitchWrapper>
20
+ );
21
+ }
22
+
23
+ const SwitchWrapper = styled.div<{ selected: boolean; disabled: boolean }>`
24
+ width: var(--switch-width);
25
+ height: var(--switch-height);
26
+ border-radius: var(--switch-border-radius);
27
+ background-color: ${({ selected, disabled }) =>
28
+ disabled
29
+ ? 'var(--switch-bg-color-disabled)'
30
+ : selected
31
+ ? 'var(--switch-bg-color-selected)'
32
+ : 'var(--switch-bg-color)'};
33
+ display: flex;
34
+ align-items: center;
35
+ padding: var(--switch-padding);
36
+ cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
37
+ transition: var(--switch-bg-transition);
38
+
39
+ ${({ disabled }) =>
40
+ !disabled &&
41
+ css`
42
+ &:hover {
43
+ background-color: var(--switch-bg-color-hover);
44
+ }
45
+ `}
46
+
47
+ &:active {
48
+ background-color: var(--switch-bg-color-pressed);
49
+ }
50
+ `;
51
+
52
+ const Knob = styled.div<{ selected: boolean }>`
53
+ width: var(--switch-knob-width);
54
+ height: var(--switch-knob-height);
55
+ border-radius: var(--switch-knob-border-radius);
56
+ background-color: ${({ selected }) =>
57
+ selected ? 'var(--switch-knob-bg-color-selected)' : 'var(--switch-knob-bg-color)'};
58
+ transform: ${({ selected }) =>
59
+ selected ? 'translateX(var(--switch-knob-width))' : 'translateX(0)'};
60
+ transition: var(--switch-knob-transition);
61
+ `;
@@ -0,0 +1,20 @@
1
+ import { css } from 'styled-components';
2
+
3
+ export const switcherDarkMode = css`
4
+ --switch-bg-color: var(--color-warm-grey-6); // @presenter Color
5
+ --switch-bg-color-selected: var(--color-warm-grey-6); // @presenter Color
6
+ --switch-bg-color-hover: var(--color-warm-grey-7); // @presenter Color
7
+ --switch-bg-color-pressed: var(--color-warm-grey-7); // @presenter Color
8
+ --switch-bg-color-disabled: var(--color-warm-grey-5); // @presenter Color
9
+ --switch-knob-bg-color: var(--color-warm-grey-8); // @presenter Color
10
+ --switch-knob-bg-color-selected: var(--color-warm-grey-11); // @presenter Color
11
+ --switch-border-radius: var(--border-radius); // @presenter BorderRadius
12
+ --switch-knob-border-radius: calc(var(--border-radius) / 2); // @presenter BorderRadius
13
+ --switch-width: 32px; // @presenter Width
14
+ --switch-height: 18px; // @presenter Height
15
+ --switch-padding: calc(var(--spacing-xxs) / 2); // @presenter Padding
16
+ --switch-bg-transition: background-color 0.3s; // @presenter Transition
17
+ --switch-knob-height: 14px; // @presenter Height
18
+ --switch-knob-width: 14px; // @presenter Width
19
+ --switch-knob-transition: all 0.3s; // @presenter Transition
20
+ `;
@@ -0,0 +1,20 @@
1
+ import { css } from 'styled-components';
2
+
3
+ export const switcher = css`
4
+ --switch-bg-color: var(--color-warm-grey-4); // @presenter Color
5
+ --switch-bg-color-selected: var(--color-warm-grey-9); // @presenter Color
6
+ --switch-bg-color-hover: var(--color-warm-grey-5); // @presenter Color
7
+ --switch-bg-color-pressed: var(--color-warm-grey-6); // @presenter Color
8
+ --switch-bg-color-disabled: var(--color-warm-grey-3); // @presenter Color
9
+ --switch-knob-bg-color: var(--color-white); // @presenter Color
10
+ --switch-knob-bg-color-selected: var(--color-white); // @presenter Color
11
+ --switch-border-radius: var(--border-radius); // @presenter BorderRadius
12
+ --switch-knob-border-radius: calc(var(--border-radius) / 2); // @presenter BorderRadius
13
+ --switch-width: 32px; // @presenter Width
14
+ --switch-height: 18px; // @presenter Height
15
+ --switch-padding: calc(var(--spacing-xxs) / 2); // @presenter Padding
16
+ --switch-bg-transition: background-color 0.3s; // @presenter Transition
17
+ --switch-knob-height: 14px; // @presenter Height
18
+ --switch-knob-width: 14px; // @presenter Width
19
+ --switch-knob-transition: transform 0.3s; // @presenter Transition
20
+ `;
@@ -8,6 +8,7 @@ import { segmentedButtonsDarkMode } from '@redocly/theme/components/Segmented/va
8
8
  import { checkboxDarkMode } from '@redocly/theme/icons/CheckboxIcon/variables.dark';
9
9
  import { tagDarkMode } from '@redocly/theme/components/Tag/variables.dark';
10
10
  import { statusCodeDarkMode } from '@redocly/theme/components/StatusCode/variables.dark';
11
+ import { switcherDarkMode } from '@redocly/theme/components/Switch/variables.dark';
11
12
 
12
13
  const replayDarkMode = css`
13
14
  /**
@@ -299,6 +300,8 @@ export const darkMode = css`
299
300
  ${mermaidDarkMode}
300
301
  ${scorecardDarkMode}
301
302
  ${replayDarkMode}
303
+ ${switcherDarkMode}
304
+
302
305
 
303
306
  /**
304
307
  * @tokens Dark Theme Scrollbar Config
@@ -34,6 +34,7 @@ import { userMenu } from '@redocly/theme/components/UserMenu/variables';
34
34
  import { httpTag } from '@redocly/theme/components/Tags/variables';
35
35
  import { versionPicker } from '@redocly/theme/components/VersionPicker/variables';
36
36
  import { datePicker } from '@redocly/theme/components/DatePicker/variables'
37
+ import { switcher } from '@redocly/theme/components/Switch/variables';
37
38
 
38
39
 
39
40
  const themeColors = css`
@@ -385,6 +386,7 @@ const sizeAndSpace = css`
385
386
  */
386
387
 
387
388
  --container-width: 1200px;
389
+ --container-max-width: 1504px;
388
390
 
389
391
  /**
390
392
  * @tokens Space
@@ -1200,6 +1202,7 @@ export const styles = css`
1200
1202
  ${icon}
1201
1203
  ${tree}
1202
1204
  ${segmented}
1205
+ ${switcher}
1203
1206
  ${checkbox}
1204
1207
  ${feedback}
1205
1208
  ${scorecard}
@@ -2,6 +2,12 @@ export type Breakpoints = {
2
2
  small: `${number}px`;
3
3
  medium: `${number}px`;
4
4
  large: `${number}px`;
5
+ max: `${number}px`;
5
6
  };
6
7
 
7
- export const breakpoints: Breakpoints = { small: '672px', medium: '960px', large: '1280px' };
8
+ export const breakpoints: Breakpoints = {
9
+ small: '672px',
10
+ medium: '960px',
11
+ large: '1280px',
12
+ max: '1504px',
13
+ };
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ export * from '@redocly/theme/components/JsonViewer/JsonViewer';
7
7
  export * from '@redocly/theme/components/Tag/Tag';
8
8
  export * from '@redocly/theme/components/TableOfContent/TableOfContent';
9
9
  export * from '@redocly/theme/components/ColorModeSwitcher/ColorModeSwitcher';
10
+ export * from '@redocly/theme/components/Switch/Switch';
10
11
  export * from '@redocly/theme/components/Select/Select';
11
12
  export * from '@redocly/theme/components/Badge/Badge';
12
13
  export * from '@redocly/theme/components/Dropdown/Dropdown';
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
+ import { breakpoints } from '@redocly/theme/core/utils';
5
+
4
6
  interface PageLayoutProps {
5
7
  sidebar?: React.ReactNode;
6
8
  }
@@ -21,6 +23,12 @@ const Container = styled.div`
21
23
  display: flex;
22
24
  flex-direction: row;
23
25
  min-height: calc(100vh - var(--navbar-height));
26
+
27
+ @media screen and (min-width: ${breakpoints.max}) {
28
+ max-width: var(--container-max-width);
29
+ margin-left: auto;
30
+ margin-right: auto;
31
+ }
24
32
  `;
25
33
 
26
34
  const ContentContainer = styled.div`