@redocly/theme 0.9.0-beta.3 → 0.9.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/lib/Button/Button.d.ts +1 -1
  2. package/lib/Button/Button.js +14 -2
  3. package/lib/Cards/Card.d.ts +1 -0
  4. package/lib/Catalog/Catalog.d.ts +1 -0
  5. package/lib/Catalog/CatalogCard.d.ts +1 -0
  6. package/lib/Catalog/Filter.d.ts +1 -0
  7. package/lib/Catalog/Filter.js +1 -3
  8. package/lib/Catalog/Tags.d.ts +1 -0
  9. package/lib/ColorModeSwitcher/ColorModeSwitcher.d.ts +1 -0
  10. package/lib/CopyButton/CopyButton.d.ts +1 -0
  11. package/lib/EditPageButton/EditPageButton.d.ts +1 -0
  12. package/lib/Feedback/Comment.d.ts +1 -0
  13. package/lib/Feedback/Rating.d.ts +1 -0
  14. package/lib/Feedback/Reasons.d.ts +1 -0
  15. package/lib/Feedback/ReportDialog.d.ts +1 -0
  16. package/lib/Feedback/Sentiment.d.ts +1 -0
  17. package/lib/Feedback/Thumbs.d.ts +1 -0
  18. package/lib/Footer/CustomFooter.d.ts +1 -0
  19. package/lib/Footer/CustomFooterNavItem.d.ts +1 -0
  20. package/lib/Footer/Footer.d.ts +1 -0
  21. package/lib/Footer/FooterColumn.d.ts +1 -0
  22. package/lib/Footer/FooterColumns.d.ts +1 -0
  23. package/lib/Footer/FooterCopyright.d.ts +1 -0
  24. package/lib/LastUpdated/LastUpdated.d.ts +1 -0
  25. package/lib/Markdown/Admonition.d.ts +4 -1
  26. package/lib/Markdown/Admonition.js +2 -2
  27. package/lib/Markdown/CodeSample/CodeSample.d.ts +4 -1
  28. package/lib/Markdown/CodeSample/CodeSample.js +2 -2
  29. package/lib/Markdown/Heading.d.ts +3 -1
  30. package/lib/Markdown/Heading.js +6 -4
  31. package/lib/Markdown/Mermaid.d.ts +4 -1
  32. package/lib/Markdown/Mermaid.js +2 -2
  33. package/lib/Markdown/Tabs/Tab.d.ts +1 -0
  34. package/lib/Navbar/MobileNavbarDropdown.d.ts +1 -0
  35. package/lib/Navbar/MobileNavbarItem.d.ts +1 -0
  36. package/lib/Navbar/MobileNavbarMenuButton.d.ts +1 -0
  37. package/lib/Navbar/NavbarDropdown.d.ts +1 -0
  38. package/lib/Navbar/NavbarItem.d.ts +1 -0
  39. package/lib/Navbar/NavbarMenu.d.ts +1 -0
  40. package/lib/NavbarLogo/NavbarLogo.d.ts +1 -0
  41. package/lib/PageNavigation/NextButton.d.ts +1 -0
  42. package/lib/PageNavigation/PageNavigation.d.ts +1 -0
  43. package/lib/PageNavigation/PreviousButton.d.ts +1 -0
  44. package/lib/Pages/Forbidden.d.ts +1 -0
  45. package/lib/Pages/NotFound.d.ts +1 -0
  46. package/lib/Profile/LoginLink.d.ts +1 -0
  47. package/lib/Profile/Profile.js +1 -1
  48. package/lib/Profile/UserProfile.d.ts +1 -0
  49. package/lib/ReferenceDocs/ClearButton.d.ts +8 -0
  50. package/lib/ReferenceDocs/ClearButton.js +48 -0
  51. package/lib/ReferenceDocs/DevOnboardingTryItSecurity.d.ts +3 -0
  52. package/lib/ReferenceDocs/DevOnboardingTryItSecurity.js +158 -0
  53. package/lib/ReferenceDocs/Dropdown.d.ts +28 -0
  54. package/lib/ReferenceDocs/Dropdown.js +150 -0
  55. package/lib/ReferenceDocs/TryItSecurity.d.ts +7 -2
  56. package/lib/ReferenceDocs/TryItSecurity.js +11 -1
  57. package/lib/ReferenceDocs/index.d.ts +1 -0
  58. package/lib/ReferenceDocs/index.js +18 -0
  59. package/lib/Search/Parameters.d.ts +1 -0
  60. package/lib/Search/Search.d.ts +1 -0
  61. package/lib/Search/SearchItem.d.ts +1 -0
  62. package/lib/Search/ShortcutKey.d.ts +1 -0
  63. package/lib/Search/utils.d.ts +1 -0
  64. package/lib/Sidebar/ApiCallItem.d.ts +1 -0
  65. package/lib/Sidebar/ArrowBack.d.ts +1 -0
  66. package/lib/Sidebar/DrilldownMenuItem.d.ts +1 -0
  67. package/lib/Sidebar/ExternalIcon.d.ts +1 -0
  68. package/lib/Sidebar/FooterWrapper.d.ts +3 -0
  69. package/lib/Sidebar/FooterWrapper.js +15 -0
  70. package/lib/Sidebar/HeaderWrapper.d.ts +3 -0
  71. package/lib/Sidebar/HeaderWrapper.js +15 -0
  72. package/lib/Sidebar/MenuGroup.js +1 -1
  73. package/lib/Sidebar/MenuItem.d.ts +1 -0
  74. package/lib/Sidebar/Separator.d.ts +1 -0
  75. package/lib/Sidebar/SidebarLayout.d.ts +1 -1
  76. package/lib/Sidebar/SidebarLayout.js +5 -42
  77. package/lib/Sidebar/index.d.ts +2 -0
  78. package/lib/Sidebar/index.js +2 -0
  79. package/lib/SidebarLogo/SidebarLogo.d.ts +1 -0
  80. package/lib/SourceCode/SourceCode.d.ts +1 -0
  81. package/lib/TableOfContent/TableOfContent.d.ts +1 -0
  82. package/lib/globalStyle.js +2 -1
  83. package/lib/icons/AlertIcon/AlertIcon.d.ts +1 -0
  84. package/lib/icons/AnchorIcon/AnchorIcon.d.ts +7 -0
  85. package/lib/icons/AnchorIcon/AnchorIcon.js +23 -0
  86. package/lib/icons/AnchorIcon/index.d.ts +2 -0
  87. package/lib/icons/AnchorIcon/index.js +6 -0
  88. package/lib/icons/ArrowIcon/ArrowIcon.d.ts +2 -0
  89. package/lib/icons/ArrowIcon/ArrowIcon.js +1 -0
  90. package/lib/icons/ColorModeIcon/ColorModeIcon.d.ts +1 -0
  91. package/lib/icons/index.d.ts +1 -0
  92. package/lib/icons/index.js +1 -0
  93. package/lib/index.d.ts +2 -0
  94. package/lib/index.js +2 -0
  95. package/lib/mocks/Link.d.ts +1 -0
  96. package/lib/mocks/useGlobalData.d.ts +1 -0
  97. package/lib/mocks/useGlobalData.js +8 -0
  98. package/lib/ui/Dropdown.d.ts +1 -0
  99. package/package.json +1 -1
  100. package/src/Button/Button.tsx +22 -5
  101. package/src/Catalog/Filter.tsx +1 -1
  102. package/src/Markdown/Admonition.tsx +13 -1
  103. package/src/Markdown/CodeSample/CodeSample.tsx +15 -2
  104. package/src/Markdown/Heading.tsx +12 -18
  105. package/src/Markdown/Mermaid.tsx +9 -1
  106. package/src/Profile/Profile.tsx +1 -1
  107. package/src/ReferenceDocs/ClearButton.tsx +30 -0
  108. package/src/ReferenceDocs/DevOnboardingTryItSecurity.tsx +161 -0
  109. package/src/ReferenceDocs/Dropdown.tsx +202 -0
  110. package/src/ReferenceDocs/TryItSecurity.tsx +16 -3
  111. package/src/ReferenceDocs/index.ts +1 -0
  112. package/src/Sidebar/FooterWrapper.tsx +9 -0
  113. package/src/Sidebar/HeaderWrapper.tsx +9 -0
  114. package/src/Sidebar/MenuGroup.tsx +4 -1
  115. package/src/Sidebar/SidebarLayout.tsx +2 -46
  116. package/src/Sidebar/index.ts +2 -0
  117. package/src/globalStyle.ts +2 -1
  118. package/src/icons/AnchorIcon/AnchorIcon.tsx +36 -0
  119. package/src/icons/AnchorIcon/index.ts +2 -0
  120. package/src/icons/ArrowIcon/ArrowIcon.tsx +2 -0
  121. package/src/icons/index.ts +1 -0
  122. package/src/index.ts +2 -0
  123. package/src/mocks/useGlobalData.tsx +3 -0
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { FlattenSimpleInterpolation } from 'styled-components';
3
3
  export type ButtonSize = 'small' | 'medium' | 'large' | 'xlarge' | string;
4
- export type ButtonColor = 'primary' | 'secondary' | 'default' | string;
4
+ export type ButtonColor = 'primary' | 'secondary' | 'tertiary' | 'default' | string;
5
5
  export type ButtonVariant = 'outlined' | 'contained';
6
6
  export interface ButtonProps {
7
7
  color?: ButtonColor;
@@ -73,8 +73,8 @@ exports.baseButtonStyles = (0, styled_components_1.css) `
73
73
  box-shadow: var(--button-active-box-shadow);
74
74
  }
75
75
  `;
76
- const StyledButton = styled_components_1.default.button.attrs(({ color = 'default', extraClass }) => ({
77
- className: `button-color-${color}${extraClass ? ` ${extraClass}` : ''}`,
76
+ const StyledButton = styled_components_1.default.button.attrs(({ color = 'default', extraClass, variant }) => ({
77
+ className: `button-color-${color}${variant ? ` ${variant}` : ''}${extraClass ? ` ${extraClass}` : ''}`,
78
78
  'data-component-name': 'Button/Button',
79
79
  })) `
80
80
  text-decoration: none;
@@ -131,6 +131,18 @@ const StyledButton = styled_components_1.default.button.attrs(({ color = 'defaul
131
131
  animation: ${getBlink()} 1.2s infinite;
132
132
  `}
133
133
 
134
+ ${({ color }) => color === 'tertiary' &&
135
+ (0, styled_components_1.css) `
136
+ background-color: transparent;
137
+ border: none;
138
+ color: var(--text-color);
139
+
140
+ :hover {
141
+ border: none;
142
+ background: rgba(255, 255, 255, 0.65);
143
+ }
144
+ `}
145
+
134
146
  ${({ disabled }) => disabled &&
135
147
  (0, styled_components_1.css) `
136
148
  &,
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedNavItem } from '@theme/types/portal';
2
3
  export interface CardProps {
3
4
  title?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { CatalogConfig } from '@theme/types/portal/src/shared/types/catalog';
2
3
  export default function Catalog(props: {
3
4
  pageProps: {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { CatalogItem } from '@theme/types/portal/src/shared/types/catalog';
2
3
  export declare function CatalogCard({ item }: {
3
4
  item: CatalogItem;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedFilter } from '@theme/types/portal/src/shared/types/catalog';
2
3
  export declare function Filter({ filter }: {
3
4
  filter: ResolvedFilter;
@@ -12,9 +12,7 @@ function Filter({ filter }) {
12
12
  if (!filter.parentUsed)
13
13
  return null;
14
14
  return (react_1.default.createElement(FilterGroup, { key: filter.property + filter.title },
15
- react_1.default.createElement(FilterTitle, null,
16
- filter.title,
17
- " filter"),
15
+ react_1.default.createElement(FilterTitle, null, filter.title),
18
16
  filter.type === 'select' ? (react_1.default.createElement(StyledSelect, { onChange: (e) => filter.selectOption(e.target.value), value: ((_a = filter.selectedOptions.values().next()) === null || _a === void 0 ? void 0 : _a.value) || '' },
19
17
  react_1.default.createElement("option", { key: "none", value: "" }, "All"),
20
18
  filter.filteredOptions.map((value) => (react_1.default.createElement("option", { key: value.value, value: value.value },
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare function Tags({ tags }: {
2
3
  tags: string[];
3
4
  }): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare function ColorModeSwitcher(): JSX.Element | null;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface CopyButtonProps {
2
3
  text: string;
3
4
  dataTestId?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface EditPageButtonProps {
2
3
  text: string;
3
4
  to: string;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { CommentProps } from '../Feedback';
2
3
  export declare const Comment: ({ settings, onSubmit }: CommentProps) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { RatingProps } from '../Feedback';
2
3
  export declare const Rating: ({ settings, onSubmit }: RatingProps) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { ReasonsProps } from '../Feedback';
2
3
  export declare const Reasons: ({ settings, onSubmit }: ReasonsProps) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { ReportDialogProps } from '../Feedback';
2
3
  export declare const ReportDialog: ({ location, settings, onSubmit, onCancel, }: ReportDialogProps) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { SentimentProps } from '../Feedback';
2
3
  export declare const Sentiment: ({ settings, onSubmit }: SentimentProps) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const ThumbUp: ({ text }: {
2
3
  text?: string | undefined;
3
4
  }) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { NavGroupRecord } from '@theme/types/portal';
2
3
  interface FooterProps {
3
4
  data: NavGroupRecord;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedNavItem } from '@theme/types/portal';
2
3
  interface CustomFooterNavItemProps {
3
4
  navItem: ResolvedNavItem;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { NavGroup } from '@theme/types/portal';
2
3
  interface FooterProps {
3
4
  data: {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedNavItem } from '@theme/types/portal';
2
3
  interface FooterColumnProps {
3
4
  column: ResolvedNavItem;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedNavItem } from '@theme/types/portal';
2
3
  interface FooterColumnsProps {
3
4
  columns: ResolvedNavItem[];
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { NavGroup } from '@theme/types/portal';
2
3
  interface FooterCopyrightProps {
3
4
  copyrightText: NavGroup;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const FORMATS: {
2
3
  timeago: (date: Date, locale: string) => string;
3
4
  iso: (date: Date) => string;
@@ -4,6 +4,9 @@ interface AdmonitionTypeProps {
4
4
  }
5
5
  export interface AdmonitionProps extends Partial<AdmonitionTypeProps> {
6
6
  name?: string;
7
+ className?: string;
8
+ 'data-source'?: string;
9
+ 'data-hash'?: string;
7
10
  }
8
- export declare function Admonition({ type, name, children, }: React.PropsWithChildren<AdmonitionProps>): JSX.Element;
11
+ export declare function Admonition({ type, name, children, className, 'data-source': dataSource, 'data-hash': dataHash, }: React.PropsWithChildren<AdmonitionProps>): JSX.Element;
9
12
  export {};
@@ -7,8 +7,8 @@ exports.Admonition = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const AlertIcon_1 = require("../icons/AlertIcon/AlertIcon");
10
- function Admonition({ type = 'info', name, children, }) {
11
- return (react_1.default.createElement(Wrapper, { type: type, "data-component-name": "Markdown/Admonition" },
10
+ function Admonition({ type = 'info', name, children, className, 'data-source': dataSource, 'data-hash': dataHash, }) {
11
+ return (react_1.default.createElement(Wrapper, { type: type, className: className, "data-component-name": "Markdown/Admonition", "data-source": dataSource, "data-hash": dataHash },
12
12
  react_1.default.createElement(AlertIcon_1.AlertIcon, { type: type }),
13
13
  name ? react_1.default.createElement(Heading, { type: type }, name) : null,
14
14
  react_1.default.createElement(Content, null, children)));
@@ -1,6 +1,9 @@
1
+ /// <reference types="react" />
1
2
  export type CodeSampleProps = {
2
3
  language: string;
3
4
  highlighted: string;
4
5
  rawContent: string;
6
+ 'data-source'?: string;
7
+ 'data-hash'?: string;
5
8
  };
6
- export declare function CodeSample({ rawContent, highlighted, language }: CodeSampleProps): JSX.Element;
9
+ export declare function CodeSample({ rawContent, highlighted, language, 'data-source': dataSource, 'data-hash': dataHash, }: CodeSampleProps): JSX.Element;
@@ -29,7 +29,7 @@ const styled_components_1 = __importStar(require("styled-components"));
29
29
  const ClipboardService_1 = require("../../utils/ClipboardService");
30
30
  const useThemeConfig_1 = require("../../hooks/useThemeConfig");
31
31
  const Feedback_1 = require("../../Feedback");
32
- function CodeSample({ rawContent, highlighted, language }) {
32
+ function CodeSample({ rawContent, highlighted, language, 'data-source': dataSource, 'data-hash': dataHash, }) {
33
33
  const langClassName = language ? `language-${language}` : '';
34
34
  const { codeSnippet: { copy = {}, report = {} } = {} } = (0, useThemeConfig_1.useThemeConfig)();
35
35
  const [isCopied, setIsCopied] = (0, react_1.useState)(false);
@@ -39,7 +39,7 @@ function CodeSample({ rawContent, highlighted, language }) {
39
39
  setIsCopied(true);
40
40
  setTimeout(() => setIsCopied(false), copy.toasterDuration || 1500);
41
41
  };
42
- return (react_1.default.createElement(Wrapper, { className: "code-sample", "data-component-name": "Markdown/CodeSample/CodeSample" },
42
+ return (react_1.default.createElement(Wrapper, { className: "code-sample", "data-component-name": "Markdown/CodeSample/CodeSample", "data-source": dataSource, "data-hash": dataHash },
43
43
  react_1.default.createElement(CodeSampleButtonContainer, null,
44
44
  !copy.hide && (react_1.default.createElement(react_1.default.Fragment, null,
45
45
  !isCopied && (react_1.default.createElement(Button, { onClick: () => copyCode(rawContent), title: copy.tooltipText || 'Copy to clipboard' }, copy.buttonText || 'Copy')),
@@ -1,5 +1,7 @@
1
1
  import type { PropsWithChildren } from 'react';
2
- export declare function Heading({ level, id, children, }: PropsWithChildren<{
2
+ export declare function Heading({ level, id, children, 'data-source': dataSource, 'data-hash': dataHash, }: PropsWithChildren<{
3
3
  level: number;
4
4
  id: string;
5
+ 'data-source'?: string;
6
+ 'data-hash'?: string;
5
7
  }>): JSX.Element;
@@ -26,18 +26,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.Heading = void 0;
27
27
  const react_1 = __importStar(require("react"));
28
28
  const utils_1 = require("../utils");
29
+ const icons_1 = require("../icons");
29
30
  /**
30
31
  * Class name for all MD tags
31
32
  */
32
33
  const mdClassName = 'md';
33
- const SvgIcon = (react_1.default.createElement("svg", { "aria-hidden": "true", focusable: "false", height: "16", version: "1.1", viewBox: "0 0 16 16", width: "16" },
34
- react_1.default.createElement("path", { fillRule: "evenodd", d: "M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z" })));
35
- function Heading({ level, id, children, }) {
36
- const linkEl = (react_1.default.createElement("a", { href: `#${id}`, className: (0, utils_1.concatClassNames)('anchor', 'before') }, SvgIcon));
34
+ function Heading({ level, id, children, 'data-source': dataSource, 'data-hash': dataHash, }) {
35
+ const linkEl = (react_1.default.createElement("a", { href: `#${id}`, className: (0, utils_1.concatClassNames)('anchor', 'before') },
36
+ react_1.default.createElement(icons_1.AnchorIcon, null)));
37
37
  return (0, react_1.createElement)(`h${level}`, {
38
38
  id,
39
39
  className: (0, utils_1.concatClassNames)('heading-anchor', mdClassName),
40
40
  'data-component-name': 'Markdown/Heading',
41
+ 'data-source': dataSource,
42
+ 'data-hash': dataHash,
41
43
  }, react_1.default.createElement(react_1.default.Fragment, null,
42
44
  linkEl,
43
45
  children));
@@ -1,5 +1,8 @@
1
+ /// <reference types="react" />
1
2
  type MermaidProps = {
2
3
  diagramHtml: string;
4
+ 'data-source'?: string;
5
+ 'data-hash'?: string;
3
6
  };
4
- export declare function Mermaid({ diagramHtml }: MermaidProps): JSX.Element;
7
+ export declare function Mermaid({ diagramHtml, 'data-source': dataSource, 'data-hash': dataHash, }: MermaidProps): JSX.Element;
5
8
  export {};
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Mermaid = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
- function Mermaid({ diagramHtml }) {
10
- return (react_1.default.createElement(Wrapper, { className: "mermaid-wrapper", dangerouslySetInnerHTML: { __html: diagramHtml }, "data-component-name": "Markdown/Mermaid" }));
9
+ function Mermaid({ diagramHtml, 'data-source': dataSource, 'data-hash': dataHash, }) {
10
+ return (react_1.default.createElement(Wrapper, { className: "mermaid-wrapper", dangerouslySetInnerHTML: { __html: diagramHtml }, "data-component-name": "Markdown/Mermaid", "data-source": dataSource, "data-hash": dataHash }));
11
11
  }
12
12
  exports.Mermaid = Mermaid;
13
13
  const Wrapper = styled_components_1.default.div `
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type TabProps = {
2
3
  activeTab: string;
3
4
  label: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedNavLinkItem } from '@theme/types/portal';
2
3
  interface NavbarDropdownProps {
3
4
  items: ResolvedNavLinkItem[];
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Link } from '../mocks/Link';
2
3
  import type { ResolvedNavItem } from '@theme/types/portal';
3
4
  export interface NavbarItemProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const MobileNavbarMenuButton: import("styled-components").StyledComponent<({ onClick, className }: import("../ui/Burger").BurgerProps) => JSX.Element, any, {
2
3
  'data-component-name': string;
3
4
  }, "data-component-name">;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedNavLinkItem } from '@theme/types/portal';
2
3
  interface NavbarDropdownProps {
3
4
  items: ResolvedNavLinkItem[];
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Link } from '../mocks/Link';
2
3
  import type { ResolvedNavItem } from '@theme/types/portal';
3
4
  export interface NavbarItemProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ResolvedConfigLinks } from '@theme/types/portal';
2
3
  export declare function NavbarMenu({ menuItems }: {
3
4
  menuItems: ResolvedConfigLinks;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { LogoConfig } from '@theme/types/portal';
2
3
  export type NavbarLogoProps = {
3
4
  logo: Pick<LogoConfig, 'image' | 'link' | 'altText'>;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare function NextButton(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare function PageNavigation(): JSX.Element | null;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare function PreviousButton(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare function Forbidden(): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare function NotFound(): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface LoginLinkProps {
2
3
  href: string;
3
4
  }
@@ -27,7 +27,7 @@ exports.Profile = void 0;
27
27
  const react_1 = __importStar(require("react"));
28
28
  const styled_components_1 = __importStar(require("styled-components"));
29
29
  const utils_1 = require("../utils");
30
- function ProfileComponent({ name, imageUrl, onClick, color }) {
30
+ function ProfileComponent({ name = 'User', imageUrl, onClick, color }) {
31
31
  var _a;
32
32
  if (imageUrl) {
33
33
  return (react_1.default.createElement(ProfileWrapper, { onClick: onClick },
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface UserProfileProps {
2
3
  userInfo: {
3
4
  isAuthenticated: boolean;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface ClearButtonProps {
3
+ className?: string;
4
+ style?: React.CSSProperties;
5
+ handleClear?: () => void;
6
+ }
7
+ export declare const ClearButton: import("styled-components").StyledComponent<React.NamedExoticComponent<ClearButtonProps>, any, {}, never>;
8
+ export {};
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ClearButton = void 0;
30
+ const react_1 = __importStar(require("react"));
31
+ const styled_components_1 = __importDefault(require("styled-components"));
32
+ const ClearButtonComponent = ({ className, style, handleClear }) => (react_1.default.createElement("button", { className: className, style: style, onClick: handleClear }, "\u2715"));
33
+ exports.ClearButton = (0, styled_components_1.default)((0, react_1.memo)(ClearButtonComponent)) `
34
+ z-index: 1;
35
+ position: absolute;
36
+ right: 24px;
37
+ top: 50%;
38
+ transform: translateY(-50%);
39
+ color: #89949f;
40
+ background: none;
41
+ border: none;
42
+ cursor: pointer;
43
+
44
+ &:hover {
45
+ color: #fff;
46
+ }
47
+ `;
48
+ //# sourceMappingURL=ClearButton.js.map
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { TryItSecurityProps } from './TryItSecurity';
3
+ export declare function DevOnboardingTryItSecurity(props: TryItSecurityProps): JSX.Element | null;
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.DevOnboardingTryItSecurity = void 0;
30
+ const React = __importStar(require("react"));
31
+ const _theme_1 = require("../index.js");
32
+ const styled_components_1 = __importDefault(require("styled-components"));
33
+ const usePageData_1 = require("../mocks/hooks/usePageData");
34
+ const Dropdown_1 = require("./Dropdown");
35
+ function DevOnboardingTryItSecurity(props) {
36
+ const apiId = props.apiId;
37
+ // @ts-ignore
38
+ const { userData } = (0, usePageData_1.usePageData)('userData') || {};
39
+ // TODO: handle error
40
+ const [_error, setError] = React.useState();
41
+ const [apps, setApps] = React.useState();
42
+ const [appId, setAppId] = React.useState('');
43
+ const [loading, setLoading] = React.useState(true);
44
+ const [appLoading, setAppLoading] = React.useState(false);
45
+ const [selectedAppSecret, setSelectedAppSecret] = React.useState();
46
+ const [acceptValueUpdate, setAcceptValueUpdate] = React.useState(true);
47
+ const initialRender = React.useRef(true);
48
+ React.useEffect(() => {
49
+ if (!props.value && initialRender.current)
50
+ return;
51
+ if (acceptValueUpdate) {
52
+ setAcceptValueUpdate(false);
53
+ }
54
+ else {
55
+ setAppId('');
56
+ }
57
+ }, [props.value]);
58
+ React.useEffect(() => {
59
+ initialRender.current = false;
60
+ const prevAppId = sessionStorage.getItem('redocly_onboarding:prevAppId');
61
+ if (prevAppId) {
62
+ setAppId(prevAppId);
63
+ }
64
+ if (userData === null || userData === void 0 ? void 0 : userData.isAuthenticated) {
65
+ fetch(`/api/api-keys/api-products/${apiId}/access?expand=1`).then((res) => {
66
+ return res
67
+ .json()
68
+ .then((data) => {
69
+ if (res.ok) {
70
+ setApps(data.apps);
71
+ }
72
+ else {
73
+ setError(data.message);
74
+ }
75
+ })
76
+ .catch(() => setError('Something went wrong'))
77
+ .finally(() => setLoading(false));
78
+ });
79
+ }
80
+ }, []);
81
+ React.useEffect(() => {
82
+ sessionStorage.setItem('redocly_onboarding:prevAppId', appId || '');
83
+ }, [appId]);
84
+ if (!apiId) {
85
+ return null;
86
+ }
87
+ const loadAppCredentials = (appId) => {
88
+ setAppLoading(true);
89
+ fetch(`/api/api-keys/apps/${appId}`).then((res) => {
90
+ return res
91
+ .json()
92
+ .then((data) => {
93
+ if (res.ok) {
94
+ const cred = data.credentials.find((cred) => cred.status === 'approved');
95
+ setAcceptValueUpdate(true);
96
+ setSelectedAppSecret(cred.clientSecret);
97
+ }
98
+ else {
99
+ setError(data.message);
100
+ }
101
+ })
102
+ .catch(() => setError('Something went wrong'))
103
+ .finally(() => setAppLoading(false));
104
+ });
105
+ };
106
+ const placeholder = loading ? 'Loading your apps...' : undefined;
107
+ return (React.createElement(React.Fragment, null,
108
+ React.createElement(FormLabel, { htmlFor: "server" }, "Select app: "),
109
+ React.createElement(FormControl, null,
110
+ React.createElement(TryItDropdown, { placeholder: placeholder, value: appId || placeholder, options: (apps === null || apps === void 0 ? void 0 : apps.map((app) => ({ title: app.title, value: app.id }))) || [], fullWidth: true, onChange: ({ value }) => {
111
+ setAppId(value);
112
+ loadAppCredentials(value);
113
+ } }),
114
+ React.createElement(UseKeyButton, { disabled: !selectedAppSecret || appLoading, color: "secondary", blinking: appLoading, onClick: () => selectedAppSecret && props.onChange(selectedAppSecret) }, "Use key"))));
115
+ }
116
+ exports.DevOnboardingTryItSecurity = DevOnboardingTryItSecurity;
117
+ const TryItDropdown = (0, styled_components_1.default)(Dropdown_1.Dropdown) `
118
+ .dropdown-select,
119
+ label {
120
+ background-color: var(--panel-try-it-dropdown-background-color);
121
+ border: var(--panel-try-it-dropdown-border);
122
+ color: var(--panel-try-it-dropdown-color);
123
+ }
124
+ `;
125
+ const FormControl = styled_components_1.default.div `
126
+ width: 100%;
127
+ /* font-family: var(--code-font-family); */
128
+ display: flex;
129
+ flex-direction: column;
130
+ margin-bottom: 10px;
131
+
132
+ &:last-child {
133
+ margin-bottom: 0;
134
+ }
135
+ `;
136
+ const FormLabel = styled_components_1.default.label `
137
+ padding-bottom: 6px;
138
+ display: block;
139
+ white-space: nowrap;
140
+ line-height: 1em;
141
+
142
+ ${({ required }) => required &&
143
+ `
144
+ &:after {
145
+ display: inline-block;
146
+ content: '*';
147
+ margin-left: 4px;
148
+ color: var(--color-error-500);
149
+ }
150
+ `}
151
+ `;
152
+ const UseKeyButton = (0, styled_components_1.default)(_theme_1.Button) `
153
+ width: 100px;
154
+ align-self: flex-end;
155
+ margin-top: 16px;
156
+ margin-right: 0;
157
+ `;
158
+ //# sourceMappingURL=DevOnboardingTryItSecurity.js.map