@purpurds/breadcrumbs 3.3.1 → 3.4.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.
@@ -19,6 +19,7 @@ type CommonItemProps = {
19
19
  ["data-testid"]?: string;
20
20
  ariaLabel?: string;
21
21
  meta?: boolean;
22
+ onClick?: () => void;
22
23
  };
23
24
  export type BreadcrumbsItemProps = CommonItemProps & Conditional;
24
25
  type Conditional = {
@@ -30,7 +31,7 @@ type Conditional = {
30
31
  };
31
32
  declare const Breadcrumbs: {
32
33
  ({ ["data-testid"]: dataTestId, ariaLabel, children, className, meta, variant, }: BreadcrumbsProps): React.JSX.Element;
33
- Item: ({ href, ["data-testid"]: dataTestId, children, current, variant, ...rest }: BreadcrumbsItemProps) => React.JSX.Element;
34
+ Item: ({ href, ["data-testid"]: dataTestId, children, current, variant, onClick, ...rest }: BreadcrumbsItemProps) => React.JSX.Element;
34
35
  };
35
36
  export { Breadcrumbs };
36
37
  //# sourceMappingURL=breadcrumbs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../src/breadcrumbs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAyC,YAAY,EAAE,MAAM,OAAO,CAAC;AAOnF,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAEX,eAAO,MAAM,kBAAkB,4BAAoC,CAAC;AACpE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE7F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,YAAY,CAAC,oBAAoB,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,CAAC;IACzF,SAAS,CAAC,EAAE,M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C,CAAC;IACzF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,WAAW,CAAC;AAEjE,KAAK,WAAW,GACZ;IACE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAC;CAC3C,CAAC;AAKN,QAAA,MAAM,WAAW;sFAOd,gBAAgB;gGAmEhB,oBAAoB;CAVtB,CAAC;AAgDF,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { jsx as l, jsxs as v } from "react/jsx-runtime";
1
+ import { jsx as p, jsxs as y } from "react/jsx-runtime";
2
2
  import { Children as w, cloneElement as $, createElement as M } from "react";
3
3
  function E(e) {
4
4
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -11,11 +11,11 @@ var S = { exports: {} };
11
11
  */
12
12
  (function(e) {
13
13
  (function() {
14
- var s = {}.hasOwnProperty;
14
+ var u = {}.hasOwnProperty;
15
15
  function n() {
16
16
  for (var r = "", t = 0; t < arguments.length; t++) {
17
- var u = arguments[t];
18
- u && (r = i(r, a.call(this, u)));
17
+ var s = arguments[t];
18
+ s && (r = i(r, a.call(this, s)));
19
19
  }
20
20
  return r;
21
21
  }
@@ -29,8 +29,8 @@ var S = { exports: {} };
29
29
  if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
30
30
  return r.toString();
31
31
  var t = "";
32
- for (var u in r)
33
- s.call(r, u) && r[u] && (t = i(t, this && this[u] || u));
32
+ for (var s in r)
33
+ u.call(r, s) && r[s] && (t = i(t, this && this[s] || s));
34
34
  return t;
35
35
  }
36
36
  function i(r, t) {
@@ -53,7 +53,7 @@ const q = /* @__PURE__ */ E(L), B = {
53
53
  svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M11.38 1.848a.9.9 0 0 1 1.24 0l8.69 8.276c1.242 1.183.405 3.276-1.31 3.276h-.6v8.1a.9.9 0 0 1-.9.9h-13a.9.9 0 0 1-.9-.9v-8.1H4c-1.715 0-2.552-2.093-1.31-3.276l8.69-8.276ZM12 3.743l-8.069 7.685c-.026.024-.03.04-.032.049a.11.11 0 0 0 .008.06.11.11 0 0 0 .036.049c.007.005.021.014.057.014h1.5a.9.9 0 0 1 .9.9v8.1h11.2v-8.1a.9.9 0 0 1 .9-.9H20c.036 0 .05-.009.057-.014a.111.111 0 0 0 .036-.049.111.111 0 0 0 .008-.06c-.002-.008-.006-.025-.032-.05L12 3.744ZM10.6 14a.9.9 0 0 1 .9-.9H15a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9h-3.5a.9.9 0 0 1-.9-.9v-4Zm1.8.9v2.2h1.7v-2.2h-1.7Z" clip-rule="evenodd"/></svg>',
54
54
  keywords: ["home"],
55
55
  category: "buildings"
56
- }, j = (e) => /* @__PURE__ */ l(
56
+ }, j = (e) => /* @__PURE__ */ p(
57
57
  R,
58
58
  {
59
59
  ...e,
@@ -61,31 +61,31 @@ const q = /* @__PURE__ */ E(L), B = {
61
61
  }
62
62
  );
63
63
  j.displayName = "IconHome";
64
- const P = q.bind(B), N = "purpur-icon", T = "md", V = (e) => e.filter((s) => Object.keys(s).length >= 1).map((s) => `${s.name}="${s.value}"`).join(" "), C = ({ content: e = "", title: s } = {}) => {
64
+ const P = q.bind(B), N = "purpur-icon", T = "md", V = (e) => e.filter((u) => Object.keys(u).length >= 1).map((u) => `${u.name}="${u.value}"`).join(" "), C = ({ content: e = "", title: u } = {}) => {
65
65
  const n = [
66
66
  { name: "xmlns", value: "http://www.w3.org/2000/svg" },
67
67
  { name: "fill", value: "currentColor" },
68
68
  { name: "viewBox", value: "0 0 24 24" },
69
- s ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
70
- ], a = s ? `<title>${s}</title>` : "";
69
+ u ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
70
+ ], a = u ? `<title>${u}</title>` : "";
71
71
  return `<svg ${V(n)}>${a}${e}</svg>`;
72
72
  }, D = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), R = ({
73
73
  ["data-testid"]: e,
74
- svg: s,
74
+ svg: u,
75
75
  allyTitle: n,
76
76
  className: a = "",
77
77
  size: i = T,
78
78
  ...r
79
79
  }) => {
80
80
  const t = C({
81
- content: D(s.svg),
81
+ content: D(u.svg),
82
82
  title: n
83
- }), u = P(a, N, `${N}--${i}`);
84
- return /* @__PURE__ */ l(
83
+ }), s = P(a, N, `${N}--${i}`);
84
+ return /* @__PURE__ */ p(
85
85
  "span",
86
86
  {
87
87
  "aria-label": n,
88
- className: u,
88
+ className: s,
89
89
  "data-testid": e,
90
90
  dangerouslySetInnerHTML: { __html: t },
91
91
  ...r
@@ -103,11 +103,11 @@ var I = { exports: {} };
103
103
  */
104
104
  (function(e) {
105
105
  (function() {
106
- var s = {}.hasOwnProperty;
106
+ var u = {}.hasOwnProperty;
107
107
  function n() {
108
108
  for (var r = "", t = 0; t < arguments.length; t++) {
109
- var u = arguments[t];
110
- u && (r = i(r, a(u)));
109
+ var s = arguments[t];
110
+ s && (r = i(r, a(s)));
111
111
  }
112
112
  return r;
113
113
  }
@@ -121,8 +121,8 @@ var I = { exports: {} };
121
121
  if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
122
122
  return r.toString();
123
123
  var t = "";
124
- for (var u in r)
125
- s.call(r, u) && r[u] && (t = i(t, u));
124
+ for (var s in r)
125
+ u.call(r, s) && r[s] && (t = i(t, s));
126
126
  return t;
127
127
  }
128
128
  function i(r, t) {
@@ -142,11 +142,11 @@ const O = /* @__PURE__ */ Z(F), o = {
142
142
  "purpur-breadcrumb-item--current": "_purpur-breadcrumb-item--current_hceki_64",
143
143
  "purpur-breadcrumb-item--negative": "_purpur-breadcrumb-item--negative_hceki_84",
144
144
  "purpur-breadcrumb-item__separator": "_purpur-breadcrumb-item__separator_hceki_87"
145
- }, z = (e, s, n) => ({
145
+ }, z = (e, u, n) => ({
146
146
  "@type": "ListItem",
147
147
  position: n,
148
148
  name: e,
149
- item: s
149
+ item: u
150
150
  }), U = (e) => JSON.stringify({
151
151
  "@context": "https://schema.org",
152
152
  "@type": "BreadcrumbList",
@@ -154,60 +154,62 @@ const O = /* @__PURE__ */ Z(F), o = {
154
154
  }), J = {
155
155
  DEFAULT: "default",
156
156
  NEGATIVE: "negative"
157
- }, G = Object.values(J), f = "purpur-breadcrumbs", b = "purpur-breadcrumb-item", K = ({
157
+ }, G = Object.values(J), b = "purpur-breadcrumbs", h = "purpur-breadcrumb-item", K = ({
158
158
  ["data-testid"]: e,
159
- ariaLabel: s,
159
+ ariaLabel: u,
160
160
  children: n,
161
161
  className: a,
162
162
  meta: i = !0,
163
163
  variant: r = "default"
164
164
  }) => {
165
- const t = O([a, o[f], o[`${f}--${r}`]]), u = w.count(n), p = [], g = w.map(n, (h, k) => {
166
- const x = k + 1, A = u === x, m = h.props.children, c = typeof m == "string" ? null : m.props;
167
- let d = null, _ = null;
168
- return typeof m == "string" ? (d = m, _ = h.props.href) : c != null && c.children && typeof (c == null ? void 0 : c.children) == "string" && (d = c.children, _ = c.href), d && _ && p.push(z(d, _, x)), $(h, {
165
+ const t = O([a, o[b], o[`${b}--${r}`]]), s = w.count(n), l = [], m = w.map(n, (g, k) => {
166
+ const x = k + 1, A = s === x, d = g.props.children, c = typeof d == "string" ? null : d.props;
167
+ let _ = null, f = null;
168
+ return typeof d == "string" ? (_ = d, f = g.props.href) : c != null && c.children && typeof (c == null ? void 0 : c.children) == "string" && (_ = c.children, f = c.href), _ && f && l.push(z(_, f, x)), $(g, {
169
169
  current: A,
170
170
  variant: r
171
171
  });
172
- }), y = p.length === u ? U(p) : null;
173
- return /* @__PURE__ */ v("nav", { "data-testid": e, "aria-label": s || "Breadcrumb", className: t, children: [
174
- /* @__PURE__ */ v("ol", { className: o[`${f}__list`], children: [
175
- /* @__PURE__ */ l("li", { "aria-hidden": "true", className: o[`${f}__home`], children: /* @__PURE__ */ l(j, { size: "xs" }) }),
176
- g
172
+ }), v = l.length === s ? U(l) : null;
173
+ return /* @__PURE__ */ y("nav", { "data-testid": e, "aria-label": u || "Breadcrumb", className: t, children: [
174
+ /* @__PURE__ */ y("ol", { className: o[`${b}__list`], children: [
175
+ /* @__PURE__ */ p("li", { "aria-hidden": "true", className: o[`${b}__home`], children: /* @__PURE__ */ p(j, { size: "xs" }) }),
176
+ m
177
177
  ] }),
178
- i && y ? /* @__PURE__ */ l(
178
+ i && v ? /* @__PURE__ */ p(
179
179
  "script",
180
180
  {
181
181
  type: "application/ld+json",
182
182
  "data-testid": "breadcrumbs-meta",
183
- dangerouslySetInnerHTML: { __html: y }
183
+ dangerouslySetInnerHTML: { __html: v }
184
184
  }
185
185
  ) : null
186
186
  ] });
187
187
  }, Q = ({
188
188
  href: e,
189
- ["data-testid"]: s,
189
+ ["data-testid"]: u,
190
190
  children: n,
191
191
  current: a = !1,
192
192
  variant: i = "default",
193
- ...r
193
+ onClick: r,
194
+ ...t
194
195
  }) => {
195
- const t = O([o[b], o[`${b}--${i}`]], {
196
- [o[`${b}--current`]]: a
196
+ const s = O([o[h], o[`${h}--${i}`]], {
197
+ [o[`${h}--current`]]: a
197
198
  });
198
- return /* @__PURE__ */ v("li", { ...r, className: t, children: [
199
+ return /* @__PURE__ */ y("li", { ...t, className: s, children: [
199
200
  (() => {
200
- const p = {
201
+ const m = {
201
202
  href: e,
202
- "data-testid": s,
203
- "aria-current": a ? "page" : void 0
203
+ "data-testid": u,
204
+ "aria-current": a ? "page" : void 0,
205
+ onClick: r
204
206
  };
205
- return e || typeof n == "string" ? M("a", p, n) : $(n, {
206
- ...p,
207
+ return e || typeof n == "string" ? M("a", m, n) : $(n, {
208
+ ...m,
207
209
  ...n.props
208
210
  });
209
211
  })(),
210
- a ? null : /* @__PURE__ */ l("span", { "aria-hidden": !0, className: o[`${b}__separator`], children: "/" })
212
+ a ? null : /* @__PURE__ */ p("span", { "aria-hidden": !0, className: o[`${h}__separator`], children: "/" })
211
213
  ] });
212
214
  };
213
215
  K.Item = Q;