@clarify-labs/renderer 0.9.2 → 0.9.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 (39) hide show
  1. package/output/{ClarifyShell-C38EkErX.js → ClarifyShell-BQ29N8P5.js} +26 -4
  2. package/output/ClarifyShell-BQ29N8P5.js.map +1 -0
  3. package/output/{ClarifyShell-DdYRgrfY.cjs → ClarifyShell-Dm--LZco.cjs} +27 -5
  4. package/output/ClarifyShell-Dm--LZco.cjs.map +1 -0
  5. package/output/{OpenApiOperation-DIFaYAe5.js → OpenApiOperation-C9xyRo5a.js} +293 -113
  6. package/output/OpenApiOperation-C9xyRo5a.js.map +1 -0
  7. package/output/{OpenApiOperation-CP_fxT_F.cjs → OpenApiOperation-DIWGdw29.cjs} +291 -111
  8. package/output/OpenApiOperation-DIWGdw29.cjs.map +1 -0
  9. package/output/{PageActions-tmnpzi23.js → PageActions-B_tSec1f.js} +6 -24
  10. package/output/PageActions-B_tSec1f.js.map +1 -0
  11. package/output/{PageActions-B08cDCzq.cjs → PageActions-DEuFHgyB.cjs} +5 -29
  12. package/output/PageActions-DEuFHgyB.cjs.map +1 -0
  13. package/output/client.cjs +3 -3
  14. package/output/client.js +3 -3
  15. package/output/components/Tabs.d.ts +16 -0
  16. package/output/components/index.d.ts +1 -0
  17. package/output/core/i18n.d.ts +1 -1
  18. package/output/index.cjs +4 -4
  19. package/output/index.js +4 -4
  20. package/output/openapi/components/EndpointSections.d.ts +2 -0
  21. package/output/openapi/components/ExamplePanels.d.ts +2 -0
  22. package/output/openapi/components/OpenApiOperation.d.ts +6 -0
  23. package/output/openapi/components/SchemaProperties.d.ts +2 -0
  24. package/output/preview.cjs +2 -2
  25. package/output/preview.js +2 -2
  26. package/output/{render-Bvf5ZMZb.cjs → render-BCGK1WpS.cjs} +2 -2
  27. package/output/{render-Bvf5ZMZb.cjs.map → render-BCGK1WpS.cjs.map} +1 -1
  28. package/output/{render-6gHfrR9h.js → render-CEWLJSmt.js} +2 -2
  29. package/output/{render-6gHfrR9h.js.map → render-CEWLJSmt.js.map} +1 -1
  30. package/output/renderer.css +43 -1
  31. package/output/server.cjs +2 -2
  32. package/output/server.js +2 -2
  33. package/package.json +1 -1
  34. package/output/ClarifyShell-C38EkErX.js.map +0 -1
  35. package/output/ClarifyShell-DdYRgrfY.cjs.map +0 -1
  36. package/output/OpenApiOperation-CP_fxT_F.cjs.map +0 -1
  37. package/output/OpenApiOperation-DIFaYAe5.js.map +0 -1
  38. package/output/PageActions-B08cDCzq.cjs.map +0 -1
  39. package/output/PageActions-tmnpzi23.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-DakpK96I.cjs");
2
- const require_PageActions = require("./PageActions-B08cDCzq.cjs");
2
+ const require_PageActions = require("./PageActions-DEuFHgyB.cjs");
3
3
  const require_remark = require("./remark-Dv3owbSH.cjs");
4
4
  let clsx = require("clsx");
5
5
  clsx = require_chunk.__toESM(clsx, 1);
@@ -906,6 +906,44 @@ function Prose(arg0) {
906
906
  });
907
907
  }
908
908
  //#endregion
909
+ //#region source/components/Tabs.tsx
910
+ function Tabs(arg0) {
911
+ const { items, selectedIndex, onChange, className, listClassName, panelsClassName } = arg0;
912
+ const [internalIndex, setInternalIndex] = (0, react.useState)(0);
913
+ const resolvedIndex = typeof selectedIndex === "number" ? selectedIndex : internalIndex;
914
+ const indicatorLayoutId = (0, react.useId)();
915
+ const handleChange = (index) => {
916
+ if (typeof selectedIndex !== "number") setInternalIndex(index);
917
+ onChange?.(index);
918
+ };
919
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.TabGroup, {
920
+ selectedIndex: resolvedIndex,
921
+ onChange: handleChange,
922
+ className,
923
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabList, {
924
+ className: (0, clsx.default)("flex flex-wrap items-center gap-6 border-b border-(--clarify-theme-tokens-colors-border) pb-0", listClassName),
925
+ children: items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Tab, {
926
+ className: ({ selected }) => (0, clsx.default)("clarify-ui-tab relative inline-flex h-10 shrink-0 items-center px-0 py-0 text-sm font-medium transition focus:outline-none", selected && "clarify-ui-tab-active"),
927
+ 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, {
928
+ layoutId: indicatorLayoutId,
929
+ className: "absolute inset-x-0 bottom-0 h-0.5 rounded-full bg-(--clarify-theme-tokens-colors-foreground)",
930
+ transition: {
931
+ type: "tween",
932
+ duration: .16,
933
+ ease: "easeOut"
934
+ }
935
+ }) : null] })
936
+ }, item.id))
937
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabPanels, {
938
+ className: (0, clsx.default)("mt-4", panelsClassName),
939
+ children: items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabPanel, {
940
+ className: "focus:outline-none",
941
+ children: item.panel
942
+ }, item.id))
943
+ })]
944
+ });
945
+ }
946
+ //#endregion
909
947
  //#region source/components/WebFrame.tsx
910
948
  function WebFrame(arg0) {
911
949
  const { src, title = "Embedded content", children, showWindow = true, className, iframeClassName, height = 420, style, ...props } = arg0;
@@ -2077,19 +2115,36 @@ function firstExampleKeyForResponseContent(content) {
2077
2115
  return getExampleEntries(content?.value)[0]?.key ?? "";
2078
2116
  }
2079
2117
  function useResponseExamplesState(arg0) {
2080
- const { operation, spec, sharedExampleKey, onSelectExampleKey } = arg0;
2081
- const responses = getResponseEntries(operation, spec).filter(({ response }) => getMediaTypeEntries(response.content, spec).length > 0);
2082
- const [selectedStatus, setSelectedStatus] = (0, react.useState)(responses.find(({ status }) => status.startsWith("2"))?.status ?? responses[0]?.status ?? "");
2083
- const selectedResponse = responses.find(({ status }) => status === selectedStatus) ?? responses[0];
2118
+ const { operation, spec, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus } = arg0;
2119
+ const orderedResponses = [...getResponseEntries(operation, spec).filter(({ response }) => getMediaTypeEntries(response.content, spec).length > 0)].sort((left, right) => {
2120
+ if (left.status === "default") return -1;
2121
+ if (right.status === "default") return 1;
2122
+ const leftCode = Number(left.status);
2123
+ const rightCode = Number(right.status);
2124
+ if (!Number.isNaN(leftCode) && !Number.isNaN(rightCode)) return leftCode - rightCode;
2125
+ return left.status.localeCompare(right.status);
2126
+ });
2127
+ const [internalSelectedStatus, setInternalSelectedStatus] = (0, react.useState)(orderedResponses.find(({ status }) => status === "default")?.status ?? orderedResponses.find(({ status }) => status.startsWith("2"))?.status ?? orderedResponses[0]?.status ?? "");
2128
+ const activeStatus = selectedStatus ?? internalSelectedStatus;
2129
+ const selectedResponse = orderedResponses.find(({ status }) => status === activeStatus) ?? orderedResponses[0];
2084
2130
  const responseContents = getMediaTypeEntries(selectedResponse?.response.content, spec);
2085
- const [selectedMediaType, setSelectedMediaType] = (0, react.useState)(responseContents[0]?.mediaType ?? "");
2086
- const selectedContent = responseContents.find((content) => content.mediaType === selectedMediaType) ?? responseContents[0];
2131
+ const [selection, setSelection] = (0, react.useState)(() => ({
2132
+ status: activeStatus,
2133
+ mediaType: responseContents[0]?.mediaType ?? "",
2134
+ exampleKey: firstExampleKeyForResponseContent(responseContents[0])
2135
+ }));
2136
+ const resolvedSelection = selection.status === activeStatus ? selection : {
2137
+ status: activeStatus,
2138
+ mediaType: responseContents[0]?.mediaType ?? "",
2139
+ exampleKey: firstExampleKeyForResponseContent(responseContents[0])
2140
+ };
2141
+ const selectedContent = responseContents.find((content) => content.mediaType === resolvedSelection.mediaType) ?? responseContents[0];
2087
2142
  const examples = getExampleEntries(selectedContent?.value);
2088
- const [selectedExampleKey, setSelectedExampleKey] = (0, react.useState)(examples[0]?.key ?? "");
2143
+ const selectedExampleKey = examples.some((example) => example.key === resolvedSelection.exampleKey) ? resolvedSelection.exampleKey : examples[0]?.key ?? "";
2089
2144
  const currentExampleKey = (sharedExampleKey && examples.some((example) => example.key === sharedExampleKey) ? sharedExampleKey : void 0) ?? selectedExampleKey;
2090
2145
  const selectedExample = examples.find((example) => example.key === currentExampleKey) ?? examples[0];
2091
2146
  return {
2092
- responses,
2147
+ responses: orderedResponses,
2093
2148
  selectedResponse,
2094
2149
  responseContents,
2095
2150
  selectedContent,
@@ -2097,29 +2152,42 @@ function useResponseExamplesState(arg0) {
2097
2152
  selectedExample,
2098
2153
  responseCode: stringifyExample(selectedExample?.value),
2099
2154
  onSelectStatus: (value) => {
2100
- const nextContents = getMediaTypeEntries(responses.find(({ status }) => status === value)?.response.content, spec);
2101
- setSelectedStatus(value);
2102
- setSelectedMediaType(nextContents[0]?.mediaType ?? "");
2103
- setSelectedExampleKey(firstExampleKeyForResponseContent(nextContents[0]));
2155
+ const nextContents = getMediaTypeEntries(orderedResponses.find(({ status }) => status === value)?.response.content, spec);
2156
+ if (typeof selectedStatus === "undefined") setInternalSelectedStatus(value);
2157
+ onSelectStatus?.(value);
2158
+ setSelection({
2159
+ status: value,
2160
+ mediaType: nextContents[0]?.mediaType ?? "",
2161
+ exampleKey: firstExampleKeyForResponseContent(nextContents[0])
2162
+ });
2104
2163
  },
2105
2164
  onSelectMediaType: (value) => {
2106
- setSelectedMediaType(value);
2107
- setSelectedExampleKey(firstExampleKeyForResponseContent(responseContents.find((content) => content.mediaType === value)));
2165
+ const nextContent = responseContents.find((content) => content.mediaType === value);
2166
+ setSelection((current) => ({
2167
+ ...current,
2168
+ mediaType: value,
2169
+ exampleKey: firstExampleKeyForResponseContent(nextContent)
2170
+ }));
2108
2171
  },
2109
2172
  onSelectExample: (value) => {
2110
- setSelectedExampleKey(value);
2173
+ setSelection((current) => ({
2174
+ ...current,
2175
+ exampleKey: value
2176
+ }));
2111
2177
  onSelectExampleKey?.(value);
2112
2178
  }
2113
2179
  };
2114
2180
  }
2115
2181
  function ResponseExamplesPanel(arg0) {
2116
- const { operation, spec, sharedExampleKey, onSelectExampleKey } = arg0;
2182
+ const { operation, spec, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus } = arg0;
2117
2183
  const t = require_PageActions.useBuiltInText();
2118
2184
  const state = useResponseExamplesState({
2119
2185
  operation,
2120
2186
  spec,
2121
2187
  sharedExampleKey,
2122
- onSelectExampleKey
2188
+ onSelectExampleKey,
2189
+ selectedStatus,
2190
+ onSelectStatus
2123
2191
  });
2124
2192
  if (!state.selectedResponse || !state.selectedContent || !state.responseCode) return null;
2125
2193
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ApiExampleCodeGroup, {
@@ -2369,97 +2437,172 @@ function SchemaProperties(arg0) {
2369
2437
  function ParameterList(arg0) {
2370
2438
  const { title, parameters } = arg0;
2371
2439
  const t = require_PageActions.useBuiltInText();
2372
- if (parameters.length === 0) return null;
2373
- 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, {
2440
+ 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.length > 0 ? parameters.map((parameter) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Property, {
2374
2441
  name: parameter.name ?? t("openapi.parameter"),
2375
2442
  type: [schemaToType(parameter.schema), parameter.required ? t("openapi.requiredBadge") : void 0].filter(Boolean).join(", ") || void 0,
2376
2443
  children: parameter.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
2377
2444
  className: "*:first:mt-0 *:last:mb-0",
2378
2445
  children: parameter.description
2379
2446
  }) : t("openapi.operationParameter")
2380
- }, `${parameter.in}-${parameter.name}`)) })] });
2447
+ }, `${parameter.in}-${parameter.name}`)) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2448
+ className: "text-sm/5 text-(--clarify-ui-text-soft)",
2449
+ children: t("openapi.none")
2450
+ }) })] });
2381
2451
  }
2382
2452
  function ResponseList(arg0) {
2383
- const { operation, spec } = arg0;
2453
+ const { operation, spec, selectedStatus, onSelectStatus } = arg0;
2384
2454
  const t = require_PageActions.useBuiltInText();
2385
- const responses = getResponseEntries(operation, spec);
2386
- if (responses.length === 0) return null;
2387
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("openapi.responses") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Properties, { children: responses.map(({ status, response }) => {
2388
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Property, {
2389
- name: status,
2390
- type: schemaToType(getJsonLikeContent(response.content, spec)?.value.schema),
2391
- children: response.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
2392
- className: "*:first:mt-0 *:last:mb-0",
2393
- children: response.description
2394
- }) : `${t("openapi.response")}.`
2395
- }, status);
2396
- }) })] });
2455
+ const orderedResponses = [...getResponseEntries(operation, spec)].sort((left, right) => {
2456
+ if (left.status === "default") return -1;
2457
+ if (right.status === "default") return 1;
2458
+ const leftCode = Number(left.status);
2459
+ const rightCode = Number(right.status);
2460
+ if (!Number.isNaN(leftCode) && !Number.isNaN(rightCode)) return leftCode - rightCode;
2461
+ return left.status.localeCompare(right.status);
2462
+ });
2463
+ const activeStatus = selectedStatus ?? orderedResponses.find(({ status }) => status === "default")?.status ?? orderedResponses.find(({ status }) => status.startsWith("2"))?.status ?? orderedResponses[0]?.status ?? "";
2464
+ const selectedIndex = Math.max(0, orderedResponses.findIndex(({ status }) => status === activeStatus));
2465
+ if (orderedResponses.length === 0) return null;
2466
+ const renderResponsePanel = ({ status, response }) => {
2467
+ const responseSchema = getJsonLikeContent(response.content, spec)?.value.schema;
2468
+ const type = schemaToType(responseSchema);
2469
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2470
+ className: "rounded-(--clarify-theme-tokens-radius-xl) p-0",
2471
+ children: [
2472
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2473
+ className: "flex flex-wrap items-center gap-2",
2474
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2475
+ className: "text-sm/5 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
2476
+ children: status
2477
+ }), type ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2478
+ className: "text-xs text-(--clarify-theme-tokens-colors-muted)",
2479
+ children: type
2480
+ }) : null]
2481
+ }),
2482
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2483
+ className: "mt-3 text-sm/6 text-(--clarify-ui-text-soft) *:first:mt-0 *:last:mb-0",
2484
+ children: response.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
2485
+ className: "*:first:mt-0 *:last:mb-0",
2486
+ children: response.description
2487
+ }) : `${t("openapi.response")}.`
2488
+ }),
2489
+ responseSchema && spec ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2490
+ className: "mt-4",
2491
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaProperties, {
2492
+ title: t("openapi.responseBodyProperties"),
2493
+ schema: responseSchema,
2494
+ spec
2495
+ })
2496
+ }) : null
2497
+ ]
2498
+ });
2499
+ };
2500
+ if (orderedResponses.length === 1) {
2501
+ const [{ status, response }] = orderedResponses;
2502
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("openapi.responses") }), renderResponsePanel({
2503
+ status,
2504
+ response
2505
+ })] });
2506
+ }
2507
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("openapi.responses") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tabs, {
2508
+ selectedIndex,
2509
+ onChange: (index) => {
2510
+ onSelectStatus?.(orderedResponses[index]?.status ?? "");
2511
+ },
2512
+ items: orderedResponses.map(({ status, response }) => ({
2513
+ id: status,
2514
+ label: status,
2515
+ panel: renderResponsePanel({
2516
+ status,
2517
+ response
2518
+ })
2519
+ })),
2520
+ panelsClassName: "mt-4"
2521
+ })] });
2397
2522
  }
2398
2523
  //#endregion
2399
2524
  //#region source/openapi/components/EndpointSections.tsx
2400
2525
  function EndpointRequest(arg0) {
2401
2526
  const { spec, path, method, description, groupedParameters, parameters, requestBody, requestContents, requestSchema, selectedRequestMediaType, onSelectRequestMediaType, selectedServer, serverVariables, auth, sharedExampleKey, onSelectExampleKey } = arg0;
2402
2527
  const t = require_PageActions.useBuiltInText();
2403
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Row, {
2528
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: description }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Row, {
2404
2529
  className: "relative mt-6",
2405
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Col, { children: [
2406
- description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: description }) : null,
2407
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
2408
- title: t("openapi.pathParameters"),
2409
- parameters: groupedParameters.path
2410
- }),
2411
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
2412
- title: t("openapi.queryParameters"),
2413
- parameters: groupedParameters.query
2414
- }),
2415
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
2416
- title: t("openapi.headers"),
2417
- parameters: groupedParameters.header
2418
- }),
2419
- requestBody && requestContents.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
2420
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("openapi.requestBody") }),
2421
- typeof requestBody.description === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: requestBody.description }) : null,
2422
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaProperties, {
2423
- title: t("openapi.bodyProperties"),
2424
- schema: requestSchema,
2425
- spec
2426
- })
2427
- ] }) : null
2428
- ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, {
2530
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2531
+ className: "w-full",
2532
+ children: [
2533
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
2534
+ title: t("openapi.pathParameters"),
2535
+ parameters: groupedParameters.path
2536
+ }),
2537
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
2538
+ title: t("openapi.queryParameters"),
2539
+ parameters: groupedParameters.query
2540
+ }),
2541
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
2542
+ title: t("openapi.headers"),
2543
+ parameters: groupedParameters.header
2544
+ }),
2545
+ requestBody && requestContents.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
2546
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("openapi.requestBody") }),
2547
+ typeof requestBody.description === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: requestBody.description }) : null,
2548
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaProperties, {
2549
+ title: t("openapi.bodyProperties"),
2550
+ schema: requestSchema,
2551
+ spec
2552
+ })
2553
+ ] }) : null
2554
+ ]
2555
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, {
2429
2556
  sticky: true,
2430
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequestExamplesPanel, {
2431
- spec,
2432
- path,
2433
- method,
2434
- parameters,
2435
- requestContents,
2436
- selectedMediaType: selectedRequestMediaType,
2437
- onSelectMediaType: onSelectRequestMediaType,
2438
- selectedServer,
2439
- serverVariables,
2440
- auth,
2441
- sharedExampleKey,
2442
- onSelectExampleKey
2557
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2558
+ className: "w-full",
2559
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequestExamplesPanel, {
2560
+ spec,
2561
+ path,
2562
+ method,
2563
+ parameters,
2564
+ requestContents,
2565
+ selectedMediaType: selectedRequestMediaType,
2566
+ onSelectMediaType: onSelectRequestMediaType,
2567
+ selectedServer,
2568
+ serverVariables,
2569
+ auth,
2570
+ sharedExampleKey,
2571
+ onSelectExampleKey
2572
+ })
2443
2573
  })
2444
2574
  })]
2445
- });
2575
+ })] });
2446
2576
  }
2447
2577
  function EndpointResponse(arg0) {
2448
- const { spec, operation, sharedExampleKey, onSelectExampleKey } = arg0;
2449
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Row, {
2450
- className: "relative mt-6",
2451
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponseList, {
2452
- operation,
2453
- spec
2454
- }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, {
2455
- sticky: true,
2456
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponseExamplesPanel, {
2457
- operation,
2458
- spec,
2459
- sharedExampleKey,
2460
- onSelectExampleKey
2461
- })
2462
- })]
2578
+ const { spec, operation, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus } = arg0;
2579
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2580
+ className: "mt-6",
2581
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Row, {
2582
+ className: "relative",
2583
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2584
+ className: "w-full",
2585
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponseList, {
2586
+ operation,
2587
+ spec,
2588
+ selectedStatus,
2589
+ onSelectStatus
2590
+ })
2591
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, {
2592
+ sticky: true,
2593
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2594
+ className: "w-full",
2595
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponseExamplesPanel, {
2596
+ operation,
2597
+ spec,
2598
+ sharedExampleKey,
2599
+ onSelectExampleKey,
2600
+ selectedStatus,
2601
+ onSelectStatus
2602
+ })
2603
+ })
2604
+ })]
2605
+ })
2463
2606
  });
2464
2607
  }
2465
2608
  //#endregion
@@ -2554,26 +2697,30 @@ function EndpointMethodBadge(arg0) {
2554
2697
  });
2555
2698
  }
2556
2699
  function EndpointPath(arg0) {
2557
- const { path } = arg0;
2558
- const segments = path.split("/").filter(Boolean);
2559
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2560
- className: "flex min-w-0 flex-1 items-center overflow-x-auto text-sm font-bold leading-6 whitespace-nowrap",
2561
- children: segments.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2562
- className: "text-(--clarify-ui-text-faint)",
2563
- children: "/"
2564
- }), segments.map((segment, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2565
- className: "flex items-center",
2566
- children: [index > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2567
- className: "text-(--clarify-ui-text-faint)",
2568
- children: "/"
2569
- }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2570
- className: "font-bold text-(--clarify-theme-tokens-colors-foreground)",
2571
- children: segment
2572
- })]
2573
- }, `${segment}-${index}`))] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2574
- className: "font-bold text-(--clarify-theme-tokens-colors-foreground)",
2575
- children: "/"
2576
- })
2700
+ const { path, copied = false, onCopy } = arg0;
2701
+ const t = require_PageActions.useBuiltInText();
2702
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2703
+ className: "flex min-w-0 flex-1 items-center gap-2 overflow-hidden",
2704
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2705
+ className: "min-w-0 flex-1 overflow-x-auto text-sm font-bold leading-6 whitespace-nowrap",
2706
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2707
+ className: "select-text font-mono text-(--clarify-theme-tokens-colors-foreground)",
2708
+ children: path || "/"
2709
+ })
2710
+ }), onCopy ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2711
+ type: "button",
2712
+ "aria-label": copied ? t("actions.copied") : t("actions.copy"),
2713
+ title: copied ? t("actions.copied") : t("actions.copy"),
2714
+ onClick: onCopy,
2715
+ className: (0, clsx.default)("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) text-(--clarify-ui-text-soft) transition hover:border-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground)", copied && "border-emerald-400/70 bg-emerald-50 text-emerald-700 dark:bg-emerald-400/10 dark:text-emerald-200"),
2716
+ children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {
2717
+ className: "h-3.5 w-3.5",
2718
+ "aria-hidden": "true"
2719
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CopyIcon, {
2720
+ className: "h-3.5 w-3.5",
2721
+ "aria-hidden": "true"
2722
+ })
2723
+ }) : null]
2577
2724
  });
2578
2725
  }
2579
2726
  function InlineListbox(arg0) {
@@ -2621,6 +2768,22 @@ function InlineListbox(arg0) {
2621
2768
  function getServerPreviewUrl(server, variables) {
2622
2769
  return (server.url ?? "").replace(/\{([^}]+)\}/g, (_, name) => variables[name] ?? server.variables?.[name]?.default ?? `{${name}}`);
2623
2770
  }
2771
+ function getFullEndpointUrl(server, variables, path) {
2772
+ const base = getServerPreviewUrl(server, variables);
2773
+ if (!base) return path;
2774
+ return `${base.endsWith("/") ? base.slice(0, -1) : base}${path.startsWith("/") ? path : `/${path}`}`;
2775
+ }
2776
+ function getDefaultResponseStatus(operation, spec) {
2777
+ const orderedResponses = [...getResponseEntries(operation, spec).filter(({ response }) => getMediaTypeEntries(response.content, spec).length > 0)].sort((left, right) => {
2778
+ if (left.status === "default") return -1;
2779
+ if (right.status === "default") return 1;
2780
+ const leftCode = Number(left.status);
2781
+ const rightCode = Number(right.status);
2782
+ if (!Number.isNaN(leftCode) && !Number.isNaN(rightCode)) return leftCode - rightCode;
2783
+ return left.status.localeCompare(right.status);
2784
+ });
2785
+ return orderedResponses.find(({ status }) => status === "default")?.status ?? orderedResponses.find(({ status }) => status.startsWith("2"))?.status ?? orderedResponses[0]?.status ?? "";
2786
+ }
2624
2787
  function ServerUrlValue(arg0) {
2625
2788
  const { server, variables, open, interactive, onToggle } = arg0;
2626
2789
  const url = getServerPreviewUrl(server, variables);
@@ -2770,6 +2933,16 @@ function AuthPanel(arg0) {
2770
2933
  function EndpointIdentity(arg0) {
2771
2934
  const { method, path, servers, selectedServerKey, selectedServer, serverVariables, serverOpen, authOptions, selectedAuthName, selectedAuth, authValues, authOpen, onSelectServer, onChangeServerVariable, onToggleServer, onToggleAuth, onSelectAuth, onChangeAuthValue } = arg0;
2772
2935
  const serverInteractive = servers.length > 1 || Object.keys(selectedServer.variables ?? {}).length > 0;
2936
+ const [copiedUrl, setCopiedUrl] = (0, react.useState)(false);
2937
+ const fullUrl = getFullEndpointUrl(selectedServer, serverVariables, path);
2938
+ (0, react.useEffect)(() => {
2939
+ if (!copiedUrl) return void 0;
2940
+ const timeout = window.setTimeout(() => setCopiedUrl(false), 1200);
2941
+ return () => window.clearTimeout(timeout);
2942
+ }, [copiedUrl]);
2943
+ async function handleCopyUrl() {
2944
+ if (await require_PageActions.copyTextToClipboard(fullUrl)) setCopiedUrl(true);
2945
+ }
2773
2946
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2774
2947
  className: "not-prose flex w-full flex-col overflow-hidden rounded-xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) shadow-xs",
2775
2948
  children: [
@@ -2784,7 +2957,11 @@ function EndpointIdentity(arg0) {
2784
2957
  interactive: serverInteractive,
2785
2958
  onToggle: onToggleServer
2786
2959
  }),
2787
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointPath, { path }),
2960
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointPath, {
2961
+ path,
2962
+ copied: copiedUrl,
2963
+ onCopy: handleCopyUrl
2964
+ }),
2788
2965
  authOptions.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2789
2966
  type: "button",
2790
2967
  "aria-expanded": authOpen,
@@ -2829,6 +3006,7 @@ function OpenApiOperation(arg0) {
2829
3006
  const serverState = useOperationServerState(spec, operation, path);
2830
3007
  const authState = useOperationAuthState(spec, operation);
2831
3008
  const [linkedExampleKey, setLinkedExampleKey] = (0, react.useState)("");
3009
+ const [selectedResponseStatus, setSelectedResponseStatus] = (0, react.useState)(() => getDefaultResponseStatus(operation, spec));
2832
3010
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
2833
3011
  className: "clarify-api-endpoint scroll-mt-24 pb-16 first:pt-0 last:pb-0",
2834
3012
  "aria-labelledby": id,
@@ -2885,7 +3063,9 @@ function OpenApiOperation(arg0) {
2885
3063
  spec,
2886
3064
  operation,
2887
3065
  sharedExampleKey: linkedExampleKey,
2888
- onSelectExampleKey: setLinkedExampleKey
3066
+ onSelectExampleKey: setLinkedExampleKey,
3067
+ selectedStatus: selectedResponseStatus,
3068
+ onSelectStatus: setSelectedResponseStatus
2889
3069
  })
2890
3070
  ]
2891
3071
  });
@@ -3072,4 +3252,4 @@ Object.defineProperty(exports, "primitives_exports", {
3072
3252
  }
3073
3253
  });
3074
3254
 
3075
- //# sourceMappingURL=OpenApiOperation-CP_fxT_F.cjs.map
3255
+ //# sourceMappingURL=OpenApiOperation-DIWGdw29.cjs.map