@aurodesignsystem-dev/auro-formkit 0.0.0-pr1413.2 → 0.0.0-pr1420.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.
Files changed (231) hide show
  1. package/package.json +32 -31
  2. package/components/bibtemplate/dist/auro-bibtemplate.d.ts +0 -66
  3. package/components/bibtemplate/dist/buttonVersion.d.ts +0 -2
  4. package/components/bibtemplate/dist/headerVersion.d.ts +0 -2
  5. package/components/bibtemplate/dist/iconVersion.d.ts +0 -2
  6. package/components/bibtemplate/dist/index.d.ts +0 -2
  7. package/components/bibtemplate/dist/index.js +0 -395
  8. package/components/bibtemplate/dist/registered.js +0 -395
  9. package/components/bibtemplate/dist/styles/color-css.d.ts +0 -2
  10. package/components/bibtemplate/dist/styles/style-css.d.ts +0 -2
  11. package/components/bibtemplate/dist/styles/tokens-css.d.ts +0 -2
  12. package/components/checkbox/demo/api.md +0 -489
  13. package/components/checkbox/demo/api.min.js +0 -2133
  14. package/components/checkbox/demo/index.md +0 -55
  15. package/components/checkbox/demo/index.min.js +0 -2108
  16. package/components/checkbox/demo/keyboardBehavior.md +0 -0
  17. package/components/checkbox/demo/readme.md +0 -142
  18. package/components/checkbox/dist/auro-checkbox-group.d.ts +0 -176
  19. package/components/checkbox/dist/auro-checkbox.d.ts +0 -209
  20. package/components/checkbox/dist/index.d.ts +0 -3
  21. package/components/checkbox/dist/index.js +0 -2057
  22. package/components/checkbox/dist/registered.js +0 -2058
  23. package/components/checkbox/dist/styles/auro-checkbox-css.d.ts +0 -2
  24. package/components/checkbox/dist/styles/auro-checkbox-group-css.d.ts +0 -2
  25. package/components/checkbox/dist/styles/color-css.d.ts +0 -2
  26. package/components/checkbox/dist/styles/colorGroup-css.d.ts +0 -2
  27. package/components/checkbox/dist/styles/tokens-css.d.ts +0 -2
  28. package/components/combobox/demo/api.md +0 -2287
  29. package/components/combobox/demo/api.min.js +0 -17800
  30. package/components/combobox/demo/index.md +0 -196
  31. package/components/combobox/demo/index.min.js +0 -17705
  32. package/components/combobox/demo/keyboardBehavior.md +0 -281
  33. package/components/combobox/demo/readme.md +0 -158
  34. package/components/combobox/dist/auro-combobox.d.ts +0 -566
  35. package/components/combobox/dist/comboboxKeyboardStrategy.d.ts +0 -8
  36. package/components/combobox/dist/index.d.ts +0 -2
  37. package/components/combobox/dist/index.js +0 -15604
  38. package/components/combobox/dist/registered.js +0 -15606
  39. package/components/combobox/dist/styles/emphasized/style-css.d.ts +0 -2
  40. package/components/combobox/dist/styles/snowflake/style-css.d.ts +0 -2
  41. package/components/combobox/dist/styles/style-css.d.ts +0 -2
  42. package/components/counter/demo/api.md +0 -1285
  43. package/components/counter/demo/api.min.js +0 -8112
  44. package/components/counter/demo/index.md +0 -92
  45. package/components/counter/demo/index.min.js +0 -8093
  46. package/components/counter/demo/keyboardBehavior.md +0 -127
  47. package/components/counter/demo/readme.md +0 -161
  48. package/components/counter/dist/auro-counter-button.d.ts +0 -14
  49. package/components/counter/dist/auro-counter-group.d.ts +0 -390
  50. package/components/counter/dist/auro-counter-wrapper.d.ts +0 -17
  51. package/components/counter/dist/auro-counter.d.ts +0 -136
  52. package/components/counter/dist/buttonVersion.d.ts +0 -2
  53. package/components/counter/dist/iconVersion.d.ts +0 -2
  54. package/components/counter/dist/index.d.ts +0 -3
  55. package/components/counter/dist/index.js +0 -8015
  56. package/components/counter/dist/keyboardStrategy.d.ts +0 -4
  57. package/components/counter/dist/registered.js +0 -8016
  58. package/components/counter/dist/styles/color-css.d.ts +0 -2
  59. package/components/counter/dist/styles/counter-button-color-css.d.ts +0 -2
  60. package/components/counter/dist/styles/counter-button-css.d.ts +0 -2
  61. package/components/counter/dist/styles/counter-group-css.d.ts +0 -2
  62. package/components/counter/dist/styles/counter-wrapper-color-css.d.ts +0 -2
  63. package/components/counter/dist/styles/counter-wrapper-css.d.ts +0 -2
  64. package/components/counter/dist/styles/shapeSize-css.d.ts +0 -2
  65. package/components/counter/dist/styles/style-css.d.ts +0 -2
  66. package/components/counter/dist/styles/tokens-css.d.ts +0 -2
  67. package/components/datepicker/demo/api.md +0 -1824
  68. package/components/datepicker/demo/api.min.js +0 -24510
  69. package/components/datepicker/demo/index.md +0 -158
  70. package/components/datepicker/demo/index.min.js +0 -24231
  71. package/components/datepicker/demo/keyboardBehavior.md +0 -24
  72. package/components/datepicker/demo/readme.md +0 -137
  73. package/components/datepicker/dist/auro-calendar-cell.d.ts +0 -169
  74. package/components/datepicker/dist/auro-calendar-month.d.ts +0 -20
  75. package/components/datepicker/dist/auro-calendar.d.ts +0 -173
  76. package/components/datepicker/dist/auro-datepicker.d.ts +0 -715
  77. package/components/datepicker/dist/buttonVersion.d.ts +0 -2
  78. package/components/datepicker/dist/datepickerKeyboardStrategy.d.ts +0 -1
  79. package/components/datepicker/dist/iconVersion.d.ts +0 -2
  80. package/components/datepicker/dist/index.d.ts +0 -2
  81. package/components/datepicker/dist/index.js +0 -24146
  82. package/components/datepicker/dist/popoverVersion.d.ts +0 -2
  83. package/components/datepicker/dist/registered.js +0 -24146
  84. package/components/datepicker/dist/styles/classic/color-css.d.ts +0 -2
  85. package/components/datepicker/dist/styles/classic/style-css.d.ts +0 -2
  86. package/components/datepicker/dist/styles/color-calendar-css.d.ts +0 -2
  87. package/components/datepicker/dist/styles/color-cell-css.d.ts +0 -2
  88. package/components/datepicker/dist/styles/color-css.d.ts +0 -2
  89. package/components/datepicker/dist/styles/color-month-css.d.ts +0 -2
  90. package/components/datepicker/dist/styles/shapeSize-css.d.ts +0 -2
  91. package/components/datepicker/dist/styles/snowflake/color-css.d.ts +0 -2
  92. package/components/datepicker/dist/styles/snowflake/style-css.d.ts +0 -2
  93. package/components/datepicker/dist/styles/style-auro-calendar-cell-css.d.ts +0 -2
  94. package/components/datepicker/dist/styles/style-auro-calendar-css.d.ts +0 -2
  95. package/components/datepicker/dist/styles/style-auro-calendar-month-css.d.ts +0 -2
  96. package/components/datepicker/dist/styles/style-css.d.ts +0 -2
  97. package/components/datepicker/dist/styles/tokens-css.d.ts +0 -2
  98. package/components/datepicker/dist/utilities.d.ts +0 -78
  99. package/components/datepicker/dist/utilitiesCalendar.d.ts +0 -38
  100. package/components/datepicker/dist/utilitiesCalendarRender.d.ts +0 -50
  101. package/components/datepicker/dist/vendor/wc-range-datepicker/day.d.ts +0 -5
  102. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-calendar.d.ts +0 -60
  103. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-cell.d.ts +0 -1
  104. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker.d.ts +0 -57
  105. package/components/dropdown/demo/api.md +0 -1358
  106. package/components/dropdown/demo/api.min.js +0 -4894
  107. package/components/dropdown/demo/index.md +0 -283
  108. package/components/dropdown/demo/index.min.js +0 -4829
  109. package/components/dropdown/demo/keyboardBehavior.md +0 -77
  110. package/components/dropdown/demo/readme.md +0 -160
  111. package/components/dropdown/dist/auro-dropdown.d.ts +0 -482
  112. package/components/dropdown/dist/auro-dropdownBib.d.ts +0 -128
  113. package/components/dropdown/dist/dropdownBibKeyboardStrategy.d.ts +0 -7
  114. package/components/dropdown/dist/iconVersion.d.ts +0 -2
  115. package/components/dropdown/dist/index.d.ts +0 -2
  116. package/components/dropdown/dist/index.js +0 -4722
  117. package/components/dropdown/dist/registered.js +0 -4722
  118. package/components/dropdown/dist/styles/classic/bibColors-css.d.ts +0 -2
  119. package/components/dropdown/dist/styles/classic/bibStyles-css.d.ts +0 -2
  120. package/components/dropdown/dist/styles/classic/color-css.d.ts +0 -2
  121. package/components/dropdown/dist/styles/classic/style-css.d.ts +0 -2
  122. package/components/dropdown/dist/styles/color-css.d.ts +0 -2
  123. package/components/dropdown/dist/styles/emphasized/style-css.d.ts +0 -2
  124. package/components/dropdown/dist/styles/shapeSize-css.d.ts +0 -2
  125. package/components/dropdown/dist/styles/snowflake/style-css.d.ts +0 -2
  126. package/components/dropdown/dist/styles/style-css.d.ts +0 -2
  127. package/components/dropdown/dist/styles/tokens-css.d.ts +0 -2
  128. package/components/form/demo/api.md +0 -319
  129. package/components/form/demo/api.min.js +0 -70505
  130. package/components/form/demo/index.md +0 -128
  131. package/components/form/demo/index.min.js +0 -70505
  132. package/components/form/demo/keyboardBehavior.md +0 -0
  133. package/components/form/demo/readme.md +0 -145
  134. package/components/form/dist/auro-form.d.ts +0 -280
  135. package/components/form/dist/index.d.ts +0 -2
  136. package/components/form/dist/index.js +0 -718
  137. package/components/form/dist/registered.d.ts +0 -1
  138. package/components/form/dist/registered.js +0 -718
  139. package/components/form/dist/styles/style-css.d.ts +0 -2
  140. package/components/helptext/dist/auro-helptext.d.ts +0 -69
  141. package/components/helptext/dist/index.d.ts +0 -2
  142. package/components/helptext/dist/index.js +0 -231
  143. package/components/helptext/dist/registered.js +0 -231
  144. package/components/helptext/dist/styles/color-css.d.ts +0 -2
  145. package/components/helptext/dist/styles/style-css.d.ts +0 -2
  146. package/components/helptext/dist/styles/tokens-css.d.ts +0 -2
  147. package/components/input/demo/api.md +0 -1397
  148. package/components/input/demo/api.min.js +0 -7460
  149. package/components/input/demo/index.md +0 -161
  150. package/components/input/demo/index.min.js +0 -7380
  151. package/components/input/demo/keyboardBehavior.md +0 -0
  152. package/components/input/demo/readme.md +0 -134
  153. package/components/input/dist/auro-input.d.ts +0 -206
  154. package/components/input/dist/base-input.d.ts +0 -629
  155. package/components/input/dist/buttonVersion.d.ts +0 -2
  156. package/components/input/dist/i18n.d.ts +0 -18
  157. package/components/input/dist/iconVersion.d.ts +0 -2
  158. package/components/input/dist/index.d.ts +0 -2
  159. package/components/input/dist/index.js +0 -7292
  160. package/components/input/dist/registered.js +0 -7292
  161. package/components/input/dist/styles/classic/color-css.d.ts +0 -2
  162. package/components/input/dist/styles/classic/style-css.d.ts +0 -2
  163. package/components/input/dist/styles/color-css.d.ts +0 -2
  164. package/components/input/dist/styles/default/borders-css.d.ts +0 -2
  165. package/components/input/dist/styles/default/color-css.d.ts +0 -2
  166. package/components/input/dist/styles/default/mixins-css.d.ts +0 -2
  167. package/components/input/dist/styles/default/notificationIcons-css.d.ts +0 -2
  168. package/components/input/dist/styles/default/style-css.d.ts +0 -2
  169. package/components/input/dist/styles/emphasized/color-css.d.ts +0 -2
  170. package/components/input/dist/styles/emphasized/style-css.d.ts +0 -2
  171. package/components/input/dist/styles/mixins-css.d.ts +0 -2
  172. package/components/input/dist/styles/shapeSize-css.d.ts +0 -2
  173. package/components/input/dist/styles/snowflake/style-css.d.ts +0 -2
  174. package/components/input/dist/styles/style-css.d.ts +0 -2
  175. package/components/input/dist/styles/tokens-css.d.ts +0 -2
  176. package/components/input/dist/utilities.d.ts +0 -25
  177. package/components/layoutElement/dist/auroElement.d.ts +0 -40
  178. package/components/layoutElement/dist/index.d.ts +0 -2
  179. package/components/layoutElement/dist/index.js +0 -107
  180. package/components/layoutElement/dist/registered.js +0 -107
  181. package/components/menu/demo/api.md +0 -1200
  182. package/components/menu/demo/api.min.js +0 -2413
  183. package/components/menu/demo/index.md +0 -72
  184. package/components/menu/demo/index.min.js +0 -2306
  185. package/components/menu/demo/keyboardBehavior.md +0 -0
  186. package/components/menu/demo/readme.md +0 -145
  187. package/components/menu/dist/auro-menu-utils.d.ts +0 -34
  188. package/components/menu/dist/auro-menu.context.d.ts +0 -239
  189. package/components/menu/dist/auro-menu.d.ts +0 -316
  190. package/components/menu/dist/auro-menuoption.d.ts +0 -210
  191. package/components/menu/dist/iconVersion.d.ts +0 -2
  192. package/components/menu/dist/index.d.ts +0 -4
  193. package/components/menu/dist/index.js +0 -2269
  194. package/components/menu/dist/registered.js +0 -2217
  195. package/components/menu/dist/styles/default/color-menu-css.d.ts +0 -2
  196. package/components/menu/dist/styles/default/color-menuoption-css.d.ts +0 -2
  197. package/components/menu/dist/styles/default/style-menu-css.d.ts +0 -2
  198. package/components/menu/dist/styles/default/style-menuoption-css.d.ts +0 -2
  199. package/components/menu/dist/styles/default/tokens-css.d.ts +0 -2
  200. package/components/radio/demo/api.md +0 -675
  201. package/components/radio/demo/api.min.js +0 -2210
  202. package/components/radio/demo/index.md +0 -73
  203. package/components/radio/demo/index.min.js +0 -2167
  204. package/components/radio/demo/keyboardBehavior.md +0 -0
  205. package/components/radio/demo/readme.md +0 -141
  206. package/components/radio/dist/auro-radio-group.d.ts +0 -250
  207. package/components/radio/dist/auro-radio.d.ts +0 -180
  208. package/components/radio/dist/index.d.ts +0 -3
  209. package/components/radio/dist/index.js +0 -2116
  210. package/components/radio/dist/registered.js +0 -2117
  211. package/components/radio/dist/styles/auro-radio-group-css.d.ts +0 -2
  212. package/components/radio/dist/styles/color-css.d.ts +0 -2
  213. package/components/radio/dist/styles/groupColor-css.d.ts +0 -2
  214. package/components/radio/dist/styles/style-css.d.ts +0 -2
  215. package/components/radio/dist/styles/tokens-css.d.ts +0 -2
  216. package/components/select/demo/api.md +0 -2378
  217. package/components/select/demo/api.min.js +0 -10400
  218. package/components/select/demo/index.md +0 -355
  219. package/components/select/demo/index.min.js +0 -10307
  220. package/components/select/demo/keyboardBehavior.md +0 -246
  221. package/components/select/demo/readme.md +0 -148
  222. package/components/select/dist/auro-select.d.ts +0 -545
  223. package/components/select/dist/index.d.ts +0 -2
  224. package/components/select/dist/index.js +0 -8218
  225. package/components/select/dist/registered.js +0 -8218
  226. package/components/select/dist/selectKeyboardStrategy.d.ts +0 -11
  227. package/components/select/dist/styles/emphasized/color-css.d.ts +0 -2
  228. package/components/select/dist/styles/shapeSize-css.d.ts +0 -2
  229. package/components/select/dist/styles/style-css.d.ts +0 -2
  230. package/components/select/dist/styles/tokens-css.d.ts +0 -2
  231. package/custom-elements.json +0 -18768
@@ -1,4829 +0,0 @@
1
- function classicExample() {
2
- const btn = document.querySelector('#classicButton');
3
- const dropdown = document.querySelector('#classic');
4
-
5
- btn?.addEventListener('click', () => {
6
- dropdown?.hide();
7
- });
8
- }
9
-
10
- function classicInverseExample() {
11
- const btn = document.querySelector('#classicInverseButton');
12
- const dropdown = document.querySelector('#classicInverse');
13
-
14
- btn?.addEventListener('click', () => {
15
- dropdown?.hide();
16
- });
17
- }
18
-
19
- function customExample() {
20
- const btn = document.querySelector('#customCommonButton');
21
- const dropdown = document.querySelector('#customCommon');
22
-
23
- btn?.addEventListener('click', () => {
24
- dropdown?.hide();
25
- });
26
- }
27
-
28
- /**
29
- * @license
30
- * Copyright 2017 Google LLC
31
- * SPDX-License-Identifier: BSD-3-Clause
32
- */
33
- const t$2=globalThis,i$5=t=>t,s$4=t$2.trustedTypes,e$6=s$4?s$4.createPolicy("lit-html",{createHTML:t=>t}):void 0,h$3="$lit$",o$7=`lit$${Math.random().toFixed(9).slice(2)}$`,n$5="?"+o$7,r$4=`<${n$5}>`,l$2=document,c$3=()=>l$2.createComment(""),a$2=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u$3=Array.isArray,d$1=t=>u$3(t)||"function"==typeof t?.[Symbol.iterator],f$3="[ \t\n\f\r]",v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_$1=/-->/g,m$1=/>/g,p$2=RegExp(`>|${f$3}(?:([^\\s"'>=/]+)(${f$3}*=${f$3}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g$1=/'/g,$=/"/g,y$2=/^(?:script|style|textarea|title)$/i,x$1=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b$1=x$1(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l$2.createTreeWalker(l$2,129);function V(t,i){if(!u$3(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e$6?e$6.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v?"!--"===u[1]?c=_$1:void 0!==u[1]?c=m$1:void 0!==u[2]?(y$2.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p$2):void 0!==u[3]&&(c=p$2):c===p$2?">"===u[0]?(c=n??v,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p$2:'"'===u[3]?$:g$1):c===$||c===g$1?c=p$2:c===_$1||c===m$1?c=v:(c=p$2,n=void 0);const x=c===p$2&&t[i+1].startsWith("/>")?" ":"";l+=c===v?s+r$4:d>=0?(e.push(a),s.slice(0,d)+h$3+s.slice(d)+o$7+x):s+o$7+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};let S$1 = class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h$3)){const i=v[a++],s=r.getAttribute(t).split(o$7),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z$1:H}),r.removeAttribute(t);}else t.startsWith(o$7)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y$2.test(r.tagName)){const t=r.textContent.split(o$7),i=t.length-1;if(i>0){r.textContent=s$4?s$4.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c$3()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c$3());}}}else if(8===r.nodeType)if(r.data===n$5)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$7,t+1));)d.push({type:7,index:l}),t+=o$7.length-1;}l++;}}static createElement(t,i){const s=l$2.createElement("template");return s.innerHTML=t,s}};function M(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a$2(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=M(t,h._$AS(t,i.values),h,e)),i}class R{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??l$2).importNode(i,true);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l$2,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,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=M(this,t,i),a$2(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d$1(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!==A&&a$2(this._$AH)?this._$AA.nextSibling.data=t:this.T(l$2.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S$1.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S$1(t)),i}k(t){u$3(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 k(this.O(c$3()),this.O(c$3()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(false,true,s);t!==this._$AB;){const s=i$5(t).nextSibling;i$5(t).remove(),t=s;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,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=A;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=M(this,t,i,0),o=!a$2(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a$2(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class I extends H{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A);}}let z$1 = class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||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);}};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){M(this,t);}}const B=t$2.litHtmlPolyfillSupport;B?.(S$1,k),(t$2.litHtmlVersions??=[]).push("3.3.2");const D=(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 k(i.insertBefore(c$3(),t),t,void 0,s??{});}return h._$AI(t),h};
34
-
35
- /**
36
- * @license
37
- * Copyright 2020 Google LLC
38
- * SPDX-License-Identifier: BSD-3-Clause
39
- */
40
- const a$1=Symbol.for(""),o$6=t=>{if(t?.r===a$1)return t?._$litStatic$},s$3=t=>({_$litStatic$:t,r:a$1}),i$4=(t,...r)=>({_$litStatic$:r.reduce((r,e,a)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[a+1],t[0]),r:a$1}),l$1=new Map,n$4=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$6(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$1.get(t))&&(n.raw=n,l$1.set(t,r=n)),e=u;}return t(r,...e)},u$2=n$4(b$1);
41
-
42
- /**
43
- * @license
44
- * Copyright 2017 Google LLC
45
- * SPDX-License-Identifier: BSD-3-Clause
46
- */
47
- const t$1={ATTRIBUTE:1,CHILD:2},e$5=t=>(...e)=>({_$litDirective$:t,values:e});let i$3 = 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)}};
48
-
49
- /**
50
- * @license
51
- * Copyright 2018 Google LLC
52
- * SPDX-License-Identifier: BSD-3-Clause
53
- */const e$4=e$5(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}});
54
-
55
- /**
56
- * @license
57
- * Copyright 2020 Google LLC
58
- * SPDX-License-Identifier: BSD-3-Clause
59
- */const r$3=o=>void 0===o.strings;
60
-
61
- /**
62
- * @license
63
- * Copyright 2017 Google LLC
64
- * SPDX-License-Identifier: BSD-3-Clause
65
- */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(){}};
66
-
67
- /**
68
- * @license
69
- * Copyright 2020 Google LLC
70
- * SPDX-License-Identifier: BSD-3-Clause
71
- */const e$3=()=>new h$1;let h$1 = class h{};const o$4=new WeakMap,n$2=e$5(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);}});
72
-
73
- // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
74
- // See LICENSE in the project root for license information.
75
-
76
- // ---------------------------------------------------------------------
77
-
78
- /* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
79
-
80
- let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
81
-
82
- /* eslint-disable jsdoc/require-param */
83
-
84
- /**
85
- * This will register a new custom element with the browser.
86
- * @param {String} name - The name of the custom element.
87
- * @param {Object} componentClass - The class to register as a custom element.
88
- * @returns {void}
89
- */
90
- registerComponent(name, componentClass) {
91
- if (!customElements.get(name)) {
92
- customElements.define(name, class extends componentClass {});
93
- }
94
- }
95
-
96
- /**
97
- * Finds and returns the closest HTML Element based on a selector.
98
- * @returns {void}
99
- */
100
- closestElement(
101
- selector, // selector like in .closest()
102
- base = this, // extra functionality to skip a parent
103
- __Closest = (el, found = el && el.closest(selector)) =>
104
- !el || el === document || el === window
105
- ? null // standard .closest() returns null for non-found selectors also
106
- : found
107
- ? found // found a selector INside this element
108
- : __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
109
- ) {
110
- return __Closest(base);
111
- }
112
- /* eslint-enable jsdoc/require-param */
113
-
114
- /**
115
- * If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
116
- * @param {Object} elem - The element to check.
117
- * @param {String} tagName - The name of the Auro component to check for or add as an attribute.
118
- * @returns {void}
119
- */
120
- handleComponentTagRename(elem, tagName) {
121
- const tag = tagName.toLowerCase();
122
- const elemTag = elem.tagName.toLowerCase();
123
-
124
- if (elemTag !== tag) {
125
- elem.setAttribute(tag, true);
126
- }
127
- }
128
-
129
- /**
130
- * Validates if an element is a specific Auro component.
131
- * @param {Object} elem - The element to validate.
132
- * @param {String} tagName - The name of the Auro component to check against.
133
- * @returns {Boolean} - Returns true if the element is the specified Auro component.
134
- */
135
- elementMatch(elem, tagName) {
136
- const tag = tagName.toLowerCase();
137
- const elemTag = elem.tagName.toLowerCase();
138
-
139
- return elemTag === tag || elem.hasAttribute(tag);
140
- }
141
-
142
- /**
143
- * Gets the text content of a named slot.
144
- * @returns {String}
145
- * @private
146
- */
147
- getSlotText(elem, name) {
148
- const slot = elem.shadowRoot?.querySelector(`slot[name="${name}"]`);
149
- const nodes = slot?.assignedNodes({ flatten: true }) || [];
150
- const text = nodes.map(n => n.textContent?.trim()).join(' ').trim();
151
-
152
- return text || null;
153
- }
154
- };
155
-
156
- /**
157
- * Custom positioning reference element.
158
- * @see https://floating-ui.com/docs/virtual-elements
159
- */
160
-
161
- const sides = ['top', 'right', 'bottom', 'left'];
162
- const alignments = ['start', 'end'];
163
- const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
164
- const min = Math.min;
165
- const max = Math.max;
166
- const round = Math.round;
167
- const floor = Math.floor;
168
- const createCoords = v => ({
169
- x: v,
170
- y: v
171
- });
172
- const oppositeSideMap = {
173
- left: 'right',
174
- right: 'left',
175
- bottom: 'top',
176
- top: 'bottom'
177
- };
178
- const oppositeAlignmentMap = {
179
- start: 'end',
180
- end: 'start'
181
- };
182
- function clamp(start, value, end) {
183
- return max(start, min(value, end));
184
- }
185
- function evaluate(value, param) {
186
- return typeof value === 'function' ? value(param) : value;
187
- }
188
- function getSide(placement) {
189
- return placement.split('-')[0];
190
- }
191
- function getAlignment(placement) {
192
- return placement.split('-')[1];
193
- }
194
- function getOppositeAxis(axis) {
195
- return axis === 'x' ? 'y' : 'x';
196
- }
197
- function getAxisLength(axis) {
198
- return axis === 'y' ? 'height' : 'width';
199
- }
200
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
201
- function getSideAxis(placement) {
202
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
203
- }
204
- function getAlignmentAxis(placement) {
205
- return getOppositeAxis(getSideAxis(placement));
206
- }
207
- function getAlignmentSides(placement, rects, rtl) {
208
- if (rtl === void 0) {
209
- rtl = false;
210
- }
211
- const alignment = getAlignment(placement);
212
- const alignmentAxis = getAlignmentAxis(placement);
213
- const length = getAxisLength(alignmentAxis);
214
- let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
215
- if (rects.reference[length] > rects.floating[length]) {
216
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
217
- }
218
- return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
219
- }
220
- function getExpandedPlacements(placement) {
221
- const oppositePlacement = getOppositePlacement(placement);
222
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
223
- }
224
- function getOppositeAlignmentPlacement(placement) {
225
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
226
- }
227
- const lrPlacement = ['left', 'right'];
228
- const rlPlacement = ['right', 'left'];
229
- const tbPlacement = ['top', 'bottom'];
230
- const btPlacement = ['bottom', 'top'];
231
- function getSideList(side, isStart, rtl) {
232
- switch (side) {
233
- case 'top':
234
- case 'bottom':
235
- if (rtl) return isStart ? rlPlacement : lrPlacement;
236
- return isStart ? lrPlacement : rlPlacement;
237
- case 'left':
238
- case 'right':
239
- return isStart ? tbPlacement : btPlacement;
240
- default:
241
- return [];
242
- }
243
- }
244
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
245
- const alignment = getAlignment(placement);
246
- let list = getSideList(getSide(placement), direction === 'start', rtl);
247
- if (alignment) {
248
- list = list.map(side => side + "-" + alignment);
249
- if (flipAlignment) {
250
- list = list.concat(list.map(getOppositeAlignmentPlacement));
251
- }
252
- }
253
- return list;
254
- }
255
- function getOppositePlacement(placement) {
256
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
257
- }
258
- function expandPaddingObject(padding) {
259
- return {
260
- top: 0,
261
- right: 0,
262
- bottom: 0,
263
- left: 0,
264
- ...padding
265
- };
266
- }
267
- function getPaddingObject(padding) {
268
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
269
- top: padding,
270
- right: padding,
271
- bottom: padding,
272
- left: padding
273
- };
274
- }
275
- function rectToClientRect(rect) {
276
- const {
277
- x,
278
- y,
279
- width,
280
- height
281
- } = rect;
282
- return {
283
- width,
284
- height,
285
- top: y,
286
- left: x,
287
- right: x + width,
288
- bottom: y + height,
289
- x,
290
- y
291
- };
292
- }
293
-
294
- function computeCoordsFromPlacement(_ref, placement, rtl) {
295
- let {
296
- reference,
297
- floating
298
- } = _ref;
299
- const sideAxis = getSideAxis(placement);
300
- const alignmentAxis = getAlignmentAxis(placement);
301
- const alignLength = getAxisLength(alignmentAxis);
302
- const side = getSide(placement);
303
- const isVertical = sideAxis === 'y';
304
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
305
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
306
- const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
307
- let coords;
308
- switch (side) {
309
- case 'top':
310
- coords = {
311
- x: commonX,
312
- y: reference.y - floating.height
313
- };
314
- break;
315
- case 'bottom':
316
- coords = {
317
- x: commonX,
318
- y: reference.y + reference.height
319
- };
320
- break;
321
- case 'right':
322
- coords = {
323
- x: reference.x + reference.width,
324
- y: commonY
325
- };
326
- break;
327
- case 'left':
328
- coords = {
329
- x: reference.x - floating.width,
330
- y: commonY
331
- };
332
- break;
333
- default:
334
- coords = {
335
- x: reference.x,
336
- y: reference.y
337
- };
338
- }
339
- switch (getAlignment(placement)) {
340
- case 'start':
341
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
342
- break;
343
- case 'end':
344
- coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
345
- break;
346
- }
347
- return coords;
348
- }
349
-
350
- /**
351
- * Resolves with an object of overflow side offsets that determine how much the
352
- * element is overflowing a given clipping boundary on each side.
353
- * - positive = overflowing the boundary by that number of pixels
354
- * - negative = how many pixels left before it will overflow
355
- * - 0 = lies flush with the boundary
356
- * @see https://floating-ui.com/docs/detectOverflow
357
- */
358
- async function detectOverflow(state, options) {
359
- var _await$platform$isEle;
360
- if (options === void 0) {
361
- options = {};
362
- }
363
- const {
364
- x,
365
- y,
366
- platform,
367
- rects,
368
- elements,
369
- strategy
370
- } = state;
371
- const {
372
- boundary = 'clippingAncestors',
373
- rootBoundary = 'viewport',
374
- elementContext = 'floating',
375
- altBoundary = false,
376
- padding = 0
377
- } = evaluate(options, state);
378
- const paddingObject = getPaddingObject(padding);
379
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
380
- const element = elements[altBoundary ? altContext : elementContext];
381
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
382
- element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
383
- boundary,
384
- rootBoundary,
385
- strategy
386
- }));
387
- const rect = elementContext === 'floating' ? {
388
- x,
389
- y,
390
- width: rects.floating.width,
391
- height: rects.floating.height
392
- } : rects.reference;
393
- const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
394
- const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
395
- x: 1,
396
- y: 1
397
- } : {
398
- x: 1,
399
- y: 1
400
- };
401
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
402
- elements,
403
- rect,
404
- offsetParent,
405
- strategy
406
- }) : rect);
407
- return {
408
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
409
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
410
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
411
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
412
- };
413
- }
414
-
415
- /**
416
- * Computes the `x` and `y` coordinates that will place the floating element
417
- * next to a given reference element.
418
- *
419
- * This export does not have any `platform` interface logic. You will need to
420
- * write one for the platform you are using Floating UI with.
421
- */
422
- const computePosition$1 = async (reference, floating, config) => {
423
- const {
424
- placement = 'bottom',
425
- strategy = 'absolute',
426
- middleware = [],
427
- platform
428
- } = config;
429
- const validMiddleware = middleware.filter(Boolean);
430
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
431
- let rects = await platform.getElementRects({
432
- reference,
433
- floating,
434
- strategy
435
- });
436
- let {
437
- x,
438
- y
439
- } = computeCoordsFromPlacement(rects, placement, rtl);
440
- let statefulPlacement = placement;
441
- let middlewareData = {};
442
- let resetCount = 0;
443
- for (let i = 0; i < validMiddleware.length; i++) {
444
- var _platform$detectOverf;
445
- const {
446
- name,
447
- fn
448
- } = validMiddleware[i];
449
- const {
450
- x: nextX,
451
- y: nextY,
452
- data,
453
- reset
454
- } = await fn({
455
- x,
456
- y,
457
- initialPlacement: placement,
458
- placement: statefulPlacement,
459
- strategy,
460
- middlewareData,
461
- rects,
462
- platform: {
463
- ...platform,
464
- detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
465
- },
466
- elements: {
467
- reference,
468
- floating
469
- }
470
- });
471
- x = nextX != null ? nextX : x;
472
- y = nextY != null ? nextY : y;
473
- middlewareData = {
474
- ...middlewareData,
475
- [name]: {
476
- ...middlewareData[name],
477
- ...data
478
- }
479
- };
480
- if (reset && resetCount <= 50) {
481
- resetCount++;
482
- if (typeof reset === 'object') {
483
- if (reset.placement) {
484
- statefulPlacement = reset.placement;
485
- }
486
- if (reset.rects) {
487
- rects = reset.rects === true ? await platform.getElementRects({
488
- reference,
489
- floating,
490
- strategy
491
- }) : reset.rects;
492
- }
493
- ({
494
- x,
495
- y
496
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
497
- }
498
- i = -1;
499
- }
500
- }
501
- return {
502
- x,
503
- y,
504
- placement: statefulPlacement,
505
- strategy,
506
- middlewareData
507
- };
508
- };
509
-
510
- function getPlacementList(alignment, autoAlignment, allowedPlacements) {
511
- const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
512
- return allowedPlacementsSortedByAlignment.filter(placement => {
513
- if (alignment) {
514
- return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
515
- }
516
- return true;
517
- });
518
- }
519
- /**
520
- * Optimizes the visibility of the floating element by choosing the placement
521
- * that has the most space available automatically, without needing to specify a
522
- * preferred placement. Alternative to `flip`.
523
- * @see https://floating-ui.com/docs/autoPlacement
524
- */
525
- const autoPlacement$1 = function (options) {
526
- if (options === void 0) {
527
- options = {};
528
- }
529
- return {
530
- name: 'autoPlacement',
531
- options,
532
- async fn(state) {
533
- var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
534
- const {
535
- rects,
536
- middlewareData,
537
- placement,
538
- platform,
539
- elements
540
- } = state;
541
- const {
542
- crossAxis = false,
543
- alignment,
544
- allowedPlacements = placements,
545
- autoAlignment = true,
546
- ...detectOverflowOptions
547
- } = evaluate(options, state);
548
- const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
549
- const overflow = await platform.detectOverflow(state, detectOverflowOptions);
550
- const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
551
- const currentPlacement = placements$1[currentIndex];
552
- if (currentPlacement == null) {
553
- return {};
554
- }
555
- const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
556
-
557
- // Make `computeCoords` start from the right place.
558
- if (placement !== currentPlacement) {
559
- return {
560
- reset: {
561
- placement: placements$1[0]
562
- }
563
- };
564
- }
565
- const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
566
- const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
567
- placement: currentPlacement,
568
- overflows: currentOverflows
569
- }];
570
- const nextPlacement = placements$1[currentIndex + 1];
571
-
572
- // There are more placements to check.
573
- if (nextPlacement) {
574
- return {
575
- data: {
576
- index: currentIndex + 1,
577
- overflows: allOverflows
578
- },
579
- reset: {
580
- placement: nextPlacement
581
- }
582
- };
583
- }
584
- const placementsSortedByMostSpace = allOverflows.map(d => {
585
- const alignment = getAlignment(d.placement);
586
- return [d.placement, alignment && crossAxis ?
587
- // Check along the mainAxis and main crossAxis side.
588
- d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
589
- // Check only the mainAxis.
590
- d.overflows[0], d.overflows];
591
- }).sort((a, b) => a[1] - b[1]);
592
- const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
593
- // Aligned placements should not check their opposite crossAxis
594
- // side.
595
- getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
596
- const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
597
- if (resetPlacement !== placement) {
598
- return {
599
- data: {
600
- index: currentIndex + 1,
601
- overflows: allOverflows
602
- },
603
- reset: {
604
- placement: resetPlacement
605
- }
606
- };
607
- }
608
- return {};
609
- }
610
- };
611
- };
612
-
613
- /**
614
- * Optimizes the visibility of the floating element by flipping the `placement`
615
- * in order to keep it in view when the preferred placement(s) will overflow the
616
- * clipping boundary. Alternative to `autoPlacement`.
617
- * @see https://floating-ui.com/docs/flip
618
- */
619
- const flip$1 = function (options) {
620
- if (options === void 0) {
621
- options = {};
622
- }
623
- return {
624
- name: 'flip',
625
- options,
626
- async fn(state) {
627
- var _middlewareData$arrow, _middlewareData$flip;
628
- const {
629
- placement,
630
- middlewareData,
631
- rects,
632
- initialPlacement,
633
- platform,
634
- elements
635
- } = state;
636
- const {
637
- mainAxis: checkMainAxis = true,
638
- crossAxis: checkCrossAxis = true,
639
- fallbackPlacements: specifiedFallbackPlacements,
640
- fallbackStrategy = 'bestFit',
641
- fallbackAxisSideDirection = 'none',
642
- flipAlignment = true,
643
- ...detectOverflowOptions
644
- } = evaluate(options, state);
645
-
646
- // If a reset by the arrow was caused due to an alignment offset being
647
- // added, we should skip any logic now since `flip()` has already done its
648
- // work.
649
- // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
650
- if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
651
- return {};
652
- }
653
- const side = getSide(placement);
654
- const initialSideAxis = getSideAxis(initialPlacement);
655
- const isBasePlacement = getSide(initialPlacement) === initialPlacement;
656
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
657
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
658
- const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
659
- if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
660
- fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
661
- }
662
- const placements = [initialPlacement, ...fallbackPlacements];
663
- const overflow = await platform.detectOverflow(state, detectOverflowOptions);
664
- const overflows = [];
665
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
666
- if (checkMainAxis) {
667
- overflows.push(overflow[side]);
668
- }
669
- if (checkCrossAxis) {
670
- const sides = getAlignmentSides(placement, rects, rtl);
671
- overflows.push(overflow[sides[0]], overflow[sides[1]]);
672
- }
673
- overflowsData = [...overflowsData, {
674
- placement,
675
- overflows
676
- }];
677
-
678
- // One or more sides is overflowing.
679
- if (!overflows.every(side => side <= 0)) {
680
- var _middlewareData$flip2, _overflowsData$filter;
681
- const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
682
- const nextPlacement = placements[nextIndex];
683
- if (nextPlacement) {
684
- const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
685
- if (!ignoreCrossAxisOverflow ||
686
- // We leave the current main axis only if every placement on that axis
687
- // overflows the main axis.
688
- overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
689
- // Try next placement and re-run the lifecycle.
690
- return {
691
- data: {
692
- index: nextIndex,
693
- overflows: overflowsData
694
- },
695
- reset: {
696
- placement: nextPlacement
697
- }
698
- };
699
- }
700
- }
701
-
702
- // First, find the candidates that fit on the mainAxis side of overflow,
703
- // then find the placement that fits the best on the main crossAxis side.
704
- let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
705
-
706
- // Otherwise fallback.
707
- if (!resetPlacement) {
708
- switch (fallbackStrategy) {
709
- case 'bestFit':
710
- {
711
- var _overflowsData$filter2;
712
- const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
713
- if (hasFallbackAxisSideDirection) {
714
- const currentSideAxis = getSideAxis(d.placement);
715
- return currentSideAxis === initialSideAxis ||
716
- // Create a bias to the `y` side axis due to horizontal
717
- // reading directions favoring greater width.
718
- currentSideAxis === 'y';
719
- }
720
- return true;
721
- }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
722
- if (placement) {
723
- resetPlacement = placement;
724
- }
725
- break;
726
- }
727
- case 'initialPlacement':
728
- resetPlacement = initialPlacement;
729
- break;
730
- }
731
- }
732
- if (placement !== resetPlacement) {
733
- return {
734
- reset: {
735
- placement: resetPlacement
736
- }
737
- };
738
- }
739
- }
740
- return {};
741
- }
742
- };
743
- };
744
-
745
- const originSides = /*#__PURE__*/new Set(['left', 'top']);
746
-
747
- // For type backwards-compatibility, the `OffsetOptions` type was also
748
- // Derivable.
749
-
750
- async function convertValueToCoords(state, options) {
751
- const {
752
- placement,
753
- platform,
754
- elements
755
- } = state;
756
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
757
- const side = getSide(placement);
758
- const alignment = getAlignment(placement);
759
- const isVertical = getSideAxis(placement) === 'y';
760
- const mainAxisMulti = originSides.has(side) ? -1 : 1;
761
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
762
- const rawValue = evaluate(options, state);
763
-
764
- // eslint-disable-next-line prefer-const
765
- let {
766
- mainAxis,
767
- crossAxis,
768
- alignmentAxis
769
- } = typeof rawValue === 'number' ? {
770
- mainAxis: rawValue,
771
- crossAxis: 0,
772
- alignmentAxis: null
773
- } : {
774
- mainAxis: rawValue.mainAxis || 0,
775
- crossAxis: rawValue.crossAxis || 0,
776
- alignmentAxis: rawValue.alignmentAxis
777
- };
778
- if (alignment && typeof alignmentAxis === 'number') {
779
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
780
- }
781
- return isVertical ? {
782
- x: crossAxis * crossAxisMulti,
783
- y: mainAxis * mainAxisMulti
784
- } : {
785
- x: mainAxis * mainAxisMulti,
786
- y: crossAxis * crossAxisMulti
787
- };
788
- }
789
-
790
- /**
791
- * Modifies the placement by translating the floating element along the
792
- * specified axes.
793
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
794
- * object may be passed.
795
- * @see https://floating-ui.com/docs/offset
796
- */
797
- const offset$1 = function (options) {
798
- if (options === void 0) {
799
- options = 0;
800
- }
801
- return {
802
- name: 'offset',
803
- options,
804
- async fn(state) {
805
- var _middlewareData$offse, _middlewareData$arrow;
806
- const {
807
- x,
808
- y,
809
- placement,
810
- middlewareData
811
- } = state;
812
- const diffCoords = await convertValueToCoords(state, options);
813
-
814
- // If the placement is the same and the arrow caused an alignment offset
815
- // then we don't need to change the positioning coordinates.
816
- if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
817
- return {};
818
- }
819
- return {
820
- x: x + diffCoords.x,
821
- y: y + diffCoords.y,
822
- data: {
823
- ...diffCoords,
824
- placement
825
- }
826
- };
827
- }
828
- };
829
- };
830
-
831
- /**
832
- * Optimizes the visibility of the floating element by shifting it in order to
833
- * keep it in view when it will overflow the clipping boundary.
834
- * @see https://floating-ui.com/docs/shift
835
- */
836
- const shift$1 = function (options) {
837
- if (options === void 0) {
838
- options = {};
839
- }
840
- return {
841
- name: 'shift',
842
- options,
843
- async fn(state) {
844
- const {
845
- x,
846
- y,
847
- placement,
848
- platform
849
- } = state;
850
- const {
851
- mainAxis: checkMainAxis = true,
852
- crossAxis: checkCrossAxis = false,
853
- limiter = {
854
- fn: _ref => {
855
- let {
856
- x,
857
- y
858
- } = _ref;
859
- return {
860
- x,
861
- y
862
- };
863
- }
864
- },
865
- ...detectOverflowOptions
866
- } = evaluate(options, state);
867
- const coords = {
868
- x,
869
- y
870
- };
871
- const overflow = await platform.detectOverflow(state, detectOverflowOptions);
872
- const crossAxis = getSideAxis(getSide(placement));
873
- const mainAxis = getOppositeAxis(crossAxis);
874
- let mainAxisCoord = coords[mainAxis];
875
- let crossAxisCoord = coords[crossAxis];
876
- if (checkMainAxis) {
877
- const minSide = mainAxis === 'y' ? 'top' : 'left';
878
- const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
879
- const min = mainAxisCoord + overflow[minSide];
880
- const max = mainAxisCoord - overflow[maxSide];
881
- mainAxisCoord = clamp(min, mainAxisCoord, max);
882
- }
883
- if (checkCrossAxis) {
884
- const minSide = crossAxis === 'y' ? 'top' : 'left';
885
- const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
886
- const min = crossAxisCoord + overflow[minSide];
887
- const max = crossAxisCoord - overflow[maxSide];
888
- crossAxisCoord = clamp(min, crossAxisCoord, max);
889
- }
890
- const limitedCoords = limiter.fn({
891
- ...state,
892
- [mainAxis]: mainAxisCoord,
893
- [crossAxis]: crossAxisCoord
894
- });
895
- return {
896
- ...limitedCoords,
897
- data: {
898
- x: limitedCoords.x - x,
899
- y: limitedCoords.y - y,
900
- enabled: {
901
- [mainAxis]: checkMainAxis,
902
- [crossAxis]: checkCrossAxis
903
- }
904
- }
905
- };
906
- }
907
- };
908
- };
909
-
910
- function hasWindow() {
911
- return typeof window !== 'undefined';
912
- }
913
- function getNodeName(node) {
914
- if (isNode(node)) {
915
- return (node.nodeName || '').toLowerCase();
916
- }
917
- // Mocked nodes in testing environments may not be instances of Node. By
918
- // returning `#document` an infinite loop won't occur.
919
- // https://github.com/floating-ui/floating-ui/issues/2317
920
- return '#document';
921
- }
922
- function getWindow(node) {
923
- var _node$ownerDocument;
924
- return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
925
- }
926
- function getDocumentElement(node) {
927
- var _ref;
928
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
929
- }
930
- function isNode(value) {
931
- if (!hasWindow()) {
932
- return false;
933
- }
934
- return value instanceof Node || value instanceof getWindow(value).Node;
935
- }
936
- function isElement(value) {
937
- if (!hasWindow()) {
938
- return false;
939
- }
940
- return value instanceof Element || value instanceof getWindow(value).Element;
941
- }
942
- function isHTMLElement(value) {
943
- if (!hasWindow()) {
944
- return false;
945
- }
946
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
947
- }
948
- function isShadowRoot(value) {
949
- if (!hasWindow() || typeof ShadowRoot === 'undefined') {
950
- return false;
951
- }
952
- return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
953
- }
954
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
955
- function isOverflowElement(element) {
956
- const {
957
- overflow,
958
- overflowX,
959
- overflowY,
960
- display
961
- } = getComputedStyle$1(element);
962
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
963
- }
964
- const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
965
- function isTableElement(element) {
966
- return tableElements.has(getNodeName(element));
967
- }
968
- const topLayerSelectors = [':popover-open', ':modal'];
969
- function isTopLayer(element) {
970
- return topLayerSelectors.some(selector => {
971
- try {
972
- return element.matches(selector);
973
- } catch (_e) {
974
- return false;
975
- }
976
- });
977
- }
978
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
979
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
980
- const containValues = ['paint', 'layout', 'strict', 'content'];
981
- function isContainingBlock(elementOrCss) {
982
- const webkit = isWebKit();
983
- const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
984
-
985
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
986
- // https://drafts.csswg.org/css-transforms-2/#individual-transforms
987
- return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
988
- }
989
- function getContainingBlock(element) {
990
- let currentNode = getParentNode(element);
991
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
992
- if (isContainingBlock(currentNode)) {
993
- return currentNode;
994
- } else if (isTopLayer(currentNode)) {
995
- return null;
996
- }
997
- currentNode = getParentNode(currentNode);
998
- }
999
- return null;
1000
- }
1001
- function isWebKit() {
1002
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
1003
- return CSS.supports('-webkit-backdrop-filter', 'none');
1004
- }
1005
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
1006
- function isLastTraversableNode(node) {
1007
- return lastTraversableNodeNames.has(getNodeName(node));
1008
- }
1009
- function getComputedStyle$1(element) {
1010
- return getWindow(element).getComputedStyle(element);
1011
- }
1012
- function getNodeScroll(element) {
1013
- if (isElement(element)) {
1014
- return {
1015
- scrollLeft: element.scrollLeft,
1016
- scrollTop: element.scrollTop
1017
- };
1018
- }
1019
- return {
1020
- scrollLeft: element.scrollX,
1021
- scrollTop: element.scrollY
1022
- };
1023
- }
1024
- function getParentNode(node) {
1025
- if (getNodeName(node) === 'html') {
1026
- return node;
1027
- }
1028
- const result =
1029
- // Step into the shadow DOM of the parent of a slotted node.
1030
- node.assignedSlot ||
1031
- // DOM Element detected.
1032
- node.parentNode ||
1033
- // ShadowRoot detected.
1034
- isShadowRoot(node) && node.host ||
1035
- // Fallback.
1036
- getDocumentElement(node);
1037
- return isShadowRoot(result) ? result.host : result;
1038
- }
1039
- function getNearestOverflowAncestor(node) {
1040
- const parentNode = getParentNode(node);
1041
- if (isLastTraversableNode(parentNode)) {
1042
- return node.ownerDocument ? node.ownerDocument.body : node.body;
1043
- }
1044
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1045
- return parentNode;
1046
- }
1047
- return getNearestOverflowAncestor(parentNode);
1048
- }
1049
- function getOverflowAncestors(node, list, traverseIframes) {
1050
- var _node$ownerDocument2;
1051
- if (list === void 0) {
1052
- list = [];
1053
- }
1054
- if (traverseIframes === void 0) {
1055
- traverseIframes = true;
1056
- }
1057
- const scrollableAncestor = getNearestOverflowAncestor(node);
1058
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1059
- const win = getWindow(scrollableAncestor);
1060
- if (isBody) {
1061
- const frameElement = getFrameElement(win);
1062
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1063
- }
1064
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1065
- }
1066
- function getFrameElement(win) {
1067
- return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1068
- }
1069
-
1070
- function getCssDimensions(element) {
1071
- const css = getComputedStyle$1(element);
1072
- // In testing environments, the `width` and `height` properties are empty
1073
- // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1074
- let width = parseFloat(css.width) || 0;
1075
- let height = parseFloat(css.height) || 0;
1076
- const hasOffset = isHTMLElement(element);
1077
- const offsetWidth = hasOffset ? element.offsetWidth : width;
1078
- const offsetHeight = hasOffset ? element.offsetHeight : height;
1079
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1080
- if (shouldFallback) {
1081
- width = offsetWidth;
1082
- height = offsetHeight;
1083
- }
1084
- return {
1085
- width,
1086
- height,
1087
- $: shouldFallback
1088
- };
1089
- }
1090
-
1091
- function unwrapElement(element) {
1092
- return !isElement(element) ? element.contextElement : element;
1093
- }
1094
-
1095
- function getScale(element) {
1096
- const domElement = unwrapElement(element);
1097
- if (!isHTMLElement(domElement)) {
1098
- return createCoords(1);
1099
- }
1100
- const rect = domElement.getBoundingClientRect();
1101
- const {
1102
- width,
1103
- height,
1104
- $
1105
- } = getCssDimensions(domElement);
1106
- let x = ($ ? round(rect.width) : rect.width) / width;
1107
- let y = ($ ? round(rect.height) : rect.height) / height;
1108
-
1109
- // 0, NaN, or Infinity should always fallback to 1.
1110
-
1111
- if (!x || !Number.isFinite(x)) {
1112
- x = 1;
1113
- }
1114
- if (!y || !Number.isFinite(y)) {
1115
- y = 1;
1116
- }
1117
- return {
1118
- x,
1119
- y
1120
- };
1121
- }
1122
-
1123
- const noOffsets = /*#__PURE__*/createCoords(0);
1124
- function getVisualOffsets(element) {
1125
- const win = getWindow(element);
1126
- if (!isWebKit() || !win.visualViewport) {
1127
- return noOffsets;
1128
- }
1129
- return {
1130
- x: win.visualViewport.offsetLeft,
1131
- y: win.visualViewport.offsetTop
1132
- };
1133
- }
1134
- function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1135
- if (isFixed === void 0) {
1136
- isFixed = false;
1137
- }
1138
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1139
- return false;
1140
- }
1141
- return isFixed;
1142
- }
1143
-
1144
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1145
- if (includeScale === void 0) {
1146
- includeScale = false;
1147
- }
1148
- if (isFixedStrategy === void 0) {
1149
- isFixedStrategy = false;
1150
- }
1151
- const clientRect = element.getBoundingClientRect();
1152
- const domElement = unwrapElement(element);
1153
- let scale = createCoords(1);
1154
- if (includeScale) {
1155
- if (offsetParent) {
1156
- if (isElement(offsetParent)) {
1157
- scale = getScale(offsetParent);
1158
- }
1159
- } else {
1160
- scale = getScale(element);
1161
- }
1162
- }
1163
- const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1164
- let x = (clientRect.left + visualOffsets.x) / scale.x;
1165
- let y = (clientRect.top + visualOffsets.y) / scale.y;
1166
- let width = clientRect.width / scale.x;
1167
- let height = clientRect.height / scale.y;
1168
- if (domElement) {
1169
- const win = getWindow(domElement);
1170
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1171
- let currentWin = win;
1172
- let currentIFrame = getFrameElement(currentWin);
1173
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1174
- const iframeScale = getScale(currentIFrame);
1175
- const iframeRect = currentIFrame.getBoundingClientRect();
1176
- const css = getComputedStyle$1(currentIFrame);
1177
- const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1178
- const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1179
- x *= iframeScale.x;
1180
- y *= iframeScale.y;
1181
- width *= iframeScale.x;
1182
- height *= iframeScale.y;
1183
- x += left;
1184
- y += top;
1185
- currentWin = getWindow(currentIFrame);
1186
- currentIFrame = getFrameElement(currentWin);
1187
- }
1188
- }
1189
- return rectToClientRect({
1190
- width,
1191
- height,
1192
- x,
1193
- y
1194
- });
1195
- }
1196
-
1197
- // If <html> has a CSS width greater than the viewport, then this will be
1198
- // incorrect for RTL.
1199
- function getWindowScrollBarX(element, rect) {
1200
- const leftScroll = getNodeScroll(element).scrollLeft;
1201
- if (!rect) {
1202
- return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1203
- }
1204
- return rect.left + leftScroll;
1205
- }
1206
-
1207
- function getHTMLOffset(documentElement, scroll) {
1208
- const htmlRect = documentElement.getBoundingClientRect();
1209
- const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
1210
- const y = htmlRect.top + scroll.scrollTop;
1211
- return {
1212
- x,
1213
- y
1214
- };
1215
- }
1216
-
1217
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1218
- let {
1219
- elements,
1220
- rect,
1221
- offsetParent,
1222
- strategy
1223
- } = _ref;
1224
- const isFixed = strategy === 'fixed';
1225
- const documentElement = getDocumentElement(offsetParent);
1226
- const topLayer = elements ? isTopLayer(elements.floating) : false;
1227
- if (offsetParent === documentElement || topLayer && isFixed) {
1228
- return rect;
1229
- }
1230
- let scroll = {
1231
- scrollLeft: 0,
1232
- scrollTop: 0
1233
- };
1234
- let scale = createCoords(1);
1235
- const offsets = createCoords(0);
1236
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1237
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1238
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1239
- scroll = getNodeScroll(offsetParent);
1240
- }
1241
- if (isHTMLElement(offsetParent)) {
1242
- const offsetRect = getBoundingClientRect(offsetParent);
1243
- scale = getScale(offsetParent);
1244
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1245
- offsets.y = offsetRect.y + offsetParent.clientTop;
1246
- }
1247
- }
1248
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1249
- return {
1250
- width: rect.width * scale.x,
1251
- height: rect.height * scale.y,
1252
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1253
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1254
- };
1255
- }
1256
-
1257
- function getClientRects(element) {
1258
- return Array.from(element.getClientRects());
1259
- }
1260
-
1261
- // Gets the entire size of the scrollable document area, even extending outside
1262
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1263
- function getDocumentRect(element) {
1264
- const html = getDocumentElement(element);
1265
- const scroll = getNodeScroll(element);
1266
- const body = element.ownerDocument.body;
1267
- const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1268
- const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1269
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1270
- const y = -scroll.scrollTop;
1271
- if (getComputedStyle$1(body).direction === 'rtl') {
1272
- x += max(html.clientWidth, body.clientWidth) - width;
1273
- }
1274
- return {
1275
- width,
1276
- height,
1277
- x,
1278
- y
1279
- };
1280
- }
1281
-
1282
- // Safety check: ensure the scrollbar space is reasonable in case this
1283
- // calculation is affected by unusual styles.
1284
- // Most scrollbars leave 15-18px of space.
1285
- const SCROLLBAR_MAX = 25;
1286
- function getViewportRect(element, strategy) {
1287
- const win = getWindow(element);
1288
- const html = getDocumentElement(element);
1289
- const visualViewport = win.visualViewport;
1290
- let width = html.clientWidth;
1291
- let height = html.clientHeight;
1292
- let x = 0;
1293
- let y = 0;
1294
- if (visualViewport) {
1295
- width = visualViewport.width;
1296
- height = visualViewport.height;
1297
- const visualViewportBased = isWebKit();
1298
- if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1299
- x = visualViewport.offsetLeft;
1300
- y = visualViewport.offsetTop;
1301
- }
1302
- }
1303
- const windowScrollbarX = getWindowScrollBarX(html);
1304
- // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
1305
- // visual width of the <html> but this is not considered in the size
1306
- // of `html.clientWidth`.
1307
- if (windowScrollbarX <= 0) {
1308
- const doc = html.ownerDocument;
1309
- const body = doc.body;
1310
- const bodyStyles = getComputedStyle(body);
1311
- const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
1312
- const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
1313
- if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
1314
- width -= clippingStableScrollbarWidth;
1315
- }
1316
- } else if (windowScrollbarX <= SCROLLBAR_MAX) {
1317
- // If the <body> scrollbar is on the left, the width needs to be extended
1318
- // by the scrollbar amount so there isn't extra space on the right.
1319
- width += windowScrollbarX;
1320
- }
1321
- return {
1322
- width,
1323
- height,
1324
- x,
1325
- y
1326
- };
1327
- }
1328
-
1329
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
1330
- // Returns the inner client rect, subtracting scrollbars if present.
1331
- function getInnerBoundingClientRect(element, strategy) {
1332
- const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1333
- const top = clientRect.top + element.clientTop;
1334
- const left = clientRect.left + element.clientLeft;
1335
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1336
- const width = element.clientWidth * scale.x;
1337
- const height = element.clientHeight * scale.y;
1338
- const x = left * scale.x;
1339
- const y = top * scale.y;
1340
- return {
1341
- width,
1342
- height,
1343
- x,
1344
- y
1345
- };
1346
- }
1347
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1348
- let rect;
1349
- if (clippingAncestor === 'viewport') {
1350
- rect = getViewportRect(element, strategy);
1351
- } else if (clippingAncestor === 'document') {
1352
- rect = getDocumentRect(getDocumentElement(element));
1353
- } else if (isElement(clippingAncestor)) {
1354
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1355
- } else {
1356
- const visualOffsets = getVisualOffsets(element);
1357
- rect = {
1358
- x: clippingAncestor.x - visualOffsets.x,
1359
- y: clippingAncestor.y - visualOffsets.y,
1360
- width: clippingAncestor.width,
1361
- height: clippingAncestor.height
1362
- };
1363
- }
1364
- return rectToClientRect(rect);
1365
- }
1366
- function hasFixedPositionAncestor(element, stopNode) {
1367
- const parentNode = getParentNode(element);
1368
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1369
- return false;
1370
- }
1371
- return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1372
- }
1373
-
1374
- // A "clipping ancestor" is an `overflow` element with the characteristic of
1375
- // clipping (or hiding) child elements. This returns all clipping ancestors
1376
- // of the given element up the tree.
1377
- function getClippingElementAncestors(element, cache) {
1378
- const cachedResult = cache.get(element);
1379
- if (cachedResult) {
1380
- return cachedResult;
1381
- }
1382
- let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1383
- let currentContainingBlockComputedStyle = null;
1384
- const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
1385
- let currentNode = elementIsFixed ? getParentNode(element) : element;
1386
-
1387
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1388
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1389
- const computedStyle = getComputedStyle$1(currentNode);
1390
- const currentNodeIsContaining = isContainingBlock(currentNode);
1391
- if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1392
- currentContainingBlockComputedStyle = null;
1393
- }
1394
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1395
- if (shouldDropCurrentNode) {
1396
- // Drop non-containing blocks.
1397
- result = result.filter(ancestor => ancestor !== currentNode);
1398
- } else {
1399
- // Record last containing block for next iteration.
1400
- currentContainingBlockComputedStyle = computedStyle;
1401
- }
1402
- currentNode = getParentNode(currentNode);
1403
- }
1404
- cache.set(element, result);
1405
- return result;
1406
- }
1407
-
1408
- // Gets the maximum area that the element is visible in due to any number of
1409
- // clipping ancestors.
1410
- function getClippingRect(_ref) {
1411
- let {
1412
- element,
1413
- boundary,
1414
- rootBoundary,
1415
- strategy
1416
- } = _ref;
1417
- const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1418
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1419
- const firstClippingAncestor = clippingAncestors[0];
1420
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1421
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1422
- accRect.top = max(rect.top, accRect.top);
1423
- accRect.right = min(rect.right, accRect.right);
1424
- accRect.bottom = min(rect.bottom, accRect.bottom);
1425
- accRect.left = max(rect.left, accRect.left);
1426
- return accRect;
1427
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1428
- return {
1429
- width: clippingRect.right - clippingRect.left,
1430
- height: clippingRect.bottom - clippingRect.top,
1431
- x: clippingRect.left,
1432
- y: clippingRect.top
1433
- };
1434
- }
1435
-
1436
- function getDimensions(element) {
1437
- const {
1438
- width,
1439
- height
1440
- } = getCssDimensions(element);
1441
- return {
1442
- width,
1443
- height
1444
- };
1445
- }
1446
-
1447
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1448
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1449
- const documentElement = getDocumentElement(offsetParent);
1450
- const isFixed = strategy === 'fixed';
1451
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1452
- let scroll = {
1453
- scrollLeft: 0,
1454
- scrollTop: 0
1455
- };
1456
- const offsets = createCoords(0);
1457
-
1458
- // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1459
- // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1460
- function setLeftRTLScrollbarOffset() {
1461
- offsets.x = getWindowScrollBarX(documentElement);
1462
- }
1463
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1464
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1465
- scroll = getNodeScroll(offsetParent);
1466
- }
1467
- if (isOffsetParentAnElement) {
1468
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1469
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1470
- offsets.y = offsetRect.y + offsetParent.clientTop;
1471
- } else if (documentElement) {
1472
- setLeftRTLScrollbarOffset();
1473
- }
1474
- }
1475
- if (isFixed && !isOffsetParentAnElement && documentElement) {
1476
- setLeftRTLScrollbarOffset();
1477
- }
1478
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1479
- const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1480
- const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1481
- return {
1482
- x,
1483
- y,
1484
- width: rect.width,
1485
- height: rect.height
1486
- };
1487
- }
1488
-
1489
- function isStaticPositioned(element) {
1490
- return getComputedStyle$1(element).position === 'static';
1491
- }
1492
-
1493
- function getTrueOffsetParent(element, polyfill) {
1494
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
1495
- return null;
1496
- }
1497
- if (polyfill) {
1498
- return polyfill(element);
1499
- }
1500
- let rawOffsetParent = element.offsetParent;
1501
-
1502
- // Firefox returns the <html> element as the offsetParent if it's non-static,
1503
- // while Chrome and Safari return the <body> element. The <body> element must
1504
- // be used to perform the correct calculations even if the <html> element is
1505
- // non-static.
1506
- if (getDocumentElement(element) === rawOffsetParent) {
1507
- rawOffsetParent = rawOffsetParent.ownerDocument.body;
1508
- }
1509
- return rawOffsetParent;
1510
- }
1511
-
1512
- // Gets the closest ancestor positioned element. Handles some edge cases,
1513
- // such as table ancestors and cross browser bugs.
1514
- function getOffsetParent(element, polyfill) {
1515
- const win = getWindow(element);
1516
- if (isTopLayer(element)) {
1517
- return win;
1518
- }
1519
- if (!isHTMLElement(element)) {
1520
- let svgOffsetParent = getParentNode(element);
1521
- while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1522
- if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1523
- return svgOffsetParent;
1524
- }
1525
- svgOffsetParent = getParentNode(svgOffsetParent);
1526
- }
1527
- return win;
1528
- }
1529
- let offsetParent = getTrueOffsetParent(element, polyfill);
1530
- while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1531
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1532
- }
1533
- if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1534
- return win;
1535
- }
1536
- return offsetParent || getContainingBlock(element) || win;
1537
- }
1538
-
1539
- const getElementRects = async function (data) {
1540
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1541
- const getDimensionsFn = this.getDimensions;
1542
- const floatingDimensions = await getDimensionsFn(data.floating);
1543
- return {
1544
- reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1545
- floating: {
1546
- x: 0,
1547
- y: 0,
1548
- width: floatingDimensions.width,
1549
- height: floatingDimensions.height
1550
- }
1551
- };
1552
- };
1553
-
1554
- function isRTL(element) {
1555
- return getComputedStyle$1(element).direction === 'rtl';
1556
- }
1557
-
1558
- const platform = {
1559
- convertOffsetParentRelativeRectToViewportRelativeRect,
1560
- getDocumentElement,
1561
- getClippingRect,
1562
- getOffsetParent,
1563
- getElementRects,
1564
- getClientRects,
1565
- getDimensions,
1566
- getScale,
1567
- isElement,
1568
- isRTL
1569
- };
1570
-
1571
- function rectsAreEqual(a, b) {
1572
- return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1573
- }
1574
-
1575
- // https://samthor.au/2021/observing-dom/
1576
- function observeMove(element, onMove) {
1577
- let io = null;
1578
- let timeoutId;
1579
- const root = getDocumentElement(element);
1580
- function cleanup() {
1581
- var _io;
1582
- clearTimeout(timeoutId);
1583
- (_io = io) == null || _io.disconnect();
1584
- io = null;
1585
- }
1586
- function refresh(skip, threshold) {
1587
- if (skip === void 0) {
1588
- skip = false;
1589
- }
1590
- if (threshold === void 0) {
1591
- threshold = 1;
1592
- }
1593
- cleanup();
1594
- const elementRectForRootMargin = element.getBoundingClientRect();
1595
- const {
1596
- left,
1597
- top,
1598
- width,
1599
- height
1600
- } = elementRectForRootMargin;
1601
- if (!skip) {
1602
- onMove();
1603
- }
1604
- if (!width || !height) {
1605
- return;
1606
- }
1607
- const insetTop = floor(top);
1608
- const insetRight = floor(root.clientWidth - (left + width));
1609
- const insetBottom = floor(root.clientHeight - (top + height));
1610
- const insetLeft = floor(left);
1611
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1612
- const options = {
1613
- rootMargin,
1614
- threshold: max(0, min(1, threshold)) || 1
1615
- };
1616
- let isFirstUpdate = true;
1617
- function handleObserve(entries) {
1618
- const ratio = entries[0].intersectionRatio;
1619
- if (ratio !== threshold) {
1620
- if (!isFirstUpdate) {
1621
- return refresh();
1622
- }
1623
- if (!ratio) {
1624
- // If the reference is clipped, the ratio is 0. Throttle the refresh
1625
- // to prevent an infinite loop of updates.
1626
- timeoutId = setTimeout(() => {
1627
- refresh(false, 1e-7);
1628
- }, 1000);
1629
- } else {
1630
- refresh(false, ratio);
1631
- }
1632
- }
1633
- if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1634
- // It's possible that even though the ratio is reported as 1, the
1635
- // element is not actually fully within the IntersectionObserver's root
1636
- // area anymore. This can happen under performance constraints. This may
1637
- // be a bug in the browser's IntersectionObserver implementation. To
1638
- // work around this, we compare the element's bounding rect now with
1639
- // what it was at the time we created the IntersectionObserver. If they
1640
- // are not equal then the element moved, so we refresh.
1641
- refresh();
1642
- }
1643
- isFirstUpdate = false;
1644
- }
1645
-
1646
- // Older browsers don't support a `document` as the root and will throw an
1647
- // error.
1648
- try {
1649
- io = new IntersectionObserver(handleObserve, {
1650
- ...options,
1651
- // Handle <iframe>s
1652
- root: root.ownerDocument
1653
- });
1654
- } catch (_e) {
1655
- io = new IntersectionObserver(handleObserve, options);
1656
- }
1657
- io.observe(element);
1658
- }
1659
- refresh(true);
1660
- return cleanup;
1661
- }
1662
-
1663
- /**
1664
- * Automatically updates the position of the floating element when necessary.
1665
- * Should only be called when the floating element is mounted on the DOM or
1666
- * visible on the screen.
1667
- * @returns cleanup function that should be invoked when the floating element is
1668
- * removed from the DOM or hidden from the screen.
1669
- * @see https://floating-ui.com/docs/autoUpdate
1670
- */
1671
- function autoUpdate(reference, floating, update, options) {
1672
- if (options === void 0) {
1673
- options = {};
1674
- }
1675
- const {
1676
- ancestorScroll = true,
1677
- ancestorResize = true,
1678
- elementResize = typeof ResizeObserver === 'function',
1679
- layoutShift = typeof IntersectionObserver === 'function',
1680
- animationFrame = false
1681
- } = options;
1682
- const referenceEl = unwrapElement(reference);
1683
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1684
- ancestors.forEach(ancestor => {
1685
- ancestorScroll && ancestor.addEventListener('scroll', update, {
1686
- passive: true
1687
- });
1688
- ancestorResize && ancestor.addEventListener('resize', update);
1689
- });
1690
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1691
- let reobserveFrame = -1;
1692
- let resizeObserver = null;
1693
- if (elementResize) {
1694
- resizeObserver = new ResizeObserver(_ref => {
1695
- let [firstEntry] = _ref;
1696
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1697
- // Prevent update loops when using the `size` middleware.
1698
- // https://github.com/floating-ui/floating-ui/issues/1740
1699
- resizeObserver.unobserve(floating);
1700
- cancelAnimationFrame(reobserveFrame);
1701
- reobserveFrame = requestAnimationFrame(() => {
1702
- var _resizeObserver;
1703
- (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1704
- });
1705
- }
1706
- update();
1707
- });
1708
- if (referenceEl && !animationFrame) {
1709
- resizeObserver.observe(referenceEl);
1710
- }
1711
- resizeObserver.observe(floating);
1712
- }
1713
- let frameId;
1714
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1715
- if (animationFrame) {
1716
- frameLoop();
1717
- }
1718
- function frameLoop() {
1719
- const nextRefRect = getBoundingClientRect(reference);
1720
- if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1721
- update();
1722
- }
1723
- prevRefRect = nextRefRect;
1724
- frameId = requestAnimationFrame(frameLoop);
1725
- }
1726
- update();
1727
- return () => {
1728
- var _resizeObserver2;
1729
- ancestors.forEach(ancestor => {
1730
- ancestorScroll && ancestor.removeEventListener('scroll', update);
1731
- ancestorResize && ancestor.removeEventListener('resize', update);
1732
- });
1733
- cleanupIo == null || cleanupIo();
1734
- (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1735
- resizeObserver = null;
1736
- if (animationFrame) {
1737
- cancelAnimationFrame(frameId);
1738
- }
1739
- };
1740
- }
1741
-
1742
- /**
1743
- * Modifies the placement by translating the floating element along the
1744
- * specified axes.
1745
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
1746
- * object may be passed.
1747
- * @see https://floating-ui.com/docs/offset
1748
- */
1749
- const offset = offset$1;
1750
-
1751
- /**
1752
- * Optimizes the visibility of the floating element by choosing the placement
1753
- * that has the most space available automatically, without needing to specify a
1754
- * preferred placement. Alternative to `flip`.
1755
- * @see https://floating-ui.com/docs/autoPlacement
1756
- */
1757
- const autoPlacement = autoPlacement$1;
1758
-
1759
- /**
1760
- * Optimizes the visibility of the floating element by shifting it in order to
1761
- * keep it in view when it will overflow the clipping boundary.
1762
- * @see https://floating-ui.com/docs/shift
1763
- */
1764
- const shift = shift$1;
1765
-
1766
- /**
1767
- * Optimizes the visibility of the floating element by flipping the `placement`
1768
- * in order to keep it in view when the preferred placement(s) will overflow the
1769
- * clipping boundary. Alternative to `autoPlacement`.
1770
- * @see https://floating-ui.com/docs/flip
1771
- */
1772
- const flip = flip$1;
1773
-
1774
- /**
1775
- * Computes the `x` and `y` coordinates that will place the floating element
1776
- * next to a given reference element.
1777
- */
1778
- const computePosition = (reference, floating, options) => {
1779
- // This caches the expensive `getClippingElementAncestors` function so that
1780
- // multiple lifecycle resets re-use the same result. It only lives for a
1781
- // single call. If other functions become expensive, we can add them as well.
1782
- const cache = new Map();
1783
- const mergedOptions = {
1784
- platform,
1785
- ...options
1786
- };
1787
- const platformWithCache = {
1788
- ...mergedOptions.platform,
1789
- _c: cache
1790
- };
1791
- return computePosition$1(reference, floating, {
1792
- ...mergedOptions,
1793
- platform: platformWithCache
1794
- });
1795
- };
1796
-
1797
- /* eslint-disable line-comment-position, no-inline-comments */
1798
-
1799
-
1800
- const MAX_CONFIGURATION_COUNT = 10;
1801
-
1802
- class AuroFloatingUI {
1803
- /**
1804
- * @private
1805
- */
1806
- static isMousePressed = false;
1807
-
1808
- /**
1809
- * @private
1810
- */
1811
- static isMousePressHandlerInitialized = false;
1812
-
1813
- /**
1814
- * @private
1815
- */
1816
- static setupMousePressChecker() {
1817
- if (
1818
- !AuroFloatingUI.isMousePressHandlerInitialized &&
1819
- window &&
1820
- window.addEventListener
1821
- ) {
1822
- AuroFloatingUI.isMousePressHandlerInitialized = true;
1823
-
1824
- // Track timeout for isMousePressed reset to avoid race conditions
1825
- if (!AuroFloatingUI._mousePressedTimeout) {
1826
- AuroFloatingUI._mousePressedTimeout = null;
1827
- }
1828
- const mouseEventGlobalHandler = (event) => {
1829
- const isPressed = event.type === "mousedown";
1830
- if (isPressed) {
1831
- // Clear any pending timeout to prevent race condition
1832
- if (AuroFloatingUI._mousePressedTimeout !== null) {
1833
- clearTimeout(AuroFloatingUI._mousePressedTimeout);
1834
- AuroFloatingUI._mousePressedTimeout = null;
1835
- }
1836
- if (!AuroFloatingUI.isMousePressed) {
1837
- AuroFloatingUI.isMousePressed = true;
1838
- }
1839
- } else if (AuroFloatingUI.isMousePressed && !isPressed) {
1840
- // Schedule reset and track timeout ID
1841
- AuroFloatingUI._mousePressedTimeout = setTimeout(() => {
1842
- AuroFloatingUI.isMousePressed = false;
1843
- AuroFloatingUI._mousePressedTimeout = null;
1844
- }, 0);
1845
- }
1846
- };
1847
-
1848
- window.addEventListener("mousedown", mouseEventGlobalHandler);
1849
- window.addEventListener("mouseup", mouseEventGlobalHandler);
1850
- }
1851
- }
1852
-
1853
- constructor(element, behavior) {
1854
- this.element = element;
1855
- this.behavior = behavior;
1856
-
1857
- // Store event listener references for cleanup
1858
- this.focusHandler = null;
1859
- this.clickHandler = null;
1860
- this.keyDownHandler = null;
1861
-
1862
- /**
1863
- * @private
1864
- */
1865
- this.enableKeyboardHandling = true;
1866
-
1867
- /**
1868
- * @private
1869
- */
1870
- this.configureTrial = 0;
1871
-
1872
- /**
1873
- * @private
1874
- */
1875
- this.eventPrefix = undefined;
1876
-
1877
- /**
1878
- * @private
1879
- */
1880
- this.id = undefined;
1881
-
1882
- /**
1883
- * @private
1884
- */
1885
- this.showing = false;
1886
-
1887
- /**
1888
- * @private
1889
- */
1890
- this.strategy = undefined;
1891
- }
1892
-
1893
- /**
1894
- * Mirrors the size of the bibSizer element to the bib content.
1895
- * Copies the width, height, max-width, and max-height styles from the bibSizer element to the bib content container.
1896
- * This ensures that the bib content has the same dimensions as the sizer element.
1897
- */
1898
- mirrorSize() {
1899
- // mirror the boxsize from bibSizer
1900
- if (this.element.bibSizer && this.element.matchWidth) {
1901
- const sizerStyle = window.getComputedStyle(this.element.bibSizer);
1902
- const bibContent =
1903
- this.element.bib.shadowRoot.querySelector(".container");
1904
- if (sizerStyle.width !== "0px") {
1905
- bibContent.style.width = sizerStyle.width;
1906
- }
1907
- if (sizerStyle.height !== "0px") {
1908
- bibContent.style.height = sizerStyle.height;
1909
- }
1910
- bibContent.style.maxWidth = sizerStyle.maxWidth;
1911
- bibContent.style.maxHeight = sizerStyle.maxHeight;
1912
- }
1913
- }
1914
-
1915
- /**
1916
- * @private
1917
- * Determines the positioning strategy based on the current viewport size and mobile breakpoint.
1918
- *
1919
- * This method checks if the current viewport width is less than or equal to the specified mobile fullscreen breakpoint
1920
- * defined in the bib element. If it is, the strategy is set to 'fullscreen'; otherwise, it defaults to 'floating'.
1921
- *
1922
- * @returns {String} The positioning strategy, one of 'fullscreen', 'floating', 'cover'.
1923
- */
1924
- getPositioningStrategy() {
1925
- const breakpoint =
1926
- this.element.bib.mobileFullscreenBreakpoint ||
1927
- this.element.floaterConfig?.fullscreenBreakpoint;
1928
- switch (this.behavior) {
1929
- case "tooltip":
1930
- return "floating";
1931
- case "dialog":
1932
- case "drawer":
1933
- if (breakpoint) {
1934
- const smallerThanBreakpoint = window.matchMedia(
1935
- `(max-width: ${breakpoint})`,
1936
- ).matches;
1937
-
1938
- this.element.expanded = smallerThanBreakpoint;
1939
- }
1940
- if (this.element.nested) {
1941
- return "cover";
1942
- }
1943
- return "fullscreen";
1944
- case "dropdown":
1945
- case undefined:
1946
- case null:
1947
- if (breakpoint) {
1948
- const smallerThanBreakpoint = window.matchMedia(
1949
- `(max-width: ${breakpoint})`,
1950
- ).matches;
1951
- if (smallerThanBreakpoint) {
1952
- return "fullscreen";
1953
- }
1954
- }
1955
- return "floating";
1956
- default:
1957
- return this.behavior;
1958
- }
1959
- }
1960
-
1961
- /**
1962
- * @private
1963
- * Positions the bib element based on the current configuration and positioning strategy.
1964
- *
1965
- * This method determines the appropriate positioning strategy (fullscreen or not) and configures the bib accordingly.
1966
- * It also sets up middleware for the floater configuration, computes the position of the bib relative to the trigger element,
1967
- * and applies the calculated position to the bib's style.
1968
- */
1969
- position() {
1970
- const strategy = this.getPositioningStrategy();
1971
- this.configureBibStrategy(strategy);
1972
-
1973
- if (strategy === "floating") {
1974
- this.mirrorSize();
1975
- // Define the middlware for the floater configuration
1976
- const middleware = [
1977
- offset(this.element.floaterConfig?.offset || 0),
1978
- ...(this.element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
1979
- ...(this.element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
1980
- ...(this.element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
1981
- ];
1982
-
1983
- // Compute the position of the bib
1984
- computePosition(this.element.trigger, this.element.bib, {
1985
- strategy: this.element.floaterConfig?.strategy || "fixed",
1986
- placement: this.element.floaterConfig?.placement,
1987
- middleware: middleware || [],
1988
- }).then(({ x, y }) => {
1989
- // eslint-disable-line id-length
1990
- Object.assign(this.element.bib.style, {
1991
- left: `${x}px`,
1992
- top: `${y}px`,
1993
- });
1994
- });
1995
- } else if (strategy === "cover") {
1996
- // Compute the position of the bib
1997
- computePosition(this.element.parentNode, this.element.bib, {
1998
- placement: "bottom-start",
1999
- }).then(({ x, y }) => {
2000
- // eslint-disable-line id-length
2001
- Object.assign(this.element.bib.style, {
2002
- left: `${x}px`,
2003
- top: `${y - this.element.parentNode.offsetHeight}px`,
2004
- width: `${this.element.parentNode.offsetWidth}px`,
2005
- height: `${this.element.parentNode.offsetHeight}px`,
2006
- });
2007
- });
2008
- }
2009
- }
2010
-
2011
- /**
2012
- * @private
2013
- * Controls whether to lock the scrolling for the document's body.
2014
- * @param {Boolean} lock - If true, locks the body's scrolling functionlity; otherwise, unlock.
2015
- */
2016
- lockScroll(lock = true) {
2017
- if (lock) {
2018
- document.body.style.overflow = "hidden"; // hide body's scrollbar
2019
-
2020
- // Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
2021
- this.element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
2022
- } else {
2023
- document.body.style.overflow = "";
2024
- }
2025
- }
2026
-
2027
- /**
2028
- * @private
2029
- * Configures the bib element's display strategy.
2030
- *
2031
- * Sets the bib to fullscreen or floating mode based on the provided strategy.
2032
- * Dispatches a 'strategy-change' event if the strategy changes.
2033
- *
2034
- * @param {string} strategy - The positioning strategy ('fullscreen' or 'floating').
2035
- */
2036
- configureBibStrategy(value) {
2037
- if (value === "fullscreen") {
2038
- this.element.isBibFullscreen = true;
2039
- // reset the prev position
2040
- this.element.bib.setAttribute("isfullscreen", "");
2041
- this.element.bib.style.position = "fixed";
2042
- this.element.bib.style.top = "0px";
2043
- this.element.bib.style.left = "0px";
2044
- this.element.bib.style.width = "";
2045
- this.element.bib.style.height = "";
2046
- this.element.style.contain = "";
2047
-
2048
- // reset the size that was mirroring `size` css-part
2049
- const bibContent =
2050
- this.element.bib.shadowRoot.querySelector(".container");
2051
- if (bibContent) {
2052
- bibContent.style.width = "";
2053
- bibContent.style.height = "";
2054
- bibContent.style.maxWidth = "";
2055
- bibContent.style.maxHeight = `${window?.visualViewport?.height}px`;
2056
- this.configureTrial = 0;
2057
- } else if (this.configureTrial < MAX_CONFIGURATION_COUNT) {
2058
- this.configureTrial += 1;
2059
-
2060
- setTimeout(() => {
2061
- this.configureBibStrategy(value);
2062
- }, 0);
2063
- }
2064
-
2065
- if (this.element.isPopoverVisible) {
2066
- this.lockScroll(true);
2067
- }
2068
- } else {
2069
- this.element.bib.style.position = "";
2070
- this.element.bib.removeAttribute("isfullscreen");
2071
- this.element.isBibFullscreen = false;
2072
- this.element.style.contain = "layout";
2073
- }
2074
-
2075
- const isChanged = this.strategy && this.strategy !== value;
2076
- this.strategy = value;
2077
- if (isChanged) {
2078
- const event = new CustomEvent(
2079
- this.eventPrefix
2080
- ? `${this.eventPrefix}-strategy-change`
2081
- : "strategy-change",
2082
- {
2083
- detail: {
2084
- value,
2085
- },
2086
- composed: true,
2087
- },
2088
- );
2089
-
2090
- this.element.dispatchEvent(event);
2091
- }
2092
- }
2093
-
2094
- updateState() {
2095
- const isVisible = this.element.isPopoverVisible;
2096
- if (!isVisible) {
2097
- this.cleanupHideHandlers();
2098
- try {
2099
- this.element.cleanup?.();
2100
- } catch (error) {
2101
- // Do nothing
2102
- }
2103
- }
2104
- }
2105
-
2106
- /**
2107
- * @private
2108
- * getting called on 'blur' in trigger or `focusin` in document
2109
- *
2110
- * Hides the bib if focus moves outside of the trigger or bib, unless a 'noHideOnThisFocusLoss' flag is set.
2111
- * This method checks if the currently active element is still within the trigger or bib.
2112
- * If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
2113
- */
2114
- handleFocusLoss() {
2115
- // if mouse is being pressed, skip and let click event to handle the action
2116
- if (AuroFloatingUI.isMousePressed) {
2117
- return;
2118
- }
2119
-
2120
- if (
2121
- this.element.noHideOnThisFocusLoss ||
2122
- this.element.hasAttribute("noHideOnThisFocusLoss")
2123
- ) {
2124
- return;
2125
- }
2126
-
2127
- // if focus is still inside of trigger or bib, do not close
2128
- if (
2129
- this.element.matches(":focus") ||
2130
- this.element.matches(":focus-within")
2131
- ) {
2132
- return;
2133
- }
2134
-
2135
- // if fullscreen bib is in fullscreen mode, do not close
2136
- if (this.element.bib.hasAttribute("isfullscreen")) {
2137
- return;
2138
- }
2139
-
2140
- this.hideBib("keydown");
2141
- }
2142
-
2143
- setupHideHandlers() {
2144
- // Define handlers & store references
2145
- this.focusHandler = () => this.handleFocusLoss();
2146
-
2147
- this.clickHandler = (evt) => {
2148
- // When the bib is fullscreen (modal dialog), don't close on outside
2149
- // clicks. VoiceOver's synthetic click events inside a top-layer modal
2150
- // <dialog> may not include the bib in composedPath(), causing false
2151
- // positives. This mirrors the fullscreen guard in handleFocusLoss().
2152
- if (this.element.bib && this.element.bib.hasAttribute("isfullscreen")) {
2153
- return;
2154
- }
2155
-
2156
- if (
2157
- (!evt.composedPath().includes(this.element.trigger) &&
2158
- !evt.composedPath().includes(this.element.bib)) ||
2159
- (this.element.bib.backdrop &&
2160
- evt.composedPath().includes(this.element.bib.backdrop))
2161
- ) {
2162
- const existedVisibleFloatingUI =
2163
- document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
2164
-
2165
- if (
2166
- existedVisibleFloatingUI &&
2167
- existedVisibleFloatingUI.element.isPopoverVisible
2168
- ) {
2169
- // if something else is open, close that
2170
- existedVisibleFloatingUI.hideBib();
2171
- document.expandedAuroFormkitDropdown = null;
2172
- document.expandedAuroFloater = this;
2173
- } else {
2174
- this.hideBib("click");
2175
- }
2176
- }
2177
- };
2178
-
2179
- // ESC key handler
2180
- this.keyDownHandler = (evt) => {
2181
- if (evt.key === "Escape" && this.element.isPopoverVisible) {
2182
- const existedVisibleFloatingUI =
2183
- document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
2184
- if (
2185
- existedVisibleFloatingUI &&
2186
- existedVisibleFloatingUI !== this &&
2187
- existedVisibleFloatingUI.element.isPopoverVisible
2188
- ) {
2189
- // if something else is open, let it handle itself
2190
- return;
2191
- }
2192
- this.hideBib("keydown");
2193
- }
2194
- };
2195
-
2196
- if (this.behavior !== "drawer" && this.behavior !== "dialog") {
2197
- // Add event listeners using the stored references
2198
- document.addEventListener("focusin", this.focusHandler);
2199
- }
2200
-
2201
- if (this.enableKeyboardHandling) {
2202
- document.addEventListener("keydown", this.keyDownHandler);
2203
- }
2204
-
2205
- // send this task to the end of queue to prevent conflicting
2206
- // it conflicts if showBib gets call from a button that's not this.element.trigger
2207
- setTimeout(() => {
2208
- window.addEventListener("click", this.clickHandler);
2209
- }, 0);
2210
- }
2211
-
2212
- cleanupHideHandlers() {
2213
- // Remove event listeners if they exist
2214
-
2215
- if (this.focusHandler) {
2216
- document.removeEventListener("focusin", this.focusHandler);
2217
- this.focusHandler = null;
2218
- }
2219
-
2220
- if (this.clickHandler) {
2221
- window.removeEventListener("click", this.clickHandler);
2222
- this.clickHandler = null;
2223
- }
2224
-
2225
- if (this.keyDownHandler) {
2226
- document.removeEventListener("keydown", this.keyDownHandler);
2227
- this.keyDownHandler = null;
2228
- }
2229
- }
2230
-
2231
- handleUpdate(changedProperties) {
2232
- if (changedProperties.has("isPopoverVisible")) {
2233
- this.updateState();
2234
- }
2235
- }
2236
-
2237
- updateCurrentExpandedDropdown() {
2238
- // Close any other dropdown that is already open
2239
- const existedVisibleFloatingUI =
2240
- document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
2241
- if (
2242
- existedVisibleFloatingUI &&
2243
- existedVisibleFloatingUI !== this &&
2244
- existedVisibleFloatingUI.element.isPopoverVisible &&
2245
- existedVisibleFloatingUI.eventPrefix === this.eventPrefix
2246
- ) {
2247
- existedVisibleFloatingUI.hideBib();
2248
- }
2249
-
2250
- document.expandedAuroFloater = this;
2251
- }
2252
-
2253
- showBib() {
2254
- if (!this.element.disabled && !this.showing) {
2255
- this.updateCurrentExpandedDropdown();
2256
- this.element.triggerChevron?.setAttribute("data-expanded", true);
2257
-
2258
- // prevent double showing: isPopovervisible gets first and showBib gets called later
2259
- if (!this.showing) {
2260
- if (!this.element.modal) {
2261
- this.setupHideHandlers();
2262
- }
2263
- this.showing = true;
2264
- this.element.isPopoverVisible = true;
2265
- this.position();
2266
- this.dispatchEventDropdownToggle();
2267
- }
2268
-
2269
- // Setup auto update to handle resize and scroll
2270
- this.element.cleanup = autoUpdate(
2271
- this.element.trigger || this.element.parentNode,
2272
- this.element.bib,
2273
- () => {
2274
- this.position();
2275
- },
2276
- );
2277
- }
2278
- }
2279
-
2280
- /**
2281
- * Hides the floating UI element.
2282
- * @param {String} eventType - The event type that triggered the hiding action.
2283
- */
2284
- hideBib(eventType = "unknown") {
2285
- if (this.element.disabled) {
2286
- return;
2287
- }
2288
-
2289
- // noToggle dropdowns should not close when the trigger is clicked (the
2290
- // "toggle" behavior), but they CAN still close via other interactions like
2291
- // Escape key or focus loss.
2292
- if (this.element.noToggle && eventType === "click") {
2293
- return;
2294
- }
2295
-
2296
- this.lockScroll(false);
2297
- this.element.triggerChevron?.removeAttribute("data-expanded");
2298
-
2299
- if (this.element.isPopoverVisible) {
2300
- this.element.isPopoverVisible = false;
2301
- }
2302
- if (this.showing) {
2303
- this.cleanupHideHandlers();
2304
- this.showing = false;
2305
- this.dispatchEventDropdownToggle(eventType);
2306
- }
2307
-
2308
- // Only clear the global reference if the bib was actually hidden.
2309
- // Clearing it when hideBib is blocked (e.g. noToggle + click) corrupts
2310
- // the singleton state so other dropdowns can't detect this one is still open.
2311
- document.expandedAuroFloater = null;
2312
- }
2313
-
2314
- /**
2315
- * @private
2316
- * @returns {void} Dispatches event with an object showing the state of the dropdown.
2317
- * @param {String} eventType - The event type that triggered the toggle action.
2318
- */
2319
- dispatchEventDropdownToggle(eventType) {
2320
- const event = new CustomEvent(
2321
- this.eventPrefix ? `${this.eventPrefix}-toggled` : "toggled",
2322
- {
2323
- detail: {
2324
- expanded: this.showing,
2325
- eventType: eventType || "unknown",
2326
- },
2327
- composed: true,
2328
- },
2329
- );
2330
-
2331
- this.element.dispatchEvent(event);
2332
- }
2333
-
2334
- handleClick() {
2335
- if (this.element.isPopoverVisible) {
2336
- this.hideBib("click");
2337
- } else {
2338
- this.showBib();
2339
- }
2340
-
2341
- const event = new CustomEvent(
2342
- this.eventPrefix ? `${this.eventPrefix}-triggerClick` : "triggerClick",
2343
- {
2344
- composed: true,
2345
- detail: {
2346
- expanded: this.element.isPopoverVisible,
2347
- },
2348
- },
2349
- );
2350
-
2351
- this.element.dispatchEvent(event);
2352
- }
2353
-
2354
- handleEvent(event) {
2355
- if (!this.element.disableEventShow) {
2356
- switch (event.type) {
2357
- case "keydown": {
2358
- // Support both Enter and Space keys for accessibility
2359
- // Space is included as it's expected behavior for interactive elements
2360
-
2361
- const origin = event.composedPath()[0];
2362
- if (
2363
- event.key === "Enter" ||
2364
- (event.key === " " && (!origin || origin.tagName !== "INPUT"))
2365
- ) {
2366
- event.preventDefault();
2367
- this.handleClick();
2368
- }
2369
- break;
2370
- }
2371
- case "mouseenter":
2372
- if (this.element.hoverToggle) {
2373
- this.showBib();
2374
- }
2375
- break;
2376
- case "mouseleave":
2377
- if (this.element.hoverToggle) {
2378
- this.hideBib("mouseleave");
2379
- }
2380
- break;
2381
- case "focus":
2382
- if (this.element.focusShow) {
2383
- /*
2384
- This needs to better handle clicking that gives focus -
2385
- currently it shows and then immediately hides the bib
2386
- */
2387
- this.showBib();
2388
- }
2389
- break;
2390
- case "blur":
2391
- // send this task 100ms later queue to
2392
- // wait a frame in case focus moves within the floating element/bib
2393
- setTimeout(() => this.handleFocusLoss(), 0);
2394
- break;
2395
- case "click":
2396
- if (document.activeElement === document.body) {
2397
- event.currentTarget.focus();
2398
- }
2399
- this.handleClick();
2400
- break;
2401
- // Do nothing
2402
- }
2403
- }
2404
- }
2405
-
2406
- /**
2407
- * Manages the tabIndex of the trigger element based on its focusability.
2408
- *
2409
- * If the trigger element or any of its children are inherently focusable, the tabIndex of the component is set to -1.
2410
- * This prevents the component itself from being focusable when the trigger element already handles focus.
2411
- */
2412
- handleTriggerTabIndex() {
2413
- const focusableElementSelectors = [
2414
- "a",
2415
- "button",
2416
- 'input:not([type="hidden"])',
2417
- "select",
2418
- "textarea",
2419
- '[tabindex]:not([tabindex="-1"])',
2420
- "auro-button",
2421
- "auro-input",
2422
- "auro-hyperlink",
2423
- ];
2424
-
2425
- const triggerNode = this.element.querySelectorAll('[slot="trigger"]')[0];
2426
- if (!triggerNode) {
2427
- return;
2428
- }
2429
- const triggerNodeTagName = triggerNode.tagName.toLowerCase();
2430
-
2431
- focusableElementSelectors.forEach((selector) => {
2432
- // Check if the trigger node element is focusable
2433
- if (triggerNodeTagName === selector) {
2434
- this.element.tabIndex = -1;
2435
- return;
2436
- }
2437
-
2438
- // Check if any child is focusable
2439
- if (triggerNode.querySelector(selector)) {
2440
- this.element.tabIndex = -1;
2441
- }
2442
- });
2443
- }
2444
-
2445
- /**
2446
- *
2447
- * @param {*} eventPrefix
2448
- */
2449
- regenerateBibId() {
2450
- this.id = this.element.getAttribute("id");
2451
- if (!this.id) {
2452
- this.id = window.crypto.randomUUID();
2453
- this.element.setAttribute("id", this.id);
2454
- }
2455
-
2456
- this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
2457
- }
2458
-
2459
- configure(elem, eventPrefix, enableKeyboardHandling = true) {
2460
- AuroFloatingUI.setupMousePressChecker();
2461
- this.enableKeyboardHandling = enableKeyboardHandling;
2462
-
2463
- this.eventPrefix = eventPrefix;
2464
- if (this.element !== elem) {
2465
- this.element = elem;
2466
- }
2467
-
2468
- if (this.behavior !== this.element.behavior) {
2469
- this.behavior = this.element.behavior;
2470
- }
2471
-
2472
- if (this.element.trigger) {
2473
- this.disconnect();
2474
- }
2475
- this.element.trigger =
2476
- this.element.triggerElement ||
2477
- this.element.shadowRoot.querySelector("#trigger") ||
2478
- this.element.trigger;
2479
- this.element.bib =
2480
- this.element.shadowRoot.querySelector("#bib") || this.element.bib;
2481
- this.element.bibSizer = this.element.shadowRoot.querySelector("#bibSizer");
2482
- this.element.triggerChevron =
2483
- this.element.shadowRoot.querySelector("#showStateIcon");
2484
-
2485
- if (this.element.floaterConfig) {
2486
- this.element.hoverToggle = this.element.floaterConfig.hoverToggle;
2487
- }
2488
-
2489
- this.regenerateBibId();
2490
- this.handleTriggerTabIndex();
2491
-
2492
- this.handleEvent = this.handleEvent.bind(this);
2493
- if (this.element.trigger) {
2494
- if (this.enableKeyboardHandling) {
2495
- this.element.trigger.addEventListener("keydown", this.handleEvent);
2496
- }
2497
- this.element.trigger.addEventListener("click", this.handleEvent);
2498
- this.element.trigger.addEventListener("mouseenter", this.handleEvent);
2499
- this.element.trigger.addEventListener("mouseleave", this.handleEvent);
2500
- this.element.trigger.addEventListener("focus", this.handleEvent);
2501
- this.element.trigger.addEventListener("blur", this.handleEvent);
2502
- }
2503
- }
2504
-
2505
- disconnect() {
2506
- this.cleanupHideHandlers();
2507
- if (this.element) {
2508
- this.element.cleanup?.();
2509
-
2510
- if (this.element.bib) {
2511
- this.element.shadowRoot.append(this.element.bib);
2512
- }
2513
-
2514
- // Remove event & keyboard listeners
2515
- if (this.element?.trigger) {
2516
- this.element.trigger.removeEventListener("keydown", this.handleEvent);
2517
- this.element.trigger.removeEventListener("click", this.handleEvent);
2518
- this.element.trigger.removeEventListener(
2519
- "mouseenter",
2520
- this.handleEvent,
2521
- );
2522
- this.element.trigger.removeEventListener(
2523
- "mouseleave",
2524
- this.handleEvent,
2525
- );
2526
- this.element.trigger.removeEventListener("focus", this.handleEvent);
2527
- this.element.trigger.removeEventListener("blur", this.handleEvent);
2528
- }
2529
- }
2530
- }
2531
- }
2532
-
2533
- // Selectors for focusable elements
2534
- const FOCUSABLE_SELECTORS = [
2535
- "a[href]",
2536
- "button:not([disabled])",
2537
- "textarea:not([disabled])",
2538
- "input:not([disabled])",
2539
- "select:not([disabled])",
2540
- '[role="tab"]:not([disabled])',
2541
- '[role="link"]:not([disabled])',
2542
- '[role="button"]:not([disabled])',
2543
- '[tabindex]:not([tabindex="-1"])',
2544
- '[contenteditable]:not([contenteditable="false"])',
2545
- ];
2546
-
2547
- // List of custom components that are known to be focusable
2548
- const FOCUSABLE_COMPONENTS = [
2549
- "auro-checkbox",
2550
- "auro-radio",
2551
- "auro-dropdown",
2552
- "auro-button",
2553
- "auro-combobox",
2554
- "auro-input",
2555
- "auro-counter",
2556
- // 'auro-menu', // Auro menu is not focusable by default, it uses a different interaction model
2557
- "auro-select",
2558
- "auro-datepicker",
2559
- "auro-hyperlink",
2560
- "auro-accordion",
2561
- ];
2562
-
2563
- /**
2564
- * Determines if a given element is a custom focusable component.
2565
- * Returns true if the element matches a known focusable component and is not disabled.
2566
- *
2567
- * @param {HTMLElement} element The element to check for focusability.
2568
- * @returns {boolean} True if the element is a focusable custom component, false otherwise.
2569
- */
2570
- function isFocusableComponent(element) {
2571
- const componentName = element.tagName.toLowerCase();
2572
-
2573
- // Guard Clause: Element is a focusable component
2574
- if (
2575
- !FOCUSABLE_COMPONENTS.some(
2576
- (name) => element.hasAttribute(name) || componentName === name,
2577
- )
2578
- )
2579
- return false;
2580
-
2581
- // Guard Clause: Element is not disabled
2582
- if (element.hasAttribute("disabled")) return false;
2583
-
2584
- // Guard Clause: The element is a hyperlink and has no href attribute
2585
- if (componentName.match("hyperlink") && !element.hasAttribute("href"))
2586
- return false;
2587
-
2588
- // If all guard clauses pass, the element is a focusable component
2589
- return true;
2590
- }
2591
-
2592
- /**
2593
- * Safely get a numeric tabindex for an element.
2594
- * Returns a number if the tabindex is a valid integer, otherwise null.
2595
- *
2596
- * @param {HTMLElement} element The element whose tabindex to read.
2597
- * @returns {?number} The numeric tabindex or null if missing/invalid.
2598
- */
2599
- function getNumericTabIndex(element) {
2600
- const raw = element.getAttribute("tabindex");
2601
- if (raw == null) return null;
2602
-
2603
- const value = Number.parseInt(raw, 10);
2604
- return Number.isNaN(value) ? null : value;
2605
- }
2606
-
2607
- /**
2608
- * Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
2609
- * Returns a unique, ordered array of elements that can receive focus.
2610
- * Also sorts elements with tabindex first, preserving their order.
2611
- *
2612
- * @param {HTMLElement} container The container to search within
2613
- * @returns {Array<HTMLElement>} An array of focusable elements within the container.
2614
- */
2615
- function getFocusableElements(container) {
2616
- // Get elements in DOM order by walking the tree
2617
- const orderedFocusableElements = [];
2618
-
2619
- // Define a recursive function to collect focusable elements in DOM order
2620
- const collectFocusableElements = (root) => {
2621
- // Check if current element is focusable
2622
- if (root.nodeType === Node.ELEMENT_NODE) {
2623
- // Check if this is a custom component that is focusable
2624
- const isComponentFocusable = isFocusableComponent(root);
2625
-
2626
- if (isComponentFocusable) {
2627
- // Add the component itself as a focusable element and don't traverse its shadow DOM
2628
- orderedFocusableElements.push(root);
2629
- return; // Skip traversing inside this component
2630
- }
2631
-
2632
- // Check if the element itself matches any selector
2633
- for (const selector of FOCUSABLE_SELECTORS) {
2634
- if (root.matches?.(selector)) {
2635
- orderedFocusableElements.push(root);
2636
- break; // Once we know it's focusable, no need to check other selectors
2637
- }
2638
- }
2639
-
2640
- // Process shadow DOM only for non-Auro components
2641
- if (root.shadowRoot) {
2642
- // Process shadow DOM children in order
2643
- if (root.shadowRoot.children) {
2644
- Array.from(root.shadowRoot.children).forEach((child) => {
2645
- collectFocusableElements(child);
2646
- });
2647
- }
2648
- }
2649
-
2650
- // Process slots and their assigned nodes in order
2651
- if (root.tagName === "SLOT") {
2652
- const assignedNodes = root.assignedNodes({ flatten: true });
2653
- for (const node of assignedNodes) {
2654
- collectFocusableElements(node);
2655
- }
2656
- } else {
2657
- // Process light DOM children in order
2658
- if (root.children) {
2659
- Array.from(root.children).forEach((child) => {
2660
- collectFocusableElements(child);
2661
- });
2662
- }
2663
- }
2664
- }
2665
- };
2666
-
2667
- // Start the traversal from the container
2668
- collectFocusableElements(container);
2669
-
2670
- // Remove duplicates that might have been collected through different paths
2671
- // while preserving order
2672
- const uniqueElements = [];
2673
- const seen = new Set();
2674
-
2675
- for (const element of orderedFocusableElements) {
2676
- if (!seen.has(element)) {
2677
- seen.add(element);
2678
- uniqueElements.push(element);
2679
- }
2680
- }
2681
-
2682
- // Move tab-indexed elements to the front while preserving their order
2683
- // This ensures that elements with tabindex are prioritized in the focus order
2684
-
2685
- // First extract elements with valid positive tabindex
2686
- const elementsWithTabindex = uniqueElements.filter((el) => {
2687
- const tabindex = getNumericTabIndex(el);
2688
- return tabindex !== null && tabindex > 0;
2689
- });
2690
-
2691
- // Sort these elements by their tabindex value
2692
- elementsWithTabindex.sort((a, b) => {
2693
- const aIndex = getNumericTabIndex(a) ?? 0;
2694
- const bIndex = getNumericTabIndex(b) ?? 0;
2695
- return aIndex - bIndex;
2696
- });
2697
-
2698
- // Elements without tabindex (preserving their original order)
2699
- const elementsWithoutTabindex = uniqueElements.filter((el) => {
2700
- const tabindex = getNumericTabIndex(el);
2701
-
2702
- // Elements without tabindex or with tabindex of 0 stay in DOM order
2703
- return tabindex === null || tabindex === 0;
2704
- });
2705
-
2706
- // Combine both arrays with tabindex elements first
2707
- const tabIndexedUniqueElements = [
2708
- ...elementsWithTabindex,
2709
- ...elementsWithoutTabindex,
2710
- ];
2711
-
2712
- return tabIndexedUniqueElements;
2713
- }
2714
-
2715
- /**
2716
- * FocusTrap manages keyboard focus within a specified container element, ensuring that focus does not leave the container when tabbing.
2717
- * It is commonly used for modal dialogs or overlays to improve accessibility by trapping focus within interactive UI components.
2718
- */
2719
- class FocusTrap {
2720
- /**
2721
- * Creates a new FocusTrap instance for the given container element.
2722
- * Initializes event listeners and prepares the container for focus management.
2723
- *
2724
- * @param {HTMLElement} container The DOM element to trap focus within.
2725
- * @param {boolean} [controlTabOrder=false] If true enables manual control of the tab order by the FocusTrap.
2726
- * @throws {Error} If the provided container is not a valid HTMLElement.
2727
- */
2728
- constructor(container, controlTabOrder = false) {
2729
- if (!container || !(container instanceof HTMLElement)) {
2730
- throw new Error("FocusTrap requires a valid HTMLElement.");
2731
- }
2732
-
2733
- this.container = container;
2734
- this.tabDirection = "forward"; // or 'backward';
2735
- this.controlTabOrder = controlTabOrder;
2736
-
2737
- this._init();
2738
- }
2739
-
2740
- /**
2741
- * Initializes the focus trap by setting up event listeners and attributes on the container.
2742
- * Prepares the container for focus management, including support for shadow DOM and inert attributes.
2743
- *
2744
- * @private
2745
- */
2746
- _init() {
2747
- // Add inert attribute to prevent focusing programmatically as well (if supported)
2748
- if ("inert" in HTMLElement.prototype) {
2749
- this.container.inert = false; // Ensure the container isn't inert
2750
- this.container.setAttribute("data-focus-trap-container", true); // Mark for identification
2751
- }
2752
-
2753
- // Track tab direction
2754
- this.container.addEventListener("keydown", this._onKeydown);
2755
- }
2756
-
2757
- /**
2758
- * Gets an array of currently active (focused) elements in the document and shadow DOM.
2759
- * @returns {Array<HTMLElement>} An array of focusable elements within the container.
2760
- * @private
2761
- */
2762
- _getActiveElements() {
2763
- // Get the active element(s) in the document and shadow root
2764
- // This will include the active element in the shadow DOM if it exists
2765
- // Active element may be inside the shadow DOM depending on delegatesFocus, so we need to check both
2766
- let { activeElement } = document;
2767
- const actives = [activeElement];
2768
- while (activeElement?.shadowRoot?.activeElement) {
2769
- actives.push(activeElement.shadowRoot.activeElement);
2770
- activeElement = activeElement.shadowRoot.activeElement;
2771
- }
2772
- return actives;
2773
- }
2774
-
2775
- /**
2776
- * Gets the next focus index based on the current index and focusable elements.
2777
- * @param {number} currentIndex The current index of the focused element.
2778
- * @param {Array<HTMLElement>} focusables The array of focusable elements.
2779
- * @returns {number|null} The next focus index or null if not determined.
2780
- */
2781
- _getNextFocusIndex(currentIndex, focusables, actives) {
2782
- if (this.controlTabOrder) {
2783
- // Calculate the new index based on the current index and tab direction
2784
- let newFocusIndex =
2785
- currentIndex + (this.tabDirection === "forward" ? 1 : -1);
2786
-
2787
- // Wrap-around logic
2788
- if (newFocusIndex < 0) newFocusIndex = focusables.length - 1;
2789
- if (newFocusIndex >= focusables.length) newFocusIndex = 0;
2790
-
2791
- // Early return with the new index
2792
- return newFocusIndex;
2793
- }
2794
-
2795
- // Determine if we need to wrap
2796
- const atFirst =
2797
- actives.includes(focusables[0]) || actives.includes(this.container);
2798
- const atLast = actives.includes(focusables[focusables.length - 1]);
2799
-
2800
- // Only wrap if at the ends
2801
- if (this.tabDirection === "backward" && atFirst) {
2802
- return focusables.length - 1;
2803
- }
2804
-
2805
- if (this.tabDirection === "forward" && atLast) {
2806
- return 0;
2807
- }
2808
-
2809
- // No wrap, so don't change focus, return early
2810
- return null;
2811
- }
2812
-
2813
- /**
2814
- * Handles the Tab key press event to manage focus within the container.
2815
- * @param {KeyboardEvent} e The keyboard event triggered by the user.
2816
- * @returns {void}
2817
- */
2818
- _handleTabKey(e) {
2819
- // Update the focusable elements
2820
- const focusables = this._getFocusableElements();
2821
-
2822
- // If there are no focusable elements, exit
2823
- if (!focusables.length) return;
2824
-
2825
- // Set the tab direction based on the key pressed
2826
- this.tabDirection = e.shiftKey ? "backward" : "forward";
2827
-
2828
- // Get the active elements that are currently focused
2829
- const actives = this._getActiveElements();
2830
-
2831
- // If we're at either end of the focusable elements, wrap around to the other end
2832
- let focusIndex = focusables.findIndex((el) => actives.includes(el));
2833
-
2834
- // Fallback if we have no focused element
2835
- if (focusIndex === -1) focusIndex = 0;
2836
-
2837
- // Get the next focus index based on the current focus index, tab direction, and controlTabOrder setting
2838
- // Is null if no new focus index is determined
2839
- const newFocusIndex = this._getNextFocusIndex(
2840
- focusIndex,
2841
- focusables,
2842
- actives,
2843
- );
2844
-
2845
- // If we have a new focus index, set focus to that element
2846
- if (newFocusIndex !== null) {
2847
- e.preventDefault();
2848
- focusables[newFocusIndex].focus();
2849
- }
2850
- }
2851
-
2852
- /**
2853
- * Catches the keydown event
2854
- * @param {KeyboardEvent} e The keyboard event triggered by user interaction.
2855
- * @private
2856
- */
2857
- _onKeydown = (e) => {
2858
- // Handle tab
2859
- if (e.key === "Tab") this._handleTabKey(e);
2860
- };
2861
-
2862
- /**
2863
- * Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
2864
- * Returns a unique, ordered array of elements that can receive focus.
2865
- *
2866
- * @returns {Array<HTMLElement>} An array of focusable elements within the container.
2867
- * @private
2868
- */
2869
- _getFocusableElements() {
2870
- // Use the imported utility function to get focusable elements
2871
- const elements = getFocusableElements(this.container);
2872
-
2873
- // Return the elements found
2874
- return elements;
2875
- }
2876
-
2877
- /**
2878
- * Moves focus to the first focusable element within the container.
2879
- * Useful for setting initial focus when activating the focus trap.
2880
- */
2881
- focusFirstElement() {
2882
- const focusables = this._getFocusableElements();
2883
- if (focusables.length) focusables[0].focus();
2884
- }
2885
-
2886
- /**
2887
- * Moves focus to the last focusable element within the container.
2888
- * Useful for setting focus when deactivating or cycling focus in reverse.
2889
- */
2890
- focusLastElement() {
2891
- const focusables = this._getFocusableElements();
2892
- if (focusables.length) focusables[focusables.length - 1].focus();
2893
- }
2894
-
2895
- /**
2896
- * Removes event listeners and attributes added by the focus trap.
2897
- * Call this method to clean up when the focus trap is no longer needed.
2898
- */
2899
- disconnect() {
2900
- if (this.container.hasAttribute("data-focus-trap-container")) {
2901
- this.container.removeAttribute("data-focus-trap-container");
2902
- }
2903
-
2904
- this.container.removeEventListener("keydown", this._onKeydown);
2905
- }
2906
- }
2907
-
2908
- // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
2909
- // See LICENSE in the project root for license information.
2910
-
2911
-
2912
- class AuroDependencyVersioning {
2913
-
2914
- /**
2915
- * Generates a unique string to be used for child auro element naming.
2916
- * @private
2917
- * @param {string} baseName - Defines the first part of the unique element name.
2918
- * @param {string} version - Version of the component that will be appended to the baseName.
2919
- * @returns {string} - Unique string to be used for naming.
2920
- */
2921
- generateElementName(baseName, version) {
2922
- let result = baseName;
2923
-
2924
- result += '-';
2925
- result += version.replace(/[.]/g, '_');
2926
-
2927
- return result;
2928
- }
2929
-
2930
- /**
2931
- * Generates a unique string to be used for child auro element naming.
2932
- * @param {string} baseName - Defines the first part of the unique element name.
2933
- * @param {string} version - Version of the component that will be appended to the baseName.
2934
- * @returns {string} - Unique string to be used for naming.
2935
- */
2936
- generateTag(baseName, version, tagClass) {
2937
- const elementName = this.generateElementName(baseName, version);
2938
- const tag = i$4`${s$3(elementName)}`;
2939
-
2940
- if (!customElements.get(elementName)) {
2941
- customElements.define(elementName, class extends tagClass {});
2942
- }
2943
-
2944
- return tag;
2945
- }
2946
- }
2947
-
2948
- /**
2949
- * @license
2950
- * Copyright 2019 Google LLC
2951
- * SPDX-License-Identifier: BSD-3-Clause
2952
- */
2953
- const t=globalThis,e$2=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$2&&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$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$1=e$2?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$1(e)})(t):t;
2954
-
2955
- /**
2956
- * @license
2957
- * Copyright 2017 Google LLC
2958
- * SPDX-License-Identifier: BSD-3-Clause
2959
- */const{is:i$1,defineProperty:e$1,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$1(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");
2960
-
2961
- /**
2962
- * @license
2963
- * Copyright 2017 Google LLC
2964
- * SPDX-License-Identifier: BSD-3-Clause
2965
- */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");
2966
-
2967
- /**
2968
- * @license
2969
- * Copyright 2018 Google LLC
2970
- * SPDX-License-Identifier: BSD-3-Clause
2971
- */const o=o=>o??A;
2972
-
2973
- class p{registerComponent(t,a){customElements.get(t)||customElements.define(t,class extends a{});}closestElement(t,a=this,e=(a,s=a&&a.closest(t))=>a&&a!==document&&a!==window?s||e(a.getRootNode().host):null){return e(a)}handleComponentTagRename(t,a){const e=a.toLowerCase();t.tagName.toLowerCase()!==e&&t.setAttribute(e,true);}elementMatch(t,a){const e=a.toLowerCase();return t.tagName.toLowerCase()===e||t.hasAttribute(e)}getSlotText(t,a){const e=t.shadowRoot?.querySelector(`slot[name="${a}"]`);return (e?.assignedNodes({flatten:true})||[]).map(t=>t.textContent?.trim()).join(" ").trim()||null}}var u='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-labelledby="error__desc" class="ico_squareLarge" data-deprecated="true" role="img" style="min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor" viewBox="0 0 24 24" part="svg"><title/><desc id="error__desc">Error alert indicator.</desc><path d="m13.047 5.599 6.786 11.586A1.207 1.207 0 0 1 18.786 19H5.214a1.207 1.207 0 0 1-1.047-1.815l6.786-11.586a1.214 1.214 0 0 1 2.094 0m-1.165.87a.23.23 0 0 0-.085.085L5.419 17.442a.232.232 0 0 0 .203.35h12.756a.234.234 0 0 0 .203-.35L12.203 6.554a.236.236 0 0 0-.321-.084M12 15.5a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5m-.024-6.22c.325 0 .589.261.589.583v4.434a.586.586 0 0 1-.589.583.586.586 0 0 1-.588-.583V9.863c0-.322.264-.583.588-.583"/></svg>';class m extends i{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$2`: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}
2974
- `;class z extends m{constructor(){super(),this._initializeDefaults();}_initializeDefaults(){this.onDark=false,this.appearance="default";}static get properties(){return {...m.properties,onDark:{type:Boolean,reflect:true},appearance:{type:String,reflect:true},svg:{attribute:false,reflect:true}}}static get styles(){return 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$2`.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}
2975
- `;var y=i$2`: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)}
2976
- `;var x=i$2`: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)}
2977
- `;class _ extends z{constructor(){super(),this._initializeDefaults();}_initializeDefaults(){this.variant=void 0,this.uri="https://cdn.jsdelivr.net/npm/@alaskaairux/icons@latest/dist",this.runtimeUtils=new p;}static get properties(){return {...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,x]}static register(t="auro-icon"){p.prototype.registerComponent(t,_);}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 b$1`
2978
- <div class="componentWrapper">
2979
- <div
2980
- class="${e$4({svgWrapper:true})}"
2981
- title="${o(this.title||void 0)}">
2982
- <span aria-hidden="${o(this.ariaHidden||true)}" part="svg">
2983
- ${this.customSvg?b$1`
2984
- <slot name="svg"></slot>
2985
- `:b$1`
2986
- ${this.svg}
2987
- `}
2988
- </span>
2989
- </div>
2990
-
2991
- <div class="${e$4(t)}" part="label">
2992
- <slot></slot>
2993
- </div>
2994
- </div>
2995
- `}}
2996
-
2997
- var iconVersion = '9.1.2';
2998
-
2999
- /**
3000
- * @license
3001
- * Copyright 2017 Google LLC
3002
- * SPDX-License-Identifier: BSD-3-Clause
3003
- */class e extends i$3{constructor(i){if(super(i),this.it=A,i.type!==t$1.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===A||null==r)return this._t=void 0,this.it=r;if(r===E)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName="unsafeHTML",e.resultType=1;
3004
-
3005
- /**
3006
- * Computes display state once per keydown event.
3007
- * Centralizes null-safety checks and makes the shared/modal/popover branching explicit.
3008
- *
3009
- * @param {HTMLElement} component - The component with a dropdown reference.
3010
- * @param {Object} [options] - Optional config.
3011
- * @param {HTMLElement} [options.dropdown] - Explicit dropdown reference. Falls back to component.dropdown.
3012
- * @param {Function} [options.inputResolver] - Called with (component, ctx) to resolve the active input element.
3013
- * @returns {{isExpanded: boolean, isModal: boolean, isPopover: boolean, activeInput: HTMLElement|null}}
3014
- * isModal and isPopover reflect the display mode (fullscreen vs not) regardless of expanded state.
3015
- */
3016
- function createDisplayContext(component, options = {}) {
3017
- const dd = options.dropdown || component.dropdown;
3018
- // isPopoverVisible reflects as the `open` attribute.
3019
- // It reports whether the bib is open in any mode (popover or modal).
3020
- const isExpanded = Boolean(dd && dd.isPopoverVisible);
3021
- const isFullscreen = Boolean(dd && dd.isBibFullscreen);
3022
-
3023
- const ctx = {
3024
- isExpanded,
3025
- isModal: isFullscreen,
3026
- isPopover: !isFullscreen,
3027
- activeInput: null,
3028
- };
3029
-
3030
- if (options.inputResolver) {
3031
- const resolvedInput = options.inputResolver(component, ctx);
3032
- // Guard against resolvers returning undefined or non-HTMLElement values.
3033
- ctx.activeInput = resolvedInput instanceof HTMLElement ? resolvedInput : null;
3034
- }
3035
-
3036
- return ctx;
3037
- }
3038
-
3039
- /**
3040
- * Wires up a keydown listener that dispatches to strategy[evt.key] or strategy.default.
3041
- * Handles both sync and async handlers.
3042
- * @param {HTMLElement} component - The component to attach the listener to.
3043
- * @param {Object} strategy - Map of key names to handler functions.
3044
- * @param {Object} [options] - Optional config passed to createDisplayContext.
3045
- */
3046
- function applyKeyboardStrategy(component, strategy, options = {}) {
3047
- component.addEventListener('keydown', async (evt) => {
3048
- const handler = strategy[evt.key] || strategy.default;
3049
- if (typeof handler === 'function') {
3050
- const ctx = createDisplayContext(component, options);
3051
- await handler(component, evt, ctx);
3052
- }
3053
- });
3054
- }
3055
-
3056
- 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(:popover-open){position:fixed;overflow:visible;padding:0;border:none;margin:0;background:transparent;inset:unset;outline:none}: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}`;
3057
-
3058
- 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)}`;
3059
-
3060
- var tokensCss$1 = i$2`:host(:not([ondark])),:host(:not([appearance=inverse])){--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-muted, #676767);--ds-auro-dropdown-trigger-background-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdown-trigger-hover-background-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdown-trigger-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-bold, #585e67);--ds-auro-dropdown-trigger-outline-color: transparent;--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-dropdownbib-boxshadow-color: var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, 0.15));--ds-auro-dropdownbib-background-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdownbib-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdownbib-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}:host([ondark]),:host([appearance=inverse]){--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db);--ds-auro-dropdown-trigger-background-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdown-trigger-hover-background-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdown-trigger-container-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-inverse, #ffffff);--ds-auro-dropdown-trigger-outline-color: transparent;--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-inverse, #ffffff);--ds-auro-dropdownbib-boxshadow-color: var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, 0.15));--ds-auro-dropdownbib-background-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdownbib-container-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdownbib-text-color: var(--ds-basic-color-texticon-inverse, #ffffff)}`;
3061
-
3062
- /**
3063
- * Creates a keyboard strategy for dialog-specific key handling.
3064
- * All other keydown behavior is left to the browser's native bubbling path.
3065
- * @param {HTMLElement} bib - The dropdown bib element.
3066
- * @returns {Object} Keyboard handlers keyed by `event.key`.
3067
- */
3068
- // eslint-disable-next-line no-unused-vars
3069
- function createDropdownBibKeyboardStrategy(bib) {
3070
- return {
3071
- // eslint-disable-next-line no-unused-vars
3072
- Enter(_dialog, event) {
3073
- // Floating UI handles Enter key to open the dropdown
3074
- },
3075
- // eslint-disable-next-line no-unused-vars
3076
- Escape(_dialog, event) {
3077
- // Floating UI handles Escape key to close the dropdown
3078
- }
3079
- };
3080
- }
3081
-
3082
- // Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
3083
- // See LICENSE in the project root for license information.
3084
- /* eslint-disable max-lines */
3085
- // ---------------------------------------------------------------------
3086
-
3087
-
3088
- const DESIGN_TOKEN_BREAKPOINT_PREFIX = '--ds-grid-breakpoint-';
3089
- const DESIGN_TOKEN_BREAKPOINT_OPTIONS = [
3090
- 'xl',
3091
- 'lg',
3092
- 'md',
3093
- 'sm',
3094
- 'xs',
3095
- ];
3096
-
3097
- /**
3098
- * @prop { String } fullscreenBreakpoint - Defines the screen size breakpoint (`lg`, `md`, `sm`, or `xs`) at which the dropdown switches to fullscreen mode on mobile. When expanded, the dropdown will automatically display in fullscreen mode if the screen size is equal to or smaller than the selected breakpoint.
3099
- * @csspart bibContainer - Apply css to the bib container.
3100
- */
3101
-
3102
- class AuroDropdownBib extends i {
3103
- // not extending AuroElement because Bib needs only `shape` prop
3104
- constructor() {
3105
- super();
3106
-
3107
- /**
3108
- * @private
3109
- */
3110
- this._mobileBreakpointValue = undefined;
3111
-
3112
- AuroLibraryRuntimeUtils$1.prototype.handleComponentTagRename(this, 'auro-dropdownbib');
3113
-
3114
- this.shape = "rounded";
3115
- this.matchWidth = false;
3116
- this.hasActiveDescendant = false;
3117
- }
3118
-
3119
- static get styles() {
3120
- return [
3121
- styleCss$2,
3122
- colorCss$2,
3123
- tokensCss$1
3124
- ];
3125
- }
3126
-
3127
- static get properties() {
3128
- return {
3129
-
3130
- /**
3131
- * If declared, will take the fullscreen when the bib is displayed.
3132
- */
3133
- isFullscreen: {
3134
- type: Boolean,
3135
- reflect: true
3136
- },
3137
-
3138
- /**
3139
- * If declared, will apply all styles for the common theme.
3140
- */
3141
- common: {
3142
- type: Boolean,
3143
- reflect: true
3144
- },
3145
-
3146
- /**
3147
- * If declared, will apply extra padding to bib content.
3148
- */
3149
- inset: {
3150
- type: Boolean,
3151
- reflect: true
3152
- },
3153
-
3154
- /**
3155
- * If declared, the bib width will match the trigger width.
3156
- * @private
3157
- */
3158
- matchWidth: {
3159
- type: Boolean,
3160
- reflect: true
3161
- },
3162
-
3163
- /**
3164
- * If declared, will apply border-radius to the bib.
3165
- */
3166
- rounded: {
3167
- type: Boolean,
3168
- reflect: true
3169
- },
3170
-
3171
- /**
3172
- * A reference to the associated bib template element.
3173
- */
3174
- bibTemplate: {
3175
- type: Object
3176
- },
3177
-
3178
- shape: {
3179
- type: String,
3180
- reflect: true
3181
- },
3182
-
3183
- /**
3184
- * Accessible label for the dialog element, used when displayed as a modal.
3185
- * Applied via aria-labelledby on a visually hidden element rather than
3186
- * aria-label because iOS VoiceOver does not reliably read aria-label
3187
- * on <dialog> elements.
3188
- * @private
3189
- */
3190
- dialogLabel: {
3191
- type: String
3192
- },
3193
-
3194
- /**
3195
- * Overrides the native role of the dialog element.
3196
- * For example, set to `"presentation"` on desktop combobox to prevent
3197
- * VoiceOver from announcing "listbox inside of a dialog".
3198
- * When `undefined`, the dialog keeps its native role.
3199
- * @private
3200
- */
3201
- dialogRole: {
3202
- type: String
3203
- },
3204
-
3205
- /**
3206
- * Tracks whether a menu option is currently highlighted.
3207
- * @private
3208
- */
3209
- hasActiveDescendant: {
3210
- type: Boolean
3211
- }
3212
- };
3213
- }
3214
-
3215
- set mobileFullscreenBreakpoint(value) {
3216
- // verify the defined breakpoint is valid and exit out if not
3217
- // 'disabled' is a design token breakpoint so it acts as our "undefined" value
3218
- const validatedValue = DESIGN_TOKEN_BREAKPOINT_OPTIONS.includes(value) ? value : undefined;
3219
- if (!validatedValue) {
3220
- this._mobileBreakpointValue = undefined;
3221
- } else {
3222
- // get the pixel value for the defined breakpoint
3223
- const docStyle = getComputedStyle(document.documentElement);
3224
- this._mobileBreakpointValue = docStyle.getPropertyValue(DESIGN_TOKEN_BREAKPOINT_PREFIX + value);
3225
- }
3226
- }
3227
-
3228
- get mobileFullscreenBreakpoint() {
3229
- return this._mobileBreakpointValue;
3230
- }
3231
-
3232
- updated(changedProperties) {
3233
- if (changedProperties.has('isFullscreen')) {
3234
- this.childNodes.forEach((child) => {
3235
- // skip any text that is not in an HTMLElement on setting `isFullscreen` attr.
3236
- if (child.nodeName !== '#text') {
3237
- if (this.isFullscreen) {
3238
- child.setAttribute('isFullscreen', 'true');
3239
- } else {
3240
- child.removeAttribute('isFullscreen');
3241
- }
3242
- }
3243
- });
3244
-
3245
- if (this.bibTemplate) {
3246
- // If the bib template is found, set the fullscreen attribute
3247
- if (this.isFullscreen) {
3248
- this.bibTemplate.setAttribute('isFullscreen', 'true');
3249
- } else {
3250
- this.bibTemplate.removeAttribute('isFullscreen');
3251
- }
3252
- }
3253
- }
3254
- }
3255
-
3256
- connectedCallback() {
3257
- super.connectedCallback();
3258
-
3259
- // Listen for the auro-bibtemplate-connected event to set the fullscreen attribute
3260
- this.addEventListener('auro-bibtemplate-connected', (event) => {
3261
- const bibTemplate = event.detail.element;
3262
- this.bibTemplate = bibTemplate;
3263
-
3264
- if (bibTemplate) {
3265
- // If the bib template is found, set the fullscreen attribute
3266
- if (this.isFullscreen) {
3267
- bibTemplate.setAttribute('isFullscreen', 'true');
3268
- } else {
3269
- bibTemplate.removeAttribute('isFullscreen');
3270
- }
3271
- }
3272
- });
3273
- }
3274
-
3275
- firstUpdated(changedProperties) {
3276
- super.firstUpdated(changedProperties);
3277
-
3278
- const dialog = this.shadowRoot.querySelector('dialog');
3279
- this._setupCancelHandler(dialog);
3280
- applyKeyboardStrategy(dialog, createDropdownBibKeyboardStrategy());
3281
-
3282
- this.dispatchEvent(new CustomEvent('auro-dropdownbib-connected', {
3283
- bubbles: true,
3284
- composed: true,
3285
- detail: {
3286
- element: this
3287
- }
3288
- }));
3289
- }
3290
-
3291
- /**
3292
- * Forwards the dialog's native `cancel` event (fired on ESC) as
3293
- * an `auro-bib-cancel` custom event so parent components can close.
3294
- * @param {HTMLDialogElement} dialog - The dialog element to attach the cancel listener to.
3295
- * @private
3296
- */
3297
- _setupCancelHandler(dialog) {
3298
- dialog.addEventListener('cancel', (event) => {
3299
- event.preventDefault();
3300
- this.dispatchEvent(new CustomEvent('auro-bib-cancel', {
3301
- bubbles: true,
3302
- composed: true
3303
- }));
3304
- });
3305
- }
3306
-
3307
-
3308
- /**
3309
- * Blocks touch-driven page scroll while a fullscreen modal dialog is open.
3310
- *
3311
- * The showModal() function places the dialog in the browser's **top layer**,
3312
- * which is a separate rendering layer above the normal DOM. On mobile, the
3313
- * compositor processes visual-viewport panning before top-layer touch
3314
- * handling. This means the entire viewport — including the top-layer dialog
3315
- * — can be panned by a touch gesture, causing the page behind the dialog to
3316
- * scroll into view. To prevent this, we add a touchmove listener that cancels
3317
- * the event if the touch started outside the dialog or any scrollable child within it.
3318
- *
3319
- * @private
3320
- */
3321
- _lockTouchScroll() {
3322
- const dialog = this.shadowRoot.querySelector('dialog');
3323
-
3324
- this._touchMoveHandler = (event) => {
3325
- // Walk the composed path (which crosses shadow DOM boundaries) to
3326
- // check whether the touch started inside a scrollable element that
3327
- // lives within the dialog. If so, allow the scroll.
3328
- for (const el of event.composedPath()) {
3329
- if (el === dialog) {
3330
- // Reached the dialog boundary without finding a scrollable child.
3331
- break;
3332
- }
3333
- if (el instanceof HTMLElement && el.scrollHeight > el.clientHeight) {
3334
- const { overflowY } = getComputedStyle(el);
3335
- if (overflowY === 'auto' || overflowY === 'scroll') {
3336
- return;
3337
- }
3338
- }
3339
- }
3340
-
3341
- event.preventDefault();
3342
- };
3343
-
3344
- document.addEventListener('touchmove', this._touchMoveHandler, { passive: false });
3345
- }
3346
-
3347
- /**
3348
- * Removes the touchmove listener added by _lockTouchScroll().
3349
- * @private
3350
- */
3351
- _unlockTouchScroll() {
3352
- if (this._touchMoveHandler) {
3353
- document.removeEventListener('touchmove', this._touchMoveHandler);
3354
- this._touchMoveHandler = undefined;
3355
- }
3356
- }
3357
-
3358
- open(modal = true) {
3359
- const dialog = this.shadowRoot.querySelector('dialog');
3360
-
3361
- if (dialog && !dialog.open) {
3362
- if (modal) {
3363
- // Prevent showModal() from scrolling the page to bring the dialog
3364
- // into view. Locking overflow on <html> blocks the viewport scroll
3365
- // that browsers perform natively; we release it immediately after
3366
- // so it doesn't interfere with the modal's focus management.
3367
- const { documentElement } = document;
3368
- const prevOverflow = documentElement.style.overflow;
3369
- documentElement.style.overflow = 'hidden';
3370
-
3371
- try {
3372
- dialog.showModal();
3373
- } finally {
3374
- // Restore overflow immediately — the lock was only needed to
3375
- // suppress the browser's native scroll-into-view behavior
3376
- // triggered by showModal(). Keeping it locked would block
3377
- // scrolling inside the modal.
3378
- documentElement.style.overflow = prevOverflow;
3379
- }
3380
-
3381
- this._lockTouchScroll();
3382
-
3383
- } else {
3384
- // Open the inner dialog so slotted content renders.
3385
- dialog.setAttribute('open', '');
3386
-
3387
- // Use popover on the host for top-layer placement without focus
3388
- // management or inertness. This escapes ancestor container-type
3389
- // containment that would trap position:fixed relative to the container.
3390
- // Set popover dynamically to avoid UA [popover]:not(:popover-open) { display: none }
3391
- // interfering with Floating UI measurement before showPopover().
3392
- this.setAttribute('popover', 'manual');
3393
- this.showPopover();
3394
- }
3395
- }
3396
- }
3397
-
3398
- /**
3399
- * Closes the dialog.
3400
- */
3401
- close() {
3402
- this.hasActiveDescendant = false;
3403
-
3404
- const dialog = this.shadowRoot.querySelector('dialog');
3405
-
3406
- if (dialog && dialog.open) {
3407
- this._unlockTouchScroll();
3408
- dialog.close();
3409
- }
3410
- // Clean up the popover used for desktop top-layer placement.
3411
- // Remove the attribute entirely so the UA rule
3412
- // [popover]:not(:popover-open) { display: none } doesn't hide
3413
- // the host while Floating UI measures it for the next open.
3414
- if (this.matches(':popover-open')) {
3415
- this.hidePopover();
3416
- this.removeAttribute('popover');
3417
- }
3418
- }
3419
-
3420
- // function that renders the HTML and CSS into the scope of the component
3421
- render() {
3422
- const classes = {
3423
- container: true
3424
- };
3425
-
3426
- // Since this class does not inherit from AuroElement, we apply the shape-related class within the `render` function,
3427
- // mimicking the class naming convention used in AuroElement.resetShapeClasses.
3428
- classes[`shape-${this.shape}`] = true;
3429
-
3430
- return u$2`
3431
- <dialog class="${e$4(classes)}" part="bibContainer" role="${o(this.dialogRole)}" aria-labelledby="${o(this.dialogLabel ? 'dialogLabel' : undefined)}">
3432
- ${this.dialogLabel ? u$2`<span id="dialogLabel" class="util_displayHiddenVisually">${this.dialogLabel}</span>` : ''}
3433
- <slot></slot>
3434
- </dialog>
3435
- `;
3436
- }
3437
- }
3438
-
3439
- var shapeSizeCss = i$2`.shape-classic-xl,.shape-classic-lg,.shape-classic-md,.shape-classic-sm,.shape-classic-xs{min-height:56px;max-height:56px;border-style:solid;border-width:1px;border-radius:var(--ds-border-radius, 0.375rem)}.shape-classic-xl.simple,.shape-classic-lg.simple,.shape-classic-md.simple,.shape-classic-sm.simple,.shape-classic-xs.simple{border-width:0px;min-height:58px;max-height:58px;background-color:unset;box-shadow:none}.shape-classic-xl.thin,.shape-classic-lg.thin,.shape-classic-md.thin,.shape-classic-sm.thin,.shape-classic-xs.thin{border-width:1px;min-height:56px;max-height:56px;background-color:unset}.shape-classic-xl.parentBorder,.shape-classic-lg.parentBorder,.shape-classic-md.parentBorder,.shape-classic-sm.parentBorder,.shape-classic-xs.parentBorder{border:0;box-shadow:unset;min-height:54px;max-height:54px}.shape-snowflake-xl,.shape-snowflake-lg,.shape-snowflake-md,.shape-snowflake-sm,.shape-snowflake-xs{min-height:56px;max-height:56px;border-style:solid;border-width:2px;border-color:transparent;border-radius:30px}.shape-snowflake-xl.simple,.shape-snowflake-lg.simple,.shape-snowflake-md.simple,.shape-snowflake-sm.simple,.shape-snowflake-xs.simple{border-width:0px;min-height:60px;max-height:60px;background-color:unset;box-shadow:none}.shape-snowflake-xl.thin,.shape-snowflake-lg.thin,.shape-snowflake-md.thin,.shape-snowflake-sm.thin,.shape-snowflake-xs.thin{border-width:1px;min-height:58px;max-height:58px;background-color:unset}.shape-snowflake-xl.parentBorder,.shape-snowflake-lg.parentBorder,.shape-snowflake-md.parentBorder,.shape-snowflake-sm.parentBorder,.shape-snowflake-xs.parentBorder{border:0;box-shadow:unset;min-height:56px;max-height:56px}.shape-box-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent}.shape-box-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-box-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-box-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-box-lg{min-height:52px;max-height:52px;border-style:solid;border-width:2px;border-color:transparent}.shape-box-lg.simple{border-width:0px;min-height:56px;max-height:56px;background-color:unset;box-shadow:none}.shape-box-lg.thin{border-width:1px;min-height:54px;max-height:54px;background-color:unset}.shape-box-lg.parentBorder{border:0;box-shadow:unset;min-height:52px;max-height:52px}.shape-box-md{min-height:44px;max-height:44px;border-style:solid;border-width:2px;border-color:transparent}.shape-box-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-box-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-box-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-box-sm{min-height:32px;max-height:32px;border-style:solid;border-width:2px;border-color:transparent}.shape-box-sm.simple{border-width:0px;min-height:36px;max-height:36px;background-color:unset;box-shadow:none}.shape-box-sm.thin{border-width:1px;min-height:34px;max-height:34px;background-color:unset}.shape-box-sm.parentBorder{border:0;box-shadow:unset;min-height:32px;max-height:32px}.shape-box-xs{min-height:20px;max-height:20px;border-style:solid;border-width:2px;border-color:transparent}.shape-box-xs.simple{border-width:0px;min-height:24px;max-height:24px;background-color:unset;box-shadow:none}.shape-box-xs.thin{border-width:1px;min-height:22px;max-height:22px;background-color:unset}.shape-box-xs.parentBorder{border:0;box-shadow:unset;min-height:20px;max-height:20px}.shape-rounded-lg{min-height:56px;max-height:56px;border-style:solid;border-width:2px;border-color:transparent;border-radius:6px}.shape-rounded-lg.simple{border-width:0px;min-height:56px;max-height:56px;background-color:unset;box-shadow:none}.shape-rounded-lg.thin{border-width:1px;min-height:54px;max-height:54px;background-color:unset}.shape-rounded-lg.parentBorder{border:0;box-shadow:unset;min-height:52px;max-height:52px}.shape-pill-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px}.shape-pill-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-pill-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-pill-left-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px 0 0 36px}.shape-pill-left-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-pill-left-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-left-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-pill-right-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent;border-radius:0 36px 36px 0}.shape-pill-right-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-pill-right-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-right-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-pill-md{min-height:44px;max-height:44px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px}.shape-pill-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-pill-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-pill-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-pill-left-md{min-height:44px;max-height:44px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px 0 0 36px}.shape-pill-left-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-pill-left-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-pill-left-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-pill-right-md{min-height:44px;max-height:44px;border-style:solid;border-width:2px;border-color:transparent;border-radius:0 36px 36px 0}.shape-pill-right-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-pill-right-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-pill-right-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}`;
3440
-
3441
- 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)}`;
3442
-
3443
- 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%}`;
3444
-
3445
- var classicColorCss = i$2``;
3446
-
3447
- var classicLayoutCss = i$2`@media(hover: hover){:host(:not([disabled])) .wrapper:hover{cursor:pointer}}:host([layout*=classic]){position:relative;max-width:100%}:host([layout*=classic]) #bibSizer{position:absolute;z-index:-1;opacity:0;pointer-events:none}:host([layout*=classic]) label{transition:font-size .3s cubic-bezier(0.215, 0.61, 0.355, 1);white-space:normal}:host([layout*=classic]) .wrapper{display:flex;flex-direction:row;box-shadow:inset 0 0 0 1px var(--ds-auro-dropdown-trigger-outline-color)}:host([layout*=classic]) .triggerContentWrapper{overflow:hidden;flex:1;justify-content:start;text-overflow:ellipsis;white-space:nowrap}:host([layout*=classic]) #showStateIcon{display:flex;overflow:hidden;height:100%;align-items:center;padding-right:var(--ds-size-150, 0.75rem)}:host([layout*=classic]) #showStateIcon [auro-icon]{height:var(--ds-size-300, 1.5rem)}:host([layout*=classic]) #showStateIcon[data-expanded=true] [auro-icon]{transform:rotate(-180deg)}`;
3448
-
3449
- var styleEmphasizedCss = i$2`.layout-emphasized .chevron,.layout-emphasized-left .chevron,.layout-emphasized-right .chevron{margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=right])) .leftIndent{width:calc(100% - var(--ds-size-300, 1.5rem));margin-left:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=left])) .rightIndent{width:calc(100% - var(--ds-size-300, 1.5rem));margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=left]):not([layout*=right])) .rightIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-right:var(--ds-size-300, 1.5rem)}`;
3450
-
3451
- var styleSnowflakeCss = i$2`:host([layout*=snowflake]) .leftIndent{width:calc(100% - var(--ds-size-400, 2rem));margin-left:var(--ds-size-200, 1rem)}:host([layout*=snowflake]) .rightIndent{width:calc(100% - var(--ds-size-400, 2rem));margin-right:var(--ds-size-200, 1rem)}:host([layout*=snowflake]) .trigger,:host([layout*=snowflake]) .helpText{text-align:center}.layout-snowflake .chevron,.layout-snowflake-left .chevron,.layout-snowflake-right .chevron{margin-right:var(--ds-size-200, 1rem)}`;
3452
-
3453
- var colorCss = i$2`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]),:host([appearance=inverse]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]),:host([appearance=inverse][error]){--ds-auro-helptext-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}.helptext-wrapper{color:var(--ds-auro-helptext-color)}`;
3454
-
3455
- var styleCss = i$2`.body-default{font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.body-default,.body-lg{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-lg{font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{font-size:var(--wcss-body-sm-font-size, 0.875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.body-sm,.body-xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-xs{font-size:var(--wcss-body-xs-font-size, 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-size:var(--wcss-body-2xs-font-size, 0.625rem);font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);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);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem));font-weight:var(--wcss-display-2xl-weight, 300);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);line-height:var(--wcss-display-2xl-line-height, 1.3)}.display-xl{font-family:var(--wcss-display-xl-family, "AS Circular"),var(--wcss-display-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem));font-weight:var(--wcss-display-xl-weight, 300);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);line-height:var(--wcss-display-xl-line-height, 1.3)}.display-lg{font-family:var(--wcss-display-lg-family, "AS Circular"),var(--wcss-display-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem));font-weight:var(--wcss-display-lg-weight, 300);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);line-height:var(--wcss-display-lg-line-height, 1.3)}.display-md{font-family:var(--wcss-display-md-family, "AS Circular"),var(--wcss-display-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem));font-weight:var(--wcss-display-md-weight, 300);letter-spacing:var(--wcss-display-md-letter-spacing, 0);line-height:var(--wcss-display-md-line-height, 1.3)}.display-sm{font-family:var(--wcss-display-sm-family, "AS Circular"),var(--wcss-display-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem));font-weight:var(--wcss-display-sm-weight, 300);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);line-height:var(--wcss-display-sm-line-height, 1.3)}.display-xs{font-family:var(--wcss-display-xs-family, "AS Circular"),var(--wcss-display-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem));font-weight:var(--wcss-display-xs-weight, 300);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);line-height:var(--wcss-display-xs-line-height, 1.3)}.heading-xl{font-family:var(--wcss-heading-xl-family, "AS Circular"),var(--wcss-heading-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem));font-weight:var(--wcss-heading-xl-weight, 300);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);line-height:var(--wcss-heading-xl-line-height, 1.3)}.heading-lg{font-family:var(--wcss-heading-lg-family, "AS Circular"),var(--wcss-heading-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem));font-weight:var(--wcss-heading-lg-weight, 300);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);line-height:var(--wcss-heading-lg-line-height, 1.3)}.heading-md{font-family:var(--wcss-heading-md-family, "AS Circular"),var(--wcss-heading-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem));font-weight:var(--wcss-heading-md-weight, 300);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);line-height:var(--wcss-heading-md-line-height, 1.3)}.heading-sm{font-family:var(--wcss-heading-sm-family, "AS Circular"),var(--wcss-heading-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem));font-weight:var(--wcss-heading-sm-weight, 300);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);line-height:var(--wcss-heading-sm-line-height, 1.3)}.heading-xs{font-family:var(--wcss-heading-xs-family, "AS Circular"),var(--wcss-heading-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem));font-weight:var(--wcss-heading-xs-weight, 450);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);line-height:var(--wcss-heading-xs-line-height, 1.3)}.heading-2xs{font-family:var(--wcss-heading-2xs-family, "AS Circular"),var(--wcss-heading-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem));font-weight:var(--wcss-heading-2xs-weight, 450);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);line-height:var(--wcss-heading-2xs-line-height, 1.3)}.accent-2xl{font-family:var(--wcss-accent-2xl-family, "Good OT"),var(--wcss-accent-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));font-weight:var(--wcss-accent-2xl-weight, 450);letter-spacing:var(--wcss-accent-2xl-letter-spacing, 0.05em);line-height:var(--wcss-accent-2xl-line-height, 1)}.accent-2xl,.accent-xl{text-transform:uppercase}.accent-xl{font-family:var(--wcss-accent-xl-family, "Good OT"),var(--wcss-accent-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));font-weight:var(--wcss-accent-xl-weight, 450);letter-spacing:var(--wcss-accent-xl-letter-spacing, 0.05em);line-height:var(--wcss-accent-xl-line-height, 1.3)}.accent-lg{font-family:var(--wcss-accent-lg-family, "Good OT"),var(--wcss-accent-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));font-weight:var(--wcss-accent-lg-weight, 450);letter-spacing:var(--wcss-accent-lg-letter-spacing, 0.05em);line-height:var(--wcss-accent-lg-line-height, 1.3)}.accent-lg,.accent-md{text-transform:uppercase}.accent-md{font-family:var(--wcss-accent-md-family, "Good OT"),var(--wcss-accent-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));font-weight:var(--wcss-accent-md-weight, 500);letter-spacing:var(--wcss-accent-md-letter-spacing, 0.05em);line-height:var(--wcss-accent-md-line-height, 1.3)}.accent-sm{font-family:var(--wcss-accent-sm-family, "Good OT"),var(--wcss-accent-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));font-weight:var(--wcss-accent-sm-weight, 500);letter-spacing:var(--wcss-accent-sm-letter-spacing, 0.05em);line-height:var(--wcss-accent-sm-line-height, 1.3)}.accent-sm,.accent-xs{text-transform:uppercase}.accent-xs{font-family:var(--wcss-accent-xs-family, "Good OT"),var(--wcss-accent-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));font-weight:var(--wcss-accent-xs-weight, 500);letter-spacing:var(--wcss-accent-xs-letter-spacing, 0.1em);line-height:var(--wcss-accent-xs-line-height, 1.3)}.accent-2xs{font-family:var(--wcss-accent-2xs-family, "Good OT"),var(--wcss-accent-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xs-font-size, clamp(0.875rem, 1.1666666667vw, 0.875rem));font-weight:var(--wcss-accent-2xs-weight, 450);letter-spacing:var(--wcss-accent-2xs-letter-spacing, 0.1em);line-height:var(--wcss-accent-2xs-line-height, 1.3);text-transform:uppercase}:host{position:relative;display:block}.helptext-wrapper{display:none}.helptext-wrapper[visible]{display:block}::slotted(*:not(:empty)){margin-top:var(--ds-size-50, 0.25rem);margin-bottom:0}::slotted(p){margin-block:0}`;
3456
-
3457
- var tokensCss = i$2`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
3458
-
3459
- // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
3460
- // See LICENSE in the project root for license information.
3461
-
3462
- // ---------------------------------------------------------------------
3463
-
3464
- /* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
3465
-
3466
- class AuroLibraryRuntimeUtils {
3467
-
3468
- /* eslint-disable jsdoc/require-param */
3469
-
3470
- /**
3471
- * This will register a new custom element with the browser.
3472
- * @param {String} name - The name of the custom element.
3473
- * @param {Object} componentClass - The class to register as a custom element.
3474
- * @returns {void}
3475
- */
3476
- registerComponent(name, componentClass) {
3477
- if (!customElements.get(name)) {
3478
- customElements.define(name, class extends componentClass {});
3479
- }
3480
- }
3481
-
3482
- /**
3483
- * Finds and returns the closest HTML Element based on a selector.
3484
- * @returns {void}
3485
- */
3486
- closestElement(
3487
- selector, // selector like in .closest()
3488
- base = this, // extra functionality to skip a parent
3489
- __Closest = (el, found = el && el.closest(selector)) =>
3490
- !el || el === document || el === window
3491
- ? null // standard .closest() returns null for non-found selectors also
3492
- : found
3493
- ? found // found a selector INside this element
3494
- : __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
3495
- ) {
3496
- return __Closest(base);
3497
- }
3498
- /* eslint-enable jsdoc/require-param */
3499
-
3500
- /**
3501
- * If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
3502
- * @param {Object} elem - The element to check.
3503
- * @param {String} tagName - The name of the Auro component to check for or add as an attribute.
3504
- * @returns {void}
3505
- */
3506
- handleComponentTagRename(elem, tagName) {
3507
- const tag = tagName.toLowerCase();
3508
- const elemTag = elem.tagName.toLowerCase();
3509
-
3510
- if (elemTag !== tag) {
3511
- elem.setAttribute(tag, true);
3512
- }
3513
- }
3514
-
3515
- /**
3516
- * Validates if an element is a specific Auro component.
3517
- * @param {Object} elem - The element to validate.
3518
- * @param {String} tagName - The name of the Auro component to check against.
3519
- * @returns {Boolean} - Returns true if the element is the specified Auro component.
3520
- */
3521
- elementMatch(elem, tagName) {
3522
- const tag = tagName.toLowerCase();
3523
- const elemTag = elem.tagName.toLowerCase();
3524
-
3525
- return elemTag === tag || elem.hasAttribute(tag);
3526
- }
3527
-
3528
- /**
3529
- * Gets the text content of a named slot.
3530
- * @returns {String}
3531
- * @private
3532
- */
3533
- getSlotText(elem, name) {
3534
- const slot = elem.shadowRoot?.querySelector(`slot[name="${name}"]`);
3535
- const nodes = slot?.assignedNodes({ flatten: true }) || [];
3536
- const text = nodes.map(n => n.textContent?.trim()).join(' ').trim();
3537
-
3538
- return text || null;
3539
- }
3540
- }
3541
-
3542
- // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
3543
- // See LICENSE in the project root for license information.
3544
-
3545
-
3546
- /**
3547
- * Displays help text or error messages within form elements - Internal Use Only.
3548
- */
3549
- class AuroHelpText extends i {
3550
-
3551
- constructor() {
3552
- super();
3553
-
3554
- this.error = false;
3555
- this.appearance = "default";
3556
- this.onDark = false;
3557
- this.hasTextContent = false;
3558
-
3559
- AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-helptext');
3560
- }
3561
-
3562
- static get styles() {
3563
- return [
3564
- colorCss,
3565
- styleCss,
3566
- tokensCss
3567
- ];
3568
- }
3569
-
3570
- // function to define props used within the scope of this component
3571
- static get properties() {
3572
- return {
3573
-
3574
- /**
3575
- * Defines whether the component will be on lighter or darker backgrounds.
3576
- * @property {'default', 'inverse'}
3577
- * @default 'default'
3578
- */
3579
- appearance: {
3580
- type: String,
3581
- reflect: true
3582
- },
3583
-
3584
- /**
3585
- * @private
3586
- */
3587
- slotNodes: {
3588
- type: Boolean,
3589
- },
3590
-
3591
- /**
3592
- * @private
3593
- */
3594
- hasTextContent: {
3595
- type: Boolean,
3596
- },
3597
-
3598
- /**
3599
- * If declared, make font color red.
3600
- */
3601
- error: {
3602
- type: Boolean,
3603
- reflect: true,
3604
- },
3605
-
3606
- /**
3607
- * DEPRECATED - use `appearance` instead.
3608
- */
3609
- onDark: {
3610
- type: Boolean,
3611
- reflect: true
3612
- }
3613
- };
3614
- }
3615
-
3616
- /**
3617
- * This will register this element with the browser.
3618
- * @param {string} [name="auro-helptext"] - The name of element that you want to register to.
3619
- *
3620
- * @example
3621
- * AuroCheckbox.register("custom-helptext") // this will register this element to <custom-helptext/>
3622
- *
3623
- */
3624
- static register(name = "auro-helptext") {
3625
- AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroHelpText);
3626
- }
3627
-
3628
- updated() {
3629
- this.handleSlotChange();
3630
- }
3631
-
3632
- handleSlotChange(event) {
3633
- if (event) {
3634
- this.slotNodes = event.target.assignedNodes();
3635
- }
3636
-
3637
- this.hasTextContent = this.checkSlotsForContent(this.slotNodes);
3638
- }
3639
-
3640
- /**
3641
- * Checks if any of the provided nodes or their nested slot nodes contain non-empty text content.
3642
- *
3643
- * @param {NodeList|Array} nodes - The list of nodes to check for content.
3644
- * @returns {boolean} - Returns true if any node or nested slot node contains non-empty text content, otherwise false.
3645
- * @private
3646
- */
3647
- checkSlotsForContent(nodes) {
3648
- if (!nodes) {
3649
- return false;
3650
- }
3651
-
3652
- return nodes.some((node) => {
3653
- if (node.textContent.trim()) {
3654
- return true;
3655
- }
3656
-
3657
- if (!node.querySelector) {
3658
- return false;
3659
- }
3660
-
3661
- const nestedSlot = node.tagName === 'SLOT' ? node : node.querySelector('slot');
3662
- if (!nestedSlot) {
3663
- return false;
3664
- }
3665
-
3666
- const nestedSlotNodes = nestedSlot.assignedNodes();
3667
- return this.checkSlotsForContent(nestedSlotNodes);
3668
- });
3669
- }
3670
-
3671
- // function that renders the HTML and CSS into the scope of the component
3672
- render() {
3673
- return b$1`
3674
- <div class="helptext-wrapper body-xs" ?visible="${this.hasTextContent}">
3675
- <slot @slotchange=${this.handleSlotChange}></slot>
3676
- </div>
3677
- `;
3678
- }
3679
- }
3680
-
3681
- var formkitVersion = '202604031554';
3682
-
3683
- class AuroElement extends i {
3684
- static get properties() {
3685
- return {
3686
-
3687
- /**
3688
- * Defines the language of an element.
3689
- * @default {'default'}
3690
- */
3691
- layout: {
3692
- type: String,
3693
- attribute: "layout",
3694
- reflect: true
3695
- },
3696
-
3697
- shape: {
3698
- type: String,
3699
- attribute: "shape",
3700
- reflect: true
3701
- },
3702
-
3703
- size: {
3704
- type: String,
3705
- attribute: "size",
3706
- reflect: true
3707
- },
3708
-
3709
- onDark: {
3710
- type: Boolean,
3711
- attribute: "ondark",
3712
- reflect: true
3713
- }
3714
- };
3715
- }
3716
-
3717
- /**
3718
- * Returns true if the element has focus.
3719
- * @private
3720
- * @returns {boolean} - Returns true if the element has focus.
3721
- */
3722
- get componentHasFocus() {
3723
- return this.matches(':focus') || this.matches(':focus-within');
3724
- }
3725
-
3726
- resetShapeClasses() {
3727
- const wrapper = this.shadowRoot.querySelector('.wrapper');
3728
-
3729
- if (wrapper) {
3730
- wrapper.classList.forEach((className) => {
3731
- if (className.startsWith('shape-')) {
3732
- wrapper.classList.remove(className);
3733
- }
3734
- });
3735
-
3736
- if (this.shape && this.size) {
3737
- wrapper.classList.add(`shape-${this.shape.toLowerCase()}-${this.size.toLowerCase()}`);
3738
- } else {
3739
- wrapper.classList.add('shape-none');
3740
- }
3741
- }
3742
-
3743
- }
3744
-
3745
- resetLayoutClasses() {
3746
- if (this.layout) {
3747
- const wrapper = this.shadowRoot.querySelector('.wrapper');
3748
-
3749
- if (wrapper) {
3750
- wrapper.classList.forEach((className) => {
3751
- if (className.startsWith('layout-')) {
3752
- wrapper.classList.remove(className);
3753
- }
3754
- });
3755
-
3756
- wrapper.classList.add(`layout-${this.layout.toLowerCase()}`);
3757
- }
3758
- }
3759
- }
3760
-
3761
- updateComponentArchitecture() {
3762
- this.resetLayoutClasses();
3763
- this.resetShapeClasses();
3764
- }
3765
-
3766
- updated(changedProperties) {
3767
- if (changedProperties.has('layout') || changedProperties.has('shape') || changedProperties.has('size')) {
3768
- this.updateComponentArchitecture();
3769
- }
3770
- }
3771
-
3772
- // Try to render the defined `this.layout` layout. If that fails, fall back to the default layout.
3773
- // This will catch if an invalid layout value is passed in and render the default layout if so.
3774
- render() {
3775
- try {
3776
- return this.renderLayout();
3777
- } catch (error) {
3778
- // failed to get the defined layout
3779
- console.error('Failed to get the defined layout - using the default layout', error); // eslint-disable-line no-console
3780
-
3781
- // fallback to the default layout
3782
- return this.getLayout('default');
3783
- }
3784
- }
3785
- }
3786
-
3787
- // Copyright (c) 2026 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
3788
- // See LICENSE in the project root for license information.
3789
-
3790
-
3791
- /**
3792
- * The `auro-dropdown` element provides a way to place content in a bib that can be toggled.
3793
- * @customElement auro-dropdown
3794
- *
3795
- * @slot - Default slot for the dropdown bib content.
3796
- * @slot helpText - Defines the content of the helpText.
3797
- * @slot trigger - Defines the content of the trigger.
3798
- * @csspart trigger - The trigger content container.
3799
- * @csspart chevron - The collapsed/expanded state icon container.
3800
- * @csspart size - The size of the dropdown bib. (height, width, maxHeight, maxWidth only)
3801
- * @csspart helpText - The helpText content container.
3802
- * @event auroDropdown-triggerClick - Notifies that the trigger has been clicked.
3803
- * @event auroDropdown-toggled - Notifies that the visibility of the dropdown bib has changed.
3804
- * @event auroDropdown-idAdded - Notifies consumers that the unique ID for the dropdown bib has been generated.
3805
- */
3806
- class AuroDropdown extends AuroElement {
3807
- static get shadowRootOptions() {
3808
- return {
3809
- ...AuroElement.shadowRootOptions,
3810
- delegatesFocus: true,
3811
- };
3812
- }
3813
-
3814
- constructor() {
3815
- super();
3816
-
3817
- this.isPopoverVisible = false;
3818
- this.isBibFullscreen = false;
3819
- this.matchWidth = false;
3820
- this.noHideOnThisFocusLoss = false;
3821
-
3822
- this.errorMessage = undefined; // TODO - check with Doug if there is still more to do here
3823
-
3824
- // Layout Config
3825
- this.layout = undefined;
3826
- this.shape = undefined;
3827
- this.size = undefined;
3828
-
3829
- this.parentBorder = false;
3830
-
3831
- /** @private */
3832
- this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
3833
-
3834
- /** @private */
3835
- this.bibElement = e$3();
3836
-
3837
- this._intializeDefaults();
3838
- }
3839
-
3840
- /**
3841
- * @private
3842
- * @returns {object} Class definition for the wrapper element.
3843
- */
3844
- get commonWrapperClasses() {
3845
- return {
3846
- 'trigger': true,
3847
- 'wrapper': true,
3848
- 'hasFocus': this.hasFocus,
3849
- 'simple': this.simple,
3850
- 'parentBorder': this.parentBorder
3851
- };
3852
- }
3853
-
3854
- /**
3855
- * @private
3856
- * @returns {void} Internal defaults.
3857
- */
3858
- _intializeDefaults() {
3859
- this.appearance = 'default';
3860
- this.chevron = false;
3861
- this.disabled = false;
3862
- this.disableKeyboardHandling = false;
3863
- this.error = false;
3864
- this.tabIndex = 0;
3865
- this.noToggle = false;
3866
- this.a11yRole = 'button';
3867
- this.onDark = false;
3868
- this.showTriggerBorders = true;
3869
- this.triggerContentFocusable = false;
3870
- this.simple = false;
3871
-
3872
- // floaterConfig
3873
- this.placement = 'bottom-start';
3874
- this.offset = 0;
3875
- this.noFlip = false;
3876
- this.shift = false;
3877
- this.autoPlacement = false;
3878
-
3879
- /**
3880
- * @private
3881
- */
3882
- this.hasTriggerContent = false;
3883
-
3884
- /**
3885
- * @private
3886
- */
3887
- this.triggerContentSlot = undefined;
3888
-
3889
- /**
3890
- * @private
3891
- */
3892
- this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
3893
-
3894
- /**
3895
- * @private
3896
- */
3897
- this.floater = new AuroFloatingUI();
3898
-
3899
- /**
3900
- * Generate unique names for dependency components.
3901
- */
3902
- const versioning = new AuroDependencyVersioning();
3903
-
3904
- /**
3905
- * @private
3906
- */
3907
- this.iconTag = versioning.generateTag('auro-formkit-dropdown-icon', iconVersion, _);
3908
-
3909
- /**
3910
- * @private
3911
- */
3912
- this.dropdownBibTag = versioning.generateTag('auro-formkit-dropdown-dropdownbib', formkitVersion, AuroDropdownBib);
3913
-
3914
- /**
3915
- * @private
3916
- */
3917
- this.helpTextTag = versioning.generateTag('auro-formkit-dropdown-helptext', formkitVersion, AuroHelpText);
3918
-
3919
- /**
3920
- * @private
3921
- */
3922
- this.bindFocusEventToTrigger = this.bindFocusEventToTrigger.bind(this);
3923
- }
3924
-
3925
- /**
3926
- * @ignore
3927
- */
3928
- get floaterConfig() {
3929
- return {
3930
- placement: this.placement,
3931
- flip: !this.noFlip,
3932
- shift: this.shift,
3933
- autoPlacement: this.autoPlacement,
3934
- offset: this.offset,
3935
- };
3936
- }
3937
-
3938
- /**
3939
- * Public method to hide the dropdown.
3940
- * @returns {void}
3941
- */
3942
- hide() {
3943
- this.floater.hideBib();
3944
- }
3945
-
3946
- /**
3947
- * Public method to show the dropdown.
3948
- * @returns {void}
3949
- */
3950
- show() {
3951
- this.floater.showBib();
3952
-
3953
- // Open dialog synchronously so callers remain in the user gesture
3954
- // chain. This is critical for mobile browsers (iOS Safari) to keep
3955
- // the virtual keyboard open when transitioning from the trigger
3956
- // input to an input inside the fullscreen dialog. Without this,
3957
- // showModal() fires asynchronously via Lit's update cycle, which
3958
- // falls outside the user activation window and causes iOS to
3959
- // dismiss the keyboard.
3960
- if (this.bibElement && this.bibElement.value) {
3961
- this.bibElement.value.open(this.isBibFullscreen);
3962
- }
3963
- }
3964
-
3965
- /**
3966
- * When bib is open, focus on the first element inside of bib.
3967
- * If not, trigger element will get focus.
3968
- */
3969
- focus() {
3970
- if (this.isPopoverVisible && this.bibContent) {
3971
- const focusables = getFocusableElements(this.bibContent);
3972
- if (focusables.length > 0) {
3973
- focusables[0].focus();
3974
- }
3975
- } else {
3976
- this.trigger.focus();
3977
- }
3978
- }
3979
-
3980
- /**
3981
- * Sets the active descendant element for accessibility.
3982
- * Uses ariaActiveDescendantElement to cross shadow DOM boundaries.
3983
- * This function is used in components that contain `auro-dropdown` to set the active descendant.
3984
- * @private
3985
- * @param {HTMLElement|null} element - The element to set as the active descendant, or null to clear.
3986
- * @returns {void}
3987
- */
3988
- setActiveDescendant(element) {
3989
- if (!this.trigger) {
3990
- return;
3991
- }
3992
-
3993
- if (element) {
3994
- this.trigger.ariaActiveDescendantElement = element;
3995
- } else {
3996
- this.trigger.ariaActiveDescendantElement = null;
3997
- this.trigger.removeAttribute('aria-activedescendant');
3998
- }
3999
-
4000
- // In fullscreen, focus stays on the close button while arrow keys
4001
- // highlight options via active-descendant. Without this flag the
4002
- // keyboard bridge clicks the close button on Enter (closing the
4003
- // bib without selecting). When true, the bridge skips the button
4004
- // click and forwards Enter to the parent to make the selection.
4005
- if (this.bibContent) {
4006
- this.bibContent.hasActiveDescendant = this.isBibFullscreen && Boolean(element);
4007
- }
4008
- }
4009
-
4010
- // function to define props used within the scope of this component
4011
- static get properties() {
4012
- return {
4013
-
4014
- /**
4015
- * The value for the role attribute of the trigger element.
4016
- */
4017
- a11yRole: {
4018
- type: String,
4019
- attribute: false,
4020
- reflect: false
4021
- },
4022
-
4023
- /**
4024
- * Defines whether the component will be on lighter or darker backgrounds.
4025
- * @type {'default' | 'inverse'}
4026
- * @default 'default'
4027
- */
4028
- appearance: {
4029
- type: String,
4030
- reflect: true
4031
- },
4032
-
4033
- /**
4034
- * If declared, bib's position will be automatically calculated where to appear.
4035
- */
4036
- autoPlacement: {
4037
- type: Boolean,
4038
- reflect: true
4039
- },
4040
-
4041
- /**
4042
- * If declared, the dropdown will only show by calling the API .show() public method.
4043
- */
4044
- disableEventShow: {
4045
- type: Boolean,
4046
- reflect: true
4047
- },
4048
-
4049
- /**
4050
- * If declared, applies a border around the trigger slot.
4051
- */
4052
- simple: {
4053
- type: Boolean,
4054
- reflect: true
4055
- },
4056
-
4057
- /**
4058
- * If declared, the dropdown displays a chevron on the right.
4059
- */
4060
- chevron: {
4061
- type: Boolean,
4062
- reflect: true,
4063
- attribute: 'chevron'
4064
- },
4065
-
4066
- /**
4067
- * If declared, the dropdown is not interactive.
4068
- */
4069
- disabled: {
4070
- type: Boolean,
4071
- reflect: true
4072
- },
4073
-
4074
- /**
4075
- * If declared, the dropdown will not handle keyboard events and will require the consumer to manage this behavior.
4076
- */
4077
- disableKeyboardHandling: {
4078
- type: Boolean,
4079
- reflect: true
4080
- },
4081
-
4082
- /**
4083
- * @private
4084
- */
4085
- dropdownWidth: {
4086
- type: Number
4087
- },
4088
-
4089
- /**
4090
- * The unique ID for the dropdown bib element.
4091
- * @private
4092
- */
4093
- dropdownId: {
4094
- type: String,
4095
- reflect: false,
4096
- attribute: false
4097
- },
4098
-
4099
- /**
4100
- * If declared, will apply error UI to the dropdown.
4101
- */
4102
- error: {
4103
- type: Boolean,
4104
- reflect: true
4105
- },
4106
-
4107
- /**
4108
- * Contains the help text message for the current validity error.
4109
- */
4110
- errorMessage: {
4111
- type: String
4112
- },
4113
-
4114
- /**
4115
- * If declared, the bib will display when focus is applied to the trigger.
4116
- */
4117
- focusShow: {
4118
- type: Boolean,
4119
- reflect: true
4120
- },
4121
-
4122
- /**
4123
- * If true, the dropdown bib is displayed.
4124
- */
4125
- isPopoverVisible: {
4126
- type: Boolean,
4127
- reflect: true,
4128
- attribute: 'open'
4129
- },
4130
-
4131
- /**
4132
- * If true, the dropdown bib is taking the fullscreen when it's open.
4133
- */
4134
- isBibFullscreen: {
4135
- type: Boolean,
4136
- reflect: true
4137
- },
4138
-
4139
- /**
4140
- * If declared, the trigger will toggle the dropdown on mouseover/mouseout.
4141
- */
4142
- hoverToggle: {
4143
- type: Boolean,
4144
- reflect: true
4145
- },
4146
-
4147
- /**
4148
- * @private
4149
- */
4150
- hasTriggerContent: {
4151
- type: Boolean
4152
- },
4153
-
4154
- /**
4155
- * Defines the screen size breakpoint at which the dropdown switches to fullscreen mode on mobile. `disabled` indicates a dropdown should _never_ enter fullscreen.
4156
- *
4157
- * When expanded, the dropdown will automatically display in fullscreen mode
4158
- * if the screen size is equal to or smaller than the selected breakpoint.
4159
- * @type {'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'disabled'}
4160
- * @default 'sm'
4161
- */
4162
- fullscreenBreakpoint: {
4163
- type: String,
4164
- reflect: true
4165
- },
4166
-
4167
- /**
4168
- * Sets the layout of the dropdown.
4169
- * @type {'classic' | 'emphasized' | 'snowflake'}
4170
- * @default 'classic'
4171
- */
4172
- layout: {
4173
- type: String,
4174
- reflect: true
4175
- },
4176
-
4177
- /**
4178
- * Defines if the trigger should size based on the parent element providing the border UI.
4179
- * @private
4180
- */
4181
- parentBorder: {
4182
- type: Boolean,
4183
- reflect: true
4184
- },
4185
-
4186
- /**
4187
- * If declared, the popover and trigger will be set to the same width.
4188
- */
4189
- matchWidth: {
4190
- type: Boolean,
4191
- reflect: true
4192
- },
4193
-
4194
- /**
4195
- * If declared, the bib will NOT flip to an alternate position
4196
- * when there isn't enough space in the specified `placement`.
4197
- */
4198
- noFlip: {
4199
- type: Boolean,
4200
- reflect: true
4201
- },
4202
-
4203
- /**
4204
- * If declared, the dropdown will shift its position to avoid being cut off by the viewport.
4205
- */
4206
- shift: {
4207
- type: Boolean,
4208
- reflect: true
4209
- },
4210
-
4211
- /**
4212
- * If declared, the dropdown will not hide when moving focus outside the element.
4213
- */
4214
- noHideOnThisFocusLoss: {
4215
- type: Boolean,
4216
- reflect: true
4217
- },
4218
-
4219
- /**
4220
- * If declared, the trigger will only show the dropdown bib.
4221
- */
4222
- noToggle: {
4223
- type: Boolean,
4224
- reflect: true
4225
- },
4226
-
4227
- /**
4228
- * Gap between the trigger element and bib.
4229
- * @default 0
4230
- */
4231
- offset: {
4232
- type: Number,
4233
- reflect: true
4234
- },
4235
-
4236
- /**
4237
- * DEPRECATED - use `appearance="inverse"` instead.
4238
- */
4239
- onDark: {
4240
- type: Boolean,
4241
- reflect: true
4242
- },
4243
-
4244
- /**
4245
- * If declared, and a function is set, that function will execute when the slot content is updated.
4246
- */
4247
- onSlotChange: {
4248
- type: Function,
4249
- reflect: false
4250
- },
4251
-
4252
- /**
4253
- * Position where the bib should appear relative to the trigger.
4254
- * @type {'top' | 'right' | 'bottom' | 'left' | 'bottom-start' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-end' | 'left-start' | 'left-end'}
4255
- * @default 'bottom-start'
4256
- */
4257
- placement: {
4258
- type: String,
4259
- reflect: true
4260
- },
4261
-
4262
- /**
4263
- * @private
4264
- */
4265
- tabIndex: {
4266
- type: Number
4267
- },
4268
-
4269
- /**
4270
- * Accessible label for the dropdown bib dialog element.
4271
- * @private
4272
- */
4273
- bibDialogLabel: {
4274
- type: String,
4275
- attribute: false,
4276
- reflect: false
4277
- }
4278
- };
4279
- }
4280
-
4281
- static get styles() {
4282
- return [
4283
- styleCss$1,
4284
- tokensCss$1,
4285
- colorCss$1,
4286
-
4287
- // default layout
4288
- classicColorCss,
4289
- classicLayoutCss,
4290
-
4291
- // emphasized layout
4292
- styleEmphasizedCss,
4293
-
4294
- // snowflake layout
4295
- styleSnowflakeCss,
4296
-
4297
- shapeSizeCss
4298
- ];
4299
- }
4300
-
4301
- /**
4302
- * This will register this element with the browser.
4303
- * @param {string} [name="auro-dropdown"] - The name of the element that you want to register.
4304
- *
4305
- * @example
4306
- * AuroDropdown.register("custom-dropdown") // this will register this element to <custom-dropdown/>
4307
- *
4308
- */
4309
- static register(name = "auro-dropdown") {
4310
- AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroDropdown);
4311
- }
4312
-
4313
- /**
4314
- * Accessor for reusing the focusable entity query string.
4315
- * @private
4316
- * @returns {string}
4317
- */
4318
- get focusableEntityQuery () {
4319
- return 'auro-input, [auro-input], auro-button, [auro-button], button, input';
4320
- }
4321
-
4322
- connectedCallback() {
4323
- super.connectedCallback();
4324
- }
4325
-
4326
- disconnectedCallback() {
4327
- super.disconnectedCallback();
4328
- if (this.floater) {
4329
- this.floater.hideBib('disconnect');
4330
- this.floater.disconnect();
4331
- }
4332
- this.clearTriggerFocusEventBinding();
4333
- }
4334
-
4335
- updated(changedProperties) {
4336
- super.updated(changedProperties);
4337
- this.floater.handleUpdate(changedProperties);
4338
-
4339
- // Note: `disabled` is not a breakpoint (it is not a screen size),
4340
- // so it looks like we never consume this - however, dropdownBib handles this in the setter as "undefined"
4341
- if (changedProperties.has('fullscreenBreakpoint')) {
4342
- this.bibContent.mobileFullscreenBreakpoint = this.fullscreenBreakpoint;
4343
- }
4344
-
4345
- // when trigger's content is changed without any attribute or node change,
4346
- // `requestUpdate` needs to be called to update hasTriggerContent
4347
- if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
4348
- this.handleTriggerContentSlotChange();
4349
- }
4350
-
4351
- if (changedProperties.has('isPopoverVisible') && this.bibElement.value) {
4352
- if (this.isPopoverVisible) {
4353
- // Fullscreen: use showModal() for native accessibility (inert outside, focus trap)
4354
- // Desktop: use show() for Floating UI positioning + FocusTrap for focus management
4355
- const useModal = this.isBibFullscreen;
4356
- this.bibElement.value.open(useModal);
4357
- } else {
4358
- this.bibElement.value.close();
4359
- }
4360
- }
4361
-
4362
- // When fullscreen strategy changes while open, re-open dialog with correct mode
4363
- // (e.g. resizing from desktop → mobile while dropdown is open)
4364
- if (changedProperties.has('isBibFullscreen') && this.isPopoverVisible && this.bibElement.value) {
4365
- const useModal = this.isBibFullscreen;
4366
- this.bibElement.value.close();
4367
- this.bibElement.value.open(useModal);
4368
- }
4369
- }
4370
-
4371
- /**
4372
- * Handles the custom event `auroDropdown-toggled` to update the visibility of the dropdown bib.
4373
- * @private
4374
- * @param {CustomEvent} event - The custom event that contains the dropdown toggle information.
4375
- */
4376
- handleDropdownToggle(event) {
4377
- this.updateFocusTrap();
4378
- this.isPopoverVisible = event.detail.expanded;
4379
- const eventType = event.detail.eventType || "unknown";
4380
- if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
4381
- this.trigger.focus();
4382
- }
4383
- }
4384
-
4385
- firstUpdated() {
4386
- // Configure the floater to, this will generate the ID for the bib
4387
- this.floater.configure(this, 'auroDropdown', !this.disableKeyboardHandling);
4388
-
4389
- // Prevent `contain: layout` on the dropdown host. Layout containment
4390
- // creates a containing block for position:fixed descendants (the bib),
4391
- // which clips the bib inside ancestor overflow contexts such as a
4392
- // <dialog> element. Without it, the bib's position:fixed is relative
4393
- // to the viewport, letting Floating UI's flip middleware detect
4394
- // viewport boundaries and the bib escape overflow clipping.
4395
- const origConfigureBibStrategy = this.floater.configureBibStrategy.bind(this.floater);
4396
- this.floater.configureBibStrategy = (value) => {
4397
- origConfigureBibStrategy(value);
4398
- this.style.contain = '';
4399
- };
4400
-
4401
- this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
4402
-
4403
- // Handle ESC key from dialog's cancel event
4404
- this.addEventListener('auro-bib-cancel', () => {
4405
- this.floater.hideBib('keydown');
4406
- });
4407
-
4408
- /**
4409
- * @description Let subscribers know that the dropdown ID ha been generated and added.
4410
- * @event auroDropdown-idAdded
4411
- * @type {Object<key: 'id', value: string>} - The ID of the dropdown bib element.
4412
- */
4413
- this.dispatchEvent(new CustomEvent('auroDropdown-idAdded', {detail: {id: this.floater.element.id}}));
4414
-
4415
- // Set the bib ID locally for aria-controls (must be in the same shadow root as the trigger)
4416
- if (!this.triggerContentFocusable) {
4417
- this.dropdownId = this.floater.element.bib.id;
4418
- }
4419
-
4420
- this.bibContent = this.floater.element.bib;
4421
-
4422
- // Add the tag name as an attribute if it is different than the component name
4423
- this.runtimeUtils.handleComponentTagRename(this, 'auro-dropdown');
4424
-
4425
- this.trigger.addEventListener('click', () => {
4426
- this.dispatchEvent(new CustomEvent('auroDropdown-triggerClick', {
4427
- bubbles: true,
4428
- composed: true
4429
- }));
4430
- });
4431
- }
4432
-
4433
- /**
4434
- * Exposes CSS parts for styling from parent components.
4435
- * @returns {void}
4436
- */
4437
- exposeCssParts() {
4438
- this.setAttribute('exportparts', 'trigger:dropdownTrigger, chevron:dropdownChevron, helpText:dropdownHelpText, size:dropdownSize');
4439
- }
4440
-
4441
- /**
4442
- * Determines if content is within a custom slot.
4443
- * @private
4444
- * @param {HTMLElement} element - The element to check.
4445
- * @returns {Boolean}
4446
- */
4447
- isCustomSlotContent(element) {
4448
- let currentElement = element;
4449
-
4450
- let inCustomSlot = false;
4451
-
4452
- while (currentElement) {
4453
- currentElement = currentElement.parentElement;
4454
-
4455
- if (currentElement && currentElement.hasAttribute('slot')) {
4456
- inCustomSlot = true;
4457
- break;
4458
- }
4459
- }
4460
-
4461
- return inCustomSlot;
4462
- }
4463
-
4464
- /**
4465
- * Function to support @focusin event.
4466
- * @private
4467
- * @return {void}
4468
- */
4469
- handleFocusin() {
4470
- this.hasFocus = true;
4471
- }
4472
-
4473
- /**
4474
- * @private
4475
- */
4476
- updateFocusTrap() {
4477
- if (this.isPopoverVisible) {
4478
- if (!this.isBibFullscreen) {
4479
- // Desktop: show() doesn't trap focus, so use FocusTrap
4480
- this.focusTrap = new FocusTrap(this.bibContent);
4481
- this.focusTrap.focusFirstElement();
4482
- }
4483
- // Fullscreen: showModal() provides native focus trapping
4484
- return;
4485
- }
4486
-
4487
- if (this.focusTrap) {
4488
- this.focusTrap.disconnect();
4489
- this.focusTrap = undefined;
4490
- }
4491
- }
4492
-
4493
- /**
4494
- * Function to support @focusout event.
4495
- * @private
4496
- * @return {void}
4497
- */
4498
- handleFocusout() {
4499
- this.hasFocus = false;
4500
- }
4501
-
4502
- /**
4503
- * Creates and dispatches a duplicate focus event on the trigger element.
4504
- * @private
4505
- * @param {Event} event - The original focus event.
4506
- */
4507
- bindFocusEventToTrigger(event) {
4508
- const dupEvent = new FocusEvent(event.type, {
4509
- bubbles: false,
4510
- cancelable: false,
4511
- composed: true,
4512
- });
4513
- this.trigger.dispatchEvent(dupEvent);
4514
- }
4515
-
4516
- /**
4517
- * Sets up event listeners to deliver focus and blur events from nested Auro components within the trigger slot to trigger.
4518
- * This ensures that focus/blur events originating from within these components are propagated to the trigger element itself.
4519
- * @private
4520
- */
4521
- setupTriggerFocusEventBinding() {
4522
- if (!this.triggerContentSlot || this.triggerContentSlot.length === 0) {
4523
- return;
4524
- }
4525
-
4526
- this.triggerContentSlot.forEach((node) => {
4527
- if (node.querySelectorAll) {
4528
- const auroElements = node.querySelectorAll(this.focusableEntityQuery);
4529
- auroElements.forEach((auroEl) => {
4530
- auroEl.addEventListener('focus', this.bindFocusEventToTrigger);
4531
- auroEl.addEventListener('blur', this.bindFocusEventToTrigger);
4532
- });
4533
- }
4534
- });
4535
- }
4536
-
4537
- /**
4538
- * Clears focus and blur event listeners from nested Auro components within the trigger slot.
4539
- * @private
4540
- * @returns {void}
4541
- */
4542
- clearTriggerFocusEventBinding() {
4543
- if (!this.triggerContentSlot || this.triggerContentSlot.length === 0) {
4544
- return;
4545
- }
4546
-
4547
- this.triggerContentSlot.forEach((node) => {
4548
- if (node.querySelectorAll) {
4549
- const auroElements = node.querySelectorAll(this.focusableEntityQuery);
4550
- auroElements.forEach((auroEl) => {
4551
- auroEl.removeEventListener('focus', this.bindFocusEventToTrigger);
4552
- auroEl.removeEventListener('blur', this.bindFocusEventToTrigger);
4553
- });
4554
- }
4555
- });
4556
- }
4557
-
4558
- /*
4559
- * Sets aria attributes for the trigger element if a custom one is passed in.
4560
- * @private
4561
- * @method setTriggerAriaAttributes
4562
- * @param { HTMLElement } triggerElement - The custom trigger element.
4563
- */
4564
- clearTriggerA11yAttributes(triggerElement) {
4565
-
4566
- if (!triggerElement || !triggerElement.removeAttribute) {
4567
- return;
4568
- }
4569
-
4570
- // Reset appropriate attributes for a11y
4571
- triggerElement.removeAttribute('aria-labelledby');
4572
- if (triggerElement.getAttribute('id') === `${this.id}-trigger-element`) {
4573
- triggerElement.removeAttribute('id');
4574
- }
4575
- triggerElement.removeAttribute('role');
4576
- triggerElement.removeAttribute('aria-expanded');
4577
-
4578
- triggerElement.removeAttribute('aria-controls');
4579
- triggerElement.removeAttribute('aria-autocomplete');
4580
- }
4581
-
4582
- /**
4583
- * Handles changes to the trigger content slot and updates related properties.
4584
- *
4585
- * It first updates the floater settings
4586
- * Then, it retrieves the assigned nodes from the event target and checks if any of
4587
- * the nodes contain non-empty text content, updating the `hasTriggerContent` property accordingly.
4588
- *
4589
- * @private
4590
- * @method handleTriggerContentSlotChange
4591
- * @param {Event} event - Native slotchange event.
4592
- * @returns {void}
4593
- */
4594
- handleTriggerContentSlotChange(event) {
4595
- this.floater.handleTriggerTabIndex();
4596
-
4597
- // Get the trigger
4598
- const trigger = this.shadowRoot.querySelector('#trigger');
4599
-
4600
- // Get the trigger slot
4601
- const triggerSlot = this.shadowRoot.querySelector('.triggerContentWrapper slot');
4602
-
4603
- // If there's a trigger slot
4604
- if (triggerSlot) {
4605
-
4606
- // Get the content nodes to see if there are any children
4607
- const triggerContentNodes = triggerSlot.assignedNodes();
4608
-
4609
- // If there are children
4610
- if (triggerContentNodes) {
4611
-
4612
- // See if any of them are focusable elements
4613
- this.triggerContentFocusable = triggerContentNodes.some((node) => getFocusableElements(node).length > 0);
4614
-
4615
- // If any of them are focusable elements
4616
- if (this.triggerContentFocusable) {
4617
-
4618
- // Assume the consumer will be providing their own a11y in whatever they passed in
4619
- this.clearTriggerA11yAttributes(trigger);
4620
-
4621
- // Remove the tabindex from the trigger so it doesn't interrupt focus flow
4622
- trigger.removeAttribute('tabindex');
4623
- } else {
4624
-
4625
- // Add the tabindex to the trigger so that it's in the focus flow
4626
- trigger.setAttribute('tabindex', '0');
4627
- }
4628
- }
4629
- }
4630
-
4631
- if (event) {
4632
- // Wrap in a try-catch block to handle errors when trying to use assignedNodes from the NodeJS test environment.
4633
- try {
4634
- this.triggerNode = event.target;
4635
- this.triggerContentSlot = event.target.assignedNodes();
4636
- } catch (error) {
4637
- console.warn('auro-dropdown: Unable to access the trigger content slot.', error); // eslint-disable-line no-console
4638
- }
4639
- }
4640
-
4641
- if (this.triggerContentSlot) {
4642
- this.setupTriggerFocusEventBinding();
4643
-
4644
- this.hasTriggerContent = this.triggerContentSlot.some((slot) => {
4645
- if (slot.textContent.trim()) {
4646
- return true;
4647
- }
4648
- const slotInSlot = slot.querySelector('slot');
4649
- if (!slotInSlot) {
4650
- return false;
4651
- }
4652
- const slotsInSlotNodes = slotInSlot.assignedNodes();
4653
- return slotsInSlotNodes.some((ss) => Boolean(ss.textContent.trim()));
4654
- });
4655
- } else {
4656
- this.hasTriggerContent = false;
4657
- }
4658
- }
4659
-
4660
- /**
4661
- * Handles the default slot change event and updates the content.
4662
- *
4663
- * This method retrieves all nodes assigned to the default slot of the event target and appends them
4664
- * to the `bibContent` element. If a callback function `onSlotChange` is defined, it is invoked to
4665
- * notify about the slot change.
4666
- *
4667
- * @private
4668
- * @method handleDefaultSlot
4669
- * @fires Function#onSlotChange - Optional callback invoked when the slot content changes.
4670
- */
4671
- handleDefaultSlot() {
4672
-
4673
- if (this.onSlotChange) {
4674
- this.onSlotChange();
4675
- }
4676
- }
4677
-
4678
- /**
4679
- * Returns HTML for the common portion of the layouts.
4680
- * @private
4681
- * @param {Object} helpTextClasses - Classes to apply to the help text container.
4682
- * @returns {html} - Returns HTML.
4683
- */
4684
- renderBasicHtml(helpTextClasses) {
4685
- return u$2`
4686
- <div>
4687
- <div
4688
- id="trigger"
4689
- class="${e$4(this.commonWrapperClasses)}" part="wrapper"
4690
- tabindex="${o(this.triggerContentFocusable ? undefined : this.tabIndex)}"
4691
- role="${o(this.triggerContentFocusable ? undefined : this.a11yRole)}"
4692
- aria-expanded="${o(this.a11yRole === 'button' || this.triggerContentFocusable ? undefined : this.isPopoverVisible)}"
4693
- aria-controls="${o(this.a11yRole === 'button' || this.triggerContentFocusable ? undefined : this.dropdownId)}"
4694
- aria-labelledby="${o(this.triggerContentFocusable ? undefined : 'triggerLabel')}"
4695
- aria-disabled="${o(this.disabled ? 'true' : undefined)}"
4696
- @focusin="${this.handleFocusin}"
4697
- @blur="${this.handleFocusOut}">
4698
- <div class="triggerContentWrapper" id="triggerLabel">
4699
- <slot
4700
- name="trigger"
4701
- @slotchange="${this.handleTriggerContentSlotChange}"></slot>
4702
- </div>
4703
- ${this.chevron ? u$2`
4704
- <div
4705
- id="showStateIcon"
4706
- class="chevron"
4707
- part="chevron"
4708
- aria-hidden="true">
4709
- <${this.iconTag}
4710
- category="interface"
4711
- name="${this.isPopoverVisible ? 'chevron-up' : `chevron-down`}"
4712
- appearance="${this.onDark ? 'inverse' : this.appearance}"
4713
- variant="${this.disabled ? 'disabled' : 'muted'}"
4714
- ariaHidden="true">
4715
- </${this.iconTag}>
4716
- </div>
4717
- ` : undefined }
4718
- </div>
4719
- <div class="${e$4(helpTextClasses)}">
4720
- <slot name="helpText"></slot>
4721
- </div>
4722
- <div id="bibSizer" part="size"></div>
4723
- <${this.dropdownBibTag}
4724
- id="bib"
4725
- shape="${this.shape}"
4726
- ?data-show="${this.isPopoverVisible}"
4727
- ?isfullscreen="${this.isBibFullscreen}"
4728
- .dialogLabel="${this.bibDialogLabel}"
4729
- ${n$2(this.bibElement)}
4730
- >
4731
- <div class="slotContent">
4732
- <slot @slotchange="${this.handleDefaultSlot}"></slot>
4733
- </div>
4734
- </${this.dropdownBibTag}>
4735
- </div>
4736
- `;
4737
- }
4738
-
4739
- /**
4740
- * Returns HTML for the classic layout. Does not support type="*".
4741
- * @private
4742
- * @returns {html} - Returns HTML for the classic layout.
4743
- */
4744
- renderLayoutClassic() {
4745
- // TODO: check with Doug why this was never used?
4746
- const helpTextClasses = {
4747
- 'helpText': true
4748
- };
4749
-
4750
- return u$2`
4751
- ${this.renderBasicHtml(helpTextClasses)}
4752
- `;
4753
- }
4754
-
4755
- /**
4756
- * Returns HTML for the snowflake layout. Does not support type="*".
4757
- * @private
4758
- * @returns {html} - Returns HTML for the snowflake layout.
4759
- */
4760
- renderLayoutSnowflake() {
4761
- const helpTextClasses = {
4762
- 'helpText': true,
4763
- 'leftIndent': true,
4764
- 'rightIndent': true
4765
- };
4766
-
4767
- return u$2`
4768
- ${this.renderBasicHtml(helpTextClasses)}
4769
- `;
4770
- }
4771
-
4772
- /**
4773
- * Returns HTML for the emphasized layout. Does not support type="*".
4774
- * @private
4775
- * @returns {html} - Returns HTML for the emphasized layout.
4776
- */
4777
- renderLayoutEmphasized() {
4778
- const helpTextClasses = {
4779
- 'helpText': true,
4780
- 'leftIndent': this.shape.toLowerCase().includes('pill') && !this.shape.toLowerCase().includes('right'),
4781
- 'rightIndent': this.shape.toLowerCase().includes('pill') && !this.shape.toLowerCase().includes('left')
4782
- };
4783
-
4784
- return u$2`
4785
- ${this.renderBasicHtml(helpTextClasses)}
4786
- `;
4787
- }
4788
-
4789
- /**
4790
- * Logic to determine the layout of the component.
4791
- * @private
4792
- * @param {string} [ForcedLayout] - Used to force a specific layout, pass in the layout name to use.
4793
- * @returns {HTMLCollection} - Returns the HTML for the layout.
4794
- */
4795
- renderLayout(ForcedLayout) {
4796
- const layout = ForcedLayout || this.layout;
4797
-
4798
- switch (layout) {
4799
- case 'emphasized':
4800
- return this.renderLayoutEmphasized();
4801
- case 'emphasized-left':
4802
- return this.renderLayoutEmphasized();
4803
- case 'emphasized-right':
4804
- return this.renderLayoutEmphasized();
4805
- case 'snowflake':
4806
- return this.renderLayoutSnowflake();
4807
- case 'snowflake-left':
4808
- return this.renderLayoutSnowflake();
4809
- case 'snowflake-right':
4810
- return this.renderLayoutSnowflake();
4811
- default:
4812
- return this.renderLayoutClassic();
4813
- }
4814
- }
4815
- }
4816
-
4817
- /* eslint-disable jsdoc/require-jsdoc, no-magic-numbers, no-param-reassign */
4818
-
4819
- AuroDropdown.register();
4820
- AuroDropdown.register('custom-dropdown');
4821
-
4822
- function initExamples() {
4823
- // javascript example function calls to be added here upon creation to test examples
4824
- classicExample();
4825
- classicInverseExample();
4826
- customExample();
4827
- }
4828
-
4829
- export { initExamples };