@aurodesignsystem-dev/auro-toast 0.0.0-pr102.1 → 0.0.0-pr106.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -77
- package/demo/api.html +2 -2
- package/demo/api.js +12 -4
- package/demo/api.md +216 -113
- package/demo/api.min.js +64 -3
- package/demo/{auro-toaster.min.js → basic.min.js} +55 -20
- package/demo/index.html +2 -2
- package/demo/index.js +1 -8
- package/demo/index.md +22 -266
- package/demo/index.min.js +3 -104
- package/dist/{auro-toaster-iuKVlBCD.js → auro-toaster-Ce-Gohhk.js} +2 -2
- package/dist/index.d.ts +201 -111
- package/dist/index.js +1 -1
- package/dist/registered.js +1 -1
- package/package.json +17 -10
package/demo/api.min.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
import { A as AuroToast, a as AuroToaster } from './
|
|
1
|
+
import { A as AuroToast, a as AuroToaster, i as initBasicExample } from './basic.min.js';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
4
|
+
|
|
5
|
+
function initDisableAutoHideExample() {
|
|
6
|
+
const btn = document.querySelector("#disableHideToastBtn");
|
|
7
|
+
const toast = document.querySelector("#disableHideToast");
|
|
8
|
+
|
|
9
|
+
btn.addEventListener("click", () => {
|
|
10
|
+
if (!toast.hasAttribute("visible")) {
|
|
11
|
+
toast.setAttribute("visible", true);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
2
15
|
|
|
3
16
|
/* eslint-disable jsdoc/require-jsdoc */
|
|
4
17
|
|
|
@@ -59,6 +72,19 @@ function initVariantToastsExample() {
|
|
|
59
72
|
|
|
60
73
|
/* eslint-disable jsdoc/require-jsdoc */
|
|
61
74
|
|
|
75
|
+
function initCustomToastExample() {
|
|
76
|
+
const btn = document.querySelector("#customizedToastBtn");
|
|
77
|
+
const toast = document.querySelector("#customizedToast");
|
|
78
|
+
|
|
79
|
+
btn.addEventListener("click", () => {
|
|
80
|
+
if (!toast.hasAttribute("visible")) {
|
|
81
|
+
toast.setAttribute("visible", true);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
87
|
+
|
|
62
88
|
function initVisibleExample() {
|
|
63
89
|
const btn = document.querySelector("#visibleToastBtn");
|
|
64
90
|
const toast = document.querySelector("#visibleToast");
|
|
@@ -70,6 +96,37 @@ function initVisibleExample() {
|
|
|
70
96
|
});
|
|
71
97
|
}
|
|
72
98
|
|
|
99
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
100
|
+
|
|
101
|
+
function initMultipleToastsExample() {
|
|
102
|
+
const btn = document.querySelector("#multiToastBtn-default");
|
|
103
|
+
const toast = document.querySelector("#multiToast-default");
|
|
104
|
+
|
|
105
|
+
btn.addEventListener("click", () => {
|
|
106
|
+
if (!toast.hasAttribute("visible")) {
|
|
107
|
+
toast.setAttribute("visible", true);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const btnTwo = document.querySelector("#multiToastBtn-error");
|
|
112
|
+
const toastTwo = document.querySelector("#multiToast-error");
|
|
113
|
+
|
|
114
|
+
btnTwo.addEventListener("click", () => {
|
|
115
|
+
if (!toastTwo.hasAttribute("visible")) {
|
|
116
|
+
toastTwo.setAttribute("visible", true);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const btnThree = document.querySelector("#multiToastBtn-success");
|
|
121
|
+
const toastThree = document.querySelector("#multiToast-success");
|
|
122
|
+
|
|
123
|
+
btnThree.addEventListener("click", () => {
|
|
124
|
+
if (!toastThree.hasAttribute("visible")) {
|
|
125
|
+
toastThree.setAttribute("visible", true);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
73
130
|
AuroToast.register();
|
|
74
131
|
AuroToaster.register();
|
|
75
132
|
|
|
@@ -81,10 +138,14 @@ function initExamples(initCount) {
|
|
|
81
138
|
|
|
82
139
|
try {
|
|
83
140
|
// javascript example function calls to be added here upon creation to test examples
|
|
84
|
-
|
|
85
|
-
|
|
141
|
+
initBasicExample();
|
|
142
|
+
initDisableAutoHideExample();
|
|
86
143
|
initNoIconExample();
|
|
87
144
|
initTimeTilHideExample();
|
|
145
|
+
initVariantToastsExample();
|
|
146
|
+
initCustomToastExample();
|
|
147
|
+
initVisibleExample();
|
|
148
|
+
initMultipleToastsExample();
|
|
88
149
|
} catch (_err) {
|
|
89
150
|
if (initCount <= 20) {
|
|
90
151
|
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
@@ -230,7 +230,7 @@ class l{generateElementName(t,e){let o=t;return o+="-",o+=e.replace(/[.]/g,"_"),
|
|
|
230
230
|
</${this._renderTag}>
|
|
231
231
|
`}renderLayout(){return this.renderLayoutDefault()}}
|
|
232
232
|
|
|
233
|
-
class p{registerComponent(t,a){customElements.get(t)||customElements.define(t,class extends a{});}closestElement(t,a=this,e=(a,s=a&&a.closest(t))=>a&&a!==document&&a!==window?s||e(a.getRootNode().host):null){return e(a)}handleComponentTagRename(t,a){const e=a.toLowerCase();t.tagName.toLowerCase()!==e&&t.setAttribute(e,true);}elementMatch(t,a){const e=a.toLowerCase();return t.tagName.toLowerCase()===e||t.hasAttribute(e)}}var u='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-labelledby="error__desc" class="ico_squareLarge" data-deprecated="true" role="img" style="min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor" viewBox="0 0 24 24" part="svg"><title/><desc id="error__desc">Error alert indicator.</desc><path d="m13.047 5.599 6.786 11.586A1.207 1.207 0 0 1 18.786 19H5.214a1.207 1.207 0 0 1-1.047-1.815l6.786-11.586a1.214 1.214 0 0 1 2.094 0m-1.165.87a.23.23 0 0 0-.085.085L5.419 17.442a.232.232 0 0 0 .203.35h12.756a.234.234 0 0 0 .203-.35L12.203 6.554a.236.236 0 0 0-.321-.084M12 15.5a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5m-.024-6.22c.325 0 .589.261.589.583v4.434a.586.586 0 0 1-.589.583.586.586 0 0 1-.588-.583V9.863c0-.322.264-.583.588-.583"/></svg>';class m extends i$2{static get properties(){return {hidden:{type:Boolean,reflect:true},hiddenVisually:{type:Boolean,reflect:true},hiddenAudible:{type:Boolean,reflect:true}}}hideAudible(t){return t?"true":"false"}}const g=new Map,f=(t,a={})=>{const e=a.responseParser||(t=>t.text());return g.has(t)||g.set(t,fetch(t).then(e)),g.get(t)};var w=i$5`:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px,1px,1px,1px);width:1px;height:1px;padding:0;border:0}.ico_squareLarge{fill:currentColor;height:var(--auro-size-lg, var(--ds-size-300, 1.5rem))}.ico_squareSmall{fill:currentColor;height:.6rem}.ico_squareMed{fill:currentColor;height:var(--auro-size-md, var(--ds-size-200, 1rem))}.ico_squareSml{fill:currentColor;height:var(--auro-size-sm, var(--ds-size-150, .75rem))}:host{color:currentColor;vertical-align:middle;
|
|
233
|
+
class p{registerComponent(t,a){customElements.get(t)||customElements.define(t,class extends a{});}closestElement(t,a=this,e=(a,s=a&&a.closest(t))=>a&&a!==document&&a!==window?s||e(a.getRootNode().host):null){return e(a)}handleComponentTagRename(t,a){const e=a.toLowerCase();t.tagName.toLowerCase()!==e&&t.setAttribute(e,true);}elementMatch(t,a){const e=a.toLowerCase();return t.tagName.toLowerCase()===e||t.hasAttribute(e)}}var u='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-labelledby="error__desc" class="ico_squareLarge" data-deprecated="true" role="img" style="min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor" viewBox="0 0 24 24" part="svg"><title/><desc id="error__desc">Error alert indicator.</desc><path d="m13.047 5.599 6.786 11.586A1.207 1.207 0 0 1 18.786 19H5.214a1.207 1.207 0 0 1-1.047-1.815l6.786-11.586a1.214 1.214 0 0 1 2.094 0m-1.165.87a.23.23 0 0 0-.085.085L5.419 17.442a.232.232 0 0 0 .203.35h12.756a.234.234 0 0 0 .203-.35L12.203 6.554a.236.236 0 0 0-.321-.084M12 15.5a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5m-.024-6.22c.325 0 .589.261.589.583v4.434a.586.586 0 0 1-.589.583.586.586 0 0 1-.588-.583V9.863c0-.322.264-.583.588-.583"/></svg>';class m extends i$2{static get properties(){return {hidden:{type:Boolean,reflect:true},hiddenVisually:{type:Boolean,reflect:true},hiddenAudible:{type:Boolean,reflect:true}}}hideAudible(t){return t?"true":"false"}}const g=new Map,f=(t,a={})=>{const e=a.responseParser||(t=>t.text());return g.has(t)||g.set(t,fetch(t).then(e)),g.get(t)};var w=i$5`:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px,1px,1px,1px);width:1px;height:1px;padding:0;border:0}.ico_squareLarge{fill:currentColor;height:var(--auro-size-lg, var(--ds-size-300, 1.5rem))}.ico_squareSmall{fill:currentColor;height:.6rem}.ico_squareMed{fill:currentColor;height:var(--auro-size-md, var(--ds-size-200, 1rem))}.ico_squareSml{fill:currentColor;height:var(--auro-size-sm, var(--ds-size-150, .75rem))}:host{color:currentColor;vertical-align:middle;display:inline-block}svg{min-width:var(--ds-auro-icon-size, 1.5rem)!important;width:var(--ds-auro-icon-size, 1.5rem)!important;height:var(--ds-auro-icon-size, 1.5rem)!important}.componentWrapper{display:flex;line-height:var(--ds-auro-icon-size)}.svgWrapper{height:var(--ds-auro-icon-size);width:var(--ds-auro-icon-size)}.svgWrapper [part=svg]{display:flex}.labelWrapper{margin-left:var(--ds-size-50, .25rem)}.labelWrapper ::slotted(*){line-height:inherit!important}
|
|
234
234
|
`;class z extends m{constructor(){super(),this.onDark=false,this.appearance="default";}static get properties(){return {...m.properties,onDark:{type:Boolean,reflect:true},appearance:{type:String,reflect:true},svg:{attribute:false,reflect:true}}}static get styles(){return w}async fetchIcon(t,a){let e="";e="logos"===t?await f(`${this.uri}/${t}/${a}.svg`):await f(`${this.uri}/icons/${t}/${a}.svg`);return (new DOMParser).parseFromString(e,"text/html").body.querySelector("svg")}async firstUpdated(){try{if(!this.customSvg){const t=await this.fetchIcon(this.category,this.name);if(t)this.svg=t;else if(!t){const t=(new DOMParser).parseFromString(u,"text/html");this.svg=t.body.firstChild;}}}catch(t){this.svg=void 0;}}}i$5`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px,1px,1px,1px);width:1px;height:1px;padding:0;border:0}:host{display:inline-block;--ds-auro-icon-size: 100%;width:100%;height:100%}:host .logo{color:var(--ds-auro-alaska-color)}:host([onDark]),:host([appearance=inverse]){--ds-auro-alaska-color: #FFF}
|
|
235
235
|
`;var y=i$5`:host{--ds-auro-icon-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-alaska-color: #02426D;--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}
|
|
236
236
|
`;var k=i$5`:host{color:var(--ds-auro-icon-color)}:host([customColor]){color:inherit}:host(:not([onDark])[variant=accent1]),:host(:not([appearance=inverse])[variant=accent1]){--ds-auro-icon-color: var(--ds-basic-color-texticon-accent1, #265688)}:host(:not([onDark])[variant=disabled]),:host(:not([appearance=inverse])[variant=disabled]){--ds-auro-icon-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:not([onDark])[variant=muted]),:host(:not([appearance=inverse])[variant=muted]){--ds-auro-icon-color: var(--ds-basic-color-texticon-muted, #676767)}:host(:not([onDark])[variant=statusDefault]),:host(:not([appearance=inverse])[variant=statusDefault]){--ds-auro-icon-color: var(--ds-basic-color-status-default, #afb9c6)}:host(:not([onDark])[variant=statusInfo]),:host(:not([appearance=inverse])[variant=statusInfo]){--ds-auro-icon-color: var(--ds-basic-color-status-info, #01426a)}:host(:not([onDark])[variant=statusSuccess]),:host(:not([appearance=inverse])[variant=statusSuccess]){--ds-auro-icon-color: var(--ds-basic-color-status-success, #447a1f)}:host(:not([onDark])[variant=statusWarning]),:host(:not([appearance=inverse])[variant=statusWarning]){--ds-auro-icon-color: var(--ds-basic-color-status-warning, #fac200)}:host(:not([onDark])[variant=statusError]),:host(:not([appearance=inverse])[variant=statusError]){--ds-auro-icon-color: var(--ds-basic-color-status-error, #e31f26)}:host(:not([onDark])[variant=statusInfoSubtle]),:host(:not([appearance=inverse])[variant=statusInfoSubtle]){--ds-auro-icon-color: var(--ds-basic-color-status-info-subtle, #ebf3f9)}:host(:not([onDark])[variant=statusSuccessSubtle]),:host(:not([appearance=inverse])[variant=statusSuccessSubtle]){--ds-auro-icon-color: var(--ds-basic-color-status-success-subtle, #d6eac7)}:host(:not([onDark])[variant=statusWarningSubtle]),:host(:not([appearance=inverse])[variant=statusWarningSubtle]){--ds-auro-icon-color: var(--ds-basic-color-status-warning-subtle, #fff0b2)}:host(:not([onDark])[variant=statusErrorSubtle]),:host(:not([appearance=inverse])[variant=statusErrorSubtle]){--ds-auro-icon-color: var(--ds-basic-color-status-error-subtle, #fbc6c6)}:host(:not([onDark])[variant=fareBasicEconomy]),:host(:not([appearance=inverse])[variant=fareBasicEconomy]){--ds-auro-icon-color: var(--ds-basic-color-fare-basiceconomy, #97eaf8)}:host(:not([onDark])[variant=fareBusiness]),:host(:not([appearance=inverse])[variant=fareBusiness]){--ds-auro-icon-color: var(--ds-basic-color-fare-business, #01426a)}:host(:not([onDark])[variant=fareEconomy]),:host(:not([appearance=inverse])[variant=fareEconomy]){--ds-auro-icon-color: var(--ds-basic-color-fare-economy, #0074ca)}:host(:not([onDark])[variant=fareFirst]),:host(:not([appearance=inverse])[variant=fareFirst]){--ds-auro-icon-color: var(--ds-basic-color-fare-first, #00274a)}:host(:not([onDark])[variant=farePremiumEconomy]),:host(:not([appearance=inverse])[variant=farePremiumEconomy]){--ds-auro-icon-color: var(--ds-basic-color-fare-premiumeconomy, #005154)}:host(:not([onDark])[variant=tierOneWorldEmerald]),:host(:not([appearance=inverse])[variant=tierOneWorldEmerald]){--ds-auro-icon-color: var(--ds-basic-color-tier-program-oneworld-emerald, #139142)}:host(:not([onDark])[variant=tierOneWorldSapphire]),:host(:not([appearance=inverse])[variant=tierOneWorldSapphire]){--ds-auro-icon-color: var(--ds-basic-color-tier-program-oneworld-sapphire, #015daa)}:host(:not([onDark])[variant=tierOneWorldRuby]),:host(:not([appearance=inverse])[variant=tierOneWorldRuby]){--ds-auro-icon-color: var(--ds-basic-color-tier-program-oneworld-ruby, #a41d4a)}:host([onDark]),:host([appearance=inverse]){--ds-auro-icon-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][variant=disabled]),:host([appearance=inverse][variant=disabled]){--ds-auro-icon-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([onDark][variant=muted]),:host([appearance=inverse][variant=muted]){--ds-auro-icon-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][variant=statusError]),:host([appearance=inverse][variant=statusError]){--ds-auro-icon-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}
|
|
@@ -262,9 +262,9 @@ var successIcon = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=
|
|
|
262
262
|
|
|
263
263
|
var closeIcon = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"x-lg__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"x-lg__desc\">a large x</desc><path fill-rule=\"evenodd\" d=\"M16.51 17.26q-.255 0-.45-.15l-.09-.08-3.96-3.96-3.98 3.98-.1.08a.76.76 0 0 1-.43.14.75.75 0 0 1-.6-1.2l.08-.09 3.96-3.96-3.98-3.98-.08-.1a.746.746 0 0 1 .61-1.18q.255 0 .45.15l.1.08L12 10.95l3.98-3.98.1-.08a.76.76 0 0 1 .43-.14.75.75 0 0 1 .6 1.2l-.08.1-3.96 3.96 3.98 3.98.08.1a.746.746 0 0 1-.61 1.18z\" clip-rule=\"evenodd\"/></svg>"};
|
|
264
264
|
|
|
265
|
-
var buttonVersion = '12.
|
|
265
|
+
var buttonVersion = '12.3.0';
|
|
266
266
|
|
|
267
|
-
var iconVersion = '9.1.
|
|
267
|
+
var iconVersion = '9.1.1';
|
|
268
268
|
|
|
269
269
|
var colorCss = i$5`:host([visible]){background-color:var(--ds-auro-toast-container-color);color:var(--ds-auro-toast-text-color)}:host([visible]) .typeIcon{color:var(--ds-auro-toast-icon-color)}:host([visible]) .closeButton:hover{background-color:var(--ds-auro-toast-close-button-hover-container-color)}:host([variant=error]){--ds-auro-toast-container-color: var(--ds-basic-color-status-error-subtle, #fbc6c6);--ds-auro-toast-icon-color: var(--ds-basic-color-status-error, #e31f26);--ds-auro-toast-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}:host([variant=success]){--ds-auro-toast-container-color: var(--ds-basic-color-status-success-subtle, #d6eac7);--ds-auro-toast-icon-color: var(--ds-basic-color-status-success, #447a1f);--ds-auro-toast-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}
|
|
270
270
|
`;
|
|
@@ -284,13 +284,9 @@ const FADE_OUT_DURATION = 300;
|
|
|
284
284
|
|
|
285
285
|
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
286
286
|
/**
|
|
287
|
-
* The auro-toast element provides users a way to display short, temporary messages.
|
|
287
|
+
* The `auro-toast` element provides users a way to display short, temporary messages.
|
|
288
|
+
* @customElement auro-toast
|
|
288
289
|
*
|
|
289
|
-
* @attr {Boolean} visible - Sets state of toast to visible
|
|
290
|
-
* @attr {String} variant - Component will render visually based on which variant value is set; currently supports `error`, `success`, `custom`
|
|
291
|
-
* @attr {Boolean} noIcon - Removes icon from the toast UI
|
|
292
|
-
* @attr {Boolean} disableAutoHide - Prevents the toast from auto-hiding on the default time.
|
|
293
|
-
* @attr {Number} timeTilHide - Sets the time in milliseconds until the toast hides.
|
|
294
290
|
* @csspart type-icon - Apply css to the toast type icon
|
|
295
291
|
* @csspart close-button - Apply css to the toast close button
|
|
296
292
|
* @fires onToastClose - Notifies that the toast has been closed
|
|
@@ -301,6 +297,10 @@ class AuroToast extends i$2 {
|
|
|
301
297
|
constructor() {
|
|
302
298
|
super();
|
|
303
299
|
|
|
300
|
+
this._initializeDefaults();
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
_initializeDefaults() {
|
|
304
304
|
/**
|
|
305
305
|
* @private
|
|
306
306
|
*/
|
|
@@ -382,25 +382,47 @@ class AuroToast extends i$2 {
|
|
|
382
382
|
static get properties() {
|
|
383
383
|
return {
|
|
384
384
|
...i$2.properties,
|
|
385
|
-
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Prevents the toast from auto-hiding on the default time.
|
|
388
|
+
*/
|
|
389
|
+
disableAutoHide: {
|
|
386
390
|
type: Boolean,
|
|
387
391
|
reflect: true,
|
|
388
392
|
},
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Removes icon from the toast UI.
|
|
396
|
+
*/
|
|
393
397
|
noIcon: {
|
|
394
398
|
type: Boolean,
|
|
395
|
-
},
|
|
396
|
-
disableAutoHide: {
|
|
397
|
-
type: Boolean,
|
|
398
399
|
reflect: true,
|
|
399
400
|
},
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Sets the time in milliseconds until the toast hides.
|
|
404
|
+
*/
|
|
400
405
|
timeTilHide: {
|
|
401
406
|
type: Number,
|
|
402
407
|
reflect: true,
|
|
403
408
|
},
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Component will render visually based on which variant value is set.
|
|
412
|
+
* @type {'error' | 'success' | 'custom'}
|
|
413
|
+
*/
|
|
414
|
+
variant: {
|
|
415
|
+
type: String,
|
|
416
|
+
reflect: true,
|
|
417
|
+
},
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Sets state of toast to visible
|
|
421
|
+
*/
|
|
422
|
+
visible: {
|
|
423
|
+
type: Boolean,
|
|
424
|
+
reflect: true,
|
|
425
|
+
}
|
|
404
426
|
};
|
|
405
427
|
}
|
|
406
428
|
|
|
@@ -410,7 +432,7 @@ class AuroToast extends i$2 {
|
|
|
410
432
|
|
|
411
433
|
/**
|
|
412
434
|
* This will register this element with the browser.
|
|
413
|
-
* @param {string} [name="auro-toast"] - The name of element that you want to register
|
|
435
|
+
* @param {string} [name="auro-toast"] - The name of the element that you want to register.
|
|
414
436
|
*
|
|
415
437
|
* @example
|
|
416
438
|
* AuroToast.register("custom-toast") // this will register this element to <custom-toast/>
|
|
@@ -597,7 +619,7 @@ class AuroToaster extends i$2 {
|
|
|
597
619
|
|
|
598
620
|
/**
|
|
599
621
|
* This will register this element with the browser.
|
|
600
|
-
* @param {string} [name="auro-toaster"] - The name of element that you want to register
|
|
622
|
+
* @param {string} [name="auro-toaster"] - The name of the element that you want to register.
|
|
601
623
|
*
|
|
602
624
|
* @example
|
|
603
625
|
* AuroToaster.register("custom-toast") // this will register this element to <custom-toast/>
|
|
@@ -612,4 +634,17 @@ class AuroToaster extends i$2 {
|
|
|
612
634
|
}
|
|
613
635
|
}
|
|
614
636
|
|
|
615
|
-
|
|
637
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
638
|
+
|
|
639
|
+
function initBasicExample() {
|
|
640
|
+
const btn = document.querySelector("#basicToastBtn");
|
|
641
|
+
const toast = document.querySelector("#basicToast");
|
|
642
|
+
|
|
643
|
+
btn.addEventListener("click", () => {
|
|
644
|
+
if (!toast.hasAttribute("visible")) {
|
|
645
|
+
toast.setAttribute("visible", true);
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
export { AuroToast as A, AuroToaster as a, initBasicExample as i };
|
package/demo/index.html
CHANGED
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
</script>
|
|
51
51
|
|
|
52
52
|
<!-- If additional elements are needed for the demo, add them here. -->
|
|
53
|
-
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-accordion@latest
|
|
54
|
-
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-button@latest
|
|
53
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-accordion@latest/+esm" type="module"></script>
|
|
54
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-button@latest/+esm" type="module"></script>
|
|
55
55
|
|
|
56
56
|
<script type="module" data-demo-script="true">
|
|
57
57
|
import { initExamples } from "./index.min.js"
|
package/demo/index.js
CHANGED
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
import { AuroToast, AuroToaster } from "../src/index";
|
|
4
4
|
|
|
5
5
|
import { initBasicExample } from "../apiExamples/basic";
|
|
6
|
-
import { initCustomExample } from "../apiExamples/
|
|
7
|
-
import { initErrorExample } from "../apiExamples/error";
|
|
8
|
-
import { initMultipleToastsExample } from "../apiExamples/multipleToasts";
|
|
9
|
-
import { initSuccessExample } from "../apiExamples/success";
|
|
10
|
-
|
|
6
|
+
import { initCustomExample } from "../apiExamples/custom";
|
|
11
7
|
|
|
12
8
|
AuroToast.register(); // registering to `auro-toast`
|
|
13
9
|
AuroToaster.register(); // registering to `auro-toaster`
|
|
@@ -21,9 +17,6 @@ export function initExamples(initCount) {
|
|
|
21
17
|
// javascript example function calls to be added here upon creation to test examples
|
|
22
18
|
initBasicExample();
|
|
23
19
|
initCustomExample();
|
|
24
|
-
initErrorExample();
|
|
25
|
-
initSuccessExample();
|
|
26
|
-
initMultipleToastsExample();
|
|
27
20
|
} catch (_err) {
|
|
28
21
|
if (initCount <= 20) {
|
|
29
22
|
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
package/demo/index.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
THIS PAGE'S CONTENT SHOULD BE KEPT MINIMAL.
|
|
3
|
+
ONLY ADD EXAMPLES THAT ARE TRULY NECESSARY FOR THE INDEX PAGE — THE BASIC EXAMPLE IS USUALLY ENOUGH.
|
|
4
|
+
ALL OTHER EXAMPLES SHOULD GO IN THE API DOCUMENTATION.
|
|
5
5
|
-->
|
|
6
6
|
|
|
7
|
-
# Toast
|
|
8
|
-
|
|
7
|
+
# Toast
|
|
8
|
+
|
|
9
9
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/description.md) -->
|
|
10
10
|
<!-- The below content is automatically added from ./../docs/partials/description.md -->
|
|
11
11
|
The `<auro-toast>` element is a [HTML custom element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) for the purpose of sending an unobtrusive toast (or push) notification to your visitors.
|
|
@@ -13,8 +13,8 @@ The `<auro-toast>` element is a [HTML custom element](https://developer.mozilla.
|
|
|
13
13
|
The `<auro-toaster>` wrapper-element is a [HTML custom element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) for the purpose of managing a series of notifications at the bottom of the screen using the `<auro-toast>` element.
|
|
14
14
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
15
15
|
|
|
16
|
-
##
|
|
17
|
-
|
|
16
|
+
## Use Cases
|
|
17
|
+
|
|
18
18
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/useCases.md) -->
|
|
19
19
|
<!-- The below content is automatically added from ./../docs/partials/useCases.md -->
|
|
20
20
|
The `<auro-toast>` use cases include:
|
|
@@ -24,7 +24,7 @@ The `<auro-toast>` use cases include:
|
|
|
24
24
|
* Sending any type of push notification
|
|
25
25
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## The setup
|
|
28
28
|
Triggering the toasts relies on setting the `visible` property to `true`. See the following example to see how this code is used in an example.
|
|
29
29
|
|
|
30
30
|
```js
|
|
@@ -37,277 +37,33 @@ showToast = (toastID) => {
|
|
|
37
37
|
};
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
##
|
|
41
|
-
|
|
42
|
-
The following demo illustrates the `default` notification using the `<auro-toast>` element. This push notification will automatically dismiss after five seconds. The user may also dismiss it manually. The toast is **NOT** removed from the DOM. The visible property is set to `false`, which will hide the toast on the UI.
|
|
43
|
-
|
|
44
|
-
Also notice in this demo the use of the `noIcon` attribute. this attribute removes the use of the default `information` icon.
|
|
40
|
+
## Example(s)
|
|
45
41
|
|
|
42
|
+
### Basic
|
|
43
|
+
|
|
46
44
|
<div class="exampleWrapper">
|
|
47
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/basic.html) -->
|
|
48
|
-
<!-- The below content is automatically added from ./../apiExamples/basic.html -->
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<auro-button id="basicToast-noIconBtn">
|
|
58
|
-
Show default notification with no icon
|
|
59
|
-
</auro-button>
|
|
60
|
-
<auro-toast style="display: block; margin: 0.5rem 0;" id="basicToast-noIcon" noIcon>
|
|
61
|
-
Default notification with no error type
|
|
62
|
-
</auro-toast>
|
|
63
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
64
|
-
</div>
|
|
45
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/basic.html) -->
|
|
46
|
+
<!-- The below content is automatically added from ./../apiExamples/basic.html -->
|
|
47
|
+
<auro-button id="basicToastBtn">
|
|
48
|
+
Show default notification
|
|
49
|
+
</auro-button>
|
|
50
|
+
<auro-toast style="display: block; margin: 0.5rem 0;" id="basicToast">
|
|
51
|
+
Default notification with no error type
|
|
52
|
+
</auro-toast>
|
|
53
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
54
|
+
</div>
|
|
65
55
|
<auro-accordion alignRight>
|
|
66
56
|
<span slot="trigger">See code</span>
|
|
67
57
|
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/basic.html) -->
|
|
68
58
|
<!-- The below code snippet is automatically added from ./../apiExamples/basic.html -->
|
|
69
59
|
|
|
70
60
|
```html
|
|
71
|
-
<!-- icon variant -->
|
|
72
61
|
<auro-button id="basicToastBtn">
|
|
73
62
|
Show default notification
|
|
74
|
-
</auro-button>
|
|
63
|
+
</auro-button>
|
|
75
64
|
<auro-toast style="display: block; margin: 0.5rem 0;" id="basicToast">
|
|
76
65
|
Default notification with no error type
|
|
77
66
|
</auro-toast>
|
|
78
|
-
<!-- no icon variant -->
|
|
79
|
-
<auro-button id="basicToast-noIconBtn">
|
|
80
|
-
Show default notification with no icon
|
|
81
|
-
</auro-button>
|
|
82
|
-
<auro-toast style="display: block; margin: 0.5rem 0;" id="basicToast-noIcon" noIcon>
|
|
83
|
-
Default notification with no error type
|
|
84
|
-
</auro-toast>
|
|
85
|
-
```
|
|
86
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
87
|
-
</auro-accordion>
|
|
88
|
-
|
|
89
|
-
## Single notification
|
|
90
|
-
|
|
91
|
-
Aside from the `default` notification, the `<auro-toast>` supports multiple variations, `success` and `error`. See below for more information on these variants.
|
|
92
|
-
|
|
93
|
-
### Error notification
|
|
94
|
-
|
|
95
|
-
The error push notification using the `<auro-toast>` element will **NOT** automatically dismiss itself. The user **MUST** dismiss the notification manually. When the notification is dismissed, it is not removed from the DOM. The `visible` property is set to `false`, which hides the notification from the UI.
|
|
96
|
-
|
|
97
|
-
<div class="exampleWrapper">
|
|
98
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/error.html) -->
|
|
99
|
-
<!-- The below content is automatically added from ./../apiExamples/error.html -->
|
|
100
|
-
<auro-button id="errorToastBtn">Show error notification</auro-button>
|
|
101
|
-
<auro-toast style="display: block; margin: 0.5rem 0;" variant="error" id="errorToast"> Unable to add lap infant. Please try again </auro-toast>
|
|
102
|
-
<auro-button id="errorToast-noIconBtn">Show error notification with no icon</auro-button>
|
|
103
|
-
<auro-toast style="display: block; margin: 0.5rem 0;" variant="error" id="errorToast-noIcon" noIcon> Unable to add lap infant. Please try again </auro-toast>
|
|
104
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
105
|
-
</div>
|
|
106
|
-
<auro-accordion alignRight>
|
|
107
|
-
<span slot="trigger">See code</span>
|
|
108
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/error.html) -->
|
|
109
|
-
<!-- The below code snippet is automatically added from ./../apiExamples/error.html -->
|
|
110
|
-
|
|
111
|
-
```html
|
|
112
|
-
<auro-button id="errorToastBtn">Show error notification</auro-button>
|
|
113
|
-
<auro-toast style="display: block; margin: 0.5rem 0;" variant="error" id="errorToast"> Unable to add lap infant. Please try again </auro-toast>
|
|
114
|
-
<auro-button id="errorToast-noIconBtn">Show error notification with no icon</auro-button>
|
|
115
|
-
<auro-toast style="display: block; margin: 0.5rem 0;" variant="error" id="errorToast-noIcon" noIcon> Unable to add lap infant. Please try again </auro-toast>
|
|
116
|
-
```
|
|
117
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
118
|
-
</auro-accordion>
|
|
119
|
-
|
|
120
|
-
### Success notification
|
|
121
|
-
|
|
122
|
-
The success push notification using the `<auro-toast>` element will automatically dismiss after five seconds if the user does not manually dismiss it. In this case, the notification is not removed from the DOM. The `visible` property is set to `false`, which hides the notification from the UI.
|
|
123
|
-
|
|
124
|
-
<div class="exampleWrapper">
|
|
125
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/success.html) -->
|
|
126
|
-
<!-- The below content is automatically added from ./../apiExamples/success.html -->
|
|
127
|
-
<auro-button id="successToastBtn">Show success toast</auro-button>
|
|
128
|
-
<auro-toast style="display: block; margin: 0.5rem 0;" variant="success" id="successToast"> Successfully added lap infant </auro-toast>
|
|
129
|
-
<auro-button id="successToast-noIconBtn">Show success toast with no icon</auro-button>
|
|
130
|
-
<auro-toast style="display: block; margin: 0.5rem 0;" variant="success" id="successToast-noIcon" noIcon> Successfully added lap infant </auro-toast>
|
|
131
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
132
|
-
</div>
|
|
133
|
-
<auro-accordion alignRight>
|
|
134
|
-
<span slot="trigger">See code</span>
|
|
135
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/success.html) -->
|
|
136
|
-
<!-- The below code snippet is automatically added from ./../apiExamples/success.html -->
|
|
137
|
-
|
|
138
|
-
```html
|
|
139
|
-
<auro-button id="successToastBtn">Show success toast</auro-button>
|
|
140
|
-
<auro-toast style="display: block; margin: 0.5rem 0;" variant="success" id="successToast"> Successfully added lap infant </auro-toast>
|
|
141
|
-
<auro-button id="successToast-noIconBtn">Show success toast with no icon</auro-button>
|
|
142
|
-
<auro-toast style="display: block; margin: 0.5rem 0;" variant="success" id="successToast-noIcon" noIcon> Successfully added lap infant </auro-toast>
|
|
143
|
-
```
|
|
144
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
145
|
-
</auro-accordion>
|
|
146
|
-
|
|
147
|
-
## Multiple toasts
|
|
148
|
-
|
|
149
|
-
The multi-notification use case requires the use of the `<auro-toaster>` component. Toaster will render the toasts
|
|
150
|
-
at the bottom right of a page.
|
|
151
|
-
|
|
152
|
-
<div class="exampleWrapper">
|
|
153
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/multipleToasts.html) -->
|
|
154
|
-
<!-- The below content is automatically added from ./../apiExamples/multipleToasts.html -->
|
|
155
|
-
<auro-button id="multiToastBtn-default">Show default toast</auro-button>
|
|
156
|
-
<auro-button id="multiToastBtn-error">Show error toast</auro-button>
|
|
157
|
-
<auro-button id="multiToastBtn-success">Show success toast</auro-button>
|
|
158
|
-
<auro-toaster>
|
|
159
|
-
<auro-toast id="multiToast-default">Default toast</auro-toast>
|
|
160
|
-
<auro-toast id="multiToast-error" variant="error">Unable to add lap infant. Please try again</auro-toast>
|
|
161
|
-
<auro-toast id="multiToast-success" variant="success">Successfully added lap infant</auro-toast>
|
|
162
|
-
</auro-toaster>
|
|
163
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
164
|
-
</div>
|
|
165
|
-
<auro-accordion alignRight>
|
|
166
|
-
<span slot="trigger">See code</span>
|
|
167
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/multipleToasts.html) -->
|
|
168
|
-
<!-- The below code snippet is automatically added from ./../apiExamples/multipleToasts.html -->
|
|
169
|
-
|
|
170
|
-
```html
|
|
171
|
-
<auro-button id="multiToastBtn-default">Show default toast</auro-button>
|
|
172
|
-
<auro-button id="multiToastBtn-error">Show error toast</auro-button>
|
|
173
|
-
<auro-button id="multiToastBtn-success">Show success toast</auro-button>
|
|
174
|
-
<auro-toaster>
|
|
175
|
-
<auro-toast id="multiToast-default">Default toast</auro-toast>
|
|
176
|
-
<auro-toast id="multiToast-error" variant="error">Unable to add lap infant. Please try again</auro-toast>
|
|
177
|
-
<auro-toast id="multiToast-success" variant="success">Successfully added lap infant</auro-toast>
|
|
178
|
-
</auro-toaster>
|
|
179
|
-
```
|
|
180
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
181
|
-
</auro-accordion>
|
|
182
|
-
|
|
183
|
-
## Dynamic toasts
|
|
184
|
-
|
|
185
|
-
If you choose to implement push notifications dynamically, the following is an example of how to implement dynamic `<auro-toast>` elements using Vue.
|
|
186
|
-
|
|
187
|
-
```js
|
|
188
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
189
|
-
|
|
190
|
-
interface ToastEvent {
|
|
191
|
-
variant: string,
|
|
192
|
-
message: string
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
interface Toast {
|
|
196
|
-
id: string
|
|
197
|
-
variant: string,
|
|
198
|
-
message: string,
|
|
199
|
-
visible: boolean
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const toasts = ref<Array<Toast>>([]);
|
|
203
|
-
|
|
204
|
-
// Function that adds toasts to the toasts array, which will trigger the toast to be visible
|
|
205
|
-
handleToastEvent(e: ToastEvent) {
|
|
206
|
-
toast.id = uuidv4();
|
|
207
|
-
toast.visible = true;
|
|
208
|
-
toast.variant = e.variant;
|
|
209
|
-
toast.message = e.message
|
|
210
|
-
toasts.value.push(toast);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Function that removes the toast from the DOM
|
|
214
|
-
handleOnToastClose(event) {
|
|
215
|
-
// In event.detail comes the ID of the auro-toast that was closed (visible was set to false)
|
|
216
|
-
const id = event.detail.id;
|
|
217
|
-
toasts.value = toasts.filter((t) => t.id !== id)
|
|
218
|
-
}
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
The following example is for the HTML template.
|
|
222
|
-
|
|
223
|
-
```html
|
|
224
|
-
<auro-toaster>
|
|
225
|
-
<auro-toast
|
|
226
|
-
v-for="(toast, i) in toasts"
|
|
227
|
-
:id="toast.id"
|
|
228
|
-
:visible="toast.visible"
|
|
229
|
-
:variant="toast.variant"
|
|
230
|
-
@on-toast-close="handleOnToastClose">
|
|
231
|
-
</auro-toast>
|
|
232
|
-
<auro-toaster>
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
## Customizing Toast Notifications
|
|
236
|
-
|
|
237
|
-
The toast notification can be customized in several ways.
|
|
238
|
-
|
|
239
|
-
- By applying the `variant="custom"` attribute value, you may pass in custom svg to use in place of the defaults assigned to the other variants.
|
|
240
|
-
- You may recolor the toast notification using the tier 3 theme tokens.
|
|
241
|
-
- You may disable the auto hide behavior of the toast by applying the `disableAutoHide` attribute.
|
|
242
|
-
- You may programmatically show the toast by applying the `visible` attribute. (e.g. if you want the toast to show on load)
|
|
243
|
-
|
|
244
|
-
<div class="exampleWrapper">
|
|
245
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/customToast.html) -->
|
|
246
|
-
<!-- The below content is automatically added from ../apiExamples/customToast.html -->
|
|
247
|
-
<!-- icon variant -->
|
|
248
|
-
<auro-button id="customizedToastBtn">
|
|
249
|
-
Show customized notification
|
|
250
|
-
</auro-button>
|
|
251
|
-
<auro-toast
|
|
252
|
-
id="customizedToast"
|
|
253
|
-
variant="custom"
|
|
254
|
-
visible
|
|
255
|
-
disableAutoHide
|
|
256
|
-
style="--ds-auro-toast-container-color: var(--ds-color-background-info-default); --ds-auro-toast-text-color: var(--ds-color-text-primary-default);">
|
|
257
|
-
Did you know you can create a price alert for this route?
|
|
258
|
-
<br />
|
|
259
|
-
<auro-button variant="tertiary">Create Alert</auro-button>
|
|
260
|
-
<svg slot="customSvg" aria-labelledby="pin-trip-filled__desc" class="ico_squareLarge" role="img" viewBox="0 0 24 24" style="min-width: var(--auro-size-lg, var(--ds-size-300, 1.5rem)); height: var(--auro-size-lg, var(--ds-size-300, 1.5rem)); fill: currentcolor;"><title></title><desc id="pin-trip-filled__desc">drop pin with circles.</desc><path d="M10.045 3.345a.75.75 0 0 1 .785-.714l.05.003a.75.75 0 0 1-.082 1.498l-.04-.002a.75.75 0 0 1-.713-.785m-1.217.22a.75.75 0 0 1-.357 1l-.034.016a.75.75 0 0 1-.655-1.35l.047-.022a.75.75 0 0 1 .999.357m3.949.186a.75.75 0 0 1 1.012-.318l.045.023a.75.75 0 0 1-.703 1.326l-.035-.019a.75.75 0 0 1-.319-1.012M6.508 5.057a.75.75 0 0 1 .2 1.041l-.01.017a.75.75 0 1 1-1.246-.836l.014-.022a.75.75 0 0 1 1.042-.2m8.577.22a.75.75 0 0 1 1.038.218l.028.044a.75.75 0 0 1-1.264.808l-.02-.032a.75.75 0 0 1 .218-1.038m6.02 7.014c0-2.789-2.44-4.88-4.88-4.88s-4.881 2.091-4.881 4.88q0 2.559 4.11 8.496l.199.285.055.068a.697.697 0 0 0 1.088-.068q4.31-6.16 4.309-8.781m-6.275 0a1.394 1.394 0 1 1 2.789 0 1.394 1.394 0 0 1-2.789 0M4.635 10.704a1.74 1.74 0 1 0 0-3.48 1.74 1.74 0 0 0 0 3.48"></path></svg>
|
|
261
|
-
</auro-toast>
|
|
262
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
263
|
-
</div>
|
|
264
|
-
<auro-accordion alignRight>
|
|
265
|
-
<span slot="trigger">See code</span>
|
|
266
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/customToast.html) -->
|
|
267
|
-
<!-- The below code snippet is automatically added from ../apiExamples/customToast.html -->
|
|
268
|
-
|
|
269
|
-
```html
|
|
270
|
-
<!-- icon variant -->
|
|
271
|
-
<auro-button id="customizedToastBtn">
|
|
272
|
-
Show customized notification
|
|
273
|
-
</auro-button>
|
|
274
|
-
<auro-toast
|
|
275
|
-
id="customizedToast"
|
|
276
|
-
variant="custom"
|
|
277
|
-
visible
|
|
278
|
-
disableAutoHide
|
|
279
|
-
style="--ds-auro-toast-container-color: var(--ds-color-background-info-default); --ds-auro-toast-text-color: var(--ds-color-text-primary-default);">
|
|
280
|
-
Did you know you can create a price alert for this route?
|
|
281
|
-
<br />
|
|
282
|
-
<auro-button variant="tertiary">Create Alert</auro-button>
|
|
283
|
-
<svg slot="customSvg" aria-labelledby="pin-trip-filled__desc" class="ico_squareLarge" role="img" viewBox="0 0 24 24" style="min-width: var(--auro-size-lg, var(--ds-size-300, 1.5rem)); height: var(--auro-size-lg, var(--ds-size-300, 1.5rem)); fill: currentcolor;"><title></title><desc id="pin-trip-filled__desc">drop pin with circles.</desc><path d="M10.045 3.345a.75.75 0 0 1 .785-.714l.05.003a.75.75 0 0 1-.082 1.498l-.04-.002a.75.75 0 0 1-.713-.785m-1.217.22a.75.75 0 0 1-.357 1l-.034.016a.75.75 0 0 1-.655-1.35l.047-.022a.75.75 0 0 1 .999.357m3.949.186a.75.75 0 0 1 1.012-.318l.045.023a.75.75 0 0 1-.703 1.326l-.035-.019a.75.75 0 0 1-.319-1.012M6.508 5.057a.75.75 0 0 1 .2 1.041l-.01.017a.75.75 0 1 1-1.246-.836l.014-.022a.75.75 0 0 1 1.042-.2m8.577.22a.75.75 0 0 1 1.038.218l.028.044a.75.75 0 0 1-1.264.808l-.02-.032a.75.75 0 0 1 .218-1.038m6.02 7.014c0-2.789-2.44-4.88-4.88-4.88s-4.881 2.091-4.881 4.88q0 2.559 4.11 8.496l.199.285.055.068a.697.697 0 0 0 1.088-.068q4.31-6.16 4.309-8.781m-6.275 0a1.394 1.394 0 1 1 2.789 0 1.394 1.394 0 0 1-2.789 0M4.635 10.704a1.74 1.74 0 1 0 0-3.48 1.74 1.74 0 0 0 0 3.48"></path></svg>
|
|
284
|
-
</auro-toast>
|
|
285
67
|
```
|
|
286
68
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
287
|
-
</auro-accordion>
|
|
288
|
-
|
|
289
|
-
## Recommended Use and Version Control
|
|
290
|
-
|
|
291
|
-
There are two important parts of every Auro component. The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">class</a> and the custom element. The class is exported and then used as part of defining the Web Component. When importing this component as described in the <a href="#install">install</a> section, the class is imported and the `auro-toast` custom element is defined automatically.
|
|
292
|
-
|
|
293
|
-
To protect from versioning conflicts with other instances of the component being loaded, it is recommended to use our `AuroToast.register(name)` method and pass in a unique name.
|
|
294
|
-
|
|
295
|
-
```js
|
|
296
|
-
import { AuroToast } from '@aurodesignsystem/auro-toast/class'
|
|
297
|
-
|
|
298
|
-
AuroToast.register('custom-toast');
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
This will create a new custom element that you can use in your HTML that will function identically to the `auro-toast` element.
|
|
302
|
-
|
|
303
|
-
<div class="exampleWrapper">
|
|
304
|
-
<custom-toast variant="error" visible>Salutations World!</custom-toast>
|
|
305
|
-
</div>
|
|
306
|
-
<auro-accordion alignRight>
|
|
307
|
-
<span slot="trigger">See code</span>
|
|
308
|
-
|
|
309
|
-
```html
|
|
310
|
-
<custom-toast variant="error" visible>Salutations World!</custom-toast>
|
|
311
|
-
```
|
|
312
|
-
|
|
313
69
|
</auro-accordion>
|