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

@govuk-react/error-text

Package Overview
Dependencies
Maintainers
5
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@govuk-react/error-text - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

27

es/index.js
var _styled;
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';

@@ -25,13 +21,20 @@ import { withWhiteSpace } from '@govuk-react/hoc';

}, _styled.color = "" + ERROR_COLOUR, _styled.paddingTop = '4px', _styled.paddingBottom = '2px', _styled));
/**
*
* ### Usage
*
*
* Simple
* ```jsx
* <ErrorText errorText="example">Example</ErrorText>
* ```
*
* ### References
* - https://github.com/alphagov/govuk-frontend/tree/master/src/components
*/
var ErrorText = function ErrorText(_ref) {
var children = _ref.children,
props = _objectWithoutProperties(_ref, ["children"]);
return React.createElement(StyledError, props, children);
var ErrorText = function ErrorText(props) {
return React.createElement(StyledError, props);
};
ErrorText.propTypes = process.env.NODE_ENV !== "production" ? {
children: PropTypes.node.isRequired
} : {};
export default withWhiteSpace({

@@ -38,0 +41,0 @@ marginBottom: 0

import React from 'react';
import { storiesOf } from '@storybook/react';
import { WithDocsCustom } from '@govuk-react/storybook-components';
import ErrorText from '.';
storiesOf('ErrorText', module).add('Component default', function () {
import ReadMe from '../README.md';
var stories = storiesOf('Typography/Error text', module);
stories.addDecorator(WithDocsCustom(ReadMe));
stories.add('Component default', function () {
return React.createElement(ErrorText, {

@@ -6,0 +10,0 @@ errorText: "example"

@@ -10,4 +10,2 @@ "use strict";

var _propTypes = _interopRequireDefault(require("prop-types"));
var _govukColours = require("govuk-colours");

@@ -23,4 +21,2 @@

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 StyledError = (0, _reactEmotion.default)('span')((_styled = {

@@ -39,14 +35,20 @@ display: 'block',

}, _styled.color = "" + _govukColours.ERROR_COLOUR, _styled.paddingTop = '4px', _styled.paddingBottom = '2px', _styled));
/**
*
* ### Usage
*
*
* Simple
* ```jsx
* <ErrorText errorText="example">Example</ErrorText>
* ```
*
* ### References
* - https://github.com/alphagov/govuk-frontend/tree/master/src/components
*/
var ErrorText = function ErrorText(_ref) {
var children = _ref.children,
props = _objectWithoutProperties(_ref, ["children"]);
return _react.default.createElement(StyledError, props, children);
var ErrorText = function ErrorText(props) {
return _react.default.createElement(StyledError, props);
};
ErrorText.propTypes = process.env.NODE_ENV !== "production" ? {
children: _propTypes.default.node.isRequired
} : {};
var _default = (0, _hoc.withWhiteSpace)({

@@ -53,0 +55,0 @@ marginBottom: 0

@@ -7,7 +7,13 @@ "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)('ErrorText', module).add('Component default', function () {
var stories = (0, _react2.storiesOf)('Typography/Error text', module);
stories.addDecorator((0, _storybookComponents.WithDocsCustom)(_README.default));
stories.add('Component default', function () {
return _react.default.createElement(_.default, {

@@ -14,0 +20,0 @@ errorText: "example"

{
"name": "@govuk-react/error-text",
"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,

ErrorText
=========
![Component Image](./docs/ErrorText.png)
### Import
```js
import ErrorText from '@govuk-react/error-text';
```
<!-- STORY -->
### Usage
Simple
```jsx
<ErrorText errorText="example">Example</ErrorText>
```
### References
- https://github.com/alphagov/govuk-frontend/tree/master/src/components

@@ -1,6 +0,3 @@

// 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';

@@ -33,12 +30,17 @@ import { withWhiteSpace } from '@govuk-react/hoc';

const ErrorText = ({ children, ...props }) => (
<StyledError {...props}>
{children}
</StyledError>
);
/**
*
* ### Usage
*
*
* Simple
* ```jsx
* <ErrorText errorText="example">Example</ErrorText>
* ```
*
* ### References
* - https://github.com/alphagov/govuk-frontend/tree/master/src/components
*/
const ErrorText = props => <StyledError {...props} />;
ErrorText.propTypes = {
children: PropTypes.node.isRequired,
};
export default withWhiteSpace({ marginBottom: 0 })(ErrorText);
import React from 'react';
import { storiesOf } from '@storybook/react';
import { WithDocsCustom } from '@govuk-react/storybook-components';
import ErrorText from '.';
import ReadMe from '../README.md';
storiesOf('ErrorText', module).add('Component default', () => (
const stories = storiesOf('Typography/Error text', module);
stories.addDecorator(WithDocsCustom(ReadMe));
stories.add('Component default', () => (
<ErrorText errorText="example">Example</ErrorText>
));

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

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