@redocly/theme 0.0.0-beta-20240223133421 → 0.0.0-beta-20240226163902

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.
@@ -38,11 +38,11 @@ function CodeBlockControls({ children, className, title, controls, tabs, }) {
38
38
  title && react_1.default.createElement(Title, null, title),
39
39
  tabs && react_1.default.createElement(FileTabs, null),
40
40
  react_1.default.createElement(ControlsWrapper, null,
41
- report && !((_a = report === null || report === void 0 ? void 0 : report.props) === null || _a === void 0 ? void 0 : _a.hide) ? (react_1.default.createElement(Button_1.Button, Object.assign({ "data-cy": "report-button", "data-testid": "report-button", icon: controlsType === 'icon' ? react_1.default.createElement(WarningSquareIcon_1.WarningSquareIcon, { size: "18px" }) : undefined, size: "small", variant: "ghost" }, report.props), controlsType != 'icon' && (((_b = report.props) === null || _b === void 0 ? void 0 : _b.buttonText) || 'Report'))) : null,
42
- expand && !((_c = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.expand) === null || _c === void 0 ? void 0 : _c.hide) ? (react_1.default.createElement(Button_1.Button, { "data-cy": "expand-all", "data-testid": "expand-all", icon: controlsType === 'icon' ? react_1.default.createElement(MaximizeIcon_1.MaximizeIcon, null) : undefined, onClick: expand === null || expand === void 0 ? void 0 : expand.onClick, size: "small", variant: "ghost" }, controlsType !== 'icon' && (expand === null || expand === void 0 ? void 0 : expand.label) ? expand.label : 'Expand all')) : null,
43
- collapse && !((_d = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.collapse) === null || _d === void 0 ? void 0 : _d.hide) ? (react_1.default.createElement(Button_1.Button, { "data-cy": "collapse-all", "data-testid": "collapse-all", icon: controlsType === 'icon' ? react_1.default.createElement(MinimizeIcon_1.MinimizeIcon, null) : undefined, onClick: collapse === null || collapse === void 0 ? void 0 : collapse.onClick, size: "small", variant: "ghost" }, controlsType !== 'icon' && (expand === null || expand === void 0 ? void 0 : expand.label) ? expand.label : 'Collapse all')) : null,
44
- select ? (react_1.default.createElement(Button_1.Button, { "data-cy": "select-all", "data-testid": "select-all", icon: controlsType === 'icon' ? react_1.default.createElement(SelectIcon_1.SelectIcon, null) : undefined, onClick: select === null || select === void 0 ? void 0 : select.onClick, size: "small", variant: "ghost" }, controlsType !== 'icon' && (select === null || select === void 0 ? void 0 : select.label) ? select.label : 'Select all')) : null,
45
- deselect ? (react_1.default.createElement(Button_1.Button, { "data-cy": "clear-all", "data-testid": "clear-all", icon: controlsType === 'icon' ? react_1.default.createElement(DeselectIcon_1.DeselectIcon, null) : undefined, onClick: deselect === null || deselect === void 0 ? void 0 : deselect.onClick, size: "small", variant: "ghost" }, controlsType !== 'icon' && (deselect === null || deselect === void 0 ? void 0 : deselect.label) ? deselect.label : 'Clear all')) : null,
41
+ report && !((_a = report === null || report === void 0 ? void 0 : report.props) === null || _a === void 0 ? void 0 : _a.hide) ? (react_1.default.createElement(ControlButton, Object.assign({ variant: "ghost", size: "small", "data-cy": "report-button", "data-testid": "report-button", icon: controlsType === 'icon' ? react_1.default.createElement(WarningSquareIcon_1.WarningSquareIcon, { size: "18px" }) : undefined }, report.props), controlsType != 'icon' && (((_b = report.props) === null || _b === void 0 ? void 0 : _b.buttonText) || 'Report'))) : null,
42
+ expand && !((_c = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.expand) === null || _c === void 0 ? void 0 : _c.hide) ? (react_1.default.createElement(ControlButton, { variant: "ghost", size: "small", "data-cy": "expand-all", "data-testid": "expand-all", icon: controlsType === 'icon' ? react_1.default.createElement(MaximizeIcon_1.MaximizeIcon, null) : undefined, onClick: expand === null || expand === void 0 ? void 0 : expand.onClick }, controlsType !== 'icon' && ((expand === null || expand === void 0 ? void 0 : expand.label) || 'Expand all'))) : null,
43
+ collapse && !((_d = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.collapse) === null || _d === void 0 ? void 0 : _d.hide) ? (react_1.default.createElement(ControlButton, { variant: "ghost", size: "small", "data-cy": "collapse-all", "data-testid": "collapse-all", icon: controlsType === 'icon' ? react_1.default.createElement(MinimizeIcon_1.MinimizeIcon, null) : undefined, onClick: collapse === null || collapse === void 0 ? void 0 : collapse.onClick }, controlsType !== 'icon' && ((expand === null || expand === void 0 ? void 0 : expand.label) || 'Collapse all'))) : null,
44
+ select ? (react_1.default.createElement(ControlButton, { variant: "ghost", size: "small", "data-cy": "select-all", "data-testid": "select-all", icon: controlsType === 'icon' ? react_1.default.createElement(SelectIcon_1.SelectIcon, null) : undefined, onClick: select === null || select === void 0 ? void 0 : select.onClick }, controlsType !== 'icon' && (select === null || select === void 0 ? void 0 : select.label) ? select.label : 'Select all')) : null,
45
+ deselect ? (react_1.default.createElement(ControlButton, { variant: "ghost", size: "small", "data-cy": "clear-all", "data-testid": "clear-all", icon: controlsType === 'icon' ? react_1.default.createElement(DeselectIcon_1.DeselectIcon, null) : undefined, onClick: deselect === null || deselect === void 0 ? void 0 : deselect.onClick }, controlsType !== 'icon' && (deselect === null || deselect === void 0 ? void 0 : deselect.label) ? deselect.label : 'Clear all')) : null,
46
46
  copy && !((_e = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.copy) === null || _e === void 0 ? void 0 : _e.hide) ? (react_1.default.createElement(CopyButton_1.CopyButton, { data: copy.data, "data-source": copy.dataSource, "data-hash": copy.dataHash, type: controlsType, toasterPlacement: copy.toasterPlacement, toasterDuration: copy.toasterDuration, buttonText: copy.label, onCopyClick: () => {
47
47
  copy === null || copy === void 0 ? void 0 : copy.onClick;
48
48
  telemetry.send('code_snippet_copied', {});
@@ -93,4 +93,9 @@ const CodeTabButton = (0, styled_components_1.default)(Button_1.Button) `
93
93
  border: none;
94
94
  }
95
95
  `;
96
+ const ControlButton = (0, styled_components_1.default)(Button_1.Button) `
97
+ & + & {
98
+ margin-left: 0;
99
+ }
100
+ `;
96
101
  //# sourceMappingURL=CodeBlockControls.js.map
@@ -1,3 +1,6 @@
1
- export declare const StatusCode: import("styled-components").StyledComponent<"button", any, {
1
+ /// <reference types="react" />
2
+ export declare const StatusCode: import("styled-components").StyledComponent<import("react").FC<import("../../index.js").ButtonProps>, any, import("../../index.js").ButtonProps & {
3
+ variant: "ghost";
4
+ } & {
2
5
  status: string;
3
- }, never>;
6
+ }, "variant">;
@@ -5,11 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.StatusCode = void 0;
7
7
  const styled_components_1 = __importDefault(require("styled-components"));
8
- exports.StatusCode = styled_components_1.default.button `
9
- background: none;
10
- padding: 0;
11
- display: flex;
12
- align-items: center;
8
+ const theme_1 = require("../../index.js");
9
+ exports.StatusCode = (0, styled_components_1.default)(theme_1.Button).attrs(() => ({
10
+ variant: 'ghost',
11
+ })) `
12
+ gap: 0;
13
+ border: 0;
13
14
 
14
15
  &:before {
15
16
  display: inline-block;
@@ -246,6 +246,13 @@ exports.darkMode = (0, styled_components_1.css) `
246
246
  --tab-bg-color-filled: var(--color-warm-grey-4); // @presenter Color
247
247
  --tab-content-color-disabled: var(--color-warm-grey-4); // @presenter Color
248
248
 
249
+ /**
250
+ * @tokens Dropdown Colors
251
+ * @presenter Color
252
+ */
253
+
254
+ --dropdown-content-color-default: var(--color-warm-grey-8); // @presenter Color
255
+
249
256
  /**
250
257
  * @tokens API Reference Schema Required styles
251
258
  */
@@ -16,6 +16,7 @@ exports.ChevronDownIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
16
16
  fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
17
17
  }
18
18
 
19
+ flex-shrink: 0;
19
20
  height: ${({ size }) => size || '16px'};
20
21
  width: ${({ size }) => size || '16px'};
21
22
  `;
@@ -16,6 +16,7 @@ exports.ChevronUpIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
16
16
  fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
17
17
  }
18
18
 
19
+ flex-shrink: 0;
19
20
  height: ${({ size }) => size || '16px'};
20
21
  width: ${({ size }) => size || '16px'};
21
22
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.0.0-beta-20240223133421",
3
+ "version": "0.0.0-beta-20240226163902",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -92,68 +92,68 @@ export function CodeBlockControls({
92
92
  {tabs && <FileTabs />}
93
93
  <ControlsWrapper>
94
94
  {report && !report?.props?.hide ? (
95
- <Button
95
+ <ControlButton
96
+ variant="ghost"
97
+ size="small"
96
98
  data-cy="report-button"
97
99
  data-testid="report-button"
98
100
  icon={controlsType === 'icon' ? <WarningSquareIcon size="18px" /> : undefined}
99
- size="small"
100
- variant="ghost"
101
101
  {...report.props}
102
102
  >
103
103
  {controlsType != 'icon' && (report.props?.buttonText || 'Report')}
104
- </Button>
104
+ </ControlButton>
105
105
  ) : null}
106
106
 
107
107
  {expand && !codeSnippet?.expand?.hide ? (
108
- <Button
108
+ <ControlButton
109
+ variant="ghost"
110
+ size="small"
109
111
  data-cy="expand-all"
110
112
  data-testid="expand-all"
111
113
  icon={controlsType === 'icon' ? <MaximizeIcon /> : undefined}
112
114
  onClick={expand?.onClick}
113
- size="small"
114
- variant="ghost"
115
115
  >
116
- {controlsType !== 'icon' && expand?.label ? expand.label : 'Expand all'}
117
- </Button>
116
+ {controlsType !== 'icon' && (expand?.label || 'Expand all')}
117
+ </ControlButton>
118
118
  ) : null}
119
119
 
120
120
  {collapse && !codeSnippet?.collapse?.hide ? (
121
- <Button
121
+ <ControlButton
122
+ variant="ghost"
123
+ size="small"
122
124
  data-cy="collapse-all"
123
125
  data-testid="collapse-all"
124
126
  icon={controlsType === 'icon' ? <MinimizeIcon /> : undefined}
125
127
  onClick={collapse?.onClick}
126
- size="small"
127
- variant="ghost"
128
128
  >
129
- {controlsType !== 'icon' && expand?.label ? expand.label : 'Collapse all'}
130
- </Button>
129
+ {controlsType !== 'icon' && (expand?.label || 'Collapse all')}
130
+ </ControlButton>
131
131
  ) : null}
132
132
 
133
133
  {select ? (
134
- <Button
134
+ <ControlButton
135
+ variant="ghost"
136
+ size="small"
135
137
  data-cy="select-all"
136
138
  data-testid="select-all"
137
139
  icon={controlsType === 'icon' ? <SelectIcon /> : undefined}
138
140
  onClick={select?.onClick}
139
- size="small"
140
- variant="ghost"
141
141
  >
142
142
  {controlsType !== 'icon' && select?.label ? select.label : 'Select all'}
143
- </Button>
143
+ </ControlButton>
144
144
  ) : null}
145
145
 
146
146
  {deselect ? (
147
- <Button
147
+ <ControlButton
148
+ variant="ghost"
149
+ size="small"
148
150
  data-cy="clear-all"
149
151
  data-testid="clear-all"
150
152
  icon={controlsType === 'icon' ? <DeselectIcon /> : undefined}
151
153
  onClick={deselect?.onClick}
152
- size="small"
153
- variant="ghost"
154
154
  >
155
155
  {controlsType !== 'icon' && deselect?.label ? deselect.label : 'Clear all'}
156
- </Button>
156
+ </ControlButton>
157
157
  ) : null}
158
158
 
159
159
  {copy && !codeSnippet?.copy?.hide ? (
@@ -229,3 +229,9 @@ const CodeTabButton = styled(Button)<{ active: boolean }>`
229
229
  border: none;
230
230
  }
231
231
  `;
232
+
233
+ const ControlButton = styled(Button)`
234
+ & + & {
235
+ margin-left: 0;
236
+ }
237
+ `;
@@ -1,10 +1,12 @@
1
1
  import styled from 'styled-components';
2
2
 
3
- export const StatusCode = styled.button<{ status: string }>`
4
- background: none;
5
- padding: 0;
6
- display: flex;
7
- align-items: center;
3
+ import { Button } from '@redocly/theme';
4
+
5
+ export const StatusCode = styled(Button).attrs(() => ({
6
+ variant: 'ghost',
7
+ }))<{ status: string }>`
8
+ gap: 0;
9
+ border: 0;
8
10
 
9
11
  &:before {
10
12
  display: inline-block;
@@ -245,6 +245,13 @@ export const darkMode = css`
245
245
  --tab-bg-color-filled: var(--color-warm-grey-4); // @presenter Color
246
246
  --tab-content-color-disabled: var(--color-warm-grey-4); // @presenter Color
247
247
 
248
+ /**
249
+ * @tokens Dropdown Colors
250
+ * @presenter Color
251
+ */
252
+
253
+ --dropdown-content-color-default: var(--color-warm-grey-8); // @presenter Color
254
+
248
255
  /**
249
256
  * @tokens API Reference Schema Required styles
250
257
  */
@@ -18,6 +18,7 @@ export const ChevronDownIcon = styled(Icon).attrs(() => ({
18
18
  fill: ${({ color }) => getCssColorVariable(color)};
19
19
  }
20
20
 
21
+ flex-shrink: 0;
21
22
  height: ${({ size }) => size || '16px'};
22
23
  width: ${({ size }) => size || '16px'};
23
24
  `;
@@ -18,6 +18,7 @@ export const ChevronUpIcon = styled(Icon).attrs(() => ({
18
18
  fill: ${({ color }) => getCssColorVariable(color)};
19
19
  }
20
20
 
21
+ flex-shrink: 0;
21
22
  height: ${({ size }) => size || '16px'};
22
23
  width: ${({ size }) => size || '16px'};
23
24
  `;