Skip to content

Commit

Permalink
Merge branch 'master' into ts-theme-provider
Browse files Browse the repository at this point in the history
* master:
  chore(deps): bump @emotion/core from 10.0.22 to 10.0.28
  Link fix in docs.
  refactor(theme-ui): add typescript
  chore(deps): bump gatsby-remark-prismjs from 3.3.30 to 3.3.31
  chore(deps): bump polished from 3.4.2 to 3.4.4
  chore(deps-dev): bump @testing-library/react from 9.4.0 to 9.4.1
  chore(deps-dev): bump husky from 4.2.1 to 4.2.3
  chore(deps): bump gatsby-plugin-mdx from 1.0.70 to 1.0.73
  Fix useBorderBox
  feat: add type variable to hook
  task: add root tsconfig
  • Loading branch information
epilande committed Mar 5, 2020
2 parents 0084f8a + e3a24ce commit 806ebb0
Show file tree
Hide file tree
Showing 33 changed files with 194 additions and 247 deletions.
8 changes: 1 addition & 7 deletions packages/color/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"compilerOptions": {
"strict": true,

"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node"
},
"extends": "../../tsconfig.json",
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"]
}
2 changes: 1 addition & 1 deletion packages/core/test/react-jsx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { jsx } from '../src'
import renderer from 'react-test-renderer'

const renderJSON = (el: React.ReactNode) => renderer.create(el).toJSON()
const renderJSON = (el: React.ReactElement) => renderer.create(el).toJSON()

describe('JSX', () => {
test('accepts sx prop', () => {
Expand Down
7 changes: 3 additions & 4 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"jsx": "react"
"jsx": "react",
"strict": false
},
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
}
2 changes: 1 addition & 1 deletion packages/css/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ export interface Theme {
/**
* Adds a global box-sizing: border-box style
*/
useBoxSizing?: boolean
useBorderBox?: boolean

/**
* Define the colors that are available through this theme
Expand Down
6 changes: 4 additions & 2 deletions packages/css/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"extends": "../core/tsconfig.json",
"compilerOptions": {},
"extends": "../../tsconfig.json",
"compilerOptions": {
"strict": false
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"]
}
7 changes: 1 addition & 6 deletions packages/custom-properties/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
2 changes: 1 addition & 1 deletion packages/docs/src/pages/styling-mdx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ colors and other styles can be added to `theme.styles.pre` to target child eleme
Prism.js adds `<span>` elements with class names that can be used as child selectors.


To enable syntax highlighting in MDX, see the [`@theme-ui/prism`](/prism) package.
To enable syntax highlighting in MDX, see the [`@theme-ui/prism`](/packages/prism) package.

[prism.js]: https://github.com/PrismJS/prism

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/pages/theming.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Flag | Default | Description
`useBodyStyles` | `true` | Adds styles defined in `theme.styles.root` to the `<body>` element along with `color` and `background-color`
`initialColorModeName` | `'default'` | The key used for the top-level color palette in `theme.colors`
`useColorSchemeMediaQuery` | `false` | Initializes the color mode based on the `prefers-color-scheme` media query
`useBoxSizing` | `true` | Adds a global `box-sizing: border-box` style
`useBorderBox` | `true` | Adds a global `box-sizing: border-box` style

## Example Theme

Expand Down
7 changes: 5 additions & 2 deletions packages/match-media/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ export const useBreakpointIndex = (options: defaultOptions = {}) => {
return value
}

type Values = ((theme: Theme | null) => string[]) | string[]
type Values<T> = ((theme: Theme | null) => T[]) | T[]

export const useResponsiveValue = (values: Values, options: defaultOptions = {}) => {
export function useResponsiveValue<T>(
values: Values<T>,
options: defaultOptions = {}
): T {
const { theme } = useThemeUI()
const array = typeof values === 'function' ? values(theme) : values
const index = useBreakpointIndex(options)
Expand Down
9 changes: 2 additions & 7 deletions packages/match-media/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-base/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-bootstrap/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-bulma/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-dark/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-deep/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-funk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-future/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-polaris/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-roboto/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-swiss/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-system/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-tailwind/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/preset-tosh/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/presets/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/tachyons/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
"extends": "../../tsconfig.json"
}
7 changes: 1 addition & 6 deletions packages/tailwind/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
},
"extends": "../../tsconfig.json",
"exclude": ["test"]
}
4 changes: 3 additions & 1 deletion packages/theme-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "theme-ui",
"version": "0.3.1",
"description": "Build consistent, themeable React UIs based on design system constraints",
"source": "src/index.ts",
"main": "dist/index.js",
"module": "dist/index.esm.js",
"sideEffects": false,
Expand All @@ -18,7 +19,8 @@
"@theme-ui/core": "^0.3.1",
"@theme-ui/css": "^0.3.1",
"@theme-ui/mdx": "^0.3.0",
"@theme-ui/theme-provider": "^0.3.1"
"@theme-ui/theme-provider": "^0.3.1",
"@types/theme-ui__components": "^0.2.3"
},
"keywords": [
"theme-ui",
Expand Down
32 changes: 0 additions & 32 deletions packages/theme-ui/src/index.js

This file was deleted.

42 changes: 42 additions & 0 deletions packages/theme-ui/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { jsx } from '@theme-ui/core'

export {
jsx,
Context,
merge,
useThemeUI,
ContextValue,
IntrinsicSxElements,
SxProps,
SxStyleProp,
} from '@theme-ui/core'
export { useColorMode, InitializeColorMode } from '@theme-ui/color-modes'
export { Styled, components } from '@theme-ui/mdx'
export { ThemeProvider } from '@theme-ui/theme-provider'
export * from '@theme-ui/components'
export {
css,
get,
ColorMode,
CSSObject,
CSSProperties,
CSSPseudoSelectorProps,
ResponsiveStyleValue,
SystemCssProperties,
SystemStyleObject,
Theme,
TLengthStyledSystem,
UseThemeFunction,
} from '@theme-ui/css'

// TODO: work this into root provider/global styles?
export const BaseStyles = (props: Record<string, unknown>) =>
jsx('div', {
...props,
sx: {
fontFamily: 'body',
lineHeight: 'body',
fontWeight: 'body',
variant: 'styles',
},
})
File renamed without changes.
8 changes: 8 additions & 0 deletions packages/theme-ui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../core/tsconfig.json",
"compilerOptions": {
"strict": true,
"noImplicitAny": false
},
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
}
8 changes: 8 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true
}
}
Loading

0 comments on commit 806ebb0

Please sign in to comment.