@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.
- package/dist/cli/cli.js +17 -6
- package/dist/declarations/lib/ui/Command.d.ts +1 -1
- package/dist/declarations/lib/util/MdxComponents.d.ts +1 -1
- package/package.json +1 -1
- package/src/app/main.tsx +150 -150
- package/src/config/loader.ts +245 -245
- package/src/index.ts +33 -33
- package/src/lib/authentication/components/CallbackHandler.tsx +45 -45
- package/src/lib/authentication/components/SignIn.tsx +46 -46
- package/src/lib/authentication/components/SignUp.tsx +48 -48
- package/src/lib/authentication/providers/clerk.tsx +224 -224
- package/src/lib/authentication/ui/AuthCard.tsx +7 -7
- package/src/lib/authentication/ui/EmailLinkCallbackUi.tsx +129 -125
- package/src/lib/authentication/ui/EmailLinkSentUi.tsx +105 -101
- package/src/lib/authentication/ui/EmailLinkSignInUi.tsx +100 -96
- package/src/lib/authentication/ui/EmailVerificationUi.tsx +128 -124
- package/src/lib/authentication/ui/ZudokuAuthUi.tsx +620 -616
- package/src/lib/components/AiAssistantMenuItems.tsx +102 -102
- package/src/lib/components/Autocomplete.tsx +123 -123
- package/src/lib/components/DeveloperHint.tsx +39 -35
- package/src/lib/components/Header.tsx +260 -260
- package/src/lib/components/Layout.tsx +53 -53
- package/src/lib/components/Main.tsx +51 -51
- package/src/lib/components/Mermaid.tsx +74 -70
- package/src/lib/components/MobileTopNavigation.tsx +276 -276
- package/src/lib/components/MultiSelect.tsx +86 -82
- package/src/lib/components/TopNavigation.tsx +103 -103
- package/src/lib/components/index.ts +26 -26
- package/src/lib/components/navigation/NavigationCategory.tsx +157 -157
- package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -35
- package/src/lib/components/navigation/NavigationItem.tsx +181 -177
- package/src/lib/core/RouteGuard.tsx +193 -193
- package/src/lib/errors/ErrorMessage.tsx +50 -46
- package/src/lib/plugins/api-catalog/Catalog.tsx +80 -80
- package/src/lib/plugins/api-keys/CreateApiKey.tsx +128 -124
- package/src/lib/plugins/api-keys/CreateApiKeyDialog.tsx +49 -49
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +72 -72
- package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -342
- package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +127 -127
- package/src/lib/plugins/markdown/MdxPage.tsx +285 -285
- package/src/lib/plugins/openapi/ApiHeader.tsx +96 -96
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +88 -88
- package/src/lib/plugins/openapi/DownloadSchemaButton.tsx +94 -94
- package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +52 -52
- package/src/lib/plugins/openapi/OperationListItem.tsx +183 -183
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +63 -63
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +120 -117
- package/src/lib/plugins/openapi/SchemaInfo.tsx +344 -344
- package/src/lib/plugins/openapi/SchemaList.tsx +113 -113
- package/src/lib/plugins/openapi/Sidecar.tsx +312 -309
- package/src/lib/plugins/openapi/SidecarExamples.tsx +177 -174
- package/src/lib/plugins/openapi/components/EnumValues.tsx +58 -58
- package/src/lib/plugins/openapi/components/ResponseContent.tsx +117 -114
- package/src/lib/plugins/openapi/playground/BodyPanel.tsx +274 -271
- package/src/lib/plugins/openapi/playground/CollapsibleHeader.tsx +51 -51
- package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +60 -60
- package/src/lib/plugins/openapi/playground/Headers.tsx +188 -181
- package/src/lib/plugins/openapi/playground/IdentityDialog.tsx +75 -75
- package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +38 -38
- package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +45 -45
- package/src/lib/plugins/openapi/playground/Playground.tsx +602 -599
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +56 -56
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +151 -148
- package/src/lib/plugins/openapi/playground/RequestLoginDialog.tsx +70 -70
- package/src/lib/plugins/openapi/playground/request-panel/MultipartField.tsx +91 -91
- package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -50
- package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +355 -355
- package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +106 -102
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +189 -184
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +299 -299
- package/src/lib/plugins/search-pagefind/IndexingDialog.tsx +162 -162
- package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +202 -202
- package/src/lib/plugins/search-pagefind/ResultList.tsx +122 -118
- package/src/lib/ui/ActionButton.tsx +21 -21
- package/src/lib/ui/Command.tsx +191 -191
- package/src/lib/util/MdxComponents.tsx +150 -150
- package/src/vite/config.ts +234 -231
- package/src/vite/dev-server.ts +291 -291
- package/src/vite/plugin-api-keys.ts +50 -50
- package/src/vite/plugin-api.ts +320 -318
- package/src/vite/plugin-auth.ts +38 -38
- package/src/vite/plugin-component.ts +45 -39
- package/src/vite/plugin-config.ts +75 -75
- package/src/vite/plugin-custom-pages.ts +36 -36
- package/src/vite/plugin-docs.ts +202 -202
- package/src/vite/plugin-markdown-export.ts +214 -214
- package/src/vite/plugin-mdx.ts +149 -149
- package/src/vite/plugin-navigation.ts +106 -106
- package/src/vite/plugin-search.ts +47 -47
- package/src/vite/plugin.ts +42 -42
- package/src/vite/prerender/prerender.ts +233 -233
|
@@ -1,174 +1,177 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (mediaType
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"application/x-
|
|
27
|
-
"
|
|
28
|
-
"application/
|
|
29
|
-
"application/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
contentTypeIndex
|
|
44
|
-
exampleIndex
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{c.mediaType}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
1
|
+
import { Badge } from "@lukoweb/apitogo/ui/Badge.js";
|
|
2
|
+
import {
|
|
3
|
+
NativeSelect,
|
|
4
|
+
NativeSelectOption,
|
|
5
|
+
} from "@lukoweb/apitogo/ui/NativeSelect.js";
|
|
6
|
+
import { ExternalLinkIcon } from "lucide-react";
|
|
7
|
+
import { SyntaxHighlight } from "../../ui/SyntaxHighlight.js";
|
|
8
|
+
import { NonHighlightedCode } from "./components/NonHighlightedCode.js";
|
|
9
|
+
import type { MediaTypeObject } from "./graphql/graphql.js";
|
|
10
|
+
import * as SidecarBox from "./SidecarBox.js";
|
|
11
|
+
|
|
12
|
+
const formatForDisplay = (value: unknown): string | undefined => {
|
|
13
|
+
if (value == null) return;
|
|
14
|
+
if (typeof value === "string") return value.trim();
|
|
15
|
+
return JSON.stringify(value, null, 2);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const getLanguage = (mediaType?: string): string => {
|
|
19
|
+
if (!mediaType) return "text";
|
|
20
|
+
if (mediaType.endsWith("+json")) return "json";
|
|
21
|
+
if (mediaType.endsWith("+xml")) return "xml";
|
|
22
|
+
if (mediaType.endsWith("+yaml")) return "yaml";
|
|
23
|
+
|
|
24
|
+
const languages: Record<string, string> = {
|
|
25
|
+
"text/html": "html",
|
|
26
|
+
"application/x-ndjson": "json",
|
|
27
|
+
"application/json": "json",
|
|
28
|
+
"application/xml": "xml",
|
|
29
|
+
"application/x-yaml": "yaml",
|
|
30
|
+
"text/csv": "csv",
|
|
31
|
+
"application/javascript": "javascript",
|
|
32
|
+
"application/graphql": "graphql",
|
|
33
|
+
};
|
|
34
|
+
return languages[mediaType] ?? "text";
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type SidecarExamplesProps = {
|
|
38
|
+
content: MediaTypeObject[];
|
|
39
|
+
description?: string;
|
|
40
|
+
selectedContentIndex: number;
|
|
41
|
+
selectedExampleIndex: number;
|
|
42
|
+
onExampleChange?: ({
|
|
43
|
+
contentTypeIndex,
|
|
44
|
+
exampleIndex,
|
|
45
|
+
}: {
|
|
46
|
+
contentTypeIndex: number;
|
|
47
|
+
exampleIndex: number;
|
|
48
|
+
}) => void;
|
|
49
|
+
isOnScreen: boolean;
|
|
50
|
+
shouldLazyHighlight?: boolean;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const SidecarExamples = ({
|
|
54
|
+
content,
|
|
55
|
+
description,
|
|
56
|
+
onExampleChange,
|
|
57
|
+
selectedContentIndex,
|
|
58
|
+
selectedExampleIndex,
|
|
59
|
+
isOnScreen,
|
|
60
|
+
shouldLazyHighlight,
|
|
61
|
+
}: SidecarExamplesProps) => {
|
|
62
|
+
// Get example value, with fallback to schema-generated example
|
|
63
|
+
const selectedContent = content[selectedContentIndex];
|
|
64
|
+
const examples = selectedContent?.examples ?? [];
|
|
65
|
+
const selectedExample = examples?.[selectedExampleIndex];
|
|
66
|
+
|
|
67
|
+
const formattedExample = formatForDisplay(selectedExample?.value);
|
|
68
|
+
const language = getLanguage(selectedContent?.mediaType);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<>
|
|
72
|
+
<SidecarBox.Body className="p-0">
|
|
73
|
+
{selectedExample?.externalValue ? (
|
|
74
|
+
<div className="p-4">
|
|
75
|
+
<a
|
|
76
|
+
href={selectedExample.externalValue}
|
|
77
|
+
target="_blank"
|
|
78
|
+
rel="noopener noreferrer"
|
|
79
|
+
className="text-xs text-primary hover:underline"
|
|
80
|
+
>
|
|
81
|
+
View External Example
|
|
82
|
+
<ExternalLinkIcon className="size-3 inline-block ms-1 align-[-0.125em]" />
|
|
83
|
+
</a>
|
|
84
|
+
</div>
|
|
85
|
+
) : shouldLazyHighlight && !isOnScreen && formattedExample ? (
|
|
86
|
+
<NonHighlightedCode code={formattedExample} />
|
|
87
|
+
) : formattedExample ? (
|
|
88
|
+
<SyntaxHighlight
|
|
89
|
+
embedded
|
|
90
|
+
language={language}
|
|
91
|
+
className="[--scrollbar-color:gray] rounded-none max-h-[200px] text-xs overflow-auto"
|
|
92
|
+
code={formattedExample}
|
|
93
|
+
/>
|
|
94
|
+
) : (
|
|
95
|
+
<div className="grid place-items-center text-xs text-muted-foreground min-h-18">
|
|
96
|
+
No example specified for this content type
|
|
97
|
+
</div>
|
|
98
|
+
)}
|
|
99
|
+
{selectedExample?.description && (
|
|
100
|
+
<div className="border-t text-xs px-3 py-1.5 text-muted-foreground">
|
|
101
|
+
{selectedExample.description}
|
|
102
|
+
</div>
|
|
103
|
+
)}
|
|
104
|
+
</SidecarBox.Body>
|
|
105
|
+
<SidecarBox.Footer className="text-xs">
|
|
106
|
+
{description && (
|
|
107
|
+
<div className="text-muted-foreground text-xs px-1 py-2">
|
|
108
|
+
{description}
|
|
109
|
+
</div>
|
|
110
|
+
)}
|
|
111
|
+
{(examples.length !== 0 || content.length !== 0) && (
|
|
112
|
+
<div className="flex items-center gap-2 justify-between min-w-0">
|
|
113
|
+
<div className="flex items-center gap-2 flex-wrap">
|
|
114
|
+
{content.length > 1 ? (
|
|
115
|
+
<NativeSelect
|
|
116
|
+
className="text-xs h-fit py-1 truncate bg-background"
|
|
117
|
+
value={selectedContentIndex.toString()}
|
|
118
|
+
onChange={(e) =>
|
|
119
|
+
onExampleChange?.({
|
|
120
|
+
contentTypeIndex: Number(e.target.value),
|
|
121
|
+
exampleIndex: 0,
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
>
|
|
125
|
+
{content.map((c, index) => (
|
|
126
|
+
<NativeSelectOption
|
|
127
|
+
key={c.mediaType}
|
|
128
|
+
value={index.toString()}
|
|
129
|
+
>
|
|
130
|
+
{c.mediaType}
|
|
131
|
+
</NativeSelectOption>
|
|
132
|
+
))}
|
|
133
|
+
</NativeSelect>
|
|
134
|
+
) : (
|
|
135
|
+
<Badge
|
|
136
|
+
className="text-[11px] font-mono font-normal"
|
|
137
|
+
variant="outline"
|
|
138
|
+
>
|
|
139
|
+
{content[0]?.mediaType}
|
|
140
|
+
</Badge>
|
|
141
|
+
)}
|
|
142
|
+
</div>
|
|
143
|
+
{examples.length > 1 && (
|
|
144
|
+
<NativeSelect
|
|
145
|
+
className="text-xs h-fit py-1 truncate bg-background"
|
|
146
|
+
value={selectedExampleIndex.toString()}
|
|
147
|
+
onChange={(e) =>
|
|
148
|
+
onExampleChange?.({
|
|
149
|
+
contentTypeIndex: selectedContentIndex,
|
|
150
|
+
exampleIndex: Number(e.target.value),
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
>
|
|
154
|
+
{examples.map((example, index) => (
|
|
155
|
+
<NativeSelectOption
|
|
156
|
+
key={
|
|
157
|
+
example.summary ||
|
|
158
|
+
example.name ||
|
|
159
|
+
example.description ||
|
|
160
|
+
`Example ${index + 1}`
|
|
161
|
+
}
|
|
162
|
+
value={index.toString()}
|
|
163
|
+
>
|
|
164
|
+
{example.summary ||
|
|
165
|
+
example.name ||
|
|
166
|
+
example.description ||
|
|
167
|
+
`Example ${index + 1}`}
|
|
168
|
+
</NativeSelectOption>
|
|
169
|
+
))}
|
|
170
|
+
</NativeSelect>
|
|
171
|
+
)}
|
|
172
|
+
</div>
|
|
173
|
+
)}
|
|
174
|
+
</SidecarBox.Footer>
|
|
175
|
+
</>
|
|
176
|
+
);
|
|
177
|
+
};
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { cn } from "../../../util/cn.js";
|
|
5
|
-
import { SelectOnClick } from "./SelectOnClick.js";
|
|
6
|
-
|
|
7
|
-
export const EnumValues = ({
|
|
8
|
-
values,
|
|
9
|
-
className,
|
|
10
|
-
maxVisibleValues = 8,
|
|
11
|
-
}: {
|
|
12
|
-
values: Array<string | number>;
|
|
13
|
-
className?: string;
|
|
14
|
-
maxVisibleValues?: number;
|
|
15
|
-
}) => {
|
|
16
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
17
|
-
|
|
18
|
-
if (!values.length) return null;
|
|
19
|
-
|
|
20
|
-
const shouldCollapse = values.length > maxVisibleValues;
|
|
21
|
-
const visibleValues =
|
|
22
|
-
shouldCollapse && !isOpen ? values.slice(0, maxVisibleValues) : values;
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<div className={cn("flex flex-wrap gap-1.5", className)}>
|
|
26
|
-
<span className="text-muted-foreground">Enum values:</span>
|
|
27
|
-
{visibleValues.map((value) => (
|
|
28
|
-
<div key={value}>
|
|
29
|
-
<SelectOnClick className="border rounded-sm px-1 font-mono">
|
|
30
|
-
{value}
|
|
31
|
-
</SelectOnClick>
|
|
32
|
-
</div>
|
|
33
|
-
))}
|
|
34
|
-
{shouldCollapse && (
|
|
35
|
-
<Button
|
|
36
|
-
variant="ghost"
|
|
37
|
-
size="sm"
|
|
38
|
-
className="h-fit px-0"
|
|
39
|
-
onClick={() => setIsOpen(!isOpen)}
|
|
40
|
-
>
|
|
41
|
-
{isOpen ? (
|
|
42
|
-
<div className="flex items-center gap-1">
|
|
43
|
-
<ChevronUpIcon size={12} />
|
|
44
|
-
<span className="text-muted-foreground">show less</span>
|
|
45
|
-
</div>
|
|
46
|
-
) : (
|
|
47
|
-
<div className="flex items-center gap-1">
|
|
48
|
-
<ChevronDownIcon size={12} />
|
|
49
|
-
<span className="text-muted-foreground">
|
|
50
|
-
show {values.length - maxVisibleValues} more
|
|
51
|
-
</span>
|
|
52
|
-
</div>
|
|
53
|
-
)}
|
|
54
|
-
</Button>
|
|
55
|
-
)}
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
1
|
+
import { Button } from "@lukoweb/apitogo/ui/Button.js";
|
|
2
|
+
import { ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { cn } from "../../../util/cn.js";
|
|
5
|
+
import { SelectOnClick } from "./SelectOnClick.js";
|
|
6
|
+
|
|
7
|
+
export const EnumValues = ({
|
|
8
|
+
values,
|
|
9
|
+
className,
|
|
10
|
+
maxVisibleValues = 8,
|
|
11
|
+
}: {
|
|
12
|
+
values: Array<string | number>;
|
|
13
|
+
className?: string;
|
|
14
|
+
maxVisibleValues?: number;
|
|
15
|
+
}) => {
|
|
16
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
17
|
+
|
|
18
|
+
if (!values.length) return null;
|
|
19
|
+
|
|
20
|
+
const shouldCollapse = values.length > maxVisibleValues;
|
|
21
|
+
const visibleValues =
|
|
22
|
+
shouldCollapse && !isOpen ? values.slice(0, maxVisibleValues) : values;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className={cn("flex flex-wrap gap-1.5", className)}>
|
|
26
|
+
<span className="text-muted-foreground">Enum values:</span>
|
|
27
|
+
{visibleValues.map((value) => (
|
|
28
|
+
<div key={value}>
|
|
29
|
+
<SelectOnClick className="border rounded-sm px-1 font-mono">
|
|
30
|
+
{value}
|
|
31
|
+
</SelectOnClick>
|
|
32
|
+
</div>
|
|
33
|
+
))}
|
|
34
|
+
{shouldCollapse && (
|
|
35
|
+
<Button
|
|
36
|
+
variant="ghost"
|
|
37
|
+
size="sm"
|
|
38
|
+
className="h-fit px-0"
|
|
39
|
+
onClick={() => setIsOpen(!isOpen)}
|
|
40
|
+
>
|
|
41
|
+
{isOpen ? (
|
|
42
|
+
<div className="flex items-center gap-1">
|
|
43
|
+
<ChevronUpIcon size={12} />
|
|
44
|
+
<span className="text-muted-foreground">show less</span>
|
|
45
|
+
</div>
|
|
46
|
+
) : (
|
|
47
|
+
<div className="flex items-center gap-1">
|
|
48
|
+
<ChevronDownIcon size={12} />
|
|
49
|
+
<span className="text-muted-foreground">
|
|
50
|
+
show {values.length - maxVisibleValues} more
|
|
51
|
+
</span>
|
|
52
|
+
</div>
|
|
53
|
+
)}
|
|
54
|
+
</Button>
|
|
55
|
+
)}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
};
|