Skip to content

Commit

Permalink
Support VendorProperties in types
Browse files Browse the repository at this point in the history
  • Loading branch information
hasparus committed May 24, 2020
1 parent 77d5216 commit 9481bbb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 3 additions & 1 deletion packages/css/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export type ResponsiveStyleValue<T> = T | Array<T | null>
*/
export interface CSSProperties
extends CSS.StandardProperties<number | string>,
CSS.SvgProperties<number | string> {}
CSS.SvgProperties<number | string>,
CSS.VendorProperties<number | string>
{}

/**
* Map of all CSS pseudo selectors (`:hover`, `:focus`, ...)
Expand Down
14 changes: 10 additions & 4 deletions packages/css/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ test('works with the css prop', () => {
})

test('works with functional arguments', () => {
const result = css(t => ({
const result = css((t) => ({
color: t.colors.primary,
}))(theme)
expect(result).toEqual({
Expand All @@ -206,7 +206,7 @@ test('works with functional arguments', () => {

test('supports functional values', () => {
const result = css({
color: t => t.colors.primary,
color: (t) => t.colors.primary,
})(theme)
expect(result).toEqual({
color: 'tomato',
Expand Down Expand Up @@ -285,7 +285,7 @@ test('handles negative margins from scale that is an object', () => {
const result = css({
mt: '-s',
mx: '-m',
})({...theme, space: { s: '16px', m: '32px' }})
})({ ...theme, space: { s: '16px', m: '32px' } })
expect(result).toEqual({
marginTop: '-16px',
marginLeft: '-32px',
Expand Down Expand Up @@ -344,7 +344,7 @@ test('ignores array values longer than breakpoints', () => {

test('functional values can return responsive arrays', () => {
const result = css({
color: t => [t.colors.primary, t.colors.secondary],
color: (t) => [t.colors.primary, t.colors.secondary],
})(theme)
expect(result).toEqual({
'@media screen and (min-width: 40em)': {
Expand Down Expand Up @@ -494,3 +494,9 @@ test('returns correct media query order 2', () => {
'paddingBottom',
])
})

test('supports vendor properties', () => {
expect(css({ WebkitOverflowScrolling: 'touch' })(theme)).toBe({
WebkitOverflowScrolling: 'touch',
})
})
4 changes: 2 additions & 2 deletions packages/sidenav/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const Sidenav = forwardRef<
transition: 'transform .2s ease-out',
transform: [open ? 'translateX(0)' : 'translate(-100%)', 'none'],
bg: ['background', 'transparent'],
...{ WebkitOverflowScrolling: 'touch' },
WebkitOverflowScrolling: 'touch',
}}
/>
</MDXProvider>
Expand Down Expand Up @@ -267,7 +267,7 @@ export const AccordionNav = forwardRef<
transition: 'transform .2s ease-out',
transform: [open ? 'translateX(0)' : 'translate(-100%)', 'none'],
bg: ['background', 'transparent'],
...{ WebkitOverflowScrolling: 'touch' },
WebkitOverflowScrolling: 'touch',
}}>
<ul
sx={{
Expand Down

0 comments on commit 9481bbb

Please sign in to comment.