@govuk-react/label
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -1,15 +0,8 @@ | ||
var _styled; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
// https://github.com/alphagov/govuk-frontend/tree/master/src/components/ | ||
import styled from 'react-emotion'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { ERROR_COLOUR } from 'govuk-colours'; | ||
import { MEDIA_QUERIES, SITE_WIDTH, SPACING } from '@govuk-react/constants'; | ||
import { SPACING } from '@govuk-react/constants'; | ||
import { withWhiteSpace } from '@govuk-react/hoc'; | ||
var StyledLabel = styled('label')((_styled = { | ||
var StyledLabel = styled('label')({ | ||
display: 'flex', | ||
@@ -24,5 +17,3 @@ flexDirection: 'column', | ||
} | ||
}, _styled[MEDIA_QUERIES.LARGESCREEN] = { | ||
maxWidth: SITE_WIDTH | ||
}, _styled), function (_ref) { | ||
}, function (_ref) { | ||
var error = _ref.error; | ||
@@ -35,18 +26,20 @@ return { | ||
}); | ||
/** | ||
* | ||
* ### Usage | ||
* | ||
* Simple | ||
* ```jsx | ||
* <Label>Example</Label> | ||
* ``` | ||
* | ||
* ### References: | ||
* - https://github.com/alphagov/govuk-frontend/tree/master/src/components/ | ||
* | ||
*/ | ||
var Label = function Label(_ref2) { | ||
var className = _ref2.className, | ||
props = _objectWithoutProperties(_ref2, ["className"]); | ||
return React.createElement(StyledLabel, _extends({ | ||
className: className | ||
}, props)); | ||
var Label = function Label(props) { | ||
return React.createElement(StyledLabel, props); | ||
}; | ||
Label.defaultProps = { | ||
className: undefined | ||
}; | ||
Label.propTypes = process.env.NODE_ENV !== "production" ? { | ||
className: PropTypes.string | ||
} : {}; | ||
export default withWhiteSpace({ | ||
@@ -53,0 +46,0 @@ marginBottom: 0 |
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { WithDocsCustom } from '@govuk-react/storybook-components'; | ||
import Label from '.'; | ||
storiesOf('Label', module).add('Component default', function () { | ||
import ReadMe from '../README.md'; | ||
var stories = storiesOf('Form/Label', module); | ||
stories.addDecorator(WithDocsCustom(ReadMe)); | ||
stories.add('Component default', function () { | ||
return React.createElement(Label, null, "Example"); | ||
}); | ||
//# sourceMappingURL=stories.js.map |
@@ -10,4 +10,2 @@ "use strict"; | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _govukColours = require("govuk-colours"); | ||
@@ -19,11 +17,6 @@ | ||
var _styled; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
var StyledLabel = (0, _reactEmotion.default)('label')((_styled = { | ||
// https://github.com/alphagov/govuk-frontend/tree/master/src/components/ | ||
var StyledLabel = (0, _reactEmotion.default)('label')({ | ||
display: 'flex', | ||
@@ -38,5 +31,3 @@ flexDirection: 'column', | ||
} | ||
}, _styled[_constants.MEDIA_QUERIES.LARGESCREEN] = { | ||
maxWidth: _constants.SITE_WIDTH | ||
}, _styled), function (_ref) { | ||
}, function (_ref) { | ||
var error = _ref.error; | ||
@@ -49,19 +40,20 @@ return { | ||
}); | ||
/** | ||
* | ||
* ### Usage | ||
* | ||
* Simple | ||
* ```jsx | ||
* <Label>Example</Label> | ||
* ``` | ||
* | ||
* ### References: | ||
* - https://github.com/alphagov/govuk-frontend/tree/master/src/components/ | ||
* | ||
*/ | ||
var Label = function Label(_ref2) { | ||
var className = _ref2.className, | ||
props = _objectWithoutProperties(_ref2, ["className"]); | ||
return _react.default.createElement(StyledLabel, _extends({ | ||
className: className | ||
}, props)); | ||
var Label = function Label(props) { | ||
return _react.default.createElement(StyledLabel, props); | ||
}; | ||
Label.defaultProps = { | ||
className: undefined | ||
}; | ||
Label.propTypes = process.env.NODE_ENV !== "production" ? { | ||
className: _propTypes.default.string | ||
} : {}; | ||
var _default = (0, _hoc.withWhiteSpace)({ | ||
@@ -68,0 +60,0 @@ marginBottom: 0 |
@@ -7,9 +7,15 @@ "use strict"; | ||
var _storybookComponents = require("@govuk-react/storybook-components"); | ||
var _ = _interopRequireDefault(require(".")); | ||
var _README = _interopRequireDefault(require("../README.md")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
(0, _react2.storiesOf)('Label', module).add('Component default', function () { | ||
var stories = (0, _react2.storiesOf)('Form/Label', module); | ||
stories.addDecorator((0, _storybookComponents.WithDocsCustom)(_README.default)); | ||
stories.add('Component default', function () { | ||
return _react.default.createElement(_.default, null, "Example"); | ||
}); | ||
//# sourceMappingURL=stories.js.map |
{ | ||
"name": "@govuk-react/label", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"dependencies": { | ||
"@govuk-react/constants": "^0.2.1", | ||
"@govuk-react/hoc": "^0.2.1", | ||
"@govuk-react/constants": "^0.2.2", | ||
"@govuk-react/hoc": "^0.2.2", | ||
"govuk-colours": "^1.0.3" | ||
@@ -25,3 +25,3 @@ }, | ||
"license": "MIT", | ||
"homepage": "https://github.com/penx/govuk-react#readme", | ||
"homepage": "https://github.com/UKHomeOffice/govuk-react#readme", | ||
"description": "govuk-react: A port of the govuk-frontend components for React using Emotion.", | ||
@@ -28,0 +28,0 @@ "private": false, |
Label | ||
===== | ||
![Component Image](./docs/Label.png) | ||
### Import | ||
```js | ||
import Label from '@govuk-react/label'; | ||
``` | ||
<!-- STORY --> | ||
### Usage | ||
Simple | ||
```jsx | ||
<Label>Example</Label> | ||
``` | ||
### References: | ||
- https://github.com/alphagov/govuk-frontend/tree/master/src/components/ | ||
@@ -5,5 +5,4 @@ // https://github.com/alphagov/govuk-frontend/tree/master/src/components/ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { ERROR_COLOUR } from 'govuk-colours'; | ||
import { MEDIA_QUERIES, SITE_WIDTH, SPACING } from '@govuk-react/constants'; | ||
import { SPACING } from '@govuk-react/constants'; | ||
import { withWhiteSpace } from '@govuk-react/hoc'; | ||
@@ -22,5 +21,2 @@ | ||
}, | ||
[MEDIA_QUERIES.LARGESCREEN]: { | ||
maxWidth: SITE_WIDTH, | ||
}, | ||
}, | ||
@@ -34,12 +30,17 @@ ({ error }) => ({ | ||
const Label = ({ className, ...props }) => (<StyledLabel className={className} {...props} />); | ||
/** | ||
* | ||
* ### Usage | ||
* | ||
* Simple | ||
* ```jsx | ||
* <Label>Example</Label> | ||
* ``` | ||
* | ||
* ### References: | ||
* - https://github.com/alphagov/govuk-frontend/tree/master/src/components/ | ||
* | ||
*/ | ||
const Label = props => <StyledLabel {...props} />; | ||
Label.defaultProps = { | ||
className: undefined, | ||
}; | ||
Label.propTypes = { | ||
className: PropTypes.string, | ||
}; | ||
export default withWhiteSpace({ marginBottom: 0 })(Label); |
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { WithDocsCustom } from '@govuk-react/storybook-components'; | ||
import Label from '.'; | ||
import ReadMe from '../README.md'; | ||
storiesOf('Label', module).add('Component default', () => ( | ||
const stories = storiesOf('Form/Label', module); | ||
stories.addDecorator(WithDocsCustom(ReadMe)); | ||
stories.add('Component default', () => ( | ||
<Label>Example</Label> | ||
)); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
21
1
20512
19
226
Updated@govuk-react/hoc@^0.2.2