@purpurds/breadcrumbs 4.5.1 → 5.0.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,22 +1,16 @@
1
1
  import { default as React, ReactElement } from 'react';
2
2
 
3
- export declare const BREADCRUMB_VARIANT: {
4
- readonly DEFAULT: "default";
5
- readonly NEGATIVE: "negative";
6
- };
7
- export declare const breadcrumbVariants: ("default" | "negative")[];
8
- export type BreadcrumbVariant = (typeof BREADCRUMB_VARIANT)[keyof typeof BREADCRUMB_VARIANT];
9
3
  export type BreadcrumbsProps = {
10
4
  ["data-testid"]?: string;
11
5
  ariaLabel?: string;
12
6
  children: ReactElement<BreadcrumbsItemProps> | Array<ReactElement<BreadcrumbsItemProps>>;
13
7
  className?: string;
14
8
  meta?: boolean;
15
- variant?: BreadcrumbVariant;
9
+ negative?: boolean;
16
10
  };
17
11
  type CommonItemProps = {
18
12
  current?: boolean;
19
- variant?: BreadcrumbVariant;
13
+ negative?: boolean;
20
14
  ["data-testid"]?: string;
21
15
  ariaLabel?: string;
22
16
  meta?: boolean;
@@ -31,8 +25,8 @@ type Conditional = {
31
25
  children: ReactElement<HTMLAnchorElement>;
32
26
  };
33
27
  declare const Breadcrumbs: {
34
- ({ ["data-testid"]: dataTestId, ariaLabel, children, className, meta, variant, }: BreadcrumbsProps): React.JSX.Element;
35
- Item: ({ href, ["data-testid"]: dataTestId, children, current, variant, onClick, ...rest }: BreadcrumbsItemProps) => React.JSX.Element;
28
+ ({ ["data-testid"]: dataTestId, ariaLabel, children, className, meta, negative, }: BreadcrumbsProps): React.JSX.Element;
29
+ Item: ({ href, ["data-testid"]: dataTestId, children, current, negative, onClick, ...rest }: BreadcrumbsItemProps) => React.JSX.Element;
36
30
  };
37
31
  export { Breadcrumbs };
38
32
  //# sourceMappingURL=breadcrumbs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../src/breadcrumbs.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EAAE,CAAC"}
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,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,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,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;uFAOd,gBAAgB;iGA4EhB,oBAAoB;CAVtB,CAAC;AAmDF,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1,6 +1,6 @@
1
- import { jsx as p, jsxs as x, Fragment as M } from "react/jsx-runtime";
2
- import { Children as w, cloneElement as $, createElement as L } from "react";
3
- function q(e) {
1
+ import { jsx as o, jsxs as x, Fragment as L } from "react/jsx-runtime";
2
+ import { Children as w, cloneElement as N, createElement as E } from "react";
3
+ function H(e) {
4
4
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
5
5
  }
6
6
  var S = { exports: {} };
@@ -40,7 +40,7 @@ var S = { exports: {} };
40
40
  })();
41
41
  })(S);
42
42
  var B = S.exports;
43
- const H = /* @__PURE__ */ q(B), T = {
43
+ const P = /* @__PURE__ */ H(B), A = {
44
44
  "purpur-icon": "_purpur-icon_8u1lq_1",
45
45
  "purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
46
46
  "purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
@@ -48,28 +48,28 @@ const H = /* @__PURE__ */ q(B), T = {
48
48
  "purpur-icon--md": "_purpur-icon--md_8u1lq_16",
49
49
  "purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
50
50
  "purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
51
- }, P = {
51
+ }, Z = {
52
52
  name: "home",
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__ */ p(
57
- z,
56
+ }, j = (e) => /* @__PURE__ */ o(
57
+ F,
58
58
  {
59
59
  ...e,
60
- svg: P
60
+ svg: Z
61
61
  }
62
62
  );
63
63
  j.displayName = "IconHome";
64
- const V = H.bind(T), N = "purpur-icon", C = "md", D = (e) => e.filter((u) => Object.keys(u).length >= 1).map((u) => `${u.name}="${u.value}"`).join(" "), R = ({ content: e = "", title: u } = {}) => {
64
+ const z = P.bind(A), $ = "purpur-icon", C = "md", T = (e) => e.filter((u) => Object.keys(u).length >= 1).map((u) => `${u.name}="${u.value}"`).join(" "), k = ({ content: e = "", title: u } = {}) => {
65
65
  const s = [
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
69
  u ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
70
70
  ], a = u ? `<title>${u}</title>` : "";
71
- return `<svg ${D(s)}>${a}${e}</svg>`;
72
- }, Z = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), z = ({
71
+ return `<svg ${T(s)}>${a}${e}</svg>`;
72
+ }, D = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), F = ({
73
73
  ["data-testid"]: e,
74
74
  svg: u,
75
75
  allyTitle: s,
@@ -77,11 +77,11 @@ const V = H.bind(T), N = "purpur-icon", C = "md", D = (e) => e.filter((u) => Obj
77
77
  size: i = C,
78
78
  ...r
79
79
  }) => {
80
- const t = R({
81
- content: Z(u.svg),
80
+ const t = k({
81
+ content: D(u.svg),
82
82
  title: s
83
- }), n = V(a, N, `${N}--${i}`);
84
- return /* @__PURE__ */ p(
83
+ }), n = z(a, $, `${$}--${i}`);
84
+ return /* @__PURE__ */ o(
85
85
  "span",
86
86
  {
87
87
  "aria-label": s,
@@ -92,7 +92,7 @@ const V = H.bind(T), N = "purpur-icon", C = "md", D = (e) => e.filter((u) => Obj
92
92
  }
93
93
  );
94
94
  };
95
- function F(e) {
95
+ function V(e) {
96
96
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
97
97
  }
98
98
  var I = { exports: {} };
@@ -131,8 +131,8 @@ var I = { exports: {} };
131
131
  e.exports ? (s.default = s, e.exports = s) : window.classNames = s;
132
132
  })();
133
133
  })(I);
134
- var k = I.exports;
135
- const O = /* @__PURE__ */ F(k), o = {
134
+ var J = I.exports;
135
+ const O = /* @__PURE__ */ V(J), c = {
136
136
  "purpur-breadcrumbs": "_purpur-breadcrumbs_11sb5_1",
137
137
  "purpur-breadcrumbs--default": "_purpur-breadcrumbs--default_11sb5_18",
138
138
  "purpur-breadcrumbs--negative": "_purpur-breadcrumbs--negative_11sb5_32",
@@ -142,43 +142,44 @@ const O = /* @__PURE__ */ F(k), o = {
142
142
  "purpur-breadcrumb-item--current": "_purpur-breadcrumb-item--current_11sb5_67",
143
143
  "purpur-breadcrumb-item--negative": "_purpur-breadcrumb-item--negative_11sb5_87",
144
144
  "purpur-breadcrumb-item__separator": "_purpur-breadcrumb-item__separator_11sb5_90"
145
- }, U = (e, u, s) => ({
145
+ }, R = (e, u, s) => ({
146
146
  "@type": "ListItem",
147
147
  position: s,
148
148
  name: e,
149
149
  item: u
150
- }), J = (e) => JSON.stringify({
150
+ }), K = (e) => JSON.stringify({
151
151
  "@context": "https://schema.org",
152
152
  "@type": "BreadcrumbList",
153
153
  itemListElement: e
154
- }), K = {
155
- DEFAULT: "default",
156
- NEGATIVE: "negative"
157
- }, rr = Object.values(K), h = "purpur-breadcrumbs", v = "purpur-breadcrumb-item", Q = ({
154
+ }), h = "purpur-breadcrumbs", v = "purpur-breadcrumb-item", Q = ({
158
155
  ["data-testid"]: e,
159
156
  ariaLabel: u,
160
157
  children: s,
161
158
  className: a,
162
159
  meta: i = !0,
163
- variant: r = "default"
160
+ negative: r = !1
164
161
  }) => {
165
- const t = O([a, o[h], o[`${h}--${r}`]]), n = w.count(s), l = [], m = w.map(s, (d, E) => {
166
- const y = E + 1, A = n === y, _ = d.props.children, c = typeof _ == "string" ? null : _.props;
162
+ const t = O([
163
+ a,
164
+ c[h],
165
+ c[`${h}--${r ? "negative" : "default"}`]
166
+ ]), n = w.count(s), l = [], m = w.map(s, (d, M) => {
167
+ const y = M + 1, q = n === y, _ = d.props.children, p = typeof _ == "string" ? null : _.props;
167
168
  let b = null, f = null;
168
- return typeof _ == "string" ? (b = _, f = d.props.href) : c != null && c.children && typeof (c == null ? void 0 : c.children) == "string" && (b = c.children, f = c.href), b && f && l.push(U(b, f, y)), $(d, {
169
- current: A,
170
- variant: r,
169
+ return typeof _ == "string" ? (b = _, f = d.props.href) : p != null && p.children && typeof (p == null ? void 0 : p.children) == "string" && (b = p.children, f = p.href), b && f && l.push(R(b, f, y)), N(d, {
170
+ current: q,
171
+ negative: r,
171
172
  ...y === 1 && {
172
- children: /* @__PURE__ */ x(M, { children: [
173
- /* @__PURE__ */ p("span", { className: o[`${h}__home`], "aria-hidden": "true", children: /* @__PURE__ */ p(j, { size: "xs" }) }),
173
+ children: /* @__PURE__ */ x(L, { children: [
174
+ /* @__PURE__ */ o("span", { className: c[`${h}__home`], "aria-hidden": "true", children: /* @__PURE__ */ o(j, { size: "xs" }) }),
174
175
  d.props.children
175
176
  ] })
176
177
  }
177
178
  });
178
- }), g = l.length === n ? J(l) : null;
179
+ }), g = l.length === n ? K(l) : null;
179
180
  return /* @__PURE__ */ x("nav", { "data-testid": e, "aria-label": u || "Breadcrumb", className: t, children: [
180
- /* @__PURE__ */ p("ol", { className: o[`${h}__list`], children: m }),
181
- i && g ? /* @__PURE__ */ p(
181
+ /* @__PURE__ */ o("ol", { className: c[`${h}__list`], children: m }),
182
+ i && g ? /* @__PURE__ */ o(
182
183
  "script",
183
184
  {
184
185
  type: "application/ld+json",
@@ -187,18 +188,21 @@ const O = /* @__PURE__ */ F(k), o = {
187
188
  }
188
189
  ) : null
189
190
  ] });
190
- }, W = ({
191
+ }, U = ({
191
192
  href: e,
192
193
  ["data-testid"]: u,
193
194
  children: s,
194
195
  current: a = !1,
195
- variant: i = "default",
196
+ negative: i = !1,
196
197
  onClick: r,
197
198
  ...t
198
199
  }) => {
199
- const n = O([o[v], o[`${v}--${i}`]], {
200
- [o[`${v}--current`]]: a
201
- });
200
+ const n = O(
201
+ [c[v], c[`${v}--${i ? "negative" : "default"}`]],
202
+ {
203
+ [c[`${v}--current`]]: a
204
+ }
205
+ );
202
206
  return /* @__PURE__ */ x("li", { ...t, className: n, children: [
203
207
  (() => {
204
208
  const m = {
@@ -207,18 +211,16 @@ const O = /* @__PURE__ */ F(k), o = {
207
211
  "aria-current": a ? "page" : void 0,
208
212
  onClick: r
209
213
  };
210
- return e || typeof s == "string" ? L("a", m, s) : $(s, {
214
+ return e || typeof s == "string" ? E("a", m, s) : N(s, {
211
215
  ...m,
212
216
  ...s.props
213
217
  });
214
218
  })(),
215
- a ? null : /* @__PURE__ */ p("span", { "aria-hidden": !0, className: o[`${v}__separator`], children: "/" })
219
+ a ? null : /* @__PURE__ */ o("span", { "aria-hidden": !0, className: c[`${v}__separator`], children: "/" })
216
220
  ] });
217
221
  };
218
- Q.Item = W;
222
+ Q.Item = U;
219
223
  export {
220
- K as BREADCRUMB_VARIANT,
221
- Q as Breadcrumbs,
222
- rr as breadcrumbVariants
224
+ Q as Breadcrumbs
223
225
  };
224
226
  //# sourceMappingURL=breadcrumbs.es.js.map