@gitbook/react-openapi 1.5.4 → 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 +13 -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 +3 -3
@@ -1,4 +1,5 @@
1
1
  import { t, tString } from "./translate.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
2
3
 
3
4
  //#region src/OpenAPISchemaName.tsx
4
5
  /**
@@ -8,30 +9,49 @@ import { t, tString } from "./translate.js";
8
9
  function OpenAPISchemaName(props) {
9
10
  const { schema, type, propertyName, required, isDiscriminatorProperty, context } = props;
10
11
  const additionalItems = schema && getAdditionalItems(schema, context);
11
- return <span className="openapi-schema-name">
12
- {propertyName ? <span data-deprecated={schema?.deprecated} className="openapi-schema-propertyname">
13
- {propertyName}
14
- </span> : null}
15
- {isDiscriminatorProperty ? <span className="openapi-schema-discriminator">
16
- {t(context.translation, "discriminator")}
17
- </span> : null}
18
- {type || additionalItems ? <span>
19
- {schema?.const ? <span className="openapi-schema-type">const: {schema?.const}</span> : type ? <span className="openapi-schema-type">{type}</span> : null}
20
- {additionalItems ? <span className="openapi-schema-type">{additionalItems}</span> : null}
21
- </span> : null}
22
- {schema?.readOnly ? <span className="openapi-schema-readonly">
23
- {t(context.translation, "read_only")}
24
- </span> : null}
25
- {schema?.writeOnly ? <span className="openapi-schema-writeonly">
26
- {t(context.translation, "write_only")}
27
- </span> : null}
28
- {required === null ? null : required ? <span className="openapi-schema-required">
29
- {t(context.translation, "required")}
30
- </span> : <span className="openapi-schema-optional">
31
- {t(context.translation, "optional")}
32
- </span>}
33
- {schema?.deprecated ? <span className="openapi-deprecated">{t(context.translation, "deprecated")}</span> : null}
34
- </span>;
12
+ return /* @__PURE__ */ jsxs("span", {
13
+ className: "openapi-schema-name",
14
+ children: [
15
+ propertyName ? /* @__PURE__ */ jsx("span", {
16
+ "data-deprecated": schema?.deprecated,
17
+ className: "openapi-schema-propertyname",
18
+ children: propertyName
19
+ }) : null,
20
+ isDiscriminatorProperty ? /* @__PURE__ */ jsx("span", {
21
+ className: "openapi-schema-discriminator",
22
+ children: t(context.translation, "discriminator")
23
+ }) : null,
24
+ type || additionalItems ? /* @__PURE__ */ jsxs("span", { children: [schema?.const ? /* @__PURE__ */ jsxs("span", {
25
+ className: "openapi-schema-type",
26
+ children: ["const: ", schema?.const]
27
+ }) : type ? /* @__PURE__ */ jsx("span", {
28
+ className: "openapi-schema-type",
29
+ children: type
30
+ }) : null, additionalItems ? /* @__PURE__ */ jsx("span", {
31
+ className: "openapi-schema-type",
32
+ children: additionalItems
33
+ }) : null] }) : null,
34
+ schema?.readOnly ? /* @__PURE__ */ jsx("span", {
35
+ className: "openapi-schema-readonly",
36
+ children: t(context.translation, "read_only")
37
+ }) : null,
38
+ schema?.writeOnly ? /* @__PURE__ */ jsx("span", {
39
+ className: "openapi-schema-writeonly",
40
+ children: t(context.translation, "write_only")
41
+ }) : null,
42
+ required === null ? null : required ? /* @__PURE__ */ jsx("span", {
43
+ className: "openapi-schema-required",
44
+ children: t(context.translation, "required")
45
+ }) : /* @__PURE__ */ jsx("span", {
46
+ className: "openapi-schema-optional",
47
+ children: t(context.translation, "optional")
48
+ }),
49
+ schema?.deprecated ? /* @__PURE__ */ jsx("span", {
50
+ className: "openapi-deprecated",
51
+ children: t(context.translation, "deprecated")
52
+ }) : null
53
+ ]
54
+ });
35
55
  }
36
56
  function getAdditionalItems(schema, context) {
37
57
  let additionalItems = "";
@@ -1,12 +1,20 @@
1
1
  import { decycle } from "./decycle.js";
2
2
  import { OpenAPIRootSchemaFromServer, OpenAPISchemaPropertiesFromServer } from "./OpenAPISchema.js";
3
+ import { jsx } from "react/jsx-runtime";
3
4
 
4
5
  //#region src/OpenAPISchemaServer.tsx
5
6
  function OpenAPISchemaProperties(props) {
6
- return <OpenAPISchemaPropertiesFromServer id={props.id} properties={JSON.stringify(props.properties, decycle())} context={props.context} />;
7
+ return /* @__PURE__ */ jsx(OpenAPISchemaPropertiesFromServer, {
8
+ id: props.id,
9
+ properties: JSON.stringify(props.properties, decycle()),
10
+ context: props.context
11
+ });
7
12
  }
8
13
  function OpenAPIRootSchema(props) {
9
- return <OpenAPIRootSchemaFromServer schema={JSON.stringify(props.schema, decycle())} context={props.context} />;
14
+ return /* @__PURE__ */ jsx(OpenAPIRootSchemaFromServer, {
15
+ schema: JSON.stringify(props.schema, decycle()),
16
+ context: props.context
17
+ });
10
18
  }
11
19
 
12
20
  //#endregion
@@ -6,6 +6,7 @@ import { createStateKey, extractOperationSecurityInfo, resolveDescription } from
6
6
  import { InteractiveSection } from "./InteractiveSection.js";
7
7
  import { OpenAPIRequiredScopes, OpenAPISchemaScopes } from "./OpenAPIRequiredScopes.js";
8
8
  import { Fragment } from "react";
9
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
10
 
10
11
  //#region src/OpenAPISecurities.tsx
11
12
  /**
@@ -19,79 +20,146 @@ function OpenAPISecurities(props) {
19
20
  securities
20
21
  });
21
22
  const stateKey = createStateKey("securities", context.blockKey);
22
- return <>
23
- <OpenAPIRequiredScopes context={context} stateKey={stateKey} securities={tabsData} />
24
- <InteractiveSection header={t(context.translation, "authorizations")} stateKey={stateKey} toggleIcon={context.icons.chevronRight} selectIcon={context.icons.chevronDown} className="openapi-securities" tabs={tabsData.map(({ key, label, schemes }) => ({
25
- key,
26
- label,
27
- body: <div className="openapi-schema">
28
- {schemes.map((security, index) => {
29
- const description = security.type !== "oauth2" ? resolveDescription(security) : void 0;
30
- return <div key={`${key}-${index}`} className="openapi-schema-presentation">
31
- {getLabelForType(security, context)}
32
- {description ? <Markdown source={description} className="openapi-securities-description" /> : null}
33
- </div>;
34
- })}
35
- </div>
36
- }))} />
37
- </>;
23
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(OpenAPIRequiredScopes, {
24
+ context,
25
+ stateKey,
26
+ securities: tabsData
27
+ }), /* @__PURE__ */ jsx(InteractiveSection, {
28
+ header: t(context.translation, "authorizations"),
29
+ stateKey,
30
+ toggleIcon: context.icons.chevronRight,
31
+ selectIcon: context.icons.chevronDown,
32
+ className: "openapi-securities",
33
+ tabs: tabsData.map(({ key, label, schemes }) => ({
34
+ key,
35
+ label,
36
+ body: /* @__PURE__ */ jsx("div", {
37
+ className: "openapi-schema",
38
+ children: schemes.map((security, index) => {
39
+ const description = security.type !== "oauth2" ? resolveDescription(security) : void 0;
40
+ return /* @__PURE__ */ jsxs("div", {
41
+ className: "openapi-schema-presentation",
42
+ children: [getLabelForType(security, context), description ? /* @__PURE__ */ jsx(Markdown, {
43
+ source: description,
44
+ className: "openapi-securities-description"
45
+ }) : null]
46
+ }, `${key}-${index}`);
47
+ })
48
+ })
49
+ }))
50
+ })] });
38
51
  }
39
52
  function getLabelForType(security, context) {
40
53
  switch (security.type) {
41
- case "apiKey": return <OpenAPISchemaName context={context} propertyName={security.name ?? "apiKey"} type="string" required={security.required} />;
54
+ case "apiKey": return /* @__PURE__ */ jsx(OpenAPISchemaName, {
55
+ context,
56
+ propertyName: security.name ?? "apiKey",
57
+ type: "string",
58
+ required: security.required
59
+ });
42
60
  case "http":
43
- if (security.scheme === "basic") return <OpenAPISchemaName context={context} propertyName="Authorization" type="string" required={security.required} />;
44
- if (security.scheme === "bearer") return <>
45
- <OpenAPISchemaName context={context} propertyName="Authorization" type="string" required={security.required} />
46
- { /** Show a default description if none is provided */}
47
- {!security.description ? <Markdown source={`Bearer authentication header of the form Bearer &lt;token&gt;.`} className="openapi-securities-description" /> : null}
48
- </>;
49
- return <OpenAPISchemaName context={context} propertyName="HTTP" required={security.required} />;
50
- case "oauth2": return <OpenAPISchemaOAuth2Flows context={context} security={security} />;
51
- case "openIdConnect": return <OpenAPISchemaName context={context} propertyName="OpenID Connect" required={security.required} />;
61
+ if (security.scheme === "basic") return /* @__PURE__ */ jsx(OpenAPISchemaName, {
62
+ context,
63
+ propertyName: "Authorization",
64
+ type: "string",
65
+ required: security.required
66
+ });
67
+ if (security.scheme === "bearer") return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(OpenAPISchemaName, {
68
+ context,
69
+ propertyName: "Authorization",
70
+ type: "string",
71
+ required: security.required
72
+ }), !security.description ? /* @__PURE__ */ jsx(Markdown, {
73
+ source: `Bearer authentication header of the form Bearer &lt;token&gt;.`,
74
+ className: "openapi-securities-description"
75
+ }) : null] });
76
+ return /* @__PURE__ */ jsx(OpenAPISchemaName, {
77
+ context,
78
+ propertyName: "HTTP",
79
+ required: security.required
80
+ });
81
+ case "oauth2": return /* @__PURE__ */ jsx(OpenAPISchemaOAuth2Flows, {
82
+ context,
83
+ security
84
+ });
85
+ case "openIdConnect": return /* @__PURE__ */ jsx(OpenAPISchemaName, {
86
+ context,
87
+ propertyName: "OpenID Connect",
88
+ required: security.required
89
+ });
52
90
  default: return security.type;
53
91
  }
54
92
  }
55
93
  function OpenAPISchemaOAuth2Flows(props) {
56
94
  const { context, security } = props;
57
95
  const flows = security.flows ? Object.entries(security.flows) : [];
58
- return <div className="openapi-securities-oauth-flows">
59
- {flows.map(([name, flow], index) => <Fragment key={index}>
60
- <OpenAPISchemaOAuth2Item flow={flow} name={name} context={context} security={security} />
61
- {index < flows.length - 1 ? <hr /> : null}
62
- </Fragment>)}
63
- </div>;
96
+ return /* @__PURE__ */ jsx("div", {
97
+ className: "openapi-securities-oauth-flows",
98
+ children: flows.map(([name, flow], index) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(OpenAPISchemaOAuth2Item, {
99
+ flow,
100
+ name,
101
+ context,
102
+ security
103
+ }), index < flows.length - 1 ? /* @__PURE__ */ jsx("hr", {}) : null] }, index))
104
+ });
64
105
  }
65
106
  function OpenAPISchemaOAuth2Item(props) {
66
107
  const { flow, context, security, name } = props;
67
108
  if (!flow) return null;
68
109
  const scopes = !security.scopes?.length && flow.scopes ? Object.entries(flow.scopes) : [];
69
110
  const description = resolveDescription(security);
70
- return <div>
71
- <OpenAPISchemaName context={context} propertyName="OAuth2" type={name} required={security.required} />
72
- <div className="openapi-securities-oauth-content openapi-markdown">
73
- {description ? <Markdown source={description} className="openapi-securities-description" /> : null}
74
- {"authorizationUrl" in flow && flow.authorizationUrl ? <span>
75
- Authorization URL:{" "}
76
- <OpenAPICopyButton value={flow.authorizationUrl} context={context} className="openapi-securities-url" withTooltip>
77
- {flow.authorizationUrl}
78
- </OpenAPICopyButton>
79
- </span> : null}
80
- {"tokenUrl" in flow && flow.tokenUrl ? <span>
81
- Token URL:{" "}
82
- <OpenAPICopyButton value={flow.tokenUrl} context={context} className="openapi-securities-url" withTooltip>
83
- {flow.tokenUrl}
84
- </OpenAPICopyButton>
85
- </span> : null}
86
- {"refreshUrl" in flow && flow.refreshUrl ? <span>
87
- Refresh URL:{" "}
88
- <OpenAPICopyButton value={flow.refreshUrl} context={context} className="openapi-securities-url" withTooltip>
89
- {flow.refreshUrl}
90
- </OpenAPICopyButton>
91
- </span> : null}
92
- {scopes.length ? <OpenAPISchemaScopes scopes={scopes} context={context} isOAuth2 /> : null}
93
- </div>
94
- </div>;
111
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(OpenAPISchemaName, {
112
+ context,
113
+ propertyName: "OAuth2",
114
+ type: name,
115
+ required: security.required
116
+ }), /* @__PURE__ */ jsxs("div", {
117
+ className: "openapi-securities-oauth-content openapi-markdown",
118
+ children: [
119
+ description ? /* @__PURE__ */ jsx(Markdown, {
120
+ source: description,
121
+ className: "openapi-securities-description"
122
+ }) : null,
123
+ "authorizationUrl" in flow && flow.authorizationUrl ? /* @__PURE__ */ jsxs("span", { children: [
124
+ "Authorization URL:",
125
+ " ",
126
+ /* @__PURE__ */ jsx(OpenAPICopyButton, {
127
+ value: flow.authorizationUrl,
128
+ context,
129
+ className: "openapi-securities-url",
130
+ withTooltip: true,
131
+ children: flow.authorizationUrl
132
+ })
133
+ ] }) : null,
134
+ "tokenUrl" in flow && flow.tokenUrl ? /* @__PURE__ */ jsxs("span", { children: [
135
+ "Token URL:",
136
+ " ",
137
+ /* @__PURE__ */ jsx(OpenAPICopyButton, {
138
+ value: flow.tokenUrl,
139
+ context,
140
+ className: "openapi-securities-url",
141
+ withTooltip: true,
142
+ children: flow.tokenUrl
143
+ })
144
+ ] }) : null,
145
+ "refreshUrl" in flow && flow.refreshUrl ? /* @__PURE__ */ jsxs("span", { children: [
146
+ "Refresh URL:",
147
+ " ",
148
+ /* @__PURE__ */ jsx(OpenAPICopyButton, {
149
+ value: flow.refreshUrl,
150
+ context,
151
+ className: "openapi-securities-url",
152
+ withTooltip: true,
153
+ children: flow.refreshUrl
154
+ })
155
+ ] }) : null,
156
+ scopes.length ? /* @__PURE__ */ jsx(OpenAPISchemaScopes, {
157
+ scopes,
158
+ context,
159
+ isOAuth2: true
160
+ }) : null
161
+ ]
162
+ })] });
95
163
  }
96
164
 
97
165
  //#endregion
@@ -4,6 +4,7 @@
4
4
  import { getOrCreateStoreByKey } from "./getOrCreateStoreByKey.js";
5
5
  import clsx from "classnames";
6
6
  import { useCallback } from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
7
8
  import { Button, ListBox, ListBoxItem, Popover, Select, SelectValue } from "react-aria-components";
8
9
  import { useStore } from "zustand";
9
10
 
@@ -19,26 +20,34 @@ function OpenAPISelect(props) {
19
20
  const { icon, items, children, className, placement, stateKey, value, onChange, defaultValue } = props;
20
21
  const state = useSelectState(stateKey, defaultValue ?? items[0]?.key);
21
22
  const selected = items.find((item) => item.key === state.key) || items[0];
22
- return <Select aria-label="OpenAPI Select" {...props} value={value ?? selected?.key} onChange={(key) => {
23
- onChange?.(key);
24
- state.setKey(key);
25
- }} className={clsx("openapi-select", className)}>
26
- <Button>
27
- <SelectValue />
28
- {icon !== null ? icon || "▼" : null}
29
- </Button>
30
- <Popover placement={placement} className="openapi-select-popover">
31
- <ListBox className="openapi-select-listbox" items={items}>
32
- {children}
33
- </ListBox>
34
- </Popover>
35
- </Select>;
23
+ return /* @__PURE__ */ jsxs(Select, {
24
+ "aria-label": "OpenAPI Select",
25
+ ...props,
26
+ value: value ?? selected?.key,
27
+ onChange: (key) => {
28
+ onChange?.(key);
29
+ state.setKey(key);
30
+ },
31
+ className: clsx("openapi-select", className),
32
+ children: [/* @__PURE__ */ jsxs(Button, { children: [/* @__PURE__ */ jsx(SelectValue, {}), icon !== null ? icon || "" : null] }), /* @__PURE__ */ jsx(Popover, {
33
+ placement,
34
+ className: "openapi-select-popover",
35
+ children: /* @__PURE__ */ jsx(ListBox, {
36
+ className: "openapi-select-listbox",
37
+ items,
38
+ children
39
+ })
40
+ })]
41
+ });
36
42
  }
37
43
  function OpenAPISelectItem(props) {
38
- return <ListBoxItem {...props} className={({ isFocused, isSelected }) => clsx("openapi-select-item", {
39
- "openapi-select-item-focused": isFocused,
40
- "openapi-select-item-selected": isSelected
41
- }, props.className)} />;
44
+ return /* @__PURE__ */ jsx(ListBoxItem, {
45
+ ...props,
46
+ className: ({ isFocused, isSelected }) => clsx("openapi-select-item", {
47
+ "openapi-select-item-focused": isFocused,
48
+ "openapi-select-item-selected": isSelected
49
+ }, props.className)
50
+ });
42
51
  }
43
52
 
44
53
  //#endregion
@@ -5,6 +5,7 @@ import { StaticSection } from "./StaticSection.js";
5
5
  import { OpenAPIRequestBody } from "./OpenAPIRequestBody.js";
6
6
  import { OpenAPIResponses } from "./OpenAPIResponses.js";
7
7
  import { OpenAPISecurities } from "./OpenAPISecurities.js";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
9
 
9
10
  //#region src/OpenAPISpec.tsx
10
11
  function OpenAPISpec(props) {
@@ -12,18 +13,32 @@ function OpenAPISpec(props) {
12
13
  const { operation } = data;
13
14
  const parameterGroups = groupParameters(deduplicateParameters(operation.parameters ?? []), context);
14
15
  const securities = "securities" in data ? data.securities : [];
15
- return <>
16
- {securities.length > 0 ? <OpenAPISecurities key="securities" securityRequirement={operation.security} securities={securities} context={context} /> : null}
17
-
18
- {parameterGroups.map((group) => {
19
- return <StaticSection key={`parameter-${group.key}`} className="openapi-parameters" header={group.label}>
20
- <OpenAPISchemaProperties properties={group.parameters.map(parameterToProperty)} context={context} />
21
- </StaticSection>;
22
- })}
23
-
24
- {operation.requestBody ? <OpenAPIRequestBody key="body" requestBody={operation.requestBody} context={context} data={data} /> : null}
25
- {operation.responses ? <OpenAPIResponses key="responses" responses={operation.responses} context={context} /> : null}
26
- </>;
16
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
17
+ securities.length > 0 ? /* @__PURE__ */ jsx(OpenAPISecurities, {
18
+ securityRequirement: operation.security,
19
+ securities,
20
+ context
21
+ }, "securities") : null,
22
+ parameterGroups.map((group) => {
23
+ return /* @__PURE__ */ jsx(StaticSection, {
24
+ className: "openapi-parameters",
25
+ header: group.label,
26
+ children: /* @__PURE__ */ jsx(OpenAPISchemaProperties, {
27
+ properties: group.parameters.map(parameterToProperty),
28
+ context
29
+ })
30
+ }, `parameter-${group.key}`);
31
+ }),
32
+ operation.requestBody ? /* @__PURE__ */ jsx(OpenAPIRequestBody, {
33
+ requestBody: operation.requestBody,
34
+ context,
35
+ data
36
+ }, "body") : null,
37
+ operation.responses ? /* @__PURE__ */ jsx(OpenAPIResponses, {
38
+ responses: operation.responses,
39
+ context
40
+ }, "responses") : null
41
+ ] });
27
42
  }
28
43
  function groupParameters(parameters, context) {
29
44
  const sorted = [
@@ -2,20 +2,28 @@
2
2
 
3
3
 
4
4
  import clsx from "classnames";
5
+ import { jsx } from "react/jsx-runtime";
5
6
  import { Tooltip, TooltipTrigger } from "react-aria-components";
6
7
 
7
8
  //#region src/OpenAPITooltip.tsx
8
9
  function OpenAPITooltip(props) {
9
10
  const { children,...rest } = props;
10
- return <TooltipTrigger {...rest} closeDelay={200} delay={200}>
11
- {children}
12
- </TooltipTrigger>;
11
+ return /* @__PURE__ */ jsx(TooltipTrigger, {
12
+ ...rest,
13
+ closeDelay: 200,
14
+ delay: 200,
15
+ children
16
+ });
13
17
  }
14
18
  function OpenAPITooltipContent(props) {
15
19
  const { children, placement = "top", offset = 4, className,...rest } = props;
16
- return <Tooltip {...rest} placement={placement} offset={offset} className={clsx("openapi-tooltip", className)}>
17
- {children}
18
- </Tooltip>;
20
+ return /* @__PURE__ */ jsx(Tooltip, {
21
+ ...rest,
22
+ placement,
23
+ offset,
24
+ className: clsx("openapi-tooltip", className),
25
+ children
26
+ });
19
27
  }
20
28
  OpenAPITooltip.Content = OpenAPITooltipContent;
21
29
 
@@ -1,6 +1,6 @@
1
1
  import { OpenAPIContextInput } from "./context.js";
2
2
  import { OpenAPIWebhookData } from "./types.js";
3
- import * as react0 from "react";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/OpenAPIWebhook.d.ts
6
6
  /**
@@ -10,6 +10,6 @@ declare function OpenAPIWebhook(props: {
10
10
  className?: string;
11
11
  data: OpenAPIWebhookData;
12
12
  context: OpenAPIContextInput;
13
- }): react0.JSX.Element;
13
+ }): react_jsx_runtime0.JSX.Element;
14
14
  //#endregion
15
15
  export { OpenAPIWebhook };
@@ -3,6 +3,7 @@ import { OpenAPIColumnSpec } from "./common/OpenAPIColumnSpec.js";
3
3
  import { OpenAPISummary } from "./common/OpenAPISummary.js";
4
4
  import { OpenAPIWebhookExample } from "./OpenAPIWebhookExample.js";
5
5
  import clsx from "classnames";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
6
7
 
7
8
  //#region src/OpenAPIWebhook.tsx
8
9
  /**
@@ -11,17 +12,28 @@ import clsx from "classnames";
11
12
  function OpenAPIWebhook(props) {
12
13
  const { className, data, context: contextInput } = props;
13
14
  const context = resolveOpenAPIContext(contextInput);
14
- return <div className={clsx("openapi-webhook", className)}>
15
- <OpenAPISummary data={data} context={context} />
16
- <div className="openapi-columns">
17
- <OpenAPIColumnSpec data={data} context={context} />
18
- <div className="openapi-column-preview">
19
- <div className="openapi-column-preview-body">
20
- <OpenAPIWebhookExample data={data} context={context} />
21
- </div>
22
- </div>
23
- </div>
24
- </div>;
15
+ return /* @__PURE__ */ jsxs("div", {
16
+ className: clsx("openapi-webhook", className),
17
+ children: [/* @__PURE__ */ jsx(OpenAPISummary, {
18
+ data,
19
+ context
20
+ }), /* @__PURE__ */ jsxs("div", {
21
+ className: "openapi-columns",
22
+ children: [/* @__PURE__ */ jsx(OpenAPIColumnSpec, {
23
+ data,
24
+ context
25
+ }), /* @__PURE__ */ jsx("div", {
26
+ className: "openapi-column-preview",
27
+ children: /* @__PURE__ */ jsx("div", {
28
+ className: "openapi-column-preview-body",
29
+ children: /* @__PURE__ */ jsx(OpenAPIWebhookExample, {
30
+ data,
31
+ context
32
+ })
33
+ })
34
+ })]
35
+ })]
36
+ });
25
37
  }
26
38
 
27
39
  //#endregion
@@ -3,6 +3,7 @@ import { createStateKey } from "./utils.js";
3
3
  import { getOpenAPIClientContext } from "./context.js";
4
4
  import { getExamples } from "./util/example.js";
5
5
  import { OpenAPIMediaTypeContent } from "./OpenAPIMediaType.js";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
7
 
7
8
  //#region src/OpenAPIWebhookExample.tsx
8
9
  function OpenAPIWebhookExample(props) {
@@ -14,12 +15,12 @@ function OpenAPIWebhookExample(props) {
14
15
  if (!value?.schema) return {
15
16
  key,
16
17
  label: key,
17
- body: <OpenAPIEmptyExample context={context} />
18
+ body: /* @__PURE__ */ jsx(OpenAPIEmptyExample, { context })
18
19
  };
19
20
  return {
20
21
  key,
21
22
  label: key,
22
- body: <></>,
23
+ body: /* @__PURE__ */ jsx(Fragment, {}),
23
24
  examples: getExamples({
24
25
  mediaTypeObject: value,
25
26
  mediaType: key,
@@ -28,12 +29,21 @@ function OpenAPIWebhookExample(props) {
28
29
  };
29
30
  });
30
31
  })();
31
- return <div className="openapi-panel">
32
- <h4 className="openapi-panel-heading">Payload</h4>
33
- <div className="openapi-panel-body">
34
- <OpenAPIMediaTypeContent selectIcon={context.icons.chevronDown} stateKey={createStateKey("request-body-media-type", context.blockKey)} items={items} context={getOpenAPIClientContext(context)} />
35
- </div>
36
- </div>;
32
+ return /* @__PURE__ */ jsxs("div", {
33
+ className: "openapi-panel",
34
+ children: [/* @__PURE__ */ jsx("h4", {
35
+ className: "openapi-panel-heading",
36
+ children: "Payload"
37
+ }), /* @__PURE__ */ jsx("div", {
38
+ className: "openapi-panel-body",
39
+ children: /* @__PURE__ */ jsx(OpenAPIMediaTypeContent, {
40
+ selectIcon: context.icons.chevronDown,
41
+ stateKey: createStateKey("request-body-media-type", context.blockKey),
42
+ items,
43
+ context: getOpenAPIClientContext(context)
44
+ })
45
+ })]
46
+ });
37
47
  }
38
48
 
39
49
  //#endregion