@aurodesignsystem/auro-formkit 5.10.0 → 5.11.0
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 +55 -15
- package/components/bibtemplate/dist/auro-bibtemplate.d.ts +6 -0
- package/components/bibtemplate/dist/index.js +12 -0
- package/components/bibtemplate/dist/registered.js +12 -0
- package/components/checkbox/demo/api.min.js +3 -3
- package/components/checkbox/demo/index.min.js +3 -3
- package/components/checkbox/dist/index.js +3 -3
- package/components/checkbox/dist/registered.js +3 -3
- package/components/combobox/demo/api.min.js +1140 -305
- package/components/combobox/demo/index.min.js +1140 -305
- package/components/combobox/dist/auro-combobox.d.ts +24 -1
- package/components/combobox/dist/comboboxKeyboardStrategy.d.ts +6 -0
- package/components/combobox/dist/index.js +1082 -264
- package/components/combobox/dist/registered.js +1082 -264
- package/components/counter/demo/api.min.js +583 -172
- package/components/counter/demo/index.min.js +583 -172
- package/components/counter/dist/auro-counter.d.ts +8 -0
- package/components/counter/dist/buttonVersion.d.ts +1 -1
- package/components/counter/dist/iconVersion.d.ts +1 -1
- package/components/counter/dist/index.js +583 -172
- package/components/counter/dist/registered.js +583 -172
- package/components/datepicker/demo/api.md +108 -85
- package/components/datepicker/demo/api.min.js +872 -257
- package/components/datepicker/demo/index.md +18 -12
- package/components/datepicker/demo/index.min.js +872 -257
- package/components/datepicker/dist/auro-calendar.d.ts +6 -0
- package/components/datepicker/dist/auro-datepicker.d.ts +11 -1
- package/components/datepicker/dist/index.js +819 -208
- package/components/datepicker/dist/registered.js +819 -208
- package/components/dropdown/demo/api.md +15 -17
- package/components/dropdown/demo/api.min.js +537 -183
- package/components/dropdown/demo/index.min.js +537 -183
- package/components/dropdown/dist/auro-dropdown.d.ts +27 -1
- package/components/dropdown/dist/auro-dropdownBib.d.ts +87 -0
- package/components/dropdown/dist/index.js +514 -160
- package/components/dropdown/dist/keyboardUtils.d.ts +18 -0
- package/components/dropdown/dist/registered.js +514 -160
- package/components/form/README.md +47 -2
- package/components/form/demo/api.js +2 -0
- package/components/form/demo/api.md +303 -30
- package/components/form/demo/api.min.js +69256 -62
- package/components/form/demo/index.html +0 -1
- package/components/form/demo/index.js +1 -0
- package/components/form/demo/index.md +1 -275
- package/components/form/demo/index.min.js +69255 -62
- package/components/form/demo/readme.md +47 -2
- package/components/form/demo/working.html +123 -32
- package/components/form/dist/auro-form.d.ts +98 -61
- package/components/form/dist/index.js +135 -51
- package/components/form/dist/registered.js +135 -51
- package/components/input/demo/api.md +1 -0
- package/components/input/demo/api.min.js +78 -24
- package/components/input/demo/index.min.js +78 -24
- package/components/input/dist/base-input.d.ts +34 -0
- package/components/input/dist/index.js +78 -24
- package/components/input/dist/registered.js +78 -24
- package/components/menu/demo/api.md +4 -10
- package/components/menu/demo/api.min.js +18 -5
- package/components/menu/demo/index.min.js +18 -5
- package/components/menu/dist/auro-menuoption.d.ts +0 -8
- package/components/menu/dist/iconVersion.d.ts +1 -1
- package/components/menu/dist/index.js +18 -5
- package/components/menu/dist/registered.js +18 -5
- package/components/radio/demo/api.min.js +3 -3
- package/components/radio/demo/index.min.js +3 -3
- package/components/radio/dist/index.js +3 -3
- package/components/radio/dist/registered.js +3 -3
- package/components/select/demo/api.js +2 -0
- package/components/select/demo/api.md +333 -78
- package/components/select/demo/api.min.js +945 -282
- package/components/select/demo/index.min.js +933 -282
- package/components/select/dist/auro-select.d.ts +26 -0
- package/components/select/dist/index.js +881 -247
- package/components/select/dist/registered.js +881 -247
- package/components/select/dist/selectKeyboardStrategy.d.ts +8 -0
- package/custom-elements.json +596 -89
- package/package.json +7 -5
|
@@ -112,42 +112,23 @@ const t$1={ATTRIBUTE:1,CHILD:2},e$4=t=>(...e)=>({_$litDirective$:t,values:e});le
|
|
|
112
112
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
113
113
|
*/const e$3=e$4(class extends i$3{constructor(t){if(super(t),t.type!==t$1.ATTRIBUTE||"class"!==t.name||t.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 E}});
|
|
114
114
|
|
|
115
|
-
/**
|
|
116
|
-
* @license
|
|
117
|
-
* Copyright 2019 Google LLC
|
|
118
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
119
|
-
*/
|
|
120
|
-
const t=globalThis,e$2=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$5=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$2)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$2&&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$3=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),i$2=(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$3(o,t,s$2)},S=(s,o)=>{if(e$2)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$2?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$3(e)})(t):t;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* @license
|
|
124
|
-
* Copyright 2017 Google LLC
|
|
125
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
126
|
-
*/const{is:i$1,defineProperty:e$1,getOwnPropertyDescriptor:h$2,getOwnPropertyNames:r$2,getOwnPropertySymbols:o$4,getPrototypeOf:n$2}=Object,a=globalThis,c$1=a.trustedTypes,l=c$1?c$1.emptyScript:"",p$1=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l: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$1(t,s),b={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$2};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;let y$1 = 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$1(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$2(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("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d("properties"))){const t=this.properties,s=[...r$2(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(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$1).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$1;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,e=false,h){if(void 0!==t){const r=this.constructor;if(false===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f$2)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$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$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d("elementProperties")]=new Map,y$1[d("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a.reactiveElementVersions??=[]).push("2.1.2");
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* @license
|
|
130
|
-
* Copyright 2017 Google LLC
|
|
131
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
132
|
-
*/const s$1=globalThis;class i extends y$1{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=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}}i._$litElement$=true,i["finalized"]=true,s$1.litElementHydrateSupport?.({LitElement:i});const o$3=s$1.litElementPolyfillSupport;o$3?.({LitElement:i});(s$1.litElementVersions??=[]).push("4.2.2");
|
|
133
|
-
|
|
134
115
|
/**
|
|
135
116
|
* @license
|
|
136
117
|
* Copyright 2020 Google LLC
|
|
137
118
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
138
|
-
*/const r$
|
|
119
|
+
*/const r$3=o=>void 0===o.strings;
|
|
139
120
|
|
|
140
121
|
/**
|
|
141
122
|
* @license
|
|
142
123
|
* Copyright 2017 Google LLC
|
|
143
124
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
144
|
-
*/const s=(i,t)=>{const e=i._$AN;if(void 0===e)return false;for(const i of e)i._$AO?.(t,false),s(i,t);return true},o$
|
|
125
|
+
*/const s$2=(i,t)=>{const e=i._$AN;if(void 0===e)return false;for(const i of e)i._$AO?.(t,false),s$2(i,t);return true},o$5=i=>{let t,e;do{if(void 0===(t=i._$AM))break;e=t._$AN,e.delete(i),i=t;}while(0===e?.size)},r$2=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(void 0===e)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),c$2(t);}};function h$2(i){ void 0!==this._$AN?(o$5(this),this._$AM=i,r$2(this)):this._$AM=i;}function n$3(i,t=false,e=0){const r=this._$AH,h=this._$AN;if(void 0!==h&&0!==h.size)if(t)if(Array.isArray(r))for(let i=e;i<r.length;i++)s$2(r[i],false),o$5(r[i]);else null!=r&&(s$2(r,false),o$5(r));else s$2(this,i);}const c$2=i=>{i.type==t$1.CHILD&&(i._$AP??=n$3,i._$AQ??=h$2);};let f$2 = class f extends i$3{constructor(){super(...arguments),this._$AN=void 0;}_$AT(i,t,e){super._$AT(i,t,e),r$2(this),this.isConnected=i._$AU;}_$AO(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(s$2(this,i),o$5(this));}setValue(t){if(r$3(this._$Ct))this._$Ct._$AI(t,this);else {const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0);}}disconnected(){}reconnected(){}};
|
|
145
126
|
|
|
146
127
|
/**
|
|
147
128
|
* @license
|
|
148
129
|
* Copyright 2020 Google LLC
|
|
149
130
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
150
|
-
*/const e=()=>new h;class h{}const o$
|
|
131
|
+
*/const e$2=()=>new h$1;let h$1 = class h{};const o$4=new WeakMap,n$2=e$4(class extends f$2{render(i){return A}update(i,[s]){const e=s!==this.G;return e&&void 0!==this.G&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=s,this.ht=i.options?.host,this.rt(this.ct=i.element)),A}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.G){const i=this.ht??globalThis;let s=o$4.get(i);void 0===s&&(s=new WeakMap,o$4.set(i,s)),void 0!==s.get(this.G)&&this.G.call(this.ht,void 0),s.set(this.G,t),void 0!==t&&this.G.call(this.ht,t);}else this.G.value=t;}get lt(){return "function"==typeof this.G?o$4.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});
|
|
151
132
|
|
|
152
133
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
153
134
|
// See LICENSE in the project root for license information.
|
|
@@ -1876,11 +1857,9 @@ const computePosition = (reference, floating, options) => {
|
|
|
1876
1857
|
/* eslint-disable line-comment-position, no-inline-comments */
|
|
1877
1858
|
|
|
1878
1859
|
|
|
1879
|
-
|
|
1880
1860
|
const MAX_CONFIGURATION_COUNT = 10;
|
|
1881
1861
|
|
|
1882
1862
|
class AuroFloatingUI {
|
|
1883
|
-
|
|
1884
1863
|
/**
|
|
1885
1864
|
* @private
|
|
1886
1865
|
*/
|
|
@@ -1895,7 +1874,11 @@ class AuroFloatingUI {
|
|
|
1895
1874
|
* @private
|
|
1896
1875
|
*/
|
|
1897
1876
|
static setupMousePressChecker() {
|
|
1898
|
-
if (
|
|
1877
|
+
if (
|
|
1878
|
+
!AuroFloatingUI.isMousePressHandlerInitialized &&
|
|
1879
|
+
window &&
|
|
1880
|
+
window.addEventListener
|
|
1881
|
+
) {
|
|
1899
1882
|
AuroFloatingUI.isMousePressHandlerInitialized = true;
|
|
1900
1883
|
|
|
1901
1884
|
// Track timeout for isMousePressed reset to avoid race conditions
|
|
@@ -1903,7 +1886,7 @@ class AuroFloatingUI {
|
|
|
1903
1886
|
AuroFloatingUI._mousePressedTimeout = null;
|
|
1904
1887
|
}
|
|
1905
1888
|
const mouseEventGlobalHandler = (event) => {
|
|
1906
|
-
const isPressed = event.type ===
|
|
1889
|
+
const isPressed = event.type === "mousedown";
|
|
1907
1890
|
if (isPressed) {
|
|
1908
1891
|
// Clear any pending timeout to prevent race condition
|
|
1909
1892
|
if (AuroFloatingUI._mousePressedTimeout !== null) {
|
|
@@ -1922,8 +1905,8 @@ class AuroFloatingUI {
|
|
|
1922
1905
|
}
|
|
1923
1906
|
};
|
|
1924
1907
|
|
|
1925
|
-
window.addEventListener(
|
|
1926
|
-
window.addEventListener(
|
|
1908
|
+
window.addEventListener("mousedown", mouseEventGlobalHandler);
|
|
1909
|
+
window.addEventListener("mouseup", mouseEventGlobalHandler);
|
|
1927
1910
|
}
|
|
1928
1911
|
}
|
|
1929
1912
|
|
|
@@ -1971,11 +1954,12 @@ class AuroFloatingUI {
|
|
|
1971
1954
|
// mirror the boxsize from bibSizer
|
|
1972
1955
|
if (this.element.bibSizer && this.element.matchWidth) {
|
|
1973
1956
|
const sizerStyle = window.getComputedStyle(this.element.bibSizer);
|
|
1974
|
-
const bibContent =
|
|
1975
|
-
|
|
1957
|
+
const bibContent =
|
|
1958
|
+
this.element.bib.shadowRoot.querySelector(".container");
|
|
1959
|
+
if (sizerStyle.width !== "0px") {
|
|
1976
1960
|
bibContent.style.width = sizerStyle.width;
|
|
1977
1961
|
}
|
|
1978
|
-
if (sizerStyle.height !==
|
|
1962
|
+
if (sizerStyle.height !== "0px") {
|
|
1979
1963
|
bibContent.style.height = sizerStyle.height;
|
|
1980
1964
|
}
|
|
1981
1965
|
bibContent.style.maxWidth = sizerStyle.maxWidth;
|
|
@@ -1993,28 +1977,34 @@ class AuroFloatingUI {
|
|
|
1993
1977
|
* @returns {String} The positioning strategy, one of 'fullscreen', 'floating', 'cover'.
|
|
1994
1978
|
*/
|
|
1995
1979
|
getPositioningStrategy() {
|
|
1996
|
-
const breakpoint =
|
|
1980
|
+
const breakpoint =
|
|
1981
|
+
this.element.bib.mobileFullscreenBreakpoint ||
|
|
1982
|
+
this.element.floaterConfig?.fullscreenBreakpoint;
|
|
1997
1983
|
switch (this.behavior) {
|
|
1998
1984
|
case "tooltip":
|
|
1999
1985
|
return "floating";
|
|
2000
1986
|
case "dialog":
|
|
2001
1987
|
case "drawer":
|
|
2002
1988
|
if (breakpoint) {
|
|
2003
|
-
const smallerThanBreakpoint = window.matchMedia(
|
|
1989
|
+
const smallerThanBreakpoint = window.matchMedia(
|
|
1990
|
+
`(max-width: ${breakpoint})`,
|
|
1991
|
+
).matches;
|
|
2004
1992
|
|
|
2005
1993
|
this.element.expanded = smallerThanBreakpoint;
|
|
2006
1994
|
}
|
|
2007
1995
|
if (this.element.nested) {
|
|
2008
1996
|
return "cover";
|
|
2009
1997
|
}
|
|
2010
|
-
return
|
|
1998
|
+
return "fullscreen";
|
|
2011
1999
|
case "dropdown":
|
|
2012
2000
|
case undefined:
|
|
2013
2001
|
case null:
|
|
2014
2002
|
if (breakpoint) {
|
|
2015
|
-
const smallerThanBreakpoint = window.matchMedia(
|
|
2003
|
+
const smallerThanBreakpoint = window.matchMedia(
|
|
2004
|
+
`(max-width: ${breakpoint})`,
|
|
2005
|
+
).matches;
|
|
2016
2006
|
if (smallerThanBreakpoint) {
|
|
2017
|
-
return
|
|
2007
|
+
return "fullscreen";
|
|
2018
2008
|
}
|
|
2019
2009
|
}
|
|
2020
2010
|
return "floating";
|
|
@@ -2035,37 +2025,39 @@ class AuroFloatingUI {
|
|
|
2035
2025
|
const strategy = this.getPositioningStrategy();
|
|
2036
2026
|
this.configureBibStrategy(strategy);
|
|
2037
2027
|
|
|
2038
|
-
if (strategy ===
|
|
2028
|
+
if (strategy === "floating") {
|
|
2039
2029
|
this.mirrorSize();
|
|
2040
2030
|
// Define the middlware for the floater configuration
|
|
2041
2031
|
const middleware = [
|
|
2042
2032
|
offset(this.element.floaterConfig?.offset || 0),
|
|
2043
|
-
...this.element.floaterConfig?.shift ? [shift()] : [], // Add shift middleware if shift is enabled.
|
|
2044
|
-
...this.element.floaterConfig?.flip ? [flip()] : [], // Add flip middleware if flip is enabled.
|
|
2045
|
-
...this.element.floaterConfig?.autoPlacement ? [autoPlacement()] : [], // Add autoPlacement middleware if autoPlacement is enabled.
|
|
2033
|
+
...(this.element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
|
|
2034
|
+
...(this.element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
|
|
2035
|
+
...(this.element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
|
|
2046
2036
|
];
|
|
2047
2037
|
|
|
2048
2038
|
// Compute the position of the bib
|
|
2049
2039
|
computePosition(this.element.trigger, this.element.bib, {
|
|
2050
|
-
strategy: this.element.floaterConfig?.strategy ||
|
|
2040
|
+
strategy: this.element.floaterConfig?.strategy || "fixed",
|
|
2051
2041
|
placement: this.element.floaterConfig?.placement,
|
|
2052
|
-
middleware: middleware || []
|
|
2053
|
-
}).then(({ x, y }) => {
|
|
2042
|
+
middleware: middleware || [],
|
|
2043
|
+
}).then(({ x, y }) => {
|
|
2044
|
+
// eslint-disable-line id-length
|
|
2054
2045
|
Object.assign(this.element.bib.style, {
|
|
2055
2046
|
left: `${x}px`,
|
|
2056
2047
|
top: `${y}px`,
|
|
2057
2048
|
});
|
|
2058
2049
|
});
|
|
2059
|
-
} else if (strategy ===
|
|
2050
|
+
} else if (strategy === "cover") {
|
|
2060
2051
|
// Compute the position of the bib
|
|
2061
2052
|
computePosition(this.element.parentNode, this.element.bib, {
|
|
2062
|
-
placement:
|
|
2063
|
-
}).then(({ x, y }) => {
|
|
2053
|
+
placement: "bottom-start",
|
|
2054
|
+
}).then(({ x, y }) => {
|
|
2055
|
+
// eslint-disable-line id-length
|
|
2064
2056
|
Object.assign(this.element.bib.style, {
|
|
2065
2057
|
left: `${x}px`,
|
|
2066
2058
|
top: `${y - this.element.parentNode.offsetHeight}px`,
|
|
2067
2059
|
width: `${this.element.parentNode.offsetWidth}px`,
|
|
2068
|
-
height: `${this.element.parentNode.offsetHeight}px
|
|
2060
|
+
height: `${this.element.parentNode.offsetHeight}px`,
|
|
2069
2061
|
});
|
|
2070
2062
|
});
|
|
2071
2063
|
}
|
|
@@ -2078,12 +2070,12 @@ class AuroFloatingUI {
|
|
|
2078
2070
|
*/
|
|
2079
2071
|
lockScroll(lock = true) {
|
|
2080
2072
|
if (lock) {
|
|
2081
|
-
document.body.style.overflow =
|
|
2073
|
+
document.body.style.overflow = "hidden"; // hide body's scrollbar
|
|
2082
2074
|
|
|
2083
2075
|
// Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
|
|
2084
2076
|
this.element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
|
|
2085
2077
|
} else {
|
|
2086
|
-
document.body.style.overflow =
|
|
2078
|
+
document.body.style.overflow = "";
|
|
2087
2079
|
}
|
|
2088
2080
|
}
|
|
2089
2081
|
|
|
@@ -2097,23 +2089,24 @@ class AuroFloatingUI {
|
|
|
2097
2089
|
* @param {string} strategy - The positioning strategy ('fullscreen' or 'floating').
|
|
2098
2090
|
*/
|
|
2099
2091
|
configureBibStrategy(value) {
|
|
2100
|
-
if (value ===
|
|
2092
|
+
if (value === "fullscreen") {
|
|
2101
2093
|
this.element.isBibFullscreen = true;
|
|
2102
2094
|
// reset the prev position
|
|
2103
|
-
this.element.bib.setAttribute(
|
|
2104
|
-
this.element.bib.style.position =
|
|
2095
|
+
this.element.bib.setAttribute("isfullscreen", "");
|
|
2096
|
+
this.element.bib.style.position = "fixed";
|
|
2105
2097
|
this.element.bib.style.top = "0px";
|
|
2106
2098
|
this.element.bib.style.left = "0px";
|
|
2107
|
-
this.element.bib.style.width =
|
|
2108
|
-
this.element.bib.style.height =
|
|
2109
|
-
this.element.style.contain =
|
|
2099
|
+
this.element.bib.style.width = "";
|
|
2100
|
+
this.element.bib.style.height = "";
|
|
2101
|
+
this.element.style.contain = "";
|
|
2110
2102
|
|
|
2111
2103
|
// reset the size that was mirroring `size` css-part
|
|
2112
|
-
const bibContent =
|
|
2104
|
+
const bibContent =
|
|
2105
|
+
this.element.bib.shadowRoot.querySelector(".container");
|
|
2113
2106
|
if (bibContent) {
|
|
2114
|
-
bibContent.style.width =
|
|
2115
|
-
bibContent.style.height =
|
|
2116
|
-
bibContent.style.maxWidth =
|
|
2107
|
+
bibContent.style.width = "";
|
|
2108
|
+
bibContent.style.height = "";
|
|
2109
|
+
bibContent.style.maxWidth = "";
|
|
2117
2110
|
bibContent.style.maxHeight = `${window?.visualViewport?.height}px`;
|
|
2118
2111
|
this.configureTrial = 0;
|
|
2119
2112
|
} else if (this.configureTrial < MAX_CONFIGURATION_COUNT) {
|
|
@@ -2128,21 +2121,26 @@ class AuroFloatingUI {
|
|
|
2128
2121
|
this.lockScroll(true);
|
|
2129
2122
|
}
|
|
2130
2123
|
} else {
|
|
2131
|
-
this.element.bib.style.position =
|
|
2132
|
-
this.element.bib.removeAttribute(
|
|
2124
|
+
this.element.bib.style.position = "";
|
|
2125
|
+
this.element.bib.removeAttribute("isfullscreen");
|
|
2133
2126
|
this.element.isBibFullscreen = false;
|
|
2134
|
-
this.element.style.contain =
|
|
2127
|
+
this.element.style.contain = "layout";
|
|
2135
2128
|
}
|
|
2136
2129
|
|
|
2137
2130
|
const isChanged = this.strategy && this.strategy !== value;
|
|
2138
2131
|
this.strategy = value;
|
|
2139
2132
|
if (isChanged) {
|
|
2140
|
-
const event = new CustomEvent(
|
|
2141
|
-
|
|
2142
|
-
|
|
2133
|
+
const event = new CustomEvent(
|
|
2134
|
+
this.eventPrefix
|
|
2135
|
+
? `${this.eventPrefix}-strategy-change`
|
|
2136
|
+
: "strategy-change",
|
|
2137
|
+
{
|
|
2138
|
+
detail: {
|
|
2139
|
+
value,
|
|
2140
|
+
},
|
|
2141
|
+
composed: true,
|
|
2143
2142
|
},
|
|
2144
|
-
|
|
2145
|
-
});
|
|
2143
|
+
);
|
|
2146
2144
|
|
|
2147
2145
|
this.element.dispatchEvent(event);
|
|
2148
2146
|
}
|
|
@@ -2174,19 +2172,24 @@ class AuroFloatingUI {
|
|
|
2174
2172
|
return;
|
|
2175
2173
|
}
|
|
2176
2174
|
|
|
2177
|
-
if (
|
|
2178
|
-
this.element.
|
|
2175
|
+
if (
|
|
2176
|
+
this.element.noHideOnThisFocusLoss ||
|
|
2177
|
+
this.element.hasAttribute("noHideOnThisFocusLoss")
|
|
2178
|
+
) {
|
|
2179
2179
|
return;
|
|
2180
2180
|
}
|
|
2181
2181
|
|
|
2182
2182
|
const { activeElement } = document;
|
|
2183
2183
|
// if focus is still inside of trigger or bib, do not close
|
|
2184
|
-
if (
|
|
2184
|
+
if (
|
|
2185
|
+
this.element.contains(activeElement) ||
|
|
2186
|
+
this.element.bib?.contains(activeElement)
|
|
2187
|
+
) {
|
|
2185
2188
|
return;
|
|
2186
2189
|
}
|
|
2187
2190
|
|
|
2188
2191
|
// if fullscreen bib is in fullscreen mode, do not close
|
|
2189
|
-
if (this.element.bib.hasAttribute(
|
|
2192
|
+
if (this.element.bib.hasAttribute("isfullscreen")) {
|
|
2190
2193
|
return;
|
|
2191
2194
|
}
|
|
2192
2195
|
|
|
@@ -2198,12 +2201,27 @@ class AuroFloatingUI {
|
|
|
2198
2201
|
this.focusHandler = () => this.handleFocusLoss();
|
|
2199
2202
|
|
|
2200
2203
|
this.clickHandler = (evt) => {
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2204
|
+
// When the bib is fullscreen (modal dialog), don't close on outside
|
|
2205
|
+
// clicks. VoiceOver's synthetic click events inside a top-layer modal
|
|
2206
|
+
// <dialog> may not include the bib in composedPath(), causing false
|
|
2207
|
+
// positives. This mirrors the fullscreen guard in handleFocusLoss().
|
|
2208
|
+
if (this.element.bib && this.element.bib.hasAttribute("isfullscreen")) {
|
|
2209
|
+
return;
|
|
2210
|
+
}
|
|
2205
2211
|
|
|
2206
|
-
|
|
2212
|
+
if (
|
|
2213
|
+
(!evt.composedPath().includes(this.element.trigger) &&
|
|
2214
|
+
!evt.composedPath().includes(this.element.bib)) ||
|
|
2215
|
+
(this.element.bib.backdrop &&
|
|
2216
|
+
evt.composedPath().includes(this.element.bib.backdrop))
|
|
2217
|
+
) {
|
|
2218
|
+
const existedVisibleFloatingUI =
|
|
2219
|
+
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
2220
|
+
|
|
2221
|
+
if (
|
|
2222
|
+
existedVisibleFloatingUI &&
|
|
2223
|
+
existedVisibleFloatingUI.element.isPopoverVisible
|
|
2224
|
+
) {
|
|
2207
2225
|
// if something else is open, close that
|
|
2208
2226
|
existedVisibleFloatingUI.hideBib();
|
|
2209
2227
|
document.expandedAuroFormkitDropdown = null;
|
|
@@ -2216,9 +2234,14 @@ class AuroFloatingUI {
|
|
|
2216
2234
|
|
|
2217
2235
|
// ESC key handler
|
|
2218
2236
|
this.keyDownHandler = (evt) => {
|
|
2219
|
-
if (evt.key ===
|
|
2220
|
-
const existedVisibleFloatingUI =
|
|
2221
|
-
|
|
2237
|
+
if (evt.key === "Escape" && this.element.isPopoverVisible) {
|
|
2238
|
+
const existedVisibleFloatingUI =
|
|
2239
|
+
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
2240
|
+
if (
|
|
2241
|
+
existedVisibleFloatingUI &&
|
|
2242
|
+
existedVisibleFloatingUI !== this &&
|
|
2243
|
+
existedVisibleFloatingUI.element.isPopoverVisible
|
|
2244
|
+
) {
|
|
2222
2245
|
// if something else is open, let it handle itself
|
|
2223
2246
|
return;
|
|
2224
2247
|
}
|
|
@@ -2226,17 +2249,17 @@ class AuroFloatingUI {
|
|
|
2226
2249
|
}
|
|
2227
2250
|
};
|
|
2228
2251
|
|
|
2229
|
-
if (this.behavior !==
|
|
2252
|
+
if (this.behavior !== "drawer" && this.behavior !== "dialog") {
|
|
2230
2253
|
// Add event listeners using the stored references
|
|
2231
|
-
document.addEventListener(
|
|
2254
|
+
document.addEventListener("focusin", this.focusHandler);
|
|
2232
2255
|
}
|
|
2233
2256
|
|
|
2234
|
-
document.addEventListener(
|
|
2257
|
+
document.addEventListener("keydown", this.keyDownHandler);
|
|
2235
2258
|
|
|
2236
2259
|
// send this task to the end of queue to prevent conflicting
|
|
2237
2260
|
// it conflicts if showBib gets call from a button that's not this.element.trigger
|
|
2238
2261
|
setTimeout(() => {
|
|
2239
|
-
window.addEventListener(
|
|
2262
|
+
window.addEventListener("click", this.clickHandler);
|
|
2240
2263
|
}, 0);
|
|
2241
2264
|
}
|
|
2242
2265
|
|
|
@@ -2244,34 +2267,38 @@ class AuroFloatingUI {
|
|
|
2244
2267
|
// Remove event listeners if they exist
|
|
2245
2268
|
|
|
2246
2269
|
if (this.focusHandler) {
|
|
2247
|
-
document.removeEventListener(
|
|
2270
|
+
document.removeEventListener("focusin", this.focusHandler);
|
|
2248
2271
|
this.focusHandler = null;
|
|
2249
2272
|
}
|
|
2250
2273
|
|
|
2251
2274
|
if (this.clickHandler) {
|
|
2252
|
-
window.removeEventListener(
|
|
2275
|
+
window.removeEventListener("click", this.clickHandler);
|
|
2253
2276
|
this.clickHandler = null;
|
|
2254
2277
|
}
|
|
2255
2278
|
|
|
2256
2279
|
if (this.keyDownHandler) {
|
|
2257
|
-
document.removeEventListener(
|
|
2280
|
+
document.removeEventListener("keydown", this.keyDownHandler);
|
|
2258
2281
|
this.keyDownHandler = null;
|
|
2259
2282
|
}
|
|
2260
2283
|
}
|
|
2261
2284
|
|
|
2262
2285
|
handleUpdate(changedProperties) {
|
|
2263
|
-
if (changedProperties.has(
|
|
2286
|
+
if (changedProperties.has("isPopoverVisible")) {
|
|
2264
2287
|
this.updateState();
|
|
2265
2288
|
}
|
|
2266
2289
|
}
|
|
2267
2290
|
|
|
2268
2291
|
updateCurrentExpandedDropdown() {
|
|
2269
2292
|
// Close any other dropdown that is already open
|
|
2270
|
-
const existedVisibleFloatingUI =
|
|
2271
|
-
|
|
2293
|
+
const existedVisibleFloatingUI =
|
|
2294
|
+
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
2295
|
+
if (
|
|
2296
|
+
existedVisibleFloatingUI &&
|
|
2297
|
+
existedVisibleFloatingUI !== this &&
|
|
2272
2298
|
existedVisibleFloatingUI.element.isPopoverVisible &&
|
|
2273
|
-
|
|
2274
|
-
|
|
2299
|
+
existedVisibleFloatingUI.eventPrefix === this.eventPrefix
|
|
2300
|
+
) {
|
|
2301
|
+
existedVisibleFloatingUI.hideBib();
|
|
2275
2302
|
}
|
|
2276
2303
|
|
|
2277
2304
|
document.expandedAuroFloater = this;
|
|
@@ -2280,7 +2307,7 @@ class AuroFloatingUI {
|
|
|
2280
2307
|
showBib() {
|
|
2281
2308
|
if (!this.element.disabled && !this.showing) {
|
|
2282
2309
|
this.updateCurrentExpandedDropdown();
|
|
2283
|
-
this.element.triggerChevron?.setAttribute(
|
|
2310
|
+
this.element.triggerChevron?.setAttribute("data-expanded", true);
|
|
2284
2311
|
|
|
2285
2312
|
// prevent double showing: isPopovervisible gets first and showBib gets called later
|
|
2286
2313
|
if (!this.showing) {
|
|
@@ -2294,9 +2321,13 @@ class AuroFloatingUI {
|
|
|
2294
2321
|
}
|
|
2295
2322
|
|
|
2296
2323
|
// Setup auto update to handle resize and scroll
|
|
2297
|
-
this.element.cleanup = autoUpdate(
|
|
2298
|
-
this.
|
|
2299
|
-
|
|
2324
|
+
this.element.cleanup = autoUpdate(
|
|
2325
|
+
this.element.trigger || this.element.parentNode,
|
|
2326
|
+
this.element.bib,
|
|
2327
|
+
() => {
|
|
2328
|
+
this.position();
|
|
2329
|
+
},
|
|
2330
|
+
);
|
|
2300
2331
|
}
|
|
2301
2332
|
}
|
|
2302
2333
|
|
|
@@ -2307,7 +2338,7 @@ class AuroFloatingUI {
|
|
|
2307
2338
|
hideBib(eventType = "unknown") {
|
|
2308
2339
|
if (!this.element.disabled && !this.element.noToggle) {
|
|
2309
2340
|
this.lockScroll(false);
|
|
2310
|
-
this.element.triggerChevron?.removeAttribute(
|
|
2341
|
+
this.element.triggerChevron?.removeAttribute("data-expanded");
|
|
2311
2342
|
|
|
2312
2343
|
if (this.element.isPopoverVisible) {
|
|
2313
2344
|
this.element.isPopoverVisible = false;
|
|
@@ -2327,13 +2358,16 @@ class AuroFloatingUI {
|
|
|
2327
2358
|
* @param {String} eventType - The event type that triggered the toggle action.
|
|
2328
2359
|
*/
|
|
2329
2360
|
dispatchEventDropdownToggle(eventType) {
|
|
2330
|
-
const event = new CustomEvent(
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2361
|
+
const event = new CustomEvent(
|
|
2362
|
+
this.eventPrefix ? `${this.eventPrefix}-toggled` : "toggled",
|
|
2363
|
+
{
|
|
2364
|
+
detail: {
|
|
2365
|
+
expanded: this.showing,
|
|
2366
|
+
eventType: eventType || "unknown",
|
|
2367
|
+
},
|
|
2368
|
+
composed: true,
|
|
2334
2369
|
},
|
|
2335
|
-
|
|
2336
|
-
});
|
|
2370
|
+
);
|
|
2337
2371
|
|
|
2338
2372
|
this.element.dispatchEvent(event);
|
|
2339
2373
|
}
|
|
@@ -2345,12 +2379,15 @@ class AuroFloatingUI {
|
|
|
2345
2379
|
this.showBib();
|
|
2346
2380
|
}
|
|
2347
2381
|
|
|
2348
|
-
const event = new CustomEvent(
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2382
|
+
const event = new CustomEvent(
|
|
2383
|
+
this.eventPrefix ? `${this.eventPrefix}-triggerClick` : "triggerClick",
|
|
2384
|
+
{
|
|
2385
|
+
composed: true,
|
|
2386
|
+
detail: {
|
|
2387
|
+
expanded: this.element.isPopoverVisible,
|
|
2388
|
+
},
|
|
2389
|
+
},
|
|
2390
|
+
);
|
|
2354
2391
|
|
|
2355
2392
|
this.element.dispatchEvent(event);
|
|
2356
2393
|
}
|
|
@@ -2358,30 +2395,32 @@ class AuroFloatingUI {
|
|
|
2358
2395
|
handleEvent(event) {
|
|
2359
2396
|
if (!this.element.disableEventShow) {
|
|
2360
2397
|
switch (event.type) {
|
|
2361
|
-
case
|
|
2398
|
+
case "keydown": {
|
|
2362
2399
|
// Support both Enter and Space keys for accessibility
|
|
2363
2400
|
// Space is included as it's expected behavior for interactive elements
|
|
2364
2401
|
|
|
2365
2402
|
const origin = event.composedPath()[0];
|
|
2366
|
-
if (
|
|
2367
|
-
|
|
2403
|
+
if (
|
|
2404
|
+
event.key === "Enter" ||
|
|
2405
|
+
(event.key === " " && (!origin || origin.tagName !== "INPUT"))
|
|
2406
|
+
) {
|
|
2368
2407
|
event.preventDefault();
|
|
2369
2408
|
this.handleClick();
|
|
2370
2409
|
}
|
|
2371
2410
|
break;
|
|
2372
|
-
|
|
2411
|
+
}
|
|
2412
|
+
case "mouseenter":
|
|
2373
2413
|
if (this.element.hoverToggle) {
|
|
2374
2414
|
this.showBib();
|
|
2375
2415
|
}
|
|
2376
2416
|
break;
|
|
2377
|
-
case
|
|
2417
|
+
case "mouseleave":
|
|
2378
2418
|
if (this.element.hoverToggle) {
|
|
2379
2419
|
this.hideBib("mouseleave");
|
|
2380
2420
|
}
|
|
2381
2421
|
break;
|
|
2382
|
-
case
|
|
2422
|
+
case "focus":
|
|
2383
2423
|
if (this.element.focusShow) {
|
|
2384
|
-
|
|
2385
2424
|
/*
|
|
2386
2425
|
This needs to better handle clicking that gives focus -
|
|
2387
2426
|
currently it shows and then immediately hides the bib
|
|
@@ -2389,12 +2428,12 @@ class AuroFloatingUI {
|
|
|
2389
2428
|
this.showBib();
|
|
2390
2429
|
}
|
|
2391
2430
|
break;
|
|
2392
|
-
case
|
|
2431
|
+
case "blur":
|
|
2393
2432
|
// send this task 100ms later queue to
|
|
2394
2433
|
// wait a frame in case focus moves within the floating element/bib
|
|
2395
2434
|
setTimeout(() => this.handleFocusLoss(), 0);
|
|
2396
2435
|
break;
|
|
2397
|
-
case
|
|
2436
|
+
case "click":
|
|
2398
2437
|
if (document.activeElement === document.body) {
|
|
2399
2438
|
event.currentTarget.focus();
|
|
2400
2439
|
}
|
|
@@ -2413,15 +2452,15 @@ class AuroFloatingUI {
|
|
|
2413
2452
|
*/
|
|
2414
2453
|
handleTriggerTabIndex() {
|
|
2415
2454
|
const focusableElementSelectors = [
|
|
2416
|
-
|
|
2417
|
-
|
|
2455
|
+
"a",
|
|
2456
|
+
"button",
|
|
2418
2457
|
'input:not([type="hidden"])',
|
|
2419
|
-
|
|
2420
|
-
|
|
2458
|
+
"select",
|
|
2459
|
+
"textarea",
|
|
2421
2460
|
'[tabindex]:not([tabindex="-1"])',
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2461
|
+
"auro-button",
|
|
2462
|
+
"auro-input",
|
|
2463
|
+
"auro-hyperlink",
|
|
2425
2464
|
];
|
|
2426
2465
|
|
|
2427
2466
|
const triggerNode = this.element.querySelectorAll('[slot="trigger"]')[0];
|
|
@@ -2449,10 +2488,10 @@ class AuroFloatingUI {
|
|
|
2449
2488
|
* @param {*} eventPrefix
|
|
2450
2489
|
*/
|
|
2451
2490
|
regenerateBibId() {
|
|
2452
|
-
this.id = this.element.getAttribute(
|
|
2491
|
+
this.id = this.element.getAttribute("id");
|
|
2453
2492
|
if (!this.id) {
|
|
2454
2493
|
this.id = window.crypto.randomUUID();
|
|
2455
|
-
this.element.setAttribute(
|
|
2494
|
+
this.element.setAttribute("id", this.id);
|
|
2456
2495
|
}
|
|
2457
2496
|
|
|
2458
2497
|
this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
|
|
@@ -2473,11 +2512,15 @@ class AuroFloatingUI {
|
|
|
2473
2512
|
if (this.element.trigger) {
|
|
2474
2513
|
this.disconnect();
|
|
2475
2514
|
}
|
|
2476
|
-
this.element.trigger =
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2515
|
+
this.element.trigger =
|
|
2516
|
+
this.element.triggerElement ||
|
|
2517
|
+
this.element.shadowRoot.querySelector("#trigger") ||
|
|
2518
|
+
this.element.trigger;
|
|
2519
|
+
this.element.bib =
|
|
2520
|
+
this.element.shadowRoot.querySelector("#bib") || this.element.bib;
|
|
2521
|
+
this.element.bibSizer = this.element.shadowRoot.querySelector("#bibSizer");
|
|
2522
|
+
this.element.triggerChevron =
|
|
2523
|
+
this.element.shadowRoot.querySelector("#showStateIcon");
|
|
2481
2524
|
|
|
2482
2525
|
if (this.element.floaterConfig) {
|
|
2483
2526
|
this.element.hoverToggle = this.element.floaterConfig.hoverToggle;
|
|
@@ -2488,12 +2531,12 @@ class AuroFloatingUI {
|
|
|
2488
2531
|
|
|
2489
2532
|
this.handleEvent = this.handleEvent.bind(this);
|
|
2490
2533
|
if (this.element.trigger) {
|
|
2491
|
-
this.element.trigger.addEventListener(
|
|
2492
|
-
this.element.trigger.addEventListener(
|
|
2493
|
-
this.element.trigger.addEventListener(
|
|
2494
|
-
this.element.trigger.addEventListener(
|
|
2495
|
-
this.element.trigger.addEventListener(
|
|
2496
|
-
this.element.trigger.addEventListener(
|
|
2534
|
+
this.element.trigger.addEventListener("keydown", this.handleEvent);
|
|
2535
|
+
this.element.trigger.addEventListener("click", this.handleEvent);
|
|
2536
|
+
this.element.trigger.addEventListener("mouseenter", this.handleEvent);
|
|
2537
|
+
this.element.trigger.addEventListener("mouseleave", this.handleEvent);
|
|
2538
|
+
this.element.trigger.addEventListener("focus", this.handleEvent);
|
|
2539
|
+
this.element.trigger.addEventListener("blur", this.handleEvent);
|
|
2497
2540
|
}
|
|
2498
2541
|
}
|
|
2499
2542
|
|
|
@@ -2508,12 +2551,18 @@ class AuroFloatingUI {
|
|
|
2508
2551
|
|
|
2509
2552
|
// Remove event & keyboard listeners
|
|
2510
2553
|
if (this.element?.trigger) {
|
|
2511
|
-
this.element.trigger.removeEventListener(
|
|
2512
|
-
this.element.trigger.removeEventListener(
|
|
2513
|
-
this.element.trigger.removeEventListener(
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2554
|
+
this.element.trigger.removeEventListener("keydown", this.handleEvent);
|
|
2555
|
+
this.element.trigger.removeEventListener("click", this.handleEvent);
|
|
2556
|
+
this.element.trigger.removeEventListener(
|
|
2557
|
+
"mouseenter",
|
|
2558
|
+
this.handleEvent,
|
|
2559
|
+
);
|
|
2560
|
+
this.element.trigger.removeEventListener(
|
|
2561
|
+
"mouseleave",
|
|
2562
|
+
this.handleEvent,
|
|
2563
|
+
);
|
|
2564
|
+
this.element.trigger.removeEventListener("focus", this.handleEvent);
|
|
2565
|
+
this.element.trigger.removeEventListener("blur", this.handleEvent);
|
|
2517
2566
|
}
|
|
2518
2567
|
}
|
|
2519
2568
|
}
|
|
@@ -2934,6 +2983,25 @@ class AuroDependencyVersioning {
|
|
|
2934
2983
|
}
|
|
2935
2984
|
}
|
|
2936
2985
|
|
|
2986
|
+
/**
|
|
2987
|
+
* @license
|
|
2988
|
+
* Copyright 2019 Google LLC
|
|
2989
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2990
|
+
*/
|
|
2991
|
+
const t=globalThis,e$1=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$3=new WeakMap;let n$1 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$1&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$3.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$3.set(s,t));}return t}toString(){return this.cssText}};const r$1=t=>new n$1("string"==typeof t?t:t+"",void 0,s$1),i$2=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$1(o,t,s$1)},S=(s,o)=>{if(e$1)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$1=e$1?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$1(e)})(t):t;
|
|
2992
|
+
|
|
2993
|
+
/**
|
|
2994
|
+
* @license
|
|
2995
|
+
* Copyright 2017 Google LLC
|
|
2996
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2997
|
+
*/const{is:i$1,defineProperty:e,getOwnPropertyDescriptor:h,getOwnPropertyNames:r,getOwnPropertySymbols:o$2,getPrototypeOf:n}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:"",p$1=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l: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$1=(t,s)=>!i$1(t,s),b={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;let y$1 = 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(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(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("elementProperties")))return;const t=n(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d("properties"))){const t=this.properties,s=[...r(t),...o$2(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$1(s));}else void 0!==s&&i.push(c$1(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(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$1).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$1;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,e=false,h){if(void 0!==t){const r=this.constructor;if(false===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$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$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d("elementProperties")]=new Map,y$1[d("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a.reactiveElementVersions??=[]).push("2.1.2");
|
|
2998
|
+
|
|
2999
|
+
/**
|
|
3000
|
+
* @license
|
|
3001
|
+
* Copyright 2017 Google LLC
|
|
3002
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3003
|
+
*/const s=globalThis;class i extends y$1{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=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}}i._$litElement$=true,i["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i});const o$1=s.litElementPolyfillSupport;o$1?.({LitElement:i});(s.litElementVersions??=[]).push("4.2.2");
|
|
3004
|
+
|
|
2937
3005
|
/**
|
|
2938
3006
|
* @license
|
|
2939
3007
|
* Copyright 2018 Google LLC
|
|
@@ -2966,7 +3034,7 @@ class p{registerComponent(t,a){customElements.get(t)||customElements.define(t,cl
|
|
|
2966
3034
|
|
|
2967
3035
|
var iconVersion = '9.1.2';
|
|
2968
3036
|
|
|
2969
|
-
var styleCss$2 = i$2`:host{position:fixed;z-index:var(--depth-tooltip, 400);display:none;isolation:isolate}:host(:not([matchWidth])) .container{min-width:fit-content}:host([isfullscreen]){position:fixed;top:0;left:0}:host([isfullscreen]) .container{width:100dvw;max-width:none;height:100dvh;max-height:none;border-radius:unset;margin-top:0;box-shadow:unset;overscroll-behavior:contain}:host([data-show]){display:flex}:host([common]:not([isfullscreen])) .container,:host([rounded]:not([isfullscreen])) .container{border-radius:var(--ds-border-radius, 0.375rem)}:host([common][isfullscreen]) .container,:host([rounded][isfullscreen]) .container{border-radius:unset;box-shadow:unset}
|
|
3037
|
+
var styleCss$2 = i$2`:host{position:fixed;z-index:var(--depth-tooltip, 400);display:none;isolation:isolate}:host dialog{width:auto;max-width:none;height:auto;max-height:none;padding:0;border:none;margin:0;outline:none;transform:translateZ(0)}:host dialog::backdrop{background:transparent}:host(:not([isfullscreen])) dialog{position:relative;inset:unset}:host(:not([isfullscreen])) .container.shape-box{border-radius:unset}:host(:not([isfullscreen])) .container[class*=shape-pill],:host(:not([isfullscreen])) .container[class*=shape-snowflake]{border-radius:30px}:host(:not([isfullscreen])) .container[class*=shape-rounded]{border-radius:16px}:host(:not([matchWidth])) .container{min-width:fit-content}:host([isfullscreen]){position:fixed;top:0;left:0}:host([isfullscreen]) .container{width:100dvw;max-width:none;height:100dvh;max-height:none;border-radius:unset;margin-top:0;box-shadow:unset;overscroll-behavior:contain}:host([isfullscreen]) .container::backdrop{background:var(--ds-color-background-primary, #fff)}:host([data-show]){display:flex}:host([common]:not([isfullscreen])) .container,:host([rounded]:not([isfullscreen])) .container{border-radius:var(--ds-border-radius, 0.375rem)}:host([common][isfullscreen]) .container,:host([rounded][isfullscreen]) .container{border-radius:unset;box-shadow:unset}.container{display:inline-block;overflow:auto;box-sizing:border-box;border-radius:var(--ds-border-radius, 0.375rem);margin:var(--ds-size-50, 0.25rem) 0}.util_displayHiddenVisually{position:absolute;overflow:hidden;width:1px;height:1px;padding:0;border:0;margin:-1px;clip-path:inset(50%);white-space:nowrap}`;
|
|
2970
3038
|
|
|
2971
3039
|
var colorCss$2 = i$2`.container{background-color:var(--ds-auro-dropdownbib-container-color);box-shadow:var(--ds-auro-dropdownbib-boxshadow-color);color:var(--ds-auro-dropdownbib-text-color)}`;
|
|
2972
3040
|
|
|
@@ -2974,6 +3042,8 @@ var tokensCss$1 = i$2`:host(:not([ondark])),:host(:not([appearance=inverse])){--
|
|
|
2974
3042
|
|
|
2975
3043
|
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
2976
3044
|
// See LICENSE in the project root for license information.
|
|
3045
|
+
/* eslint-disable max-lines */
|
|
3046
|
+
// ---------------------------------------------------------------------
|
|
2977
3047
|
|
|
2978
3048
|
|
|
2979
3049
|
const DESIGN_TOKEN_BREAKPOINT_PREFIX = '--ds-grid-breakpoint-';
|
|
@@ -3068,6 +3138,28 @@ class AuroDropdownBib extends i {
|
|
|
3068
3138
|
shape: {
|
|
3069
3139
|
type: String,
|
|
3070
3140
|
reflect: true
|
|
3141
|
+
},
|
|
3142
|
+
|
|
3143
|
+
/**
|
|
3144
|
+
* Accessible label for the dialog element, used when displayed as a modal.
|
|
3145
|
+
* Applied via aria-labelledby on a visually hidden element rather than
|
|
3146
|
+
* aria-label because iOS VoiceOver does not reliably read aria-label
|
|
3147
|
+
* on <dialog> elements.
|
|
3148
|
+
* @private
|
|
3149
|
+
*/
|
|
3150
|
+
dialogLabel: {
|
|
3151
|
+
type: String
|
|
3152
|
+
},
|
|
3153
|
+
|
|
3154
|
+
/**
|
|
3155
|
+
* Overrides the native role of the dialog element.
|
|
3156
|
+
* For example, set to `"presentation"` on desktop combobox to prevent
|
|
3157
|
+
* VoiceOver from announcing "listbox inside of a dialog".
|
|
3158
|
+
* When `undefined`, the dialog keeps its native role.
|
|
3159
|
+
* @private
|
|
3160
|
+
*/
|
|
3161
|
+
dialogRole: {
|
|
3162
|
+
type: String
|
|
3071
3163
|
}
|
|
3072
3164
|
};
|
|
3073
3165
|
}
|
|
@@ -3135,7 +3227,10 @@ class AuroDropdownBib extends i {
|
|
|
3135
3227
|
firstUpdated(changedProperties) {
|
|
3136
3228
|
super.firstUpdated(changedProperties);
|
|
3137
3229
|
|
|
3138
|
-
|
|
3230
|
+
const dialog = this.shadowRoot.querySelector('dialog');
|
|
3231
|
+
this._setupCancelHandler(dialog);
|
|
3232
|
+
this._setupKeyboardBridge(dialog);
|
|
3233
|
+
|
|
3139
3234
|
this.dispatchEvent(new CustomEvent('auro-dropdownbib-connected', {
|
|
3140
3235
|
bubbles: true,
|
|
3141
3236
|
composed: true,
|
|
@@ -3145,6 +3240,189 @@ class AuroDropdownBib extends i {
|
|
|
3145
3240
|
}));
|
|
3146
3241
|
}
|
|
3147
3242
|
|
|
3243
|
+
/**
|
|
3244
|
+
* Forwards the dialog's native `cancel` event (fired on ESC) as
|
|
3245
|
+
* an `auro-bib-cancel` custom event so parent components can close.
|
|
3246
|
+
* @param {HTMLDialogElement} dialog
|
|
3247
|
+
* @private
|
|
3248
|
+
*/
|
|
3249
|
+
_setupCancelHandler(dialog) {
|
|
3250
|
+
dialog.addEventListener('cancel', (event) => {
|
|
3251
|
+
event.preventDefault();
|
|
3252
|
+
this.dispatchEvent(new CustomEvent('auro-bib-cancel', {
|
|
3253
|
+
bubbles: true,
|
|
3254
|
+
composed: true
|
|
3255
|
+
}));
|
|
3256
|
+
});
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
/**
|
|
3260
|
+
* showModal() creates a closed focus scope — keyboard events inside
|
|
3261
|
+
* the dialog's shadow DOM do NOT bubble out to the combobox/select
|
|
3262
|
+
* keydown handlers in the parent shadow DOM. This handler bridges
|
|
3263
|
+
* that gap by re-dispatching navigation keys so they cross the
|
|
3264
|
+
* shadow boundary and reach the menu navigation logic in the parent
|
|
3265
|
+
* component.
|
|
3266
|
+
*
|
|
3267
|
+
* The trade-off: intercepting these keys means native keyboard
|
|
3268
|
+
* behaviors that would normally "just work" must be manually
|
|
3269
|
+
* re-implemented here:
|
|
3270
|
+
*
|
|
3271
|
+
* - Enter on buttons: Custom elements (auro-button) don't get the
|
|
3272
|
+
* native Enter→click that <button> provides, so we call .click()
|
|
3273
|
+
* directly when Enter is pressed on a button-like element.
|
|
3274
|
+
*
|
|
3275
|
+
* - Tab: Intercepted and re-dispatched so parent components
|
|
3276
|
+
* (select/combobox) can select the active option and close the
|
|
3277
|
+
* dialog. The <dialog> provides containment and isolation
|
|
3278
|
+
* (inert background, VoiceOver focus trapping, top layer), while
|
|
3279
|
+
* the content inside is a role="listbox" navigated via
|
|
3280
|
+
* aria-activedescendant (options are not focusable). Tab keyboard
|
|
3281
|
+
* behavior follows listbox conventions (select + close) because
|
|
3282
|
+
* the dialog's native Tab trap only cycles between the close
|
|
3283
|
+
* button and browser chrome.
|
|
3284
|
+
*
|
|
3285
|
+
* - Escape: The native <dialog> fires a `cancel` event on ESC
|
|
3286
|
+
* (handled by _setupCancelHandler), so the re-dispatched Escape
|
|
3287
|
+
* is a secondary path for parent components that also listen for
|
|
3288
|
+
* Escape keydown.
|
|
3289
|
+
*
|
|
3290
|
+
* @param {HTMLDialogElement} dialog
|
|
3291
|
+
* @private
|
|
3292
|
+
*/
|
|
3293
|
+
_setupKeyboardBridge(dialog) {
|
|
3294
|
+
const navKeys = new Set([
|
|
3295
|
+
'ArrowUp',
|
|
3296
|
+
'ArrowDown',
|
|
3297
|
+
'Enter',
|
|
3298
|
+
'Escape',
|
|
3299
|
+
'Tab'
|
|
3300
|
+
]);
|
|
3301
|
+
|
|
3302
|
+
dialog.addEventListener('keydown', (event) => {
|
|
3303
|
+
if (!navKeys.has(event.key)) {
|
|
3304
|
+
return;
|
|
3305
|
+
}
|
|
3306
|
+
|
|
3307
|
+
// Custom elements (auro-button) don't get the native Enter→click
|
|
3308
|
+
// behavior that <button> has. Find the button in the composed path
|
|
3309
|
+
// and click it directly.
|
|
3310
|
+
if (event.key === 'Enter') {
|
|
3311
|
+
const buttonSelector = 'button, [role="button"], auro-button, [auro-button]';
|
|
3312
|
+
const btn = event.composedPath().find((el) => el.matches && el.matches(buttonSelector));
|
|
3313
|
+
if (btn) {
|
|
3314
|
+
event.preventDefault();
|
|
3315
|
+
event.stopPropagation();
|
|
3316
|
+
btn.click();
|
|
3317
|
+
return;
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
event.preventDefault();
|
|
3322
|
+
event.stopPropagation();
|
|
3323
|
+
const newEvent = new KeyboardEvent('keydown', {
|
|
3324
|
+
key: event.key,
|
|
3325
|
+
code: event.code,
|
|
3326
|
+
shiftKey: event.shiftKey,
|
|
3327
|
+
altKey: event.altKey,
|
|
3328
|
+
ctrlKey: event.ctrlKey,
|
|
3329
|
+
metaKey: event.metaKey,
|
|
3330
|
+
bubbles: true,
|
|
3331
|
+
composed: true,
|
|
3332
|
+
cancelable: true
|
|
3333
|
+
});
|
|
3334
|
+
this.dispatchEvent(newEvent);
|
|
3335
|
+
});
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3338
|
+
/**
|
|
3339
|
+
* Blocks touch-driven page scroll while a fullscreen modal dialog is open.
|
|
3340
|
+
*
|
|
3341
|
+
* The showModal() function places the dialog in the browser's **top layer**,
|
|
3342
|
+
* which is a separate rendering layer above the normal DOM. On mobile, the
|
|
3343
|
+
* compositor processes visual-viewport panning before top-layer touch
|
|
3344
|
+
* handling. This means the entire viewport — including the top-layer dialog
|
|
3345
|
+
* — can be panned by a touch gesture, causing the page behind the dialog to
|
|
3346
|
+
* scroll into view. To prevent this, we add a touchmove listener that cancels
|
|
3347
|
+
* the event if the touch started outside the dialog or any scrollable child within it.
|
|
3348
|
+
*
|
|
3349
|
+
* @private
|
|
3350
|
+
*/
|
|
3351
|
+
_lockTouchScroll() {
|
|
3352
|
+
const dialog = this.shadowRoot.querySelector('dialog');
|
|
3353
|
+
|
|
3354
|
+
this._touchMoveHandler = (event) => {
|
|
3355
|
+
// Walk the composed path (which crosses shadow DOM boundaries) to
|
|
3356
|
+
// check whether the touch started inside a scrollable element that
|
|
3357
|
+
// lives within the dialog. If so, allow the scroll.
|
|
3358
|
+
for (const el of event.composedPath()) {
|
|
3359
|
+
if (el === dialog) {
|
|
3360
|
+
// Reached the dialog boundary without finding a scrollable child.
|
|
3361
|
+
break;
|
|
3362
|
+
}
|
|
3363
|
+
if (el instanceof HTMLElement && el.scrollHeight > el.clientHeight) {
|
|
3364
|
+
const { overflowY } = getComputedStyle(el);
|
|
3365
|
+
if (overflowY === 'auto' || overflowY === 'scroll') {
|
|
3366
|
+
return;
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
|
|
3371
|
+
event.preventDefault();
|
|
3372
|
+
};
|
|
3373
|
+
|
|
3374
|
+
document.addEventListener('touchmove', this._touchMoveHandler, { passive: false });
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3377
|
+
/**
|
|
3378
|
+
* Removes the touchmove listener added by _lockTouchScroll().
|
|
3379
|
+
* @private
|
|
3380
|
+
*/
|
|
3381
|
+
_unlockTouchScroll() {
|
|
3382
|
+
if (this._touchMoveHandler) {
|
|
3383
|
+
document.removeEventListener('touchmove', this._touchMoveHandler);
|
|
3384
|
+
this._touchMoveHandler = undefined;
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
|
|
3388
|
+
open(modal = true) {
|
|
3389
|
+
const dialog = this.shadowRoot.querySelector('dialog');
|
|
3390
|
+
if (dialog && !dialog.open) {
|
|
3391
|
+
if (modal) {
|
|
3392
|
+
// Prevent showModal() from scrolling the page to bring the dialog
|
|
3393
|
+
// into view. Locking overflow on <html> blocks the viewport scroll
|
|
3394
|
+
// that browsers perform natively; we release it immediately after
|
|
3395
|
+
// so it doesn't interfere with the modal's focus management.
|
|
3396
|
+
const { documentElement } = document;
|
|
3397
|
+
const prevOverflow = documentElement.style.overflow;
|
|
3398
|
+
documentElement.style.overflow = 'hidden';
|
|
3399
|
+
|
|
3400
|
+
dialog.showModal();
|
|
3401
|
+
|
|
3402
|
+
documentElement.style.overflow = prevOverflow;
|
|
3403
|
+
|
|
3404
|
+
this._lockTouchScroll();
|
|
3405
|
+
|
|
3406
|
+
} else {
|
|
3407
|
+
// Use setAttribute instead of dialog.show() to avoid the dialog
|
|
3408
|
+
// focusing steps which steal focus from the trigger and cause
|
|
3409
|
+
// the floater's handleFocusLoss() to immediately hide the bib.
|
|
3410
|
+
dialog.setAttribute('open', '');
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
|
|
3415
|
+
/**
|
|
3416
|
+
* Closes the dialog.
|
|
3417
|
+
*/
|
|
3418
|
+
close() {
|
|
3419
|
+
const dialog = this.shadowRoot.querySelector('dialog');
|
|
3420
|
+
if (dialog && dialog.open) {
|
|
3421
|
+
this._unlockTouchScroll();
|
|
3422
|
+
dialog.close();
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3148
3426
|
// function that renders the HTML and CSS into the scope of the component
|
|
3149
3427
|
render() {
|
|
3150
3428
|
const classes = {
|
|
@@ -3156,9 +3434,10 @@ class AuroDropdownBib extends i {
|
|
|
3156
3434
|
classes[`shape-${this.shape}`] = true;
|
|
3157
3435
|
|
|
3158
3436
|
return u$2`
|
|
3159
|
-
<
|
|
3437
|
+
<dialog class="${e$3(classes)}" part="bibContainer" role="${o(this.dialogRole)}" aria-labelledby="${o(this.dialogLabel ? 'dialogLabel' : undefined)}">
|
|
3438
|
+
${this.dialogLabel ? u$2`<span id="dialogLabel" class="util_displayHiddenVisually" aria-hidden="true">${this.dialogLabel}</span>` : ''}
|
|
3160
3439
|
<slot></slot>
|
|
3161
|
-
</
|
|
3440
|
+
</dialog>
|
|
3162
3441
|
`;
|
|
3163
3442
|
}
|
|
3164
3443
|
}
|
|
@@ -3167,7 +3446,7 @@ var shapeSizeCss = i$2`.shape-classic-xl,.shape-classic-lg,.shape-classic-md,.sh
|
|
|
3167
3446
|
|
|
3168
3447
|
var colorCss$1 = i$2`:host(:not([layout*=classic])){--ds-auro-dropdown-trigger-border-color: transparent}:host(:not([disabled],[onDark])) .wrapper:focus-within,:host(:not([disabled],[onDark])) .wrapper:active,:host(:not([disabled],[appearance=inverse])) .wrapper:focus-within,:host(:not([disabled],[appearance=inverse])) .wrapper:active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused, #01426a);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused, #01426a)}:host(:not([disabled],[onDark])) .wrapper:hover,:host(:not([disabled],[appearance=inverse])) .wrapper:hover{--ds-auro-dropdown-trigger-background-color: var(--ds-auro-dropdown-trigger-hover-background-color)}:host(:not([ondark])) .wrapper,:host(:not([appearance=inverse])) .wrapper{border-color:var(--ds-auro-dropdown-trigger-border-color);background-color:var(--ds-auro-dropdown-trigger-background-color);color:var(--ds-auro-dropdown-trigger-text-color)}:host(:not([onDark])[disabled]),:host(:not([appearance=inverse])[disabled]){--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0);--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0);--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-subtle, #dddddd)}:host(:not([onDark])[disabled]) #triggerLabel,:host(:not([appearance=inverse])[disabled]) #triggerLabel{cursor:default}:host(:not([ondark])[error]),:host(:not([appearance=inverse])[error]){--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-status-error, #e31f26)}:host(:not([disabled])[onDark]) .wrapper:focus-within,:host(:not([disabled])[onDark]) .wrapper:active,:host(:not([disabled])[appearance=inverse]) .wrapper:focus-within,:host(:not([disabled])[appearance=inverse]) .wrapper:active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused-inverse, #ffffff);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused-inverse, #ffffff)}:host(:not([disabled])[onDark]) .wrapper:hover,:host(:not([disabled])[appearance=inverse]) .wrapper:hover{--ds-auro-dropdown-trigger-background-color: var(--ds-auro-dropdown-trigger-hover-background-color)}:host([onDark]) .label,:host([onDark]) .helpText,:host([appearance=inverse]) .label,:host([appearance=inverse]) .helpText{color:var(--ds-auro-dropdown-label-text-color)}:host([onDark]) .wrapper,:host([appearance=inverse]) .wrapper{border-color:var(--ds-auro-dropdown-trigger-border-color);background-color:var(--ds-auro-dropdown-trigger-background-color);color:var(--ds-auro-dropdown-trigger-text-color)}:host([onDark][disabled]),:host([appearance=inverse][disabled]){--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894);--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894);--ds-auro-dropdown-trigger-container-color: var(--ds-advanced-color-shared-background-inverse-disabled, rgba(255, 255, 255, 0.1))}:host([onDark][disabled]) #triggerLabel,:host([appearance=inverse][disabled]) #triggerLabel{cursor:default}:host([ondark][error]),:host([appearance=inverse][error]){--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}`;
|
|
3169
3448
|
|
|
3170
|
-
var styleCss$1 = i$2`:host{position:relative;display:block;text-align:left}
|
|
3449
|
+
var styleCss$1 = i$2`:host{position:relative;display:block;text-align:left}:host([open]){z-index:var(--depth-tooltip, 400)}.wrapper{display:flex;flex:1;flex-direction:row;align-items:center;justify-content:center;outline:none}.triggerContentWrapper{display:flex;overflow:hidden;width:100%;flex:1;align-items:center;justify-content:center;text-overflow:ellipsis;white-space:nowrap}:host([matchwidth]) #bibSizer{width:100%}`;
|
|
3171
3450
|
|
|
3172
3451
|
var classicColorCss = i$2``;
|
|
3173
3452
|
|
|
@@ -3405,7 +3684,7 @@ class AuroHelpText extends i {
|
|
|
3405
3684
|
}
|
|
3406
3685
|
}
|
|
3407
3686
|
|
|
3408
|
-
var formkitVersion = '
|
|
3687
|
+
var formkitVersion = '202603102257';
|
|
3409
3688
|
|
|
3410
3689
|
class AuroElement extends i {
|
|
3411
3690
|
static get properties() {
|
|
@@ -3519,7 +3798,7 @@ class AuroElement extends i {
|
|
|
3519
3798
|
* The `auro-dropdown` element provides a way to place content in a bib that can be toggled.
|
|
3520
3799
|
* @customElement auro-dropdown
|
|
3521
3800
|
*
|
|
3522
|
-
* @slot - Default slot for the
|
|
3801
|
+
* @slot - Default slot for the dropdown bib content.
|
|
3523
3802
|
* @slot helpText - Defines the content of the helpText.
|
|
3524
3803
|
* @slot trigger - Defines the content of the trigger.
|
|
3525
3804
|
* @csspart trigger - The trigger content container.
|
|
@@ -3531,6 +3810,13 @@ class AuroElement extends i {
|
|
|
3531
3810
|
* @event auroDropdown-idAdded - Notifies consumers that the unique ID for the dropdown bib has been generated.
|
|
3532
3811
|
*/
|
|
3533
3812
|
class AuroDropdown extends AuroElement {
|
|
3813
|
+
static get shadowRootOptions() {
|
|
3814
|
+
return {
|
|
3815
|
+
...AuroElement.shadowRootOptions,
|
|
3816
|
+
delegatesFocus: true,
|
|
3817
|
+
};
|
|
3818
|
+
}
|
|
3819
|
+
|
|
3534
3820
|
constructor() {
|
|
3535
3821
|
super();
|
|
3536
3822
|
|
|
@@ -3552,7 +3838,7 @@ class AuroDropdown extends AuroElement {
|
|
|
3552
3838
|
this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
|
|
3553
3839
|
|
|
3554
3840
|
/** @private */
|
|
3555
|
-
this.bibElement = e();
|
|
3841
|
+
this.bibElement = e$2();
|
|
3556
3842
|
|
|
3557
3843
|
this._intializeDefaults();
|
|
3558
3844
|
}
|
|
@@ -3596,15 +3882,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3596
3882
|
this.shift = false;
|
|
3597
3883
|
this.autoPlacement = false;
|
|
3598
3884
|
|
|
3599
|
-
/**
|
|
3600
|
-
* @private
|
|
3601
|
-
* @property {boolean} delegatesFocus - Whether the shadow root delegates focus.
|
|
3602
|
-
*/
|
|
3603
|
-
this.constructor.shadowRootOptions = {
|
|
3604
|
-
...i.shadowRootOptions,
|
|
3605
|
-
delegatesFocus: true,
|
|
3606
|
-
};
|
|
3607
|
-
|
|
3608
3885
|
/**
|
|
3609
3886
|
* @private
|
|
3610
3887
|
*/
|
|
@@ -3678,6 +3955,18 @@ class AuroDropdown extends AuroElement {
|
|
|
3678
3955
|
*/
|
|
3679
3956
|
show() {
|
|
3680
3957
|
this.floater.showBib();
|
|
3958
|
+
|
|
3959
|
+
// Open dialog synchronously so callers remain in the user gesture
|
|
3960
|
+
// chain. This is critical for mobile browsers (iOS Safari) to keep
|
|
3961
|
+
// the virtual keyboard open when transitioning from the trigger
|
|
3962
|
+
// input to an input inside the fullscreen dialog. Without this,
|
|
3963
|
+
// showModal() fires asynchronously via Lit's update cycle, which
|
|
3964
|
+
// falls outside the user activation window and causes iOS to
|
|
3965
|
+
// dismiss the keyboard.
|
|
3966
|
+
if (this.isBibFullscreen && this.bibElement && this.bibElement.value) {
|
|
3967
|
+
const useModal = !this.disableFocusTrap;
|
|
3968
|
+
this.bibElement.value.open(useModal);
|
|
3969
|
+
}
|
|
3681
3970
|
}
|
|
3682
3971
|
|
|
3683
3972
|
/**
|
|
@@ -3685,13 +3974,37 @@ class AuroDropdown extends AuroElement {
|
|
|
3685
3974
|
* If not, trigger element will get focus.
|
|
3686
3975
|
*/
|
|
3687
3976
|
focus() {
|
|
3688
|
-
if (this.isPopoverVisible && this.
|
|
3689
|
-
this.
|
|
3977
|
+
if (this.isPopoverVisible && this.bibContent) {
|
|
3978
|
+
const focusables = getFocusableElements(this.bibContent);
|
|
3979
|
+
if (focusables.length > 0) {
|
|
3980
|
+
focusables[0].focus();
|
|
3981
|
+
}
|
|
3690
3982
|
} else {
|
|
3691
3983
|
this.trigger.focus();
|
|
3692
3984
|
}
|
|
3693
3985
|
}
|
|
3694
3986
|
|
|
3987
|
+
/**
|
|
3988
|
+
* Sets the active descendant element for accessibility.
|
|
3989
|
+
* Uses ariaActiveDescendantElement to cross shadow DOM boundaries.
|
|
3990
|
+
* This function is used in components that contain `auro-dropdown` to set the active descendant.
|
|
3991
|
+
* @private
|
|
3992
|
+
* @param {HTMLElement|null} element - The element to set as the active descendant, or null to clear.
|
|
3993
|
+
* @returns {void}
|
|
3994
|
+
*/
|
|
3995
|
+
setActiveDescendant(element) {
|
|
3996
|
+
if (!this.trigger) {
|
|
3997
|
+
return;
|
|
3998
|
+
}
|
|
3999
|
+
|
|
4000
|
+
if (element) {
|
|
4001
|
+
this.trigger.ariaActiveDescendantElement = element;
|
|
4002
|
+
} else {
|
|
4003
|
+
this.trigger.ariaActiveDescendantElement = null;
|
|
4004
|
+
this.trigger.removeAttribute('aria-activedescendant');
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
|
|
3695
4008
|
// function to define props used within the scope of this component
|
|
3696
4009
|
static get properties() {
|
|
3697
4010
|
return {
|
|
@@ -3949,6 +4262,16 @@ class AuroDropdown extends AuroElement {
|
|
|
3949
4262
|
*/
|
|
3950
4263
|
tabIndex: {
|
|
3951
4264
|
type: Number
|
|
4265
|
+
},
|
|
4266
|
+
|
|
4267
|
+
/**
|
|
4268
|
+
* Accessible label for the dropdown bib dialog element.
|
|
4269
|
+
* @private
|
|
4270
|
+
*/
|
|
4271
|
+
bibDialogLabel: {
|
|
4272
|
+
type: String,
|
|
4273
|
+
attribute: false,
|
|
4274
|
+
reflect: false
|
|
3952
4275
|
}
|
|
3953
4276
|
};
|
|
3954
4277
|
}
|
|
@@ -4000,7 +4323,10 @@ class AuroDropdown extends AuroElement {
|
|
|
4000
4323
|
|
|
4001
4324
|
disconnectedCallback() {
|
|
4002
4325
|
super.disconnectedCallback();
|
|
4003
|
-
this.floater
|
|
4326
|
+
if (this.floater) {
|
|
4327
|
+
this.floater.hideBib('disconnect');
|
|
4328
|
+
this.floater.disconnect();
|
|
4329
|
+
}
|
|
4004
4330
|
this.clearTriggerFocusEventBinding();
|
|
4005
4331
|
}
|
|
4006
4332
|
|
|
@@ -4022,11 +4348,22 @@ class AuroDropdown extends AuroElement {
|
|
|
4022
4348
|
|
|
4023
4349
|
if (changedProperties.has('isPopoverVisible') && this.bibElement.value) {
|
|
4024
4350
|
if (this.isPopoverVisible) {
|
|
4025
|
-
|
|
4351
|
+
// Fullscreen: use showModal() for native accessibility (inert outside, focus trap)
|
|
4352
|
+
// Desktop: use show() for Floating UI positioning + FocusTrap for focus management
|
|
4353
|
+
const useModal = this.isBibFullscreen && !this.disableFocusTrap;
|
|
4354
|
+
this.bibElement.value.open(useModal);
|
|
4026
4355
|
} else {
|
|
4027
|
-
this.bibElement.value.
|
|
4356
|
+
this.bibElement.value.close();
|
|
4028
4357
|
}
|
|
4029
4358
|
}
|
|
4359
|
+
|
|
4360
|
+
// When fullscreen strategy changes while open, re-open dialog with correct mode
|
|
4361
|
+
// (e.g. resizing from desktop → mobile while dropdown is open)
|
|
4362
|
+
if (changedProperties.has('isBibFullscreen') && this.isPopoverVisible && this.bibElement.value) {
|
|
4363
|
+
const useModal = this.isBibFullscreen && !this.disableFocusTrap;
|
|
4364
|
+
this.bibElement.value.close();
|
|
4365
|
+
this.bibElement.value.open(useModal);
|
|
4366
|
+
}
|
|
4030
4367
|
}
|
|
4031
4368
|
|
|
4032
4369
|
/**
|
|
@@ -4044,11 +4381,28 @@ class AuroDropdown extends AuroElement {
|
|
|
4044
4381
|
}
|
|
4045
4382
|
|
|
4046
4383
|
firstUpdated() {
|
|
4047
|
-
|
|
4048
4384
|
// Configure the floater to, this will generate the ID for the bib
|
|
4049
4385
|
this.floater.configure(this, 'auroDropdown');
|
|
4386
|
+
|
|
4387
|
+
// Prevent `contain: layout` on the dropdown host. Layout containment
|
|
4388
|
+
// creates a containing block for position:fixed descendants (the bib),
|
|
4389
|
+
// which clips the bib inside ancestor overflow contexts such as a
|
|
4390
|
+
// <dialog> element. Without it, the bib's position:fixed is relative
|
|
4391
|
+
// to the viewport, letting Floating UI's flip middleware detect
|
|
4392
|
+
// viewport boundaries and the bib escape overflow clipping.
|
|
4393
|
+
const origConfigureBibStrategy = this.floater.configureBibStrategy.bind(this.floater);
|
|
4394
|
+
this.floater.configureBibStrategy = (value) => {
|
|
4395
|
+
origConfigureBibStrategy(value);
|
|
4396
|
+
this.style.contain = '';
|
|
4397
|
+
};
|
|
4398
|
+
|
|
4050
4399
|
this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
|
|
4051
4400
|
|
|
4401
|
+
// Handle ESC key from dialog's cancel event
|
|
4402
|
+
this.addEventListener('auro-bib-cancel', () => {
|
|
4403
|
+
this.floater.hideBib('keydown');
|
|
4404
|
+
});
|
|
4405
|
+
|
|
4052
4406
|
/**
|
|
4053
4407
|
* @description Let subscribers know that the dropdown ID ha been generated and added.
|
|
4054
4408
|
* @event auroDropdown-idAdded
|
|
@@ -4056,9 +4410,9 @@ class AuroDropdown extends AuroElement {
|
|
|
4056
4410
|
*/
|
|
4057
4411
|
this.dispatchEvent(new CustomEvent('auroDropdown-idAdded', {detail: {id: this.floater.element.id}}));
|
|
4058
4412
|
|
|
4059
|
-
// Set the bib ID locally
|
|
4413
|
+
// Set the bib ID locally for aria-controls (must be in the same shadow root as the trigger)
|
|
4060
4414
|
if (!this.triggerContentFocusable) {
|
|
4061
|
-
this.dropdownId = this.floater.element.id;
|
|
4415
|
+
this.dropdownId = this.floater.element.bib.id;
|
|
4062
4416
|
}
|
|
4063
4417
|
|
|
4064
4418
|
this.bibContent = this.floater.element.bib;
|
|
@@ -4118,21 +4472,20 @@ class AuroDropdown extends AuroElement {
|
|
|
4118
4472
|
* @private
|
|
4119
4473
|
*/
|
|
4120
4474
|
updateFocusTrap() {
|
|
4121
|
-
// If the dropdown is open, create a focus trap and focus the first element
|
|
4122
4475
|
if (this.isPopoverVisible && !this.disableFocusTrap) {
|
|
4123
|
-
|
|
4124
|
-
|
|
4476
|
+
if (!this.isBibFullscreen) {
|
|
4477
|
+
// Desktop: show() doesn't trap focus, so use FocusTrap
|
|
4478
|
+
this.focusTrap = new FocusTrap(this.bibContent);
|
|
4479
|
+
this.focusTrap.focusFirstElement();
|
|
4480
|
+
}
|
|
4481
|
+
// Fullscreen: showModal() provides native focus trapping
|
|
4125
4482
|
return;
|
|
4126
4483
|
}
|
|
4127
4484
|
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4485
|
+
if (this.focusTrap) {
|
|
4486
|
+
this.focusTrap.disconnect();
|
|
4487
|
+
this.focusTrap = undefined;
|
|
4131
4488
|
}
|
|
4132
|
-
|
|
4133
|
-
// If the dropdown is not open, disconnect the focus trap if it exists
|
|
4134
|
-
this.focusTrap.disconnect();
|
|
4135
|
-
this.focusTrap = undefined;
|
|
4136
4489
|
}
|
|
4137
4490
|
|
|
4138
4491
|
/**
|
|
@@ -4348,13 +4701,14 @@ class AuroDropdown extends AuroElement {
|
|
|
4348
4701
|
<div
|
|
4349
4702
|
id="showStateIcon"
|
|
4350
4703
|
class="chevron"
|
|
4351
|
-
part="chevron"
|
|
4704
|
+
part="chevron"
|
|
4705
|
+
aria-hidden="true">
|
|
4352
4706
|
<${this.iconTag}
|
|
4353
4707
|
category="interface"
|
|
4354
4708
|
name="${this.isPopoverVisible ? 'chevron-up' : `chevron-down`}"
|
|
4355
4709
|
appearance="${this.onDark ? 'inverse' : this.appearance}"
|
|
4356
|
-
variant="${this.disabled ? 'disabled' : 'muted'}"
|
|
4357
|
-
>
|
|
4710
|
+
variant="${this.disabled ? 'disabled' : 'muted'}"
|
|
4711
|
+
ariaHidden="true">
|
|
4358
4712
|
</${this.iconTag}>
|
|
4359
4713
|
</div>
|
|
4360
4714
|
` : undefined }
|
|
@@ -4368,8 +4722,8 @@ class AuroDropdown extends AuroElement {
|
|
|
4368
4722
|
shape="${this.shape}"
|
|
4369
4723
|
?data-show="${this.isPopoverVisible}"
|
|
4370
4724
|
?isfullscreen="${this.isBibFullscreen}"
|
|
4371
|
-
${
|
|
4372
|
-
|
|
4725
|
+
.dialogLabel="${this.bibDialogLabel}"
|
|
4726
|
+
${n$2(this.bibElement)}
|
|
4373
4727
|
>
|
|
4374
4728
|
<div class="slotContent">
|
|
4375
4729
|
<slot @slotchange="${this.handleDefaultSlot}"></slot>
|