@spectrum-web-components/toast 1.1.0 → 1.1.2
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/package.json +7 -7
- package/sp-toast.d.ts +6 -0
- package/sp-toast.dev.js +5 -0
- package/sp-toast.dev.js.map +7 -0
- package/sp-toast.js +2 -0
- package/sp-toast.js.map +7 -0
- package/src/Toast.d.ts +79 -0
- package/src/Toast.dev.js +206 -0
- package/src/Toast.dev.js.map +7 -0
- package/src/Toast.js +37 -0
- package/src/Toast.js.map +7 -0
- package/src/index.d.ts +1 -0
- package/src/index.dev.js +3 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/src/spectrum-toast.css.d.ts +2 -0
- package/src/spectrum-toast.css.dev.js +7 -0
- package/src/spectrum-toast.css.dev.js.map +7 -0
- package/src/spectrum-toast.css.js +4 -0
- package/src/spectrum-toast.css.js.map +7 -0
- package/src/toast-overrides.css.d.ts +2 -0
- package/src/toast-overrides.css.dev.js +7 -0
- package/src/toast-overrides.css.dev.js.map +7 -0
- package/src/toast-overrides.css.js +4 -0
- package/src/toast-overrides.css.js.map +7 -0
- package/src/toast.css.d.ts +2 -0
- package/src/toast.css.dev.js +7 -0
- package/src/toast.css.dev.js.map +7 -0
- package/src/toast.css.js +4 -0
- package/src/toast.css.js.map +7 -0
- package/stories/toast.stories.js +192 -0
- package/stories/toast.stories.js.map +7 -0
- package/test/benchmark/test-basic.js +8 -0
- package/test/benchmark/test-basic.js.map +7 -0
- package/test/toast-memory.test.js +8 -0
- package/test/toast-memory.test.js.map +7 -0
- package/test/toast.test-vrt.js +5 -0
- package/test/toast.test-vrt.js.map +7 -0
- package/test/toast.test.js +227 -0
- package/test/toast.test.js.map +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/toast",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"lit-html"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@spectrum-web-components/base": "^1.1.
|
|
62
|
-
"@spectrum-web-components/button": "^1.1.
|
|
63
|
-
"@spectrum-web-components/icon": "^1.1.
|
|
64
|
-
"@spectrum-web-components/icons-workflow": "^1.1.
|
|
65
|
-
"@spectrum-web-components/shared": "^1.1.
|
|
61
|
+
"@spectrum-web-components/base": "^1.1.2",
|
|
62
|
+
"@spectrum-web-components/button": "^1.1.2",
|
|
63
|
+
"@spectrum-web-components/icon": "^1.1.2",
|
|
64
|
+
"@spectrum-web-components/icons-workflow": "^1.1.2",
|
|
65
|
+
"@spectrum-web-components/shared": "^1.1.2"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@spectrum-css/toast": "11.0.0-s2-foundations.15"
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"./sp-*.js",
|
|
74
74
|
"./**/*.dev.js"
|
|
75
75
|
],
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "9ee45f2dfd3ac1939072726d00195c6c05d9a562"
|
|
77
77
|
}
|
package/sp-toast.d.ts
ADDED
package/sp-toast.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-toast.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Toast } from './src/Toast.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-toast', Toast);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-toast': Toast;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAE9B,cAAc,YAAY,KAAK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/sp-toast.js
ADDED
package/sp-toast.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-toast.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Toast } from './src/Toast.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-toast', Toast);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-toast': Toast;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,SAAAA,MAAa,iBACtB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,WAAYD,CAAK",
|
|
6
|
+
"names": ["Toast", "defineElement"]
|
|
7
|
+
}
|
package/src/Toast.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
import '@spectrum-web-components/button/sp-close-button.js';
|
|
3
|
+
import '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';
|
|
4
|
+
import '@spectrum-web-components/icons-workflow/icons/sp-icon-info.js';
|
|
5
|
+
import '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';
|
|
6
|
+
export declare const toastVariants: ToastVariants[];
|
|
7
|
+
export type ToastVariants = 'negative' | 'positive' | 'info' | 'error' | 'warning' | '';
|
|
8
|
+
declare const Toast_base: typeof SpectrumElement;
|
|
9
|
+
/**
|
|
10
|
+
* @element sp-toast
|
|
11
|
+
*
|
|
12
|
+
* @slot - The toast content
|
|
13
|
+
* @slot action - button element surfacing an action in the Toast
|
|
14
|
+
*
|
|
15
|
+
* @fires close - Announces that the Toast has been closed by the user or by its timeout.
|
|
16
|
+
*/
|
|
17
|
+
export declare class Toast extends Toast_base {
|
|
18
|
+
static get styles(): CSSResultArray;
|
|
19
|
+
/**
|
|
20
|
+
* The `open` property indicates whether the toast is visible or hidden.
|
|
21
|
+
*
|
|
22
|
+
* @param {Boolean} open
|
|
23
|
+
*/
|
|
24
|
+
open: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* When a timeout is provided, it represents the number of milliseconds from when
|
|
27
|
+
* the Toast was placed on the page before it will automatically dismiss itself.
|
|
28
|
+
*
|
|
29
|
+
* Accessibility concerns require that a Toast is available for at least 6000ms
|
|
30
|
+
* before being dismissed, so any timeout of less than 6000ms will be raised to
|
|
31
|
+
* that baseline.
|
|
32
|
+
*
|
|
33
|
+
* It is suggested that messages longer than 120 words should receive an additional
|
|
34
|
+
* 1000ms in their timeout for each additional 120 words in the message.
|
|
35
|
+
*
|
|
36
|
+
* For example, a message with 240 words should have a timeout of 7000ms,
|
|
37
|
+
* and a message with 360 words should have a timeout of 8000ms.
|
|
38
|
+
*
|
|
39
|
+
* @param {Number | null} timeout
|
|
40
|
+
* @default null
|
|
41
|
+
*/
|
|
42
|
+
set timeout(timeout: number | null);
|
|
43
|
+
get timeout(): number | null;
|
|
44
|
+
private _timeout;
|
|
45
|
+
/**
|
|
46
|
+
* The variant applies specific styling when set to `negative`, `positive`, `info`, `error`, or `warning`.
|
|
47
|
+
*
|
|
48
|
+
* The variants `error` and `warning` are deprecated and should be replaced with `negative`.
|
|
49
|
+
*
|
|
50
|
+
* `variant` attribute is removed when not matching one of the above.
|
|
51
|
+
*
|
|
52
|
+
* @param {String} variant
|
|
53
|
+
*/
|
|
54
|
+
set variant(variant: ToastVariants);
|
|
55
|
+
get variant(): ToastVariants;
|
|
56
|
+
private _variant;
|
|
57
|
+
/**
|
|
58
|
+
* The `iconLabel` property is used to set the `label` attribute on the icon element. This is used to provide a text alternative for the icon to ensure accessibility.
|
|
59
|
+
*
|
|
60
|
+
* If the `iconLabel` property is not set, the icon will use the `variant` to dynamically set the `label`.
|
|
61
|
+
*
|
|
62
|
+
* @param {String} iconLabel
|
|
63
|
+
*/
|
|
64
|
+
iconLabel?: string;
|
|
65
|
+
private renderIcon;
|
|
66
|
+
private countdownStart;
|
|
67
|
+
private nextCount;
|
|
68
|
+
private doCountdown;
|
|
69
|
+
private countdown;
|
|
70
|
+
private holdCountdown;
|
|
71
|
+
private resumeCountdown;
|
|
72
|
+
private startCountdown;
|
|
73
|
+
private stopCountdown;
|
|
74
|
+
private shouldClose;
|
|
75
|
+
close(): void;
|
|
76
|
+
protected render(): TemplateResult;
|
|
77
|
+
protected updated(changes: PropertyValues): void;
|
|
78
|
+
}
|
|
79
|
+
export {};
|
package/src/Toast.dev.js
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
html,
|
|
14
|
+
SpectrumElement
|
|
15
|
+
} from "@spectrum-web-components/base";
|
|
16
|
+
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
17
|
+
import "@spectrum-web-components/button/sp-close-button.js";
|
|
18
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js";
|
|
19
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-info.js";
|
|
20
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js";
|
|
21
|
+
import { FocusVisiblePolyfillMixin } from "@spectrum-web-components/shared/src/focus-visible.js";
|
|
22
|
+
import toastStyles from "./toast.css.js";
|
|
23
|
+
export const toastVariants = [
|
|
24
|
+
"negative",
|
|
25
|
+
"positive",
|
|
26
|
+
"info",
|
|
27
|
+
"error",
|
|
28
|
+
"warning"
|
|
29
|
+
];
|
|
30
|
+
export class Toast extends FocusVisiblePolyfillMixin(SpectrumElement) {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
this.open = false;
|
|
34
|
+
this._timeout = null;
|
|
35
|
+
this._variant = "";
|
|
36
|
+
this.countdownStart = 0;
|
|
37
|
+
this.nextCount = -1;
|
|
38
|
+
this.doCountdown = (time) => {
|
|
39
|
+
if (!this.countdownStart) {
|
|
40
|
+
this.countdownStart = performance.now();
|
|
41
|
+
}
|
|
42
|
+
if (time - this.countdownStart > this._timeout) {
|
|
43
|
+
this.shouldClose();
|
|
44
|
+
this.countdownStart = 0;
|
|
45
|
+
} else {
|
|
46
|
+
this.countdown();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
this.countdown = () => {
|
|
50
|
+
cancelAnimationFrame(this.nextCount);
|
|
51
|
+
this.nextCount = requestAnimationFrame(this.doCountdown);
|
|
52
|
+
};
|
|
53
|
+
this.holdCountdown = () => {
|
|
54
|
+
this.stopCountdown();
|
|
55
|
+
this.addEventListener("focusout", this.resumeCountdown);
|
|
56
|
+
};
|
|
57
|
+
this.resumeCountdown = () => {
|
|
58
|
+
this.removeEventListener("focusout", this.holdCountdown);
|
|
59
|
+
this.countdown();
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
static get styles() {
|
|
63
|
+
return [toastStyles];
|
|
64
|
+
}
|
|
65
|
+
set timeout(timeout) {
|
|
66
|
+
const hasTimeout = typeof timeout !== null && timeout > 0;
|
|
67
|
+
const newTimeout = hasTimeout ? Math.max(6e3, timeout) : null;
|
|
68
|
+
const oldValue = this.timeout;
|
|
69
|
+
if (newTimeout && this.countdownStart) {
|
|
70
|
+
this.countdownStart = performance.now();
|
|
71
|
+
}
|
|
72
|
+
this._timeout = newTimeout;
|
|
73
|
+
this.requestUpdate("timeout", oldValue);
|
|
74
|
+
}
|
|
75
|
+
get timeout() {
|
|
76
|
+
return this._timeout;
|
|
77
|
+
}
|
|
78
|
+
set variant(variant) {
|
|
79
|
+
if (variant === this.variant) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const oldValue = this.variant;
|
|
83
|
+
if (toastVariants.includes(variant)) {
|
|
84
|
+
this.setAttribute("variant", variant);
|
|
85
|
+
this._variant = variant;
|
|
86
|
+
} else {
|
|
87
|
+
this.removeAttribute("variant");
|
|
88
|
+
this._variant = "";
|
|
89
|
+
}
|
|
90
|
+
this.requestUpdate("variant", oldValue);
|
|
91
|
+
}
|
|
92
|
+
get variant() {
|
|
93
|
+
return this._variant;
|
|
94
|
+
}
|
|
95
|
+
//TODO(#4931): Address the deprecated variants or remove the flags
|
|
96
|
+
renderIcon(variant, iconLabel) {
|
|
97
|
+
switch (variant) {
|
|
98
|
+
case "info":
|
|
99
|
+
return html`
|
|
100
|
+
<sp-icon-info
|
|
101
|
+
label=${iconLabel || "Information"}
|
|
102
|
+
class="type"
|
|
103
|
+
></sp-icon-info>
|
|
104
|
+
`;
|
|
105
|
+
case "negative":
|
|
106
|
+
case "error":
|
|
107
|
+
return html`
|
|
108
|
+
<sp-icon-alert
|
|
109
|
+
label=${iconLabel || "Error"}
|
|
110
|
+
class="type"
|
|
111
|
+
></sp-icon-alert>
|
|
112
|
+
`;
|
|
113
|
+
case "warning":
|
|
114
|
+
return html`
|
|
115
|
+
<sp-icon-alert
|
|
116
|
+
label=${iconLabel || "Warning"}
|
|
117
|
+
class="type"
|
|
118
|
+
></sp-icon-alert>
|
|
119
|
+
`;
|
|
120
|
+
case "positive":
|
|
121
|
+
return html`
|
|
122
|
+
<sp-icon-checkmark-circle
|
|
123
|
+
label=${iconLabel || "Success"}
|
|
124
|
+
class="type"
|
|
125
|
+
></sp-icon-checkmark-circle>
|
|
126
|
+
`;
|
|
127
|
+
default:
|
|
128
|
+
return html``;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
startCountdown() {
|
|
132
|
+
this.countdown();
|
|
133
|
+
this.addEventListener("focusin", this.holdCountdown);
|
|
134
|
+
}
|
|
135
|
+
stopCountdown() {
|
|
136
|
+
cancelAnimationFrame(this.nextCount);
|
|
137
|
+
this.countdownStart = 0;
|
|
138
|
+
}
|
|
139
|
+
shouldClose() {
|
|
140
|
+
const applyDefault = this.dispatchEvent(
|
|
141
|
+
new CustomEvent("close", {
|
|
142
|
+
composed: true,
|
|
143
|
+
bubbles: true,
|
|
144
|
+
cancelable: true
|
|
145
|
+
})
|
|
146
|
+
);
|
|
147
|
+
if (applyDefault) {
|
|
148
|
+
this.close();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
close() {
|
|
152
|
+
this.open = false;
|
|
153
|
+
}
|
|
154
|
+
render() {
|
|
155
|
+
return html`
|
|
156
|
+
${this.renderIcon(this.variant, this.iconLabel)}
|
|
157
|
+
<div class="body" role="alert">
|
|
158
|
+
<div class="content">
|
|
159
|
+
<slot></slot>
|
|
160
|
+
</div>
|
|
161
|
+
<slot name="action"></slot>
|
|
162
|
+
</div>
|
|
163
|
+
<div class="buttons">
|
|
164
|
+
<sp-close-button
|
|
165
|
+
@click=${this.shouldClose}
|
|
166
|
+
label="Close"
|
|
167
|
+
static-color="white"
|
|
168
|
+
></sp-close-button>
|
|
169
|
+
</div>
|
|
170
|
+
`;
|
|
171
|
+
}
|
|
172
|
+
updated(changes) {
|
|
173
|
+
super.updated(changes);
|
|
174
|
+
if (changes.has("open")) {
|
|
175
|
+
if (this.open) {
|
|
176
|
+
if (this.timeout) {
|
|
177
|
+
this.startCountdown();
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
if (this.timeout) {
|
|
181
|
+
this.stopCountdown();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (changes.has("timeout")) {
|
|
186
|
+
if (this.timeout !== null && this.open) {
|
|
187
|
+
this.startCountdown();
|
|
188
|
+
} else {
|
|
189
|
+
this.stopCountdown();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
__decorateClass([
|
|
195
|
+
property({ type: Boolean, reflect: true })
|
|
196
|
+
], Toast.prototype, "open", 2);
|
|
197
|
+
__decorateClass([
|
|
198
|
+
property({ type: Number })
|
|
199
|
+
], Toast.prototype, "timeout", 1);
|
|
200
|
+
__decorateClass([
|
|
201
|
+
property({ type: String })
|
|
202
|
+
], Toast.prototype, "variant", 1);
|
|
203
|
+
__decorateClass([
|
|
204
|
+
property({ type: String, attribute: "icon-label" })
|
|
205
|
+
], Toast.prototype, "iconLabel", 2);
|
|
206
|
+
//# sourceMappingURL=Toast.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Toast.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-info.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared/src/focus-visible.js';\n\nimport toastStyles from './toast.css.js';\n\nexport const toastVariants: ToastVariants[] = [\n 'negative',\n 'positive',\n 'info',\n 'error',\n 'warning',\n];\n\nexport type ToastVariants =\n | 'negative'\n | 'positive'\n | 'info'\n | 'error'\n | 'warning'\n | '';\n\n/**\n * @element sp-toast\n *\n * @slot - The toast content\n * @slot action - button element surfacing an action in the Toast\n *\n * @fires close - Announces that the Toast has been closed by the user or by its timeout.\n */\n\nexport class Toast extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [toastStyles];\n }\n\n /**\n * The `open` property indicates whether the toast is visible or hidden.\n *\n * @param {Boolean} open\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * When a timeout is provided, it represents the number of milliseconds from when\n * the Toast was placed on the page before it will automatically dismiss itself.\n *\n * Accessibility concerns require that a Toast is available for at least 6000ms\n * before being dismissed, so any timeout of less than 6000ms will be raised to\n * that baseline.\n *\n * It is suggested that messages longer than 120 words should receive an additional\n * 1000ms in their timeout for each additional 120 words in the message.\n *\n * For example, a message with 240 words should have a timeout of 7000ms,\n * and a message with 360 words should have a timeout of 8000ms.\n *\n * @param {Number | null} timeout\n * @default null\n */\n //TODO(#4939): Align on the timeout minimum with design\n @property({ type: Number })\n public set timeout(timeout: number | null) {\n const hasTimeout = typeof timeout !== null && (timeout as number) > 0;\n const newTimeout = hasTimeout\n ? Math.max(6000, timeout as number)\n : null;\n const oldValue = this.timeout;\n if (newTimeout && this.countdownStart) {\n this.countdownStart = performance.now();\n }\n this._timeout = newTimeout;\n this.requestUpdate('timeout', oldValue);\n }\n\n public get timeout(): number | null {\n return this._timeout;\n }\n\n private _timeout: number | null = null;\n\n /**\n * The variant applies specific styling when set to `negative`, `positive`, `info`, `error`, or `warning`.\n *\n * The variants `error` and `warning` are deprecated and should be replaced with `negative`.\n *\n * `variant` attribute is removed when not matching one of the above.\n *\n * @param {String} variant\n */\n @property({ type: String })\n public set variant(variant: ToastVariants) {\n if (variant === this.variant) {\n return;\n }\n const oldValue = this.variant;\n\n // validate the variant is one of the allowed values else remove the attribute\n if (toastVariants.includes(variant)) {\n this.setAttribute('variant', variant);\n this._variant = variant;\n } else {\n this.removeAttribute('variant');\n this._variant = '';\n }\n this.requestUpdate('variant', oldValue);\n }\n\n public get variant(): ToastVariants {\n return this._variant;\n }\n\n private _variant: ToastVariants = '';\n\n /**\n * The `iconLabel` property is used to set the `label` attribute on the icon element. This is used to provide a text alternative for the icon to ensure accessibility.\n *\n * If the `iconLabel` property is not set, the icon will use the `variant` to dynamically set the `label`.\n *\n * @param {String} iconLabel\n */\n @property({ type: String, attribute: 'icon-label' })\n public iconLabel?: string;\n\n //TODO(#4931): Address the deprecated variants or remove the flags\n private renderIcon(\n variant: ToastVariants,\n iconLabel?: string\n ): TemplateResult {\n switch (variant) {\n case 'info':\n return html`\n <sp-icon-info\n label=${iconLabel || 'Information'}\n class=\"type\"\n ></sp-icon-info>\n `;\n case 'negative':\n case 'error': // deprecated\n return html`\n <sp-icon-alert\n label=${iconLabel || 'Error'}\n class=\"type\"\n ></sp-icon-alert>\n `;\n case 'warning': // deprecated\n return html`\n <sp-icon-alert\n label=${iconLabel || 'Warning'}\n class=\"type\"\n ></sp-icon-alert>\n `;\n case 'positive':\n return html`\n <sp-icon-checkmark-circle\n label=${iconLabel || 'Success'}\n class=\"type\"\n ></sp-icon-checkmark-circle>\n `;\n default:\n return html``;\n }\n }\n\n private countdownStart = 0;\n private nextCount = -1;\n\n private doCountdown = (time: number): void => {\n if (!this.countdownStart) {\n this.countdownStart = performance.now();\n }\n if (time - this.countdownStart > (this._timeout as number)) {\n this.shouldClose();\n this.countdownStart = 0;\n } else {\n this.countdown();\n }\n };\n\n private countdown = (): void => {\n cancelAnimationFrame(this.nextCount);\n this.nextCount = requestAnimationFrame(this.doCountdown);\n };\n\n private holdCountdown = (): void => {\n this.stopCountdown();\n this.addEventListener('focusout', this.resumeCountdown);\n };\n\n private resumeCountdown = (): void => {\n this.removeEventListener('focusout', this.holdCountdown);\n this.countdown();\n };\n\n private startCountdown(): void {\n this.countdown();\n this.addEventListener('focusin', this.holdCountdown);\n }\n\n private stopCountdown(): void {\n cancelAnimationFrame(this.nextCount);\n this.countdownStart = 0;\n }\n\n private shouldClose(): void {\n const applyDefault = this.dispatchEvent(\n new CustomEvent('close', {\n composed: true,\n bubbles: true,\n cancelable: true,\n })\n );\n if (applyDefault) {\n this.close();\n }\n }\n\n public close(): void {\n this.open = false;\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.renderIcon(this.variant, this.iconLabel)}\n <div class=\"body\" role=\"alert\">\n <div class=\"content\">\n <slot></slot>\n </div>\n <slot name=\"action\"></slot>\n </div>\n <div class=\"buttons\">\n <sp-close-button\n @click=${this.shouldClose}\n label=\"Close\"\n static-color=\"white\"\n ></sp-close-button>\n </div>\n `;\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('open')) {\n if (this.open) {\n if (this.timeout) {\n this.startCountdown();\n }\n } else {\n if (this.timeout) {\n this.stopCountdown();\n }\n }\n }\n if (changes.has('timeout')) {\n if (this.timeout !== null && this.open) {\n this.startCountdown();\n } else {\n this.stopCountdown();\n }\n }\n }\n}\n"],
|
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ptor;var r=(u,n,t,e)=>{for(var o=e>1?void 0:e?p(n,t):n,s=u.length-1,l;s>=0;s--)(l=u[s])&&(o=(e?l(n,t,o):l(o))||o);return e&&o&&c(n,t,o),o};import{html as i,SpectrumElement as d}from"@spectrum-web-components/base";import{property as a}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/button/sp-close-button.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-info.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js";import{FocusVisiblePolyfillMixin as h}from"@spectrum-web-components/shared/src/focus-visible.js";import m from"./toast.css.js";export const toastVariants=["negative","positive","info","error","warning"];export class Toast extends h(d){constructor(){super(...arguments);this.open=!1;this._timeout=null;this._variant="";this.countdownStart=0;this.nextCount=-1;this.doCountdown=t=>{this.countdownStart||(this.countdownStart=performance.now()),t-this.countdownStart>this._timeout?(this.shouldClose(),this.countdownStart=0):this.countdown()};this.countdown=()=>{cancelAnimationFrame(this.nextCount),this.nextCount=requestAnimationFrame(this.doCountdown)};this.holdCountdown=()=>{this.stopCountdown(),this.addEventListener("focusout",this.resumeCountdown)};this.resumeCountdown=()=>{this.removeEventListener("focusout",this.holdCountdown),this.countdown()}}static get styles(){return[m]}set timeout(t){const o=typeof t!==null&&t>0?Math.max(6e3,t):null,s=this.timeout;o&&this.countdownStart&&(this.countdownStart=performance.now()),this._timeout=o,this.requestUpdate("timeout",s)}get timeout(){return this._timeout}set variant(t){if(t===this.variant)return;const e=this.variant;toastVariants.includes(t)?(this.setAttribute("variant",t),this._variant=t):(this.removeAttribute("variant"),this._variant=""),this.requestUpdate("variant",e)}get variant(){return this._variant}renderIcon(t,e){switch(t){case"info":return i`
|
|
2
|
+
<sp-icon-info
|
|
3
|
+
label=${e||"Information"}
|
|
4
|
+
class="type"
|
|
5
|
+
></sp-icon-info>
|
|
6
|
+
`;case"negative":case"error":return i`
|
|
7
|
+
<sp-icon-alert
|
|
8
|
+
label=${e||"Error"}
|
|
9
|
+
class="type"
|
|
10
|
+
></sp-icon-alert>
|
|
11
|
+
`;case"warning":return i`
|
|
12
|
+
<sp-icon-alert
|
|
13
|
+
label=${e||"Warning"}
|
|
14
|
+
class="type"
|
|
15
|
+
></sp-icon-alert>
|
|
16
|
+
`;case"positive":return i`
|
|
17
|
+
<sp-icon-checkmark-circle
|
|
18
|
+
label=${e||"Success"}
|
|
19
|
+
class="type"
|
|
20
|
+
></sp-icon-checkmark-circle>
|
|
21
|
+
`;default:return i``}}startCountdown(){this.countdown(),this.addEventListener("focusin",this.holdCountdown)}stopCountdown(){cancelAnimationFrame(this.nextCount),this.countdownStart=0}shouldClose(){this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0,cancelable:!0}))&&this.close()}close(){this.open=!1}render(){return i`
|
|
22
|
+
${this.renderIcon(this.variant,this.iconLabel)}
|
|
23
|
+
<div class="body" role="alert">
|
|
24
|
+
<div class="content">
|
|
25
|
+
<slot></slot>
|
|
26
|
+
</div>
|
|
27
|
+
<slot name="action"></slot>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="buttons">
|
|
30
|
+
<sp-close-button
|
|
31
|
+
@click=${this.shouldClose}
|
|
32
|
+
label="Close"
|
|
33
|
+
static-color="white"
|
|
34
|
+
></sp-close-button>
|
|
35
|
+
</div>
|
|
36
|
+
`}updated(t){super.updated(t),t.has("open")&&(this.open?this.timeout&&this.startCountdown():this.timeout&&this.stopCountdown()),t.has("timeout")&&(this.timeout!==null&&this.open?this.startCountdown():this.stopCountdown())}}r([a({type:Boolean,reflect:!0})],Toast.prototype,"open",2),r([a({type:Number})],Toast.prototype,"timeout",1),r([a({type:String})],Toast.prototype,"variant",1),r([a({type:String,attribute:"icon-label"})],Toast.prototype,"iconLabel",2);
|
|
37
|
+
//# sourceMappingURL=Toast.js.map
|
package/src/Toast.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Toast.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-info.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared/src/focus-visible.js';\n\nimport toastStyles from './toast.css.js';\n\nexport const toastVariants: ToastVariants[] = [\n 'negative',\n 'positive',\n 'info',\n 'error',\n 'warning',\n];\n\nexport type ToastVariants =\n | 'negative'\n | 'positive'\n | 'info'\n | 'error'\n | 'warning'\n | '';\n\n/**\n * @element sp-toast\n *\n * @slot - The toast content\n * @slot action - button element surfacing an action in the Toast\n *\n * @fires close - Announces that the Toast has been closed by the user or by its timeout.\n */\n\nexport class Toast extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [toastStyles];\n }\n\n /**\n * The `open` property indicates whether the toast is visible or hidden.\n *\n * @param {Boolean} open\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * When a timeout is provided, it represents the number of milliseconds from when\n * the Toast was placed on the page before it will automatically dismiss itself.\n *\n * Accessibility concerns require that a Toast is available for at least 6000ms\n * before being dismissed, so any timeout of less than 6000ms will be raised to\n * that baseline.\n *\n * It is suggested that messages longer than 120 words should receive an additional\n * 1000ms in their timeout for each additional 120 words in the message.\n *\n * For example, a message with 240 words should have a timeout of 7000ms,\n * and a message with 360 words should have a timeout of 8000ms.\n *\n * @param {Number | null} timeout\n * @default null\n */\n //TODO(#4939): Align on the timeout minimum with design\n @property({ type: Number })\n public set timeout(timeout: number | null) {\n const hasTimeout = typeof timeout !== null && (timeout as number) > 0;\n const newTimeout = hasTimeout\n ? Math.max(6000, timeout as number)\n : null;\n const oldValue = this.timeout;\n if (newTimeout && this.countdownStart) {\n this.countdownStart = performance.now();\n }\n this._timeout = newTimeout;\n this.requestUpdate('timeout', oldValue);\n }\n\n public get timeout(): number | null {\n return this._timeout;\n }\n\n private _timeout: number | null = null;\n\n /**\n * The variant applies specific styling when set to `negative`, `positive`, `info`, `error`, or `warning`.\n *\n * The variants `error` and `warning` are deprecated and should be replaced with `negative`.\n *\n * `variant` attribute is removed when not matching one of the above.\n *\n * @param {String} variant\n */\n @property({ type: String })\n public set variant(variant: ToastVariants) {\n if (variant === this.variant) {\n return;\n }\n const oldValue = this.variant;\n\n // validate the variant is one of the allowed values else remove the attribute\n if (toastVariants.includes(variant)) {\n this.setAttribute('variant', variant);\n this._variant = variant;\n } else {\n this.removeAttribute('variant');\n this._variant = '';\n }\n this.requestUpdate('variant', oldValue);\n }\n\n public get variant(): ToastVariants {\n return this._variant;\n }\n\n private _variant: ToastVariants = '';\n\n /**\n * The `iconLabel` property is used to set the `label` attribute on the icon element. This is used to provide a text alternative for the icon to ensure accessibility.\n *\n * If the `iconLabel` property is not set, the icon will use the `variant` to dynamically set the `label`.\n *\n * @param {String} iconLabel\n */\n @property({ type: String, attribute: 'icon-label' })\n public iconLabel?: string;\n\n //TODO(#4931): Address the deprecated variants or remove the flags\n private renderIcon(\n variant: ToastVariants,\n iconLabel?: string\n ): TemplateResult {\n switch (variant) {\n case 'info':\n return html`\n <sp-icon-info\n label=${iconLabel || 'Information'}\n class=\"type\"\n ></sp-icon-info>\n `;\n case 'negative':\n case 'error': // deprecated\n return html`\n <sp-icon-alert\n label=${iconLabel || 'Error'}\n class=\"type\"\n ></sp-icon-alert>\n `;\n case 'warning': // deprecated\n return html`\n <sp-icon-alert\n label=${iconLabel || 'Warning'}\n class=\"type\"\n ></sp-icon-alert>\n `;\n case 'positive':\n return html`\n <sp-icon-checkmark-circle\n label=${iconLabel || 'Success'}\n class=\"type\"\n ></sp-icon-checkmark-circle>\n `;\n default:\n return html``;\n }\n }\n\n private countdownStart = 0;\n private nextCount = -1;\n\n private doCountdown = (time: number): void => {\n if (!this.countdownStart) {\n this.countdownStart = performance.now();\n }\n if (time - this.countdownStart > (this._timeout as number)) {\n this.shouldClose();\n this.countdownStart = 0;\n } else {\n this.countdown();\n }\n };\n\n private countdown = (): void => {\n cancelAnimationFrame(this.nextCount);\n this.nextCount = requestAnimationFrame(this.doCountdown);\n };\n\n private holdCountdown = (): void => {\n this.stopCountdown();\n this.addEventListener('focusout', this.resumeCountdown);\n };\n\n private resumeCountdown = (): void => {\n this.removeEventListener('focusout', this.holdCountdown);\n this.countdown();\n };\n\n private startCountdown(): void {\n this.countdown();\n this.addEventListener('focusin', this.holdCountdown);\n }\n\n private stopCountdown(): void {\n cancelAnimationFrame(this.nextCount);\n this.countdownStart = 0;\n }\n\n private shouldClose(): void {\n const applyDefault = this.dispatchEvent(\n new CustomEvent('close', {\n composed: true,\n bubbles: true,\n cancelable: true,\n })\n );\n if (applyDefault) {\n this.close();\n }\n }\n\n public close(): void {\n this.open = false;\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.renderIcon(this.variant, this.iconLabel)}\n <div class=\"body\" role=\"alert\">\n <div class=\"content\">\n <slot></slot>\n </div>\n <slot name=\"action\"></slot>\n </div>\n <div class=\"buttons\">\n <sp-close-button\n @click=${this.shouldClose}\n label=\"Close\"\n static-color=\"white\"\n ></sp-close-button>\n </div>\n `;\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('open')) {\n if (this.open) {\n if (this.timeout) {\n this.startCountdown();\n }\n } else {\n if (this.timeout) {\n this.stopCountdown();\n }\n }\n }\n if (changes.has('timeout')) {\n if (this.timeout !== null && this.open) {\n this.startCountdown();\n } else {\n this.stopCountdown();\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,EAEA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,MAAO,qDACP,MAAO,iEACP,MAAO,gEACP,MAAO,4EACP,OAAS,6BAAAC,MAAiC,uDAE1C,OAAOC,MAAiB,iBAEjB,aAAM,cAAiC,CAC1C,WACA,WACA,OACA,QACA,SACJ,EAmBO,aAAM,cAAcD,EAA0BF,CAAe,CAAE,CAA/D,kCAWH,KAAO,KAAO,GAsCd,KAAQ,SAA0B,KAiClC,KAAQ,SAA0B,GAoDlC,KAAQ,eAAiB,EACzB,KAAQ,UAAY,GAEpB,KAAQ,YAAeI,GAAuB,CACrC,KAAK,iBACN,KAAK,eAAiB,YAAY,IAAI,GAEtCA,EAAO,KAAK,eAAkB,KAAK,UACnC,KAAK,YAAY,EACjB,KAAK,eAAiB,GAEtB,KAAK,UAAU,CAEvB,EAEA,KAAQ,UAAY,IAAY,CAC5B,qBAAqB,KAAK,SAAS,EACnC,KAAK,UAAY,sBAAsB,KAAK,WAAW,CAC3D,EAEA,KAAQ,cAAgB,IAAY,CAChC,KAAK,cAAc,EACnB,KAAK,iBAAiB,WAAY,KAAK,eAAe,CAC1D,EAEA,KAAQ,gBAAkB,IAAY,CAClC,KAAK,oBAAoB,WAAY,KAAK,aAAa,EACvD,KAAK,UAAU,CACnB,EAjKA,WAA2B,QAAyB,CAChD,MAAO,CAACD,CAAW,CACvB,CA6BA,IAAW,QAAQE,EAAwB,CAEvC,MAAMC,EADa,OAAOD,IAAY,MAASA,EAAqB,EAE9D,KAAK,IAAI,IAAMA,CAAiB,EAChC,KACAE,EAAW,KAAK,QAClBD,GAAc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;AAAA;AAAA;AAAA;AAAA;AAAA,6BAS9B,KAAK,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,SAMzC,CAEmB,QAAQW,EAA+B,CACtD,MAAM,QAAQA,CAAO,EACjBA,EAAQ,IAAI,MAAM,IACd,KAAK,KACD,KAAK,SACL,KAAK,eAAe,EAGpB,KAAK,SACL,KAAK,cAAc,GAI3BA,EAAQ,IAAI,SAAS,IACjB,KAAK,UAAY,MAAQ,KAAK,KAC9B,KAAK,eAAe,EAEpB,KAAK,cAAc,EAG/B,CACJ,CA5NWC,EAAA,CADNV,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAVjC,MAWF,oBAqBIU,EAAA,CADVV,EAAS,CAAE,KAAM,MAAO,CAAC,GA/BjB,MAgCE,uBA6BAU,EAAA,CADVV,EAAS,CAAE,KAAM,MAAO,CAAC,GA5DjB,MA6DE,uBA+BJU,EAAA,CADNV,EAAS,CAAE,KAAM,OAAQ,UAAW,YAAa,CAAC,GA3F1C,MA4FF",
|
|
6
|
+
"names": ["html", "SpectrumElement", "property", "FocusVisiblePolyfillMixin", "toastStyles", "time", "timeout", "newTimeout", "oldValue", "variant", "iconLabel", "changes", "__decorateClass"]
|
|
7
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Toast.js';
|
package/src/index.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nexport * from './Toast.dev.js'\n"],
|
|
5
|
+
"mappings": ";AAWA,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nexport * from './Toast.js';\n"],
|
|
5
|
+
"mappings": "aAWA,WAAc",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
@media (forced-colors:active){:host{--highcontrast-toast-border-color:ButtonText;border:var(--mod-toast-border-width,var(--spectrum-toast-border-width))solid var(--highcontrast-toast-border-color,transparent)}}:host{box-sizing:border-box;min-block-size:var(--mod-toast-block-size,var(--spectrum-toast-block-size));max-inline-size:var(--mod-toast-max-inline-size,var(--spectrum-toast-max-inline-size));border-radius:var(--mod-toast-corner-radius,var(--spectrum-toast-corner-radius));font-size:var(--mod-toast-font-size,var(--spectrum-toast-font-size));font-weight:var(--mod-toast-font-weight,var(--spectrum-toast-font-weight));-webkit-font-smoothing:antialiased;background-color:var(--highcontrast-toast-background-color-default,var(--mod-toast-background-color-default,var(--spectrum-toast-background-color-default)));color:var(--highcontrast-toast-background-color-default,var(--mod-toast-background-color-default,var(--spectrum-toast-background-color-default)));overflow-wrap:anywhere;flex-direction:row;align-items:stretch;padding-inline-start:var(--mod-toast-spacing-start-edge-to-text-and-icon,var(--spectrum-toast-spacing-start-edge-to-text-and-icon));display:inline-flex}:host([variant=negative]){background-color:var(--highcontrast-toast-negative-background-color-default,var(--mod-toast-negative-background-color-default,var(--spectrum-toast-negative-background-color-default)))}:host([variant=negative]),:host([variant=negative]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-negative-background-color-default,var(--mod-toast-negative-background-color-default,var(--spectrum-toast-negative-background-color-default)))}:host([variant=info]){background-color:var(--highcontrast-toast-informative-background-color-default,var(--mod-toast-informative-background-color-default,var(--spectrum-toast-informative-background-color-default)))}:host([variant=info]),:host([variant=info]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-informative-background-color-default,var(--mod-toast-informative-background-color-default,var(--spectrum-toast-informative-background-color-default)))}:host([variant=positive]){background-color:var(--highcontrast-toast-positive-background-color-default,var(--mod-toast-positive-background-color-default,var(--spectrum-toast-positive-background-color-default)))}:host([variant=positive]),:host([variant=positive]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-positive-background-color-default,var(--mod-toast-positive-background-color-default,var(--spectrum-toast-positive-background-color-default)))}.type{flex-grow:0;flex-shrink:0;margin-block-start:var(--mod-toast-spacing-top-edge-to-icon,var(--spectrum-toast-spacing-top-edge-to-icon));margin-inline-start:0;margin-inline-end:var(--mod-toast-spacing-icon-to-text,var(--spectrum-toast-spacing-icon-to-text))}.content,.type{color:var(--highcontrast-toast-text-and-icon-color,var(--mod-toast-text-and-icon-color,var(--spectrum-toast-text-and-icon-color)))}.content{box-sizing:border-box;line-height:var(--mod-toast-line-height,var(--spectrum-toast-line-height));text-align:start;flex:auto;padding-block-start:calc(var(--mod-toast-spacing-top-edge-to-text,var(--spectrum-toast-spacing-top-edge-to-text)) - var(--mod-toast-spacing-block-start,var(--spectrum-toast-spacing-block-start)));padding-block-end:calc(var(--mod-toast-spacing-bottom-edge-to-text,var(--spectrum-toast-spacing-bottom-edge-to-text)) - var(--mod-toast-spacing-block-end,var(--spectrum-toast-spacing-block-end)));padding-inline-start:0;padding-inline-end:var(--mod-toast-spacing-text-to-action-button-horizontal,var(--spectrum-toast-spacing-text-to-action-button-horizontal));display:inline-block}.content:lang(ja),.content:lang(ko),.content:lang(zh){line-height:var(--mod-toast-line-height-cjk,var(--spectrum-toast-line-height-cjk))}.buttons{border-inline-start-color:var(--mod-toast-divider-color,var(--spectrum-toast-divider-color));flex:none;align-items:flex-start;margin-block-start:var(--mod-toast-spacing-top-edge-to-divider,var(--spectrum-toast-spacing-top-edge-to-divider));margin-block-end:var(--mod-toast-spacing-bottom-edge-to-divider,var(--spectrum-toast-spacing-bottom-edge-to-divider));padding-inline-end:var(--mod-toast-spacing-close-button,var(--spectrum-toast-spacing-close-button));display:flex}.buttons .spectrum-CloseButton{align-self:flex-start}.body{flex-wrap:wrap;flex:auto;align-self:center;align-items:center;padding-block-start:var(--mod-toast-spacing-block-start,var(--spectrum-toast-spacing-block-start));padding-block-end:var(--mod-toast-spacing-block-end,var(--spectrum-toast-spacing-block-end));display:flex}.body ::slotted([slot=action]){margin-inline-start:auto;margin-inline-end:var(--mod-toast-spacing-text-and-action-button-to-divider,var(--spectrum-toast-spacing-text-and-action-button-to-divider))}.body ::slotted([slot=action]:dir(rtl)),:host([dir=rtl]) .body ::slotted([slot=action]){margin-inline-end:var(--mod-toast-spacing-text-and-action-button-to-divider,var(--spectrum-toast-spacing-text-and-action-button-to-divider))}.body+.buttons{border-inline-start-style:solid;border-inline-start-width:1px;padding-inline-start:var(--mod-toast-spacing-close-button,var(--spectrum-toast-spacing-close-button))}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=spectrum-toast.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-toast.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n @media (forced-colors:active){:host{--highcontrast-toast-border-color:ButtonText;border:var(--mod-toast-border-width,var(--spectrum-toast-border-width))solid var(--highcontrast-toast-border-color,transparent)}}:host{box-sizing:border-box;min-block-size:var(--mod-toast-block-size,var(--spectrum-toast-block-size));max-inline-size:var(--mod-toast-max-inline-size,var(--spectrum-toast-max-inline-size));border-radius:var(--mod-toast-corner-radius,var(--spectrum-toast-corner-radius));font-size:var(--mod-toast-font-size,var(--spectrum-toast-font-size));font-weight:var(--mod-toast-font-weight,var(--spectrum-toast-font-weight));-webkit-font-smoothing:antialiased;background-color:var(--highcontrast-toast-background-color-default,var(--mod-toast-background-color-default,var(--spectrum-toast-background-color-default)));color:var(--highcontrast-toast-background-color-default,var(--mod-toast-background-color-default,var(--spectrum-toast-background-color-default)));overflow-wrap:anywhere;flex-direction:row;align-items:stretch;padding-inline-start:var(--mod-toast-spacing-start-edge-to-text-and-icon,var(--spectrum-toast-spacing-start-edge-to-text-and-icon));display:inline-flex}:host([variant=negative]){background-color:var(--highcontrast-toast-negative-background-color-default,var(--mod-toast-negative-background-color-default,var(--spectrum-toast-negative-background-color-default)))}:host([variant=negative]),:host([variant=negative]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-negative-background-color-default,var(--mod-toast-negative-background-color-default,var(--spectrum-toast-negative-background-color-default)))}:host([variant=info]){background-color:var(--highcontrast-toast-informative-background-color-default,var(--mod-toast-informative-background-color-default,var(--spectrum-toast-informative-background-color-default)))}:host([variant=info]),:host([variant=info]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-informative-background-color-default,var(--mod-toast-informative-background-color-default,var(--spectrum-toast-informative-background-color-default)))}:host([variant=positive]){background-color:var(--highcontrast-toast-positive-background-color-default,var(--mod-toast-positive-background-color-default,var(--spectrum-toast-positive-background-color-default)))}:host([variant=positive]),:host([variant=positive]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-positive-background-color-default,var(--mod-toast-positive-background-color-default,var(--spectrum-toast-positive-background-color-default)))}.type{flex-grow:0;flex-shrink:0;margin-block-start:var(--mod-toast-spacing-top-edge-to-icon,var(--spectrum-toast-spacing-top-edge-to-icon));margin-inline-start:0;margin-inline-end:var(--mod-toast-spacing-icon-to-text,var(--spectrum-toast-spacing-icon-to-text))}.content,.type{color:var(--highcontrast-toast-text-and-icon-color,var(--mod-toast-text-and-icon-color,var(--spectrum-toast-text-and-icon-color)))}.content{box-sizing:border-box;line-height:var(--mod-toast-line-height,var(--spectrum-toast-line-height));text-align:start;flex:auto;padding-block-start:calc(var(--mod-toast-spacing-top-edge-to-text,var(--spectrum-toast-spacing-top-edge-to-text)) - var(--mod-toast-spacing-block-start,var(--spectrum-toast-spacing-block-start)));padding-block-end:calc(var(--mod-toast-spacing-bottom-edge-to-text,var(--spectrum-toast-spacing-bottom-edge-to-text)) - var(--mod-toast-spacing-block-end,var(--spectrum-toast-spacing-block-end)));padding-inline-start:0;padding-inline-end:var(--mod-toast-spacing-text-to-action-button-horizontal,var(--spectrum-toast-spacing-text-to-action-button-horizontal));display:inline-block}.content:lang(ja),.content:lang(ko),.content:lang(zh){line-height:var(--mod-toast-line-height-cjk,var(--spectrum-toast-line-height-cjk))}.buttons{border-inline-start-color:var(--mod-toast-divider-color,var(--spectrum-toast-divider-color));flex:none;align-items:flex-start;margin-block-start:var(--mod-toast-spacing-top-edge-to-divider,var(--spectrum-toast-spacing-top-edge-to-divider));margin-block-end:var(--mod-toast-spacing-bottom-edge-to-divider,var(--spectrum-toast-spacing-bottom-edge-to-divider));padding-inline-end:var(--mod-toast-spacing-close-button,var(--spectrum-toast-spacing-close-button));display:flex}.buttons .spectrum-CloseButton{align-self:flex-start}.body{flex-wrap:wrap;flex:auto;align-self:center;align-items:center;padding-block-start:var(--mod-toast-spacing-block-start,var(--spectrum-toast-spacing-block-start));padding-block-end:var(--mod-toast-spacing-block-end,var(--spectrum-toast-spacing-block-end));display:flex}.body ::slotted([slot=action]){margin-inline-start:auto;margin-inline-end:var(--mod-toast-spacing-text-and-action-button-to-divider,var(--spectrum-toast-spacing-text-and-action-button-to-divider))}.body ::slotted([slot=action]:dir(rtl)),:host([dir=rtl]) .body ::slotted([slot=action]){margin-inline-end:var(--mod-toast-spacing-text-and-action-button-to-divider,var(--spectrum-toast-spacing-text-and-action-button-to-divider))}.body+.buttons{border-inline-start-style:solid;border-inline-start-width:1px;padding-inline-start:var(--mod-toast-spacing-close-button,var(--spectrum-toast-spacing-close-button))}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";import{css as t}from"@spectrum-web-components/base";const o=t`
|
|
2
|
+
@media (forced-colors:active){:host{--highcontrast-toast-border-color:ButtonText;border:var(--mod-toast-border-width,var(--spectrum-toast-border-width))solid var(--highcontrast-toast-border-color,transparent)}}:host{box-sizing:border-box;min-block-size:var(--mod-toast-block-size,var(--spectrum-toast-block-size));max-inline-size:var(--mod-toast-max-inline-size,var(--spectrum-toast-max-inline-size));border-radius:var(--mod-toast-corner-radius,var(--spectrum-toast-corner-radius));font-size:var(--mod-toast-font-size,var(--spectrum-toast-font-size));font-weight:var(--mod-toast-font-weight,var(--spectrum-toast-font-weight));-webkit-font-smoothing:antialiased;background-color:var(--highcontrast-toast-background-color-default,var(--mod-toast-background-color-default,var(--spectrum-toast-background-color-default)));color:var(--highcontrast-toast-background-color-default,var(--mod-toast-background-color-default,var(--spectrum-toast-background-color-default)));overflow-wrap:anywhere;flex-direction:row;align-items:stretch;padding-inline-start:var(--mod-toast-spacing-start-edge-to-text-and-icon,var(--spectrum-toast-spacing-start-edge-to-text-and-icon));display:inline-flex}:host([variant=negative]){background-color:var(--highcontrast-toast-negative-background-color-default,var(--mod-toast-negative-background-color-default,var(--spectrum-toast-negative-background-color-default)))}:host([variant=negative]),:host([variant=negative]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-negative-background-color-default,var(--mod-toast-negative-background-color-default,var(--spectrum-toast-negative-background-color-default)))}:host([variant=info]){background-color:var(--highcontrast-toast-informative-background-color-default,var(--mod-toast-informative-background-color-default,var(--spectrum-toast-informative-background-color-default)))}:host([variant=info]),:host([variant=info]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-informative-background-color-default,var(--mod-toast-informative-background-color-default,var(--spectrum-toast-informative-background-color-default)))}:host([variant=positive]){background-color:var(--highcontrast-toast-positive-background-color-default,var(--mod-toast-positive-background-color-default,var(--spectrum-toast-positive-background-color-default)))}:host([variant=positive]),:host([variant=positive]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-positive-background-color-default,var(--mod-toast-positive-background-color-default,var(--spectrum-toast-positive-background-color-default)))}.type{flex-grow:0;flex-shrink:0;margin-block-start:var(--mod-toast-spacing-top-edge-to-icon,var(--spectrum-toast-spacing-top-edge-to-icon));margin-inline-start:0;margin-inline-end:var(--mod-toast-spacing-icon-to-text,var(--spectrum-toast-spacing-icon-to-text))}.content,.type{color:var(--highcontrast-toast-text-and-icon-color,var(--mod-toast-text-and-icon-color,var(--spectrum-toast-text-and-icon-color)))}.content{box-sizing:border-box;line-height:var(--mod-toast-line-height,var(--spectrum-toast-line-height));text-align:start;flex:auto;padding-block-start:calc(var(--mod-toast-spacing-top-edge-to-text,var(--spectrum-toast-spacing-top-edge-to-text)) - var(--mod-toast-spacing-block-start,var(--spectrum-toast-spacing-block-start)));padding-block-end:calc(var(--mod-toast-spacing-bottom-edge-to-text,var(--spectrum-toast-spacing-bottom-edge-to-text)) - var(--mod-toast-spacing-block-end,var(--spectrum-toast-spacing-block-end)));padding-inline-start:0;padding-inline-end:var(--mod-toast-spacing-text-to-action-button-horizontal,var(--spectrum-toast-spacing-text-to-action-button-horizontal));display:inline-block}.content:lang(ja),.content:lang(ko),.content:lang(zh){line-height:var(--mod-toast-line-height-cjk,var(--spectrum-toast-line-height-cjk))}.buttons{border-inline-start-color:var(--mod-toast-divider-color,var(--spectrum-toast-divider-color));flex:none;align-items:flex-start;margin-block-start:var(--mod-toast-spacing-top-edge-to-divider,var(--spectrum-toast-spacing-top-edge-to-divider));margin-block-end:var(--mod-toast-spacing-bottom-edge-to-divider,var(--spectrum-toast-spacing-bottom-edge-to-divider));padding-inline-end:var(--mod-toast-spacing-close-button,var(--spectrum-toast-spacing-close-button));display:flex}.buttons .spectrum-CloseButton{align-self:flex-start}.body{flex-wrap:wrap;flex:auto;align-self:center;align-items:center;padding-block-start:var(--mod-toast-spacing-block-start,var(--spectrum-toast-spacing-block-start));padding-block-end:var(--mod-toast-spacing-block-end,var(--spectrum-toast-spacing-block-end));display:flex}.body ::slotted([slot=action]){margin-inline-start:auto;margin-inline-end:var(--mod-toast-spacing-text-and-action-button-to-divider,var(--spectrum-toast-spacing-text-and-action-button-to-divider))}.body ::slotted([slot=action]:dir(rtl)),:host([dir=rtl]) .body ::slotted([slot=action]){margin-inline-end:var(--mod-toast-spacing-text-and-action-button-to-divider,var(--spectrum-toast-spacing-text-and-action-button-to-divider))}.body+.buttons{border-inline-start-style:solid;border-inline-start-width:1px;padding-inline-start:var(--mod-toast-spacing-close-button,var(--spectrum-toast-spacing-close-button))}
|
|
3
|
+
`;export default o;
|
|
4
|
+
//# sourceMappingURL=spectrum-toast.css.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-toast.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n @media (forced-colors:active){:host{--highcontrast-toast-border-color:ButtonText;border:var(--mod-toast-border-width,var(--spectrum-toast-border-width))solid var(--highcontrast-toast-border-color,transparent)}}:host{box-sizing:border-box;min-block-size:var(--mod-toast-block-size,var(--spectrum-toast-block-size));max-inline-size:var(--mod-toast-max-inline-size,var(--spectrum-toast-max-inline-size));border-radius:var(--mod-toast-corner-radius,var(--spectrum-toast-corner-radius));font-size:var(--mod-toast-font-size,var(--spectrum-toast-font-size));font-weight:var(--mod-toast-font-weight,var(--spectrum-toast-font-weight));-webkit-font-smoothing:antialiased;background-color:var(--highcontrast-toast-background-color-default,var(--mod-toast-background-color-default,var(--spectrum-toast-background-color-default)));color:var(--highcontrast-toast-background-color-default,var(--mod-toast-background-color-default,var(--spectrum-toast-background-color-default)));overflow-wrap:anywhere;flex-direction:row;align-items:stretch;padding-inline-start:var(--mod-toast-spacing-start-edge-to-text-and-icon,var(--spectrum-toast-spacing-start-edge-to-text-and-icon));display:inline-flex}:host([variant=negative]){background-color:var(--highcontrast-toast-negative-background-color-default,var(--mod-toast-negative-background-color-default,var(--spectrum-toast-negative-background-color-default)))}:host([variant=negative]),:host([variant=negative]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-negative-background-color-default,var(--mod-toast-negative-background-color-default,var(--spectrum-toast-negative-background-color-default)))}:host([variant=info]){background-color:var(--highcontrast-toast-informative-background-color-default,var(--mod-toast-informative-background-color-default,var(--spectrum-toast-informative-background-color-default)))}:host([variant=info]),:host([variant=info]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-informative-background-color-default,var(--mod-toast-informative-background-color-default,var(--spectrum-toast-informative-background-color-default)))}:host([variant=positive]){background-color:var(--highcontrast-toast-positive-background-color-default,var(--mod-toast-positive-background-color-default,var(--spectrum-toast-positive-background-color-default)))}:host([variant=positive]),:host([variant=positive]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-positive-background-color-default,var(--mod-toast-positive-background-color-default,var(--spectrum-toast-positive-background-color-default)))}.type{flex-grow:0;flex-shrink:0;margin-block-start:var(--mod-toast-spacing-top-edge-to-icon,var(--spectrum-toast-spacing-top-edge-to-icon));margin-inline-start:0;margin-inline-end:var(--mod-toast-spacing-icon-to-text,var(--spectrum-toast-spacing-icon-to-text))}.content,.type{color:var(--highcontrast-toast-text-and-icon-color,var(--mod-toast-text-and-icon-color,var(--spectrum-toast-text-and-icon-color)))}.content{box-sizing:border-box;line-height:var(--mod-toast-line-height,var(--spectrum-toast-line-height));text-align:start;flex:auto;padding-block-start:calc(var(--mod-toast-spacing-top-edge-to-text,var(--spectrum-toast-spacing-top-edge-to-text)) - var(--mod-toast-spacing-block-start,var(--spectrum-toast-spacing-block-start)));padding-block-end:calc(var(--mod-toast-spacing-bottom-edge-to-text,var(--spectrum-toast-spacing-bottom-edge-to-text)) - var(--mod-toast-spacing-block-end,var(--spectrum-toast-spacing-block-end)));padding-inline-start:0;padding-inline-end:var(--mod-toast-spacing-text-to-action-button-horizontal,var(--spectrum-toast-spacing-text-to-action-button-horizontal));display:inline-block}.content:lang(ja),.content:lang(ko),.content:lang(zh){line-height:var(--mod-toast-line-height-cjk,var(--spectrum-toast-line-height-cjk))}.buttons{border-inline-start-color:var(--mod-toast-divider-color,var(--spectrum-toast-divider-color));flex:none;align-items:flex-start;margin-block-start:var(--mod-toast-spacing-top-edge-to-divider,var(--spectrum-toast-spacing-top-edge-to-divider));margin-block-end:var(--mod-toast-spacing-bottom-edge-to-divider,var(--spectrum-toast-spacing-bottom-edge-to-divider));padding-inline-end:var(--mod-toast-spacing-close-button,var(--spectrum-toast-spacing-close-button));display:flex}.buttons .spectrum-CloseButton{align-self:flex-start}.body{flex-wrap:wrap;flex:auto;align-self:center;align-items:center;padding-block-start:var(--mod-toast-spacing-block-start,var(--spectrum-toast-spacing-block-start));padding-block-end:var(--mod-toast-spacing-block-end,var(--spectrum-toast-spacing-block-end));display:flex}.body ::slotted([slot=action]){margin-inline-start:auto;margin-inline-end:var(--mod-toast-spacing-text-and-action-button-to-divider,var(--spectrum-toast-spacing-text-and-action-button-to-divider))}.body ::slotted([slot=action]:dir(rtl)),:host([dir=rtl]) .body ::slotted([slot=action]){margin-inline-end:var(--mod-toast-spacing-text-and-action-button-to-divider,var(--spectrum-toast-spacing-text-and-action-button-to-divider))}.body+.buttons{border-inline-start-style:solid;border-inline-start-width:1px;padding-inline-start:var(--mod-toast-spacing-close-button,var(--spectrum-toast-spacing-close-button))}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{--spectrum-toast-background-color-default:var(--system-toast-background-color-default);--spectrum-toast-font-weight:var(--system-toast-font-weight);--spectrum-toast-font-size:var(--system-toast-font-size);--spectrum-toast-corner-radius:var(--system-toast-corner-radius);--spectrum-toast-block-size:var(--system-toast-block-size);--spectrum-toast-max-inline-size:var(--system-toast-max-inline-size);--spectrum-toast-border-width:var(--system-toast-border-width);--spectrum-toast-line-height:var(--system-toast-line-height);--spectrum-toast-line-height-cjk:var(--system-toast-line-height-cjk);--spectrum-toast-spacing-icon-to-text:var(--system-toast-spacing-icon-to-text);--spectrum-toast-spacing-start-edge-to-text-and-icon:var(--system-toast-spacing-start-edge-to-text-and-icon);--spectrum-toast-spacing-text-and-action-button-to-divider:var(--system-toast-spacing-text-and-action-button-to-divider);--spectrum-toast-spacing-top-edge-to-divider:var(--system-toast-spacing-top-edge-to-divider);--spectrum-toast-spacing-bottom-edge-to-divider:var(--system-toast-spacing-bottom-edge-to-divider);--spectrum-toast-spacing-top-edge-to-icon:var(--system-toast-spacing-top-edge-to-icon);--spectrum-toast-spacing-text-to-action-button-horizontal:var(--system-toast-spacing-text-to-action-button-horizontal);--spectrum-toast-spacing-close-button:var(--system-toast-spacing-close-button);--spectrum-toast-spacing-block-start:var(--system-toast-spacing-block-start);--spectrum-toast-spacing-block-end:var(--system-toast-spacing-block-end);--spectrum-toast-spacing-top-edge-to-text:var(--system-toast-spacing-top-edge-to-text);--spectrum-toast-spacing-bottom-edge-to-text:var(--system-toast-spacing-bottom-edge-to-text);--spectrum-toast-negative-background-color-default:var(--system-toast-negative-background-color-default);--spectrum-toast-positive-background-color-default:var(--system-toast-positive-background-color-default);--spectrum-toast-informative-background-color-default:var(--system-toast-informative-background-color-default);--spectrum-toast-text-and-icon-color:var(--system-toast-text-and-icon-color);--spectrum-toast-divider-color:var(--system-toast-divider-color)}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=toast-overrides.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["toast-overrides.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-toast-background-color-default:var(--system-toast-background-color-default);--spectrum-toast-font-weight:var(--system-toast-font-weight);--spectrum-toast-font-size:var(--system-toast-font-size);--spectrum-toast-corner-radius:var(--system-toast-corner-radius);--spectrum-toast-block-size:var(--system-toast-block-size);--spectrum-toast-max-inline-size:var(--system-toast-max-inline-size);--spectrum-toast-border-width:var(--system-toast-border-width);--spectrum-toast-line-height:var(--system-toast-line-height);--spectrum-toast-line-height-cjk:var(--system-toast-line-height-cjk);--spectrum-toast-spacing-icon-to-text:var(--system-toast-spacing-icon-to-text);--spectrum-toast-spacing-start-edge-to-text-and-icon:var(--system-toast-spacing-start-edge-to-text-and-icon);--spectrum-toast-spacing-text-and-action-button-to-divider:var(--system-toast-spacing-text-and-action-button-to-divider);--spectrum-toast-spacing-top-edge-to-divider:var(--system-toast-spacing-top-edge-to-divider);--spectrum-toast-spacing-bottom-edge-to-divider:var(--system-toast-spacing-bottom-edge-to-divider);--spectrum-toast-spacing-top-edge-to-icon:var(--system-toast-spacing-top-edge-to-icon);--spectrum-toast-spacing-text-to-action-button-horizontal:var(--system-toast-spacing-text-to-action-button-horizontal);--spectrum-toast-spacing-close-button:var(--system-toast-spacing-close-button);--spectrum-toast-spacing-block-start:var(--system-toast-spacing-block-start);--spectrum-toast-spacing-block-end:var(--system-toast-spacing-block-end);--spectrum-toast-spacing-top-edge-to-text:var(--system-toast-spacing-top-edge-to-text);--spectrum-toast-spacing-bottom-edge-to-text:var(--system-toast-spacing-bottom-edge-to-text);--spectrum-toast-negative-background-color-default:var(--system-toast-negative-background-color-default);--spectrum-toast-positive-background-color-default:var(--system-toast-positive-background-color-default);--spectrum-toast-informative-background-color-default:var(--system-toast-informative-background-color-default);--spectrum-toast-text-and-icon-color:var(--system-toast-text-and-icon-color);--spectrum-toast-divider-color:var(--system-toast-divider-color)}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";import{css as t}from"@spectrum-web-components/base";const s=t`
|
|
2
|
+
:host{--spectrum-toast-background-color-default:var(--system-toast-background-color-default);--spectrum-toast-font-weight:var(--system-toast-font-weight);--spectrum-toast-font-size:var(--system-toast-font-size);--spectrum-toast-corner-radius:var(--system-toast-corner-radius);--spectrum-toast-block-size:var(--system-toast-block-size);--spectrum-toast-max-inline-size:var(--system-toast-max-inline-size);--spectrum-toast-border-width:var(--system-toast-border-width);--spectrum-toast-line-height:var(--system-toast-line-height);--spectrum-toast-line-height-cjk:var(--system-toast-line-height-cjk);--spectrum-toast-spacing-icon-to-text:var(--system-toast-spacing-icon-to-text);--spectrum-toast-spacing-start-edge-to-text-and-icon:var(--system-toast-spacing-start-edge-to-text-and-icon);--spectrum-toast-spacing-text-and-action-button-to-divider:var(--system-toast-spacing-text-and-action-button-to-divider);--spectrum-toast-spacing-top-edge-to-divider:var(--system-toast-spacing-top-edge-to-divider);--spectrum-toast-spacing-bottom-edge-to-divider:var(--system-toast-spacing-bottom-edge-to-divider);--spectrum-toast-spacing-top-edge-to-icon:var(--system-toast-spacing-top-edge-to-icon);--spectrum-toast-spacing-text-to-action-button-horizontal:var(--system-toast-spacing-text-to-action-button-horizontal);--spectrum-toast-spacing-close-button:var(--system-toast-spacing-close-button);--spectrum-toast-spacing-block-start:var(--system-toast-spacing-block-start);--spectrum-toast-spacing-block-end:var(--system-toast-spacing-block-end);--spectrum-toast-spacing-top-edge-to-text:var(--system-toast-spacing-top-edge-to-text);--spectrum-toast-spacing-bottom-edge-to-text:var(--system-toast-spacing-bottom-edge-to-text);--spectrum-toast-negative-background-color-default:var(--system-toast-negative-background-color-default);--spectrum-toast-positive-background-color-default:var(--system-toast-positive-background-color-default);--spectrum-toast-informative-background-color-default:var(--system-toast-informative-background-color-default);--spectrum-toast-text-and-icon-color:var(--system-toast-text-and-icon-color);--spectrum-toast-divider-color:var(--system-toast-divider-color)}
|
|
3
|
+
`;export default s;
|
|
4
|
+
//# sourceMappingURL=toast-overrides.css.js.map
|