Skip to content

Commit 9163f48

Browse files
authored
Merge pull request #502 from system-ui/css-package
Move CSS package
2 parents 389aa04 + eefe7fb commit 9163f48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1038
-417
lines changed

lerna.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
"version": "0.2.53",
33
"npmClient": "yarn",
44
"useWorkspaces": true,
5-
"packages": [
6-
"packages/*"
7-
]
5+
"packages": ["packages/*"]
86
}

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
"prettier": "^1.18.2",
3333
"react-test-renderer": "^16.8.6"
3434
},
35-
"resolutions": {
36-
},
35+
"resolutions": {},
3736
"jest": {
3837
"testMatch": [
3938
"**/packages/**/test/*.js"

packages/color/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"watch": "microbundle watch --no-compress"
99
},
1010
"dependencies": {
11-
"@styled-system/css": "^5.0.23",
11+
"@theme-ui/css": "^0.2.48",
1212
"polished": "^3.4.1"
1313
},
1414
"publishConfig": {

packages/color/src/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import * as P from 'polished'
2-
import { get } from '@styled-system/css'
2+
import { get } from '@theme-ui/css'
33

4-
const g = (t, c) => get(t, `colors.${c}`, c).replace(/^var\(--(\w+)(.*?), /,'').replace(/\)/,'')
4+
const g = (t, c) =>
5+
get(t, `colors.${c}`, c)
6+
.replace(/^var\(--(\w+)(.*?), /, '')
7+
.replace(/\)/, '')
58

69
export const darken = (c, n) => t => P.darken(n, g(t, c))
710
export const lighten = (c, n) => t => P.lighten(n, g(t, c))

packages/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@emotion/core": "^10.0.0",
1212
"@emotion/styled": "^10.0.0",
1313
"@styled-system/color": "^5.1.2",
14-
"@styled-system/css": "^5.0.23",
14+
"@theme-ui/css": "^0.2.48",
1515
"@styled-system/should-forward-prop": "^5.1.2",
1616
"@styled-system/space": "^5.1.2"
1717
},

packages/components/src/AspectImage.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ import React from 'react'
22
import { AspectRatio } from './AspectRatio'
33
import { Image } from './Image'
44

5-
export const AspectImage = React.forwardRef(({
6-
ratio,
7-
...props
8-
}, ref) => (
9-
<AspectRatio
10-
ratio={ratio}>
5+
export const AspectImage = React.forwardRef(({ ratio, ...props }, ref) => (
6+
<AspectRatio ratio={ratio}>
117
<Image
128
ref={ref}
139
{...props}
Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
11
import React from 'react'
22
import Box from './Box'
33

4-
export const AspectRatio = React.forwardRef(({
5-
ratio = 4/3,
6-
children,
7-
...props
8-
}, ref) => (
9-
<Box
10-
ref={ref}
11-
sx={{
12-
position: 'relative',
13-
overflow: 'hidden',
14-
}}>
4+
export const AspectRatio = React.forwardRef(
5+
({ ratio = 4 / 3, children, ...props }, ref) => (
156
<Box
7+
ref={ref}
168
sx={{
17-
width: '100%',
18-
height: 0,
19-
paddingBottom: (100 / ratio) + '%',
20-
}}
21-
/>
22-
<Box
23-
{...props}
24-
__css={{
25-
position: 'absolute',
26-
top: 0,
27-
right: 0,
28-
bottom: 0,
29-
left: 0,
9+
position: 'relative',
10+
overflow: 'hidden',
3011
}}>
31-
{children}
12+
<Box
13+
sx={{
14+
width: '100%',
15+
height: 0,
16+
paddingBottom: 100 / ratio + '%',
17+
}}
18+
/>
19+
<Box
20+
{...props}
21+
__css={{
22+
position: 'absolute',
23+
top: 0,
24+
right: 0,
25+
bottom: 0,
26+
left: 0,
27+
}}>
28+
{children}
29+
</Box>
3230
</Box>
33-
</Box>
34-
))
31+
)
32+
)

packages/components/src/Avatar.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import React from 'react'
22
import { Image } from './Image'
33

4-
export const Avatar = React.forwardRef(({
5-
size = 48,
6-
...props
7-
}, ref) => (
4+
export const Avatar = React.forwardRef(({ size = 48, ...props }, ref) => (
85
<Image
96
ref={ref}
107
width={size}
118
height={size}
12-
variant='avatar'
9+
variant="avatar"
1310
{...props}
1411
__css={{
1512
borderRadius: 9999,

packages/components/src/Box.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from '@emotion/styled'
2-
import css, { get } from '@styled-system/css'
2+
import { css, get } from '@theme-ui/css'
33
import { createShouldForwardProp } from '@styled-system/should-forward-prop'
44
import space from '@styled-system/space'
55
import color from '@styled-system/color'

packages/components/src/Donut.js

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
11
import React from 'react'
22
import Box from './Box'
33

4-
export const Donut = React.forwardRef(({
5-
size = 128,
6-
strokeWidth = 2,
7-
value = 0,
8-
min = 0,
9-
max = 1,
10-
title,
11-
...props
12-
}, ref) => {
13-
const r = 16 - (strokeWidth)
14-
const C = 2 * r * Math.PI
15-
const offset = C - ((value - min) / (max - min) * C)
4+
export const Donut = React.forwardRef(
5+
(
6+
{
7+
size = 128,
8+
strokeWidth = 2,
9+
value = 0,
10+
min = 0,
11+
max = 1,
12+
title,
13+
...props
14+
},
15+
ref
16+
) => {
17+
const r = 16 - strokeWidth
18+
const C = 2 * r * Math.PI
19+
const offset = C - ((value - min) / (max - min)) * C
1620

17-
return (
18-
<Box
19-
ref={ref}
20-
as='svg'
21-
viewBox='0 0 32 32'
22-
width={size}
23-
height={size}
24-
strokeWidth={strokeWidth}
25-
fill='none'
26-
stroke='currentcolor'
27-
role='img'
28-
aria-valuenow={value}
29-
aria-valuemin={min}
30-
aria-valuemax={max}
31-
{...props}
32-
__css={{
33-
color: 'primary',
34-
}}>
35-
{title && <title>{title}</title>}
36-
<circle
37-
cx={16}
38-
cy={16}
39-
r={r}
40-
opacity={1/8}
41-
/>
42-
<circle
43-
cx={16}
44-
cy={16}
45-
r={r}
46-
strokeDasharray={C}
47-
strokeDashoffset={offset}
48-
transform='rotate(-90 16 16)'
49-
/>
50-
</Box>
51-
)
52-
})
21+
return (
22+
<Box
23+
ref={ref}
24+
as="svg"
25+
viewBox="0 0 32 32"
26+
width={size}
27+
height={size}
28+
strokeWidth={strokeWidth}
29+
fill="none"
30+
stroke="currentcolor"
31+
role="img"
32+
aria-valuenow={value}
33+
aria-valuemin={min}
34+
aria-valuemax={max}
35+
{...props}
36+
__css={{
37+
color: 'primary',
38+
}}>
39+
{title && <title>{title}</title>}
40+
<circle cx={16} cy={16} r={r} opacity={1 / 8} />
41+
<circle
42+
cx={16}
43+
cy={16}
44+
r={r}
45+
strokeDasharray={C}
46+
strokeDashoffset={offset}
47+
transform="rotate(-90 16 16)"
48+
/>
49+
</Box>
50+
)
51+
}
52+
)

0 commit comments

Comments
 (0)