@nice-digital/nds-breadcrumbs 4.0.16 → 4.0.18-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.
@@ -1,10 +1,10 @@
1
- import { ReactNode, ElementType } from "react";
2
- export interface BreadcrumbProps {
3
- [prop: string]: unknown;
4
- children: ReactNode;
5
- to?: string;
6
- elementType?: ElementType;
7
- method?: string;
8
- className?: string;
9
- }
10
- export declare const Breadcrumb: (props: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { ReactNode, ElementType } from "react";
2
+ export interface BreadcrumbProps {
3
+ [prop: string]: unknown;
4
+ children: ReactNode;
5
+ to?: string;
6
+ elementType?: ElementType;
7
+ method?: string;
8
+ className?: string;
9
+ }
10
+ export declare const Breadcrumb: (props: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
package/es/Breadcrumb.js CHANGED
@@ -1,30 +1,30 @@
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.Breadcrumb = void 0;
18
- const jsx_runtime_1 = require("react/jsx-runtime");
19
- const classnames_1 = __importDefault(require("classnames"));
20
- const Breadcrumb = (props) => {
21
- const { elementType, method, to, children, className } = props, attributes = __rest(props, ["elementType", "method", "to", "children", "className"]);
22
- let ElementType = elementType || "span";
23
- const innerTagProps = Object.assign({}, attributes);
24
- if (to) {
25
- ElementType = elementType || "a";
26
- innerTagProps[method || (ElementType === "a" && "href") || "to"] = to;
27
- }
28
- return ((0, jsx_runtime_1.jsx)("li", Object.assign({ className: (0, classnames_1.default)(["breadcrumbs__crumb", className]) }, { children: (0, jsx_runtime_1.jsx)(ElementType, Object.assign({}, innerTagProps, { children: children })) })));
29
- };
30
- exports.Breadcrumb = Breadcrumb;
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.Breadcrumb = void 0;
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ const classnames_1 = __importDefault(require("classnames"));
20
+ const Breadcrumb = (props) => {
21
+ const { elementType, method, to, children, className } = props, attributes = __rest(props, ["elementType", "method", "to", "children", "className"]);
22
+ let ElementType = elementType || "span";
23
+ const innerTagProps = Object.assign({}, attributes);
24
+ if (to) {
25
+ ElementType = elementType || "a";
26
+ innerTagProps[method || (ElementType === "a" && "href") || "to"] = to;
27
+ }
28
+ return ((0, jsx_runtime_1.jsx)("li", { className: (0, classnames_1.default)(["breadcrumbs__crumb", className]), children: (0, jsx_runtime_1.jsx)(ElementType, Object.assign({}, innerTagProps, { children: children })) }));
29
+ };
30
+ exports.Breadcrumb = Breadcrumb;
@@ -1,12 +1,12 @@
1
- import { ReactElement } from "react";
2
- import { type BreadcrumbProps } from "./Breadcrumb";
3
- import { Breadcrumb } from "./Breadcrumb";
4
- import "../scss/breadcrumbs.scss";
5
- export { Breadcrumb };
6
- export interface BreadcrumbsProps {
7
- [prop: string]: unknown;
8
- className?: string;
9
- children: ValidBreadcrumbProp[] | ValidBreadcrumbProp;
10
- }
11
- type ValidBreadcrumbProp = ReactElement<BreadcrumbProps> | null | undefined;
12
- export declare const Breadcrumbs: ({ children, ...rest }: BreadcrumbsProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { ReactElement } from "react";
2
+ import { type BreadcrumbProps } from "./Breadcrumb";
3
+ import { Breadcrumb } from "./Breadcrumb";
4
+ import "../scss/breadcrumbs.scss";
5
+ export { Breadcrumb };
6
+ export interface BreadcrumbsProps {
7
+ [prop: string]: unknown;
8
+ className?: string;
9
+ children: ValidBreadcrumbProp[] | ValidBreadcrumbProp;
10
+ }
11
+ type ValidBreadcrumbProp = ReactElement<BreadcrumbProps> | null | undefined;
12
+ export declare const Breadcrumbs: ({ children, ...rest }: BreadcrumbsProps) => import("react/jsx-runtime").JSX.Element;
package/es/Breadcrumbs.js CHANGED
@@ -1,43 +1,43 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.Breadcrumbs = exports.Breadcrumb = void 0;
15
- const jsx_runtime_1 = require("react/jsx-runtime");
16
- const Breadcrumb_1 = require("./Breadcrumb");
17
- Object.defineProperty(exports, "Breadcrumb", { enumerable: true, get: function () { return Breadcrumb_1.Breadcrumb; } });
18
- require("../scss/breadcrumbs.scss");
19
- const stringify = (data) => {
20
- if (process.env.NODE_ENV === "production")
21
- return JSON.stringify(data);
22
- return JSON.stringify(data, null, 2);
23
- };
24
- const getBreadcrumbJsonLdItem = (breadcrumb, index = 0) => ({
25
- "@type": "ListItem",
26
- position: index + 1,
27
- item: {
28
- "@id": breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.props.to,
29
- name: breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.props.children
30
- }
31
- });
32
- const Breadcrumbs = (_a) => {
33
- var { children } = _a, rest = __rest(_a, ["children"]);
34
- const jsonLdData = {
35
- "@context": "http://schema.org",
36
- "@type": "BreadcrumbList",
37
- itemListElement: Array.isArray(children)
38
- ? children.filter(Boolean).map(getBreadcrumbJsonLdItem)
39
- : getBreadcrumbJsonLdItem(children)
40
- };
41
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("nav", Object.assign({ "aria-label": "Breadcrumbs", role: "navigation", "data-component": "breadcrumbs" }, rest, { children: (0, jsx_runtime_1.jsx)("ol", Object.assign({ className: "breadcrumbs" }, { children: children })) })), (0, jsx_runtime_1.jsx)("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: stringify(jsonLdData) } })] }));
42
- };
43
- exports.Breadcrumbs = Breadcrumbs;
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
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Breadcrumbs = exports.Breadcrumb = void 0;
15
+ const jsx_runtime_1 = require("react/jsx-runtime");
16
+ const Breadcrumb_1 = require("./Breadcrumb");
17
+ Object.defineProperty(exports, "Breadcrumb", { enumerable: true, get: function () { return Breadcrumb_1.Breadcrumb; } });
18
+ require("../scss/breadcrumbs.scss");
19
+ const stringify = (data) => {
20
+ if (process.env.NODE_ENV === "production")
21
+ return JSON.stringify(data);
22
+ return JSON.stringify(data, null, 2);
23
+ };
24
+ const getBreadcrumbJsonLdItem = (breadcrumb, index = 0) => ({
25
+ "@type": "ListItem",
26
+ position: index + 1,
27
+ item: {
28
+ "@id": breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.props.to,
29
+ name: breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.props.children
30
+ }
31
+ });
32
+ const Breadcrumbs = (_a) => {
33
+ var { children } = _a, rest = __rest(_a, ["children"]);
34
+ const jsonLdData = {
35
+ "@context": "http://schema.org",
36
+ "@type": "BreadcrumbList",
37
+ itemListElement: Array.isArray(children)
38
+ ? children.filter(Boolean).map(getBreadcrumbJsonLdItem)
39
+ : getBreadcrumbJsonLdItem(children)
40
+ };
41
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("nav", Object.assign({ "aria-label": "Breadcrumbs", role: "navigation", "data-component": "breadcrumbs" }, rest, { children: (0, jsx_runtime_1.jsx)("ol", { className: "breadcrumbs", children: children }) })), (0, jsx_runtime_1.jsx)("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: stringify(jsonLdData) } })] }));
42
+ };
43
+ exports.Breadcrumbs = Breadcrumbs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-digital/nds-breadcrumbs",
3
- "version": "4.0.16",
3
+ "version": "4.0.18-alpha.0",
4
4
  "description": "Breadcrumbs component for the NICE Design System",
5
5
  "keywords": [
6
6
  "breadcrumbs"
@@ -31,7 +31,7 @@
31
31
  "url": "https://github.com/nice-digital/nice-design-system/issues"
32
32
  },
33
33
  "dependencies": {
34
- "@nice-digital/nds-core": "^4.0.16",
34
+ "@nice-digital/nds-core": "^4.0.18-alpha.0",
35
35
  "classnames": "^2.3.1"
36
36
  },
37
37
  "peerDependencies": {
@@ -43,8 +43,8 @@
43
43
  "@testing-library/react": "^13.4.0",
44
44
  "@testing-library/user-event": "^14.4.3",
45
45
  "@types/jest": "^29.2.2",
46
- "@types/node": "^18.11.9",
47
- "typescript": "^4.8.4"
46
+ "@types/node": "22.19.0",
47
+ "typescript": "^5.9.3"
48
48
  },
49
- "gitHead": "7f069b2855600345c7366e8dc965a5d839a20c17"
49
+ "gitHead": "d1bac6f89a952c97aeaf5d9d0ee9d99ee35a3ed3"
50
50
  }