@justeattakeaway/pie-breadcrumb 0.3.0 → 0.3.1
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.
- package/dist/index.js +49 -53
- package/package.json +4 -4
- package/src/index.ts +3 -5
package/dist/index.js
CHANGED
|
@@ -1,35 +1,30 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as
|
|
3
|
-
import { RtlMixin as
|
|
4
|
-
import { classMap as
|
|
1
|
+
import { LitElement as h, html as t, nothing as u, unsafeCSS as f } from "lit";
|
|
2
|
+
import { property as b } from "lit/decorators.js";
|
|
3
|
+
import { RtlMixin as g, validPropertyValues as $, safeCustomElement as y } from "@justeattakeaway/pie-webc-core";
|
|
4
|
+
import { classMap as v } from "lit/directives/class-map.js";
|
|
5
5
|
import "@justeattakeaway/pie-link";
|
|
6
6
|
import "@justeattakeaway/pie-icons-webc/dist/IconChevronRight.js";
|
|
7
7
|
import "@justeattakeaway/pie-icons-webc/dist/IconChevronLeft.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
(
|
|
11
|
-
return t && k(r, e, t), t;
|
|
12
|
-
};
|
|
13
|
-
class v extends f {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments), this.v = "0.3.0";
|
|
8
|
+
const o = class o extends h {
|
|
9
|
+
willUpdate() {
|
|
10
|
+
this.getAttribute("v") || this.setAttribute("v", o.v);
|
|
16
11
|
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 = {
|
|
12
|
+
};
|
|
13
|
+
o.v = "0.3.1";
|
|
14
|
+
let m = o;
|
|
15
|
+
const C = "*,*: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"], p = {
|
|
22
16
|
variant: "default",
|
|
23
17
|
isCompact: !1
|
|
24
18
|
};
|
|
25
|
-
var
|
|
26
|
-
for (var
|
|
27
|
-
(
|
|
28
|
-
return
|
|
19
|
+
var x = Object.defineProperty, B = Object.getOwnPropertyDescriptor, n = (r, e, a, i) => {
|
|
20
|
+
for (var s = i > 1 ? void 0 : i ? B(e, a) : e, d = r.length - 1, l; d >= 0; d--)
|
|
21
|
+
(l = r[d]) && (s = (i ? l(e, a, s) : l(s)) || s);
|
|
22
|
+
return i && s && x(e, a, s), s;
|
|
29
23
|
};
|
|
30
|
-
const
|
|
24
|
+
const S = "pie-breadcrumb";
|
|
25
|
+
let c = class extends g(m) {
|
|
31
26
|
constructor() {
|
|
32
|
-
super(...arguments), this.items = [], this.variant =
|
|
27
|
+
super(...arguments), this.items = [], this.variant = p.variant, this.isCompact = p.isCompact;
|
|
33
28
|
}
|
|
34
29
|
/**
|
|
35
30
|
* Renders a separator icon between breadcrumb items.
|
|
@@ -41,13 +36,13 @@ const h = "pie-breadcrumb", p = class p extends $(v) {
|
|
|
41
36
|
*/
|
|
42
37
|
renderSeparator() {
|
|
43
38
|
const r = this.variant === "scrim" ? "c-breadcrumb-separator--scrim" : "c-breadcrumb-separator";
|
|
44
|
-
return
|
|
39
|
+
return t`
|
|
45
40
|
<li
|
|
46
41
|
role="presentation"
|
|
47
42
|
aria-hidden="true"
|
|
48
43
|
class="${r}"
|
|
49
44
|
data-test-id="pie-breadcrumb-separator">
|
|
50
|
-
${this.isRTL ?
|
|
45
|
+
${this.isRTL ? t`<icon-chevron-left></icon-chevron-left>` : t`<icon-chevron-right></icon-chevron-right>`}
|
|
51
46
|
</li>
|
|
52
47
|
`;
|
|
53
48
|
}
|
|
@@ -60,7 +55,7 @@ const h = "pie-breadcrumb", p = class p extends $(v) {
|
|
|
60
55
|
*/
|
|
61
56
|
renderNavigationLink(r) {
|
|
62
57
|
const e = this.variant === "scrim" ? "inverse" : "default";
|
|
63
|
-
return
|
|
58
|
+
return t`
|
|
64
59
|
<pie-link variant="${e}" isStandalone underline="reversed" isBold href="${r.href}">
|
|
65
60
|
${r.label}
|
|
66
61
|
</pie-link>
|
|
@@ -79,7 +74,7 @@ const h = "pie-breadcrumb", p = class p extends $(v) {
|
|
|
79
74
|
"c-breadcrumb-list-last-item": !0,
|
|
80
75
|
"c-breadcrumb-list-last-item--scrim": this.variant === "scrim"
|
|
81
76
|
};
|
|
82
|
-
return
|
|
77
|
+
return t`<span class="${v(e)}">${r.label}</span>`;
|
|
83
78
|
}
|
|
84
79
|
/**
|
|
85
80
|
* Renders an individual breadcrumb item.
|
|
@@ -92,7 +87,7 @@ const h = "pie-breadcrumb", p = class p extends $(v) {
|
|
|
92
87
|
* @private
|
|
93
88
|
*/
|
|
94
89
|
renderItem(r, e = !1) {
|
|
95
|
-
return
|
|
90
|
+
return t`
|
|
96
91
|
<li role="listitem" data-test-id="pie-breadcrumb-item">
|
|
97
92
|
${e ? this.renderLastItem(r) : this.renderNavigationLink(r)}
|
|
98
93
|
</li>
|
|
@@ -108,7 +103,7 @@ const h = "pie-breadcrumb", p = class p extends $(v) {
|
|
|
108
103
|
*/
|
|
109
104
|
renderDefaultBreadcrumb(r) {
|
|
110
105
|
const e = r.length - 1;
|
|
111
|
-
return
|
|
106
|
+
return t`${r.map((a, i) => this.renderItem(a, e <= i))}`;
|
|
112
107
|
}
|
|
113
108
|
/**
|
|
114
109
|
* Renders a separator icon specifically for the back variant.
|
|
@@ -118,9 +113,9 @@ const h = "pie-breadcrumb", p = class p extends $(v) {
|
|
|
118
113
|
*/
|
|
119
114
|
renderCompactBreadcrumbSeparator() {
|
|
120
115
|
const r = this.variant === "scrim" ? "c-breadcrumb-separator--scrim" : "c-breadcrumb-separator";
|
|
121
|
-
return
|
|
116
|
+
return t`
|
|
122
117
|
<li role="presentation" aria-hidden="true" class="${r}" data-test-id="pie-breadcrumb-separator">
|
|
123
|
-
${this.isRTL ?
|
|
118
|
+
${this.isRTL ? t`<icon-chevron-right></icon-chevron-right>` : t`<icon-chevron-left></icon-chevron-left>`}
|
|
124
119
|
</li>
|
|
125
120
|
`;
|
|
126
121
|
}
|
|
@@ -133,10 +128,10 @@ const h = "pie-breadcrumb", p = class p extends $(v) {
|
|
|
133
128
|
*/
|
|
134
129
|
renderCompactBreadcrumb(r) {
|
|
135
130
|
const e = r[r.length - 1];
|
|
136
|
-
return
|
|
131
|
+
return t`
|
|
137
132
|
${this.renderCompactBreadcrumbSeparator()}
|
|
138
133
|
<li role="listitem" data-test-id="pie-breadcrumb-item">
|
|
139
|
-
${this.renderNavigationLink(e)}
|
|
134
|
+
${this.renderNavigationLink(e)}
|
|
140
135
|
</li>
|
|
141
136
|
`;
|
|
142
137
|
}
|
|
@@ -149,41 +144,42 @@ const h = "pie-breadcrumb", p = class p extends $(v) {
|
|
|
149
144
|
* @private
|
|
150
145
|
*/
|
|
151
146
|
renderBreadcrumbItems(r, e) {
|
|
152
|
-
return
|
|
147
|
+
return t`
|
|
153
148
|
<ol class="c-breadcrumb-list" data-test-id="pie-breadcrumb-list">
|
|
154
149
|
${e ? this.renderCompactBreadcrumb(r) : this.renderDefaultBreadcrumb(r)}
|
|
155
150
|
</ol>
|
|
156
151
|
`;
|
|
157
152
|
}
|
|
158
153
|
render() {
|
|
159
|
-
const { items: r, variant: e, isCompact:
|
|
160
|
-
return
|
|
154
|
+
const { items: r, variant: e, isCompact: a } = this;
|
|
155
|
+
return t`
|
|
161
156
|
<nav
|
|
162
157
|
aria-label="breadcrumb"
|
|
163
158
|
data-test-id="pie-breadcrumb"
|
|
164
|
-
class="${
|
|
159
|
+
class="${v({
|
|
165
160
|
"c-breadcrumb": !0,
|
|
166
161
|
"c-breadcrumb--scrim": e === "scrim"
|
|
167
162
|
})}">
|
|
168
|
-
${r ? this.renderBreadcrumbItems(r,
|
|
163
|
+
${r ? this.renderBreadcrumbItems(r, a) : u}
|
|
169
164
|
</nav>`;
|
|
170
165
|
}
|
|
171
166
|
};
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
167
|
+
c.styles = f(C);
|
|
168
|
+
n([
|
|
169
|
+
b({ type: Array })
|
|
170
|
+
], c.prototype, "items", 2);
|
|
171
|
+
n([
|
|
172
|
+
b({ type: String }),
|
|
173
|
+
$(S, w, p.variant)
|
|
174
|
+
], c.prototype, "variant", 2);
|
|
175
|
+
n([
|
|
176
|
+
b({ type: Boolean })
|
|
177
|
+
], c.prototype, "isCompact", 2);
|
|
178
|
+
c = n([
|
|
179
|
+
y("pie-breadcrumb")
|
|
180
|
+
], c);
|
|
185
181
|
export {
|
|
186
|
-
|
|
187
|
-
|
|
182
|
+
c as PieBreadcrumb,
|
|
183
|
+
p as defaultProps,
|
|
188
184
|
w as variants
|
|
189
185
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-breadcrumb",
|
|
3
3
|
"description": "PIE Design System Breadcrumb built using Web Components",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"license": "Apache-2.0",
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
36
|
-
"@justeattakeaway/pie-components-config": "0.20.
|
|
36
|
+
"@justeattakeaway/pie-components-config": "0.20.1",
|
|
37
37
|
"@justeattakeaway/pie-css": "0.16.0",
|
|
38
|
-
"@justeattakeaway/pie-monorepo-utils": "0.5.
|
|
38
|
+
"@justeattakeaway/pie-monorepo-utils": "0.5.1",
|
|
39
39
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
42
|
+
"@justeattakeaway/pie-webc-core": "0.26.0"
|
|
43
43
|
},
|
|
44
44
|
"volta": {
|
|
45
45
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { html, nothing, unsafeCSS } from 'lit';
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { RtlMixin,
|
|
3
|
+
import { RtlMixin, safeCustomElement, validPropertyValues } from '@justeattakeaway/pie-webc-core';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
-
|
|
6
5
|
import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
|
|
7
6
|
|
|
8
7
|
import '@justeattakeaway/pie-link';
|
|
@@ -25,6 +24,7 @@ export * from './defs';
|
|
|
25
24
|
/**
|
|
26
25
|
* @tagname pie-breadcrumb
|
|
27
26
|
*/
|
|
27
|
+
@safeCustomElement('pie-breadcrumb')
|
|
28
28
|
export class PieBreadcrumb extends RtlMixin(PieElement) implements BreadcrumbProps {
|
|
29
29
|
@property({ type: Array })
|
|
30
30
|
public items: BreadcrumbProps['items'] = [];
|
|
@@ -157,7 +157,7 @@ export class PieBreadcrumb extends RtlMixin(PieElement) implements BreadcrumbPro
|
|
|
157
157
|
return html`
|
|
158
158
|
${this.renderCompactBreadcrumbSeparator()}
|
|
159
159
|
<li role="listitem" data-test-id="pie-breadcrumb-item">
|
|
160
|
-
${this.renderNavigationLink(lastItem)}
|
|
160
|
+
${this.renderNavigationLink(lastItem)}
|
|
161
161
|
</li>
|
|
162
162
|
`;
|
|
163
163
|
}
|
|
@@ -199,8 +199,6 @@ export class PieBreadcrumb extends RtlMixin(PieElement) implements BreadcrumbPro
|
|
|
199
199
|
static styles = unsafeCSS(styles);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
defineCustomElement(componentSelector, PieBreadcrumb);
|
|
203
|
-
|
|
204
202
|
declare global {
|
|
205
203
|
interface HTMLElementTagNameMap {
|
|
206
204
|
[componentSelector]: PieBreadcrumb;
|