@redocly/theme 0.67.0-next.0 → 0.67.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.
- package/lib/components/Admonition/Admonition.js +9 -9
- package/lib/components/Badge/Badge.d.ts +1 -1
- package/lib/components/Badge/Badge.js +4 -4
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/Button.js +16 -17
- package/lib/components/Buttons/AIAssistantButton.js +2 -0
- package/lib/components/Catalog/CatalogActionsRow.js +3 -1
- package/lib/components/Catalog/CatalogAvatar.d.ts +3 -1
- package/lib/components/Catalog/CatalogAvatar.js +3 -3
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +4 -4
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.js +7 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +6 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +4 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +3 -5
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +15 -11
- package/lib/components/Catalog/CatalogEntityTypeTag.js +5 -5
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +5 -3
- package/lib/components/CatalogClassic/CatalogClassic.d.ts +4 -2
- package/lib/components/CatalogClassic/CatalogClassic.js +3 -1
- package/lib/components/CodeBlock/CodeBlockContainer.js +16 -4
- package/lib/components/CodeBlock/CodeBlockControls.d.ts +2 -1
- package/lib/components/CodeBlock/CodeBlockControls.js +9 -7
- package/lib/components/CodeBlock/CodeBlockTabs.js +2 -2
- package/lib/components/Dropdown/Dropdown.js +6 -6
- package/lib/components/Dropdown/DropdownMenuItem.d.ts +1 -1
- package/lib/components/Feedback/Comment.js +3 -3
- package/lib/components/Feedback/Mood.js +3 -3
- package/lib/components/Filter/FilterContent.js +2 -2
- package/lib/components/Footer/Footer.js +2 -2
- package/lib/components/Footer/FooterColumn.js +2 -2
- package/lib/components/Footer/FooterItem.js +5 -5
- package/lib/components/Image/Image.js +2 -2
- package/lib/components/LastUpdated/LastUpdated.js +2 -2
- package/lib/components/Link/Link.d.ts +2 -19
- package/lib/components/Link/Link.js +2 -9
- package/lib/components/Loaders/Loading.js +2 -2
- package/lib/components/Loaders/SpinnerLoader.js +4 -4
- package/lib/components/Markdown/Markdown.d.ts +7 -10
- package/lib/components/Markdown/Markdown.js +6 -3
- package/lib/components/Marker/Marker.js +3 -3
- package/lib/components/Menu/MenuContainer.d.ts +2 -2
- package/lib/components/Menu/MenuContainer.js +9 -11
- package/lib/components/Menu/MenuItem.js +14 -14
- package/lib/components/Menu/MenuMobile.js +8 -8
- package/lib/components/Navbar/NavbarItem.js +7 -7
- package/lib/components/PageNavigation/NavigationButton.js +3 -3
- package/lib/components/Panel/PanelBody.d.ts +5 -5
- package/lib/components/Panel/PanelBody.js +6 -3
- package/lib/components/Panel/PanelHeader.d.ts +2 -5
- package/lib/components/Panel/PanelHeader.js +6 -2
- package/lib/components/Search/SearchAiMessage.js +10 -8
- package/lib/components/Search/SearchDialog.js +6 -0
- package/lib/components/Search/SearchSuggestedPages.js +2 -2
- package/lib/components/Select/Select.js +3 -1
- package/lib/components/Select/SelectInput.d.ts +1 -0
- package/lib/components/Select/SelectInput.js +8 -8
- package/lib/components/Sidebar/Sidebar.d.ts +4 -2
- package/lib/components/Sidebar/Sidebar.js +10 -8
- package/lib/components/SidebarActions/styled.d.ts +6 -6
- package/lib/components/SidebarActions/styled.js +12 -4
- package/lib/components/StatusCode/StatusCode.d.ts +6 -4
- package/lib/components/StatusCode/StatusCode.js +8 -2
- package/lib/components/Switch/Switch.js +13 -13
- package/lib/components/TableOfContent/TableOfContent.js +2 -2
- package/lib/components/Tag/Tag.js +11 -11
- package/lib/components/Tooltip/AnchorTooltip.js +26 -25
- package/lib/components/Tooltip/JsTooltip.js +5 -5
- package/lib/components/Typography/CompactTypography.d.ts +27 -11
- package/lib/components/Typography/CompactTypography.js +2 -2
- package/lib/components/Typography/Typography.d.ts +6 -2
- package/lib/components/Typography/Typography.js +18 -3
- package/lib/components/UserMenu/UserAvatar.js +5 -5
- package/lib/core/contexts/ThemeDataContext.d.ts +1 -1
- package/lib/core/hooks/feedback/use-report-dialog.d.ts +8 -5
- package/lib/core/styles/global.js +1 -0
- package/lib/core/templates/Markdown.js +5 -6
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/link.d.ts +19 -0
- package/lib/core/types/link.js +3 -0
- package/lib/core/utils/details.d.ts +1 -1
- package/lib/core/utils/details.js +3 -0
- package/lib/core/utils/dom.d.ts +0 -1
- package/lib/core/utils/dom.js +0 -9
- package/lib/core/utils/index.d.ts +0 -1
- package/lib/core/utils/index.js +0 -1
- package/lib/ext/configure-helpers.d.ts +35 -0
- package/lib/ext/configure-helpers.js +3 -0
- package/lib/ext/configure.d.ts +3 -25
- package/lib/ext/configure.js +16 -0
- package/lib/ext/helpers/is-direct-configure-request-values.d.ts +15 -0
- package/lib/ext/helpers/is-direct-configure-request-values.js +42 -0
- package/lib/ext/use-configure-replay.d.ts +1 -1
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.d.ts +1 -1
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +6 -1
- package/lib/icons/AiStarsIcon/AiStarsIcon.d.ts +1 -1
- package/lib/icons/AiStarsIcon/AiStarsIcon.js +6 -1
- package/lib/icons/MagicWandIcon/MagicWandIcon.d.ts +23 -0
- package/lib/icons/MagicWandIcon/MagicWandIcon.js +25 -0
- package/lib/icons/ReturnKeyIcon/ReturnKeyIcon.d.ts +25 -5
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/layouts/DocumentationLayout.js +2 -2
- package/lib/layouts/ThreePanelLayout.d.ts +27 -7
- package/lib/layouts/ThreePanelLayout.js +11 -8
- package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.d.ts +4 -2
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +6 -2
- package/lib/markdoc/components/Image/Image.js +3 -3
- package/lib/markdoc/components/Tabs/TabItemFragment.d.ts +9 -0
- package/lib/markdoc/components/Tabs/TabItemFragment.js +11 -0
- package/lib/markdoc/components/Tabs/TabList.d.ts +7 -4
- package/lib/markdoc/components/Tabs/TabList.js +6 -4
- package/lib/markdoc/components/Tabs/Tabs.d.ts +3 -9
- package/lib/markdoc/components/Tabs/Tabs.js +12 -5
- package/lib/markdoc/components/default.d.ts +1 -0
- package/lib/markdoc/components/default.js +1 -0
- package/lib/markdoc/tags/tab.js +1 -1
- package/lib/markdoc/tags/tabs.js +1 -1
- package/package.json +2 -3
- package/src/components/Admonition/Admonition.tsx +11 -11
- package/src/components/Badge/Badge.tsx +11 -6
- package/src/components/Button/Button.tsx +51 -21
- package/src/components/Buttons/AIAssistantButton.tsx +2 -0
- package/src/components/Catalog/CatalogActionsRow.tsx +3 -1
- package/src/components/Catalog/CatalogAvatar.tsx +6 -10
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +6 -6
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.tsx +14 -14
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +11 -11
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +4 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +8 -11
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +10 -9
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +22 -16
- package/src/components/Catalog/CatalogEntityTypeTag.tsx +8 -8
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +8 -6
- package/src/components/CatalogClassic/CatalogClassic.tsx +3 -1
- package/src/components/CodeBlock/CodeBlockContainer.tsx +23 -7
- package/src/components/CodeBlock/CodeBlockControls.tsx +16 -10
- package/src/components/CodeBlock/CodeBlockTabs.tsx +4 -4
- package/src/components/Dropdown/Dropdown.tsx +9 -9
- package/src/components/Dropdown/DropdownMenuItem.tsx +1 -1
- package/src/components/Feedback/Comment.tsx +5 -5
- package/src/components/Feedback/Mood.tsx +5 -5
- package/src/components/Filter/FilterContent.tsx +4 -4
- package/src/components/Filter/FilterPopover.tsx +1 -1
- package/src/components/Footer/Footer.tsx +4 -4
- package/src/components/Footer/FooterColumn.tsx +3 -3
- package/src/components/Footer/FooterItem.tsx +9 -9
- package/src/components/Image/Image.tsx +3 -3
- package/src/components/LastUpdated/LastUpdated.tsx +4 -4
- package/src/components/Link/Link.tsx +6 -51
- package/src/components/Loaders/Loading.tsx +3 -3
- package/src/components/Loaders/SpinnerLoader.tsx +5 -5
- package/src/components/Markdown/Markdown.tsx +7 -7
- package/src/components/Marker/Marker.tsx +4 -4
- package/src/components/Menu/MenuContainer.tsx +32 -16
- package/src/components/Menu/MenuItem.tsx +34 -29
- package/src/components/Menu/MenuMobile.tsx +12 -12
- package/src/components/Navbar/NavbarItem.tsx +13 -13
- package/src/components/PageNavigation/NavigationButton.tsx +4 -4
- package/src/components/Panel/PanelBody.tsx +7 -4
- package/src/components/Panel/PanelHeader.tsx +9 -4
- package/src/components/Search/SearchAiMessage.tsx +17 -15
- package/src/components/Search/SearchDialog.tsx +6 -0
- package/src/components/Search/SearchSuggestedPages.tsx +20 -5
- package/src/components/Select/Select.tsx +3 -1
- package/src/components/Select/SelectInput.tsx +10 -9
- package/src/components/Sidebar/Sidebar.tsx +15 -13
- package/src/components/SidebarActions/styled.ts +12 -4
- package/src/components/StatusCode/StatusCode.tsx +12 -4
- package/src/components/Switch/Switch.tsx +21 -21
- package/src/components/TableOfContent/TableOfContent.tsx +3 -3
- package/src/components/Tag/Tag.tsx +34 -27
- package/src/components/Tooltip/AnchorTooltip.tsx +50 -42
- package/src/components/Tooltip/JsTooltip.tsx +14 -13
- package/src/components/Typography/CompactTypography.tsx +4 -4
- package/src/components/Typography/Typography.tsx +21 -5
- package/src/components/UserMenu/UserAvatar.tsx +7 -7
- package/src/core/contexts/ThemeDataContext.tsx +1 -1
- package/src/core/hooks/feedback/use-report-dialog.ts +1 -5
- package/src/core/styles/dark.ts +1 -1
- package/src/core/styles/global.ts +1 -0
- package/src/core/templates/Markdown.tsx +6 -7
- package/src/core/types/index.ts +1 -0
- package/src/core/types/link.ts +20 -0
- package/src/core/utils/details.ts +4 -0
- package/src/core/utils/dom.ts +0 -8
- package/src/core/utils/index.ts +0 -1
- package/src/ext/configure-helpers.ts +45 -0
- package/src/ext/configure.ts +6 -26
- package/src/ext/helpers/is-direct-configure-request-values.ts +53 -0
- package/src/ext/use-configure-replay.ts +3 -3
- package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +9 -3
- package/src/icons/AiStarsIcon/AiStarsIcon.tsx +9 -3
- package/src/icons/MagicWandIcon/MagicWandIcon.tsx +26 -0
- package/src/icons/ReturnKeyIcon/ReturnKeyIcon.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/layouts/DocumentationLayout.tsx +3 -3
- package/src/layouts/ThreePanelLayout.tsx +27 -14
- package/src/markdoc/components/CodeWalkthrough/CodeContainer.tsx +4 -4
- package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +4 -4
- package/src/markdoc/components/CodeWalkthrough/CodePanelPreview.tsx +3 -3
- package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +6 -2
- package/src/markdoc/components/Image/Image.tsx +4 -4
- package/src/markdoc/components/Tabs/TabItemFragment.tsx +15 -0
- package/src/markdoc/components/Tabs/TabList.tsx +9 -6
- package/src/markdoc/components/Tabs/Tabs.tsx +21 -15
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/tags/tab.ts +1 -1
- package/src/markdoc/tags/tabs.ts +1 -1
|
@@ -47,16 +47,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
47
47
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.Wrapper = void 0;
|
|
50
51
|
exports.ThreePanelLayout = ThreePanelLayout;
|
|
51
52
|
const react_1 = __importDefault(require("react"));
|
|
52
53
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
53
54
|
const config_1 = require("@redocly/config");
|
|
54
55
|
const utils_1 = require("../core/utils");
|
|
55
56
|
function ThreePanelLayout(_a) {
|
|
56
|
-
var { children } = _a, props = __rest(_a, ["children"]);
|
|
57
|
-
return (react_1.default.createElement(Wrapper, Object.assign({ "data-component-name": "Layout/ThreePanelLayout" }, props), children));
|
|
57
|
+
var { layout, collapsedSidebar, children } = _a, props = __rest(_a, ["layout", "collapsedSidebar", "children"]);
|
|
58
|
+
return (react_1.default.createElement(exports.Wrapper, Object.assign({ "data-component-name": "Layout/ThreePanelLayout" }, props, { $layout: layout, $collapsedSidebar: collapsedSidebar }), children));
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
exports.Wrapper = styled_components_1.default.div.attrs({
|
|
61
|
+
'data-component-name': 'Layout/ThreePanelLayout',
|
|
62
|
+
}) `
|
|
60
63
|
position: relative;
|
|
61
64
|
display: flex;
|
|
62
65
|
flex-direction: column;
|
|
@@ -64,20 +67,20 @@ const Wrapper = styled_components_1.default.div `
|
|
|
64
67
|
margin: 0 auto;
|
|
65
68
|
width: 100%;
|
|
66
69
|
|
|
67
|
-
${({ layout = config_1.LayoutVariant.THREE_PANEL }) => {
|
|
70
|
+
${({ $layout = config_1.LayoutVariant.THREE_PANEL }) => {
|
|
68
71
|
return (0, styled_components_1.css) `
|
|
69
|
-
max-width: ${layout === config_1.LayoutVariant.THREE_PANEL ? '100%' : ''};
|
|
72
|
+
max-width: ${$layout === config_1.LayoutVariant.THREE_PANEL ? '100%' : ''};
|
|
70
73
|
|
|
71
74
|
@media screen and (min-width: ${utils_1.breakpoints.small}) {
|
|
72
|
-
max-width: var(--layout-${layout}-small-max-width);
|
|
75
|
+
max-width: var(--layout-${$layout}-small-max-width);
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
@media screen and (min-width: ${utils_1.breakpoints.medium}) {
|
|
76
|
-
max-width: var(--layout-${layout}-medium-max-width);
|
|
79
|
+
max-width: var(--layout-${$layout}-medium-max-width);
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
@media screen and (min-width: ${utils_1.breakpoints.large}) {
|
|
80
|
-
max-width: var(--layout-${layout}-large-max-width);
|
|
83
|
+
max-width: var(--layout-${$layout}-large-max-width);
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
@media print {
|
|
@@ -74,7 +74,7 @@ function CodeContainer({ highlightedCode, toolbar, }) {
|
|
|
74
74
|
}
|
|
75
75
|
}, 200);
|
|
76
76
|
}, [activeStep]);
|
|
77
|
-
return (react_1.default.createElement(CodeContainerWrapper, { "data-component-name": "Markdoc/CodeWalkthrough/CodeContainer", ref: compRef, hideCodeColors: !isHovered, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) },
|
|
77
|
+
return (react_1.default.createElement(CodeContainerWrapper, { "data-component-name": "Markdoc/CodeWalkthrough/CodeContainer", ref: compRef, $hideCodeColors: !isHovered, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) },
|
|
78
78
|
react_1.default.createElement(CodeBlockContainer_1.CodeBlockContainer, { dangerouslySetInnerHTML: { __html: highlightedCode } }),
|
|
79
79
|
toolbar));
|
|
80
80
|
}
|
|
@@ -98,7 +98,7 @@ const CodeContainerWrapper = styled_components_1.default.div `
|
|
|
98
98
|
span.line::before {
|
|
99
99
|
color: var(--code-panel-line-numbering-color);
|
|
100
100
|
}
|
|
101
|
-
${({ hideCodeColors }) => hideCodeColors &&
|
|
101
|
+
${({ $hideCodeColors }) => $hideCodeColors &&
|
|
102
102
|
(0, styled_components_1.css) `
|
|
103
103
|
.line.greyed-out {
|
|
104
104
|
color: var(--text-color-helper) !important;
|
|
@@ -87,7 +87,7 @@ function CodePanelHeader({ files, handleTabSwitch, activeTabName, onDownloadCode
|
|
|
87
87
|
react_1.default.createElement(Tabs, null, renderableFiles.map(({ path, basename, fileIcon, parentFolder, isNameDuplicate, inRootDir }, i) => {
|
|
88
88
|
return (react_1.default.createElement(Tab, { ref: (el) => {
|
|
89
89
|
tabRefs.current[i] = el;
|
|
90
|
-
}, "data-name": path, active: path === activeTabName, key: i, onClick: () => handleTabSwitch(path) },
|
|
90
|
+
}, "data-name": path, $active: path === activeTabName, key: i, onClick: () => handleTabSwitch(path) },
|
|
91
91
|
fileIcon,
|
|
92
92
|
basename,
|
|
93
93
|
isNameDuplicate && !inRootDir ? react_1.default.createElement(Dirname, null, parentFolder) : null));
|
|
@@ -151,7 +151,7 @@ const Tab = styled_components_1.default.button `
|
|
|
151
151
|
color: var(--text-color-secondary);
|
|
152
152
|
white-space: nowrap;
|
|
153
153
|
scroll-margin-right: var(--spacing-base);
|
|
154
|
-
${({ active }) => active
|
|
154
|
+
${({ $active }) => $active
|
|
155
155
|
? (0, styled_components_1.css) `
|
|
156
156
|
color: var(--text-color-primary);
|
|
157
157
|
background-color: var(--tab-bg-color-filled);
|
|
@@ -50,7 +50,7 @@ function CodePanelPreview({ children }) {
|
|
|
50
50
|
react_1.default.createElement(PreviewDropdown, { onClick: () => setIsOpen(!isOpen) },
|
|
51
51
|
translate('codeWalkthrough.preview', 'Preview'),
|
|
52
52
|
isOpen ? react_1.default.createElement(ChevronUpIcon_1.ChevronUpIcon, null) : react_1.default.createElement(ChevronDownIcon_1.ChevronDownIcon, null)),
|
|
53
|
-
react_1.default.createElement(PreviewContentWrapper, { isOpen: isOpen }, children)));
|
|
53
|
+
react_1.default.createElement(PreviewContentWrapper, { $isOpen: isOpen }, children)));
|
|
54
54
|
}
|
|
55
55
|
const CodePanelPreviewWrapper = styled_components_1.default.div `
|
|
56
56
|
width: 100%;
|
|
@@ -69,7 +69,7 @@ const PreviewDropdown = styled_components_1.default.div `
|
|
|
69
69
|
cursor: pointer;
|
|
70
70
|
`;
|
|
71
71
|
const PreviewContentWrapper = styled_components_1.default.div `
|
|
72
|
-
display: ${({ isOpen }) => (isOpen ? 'grid' : 'none')};
|
|
72
|
+
display: ${({ $isOpen }) => ($isOpen ? 'grid' : 'none')};
|
|
73
73
|
place-items: center;
|
|
74
74
|
|
|
75
75
|
margin: auto 0;
|
|
@@ -5,10 +5,12 @@ export type CodeStepProps = WithConditions<{
|
|
|
5
5
|
heading?: string;
|
|
6
6
|
}>;
|
|
7
7
|
export declare function CodeStep({ id, heading, when, unless, children }: PropsWithChildren<CodeStepProps>): React.JSX.Element | null;
|
|
8
|
-
export declare const StepWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "isActive" | "scrollMarginTop"> & {
|
|
8
|
+
export declare const StepWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "className" | "isActive" | "scrollMarginTop"> & {
|
|
9
9
|
isActive: boolean;
|
|
10
10
|
scrollMarginTop: number;
|
|
11
|
-
|
|
11
|
+
className?: string;
|
|
12
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "className" | "isActive" | "scrollMarginTop"> & {
|
|
12
13
|
isActive: boolean;
|
|
13
14
|
scrollMarginTop: number;
|
|
15
|
+
className?: string;
|
|
14
16
|
}, never>>> & string;
|
|
@@ -107,7 +107,9 @@ function CodeStep({ id, heading, when, unless, children, }) {
|
|
|
107
107
|
heading ? react_1.default.createElement(StepHeading, null, heading) : null,
|
|
108
108
|
children))));
|
|
109
109
|
}
|
|
110
|
-
const StepContent = styled_components_1.default.div
|
|
110
|
+
const StepContent = styled_components_1.default.div.withConfig({
|
|
111
|
+
shouldForwardProp: (prop) => prop !== 'isActive',
|
|
112
|
+
}) `
|
|
111
113
|
margin: var(--spacing-xs) 0px var(--spacing-xs) calc(var(--spacing-unit) * 3.5);
|
|
112
114
|
padding: var(--spacing-md) var(--spacing-lg);
|
|
113
115
|
background: ${({ isActive }) => (isActive ? 'var(--layer-color)' : 'none')};
|
|
@@ -120,7 +122,9 @@ const StepContent = styled_components_1.default.div `
|
|
|
120
122
|
const StepHeading = styled_components_1.default.p `
|
|
121
123
|
font-weight: var(--font-weight-semibold);
|
|
122
124
|
`;
|
|
123
|
-
exports.StepWrapper = styled_components_1.default.div
|
|
125
|
+
exports.StepWrapper = styled_components_1.default.div.withConfig({
|
|
126
|
+
shouldForwardProp: (prop) => !['isActive', 'scrollMarginTop'].includes(prop),
|
|
127
|
+
}) `
|
|
124
128
|
position: relative;
|
|
125
129
|
scroll-margin-top: ${({ scrollMarginTop }) => scrollMarginTop}px;
|
|
126
130
|
|
|
@@ -20,16 +20,16 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
20
20
|
const Image_1 = require("../../../components/Image/Image");
|
|
21
21
|
function Image(props) {
|
|
22
22
|
const { align } = props, rest = __rest(props, ["align"]);
|
|
23
|
-
return align ? (react_1.default.createElement(ImageWrapper, { align: align },
|
|
23
|
+
return align ? (react_1.default.createElement(ImageWrapper, { $align: align },
|
|
24
24
|
react_1.default.createElement(Image_1.Image, Object.assign({}, rest)))) : (react_1.default.createElement(Image_1.Image, Object.assign({}, rest)));
|
|
25
25
|
}
|
|
26
26
|
const ImageWrapper = styled_components_1.default.div `
|
|
27
|
-
text-align: ${(props) => props
|
|
27
|
+
text-align: ${(props) => props.$align || 'initial'};
|
|
28
28
|
|
|
29
29
|
img {
|
|
30
30
|
display: block;
|
|
31
31
|
${(props) => {
|
|
32
|
-
switch (props
|
|
32
|
+
switch (props.$align) {
|
|
33
33
|
case 'left':
|
|
34
34
|
return 'margin-right: auto; margin-left: 0;';
|
|
35
35
|
case 'right':
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { JSX, PropsWithChildren } from 'react';
|
|
3
|
+
export type TabItemProps = PropsWithChildren<{
|
|
4
|
+
label: string;
|
|
5
|
+
disable?: boolean;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
icon?: React.ReactNode | string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function TabItemFragment({ children }: TabItemProps): JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
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.TabItemFragment = TabItemFragment;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
function TabItemFragment({ children }) {
|
|
9
|
+
return react_1.default.createElement("div", null, children);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=TabItemFragment.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { JSX } from 'react';
|
|
3
|
-
import { TabItemProps
|
|
3
|
+
import type { TabItemProps } from '../../../markdoc/components/Tabs/TabItemFragment';
|
|
4
|
+
import { TabsSize } from '../../../markdoc/components/Tabs/Tabs';
|
|
4
5
|
type TabListProps = {
|
|
5
6
|
childrenArray: React.ReactElement<TabItemProps>[];
|
|
6
7
|
size: TabsSize;
|
|
@@ -11,14 +12,16 @@ type TabListProps = {
|
|
|
11
12
|
};
|
|
12
13
|
export declare function TabList({ childrenArray, size, activeTab, onTabChange, containerRef, onReadyChange }: TabListProps): JSX.Element;
|
|
13
14
|
export declare const TabListContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>>> & string;
|
|
14
|
-
export declare const TabItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "active" | "size" | "tabIndex"> & {
|
|
15
|
+
export declare const TabItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "active" | "className" | "size" | "tabIndex"> & {
|
|
16
|
+
tabIndex?: number;
|
|
17
|
+
className?: string;
|
|
15
18
|
active?: boolean;
|
|
16
19
|
size: TabsSize;
|
|
20
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "active" | "className" | "size" | "tabIndex"> & {
|
|
17
21
|
tabIndex?: number;
|
|
18
|
-
|
|
22
|
+
className?: string;
|
|
19
23
|
active?: boolean;
|
|
20
24
|
size: TabsSize;
|
|
21
|
-
tabIndex?: number;
|
|
22
25
|
}, never>>> & string;
|
|
23
26
|
export declare const TabButtonLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<import("../../../index.js").ButtonProps, keyof import("../../../index.js").ButtonProps> & import("../../../index.js").ButtonProps, never> & Partial<Pick<import("styled-components").FastOmit<import("../../../index.js").ButtonProps, keyof import("../../../index.js").ButtonProps> & import("../../../index.js").ButtonProps, never>>, "as" | "forwardedAs"> & {
|
|
24
27
|
as?: import("styled-components").WebTarget | undefined;
|
|
@@ -153,7 +153,7 @@ function TabList({ childrenArray, size, activeTab, onTabChange, containerRef, on
|
|
|
153
153
|
const showAsSelector = visibleTabs.length === 0 && hasOverflow;
|
|
154
154
|
const { dropdownPosition, setIsDropdownOpen, setDropdownPosition } = useDropdownPosition(hasOverflow, dropdownRef);
|
|
155
155
|
return (react_1.default.createElement(exports.TabListContainer, { role: "tablist", ref: containerRef },
|
|
156
|
-
react_1.default.createElement(HighlightBar, { size: size, style: highlightStyle },
|
|
156
|
+
react_1.default.createElement(HighlightBar, { $size: size, style: highlightStyle },
|
|
157
157
|
react_1.default.createElement("div", null)),
|
|
158
158
|
childrenArray.map((child, index) => {
|
|
159
159
|
// Show all tabs before ready (for measurement), then only visible ones
|
|
@@ -258,7 +258,9 @@ exports.TabListContainer = styled_components_1.default.ul `
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
`;
|
|
261
|
-
exports.TabItem = styled_components_1.default.li
|
|
261
|
+
exports.TabItem = styled_components_1.default.li.withConfig({
|
|
262
|
+
shouldForwardProp: (prop) => !['active', 'size'].includes(prop),
|
|
263
|
+
}) `
|
|
262
264
|
display: inline-flex;
|
|
263
265
|
list-style: none;
|
|
264
266
|
cursor: pointer;
|
|
@@ -346,7 +348,7 @@ const HighlightBar = styled_components_1.default.div `
|
|
|
346
348
|
top: 0;
|
|
347
349
|
bottom: 0;
|
|
348
350
|
border: solid var(--md-tabs-active-tab-border-color);
|
|
349
|
-
border-width: var(--md-tabs-${({ size }) => size}-active-tab-border-width);
|
|
351
|
+
border-width: var(--md-tabs-${({ $size }) => $size}-active-tab-border-width);
|
|
350
352
|
transition:
|
|
351
353
|
left 300ms ease-in-out,
|
|
352
354
|
width 300ms ease-in-out;
|
|
@@ -357,7 +359,7 @@ const HighlightBar = styled_components_1.default.div `
|
|
|
357
359
|
width: 100%;
|
|
358
360
|
height: 100%;
|
|
359
361
|
background-color: var(--md-tabs-active-tab-bg-color);
|
|
360
|
-
border-radius: var(--md-tabs-${({ size }) => size}-active-tab-border-radius);
|
|
362
|
+
border-radius: var(--md-tabs-${({ $size }) => $size}-active-tab-border-radius);
|
|
361
363
|
}
|
|
362
364
|
`;
|
|
363
365
|
const TabButtonText = styled_components_1.default.span `
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { JSX } from 'react';
|
|
3
|
+
import { type TabItemProps } from '../../../markdoc/components/Tabs/TabItemFragment';
|
|
4
|
+
export type { TabItemProps } from '../../../markdoc/components/Tabs/TabItemFragment';
|
|
3
5
|
export declare enum TabsSize {
|
|
4
6
|
SMALL = "small",
|
|
5
7
|
MEDIUM = "medium"
|
|
6
8
|
}
|
|
7
|
-
export type TabItemProps = {
|
|
8
|
-
label: string;
|
|
9
|
-
disable?: boolean;
|
|
10
|
-
onClick?: () => void;
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
icon?: React.ReactNode | string;
|
|
13
|
-
};
|
|
14
9
|
type TabsProps = {
|
|
15
10
|
id?: string;
|
|
16
11
|
children: React.ReactElement<TabItemProps>[];
|
|
@@ -19,6 +14,5 @@ type TabsProps = {
|
|
|
19
14
|
initialTab?: string;
|
|
20
15
|
activeTab?: string;
|
|
21
16
|
};
|
|
22
|
-
export declare function Tabs({ id, children, className, size, initialTab: propInitialTab, activeTab: controlledActiveTab }: TabsProps): JSX.Element;
|
|
17
|
+
export declare function Tabs({ id, children, className, size, initialTab: propInitialTab, activeTab: controlledActiveTab }: TabsProps): JSX.Element | null;
|
|
23
18
|
export declare const TabContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
24
|
-
export {};
|
|
@@ -42,6 +42,7 @@ const react_1 = __importStar(require("react"));
|
|
|
42
42
|
const react_router_dom_1 = require("react-router-dom");
|
|
43
43
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
44
44
|
const hooks_1 = require("../../../core/hooks");
|
|
45
|
+
const TabItemFragment_1 = require("../../../markdoc/components/Tabs/TabItemFragment");
|
|
45
46
|
const TabList_1 = require("../../../markdoc/components/Tabs/TabList");
|
|
46
47
|
const utils_1 = require("../../../core/utils");
|
|
47
48
|
var TabsSize;
|
|
@@ -50,13 +51,14 @@ var TabsSize;
|
|
|
50
51
|
TabsSize["MEDIUM"] = "medium";
|
|
51
52
|
})(TabsSize || (exports.TabsSize = TabsSize = {}));
|
|
52
53
|
function Tabs({ id, children, className, size, initialTab: propInitialTab, activeTab: controlledActiveTab, }) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const childrenArray = react_1.default.Children.toArray(children);
|
|
54
|
+
const inRouter = (0, react_router_dom_1.useInRouterContext)();
|
|
55
|
+
const childrenArray = react_1.default.Children.toArray(children).filter(isTabItemFragment);
|
|
56
56
|
const containerRef = (0, react_1.useRef)(null);
|
|
57
|
-
|
|
57
|
+
if (childrenArray.length === 0) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const initialTab = propInitialTab !== null && propInitialTab !== void 0 ? propInitialTab : childrenArray[0].props.label;
|
|
58
61
|
const labelsHash = childrenArray.map((c) => c.props.label).join('|');
|
|
59
|
-
const inRouter = (0, react_router_dom_1.useInRouterContext)();
|
|
60
62
|
return (react_1.default.createElement(TabsView, { id: id, className: className, size: size, childrenArray: childrenArray, initialTab: initialTab, useActiveTab: inRouter ? useActiveTabWithRouter : useActiveTabWithoutRouter, labelsHash: labelsHash, containerRef: containerRef, externalActiveTab: controlledActiveTab }));
|
|
61
63
|
}
|
|
62
64
|
function TabsView({ id, className, size, childrenArray, useActiveTab, initialTab, labelsHash, containerRef, externalActiveTab, }) {
|
|
@@ -74,6 +76,11 @@ function TabsView({ id, className, size, childrenArray, useActiveTab, initialTab
|
|
|
74
76
|
return label === activeTab ? (react_1.default.createElement(exports.TabContent, { key: `content-${tabId}`, id: `panel-${tabId}`, "aria-labelledby": `tab-${tabId}`, tabIndex: 0, role: "tabpanel" }, child.props.children)) : null;
|
|
75
77
|
})));
|
|
76
78
|
}
|
|
79
|
+
function isTabItemFragment(node) {
|
|
80
|
+
if (!(0, react_1.isValidElement)(node))
|
|
81
|
+
return false;
|
|
82
|
+
return node.type === TabItemFragment_1.TabItemFragment;
|
|
83
|
+
}
|
|
77
84
|
/**
|
|
78
85
|
* Validates that the active tab exists in children and resets to initial tab if not found.
|
|
79
86
|
* Ensures tab state remains consistent when tab structure changes.
|
|
@@ -4,6 +4,7 @@ export * from '../../markdoc/components/MarkdocExample/MarkdocExample';
|
|
|
4
4
|
export * from '../../markdoc/components/Heading/Heading';
|
|
5
5
|
export * from '../../markdoc/components/Diagram/Diagram';
|
|
6
6
|
export * from '../../markdoc/components/HtmlBlock/HtmlBlock';
|
|
7
|
+
export * from '../../markdoc/components/Tabs/TabItemFragment';
|
|
7
8
|
export * from '../../markdoc/components/Tabs/Tab';
|
|
8
9
|
export * from '../../markdoc/components/Tabs/TabList';
|
|
9
10
|
export * from '../../markdoc/components/Tabs/Tabs';
|
|
@@ -20,6 +20,7 @@ __exportStar(require("../../markdoc/components/MarkdocExample/MarkdocExample"),
|
|
|
20
20
|
__exportStar(require("../../markdoc/components/Heading/Heading"), exports);
|
|
21
21
|
__exportStar(require("../../markdoc/components/Diagram/Diagram"), exports);
|
|
22
22
|
__exportStar(require("../../markdoc/components/HtmlBlock/HtmlBlock"), exports);
|
|
23
|
+
__exportStar(require("../../markdoc/components/Tabs/TabItemFragment"), exports);
|
|
23
24
|
__exportStar(require("../../markdoc/components/Tabs/Tab"), exports);
|
|
24
25
|
__exportStar(require("../../markdoc/components/Tabs/TabList"), exports);
|
|
25
26
|
__exportStar(require("../../markdoc/components/Tabs/Tabs"), exports);
|
package/lib/markdoc/tags/tab.js
CHANGED
package/lib/markdoc/tags/tabs.js
CHANGED
|
@@ -15,7 +15,7 @@ exports.tabs = {
|
|
|
15
15
|
if ((0, utils_1.isTag)(child) && (child === null || child === void 0 ? void 0 : child.name) === 'CodeBlock') {
|
|
16
16
|
const key = child.attributes['data-language'] || 'default';
|
|
17
17
|
const label = child.attributes['data-label'] || key;
|
|
18
|
-
return new markdoc_1.default.Tag('
|
|
18
|
+
return new markdoc_1.default.Tag('TabItemFragment', { label, key }, [child]);
|
|
19
19
|
}
|
|
20
20
|
return child;
|
|
21
21
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.67.0-next.
|
|
3
|
+
"version": "0.67.0-next.2",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -63,10 +63,9 @@
|
|
|
63
63
|
"vitest": "4.1.8",
|
|
64
64
|
"vitest-when": "0.6.2",
|
|
65
65
|
"webpack": "5.105.2",
|
|
66
|
-
"@redocly/realm-asyncapi-sdk": "0.13.0-next.
|
|
66
|
+
"@redocly/realm-asyncapi-sdk": "0.13.0-next.1"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@emotion/is-prop-valid": "^1.3.1",
|
|
70
69
|
"@tanstack/react-query": "5.62.3",
|
|
71
70
|
"@tanstack/react-virtual": "3.13.0",
|
|
72
71
|
"@xyflow/react": "^12.8.2",
|
|
@@ -39,7 +39,7 @@ export function Admonition({
|
|
|
39
39
|
const Icon = IconsMap[type] || IconsMap['info'];
|
|
40
40
|
return (
|
|
41
41
|
<AdmonitionWrapper
|
|
42
|
-
type={type}
|
|
42
|
+
$type={type}
|
|
43
43
|
className={className}
|
|
44
44
|
data-component-name="Admonition/Admonition"
|
|
45
45
|
data-source={dataSource}
|
|
@@ -47,7 +47,7 @@ export function Admonition({
|
|
|
47
47
|
>
|
|
48
48
|
<Icon color={`--admonition-${type}-icon-color`} />
|
|
49
49
|
<TextContainer>
|
|
50
|
-
{name ? <Heading type={type}>{name}</Heading> : null}
|
|
50
|
+
{name ? <Heading $type={type}>{name}</Heading> : null}
|
|
51
51
|
{children ? <Content>{children}</Content> : null}
|
|
52
52
|
</TextContainer>
|
|
53
53
|
</AdmonitionWrapper>
|
|
@@ -64,7 +64,7 @@ const Content = styled.div`
|
|
|
64
64
|
}
|
|
65
65
|
`;
|
|
66
66
|
|
|
67
|
-
const AdmonitionWrapper = styled.div<AdmonitionTypeProps>`
|
|
67
|
+
const AdmonitionWrapper = styled.div<{ $type: AdmonitionTypeProps['type'] }>`
|
|
68
68
|
display: flex;
|
|
69
69
|
flex-direction: row;
|
|
70
70
|
gap: var(--admonition-gap);
|
|
@@ -78,10 +78,10 @@ const AdmonitionWrapper = styled.div<AdmonitionTypeProps>`
|
|
|
78
78
|
print-color-adjust: exact;
|
|
79
79
|
-webkit-print-color-adjust: exact;
|
|
80
80
|
|
|
81
|
-
${({ type }) => css`
|
|
82
|
-
background-color: var(--admonition-${type}-bg-color);
|
|
83
|
-
color: var(--admonition-${type}-text-color);
|
|
84
|
-
border: var(--admonition-${type}-border);
|
|
81
|
+
${({ $type }) => css`
|
|
82
|
+
background-color: var(--admonition-${$type}-bg-color);
|
|
83
|
+
color: var(--admonition-${$type}-text-color);
|
|
84
|
+
border: var(--admonition-${$type}-border);
|
|
85
85
|
`};
|
|
86
86
|
|
|
87
87
|
&:not(:has(${Content})) {
|
|
@@ -98,9 +98,9 @@ const AdmonitionWrapper = styled.div<AdmonitionTypeProps>`
|
|
|
98
98
|
flex-shrink: 0;
|
|
99
99
|
margin: var(--admonition-icon-margin);
|
|
100
100
|
|
|
101
|
-
fill: ${({ type }) => `var(--admonition-${type}-icon-color)`};
|
|
101
|
+
fill: ${({ $type }) => `var(--admonition-${$type}-icon-color)`};
|
|
102
102
|
|
|
103
|
-
background-image: ${({ type }) => `var(--admonition-${type}-icon)`};
|
|
103
|
+
background-image: ${({ $type }) => `var(--admonition-${$type}-icon)`};
|
|
104
104
|
background-repeat: no-repeat;
|
|
105
105
|
background-position: center;
|
|
106
106
|
background-size: contain;
|
|
@@ -114,9 +114,9 @@ const TextContainer = styled.div`
|
|
|
114
114
|
width: 100%;
|
|
115
115
|
`;
|
|
116
116
|
|
|
117
|
-
const Heading = styled.div<AdmonitionTypeProps>`
|
|
117
|
+
const Heading = styled.div<{ $type: AdmonitionTypeProps['type'] }>`
|
|
118
118
|
letter-spacing: var(--admonition-heading-letter-spacing);
|
|
119
|
-
color: ${({ type }) => `var(--admonition-${type}-heading-text-color)`};
|
|
119
|
+
color: ${({ $type }) => `var(--admonition-${$type}-heading-text-color)`};
|
|
120
120
|
|
|
121
121
|
&& {
|
|
122
122
|
font-size: var(--admonition-heading-font-size);
|
|
@@ -13,29 +13,34 @@ export type BadgeProps = PropsWithChildren<{
|
|
|
13
13
|
icon?: string;
|
|
14
14
|
}>;
|
|
15
15
|
|
|
16
|
-
export function Badge({ icon, children, ...props }: BadgeProps): JSX.Element {
|
|
16
|
+
export function Badge({ icon, children, deprecated, color, ...props }: BadgeProps): JSX.Element {
|
|
17
17
|
return (
|
|
18
|
-
<BadgeComponent
|
|
18
|
+
<BadgeComponent
|
|
19
|
+
{...props}
|
|
20
|
+
$color={color}
|
|
21
|
+
$deprecated={deprecated}
|
|
22
|
+
data-component-name="Badge/Badge"
|
|
23
|
+
>
|
|
19
24
|
{icon ? <BadgeIcon icon={icon} /> : null}
|
|
20
25
|
{children}
|
|
21
26
|
</BadgeComponent>
|
|
22
27
|
);
|
|
23
28
|
}
|
|
24
29
|
|
|
25
|
-
const BadgeComponent = styled.span<
|
|
30
|
+
const BadgeComponent = styled.span<{ $color?: string; $deprecated?: boolean }>`
|
|
26
31
|
display: inline-block;
|
|
27
32
|
padding: 0 var(--spacing-xs);
|
|
28
33
|
vertical-align: middle;
|
|
29
34
|
line-height: var(--line-height-base);
|
|
30
35
|
color: var(--badge-text-color);
|
|
31
|
-
background-color: ${({ color }) => color || 'var(--badge-bg-color)'};
|
|
36
|
+
background-color: ${({ $color }) => $color || 'var(--badge-bg-color)'};
|
|
32
37
|
border-radius: var(--badge-border-radius);
|
|
33
38
|
margin: 0 0 0 0.5em;
|
|
34
39
|
font-size: var(--font-size-base);
|
|
35
40
|
font-weight: var(--font-weight-regular);
|
|
36
41
|
|
|
37
|
-
${({ deprecated }) =>
|
|
38
|
-
deprecated &&
|
|
42
|
+
${({ $deprecated }) =>
|
|
43
|
+
$deprecated &&
|
|
39
44
|
css`
|
|
40
45
|
color: var(--badge-deprecated-text-color);
|
|
41
46
|
background-color: var(--badge-deprecated-bg-color);
|
|
@@ -67,6 +67,7 @@ export function generateClassName({
|
|
|
67
67
|
tone = 'default',
|
|
68
68
|
size = 'medium',
|
|
69
69
|
extraClass = '',
|
|
70
|
+
className = '',
|
|
70
71
|
}: ButtonProps) {
|
|
71
72
|
const classNames = [
|
|
72
73
|
'button',
|
|
@@ -74,6 +75,7 @@ export function generateClassName({
|
|
|
74
75
|
`button-tone-${tone}`,
|
|
75
76
|
`button-variant-${variant}`,
|
|
76
77
|
`button-size-${size}`,
|
|
78
|
+
className,
|
|
77
79
|
];
|
|
78
80
|
|
|
79
81
|
return classNames
|
|
@@ -82,10 +84,16 @@ export function generateClassName({
|
|
|
82
84
|
.trim();
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
const StyledButton = styled.button
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
const StyledButton = styled.button<{
|
|
88
|
+
$icon?: ButtonProps['icon'];
|
|
89
|
+
$iconOnly: boolean;
|
|
90
|
+
$fullWidth?: boolean;
|
|
91
|
+
$blinking?: boolean;
|
|
92
|
+
$iconPosition?: ButtonProps['iconPosition'];
|
|
93
|
+
$variant?: ButtonProps['variant'];
|
|
94
|
+
$size?: ButtonProps['size'];
|
|
95
|
+
}>`
|
|
96
|
+
width: ${({ $fullWidth }) => ($fullWidth ? '100%' : 'auto')};
|
|
89
97
|
|
|
90
98
|
display: inline-flex;
|
|
91
99
|
align-items: center;
|
|
@@ -104,9 +112,9 @@ const StyledButton = styled.button.attrs((props: ButtonProps) => ({
|
|
|
104
112
|
font-weight: var(--button-font-weight);
|
|
105
113
|
font-size: var(--button-font-size);
|
|
106
114
|
line-height: var(--button-line-height);
|
|
107
|
-
padding: ${({ icon, iconPosition, iconOnly }) =>
|
|
108
|
-
icon
|
|
109
|
-
? `var(--button-icon-${iconOnly ? '' : `${iconPosition || 'left'}-`}padding)`
|
|
115
|
+
padding: ${({ $icon, $iconPosition, $iconOnly }) =>
|
|
116
|
+
$icon
|
|
117
|
+
? `var(--button-icon-${$iconOnly ? '' : `${$iconPosition || 'left'}-`}padding)`
|
|
110
118
|
: 'var(--button-padding)'};
|
|
111
119
|
border-radius: var(--button-border-radius);
|
|
112
120
|
|
|
@@ -158,17 +166,17 @@ const StyledButton = styled.button.attrs((props: ButtonProps) => ({
|
|
|
158
166
|
border-width: var(--button-border-width-disabled);
|
|
159
167
|
}
|
|
160
168
|
|
|
161
|
-
${({ variant, size }) =>
|
|
162
|
-
(variant === 'link' || variant === 'ghost') &&
|
|
163
|
-
size === 'small' &&
|
|
169
|
+
${({ $variant, $size }) =>
|
|
170
|
+
($variant === 'link' || $variant === 'ghost') &&
|
|
171
|
+
$size === 'small' &&
|
|
164
172
|
css`
|
|
165
173
|
--button-font-size: var(--font-size-sm);
|
|
166
174
|
--button-line-height: var(--line-height-sm);
|
|
167
175
|
--button-icon-padding: var(--button-icon-padding-small) !important;
|
|
168
176
|
`}
|
|
169
177
|
|
|
170
|
-
${({ blinking }) =>
|
|
171
|
-
blinking &&
|
|
178
|
+
${({ $blinking }) =>
|
|
179
|
+
$blinking &&
|
|
172
180
|
css`
|
|
173
181
|
pointer-events: none;
|
|
174
182
|
animation: ${getBlink()} 1.2s infinite;
|
|
@@ -176,27 +184,49 @@ const StyledButton = styled.button.attrs((props: ButtonProps) => ({
|
|
|
176
184
|
`;
|
|
177
185
|
|
|
178
186
|
const ButtonComponent: React.FC<ButtonProps> = (props) => {
|
|
179
|
-
const {
|
|
187
|
+
const {
|
|
188
|
+
languageInsensitive,
|
|
189
|
+
fullWidth,
|
|
190
|
+
blinking,
|
|
191
|
+
iconPosition,
|
|
192
|
+
icon,
|
|
193
|
+
children,
|
|
194
|
+
variant,
|
|
195
|
+
tone,
|
|
196
|
+
size,
|
|
197
|
+
extraClass,
|
|
198
|
+
to,
|
|
199
|
+
external,
|
|
200
|
+
className,
|
|
201
|
+
...rest
|
|
202
|
+
} = props;
|
|
180
203
|
const tabIndex = 'tabIndex' in props ? props.tabIndex : props.to ? -1 : undefined;
|
|
181
204
|
|
|
182
205
|
const button = (
|
|
183
206
|
<StyledButton
|
|
184
207
|
data-component-name="Button/Button"
|
|
185
|
-
{...
|
|
186
|
-
|
|
208
|
+
{...rest}
|
|
209
|
+
className={generateClassName({ variant, tone, size, extraClass, className })}
|
|
210
|
+
$fullWidth={fullWidth}
|
|
211
|
+
$blinking={blinking}
|
|
212
|
+
$iconPosition={iconPosition}
|
|
213
|
+
$icon={icon}
|
|
214
|
+
$iconOnly={!children && icon != null}
|
|
215
|
+
$variant={variant}
|
|
216
|
+
$size={size}
|
|
187
217
|
tabIndex={tabIndex}
|
|
188
218
|
>
|
|
189
|
-
{
|
|
190
|
-
{
|
|
191
|
-
{
|
|
219
|
+
{icon && iconPosition !== 'right' && icon}
|
|
220
|
+
{children}
|
|
221
|
+
{icon && iconPosition === 'right' && icon}
|
|
192
222
|
</StyledButton>
|
|
193
223
|
);
|
|
194
224
|
|
|
195
|
-
if (
|
|
225
|
+
if (to) {
|
|
196
226
|
return (
|
|
197
227
|
<StyledButtonLink
|
|
198
|
-
to={
|
|
199
|
-
external={
|
|
228
|
+
to={to}
|
|
229
|
+
external={external}
|
|
200
230
|
languageInsensitive={languageInsensitive}
|
|
201
231
|
onClick={props.onClick}
|
|
202
232
|
>
|
|
@@ -79,7 +79,9 @@ export function AIAssistantButton() {
|
|
|
79
79
|
setIsOpen(true);
|
|
80
80
|
telemetry.sendSearchAiOpenedMessage([
|
|
81
81
|
{
|
|
82
|
+
id: 'aiAssistantTriggerButton',
|
|
82
83
|
object: 'search',
|
|
84
|
+
uri: 'urn:redocly:realm:ui:search:aiAssistantTriggerButton',
|
|
83
85
|
method: 'ai_trigger_button',
|
|
84
86
|
},
|
|
85
87
|
]);
|