Skip to content

Commit c57354e

Browse files
RomanPidkostelnyickoegel
authored andcommitted
feat: add support of react 18 (Redocly#2369)
* feat: add support of react 18 * chore: add newest version of styled-components to peerDependencies * chore: add supoort of styled components * chore: downgrade types * chore: update snapshots
1 parent 9656b37 commit c57354e

File tree

8 files changed

+2022
-1523
lines changed

8 files changed

+2022
-1523
lines changed

package-lock.json

Lines changed: 1985 additions & 1495 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@
135135
"peerDependencies": {
136136
"core-js": "^3.1.4",
137137
"mobx": "^6.0.4",
138-
"react": "^16.8.4 || ^17.0.0",
139-
"react-dom": "^16.8.4 || ^17.0.0",
140-
"styled-components": "^4.1.1 || ^5.1.1"
138+
"react": "^16.8.4 || ^17.0.0 || ^18.0.0",
139+
"react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0",
140+
"styled-components": "^4.1.1 || ^5.1.1 || ^6.0.5"
141141
},
142142
"dependencies": {
143143
"@redocly/openapi-core": "^1.0.0-beta.104",

src/common-elements/fields.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ export const TypeTitle = styled(FieldLabel)`
7070

7171
export const TypeFormat = TypeName;
7272

73-
export const RequiredLabel = styled(FieldLabel.withComponent('div'))`
73+
export const RequiredLabel = styled(FieldLabel).attrs({
74+
as: 'div',
75+
})`
7476
color: ${props => props.theme.schema.requireLabelColor};
7577
font-size: ${props => props.theme.schema.labelsTextSize};
7678
font-weight: normal;

src/common-elements/samples.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export const SampleControlsWrap = styled.div`
3232
}
3333
`;
3434

35-
export const StyledPre = styled(PrismDiv.withComponent('pre'))`
35+
export const StyledPre = styled(PrismDiv).attrs({
36+
as: 'pre',
37+
})`
3638
font-family: ${props => props.theme.typography.code.fontFamily};
3739
font-size: ${props => props.theme.typography.code.fontSize};
3840
overflow-x: auto;

src/components/Markdown/SanitizedMdBlock.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import * as React from 'react';
44
import { OptionsConsumer } from '../OptionsProvider';
55
import { StylingMarkdownProps } from './Markdown';
66
import { StyledMarkdownBlock } from './styled.elements';
7+
import styled from 'styled-components';
78

8-
const StyledMarkdownSpan = StyledMarkdownBlock.withComponent('span');
9+
const StyledMarkdownSpan = styled(StyledMarkdownBlock)`
10+
display: inline;
11+
`;
912

1013
const sanitize = (untrustedSpec, html) => (untrustedSpec ? DOMPurify.sanitize(html) : html);
1114

src/components/Responses/styled.elements.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ export const ResponseDetailsWrap = styled.div`
4141
padding: 10px;
4242
`;
4343

44-
export const HeadersCaption = styled(UnderlinedHeader.withComponent('caption'))`
44+
export const HeadersCaption = styled(UnderlinedHeader).attrs({
45+
as: 'caption',
46+
})`
4547
text-align: left;
4648
margin-top: 1em;
4749
caption-side: top;

src/components/__tests__/__snapshots__/OneOfSchema.test.tsx.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@ exports[`Components SchemaView OneOf deprecated should match snapshot 1`] = `
55
class="oneOf-schema"
66
>
77
<span
8-
class="sc-kfYoZR juYXUf"
8+
class="sc-fUnMCh hPwMmL"
99
>
1010
One of
1111
</span>
1212
<div
13-
class="sc-dlMDgC EoFth"
13+
class="sc-feUZmu bTropM"
1414
>
1515
<button
16-
class="sc-fKgJPI iEPbLk"
16+
class="sc-hzhJZQ ilKqWS"
1717
>
1818
string
1919
</button>
2020
<button
21-
class="sc-fKgJPI bpjiHN"
21+
class="sc-hzhJZQ emRRrf"
2222
>
2323
integer
2424
</button>
2525
</div>
2626
<div>
2727
<span
28-
class="sc-bqGGPW eSYQnm"
28+
class="sc-jEACwC gWyYnj"
2929
type="warning"
3030
>
3131
Deprecated
@@ -37,18 +37,18 @@ exports[`Components SchemaView OneOf deprecated should match snapshot 1`] = `
3737
>
3838
<div>
3939
<span
40-
class="sc-laZMeE sc-iNiQyp jWaWWE jrLlAa"
40+
class="sc-Nxspf sc-cfxfcM cXxAXt jrGEaR"
4141
/>
4242
<span
43-
class="sc-laZMeE sc-jffHpj jWaWWE cThoNa"
43+
class="sc-Nxspf sc-gFAWRd cXxAXt dYzdDr"
4444
>
4545
string
4646
</span>
4747
</div>
4848
4949
<div>
5050
<div
51-
class="sc-iJCRrE sc-ciSkZP jCdxGr lhENGb"
51+
class="sc-eeDRCY sc-eBMEME gTGgei hXXgcw"
5252
/>
5353
</div>
5454
</div>

src/components/__tests__/__snapshots__/SecurityRequirement.test.tsx.snap

Lines changed: 13 additions & 13 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)