@justeattakeaway/pie-breadcrumb 0.3.0 → 0.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.
@@ -24,9 +24,9 @@
24
24
  "kind": "variable",
25
25
  "name": "defaultProps",
26
26
  "type": {
27
- "text": "Pick<BreadcrumbProps, 'variant' | 'isCompact'>"
27
+ "text": "DefaultProps"
28
28
  },
29
- "default": "{\n variant: 'default',\n isCompact: false,\n}"
29
+ "default": "{\r\n variant: 'default',\r\n isCompact: false,\r\n}"
30
30
  }
31
31
  ],
32
32
  "exports": [
@@ -59,31 +59,92 @@
59
59
  "members": [
60
60
  {
61
61
  "kind": "field",
62
- "name": "items",
63
- "type": {
64
- "text": "BreadcrumbProps['items']"
65
- },
62
+ "name": "variant",
66
63
  "privacy": "public",
67
- "default": "[]",
68
- "attribute": "items"
64
+ "attribute": "variant"
69
65
  },
70
66
  {
71
67
  "kind": "field",
72
- "name": "variant",
68
+ "name": "isCompact",
73
69
  "privacy": "public",
74
- "attribute": "variant"
70
+ "attribute": "isCompact",
71
+ "reflects": true
72
+ }
73
+ ],
74
+ "attributes": [
75
+ {
76
+ "name": "variant",
77
+ "fieldName": "variant"
75
78
  },
76
79
  {
77
- "kind": "field",
78
80
  "name": "isCompact",
81
+ "fieldName": "isCompact"
82
+ }
83
+ ],
84
+ "superclass": {
85
+ "name": "PieElement",
86
+ "package": "@justeattakeaway/pie-webc-core/src/internals/PieElement"
87
+ },
88
+ "tagName": "pie-breadcrumb",
89
+ "customElement": true
90
+ }
91
+ ],
92
+ "exports": [
93
+ {
94
+ "kind": "js",
95
+ "name": "*",
96
+ "declaration": {
97
+ "name": "*",
98
+ "package": "./defs"
99
+ }
100
+ },
101
+ {
102
+ "kind": "js",
103
+ "name": "PieBreadcrumb",
104
+ "declaration": {
105
+ "name": "PieBreadcrumb",
106
+ "module": "src/index.js"
107
+ }
108
+ }
109
+ ]
110
+ },
111
+ {
112
+ "kind": "javascript-module",
113
+ "path": "src/pie-breadcrumb-item/defs-react.js",
114
+ "declarations": [],
115
+ "exports": []
116
+ },
117
+ {
118
+ "kind": "javascript-module",
119
+ "path": "src/pie-breadcrumb-item/defs.js",
120
+ "declarations": [],
121
+ "exports": []
122
+ },
123
+ {
124
+ "kind": "javascript-module",
125
+ "path": "src/pie-breadcrumb-item/index.js",
126
+ "declarations": [
127
+ {
128
+ "kind": "class",
129
+ "description": "",
130
+ "name": "PieBreadcrumbItem",
131
+ "members": [
132
+ {
133
+ "kind": "field",
134
+ "name": "href",
135
+ "type": {
136
+ "text": "string"
137
+ },
79
138
  "privacy": "public",
80
- "attribute": "isCompact"
139
+ "default": "''",
140
+ "attribute": "href",
141
+ "reflects": true
81
142
  },
82
143
  {
83
144
  "kind": "method",
84
145
  "name": "renderSeparator",
85
146
  "privacy": "private",
86
- "description": "Renders a separator icon between breadcrumb items.\nThe icon direction depends on the RTL (Right-to-Left) setting.",
147
+ "description": "Renders a separator icon between breadcrumb items.\r\nThe icon direction depends on the RTL (Right-to-Left) setting.",
87
148
  "return": {
88
149
  "type": {
89
150
  "text": "TemplateResult"
@@ -94,130 +155,17 @@
94
155
  "kind": "method",
95
156
  "name": "renderNavigationLink",
96
157
  "privacy": "private",
97
- "parameters": [
98
- {
99
- "name": "item",
100
- "type": {
101
- "text": "BreadcrumbItem"
102
- },
103
- "description": "The breadcrumb item containing label and URL."
104
- }
105
- ],
106
158
  "description": "Renders a navigation link for a breadcrumb item."
107
- },
108
- {
109
- "kind": "method",
110
- "name": "renderLastItem",
111
- "privacy": "private",
112
- "parameters": [
113
- {
114
- "name": "item",
115
- "type": {
116
- "text": "BreadcrumbItem"
117
- },
118
- "description": "The breadcrumb item containing label and URL."
119
- }
120
- ],
121
- "description": "Renders the last breadcrumb item.\nIt has 250px of max-width. If the label reaches this width the text truncates."
122
- },
123
- {
124
- "kind": "method",
125
- "name": "renderItem",
126
- "privacy": "private",
127
- "parameters": [
128
- {
129
- "name": "item",
130
- "type": {
131
- "text": "BreadcrumbItem"
132
- },
133
- "description": "The breadcrumb item to render."
134
- },
135
- {
136
- "name": "isLastItem",
137
- "default": "false",
138
- "description": "Indicates if the item is the last in the breadcrumb trail.",
139
- "optional": true,
140
- "type": {
141
- "text": "boolean"
142
- }
143
- }
144
- ],
145
- "description": "Renders an individual breadcrumb item.\n\nConditionally renders either a clickable link or plain text for the last item."
146
- },
147
- {
148
- "kind": "method",
149
- "name": "renderDefaultBreadcrumb",
150
- "privacy": "private",
151
- "parameters": [
152
- {
153
- "name": "items",
154
- "type": {
155
- "text": "BreadcrumbProps['items']"
156
- },
157
- "description": "Breadcrumb items to render."
158
- }
159
- ],
160
- "description": "Renders breadcrumb items using the default variant style."
161
- },
162
- {
163
- "kind": "method",
164
- "name": "renderCompactBreadcrumbSeparator",
165
- "privacy": "private",
166
- "description": "Renders a separator icon specifically for the back variant.\nThe icon direction depends on the RTL (Right-to-Left) setting."
167
- },
168
- {
169
- "kind": "method",
170
- "name": "renderCompactBreadcrumb",
171
- "privacy": "private",
172
- "parameters": [
173
- {
174
- "name": "items",
175
- "type": {
176
- "text": "BreadcrumbProps['items']"
177
- },
178
- "description": "Breadcrumb items to render."
179
- }
180
- ],
181
- "description": "Renders breadcrumb items using the back variant style, displaying only the last item with a preceding separator."
182
- },
183
- {
184
- "kind": "method",
185
- "name": "renderBreadcrumbItems",
186
- "privacy": "private",
187
- "parameters": [
188
- {
189
- "name": "items",
190
- "type": {
191
- "text": "BreadcrumbProps['items']"
192
- },
193
- "description": "Array of breadcrumb items to render."
194
- },
195
- {
196
- "name": "isCompact",
197
- "type": {
198
- "text": "BreadcrumbProps['isCompact']"
199
- }
200
- }
201
- ],
202
- "description": "Renders a complete breadcrumb list.\nIterates over breadcrumb items to generate the breadcrumb trail."
203
159
  }
204
160
  ],
205
161
  "attributes": [
206
162
  {
207
- "name": "items",
163
+ "name": "href",
208
164
  "type": {
209
- "text": "BreadcrumbProps['items']"
165
+ "text": "string"
210
166
  },
211
- "default": "[]",
212
- "fieldName": "items"
213
- },
214
- {
215
- "name": "variant",
216
- "fieldName": "variant"
217
- },
218
- {
219
- "name": "isCompact",
220
- "fieldName": "isCompact"
167
+ "default": "''",
168
+ "fieldName": "href"
221
169
  }
222
170
  ],
223
171
  "mixins": [
@@ -230,7 +178,7 @@
230
178
  "name": "PieElement",
231
179
  "package": "@justeattakeaway/pie-webc-core/src/internals/PieElement"
232
180
  },
233
- "tagName": "pie-breadcrumb",
181
+ "tagName": "pie-breadcrumb-item",
234
182
  "customElement": true
235
183
  }
236
184
  ],
@@ -245,10 +193,10 @@
245
193
  },
246
194
  {
247
195
  "kind": "js",
248
- "name": "PieBreadcrumb",
196
+ "name": "PieBreadcrumbItem",
249
197
  "declaration": {
250
- "name": "PieBreadcrumb",
251
- "module": "src/index.js"
198
+ "name": "PieBreadcrumbItem",
199
+ "module": "src/pie-breadcrumb-item/index.js"
252
200
  }
253
201
  }
254
202
  ]
@@ -0,0 +1,13 @@
1
+ import { LitElement as e } from "lit";
2
+ const r = class r extends e {
3
+ willUpdate() {
4
+ this.getAttribute("v") || this.setAttribute("v", r.v);
5
+ }
6
+ };
7
+ r.v = "0.4.0";
8
+ let t = r;
9
+ const o = "*,*:after,*:before{box-sizing:inherit}.c-breadcrumb{--breadcrumb-background-color: var(--dt-color-transparent);--breadcrumb-item-flex-direction: row;--breadcrumb-item-color: var(--dt-color-content-link);--breadcrumb-separator-color: var(--dt-color-content-subdued);--breadcrumb-separator-transform: none;background-color:var(--breadcrumb-background-color);padding:var(--dt-spacing-a) var(--dt-spacing-d)}.c-breadcrumb--scrim{--breadcrumb-background-color: var(--dt-color-overlay);--breadcrumb-item-color: var(--dt-color-content-link-light);--breadcrumb-separator-color: var(--dt-color-content-light);border-radius:var(--dt-radius-rounded-e)}.c-breadcrumb-list{margin:0;padding:0;display:flex;flex-flow:row;gap:var(--dt-spacing-a)}.c-breadcrumb-item{display:flex;flex-direction:var(--breadcrumb-item-flex-direction);align-items:center;white-space:nowrap;gap:var(--dt-spacing-a)}.c-breadcrumb-item pie-link{--link-text-color: var(--breadcrumb-item-color);--link-font-weight: var(--dt-font-weight-bold)}.c-breadcrumb-separator{display:inline-flex;color:var(--breadcrumb-separator-color);transform:var(--breadcrumb-separator-transform)}:host([isCompact]) .c-breadcrumb{--breadcrumb-item-flex-direction: row-reverse;--breadcrumb-separator-transform: rotate(180deg)}:host([isCompact]) ::slotted(pie-breadcrumb-item:not(:nth-last-of-type(2))){display:none}:host(:last-of-type) pie-link{--link-font-weight: var(--dt-font-weight-regular)}:host(:last-of-type) pie-link span{max-width:250px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host(:last-of-type) .c-breadcrumb-separator{display:none}:host ::slotted(pie-breadcrumb-item:only-child){display:none}";
10
+ export {
11
+ t as P,
12
+ o as s
13
+ };
package/dist/defs.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import { type ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
2
+ export declare const variants: readonly ["default", "scrim"];
3
+ export interface BreadcrumbProps {
4
+ /**
5
+ * Optional variant for styling the breadcrumb component.
6
+ */
7
+ variant?: typeof variants[number];
8
+ /**
9
+ * Optional property for rendering a compact variation of the breadcrumb.
10
+ */
11
+ isCompact?: boolean;
12
+ }
13
+ export type DefaultProps = ComponentDefaultProps<BreadcrumbProps>;
14
+ export declare const defaultProps: DefaultProps;
15
+ //# sourceMappingURL=defs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../src/defs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E,eAAO,MAAM,QAAQ,+BAAgC,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;IAElC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,YAAY,GAAG,qBAAqB,CAAC,eAAe,CAAC,CAAC;AAElE,eAAO,MAAM,YAAY,EAAC,YAGzB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,110 +1,19 @@
1
- import type { CSSResult } from 'lit';
2
- import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
3
- import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
4
- import type { RTLInterface } from '@justeattakeaway/pie-webc-core';
5
- import type { TemplateResult } from 'lit-html';
6
-
7
- export declare type BreadcrumbItem = {
8
- label: string;
9
- href: string;
10
- };
11
-
12
- export declare interface BreadcrumbProps {
13
- items: BreadcrumbItem[];
14
- /**
15
- * Optional variant for styling the breadcrumb component.
16
- */
17
- variant?: typeof variants[number];
18
- /**
19
- * Optional property for rendering a compact variation of the breadcrumb.
20
- */
21
- isCompact?: boolean;
22
- }
23
-
24
- export declare const defaultProps: Pick<BreadcrumbProps, 'variant' | 'isCompact'>;
25
-
26
- /**
27
- * @tagname pie-breadcrumb
28
- */
29
- export declare class PieBreadcrumb extends PieBreadcrumb_base implements BreadcrumbProps {
30
- items: BreadcrumbProps['items'];
31
- variant: "default" | "scrim" | undefined;
32
- isCompact: boolean | undefined;
33
- /**
34
- * Renders a separator icon between breadcrumb items.
35
- * The icon direction depends on the RTL (Right-to-Left) setting.
36
- *
37
- * @returns {TemplateResult} HTML template for the separator icon.
38
- *
39
- * @private
40
- */
41
- private renderSeparator;
42
- /**
43
- * Renders a navigation link for a breadcrumb item.
44
- *
45
- * @param {BreadcrumbItem} item - The breadcrumb item containing label and URL.
46
- *
47
- * @private
48
- */
49
- private renderNavigationLink;
50
- /**
51
- * Renders the last breadcrumb item.
52
- * It has 250px of max-width. If the label reaches this width the text truncates.
53
- *
54
- * @param {BreadcrumbItem} item - The breadcrumb item containing label and URL.
55
- *
56
- * @private
57
- */
58
- private renderLastItem;
59
- /**
60
- * Renders an individual breadcrumb item.
61
-
62
- * Conditionally renders either a clickable link or plain text for the last item.
63
- *
64
- * @param {BreadcrumbItem} item - The breadcrumb item to render.
65
- * @param {boolean} [isLastItem=false] - Indicates if the item is the last in the breadcrumb trail.
66
- *
67
- * @private
68
- */
69
- private renderItem;
70
- /**
71
- * Renders breadcrumb items using the default variant style.
72
- *
73
- * @param {BreadcrumbProps['items']} items - Breadcrumb items to render.
74
- *
75
- * @private
76
- */
77
- private renderDefaultBreadcrumb;
78
- /**
79
- * Renders a separator icon specifically for the back variant.
80
- * The icon direction depends on the RTL (Right-to-Left) setting.
81
- *
82
- * @private
83
- */
84
- private renderCompactBreadcrumbSeparator;
85
- /**
86
- * Renders breadcrumb items using the back variant style, displaying only the last item with a preceding separator.
87
- *
88
- * @param {BreadcrumbProps['items']} items - Breadcrumb items to render.
89
- *
90
- * @private
91
- */
92
- private renderCompactBreadcrumb;
93
- /**
94
- * Renders a complete breadcrumb list.
95
- * Iterates over breadcrumb items to generate the breadcrumb trail.
96
- *
97
- * @param {BreadcrumbProps['items']} items - Array of breadcrumb items to render.
98
- *
99
- * @private
100
- */
101
- private renderBreadcrumbItems;
102
- render(): TemplateResult<1>;
103
- static styles: CSSResult;
104
- }
105
-
106
- declare const PieBreadcrumb_base: GenericConstructor<RTLInterface> & typeof PieElement;
107
-
108
- export declare const variants: readonly ["default", "scrim"];
109
-
110
- export { }
1
+ import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
2
+ import { type BreadcrumbProps } from './defs';
3
+ declare const componentSelector = "pie-breadcrumb";
4
+ export * from './defs';
5
+ /**
6
+ * @tagname pie-breadcrumb
7
+ */
8
+ export declare class PieBreadcrumb extends PieElement implements BreadcrumbProps {
9
+ variant: "default" | "scrim";
10
+ isCompact: boolean;
11
+ render(): import("lit-html").TemplateResult<1>;
12
+ static styles: import("lit").CSSResult;
13
+ }
14
+ declare global {
15
+ interface HTMLElementTagNameMap {
16
+ [componentSelector]: PieBreadcrumb;
17
+ }
18
+ }
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,yDAAyD,CAAC;AAGrF,OAAO,EACH,KAAK,eAAe,EAGvB,MAAM,QAAQ,CAAC;AAEhB,QAAA,MAAM,iBAAiB,mBAAmB,CAAC;AAG3C,cAAc,QAAQ,CAAC;AAEvB;;GAEG;AACH,qBACa,aAAc,SAAQ,UAAW,YAAW,eAAe;IAG7D,OAAO,sBAAwB;IAG/B,SAAS,UAA0B;IAE1C,MAAM;IAqBN,MAAM,CAAC,MAAM,0BAAqB;CACrC;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC;KACtC;CACJ"}
package/dist/index.js CHANGED
@@ -1,189 +1,52 @@
1
- import { LitElement as f, html as a, nothing as u, unsafeCSS as g } from "lit";
2
- import { property as d } from "lit/decorators.js";
3
- import { RtlMixin as $, validPropertyValues as y, defineCustomElement as C } from "@justeattakeaway/pie-webc-core";
4
- import { classMap as b } from "lit/directives/class-map.js";
5
- import "@justeattakeaway/pie-link";
6
- import "@justeattakeaway/pie-icons-webc/dist/IconChevronRight.js";
7
- import "@justeattakeaway/pie-icons-webc/dist/IconChevronLeft.js";
8
- var k = Object.defineProperty, x = (s, r, e, o) => {
9
- for (var t = void 0, i = s.length - 1, c; i >= 0; i--)
10
- (c = s[i]) && (t = c(r, e, t) || t);
11
- return t && k(r, e, t), t;
12
- };
13
- class v extends f {
14
- constructor() {
15
- super(...arguments), this.v = "0.3.0";
16
- }
17
- }
18
- x([
19
- d({ type: String, reflect: !0 })
20
- ], v.prototype, "v");
21
- const S = "*,*:after,*:before{box-sizing:inherit}.c-breadcrumb{--breadcrumb-background-color: var(--dt-color-transparent);background-color:var(--breadcrumb-background-color);padding:var(--dt-spacing-a) var(--dt-spacing-d) var(--dt-spacing-a) var(--dt-spacing-d)}.c-breadcrumb-list{margin:0;padding:0;display:flex;flex-flow:row;gap:var(--dt-spacing-a)}.c-breadcrumb-list li{list-style-type:none;display:flex;align-items:center;white-space:nowrap}.c-breadcrumb--scrim{--breadcrumb-background-color: var(--dt-color-overlay);border-radius:var(--dt-radius-rounded-e)}.c-breadcrumb-list-last-item{overflow:hidden;text-overflow:ellipsis;max-width:250px;color:var(--dt-color-content-subdued)}.c-breadcrumb-list-last-item--scrim{color:var(--dt-color-content-link-light)}.c-breadcrumb-separator{color:var(--dt-color-content-subdued)}.c-breadcrumb-separator--scrim{color:var(--dt-color-content-link-light)}", w = ["default", "scrim"], l = {
1
+ import { unsafeCSS as n, html as u } from "lit";
2
+ import { property as l } from "lit/decorators.js";
3
+ import { validPropertyValues as b, safeCustomElement as d } from "@justeattakeaway/pie-webc-core";
4
+ import { classMap as f } from "lit/directives/class-map.js";
5
+ import { s as v, P } from "./breadcrumb-B5ACdbGG.js";
6
+ const y = ["default", "scrim"], p = {
22
7
  variant: "default",
23
8
  isCompact: !1
24
9
  };
25
- var B = Object.defineProperty, m = (s, r, e, o) => {
26
- for (var t = void 0, i = s.length - 1, c; i >= 0; i--)
27
- (c = s[i]) && (t = c(r, e, t) || t);
28
- return t && B(r, e, t), t;
10
+ var C = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, m = (s, t, e, o) => {
11
+ for (var r = o > 1 ? void 0 : o ? _(t, e) : t, c = s.length - 1, i; c >= 0; c--)
12
+ (i = s[c]) && (r = (o ? i(t, e, r) : i(r)) || r);
13
+ return o && r && C(t, e, r), r;
29
14
  };
30
- const h = "pie-breadcrumb", p = class p extends $(v) {
15
+ const h = "pie-breadcrumb";
16
+ let a = class extends P {
31
17
  constructor() {
32
- super(...arguments), this.items = [], this.variant = l.variant, this.isCompact = l.isCompact;
33
- }
34
- /**
35
- * Renders a separator icon between breadcrumb items.
36
- * The icon direction depends on the RTL (Right-to-Left) setting.
37
- *
38
- * @returns {TemplateResult} HTML template for the separator icon.
39
- *
40
- * @private
41
- */
42
- renderSeparator() {
43
- const r = this.variant === "scrim" ? "c-breadcrumb-separator--scrim" : "c-breadcrumb-separator";
44
- return a`
45
- <li
46
- role="presentation"
47
- aria-hidden="true"
48
- class="${r}"
49
- data-test-id="pie-breadcrumb-separator">
50
- ${this.isRTL ? a`<icon-chevron-left></icon-chevron-left>` : a`<icon-chevron-right></icon-chevron-right>`}
51
- </li>
52
- `;
53
- }
54
- /**
55
- * Renders a navigation link for a breadcrumb item.
56
- *
57
- * @param {BreadcrumbItem} item - The breadcrumb item containing label and URL.
58
- *
59
- * @private
60
- */
61
- renderNavigationLink(r) {
62
- const e = this.variant === "scrim" ? "inverse" : "default";
63
- return a`
64
- <pie-link variant="${e}" isStandalone underline="reversed" isBold href="${r.href}">
65
- ${r.label}
66
- </pie-link>
67
- `;
68
- }
69
- /**
70
- * Renders the last breadcrumb item.
71
- * It has 250px of max-width. If the label reaches this width the text truncates.
72
- *
73
- * @param {BreadcrumbItem} item - The breadcrumb item containing label and URL.
74
- *
75
- * @private
76
- */
77
- renderLastItem(r) {
78
- const e = {
79
- "c-breadcrumb-list-last-item": !0,
80
- "c-breadcrumb-list-last-item--scrim": this.variant === "scrim"
81
- };
82
- return a`<span class="${b(e)}">${r.label}</span>`;
83
- }
84
- /**
85
- * Renders an individual breadcrumb item.
86
-
87
- * Conditionally renders either a clickable link or plain text for the last item.
88
- *
89
- * @param {BreadcrumbItem} item - The breadcrumb item to render.
90
- * @param {boolean} [isLastItem=false] - Indicates if the item is the last in the breadcrumb trail.
91
- *
92
- * @private
93
- */
94
- renderItem(r, e = !1) {
95
- return a`
96
- <li role="listitem" data-test-id="pie-breadcrumb-item">
97
- ${e ? this.renderLastItem(r) : this.renderNavigationLink(r)}
98
- </li>
99
- ${e ? u : this.renderSeparator()}
100
- `;
101
- }
102
- /**
103
- * Renders breadcrumb items using the default variant style.
104
- *
105
- * @param {BreadcrumbProps['items']} items - Breadcrumb items to render.
106
- *
107
- * @private
108
- */
109
- renderDefaultBreadcrumb(r) {
110
- const e = r.length - 1;
111
- return a`${r.map((o, t) => this.renderItem(o, e <= t))}`;
112
- }
113
- /**
114
- * Renders a separator icon specifically for the back variant.
115
- * The icon direction depends on the RTL (Right-to-Left) setting.
116
- *
117
- * @private
118
- */
119
- renderCompactBreadcrumbSeparator() {
120
- const r = this.variant === "scrim" ? "c-breadcrumb-separator--scrim" : "c-breadcrumb-separator";
121
- return a`
122
- <li role="presentation" aria-hidden="true" class="${r}" data-test-id="pie-breadcrumb-separator">
123
- ${this.isRTL ? a`<icon-chevron-right></icon-chevron-right>` : a`<icon-chevron-left></icon-chevron-left>`}
124
- </li>
125
- `;
126
- }
127
- /**
128
- * Renders breadcrumb items using the back variant style, displaying only the last item with a preceding separator.
129
- *
130
- * @param {BreadcrumbProps['items']} items - Breadcrumb items to render.
131
- *
132
- * @private
133
- */
134
- renderCompactBreadcrumb(r) {
135
- const e = r[r.length - 1];
136
- return a`
137
- ${this.renderCompactBreadcrumbSeparator()}
138
- <li role="listitem" data-test-id="pie-breadcrumb-item">
139
- ${this.renderNavigationLink(e)}
140
- </li>
141
- `;
142
- }
143
- /**
144
- * Renders a complete breadcrumb list.
145
- * Iterates over breadcrumb items to generate the breadcrumb trail.
146
- *
147
- * @param {BreadcrumbProps['items']} items - Array of breadcrumb items to render.
148
- *
149
- * @private
150
- */
151
- renderBreadcrumbItems(r, e) {
152
- return a`
153
- <ol class="c-breadcrumb-list" data-test-id="pie-breadcrumb-list">
154
- ${e ? this.renderCompactBreadcrumb(r) : this.renderDefaultBreadcrumb(r)}
155
- </ol>
156
- `;
18
+ super(...arguments), this.variant = p.variant, this.isCompact = p.isCompact;
157
19
  }
158
20
  render() {
159
- const { items: r, variant: e, isCompact: o } = this;
160
- return a`
21
+ const { variant: s, isCompact: t } = this, e = {
22
+ "c-breadcrumb": !0,
23
+ [`c-breadcrumb--${s}`]: !0,
24
+ "c-breadcrumb--compact": t
25
+ };
26
+ return u`
161
27
  <nav
162
28
  aria-label="breadcrumb"
163
29
  data-test-id="pie-breadcrumb"
164
- class="${b({
165
- "c-breadcrumb": !0,
166
- "c-breadcrumb--scrim": e === "scrim"
167
- })}">
168
- ${r ? this.renderBreadcrumbItems(r, o) : u}
30
+ class="${f(e)}">
31
+ <ol class="c-breadcrumb-list" data-test-id="pie-breadcrumb-list">
32
+ <slot></slot>
33
+ </ol>
169
34
  </nav>`;
170
35
  }
171
36
  };
172
- p.styles = g(S);
173
- let n = p;
174
- m([
175
- d({ type: Array })
176
- ], n.prototype, "items");
37
+ a.styles = n(v);
177
38
  m([
178
- d({ type: String }),
179
- y(h, w, l.variant)
180
- ], n.prototype, "variant");
39
+ l({ type: String }),
40
+ b(h, y, p.variant)
41
+ ], a.prototype, "variant", 2);
181
42
  m([
182
- d({ type: Boolean })
183
- ], n.prototype, "isCompact");
184
- C(h, n);
43
+ l({ type: Boolean, reflect: !0 })
44
+ ], a.prototype, "isCompact", 2);
45
+ a = m([
46
+ d("pie-breadcrumb")
47
+ ], a);
185
48
  export {
186
- n as PieBreadcrumb,
187
- l as defaultProps,
188
- w as variants
49
+ a as PieBreadcrumb,
50
+ p as defaultProps,
51
+ y as variants
189
52
  };
@@ -0,0 +1,7 @@
1
+ export interface BreadcrumbItemProps {
2
+ /**
3
+ * The URL that the breadcrumb item links to
4
+ */
5
+ href?: string;
6
+ }
7
+ //# sourceMappingURL=defs.d.ts.map