styled-system
Advanced tools
Comparing version 1.0.0-6 to 1.0.0-7
@@ -29,5 +29,8 @@ 'use strict'; | ||
return function (n) { | ||
return obj[n] || n; | ||
return idx(getKeys(n), obj) || n; | ||
}; | ||
}; | ||
var getKeys = function getKeys(n) { | ||
return typeof n === 'string' ? n.split('.') : [n]; | ||
}; | ||
@@ -34,0 +37,0 @@ var properties = { |
{ | ||
"name": "styled-system", | ||
"version": "1.0.0-6", | ||
"version": "1.0.0-7", | ||
"description": "Design system utilities for styled-components, glamorous, and other css-in-js libraries", | ||
@@ -30,2 +30,3 @@ "main": "dist/index.js", | ||
"grid-styled": "^2.0.0-2", | ||
"palx": "^1.0.2", | ||
"react": "^15.6.0", | ||
@@ -32,0 +33,0 @@ "react-dom": "^15.6.0", |
@@ -49,2 +49,3 @@ # styled-system | ||
<Box color='tomato' /> | ||
<Box color='grays.0' /> | ||
@@ -130,3 +131,3 @@ // background color | ||
By default the raw value of the prop is returned. | ||
Color palettes can be configured with the [ThemeProvider](#configuration) to use keys as prop values. | ||
Color palettes can be configured with the [ThemeProvider](#configuration) to use keys as prop values, with support for dot notation. | ||
Array values are converted into [responsive values](#responsive-styles). | ||
@@ -133,0 +134,0 @@ |
@@ -21,3 +21,4 @@ const { breaks, idx, merge, arr, dec, media } = require('./util') | ||
const cx = obj => n => obj[n] || n | ||
const cx = obj => n => idx(getKeys(n), obj) || n | ||
const getKeys = n => typeof n === 'string' ? n.split('.') : [ n ] | ||
@@ -24,0 +25,0 @@ const properties = { |
13
test.js
import test from 'ava' | ||
import palx from 'palx' | ||
import { | ||
@@ -11,2 +12,4 @@ space, | ||
const palette = palx('#07c') | ||
const theme = { | ||
@@ -412,2 +415,12 @@ breakpoints: [32, 48, 64], | ||
test('color keys support dot notation', t => { | ||
const a = color({ | ||
theme: { | ||
colors: palette | ||
}, | ||
color: 'gray.2' | ||
}) | ||
t.is(a.color, palette.gray[2]) | ||
}) | ||
test('breakpoints can be configured with a theme', t => { | ||
@@ -414,0 +427,0 @@ const a = space({theme, m: [1, 2, 3, 4]}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29871
848
265
18