1 | import * as StyledSystem from "styled-system";
|
2 |
|
3 | import * as React from "react";
|
4 | import { Omit } from "../common-types";
|
5 |
|
6 | type CSS = React.CSSProperties;
|
7 |
|
8 | type borderRadius = StyledSystem.BorderRadiusProps["borderRadius"];
|
9 | type borderColor = StyledSystem.BorderColorProps["borderColor"];
|
10 |
|
11 | interface ICustomConfig {
|
12 |
|
13 | rounded?: borderRadius;
|
14 | roundedTop?: borderRadius;
|
15 | roundedBottom?: borderRadius;
|
16 | roundedLeft?: borderRadius;
|
17 | roundedRight?: borderRadius;
|
18 | roundedTopRight?: borderRadius;
|
19 | roundedTopLeft?: borderRadius;
|
20 | roundedBottomRight?: borderRadius;
|
21 | roundedBottomLeft?: borderRadius;
|
22 |
|
23 |
|
24 | borderBottomColor?: borderColor;
|
25 | borderTopColor?: borderColor;
|
26 | borderRightColor?: borderColor;
|
27 | borderLeftColor?: borderColor;
|
28 |
|
29 |
|
30 | w?: StyledSystem.WidthProps["width"];
|
31 | minW?: StyledSystem.MinWidthProps["minWidth"];
|
32 | maxW?: StyledSystem.MaxWidthProps["maxWidth"];
|
33 |
|
34 |
|
35 | h?: StyledSystem.HeightProps["height"];
|
36 | minH?: StyledSystem.MinHeightProps["minHeight"];
|
37 | maxH?: StyledSystem.MaxHeightProps["maxHeight"];
|
38 |
|
39 |
|
40 | d?: StyledSystem.DisplayProps["display"];
|
41 |
|
42 |
|
43 | backgroundAttachment?: StyledSystem.ResponsiveValue<
|
44 | CSS["backgroundAttachment"]
|
45 | >;
|
46 | bgImg?: StyledSystem.BackgroundImageProps["backgroundImage"];
|
47 | bgImage?: StyledSystem.BackgroundImageProps["backgroundImage"];
|
48 | bgSize?: StyledSystem.BackgroundSizeProps["backgroundSize"];
|
49 | bgPos?: StyledSystem.BackgroundPositionProps["backgroundPosition"];
|
50 | pos?: StyledSystem.PositionProps["position"];
|
51 | flexDir?: StyledSystem.FlexDirectionProps["flexDirection"];
|
52 |
|
53 |
|
54 | textDecoration?: StyledSystem.ResponsiveValue<CSS["textDecoration"]>;
|
55 | textDecor?: StyledSystem.ResponsiveValue<CSS["textDecoration"]>;
|
56 | textTransform?: StyledSystem.ResponsiveValue<CSS["textTransform"]>;
|
57 | overflowX?: StyledSystem.OverflowProps["overflow"];
|
58 | overflowY?: StyledSystem.OverflowProps["overflow"];
|
59 | appearance?: StyledSystem.ResponsiveValue<CSS["appearance"]>;
|
60 | transform?: StyledSystem.ResponsiveValue<CSS["transform"]>;
|
61 | transformOrigin?: StyledSystem.ResponsiveValue<CSS["transformOrigin"]>;
|
62 | animation?: StyledSystem.ResponsiveValue<CSS["animation"]>;
|
63 | userSelect?: StyledSystem.ResponsiveValue<CSS["userSelect"]>;
|
64 | pointerEvents?: StyledSystem.ResponsiveValue<CSS["pointerEvents"]>;
|
65 | boxSizing?: StyledSystem.ResponsiveValue<CSS["boxSizing"]>;
|
66 | cursor?: StyledSystem.ResponsiveValue<CSS["cursor"]>;
|
67 | resize?: StyledSystem.ResponsiveValue<CSS["resize"]>;
|
68 | transition?: StyledSystem.ResponsiveValue<CSS["transition"]>;
|
69 | objectFit?: StyledSystem.ResponsiveValue<CSS["objectFit"]>;
|
70 | objectPosition?: StyledSystem.ResponsiveValue<CSS["objectPosition"]>;
|
71 | visibility?: StyledSystem.ResponsiveValue<CSS["visibility"]>;
|
72 |
|
73 |
|
74 | wordBreak?: StyledSystem.ResponsiveValue<CSS["wordBreak"]>;
|
75 | overflowWrap?: StyledSystem.ResponsiveValue<CSS["overflowWrap"]>;
|
76 | whiteSpace?: StyledSystem.ResponsiveValue<CSS["whiteSpace"]>;
|
77 |
|
78 |
|
79 | fill?: StyledSystem.ColorProps["color"];
|
80 | stroke?: StyledSystem.ColorProps["color"];
|
81 |
|
82 | bgAttachment?: StyledSystem.ResponsiveValue<CSS["backgroundAttachment"]>;
|
83 | shadow?: StyledSystem.BoxShadowProps["boxShadow"];
|
84 |
|
85 |
|
86 | listStyleType?: StyledSystem.ResponsiveValue<CSS["listStyleType"]>;
|
87 | listStylePosition?: StyledSystem.ResponsiveValue<CSS["listStylePosition"]>;
|
88 | listStyleImage?: StyledSystem.ResponsiveValue<CSS["listStyleImage"]>;
|
89 | listStyleImg?: StyledSystem.ResponsiveValue<CSS["listStyleImage"]>;
|
90 | listStylePos?: StyledSystem.ResponsiveValue<CSS["listStylePosition"]>;
|
91 |
|
92 |
|
93 | outline?: StyledSystem.ResponsiveValue<CSS["outline"]>;
|
94 | float?: StyledSystem.ResponsiveValue<CSS["float"]>;
|
95 | willChange?: StyledSystem.ResponsiveValue<CSS["willChange"]>;
|
96 |
|
97 |
|
98 | borderTopWidth?: StyledSystem.ResponsiveValue<CSS["borderTopWidth"]>;
|
99 | borderBottomWidth?: StyledSystem.ResponsiveValue<CSS["borderBottomWidth"]>;
|
100 | borderLeftWidth?: StyledSystem.ResponsiveValue<CSS["borderLeftWidth"]>;
|
101 | borderRightWidth?: StyledSystem.ResponsiveValue<CSS["borderRightWidth"]>;
|
102 | }
|
103 |
|
104 | type FontSize =
|
105 | | "xs"
|
106 | | "sm"
|
107 | | "base"
|
108 | | "lg"
|
109 | | "xl"
|
110 | | "2xl"
|
111 | | "3xl"
|
112 | | "4xl"
|
113 | | "5xl"
|
114 | | "6xl";
|
115 |
|
116 | interface IFontSize {
|
117 | fontSize?:
|
118 | | StyledSystem.ResponsiveValue<FontSize>
|
119 | | StyledSystem.FontSizeProps["fontSize"];
|
120 | }
|
121 |
|
122 | type FontWeight =
|
123 | | "hairline"
|
124 | | "thin"
|
125 | | "light"
|
126 | | "normal"
|
127 | | "medium"
|
128 | | "semibold"
|
129 | | "bold"
|
130 | | "extrabold"
|
131 | | "black";
|
132 |
|
133 | interface IFontWeight {
|
134 | fontWeight?:
|
135 | | StyledSystem.ResponsiveValue<FontWeight>
|
136 | | StyledSystem.FontWeightProps["fontWeight"];
|
137 | }
|
138 |
|
139 | type LineHeight = "none" | "shorter" | "short" | "normal" | "tall" | "taller";
|
140 |
|
141 | interface ILineHeight {
|
142 | lineHeight?:
|
143 | | StyledSystem.ResponsiveValue<LineHeight>
|
144 | | StyledSystem.LineHeightProps["lineHeight"];
|
145 | }
|
146 |
|
147 | type LetterSpacing =
|
148 | | "tighter"
|
149 | | "tight"
|
150 | | "normal"
|
151 | | "wide"
|
152 | | "wider"
|
153 | | "widest";
|
154 |
|
155 | interface ILetterSpacing {
|
156 | letterSpacing?:
|
157 | | StyledSystem.ResponsiveValue<LetterSpacing>
|
158 | | StyledSystem.LetterSpacingProps["letterSpacing"];
|
159 | }
|
160 |
|
161 | interface As {
|
162 | as?: React.ElementType;
|
163 | }
|
164 |
|
165 | type TypographyProps = Omit<
|
166 | StyledSystem.TypographyProps,
|
167 | "fontWeight" | "lineHeight" | "fontSize" | "letterSpacing"
|
168 | >;
|
169 |
|
170 | interface Truncated {
|
171 | |
172 |
|
173 |
|
174 | isTruncated?: boolean;
|
175 | }
|
176 |
|
177 | type StyledSystemProps = StyledSystem.LayoutProps &
|
178 | StyledSystem.ColorProps &
|
179 | StyledSystem.SpaceProps &
|
180 | StyledSystem.BordersProps &
|
181 | StyledSystem.BackgroundProps &
|
182 | StyledSystem.PositionProps &
|
183 | StyledSystem.FlexboxProps &
|
184 | StyledSystem.ShadowProps &
|
185 | StyledSystem.GridProps &
|
186 | StyledSystem.OpacityProps &
|
187 | StyledSystem.OverflowProps;
|
188 |
|
189 | type ModifiedStyledSystemProps = TypographyProps &
|
190 | IFontSize &
|
191 | ILetterSpacing &
|
192 | IFontWeight &
|
193 | ILineHeight &
|
194 | ICustomConfig;
|
195 |
|
196 | type BoxHTMLProps = React.RefAttributes<any> & React.HTMLAttributes<any>;
|
197 |
|
198 | export type BoxProps = BoxHTMLProps &
|
199 | StyledSystemProps &
|
200 | ModifiedStyledSystemProps &
|
201 | As &
|
202 | Truncated;
|
203 |
|
204 | declare const Box: React.FC<BoxProps>;
|
205 |
|
206 | export default Box;
|