ublo-lib 1.12.8 → 1.12.9
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../../src/common/components/breadcrumb.tsx"],"names":[],"mappings":";AAGA,aAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../../src/common/components/breadcrumb.tsx"],"names":[],"mappings":";AAGA,aAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,aAAK,eAAe,GAAG;IACrB,UAAU,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAqDF,QAAA,MAAM,UAAU,+BAAqC,eAAe,gBAInE,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Link from "ublo/link";
|
|
3
|
-
const Item = ({ page, path, itemTitle, nextItem, isCurrent }) => {
|
|
3
|
+
const Item = ({ name, page, path, itemTitle, nextItem, isCurrent, exclusions, }) => {
|
|
4
4
|
const hasTemplate = page !== undefined;
|
|
5
5
|
const isExternalUrl = /^((http|https):\/\/)/.test(path);
|
|
6
6
|
const noHref = isCurrent || !hasTemplate;
|
|
7
|
+
const isExcluded = !isCurrent && exclusions.includes(name);
|
|
7
8
|
const Tag = isExternalUrl ? "a" : noHref ? "span" : Link;
|
|
8
9
|
const linkProps = { title: itemTitle, page, as: path };
|
|
9
10
|
const spanProps = { dangerouslySetInnerHTML: { __html: itemTitle } };
|
|
10
11
|
const anchorProps = { ...spanProps, href: path };
|
|
11
12
|
const props = isExternalUrl ? anchorProps : noHref ? spanProps : linkProps;
|
|
12
|
-
return (_jsxs(_Fragment, { children: [_jsx(Tag, { className: "breadcrumb__item", ...props }), nextItem] }));
|
|
13
|
+
return (_jsxs(_Fragment, { children: [!isExcluded && _jsx(Tag, { className: "breadcrumb__item", ...props }), nextItem] }));
|
|
13
14
|
};
|
|
14
15
|
const Items = ({ rawItem, exclusions }) => {
|
|
15
|
-
const { next, title, path, page, shortTitle } = rawItem;
|
|
16
|
+
const { next, name, title, path, page, shortTitle } = rawItem;
|
|
16
17
|
const isCurrent = next === undefined;
|
|
17
18
|
const isNextExcluded = !isCurrent && exclusions.includes(next.name);
|
|
18
19
|
const itemToRender = isNextExcluded ? next.next : next;
|
|
19
20
|
const nextItem = !isCurrent ? (_jsx(Items, { rawItem: itemToRender, exclusions: exclusions })) : null;
|
|
20
|
-
return (_jsx(Item, { page: page, path: path, itemTitle: shortTitle || title, nextItem: nextItem, isCurrent: isCurrent }));
|
|
21
|
+
return (_jsx(Item, { name: name, page: page, path: path, itemTitle: shortTitle || title, nextItem: nextItem, isCurrent: isCurrent, exclusions: exclusions }));
|
|
21
22
|
};
|
|
22
23
|
const Breadcrumb = ({ breadcrumb, exclusions = [] }) => (_jsx("div", { className: "breadcrumb", children: _jsx(Items, { rawItem: breadcrumb, exclusions: exclusions }) }));
|
|
23
24
|
export default Breadcrumb;
|