File tree Expand file tree Collapse file tree 4 files changed +25
-7
lines changed Expand file tree Collapse file tree 4 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -511,7 +511,7 @@ export type ColorMode = {
511511}
512512
513513export interface Theme {
514- breakpoints ?: ObjectOrArray < number | string | symbol >
514+ breakpoints ?: Array < string >
515515 mediaQueries ?: { [ size : string ] : string }
516516 space ?: ObjectOrArray < CSS . MarginProperty < number | string > >
517517 fontSizes ?: ObjectOrArray < CSS . FontSizeProperty < number > >
Original file line number Diff line number Diff line change 22 "name" : " @theme-ui/match-media" ,
33 "version" : " 0.3.1" ,
44 "description" : " React hooks for theme-ui breakpoints" ,
5+ "source" : " src/index.ts" ,
56 "main" : " dist/index.js" ,
67 "module" : " dist/index.esm.js" ,
8+ "types" : " dist/index.d.ts" ,
79 "author" : " Brent Jackson <jxnblk@gmail.com>" ,
810 "license" : " MIT" ,
911 "repository" : " system-ui/theme-ui" ,
1012 "scripts" : {
11- "prepare" : " microbundle --no-compress" ,
12- "watch" : " microbundle watch --no-compress"
13+ "prepare" : " microbundle --no-compress --tsconfig tsconfig.json " ,
14+ "watch" : " microbundle watch --no-compress --tsconfig tsconfig.json "
1315 },
1416 "publishConfig" : {
1517 "access" : " public"
1618 },
1719 "devDependencies" : {
1820 "react" : " ^16.9.0" ,
19- "theme-ui" : " ^0.3.1"
21+ "@theme-ui/core" : " ^0.3.1" ,
22+ "@theme-ui/css" : " ^0.3.1"
2023 },
2124 "peerDependencies" : {
2225 "react" : " ^16.9.0" ,
Original file line number Diff line number Diff line change 11import { useState , useEffect , useCallback } from 'react'
2- import { useThemeUI } from 'theme-ui'
2+ import { useThemeUI } from '@theme-ui/core'
3+ import { Theme } from '@theme-ui/css'
34
45// Shared with @theme -ui/css
56const defaultBreakpoints = [ 40 , 52 , 64 ] . map ( n => n + 'em' )
67
7- export const useBreakpointIndex = ( options = { } ) => {
8+ type defaultOptions = {
9+ defaultIndex ?: number
10+ }
11+
12+ export const useBreakpointIndex = ( options : defaultOptions = { } ) => {
813 const context = useThemeUI ( )
914 const { defaultIndex = 0 } = options
1015 const breakpoints =
@@ -47,7 +52,9 @@ export const useBreakpointIndex = (options = {}) => {
4752 return value
4853}
4954
50- export const useResponsiveValue = ( values , options ) => {
55+ type Values = ( ( theme : Theme | null ) => string [ ] ) | string [ ]
56+
57+ export const useResponsiveValue = ( values : Values , options : defaultOptions = { } ) => {
5158 const { theme } = useThemeUI ( )
5259 const array = typeof values === 'function' ? values ( theme ) : values
5360 const index = useBreakpointIndex ( options )
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "resolveJsonModule" : true ,
4+ "esModuleInterop" : true ,
5+ "moduleResolution" : " node" ,
6+ "strict" : true
7+ }
8+ }
You can’t perform that action at this time.
0 commit comments