@gitbook/react-openapi 1.5.5 → 1.5.6

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 (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/InteractiveSection.js +52 -30
  3. package/dist/Markdown.js +5 -1
  4. package/dist/OpenAPICodeSample.js +45 -9
  5. package/dist/OpenAPICodeSampleInteractive.js +41 -15
  6. package/dist/OpenAPICodeSampleSelector.js +34 -14
  7. package/dist/OpenAPICopyButton.js +21 -15
  8. package/dist/OpenAPIDisclosure.js +18 -10
  9. package/dist/OpenAPIDisclosureGroup.js +56 -30
  10. package/dist/OpenAPIExample.js +6 -4
  11. package/dist/OpenAPIMediaType.js +38 -17
  12. package/dist/OpenAPIOperation.d.ts +2 -2
  13. package/dist/OpenAPIOperation.js +26 -12
  14. package/dist/OpenAPIOperationContext.d.ts +2 -2
  15. package/dist/OpenAPIOperationContext.js +5 -3
  16. package/dist/OpenAPIPath.js +14 -5
  17. package/dist/OpenAPIPathItem.js +26 -12
  18. package/dist/OpenAPIPathMultipleServers.js +29 -12
  19. package/dist/OpenAPIPrefillContextProvider.d.ts +2 -1
  20. package/dist/OpenAPIPrefillContextProvider.js +5 -3
  21. package/dist/OpenAPIRequestBody.js +20 -10
  22. package/dist/OpenAPIRequestBodyHeaderType.js +5 -3
  23. package/dist/OpenAPIRequiredScopes.js +41 -26
  24. package/dist/OpenAPIResponse.js +34 -19
  25. package/dist/OpenAPIResponseExample.js +25 -8
  26. package/dist/OpenAPIResponseExampleContent.js +39 -18
  27. package/dist/OpenAPIResponses.js +40 -17
  28. package/dist/OpenAPISchema.js +212 -88
  29. package/dist/OpenAPISchemaName.js +44 -24
  30. package/dist/OpenAPISchemaServer.js +10 -2
  31. package/dist/OpenAPISecurities.js +125 -57
  32. package/dist/OpenAPISelect.js +27 -18
  33. package/dist/OpenAPISpec.js +27 -12
  34. package/dist/OpenAPITooltip.js +14 -6
  35. package/dist/OpenAPIWebhook.d.ts +2 -2
  36. package/dist/OpenAPIWebhook.js +23 -11
  37. package/dist/OpenAPIWebhookExample.js +18 -8
  38. package/dist/ScalarApiButton.js +50 -29
  39. package/dist/StaticSection.js +49 -15
  40. package/dist/common/OpenAPIColumnSpec.js +21 -9
  41. package/dist/common/OpenAPIOperationDescription.js +12 -6
  42. package/dist/common/OpenAPIStability.js +6 -3
  43. package/dist/common/OpenAPISummary.js +23 -12
  44. package/dist/formatPath.js +7 -4
  45. package/dist/schemas/OpenAPISchemaItem.js +18 -11
  46. package/dist/schemas/OpenAPISchemas.d.ts +2 -2
  47. package/dist/schemas/OpenAPISchemas.js +55 -31
  48. package/dist/translate.js +4 -6
  49. package/dist/util/example.js +6 -1
  50. package/package.json +2 -2
@@ -6,6 +6,7 @@ import { useOpenAPIOperationContext } from "./OpenAPIOperationContext.js";
6
6
  import { useOpenAPIPrefillContext } from "./OpenAPIPrefillContextProvider.js";
7
7
  import { resolveTryItPrefillForOperation } from "./util/tryit-prefill.js";
8
8
  import { Suspense, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
9
10
  import { ApiClientModalProvider, useApiClientModal } from "@scalar/api-client-react";
10
11
  import { createPortal } from "react-dom";
11
12
 
@@ -17,41 +18,61 @@ function ScalarApiButton(props) {
17
18
  const { method, path, securities, servers, specUrl, context } = props;
18
19
  const [isOpen, setIsOpen] = useState(false);
19
20
  const controllerRef = useRef(null);
20
- return <div className="scalar scalar-activate">
21
- <button className="scalar-activate-button button" onClick={() => {
22
- controllerRef.current?.openClient?.();
23
- setIsOpen(true);
24
- }}>
25
- {t(context.translation, "test_it")}
26
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 12" fill="currentColor">
27
- <path stroke="currentColor" strokeWidth="1.5" d="M1 10.05V1.43c0-.2.2-.31.37-.22l7.26 4.08c.17.1.17.33.01.43l-7.26 4.54a.25.25 0 0 1-.38-.21Z" />
28
- </svg>
29
- </button>
30
-
31
- {isOpen && createPortal(<Suspense fallback={null}>
32
- <ScalarModal controllerRef={controllerRef} method={method} path={path} securities={securities} servers={servers} specUrl={specUrl} />
33
- </Suspense>, document.body)}
34
- </div>;
21
+ return /* @__PURE__ */ jsxs("div", {
22
+ className: "scalar scalar-activate",
23
+ children: [/* @__PURE__ */ jsxs("button", {
24
+ className: "scalar-activate-button button",
25
+ onClick: () => {
26
+ controllerRef.current?.openClient?.();
27
+ setIsOpen(true);
28
+ },
29
+ children: [t(context.translation, "test_it"), /* @__PURE__ */ jsx("svg", {
30
+ xmlns: "http://www.w3.org/2000/svg",
31
+ viewBox: "0 0 10 12",
32
+ fill: "currentColor",
33
+ children: /* @__PURE__ */ jsx("path", {
34
+ stroke: "currentColor",
35
+ strokeWidth: "1.5",
36
+ d: "M1 10.05V1.43c0-.2.2-.31.37-.22l7.26 4.08c.17.1.17.33.01.43l-7.26 4.54a.25.25 0 0 1-.38-.21Z"
37
+ })
38
+ })]
39
+ }), isOpen && createPortal(/* @__PURE__ */ jsx(Suspense, {
40
+ fallback: null,
41
+ children: /* @__PURE__ */ jsx(ScalarModal, {
42
+ controllerRef,
43
+ method,
44
+ path,
45
+ securities,
46
+ servers,
47
+ specUrl
48
+ })
49
+ }), document.body)]
50
+ });
35
51
  }
36
52
  function ScalarModal(props) {
37
53
  const { method, path, securities, servers, specUrl, controllerRef } = props;
38
54
  const prefillInputContext = useOpenAPIPrefillContext()();
39
- const prefillConfig = resolveTryItPrefillForOperation({
40
- operation: {
41
- securities,
42
- servers
55
+ return /* @__PURE__ */ jsx(ApiClientModalProvider, {
56
+ configuration: {
57
+ url: specUrl,
58
+ ...resolveTryItPrefillForOperation({
59
+ operation: {
60
+ securities,
61
+ servers
62
+ },
63
+ prefillInputContext
64
+ })
65
+ },
66
+ initialRequest: {
67
+ method: toScalarHttpMethod(method),
68
+ path
43
69
  },
44
- prefillInputContext
70
+ children: /* @__PURE__ */ jsx(ScalarModalController, {
71
+ method,
72
+ path,
73
+ controllerRef
74
+ })
45
75
  });
46
- return <ApiClientModalProvider configuration={{
47
- url: specUrl,
48
- ...prefillConfig
49
- }} initialRequest={{
50
- method: toScalarHttpMethod(method),
51
- path
52
- }}>
53
- <ScalarModalController method={method} path={path} controllerRef={controllerRef} />
54
- </ApiClientModalProvider>;
55
76
  }
56
77
  function toScalarHttpMethod(method) {
57
78
  return method.toUpperCase();
@@ -1,36 +1,70 @@
1
1
  import clsx from "classnames";
2
2
  import { forwardRef } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
3
4
 
4
5
  //#region src/StaticSection.tsx
5
6
  function Section(props) {
6
- return <div {...props} className={clsx("openapi-section", props.className)} />;
7
+ return /* @__PURE__ */ jsx("div", {
8
+ ...props,
9
+ className: clsx("openapi-section", props.className)
10
+ });
7
11
  }
8
12
  function SectionHeader(props) {
9
- return <div {...props} className={clsx("openapi-section-header", props.className ? `${props.className}-header` : void 0)} />;
13
+ return /* @__PURE__ */ jsx("div", {
14
+ ...props,
15
+ className: clsx("openapi-section-header", props.className ? `${props.className}-header` : void 0)
16
+ });
10
17
  }
11
18
  function SectionHeaderContent(props) {
12
- return <div {...props} className={clsx("openapi-section-header-content", props.className && `${props.className}-header-content`)} />;
19
+ return /* @__PURE__ */ jsx("div", {
20
+ ...props,
21
+ className: clsx("openapi-section-header-content", props.className && `${props.className}-header-content`)
22
+ });
13
23
  }
14
24
  const SectionBody = forwardRef(function SectionBody$1(props, ref) {
15
- return <div ref={ref} {...props} className={clsx("openapi-section-body", props.className && `${props.className}-body`)} />;
25
+ return /* @__PURE__ */ jsx("div", {
26
+ ref,
27
+ ...props,
28
+ className: clsx("openapi-section-body", props.className && `${props.className}-body`)
29
+ });
16
30
  });
17
31
  function SectionFooter(props) {
18
- return <div {...props} className={clsx("openapi-section-footer", props.className && `${props.className}-footer`)} />;
32
+ return /* @__PURE__ */ jsx("div", {
33
+ ...props,
34
+ className: clsx("openapi-section-footer", props.className && `${props.className}-footer`)
35
+ });
19
36
  }
20
37
  function SectionFooterContent(props) {
21
- return <div {...props} className={clsx("openapi-section-footer-content", props.className && `${props.className}-footer-content`)} />;
38
+ return /* @__PURE__ */ jsx("div", {
39
+ ...props,
40
+ className: clsx("openapi-section-footer-content", props.className && `${props.className}-footer-content`)
41
+ });
22
42
  }
23
43
  function StaticSection(props) {
24
44
  const { className, header, children, footer } = props;
25
- return <Section className={className}>
26
- {header ? <SectionHeader className={className}>
27
- <SectionHeaderContent className={className}>{header}</SectionHeaderContent>
28
- </SectionHeader> : null}
29
- <SectionBody className={className}>{children}</SectionBody>
30
- {footer ? <SectionFooter className={className}>
31
- <SectionFooterContent className={className}>{footer}</SectionFooterContent>
32
- </SectionFooter> : null}
33
- </Section>;
45
+ return /* @__PURE__ */ jsxs(Section, {
46
+ className,
47
+ children: [
48
+ header ? /* @__PURE__ */ jsx(SectionHeader, {
49
+ className,
50
+ children: /* @__PURE__ */ jsx(SectionHeaderContent, {
51
+ className,
52
+ children: header
53
+ })
54
+ }) : null,
55
+ /* @__PURE__ */ jsx(SectionBody, {
56
+ className,
57
+ children
58
+ }),
59
+ footer ? /* @__PURE__ */ jsx(SectionFooter, {
60
+ className,
61
+ children: /* @__PURE__ */ jsx(SectionFooterContent, {
62
+ className,
63
+ children: footer
64
+ })
65
+ }) : null
66
+ ]
67
+ });
34
68
  }
35
69
 
36
70
  //#endregion
@@ -2,21 +2,33 @@ import { t } from "../translate.js";
2
2
  import { getOpenAPIClientContext } from "../context.js";
3
3
  import { OpenAPISpec } from "../OpenAPISpec.js";
4
4
  import { OpenAPIOperationDescription } from "./OpenAPIOperationDescription.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
5
6
 
6
7
  //#region src/common/OpenAPIColumnSpec.tsx
7
8
  function OpenAPIColumnSpec(props) {
8
9
  const { data, context } = props;
9
10
  const { operation } = data;
10
11
  const clientContext = getOpenAPIClientContext(context);
11
- return <div className="openapi-column-spec">
12
- {operation["x-deprecated-sunset"] ? <div className="openapi-deprecated-sunset openapi-description openapi-markdown">
13
- {t(context.translation, "deprecated_and_sunset_on", [<span key="date" className="openapi-deprecated-sunset-date">
14
- {operation["x-deprecated-sunset"]}
15
- </span>])}
16
- </div> : null}
17
- <OpenAPIOperationDescription operation={operation} context={context} />
18
- <OpenAPISpec data={data} context={clientContext} />
19
- </div>;
12
+ return /* @__PURE__ */ jsxs("div", {
13
+ className: "openapi-column-spec",
14
+ children: [
15
+ operation["x-deprecated-sunset"] ? /* @__PURE__ */ jsx("div", {
16
+ className: "openapi-deprecated-sunset openapi-description openapi-markdown",
17
+ children: t(context.translation, "deprecated_and_sunset_on", [/* @__PURE__ */ jsx("span", {
18
+ className: "openapi-deprecated-sunset-date",
19
+ children: operation["x-deprecated-sunset"]
20
+ }, "date")])
21
+ }) : null,
22
+ /* @__PURE__ */ jsx(OpenAPIOperationDescription, {
23
+ operation,
24
+ context
25
+ }),
26
+ /* @__PURE__ */ jsx(OpenAPISpec, {
27
+ data,
28
+ context: clientContext
29
+ })
30
+ ]
31
+ });
20
32
  }
21
33
 
22
34
  //#endregion
@@ -1,17 +1,23 @@
1
1
  import { Markdown } from "../Markdown.js";
2
2
  import { resolveDescription } from "../utils.js";
3
+ import { jsx } from "react/jsx-runtime";
3
4
 
4
5
  //#region src/common/OpenAPIOperationDescription.tsx
5
6
  function OpenAPIOperationDescription(props) {
6
7
  const { operation } = props;
7
- if (operation["x-gitbook-description-document"]) return <div className="openapi-intro">
8
- {props.context.renderDocument({ document: operation["x-gitbook-description-document"] })}
9
- </div>;
8
+ if (operation["x-gitbook-description-document"]) return /* @__PURE__ */ jsx("div", {
9
+ className: "openapi-intro",
10
+ children: props.context.renderDocument({ document: operation["x-gitbook-description-document"] })
11
+ });
10
12
  const description = resolveDescription(operation);
11
13
  if (!description) return null;
12
- return <div className="openapi-intro">
13
- <Markdown className="openapi-description" source={description} />
14
- </div>;
14
+ return /* @__PURE__ */ jsx("div", {
15
+ className: "openapi-intro",
16
+ children: /* @__PURE__ */ jsx(Markdown, {
17
+ className: "openapi-description",
18
+ source: description
19
+ })
20
+ });
15
21
  }
16
22
 
17
23
  //#endregion
@@ -1,3 +1,5 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+
1
3
  //#region src/common/OpenAPIStability.tsx
2
4
  const stabilityEnum = {
3
5
  experimental: "Experimental",
@@ -8,9 +10,10 @@ function OpenAPIStability(props) {
8
10
  const { stability } = props;
9
11
  const foundStability = stabilityEnum[stability];
10
12
  if (!foundStability) return null;
11
- return <div className={`openapi-stability openapi-stability-${foundStability.toLowerCase()}`}>
12
- {foundStability}
13
- </div>;
13
+ return /* @__PURE__ */ jsx("div", {
14
+ className: `openapi-stability openapi-stability-${foundStability.toLowerCase()}`,
15
+ children: foundStability
16
+ });
14
17
  }
15
18
 
16
19
  //#endregion
@@ -1,5 +1,6 @@
1
1
  import { OpenAPIPath } from "../OpenAPIPath.js";
2
2
  import { OpenAPIStability } from "./OpenAPIStability.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
3
4
 
4
5
  //#region src/common/OpenAPISummary.tsx
5
6
  function OpenAPISummary(props) {
@@ -9,18 +10,28 @@ function OpenAPISummary(props) {
9
10
  if (operation.summary) return operation.summary;
10
11
  if ("name" in data) return data.name;
11
12
  })();
12
- return <div className="openapi-summary" id={operation.summary ? void 0 : context.id}>
13
- {(operation.deprecated || operation["x-stability"]) && <div className="openapi-summary-tags">
14
- {operation.deprecated && <div className="openapi-deprecated">Deprecated</div>}
15
- {operation["x-stability"] && <OpenAPIStability stability={operation["x-stability"]} />}
16
- </div>}
17
- {title ? context.renderHeading({
18
- deprecated: operation.deprecated ?? false,
19
- stability: operation["x-stability"],
20
- title
21
- }) : null}
22
- {"path" in data ? <OpenAPIPath data={data} context={context} /> : null}
23
- </div>;
13
+ return /* @__PURE__ */ jsxs("div", {
14
+ className: "openapi-summary",
15
+ id: operation.summary ? void 0 : context.id,
16
+ children: [
17
+ (operation.deprecated || operation["x-stability"]) && /* @__PURE__ */ jsxs("div", {
18
+ className: "openapi-summary-tags",
19
+ children: [operation.deprecated && /* @__PURE__ */ jsx("div", {
20
+ className: "openapi-deprecated",
21
+ children: "Deprecated"
22
+ }), operation["x-stability"] && /* @__PURE__ */ jsx(OpenAPIStability, { stability: operation["x-stability"] })]
23
+ }),
24
+ title ? context.renderHeading({
25
+ deprecated: operation.deprecated ?? false,
26
+ stability: operation["x-stability"],
27
+ title
28
+ }) : null,
29
+ "path" in data ? /* @__PURE__ */ jsx(OpenAPIPath, {
30
+ data,
31
+ context
32
+ }) : null
33
+ ]
34
+ });
24
35
  }
25
36
 
26
37
  //#endregion
@@ -1,3 +1,5 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+
1
3
  //#region src/formatPath.tsx
2
4
  /**
3
5
  * Format the path by wrapping placeholders in <span> tags.
@@ -8,15 +10,16 @@ function formatPath(path) {
8
10
  let lastIndex = 0;
9
11
  path.replace(regex, (match, _, offset) => {
10
12
  if (offset > lastIndex) parts.push(path.slice(lastIndex, offset));
11
- parts.push(<span key={`offset-${offset}`} className="openapi-path-variable">
12
- {match}
13
- </span>);
13
+ parts.push(/* @__PURE__ */ jsx("span", {
14
+ className: "openapi-path-variable",
15
+ children: match
16
+ }, `offset-${offset}`));
14
17
  lastIndex = offset + match.length;
15
18
  return match;
16
19
  });
17
20
  if (lastIndex < path.length) parts.push(path.slice(lastIndex));
18
21
  return parts.map((part, index) => {
19
- if (typeof part === "string") return <span key={`part-${index}`}>{part}</span>;
22
+ if (typeof part === "string") return /* @__PURE__ */ jsx("span", { children: part }, `part-${index}`);
20
23
  return part;
21
24
  });
22
25
  }
@@ -5,21 +5,28 @@ import { OpenAPIDisclosure } from "../OpenAPIDisclosure.js";
5
5
  import { getDisclosureLabel } from "../getDisclosureLabel.js";
6
6
  import { OpenAPIRootSchema } from "../OpenAPISchemaServer.js";
7
7
  import { Section, SectionBody } from "../StaticSection.js";
8
+ import { jsx } from "react/jsx-runtime";
8
9
 
9
10
  //#region src/schemas/OpenAPISchemaItem.tsx
10
11
  function OpenAPISchemaItem(props) {
11
12
  const { schema, context, name } = props;
12
- return <OpenAPIDisclosure className="openapi-schemas-disclosure" key={name} icon={context.icons.plus} header={name} label={(isExpanded) => getDisclosureLabel({
13
- schema,
14
- isExpanded,
15
- context
16
- })}>
17
- <Section className="openapi-section-schemas">
18
- <SectionBody>
19
- <OpenAPIRootSchema schema={schema} context={context} />
20
- </SectionBody>
21
- </Section>
22
- </OpenAPIDisclosure>;
13
+ return /* @__PURE__ */ jsx(OpenAPIDisclosure, {
14
+ className: "openapi-schemas-disclosure",
15
+ icon: context.icons.plus,
16
+ header: name,
17
+ label: (isExpanded) => getDisclosureLabel({
18
+ schema,
19
+ isExpanded,
20
+ context
21
+ }),
22
+ children: /* @__PURE__ */ jsx(Section, {
23
+ className: "openapi-section-schemas",
24
+ children: /* @__PURE__ */ jsx(SectionBody, { children: /* @__PURE__ */ jsx(OpenAPIRootSchema, {
25
+ schema,
26
+ context
27
+ }) })
28
+ })
29
+ }, name);
23
30
  }
24
31
 
25
32
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { OpenAPIContextInput } from "../context.js";
2
- import * as react2 from "react";
2
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
3
3
  import { OpenAPISchema } from "@gitbook/openapi-parser";
4
4
 
5
5
  //#region src/schemas/OpenAPISchemas.d.ts
@@ -14,6 +14,6 @@ declare function OpenAPISchemas(props: {
14
14
  * Whether to show the schema directly if there is only one.
15
15
  */
16
16
  grouped?: boolean;
17
- }): react2.JSX.Element | null;
17
+ }): react_jsx_runtime3.JSX.Element | null;
18
18
  //#endregion
19
19
  export { OpenAPISchemas };
@@ -6,6 +6,7 @@ import { getOpenAPIClientContext, resolveOpenAPIContext } from "../context.js";
6
6
  import { getExampleFromSchema } from "../util/example.js";
7
7
  import { OpenAPISchemaItem } from "./OpenAPISchemaItem.js";
8
8
  import clsx from "classnames";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
9
10
 
10
11
  //#region src/schemas/OpenAPISchemas.tsx
11
12
  /**
@@ -19,38 +20,61 @@ function OpenAPISchemas(props) {
19
20
  const clientContext = getOpenAPIClientContext(context);
20
21
  if (schemas.length === 1 && !grouped) {
21
22
  const title = `The ${firstSchema.name} object`;
22
- return <div className={clsx("openapi-schemas", className)}>
23
- <div className="openapi-summary" id={context.id}>
24
- {context.renderHeading({
25
- title,
26
- deprecated: Boolean(firstSchema.schema.deprecated),
27
- stability: firstSchema.schema["x-stability"]
28
- })}
29
- </div>
30
- <div className="openapi-columns">
31
- <div className="openapi-column-spec">
32
- <StaticSection className="openapi-parameters" header={t(context.translation, "attributes")}>
33
- <OpenAPIRootSchema schema={firstSchema.schema} context={clientContext} />
34
- </StaticSection>
35
- </div>
36
- <div className="openapi-column-preview">
37
- <div className="openapi-column-preview-body">
38
- <div className="openapi-panel">
39
- <h4 className="openapi-panel-heading">{title}</h4>
40
- <div className="openapi-panel-body">
41
- <OpenAPIExample example={getExampleFromSchema({ schema: firstSchema.schema })} context={context} syntax="json" />
42
- </div>
43
- </div>
44
- </div>
45
- </div>
46
- </div>
47
- </div>;
23
+ return /* @__PURE__ */ jsxs("div", {
24
+ className: clsx("openapi-schemas", className),
25
+ children: [/* @__PURE__ */ jsx("div", {
26
+ className: "openapi-summary",
27
+ id: context.id,
28
+ children: context.renderHeading({
29
+ title,
30
+ deprecated: Boolean(firstSchema.schema.deprecated),
31
+ stability: firstSchema.schema["x-stability"]
32
+ })
33
+ }), /* @__PURE__ */ jsxs("div", {
34
+ className: "openapi-columns",
35
+ children: [/* @__PURE__ */ jsx("div", {
36
+ className: "openapi-column-spec",
37
+ children: /* @__PURE__ */ jsx(StaticSection, {
38
+ className: "openapi-parameters",
39
+ header: t(context.translation, "attributes"),
40
+ children: /* @__PURE__ */ jsx(OpenAPIRootSchema, {
41
+ schema: firstSchema.schema,
42
+ context: clientContext
43
+ })
44
+ })
45
+ }), /* @__PURE__ */ jsx("div", {
46
+ className: "openapi-column-preview",
47
+ children: /* @__PURE__ */ jsx("div", {
48
+ className: "openapi-column-preview-body",
49
+ children: /* @__PURE__ */ jsxs("div", {
50
+ className: "openapi-panel",
51
+ children: [/* @__PURE__ */ jsx("h4", {
52
+ className: "openapi-panel-heading",
53
+ children: title
54
+ }), /* @__PURE__ */ jsx("div", {
55
+ className: "openapi-panel-body",
56
+ children: /* @__PURE__ */ jsx(OpenAPIExample, {
57
+ example: getExampleFromSchema({ schema: firstSchema.schema }),
58
+ context,
59
+ syntax: "json"
60
+ })
61
+ })]
62
+ })
63
+ })
64
+ })]
65
+ })]
66
+ });
48
67
  }
49
- return <div className={clsx("openapi-schemas", className)}>
50
- {schemas.map(({ name, schema }) => {
51
- return <OpenAPISchemaItem key={name} name={name} context={clientContext} schema={schema} />;
52
- })}
53
- </div>;
68
+ return /* @__PURE__ */ jsx("div", {
69
+ className: clsx("openapi-schemas", className),
70
+ children: schemas.map(({ name, schema }) => {
71
+ return /* @__PURE__ */ jsx(OpenAPISchemaItem, {
72
+ name,
73
+ context: clientContext,
74
+ schema
75
+ }, name);
76
+ })
77
+ });
54
78
  }
55
79
 
56
80
  //#endregion
package/dist/translate.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import React, { isValidElement } from "react";
2
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
2
3
 
3
4
  //#region src/translate.tsx
4
5
  /**
@@ -14,16 +15,13 @@ function t(translation, id, ...args) {
14
15
  else {
15
16
  const [partToPush, partToReplace] = currentStringToReplace.split(`\${${i + 1}}`);
16
17
  if (partToPush === void 0 || partToReplace === void 0) throw new Error(`Invalid translation "${id}"`);
17
- parts.push(<React.Fragment key={`string-${i}`}>{partToPush}</React.Fragment>);
18
- parts.push(<React.Fragment key={`arg-${i}`}>{arg}</React.Fragment>);
18
+ parts.push(/* @__PURE__ */ jsx(React.Fragment, { children: partToPush }, `string-${i}`));
19
+ parts.push(/* @__PURE__ */ jsx(React.Fragment, { children: arg }, `arg-${i}`));
19
20
  currentStringToReplace = partToReplace;
20
21
  }
21
22
  });
22
23
  if (!parts.length) return currentStringToReplace;
23
- return <>
24
- {parts}
25
- {currentStringToReplace}
26
- </>;
24
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [parts, currentStringToReplace] });
27
25
  }
28
26
  /**
29
27
  * Version of `t` that returns a string.
@@ -2,6 +2,7 @@ import { tString } from "../translate.js";
2
2
  import { OpenAPIExample } from "../OpenAPIExample.js";
3
3
  import { checkIsReference } from "../utils.js";
4
4
  import { generateSchemaExample } from "../generateSchemaExample.js";
5
+ import { jsx } from "react/jsx-runtime";
5
6
 
6
7
  //#region src/util/example.tsx
7
8
  /**
@@ -66,7 +67,11 @@ function getExamples(props) {
66
67
  return {
67
68
  key: example.key,
68
69
  label: example.example.summary || example.key,
69
- body: <OpenAPIExample example={example.example} context={props.context} syntax={syntax} />
70
+ body: /* @__PURE__ */ jsx(OpenAPIExample, {
71
+ example: example.example,
72
+ context: props.context,
73
+ syntax
74
+ })
70
75
  };
71
76
  });
72
77
  }
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "default": "./dist/index.js"
8
8
  }
9
9
  },
10
- "version": "1.5.5",
10
+ "version": "1.5.6",
11
11
  "sideEffects": false,
12
12
  "dependencies": {
13
13
  "@gitbook/expr": "1.2.4",
@@ -42,7 +42,7 @@
42
42
  "react-dom": "catalog:"
43
43
  },
44
44
  "peerDependencies": {
45
- "react": "*",
45
+ "react": ">=17",
46
46
  "react-dom": "*"
47
47
  },
48
48
  "scripts": {