Skip to content

Commit fde802e

Browse files
committed
feat: add maxW, maxH, minW, minH shortcuts
Closes #199
1 parent 0660565 commit fde802e

File tree

5 files changed

+84
-4
lines changed

5 files changed

+84
-4
lines changed

packages/system/src/styles/sizing.ts

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ type MaxWidthProp<T extends ITheme> = SystemProp<
7575
T
7676
>
7777
export interface MaxWidthProps<T extends ITheme = Theme> {
78+
// maxWidth
7879
maxWidth?: MaxWidthProp<T>
7980
motionSafeMaxWidth?: MaxWidthProp<T>
8081
motionReduceMaxWidth?: MaxWidthProp<T>
@@ -91,9 +92,27 @@ export interface MaxWidthProps<T extends ITheme = Theme> {
9192
activeMaxWidth?: MaxWidthProp<T>
9293
disabledMaxWidth?: MaxWidthProp<T>
9394
placeholderMaxWidth?: MaxWidthProp<T>
95+
96+
// maxW
97+
maxW?: MaxWidthProp<T>
98+
motionSafeMaxW?: MaxWidthProp<T>
99+
motionReduceMaxW?: MaxWidthProp<T>
100+
firstMaxW?: MaxWidthProp<T>
101+
lastMaxW?: MaxWidthProp<T>
102+
oddMaxW?: MaxWidthProp<T>
103+
evenMaxW?: MaxWidthProp<T>
104+
visitedMaxW?: MaxWidthProp<T>
105+
checkedMaxW?: MaxWidthProp<T>
106+
focusWithinMaxW?: MaxWidthProp<T>
107+
hoverMaxW?: MaxWidthProp<T>
108+
focusMaxW?: MaxWidthProp<T>
109+
focusVisibleMaxW?: MaxWidthProp<T>
110+
activeMaxW?: MaxWidthProp<T>
111+
disabledMaxW?: MaxWidthProp<T>
112+
placeholderMaxW?: MaxWidthProp<T>
94113
}
95114
export const maxWidth = style({
96-
prop: 'maxWidth',
115+
prop: ['maxWidth', 'maxW'],
97116
themeGet: getSize,
98117
})
99118

@@ -102,6 +121,7 @@ type MaxHeightProp<T extends ITheme> = SystemProp<
102121
T
103122
>
104123
export interface MaxHeightProps<T extends ITheme = Theme> {
124+
// maxHeight
105125
maxHeight?: MaxHeightProp<T>
106126
motionSafeMaxHeight?: MaxHeightProp<T>
107127
motionReduceMaxHeight?: MaxHeightProp<T>
@@ -118,9 +138,27 @@ export interface MaxHeightProps<T extends ITheme = Theme> {
118138
activeMaxHeight?: MaxHeightProp<T>
119139
disabledMaxHeight?: MaxHeightProp<T>
120140
placeholderMaxHeight?: MaxHeightProp<T>
141+
142+
// maxH
143+
maxH?: MaxWidthProp<T>
144+
motionSafeMaxH?: MaxWidthProp<T>
145+
motionReduceMaxH?: MaxWidthProp<T>
146+
firstMaxH?: MaxWidthProp<T>
147+
lastMaxH?: MaxWidthProp<T>
148+
oddMaxH?: MaxWidthProp<T>
149+
evenMaxH?: MaxWidthProp<T>
150+
visitedMaxH?: MaxWidthProp<T>
151+
checkedMaxH?: MaxWidthProp<T>
152+
focusWithinMaxH?: MaxWidthProp<T>
153+
hoverMaxH?: MaxWidthProp<T>
154+
focusMaxH?: MaxWidthProp<T>
155+
focusVisibleMaxH?: MaxWidthProp<T>
156+
activeMaxH?: MaxWidthProp<T>
157+
disabledMaxH?: MaxWidthProp<T>
158+
placeholderMaxH?: MaxWidthProp<T>
121159
}
122160
export const maxHeight = style({
123-
prop: 'maxHeight',
161+
prop: ['maxHeight', 'maxH'],
124162
themeGet: getSize,
125163
})
126164

@@ -129,6 +167,7 @@ type MinWidthProp<T extends ITheme> = SystemProp<
129167
T
130168
>
131169
export interface MinWidthProps<T extends ITheme = Theme> {
170+
// minWidth
132171
minWidth?: MinWidthProp<T>
133172
motionSafeMinWidth?: MinWidthProp<T>
134173
motionReduceMinWidth?: MinWidthProp<T>
@@ -145,9 +184,27 @@ export interface MinWidthProps<T extends ITheme = Theme> {
145184
activeMinWidth?: MinWidthProp<T>
146185
disabledMinWidth?: MinWidthProp<T>
147186
placeholderMinWidth?: MinWidthProp<T>
187+
188+
// minW
189+
minW?: MaxWidthProp<T>
190+
motionSafeMinW?: MaxWidthProp<T>
191+
motionReduceMinW?: MaxWidthProp<T>
192+
firstMinW?: MaxWidthProp<T>
193+
lastMinW?: MaxWidthProp<T>
194+
oddMinW?: MaxWidthProp<T>
195+
evenMinW?: MaxWidthProp<T>
196+
visitedMinW?: MaxWidthProp<T>
197+
checkedMinW?: MaxWidthProp<T>
198+
focusWithinMinW?: MaxWidthProp<T>
199+
hoverMinW?: MaxWidthProp<T>
200+
focusMinW?: MaxWidthProp<T>
201+
focusVisibleMinW?: MaxWidthProp<T>
202+
activeMinW?: MaxWidthProp<T>
203+
disabledMinW?: MaxWidthProp<T>
204+
placeholderMinW?: MaxWidthProp<T>
148205
}
149206
export const minWidth = style({
150-
prop: 'minWidth',
207+
prop: ['minWidth', 'minW'],
151208
themeGet: getSize,
152209
})
153210

@@ -156,6 +213,7 @@ type MinHeightProp<T extends ITheme> = SystemProp<
156213
T
157214
>
158215
export interface MinHeightProps<T extends ITheme = Theme> {
216+
// minHeight
159217
minHeight?: MinHeightProp<T>
160218
motionSafeMinHeight?: MinHeightProp<T>
161219
motionReduceMinHeight?: MinHeightProp<T>
@@ -172,9 +230,27 @@ export interface MinHeightProps<T extends ITheme = Theme> {
172230
activeMinHeight?: MinHeightProp<T>
173231
disabledMinHeight?: MinHeightProp<T>
174232
placeholderMinHeight?: MinHeightProp<T>
233+
234+
// minH
235+
minH?: MaxWidthProp<T>
236+
motionSafeMinH?: MaxWidthProp<T>
237+
motionReduceMinH?: MaxWidthProp<T>
238+
firstMinH?: MaxWidthProp<T>
239+
lastMinH?: MaxWidthProp<T>
240+
oddMinH?: MaxWidthProp<T>
241+
evenMinH?: MaxWidthProp<T>
242+
visitedMinH?: MaxWidthProp<T>
243+
checkedMinH?: MaxWidthProp<T>
244+
focusWithinMinH?: MaxWidthProp<T>
245+
hoverMinH?: MaxWidthProp<T>
246+
focusMinH?: MaxWidthProp<T>
247+
focusVisibleMinH?: MaxWidthProp<T>
248+
activeMinH?: MaxWidthProp<T>
249+
disabledMinH?: MaxWidthProp<T>
250+
placeholderMinH?: MaxWidthProp<T>
175251
}
176252
export const minHeight = style({
177-
prop: 'minHeight',
253+
prop: ['minHeight', 'minH'],
178254
themeGet: getSize,
179255
})
180256

website/pages/docs/sizing/max-height.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Utilities for setting the maximum height of an element.
1414
| React props | CSS Properties |
1515
| ------------------ | --------------------- |
1616
| `maxHeight={size}` | `max-height: {size};` |
17+
| `maxH={size}` | `max-height: {size};` |
1718

1819
## Scaled Max-Height
1920

website/pages/docs/sizing/max-width.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Utilities for setting the maximum width of an element
1414
| React props | CSS Properties |
1515
| ----------------- | -------------------- |
1616
| `maxWidth={size}` | `max-width: {size};` |
17+
| `maxW={size}` | `max-width: {size};` |
1718

1819
## Scaled Max-Width
1920

website/pages/docs/sizing/min-height.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Utilities for setting the minimum height of an element.
1414
| React props | CSS Properties |
1515
| ------------------ | --------------------- |
1616
| `minHeight={size}` | `min-height: {size};` |
17+
| `minH={size}` | `min-height: {size};` |
1718

1819
## Scaled Min-Height
1920

website/pages/docs/sizing/min-width.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Utilities for setting the minimum width of an element.
1414
| React props | CSS Properties |
1515
| ----------------- | -------------------- |
1616
| `minWidth={size}` | `min-width: {size};` |
17+
| `minW={size}` | `min-width: {size};` |
1718

1819
## Scaled Min-Width
1920

0 commit comments

Comments
 (0)