@not-govuk/back-link 0.5.2 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/BackLink.js +14 -10
  2. package/package.json +8 -8
package/dist/BackLink.js CHANGED
@@ -1,12 +1,16 @@
1
- import { createElement as h } from 'react';
2
- import { useHistory } from 'react-router-dom';
3
- import { classBuilder } from '@not-govuk/component-helpers';
4
- import { A } from '@not-govuk/link';
5
- import '../assets/BackLink.scss';
6
- export const BackLink = ({ children, classBlock, classModifiers, className, href, text = 'Back', ...attrs }) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BackLink = void 0;
4
+ const react_1 = require("react");
5
+ const react_router_dom_1 = require("react-router-dom");
6
+ const component_helpers_1 = require("@not-govuk/component-helpers");
7
+ const link_1 = require("@not-govuk/link");
8
+ require("../assets/BackLink.scss");
9
+ const BackLink = ({ children, classBlock, classModifiers, className, href, text = 'Back', ...attrs }) => {
7
10
  const defaultClassBlock = 'govuk-back-link';
8
- const classes = classBuilder(defaultClassBlock, classBlock, classModifiers, className);
9
- const history = useHistory();
10
- return href ? (h(A, { ...attrs, classBlock: classBlock || defaultClassBlock, classModifiers: classModifiers, className: className, href: href }, text)) : (h("a", { ...attrs, className: classes(), href: "#", onClick: history.goBack }, text));
11
+ const classes = (0, component_helpers_1.classBuilder)(defaultClassBlock, classBlock, classModifiers, className);
12
+ const history = (0, react_router_dom_1.useHistory)();
13
+ return href ? ((0, react_1.createElement)(link_1.A, { ...attrs, classBlock: classBlock || defaultClassBlock, classModifiers: classModifiers, className: className, href: href }, text)) : ((0, react_1.createElement)("a", { ...attrs, className: classes(), href: "#", onClick: history.goBack }, text));
11
14
  };
12
- export default BackLink;
15
+ exports.BackLink = BackLink;
16
+ exports.default = exports.BackLink;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@not-govuk/back-link",
3
- "version": "0.5.2",
3
+ "version": "0.5.5",
4
4
  "description": "A component to help users navigate back one page.",
5
5
  "main": "dist/BackLink.js",
6
6
  "sass": "assets/BackLink.scss",
@@ -14,13 +14,13 @@
14
14
  "react-components"
15
15
  ],
16
16
  "dependencies": {
17
- "@not-govuk/component-helpers": "^0.5.2",
18
- "@not-govuk/link": "^0.5.2",
19
- "@not-govuk/sass-base": "^0.5.2",
17
+ "@not-govuk/component-helpers": "^0.5.5",
18
+ "@not-govuk/link": "^0.5.5",
19
+ "@not-govuk/sass-base": "^0.5.5",
20
20
  "govuk-frontend": "3.11.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@not-govuk/docs-components": "^0.5.2",
23
+ "@not-govuk/docs-components": "^0.5.5",
24
24
  "@storybook/addon-docs": "^6.4.0",
25
25
  "react": "^16.9.55"
26
26
  },
@@ -34,15 +34,15 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@mdx-js/react": "1.6.22",
37
- "@not-govuk/component-test-helpers": "^0.5.2",
37
+ "@not-govuk/component-test-helpers": "^0.5.5",
38
38
  "@types/react": "16.14.28",
39
39
  "jest": "28.1.3",
40
40
  "jest-environment-jsdom": "28.1.3",
41
41
  "ts-jest": "28.0.7",
42
- "typescript": "4.6.4"
42
+ "typescript": "4.7.4"
43
43
  },
44
44
  "scripts": {
45
- "test": "jest",
45
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest",
46
46
  "build": "tsc",
47
47
  "clean": "rm -rf dist tsconfig.tsbuildinfo"
48
48
  },