@justeattakeaway/pie-toast 0.12.33 → 0.12.35
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 +28 -28
- package/package.json +6 -6
- package/src/index.ts +1 -1
- package/src/toast.scss +1 -1
package/dist/index.js
CHANGED
|
@@ -14,9 +14,9 @@ const f = class f extends y {
|
|
|
14
14
|
this.getAttribute("v") || this.setAttribute("v", f.v);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
f.v = "0.12.
|
|
17
|
+
f.v = "0.12.35";
|
|
18
18
|
let m = f;
|
|
19
|
-
const C = "*,*:after,*:before{box-sizing:inherit}:host{display:block}.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-family: var(--dt-font-body-s-family);--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);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-below-20);color:var(--toast-font-color);font-family:var(--toast-font-family);font-size:var(--toast-font-size);line-height:var(--toast-line-height)}.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-light);--toast-font-color: var(--dt-color-content-light)}.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}.
|
|
19
|
+
const C = "*,*:after,*:before{box-sizing:inherit}:host{display:block}.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-family: var(--dt-font-body-s-family);--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);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-below-20);color:var(--toast-font-color);font-family:var(--toast-font-family);font-size:var(--toast-font-size);line-height:var(--toast-line-height)}.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-light);--toast-font-color: var(--dt-color-content-light)}.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}.is-multiline .c-toast-contentArea{align-items:flex-start;gap:0}.is-multiline .c-toast-messageArea{align-items:flex-start;padding-block-end:var(--dt-spacing-b)}.is-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)}", _ = ["neutral", "info", "warning", "success", "error"], s = "pie-toast", n = "c-toast", O = `${s}-close`, E = `${s}-open`, T = `${s}-leading-action-click`, p = {
|
|
20
20
|
message: "",
|
|
21
21
|
isOpen: !0,
|
|
22
22
|
variant: "neutral",
|
|
@@ -25,10 +25,10 @@ const C = "*,*:after,*:before{box-sizing:inherit}:host{display:block}.c-toast{--
|
|
|
25
25
|
isMultiline: !1,
|
|
26
26
|
duration: 5e3
|
|
27
27
|
};
|
|
28
|
-
var k = Object.defineProperty, B = Object.getOwnPropertyDescriptor, a = (t,
|
|
29
|
-
for (var
|
|
30
|
-
(v = t[h]) && (
|
|
31
|
-
return o &&
|
|
28
|
+
var k = Object.defineProperty, B = Object.getOwnPropertyDescriptor, a = (t, i, c, o) => {
|
|
29
|
+
for (var r = o > 1 ? void 0 : o ? B(i, c) : i, h = t.length - 1, v; h >= 0; h--)
|
|
30
|
+
(v = t[h]) && (r = (o ? v(i, c, r) : v(r)) || r);
|
|
31
|
+
return o && r && k(i, c, r), r;
|
|
32
32
|
};
|
|
33
33
|
let e = class extends m {
|
|
34
34
|
constructor() {
|
|
@@ -63,8 +63,8 @@ let e = class extends m {
|
|
|
63
63
|
*
|
|
64
64
|
* @private
|
|
65
65
|
*/
|
|
66
|
-
addListenersToElement(t,
|
|
67
|
-
t && (t.addEventListener(
|
|
66
|
+
addListenersToElement(t, i, c, o) {
|
|
67
|
+
t && (t.addEventListener(i, () => {
|
|
68
68
|
this._timeoutId && clearTimeout(this._timeoutId);
|
|
69
69
|
}, { signal: o }), t.addEventListener(c, () => {
|
|
70
70
|
this.setAutoDismiss();
|
|
@@ -107,7 +107,7 @@ let e = class extends m {
|
|
|
107
107
|
* @private
|
|
108
108
|
*/
|
|
109
109
|
renderActionButton(t) {
|
|
110
|
-
const { text:
|
|
110
|
+
const { text: i, ariaLabel: c } = t;
|
|
111
111
|
return l`
|
|
112
112
|
<pie-button
|
|
113
113
|
variant="${this.shouldNotUseInverseBtnVariant() ? "ghost" : "ghost-inverse"}"
|
|
@@ -116,7 +116,7 @@ let e = class extends m {
|
|
|
116
116
|
@click="${() => this.handleActionClick()}"
|
|
117
117
|
data-test-id="${s}-leading-action"
|
|
118
118
|
type="button">
|
|
119
|
-
${
|
|
119
|
+
${i}
|
|
120
120
|
</pie-button>
|
|
121
121
|
`;
|
|
122
122
|
}
|
|
@@ -130,7 +130,7 @@ let e = class extends m {
|
|
|
130
130
|
renderFooter() {
|
|
131
131
|
const { leadingAction: t } = this;
|
|
132
132
|
return l`
|
|
133
|
-
<footer class="${
|
|
133
|
+
<footer class="${n}-footer" data-test-id="${s}-footer" >
|
|
134
134
|
${t ? this.renderActionButton(t) : d}
|
|
135
135
|
</footer>
|
|
136
136
|
`;
|
|
@@ -183,13 +183,13 @@ let e = class extends m {
|
|
|
183
183
|
getVariantIcon() {
|
|
184
184
|
switch (this.variant) {
|
|
185
185
|
case "info":
|
|
186
|
-
return l`<icon-info-circle class="${
|
|
186
|
+
return l`<icon-info-circle class="${n}-icon" size="s" data-test-id="${s}-heading-icon-info"></icon-info-circle>`;
|
|
187
187
|
case "success":
|
|
188
|
-
return l`<icon-check-circle class="${
|
|
188
|
+
return l`<icon-check-circle class="${n}-icon" size="s" data-test-id="${s}-heading-icon-success"></icon-check-circle>`;
|
|
189
189
|
case "warning":
|
|
190
|
-
return l`<icon-alert-triangle class="${
|
|
190
|
+
return l`<icon-alert-triangle class="${n}-icon" size="s" data-test-id="${s}-heading-icon-warning"></icon-alert-triangle>`;
|
|
191
191
|
case "error":
|
|
192
|
-
return l`<icon-alert-circle class="${
|
|
192
|
+
return l`<icon-alert-circle class="${n}-icon" size="s" data-test-id="${s}-heading-icon-error"></icon-alert-circle>`;
|
|
193
193
|
default:
|
|
194
194
|
return d;
|
|
195
195
|
}
|
|
@@ -215,33 +215,33 @@ let e = class extends m {
|
|
|
215
215
|
render() {
|
|
216
216
|
const {
|
|
217
217
|
variant: t,
|
|
218
|
-
message:
|
|
218
|
+
message: i,
|
|
219
219
|
isDismissible: c,
|
|
220
220
|
leadingAction: o,
|
|
221
|
-
isMultiline:
|
|
221
|
+
isMultiline: r,
|
|
222
222
|
isStrong: h
|
|
223
223
|
} = this, v = {
|
|
224
|
-
[
|
|
225
|
-
|
|
226
|
-
[`${
|
|
227
|
-
[`${
|
|
224
|
+
[n]: !0,
|
|
225
|
+
"is-multiline": r,
|
|
226
|
+
[`${n}--${t}`]: !0,
|
|
227
|
+
[`${n}--strong`]: h
|
|
228
228
|
};
|
|
229
229
|
return l`
|
|
230
230
|
<div
|
|
231
231
|
role="${t === "error" ? "alert" : "status"}"
|
|
232
232
|
data-test-id="${s}"
|
|
233
233
|
class="${x(v)}">
|
|
234
|
-
<div class="${
|
|
235
|
-
<div class="${
|
|
234
|
+
<div class="${n}-contentArea">
|
|
235
|
+
<div class="${n}-messageArea">
|
|
236
236
|
${this.variantHasIcon(t) ? this.getVariantIcon() : d}
|
|
237
|
-
${
|
|
237
|
+
${i === "" ? d : this.renderMessage(i)}
|
|
238
238
|
</div>
|
|
239
|
-
<div class="${
|
|
240
|
-
${!
|
|
239
|
+
<div class="${n}-actionsArea">
|
|
240
|
+
${!r && (o != null && o.text) ? this.renderActionButton(o) : d}
|
|
241
241
|
${c ? this.renderCloseButton() : d}
|
|
242
242
|
</div>
|
|
243
243
|
</div>
|
|
244
|
-
${
|
|
244
|
+
${r && (o != null && o.text) ? this.renderFooter() : d}
|
|
245
245
|
</div>`;
|
|
246
246
|
}
|
|
247
247
|
};
|
|
@@ -285,7 +285,7 @@ export {
|
|
|
285
285
|
T as ON_TOAST_LEADING_ACTION_CLICK_EVENT,
|
|
286
286
|
E as ON_TOAST_OPEN_EVENT,
|
|
287
287
|
e as PieToast,
|
|
288
|
-
|
|
288
|
+
n as componentClass,
|
|
289
289
|
s as componentSelector,
|
|
290
290
|
p as defaultProps,
|
|
291
291
|
_ as variants
|
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.12.
|
|
4
|
+
"version": "0.12.35",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/justeattakeaway/pie",
|
|
@@ -45,15 +45,15 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
47
47
|
"@justeattakeaway/pie-components-config": "0.21.0",
|
|
48
|
-
"@justeattakeaway/pie-css": "0.
|
|
48
|
+
"@justeattakeaway/pie-css": "1.0.0",
|
|
49
49
|
"@justeattakeaway/pie-monorepo-utils": "0.7.0",
|
|
50
50
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@justeattakeaway/pie-button": "1.13.
|
|
54
|
-
"@justeattakeaway/pie-icon-button": "2.7.
|
|
55
|
-
"@justeattakeaway/pie-icons-webc": "1.21.
|
|
56
|
-
"@justeattakeaway/pie-webc-core": "
|
|
53
|
+
"@justeattakeaway/pie-button": "1.13.2",
|
|
54
|
+
"@justeattakeaway/pie-icon-button": "2.7.5",
|
|
55
|
+
"@justeattakeaway/pie-icons-webc": "1.21.2",
|
|
56
|
+
"@justeattakeaway/pie-webc-core": "13.0.0"
|
|
57
57
|
},
|
|
58
58
|
"volta": {
|
|
59
59
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -323,7 +323,7 @@ export class PieToast extends PieElement implements ToastProps {
|
|
|
323
323
|
|
|
324
324
|
const componentWrapperClasses = {
|
|
325
325
|
[componentClass]: true,
|
|
326
|
-
|
|
326
|
+
'is-multiline': isMultiline,
|
|
327
327
|
[`${componentClass}--${variant}`]: true,
|
|
328
328
|
[`${componentClass}--strong`]: isStrong,
|
|
329
329
|
};
|