@spectrum-web-components/toast 1.0.0 → 1.0.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.
@@ -52,6 +52,15 @@
52
52
  },
53
53
  "privacy": "public",
54
54
  "default": "false",
55
+ "description": "The `open` property indicates whether the toast is visible or hidden.",
56
+ "parameters": [
57
+ {
58
+ "name": "open",
59
+ "type": {
60
+ "text": "Boolean"
61
+ }
62
+ }
63
+ ],
55
64
  "attribute": "open",
56
65
  "reflects": true
57
66
  },
@@ -59,15 +68,16 @@
59
68
  "kind": "field",
60
69
  "name": "timeout",
61
70
  "privacy": "public",
62
- "description": "When a timeout is provided it represents the number of milliseconds from when\nthe Toast was placed on the page before it will automatically dismiss itself.\nAccessibility concerns require that a Toast is available for at least 6000ms\nbefore being dismissed, so any timeout of less than 6000ms will be raised to\nthat baseline. It is suggested that messages longer than 120 words should\nreceive another 1000ms in their timeout for each additional 120 words in the\nmessage. E.G. 240 words = 7000ms, 360 words = 8000ms, etc.",
71
+ "description": "When a timeout is provided, it represents the number of milliseconds from when\nthe Toast was placed on the page before it will automatically dismiss itself.\n\nAccessibility concerns require that a Toast is available for at least 6000ms\nbefore being dismissed, so any timeout of less than 6000ms will be raised to\nthat baseline.\n\nIt is suggested that messages longer than 120 words should receive an additional\n1000ms in their timeout for each additional 120 words in the message.\n\nFor example, a message with 240 words should have a timeout of 7000ms,\nand a message with 360 words should have a timeout of 8000ms.",
63
72
  "parameters": [
64
73
  {
65
74
  "name": "timeout",
66
75
  "type": {
67
- "text": "Number"
76
+ "text": "Number | null"
68
77
  }
69
78
  }
70
79
  ],
80
+ "default": "null",
71
81
  "type": {
72
82
  "text": "number | null"
73
83
  },
@@ -79,14 +89,14 @@
79
89
  "type": {
80
90
  "text": "number | null"
81
91
  },
82
- "privacy": "public",
92
+ "privacy": "private",
83
93
  "default": "null"
84
94
  },
85
95
  {
86
96
  "kind": "field",
87
97
  "name": "variant",
88
98
  "privacy": "public",
89
- "description": "The variant applies specific styling when set to `negative`, `positive`, `info`, `error`, or `warning`.\n`variant` attribute is removed when not matching one of the above.",
99
+ "description": "The variant applies specific styling when set to `negative`, `positive`, `info`, `error`, or `warning`.\n\nThe 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.",
90
100
  "parameters": [
91
101
  {
92
102
  "name": "variant",
@@ -109,6 +119,24 @@
109
119
  "privacy": "private",
110
120
  "default": "''"
111
121
  },
122
+ {
123
+ "kind": "field",
124
+ "name": "iconLabel",
125
+ "type": {
126
+ "text": "string | undefined"
127
+ },
128
+ "privacy": "public",
129
+ "description": "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\nIf the `iconLabel` property is not set, the icon will use the `variant` to dynamically set the `label`.",
130
+ "parameters": [
131
+ {
132
+ "name": "iconLabel",
133
+ "type": {
134
+ "text": "String"
135
+ }
136
+ }
137
+ ],
138
+ "attribute": "icon-label"
139
+ },
112
140
  {
113
141
  "kind": "method",
114
142
  "name": "renderIcon",
@@ -121,6 +149,13 @@
121
149
  "parameters": [
122
150
  {
123
151
  "name": "variant",
152
+ "type": {
153
+ "text": "ToastVariants"
154
+ }
155
+ },
156
+ {
157
+ "name": "iconLabel",
158
+ "optional": true,
124
159
  "type": {
125
160
  "text": "string"
126
161
  }
@@ -222,19 +257,29 @@
222
257
  "text": "boolean"
223
258
  },
224
259
  "default": "false",
260
+ "description": "The `open` property indicates whether the toast is visible or hidden.",
261
+ "parameters": [
262
+ {
263
+ "name": "open",
264
+ "type": {
265
+ "text": "Boolean"
266
+ }
267
+ }
268
+ ],
225
269
  "fieldName": "open"
226
270
  },
227
271
  {
228
272
  "name": "timeout",
229
- "description": "When a timeout is provided it represents the number of milliseconds from when\nthe Toast was placed on the page before it will automatically dismiss itself.\nAccessibility concerns require that a Toast is available for at least 6000ms\nbefore being dismissed, so any timeout of less than 6000ms will be raised to\nthat baseline. It is suggested that messages longer than 120 words should\nreceive another 1000ms in their timeout for each additional 120 words in the\nmessage. E.G. 240 words = 7000ms, 360 words = 8000ms, etc.",
273
+ "description": "When a timeout is provided, it represents the number of milliseconds from when\nthe Toast was placed on the page before it will automatically dismiss itself.\n\nAccessibility concerns require that a Toast is available for at least 6000ms\nbefore being dismissed, so any timeout of less than 6000ms will be raised to\nthat baseline.\n\nIt is suggested that messages longer than 120 words should receive an additional\n1000ms in their timeout for each additional 120 words in the message.\n\nFor example, a message with 240 words should have a timeout of 7000ms,\nand a message with 360 words should have a timeout of 8000ms.",
230
274
  "parameters": [
231
275
  {
232
276
  "name": "timeout",
233
277
  "type": {
234
- "text": "Number"
278
+ "text": "Number | null"
235
279
  }
236
280
  }
237
281
  ],
282
+ "default": "null",
238
283
  "type": {
239
284
  "text": "number | null"
240
285
  },
@@ -242,7 +287,7 @@
242
287
  },
243
288
  {
244
289
  "name": "variant",
245
- "description": "The variant applies specific styling when set to `negative`, `positive`, `info`, `error`, or `warning`.\n`variant` attribute is removed when not matching one of the above.",
290
+ "description": "The variant applies specific styling when set to `negative`, `positive`, `info`, `error`, or `warning`.\n\nThe 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.",
246
291
  "parameters": [
247
292
  {
248
293
  "name": "variant",
@@ -255,6 +300,22 @@
255
300
  "text": "ToastVariants"
256
301
  },
257
302
  "fieldName": "variant"
303
+ },
304
+ {
305
+ "name": "icon-label",
306
+ "type": {
307
+ "text": "string | undefined"
308
+ },
309
+ "description": "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\nIf the `iconLabel` property is not set, the icon will use the `variant` to dynamically set the `label`.",
310
+ "parameters": [
311
+ {
312
+ "name": "iconLabel",
313
+ "type": {
314
+ "text": "String"
315
+ }
316
+ }
317
+ ],
318
+ "fieldName": "iconLabel"
258
319
  }
259
320
  ],
260
321
  "mixins": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/toast",
3
- "version": "1.0.0",
3
+ "version": "1.0.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.0.0",
62
- "@spectrum-web-components/button": "^1.0.0",
63
- "@spectrum-web-components/icon": "^1.0.0",
64
- "@spectrum-web-components/icons-workflow": "^1.0.0",
65
- "@spectrum-web-components/shared": "^1.0.0"
61
+ "@spectrum-web-components/base": "^1.0.2",
62
+ "@spectrum-web-components/button": "^1.0.2",
63
+ "@spectrum-web-components/icon": "^1.0.2",
64
+ "@spectrum-web-components/icons-workflow": "^1.0.2",
65
+ "@spectrum-web-components/shared": "^1.0.2"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@spectrum-css/toast": "^11.0.0-s2-foundations.15"
@@ -72,6 +72,5 @@
72
72
  "sideEffects": [
73
73
  "./sp-*.js",
74
74
  "./**/*.dev.js"
75
- ],
76
- "gitHead": "5cf5d34645bf9494ebd20f64c42d1619523d2d84"
75
+ ]
77
76
  }
package/src/Toast.d.ts CHANGED
@@ -16,23 +16,37 @@ declare const Toast_base: typeof SpectrumElement;
16
16
  */
17
17
  export declare class Toast extends Toast_base {
18
18
  static get styles(): CSSResultArray;
19
+ /**
20
+ * The `open` property indicates whether the toast is visible or hidden.
21
+ *
22
+ * @param {Boolean} open
23
+ */
19
24
  open: boolean;
20
25
  /**
21
- * When a timeout is provided it represents the number of milliseconds from when
26
+ * When a timeout is provided, it represents the number of milliseconds from when
22
27
  * the Toast was placed on the page before it will automatically dismiss itself.
28
+ *
23
29
  * Accessibility concerns require that a Toast is available for at least 6000ms
24
30
  * before being dismissed, so any timeout of less than 6000ms will be raised to
25
- * that baseline. It is suggested that messages longer than 120 words should
26
- * receive another 1000ms in their timeout for each additional 120 words in the
27
- * message. E.G. 240 words = 7000ms, 360 words = 8000ms, etc.
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.
28
38
  *
29
- * @param {Number} timeout
39
+ * @param {Number | null} timeout
40
+ * @default null
30
41
  */
31
42
  set timeout(timeout: number | null);
32
43
  get timeout(): number | null;
33
- _timeout: number | null;
44
+ private _timeout;
34
45
  /**
35
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
+ *
36
50
  * `variant` attribute is removed when not matching one of the above.
37
51
  *
38
52
  * @param {String} variant
@@ -40,6 +54,14 @@ export declare class Toast extends Toast_base {
40
54
  set variant(variant: ToastVariants);
41
55
  get variant(): ToastVariants;
42
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;
43
65
  private renderIcon;
44
66
  private countdownStart;
45
67
  private nextCount;
package/src/Toast.dev.js CHANGED
@@ -92,26 +92,35 @@ export class Toast extends FocusVisiblePolyfillMixin(SpectrumElement) {
92
92
  get variant() {
93
93
  return this._variant;
94
94
  }
95
- renderIcon(variant) {
95
+ //TODO(#4931): Address the deprecated variants or remove the flags
96
+ renderIcon(variant, iconLabel) {
96
97
  switch (variant) {
97
98
  case "info":
98
99
  return html`
99
100
  <sp-icon-info
100
- label="Information"
101
+ label=${iconLabel || "Information"}
101
102
  class="type"
102
103
  ></sp-icon-info>
103
104
  `;
104
105
  case "negative":
105
106
  case "error":
107
+ return html`
108
+ <sp-icon-alert
109
+ label=${iconLabel || "Error"}
110
+ class="type"
111
+ ></sp-icon-alert>
112
+ `;
106
113
  case "warning":
107
114
  return html`
108
- <sp-icon-alert label="Error" class="type"></sp-icon-alert>
115
+ <sp-icon-alert
116
+ label=${iconLabel || "Warning"}
117
+ class="type"
118
+ ></sp-icon-alert>
109
119
  `;
110
120
  case "positive":
111
- case "success":
112
121
  return html`
113
122
  <sp-icon-checkmark-circle
114
- label="Success"
123
+ label=${iconLabel || "Success"}
115
124
  class="type"
116
125
  ></sp-icon-checkmark-circle>
117
126
  `;
@@ -144,7 +153,7 @@ export class Toast extends FocusVisiblePolyfillMixin(SpectrumElement) {
144
153
  }
145
154
  render() {
146
155
  return html`
147
- ${this.renderIcon(this.variant)}
156
+ ${this.renderIcon(this.variant, this.iconLabel)}
148
157
  <div class="body" role="alert">
149
158
  <div class="content">
150
159
  <slot></slot>
@@ -191,4 +200,7 @@ __decorateClass([
191
200
  __decorateClass([
192
201
  property({ type: String })
193
202
  ], Toast.prototype, "variant", 1);
203
+ __decorateClass([
204
+ property({ type: String, attribute: "icon-label" })
205
+ ], Toast.prototype, "iconLabel", 2);
194
206
  //# sourceMappingURL=Toast.dev.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["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*/\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 @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 * 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. It is suggested that messages longer than 120 words should\n * receive another 1000ms in their timeout for each additional 120 words in the\n * message. E.G. 240 words = 7000ms, 360 words = 8000ms, etc.\n *\n * @param {Number} timeout\n */\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 public _timeout: number | null = null;\n\n /**\n * The variant applies specific styling when set to `negative`, `positive`, `info`, `error`, or `warning`.\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 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 private renderIcon(variant: string): TemplateResult {\n switch (variant) {\n case 'info':\n return html`\n <sp-icon-info\n label=\"Information\"\n class=\"type\"\n ></sp-icon-info>\n `;\n case 'negative':\n case 'error': // deprecated\n case 'warning': // deprecated\n return html`\n <sp-icon-alert label=\"Error\" class=\"type\"></sp-icon-alert>\n `;\n case 'positive':\n case 'success': // deprecated\n return html`\n <sp-icon-checkmark-circle\n label=\"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)}\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": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,iCAAiC;AAE1C,OAAO,iBAAiB;AAEjB,aAAM,gBAAiC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAmBO,aAAM,cAAc,0BAA0B,eAAe,EAAE;AAAA,EAA/D;AAAA;AAMH,SAAO,OAAO;AA+Bd,SAAO,WAA0B;AA4BjC,SAAQ,WAA0B;AA8BlC,SAAQ,iBAAiB;AACzB,SAAQ,YAAY;AAEpB,SAAQ,cAAc,CAAC,SAAuB;AAC1C,UAAI,CAAC,KAAK,gBAAgB;AACtB,aAAK,iBAAiB,YAAY,IAAI;AAAA,MAC1C;AACA,UAAI,OAAO,KAAK,iBAAkB,KAAK,UAAqB;AACxD,aAAK,YAAY;AACjB,aAAK,iBAAiB;AAAA,MAC1B,OAAO;AACH,aAAK,UAAU;AAAA,MACnB;AAAA,IACJ;AAEA,SAAQ,YAAY,MAAY;AAC5B,2BAAqB,KAAK,SAAS;AACnC,WAAK,YAAY,sBAAsB,KAAK,WAAW;AAAA,IAC3D;AAEA,SAAQ,gBAAgB,MAAY;AAChC,WAAK,cAAc;AACnB,WAAK,iBAAiB,YAAY,KAAK,eAAe;AAAA,IAC1D;AAEA,SAAQ,kBAAkB,M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obe. 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": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,iCAAiC;AAE1C,OAAO,iBAAiB;AAEjB,aAAM,gBAAiC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAmBO,aAAM,cAAc,0BAA0B,eAAe,EAAE;AAAA,EAA/D;AAAA;AAWH,SAAO,OAAO;AAsCd,SAAQ,WAA0B;AAiClC,SAAQ,WAA0B;AAoDlC,SAAQ,iBAAiB;AACzB,SAAQ,YAAY;AAEpB,SAAQ,cAAc,CAAC,SAAuB;AAC1C,UAAI,CAAC,KAAK,gBAAgB;AACtB,aAAK,iBAAiB,YAAY,IAAI;AAAA,MAC1C;AACA,UAAI,OAAO,KAAK,iBAAkB,KAAK,UAAqB;AACxD,aAAK,YAAY;AACjB,aAAK,iBAAiB;AAAA,MAC1B,OAAO;AACH,aAAK,UAAU;AAAA,MACnB;AAAA,IACJ;AAEA,SAAQ,YAAY,MAAY;AAC5B,2BAAqB,KAAK,SAAS;AACnC,WAAK,YAAY,sBAAsB,KAAK,WAAW;AAAA,IAC3D;AAEA,SAAQ,gBAAgB,MAAY;AAChC,WAAK,cAAc;AACnB,WAAK,iBAAiB,YAAY,KAAK,eAAe;AAAA,IAC1D;AAEA,SAAQ,kBAAkB,MAAY;AAClC,WAAK,oBAAoB,YAAY,KAAK,aAAa;AACvD,WAAK,UAAU;AAAA,IACnB;AAAA;AAAA,EAjKA,WAA2B,SAAyB;AAChD,WAAO,CAAC,WAAW;AAAA,EACvB;AAAA,EA6BA,IAAW,QAAQ,SAAwB;AACvC,UAAM,aAAa,OAAO,YAAY,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
7
7
  }
package/src/Toast.js CHANGED
@@ -1,17 +1,25 @@
1
- "use strict";var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var r=(a,i,t,o)=>{for(var e=o>1?void 0:o?p(i,t):i,s=a.length-1,u;s>=0;s--)(u=a[s])&&(e=(o?u(i,t,e):u(e))||e);return o&&e&&c(i,t,e),e};import{html as n,SpectrumElement as d}from"@spectrum-web-components/base";import{property as l}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 e=typeof t!==null&&t>0?Math.max(6e3,t):null,s=this.timeout;e&&this.countdownStart&&(this.countdownStart=performance.now()),this._timeout=e,this.requestUpdate("timeout",s)}get timeout(){return this._timeout}set variant(t){if(t===this.variant)return;const o=this.variant;toastVariants.includes(t)?(this.setAttribute("variant",t),this._variant=t):(this.removeAttribute("variant"),this._variant=""),this.requestUpdate("variant",o)}get variant(){return this._variant}renderIcon(t){switch(t){case"info":return n`
1
+ "use strict";var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;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
2
  <sp-icon-info
3
- label="Information"
3
+ label=${e||"Information"}
4
4
  class="type"
5
5
  ></sp-icon-info>
6
- `;case"negative":case"error":case"warning":return n`
7
- <sp-icon-alert label="Error" class="type"></sp-icon-alert>
8
- `;case"positive":case"success":return n`
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`
9
17
  <sp-icon-checkmark-circle
10
- label="Success"
18
+ label=${e||"Success"}
11
19
  class="type"
12
20
  ></sp-icon-checkmark-circle>
13
- `;default:return n``}}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 n`
14
- ${this.renderIcon(this.variant)}
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)}
15
23
  <div class="body" role="alert">
16
24
  <div class="content">
17
25
  <slot></slot>
@@ -25,5 +33,5 @@
25
33
  static-color="white"
26
34
  ></sp-close-button>
27
35
  </div>
28
- `}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([l({type:Boolean,reflect:!0})],Toast.prototype,"open",2),r([l({type:Number})],Toast.prototype,"timeout",1),r([l({type:String})],Toast.prototype,"variant",1);
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);
29
37
  //# sourceMappingURL=Toast.js.map
package/src/Toast.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["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*/\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 @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 * 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. It is suggested that messages longer than 120 words should\n * receive another 1000ms in their timeout for each additional 120 words in the\n * message. E.G. 240 words = 7000ms, 360 words = 8000ms, etc.\n *\n * @param {Number} timeout\n */\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 public _timeout: number | null = null;\n\n /**\n * The variant applies specific styling when set to `negative`, `positive`, `info`, `error`, or `warning`.\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 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 private renderIcon(variant: string): TemplateResult {\n switch (variant) {\n case 'info':\n return html`\n <sp-icon-info\n label=\"Information\"\n class=\"type\"\n ></sp-icon-info>\n `;\n case 'negative':\n case 'error': // deprecated\n case 'warning': // deprecated\n return html`\n <sp-icon-alert label=\"Error\" class=\"type\"></sp-icon-alert>\n `;\n case 'positive':\n case 'success': // deprecated\n return html`\n <sp-icon-checkmark-circle\n label=\"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)}\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,OAA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M,MAAO,CAAC,GA7CjB,MA8CE",
6
- "names": ["html", "SpectrumElement", "property", "FocusVisiblePolyfillMixin", "toastStyles", "time", "timeout", "newTimeout", "oldValue", "variant", "changes", "__decorateClass"]
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,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CACxC,OAAOA;AAAA,cACD,KAAK,WAAW,KAAK,QAAS,KAAK,SAAS,CAAC;AAAA;AAAA;AAAA;AAAA;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
7
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  import { css } from "@spectrum-web-components/base";
3
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))}: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)}:host{--spectrum-overlay-animation-distance:var(--spectrum-spacing-100);--spectrum-overlay-animation-duration:var(--spectrum-animation-duration-100);opacity:0;pointer-events:none;transition:transform var(--spectrum-overlay-animation-duration)ease-in-out,opacity var(--spectrum-overlay-animation-duration)ease-in-out,visibility 0s linear var(--spectrum-overlay-animation-duration);visibility:hidden}:host([open]){opacity:1;pointer-events:auto;visibility:visible;transition-delay:0s}
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))}: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)}:host{--spectrum-overlay-animation-distance:var(--spectrum-spacing-100);--spectrum-overlay-animation-duration:var(--spectrum-animation-duration-100);opacity:0;pointer-events:none;transition:transform var(--spectrum-overlay-animation-duration)ease-in-out,opacity var(--spectrum-overlay-animation-duration)ease-in-out,visibility 0s linear var(--spectrum-overlay-animation-duration);visibility:hidden}:host([open]){opacity:1;pointer-events:auto;visibility:visible;transition-delay:0s}:host([variant=error]),:host([variant=warning]){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),:host([variant=warning]),:host([variant=warning]) .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)))}
5
5
  `;
6
6
  export default styles;
7
7
  //# sourceMappingURL=toast.css.dev.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["toast.css.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*/\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))}: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)}:host{--spectrum-overlay-animation-distance:var(--spectrum-spacing-100);--spectrum-overlay-animation-duration:var(--spectrum-animation-duration-100);opacity:0;pointer-events:none;transition:transform var(--spectrum-overlay-animation-duration)ease-in-out,opacity var(--spectrum-overlay-animation-duration)ease-in-out,visibility 0s linear var(--spectrum-overlay-animation-duration);visibility:hidden}:host([open]){opacity:1;pointer-events:auto;visibility:visible;transition-delay:0s}\n`;\nexport default styles;"],
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*/\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))}: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)}:host{--spectrum-overlay-animation-distance:var(--spectrum-spacing-100);--spectrum-overlay-animation-duration:var(--spectrum-animation-duration-100);opacity:0;pointer-events:none;transition:transform var(--spectrum-overlay-animation-duration)ease-in-out,opacity var(--spectrum-overlay-animation-duration)ease-in-out,visibility 0s linear var(--spectrum-overlay-animation-duration);visibility:hidden}:host([open]){opacity:1;pointer-events:auto;visibility:visible;transition-delay:0s}:host([variant=error]),:host([variant=warning]){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),:host([variant=warning]),:host([variant=warning]) .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)))}\n`;\nexport default styles;"],
5
5
  "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
6
6
  "names": []
7
7
  }