Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

styled-system

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

styled-system - npm Package Compare versions

Comparing version 1.0.0-7 to 1.0.0-8

dist/responsive-style.js

2

dist/index.js

@@ -7,2 +7,3 @@ 'use strict';

var color = require('./color');
var responsiveStyle = require('./responsive-style');
var removeProps = require('./remove-props');

@@ -17,2 +18,3 @@ var util = require('./util');

color: color,
responsiveStyle: responsiveStyle,
removeProps: removeProps,

@@ -19,0 +21,0 @@ util: util,

2

package.json
{
"name": "styled-system",
"version": "1.0.0-7",
"version": "1.0.0-8",
"description": "Design system utilities for styled-components, glamorous, and other css-in-js libraries",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -154,2 +154,26 @@ # styled-system

## responsiveStyle
The `responsiveStyle` utility can be used to handle array-based responsive style props for other CSS properties.
```js
import styled from 'styled-components'
import { responsiveStyle } from 'styled-system'
// Usage
// responsiveStyle(cssProperty[, propName][, booleanValue])
const Flex = styled.div`
display: flex;
${responsiveStyle('flex-direction', 'direction')}
`
const App = props => (
<Flex direction={[ 'column', 'row' ]}>
<div>Responsive</div>
<div>Direction</div>
</Flex>
)
```
## Remove Props

@@ -156,0 +180,0 @@

@@ -5,2 +5,3 @@ const space = require('./space')

const color = require('./color')
const responsiveStyle = require('./responsive-style')
const removeProps = require('./remove-props')

@@ -15,2 +16,3 @@ const util = require('./util')

color,
responsiveStyle,
removeProps,

@@ -17,0 +19,0 @@ util,

@@ -8,2 +8,3 @@ import test from 'ava'

color,
responsiveStyle,
removeProps,

@@ -425,2 +426,57 @@ util

test('responsiveStyle returns a function', t => {
const sx = responsiveStyle('order')
t.is(typeof sx, 'function')
})
test('responsiveStyle‘s returned function returns a style object', t => {
const order = responsiveStyle('order')
const a = order({ order: 1 })
t.deepEqual(a, { order: 1 })
})
test('responsiveStyle‘s returned function returns null', t => {
const order = responsiveStyle('order')
const a = order({ })
t.is(a, null)
})
test('responsiveStyle allows property aliases', t => {
const direction = responsiveStyle('flex-direction', 'direction')
const a = direction({ direction: 'column' })
t.deepEqual(a, {
'flex-direction': 'column'
})
})
test('responsiveStyle allows array values', t => {
const direction = responsiveStyle('flex-direction', 'direction')
const a = direction({ direction: [ 'column', 'row' ] })
t.deepEqual(a, {
'flex-direction': 'column',
'@media screen and (min-width: 40em)': {
'flex-direction': 'row',
}
})
})
test('responsiveStyle can be configured for boolean props', t => {
const wrap = responsiveStyle('flex-wrap', 'wrap', 'wrap')
const a = wrap({ wrap: true })
t.deepEqual(a, {
'flex-wrap': 'wrap'
})
})
test('responsiveStyle boolean props handle arrays', t => {
const wrap = responsiveStyle('flex-wrap', 'wrap', 'wrap')
const a = wrap({ wrap: [ true, false ] })
t.deepEqual(a, {
'flex-wrap': 'wrap',
'@media screen and (min-width: 40em)': {
'flex-wrap': false
}
})
})
test('breakpoints can be configured with a theme', t => {

@@ -427,0 +483,0 @@ const a = space({theme, m: [1, 2, 3, 4]})

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc