@redocly/openapi-docs 3.17.1 → 3.18.0-custom.1
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/redocly-openapi-docs.min.js +3593 -2768
- package/lib/components/ApiInfo/ApiInfo.js +1 -1
- package/lib/components/ApiInfo/Metadata.js +1 -1
- package/lib/components/Callbacks/CallbackDetails.js +2 -2
- package/lib/components/Discriminator/Discriminator.d.ts +0 -1
- package/lib/components/Discriminator/Discriminator.js +2 -2
- package/lib/components/ExpandAllButton/ExpandAllButton.js +2 -2
- package/lib/components/Language/LanguageList.js +1 -1
- package/lib/components/McpOverview/McpOverview.js +7 -3
- package/lib/components/OperationItem/OperationItem.js +10 -6
- package/lib/components/Overview/Overview.js +1 -1
- package/lib/components/PanelItem/styled.js +8 -4
- package/lib/components/PayloadSamples/ExampleValue.js +1 -1
- package/lib/components/PayloadSamples/PayloadSamples.js +1 -1
- package/lib/components/PayloadSamples/types.d.ts +1 -0
- package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
- package/lib/components/Request/RequestDetails.js +8 -2
- package/lib/components/Request/types.d.ts +1 -1
- package/lib/components/RequestParameters/Body.d.ts +1 -0
- package/lib/components/RequestParameters/Body.js +1 -1
- package/lib/components/RequestParameters/RequestParameters.d.ts +2 -1
- package/lib/components/RequestParameters/RequestParameters.js +1 -1
- package/lib/components/RequestSamples/Example.js +1 -1
- package/lib/components/RequestSamples/RequestSamples.js +2 -2
- package/lib/components/RequestSamples/useCodeSamples.d.ts +1 -1
- package/lib/components/RequestSamples/useCodeSamples.js +1 -1
- package/lib/components/ResponseSamples/ResponseSamples.js +1 -1
- package/lib/components/ResponseSamples/Summary.d.ts +2 -1
- package/lib/components/ResponseSamples/Summary.js +1 -1
- package/lib/components/Responses/OperationResponseList.d.ts +1 -0
- package/lib/components/Responses/OperationResponseList.js +3 -2
- package/lib/components/Responses/ResponseDetails.js +1 -1
- package/lib/components/Responses/styled.js +4 -2
- package/lib/components/Responses/types.d.ts +1 -0
- package/lib/components/RightPanel/RightPanel.js +5 -1
- package/lib/components/Samples/ExampleSwitch.js +1 -1
- package/lib/components/Schema/ObjectSchema.js +1 -1
- package/lib/components/Schema/Schema.js +2 -2
- package/lib/components/Schema/types.d.ts +1 -3
- package/lib/components/SchemaDefinition/SchemaDefinition.js +5 -2
- package/lib/components/SectionContent/SectionContent.js +7 -5
- package/lib/components/SectionItem/SectionItem.js +1 -1
- package/lib/components/Security/OAuthScopes.d.ts +3 -3
- package/lib/components/Security/OAuthScopes.js +12 -11
- package/lib/components/Security/RequiredScopes.d.ts +6 -0
- package/lib/components/Security/RequiredScopes.js +17 -0
- package/lib/components/Security/RequiredScopesList.d.ts +14 -0
- package/lib/components/Security/RequiredScopesList.js +13 -0
- package/lib/components/Security/ScopeTagWithTooltip.d.ts +17 -0
- package/lib/components/Security/ScopeTagWithTooltip.js +33 -0
- package/lib/components/Security/Security.js +1 -1
- package/lib/components/Security/SecurityButton.js +14 -14
- package/lib/components/Security/SecurityFlow.js +18 -5
- package/lib/components/ServerList/ServerList.js +11 -11
- package/lib/components/ServerListDropdown/ServerListDropdown.js +1 -1
- package/lib/components/TagItem/Breadcrumbs.d.ts +11 -0
- package/lib/components/TagItem/Breadcrumbs.js +41 -0
- package/lib/components/TagItem/OperationNavigationItems.d.ts +4 -2
- package/lib/components/TagItem/OperationNavigationItems.js +20 -5
- package/lib/components/TagItem/OperationsNavigation.js +27 -2
- package/lib/components/TagItem/TagItem.js +51 -37
- package/lib/components/ViewNested/ViewNested.js +7 -7
- package/lib/components/common/Badges.js +10 -8
- package/lib/components/common/BodyContent/BodyContent.d.ts +2 -0
- package/lib/components/common/BodyContent/BodyContent.js +4 -4
- package/lib/components/common/Dropdown/Dropdown.d.ts +2 -2
- package/lib/components/common/Dropdown/Dropdown.js +44 -10
- package/lib/components/common/Fields/fields.js +5 -3
- package/lib/components/common/OperationItemTitle.js +8 -6
- package/lib/components/common/SchemaSelection/SchemaSelection.js +1 -1
- package/lib/components/common/Select/Select.js +1 -1
- package/lib/components/common/Select/styled.d.ts +0 -1
- package/lib/components/common/Select/styled.js +19 -63
- package/lib/components/common/Select/types.d.ts +0 -3
- package/lib/components/common/linkify.js +7 -2
- package/lib/components/common/panels.js +1 -1
- package/lib/components/common/styled.js +4 -4
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +1 -1
- package/lib/icons/CSharpIcon/CSharpIcon.d.ts +2 -1
- package/lib/icons/CSharpIcon/CSharpIcon.js +1 -1
- package/lib/icons/CurlIcon/CurlIcon.d.ts +3 -2
- package/lib/icons/CurlIcon/CurlIcon.js +2 -2
- package/lib/icons/GOIcon/GOIcon.d.ts +2 -1
- package/lib/icons/GOIcon/GOIcon.js +1 -1
- package/lib/icons/JavaIcon/JavaIcon.d.ts +2 -1
- package/lib/icons/JavaIcon/JavaIcon.js +1 -1
- package/lib/icons/JavaScriptIcon/JavaScriptIcon.d.ts +2 -1
- package/lib/icons/JavaScriptIcon/JavaScriptIcon.js +1 -1
- package/lib/icons/NodeJSIcon/NodeJSIcon.d.ts +2 -1
- package/lib/icons/NodeJSIcon/NodeJSIcon.js +1 -1
- package/lib/icons/PHPIcon/PHPIcon.d.ts +2 -1
- package/lib/icons/PHPIcon/PHPIcon.js +1 -1
- package/lib/icons/PythonIcon/PythonIcon.d.ts +2 -1
- package/lib/icons/PythonIcon/PythonIcon.js +1 -1
- package/lib/icons/RIcon/RIcon.d.ts +2 -1
- package/lib/icons/RIcon/RIcon.js +1 -1
- package/lib/icons/RubyIcon/RubyIcon.d.ts +2 -1
- package/lib/icons/RubyIcon/RubyIcon.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/models/field.js +1 -1
- package/lib/models/group.js +1 -1
- package/lib/models/mediaType.js +1 -1
- package/lib/models/operation.js +1 -1
- package/lib/models/request.js +1 -1
- package/lib/models/response.js +1 -1
- package/lib/models/schema.js +2 -2
- package/lib/models/types.d.ts +2 -0
- package/lib/services/code-samples/generator.d.ts +1 -0
- package/lib/services/code-samples/generator.js +1 -1
- package/lib/services/menu/builder.js +1 -1
- package/lib/services/menu/markdown.js +1 -1
- package/lib/services/menu/operation.d.ts +2 -2
- package/lib/services/menu/operation.js +1 -1
- package/lib/services/menu/tags.d.ts +1 -0
- package/lib/services/menu/tags.js +3 -3
- package/lib/services/types.d.ts +7 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -1
- package/lib/types/oauth2-types.d.ts +4 -0
- package/lib/types/oauth2-types.js +0 -0
- package/lib/types/open-api.d.ts +23 -2
- package/lib/utils/calculateMaxLength.d.ts +6 -0
- package/lib/utils/calculateMaxLength.js +1 -0
- package/lib/utils/getBreadcrumbs.d.ts +7 -0
- package/lib/utils/getBreadcrumbs.js +1 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +1 -1
- package/lib/utils/mcp.d.ts +1 -1
- package/lib/utils/mcp.js +1 -1
- package/lib/utils/openapi.d.ts +5 -1
- package/lib/utils/openapi.js +1 -1
- package/lib/utils/security-scope.d.ts +5 -0
- package/lib/utils/security-scope.js +1 -0
- package/lib/utils/string.js +1 -1
- package/package.json +20 -21
|
@@ -12,7 +12,6 @@ export interface SchemaOptions {
|
|
|
12
12
|
export interface SchemaProps extends SchemaOptions {
|
|
13
13
|
schema: SchemaModel;
|
|
14
14
|
parentType?: string[] | string;
|
|
15
|
-
onDiscriminatorChange?: (idx: number) => void;
|
|
16
15
|
onOneOfChange?: (params: OneOfChangeParams) => void;
|
|
17
16
|
fieldParentsName?: string[];
|
|
18
17
|
expandable?: boolean;
|
|
@@ -23,12 +22,11 @@ export interface SchemaProps extends SchemaOptions {
|
|
|
23
22
|
oneOfLevel?: number;
|
|
24
23
|
shouldCloseArray?: boolean;
|
|
25
24
|
}
|
|
26
|
-
export interface ObjectSchemaProps extends
|
|
25
|
+
export interface ObjectSchemaProps extends SchemaProps {
|
|
27
26
|
discriminator?: {
|
|
28
27
|
fieldName: string;
|
|
29
28
|
parentSchema: SchemaModel;
|
|
30
29
|
activeOneOfIdx: number;
|
|
31
|
-
onChange?: (idx: number) => void;
|
|
32
30
|
};
|
|
33
31
|
fieldParentsName?: string[];
|
|
34
32
|
expandable?: boolean;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import{jsx as o,jsxs as S}from"react/jsx-runtime";import{memo as C,useCallback as
|
|
1
|
+
import{jsx as o,jsxs as S}from"react/jsx-runtime";import{memo as C,useCallback as k,useMemo as A}from"react";import{LayoutVariant as j}from"@redocly/config";import{useAtom as D,useAtomValue as x}from"jotai";import{useWriteAtom as N}from"../../jotai/use-write-atom.js";import{SamplesMiddlePanel as T,SamplesPanel as E,Row as P,Section as b,CodeBlockPanel as w}from"../common/index.js";import{getMediaType as I}from"../../models/index.js";import{MediaTypeSamples as L}from"../PayloadSamples/index.js";import{Schema as V}from"../Schema/index.js";import{Markdown as W}from"../Markdown/index.js";import{layoutAtom as _}from"../../jotai/app.js";import{globalStoreAtom as $}from"../../jotai/store.js";import{operationStore as O}from"../../jotai/operation.js";import{styled as g}from"../../styled-components.js";import{SchemaCatalogLink as B}from"../SchemaCatalogLink/SchemaCatalogLink.js";const K=(t,i)=>{if(!t)return{};const n={schema:{$ref:t}};return i&&(n.examples={example:{$ref:i}}),n};function q({schemaRef:t,exampleRef:i,showReadOnly:n=!0,showWriteOnly:v=!1}){const s=x(_),{parser:c,options:p}=x($),l=N(),e=A(()=>I(c,"json",!1,K(t,i),p,{operation:{pointer:"SchemaDefinitionComponent"}}),[i,p,c,t]),[d,f]=D(O(e.operation?.pointer)),y=k(r=>{if(!e.schema)return;const a=e.schema,u=a.oneOf;if(u&&e?.examples&&Object.keys(e?.examples).includes(r)){const m=u.findIndex(M=>M.title===r);m!==-1&&a&&l(O(a.operationPointer),{activeExampleName:a.oneOf?.[m]?.title,activeOneOf:{[a.pointer]:m}})}d.activeExampleName!==r&&f({activeExampleName:r})},[e?.examples,e.schema,d.activeExampleName,f,l]),h=s===j.STACKED;return o(b,{className:"schema-definition",children:S(P,{layout:s,children:[S(F,{isStacked:h,children:[t&&o(B,{schemaRef:t}),e.schema?.description&&o(z,{children:o(W,{source:e.schema?.description})}),o(V,{skipWriteOnly:!v,skipReadOnly:!n,schema:e.schema,level:1})]}),o(E,{isStacked:h,children:o(w,{className:"panel-response-samples",children:o(L,{mediaType:e,onChange:y})})})]})})}const re=C(q),z=g.div`
|
|
2
2
|
margin-bottom: var(--spacing-vertical);
|
|
3
|
-
|
|
3
|
+
`,F=g(T)`
|
|
4
|
+
padding-left: 0;
|
|
5
|
+
padding-right: 0;
|
|
6
|
+
`;export{re as SchemaDefinition};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import{jsx as t,jsxs as
|
|
1
|
+
import{jsx as t,jsxs as m,Fragment as v}from"react/jsx-runtime";import{useMemo as p}from"react";import{useAtomValue as d}from"jotai";import{LayoutVariant as c}from"@redocly/config";import{breakpoints as S}from"@redocly/theme/core/openapi";import{OpenApiHeader as u}from"@redocly/theme/components/OpenApiDocs/hooks/OpenApiHeader";import{PageFooter as k}from"../PageFooter/index.js";import{globalOptionsAtom as b}from"../../jotai/store.js";import{RenderHook as w}from"../RenderHook/index.js";import{RightPanel as y}from"../RightPanel/index.js";import{layoutAtom as C}from"../../jotai/app.js";import{Row as B,SamplesMiddlePanel as R,SamplesPanel as j}from"../common/index.js";import{Items as f}from"../ContentItems/Items.js";import{ContentItem as g}from"../ContentItem/index.js";import{styled as l}from"../../styled-components.js";function J({items:e,hideFooterAndHeader:n}){const{unstable_hooks:{MiddlePanelHeader:a},routingBasePath:i}=d(b),s=d(C),o=s===c.STACKED,P=p(()=>n?null:t(h,{isStacked:o,children:t(k,{})}),[n,o]),x=p(()=>n||!u&&!a?null:t(h,{isStacked:o,children:a?t(w,{Hook:a,props:void 0}):t(u,{})}),[a,n,o]);return e.length===0?null:m(v,{children:[x,m(_,{layout:s,style:{zIndex:1},children:[t(I,{layout:s,children:e.filter(({type:r})=>r==="section").map(r=>t(g,{item:r,routingBasePath:i,children:t(f,{items:r.items,routingBasePath:i})},r.id))}),t(M,{isStacked:o,tabIndex:0,children:t(y,{item:e[0]})})]}),e.filter(({type:r})=>r!=="section").map(r=>t(g,{item:r,routingBasePath:i,children:t(f,{items:r.items,routingBasePath:i})},r.id)),P]})}const h=l(R)`
|
|
2
2
|
align-self: flex-start;
|
|
3
3
|
padding-top: var(--panel-gap-vertical);
|
|
4
4
|
padding-bottom: var(--panel-gap-vertical);
|
|
5
|
-
`,
|
|
5
|
+
`,I=l.div`
|
|
6
6
|
width: 100%;
|
|
7
7
|
|
|
8
|
-
@media screen and (min-width: ${
|
|
8
|
+
@media screen and (min-width: ${S.large}) {
|
|
9
9
|
width: ${({layout:e})=>e===c.STACKED?"100%":"calc(100% - var(--panel-samples-width))"};
|
|
10
10
|
}
|
|
11
|
-
`,
|
|
11
|
+
`,M=l(j)`
|
|
12
12
|
margin: var(--spacing-base) 0;
|
|
13
|
-
|
|
13
|
+
`,_=l(B)`
|
|
14
|
+
padding-bottom: var(--spacing-xl);
|
|
15
|
+
`;export{M as RightPanelContainer,I as SectionContainer,J as SectionContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,Fragment as l,jsxs as p}from"react/jsx-runtime";import{memo as d}from"react";import{LayoutVariant as
|
|
1
|
+
import{jsx as t,Fragment as l,jsxs as p}from"react/jsx-runtime";import{memo as d}from"react";import{LayoutVariant as f}from"@redocly/config";import{SamplesMiddlePanel as a,Row as u}from"../common/index.js";import{Markdown as h}from"../Markdown/index.js";import{ExternalDocumentation as x}from"../ExternalDocumentation/index.js";function S({item:o,layout:s}){const{externalDocs:r,ast:i,description:c}=o,e=s===f.STACKED,n=!o.parent||o.parent.type!=="tag";return p(l,{children:[t(h,{ast:i,source:c,htmlWrap:m=>t(a,{fullWidth:n,isStacked:e,children:m})}),r&&t(u,{children:t(a,{compact:!0,fullWidth:n,isStacked:e,children:t(x,{externalDocs:r})})})]})}const _=d(S);export{_ as SectionItem};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
|
-
import type { OpenAPISecurityScheme } from '../../types/index.js';
|
|
3
2
|
import type { SecurityRequirement } from '../../models/index.js';
|
|
4
|
-
type
|
|
3
|
+
import type { OAuth2Flow, OAuth2Flows } from '../../types/index.js';
|
|
5
4
|
interface OAuthScopesMainProps {
|
|
6
5
|
id: string;
|
|
7
6
|
securities: SecurityRequirement[];
|
|
8
|
-
|
|
7
|
+
flow?: OAuth2Flow;
|
|
8
|
+
flows?: OAuth2Flows;
|
|
9
9
|
}
|
|
10
10
|
export declare const OAuthScopes: import("react").NamedExoticComponent<PropsWithChildren<OAuthScopesMainProps>>;
|
|
11
11
|
export {};
|
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as c,Fragment as g}from"react/jsx-runtime";import{memo as f,useState as u}from"react";import{ChevronRightIcon as S}from"@redocly/theme/icons/ChevronRightIcon/ChevronRightIcon";import{Markdown as h}from"../Markdown/index.js";import{SecuritySchemeItem as l}from"./SecuritySchemeItem.js";import{Tag as v}from"./styled.js";import{useTranslate as x}from"../../hooks/index.js";import{getOptionalScopes as y,getRequiredScopes as O}from"./helper.js";import{styled as t}from"../../styled-components.js";import{ScopeTagWithTooltip as b}from"./ScopeTagWithTooltip.js";import{RequiredScopesList as w}from"./RequiredScopesList.js";import{normalizeScopes as C}from"../../utils/security-scope.js";const j=24;function q({id:e,securities:n,flow:a,flows:r}){const i=O(e,n);return a?o(z,{flow:a,requiredScopes:i}):o(I,{children:o(w,{schemeId:e,securities:n,flows:r})})}function z({flow:e,requiredScopes:n}){const a=x(),[r,i]=u(!1),m=Object.keys(e.scopes||{}),d=C(n),p=y(d,m);return p.length===0?null:c(g,{children:[o(l,{label:c(R,{onClick:()=>{i(s=>!s)},children:[a(r?"openapi.hideOptionalScopes":"openapi.showOptionalScopes",r?"Hide optional scopes":"Show optional scopes"),o(_,{isOpen:r,children:o(S,{size:"var(--font-size-base)",color:"var(--tree-content-color-default)"})})]}),value:" "}),o(T,{isOpen:r,children:p.map(s=>o(l,{label:o(b,{className:"tag-grey",text:s,maxChars:j,TagComponent:A,compact:!0}),value:o(W,{children:o(h,{source:e.scopes[s]||""})})},s))})]})}const A=t(v)`
|
|
2
2
|
font-family: var(--font-family-base);
|
|
3
3
|
font-size: var(--font-size-base);
|
|
4
|
-
line-height: var(--line-height-base);
|
|
5
4
|
align-self: flex-start;
|
|
6
5
|
padding: 0 var(--spacing-xs);
|
|
7
6
|
border: var(--tag-border-width) var(--tag-border-style) var(--tag-bg-color);
|
|
8
7
|
border-radius: var(--tag-border-radius);
|
|
9
|
-
|
|
8
|
+
color: var(--color-warm-grey-8);
|
|
9
|
+
`,R=t.div`
|
|
10
10
|
cursor: pointer;
|
|
11
11
|
display: flex;
|
|
12
12
|
gap: var(--spacing-xxs);
|
|
13
13
|
align-items: center;
|
|
14
14
|
user-select: none;
|
|
15
|
-
`,
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-wrap: wrap;
|
|
18
|
-
gap: var(--spacing-xxs);
|
|
19
|
-
word-break: normal;
|
|
20
|
-
`,z=i.div`
|
|
15
|
+
`,T=t.div`
|
|
21
16
|
max-height: ${e=>e.isOpen?"1000px":"0"};
|
|
22
17
|
opacity: ${e=>e.isOpen?"1":"0"};
|
|
23
18
|
overflow: hidden;
|
|
24
19
|
transition:
|
|
25
20
|
max-height 0.5s ease-in-out,
|
|
26
21
|
opacity 0.5s ease-in-out;
|
|
27
|
-
`,
|
|
22
|
+
`,_=t.span`
|
|
28
23
|
display: inline-flex;
|
|
29
24
|
align-items: center;
|
|
30
25
|
justify-content: center;
|
|
31
26
|
transform: ${e=>e.isOpen?"rotate(90deg)":"rotate(0deg)"};
|
|
32
27
|
transition: transform 0.5s ease-in-out;
|
|
33
|
-
`,
|
|
28
|
+
`,I=t.div`
|
|
29
|
+
margin-top: var(--spacing-xs);
|
|
30
|
+
`,W=t.div`
|
|
31
|
+
p {
|
|
32
|
+
margin-bottom: 0;
|
|
33
|
+
}
|
|
34
|
+
`,G=f(q);export{G as OAuthScopes};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{styled as o}from"../../styled-components.js";import{normalizeScopes as m}from"../../utils/security-scope.js";import{useTranslate as g}from"../../hooks/index.js";import{ScopeTagWithTooltip as c}from"./ScopeTagWithTooltip.js";const l=4,S=32;function j({scopes:d}){const t=g(),s=m(d);if(s.length===0)return null;const h=s.slice(0,l),a=s.slice(l),n=a.length;return r(x,{children:[e(p,{children:"("}),r(u,{children:[t("openapi.requiredScopes","Required scopes"),":"," "]}),r(f,{children:[h.map(i=>e(c,{className:"tag-grey",text:i,maxChars:S},i)),n>0&&e(c,{arrowPosition:"left",className:"tag-grey",text:`+${n}`,tip:e(v,{children:a.map(i=>e("div",{children:i},i))}),ariaLabel:t("openapi.showMoreScopes",`Show ${n} more scopes`)})]}),e(p,{children:")"})]})}const x=o.span`
|
|
2
|
+
display: inline;
|
|
3
|
+
margin-left: var(--spacing-xxs);
|
|
4
|
+
`,u=o.span`
|
|
5
|
+
color: var(--color-warm-grey-8);
|
|
6
|
+
line-height: var(--line-height-base);
|
|
7
|
+
`,f=o.span`
|
|
8
|
+
display: inline;
|
|
9
|
+
padding: 0 var(--spacing-xxs);
|
|
10
|
+
`,v=o.div`
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: var(--spacing-xxs);
|
|
14
|
+
`,p=o.span`
|
|
15
|
+
color: var(--text-color-description);
|
|
16
|
+
line-height: var(--line-height-base);
|
|
17
|
+
`;export{j as RequiredScopes};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComponentType, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { SecurityRequirement } from '../../models/index.js';
|
|
3
|
+
import type { OAuth2Flows } from '../../types/index.js';
|
|
4
|
+
interface RequiredScopesListProps {
|
|
5
|
+
schemeId: string;
|
|
6
|
+
securities: SecurityRequirement[];
|
|
7
|
+
flows?: OAuth2Flows;
|
|
8
|
+
TagComponent?: ComponentType<{
|
|
9
|
+
className?: string;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
export declare function RequiredScopesList({ schemeId, securities, flows, TagComponent, }: RequiredScopesListProps): ReactElement | null;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{jsx as r,Fragment as g,jsxs as u}from"react/jsx-runtime";import{SecuritySchemeItem as s}from"./SecuritySchemeItem.js";import{useTranslate as f}from"../../hooks/index.js";import{getRequiredScopes as S}from"./helper.js";import{normalizeScopes as b,buildScopeDescriptionIndex as v}from"../../utils/security-scope.js";import{ScopeTagWithTooltip as x}from"./ScopeTagWithTooltip.js";import{Tag as h}from"./styled.js";import{Markdown as y}from"../Markdown/index.js";import{styled as i}from"../../styled-components.js";const T=24;function A({schemeId:n,securities:m,flows:o,TagComponent:c=q}){const p=f(),l=S(n,m),t=b(l);if(t.length===0)return null;const a=o?v(o):null,d=!!a;return u(g,{children:[r(s,{label:p("openapi.requiredScopes","Required scopes"),value:" "}),t.map(e=>r(s,{label:r(x,{className:"tag-grey",text:e,maxChars:T,TagComponent:c,compact:!0}),value:d?r(_,{children:r(y,{source:a?.get(e)||""})}):" "},e))]})}const _=i.div`
|
|
2
|
+
p {
|
|
3
|
+
margin-bottom: 0;
|
|
4
|
+
}
|
|
5
|
+
`,q=i(h)`
|
|
6
|
+
font-family: var(--font-family-base);
|
|
7
|
+
font-size: var(--font-size-base);
|
|
8
|
+
align-self: flex-start;
|
|
9
|
+
padding: 0 var(--spacing-xs);
|
|
10
|
+
border: var(--tag-border-width) var(--tag-border-style) var(--tag-bg-color);
|
|
11
|
+
border-radius: var(--tag-border-radius);
|
|
12
|
+
color: var(--color-warm-grey-8);
|
|
13
|
+
`;export{A as RequiredScopesList};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentType, ReactElement, ReactNode } from 'react';
|
|
2
|
+
type TagComponentProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
};
|
|
6
|
+
interface ScopeTagWithTooltipProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
text: string;
|
|
9
|
+
maxChars?: number;
|
|
10
|
+
tip?: string | ReactNode;
|
|
11
|
+
ariaLabel?: string;
|
|
12
|
+
TagComponent?: ComponentType<TagComponentProps>;
|
|
13
|
+
arrowPosition?: 'left' | 'right' | 'center';
|
|
14
|
+
compact?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function ScopeTagWithTooltip({ className, text, maxChars, tip, ariaLabel, TagComponent, arrowPosition, compact, }: ScopeTagWithTooltipProps): ReactElement;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{css as l}from"styled-components";import{Tooltip as h}from"@redocly/theme/components/Tooltip/Tooltip";import{styled as a}from"../../styled-components.js";import{getVisibleScopeLabel as b,isScopeTruncated as v}from"../../utils/security-scope.js";import{Tag as g}from"./styled.js";function k({className:i,text:r,maxChars:n=32,tip:s,ariaLabel:f,TagComponent:t=g,arrowPosition:u="center",compact:o=!1}){const c=b(r,n),d=s===void 0&&v(r,n)?r:s;return d?e(m,{$compact:o,children:e(h,{placement:"bottom",arrowPosition:u,tip:d,children:e(T,{role:"button",tabIndex:0,"aria-label":f??r,children:e(t,{className:i,children:e(p,{$compact:o,children:c})})})})}):e(m,{$compact:o,children:e(t,{className:i,children:e(p,{$compact:o,children:c})})})}const p=a.span`
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
font-family: var(--font-family-base);
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
text-overflow: ellipsis;
|
|
6
|
+
white-space: nowrap;
|
|
7
|
+
max-width: 16rem;
|
|
8
|
+
color: var(--color-warm-grey-8);
|
|
9
|
+
${({$compact:i})=>!i&&l`
|
|
10
|
+
&&& {
|
|
11
|
+
font-size: var(--font-size-sm);
|
|
12
|
+
}
|
|
13
|
+
`}
|
|
14
|
+
`,T=a.span`
|
|
15
|
+
cursor: default;
|
|
16
|
+
|
|
17
|
+
&:focus-visible {
|
|
18
|
+
outline: 1px solid var(--link-color-primary);
|
|
19
|
+
border-radius: var(--border-radius-md);
|
|
20
|
+
}
|
|
21
|
+
`,m=a.span`
|
|
22
|
+
display: inline-block;
|
|
23
|
+
vertical-align: baseline;
|
|
24
|
+
line-height: var(--line-height-base);
|
|
25
|
+
${({$compact:i})=>i?l`
|
|
26
|
+
margin: 0;
|
|
27
|
+
`:l`
|
|
28
|
+
margin: calc(var(--spacing-unit) / 2) var(--spacing-xxs) calc(var(--spacing-unit) / 2) 0;
|
|
29
|
+
&:last-child {
|
|
30
|
+
margin-right: 0;
|
|
31
|
+
}
|
|
32
|
+
`}
|
|
33
|
+
`;export{k as ScopeTagWithTooltip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,Fragment as f,jsxs as y}from"react/jsx-runtime";import{useState as h,useRef as C}from"react";import{Portal as b}from"@redocly/theme/components/Portal/Portal";import{useModalScrollLock as w}from"@redocly/theme/core/openapi";import{SecurityButton as M}from"./SecurityButton.js";import{SecurityModal as S}from"./SecurityModal.js";import{useTelemetry as g}from"../../hooks/index.js";function _({securities:t}){const[i,c]=h(!1),l=g(),e=C(null);if(w(i),!t.length)return null;const m=()=>{const o=t.flatMap(s=>s.schemes),n=[...new Set(o.map(s=>s.type))],u=o.length,a=n.length>1,p=Date.now();e.current={securityTypes:n,schemesCount:u,isCombined:a,modalOpenTime:p},l.sendViewSecurityDetailsClickedMessage({id:"openapi-docs-security-button",object:"button",uri:window.location.href,securityTypes:n,schemesCount:u,isCombined:a}),c(!0)},d=()=>{if(e.current){const o=Date.now()-e.current.modalOpenTime;l.sendViewSecurityDetailsClosedMessage({id:"openapi-docs-security-button",object:"button",uri:window.location.href,securityTypes:e.current.securityTypes,schemesCount:e.current.schemesCount,isCombined:e.current.isCombined,timeInModalMs:o}),e.current=null}c(!1)};return y(f,{children:[r(M,{securities:t,onClick:m}),i&&r(b,{mountId:"api-content",children:r(S,{securities:t,onClose:d})})]})}export{_ as Security};
|
|
1
|
+
import{jsx as r,Fragment as f,jsxs as y}from"react/jsx-runtime";import{useState as h,useRef as C}from"react";import{Portal as b}from"@redocly/theme/components/Portal/Portal";import{useModalScrollLock as w}from"@redocly/theme/core/openapi";import{SecurityButton as M}from"./SecurityButton.js";import{SecurityModal as S}from"./SecurityModal.js";import{useTelemetry as g}from"../../hooks/index.js";function _({securities:t}){const[i,c]=h(!1),l=g(),e=C(null);if(w(i),!t.length)return null;const m=()=>{const o=t.flatMap(s=>s.schemes),n=[...new Set(o.map(s=>s.type))],u=o.length,a=n.length>1,p=Date.now();e.current={securityTypes:n,schemesCount:u,isCombined:a,modalOpenTime:p},l.sendViewSecurityDetailsClickedMessage([{id:"openapi-docs-security-button",object:"button",uri:window.location.href,securityTypes:n,schemesCount:u,isCombined:a}]),c(!0)},d=()=>{if(e.current){const o=Date.now()-e.current.modalOpenTime;l.sendViewSecurityDetailsClosedMessage([{id:"openapi-docs-security-button",object:"button",uri:window.location.href,securityTypes:e.current.securityTypes,schemesCount:e.current.schemesCount,isCombined:e.current.isCombined,timeInModalMs:o}]),e.current=null}c(!1)};return y(f,{children:[r(M,{securities:t,onClick:m}),i&&r(b,{mountId:"api-content",children:r(S,{securities:t,onClose:d})})]})}export{_ as Security};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import{jsx as
|
|
2
|
-
${({deprecated:a})=>a&&
|
|
3
|
-
display: flex;
|
|
1
|
+
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Fragment as d}from"react";import{SecurityIcon as v}from"@redocly/theme/icons/SecurityIcon/SecurityIcon";import{Panel as u}from"@redocly/theme/components/Panel/Panel";import{Button as b}from"@redocly/theme/components/Button/Button";import{Tooltip as y}from"@redocly/theme/components/Tooltip/Tooltip";import{WarningFilledIcon as x}from"@redocly/theme/icons/WarningFilledIcon/WarningFilledIcon";import{useTranslate as w}from"../../hooks/index.js";import{styled as r}from"../../styled-components.js";import{deprecatedCss as S}from"../common/index.js";import{RequiredScopes as j}from"./RequiredScopes.js";function W({securities:a,onClick:m}){const o=w();return e(T,{header:()=>i(B,{children:[e(v,{}),e(D,{children:o("openapi.security","Security")}),e(C,{onClick:m,variant:"link",children:o("openapi.viewSecurityDetails","View details")})]}),isExpandable:!1,children:e(H,{children:a.map((t,n)=>{const s=a.length>1&&t.schemes.length>1,h=t.schemes.map(({id:l,scopes:g,deprecated:c=!1},f)=>i(d,{children:[i(k,{deprecated:c,children:[l,c&&e(y,{tip:o("openapi.badges.deprecated","Deprecated"),children:e(x,{color:"var(--badge-deprecated-bg-color)"})})]}),e(j,{scopes:g}),f<t.schemes.length-1&&e(p,{children:" and "})]},l));return i(d,{children:[s?"(":"",h,s?")":"",n<a.length-1&&e(p,{children:" or "})]},n)})})})}const k=r.span`
|
|
2
|
+
${({deprecated:a})=>a&&S}
|
|
3
|
+
display: inline-flex;
|
|
4
4
|
align-items: center;
|
|
5
5
|
gap: var(--spacing-xxs);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`,j=e(u)`
|
|
6
|
+
font-weight: var(--font-weight-medium);
|
|
7
|
+
`,T=r(u)`
|
|
9
8
|
margin-top: var(--spacing-base);
|
|
10
9
|
border: var(--panel-border);
|
|
11
10
|
border-radius: var(--panel-border-radius);
|
|
12
|
-
`,
|
|
11
|
+
`,B=r.div`
|
|
13
12
|
display: flex;
|
|
14
13
|
align-items: center;
|
|
15
14
|
justify-content: space-between;
|
|
@@ -19,19 +18,20 @@ import{jsx as r,jsxs as o}from"react/jsx-runtime";import{Fragment as d}from"reac
|
|
|
19
18
|
background-color: var(--layer-color);
|
|
20
19
|
border-bottom: var(--panel-border);
|
|
21
20
|
border-radius: var(--panel-border-radius) var(--panel-border-radius) 0 0;
|
|
22
|
-
`,
|
|
21
|
+
`,C=r(b)`
|
|
23
22
|
margin-left: auto;
|
|
24
23
|
font-size: var(--font-size-sm);
|
|
25
|
-
`,
|
|
24
|
+
`,D=r.span`
|
|
26
25
|
font-family: var(--font-family-base);
|
|
27
26
|
font-weight: var(--font-weight-medium);
|
|
28
27
|
color: var(--text-color-primary);
|
|
29
|
-
`,
|
|
30
|
-
|
|
31
|
-
text-overflow: ellipsis;
|
|
28
|
+
`,H=r.div`
|
|
29
|
+
display: block;
|
|
32
30
|
overflow: hidden;
|
|
33
31
|
padding: var(--spacing-xs) var(--spacing-sm);
|
|
34
32
|
color: var(--text-color-primary);
|
|
35
|
-
|
|
33
|
+
line-height: var(--line-height-base);
|
|
34
|
+
`,p=r.span`
|
|
36
35
|
color: var(--text-color-description);
|
|
37
|
-
|
|
36
|
+
line-height: var(--line-height-base);
|
|
37
|
+
`;export{W as SecurityButton};
|
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
import{jsx as e,
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as p}from"react/jsx-runtime";import{Badge as z}from"@redocly/theme/components/Badge/Badge";import{SecuritySchemeItem as n}from"./SecuritySchemeItem.js";import{titleize as A}from"../../utils/index.js";import{OAuthFlow as L}from"./OAuthFlow.js";import{StyledLink as v,Tag as O}from"./styled.js";import{Markdown as _}from"../Markdown/index.js";import{useTranslate as w}from"../../hooks/index.js";import{OAuthScopes as b}from"./OAuthScopes.js";import{styled as o}from"../../styled-components.js";import{RequiredScopesList as g}from"./RequiredScopesList.js";const j=["authorizationCode","clientCredentials","implicit","password","deviceAuthorization"];function k({flowType:l,flow:m,schemeId:h,securities:a}){const c=w();return r(p,{children:[e(n,{label:r(H,{className:"tag-grey",children:[e(N,{children:c("openapi.flowType","Flow type")})," ",e(P,{children:l})]}),value:e("span",{})}),r(C,{children:[e(L,{flow:m}),e(b,{id:h,securities:a,flow:m})]})]})}function V({type:l,bearerFormat:m,name:h,flows:a,openIdConnectUrl:c,description:y,id:t,securities:s,in:x,deprecated:T=!1,oauth2MetadataUrl:f}){const i=w();if(!l||!t)return null;const F={http:r(p,{children:[e(n,{label:i("openapi.httpAuthorizationScheme","HTTP Authorization Scheme"),value:l}),e(n,{label:i("openapi.bearerFormat","Bearer Format"),value:m}),e(g,{schemeId:t,securities:s,flows:a})]}),apiKey:r(p,{children:[e(n,{label:`${A(x||"")} ${i("openapi.parameterName","parameter name")}:`,value:h}),e(g,{schemeId:t,securities:s,flows:a})]}),oauth2:r(p,{children:[a&&Object.entries(a).filter(d=>{const[u,S]=d;return!!S&&j.includes(u)}).map(([d,u])=>e(k,{flowType:d,flow:u,schemeId:t,securities:s},d)),e(b,{id:t,securities:s,flows:a})]}),openIdConnect:r(p,{children:[e(n,{label:i("openapi.connectUrl","Connect URL"),value:c&&e(v,{target:"_blank",rel:"noopener noreferrer",href:c,children:c})}),e(g,{schemeId:t,securities:s,flows:a})]})};return r(W,{children:[r(I,{children:[e(R,{children:t}),T&&e(z,{deprecated:!0,children:i("openapi.badges.deprecated","Deprecated")})]}),e(_,{source:y}),f&&e(n,{label:i("openapi.oauth2MetadataUrl","OAuth2 Metadata URL"),value:e(v,{target:"_blank",rel:"noopener noreferrer",href:f,children:f})}),e(B,{children:F[l]||null})]})}const I=o.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
gap: var(--spacing-xxs);
|
|
5
5
|
margin: 0 0 var(--spacing-xs);
|
|
6
|
-
`,
|
|
6
|
+
`,W=o.div`
|
|
7
7
|
background: var(--layer-color);
|
|
8
8
|
padding: var(--spacing-base);
|
|
9
9
|
border-radius: var(--border-radius);
|
|
10
10
|
border: 1px solid var(--border-color-secondary);
|
|
11
11
|
width: 100%;
|
|
12
12
|
margin-top: var(--spacing-base);
|
|
13
|
-
`,
|
|
13
|
+
`,B=o.div`
|
|
14
14
|
width: 100%;
|
|
15
15
|
margin-top: var(--spacing-md);
|
|
16
|
-
`,
|
|
16
|
+
`,R=o.p`
|
|
17
17
|
font-size: var(--font-size-base);
|
|
18
18
|
margin: 0;
|
|
19
19
|
text-transform: capitalize;
|
|
20
20
|
font-weight: var(--font-weight-semibold);
|
|
21
|
-
|
|
21
|
+
`,C=o.div`
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
padding-left: var(--spacing-xs);
|
|
25
|
+
margin-bottom: var(--spacing-xxs);
|
|
26
|
+
`,H=o(O)`
|
|
27
|
+
color: var(--color-warm-grey-8);
|
|
28
|
+
font-family: var(--font-family-base);
|
|
29
|
+
`,N=o.span`
|
|
30
|
+
font-weight: var(--font-weight-regular);
|
|
31
|
+
`,P=o.span`
|
|
32
|
+
color: var(--color-warm-grey-11);
|
|
33
|
+
font-weight: var(--font-weight-medium);
|
|
34
|
+
`;export{V as SecurityFlow};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as i,jsxs as o}from"react/jsx-runtime";import{CopyButton as
|
|
1
|
+
import{jsx as i,jsxs as o}from"react/jsx-runtime";import{CopyButton as u}from"@redocly/theme/components/Buttons/CopyButton";import{CheckmarkFilledIcon as y}from"@redocly/theme/icons/CheckmarkFilledIcon/CheckmarkFilledIcon";import{getServerDisplayName as w}from"../../utils/helpers.js";import{PanelItemDescription as h,Title as S}from"../PanelItem/index.js";import{ViewNested as T}from"../ViewNested/index.js";import{Tag as l}from"../common/index.js";import{Markdown as j}from"../Markdown/index.js";import{styled as t}from"../../styled-components.js";import{ServerDescriptionTooltip as D}from"./ServerDescriptionTooltip.js";const A=({servers:v,path:f="",translate:n})=>i($,{children:v.map(e=>{const s=e.url+f,d=Object.keys(e.variables||{}).length,c=d===1?"variable":"variables",m=`${d||""} ${n(`openapi.${c}`,c)}`,b=!!e.name&&!!e.description;return o("div",{children:[o(W,{children:[o(h,{"data-testid":"server-panel-item-name",children:[w(e),e["x-isLive"]&&o(l,{className:"tag-green",children:[i(y,{}),"Live"]})]}),b&&i(D,{description:e.description}),e["x-labels"]?.length&&i(h,{style:{margin:"var(--spacing-xs) 0"},children:e["x-labels"]?.map(r=>o(l,{className:`tag-${r.color}`,children:[r.label,": ",r.value]},r.value))})||null]}),o(I,{children:[i(S,{suppressHydrationWarning:!0,children:s}),i(u,{data:s},s)]}),e.variables&&i(T,{expandText:`${n("openapi.actions.show","Show")} ${m}`,hideText:`${n("openapi.actions.hide","Hide")} ${m}`,expandByDefault:!1,expandable:!0,hideDivider:!0,children:i(z,{children:Object.entries(e.variables||{}).map(([r,a])=>o(k,{children:[i(C,{children:r}),o(p,{children:[n("openapi.default","Default")," ",i(x,{children:a.default})]}),i(L,{source:a.description}),a.enum&&o(p,{children:[n("openapi.enum","Enum")," ",i(N,{children:a.enum.map(g=>i(x,{children:g},g))})]})]},r))})})]},e.url)})}),$=t.div`
|
|
2
2
|
& > div {
|
|
3
3
|
border-bottom: 1px solid var(--border-color-secondary);
|
|
4
4
|
margin-bottom: var(--spacing-xs);
|
|
@@ -10,7 +10,7 @@ import{jsx as i,jsxs as o}from"react/jsx-runtime";import{CopyButton as x}from"@r
|
|
|
10
10
|
margin-bottom: 0;
|
|
11
11
|
padding-bottom: 0;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
`,z=t.div`
|
|
14
14
|
padding-left: var(--spacing-xxs);
|
|
15
15
|
& > div {
|
|
16
16
|
border-bottom: 1px solid var(--border-color-secondary);
|
|
@@ -28,37 +28,37 @@ import{jsx as i,jsxs as o}from"react/jsx-runtime";import{CopyButton as x}from"@r
|
|
|
28
28
|
margin-bottom: 0;
|
|
29
29
|
padding-bottom: 0;
|
|
30
30
|
}
|
|
31
|
-
`,
|
|
31
|
+
`,k=t.div`
|
|
32
32
|
display: flex;
|
|
33
33
|
flex-direction: column;
|
|
34
34
|
flex-wrap: wrap;
|
|
35
|
-
`,
|
|
35
|
+
`,L=t(j)`
|
|
36
36
|
font-size: var(--font-size-sm);
|
|
37
37
|
line-height: var(--line-height-sm);
|
|
38
38
|
color: var(--text-color-primary);
|
|
39
|
-
`,
|
|
39
|
+
`,p=t.span`
|
|
40
40
|
display: flex;
|
|
41
41
|
gap: var(--spacing-xxs);
|
|
42
42
|
font-size: var(--font-size-sm);
|
|
43
43
|
line-height: var(--line-height-sm);
|
|
44
44
|
color: var(--text-color-primary);
|
|
45
|
-
`,
|
|
45
|
+
`,C=t(p)`
|
|
46
46
|
padding-bottom: var(--spacing-xxs);
|
|
47
47
|
font-weight: var(--font-weight-semibold);
|
|
48
|
-
`,
|
|
48
|
+
`,N=t.span`
|
|
49
49
|
display: flex;
|
|
50
50
|
gap: var(--spacing-xxs);
|
|
51
51
|
flex-wrap: wrap;
|
|
52
|
-
`,
|
|
52
|
+
`,x=t(l)`
|
|
53
53
|
font-size: var(--font-size-sm);
|
|
54
54
|
line-height: var(--line-height-sm);
|
|
55
|
-
`,
|
|
55
|
+
`,W=t.div`
|
|
56
56
|
display: flex;
|
|
57
57
|
justify-content: start;
|
|
58
58
|
align-items: center;
|
|
59
59
|
gap: var(--spacing-xxs);
|
|
60
|
-
`,
|
|
60
|
+
`,I=t.div`
|
|
61
61
|
display: flex;
|
|
62
62
|
justify-content: space-between;
|
|
63
63
|
align-items: center;
|
|
64
|
-
`;export{
|
|
64
|
+
`;export{A as ServerList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as S}from"react/jsx-runtime";import{useMemo as g,useCallback as a}from"react";import{useAtom as w,useAtomValue as y}from"jotai";import{DropdownMenu as A}from"@redocly/theme/components/Dropdown/DropdownMenu";import{Dropdown as C}from"@redocly/theme/components/Dropdown/Dropdown";import{getOperationColor as b}from"@redocly/theme/core/openapi";import{HttpVerb as k}from"../common/index.js";import{PathWrapper as j,Path as P,StyledCopyButton as V,StyledDropdownMenuItem as x}from"./styled.js";import{PanelItem as D}from"../PanelItem/index.js";import{joinWithSeparator as M}from"../../services/index.js";import{getServerDisplayName as E,replaceVariables as p}from"../../utils/index.js";import{environmentAtom as N}from"../../jotai/app.js";import{useActiveWithFallback as O,useTelemetry as W}from"../../hooks/index.js";import{getServerEnvName as h}from"../../utils/environments.js";import{createTargetServerSwitchEvent as _}from"../../events/index.js";import{globalStoreAtom as I}from"../../jotai/store.js";const $=({operation:r,className:d})=>{const m=W(),[[v],n]=w(N),{options:{events:i}}=y(I),s=O(r.servers.map(t=>({...t,key:t.url})),v.server),c=a(t=>{t.stopPropagation()},[]),l=a(t=>()=>{if(r.servers.length!==1&&(n({environment:h(t)}),m.sendSwitchServersClickedMessage([{object:"switch_servers",server:h(t)}]),i?.targetServerSwitch&&t)){const o=_({operation:r,serverUrl:t.url});i.targetServerSwitch(o)}},[r,n,m,i]),u=g(()=>r.servers.map(t=>{const o=r.isRpc?p(t):M(p(t),r.path);return e(x,{onAction:l(t),children:e(D,{header:E(t),title:o,actions:[e(V,{data:o,toasterPlacement:"left",onCopyClick:c},o)],active:t.url===s,withCheckmark:!0})},o)}),[r.servers,r.isRpc,r.path,l,c,s]),f=b({isAdditionalOperation:r.isAdditionalOperation,httpVerb:r.httpVerb});return e(C,{className:d,trigger:S(j,{variant:"ghost",children:[e(k,{color:f,children:r.httpVerb}),e(P,{children:r.path})]}),withArrow:!0,children:e(A,{children:u})})};export{$ as ServerListDropdown};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
type Breadcrumb = {
|
|
3
|
+
name: string;
|
|
4
|
+
href: string;
|
|
5
|
+
};
|
|
6
|
+
type BreadcrumbsProps = {
|
|
7
|
+
breadcrumbs: Breadcrumb[];
|
|
8
|
+
onClick: (href: string) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare function Breadcrumbs({ breadcrumbs, onClick }: BreadcrumbsProps): ReactElement | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import{jsx as n,Fragment as p,jsxs as h}from"react/jsx-runtime";import w,{useRef as x,useState as L,useMemo as b,useCallback as B,useLayoutEffect as k}from"react";import{Dropdown as E}from"@redocly/theme/components/Dropdown/Dropdown";import{DropdownMenu as M}from"@redocly/theme/components/Dropdown/DropdownMenu";import{DropdownMenuItem as C}from"@redocly/theme/components/Dropdown/DropdownMenuItem";import{Tooltip as T}from"@redocly/theme/components/Tooltip/Tooltip";import{trimText as y}from"@redocly/theme/core/openapi";import{styled as s}from"../../styled-components.js";import{calculateMaxLength as D}from"../../utils/calculateMaxLength.js";const R=25,_=3,u=({breadcrumb:e,onClick:t,maxLength:r})=>{const o=e.name.length>r,i=y(e.name,r);return n(T,{tip:e.name,placement:"bottom",disabled:!o,children:n(v,{onClick:()=>t(e.href),children:i})})},z=({breadcrumbs:e,onClick:t,maxLength:r})=>{const o=e[0],i=e[e.length-1],d=e.slice(1,-1);return h(p,{children:[n(u,{breadcrumb:o,onClick:t,maxLength:r}),n(g,{children:"/"}),n(E,{trigger:n(O,{children:"..."}),closeOnClick:!0,alignment:"end",children:n(M,{children:d.map(a=>n(C,{onAction:()=>t(a.href),children:a.name},a.href))})}),n(g,{children:"/"}),n(u,{breadcrumb:i,onClick:t,maxLength:r})]})},F=({breadcrumbs:e,onClick:t,maxLength:r})=>n(p,{children:e.map((o,i)=>h(w.Fragment,{children:[n(u,{breadcrumb:o,onClick:t,maxLength:r}),i!==e.length-1&&n(g,{children:"/"})]},o.href))});function q({breadcrumbs:e,onClick:t}){const r=x(null),o=x(null),[i,d]=L(R),a=e.length>_,f=b(()=>a?[e[0],e[e.length-1]]:e,[e,a]),m=B(()=>{if(!r.current?.parentElement||!o.current)return;const c=r.current.parentElement.clientWidth,l=D(f,c,a,o.current);d(l)},[f,a]);return k(()=>{m();const c=new ResizeObserver(m),l=r.current?.parentElement;return l&&c.observe(l),()=>{c.disconnect()}},[m]),e.length?h(p,{children:[n(j,{ref:o,"aria-hidden":"true"}),n(A,{ref:r,"data-component-name":"TagItem/Breadcrumbs",children:a?n(z,{breadcrumbs:e,onClick:t,maxLength:i}):n(F,{breadcrumbs:e,onClick:t,maxLength:i})})]}):null}const j=s.span`
|
|
2
|
+
position: absolute;
|
|
3
|
+
visibility: hidden;
|
|
4
|
+
white-space: nowrap;
|
|
5
|
+
`,A=s.div`
|
|
6
|
+
position: absolute;
|
|
7
|
+
top: -26px;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
flex-wrap: nowrap;
|
|
11
|
+
gap: calc(var(--breadcrumbs-gap) / 2);
|
|
12
|
+
margin-bottom: var(--spacing-xxs);
|
|
13
|
+
max-width: 100%;
|
|
14
|
+
`,v=s.button`
|
|
15
|
+
background: none;
|
|
16
|
+
border: none;
|
|
17
|
+
margin: 0;
|
|
18
|
+
font-size: var(--font-size-sm);
|
|
19
|
+
color: var(--breadcrumbs-text-color);
|
|
20
|
+
border-radius: var(--border-radius);
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
padding: 1px calc(var(--spacing-xxs) / 2);
|
|
23
|
+
line-height: var(--line-height-sm);
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
text-overflow: ellipsis;
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
flex: 0 1 auto;
|
|
28
|
+
min-width: 0;
|
|
29
|
+
|
|
30
|
+
&:hover {
|
|
31
|
+
background-color: var(--breadcrumbs-background-color-hover);
|
|
32
|
+
}
|
|
33
|
+
`,g=s.span`
|
|
34
|
+
line-height: var(--line-height-sm);
|
|
35
|
+
padding: 0 calc(var(--spacing-xxs) / 2);
|
|
36
|
+
color: var(--breadcrumbs-text-color);
|
|
37
|
+
font-size: var(--font-size-sm);
|
|
38
|
+
`,O=s(v)`
|
|
39
|
+
text-align: center;
|
|
40
|
+
overflow: visible;
|
|
41
|
+
`;export{q as Breadcrumbs};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { TFunction } from '@redocly/theme/core/openapi';
|
|
2
2
|
import type { OperationsNavigationProps } from './types.js';
|
|
3
3
|
type OperationNavigationItemsProps = OperationsNavigationProps & {
|
|
4
|
-
title
|
|
4
|
+
title?: string;
|
|
5
5
|
onClick: (link: string) => void;
|
|
6
6
|
translate: TFunction;
|
|
7
|
+
disableTooltip?: boolean;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
+
declare function OperationNavigationItemsComponent({ title, items, onClick, routingBasePath, translate, disableTooltip, }: OperationNavigationItemsProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const OperationNavigationItems: import("react").MemoExoticComponent<typeof OperationNavigationItemsComponent>;
|
|
9
11
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r,jsxs as s,Fragment as x}from"react/jsx-runtime";import{memo as y}from"react";import{GenericIcon as w}from"@redocly/theme/icons/GenericIcon/GenericIcon";import{DirectionRightIcon as I}from"@redocly/theme/icons/DirectionRightIcon/DirectionRightIcon";import{getOperationColor as j}from"@redocly/theme/core/openapi";import{Tooltip as k}from"@redocly/theme/components/Tooltip/Tooltip";import{joinWithSeparator as z}from"../../services/index.js";import{encodeBackSlashes as O}from"../../utils/index.js";import{HttpVerb as V,NavigationBadge as d}from"../common/index.js";import{styled as o}from"../../styled-components.js";import{StyledButton as B}from"./styled.js";function C({verb:e,deprecated:t,isAdditionalOperation:n}){const i=j({httpVerb:e,deprecated:t,isAdditionalOperation:n});return r(V,{color:i,children:e})}function H(e){if(e.type==="tag")return r(F,{children:r(I,{size:"12px"})});const t=e.type==="operation"?e.httpVerb:e.type;return C({verb:t,deprecated:e.deprecated,isAdditionalOperation:e.isAdditionalOperation})}function N(e){return e.type==="operation"?e.path:e.name}function S({title:e,items:t,onClick:n,routingBasePath:i,translate:l,disableTooltip:h}){return s(x,{children:[e&&r(_,{children:e}),t.map(a=>{const{id:g,href:f,name:m,deprecated:v,badges:b}=a;return r(k,{tip:m,placement:"left",disabled:h,children:r(A,{variant:"outlined",size:"large",onClick:()=>n(z(i,O(f))),children:s("span",{children:[H(a),r(D,{children:N(a)}),v&&r(d,{deprecated:!0,children:l("openapi.badges.deprecated","Deprecated")}),b?.map(({name:p,color:u,icon:c})=>r(d,{color:u,icon:c&&r(w,{icon:c}),children:p},p))]})})},g)})]})}const Q=y(S),_=o.span`
|
|
2
2
|
font-size: var(--font-size-base);
|
|
3
3
|
line-height: var(--line-height-base);
|
|
4
4
|
font-weight: var(--font-weight-bold);
|
|
5
5
|
color: var(--text-color-primary);
|
|
6
6
|
margin: var(--spacing-sm) 0 var(--spacing-xxs) 0;
|
|
7
|
-
`,
|
|
7
|
+
`,A=o(B)`
|
|
8
8
|
border-radius: var(--border-radius);
|
|
9
9
|
background: var(--bg-color);
|
|
10
10
|
justify-content: space-between;
|
|
@@ -12,7 +12,7 @@ import{jsx as e,jsxs as s,Fragment as w}from"react/jsx-runtime";import{memo as j
|
|
|
12
12
|
|
|
13
13
|
& > span {
|
|
14
14
|
display: flex;
|
|
15
|
-
align-items:
|
|
15
|
+
align-items: center;
|
|
16
16
|
gap: var(--spacing-unit);
|
|
17
17
|
overflow-x: hidden;
|
|
18
18
|
}
|
|
@@ -25,7 +25,7 @@ import{jsx as e,jsxs as s,Fragment as w}from"react/jsx-runtime";import{memo as j
|
|
|
25
25
|
content: '→';
|
|
26
26
|
line-height: var(--line-height-base);
|
|
27
27
|
}
|
|
28
|
-
`,
|
|
28
|
+
`,D=o.span`
|
|
29
29
|
font-family: var(--font-family-base);
|
|
30
30
|
font-size: var(--font-size-base);
|
|
31
31
|
line-height: var(--line-height-base);
|
|
@@ -34,4 +34,19 @@ import{jsx as e,jsxs as s,Fragment as w}from"react/jsx-runtime";import{memo as j
|
|
|
34
34
|
white-space: nowrap;
|
|
35
35
|
text-overflow: ellipsis;
|
|
36
36
|
overflow-x: hidden;
|
|
37
|
-
|
|
37
|
+
`,F=o.div`
|
|
38
|
+
width: 20px;
|
|
39
|
+
height: 20px;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-shrink: 0;
|
|
45
|
+
background-color: var(--layer-color-hover);
|
|
46
|
+
margin-right: var(--spacing-unit);
|
|
47
|
+
|
|
48
|
+
& > svg {
|
|
49
|
+
height: 12px;
|
|
50
|
+
width: 12px;
|
|
51
|
+
}
|
|
52
|
+
`;export{Q as OperationNavigationItems};
|