@pismo/marola 0.0.1-alpha.30 → 0.0.1-alpha.31
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.
|
@@ -8,6 +8,10 @@ type BreadcrumbItem = {
|
|
|
8
8
|
'data-testid'?: string;
|
|
9
9
|
/** CSS classes to be applied on the breadcrumb item */
|
|
10
10
|
className?: string;
|
|
11
|
+
/** Callback called when the breadcrumb item is clicked */
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
};
|
|
14
|
+
type LastBreadcrumbItem = Omit<BreadcrumbItem, 'onClick'> & {
|
|
11
15
|
/** Callback called when the breadcrumb item is clicked */
|
|
12
16
|
onClick?: () => void;
|
|
13
17
|
};
|
|
@@ -55,7 +59,7 @@ type PageHeaderCommonProps = {
|
|
|
55
59
|
};
|
|
56
60
|
type PageHeaderWithBreadcrumb = Omit<PageHeaderCommonProps, 'backLinkText' | 'onBackLinkClick' | 'classNameBackLink' | 'data-testid-backLink' | 'breadcrumb'> & {
|
|
57
61
|
/** List of breadcrumbs to be rendered at the top of the title */
|
|
58
|
-
breadcrumb?: BreadcrumbItem[];
|
|
62
|
+
breadcrumb?: [...BreadcrumbItem[], LastBreadcrumbItem];
|
|
59
63
|
};
|
|
60
64
|
export type PageHeaderProps = RequireAllOrNone<PageHeaderCommonProps, 'backLinkText' | 'onBackLinkClick'> | PageHeaderWithBreadcrumb;
|
|
61
65
|
export declare const PageHeader: ({ title, subtitle, rightChildren, bottomChildren, classNameWrapper, classNameTitle, classNameSubtitle, "data-testid-wrapper": wrapperTestId, "data-testid-title": titleTestId, "data-testid-subtitle": subtitleTestId, ...props }: PageHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import '../../assets/PageHeader.css';
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { c as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { IconButton as
|
|
7
|
-
const
|
|
2
|
+
import { jsx as a, jsxs as h } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as L } from "react";
|
|
4
|
+
import { c as n } from "../../clsx-DB4S2d7J.js";
|
|
5
|
+
import { Icon as B } from "../Icon/Icon.js";
|
|
6
|
+
import { IconButton as C } from "../IconButton/IconButton.js";
|
|
7
|
+
const j = "_title_z7ezb_22", w = "_subtitle_z7ezb_43", e = {
|
|
8
8
|
"u-typography-h1": "_u-typography-h1_z7ezb_1",
|
|
9
9
|
"u-typography-h2": "_u-typography-h2_z7ezb_8",
|
|
10
10
|
"u-typography-h3": "_u-typography-h3_z7ezb_15",
|
|
11
11
|
"u-typography-h4": "_u-typography-h4_z7ezb_22",
|
|
12
12
|
"page-header__main-left-content": "_page-header__main-left-content_z7ezb_22",
|
|
13
|
-
title:
|
|
13
|
+
title: j,
|
|
14
14
|
"u-typography-h5": "_u-typography-h5_z7ezb_29",
|
|
15
15
|
"u-typography-h6": "_u-typography-h6_z7ezb_36",
|
|
16
16
|
"u-typography-base": "_u-typography-base_z7ezb_43",
|
|
17
|
-
subtitle:
|
|
17
|
+
subtitle: w,
|
|
18
18
|
"u-typography-base--xxl": "_u-typography-base--xxl_z7ezb_48",
|
|
19
19
|
"u-typography-base--xl": "_u-typography-base--xl_z7ezb_52",
|
|
20
20
|
"u-typography-base--lg": "_u-typography-base--lg_z7ezb_56",
|
|
@@ -30,57 +30,58 @@ const x = "_title_z7ezb_22", L = "_subtitle_z7ezb_43", a = {
|
|
|
30
30
|
"page-header__breadcrumb": "_page-header__breadcrumb_z7ezb_103",
|
|
31
31
|
"page-header__breadcrumb__separator": "_page-header__breadcrumb__separator_z7ezb_108",
|
|
32
32
|
"page-header__main-right-content": "_page-header__main-right-content_z7ezb_131"
|
|
33
|
-
},
|
|
34
|
-
title:
|
|
35
|
-
subtitle:
|
|
36
|
-
rightChildren:
|
|
37
|
-
bottomChildren:
|
|
38
|
-
classNameWrapper:
|
|
39
|
-
classNameTitle:
|
|
40
|
-
classNameSubtitle:
|
|
41
|
-
"data-testid-wrapper":
|
|
42
|
-
"data-testid-title":
|
|
43
|
-
"data-testid-subtitle":
|
|
44
|
-
...
|
|
33
|
+
}, P = ({
|
|
34
|
+
title: l,
|
|
35
|
+
subtitle: g,
|
|
36
|
+
rightChildren: d,
|
|
37
|
+
bottomChildren: b,
|
|
38
|
+
classNameWrapper: y,
|
|
39
|
+
classNameTitle: u,
|
|
40
|
+
classNameSubtitle: z,
|
|
41
|
+
"data-testid-wrapper": m,
|
|
42
|
+
"data-testid-title": k,
|
|
43
|
+
"data-testid-subtitle": N,
|
|
44
|
+
...f
|
|
45
45
|
}) => {
|
|
46
|
-
const
|
|
46
|
+
const {
|
|
47
|
+
breadcrumb: r,
|
|
48
|
+
backLinkText: p,
|
|
49
|
+
onBackLinkClick: s,
|
|
50
|
+
classNameBackLink: c,
|
|
51
|
+
"data-testid-backLink": i,
|
|
52
|
+
...x
|
|
53
|
+
} = f, v = L(() => {
|
|
47
54
|
const _ = [];
|
|
48
|
-
return
|
|
49
|
-
label:
|
|
50
|
-
className:
|
|
51
|
-
"data-testid":
|
|
52
|
-
onClick:
|
|
53
|
-
}),
|
|
54
|
-
|
|
55
|
+
return p && s && _.push({
|
|
56
|
+
label: p,
|
|
57
|
+
className: c,
|
|
58
|
+
"data-testid": i,
|
|
59
|
+
onClick: s
|
|
60
|
+
}), r && _.push(...r), /* @__PURE__ */ a("div", { className: e["page-header__top-content"], children: /* @__PURE__ */ a("div", { className: e["page-header__breadcrumb"], children: _.map((t, o) => /* @__PURE__ */ a(
|
|
61
|
+
C,
|
|
55
62
|
{
|
|
56
|
-
icon:
|
|
57
|
-
onClick: () =>
|
|
58
|
-
className:
|
|
59
|
-
"data-testid":
|
|
60
|
-
disabled: _.length === 1 ? !1 :
|
|
61
|
-
children:
|
|
63
|
+
icon: o === 0 ? /* @__PURE__ */ a(B, { icon: "arrow-left" }) : /* @__PURE__ */ a("span", { className: e["page-header__breadcrumb__separator"], children: "/" }),
|
|
64
|
+
onClick: () => t.onClick && t.onClick(),
|
|
65
|
+
className: t.className,
|
|
66
|
+
"data-testid": t["data-testid"],
|
|
67
|
+
disabled: _.length === 1 ? !1 : o === _.length - 1,
|
|
68
|
+
children: t.label
|
|
62
69
|
},
|
|
63
|
-
`${
|
|
70
|
+
`${t.label}_${o}`
|
|
64
71
|
)) }) });
|
|
65
|
-
}, [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
e
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return /* @__PURE__ */ o("div", { className: s([a["page-header"], i]), "data-testid": y, ...d, children: [
|
|
73
|
-
m,
|
|
74
|
-
/* @__PURE__ */ o("div", { className: a["page-header__main-content"], children: [
|
|
75
|
-
/* @__PURE__ */ o("div", { className: a["page-header__main-left-content"], children: [
|
|
76
|
-
/* @__PURE__ */ t("h1", { className: s(a.title, l), "data-testid": u, children: b }),
|
|
77
|
-
/* @__PURE__ */ t("h2", { className: s(a.subtitle, g), "data-testid": z, children: c })
|
|
72
|
+
}, [r, p, c, i, s]);
|
|
73
|
+
return /* @__PURE__ */ h("div", { className: n([e["page-header"], y]), "data-testid": m, ...x, children: [
|
|
74
|
+
v,
|
|
75
|
+
/* @__PURE__ */ h("div", { className: e["page-header__main-content"], children: [
|
|
76
|
+
/* @__PURE__ */ h("div", { className: e["page-header__main-left-content"], children: [
|
|
77
|
+
/* @__PURE__ */ a("h1", { className: n(e.title, u), "data-testid": k, children: l }),
|
|
78
|
+
/* @__PURE__ */ a("h2", { className: n(e.subtitle, z), "data-testid": N, children: g })
|
|
78
79
|
] }),
|
|
79
|
-
|
|
80
|
+
d && /* @__PURE__ */ a("div", { className: e["page-header__main-right-content"], children: d })
|
|
80
81
|
] }),
|
|
81
|
-
|
|
82
|
+
b && /* @__PURE__ */ a("div", { className: e["page-header__bottom-content"], children: b })
|
|
82
83
|
] });
|
|
83
84
|
};
|
|
84
85
|
export {
|
|
85
|
-
|
|
86
|
+
P as PageHeader
|
|
86
87
|
};
|