@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 t, jsxs as o } from "react/jsx-runtime";
3
- import { useMemo as k } from "react";
4
- import { c as s } from "../../clsx-DB4S2d7J.js";
5
- import { Icon as N } from "../Icon/Icon.js";
6
- import { IconButton as f } from "../IconButton/IconButton.js";
7
- const x = "_title_z7ezb_22", L = "_subtitle_z7ezb_43", a = {
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: x,
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: L,
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
- }, w = ({
34
- title: b,
35
- subtitle: c,
36
- rightChildren: h,
37
- bottomChildren: n,
38
- classNameWrapper: i,
39
- classNameTitle: l,
40
- classNameSubtitle: g,
41
- "data-testid-wrapper": y,
42
- "data-testid-title": u,
43
- "data-testid-subtitle": z,
44
- ...d
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 e = d, m = k(() => {
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 e.backLinkText && e.onBackLinkClick && _.push({
49
- label: e.backLinkText,
50
- className: e.classNameBackLink,
51
- "data-testid": e["data-testid-backLink"],
52
- onClick: e.onBackLinkClick
53
- }), e.breadcrumb && _.push(...e.breadcrumb), /* @__PURE__ */ t("div", { className: a["page-header__top-content"], children: /* @__PURE__ */ t("div", { className: a["page-header__breadcrumb"], children: _.map((r, p) => /* @__PURE__ */ t(
54
- f,
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: p === 0 ? /* @__PURE__ */ t(N, { icon: "arrow-left" }) : /* @__PURE__ */ t("span", { className: a["page-header__breadcrumb__separator"], children: "/" }),
57
- onClick: () => r.onClick && r.onClick(),
58
- className: r.className,
59
- "data-testid": r["data-testid"],
60
- disabled: _.length === 1 ? !1 : p === _.length - 1,
61
- children: r.label
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
- `${r.label}_${p}`
70
+ `${t.label}_${o}`
64
71
  )) }) });
65
- }, [
66
- e.breadcrumb,
67
- e.backLinkText,
68
- e.classNameBackLink,
69
- e["data-testid-backLink"],
70
- e.onBackLinkClick
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
- h && /* @__PURE__ */ t("div", { className: a["page-header__main-right-content"], children: h })
80
+ d && /* @__PURE__ */ a("div", { className: e["page-header__main-right-content"], children: d })
80
81
  ] }),
81
- n && /* @__PURE__ */ t("div", { className: a["page-header__bottom-content"], children: n })
82
+ b && /* @__PURE__ */ a("div", { className: e["page-header__bottom-content"], children: b })
82
83
  ] });
83
84
  };
84
85
  export {
85
- w as PageHeader
86
+ P as PageHeader
86
87
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pismo/marola",
3
3
  "description": "CDX tribe component library",
4
- "version": "0.0.1-alpha.30",
4
+ "version": "0.0.1-alpha.31",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",