@redocly/openapi-docs 3.0.0-alpha.55.patch.0 → 3.0.0-alpha.56
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/console.redocly-openapi-docs.min.js +28 -18
- package/dist/oauth2-redirect.js +1 -1
- package/dist/redocly-openapi-docs.min.js +4716 -5379
- package/lib/components/Callbacks/CallbackSummary.js +1 -1
- package/lib/components/Download/DownloadButtonWithLabel.js +14 -6
- package/lib/components/DropdownOrLabel/DropdownOrLabel.js +3 -3
- package/lib/components/Endpoint/Endpoint.js +1 -1
- package/lib/components/Endpoint/Summary.js +1 -1
- package/lib/components/Endpoint/styled.js +2 -2
- package/lib/components/NextSectionButton/NextSectionButton.js +1 -1
- package/lib/components/Panel/CodeHeader.js +2 -2
- package/lib/components/Panel/CodePanel.js +5 -1
- package/lib/components/Parameters/ParametersGroup.js +1 -1
- package/lib/components/RedoclyOpenAPIDocs/styled.js +1 -1
- package/lib/components/Search/styled.js +1 -3
- package/lib/components/SecurityRequirement/RequirementElement.js +1 -1
- package/lib/components/SecurityRequirement/SecurityRequirement.js +1 -1
- package/lib/components/SideMenu/MenuItem.js +1 -1
- package/lib/components/SideMenu/MenuOperationItemContent.js +1 -1
- package/lib/components/SourceCodeWithFile/SourceCodeWithFile.js +1 -1
- package/lib/components/StickySidebar/StickyResponsiveSidebar.js +2 -2
- package/lib/components/Tabs/CollapsingTabs/CollapsingTabList.js +2 -10
- package/lib/components/Tabs/Tab.js +12 -8
- package/lib/components/common/CheckboxList.js +3 -3
- package/lib/components/common/Dropdown/Dropdown.js +3 -3
- package/lib/components/common/Dropdown/styled.js +21 -10
- package/lib/components/common/Dropdown/types.d.ts +1 -0
- package/lib/components/common/Fields/fields-layout.js +3 -3
- package/lib/components/common/Fields/fields.js +7 -7
- package/lib/components/common/form.js +4 -4
- package/lib/components/common/headers.js +1 -1
- package/lib/components/common/panels.js +1 -1
- package/lib/components/icons/LinkIcon.js +1 -1
- package/lib/components/pluggable/styled.components.js +0 -1
- package/lib/components/rightPanel/ActionPanel.js +1 -1
- package/lib/components/rightPanel/CodemirrorInput/styled.js +3 -3
- package/lib/components/rightPanel/ConsoleTabs/styled.js +16 -6
- package/lib/components/rightPanel/OAuth2Flow/OAuth2Flow.js +1 -1
- package/lib/components/rightPanel/ParameterArray.js +1 -1
- package/lib/components/rightPanel/ResponsePanel.js +1 -1
- package/lib/components/rightPanel/TryItPanel.js +3 -3
- package/lib/components/rightPanel/styled.js +4 -3
- package/lib/components/shared/HttpVerb.d.ts +6 -2
- package/lib/components/shared/HttpVerb.js +3 -2
- package/lib/components/shared/MimeLabel.js +3 -5
- package/lib/components/shared/NoSampleLabel.js +1 -1
- package/lib/events/types.d.ts +6 -5
- package/lib/events/types.js +1 -1
- package/lib-esm/components/Callbacks/CallbackSummary.js +1 -1
- package/lib-esm/components/Download/DownloadButtonWithLabel.js +14 -6
- package/lib-esm/components/DropdownOrLabel/DropdownOrLabel.js +1 -1
- package/lib-esm/components/Endpoint/Endpoint.js +1 -1
- package/lib-esm/components/Endpoint/Summary.js +1 -1
- package/lib-esm/components/Endpoint/styled.js +2 -2
- package/lib-esm/components/NextSectionButton/NextSectionButton.js +1 -1
- package/lib-esm/components/Panel/CodeHeader.js +2 -2
- package/lib-esm/components/Panel/CodePanel.js +5 -1
- package/lib-esm/components/Parameters/ParametersGroup.js +1 -1
- package/lib-esm/components/RedoclyOpenAPIDocs/styled.js +1 -1
- package/lib-esm/components/Search/styled.js +1 -3
- package/lib-esm/components/SecurityRequirement/RequirementElement.js +1 -1
- package/lib-esm/components/SecurityRequirement/SecurityRequirement.js +1 -1
- package/lib-esm/components/SideMenu/MenuItem.js +1 -1
- package/lib-esm/components/SideMenu/MenuOperationItemContent.js +2 -2
- package/lib-esm/components/SourceCodeWithFile/SourceCodeWithFile.js +1 -1
- package/lib-esm/components/StickySidebar/StickyResponsiveSidebar.js +3 -3
- package/lib-esm/components/Tabs/CollapsingTabs/CollapsingTabList.js +1 -9
- package/lib-esm/components/Tabs/Tab.js +11 -7
- package/lib-esm/components/common/CheckboxList.js +3 -3
- package/lib-esm/components/common/Dropdown/Dropdown.js +2 -2
- package/lib-esm/components/common/Dropdown/styled.js +20 -9
- package/lib-esm/components/common/Dropdown/types.d.ts +1 -0
- package/lib-esm/components/common/Fields/fields-layout.js +2 -2
- package/lib-esm/components/common/Fields/fields.js +4 -4
- package/lib-esm/components/common/form.js +4 -4
- package/lib-esm/components/common/headers.js +1 -1
- package/lib-esm/components/common/panels.js +1 -1
- package/lib-esm/components/icons/LinkIcon.js +1 -1
- package/lib-esm/components/pluggable/styled.components.js +0 -1
- package/lib-esm/components/rightPanel/ActionPanel.js +1 -1
- package/lib-esm/components/rightPanel/CodemirrorInput/styled.js +3 -3
- package/lib-esm/components/rightPanel/ConsoleTabs/styled.js +15 -5
- package/lib-esm/components/rightPanel/OAuth2Flow/OAuth2Flow.js +1 -1
- package/lib-esm/components/rightPanel/ParameterArray.js +1 -1
- package/lib-esm/components/rightPanel/ResponsePanel.js +2 -2
- package/lib-esm/components/rightPanel/TryItPanel.js +3 -3
- package/lib-esm/components/rightPanel/styled.js +4 -3
- package/lib-esm/components/shared/HttpVerb.d.ts +6 -2
- package/lib-esm/components/shared/HttpVerb.js +3 -2
- package/lib-esm/components/shared/MimeLabel.js +2 -4
- package/lib-esm/components/shared/NoSampleLabel.js +1 -1
- package/lib-esm/events/types.d.ts +6 -5
- package/lib-esm/events/types.js +1 -1
- package/package.json +2 -2
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import{Tab as ReactTab}from"react-tabs";import styled from"styled-components";export const Tab=styled(ReactTab)`
|
|
2
2
|
flex: 1;
|
|
3
|
-
display: flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
justify-content: center;
|
|
6
3
|
cursor: pointer;
|
|
7
|
-
padding:
|
|
4
|
+
padding: 5px 10px;
|
|
8
5
|
font-size: var(--panel-samples-tabs-font-size);
|
|
9
6
|
line-height: 26px;
|
|
10
7
|
font-weight: var(--panel-samples-tabs-font-weight);
|
|
11
8
|
text-align: center;
|
|
12
9
|
color: var(--panel-samples-tabs-text-color);
|
|
13
10
|
background-color: var(--panel-samples-tabs-background-color);
|
|
14
|
-
border-
|
|
11
|
+
border-bottom: 4px solid var(--panel-samples-tabs-border-color);
|
|
12
|
+
margin-bottom: -4px;
|
|
15
13
|
|
|
16
14
|
&:hover {
|
|
17
15
|
border-color: var(--panel-samples-tabs-hover-border-color);
|
|
18
16
|
background-color: var(--panel-samples-tabs-hover-background-color);
|
|
19
|
-
color: var(--panel-samples-tabs-hover-text-color);
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
&.react-tabs__tab--selected {
|
|
23
20
|
background-color: var(--panel-samples-tabs-active-background-color);
|
|
24
21
|
border-color: var(--panel-samples-tabs-active-border-color);
|
|
25
|
-
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:first-child {
|
|
25
|
+
border-top-left-radius: var(--border-radius);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:last-child {
|
|
29
|
+
border-top-right-radius: var(--border-radius);
|
|
26
30
|
}
|
|
27
31
|
`;
|
|
28
32
|
//# sourceMappingURL=Tab.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{asField}from"informed";import{CodeBlockControls,CodeBlockControlButton}from"@redocly/theme";import React,{useState}from"react";import styled from"styled-components";import{FormError}from"./form";import{Checkbox}from"./Checkbox";const DEFAULT_MAX_ITEMS=11;export const CheckboxListComponent=({items:e,fieldApi:t,validateOnChange:o,maxDisplayedItems:l,showControls:r,trimItemsLength:c})=>{const[a,
|
|
1
|
+
import{asField}from"informed";import{CodeBlockControls,CodeBlockControlButton}from"@redocly/theme";import React,{useState}from"react";import styled from"styled-components";import{FormError}from"./form";import{Checkbox}from"./Checkbox";const DEFAULT_MAX_ITEMS=11;export const CheckboxListComponent=({items:e,fieldApi:t,validateOnChange:o,maxDisplayedItems:l,showControls:r,trimItemsLength:c})=>{const[a,n]=useState(!0),s=e=>t.getValue().includes(e),i=t.getError(),d=l||11,m=c&&a?e.slice(0,d):e;return React.createElement("div",null,r?React.createElement(CodeBlockControls,{controls:{select:{onClick:()=>{t.setValue(e)},label:"Select all",tooltipText:"Select all checkboxes"},deselect:{onClick:()=>{t.setValue([])},label:"Deselect all",tooltipText:"Deselect all checkboxes"}}}):null,React.createElement(ListWrapper,null,m.map((e=>React.createElement(Checkbox,{fullWidth:!0,id:e,value:e,checked:s(e),label:e,key:e,onChange:e=>{(e=>{const o=e.target.value,l=e.target.checked;t.setTouched(!0);const r=t.getValue()||[];let c;if(l)c=[...r,o];else{const e=r.indexOf(o);c=[...r.slice(0,e),...r.slice(e+1)]}t.setValue(c)})(e),o&&t.validate()}}))),e.length>d&&c?React.createElement(ToggleButton,{onClick:()=>{n((e=>!e))}},a?"Show all":"Collapse"):null),i?React.createElement(FormError,null,i):"")};export const CheckboxList=asField(CheckboxListComponent);const ListWrapper=styled.div`
|
|
2
2
|
padding: 10px;
|
|
3
|
-
|
|
4
|
-
border-radius: 0 0 var(--border-radius
|
|
3
|
+
background-color: var(--panel-samples-input-background-color);
|
|
4
|
+
border-radius: 0 0 var(--border-radius) var(--border-radius);
|
|
5
5
|
`,ToggleButton=styled(CodeBlockControlButton)`
|
|
6
6
|
float: right;
|
|
7
7
|
`;
|
|
@@ -10,7 +10,7 @@ import React,{memo,useMemo}from"react";import styled from"styled-components";imp
|
|
|
10
10
|
margin: auto;
|
|
11
11
|
text-align: center;
|
|
12
12
|
polyline {
|
|
13
|
-
color:
|
|
13
|
+
color: ${e=>"dark"===e.variant&&"white"};
|
|
14
14
|
}
|
|
15
|
-
`,DropdownComponent=({options:e,onChange:t,handleClear:o,clearable:n,placeholder:
|
|
15
|
+
`,DropdownComponent=({options:e,onChange:t,handleClear:o,clearable:n,placeholder:a,value:r="",className:l,variant:s="light"})=>{var i;const c=useMemo((()=>e.map((({idx:e,value:t,title:o},n)=>{const a=normalizeText(t);return React.createElement("option",{key:e||a+n,value:a,className:"dropdown-option"},o||a)}))),[e]),m=normalizeText(r),d=(null===(i=e.find((e=>e.value===r)))||void 0===i?void 0:i.title)||m;return React.createElement("div",{className:l+" dropdown-wrapper"},React.createElement(ArrowIcon,{variant:s}),n&&(null==m?void 0:m.length)>0&&React.createElement(ClearButton,{handleClear:o}),React.createElement("select",{onChange:o=>{const{selectedIndex:n}=o.target;t(e[a||!r?n-1:n])},value:m,className:"dropdown-select"},a&&React.createElement("option",{disabled:!0,hidden:!0,value:a},a),!m&&!a&&React.createElement("option",{disabled:!0}),c),React.createElement("label",null,d))};export const Dropdown=memo(DropdownComponent);
|
|
16
16
|
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -6,12 +6,14 @@ import styled,{css}from"styled-components";import{Dropdown as DropdownComponent}
|
|
|
6
6
|
&,
|
|
7
7
|
&:hover,
|
|
8
8
|
&:focus-within {
|
|
9
|
+
border: none;
|
|
9
10
|
box-shadow: none;
|
|
10
11
|
}
|
|
11
12
|
`;export const Dropdown=styled(DropdownComponent)`
|
|
12
13
|
box-sizing: border-box;
|
|
13
14
|
outline: none;
|
|
14
15
|
display: inline-block;
|
|
16
|
+
border-radius: var(--border-radius);
|
|
15
17
|
vertical-align: bottom;
|
|
16
18
|
position: relative;
|
|
17
19
|
width: ${({fullWidth:o})=>o?"100%":"auto"};
|
|
@@ -23,10 +25,10 @@ import styled,{css}from"styled-components";import{Dropdown as DropdownComponent}
|
|
|
23
25
|
min-width: 90px;
|
|
24
26
|
height: 36px;
|
|
25
27
|
outline: none;
|
|
26
|
-
display:
|
|
27
|
-
align-items: center;
|
|
28
|
+
display: inline-block;
|
|
28
29
|
color: var(--docs-dropdown-text-color);
|
|
29
|
-
border-radius: var(--border-radius
|
|
30
|
+
border-radius: var(--border-radius);
|
|
31
|
+
border: var(--docs-dropdown-border);
|
|
30
32
|
padding: var(--docs-dropdown-padding);
|
|
31
33
|
vertical-align: bottom;
|
|
32
34
|
width: ${({fullWidth:o})=>o?"100%":"auto"};
|
|
@@ -41,6 +43,7 @@ import styled,{css}from"styled-components";import{Dropdown as DropdownComponent}
|
|
|
41
43
|
&,
|
|
42
44
|
&:hover,
|
|
43
45
|
&:focus-within {
|
|
46
|
+
border: 1px solid var(--border-color);
|
|
44
47
|
box-shadow: none;
|
|
45
48
|
}
|
|
46
49
|
|
|
@@ -58,7 +61,7 @@ import styled,{css}from"styled-components";import{Dropdown as DropdownComponent}
|
|
|
58
61
|
appearance: none;
|
|
59
62
|
cursor: pointer;
|
|
60
63
|
|
|
61
|
-
color: var(--text-
|
|
64
|
+
color: var(--text-color);
|
|
62
65
|
line-height: inherit;
|
|
63
66
|
font-size: 14px;
|
|
64
67
|
font-family: inherit;
|
|
@@ -72,6 +75,7 @@ import styled,{css}from"styled-components";import{Dropdown as DropdownComponent}
|
|
|
72
75
|
}
|
|
73
76
|
label {
|
|
74
77
|
padding: 0 26px 0 4px;
|
|
78
|
+
border: none;
|
|
75
79
|
background: transparent;
|
|
76
80
|
font-size: 14px;
|
|
77
81
|
font-weight: 400;
|
|
@@ -80,6 +84,7 @@ import styled,{css}from"styled-components";import{Dropdown as DropdownComponent}
|
|
|
80
84
|
|
|
81
85
|
&:hover,
|
|
82
86
|
&:focus-within {
|
|
87
|
+
border: none;
|
|
83
88
|
box-shadow: none;
|
|
84
89
|
}
|
|
85
90
|
}
|
|
@@ -91,16 +96,22 @@ import styled,{css}from"styled-components";import{Dropdown as DropdownComponent}
|
|
|
91
96
|
label {
|
|
92
97
|
${darkDropdownStyle};
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
|
|
99
|
+
height: 40px;
|
|
100
|
+
border-radius: 0 var(--border-radius) 0 0;
|
|
101
|
+
margin: 0 0 -4px;
|
|
96
102
|
transition: none;
|
|
97
103
|
min-width: auto;
|
|
98
|
-
background
|
|
104
|
+
background: ${({active:o})=>o?"var(--panel-samples-tabs-active-background-color)":"none"};
|
|
99
105
|
& {
|
|
106
|
+
border-bottom: 4px solid
|
|
107
|
+
${({active:o})=>o?"var(--panel-samples-tabs-active-border-color)":"transparent"};
|
|
108
|
+
|
|
100
109
|
&[open],
|
|
101
110
|
&:focus-within,
|
|
102
111
|
&:hover {
|
|
103
|
-
background
|
|
112
|
+
background: var(--border-color-secondary);
|
|
113
|
+
border-bottom: 4px solid
|
|
114
|
+
${({active:o})=>o?"var( --panel-samples-tabs-active-border-color)":"transparent"};
|
|
104
115
|
}
|
|
105
116
|
}
|
|
106
117
|
}
|
|
@@ -109,7 +120,7 @@ import styled,{css}from"styled-components";import{Dropdown as DropdownComponent}
|
|
|
109
120
|
label {
|
|
110
121
|
width: 100%;
|
|
111
122
|
font-weight: 600;
|
|
112
|
-
color: var(--text-
|
|
123
|
+
color: var(--text-color);
|
|
113
124
|
}
|
|
114
125
|
`;export const SchemaDiscriminatorDropdown=styled(Dropdown)`
|
|
115
126
|
.dropdown-select {
|
|
@@ -2,7 +2,7 @@ import styled,{css}from"styled-components";import{typography}from"../../../utils
|
|
|
2
2
|
text-align: right;
|
|
3
3
|
font-size: 0.9em;
|
|
4
4
|
font-weight: normal;
|
|
5
|
-
color: var(--text-secondary);
|
|
5
|
+
color: var(--text-color-secondary);
|
|
6
6
|
`;const repeatingGradient=css`
|
|
7
7
|
repeating-linear-gradient(0deg,
|
|
8
8
|
var(--schemas-lines-color),
|
|
@@ -122,7 +122,7 @@ import styled,{css}from"styled-components";import{typography}from"../../../utils
|
|
|
122
122
|
min-width: 200px;
|
|
123
123
|
|
|
124
124
|
${({theme:e})=>e.mediaQueries.small} {
|
|
125
|
-
border-bottom: 1px solid var(--border-
|
|
125
|
+
border-bottom: 1px solid var(--border-color);
|
|
126
126
|
border-left: none;
|
|
127
127
|
padding: 10px 0;
|
|
128
128
|
}
|
|
@@ -5,7 +5,7 @@ import styled,{css}from"styled-components";import{typography}from"../../../utils
|
|
|
5
5
|
outline: 0;
|
|
6
6
|
cursor: pointer;
|
|
7
7
|
padding: 0 10px 0 0;
|
|
8
|
-
color: var(--text-
|
|
8
|
+
color: var(--text-color);
|
|
9
9
|
&:focus {
|
|
10
10
|
font-weight: var(--font-weight-bold);
|
|
11
11
|
}
|
|
@@ -40,7 +40,7 @@ import styled,{css}from"styled-components";import{typography}from"../../../utils
|
|
|
40
40
|
color: var(--schema-type-title-text-color);
|
|
41
41
|
word-break: break-word;
|
|
42
42
|
`;export const TypeFormat=TypeName;export const PropertyLabel=styled(FieldLabel.withComponent("div"))`
|
|
43
|
-
color: var(--text-secondary);
|
|
43
|
+
color: var(--text-color-secondary);
|
|
44
44
|
font-size: var(--schema-labels-font-size);
|
|
45
45
|
font-weight: normal;
|
|
46
46
|
line-height: 1;
|
|
@@ -97,11 +97,11 @@ import styled,{css}from"styled-components";import{typography}from"../../../utils
|
|
|
97
97
|
`;export const PatternLabel=styled(ConstraintItem)``;export const ToggleButton=styled.button`
|
|
98
98
|
background-color: transparent;
|
|
99
99
|
border: 0;
|
|
100
|
-
color: var(--text-secondary);
|
|
100
|
+
color: var(--text-color-secondary);
|
|
101
101
|
margin-left: var(--spacing-unit);
|
|
102
102
|
border-radius: var(--border-radius);
|
|
103
103
|
cursor: pointer;
|
|
104
|
-
outline-color: var(--text-secondary);
|
|
104
|
+
outline-color: var(--text-color-secondary);
|
|
105
105
|
font-size: 12px;
|
|
106
106
|
`;
|
|
107
107
|
//# sourceMappingURL=fields.js.map
|
|
@@ -30,18 +30,18 @@ import styled,{css}from"styled-components";export const Table=styled.div`
|
|
|
30
30
|
display: inline-block;
|
|
31
31
|
content: '*';
|
|
32
32
|
margin-left: 4px;
|
|
33
|
-
color: var(--color-error);
|
|
33
|
+
color: var(--color-error-500);
|
|
34
34
|
}
|
|
35
35
|
`}
|
|
36
36
|
`;export const FormError=styled.div`
|
|
37
|
-
color: var(--color-error);
|
|
37
|
+
color: var(--color-error-500);
|
|
38
38
|
font-size: 0.9em;
|
|
39
39
|
& pre {
|
|
40
40
|
word-break: break-word;
|
|
41
41
|
white-space: pre-wrap;
|
|
42
42
|
}
|
|
43
43
|
`;export const FormWarning=styled.div`
|
|
44
|
-
color: var(--color-warning);
|
|
44
|
+
color: var(--color-warning-500);
|
|
45
45
|
font-size: 0.9em;
|
|
46
46
|
`;function placeholder(o,e){let t="";for(let r=0;r<o;r++)t+=e;return'"'+t+'"'}export const TokenField=styled.div`
|
|
47
47
|
position: relative;
|
|
@@ -55,7 +55,7 @@ import styled,{css}from"styled-components";export const Table=styled.div`
|
|
|
55
55
|
padding: 0 5px;
|
|
56
56
|
cursor: pointer;
|
|
57
57
|
`;export const TokenClear=styled(TokenShowHide)`
|
|
58
|
-
color: var(--color-error);
|
|
58
|
+
color: var(--color-error-500);
|
|
59
59
|
`;export const FormHeader=styled.div`
|
|
60
60
|
font-weight: bold;
|
|
61
61
|
font-size: 1.2em;
|
|
@@ -3,7 +3,7 @@ import styled from"styled-components";import{typography}from"../../utils";export
|
|
|
3
3
|
|
|
4
4
|
${typography("right-panel-header")};
|
|
5
5
|
`;export const FieldsGroupHeader=styled.h5`
|
|
6
|
-
color: var(--text-secondary);
|
|
6
|
+
color: var(--text-color-secondary);
|
|
7
7
|
font-weight: bold;
|
|
8
8
|
text-transform: uppercase;
|
|
9
9
|
font-size: 14px;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import styled from"styled-components";import{SamplesMiddlePanel}from"../common/panels";export const SamplesWrap=styled.div`
|
|
2
2
|
padding: calc(var(--spacing-unit) * 4);
|
|
3
3
|
border-radius: var(--panel-border-radius);
|
|
4
|
-
border: var(--panel-samples-border);
|
|
5
4
|
background-color: var(--panel-samples-background-color);
|
|
6
5
|
`;export const ExamplesWrap=styled(SamplesWrap)`
|
|
7
6
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React,{memo}from"react";import styled from"styled-components";import{serializeParameterValue}from"../../utils";import{CodeHeader}from"../Panel";import{Path,PathWrapper,TryItButton}from"../Endpoint";import{HttpVerb}from"../shared";import{expandVariables}from"./utils";function formatPath(e,t,r){const n=t.path||{},a=t.query||{},o=Object.keys(a);let i=expandVariables(e,n);return o.length&&(i+="?"+o.map((e=>{if(!a[e])return"";const t=(e=>r.find((t=>t.name===e&&"query"===t.in)))(e);return t?serializeParameterValue(t,a[e]):`${e}=${encodeURIComponent(a[e])}`})).filter(Boolean).join("&")),i}export const ActionPanelComponent=({loading:e,operation:t,hasResponse:r,execute:n,params:a={}})=>React.createElement(CodeHeader,null,React.createElement(PathWrapper,null,React.createElement(HttpVerb,{
|
|
1
|
+
import React,{memo}from"react";import styled from"styled-components";import{serializeParameterValue}from"../../utils";import{CodeHeader}from"../Panel";import{Path,PathWrapper,TryItButton}from"../Endpoint";import{HttpVerb}from"../shared";import{expandVariables}from"./utils";function formatPath(e,t,r){const n=t.path||{},a=t.query||{},o=Object.keys(a);let i=expandVariables(e,n);return o.length&&(i+="?"+o.map((e=>{if(!a[e])return"";const t=(e=>r.find((t=>t.name===e&&"query"===t.in)))(e);return t?serializeParameterValue(t,a[e]):`${e}=${encodeURIComponent(a[e])}`})).filter(Boolean).join("&")),i}export const ActionPanelComponent=({loading:e,operation:t,hasResponse:r,execute:n,params:a={}})=>React.createElement(CodeHeader,null,React.createElement(PathWrapper,null,React.createElement(HttpVerb,{type:t.httpVerb},t.httpVerb),React.createElement(Path,{wrap:"true"},formatPath(t.path,a,t.parameters))),React.createElement(SendButton,{"data-cy":"send-button",color:"primary",blinking:e,onClick:()=>!e&&n()},e?"Sending...":r?"Resend":"Send"));const SendButton=styled(TryItButton)`
|
|
2
2
|
width: var(--panel-try-it-action-button-width);
|
|
3
3
|
`;export const ActionPanel=memo(ActionPanelComponent);
|
|
4
4
|
//# sourceMappingURL=ActionPanel.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import{createGlobalStyle}from"styled-components";export const CodeMirrorStyles=createGlobalStyle`
|
|
2
2
|
.cm-s-material.CodeMirror {
|
|
3
|
-
background-color: var(--
|
|
4
|
-
color: var(--text-
|
|
3
|
+
background-color: var(--panel-samples-controls-background-color)!important;
|
|
4
|
+
color: var(--text-color-inverse)!important;
|
|
5
5
|
font-family: var(--code-font-family);
|
|
6
6
|
line-height: 18px;
|
|
7
7
|
padding: 10px;
|
|
@@ -25,7 +25,7 @@ import{createGlobalStyle}from"styled-components";export const CodeMirrorStyles=c
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.cm-s-material .CodeMirror-code .cm-atom {
|
|
28
|
-
color: var(--text-
|
|
28
|
+
color: var(--text-color-inverse);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
div .cm-s-material .CodeMirror-matchingbracket {
|
|
@@ -13,24 +13,34 @@ import styled,{css}from"styled-components";export const TabsWrap=styled.div`
|
|
|
13
13
|
color: var(--panel-try-it-tabs-text-color);
|
|
14
14
|
min-width: 80px;
|
|
15
15
|
min-height: 30px;
|
|
16
|
-
border-radius: var(--border-radius
|
|
16
|
+
border-radius: var(--border-radius);
|
|
17
17
|
font-size: var(--panel-try-it-tabs-font-size);
|
|
18
18
|
font-family: var(--panel-try-it-tabs-font-family);
|
|
19
19
|
font-weight: var(--panel-try-it-tabs-font-weight);
|
|
20
20
|
padding: 0 10px;
|
|
21
|
+
border-bottom: 4px solid var(--panel-try-it-tabs-border-color);
|
|
22
|
+
|
|
23
|
+
&:first-child {
|
|
24
|
+
border-radius: var(--border-radius) 0 0 var(--border-radius);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:last-child {
|
|
28
|
+
border-radius: 0 var(--border-radius) var(--border-radius) 0;
|
|
29
|
+
}
|
|
21
30
|
|
|
22
31
|
&:hover:not(:disabled) {
|
|
32
|
+
border-color: var(--panel-try-it-tabs-hover-border-color);
|
|
23
33
|
background-color: var(--panel-try-it-tabs-hover-background-color);
|
|
24
|
-
color: var(--panel-try-it-tabs-hover-text-color);
|
|
25
34
|
}
|
|
26
35
|
|
|
27
|
-
${({active:
|
|
36
|
+
${({active:r})=>r&&css`
|
|
37
|
+
border-color: var(--panel-try-it-tabs-active-border-color);
|
|
28
38
|
background-color: var(--panel-try-it-tabs-active-background-color);
|
|
29
|
-
color: var(--panel-try-it-tabs-active-text-color);
|
|
30
39
|
`||""}
|
|
31
40
|
|
|
32
|
-
${({disabled:
|
|
41
|
+
${({disabled:r})=>r&&css`
|
|
33
42
|
cursor: default;
|
|
43
|
+
border-color: var(--panel-try-it-tabs-disables-border-color)
|
|
34
44
|
background-color: var(--panel-try-it-tabs-disabled-background-color);
|
|
35
45
|
color: var(--panel-try-it-tabs-disabled-text-color);
|
|
36
46
|
`||""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,o,l){return new(o||(o=Promise))((function(n,r){function a(e){try{c(l.next(e))}catch(e){r(e)}}function i(e){try{c(l.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,i)}c((l=l.apply(e,t||[])).next())}))};import React,{useEffect,useState}from"react";import{Button}from"@redocly/theme";import{useRecoilValue}from"recoil";import{ButtonsWrapper,PkceOptionsWrapper,PkceDetails}from"./styled";import{LinearProgress}from"../../common/LinearProgress";import{FormControl,FormLabel,FormError,FormWrapper}from"../../common/form";import{FormDropdown,FormTextField,TextField}from"../../common/TextField";import{Checkbox}from"../../common/Checkbox";import{OAuth2,deriveCodeChallenge}from"../../../services/OAuth2";import{fromSessionStorage,getSecurityDetailsOptions}from"../../../utils";import{isEmptyObject,randString}from"../../../services/utils";import{getOAuth2TokenEndpointAuthHeader,normalizeUrlProtocol,validateTokenEndpointMethod}from"../utils";import Scope from"../Scope";import{Error}from"./Error";import{globalOptionsSelector}from"../../../recoil/store";function requiredValidator(e){if(!e)return"Field is required"}export const OAuth2Flow=({usePkce:e,form:t,id:o,formApi:l,flow:n,tokenUrl:r,authCorsProxyUrl:a,tokenEndpointAuthMethod:i,server:c,scopes:u,authorizationUrl:d,defaultValues:s,clientId:m})=>{var p,h,f,v;const{oAuth2RedirectURI:g,routingBasePath:E}=useRecoilValue(globalOptionsSelector),[k,C]=useState(null),[R,F]=useState(!1),[S,y]=useState(!1),[O,b]=useState(void 0),[_,A]=useState(void 0),[x,W]=useState(void 0),P=(null===(h=null===(p=t.values)||void 0===p?void 0:p.auth)||void 0===h?void 0:h[o])||{},T=(null===(v=null===(f=t.errors)||void 0===f?void 0:f.auth)||void 0===v?void 0:v[o])||{},V=void 0!==O&&_!==x?{label:"sync",onClick:()=>{O&&A(x)}}:void 0;useEffect((()=>{if(e){const e=randString(43);deriveCodeChallenge(e).then((t=>{b(e),A(t),W(t)}))}}),[e]);const w=()=>{l.setValue(`auth.${o}.token`,"")};if(!d)return React.createElement(FormError,null,"No flow info");let z=fromSessionStorage(`auth.${o}.token`)||JSON.stringify(null==s?void 0:s.token);z=z?JSON.parse(z):"";const B=getSecurityDetailsOptions(o,"client_id"),U={field:`auth.${o}.client_id`,fullWidth:!0,initialValue:fromSessionStorage(`auth.${o}.client_id`)||m||(null==s?void 0:s.client_id),initValue:fromSessionStorage(`auth.${o}.client_id`)||m||(null==s?void 0:s.client_id),placeholder:"Your OAuth2 app Client ID",validate:requiredValidator,validateOnBlur:!0,validateOnChange:!0};return React.createElement("div",null,React.createElement(FormWrapper,null,React.createElement(FormControl,null,React.createElement(FormLabel,null," Client ID: "),B?React.createElement(FormDropdown,Object.assign({},U,{options:B})):React.createElement(FormTextField,Object.assign({},U,{"data-cy":"client-id-input",panel:"try-it"}))),"authorizationCode"===n&&React.createElement(React.Fragment,null,(!(null==e?void 0:e.hideClientSecretInput)||!e)&&React.createElement(FormControl,null,React.createElement(FormLabel,null,"Client Secret:"),React.createElement(FormTextField,{type:"password",fullWidth:!0,field:`auth.${o}.client_secret`,initialValue:fromSessionStorage(`auth.${o}.client_secret`)||(null==s?void 0:s.client_secret),validateOnBlur:!0,validateOnChange:!0,panel:"try-it","data-cy":"client-secret-input"})),e&&!e.disableManualConfiguration&&React.createElement(PkceOptionsWrapper,null,React.createElement(Checkbox,{id:"pkce-opitons-toggle",label:"Configure PKCE manually",checked:S,onChange:()=>{y((e=>!e))},"data-cy":"pkce-options-toggle"}),S&&React.createElement(PkceDetails,null,React.createElement(FormControl,null,React.createElement(FormLabel,null,"Code Verifier"),React.createElement(TextField,{fullWidth:!0,value:O,onChange:({target:{value:e}})=>__awaiter(void 0,void 0,void 0,(function*(){const t=yield deriveCodeChallenge(e);b(e),W(t)})),panel:"try-it","data-cy":"code-verifier-input"})),React.createElement(FormControl,null,React.createElement(FormLabel,null,"Code Challenge"),React.createElement(TextField,{fullWidth:!0,value:_,onChange:({target:{value:e}})=>{A(e)},inputActionButton:V,panel:"try-it","data-cy":"code-challenge-input"}))))),React.createElement(FormTextField,{fullWidth:!0,field:`auth.${o}.token`,type:"hidden",initialValue:z,panel:"try-it"}),React.createElement(Scope,{id:o,scopes:u}),P.token&&P.token.access_token?React.createElement(FormControl,null,React.createElement(FormLabel,null," Access Token: "),React.createElement(TextField,{disabled:!0,type:"password",fullWidth:!0,value:P.token.access_token,panel:"try-it"})):null),React.createElement(ButtonsWrapper,null,P.token&&P.token.access_token?React.createElement(Button,{fullWidth:!0,onClick:()=>{w(),C(null)}},"Log out"):R?React.createElement(React.Fragment,null,React.createElement(Button,{fullWidth:!0,onClick:()=>{F(!1),C(null),OAuth2.clearRedirectData(n)}},"Cancel"),React.createElement(LinearProgress,null)):React.createElement(Button,{fullWidth:!0,disabled:!isEmptyObject(T),onClick:()=>{(t=>{if(!t)return;if(l.validate(),!isEmptyObject(T))return;F(!0),C(null);const u=a?a+normalizeUrlProtocol(t):t,d=a&&r?a+normalizeUrlProtocol(r):r,s=l.getValue(`auth.${o}.scopes`),m={authorizationUrl:u.startsWith("http")?u:c+u,clientId:P.client_id,scopes:s,redirectUri:g,routingBasePath:E,successCallback:e=>{l.setValue(`auth.${o}.token`,e),F(!1),C(null)},errorCallback:e=>{F(!1),C((null==e?void 0:e.message)||"Failed to retrieve the access token")}};"implicit"===n&&OAuth2.authorizeImplicit(m),validateTokenEndpointMethod(i)?"authorizationCode"===n&&OAuth2.authorizeAuthorizationCode(Object.assign(Object.assign(Object.assign({},m),{tokenUrl:(null==d?void 0:d.startsWith("http"))?d:c+d,clientSecret:P.client_secret,extraHeaders:getOAuth2TokenEndpointAuthHeader({authMethod:i,clientId:P.client_id,clientSecret:P.client_secret})}),e&&{codeVerifier:O,codeChallenge:_})):console.log(`Unsupported token endpoint auth method: ${i}`)})(d)}},"Authorize")),R||k||!P.token||!P.token.access_token&&React.createElement(Error,{loading:R,error:k,token:P.token}))};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,o,l){return new(o||(o=Promise))((function(n,r){function a(e){try{c(l.next(e))}catch(e){r(e)}}function i(e){try{c(l.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,i)}c((l=l.apply(e,t||[])).next())}))};import React,{useEffect,useState}from"react";import{Button}from"@redocly/theme";import{useRecoilValue}from"recoil";import{ButtonsWrapper,PkceOptionsWrapper,PkceDetails}from"./styled";import{LinearProgress}from"../../common/LinearProgress";import{FormControl,FormLabel,FormError,FormWrapper}from"../../common/form";import{FormDropdown,FormTextField,TextField}from"../../common/TextField";import{Checkbox}from"../../common/Checkbox";import{OAuth2,deriveCodeChallenge}from"../../../services/OAuth2";import{fromSessionStorage,getSecurityDetailsOptions}from"../../../utils";import{isEmptyObject,randString}from"../../../services/utils";import{getOAuth2TokenEndpointAuthHeader,normalizeUrlProtocol,validateTokenEndpointMethod}from"../utils";import Scope from"../Scope";import{Error}from"./Error";import{globalOptionsSelector}from"../../../recoil/store";function requiredValidator(e){if(!e)return"Field is required"}export const OAuth2Flow=({usePkce:e,form:t,id:o,formApi:l,flow:n,tokenUrl:r,authCorsProxyUrl:a,tokenEndpointAuthMethod:i,server:c,scopes:u,authorizationUrl:d,defaultValues:s,clientId:m})=>{var p,h,f,v;const{oAuth2RedirectURI:g,routingBasePath:E}=useRecoilValue(globalOptionsSelector),[k,C]=useState(null),[R,F]=useState(!1),[S,y]=useState(!1),[O,b]=useState(void 0),[_,A]=useState(void 0),[x,W]=useState(void 0),P=(null===(h=null===(p=t.values)||void 0===p?void 0:p.auth)||void 0===h?void 0:h[o])||{},T=(null===(v=null===(f=t.errors)||void 0===f?void 0:f.auth)||void 0===v?void 0:v[o])||{},V=void 0!==O&&_!==x?{label:"sync",onClick:()=>{O&&A(x)}}:void 0;useEffect((()=>{if(e){const e=randString(43);deriveCodeChallenge(e).then((t=>{b(e),A(t),W(t)}))}}),[e]);const w=()=>{l.setValue(`auth.${o}.token`,"")};if(!d)return React.createElement(FormError,null,"No flow info");let z=fromSessionStorage(`auth.${o}.token`)||JSON.stringify(null==s?void 0:s.token);z=z?JSON.parse(z):"";const B=getSecurityDetailsOptions(o,"client_id"),U={field:`auth.${o}.client_id`,fullWidth:!0,initialValue:fromSessionStorage(`auth.${o}.client_id`)||m||(null==s?void 0:s.client_id),initValue:fromSessionStorage(`auth.${o}.client_id`)||m||(null==s?void 0:s.client_id),placeholder:"Your OAuth2 app Client ID",validate:requiredValidator,validateOnBlur:!0,validateOnChange:!0};return React.createElement("div",null,React.createElement(FormWrapper,null,React.createElement(FormControl,null,React.createElement(FormLabel,null," Client ID: "),B?React.createElement(FormDropdown,Object.assign({},U,{options:B})):React.createElement(FormTextField,Object.assign({},U,{"data-cy":"client-id-input",panel:"try-it"}))),"authorizationCode"===n&&React.createElement(React.Fragment,null,(!(null==e?void 0:e.hideClientSecretInput)||!e)&&React.createElement(FormControl,null,React.createElement(FormLabel,null,"Client Secret:"),React.createElement(FormTextField,{type:"password",fullWidth:!0,field:`auth.${o}.client_secret`,initialValue:fromSessionStorage(`auth.${o}.client_secret`)||(null==s?void 0:s.client_secret),validateOnBlur:!0,validateOnChange:!0,panel:"try-it","data-cy":"client-secret-input"})),e&&!e.disableManualConfiguration&&React.createElement(PkceOptionsWrapper,null,React.createElement(Checkbox,{id:"pkce-opitons-toggle",label:"Configure PKCE manually",checked:S,onChange:()=>{y((e=>!e))},"data-cy":"pkce-options-toggle"}),S&&React.createElement(PkceDetails,null,React.createElement(FormControl,null,React.createElement(FormLabel,null,"Code Verifier"),React.createElement(TextField,{fullWidth:!0,value:O,onChange:({target:{value:e}})=>__awaiter(void 0,void 0,void 0,(function*(){const t=yield deriveCodeChallenge(e);b(e),W(t)})),panel:"try-it","data-cy":"code-verifier-input"})),React.createElement(FormControl,null,React.createElement(FormLabel,null,"Code Challenge"),React.createElement(TextField,{fullWidth:!0,value:_,onChange:({target:{value:e}})=>{A(e)},inputActionButton:V,panel:"try-it","data-cy":"code-challenge-input"}))))),React.createElement(FormTextField,{fullWidth:!0,field:`auth.${o}.token`,type:"hidden",initialValue:z,panel:"try-it"}),React.createElement(Scope,{id:o,scopes:u}),P.token&&P.token.access_token?React.createElement(FormControl,null,React.createElement(FormLabel,null," Access Token: "),React.createElement(TextField,{disabled:!0,type:"password",fullWidth:!0,value:P.token.access_token,panel:"try-it"})):null),React.createElement(ButtonsWrapper,null,P.token&&P.token.access_token?React.createElement(Button,{fullWidth:!0,onClick:()=>{w(),C(null)}},"Log out"):R?React.createElement(React.Fragment,null,React.createElement(Button,{fullWidth:!0,onClick:()=>{F(!1),C(null),OAuth2.clearRedirectData(n)}},"Cancel"),React.createElement(LinearProgress,null)):React.createElement(Button,{fullWidth:!0,color:"secondary",disabled:!isEmptyObject(T),onClick:()=>{(t=>{if(!t)return;if(l.validate(),!isEmptyObject(T))return;F(!0),C(null);const u=a?a+normalizeUrlProtocol(t):t,d=a&&r?a+normalizeUrlProtocol(r):r,s=l.getValue(`auth.${o}.scopes`),m={authorizationUrl:u.startsWith("http")?u:c+u,clientId:P.client_id,scopes:s,redirectUri:g,routingBasePath:E,successCallback:e=>{l.setValue(`auth.${o}.token`,e),F(!1),C(null)},errorCallback:e=>{F(!1),C((null==e?void 0:e.message)||"Failed to retrieve the access token")}};"implicit"===n&&OAuth2.authorizeImplicit(m),validateTokenEndpointMethod(i)?"authorizationCode"===n&&OAuth2.authorizeAuthorizationCode(Object.assign(Object.assign(Object.assign({},m),{tokenUrl:(null==d?void 0:d.startsWith("http"))?d:c+d,clientSecret:P.client_secret,extraHeaders:getOAuth2TokenEndpointAuthHeader({authMethod:i,clientId:P.client_id,clientSecret:P.client_secret})}),e&&{codeVerifier:O,codeChallenge:_})):console.log(`Unsupported token endpoint auth method: ${i}`)})(d)}},"Authorize")),R||k||!P.token||!P.token.access_token&&React.createElement(Error,{loading:R,error:k,token:P.token}))};
|
|
2
2
|
//# sourceMappingURL=OAuth2Flow.js.map
|
|
@@ -5,7 +5,7 @@ import React from"react";import styled from"styled-components";import{ResponseBo
|
|
|
5
5
|
margin-right: 20px;
|
|
6
6
|
padding: 2px 0;
|
|
7
7
|
text-align: center;
|
|
8
|
-
color: var(--text-
|
|
8
|
+
color: var(--text-color-inverse);
|
|
9
9
|
`,ResponseBadge=styled(ResponseBadgeBase)`
|
|
10
10
|
color: ${({code:e})=>e>=200&&e<300?"var(--response-success-text-color)":e>=300&&e<400?"var(--response-redirect-text-color)":e>400?"var(--response-error-text-color)":"var(--response-info-text-color)"};
|
|
11
11
|
`,ErrorHeader=styled.header`
|
|
@@ -14,5 +14,5 @@ import React from"react";import styled from"styled-components";import{ResponseBo
|
|
|
14
14
|
`,ErrorDetails=styled.code`
|
|
15
15
|
border-left: 3px solid #ff4040;
|
|
16
16
|
padding-left: 5px;
|
|
17
|
-
`;export const ResponsePanel=({error:e,response:t,time:n})=>{const r=t||e&&e.response,
|
|
17
|
+
`;export const ResponsePanel=({error:e,response:t,time:n})=>{const r=t||e&&e.response,s=r&&r.data&&r.data.length||0;let a;return a=s>1e6?(s/1e6).toFixed(2)+" MB":s>1e3?(s/1e3).toFixed(2)+" KB":s+" B",e&&!e.response||!r?React.createElement(React.Fragment,null,React.createElement(ErrorHeader,null," Could not get any response "),React.createElement(ErrorDetails,null,e&&e.message||"Unknown error"),React.createElement("br",null),React.createElement(ErrorHeader,null," Why this might have happened:"),React.createElement("div",null," - CORS is misconfigured on the server"),React.createElement("div",null," - The server couldn't send a response"),React.createElement("div",null," - No internet access"),React.createElement("div",null," - Documentation issue - contact API owner"),React.createElement("div",null," - Misconfigured security definition")):r?React.createElement(React.Fragment,null,React.createElement(ResponseBadges,null,React.createElement(ResponseBadge,{code:r.status},React.createElement("span",null," Status: "),r.status," ",r.statusText),React.createElement(ResponseBadgeBase,null,React.createElement("span",null," Time: "),n,"ms"),React.createElement(ResponseBadgeBase,null,React.createElement("span",null," Size: "),a)),React.createElement("div",null,React.createElement(ResponseHeadersList,{headers:r.headers}),React.createElement(ResponseBody,{response:r}))):React.createElement(React.Fragment,null,"Something went wrong")};
|
|
18
18
|
//# sourceMappingURL=ResponsePanel.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var __rest=this&&this.__rest||function(e,r){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(e);a<o.length;a++)r.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]])}return t};import*as React from"react";import styled from"styled-components";import{PanelHeaderTitle,PanelHeader,Panel,PanelBody,ShelfIcon}from"@redocly/theme";import{Trigger}from"../Panel";import{CrossIcon,LockIcon}from"../icons";export function TryItPanel(e){var{header:r,error:t,success:o}=e,a=__rest(e,["header","error","success"]);return React.createElement(StyledTryItPanel,Object.assign({className:"panel-try-it-nested"},a,{header:({toggle:e,expanded:n=!1})=>React.createElement(PanelHeader,{onClick:e,expanded:n,"data-cy":a["data-cy"]},React.createElement(Trigger,null,React.createElement(PanelHeaderTitle,null,r),React.createElement(ShelfIcon,{direction:n?"down":"right"})),t&&React.createElement(CrossIcon,{size:"14px",color:"--color-error"})||null,o&&React.createElement(LockIcon,{size:"14px",color:"--color-success"})||null)}))}const StyledTryItPanel=styled(Panel)`
|
|
1
|
+
var __rest=this&&this.__rest||function(e,r){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(e);a<o.length;a++)r.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]])}return t};import*as React from"react";import styled from"styled-components";import{PanelHeaderTitle,PanelHeader,Panel,PanelBody,ShelfIcon}from"@redocly/theme";import{Trigger}from"../Panel";import{CrossIcon,LockIcon}from"../icons";export function TryItPanel(e){var{header:r,error:t,success:o}=e,a=__rest(e,["header","error","success"]);return React.createElement(StyledTryItPanel,Object.assign({className:"panel-try-it-nested"},a,{header:({toggle:e,expanded:n=!1})=>React.createElement(PanelHeader,{onClick:e,expanded:n,"data-cy":a["data-cy"]},React.createElement(Trigger,null,React.createElement(PanelHeaderTitle,null,r),React.createElement(ShelfIcon,{direction:n?"down":"right"})),t&&React.createElement(CrossIcon,{size:"14px",color:"--color-error-500"})||null,o&&React.createElement(LockIcon,{size:"14px",color:"--color-success-500"})||null)}))}const StyledTryItPanel=styled(Panel)`
|
|
2
2
|
${PanelHeader} {
|
|
3
3
|
border: 1px solid
|
|
4
|
-
${({error:e})=>e?"var(--color-error-
|
|
4
|
+
${({error:e})=>e?"var(--color-error-300)":"var(--panel-try-it-nested-heading-border-color)"};
|
|
5
5
|
padding: 10px;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
${PanelBody} {
|
|
9
9
|
border: 1px solid
|
|
10
|
-
${({error:e})=>e?"var(--color-error-
|
|
10
|
+
${({error:e})=>e?"var(--color-error-300)":"var(--panel-try-it-nested-body-border-color)"};
|
|
11
11
|
border-top: 0;
|
|
12
12
|
}
|
|
13
13
|
`;
|
|
@@ -41,7 +41,8 @@ import styled,{css,keyframes}from"styled-components";import{Dropdown}from"../com
|
|
|
41
41
|
margin-bottom: 10px;
|
|
42
42
|
${({shaking:o})=>o&&shakeAnimation};
|
|
43
43
|
> div:last-child {
|
|
44
|
-
border-radius: 0
|
|
44
|
+
border-top-left-radius: 0;
|
|
45
|
+
border-top-right-radius: 0;
|
|
45
46
|
}
|
|
46
47
|
`;export const ConsoleBody=styled.div`
|
|
47
48
|
flex: 1;
|
|
@@ -55,7 +56,7 @@ import styled,{css,keyframes}from"styled-components";import{Dropdown}from"../com
|
|
|
55
56
|
cursor: pointer;
|
|
56
57
|
font-size: 18px;
|
|
57
58
|
font-weight: bold;
|
|
58
|
-
color: var(--text-
|
|
59
|
+
color: var(--text-color-inverse);
|
|
59
60
|
`;export const invertedInputStyles=css`
|
|
60
61
|
border: none;
|
|
61
62
|
outline: none;
|
|
@@ -69,7 +70,7 @@ import styled,{css,keyframes}from"styled-components";import{Dropdown}from"../com
|
|
|
69
70
|
|
|
70
71
|
&::placeholder {
|
|
71
72
|
opacity: 0.6;
|
|
72
|
-
color: var(--text-
|
|
73
|
+
color: var(--text-color-inverse);
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
&:-webkit-autofill {
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const HttpVerb: import("styled-components").StyledComponent<"span", any, {
|
|
2
|
+
className: `operation-type ${string}`;
|
|
3
|
+
'data-component-name': string;
|
|
4
|
+
} & {
|
|
5
|
+
type: string;
|
|
6
|
+
}, "className" | "data-component-name">;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import styled from"styled-components";import{
|
|
2
|
-
|
|
1
|
+
import styled from"styled-components";import{OperationBadge}from"@redocly/theme";export const HttpVerb=styled(OperationBadge)`
|
|
2
|
+
display: inline-block;
|
|
3
|
+
padding: 0 8px;
|
|
3
4
|
`;
|
|
4
5
|
//# sourceMappingURL=HttpVerb.js.map
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import styled from"styled-components";export const MimeLabel=styled.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
2
|
background-color: var(--panel-samples-dropdown-background-color);
|
|
5
|
-
color: var(
|
|
3
|
+
color: var(---panel-samples-dropdown-color);
|
|
6
4
|
font-family: var(--code-font-family);
|
|
7
5
|
margin-bottom: 0;
|
|
8
6
|
height: 36px;
|
|
@@ -10,6 +8,6 @@ import styled from"styled-components";export const MimeLabel=styled.div`
|
|
|
10
8
|
font-size: 14px;
|
|
11
9
|
line-height: 16px;
|
|
12
10
|
border: var(--panel-samples-dropdown-border);
|
|
13
|
-
border-radius: var(--
|
|
11
|
+
border-radius: var(--border-radius);
|
|
14
12
|
`;
|
|
15
13
|
//# sourceMappingURL=MimeLabel.js.map
|
|
@@ -4,7 +4,7 @@ import styled from"styled-components";export const NoSampleLabel=styled.div`
|
|
|
4
4
|
`;export const WarnMessage=styled.div`
|
|
5
5
|
font-size: 12px;
|
|
6
6
|
padding-bottom: 10px;
|
|
7
|
-
color: var(--color-warning);
|
|
7
|
+
color: var(--color-warning-500);
|
|
8
8
|
font-family: var(--code-font-family);
|
|
9
9
|
`;
|
|
10
10
|
//# sourceMappingURL=NoSampleLabel.js.map
|
|
@@ -24,14 +24,14 @@ export declare enum AnalyticsEventType {
|
|
|
24
24
|
CodeSampleCopied = "CodeSampleCopied",
|
|
25
25
|
OperationServerExpanded = "OperationServerExpanded",
|
|
26
26
|
PanelToggle = "PanelToggle",
|
|
27
|
-
|
|
27
|
+
tryItToggle = "TryItToggle",
|
|
28
28
|
TryItSent = "TryItSent",
|
|
29
29
|
TargetServerSwitched = "TargetServerSwitched"
|
|
30
30
|
}
|
|
31
31
|
export interface AnalyticsEvent {
|
|
32
32
|
eventType: AnalyticsEventType;
|
|
33
33
|
resource: 'Redocly_CodeSample' | 'Redocly_Operation' | 'Redocly_OperationTryIt';
|
|
34
|
-
action: 'LanguageSwitched' | 'PanelToggled' | 'Opened' | 'NavigatedOverrideLink' | 'Sent' | 'ValidationFailed' | 'CodeSampleCopied' | 'TargetServerSwitched';
|
|
34
|
+
action: 'LanguageSwitched' | 'PanelToggled' | 'Opened' | 'Closed' | 'NavigatedOverrideLink' | 'Sent' | 'ValidationFailed' | 'CodeSampleCopied' | 'TargetServerSwitched';
|
|
35
35
|
operationId?: string;
|
|
36
36
|
operationPath: string;
|
|
37
37
|
operationHttpVerb: string;
|
|
@@ -49,7 +49,8 @@ export interface CodeSamplesCopiedEvent extends AnalyticsEvent {
|
|
|
49
49
|
exampleId?: string;
|
|
50
50
|
exampleMimeType?: string;
|
|
51
51
|
}
|
|
52
|
-
type
|
|
52
|
+
type TryItSentEvent = AnalyticsEvent;
|
|
53
|
+
type tryItToggleEvent = AnalyticsEvent;
|
|
53
54
|
export interface PanelToggleEvent extends AnalyticsEvent {
|
|
54
55
|
panelType: 'request' | 'responses' | 'request-samples' | 'response-samples';
|
|
55
56
|
state: 'expanded' | 'collapsed';
|
|
@@ -64,8 +65,8 @@ export interface TargetServerSwitchedEvent extends AnalyticsEvent {
|
|
|
64
65
|
export type Events = {
|
|
65
66
|
codeSamplesLanguageSwitch?: (event: CodeSamplesLanguageSwitchedEvent) => void;
|
|
66
67
|
codeSamplesCopy?: (event: CodeSamplesCopiedEvent) => void;
|
|
67
|
-
|
|
68
|
-
tryItSent?: (event:
|
|
68
|
+
tryItToggle?: (event: tryItToggleEvent) => void;
|
|
69
|
+
tryItSent?: (event: TryItSentEvent) => void;
|
|
69
70
|
panelToggle?: (event: PanelToggleEvent) => void;
|
|
70
71
|
targetServerSwitch?: (event: TargetServerSwitchedEvent) => void;
|
|
71
72
|
};
|
package/lib-esm/events/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var AnalyticsEventType;!function(e){e.CodeSampleLanguageSwitched="CodeSampleLanguageSwitched",e.CodeSampleCopied="CodeSampleCopied",e.OperationServerExpanded="OperationServerExpanded",e.PanelToggle="PanelToggle",e.
|
|
1
|
+
export var AnalyticsEventType;!function(e){e.CodeSampleLanguageSwitched="CodeSampleLanguageSwitched",e.CodeSampleCopied="CodeSampleCopied",e.OperationServerExpanded="OperationServerExpanded",e.PanelToggle="PanelToggle",e.tryItToggle="TryItToggle",e.TryItSent="TryItSent",e.TargetServerSwitched="TargetServerSwitched"}(AnalyticsEventType||(AnalyticsEventType={}));
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.56",
|
|
4
4
|
"description": "Redocly OpenAPI Docs",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"webpack-cli": "^5.1.4",
|
|
118
118
|
"webpack-dev-server": "^4.15.1",
|
|
119
119
|
"workerize-loader": "github:redocly/workerize-loader#webpack-5-dist",
|
|
120
|
-
"@redocly/theme": "0.18.3
|
|
120
|
+
"@redocly/theme": "0.18.3"
|
|
121
121
|
},
|
|
122
122
|
"scripts": {
|
|
123
123
|
"start": "webpack serve --mode=development --hot",
|