Skip to content

Commit 25da709

Browse files
authored
Merge pull request #724 from hasparus/ts-theme-ui
refactor(theme-ui): add typescript to the root package
2 parents ea5a2af + 6cdcc8c commit 25da709

File tree

7 files changed

+96
-34
lines changed

7 files changed

+96
-34
lines changed

packages/core/test/react-jsx.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { jsx } from '../src'
33
import renderer from 'react-test-renderer'
44

5-
const renderJSON = (el: React.ReactNode) => renderer.create(el).toJSON()
5+
const renderJSON = (el: React.ReactElement) => renderer.create(el).toJSON()
66

77
describe('JSX', () => {
88
test('accepts sx prop', () => {

packages/theme-ui/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "theme-ui",
33
"version": "0.3.1",
44
"description": "Build consistent, themeable React UIs based on design system constraints",
5+
"source": "src/index.ts",
56
"main": "dist/index.js",
67
"module": "dist/index.esm.js",
78
"sideEffects": false,
@@ -18,7 +19,8 @@
1819
"@theme-ui/core": "^0.3.1",
1920
"@theme-ui/css": "^0.3.1",
2021
"@theme-ui/mdx": "^0.3.0",
21-
"@theme-ui/theme-provider": "^0.3.1"
22+
"@theme-ui/theme-provider": "^0.3.1",
23+
"@types/theme-ui__components": "^0.2.3"
2224
},
2325
"keywords": [
2426
"theme-ui",

packages/theme-ui/src/index.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

packages/theme-ui/src/index.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { jsx } from '@theme-ui/core'
2+
3+
export {
4+
jsx,
5+
Context,
6+
merge,
7+
useThemeUI,
8+
ContextValue,
9+
IntrinsicSxElements,
10+
SxProps,
11+
SxStyleProp,
12+
} from '@theme-ui/core'
13+
export { useColorMode, InitializeColorMode } from '@theme-ui/color-modes'
14+
export { Styled, components } from '@theme-ui/mdx'
15+
export { ThemeProvider } from '@theme-ui/theme-provider'
16+
export * from '@theme-ui/components'
17+
export {
18+
css,
19+
get,
20+
ColorMode,
21+
CSSObject,
22+
CSSProperties,
23+
CSSPseudoSelectorProps,
24+
ResponsiveStyleValue,
25+
SystemCssProperties,
26+
SystemStyleObject,
27+
Theme,
28+
TLengthStyledSystem,
29+
UseThemeFunction,
30+
} from '@theme-ui/css'
31+
32+
// TODO: work this into root provider/global styles?
33+
export const BaseStyles = (props: Record<string, unknown>) =>
34+
jsx('div', {
35+
...props,
36+
sx: {
37+
fontFamily: 'body',
38+
lineHeight: 'body',
39+
fontWeight: 'body',
40+
variant: 'styles',
41+
},
42+
})
File renamed without changes.

packages/theme-ui/tsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../core/tsconfig.json",
3+
"compilerOptions": {
4+
"strict": true,
5+
"noImplicitAny": false
6+
},
7+
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
8+
}

yarn.lock

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3590,6 +3590,20 @@
35903590
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
35913591
integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==
35923592

3593+
"@types/styled-system@*":
3594+
version "5.1.7"
3595+
resolved "https://registry.yarnpkg.com/@types/styled-system/-/styled-system-5.1.7.tgz#b5aeb6efea499103a497da762516cdf38efd9e02"
3596+
integrity sha512-0zMxF/B5Z4T6ZhCP8CKtxe8wBmH7sqDjK3lOMByNQ6gG/Qf6RDnBp1aZwkReS1uDVhrsPx9J+IbLigpAdYBkrQ==
3597+
dependencies:
3598+
csstype "^2.6.9"
3599+
3600+
"@types/styled-system__css@*":
3601+
version "5.0.5"
3602+
resolved "https://registry.yarnpkg.com/@types/styled-system__css/-/styled-system__css-5.0.5.tgz#f3c8036e551fbf603f1ad39cf317fd0e6ad1e431"
3603+
integrity sha512-JaKYusiRtP3osDx+PhTPP7Ki68mMKoImv/bhr7lK4UFAxeXvveARD5v5rUY0Oy0pfbNkky/nVgHlgGaPbG/JBQ==
3604+
dependencies:
3605+
csstype "^2.6.6"
3606+
35933607
"@types/testing-library__dom@*", "@types/testing-library__dom@^6.0.0":
35943608
version "6.10.0"
35953609
resolved "https://registry.yarnpkg.com/@types/testing-library__dom/-/testing-library__dom-6.10.0.tgz#590d76e3875a7c536dc744eb530cbf51b6483404"
@@ -3605,6 +3619,29 @@
36053619
"@types/react-dom" "*"
36063620
"@types/testing-library__dom" "*"
36073621

3622+
"@types/theme-ui@*":
3623+
version "0.3.0"
3624+
resolved "https://registry.yarnpkg.com/@types/theme-ui/-/theme-ui-0.3.0.tgz#5a8972b1e6060a4699885ea6c91f9d17a957661a"
3625+
integrity sha512-3PJw/As8C1HeLJXZytGf5Gfz7HBKskbtyOabPsHSNRTr+jLZvIWpFKF9hgDWYp7io35UcLDS5TLcFwiCGGxAzg==
3626+
dependencies:
3627+
"@emotion/serialize" "^0.11.15"
3628+
"@types/react" "*"
3629+
"@types/styled-system" "*"
3630+
"@types/styled-system__css" "*"
3631+
"@types/theme-ui__components" "*"
3632+
csstype "^2.6.6"
3633+
3634+
"@types/theme-ui__components@*", "@types/theme-ui__components@^0.2.3":
3635+
version "0.2.3"
3636+
resolved "https://registry.yarnpkg.com/@types/theme-ui__components/-/theme-ui__components-0.2.3.tgz#470c286375f5177d2607f34da4b38c315e66907c"
3637+
integrity sha512-g0q3IpJxDXPQvWhaVSXJroB74dxD6HAHAfCbb3unV7iaoovrLact1Yxan5cDRMqHf8d7ub3JAvpSmGSdlNJ5OQ==
3638+
dependencies:
3639+
"@emotion/core" "^10.0.0"
3640+
"@emotion/styled" "^10.0.0"
3641+
"@types/react" "*"
3642+
"@types/styled-system" "*"
3643+
"@types/theme-ui" "*"
3644+
36083645
"@types/tmp@^0.0.32":
36093646
version "0.0.32"
36103647
resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.0.32.tgz#0d3cb31022f8427ea58c008af32b80da126ca4e3"
@@ -8220,6 +8257,11 @@ csstype@^2.2.0, csstype@^2.5.7:
82208257
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.7.tgz#20b0024c20b6718f4eda3853a1f5a1cce7f5e4a5"
82218258
integrity sha512-9Mcn9sFbGBAdmimWb2gLVDtFJzeKtDGIr76TUqmjZrw9LFXBMSU70lcs+C0/7fyCd6iBDqmksUcCOUIkisPHsQ==
82228259

8260+
csstype@^2.6.6, csstype@^2.6.9:
8261+
version "2.6.9"
8262+
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.9.tgz#05141d0cd557a56b8891394c1911c40c8a98d098"
8263+
integrity sha512-xz39Sb4+OaTsULgUERcCk+TJj8ylkL4aSVDQiX/ksxbELSqwkgt4d4RD7fovIdgJGSuNYqwZEiVjYY5l0ask+Q==
8264+
82238265
currently-unhandled@^0.4.1:
82248266
version "0.4.1"
82258267
resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea"

0 commit comments

Comments
 (0)