@aurodesignsystem-dev/auro-drawer 0.0.0-pr131.7 → 0.0.0-pr131.9
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 +70 -82
- package/demo/api.html +1 -0
- package/demo/api.js +2 -2
- package/demo/api.md +953 -977
- package/demo/api.min.js +4119 -33
- package/demo/index.html +1 -0
- package/demo/index.md +54 -58
- package/demo/index.min.js +4083 -1
- package/demo/readme.md +175 -0
- package/dist/{auro-drawer-CozmUPFj.js → auro-drawer-DJcKRnFy.js} +27 -27
- package/dist/index.d.ts +3 -4
- package/dist/index.js +1 -1
- package/dist/registered.js +1 -1
- package/package.json +7 -7
- package/demo/auro-drawer.min.js +0 -3696
package/demo/api.min.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
function initAriaLabelSlotExample() {
|
|
2
|
+
const buttons = [
|
|
3
|
+
document.querySelector("#openAriaLabelSlotDrawer"),
|
|
4
|
+
document.querySelector("#closeAriaLabelSlotDrawer"),
|
|
5
|
+
];
|
|
6
|
+
const drawer = document.querySelector("#ariaLabelSlotDrawer");
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
drawer.triggerElement = buttons[0];
|
|
9
|
+
buttons[1].addEventListener("click", () => {
|
|
10
|
+
drawer.removeAttribute("open");
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function initBasicExample() {
|
|
4
15
|
const buttons = [
|
|
5
|
-
document.querySelector("#
|
|
6
|
-
document.querySelector("#
|
|
16
|
+
document.querySelector("#openBasic"),
|
|
17
|
+
document.querySelector("#closeBasic"),
|
|
7
18
|
];
|
|
8
|
-
const drawer = document.querySelector("#
|
|
19
|
+
const drawer = document.querySelector("#defaultDrawer");
|
|
9
20
|
|
|
10
21
|
drawer.triggerElement = buttons[0];
|
|
11
22
|
buttons[1].addEventListener("click", () => {
|
|
@@ -53,6 +64,9 @@ function initFullscreenBreakpointExample() {
|
|
|
53
64
|
}
|
|
54
65
|
|
|
55
66
|
function initModalExample() {
|
|
67
|
+
if (initModalExample._initialized) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
56
70
|
const defaultButtons = [
|
|
57
71
|
document.querySelector("#openDefaultModal"),
|
|
58
72
|
document.querySelector("#closeDefaultModal"),
|
|
@@ -71,35 +85,36 @@ function initModalExample() {
|
|
|
71
85
|
];
|
|
72
86
|
const smallDrawer = document.querySelector("#smallModalDrawer");
|
|
73
87
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
if (
|
|
89
|
+
!defaultButtons[0] ||
|
|
90
|
+
!defaultButtons[1] ||
|
|
91
|
+
!defaultDrawer ||
|
|
92
|
+
!mediumButtons[0] ||
|
|
93
|
+
!mediumButtons[1] ||
|
|
94
|
+
!mediumDrawer ||
|
|
95
|
+
!smallButtons[0] ||
|
|
96
|
+
!smallButtons[1] ||
|
|
97
|
+
!smallDrawer
|
|
98
|
+
) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
defaultDrawer.triggerElement = defaultButtons[0];
|
|
103
|
+
defaultButtons[1].addEventListener("click", () => {
|
|
104
|
+
defaultDrawer.removeAttribute("open");
|
|
82
105
|
});
|
|
83
106
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
mediumDrawer.removeAttribute("open");
|
|
88
|
-
} else {
|
|
89
|
-
mediumDrawer.setAttribute("open", true);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
107
|
+
mediumDrawer.triggerElement = mediumButtons[0];
|
|
108
|
+
mediumButtons[1].addEventListener("click", () => {
|
|
109
|
+
mediumDrawer.removeAttribute("open");
|
|
92
110
|
});
|
|
93
111
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
smallDrawer.removeAttribute("open");
|
|
98
|
-
} else {
|
|
99
|
-
smallDrawer.setAttribute("open", true);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
112
|
+
smallDrawer.triggerElement = smallButtons[0];
|
|
113
|
+
smallButtons[1].addEventListener("click", () => {
|
|
114
|
+
smallDrawer.removeAttribute("open");
|
|
102
115
|
});
|
|
116
|
+
|
|
117
|
+
initModalExample._initialized = true;
|
|
103
118
|
}
|
|
104
119
|
|
|
105
120
|
function initNestedExample() {
|
|
@@ -244,12 +259,12 @@ function initSizeOptionsExample() {
|
|
|
244
259
|
});
|
|
245
260
|
}
|
|
246
261
|
|
|
247
|
-
function
|
|
262
|
+
function initUnformattedExample() {
|
|
248
263
|
const buttons = [
|
|
249
|
-
document.querySelector("#
|
|
250
|
-
document.querySelector("#
|
|
264
|
+
document.querySelector("#openUnformatted"),
|
|
265
|
+
document.querySelector("#closeUnformatted"),
|
|
251
266
|
];
|
|
252
|
-
const drawer = document.querySelector("#
|
|
267
|
+
const drawer = document.querySelector("#unformattedDrawer");
|
|
253
268
|
|
|
254
269
|
drawer.triggerElement = buttons[0];
|
|
255
270
|
buttons[1].addEventListener("click", () => {
|
|
@@ -257,6 +272,4077 @@ function initAriaLabelSlotExample() {
|
|
|
257
272
|
});
|
|
258
273
|
}
|
|
259
274
|
|
|
275
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
276
|
+
// See LICENSE in the project root for license information.
|
|
277
|
+
|
|
278
|
+
// ---------------------------------------------------------------------
|
|
279
|
+
|
|
280
|
+
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
281
|
+
|
|
282
|
+
class AuroLibraryRuntimeUtils {
|
|
283
|
+
|
|
284
|
+
/* eslint-disable jsdoc/require-param */
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* This will register a new custom element with the browser.
|
|
288
|
+
* @param {String} name - The name of the custom element.
|
|
289
|
+
* @param {Object} componentClass - The class to register as a custom element.
|
|
290
|
+
* @returns {void}
|
|
291
|
+
*/
|
|
292
|
+
registerComponent(name, componentClass) {
|
|
293
|
+
if (!customElements.get(name)) {
|
|
294
|
+
customElements.define(name, class extends componentClass {});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Finds and returns the closest HTML Element based on a selector.
|
|
300
|
+
* @returns {void}
|
|
301
|
+
*/
|
|
302
|
+
closestElement(
|
|
303
|
+
selector, // selector like in .closest()
|
|
304
|
+
base = this, // extra functionality to skip a parent
|
|
305
|
+
__Closest = (el, found = el && el.closest(selector)) =>
|
|
306
|
+
!el || el === document || el === window
|
|
307
|
+
? null // standard .closest() returns null for non-found selectors also
|
|
308
|
+
: found
|
|
309
|
+
? found // found a selector INside this element
|
|
310
|
+
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
|
|
311
|
+
) {
|
|
312
|
+
return __Closest(base);
|
|
313
|
+
}
|
|
314
|
+
/* eslint-enable jsdoc/require-param */
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
|
|
318
|
+
* @param {Object} elem - The element to check.
|
|
319
|
+
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
320
|
+
* @returns {void}
|
|
321
|
+
*/
|
|
322
|
+
handleComponentTagRename(elem, tagName) {
|
|
323
|
+
const tag = tagName.toLowerCase();
|
|
324
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
325
|
+
|
|
326
|
+
if (elemTag !== tag) {
|
|
327
|
+
elem.setAttribute(tag, true);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Validates if an element is a specific Auro component.
|
|
333
|
+
* @param {Object} elem - The element to validate.
|
|
334
|
+
* @param {String} tagName - The name of the Auro component to check against.
|
|
335
|
+
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
336
|
+
*/
|
|
337
|
+
elementMatch(elem, tagName) {
|
|
338
|
+
const tag = tagName.toLowerCase();
|
|
339
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
340
|
+
|
|
341
|
+
return elemTag === tag || elem.hasAttribute(tag);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Gets the text content of a named slot.
|
|
346
|
+
* @returns {String}
|
|
347
|
+
* @private
|
|
348
|
+
*/
|
|
349
|
+
getSlotText(elem, name) {
|
|
350
|
+
const slot = elem.shadowRoot?.querySelector(`slot[name="${name}"]`);
|
|
351
|
+
const nodes = slot?.assignedNodes({ flatten: true }) || [];
|
|
352
|
+
const text = nodes.map(n => n.textContent?.trim()).join(' ').trim();
|
|
353
|
+
|
|
354
|
+
return text || null;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @license
|
|
360
|
+
* Copyright 2017 Google LLC
|
|
361
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
362
|
+
*/
|
|
363
|
+
const t$2=globalThis,i$5=t$2.trustedTypes,s$3=i$5?i$5.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$4="$lit$",h$2=`lit$${Math.random().toFixed(9).slice(2)}$`,o$5="?"+h$2,n$3=`<${o$5}>`,r$2=document,l$3=()=>r$2.createComment(""),c$3=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a$2=Array.isArray,u$4=t=>a$2(t)||"function"==typeof t?.[Symbol.iterator],d$2="[ \t\n\f\r]",f$3=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v$1=/-->/g,_$1=/>/g,m$2=RegExp(`>|${d$2}(?:([^\\s"'>=/]+)(${d$2}*=${d$2}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p$3=/'/g,g$2=/"/g,$=/^(?:script|style|textarea|title)$/i,y$3=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x$1=y$3(1),T$1=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A$1=new WeakMap,C$1=r$2.createTreeWalker(r$2,129);function P(t,i){if(!a$2(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$3?s$3.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f$3;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f$3?"!--"===u[1]?c=v$1:void 0!==u[1]?c=_$1:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m$2):void 0!==u[3]&&(c=m$2):c===m$2?">"===u[0]?(c=r??f$3,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m$2:'"'===u[3]?g$2:p$3):c===g$2||c===p$3?c=m$2:c===v$1||c===_$1?c=f$3:(c=m$2,r=void 0);const x=c===m$2&&t[i+1].startsWith("/>")?" ":"";l+=c===f$3?s+n$3:d>=0?(o.push(a),s.slice(0,d)+e$4+s.slice(d)+h$2+x):s+h$2+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};let N$1 = class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C$1.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C$1.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$4)){const i=v[a++],s=r.getAttribute(t).split(h$2),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H$1:"?"===e[1]?I:"@"===e[1]?L:k$2}),r.removeAttribute(t);}else t.startsWith(h$2)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h$2),s=t.length-1;if(s>0){r.textContent=i$5?i$5.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l$3()),C$1.nextNode(),d.push({type:2,index:++c});r.append(t[s],l$3());}}}else if(8===r.nodeType)if(r.data===o$5)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h$2,t+1));)d.push({type:7,index:c}),t+=h$2.length-1;}c++;}}static createElement(t,i){const s=r$2.createElement("template");return s.innerHTML=t,s}};function S$2(t,i,s=t,e){if(i===T$1)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c$3(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S$2(t,h._$AS(t,i.values),h,e)),i}let M$2 = class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$2).importNode(i,true);C$1.currentNode=e;let h=C$1.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R$1(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z$2(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C$1.nextNode(),o++);}return C$1.currentNode=r$2,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}};let R$1 = class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S$2(this,t,i),c$3(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T$1&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u$4(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c$3(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$2.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N$1.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M$2(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A$1.get(t.strings);return void 0===i&&A$1.set(t.strings,i=new N$1(t)),i}k(t){a$2(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l$3()),this.O(l$3()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(false,true,i);t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}};let k$2 = class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=S$2(this,t,i,0),o=!c$3(t)||t!==this._$AH&&t!==T$1,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S$2(this,e[s+n],i,n),r===T$1&&(r=this._$AH[n]),o||=!c$3(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}};let H$1 = class H extends k$2{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}};class I extends k$2{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k$2{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S$2(this,t,i,0)??E)===T$1)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}let z$2 = class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S$2(this,t);}};const j=t$2.litHtmlPolyfillSupport;j?.(N$1,R$1),(t$2.litHtmlVersions??=[]).push("3.3.1");const B$1=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R$1(i.insertBefore(l$3(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* @license
|
|
367
|
+
* Copyright 2020 Google LLC
|
|
368
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
369
|
+
*/
|
|
370
|
+
const a$1=Symbol.for(""),o$4=t=>{if(t?.r===a$1)return t?._$litStatic$},s$2=t=>({_$litStatic$:t,r:a$1}),i$4=(t,...r)=>({_$litStatic$:r.reduce(((r,e,a)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[a+1]),t[0]),r:a$1}),l$2=new Map,n$2=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f=false;for(;$<a;){for(c=r[$];$<a&&void 0!==(i=e[$],s=o$4(i));)c+=s+r[++$],f=true;$!==a&&u.push(i),n.push(c),$++;}if($===a&&n.push(r[a]),f){const t=n.join("$$lit$$");void 0===(r=l$2.get(t))&&(n.raw=n,l$2.set(t,r=n)),e=u;}return t(r,...e)},u$3=n$2(x$1);
|
|
371
|
+
|
|
372
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
373
|
+
// See LICENSE in the project root for license information.
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
class AuroDependencyVersioning {
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Generates a unique string to be used for child auro element naming.
|
|
380
|
+
* @private
|
|
381
|
+
* @param {string} baseName - Defines the first part of the unique element name.
|
|
382
|
+
* @param {string} version - Version of the component that will be appended to the baseName.
|
|
383
|
+
* @returns {string} - Unique string to be used for naming.
|
|
384
|
+
*/
|
|
385
|
+
generateElementName(baseName, version) {
|
|
386
|
+
let result = baseName;
|
|
387
|
+
|
|
388
|
+
result += '-';
|
|
389
|
+
result += version.replace(/[.]/g, '_');
|
|
390
|
+
|
|
391
|
+
return result;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Generates a unique string to be used for child auro element naming.
|
|
396
|
+
* @param {string} baseName - Defines the first part of the unique element name.
|
|
397
|
+
* @param {string} version - Version of the component that will be appended to the baseName.
|
|
398
|
+
* @returns {string} - Unique string to be used for naming.
|
|
399
|
+
*/
|
|
400
|
+
generateTag(baseName, version, tagClass) {
|
|
401
|
+
const elementName = this.generateElementName(baseName, version);
|
|
402
|
+
const tag = i$4`${s$2(elementName)}`;
|
|
403
|
+
|
|
404
|
+
if (!customElements.get(elementName)) {
|
|
405
|
+
customElements.define(elementName, class extends tagClass {});
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
return tag;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Custom positioning reference element.
|
|
414
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
415
|
+
*/
|
|
416
|
+
|
|
417
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
418
|
+
const alignments = ['start', 'end'];
|
|
419
|
+
const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
|
420
|
+
const min = Math.min;
|
|
421
|
+
const max = Math.max;
|
|
422
|
+
const round = Math.round;
|
|
423
|
+
const floor = Math.floor;
|
|
424
|
+
const createCoords = v => ({
|
|
425
|
+
x: v,
|
|
426
|
+
y: v
|
|
427
|
+
});
|
|
428
|
+
const oppositeSideMap = {
|
|
429
|
+
left: 'right',
|
|
430
|
+
right: 'left',
|
|
431
|
+
bottom: 'top',
|
|
432
|
+
top: 'bottom'
|
|
433
|
+
};
|
|
434
|
+
const oppositeAlignmentMap = {
|
|
435
|
+
start: 'end',
|
|
436
|
+
end: 'start'
|
|
437
|
+
};
|
|
438
|
+
function clamp(start, value, end) {
|
|
439
|
+
return max(start, min(value, end));
|
|
440
|
+
}
|
|
441
|
+
function evaluate(value, param) {
|
|
442
|
+
return typeof value === 'function' ? value(param) : value;
|
|
443
|
+
}
|
|
444
|
+
function getSide(placement) {
|
|
445
|
+
return placement.split('-')[0];
|
|
446
|
+
}
|
|
447
|
+
function getAlignment(placement) {
|
|
448
|
+
return placement.split('-')[1];
|
|
449
|
+
}
|
|
450
|
+
function getOppositeAxis(axis) {
|
|
451
|
+
return axis === 'x' ? 'y' : 'x';
|
|
452
|
+
}
|
|
453
|
+
function getAxisLength(axis) {
|
|
454
|
+
return axis === 'y' ? 'height' : 'width';
|
|
455
|
+
}
|
|
456
|
+
const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
|
|
457
|
+
function getSideAxis(placement) {
|
|
458
|
+
return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
|
|
459
|
+
}
|
|
460
|
+
function getAlignmentAxis(placement) {
|
|
461
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
462
|
+
}
|
|
463
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
464
|
+
if (rtl === void 0) {
|
|
465
|
+
rtl = false;
|
|
466
|
+
}
|
|
467
|
+
const alignment = getAlignment(placement);
|
|
468
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
469
|
+
const length = getAxisLength(alignmentAxis);
|
|
470
|
+
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
471
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
472
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
473
|
+
}
|
|
474
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
475
|
+
}
|
|
476
|
+
function getExpandedPlacements(placement) {
|
|
477
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
478
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
479
|
+
}
|
|
480
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
481
|
+
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
482
|
+
}
|
|
483
|
+
const lrPlacement = ['left', 'right'];
|
|
484
|
+
const rlPlacement = ['right', 'left'];
|
|
485
|
+
const tbPlacement = ['top', 'bottom'];
|
|
486
|
+
const btPlacement = ['bottom', 'top'];
|
|
487
|
+
function getSideList(side, isStart, rtl) {
|
|
488
|
+
switch (side) {
|
|
489
|
+
case 'top':
|
|
490
|
+
case 'bottom':
|
|
491
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
492
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
493
|
+
case 'left':
|
|
494
|
+
case 'right':
|
|
495
|
+
return isStart ? tbPlacement : btPlacement;
|
|
496
|
+
default:
|
|
497
|
+
return [];
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
501
|
+
const alignment = getAlignment(placement);
|
|
502
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
503
|
+
if (alignment) {
|
|
504
|
+
list = list.map(side => side + "-" + alignment);
|
|
505
|
+
if (flipAlignment) {
|
|
506
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return list;
|
|
510
|
+
}
|
|
511
|
+
function getOppositePlacement(placement) {
|
|
512
|
+
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
513
|
+
}
|
|
514
|
+
function expandPaddingObject(padding) {
|
|
515
|
+
return {
|
|
516
|
+
top: 0,
|
|
517
|
+
right: 0,
|
|
518
|
+
bottom: 0,
|
|
519
|
+
left: 0,
|
|
520
|
+
...padding
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
function getPaddingObject(padding) {
|
|
524
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
525
|
+
top: padding,
|
|
526
|
+
right: padding,
|
|
527
|
+
bottom: padding,
|
|
528
|
+
left: padding
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function rectToClientRect(rect) {
|
|
532
|
+
const {
|
|
533
|
+
x,
|
|
534
|
+
y,
|
|
535
|
+
width,
|
|
536
|
+
height
|
|
537
|
+
} = rect;
|
|
538
|
+
return {
|
|
539
|
+
width,
|
|
540
|
+
height,
|
|
541
|
+
top: y,
|
|
542
|
+
left: x,
|
|
543
|
+
right: x + width,
|
|
544
|
+
bottom: y + height,
|
|
545
|
+
x,
|
|
546
|
+
y
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
551
|
+
let {
|
|
552
|
+
reference,
|
|
553
|
+
floating
|
|
554
|
+
} = _ref;
|
|
555
|
+
const sideAxis = getSideAxis(placement);
|
|
556
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
557
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
558
|
+
const side = getSide(placement);
|
|
559
|
+
const isVertical = sideAxis === 'y';
|
|
560
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
561
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
562
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
563
|
+
let coords;
|
|
564
|
+
switch (side) {
|
|
565
|
+
case 'top':
|
|
566
|
+
coords = {
|
|
567
|
+
x: commonX,
|
|
568
|
+
y: reference.y - floating.height
|
|
569
|
+
};
|
|
570
|
+
break;
|
|
571
|
+
case 'bottom':
|
|
572
|
+
coords = {
|
|
573
|
+
x: commonX,
|
|
574
|
+
y: reference.y + reference.height
|
|
575
|
+
};
|
|
576
|
+
break;
|
|
577
|
+
case 'right':
|
|
578
|
+
coords = {
|
|
579
|
+
x: reference.x + reference.width,
|
|
580
|
+
y: commonY
|
|
581
|
+
};
|
|
582
|
+
break;
|
|
583
|
+
case 'left':
|
|
584
|
+
coords = {
|
|
585
|
+
x: reference.x - floating.width,
|
|
586
|
+
y: commonY
|
|
587
|
+
};
|
|
588
|
+
break;
|
|
589
|
+
default:
|
|
590
|
+
coords = {
|
|
591
|
+
x: reference.x,
|
|
592
|
+
y: reference.y
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
switch (getAlignment(placement)) {
|
|
596
|
+
case 'start':
|
|
597
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
598
|
+
break;
|
|
599
|
+
case 'end':
|
|
600
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
return coords;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
608
|
+
* next to a given reference element.
|
|
609
|
+
*
|
|
610
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
611
|
+
* write one for the platform you are using Floating UI with.
|
|
612
|
+
*/
|
|
613
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
614
|
+
const {
|
|
615
|
+
placement = 'bottom',
|
|
616
|
+
strategy = 'absolute',
|
|
617
|
+
middleware = [],
|
|
618
|
+
platform
|
|
619
|
+
} = config;
|
|
620
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
621
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
622
|
+
let rects = await platform.getElementRects({
|
|
623
|
+
reference,
|
|
624
|
+
floating,
|
|
625
|
+
strategy
|
|
626
|
+
});
|
|
627
|
+
let {
|
|
628
|
+
x,
|
|
629
|
+
y
|
|
630
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
631
|
+
let statefulPlacement = placement;
|
|
632
|
+
let middlewareData = {};
|
|
633
|
+
let resetCount = 0;
|
|
634
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
635
|
+
const {
|
|
636
|
+
name,
|
|
637
|
+
fn
|
|
638
|
+
} = validMiddleware[i];
|
|
639
|
+
const {
|
|
640
|
+
x: nextX,
|
|
641
|
+
y: nextY,
|
|
642
|
+
data,
|
|
643
|
+
reset
|
|
644
|
+
} = await fn({
|
|
645
|
+
x,
|
|
646
|
+
y,
|
|
647
|
+
initialPlacement: placement,
|
|
648
|
+
placement: statefulPlacement,
|
|
649
|
+
strategy,
|
|
650
|
+
middlewareData,
|
|
651
|
+
rects,
|
|
652
|
+
platform,
|
|
653
|
+
elements: {
|
|
654
|
+
reference,
|
|
655
|
+
floating
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
x = nextX != null ? nextX : x;
|
|
659
|
+
y = nextY != null ? nextY : y;
|
|
660
|
+
middlewareData = {
|
|
661
|
+
...middlewareData,
|
|
662
|
+
[name]: {
|
|
663
|
+
...middlewareData[name],
|
|
664
|
+
...data
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
if (reset && resetCount <= 50) {
|
|
668
|
+
resetCount++;
|
|
669
|
+
if (typeof reset === 'object') {
|
|
670
|
+
if (reset.placement) {
|
|
671
|
+
statefulPlacement = reset.placement;
|
|
672
|
+
}
|
|
673
|
+
if (reset.rects) {
|
|
674
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
|
675
|
+
reference,
|
|
676
|
+
floating,
|
|
677
|
+
strategy
|
|
678
|
+
}) : reset.rects;
|
|
679
|
+
}
|
|
680
|
+
({
|
|
681
|
+
x,
|
|
682
|
+
y
|
|
683
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
684
|
+
}
|
|
685
|
+
i = -1;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
return {
|
|
689
|
+
x,
|
|
690
|
+
y,
|
|
691
|
+
placement: statefulPlacement,
|
|
692
|
+
strategy,
|
|
693
|
+
middlewareData
|
|
694
|
+
};
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
699
|
+
* element is overflowing a given clipping boundary on each side.
|
|
700
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
701
|
+
* - negative = how many pixels left before it will overflow
|
|
702
|
+
* - 0 = lies flush with the boundary
|
|
703
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
704
|
+
*/
|
|
705
|
+
async function detectOverflow(state, options) {
|
|
706
|
+
var _await$platform$isEle;
|
|
707
|
+
if (options === void 0) {
|
|
708
|
+
options = {};
|
|
709
|
+
}
|
|
710
|
+
const {
|
|
711
|
+
x,
|
|
712
|
+
y,
|
|
713
|
+
platform,
|
|
714
|
+
rects,
|
|
715
|
+
elements,
|
|
716
|
+
strategy
|
|
717
|
+
} = state;
|
|
718
|
+
const {
|
|
719
|
+
boundary = 'clippingAncestors',
|
|
720
|
+
rootBoundary = 'viewport',
|
|
721
|
+
elementContext = 'floating',
|
|
722
|
+
altBoundary = false,
|
|
723
|
+
padding = 0
|
|
724
|
+
} = evaluate(options, state);
|
|
725
|
+
const paddingObject = getPaddingObject(padding);
|
|
726
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
727
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
728
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
729
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
730
|
+
boundary,
|
|
731
|
+
rootBoundary,
|
|
732
|
+
strategy
|
|
733
|
+
}));
|
|
734
|
+
const rect = elementContext === 'floating' ? {
|
|
735
|
+
x,
|
|
736
|
+
y,
|
|
737
|
+
width: rects.floating.width,
|
|
738
|
+
height: rects.floating.height
|
|
739
|
+
} : rects.reference;
|
|
740
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
741
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
742
|
+
x: 1,
|
|
743
|
+
y: 1
|
|
744
|
+
} : {
|
|
745
|
+
x: 1,
|
|
746
|
+
y: 1
|
|
747
|
+
};
|
|
748
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
749
|
+
elements,
|
|
750
|
+
rect,
|
|
751
|
+
offsetParent,
|
|
752
|
+
strategy
|
|
753
|
+
}) : rect);
|
|
754
|
+
return {
|
|
755
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
756
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
757
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
758
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
763
|
+
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
|
|
764
|
+
return allowedPlacementsSortedByAlignment.filter(placement => {
|
|
765
|
+
if (alignment) {
|
|
766
|
+
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
767
|
+
}
|
|
768
|
+
return true;
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
773
|
+
* that has the most space available automatically, without needing to specify a
|
|
774
|
+
* preferred placement. Alternative to `flip`.
|
|
775
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
776
|
+
*/
|
|
777
|
+
const autoPlacement$1 = function (options) {
|
|
778
|
+
if (options === void 0) {
|
|
779
|
+
options = {};
|
|
780
|
+
}
|
|
781
|
+
return {
|
|
782
|
+
name: 'autoPlacement',
|
|
783
|
+
options,
|
|
784
|
+
async fn(state) {
|
|
785
|
+
var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
|
|
786
|
+
const {
|
|
787
|
+
rects,
|
|
788
|
+
middlewareData,
|
|
789
|
+
placement,
|
|
790
|
+
platform,
|
|
791
|
+
elements
|
|
792
|
+
} = state;
|
|
793
|
+
const {
|
|
794
|
+
crossAxis = false,
|
|
795
|
+
alignment,
|
|
796
|
+
allowedPlacements = placements,
|
|
797
|
+
autoAlignment = true,
|
|
798
|
+
...detectOverflowOptions
|
|
799
|
+
} = evaluate(options, state);
|
|
800
|
+
const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
801
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
802
|
+
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
|
|
803
|
+
const currentPlacement = placements$1[currentIndex];
|
|
804
|
+
if (currentPlacement == null) {
|
|
805
|
+
return {};
|
|
806
|
+
}
|
|
807
|
+
const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
808
|
+
|
|
809
|
+
// Make `computeCoords` start from the right place.
|
|
810
|
+
if (placement !== currentPlacement) {
|
|
811
|
+
return {
|
|
812
|
+
reset: {
|
|
813
|
+
placement: placements$1[0]
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
|
|
818
|
+
const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
|
|
819
|
+
placement: currentPlacement,
|
|
820
|
+
overflows: currentOverflows
|
|
821
|
+
}];
|
|
822
|
+
const nextPlacement = placements$1[currentIndex + 1];
|
|
823
|
+
|
|
824
|
+
// There are more placements to check.
|
|
825
|
+
if (nextPlacement) {
|
|
826
|
+
return {
|
|
827
|
+
data: {
|
|
828
|
+
index: currentIndex + 1,
|
|
829
|
+
overflows: allOverflows
|
|
830
|
+
},
|
|
831
|
+
reset: {
|
|
832
|
+
placement: nextPlacement
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
const placementsSortedByMostSpace = allOverflows.map(d => {
|
|
837
|
+
const alignment = getAlignment(d.placement);
|
|
838
|
+
return [d.placement, alignment && crossAxis ?
|
|
839
|
+
// Check along the mainAxis and main crossAxis side.
|
|
840
|
+
d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
|
|
841
|
+
// Check only the mainAxis.
|
|
842
|
+
d.overflows[0], d.overflows];
|
|
843
|
+
}).sort((a, b) => a[1] - b[1]);
|
|
844
|
+
const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
|
|
845
|
+
// Aligned placements should not check their opposite crossAxis
|
|
846
|
+
// side.
|
|
847
|
+
getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
|
|
848
|
+
const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
|
|
849
|
+
if (resetPlacement !== placement) {
|
|
850
|
+
return {
|
|
851
|
+
data: {
|
|
852
|
+
index: currentIndex + 1,
|
|
853
|
+
overflows: allOverflows
|
|
854
|
+
},
|
|
855
|
+
reset: {
|
|
856
|
+
placement: resetPlacement
|
|
857
|
+
}
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
return {};
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
};
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
867
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
868
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
869
|
+
* @see https://floating-ui.com/docs/flip
|
|
870
|
+
*/
|
|
871
|
+
const flip$1 = function (options) {
|
|
872
|
+
if (options === void 0) {
|
|
873
|
+
options = {};
|
|
874
|
+
}
|
|
875
|
+
return {
|
|
876
|
+
name: 'flip',
|
|
877
|
+
options,
|
|
878
|
+
async fn(state) {
|
|
879
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
880
|
+
const {
|
|
881
|
+
placement,
|
|
882
|
+
middlewareData,
|
|
883
|
+
rects,
|
|
884
|
+
initialPlacement,
|
|
885
|
+
platform,
|
|
886
|
+
elements
|
|
887
|
+
} = state;
|
|
888
|
+
const {
|
|
889
|
+
mainAxis: checkMainAxis = true,
|
|
890
|
+
crossAxis: checkCrossAxis = true,
|
|
891
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
892
|
+
fallbackStrategy = 'bestFit',
|
|
893
|
+
fallbackAxisSideDirection = 'none',
|
|
894
|
+
flipAlignment = true,
|
|
895
|
+
...detectOverflowOptions
|
|
896
|
+
} = evaluate(options, state);
|
|
897
|
+
|
|
898
|
+
// If a reset by the arrow was caused due to an alignment offset being
|
|
899
|
+
// added, we should skip any logic now since `flip()` has already done its
|
|
900
|
+
// work.
|
|
901
|
+
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
902
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
903
|
+
return {};
|
|
904
|
+
}
|
|
905
|
+
const side = getSide(placement);
|
|
906
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
907
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
908
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
909
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
910
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
|
|
911
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
912
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
913
|
+
}
|
|
914
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
915
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
916
|
+
const overflows = [];
|
|
917
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
918
|
+
if (checkMainAxis) {
|
|
919
|
+
overflows.push(overflow[side]);
|
|
920
|
+
}
|
|
921
|
+
if (checkCrossAxis) {
|
|
922
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
923
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
924
|
+
}
|
|
925
|
+
overflowsData = [...overflowsData, {
|
|
926
|
+
placement,
|
|
927
|
+
overflows
|
|
928
|
+
}];
|
|
929
|
+
|
|
930
|
+
// One or more sides is overflowing.
|
|
931
|
+
if (!overflows.every(side => side <= 0)) {
|
|
932
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
933
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
934
|
+
const nextPlacement = placements[nextIndex];
|
|
935
|
+
if (nextPlacement) {
|
|
936
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
937
|
+
if (!ignoreCrossAxisOverflow ||
|
|
938
|
+
// We leave the current main axis only if every placement on that axis
|
|
939
|
+
// overflows the main axis.
|
|
940
|
+
overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
941
|
+
// Try next placement and re-run the lifecycle.
|
|
942
|
+
return {
|
|
943
|
+
data: {
|
|
944
|
+
index: nextIndex,
|
|
945
|
+
overflows: overflowsData
|
|
946
|
+
},
|
|
947
|
+
reset: {
|
|
948
|
+
placement: nextPlacement
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
955
|
+
// then find the placement that fits the best on the main crossAxis side.
|
|
956
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
957
|
+
|
|
958
|
+
// Otherwise fallback.
|
|
959
|
+
if (!resetPlacement) {
|
|
960
|
+
switch (fallbackStrategy) {
|
|
961
|
+
case 'bestFit':
|
|
962
|
+
{
|
|
963
|
+
var _overflowsData$filter2;
|
|
964
|
+
const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
|
|
965
|
+
if (hasFallbackAxisSideDirection) {
|
|
966
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
967
|
+
return currentSideAxis === initialSideAxis ||
|
|
968
|
+
// Create a bias to the `y` side axis due to horizontal
|
|
969
|
+
// reading directions favoring greater width.
|
|
970
|
+
currentSideAxis === 'y';
|
|
971
|
+
}
|
|
972
|
+
return true;
|
|
973
|
+
}).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
974
|
+
if (placement) {
|
|
975
|
+
resetPlacement = placement;
|
|
976
|
+
}
|
|
977
|
+
break;
|
|
978
|
+
}
|
|
979
|
+
case 'initialPlacement':
|
|
980
|
+
resetPlacement = initialPlacement;
|
|
981
|
+
break;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
if (placement !== resetPlacement) {
|
|
985
|
+
return {
|
|
986
|
+
reset: {
|
|
987
|
+
placement: resetPlacement
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
return {};
|
|
993
|
+
}
|
|
994
|
+
};
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
const originSides = /*#__PURE__*/new Set(['left', 'top']);
|
|
998
|
+
|
|
999
|
+
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
1000
|
+
// Derivable.
|
|
1001
|
+
|
|
1002
|
+
async function convertValueToCoords(state, options) {
|
|
1003
|
+
const {
|
|
1004
|
+
placement,
|
|
1005
|
+
platform,
|
|
1006
|
+
elements
|
|
1007
|
+
} = state;
|
|
1008
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
1009
|
+
const side = getSide(placement);
|
|
1010
|
+
const alignment = getAlignment(placement);
|
|
1011
|
+
const isVertical = getSideAxis(placement) === 'y';
|
|
1012
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
1013
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
1014
|
+
const rawValue = evaluate(options, state);
|
|
1015
|
+
|
|
1016
|
+
// eslint-disable-next-line prefer-const
|
|
1017
|
+
let {
|
|
1018
|
+
mainAxis,
|
|
1019
|
+
crossAxis,
|
|
1020
|
+
alignmentAxis
|
|
1021
|
+
} = typeof rawValue === 'number' ? {
|
|
1022
|
+
mainAxis: rawValue,
|
|
1023
|
+
crossAxis: 0,
|
|
1024
|
+
alignmentAxis: null
|
|
1025
|
+
} : {
|
|
1026
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
1027
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
1028
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
1029
|
+
};
|
|
1030
|
+
if (alignment && typeof alignmentAxis === 'number') {
|
|
1031
|
+
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
1032
|
+
}
|
|
1033
|
+
return isVertical ? {
|
|
1034
|
+
x: crossAxis * crossAxisMulti,
|
|
1035
|
+
y: mainAxis * mainAxisMulti
|
|
1036
|
+
} : {
|
|
1037
|
+
x: mainAxis * mainAxisMulti,
|
|
1038
|
+
y: crossAxis * crossAxisMulti
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* Modifies the placement by translating the floating element along the
|
|
1044
|
+
* specified axes.
|
|
1045
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
1046
|
+
* object may be passed.
|
|
1047
|
+
* @see https://floating-ui.com/docs/offset
|
|
1048
|
+
*/
|
|
1049
|
+
const offset$1 = function (options) {
|
|
1050
|
+
if (options === void 0) {
|
|
1051
|
+
options = 0;
|
|
1052
|
+
}
|
|
1053
|
+
return {
|
|
1054
|
+
name: 'offset',
|
|
1055
|
+
options,
|
|
1056
|
+
async fn(state) {
|
|
1057
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
1058
|
+
const {
|
|
1059
|
+
x,
|
|
1060
|
+
y,
|
|
1061
|
+
placement,
|
|
1062
|
+
middlewareData
|
|
1063
|
+
} = state;
|
|
1064
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
1065
|
+
|
|
1066
|
+
// If the placement is the same and the arrow caused an alignment offset
|
|
1067
|
+
// then we don't need to change the positioning coordinates.
|
|
1068
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
1069
|
+
return {};
|
|
1070
|
+
}
|
|
1071
|
+
return {
|
|
1072
|
+
x: x + diffCoords.x,
|
|
1073
|
+
y: y + diffCoords.y,
|
|
1074
|
+
data: {
|
|
1075
|
+
...diffCoords,
|
|
1076
|
+
placement
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
1085
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
1086
|
+
* @see https://floating-ui.com/docs/shift
|
|
1087
|
+
*/
|
|
1088
|
+
const shift$1 = function (options) {
|
|
1089
|
+
if (options === void 0) {
|
|
1090
|
+
options = {};
|
|
1091
|
+
}
|
|
1092
|
+
return {
|
|
1093
|
+
name: 'shift',
|
|
1094
|
+
options,
|
|
1095
|
+
async fn(state) {
|
|
1096
|
+
const {
|
|
1097
|
+
x,
|
|
1098
|
+
y,
|
|
1099
|
+
placement
|
|
1100
|
+
} = state;
|
|
1101
|
+
const {
|
|
1102
|
+
mainAxis: checkMainAxis = true,
|
|
1103
|
+
crossAxis: checkCrossAxis = false,
|
|
1104
|
+
limiter = {
|
|
1105
|
+
fn: _ref => {
|
|
1106
|
+
let {
|
|
1107
|
+
x,
|
|
1108
|
+
y
|
|
1109
|
+
} = _ref;
|
|
1110
|
+
return {
|
|
1111
|
+
x,
|
|
1112
|
+
y
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
},
|
|
1116
|
+
...detectOverflowOptions
|
|
1117
|
+
} = evaluate(options, state);
|
|
1118
|
+
const coords = {
|
|
1119
|
+
x,
|
|
1120
|
+
y
|
|
1121
|
+
};
|
|
1122
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1123
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
1124
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
1125
|
+
let mainAxisCoord = coords[mainAxis];
|
|
1126
|
+
let crossAxisCoord = coords[crossAxis];
|
|
1127
|
+
if (checkMainAxis) {
|
|
1128
|
+
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
1129
|
+
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
1130
|
+
const min = mainAxisCoord + overflow[minSide];
|
|
1131
|
+
const max = mainAxisCoord - overflow[maxSide];
|
|
1132
|
+
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
|
1133
|
+
}
|
|
1134
|
+
if (checkCrossAxis) {
|
|
1135
|
+
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
1136
|
+
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
1137
|
+
const min = crossAxisCoord + overflow[minSide];
|
|
1138
|
+
const max = crossAxisCoord - overflow[maxSide];
|
|
1139
|
+
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
|
1140
|
+
}
|
|
1141
|
+
const limitedCoords = limiter.fn({
|
|
1142
|
+
...state,
|
|
1143
|
+
[mainAxis]: mainAxisCoord,
|
|
1144
|
+
[crossAxis]: crossAxisCoord
|
|
1145
|
+
});
|
|
1146
|
+
return {
|
|
1147
|
+
...limitedCoords,
|
|
1148
|
+
data: {
|
|
1149
|
+
x: limitedCoords.x - x,
|
|
1150
|
+
y: limitedCoords.y - y,
|
|
1151
|
+
enabled: {
|
|
1152
|
+
[mainAxis]: checkMainAxis,
|
|
1153
|
+
[crossAxis]: checkCrossAxis
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
function hasWindow() {
|
|
1162
|
+
return typeof window !== 'undefined';
|
|
1163
|
+
}
|
|
1164
|
+
function getNodeName(node) {
|
|
1165
|
+
if (isNode(node)) {
|
|
1166
|
+
return (node.nodeName || '').toLowerCase();
|
|
1167
|
+
}
|
|
1168
|
+
// Mocked nodes in testing environments may not be instances of Node. By
|
|
1169
|
+
// returning `#document` an infinite loop won't occur.
|
|
1170
|
+
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
1171
|
+
return '#document';
|
|
1172
|
+
}
|
|
1173
|
+
function getWindow(node) {
|
|
1174
|
+
var _node$ownerDocument;
|
|
1175
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
1176
|
+
}
|
|
1177
|
+
function getDocumentElement(node) {
|
|
1178
|
+
var _ref;
|
|
1179
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
1180
|
+
}
|
|
1181
|
+
function isNode(value) {
|
|
1182
|
+
if (!hasWindow()) {
|
|
1183
|
+
return false;
|
|
1184
|
+
}
|
|
1185
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
1186
|
+
}
|
|
1187
|
+
function isElement(value) {
|
|
1188
|
+
if (!hasWindow()) {
|
|
1189
|
+
return false;
|
|
1190
|
+
}
|
|
1191
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
1192
|
+
}
|
|
1193
|
+
function isHTMLElement(value) {
|
|
1194
|
+
if (!hasWindow()) {
|
|
1195
|
+
return false;
|
|
1196
|
+
}
|
|
1197
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
1198
|
+
}
|
|
1199
|
+
function isShadowRoot(value) {
|
|
1200
|
+
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
1201
|
+
return false;
|
|
1202
|
+
}
|
|
1203
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
1204
|
+
}
|
|
1205
|
+
const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
|
|
1206
|
+
function isOverflowElement(element) {
|
|
1207
|
+
const {
|
|
1208
|
+
overflow,
|
|
1209
|
+
overflowX,
|
|
1210
|
+
overflowY,
|
|
1211
|
+
display
|
|
1212
|
+
} = getComputedStyle$1(element);
|
|
1213
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
|
|
1214
|
+
}
|
|
1215
|
+
const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
|
|
1216
|
+
function isTableElement(element) {
|
|
1217
|
+
return tableElements.has(getNodeName(element));
|
|
1218
|
+
}
|
|
1219
|
+
const topLayerSelectors = [':popover-open', ':modal'];
|
|
1220
|
+
function isTopLayer(element) {
|
|
1221
|
+
return topLayerSelectors.some(selector => {
|
|
1222
|
+
try {
|
|
1223
|
+
return element.matches(selector);
|
|
1224
|
+
} catch (_e) {
|
|
1225
|
+
return false;
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
|
|
1230
|
+
const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
|
|
1231
|
+
const containValues = ['paint', 'layout', 'strict', 'content'];
|
|
1232
|
+
function isContainingBlock(elementOrCss) {
|
|
1233
|
+
const webkit = isWebKit();
|
|
1234
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
1235
|
+
|
|
1236
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1237
|
+
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
1238
|
+
return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
|
|
1239
|
+
}
|
|
1240
|
+
function getContainingBlock(element) {
|
|
1241
|
+
let currentNode = getParentNode(element);
|
|
1242
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1243
|
+
if (isContainingBlock(currentNode)) {
|
|
1244
|
+
return currentNode;
|
|
1245
|
+
} else if (isTopLayer(currentNode)) {
|
|
1246
|
+
return null;
|
|
1247
|
+
}
|
|
1248
|
+
currentNode = getParentNode(currentNode);
|
|
1249
|
+
}
|
|
1250
|
+
return null;
|
|
1251
|
+
}
|
|
1252
|
+
function isWebKit() {
|
|
1253
|
+
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
1254
|
+
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
1255
|
+
}
|
|
1256
|
+
const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
|
|
1257
|
+
function isLastTraversableNode(node) {
|
|
1258
|
+
return lastTraversableNodeNames.has(getNodeName(node));
|
|
1259
|
+
}
|
|
1260
|
+
function getComputedStyle$1(element) {
|
|
1261
|
+
return getWindow(element).getComputedStyle(element);
|
|
1262
|
+
}
|
|
1263
|
+
function getNodeScroll(element) {
|
|
1264
|
+
if (isElement(element)) {
|
|
1265
|
+
return {
|
|
1266
|
+
scrollLeft: element.scrollLeft,
|
|
1267
|
+
scrollTop: element.scrollTop
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
return {
|
|
1271
|
+
scrollLeft: element.scrollX,
|
|
1272
|
+
scrollTop: element.scrollY
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
1275
|
+
function getParentNode(node) {
|
|
1276
|
+
if (getNodeName(node) === 'html') {
|
|
1277
|
+
return node;
|
|
1278
|
+
}
|
|
1279
|
+
const result =
|
|
1280
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
1281
|
+
node.assignedSlot ||
|
|
1282
|
+
// DOM Element detected.
|
|
1283
|
+
node.parentNode ||
|
|
1284
|
+
// ShadowRoot detected.
|
|
1285
|
+
isShadowRoot(node) && node.host ||
|
|
1286
|
+
// Fallback.
|
|
1287
|
+
getDocumentElement(node);
|
|
1288
|
+
return isShadowRoot(result) ? result.host : result;
|
|
1289
|
+
}
|
|
1290
|
+
function getNearestOverflowAncestor(node) {
|
|
1291
|
+
const parentNode = getParentNode(node);
|
|
1292
|
+
if (isLastTraversableNode(parentNode)) {
|
|
1293
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
1294
|
+
}
|
|
1295
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
1296
|
+
return parentNode;
|
|
1297
|
+
}
|
|
1298
|
+
return getNearestOverflowAncestor(parentNode);
|
|
1299
|
+
}
|
|
1300
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
1301
|
+
var _node$ownerDocument2;
|
|
1302
|
+
if (list === void 0) {
|
|
1303
|
+
list = [];
|
|
1304
|
+
}
|
|
1305
|
+
if (traverseIframes === void 0) {
|
|
1306
|
+
traverseIframes = true;
|
|
1307
|
+
}
|
|
1308
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
1309
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
1310
|
+
const win = getWindow(scrollableAncestor);
|
|
1311
|
+
if (isBody) {
|
|
1312
|
+
const frameElement = getFrameElement(win);
|
|
1313
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
1314
|
+
}
|
|
1315
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1316
|
+
}
|
|
1317
|
+
function getFrameElement(win) {
|
|
1318
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
function getCssDimensions(element) {
|
|
1322
|
+
const css = getComputedStyle$1(element);
|
|
1323
|
+
// In testing environments, the `width` and `height` properties are empty
|
|
1324
|
+
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
1325
|
+
let width = parseFloat(css.width) || 0;
|
|
1326
|
+
let height = parseFloat(css.height) || 0;
|
|
1327
|
+
const hasOffset = isHTMLElement(element);
|
|
1328
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
1329
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
1330
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
1331
|
+
if (shouldFallback) {
|
|
1332
|
+
width = offsetWidth;
|
|
1333
|
+
height = offsetHeight;
|
|
1334
|
+
}
|
|
1335
|
+
return {
|
|
1336
|
+
width,
|
|
1337
|
+
height,
|
|
1338
|
+
$: shouldFallback
|
|
1339
|
+
};
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
function unwrapElement(element) {
|
|
1343
|
+
return !isElement(element) ? element.contextElement : element;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
function getScale(element) {
|
|
1347
|
+
const domElement = unwrapElement(element);
|
|
1348
|
+
if (!isHTMLElement(domElement)) {
|
|
1349
|
+
return createCoords(1);
|
|
1350
|
+
}
|
|
1351
|
+
const rect = domElement.getBoundingClientRect();
|
|
1352
|
+
const {
|
|
1353
|
+
width,
|
|
1354
|
+
height,
|
|
1355
|
+
$
|
|
1356
|
+
} = getCssDimensions(domElement);
|
|
1357
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
1358
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
1359
|
+
|
|
1360
|
+
// 0, NaN, or Infinity should always fallback to 1.
|
|
1361
|
+
|
|
1362
|
+
if (!x || !Number.isFinite(x)) {
|
|
1363
|
+
x = 1;
|
|
1364
|
+
}
|
|
1365
|
+
if (!y || !Number.isFinite(y)) {
|
|
1366
|
+
y = 1;
|
|
1367
|
+
}
|
|
1368
|
+
return {
|
|
1369
|
+
x,
|
|
1370
|
+
y
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
1375
|
+
function getVisualOffsets(element) {
|
|
1376
|
+
const win = getWindow(element);
|
|
1377
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
1378
|
+
return noOffsets;
|
|
1379
|
+
}
|
|
1380
|
+
return {
|
|
1381
|
+
x: win.visualViewport.offsetLeft,
|
|
1382
|
+
y: win.visualViewport.offsetTop
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1385
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
1386
|
+
if (isFixed === void 0) {
|
|
1387
|
+
isFixed = false;
|
|
1388
|
+
}
|
|
1389
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
1390
|
+
return false;
|
|
1391
|
+
}
|
|
1392
|
+
return isFixed;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
1396
|
+
if (includeScale === void 0) {
|
|
1397
|
+
includeScale = false;
|
|
1398
|
+
}
|
|
1399
|
+
if (isFixedStrategy === void 0) {
|
|
1400
|
+
isFixedStrategy = false;
|
|
1401
|
+
}
|
|
1402
|
+
const clientRect = element.getBoundingClientRect();
|
|
1403
|
+
const domElement = unwrapElement(element);
|
|
1404
|
+
let scale = createCoords(1);
|
|
1405
|
+
if (includeScale) {
|
|
1406
|
+
if (offsetParent) {
|
|
1407
|
+
if (isElement(offsetParent)) {
|
|
1408
|
+
scale = getScale(offsetParent);
|
|
1409
|
+
}
|
|
1410
|
+
} else {
|
|
1411
|
+
scale = getScale(element);
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
1415
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
1416
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
1417
|
+
let width = clientRect.width / scale.x;
|
|
1418
|
+
let height = clientRect.height / scale.y;
|
|
1419
|
+
if (domElement) {
|
|
1420
|
+
const win = getWindow(domElement);
|
|
1421
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1422
|
+
let currentWin = win;
|
|
1423
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
1424
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1425
|
+
const iframeScale = getScale(currentIFrame);
|
|
1426
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1427
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
1428
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1429
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1430
|
+
x *= iframeScale.x;
|
|
1431
|
+
y *= iframeScale.y;
|
|
1432
|
+
width *= iframeScale.x;
|
|
1433
|
+
height *= iframeScale.y;
|
|
1434
|
+
x += left;
|
|
1435
|
+
y += top;
|
|
1436
|
+
currentWin = getWindow(currentIFrame);
|
|
1437
|
+
currentIFrame = getFrameElement(currentWin);
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
return rectToClientRect({
|
|
1441
|
+
width,
|
|
1442
|
+
height,
|
|
1443
|
+
x,
|
|
1444
|
+
y
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1449
|
+
// incorrect for RTL.
|
|
1450
|
+
function getWindowScrollBarX(element, rect) {
|
|
1451
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
1452
|
+
if (!rect) {
|
|
1453
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
1454
|
+
}
|
|
1455
|
+
return rect.left + leftScroll;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
1459
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
1460
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
1461
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
1462
|
+
return {
|
|
1463
|
+
x,
|
|
1464
|
+
y
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1469
|
+
let {
|
|
1470
|
+
elements,
|
|
1471
|
+
rect,
|
|
1472
|
+
offsetParent,
|
|
1473
|
+
strategy
|
|
1474
|
+
} = _ref;
|
|
1475
|
+
const isFixed = strategy === 'fixed';
|
|
1476
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1477
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
1478
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1479
|
+
return rect;
|
|
1480
|
+
}
|
|
1481
|
+
let scroll = {
|
|
1482
|
+
scrollLeft: 0,
|
|
1483
|
+
scrollTop: 0
|
|
1484
|
+
};
|
|
1485
|
+
let scale = createCoords(1);
|
|
1486
|
+
const offsets = createCoords(0);
|
|
1487
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1488
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1489
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1490
|
+
scroll = getNodeScroll(offsetParent);
|
|
1491
|
+
}
|
|
1492
|
+
if (isHTMLElement(offsetParent)) {
|
|
1493
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1494
|
+
scale = getScale(offsetParent);
|
|
1495
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1496
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1500
|
+
return {
|
|
1501
|
+
width: rect.width * scale.x,
|
|
1502
|
+
height: rect.height * scale.y,
|
|
1503
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
1504
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
function getClientRects(element) {
|
|
1509
|
+
return Array.from(element.getClientRects());
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
// Gets the entire size of the scrollable document area, even extending outside
|
|
1513
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
1514
|
+
function getDocumentRect(element) {
|
|
1515
|
+
const html = getDocumentElement(element);
|
|
1516
|
+
const scroll = getNodeScroll(element);
|
|
1517
|
+
const body = element.ownerDocument.body;
|
|
1518
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1519
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1520
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1521
|
+
const y = -scroll.scrollTop;
|
|
1522
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
1523
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1524
|
+
}
|
|
1525
|
+
return {
|
|
1526
|
+
width,
|
|
1527
|
+
height,
|
|
1528
|
+
x,
|
|
1529
|
+
y
|
|
1530
|
+
};
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
1534
|
+
// calculation is affected by unusual styles.
|
|
1535
|
+
// Most scrollbars leave 15-18px of space.
|
|
1536
|
+
const SCROLLBAR_MAX = 25;
|
|
1537
|
+
function getViewportRect(element, strategy) {
|
|
1538
|
+
const win = getWindow(element);
|
|
1539
|
+
const html = getDocumentElement(element);
|
|
1540
|
+
const visualViewport = win.visualViewport;
|
|
1541
|
+
let width = html.clientWidth;
|
|
1542
|
+
let height = html.clientHeight;
|
|
1543
|
+
let x = 0;
|
|
1544
|
+
let y = 0;
|
|
1545
|
+
if (visualViewport) {
|
|
1546
|
+
width = visualViewport.width;
|
|
1547
|
+
height = visualViewport.height;
|
|
1548
|
+
const visualViewportBased = isWebKit();
|
|
1549
|
+
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
1550
|
+
x = visualViewport.offsetLeft;
|
|
1551
|
+
y = visualViewport.offsetTop;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
1555
|
+
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
1556
|
+
// visual width of the <html> but this is not considered in the size
|
|
1557
|
+
// of `html.clientWidth`.
|
|
1558
|
+
if (windowScrollbarX <= 0) {
|
|
1559
|
+
const doc = html.ownerDocument;
|
|
1560
|
+
const body = doc.body;
|
|
1561
|
+
const bodyStyles = getComputedStyle(body);
|
|
1562
|
+
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
1563
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
1564
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
1565
|
+
width -= clippingStableScrollbarWidth;
|
|
1566
|
+
}
|
|
1567
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
1568
|
+
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
1569
|
+
// by the scrollbar amount so there isn't extra space on the right.
|
|
1570
|
+
width += windowScrollbarX;
|
|
1571
|
+
}
|
|
1572
|
+
return {
|
|
1573
|
+
width,
|
|
1574
|
+
height,
|
|
1575
|
+
x,
|
|
1576
|
+
y
|
|
1577
|
+
};
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
|
|
1581
|
+
// Returns the inner client rect, subtracting scrollbars if present.
|
|
1582
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
1583
|
+
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
1584
|
+
const top = clientRect.top + element.clientTop;
|
|
1585
|
+
const left = clientRect.left + element.clientLeft;
|
|
1586
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
1587
|
+
const width = element.clientWidth * scale.x;
|
|
1588
|
+
const height = element.clientHeight * scale.y;
|
|
1589
|
+
const x = left * scale.x;
|
|
1590
|
+
const y = top * scale.y;
|
|
1591
|
+
return {
|
|
1592
|
+
width,
|
|
1593
|
+
height,
|
|
1594
|
+
x,
|
|
1595
|
+
y
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1599
|
+
let rect;
|
|
1600
|
+
if (clippingAncestor === 'viewport') {
|
|
1601
|
+
rect = getViewportRect(element, strategy);
|
|
1602
|
+
} else if (clippingAncestor === 'document') {
|
|
1603
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
1604
|
+
} else if (isElement(clippingAncestor)) {
|
|
1605
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1606
|
+
} else {
|
|
1607
|
+
const visualOffsets = getVisualOffsets(element);
|
|
1608
|
+
rect = {
|
|
1609
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
1610
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
1611
|
+
width: clippingAncestor.width,
|
|
1612
|
+
height: clippingAncestor.height
|
|
1613
|
+
};
|
|
1614
|
+
}
|
|
1615
|
+
return rectToClientRect(rect);
|
|
1616
|
+
}
|
|
1617
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
1618
|
+
const parentNode = getParentNode(element);
|
|
1619
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1620
|
+
return false;
|
|
1621
|
+
}
|
|
1622
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
1626
|
+
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
1627
|
+
// of the given element up the tree.
|
|
1628
|
+
function getClippingElementAncestors(element, cache) {
|
|
1629
|
+
const cachedResult = cache.get(element);
|
|
1630
|
+
if (cachedResult) {
|
|
1631
|
+
return cachedResult;
|
|
1632
|
+
}
|
|
1633
|
+
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
1634
|
+
let currentContainingBlockComputedStyle = null;
|
|
1635
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
1636
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1637
|
+
|
|
1638
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1639
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1640
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
1641
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1642
|
+
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
1643
|
+
currentContainingBlockComputedStyle = null;
|
|
1644
|
+
}
|
|
1645
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1646
|
+
if (shouldDropCurrentNode) {
|
|
1647
|
+
// Drop non-containing blocks.
|
|
1648
|
+
result = result.filter(ancestor => ancestor !== currentNode);
|
|
1649
|
+
} else {
|
|
1650
|
+
// Record last containing block for next iteration.
|
|
1651
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
1652
|
+
}
|
|
1653
|
+
currentNode = getParentNode(currentNode);
|
|
1654
|
+
}
|
|
1655
|
+
cache.set(element, result);
|
|
1656
|
+
return result;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
// Gets the maximum area that the element is visible in due to any number of
|
|
1660
|
+
// clipping ancestors.
|
|
1661
|
+
function getClippingRect(_ref) {
|
|
1662
|
+
let {
|
|
1663
|
+
element,
|
|
1664
|
+
boundary,
|
|
1665
|
+
rootBoundary,
|
|
1666
|
+
strategy
|
|
1667
|
+
} = _ref;
|
|
1668
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1669
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1670
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
1671
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
1672
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
1673
|
+
accRect.top = max(rect.top, accRect.top);
|
|
1674
|
+
accRect.right = min(rect.right, accRect.right);
|
|
1675
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
1676
|
+
accRect.left = max(rect.left, accRect.left);
|
|
1677
|
+
return accRect;
|
|
1678
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
1679
|
+
return {
|
|
1680
|
+
width: clippingRect.right - clippingRect.left,
|
|
1681
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
1682
|
+
x: clippingRect.left,
|
|
1683
|
+
y: clippingRect.top
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
function getDimensions(element) {
|
|
1688
|
+
const {
|
|
1689
|
+
width,
|
|
1690
|
+
height
|
|
1691
|
+
} = getCssDimensions(element);
|
|
1692
|
+
return {
|
|
1693
|
+
width,
|
|
1694
|
+
height
|
|
1695
|
+
};
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1699
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1700
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1701
|
+
const isFixed = strategy === 'fixed';
|
|
1702
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1703
|
+
let scroll = {
|
|
1704
|
+
scrollLeft: 0,
|
|
1705
|
+
scrollTop: 0
|
|
1706
|
+
};
|
|
1707
|
+
const offsets = createCoords(0);
|
|
1708
|
+
|
|
1709
|
+
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
1710
|
+
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
1711
|
+
function setLeftRTLScrollbarOffset() {
|
|
1712
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1713
|
+
}
|
|
1714
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1715
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1716
|
+
scroll = getNodeScroll(offsetParent);
|
|
1717
|
+
}
|
|
1718
|
+
if (isOffsetParentAnElement) {
|
|
1719
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1720
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1721
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1722
|
+
} else if (documentElement) {
|
|
1723
|
+
setLeftRTLScrollbarOffset();
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
1727
|
+
setLeftRTLScrollbarOffset();
|
|
1728
|
+
}
|
|
1729
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1730
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
1731
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
1732
|
+
return {
|
|
1733
|
+
x,
|
|
1734
|
+
y,
|
|
1735
|
+
width: rect.width,
|
|
1736
|
+
height: rect.height
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
function isStaticPositioned(element) {
|
|
1741
|
+
return getComputedStyle$1(element).position === 'static';
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
1745
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
1746
|
+
return null;
|
|
1747
|
+
}
|
|
1748
|
+
if (polyfill) {
|
|
1749
|
+
return polyfill(element);
|
|
1750
|
+
}
|
|
1751
|
+
let rawOffsetParent = element.offsetParent;
|
|
1752
|
+
|
|
1753
|
+
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
|
1754
|
+
// while Chrome and Safari return the <body> element. The <body> element must
|
|
1755
|
+
// be used to perform the correct calculations even if the <html> element is
|
|
1756
|
+
// non-static.
|
|
1757
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
1758
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1759
|
+
}
|
|
1760
|
+
return rawOffsetParent;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
1764
|
+
// such as table ancestors and cross browser bugs.
|
|
1765
|
+
function getOffsetParent(element, polyfill) {
|
|
1766
|
+
const win = getWindow(element);
|
|
1767
|
+
if (isTopLayer(element)) {
|
|
1768
|
+
return win;
|
|
1769
|
+
}
|
|
1770
|
+
if (!isHTMLElement(element)) {
|
|
1771
|
+
let svgOffsetParent = getParentNode(element);
|
|
1772
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1773
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1774
|
+
return svgOffsetParent;
|
|
1775
|
+
}
|
|
1776
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1777
|
+
}
|
|
1778
|
+
return win;
|
|
1779
|
+
}
|
|
1780
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1781
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1782
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1783
|
+
}
|
|
1784
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
1785
|
+
return win;
|
|
1786
|
+
}
|
|
1787
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
const getElementRects = async function (data) {
|
|
1791
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1792
|
+
const getDimensionsFn = this.getDimensions;
|
|
1793
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1794
|
+
return {
|
|
1795
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1796
|
+
floating: {
|
|
1797
|
+
x: 0,
|
|
1798
|
+
y: 0,
|
|
1799
|
+
width: floatingDimensions.width,
|
|
1800
|
+
height: floatingDimensions.height
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1805
|
+
function isRTL(element) {
|
|
1806
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
const platform = {
|
|
1810
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1811
|
+
getDocumentElement,
|
|
1812
|
+
getClippingRect,
|
|
1813
|
+
getOffsetParent,
|
|
1814
|
+
getElementRects,
|
|
1815
|
+
getClientRects,
|
|
1816
|
+
getDimensions,
|
|
1817
|
+
getScale,
|
|
1818
|
+
isElement,
|
|
1819
|
+
isRTL
|
|
1820
|
+
};
|
|
1821
|
+
|
|
1822
|
+
function rectsAreEqual(a, b) {
|
|
1823
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
// https://samthor.au/2021/observing-dom/
|
|
1827
|
+
function observeMove(element, onMove) {
|
|
1828
|
+
let io = null;
|
|
1829
|
+
let timeoutId;
|
|
1830
|
+
const root = getDocumentElement(element);
|
|
1831
|
+
function cleanup() {
|
|
1832
|
+
var _io;
|
|
1833
|
+
clearTimeout(timeoutId);
|
|
1834
|
+
(_io = io) == null || _io.disconnect();
|
|
1835
|
+
io = null;
|
|
1836
|
+
}
|
|
1837
|
+
function refresh(skip, threshold) {
|
|
1838
|
+
if (skip === void 0) {
|
|
1839
|
+
skip = false;
|
|
1840
|
+
}
|
|
1841
|
+
if (threshold === void 0) {
|
|
1842
|
+
threshold = 1;
|
|
1843
|
+
}
|
|
1844
|
+
cleanup();
|
|
1845
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
1846
|
+
const {
|
|
1847
|
+
left,
|
|
1848
|
+
top,
|
|
1849
|
+
width,
|
|
1850
|
+
height
|
|
1851
|
+
} = elementRectForRootMargin;
|
|
1852
|
+
if (!skip) {
|
|
1853
|
+
onMove();
|
|
1854
|
+
}
|
|
1855
|
+
if (!width || !height) {
|
|
1856
|
+
return;
|
|
1857
|
+
}
|
|
1858
|
+
const insetTop = floor(top);
|
|
1859
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
1860
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
1861
|
+
const insetLeft = floor(left);
|
|
1862
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
1863
|
+
const options = {
|
|
1864
|
+
rootMargin,
|
|
1865
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
1866
|
+
};
|
|
1867
|
+
let isFirstUpdate = true;
|
|
1868
|
+
function handleObserve(entries) {
|
|
1869
|
+
const ratio = entries[0].intersectionRatio;
|
|
1870
|
+
if (ratio !== threshold) {
|
|
1871
|
+
if (!isFirstUpdate) {
|
|
1872
|
+
return refresh();
|
|
1873
|
+
}
|
|
1874
|
+
if (!ratio) {
|
|
1875
|
+
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
|
1876
|
+
// to prevent an infinite loop of updates.
|
|
1877
|
+
timeoutId = setTimeout(() => {
|
|
1878
|
+
refresh(false, 1e-7);
|
|
1879
|
+
}, 1000);
|
|
1880
|
+
} else {
|
|
1881
|
+
refresh(false, ratio);
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
1885
|
+
// It's possible that even though the ratio is reported as 1, the
|
|
1886
|
+
// element is not actually fully within the IntersectionObserver's root
|
|
1887
|
+
// area anymore. This can happen under performance constraints. This may
|
|
1888
|
+
// be a bug in the browser's IntersectionObserver implementation. To
|
|
1889
|
+
// work around this, we compare the element's bounding rect now with
|
|
1890
|
+
// what it was at the time we created the IntersectionObserver. If they
|
|
1891
|
+
// are not equal then the element moved, so we refresh.
|
|
1892
|
+
refresh();
|
|
1893
|
+
}
|
|
1894
|
+
isFirstUpdate = false;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
// Older browsers don't support a `document` as the root and will throw an
|
|
1898
|
+
// error.
|
|
1899
|
+
try {
|
|
1900
|
+
io = new IntersectionObserver(handleObserve, {
|
|
1901
|
+
...options,
|
|
1902
|
+
// Handle <iframe>s
|
|
1903
|
+
root: root.ownerDocument
|
|
1904
|
+
});
|
|
1905
|
+
} catch (_e) {
|
|
1906
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
1907
|
+
}
|
|
1908
|
+
io.observe(element);
|
|
1909
|
+
}
|
|
1910
|
+
refresh(true);
|
|
1911
|
+
return cleanup;
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
/**
|
|
1915
|
+
* Automatically updates the position of the floating element when necessary.
|
|
1916
|
+
* Should only be called when the floating element is mounted on the DOM or
|
|
1917
|
+
* visible on the screen.
|
|
1918
|
+
* @returns cleanup function that should be invoked when the floating element is
|
|
1919
|
+
* removed from the DOM or hidden from the screen.
|
|
1920
|
+
* @see https://floating-ui.com/docs/autoUpdate
|
|
1921
|
+
*/
|
|
1922
|
+
function autoUpdate(reference, floating, update, options) {
|
|
1923
|
+
if (options === void 0) {
|
|
1924
|
+
options = {};
|
|
1925
|
+
}
|
|
1926
|
+
const {
|
|
1927
|
+
ancestorScroll = true,
|
|
1928
|
+
ancestorResize = true,
|
|
1929
|
+
elementResize = typeof ResizeObserver === 'function',
|
|
1930
|
+
layoutShift = typeof IntersectionObserver === 'function',
|
|
1931
|
+
animationFrame = false
|
|
1932
|
+
} = options;
|
|
1933
|
+
const referenceEl = unwrapElement(reference);
|
|
1934
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
|
1935
|
+
ancestors.forEach(ancestor => {
|
|
1936
|
+
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
1937
|
+
passive: true
|
|
1938
|
+
});
|
|
1939
|
+
ancestorResize && ancestor.addEventListener('resize', update);
|
|
1940
|
+
});
|
|
1941
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
1942
|
+
let reobserveFrame = -1;
|
|
1943
|
+
let resizeObserver = null;
|
|
1944
|
+
if (elementResize) {
|
|
1945
|
+
resizeObserver = new ResizeObserver(_ref => {
|
|
1946
|
+
let [firstEntry] = _ref;
|
|
1947
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
1948
|
+
// Prevent update loops when using the `size` middleware.
|
|
1949
|
+
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
1950
|
+
resizeObserver.unobserve(floating);
|
|
1951
|
+
cancelAnimationFrame(reobserveFrame);
|
|
1952
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
1953
|
+
var _resizeObserver;
|
|
1954
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1957
|
+
update();
|
|
1958
|
+
});
|
|
1959
|
+
if (referenceEl && !animationFrame) {
|
|
1960
|
+
resizeObserver.observe(referenceEl);
|
|
1961
|
+
}
|
|
1962
|
+
resizeObserver.observe(floating);
|
|
1963
|
+
}
|
|
1964
|
+
let frameId;
|
|
1965
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
1966
|
+
if (animationFrame) {
|
|
1967
|
+
frameLoop();
|
|
1968
|
+
}
|
|
1969
|
+
function frameLoop() {
|
|
1970
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
1971
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
1972
|
+
update();
|
|
1973
|
+
}
|
|
1974
|
+
prevRefRect = nextRefRect;
|
|
1975
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
1976
|
+
}
|
|
1977
|
+
update();
|
|
1978
|
+
return () => {
|
|
1979
|
+
var _resizeObserver2;
|
|
1980
|
+
ancestors.forEach(ancestor => {
|
|
1981
|
+
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
1982
|
+
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
1983
|
+
});
|
|
1984
|
+
cleanupIo == null || cleanupIo();
|
|
1985
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
1986
|
+
resizeObserver = null;
|
|
1987
|
+
if (animationFrame) {
|
|
1988
|
+
cancelAnimationFrame(frameId);
|
|
1989
|
+
}
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
/**
|
|
1994
|
+
* Modifies the placement by translating the floating element along the
|
|
1995
|
+
* specified axes.
|
|
1996
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
1997
|
+
* object may be passed.
|
|
1998
|
+
* @see https://floating-ui.com/docs/offset
|
|
1999
|
+
*/
|
|
2000
|
+
const offset = offset$1;
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
2004
|
+
* that has the most space available automatically, without needing to specify a
|
|
2005
|
+
* preferred placement. Alternative to `flip`.
|
|
2006
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
2007
|
+
*/
|
|
2008
|
+
const autoPlacement = autoPlacement$1;
|
|
2009
|
+
|
|
2010
|
+
/**
|
|
2011
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
2012
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
2013
|
+
* @see https://floating-ui.com/docs/shift
|
|
2014
|
+
*/
|
|
2015
|
+
const shift = shift$1;
|
|
2016
|
+
|
|
2017
|
+
/**
|
|
2018
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
2019
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
2020
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
2021
|
+
* @see https://floating-ui.com/docs/flip
|
|
2022
|
+
*/
|
|
2023
|
+
const flip = flip$1;
|
|
2024
|
+
|
|
2025
|
+
/**
|
|
2026
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
2027
|
+
* next to a given reference element.
|
|
2028
|
+
*/
|
|
2029
|
+
const computePosition = (reference, floating, options) => {
|
|
2030
|
+
// This caches the expensive `getClippingElementAncestors` function so that
|
|
2031
|
+
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
2032
|
+
// single call. If other functions become expensive, we can add them as well.
|
|
2033
|
+
const cache = new Map();
|
|
2034
|
+
const mergedOptions = {
|
|
2035
|
+
platform,
|
|
2036
|
+
...options
|
|
2037
|
+
};
|
|
2038
|
+
const platformWithCache = {
|
|
2039
|
+
...mergedOptions.platform,
|
|
2040
|
+
_c: cache
|
|
2041
|
+
};
|
|
2042
|
+
return computePosition$1(reference, floating, {
|
|
2043
|
+
...mergedOptions,
|
|
2044
|
+
platform: platformWithCache
|
|
2045
|
+
});
|
|
2046
|
+
};
|
|
2047
|
+
|
|
2048
|
+
/* eslint-disable line-comment-position, no-inline-comments */
|
|
2049
|
+
|
|
2050
|
+
|
|
2051
|
+
const MAX_CONFIGURATION_COUNT = 10;
|
|
2052
|
+
|
|
2053
|
+
class AuroFloatingUI {
|
|
2054
|
+
/**
|
|
2055
|
+
* @private
|
|
2056
|
+
*/
|
|
2057
|
+
static isMousePressed = false;
|
|
2058
|
+
|
|
2059
|
+
/**
|
|
2060
|
+
* @private
|
|
2061
|
+
*/
|
|
2062
|
+
static isMousePressHandlerInitialized = false;
|
|
2063
|
+
|
|
2064
|
+
/**
|
|
2065
|
+
* @private
|
|
2066
|
+
*/
|
|
2067
|
+
static setupMousePressChecker() {
|
|
2068
|
+
if (
|
|
2069
|
+
!AuroFloatingUI.isMousePressHandlerInitialized &&
|
|
2070
|
+
window &&
|
|
2071
|
+
window.addEventListener
|
|
2072
|
+
) {
|
|
2073
|
+
AuroFloatingUI.isMousePressHandlerInitialized = true;
|
|
2074
|
+
|
|
2075
|
+
// Track timeout for isMousePressed reset to avoid race conditions
|
|
2076
|
+
if (!AuroFloatingUI._mousePressedTimeout) {
|
|
2077
|
+
AuroFloatingUI._mousePressedTimeout = null;
|
|
2078
|
+
}
|
|
2079
|
+
const mouseEventGlobalHandler = (event) => {
|
|
2080
|
+
const isPressed = event.type === "mousedown";
|
|
2081
|
+
if (isPressed) {
|
|
2082
|
+
// Clear any pending timeout to prevent race condition
|
|
2083
|
+
if (AuroFloatingUI._mousePressedTimeout !== null) {
|
|
2084
|
+
clearTimeout(AuroFloatingUI._mousePressedTimeout);
|
|
2085
|
+
AuroFloatingUI._mousePressedTimeout = null;
|
|
2086
|
+
}
|
|
2087
|
+
if (!AuroFloatingUI.isMousePressed) {
|
|
2088
|
+
AuroFloatingUI.isMousePressed = true;
|
|
2089
|
+
}
|
|
2090
|
+
} else if (AuroFloatingUI.isMousePressed && !isPressed) {
|
|
2091
|
+
// Schedule reset and track timeout ID
|
|
2092
|
+
AuroFloatingUI._mousePressedTimeout = setTimeout(() => {
|
|
2093
|
+
AuroFloatingUI.isMousePressed = false;
|
|
2094
|
+
AuroFloatingUI._mousePressedTimeout = null;
|
|
2095
|
+
}, 0);
|
|
2096
|
+
}
|
|
2097
|
+
};
|
|
2098
|
+
|
|
2099
|
+
window.addEventListener("mousedown", mouseEventGlobalHandler);
|
|
2100
|
+
window.addEventListener("mouseup", mouseEventGlobalHandler);
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
static openingQueue = [];
|
|
2105
|
+
|
|
2106
|
+
/**
|
|
2107
|
+
* Returns the currently active floating UI instance that should be considered "on top".
|
|
2108
|
+
* Prefers any globally tracked expanded dropdown or floater, falling back to the last entry in the local opening queue.
|
|
2109
|
+
*
|
|
2110
|
+
* This getter first checks the global document references for a visible floating UI and returns it if found.
|
|
2111
|
+
* If the global reference is stale or not visible, it clears those references and instead returns the most recently opened instance from `openingQueue`, or `null` if none exist.
|
|
2112
|
+
*
|
|
2113
|
+
* Side effect: clears stale global refs so callers don't need a separate cleanup step.
|
|
2114
|
+
*/
|
|
2115
|
+
static get topOpeningFloatingUI() {
|
|
2116
|
+
const existedVisibleFloatingUI =
|
|
2117
|
+
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
2118
|
+
if (
|
|
2119
|
+
existedVisibleFloatingUI &&
|
|
2120
|
+
existedVisibleFloatingUI.element.isPopoverVisible
|
|
2121
|
+
) {
|
|
2122
|
+
return existedVisibleFloatingUI;
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
// clear existedVisibleFloatingUI in case it's not flushed well when it hidden by other reasons (e.g. noToggle + click)
|
|
2126
|
+
document.expandedAuroFormkitDropdown = null;
|
|
2127
|
+
document.expandedAuroFloater = null;
|
|
2128
|
+
|
|
2129
|
+
return AuroFloatingUI.openingQueue.length > 0
|
|
2130
|
+
? AuroFloatingUI.openingQueue[AuroFloatingUI.openingQueue.length - 1]
|
|
2131
|
+
: null;
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
constructor(element, behavior) {
|
|
2135
|
+
this.element = element;
|
|
2136
|
+
this.behavior = behavior;
|
|
2137
|
+
|
|
2138
|
+
// Store event listener references for cleanup
|
|
2139
|
+
this.focusHandler = null;
|
|
2140
|
+
this.clickHandler = null;
|
|
2141
|
+
this.keyDownHandler = null;
|
|
2142
|
+
this.touchHandler = null;
|
|
2143
|
+
|
|
2144
|
+
/**
|
|
2145
|
+
* @private
|
|
2146
|
+
*/
|
|
2147
|
+
this.enableKeyboardHandling = true;
|
|
2148
|
+
|
|
2149
|
+
/**
|
|
2150
|
+
* @private
|
|
2151
|
+
*/
|
|
2152
|
+
this.configureTrial = 0;
|
|
2153
|
+
|
|
2154
|
+
/**
|
|
2155
|
+
* @private
|
|
2156
|
+
*/
|
|
2157
|
+
this.eventPrefix = undefined;
|
|
2158
|
+
|
|
2159
|
+
/**
|
|
2160
|
+
* @private
|
|
2161
|
+
*/
|
|
2162
|
+
this.id = undefined;
|
|
2163
|
+
|
|
2164
|
+
/**
|
|
2165
|
+
* @private
|
|
2166
|
+
*/
|
|
2167
|
+
this.showing = false;
|
|
2168
|
+
|
|
2169
|
+
/**
|
|
2170
|
+
* @private
|
|
2171
|
+
*/
|
|
2172
|
+
this.strategy = undefined;
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
/**
|
|
2176
|
+
* Mirrors the size of the bibSizer element to the bib content.
|
|
2177
|
+
* Copies the width, height, max-width, and max-height styles from the bibSizer element to the bib content container.
|
|
2178
|
+
* This ensures that the bib content has the same dimensions as the sizer element.
|
|
2179
|
+
*/
|
|
2180
|
+
mirrorSize() {
|
|
2181
|
+
const element = this.element;
|
|
2182
|
+
if (!element) {
|
|
2183
|
+
return;
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
// mirror the boxsize from bibSizer
|
|
2187
|
+
if (element.bibSizer && element.matchWidth && element.bib?.shadowRoot) {
|
|
2188
|
+
const sizerStyle = window.getComputedStyle(element.bibSizer);
|
|
2189
|
+
const bibContent = element.bib.shadowRoot.querySelector(".container");
|
|
2190
|
+
if (!bibContent) {
|
|
2191
|
+
return;
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
if (sizerStyle.width !== "0px") {
|
|
2195
|
+
bibContent.style.width = sizerStyle.width;
|
|
2196
|
+
}
|
|
2197
|
+
if (sizerStyle.height !== "0px") {
|
|
2198
|
+
bibContent.style.height = sizerStyle.height;
|
|
2199
|
+
}
|
|
2200
|
+
bibContent.style.maxWidth = sizerStyle.maxWidth;
|
|
2201
|
+
bibContent.style.maxHeight = sizerStyle.maxHeight;
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
/**
|
|
2206
|
+
* @private
|
|
2207
|
+
* Determines the positioning strategy based on the current viewport size and mobile breakpoint.
|
|
2208
|
+
*
|
|
2209
|
+
* This method checks if the current viewport width is less than or equal to the specified mobile fullscreen breakpoint
|
|
2210
|
+
* defined in the bib element. If it is, the strategy is set to 'fullscreen'; otherwise, it defaults to 'floating'.
|
|
2211
|
+
*
|
|
2212
|
+
* @returns {String} The positioning strategy, one of 'fullscreen', 'floating', 'cover'.
|
|
2213
|
+
*/
|
|
2214
|
+
getPositioningStrategy() {
|
|
2215
|
+
const element = this.element;
|
|
2216
|
+
if (!element) {
|
|
2217
|
+
return "floating";
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
const breakpoint =
|
|
2221
|
+
element.bib?.mobileFullscreenBreakpoint ||
|
|
2222
|
+
element.floaterConfig?.fullscreenBreakpoint;
|
|
2223
|
+
switch (this.behavior) {
|
|
2224
|
+
case "tooltip":
|
|
2225
|
+
return "floating";
|
|
2226
|
+
case "dialog":
|
|
2227
|
+
case "drawer":
|
|
2228
|
+
if (breakpoint) {
|
|
2229
|
+
const smallerThanBreakpoint = window.matchMedia(
|
|
2230
|
+
`(max-width: ${breakpoint})`,
|
|
2231
|
+
).matches;
|
|
2232
|
+
|
|
2233
|
+
this.element.expanded = smallerThanBreakpoint;
|
|
2234
|
+
|
|
2235
|
+
if (this.element.nested) {
|
|
2236
|
+
return "cover";
|
|
2237
|
+
}
|
|
2238
|
+
return smallerThanBreakpoint || this.element.modal
|
|
2239
|
+
? "fullscreen"
|
|
2240
|
+
: "dialog";
|
|
2241
|
+
}
|
|
2242
|
+
return "dialog";
|
|
2243
|
+
case "dropdown":
|
|
2244
|
+
case undefined:
|
|
2245
|
+
case null:
|
|
2246
|
+
if (breakpoint) {
|
|
2247
|
+
const smallerThanBreakpoint = window.matchMedia(
|
|
2248
|
+
`(max-width: ${breakpoint})`,
|
|
2249
|
+
).matches;
|
|
2250
|
+
if (smallerThanBreakpoint) {
|
|
2251
|
+
return "fullscreen";
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
return "floating";
|
|
2255
|
+
default:
|
|
2256
|
+
return this.behavior;
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
/**
|
|
2261
|
+
* @private
|
|
2262
|
+
* Positions the bib element based on the current configuration and positioning strategy.
|
|
2263
|
+
*
|
|
2264
|
+
* This method determines the appropriate positioning strategy (fullscreen or not) and configures the bib accordingly.
|
|
2265
|
+
* It also sets up middleware for the floater configuration, computes the position of the bib relative to the trigger element,
|
|
2266
|
+
* and applies the calculated position to the bib's style.
|
|
2267
|
+
*/
|
|
2268
|
+
position() {
|
|
2269
|
+
const element = this.element;
|
|
2270
|
+
if (!element) {
|
|
2271
|
+
return;
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
const strategy = this.getPositioningStrategy();
|
|
2275
|
+
this.configureBibStrategy(strategy);
|
|
2276
|
+
|
|
2277
|
+
if (strategy === "floating") {
|
|
2278
|
+
if (!element.trigger || !element.bib) {
|
|
2279
|
+
return;
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
this.mirrorSize();
|
|
2283
|
+
// Define the middlware for the floater configuration
|
|
2284
|
+
const middleware = [
|
|
2285
|
+
offset(element.floaterConfig?.offset || 0),
|
|
2286
|
+
...(element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
|
|
2287
|
+
...(element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
|
|
2288
|
+
...(element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
|
|
2289
|
+
];
|
|
2290
|
+
|
|
2291
|
+
// Compute the position of the bib
|
|
2292
|
+
computePosition(element.trigger, element.bib, {
|
|
2293
|
+
strategy: element.floaterConfig?.strategy || "fixed",
|
|
2294
|
+
placement: element.floaterConfig?.placement,
|
|
2295
|
+
middleware: middleware || [],
|
|
2296
|
+
}).then(({ x, y }) => {
|
|
2297
|
+
// eslint-disable-line id-length
|
|
2298
|
+
const currentElement = this.element;
|
|
2299
|
+
if (!currentElement?.bib) {
|
|
2300
|
+
return;
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
Object.assign(currentElement.bib.style, {
|
|
2304
|
+
left: `${x}px`,
|
|
2305
|
+
top: `${y}px`,
|
|
2306
|
+
});
|
|
2307
|
+
});
|
|
2308
|
+
} else if (strategy === "cover") {
|
|
2309
|
+
if (!element.parentNode || !element.bib) {
|
|
2310
|
+
return;
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
// Compute the position of the bib
|
|
2314
|
+
computePosition(element.parentNode, element.bib, {
|
|
2315
|
+
placement: "bottom-start",
|
|
2316
|
+
}).then(({ x, y }) => {
|
|
2317
|
+
// eslint-disable-line id-length
|
|
2318
|
+
const currentElement = this.element;
|
|
2319
|
+
if (!currentElement?.bib || !currentElement.parentNode) {
|
|
2320
|
+
return;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
Object.assign(currentElement.bib.style, {
|
|
2324
|
+
left: `${x}px`,
|
|
2325
|
+
top: `${y - currentElement.parentNode.offsetHeight}px`,
|
|
2326
|
+
width: `${currentElement.parentNode.offsetWidth}px`,
|
|
2327
|
+
height: `${currentElement.parentNode.offsetHeight}px`,
|
|
2328
|
+
});
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
/**
|
|
2334
|
+
* @private
|
|
2335
|
+
* Controls whether to lock the scrolling for the document's body.
|
|
2336
|
+
* @param {Boolean} lock - If true, locks the body's scrolling functionlity; otherwise, unlock.
|
|
2337
|
+
*/
|
|
2338
|
+
lockScroll(lock = true) {
|
|
2339
|
+
const element = this.element;
|
|
2340
|
+
|
|
2341
|
+
if (!element?.bib) {
|
|
2342
|
+
return;
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
const dialog = (
|
|
2346
|
+
element.bib?.shadowRoot ||
|
|
2347
|
+
element.bib ||
|
|
2348
|
+
element
|
|
2349
|
+
).querySelector("dialog");
|
|
2350
|
+
if (dialog) {
|
|
2351
|
+
if (lock) {
|
|
2352
|
+
dialog.setAttribute("aria-modal", "true");
|
|
2353
|
+
} else {
|
|
2354
|
+
dialog.removeAttribute("aria-modal");
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
if (lock) {
|
|
2359
|
+
if (!this._scrollLocked) {
|
|
2360
|
+
this._scrollLocked = true;
|
|
2361
|
+
this._savedScrollY = window.scrollY;
|
|
2362
|
+
this._savedScrollStyles = {
|
|
2363
|
+
rootScrollbarGutter: document.documentElement.style.scrollbarGutter,
|
|
2364
|
+
rootOverflow: document.documentElement.style.overflow,
|
|
2365
|
+
bodyOverflow: document.body.style.overflow,
|
|
2366
|
+
bodyPosition: document.body.style.position,
|
|
2367
|
+
bodyTop: document.body.style.top,
|
|
2368
|
+
bodyWidth: document.body.style.width,
|
|
2369
|
+
bibTransform: element?.bib?.style.transform,
|
|
2370
|
+
};
|
|
2371
|
+
document.documentElement.style.scrollbarGutter = "stable";
|
|
2372
|
+
document.documentElement.style.overflow = "hidden";
|
|
2373
|
+
document.body.style.overflow = "hidden";
|
|
2374
|
+
|
|
2375
|
+
// position:fixed is the only way to block VoiceOver three-finger swipe,
|
|
2376
|
+
// which bypasses both overflow:hidden and touchmove preventDefault.
|
|
2377
|
+
document.body.style.position = "fixed";
|
|
2378
|
+
document.body.style.top = `-${this._savedScrollY}px`;
|
|
2379
|
+
document.body.style.width = "100%";
|
|
2380
|
+
|
|
2381
|
+
// Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
|
|
2382
|
+
if (element?.bib && window?.visualViewport?.offsetTop) {
|
|
2383
|
+
element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
this.lockTouchScroll(true);
|
|
2387
|
+
}
|
|
2388
|
+
} else {
|
|
2389
|
+
if (this._scrollLocked) {
|
|
2390
|
+
document.documentElement.style.scrollbarGutter =
|
|
2391
|
+
this._savedScrollStyles?.rootScrollbarGutter ?? "";
|
|
2392
|
+
document.documentElement.style.overflow =
|
|
2393
|
+
this._savedScrollStyles?.rootOverflow ?? "";
|
|
2394
|
+
document.body.style.overflow =
|
|
2395
|
+
this._savedScrollStyles?.bodyOverflow ?? "";
|
|
2396
|
+
document.body.style.position =
|
|
2397
|
+
this._savedScrollStyles?.bodyPosition ?? "";
|
|
2398
|
+
document.body.style.top = this._savedScrollStyles?.bodyTop ?? "";
|
|
2399
|
+
document.body.style.width = this._savedScrollStyles?.bodyWidth ?? "";
|
|
2400
|
+
if (element?.bib) {
|
|
2401
|
+
element.bib.style.transform =
|
|
2402
|
+
this._savedScrollStyles?.bibTransform ?? "";
|
|
2403
|
+
}
|
|
2404
|
+
window.scrollTo(0, this._savedScrollY || 0);
|
|
2405
|
+
this._savedScrollY = undefined;
|
|
2406
|
+
this._savedScrollStyles = undefined;
|
|
2407
|
+
this._scrollLocked = false;
|
|
2408
|
+
|
|
2409
|
+
this.lockTouchScroll(false);
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
/**
|
|
2415
|
+
* Locks page-level touch scroll while bib is open.
|
|
2416
|
+
* Walks composedPath() so scrollable children inside the dialog still scroll.
|
|
2417
|
+
* @private
|
|
2418
|
+
*/
|
|
2419
|
+
lockTouchScroll(lock = true) {
|
|
2420
|
+
if (lock) {
|
|
2421
|
+
if (this._boundTouchMoveHandler) {
|
|
2422
|
+
return;
|
|
2423
|
+
}
|
|
2424
|
+
this._boundTouchMoveHandler = (e) => {
|
|
2425
|
+
const path = e.composedPath();
|
|
2426
|
+
const insideScrollable = path.some(
|
|
2427
|
+
(el) =>
|
|
2428
|
+
el !== document &&
|
|
2429
|
+
el !== document.documentElement &&
|
|
2430
|
+
el !== document.body &&
|
|
2431
|
+
(el.scrollHeight > el.clientHeight ||
|
|
2432
|
+
el.scrollWidth > el.clientWidth),
|
|
2433
|
+
);
|
|
2434
|
+
if (!insideScrollable) {
|
|
2435
|
+
e.preventDefault();
|
|
2436
|
+
}
|
|
2437
|
+
};
|
|
2438
|
+
document.addEventListener("touchmove", this._boundTouchMoveHandler, {
|
|
2439
|
+
passive: false,
|
|
2440
|
+
});
|
|
2441
|
+
} else if (this._boundTouchMoveHandler) {
|
|
2442
|
+
document.removeEventListener("touchmove", this._boundTouchMoveHandler, {
|
|
2443
|
+
passive: false,
|
|
2444
|
+
});
|
|
2445
|
+
this._boundTouchMoveHandler = undefined;
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
/**
|
|
2450
|
+
* @private
|
|
2451
|
+
* Configures the bib element's display strategy.
|
|
2452
|
+
*
|
|
2453
|
+
* Sets the bib to fullscreen or floating mode based on the provided strategy.
|
|
2454
|
+
* Dispatches a 'strategy-change' event if the strategy changes.
|
|
2455
|
+
*
|
|
2456
|
+
* @param {string} strategy - The positioning strategy ('fullscreen' or 'floating').
|
|
2457
|
+
*/
|
|
2458
|
+
configureBibStrategy(value) {
|
|
2459
|
+
const element = this.element;
|
|
2460
|
+
if (!element?.bib) {
|
|
2461
|
+
return;
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
if (value === "fullscreen" || value === "dialog") {
|
|
2465
|
+
element.isBibFullscreen = true;
|
|
2466
|
+
// reset the prev position
|
|
2467
|
+
element.bib.setAttribute("isfullscreen", "");
|
|
2468
|
+
element.bib.style.position = "fixed";
|
|
2469
|
+
element.bib.style.top = "0px";
|
|
2470
|
+
element.bib.style.left = "0px";
|
|
2471
|
+
element.bib.style.width = "";
|
|
2472
|
+
element.bib.style.height = "";
|
|
2473
|
+
element.style.contain = "";
|
|
2474
|
+
|
|
2475
|
+
// reset the size that was mirroring `size` css-part
|
|
2476
|
+
const bibContent = element.bib.shadowRoot?.querySelector(".container");
|
|
2477
|
+
if (bibContent) {
|
|
2478
|
+
bibContent.style.width = "";
|
|
2479
|
+
bibContent.style.height = "";
|
|
2480
|
+
bibContent.style.maxWidth = "";
|
|
2481
|
+
bibContent.style.maxHeight = `${window?.visualViewport?.height}px`;
|
|
2482
|
+
this.configureTrial = 0;
|
|
2483
|
+
} else if (this.configureTrial < MAX_CONFIGURATION_COUNT) {
|
|
2484
|
+
this.configureTrial += 1;
|
|
2485
|
+
|
|
2486
|
+
setTimeout(() => {
|
|
2487
|
+
this.configureBibStrategy(value);
|
|
2488
|
+
}, 0);
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
if (element.isPopoverVisible) {
|
|
2492
|
+
this.lockScroll(value === "fullscreen");
|
|
2493
|
+
}
|
|
2494
|
+
} else {
|
|
2495
|
+
element.bib.style.position = "";
|
|
2496
|
+
element.bib.removeAttribute("isfullscreen");
|
|
2497
|
+
element.isBibFullscreen = false;
|
|
2498
|
+
element.style.contain = "layout";
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
const isChanged = this.strategy && this.strategy !== value;
|
|
2502
|
+
this.strategy = value;
|
|
2503
|
+
if (isChanged) {
|
|
2504
|
+
const event = new CustomEvent(
|
|
2505
|
+
this.eventPrefix
|
|
2506
|
+
? `${this.eventPrefix}-strategy-change`
|
|
2507
|
+
: "strategy-change",
|
|
2508
|
+
{
|
|
2509
|
+
detail: {
|
|
2510
|
+
value,
|
|
2511
|
+
},
|
|
2512
|
+
composed: true,
|
|
2513
|
+
},
|
|
2514
|
+
);
|
|
2515
|
+
|
|
2516
|
+
element.dispatchEvent(event);
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
updateState() {
|
|
2521
|
+
const element = this.element;
|
|
2522
|
+
if (!element) {
|
|
2523
|
+
return;
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
const isVisible = element.isPopoverVisible;
|
|
2527
|
+
if (!isVisible) {
|
|
2528
|
+
this.cleanupHideHandlers();
|
|
2529
|
+
try {
|
|
2530
|
+
element.cleanup?.();
|
|
2531
|
+
} catch (error) {
|
|
2532
|
+
// Do nothing
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
/**
|
|
2538
|
+
* @private
|
|
2539
|
+
* getting called on 'blur' in trigger or `focusin` in document
|
|
2540
|
+
*
|
|
2541
|
+
* Hides the bib if focus moves outside of the trigger or bib, unless a 'noHideOnThisFocusLoss' flag is set.
|
|
2542
|
+
* This method checks if the currently active element is still within the trigger or bib.
|
|
2543
|
+
* If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
|
|
2544
|
+
*/
|
|
2545
|
+
handleFocusLoss() {
|
|
2546
|
+
const element = this.element;
|
|
2547
|
+
if (!element?.bib) {
|
|
2548
|
+
return;
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
// if mouse is being pressed, skip and let click event to handle the action
|
|
2552
|
+
if (AuroFloatingUI.isMousePressed) {
|
|
2553
|
+
return;
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
if (
|
|
2557
|
+
element.noHideOnThisFocusLoss ||
|
|
2558
|
+
element.hasAttribute("noHideOnThisFocusLoss")
|
|
2559
|
+
) {
|
|
2560
|
+
return;
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
// if focus is still inside of trigger or bib, do not close
|
|
2564
|
+
if (element.matches(":focus") || element.matches(":focus-within")) {
|
|
2565
|
+
return;
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
// Chrome-specific: during popover top-layer promotion after a click on a
|
|
2569
|
+
// slotted focusable, :focus-within can briefly evaluate false while the
|
|
2570
|
+
// active element is still structurally inside the trigger/bib. Fall back
|
|
2571
|
+
// to a shadow-piercing ancestry walk from the deep active element before
|
|
2572
|
+
// treating this as a real focus loss.
|
|
2573
|
+
try {
|
|
2574
|
+
let active = document.activeElement;
|
|
2575
|
+
while (active && active.shadowRoot && active.shadowRoot.activeElement) {
|
|
2576
|
+
active = active.shadowRoot.activeElement;
|
|
2577
|
+
}
|
|
2578
|
+
const targets = [element, element.trigger, element.bib].filter(Boolean);
|
|
2579
|
+
let node = active;
|
|
2580
|
+
while (node) {
|
|
2581
|
+
if (targets.includes(node)) {
|
|
2582
|
+
return;
|
|
2583
|
+
}
|
|
2584
|
+
node =
|
|
2585
|
+
node.parentElement ||
|
|
2586
|
+
(node.getRootNode && node.getRootNode().host) ||
|
|
2587
|
+
null;
|
|
2588
|
+
}
|
|
2589
|
+
} catch (e) {
|
|
2590
|
+
// Defensive: fall through to the existing close path if traversal fails.
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
// if fullscreen bib is in fullscreen mode, do not close
|
|
2594
|
+
if (element.bib.hasAttribute("isfullscreen")) {
|
|
2595
|
+
return;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
// eventType "focusloss" distinguishes a Tab/click-driven close from an
|
|
2599
|
+
// Escape keydown close. Consumers use this to decide whether to restore
|
|
2600
|
+
// focus to the trigger (Escape) or let it advance naturally (Tab).
|
|
2601
|
+
this.hideBib("focusloss");
|
|
2602
|
+
}
|
|
2603
|
+
|
|
2604
|
+
setupHideHandlers() {
|
|
2605
|
+
const element = this.element;
|
|
2606
|
+
if (!element) {
|
|
2607
|
+
return;
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
// Define handlers & store references
|
|
2611
|
+
this.focusHandler = () => this.handleFocusLoss();
|
|
2612
|
+
|
|
2613
|
+
this.clickHandler = (evt) => {
|
|
2614
|
+
const element = this.element;
|
|
2615
|
+
if (!element?.bib) {
|
|
2616
|
+
return;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
// When the bib is fullscreen (modal dialog), don't close on outside
|
|
2620
|
+
// clicks. VoiceOver's synthetic click events inside a top-layer modal
|
|
2621
|
+
// <dialog> may not include the bib in composedPath(), causing false
|
|
2622
|
+
// positives. This mirrors the fullscreen guard in handleFocusLoss().
|
|
2623
|
+
if (element.bib.hasAttribute("isfullscreen")) {
|
|
2624
|
+
return;
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
if (
|
|
2628
|
+
(!evt.composedPath().includes(element.trigger) &&
|
|
2629
|
+
!evt.composedPath().includes(element.bib)) ||
|
|
2630
|
+
(element.bib.backdrop &&
|
|
2631
|
+
evt.composedPath().includes(element.bib.backdrop))
|
|
2632
|
+
) {
|
|
2633
|
+
const existedVisibleFloatingUI =
|
|
2634
|
+
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
2635
|
+
|
|
2636
|
+
if (
|
|
2637
|
+
existedVisibleFloatingUI &&
|
|
2638
|
+
existedVisibleFloatingUI.element.isPopoverVisible
|
|
2639
|
+
) {
|
|
2640
|
+
// if something else is open, close that
|
|
2641
|
+
existedVisibleFloatingUI.hideBib();
|
|
2642
|
+
document.expandedAuroFormkitDropdown = null;
|
|
2643
|
+
document.expandedAuroFloater = this;
|
|
2644
|
+
} else {
|
|
2645
|
+
this.hideBib("click");
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
};
|
|
2649
|
+
|
|
2650
|
+
// ESC key handler
|
|
2651
|
+
this.keyDownHandler = (evt) => {
|
|
2652
|
+
const element = this.element;
|
|
2653
|
+
if (!element) {
|
|
2654
|
+
return;
|
|
2655
|
+
}
|
|
2656
|
+
|
|
2657
|
+
if (evt.key === "Escape" && element.isPopoverVisible) {
|
|
2658
|
+
const existedVisibleFloatingUI =
|
|
2659
|
+
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
2660
|
+
if (
|
|
2661
|
+
existedVisibleFloatingUI &&
|
|
2662
|
+
existedVisibleFloatingUI !== this &&
|
|
2663
|
+
existedVisibleFloatingUI.element.isPopoverVisible
|
|
2664
|
+
) {
|
|
2665
|
+
// if something else is open, let it handle itself
|
|
2666
|
+
return;
|
|
2667
|
+
}
|
|
2668
|
+
this.hideBib("keydown");
|
|
2669
|
+
}
|
|
2670
|
+
};
|
|
2671
|
+
|
|
2672
|
+
if (this.behavior !== "drawer" && this.behavior !== "dialog") {
|
|
2673
|
+
// Add event listeners using the stored references
|
|
2674
|
+
document.addEventListener("focusin", this.focusHandler);
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
if (this.enableKeyboardHandling) {
|
|
2678
|
+
document.addEventListener("keydown", this.keyDownHandler);
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
// send this task to the end of queue to prevent conflicting
|
|
2682
|
+
// it conflicts if showBib gets call from a button that's not this.element.trigger
|
|
2683
|
+
setTimeout(() => {
|
|
2684
|
+
window.addEventListener("click", this.clickHandler);
|
|
2685
|
+
}, 0);
|
|
2686
|
+
|
|
2687
|
+
// iOS Safari does not fire `click` on non-interactive elements, so
|
|
2688
|
+
// tapping an inert backdrop never reaches the click handler above.
|
|
2689
|
+
// Mirror the same outside-tap logic with a passive touchstart listener.
|
|
2690
|
+
this.touchHandler = (evt) => {
|
|
2691
|
+
const element = this.element;
|
|
2692
|
+
if (!element?.bib) {
|
|
2693
|
+
return;
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
// fullscreen (modal) dialog handles its own dismissal
|
|
2697
|
+
if (element.bib.hasAttribute("isfullscreen")) {
|
|
2698
|
+
return;
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
const path = evt.composedPath();
|
|
2702
|
+
if (!path.includes(element.trigger) && !path.includes(element.bib)) {
|
|
2703
|
+
this.hideBib("click");
|
|
2704
|
+
}
|
|
2705
|
+
};
|
|
2706
|
+
|
|
2707
|
+
window.addEventListener("touchstart", this.touchHandler, { passive: true });
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
cleanupHideHandlers() {
|
|
2711
|
+
// Remove event listeners if they exist
|
|
2712
|
+
|
|
2713
|
+
if (this.focusHandler) {
|
|
2714
|
+
document.removeEventListener("focusin", this.focusHandler);
|
|
2715
|
+
this.focusHandler = null;
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
if (this.clickHandler) {
|
|
2719
|
+
window.removeEventListener("click", this.clickHandler);
|
|
2720
|
+
this.clickHandler = null;
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
if (this.touchHandler) {
|
|
2724
|
+
window.removeEventListener("touchstart", this.touchHandler);
|
|
2725
|
+
this.touchHandler = null;
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
if (this.keyDownHandler) {
|
|
2729
|
+
document.removeEventListener("keydown", this.keyDownHandler);
|
|
2730
|
+
this.keyDownHandler = null;
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
|
|
2734
|
+
handleUpdate(changedProperties) {
|
|
2735
|
+
if (changedProperties.has("isPopoverVisible")) {
|
|
2736
|
+
this.updateState();
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
updateCurrentExpandedDropdown() {
|
|
2741
|
+
if (!this.element) {
|
|
2742
|
+
return;
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
// Close any other dropdown that is already open
|
|
2746
|
+
const existedVisibleFloatingUI =
|
|
2747
|
+
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
2748
|
+
if (
|
|
2749
|
+
existedVisibleFloatingUI &&
|
|
2750
|
+
existedVisibleFloatingUI !== this &&
|
|
2751
|
+
existedVisibleFloatingUI.element.isPopoverVisible &&
|
|
2752
|
+
existedVisibleFloatingUI.eventPrefix === this.eventPrefix
|
|
2753
|
+
) {
|
|
2754
|
+
existedVisibleFloatingUI.hideBib();
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
document.expandedAuroFloater = this;
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
showBib() {
|
|
2761
|
+
const element = this.element;
|
|
2762
|
+
if (!element) {
|
|
2763
|
+
return;
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
if (!element.bib || (!element.trigger && !element.parentNode)) {
|
|
2767
|
+
return;
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
if (!element.disabled && !this.showing) {
|
|
2771
|
+
this.updateCurrentExpandedDropdown();
|
|
2772
|
+
element.triggerChevron?.setAttribute("data-expanded", true);
|
|
2773
|
+
|
|
2774
|
+
// prevent double showing: isPopovervisible gets first and showBib gets called later
|
|
2775
|
+
if (!this.showing) {
|
|
2776
|
+
if (!element.modal) {
|
|
2777
|
+
this.setupHideHandlers();
|
|
2778
|
+
}
|
|
2779
|
+
this.showing = true;
|
|
2780
|
+
element.isPopoverVisible = true;
|
|
2781
|
+
this.position();
|
|
2782
|
+
this.dispatchEventDropdownToggle();
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
// Setup auto update to handle resize and scroll
|
|
2786
|
+
element.cleanup = autoUpdate(
|
|
2787
|
+
element.trigger || element.parentNode,
|
|
2788
|
+
element.bib,
|
|
2789
|
+
() => {
|
|
2790
|
+
this.position();
|
|
2791
|
+
},
|
|
2792
|
+
);
|
|
2793
|
+
|
|
2794
|
+
const idx = AuroFloatingUI.openingQueue.indexOf(this);
|
|
2795
|
+
if (idx > -1) {
|
|
2796
|
+
AuroFloatingUI.openingQueue.splice(idx, 1);
|
|
2797
|
+
}
|
|
2798
|
+
AuroFloatingUI.openingQueue.push(this);
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2802
|
+
/**
|
|
2803
|
+
* Hides the floating UI element.
|
|
2804
|
+
* @param {String} eventType - The event type that triggered the hiding action.
|
|
2805
|
+
*/
|
|
2806
|
+
hideBib(eventType = "unknown") {
|
|
2807
|
+
const element = this.element;
|
|
2808
|
+
if (!element) {
|
|
2809
|
+
return;
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
if (element.disabled) {
|
|
2813
|
+
return;
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
// noToggle dropdowns should not close when the trigger is clicked (the
|
|
2817
|
+
// "toggle" behavior), but they CAN still close via other interactions like
|
|
2818
|
+
// Escape key or focus loss.
|
|
2819
|
+
if (element.noToggle && eventType === "click") {
|
|
2820
|
+
return;
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2823
|
+
this.lockScroll(false);
|
|
2824
|
+
element.triggerChevron?.removeAttribute("data-expanded");
|
|
2825
|
+
|
|
2826
|
+
if (element.isPopoverVisible) {
|
|
2827
|
+
element.isPopoverVisible = false;
|
|
2828
|
+
}
|
|
2829
|
+
if (this.showing) {
|
|
2830
|
+
this.cleanupHideHandlers();
|
|
2831
|
+
this.showing = false;
|
|
2832
|
+
this.dispatchEventDropdownToggle(eventType);
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
// Only clear the global reference if the bib was actually hidden.
|
|
2836
|
+
// Clearing it when hideBib is blocked (e.g. noToggle + click) corrupts
|
|
2837
|
+
// the singleton state so other dropdowns can't detect this one is still open.
|
|
2838
|
+
document.expandedAuroFloater = null;
|
|
2839
|
+
const idx = AuroFloatingUI.openingQueue.indexOf(this);
|
|
2840
|
+
if (idx > -1) {
|
|
2841
|
+
AuroFloatingUI.openingQueue.splice(idx, 1);
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2845
|
+
/**
|
|
2846
|
+
* @private
|
|
2847
|
+
* @returns {void} Dispatches event with an object showing the state of the dropdown.
|
|
2848
|
+
* @param {String} eventType - The event type that triggered the toggle action.
|
|
2849
|
+
*/
|
|
2850
|
+
dispatchEventDropdownToggle(eventType) {
|
|
2851
|
+
const element = this.element;
|
|
2852
|
+
if (!element) {
|
|
2853
|
+
return;
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
const event = new CustomEvent(
|
|
2857
|
+
this.eventPrefix ? `${this.eventPrefix}-toggled` : "toggled",
|
|
2858
|
+
{
|
|
2859
|
+
detail: {
|
|
2860
|
+
expanded: this.showing,
|
|
2861
|
+
eventType: eventType || "unknown",
|
|
2862
|
+
},
|
|
2863
|
+
composed: true,
|
|
2864
|
+
},
|
|
2865
|
+
);
|
|
2866
|
+
|
|
2867
|
+
element.dispatchEvent(event);
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
handleClick() {
|
|
2871
|
+
const element = this.element;
|
|
2872
|
+
if (!element) {
|
|
2873
|
+
return;
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
if (element.isPopoverVisible) {
|
|
2877
|
+
this.hideBib("click");
|
|
2878
|
+
} else {
|
|
2879
|
+
this.showBib();
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2882
|
+
const event = new CustomEvent(
|
|
2883
|
+
this.eventPrefix ? `${this.eventPrefix}-triggerClick` : "triggerClick",
|
|
2884
|
+
{
|
|
2885
|
+
composed: true,
|
|
2886
|
+
detail: {
|
|
2887
|
+
expanded: element.isPopoverVisible,
|
|
2888
|
+
},
|
|
2889
|
+
},
|
|
2890
|
+
);
|
|
2891
|
+
|
|
2892
|
+
element.dispatchEvent(event);
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
handleEvent(event) {
|
|
2896
|
+
const element = this.element;
|
|
2897
|
+
if (!element || element.disableEventShow) {
|
|
2898
|
+
return;
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
switch (event.type) {
|
|
2902
|
+
case "keydown": {
|
|
2903
|
+
// Support both Enter and Space keys for accessibility
|
|
2904
|
+
// Space is included as it's expected behavior for interactive elements
|
|
2905
|
+
|
|
2906
|
+
const origin = event.composedPath()[0];
|
|
2907
|
+
if (
|
|
2908
|
+
event.key === "Enter" ||
|
|
2909
|
+
(event.key === " " && (!origin || origin.tagName !== "INPUT"))
|
|
2910
|
+
) {
|
|
2911
|
+
event.preventDefault();
|
|
2912
|
+
this.handleClick();
|
|
2913
|
+
}
|
|
2914
|
+
break;
|
|
2915
|
+
}
|
|
2916
|
+
case "mouseenter":
|
|
2917
|
+
if (element.hoverToggle) {
|
|
2918
|
+
this.showBib();
|
|
2919
|
+
}
|
|
2920
|
+
break;
|
|
2921
|
+
case "mouseleave":
|
|
2922
|
+
if (element.hoverToggle) {
|
|
2923
|
+
this.hideBib("mouseleave");
|
|
2924
|
+
}
|
|
2925
|
+
break;
|
|
2926
|
+
case "focus":
|
|
2927
|
+
if (element.focusShow) {
|
|
2928
|
+
/*
|
|
2929
|
+
This needs to better handle clicking that gives focus -
|
|
2930
|
+
currently it shows and then immediately hides the bib
|
|
2931
|
+
*/
|
|
2932
|
+
this.showBib();
|
|
2933
|
+
}
|
|
2934
|
+
break;
|
|
2935
|
+
case "blur":
|
|
2936
|
+
// send this task 100ms later queue to
|
|
2937
|
+
// wait a frame in case focus moves within the floating element/bib
|
|
2938
|
+
setTimeout(() => this.handleFocusLoss(), 0);
|
|
2939
|
+
break;
|
|
2940
|
+
case "click":
|
|
2941
|
+
if (document.activeElement === document.body) {
|
|
2942
|
+
event.currentTarget.focus();
|
|
2943
|
+
}
|
|
2944
|
+
this.handleClick();
|
|
2945
|
+
break;
|
|
2946
|
+
// Do nothing
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2950
|
+
/**
|
|
2951
|
+
* Manages the tabIndex of the trigger element based on its focusability.
|
|
2952
|
+
*
|
|
2953
|
+
* If the trigger element or any of its children are inherently focusable, the tabIndex of the component is set to -1.
|
|
2954
|
+
* This prevents the component itself from being focusable when the trigger element already handles focus.
|
|
2955
|
+
*/
|
|
2956
|
+
handleTriggerTabIndex() {
|
|
2957
|
+
const element = this.element;
|
|
2958
|
+
if (!element) {
|
|
2959
|
+
return;
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
const focusableElementSelectors = [
|
|
2963
|
+
"a",
|
|
2964
|
+
"button",
|
|
2965
|
+
'input:not([type="hidden"])',
|
|
2966
|
+
"select",
|
|
2967
|
+
"textarea",
|
|
2968
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
2969
|
+
"auro-button",
|
|
2970
|
+
"auro-input",
|
|
2971
|
+
"auro-hyperlink",
|
|
2972
|
+
];
|
|
2973
|
+
|
|
2974
|
+
const triggerNode = element.querySelectorAll('[slot="trigger"]')[0];
|
|
2975
|
+
if (!triggerNode) {
|
|
2976
|
+
return;
|
|
2977
|
+
}
|
|
2978
|
+
const triggerNodeTagName = triggerNode.tagName.toLowerCase();
|
|
2979
|
+
|
|
2980
|
+
focusableElementSelectors.forEach((selector) => {
|
|
2981
|
+
// Check if the trigger node element is focusable
|
|
2982
|
+
if (triggerNodeTagName === selector) {
|
|
2983
|
+
element.tabIndex = -1;
|
|
2984
|
+
return;
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
// Check if any child is focusable
|
|
2988
|
+
if (triggerNode.querySelector(selector)) {
|
|
2989
|
+
element.tabIndex = -1;
|
|
2990
|
+
}
|
|
2991
|
+
});
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
/**
|
|
2995
|
+
*
|
|
2996
|
+
* @param {*} eventPrefix
|
|
2997
|
+
*/
|
|
2998
|
+
regenerateBibId() {
|
|
2999
|
+
const element = this.element;
|
|
3000
|
+
if (!element) {
|
|
3001
|
+
return;
|
|
3002
|
+
}
|
|
3003
|
+
|
|
3004
|
+
this.id = element.getAttribute("id");
|
|
3005
|
+
if (!this.id) {
|
|
3006
|
+
this.id = window.crypto.randomUUID();
|
|
3007
|
+
element.setAttribute("id", this.id);
|
|
3008
|
+
}
|
|
3009
|
+
|
|
3010
|
+
element.bib?.setAttribute("id", `${this.id}-floater-bib`);
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
configure(elem, eventPrefix, enableKeyboardHandling = true) {
|
|
3014
|
+
AuroFloatingUI.setupMousePressChecker();
|
|
3015
|
+
this.enableKeyboardHandling = enableKeyboardHandling;
|
|
3016
|
+
|
|
3017
|
+
this.eventPrefix = eventPrefix;
|
|
3018
|
+
if (this.element !== elem) {
|
|
3019
|
+
this.element = elem;
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
const element = this.element;
|
|
3023
|
+
if (!element) {
|
|
3024
|
+
return;
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
if (this.behavior !== element.behavior) {
|
|
3028
|
+
this.behavior = element.behavior;
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
if (element.trigger) {
|
|
3032
|
+
this.disconnect();
|
|
3033
|
+
}
|
|
3034
|
+
element.trigger =
|
|
3035
|
+
element.triggerElement ||
|
|
3036
|
+
element.shadowRoot?.querySelector("#trigger") ||
|
|
3037
|
+
element.trigger;
|
|
3038
|
+
element.bib = element.shadowRoot?.querySelector("#bib") || element.bib;
|
|
3039
|
+
element.bibSizer = element.shadowRoot?.querySelector("#bibSizer");
|
|
3040
|
+
element.triggerChevron =
|
|
3041
|
+
element.shadowRoot?.querySelector("#showStateIcon");
|
|
3042
|
+
|
|
3043
|
+
if (element.floaterConfig) {
|
|
3044
|
+
element.hoverToggle = element.floaterConfig.hoverToggle;
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
this.regenerateBibId();
|
|
3048
|
+
this.handleTriggerTabIndex();
|
|
3049
|
+
|
|
3050
|
+
this.handleEvent = this.handleEvent.bind(this);
|
|
3051
|
+
if (element.trigger) {
|
|
3052
|
+
if (this.enableKeyboardHandling) {
|
|
3053
|
+
element.trigger.addEventListener("keydown", this.handleEvent);
|
|
3054
|
+
}
|
|
3055
|
+
element.trigger.addEventListener("click", this.handleEvent);
|
|
3056
|
+
element.trigger.addEventListener("mouseenter", this.handleEvent);
|
|
3057
|
+
element.trigger.addEventListener("mouseleave", this.handleEvent);
|
|
3058
|
+
element.trigger.addEventListener("focus", this.handleEvent);
|
|
3059
|
+
element.trigger.addEventListener("blur", this.handleEvent);
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
|
|
3063
|
+
disconnect() {
|
|
3064
|
+
this.cleanupHideHandlers();
|
|
3065
|
+
|
|
3066
|
+
const element = this.element;
|
|
3067
|
+
if (!element) {
|
|
3068
|
+
return;
|
|
3069
|
+
}
|
|
3070
|
+
|
|
3071
|
+
element.cleanup?.();
|
|
3072
|
+
|
|
3073
|
+
if (element.bib && element.shadowRoot) {
|
|
3074
|
+
element.shadowRoot.append(element.bib);
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
// Remove event & keyboard listeners
|
|
3078
|
+
if (element.trigger) {
|
|
3079
|
+
element.trigger.removeEventListener("keydown", this.handleEvent);
|
|
3080
|
+
element.trigger.removeEventListener("click", this.handleEvent);
|
|
3081
|
+
element.trigger.removeEventListener("mouseenter", this.handleEvent);
|
|
3082
|
+
element.trigger.removeEventListener("mouseleave", this.handleEvent);
|
|
3083
|
+
element.trigger.removeEventListener("focus", this.handleEvent);
|
|
3084
|
+
element.trigger.removeEventListener("blur", this.handleEvent);
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
|
|
3089
|
+
/**
|
|
3090
|
+
* @license
|
|
3091
|
+
* Copyright 2019 Google LLC
|
|
3092
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3093
|
+
*/
|
|
3094
|
+
const t$1=globalThis,e$3=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$3=new WeakMap;let n$1 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$3&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$3.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$3.set(s,t));}return t}toString(){return this.cssText}};const r$1=t=>new n$1("string"==typeof t?t:t+"",void 0,s$1),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$1(o,t,s$1)},S$1=(s,o)=>{if(e$3)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$1.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$3?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$1(e)})(t):t;
|
|
3095
|
+
|
|
3096
|
+
/**
|
|
3097
|
+
* @license
|
|
3098
|
+
* Copyright 2017 Google LLC
|
|
3099
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3100
|
+
*/const{is:i$2,defineProperty:e$2,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r,getOwnPropertySymbols:o$2,getPrototypeOf:n}=Object,a=globalThis,c$1=a.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$2=a.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$2={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$2=(t,s)=>!i$2(t,s),b$1={attribute:true,type:String,converter:u$2,reflect:false,useDefault:false,hasChanged:f$2};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;let y$2 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b$1){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$2(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r(t),...o$2(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$2).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$2;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f$2)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}};y$2.elementStyles=[],y$2.shadowRootOptions={mode:"open"},y$2[d$1("elementProperties")]=new Map,y$2[d$1("finalized")]=new Map,p$2?.({ReactiveElement:y$2}),(a.reactiveElementVersions??=[]).push("2.1.1");
|
|
3101
|
+
|
|
3102
|
+
/**
|
|
3103
|
+
* @license
|
|
3104
|
+
* Copyright 2017 Google LLC
|
|
3105
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3106
|
+
*/const s=globalThis;let i$1 = class i extends y$2{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B$1(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T$1}};i$1._$litElement$=true,i$1["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i$1});const o$1=s.litElementPolyfillSupport;o$1?.({LitElement:i$1});(s.litElementVersions??=[]).push("4.2.1");
|
|
3107
|
+
|
|
3108
|
+
var colorCss$1 = i$3`:host([onbackdrop]) .backdrop{background:var(--ds-auro-floater-backdrop-modal-background-color)}::slotted(*){background:var(--ds-auro-floater-container-background-color);color:var(--ds-auro-floater-container-text-color)}
|
|
3109
|
+
`;
|
|
3110
|
+
|
|
3111
|
+
var styleCss$1 = i$3`:host{position:absolute;z-index:var(--ds-depth-overlay, 200);display:none;flex-direction:column;opacity:0;transition:opacity .3s ease-in-out,display .3s;transition-behavior:allow-discrete;will-change:opacity}.util_displayHiddenVisually{position:absolute;overflow:hidden;width:1px;height:1px;padding:0;border:0;margin:-1px;clip:rect(0,0,0,0);white-space:nowrap}dialog.container{display:inline-block;width:100%;max-width:none;height:100%;max-height:none;padding:0;border:none;margin:0;background-color:transparent;outline:none;transform:translateZ(0)}dialog.container::backdrop{backdrop-filter:var(--auro-drawer-backdrop-filter, none);background:var(--auro-drawer-backdrop-background, transparent);opacity:var(--auro-drawer-backdrop-opacity, 1);transition:var(--auro-drawer-backdrop-transition, opacity .3s ease)}dialog.container .backdrop{position:fixed;inset:0;pointer-events:none}dialog.container ::slotted(:only-child){z-index:var(--ds-depth-modal, 300);box-shadow:var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, .15))}:host([data-show]){display:block;opacity:1}@starting-style{:host([data-show]:not([modal])){opacity:0}}:host([data-show][modal]) dialog.container{opacity:1;transition:opacity .3s ease-in-out}@starting-style{:host([data-show][modal]) dialog.container{opacity:0}}:host([data-show][modal]){pointer-events:initial}:host([isfullscreen]){width:100%;height:100%}:host([isfullscreen]) dialog.container{overflow:auto;width:100%;height:100%}
|
|
3112
|
+
`;
|
|
3113
|
+
|
|
3114
|
+
var tokensCss$1 = i$3`:host{--ds-auro-floater-backdrop-modal-background-color: var(--ds-advanced-color-shared-scrim, rgba(0, 0, 0, .5));--ds-auro-floater-container-background-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-floater-container-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}
|
|
3115
|
+
`;
|
|
3116
|
+
|
|
3117
|
+
/**
|
|
3118
|
+
* @internal
|
|
3119
|
+
*/
|
|
3120
|
+
class AuroFloaterBib extends i$1 {
|
|
3121
|
+
static get properties() {
|
|
3122
|
+
return {
|
|
3123
|
+
/**
|
|
3124
|
+
* Text used to label the dialog for screen readers via aria-labelledby.
|
|
3125
|
+
*/
|
|
3126
|
+
bibLabel: {
|
|
3127
|
+
type: String,
|
|
3128
|
+
},
|
|
3129
|
+
};
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
static get styles() {
|
|
3133
|
+
return [colorCss$1, styleCss$1, tokensCss$1];
|
|
3134
|
+
}
|
|
3135
|
+
|
|
3136
|
+
firstUpdated() {
|
|
3137
|
+
AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(
|
|
3138
|
+
this,
|
|
3139
|
+
"auro-floater-bib",
|
|
3140
|
+
);
|
|
3141
|
+
|
|
3142
|
+
this.dialog = this.shadowRoot.querySelector("dialog");
|
|
3143
|
+
|
|
3144
|
+
// Always prevent native dialog close on Escape; re-dispatch as a composed
|
|
3145
|
+
// event so AuroDrawer can decide whether to honour it based on `modal`.
|
|
3146
|
+
this.dialog.addEventListener("cancel", (e) => {
|
|
3147
|
+
e.preventDefault();
|
|
3148
|
+
this.dispatchEvent(
|
|
3149
|
+
new Event("dialog-cancel", { bubbles: true, composed: true }),
|
|
3150
|
+
);
|
|
3151
|
+
});
|
|
3152
|
+
|
|
3153
|
+
// Re-dispatch keydown events that stopped at the dialog boundary so that
|
|
3154
|
+
// slotted consumer keyboard handlers outside the shadow DOM still receive them.
|
|
3155
|
+
this.dialog.addEventListener("keydown", (e) => {
|
|
3156
|
+
if (e.target !== this.dialog) {
|
|
3157
|
+
return;
|
|
3158
|
+
}
|
|
3159
|
+
this.dialog.dispatchEvent(
|
|
3160
|
+
new KeyboardEvent(e.type, { ...e, bubbles: true, composed: true }),
|
|
3161
|
+
);
|
|
3162
|
+
});
|
|
3163
|
+
|
|
3164
|
+
// Clicks on the empty dialog area (outside the drawer panel) target the
|
|
3165
|
+
// dialog element directly; clicks inside the panel bubble up from a child.
|
|
3166
|
+
this.dialog.addEventListener("click", (e) => {
|
|
3167
|
+
if (e.target === this.dialog) {
|
|
3168
|
+
this.dispatchEvent(
|
|
3169
|
+
new Event("dialog-backdrop-click", { bubbles: true, composed: true }),
|
|
3170
|
+
);
|
|
3171
|
+
}
|
|
3172
|
+
});
|
|
3173
|
+
}
|
|
3174
|
+
|
|
3175
|
+
render() {
|
|
3176
|
+
return u$3`
|
|
3177
|
+
<dialog class="container" aria-labelledby="dialogLabel">
|
|
3178
|
+
<span id="dialogLabel" class="util_displayHiddenVisually" aria-hidden="true">${this.bibLabel || ""}</span>
|
|
3179
|
+
<div class="backdrop" part="backdrop"></div>
|
|
3180
|
+
<slot></slot>
|
|
3181
|
+
</dialog>
|
|
3182
|
+
`;
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
var drawerVersion = '0.0.0';
|
|
3187
|
+
|
|
3188
|
+
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
3189
|
+
// See LICENSE in the project root for license information.
|
|
3190
|
+
|
|
3191
|
+
|
|
3192
|
+
/**
|
|
3193
|
+
* @internal
|
|
3194
|
+
*/
|
|
3195
|
+
class AuroFloater extends i$1 {
|
|
3196
|
+
constructor(behavior) {
|
|
3197
|
+
super();
|
|
3198
|
+
|
|
3199
|
+
/**
|
|
3200
|
+
* @private
|
|
3201
|
+
*/
|
|
3202
|
+
this.behavior = behavior;
|
|
3203
|
+
|
|
3204
|
+
/**
|
|
3205
|
+
* @private
|
|
3206
|
+
*/
|
|
3207
|
+
this.floater = undefined;
|
|
3208
|
+
|
|
3209
|
+
const tagPrefix = `${this.floaterConfig.prefix.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}-bib`;
|
|
3210
|
+
|
|
3211
|
+
/**
|
|
3212
|
+
* @private
|
|
3213
|
+
*/
|
|
3214
|
+
this.floaterBibTag = AuroDependencyVersioning.prototype.generateTag(
|
|
3215
|
+
tagPrefix,
|
|
3216
|
+
drawerVersion,
|
|
3217
|
+
AuroFloaterBib,
|
|
3218
|
+
);
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
/**
|
|
3222
|
+
* @ignore
|
|
3223
|
+
* The configuration for floaingUI.
|
|
3224
|
+
* @returns {object} Floater configuration object.
|
|
3225
|
+
*/
|
|
3226
|
+
get floaterConfig() {
|
|
3227
|
+
return {
|
|
3228
|
+
prefix: "auroFloater",
|
|
3229
|
+
};
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3232
|
+
// function to define props used within the scope of this component
|
|
3233
|
+
static get properties() {
|
|
3234
|
+
return {
|
|
3235
|
+
/**
|
|
3236
|
+
* @private
|
|
3237
|
+
* Sets state of drawer to open.
|
|
3238
|
+
* @default false
|
|
3239
|
+
*/
|
|
3240
|
+
isPopoverVisible: {
|
|
3241
|
+
attribute: "open",
|
|
3242
|
+
type: Boolean,
|
|
3243
|
+
reflect: true,
|
|
3244
|
+
},
|
|
3245
|
+
|
|
3246
|
+
/**
|
|
3247
|
+
* @private
|
|
3248
|
+
* The element to focus when the drawer is closed.
|
|
3249
|
+
*/
|
|
3250
|
+
triggerElement: {
|
|
3251
|
+
attribute: false,
|
|
3252
|
+
},
|
|
3253
|
+
};
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3256
|
+
firstUpdated() {
|
|
3257
|
+
this.floater = new AuroFloatingUI(this, this.behavior);
|
|
3258
|
+
|
|
3259
|
+
this.floater.configure(this, this.floaterConfig.prefix);
|
|
3260
|
+
|
|
3261
|
+
// Handle Escape key via native dialog cancel event.
|
|
3262
|
+
// Always preventDefault in the bib; here we decide whether to actually close.
|
|
3263
|
+
this.bib.addEventListener("dialog-cancel", () => {
|
|
3264
|
+
if (this.modal) {
|
|
3265
|
+
return; // Modal drawers ignore Escape.
|
|
3266
|
+
}
|
|
3267
|
+
this.hide();
|
|
3268
|
+
});
|
|
3269
|
+
|
|
3270
|
+
// Handle backdrop clicks — close unless this is a modal drawer.
|
|
3271
|
+
this.bib.addEventListener("dialog-backdrop-click", () => {
|
|
3272
|
+
if (this.modal) {
|
|
3273
|
+
return; // Modal drawers require an explicit action to close.
|
|
3274
|
+
}
|
|
3275
|
+
if (AuroFloatingUI.topOpeningFloatingUI !== this.floater) {
|
|
3276
|
+
return; // there is another floatingUI that is currently visible, so ignore backdrop clicks on this one
|
|
3277
|
+
}
|
|
3278
|
+
this.hide();
|
|
3279
|
+
});
|
|
3280
|
+
}
|
|
3281
|
+
|
|
3282
|
+
disconnectedCallback() {
|
|
3283
|
+
if (this.floater) {
|
|
3284
|
+
this.hide("disconnect");
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
|
|
3288
|
+
updated(changedProperties) {
|
|
3289
|
+
this.floater.handleUpdate(changedProperties);
|
|
3290
|
+
|
|
3291
|
+
if (changedProperties.has("triggerElement")) {
|
|
3292
|
+
this.floater.configure(this, this.floaterConfig.prefix);
|
|
3293
|
+
|
|
3294
|
+
// Use bibLabel + aria-labelledby on the <dialog> instead of aria-label
|
|
3295
|
+
// directly — iOS VoiceOver does not reliably read aria-label on <dialog>.
|
|
3296
|
+
this.bib.bibLabel = this.triggerElement?.textContent.trim();
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3299
|
+
if (changedProperties.has("isPopoverVisible")) {
|
|
3300
|
+
if (this.isPopoverVisible) {
|
|
3301
|
+
this.show();
|
|
3302
|
+
} else {
|
|
3303
|
+
this.hide();
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
|
|
3308
|
+
/**
|
|
3309
|
+
* Opens the native dialog inside the bib.
|
|
3310
|
+
*
|
|
3311
|
+
* - `modal && !nested`: `showModal()` for native focus containment and top-layer rendering.
|
|
3312
|
+
* - `nested` or `!modal`: `showPopover()` to keep positional CSS intact
|
|
3313
|
+
* and allow free keyboard flow to background content (WCAG 2.1.2).
|
|
3314
|
+
*/
|
|
3315
|
+
async show() {
|
|
3316
|
+
this.floater.showBib();
|
|
3317
|
+
if (!this.bib?.dialog) {
|
|
3318
|
+
await this.bib?.updateComplete;
|
|
3319
|
+
}
|
|
3320
|
+
if (!this.bib?.dialog) {
|
|
3321
|
+
return;
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
const nested = this.nested ?? false;
|
|
3325
|
+
const modal = this.modal ?? false;
|
|
3326
|
+
|
|
3327
|
+
if (nested) {
|
|
3328
|
+
this.bib.dialog.setAttribute("open", "");
|
|
3329
|
+
} else if (!modal) {
|
|
3330
|
+
this.bib.dialog.setAttribute("popover", "manual");
|
|
3331
|
+
this.bib.dialog.showPopover();
|
|
3332
|
+
} else {
|
|
3333
|
+
this.bib.dialog.removeAttribute("popover");
|
|
3334
|
+
this.bib.dialog.showModal();
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3338
|
+
/**
|
|
3339
|
+
* Closes the native dialog.
|
|
3340
|
+
*/
|
|
3341
|
+
hide(eventType = undefined) {
|
|
3342
|
+
if (this.bib?.dialog?.open) {
|
|
3343
|
+
setTimeout(() => {
|
|
3344
|
+
this.bib.dialog.close();
|
|
3345
|
+
}, 300);
|
|
3346
|
+
}
|
|
3347
|
+
this.floater.hideBib(eventType);
|
|
3348
|
+
|
|
3349
|
+
if (eventType === "disconnect") {
|
|
3350
|
+
this.floater.disconnect();
|
|
3351
|
+
}
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
render() {
|
|
3355
|
+
return u$3`
|
|
3356
|
+
<${this.floaterBibTag} id="bib"
|
|
3357
|
+
?data-show=${this.isPopoverVisible}
|
|
3358
|
+
?onBackdrop="${this.floaterConfig.backdrop}">
|
|
3359
|
+
<slot></slot>
|
|
3360
|
+
</${this.floaterBibTag}>
|
|
3361
|
+
`;
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
|
|
3365
|
+
/**
|
|
3366
|
+
* @license
|
|
3367
|
+
* Copyright 2017 Google LLC
|
|
3368
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3369
|
+
*/
|
|
3370
|
+
const t={ATTRIBUTE:1},e$1=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
3371
|
+
|
|
3372
|
+
/**
|
|
3373
|
+
* @license
|
|
3374
|
+
* Copyright 2018 Google LLC
|
|
3375
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3376
|
+
*/const e=e$1(class extends i{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((s=>t[s])).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return T$1}});
|
|
3377
|
+
|
|
3378
|
+
/**
|
|
3379
|
+
* @license
|
|
3380
|
+
* Copyright 2018 Google LLC
|
|
3381
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3382
|
+
*/const o=o=>o??E;
|
|
3383
|
+
|
|
3384
|
+
class l{generateElementName(t,e){let o=t;return o+="-",o+=e.replace(/[.]/g,"_"),o}generateTag(o,s,a){const r=this.generateElementName(o,s),i=i$4`${s$2(r)}`;return customElements.get(r)||customElements.define(r,class extends a{}),i}}class d{registerComponent(t,e){customElements.get(t)||customElements.define(t,class extends e{});}closestElement(t,e=this,o=(e,s=e&&e.closest(t))=>e&&e!==document&&e!==window?s||o(e.getRootNode().host):null){return o(e)}handleComponentTagRename(t,e){const o=e.toLowerCase();t.tagName.toLowerCase()!==o&&t.setAttribute(o,true);}elementMatch(t,e){const o=e.toLowerCase();return t.tagName.toLowerCase()===o||t.hasAttribute(o)}getSlotText(t,e){const o=t.shadowRoot?.querySelector(`slot[name="${e}"]`),s=(o?.assignedNodes({flatten:true})||[]).map(t=>t.textContent?.trim()).join(" ").trim();return s||null}}class h{registerComponent(t,e){customElements.get(t)||customElements.define(t,class extends e{});}closestElement(t,e=this,o=(e,s=e&&e.closest(t))=>e&&e!==document&&e!==window?s||o(e.getRootNode().host):null){return o(e)}handleComponentTagRename(t,e){const o=e.toLowerCase();t.tagName.toLowerCase()!==o&&t.setAttribute(o,true);}elementMatch(t,e){const o=e.toLowerCase();return t.tagName.toLowerCase()===o||t.hasAttribute(o)}}var c=i$3`:host{color:var(--ds-auro-loader-color)}:host>span{background-color:var(--ds-auro-loader-background-color);border-color:var(--ds-auro-loader-border-color)}:host([onlight]),:host([appearance=brand]){--ds-auro-loader-color: var(--ds-basic-color-brand-primary, #01426a)}:host([ondark]),:host([appearance=inverse]){--ds-auro-loader-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([orbit])>span{--ds-auro-loader-background-color: transparent}:host([orbit])>span:nth-child(1){--ds-auro-loader-border-color: currentcolor;opacity:.25}:host([orbit])>span:nth-child(2){--ds-auro-loader-border-color: currentcolor;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent}
|
|
3385
|
+
`,u$1=i$3`.body-default{font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.body-default,.body-lg{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-lg{font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{font-size:var(--wcss-body-sm-font-size, .875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.body-sm,.body-xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-xs{font-size:var(--wcss-body-xs-font-size, .75rem);line-height:var(--wcss-body-xs-line-height, 1rem)}.body-2xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:var(--wcss-body-2xs-font-size, .625rem);font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);line-height:var(--wcss-body-2xs-line-height, .875rem)}.display-2xl{font-family:var(--wcss-display-2xl-family, "AS Circular"),var(--wcss-display-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem));font-weight:var(--wcss-display-2xl-weight, 300);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);line-height:var(--wcss-display-2xl-line-height, 1.3)}.display-xl{font-family:var(--wcss-display-xl-family, "AS Circular"),var(--wcss-display-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem));font-weight:var(--wcss-display-xl-weight, 300);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);line-height:var(--wcss-display-xl-line-height, 1.3)}.display-lg{font-family:var(--wcss-display-lg-family, "AS Circular"),var(--wcss-display-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem));font-weight:var(--wcss-display-lg-weight, 300);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);line-height:var(--wcss-display-lg-line-height, 1.3)}.display-md{font-family:var(--wcss-display-md-family, "AS Circular"),var(--wcss-display-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem));font-weight:var(--wcss-display-md-weight, 300);letter-spacing:var(--wcss-display-md-letter-spacing, 0);line-height:var(--wcss-display-md-line-height, 1.3)}.display-sm{font-family:var(--wcss-display-sm-family, "AS Circular"),var(--wcss-display-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem));font-weight:var(--wcss-display-sm-weight, 300);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);line-height:var(--wcss-display-sm-line-height, 1.3)}.display-xs{font-family:var(--wcss-display-xs-family, "AS Circular"),var(--wcss-display-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem));font-weight:var(--wcss-display-xs-weight, 300);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);line-height:var(--wcss-display-xs-line-height, 1.3)}.heading-xl{font-family:var(--wcss-heading-xl-family, "AS Circular"),var(--wcss-heading-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem));font-weight:var(--wcss-heading-xl-weight, 300);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);line-height:var(--wcss-heading-xl-line-height, 1.3)}.heading-lg{font-family:var(--wcss-heading-lg-family, "AS Circular"),var(--wcss-heading-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem));font-weight:var(--wcss-heading-lg-weight, 300);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);line-height:var(--wcss-heading-lg-line-height, 1.3)}.heading-md{font-family:var(--wcss-heading-md-family, "AS Circular"),var(--wcss-heading-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem));font-weight:var(--wcss-heading-md-weight, 300);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);line-height:var(--wcss-heading-md-line-height, 1.3)}.heading-sm{font-family:var(--wcss-heading-sm-family, "AS Circular"),var(--wcss-heading-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem));font-weight:var(--wcss-heading-sm-weight, 300);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);line-height:var(--wcss-heading-sm-line-height, 1.3)}.heading-xs{font-family:var(--wcss-heading-xs-family, "AS Circular"),var(--wcss-heading-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem));font-weight:var(--wcss-heading-xs-weight, 450);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);line-height:var(--wcss-heading-xs-line-height, 1.3)}.heading-2xs{font-family:var(--wcss-heading-2xs-family, "AS Circular"),var(--wcss-heading-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem));font-weight:var(--wcss-heading-2xs-weight, 450);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);line-height:var(--wcss-heading-2xs-line-height, 1.3)}.accent-2xl{font-family:var(--wcss-accent-2xl-family, "Good OT"),var(--wcss-accent-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));font-weight:var(--wcss-accent-2xl-weight, 450);letter-spacing:var(--wcss-accent-2xl-letter-spacing, .05em);line-height:var(--wcss-accent-2xl-line-height, 1)}.accent-2xl,.accent-xl{text-transform:uppercase}.accent-xl{font-family:var(--wcss-accent-xl-family, "Good OT"),var(--wcss-accent-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));font-weight:var(--wcss-accent-xl-weight, 450);letter-spacing:var(--wcss-accent-xl-letter-spacing, .05em);line-height:var(--wcss-accent-xl-line-height, 1.3)}.accent-lg{font-family:var(--wcss-accent-lg-family, "Good OT"),var(--wcss-accent-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));font-weight:var(--wcss-accent-lg-weight, 450);letter-spacing:var(--wcss-accent-lg-letter-spacing, .05em);line-height:var(--wcss-accent-lg-line-height, 1.3)}.accent-lg,.accent-md{text-transform:uppercase}.accent-md{font-family:var(--wcss-accent-md-family, "Good OT"),var(--wcss-accent-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));font-weight:var(--wcss-accent-md-weight, 500);letter-spacing:var(--wcss-accent-md-letter-spacing, .05em);line-height:var(--wcss-accent-md-line-height, 1.3)}.accent-sm{font-family:var(--wcss-accent-sm-family, "Good OT"),var(--wcss-accent-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));font-weight:var(--wcss-accent-sm-weight, 500);letter-spacing:var(--wcss-accent-sm-letter-spacing, .05em);line-height:var(--wcss-accent-sm-line-height, 1.3)}.accent-sm,.accent-xs{text-transform:uppercase}.accent-xs{font-family:var(--wcss-accent-xs-family, "Good OT"),var(--wcss-accent-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));font-weight:var(--wcss-accent-xs-weight, 500);letter-spacing:var(--wcss-accent-xs-letter-spacing, .1em);line-height:var(--wcss-accent-xs-line-height, 1.3)}.accent-2xs{font-family:var(--wcss-accent-2xs-family, "Good OT"),var(--wcss-accent-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xs-font-size, clamp(.875rem, 1.1666666667vw, .875rem));font-weight:var(--wcss-accent-2xs-weight, 450);letter-spacing:var(--wcss-accent-2xs-letter-spacing, .1em);line-height:var(--wcss-accent-2xs-line-height, 1.3);text-transform:uppercase}:focus:not(:focus-visible){outline:3px solid transparent}:host,:host>span{position:relative}:host{width:2rem;height:2rem;display:inline-block;font-size:0}:host>span{position:absolute;display:inline-block;float:none;top:0;left:0;width:2rem;height:2rem;border-radius:100%;border-style:solid;border-width:0;box-sizing:border-box}:host([xs]),:host([xs])>span{width:1.2rem;height:1.2rem}:host([sm]),:host([sm])>span{width:3rem;height:3rem}:host([md]),:host([md])>span{width:5rem;height:5rem}:host([lg]),:host([lg])>span{width:8rem;height:8rem}:host{--margin: .375rem;--margin-xs: .2rem;--margin-sm: .5rem;--margin-md: .75rem;--margin-lg: 1rem}:host([pulse]),:host([pulse])>span{position:relative}:host([pulse]){width:calc(3rem + var(--margin) * 6);height:calc(1rem + var(--margin) * 2)}:host([pulse])>span{width:1rem;height:1rem;margin:var(--margin);animation:pulse 1.5s ease infinite}:host([pulse][xs]){width:calc(1.95rem + var(--margin-xs) * 6);height:calc(.65rem + var(--margin-xs) * 2)}:host([pulse][xs])>span{margin:var(--margin-xs);width:.65rem;height:.65rem}:host([pulse][sm]){width:calc(6rem + var(--margin-sm) * 6);height:calc(2rem + var(--margin-sm) * 2)}:host([pulse][sm])>span{margin:var(--margin-sm);width:2rem;height:2rem}:host([pulse][md]){width:calc(9rem + var(--margin-md) * 6);height:calc(3rem + var(--margin-md) * 2)}:host([pulse][md])>span{margin:var(--margin-md);width:3rem;height:3rem}:host([pulse][lg]){width:calc(15rem + var(--margin-lg) * 6);height:calc(5rem + var(--margin-lg) * 2)}:host([pulse][lg])>span{margin:var(--margin-lg);width:5rem;height:5rem}:host([pulse])>span:nth-child(1){animation-delay:-.4s}:host([pulse])>span:nth-child(2){animation-delay:-.2s}:host([pulse])>span:nth-child(3){animation-delay:0ms}@keyframes pulse{0%,to{opacity:.1;transform:scale(.9)}50%{opacity:1;transform:scale(1.1)}}:host([orbit]),:host([orbit])>span{opacity:1}:host([orbit])>span{border-width:5px}:host([orbit])>span:nth-child(2){animation:orbit 2s linear infinite}:host([orbit][sm])>span{border-width:8px}:host([orbit][md])>span{border-width:13px}:host([orbit][lg])>span{border-width:21px}@keyframes orbit{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host([ringworm])>svg{animation:rotate 2s linear infinite;height:100%;width:100%;stroke:currentcolor;stroke-width:8}:host([ringworm]) .path{stroke-dashoffset:0;animation:ringworm 1.5s ease-in-out infinite;stroke-linecap:round}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes ringworm{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}:host([laser]){position:static;width:100%;display:block;height:0;overflow:hidden;font-size:unset}:host([laser])>span{position:fixed;width:100%;height:.25rem;border-radius:0;z-index:100}:host([laser])>span:nth-child(1){border-color:currentcolor;opacity:.25}:host([laser])>span:nth-child(2){border-color:currentcolor;animation:laser 2s linear infinite;opacity:1;width:50%}:host([laser][sm])>span:nth-child(2){width:20%}:host([laser][md])>span:nth-child(2){width:30%}:host([laser][lg])>span:nth-child(2){width:50%;animation-duration:1.5s}:host([laser][xl])>span:nth-child(2){width:80%;animation-duration:1.5s}@keyframes laser{0%{left:-100%}to{left:110%}}:host>.no-animation{display:none}@media (prefers-reduced-motion: reduce){:host{display:flex;align-items:center;justify-content:center}:host>span{opacity:1}:host>.loader{display:none}:host>svg{display:none}:host>.no-animation{display:block}}
|
|
3386
|
+
`,p$1=i$3`:host{--ds-auro-loader-background-color: currentcolor;--ds-auro-loader-border-color: currentcolor;--ds-auro-loader-color: currentcolor}
|
|
3387
|
+
`;class b extends i$1{constructor(){super(),this.appearance="default",this.keys=[0,1,2,3,4,5,6,7,8,9],this.mdCount=3,this.smCount=2,this.runtimeUtils=new h,this.orbit=false,this.ringworm=false,this.laser=false,this.pulse=false;}static get properties(){return {appearance:{type:String,reflect:true},laser:{type:Boolean,reflect:true},orbit:{type:Boolean,reflect:true},pulse:{type:Boolean,reflect:true},ringworm:{type:Boolean,reflect:true}}}static get styles(){return [u$1,c,p$1]}static register(t="auro-loader"){h.prototype.registerComponent(t,b);}firstUpdated(){this.runtimeUtils.handleComponentTagRename(this,"auro-loader");}connectedCallback(){super.connectedCallback();}defineTemplate(){let t=Array.from(Array(this.mdCount).keys());return this.orbit||this.laser?t=Array.from(Array(this.smCount).keys()):this.ringworm&&(t=Array.from(Array(0).keys())),t}render(){return x$1`
|
|
3388
|
+
${this.defineTemplate().map(t=>x$1`
|
|
3389
|
+
<span part="element" class="loader node-${t}"></span>
|
|
3390
|
+
`)}
|
|
3391
|
+
|
|
3392
|
+
<div class="no-animation body-default">Loading...</div>
|
|
3393
|
+
|
|
3394
|
+
${this.ringworm?x$1`
|
|
3395
|
+
<svg part="element" class="circular" viewBox="25 25 50 50">
|
|
3396
|
+
<circle class="path" cx="50" cy="50" r="20" fill="none"/>
|
|
3397
|
+
</svg>`:""}
|
|
3398
|
+
`}}const m$1=new WeakMap,v=new WeakMap,x=({host:t,target:e,matcher:o,removeOriginal:s=true})=>{v.has(t)||v.set(t,{matchers:new Set,targets:new Map});const a=v.get(t);return a.matchers.add(o),a.targets.has(e)||a.targets.set(e,new Map),a.targets.get(e).set(o,{removeOriginal:s,currentAttributes:new Map}),f$1({host:t,target:e,matcher:o,removeOriginal:s}),y$1(t),{cleanup:()=>g$1(t,e,o),getObservedAttributes:()=>A(t,e,o),getObservedAttribute:s=>S(t,e,o,s)}},g$1=(t,e,o)=>{const s=v.get(t);if(!s)return;const a=s.targets.get(e);a&&(a.delete(o),0===a.size&&s.targets.delete(e));let r=false;for(const t of s.targets.values())if(t.has(o)){r=true;break}r||s.matchers.delete(o),0!==s.targets.size&&0!==s.matchers.size||w$1(t);},f$1=({host:t,target:e,matcher:o,removeOriginal:s=true})=>{const a=t.getAttributeNames().filter(t=>o(t)).reduce((e,o)=>(e[o]=t.getAttribute(o),e),{});Object.entries(a).forEach(([a,r])=>{k$1(t,e,o,a,r),e.setAttribute(a,r),s&&t.removeAttribute(a);});},y$1=t=>{if(m$1.has(t))return m$1.get(t);const e=new MutationObserver(e=>{const o=v.get(t);o&&e.filter(t=>"attributes"===t.type).forEach(e=>{const s=e.attributeName;for(const e of o.matchers)if(e(s))for(const[s,a]of o.targets.entries())if(a.has(e)){const{removeOriginal:o}=a.get(e);f$1({host:t,target:s,matcher:e,removeOriginal:o});}});});return e.observe(t,{attributes:true}),m$1.set(t,e),e},w$1=t=>{if(m$1.has(t)){m$1.get(t).disconnect(),m$1.delete(t);}v.has(t)&&v.delete(t);},z$1=(t,e,o)=>{const s=v.get(t);if(!s)return;const a=s.targets.get(e);return a?a.get(o):void 0},k$1=(t,e,o,s,a)=>{const r=z$1(t,e,o);r&&r.currentAttributes.set(s,a);},S=(t,e,o,s)=>{const a=z$1(t,e,o);if(a)return a.currentAttributes.get(s)},A=(t,e,o)=>{const s=z$1(t,e,o);return s?Array.from(s.currentAttributes.entries()):[]},q={"aria-":t=>t.startsWith("aria-"),role:t=>t.match(/^role$/)},B=({host:t,target:e,removeOriginal:o=true})=>(({host:t,target:e,match:o,removeOriginal:s=true})=>{if("object"!=typeof t||!(t instanceof HTMLElement))throw new TypeError('a11yUtilities.js | transportAttributes | The "host" parameter must be an instance of HTMLElement.');if("object"!=typeof e||!(e instanceof HTMLElement))throw new TypeError('a11yUtilities.js | transportAttributes | The "target" parameter must be an instance of HTMLElement.');if("function"!=typeof o)throw new TypeError('a11yUtilities.js | transportAttributes | The "match" parameter must be a function.');if("boolean"!=typeof s)throw new TypeError('a11yUtilities.js | transportAttributes | The "removeOriginal" parameter must be a boolean.');return x({host:t,target:e,matcher:o,removeOriginal:s})})({host:t,target:e,match:t=>{for(const e in q)if(q[e](t))return true;return false},removeOriginal:o});class C extends i$1{attributeWatcher;static get properties(){return {layout:{type:String,attribute:"layout",reflect:true},shape:{type:String,attribute:"shape",reflect:true},size:{type:String,attribute:"size",reflect:true},appearance:{type:String,reflect:true},onDark:{type:Boolean,attribute:"ondark",reflect:true},wrapper:{attribute:false,reflect:false}}}constructor(){super(),this.onDark=false,this.appearance="default";}resetShapeClasses(){this.shape&&this.size&&this.wrapper&&(this.wrapper.classList.forEach(t=>{t.startsWith("shape-")&&this.wrapper.classList.remove(t);}),this.wrapper.classList.add(`shape-${this.shape.toLowerCase()}-${this.size.toLowerCase()}`));}resetLayoutClasses(){this.layout&&this.wrapper&&(this.wrapper.classList.forEach(t=>{t.startsWith("layout-")&&this.wrapper.classList.remove(t);}),this.wrapper.classList.add(`layout-${this.layout.toLowerCase()}`));}updateComponentArchitecture(){this.resetLayoutClasses(),this.resetShapeClasses();}updated(t){(t.has("layout")||t.has("shape")||t.has("size"))&&this.updateComponentArchitecture();}firstUpdated(){super.firstUpdated(),this.wrapper=this.shadowRoot.querySelector(".wrapper"),this.attributeWatcher=B({host:this,target:this.shadowRoot.querySelector(".wrapper")});}disconnectedCallback(){super.disconnectedCallback(),this.attributeWatcher&&(this.attributeWatcher.cleanup(),this.attributeWatcher=null);}render(){try{return this.renderLayout()}catch(t){return console.error("Failed to get the defined layout - using the default layout",t),this.getLayout("default")}}}var U=i$3`[auro-loader]{color:var(--ds-auro-button-loader-color, #ffffff)}.auro-button{-webkit-tap-highlight-color:var(--ds-auro-button-tap-color);color:var(--ds-auro-button-text-color);background-color:var(--ds-auro-button-container-color);background-image:linear-gradient(var(--ds-auro-button-container-image),var(--ds-auro-button-container-image));border-color:var(--ds-auro-button-border-color)}:host(:focus-within) .auro-button{outline-color:var(--ds-auro-button-border-inset-color)}:host(:not([disabled]):is([data-hover],[data-active])){--ds-auro-button-container-color: var(--ds-advanced-color-button-primary-background-hover, #00274a);--ds-auro-button-container-image: var(--ds-advanced-color-button-primary-background-hover, #00274a);--ds-auro-button-border-color: var(--ds-advanced-color-button-primary-border-hover, #00274a)}:host([disabled]){--ds-auro-button-container-color: var(--ds-advanced-color-button-primary-background-disabled, #acc9e2);--ds-auro-button-container-image: var(--ds-advanced-color-button-primary-background-disabled, #acc9e2);--ds-auro-button-border-color: var(--ds-advanced-color-button-primary-border-disabled, #acc9e2)}:host([variant=secondary]){--ds-auro-button-container-color: var(--ds-advanced-color-button-secondary-background, #ffffff);--ds-auro-button-container-image: var(--ds-advanced-color-button-secondary-background, #ffffff);--ds-auro-button-border-color: var(--ds-advanced-color-button-secondary-border, #01426a);--ds-auro-button-text-color: var(--ds-advanced-color-button-secondary-text, #01426a);--ds-auro-button-loader-color: var(--ds-advanced-color-button-secondary-text, #01426a)}:host([variant=secondary]:not([disabled]):is([data-hover],[data-active])){--ds-auro-button-container-color: var(--ds-advanced-color-button-secondary-background-hover, #f2f2f2);--ds-auro-button-container-image: var(--ds-advanced-color-button-secondary-background-hover, #f2f2f2);--ds-auro-button-border-color: var(--ds-advanced-color-button-secondary-border-hover, #00274a);--ds-auro-button-text-color: var(--ds-advanced-color-button-secondary-text-hover, #00274a)}:host([variant=secondary]:focus-within){--ds-auro-button-border-inset-color: var(--ds-advanced-color-state-focused, #01426a)}:host([variant=secondary][disabled]){--ds-auro-button-container-color: var(--ds-advanced-color-button-secondary-background-disabled, #f7f7f7);--ds-auro-button-container-image: var(--ds-advanced-color-button-secondary-background-disabled, #f7f7f7);--ds-auro-button-border-color: var(--ds-advanced-color-button-secondary-border-disabled, #cfe0ef);--ds-auro-button-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host([variant=tertiary]){--ds-auro-button-container-color: var(--ds-advanced-color-button-tertiary-background, rgba(0, 0, 0, .05));--ds-auro-button-container-image: var(--ds-advanced-color-button-tertiary-background, rgba(0, 0, 0, .05));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-advanced-color-button-tertiary-text, #01426a);--ds-auro-button-loader-color: var(--ds-advanced-color-button-tertiary-text, #01426a)}:host([variant=tertiary]:not([disabled]):is([data-hover],[data-active])){--ds-auro-button-container-color: var(--ds-advanced-color-button-tertiary-background-hover, rgba(0, 0, 0, .1));--ds-auro-button-container-image: var(--ds-advanced-color-button-tertiary-background-hover, rgba(0, 0, 0, .1));--ds-auro-button-border-color: transparent}:host([variant=tertiary]:focus-within){--ds-auro-button-border-color: var(--ds-advanced-color-state-focused, #01426a);--ds-auro-button-border-inset-color: var(--ds-advanced-color-state-focused, #01426a)}:host([variant=tertiary][disabled]){--ds-auro-button-container-color: var(--ds-advanced-color-button-tertiary-background, rgba(0, 0, 0, .05));--ds-auro-button-container-image: var(--ds-advanced-color-button-tertiary-background, rgba(0, 0, 0, .05));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host([variant=ghost]){--ds-auro-button-container-color: transparent;--ds-auro-button-container-image: transparent;--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-advanced-color-button-ghost-text, #01426a);--ds-auro-button-loader-color: var(--ds-advanced-color-button-ghost-text, #01426a)}:host([variant=ghost]:not([disabled]):is([data-hover],[data-active])){--ds-auro-button-container-color: var(--ds-advanced-color-button-ghost-background-hover, rgba(0, 0, 0, .05));--ds-auro-button-container-image: var(--ds-advanced-color-button-ghost-background-hover, rgba(0, 0, 0, .05));--ds-auro-button-border-color: transparent}:host([variant=ghost]:focus-within){--ds-auro-button-border-color: var(--ds-advanced-color-state-focused, #01426a);--ds-auro-button-border-inset-color: var(--ds-advanced-color-state-focused, #01426a)}:host([variant=ghost][disabled]){--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host([variant=flat]) .auro-button{color:var(--ds-advanced-color-button-flat-text, #676767);background-color:transparent;background-image:none;border-color:transparent}:host([variant=flat]) .auro-button:active:not(:disabled),:host([variant=flat]) .auro-button:hover:not(:disabled){color:var(--ds-advanced-color-button-flat-text-hover, #525252);background-color:transparent;background-image:none;border-color:transparent}:host([variant=flat]) .auro-button:disabled{color:var(--ds-advanced-color-button-flat-text-disabled, #d0d0d0);background-color:transparent;background-image:none;border-color:transparent}:host([variant=flat]:focus-within){--ds-auro-button-border-color: var(--ds-advanced-color-state-focused, #01426a);--ds-auro-button-border-inset-color: var(--ds-advanced-color-state-focused, #01426a)}:host([onDark]),:host([appearance=inverse]){--ds-auro-button-border-color: var(--ds-advanced-color-button-primary-border-inverse, #ffffff);--ds-auro-button-border-inset-color: var(--ds-advanced-color-state-focused-inverse, #ffffff);--ds-auro-button-container-color: var(--ds-advanced-color-button-primary-background-inverse, #ffffff);--ds-auro-button-container-image: var(--ds-advanced-color-button-primary-background-inverse, #ffffff);--ds-auro-button-loader-color: var(--ds-advanced-color-button-primary-text-inverse, #01426a);--ds-auro-button-text-color: var(--ds-advanced-color-button-primary-text-inverse, #01426a)}:host([ondark]:not([disabled]):is([data-hover],[data-active])),:host([appearance=inverse]:not([disabled]):is([data-hover],[data-active])){--ds-auro-button-border-color: var(--ds-advanced-color-button-primary-border-inverse-hover, #ebf3f9);--ds-auro-button-container-color: var(--ds-advanced-color-button-primary-background-inverse-hover, #ebf3f9);--ds-auro-button-container-image: var(--ds-advanced-color-button-primary-background-inverse-hover, #ebf3f9)}:host([ondark]:focus-within),:host([appearance=inverse]:focus-within){--ds-auro-button-border-inset-color: var(--ds-advanced-color-state-focused, #01426a)}:host([ondark][disabled]),:host([appearance=inverse][disabled]){--ds-auro-button-border-color: var(--ds-advanced-color-button-primary-border-inverse-disabled, rgba(255, 255, 255, .75));--ds-auro-button-container-color: var(--ds-advanced-color-button-primary-background-inverse-disabled, rgba(255, 255, 255, .75));--ds-auro-button-container-image: var(--ds-advanced-color-button-primary-background-inverse-disabled, rgba(255, 255, 255, .75));--ds-auro-button-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([ondark][variant=secondary]),:host([appearance=inverse][variant=secondary]){--ds-auro-button-container-color: transparent;--ds-auro-button-container-image: transparent;--ds-auro-button-border-color: var(--ds-advanced-color-button-secondary-border-inverse, #ffffff);--ds-auro-button-text-color: var(--ds-advanced-color-button-secondary-text-inverse, #ffffff);--ds-auro-button-loader-color: var(--ds-advanced-color-button-secondary-text-inverse, #ffffff)}:host([ondark][variant=secondary]:not([disabled]):is([data-hover],[data-active])),:host([appearance=inverse][variant=secondary]:not([disabled]):is([data-hover],[data-active])){--ds-auro-button-text-color: var(--ds-advanced-color-button-secondary-text-inverse, #ffffff);--ds-auro-button-container-color: var(--ds-advanced-color-button-secondary-background-inverse-hover, rgba(255, 255, 255, .1));--ds-auro-button-container-image: var(--ds-advanced-color-button-secondary-background-inverse-hover, rgba(255, 255, 255, .1))}:host([ondark][variant=secondary]:focus-within),:host([appearance=inverse][variant=secondary]:focus-within){--ds-auro-button-border-inset-color: var(--ds-advanced-color-state-focused-inverse, #ffffff)}:host([ondark][variant=secondary][disabled]),:host([appearance=inverse][variant=secondary][disabled]){--ds-auro-button-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894);--ds-auro-button-border-color: var(--ds-advanced-color-button-secondary-border-inverse-disabled, #dddddd)}:host([ondark][variant=tertiary]),:host([appearance=inverse][variant=tertiary]){--ds-auro-button-container-color: var(--ds-advanced-color-button-tertiary-background-inverse, rgba(255, 255, 255, .05));--ds-auro-button-container-image: var(--ds-advanced-color-button-tertiary-background-inverse, rgba(255, 255, 255, .05));--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-advanced-color-button-tertiary-text-inverse, #ffffff);--ds-auro-button-loader-color: var(--ds-advanced-color-button-tertiary-text-inverse, #ffffff)}:host([ondark][variant=tertiary]:not([disabled]):is([data-hover],[data-active])),:host([appearance=inverse][variant=tertiary]:not([disabled]):is([data-hover],[data-active])){--ds-auro-button-container-color: var(--ds-advanced-color-button-tertiary-background-inverse-hover, rgba(255, 255, 255, .1));--ds-auro-button-container-image: var(--ds-advanced-color-button-tertiary-background-inverse-hover, rgba(255, 255, 255, .1))}:host([ondark][variant=tertiary]:focus-within),:host([appearance=inverse][variant=tertiary]:focus-within){--ds-auro-button-border-color: var(--ds-advanced-color-state-focused-inverse, #ffffff);--ds-auro-button-border-inset-color: var(--ds-advanced-color-state-focused-inverse, #ffffff)}:host([ondark][variant=tertiary][disabled]),:host([appearance=inverse][variant=tertiary][disabled]){--ds-auro-button-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([ondark][variant=ghost]),:host([appearance=inverse][variant=ghost]){--ds-auro-button-container-color: transparent;--ds-auro-button-container-image: transparent;--ds-auro-button-border-color: transparent;--ds-auro-button-text-color: var(--ds-advanced-color-button-ghost-text-inverse, #ffffff);--ds-auro-button-loader-color: var(--ds-advanced-color-button-ghost-text-inverse, #ffffff)}:host([ondark][variant=ghost]:not([disabled]):is([data-hover],[data-active])),:host([appearance=inverse][variant=ghost]:not([disabled]):is([data-hover],[data-active])){--ds-auro-button-container-color: var(--ds-advanced-color-button-ghost-background-inverse-hover, rgba(255, 255, 255, .05));--ds-auro-button-container-image: var(--ds-advanced-color-button-ghost-background-inverse-hover, rgba(255, 255, 255, .05));--ds-auro-button-border-color: transparent}:host([ondark][variant=ghost]:focus-within),:host([appearance=inverse][variant=ghost]:focus-within){border-color:transparent;--ds-auro-button-border-inset-color: var(--ds-advanced-color-state-focused-inverse, #ffffff)}:host([ondark][variant=ghost][disabled]),:host([appearance=inverse][variant=ghost][disabled]){--ds-auro-button-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([ondark][variant=flat]) .auro-button,:host([appearance=inverse][variant=flat]) .auro-button{color:var(--ds-advanced-color-button-flat-text-inverse, #ffffff);background-color:transparent;background-image:none;border-color:transparent}:host([ondark][variant=flat]) .auro-button:active:not(:disabled),:host([ondark][variant=flat]) .auro-button:hover:not(:disabled),:host([appearance=inverse][variant=flat]) .auro-button:active:not(:disabled),:host([appearance=inverse][variant=flat]) .auro-button:hover:not(:disabled){color:var(--ds-advanced-color-button-flat-text-inverse-hover, #adadad);background-color:transparent;background-image:none;border-color:transparent}:host([ondark][variant=flat]) .auro-button:disabled,:host([appearance=inverse][variant=flat]) .auro-button:disabled{color:var(--ds-advanced-color-button-flat-text-inverse-disabled, #7e8894);background-color:transparent;background-image:none;border-color:transparent}:host([ondark][variant=flat]:focus-within),:host([appearance=inverse][variant=flat]:focus-within){--ds-auro-button-border-color: var(--ds-advanced-color-state-focused-inverse, #ffffff);--ds-auro-button-border-inset-color: var(--ds-advanced-color-state-focused-inverse, #ffffff)}
|
|
3399
|
+
`,H=i$3`.shape-rounded-xl{min-height:68px;max-height:68px;border-style:solid;overflow:hidden;border-radius:6px}.shape-rounded-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-rounded-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-rounded-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-pill-xl{min-height:68px;max-height:68px;border-style:solid;overflow:hidden;border-radius:36px}.shape-pill-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-pill-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-pill-left-xl{min-height:68px;max-height:68px;border-style:solid;overflow:hidden;border-radius:36px 0 0 36px}.shape-pill-left-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-pill-left-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-left-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-pill-right-xl{min-height:68px;max-height:68px;border-style:solid;overflow:hidden;border-radius:0 36px 36px 0}.shape-pill-right-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-pill-right-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-right-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-circle-xl{min-height:68px;max-height:68px;border-style:solid;overflow:hidden;border-radius:50%;min-width:72px;max-width:72px;padding:0}.shape-circle-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-circle-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-circle-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-square-xl{min-height:68px;max-height:68px;border-style:solid;overflow:hidden;border-radius:6px;min-width:72px;max-width:72px;padding:0}.shape-square-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-square-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-square-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-rounded-lg{min-height:52px;max-height:52px;border-style:solid;overflow:hidden;border-radius:6px}.shape-rounded-lg.simple{border-width:0px;min-height:56px;max-height:56px;background-color:unset;box-shadow:none}.shape-rounded-lg.thin{border-width:1px;min-height:54px;max-height:54px;background-color:unset}.shape-rounded-lg.parentBorder{border:0;box-shadow:unset;min-height:52px;max-height:52px}.shape-pill-lg{min-height:52px;max-height:52px;border-style:solid;overflow:hidden;border-radius:28px}.shape-pill-lg.simple{border-width:0px;min-height:56px;max-height:56px;background-color:unset;box-shadow:none}.shape-pill-lg.thin{border-width:1px;min-height:54px;max-height:54px;background-color:unset}.shape-pill-lg.parentBorder{border:0;box-shadow:unset;min-height:52px;max-height:52px}.shape-pill-left-lg{min-height:52px;max-height:52px;border-style:solid;overflow:hidden;border-radius:28px 0 0 28px}.shape-pill-left-lg.simple{border-width:0px;min-height:56px;max-height:56px;background-color:unset;box-shadow:none}.shape-pill-left-lg.thin{border-width:1px;min-height:54px;max-height:54px;background-color:unset}.shape-pill-left-lg.parentBorder{border:0;box-shadow:unset;min-height:52px;max-height:52px}.shape-pill-right-lg{min-height:52px;max-height:52px;border-style:solid;overflow:hidden;border-radius:0 28px 28px 0}.shape-pill-right-lg.simple{border-width:0px;min-height:56px;max-height:56px;background-color:unset;box-shadow:none}.shape-pill-right-lg.thin{border-width:1px;min-height:54px;max-height:54px;background-color:unset}.shape-pill-right-lg.parentBorder{border:0;box-shadow:unset;min-height:52px;max-height:52px}.shape-circle-lg{min-height:52px;max-height:52px;border-style:solid;overflow:hidden;border-radius:50%;min-width:56px;max-width:56px;padding:0}.shape-circle-lg.simple{border-width:0px;min-height:56px;max-height:56px;background-color:unset;box-shadow:none}.shape-circle-lg.thin{border-width:1px;min-height:54px;max-height:54px;background-color:unset}.shape-circle-lg.parentBorder{border:0;box-shadow:unset;min-height:52px;max-height:52px}.shape-square-lg{min-height:52px;max-height:52px;border-style:solid;overflow:hidden;border-radius:6px;min-width:56px;max-width:56px;padding:0}.shape-square-lg.simple{border-width:0px;min-height:56px;max-height:56px;background-color:unset;box-shadow:none}.shape-square-lg.thin{border-width:1px;min-height:54px;max-height:54px;background-color:unset}.shape-square-lg.parentBorder{border:0;box-shadow:unset;min-height:52px;max-height:52px}.shape-rounded-md{min-height:44px;max-height:44px;border-style:solid;overflow:hidden;border-radius:6px}.shape-rounded-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-rounded-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-rounded-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-pill-md{min-height:44px;max-height:44px;border-style:solid;overflow:hidden;border-radius:24px}.shape-pill-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-pill-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-pill-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-pill-left-md{min-height:44px;max-height:44px;border-style:solid;overflow:hidden;border-radius:24px 0 0 24px}.shape-pill-left-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-pill-left-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-pill-left-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-pill-right-md{min-height:44px;max-height:44px;border-style:solid;overflow:hidden;border-radius:0 24px 24px 0}.shape-pill-right-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-pill-right-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-pill-right-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-circle-md{min-height:44px;max-height:44px;border-style:solid;overflow:hidden;border-radius:50%;min-width:48px;max-width:48px;padding:0}.shape-circle-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-circle-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-circle-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-square-md{min-height:44px;max-height:44px;border-style:solid;overflow:hidden;border-radius:6px;min-width:48px;max-width:48px;padding:0}.shape-square-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-square-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-square-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-rounded-sm{min-height:32px;max-height:32px;border-style:solid;overflow:hidden;border-radius:6px}.shape-rounded-sm.simple{border-width:0px;min-height:36px;max-height:36px;background-color:unset;box-shadow:none}.shape-rounded-sm.thin{border-width:1px;min-height:34px;max-height:34px;background-color:unset}.shape-rounded-sm.parentBorder{border:0;box-shadow:unset;min-height:32px;max-height:32px}.shape-pill-sm{min-height:32px;max-height:32px;border-style:solid;overflow:hidden;border-radius:18px}.shape-pill-sm.simple{border-width:0px;min-height:36px;max-height:36px;background-color:unset;box-shadow:none}.shape-pill-sm.thin{border-width:1px;min-height:34px;max-height:34px;background-color:unset}.shape-pill-sm.parentBorder{border:0;box-shadow:unset;min-height:32px;max-height:32px}.shape-pill-left-sm{min-height:32px;max-height:32px;border-style:solid;overflow:hidden;border-radius:18px 0 0 18px}.shape-pill-left-sm.simple{border-width:0px;min-height:36px;max-height:36px;background-color:unset;box-shadow:none}.shape-pill-left-sm.thin{border-width:1px;min-height:34px;max-height:34px;background-color:unset}.shape-pill-left-sm.parentBorder{border:0;box-shadow:unset;min-height:32px;max-height:32px}.shape-pill-right-sm{min-height:32px;max-height:32px;border-style:solid;overflow:hidden;border-radius:0 18px 18px 0}.shape-pill-right-sm.simple{border-width:0px;min-height:36px;max-height:36px;background-color:unset;box-shadow:none}.shape-pill-right-sm.thin{border-width:1px;min-height:34px;max-height:34px;background-color:unset}.shape-pill-right-sm.parentBorder{border:0;box-shadow:unset;min-height:32px;max-height:32px}.shape-circle-sm{min-height:32px;max-height:32px;border-style:solid;overflow:hidden;border-radius:50%;min-width:36px;max-width:36px;padding:0}.shape-circle-sm.simple{border-width:0px;min-height:36px;max-height:36px;background-color:unset;box-shadow:none}.shape-circle-sm.thin{border-width:1px;min-height:34px;max-height:34px;background-color:unset}.shape-circle-sm.parentBorder{border:0;box-shadow:unset;min-height:32px;max-height:32px}.shape-square-sm{min-height:32px;max-height:32px;border-style:solid;overflow:hidden;border-radius:6px;min-width:36px;max-width:36px;padding:0}.shape-square-sm.simple{border-width:0px;min-height:36px;max-height:36px;background-color:unset;box-shadow:none}.shape-square-sm.thin{border-width:1px;min-height:34px;max-height:34px;background-color:unset}.shape-square-sm.parentBorder{border:0;box-shadow:unset;min-height:32px;max-height:32px}.shape-rounded-xs{min-height:20px;max-height:20px;border-style:solid;overflow:hidden;border-radius:4px}.shape-rounded-xs.simple{border-width:0px;min-height:24px;max-height:24px;background-color:unset;box-shadow:none}.shape-rounded-xs.thin{border-width:1px;min-height:22px;max-height:22px;background-color:unset}.shape-rounded-xs.parentBorder{border:0;box-shadow:unset;min-height:20px;max-height:20px}.shape-pill-xs{min-height:20px;max-height:20px;border-style:solid;overflow:hidden;border-radius:12px}.shape-pill-xs.simple{border-width:0px;min-height:24px;max-height:24px;background-color:unset;box-shadow:none}.shape-pill-xs.thin{border-width:1px;min-height:22px;max-height:22px;background-color:unset}.shape-pill-xs.parentBorder{border:0;box-shadow:unset;min-height:20px;max-height:20px}.shape-pill-left-xs{min-height:20px;max-height:20px;border-style:solid;overflow:hidden;border-radius:12px 0 0 12px}.shape-pill-left-xs.simple{border-width:0px;min-height:24px;max-height:24px;background-color:unset;box-shadow:none}.shape-pill-left-xs.thin{border-width:1px;min-height:22px;max-height:22px;background-color:unset}.shape-pill-left-xs.parentBorder{border:0;box-shadow:unset;min-height:20px;max-height:20px}.shape-pill-right-xs{min-height:20px;max-height:20px;border-style:solid;overflow:hidden;border-radius:0 12px 12px 0}.shape-pill-right-xs.simple{border-width:0px;min-height:24px;max-height:24px;background-color:unset;box-shadow:none}.shape-pill-right-xs.thin{border-width:1px;min-height:22px;max-height:22px;background-color:unset}.shape-pill-right-xs.parentBorder{border:0;box-shadow:unset;min-height:20px;max-height:20px}.shape-circle-xs{min-height:20px;max-height:20px;border-style:solid;overflow:hidden;border-radius:50%;min-width:24px;max-width:24px;padding:0}.shape-circle-xs.simple{border-width:0px;min-height:24px;max-height:24px;background-color:unset;box-shadow:none}.shape-circle-xs.thin{border-width:1px;min-height:22px;max-height:22px;background-color:unset}.shape-circle-xs.parentBorder{border:0;box-shadow:unset;min-height:20px;max-height:20px}.shape-square-xs{min-height:20px;max-height:20px;border-style:solid;overflow:hidden;border-radius:6px;min-width:24px;max-width:24px;padding:0}.shape-square-xs.simple{border-width:0px;min-height:24px;max-height:24px;background-color:unset;box-shadow:none}.shape-square-xs.thin{border-width:1px;min-height:22px;max-height:22px;background-color:unset}.shape-square-xs.parentBorder{border:0;box-shadow:unset;min-height:20px;max-height:20px}
|
|
3400
|
+
`,M$1=i$3`:focus:not(:focus-visible){outline:3px solid transparent}.util_insetNone{padding:0}.util_insetXxxs{padding:.125rem}.util_insetXxxs--stretch{padding:.25rem .125rem}.util_insetXxxs--squish{padding:0 .125rem}.util_insetXxs{padding:.25rem}.util_insetXxs--stretch{padding:.375rem .25rem}.util_insetXxs--squish{padding:.125rem .25rem}.util_insetXs{padding:.5rem}.util_insetXs--stretch{padding:.75rem .5rem}.util_insetXs--squish{padding:.25rem .5rem}.util_insetSm{padding:.75rem}.util_insetSm--stretch{padding:1.125rem .75rem}.util_insetSm--squish{padding:.375rem .75rem}.util_insetMd{padding:1rem}.util_insetMd--stretch{padding:1.5rem 1rem}.util_insetMd--squish{padding:.5rem 1rem}.util_insetLg{padding:1.5rem}.util_insetLg--stretch{padding:2.25rem 1.5rem}.util_insetLg--squish{padding:.75rem 1.5rem}.util_insetXl{padding:2rem}.util_insetXl--stretch{padding:3rem 2rem}.util_insetXl--squish{padding:1rem 2rem}.util_insetXxl{padding:3rem}.util_insetXxl--stretch{padding:4.5rem 3rem}.util_insetXxl--squish{padding:1.5rem 3rem}.util_insetXxxl{padding:4rem}.util_insetXxxl--stretch{padding:6rem 4rem}.util_insetXxxl--squish{padding:2rem 4rem}.body-default{font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.body-default,.body-lg{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-lg{font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{font-size:var(--wcss-body-sm-font-size, .875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.body-sm,.body-xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-xs{font-size:var(--wcss-body-xs-font-size, .75rem);line-height:var(--wcss-body-xs-line-height, 1rem)}.body-2xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:var(--wcss-body-2xs-font-size, .625rem);font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);line-height:var(--wcss-body-2xs-line-height, .875rem)}.display-2xl{font-family:var(--wcss-display-2xl-family, "AS Circular"),var(--wcss-display-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem));font-weight:var(--wcss-display-2xl-weight, 300);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);line-height:var(--wcss-display-2xl-line-height, 1.3)}.display-xl{font-family:var(--wcss-display-xl-family, "AS Circular"),var(--wcss-display-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem));font-weight:var(--wcss-display-xl-weight, 300);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);line-height:var(--wcss-display-xl-line-height, 1.3)}.display-lg{font-family:var(--wcss-display-lg-family, "AS Circular"),var(--wcss-display-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem));font-weight:var(--wcss-display-lg-weight, 300);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);line-height:var(--wcss-display-lg-line-height, 1.3)}.display-md{font-family:var(--wcss-display-md-family, "AS Circular"),var(--wcss-display-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem));font-weight:var(--wcss-display-md-weight, 300);letter-spacing:var(--wcss-display-md-letter-spacing, 0);line-height:var(--wcss-display-md-line-height, 1.3)}.display-sm{font-family:var(--wcss-display-sm-family, "AS Circular"),var(--wcss-display-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem));font-weight:var(--wcss-display-sm-weight, 300);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);line-height:var(--wcss-display-sm-line-height, 1.3)}.display-xs{font-family:var(--wcss-display-xs-family, "AS Circular"),var(--wcss-display-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem));font-weight:var(--wcss-display-xs-weight, 300);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);line-height:var(--wcss-display-xs-line-height, 1.3)}.heading-xl{font-family:var(--wcss-heading-xl-family, "AS Circular"),var(--wcss-heading-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem));font-weight:var(--wcss-heading-xl-weight, 300);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);line-height:var(--wcss-heading-xl-line-height, 1.3)}.heading-lg{font-family:var(--wcss-heading-lg-family, "AS Circular"),var(--wcss-heading-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem));font-weight:var(--wcss-heading-lg-weight, 300);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);line-height:var(--wcss-heading-lg-line-height, 1.3)}.heading-md{font-family:var(--wcss-heading-md-family, "AS Circular"),var(--wcss-heading-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem));font-weight:var(--wcss-heading-md-weight, 300);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);line-height:var(--wcss-heading-md-line-height, 1.3)}.heading-sm{font-family:var(--wcss-heading-sm-family, "AS Circular"),var(--wcss-heading-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem));font-weight:var(--wcss-heading-sm-weight, 300);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);line-height:var(--wcss-heading-sm-line-height, 1.3)}.heading-xs{font-family:var(--wcss-heading-xs-family, "AS Circular"),var(--wcss-heading-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem));font-weight:var(--wcss-heading-xs-weight, 450);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);line-height:var(--wcss-heading-xs-line-height, 1.3)}.heading-2xs{font-family:var(--wcss-heading-2xs-family, "AS Circular"),var(--wcss-heading-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem));font-weight:var(--wcss-heading-2xs-weight, 450);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);line-height:var(--wcss-heading-2xs-line-height, 1.3)}.accent-2xl{font-family:var(--wcss-accent-2xl-family, "Good OT"),var(--wcss-accent-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));font-weight:var(--wcss-accent-2xl-weight, 450);letter-spacing:var(--wcss-accent-2xl-letter-spacing, .05em);line-height:var(--wcss-accent-2xl-line-height, 1)}.accent-2xl,.accent-xl{text-transform:uppercase}.accent-xl{font-family:var(--wcss-accent-xl-family, "Good OT"),var(--wcss-accent-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));font-weight:var(--wcss-accent-xl-weight, 450);letter-spacing:var(--wcss-accent-xl-letter-spacing, .05em);line-height:var(--wcss-accent-xl-line-height, 1.3)}.accent-lg{font-family:var(--wcss-accent-lg-family, "Good OT"),var(--wcss-accent-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));font-weight:var(--wcss-accent-lg-weight, 450);letter-spacing:var(--wcss-accent-lg-letter-spacing, .05em);line-height:var(--wcss-accent-lg-line-height, 1.3)}.accent-lg,.accent-md{text-transform:uppercase}.accent-md{font-family:var(--wcss-accent-md-family, "Good OT"),var(--wcss-accent-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));font-weight:var(--wcss-accent-md-weight, 500);letter-spacing:var(--wcss-accent-md-letter-spacing, .05em);line-height:var(--wcss-accent-md-line-height, 1.3)}.accent-sm{font-family:var(--wcss-accent-sm-family, "Good OT"),var(--wcss-accent-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));font-weight:var(--wcss-accent-sm-weight, 500);letter-spacing:var(--wcss-accent-sm-letter-spacing, .05em);line-height:var(--wcss-accent-sm-line-height, 1.3)}.accent-sm,.accent-xs{text-transform:uppercase}.accent-xs{font-family:var(--wcss-accent-xs-family, "Good OT"),var(--wcss-accent-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));font-weight:var(--wcss-accent-xs-weight, 500);letter-spacing:var(--wcss-accent-xs-letter-spacing, .1em);line-height:var(--wcss-accent-xs-line-height, 1.3)}.accent-2xs{font-family:var(--wcss-accent-2xs-family, "Good OT"),var(--wcss-accent-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xs-font-size, clamp(.875rem, 1.1666666667vw, .875rem));font-weight:var(--wcss-accent-2xs-weight, 450);letter-spacing:var(--wcss-accent-2xs-letter-spacing, .1em);line-height:var(--wcss-accent-2xs-line-height, 1.3);text-transform:uppercase}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px,1px,1px,1px);width:1px;height:1px;padding:0;border:0}:host([size=xs][shape=rounded]) ::slotted(auro-icon),:host([size=xs][shape=rounded]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-200, 1rem)}:host([size=xs][shape=rounded][variant=primary]) .auro-button:focus,:host([size=xs][shape=rounded][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=rounded][variant=primary]) .auro-button:focus:after,:host([size=xs][shape=rounded][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=xs][shape=rounded][variant=secondary]) .auro-button:focus,:host([size=xs][shape=rounded][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=rounded][variant=tertiary]) .auro-button:focus,:host([size=xs][shape=rounded][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=rounded][variant=ghost]) .auro-button:focus,:host([size=xs][shape=rounded][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=pill]) ::slotted(auro-icon),:host([size=xs][shape=pill]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-200, 1rem)}:host([size=xs][shape=pill][variant=primary]) .auro-button:focus,:host([size=xs][shape=pill][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=pill][variant=primary]) .auro-button:focus:after,:host([size=xs][shape=pill][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=xs][shape=pill][variant=secondary]) .auro-button:focus,:host([size=xs][shape=pill][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=pill][variant=tertiary]) .auro-button:focus,:host([size=xs][shape=pill][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=pill][variant=ghost]) .auro-button:focus,:host([size=xs][shape=pill][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=pill-left]) ::slotted(auro-icon),:host([size=xs][shape=pill-left]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-200, 1rem)}:host([size=xs][shape=pill-left][variant=primary]) .auro-button:focus,:host([size=xs][shape=pill-left][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=pill-left][variant=primary]) .auro-button:focus:after,:host([size=xs][shape=pill-left][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=xs][shape=pill-left][variant=secondary]) .auro-button:focus,:host([size=xs][shape=pill-left][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=pill-left][variant=tertiary]) .auro-button:focus,:host([size=xs][shape=pill-left][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=pill-left][variant=ghost]) .auro-button:focus,:host([size=xs][shape=pill-left][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=pill-right]) ::slotted(auro-icon),:host([size=xs][shape=pill-right]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-200, 1rem)}:host([size=xs][shape=pill-right][variant=primary]) .auro-button:focus,:host([size=xs][shape=pill-right][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=pill-right][variant=primary]) .auro-button:focus:after,:host([size=xs][shape=pill-right][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=xs][shape=pill-right][variant=secondary]) .auro-button:focus,:host([size=xs][shape=pill-right][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=pill-right][variant=tertiary]) .auro-button:focus,:host([size=xs][shape=pill-right][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=pill-right][variant=ghost]) .auro-button:focus,:host([size=xs][shape=pill-right][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=circle]) ::slotted(auro-icon),:host([size=xs][shape=circle]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=xs][shape=circle][variant=primary]) .auro-button:focus,:host([size=xs][shape=circle][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=circle][variant=primary]) .auro-button:focus:after,:host([size=xs][shape=circle][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=xs][shape=circle][variant=secondary]) .auro-button:focus,:host([size=xs][shape=circle][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 1px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=circle][variant=tertiary]) .auro-button:focus,:host([size=xs][shape=circle][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=circle][variant=flat]) .auro-button:focus,:host([size=xs][shape=circle][variant=flat]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=circle][variant=ghost]) .auro-button:focus,:host([size=xs][shape=circle][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=square]) ::slotted(auro-icon),:host([size=xs][shape=square]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=xs][shape=square][variant=primary]) .auro-button:focus,:host([size=xs][shape=square][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=square][variant=primary]) .auro-button:focus:after,:host([size=xs][shape=square][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=xs][shape=square][variant=secondary]) .auro-button:focus,:host([size=xs][shape=square][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 1px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=square][variant=tertiary]) .auro-button:focus,:host([size=xs][shape=square][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=square][variant=flat]) .auro-button:focus,:host([size=xs][shape=square][variant=flat]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xs][shape=square][variant=ghost]) .auro-button:focus,:host([size=xs][shape=square][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=rounded]) ::slotted(auro-icon),:host([size=sm][shape=rounded]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=sm][shape=rounded][variant=primary]) .auro-button:focus,:host([size=sm][shape=rounded][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=rounded][variant=primary]) .auro-button:focus:after,:host([size=sm][shape=rounded][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=sm][shape=rounded][variant=secondary]) .auro-button:focus,:host([size=sm][shape=rounded][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=rounded][variant=tertiary]) .auro-button:focus,:host([size=sm][shape=rounded][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=rounded][variant=ghost]) .auro-button:focus,:host([size=sm][shape=rounded][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=pill]) ::slotted(auro-icon),:host([size=sm][shape=pill]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=sm][shape=pill][variant=primary]) .auro-button:focus,:host([size=sm][shape=pill][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=pill][variant=primary]) .auro-button:focus:after,:host([size=sm][shape=pill][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=sm][shape=pill][variant=secondary]) .auro-button:focus,:host([size=sm][shape=pill][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=pill][variant=tertiary]) .auro-button:focus,:host([size=sm][shape=pill][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=pill][variant=ghost]) .auro-button:focus,:host([size=sm][shape=pill][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=pill-left]) ::slotted(auro-icon),:host([size=sm][shape=pill-left]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=sm][shape=pill-left][variant=primary]) .auro-button:focus,:host([size=sm][shape=pill-left][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=pill-left][variant=primary]) .auro-button:focus:after,:host([size=sm][shape=pill-left][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=sm][shape=pill-left][variant=secondary]) .auro-button:focus,:host([size=sm][shape=pill-left][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=pill-left][variant=tertiary]) .auro-button:focus,:host([size=sm][shape=pill-left][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=pill-left][variant=ghost]) .auro-button:focus,:host([size=sm][shape=pill-left][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=pill-right]) ::slotted(auro-icon),:host([size=sm][shape=pill-right]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=sm][shape=pill-right][variant=primary]) .auro-button:focus,:host([size=sm][shape=pill-right][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=pill-right][variant=primary]) .auro-button:focus:after,:host([size=sm][shape=pill-right][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=sm][shape=pill-right][variant=secondary]) .auro-button:focus,:host([size=sm][shape=pill-right][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=pill-right][variant=tertiary]) .auro-button:focus,:host([size=sm][shape=pill-right][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=pill-right][variant=ghost]) .auro-button:focus,:host([size=sm][shape=pill-right][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=circle]) ::slotted(auro-icon),:host([size=sm][shape=circle]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=sm][shape=circle][variant=primary]) .auro-button:focus,:host([size=sm][shape=circle][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 3px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=circle][variant=primary]) .auro-button:focus:after,:host([size=sm][shape=circle][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=sm][shape=circle][variant=secondary]) .auro-button:focus,:host([size=sm][shape=circle][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 3px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=circle][variant=tertiary]) .auro-button:focus,:host([size=sm][shape=circle][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=circle][variant=flat]) .auro-button:focus,:host([size=sm][shape=circle][variant=flat]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=circle][variant=ghost]) .auro-button:focus,:host([size=sm][shape=circle][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=square]) ::slotted(auro-icon),:host([size=sm][shape=square]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=sm][shape=square][variant=primary]) .auro-button:focus,:host([size=sm][shape=square][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 3px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=square][variant=primary]) .auro-button:focus:after,:host([size=sm][shape=square][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=sm][shape=square][variant=secondary]) .auro-button:focus,:host([size=sm][shape=square][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 3px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=square][variant=tertiary]) .auro-button:focus,:host([size=sm][shape=square][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=square][variant=flat]) .auro-button:focus,:host([size=sm][shape=square][variant=flat]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=sm][shape=square][variant=ghost]) .auro-button:focus,:host([size=sm][shape=square][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=rounded]) ::slotted(auro-icon),:host([size=md][shape=rounded]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=md][shape=rounded][variant=primary]) .auro-button:focus,:host([size=md][shape=rounded][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=rounded][variant=primary]) .auro-button:focus:after,:host([size=md][shape=rounded][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=md][shape=rounded][variant=secondary]) .auro-button:focus,:host([size=md][shape=rounded][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=rounded][variant=tertiary]) .auro-button:focus,:host([size=md][shape=rounded][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=rounded][variant=ghost]) .auro-button:focus,:host([size=md][shape=rounded][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=pill]) ::slotted(auro-icon),:host([size=md][shape=pill]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=md][shape=pill][variant=primary]) .auro-button:focus,:host([size=md][shape=pill][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=pill][variant=primary]) .auro-button:focus:after,:host([size=md][shape=pill][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=md][shape=pill][variant=secondary]) .auro-button:focus,:host([size=md][shape=pill][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=pill][variant=tertiary]) .auro-button:focus,:host([size=md][shape=pill][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=pill][variant=ghost]) .auro-button:focus,:host([size=md][shape=pill][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=pill-left]) ::slotted(auro-icon),:host([size=md][shape=pill-left]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=md][shape=pill-left][variant=primary]) .auro-button:focus,:host([size=md][shape=pill-left][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=pill-left][variant=primary]) .auro-button:focus:after,:host([size=md][shape=pill-left][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=md][shape=pill-left][variant=secondary]) .auro-button:focus,:host([size=md][shape=pill-left][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=pill-left][variant=tertiary]) .auro-button:focus,:host([size=md][shape=pill-left][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=pill-left][variant=ghost]) .auro-button:focus,:host([size=md][shape=pill-left][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=pill-right]) ::slotted(auro-icon),:host([size=md][shape=pill-right]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=md][shape=pill-right][variant=primary]) .auro-button:focus,:host([size=md][shape=pill-right][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=pill-right][variant=primary]) .auro-button:focus:after,:host([size=md][shape=pill-right][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=md][shape=pill-right][variant=secondary]) .auro-button:focus,:host([size=md][shape=pill-right][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=pill-right][variant=tertiary]) .auro-button:focus,:host([size=md][shape=pill-right][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=pill-right][variant=ghost]) .auro-button:focus,:host([size=md][shape=pill-right][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=circle]) ::slotted(auro-icon),:host([size=md][shape=circle]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=md][shape=circle][variant=primary]) .auro-button:focus,:host([size=md][shape=circle][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=circle][variant=primary]) .auro-button:focus:after,:host([size=md][shape=circle][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=md][shape=circle][variant=secondary]) .auro-button:focus,:host([size=md][shape=circle][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 3px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=circle][variant=tertiary]) .auro-button:focus,:host([size=md][shape=circle][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=circle][variant=flat]) .auro-button:focus,:host([size=md][shape=circle][variant=flat]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=circle][variant=ghost]) .auro-button:focus,:host([size=md][shape=circle][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=square]) ::slotted(auro-icon),:host([size=md][shape=square]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=md][shape=square][variant=primary]) .auro-button:focus,:host([size=md][shape=square][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=square][variant=primary]) .auro-button:focus:after,:host([size=md][shape=square][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=md][shape=square][variant=secondary]) .auro-button:focus,:host([size=md][shape=square][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 3px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=square][variant=tertiary]) .auro-button:focus,:host([size=md][shape=square][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=square][variant=flat]) .auro-button:focus,:host([size=md][shape=square][variant=flat]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=md][shape=square][variant=ghost]) .auro-button:focus,:host([size=md][shape=square][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=rounded]) ::slotted(auro-icon),:host([size=lg][shape=rounded]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=lg][shape=rounded][variant=primary]) .auro-button:focus,:host([size=lg][shape=rounded][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=rounded][variant=primary]) .auro-button:focus:after,:host([size=lg][shape=rounded][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=lg][shape=rounded][variant=secondary]) .auro-button:focus,:host([size=lg][shape=rounded][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=rounded][variant=tertiary]) .auro-button:focus,:host([size=lg][shape=rounded][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=rounded][variant=ghost]) .auro-button:focus,:host([size=lg][shape=rounded][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=pill]) ::slotted(auro-icon),:host([size=lg][shape=pill]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=lg][shape=pill][variant=primary]) .auro-button:focus,:host([size=lg][shape=pill][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=pill][variant=primary]) .auro-button:focus:after,:host([size=lg][shape=pill][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=lg][shape=pill][variant=secondary]) .auro-button:focus,:host([size=lg][shape=pill][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=pill][variant=tertiary]) .auro-button:focus,:host([size=lg][shape=pill][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=pill][variant=ghost]) .auro-button:focus,:host([size=lg][shape=pill][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=pill-left]) ::slotted(auro-icon),:host([size=lg][shape=pill-left]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=lg][shape=pill-left][variant=primary]) .auro-button:focus,:host([size=lg][shape=pill-left][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=pill-left][variant=primary]) .auro-button:focus:after,:host([size=lg][shape=pill-left][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=lg][shape=pill-left][variant=secondary]) .auro-button:focus,:host([size=lg][shape=pill-left][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=pill-left][variant=tertiary]) .auro-button:focus,:host([size=lg][shape=pill-left][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=pill-left][variant=ghost]) .auro-button:focus,:host([size=lg][shape=pill-left][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=pill-right]) ::slotted(auro-icon),:host([size=lg][shape=pill-right]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=lg][shape=pill-right][variant=primary]) .auro-button:focus,:host([size=lg][shape=pill-right][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=pill-right][variant=primary]) .auro-button:focus:after,:host([size=lg][shape=pill-right][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=lg][shape=pill-right][variant=secondary]) .auro-button:focus,:host([size=lg][shape=pill-right][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=pill-right][variant=tertiary]) .auro-button:focus,:host([size=lg][shape=pill-right][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=pill-right][variant=ghost]) .auro-button:focus,:host([size=lg][shape=pill-right][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=circle]) ::slotted(auro-icon),:host([size=lg][shape=circle]) ::slotted([auro-icon]){--ds-auro-icon-size: calc(var(--ds-size-300, 1.5rem) + var(--ds-size-50, .25rem))}:host([size=lg][shape=circle][variant=primary]) .auro-button:focus,:host([size=lg][shape=circle][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4.33px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=circle][variant=primary]) .auro-button:focus:after,:host([size=lg][shape=circle][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=lg][shape=circle][variant=secondary]) .auro-button:focus,:host([size=lg][shape=circle][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 3px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=circle][variant=tertiary]) .auro-button:focus,:host([size=lg][shape=circle][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=circle][variant=flat]) .auro-button:focus,:host([size=lg][shape=circle][variant=flat]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=circle][variant=ghost]) .auro-button:focus,:host([size=lg][shape=circle][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=square]) ::slotted(auro-icon),:host([size=lg][shape=square]) ::slotted([auro-icon]){--ds-auro-icon-size: calc(var(--ds-size-300, 1.5rem) + var(--ds-size-50, .25rem))}:host([size=lg][shape=square][variant=primary]) .auro-button:focus,:host([size=lg][shape=square][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4.33px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=square][variant=primary]) .auro-button:focus:after,:host([size=lg][shape=square][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=lg][shape=square][variant=secondary]) .auro-button:focus,:host([size=lg][shape=square][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 3px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=square][variant=tertiary]) .auro-button:focus,:host([size=lg][shape=square][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=square][variant=flat]) .auro-button:focus,:host([size=lg][shape=square][variant=flat]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=lg][shape=square][variant=ghost]) .auro-button:focus,:host([size=lg][shape=square][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=rounded]) ::slotted(auro-icon),:host([size=xl][shape=rounded]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=xl][shape=rounded][variant=primary]) .auro-button:focus,:host([size=xl][shape=rounded][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=rounded][variant=primary]) .auro-button:focus:after,:host([size=xl][shape=rounded][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=xl][shape=rounded][variant=secondary]) .auro-button:focus,:host([size=xl][shape=rounded][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=rounded][variant=tertiary]) .auro-button:focus,:host([size=xl][shape=rounded][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=rounded][variant=ghost]) .auro-button:focus,:host([size=xl][shape=rounded][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=pill]) ::slotted(auro-icon),:host([size=xl][shape=pill]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=xl][shape=pill][variant=primary]) .auro-button:focus,:host([size=xl][shape=pill][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=pill][variant=primary]) .auro-button:focus:after,:host([size=xl][shape=pill][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=xl][shape=pill][variant=secondary]) .auro-button:focus,:host([size=xl][shape=pill][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=pill][variant=tertiary]) .auro-button:focus,:host([size=xl][shape=pill][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=pill][variant=ghost]) .auro-button:focus,:host([size=xl][shape=pill][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=pill-left]) ::slotted(auro-icon),:host([size=xl][shape=pill-left]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=xl][shape=pill-left][variant=primary]) .auro-button:focus,:host([size=xl][shape=pill-left][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=pill-left][variant=primary]) .auro-button:focus:after,:host([size=xl][shape=pill-left][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=xl][shape=pill-left][variant=secondary]) .auro-button:focus,:host([size=xl][shape=pill-left][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=pill-left][variant=tertiary]) .auro-button:focus,:host([size=xl][shape=pill-left][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=pill-left][variant=ghost]) .auro-button:focus,:host([size=xl][shape=pill-left][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=pill-right]) ::slotted(auro-icon),:host([size=xl][shape=pill-right]) ::slotted([auro-icon]){--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}:host([size=xl][shape=pill-right][variant=primary]) .auro-button:focus,:host([size=xl][shape=pill-right][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=pill-right][variant=primary]) .auro-button:focus:after,:host([size=xl][shape=pill-right][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=xl][shape=pill-right][variant=secondary]) .auro-button:focus,:host([size=xl][shape=pill-right][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=pill-right][variant=tertiary]) .auro-button:focus,:host([size=xl][shape=pill-right][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=pill-right][variant=ghost]) .auro-button:focus,:host([size=xl][shape=pill-right][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=circle]) ::slotted(auro-icon),:host([size=xl][shape=circle]) ::slotted([auro-icon]){--ds-auro-icon-size: calc(var(--ds-size-400, 2rem) + var(--ds-size-50, .25rem))}:host([size=xl][shape=circle][variant=primary]) .auro-button:focus,:host([size=xl][shape=circle][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=circle][variant=primary]) .auro-button:focus:after,:host([size=xl][shape=circle][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=xl][shape=circle][variant=secondary]) .auro-button:focus,:host([size=xl][shape=circle][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 3px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=circle][variant=tertiary]) .auro-button:focus,:host([size=xl][shape=circle][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=circle][variant=flat]) .auro-button:focus,:host([size=xl][shape=circle][variant=flat]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=circle][variant=ghost]) .auro-button:focus,:host([size=xl][shape=circle][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=square]) ::slotted(auro-icon),:host([size=xl][shape=square]) ::slotted([auro-icon]){--ds-auro-icon-size: calc(var(--ds-size-400, 2rem) + var(--ds-size-50, .25rem))}:host([size=xl][shape=square][variant=primary]) .auro-button:focus,:host([size=xl][shape=square][variant=primary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 5px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=square][variant=primary]) .auro-button:focus:after,:host([size=xl][shape=square][variant=primary]) .auro-button:focus-visible:after{content:"";position:absolute;border-radius:inherit;box-sizing:content-box;top:0;left:0;width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid var(--ds-auro-button-border-color)}:host([size=xl][shape=square][variant=secondary]) .auro-button:focus,:host([size=xl][shape=square][variant=secondary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 3px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=square][variant=tertiary]) .auro-button:focus,:host([size=xl][shape=square][variant=tertiary]) .auro-button:focus-visible{box-shadow:inset 0 0 0 4px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=square][variant=flat]) .auro-button:focus,:host([size=xl][shape=square][variant=flat]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xl][shape=square][variant=ghost]) .auro-button:focus,:host([size=xl][shape=square][variant=ghost]) .auro-button:focus-visible{box-shadow:inset 0 0 0 2px var(--ds-auro-button-border-inset-color)}:host([size=xs]) .inset .contentWrapper{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-inline:var(--ds-size-150, .75rem)}:host([size=sm]) .inset .contentWrapper{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-inline:var(--ds-size-200, 1rem)}:host([size=md]) .inset .contentWrapper{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-inline:var(--ds-size-300, 1.5rem)}:host([size=lg]) .inset .contentWrapper{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-inline:var(--ds-size-400, 2rem)}:host([size=xl]) .inset .contentWrapper{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-inline:var(--ds-size-500, 2.5rem)}:host([shape=circle]) ::slotted(:not(auro-icon):not([auro-icon])){position:absolute;overflow:hidden;clip:rect(1px,1px,1px,1px);width:1px;height:1px;padding:0;border:0}:host([shape=square]) ::slotted(:not(auro-icon):not([auro-icon])){position:absolute;overflow:hidden;clip:rect(1px,1px,1px,1px);width:1px;height:1px;padding:0;border:0}:host([variant=flat]){display:inline-block}::slotted(svg){vertical-align:middle}.textSlot{display:inline-flex;align-items:center;gap:var(--ds-size-100, .5rem)}.contentWrapper{font-size:0}slot{pointer-events:none}[auro-loader]{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}:host{display:inline-block;overflow:hidden}.auro-button{position:relative;cursor:pointer;padding:0 var(--ds-size-300, 1.5rem);padding-inline:unset;padding-block:unset;box-sizing:content-box;overflow:hidden;text-overflow:ellipsis;user-select:none;white-space:nowrap;outline:none;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:var(--ds-size-100, .5rem);margin:0;-webkit-touch-callout:none;-webkit-user-select:none;transition:padding .3s ease-out}.auro-button:focus,.auro-button:focus-visible{outline:none}.auro-button:active{transform:scale(.95)}.auro-button.loading{cursor:not-allowed}.auro-button.loading *:not([auro-loader]){visibility:hidden}@media screen and (min-width: 576px){.auro-button{width:auto}}.auro-button:disabled{cursor:not-allowed;transform:unset}:host([fluid]){display:block}:host([fluid]) .auro-button:not(.thin):not(.simple){width:calc(100% - 4px)}:host([fluid]) .auro-button.thin{width:calc(100% - 2px)}:host([fluid]) .auro-button.simple{width:100%}:host([static]) .auro-button{pointer-events:none;cursor:default;display:inline-flex}:host([static]) .auro-button .contentWrapper{display:inline-flex}
|
|
3401
|
+
`,R=i$3`:host{--ds-auro-button-border-color: var(--ds-advanced-color-button-primary-border, #01426a);--ds-auro-button-border-inset-color: var(--ds-advanced-color-state-focused-inverse, #ffffff);--ds-auro-button-container-color: var(--ds-advanced-color-button-primary-background, #01426a);--ds-auro-button-container-image: var(--ds-advanced-color-button-primary-background, #01426a);--ds-auro-button-loader-color: var(--ds-advanced-color-button-primary-text, #ffffff);--ds-auro-button-text-color: var(--ds-advanced-color-button-primary-text, #ffffff)}
|
|
3402
|
+
`;const N=["circle","square"];class T extends C{static get formAssociated(){return true}constructor(){super(),this.autofocus=false,this.disabled=false,this.loading=false,this.static=false,this.size="md",this.shape="rounded",this.fluid=false,this.loadingText=this.loadingText||"Loading...",this.variant="primary",this.runtimeUtils=new d,"function"==typeof this.attachInternals?this.internals=this.attachInternals():(this.internals=null,console.warn("This browser does not support form association features. Some form-related functionality may not work as expected. Consider using a polyfill or handling click events manually."));const t=new l;this.loaderTag=t.generateTag("auro-loader","6.1.0",b),this.buttonHref=void 0,this.buttonTarget=void 0,this.buttonRel=void 0;}static get styles(){return [R,M$1,U,H]}static get properties(){return {...C.properties,layout:{type:Boolean,attribute:false,reflect:false},autofocus:{type:Boolean,reflect:true},disabled:{type:Boolean,reflect:true},fluid:{type:Boolean,reflect:true},loading:{type:Boolean,reflect:true},loadingText:{type:String},tIndex:{type:String,reflect:true},tabindex:{type:String,reflect:false},title:{type:String,reflect:true},type:{type:String,reflect:true},value:{type:String,reflect:true},variant:{type:String,reflect:true},buttonHref:{type:String},buttonTarget:{type:String},buttonRel:{type:String},static:{type:Boolean,reflect:true},onHover:{attribute:"data-hover",type:Boolean,reflect:true},onActive:{attribute:"data-active",type:Boolean,reflect:true}}}static register(t="auro-button"){d.prototype.registerComponent(t,T);}focus(){this.renderRoot.querySelector("button").focus();}surfaceSubmitEvent(){this.form&&this.form.requestSubmit();}get form(){return this.internals?this.internals.form:null}get showText(){return !N.includes(this.shape)}get currentAriaLabel(){if(!this.attributeWatcher)return;return this.attributeWatcher.getObservedAttribute("aria-label")||void 0}get currentAriaLabelledBy(){if(!this.attributeWatcher)return;return this.attributeWatcher.getObservedAttribute("aria-labelledby")||void 0}get iconOnly(){return N.includes(this.shape)}getFontSize(){return (this.iconOnly?{xs:"heading-xs",sm:"heading-sm",md:"heading-sm",lg:"heading-md",xl:"heading-lg"}:{xs:"body-xs",sm:"body-sm",md:"body-default",lg:"body-lg",xl:"body-lg"})[this.size]||"body-default"}get _renderTag(){return this.static?i$4`span`:this.buttonHref?i$4`a`:i$4`button`}firstUpdated(){super.firstUpdated(),this.runtimeUtils.handleComponentTagRename(this,"auro-button");}generateAriaLabel(){return this.loading?this.runtimeUtils.getSlotText(this,"ariaLabel.loading")||this.loadingText:this.runtimeUtils.getSlotText(this,"ariaLabel")||this.currentAriaLabel}onPointerEvent(t){switch(t.type){case "pointerenter":this.onHover=true;break;case "pointerleave":this.onHover=false;break;case "pointerdown":this.onActive=true;break;case "pointerup":case "blur":this.onActive=false;}}renderLayoutDefault(){const t=this.getFontSize(),e$1=this.buttonHref?"link":"button",s={"auro-button":true,inset:this.showText,wrapper:true,loading:this.loading,simple:!["secondary"].includes(this.variant),thin:["secondary"].includes(this.variant)},a={contentWrapper:true,loading:this.loading},r={textSlot:true,[t]:this.showText},l=this.tIndex||this.tabindex;return u$3`
|
|
3403
|
+
<!-- Hidden slots for aria labels -->
|
|
3404
|
+
<slot name="ariaLabel" hidden @slotchange="${this.requestUpdate}"></slot>
|
|
3405
|
+
<slot name="ariaLabel.loading" hidden @slotchange="${this.requestUpdate}"></slot>
|
|
3406
|
+
|
|
3407
|
+
<${this._renderTag}
|
|
3408
|
+
part="${e$1}"
|
|
3409
|
+
aria-label="${o(this.generateAriaLabel())}"
|
|
3410
|
+
aria-labelledby="${o(this.loading?void 0:this.currentAriaLabelledBy||void 0)}"
|
|
3411
|
+
tabindex="${o(this.static?-1:l)}"
|
|
3412
|
+
?autofocus="${this.autofocus}"
|
|
3413
|
+
class=${e(s)}
|
|
3414
|
+
?disabled="${this.disabled||this.loading}"
|
|
3415
|
+
?onDark="${this.onDark}"
|
|
3416
|
+
title="${o(this.title?this.title:void 0)}"
|
|
3417
|
+
name="${o(this.name?this.name:void 0)}"
|
|
3418
|
+
type="${o(this.type?this.type:void 0)}"
|
|
3419
|
+
variant="${o(this.variant?this.variant:void 0)}"
|
|
3420
|
+
.value="${o(this.value?this.value:void 0)}"
|
|
3421
|
+
@click="${this.static||"submit"!==this.type?void 0:this.surfaceSubmitEvent}"
|
|
3422
|
+
@pointerenter="${this.onPointerEvent}"
|
|
3423
|
+
@pointerleave="${this.onPointerEvent}"
|
|
3424
|
+
@pointerdown="${this.onPointerEvent}"
|
|
3425
|
+
@pointerup="${this.onPointerEvent}"
|
|
3426
|
+
@blur="${this.onPointerEvent}"
|
|
3427
|
+
href="${o(this.buttonHref||void 0)}"
|
|
3428
|
+
target="${o(this.buttonTarget||void 0)}"
|
|
3429
|
+
rel="${o(this.buttonRel||void 0)}"
|
|
3430
|
+
>
|
|
3431
|
+
${o(this.loading?u$3`<${this.loaderTag} pulse part="loader"></${this.loaderTag}>`:void 0)}
|
|
3432
|
+
|
|
3433
|
+
<span class="${e(a)}" part="contentWrapper">
|
|
3434
|
+
<span class="${e(r)}" part="text">
|
|
3435
|
+
<slot></slot>
|
|
3436
|
+
</span>
|
|
3437
|
+
</span>
|
|
3438
|
+
</${this._renderTag}>
|
|
3439
|
+
`}renderLayout(){return this.renderLayoutDefault()}}
|
|
3440
|
+
|
|
3441
|
+
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)}getSlotText(t,a){const e=t.shadowRoot?.querySelector(`slot[name="${a}"]`);return (e?.assignedNodes({flatten:true})||[]).map(t=>t.textContent?.trim()).join(" ").trim()||null}}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>',g='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" style="min-width:100%;height:auto;fill:currentColor" viewBox="0 0 142 138" part="svg"><title id="tail-DEFAULT__title">Airplane tail default image with light gray color</title><path fill="url(#paint0_linear_9225_2069)" fill-rule="evenodd" d="M124.093 14.665a3.26 3.26 0 0 1 3.208 3.829L101.097 119.85c-.47 1.087-2.211 3.398-5.692 3.471l-.106.001-80.65.013A659230 659230 0 0 1 99.08 17.412c1.214-1.497 3.275-2.722 5.372-2.747z" clip-rule="evenodd"/><defs><linearGradient id="paint0_linear_9225_2069" x1="114.823" x2="60.061" y1="14.665" y2="123.335" gradientUnits="userSpaceOnUse"><stop offset=".5" stop-color="#707984"/><stop offset=".5" stop-color="#646E7B"/></linearGradient></defs></svg>';class m extends i$1{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 f=new Map,w=(t,a={})=>{const e=a.responseParser||(t=>t.text());return f.has(t)||f.set(t,fetch(t).then(e)),f.get(t)};var z=i$3`: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}
|
|
3442
|
+
`;class y extends m{constructor(){super(),this._initializeDefaults();}_initializeDefaults(){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 z}async fetchIcon(t,a){let e="";e="logos"===t?await w(`${this.uri}/${t}/${a}.svg`):await w(`${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=this.name?.startsWith("tail-")?g:u;this.svg=(new DOMParser).parseFromString(t,"text/html").body.querySelector("svg");}}}catch(t){this.svg=void 0;}}}i$3`.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}
|
|
3443
|
+
`;var M=i$3`: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)}
|
|
3444
|
+
`;var _=i$3`: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)}
|
|
3445
|
+
`;class k extends y{constructor(){super(),this._initializeDefaults();}_initializeDefaults(){this.variant=void 0,this.uri="https://cdn.jsdelivr.net/npm/@alaskaairux/icons@latest/dist",this.runtimeUtils=new p;}static get properties(){return {...y.properties,ariaHidden:{type:String,reflect:true},category:{type:String,reflect:true},customColor:{type:Boolean,reflect:true},customSvg:{type:Boolean},label:{type:Boolean,reflect:true},name:{type:String,reflect:true},variant:{type:String,reflect:true}}}static get styles(){return [y.styles,M,z,_]}static register(t="auro-icon"){p.prototype.registerComponent(t,k);}connectedCallback(){super.connectedCallback(),this.runtimeUtils.handleComponentTagRename(this,"auro-icon");}exposeCssParts(){this.setAttribute("exportparts","svg:iconSvg");}async firstUpdated(){if(await super.firstUpdated(),this.hasAttribute("ariaHidden")&&this.svg){const t=this.svg.querySelector("desc");t&&(t.remove(),this.svg.removeAttribute("aria-labelledby"));}}render(){const t={labelWrapper:true,util_displayHiddenVisually:!this.label};return x$1`
|
|
3446
|
+
<div class="componentWrapper">
|
|
3447
|
+
<div
|
|
3448
|
+
class="${e({svgWrapper:true})}"
|
|
3449
|
+
title="${o(this.title||void 0)}">
|
|
3450
|
+
<span aria-hidden="${o(this.ariaHidden||true)}" part="svg">
|
|
3451
|
+
${this.customSvg?x$1`
|
|
3452
|
+
<slot name="svg"></slot>
|
|
3453
|
+
`:x$1`
|
|
3454
|
+
${this.svg}
|
|
3455
|
+
`}
|
|
3456
|
+
</span>
|
|
3457
|
+
</div>
|
|
3458
|
+
|
|
3459
|
+
<div class="${e(t)}" part="label">
|
|
3460
|
+
<slot></slot>
|
|
3461
|
+
</div>
|
|
3462
|
+
</div>
|
|
3463
|
+
`}}
|
|
3464
|
+
|
|
3465
|
+
// Selectors for focusable elements
|
|
3466
|
+
const FOCUSABLE_SELECTORS = [
|
|
3467
|
+
"a[href]",
|
|
3468
|
+
"button:not([disabled])",
|
|
3469
|
+
"textarea:not([disabled])",
|
|
3470
|
+
"input:not([disabled])",
|
|
3471
|
+
"select:not([disabled])",
|
|
3472
|
+
'[role="tab"]:not([disabled])',
|
|
3473
|
+
'[role="link"]:not([disabled])',
|
|
3474
|
+
'[role="button"]:not([disabled])',
|
|
3475
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
3476
|
+
'[contenteditable]:not([contenteditable="false"])',
|
|
3477
|
+
];
|
|
3478
|
+
|
|
3479
|
+
// List of custom components that are known to be focusable
|
|
3480
|
+
const FOCUSABLE_COMPONENTS = [
|
|
3481
|
+
"auro-checkbox",
|
|
3482
|
+
"auro-radio",
|
|
3483
|
+
"auro-dropdown",
|
|
3484
|
+
"auro-button",
|
|
3485
|
+
"auro-combobox",
|
|
3486
|
+
"auro-input",
|
|
3487
|
+
"auro-counter",
|
|
3488
|
+
// 'auro-menu', // Auro menu is not focusable by default, it uses a different interaction model
|
|
3489
|
+
"auro-select",
|
|
3490
|
+
"auro-datepicker",
|
|
3491
|
+
"auro-hyperlink",
|
|
3492
|
+
"auro-accordion",
|
|
3493
|
+
];
|
|
3494
|
+
|
|
3495
|
+
/**
|
|
3496
|
+
* Determines if a given element is a custom focusable component.
|
|
3497
|
+
* Returns true if the element matches a known focusable component and is not disabled.
|
|
3498
|
+
*
|
|
3499
|
+
* @param {HTMLElement} element The element to check for focusability.
|
|
3500
|
+
* @returns {boolean} True if the element is a focusable custom component, false otherwise.
|
|
3501
|
+
*/
|
|
3502
|
+
function isFocusableComponent(element) {
|
|
3503
|
+
const componentName = element.tagName.toLowerCase();
|
|
3504
|
+
|
|
3505
|
+
// Guard Clause: Element is a focusable component
|
|
3506
|
+
if (
|
|
3507
|
+
!FOCUSABLE_COMPONENTS.some(
|
|
3508
|
+
(name) => element.hasAttribute(name) || componentName === name,
|
|
3509
|
+
)
|
|
3510
|
+
)
|
|
3511
|
+
return false;
|
|
3512
|
+
|
|
3513
|
+
// Guard Clause: Element is not disabled
|
|
3514
|
+
if (element.hasAttribute("disabled")) return false;
|
|
3515
|
+
|
|
3516
|
+
// Guard Clause: The element is a hyperlink and has no href attribute
|
|
3517
|
+
if (componentName.match("hyperlink") && !element.hasAttribute("href"))
|
|
3518
|
+
return false;
|
|
3519
|
+
|
|
3520
|
+
// If all guard clauses pass, the element is a focusable component
|
|
3521
|
+
return true;
|
|
3522
|
+
}
|
|
3523
|
+
|
|
3524
|
+
/**
|
|
3525
|
+
* Safely get a numeric tabindex for an element.
|
|
3526
|
+
* Returns a number if the tabindex is a valid integer, otherwise null.
|
|
3527
|
+
*
|
|
3528
|
+
* @param {HTMLElement} element The element whose tabindex to read.
|
|
3529
|
+
* @returns {?number} The numeric tabindex or null if missing/invalid.
|
|
3530
|
+
*/
|
|
3531
|
+
function getNumericTabIndex(element) {
|
|
3532
|
+
const raw = element.getAttribute("tabindex");
|
|
3533
|
+
if (raw == null) return null;
|
|
3534
|
+
|
|
3535
|
+
const value = Number.parseInt(raw, 10);
|
|
3536
|
+
return Number.isNaN(value) ? null : value;
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
/**
|
|
3540
|
+
* Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
|
|
3541
|
+
* Returns a unique, ordered array of elements that can receive focus.
|
|
3542
|
+
* Also sorts elements with tabindex first, preserving their order.
|
|
3543
|
+
*
|
|
3544
|
+
* @param {HTMLElement} container The container to search within
|
|
3545
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
3546
|
+
*/
|
|
3547
|
+
function getFocusableElements(container) {
|
|
3548
|
+
// Get elements in DOM order by walking the tree
|
|
3549
|
+
const orderedFocusableElements = [];
|
|
3550
|
+
|
|
3551
|
+
// Define a recursive function to collect focusable elements in DOM order
|
|
3552
|
+
const collectFocusableElements = (root) => {
|
|
3553
|
+
// Check if current element is focusable
|
|
3554
|
+
if (root.nodeType === Node.ELEMENT_NODE) {
|
|
3555
|
+
// Check if this is a custom component that is focusable
|
|
3556
|
+
const isComponentFocusable = isFocusableComponent(root);
|
|
3557
|
+
|
|
3558
|
+
if (isComponentFocusable) {
|
|
3559
|
+
// Add the component itself as a focusable element and don't traverse its shadow DOM
|
|
3560
|
+
orderedFocusableElements.push(root);
|
|
3561
|
+
return; // Skip traversing inside this component
|
|
3562
|
+
}
|
|
3563
|
+
|
|
3564
|
+
// Check if the element itself matches any selector
|
|
3565
|
+
for (const selector of FOCUSABLE_SELECTORS) {
|
|
3566
|
+
if (root.matches?.(selector)) {
|
|
3567
|
+
orderedFocusableElements.push(root);
|
|
3568
|
+
break; // Once we know it's focusable, no need to check other selectors
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
|
|
3572
|
+
// Process shadow DOM only for non-Auro components
|
|
3573
|
+
if (root.shadowRoot) {
|
|
3574
|
+
// Process shadow DOM children in order
|
|
3575
|
+
if (root.shadowRoot.children) {
|
|
3576
|
+
Array.from(root.shadowRoot.children).forEach((child) => {
|
|
3577
|
+
collectFocusableElements(child);
|
|
3578
|
+
});
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3582
|
+
// Process slots and their assigned nodes in order
|
|
3583
|
+
if (root.tagName === "SLOT") {
|
|
3584
|
+
const assignedNodes = root.assignedNodes({ flatten: true });
|
|
3585
|
+
for (const node of assignedNodes) {
|
|
3586
|
+
collectFocusableElements(node);
|
|
3587
|
+
}
|
|
3588
|
+
} else {
|
|
3589
|
+
// Process light DOM children in order
|
|
3590
|
+
if (root.children) {
|
|
3591
|
+
Array.from(root.children).forEach((child) => {
|
|
3592
|
+
collectFocusableElements(child);
|
|
3593
|
+
});
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3597
|
+
};
|
|
3598
|
+
|
|
3599
|
+
// Start the traversal from the container
|
|
3600
|
+
collectFocusableElements(container);
|
|
3601
|
+
|
|
3602
|
+
// Remove duplicates that might have been collected through different paths
|
|
3603
|
+
// while preserving order
|
|
3604
|
+
const uniqueElements = [];
|
|
3605
|
+
const seen = new Set();
|
|
3606
|
+
|
|
3607
|
+
for (const element of orderedFocusableElements) {
|
|
3608
|
+
if (!seen.has(element)) {
|
|
3609
|
+
seen.add(element);
|
|
3610
|
+
uniqueElements.push(element);
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
// Move tab-indexed elements to the front while preserving their order
|
|
3615
|
+
// This ensures that elements with tabindex are prioritized in the focus order
|
|
3616
|
+
|
|
3617
|
+
// First extract elements with valid positive tabindex
|
|
3618
|
+
const elementsWithTabindex = uniqueElements.filter((el) => {
|
|
3619
|
+
const tabindex = getNumericTabIndex(el);
|
|
3620
|
+
return tabindex !== null && tabindex > 0;
|
|
3621
|
+
});
|
|
3622
|
+
|
|
3623
|
+
// Sort these elements by their tabindex value
|
|
3624
|
+
elementsWithTabindex.sort((a, b) => {
|
|
3625
|
+
const aIndex = getNumericTabIndex(a) ?? 0;
|
|
3626
|
+
const bIndex = getNumericTabIndex(b) ?? 0;
|
|
3627
|
+
return aIndex - bIndex;
|
|
3628
|
+
});
|
|
3629
|
+
|
|
3630
|
+
// Elements without tabindex (preserving their original order)
|
|
3631
|
+
const elementsWithoutTabindex = uniqueElements.filter((el) => {
|
|
3632
|
+
const tabindex = getNumericTabIndex(el);
|
|
3633
|
+
|
|
3634
|
+
// Elements without tabindex or with tabindex of 0 stay in DOM order
|
|
3635
|
+
return tabindex === null || tabindex === 0;
|
|
3636
|
+
});
|
|
3637
|
+
|
|
3638
|
+
// Combine both arrays with tabindex elements first
|
|
3639
|
+
const tabIndexedUniqueElements = [
|
|
3640
|
+
...elementsWithTabindex,
|
|
3641
|
+
...elementsWithoutTabindex,
|
|
3642
|
+
];
|
|
3643
|
+
|
|
3644
|
+
return tabIndexedUniqueElements;
|
|
3645
|
+
}
|
|
3646
|
+
|
|
3647
|
+
/**
|
|
3648
|
+
* FocusTrap manages keyboard focus within a specified container element, ensuring that focus does not leave the container when tabbing.
|
|
3649
|
+
* It is commonly used for modal dialogs or overlays to improve accessibility by trapping focus within interactive UI components.
|
|
3650
|
+
*/
|
|
3651
|
+
class FocusTrap {
|
|
3652
|
+
/**
|
|
3653
|
+
* Creates a new FocusTrap instance for the given container element.
|
|
3654
|
+
* Initializes event listeners and prepares the container for focus management.
|
|
3655
|
+
*
|
|
3656
|
+
* @param {HTMLElement} container The DOM element to trap focus within.
|
|
3657
|
+
* @param {boolean} [controlTabOrder=false] If true enables manual control of the tab order by the FocusTrap.
|
|
3658
|
+
* @throws {Error} If the provided container is not a valid HTMLElement.
|
|
3659
|
+
*/
|
|
3660
|
+
constructor(container, controlTabOrder = false) {
|
|
3661
|
+
if (!container || !(container instanceof HTMLElement)) {
|
|
3662
|
+
throw new Error("FocusTrap requires a valid HTMLElement.");
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
this.container = container;
|
|
3666
|
+
this.tabDirection = "forward"; // or 'backward';
|
|
3667
|
+
this.controlTabOrder = controlTabOrder;
|
|
3668
|
+
|
|
3669
|
+
this._init();
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
/**
|
|
3673
|
+
* Initializes the focus trap by setting up event listeners and attributes on the container.
|
|
3674
|
+
* Prepares the container for focus management, including support for shadow DOM and inert attributes.
|
|
3675
|
+
*
|
|
3676
|
+
* @private
|
|
3677
|
+
*/
|
|
3678
|
+
_init() {
|
|
3679
|
+
// Add inert attribute to prevent focusing programmatically as well (if supported)
|
|
3680
|
+
if ("inert" in HTMLElement.prototype) {
|
|
3681
|
+
this.container.inert = false; // Ensure the container isn't inert
|
|
3682
|
+
this.container.setAttribute("data-focus-trap-container", true); // Mark for identification
|
|
3683
|
+
}
|
|
3684
|
+
|
|
3685
|
+
// Track tab direction
|
|
3686
|
+
this.container.addEventListener("keydown", this._onKeydown);
|
|
3687
|
+
}
|
|
3688
|
+
|
|
3689
|
+
/**
|
|
3690
|
+
* Gets an array of currently active (focused) elements in the document and shadow DOM.
|
|
3691
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
3692
|
+
* @private
|
|
3693
|
+
*/
|
|
3694
|
+
_getActiveElements() {
|
|
3695
|
+
// Get the active element(s) in the document and shadow root
|
|
3696
|
+
// This will include the active element in the shadow DOM if it exists
|
|
3697
|
+
// Active element may be inside the shadow DOM depending on delegatesFocus, so we need to check both
|
|
3698
|
+
let { activeElement } = document;
|
|
3699
|
+
const actives = [activeElement];
|
|
3700
|
+
while (activeElement?.shadowRoot?.activeElement) {
|
|
3701
|
+
actives.push(activeElement.shadowRoot.activeElement);
|
|
3702
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
|
3703
|
+
}
|
|
3704
|
+
return actives;
|
|
3705
|
+
}
|
|
3706
|
+
|
|
3707
|
+
/**
|
|
3708
|
+
* Gets the next focus index based on the current index and focusable elements.
|
|
3709
|
+
* @param {number} currentIndex The current index of the focused element.
|
|
3710
|
+
* @param {Array<HTMLElement>} focusables The array of focusable elements.
|
|
3711
|
+
* @returns {number|null} The next focus index or null if not determined.
|
|
3712
|
+
*/
|
|
3713
|
+
_getNextFocusIndex(currentIndex, focusables, actives) {
|
|
3714
|
+
if (this.controlTabOrder) {
|
|
3715
|
+
// Calculate the new index based on the current index and tab direction
|
|
3716
|
+
let newFocusIndex =
|
|
3717
|
+
currentIndex + (this.tabDirection === "forward" ? 1 : -1);
|
|
3718
|
+
|
|
3719
|
+
// Wrap-around logic
|
|
3720
|
+
if (newFocusIndex < 0) newFocusIndex = focusables.length - 1;
|
|
3721
|
+
if (newFocusIndex >= focusables.length) newFocusIndex = 0;
|
|
3722
|
+
|
|
3723
|
+
// Early return with the new index
|
|
3724
|
+
return newFocusIndex;
|
|
3725
|
+
}
|
|
3726
|
+
|
|
3727
|
+
// Determine if we need to wrap
|
|
3728
|
+
const atFirst =
|
|
3729
|
+
actives.includes(focusables[0]) || actives.includes(this.container);
|
|
3730
|
+
const atLast = actives.includes(focusables[focusables.length - 1]);
|
|
3731
|
+
|
|
3732
|
+
// Only wrap if at the ends
|
|
3733
|
+
if (this.tabDirection === "backward" && atFirst) {
|
|
3734
|
+
return focusables.length - 1;
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3737
|
+
if (this.tabDirection === "forward" && atLast) {
|
|
3738
|
+
return 0;
|
|
3739
|
+
}
|
|
3740
|
+
|
|
3741
|
+
// No wrap, so don't change focus, return early
|
|
3742
|
+
return null;
|
|
3743
|
+
}
|
|
3744
|
+
|
|
3745
|
+
/**
|
|
3746
|
+
* Handles the Tab key press event to manage focus within the container.
|
|
3747
|
+
* @param {KeyboardEvent} e The keyboard event triggered by the user.
|
|
3748
|
+
* @returns {void}
|
|
3749
|
+
*/
|
|
3750
|
+
_handleTabKey(e) {
|
|
3751
|
+
// Update the focusable elements
|
|
3752
|
+
const focusables = this._getFocusableElements();
|
|
3753
|
+
|
|
3754
|
+
// If there are no focusable elements, exit
|
|
3755
|
+
if (!focusables.length) return;
|
|
3756
|
+
|
|
3757
|
+
// Set the tab direction based on the key pressed
|
|
3758
|
+
this.tabDirection = e.shiftKey ? "backward" : "forward";
|
|
3759
|
+
|
|
3760
|
+
// Get the active elements that are currently focused
|
|
3761
|
+
const actives = this._getActiveElements();
|
|
3762
|
+
|
|
3763
|
+
// If we're at either end of the focusable elements, wrap around to the other end
|
|
3764
|
+
let focusIndex = focusables.findIndex((el) => actives.includes(el));
|
|
3765
|
+
|
|
3766
|
+
// Fallback if we have no focused element
|
|
3767
|
+
if (focusIndex === -1) focusIndex = 0;
|
|
3768
|
+
|
|
3769
|
+
// Get the next focus index based on the current focus index, tab direction, and controlTabOrder setting
|
|
3770
|
+
// Is null if no new focus index is determined
|
|
3771
|
+
const newFocusIndex = this._getNextFocusIndex(
|
|
3772
|
+
focusIndex,
|
|
3773
|
+
focusables,
|
|
3774
|
+
actives,
|
|
3775
|
+
);
|
|
3776
|
+
|
|
3777
|
+
// If we have a new focus index, set focus to that element
|
|
3778
|
+
if (newFocusIndex !== null) {
|
|
3779
|
+
e.preventDefault();
|
|
3780
|
+
focusables[newFocusIndex].focus();
|
|
3781
|
+
}
|
|
3782
|
+
}
|
|
3783
|
+
|
|
3784
|
+
/**
|
|
3785
|
+
* Catches the keydown event
|
|
3786
|
+
* @param {KeyboardEvent} e The keyboard event triggered by user interaction.
|
|
3787
|
+
* @private
|
|
3788
|
+
*/
|
|
3789
|
+
_onKeydown = (e) => {
|
|
3790
|
+
// Handle tab
|
|
3791
|
+
if (e.key === "Tab") this._handleTabKey(e);
|
|
3792
|
+
};
|
|
3793
|
+
|
|
3794
|
+
/**
|
|
3795
|
+
* Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
|
|
3796
|
+
* Returns a unique, ordered array of elements that can receive focus.
|
|
3797
|
+
*
|
|
3798
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
3799
|
+
* @private
|
|
3800
|
+
*/
|
|
3801
|
+
_getFocusableElements() {
|
|
3802
|
+
// Use the imported utility function to get focusable elements
|
|
3803
|
+
const elements = getFocusableElements(this.container);
|
|
3804
|
+
|
|
3805
|
+
// Return the elements found
|
|
3806
|
+
return elements;
|
|
3807
|
+
}
|
|
3808
|
+
|
|
3809
|
+
/**
|
|
3810
|
+
* Moves focus to the first focusable element within the container.
|
|
3811
|
+
* Useful for setting initial focus when activating the focus trap.
|
|
3812
|
+
*/
|
|
3813
|
+
focusFirstElement() {
|
|
3814
|
+
const focusables = this._getFocusableElements();
|
|
3815
|
+
if (focusables.length) focusables[0].focus();
|
|
3816
|
+
}
|
|
3817
|
+
|
|
3818
|
+
/**
|
|
3819
|
+
* Moves focus to the last focusable element within the container.
|
|
3820
|
+
* Useful for setting focus when deactivating or cycling focus in reverse.
|
|
3821
|
+
*/
|
|
3822
|
+
focusLastElement() {
|
|
3823
|
+
const focusables = this._getFocusableElements();
|
|
3824
|
+
if (focusables.length) focusables[focusables.length - 1].focus();
|
|
3825
|
+
}
|
|
3826
|
+
|
|
3827
|
+
/**
|
|
3828
|
+
* Removes event listeners and attributes added by the focus trap.
|
|
3829
|
+
* Call this method to clean up when the focus trap is no longer needed.
|
|
3830
|
+
*/
|
|
3831
|
+
disconnect() {
|
|
3832
|
+
if (this.container.hasAttribute("data-focus-trap-container")) {
|
|
3833
|
+
this.container.removeAttribute("data-focus-trap-container");
|
|
3834
|
+
}
|
|
3835
|
+
|
|
3836
|
+
this.container.removeEventListener("keydown", this._onKeydown);
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
|
|
3840
|
+
var buttonVersion = "12.3.2";
|
|
3841
|
+
|
|
3842
|
+
var iconVersion = "9.2.0";
|
|
3843
|
+
|
|
3844
|
+
var colorCss = i$3`.wrapper{background:var(--ds-auro-drawer-container-color)}::slotted(*){color:var(--ds-auro-drawer-text-color)}
|
|
3845
|
+
`;
|
|
3846
|
+
|
|
3847
|
+
var styleCss = i$3`.body-default{font-size:var(--wcss-body-default-font-size, 1rem);font-weight:var(--wcss-body-default-weight, );line-height:var(--wcss-body-default-line-height, 1.5rem)}.body-default,.body-default-emphasized{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-default-emphasized{font-size:var(--wcss-body-default-emphasized-font-size, 1rem);font-weight:var(--wcss-body-default-emphasized-weight, );line-height:var(--wcss-body-default-emphasized-line-height, 1.5rem)}.body-lg{font-size:var(--wcss-body-lg-font-size, 1.125rem);font-weight:var(--wcss-body-lg-weight, );line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-lg,.body-lg-emphasized{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-lg-emphasized{font-size:var(--wcss-body-lg-emphasized-font-size, 1.125rem);font-weight:var(--wcss-body-lg-emphasized-weight, );line-height:var(--wcss-body-lg-emphasized-line-height, 1.625rem)}.body-sm{font-size:var(--wcss-body-sm-font-size, .875rem);font-weight:var(--wcss-body-sm-weight, );line-height:var(--wcss-body-sm-line-height, 1.25rem)}.body-sm,.body-sm-emphasized{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-sm-emphasized{font-size:var(--wcss-body-sm-emphasized-font-size, .875rem);font-weight:var(--wcss-body-sm-emphasized-weight, );line-height:var(--wcss-body-sm-emphasized-line-height, 1.25rem)}.body-xs{font-size:var(--wcss-body-xs-font-size, .75rem);font-weight:var(--wcss-body-xs-weight, );line-height:var(--wcss-body-xs-line-height, 1rem)}.body-xs,.body-xs-emphasized{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-xs-emphasized{font-size:var(--wcss-body-xs-emphasized-font-size, .75rem);font-weight:var(--wcss-body-xs-emphasized-weight, );line-height:var(--wcss-body-xs-emphasized-line-height, 1rem)}.body-2xs{font-size:var(--wcss-body-2xs-font-size, .625rem);font-weight:var(--wcss-body-2xs-weight, );line-height:var(--wcss-body-2xs-line-height, .875rem)}.body-2xs,.body-2xs-emphasized{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-2xs-emphasized{font-size:var(--wcss-body-2xs-emphasized-font-size, .625rem);font-weight:var(--wcss-body-2xs-emphasized-weight, );line-height:var(--wcss-body-2xs-emphasized-line-height, .875rem)}.display-2xl{font-family:var(--wcss-display-2xl-family, "AS Circular"),var(--wcss-display-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem));font-weight:var(--wcss-display-2xl-weight, 300);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);line-height:var(--wcss-display-2xl-line-height, 1.3)}.display-xl{font-family:var(--wcss-display-xl-family, "AS Circular"),var(--wcss-display-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem));font-weight:var(--wcss-display-xl-weight, 300);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);line-height:var(--wcss-display-xl-line-height, 1.3)}.display-lg{font-family:var(--wcss-display-lg-family, "AS Circular"),var(--wcss-display-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem));font-weight:var(--wcss-display-lg-weight, 300);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);line-height:var(--wcss-display-lg-line-height, 1.3)}.display-md{font-family:var(--wcss-display-md-family, "AS Circular"),var(--wcss-display-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem));font-weight:var(--wcss-display-md-weight, 300);letter-spacing:var(--wcss-display-md-letter-spacing, 0);line-height:var(--wcss-display-md-line-height, 1.3)}.display-sm{font-family:var(--wcss-display-sm-family, "AS Circular"),var(--wcss-display-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem));font-weight:var(--wcss-display-sm-weight, 300);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);line-height:var(--wcss-display-sm-line-height, 1.3)}.display-xs{font-family:var(--wcss-display-xs-family, "AS Circular"),var(--wcss-display-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem));font-weight:var(--wcss-display-xs-weight, 300);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);line-height:var(--wcss-display-xs-line-height, 1.3)}.heading-xl{font-family:var(--wcss-heading-xl-family, "AS Circular"),var(--wcss-heading-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem));font-weight:var(--wcss-heading-xl-weight, 300);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);line-height:var(--wcss-heading-xl-line-height, 1.3)}.heading-lg{font-family:var(--wcss-heading-lg-family, "AS Circular"),var(--wcss-heading-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem));font-weight:var(--wcss-heading-lg-weight, 300);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);line-height:var(--wcss-heading-lg-line-height, 1.3)}.heading-md{font-family:var(--wcss-heading-md-family, "AS Circular"),var(--wcss-heading-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem));font-weight:var(--wcss-heading-md-weight, 300);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);line-height:var(--wcss-heading-md-line-height, 1.3)}.heading-sm{font-family:var(--wcss-heading-sm-family, "AS Circular"),var(--wcss-heading-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem));font-weight:var(--wcss-heading-sm-weight, 300);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);line-height:var(--wcss-heading-sm-line-height, 1.3)}.heading-xs{font-family:var(--wcss-heading-xs-family, "AS Circular"),var(--wcss-heading-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem));font-weight:var(--wcss-heading-xs-weight, 300);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);line-height:var(--wcss-heading-xs-line-height, 1.3)}.heading-2xs{font-family:var(--wcss-heading-2xs-family, "AS Circular"),var(--wcss-heading-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem));font-weight:var(--wcss-heading-2xs-weight, 300);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);line-height:var(--wcss-heading-2xs-line-height, 1.3)}.accent-2xl{font-family:var(--wcss-accent-2xl-family, "Good OT"),var(--wcss-accent-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));font-weight:var(--wcss-accent-2xl-weight, 450);letter-spacing:var(--wcss-accent-2xl-letter-spacing, .05em);line-height:var(--wcss-accent-2xl-line-height, 1)}.accent-2xl,.accent-xl{text-transform:uppercase}.accent-xl{font-family:var(--wcss-accent-xl-family, "Good OT"),var(--wcss-accent-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));font-weight:var(--wcss-accent-xl-weight, 450);letter-spacing:var(--wcss-accent-xl-letter-spacing, .05em);line-height:var(--wcss-accent-xl-line-height, 1.3)}.accent-lg{font-family:var(--wcss-accent-lg-family, "Good OT"),var(--wcss-accent-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));font-weight:var(--wcss-accent-lg-weight, 450);letter-spacing:var(--wcss-accent-lg-letter-spacing, .05em);line-height:var(--wcss-accent-lg-line-height, 1.3)}.accent-lg,.accent-md{text-transform:uppercase}.accent-md{font-family:var(--wcss-accent-md-family, "Good OT"),var(--wcss-accent-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));font-weight:var(--wcss-accent-md-weight, 500);letter-spacing:var(--wcss-accent-md-letter-spacing, .05em);line-height:var(--wcss-accent-md-line-height, 1.3)}.accent-sm{font-family:var(--wcss-accent-sm-family, "Good OT"),var(--wcss-accent-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));font-weight:var(--wcss-accent-sm-weight, 500);letter-spacing:var(--wcss-accent-sm-letter-spacing, .05em);line-height:var(--wcss-accent-sm-line-height, 1.3)}.accent-sm,.accent-xs{text-transform:uppercase}.accent-xs{font-family:var(--wcss-accent-xs-family, "Good OT"),var(--wcss-accent-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));font-weight:var(--wcss-accent-xs-weight, 500);letter-spacing:var(--wcss-accent-xs-letter-spacing, .1em);line-height:var(--wcss-accent-xs-line-height, 1.3)}.accent-2xs{font-family:var(--wcss-accent-2xs-family, "Good OT"),var(--wcss-accent-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xs-font-size, clamp(.875rem, 1.1666666667vw, .875rem));font-weight:var(--wcss-accent-2xs-weight, 450);letter-spacing:var(--wcss-accent-2xs-letter-spacing, .1em);line-height:var(--wcss-accent-2xs-line-height, 1.3);text-transform:uppercase}:host{display:contents;--insetPaddingXl: var(--ds-size-400, 2rem);--insetPaddingXxl: var(--ds-size-600, 3rem);--insetPaddingXxxl: var(--ds-size-800, 4rem)}:host .wrapper{position:absolute;overflow:auto;width:100%;height:100%;box-sizing:border-box;box-shadow:var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, .15));transition:transform;will-change:transform}:host .header-row{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--ds-size-200, 1rem)}:host .footer{display:flex;align-items:flex-start;justify-content:flex-end;margin-top:var(--insetPaddingXl)}:host .heading{margin-block-start:0}:host(:not([unformatted])) .wrapper{padding:var(--insetPaddingXl)}@media screen and (min-width: 1024px){:host(:not([unformatted])) .wrapper{padding:var(--insetPaddingXxxl)}}#closeButton{margin-left:auto}#closeButton:hover{cursor:pointer}#closeButton .util_displayHiddenVisually{position:absolute;overflow:hidden;width:1px;height:1px;padding:0;border:0;clip:rect(1px,1px,1px,1px)}:host([placement=right]) .wrapper,:host([placement=left]) .wrapper{max-width:90%}:host([placement=right]),:host([placement=left]){overflow-x:hidden}:host([placement=top]),:host([placement=bottom]){width:100%}:host([placement=top]) .wrapper,:host([placement=bottom]) .wrapper{max-height:90%}:host([placement=right]) .wrapper{right:100%}:host([visible][placement=right]) .wrapper{animation:slideInFromRight .3s forwards;animation-delay:.05s}:host([closing][placement=right]) .wrapper{animation:slideOutToRight .3s forwards}@keyframes slideInFromRight{0%{transform:translate(100%);right:0}to{transform:translateZ(0);right:0}}@keyframes slideOutToRight{0%{transform:translateZ(0);right:0}to{transform:translate(100%);right:0}}:host([placement=left]) .wrapper{left:-100%}:host([visible][placement=left]) .wrapper{animation:slideInFromLeft .3s forwards;animation-delay:.05s}:host([closing][placement=left]) .wrapper{animation:slideOutToLeft .3s forwards}@keyframes slideInFromLeft{0%{transform:translate(-100%);left:0}to{transform:translateZ(0);left:0}}@keyframes slideOutToLeft{0%{transform:translateZ(0);left:0}to{transform:translate(-100%);left:0}}:host([placement=top]) .wrapper{top:-100%}:host([visible][placement=top]) .wrapper{animation:slideInFromTop .3s forwards;animation-delay:.05s}:host([closing][placement=top]) .wrapper{animation:slideOutToTop .3s forwards}@keyframes slideInFromTop{0%{transform:translateY(-100%);top:0}to{transform:translateZ(0);top:0}}@keyframes slideOutToTop{0%{transform:translateZ(0);top:0}to{transform:translateY(-100%);top:0}}:host([placement=bottom]) .wrapper{bottom:100%}:host([visible][placement=bottom]) .wrapper{animation:slideInFromBottom .3s forwards;animation-delay:.05s}:host([closing][placement=bottom]) .wrapper{animation:slideOutToBottom .3s forwards}@keyframes slideInFromBottom{0%{transform:translateY(100%);bottom:0}to{transform:translateZ(0);bottom:0}}@keyframes slideOutToBottom{0%{transform:translateZ(0);bottom:0}to{transform:translateY(100%);bottom:0}}@media screen and (min-width: 768px){:host([size=sm][placement=left]) .wrapper,:host([size=sm][placement=right]) .wrapper{max-width:40%}}@media screen and (min-width: 1024px){:host([size=sm][placement=left]) .drawer,:host([size=sm][placement=right]) .drawer{max-width:740px}}@media screen and (min-width: 768px){:host([size=md][placement=left]) .wrapper,:host([size=md][placement=right]) .wrapper{max-width:70%}}@media screen and (min-width: 1024px){:host([size=md][placement=left]) .wrapper,:host([size=md][placement=right]) .wrapper{max-width:986px}}:host([size=sm][placement=top]:not([stretch])) .wrapper,:host([size=sm][placement=bottom]:not([stretch])) .wrapper{max-height:30%}:host([size=md][placement=top]:not([stretch])) .wrapper,:host([size=md][placement=bottom]:not([stretch])) .wrapper{max-height:50%}:host([stretch]) .wrapper{max-width:100%;max-height:100%}
|
|
3848
|
+
`;
|
|
3849
|
+
|
|
3850
|
+
var tokensCss = i$3`:host{--ds-auro-drawer-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-drawer-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}
|
|
3851
|
+
`;
|
|
3852
|
+
|
|
3853
|
+
/**
|
|
3854
|
+
* @internal
|
|
3855
|
+
*/
|
|
3856
|
+
class AuroDrawerContent extends i$1 {
|
|
3857
|
+
constructor() {
|
|
3858
|
+
super();
|
|
3859
|
+
|
|
3860
|
+
this.closeButtonAppearance = "default";
|
|
3861
|
+
|
|
3862
|
+
/**
|
|
3863
|
+
* @private
|
|
3864
|
+
*/
|
|
3865
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
3866
|
+
|
|
3867
|
+
/*
|
|
3868
|
+
* @private
|
|
3869
|
+
*/
|
|
3870
|
+
this.buttonTag = AuroDependencyVersioning.prototype.generateTag(
|
|
3871
|
+
"auro-button",
|
|
3872
|
+
buttonVersion,
|
|
3873
|
+
T,
|
|
3874
|
+
);
|
|
3875
|
+
|
|
3876
|
+
/**
|
|
3877
|
+
* @private
|
|
3878
|
+
*/
|
|
3879
|
+
this.iconTag = AuroDependencyVersioning.prototype.generateTag(
|
|
3880
|
+
"auro-icon",
|
|
3881
|
+
iconVersion,
|
|
3882
|
+
k,
|
|
3883
|
+
);
|
|
3884
|
+
|
|
3885
|
+
/**
|
|
3886
|
+
* @private
|
|
3887
|
+
*/
|
|
3888
|
+
this.prevActiveElement = undefined;
|
|
3889
|
+
}
|
|
3890
|
+
|
|
3891
|
+
static get properties() {
|
|
3892
|
+
return {
|
|
3893
|
+
/**
|
|
3894
|
+
* Defines whether the close button should be light colored for use on dark backgrounds.
|
|
3895
|
+
* @property {'default', 'inverse'}
|
|
3896
|
+
* @default 'default'
|
|
3897
|
+
*/
|
|
3898
|
+
closeButtonAppearance: {
|
|
3899
|
+
type: String,
|
|
3900
|
+
attribute: "close-button-appearance",
|
|
3901
|
+
reflect: true,
|
|
3902
|
+
},
|
|
3903
|
+
|
|
3904
|
+
modal: {
|
|
3905
|
+
type: Boolean,
|
|
3906
|
+
reflect: true,
|
|
3907
|
+
},
|
|
3908
|
+
|
|
3909
|
+
onDark: {
|
|
3910
|
+
type: Boolean,
|
|
3911
|
+
reflect: true,
|
|
3912
|
+
},
|
|
3913
|
+
|
|
3914
|
+
unformatted: {
|
|
3915
|
+
type: Boolean,
|
|
3916
|
+
reflect: true,
|
|
3917
|
+
},
|
|
3918
|
+
|
|
3919
|
+
visible: {
|
|
3920
|
+
type: Boolean,
|
|
3921
|
+
reflect: true,
|
|
3922
|
+
},
|
|
3923
|
+
|
|
3924
|
+
closing: {
|
|
3925
|
+
type: Boolean,
|
|
3926
|
+
reflect: true,
|
|
3927
|
+
},
|
|
3928
|
+
};
|
|
3929
|
+
}
|
|
3930
|
+
|
|
3931
|
+
static get styles() {
|
|
3932
|
+
return [colorCss, tokensCss, styleCss];
|
|
3933
|
+
}
|
|
3934
|
+
|
|
3935
|
+
get ariaLabelDrawerClose() {
|
|
3936
|
+
const slot = this.shadowRoot.querySelector('slot[name="ariaLabel.drawer.close"]');
|
|
3937
|
+
if (slot) {
|
|
3938
|
+
return this.runtimeUtils.getSlotText(this, "ariaLabel.drawer.close");
|
|
3939
|
+
}
|
|
3940
|
+
return "Close";
|
|
3941
|
+
}
|
|
3942
|
+
|
|
3943
|
+
handleSlotChange() {
|
|
3944
|
+
this.requestUpdate();
|
|
3945
|
+
}
|
|
3946
|
+
|
|
3947
|
+
handleCloseButtonClick() {
|
|
3948
|
+
this.dispatchEvent(new CustomEvent("close-click"));
|
|
3949
|
+
}
|
|
3950
|
+
|
|
3951
|
+
updated(changedProperties) {
|
|
3952
|
+
if (changedProperties.has("visible")) {
|
|
3953
|
+
if (this.visible) {
|
|
3954
|
+
// Reset CSS animation so it replays each time the drawer opens
|
|
3955
|
+
const wrapper = this.shadowRoot.querySelector(".wrapper");
|
|
3956
|
+
if (wrapper) {
|
|
3957
|
+
wrapper.style.animation = "none";
|
|
3958
|
+
// Force reflow to restart the animation
|
|
3959
|
+
void wrapper.offsetHeight; // eslint-disable-line no-void
|
|
3960
|
+
wrapper.style.animation = "";
|
|
3961
|
+
}
|
|
3962
|
+
|
|
3963
|
+
if (!this.focusTrap) {
|
|
3964
|
+
this.focusTrap = new FocusTrap(this);
|
|
3965
|
+
}
|
|
3966
|
+
this.prevActiveElement = this.triggerElement || document.activeElement;
|
|
3967
|
+
// Move focus to the first focusable element inside the drawer.
|
|
3968
|
+
// rAF lets showModal()'s native focus assignment settle before we override.
|
|
3969
|
+
requestAnimationFrame(() => {
|
|
3970
|
+
this.focusTrap?.focusFirstElement();
|
|
3971
|
+
});
|
|
3972
|
+
} else {
|
|
3973
|
+
// Native dialog.close() fires after a 300ms delay (see auro-floater-bib hideDialog).
|
|
3974
|
+
// Defer focus restoration so it runs after the dialog releases focus.
|
|
3975
|
+
const target = this.prevActiveElement;
|
|
3976
|
+
this.prevActiveElement = undefined;
|
|
3977
|
+
setTimeout(() => target?.focus(), 350);
|
|
3978
|
+
|
|
3979
|
+
if (this.focusTrap) {
|
|
3980
|
+
this.focusTrap.disconnect();
|
|
3981
|
+
this.focusTrap = null;
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
|
|
3986
|
+
if (changedProperties.has("closing") && this.closing) {
|
|
3987
|
+
// Reset closing state after animation completes
|
|
3988
|
+
setTimeout(() => {
|
|
3989
|
+
this.closing = false;
|
|
3990
|
+
}, 300);
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
|
|
3994
|
+
render() {
|
|
3995
|
+
return u$3`
|
|
3996
|
+
<!-- Hidden slot for close button aria-label -->
|
|
3997
|
+
<slot name="ariaLabel.drawer.close" hidden @slotchange=${this.handleSlotChange}></slot>
|
|
3998
|
+
|
|
3999
|
+
<div class="wrapper" tabindex="-1" part="drawer-wrapper">
|
|
4000
|
+
${
|
|
4001
|
+
this.unformatted
|
|
4002
|
+
? ""
|
|
4003
|
+
: u$3`
|
|
4004
|
+
<div class="header-row">
|
|
4005
|
+
<h1 class="heading heading-lg util_stackMarginNone--top" id="drawer-header" part="drawer-header">
|
|
4006
|
+
<slot name="header"></slot>
|
|
4007
|
+
</h1>
|
|
4008
|
+
${
|
|
4009
|
+
this.modal
|
|
4010
|
+
? ""
|
|
4011
|
+
: u$3`
|
|
4012
|
+
<div id="closeButton" @click="${this.handleCloseButtonClick}">
|
|
4013
|
+
<slot name="close">
|
|
4014
|
+
<${this.buttonTag}
|
|
4015
|
+
part="close-button"
|
|
4016
|
+
variant="ghost"
|
|
4017
|
+
shape="circle"
|
|
4018
|
+
size="sm"
|
|
4019
|
+
aria-label="${this.ariaLabelDrawerClose}"
|
|
4020
|
+
appearance="${this.onDark ? "inverse" : this.closeButtonAppearance}">
|
|
4021
|
+
<${this.iconTag} ?customColor="${this.onDark || this.closeButtonAppearance === "inverse"}" category="interface" name="x-lg"></${this.iconTag}>
|
|
4022
|
+
</${this.buttonTag}>
|
|
4023
|
+
</slot>
|
|
4024
|
+
</div>
|
|
4025
|
+
`
|
|
4026
|
+
}
|
|
4027
|
+
</div>
|
|
4028
|
+
`
|
|
4029
|
+
}
|
|
4030
|
+
<div part="drawer-content" class="content body-default">
|
|
4031
|
+
<slot></slot>
|
|
4032
|
+
<slot name="content"></slot>
|
|
4033
|
+
</div>
|
|
4034
|
+
${
|
|
4035
|
+
this.unformatted
|
|
4036
|
+
? ""
|
|
4037
|
+
: u$3`
|
|
4038
|
+
<div part="drawer-footer" class="footer" id="footerWrapper">
|
|
4039
|
+
<slot name="footer" id="footer"></slot>
|
|
4040
|
+
</div>
|
|
4041
|
+
`
|
|
4042
|
+
}
|
|
4043
|
+
</div>
|
|
4044
|
+
`;
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
|
|
4048
|
+
// define the name of the custom component
|
|
4049
|
+
if (!customElements.get("auro-drawer-content")) {
|
|
4050
|
+
customElements.define("auro-drawer-content", AuroDrawerContent);
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
const DESIGN_TOKEN_BREAKPOINT_PREFIX = "--ds-grid-breakpoint-";
|
|
4054
|
+
const DESIGN_TOKEN_BREAKPOINT_OPTIONS = ["lg", "md", "sm", "xs"];
|
|
4055
|
+
|
|
4056
|
+
/**
|
|
4057
|
+
* Parses a design token to get its pixel value.
|
|
4058
|
+
* Returns the pixel value of the design token or undefined if the token is invalid.
|
|
4059
|
+
* @param {string} value - `lg`, `md`, `sm`, or `xs`.
|
|
4060
|
+
* @returns {string | undefined} The pixel value of the design token or undefined if invalid.
|
|
4061
|
+
*/
|
|
4062
|
+
function parseBreakpointToken(value) {
|
|
4063
|
+
// verify the defined breakpoint is valid and exit out if not
|
|
4064
|
+
const validatedValue = DESIGN_TOKEN_BREAKPOINT_OPTIONS.includes(value)
|
|
4065
|
+
? value
|
|
4066
|
+
: undefined;
|
|
4067
|
+
if (!validatedValue) {
|
|
4068
|
+
return undefined;
|
|
4069
|
+
}
|
|
4070
|
+
// get the pixel value for the defined breakpoint
|
|
4071
|
+
const docStyle = getComputedStyle(document.documentElement);
|
|
4072
|
+
return docStyle.getPropertyValue(DESIGN_TOKEN_BREAKPOINT_PREFIX + value);
|
|
4073
|
+
}
|
|
4074
|
+
|
|
4075
|
+
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
4076
|
+
// See LICENSE in the project root for license information.
|
|
4077
|
+
|
|
4078
|
+
|
|
4079
|
+
const CONFIG = {
|
|
4080
|
+
backdrop: true,
|
|
4081
|
+
prefix: "auroDrawer",
|
|
4082
|
+
};
|
|
4083
|
+
|
|
4084
|
+
/**
|
|
4085
|
+
* The `auro-drawer` element provides users a way to implement an expandable drawer component.
|
|
4086
|
+
* @customElement auro-drawer
|
|
4087
|
+
*
|
|
4088
|
+
* @slot - Default slot for the body content in drawer.
|
|
4089
|
+
* @slot header - Text to display as the header of the modal.
|
|
4090
|
+
* @slot footer - Used for action options, e.g. buttons.
|
|
4091
|
+
* @slot close - Used to replace the close button.
|
|
4092
|
+
* @slot ariaLabel.drawer.close - Text to describe the "x" icon close button for screen readers. Default: "Close".
|
|
4093
|
+
*
|
|
4094
|
+
* @fires auroDrawer-toggled - Event fired when the drawer is toggled open or closed.
|
|
4095
|
+
*
|
|
4096
|
+
* @csspart {deprecated} drawer-backdrop - DEPRECATED - To migrate to the token approach, set `display: none` on this part and use the `--auro-drawer-backdrop-*` CSS custom properties instead.
|
|
4097
|
+
* @csspart drawer-wrapper - to style the content wrapper.
|
|
4098
|
+
* @csspart drawer-header - to style the header.
|
|
4099
|
+
* @csspart drawer-content - to style the container of the drawer content.
|
|
4100
|
+
* @csspart drawer-footer - to style the footer.
|
|
4101
|
+
* @csspart close-button - to style the close button.
|
|
4102
|
+
*
|
|
4103
|
+
* @cssprop [--auro-drawer-backdrop-background=transparent] - Background of the `::backdrop` pseudo-element. In modal/backdrop mode the component sets this to the design-system scrim token; consumers can override it.
|
|
4104
|
+
* @cssprop [--auro-drawer-backdrop-filter=none] - `backdrop-filter` applied to the `::backdrop` pseudo-element (e.g. `blur(4px)`).
|
|
4105
|
+
* @cssprop [--auro-drawer-backdrop-opacity=1] - Opacity of the `::backdrop` pseudo-element.
|
|
4106
|
+
* @cssprop [--auro-drawer-backdrop-transition=opacity 0.3s ease] - Transition applied to the `::backdrop` pseudo-element (e.g. `opacity 0.3s ease`).
|
|
4107
|
+
*/
|
|
4108
|
+
class AuroDrawer extends AuroFloater {
|
|
4109
|
+
constructor() {
|
|
4110
|
+
super("drawer");
|
|
4111
|
+
|
|
4112
|
+
this._initializeDefaults();
|
|
4113
|
+
}
|
|
4114
|
+
|
|
4115
|
+
_initializeDefaults() {
|
|
4116
|
+
this.closeButtonAppearance = "default";
|
|
4117
|
+
this.placement = "right";
|
|
4118
|
+
this.size = "lg";
|
|
4119
|
+
this.fullscreenBreakpoint = "sm";
|
|
4120
|
+
|
|
4121
|
+
/**
|
|
4122
|
+
* @private
|
|
4123
|
+
*/
|
|
4124
|
+
this.drawerBib = undefined;
|
|
4125
|
+
}
|
|
4126
|
+
|
|
4127
|
+
// when `carryDown` is true, the value of the property will be passed down to `this.drawerBib` in `updated` cycle.
|
|
4128
|
+
static get properties() {
|
|
4129
|
+
return {
|
|
4130
|
+
...AuroFloater.properties,
|
|
4131
|
+
|
|
4132
|
+
/**
|
|
4133
|
+
* Defines whether the close button should be light colored for use on dark backgrounds.
|
|
4134
|
+
* @property {'default', 'inverse'}
|
|
4135
|
+
* @default 'default'
|
|
4136
|
+
*/
|
|
4137
|
+
closeButtonAppearance: {
|
|
4138
|
+
type: String,
|
|
4139
|
+
attribute: "close-button-appearance",
|
|
4140
|
+
carryDown: true,
|
|
4141
|
+
reflect: true,
|
|
4142
|
+
},
|
|
4143
|
+
|
|
4144
|
+
/**
|
|
4145
|
+
* Defines the screen size breakpoint, at which the drawer switches to fullscreen mode on mobile.
|
|
4146
|
+
* When expanded, the drawer will automatically display in fullscreen mode if the screen size is equal to or smaller than the selected breakpoint.
|
|
4147
|
+
* @type {'lg' | 'md' | 'sm' | 'xs'}
|
|
4148
|
+
* @default 'sm'
|
|
4149
|
+
*/
|
|
4150
|
+
fullscreenBreakpoint: {
|
|
4151
|
+
type: String,
|
|
4152
|
+
reflect: true,
|
|
4153
|
+
},
|
|
4154
|
+
|
|
4155
|
+
/**
|
|
4156
|
+
* Modal drawer restricts the user to take an action (no default close actions).
|
|
4157
|
+
*/
|
|
4158
|
+
modal: {
|
|
4159
|
+
type: Boolean,
|
|
4160
|
+
carryDown: true,
|
|
4161
|
+
reflect: true,
|
|
4162
|
+
},
|
|
4163
|
+
|
|
4164
|
+
/**
|
|
4165
|
+
* Sets the anchor placement for the bib. If true, bib will open based off its parent size and position.
|
|
4166
|
+
*/
|
|
4167
|
+
nested: {
|
|
4168
|
+
type: Boolean,
|
|
4169
|
+
reflect: true,
|
|
4170
|
+
},
|
|
4171
|
+
|
|
4172
|
+
/**
|
|
4173
|
+
* DEPRECATED - use `closeButtonAppearance` instead.
|
|
4174
|
+
*/
|
|
4175
|
+
onDark: {
|
|
4176
|
+
type: Boolean,
|
|
4177
|
+
carryDown: true,
|
|
4178
|
+
reflect: true,
|
|
4179
|
+
},
|
|
4180
|
+
|
|
4181
|
+
/**
|
|
4182
|
+
* Sets the placement of drawer bib.
|
|
4183
|
+
* @type {'right' | 'left' | 'top' | 'bottom'}
|
|
4184
|
+
* @default 'right'
|
|
4185
|
+
*/
|
|
4186
|
+
placement: {
|
|
4187
|
+
type: String,
|
|
4188
|
+
carryDown: true,
|
|
4189
|
+
},
|
|
4190
|
+
|
|
4191
|
+
/**
|
|
4192
|
+
* Sets the size of drawer bib.
|
|
4193
|
+
* @type {'sm' | 'md' | 'lg'}
|
|
4194
|
+
* @default 'lg'
|
|
4195
|
+
*/
|
|
4196
|
+
size: {
|
|
4197
|
+
type: String,
|
|
4198
|
+
carryDown: true,
|
|
4199
|
+
},
|
|
4200
|
+
|
|
4201
|
+
/**
|
|
4202
|
+
* Unformatted drawer window, edge-to-edge fill for content.
|
|
4203
|
+
*/
|
|
4204
|
+
unformatted: {
|
|
4205
|
+
type: Boolean,
|
|
4206
|
+
carryDown: true,
|
|
4207
|
+
reflect: true,
|
|
4208
|
+
},
|
|
4209
|
+
};
|
|
4210
|
+
}
|
|
4211
|
+
|
|
4212
|
+
/**
|
|
4213
|
+
* This will register this element with the browser.
|
|
4214
|
+
* @param {string} [name="auro-drawer"] - The name of the element that you want to register.
|
|
4215
|
+
*
|
|
4216
|
+
* @example
|
|
4217
|
+
* AuroDrawer.register("custom-drawer") // this will register this element to <custom-drawer/>
|
|
4218
|
+
*
|
|
4219
|
+
*/
|
|
4220
|
+
static register(name = "auro-drawer") {
|
|
4221
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroDrawer);
|
|
4222
|
+
}
|
|
4223
|
+
|
|
4224
|
+
/**
|
|
4225
|
+
* @ignore
|
|
4226
|
+
*/
|
|
4227
|
+
get floaterConfig() {
|
|
4228
|
+
return {
|
|
4229
|
+
...super.floaterConfig,
|
|
4230
|
+
...CONFIG,
|
|
4231
|
+
placement: this.placement,
|
|
4232
|
+
fullscreenBreakpoint: parseBreakpointToken(this.fullscreenBreakpoint),
|
|
4233
|
+
};
|
|
4234
|
+
}
|
|
4235
|
+
|
|
4236
|
+
/**
|
|
4237
|
+
* Sets the expanded state of the drawer.
|
|
4238
|
+
* Called by floatingUI.
|
|
4239
|
+
* @ignore
|
|
4240
|
+
* @param {boolean} value - Whether the drawer is expanded.
|
|
4241
|
+
*/
|
|
4242
|
+
set expanded(value) {
|
|
4243
|
+
if (value) {
|
|
4244
|
+
this.drawerBib.setAttribute("stretch", "");
|
|
4245
|
+
} else {
|
|
4246
|
+
this.drawerBib.removeAttribute("stretch");
|
|
4247
|
+
}
|
|
4248
|
+
}
|
|
4249
|
+
|
|
4250
|
+
/**
|
|
4251
|
+
* Gets the expanded state of the drawer.
|
|
4252
|
+
* @ignore
|
|
4253
|
+
* @returns {boolean} Whether the drawer is expanded.
|
|
4254
|
+
*/
|
|
4255
|
+
get expanded() {
|
|
4256
|
+
return this.drawerBib.hasAttribute("stretch");
|
|
4257
|
+
}
|
|
4258
|
+
|
|
4259
|
+
firstUpdated() {
|
|
4260
|
+
super.firstUpdated();
|
|
4261
|
+
|
|
4262
|
+
AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(
|
|
4263
|
+
this,
|
|
4264
|
+
"auro-drawer",
|
|
4265
|
+
);
|
|
4266
|
+
|
|
4267
|
+
this.drawerBib = document.createElement("auro-drawer-content");
|
|
4268
|
+
this.drawerBib.triggerElement = this.triggerElement;
|
|
4269
|
+
this.drawerBib.addEventListener("close-click", () => {
|
|
4270
|
+
this.hide();
|
|
4271
|
+
});
|
|
4272
|
+
this.append(this.drawerBib);
|
|
4273
|
+
|
|
4274
|
+
this.bib.setAttribute("exportparts", "backdrop:drawer-backdrop");
|
|
4275
|
+
|
|
4276
|
+
this.setupAria();
|
|
4277
|
+
}
|
|
4278
|
+
|
|
4279
|
+
/**
|
|
4280
|
+
* @private
|
|
4281
|
+
*/
|
|
4282
|
+
setupAria() {
|
|
4283
|
+
if (this.triggerElement) {
|
|
4284
|
+
this.triggerElement.setAttribute("aria-haspopup", "dialog");
|
|
4285
|
+
this.triggerElement.setAttribute(
|
|
4286
|
+
"aria-controls",
|
|
4287
|
+
this.bib.getAttribute("id"),
|
|
4288
|
+
);
|
|
4289
|
+
}
|
|
4290
|
+
// role="dialog" and aria-modal are provided natively by the <dialog> element;
|
|
4291
|
+
// do not set them manually here.
|
|
4292
|
+
}
|
|
4293
|
+
|
|
4294
|
+
/**
|
|
4295
|
+
* @private
|
|
4296
|
+
* Updates an attribute on the drawer template element.
|
|
4297
|
+
* @param {string} attribute - The name of the attribute to update.
|
|
4298
|
+
* @param {string | boolean} value - The value to set the attribute to.
|
|
4299
|
+
*/
|
|
4300
|
+
updateDrawerBibAttribute(attribute, value) {
|
|
4301
|
+
if (typeof value === "boolean" || typeof value === "undefined") {
|
|
4302
|
+
if (value) {
|
|
4303
|
+
this.drawerBib.setAttribute(attribute, "");
|
|
4304
|
+
} else {
|
|
4305
|
+
this.drawerBib.removeAttribute(attribute);
|
|
4306
|
+
}
|
|
4307
|
+
} else {
|
|
4308
|
+
this.drawerBib.setAttribute(attribute, value);
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
|
|
4312
|
+
updated(changedProperties) {
|
|
4313
|
+
super.updated(changedProperties);
|
|
4314
|
+
|
|
4315
|
+
[...this.children].forEach((slot) => {
|
|
4316
|
+
if (slot !== this.drawerBib) {
|
|
4317
|
+
this.drawerBib.append(slot);
|
|
4318
|
+
}
|
|
4319
|
+
});
|
|
4320
|
+
|
|
4321
|
+
[...changedProperties.entries()].forEach(([entry]) => {
|
|
4322
|
+
if (AuroDrawer.properties[entry].carryDown) {
|
|
4323
|
+
this.updateDrawerBibAttribute(
|
|
4324
|
+
AuroDrawer.properties[entry].attribute || entry,
|
|
4325
|
+
this[entry],
|
|
4326
|
+
);
|
|
4327
|
+
}
|
|
4328
|
+
});
|
|
4329
|
+
|
|
4330
|
+
if (changedProperties.has("isPopoverVisible")) {
|
|
4331
|
+
this.drawerBib.visible = this.isPopoverVisible;
|
|
4332
|
+
if (!this.isPopoverVisible) {
|
|
4333
|
+
this.drawerBib.closing = true;
|
|
4334
|
+
}
|
|
4335
|
+
}
|
|
4336
|
+
|
|
4337
|
+
if (changedProperties.has("triggerElement")) {
|
|
4338
|
+
if (this.drawerBib) {
|
|
4339
|
+
this.drawerBib.triggerElement = this.triggerElement;
|
|
4340
|
+
}
|
|
4341
|
+
this.setupAria();
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
|
|
260
4346
|
AuroDrawer.register();
|
|
261
4347
|
|
|
262
4348
|
function initExamples(initCount) {
|