zudoku 0.0.0-fdfe742 → 0.0.0-feat-bundled-types.1c7f1db

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 (119) hide show
  1. package/dist/lib/components/Bootstrap.d.ts +2 -2
  2. package/dist/lib/components/Bootstrap.js +2 -0
  3. package/dist/lib/components/Bootstrap.js.map +1 -1
  4. package/dist/lib/components/index.d.ts +1 -1
  5. package/dist/lib/plugins/openapi/playground/BodyPanel.d.ts +5 -0
  6. package/dist/lib/plugins/openapi/playground/BodyPanel.js +22 -0
  7. package/dist/lib/plugins/openapi/playground/BodyPanel.js.map +1 -0
  8. package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js +2 -1
  9. package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js.map +1 -1
  10. package/dist/lib/plugins/openapi/playground/Headers.js +25 -25
  11. package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
  12. package/dist/lib/plugins/openapi/playground/IdentitySelector.js +1 -1
  13. package/dist/lib/plugins/openapi/playground/IdentitySelector.js.map +1 -1
  14. package/dist/lib/plugins/openapi/playground/ParamsGrid.js +2 -2
  15. package/dist/lib/plugins/openapi/playground/ParamsGrid.js.map +1 -1
  16. package/dist/lib/plugins/openapi/playground/PathParams.js +1 -1
  17. package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
  18. package/dist/lib/plugins/openapi/playground/Playground.d.ts +3 -8
  19. package/dist/lib/plugins/openapi/playground/Playground.js +70 -65
  20. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  21. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +1 -1
  22. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
  23. package/dist/lib/plugins/openapi/playground/QueryParams.js +1 -1
  24. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
  25. package/dist/lib/plugins/openapi/playground/fileUtils.d.ts +2 -0
  26. package/dist/lib/plugins/openapi/playground/fileUtils.js +22 -0
  27. package/dist/lib/plugins/openapi/playground/fileUtils.js.map +1 -0
  28. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.d.ts +4 -1
  29. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +29 -20
  30. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js.map +1 -1
  31. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js +2 -2
  32. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js.map +1 -1
  33. package/dist/lib/plugins/openapi/playground/useRememberSkipLoginDialog.d.ts +16 -0
  34. package/dist/lib/plugins/openapi/playground/useRememberSkipLoginDialog.js +10 -0
  35. package/dist/lib/plugins/openapi/playground/useRememberSkipLoginDialog.js.map +1 -0
  36. package/dist/lib/ui/CodeBlock.js +1 -1
  37. package/dist/lib/ui/CodeBlock.js.map +1 -1
  38. package/dist/lib/ui/Dialog.d.ts +3 -1
  39. package/dist/lib/ui/Dialog.js +2 -2
  40. package/dist/lib/ui/Dialog.js.map +1 -1
  41. package/dist/lib/util/humanFileSize.d.ts +6 -0
  42. package/dist/lib/util/humanFileSize.js +14 -0
  43. package/dist/lib/util/humanFileSize.js.map +1 -0
  44. package/dist/lib/util/humanFileSize.test.d.ts +1 -0
  45. package/dist/lib/util/humanFileSize.test.js +22 -0
  46. package/dist/lib/util/humanFileSize.test.js.map +1 -0
  47. package/lib/{Callout-CvY02DXU.js → Callout-CoVxYafP.js} +2 -2
  48. package/lib/{Callout-CvY02DXU.js.map → Callout-CoVxYafP.js.map} +1 -1
  49. package/lib/{Dialog-B53OMCvW.js → Dialog-BxpuVLh9.js} +25 -25
  50. package/lib/Dialog-BxpuVLh9.js.map +1 -0
  51. package/lib/{Markdown-m03c-TR_.js → Markdown-Cm4kj26S.js} +3 -2
  52. package/lib/{Markdown-m03c-TR_.js.map → Markdown-Cm4kj26S.js.map} +1 -1
  53. package/lib/{MdxPage-Dy5JAci3.js → MdxPage-fDGQtB5w.js} +3 -3
  54. package/lib/{MdxPage-Dy5JAci3.js.map → MdxPage-fDGQtB5w.js.map} +1 -1
  55. package/lib/{OasProvider-DfTncecV.js → OasProvider-CFBvfR3r.js} +2 -2
  56. package/lib/{OasProvider-DfTncecV.js.map → OasProvider-CFBvfR3r.js.map} +1 -1
  57. package/lib/{OperationList-DTQVxVx5.js → OperationList-Xs4KWmsh.js} +4 -4
  58. package/lib/{OperationList-DTQVxVx5.js.map → OperationList-Xs4KWmsh.js.map} +1 -1
  59. package/lib/{RouteGuard-DiCUImwp.js → RouteGuard-CZ_uLv3g.js} +2 -2
  60. package/lib/{RouteGuard-DiCUImwp.js.map → RouteGuard-CZ_uLv3g.js.map} +1 -1
  61. package/lib/{SchemaList-BoRsh_HT.js → SchemaList-BWaNlmUJ.js} +5 -5
  62. package/lib/{SchemaList-BoRsh_HT.js.map → SchemaList-BWaNlmUJ.js.map} +1 -1
  63. package/lib/{SchemaView-BpEFXAa1.js → SchemaView-DdKJt2ln.js} +3 -3
  64. package/lib/{SchemaView-BpEFXAa1.js.map → SchemaView-DdKJt2ln.js.map} +1 -1
  65. package/lib/{Slot-xguyqKKU.js → Slot-B99cbD-q.js} +2 -2
  66. package/lib/{Slot-xguyqKKU.js.map → Slot-B99cbD-q.js.map} +1 -1
  67. package/lib/{Toc-CYYLzWX_.js → Toc-Qe7A4uj_.js} +2 -2
  68. package/lib/{Toc-CYYLzWX_.js.map → Toc-Qe7A4uj_.js.map} +1 -1
  69. package/lib/{circular-CCqt6vxH.js → circular-w5eL5J8a.js} +1812 -1807
  70. package/lib/circular-w5eL5J8a.js.map +1 -0
  71. package/lib/{createServer-Fm59dJVp.js → createServer-p3yUA8Bu.js} +3648 -3493
  72. package/lib/createServer-p3yUA8Bu.js.map +1 -0
  73. package/lib/{index-DCHP-Cbn.js → index-yqBxBqxF.js} +1053 -1095
  74. package/lib/index-yqBxBqxF.js.map +1 -0
  75. package/lib/react-nprogress.esm-C2MPXjiJ.js +389 -0
  76. package/lib/react-nprogress.esm-C2MPXjiJ.js.map +1 -0
  77. package/lib/ui/CodeBlock.js +17 -16
  78. package/lib/ui/CodeBlock.js.map +1 -1
  79. package/lib/ui/Command.js +1 -1
  80. package/lib/ui/Dialog.js +25 -25
  81. package/lib/ui/Dialog.js.map +1 -1
  82. package/lib/zudoku.components.js +1697 -2081
  83. package/lib/zudoku.components.js.map +1 -1
  84. package/lib/zudoku.plugin-api-catalog.js +1 -1
  85. package/lib/zudoku.plugin-api-keys.js +2 -2
  86. package/lib/zudoku.plugin-custom-pages.js +1 -1
  87. package/lib/zudoku.plugin-markdown.js +1 -1
  88. package/lib/zudoku.plugin-openapi.js +1 -1
  89. package/lib/zudoku.plugin-search-pagefind.js +3 -3
  90. package/package.json +8 -7
  91. package/src/lib/components/Bootstrap.tsx +4 -2
  92. package/src/lib/plugins/openapi/playground/BodyPanel.tsx +46 -0
  93. package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +4 -1
  94. package/src/lib/plugins/openapi/playground/Headers.tsx +110 -106
  95. package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +13 -11
  96. package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +2 -2
  97. package/src/lib/plugins/openapi/playground/PathParams.tsx +1 -1
  98. package/src/lib/plugins/openapi/playground/Playground.tsx +127 -211
  99. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +2 -1
  100. package/src/lib/plugins/openapi/playground/QueryParams.tsx +1 -1
  101. package/src/lib/plugins/openapi/playground/fileUtils.ts +32 -0
  102. package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +74 -39
  103. package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +4 -1
  104. package/src/lib/plugins/openapi/playground/useRememberSkipLoginDialog.tsx +20 -0
  105. package/src/lib/ui/CodeBlock.tsx +1 -0
  106. package/src/lib/ui/Dialog.tsx +11 -7
  107. package/src/lib/util/humanFileSize.test.ts +24 -0
  108. package/src/lib/util/humanFileSize.ts +16 -0
  109. package/dist/lib/plugins/openapi/playground/SubmitButton.d.ts +0 -7
  110. package/dist/lib/plugins/openapi/playground/SubmitButton.js +0 -19
  111. package/dist/lib/plugins/openapi/playground/SubmitButton.js.map +0 -1
  112. package/dist/ts.d.ts +0 -6
  113. package/dist/ts.js +0 -61
  114. package/dist/ts.js.map +0 -1
  115. package/lib/Dialog-B53OMCvW.js.map +0 -1
  116. package/lib/circular-CCqt6vxH.js.map +0 -1
  117. package/lib/createServer-Fm59dJVp.js.map +0 -1
  118. package/lib/index-DCHP-Cbn.js.map +0 -1
  119. package/src/lib/plugins/openapi/playground/SubmitButton.tsx +0 -70
@@ -4,7 +4,7 @@ import { d as b, m as j } from "./chunk-DQRVZFIR-BblmKnHy.js";
4
4
  import { u as x, d as y, j as m } from "./hook-k7PfUIsj.js";
5
5
  import { H as v } from "./index.esm-BFcSKCe-.js";
6
6
  import { Link as N } from "./zudoku.components.js";
7
- import { H as S, M as w } from "./Markdown-m03c-TR_.js";
7
+ import { H as S, M as w } from "./Markdown-Cm4kj26S.js";
8
8
  const H = ({
9
9
  items: r,
10
10
  filterCatalogItems: o = (n) => n,
@@ -1,6 +1,6 @@
1
1
  import { j as e } from "./jsx-runtime-C5mzlN2N.js";
2
2
  import { CheckIcon as _, XIcon as se, PencilLineIcon as ne, RotateCwIcon as ie, EyeOffIcon as re, EyeIcon as ae, CopyIcon as oe, TrashIcon as le, KeyRoundIcon as de } from "lucide-react";
3
- import { D as ce, S as F, R as ue } from "./Slot-xguyqKKU.js";
3
+ import { D as ce, S as F, R as ue } from "./Slot-B99cbD-q.js";
4
4
  import { i as P } from "./invariant-DAFpPywt.js";
5
5
  import { O as he, L as Q } from "./chunk-DQRVZFIR-BblmKnHy.js";
6
6
  import { i as fe, k as pe, e as xe, d as me } from "./hook-k7PfUIsj.js";
@@ -9,7 +9,7 @@ import { u as z } from "./useMutation-CZSmsIGW.js";
9
9
  import * as S from "react";
10
10
  import ye, { createContext as q, useRef as D, useLayoutEffect as ge, useEffect as B, useId as L, useContext as O, useInsertionEffect as je, useMemo as M, useCallback as Ce, Children as ve, isValidElement as we, useState as E } from "react";
11
11
  import { C as ke, a as be } from "./Card-DPhGbYUM.js";
12
- import { D as U, e as W, a as X, b as Y, c as G, d as J, f as V, g as K } from "./Dialog-B53OMCvW.js";
12
+ import { D as U, e as W, a as X, b as Y, c as G, d as J, f as V, g as K } from "./Dialog-BxpuVLh9.js";
13
13
  import { Input as Ee } from "./ui/Input.js";
14
14
  import { c as R } from "./cn-wvCW-ho6.js";
15
15
  const De = () => {
@@ -1,6 +1,6 @@
1
1
  import { j as o } from "./jsx-runtime-C5mzlN2N.js";
2
2
  import a from "react";
3
- import { P as n } from "./Markdown-m03c-TR_.js";
3
+ import { P as n } from "./Markdown-Cm4kj26S.js";
4
4
  import { c } from "./cn-wvCW-ho6.js";
5
5
  import { u as p } from "./useExposedProps-BZQkZneR.js";
6
6
  const u = ({
@@ -50,7 +50,7 @@ const m = (a) => ({
50
50
  const c = {
51
51
  path: e,
52
52
  lazy: async () => {
53
- const { MdxPage: u } = await import("./MdxPage-Dy5JAci3.js"), { default: h, ...p } = await i();
53
+ const { MdxPage: u } = await import("./MdxPage-fDGQtB5w.js"), { default: h, ...p } = await i();
54
54
  return {
55
55
  element: /* @__PURE__ */ f.jsx(
56
56
  u,
@@ -3,7 +3,7 @@ import "lucide-react";
3
3
  import "./chunk-DQRVZFIR-BblmKnHy.js";
4
4
  import "./hook-k7PfUIsj.js";
5
5
  import "./ui/Button.js";
6
- import { F as a, U as s, H as n } from "./index-DCHP-Cbn.js";
6
+ import { F as a, U as s, H as n } from "./index-yqBxBqxF.js";
7
7
  export {
8
8
  a as GetSidebarOperationsQuery,
9
9
  s as UNTAGGED_PATH,
@@ -4,9 +4,9 @@ import { VisuallyHidden as v } from "@radix-ui/react-visually-hidden";
4
4
  import { u as N, k as y, l as j, o as _, j as L } from "./hook-k7PfUIsj.js";
5
5
  import { useRef as S, useLayoutEffect as T, useState as w } from "react";
6
6
  import { B as E } from "./Button-BE9IVkWV.js";
7
- import { C as R, a as f, b as p, c as F, d as I, e as q, f as P } from "./Callout-CvY02DXU.js";
8
- import { c as $ } from "./Dialog-B53OMCvW.js";
9
- import { S as A } from "./RouteGuard-DiCUImwp.js";
7
+ import { C as R, a as f, b as p, c as F, d as I, e as q, f as P } from "./Callout-CoVxYafP.js";
8
+ import { c as $ } from "./Dialog-BxpuVLh9.js";
9
+ import { S as A } from "./RouteGuard-CZ_uLv3g.js";
10
10
  import { BracketsIcon as D, FileTextIcon as O } from "lucide-react";
11
11
  import { a as B, L as g } from "./chunk-DQRVZFIR-BblmKnHy.js";
12
12
  const U = async ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudoku",
3
- "version": "0.0.0-fdfe742",
3
+ "version": "0.0.0-feat-bundled-types.1c7f1db",
4
4
  "type": "module",
5
5
  "homepage": "https://zudoku.dev",
6
6
  "repository": {
@@ -162,7 +162,7 @@
162
162
  "@sentry/node": "9.12.0",
163
163
  "@shikijs/langs": "3.4.2",
164
164
  "@shikijs/rehype": "3.4.2",
165
- "@shikijs/themes": "3.2.2",
165
+ "@shikijs/themes": "3.4.2",
166
166
  "@shikijs/transformers": "3.4.2",
167
167
  "@sindresorhus/slugify": "2.2.1",
168
168
  "@stefanprobst/rehype-extract-toc": "3.0.0",
@@ -188,7 +188,7 @@
188
188
  "fast-equals": "5.2.2",
189
189
  "framer-motion": "^12.12.2",
190
190
  "glob": "11.0.1",
191
- "graphql": "16.10.0",
191
+ "graphql": "16.11.0",
192
192
  "graphql-type-json": "0.3.2",
193
193
  "graphql-yoga": "5.13.3",
194
194
  "gray-matter": "4.0.3",
@@ -225,7 +225,7 @@
225
225
  "remark-mdx-frontmatter": "5.1.0",
226
226
  "remark-parse": "^11.0.0",
227
227
  "remark-rehype": "^11.1.2",
228
- "rollup": "4.40.1",
228
+ "rollup": "4.41.1",
229
229
  "semver": "7.7.1",
230
230
  "shiki": "3.4.2",
231
231
  "sitemap": "8.0.0",
@@ -236,7 +236,6 @@
236
236
  "ulidx": "2.4.1",
237
237
  "unified": "^11.0.5",
238
238
  "unist-util-visit": "5.0.0",
239
- "urql": "4.2.1",
240
239
  "vaul": "1.1.2",
241
240
  "vfile": "6.0.3",
242
241
  "vite": "6.3.5",
@@ -247,8 +246,9 @@
247
246
  "zustand": "5.0.3"
248
247
  },
249
248
  "devDependencies": {
250
- "@graphql-codegen/cli": "5.0.5",
249
+ "@graphql-codegen/cli": "5.0.6",
251
250
  "@graphql-codegen/client-preset": "4.8.0",
251
+ "@microsoft/api-extractor": "7.52.8",
252
252
  "@testing-library/dom": "10.4.0",
253
253
  "@testing-library/jest-dom": "6.6.3",
254
254
  "@testing-library/react": "16.3.0",
@@ -293,7 +293,8 @@
293
293
  "build:standalone:html": "cp ./src/app/standalone.html ./standalone/standalone.html && cp ./src/app/demo.html ./standalone/demo.html && cp ./src/app/demo-cdn.html ./standalone/index.html && cp standalone/zudoku.css standalone/style.css",
294
294
  "clean": "tsc --build --clean",
295
295
  "codegen": "graphql-codegen --config ./src/codegen.ts",
296
- "test": "vitest run"
296
+ "test": "vitest run",
297
+ "extract-api": "node scripts/extract-api.js"
297
298
  },
298
299
  "module": "./dist/index.js",
299
300
  "types": "./dist/index.d.ts"
@@ -3,7 +3,9 @@ import {
3
3
  QueryClient,
4
4
  QueryClientProvider,
5
5
  } from "@tanstack/react-query";
6
- import { type HelmetData, HelmetProvider } from "@zudoku/react-helmet-async";
6
+ // `HelmetData` can't be a type import because otherwise API Extractor will fail
7
+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
8
+ import { HelmetData, HelmetProvider } from "@zudoku/react-helmet-async";
7
9
  import { StrictMode } from "react";
8
10
  import {
9
11
  type createBrowserRouter,
@@ -52,7 +54,7 @@ const BootstrapStatic = ({
52
54
  helmetContext,
53
55
  bypassProtection = false,
54
56
  }: {
55
- helmetContext: HelmetData["context"];
57
+ helmetContext: (typeof HelmetData)["context"];
56
58
  context: StaticHandlerContext;
57
59
  queryClient: QueryClient;
58
60
  router: ReturnType<typeof createStaticRouter>;
@@ -0,0 +1,46 @@
1
+ import { useFormContext } from "react-hook-form";
2
+ import { Textarea } from "zudoku/ui/Textarea.js";
3
+ import { cn } from "../../../util/cn.js";
4
+ import { type Content } from "../SidecarExamples.js";
5
+ import ExamplesDropdown from "./ExamplesDropdown.js";
6
+ import { type PlaygroundForm } from "./Playground.js";
7
+
8
+ export const BodyPanel = ({ examples }: { examples?: Content }) => {
9
+ const { register, setValue, watch } = useFormContext<PlaygroundForm>();
10
+
11
+ const headers = watch("headers");
12
+
13
+ return (
14
+ <div className="flex flex-col gap-2 ">
15
+ <div className="flex justify-between gap-2">
16
+ <span className="font-semibold">Body</span>
17
+ <div className="flex flex-col gap-2">
18
+ {examples && examples.length > 0 && (
19
+ <ExamplesDropdown
20
+ examples={examples}
21
+ onSelect={(example, mediaType) => {
22
+ setValue("body", JSON.stringify(example.value, null, 2));
23
+ setValue("headers", [
24
+ ...headers.filter((h) => h.name !== "Content-Type"),
25
+ {
26
+ name: "Content-Type",
27
+ value: mediaType,
28
+ active: true,
29
+ },
30
+ ]);
31
+ }}
32
+ />
33
+ )}
34
+ </div>
35
+ </div>
36
+ <Textarea
37
+ {...register("body")}
38
+ className={cn(
39
+ "border w-full rounded-lg bg-muted/40 p-2 h-64 font-mono text-[13px]",
40
+ )}
41
+ />
42
+ </div>
43
+ );
44
+ };
45
+
46
+ export default BodyPanel;
@@ -1,3 +1,4 @@
1
+ import { ChevronDownIcon } from "lucide-react";
1
2
  import { Button } from "zudoku/ui/Button.js";
2
3
  import {
3
4
  DropdownMenu,
@@ -20,7 +21,9 @@ const ExamplesDropdown = ({
20
21
  return (
21
22
  <DropdownMenu>
22
23
  <DropdownMenuTrigger asChild>
23
- <Button variant="outline">Use Example</Button>
24
+ <Button variant="ghost" size="sm">
25
+ Use Example <ChevronDownIcon className="w-4 h-4" />
26
+ </Button>
24
27
  </DropdownMenuTrigger>
25
28
  <DropdownMenuContent className="max-w-72">
26
29
  {examples.map((mediaTypeObject) => (
@@ -83,119 +83,123 @@ export const Headers = ({
83
83
  .map(({ name }) => name);
84
84
 
85
85
  return (
86
- <div className="flex flex-col gap-2">
87
- <Card className="overflow-hidden">
88
- <ParamsGrid>
89
- {fields.map((field, i) => {
90
- const currentHeader = schemaHeaders.find(
91
- (h) => h.name === watch(`headers.${i}.name`),
92
- );
93
- return (
94
- <ParamsGridItem key={field.id}>
95
- <div className="flex items-center gap-2 ">
96
- <Controller
97
- control={control}
98
- name={`headers.${i}.active`}
99
- render={({ field }) => (
100
- <Checkbox
101
- id={`headers.${i}.active`}
102
- checked={field.value}
103
- onCheckedChange={(checked) => {
104
- field.onChange(checked);
105
- }}
106
- />
107
- )}
108
- />
109
- <Controller
110
- control={control}
111
- name={`headers.${i}.name`}
112
- render={({ field }) => (
113
- <Autocomplete
114
- {...field}
115
- placeholder="Name"
116
- className="border-0 shadow-none focus-visible:ring-0 bg-transparent hover:bg-transparent text-xs font-mono"
117
- options={[...missingHeaders, ...headerOptions]}
118
- onEnterPress={() => handleHeaderEnter(i)}
119
- onChange={(e) => {
120
- field.onChange(e);
121
- setValue(`headers.${i}.active`, true);
122
- }}
123
- ref={(el) => {
124
- nameRefs.current[i] = el;
125
- }}
126
- />
127
- )}
128
- />
129
- </div>
130
- <div className="flex items-center gap-2">
131
- <Controller
132
- control={control}
133
- name={`headers.${i}.value`}
134
- render={({ field }) => {
135
- const hasEnum =
136
- currentHeader?.enum && currentHeader.enum.length > 0;
137
-
138
- if (!hasEnum) {
139
- return (
140
- <Input
141
- placeholder="Value"
142
- className="w-full border-0 shadow-none text-xs font-mono focus-visible:ring-0"
143
- {...field}
144
- ref={(el) => {
145
- valueRefs.current[i] = el;
146
- }}
147
- onKeyDown={(e) => {
148
- if (
149
- e.key === "Enter" &&
150
- e.currentTarget.value.trim()
151
- ) {
152
- handleValueEnter(i);
153
- }
154
- }}
155
- autoComplete="off"
156
- />
157
- );
158
- }
159
-
160
- return (
161
- <Autocomplete
162
- shouldFilter={false}
163
- value={field.value}
164
- options={currentHeader.enum ?? []}
165
- onChange={(e) => {
166
- field.onChange(e);
167
- setValue(`headers.${i}.active`, true);
168
- }}
169
- className="border-0 shadow-none focus-visible:ring-0 bg-transparent hover:bg-transparent text-xs font-mono"
170
- />
171
- );
172
- }}
173
- />
174
- <Button
175
- size="icon"
176
- variant="ghost"
177
- className="text-muted-foreground opacity-0 group-hover:opacity-100 rounded-full w-8 h-7"
178
- onClick={() => remove(i)}
179
- type="button"
180
- >
181
- <XIcon size={16} />
182
- </Button>
183
- </div>
184
- </ParamsGridItem>
185
- );
186
- })}
187
- </ParamsGrid>
188
- </Card>
189
- <div className="text-end">
86
+ <div className="flex flex-col gap-2 ">
87
+ <div className="flex items-center justify-between">
88
+ <span className="font-semibold">Headers</span>
190
89
  <Button
191
90
  className=""
192
91
  onClick={addNewHeader}
193
92
  type="button"
194
- variant="secondary"
93
+ size="sm"
94
+ variant="ghost"
195
95
  >
196
- Add header
96
+ + Add header
197
97
  </Button>
198
98
  </div>
99
+ <div className="flex flex-col gap-2">
100
+ <Card className="overflow-hidden rounded-lg">
101
+ <ParamsGrid>
102
+ {fields.map((field, i) => {
103
+ const currentHeader = schemaHeaders.find(
104
+ (h) => h.name === watch(`headers.${i}.name`),
105
+ );
106
+ return (
107
+ <ParamsGridItem key={field.id}>
108
+ <div className="flex items-center gap-2 ">
109
+ <Controller
110
+ control={control}
111
+ name={`headers.${i}.active`}
112
+ render={({ field }) => (
113
+ <Checkbox
114
+ id={`headers.${i}.active`}
115
+ checked={field.value}
116
+ onCheckedChange={(checked) => {
117
+ field.onChange(checked);
118
+ }}
119
+ />
120
+ )}
121
+ />
122
+ <Controller
123
+ control={control}
124
+ name={`headers.${i}.name`}
125
+ render={({ field }) => (
126
+ <Autocomplete
127
+ {...field}
128
+ placeholder="Name"
129
+ className="border-0 shadow-none focus-visible:ring-0 bg-transparent hover:bg-transparent text-xs font-mono"
130
+ options={[...missingHeaders, ...headerOptions]}
131
+ onEnterPress={() => handleHeaderEnter(i)}
132
+ onChange={(e) => {
133
+ field.onChange(e);
134
+ setValue(`headers.${i}.active`, true);
135
+ }}
136
+ ref={(el) => {
137
+ nameRefs.current[i] = el;
138
+ }}
139
+ />
140
+ )}
141
+ />
142
+ </div>
143
+ <div className="flex items-center gap-2">
144
+ <Controller
145
+ control={control}
146
+ name={`headers.${i}.value`}
147
+ render={({ field }) => {
148
+ const hasEnum =
149
+ currentHeader?.enum && currentHeader.enum.length > 0;
150
+
151
+ if (!hasEnum) {
152
+ return (
153
+ <Input
154
+ placeholder="Value"
155
+ className="w-full border-0 shadow-none text-xs font-mono focus-visible:ring-0"
156
+ {...field}
157
+ ref={(el) => {
158
+ valueRefs.current[i] = el;
159
+ }}
160
+ onKeyDown={(e) => {
161
+ if (
162
+ e.key === "Enter" &&
163
+ e.currentTarget.value.trim()
164
+ ) {
165
+ handleValueEnter(i);
166
+ }
167
+ }}
168
+ autoComplete="off"
169
+ />
170
+ );
171
+ }
172
+
173
+ return (
174
+ <Autocomplete
175
+ shouldFilter={false}
176
+ value={field.value}
177
+ options={currentHeader.enum ?? []}
178
+ onChange={(e) => {
179
+ field.onChange(e);
180
+ setValue(`headers.${i}.active`, true);
181
+ }}
182
+ className="border-0 shadow-none focus-visible:ring-0 bg-transparent hover:bg-transparent text-xs font-mono"
183
+ />
184
+ );
185
+ }}
186
+ />
187
+ <Button
188
+ size="icon"
189
+ variant="ghost"
190
+ className="text-muted-foreground opacity-0 group-hover:opacity-100 rounded-full w-8 h-7"
191
+ onClick={() => remove(i)}
192
+ type="button"
193
+ >
194
+ <XIcon size={16} />
195
+ </Button>
196
+ </div>
197
+ </ParamsGridItem>
198
+ );
199
+ })}
200
+ </ParamsGrid>
201
+ </Card>
202
+ </div>
199
203
  </div>
200
204
  );
201
205
  };
@@ -13,7 +13,7 @@ const IdentitySelector = ({
13
13
  setValue: (value: string) => void;
14
14
  value?: string;
15
15
  }) => (
16
- <Card className="w-full overflow-hidden">
16
+ <Card className="w-full overflow-hidden rounded-lg">
17
17
  <RadioGroup
18
18
  onValueChange={(value) => setValue(value)}
19
19
  value={value}
@@ -21,19 +21,21 @@ const IdentitySelector = ({
21
21
  className="gap-0"
22
22
  disabled={identities?.length === 0}
23
23
  >
24
- <Label className="h-12 border-b items-center flex gap-2 p-4 cursor-pointer hover:bg-accent">
24
+ <Label className="h-10 border-b items-center flex gap-2 p-4 cursor-pointer hover:bg-accent">
25
25
  <RadioGroupItem value={NO_IDENTITY} id="none" />
26
26
  <span>None</span>
27
27
  </Label>
28
- {identities?.map((identity) => (
29
- <Label
30
- key={identity.id}
31
- className="h-12 border-b items-center flex gap-2 p-4 cursor-pointer hover:bg-accent"
32
- >
33
- <RadioGroupItem value={identity.id} id={identity.id} />
34
- <span>{identity.label}</span>
35
- </Label>
36
- ))}
28
+ <div className="divide-y">
29
+ {identities?.map((identity) => (
30
+ <Label
31
+ key={identity.id}
32
+ className="h-10 items-center flex gap-2 p-4 cursor-pointer hover:bg-accent"
33
+ >
34
+ <RadioGroupItem value={identity.id} id={identity.id} />
35
+ <span>{identity.label}</span>
36
+ </Label>
37
+ ))}
38
+ </div>
37
39
  </RadioGroup>
38
40
  </Card>
39
41
  );
@@ -2,12 +2,12 @@ import createVariantComponent from "../../../util/createVariantComponent.js";
2
2
 
3
3
  const ParamsGrid = createVariantComponent(
4
4
  "div",
5
- "grid grid-cols-[2fr_3fr] gap-2 items-center",
5
+ "grid grid-cols-[2fr_3fr] items-center",
6
6
  );
7
7
 
8
8
  export const ParamsGridItem = createVariantComponent(
9
9
  "div",
10
- "group hover:bg-accent px-3 grid col-span-full grid-cols-subgrid",
10
+ "group hover:bg-accent px-4 py-1 grid col-span-full grid-cols-subgrid",
11
11
  );
12
12
 
13
13
  export default ParamsGrid;
@@ -22,7 +22,7 @@ export const PathParams = ({
22
22
  );
23
23
 
24
24
  return (
25
- <Card className="rounded-lg">
25
+ <Card className="rounded-lg overflow-hidden">
26
26
  <ParamsGrid>
27
27
  {sortedFields.map((field, i) => (
28
28
  <ParamsGridItem key={field.id}>