@aurodesignsystem/auro-formkit 5.8.1 → 5.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -15
- package/README.md +4 -4
- package/components/bibtemplate/dist/iconVersion.d.ts +1 -1
- package/components/bibtemplate/dist/index.js +2 -2
- package/components/bibtemplate/dist/registered.js +2 -2
- package/components/checkbox/demo/api.min.js +1 -1
- package/components/checkbox/demo/index.min.js +1 -1
- package/components/checkbox/dist/index.js +1 -1
- package/components/checkbox/dist/registered.js +1 -1
- package/components/combobox/demo/api.md +7 -6
- package/components/combobox/demo/api.min.js +1698 -1038
- package/components/combobox/demo/index.min.js +1698 -1038
- package/components/combobox/dist/auro-combobox.d.ts +10 -8
- package/components/combobox/dist/index.js +128 -149
- package/components/combobox/dist/registered.js +128 -149
- package/components/counter/demo/api.min.js +37 -61
- package/components/counter/demo/index.min.js +37 -61
- package/components/counter/dist/index.js +37 -61
- package/components/counter/dist/registered.js +37 -61
- package/components/datepicker/demo/api.min.js +55 -148
- package/components/datepicker/demo/index.min.js +55 -148
- package/components/datepicker/dist/auro-datepicker.d.ts +1 -1
- package/components/datepicker/dist/iconVersion.d.ts +1 -1
- package/components/datepicker/dist/index.js +55 -148
- package/components/datepicker/dist/popoverVersion.d.ts +1 -1
- package/components/datepicker/dist/registered.js +55 -148
- package/components/dropdown/demo/api.min.js +33 -57
- package/components/dropdown/demo/index.min.js +33 -57
- package/components/dropdown/dist/iconVersion.d.ts +1 -1
- package/components/dropdown/dist/index.js +33 -57
- package/components/dropdown/dist/registered.js +33 -57
- package/components/form/demo/working.html +1 -1
- package/components/input/demo/api.min.js +5 -4
- package/components/input/demo/index.min.js +5 -4
- package/components/input/dist/base-input.d.ts +1 -1
- package/components/input/dist/iconVersion.d.ts +1 -1
- package/components/input/dist/index.js +5 -4
- package/components/input/dist/registered.js +5 -4
- package/components/menu/demo/api.js +4 -0
- package/components/menu/demo/api.md +271 -31
- package/components/menu/demo/api.min.js +1609 -863
- package/components/menu/demo/index.html +1 -0
- package/components/menu/demo/index.js +2 -0
- package/components/menu/demo/index.md +95 -1
- package/components/menu/demo/index.min.js +1544 -812
- package/components/menu/dist/auro-menu.context.d.ts +227 -0
- package/components/menu/dist/auro-menu.d.ts +98 -53
- package/components/menu/dist/auro-menuoption.d.ts +116 -14
- package/components/menu/dist/index.js +1457 -796
- package/components/menu/dist/registered.js +1456 -807
- package/components/radio/demo/api.min.js +1 -1
- package/components/radio/demo/index.min.js +1 -1
- package/components/radio/dist/index.js +1 -1
- package/components/radio/dist/registered.js +1 -1
- package/components/select/demo/api.md +8 -7
- package/components/select/demo/api.min.js +1617 -1056
- package/components/select/demo/index.min.js +1617 -1056
- package/components/select/dist/auro-select.d.ts +11 -35
- package/components/select/dist/index.js +98 -218
- package/components/select/dist/registered.js +98 -218
- package/package.json +8 -2
|
@@ -38,39 +38,102 @@ function auroMenuLoadingExample() {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
const initSelectAllMatchingOptionsExample = () => {
|
|
42
|
+
|
|
43
|
+
const selectAllBtn = document.getElementById('selectAllBtn');
|
|
44
|
+
const selectAllMenu = document.getElementById('selectAllMenu');
|
|
45
|
+
const selectFirstBtn = document.getElementById('selectFirstBtn');
|
|
46
|
+
const selectFirstMenu = document.getElementById('selectFirstMenu');
|
|
47
|
+
const resetAllBtn = document.getElementById('resetAllBtn');
|
|
48
|
+
const resetFirstBtn = document.getElementById('resetFirstBtn');
|
|
49
|
+
|
|
50
|
+
selectAllBtn.addEventListener('click', () => {
|
|
51
|
+
selectAllMenu.value = 'stops';
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
resetAllBtn.addEventListener('click', () => {
|
|
55
|
+
selectAllMenu.reset();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
selectFirstBtn.addEventListener('click', () => {
|
|
59
|
+
selectFirstMenu.value = 'stops';
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
resetFirstBtn.addEventListener('click', () => {
|
|
63
|
+
selectFirstMenu.reset();
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
function initKeysExample() {
|
|
68
|
+
const menu = document.getElementById('keys-menu');
|
|
69
|
+
const stopsButton = document.getElementById('stopsButton');
|
|
70
|
+
const stopsTopButton = document.getElementById('stopsTopButton');
|
|
71
|
+
const output = document.getElementById('output');
|
|
72
|
+
|
|
73
|
+
const createConsoleEntry = (message) => {
|
|
74
|
+
const node = document.createElement('span');
|
|
75
|
+
node.innerHTML = message;
|
|
76
|
+
output.appendChild(node);
|
|
77
|
+
output.appendChild(document.createElement('br'));
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const resetConsole = () => {
|
|
81
|
+
output.innerHTML = '';
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const updateMenuValue = (value) => {
|
|
85
|
+
resetConsole();
|
|
86
|
+
createConsoleEntry(`Setting menu.value: <em>"${value}"</em>`);
|
|
87
|
+
menu.value = '';
|
|
88
|
+
menu.value = value;
|
|
89
|
+
createConsoleEntry(`menu.value before next lifecycle: <em>"${menu.value}"</em>`);
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
createConsoleEntry(`menu.value after lifecycle: <em>"${menu.value}"</em>`);
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
stopsButton.addEventListener('click', () => {
|
|
96
|
+
updateMenuValue('stops');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
stopsTopButton.addEventListener('click', () => {
|
|
100
|
+
updateMenuValue('stops-top');
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
41
104
|
/**
|
|
42
105
|
* @license
|
|
43
106
|
* Copyright 2019 Google LLC
|
|
44
107
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
45
108
|
*/
|
|
46
|
-
const t$2=globalThis,e$
|
|
109
|
+
const t$2=globalThis,e$5=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$6=Symbol(),o$5=new WeakMap;let n$4 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$6)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$5&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$5.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$5.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$4("string"==typeof t?t:t+"",void 0,s$6),i$6=(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$4(o,t,s$6)},S$1=(s,o)=>{if(e$5)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$5?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
|
|
47
110
|
|
|
48
111
|
/**
|
|
49
112
|
* @license
|
|
50
113
|
* Copyright 2017 Google LLC
|
|
51
114
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
52
|
-
*/const{is:i$
|
|
115
|
+
*/const{is:i$5,defineProperty:e$4,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$1,getOwnPropertySymbols:o$4,getPrototypeOf:n$3}=Object,a$2=globalThis,c$1=a$2.trustedTypes,l$2=c$1?c$1.emptyScript:"",p$2=a$2.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$3={toAttribute(t,s){switch(s){case Boolean:t=t?l$2: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$5(t,s),b={attribute:true,type:String,converter:u$3,reflect:false,useDefault:false,hasChanged:f$2};Symbol.metadata??=Symbol("metadata"),a$2.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){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$4(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}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$3(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$1(t),...o$4(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$3).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$3;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$2.reactiveElementVersions??=[]).push("2.1.1");
|
|
53
116
|
|
|
54
117
|
/**
|
|
55
118
|
* @license
|
|
56
119
|
* Copyright 2017 Google LLC
|
|
57
120
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
58
121
|
*/
|
|
59
|
-
const t$1=globalThis,i$
|
|
122
|
+
const t$1=globalThis,i$4=t$1.trustedTypes,s$5=i$4?i$4.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$3="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$3="?"+h,n$2=`<${o$3}>`,r=document,l$1=()=>r.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a$1=Array.isArray,u$2=t=>a$1(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f$1=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m$1=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p$1=/'/g,g$1=/"/g,$=/^(?:script|style|textarea|title)$/i,y$1=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x$1=y$1(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r.createTreeWalker(r,129);function P(t,i){if(!a$1(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$5?s$5.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f$1;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$1?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m$1):void 0!==u[3]&&(c=m$1):c===m$1?">"===u[0]?(c=r??f$1,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m$1:'"'===u[3]?g$1:p$1):c===g$1||c===p$1?c=m$1:c===v||c===_?c=f$1:(c=m$1,r=void 0);const x=c===m$1&&t[i+1].startsWith("/>")?" ":"";l+=c===f$1?s+n$2:d>=0?(o.push(a),s.slice(0,d)+e$3+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};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.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$3)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k$1}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$4?i$4.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l$1()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l$1());}}}else if(8===r.nodeType)if(r.data===o$3)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(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(t,h._$AS(t,i.values),h,e)),i}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).importNode(i,true);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(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$1(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r,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++;}}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(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u$2(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(this._$AH)?this._$AA.nextSibling.data=t:this.T(r.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.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a$1(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$1()),this.O(l$1()),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$1 = 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(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(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??"");}};class H extends k$1{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k$1{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k$1{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)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$1 = 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(this,t);}};const j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.3.1");const B=(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(i.insertBefore(l$1(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
60
123
|
|
|
61
124
|
/**
|
|
62
125
|
* @license
|
|
63
126
|
* Copyright 2017 Google LLC
|
|
64
127
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
65
|
-
*/const s$
|
|
128
|
+
*/const s$4=globalThis;let i$3 = 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(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T}};i$3._$litElement$=true,i$3["finalized"]=true,s$4.litElementHydrateSupport?.({LitElement:i$3});const o$2=s$4.litElementPolyfillSupport;o$2?.({LitElement:i$3});(s$4.litElementVersions??=[]).push("4.2.1");
|
|
66
129
|
|
|
67
|
-
var styleCss$1 = i$5`:focus:not(:focus-visible){outline:3px solid transparent}.body-default{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);font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.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);font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{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);font-size:var(--wcss-body-sm-font-size, 0.875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.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);font-size:var(--wcss-body-xs-font-size, 0.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-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-2xs-font-size, 0.625rem);line-height:var(--wcss-body-2xs-line-height, 0.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);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);font-weight:var(--wcss-display-2xl-weight, 300);line-height:var(--wcss-display-2xl-line-height, 1.3);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem))}.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);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);font-weight:var(--wcss-display-xl-weight, 300);line-height:var(--wcss-display-xl-line-height, 1.3);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem))}.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);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);font-weight:var(--wcss-display-lg-weight, 300);line-height:var(--wcss-display-lg-line-height, 1.3);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem))}.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);letter-spacing:var(--wcss-display-md-letter-spacing, 0);font-weight:var(--wcss-display-md-weight, 300);line-height:var(--wcss-display-md-line-height, 1.3);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem))}.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);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);font-weight:var(--wcss-display-sm-weight, 300);line-height:var(--wcss-display-sm-line-height, 1.3);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem))}.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);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);font-weight:var(--wcss-display-xs-weight, 300);line-height:var(--wcss-display-xs-line-height, 1.3);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem))}.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);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);font-weight:var(--wcss-heading-xl-weight, 300);line-height:var(--wcss-heading-xl-line-height, 1.3);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem))}.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);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);font-weight:var(--wcss-heading-lg-weight, 300);line-height:var(--wcss-heading-lg-line-height, 1.3);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem))}.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);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);font-weight:var(--wcss-heading-md-weight, 300);line-height:var(--wcss-heading-md-line-height, 1.3);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem))}.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);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);font-weight:var(--wcss-heading-sm-weight, 300);line-height:var(--wcss-heading-sm-line-height, 1.3);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem))}.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);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);font-weight:var(--wcss-heading-xs-weight, 450);line-height:var(--wcss-heading-xs-line-height, 1.3);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem))}.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);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);font-weight:var(--wcss-heading-2xs-weight, 450);line-height:var(--wcss-heading-2xs-line-height, 1.3);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem))}.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);letter-spacing:var(--wcss-accent-2xl-letter-spacing, 0.05em);font-weight:var(--wcss-accent-2xl-weight, 450);line-height:var(--wcss-accent-2xl-line-height, 1);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));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);letter-spacing:var(--wcss-accent-xl-letter-spacing, 0.05em);font-weight:var(--wcss-accent-xl-weight, 450);line-height:var(--wcss-accent-xl-line-height, 1.3);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));text-transform:uppercase}.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);letter-spacing:var(--wcss-accent-lg-letter-spacing, 0.05em);font-weight:var(--wcss-accent-lg-weight, 450);line-height:var(--wcss-accent-lg-line-height, 1.3);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));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);letter-spacing:var(--wcss-accent-md-letter-spacing, 0.05em);font-weight:var(--wcss-accent-md-weight, 500);line-height:var(--wcss-accent-md-line-height, 1.3);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));text-transform:uppercase}.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);letter-spacing:var(--wcss-accent-sm-letter-spacing, 0.05em);font-weight:var(--wcss-accent-sm-weight, 500);line-height:var(--wcss-accent-sm-line-height, 1.3);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));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);letter-spacing:var(--wcss-accent-xs-letter-spacing, 0.1em);font-weight:var(--wcss-accent-xs-weight, 500);line-height:var(--wcss-accent-xs-line-height, 1.3);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));text-transform:uppercase}.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);letter-spacing:var(--wcss-accent-2xs-letter-spacing, 0.1em);font-weight:var(--wcss-accent-2xs-weight, 450);line-height:var(--wcss-accent-2xs-line-height, 1.3);font-size:var(--wcss-accent-2xs-font-size, clamp(0.875rem, 1.1666666667vw, 0.875rem));text-transform:uppercase}:host{display:block;vertical-align:middle;line-height:0}:host .menuWrapper{box-sizing:border-box;display:flex;flex-direction:column;width:100%;margin:0;padding:0}:host ::slotted(hr){box-sizing:content-box !important;height:0 !important;overflow:visible !important;margin:var(--ds-size-100, 0.5rem) 0 !important;border-width:0 !important;border-top-width:1px !important;border-top-style:solid !important}:host [loadingplaceholder].empty{opacity:0;position:absolute}:host [loadingplaceholder] slot[name=loadingIcon]{vertical-align:middle;display:inline-block;margin-bottom:var(--ds-size-25, 0.125rem)}:host [loadingplaceholder] slot[name=loadingIcon]::slotted(*){margin-right:var(--ds-size-150, 0.75rem)}:host([root]){overflow-y:auto}:host([root]) .menuWrapper.lg{padding:var(--ds-size-150, 0.75rem);gap:var(--ds-size-50, 0.25rem)}:host([root]) .menuWrapper.xl{padding:var(--ds-size-200, 1rem);gap:var(--ds-size-100, 0.5rem)}`;
|
|
130
|
+
var styleCss$1 = i$6`:focus:not(:focus-visible){outline:3px solid transparent}.body-default{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);font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.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);font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{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);font-size:var(--wcss-body-sm-font-size, 0.875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.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);font-size:var(--wcss-body-xs-font-size, 0.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-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-2xs-font-size, 0.625rem);line-height:var(--wcss-body-2xs-line-height, 0.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);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);font-weight:var(--wcss-display-2xl-weight, 300);line-height:var(--wcss-display-2xl-line-height, 1.3);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem))}.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);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);font-weight:var(--wcss-display-xl-weight, 300);line-height:var(--wcss-display-xl-line-height, 1.3);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem))}.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);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);font-weight:var(--wcss-display-lg-weight, 300);line-height:var(--wcss-display-lg-line-height, 1.3);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem))}.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);letter-spacing:var(--wcss-display-md-letter-spacing, 0);font-weight:var(--wcss-display-md-weight, 300);line-height:var(--wcss-display-md-line-height, 1.3);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem))}.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);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);font-weight:var(--wcss-display-sm-weight, 300);line-height:var(--wcss-display-sm-line-height, 1.3);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem))}.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);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);font-weight:var(--wcss-display-xs-weight, 300);line-height:var(--wcss-display-xs-line-height, 1.3);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem))}.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);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);font-weight:var(--wcss-heading-xl-weight, 300);line-height:var(--wcss-heading-xl-line-height, 1.3);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem))}.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);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);font-weight:var(--wcss-heading-lg-weight, 300);line-height:var(--wcss-heading-lg-line-height, 1.3);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem))}.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);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);font-weight:var(--wcss-heading-md-weight, 300);line-height:var(--wcss-heading-md-line-height, 1.3);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem))}.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);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);font-weight:var(--wcss-heading-sm-weight, 300);line-height:var(--wcss-heading-sm-line-height, 1.3);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem))}.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);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);font-weight:var(--wcss-heading-xs-weight, 450);line-height:var(--wcss-heading-xs-line-height, 1.3);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem))}.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);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);font-weight:var(--wcss-heading-2xs-weight, 450);line-height:var(--wcss-heading-2xs-line-height, 1.3);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem))}.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);letter-spacing:var(--wcss-accent-2xl-letter-spacing, 0.05em);font-weight:var(--wcss-accent-2xl-weight, 450);line-height:var(--wcss-accent-2xl-line-height, 1);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));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);letter-spacing:var(--wcss-accent-xl-letter-spacing, 0.05em);font-weight:var(--wcss-accent-xl-weight, 450);line-height:var(--wcss-accent-xl-line-height, 1.3);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));text-transform:uppercase}.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);letter-spacing:var(--wcss-accent-lg-letter-spacing, 0.05em);font-weight:var(--wcss-accent-lg-weight, 450);line-height:var(--wcss-accent-lg-line-height, 1.3);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));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);letter-spacing:var(--wcss-accent-md-letter-spacing, 0.05em);font-weight:var(--wcss-accent-md-weight, 500);line-height:var(--wcss-accent-md-line-height, 1.3);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));text-transform:uppercase}.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);letter-spacing:var(--wcss-accent-sm-letter-spacing, 0.05em);font-weight:var(--wcss-accent-sm-weight, 500);line-height:var(--wcss-accent-sm-line-height, 1.3);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));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);letter-spacing:var(--wcss-accent-xs-letter-spacing, 0.1em);font-weight:var(--wcss-accent-xs-weight, 500);line-height:var(--wcss-accent-xs-line-height, 1.3);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));text-transform:uppercase}.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);letter-spacing:var(--wcss-accent-2xs-letter-spacing, 0.1em);font-weight:var(--wcss-accent-2xs-weight, 450);line-height:var(--wcss-accent-2xs-line-height, 1.3);font-size:var(--wcss-accent-2xs-font-size, clamp(0.875rem, 1.1666666667vw, 0.875rem));text-transform:uppercase}:host{display:block;vertical-align:middle;line-height:0}:host .menuWrapper{box-sizing:border-box;display:flex;flex-direction:column;width:100%;margin:0;padding:0}:host ::slotted(hr){box-sizing:content-box !important;height:0 !important;overflow:visible !important;margin:var(--ds-size-100, 0.5rem) 0 !important;border-width:0 !important;border-top-width:1px !important;border-top-style:solid !important}:host [loadingplaceholder].empty{opacity:0;position:absolute}:host [loadingplaceholder] slot[name=loadingIcon]{vertical-align:middle;display:inline-block;margin-bottom:var(--ds-size-25, 0.125rem)}:host [loadingplaceholder] slot[name=loadingIcon]::slotted(*){margin-right:var(--ds-size-150, 0.75rem)}:host([root]){overflow-y:auto}:host([root]) .menuWrapper.lg{padding:var(--ds-size-150, 0.75rem);gap:var(--ds-size-50, 0.25rem)}:host([root]) .menuWrapper.xl{padding:var(--ds-size-200, 1rem);gap:var(--ds-size-100, 0.5rem)}`;
|
|
68
131
|
|
|
69
|
-
var colorCss$1 = i$
|
|
132
|
+
var colorCss$1 = i$6`:host ::slotted(hr){border-top-color:var(--ds-auro-menu-divider-color)}[loadingplaceholder] slot[name=loadingIcon]{color:var(--ds-auro-menu-loader-color)}[loadingplaceholder] slot[name=loadingText]{color:var(--ds-auro-menu-loader-text-color)}`;
|
|
70
133
|
|
|
71
|
-
var tokensCss = i$
|
|
134
|
+
var tokensCss = i$6`:host{--ds-auro-menu-divider-color: var(--ds-basic-color-border-divider, rgba(0, 0, 0, 0.15));--ds-auro-menu-loader-color: var(--ds-basic-color-brand-primary, #01426a);--ds-auro-menu-loader-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-menuoption-container-color: transparent;--ds-auro-menuoption-container-border-color: var(--ds-auro-menuoption-container-color);--ds-auro-menuoption-icon-color: transparent;--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}`;
|
|
72
135
|
|
|
73
|
-
class AuroElement extends i$
|
|
136
|
+
class AuroElement extends i$3 {
|
|
74
137
|
static get properties() {
|
|
75
138
|
return {
|
|
76
139
|
|
|
@@ -174,6 +237,50 @@ class AuroElement extends i$2 {
|
|
|
174
237
|
}
|
|
175
238
|
}
|
|
176
239
|
|
|
240
|
+
/**
|
|
241
|
+
* @license
|
|
242
|
+
* Copyright 2021 Google LLC
|
|
243
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
244
|
+
*/
|
|
245
|
+
let s$3 = class s extends Event{constructor(s,t,e,o){super("context-request",{bubbles:true,composed:true}),this.context=s,this.contextTarget=t,this.callback=e,this.subscribe=o??false;}};
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @license
|
|
249
|
+
* Copyright 2021 Google LLC
|
|
250
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
251
|
+
*/
|
|
252
|
+
function n$1(n){return n}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* @license
|
|
256
|
+
* Copyright 2021 Google LLC
|
|
257
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
258
|
+
*/let s$2 = class s{constructor(t,s,i,h){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(t,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=t,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(t,s)),this.unsubscribe=s;},this.host=t,void 0!==s.context){const t=s;this.context=t.context,this.callback=t.callback,this.subscribe=t.subscribe??false;}else this.context=s,this.callback=i,this.subscribe=h??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new s$3(this.context,this.host,this.t,this.subscribe));}};
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @license
|
|
262
|
+
* Copyright 2021 Google LLC
|
|
263
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
264
|
+
*/
|
|
265
|
+
let s$1 = class s{get value(){return this.o}set value(s){this.setValue(s);}setValue(s,t=false){const i=t||!Object.is(s,this.o);this.o=s,i&&this.updateObservers();}constructor(s){this.subscriptions=new Map,this.updateObservers=()=>{for(const[s,{disposer:t}]of this.subscriptions)s(this.o,t);},void 0!==s&&(this.value=s);}addCallback(s,t,i){if(!i)return void s(this.value);this.subscriptions.has(s)||this.subscriptions.set(s,{disposer:()=>{this.subscriptions.delete(s);},consumerHost:t});const{disposer:h}=this.subscriptions.get(s);s(this.value,h);}clearCallbacks(){this.subscriptions.clear();}};
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* @license
|
|
269
|
+
* Copyright 2021 Google LLC
|
|
270
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
271
|
+
*/let e$2 = class e extends Event{constructor(t,s){super("context-provider",{bubbles:true,composed:true}),this.context=t,this.contextTarget=s;}};let i$2 = class i extends s$1{constructor(s,e,i){super(void 0!==e.context?e.initialValue:i),this.onContextRequest=t=>{if(t.context!==this.context)return;const s=t.contextTarget??t.composedPath()[0];s!==this.host&&(t.stopPropagation(),this.addCallback(t.callback,s,t.subscribe));},this.onProviderRequest=s=>{if(s.context!==this.context)return;if((s.contextTarget??s.composedPath()[0])===this.host)return;const e=new Set;for(const[s,{consumerHost:i}]of this.subscriptions)e.has(s)||(e.add(s),i.dispatchEvent(new s$3(this.context,i,s,true)));s.stopPropagation();},this.host=s,void 0!==e.context?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this);}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest);}hostConnected(){this.host.dispatchEvent(new e$2(this.context,this.host));}};
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* @license
|
|
275
|
+
* Copyright 2020 Google LLC
|
|
276
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
277
|
+
*/
|
|
278
|
+
const a=Symbol.for(""),o$1=t=>{if(t?.r===a)return t?._$litStatic$},s=t=>({_$litStatic$:t,r:a}),i$1=(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}),l=new Map,n=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$1(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.get(t))&&(n.raw=n,l.set(t,r=n)),e=u;}return t(r,...e)},u$1=n(x$1);
|
|
279
|
+
|
|
280
|
+
var styleCss = i$6`.body-default{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);font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.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);font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{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);font-size:var(--wcss-body-sm-font-size, 0.875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.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);font-size:var(--wcss-body-xs-font-size, 0.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-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-2xs-font-size, 0.625rem);line-height:var(--wcss-body-2xs-line-height, 0.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);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);font-weight:var(--wcss-display-2xl-weight, 300);line-height:var(--wcss-display-2xl-line-height, 1.3);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem))}.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);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);font-weight:var(--wcss-display-xl-weight, 300);line-height:var(--wcss-display-xl-line-height, 1.3);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem))}.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);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);font-weight:var(--wcss-display-lg-weight, 300);line-height:var(--wcss-display-lg-line-height, 1.3);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem))}.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);letter-spacing:var(--wcss-display-md-letter-spacing, 0);font-weight:var(--wcss-display-md-weight, 300);line-height:var(--wcss-display-md-line-height, 1.3);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem))}.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);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);font-weight:var(--wcss-display-sm-weight, 300);line-height:var(--wcss-display-sm-line-height, 1.3);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem))}.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);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);font-weight:var(--wcss-display-xs-weight, 300);line-height:var(--wcss-display-xs-line-height, 1.3);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem))}.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);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);font-weight:var(--wcss-heading-xl-weight, 300);line-height:var(--wcss-heading-xl-line-height, 1.3);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem))}.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);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);font-weight:var(--wcss-heading-lg-weight, 300);line-height:var(--wcss-heading-lg-line-height, 1.3);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem))}.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);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);font-weight:var(--wcss-heading-md-weight, 300);line-height:var(--wcss-heading-md-line-height, 1.3);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem))}.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);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);font-weight:var(--wcss-heading-sm-weight, 300);line-height:var(--wcss-heading-sm-line-height, 1.3);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem))}.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);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);font-weight:var(--wcss-heading-xs-weight, 450);line-height:var(--wcss-heading-xs-line-height, 1.3);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem))}.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);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);font-weight:var(--wcss-heading-2xs-weight, 450);line-height:var(--wcss-heading-2xs-line-height, 1.3);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem))}.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);letter-spacing:var(--wcss-accent-2xl-letter-spacing, 0.05em);font-weight:var(--wcss-accent-2xl-weight, 450);line-height:var(--wcss-accent-2xl-line-height, 1);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));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);letter-spacing:var(--wcss-accent-xl-letter-spacing, 0.05em);font-weight:var(--wcss-accent-xl-weight, 450);line-height:var(--wcss-accent-xl-line-height, 1.3);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));text-transform:uppercase}.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);letter-spacing:var(--wcss-accent-lg-letter-spacing, 0.05em);font-weight:var(--wcss-accent-lg-weight, 450);line-height:var(--wcss-accent-lg-line-height, 1.3);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));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);letter-spacing:var(--wcss-accent-md-letter-spacing, 0.05em);font-weight:var(--wcss-accent-md-weight, 500);line-height:var(--wcss-accent-md-line-height, 1.3);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));text-transform:uppercase}.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);letter-spacing:var(--wcss-accent-sm-letter-spacing, 0.05em);font-weight:var(--wcss-accent-sm-weight, 500);line-height:var(--wcss-accent-sm-line-height, 1.3);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));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);letter-spacing:var(--wcss-accent-xs-letter-spacing, 0.1em);font-weight:var(--wcss-accent-xs-weight, 500);line-height:var(--wcss-accent-xs-line-height, 1.3);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));text-transform:uppercase}.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);letter-spacing:var(--wcss-accent-2xs-letter-spacing, 0.1em);font-weight:var(--wcss-accent-2xs-weight, 450);line-height:var(--wcss-accent-2xs-line-height, 1.3);font-size:var(--wcss-accent-2xs-font-size, clamp(0.875rem, 1.1666666667vw, 0.875rem));text-transform:uppercase}:host{cursor:pointer;user-select:none;text-overflow:ellipsis;max-width:100dvw}:host .wrapper{display:flex;align-items:center;padding-right:var(--ds-size-200, 1rem);padding-left:calc(var(--ds-size-150, 0.75rem) + var(--ds-size-300, 1.5rem) + var(--ds-size-100, 0.5rem));padding-top:var(--ds-size-50, 0.25rem);padding-bottom:var(--ds-size-50, 0.25rem);border-radius:var(--ds-size-100, 0.5rem);-webkit-tap-highlight-color:transparent}:host .wrapper[class*=shape-box]{border-radius:unset}:host .wrapper[class*=shape-snowflake]{border-radius:unset;line-height:24px}:host .wrapper[class*=shape-pill]{border-radius:30px}:host .wrapper[class*=-lg]{padding-top:var(--ds-size-75, 0.375rem);padding-bottom:var(--ds-size-75, 0.375rem);padding-right:var(--ds-size-150, 0.75rem);line-height:26px}:host .wrapper[class*=-xl]{padding-top:var(--ds-size-100, 0.5rem);padding-bottom:var(--ds-size-100, 0.5rem);padding-right:var(--ds-size-200, 1rem);line-height:26px}:host slot{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host [auro-icon]{--ds-auro-icon-size: var(--ds-size-300, 1.5rem);margin-right:var(--ds-size-150, 0.75rem);margin-left:var(--ds-size-100, 0.5rem)}:host ::slotted(.nestingSpacer){display:inline-block;width:var(--ds-size-300, 1.5rem)}[slot=displayValue]{display:none}:host([loadingplaceholder]) .wrapper{padding-left:calc(var(--ds-size-150, 0.75rem) + var(--ds-size-300, 1.5rem) + var(--ds-size-100, 0.5rem))}:host([selected]) .wrapper{padding-left:0}:host([nocheckmark]) .wrapper{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-lg]{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-xl]{padding-left:var(--ds-size-200, 1rem)}:host([hidden]){display:none}:host([static]){pointer-events:none}:host([disabled]:hover){cursor:auto}:host([disabled]){user-select:none;pointer-events:none}`;
|
|
281
|
+
|
|
282
|
+
var colorCss = i$6`:host .wrapper{background-color:var(--ds-auro-menuoption-container-color, transparent);box-shadow:inset 0 0 0 1px var(--ds-auro-menuoption-container-border-color, transparent);color:var(--ds-auro-menuoption-text-color)}:host svg{fill:var(--ds-auro-menuoption-icon-color)}:host([disabled]){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0);--ds-auro-menuoption-icon-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:hover),:host(.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd)}:host(:focus){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}:host([selected]){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-subtle, #b4eff9);--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-menuoption-icon-color: var(--ds-basic-color-texticon-default, #2a2a2a)}:host([selected]:hover),:host([selected].active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd)}:host([selected]:focus){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-subtle, #b4eff9);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}:host(:focus:hover),:host(:focus.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}:host([selected]:focus:hover),:host([selected]:focus.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}`;
|
|
283
|
+
|
|
177
284
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
178
285
|
// See LICENSE in the project root for license information.
|
|
179
286
|
|
|
@@ -257,21 +364,96 @@ class AuroLibraryRuntimeUtils {
|
|
|
257
364
|
}
|
|
258
365
|
}
|
|
259
366
|
|
|
260
|
-
// Copyright (c)
|
|
367
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
261
368
|
// See LICENSE in the project root for license information.
|
|
262
369
|
|
|
263
370
|
|
|
371
|
+
class AuroDependencyVersioning {
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Generates a unique string to be used for child auro element naming.
|
|
375
|
+
* @private
|
|
376
|
+
* @param {string} baseName - Defines the first part of the unique element name.
|
|
377
|
+
* @param {string} version - Version of the component that will be appended to the baseName.
|
|
378
|
+
* @returns {string} - Unique string to be used for naming.
|
|
379
|
+
*/
|
|
380
|
+
generateElementName(baseName, version) {
|
|
381
|
+
let result = baseName;
|
|
382
|
+
|
|
383
|
+
result += '-';
|
|
384
|
+
result += version.replace(/[.]/g, '_');
|
|
385
|
+
|
|
386
|
+
return result;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Generates a unique string to be used for child auro element naming.
|
|
391
|
+
* @param {string} baseName - Defines the first part of the unique element name.
|
|
392
|
+
* @param {string} version - Version of the component that will be appended to the baseName.
|
|
393
|
+
* @returns {string} - Unique string to be used for naming.
|
|
394
|
+
*/
|
|
395
|
+
generateTag(baseName, version, tagClass) {
|
|
396
|
+
const elementName = this.generateElementName(baseName, version);
|
|
397
|
+
const tag = i$1`${s(elementName)}`;
|
|
398
|
+
|
|
399
|
+
if (!customElements.get(elementName)) {
|
|
400
|
+
customElements.define(elementName, class extends tagClass {});
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return tag;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
264
407
|
/**
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
* @returns {boolean} True if option is interactive.
|
|
408
|
+
* @license
|
|
409
|
+
* Copyright 2017 Google LLC
|
|
410
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
269
411
|
*/
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
412
|
+
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)}}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* @license
|
|
416
|
+
* Copyright 2018 Google LLC
|
|
417
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
418
|
+
*/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}});
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* @license
|
|
422
|
+
* Copyright 2018 Google LLC
|
|
423
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
424
|
+
*/const o=o=>o??E;
|
|
425
|
+
|
|
426
|
+
class p{registerComponent(t,a){customElements.get(t)||customElements.define(t,class extends a{});}closestElement(t,a=this,e=(a,s=a&&a.closest(t))=>a&&a!==document&&a!==window?s||e(a.getRootNode().host):null){return e(a)}handleComponentTagRename(t,a){const e=a.toLowerCase();t.tagName.toLowerCase()!==e&&t.setAttribute(e,true);}elementMatch(t,a){const e=a.toLowerCase();return t.tagName.toLowerCase()===e||t.hasAttribute(e)}}var u='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-labelledby="error__desc" class="ico_squareLarge" data-deprecated="true" role="img" style="min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor" viewBox="0 0 24 24" part="svg"><title/><desc id="error__desc">Error alert indicator.</desc><path d="m13.047 5.599 6.786 11.586A1.207 1.207 0 0 1 18.786 19H5.214a1.207 1.207 0 0 1-1.047-1.815l6.786-11.586a1.214 1.214 0 0 1 2.094 0m-1.165.87a.23.23 0 0 0-.085.085L5.419 17.442a.232.232 0 0 0 .203.35h12.756a.234.234 0 0 0 .203-.35L12.203 6.554a.236.236 0 0 0-.321-.084M12 15.5a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5m-.024-6.22c.325 0 .589.261.589.583v4.434a.586.586 0 0 1-.589.583.586.586 0 0 1-.588-.583V9.863c0-.322.264-.583.588-.583"/></svg>';class m extends i$3{static get properties(){return {hidden:{type:Boolean,reflect:true},hiddenVisually:{type:Boolean,reflect:true},hiddenAudible:{type:Boolean,reflect:true}}}hideAudible(t){return t?"true":"false"}}const g=new Map,f=(t,a={})=>{const e=a.responseParser||(t=>t.text());return g.has(t)||g.set(t,fetch(t).then(e)),g.get(t)};var w=i$6`: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}
|
|
427
|
+
`;class z extends m{constructor(){super(),this.onDark=false,this.appearance="default";}static get properties(){return {...m.properties,onDark:{type:Boolean,reflect:true},appearance:{type:String,reflect:true},svg:{attribute:false,reflect:true}}}static get styles(){return w}async fetchIcon(t,a){let e="";e="logos"===t?await f(`${this.uri}/${t}/${a}.svg`):await f(`${this.uri}/icons/${t}/${a}.svg`);return (new DOMParser).parseFromString(e,"text/html").body.querySelector("svg")}async firstUpdated(){try{if(!this.customSvg){const t=await this.fetchIcon(this.category,this.name);if(t)this.svg=t;else if(!t){const t=(new DOMParser).parseFromString(u,"text/html");this.svg=t.body.firstChild;}}}catch(t){this.svg=void 0;}}}i$6`.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}
|
|
428
|
+
`;var y=i$6`: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)}
|
|
429
|
+
`;var k=i$6`: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)}
|
|
430
|
+
`;class x extends z{constructor(){super(),this.variant=void 0,this.privateDefaults();}privateDefaults(){this.uri="https://cdn.jsdelivr.net/npm/@alaskaairux/icons@latest/dist",this.runtimeUtils=new p;}static get properties(){return {...z.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 [z.styles,y,w,k]}static register(t="auro-icon"){p.prototype.registerComponent(t,x);}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`
|
|
431
|
+
<div class="componentWrapper">
|
|
432
|
+
<div
|
|
433
|
+
class="${e({svgWrapper:true})}"
|
|
434
|
+
title="${o(this.title||void 0)}">
|
|
435
|
+
<span aria-hidden="${o(this.ariaHidden||true)}" part="svg">
|
|
436
|
+
${this.customSvg?x$1`
|
|
437
|
+
<slot name="svg"></slot>
|
|
438
|
+
`:x$1`
|
|
439
|
+
${this.svg}
|
|
440
|
+
`}
|
|
441
|
+
</span>
|
|
442
|
+
</div>
|
|
443
|
+
|
|
444
|
+
<div class="${e(t)}" part="label">
|
|
445
|
+
<slot></slot>
|
|
446
|
+
</div>
|
|
447
|
+
</div>
|
|
448
|
+
`}}
|
|
449
|
+
|
|
450
|
+
var iconVersion = '9.1.0';
|
|
451
|
+
|
|
452
|
+
var checkmarkIcon = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"checkmark-sm__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"checkmark-sm__desc\">a small check mark.</desc><path d=\"M8.461 11.84a.625.625 0 1 0-.922.844l2.504 2.738c.247.27.674.27.922 0l5.496-6a.625.625 0 1 0-.922-.844l-5.035 5.496z\"/></svg>"};
|
|
453
|
+
|
|
454
|
+
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
455
|
+
// See LICENSE in the project root for license information.
|
|
456
|
+
|
|
275
457
|
|
|
276
458
|
/**
|
|
277
459
|
* Helper method to dispatch custom events.
|
|
@@ -293,768 +475,1590 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
293
475
|
element.dispatchEvent(new CustomEvent(eventName, eventConfig));
|
|
294
476
|
}
|
|
295
477
|
|
|
296
|
-
|
|
297
|
-
* @license
|
|
298
|
-
* Copyright 2017 Google LLC
|
|
299
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
300
|
-
*/
|
|
301
|
-
const t={ATTRIBUTE:1},e$1=t=>(...e)=>({_$litDirective$:t,values:e});let i$1 = 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)}};
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* @license
|
|
305
|
-
* Copyright 2018 Google LLC
|
|
306
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
307
|
-
*/const e=e$1(class extends i$1{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}});
|
|
308
|
-
|
|
309
|
-
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
478
|
+
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
310
479
|
// See LICENSE in the project root for license information.
|
|
311
480
|
|
|
312
481
|
|
|
313
|
-
|
|
314
|
-
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
315
482
|
/**
|
|
316
|
-
* The auro-menu element provides users a way to
|
|
317
|
-
*
|
|
318
|
-
* @attr {
|
|
319
|
-
* @attr {
|
|
320
|
-
* @attr {
|
|
321
|
-
* @attr {
|
|
322
|
-
* @
|
|
323
|
-
* @
|
|
324
|
-
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
325
|
-
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
326
|
-
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
327
|
-
* @event {CustomEvent<{ loading: boolean; hasLoadingPlaceholder: boolean; }>} auroMenu-loadingChange - Notifies when the loading attribute is changed.
|
|
328
|
-
* @event {CustomEvent<any>} auroMenu-selectValueFailure - Notifies that an attempt to select a menuoption by matching a value has failed.
|
|
329
|
-
* @event {CustomEvent<any>} auroMenu-selectValueReset - Notifies that the component value has been reset.
|
|
330
|
-
* @event {CustomEvent<any>} auroMenu-selectedOption - Notifies that a new menuoption selection has been made.
|
|
331
|
-
* @slot loadingText - Text to show while loading attribute is set
|
|
332
|
-
* @slot loadingIcon - Icon to show while loading attribute is set
|
|
333
|
-
* @slot - Slot for insertion of menu options.
|
|
483
|
+
* The auro-menu element provides users a way to define a menu option.
|
|
484
|
+
*
|
|
485
|
+
* @attr {String} value - Specifies the value to be sent to a server.
|
|
486
|
+
* @attr {String} noCheckmark - When true, selected option will not show the checkmark.
|
|
487
|
+
* @attr {Boolean} disabled - When true specifies that the menuoption is disabled.
|
|
488
|
+
* @attr {Boolean} selected - Specifies that an option is selected.
|
|
489
|
+
* @event auroMenuOption-mouseover - Notifies that this option has been hovered over.
|
|
490
|
+
* @slot - Specifies text for an option, but is not the value.
|
|
334
491
|
*/
|
|
492
|
+
class AuroMenuOption extends AuroElement {
|
|
335
493
|
|
|
336
|
-
|
|
494
|
+
/**
|
|
495
|
+
* This will register this element with the browser.
|
|
496
|
+
* @param {string} [name="auro-menuoption"] - The name of element that you want to register to.
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* AuroMenuOption.register("custom-menuoption") // this will register this element to <custom-menuoption/>
|
|
500
|
+
*
|
|
501
|
+
*/
|
|
502
|
+
static register(name = "auro-menuoption") {
|
|
503
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenuOption);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Returns whether the menu option is currently active and selectable.
|
|
508
|
+
* An option is considered active if it is not hidden, not disabled, and not static.
|
|
509
|
+
* @returns {boolean} True if the option is active, false otherwise.
|
|
510
|
+
*/
|
|
511
|
+
get isActive() {
|
|
512
|
+
return !this.hasAttribute('hidden') &&
|
|
513
|
+
!this.disabled &&
|
|
514
|
+
!this.hasAttribute('static');
|
|
515
|
+
}
|
|
337
516
|
|
|
338
|
-
class AuroMenu extends AuroElement {
|
|
339
517
|
constructor() {
|
|
340
518
|
super();
|
|
341
519
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* @private
|
|
346
|
-
*/
|
|
347
|
-
this.shape = "box";
|
|
520
|
+
this.bindEvents();
|
|
348
521
|
|
|
349
522
|
/**
|
|
350
523
|
* @private
|
|
351
524
|
*/
|
|
352
|
-
this.
|
|
353
|
-
|
|
354
|
-
// Value of the selected options
|
|
355
|
-
this.value = undefined;
|
|
356
|
-
// Currently selected option
|
|
357
|
-
this.optionSelected = undefined;
|
|
358
|
-
// String used for highlighting/filtering
|
|
359
|
-
this.matchWord = undefined;
|
|
360
|
-
// Hide the checkmark icon on selected options
|
|
361
|
-
this.noCheckmark = false;
|
|
362
|
-
// Currently active option
|
|
363
|
-
this.optionActive = undefined;
|
|
364
|
-
// Loading state
|
|
365
|
-
this.loading = false;
|
|
366
|
-
// Multi-select mode
|
|
367
|
-
this.multiSelect = false;
|
|
368
|
-
|
|
369
|
-
// Event Bindings
|
|
525
|
+
this.shape = undefined;
|
|
370
526
|
|
|
371
527
|
/**
|
|
372
528
|
* @private
|
|
373
529
|
*/
|
|
374
|
-
this.
|
|
530
|
+
this.size = undefined;
|
|
375
531
|
|
|
376
532
|
/**
|
|
377
|
-
*
|
|
533
|
+
* Generate unique names for dependency components.
|
|
378
534
|
*/
|
|
379
|
-
|
|
535
|
+
const versioning = new AuroDependencyVersioning();
|
|
536
|
+
this.iconTag = versioning.generateTag('auro-formkit-menuoption-icon', iconVersion, x);
|
|
380
537
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
this.handleOptionHover = this.handleOptionHover.bind(this);
|
|
538
|
+
this.selected = false;
|
|
539
|
+
this.noCheckmark = false;
|
|
540
|
+
this.disabled = false;
|
|
385
541
|
|
|
386
542
|
/**
|
|
387
543
|
* @private
|
|
388
544
|
*/
|
|
389
|
-
this.
|
|
545
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
390
546
|
|
|
391
|
-
//
|
|
547
|
+
// Initialize context-related properties
|
|
548
|
+
this.menuService = null;
|
|
549
|
+
this.unsubscribe = null;
|
|
392
550
|
|
|
393
551
|
/**
|
|
394
552
|
* @private
|
|
395
553
|
*/
|
|
396
|
-
|
|
397
|
-
// Root-level menu (true) or a nested submenu (false)
|
|
398
|
-
rootMenu: true,
|
|
399
|
-
// Currently focused/active menu item index
|
|
400
|
-
index: -1,
|
|
401
|
-
// Nested menu spacer
|
|
402
|
-
nestingSpacer: '<span class="nestingSpacer"></span>',
|
|
403
|
-
// Loading indicator for slot elements
|
|
404
|
-
loadingSlots: null,
|
|
405
|
-
// Store for menu items
|
|
406
|
-
items: [],
|
|
407
|
-
});
|
|
554
|
+
this.handleMenuChange = this.handleMenuChange.bind(this);
|
|
408
555
|
}
|
|
409
556
|
|
|
410
557
|
static get properties() {
|
|
411
558
|
return {
|
|
412
559
|
...super.properties,
|
|
413
|
-
noCheckmark: {
|
|
414
|
-
type: Boolean,
|
|
415
|
-
reflect: true,
|
|
416
|
-
attribute: 'nocheckmark'
|
|
417
|
-
},
|
|
418
560
|
disabled: {
|
|
419
561
|
type: Boolean,
|
|
420
562
|
reflect: true
|
|
421
563
|
},
|
|
422
|
-
|
|
423
|
-
type:
|
|
564
|
+
event: {
|
|
565
|
+
type: String,
|
|
424
566
|
reflect: true
|
|
425
567
|
},
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
568
|
+
key: {
|
|
569
|
+
type: String,
|
|
570
|
+
reflect: true
|
|
429
571
|
},
|
|
430
|
-
|
|
572
|
+
menuService: {
|
|
431
573
|
type: Object,
|
|
432
|
-
|
|
574
|
+
state: true
|
|
433
575
|
},
|
|
434
576
|
matchWord: {
|
|
435
577
|
type: String,
|
|
436
|
-
|
|
578
|
+
state: true
|
|
437
579
|
},
|
|
438
|
-
|
|
580
|
+
noCheckmark: {
|
|
439
581
|
type: Boolean,
|
|
440
|
-
reflect: true
|
|
441
|
-
|
|
582
|
+
reflect: true
|
|
583
|
+
},
|
|
584
|
+
selected: {
|
|
585
|
+
type: Boolean,
|
|
586
|
+
reflect: true
|
|
587
|
+
},
|
|
588
|
+
tabIndex: {
|
|
589
|
+
type: Number,
|
|
590
|
+
reflect: true
|
|
442
591
|
},
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* Value selected for the component.
|
|
446
|
-
*/
|
|
447
592
|
value: {
|
|
448
593
|
type: String,
|
|
449
|
-
reflect: true
|
|
450
|
-
attribute: 'value'
|
|
594
|
+
reflect: true
|
|
451
595
|
},
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Indent level for submenus.
|
|
455
|
-
* @private
|
|
456
|
-
*/
|
|
457
|
-
level: {
|
|
458
|
-
type: Number,
|
|
459
|
-
reflect: false,
|
|
460
|
-
attribute: false
|
|
461
|
-
}
|
|
462
596
|
};
|
|
463
597
|
}
|
|
464
598
|
|
|
465
599
|
static get styles() {
|
|
466
600
|
return [
|
|
467
|
-
styleCss
|
|
468
|
-
colorCss
|
|
601
|
+
styleCss,
|
|
602
|
+
colorCss,
|
|
469
603
|
tokensCss
|
|
470
604
|
];
|
|
471
605
|
}
|
|
472
606
|
|
|
473
|
-
/**
|
|
474
|
-
* This will register this element with the browser.
|
|
475
|
-
* @param {string} [name="auro-menu"] - The name of element that you want to register to.
|
|
476
|
-
*
|
|
477
|
-
* @example
|
|
478
|
-
* AuroMenu.register("custom-menu") // this will register this element to <custom-menu/>
|
|
479
|
-
*
|
|
480
|
-
*/
|
|
481
|
-
static register(name = "auro-menu") {
|
|
482
|
-
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenu);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Formatted value based on `multiSelect` state.
|
|
487
|
-
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
488
|
-
* @private
|
|
489
|
-
* @returns {String|Array<String>}
|
|
490
|
-
*/
|
|
491
|
-
get formattedValue() {
|
|
492
|
-
if (this.multiSelect) {
|
|
493
|
-
if (!this.value) {
|
|
494
|
-
return undefined;
|
|
495
|
-
}
|
|
496
|
-
if (this.value.startsWith("[")) {
|
|
497
|
-
return JSON.parse(this.value);
|
|
498
|
-
}
|
|
499
|
-
return [this.value];
|
|
500
|
-
}
|
|
501
|
-
return this.value;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
// Lifecycle Methods
|
|
505
|
-
|
|
506
607
|
connectedCallback() {
|
|
507
608
|
super.connectedCallback();
|
|
508
609
|
|
|
509
|
-
|
|
510
|
-
this
|
|
511
|
-
this.
|
|
512
|
-
this.addEventListener('slotchange', this.handleSlotChange);
|
|
513
|
-
this.setTagAttribute("auro-menu");
|
|
514
|
-
}
|
|
610
|
+
// Add the tag name as an attribute if it is different than the component name
|
|
611
|
+
// Add this step soon as this node gets attached to the DOM to avoid racing condition with menu's value setting logic.
|
|
612
|
+
this.runtimeUtils.handleComponentTagRename(this, 'auro-menuoption');
|
|
515
613
|
|
|
516
|
-
|
|
517
|
-
this.
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
614
|
+
// Set up context consumption in connectedCallback
|
|
615
|
+
this._contextConsumer = new s$2(this, {
|
|
616
|
+
context: MenuContext,
|
|
617
|
+
callback: this.attachTo.bind(this),
|
|
618
|
+
subscribe: true
|
|
619
|
+
});
|
|
521
620
|
|
|
522
|
-
|
|
621
|
+
// Establish the key property as early as possible
|
|
622
|
+
const valueAttr = this.getAttribute('value');
|
|
623
|
+
const keyAttr = this.getAttribute('key');
|
|
624
|
+
this.key = keyAttr !== null ? keyAttr : valueAttr;
|
|
523
625
|
}
|
|
524
626
|
|
|
525
627
|
firstUpdated() {
|
|
526
|
-
|
|
628
|
+
// Add the tag name as an attribute if it is different than the component name
|
|
629
|
+
this.runtimeUtils.handleComponentTagRename(this, 'auro-menuoption');
|
|
527
630
|
|
|
528
|
-
this.
|
|
529
|
-
this.
|
|
530
|
-
}
|
|
631
|
+
this.setAttribute('role', 'option');
|
|
632
|
+
this.setAttribute('aria-selected', 'false');
|
|
531
633
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
}
|
|
634
|
+
this.addEventListener('mouseover', () => {
|
|
635
|
+
this.dispatchEvent(new CustomEvent('auroMenuOption-mouseover', {
|
|
636
|
+
bubbles: true,
|
|
637
|
+
cancelable: false,
|
|
638
|
+
composed: true,
|
|
639
|
+
detail: this
|
|
640
|
+
}));
|
|
641
|
+
});
|
|
541
642
|
}
|
|
542
643
|
|
|
543
|
-
// eslint-disable-next-line complexity
|
|
544
644
|
updated(changedProperties) {
|
|
545
645
|
super.updated(changedProperties);
|
|
546
646
|
|
|
547
|
-
if
|
|
548
|
-
|
|
549
|
-
if ((old && this.optionSelected && old.value !== this.optionSelected.value) ||
|
|
550
|
-
(!old && this.optionSelected) ||
|
|
551
|
-
(old && !this.optionSelected)) {
|
|
552
|
-
this.notifySelectionChange();
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
if (changedProperties.has('multiSelect') && !changedProperties.has("value")) {
|
|
557
|
-
// Reset selection if multiSelect mode changes
|
|
558
|
-
this.clearSelection();
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
if (changedProperties.has("value")) {
|
|
563
|
-
// Handle null/undefined case
|
|
564
|
-
if (this.value === undefined || this.value === null) {
|
|
565
|
-
this.clearSelection();
|
|
566
|
-
} else {
|
|
567
|
-
if (this.multiSelect) {
|
|
568
|
-
// In multiselect mode, this.value should be an array of strings
|
|
569
|
-
const valueArray = this.formattedValue;
|
|
570
|
-
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
571
|
-
|
|
572
|
-
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
573
|
-
} else {
|
|
574
|
-
// In single-select mode, this.value should be a string
|
|
575
|
-
const matchingOptions = this.items.find((item) => item.value === this.value);
|
|
576
|
-
|
|
577
|
-
if (matchingOptions) {
|
|
578
|
-
this.optionSelected = matchingOptions;
|
|
579
|
-
this.index = this.items.indexOf(matchingOptions);
|
|
580
|
-
} else {
|
|
581
|
-
// If no matching option found, reset selection
|
|
582
|
-
this.optionSelected = undefined;
|
|
583
|
-
this.index = -1;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
647
|
+
// Update aria-selected attribute if selected changed
|
|
648
|
+
if (changedProperties.has('selected')) {
|
|
586
649
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
dispatchMenuEvent(this, 'auroMenu-selectValueFailure');
|
|
590
|
-
this.optionSelected = undefined;
|
|
591
|
-
this.index = -1;
|
|
592
|
-
}
|
|
593
|
-
}
|
|
650
|
+
// Update aria-selected attribute
|
|
651
|
+
this.setAttribute('aria-selected', this.selected.toString());
|
|
594
652
|
|
|
595
|
-
// Update
|
|
596
|
-
this.
|
|
597
|
-
[
|
|
598
|
-
'optionSelected',
|
|
599
|
-
true
|
|
600
|
-
]
|
|
601
|
-
]));
|
|
602
|
-
|
|
603
|
-
// Notify of changes
|
|
604
|
-
if (this.optionSelected !== undefined) {
|
|
605
|
-
this.notifySelectionChange();
|
|
653
|
+
// Update menu service selection state if this isn't an internal update
|
|
654
|
+
if (this.internalUpdateInProgress !== true) {
|
|
655
|
+
this.menuService[this.selected ? 'selectOption' : 'deselectOption'](this);
|
|
606
656
|
}
|
|
607
657
|
}
|
|
608
658
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* Updates the UI state and appearance of menu items based on changed properties.
|
|
615
|
-
* @private
|
|
616
|
-
* @param {Map<string, boolean>} changedProperties - LitElement's changed properties map.
|
|
617
|
-
*/
|
|
618
|
-
updateItemsState(changedProperties) {
|
|
619
|
-
if (!this.items) {
|
|
620
|
-
return;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
// Handle noCheckmark propagation to all menus and options
|
|
624
|
-
if (changedProperties.has('noCheckmark') && this.noCheckmark) {
|
|
625
|
-
// Update both menus and options
|
|
626
|
-
this.querySelectorAll('auro-menu, [auro-menu], auro-menuoption, [auro-menuoption]').forEach((element) => element.setAttribute('noCheckmark', ''));
|
|
659
|
+
if (changedProperties.has('active')) {
|
|
660
|
+
this.updateActiveClasses();
|
|
627
661
|
}
|
|
628
662
|
|
|
629
|
-
//
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
'size',
|
|
633
|
-
'shape'
|
|
634
|
-
].forEach((prop) => {
|
|
635
|
-
if (changedProperties.has(prop)) {
|
|
636
|
-
propagationTargets.forEach((el) => {
|
|
637
|
-
el.setAttribute(prop, this[prop]);
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
|
|
642
|
-
// Regex for matchWord if needed
|
|
643
|
-
let regexWord = null;
|
|
644
|
-
|
|
645
|
-
if (changedProperties.has('matchWord') && this.matchWord && this.matchWord.length) {
|
|
646
|
-
const escapedWord = this.matchWord.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
647
|
-
regexWord = new RegExp(escapedWord, 'giu');
|
|
663
|
+
// Update text highlight if matchWord changed
|
|
664
|
+
if (changedProperties.has('matchWord')) {
|
|
665
|
+
this.updateTextHighlight();
|
|
648
666
|
}
|
|
649
667
|
|
|
650
|
-
//
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
if (changedProperties.has('optionSelected') || changedProperties.has('value')) {
|
|
654
|
-
const isSelected = this.isOptionSelected(option);
|
|
655
|
-
option.setAttribute('aria-selected', isSelected ? 'true' : 'false');
|
|
656
|
-
|
|
657
|
-
// Add/remove selected attribute based on state
|
|
658
|
-
if (isSelected) {
|
|
659
|
-
option.setAttribute('selected', '');
|
|
660
|
-
} else {
|
|
661
|
-
option.removeAttribute('selected');
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
// Update text highlighting if matchWord changed
|
|
666
|
-
if (changedProperties.has('matchWord') && regexWord &&
|
|
667
|
-
isOptionInteractive(option) && !option.hasAttribute('persistent')) {
|
|
668
|
-
const nested = option.querySelectorAll('.nestingSpacer');
|
|
669
|
-
|
|
670
|
-
const displayValueEl = option.querySelector('[slot="displayValue"]');
|
|
671
|
-
if (displayValueEl) {
|
|
672
|
-
option.removeChild(displayValueEl);
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
// Create nested spacers
|
|
676
|
-
const nestingSpacerBundle = [...nested].map(() => this.nestingSpacer).join('');
|
|
677
|
-
|
|
678
|
-
// Update with spacers and matchWord
|
|
679
|
-
option.innerHTML = nestingSpacerBundle +
|
|
680
|
-
option.textContent.replace(
|
|
681
|
-
regexWord,
|
|
682
|
-
(match) => `<strong>${match}</strong>`
|
|
683
|
-
);
|
|
684
|
-
if (displayValueEl) {
|
|
685
|
-
option.append(displayValueEl);
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
// Update disabled state
|
|
690
|
-
if (changedProperties.has('disabled')) {
|
|
691
|
-
option.disabled = this.disabled;
|
|
692
|
-
}
|
|
693
|
-
});
|
|
694
|
-
|
|
695
|
-
// Handle loading state changes
|
|
696
|
-
if (changedProperties.has('loading')) {
|
|
697
|
-
this.setAttribute("aria-busy", this.loading);
|
|
698
|
-
dispatchMenuEvent(this, "auroMenu-loadingChange", {
|
|
699
|
-
loading: this.loading,
|
|
700
|
-
hasLoadingPlaceholder: this.hasLoadingPlaceholder
|
|
701
|
-
});
|
|
668
|
+
// Set the key to be the passed value if no key is provided
|
|
669
|
+
if (changedProperties.has('value') && this.key === undefined) {
|
|
670
|
+
this.key = this.value;
|
|
702
671
|
}
|
|
703
672
|
}
|
|
704
673
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
* @private
|
|
710
|
-
*/
|
|
711
|
-
initializeMenu() {
|
|
712
|
-
this.initItems();
|
|
713
|
-
if (this.rootMenu) {
|
|
714
|
-
this.setAttribute('role', 'listbox');
|
|
715
|
-
this.setAttribute('root', '');
|
|
716
|
-
this.handleNestedMenus(this);
|
|
674
|
+
disconnectedCallback() {
|
|
675
|
+
if (this.menuService) {
|
|
676
|
+
this.menuService.unsubscribe(this.handleMenuChange);
|
|
677
|
+
this.menuService.removeMenuOption(this);
|
|
717
678
|
}
|
|
718
679
|
}
|
|
719
680
|
|
|
720
681
|
/**
|
|
721
|
-
*
|
|
722
|
-
*
|
|
682
|
+
* Sets up event listeners for user interaction with the menu option.
|
|
683
|
+
* This function enables click and mouse enter events to trigger selection and highlighting logic.
|
|
723
684
|
*/
|
|
724
|
-
|
|
725
|
-
this.
|
|
726
|
-
|
|
727
|
-
this.updateItemsState(new Map([
|
|
728
|
-
[
|
|
729
|
-
'noCheckmark',
|
|
730
|
-
true
|
|
731
|
-
]
|
|
732
|
-
]));
|
|
733
|
-
}
|
|
685
|
+
bindEvents() {
|
|
686
|
+
this.addEventListener('click', this.handleClick.bind(this));
|
|
687
|
+
this.addEventListener('mouseenter', this.handleMouseEnter.bind(this));
|
|
734
688
|
}
|
|
735
689
|
|
|
736
|
-
// Logic Methods
|
|
737
|
-
|
|
738
690
|
/**
|
|
739
|
-
*
|
|
740
|
-
*
|
|
741
|
-
* @param {
|
|
691
|
+
* Attaches this menu option to a menu service and subscribes to its events.
|
|
692
|
+
* This method enables the option to participate in menu selection and highlighting logic.
|
|
693
|
+
* @param {Object} service - The menu service instance to attach to.
|
|
742
694
|
*/
|
|
743
|
-
|
|
744
|
-
if (
|
|
745
|
-
|
|
746
|
-
const currentSelected = this.optionSelected || [];
|
|
747
|
-
|
|
748
|
-
if (!currentValue.includes(option.value)) {
|
|
749
|
-
this.value = JSON.stringify([
|
|
750
|
-
...currentValue,
|
|
751
|
-
option.value
|
|
752
|
-
]);
|
|
753
|
-
}
|
|
754
|
-
if (!currentSelected.includes(option)) {
|
|
755
|
-
this.optionSelected = [
|
|
756
|
-
...currentSelected,
|
|
757
|
-
option
|
|
758
|
-
];
|
|
759
|
-
}
|
|
760
|
-
} else {
|
|
761
|
-
// Single select - use arrays with single values
|
|
762
|
-
this.value = option.value;
|
|
763
|
-
this.optionSelected = option;
|
|
695
|
+
attachTo(service) {
|
|
696
|
+
if (!service) {
|
|
697
|
+
return;
|
|
764
698
|
}
|
|
765
|
-
|
|
766
|
-
this.
|
|
699
|
+
this.menuService = service;
|
|
700
|
+
this.menuService.addMenuOption(this);
|
|
701
|
+
this.menuService.subscribe(this.handleMenuChange);
|
|
767
702
|
}
|
|
768
703
|
|
|
769
704
|
/**
|
|
770
|
-
*
|
|
771
|
-
*
|
|
772
|
-
* @param {
|
|
705
|
+
* Handles changes from the menu service and updates the option's state.
|
|
706
|
+
* This function synchronizes the option's properties and selection/highlight state with menu events.
|
|
707
|
+
* @param {Object} event - The event object from the menu service.
|
|
773
708
|
*/
|
|
774
|
-
|
|
775
|
-
if (this.multiSelect) {
|
|
776
|
-
// Remove this option from array
|
|
777
|
-
const newFormattedValue = (this.formattedValue || []).filter((val) => val !== option.value);
|
|
778
|
-
|
|
779
|
-
// If array is empty after removal, set back to undefined
|
|
780
|
-
if (newFormattedValue && newFormattedValue.length === 0) {
|
|
781
|
-
this.value = undefined;
|
|
782
|
-
} else {
|
|
783
|
-
this.value = JSON.stringify(newFormattedValue);
|
|
784
|
-
}
|
|
709
|
+
handleMenuChange(event) {
|
|
785
710
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
}
|
|
790
|
-
} else {
|
|
791
|
-
// For single-select: Back to undefined when deselected
|
|
792
|
-
this.value = undefined;
|
|
793
|
-
this.optionSelected = undefined;
|
|
711
|
+
// Ignore events without a type or property
|
|
712
|
+
if (!event || (!event.type && !event.property)) {
|
|
713
|
+
return;
|
|
794
714
|
}
|
|
795
715
|
|
|
796
|
-
// Update
|
|
797
|
-
|
|
716
|
+
// Update reactive properties based on event type
|
|
717
|
+
if (event.property && Object.keys(AuroMenuOption.properties).includes(event.property)) {
|
|
718
|
+
this[event.property] = event.value;
|
|
719
|
+
}
|
|
798
720
|
|
|
799
|
-
//
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
]));
|
|
721
|
+
// Handle highlight changes
|
|
722
|
+
if (event.type === 'highlightChange') {
|
|
723
|
+
const isActive = event.option === this;
|
|
724
|
+
this.active = isActive;
|
|
725
|
+
this.updateActiveClasses();
|
|
726
|
+
}
|
|
806
727
|
|
|
807
|
-
|
|
808
|
-
|
|
728
|
+
if (event.type === 'stateChange') {
|
|
729
|
+
const isSelected = event.selectedOptions.includes(this);
|
|
730
|
+
this.setInternalSelected(isSelected);
|
|
731
|
+
}
|
|
809
732
|
}
|
|
810
733
|
|
|
811
734
|
/**
|
|
812
|
-
*
|
|
813
|
-
*
|
|
735
|
+
* Updates the internal selected state of the menu option bypassing 'updated' and triggers custom events if selected.
|
|
736
|
+
* This function ensures the option's selection state is synchronized with menu logic and notifies listeners.
|
|
737
|
+
* @param {boolean} isSelected - Whether the option should be marked as selected.
|
|
814
738
|
*/
|
|
815
|
-
|
|
816
|
-
this.
|
|
817
|
-
this.
|
|
818
|
-
|
|
739
|
+
setInternalSelected(isSelected) {
|
|
740
|
+
this.internalUpdateInProgress = true;
|
|
741
|
+
this.selected = isSelected;
|
|
742
|
+
|
|
743
|
+
// Fire custom event if selected
|
|
744
|
+
if (isSelected) {
|
|
745
|
+
this.handleCustomEvent();
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
setTimeout(() => {
|
|
749
|
+
this.internalUpdateInProgress = false;
|
|
750
|
+
}, 0);
|
|
819
751
|
}
|
|
820
752
|
|
|
821
753
|
/**
|
|
822
|
-
*
|
|
823
|
-
* This
|
|
824
|
-
* @
|
|
754
|
+
* Sets the selected state of the menu option.
|
|
755
|
+
* This function updates whether the option is currently selected.
|
|
756
|
+
* @param {boolean} isSelected - Whether the option should be marked as selected.
|
|
757
|
+
* @deprecated Simply modify the `selected` property directly instead.
|
|
825
758
|
*/
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
this.value = undefined;
|
|
829
|
-
this.optionSelected = undefined;
|
|
830
|
-
this.index = -1;
|
|
831
|
-
|
|
832
|
-
// Reset UI state
|
|
833
|
-
this.updateItemsState(new Map([
|
|
834
|
-
[
|
|
835
|
-
'optionSelected',
|
|
836
|
-
true
|
|
837
|
-
]
|
|
838
|
-
]));
|
|
839
|
-
|
|
840
|
-
// Dispatch reset event
|
|
841
|
-
dispatchMenuEvent(this, 'auroMenu-selectValueReset');
|
|
759
|
+
setSelected(isSelected) {
|
|
760
|
+
this.selected = isSelected;
|
|
842
761
|
}
|
|
843
762
|
|
|
844
763
|
/**
|
|
845
|
-
*
|
|
846
|
-
*
|
|
847
|
-
* @param {
|
|
764
|
+
* Updates the active state and visual highlighting of the menu option.
|
|
765
|
+
* This function toggles the option's active status and applies or removes the active CSS class.
|
|
766
|
+
* @param {boolean} isActive - Whether the option should be marked as active.
|
|
767
|
+
* @deprecated Simply modify the `active` property directly instead.
|
|
848
768
|
*/
|
|
849
|
-
|
|
850
|
-
menu.level = menu.parentElement.level >= 0 ? menu.parentElement.level + 1 : 0;
|
|
851
|
-
|
|
852
|
-
if (menu.level > 0) {
|
|
853
|
-
menu.setAttribute('role', 'group');
|
|
854
|
-
menu.removeAttribute("root");
|
|
855
|
-
if (!menu.hasAttribute('aria-label')) {
|
|
856
|
-
menu.setAttribute('aria-label', 'submenu');
|
|
857
|
-
}
|
|
858
|
-
}
|
|
769
|
+
updateActive(isActive) {
|
|
859
770
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
option.innerHTML = this.nestingSpacer.repeat(menu.level) + option.innerHTML.replace(regex, '');
|
|
864
|
-
});
|
|
771
|
+
// Set active state
|
|
772
|
+
this.active = isActive;
|
|
773
|
+
this.updateActiveClasses();
|
|
865
774
|
}
|
|
866
775
|
|
|
867
|
-
// Event Handlers
|
|
868
|
-
|
|
869
776
|
/**
|
|
870
|
-
*
|
|
777
|
+
* Updates the CSS class for the menu option based on its active state.
|
|
778
|
+
* This function adds or removes the 'active' class to visually indicate the option's active status.
|
|
871
779
|
* @private
|
|
872
|
-
* @param {KeyboardEvent} event - Event object from the browser.
|
|
873
780
|
*/
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
this.navigateOptions('down');
|
|
879
|
-
break;
|
|
880
|
-
case "ArrowUp":
|
|
881
|
-
this.navigateOptions('up');
|
|
882
|
-
break;
|
|
883
|
-
case "Tab":
|
|
884
|
-
this.makeSelection();
|
|
885
|
-
break;
|
|
886
|
-
case "Enter":
|
|
887
|
-
this.makeSelection();
|
|
888
|
-
break;
|
|
889
|
-
}
|
|
781
|
+
updateActiveClasses() {
|
|
782
|
+
// Update class based on active state
|
|
783
|
+
if (this.active) this.classList.add('active');
|
|
784
|
+
else this.classList.remove('active');
|
|
890
785
|
}
|
|
891
786
|
|
|
787
|
+
|
|
892
788
|
/**
|
|
893
|
-
*
|
|
789
|
+
* Updates the visual highlighting of text within the menu option based on the current match word.
|
|
790
|
+
* This function highlights matching text segments and manages nested spacers for display formatting.
|
|
894
791
|
* @private
|
|
895
792
|
*/
|
|
896
|
-
|
|
897
|
-
if (!this.items) {
|
|
898
|
-
this.initItems();
|
|
899
|
-
}
|
|
793
|
+
updateTextHighlight() {
|
|
900
794
|
|
|
901
|
-
//
|
|
902
|
-
|
|
795
|
+
// Regex for matchWord if needed
|
|
796
|
+
let regexWord = null;
|
|
903
797
|
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
798
|
+
if (this.matchWord && this.matchWord.length) {
|
|
799
|
+
const escapedWord = this.matchWord.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
800
|
+
regexWord = new RegExp(escapedWord, 'giu');
|
|
907
801
|
}
|
|
908
802
|
|
|
909
|
-
//
|
|
910
|
-
if (
|
|
911
|
-
this.
|
|
912
|
-
|
|
913
|
-
}
|
|
803
|
+
// Update text highlighting if matchWord changed
|
|
804
|
+
if (regexWord &&
|
|
805
|
+
this.isActive && !this.hasAttribute('persistent')) {
|
|
806
|
+
const nested = this.querySelectorAll('.nestingSpacer');
|
|
914
807
|
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
} else if (this.option !== this.optionSelected || !this.isOptionSelected(option)) {
|
|
920
|
-
this.clearSelection();
|
|
921
|
-
this.handleSelectState(option);
|
|
922
|
-
}
|
|
808
|
+
const displayValueEl = this.querySelector('[slot="displayValue"]');
|
|
809
|
+
if (displayValueEl) {
|
|
810
|
+
this.removeChild(displayValueEl);
|
|
811
|
+
}
|
|
923
812
|
|
|
924
|
-
|
|
813
|
+
// Create nested spacers
|
|
814
|
+
const nestingSpacerBundle = [...nested].map(() => this.nestingSpacer).join('');
|
|
815
|
+
|
|
816
|
+
// Update with spacers and matchWord
|
|
817
|
+
this.innerHTML = nestingSpacerBundle +
|
|
818
|
+
this.textContent.replace(
|
|
819
|
+
regexWord,
|
|
820
|
+
(match) => `<strong>${match}</strong>`
|
|
821
|
+
);
|
|
822
|
+
if (displayValueEl) {
|
|
823
|
+
this.append(displayValueEl);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
925
826
|
}
|
|
926
827
|
|
|
927
828
|
/**
|
|
928
|
-
*
|
|
829
|
+
* Handles click events on the menu option, toggling its selected state.
|
|
830
|
+
* This function dispatches a click event and updates selection if the option is not disabled.
|
|
929
831
|
* @private
|
|
930
|
-
* @param {HTMLElement} option - The menuoption to toggle.
|
|
931
832
|
*/
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
this.handleDeselectState(option);
|
|
937
|
-
} else if (option.value === undefined || option.value === '') {
|
|
938
|
-
dispatchMenuEvent(this, 'auroMenu-selectValueFailure');
|
|
939
|
-
} else {
|
|
940
|
-
this.handleSelectState(option);
|
|
833
|
+
handleClick() {
|
|
834
|
+
if (!this.disabled) {
|
|
835
|
+
this.dispatchClickEvent();
|
|
836
|
+
this.selected = !this.selected;
|
|
941
837
|
}
|
|
942
838
|
}
|
|
943
839
|
|
|
944
840
|
/**
|
|
945
|
-
* Handles
|
|
841
|
+
* Handles mouse enter events to highlight the menu option.
|
|
842
|
+
* This function updates the menu service to set this option as the currently highlighted item if not disabled.
|
|
946
843
|
* @private
|
|
947
|
-
* @param {MouseEvent} event - Event object from the browser.
|
|
948
844
|
*/
|
|
949
|
-
|
|
950
|
-
if (!this.
|
|
951
|
-
|
|
845
|
+
handleMouseEnter() {
|
|
846
|
+
if (!this.disabled) {
|
|
847
|
+
this.menuService.setHighlightedOption(this);
|
|
952
848
|
}
|
|
849
|
+
}
|
|
953
850
|
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
851
|
+
/**
|
|
852
|
+
* Dispatches custom events defined for this menu option.
|
|
853
|
+
* This function notifies listeners when a custom event is triggered by the option.
|
|
854
|
+
* @private
|
|
855
|
+
*/
|
|
856
|
+
handleCustomEvent() {
|
|
857
|
+
if (this.event) {
|
|
858
|
+
dispatchMenuEvent(this, this.event, { option: this });
|
|
859
|
+
dispatchMenuEvent(this, 'auroMenu-customEventFired', { option: this });
|
|
958
860
|
}
|
|
959
861
|
}
|
|
960
862
|
|
|
961
863
|
/**
|
|
962
|
-
*
|
|
864
|
+
* Dispatches a click event for this menu option.
|
|
865
|
+
* This function notifies listeners that the option has been clicked.
|
|
963
866
|
* @private
|
|
964
|
-
* @param {CustomEvent} event - Event object from the browser.
|
|
965
867
|
*/
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
868
|
+
dispatchClickEvent() {
|
|
869
|
+
this.dispatchEvent(new CustomEvent('auroMenuOption-click', {
|
|
870
|
+
bubbles: true,
|
|
871
|
+
cancelable: false,
|
|
872
|
+
composed: true,
|
|
873
|
+
detail: this
|
|
874
|
+
}));
|
|
970
875
|
}
|
|
971
876
|
|
|
972
877
|
/**
|
|
973
|
-
*
|
|
878
|
+
* Generates an HTML element containing an SVG icon based on the provided `svgContent`.
|
|
879
|
+
*
|
|
974
880
|
* @private
|
|
881
|
+
* @param {string} svgContent - The SVG content to be embedded.
|
|
882
|
+
* @returns {Element} The HTML element containing the SVG icon.
|
|
975
883
|
*/
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
884
|
+
generateIconHtml(svgContent) {
|
|
885
|
+
const dom = new DOMParser().parseFromString(svgContent, 'text/html');
|
|
886
|
+
const svg = dom.body.firstChild;
|
|
887
|
+
|
|
888
|
+
svg.setAttribute('slot', 'svg');
|
|
889
|
+
|
|
890
|
+
return u$1`<${this.iconTag} customColor customSvg>${svg}</${this.iconTag}>`;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Logic to determine the layout of the component.
|
|
895
|
+
* @protected
|
|
896
|
+
* @returns {void}
|
|
897
|
+
*/
|
|
898
|
+
renderLayout() {
|
|
899
|
+
|
|
900
|
+
const fontClassMap = {
|
|
901
|
+
xs: 'body-sm',
|
|
902
|
+
sm: 'body-default',
|
|
903
|
+
md: 'body-default',
|
|
904
|
+
lg: 'body-lg',
|
|
905
|
+
xl: 'body-lg'
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
const classes = e({
|
|
909
|
+
'wrapper': true,
|
|
910
|
+
[this.size ? fontClassMap[this.size] : 'body-sm']: true,
|
|
911
|
+
});
|
|
912
|
+
|
|
913
|
+
return u$1`
|
|
914
|
+
<div class="${classes}">
|
|
915
|
+
${this.selected && !this.noCheckmark
|
|
916
|
+
? this.generateIconHtml(checkmarkIcon.svg)
|
|
917
|
+
: undefined}
|
|
918
|
+
<slot></slot>
|
|
919
|
+
</div>
|
|
920
|
+
`;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/* eslint-disable */
|
|
925
|
+
|
|
926
|
+
class MenuService {
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* PROPERTIES AND GETTERS
|
|
930
|
+
*/
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Gets the list of registered menu options.
|
|
934
|
+
* @returns {AuroMenuOption[]}
|
|
935
|
+
*/
|
|
936
|
+
get menuOptions() {
|
|
937
|
+
return this._menuOptions;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Gets the currently highlighted option.
|
|
942
|
+
* @returns {AuroMenuOption|null}
|
|
943
|
+
*/
|
|
944
|
+
get highlightedOption() {
|
|
945
|
+
return this._menuOptions[this.highlightedIndex] || null;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Gets the current value(s) of the selected option(s).
|
|
950
|
+
* @returns {string|string[]|undefined}
|
|
951
|
+
*/
|
|
952
|
+
get currentValue() {
|
|
953
|
+
const values = (this.selectedOptions || []).map(option => option.value);
|
|
954
|
+
return this.multiSelect ? values : values[0];
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* Gets the label(s) of the currently selected option(s).
|
|
959
|
+
* @returns {string}
|
|
960
|
+
*/
|
|
961
|
+
get currentLabel() {
|
|
962
|
+
const labels = (this.selectedOptions || []).map(option => option.textContent);
|
|
963
|
+
return this.multiSelect ? labels.join(", ") : labels[0] || '';
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Gets the string representation of the current value(s).
|
|
968
|
+
* For multi-select, this is a JSON stringified array.
|
|
969
|
+
* @returns {string|undefined}
|
|
970
|
+
*/
|
|
971
|
+
get stringValue() {
|
|
972
|
+
const { currentValue } = this;
|
|
973
|
+
|
|
974
|
+
if (Array.isArray(currentValue)) {
|
|
975
|
+
if (currentValue.length > 0) {
|
|
976
|
+
return JSON.stringify(currentValue);
|
|
977
|
+
}
|
|
978
|
+
return undefined;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
if (typeof currentValue === 'string') {
|
|
982
|
+
if (currentValue.length > 0) {
|
|
983
|
+
return currentValue;
|
|
984
|
+
}
|
|
985
|
+
return undefined;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
// Future: handle other types here (e.g., number, object, etc.)
|
|
989
|
+
return undefined;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Gets the key(s) of the currently selected option(s).
|
|
994
|
+
* @returns {string|string[]|undefined}
|
|
995
|
+
*/
|
|
996
|
+
get currentKeys() {
|
|
997
|
+
const keys = (this.selectedOptions || []).map(option => option.key);
|
|
998
|
+
return this.multiSelect ? keys : keys[0];
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* CONSTRUCTOR
|
|
1003
|
+
*/
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Creates a new MenuService instance.
|
|
1007
|
+
* @param {Object} options - The options object.
|
|
1008
|
+
* @param {AuroMenu} options.host - The host element that this service will control. Required.
|
|
1009
|
+
* @throws {Error} If the host is not provided.
|
|
1010
|
+
*/
|
|
1011
|
+
constructor({ host } = {}) {
|
|
1012
|
+
|
|
1013
|
+
// Ensure a host was passed
|
|
1014
|
+
if (!host) {
|
|
1015
|
+
throw new Error("MenuService requires a host element.");
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
// Attach the service to the host
|
|
1019
|
+
this.host = host;
|
|
1020
|
+
this.host.addController(this);
|
|
1021
|
+
|
|
1022
|
+
// Set default properties
|
|
1023
|
+
this.size = undefined;
|
|
1024
|
+
this.shape = undefined;
|
|
1025
|
+
this.noCheckmark = undefined;
|
|
1026
|
+
this.disabled = undefined;
|
|
1027
|
+
this.matchWord = undefined;
|
|
1028
|
+
this.multiSelect = undefined;
|
|
1029
|
+
this.allowDeselect = undefined;
|
|
1030
|
+
this.selectAllMatchingOptions = undefined;
|
|
1031
|
+
|
|
1032
|
+
this.highlightedIndex = -1;
|
|
1033
|
+
|
|
1034
|
+
this._menuOptions = [];
|
|
1035
|
+
this._subscribers = [];
|
|
1036
|
+
this.internalUpdateInProgress = false;
|
|
1037
|
+
this.selectedOptions = [];
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* PROPERTY SYNCING
|
|
1042
|
+
*/
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* Handles host updates.
|
|
1046
|
+
* This is a lit reactive lifecycle method.
|
|
1047
|
+
* This comes from the Lit controller interface provided by adding this service as a controller to the host.
|
|
1048
|
+
* See constructor for `this.host.addController(this)`
|
|
1049
|
+
* You can read more about Lit reactive controllers here: https://lit.dev/docs/composition/controllers/
|
|
1050
|
+
*/
|
|
1051
|
+
hostUpdated() {
|
|
1052
|
+
|
|
1053
|
+
// Reset selection if multiSelect mode changes
|
|
1054
|
+
if (this.host.multiSelect !== this.multiSelect) {
|
|
1055
|
+
this.selectedOptions = [];
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
// Update properties on host update
|
|
1059
|
+
this.setProperties({
|
|
1060
|
+
size: this.host.size,
|
|
1061
|
+
shape: this.host.shape,
|
|
1062
|
+
noCheckmark: this.host.noCheckmark,
|
|
1063
|
+
disabled: this.host.disabled,
|
|
1064
|
+
matchWord: this.host.matchWord,
|
|
1065
|
+
multiSelect: this.host.multiSelect,
|
|
1066
|
+
allowDeselect: this.host.allowDeselect,
|
|
1067
|
+
selectAllMatchingOptions: this.host.selectAllMatchingOptions
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* Handles host disconnection and memory cleanup.
|
|
1073
|
+
*/
|
|
1074
|
+
hostDisconnected() {
|
|
1075
|
+
this._subscribers = [];
|
|
1076
|
+
this._menuOptions = [];
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Sets a property value if it exists on the instance and the value has changed.
|
|
1081
|
+
* @param {string} property
|
|
1082
|
+
* @param {any} value
|
|
1083
|
+
*/
|
|
1084
|
+
setProperty(property, value) {
|
|
1085
|
+
|
|
1086
|
+
// Only update if we are tracking the property in this service
|
|
1087
|
+
if (this.hasOwnProperty(property)) {
|
|
1088
|
+
|
|
1089
|
+
// Check if the value has changed
|
|
1090
|
+
const valueChanged = this[property] !== value;
|
|
1091
|
+
|
|
1092
|
+
// Update and notify if changed
|
|
1093
|
+
if (valueChanged) {
|
|
1094
|
+
this[property] = value;
|
|
1095
|
+
this.notify({ property, value });
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Sets multiple properties on the instance.
|
|
1102
|
+
* @param {Object} properties - Key-value pairs of properties to set.
|
|
1103
|
+
*/
|
|
1104
|
+
setProperties(properties) {
|
|
1105
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
1106
|
+
this.setProperty(key, value);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
/**
|
|
1111
|
+
* MENU OPTION HIGHLIGHTING
|
|
1112
|
+
*/
|
|
1113
|
+
|
|
1114
|
+
/**
|
|
1115
|
+
* Highlights the next active option in the menu.
|
|
1116
|
+
*/
|
|
1117
|
+
highlightNext() {
|
|
1118
|
+
this.moveHighlightedOption("next");
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* Highlights the previous active option in the menu.
|
|
1123
|
+
*/
|
|
1124
|
+
highlightPrevious() {
|
|
1125
|
+
this.moveHighlightedOption("previous");
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* Moves the highlighted option in the specified direction.
|
|
1130
|
+
* @param {string} direction - The direction to move the highlight ("next" or "previous").
|
|
1131
|
+
*/
|
|
1132
|
+
moveHighlightedOption(direction) {
|
|
1133
|
+
|
|
1134
|
+
// Get the active options
|
|
1135
|
+
const activeOptions = this._menuOptions.filter(option => option.isActive);
|
|
1136
|
+
|
|
1137
|
+
// Get the currently active option
|
|
1138
|
+
const currentActiveOption = activeOptions[activeOptions.indexOf(this.highlightedOption)];
|
|
1139
|
+
|
|
1140
|
+
// Determine the new index based on the currently active option and direction
|
|
1141
|
+
let newIndex = currentActiveOption
|
|
1142
|
+
? direction === "previous"
|
|
1143
|
+
? activeOptions.indexOf(currentActiveOption) - 1
|
|
1144
|
+
: activeOptions.indexOf(currentActiveOption) + 1
|
|
1145
|
+
: direction === "previous"
|
|
1146
|
+
? activeOptions.length - 1
|
|
1147
|
+
: 0;
|
|
1148
|
+
|
|
1149
|
+
// Wrap around the index if needed
|
|
1150
|
+
newIndex = newIndex < 0 ? activeOptions.length - 1 : newIndex >= activeOptions.length ? 0 : newIndex;
|
|
1151
|
+
|
|
1152
|
+
// Get the new active option and set it as highlighted
|
|
1153
|
+
const newActiveOption = activeOptions[newIndex];
|
|
1154
|
+
this.setHighlightedOption(newActiveOption);
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* Sets the highlighted index to the specified option.
|
|
1159
|
+
* @param {AuroMenuOption} option - The option to highlight.
|
|
1160
|
+
*/
|
|
1161
|
+
setHighlightedOption(option) {
|
|
1162
|
+
|
|
1163
|
+
if (!option) return;
|
|
1164
|
+
|
|
1165
|
+
// Get the index of the option to highlight
|
|
1166
|
+
const index = this._menuOptions.indexOf(option);
|
|
1167
|
+
|
|
1168
|
+
// Update highlighted index
|
|
1169
|
+
this.highlightedIndex = index;
|
|
1170
|
+
|
|
1171
|
+
// Notify subscribers of highlight change
|
|
1172
|
+
this.notify({ type: 'highlightChange', option, index: this.highlightedIndex });
|
|
1173
|
+
|
|
1174
|
+
// Dispatch the change event
|
|
1175
|
+
this.dispatchChangeEvent('auroMenu-activatedOption', option);
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* Sets the highlighted option to the option at the specified index if it exists.
|
|
1180
|
+
* @param {number} index
|
|
1181
|
+
*/
|
|
1182
|
+
setHighlightedIndex(index) {
|
|
1183
|
+
const option = this._menuOptions[index] || null;
|
|
1184
|
+
this.setHighlightedOption(option);
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* Selects the currently highlighted option.
|
|
1189
|
+
*/
|
|
1190
|
+
selectHighlightedOption() {
|
|
1191
|
+
if (this.highlightedOption) {
|
|
1192
|
+
this.toggleOption(this.highlightedOption);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
/**
|
|
1197
|
+
* SELECTION AND DESELECTION METHODS
|
|
1198
|
+
*/
|
|
1199
|
+
|
|
1200
|
+
/**
|
|
1201
|
+
* Selects one or more options in a batch operation
|
|
1202
|
+
* @param {AuroMenuOption|AuroMenuOption[]} options - Single option or array of options to select
|
|
1203
|
+
*/
|
|
1204
|
+
selectOptions(options) {
|
|
1205
|
+
let optionsToSelect = Array.isArray(options) ? options : [options];
|
|
1206
|
+
|
|
1207
|
+
// Filter out options that are inactive
|
|
1208
|
+
optionsToSelect = optionsToSelect.filter(option => option.isActive);
|
|
1209
|
+
|
|
1210
|
+
if (!optionsToSelect.length) return;
|
|
1211
|
+
|
|
1212
|
+
if (this.multiSelect) {
|
|
1213
|
+
this.selectedOptions = [...(this.selectedOptions || []), ...optionsToSelect];
|
|
1214
|
+
} else {
|
|
1215
|
+
// In single select mode, only take the last option
|
|
1216
|
+
this.selectedOptions = [optionsToSelect[optionsToSelect.length - 1]];
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
this.stageUpdate();
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Deselects one or more options in a batch operation
|
|
1224
|
+
* @param {AuroMenuOption|AuroMenuOption[]} options - Single option or array of options to deselect
|
|
1225
|
+
*/
|
|
1226
|
+
deselectOptions(options) {
|
|
1227
|
+
const optionsToDeselect = Array.isArray(options) ? options : [options];
|
|
1228
|
+
|
|
1229
|
+
if (!optionsToDeselect.length) return;
|
|
1230
|
+
|
|
1231
|
+
// Check if deselection should be prevented
|
|
1232
|
+
const shouldPreventDeselect = !this.allowDeselect && !this.multiSelect;
|
|
1233
|
+
const isOnlySelectedOption = this.selectedOptions.length === 1 && optionsToDeselect.includes(this.selectedOptions[0]);
|
|
1234
|
+
|
|
1235
|
+
// Prevent deselecting the only selected option if not allowed
|
|
1236
|
+
if (shouldPreventDeselect && isOnlySelectedOption) return;
|
|
1237
|
+
|
|
1238
|
+
const optionsSet = new Set(optionsToDeselect);
|
|
1239
|
+
this.selectedOptions = (this.selectedOptions || [])
|
|
1240
|
+
.filter(opt => !optionsSet.has(opt));
|
|
1241
|
+
|
|
1242
|
+
this.stageUpdate();
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Selects a single option.
|
|
1247
|
+
* @param {AuroMenuOption} option
|
|
1248
|
+
*/
|
|
1249
|
+
selectOption(option) {
|
|
1250
|
+
this.selectOptions(option);
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* Deselects a single option.
|
|
1255
|
+
* @param {AuroMenuOption} option
|
|
1256
|
+
*/
|
|
1257
|
+
deselectOption(option) {
|
|
1258
|
+
this.deselectOptions(option);
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* Toggles the selection state of a single option.
|
|
1263
|
+
* @param {AuroMenuOption} option
|
|
1264
|
+
*/
|
|
1265
|
+
toggleOption(option) {
|
|
1266
|
+
if (option.selected) {
|
|
1267
|
+
this.deselectOption(option);
|
|
1268
|
+
} else {
|
|
1269
|
+
this.selectOption(option);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/**
|
|
1274
|
+
* Selects options based on their value(s) when compared to a passed value or values.
|
|
1275
|
+
* Value or values are normalized to an array of strings that can be matched to option keys.
|
|
1276
|
+
* @param {string|number|Array<string|number>} value - The value(s) to select.
|
|
1277
|
+
*/
|
|
1278
|
+
selectByValue(value) {
|
|
1279
|
+
// Early exit for invalid/empty values or internal updates
|
|
1280
|
+
if (this.internalUpdateInProgress ||
|
|
1281
|
+
this.host.internalUpdateInProgress ||
|
|
1282
|
+
value === undefined ||
|
|
1283
|
+
value === null ||
|
|
1284
|
+
(Array.isArray(value) && value.length === 0) ||
|
|
1285
|
+
(typeof value === 'string' && value.trim() === '')) {
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
this.reset();
|
|
1290
|
+
|
|
1291
|
+
// Normalize values to array of strings
|
|
1292
|
+
const normalizedValues = this._getNormalizedValues(value);
|
|
1293
|
+
|
|
1294
|
+
// Validate for single-select mode
|
|
1295
|
+
let validatedValues = normalizedValues;
|
|
1296
|
+
if (normalizedValues.length > 1 && !this.multiSelect) {
|
|
1297
|
+
console.warn("MenuService - Multiple values provided for single-select menu. Only the first value will be selected.");
|
|
1298
|
+
validatedValues = [normalizedValues[0]];
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// Find matching options by comparing available options to validated values
|
|
1302
|
+
const trackedKeys = new Set();
|
|
1303
|
+
const optionsToSelect = this._menuOptions.filter(option => {
|
|
1304
|
+
const passesFilter = validatedValues.includes(option.key);
|
|
1305
|
+
const alreadyTracked = trackedKeys.has(option.key);
|
|
1306
|
+
|
|
1307
|
+
trackedKeys.add(option.key);
|
|
1308
|
+
|
|
1309
|
+
// Include the option in the options to be selected if it passes the filter check and
|
|
1310
|
+
// either hasn't been tracked yet or selectAllMatchingOptions is true
|
|
1311
|
+
return passesFilter && (!alreadyTracked || (alreadyTracked && this.selectAllMatchingOptions));
|
|
1312
|
+
});
|
|
1313
|
+
|
|
1314
|
+
// Handle selection result
|
|
1315
|
+
if (optionsToSelect.length && !this.optionsArraysMatch(optionsToSelect, this.selectedOptions)) {
|
|
1316
|
+
this.selectOptions(optionsToSelect);
|
|
1317
|
+
} else {
|
|
1318
|
+
this.stageUpdate();
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
// Dispatch failure event if no matches found
|
|
1322
|
+
if (!optionsToSelect.length && validatedValues.length) {
|
|
1323
|
+
this.dispatchChangeEvent('auroMenu-selectValueFailure', {
|
|
1324
|
+
message: 'No matching options found for the provided value(s).',
|
|
1325
|
+
values: validatedValues
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* Resets the selected options to an empty array.
|
|
1332
|
+
*/
|
|
1333
|
+
reset() {
|
|
1334
|
+
const previousOptions = [...this.selectedOptions];
|
|
1335
|
+
this.selectedOptions = [];
|
|
1336
|
+
|
|
1337
|
+
// Single update after clearing all
|
|
1338
|
+
if (previousOptions.length) {
|
|
1339
|
+
this.stageUpdate();
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* SUBSCRIPTION, NOTIFICATION AND EVENT DISPATCH METHODS
|
|
1345
|
+
*/
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* Subscribes a callback to menu service events.
|
|
1349
|
+
* @param {Function} callback - The callback to invoke on events.
|
|
1350
|
+
*/
|
|
1351
|
+
subscribe(callback) {
|
|
1352
|
+
this._subscribers.push(callback);
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* Remove a previously subscribed callback from menu service events.
|
|
1357
|
+
* @param {Function} callback
|
|
1358
|
+
*/
|
|
1359
|
+
unsubscribe(callback) {
|
|
1360
|
+
this._subscribers = this._subscribers.filter(cb => cb !== callback);
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
/**
|
|
1364
|
+
* Stages an update to notify subscribers of state and value changes.
|
|
1365
|
+
*/
|
|
1366
|
+
stageUpdate() {
|
|
1367
|
+
this.notifyStateChange();
|
|
1368
|
+
this.notifyValueChange();
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* Notifies subscribers of a menu service event.
|
|
1373
|
+
* All notifications are sent to all subscribers.
|
|
1374
|
+
* @param {string} event - The event to send to subscribers.
|
|
1375
|
+
*/
|
|
1376
|
+
notify(event) {
|
|
1377
|
+
this._subscribers.forEach(callback => callback(event));
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
/**
|
|
1381
|
+
* Notifies subscribers of a state change (selected options has changed).
|
|
1382
|
+
*/
|
|
1383
|
+
notifyStateChange() {
|
|
1384
|
+
this.notify({ type: 'stateChange', selectedOptions: this.selectedOptions });
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
/**
|
|
1388
|
+
* Notifies subscribers of a value change (current value has changed).
|
|
1389
|
+
*/
|
|
1390
|
+
notifyValueChange() {
|
|
1391
|
+
|
|
1392
|
+
// Prepare details for the event
|
|
1393
|
+
const details = {
|
|
1394
|
+
value: this.currentValue,
|
|
1395
|
+
stringValue: this.stringValue,
|
|
1396
|
+
keys: this.currentKeys,
|
|
1397
|
+
options: this.selectedOptions,
|
|
1398
|
+
label: this.currentLabel
|
|
1399
|
+
};
|
|
1400
|
+
|
|
1401
|
+
// If only one option is selected, include its index
|
|
1402
|
+
if (this.selectedOptions.length === 1) details.index = this._menuOptions.indexOf(this.selectedOptions[0]);
|
|
1403
|
+
|
|
1404
|
+
this.notify({
|
|
1405
|
+
type: 'valueChange',
|
|
1406
|
+
...details
|
|
1407
|
+
});
|
|
1408
|
+
|
|
1409
|
+
this.dispatchChangeEvent('auroMenu-selectedOption', details);
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* Dispatches a custom event from the host element.
|
|
1414
|
+
* @param {string} eventName
|
|
1415
|
+
* @param {any} detail
|
|
1416
|
+
*/
|
|
1417
|
+
dispatchChangeEvent(eventName, detail) {
|
|
1418
|
+
this.host.dispatchEvent(new CustomEvent(eventName, {
|
|
1419
|
+
bubbles: true,
|
|
1420
|
+
cancelable: false,
|
|
1421
|
+
composed: true,
|
|
1422
|
+
detail
|
|
1423
|
+
}));
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* MENU OPTION MANAGEMENT METHODS
|
|
1428
|
+
*/
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* Adds a menu option to the service's list.
|
|
1432
|
+
* @param {AuroMenuOption} option - the option to track
|
|
1433
|
+
*/
|
|
1434
|
+
addMenuOption(option) {
|
|
1435
|
+
this._menuOptions.push(option);
|
|
1436
|
+
this.notify({ type: 'optionsChange', options: this._menuOptions });
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* Removes a menu option from the service's list.
|
|
1441
|
+
* @param {AuroMenuOption} option - the option to remove
|
|
1442
|
+
*/
|
|
1443
|
+
removeMenuOption(option) {
|
|
1444
|
+
this._menuOptions = this._menuOptions.filter(opt => opt !== option);
|
|
1445
|
+
this.notify({ type: 'optionsChange', options: this._menuOptions });
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
/**
|
|
1449
|
+
* UTILITIES
|
|
1450
|
+
*/
|
|
1451
|
+
|
|
1452
|
+
/**
|
|
1453
|
+
* Normalizes a value or array of values into an array of strings for option selection.
|
|
1454
|
+
* This function ensures that input values are consistently formatted for matching menu options.
|
|
1455
|
+
*
|
|
1456
|
+
* @param {string|number|Array<string|number>} value - The value(s) to normalize.
|
|
1457
|
+
* @returns {Array<string>} An array of string values suitable for option matching.
|
|
1458
|
+
* @throws {Error} If any value is not a string or number.
|
|
1459
|
+
*/
|
|
1460
|
+
_getNormalizedValues(value) {
|
|
1461
|
+
let values = value;
|
|
1462
|
+
|
|
1463
|
+
// Handle JSON string and single value string input
|
|
1464
|
+
if (!Array.isArray(values) && typeof values === 'string') {
|
|
1465
|
+
|
|
1466
|
+
// Attempt to parse as JSON array
|
|
1467
|
+
try {
|
|
1468
|
+
|
|
1469
|
+
// Normalize single quotes to double quotes for JSON parsing
|
|
1470
|
+
// This will not handle complex cases but will cover basic usage
|
|
1471
|
+
const parseValue = values.replace(/'([^']*?)'/g, '"$1"');
|
|
1472
|
+
|
|
1473
|
+
// Attempt parse
|
|
1474
|
+
const parsed = JSON.parse(parseValue);
|
|
1475
|
+
|
|
1476
|
+
// Ensure parsed value is an array
|
|
1477
|
+
if (!Array.isArray(parsed)) throw new Error('Not an array');
|
|
1478
|
+
|
|
1479
|
+
// Set values to parsed array
|
|
1480
|
+
values = parsed;
|
|
1481
|
+
} catch (err) {
|
|
1482
|
+
|
|
1483
|
+
// If parsing fails, treat as single value
|
|
1484
|
+
values = [value];
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
// Handle a single number being passed
|
|
1489
|
+
if (typeof values === 'number') {
|
|
1490
|
+
values = [String(values)];
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
// Coerce each value to string and validate types
|
|
1494
|
+
values.forEach((val, index) => {
|
|
1495
|
+
|
|
1496
|
+
// Throw an error for invalid value types
|
|
1497
|
+
if (typeof val !== 'string' && typeof val !== 'number') {
|
|
1498
|
+
throw new Error('Value contains invalid value type. Supported types are string and number.');
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
// Convert numbers to strings for consistency
|
|
1502
|
+
if (typeof val === 'number') {
|
|
1503
|
+
values[index] = String(val);
|
|
1504
|
+
}
|
|
1505
|
+
});
|
|
1506
|
+
|
|
1507
|
+
// Return the resulting array of string values
|
|
1508
|
+
return values;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* Returns whether two arrays of options contain the same elements.
|
|
1513
|
+
* @param {AuroMenuOption[]} arr1 - First array of options.
|
|
1514
|
+
* @param {AuroMenuOption[]} arr2 - Second array of options.
|
|
1515
|
+
* @returns {boolean} True if arrays match, false otherwise.
|
|
1516
|
+
*/
|
|
1517
|
+
optionsArraysMatch(arr1, arr2) {
|
|
1518
|
+
if (arr1.length !== arr2.length) return false;
|
|
1519
|
+
|
|
1520
|
+
const set1 = new Set(arr1);
|
|
1521
|
+
const set2 = new Set(arr2);
|
|
1522
|
+
|
|
1523
|
+
for (let item of set1) {
|
|
1524
|
+
if (!set2.has(item)) {
|
|
1525
|
+
return false;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
return true;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
const MenuContext = n$1('menu-context');
|
|
1534
|
+
|
|
1535
|
+
/* eslint-disable no-underscore-dangle, curly */
|
|
1536
|
+
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
1537
|
+
// See LICENSE in the project root for license information.
|
|
1538
|
+
|
|
1539
|
+
|
|
1540
|
+
|
|
1541
|
+
/**
|
|
1542
|
+
* The auro-menu element provides users a way to select from a list of options.
|
|
1543
|
+
* @attr {HTMLElement|Array<HTMLElement>} optionSelected - An array of currently selected menu options, type `HTMLElement` by default. In multi-select mode, `optionSelected` is an array of HTML elements.
|
|
1544
|
+
* @attr {object} optionactive - Specifies the current active menuOption.
|
|
1545
|
+
* @attr {string} matchword - Specifies a string used to highlight matched string parts in options.
|
|
1546
|
+
* @attr {boolean} disabled - When true, the entire menu and all options are disabled;
|
|
1547
|
+
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
1548
|
+
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
1549
|
+
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
1550
|
+
* @attr {boolean} selectAllMatchingOptions - When true, selects all options that match the provided value/key when setting value and multiselect is enabled.
|
|
1551
|
+
* @attr {string} value - The value of the selected option. In multi-select mode, this is a JSON stringified array of selected option values.
|
|
1552
|
+
* @prop {string} size - Sets the size of the menu. Accepted values are 'sm' and 'md'. Default is 'sm'.
|
|
1553
|
+
* @prop {string} shape - Sets the shape of the menu options. Accepted values are 'box' and 'round'. Default is 'box'.
|
|
1554
|
+
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
1555
|
+
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
1556
|
+
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
1557
|
+
* @event {CustomEvent<{ loading: boolean; hasLoadingPlaceholder: boolean; }>} auroMenu-loadingChange - Notifies when the loading attribute is changed.
|
|
1558
|
+
* @event {CustomEvent<any>} auroMenu-selectValueFailure - Notifies that an attempt to select a menuoption by matching a value has failed.
|
|
1559
|
+
* @event {CustomEvent<any>} auroMenu-selectValueReset - Notifies that the component value has been reset.
|
|
1560
|
+
* @event {CustomEvent<any>} auroMenu-selectedOption - Notifies that a new menuoption selection has been made.
|
|
1561
|
+
* @slot loadingText - Text to show while loading attribute is set
|
|
1562
|
+
* @slot loadingIcon - Icon to show while loading attribute is set
|
|
1563
|
+
* @slot - Slot for insertion of menu options.
|
|
1564
|
+
*/
|
|
1565
|
+
|
|
1566
|
+
/* eslint-disable no-magic-numbers, max-lines, no-extra-parens */
|
|
1567
|
+
|
|
1568
|
+
class AuroMenu extends AuroElement {
|
|
1569
|
+
|
|
1570
|
+
constructor() {
|
|
1571
|
+
super();
|
|
1572
|
+
|
|
1573
|
+
// State properties (reactive)
|
|
1574
|
+
|
|
1575
|
+
/**
|
|
1576
|
+
* @private
|
|
1577
|
+
*/
|
|
1578
|
+
this.shape = "box";
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* @private
|
|
1582
|
+
*/
|
|
1583
|
+
this.size = "sm";
|
|
1584
|
+
|
|
1585
|
+
// Value of the selected options
|
|
1586
|
+
this.value = undefined;
|
|
1587
|
+
// Currently selected option
|
|
1588
|
+
this.optionSelected = undefined;
|
|
1589
|
+
// String used for highlighting/filtering
|
|
1590
|
+
this.matchWord = undefined;
|
|
1591
|
+
// Hide the checkmark icon on selected options
|
|
1592
|
+
this.noCheckmark = false;
|
|
1593
|
+
// Currently active option
|
|
1594
|
+
this.optionActive = undefined;
|
|
1595
|
+
// Loading state
|
|
1596
|
+
this.loading = false;
|
|
1597
|
+
// Multi-select mode
|
|
1598
|
+
this.multiSelect = false;
|
|
1599
|
+
// Allow deselecting of menu options
|
|
1600
|
+
this.allowDeselect = false;
|
|
1601
|
+
// Select all matching options when setting value in multi-select mode
|
|
1602
|
+
this.selectAllMatchingOptions = false;
|
|
1603
|
+
|
|
1604
|
+
// Event Bindings
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* @private
|
|
1608
|
+
*/
|
|
1609
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
/**
|
|
1613
|
+
* @private
|
|
1614
|
+
*/
|
|
1615
|
+
this.handleSlotChange = this.handleSlotChange.bind(this);
|
|
1616
|
+
|
|
1617
|
+
// Instance properties (non-reactive)
|
|
1618
|
+
|
|
1619
|
+
/**
|
|
1620
|
+
* @private
|
|
1621
|
+
*/
|
|
1622
|
+
Object.assign(this, {
|
|
1623
|
+
// Root-level menu (true) or a nested submenu (false)
|
|
1624
|
+
rootMenu: true,
|
|
1625
|
+
// Currently focused/active menu item index
|
|
1626
|
+
_index: -1,
|
|
1627
|
+
// Nested menu spacer
|
|
1628
|
+
nestingSpacer: '<span class="nestingSpacer"></span>',
|
|
1629
|
+
// Loading indicator for slot elements
|
|
1630
|
+
loadingSlots: null,
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
static get properties() {
|
|
1635
|
+
return {
|
|
1636
|
+
...super.properties,
|
|
1637
|
+
|
|
1638
|
+
/**
|
|
1639
|
+
* Allows deselecting an already selected option when clicked again in single-select mode.
|
|
1640
|
+
*/
|
|
1641
|
+
allowDeselect: {
|
|
1642
|
+
type: Boolean,
|
|
1643
|
+
reflect: true,
|
|
1644
|
+
},
|
|
1645
|
+
noCheckmark: {
|
|
1646
|
+
type: Boolean,
|
|
1647
|
+
reflect: true,
|
|
1648
|
+
attribute: 'nocheckmark'
|
|
1649
|
+
},
|
|
1650
|
+
disabled: {
|
|
1651
|
+
type: Boolean,
|
|
1652
|
+
reflect: true
|
|
1653
|
+
},
|
|
1654
|
+
loading: {
|
|
1655
|
+
type: Boolean,
|
|
1656
|
+
reflect: true
|
|
1657
|
+
},
|
|
1658
|
+
optionSelected: {
|
|
1659
|
+
// Allow HTMLElement, HTMLElement[] arrays and undefined
|
|
1660
|
+
type: Object
|
|
1661
|
+
},
|
|
1662
|
+
optionActive: {
|
|
1663
|
+
type: Object,
|
|
1664
|
+
attribute: 'optionactive'
|
|
1665
|
+
},
|
|
1666
|
+
matchWord: {
|
|
1667
|
+
type: String,
|
|
1668
|
+
attribute: 'matchword'
|
|
1669
|
+
},
|
|
1670
|
+
multiSelect: {
|
|
1671
|
+
type: Boolean,
|
|
1672
|
+
reflect: true,
|
|
1673
|
+
attribute: 'multiselect'
|
|
1674
|
+
},
|
|
1675
|
+
selectAllMatchingOptions: {
|
|
1676
|
+
type: Boolean,
|
|
1677
|
+
reflect: true,
|
|
1678
|
+
},
|
|
1679
|
+
|
|
1680
|
+
/**
|
|
1681
|
+
* Value selected for the component.
|
|
1682
|
+
*/
|
|
1683
|
+
value: {
|
|
1684
|
+
type: String,
|
|
1685
|
+
reflect: true,
|
|
1686
|
+
attribute: 'value'
|
|
1687
|
+
},
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* Indent level for submenus.
|
|
1691
|
+
* @private
|
|
1692
|
+
*/
|
|
1693
|
+
level: {
|
|
1694
|
+
type: Number,
|
|
1695
|
+
reflect: false,
|
|
1696
|
+
attribute: false
|
|
1697
|
+
},
|
|
1698
|
+
|
|
1699
|
+
/**
|
|
1700
|
+
* Available menu options
|
|
1701
|
+
* @readonly
|
|
1702
|
+
*/
|
|
1703
|
+
options: {
|
|
1704
|
+
type: Array,
|
|
1705
|
+
reflect: false,
|
|
1706
|
+
attribute: false
|
|
1707
|
+
}
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
static get styles() {
|
|
1712
|
+
return [
|
|
1713
|
+
styleCss$1,
|
|
1714
|
+
colorCss$1,
|
|
1715
|
+
tokensCss
|
|
1716
|
+
];
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
/**
|
|
1720
|
+
* @readonly
|
|
1721
|
+
* @returns {string} - Returns the label of the currently selected option(s).
|
|
1722
|
+
*/
|
|
1723
|
+
get currentLabel() {
|
|
1724
|
+
return this.menuService.currentLabel;
|
|
1725
|
+
};
|
|
1726
|
+
|
|
1727
|
+
/**
|
|
1728
|
+
* @readonly
|
|
1729
|
+
* @returns {Array<HTMLElement>} - Returns the array of available menu options.
|
|
1730
|
+
* @deprecated use `options` property instead.
|
|
1731
|
+
*/
|
|
1732
|
+
get items() {
|
|
1733
|
+
return this.options;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
/**
|
|
1737
|
+
* @returns {number} - Returns the index of the currently active option.
|
|
1738
|
+
*/
|
|
1739
|
+
get index() {
|
|
1740
|
+
return this._index;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* @param {number} value - Sets the index of the currently active option.
|
|
1745
|
+
*/
|
|
1746
|
+
set index(value) {
|
|
1747
|
+
this.menuService.setHighlightedIndex(value);
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
/**
|
|
1751
|
+
* This will register this element with the browser.
|
|
1752
|
+
* @param {string} [name="auro-menu"] - The name of element that you want to register to.
|
|
1753
|
+
*
|
|
1754
|
+
* @example
|
|
1755
|
+
* AuroMenu.register("custom-menu") // this will register this element to <custom-menu/>
|
|
1756
|
+
*
|
|
1757
|
+
*/
|
|
1758
|
+
static register(name = "auro-menu") {
|
|
1759
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenu);
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
/**
|
|
1763
|
+
* Formatted value based on `multiSelect` state.
|
|
1764
|
+
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
1765
|
+
* @private
|
|
1766
|
+
* @returns {String|Array<String>}
|
|
1767
|
+
*/
|
|
1768
|
+
get formattedValue() {
|
|
1769
|
+
return this.menuService.currentValue;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
/**
|
|
1773
|
+
* Gets the current property values for the menu service.
|
|
1774
|
+
* @private
|
|
1775
|
+
* @returns {Object}
|
|
1776
|
+
*/
|
|
1777
|
+
get propertyValues() {
|
|
1778
|
+
return {
|
|
1779
|
+
size: this.size,
|
|
1780
|
+
shape: this.shape,
|
|
1781
|
+
noCheckmark: this.nocheckmark,
|
|
1782
|
+
disabled: this.disabled
|
|
1783
|
+
};
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
/**
|
|
1787
|
+
* Provides the menu context to child components.
|
|
1788
|
+
* Initializes the MenuService and subscribes to menu changes.
|
|
1789
|
+
* @protected
|
|
1790
|
+
*/
|
|
1791
|
+
provideContext() {
|
|
1792
|
+
this.menuService = new MenuService({host: this});
|
|
1793
|
+
this.menuService.setProperties(this.propertyValues);
|
|
1794
|
+
this.menuService.subscribe(this.handleMenuChange.bind(this));
|
|
1795
|
+
this._contextProvider = new i$2(this, {
|
|
1796
|
+
context: MenuContext,
|
|
1797
|
+
initialValue: this.menuService
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
/**
|
|
1802
|
+
* Updates the currently active option in the menu.
|
|
1803
|
+
* @param {HTMLElement} option - The option to set as active.
|
|
1804
|
+
*/
|
|
1805
|
+
updateActiveOption(option) {
|
|
1806
|
+
this.menuService.setHighlightedOption(option);
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
/**
|
|
1810
|
+
* Sets the internal value and manages update state.
|
|
1811
|
+
* @param {String|Array<String>} value - The value to set.
|
|
1812
|
+
* @protected
|
|
1813
|
+
*/
|
|
1814
|
+
setInternalValue(value) {
|
|
1815
|
+
if (this.value !== value) {
|
|
1816
|
+
this.internalUpdateInProgress = true;
|
|
1817
|
+
this.value = value;
|
|
1818
|
+
|
|
1819
|
+
setTimeout(() => {
|
|
1820
|
+
this.internalUpdateInProgress = false;
|
|
1821
|
+
});
|
|
979
1822
|
}
|
|
1823
|
+
}
|
|
980
1824
|
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1825
|
+
/**
|
|
1826
|
+
* Handles changes from the menu service and updates component state.
|
|
1827
|
+
* @param {Object} event - The event object from the menu service.
|
|
1828
|
+
* @protected
|
|
1829
|
+
*/
|
|
1830
|
+
handleMenuChange(event) {
|
|
1831
|
+
if (event.type === 'valueChange') {
|
|
1832
|
+
|
|
1833
|
+
// New option is array value or first option with fallback to undefined for empty array in all cases
|
|
1834
|
+
const newOption = this.multiSelect && event.options.length ? event.options : event.options[0] || undefined;
|
|
1835
|
+
const newValue = event.stringValue;
|
|
1836
|
+
|
|
1837
|
+
// Check if the option or value has actually changed
|
|
1838
|
+
if (newValue === undefined || (this.optionSelected !== newOption || this.stringValue !== newValue)) {
|
|
1839
|
+
this.optionSelected = newOption;
|
|
1840
|
+
this.setInternalValue(newValue);
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
// Notify components of selection change
|
|
1844
|
+
this.notifySelectionChange(event);
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
if (event.type === 'highlightChange') {
|
|
1848
|
+
this.optionActive = event.option;
|
|
1849
|
+
this._index = event.index;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
if (event.type === 'optionsChange') {
|
|
1853
|
+
this.options = event.options;
|
|
1854
|
+
this.dispatchEvent(new CustomEvent('auroMenu-optionsChange', {
|
|
1855
|
+
detail: {
|
|
1856
|
+
options: event.options
|
|
1857
|
+
}
|
|
1858
|
+
}));
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
/**
|
|
1863
|
+
* Gets the currently selected options.
|
|
1864
|
+
* @returns {Array<HTMLElement>}
|
|
1865
|
+
*/
|
|
1866
|
+
get selectedOptions() {
|
|
1867
|
+
return this.menuService ? this.menuService.selectedOptions : [];
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
/**
|
|
1871
|
+
* Gets the first selected option, or null if none.
|
|
1872
|
+
* @returns {HTMLElement|null}
|
|
1873
|
+
*/
|
|
1874
|
+
get selectedOption() {
|
|
1875
|
+
return this.menuService ? this.menuService.selectedOptions[0] : null;
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
// Lifecycle Methods
|
|
1879
|
+
|
|
1880
|
+
connectedCallback() {
|
|
1881
|
+
super.connectedCallback();
|
|
1882
|
+
|
|
1883
|
+
this.provideContext();
|
|
1884
|
+
|
|
1885
|
+
this.addEventListener('keydown', this.handleKeyDown);
|
|
1886
|
+
this.addEventListener('auroMenuOption-click', this.handleMouseSelect);
|
|
1887
|
+
this.addEventListener('auroMenuOption-mouseover', this.handleOptionHover);
|
|
1888
|
+
this.addEventListener('slotchange', this.handleSlotChange);
|
|
1889
|
+
this.setTagAttribute("auro-menu");
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
disconnectedCallback() {
|
|
1893
|
+
this.removeEventListener('keydown', this.handleKeyDown);
|
|
1894
|
+
this.removeEventListener('auroMenuOption-click', this.handleMouseSelect);
|
|
1895
|
+
this.removeEventListener('auroMenuOption-mouseover', this.handleOptionHover);
|
|
1896
|
+
this.removeEventListener('slotchange', this.handleSlotChange);
|
|
1897
|
+
|
|
1898
|
+
super.disconnectedCallback();
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
firstUpdated() {
|
|
1902
|
+
AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-menu');
|
|
1903
|
+
|
|
1904
|
+
this.loadingSlots = this.querySelectorAll("[slot='loadingText'], [slot='loadingIcon']");
|
|
1905
|
+
this.initializeMenu();
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
|
|
1909
|
+
updated(changedProperties) {
|
|
1910
|
+
super.updated(changedProperties);
|
|
1911
|
+
|
|
1912
|
+
// Update menu service properties on host update
|
|
1913
|
+
if (changedProperties.has('value')) {
|
|
1914
|
+
this.menuService.selectByValue(this.value);
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
// Handle loading state changes
|
|
1918
|
+
if (changedProperties.has('loading')) {
|
|
1919
|
+
this.setLoadingState(this.loading);
|
|
990
1920
|
}
|
|
991
1921
|
}
|
|
992
1922
|
|
|
993
1923
|
/**
|
|
994
|
-
*
|
|
1924
|
+
* Sets an attribute that matches the default tag name if the tag name is not the default.
|
|
1925
|
+
* @param {string} tagName - The tag name to set as an attribute.
|
|
995
1926
|
* @private
|
|
996
|
-
* @param {string} direction - 'up' or 'down'.
|
|
997
1927
|
*/
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
return;
|
|
1928
|
+
setTagAttribute(tagName) {
|
|
1929
|
+
if (this.tagName.toLowerCase() !== tagName) {
|
|
1930
|
+
this.setAttribute(tagName, true);
|
|
1002
1931
|
}
|
|
1932
|
+
}
|
|
1003
1933
|
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1934
|
+
/**
|
|
1935
|
+
* Sets the loading state and dispatches a loading change event.
|
|
1936
|
+
* @param {boolean} isLoading - Whether the menu is loading.
|
|
1937
|
+
* @protected
|
|
1938
|
+
*/
|
|
1939
|
+
setLoadingState(isLoading) {
|
|
1940
|
+
this.setAttribute("aria-busy", isLoading);
|
|
1941
|
+
dispatchMenuEvent(this, "auroMenu-loadingChange", {
|
|
1942
|
+
loading: isLoading,
|
|
1943
|
+
hasLoadingPlaceholder: this.hasLoadingPlaceholder
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1009
1946
|
|
|
1010
|
-
|
|
1011
|
-
newIndex = (newIndex + increment + this.items.length) % this.items.length;
|
|
1012
|
-
iterations += 1;
|
|
1947
|
+
// Init Methods
|
|
1013
1948
|
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1949
|
+
/**
|
|
1950
|
+
* Initializes the menu's state and structure.
|
|
1951
|
+
* @private
|
|
1952
|
+
*/
|
|
1953
|
+
initializeMenu() {
|
|
1954
|
+
if (this.rootMenu) {
|
|
1955
|
+
this.setAttribute('role', 'listbox');
|
|
1956
|
+
this.setAttribute('root', '');
|
|
1957
|
+
this.handleNestedMenus(this);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
/**
|
|
1962
|
+
* Selects the currently highlighted option.
|
|
1963
|
+
* @protected
|
|
1964
|
+
*/
|
|
1965
|
+
makeSelection() {
|
|
1966
|
+
this.menuService.selectHighlightedOption();
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
/**
|
|
1970
|
+
* Resets all options to their default state.
|
|
1971
|
+
* @private
|
|
1972
|
+
*/
|
|
1973
|
+
clearSelection() {
|
|
1974
|
+
this.optionSelected = undefined;
|
|
1975
|
+
this.value = undefined;
|
|
1976
|
+
this._index = -1;
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
/**
|
|
1980
|
+
* Resets the menu to its initial state.
|
|
1981
|
+
* This is the only way to return value to undefined.
|
|
1982
|
+
* @public
|
|
1983
|
+
*/
|
|
1984
|
+
reset() {
|
|
1985
|
+
this.menuService.reset();
|
|
1986
|
+
|
|
1987
|
+
// Dispatch reset event
|
|
1988
|
+
dispatchMenuEvent(this, 'auroMenu-selectValueReset');
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
/**
|
|
1992
|
+
* Handles nested menu structure.
|
|
1993
|
+
* @private
|
|
1994
|
+
* @param {HTMLElement} menu - Root menu element.
|
|
1995
|
+
*/
|
|
1996
|
+
handleNestedMenus(menu) {
|
|
1997
|
+
menu.level = menu.parentElement.level >= 0 ? menu.parentElement.level + 1 : 0;
|
|
1998
|
+
|
|
1999
|
+
if (menu.level > 0) {
|
|
2000
|
+
menu.setAttribute('role', 'group');
|
|
2001
|
+
menu.removeAttribute("root");
|
|
2002
|
+
if (!menu.hasAttribute('aria-label')) {
|
|
2003
|
+
menu.setAttribute('aria-label', 'submenu');
|
|
1019
2004
|
}
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
const options = menu.querySelectorAll(':scope > auro-menuoption, :scope > [auro-menuoption]');
|
|
2008
|
+
options.forEach((option) => {
|
|
2009
|
+
const regex = new RegExp(this.nestingSpacer, "gu");
|
|
2010
|
+
option.innerHTML = this.nestingSpacer.repeat(menu.level) + option.innerHTML.replace(regex, '');
|
|
2011
|
+
});
|
|
2012
|
+
}
|
|
1020
2013
|
|
|
1021
|
-
|
|
1022
|
-
|
|
2014
|
+
// Event Handlers
|
|
2015
|
+
|
|
2016
|
+
/**
|
|
2017
|
+
* Handles keyboard navigation.
|
|
2018
|
+
* @private
|
|
2019
|
+
* @param {KeyboardEvent} event - Event object from the browser.
|
|
2020
|
+
*/
|
|
2021
|
+
handleKeyDown(event) {
|
|
2022
|
+
event.preventDefault();
|
|
2023
|
+
switch (event.key) {
|
|
2024
|
+
case "ArrowDown":
|
|
2025
|
+
this.menuService.highlightNext();
|
|
1023
2026
|
break;
|
|
1024
|
-
|
|
1025
|
-
|
|
2027
|
+
case "ArrowUp":
|
|
2028
|
+
this.menuService.highlightPrevious();
|
|
2029
|
+
break;
|
|
2030
|
+
case "Tab":
|
|
2031
|
+
case "Enter":
|
|
2032
|
+
this.menuService.selectHighlightedOption();
|
|
2033
|
+
break;
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
1026
2036
|
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
direction,
|
|
1038
|
-
currentIndex: this.index
|
|
1039
|
-
});
|
|
2037
|
+
/**
|
|
2038
|
+
* Navigates the menu options in the specified direction.
|
|
2039
|
+
* @param {'up'|'down'} direction - The direction to navigate.
|
|
2040
|
+
* @protected
|
|
2041
|
+
*/
|
|
2042
|
+
navigateOptions(direction) {
|
|
2043
|
+
if (direction === 'up') {
|
|
2044
|
+
this.menuService.highlightPrevious();
|
|
2045
|
+
} else if (direction === 'down') {
|
|
2046
|
+
this.menuService.highlightNext();
|
|
1040
2047
|
}
|
|
1041
2048
|
}
|
|
1042
2049
|
|
|
1043
2050
|
/**
|
|
1044
|
-
*
|
|
1045
|
-
* @
|
|
2051
|
+
* Handles slot change events.
|
|
2052
|
+
* @private
|
|
1046
2053
|
*/
|
|
1047
|
-
|
|
1048
|
-
if (
|
|
1049
|
-
|
|
2054
|
+
handleSlotChange() {
|
|
2055
|
+
if (this.parentElement && this.parentElement.closest('auro-menu, [auro-menu]')) {
|
|
2056
|
+
this.rootMenu = false;
|
|
1050
2057
|
}
|
|
1051
2058
|
|
|
1052
|
-
this.
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
this.index = index;
|
|
1056
|
-
|
|
1057
|
-
dispatchMenuEvent(this, 'auroMenu-activatedOption', this.items[index]);
|
|
2059
|
+
if (this.rootMenu) {
|
|
2060
|
+
this.initializeMenu();
|
|
2061
|
+
}
|
|
1058
2062
|
}
|
|
1059
2063
|
|
|
1060
2064
|
/**
|
|
@@ -1073,8 +2077,13 @@ class AuroMenu extends AuroElement {
|
|
|
1073
2077
|
* @param {any} source - The source that triggers this event.
|
|
1074
2078
|
* @private
|
|
1075
2079
|
*/
|
|
1076
|
-
notifySelectionChange(
|
|
1077
|
-
dispatchMenuEvent(this, 'auroMenu-selectedOption', {
|
|
2080
|
+
notifySelectionChange({value, stringValue, keys, options} = {}) {
|
|
2081
|
+
dispatchMenuEvent(this, 'auroMenu-selectedOption', {
|
|
2082
|
+
value,
|
|
2083
|
+
stringValue,
|
|
2084
|
+
keys,
|
|
2085
|
+
options
|
|
2086
|
+
});
|
|
1078
2087
|
}
|
|
1079
2088
|
|
|
1080
2089
|
/**
|
|
@@ -1147,271 +2156,6 @@ class AuroMenu extends AuroElement {
|
|
|
1147
2156
|
}
|
|
1148
2157
|
}
|
|
1149
2158
|
|
|
1150
|
-
/**
|
|
1151
|
-
* @license
|
|
1152
|
-
* Copyright 2020 Google LLC
|
|
1153
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1154
|
-
*/
|
|
1155
|
-
const a=Symbol.for(""),o$1=t=>{if(t?.r===a)return t?._$litStatic$},s=t=>({_$litStatic$:t,r:a}),i=(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}),l=new Map,n=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$1(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.get(t))&&(n.raw=n,l.set(t,r=n)),e=u;}return t(r,...e)},u$1=n(x$1);
|
|
1156
|
-
|
|
1157
|
-
var styleCss = i$5`.body-default{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);font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.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);font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{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);font-size:var(--wcss-body-sm-font-size, 0.875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.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);font-size:var(--wcss-body-xs-font-size, 0.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-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-2xs-font-size, 0.625rem);line-height:var(--wcss-body-2xs-line-height, 0.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);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);font-weight:var(--wcss-display-2xl-weight, 300);line-height:var(--wcss-display-2xl-line-height, 1.3);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem))}.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);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);font-weight:var(--wcss-display-xl-weight, 300);line-height:var(--wcss-display-xl-line-height, 1.3);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem))}.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);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);font-weight:var(--wcss-display-lg-weight, 300);line-height:var(--wcss-display-lg-line-height, 1.3);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem))}.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);letter-spacing:var(--wcss-display-md-letter-spacing, 0);font-weight:var(--wcss-display-md-weight, 300);line-height:var(--wcss-display-md-line-height, 1.3);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem))}.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);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);font-weight:var(--wcss-display-sm-weight, 300);line-height:var(--wcss-display-sm-line-height, 1.3);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem))}.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);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);font-weight:var(--wcss-display-xs-weight, 300);line-height:var(--wcss-display-xs-line-height, 1.3);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem))}.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);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);font-weight:var(--wcss-heading-xl-weight, 300);line-height:var(--wcss-heading-xl-line-height, 1.3);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem))}.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);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);font-weight:var(--wcss-heading-lg-weight, 300);line-height:var(--wcss-heading-lg-line-height, 1.3);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem))}.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);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);font-weight:var(--wcss-heading-md-weight, 300);line-height:var(--wcss-heading-md-line-height, 1.3);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem))}.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);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);font-weight:var(--wcss-heading-sm-weight, 300);line-height:var(--wcss-heading-sm-line-height, 1.3);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem))}.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);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);font-weight:var(--wcss-heading-xs-weight, 450);line-height:var(--wcss-heading-xs-line-height, 1.3);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem))}.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);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);font-weight:var(--wcss-heading-2xs-weight, 450);line-height:var(--wcss-heading-2xs-line-height, 1.3);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem))}.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);letter-spacing:var(--wcss-accent-2xl-letter-spacing, 0.05em);font-weight:var(--wcss-accent-2xl-weight, 450);line-height:var(--wcss-accent-2xl-line-height, 1);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));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);letter-spacing:var(--wcss-accent-xl-letter-spacing, 0.05em);font-weight:var(--wcss-accent-xl-weight, 450);line-height:var(--wcss-accent-xl-line-height, 1.3);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));text-transform:uppercase}.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);letter-spacing:var(--wcss-accent-lg-letter-spacing, 0.05em);font-weight:var(--wcss-accent-lg-weight, 450);line-height:var(--wcss-accent-lg-line-height, 1.3);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));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);letter-spacing:var(--wcss-accent-md-letter-spacing, 0.05em);font-weight:var(--wcss-accent-md-weight, 500);line-height:var(--wcss-accent-md-line-height, 1.3);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));text-transform:uppercase}.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);letter-spacing:var(--wcss-accent-sm-letter-spacing, 0.05em);font-weight:var(--wcss-accent-sm-weight, 500);line-height:var(--wcss-accent-sm-line-height, 1.3);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));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);letter-spacing:var(--wcss-accent-xs-letter-spacing, 0.1em);font-weight:var(--wcss-accent-xs-weight, 500);line-height:var(--wcss-accent-xs-line-height, 1.3);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));text-transform:uppercase}.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);letter-spacing:var(--wcss-accent-2xs-letter-spacing, 0.1em);font-weight:var(--wcss-accent-2xs-weight, 450);line-height:var(--wcss-accent-2xs-line-height, 1.3);font-size:var(--wcss-accent-2xs-font-size, clamp(0.875rem, 1.1666666667vw, 0.875rem));text-transform:uppercase}:host{cursor:pointer;user-select:none;text-overflow:ellipsis;max-width:100dvw}:host .wrapper{display:flex;align-items:center;padding-right:var(--ds-size-200, 1rem);padding-left:calc(var(--ds-size-150, 0.75rem) + var(--ds-size-300, 1.5rem) + var(--ds-size-100, 0.5rem));padding-top:var(--ds-size-50, 0.25rem);padding-bottom:var(--ds-size-50, 0.25rem);border-radius:var(--ds-size-100, 0.5rem);-webkit-tap-highlight-color:transparent}:host .wrapper[class*=shape-box]{border-radius:unset}:host .wrapper[class*=shape-snowflake]{border-radius:unset;line-height:24px}:host .wrapper[class*=shape-pill]{border-radius:30px}:host .wrapper[class*=-lg]{padding-top:var(--ds-size-75, 0.375rem);padding-bottom:var(--ds-size-75, 0.375rem);padding-right:var(--ds-size-150, 0.75rem);line-height:26px}:host .wrapper[class*=-xl]{padding-top:var(--ds-size-100, 0.5rem);padding-bottom:var(--ds-size-100, 0.5rem);padding-right:var(--ds-size-200, 1rem);line-height:26px}:host slot{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host [auro-icon]{--ds-auro-icon-size: var(--ds-size-300, 1.5rem);margin-right:var(--ds-size-150, 0.75rem);margin-left:var(--ds-size-100, 0.5rem)}:host ::slotted(.nestingSpacer){display:inline-block;width:var(--ds-size-300, 1.5rem)}[slot=displayValue]{display:none}:host([loadingplaceholder]) .wrapper{padding-left:calc(var(--ds-size-150, 0.75rem) + var(--ds-size-300, 1.5rem) + var(--ds-size-100, 0.5rem))}:host([selected]) .wrapper{padding-left:0}:host([nocheckmark]) .wrapper{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-lg]{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-xl]{padding-left:var(--ds-size-200, 1rem)}:host([hidden]){display:none}:host([static]){pointer-events:none}:host([disabled]:hover){cursor:auto}:host([disabled]){user-select:none;pointer-events:none}`;
|
|
1158
|
-
|
|
1159
|
-
var colorCss = i$5`:host .wrapper{background-color:var(--ds-auro-menuoption-container-color, transparent);box-shadow:inset 0 0 0 1px var(--ds-auro-menuoption-container-border-color, transparent);color:var(--ds-auro-menuoption-text-color)}:host svg{fill:var(--ds-auro-menuoption-icon-color)}:host([disabled]){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0);--ds-auro-menuoption-icon-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:hover),:host(.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd)}:host(:focus){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}:host([selected]){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-subtle, #b4eff9);--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-menuoption-icon-color: var(--ds-basic-color-texticon-default, #2a2a2a)}:host([selected]:hover),:host([selected].active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd)}:host([selected]:focus){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-subtle, #b4eff9);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}:host(:focus:hover),:host(:focus.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}:host([selected]:focus:hover),:host([selected]:focus.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}`;
|
|
1160
|
-
|
|
1161
|
-
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
1162
|
-
// See LICENSE in the project root for license information.
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
class AuroDependencyVersioning {
|
|
1166
|
-
|
|
1167
|
-
/**
|
|
1168
|
-
* Generates a unique string to be used for child auro element naming.
|
|
1169
|
-
* @private
|
|
1170
|
-
* @param {string} baseName - Defines the first part of the unique element name.
|
|
1171
|
-
* @param {string} version - Version of the component that will be appended to the baseName.
|
|
1172
|
-
* @returns {string} - Unique string to be used for naming.
|
|
1173
|
-
*/
|
|
1174
|
-
generateElementName(baseName, version) {
|
|
1175
|
-
let result = baseName;
|
|
1176
|
-
|
|
1177
|
-
result += '-';
|
|
1178
|
-
result += version.replace(/[.]/g, '_');
|
|
1179
|
-
|
|
1180
|
-
return result;
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
/**
|
|
1184
|
-
* Generates a unique string to be used for child auro element naming.
|
|
1185
|
-
* @param {string} baseName - Defines the first part of the unique element name.
|
|
1186
|
-
* @param {string} version - Version of the component that will be appended to the baseName.
|
|
1187
|
-
* @returns {string} - Unique string to be used for naming.
|
|
1188
|
-
*/
|
|
1189
|
-
generateTag(baseName, version, tagClass) {
|
|
1190
|
-
const elementName = this.generateElementName(baseName, version);
|
|
1191
|
-
const tag = i`${s(elementName)}`;
|
|
1192
|
-
|
|
1193
|
-
if (!customElements.get(elementName)) {
|
|
1194
|
-
customElements.define(elementName, class extends tagClass {});
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
return tag;
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
/**
|
|
1202
|
-
* @license
|
|
1203
|
-
* Copyright 2018 Google LLC
|
|
1204
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1205
|
-
*/const o=o=>o??E;
|
|
1206
|
-
|
|
1207
|
-
class p{registerComponent(t,a){customElements.get(t)||customElements.define(t,class extends a{});}closestElement(t,a=this,e=(a,s=a&&a.closest(t))=>a&&a!==document&&a!==window?s||e(a.getRootNode().host):null){return e(a)}handleComponentTagRename(t,a){const e=a.toLowerCase();t.tagName.toLowerCase()!==e&&t.setAttribute(e,true);}elementMatch(t,a){const e=a.toLowerCase();return t.tagName.toLowerCase()===e||t.hasAttribute(e)}}var u='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-labelledby="error__desc" class="ico_squareLarge" data-deprecated="true" role="img" style="min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor" viewBox="0 0 24 24" part="svg"><title/><desc id="error__desc">Error alert indicator.</desc><path d="m13.047 5.599 6.786 11.586A1.207 1.207 0 0 1 18.786 19H5.214a1.207 1.207 0 0 1-1.047-1.815l6.786-11.586a1.214 1.214 0 0 1 2.094 0m-1.165.87a.23.23 0 0 0-.085.085L5.419 17.442a.232.232 0 0 0 .203.35h12.756a.234.234 0 0 0 .203-.35L12.203 6.554a.236.236 0 0 0-.321-.084M12 15.5a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5m-.024-6.22c.325 0 .589.261.589.583v4.434a.586.586 0 0 1-.589.583.586.586 0 0 1-.588-.583V9.863c0-.322.264-.583.588-.583"/></svg>';class m extends i$2{static get properties(){return {hidden:{type:Boolean,reflect:true},hiddenVisually:{type:Boolean,reflect:true},hiddenAudible:{type:Boolean,reflect:true}}}hideAudible(t){return t?"true":"false"}}const g=new Map,f=(t,a={})=>{const e=a.responseParser||(t=>t.text());return g.has(t)||g.set(t,fetch(t).then(e)),g.get(t)};var w=i$5`:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px,1px,1px,1px);width:1px;height:1px;padding:0;border:0}.ico_squareLarge{fill:currentColor;height:var(--auro-size-lg, var(--ds-size-300, 1.5rem))}.ico_squareSmall{fill:currentColor;height:.6rem}.ico_squareMed{fill:currentColor;height:var(--auro-size-md, var(--ds-size-200, 1rem))}.ico_squareSml{fill:currentColor;height:var(--auro-size-sm, var(--ds-size-150, .75rem))}:host{color:currentColor;vertical-align:middle;line-height:1;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}.svgWrapper{height:var(--ds-auro-icon-size);width:var(--ds-auro-icon-size)}.labelWrapper{margin-left:var(--ds-size-50, .25rem);line-height:1.8}
|
|
1208
|
-
`;class z extends m{constructor(){super(),this.onDark=false,this.appearance="default";}static get properties(){return {...m.properties,onDark:{type:Boolean,reflect:true},appearance:{type:String,reflect:true},svg:{attribute:false,reflect:true}}}static get styles(){return w}async fetchIcon(t,a){let e="";e="logos"===t?await f(`${this.uri}/${t}/${a}.svg`):await f(`${this.uri}/icons/${t}/${a}.svg`);return (new DOMParser).parseFromString(e,"text/html").body.querySelector("svg")}async firstUpdated(){try{if(!this.customSvg){const t=await this.fetchIcon(this.category,this.name);if(t)this.svg=t;else if(!t){const t=(new DOMParser).parseFromString(u,"text/html");this.svg=t.body.firstChild;}}}catch(t){this.svg=void 0;}}}i$5`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px,1px,1px,1px);width:1px;height:1px;padding:0;border:0}:host{display:inline-block;--ds-auro-icon-size: 100%;width:100%;height:100%}:host .logo{color:var(--ds-auro-alaska-color)}:host([onDark]),:host([appearance=inverse]){--ds-auro-alaska-color: #FFF}
|
|
1209
|
-
`;var y=i$5`:host{--ds-auro-icon-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-alaska-color: #02426D;--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}
|
|
1210
|
-
`;var k=i$5`:host{color:var(--ds-auro-icon-color)}:host([customColor]){color:inherit}:host(:not([onDark])[variant=accent1]),:host(:not([appearance=inverse])[variant=accent1]){--ds-auro-icon-color: var(--ds-basic-color-texticon-accent1, #265688)}:host(:not([onDark])[variant=disabled]),:host(:not([appearance=inverse])[variant=disabled]){--ds-auro-icon-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:not([onDark])[variant=muted]),:host(:not([appearance=inverse])[variant=muted]){--ds-auro-icon-color: var(--ds-basic-color-texticon-muted, #676767)}:host(:not([onDark])[variant=statusDefault]),:host(:not([appearance=inverse])[variant=statusDefault]){--ds-auro-icon-color: var(--ds-basic-color-status-default, #afb9c6)}:host(:not([onDark])[variant=statusInfo]),:host(:not([appearance=inverse])[variant=statusInfo]){--ds-auro-icon-color: var(--ds-basic-color-status-info, #01426a)}:host(:not([onDark])[variant=statusSuccess]),:host(:not([appearance=inverse])[variant=statusSuccess]){--ds-auro-icon-color: var(--ds-basic-color-status-success, #447a1f)}:host(:not([onDark])[variant=statusWarning]),:host(:not([appearance=inverse])[variant=statusWarning]){--ds-auro-icon-color: var(--ds-basic-color-status-warning, #fac200)}:host(:not([onDark])[variant=statusError]),:host(:not([appearance=inverse])[variant=statusError]){--ds-auro-icon-color: var(--ds-basic-color-status-error, #e31f26)}:host(:not([onDark])[variant=statusInfoSubtle]),:host(:not([appearance=inverse])[variant=statusInfoSubtle]){--ds-auro-icon-color: var(--ds-basic-color-status-info-subtle, #ebf3f9)}:host(:not([onDark])[variant=statusSuccessSubtle]),:host(:not([appearance=inverse])[variant=statusSuccessSubtle]){--ds-auro-icon-color: var(--ds-basic-color-status-success-subtle, #d6eac7)}:host(:not([onDark])[variant=statusWarningSubtle]),:host(:not([appearance=inverse])[variant=statusWarningSubtle]){--ds-auro-icon-color: var(--ds-basic-color-status-warning-subtle, #fff0b2)}:host(:not([onDark])[variant=statusErrorSubtle]),:host(:not([appearance=inverse])[variant=statusErrorSubtle]){--ds-auro-icon-color: var(--ds-basic-color-status-error-subtle, #fbc6c6)}:host(:not([onDark])[variant=fareBasicEconomy]),:host(:not([appearance=inverse])[variant=fareBasicEconomy]){--ds-auro-icon-color: var(--ds-basic-color-fare-basiceconomy, #97eaf8)}:host(:not([onDark])[variant=fareBusiness]),:host(:not([appearance=inverse])[variant=fareBusiness]){--ds-auro-icon-color: var(--ds-basic-color-fare-business, #01426a)}:host(:not([onDark])[variant=fareEconomy]),:host(:not([appearance=inverse])[variant=fareEconomy]){--ds-auro-icon-color: var(--ds-basic-color-fare-economy, #0074ca)}:host(:not([onDark])[variant=fareFirst]),:host(:not([appearance=inverse])[variant=fareFirst]){--ds-auro-icon-color: var(--ds-basic-color-fare-first, #00274a)}:host(:not([onDark])[variant=farePremiumEconomy]),:host(:not([appearance=inverse])[variant=farePremiumEconomy]){--ds-auro-icon-color: var(--ds-basic-color-fare-premiumeconomy, #005154)}:host(:not([onDark])[variant=tierOneWorldEmerald]),:host(:not([appearance=inverse])[variant=tierOneWorldEmerald]){--ds-auro-icon-color: var(--ds-basic-color-tier-program-oneworld-emerald, #139142)}:host(:not([onDark])[variant=tierOneWorldSapphire]),:host(:not([appearance=inverse])[variant=tierOneWorldSapphire]){--ds-auro-icon-color: var(--ds-basic-color-tier-program-oneworld-sapphire, #015daa)}:host(:not([onDark])[variant=tierOneWorldRuby]),:host(:not([appearance=inverse])[variant=tierOneWorldRuby]){--ds-auro-icon-color: var(--ds-basic-color-tier-program-oneworld-ruby, #a41d4a)}:host([onDark]),:host([appearance=inverse]){--ds-auro-icon-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][variant=disabled]),:host([appearance=inverse][variant=disabled]){--ds-auro-icon-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([onDark][variant=muted]),:host([appearance=inverse][variant=muted]){--ds-auro-icon-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][variant=statusError]),:host([appearance=inverse][variant=statusError]){--ds-auro-icon-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}
|
|
1211
|
-
`;class x extends z{constructor(){super(),this.variant=void 0,this.privateDefaults();}privateDefaults(){this.uri="https://cdn.jsdelivr.net/npm/@alaskaairux/icons@latest/dist",this.runtimeUtils=new p;}static get properties(){return {...z.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 [z.styles,y,w,k]}static register(t="auro-icon"){p.prototype.registerComponent(t,x);}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`
|
|
1212
|
-
<div class="componentWrapper">
|
|
1213
|
-
<div
|
|
1214
|
-
class="${e({svgWrapper:true})}"
|
|
1215
|
-
title="${o(this.title||void 0)}">
|
|
1216
|
-
<span aria-hidden="${o(this.ariaHidden||true)}" part="svg">
|
|
1217
|
-
${this.customSvg?x$1`
|
|
1218
|
-
<slot name="svg"></slot>
|
|
1219
|
-
`:x$1`
|
|
1220
|
-
${this.svg}
|
|
1221
|
-
`}
|
|
1222
|
-
</span>
|
|
1223
|
-
</div>
|
|
1224
|
-
|
|
1225
|
-
<div class="${e(t)}" part="label">
|
|
1226
|
-
<slot></slot>
|
|
1227
|
-
</div>
|
|
1228
|
-
</div>
|
|
1229
|
-
`}}
|
|
1230
|
-
|
|
1231
|
-
var iconVersion = '9.1.0';
|
|
1232
|
-
|
|
1233
|
-
var checkmarkIcon = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"checkmark-sm__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"checkmark-sm__desc\">a small check mark.</desc><path d=\"M8.461 11.84a.625.625 0 1 0-.922.844l2.504 2.738c.247.27.674.27.922 0l5.496-6a.625.625 0 1 0-.922-.844l-5.035 5.496z\"/></svg>"};
|
|
1234
|
-
|
|
1235
|
-
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
1236
|
-
// See LICENSE in the project root for license information.
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
/**
|
|
1240
|
-
* The auro-menu element provides users a way to define a menu option.
|
|
1241
|
-
*
|
|
1242
|
-
* @attr {String} value - Specifies the value to be sent to a server.
|
|
1243
|
-
* @attr {String} noCheckmark - When true, selected option will not show the checkmark.
|
|
1244
|
-
* @attr {Boolean} disabled - When true specifies that the menuoption is disabled.
|
|
1245
|
-
* @attr {Boolean} selected - Specifies that an option is selected.
|
|
1246
|
-
* @event auroMenuOption-mouseover - Notifies that this option has been hovered over.
|
|
1247
|
-
* @slot - Specifies text for an option, but is not the value.
|
|
1248
|
-
*/
|
|
1249
|
-
class AuroMenuOption extends AuroElement {
|
|
1250
|
-
constructor() {
|
|
1251
|
-
super();
|
|
1252
|
-
|
|
1253
|
-
/**
|
|
1254
|
-
* @private
|
|
1255
|
-
*/
|
|
1256
|
-
this.shape = undefined;
|
|
1257
|
-
|
|
1258
|
-
/**
|
|
1259
|
-
* @private
|
|
1260
|
-
*/
|
|
1261
|
-
this.size = undefined;
|
|
1262
|
-
|
|
1263
|
-
/**
|
|
1264
|
-
* Generate unique names for dependency components.
|
|
1265
|
-
*/
|
|
1266
|
-
const versioning = new AuroDependencyVersioning();
|
|
1267
|
-
this.iconTag = versioning.generateTag('auro-formkit-menuoption-icon', iconVersion, x);
|
|
1268
|
-
|
|
1269
|
-
this.selected = false;
|
|
1270
|
-
this.nocheckmark = false;
|
|
1271
|
-
this.disabled = false;
|
|
1272
|
-
|
|
1273
|
-
/**
|
|
1274
|
-
* @private
|
|
1275
|
-
*/
|
|
1276
|
-
this.tabIndex = -1;
|
|
1277
|
-
|
|
1278
|
-
/**
|
|
1279
|
-
* @private
|
|
1280
|
-
*/
|
|
1281
|
-
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
static get properties() {
|
|
1285
|
-
return {
|
|
1286
|
-
...super.properties,
|
|
1287
|
-
nocheckmark: {
|
|
1288
|
-
type: Boolean,
|
|
1289
|
-
reflect: true
|
|
1290
|
-
},
|
|
1291
|
-
selected: {
|
|
1292
|
-
type: Boolean,
|
|
1293
|
-
reflect: true
|
|
1294
|
-
},
|
|
1295
|
-
disabled: {
|
|
1296
|
-
type: Boolean,
|
|
1297
|
-
reflect: true
|
|
1298
|
-
},
|
|
1299
|
-
value: {
|
|
1300
|
-
type: String,
|
|
1301
|
-
reflect: true
|
|
1302
|
-
},
|
|
1303
|
-
tabIndex: {
|
|
1304
|
-
type: Number,
|
|
1305
|
-
reflect: true
|
|
1306
|
-
}
|
|
1307
|
-
};
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
static get styles() {
|
|
1311
|
-
return [
|
|
1312
|
-
styleCss,
|
|
1313
|
-
colorCss,
|
|
1314
|
-
tokensCss
|
|
1315
|
-
];
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
/**
|
|
1319
|
-
* This will register this element with the browser.
|
|
1320
|
-
* @param {string} [name="auro-menuoption"] - The name of element that you want to register to.
|
|
1321
|
-
*
|
|
1322
|
-
* @example
|
|
1323
|
-
* AuroMenuOption.register("custom-menuoption") // this will register this element to <custom-menuoption/>
|
|
1324
|
-
*
|
|
1325
|
-
*/
|
|
1326
|
-
static register(name = "auro-menuoption") {
|
|
1327
|
-
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenuOption);
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
connectedCallback() {
|
|
1331
|
-
super.connectedCallback();
|
|
1332
|
-
|
|
1333
|
-
// Add the tag name as an attribute if it is different than the component name
|
|
1334
|
-
// Add this step soon as this node gets attached to the DOM to avoid racing condition with menu's value setting logic.
|
|
1335
|
-
this.runtimeUtils.handleComponentTagRename(this, 'auro-menuoption');
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
firstUpdated() {
|
|
1339
|
-
if (!this.hasAttribute('size')) {
|
|
1340
|
-
this.size = this.parentElement.getAttribute('size') || 'sm';
|
|
1341
|
-
}
|
|
1342
|
-
if (!this.hasAttribute('shape')) {
|
|
1343
|
-
this.shape = this.parentElement.getAttribute('shape') || 'box';
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
this.setAttribute('role', 'option');
|
|
1347
|
-
this.setAttribute('aria-selected', 'false');
|
|
1348
|
-
|
|
1349
|
-
this.addEventListener('mouseover', () => {
|
|
1350
|
-
this.dispatchEvent(new CustomEvent('auroMenuOption-mouseover', {
|
|
1351
|
-
bubbles: true,
|
|
1352
|
-
cancelable: false,
|
|
1353
|
-
composed: true,
|
|
1354
|
-
detail: this
|
|
1355
|
-
}));
|
|
1356
|
-
});
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
// observer for selected property changes
|
|
1360
|
-
updated(changedProperties) {
|
|
1361
|
-
super.updated(changedProperties);
|
|
1362
|
-
|
|
1363
|
-
if (changedProperties.has('selected')) {
|
|
1364
|
-
this.setAttribute('aria-selected', this.selected.toString());
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
/**
|
|
1369
|
-
* Generates an HTML element containing an SVG icon based on the provided `svgContent`.
|
|
1370
|
-
*
|
|
1371
|
-
* @private
|
|
1372
|
-
* @param {string} svgContent - The SVG content to be embedded.
|
|
1373
|
-
* @returns {Element} The HTML element containing the SVG icon.
|
|
1374
|
-
*/
|
|
1375
|
-
generateIconHtml(svgContent) {
|
|
1376
|
-
const dom = new DOMParser().parseFromString(svgContent, 'text/html');
|
|
1377
|
-
const svg = dom.body.firstChild;
|
|
1378
|
-
|
|
1379
|
-
svg.setAttribute('slot', 'svg');
|
|
1380
|
-
|
|
1381
|
-
return u$1`<${this.iconTag} customColor customSvg>${svg}</${this.iconTag}>`;
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
/**
|
|
1385
|
-
* Logic to determine the layout of the component.
|
|
1386
|
-
* @protected
|
|
1387
|
-
* @returns {void}
|
|
1388
|
-
*/
|
|
1389
|
-
renderLayout() {
|
|
1390
|
-
|
|
1391
|
-
const fontClassMap = {
|
|
1392
|
-
xs: 'body-sm',
|
|
1393
|
-
sm: 'body-default',
|
|
1394
|
-
md: 'body-default',
|
|
1395
|
-
lg: 'body-lg',
|
|
1396
|
-
xl: 'body-lg'
|
|
1397
|
-
};
|
|
1398
|
-
|
|
1399
|
-
const classes = e({
|
|
1400
|
-
'wrapper': true,
|
|
1401
|
-
[this.size ? fontClassMap[this.size] : 'body-sm']: true,
|
|
1402
|
-
});
|
|
1403
|
-
|
|
1404
|
-
return u$1`
|
|
1405
|
-
<div class="${classes}">
|
|
1406
|
-
${this.selected && !this.nocheckmark
|
|
1407
|
-
? this.generateIconHtml(checkmarkIcon.svg)
|
|
1408
|
-
: undefined}
|
|
1409
|
-
<slot></slot>
|
|
1410
|
-
</div>
|
|
1411
|
-
`;
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
2159
|
AuroMenu.register();
|
|
1416
2160
|
AuroMenuOption.register();
|
|
1417
2161
|
|
|
@@ -1427,6 +2171,8 @@ function initExamples(initCount) {
|
|
|
1427
2171
|
auroMenuMatchWordExample();
|
|
1428
2172
|
auroMenuCustomEventExample();
|
|
1429
2173
|
auroMenuLoadingExample();
|
|
2174
|
+
initSelectAllMatchingOptionsExample();
|
|
2175
|
+
initKeysExample();
|
|
1430
2176
|
} catch (err) {
|
|
1431
2177
|
if (initCount <= 20) {
|
|
1432
2178
|
// setTimeout handles issue where content is sometimes loaded after the functions get called
|