Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 33 additions & 32 deletions types/grid-styled/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Type definitions for grid-styled 3.2
// Project: https://github.com/jxnblk/grid-styled
// Definitions by: Anton Vasin <https://github.com/antonvasin>
// Victor Orlov <https://github.com/vittorio>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6

Expand All @@ -15,44 +16,44 @@ import { StyledComponentClass } from "styled-components";
export type ResponsiveProp = number | string | Array<string | number>;

export interface CommonProps {
width: ResponsiveProp;
fontSize: ResponsiveProp;
color: ResponsiveProp;
bg: ResponsiveProp;
m: ResponsiveProp;
mt: ResponsiveProp;
mr: ResponsiveProp;
mb: ResponsiveProp;
ml: ResponsiveProp;
mx: ResponsiveProp;
my: ResponsiveProp;
p: ResponsiveProp;
pt: ResponsiveProp;
pr: ResponsiveProp;
pb: ResponsiveProp;
pl: ResponsiveProp;
px: ResponsiveProp;
py: ResponsiveProp;
theme: any;
width?: ResponsiveProp;
fontSize?: ResponsiveProp;
color?: ResponsiveProp;
bg?: ResponsiveProp;
m?: ResponsiveProp;
mt?: ResponsiveProp;
mr?: ResponsiveProp;
mb?: ResponsiveProp;
ml?: ResponsiveProp;
mx?: ResponsiveProp;
my?: ResponsiveProp;
p?: ResponsiveProp;
pt?: ResponsiveProp;
pr?: ResponsiveProp;
pb?: ResponsiveProp;
pl?: ResponsiveProp;
px?: ResponsiveProp;
py?: ResponsiveProp;
theme?: any;
}

export interface BoxProps
extends Omit<React.HTMLProps<HTMLDivElement>, "width" | "wrap" | "is"> {
flex: ResponsiveProp;
order: ResponsiveProp;
is: string | ComponentClass<any>;
flex?: ResponsiveProp;
order?: ResponsiveProp;
is?: string | ComponentClass<any>;
}

export interface FlexProps extends BoxProps {
alignItems: ResponsiveProp;
justifyContent: ResponsiveProp;
flexDirection: ResponsiveProp;
flexWrap: ResponsiveProp;
alignItems?: ResponsiveProp;
justifyContent?: ResponsiveProp;
flexDirection?: ResponsiveProp;
flexWrap?: ResponsiveProp;

// legacy aliases https://github.com/jxnblk/styled-system/releases/tag/v2.0.0
justify: ResponsiveProp;
align: ResponsiveProp;
wrap: ResponsiveProp | boolean;
justify?: ResponsiveProp;
align?: ResponsiveProp;
wrap?: ResponsiveProp | boolean;
}

export type BoxComponent = StyledComponentClass<
Expand All @@ -67,14 +68,14 @@ export type FlexComponent = StyledComponentClass<

export interface Theme {
breakpoints: string[];
space: number[];
fontSizes: number[];
space?: number[];
fontSizes?: number[];
}

export const Box: BoxComponent;
export const Flex: FlexComponent;
export const theme: Theme;
export type DivProps = Omit<React.HTMLProps<HTMLDivElement>, "ref"> & {
innerRef: (el: HTMLDivElement) => any;
innerRef?: (el: HTMLDivElement) => any;
};
export const div: ComponentClass<DivProps>;