@justeattakeaway/pie-toast 0.8.4 → 0.9.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/custom-elements.json +7 -7
- package/dist/index.js +101 -106
- package/package.json +5 -5
- package/src/index.ts +2 -3
package/custom-elements.json
CHANGED
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"type": {
|
|
61
61
|
"text": "DefaultProps"
|
|
62
62
|
},
|
|
63
|
-
"default": "{\n message: '',\n isOpen: true,\n variant: 'neutral',\n isStrong: false,\n isDismissible: false,\n isMultiline: false,\n duration: 5000,\n}"
|
|
63
|
+
"default": "{\r\n message: '',\r\n isOpen: true,\r\n variant: 'neutral',\r\n isStrong: false,\r\n isDismissible: false,\r\n isMultiline: false,\r\n duration: 5000,\r\n}"
|
|
64
64
|
}
|
|
65
65
|
],
|
|
66
66
|
"exports": [
|
|
@@ -226,7 +226,7 @@
|
|
|
226
226
|
"kind": "method",
|
|
227
227
|
"name": "abortAndCleanEventListeners",
|
|
228
228
|
"privacy": "private",
|
|
229
|
-
"description": "If the _abortController is set, it aborts all event\nlisteners in this controller and the controller turns into null."
|
|
229
|
+
"description": "If the _abortController is set, it aborts all event\r\nlisteners in this controller and the controller turns into null."
|
|
230
230
|
},
|
|
231
231
|
{
|
|
232
232
|
"kind": "method",
|
|
@@ -268,7 +268,7 @@
|
|
|
268
268
|
"kind": "method",
|
|
269
269
|
"name": "createAutoDismissEventListeners",
|
|
270
270
|
"privacy": "private",
|
|
271
|
-
"description": "It creates all event listeners to handle the auto-dismiss capability\nas well the controller responsible to remove the events when needed."
|
|
271
|
+
"description": "It creates all event listeners to handle the auto-dismiss capability\r\nas well the controller responsible to remove the events when needed."
|
|
272
272
|
},
|
|
273
273
|
{
|
|
274
274
|
"kind": "method",
|
|
@@ -300,7 +300,7 @@
|
|
|
300
300
|
"kind": "method",
|
|
301
301
|
"name": "renderFooter",
|
|
302
302
|
"privacy": "private",
|
|
303
|
-
"description": "Template for the footer area.\nIt should display only when isMultiline is true as well if has action button.\nCalled within the main render function."
|
|
303
|
+
"description": "Template for the footer area.\r\nIt should display only when isMultiline is true as well if has action button.\r\nCalled within the main render function."
|
|
304
304
|
},
|
|
305
305
|
{
|
|
306
306
|
"kind": "method",
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
"text": "TemplateResult"
|
|
312
312
|
}
|
|
313
313
|
},
|
|
314
|
-
"description": "Template for the close button element. Called within the\nmain render function."
|
|
314
|
+
"description": "Template for the close button element. Called within the\r\nmain render function."
|
|
315
315
|
},
|
|
316
316
|
{
|
|
317
317
|
"kind": "method",
|
|
@@ -331,13 +331,13 @@
|
|
|
331
331
|
"description": "The message to be displayed."
|
|
332
332
|
}
|
|
333
333
|
],
|
|
334
|
-
"description": "Template for the toast message. Called within the\nmain render function."
|
|
334
|
+
"description": "Template for the toast message. Called within the\r\nmain render function."
|
|
335
335
|
},
|
|
336
336
|
{
|
|
337
337
|
"kind": "method",
|
|
338
338
|
"name": "closeToastComponent",
|
|
339
339
|
"privacy": "private",
|
|
340
|
-
"description": "Util method responsible to close the component.\nIt handles the action when user clicks in the close button and triggers an event when is executed."
|
|
340
|
+
"description": "Util method responsible to close the component.\r\nIt handles the action when user clicks in the close button and triggers an event when is executed."
|
|
341
341
|
},
|
|
342
342
|
{
|
|
343
343
|
"kind": "method",
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as
|
|
3
|
-
import { classMap as
|
|
4
|
-
import { RtlMixin as
|
|
1
|
+
import { LitElement as x, nothing as d, html as l, unsafeCSS as A } from "lit";
|
|
2
|
+
import { property as u, query as b } from "lit/decorators.js";
|
|
3
|
+
import { classMap as w } from "lit/directives/class-map.js";
|
|
4
|
+
import { RtlMixin as C, dispatchCustomEvent as g, validPropertyValues as O, safeCustomElement as _ } from "@justeattakeaway/pie-webc-core";
|
|
5
5
|
import "@justeattakeaway/pie-icon-button";
|
|
6
6
|
import "@justeattakeaway/pie-button";
|
|
7
7
|
import "@justeattakeaway/pie-icons-webc/dist/IconClose.js";
|
|
@@ -9,20 +9,14 @@ import "@justeattakeaway/pie-icons-webc/dist/IconInfoCircle.js";
|
|
|
9
9
|
import "@justeattakeaway/pie-icons-webc/dist/IconAlertCircle.js";
|
|
10
10
|
import "@justeattakeaway/pie-icons-webc/dist/IconAlertTriangle.js";
|
|
11
11
|
import "@justeattakeaway/pie-icons-webc/dist/IconCheckCircle.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
(
|
|
15
|
-
return o && O(t, n, o), o;
|
|
16
|
-
};
|
|
17
|
-
class b extends A {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments), this.v = "0.8.4";
|
|
12
|
+
const h = class h extends x {
|
|
13
|
+
willUpdate() {
|
|
14
|
+
this.getAttribute("v") || this.setAttribute("v", h.v);
|
|
20
15
|
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const L = "*,*:after,*:before{box-sizing:inherit}.c-toast{--toast-border-radius: var(--dt-radius-rounded-b);--toast-background-color: var(--dt-color-container-inverse);--toast-font-color: var(--dt-color-content-inverse);--toast-font-size: calc(var(--dt-font-body-s-size) * 1px);--toast-line-height: calc(var(--dt-font-body-s-line-height) * 1px);--toast-icon-fill: var(--dt-color-content-default);--toast-translate-start: -100%;--toast-translate-end: 0;display:flex;flex-direction:column;justify-content:center;min-height:48px;max-height:122px;min-width:300px;max-width:420px;padding:var(--dt-spacing-b) var(--dt-spacing-c) var(--dt-spacing-b) var(--dt-spacing-d);border-radius:var(--toast-border-radius);background-color:var(--toast-background-color);box-shadow:var(--dt-elevation-03);color:var(--toast-font-color);font-size:var(--toast-font-size);line-height:var(--toast-line-height);transition-property:all;transition-duration:var(--dt-motion-timing-100);transition-timing-function:var(--dt-motion-easing-in)}.c-toast--rtl{--toast-translate-start: 100%}.c-toast--animate-in{animation-duration:var(--dt-motion-timing-200);animation-name:animate-in;animation-timing-function:var(--dt-motion-easing-out);transform:translate(var(--toast-translate-end))}.c-toast--animate-out{animation-duration:var(--dt-motion-timing-100);animation-name:animate-out;animation-timing-function:var(--dt-motion-easing-in);transform:translate(var(--toast-translate-start));opacity:0}.c-toast--info{--toast-icon-fill: var(--dt-color-support-info-inverse)}.c-toast--info.c-toast--strong{--toast-background-color: var(--dt-color-support-info);--toast-icon-fill: var(--dt-color-content-inverse)}.c-toast--warning{--toast-icon-fill: var(--dt-color-support-warning-inverse)}.c-toast--warning.c-toast--strong{--toast-background-color: var(--dt-color-support-warning);--toast-icon-fill: var(--dt-color-content-dark);--toast-font-color: var(--dt-color-content-dark)}.c-toast--success{--toast-icon-fill: var(--dt-color-support-positive-inverse)}.c-toast--success.c-toast--strong{--toast-background-color: var(--dt-color-support-positive);--toast-icon-fill: var(--dt-color-content-inverse)}.c-toast--error{--toast-icon-fill: var(--dt-color-support-error-inverse)}.c-toast--error.c-toast--strong{--toast-background-color: var(--dt-color-support-error);--toast-icon-fill: var(--dt-color-content-inverse)}.c-toast-contentArea{display:flex;gap:var(--dt-spacing-b);justify-content:space-between}.c-toast-messageArea{display:flex;align-items:center;gap:var(--dt-spacing-b);padding:6px var(--dt-spacing-a) 6px 0;overflow:hidden}.c-toast-messageArea span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.c-toast-actionsArea{display:flex;gap:var(--dt-spacing-b);flex-shrink:0}.c-toast--multiline .c-toast-contentArea{align-items:flex-start;gap:0}.c-toast--multiline .c-toast-messageArea{align-items:flex-start;padding-block-end:var(--dt-spacing-b)}.c-toast--multiline .c-toast-messageArea span{max-height:60px;white-space:inherit;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.c-toast-footer{display:flex;justify-content:flex-end}.c-toast-icon{color:var(--toast-icon-fill)}@keyframes animate-in{0%{transform:translate(var(--toast-translate-start))}to{transform:translate(var(--toast-translate-end))}}@keyframes animate-out{0%{transform:translate(var(--toast-translate-end))}to{transform:translate(var(--toast-translate-start))}}", B = ["neutral", "info", "warning", "success", "error"], i = "pie-toast", e = "c-toast", N = `${i}-close`, S = `${i}-open`, I = `${i}-leading-action-click`, m = {
|
|
16
|
+
};
|
|
17
|
+
h.v = "0.9.1";
|
|
18
|
+
let f = h;
|
|
19
|
+
const E = "*,*:after,*:before{box-sizing:inherit}.c-toast{--toast-border-radius: var(--dt-radius-rounded-b);--toast-background-color: var(--dt-color-container-inverse);--toast-font-color: var(--dt-color-content-inverse);--toast-font-size: calc(var(--dt-font-body-s-size) * 1px);--toast-line-height: calc(var(--dt-font-body-s-line-height) * 1px);--toast-icon-fill: var(--dt-color-content-default);--toast-translate-start: -100%;--toast-translate-end: 0;display:flex;flex-direction:column;justify-content:center;min-height:48px;max-height:122px;min-width:300px;max-width:420px;padding:var(--dt-spacing-b) var(--dt-spacing-c) var(--dt-spacing-b) var(--dt-spacing-d);border-radius:var(--toast-border-radius);background-color:var(--toast-background-color);box-shadow:var(--dt-elevation-03);color:var(--toast-font-color);font-size:var(--toast-font-size);line-height:var(--toast-line-height);transition-property:all;transition-duration:var(--dt-motion-timing-100);transition-timing-function:var(--dt-motion-easing-in)}.c-toast--rtl{--toast-translate-start: 100%}.c-toast--animate-in{animation-duration:var(--dt-motion-timing-200);animation-name:animate-in;animation-timing-function:var(--dt-motion-easing-out);transform:translate(var(--toast-translate-end))}.c-toast--animate-out{animation-duration:var(--dt-motion-timing-100);animation-name:animate-out;animation-timing-function:var(--dt-motion-easing-in);transform:translate(var(--toast-translate-start));opacity:0}.c-toast--info{--toast-icon-fill: var(--dt-color-support-info-inverse)}.c-toast--info.c-toast--strong{--toast-background-color: var(--dt-color-support-info);--toast-icon-fill: var(--dt-color-content-inverse)}.c-toast--warning{--toast-icon-fill: var(--dt-color-support-warning-inverse)}.c-toast--warning.c-toast--strong{--toast-background-color: var(--dt-color-support-warning);--toast-icon-fill: var(--dt-color-content-dark);--toast-font-color: var(--dt-color-content-dark)}.c-toast--success{--toast-icon-fill: var(--dt-color-support-positive-inverse)}.c-toast--success.c-toast--strong{--toast-background-color: var(--dt-color-support-positive);--toast-icon-fill: var(--dt-color-content-inverse)}.c-toast--error{--toast-icon-fill: var(--dt-color-support-error-inverse)}.c-toast--error.c-toast--strong{--toast-background-color: var(--dt-color-support-error);--toast-icon-fill: var(--dt-color-content-inverse)}.c-toast-contentArea{display:flex;gap:var(--dt-spacing-b);justify-content:space-between}.c-toast-messageArea{display:flex;align-items:center;gap:var(--dt-spacing-b);padding:6px var(--dt-spacing-a) 6px 0;overflow:hidden}.c-toast-messageArea span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.c-toast-actionsArea{display:flex;gap:var(--dt-spacing-b);flex-shrink:0}.c-toast--multiline .c-toast-contentArea{align-items:flex-start;gap:0}.c-toast--multiline .c-toast-messageArea{align-items:flex-start;padding-block-end:var(--dt-spacing-b)}.c-toast--multiline .c-toast-messageArea span{max-height:60px;white-space:inherit;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.c-toast-footer{display:flex;justify-content:flex-end}.c-toast-icon{color:var(--toast-icon-fill)}@keyframes animate-in{0%{transform:translate(var(--toast-translate-start))}to{transform:translate(var(--toast-translate-end))}}@keyframes animate-out{0%{transform:translate(var(--toast-translate-end))}to{transform:translate(var(--toast-translate-start))}}", T = ["neutral", "info", "warning", "success", "error"], i = "pie-toast", s = "c-toast", k = `${i}-close`, L = `${i}-open`, B = `${i}-leading-action-click`, p = {
|
|
26
20
|
message: "",
|
|
27
21
|
isOpen: !0,
|
|
28
22
|
variant: "neutral",
|
|
@@ -31,14 +25,14 @@ const L = "*,*:after,*:before{box-sizing:inherit}.c-toast{--toast-border-radius:
|
|
|
31
25
|
isMultiline: !1,
|
|
32
26
|
duration: 5e3
|
|
33
27
|
};
|
|
34
|
-
var
|
|
35
|
-
for (var o = void 0,
|
|
36
|
-
(
|
|
37
|
-
return o &&
|
|
28
|
+
var N = Object.defineProperty, I = Object.getOwnPropertyDescriptor, n = (t, a, r, c) => {
|
|
29
|
+
for (var o = c > 1 ? void 0 : c ? I(a, r) : a, m = t.length - 1, v; m >= 0; m--)
|
|
30
|
+
(v = t[m]) && (o = (c ? v(a, r, o) : v(o)) || o);
|
|
31
|
+
return c && o && N(a, r, o), o;
|
|
38
32
|
};
|
|
39
|
-
|
|
33
|
+
let e = class extends C(f) {
|
|
40
34
|
constructor() {
|
|
41
|
-
super(...arguments), this.message =
|
|
35
|
+
super(...arguments), this.message = p.message, this.isOpen = p.isOpen, this.variant = p.variant, this.isStrong = p.isStrong, this.isDismissible = p.isDismissible, this.isMultiline = p.isMultiline, this.duration = p.duration, this._timeoutId = null, this._abortController = null;
|
|
42
36
|
}
|
|
43
37
|
/**
|
|
44
38
|
* Create a timeout function and set its id into a private attribute.
|
|
@@ -69,12 +63,12 @@ const f = class f extends w(b) {
|
|
|
69
63
|
*
|
|
70
64
|
* @private
|
|
71
65
|
*/
|
|
72
|
-
addListenersToElement(t,
|
|
73
|
-
t && (t.addEventListener(
|
|
66
|
+
addListenersToElement(t, a, r, c) {
|
|
67
|
+
t && (t.addEventListener(a, () => {
|
|
74
68
|
this._timeoutId && clearTimeout(this._timeoutId);
|
|
75
|
-
}, { signal:
|
|
69
|
+
}, { signal: c }), t.addEventListener(r, () => {
|
|
76
70
|
this.setAutoDismiss();
|
|
77
|
-
}, { signal:
|
|
71
|
+
}, { signal: c }));
|
|
78
72
|
}
|
|
79
73
|
/**
|
|
80
74
|
* It creates all event listeners to handle the auto-dismiss capability
|
|
@@ -94,7 +88,7 @@ const f = class f extends w(b) {
|
|
|
94
88
|
* It aborts all event listeners when toast is closed.
|
|
95
89
|
*/
|
|
96
90
|
async updated(t) {
|
|
97
|
-
t.has("isOpen") && this.isOpen && (
|
|
91
|
+
t.has("isOpen") && this.isOpen && (g(this, L, { targetNotification: this }), this.duration !== null && this.createAutoDismissEventListeners()), t.has("isOpen") && !this.isOpen && this.abortAndCleanEventListeners();
|
|
98
92
|
}
|
|
99
93
|
/**
|
|
100
94
|
* It handle the action button action.
|
|
@@ -102,7 +96,7 @@ const f = class f extends w(b) {
|
|
|
102
96
|
* @private
|
|
103
97
|
*/
|
|
104
98
|
handleActionClick() {
|
|
105
|
-
|
|
99
|
+
g(this, B, { targetNotification: this });
|
|
106
100
|
}
|
|
107
101
|
/**
|
|
108
102
|
* Render the action button depending on action type and its action.
|
|
@@ -113,16 +107,16 @@ const f = class f extends w(b) {
|
|
|
113
107
|
* @private
|
|
114
108
|
*/
|
|
115
109
|
renderActionButton(t) {
|
|
116
|
-
const { text:
|
|
110
|
+
const { text: a, ariaLabel: r } = t;
|
|
117
111
|
return l`
|
|
118
112
|
<pie-button
|
|
119
113
|
variant="${this.shouldNotUseInverseBtnVariant() ? "ghost" : "ghost-inverse"}"
|
|
120
114
|
size="xsmall"
|
|
121
|
-
aria-label="${
|
|
115
|
+
aria-label="${r || d}"
|
|
122
116
|
@click="${() => this.handleActionClick()}"
|
|
123
117
|
data-test-id="${i}-leading-action"
|
|
124
118
|
type="button">
|
|
125
|
-
${
|
|
119
|
+
${a}
|
|
126
120
|
</pie-button>
|
|
127
121
|
`;
|
|
128
122
|
}
|
|
@@ -136,8 +130,8 @@ const f = class f extends w(b) {
|
|
|
136
130
|
renderFooter() {
|
|
137
131
|
const { leadingAction: t } = this;
|
|
138
132
|
return l`
|
|
139
|
-
<footer class="${
|
|
140
|
-
${t ? this.renderActionButton(t) :
|
|
133
|
+
<footer class="${s}-footer" data-test-id="${i}-footer" >
|
|
134
|
+
${t ? this.renderActionButton(t) : d}
|
|
141
135
|
</footer>
|
|
142
136
|
`;
|
|
143
137
|
}
|
|
@@ -179,7 +173,7 @@ const f = class f extends w(b) {
|
|
|
179
173
|
* @private
|
|
180
174
|
*/
|
|
181
175
|
closeToastComponent() {
|
|
182
|
-
this.isOpen = !1,
|
|
176
|
+
this.isOpen = !1, g(this, k, { targetNotification: this }), this.abortAndCleanEventListeners();
|
|
183
177
|
}
|
|
184
178
|
/**
|
|
185
179
|
* Util method that returns an icon from a variant that has default icon.
|
|
@@ -189,15 +183,15 @@ const f = class f extends w(b) {
|
|
|
189
183
|
getVariantIcon() {
|
|
190
184
|
switch (this.variant) {
|
|
191
185
|
case "info":
|
|
192
|
-
return l`<icon-info-circle class="${
|
|
186
|
+
return l`<icon-info-circle class="${s}-icon" size="s" data-test-id="${i}-heading-icon-info"></icon-info-circle>`;
|
|
193
187
|
case "success":
|
|
194
|
-
return l`<icon-check-circle class="${
|
|
188
|
+
return l`<icon-check-circle class="${s}-icon" size="s" data-test-id="${i}-heading-icon-success"></icon-check-circle>`;
|
|
195
189
|
case "warning":
|
|
196
|
-
return l`<icon-alert-triangle class="${
|
|
190
|
+
return l`<icon-alert-triangle class="${s}-icon" size="s" data-test-id="${i}-heading-icon-warning"></icon-alert-triangle>`;
|
|
197
191
|
case "error":
|
|
198
|
-
return l`<icon-alert-circle class="${
|
|
192
|
+
return l`<icon-alert-circle class="${s}-icon" size="s" data-test-id="${i}-heading-icon-error"></icon-alert-circle>`;
|
|
199
193
|
default:
|
|
200
|
-
return
|
|
194
|
+
return d;
|
|
201
195
|
}
|
|
202
196
|
}
|
|
203
197
|
/**
|
|
@@ -221,82 +215,83 @@ const f = class f extends w(b) {
|
|
|
221
215
|
render() {
|
|
222
216
|
const {
|
|
223
217
|
isOpen: t,
|
|
224
|
-
variant:
|
|
225
|
-
message:
|
|
226
|
-
isDismissible:
|
|
227
|
-
leadingAction:
|
|
228
|
-
isMultiline:
|
|
229
|
-
isStrong:
|
|
230
|
-
isRTL:
|
|
231
|
-
} = this,
|
|
232
|
-
[
|
|
233
|
-
[`${
|
|
234
|
-
[`${
|
|
235
|
-
[`${
|
|
236
|
-
[`${
|
|
237
|
-
[`${
|
|
238
|
-
[`${
|
|
218
|
+
variant: a,
|
|
219
|
+
message: r,
|
|
220
|
+
isDismissible: c,
|
|
221
|
+
leadingAction: o,
|
|
222
|
+
isMultiline: m,
|
|
223
|
+
isStrong: v,
|
|
224
|
+
isRTL: $
|
|
225
|
+
} = this, y = {
|
|
226
|
+
[s]: !0,
|
|
227
|
+
[`${s}--rtl`]: $,
|
|
228
|
+
[`${s}--multiline`]: m,
|
|
229
|
+
[`${s}--${a}`]: !0,
|
|
230
|
+
[`${s}--strong`]: v,
|
|
231
|
+
[`${s}--animate-in`]: t,
|
|
232
|
+
[`${s}--animate-out`]: !t
|
|
239
233
|
};
|
|
240
234
|
return l`
|
|
241
235
|
<div
|
|
242
|
-
role="${
|
|
236
|
+
role="${a === "error" ? "alert" : "status"}"
|
|
243
237
|
data-test-id="${i}"
|
|
244
|
-
class="${
|
|
245
|
-
<div class="${
|
|
246
|
-
<div class="${
|
|
247
|
-
${this.variantHasIcon(
|
|
248
|
-
${
|
|
238
|
+
class="${w(y)}">
|
|
239
|
+
<div class="${s}-contentArea">
|
|
240
|
+
<div class="${s}-messageArea">
|
|
241
|
+
${this.variantHasIcon(a) ? this.getVariantIcon() : d}
|
|
242
|
+
${r === "" ? d : this.renderMessage(r)}
|
|
249
243
|
</div>
|
|
250
|
-
<div class="${
|
|
251
|
-
${!
|
|
252
|
-
${
|
|
244
|
+
<div class="${s}-actionsArea">
|
|
245
|
+
${!m && (o != null && o.text) ? this.renderActionButton(o) : d}
|
|
246
|
+
${c ? this.renderCloseButton() : d}
|
|
253
247
|
</div>
|
|
254
248
|
</div>
|
|
255
|
-
${
|
|
249
|
+
${m && (o != null && o.text) ? this.renderFooter() : d}
|
|
256
250
|
</div>`;
|
|
257
251
|
}
|
|
258
252
|
};
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
253
|
+
e.styles = A(E);
|
|
254
|
+
n([
|
|
255
|
+
u({ type: String })
|
|
256
|
+
], e.prototype, "message", 2);
|
|
257
|
+
n([
|
|
258
|
+
u({ type: Boolean })
|
|
259
|
+
], e.prototype, "isOpen", 2);
|
|
260
|
+
n([
|
|
261
|
+
u({ type: String }),
|
|
262
|
+
O(i, T, p.variant)
|
|
263
|
+
], e.prototype, "variant", 2);
|
|
264
|
+
n([
|
|
265
|
+
u({ type: Boolean })
|
|
266
|
+
], e.prototype, "isStrong", 2);
|
|
267
|
+
n([
|
|
268
|
+
u({ type: Boolean })
|
|
269
|
+
], e.prototype, "isDismissible", 2);
|
|
270
|
+
n([
|
|
271
|
+
u({ type: Boolean })
|
|
272
|
+
], e.prototype, "isMultiline", 2);
|
|
273
|
+
n([
|
|
274
|
+
u({ type: Object })
|
|
275
|
+
], e.prototype, "leadingAction", 2);
|
|
276
|
+
n([
|
|
277
|
+
u({ type: Number })
|
|
278
|
+
], e.prototype, "duration", 2);
|
|
279
|
+
n([
|
|
280
|
+
b("pie-button")
|
|
281
|
+
], e.prototype, "actionButton", 2);
|
|
282
|
+
n([
|
|
283
|
+
b("pie-icon-button")
|
|
284
|
+
], e.prototype, "closeButton", 2);
|
|
285
|
+
e = n([
|
|
286
|
+
_("pie-toast")
|
|
287
|
+
], e);
|
|
293
288
|
export {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
289
|
+
k as ON_TOAST_CLOSE_EVENT,
|
|
290
|
+
B as ON_TOAST_LEADING_ACTION_CLICK_EVENT,
|
|
291
|
+
L as ON_TOAST_OPEN_EVENT,
|
|
292
|
+
e as PieToast,
|
|
293
|
+
s as componentClass,
|
|
299
294
|
i as componentSelector,
|
|
300
|
-
|
|
301
|
-
|
|
295
|
+
p as defaultProps,
|
|
296
|
+
T as variants
|
|
302
297
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-toast",
|
|
3
3
|
"description": "PIE Design System Toast built using Web Components",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/justeattakeaway/pie",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@justeattakeaway/pie-button": "1.
|
|
49
|
-
"@justeattakeaway/pie-icon-button": "1.
|
|
50
|
-
"@justeattakeaway/pie-icons-webc": "1.
|
|
51
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
48
|
+
"@justeattakeaway/pie-button": "1.6.1",
|
|
49
|
+
"@justeattakeaway/pie-icon-button": "1.5.0",
|
|
50
|
+
"@justeattakeaway/pie-icons-webc": "1.10.0",
|
|
51
|
+
"@justeattakeaway/pie-webc-core": "0.26.0"
|
|
52
52
|
},
|
|
53
53
|
"volta": {
|
|
54
54
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -10,8 +10,8 @@ import { property, query } from 'lit/decorators.js';
|
|
|
10
10
|
import { classMap } from 'lit/directives/class-map.js';
|
|
11
11
|
import {
|
|
12
12
|
RtlMixin,
|
|
13
|
-
defineCustomElement,
|
|
14
13
|
dispatchCustomEvent,
|
|
14
|
+
safeCustomElement,
|
|
15
15
|
validPropertyValues,
|
|
16
16
|
} from '@justeattakeaway/pie-webc-core';
|
|
17
17
|
import '@justeattakeaway/pie-icon-button';
|
|
@@ -44,6 +44,7 @@ export * from './defs';
|
|
|
44
44
|
* @event {CustomEvent} pie-toast-open - when the toast is opened.
|
|
45
45
|
* @event {CustomEvent} pie-toast-leading-action-click - when the user interacts with the leading action.
|
|
46
46
|
*/
|
|
47
|
+
@safeCustomElement('pie-toast')
|
|
47
48
|
export class PieToast extends RtlMixin(PieElement) implements ToastProps {
|
|
48
49
|
@property({ type: String })
|
|
49
50
|
public message = defaultProps.message;
|
|
@@ -353,8 +354,6 @@ export class PieToast extends RtlMixin(PieElement) implements ToastProps {
|
|
|
353
354
|
}
|
|
354
355
|
}
|
|
355
356
|
|
|
356
|
-
defineCustomElement(componentSelector, PieToast);
|
|
357
|
-
|
|
358
357
|
declare global {
|
|
359
358
|
interface HTMLElementTagNameMap {
|
|
360
359
|
[componentSelector]: PieToast;
|