@redocly/theme 0.48.0 → 0.48.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/components/Feedback/Mood.js +14 -9
- package/lib/components/Search/SearchDialog.js +9 -3
- package/lib/components/Search/variables.js +4 -0
- package/lib/components/Segmented/Segmented.d.ts +4 -4
- package/lib/components/Segmented/Segmented.js +4 -7
- package/lib/components/Tag/Tag.d.ts +1 -0
- package/lib/components/Tag/Tag.js +3 -2
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.d.ts +1 -1
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +10 -5
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +1 -2
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +20 -15
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough.d.ts +2 -7
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough.js +10 -3
- package/lib/core/hooks/code-walkthrough/use-renderable-files.d.ts +9 -0
- package/lib/core/hooks/code-walkthrough/use-renderable-files.js +28 -0
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/utils/download-code-walkthrough.js +9 -1
- package/lib/core/utils/find-closest-common-directory.d.ts +6 -0
- package/lib/core/utils/find-closest-common-directory.js +51 -0
- package/lib/core/utils/get-file-icon.js +6 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/core/utils/replace-inputs-with-value.d.ts +1 -1
- package/lib/core/utils/replace-inputs-with-value.js +9 -10
- package/lib/icons/DocumentJavaIcon/DocumentJavaIcon.d.ts +9 -0
- package/lib/icons/DocumentJavaIcon/DocumentJavaIcon.js +22 -0
- package/lib/icons/DocumentJavaIcon/index.d.ts +1 -0
- package/lib/icons/DocumentJavaIcon/index.js +6 -0
- package/lib/icons/DocumentPythonIcon/DocumentPythonIcon.d.ts +9 -0
- package/lib/icons/DocumentPythonIcon/DocumentPythonIcon.js +23 -0
- package/lib/icons/DocumentPythonIcon/index.d.ts +1 -0
- package/lib/icons/DocumentPythonIcon/index.js +6 -0
- package/lib/icons/DocumentShellIcon/DocumentShellIcon.d.ts +9 -0
- package/lib/icons/DocumentShellIcon/DocumentShellIcon.js +22 -0
- package/lib/icons/DocumentShellIcon/index.d.ts +1 -0
- package/lib/icons/DocumentShellIcon/index.js +6 -0
- package/lib/icons/__tests__/IconTestUtils.d.ts +7 -0
- package/lib/icons/__tests__/IconTestUtils.js +33 -0
- package/lib/layouts/CodeWalkthroughLayout.js +4 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +15 -2
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +29 -23
- package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +6 -3
- package/lib/markdoc/components/CodeWalkthrough/CodeToggle.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/Input.js +4 -2
- package/lib/markdoc/tags/code-walkthrough.js +5 -0
- package/package.json +3 -3
- package/src/components/Feedback/Mood.tsx +16 -7
- package/src/components/Search/SearchDialog.tsx +52 -36
- package/src/components/Search/variables.ts +4 -0
- package/src/components/Segmented/Segmented.tsx +10 -10
- package/src/components/Tag/Tag.tsx +1 -1
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +9 -3
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +30 -18
- package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +13 -13
- package/src/core/hooks/code-walkthrough/use-renderable-files.ts +51 -0
- package/src/core/hooks/index.ts +1 -0
- package/src/core/types/l10n.ts +3 -1
- package/src/core/utils/download-code-walkthrough.ts +14 -2
- package/src/core/utils/find-closest-common-directory.ts +51 -0
- package/src/core/utils/get-file-icon.ts +7 -0
- package/src/core/utils/index.ts +1 -0
- package/src/core/utils/replace-inputs-with-value.ts +12 -9
- package/src/icons/DocumentJavaIcon/DocumentJavaIcon.tsx +33 -0
- package/src/icons/DocumentJavaIcon/index.ts +1 -0
- package/src/icons/DocumentPythonIcon/DocumentPythonIcon.tsx +37 -0
- package/src/icons/DocumentPythonIcon/index.ts +1 -0
- package/src/icons/DocumentShellIcon/DocumentShellIcon.tsx +33 -0
- package/src/icons/DocumentShellIcon/index.ts +1 -0
- package/src/icons/__tests__/IconTestUtils.tsx +31 -0
- package/src/layouts/CodeWalkthroughLayout.tsx +5 -1
- package/src/markdoc/components/CodeWalkthrough/CodeContainer.tsx +1 -0
- package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +19 -3
- package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +64 -47
- package/src/markdoc/components/CodeWalkthrough/CodePanelPreview.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/CodePanelToolbar.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +6 -2
- package/src/markdoc/components/CodeWalkthrough/CodeToggle.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +4 -1
- package/src/markdoc/components/CodeWalkthrough/Input.tsx +4 -2
- package/src/markdoc/tags/code-walkthrough.ts +5 -0
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceInputsWithValue = replaceInputsWithValue;
|
|
4
|
-
const inputRegex = /(?:\/\*|<!--|#|\/\/)\s*@redocly-input\s*\{"id":\s*"(.*?)"\}\s*(?:\*\/|-->)?/g;
|
|
5
4
|
function replaceInputsWithValue(node, inputs) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
5
|
+
const validKeys = Object.entries(inputs)
|
|
6
|
+
.filter(([_, input]) => input.value)
|
|
7
|
+
.map(([key]) => key)
|
|
8
|
+
.join('|');
|
|
9
|
+
if (!validKeys) {
|
|
10
|
+
return node;
|
|
11
|
+
}
|
|
12
|
+
const inputRegex = new RegExp(`\\{\\{\\s*(${validKeys})\\s*\\}\\}`, 'g');
|
|
13
|
+
return node.replace(inputRegex, (_, inputKey) => { var _a; return (_a = inputs[inputKey]) === null || _a === void 0 ? void 0 : _a.value; });
|
|
15
14
|
}
|
|
16
15
|
//# sourceMappingURL=replace-inputs-with-value.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../../icons/types';
|
|
3
|
+
export declare const DocumentJavaIcon: import("styled-components").StyledComponent<(props: IconProps) => React.JSX.Element, any, {
|
|
4
|
+
'data-component-name': string;
|
|
5
|
+
} & {
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & React.SVGProps<SVGSVGElement>, "data-component-name">;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DocumentJavaIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const utils_1 = require("../../core/utils");
|
|
10
|
+
const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
11
|
+
react_1.default.createElement("path", { d: "M2 13H14V14H2V13ZM14 2H3.5C3.36739 2 3.24021 2.05268 3.14645 2.14645C3.05268 2.24021 3 2.36739 3 2.5V9C3 9.53043 3.21071 10.0391 3.58579 10.4142C3.96086 10.7893 4.46957 11 5 11H10C10.5304 11 11.0391 10.7893 11.4142 10.4142C11.7893 10.0391 12 9.53043 12 9V7H14C14.2652 7 14.5196 6.89464 14.7071 6.70711C14.8946 6.51957 15 6.26522 15 6V3C15 2.73478 14.8946 2.48043 14.7071 2.29289C14.5196 2.10536 14.2652 2 14 2ZM14 6H12V3H14V6Z", fill: "#3B3C45" })));
|
|
12
|
+
exports.DocumentJavaIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
13
|
+
'data-component-name': 'icons/DocumentJavaIcon/DocumentJavaIcon',
|
|
14
|
+
})) `
|
|
15
|
+
path {
|
|
16
|
+
fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
height: ${({ size }) => size || '16px'};
|
|
20
|
+
width: ${({ size }) => size || '16px'};
|
|
21
|
+
`;
|
|
22
|
+
//# sourceMappingURL=DocumentJavaIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DocumentJavaIcon } from '../../icons/DocumentJavaIcon/DocumentJavaIcon';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentJavaIcon = void 0;
|
|
4
|
+
var DocumentJavaIcon_1 = require("../../icons/DocumentJavaIcon/DocumentJavaIcon");
|
|
5
|
+
Object.defineProperty(exports, "DocumentJavaIcon", { enumerable: true, get: function () { return DocumentJavaIcon_1.DocumentJavaIcon; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../../icons/types';
|
|
3
|
+
export declare const DocumentPythonIcon: import("styled-components").StyledComponent<(props: IconProps) => React.JSX.Element, any, {
|
|
4
|
+
'data-component-name': string;
|
|
5
|
+
} & {
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & React.SVGProps<SVGSVGElement>, "data-component-name">;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DocumentPythonIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const utils_1 = require("../../core/utils");
|
|
10
|
+
const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
11
|
+
react_1.default.createElement("path", { d: "M6.57325 1.33301C6.06757 1.33301 5.5826 1.53389 5.22504 1.89146C4.86747 2.24903 4.66659 2.734 4.66659 3.23967V4.35967H7.52659C7.78659 4.35967 7.99992 4.73967 7.99992 4.99967H3.23992C2.73424 4.99967 2.24927 5.20055 1.8917 5.55812C1.53413 5.91569 1.33325 6.40066 1.33325 6.90634V9.42701C1.33325 9.93269 1.53413 10.4177 1.8917 10.7752C2.24927 11.1328 2.73424 11.3337 3.23992 11.3337H4.02659V9.54701C4.02571 9.29694 4.07421 9.04915 4.1693 8.81786C4.26439 8.58657 4.4042 8.37633 4.58072 8.19919C4.75724 8.02206 4.96699 7.88151 5.19794 7.78561C5.4289 7.6897 5.67651 7.64034 5.92659 7.64034H9.42659C10.4799 7.64034 11.3333 6.79301 11.3333 5.73967V3.23967C11.3333 2.734 11.1324 2.24903 10.7748 1.89146C10.4172 1.53389 9.93227 1.33301 9.42659 1.33301H6.57325ZM6.09325 2.40634C6.35992 2.40634 6.57325 2.48634 6.57325 2.87967C6.57325 3.27301 6.35992 3.47367 6.09325 3.47367C5.83325 3.47367 5.61992 3.27367 5.61992 2.88034C5.61992 2.48701 5.83325 2.40634 6.09325 2.40634Z", fill: "#3B3C45" }),
|
|
12
|
+
react_1.default.createElement("path", { d: "M11.9727 4.66699V6.45366C11.9735 6.70367 11.925 6.95139 11.8298 7.1826C11.7347 7.41381 11.5949 7.62397 11.4184 7.80104C11.2419 7.97811 11.0321 8.1186 10.8012 8.21446C10.5703 8.31032 10.3228 8.35966 10.0727 8.35966H6.57341C6.32334 8.35878 6.07556 8.40728 5.84427 8.50237C5.61298 8.59746 5.40274 8.73727 5.2256 8.91379C5.04846 9.09031 4.90791 9.30006 4.81201 9.53102C4.71611 9.76197 4.66675 10.0096 4.66675 10.2597V12.7597C4.66675 13.2653 4.86763 13.7503 5.2252 14.1079C5.58277 14.4654 6.06774 14.6663 6.57341 14.6663H9.42675C9.93231 14.6663 10.4172 14.4655 10.7747 14.1081C11.1323 13.7507 11.3332 13.2659 11.3334 12.7603V11.6403H8.47275C8.21275 11.6403 8.00008 11.2603 8.00008 11.0003H12.7601C13.2658 11.0003 13.7507 10.7994 14.1083 10.4419C14.4659 10.0843 14.6667 9.59934 14.6667 9.09366V6.57366C14.6667 6.06798 14.4659 5.58301 14.1083 5.22544C13.7507 4.86787 13.2658 4.66699 12.7601 4.66699H11.9727ZM5.54675 7.67566L5.54408 7.67833L5.56941 7.67566H5.54675ZM9.90675 12.5263C10.1667 12.5263 10.3801 12.7263 10.3801 13.1197C10.3801 13.1818 10.3678 13.2434 10.3441 13.3008C10.3203 13.3582 10.2854 13.4104 10.2414 13.4544C10.1975 13.4983 10.1453 13.5332 10.0879 13.557C10.0305 13.5807 9.96891 13.593 9.90675 13.593C9.64008 13.593 9.42675 13.513 9.42675 13.1197C9.42675 12.7263 9.64008 12.5263 9.90675 12.5263Z", fill: "#3B3C45" })));
|
|
13
|
+
exports.DocumentPythonIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
14
|
+
'data-component-name': 'icons/DocumentPythonIcon/DocumentPythonIcon',
|
|
15
|
+
})) `
|
|
16
|
+
path {
|
|
17
|
+
fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
height: ${({ size }) => size || '16px'};
|
|
21
|
+
width: ${({ size }) => size || '16px'};
|
|
22
|
+
`;
|
|
23
|
+
//# sourceMappingURL=DocumentPythonIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DocumentPythonIcon } from '../../icons/DocumentPythonIcon/DocumentPythonIcon';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentPythonIcon = void 0;
|
|
4
|
+
var DocumentPythonIcon_1 = require("../../icons/DocumentPythonIcon/DocumentPythonIcon");
|
|
5
|
+
Object.defineProperty(exports, "DocumentPythonIcon", { enumerable: true, get: function () { return DocumentPythonIcon_1.DocumentPythonIcon; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../../icons/types';
|
|
3
|
+
export declare const DocumentShellIcon: import("styled-components").StyledComponent<(props: IconProps) => React.JSX.Element, any, {
|
|
4
|
+
'data-component-name': string;
|
|
5
|
+
} & {
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & React.SVGProps<SVGSVGElement>, "data-component-name">;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DocumentShellIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const utils_1 = require("../../core/utils");
|
|
10
|
+
const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
11
|
+
react_1.default.createElement("path", { d: "M14.5351 2.99992H3.83862C3.6752 3.00407 3.51738 3.06029 3.38814 3.16039C3.25891 3.26049 3.16501 3.39924 3.12012 3.55642L1.02012 12.4434C0.998149 12.5106 0.993246 12.5822 1.00585 12.6518C1.01845 12.7213 1.04817 12.7867 1.09232 12.8419C1.13646 12.8971 1.19365 12.9404 1.25874 12.968C1.32382 12.9956 1.39474 13.0066 1.46512 12.9999H12.1616C12.3249 12.9957 12.4827 12.9394 12.6118 12.8393C12.7409 12.7392 12.8348 12.6005 12.8796 12.4434L14.9801 3.55592C15.002 3.48876 15.0068 3.41722 14.9942 3.34773C14.9815 3.27825 14.9518 3.213 14.9076 3.15785C14.8635 3.10271 14.8064 3.05941 14.7413 3.03184C14.6763 3.00427 14.6054 2.9933 14.5351 2.99992ZM4.31312 11.8984C4.16872 11.9865 3.99731 12.0194 3.83057 11.9909C3.66383 11.9624 3.51306 11.8745 3.40612 11.7434L3.40262 11.7389C3.35483 11.6781 3.32075 11.6076 3.30269 11.5324C3.28463 11.4572 3.28302 11.3789 3.29797 11.303C3.31292 11.2271 3.34409 11.1554 3.38933 11.0926C3.43457 11.0298 3.49283 10.9776 3.56012 10.9394L8.36012 7.90892L5.30912 4.98292L5.30412 4.97792C5.24784 4.92482 5.20377 4.86011 5.17497 4.78829C5.14616 4.71647 5.13332 4.63924 5.13731 4.56196C5.14131 4.48469 5.16205 4.4092 5.1981 4.34073C5.23416 4.27226 5.28466 4.21244 5.34612 4.16542L5.36462 4.15042C5.49395 4.04749 5.65594 3.9944 5.82112 4.00082C5.98629 4.00725 6.14367 4.07275 6.26462 4.18542L9.88112 7.66392C9.96402 7.76867 10.006 7.90001 9.99912 8.03342C9.99485 8.11013 9.97427 8.18504 9.93875 8.25316C9.90323 8.32127 9.85358 8.38102 9.79312 8.42842C9.75612 8.44842 9.72012 8.48792 4.31762 11.8959L4.31312 11.8984ZM12.0001 11.4699C11.9905 11.6194 11.9221 11.7589 11.81 11.8582C11.6979 11.9575 11.5511 12.0084 11.4016 11.9999H8.58462C8.51096 12.0071 8.43662 11.9987 8.36638 11.9754C8.29614 11.9521 8.23156 11.9144 8.17677 11.8646C8.12199 11.8149 8.07822 11.7542 8.04828 11.6865C8.01834 11.6188 8.00289 11.5457 8.00293 11.4716C8.00296 11.3976 8.01848 11.3245 8.04848 11.2568C8.07849 11.1892 8.12231 11.1285 8.17714 11.0788C8.23197 11.0291 8.2966 10.9915 8.36686 10.9682C8.43712 10.945 8.51147 10.9367 8.58512 10.9439H11.4016C11.5503 10.9353 11.6965 10.9855 11.8085 11.0837C11.9205 11.182 11.9893 11.3203 12.0001 11.4689V11.4699Z", fill: "#3B3C45" })));
|
|
12
|
+
exports.DocumentShellIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
13
|
+
'data-component-name': 'icons/DocumentShellIcon/DocumentShellIcon',
|
|
14
|
+
})) `
|
|
15
|
+
path {
|
|
16
|
+
fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
height: ${({ size }) => size || '16px'};
|
|
20
|
+
width: ${({ size }) => size || '16px'};
|
|
21
|
+
`;
|
|
22
|
+
//# sourceMappingURL=DocumentShellIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DocumentShellIcon } from '../../icons/DocumentShellIcon/DocumentShellIcon';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentShellIcon = void 0;
|
|
4
|
+
var DocumentShellIcon_1 = require("../../icons/DocumentShellIcon/DocumentShellIcon");
|
|
5
|
+
Object.defineProperty(exports, "DocumentShellIcon", { enumerable: true, get: function () { return DocumentShellIcon_1.DocumentShellIcon; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
export declare function testIconComponent(IconComponent: React.ComponentType<any>, componentName: string): {
|
|
4
|
+
rendersCorrectlyWithDefaultProps: () => void;
|
|
5
|
+
appliesCustomSizeAndColor: () => void;
|
|
6
|
+
hasCorrectDataComponentName: () => void;
|
|
7
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.testIconComponent = testIconComponent;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_2 = require("@testing-library/react");
|
|
9
|
+
require("@testing-library/jest-dom");
|
|
10
|
+
function testIconComponent(IconComponent, componentName) {
|
|
11
|
+
const dataName = `icons/${componentName}/${componentName}`;
|
|
12
|
+
return {
|
|
13
|
+
rendersCorrectlyWithDefaultProps: () => {
|
|
14
|
+
const { container } = (0, react_2.render)(react_1.default.createElement(IconComponent, null));
|
|
15
|
+
const svgElement = container.querySelector('svg');
|
|
16
|
+
expect(svgElement).toBeInTheDocument();
|
|
17
|
+
expect(container.firstChild).toHaveStyle('height: 16px; width: 16px;');
|
|
18
|
+
},
|
|
19
|
+
appliesCustomSizeAndColor: () => {
|
|
20
|
+
const { container } = (0, react_2.render)(react_1.default.createElement(IconComponent, { size: "24px", color: "--color-primary" }));
|
|
21
|
+
const svgElement = container.querySelector('svg');
|
|
22
|
+
expect(svgElement).toBeInTheDocument();
|
|
23
|
+
expect(container.firstChild).toHaveStyle('height: 24px; width: 24px;');
|
|
24
|
+
const pathElement = container.querySelector('path');
|
|
25
|
+
expect(pathElement).toHaveStyle('fill: var(--color-primary);');
|
|
26
|
+
},
|
|
27
|
+
hasCorrectDataComponentName: () => {
|
|
28
|
+
const { container } = (0, react_2.render)(react_1.default.createElement(IconComponent, null));
|
|
29
|
+
expect(container.firstChild).toHaveAttribute('data-component-name', dataName);
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=IconTestUtils.js.map
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CodeWalkthroughLayout = CodeWalkthroughLayout;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const core_1 = require("../core");
|
|
9
10
|
function CodeWalkthroughLayout({ className, children, }) {
|
|
10
11
|
return (react_1.default.createElement(LayoutWrapper, { "data-component-name": "Layout/CodeWalkthroughLayout", className: className },
|
|
11
12
|
react_1.default.createElement(ContentWrapper, null, children)));
|
|
@@ -59,8 +60,10 @@ const ContentWrapper = styled_components_1.default.section `
|
|
|
59
60
|
|
|
60
61
|
/* Full-width styling for all .code-walkthroughs */
|
|
61
62
|
.code-walkthrough {
|
|
62
|
-
max-width: none;
|
|
63
63
|
width: 100%;
|
|
64
|
+
max-width: ${core_1.breakpoints.max};
|
|
65
|
+
margin-left: auto;
|
|
66
|
+
margin-right: auto;
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
&:first-child > h1:first-child {
|
|
@@ -43,7 +43,7 @@ function CodeContainer({ highlightedCode, toolbar, }) {
|
|
|
43
43
|
}
|
|
44
44
|
}, 200);
|
|
45
45
|
}, [activeStep]);
|
|
46
|
-
return (react_1.default.createElement(CodeContainerWrapper, { ref: compRef, hideCodeColors: !isHovered, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) },
|
|
46
|
+
return (react_1.default.createElement(CodeContainerWrapper, { "data-component-name": "Markdoc/CodeWalkthrough/CodeContainer", ref: compRef, hideCodeColors: !isHovered, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) },
|
|
47
47
|
react_1.default.createElement(CodeBlockContainer_1.CodeBlockContainer, { dangerouslySetInnerHTML: { __html: highlightedCode } }),
|
|
48
48
|
toolbar));
|
|
49
49
|
}
|
|
@@ -11,7 +11,7 @@ function CodeFilters({ filters, getFilterState, handleFilterSelect, filtersEleme
|
|
|
11
11
|
if (filters.length === 0) {
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
|
-
return (react_1.default.createElement(FilterWrapper, { ref: filtersElementRef }, filters.map(({ label, items, id }) => {
|
|
14
|
+
return (react_1.default.createElement(FilterWrapper, { ref: filtersElementRef, "data-component-name": "Markdoc/CodeWalkthrough/CodeFilters" }, filters.map(({ label, items, id }) => {
|
|
15
15
|
return (react_1.default.createElement(Filter, { key: id },
|
|
16
16
|
label && react_1.default.createElement(FilterName, null,
|
|
17
17
|
label,
|
|
@@ -24,8 +24,9 @@ function CodeFilters({ filters, getFilterState, handleFilterSelect, filtersEleme
|
|
|
24
24
|
}
|
|
25
25
|
const Filter = styled_components_1.default.div `
|
|
26
26
|
display: flex;
|
|
27
|
-
align-items:
|
|
27
|
+
align-items: flex-start;
|
|
28
28
|
gap: var(--spacing-xs);
|
|
29
|
+
max-width: 100%;
|
|
29
30
|
`;
|
|
30
31
|
const FilterName = styled_components_1.default.div `
|
|
31
32
|
color: var(--color-text-primary);
|
|
@@ -46,13 +47,25 @@ const FilterWrapper = styled_components_1.default.div `
|
|
|
46
47
|
top: calc(var(--navbar-height));
|
|
47
48
|
background-color: var(--bg-color);
|
|
48
49
|
z-index: 1;
|
|
50
|
+
max-width: var(--md-content-max-width);
|
|
49
51
|
`;
|
|
50
52
|
const ButtonsWrapper = styled_components_1.default.div `
|
|
51
53
|
display: flex;
|
|
54
|
+
min-width: 0;
|
|
55
|
+
flex-wrap: wrap;
|
|
52
56
|
`;
|
|
53
57
|
const TagButton = (0, styled_components_1.default)(Tag_1.Tag) `
|
|
54
58
|
cursor: pointer;
|
|
55
59
|
padding: 0px var(--spacing-xs);
|
|
56
60
|
margin-right: var(--spacing-xs);
|
|
61
|
+
max-width: 100%;
|
|
62
|
+
margin-bottom: var(--spacing-xs);
|
|
63
|
+
|
|
64
|
+
${Tag_1.ContentWrapper} {
|
|
65
|
+
display: inline-block;
|
|
66
|
+
text-overflow: ellipsis;
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
}
|
|
57
70
|
`;
|
|
58
71
|
//# sourceMappingURL=CodeFilters.js.map
|
|
@@ -38,7 +38,7 @@ const CodePanelToolbar_1 = require("../../../markdoc/components/CodeWalkthrough/
|
|
|
38
38
|
function CodePanel({ files, downloadAssociatedFiles, preview, }) {
|
|
39
39
|
const { activeFile, handleTabSwitch, highlightedCode } = (0, hooks_1.useCodePanel)(files);
|
|
40
40
|
const { handleDownloadCode } = (0, react_1.useContext)(contexts_1.CodeWalkthroughControlsStateContext);
|
|
41
|
-
return (react_1.default.createElement(CodePanelWrapper,
|
|
41
|
+
return (react_1.default.createElement(CodePanelWrapper, { "data-component-name": "Markdoc/CodeWalkthrough/CodePanel" },
|
|
42
42
|
preview ? (react_1.default.createElement(CodePanelPreview_1.CodePanelPreview, null, preview.map((element, idx) => (react_1.default.createElement(react_1.default.Fragment, { key: idx }, element))))) : null,
|
|
43
43
|
react_1.default.createElement(CodePanelHeader_1.CodePanelHeader, { files: files, activeTabName: (activeFile === null || activeFile === void 0 ? void 0 : activeFile.path) || '', handleTabSwitch: handleTabSwitch, onDownloadCode: () => handleDownloadCode([...files, ...downloadAssociatedFiles]) }),
|
|
44
44
|
react_1.default.createElement(CodeContainer_1.CodeContainer, { key: (activeFile === null || activeFile === void 0 ? void 0 : activeFile.path) || '', highlightedCode: highlightedCode, toolbar: react_1.default.createElement(CodePanelToolbar_1.CodePanelToolbar, { file: activeFile }) })));
|
|
@@ -27,7 +27,6 @@ exports.CodePanelHeader = CodePanelHeader;
|
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
29
29
|
const hooks_1 = require("../../../core/hooks");
|
|
30
|
-
const utils_1 = require("../../../core/utils");
|
|
31
30
|
const OverflowMenuVerticalIcon_1 = require("../../../icons/OverflowMenuVerticalIcon/OverflowMenuVerticalIcon");
|
|
32
31
|
const Dropdown_1 = require("../../../components/Dropdown/Dropdown");
|
|
33
32
|
const DropdownMenu_1 = require("../../../components/Dropdown/DropdownMenu");
|
|
@@ -35,6 +34,7 @@ const DropdownMenuItem_1 = require("../../../components/Dropdown/DropdownMenuIte
|
|
|
35
34
|
const DownloadIcon_1 = require("../../../icons/DownloadIcon/DownloadIcon");
|
|
36
35
|
const Button_1 = require("../../../components/Button/Button");
|
|
37
36
|
function CodePanelHeader({ files, handleTabSwitch, activeTabName, onDownloadCode, }) {
|
|
37
|
+
const renderableFiles = (0, hooks_1.useRenderableFiles)(files);
|
|
38
38
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
39
39
|
const { translate } = useTranslate();
|
|
40
40
|
const tabRefs = (0, react_1.useRef)([]);
|
|
@@ -42,47 +42,49 @@ function CodePanelHeader({ files, handleTabSwitch, activeTabName, onDownloadCode
|
|
|
42
42
|
const [hiddenFiles, setHiddenFiles] = (0, react_1.useState)([]);
|
|
43
43
|
(0, react_1.useEffect)(() => {
|
|
44
44
|
const activeTab = tabRefs.current.find((tab) => (tab === null || tab === void 0 ? void 0 : tab.dataset.name) === activeTabName);
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const tabsWrapper = tabsWrapperRef.current;
|
|
46
|
+
if (activeTab && tabsWrapper) {
|
|
47
|
+
const { left: wrapperLeft, right: wrapperRight } = tabsWrapper.getBoundingClientRect();
|
|
48
|
+
const { left: tabLeft, right: tabRight } = activeTab.getBoundingClientRect();
|
|
49
|
+
const tabHidden = tabLeft < wrapperLeft || tabRight > wrapperRight;
|
|
50
|
+
if (tabHidden) {
|
|
51
|
+
activeTab.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
52
|
+
}
|
|
47
53
|
}
|
|
48
|
-
}, [activeTabName]);
|
|
49
|
-
(0, react_1.useEffect)(() => {
|
|
50
54
|
const calculateHiddenFiles = () => {
|
|
51
55
|
if (!tabsWrapperRef.current)
|
|
52
56
|
return;
|
|
53
57
|
const { left: wrapperLeft, right: wrapperRight } = tabsWrapperRef.current.getBoundingClientRect();
|
|
54
|
-
const hidden =
|
|
58
|
+
const hidden = [];
|
|
59
|
+
for (let i = 0; i < renderableFiles.length; i++) {
|
|
55
60
|
const tab = tabRefs.current[i];
|
|
56
61
|
if (!tab)
|
|
57
|
-
|
|
62
|
+
continue;
|
|
58
63
|
const { left: tabLeft, right: tabRight } = tab.getBoundingClientRect();
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
const visible = tabLeft > wrapperLeft && tabRight < wrapperRight;
|
|
65
|
+
if (!visible) {
|
|
66
|
+
hidden.push(renderableFiles[i]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
61
69
|
setHiddenFiles(hidden);
|
|
62
70
|
};
|
|
63
71
|
calculateHiddenFiles();
|
|
64
72
|
window.addEventListener('resize', calculateHiddenFiles);
|
|
65
73
|
return () => window.removeEventListener('resize', calculateHiddenFiles);
|
|
66
|
-
}, [files]);
|
|
67
|
-
const getFileTypeIcon = (0, react_1.useCallback)((basename) => {
|
|
68
|
-
var _a;
|
|
69
|
-
const extension = ((_a = basename.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
|
|
70
|
-
return (0, utils_1.getFileIconByExt)(extension);
|
|
71
|
-
}, []);
|
|
74
|
+
}, [activeTabName, files, renderableFiles]);
|
|
72
75
|
return (react_1.default.createElement(CodePanelHeaderWrapper, { "data-component-name": "Markdoc/CodeWalkthrough/CodePanelHeader" },
|
|
73
76
|
react_1.default.createElement(TabsWrapper, { ref: tabsWrapperRef },
|
|
74
|
-
react_1.default.createElement(Tabs, null,
|
|
75
|
-
const FileIcon = getFileTypeIcon(basename);
|
|
77
|
+
react_1.default.createElement(Tabs, null, renderableFiles.map(({ path, basename, FileIcon, parentFolder, isNameDuplicate, inRootDir }, i) => {
|
|
76
78
|
return (react_1.default.createElement(Tab, { ref: (el) => (tabRefs.current[i] = el), "data-name": path, active: path === activeTabName, key: i, onClick: () => handleTabSwitch(path) },
|
|
77
79
|
react_1.default.createElement(FileIcon, null),
|
|
78
|
-
basename
|
|
80
|
+
basename,
|
|
81
|
+
isNameDuplicate && !inRootDir ? react_1.default.createElement(Dirname, null, parentFolder) : null));
|
|
79
82
|
})),
|
|
80
83
|
react_1.default.createElement(Gradient, null)),
|
|
81
84
|
react_1.default.createElement(ActionBar, null,
|
|
82
85
|
hiddenFiles.length ? (react_1.default.createElement(Dropdown_1.Dropdown, { trigger: react_1.default.createElement(StyledOverflowMenuVerticalIcon, { size: "14px" }), alignment: "end" },
|
|
83
|
-
react_1.default.createElement(StyledDropdownMenu, null, hiddenFiles.map(({ path, basename }, i) => {
|
|
84
|
-
|
|
85
|
-
return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { active: path === activeTabName, key: i, onAction: () => handleTabSwitch(path), prefix: react_1.default.createElement(FileIcon, null), content: basename }));
|
|
86
|
+
react_1.default.createElement(StyledDropdownMenu, null, hiddenFiles.map(({ path, basename, FileIcon, isNameDuplicate, inRootDir, parentFolder }, i) => {
|
|
87
|
+
return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { active: path === activeTabName, key: i, onAction: () => handleTabSwitch(path), prefix: react_1.default.createElement(FileIcon, null), content: isNameDuplicate && !inRootDir ? `${parentFolder}/${basename}` : basename }));
|
|
86
88
|
})))) : null,
|
|
87
89
|
react_1.default.createElement(Button_1.Button, { variant: "text", icon: react_1.default.createElement(DownloadIcon_1.DownloadIcon, null), onClick: onDownloadCode, size: "small" }, translate('codeWalkthrough.download', 'Download')))));
|
|
88
90
|
}
|
|
@@ -108,13 +110,17 @@ const Gradient = styled_components_1.default.div `
|
|
|
108
110
|
`;
|
|
109
111
|
const Tabs = styled_components_1.default.div `
|
|
110
112
|
display: flex;
|
|
111
|
-
overflow-x:
|
|
113
|
+
overflow-x: hidden;
|
|
112
114
|
padding-right: var(--spacing-base);
|
|
113
115
|
|
|
114
116
|
&::-webkit-scrollbar {
|
|
115
117
|
display: none;
|
|
116
118
|
}
|
|
117
119
|
`;
|
|
120
|
+
const Dirname = styled_components_1.default.span `
|
|
121
|
+
font-size: var(--font-size-sm);
|
|
122
|
+
color: var(--text-color-description);
|
|
123
|
+
`;
|
|
118
124
|
const ActionBar = styled_components_1.default.div `
|
|
119
125
|
display: flex;
|
|
120
126
|
`;
|
|
@@ -129,7 +135,7 @@ const Tab = styled_components_1.default.button `
|
|
|
129
135
|
gap: var(--spacing-xs);
|
|
130
136
|
color: var(--text-color-secondary);
|
|
131
137
|
white-space: nowrap;
|
|
132
|
-
|
|
138
|
+
scroll-margin-right: var(--spacing-base);
|
|
133
139
|
${({ active }) => active
|
|
134
140
|
? (0, styled_components_1.css) `
|
|
135
141
|
color: var(--text-color-primary);
|
|
@@ -36,7 +36,7 @@ function CodePanelPreview({ children }) {
|
|
|
36
36
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
37
37
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
38
38
|
const { translate } = useTranslate();
|
|
39
|
-
return (react_1.default.createElement(CodePanelPreviewWrapper,
|
|
39
|
+
return (react_1.default.createElement(CodePanelPreviewWrapper, { "data-component-name": "Markdoc/CodeWalkthrough/CodePanelPreview" },
|
|
40
40
|
react_1.default.createElement(PreviewDropdown, { onClick: () => setIsOpen(!isOpen) },
|
|
41
41
|
translate('codeWalkthrough.preview', 'Preview'),
|
|
42
42
|
isOpen ? react_1.default.createElement(ChevronUpIcon_1.ChevronUpIcon, null) : react_1.default.createElement(ChevronDownIcon_1.ChevronDownIcon, null)),
|
|
@@ -34,7 +34,7 @@ const CopyButton_1 = require("../../../components/Buttons/CopyButton");
|
|
|
34
34
|
function CodePanelToolbar({ file }) {
|
|
35
35
|
const { getFileText } = (0, react_1.useContext)(contexts_1.CodeWalkthroughControlsStateContext);
|
|
36
36
|
const fileContent = getFileText(file);
|
|
37
|
-
return (react_1.default.createElement(CodeToolbarWrapper,
|
|
37
|
+
return (react_1.default.createElement(CodeToolbarWrapper, { "data-component-name": "Markdoc/CodeWalkthrough/CodePanelToolbar" },
|
|
38
38
|
react_1.default.createElement(CopyButton_1.CopyButton, { data: fileContent, type: "compound", variant: "secondary", size: "medium" })));
|
|
39
39
|
}
|
|
40
40
|
const CodeToolbarWrapper = styled_components_1.default.div `
|
|
@@ -41,7 +41,7 @@ function CodeStep({ id, heading, stepKey, when, unless, children, }) {
|
|
|
41
41
|
if (lockObserver) {
|
|
42
42
|
lockObserver.current = true;
|
|
43
43
|
if (compRef.current) {
|
|
44
|
-
compRef.current.scrollIntoView({ behavior: 'smooth', block: '
|
|
44
|
+
compRef.current.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
45
45
|
}
|
|
46
46
|
setActiveStep(id);
|
|
47
47
|
setTimeout(() => {
|
|
@@ -71,7 +71,7 @@ function CodeStep({ id, heading, stepKey, when, unless, children, }) {
|
|
|
71
71
|
}
|
|
72
72
|
const filtersElementHeight = ((_a = filtersElementRef === null || filtersElementRef === void 0 ? void 0 : filtersElementRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight) || 0;
|
|
73
73
|
const navbarHeight = ((_b = document.querySelector('nav')) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0;
|
|
74
|
-
setScrollMarginTop(filtersElementHeight + navbarHeight);
|
|
74
|
+
setScrollMarginTop(filtersElementHeight + navbarHeight + 10);
|
|
75
75
|
return () => {
|
|
76
76
|
if (currentCompRef) {
|
|
77
77
|
unregister(currentCompRef);
|
|
@@ -79,9 +79,12 @@ function CodeStep({ id, heading, stepKey, when, unless, children, }) {
|
|
|
79
79
|
};
|
|
80
80
|
}, [activeStep, register, unregister, filtersElementRef]);
|
|
81
81
|
if (!areConditionsMet({ when, unless })) {
|
|
82
|
+
if (isActive) {
|
|
83
|
+
setActiveStep(null);
|
|
84
|
+
}
|
|
82
85
|
return null;
|
|
83
86
|
}
|
|
84
|
-
return (react_1.default.createElement(exports.StepWrapper, { ref: compRef, isActive: isActive, scrollMarginTop: scrollMarginTop, "data-step-key": stepKey, "data-step-active": isActive, onClick: handleActivateStep, onFocus: handleActivateStep, tabIndex: 0 },
|
|
87
|
+
return (react_1.default.createElement(exports.StepWrapper, { "data-component-name": "Markdoc/CodeWalkthrough/CodeStep", ref: compRef, isActive: isActive, scrollMarginTop: scrollMarginTop, "data-step-key": stepKey, "data-step-active": isActive, onClick: handleActivateStep, onFocus: handleActivateStep, tabIndex: 0 },
|
|
85
88
|
react_1.default.createElement(StepContent, { isActive: isActive },
|
|
86
89
|
heading ? react_1.default.createElement(StepHeading, null, heading) : null,
|
|
87
90
|
children)));
|
|
@@ -41,7 +41,7 @@ function CodeToggle(props) {
|
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
const checked = toggleState.value;
|
|
44
|
-
return (react_1.default.createElement(exports.ToggleWrapper,
|
|
44
|
+
return (react_1.default.createElement(exports.ToggleWrapper, { "data-component-name": "Markdoc/CodeWalkthrough/CodeToggle" },
|
|
45
45
|
react_1.default.createElement(ToggleContentWrapper, null,
|
|
46
46
|
react_1.default.createElement(exports.ToggleSubtitle, null,
|
|
47
47
|
react_1.default.createElement(Switch_1.Switch, { value: checked, onChange: (newValue) => changeToggleState(id, newValue) }),
|
|
@@ -55,7 +55,7 @@ function CodeWalkthrough(_a) {
|
|
|
55
55
|
const { filtersElementRef } = stepsState;
|
|
56
56
|
return (react_1.default.createElement(contexts_1.CodeWalkthroughStepsContext.Provider, { value: stepsState },
|
|
57
57
|
react_1.default.createElement(contexts_1.CodeWalkthroughControlsStateContext.Provider, { value: controlsState },
|
|
58
|
-
react_1.default.createElement(CodeWalkthroughWrapper, { className: "code-walkthrough" },
|
|
58
|
+
react_1.default.createElement(CodeWalkthroughWrapper, { className: "code-walkthrough", "data-component-name": "Markdoc/CodeWalkthrough/CodeWalkthrough" },
|
|
59
59
|
react_1.default.createElement(DocsPanel, null,
|
|
60
60
|
react_1.default.createElement(CodeFilters_1.CodeFilters, { filters: activeFilters, getFilterState: getFilterState, handleFilterSelect: changeFilterState, filtersElementRef: filtersElementRef }),
|
|
61
61
|
react_1.default.createElement(ContentWrapper, null, children)),
|
|
@@ -49,14 +49,15 @@ function Input(props) {
|
|
|
49
49
|
setValue(inputValue);
|
|
50
50
|
debouncedSave(id, inputValue);
|
|
51
51
|
};
|
|
52
|
-
return (react_1.default.createElement(InputWrapper,
|
|
52
|
+
return (react_1.default.createElement(InputWrapper, { "data-component-name": "Markdoc/CodeWalkthrough/Input" },
|
|
53
53
|
label && react_1.default.createElement(Label, null, label),
|
|
54
54
|
react_1.default.createElement(StyledInput, { id: id, value: value, onChange: handleChange, "aria-label": label, placeholder: placeholder })));
|
|
55
55
|
}
|
|
56
56
|
const InputWrapper = styled_components_1.default.div `
|
|
57
57
|
display: flex;
|
|
58
58
|
flex-direction: column;
|
|
59
|
-
margin: var(--
|
|
59
|
+
margin-top: var(--spacing-base);
|
|
60
|
+
margin-bottom: var(--spacing-base);
|
|
60
61
|
`;
|
|
61
62
|
const Label = styled_components_1.default.p `
|
|
62
63
|
color: var(--text-color-secondary);
|
|
@@ -64,6 +65,7 @@ const Label = styled_components_1.default.p `
|
|
|
64
65
|
line-height: var(--line-height-base);
|
|
65
66
|
font-family: var(--font-family-base);
|
|
66
67
|
font-weight: var(--font-weight-medium);
|
|
68
|
+
margin-bottom: var(--spacing-xxs) !important;
|
|
67
69
|
`;
|
|
68
70
|
const StyledInput = styled_components_1.default.input `
|
|
69
71
|
border: 1px solid var(--border-color-primary);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.48.
|
|
3
|
+
"version": "0.48.1",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@types/jest-when": "3.5.5",
|
|
47
47
|
"@types/lodash.debounce": "4.0.9",
|
|
48
48
|
"@types/lodash.throttle": "4.1.9",
|
|
49
|
-
"@types/node": "
|
|
49
|
+
"@types/node": "22.10.5",
|
|
50
50
|
"@types/react": "18.3.9",
|
|
51
51
|
"@types/react-dom": "18.3.5",
|
|
52
52
|
"@types/styled-components": "5.1.34",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"timeago.js": "4.0.2",
|
|
87
87
|
"i18next": "22.4.15",
|
|
88
88
|
"nprogress": "0.2.0",
|
|
89
|
-
"@redocly/config": "0.20.
|
|
89
|
+
"@redocly/config": "0.20.1"
|
|
90
90
|
},
|
|
91
91
|
"scripts": {
|
|
92
92
|
"watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
4
|
|
|
5
5
|
import type { OptionalEmailSettings, ReasonsSettingsSchema } from '@redocly/config';
|
|
6
6
|
import type { ReasonsProps } from '@redocly/theme/components/Feedback/Reasons';
|
|
@@ -161,7 +161,7 @@ export function Mood({ settings, onSubmit, className }: MoodProps): JSX.Element
|
|
|
161
161
|
return (
|
|
162
162
|
<MoodWrapper data-component-name="Feedback/Mood">
|
|
163
163
|
<StyledFormMandatoryFields>
|
|
164
|
-
<Label data-translation-key="feedback.settings.submitText">
|
|
164
|
+
<Label standAlone={true} data-translation-key="feedback.settings.submitText">
|
|
165
165
|
{submitText ||
|
|
166
166
|
translate(
|
|
167
167
|
'feedback.settings.submitText',
|
|
@@ -178,7 +178,7 @@ export function Mood({ settings, onSubmit, className }: MoodProps): JSX.Element
|
|
|
178
178
|
<MoodWrapper data-component-name="Feedback/Mood" className={className}>
|
|
179
179
|
<StyledForm onSubmit={onSubmitMoodForm}>
|
|
180
180
|
<StyledFormMandatoryFields>
|
|
181
|
-
<Label data-translation-key="feedback.settings.label">
|
|
181
|
+
<Label standAlone={true} data-translation-key="feedback.settings.label">
|
|
182
182
|
{label || translate('feedback.settings.label', 'Was this helpful?')}
|
|
183
183
|
</Label>
|
|
184
184
|
<StyledMandatoryFieldContainer>
|
|
@@ -294,12 +294,21 @@ const MoodWrapper = styled.div`
|
|
|
294
294
|
align-items: center;
|
|
295
295
|
`;
|
|
296
296
|
|
|
297
|
-
const Label = styled.h4
|
|
297
|
+
const Label = styled.h4<{ standAlone?: boolean }>`
|
|
298
298
|
font-family: var(--feedback-font-family);
|
|
299
299
|
font-weight: var(--font-weight-regular);
|
|
300
|
-
font-size: var(--feedback-
|
|
301
|
-
line-height: var(--feedback-
|
|
302
|
-
color: var(--feedback-
|
|
300
|
+
font-size: var(--feedback-font-size);
|
|
301
|
+
line-height: var(--feedback-line-height);
|
|
302
|
+
color: var(--feedback-text-color);
|
|
303
|
+
|
|
304
|
+
${({ standAlone = false }) =>
|
|
305
|
+
standAlone &&
|
|
306
|
+
css`
|
|
307
|
+
font-size: var(--feedback-header-font-size);
|
|
308
|
+
line-height: var(--feedback-header-line-height);
|
|
309
|
+
color: var(--feedback-header-text-color);
|
|
310
|
+
`}
|
|
311
|
+
|
|
303
312
|
margin: 0;
|
|
304
313
|
`;
|
|
305
314
|
|