@lukoweb/apitogo 0.1.1 → 0.1.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.
Files changed (91) hide show
  1. package/dist/cli/cli.js +17 -6
  2. package/dist/declarations/lib/ui/Command.d.ts +1 -1
  3. package/dist/declarations/lib/util/MdxComponents.d.ts +1 -1
  4. package/package.json +1 -1
  5. package/src/app/main.tsx +150 -150
  6. package/src/config/loader.ts +245 -245
  7. package/src/index.ts +33 -33
  8. package/src/lib/authentication/components/CallbackHandler.tsx +45 -45
  9. package/src/lib/authentication/components/SignIn.tsx +46 -46
  10. package/src/lib/authentication/components/SignUp.tsx +48 -48
  11. package/src/lib/authentication/providers/clerk.tsx +224 -224
  12. package/src/lib/authentication/ui/AuthCard.tsx +7 -7
  13. package/src/lib/authentication/ui/EmailLinkCallbackUi.tsx +129 -125
  14. package/src/lib/authentication/ui/EmailLinkSentUi.tsx +105 -101
  15. package/src/lib/authentication/ui/EmailLinkSignInUi.tsx +100 -96
  16. package/src/lib/authentication/ui/EmailVerificationUi.tsx +128 -124
  17. package/src/lib/authentication/ui/ZudokuAuthUi.tsx +620 -616
  18. package/src/lib/components/AiAssistantMenuItems.tsx +102 -102
  19. package/src/lib/components/Autocomplete.tsx +123 -123
  20. package/src/lib/components/DeveloperHint.tsx +39 -35
  21. package/src/lib/components/Header.tsx +260 -260
  22. package/src/lib/components/Layout.tsx +53 -53
  23. package/src/lib/components/Main.tsx +51 -51
  24. package/src/lib/components/Mermaid.tsx +74 -70
  25. package/src/lib/components/MobileTopNavigation.tsx +276 -276
  26. package/src/lib/components/MultiSelect.tsx +86 -82
  27. package/src/lib/components/TopNavigation.tsx +103 -103
  28. package/src/lib/components/index.ts +26 -26
  29. package/src/lib/components/navigation/NavigationCategory.tsx +157 -157
  30. package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -35
  31. package/src/lib/components/navigation/NavigationItem.tsx +181 -177
  32. package/src/lib/core/RouteGuard.tsx +193 -193
  33. package/src/lib/errors/ErrorMessage.tsx +50 -46
  34. package/src/lib/plugins/api-catalog/Catalog.tsx +80 -80
  35. package/src/lib/plugins/api-keys/CreateApiKey.tsx +128 -124
  36. package/src/lib/plugins/api-keys/CreateApiKeyDialog.tsx +49 -49
  37. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +72 -72
  38. package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -342
  39. package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +127 -127
  40. package/src/lib/plugins/markdown/MdxPage.tsx +285 -285
  41. package/src/lib/plugins/openapi/ApiHeader.tsx +96 -96
  42. package/src/lib/plugins/openapi/CollapsibleCode.tsx +88 -88
  43. package/src/lib/plugins/openapi/DownloadSchemaButton.tsx +94 -94
  44. package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +52 -52
  45. package/src/lib/plugins/openapi/OperationListItem.tsx +183 -183
  46. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +63 -63
  47. package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +120 -117
  48. package/src/lib/plugins/openapi/SchemaInfo.tsx +344 -344
  49. package/src/lib/plugins/openapi/SchemaList.tsx +113 -113
  50. package/src/lib/plugins/openapi/Sidecar.tsx +312 -309
  51. package/src/lib/plugins/openapi/SidecarExamples.tsx +177 -174
  52. package/src/lib/plugins/openapi/components/EnumValues.tsx +58 -58
  53. package/src/lib/plugins/openapi/components/ResponseContent.tsx +117 -114
  54. package/src/lib/plugins/openapi/playground/BodyPanel.tsx +274 -271
  55. package/src/lib/plugins/openapi/playground/CollapsibleHeader.tsx +51 -51
  56. package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +60 -60
  57. package/src/lib/plugins/openapi/playground/Headers.tsx +188 -181
  58. package/src/lib/plugins/openapi/playground/IdentityDialog.tsx +75 -75
  59. package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +38 -38
  60. package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +45 -45
  61. package/src/lib/plugins/openapi/playground/Playground.tsx +602 -599
  62. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +56 -56
  63. package/src/lib/plugins/openapi/playground/QueryParams.tsx +151 -148
  64. package/src/lib/plugins/openapi/playground/RequestLoginDialog.tsx +70 -70
  65. package/src/lib/plugins/openapi/playground/request-panel/MultipartField.tsx +91 -91
  66. package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -50
  67. package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +355 -355
  68. package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +106 -102
  69. package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +189 -184
  70. package/src/lib/plugins/openapi/schema/SchemaView.tsx +299 -299
  71. package/src/lib/plugins/search-pagefind/IndexingDialog.tsx +162 -162
  72. package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +202 -202
  73. package/src/lib/plugins/search-pagefind/ResultList.tsx +122 -118
  74. package/src/lib/ui/ActionButton.tsx +21 -21
  75. package/src/lib/ui/Command.tsx +191 -191
  76. package/src/lib/util/MdxComponents.tsx +150 -150
  77. package/src/vite/config.ts +234 -231
  78. package/src/vite/dev-server.ts +291 -291
  79. package/src/vite/plugin-api-keys.ts +50 -50
  80. package/src/vite/plugin-api.ts +320 -318
  81. package/src/vite/plugin-auth.ts +38 -38
  82. package/src/vite/plugin-component.ts +45 -39
  83. package/src/vite/plugin-config.ts +75 -75
  84. package/src/vite/plugin-custom-pages.ts +36 -36
  85. package/src/vite/plugin-docs.ts +202 -202
  86. package/src/vite/plugin-markdown-export.ts +214 -214
  87. package/src/vite/plugin-mdx.ts +149 -149
  88. package/src/vite/plugin-navigation.ts +106 -106
  89. package/src/vite/plugin-search.ts +47 -47
  90. package/src/vite/plugin.ts +42 -42
  91. package/src/vite/prerender/prerender.ts +233 -233
@@ -1,183 +1,183 @@
1
- import { useState } from "react";
2
- import { Badge } from "@lukoweb/apitogo/ui/Badge.js";
3
- import { Separator } from "@lukoweb/apitogo/ui/Separator.js";
4
- import { Heading } from "../../components/Heading.js";
5
- import { Markdown } from "../../components/Markdown.js";
6
- import { PagefindSearchMeta } from "../../components/PagefindSearchMeta.js";
7
- import { cn } from "../../util/cn.js";
8
- import { renderIf } from "../../util/renderIf.js";
9
- import { ResponseContent } from "./components/ResponseContent.js";
10
- import { SelectOnClick } from "./components/SelectOnClick.js";
11
- import { useOasConfig } from "./context.js";
12
- import { type FragmentType, useFragment } from "./graphql/index.js";
13
- import { MCPEndpoint } from "./MCPEndpoint.js";
14
- import { OperationsFragment } from "./OperationList.js";
15
- import { ParameterList } from "./ParameterList.js";
16
- import { SchemaView } from "./schema/SchemaView.js";
17
- import { Sidecar } from "./Sidecar.js";
18
- import { methodForColor } from "./util/methodToColor.js";
19
-
20
- const PARAM_GROUPS = ["path", "query", "header", "cookie"] as const;
21
- export type ParameterGroup = (typeof PARAM_GROUPS)[number];
22
-
23
- export const OperationListItem = ({
24
- operationFragment,
25
- globalSelectedServer,
26
- shouldLazyHighlight,
27
- }: {
28
- operationFragment: FragmentType<typeof OperationsFragment>;
29
- globalSelectedServer?: string;
30
- shouldLazyHighlight?: boolean;
31
- }) => {
32
- const operation = useFragment(OperationsFragment, operationFragment);
33
- const groupedParameters = Object.groupBy(
34
- operation.parameters ?? [],
35
- (param) => param.in,
36
- );
37
- const { options } = useOasConfig();
38
-
39
- // Manual server selection takes precedence over the server hierarchy.
40
- // If no manual selection, fall back to operation's first server (already respects operation > path > global hierarchy)
41
- const displayServerUrl = globalSelectedServer || operation.servers.at(0)?.url;
42
-
43
- const first = operation.responses.at(0);
44
- const [selectedResponse, setSelectedResponse] = useState(first?.statusCode);
45
- const isMCPEndpoint = operation.extensions?.["x-mcp-server"] !== undefined;
46
-
47
- return (
48
- <div>
49
- {operation.deprecated && (
50
- <Badge variant="muted" className="text-xs mb-4">
51
- deprecated
52
- </Badge>
53
- )}
54
- <div
55
- key={operation.operationId}
56
- className={cn(
57
- "grid grid-cols-1 lg:grid-cols-[minmax(0,4fr)_minmax(0,3fr)] gap-x-8 gap-y-4 items-start",
58
- operation.deprecated && "opacity-50 transition hover:opacity-100",
59
- )}
60
- >
61
- <Heading
62
- level={2}
63
- id={operation.slug}
64
- registerNavigationAnchor
65
- className="break-all col-span-full"
66
- >
67
- {operation.summary}
68
- </Heading>
69
- {!isMCPEndpoint && (
70
- <div className="text-sm flex gap-2 font-mono col-span-full">
71
- <span className={methodForColor(operation.method)}>
72
- {operation.method.toUpperCase()}
73
- </span>
74
- <SelectOnClick className="max-w-full truncate flex cursor-pointer">
75
- {displayServerUrl && (
76
- <div className="text-neutral-400 dark:text-neutral-500 truncate">
77
- {displayServerUrl.replace(/\/$/, "")}
78
- </div>
79
- )}
80
- <div className="text-neutral-900 dark:text-neutral-200">
81
- {operation.path}
82
- </div>
83
- </SelectOnClick>
84
- </div>
85
- )}
86
-
87
- {isMCPEndpoint ? (
88
- <div className="col-span-full">
89
- <MCPEndpoint
90
- serverUrl={displayServerUrl}
91
- summary={operation.summary ?? undefined}
92
- data={operation.extensions?.["x-mcp-server"]}
93
- />
94
- </div>
95
- ) : (
96
- <div
97
- className={cn(
98
- "flex flex-col gap-4",
99
- options?.disableSidecar && "col-span-full",
100
- )}
101
- >
102
- {operation.description && (
103
- <Markdown
104
- className="max-w-full prose-img:max-w-prose"
105
- content={operation.description}
106
- />
107
- )}
108
- {operation.parameters &&
109
- operation.parameters.length > 0 &&
110
- PARAM_GROUPS.flatMap((group) =>
111
- groupedParameters[group]?.length ? (
112
- <ParameterList
113
- key={group}
114
- summary={operation.summary ?? undefined}
115
- id={operation.slug}
116
- parameters={groupedParameters[group]}
117
- group={group}
118
- />
119
- ) : (
120
- []
121
- ),
122
- )}
123
- {renderIf(operation.requestBody?.content?.at(0)?.schema, () => (
124
- <Separator className="my-4" />
125
- ))}
126
- {renderIf(
127
- operation.requestBody?.content?.at(0)?.schema,
128
- (schema) => (
129
- <div className="flex flex-col gap-4">
130
- <Heading
131
- level={3}
132
- className="capitalize flex items-center gap-2"
133
- id={`${operation.slug}/request-body`}
134
- >
135
- {operation.summary && (
136
- <PagefindSearchMeta>
137
- {operation.summary} &rsaquo;{" "}
138
- </PagefindSearchMeta>
139
- )}
140
- Request Body{" "}
141
- {operation.requestBody?.required === false ? (
142
- <Badge variant="muted">optional</Badge>
143
- ) : (
144
- ""
145
- )}
146
- </Heading>
147
- <SchemaView schema={schema} />
148
- </div>
149
- ),
150
- )}
151
- <Separator className="my-4" />
152
- {operation.responses.length > 0 && (
153
- <>
154
- <Heading level={3} id={`${operation.slug}/responses`}>
155
- {operation.summary && (
156
- <PagefindSearchMeta>
157
- {operation.summary} &rsaquo;{" "}
158
- </PagefindSearchMeta>
159
- )}
160
- Responses
161
- </Heading>
162
- <ResponseContent
163
- responses={operation.responses}
164
- selectedResponse={selectedResponse}
165
- onSelectResponse={setSelectedResponse}
166
- />
167
- </>
168
- )}
169
- </div>
170
- )}
171
-
172
- {renderIf(!options?.disableSidecar && !isMCPEndpoint, () => (
173
- <Sidecar
174
- selectedResponse={selectedResponse}
175
- operation={operation}
176
- globalSelectedServer={globalSelectedServer}
177
- shouldLazyHighlight={shouldLazyHighlight}
178
- />
179
- ))}
180
- </div>
181
- </div>
182
- );
183
- };
1
+ import { Badge } from "@lukoweb/apitogo/ui/Badge.js";
2
+ import { Separator } from "@lukoweb/apitogo/ui/Separator.js";
3
+ import { useState } from "react";
4
+ import { Heading } from "../../components/Heading.js";
5
+ import { Markdown } from "../../components/Markdown.js";
6
+ import { PagefindSearchMeta } from "../../components/PagefindSearchMeta.js";
7
+ import { cn } from "../../util/cn.js";
8
+ import { renderIf } from "../../util/renderIf.js";
9
+ import { ResponseContent } from "./components/ResponseContent.js";
10
+ import { SelectOnClick } from "./components/SelectOnClick.js";
11
+ import { useOasConfig } from "./context.js";
12
+ import { type FragmentType, useFragment } from "./graphql/index.js";
13
+ import { MCPEndpoint } from "./MCPEndpoint.js";
14
+ import { OperationsFragment } from "./OperationList.js";
15
+ import { ParameterList } from "./ParameterList.js";
16
+ import { SchemaView } from "./schema/SchemaView.js";
17
+ import { Sidecar } from "./Sidecar.js";
18
+ import { methodForColor } from "./util/methodToColor.js";
19
+
20
+ const PARAM_GROUPS = ["path", "query", "header", "cookie"] as const;
21
+ export type ParameterGroup = (typeof PARAM_GROUPS)[number];
22
+
23
+ export const OperationListItem = ({
24
+ operationFragment,
25
+ globalSelectedServer,
26
+ shouldLazyHighlight,
27
+ }: {
28
+ operationFragment: FragmentType<typeof OperationsFragment>;
29
+ globalSelectedServer?: string;
30
+ shouldLazyHighlight?: boolean;
31
+ }) => {
32
+ const operation = useFragment(OperationsFragment, operationFragment);
33
+ const groupedParameters = Object.groupBy(
34
+ operation.parameters ?? [],
35
+ (param) => param.in,
36
+ );
37
+ const { options } = useOasConfig();
38
+
39
+ // Manual server selection takes precedence over the server hierarchy.
40
+ // If no manual selection, fall back to operation's first server (already respects operation > path > global hierarchy)
41
+ const displayServerUrl = globalSelectedServer || operation.servers.at(0)?.url;
42
+
43
+ const first = operation.responses.at(0);
44
+ const [selectedResponse, setSelectedResponse] = useState(first?.statusCode);
45
+ const isMCPEndpoint = operation.extensions?.["x-mcp-server"] !== undefined;
46
+
47
+ return (
48
+ <div>
49
+ {operation.deprecated && (
50
+ <Badge variant="muted" className="text-xs mb-4">
51
+ deprecated
52
+ </Badge>
53
+ )}
54
+ <div
55
+ key={operation.operationId}
56
+ className={cn(
57
+ "grid grid-cols-1 lg:grid-cols-[minmax(0,4fr)_minmax(0,3fr)] gap-x-8 gap-y-4 items-start",
58
+ operation.deprecated && "opacity-50 transition hover:opacity-100",
59
+ )}
60
+ >
61
+ <Heading
62
+ level={2}
63
+ id={operation.slug}
64
+ registerNavigationAnchor
65
+ className="break-all col-span-full"
66
+ >
67
+ {operation.summary}
68
+ </Heading>
69
+ {!isMCPEndpoint && (
70
+ <div className="text-sm flex gap-2 font-mono col-span-full">
71
+ <span className={methodForColor(operation.method)}>
72
+ {operation.method.toUpperCase()}
73
+ </span>
74
+ <SelectOnClick className="max-w-full truncate flex cursor-pointer">
75
+ {displayServerUrl && (
76
+ <div className="text-neutral-400 dark:text-neutral-500 truncate">
77
+ {displayServerUrl.replace(/\/$/, "")}
78
+ </div>
79
+ )}
80
+ <div className="text-neutral-900 dark:text-neutral-200">
81
+ {operation.path}
82
+ </div>
83
+ </SelectOnClick>
84
+ </div>
85
+ )}
86
+
87
+ {isMCPEndpoint ? (
88
+ <div className="col-span-full">
89
+ <MCPEndpoint
90
+ serverUrl={displayServerUrl}
91
+ summary={operation.summary ?? undefined}
92
+ data={operation.extensions?.["x-mcp-server"]}
93
+ />
94
+ </div>
95
+ ) : (
96
+ <div
97
+ className={cn(
98
+ "flex flex-col gap-4",
99
+ options?.disableSidecar && "col-span-full",
100
+ )}
101
+ >
102
+ {operation.description && (
103
+ <Markdown
104
+ className="max-w-full prose-img:max-w-prose"
105
+ content={operation.description}
106
+ />
107
+ )}
108
+ {operation.parameters &&
109
+ operation.parameters.length > 0 &&
110
+ PARAM_GROUPS.flatMap((group) =>
111
+ groupedParameters[group]?.length ? (
112
+ <ParameterList
113
+ key={group}
114
+ summary={operation.summary ?? undefined}
115
+ id={operation.slug}
116
+ parameters={groupedParameters[group]}
117
+ group={group}
118
+ />
119
+ ) : (
120
+ []
121
+ ),
122
+ )}
123
+ {renderIf(operation.requestBody?.content?.at(0)?.schema, () => (
124
+ <Separator className="my-4" />
125
+ ))}
126
+ {renderIf(
127
+ operation.requestBody?.content?.at(0)?.schema,
128
+ (schema) => (
129
+ <div className="flex flex-col gap-4">
130
+ <Heading
131
+ level={3}
132
+ className="capitalize flex items-center gap-2"
133
+ id={`${operation.slug}/request-body`}
134
+ >
135
+ {operation.summary && (
136
+ <PagefindSearchMeta>
137
+ {operation.summary} &rsaquo;{" "}
138
+ </PagefindSearchMeta>
139
+ )}
140
+ Request Body{" "}
141
+ {operation.requestBody?.required === false ? (
142
+ <Badge variant="muted">optional</Badge>
143
+ ) : (
144
+ ""
145
+ )}
146
+ </Heading>
147
+ <SchemaView schema={schema} />
148
+ </div>
149
+ ),
150
+ )}
151
+ <Separator className="my-4" />
152
+ {operation.responses.length > 0 && (
153
+ <>
154
+ <Heading level={3} id={`${operation.slug}/responses`}>
155
+ {operation.summary && (
156
+ <PagefindSearchMeta>
157
+ {operation.summary} &rsaquo;{" "}
158
+ </PagefindSearchMeta>
159
+ )}
160
+ Responses
161
+ </Heading>
162
+ <ResponseContent
163
+ responses={operation.responses}
164
+ selectedResponse={selectedResponse}
165
+ onSelectResponse={setSelectedResponse}
166
+ />
167
+ </>
168
+ )}
169
+ </div>
170
+ )}
171
+
172
+ {renderIf(!options?.disableSidecar && !isMCPEndpoint, () => (
173
+ <Sidecar
174
+ selectedResponse={selectedResponse}
175
+ operation={operation}
176
+ globalSelectedServer={globalSelectedServer}
177
+ shouldLazyHighlight={shouldLazyHighlight}
178
+ />
179
+ ))}
180
+ </div>
181
+ </div>
182
+ );
183
+ };
@@ -1,63 +1,63 @@
1
- import { ChevronsDownUpIcon, ChevronsUpDownIcon } from "lucide-react";
2
- import { Button } from "@lukoweb/apitogo/components";
3
- import {
4
- Collapsible,
5
- CollapsibleContent,
6
- CollapsibleTrigger,
7
- } from "@lukoweb/apitogo/ui/Collapsible.js";
8
- import type { MediaTypeObject } from "./graphql/graphql.js";
9
- import * as SidecarBox from "./SidecarBox.js";
10
- import { SidecarExamples } from "./SidecarExamples.js";
11
-
12
- export const RequestBodySidecarBox = ({
13
- content,
14
- onExampleChange,
15
- isOnScreen,
16
- shouldLazyHighlight,
17
- selectedContentIndex,
18
- selectedExampleIndex,
19
- }: {
20
- content: MediaTypeObject[];
21
- onExampleChange?: (selected: {
22
- contentTypeIndex: number;
23
- exampleIndex: number;
24
- }) => void;
25
- isOnScreen: boolean;
26
- shouldLazyHighlight?: boolean;
27
- selectedContentIndex: number;
28
- selectedExampleIndex: number;
29
- }) => {
30
- if (content.length === 0) return null;
31
-
32
- return (
33
- <Collapsible className="group/collapsible" defaultOpen>
34
- <SidecarBox.Root>
35
- <SidecarBox.Head className="text-xs flex justify-between items-center">
36
- <span className="flex items-center gap-1 font-medium">
37
- <CollapsibleTrigger asChild>
38
- <Button
39
- variant="ghost"
40
- className="size-fit px-1 py-1 -my-1"
41
- aria-label="Toggle request body examples"
42
- >
43
- <ChevronsDownUpIcon className="size-[1em] group-data-[state=closed]/collapsible:hidden" />
44
- <ChevronsUpDownIcon className="size-[1em] group-data-[state=open]/collapsible:hidden" />
45
- </Button>
46
- </CollapsibleTrigger>
47
- Example Request Body
48
- </span>
49
- </SidecarBox.Head>
50
- <CollapsibleContent>
51
- <SidecarExamples
52
- selectedContentIndex={selectedContentIndex}
53
- selectedExampleIndex={selectedExampleIndex}
54
- content={content}
55
- onExampleChange={onExampleChange}
56
- isOnScreen={isOnScreen}
57
- shouldLazyHighlight={shouldLazyHighlight}
58
- />
59
- </CollapsibleContent>
60
- </SidecarBox.Root>
61
- </Collapsible>
62
- );
63
- };
1
+ import { Button } from "@lukoweb/apitogo/components";
2
+ import {
3
+ Collapsible,
4
+ CollapsibleContent,
5
+ CollapsibleTrigger,
6
+ } from "@lukoweb/apitogo/ui/Collapsible.js";
7
+ import { ChevronsDownUpIcon, ChevronsUpDownIcon } from "lucide-react";
8
+ import type { MediaTypeObject } from "./graphql/graphql.js";
9
+ import * as SidecarBox from "./SidecarBox.js";
10
+ import { SidecarExamples } from "./SidecarExamples.js";
11
+
12
+ export const RequestBodySidecarBox = ({
13
+ content,
14
+ onExampleChange,
15
+ isOnScreen,
16
+ shouldLazyHighlight,
17
+ selectedContentIndex,
18
+ selectedExampleIndex,
19
+ }: {
20
+ content: MediaTypeObject[];
21
+ onExampleChange?: (selected: {
22
+ contentTypeIndex: number;
23
+ exampleIndex: number;
24
+ }) => void;
25
+ isOnScreen: boolean;
26
+ shouldLazyHighlight?: boolean;
27
+ selectedContentIndex: number;
28
+ selectedExampleIndex: number;
29
+ }) => {
30
+ if (content.length === 0) return null;
31
+
32
+ return (
33
+ <Collapsible className="group/collapsible" defaultOpen>
34
+ <SidecarBox.Root>
35
+ <SidecarBox.Head className="text-xs flex justify-between items-center">
36
+ <span className="flex items-center gap-1 font-medium">
37
+ <CollapsibleTrigger asChild>
38
+ <Button
39
+ variant="ghost"
40
+ className="size-fit px-1 py-1 -my-1"
41
+ aria-label="Toggle request body examples"
42
+ >
43
+ <ChevronsDownUpIcon className="size-[1em] group-data-[state=closed]/collapsible:hidden" />
44
+ <ChevronsUpDownIcon className="size-[1em] group-data-[state=open]/collapsible:hidden" />
45
+ </Button>
46
+ </CollapsibleTrigger>
47
+ Example Request Body
48
+ </span>
49
+ </SidecarBox.Head>
50
+ <CollapsibleContent>
51
+ <SidecarExamples
52
+ selectedContentIndex={selectedContentIndex}
53
+ selectedExampleIndex={selectedExampleIndex}
54
+ content={content}
55
+ onExampleChange={onExampleChange}
56
+ isOnScreen={isOnScreen}
57
+ shouldLazyHighlight={shouldLazyHighlight}
58
+ />
59
+ </CollapsibleContent>
60
+ </SidecarBox.Root>
61
+ </Collapsible>
62
+ );
63
+ };