@lukoweb/apitogo 0.1.1 → 0.1.3

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 +168 -57
  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 +2 -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,102 +1,106 @@
1
- import type { UseMutationResult } from "@tanstack/react-query";
2
- import { SendIcon, UnplugIcon } from "lucide-react";
3
- import { Spinner } from "@lukoweb/apitogo/components";
4
- import { Alert, AlertDescription, AlertTitle } from "@lukoweb/apitogo/ui/Alert.js";
5
- import { Button } from "../../../../ui/Button.js";
6
- import { cn } from "../../../../util/cn.js";
7
- import type { PlaygroundResult } from "../Playground.js";
8
- import ResponseStatusBar from "./ResponseStatusBar.js";
9
- import { ResponseTab } from "./ResponseTab.js";
10
-
11
- export const ResultPanel = ({
12
- queryMutation,
13
- showLongRunningWarning,
14
- onCancel,
15
- tip,
16
- isFinished,
17
- progress,
18
- }: {
19
- // biome-ignore lint/suspicious/noExplicitAny: Allow any type
20
- queryMutation: UseMutationResult<PlaygroundResult, Error, any>;
21
- showLongRunningWarning?: boolean;
22
- onCancel?: () => void;
23
- isFinished: boolean;
24
- progress: number;
25
- tip?: React.ReactNode;
26
- }) => {
27
- return (
28
- <div className="flex flex-col overflow-y-auto h-[80vh] bg-muted/50">
29
- {(queryMutation.isPending || queryMutation.data) && (
30
- <ResponseStatusBar
31
- status={queryMutation.data?.status}
32
- time={queryMutation.data?.time}
33
- size={queryMutation.data?.size}
34
- isFinished={isFinished}
35
- progress={progress}
36
- />
37
- )}
38
- {queryMutation.error ? (
39
- <div className="max-w-2/3 mx-auto mt-20">
40
- <Alert>
41
- <UnplugIcon size={24} strokeWidth={1.5} className="me-5" />
42
- <AlertTitle>Request failed</AlertTitle>
43
- <AlertDescription>
44
- {queryMutation.error.message ||
45
- String(queryMutation.error) ||
46
- "Unexpected error"}
47
- </AlertDescription>
48
- </Alert>
49
- </div>
50
- ) : queryMutation.data ? (
51
- <ResponseTab
52
- request={queryMutation.data.request}
53
- size={queryMutation.data.size}
54
- headers={queryMutation.data.headers}
55
- body={queryMutation.data.body}
56
- isBinary={queryMutation.data.isBinary}
57
- fileName={queryMutation.data.fileName}
58
- blob={queryMutation.data.blob}
59
- />
60
- ) : queryMutation.isPending ? (
61
- <div className="grid place-items-center h-full">
62
- <div className="flex flex-col gap-2 items-center mt-20">
63
- <Spinner />
64
- <div
65
- className={cn(
66
- "opacity-0 pointer-events-none transition-opacity h-20 text-sm text-muted-foreground duration-300 flex flex-col gap-2 items-center",
67
- showLongRunningWarning && "opacity-100 pointer-events-auto",
68
- )}
69
- >
70
- Looks like the request is taking longer than expected.
71
- <Button
72
- type="button"
73
- onClick={onCancel}
74
- size="sm"
75
- className="w-fit"
76
- variant="outline"
77
- >
78
- Cancel
79
- </Button>
80
- </div>
81
- </div>
82
- </div>
83
- ) : (
84
- <div className="h-full grid place-items-center">
85
- <div className="flex flex-col gap-4 items-center">
86
- <SendIcon
87
- size={64}
88
- className="text-muted-foreground"
89
- strokeWidth={1.2}
90
- />
91
- <span className="text-[16px] font-semibold text-muted-foreground">
92
- Send your first request
93
- </span>
94
- {tip}
95
- </div>
96
- </div>
97
- )}
98
- </div>
99
- );
100
- };
101
-
102
- export default ResultPanel;
1
+ import { Spinner } from "@lukoweb/apitogo/components";
2
+ import {
3
+ Alert,
4
+ AlertDescription,
5
+ AlertTitle,
6
+ } from "@lukoweb/apitogo/ui/Alert.js";
7
+ import type { UseMutationResult } from "@tanstack/react-query";
8
+ import { SendIcon, UnplugIcon } from "lucide-react";
9
+ import { Button } from "../../../../ui/Button.js";
10
+ import { cn } from "../../../../util/cn.js";
11
+ import type { PlaygroundResult } from "../Playground.js";
12
+ import ResponseStatusBar from "./ResponseStatusBar.js";
13
+ import { ResponseTab } from "./ResponseTab.js";
14
+
15
+ export const ResultPanel = ({
16
+ queryMutation,
17
+ showLongRunningWarning,
18
+ onCancel,
19
+ tip,
20
+ isFinished,
21
+ progress,
22
+ }: {
23
+ // biome-ignore lint/suspicious/noExplicitAny: Allow any type
24
+ queryMutation: UseMutationResult<PlaygroundResult, Error, any>;
25
+ showLongRunningWarning?: boolean;
26
+ onCancel?: () => void;
27
+ isFinished: boolean;
28
+ progress: number;
29
+ tip?: React.ReactNode;
30
+ }) => {
31
+ return (
32
+ <div className="flex flex-col overflow-y-auto h-[80vh] bg-muted/50">
33
+ {(queryMutation.isPending || queryMutation.data) && (
34
+ <ResponseStatusBar
35
+ status={queryMutation.data?.status}
36
+ time={queryMutation.data?.time}
37
+ size={queryMutation.data?.size}
38
+ isFinished={isFinished}
39
+ progress={progress}
40
+ />
41
+ )}
42
+ {queryMutation.error ? (
43
+ <div className="max-w-2/3 mx-auto mt-20">
44
+ <Alert>
45
+ <UnplugIcon size={24} strokeWidth={1.5} className="me-5" />
46
+ <AlertTitle>Request failed</AlertTitle>
47
+ <AlertDescription>
48
+ {queryMutation.error.message ||
49
+ String(queryMutation.error) ||
50
+ "Unexpected error"}
51
+ </AlertDescription>
52
+ </Alert>
53
+ </div>
54
+ ) : queryMutation.data ? (
55
+ <ResponseTab
56
+ request={queryMutation.data.request}
57
+ size={queryMutation.data.size}
58
+ headers={queryMutation.data.headers}
59
+ body={queryMutation.data.body}
60
+ isBinary={queryMutation.data.isBinary}
61
+ fileName={queryMutation.data.fileName}
62
+ blob={queryMutation.data.blob}
63
+ />
64
+ ) : queryMutation.isPending ? (
65
+ <div className="grid place-items-center h-full">
66
+ <div className="flex flex-col gap-2 items-center mt-20">
67
+ <Spinner />
68
+ <div
69
+ className={cn(
70
+ "opacity-0 pointer-events-none transition-opacity h-20 text-sm text-muted-foreground duration-300 flex flex-col gap-2 items-center",
71
+ showLongRunningWarning && "opacity-100 pointer-events-auto",
72
+ )}
73
+ >
74
+ Looks like the request is taking longer than expected.
75
+ <Button
76
+ type="button"
77
+ onClick={onCancel}
78
+ size="sm"
79
+ className="w-fit"
80
+ variant="outline"
81
+ >
82
+ Cancel
83
+ </Button>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ ) : (
88
+ <div className="h-full grid place-items-center">
89
+ <div className="flex flex-col gap-4 items-center">
90
+ <SendIcon
91
+ size={64}
92
+ className="text-muted-foreground"
93
+ strokeWidth={1.2}
94
+ />
95
+ <span className="text-[16px] font-semibold text-muted-foreground">
96
+ Send your first request
97
+ </span>
98
+ {tip}
99
+ </div>
100
+ </div>
101
+ )}
102
+ </div>
103
+ );
104
+ };
105
+
106
+ export default ResultPanel;
@@ -1,184 +1,189 @@
1
- import * as Collapsible from "@radix-ui/react-collapsible";
2
- import { MinusIcon, PlusIcon, RefreshCcwDotIcon } from "lucide-react";
3
- import { useState } from "react";
4
- import { Item, ItemActions, ItemContent, ItemTitle } from "@lukoweb/apitogo/ui/Item.js";
5
- import { InlineCode } from "../../../components/InlineCode.js";
6
- import { Markdown } from "../../../components/Markdown.js";
7
- import type { SchemaObject } from "../../../oas/parser/index.js";
8
- import { Button } from "../../../ui/Button.js";
9
- import { cn } from "../../../util/cn.js";
10
- import { ConstValue } from "../components/ConstValue.js";
11
- import { EnumValues } from "../components/EnumValues.js";
12
- import { ParamInfos } from "../ParamInfos.js";
13
- import { SchemaExampleAndDefault } from "./SchemaExampleAndDefault.js";
14
- import { SchemaView } from "./SchemaView.js";
15
- import {
16
- extractCircularRefInfo,
17
- isArrayCircularRef,
18
- isArrayType,
19
- isCircularRef,
20
- isComplexType,
21
- } from "./utils.js";
22
-
23
- const RecursiveIndicator = ({ circularProp }: { circularProp?: string }) => (
24
- <InlineCode className="inline-flex items-center gap-1.5 text-xs translate-y-0.5">
25
- <RefreshCcwDotIcon size={13} />
26
- <span>{circularProp ? `${circularProp} (circular)` : "circular"}</span>
27
- </InlineCode>
28
- );
29
-
30
- export const SchemaPropertyItem = ({
31
- name,
32
- schema,
33
- group,
34
- defaultOpen = false,
35
- showCollapseButton = true,
36
- }: {
37
- name: string;
38
- schema: SchemaObject;
39
- group: "required" | "optional" | "deprecated";
40
- defaultOpen?: boolean;
41
- showCollapseButton?: boolean;
42
- }) => {
43
- const [isOpen, setIsOpen] = useState(defaultOpen);
44
-
45
- const isDeprecated = group === "deprecated";
46
-
47
- if (isCircularRef(schema)) {
48
- return (
49
- <Item
50
- className={cn(
51
- isDeprecated && "opacity-50 hover:opacity-100 transition",
52
- )}
53
- >
54
- <ItemContent className="gap-y-2">
55
- <div>
56
- <ItemTitle className="inline me-2">
57
- <code className={cn(isDeprecated && "line-through")}>{name}</code>
58
- </ItemTitle>
59
- {"\u200B"}
60
- <ParamInfos
61
- className="inline"
62
- schema={schema}
63
- extraItems={[
64
- group === "required" && (
65
- <span className="text-primary">required</span>
66
- ),
67
- <RecursiveIndicator key="circular-ref" />,
68
- ]}
69
- />
70
- </div>
71
- <SchemaExampleAndDefault schema={schema} />
72
- </ItemContent>
73
- </Item>
74
- );
75
- }
76
-
77
- const isCollapsible = Boolean(
78
- (schema.allOf ||
79
- schema.anyOf ||
80
- schema.oneOf ||
81
- isComplexType(schema) ||
82
- (isArrayType(schema) &&
83
- "items" in schema &&
84
- isComplexType(schema.items)) ||
85
- schema.additionalProperties) &&
86
- !isArrayCircularRef(schema),
87
- );
88
-
89
- const shouldRenderDescription = Boolean(
90
- schema.description ||
91
- ("items" in schema && schema.items?.enum) ||
92
- schema.const ||
93
- schema.enum ||
94
- schema.example !== undefined ||
95
- schema.default !== undefined,
96
- );
97
-
98
- return (
99
- <Item
100
- className={cn(isDeprecated && "opacity-50 hover:opacity-100 transition")}
101
- >
102
- <ItemContent className="gap-y-2">
103
- <div>
104
- <ItemTitle className="inline me-2">
105
- {isCollapsible ? (
106
- <button
107
- onClick={() => setIsOpen(!isOpen)}
108
- type="button"
109
- className="hover:underline"
110
- >
111
- <code className={cn(isDeprecated && "line-through")}>
112
- {name}
113
- </code>
114
- </button>
115
- ) : (
116
- <code className={cn(isDeprecated && "line-through")}>{name}</code>
117
- )}
118
- </ItemTitle>
119
- {"\u200B"}
120
- <ParamInfos
121
- className="inline"
122
- schema={schema}
123
- extraItems={[
124
- group === "required" && (
125
- <span className="text-primary">required</span>
126
- ),
127
- isArrayCircularRef(schema) && (
128
- <RecursiveIndicator
129
- circularProp={extractCircularRefInfo(schema.items)}
130
- />
131
- ),
132
- ]}
133
- />
134
- </div>
135
- {shouldRenderDescription && (
136
- <div className="flex flex-col gap-1.5">
137
- {schema.description && (
138
- <Markdown className="prose-sm" content={schema.description} />
139
- )}
140
- {"items" in schema && schema.items?.enum && (
141
- <EnumValues values={schema.items.enum} />
142
- )}
143
- {schema.const && <ConstValue schema={schema} hideDescription />}
144
- {schema.enum && <EnumValues values={schema.enum} />}
145
- <SchemaExampleAndDefault schema={schema} />
146
- </div>
147
- )}
148
- </ItemContent>
149
-
150
- {isCollapsible && showCollapseButton && (
151
- <ItemActions className="self-start">
152
- <Button
153
- variant="ghost"
154
- size="icon"
155
- className="rounded-full"
156
- onClick={() => setIsOpen(!isOpen)}
157
- aria-label="Toggle properties"
158
- >
159
- {isOpen ? <MinusIcon size={16} /> : <PlusIcon size={16} />}
160
- </Button>
161
- </ItemActions>
162
- )}
163
-
164
- {isCollapsible && (
165
- <Collapsible.Root
166
- defaultOpen={defaultOpen}
167
- open={isOpen}
168
- onOpenChange={setIsOpen}
169
- className={cn("w-full", !isOpen && "contents")}
170
- >
171
- <Collapsible.Content asChild>
172
- <ItemContent>
173
- {schema.anyOf || schema.oneOf || schema.type === "object" ? (
174
- <SchemaView schema={schema} />
175
- ) : isArrayType(schema) && "items" in schema ? (
176
- <SchemaView schema={schema.items} />
177
- ) : null}
178
- </ItemContent>
179
- </Collapsible.Content>
180
- </Collapsible.Root>
181
- )}
182
- </Item>
183
- );
184
- };
1
+ import {
2
+ Item,
3
+ ItemActions,
4
+ ItemContent,
5
+ ItemTitle,
6
+ } from "@lukoweb/apitogo/ui/Item.js";
7
+ import * as Collapsible from "@radix-ui/react-collapsible";
8
+ import { MinusIcon, PlusIcon, RefreshCcwDotIcon } from "lucide-react";
9
+ import { useState } from "react";
10
+ import { InlineCode } from "../../../components/InlineCode.js";
11
+ import { Markdown } from "../../../components/Markdown.js";
12
+ import type { SchemaObject } from "../../../oas/parser/index.js";
13
+ import { Button } from "../../../ui/Button.js";
14
+ import { cn } from "../../../util/cn.js";
15
+ import { ConstValue } from "../components/ConstValue.js";
16
+ import { EnumValues } from "../components/EnumValues.js";
17
+ import { ParamInfos } from "../ParamInfos.js";
18
+ import { SchemaExampleAndDefault } from "./SchemaExampleAndDefault.js";
19
+ import { SchemaView } from "./SchemaView.js";
20
+ import {
21
+ extractCircularRefInfo,
22
+ isArrayCircularRef,
23
+ isArrayType,
24
+ isCircularRef,
25
+ isComplexType,
26
+ } from "./utils.js";
27
+
28
+ const RecursiveIndicator = ({ circularProp }: { circularProp?: string }) => (
29
+ <InlineCode className="inline-flex items-center gap-1.5 text-xs translate-y-0.5">
30
+ <RefreshCcwDotIcon size={13} />
31
+ <span>{circularProp ? `${circularProp} (circular)` : "circular"}</span>
32
+ </InlineCode>
33
+ );
34
+
35
+ export const SchemaPropertyItem = ({
36
+ name,
37
+ schema,
38
+ group,
39
+ defaultOpen = false,
40
+ showCollapseButton = true,
41
+ }: {
42
+ name: string;
43
+ schema: SchemaObject;
44
+ group: "required" | "optional" | "deprecated";
45
+ defaultOpen?: boolean;
46
+ showCollapseButton?: boolean;
47
+ }) => {
48
+ const [isOpen, setIsOpen] = useState(defaultOpen);
49
+
50
+ const isDeprecated = group === "deprecated";
51
+
52
+ if (isCircularRef(schema)) {
53
+ return (
54
+ <Item
55
+ className={cn(
56
+ isDeprecated && "opacity-50 hover:opacity-100 transition",
57
+ )}
58
+ >
59
+ <ItemContent className="gap-y-2">
60
+ <div>
61
+ <ItemTitle className="inline me-2">
62
+ <code className={cn(isDeprecated && "line-through")}>{name}</code>
63
+ </ItemTitle>
64
+ {"\u200B"}
65
+ <ParamInfos
66
+ className="inline"
67
+ schema={schema}
68
+ extraItems={[
69
+ group === "required" && (
70
+ <span className="text-primary">required</span>
71
+ ),
72
+ <RecursiveIndicator key="circular-ref" />,
73
+ ]}
74
+ />
75
+ </div>
76
+ <SchemaExampleAndDefault schema={schema} />
77
+ </ItemContent>
78
+ </Item>
79
+ );
80
+ }
81
+
82
+ const isCollapsible = Boolean(
83
+ (schema.allOf ||
84
+ schema.anyOf ||
85
+ schema.oneOf ||
86
+ isComplexType(schema) ||
87
+ (isArrayType(schema) &&
88
+ "items" in schema &&
89
+ isComplexType(schema.items)) ||
90
+ schema.additionalProperties) &&
91
+ !isArrayCircularRef(schema),
92
+ );
93
+
94
+ const shouldRenderDescription = Boolean(
95
+ schema.description ||
96
+ ("items" in schema && schema.items?.enum) ||
97
+ schema.const ||
98
+ schema.enum ||
99
+ schema.example !== undefined ||
100
+ schema.default !== undefined,
101
+ );
102
+
103
+ return (
104
+ <Item
105
+ className={cn(isDeprecated && "opacity-50 hover:opacity-100 transition")}
106
+ >
107
+ <ItemContent className="gap-y-2">
108
+ <div>
109
+ <ItemTitle className="inline me-2">
110
+ {isCollapsible ? (
111
+ <button
112
+ onClick={() => setIsOpen(!isOpen)}
113
+ type="button"
114
+ className="hover:underline"
115
+ >
116
+ <code className={cn(isDeprecated && "line-through")}>
117
+ {name}
118
+ </code>
119
+ </button>
120
+ ) : (
121
+ <code className={cn(isDeprecated && "line-through")}>{name}</code>
122
+ )}
123
+ </ItemTitle>
124
+ {"\u200B"}
125
+ <ParamInfos
126
+ className="inline"
127
+ schema={schema}
128
+ extraItems={[
129
+ group === "required" && (
130
+ <span className="text-primary">required</span>
131
+ ),
132
+ isArrayCircularRef(schema) && (
133
+ <RecursiveIndicator
134
+ circularProp={extractCircularRefInfo(schema.items)}
135
+ />
136
+ ),
137
+ ]}
138
+ />
139
+ </div>
140
+ {shouldRenderDescription && (
141
+ <div className="flex flex-col gap-1.5">
142
+ {schema.description && (
143
+ <Markdown className="prose-sm" content={schema.description} />
144
+ )}
145
+ {"items" in schema && schema.items?.enum && (
146
+ <EnumValues values={schema.items.enum} />
147
+ )}
148
+ {schema.const && <ConstValue schema={schema} hideDescription />}
149
+ {schema.enum && <EnumValues values={schema.enum} />}
150
+ <SchemaExampleAndDefault schema={schema} />
151
+ </div>
152
+ )}
153
+ </ItemContent>
154
+
155
+ {isCollapsible && showCollapseButton && (
156
+ <ItemActions className="self-start">
157
+ <Button
158
+ variant="ghost"
159
+ size="icon"
160
+ className="rounded-full"
161
+ onClick={() => setIsOpen(!isOpen)}
162
+ aria-label="Toggle properties"
163
+ >
164
+ {isOpen ? <MinusIcon size={16} /> : <PlusIcon size={16} />}
165
+ </Button>
166
+ </ItemActions>
167
+ )}
168
+
169
+ {isCollapsible && (
170
+ <Collapsible.Root
171
+ defaultOpen={defaultOpen}
172
+ open={isOpen}
173
+ onOpenChange={setIsOpen}
174
+ className={cn("w-full", !isOpen && "contents")}
175
+ >
176
+ <Collapsible.Content asChild>
177
+ <ItemContent>
178
+ {schema.anyOf || schema.oneOf || schema.type === "object" ? (
179
+ <SchemaView schema={schema} />
180
+ ) : isArrayType(schema) && "items" in schema ? (
181
+ <SchemaView schema={schema.items} />
182
+ ) : null}
183
+ </ItemContent>
184
+ </Collapsible.Content>
185
+ </Collapsible.Root>
186
+ )}
187
+ </Item>
188
+ );
189
+ };