Skip to content

Commit d47fe6b

Browse files
authored
Merge pull request #797 from lachlanjc/logical
Add support for CSS Logical Properties
2 parents 0a7eb69 + 5716886 commit d47fe6b

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

packages/css/src/index.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,32 @@ export const scales = {
6565
marginLeft: 'space',
6666
marginX: 'space',
6767
marginY: 'space',
68+
marginBlock: 'space',
69+
marginBlockEnd: 'space',
70+
marginBlockStart: 'space',
71+
marginInline: 'space',
72+
marginInlineEnd: 'space',
73+
marginInlineStart: 'space',
6874
padding: 'space',
6975
paddingTop: 'space',
7076
paddingRight: 'space',
7177
paddingBottom: 'space',
7278
paddingLeft: 'space',
7379
paddingX: 'space',
7480
paddingY: 'space',
81+
paddingBlock: 'space',
82+
paddingBlockEnd: 'space',
83+
paddingBlockStart: 'space',
84+
paddingInline: 'space',
85+
paddingInlineEnd: 'space',
86+
paddingInlineStart: 'space',
87+
inset: 'space',
88+
insetBlock: 'space',
89+
insetBlockEnd: 'space',
90+
insetBlockStart: 'space',
91+
insetInline: 'space',
92+
insetInlineEnd: 'space',
93+
insetInlineStart: 'space',
7594
top: 'space',
7695
right: 'space',
7796
bottom: 'space',
@@ -111,6 +130,28 @@ export const scales = {
111130
borderRightWidth: 'borderWidths',
112131
borderRightColor: 'colors',
113132
borderRightStyle: 'borderStyles',
133+
borderBlock: 'borders',
134+
borderBlockEnd: 'borders',
135+
borderBlockEndStyle: 'borderStyles',
136+
borderBlockEndWidth: 'borderWidths',
137+
borderBlockStart: 'borders',
138+
borderBlockStartStyle: 'borderStyles',
139+
borderBlockStartWidth: 'borderWidths',
140+
borderBlockStyle: 'borderStyles',
141+
borderBlockWidth: 'borderWidths',
142+
borderEndEndRadius: 'radii',
143+
borderEndStartRadius: 'radii',
144+
borderInline: 'borders',
145+
borderInlineEnd: 'borders',
146+
borderInlineEndStyle: 'borderStyles',
147+
borderInlineEndWidth: 'borderWidths',
148+
borderInlineStart: 'borders',
149+
borderInlineStartStyle: 'borderStyles',
150+
borderInlineStartWidth: 'borderWidths',
151+
borderInlineStyle: 'borderStyles',
152+
borderInlineWidth: 'borderWidths',
153+
borderStartEndRadius: 'radii',
154+
borderStartStartRadius: 'radii',
114155
outlineColor: 'colors',
115156
boxShadow: 'shadows',
116157
textShadow: 'shadows',
@@ -123,6 +164,12 @@ export const scales = {
123164
maxHeight: 'sizes',
124165
flexBasis: 'sizes',
125166
size: 'sizes',
167+
blockSize: 'sizes',
168+
inlineSize: 'sizes',
169+
maxBlockSize: 'sizes',
170+
maxInlineSize: 'sizes',
171+
minBlockSize: 'sizes',
172+
minInlineSize: 'sizes',
126173
// svg
127174
fill: 'colors',
128175
stroke: 'colors',
@@ -152,6 +199,12 @@ const transforms = [
152199
'marginLeft',
153200
'marginX',
154201
'marginY',
202+
'marginBlock',
203+
'marginBlockEnd',
204+
'marginBlockStart',
205+
'marginInline',
206+
'marginInlineEnd',
207+
'marginInlineStart',
155208
'top',
156209
'bottom',
157210
'left',

packages/css/test/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,25 @@ test('handles all core styled system props', () => {
163163
})
164164
})
165165

166+
test('handles css logical properties', () => {
167+
const result = css({
168+
borderInlineStartWidth: 'thin',
169+
borderStartEndRadius: 'small',
170+
marginInlineStart: 'auto',
171+
maxBlockSize: 'large',
172+
paddingInline: 0,
173+
marginBlockEnd: 2,
174+
})({ theme })
175+
expect(result).toEqual({
176+
borderInlineStartWidth: 1,
177+
borderStartEndRadius: 5,
178+
maxBlockSize: 16,
179+
paddingInline: 0,
180+
marginBlockEnd: 8,
181+
marginInlineStart: 'auto',
182+
})
183+
})
184+
166185
test('works with the css prop', () => {
167186
const result = css({
168187
color: 'primary',

0 commit comments

Comments
 (0)