Skip to content

Commit 28be0fc

Browse files
authored
Merge pull request DefinitelyTyped#30742 from Lavoaster/styled-system-csstype
styled-system: Remove all type exports, and pull in values from csstype
2 parents ea53c3b + fd336a9 commit 28be0fc

File tree

3 files changed

+128
-386
lines changed

3 files changed

+128
-386
lines changed

types/styled-system/dist/space.d.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import * as CSS from 'csstype';
2+
export type TLengthStyledSystem = string | 0 | number;
13
export type ResponsiveValue<T> = T | Array<T | null>;
24

3-
export type SpaceValue = number | string;
4-
55
/**
66
* Converts shorthand margin and padding props to margin and padding CSS declarations
77
*
@@ -11,37 +11,36 @@ export type SpaceValue = number | string;
1111
* - String values are passed as raw CSS values.
1212
* - Array values are converted into responsive values.
1313
*/
14-
export type ResponsiveSpaceValue = ResponsiveValue<SpaceValue>;
1514

16-
export interface SpaceProps {
15+
export interface SpaceProps<TLength = TLengthStyledSystem> {
1716
/** Margin on top, left, bottom and right */
18-
m?: ResponsiveSpaceValue;
17+
m?: ResponsiveValue<CSS.MarginProperty<TLength>>;
1918
/** Margin for the top */
20-
mt?: ResponsiveSpaceValue;
19+
mt?: ResponsiveValue<CSS.MarginTopProperty<TLength>>;
2120
/** Margin for the right */
22-
mr?: ResponsiveSpaceValue;
21+
mr?: ResponsiveValue<CSS.MarginRightProperty<TLength>>;
2322
/** Margin for the bottom */
24-
mb?: ResponsiveSpaceValue;
23+
mb?: ResponsiveValue<CSS.MarginBottomProperty<TLength>>;
2524
/** Margin for the left */
26-
ml?: ResponsiveSpaceValue;
25+
ml?: ResponsiveValue<CSS.MarginLeftProperty<TLength>>;
2726
/** Margin for the left and right */
28-
mx?: ResponsiveSpaceValue;
27+
mx?: ResponsiveValue<CSS.PaddingProperty<TLength>>;
2928
/** Margin for the top and bottom */
30-
my?: ResponsiveSpaceValue;
29+
my?: ResponsiveValue<CSS.PaddingProperty<TLength>>;
3130
/** Padding on top, left, bottom and right */
32-
p?: ResponsiveSpaceValue;
31+
p?: ResponsiveValue<CSS.PaddingProperty<TLength>>;
3332
/** Padding for the top */
34-
pt?: ResponsiveSpaceValue;
33+
pt?: ResponsiveValue<CSS.PaddingTopProperty<TLength>>;
3534
/** Padding for the right */
36-
pr?: ResponsiveSpaceValue;
35+
pr?: ResponsiveValue<CSS.PaddingRightProperty<TLength>>;
3736
/** Padding for the bottom */
38-
pb?: ResponsiveSpaceValue;
37+
pb?: ResponsiveValue<CSS.PaddingBottomProperty<TLength>>;
3938
/** Padding for the left */
40-
pl?: ResponsiveSpaceValue;
39+
pl?: ResponsiveValue<CSS.PaddingLeftProperty<TLength>>;
4140
/** Padding for the left and right */
42-
px?: ResponsiveSpaceValue;
41+
px?: ResponsiveValue<CSS.PaddingProperty<TLength>>;
4342
/** Padding for the top and bottom */
44-
py?: ResponsiveSpaceValue;
43+
py?: ResponsiveValue<CSS.PaddingProperty<TLength>>;
4544
}
4645

4746
export function space(...args: any[]): any;

0 commit comments

Comments
 (0)