diff --git a/package.json b/package.json index fb209877f5b..92ba83f5ff1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@primer/components", - "version": "8.0.0-beta", + "version": "8.2.0-beta", "description": "Primer react components", "main": "dist/index.umd.js", "module": "dist/index.esm.js", @@ -46,6 +46,7 @@ "primer-typography": "1.0.1", "react": "16.4.2", "react-dom": "16.4.2", + "styled-components": "4.1.2", "styled-system": "3.1.3", "system-components": "3.0.1" }, @@ -86,7 +87,6 @@ "rollup": "0.62.0", "rollup-plugin-babel": "4.0.0-beta.8", "rollup-plugin-commonjs": "9.1.3", - "sass.macro": "0.1.0", - "styled-components": "4.1.2" + "sass.macro": "0.1.0" } } diff --git a/src/Box.js b/src/Box.js index b2c162e0509..a858956d36b 100644 --- a/src/Box.js +++ b/src/Box.js @@ -1,9 +1,9 @@ import styled from 'styled-components' import PropTypes from 'prop-types' -import {LAYOUT, COMMON} from './constants' +import {LAYOUT, COMMON, Base} from './constants' import theme from './theme' -const Box = styled.div` +const Box = styled(Base)` ${LAYOUT} ${COMMON}; ` diff --git a/src/CircleOcticon.js b/src/CircleOcticon.js index d683d70104c..ba53c9e2b65 100644 --- a/src/CircleOcticon.js +++ b/src/CircleOcticon.js @@ -6,10 +6,10 @@ import theme from './theme' import BorderBox from './BorderBox' function CircleOcticon(props) { - const {size} = props + const {size, is} = props const {icon, bg, ...rest} = props return ( - + diff --git a/src/Flash.js b/src/Flash.js index 5e711493c92..4cb53dd114b 100644 --- a/src/Flash.js +++ b/src/Flash.js @@ -1,6 +1,6 @@ import PropTypes from 'prop-types' import styled from 'styled-components' -import {COMMON, get} from './constants' +import {COMMON, get, Base} from './constants' import theme from './theme' const schemeMap = { @@ -10,7 +10,7 @@ const schemeMap = { base: {color: 'colors.blue.8', bg: 'colors.blue.1'} } -const Flash = styled.div` +const Flash = styled(Base)` position: relative; padding: ${get('space.3')}px; color: ${props => get(schemeMap[props.scheme] ? schemeMap[props.scheme].color : '')}; diff --git a/src/PointerBox.js b/src/PointerBox.js index 5903c00ca20..0718099760e 100644 --- a/src/PointerBox.js +++ b/src/PointerBox.js @@ -7,11 +7,11 @@ import {Relative} from './Position' function PointerBox(props) { // don't destructure these, just grab them - const {bg, border, borderColor} = props + const {bg, border, borderColor, is} = props const {caret, children, ...boxProps} = props const caretProps = {bg, borderColor, borderWidth: border, location: caret} return ( - + {children} diff --git a/src/__tests__/BorderBox.js b/src/__tests__/BorderBox.js index 05a9a6f95e7..4b59d59ca91 100644 --- a/src/__tests__/BorderBox.js +++ b/src/__tests__/BorderBox.js @@ -14,6 +14,10 @@ describe('BorderBox', () => { expect(BorderBox).toSetDefaultTheme() }) + it('respects the "is" prop', () => { + expect(render().type).toEqual('span') + }) + it('renders borders', () => { expect(render()).toHaveStyleRule('border-color', colors.green[5]) expect(render()).toHaveStyleRule('border-bottom', '0') diff --git a/src/__tests__/Box.js b/src/__tests__/Box.js index a2f89901ca4..027dbf138fd 100644 --- a/src/__tests__/Box.js +++ b/src/__tests__/Box.js @@ -10,6 +10,10 @@ describe('Box', () => { expect(Box).toImplementSystemProps(COMMON) }) + it('respects the "is" prop', () => { + expect(render().type).toEqual('span') + }) + it('renders without any props', () => { expect(render()).toMatchSnapshot() }) diff --git a/src/__tests__/CircleOcticon.js b/src/__tests__/CircleOcticon.js index b8bb5246b41..3c2ba42f935 100644 --- a/src/__tests__/CircleOcticon.js +++ b/src/__tests__/CircleOcticon.js @@ -28,4 +28,8 @@ describe('CircleOcticon', () => { expect(result).toHaveStyleRule('width', '32px') expect(result).toHaveStyleRule('height', '32px') }) + + it('respects the "is" prop', () => { + expect(render().type).toEqual('span') + }) }) diff --git a/src/__tests__/CounterLabel.js b/src/__tests__/CounterLabel.js index 7753714f1e9..ba0afae436d 100644 --- a/src/__tests__/CounterLabel.js +++ b/src/__tests__/CounterLabel.js @@ -29,4 +29,8 @@ describe('CounterLabel', () => { it('implements system props', () => { expect(CounterLabel).toImplementSystemProps(COMMON) }) + + it('respects the "is" prop', () => { + expect(render().type).toEqual('span') + }) }) diff --git a/src/__tests__/Flash.js b/src/__tests__/Flash.js index 67a8ecf05fd..cbc5c68696c 100644 --- a/src/__tests__/Flash.js +++ b/src/__tests__/Flash.js @@ -19,6 +19,10 @@ describe('Flash', () => { expect(render()).toHaveStyleRule('border-width', '1px 0px') }) + it('respects the "is" prop', () => { + expect(render().type).toEqual('span') + }) + it('respects the "scheme" prop', () => { expect(render()).toHaveStyleRule('color', colors.yellow[9]) expect(render()).toHaveStyleRule('color', colors.red[9]) diff --git a/src/__tests__/Label.js b/src/__tests__/Label.js index 2fff472871e..281ad6fb012 100644 --- a/src/__tests__/Label.js +++ b/src/__tests__/Label.js @@ -13,6 +13,10 @@ describe('Label', () => { expect(render(