@govuk-react/hoc
Advanced tools
Comparing version 0.6.0-alpha.4 to 0.6.0-rc.1
@@ -5,9 +5,10 @@ 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); } | ||
import Link from '@govuk-react/link'; | ||
import deprecate from '../deprecate'; | ||
var asAnchor = function asAnchor(AnchorType) { | ||
return function (props) { | ||
return deprecate(function (props) { | ||
return React.createElement(Link, _extends({ | ||
as: AnchorType | ||
}, props)); | ||
}; | ||
}, '(use of asAnchor HOC - please use Link component instead)'); | ||
}; | ||
@@ -14,0 +15,0 @@ |
export { default as asAnchor } from './asAnchor'; | ||
export { default as asPaginationItem } from './asPaginationItem'; | ||
export { default as deprecate } from './deprecate'; | ||
export { default as withWhiteSpace } from './withWhiteSpace'; | ||
//# sourceMappingURL=index.js.map |
@@ -6,3 +6,4 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
import styled from 'styled-components'; | ||
import { spacing } from '@govuk-react/lib'; // NB withWhiteSpace HOC is DEPRECATED | ||
import { spacing } from '@govuk-react/lib'; | ||
import deprecate from '../deprecate'; // NB withWhiteSpace HOC is DEPRECATED | ||
// Please use `spacing.withWhiteSpace(config)` instead in styled components | ||
@@ -12,3 +13,3 @@ | ||
return function (Component) { | ||
var StyledHoc = styled(Component)(spacing.withWhiteSpace(config)); | ||
var StyledHoc = styled(deprecate(Component, '(use of withWhiteSpace HOC - Please use `spacing.withWhiteSpace(config)` instead in styled components)'))(spacing.withWhiteSpace(config)); | ||
StyledHoc.propTypes = _objectSpread({}, spacing.withWhiteSpace.propTypes); | ||
@@ -15,0 +16,0 @@ return StyledHoc; |
@@ -12,3 +12,3 @@ import React, { Fragment } from 'react'; | ||
import FileUpload from '@govuk-react/file-upload'; | ||
import Header from '@govuk-react/header'; | ||
import Heading from '@govuk-react/heading'; | ||
import HintText from '@govuk-react/hint-text'; | ||
@@ -138,4 +138,4 @@ import Input from '@govuk-react/input'; | ||
mb: number('File Upload marginBottom', 9) | ||
}, "Example"), React.createElement(Header, { | ||
mb: number('Header marginBottom', 9) | ||
}, "Example"), React.createElement(Heading, { | ||
mb: number('Heading marginBottom', 9) | ||
}, "Example"), React.createElement(HintText, { | ||
@@ -142,0 +142,0 @@ mb: number('HintText marginBottom', 9) |
@@ -10,2 +10,4 @@ "use strict"; | ||
var _deprecate = _interopRequireDefault(require("../deprecate")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -16,7 +18,7 @@ | ||
var asAnchor = function asAnchor(AnchorType) { | ||
return function (props) { | ||
return (0, _deprecate.default)(function (props) { | ||
return _react.default.createElement(_link.default, _extends({ | ||
as: AnchorType | ||
}, props)); | ||
}; | ||
}, '(use of asAnchor HOC - please use Link component instead)'); | ||
}; | ||
@@ -23,0 +25,0 @@ |
"use strict"; | ||
exports.__esModule = true; | ||
exports.withWhiteSpace = exports.asPaginationItem = exports.asAnchor = void 0; | ||
exports.withWhiteSpace = exports.deprecate = exports.asPaginationItem = exports.asAnchor = void 0; | ||
@@ -14,2 +14,6 @@ var _asAnchor = _interopRequireDefault(require("./asAnchor")); | ||
var _deprecate = _interopRequireDefault(require("./deprecate")); | ||
exports.deprecate = _deprecate.default; | ||
var _withWhiteSpace = _interopRequireDefault(require("./withWhiteSpace")); | ||
@@ -16,0 +20,0 @@ |
@@ -10,2 +10,4 @@ "use strict"; | ||
var _deprecate = _interopRequireDefault(require("../deprecate")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -21,3 +23,3 @@ | ||
return function (Component) { | ||
var StyledHoc = (0, _styledComponents.default)(Component)(_lib.spacing.withWhiteSpace(config)); | ||
var StyledHoc = (0, _styledComponents.default)((0, _deprecate.default)(Component, '(use of withWhiteSpace HOC - Please use `spacing.withWhiteSpace(config)` instead in styled components)'))(_lib.spacing.withWhiteSpace(config)); | ||
StyledHoc.propTypes = _objectSpread({}, _lib.spacing.withWhiteSpace.propTypes); | ||
@@ -24,0 +26,0 @@ return StyledHoc; |
@@ -25,3 +25,3 @@ "use strict"; | ||
var _header = _interopRequireDefault(require("@govuk-react/header")); | ||
var _heading = _interopRequireDefault(require("@govuk-react/heading")); | ||
@@ -176,4 +176,4 @@ var _hintText = _interopRequireDefault(require("@govuk-react/hint-text")); | ||
mb: (0, _react3.number)('File Upload marginBottom', 9) | ||
}, "Example"), _react.default.createElement(_header.default, { | ||
mb: (0, _react3.number)('Header marginBottom', 9) | ||
}, "Example"), _react.default.createElement(_heading.default, { | ||
mb: (0, _react3.number)('Heading marginBottom', 9) | ||
}, "Example"), _react.default.createElement(_hintText.default, { | ||
@@ -180,0 +180,0 @@ mb: (0, _react3.number)('HintText marginBottom', 9) |
{ | ||
"name": "@govuk-react/hoc", | ||
"version": "0.6.0-alpha.4", | ||
"version": "0.6.0-rc.1", | ||
"dependencies": { | ||
"@govuk-react/constants": "^0.6.0-alpha.4", | ||
"@govuk-react/icons": "^0.6.0-alpha.4", | ||
"@govuk-react/lib": "^0.6.0-alpha.4", | ||
"@govuk-react/link": "^0.6.0-alpha.4", | ||
"@govuk-react/constants": "^0.6.0-rc.1", | ||
"@govuk-react/icons": "^0.6.0-rc.1", | ||
"@govuk-react/lib": "^0.6.0-rc.1", | ||
"@govuk-react/link": "^0.6.0-rc.1", | ||
"govuk-colours": "^1.0.3" | ||
@@ -10,0 +10,0 @@ }, |
import React from 'react'; | ||
import Link from '@govuk-react/link'; | ||
const asAnchor = AnchorType => (props => <Link as={AnchorType} {...props} />); | ||
import deprecate from '../deprecate'; | ||
const asAnchor = AnchorType => deprecate( | ||
props => <Link as={AnchorType} {...props} />, | ||
'(use of asAnchor HOC - please use Link component instead)', | ||
); | ||
export default asAnchor; |
export { default as asAnchor } from './asAnchor'; | ||
export { default as asPaginationItem } from './asPaginationItem'; | ||
export { default as deprecate } from './deprecate'; | ||
export { default as withWhiteSpace } from './withWhiteSpace'; |
import styled from 'styled-components'; | ||
import { spacing } from '@govuk-react/lib'; | ||
import deprecate from '../deprecate'; | ||
// NB withWhiteSpace HOC is DEPRECATED | ||
@@ -8,3 +10,6 @@ // Please use `spacing.withWhiteSpace(config)` instead in styled components | ||
const withWhiteSpace = config => (Component) => { | ||
const StyledHoc = styled(Component)(spacing.withWhiteSpace(config)); | ||
const StyledHoc = styled(deprecate( | ||
Component, | ||
'(use of withWhiteSpace HOC - Please use `spacing.withWhiteSpace(config)` instead in styled components)', | ||
))(spacing.withWhiteSpace(config)); | ||
@@ -11,0 +16,0 @@ StyledHoc.propTypes = { |
@@ -13,3 +13,3 @@ import React, { Fragment } from 'react'; | ||
import FileUpload from '@govuk-react/file-upload'; | ||
import Header from '@govuk-react/header'; | ||
import Heading from '@govuk-react/heading'; | ||
import HintText from '@govuk-react/hint-text'; | ||
@@ -129,3 +129,3 @@ import Input from '@govuk-react/input'; | ||
<FileUpload mb={number('File Upload marginBottom', 9)}>Example</FileUpload> | ||
<Header mb={number('Header marginBottom', 9)}>Example</Header> | ||
<Heading mb={number('Heading marginBottom', 9)}>Example</Heading> | ||
<HintText mb={number('HintText marginBottom', 9)}>Example</HintText> | ||
@@ -132,0 +132,0 @@ <Input mb={number('Input marginBottom', 9)} /> |
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
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
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
152427
69
1715
19