Skip to content
This repository was archived by the owner on Jun 20, 2022. It is now read-only.

Commit 0f59029

Browse files
authored
fix(sc): fix withComponent API (#68)
1 parent 6444ba9 commit 0f59029

File tree

6 files changed

+29
-24
lines changed

6 files changed

+29
-24
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"eslint-plugin-react": "^7.11.1",
5858
"favicons-webpack-plugin": "^0.0.9",
5959
"jest": "^23.6.0",
60-
"jest-styled-components": "^6.2.0",
60+
"jest-styled-components": "^6.2.2",
6161
"lerna": "^3.4.3",
6262
"react": "^16.5.1",
6363
"react-dom": "^16.5.1",
@@ -74,11 +74,11 @@
7474
"standard-version": "^4.4.0",
7575
"styled-components": "^4.0.2",
7676
"uglifyjs-webpack-plugin": "^2.0.0",
77-
"webpack": "^4.21.0"
77+
"webpack": "^4.22.0"
7878
},
7979
"dependencies": {
8080
"classnames": "^2.2.6",
81-
"polished": "^2.2.0",
81+
"polished": "^2.3.0",
8282
"prop-types": "^15.6.2",
8383
"react-transition-group": "^2.5.0"
8484
}

packages/core-em/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"dependencies": {
2929
"focus-trap": "^3.0.0",
30-
"polished": "^2.2.0",
30+
"polished": "^2.3.0",
3131
"prop-types": "^15.6.2",
3232
"react-transition-group": "^2.5.0"
3333
},

packages/core-sc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"dependencies": {
2828
"focus-trap": "^3.0.0",
29-
"polished": "^2.2.0",
29+
"polished": "^2.3.0",
3030
"prop-types": "^15.6.2",
3131
"react-transition-group": "^2.5.0"
3232
},

packages/shared/core/styled-engine/styled-components.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import { wrapStyled } from './util'
33

44
const styled = wrapStyled(scStyled)
55

6-
export default styled
76
export * from 'styled-components'
7+
export default styled

packages/shared/core/styled-engine/util.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,26 @@ function patchStyledComponent(StyledComponent) {
55
if (!StyledComponent.target.__smoothUIComponent) {
66
return StyledComponent
77
}
8-
const {
9-
render,
10-
withComponent,
11-
defaultProps,
12-
propTypes,
13-
componentStyle,
14-
} = StyledComponent
8+
9+
const { render, withComponent: baseWithComponent } = StyledComponent
10+
1511
StyledComponent.withComponent = (component, ...args) => {
12+
const { defaultProps, propTypes } = StyledComponent
1613
const Target = StyledComponent.target
1714
const NewTarget = props => <Target as={component} {...props} />
1815
// eslint-disable-next-line no-underscore-dangle
1916
NewTarget.__smoothUIComponent = true
2017
return patchStyledComponent(
21-
Object.assign(withComponent(NewTarget, ...args), {
18+
Object.assign(baseWithComponent(NewTarget, ...args), {
2219
defaultProps,
2320
propTypes,
24-
componentStyle,
2521
}),
2622
)
2723
}
24+
2825
StyledComponent.render = ({ as, ...props }, ref) =>
2926
render({ forwardedAs: as, ...props }, ref)
27+
3028
return StyledComponent
3129
}
3230

yarn.lock

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7797,10 +7797,10 @@ jest-snapshot@^23.6.0:
77977797
pretty-format "^23.6.0"
77987798
semver "^5.5.0"
77997799

7800-
jest-styled-components@^6.2.0:
7801-
version "6.2.1"
7802-
resolved "https://registry.yarnpkg.com/jest-styled-components/-/jest-styled-components-6.2.1.tgz#63d28c6bf637977509f0e6a57bff0a10f44a48e3"
7803-
integrity sha512-7Z9TeI97yvI5BA6nn3169V7YwzSJj2fgl7uwE3foL9XxgMyrpTjTAnS0EZEiV8J8iyMFNYvzD6yytmF43/6L1g==
7800+
jest-styled-components@^6.2.2:
7801+
version "6.2.2"
7802+
resolved "https://registry.yarnpkg.com/jest-styled-components/-/jest-styled-components-6.2.2.tgz#8d69a95ca9d26b9ceab2fcccdee3795d041a1f3b"
7803+
integrity sha512-CLjlS4FuVpzft3DG+bX8HIFZxmkWTJs0sX2rlIkel4U6O7TteNBPBdATuH/fT+RCfEQ/bGTtOFoI7yQ9HTghRA==
78047804
dependencies:
78057805
css "^2.2.4"
78067806

@@ -10286,13 +10286,20 @@ pngjs@^3.0.0, pngjs@^3.2.0:
1028610286
resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.3.3.tgz#85173703bde3edac8998757b96e5821d0966a21b"
1028710287
integrity sha512-1n3Z4p3IOxArEs1VRXnZ/RXdfEniAUS9jb68g58FIXMNkPJeZd+Qh4Uq7/e0LVxAQGos1eIUrqrt4FpjdnEd+Q==
1028810288

10289-
polished@^2.0.3, polished@^2.2.0:
10289+
polished@^2.0.3:
1029010290
version "2.2.0"
1029110291
resolved "https://registry.yarnpkg.com/polished/-/polished-2.2.0.tgz#5ca7e178cc5352bd7fd1efc45342f7c6d59cc982"
1029210292
integrity sha512-GEKeNET1XIri53xKpFwGZX4fh2k3b5GE5fxwLWYYR2sGWkMAHJVcb7bK1g6QHIDcoIEEGC8CzHOQgl2qFByd3w==
1029310293
dependencies:
1029410294
"@babel/runtime" "^7.0.0"
1029510295

10296+
polished@^2.3.0:
10297+
version "2.3.0"
10298+
resolved "https://registry.yarnpkg.com/polished/-/polished-2.3.0.tgz#66c8b66bc666e95d9d12d760dac9df758aed8f8e"
10299+
integrity sha512-G2yD9LhJy5HBuU+Im5qe70ubaJI/ZTTOIJO6GRMwJ2WSoAiPzlm8+LjAXMnm9/K0E0NumRVHvQu2HHPKQSYQjw==
10300+
dependencies:
10301+
"@babel/runtime" "^7.0.0"
10302+
1029610303
posix-character-classes@^0.1.0:
1029710304
version "0.1.1"
1029810305
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
@@ -13583,10 +13590,10 @@ webpack@^4.19.1:
1358313590
watchpack "^1.5.0"
1358413591
webpack-sources "^1.3.0"
1358513592

13586-
webpack@^4.21.0:
13587-
version "4.21.0"
13588-
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.21.0.tgz#bd03605c0f48c0d4aaaef78ead2769485e5afd92"
13589-
integrity sha512-CGBeop4AYR0dcmk9Afl33qQULwTHQCXQPAIBTHMJoy9DpY8FPUDna/NUlAGTr5o5y9QC901Ww3wCY4wNo1X9Lw==
13593+
webpack@^4.22.0:
13594+
version "4.22.0"
13595+
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.22.0.tgz#b168111e2e7b05f5169ac484e79e62093ec39e0d"
13596+
integrity sha512-2+3EYFqyhPl12buLQ42QPHEEh8BHn3P9ipRvGRHhdfKJ1u9svhZ3QjhIoEdL5SeIhL5gfOZVbBnartYEabkEsg==
1359013597
dependencies:
1359113598
"@webassemblyjs/ast" "1.7.8"
1359213599
"@webassemblyjs/helper-module-context" "1.7.8"

0 commit comments

Comments
 (0)