@nice-digital/nds-prev-next 3.0.2 → 4.0.2-alpha.0

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.
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import "./../scss/prev-next.scss";
3
+ export interface PrevNextLink {
4
+ text: string;
5
+ destination: string;
6
+ elementType?: React.ElementType;
7
+ intro?: string;
8
+ method?: string;
9
+ }
10
+ export interface PrevNextProps {
11
+ [prop: string]: unknown;
12
+ previousPageLink?: PrevNextLink;
13
+ nextPageLink?: PrevNextLink;
14
+ className?: string;
15
+ }
16
+ export declare const PrevNext: React.FC<PrevNextProps>;
package/es/PrevNext.js CHANGED
@@ -1,66 +1,51 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- var _excluded = ["nextPageLink", "previousPageLink", "className"];
4
- import React from "react";
5
- import PropTypes from "prop-types";
6
- import classnames from "classnames";
7
- import "./../scss/prev-next.scss";
8
-
9
- var Link = function Link(_ref) {
10
- var _linkProps;
11
-
12
- var text = _ref.text,
13
- destination = _ref.destination,
14
- _ref$elementType = _ref.elementType,
15
- ElementType = _ref$elementType === void 0 ? "a" : _ref$elementType,
16
- intro = _ref.intro,
17
- method = _ref.method;
18
- var linkProps = (_linkProps = {
19
- className: "prev-next__link"
20
- }, _linkProps[method || ElementType === "a" && "href" || "to"] = destination, _linkProps);
21
- return /*#__PURE__*/React.createElement(ElementType, linkProps, /*#__PURE__*/React.createElement("span", {
22
- className: "prev-next__link-intro"
23
- }, intro), /*#__PURE__*/React.createElement("span", {
24
- className: "prev-next__link-text"
25
- }, text));
26
- };
27
-
28
- export var PrevNext = function PrevNext(props) {
29
- var nextPageLink = props.nextPageLink,
30
- previousPageLink = props.previousPageLink,
31
- className = props.className,
32
- rest = _objectWithoutPropertiesLoose(props, _excluded);
33
-
34
- var nextLinkProps = {
35
- intro: (nextPageLink == null ? void 0 : nextPageLink.intro) || "Next page",
36
- text: nextPageLink == null ? void 0 : nextPageLink.text,
37
- destination: nextPageLink == null ? void 0 : nextPageLink.destination,
38
- elementType: nextPageLink == null ? void 0 : nextPageLink.elementType,
39
- method: nextPageLink == null ? void 0 : nextPageLink.method
40
- };
41
- var previousLinkProps = {
42
- intro: (previousPageLink == null ? void 0 : previousPageLink.intro) || "Previous page",
43
- text: previousPageLink == null ? void 0 : previousPageLink.text,
44
- destination: previousPageLink == null ? void 0 : previousPageLink.destination,
45
- elementType: previousPageLink == null ? void 0 : previousPageLink.elementType,
46
- method: previousPageLink == null ? void 0 : previousPageLink.method
47
- };
48
- return /*#__PURE__*/React.createElement("div", _extends({
49
- className: classnames("prev-next", className)
50
- }, rest), (nextPageLink || previousPageLink) && /*#__PURE__*/React.createElement("nav", {
51
- "aria-label": "Previous and next pages"
52
- }, nextPageLink && /*#__PURE__*/React.createElement(Link, nextLinkProps), previousPageLink && /*#__PURE__*/React.createElement(Link, previousLinkProps)));
53
- };
54
- PrevNext.propTypes = {
55
- nextPageLink: PropTypes.objectOf(Link),
56
- previousPageLink: PropTypes.objectOf(Link),
57
- className: PropTypes.string
58
- };
59
- Link.propTypes = {
60
- text: PropTypes.string.isRequired,
61
- destination: PropTypes.string.isRequired,
62
- elementType: PropTypes.elementType,
63
- intro: PropTypes.string,
64
- method: PropTypes.string
65
- };
66
- //# sourceMappingURL=PrevNext.js.map
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.PrevNext = void 0;
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ const classnames_1 = __importDefault(require("classnames"));
20
+ require("./../scss/prev-next.scss");
21
+ const Link = ({ text, destination, elementType: ElementType = "a", intro, method }) => {
22
+ let linkProps = {
23
+ className: "prev-next__link",
24
+ [method || (ElementType === "a" && "href") || "to"]: destination
25
+ };
26
+ return ((0, jsx_runtime_1.jsxs)(ElementType, Object.assign({}, linkProps, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: "prev-next__link-intro" }, { children: intro })), (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "prev-next__link-text" }, { children: text }))] })));
27
+ };
28
+ const PrevNext = (props) => {
29
+ const { nextPageLink, previousPageLink, className } = props, rest = __rest(props, ["nextPageLink", "previousPageLink", "className"]);
30
+ let nextLinkProps, previousLinkProps;
31
+ nextLinkProps = nextPageLink
32
+ ? {
33
+ intro: (nextPageLink === null || nextPageLink === void 0 ? void 0 : nextPageLink.intro) || "Next page",
34
+ text: nextPageLink === null || nextPageLink === void 0 ? void 0 : nextPageLink.text,
35
+ destination: nextPageLink === null || nextPageLink === void 0 ? void 0 : nextPageLink.destination,
36
+ elementType: nextPageLink === null || nextPageLink === void 0 ? void 0 : nextPageLink.elementType,
37
+ method: nextPageLink === null || nextPageLink === void 0 ? void 0 : nextPageLink.method
38
+ }
39
+ : null;
40
+ previousLinkProps = previousPageLink
41
+ ? {
42
+ intro: (previousPageLink === null || previousPageLink === void 0 ? void 0 : previousPageLink.intro) || "Previous page",
43
+ text: previousPageLink === null || previousPageLink === void 0 ? void 0 : previousPageLink.text,
44
+ destination: previousPageLink === null || previousPageLink === void 0 ? void 0 : previousPageLink.destination,
45
+ elementType: previousPageLink === null || previousPageLink === void 0 ? void 0 : previousPageLink.elementType,
46
+ method: previousPageLink === null || previousPageLink === void 0 ? void 0 : previousPageLink.method
47
+ }
48
+ : null;
49
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)("prev-next", className) }, rest, { children: (nextPageLink || previousPageLink) && ((0, jsx_runtime_1.jsxs)("nav", Object.assign({ "aria-label": "Previous and next pages" }, { children: [nextPageLink && nextLinkProps && (0, jsx_runtime_1.jsx)(Link, Object.assign({}, nextLinkProps)), previousPageLink && previousLinkProps && ((0, jsx_runtime_1.jsx)(Link, Object.assign({}, previousLinkProps)))] }))) })));
50
+ };
51
+ exports.PrevNext = PrevNext;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const react_1 = require("@testing-library/react");
5
+ const PrevNext_1 = require("./PrevNext");
6
+ const Link = () => (0, jsx_runtime_1.jsx)("a", Object.assign({ href: "#" }, { children: "I am a link" }));
7
+ const nextPageLink = {
8
+ text: "Page Header",
9
+ destination: "/pageheader",
10
+ elementType: Link,
11
+ intro: "Show me the next one"
12
+ };
13
+ const previousPageLink = {
14
+ text: "Alert",
15
+ destination: "/alert"
16
+ };
17
+ describe("Previous & Next", () => {
18
+ it("should match snapshot with both links supplied", () => {
19
+ const wrapper = (0, react_1.render)((0, jsx_runtime_1.jsx)(PrevNext_1.PrevNext, { nextPageLink: nextPageLink, previousPageLink: previousPageLink }));
20
+ expect(wrapper).toMatchSnapshot();
21
+ });
22
+ it("should match snapshot with one link supplied", () => {
23
+ const wrapper = (0, react_1.render)((0, jsx_runtime_1.jsx)(PrevNext_1.PrevNext, { previousPageLink: previousPageLink }));
24
+ expect(wrapper).toMatchSnapshot();
25
+ });
26
+ it("link should render an href attribute if the elementType is an anchor", () => {
27
+ const wrapper = (0, react_1.render)((0, jsx_runtime_1.jsx)(PrevNext_1.PrevNext, { previousPageLink: previousPageLink }));
28
+ const anchor = wrapper.getByRole("link");
29
+ expect(anchor.getAttribute("href")).toBe("/alert");
30
+ });
31
+ it("should pass extra props to the containing element", () => {
32
+ var _a;
33
+ const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(PrevNext_1.PrevNext, { nextPageLink: nextPageLink, "data-tracker": "my-tracker" }));
34
+ expect((_a = container.querySelector(".prev-next")) === null || _a === void 0 ? void 0 : _a.getAttribute("data-tracker")).toBe("my-tracker");
35
+ });
36
+ it("should merge additional classnames with the component classname", () => {
37
+ const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(PrevNext_1.PrevNext, { nextPageLink: nextPageLink, className: "extra-class" }));
38
+ expect(container.querySelector(".prev-next")).toHaveClass("prev-next extra-class");
39
+ });
40
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-digital/nds-prev-next",
3
- "version": "3.0.2",
3
+ "version": "4.0.2-alpha.0",
4
4
  "description": "Previous and next navigation component for the NICE Design System",
5
5
  "author": "Warren Keith <w@rren.dev>",
6
6
  "keywords": [
@@ -9,16 +9,12 @@
9
9
  ],
10
10
  "homepage": "https://github.com/nice-digital/nice-design-system#readme",
11
11
  "license": "MIT",
12
- "types": "nds-prev-next.d.ts",
13
- "main": "lib/PrevNext.js",
14
- "module": "es/PrevNext.js",
12
+ "main": "es/PrevNext.js",
15
13
  "style": "scss/prev-next.scss",
16
14
  "directories": {
17
- "lib": "lib",
18
- "test": "__tests__"
15
+ "lib": "es"
19
16
  },
20
17
  "files": [
21
- "lib",
22
18
  "es",
23
19
  "scss",
24
20
  "*.d.ts"
@@ -38,16 +34,20 @@
38
34
  "url": "https://github.com/nice-digital/nice-design-system/issues"
39
35
  },
40
36
  "dependencies": {
41
- "@nice-digital/nds-core": "^3.0.2",
42
- "classnames": "^2.2.6",
43
- "prop-types": "^15.7.2"
37
+ "@nice-digital/nds-core": "^4.0.2-alpha.0",
38
+ "classnames": "^2.2.6"
44
39
  },
45
40
  "peerDependencies": {
46
41
  "react": "^16 || ^17 || ^18",
47
42
  "react-dom": "^16 || ^17 || ^18"
48
43
  },
49
44
  "devDependencies": {
50
- "@babel/cli": "^7.5.0"
51
- },
52
- "gitHead": "88329347c4985509b2347ecc27daec0a33aef607"
45
+ "@testing-library/jest-dom": "^5.16.5",
46
+ "@testing-library/react": "^13.4.0",
47
+ "@testing-library/user-event": "^14.4.3",
48
+ "@types/jest": "^29.2.2",
49
+ "@types/node": "^18.11.9",
50
+ "typescript": "^4.8.4"
51
+ },
52
+ "gitHead": "4e9cad8a2b94cdf4af05b18a6610835883bedf0e"
53
53
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrevNext.js","names":["React","PropTypes","classnames","Link","text","destination","elementType","ElementType","intro","method","linkProps","className","PrevNext","props","nextPageLink","previousPageLink","rest","nextLinkProps","previousLinkProps","propTypes","objectOf","string","isRequired"],"sources":["../src/PrevNext.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport classnames from \"classnames\";\nimport \"./../scss/prev-next.scss\";\n\nconst Link = ({\n\ttext,\n\tdestination,\n\telementType: ElementType = \"a\",\n\tintro,\n\tmethod\n}) => {\n\tlet linkProps = {\n\t\tclassName: \"prev-next__link\",\n\t\t[method || (ElementType === \"a\" && \"href\") || \"to\"]: destination\n\t};\n\treturn (\n\t\t<ElementType {...linkProps}>\n\t\t\t<span className=\"prev-next__link-intro\">{intro}</span>\n\t\t\t<span className=\"prev-next__link-text\">{text}</span>\n\t\t</ElementType>\n\t);\n};\n\nexport const PrevNext = (props) => {\n\tconst { nextPageLink, previousPageLink, className, ...rest } = props;\n\n\tconst nextLinkProps = {\n\t\tintro: nextPageLink?.intro || \"Next page\",\n\t\ttext: nextPageLink?.text,\n\t\tdestination: nextPageLink?.destination,\n\t\telementType: nextPageLink?.elementType,\n\t\tmethod: nextPageLink?.method\n\t};\n\n\tconst previousLinkProps = {\n\t\tintro: previousPageLink?.intro || \"Previous page\",\n\t\ttext: previousPageLink?.text,\n\t\tdestination: previousPageLink?.destination,\n\t\telementType: previousPageLink?.elementType,\n\t\tmethod: previousPageLink?.method\n\t};\n\n\treturn (\n\t\t<div className={classnames(\"prev-next\", className)} {...rest}>\n\t\t\t{(nextPageLink || previousPageLink) && (\n\t\t\t\t<nav aria-label=\"Previous and next pages\">\n\t\t\t\t\t{nextPageLink && <Link {...nextLinkProps} />}\n\t\t\t\t\t{previousPageLink && <Link {...previousLinkProps} />}\n\t\t\t\t</nav>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nPrevNext.propTypes = {\n\tnextPageLink: PropTypes.objectOf(Link),\n\tpreviousPageLink: PropTypes.objectOf(Link),\n\tclassName: PropTypes.string\n};\n\nLink.propTypes = {\n\ttext: PropTypes.string.isRequired,\n\tdestination: PropTypes.string.isRequired,\n\telementType: PropTypes.elementType,\n\tintro: PropTypes.string,\n\tmethod: PropTypes.string\n};\n"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAO,0BAAP;;AAEA,IAAMC,IAAI,GAAG,SAAPA,IAAO,OAMP;EAAA;;EAAA,IALLC,IAKK,QALLA,IAKK;EAAA,IAJLC,WAIK,QAJLA,WAIK;EAAA,4BAHLC,WAGK;EAAA,IAHQC,WAGR,iCAHsB,GAGtB;EAAA,IAFLC,KAEK,QAFLA,KAEK;EAAA,IADLC,MACK,QADLA,MACK;EACL,IAAIC,SAAS;IACZC,SAAS,EAAE;EADC,cAEXF,MAAM,IAAKF,WAAW,KAAK,GAAhB,IAAuB,MAAlC,IAA6C,IAFlC,IAEyCF,WAFzC,aAAb;EAIA,oBACC,oBAAC,WAAD,EAAiBK,SAAjB,eACC;IAAM,SAAS,EAAC;EAAhB,GAAyCF,KAAzC,CADD,eAEC;IAAM,SAAS,EAAC;EAAhB,GAAwCJ,IAAxC,CAFD,CADD;AAMA,CAjBD;;AAmBA,OAAO,IAAMQ,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;EACpBL,YAAY,EAAEb,SAAS,CAACmB,QAAV,CAAmBjB,IAAnB,CADM;EAEpBY,gBAAgB,EAAEd,SAAS,CAACmB,QAAV,CAAmBjB,IAAnB,CAFE;EAGpBQ,SAAS,EAAEV,SAAS,CAACoB;AAHD,CAArB;AAMAlB,IAAI,CAACgB,SAAL,GAAiB;EAChBf,IAAI,EAAEH,SAAS,CAACoB,MAAV,CAAiBC,UADP;EAEhBjB,WAAW,EAAEJ,SAAS,CAACoB,MAAV,CAAiBC,UAFd;EAGhBhB,WAAW,EAAEL,SAAS,CAACK,WAHP;EAIhBE,KAAK,EAAEP,SAAS,CAACoB,MAJD;EAKhBZ,MAAM,EAAER,SAAS,CAACoB;AALF,CAAjB"}
package/lib/PrevNext.js DELETED
@@ -1,129 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- exports.__esModule = true;
6
- exports.PrevNext = void 0;
7
-
8
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
9
-
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
- var _react = _interopRequireDefault(require("react"));
13
-
14
- var _propTypes = _interopRequireDefault(require("prop-types"));
15
-
16
- var _classnames = _interopRequireDefault(require("classnames"));
17
-
18
- require("./../scss/prev-next.scss");
19
-
20
- var _excluded = ["nextPageLink", "previousPageLink", "className"];
21
-
22
- var _jsxFileName = "C:\\dev\\nice-design-system\\components\\nds-prev-next\\src\\PrevNext.js",
23
- _this = void 0;
24
-
25
- var Link = function Link(_ref) {
26
- var _linkProps;
27
-
28
- var text = _ref.text,
29
- destination = _ref.destination,
30
- _ref$elementType = _ref.elementType,
31
- ElementType = _ref$elementType === void 0 ? "a" : _ref$elementType,
32
- intro = _ref.intro,
33
- method = _ref.method;
34
- var linkProps = (_linkProps = {
35
- className: "prev-next__link"
36
- }, _linkProps[method || ElementType === "a" && "href" || "to"] = destination, _linkProps);
37
- return /*#__PURE__*/_react["default"].createElement(ElementType, (0, _extends2["default"])({}, linkProps, {
38
- __self: _this,
39
- __source: {
40
- fileName: _jsxFileName,
41
- lineNumber: 18,
42
- columnNumber: 3
43
- }
44
- }), /*#__PURE__*/_react["default"].createElement("span", {
45
- className: "prev-next__link-intro",
46
- __self: _this,
47
- __source: {
48
- fileName: _jsxFileName,
49
- lineNumber: 19,
50
- columnNumber: 4
51
- }
52
- }, intro), /*#__PURE__*/_react["default"].createElement("span", {
53
- className: "prev-next__link-text",
54
- __self: _this,
55
- __source: {
56
- fileName: _jsxFileName,
57
- lineNumber: 20,
58
- columnNumber: 4
59
- }
60
- }, text));
61
- };
62
-
63
- var PrevNext = function PrevNext(props) {
64
- var nextPageLink = props.nextPageLink,
65
- previousPageLink = props.previousPageLink,
66
- className = props.className,
67
- rest = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded);
68
- var nextLinkProps = {
69
- intro: (nextPageLink == null ? void 0 : nextPageLink.intro) || "Next page",
70
- text: nextPageLink == null ? void 0 : nextPageLink.text,
71
- destination: nextPageLink == null ? void 0 : nextPageLink.destination,
72
- elementType: nextPageLink == null ? void 0 : nextPageLink.elementType,
73
- method: nextPageLink == null ? void 0 : nextPageLink.method
74
- };
75
- var previousLinkProps = {
76
- intro: (previousPageLink == null ? void 0 : previousPageLink.intro) || "Previous page",
77
- text: previousPageLink == null ? void 0 : previousPageLink.text,
78
- destination: previousPageLink == null ? void 0 : previousPageLink.destination,
79
- elementType: previousPageLink == null ? void 0 : previousPageLink.elementType,
80
- method: previousPageLink == null ? void 0 : previousPageLink.method
81
- };
82
- return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
83
- className: (0, _classnames["default"])("prev-next", className)
84
- }, rest, {
85
- __self: _this,
86
- __source: {
87
- fileName: _jsxFileName,
88
- lineNumber: 45,
89
- columnNumber: 3
90
- }
91
- }), (nextPageLink || previousPageLink) && /*#__PURE__*/_react["default"].createElement("nav", {
92
- "aria-label": "Previous and next pages",
93
- __self: _this,
94
- __source: {
95
- fileName: _jsxFileName,
96
- lineNumber: 47,
97
- columnNumber: 5
98
- }
99
- }, nextPageLink && /*#__PURE__*/_react["default"].createElement(Link, (0, _extends2["default"])({}, nextLinkProps, {
100
- __self: _this,
101
- __source: {
102
- fileName: _jsxFileName,
103
- lineNumber: 48,
104
- columnNumber: 23
105
- }
106
- })), previousPageLink && /*#__PURE__*/_react["default"].createElement(Link, (0, _extends2["default"])({}, previousLinkProps, {
107
- __self: _this,
108
- __source: {
109
- fileName: _jsxFileName,
110
- lineNumber: 49,
111
- columnNumber: 27
112
- }
113
- }))));
114
- };
115
-
116
- exports.PrevNext = PrevNext;
117
- PrevNext.propTypes = {
118
- nextPageLink: _propTypes["default"].objectOf(Link),
119
- previousPageLink: _propTypes["default"].objectOf(Link),
120
- className: _propTypes["default"].string
121
- };
122
- Link.propTypes = {
123
- text: _propTypes["default"].string.isRequired,
124
- destination: _propTypes["default"].string.isRequired,
125
- elementType: _propTypes["default"].elementType,
126
- intro: _propTypes["default"].string,
127
- method: _propTypes["default"].string
128
- };
129
- //# sourceMappingURL=PrevNext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrevNext.js","names":["Link","text","destination","elementType","ElementType","intro","method","linkProps","className","PrevNext","props","nextPageLink","previousPageLink","rest","nextLinkProps","previousLinkProps","classnames","propTypes","PropTypes","objectOf","string","isRequired"],"sources":["../src/PrevNext.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport classnames from \"classnames\";\nimport \"./../scss/prev-next.scss\";\n\nconst Link = ({\n\ttext,\n\tdestination,\n\telementType: ElementType = \"a\",\n\tintro,\n\tmethod\n}) => {\n\tlet linkProps = {\n\t\tclassName: \"prev-next__link\",\n\t\t[method || (ElementType === \"a\" && \"href\") || \"to\"]: destination\n\t};\n\treturn (\n\t\t<ElementType {...linkProps}>\n\t\t\t<span className=\"prev-next__link-intro\">{intro}</span>\n\t\t\t<span className=\"prev-next__link-text\">{text}</span>\n\t\t</ElementType>\n\t);\n};\n\nexport const PrevNext = (props) => {\n\tconst { nextPageLink, previousPageLink, className, ...rest } = props;\n\n\tconst nextLinkProps = {\n\t\tintro: nextPageLink?.intro || \"Next page\",\n\t\ttext: nextPageLink?.text,\n\t\tdestination: nextPageLink?.destination,\n\t\telementType: nextPageLink?.elementType,\n\t\tmethod: nextPageLink?.method\n\t};\n\n\tconst previousLinkProps = {\n\t\tintro: previousPageLink?.intro || \"Previous page\",\n\t\ttext: previousPageLink?.text,\n\t\tdestination: previousPageLink?.destination,\n\t\telementType: previousPageLink?.elementType,\n\t\tmethod: previousPageLink?.method\n\t};\n\n\treturn (\n\t\t<div className={classnames(\"prev-next\", className)} {...rest}>\n\t\t\t{(nextPageLink || previousPageLink) && (\n\t\t\t\t<nav aria-label=\"Previous and next pages\">\n\t\t\t\t\t{nextPageLink && <Link {...nextLinkProps} />}\n\t\t\t\t\t{previousPageLink && <Link {...previousLinkProps} />}\n\t\t\t\t</nav>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nPrevNext.propTypes = {\n\tnextPageLink: PropTypes.objectOf(Link),\n\tpreviousPageLink: PropTypes.objectOf(Link),\n\tclassName: PropTypes.string\n};\n\nLink.propTypes = {\n\ttext: PropTypes.string.isRequired,\n\tdestination: PropTypes.string.isRequired,\n\telementType: PropTypes.elementType,\n\tintro: PropTypes.string,\n\tmethod: PropTypes.string\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;AAEA,IAAMA,IAAI,GAAG,SAAPA,IAAO,OAMP;EAAA;;EAAA,IALLC,IAKK,QALLA,IAKK;EAAA,IAJLC,WAIK,QAJLA,WAIK;EAAA,4BAHLC,WAGK;EAAA,IAHQC,WAGR,iCAHsB,GAGtB;EAAA,IAFLC,KAEK,QAFLA,KAEK;EAAA,IADLC,MACK,QADLA,MACK;EACL,IAAIC,SAAS;IACZC,SAAS,EAAE;EADC,c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AEA,gBAAgB,CAAET,WAJN;IAKzBG,MAAM,EAAEM,gBAAF,oBAAEA,gBAAgB,CAAEN;EALD,CAA1B;EAQA,oBACC;IAAK,SAAS,EAAE,IAAAU,sBAAA,EAAW,WAAX,EAAwBR,SAAxB;EAAhB,GAAwDK,IAAxD;IAAA;IAAA;MAAA;MAAA;MAAA;IAAA;EAAA,IACE,CAACF,YAAY,IAAIC,gBAAjB,kBACA;IAAK,cAAW,yBAAhB;IAAA;IAAA;MAAA;MAAA;MAAA;IAAA;EAAA,GACED,YAAY,iBAAI,gCAAC,IAAD,gCAAUG,aAAV;IAAA;IAAA;MAAA;MAAA;MAAA;IAAA;EAAA,GADlB,EAEEF,gBAAgB,iBAAI,gCAAC,IAAD,gCAAUG,iBAAV;IAAA;IAAA;MAAA;MAAA;MAAA;IAAA;EAAA,GAFtB,CAFF,CADD;AAUA,CA7BM;;;AA+BPN,QAAQ,CAACQ,SAAT,GAAqB;EACpBN,YAAY,EAAEO,qBAAA,CAAUC,QAAV,CAAmBnB,IAAnB,CADM;EAEpBY,gBAAgB,EAAEM,qBAAA,CAAUC,QAAV,CAAmBnB,IAAnB,CAFE;EAGpBQ,SAAS,EAAEU,qBAAA,CAAUE;AAHD,CAArB;AAMApB,IAAI,CAACiB,SAAL,GAAiB;EAChBhB,IAAI,EAAEiB,qBAAA,CAAUE,MAAV,CAAiBC,UADP;EAEhBnB,WAAW,EAAEgB,qBAAA,CAAUE,MAAV,CAAiBC,UAFd;EAGhBlB,WAAW,EAAEe,qBAAA,CAAUf,WAHP;EAIhBE,KAAK,EAAEa,qBAAA,CAAUE,MAJD;EAKhBd,MAAM,EAAEY,qBAAA,CAAUE;AALF,CAAjB"}
@@ -1,19 +0,0 @@
1
- declare module "@nice-digital/nds-prev-next" {
2
- import * as React from "react";
3
-
4
- interface PrevNextLink {
5
- text: string;
6
- destination: string;
7
- elementType?: React.ElementType;
8
- intro?: string;
9
- method?: string;
10
- }
11
-
12
- interface PrevNextProps {
13
- [prop: string]: unknown;
14
- previousPageLink?: PrevNextLink;
15
- nextPageLink?: PrevNextLink;
16
- }
17
-
18
- export const PrevNext: React.FC<PrevNextProps>;
19
- }