@clarify-labs/renderer 0.11.1 → 0.11.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 (54) hide show
  1. package/output/{ClarifyShell-CwRtof1h.js → ClarifyShell-4hlqrEgp.js} +3 -3
  2. package/output/{ClarifyShell-CwRtof1h.js.map → ClarifyShell-4hlqrEgp.js.map} +1 -1
  3. package/output/{ClarifyShell-C2XnkFQ6.cjs → ClarifyShell-D25PYLE0.cjs} +3 -3
  4. package/output/{ClarifyShell-C2XnkFQ6.cjs.map → ClarifyShell-D25PYLE0.cjs.map} +1 -1
  5. package/output/{MermaidViewer-CwkiQ2gO.js → MermaidViewer-D4h-WEak.js} +2 -2
  6. package/output/{MermaidViewer-CwkiQ2gO.js.map → MermaidViewer-D4h-WEak.js.map} +1 -1
  7. package/output/{MermaidViewer-CTvMCE19.cjs → MermaidViewer-kbSVqJ_z.cjs} +2 -2
  8. package/output/{MermaidViewer-CTvMCE19.cjs.map → MermaidViewer-kbSVqJ_z.cjs.map} +1 -1
  9. package/output/{OpenApiOperation-CFo6_otd.js → OpenApiOperation-BcJYHwft.js} +201 -87
  10. package/output/OpenApiOperation-BcJYHwft.js.map +1 -0
  11. package/output/{OpenApiOperation-D1WNrj5X.cjs → OpenApiOperation-HhSjad7q.cjs} +201 -87
  12. package/output/OpenApiOperation-HhSjad7q.cjs.map +1 -0
  13. package/output/{PageActions-3eo05fb_.js → PageActions-Bnz5Bybt.js} +44 -27
  14. package/output/{PageActions-3eo05fb_.js.map → PageActions-Bnz5Bybt.js.map} +1 -1
  15. package/output/{PageActions-Lp_NeIKr.cjs → PageActions-GVAsO16x.cjs} +44 -27
  16. package/output/{PageActions-Lp_NeIKr.cjs.map → PageActions-GVAsO16x.cjs.map} +1 -1
  17. package/output/{SearchDialog-CM9DrE2Y.cjs → SearchDialog-CFMl0YAZ.cjs} +3 -3
  18. package/output/{SearchDialog-CM9DrE2Y.cjs.map → SearchDialog-CFMl0YAZ.cjs.map} +1 -1
  19. package/output/{SearchDialog-BvCBIFqs.js → SearchDialog-DL5Y_bQ0.js} +3 -3
  20. package/output/{SearchDialog-BvCBIFqs.js.map → SearchDialog-DL5Y_bQ0.js.map} +1 -1
  21. package/output/client.cjs +3 -3
  22. package/output/client.js +3 -3
  23. package/output/components/Tabs.d.ts +3 -0
  24. package/output/core/i18n.d.ts +1 -1
  25. package/output/{i18n-DsjZ51U1.cjs → i18n-R08i532P.cjs} +23 -1
  26. package/output/i18n-R08i532P.cjs.map +1 -0
  27. package/output/{i18n-BxXpRSFX.js → i18n-sJUQQLRZ.js} +23 -1
  28. package/output/i18n-sJUQQLRZ.js.map +1 -0
  29. package/output/index.cjs +5 -7
  30. package/output/index.cjs.map +1 -1
  31. package/output/index.d.ts +1 -2
  32. package/output/index.js +6 -7
  33. package/output/index.js.map +1 -1
  34. package/output/mdx/components.d.ts +2 -2
  35. package/output/mdx/primitives.d.ts +2 -0
  36. package/output/openapi/components/EndpointSections.d.ts +2 -0
  37. package/output/openapi/components/OpenApiAuthDocumentation.d.ts +7 -0
  38. package/output/openapi/components/OpenApiDocumentSection.d.ts +10 -0
  39. package/output/openapi/components/helpers.d.ts +1 -0
  40. package/output/openapi/types.d.ts +1 -0
  41. package/output/preview.cjs +3 -3
  42. package/output/preview.js +3 -3
  43. package/output/{render-CKG4X-me.cjs → render-BuWbLXJW.cjs} +2 -2
  44. package/output/{render-CKG4X-me.cjs.map → render-BuWbLXJW.cjs.map} +1 -1
  45. package/output/{render-vlp3hwW3.js → render-tWo_ruCT.js} +2 -2
  46. package/output/{render-vlp3hwW3.js.map → render-tWo_ruCT.js.map} +1 -1
  47. package/output/renderer.css +24 -13
  48. package/output/server.cjs +2 -2
  49. package/output/server.js +2 -2
  50. package/package.json +1 -1
  51. package/output/OpenApiOperation-CFo6_otd.js.map +0 -1
  52. package/output/OpenApiOperation-D1WNrj5X.cjs.map +0 -1
  53. package/output/i18n-BxXpRSFX.js.map +0 -1
  54. package/output/i18n-DsjZ51U1.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
- const require_i18n = require("./i18n-DsjZ51U1.cjs");
3
- const require_PageActions = require("./PageActions-Lp_NeIKr.cjs");
2
+ const require_i18n = require("./i18n-R08i532P.cjs");
3
+ const require_PageActions = require("./PageActions-GVAsO16x.cjs");
4
4
  const require_remark = require("./remark-DTLbG8PK.cjs");
5
5
  let clsx = require("clsx");
6
6
  clsx = require_rolldown_runtime.__toESM(clsx, 1);
@@ -245,7 +245,7 @@ function Card(arg0) {
245
245
  }
246
246
  //#endregion
247
247
  //#region source/components/Mermaid.tsx
248
- var MermaidViewer = (0, react.lazy)(() => Promise.resolve().then(() => require("./MermaidViewer-CTvMCE19.cjs")));
248
+ var MermaidViewer = (0, react.lazy)(() => Promise.resolve().then(() => require("./MermaidViewer-kbSVqJ_z.cjs")));
249
249
  var mermaidModulePromise;
250
250
  async function loadMermaid() {
251
251
  mermaidModulePromise = mermaidModulePromise ?? import("mermaid").then((module) => module.default);
@@ -1006,7 +1006,7 @@ function TabItem(_props) {
1006
1006
  return null;
1007
1007
  }
1008
1008
  function Tabs(arg0) {
1009
- const { items, children, defaultValue, selectedIndex, onChange, className, listClassName, panelsClassName } = arg0;
1009
+ const { items, children, defaultValue, selectedIndex, onChange, className, spacingClassName = "my-6", listClassName, panelsClassName, actions, variant = "content" } = arg0;
1010
1010
  const childItems = react.Children.toArray(children).filter((child) => (0, react.isValidElement)(child) && child.type === TabItem).map((child, index) => ({
1011
1011
  id: child.props.value ?? `tab-${index}`,
1012
1012
  label: child.props.title,
@@ -1023,23 +1023,26 @@ function Tabs(arg0) {
1023
1023
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.TabGroup, {
1024
1024
  selectedIndex: resolvedIndex,
1025
1025
  onChange: handleChange,
1026
- className: (0, clsx.default)("clarify-tabs my-6", className),
1027
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabList, {
1028
- className: (0, clsx.default)("flex max-w-full items-stretch gap-1 overflow-x-auto border-b border-(--clarify-theme-tokens-colors-border)", listClassName),
1029
- children: resolvedItems.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Tab, {
1030
- className: ({ selected }) => (0, clsx.default)("clarify-content-tab clarify-ui-tab relative my-1 inline-flex h-9 shrink-0 items-center rounded-(--clarify-theme-tokens-radius-md) px-2.5 transition focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-(--clarify-theme-tokens-colors-primary)", selected && "clarify-ui-tab-active"),
1026
+ className: (0, clsx.default)("clarify-tabs", spacingClassName, className),
1027
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.TabList, {
1028
+ className: (0, clsx.default)("flex max-w-full items-stretch overflow-x-auto border-b", variant === "content" ? "gap-1 border-(--clarify-theme-tokens-colors-border)" : "h-10 gap-0 border-(--clarify-code-border) px-3", listClassName),
1029
+ children: [resolvedItems.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Tab, {
1030
+ className: ({ selected }) => (0, clsx.default)("relative inline-flex shrink-0 items-center px-2.5 transition focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-(--clarify-theme-tokens-colors-primary)", variant === "content" ? "clarify-content-tab clarify-ui-tab my-1 h-9 rounded-(--clarify-theme-tokens-radius-md)" : "text-2xs font-semibold", selected && (variant === "content" ? "clarify-ui-tab-active" : "text-(--clarify-code-text)"), variant === "code" && !selected && "text-(--clarify-code-muted)"),
1031
1031
  children: ({ selected }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.label }), selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.span, {
1032
1032
  layoutId: indicatorLayoutId,
1033
- className: "absolute inset-x-2.5 -bottom-1 h-0.5 rounded-full bg-(--clarify-ui-tab-indicator)",
1033
+ className: (0, clsx.default)("absolute inset-x-2.5 h-0.5 bg-(--clarify-ui-tab-indicator)", variant === "content" ? "-bottom-1 rounded-full" : "-bottom-px"),
1034
1034
  transition: {
1035
1035
  type: "tween",
1036
1036
  duration: .16,
1037
1037
  ease: "easeOut"
1038
1038
  }
1039
1039
  }) : null] })
1040
- }, item.id))
1040
+ }, item.id)), actions ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1041
+ className: "sticky right-0 ml-auto flex shrink-0 items-center bg-(--clarify-code-background)",
1042
+ children: actions
1043
+ }) : null]
1041
1044
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabPanels, {
1042
- className: (0, clsx.default)("mt-5", panelsClassName),
1045
+ className: panelsClassName ?? "mt-5",
1043
1046
  children: resolvedItems.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabPanel, {
1044
1047
  className: "focus:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)",
1045
1048
  children: item.panel
@@ -1330,9 +1333,9 @@ function Col(arg0) {
1330
1333
  });
1331
1334
  }
1332
1335
  function Properties(arg0) {
1333
- const { children } = arg0;
1336
+ const { children, className, spacingClassName = "my-6" } = arg0;
1334
1337
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1335
- className: "clarify-properties my-6",
1338
+ className: (0, clsx.default)("clarify-properties", spacingClassName, className),
1336
1339
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1337
1340
  role: "list",
1338
1341
  className: "m-0 list-none divide-y divide-(--clarify-theme-tokens-colors-border) p-0",
@@ -2400,7 +2403,8 @@ function getAuthOptions(spec, operation) {
2400
2403
  return getSecurityRequirements(spec, operation).map((requirement, index) => {
2401
2404
  const requirementSchemes = Object.keys(requirement).map((name) => ({
2402
2405
  name,
2403
- scheme: schemes[name]
2406
+ scheme: schemes[name],
2407
+ scopes: requirement[name] ?? []
2404
2408
  })).filter((option) => Boolean(option.scheme));
2405
2409
  return {
2406
2410
  key: `requirement:${index}`,
@@ -2707,6 +2711,103 @@ function ResponseExamplesPanel(arg0) {
2707
2711
  });
2708
2712
  }
2709
2713
  //#endregion
2714
+ //#region source/openapi/components/OpenApiDocumentSection.tsx
2715
+ function OpenApiDocumentSection(props) {
2716
+ const { title, children, className, bodyClassName, level = 3 } = props;
2717
+ const heading = level === 3 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
2718
+ className: "!m-0 text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
2719
+ children: title
2720
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
2721
+ className: "!m-0 text-xs/5 font-semibold text-(--clarify-ui-text-soft)",
2722
+ children: title
2723
+ });
2724
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
2725
+ className: (0, clsx.default)("clarify-openapi-document-section", className),
2726
+ children: [heading, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2727
+ className: (0, clsx.default)("mt-2", bodyClassName),
2728
+ children
2729
+ })]
2730
+ });
2731
+ }
2732
+ //#endregion
2733
+ //#region source/openapi/components/OpenApiAuthDocumentation.tsx
2734
+ function authSchemeType(option, apiKeyLabel) {
2735
+ const { scheme } = option;
2736
+ if (scheme.type === "http") return scheme.scheme?.toUpperCase() || "HTTP";
2737
+ if (scheme.type === "apiKey") return apiKeyLabel;
2738
+ if (scheme.type === "oauth2") return "OAUTH 2.0";
2739
+ if (scheme.type === "openIdConnect") return "OPENID CONNECT";
2740
+ return scheme.type?.toUpperCase() || "AUTH";
2741
+ }
2742
+ function OpenApiAuthDocumentation(props) {
2743
+ const { options } = props;
2744
+ const t = require_i18n.useBuiltInText();
2745
+ if (options.length === 0) return null;
2746
+ const renderOption = (option) => option.schemes.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2747
+ className: "border-b border-(--clarify-theme-tokens-colors-border) pt-2 pb-4 text-sm/6 font-medium text-(--clarify-theme-tokens-colors-foreground)",
2748
+ children: t("openapi.authNoAuth")
2749
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2750
+ className: "divide-y divide-(--clarify-theme-tokens-colors-border) border-b border-(--clarify-theme-tokens-colors-border)",
2751
+ children: option.schemes.map((schemeOption, schemeIndex) => {
2752
+ const { scheme } = schemeOption;
2753
+ const details = [
2754
+ scheme.type === "apiKey" && scheme.in && scheme.name ? t("openapi.authLocation", {
2755
+ in: scheme.in,
2756
+ name: scheme.name
2757
+ }) : void 0,
2758
+ scheme.type === "http" && scheme.bearerFormat ? t("openapi.authBearerFormat", { format: scheme.bearerFormat }) : void 0,
2759
+ scheme.type === "openIdConnect" ? scheme.openIdConnectUrl : void 0,
2760
+ schemeOption.scopes.length > 0 ? t("openapi.authScopes", { scopes: schemeOption.scopes.join(", ") }) : void 0
2761
+ ].filter((value) => Boolean(value));
2762
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [schemeIndex > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2763
+ className: "relative h-0",
2764
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2765
+ className: "absolute top-0 left-4 -translate-y-1/2 bg-(--clarify-theme-tokens-colors-background) px-1.5 text-2xs font-semibold text-(--clarify-ui-text-faint)",
2766
+ children: t("openapi.authAnd")
2767
+ })
2768
+ }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2769
+ className: "py-4 first:pt-2",
2770
+ children: [
2771
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2772
+ className: "flex flex-wrap items-center gap-2",
2773
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2774
+ className: "font-mono text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
2775
+ children: schemeOption.name
2776
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2777
+ className: "rounded bg-(--clarify-ui-subtle-background) px-1.5 py-0.5 text-2xs font-semibold text-(--clarify-ui-text-soft)",
2778
+ children: authSchemeType(schemeOption, t("openapi.authApiKey"))
2779
+ })]
2780
+ }),
2781
+ scheme.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
2782
+ className: "mt-2 text-sm/6 text-(--clarify-ui-text-soft) *:first:mt-0 *:last:mb-0",
2783
+ children: scheme.description
2784
+ }) : null,
2785
+ details.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2786
+ className: "mt-2 flex min-w-0 flex-wrap gap-x-4 gap-y-1 text-xs/5 text-(--clarify-ui-text-faint)",
2787
+ children: details.map((detail) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2788
+ className: "min-w-0 break-all font-mono",
2789
+ children: detail
2790
+ }, detail))
2791
+ }) : null
2792
+ ]
2793
+ })] }, schemeOption.name);
2794
+ })
2795
+ });
2796
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiDocumentSection, {
2797
+ title: t("openapi.authentication"),
2798
+ bodyClassName: "not-prose",
2799
+ children: options.length === 1 ? renderOption(options[0]) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tabs, {
2800
+ items: options.map((option) => ({
2801
+ id: option.key,
2802
+ label: option.label || t("openapi.none"),
2803
+ panel: renderOption(option)
2804
+ })),
2805
+ spacingClassName: "m-0",
2806
+ panelsClassName: "mt-2"
2807
+ })
2808
+ });
2809
+ }
2810
+ //#endregion
2710
2811
  //#region source/openapi/components/SchemaProperties.tsx
2711
2812
  function getEnumDescriptions(schema) {
2712
2813
  const descriptions = schema["x-enumDescriptions"];
@@ -3003,23 +3104,32 @@ function SchemaProperties(arg0) {
3003
3104
  const { title, schema, spec, defaultExpanded } = arg0;
3004
3105
  const root = getRootSchemaNode(spec, schema, defaultExpanded);
3005
3106
  if (!root || root.children.length === 0) return null;
3006
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: title }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3007
- className: "clarify-schema-properties not-prose my-6",
3107
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiDocumentSection, {
3108
+ title,
3109
+ level: 4,
3110
+ bodyClassName: "clarify-schema-properties not-prose",
3008
3111
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaTree, { nodes: root.children })
3009
- })] });
3112
+ });
3010
3113
  }
3011
3114
  function ParameterList(arg0) {
3012
3115
  const t = require_i18n.useBuiltInText();
3013
3116
  const { title, parameters } = arg0;
3014
3117
  if (parameters.length === 0) return null;
3015
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: title }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Properties, { children: parameters.map((parameter) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Property, {
3016
- name: parameter.name ?? t("openapi.parameter"),
3017
- type: [schemaToType(parameter.schema), parameter.required ? t("openapi.requiredBadge") : void 0].filter(Boolean).join(", ") || void 0,
3018
- children: parameter.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
3019
- className: "*:first:mt-0 *:last:mb-0",
3020
- children: parameter.description
3021
- }) : t("openapi.operationParameter")
3022
- }, `${parameter.in}-${parameter.name}`)) })] });
3118
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiDocumentSection, {
3119
+ title,
3120
+ bodyClassName: "not-prose",
3121
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Properties, {
3122
+ spacingClassName: "m-0",
3123
+ children: parameters.map((parameter) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Property, {
3124
+ name: parameter.name ?? t("openapi.parameter"),
3125
+ type: [schemaToType(parameter.schema), parameter.required ? t("openapi.requiredBadge") : void 0].filter(Boolean).join(", ") || void 0,
3126
+ children: parameter.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
3127
+ className: "*:first:mt-0 *:last:mb-0",
3128
+ children: parameter.description
3129
+ }) : t("openapi.operationParameter")
3130
+ }, `${parameter.in}-${parameter.name}`))
3131
+ })
3132
+ });
3023
3133
  }
3024
3134
  function ResponseList(arg0) {
3025
3135
  const { title, operation, spec, selectedStatus, onSelectStatus } = arg0;
@@ -3059,7 +3169,7 @@ function ResponseList(arg0) {
3059
3169
  }) : `${t("openapi.response")}.`
3060
3170
  }),
3061
3171
  responseSchema && spec ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3062
- className: "mt-4",
3172
+ className: "mt-6",
3063
3173
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaProperties, {
3064
3174
  title: t("openapi.responseBodyProperties"),
3065
3175
  schema: responseSchema,
@@ -3071,32 +3181,39 @@ function ResponseList(arg0) {
3071
3181
  };
3072
3182
  if (orderedResponses.length === 1) {
3073
3183
  const [{ status, response }] = orderedResponses;
3074
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: title ?? t("openapi.responses") }), renderResponsePanel({
3075
- status,
3076
- response
3077
- })] });
3078
- }
3079
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: title ?? t("openapi.responses") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tabs, {
3080
- selectedIndex,
3081
- onChange: (index) => {
3082
- onSelectStatus?.(orderedResponses[index]?.status ?? "");
3083
- },
3084
- items: orderedResponses.map(({ status, response }) => ({
3085
- id: status,
3086
- label: status,
3087
- panel: renderResponsePanel({
3184
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiDocumentSection, {
3185
+ title: title ?? t("openapi.responses"),
3186
+ children: renderResponsePanel({
3088
3187
  status,
3089
3188
  response
3090
3189
  })
3091
- })),
3092
- className: "mt-4 mb-6",
3093
- panelsClassName: "mt-5"
3094
- })] });
3190
+ });
3191
+ }
3192
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiDocumentSection, {
3193
+ title: title ?? t("openapi.responses"),
3194
+ bodyClassName: "not-prose",
3195
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tabs, {
3196
+ selectedIndex,
3197
+ onChange: (index) => {
3198
+ onSelectStatus?.(orderedResponses[index]?.status ?? "");
3199
+ },
3200
+ items: orderedResponses.map(({ status, response }) => ({
3201
+ id: status,
3202
+ label: status,
3203
+ panel: renderResponsePanel({
3204
+ status,
3205
+ response
3206
+ })
3207
+ })),
3208
+ spacingClassName: "m-0",
3209
+ panelsClassName: "mt-2"
3210
+ })
3211
+ });
3095
3212
  }
3096
3213
  //#endregion
3097
3214
  //#region source/openapi/components/EndpointSections.tsx
3098
3215
  function EndpointRequest(arg0) {
3099
- const { spec, path, method, operationSource = "path", description, groupedParameters, parameters, requestBody, requestContents, requestSchema, selectedRequestMediaType, onSelectRequestMediaType, selectedServer, serverVariables, auth, sharedExampleKey, onSelectExampleKey } = arg0;
3216
+ const { spec, path, method, operationSource = "path", description, groupedParameters, parameters, requestBody, requestContents, requestSchema, selectedRequestMediaType, onSelectRequestMediaType, selectedServer, serverVariables, authOptions, auth, sharedExampleKey, onSelectExampleKey } = arg0;
3100
3217
  const t = require_i18n.useBuiltInText();
3101
3218
  const hasRequestBody = Boolean(requestBody && requestContents.length > 0);
3102
3219
  const renderDescription = () => {
@@ -3117,8 +3234,9 @@ function EndpointRequest(arg0) {
3117
3234
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderDescription(), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Row, {
3118
3235
  className: "clarify-openapi-request-workspace relative mt-8 pt-6",
3119
3236
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3120
- className: "w-full",
3237
+ className: "flex w-full flex-col gap-6",
3121
3238
  children: [
3239
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiAuthDocumentation, { options: authOptions }),
3122
3240
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
3123
3241
  title: t("openapi.pathParameters"),
3124
3242
  parameters: groupedParameters.path
@@ -3131,7 +3249,10 @@ function EndpointRequest(arg0) {
3131
3249
  title: t("openapi.headers"),
3132
3250
  parameters: groupedParameters.header
3133
3251
  }),
3134
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("openapi.requestBody") }), renderRequestBody()] })
3252
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiDocumentSection, {
3253
+ title: t("openapi.requestBody"),
3254
+ children: renderRequestBody()
3255
+ })
3135
3256
  ]
3136
3257
  }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, {
3137
3258
  sticky: true,
@@ -4211,6 +4332,7 @@ function OpenApiResponseViewer(arg0) {
4211
4332
  const previewAvailable = exchange ? canPreviewResponse(exchange.contentType) : false;
4212
4333
  const selectedBodyMode = bodyModeSelection && bodyModeSelection.exchange === exchange ? bodyModeSelection.mode : "preview";
4213
4334
  const activeBodyMode = previewAvailable ? selectedBodyMode : "raw";
4335
+ const bodyModes = ["preview", "raw"].filter((mode) => mode === "raw" || previewAvailable);
4214
4336
  function downloadBody() {
4215
4337
  if (!exchange) return;
4216
4338
  const url = URL.createObjectURL(exchange.blob);
@@ -4285,48 +4407,37 @@ function OpenApiResponseViewer(arg0) {
4285
4407
  className: "font-mono text-2xs font-normal text-(--clarify-code-faint)",
4286
4408
  children: exchange.contentType || t("openapi.unknownContentType")
4287
4409
  }),
4288
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4289
- className: "min-h-72",
4290
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4291
- className: "flex h-10 items-center justify-between border-b border-(--clarify-code-border) px-3",
4292
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4293
- role: "tablist",
4294
- className: "flex",
4295
- children: ["preview", "raw"].filter((mode) => mode === "raw" || previewAvailable).map((mode) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4296
- type: "button",
4297
- role: "tab",
4298
- "aria-selected": activeBodyMode === mode,
4299
- onClick: () => setBodyModeSelection({
4300
- exchange,
4301
- mode
4302
- }),
4303
- className: (0, clsx.default)("border-b-2 px-2.5 py-1 text-2xs font-semibold", activeBodyMode === mode ? "border-(--clarify-theme-tokens-colors-primary) text-(--clarify-code-text)" : "border-transparent text-(--clarify-code-muted)"),
4304
- children: mode === "preview" ? t("openapi.preview") : t("openapi.raw")
4305
- }, mode))
4306
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4307
- className: "flex",
4308
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyButton, { value: exchange.body }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4309
- type: "button",
4310
- onClick: downloadBody,
4311
- "aria-label": t("openapi.downloadBody"),
4312
- title: t("openapi.downloadBody"),
4313
- className: "grid size-8 shrink-0 place-items-center rounded-(--clarify-theme-tokens-radius-md) text-(--clarify-code-muted) transition hover:bg-(--clarify-code-control-background-hover) hover:text-(--clarify-code-text) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)",
4314
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.DownloadIcon, {
4315
- className: "size-4",
4316
- "aria-hidden": "true"
4317
- })
4318
- })]
4319
- })]
4320
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4321
- className: "p-4",
4322
- children: activeBodyMode === "preview" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponsePreview, { exchange }) : exchange.size ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
4410
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tabs, {
4411
+ items: bodyModes.map((mode) => ({
4412
+ id: mode,
4413
+ label: mode === "preview" ? t("openapi.preview") : t("openapi.raw"),
4414
+ panel: mode === "preview" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponsePreview, { exchange }) : exchange.size ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
4323
4415
  className: "max-h-128 overflow-auto whitespace-pre-wrap wrap-break-word font-mono text-xs/5",
4324
4416
  children: exchange.body
4325
4417
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4326
4418
  className: "py-8 text-center text-xs text-(--clarify-code-faint)",
4327
4419
  children: t("openapi.responseBodyEmpty")
4328
4420
  })
4329
- })]
4421
+ })),
4422
+ selectedIndex: bodyModes.indexOf(activeBodyMode),
4423
+ onChange: (index) => setBodyModeSelection({
4424
+ exchange,
4425
+ mode: bodyModes[index] ?? "raw"
4426
+ }),
4427
+ spacingClassName: "m-0 min-h-72",
4428
+ panelsClassName: "p-4",
4429
+ variant: "code",
4430
+ actions: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyButton, { value: exchange.body }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4431
+ type: "button",
4432
+ onClick: downloadBody,
4433
+ "aria-label": t("openapi.downloadBody"),
4434
+ title: t("openapi.downloadBody"),
4435
+ className: "grid size-8 shrink-0 place-items-center rounded-(--clarify-theme-tokens-radius-md) text-(--clarify-code-muted) transition hover:bg-(--clarify-code-control-background-hover) hover:text-(--clarify-code-text) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)",
4436
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.DownloadIcon, {
4437
+ className: "size-4",
4438
+ "aria-hidden": "true"
4439
+ })
4440
+ })] })
4330
4441
  })
4331
4442
  })
4332
4443
  ]
@@ -5089,7 +5200,8 @@ function ServerVariableControl(arg0) {
5089
5200
  label: option
5090
5201
  })),
5091
5202
  onChange,
5092
- compact
5203
+ compact,
5204
+ buttonClassName: "inline-flex min-h-8 w-full min-w-0 items-center justify-between gap-1 rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) px-2.5 py-1.5 text-xs font-semibold text-(--clarify-theme-tokens-colors-foreground) shadow-xs outline-hidden transition hover:border-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) focus:ring-2 focus:ring-inset focus:ring-(--clarify-theme-tokens-colors-primary) data-open:bg-(--clarify-ui-active-background)"
5093
5205
  });
5094
5206
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
5095
5207
  "aria-label": name,
@@ -5119,7 +5231,8 @@ function ServerPanel(arg0) {
5119
5231
  label: getServerLabel(server, index),
5120
5232
  description: server.description
5121
5233
  })),
5122
- onChange: onSelectServer
5234
+ onChange: onSelectServer,
5235
+ buttonClassName: "inline-flex min-h-8 w-full min-w-0 items-center justify-between gap-1 rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) px-2.5 py-1.5 text-xs font-semibold text-(--clarify-theme-tokens-colors-foreground) shadow-xs outline-hidden transition hover:border-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) focus:ring-2 focus:ring-inset focus:ring-(--clarify-theme-tokens-colors-primary) data-open:bg-(--clarify-ui-active-background)"
5123
5236
  })]
5124
5237
  }) : null, variableEntries.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5125
5238
  className: "grid gap-3 sm:grid-cols-(--clarify-openapi-variable-grid)",
@@ -5249,6 +5362,7 @@ function OpenApiOperation(arg0) {
5249
5362
  onSelectRequestMediaType: requestState.setSelectedRequestMediaType,
5250
5363
  selectedServer: serverState.selectedServer,
5251
5364
  serverVariables: serverState.serverVariables,
5365
+ authOptions: authState.authOptions,
5252
5366
  auth: authState.authInput,
5253
5367
  sharedExampleKey: linkedExampleKey,
5254
5368
  onSelectExampleKey: setLinkedExampleKey
@@ -5489,4 +5603,4 @@ Object.defineProperty(exports, "primitives_exports", {
5489
5603
  }
5490
5604
  });
5491
5605
 
5492
- //# sourceMappingURL=OpenApiOperation-D1WNrj5X.cjs.map
5606
+ //# sourceMappingURL=OpenApiOperation-HhSjad7q.cjs.map