@aurodesignsystem-dev/auro-formkit 0.0.0-pr1379.0 → 0.0.0-pr1379.10

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 (226) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/README.md +87 -113
  3. package/components/combobox/demo/keyboardBehavior.html +81 -0
  4. package/components/counter/demo/keyboardBehavior.html +81 -0
  5. package/components/datepicker/demo/keyboard-behavior.html +81 -0
  6. package/components/dropdown/demo/keyboardBehavior.html +81 -0
  7. package/components/select/demo/keyboardBehavior.html +81 -0
  8. package/package.json +64 -53
  9. package/components/bibtemplate/dist/auro-bibtemplate.d.ts +0 -66
  10. package/components/bibtemplate/dist/buttonVersion.d.ts +0 -2
  11. package/components/bibtemplate/dist/headerVersion.d.ts +0 -2
  12. package/components/bibtemplate/dist/iconVersion.d.ts +0 -2
  13. package/components/bibtemplate/dist/index.d.ts +0 -2
  14. package/components/bibtemplate/dist/index.js +0 -395
  15. package/components/bibtemplate/dist/registered.js +0 -395
  16. package/components/bibtemplate/dist/styles/color-css.d.ts +0 -2
  17. package/components/bibtemplate/dist/styles/style-css.d.ts +0 -2
  18. package/components/bibtemplate/dist/styles/tokens-css.d.ts +0 -2
  19. package/components/checkbox/demo/api.md +0 -489
  20. package/components/checkbox/demo/api.min.js +0 -2133
  21. package/components/checkbox/demo/index.md +0 -55
  22. package/components/checkbox/demo/index.min.js +0 -2108
  23. package/components/checkbox/demo/readme.md +0 -142
  24. package/components/checkbox/dist/auro-checkbox-group.d.ts +0 -176
  25. package/components/checkbox/dist/auro-checkbox.d.ts +0 -209
  26. package/components/checkbox/dist/index.d.ts +0 -3
  27. package/components/checkbox/dist/index.js +0 -2057
  28. package/components/checkbox/dist/registered.js +0 -2058
  29. package/components/checkbox/dist/styles/auro-checkbox-css.d.ts +0 -2
  30. package/components/checkbox/dist/styles/auro-checkbox-group-css.d.ts +0 -2
  31. package/components/checkbox/dist/styles/color-css.d.ts +0 -2
  32. package/components/checkbox/dist/styles/colorGroup-css.d.ts +0 -2
  33. package/components/checkbox/dist/styles/tokens-css.d.ts +0 -2
  34. package/components/combobox/demo/api.md +0 -2287
  35. package/components/combobox/demo/api.min.js +0 -17549
  36. package/components/combobox/demo/index.md +0 -196
  37. package/components/combobox/demo/index.min.js +0 -17454
  38. package/components/combobox/demo/readme.md +0 -158
  39. package/components/combobox/dist/auro-combobox.d.ts +0 -552
  40. package/components/combobox/dist/comboboxKeyboardStrategy.d.ts +0 -6
  41. package/components/combobox/dist/index.d.ts +0 -2
  42. package/components/combobox/dist/index.js +0 -15474
  43. package/components/combobox/dist/registered.js +0 -15476
  44. package/components/combobox/dist/styles/emphasized/style-css.d.ts +0 -2
  45. package/components/combobox/dist/styles/snowflake/style-css.d.ts +0 -2
  46. package/components/combobox/dist/styles/style-css.d.ts +0 -2
  47. package/components/counter/demo/api.md +0 -1285
  48. package/components/counter/demo/api.min.js +0 -7993
  49. package/components/counter/demo/index.md +0 -92
  50. package/components/counter/demo/index.min.js +0 -7974
  51. package/components/counter/demo/readme.md +0 -161
  52. package/components/counter/dist/auro-counter-button.d.ts +0 -14
  53. package/components/counter/dist/auro-counter-group.d.ts +0 -390
  54. package/components/counter/dist/auro-counter-wrapper.d.ts +0 -17
  55. package/components/counter/dist/auro-counter.d.ts +0 -126
  56. package/components/counter/dist/buttonVersion.d.ts +0 -2
  57. package/components/counter/dist/iconVersion.d.ts +0 -2
  58. package/components/counter/dist/index.d.ts +0 -3
  59. package/components/counter/dist/index.js +0 -7896
  60. package/components/counter/dist/registered.js +0 -7897
  61. package/components/counter/dist/styles/color-css.d.ts +0 -2
  62. package/components/counter/dist/styles/counter-button-color-css.d.ts +0 -2
  63. package/components/counter/dist/styles/counter-button-css.d.ts +0 -2
  64. package/components/counter/dist/styles/counter-group-css.d.ts +0 -2
  65. package/components/counter/dist/styles/counter-wrapper-color-css.d.ts +0 -2
  66. package/components/counter/dist/styles/counter-wrapper-css.d.ts +0 -2
  67. package/components/counter/dist/styles/shapeSize-css.d.ts +0 -2
  68. package/components/counter/dist/styles/style-css.d.ts +0 -2
  69. package/components/counter/dist/styles/tokens-css.d.ts +0 -2
  70. package/components/datepicker/demo/api.md +0 -1824
  71. package/components/datepicker/demo/api.min.js +0 -24530
  72. package/components/datepicker/demo/index.md +0 -158
  73. package/components/datepicker/demo/index.min.js +0 -24251
  74. package/components/datepicker/demo/readme.md +0 -137
  75. package/components/datepicker/dist/auro-calendar-cell.d.ts +0 -169
  76. package/components/datepicker/dist/auro-calendar-month.d.ts +0 -20
  77. package/components/datepicker/dist/auro-calendar.d.ts +0 -173
  78. package/components/datepicker/dist/auro-datepicker.d.ts +0 -722
  79. package/components/datepicker/dist/buttonVersion.d.ts +0 -2
  80. package/components/datepicker/dist/iconVersion.d.ts +0 -2
  81. package/components/datepicker/dist/index.d.ts +0 -2
  82. package/components/datepicker/dist/index.js +0 -24166
  83. package/components/datepicker/dist/popoverVersion.d.ts +0 -2
  84. package/components/datepicker/dist/registered.js +0 -24166
  85. package/components/datepicker/dist/styles/classic/color-css.d.ts +0 -2
  86. package/components/datepicker/dist/styles/classic/style-css.d.ts +0 -2
  87. package/components/datepicker/dist/styles/color-calendar-css.d.ts +0 -2
  88. package/components/datepicker/dist/styles/color-cell-css.d.ts +0 -2
  89. package/components/datepicker/dist/styles/color-css.d.ts +0 -2
  90. package/components/datepicker/dist/styles/color-month-css.d.ts +0 -2
  91. package/components/datepicker/dist/styles/shapeSize-css.d.ts +0 -2
  92. package/components/datepicker/dist/styles/snowflake/color-css.d.ts +0 -2
  93. package/components/datepicker/dist/styles/snowflake/style-css.d.ts +0 -2
  94. package/components/datepicker/dist/styles/style-auro-calendar-cell-css.d.ts +0 -2
  95. package/components/datepicker/dist/styles/style-auro-calendar-css.d.ts +0 -2
  96. package/components/datepicker/dist/styles/style-auro-calendar-month-css.d.ts +0 -2
  97. package/components/datepicker/dist/styles/style-css.d.ts +0 -2
  98. package/components/datepicker/dist/styles/tokens-css.d.ts +0 -2
  99. package/components/datepicker/dist/utilities.d.ts +0 -78
  100. package/components/datepicker/dist/utilitiesCalendar.d.ts +0 -38
  101. package/components/datepicker/dist/utilitiesCalendarRender.d.ts +0 -50
  102. package/components/datepicker/dist/vendor/wc-range-datepicker/day.d.ts +0 -5
  103. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-calendar.d.ts +0 -60
  104. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-cell.d.ts +0 -1
  105. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker.d.ts +0 -57
  106. package/components/dropdown/demo/api.md +0 -1358
  107. package/components/dropdown/demo/api.min.js +0 -4853
  108. package/components/dropdown/demo/index.md +0 -283
  109. package/components/dropdown/demo/index.min.js +0 -4788
  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 -155
  113. package/components/dropdown/dist/iconVersion.d.ts +0 -2
  114. package/components/dropdown/dist/index.d.ts +0 -2
  115. package/components/dropdown/dist/index.js +0 -4685
  116. package/components/dropdown/dist/keyboardUtils.d.ts +0 -18
  117. package/components/dropdown/dist/registered.js +0 -4685
  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 -69996
  130. package/components/form/demo/index.md +0 -128
  131. package/components/form/demo/index.min.js +0 -69996
  132. package/components/form/demo/readme.md +0 -145
  133. package/components/form/dist/auro-form.d.ts +0 -280
  134. package/components/form/dist/index.d.ts +0 -2
  135. package/components/form/dist/index.js +0 -718
  136. package/components/form/dist/registered.d.ts +0 -1
  137. package/components/form/dist/registered.js +0 -718
  138. package/components/form/dist/styles/style-css.d.ts +0 -2
  139. package/components/helptext/dist/auro-helptext.d.ts +0 -69
  140. package/components/helptext/dist/index.d.ts +0 -2
  141. package/components/helptext/dist/index.js +0 -231
  142. package/components/helptext/dist/registered.js +0 -231
  143. package/components/helptext/dist/styles/color-css.d.ts +0 -2
  144. package/components/helptext/dist/styles/style-css.d.ts +0 -2
  145. package/components/helptext/dist/styles/tokens-css.d.ts +0 -2
  146. package/components/input/demo/api.md +0 -1397
  147. package/components/input/demo/api.min.js +0 -7435
  148. package/components/input/demo/index.md +0 -161
  149. package/components/input/demo/index.min.js +0 -7355
  150. package/components/input/demo/readme.md +0 -134
  151. package/components/input/dist/auro-input.d.ts +0 -195
  152. package/components/input/dist/base-input.d.ts +0 -628
  153. package/components/input/dist/buttonVersion.d.ts +0 -2
  154. package/components/input/dist/i18n.d.ts +0 -18
  155. package/components/input/dist/iconVersion.d.ts +0 -2
  156. package/components/input/dist/index.d.ts +0 -2
  157. package/components/input/dist/index.js +0 -7278
  158. package/components/input/dist/registered.js +0 -7278
  159. package/components/input/dist/styles/classic/color-css.d.ts +0 -2
  160. package/components/input/dist/styles/classic/style-css.d.ts +0 -2
  161. package/components/input/dist/styles/color-css.d.ts +0 -2
  162. package/components/input/dist/styles/default/borders-css.d.ts +0 -2
  163. package/components/input/dist/styles/default/color-css.d.ts +0 -2
  164. package/components/input/dist/styles/default/mixins-css.d.ts +0 -2
  165. package/components/input/dist/styles/default/notificationIcons-css.d.ts +0 -2
  166. package/components/input/dist/styles/default/style-css.d.ts +0 -2
  167. package/components/input/dist/styles/emphasized/color-css.d.ts +0 -2
  168. package/components/input/dist/styles/emphasized/style-css.d.ts +0 -2
  169. package/components/input/dist/styles/mixins-css.d.ts +0 -2
  170. package/components/input/dist/styles/shapeSize-css.d.ts +0 -2
  171. package/components/input/dist/styles/snowflake/style-css.d.ts +0 -2
  172. package/components/input/dist/styles/style-css.d.ts +0 -2
  173. package/components/input/dist/styles/tokens-css.d.ts +0 -2
  174. package/components/input/dist/utilities.d.ts +0 -25
  175. package/components/layoutElement/dist/auroElement.d.ts +0 -40
  176. package/components/layoutElement/dist/index.d.ts +0 -2
  177. package/components/layoutElement/dist/index.js +0 -107
  178. package/components/layoutElement/dist/registered.js +0 -107
  179. package/components/menu/demo/api.md +0 -1200
  180. package/components/menu/demo/api.min.js +0 -2292
  181. package/components/menu/demo/index.md +0 -72
  182. package/components/menu/demo/index.min.js +0 -2185
  183. package/components/menu/demo/readme.md +0 -145
  184. package/components/menu/dist/auro-menu-utils.d.ts +0 -34
  185. package/components/menu/dist/auro-menu.context.d.ts +0 -227
  186. package/components/menu/dist/auro-menu.d.ts +0 -324
  187. package/components/menu/dist/auro-menuoption.d.ts +0 -210
  188. package/components/menu/dist/iconVersion.d.ts +0 -2
  189. package/components/menu/dist/index.d.ts +0 -4
  190. package/components/menu/dist/index.js +0 -2148
  191. package/components/menu/dist/registered.js +0 -2096
  192. package/components/menu/dist/styles/default/color-menu-css.d.ts +0 -2
  193. package/components/menu/dist/styles/default/color-menuoption-css.d.ts +0 -2
  194. package/components/menu/dist/styles/default/style-menu-css.d.ts +0 -2
  195. package/components/menu/dist/styles/default/style-menuoption-css.d.ts +0 -2
  196. package/components/menu/dist/styles/default/tokens-css.d.ts +0 -2
  197. package/components/radio/demo/api.md +0 -675
  198. package/components/radio/demo/api.min.js +0 -2210
  199. package/components/radio/demo/index.md +0 -73
  200. package/components/radio/demo/index.min.js +0 -2167
  201. package/components/radio/demo/readme.md +0 -141
  202. package/components/radio/dist/auro-radio-group.d.ts +0 -250
  203. package/components/radio/dist/auro-radio.d.ts +0 -180
  204. package/components/radio/dist/index.d.ts +0 -3
  205. package/components/radio/dist/index.js +0 -2116
  206. package/components/radio/dist/registered.js +0 -2117
  207. package/components/radio/dist/styles/auro-radio-group-css.d.ts +0 -2
  208. package/components/radio/dist/styles/color-css.d.ts +0 -2
  209. package/components/radio/dist/styles/groupColor-css.d.ts +0 -2
  210. package/components/radio/dist/styles/style-css.d.ts +0 -2
  211. package/components/radio/dist/styles/tokens-css.d.ts +0 -2
  212. package/components/select/demo/api.md +0 -2378
  213. package/components/select/demo/api.min.js +0 -10133
  214. package/components/select/demo/index.md +0 -355
  215. package/components/select/demo/index.min.js +0 -10040
  216. package/components/select/demo/readme.md +0 -148
  217. package/components/select/dist/auro-select.d.ts +0 -545
  218. package/components/select/dist/index.d.ts +0 -2
  219. package/components/select/dist/index.js +0 -8072
  220. package/components/select/dist/registered.js +0 -8072
  221. package/components/select/dist/selectKeyboardStrategy.d.ts +0 -8
  222. package/components/select/dist/styles/emphasized/color-css.d.ts +0 -2
  223. package/components/select/dist/styles/shapeSize-css.d.ts +0 -2
  224. package/components/select/dist/styles/style-css.d.ts +0 -2
  225. package/components/select/dist/styles/tokens-css.d.ts +0 -2
  226. package/custom-elements.json +0 -18656
@@ -1,4788 +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$5=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$5?e$5.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$4=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$3=e$4(class extends i$3{constructor(t){if(super(t),t.type!==t$1.ATTRIBUTE||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter(s=>t[s]).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return E}});
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$2=()=>new h$1;let h$1 = class h{};const o$4=new WeakMap,n$2=e$4(class extends f$2{render(i){return A}update(i,[s]){const e=s!==this.G;return e&&void 0!==this.G&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=s,this.ht=i.options?.host,this.rt(this.ct=i.element)),A}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.G){const i=this.ht??globalThis;let s=o$4.get(i);void 0===s&&(s=new WeakMap,o$4.set(i,s)),void 0!==s.get(this.G)&&this.G.call(this.ht,void 0),s.set(this.G,t),void 0!==t&&this.G.call(this.ht,t);}else this.G.value=t;}get lt(){return "function"==typeof this.G?o$4.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});
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.configureTrial = 0;
1866
-
1867
- /**
1868
- * @private
1869
- */
1870
- this.eventPrefix = undefined;
1871
-
1872
- /**
1873
- * @private
1874
- */
1875
- this.id = undefined;
1876
-
1877
- /**
1878
- * @private
1879
- */
1880
- this.showing = false;
1881
-
1882
- /**
1883
- * @private
1884
- */
1885
- this.strategy = undefined;
1886
- }
1887
-
1888
- /**
1889
- * Mirrors the size of the bibSizer element to the bib content.
1890
- * Copies the width, height, max-width, and max-height styles from the bibSizer element to the bib content container.
1891
- * This ensures that the bib content has the same dimensions as the sizer element.
1892
- */
1893
- mirrorSize() {
1894
- // mirror the boxsize from bibSizer
1895
- if (this.element.bibSizer && this.element.matchWidth) {
1896
- const sizerStyle = window.getComputedStyle(this.element.bibSizer);
1897
- const bibContent =
1898
- this.element.bib.shadowRoot.querySelector(".container");
1899
- if (sizerStyle.width !== "0px") {
1900
- bibContent.style.width = sizerStyle.width;
1901
- }
1902
- if (sizerStyle.height !== "0px") {
1903
- bibContent.style.height = sizerStyle.height;
1904
- }
1905
- bibContent.style.maxWidth = sizerStyle.maxWidth;
1906
- bibContent.style.maxHeight = sizerStyle.maxHeight;
1907
- }
1908
- }
1909
-
1910
- /**
1911
- * @private
1912
- * Determines the positioning strategy based on the current viewport size and mobile breakpoint.
1913
- *
1914
- * This method checks if the current viewport width is less than or equal to the specified mobile fullscreen breakpoint
1915
- * defined in the bib element. If it is, the strategy is set to 'fullscreen'; otherwise, it defaults to 'floating'.
1916
- *
1917
- * @returns {String} The positioning strategy, one of 'fullscreen', 'floating', 'cover'.
1918
- */
1919
- getPositioningStrategy() {
1920
- const breakpoint =
1921
- this.element.bib.mobileFullscreenBreakpoint ||
1922
- this.element.floaterConfig?.fullscreenBreakpoint;
1923
- switch (this.behavior) {
1924
- case "tooltip":
1925
- return "floating";
1926
- case "dialog":
1927
- case "drawer":
1928
- if (breakpoint) {
1929
- const smallerThanBreakpoint = window.matchMedia(
1930
- `(max-width: ${breakpoint})`,
1931
- ).matches;
1932
-
1933
- this.element.expanded = smallerThanBreakpoint;
1934
- }
1935
- if (this.element.nested) {
1936
- return "cover";
1937
- }
1938
- return "fullscreen";
1939
- case "dropdown":
1940
- case undefined:
1941
- case null:
1942
- if (breakpoint) {
1943
- const smallerThanBreakpoint = window.matchMedia(
1944
- `(max-width: ${breakpoint})`,
1945
- ).matches;
1946
- if (smallerThanBreakpoint) {
1947
- return "fullscreen";
1948
- }
1949
- }
1950
- return "floating";
1951
- default:
1952
- return this.behavior;
1953
- }
1954
- }
1955
-
1956
- /**
1957
- * @private
1958
- * Positions the bib element based on the current configuration and positioning strategy.
1959
- *
1960
- * This method determines the appropriate positioning strategy (fullscreen or not) and configures the bib accordingly.
1961
- * It also sets up middleware for the floater configuration, computes the position of the bib relative to the trigger element,
1962
- * and applies the calculated position to the bib's style.
1963
- */
1964
- position() {
1965
- const strategy = this.getPositioningStrategy();
1966
- this.configureBibStrategy(strategy);
1967
-
1968
- if (strategy === "floating") {
1969
- this.mirrorSize();
1970
- // Define the middlware for the floater configuration
1971
- const middleware = [
1972
- offset(this.element.floaterConfig?.offset || 0),
1973
- ...(this.element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
1974
- ...(this.element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
1975
- ...(this.element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
1976
- ];
1977
-
1978
- // Compute the position of the bib
1979
- computePosition(this.element.trigger, this.element.bib, {
1980
- strategy: this.element.floaterConfig?.strategy || "fixed",
1981
- placement: this.element.floaterConfig?.placement,
1982
- middleware: middleware || [],
1983
- }).then(({ x, y }) => {
1984
- // eslint-disable-line id-length
1985
- Object.assign(this.element.bib.style, {
1986
- left: `${x}px`,
1987
- top: `${y}px`,
1988
- });
1989
- });
1990
- } else if (strategy === "cover") {
1991
- // Compute the position of the bib
1992
- computePosition(this.element.parentNode, this.element.bib, {
1993
- placement: "bottom-start",
1994
- }).then(({ x, y }) => {
1995
- // eslint-disable-line id-length
1996
- Object.assign(this.element.bib.style, {
1997
- left: `${x}px`,
1998
- top: `${y - this.element.parentNode.offsetHeight}px`,
1999
- width: `${this.element.parentNode.offsetWidth}px`,
2000
- height: `${this.element.parentNode.offsetHeight}px`,
2001
- });
2002
- });
2003
- }
2004
- }
2005
-
2006
- /**
2007
- * @private
2008
- * Controls whether to lock the scrolling for the document's body.
2009
- * @param {Boolean} lock - If true, locks the body's scrolling functionlity; otherwise, unlock.
2010
- */
2011
- lockScroll(lock = true) {
2012
- if (lock) {
2013
- document.body.style.overflow = "hidden"; // hide body's scrollbar
2014
-
2015
- // Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
2016
- this.element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
2017
- } else {
2018
- document.body.style.overflow = "";
2019
- }
2020
- }
2021
-
2022
- /**
2023
- * @private
2024
- * Configures the bib element's display strategy.
2025
- *
2026
- * Sets the bib to fullscreen or floating mode based on the provided strategy.
2027
- * Dispatches a 'strategy-change' event if the strategy changes.
2028
- *
2029
- * @param {string} strategy - The positioning strategy ('fullscreen' or 'floating').
2030
- */
2031
- configureBibStrategy(value) {
2032
- if (value === "fullscreen") {
2033
- this.element.isBibFullscreen = true;
2034
- // reset the prev position
2035
- this.element.bib.setAttribute("isfullscreen", "");
2036
- this.element.bib.style.position = "fixed";
2037
- this.element.bib.style.top = "0px";
2038
- this.element.bib.style.left = "0px";
2039
- this.element.bib.style.width = "";
2040
- this.element.bib.style.height = "";
2041
- this.element.style.contain = "";
2042
-
2043
- // reset the size that was mirroring `size` css-part
2044
- const bibContent =
2045
- this.element.bib.shadowRoot.querySelector(".container");
2046
- if (bibContent) {
2047
- bibContent.style.width = "";
2048
- bibContent.style.height = "";
2049
- bibContent.style.maxWidth = "";
2050
- bibContent.style.maxHeight = `${window?.visualViewport?.height}px`;
2051
- this.configureTrial = 0;
2052
- } else if (this.configureTrial < MAX_CONFIGURATION_COUNT) {
2053
- this.configureTrial += 1;
2054
-
2055
- setTimeout(() => {
2056
- this.configureBibStrategy(value);
2057
- }, 0);
2058
- }
2059
-
2060
- if (this.element.isPopoverVisible) {
2061
- this.lockScroll(true);
2062
- }
2063
- } else {
2064
- this.element.bib.style.position = "";
2065
- this.element.bib.removeAttribute("isfullscreen");
2066
- this.element.isBibFullscreen = false;
2067
- this.element.style.contain = "layout";
2068
- }
2069
-
2070
- const isChanged = this.strategy && this.strategy !== value;
2071
- this.strategy = value;
2072
- if (isChanged) {
2073
- const event = new CustomEvent(
2074
- this.eventPrefix
2075
- ? `${this.eventPrefix}-strategy-change`
2076
- : "strategy-change",
2077
- {
2078
- detail: {
2079
- value,
2080
- },
2081
- composed: true,
2082
- },
2083
- );
2084
-
2085
- this.element.dispatchEvent(event);
2086
- }
2087
- }
2088
-
2089
- updateState() {
2090
- const isVisible = this.element.isPopoverVisible;
2091
- if (!isVisible) {
2092
- this.cleanupHideHandlers();
2093
- try {
2094
- this.element.cleanup?.();
2095
- } catch (error) {
2096
- // Do nothing
2097
- }
2098
- }
2099
- }
2100
-
2101
- /**
2102
- * @private
2103
- * getting called on 'blur' in trigger or `focusin` in document
2104
- *
2105
- * Hides the bib if focus moves outside of the trigger or bib, unless a 'noHideOnThisFocusLoss' flag is set.
2106
- * This method checks if the currently active element is still within the trigger or bib.
2107
- * If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
2108
- */
2109
- handleFocusLoss() {
2110
- // if mouse is being pressed, skip and let click event to handle the action
2111
- if (AuroFloatingUI.isMousePressed) {
2112
- return;
2113
- }
2114
-
2115
- if (
2116
- this.element.noHideOnThisFocusLoss ||
2117
- this.element.hasAttribute("noHideOnThisFocusLoss")
2118
- ) {
2119
- return;
2120
- }
2121
-
2122
- const { activeElement } = document;
2123
- // if focus is still inside of trigger or bib, do not close
2124
- if (
2125
- this.element.contains(activeElement) ||
2126
- this.element.bib?.contains(activeElement)
2127
- ) {
2128
- return;
2129
- }
2130
-
2131
- // if fullscreen bib is in fullscreen mode, do not close
2132
- if (this.element.bib.hasAttribute("isfullscreen")) {
2133
- return;
2134
- }
2135
-
2136
- this.hideBib("keydown");
2137
- }
2138
-
2139
- setupHideHandlers() {
2140
- // Define handlers & store references
2141
- this.focusHandler = () => this.handleFocusLoss();
2142
-
2143
- this.clickHandler = (evt) => {
2144
- // When the bib is fullscreen (modal dialog), don't close on outside
2145
- // clicks. VoiceOver's synthetic click events inside a top-layer modal
2146
- // <dialog> may not include the bib in composedPath(), causing false
2147
- // positives. This mirrors the fullscreen guard in handleFocusLoss().
2148
- if (this.element.bib && this.element.bib.hasAttribute("isfullscreen")) {
2149
- return;
2150
- }
2151
-
2152
- if (
2153
- (!evt.composedPath().includes(this.element.trigger) &&
2154
- !evt.composedPath().includes(this.element.bib)) ||
2155
- (this.element.bib.backdrop &&
2156
- evt.composedPath().includes(this.element.bib.backdrop))
2157
- ) {
2158
- const existedVisibleFloatingUI =
2159
- document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
2160
-
2161
- if (
2162
- existedVisibleFloatingUI &&
2163
- existedVisibleFloatingUI.element.isPopoverVisible
2164
- ) {
2165
- // if something else is open, close that
2166
- existedVisibleFloatingUI.hideBib();
2167
- document.expandedAuroFormkitDropdown = null;
2168
- document.expandedAuroFloater = this;
2169
- } else {
2170
- this.hideBib("click");
2171
- }
2172
- }
2173
- };
2174
-
2175
- // ESC key handler
2176
- this.keyDownHandler = (evt) => {
2177
- if (evt.key === "Escape" && this.element.isPopoverVisible) {
2178
- const existedVisibleFloatingUI =
2179
- document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
2180
- if (
2181
- existedVisibleFloatingUI &&
2182
- existedVisibleFloatingUI !== this &&
2183
- existedVisibleFloatingUI.element.isPopoverVisible
2184
- ) {
2185
- // if something else is open, let it handle itself
2186
- return;
2187
- }
2188
- this.hideBib("keydown");
2189
- }
2190
- };
2191
-
2192
- if (this.behavior !== "drawer" && this.behavior !== "dialog") {
2193
- // Add event listeners using the stored references
2194
- document.addEventListener("focusin", this.focusHandler);
2195
- }
2196
-
2197
- document.addEventListener("keydown", this.keyDownHandler);
2198
-
2199
- // send this task to the end of queue to prevent conflicting
2200
- // it conflicts if showBib gets call from a button that's not this.element.trigger
2201
- setTimeout(() => {
2202
- window.addEventListener("click", this.clickHandler);
2203
- }, 0);
2204
- }
2205
-
2206
- cleanupHideHandlers() {
2207
- // Remove event listeners if they exist
2208
-
2209
- if (this.focusHandler) {
2210
- document.removeEventListener("focusin", this.focusHandler);
2211
- this.focusHandler = null;
2212
- }
2213
-
2214
- if (this.clickHandler) {
2215
- window.removeEventListener("click", this.clickHandler);
2216
- this.clickHandler = null;
2217
- }
2218
-
2219
- if (this.keyDownHandler) {
2220
- document.removeEventListener("keydown", this.keyDownHandler);
2221
- this.keyDownHandler = null;
2222
- }
2223
- }
2224
-
2225
- handleUpdate(changedProperties) {
2226
- if (changedProperties.has("isPopoverVisible")) {
2227
- this.updateState();
2228
- }
2229
- }
2230
-
2231
- updateCurrentExpandedDropdown() {
2232
- // Close any other dropdown that is already open
2233
- const existedVisibleFloatingUI =
2234
- document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
2235
- if (
2236
- existedVisibleFloatingUI &&
2237
- existedVisibleFloatingUI !== this &&
2238
- existedVisibleFloatingUI.element.isPopoverVisible &&
2239
- existedVisibleFloatingUI.eventPrefix === this.eventPrefix
2240
- ) {
2241
- existedVisibleFloatingUI.hideBib();
2242
- }
2243
-
2244
- document.expandedAuroFloater = this;
2245
- }
2246
-
2247
- showBib() {
2248
- if (!this.element.disabled && !this.showing) {
2249
- this.updateCurrentExpandedDropdown();
2250
- this.element.triggerChevron?.setAttribute("data-expanded", true);
2251
-
2252
- // prevent double showing: isPopovervisible gets first and showBib gets called later
2253
- if (!this.showing) {
2254
- if (!this.element.modal) {
2255
- this.setupHideHandlers();
2256
- }
2257
- this.showing = true;
2258
- this.element.isPopoverVisible = true;
2259
- this.position();
2260
- this.dispatchEventDropdownToggle();
2261
- }
2262
-
2263
- // Setup auto update to handle resize and scroll
2264
- this.element.cleanup = autoUpdate(
2265
- this.element.trigger || this.element.parentNode,
2266
- this.element.bib,
2267
- () => {
2268
- this.position();
2269
- },
2270
- );
2271
- }
2272
- }
2273
-
2274
- /**
2275
- * Hides the floating UI element.
2276
- * @param {String} eventType - The event type that triggered the hiding action.
2277
- */
2278
- hideBib(eventType = "unknown") {
2279
- if (!this.element.disabled && !this.element.noToggle) {
2280
- this.lockScroll(false);
2281
- this.element.triggerChevron?.removeAttribute("data-expanded");
2282
-
2283
- if (this.element.isPopoverVisible) {
2284
- this.element.isPopoverVisible = false;
2285
- }
2286
- if (this.showing) {
2287
- this.cleanupHideHandlers();
2288
- this.showing = false;
2289
- this.dispatchEventDropdownToggle(eventType);
2290
- }
2291
- }
2292
- document.expandedAuroFloater = null;
2293
- }
2294
-
2295
- /**
2296
- * @private
2297
- * @returns {void} Dispatches event with an object showing the state of the dropdown.
2298
- * @param {String} eventType - The event type that triggered the toggle action.
2299
- */
2300
- dispatchEventDropdownToggle(eventType) {
2301
- const event = new CustomEvent(
2302
- this.eventPrefix ? `${this.eventPrefix}-toggled` : "toggled",
2303
- {
2304
- detail: {
2305
- expanded: this.showing,
2306
- eventType: eventType || "unknown",
2307
- },
2308
- composed: true,
2309
- },
2310
- );
2311
-
2312
- this.element.dispatchEvent(event);
2313
- }
2314
-
2315
- handleClick() {
2316
- if (this.element.isPopoverVisible) {
2317
- this.hideBib("click");
2318
- } else {
2319
- this.showBib();
2320
- }
2321
-
2322
- const event = new CustomEvent(
2323
- this.eventPrefix ? `${this.eventPrefix}-triggerClick` : "triggerClick",
2324
- {
2325
- composed: true,
2326
- detail: {
2327
- expanded: this.element.isPopoverVisible,
2328
- },
2329
- },
2330
- );
2331
-
2332
- this.element.dispatchEvent(event);
2333
- }
2334
-
2335
- handleEvent(event) {
2336
- if (!this.element.disableEventShow) {
2337
- switch (event.type) {
2338
- case "keydown": {
2339
- // Support both Enter and Space keys for accessibility
2340
- // Space is included as it's expected behavior for interactive elements
2341
-
2342
- const origin = event.composedPath()[0];
2343
- if (
2344
- event.key === "Enter" ||
2345
- (event.key === " " && (!origin || origin.tagName !== "INPUT"))
2346
- ) {
2347
- event.preventDefault();
2348
- this.handleClick();
2349
- }
2350
- break;
2351
- }
2352
- case "mouseenter":
2353
- if (this.element.hoverToggle) {
2354
- this.showBib();
2355
- }
2356
- break;
2357
- case "mouseleave":
2358
- if (this.element.hoverToggle) {
2359
- this.hideBib("mouseleave");
2360
- }
2361
- break;
2362
- case "focus":
2363
- if (this.element.focusShow) {
2364
- /*
2365
- This needs to better handle clicking that gives focus -
2366
- currently it shows and then immediately hides the bib
2367
- */
2368
- this.showBib();
2369
- }
2370
- break;
2371
- case "blur":
2372
- // send this task 100ms later queue to
2373
- // wait a frame in case focus moves within the floating element/bib
2374
- setTimeout(() => this.handleFocusLoss(), 0);
2375
- break;
2376
- case "click":
2377
- if (document.activeElement === document.body) {
2378
- event.currentTarget.focus();
2379
- }
2380
- this.handleClick();
2381
- break;
2382
- // Do nothing
2383
- }
2384
- }
2385
- }
2386
-
2387
- /**
2388
- * Manages the tabIndex of the trigger element based on its focusability.
2389
- *
2390
- * If the trigger element or any of its children are inherently focusable, the tabIndex of the component is set to -1.
2391
- * This prevents the component itself from being focusable when the trigger element already handles focus.
2392
- */
2393
- handleTriggerTabIndex() {
2394
- const focusableElementSelectors = [
2395
- "a",
2396
- "button",
2397
- 'input:not([type="hidden"])',
2398
- "select",
2399
- "textarea",
2400
- '[tabindex]:not([tabindex="-1"])',
2401
- "auro-button",
2402
- "auro-input",
2403
- "auro-hyperlink",
2404
- ];
2405
-
2406
- const triggerNode = this.element.querySelectorAll('[slot="trigger"]')[0];
2407
- if (!triggerNode) {
2408
- return;
2409
- }
2410
- const triggerNodeTagName = triggerNode.tagName.toLowerCase();
2411
-
2412
- focusableElementSelectors.forEach((selector) => {
2413
- // Check if the trigger node element is focusable
2414
- if (triggerNodeTagName === selector) {
2415
- this.element.tabIndex = -1;
2416
- return;
2417
- }
2418
-
2419
- // Check if any child is focusable
2420
- if (triggerNode.querySelector(selector)) {
2421
- this.element.tabIndex = -1;
2422
- }
2423
- });
2424
- }
2425
-
2426
- /**
2427
- *
2428
- * @param {*} eventPrefix
2429
- */
2430
- regenerateBibId() {
2431
- this.id = this.element.getAttribute("id");
2432
- if (!this.id) {
2433
- this.id = window.crypto.randomUUID();
2434
- this.element.setAttribute("id", this.id);
2435
- }
2436
-
2437
- this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
2438
- }
2439
-
2440
- configure(elem, eventPrefix) {
2441
- AuroFloatingUI.setupMousePressChecker();
2442
-
2443
- this.eventPrefix = eventPrefix;
2444
- if (this.element !== elem) {
2445
- this.element = elem;
2446
- }
2447
-
2448
- if (this.behavior !== this.element.behavior) {
2449
- this.behavior = this.element.behavior;
2450
- }
2451
-
2452
- if (this.element.trigger) {
2453
- this.disconnect();
2454
- }
2455
- this.element.trigger =
2456
- this.element.triggerElement ||
2457
- this.element.shadowRoot.querySelector("#trigger") ||
2458
- this.element.trigger;
2459
- this.element.bib =
2460
- this.element.shadowRoot.querySelector("#bib") || this.element.bib;
2461
- this.element.bibSizer = this.element.shadowRoot.querySelector("#bibSizer");
2462
- this.element.triggerChevron =
2463
- this.element.shadowRoot.querySelector("#showStateIcon");
2464
-
2465
- if (this.element.floaterConfig) {
2466
- this.element.hoverToggle = this.element.floaterConfig.hoverToggle;
2467
- }
2468
-
2469
- this.regenerateBibId();
2470
- this.handleTriggerTabIndex();
2471
-
2472
- this.handleEvent = this.handleEvent.bind(this);
2473
- if (this.element.trigger) {
2474
- this.element.trigger.addEventListener("keydown", this.handleEvent);
2475
- this.element.trigger.addEventListener("click", this.handleEvent);
2476
- this.element.trigger.addEventListener("mouseenter", this.handleEvent);
2477
- this.element.trigger.addEventListener("mouseleave", this.handleEvent);
2478
- this.element.trigger.addEventListener("focus", this.handleEvent);
2479
- this.element.trigger.addEventListener("blur", this.handleEvent);
2480
- }
2481
- }
2482
-
2483
- disconnect() {
2484
- this.cleanupHideHandlers();
2485
- if (this.element) {
2486
- this.element.cleanup?.();
2487
-
2488
- if (this.element.bib) {
2489
- this.element.shadowRoot.append(this.element.bib);
2490
- }
2491
-
2492
- // Remove event & keyboard listeners
2493
- if (this.element?.trigger) {
2494
- this.element.trigger.removeEventListener("keydown", this.handleEvent);
2495
- this.element.trigger.removeEventListener("click", this.handleEvent);
2496
- this.element.trigger.removeEventListener(
2497
- "mouseenter",
2498
- this.handleEvent,
2499
- );
2500
- this.element.trigger.removeEventListener(
2501
- "mouseleave",
2502
- this.handleEvent,
2503
- );
2504
- this.element.trigger.removeEventListener("focus", this.handleEvent);
2505
- this.element.trigger.removeEventListener("blur", this.handleEvent);
2506
- }
2507
- }
2508
- }
2509
- }
2510
-
2511
- // Selectors for focusable elements
2512
- const FOCUSABLE_SELECTORS = [
2513
- "a[href]",
2514
- "button:not([disabled])",
2515
- "textarea:not([disabled])",
2516
- "input:not([disabled])",
2517
- "select:not([disabled])",
2518
- '[role="tab"]:not([disabled])',
2519
- '[role="link"]:not([disabled])',
2520
- '[role="button"]:not([disabled])',
2521
- '[tabindex]:not([tabindex="-1"])',
2522
- '[contenteditable]:not([contenteditable="false"])',
2523
- ];
2524
-
2525
- // List of custom components that are known to be focusable
2526
- const FOCUSABLE_COMPONENTS = [
2527
- "auro-checkbox",
2528
- "auro-radio",
2529
- "auro-dropdown",
2530
- "auro-button",
2531
- "auro-combobox",
2532
- "auro-input",
2533
- "auro-counter",
2534
- // 'auro-menu', // Auro menu is not focusable by default, it uses a different interaction model
2535
- "auro-select",
2536
- "auro-datepicker",
2537
- "auro-hyperlink",
2538
- "auro-accordion",
2539
- ];
2540
-
2541
- /**
2542
- * Determines if a given element is a custom focusable component.
2543
- * Returns true if the element matches a known focusable component and is not disabled.
2544
- *
2545
- * @param {HTMLElement} element The element to check for focusability.
2546
- * @returns {boolean} True if the element is a focusable custom component, false otherwise.
2547
- */
2548
- function isFocusableComponent(element) {
2549
- const componentName = element.tagName.toLowerCase();
2550
-
2551
- // Guard Clause: Element is a focusable component
2552
- if (
2553
- !FOCUSABLE_COMPONENTS.some(
2554
- (name) => element.hasAttribute(name) || componentName === name,
2555
- )
2556
- )
2557
- return false;
2558
-
2559
- // Guard Clause: Element is not disabled
2560
- if (element.hasAttribute("disabled")) return false;
2561
-
2562
- // Guard Clause: The element is a hyperlink and has no href attribute
2563
- if (componentName.match("hyperlink") && !element.hasAttribute("href"))
2564
- return false;
2565
-
2566
- // If all guard clauses pass, the element is a focusable component
2567
- return true;
2568
- }
2569
-
2570
- /**
2571
- * Safely get a numeric tabindex for an element.
2572
- * Returns a number if the tabindex is a valid integer, otherwise null.
2573
- *
2574
- * @param {HTMLElement} element The element whose tabindex to read.
2575
- * @returns {?number} The numeric tabindex or null if missing/invalid.
2576
- */
2577
- function getNumericTabIndex(element) {
2578
- const raw = element.getAttribute("tabindex");
2579
- if (raw == null) return null;
2580
-
2581
- const value = Number.parseInt(raw, 10);
2582
- return Number.isNaN(value) ? null : value;
2583
- }
2584
-
2585
- /**
2586
- * Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
2587
- * Returns a unique, ordered array of elements that can receive focus.
2588
- * Also sorts elements with tabindex first, preserving their order.
2589
- *
2590
- * @param {HTMLElement} container The container to search within
2591
- * @returns {Array<HTMLElement>} An array of focusable elements within the container.
2592
- */
2593
- function getFocusableElements(container) {
2594
- // Get elements in DOM order by walking the tree
2595
- const orderedFocusableElements = [];
2596
-
2597
- // Define a recursive function to collect focusable elements in DOM order
2598
- const collectFocusableElements = (root) => {
2599
- // Check if current element is focusable
2600
- if (root.nodeType === Node.ELEMENT_NODE) {
2601
- // Check if this is a custom component that is focusable
2602
- const isComponentFocusable = isFocusableComponent(root);
2603
-
2604
- if (isComponentFocusable) {
2605
- // Add the component itself as a focusable element and don't traverse its shadow DOM
2606
- orderedFocusableElements.push(root);
2607
- return; // Skip traversing inside this component
2608
- }
2609
-
2610
- // Check if the element itself matches any selector
2611
- for (const selector of FOCUSABLE_SELECTORS) {
2612
- if (root.matches?.(selector)) {
2613
- orderedFocusableElements.push(root);
2614
- break; // Once we know it's focusable, no need to check other selectors
2615
- }
2616
- }
2617
-
2618
- // Process shadow DOM only for non-Auro components
2619
- if (root.shadowRoot) {
2620
- // Process shadow DOM children in order
2621
- if (root.shadowRoot.children) {
2622
- Array.from(root.shadowRoot.children).forEach((child) => {
2623
- collectFocusableElements(child);
2624
- });
2625
- }
2626
- }
2627
-
2628
- // Process slots and their assigned nodes in order
2629
- if (root.tagName === "SLOT") {
2630
- const assignedNodes = root.assignedNodes({ flatten: true });
2631
- for (const node of assignedNodes) {
2632
- collectFocusableElements(node);
2633
- }
2634
- } else {
2635
- // Process light DOM children in order
2636
- if (root.children) {
2637
- Array.from(root.children).forEach((child) => {
2638
- collectFocusableElements(child);
2639
- });
2640
- }
2641
- }
2642
- }
2643
- };
2644
-
2645
- // Start the traversal from the container
2646
- collectFocusableElements(container);
2647
-
2648
- // Remove duplicates that might have been collected through different paths
2649
- // while preserving order
2650
- const uniqueElements = [];
2651
- const seen = new Set();
2652
-
2653
- for (const element of orderedFocusableElements) {
2654
- if (!seen.has(element)) {
2655
- seen.add(element);
2656
- uniqueElements.push(element);
2657
- }
2658
- }
2659
-
2660
- // Move tab-indexed elements to the front while preserving their order
2661
- // This ensures that elements with tabindex are prioritized in the focus order
2662
-
2663
- // First extract elements with valid positive tabindex
2664
- const elementsWithTabindex = uniqueElements.filter((el) => {
2665
- const tabindex = getNumericTabIndex(el);
2666
- return tabindex !== null && tabindex > 0;
2667
- });
2668
-
2669
- // Sort these elements by their tabindex value
2670
- elementsWithTabindex.sort((a, b) => {
2671
- const aIndex = getNumericTabIndex(a) ?? 0;
2672
- const bIndex = getNumericTabIndex(b) ?? 0;
2673
- return aIndex - bIndex;
2674
- });
2675
-
2676
- // Elements without tabindex (preserving their original order)
2677
- const elementsWithoutTabindex = uniqueElements.filter((el) => {
2678
- const tabindex = getNumericTabIndex(el);
2679
-
2680
- // Elements without tabindex or with tabindex of 0 stay in DOM order
2681
- return tabindex === null || tabindex === 0;
2682
- });
2683
-
2684
- // Combine both arrays with tabindex elements first
2685
- const tabIndexedUniqueElements = [
2686
- ...elementsWithTabindex,
2687
- ...elementsWithoutTabindex,
2688
- ];
2689
-
2690
- return tabIndexedUniqueElements;
2691
- }
2692
-
2693
- /**
2694
- * FocusTrap manages keyboard focus within a specified container element, ensuring that focus does not leave the container when tabbing.
2695
- * It is commonly used for modal dialogs or overlays to improve accessibility by trapping focus within interactive UI components.
2696
- */
2697
- class FocusTrap {
2698
- /**
2699
- * Creates a new FocusTrap instance for the given container element.
2700
- * Initializes event listeners and prepares the container for focus management.
2701
- *
2702
- * @param {HTMLElement} container The DOM element to trap focus within.
2703
- * @param {boolean} [controlTabOrder=false] If true enables manual control of the tab order by the FocusTrap.
2704
- * @throws {Error} If the provided container is not a valid HTMLElement.
2705
- */
2706
- constructor(container, controlTabOrder = false) {
2707
- if (!container || !(container instanceof HTMLElement)) {
2708
- throw new Error("FocusTrap requires a valid HTMLElement.");
2709
- }
2710
-
2711
- this.container = container;
2712
- this.tabDirection = "forward"; // or 'backward';
2713
- this.controlTabOrder = controlTabOrder;
2714
-
2715
- this._init();
2716
- }
2717
-
2718
- /**
2719
- * Initializes the focus trap by setting up event listeners and attributes on the container.
2720
- * Prepares the container for focus management, including support for shadow DOM and inert attributes.
2721
- *
2722
- * @private
2723
- */
2724
- _init() {
2725
- // Add inert attribute to prevent focusing programmatically as well (if supported)
2726
- if ("inert" in HTMLElement.prototype) {
2727
- this.container.inert = false; // Ensure the container isn't inert
2728
- this.container.setAttribute("data-focus-trap-container", true); // Mark for identification
2729
- }
2730
-
2731
- // Track tab direction
2732
- this.container.addEventListener("keydown", this._onKeydown);
2733
- }
2734
-
2735
- /**
2736
- * Gets an array of currently active (focused) elements in the document and shadow DOM.
2737
- * @returns {Array<HTMLElement>} An array of focusable elements within the container.
2738
- * @private
2739
- */
2740
- _getActiveElements() {
2741
- // Get the active element(s) in the document and shadow root
2742
- // This will include the active element in the shadow DOM if it exists
2743
- // Active element may be inside the shadow DOM depending on delegatesFocus, so we need to check both
2744
- let { activeElement } = document;
2745
- const actives = [activeElement];
2746
- while (activeElement?.shadowRoot?.activeElement) {
2747
- actives.push(activeElement.shadowRoot.activeElement);
2748
- activeElement = activeElement.shadowRoot.activeElement;
2749
- }
2750
- return actives;
2751
- }
2752
-
2753
- /**
2754
- * Gets the next focus index based on the current index and focusable elements.
2755
- * @param {number} currentIndex The current index of the focused element.
2756
- * @param {Array<HTMLElement>} focusables The array of focusable elements.
2757
- * @returns {number|null} The next focus index or null if not determined.
2758
- */
2759
- _getNextFocusIndex(currentIndex, focusables, actives) {
2760
- if (this.controlTabOrder) {
2761
- // Calculate the new index based on the current index and tab direction
2762
- let newFocusIndex =
2763
- currentIndex + (this.tabDirection === "forward" ? 1 : -1);
2764
-
2765
- // Wrap-around logic
2766
- if (newFocusIndex < 0) newFocusIndex = focusables.length - 1;
2767
- if (newFocusIndex >= focusables.length) newFocusIndex = 0;
2768
-
2769
- // Early return with the new index
2770
- return newFocusIndex;
2771
- }
2772
-
2773
- // Determine if we need to wrap
2774
- const atFirst =
2775
- actives.includes(focusables[0]) || actives.includes(this.container);
2776
- const atLast = actives.includes(focusables[focusables.length - 1]);
2777
-
2778
- // Only wrap if at the ends
2779
- if (this.tabDirection === "backward" && atFirst) {
2780
- return focusables.length - 1;
2781
- }
2782
-
2783
- if (this.tabDirection === "forward" && atLast) {
2784
- return 0;
2785
- }
2786
-
2787
- // No wrap, so don't change focus, return early
2788
- return null;
2789
- }
2790
-
2791
- /**
2792
- * Handles the Tab key press event to manage focus within the container.
2793
- * @param {KeyboardEvent} e The keyboard event triggered by the user.
2794
- * @returns {void}
2795
- */
2796
- _handleTabKey(e) {
2797
- // Update the focusable elements
2798
- const focusables = this._getFocusableElements();
2799
-
2800
- // If there are no focusable elements, exit
2801
- if (!focusables.length) return;
2802
-
2803
- // Set the tab direction based on the key pressed
2804
- this.tabDirection = e.shiftKey ? "backward" : "forward";
2805
-
2806
- // Get the active elements that are currently focused
2807
- const actives = this._getActiveElements();
2808
-
2809
- // If we're at either end of the focusable elements, wrap around to the other end
2810
- let focusIndex = focusables.findIndex((el) => actives.includes(el));
2811
-
2812
- // Fallback if we have no focused element
2813
- if (focusIndex === -1) focusIndex = 0;
2814
-
2815
- // Get the next focus index based on the current focus index, tab direction, and controlTabOrder setting
2816
- // Is null if no new focus index is determined
2817
- const newFocusIndex = this._getNextFocusIndex(
2818
- focusIndex,
2819
- focusables,
2820
- actives,
2821
- );
2822
-
2823
- // If we have a new focus index, set focus to that element
2824
- if (newFocusIndex !== null) {
2825
- e.preventDefault();
2826
- focusables[newFocusIndex].focus();
2827
- }
2828
- }
2829
-
2830
- /**
2831
- * Catches the keydown event
2832
- * @param {KeyboardEvent} e The keyboard event triggered by user interaction.
2833
- * @private
2834
- */
2835
- _onKeydown = (e) => {
2836
- // Handle tab
2837
- if (e.key === "Tab") this._handleTabKey(e);
2838
- };
2839
-
2840
- /**
2841
- * Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
2842
- * Returns a unique, ordered array of elements that can receive focus.
2843
- *
2844
- * @returns {Array<HTMLElement>} An array of focusable elements within the container.
2845
- * @private
2846
- */
2847
- _getFocusableElements() {
2848
- // Use the imported utility function to get focusable elements
2849
- const elements = getFocusableElements(this.container);
2850
-
2851
- // Return the elements found
2852
- return elements;
2853
- }
2854
-
2855
- /**
2856
- * Moves focus to the first focusable element within the container.
2857
- * Useful for setting initial focus when activating the focus trap.
2858
- */
2859
- focusFirstElement() {
2860
- const focusables = this._getFocusableElements();
2861
- if (focusables.length) focusables[0].focus();
2862
- }
2863
-
2864
- /**
2865
- * Moves focus to the last focusable element within the container.
2866
- * Useful for setting focus when deactivating or cycling focus in reverse.
2867
- */
2868
- focusLastElement() {
2869
- const focusables = this._getFocusableElements();
2870
- if (focusables.length) focusables[focusables.length - 1].focus();
2871
- }
2872
-
2873
- /**
2874
- * Removes event listeners and attributes added by the focus trap.
2875
- * Call this method to clean up when the focus trap is no longer needed.
2876
- */
2877
- disconnect() {
2878
- if (this.container.hasAttribute("data-focus-trap-container")) {
2879
- this.container.removeAttribute("data-focus-trap-container");
2880
- }
2881
-
2882
- this.container.removeEventListener("keydown", this._onKeydown);
2883
- }
2884
- }
2885
-
2886
- // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
2887
- // See LICENSE in the project root for license information.
2888
-
2889
-
2890
- class AuroDependencyVersioning {
2891
-
2892
- /**
2893
- * Generates a unique string to be used for child auro element naming.
2894
- * @private
2895
- * @param {string} baseName - Defines the first part of the unique element name.
2896
- * @param {string} version - Version of the component that will be appended to the baseName.
2897
- * @returns {string} - Unique string to be used for naming.
2898
- */
2899
- generateElementName(baseName, version) {
2900
- let result = baseName;
2901
-
2902
- result += '-';
2903
- result += version.replace(/[.]/g, '_');
2904
-
2905
- return result;
2906
- }
2907
-
2908
- /**
2909
- * Generates a unique string to be used for child auro element naming.
2910
- * @param {string} baseName - Defines the first part of the unique element name.
2911
- * @param {string} version - Version of the component that will be appended to the baseName.
2912
- * @returns {string} - Unique string to be used for naming.
2913
- */
2914
- generateTag(baseName, version, tagClass) {
2915
- const elementName = this.generateElementName(baseName, version);
2916
- const tag = i$4`${s$3(elementName)}`;
2917
-
2918
- if (!customElements.get(elementName)) {
2919
- customElements.define(elementName, class extends tagClass {});
2920
- }
2921
-
2922
- return tag;
2923
- }
2924
- }
2925
-
2926
- /**
2927
- * @license
2928
- * Copyright 2019 Google LLC
2929
- * SPDX-License-Identifier: BSD-3-Clause
2930
- */
2931
- const t=globalThis,e$1=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$3=new WeakMap;let n$1 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$1&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$3.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$3.set(s,t));}return t}toString(){return this.cssText}};const r$1=t=>new n$1("string"==typeof t?t:t+"",void 0,s$1),i$2=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$1(o,t,s$1)},S=(s,o)=>{if(e$1)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$1=e$1?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$1(e)})(t):t;
2932
-
2933
- /**
2934
- * @license
2935
- * Copyright 2017 Google LLC
2936
- * SPDX-License-Identifier: BSD-3-Clause
2937
- */const{is:i$1,defineProperty:e,getOwnPropertyDescriptor:h,getOwnPropertyNames:r,getOwnPropertySymbols:o$2,getPrototypeOf:n}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:"",p$1=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$1(t,s),b={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d("elementProperties")))return;const t=n(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d("properties"))){const t=this.properties,s=[...r(t),...o$2(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$1(s));}else void 0!==s&&i.push(c$1(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(t=>t.hostConnected?.());}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.());}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i,e=false,h){if(void 0!==t){const r=this.constructor;if(false===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d("elementProperties")]=new Map,y$1[d("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a.reactiveElementVersions??=[]).push("2.1.2");
2938
-
2939
- /**
2940
- * @license
2941
- * Copyright 2017 Google LLC
2942
- * SPDX-License-Identifier: BSD-3-Clause
2943
- */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");
2944
-
2945
- /**
2946
- * @license
2947
- * Copyright 2018 Google LLC
2948
- * SPDX-License-Identifier: BSD-3-Clause
2949
- */const o=o=>o??A;
2950
-
2951
- 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}
2952
- `;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}
2953
- `;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)}
2954
- `;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)}
2955
- `;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`
2956
- <div class="componentWrapper">
2957
- <div
2958
- class="${e$3({svgWrapper:true})}"
2959
- title="${o(this.title||void 0)}">
2960
- <span aria-hidden="${o(this.ariaHidden||true)}" part="svg">
2961
- ${this.customSvg?b$1`
2962
- <slot name="svg"></slot>
2963
- `:b$1`
2964
- ${this.svg}
2965
- `}
2966
- </span>
2967
- </div>
2968
-
2969
- <div class="${e$3(t)}" part="label">
2970
- <slot></slot>
2971
- </div>
2972
- </div>
2973
- `}}
2974
-
2975
- var iconVersion = '9.1.2';
2976
-
2977
- 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}`;
2978
-
2979
- 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)}`;
2980
-
2981
- 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)}`;
2982
-
2983
- // Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
2984
- // See LICENSE in the project root for license information.
2985
- /* eslint-disable max-lines */
2986
- // ---------------------------------------------------------------------
2987
-
2988
-
2989
- const DESIGN_TOKEN_BREAKPOINT_PREFIX = '--ds-grid-breakpoint-';
2990
- const DESIGN_TOKEN_BREAKPOINT_OPTIONS = [
2991
- 'xl',
2992
- 'lg',
2993
- 'md',
2994
- 'sm',
2995
- 'xs',
2996
- ];
2997
-
2998
- /**
2999
- * @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.
3000
- * @csspart bibContainer - Apply css to the bib container.
3001
- */
3002
-
3003
- class AuroDropdownBib extends i {
3004
- // not extending AuroElement because Bib needs only `shape` prop
3005
- constructor() {
3006
- super();
3007
-
3008
- /**
3009
- * @private
3010
- */
3011
- this._mobileBreakpointValue = undefined;
3012
-
3013
- AuroLibraryRuntimeUtils$1.prototype.handleComponentTagRename(this, 'auro-dropdownbib');
3014
-
3015
- this.shape = "rounded";
3016
- this.matchWidth = false;
3017
- }
3018
-
3019
- static get styles() {
3020
- return [
3021
- styleCss$2,
3022
- colorCss$2,
3023
- tokensCss$1
3024
- ];
3025
- }
3026
-
3027
- static get properties() {
3028
- return {
3029
-
3030
- /**
3031
- * If declared, will take the fullscreen when the bib is displayed.
3032
- */
3033
- isFullscreen: {
3034
- type: Boolean,
3035
- reflect: true
3036
- },
3037
-
3038
- /**
3039
- * If declared, will apply all styles for the common theme.
3040
- */
3041
- common: {
3042
- type: Boolean,
3043
- reflect: true
3044
- },
3045
-
3046
- /**
3047
- * If declared, will apply extra padding to bib content.
3048
- */
3049
- inset: {
3050
- type: Boolean,
3051
- reflect: true
3052
- },
3053
-
3054
- /**
3055
- * If declared, the bib width will match the trigger width.
3056
- * @private
3057
- */
3058
- matchWidth: {
3059
- type: Boolean,
3060
- reflect: true
3061
- },
3062
-
3063
- /**
3064
- * If declared, will apply border-radius to the bib.
3065
- */
3066
- rounded: {
3067
- type: Boolean,
3068
- reflect: true
3069
- },
3070
-
3071
- /**
3072
- * A reference to the associated bib template element.
3073
- */
3074
- bibTemplate: {
3075
- type: Object
3076
- },
3077
-
3078
- shape: {
3079
- type: String,
3080
- reflect: true
3081
- },
3082
-
3083
- /**
3084
- * Accessible label for the dialog element, used when displayed as a modal.
3085
- * Applied via aria-labelledby on a visually hidden element rather than
3086
- * aria-label because iOS VoiceOver does not reliably read aria-label
3087
- * on <dialog> elements.
3088
- * @private
3089
- */
3090
- dialogLabel: {
3091
- type: String
3092
- },
3093
-
3094
- /**
3095
- * Overrides the native role of the dialog element.
3096
- * For example, set to `"presentation"` on desktop combobox to prevent
3097
- * VoiceOver from announcing "listbox inside of a dialog".
3098
- * When `undefined`, the dialog keeps its native role.
3099
- * @private
3100
- */
3101
- dialogRole: {
3102
- type: String
3103
- }
3104
- };
3105
- }
3106
-
3107
- set mobileFullscreenBreakpoint(value) {
3108
- // verify the defined breakpoint is valid and exit out if not
3109
- // 'disabled' is a design token breakpoint so it acts as our "undefined" value
3110
- const validatedValue = DESIGN_TOKEN_BREAKPOINT_OPTIONS.includes(value) ? value : undefined;
3111
- if (!validatedValue) {
3112
- this._mobileBreakpointValue = undefined;
3113
- } else {
3114
- // get the pixel value for the defined breakpoint
3115
- const docStyle = getComputedStyle(document.documentElement);
3116
- this._mobileBreakpointValue = docStyle.getPropertyValue(DESIGN_TOKEN_BREAKPOINT_PREFIX + value);
3117
- }
3118
- }
3119
-
3120
- get mobileFullscreenBreakpoint() {
3121
- return this._mobileBreakpointValue;
3122
- }
3123
-
3124
- updated(changedProperties) {
3125
- if (changedProperties.has('isFullscreen')) {
3126
- this.childNodes.forEach((child) => {
3127
- // skip any text that is not in an HTMLElement on setting `isFullscreen` attr.
3128
- if (child.nodeName !== '#text') {
3129
- if (this.isFullscreen) {
3130
- child.setAttribute('isFullscreen', 'true');
3131
- } else {
3132
- child.removeAttribute('isFullscreen');
3133
- }
3134
- }
3135
- });
3136
-
3137
- if (this.bibTemplate) {
3138
- // If the bib template is found, set the fullscreen attribute
3139
- if (this.isFullscreen) {
3140
- this.bibTemplate.setAttribute('isFullscreen', 'true');
3141
- } else {
3142
- this.bibTemplate.removeAttribute('isFullscreen');
3143
- }
3144
- }
3145
- }
3146
- }
3147
-
3148
- connectedCallback() {
3149
- super.connectedCallback();
3150
-
3151
- // Listen for the auro-bibtemplate-connected event to set the fullscreen attribute
3152
- this.addEventListener('auro-bibtemplate-connected', (event) => {
3153
- const bibTemplate = event.detail.element;
3154
- this.bibTemplate = bibTemplate;
3155
-
3156
- if (bibTemplate) {
3157
- // If the bib template is found, set the fullscreen attribute
3158
- if (this.isFullscreen) {
3159
- bibTemplate.setAttribute('isFullscreen', 'true');
3160
- } else {
3161
- bibTemplate.removeAttribute('isFullscreen');
3162
- }
3163
- }
3164
- });
3165
- }
3166
-
3167
- firstUpdated(changedProperties) {
3168
- super.firstUpdated(changedProperties);
3169
-
3170
- const dialog = this.shadowRoot.querySelector('dialog');
3171
- this._setupCancelHandler(dialog);
3172
- this._setupKeyboardBridge(dialog);
3173
-
3174
- this.dispatchEvent(new CustomEvent('auro-dropdownbib-connected', {
3175
- bubbles: true,
3176
- composed: true,
3177
- detail: {
3178
- element: this
3179
- }
3180
- }));
3181
- }
3182
-
3183
- /**
3184
- * Forwards the dialog's native `cancel` event (fired on ESC) as
3185
- * an `auro-bib-cancel` custom event so parent components can close.
3186
- * @param {HTMLDialogElement} dialog
3187
- * @private
3188
- */
3189
- _setupCancelHandler(dialog) {
3190
- dialog.addEventListener('cancel', (event) => {
3191
- event.preventDefault();
3192
- this.dispatchEvent(new CustomEvent('auro-bib-cancel', {
3193
- bubbles: true,
3194
- composed: true
3195
- }));
3196
- });
3197
- }
3198
-
3199
- /**
3200
- * showModal() creates a closed focus scope — keyboard events inside
3201
- * the dialog's shadow DOM do NOT bubble out to the combobox/select
3202
- * keydown handlers in the parent shadow DOM. This handler bridges
3203
- * that gap by re-dispatching navigation keys so they cross the
3204
- * shadow boundary and reach the menu navigation logic in the parent
3205
- * component.
3206
- *
3207
- * The trade-off: intercepting these keys means native keyboard
3208
- * behaviors that would normally "just work" must be manually
3209
- * re-implemented here:
3210
- *
3211
- * - Enter on buttons: Custom elements (auro-button) don't get the
3212
- * native Enter→click that <button> provides, so we call .click()
3213
- * directly when Enter is pressed on a button-like element.
3214
- *
3215
- * - Tab: Intercepted and re-dispatched so parent components
3216
- * (select/combobox) can select the active option and close the
3217
- * dialog. The <dialog> provides containment and isolation
3218
- * (inert background, VoiceOver focus trapping, top layer), while
3219
- * the content inside is a role="listbox" navigated via
3220
- * aria-activedescendant (options are not focusable). Tab keyboard
3221
- * behavior follows listbox conventions (select + close) because
3222
- * the dialog's native Tab trap only cycles between the close
3223
- * button and browser chrome.
3224
- *
3225
- * - Escape: The native <dialog> fires a `cancel` event on ESC
3226
- * (handled by _setupCancelHandler), so the re-dispatched Escape
3227
- * is a secondary path for parent components that also listen for
3228
- * Escape keydown.
3229
- *
3230
- * @param {HTMLDialogElement} dialog
3231
- * @private
3232
- */
3233
- _setupKeyboardBridge(dialog) {
3234
- const navKeys = new Set([
3235
- 'ArrowUp',
3236
- 'ArrowDown',
3237
- 'Enter',
3238
- 'Escape',
3239
- 'Tab'
3240
- ]);
3241
-
3242
- dialog.addEventListener('keydown', (event) => {
3243
- if (!navKeys.has(event.key)) {
3244
- return;
3245
- }
3246
-
3247
- // Custom elements (auro-button) don't get the native Enter→click
3248
- // behavior that <button> has. Find the button in the composed path
3249
- // and click it directly.
3250
- if (event.key === 'Enter') {
3251
- const buttonSelector = 'button, [role="button"], auro-button, [auro-button]';
3252
- const btn = event.composedPath().find((el) => el.matches && el.matches(buttonSelector));
3253
- if (btn) {
3254
- event.preventDefault();
3255
- event.stopPropagation();
3256
- btn.click();
3257
- return;
3258
- }
3259
- }
3260
-
3261
- event.preventDefault();
3262
- event.stopPropagation();
3263
- const newEvent = new KeyboardEvent('keydown', {
3264
- key: event.key,
3265
- code: event.code,
3266
- shiftKey: event.shiftKey,
3267
- altKey: event.altKey,
3268
- ctrlKey: event.ctrlKey,
3269
- metaKey: event.metaKey,
3270
- bubbles: true,
3271
- composed: true,
3272
- cancelable: true
3273
- });
3274
- this.dispatchEvent(newEvent);
3275
- });
3276
- }
3277
-
3278
- /**
3279
- * Blocks touch-driven page scroll while a fullscreen modal dialog is open.
3280
- *
3281
- * The showModal() function places the dialog in the browser's **top layer**,
3282
- * which is a separate rendering layer above the normal DOM. On mobile, the
3283
- * compositor processes visual-viewport panning before top-layer touch
3284
- * handling. This means the entire viewport — including the top-layer dialog
3285
- * — can be panned by a touch gesture, causing the page behind the dialog to
3286
- * scroll into view. To prevent this, we add a touchmove listener that cancels
3287
- * the event if the touch started outside the dialog or any scrollable child within it.
3288
- *
3289
- * @private
3290
- */
3291
- _lockTouchScroll() {
3292
- const dialog = this.shadowRoot.querySelector('dialog');
3293
-
3294
- this._touchMoveHandler = (event) => {
3295
- // Walk the composed path (which crosses shadow DOM boundaries) to
3296
- // check whether the touch started inside a scrollable element that
3297
- // lives within the dialog. If so, allow the scroll.
3298
- for (const el of event.composedPath()) {
3299
- if (el === dialog) {
3300
- // Reached the dialog boundary without finding a scrollable child.
3301
- break;
3302
- }
3303
- if (el instanceof HTMLElement && el.scrollHeight > el.clientHeight) {
3304
- const { overflowY } = getComputedStyle(el);
3305
- if (overflowY === 'auto' || overflowY === 'scroll') {
3306
- return;
3307
- }
3308
- }
3309
- }
3310
-
3311
- event.preventDefault();
3312
- };
3313
-
3314
- document.addEventListener('touchmove', this._touchMoveHandler, { passive: false });
3315
- }
3316
-
3317
- /**
3318
- * Removes the touchmove listener added by _lockTouchScroll().
3319
- * @private
3320
- */
3321
- _unlockTouchScroll() {
3322
- if (this._touchMoveHandler) {
3323
- document.removeEventListener('touchmove', this._touchMoveHandler);
3324
- this._touchMoveHandler = undefined;
3325
- }
3326
- }
3327
-
3328
- open(modal = true) {
3329
- const dialog = this.shadowRoot.querySelector('dialog');
3330
-
3331
- if (dialog && !dialog.open) {
3332
- if (modal) {
3333
- // Prevent showModal() from scrolling the page to bring the dialog
3334
- // into view. Locking overflow on <html> blocks the viewport scroll
3335
- // that browsers perform natively; we release it immediately after
3336
- // so it doesn't interfere with the modal's focus management.
3337
- const { documentElement } = document;
3338
- const prevOverflow = documentElement.style.overflow;
3339
- documentElement.style.overflow = 'hidden';
3340
-
3341
- try {
3342
- dialog.showModal();
3343
- } finally {
3344
- // Restore overflow immediately — the lock was only needed to
3345
- // suppress the browser's native scroll-into-view behavior
3346
- // triggered by showModal(). Keeping it locked would block
3347
- // scrolling inside the modal.
3348
- documentElement.style.overflow = prevOverflow;
3349
- }
3350
-
3351
- this._lockTouchScroll();
3352
-
3353
- } else {
3354
- // Open the inner dialog so slotted content renders.
3355
- dialog.setAttribute('open', '');
3356
-
3357
- // Use popover on the host for top-layer placement without focus
3358
- // management or inertness. This escapes ancestor container-type
3359
- // containment that would trap position:fixed relative to the container.
3360
- // Set popover dynamically to avoid UA [popover]:not(:popover-open) { display: none }
3361
- // interfering with Floating UI measurement before showPopover().
3362
- this.setAttribute('popover', 'manual');
3363
- this.showPopover();
3364
- }
3365
- }
3366
- }
3367
-
3368
- /**
3369
- * Closes the dialog.
3370
- */
3371
- close() {
3372
- const dialog = this.shadowRoot.querySelector('dialog');
3373
-
3374
- if (dialog && dialog.open) {
3375
- this._unlockTouchScroll();
3376
- dialog.close();
3377
- }
3378
- // Clean up the popover used for desktop top-layer placement.
3379
- // Remove the attribute entirely so the UA rule
3380
- // [popover]:not(:popover-open) { display: none } doesn't hide
3381
- // the host while Floating UI measures it for the next open.
3382
- if (this.matches(':popover-open')) {
3383
- this.hidePopover();
3384
- this.removeAttribute('popover');
3385
- }
3386
- }
3387
-
3388
- // function that renders the HTML and CSS into the scope of the component
3389
- render() {
3390
- const classes = {
3391
- container: true
3392
- };
3393
-
3394
- // Since this class does not inherit from AuroElement, we apply the shape-related class within the `render` function,
3395
- // mimicking the class naming convention used in AuroElement.resetShapeClasses.
3396
- classes[`shape-${this.shape}`] = true;
3397
-
3398
- return u$2`
3399
- <dialog class="${e$3(classes)}" part="bibContainer" role="${o(this.dialogRole)}" aria-labelledby="${o(this.dialogLabel ? 'dialogLabel' : undefined)}">
3400
- ${this.dialogLabel ? u$2`<span id="dialogLabel" class="util_displayHiddenVisually">${this.dialogLabel}</span>` : ''}
3401
- <slot></slot>
3402
- </dialog>
3403
- `;
3404
- }
3405
- }
3406
-
3407
- 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}`;
3408
-
3409
- 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)}`;
3410
-
3411
- 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%}`;
3412
-
3413
- var classicColorCss = i$2``;
3414
-
3415
- 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)}`;
3416
-
3417
- 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)}`;
3418
-
3419
- 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)}`;
3420
-
3421
- 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)}`;
3422
-
3423
- 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}`;
3424
-
3425
- var tokensCss = i$2`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
3426
-
3427
- // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
3428
- // See LICENSE in the project root for license information.
3429
-
3430
- // ---------------------------------------------------------------------
3431
-
3432
- /* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
3433
-
3434
- class AuroLibraryRuntimeUtils {
3435
-
3436
- /* eslint-disable jsdoc/require-param */
3437
-
3438
- /**
3439
- * This will register a new custom element with the browser.
3440
- * @param {String} name - The name of the custom element.
3441
- * @param {Object} componentClass - The class to register as a custom element.
3442
- * @returns {void}
3443
- */
3444
- registerComponent(name, componentClass) {
3445
- if (!customElements.get(name)) {
3446
- customElements.define(name, class extends componentClass {});
3447
- }
3448
- }
3449
-
3450
- /**
3451
- * Finds and returns the closest HTML Element based on a selector.
3452
- * @returns {void}
3453
- */
3454
- closestElement(
3455
- selector, // selector like in .closest()
3456
- base = this, // extra functionality to skip a parent
3457
- __Closest = (el, found = el && el.closest(selector)) =>
3458
- !el || el === document || el === window
3459
- ? null // standard .closest() returns null for non-found selectors also
3460
- : found
3461
- ? found // found a selector INside this element
3462
- : __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
3463
- ) {
3464
- return __Closest(base);
3465
- }
3466
- /* eslint-enable jsdoc/require-param */
3467
-
3468
- /**
3469
- * 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.
3470
- * @param {Object} elem - The element to check.
3471
- * @param {String} tagName - The name of the Auro component to check for or add as an attribute.
3472
- * @returns {void}
3473
- */
3474
- handleComponentTagRename(elem, tagName) {
3475
- const tag = tagName.toLowerCase();
3476
- const elemTag = elem.tagName.toLowerCase();
3477
-
3478
- if (elemTag !== tag) {
3479
- elem.setAttribute(tag, true);
3480
- }
3481
- }
3482
-
3483
- /**
3484
- * Validates if an element is a specific Auro component.
3485
- * @param {Object} elem - The element to validate.
3486
- * @param {String} tagName - The name of the Auro component to check against.
3487
- * @returns {Boolean} - Returns true if the element is the specified Auro component.
3488
- */
3489
- elementMatch(elem, tagName) {
3490
- const tag = tagName.toLowerCase();
3491
- const elemTag = elem.tagName.toLowerCase();
3492
-
3493
- return elemTag === tag || elem.hasAttribute(tag);
3494
- }
3495
-
3496
- /**
3497
- * Gets the text content of a named slot.
3498
- * @returns {String}
3499
- * @private
3500
- */
3501
- getSlotText(elem, name) {
3502
- const slot = elem.shadowRoot?.querySelector(`slot[name="${name}"]`);
3503
- const nodes = slot?.assignedNodes({ flatten: true }) || [];
3504
- const text = nodes.map(n => n.textContent?.trim()).join(' ').trim();
3505
-
3506
- return text || null;
3507
- }
3508
- }
3509
-
3510
- // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
3511
- // See LICENSE in the project root for license information.
3512
-
3513
-
3514
- /**
3515
- * Displays help text or error messages within form elements - Internal Use Only.
3516
- */
3517
- class AuroHelpText extends i {
3518
-
3519
- constructor() {
3520
- super();
3521
-
3522
- this.error = false;
3523
- this.appearance = "default";
3524
- this.onDark = false;
3525
- this.hasTextContent = false;
3526
-
3527
- AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-helptext');
3528
- }
3529
-
3530
- static get styles() {
3531
- return [
3532
- colorCss,
3533
- styleCss,
3534
- tokensCss
3535
- ];
3536
- }
3537
-
3538
- // function to define props used within the scope of this component
3539
- static get properties() {
3540
- return {
3541
-
3542
- /**
3543
- * Defines whether the component will be on lighter or darker backgrounds.
3544
- * @property {'default', 'inverse'}
3545
- * @default 'default'
3546
- */
3547
- appearance: {
3548
- type: String,
3549
- reflect: true
3550
- },
3551
-
3552
- /**
3553
- * @private
3554
- */
3555
- slotNodes: {
3556
- type: Boolean,
3557
- },
3558
-
3559
- /**
3560
- * @private
3561
- */
3562
- hasTextContent: {
3563
- type: Boolean,
3564
- },
3565
-
3566
- /**
3567
- * If declared, make font color red.
3568
- */
3569
- error: {
3570
- type: Boolean,
3571
- reflect: true,
3572
- },
3573
-
3574
- /**
3575
- * DEPRECATED - use `appearance` instead.
3576
- */
3577
- onDark: {
3578
- type: Boolean,
3579
- reflect: true
3580
- }
3581
- };
3582
- }
3583
-
3584
- /**
3585
- * This will register this element with the browser.
3586
- * @param {string} [name="auro-helptext"] - The name of element that you want to register to.
3587
- *
3588
- * @example
3589
- * AuroCheckbox.register("custom-helptext") // this will register this element to <custom-helptext/>
3590
- *
3591
- */
3592
- static register(name = "auro-helptext") {
3593
- AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroHelpText);
3594
- }
3595
-
3596
- updated() {
3597
- this.handleSlotChange();
3598
- }
3599
-
3600
- handleSlotChange(event) {
3601
- if (event) {
3602
- this.slotNodes = event.target.assignedNodes();
3603
- }
3604
-
3605
- this.hasTextContent = this.checkSlotsForContent(this.slotNodes);
3606
- }
3607
-
3608
- /**
3609
- * Checks if any of the provided nodes or their nested slot nodes contain non-empty text content.
3610
- *
3611
- * @param {NodeList|Array} nodes - The list of nodes to check for content.
3612
- * @returns {boolean} - Returns true if any node or nested slot node contains non-empty text content, otherwise false.
3613
- * @private
3614
- */
3615
- checkSlotsForContent(nodes) {
3616
- if (!nodes) {
3617
- return false;
3618
- }
3619
-
3620
- return nodes.some((node) => {
3621
- if (node.textContent.trim()) {
3622
- return true;
3623
- }
3624
-
3625
- if (!node.querySelector) {
3626
- return false;
3627
- }
3628
-
3629
- const nestedSlot = node.tagName === 'SLOT' ? node : node.querySelector('slot');
3630
- if (!nestedSlot) {
3631
- return false;
3632
- }
3633
-
3634
- const nestedSlotNodes = nestedSlot.assignedNodes();
3635
- return this.checkSlotsForContent(nestedSlotNodes);
3636
- });
3637
- }
3638
-
3639
- // function that renders the HTML and CSS into the scope of the component
3640
- render() {
3641
- return b$1`
3642
- <div class="helptext-wrapper body-xs" ?visible="${this.hasTextContent}">
3643
- <slot @slotchange=${this.handleSlotChange}></slot>
3644
- </div>
3645
- `;
3646
- }
3647
- }
3648
-
3649
- var formkitVersion = '202603172151';
3650
-
3651
- class AuroElement extends i {
3652
- static get properties() {
3653
- return {
3654
-
3655
- /**
3656
- * Defines the language of an element.
3657
- * @default {'default'}
3658
- */
3659
- layout: {
3660
- type: String,
3661
- attribute: "layout",
3662
- reflect: true
3663
- },
3664
-
3665
- shape: {
3666
- type: String,
3667
- attribute: "shape",
3668
- reflect: true
3669
- },
3670
-
3671
- size: {
3672
- type: String,
3673
- attribute: "size",
3674
- reflect: true
3675
- },
3676
-
3677
- onDark: {
3678
- type: Boolean,
3679
- attribute: "ondark",
3680
- reflect: true
3681
- }
3682
- };
3683
- }
3684
-
3685
- /**
3686
- * Returns true if the element has focus.
3687
- * @private
3688
- * @returns {boolean} - Returns true if the element has focus.
3689
- */
3690
- get componentHasFocus() {
3691
- return this.matches(':focus') || this.matches(':focus-within');
3692
- }
3693
-
3694
- resetShapeClasses() {
3695
- const wrapper = this.shadowRoot.querySelector('.wrapper');
3696
-
3697
- if (wrapper) {
3698
- wrapper.classList.forEach((className) => {
3699
- if (className.startsWith('shape-')) {
3700
- wrapper.classList.remove(className);
3701
- }
3702
- });
3703
-
3704
- if (this.shape && this.size) {
3705
- wrapper.classList.add(`shape-${this.shape.toLowerCase()}-${this.size.toLowerCase()}`);
3706
- } else {
3707
- wrapper.classList.add('shape-none');
3708
- }
3709
- }
3710
-
3711
- }
3712
-
3713
- resetLayoutClasses() {
3714
- if (this.layout) {
3715
- const wrapper = this.shadowRoot.querySelector('.wrapper');
3716
-
3717
- if (wrapper) {
3718
- wrapper.classList.forEach((className) => {
3719
- if (className.startsWith('layout-')) {
3720
- wrapper.classList.remove(className);
3721
- }
3722
- });
3723
-
3724
- wrapper.classList.add(`layout-${this.layout.toLowerCase()}`);
3725
- }
3726
- }
3727
- }
3728
-
3729
- updateComponentArchitecture() {
3730
- this.resetLayoutClasses();
3731
- this.resetShapeClasses();
3732
- }
3733
-
3734
- updated(changedProperties) {
3735
- if (changedProperties.has('layout') || changedProperties.has('shape') || changedProperties.has('size')) {
3736
- this.updateComponentArchitecture();
3737
- }
3738
- }
3739
-
3740
- // Try to render the defined `this.layout` layout. If that fails, fall back to the default layout.
3741
- // This will catch if an invalid layout value is passed in and render the default layout if so.
3742
- render() {
3743
- try {
3744
- return this.renderLayout();
3745
- } catch (error) {
3746
- // failed to get the defined layout
3747
- console.error('Failed to get the defined layout - using the default layout', error); // eslint-disable-line no-console
3748
-
3749
- // fallback to the default layout
3750
- return this.getLayout('default');
3751
- }
3752
- }
3753
- }
3754
-
3755
- // Copyright (c) 2026 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
3756
- // See LICENSE in the project root for license information.
3757
-
3758
-
3759
- /**
3760
- * The `auro-dropdown` element provides a way to place content in a bib that can be toggled.
3761
- * @customElement auro-dropdown
3762
- *
3763
- * @slot - Default slot for the dropdown bib content.
3764
- * @slot helpText - Defines the content of the helpText.
3765
- * @slot trigger - Defines the content of the trigger.
3766
- * @csspart trigger - The trigger content container.
3767
- * @csspart chevron - The collapsed/expanded state icon container.
3768
- * @csspart size - The size of the dropdown bib. (height, width, maxHeight, maxWidth only)
3769
- * @csspart helpText - The helpText content container.
3770
- * @event auroDropdown-triggerClick - Notifies that the trigger has been clicked.
3771
- * @event auroDropdown-toggled - Notifies that the visibility of the dropdown bib has changed.
3772
- * @event auroDropdown-idAdded - Notifies consumers that the unique ID for the dropdown bib has been generated.
3773
- */
3774
- class AuroDropdown extends AuroElement {
3775
- static get shadowRootOptions() {
3776
- return {
3777
- ...AuroElement.shadowRootOptions,
3778
- delegatesFocus: true,
3779
- };
3780
- }
3781
-
3782
- constructor() {
3783
- super();
3784
-
3785
- this.isPopoverVisible = false;
3786
- this.isBibFullscreen = false;
3787
- this.matchWidth = false;
3788
- this.noHideOnThisFocusLoss = false;
3789
-
3790
- this.errorMessage = undefined; // TODO - check with Doug if there is still more to do here
3791
-
3792
- // Layout Config
3793
- this.layout = undefined;
3794
- this.shape = undefined;
3795
- this.size = undefined;
3796
-
3797
- this.parentBorder = false;
3798
-
3799
- /** @private */
3800
- this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
3801
-
3802
- /** @private */
3803
- this.bibElement = e$2();
3804
-
3805
- this._intializeDefaults();
3806
- }
3807
-
3808
- /**
3809
- * @private
3810
- * @returns {object} Class definition for the wrapper element.
3811
- */
3812
- get commonWrapperClasses() {
3813
- return {
3814
- 'trigger': true,
3815
- 'wrapper': true,
3816
- 'hasFocus': this.hasFocus,
3817
- 'simple': this.simple,
3818
- 'parentBorder': this.parentBorder
3819
- };
3820
- }
3821
-
3822
- /**
3823
- * @private
3824
- * @returns {void} Internal defaults.
3825
- */
3826
- _intializeDefaults() {
3827
- this.appearance = 'default';
3828
- this.chevron = false;
3829
- this.disabled = false;
3830
- this.disableFocusTrap = false;
3831
- this.error = false;
3832
- this.tabIndex = 0;
3833
- this.noToggle = false;
3834
- this.a11yRole = 'button';
3835
- this.onDark = false;
3836
- this.showTriggerBorders = true;
3837
- this.triggerContentFocusable = false;
3838
- this.simple = false;
3839
-
3840
- // floaterConfig
3841
- this.placement = 'bottom-start';
3842
- this.offset = 0;
3843
- this.noFlip = false;
3844
- this.shift = false;
3845
- this.autoPlacement = false;
3846
-
3847
- /**
3848
- * @private
3849
- */
3850
- this.hasTriggerContent = false;
3851
-
3852
- /**
3853
- * @private
3854
- */
3855
- this.triggerContentSlot = undefined;
3856
-
3857
- /**
3858
- * @private
3859
- */
3860
- this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
3861
-
3862
- /**
3863
- * @private
3864
- */
3865
- this.floater = new AuroFloatingUI();
3866
-
3867
- /**
3868
- * Generate unique names for dependency components.
3869
- */
3870
- const versioning = new AuroDependencyVersioning();
3871
-
3872
- /**
3873
- * @private
3874
- */
3875
- this.iconTag = versioning.generateTag('auro-formkit-dropdown-icon', iconVersion, _);
3876
-
3877
- /**
3878
- * @private
3879
- */
3880
- this.dropdownBibTag = versioning.generateTag('auro-formkit-dropdown-dropdownbib', formkitVersion, AuroDropdownBib);
3881
-
3882
- /**
3883
- * @private
3884
- */
3885
- this.helpTextTag = versioning.generateTag('auro-formkit-dropdown-helptext', formkitVersion, AuroHelpText);
3886
-
3887
- /**
3888
- * @private
3889
- */
3890
- this.bindFocusEventToTrigger = this.bindFocusEventToTrigger.bind(this);
3891
- }
3892
-
3893
- /**
3894
- * @ignore
3895
- */
3896
- get floaterConfig() {
3897
- return {
3898
- placement: this.placement,
3899
- flip: !this.noFlip,
3900
- shift: this.shift,
3901
- autoPlacement: this.autoPlacement,
3902
- offset: this.offset,
3903
- };
3904
- }
3905
-
3906
- /**
3907
- * Public method to hide the dropdown.
3908
- * @returns {void}
3909
- */
3910
- hide() {
3911
- this.floater.hideBib();
3912
- }
3913
-
3914
- /**
3915
- * Public method to show the dropdown.
3916
- * @returns {void}
3917
- */
3918
- show() {
3919
- this.floater.showBib();
3920
-
3921
- // Open dialog synchronously so callers remain in the user gesture
3922
- // chain. This is critical for mobile browsers (iOS Safari) to keep
3923
- // the virtual keyboard open when transitioning from the trigger
3924
- // input to an input inside the fullscreen dialog. Without this,
3925
- // showModal() fires asynchronously via Lit's update cycle, which
3926
- // falls outside the user activation window and causes iOS to
3927
- // dismiss the keyboard.
3928
- if (this.isBibFullscreen && this.bibElement && this.bibElement.value) {
3929
- const useModal = !this.disableFocusTrap;
3930
- this.bibElement.value.open(useModal);
3931
- }
3932
- }
3933
-
3934
- /**
3935
- * When bib is open, focus on the first element inside of bib.
3936
- * If not, trigger element will get focus.
3937
- */
3938
- focus() {
3939
- if (this.isPopoverVisible && this.bibContent) {
3940
- const focusables = getFocusableElements(this.bibContent);
3941
- if (focusables.length > 0) {
3942
- focusables[0].focus();
3943
- }
3944
- } else {
3945
- this.trigger.focus();
3946
- }
3947
- }
3948
-
3949
- /**
3950
- * Sets the active descendant element for accessibility.
3951
- * Uses ariaActiveDescendantElement to cross shadow DOM boundaries.
3952
- * This function is used in components that contain `auro-dropdown` to set the active descendant.
3953
- * @private
3954
- * @param {HTMLElement|null} element - The element to set as the active descendant, or null to clear.
3955
- * @returns {void}
3956
- */
3957
- setActiveDescendant(element) {
3958
- if (!this.trigger) {
3959
- return;
3960
- }
3961
-
3962
- if (element) {
3963
- this.trigger.ariaActiveDescendantElement = element;
3964
- } else {
3965
- this.trigger.ariaActiveDescendantElement = null;
3966
- this.trigger.removeAttribute('aria-activedescendant');
3967
- }
3968
- }
3969
-
3970
- // function to define props used within the scope of this component
3971
- static get properties() {
3972
- return {
3973
-
3974
- /**
3975
- * The value for the role attribute of the trigger element.
3976
- */
3977
- a11yRole: {
3978
- type: String,
3979
- attribute: false,
3980
- reflect: false
3981
- },
3982
-
3983
- /**
3984
- * Defines whether the component will be on lighter or darker backgrounds.
3985
- * @type {'default' | 'inverse'}
3986
- * @default 'default'
3987
- */
3988
- appearance: {
3989
- type: String,
3990
- reflect: true
3991
- },
3992
-
3993
- /**
3994
- * If declared, bib's position will be automatically calculated where to appear.
3995
- */
3996
- autoPlacement: {
3997
- type: Boolean,
3998
- reflect: true
3999
- },
4000
-
4001
- /**
4002
- * If declared, the dropdown will only show by calling the API .show() public method.
4003
- */
4004
- disableEventShow: {
4005
- type: Boolean,
4006
- reflect: true
4007
- },
4008
-
4009
- /**
4010
- * If declared, applies a border around the trigger slot.
4011
- */
4012
- simple: {
4013
- type: Boolean,
4014
- reflect: true
4015
- },
4016
-
4017
- /**
4018
- * If declared, the dropdown displays a chevron on the right.
4019
- */
4020
- chevron: {
4021
- type: Boolean,
4022
- reflect: true,
4023
- attribute: 'chevron'
4024
- },
4025
-
4026
- /**
4027
- * If declared, the dropdown is not interactive.
4028
- */
4029
- disabled: {
4030
- type: Boolean,
4031
- reflect: true
4032
- },
4033
-
4034
- /**
4035
- * If declared, the focus trap inside of bib will be turned off.
4036
- */
4037
- disableFocusTrap: {
4038
- type: Boolean,
4039
- reflect: true
4040
- },
4041
-
4042
- /**
4043
- * @private
4044
- */
4045
- dropdownWidth: {
4046
- type: Number
4047
- },
4048
-
4049
- /**
4050
- * The unique ID for the dropdown bib element.
4051
- * @private
4052
- */
4053
- dropdownId: {
4054
- type: String,
4055
- reflect: false,
4056
- attribute: false
4057
- },
4058
-
4059
- /**
4060
- * If declared, will apply error UI to the dropdown.
4061
- */
4062
- error: {
4063
- type: Boolean,
4064
- reflect: true
4065
- },
4066
-
4067
- /**
4068
- * Contains the help text message for the current validity error.
4069
- */
4070
- errorMessage: {
4071
- type: String
4072
- },
4073
-
4074
- /**
4075
- * If declared, the bib will display when focus is applied to the trigger.
4076
- */
4077
- focusShow: {
4078
- type: Boolean,
4079
- reflect: true
4080
- },
4081
-
4082
- /**
4083
- * If true, the dropdown bib is displayed.
4084
- */
4085
- isPopoverVisible: {
4086
- type: Boolean,
4087
- reflect: true,
4088
- attribute: 'open'
4089
- },
4090
-
4091
- /**
4092
- * If true, the dropdown bib is taking the fullscreen when it's open.
4093
- */
4094
- isBibFullscreen: {
4095
- type: Boolean,
4096
- reflect: true
4097
- },
4098
-
4099
- /**
4100
- * If declared, the trigger will toggle the dropdown on mouseover/mouseout.
4101
- */
4102
- hoverToggle: {
4103
- type: Boolean,
4104
- reflect: true
4105
- },
4106
-
4107
- /**
4108
- * @private
4109
- */
4110
- hasTriggerContent: {
4111
- type: Boolean
4112
- },
4113
-
4114
- /**
4115
- * Defines the screen size breakpoint at which the dropdown switches to fullscreen mode on mobile. `disabled` indicates a dropdown should _never_ enter fullscreen.
4116
- *
4117
- * When expanded, the dropdown will automatically display in fullscreen mode
4118
- * if the screen size is equal to or smaller than the selected breakpoint.
4119
- * @type {'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'disabled'}
4120
- * @default 'sm'
4121
- */
4122
- fullscreenBreakpoint: {
4123
- type: String,
4124
- reflect: true
4125
- },
4126
-
4127
- /**
4128
- * Sets the layout of the dropdown.
4129
- * @type {'classic' | 'emphasized' | 'snowflake'}
4130
- * @default 'classic'
4131
- */
4132
- layout: {
4133
- type: String,
4134
- reflect: true
4135
- },
4136
-
4137
- /**
4138
- * Defines if the trigger should size based on the parent element providing the border UI.
4139
- * @private
4140
- */
4141
- parentBorder: {
4142
- type: Boolean,
4143
- reflect: true
4144
- },
4145
-
4146
- /**
4147
- * If declared, the popover and trigger will be set to the same width.
4148
- */
4149
- matchWidth: {
4150
- type: Boolean,
4151
- reflect: true
4152
- },
4153
-
4154
- /**
4155
- * If declared, the bib will NOT flip to an alternate position
4156
- * when there isn't enough space in the specified `placement`.
4157
- */
4158
- noFlip: {
4159
- type: Boolean,
4160
- reflect: true
4161
- },
4162
-
4163
- /**
4164
- * If declared, the dropdown will shift its position to avoid being cut off by the viewport.
4165
- */
4166
- shift: {
4167
- type: Boolean,
4168
- reflect: true
4169
- },
4170
-
4171
- /**
4172
- * If declared, the dropdown will not hide when moving focus outside the element.
4173
- */
4174
- noHideOnThisFocusLoss: {
4175
- type: Boolean,
4176
- reflect: true
4177
- },
4178
-
4179
- /**
4180
- * If declared, the trigger will only show the dropdown bib.
4181
- */
4182
- noToggle: {
4183
- type: Boolean,
4184
- reflect: true
4185
- },
4186
-
4187
- /**
4188
- * Gap between the trigger element and bib.
4189
- * @default 0
4190
- */
4191
- offset: {
4192
- type: Number,
4193
- reflect: true
4194
- },
4195
-
4196
- /**
4197
- * DEPRECATED - use `appearance="inverse"` instead.
4198
- */
4199
- onDark: {
4200
- type: Boolean,
4201
- reflect: true
4202
- },
4203
-
4204
- /**
4205
- * If declared, and a function is set, that function will execute when the slot content is updated.
4206
- */
4207
- onSlotChange: {
4208
- type: Function,
4209
- reflect: false
4210
- },
4211
-
4212
- /**
4213
- * Position where the bib should appear relative to the trigger.
4214
- * @type {'top' | 'right' | 'bottom' | 'left' | 'bottom-start' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-end' | 'left-start' | 'left-end'}
4215
- * @default 'bottom-start'
4216
- */
4217
- placement: {
4218
- type: String,
4219
- reflect: true
4220
- },
4221
-
4222
- /**
4223
- * @private
4224
- */
4225
- tabIndex: {
4226
- type: Number
4227
- },
4228
-
4229
- /**
4230
- * Accessible label for the dropdown bib dialog element.
4231
- * @private
4232
- */
4233
- bibDialogLabel: {
4234
- type: String,
4235
- attribute: false,
4236
- reflect: false
4237
- }
4238
- };
4239
- }
4240
-
4241
- static get styles() {
4242
- return [
4243
- styleCss$1,
4244
- tokensCss$1,
4245
- colorCss$1,
4246
-
4247
- // default layout
4248
- classicColorCss,
4249
- classicLayoutCss,
4250
-
4251
- // emphasized layout
4252
- styleEmphasizedCss,
4253
-
4254
- // snowflake layout
4255
- styleSnowflakeCss,
4256
-
4257
- shapeSizeCss
4258
- ];
4259
- }
4260
-
4261
- /**
4262
- * This will register this element with the browser.
4263
- * @param {string} [name="auro-dropdown"] - The name of the element that you want to register.
4264
- *
4265
- * @example
4266
- * AuroDropdown.register("custom-dropdown") // this will register this element to <custom-dropdown/>
4267
- *
4268
- */
4269
- static register(name = "auro-dropdown") {
4270
- AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroDropdown);
4271
- }
4272
-
4273
- /**
4274
- * Accessor for reusing the focusable entity query string.
4275
- * @private
4276
- * @returns {string}
4277
- */
4278
- get focusableEntityQuery () {
4279
- return 'auro-input, [auro-input], auro-button, [auro-button], button, input';
4280
- }
4281
-
4282
- connectedCallback() {
4283
- super.connectedCallback();
4284
- }
4285
-
4286
- disconnectedCallback() {
4287
- super.disconnectedCallback();
4288
- if (this.floater) {
4289
- this.floater.hideBib('disconnect');
4290
- this.floater.disconnect();
4291
- }
4292
- this.clearTriggerFocusEventBinding();
4293
- }
4294
-
4295
- updated(changedProperties) {
4296
- super.updated(changedProperties);
4297
- this.floater.handleUpdate(changedProperties);
4298
-
4299
- // Note: `disabled` is not a breakpoint (it is not a screen size),
4300
- // so it looks like we never consume this - however, dropdownBib handles this in the setter as "undefined"
4301
- if (changedProperties.has('fullscreenBreakpoint')) {
4302
- this.bibContent.mobileFullscreenBreakpoint = this.fullscreenBreakpoint;
4303
- }
4304
-
4305
- // when trigger's content is changed without any attribute or node change,
4306
- // `requestUpdate` needs to be called to update hasTriggerContent
4307
- if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
4308
- this.handleTriggerContentSlotChange();
4309
- }
4310
-
4311
- if (changedProperties.has('isPopoverVisible') && this.bibElement.value) {
4312
- if (this.isPopoverVisible) {
4313
- // Fullscreen: use showModal() for native accessibility (inert outside, focus trap)
4314
- // Desktop: use show() for Floating UI positioning + FocusTrap for focus management
4315
- const useModal = this.isBibFullscreen && !this.disableFocusTrap;
4316
- this.bibElement.value.open(useModal);
4317
- } else {
4318
- this.bibElement.value.close();
4319
- }
4320
- }
4321
-
4322
- // When fullscreen strategy changes while open, re-open dialog with correct mode
4323
- // (e.g. resizing from desktop → mobile while dropdown is open)
4324
- if (changedProperties.has('isBibFullscreen') && this.isPopoverVisible && this.bibElement.value) {
4325
- const useModal = this.isBibFullscreen && !this.disableFocusTrap;
4326
- this.bibElement.value.close();
4327
- this.bibElement.value.open(useModal);
4328
- }
4329
- }
4330
-
4331
- /**
4332
- * Handles the custom event `auroDropdown-toggled` to update the visibility of the dropdown bib.
4333
- * @private
4334
- * @param {CustomEvent} event - The custom event that contains the dropdown toggle information.
4335
- */
4336
- handleDropdownToggle(event) {
4337
- this.updateFocusTrap();
4338
- this.isPopoverVisible = event.detail.expanded;
4339
- const eventType = event.detail.eventType || "unknown";
4340
- if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
4341
- this.trigger.focus();
4342
- }
4343
- }
4344
-
4345
- firstUpdated() {
4346
- // Configure the floater to, this will generate the ID for the bib
4347
- this.floater.configure(this, 'auroDropdown');
4348
-
4349
- // Prevent `contain: layout` on the dropdown host. Layout containment
4350
- // creates a containing block for position:fixed descendants (the bib),
4351
- // which clips the bib inside ancestor overflow contexts such as a
4352
- // <dialog> element. Without it, the bib's position:fixed is relative
4353
- // to the viewport, letting Floating UI's flip middleware detect
4354
- // viewport boundaries and the bib escape overflow clipping.
4355
- const origConfigureBibStrategy = this.floater.configureBibStrategy.bind(this.floater);
4356
- this.floater.configureBibStrategy = (value) => {
4357
- origConfigureBibStrategy(value);
4358
- this.style.contain = '';
4359
- };
4360
-
4361
- this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
4362
-
4363
- // Handle ESC key from dialog's cancel event
4364
- this.addEventListener('auro-bib-cancel', () => {
4365
- this.floater.hideBib('keydown');
4366
- });
4367
-
4368
- /**
4369
- * @description Let subscribers know that the dropdown ID ha been generated and added.
4370
- * @event auroDropdown-idAdded
4371
- * @type {Object<key: 'id', value: string>} - The ID of the dropdown bib element.
4372
- */
4373
- this.dispatchEvent(new CustomEvent('auroDropdown-idAdded', {detail: {id: this.floater.element.id}}));
4374
-
4375
- // Set the bib ID locally for aria-controls (must be in the same shadow root as the trigger)
4376
- if (!this.triggerContentFocusable) {
4377
- this.dropdownId = this.floater.element.bib.id;
4378
- }
4379
-
4380
- this.bibContent = this.floater.element.bib;
4381
-
4382
- // Add the tag name as an attribute if it is different than the component name
4383
- this.runtimeUtils.handleComponentTagRename(this, 'auro-dropdown');
4384
-
4385
- this.trigger.addEventListener('click', () => {
4386
- this.dispatchEvent(new CustomEvent('auroDropdown-triggerClick', {
4387
- bubbles: true,
4388
- composed: true
4389
- }));
4390
- });
4391
- }
4392
-
4393
- /**
4394
- * Exposes CSS parts for styling from parent components.
4395
- * @returns {void}
4396
- */
4397
- exposeCssParts() {
4398
- this.setAttribute('exportparts', 'trigger:dropdownTrigger, chevron:dropdownChevron, helpText:dropdownHelpText, size:dropdownSize');
4399
- }
4400
-
4401
- /**
4402
- * Determines if content is within a custom slot.
4403
- * @private
4404
- * @param {HTMLElement} element - The element to check.
4405
- * @returns {Boolean}
4406
- */
4407
- isCustomSlotContent(element) {
4408
- let currentElement = element;
4409
-
4410
- let inCustomSlot = false;
4411
-
4412
- while (currentElement) {
4413
- currentElement = currentElement.parentElement;
4414
-
4415
- if (currentElement && currentElement.hasAttribute('slot')) {
4416
- inCustomSlot = true;
4417
- break;
4418
- }
4419
- }
4420
-
4421
- return inCustomSlot;
4422
- }
4423
-
4424
- /**
4425
- * Function to support @focusin event.
4426
- * @private
4427
- * @return {void}
4428
- */
4429
- handleFocusin() {
4430
- this.hasFocus = true;
4431
- }
4432
-
4433
- /**
4434
- * @private
4435
- */
4436
- updateFocusTrap() {
4437
- if (this.isPopoverVisible && !this.disableFocusTrap) {
4438
- if (!this.isBibFullscreen) {
4439
- // Desktop: show() doesn't trap focus, so use FocusTrap
4440
- this.focusTrap = new FocusTrap(this.bibContent);
4441
- this.focusTrap.focusFirstElement();
4442
- }
4443
- // Fullscreen: showModal() provides native focus trapping
4444
- return;
4445
- }
4446
-
4447
- if (this.focusTrap) {
4448
- this.focusTrap.disconnect();
4449
- this.focusTrap = undefined;
4450
- }
4451
- }
4452
-
4453
- /**
4454
- * Function to support @focusout event.
4455
- * @private
4456
- * @return {void}
4457
- */
4458
- handleFocusout() {
4459
- this.hasFocus = false;
4460
- }
4461
-
4462
- /**
4463
- * Creates and dispatches a duplicate focus event on the trigger element.
4464
- * @private
4465
- * @param {Event} event - The original focus event.
4466
- */
4467
- bindFocusEventToTrigger(event) {
4468
- const dupEvent = new FocusEvent(event.type, {
4469
- bubbles: false,
4470
- cancelable: false,
4471
- composed: true,
4472
- });
4473
- this.trigger.dispatchEvent(dupEvent);
4474
- }
4475
-
4476
- /**
4477
- * Sets up event listeners to deliver focus and blur events from nested Auro components within the trigger slot to trigger.
4478
- * This ensures that focus/blur events originating from within these components are propagated to the trigger element itself.
4479
- * @private
4480
- */
4481
- setupTriggerFocusEventBinding() {
4482
- if (!this.triggerContentSlot || this.triggerContentSlot.length === 0) {
4483
- return;
4484
- }
4485
-
4486
- this.triggerContentSlot.forEach((node) => {
4487
- if (node.querySelectorAll) {
4488
- const auroElements = node.querySelectorAll(this.focusableEntityQuery);
4489
- auroElements.forEach((auroEl) => {
4490
- auroEl.addEventListener('focus', this.bindFocusEventToTrigger);
4491
- auroEl.addEventListener('blur', this.bindFocusEventToTrigger);
4492
- });
4493
- }
4494
- });
4495
- }
4496
-
4497
- /**
4498
- * Clears focus and blur event listeners from nested Auro components within the trigger slot.
4499
- * @private
4500
- * @returns {void}
4501
- */
4502
- clearTriggerFocusEventBinding() {
4503
- if (!this.triggerContentSlot || this.triggerContentSlot.length === 0) {
4504
- return;
4505
- }
4506
-
4507
- this.triggerContentSlot.forEach((node) => {
4508
- if (node.querySelectorAll) {
4509
- const auroElements = node.querySelectorAll(this.focusableEntityQuery);
4510
- auroElements.forEach((auroEl) => {
4511
- auroEl.removeEventListener('focus', this.bindFocusEventToTrigger);
4512
- auroEl.removeEventListener('blur', this.bindFocusEventToTrigger);
4513
- });
4514
- }
4515
- });
4516
- }
4517
-
4518
- /*
4519
- * Sets aria attributes for the trigger element if a custom one is passed in.
4520
- * @private
4521
- * @method setTriggerAriaAttributes
4522
- * @param { HTMLElement } triggerElement - The custom trigger element.
4523
- */
4524
- clearTriggerA11yAttributes(triggerElement) {
4525
-
4526
- if (!triggerElement || !triggerElement.removeAttribute) {
4527
- return;
4528
- }
4529
-
4530
- // Reset appropriate attributes for a11y
4531
- triggerElement.removeAttribute('aria-labelledby');
4532
- if (triggerElement.getAttribute('id') === `${this.id}-trigger-element`) {
4533
- triggerElement.removeAttribute('id');
4534
- }
4535
- triggerElement.removeAttribute('role');
4536
- triggerElement.removeAttribute('aria-expanded');
4537
-
4538
- triggerElement.removeAttribute('aria-controls');
4539
- triggerElement.removeAttribute('aria-autocomplete');
4540
- }
4541
-
4542
- /**
4543
- * Handles changes to the trigger content slot and updates related properties.
4544
- *
4545
- * It first updates the floater settings
4546
- * Then, it retrieves the assigned nodes from the event target and checks if any of
4547
- * the nodes contain non-empty text content, updating the `hasTriggerContent` property accordingly.
4548
- *
4549
- * @private
4550
- * @method handleTriggerContentSlotChange
4551
- * @param {Event} event - Native slotchange event.
4552
- * @returns {void}
4553
- */
4554
- handleTriggerContentSlotChange(event) {
4555
- this.floater.handleTriggerTabIndex();
4556
-
4557
- // Get the trigger
4558
- const trigger = this.shadowRoot.querySelector('#trigger');
4559
-
4560
- // Get the trigger slot
4561
- const triggerSlot = this.shadowRoot.querySelector('.triggerContentWrapper slot');
4562
-
4563
- // If there's a trigger slot
4564
- if (triggerSlot) {
4565
-
4566
- // Get the content nodes to see if there are any children
4567
- const triggerContentNodes = triggerSlot.assignedNodes();
4568
-
4569
- // If there are children
4570
- if (triggerContentNodes) {
4571
-
4572
- // See if any of them are focusable elements
4573
- this.triggerContentFocusable = triggerContentNodes.some((node) => getFocusableElements(node).length > 0);
4574
-
4575
- // If any of them are focusable elements
4576
- if (this.triggerContentFocusable) {
4577
-
4578
- // Assume the consumer will be providing their own a11y in whatever they passed in
4579
- this.clearTriggerA11yAttributes(trigger);
4580
-
4581
- // Remove the tabindex from the trigger so it doesn't interrupt focus flow
4582
- trigger.removeAttribute('tabindex');
4583
- } else {
4584
-
4585
- // Add the tabindex to the trigger so that it's in the focus flow
4586
- trigger.setAttribute('tabindex', '0');
4587
- }
4588
- }
4589
- }
4590
-
4591
- if (event) {
4592
- // Wrap in a try-catch block to handle errors when trying to use assignedNodes from the NodeJS test environment.
4593
- try {
4594
- this.triggerNode = event.target;
4595
- this.triggerContentSlot = event.target.assignedNodes();
4596
- } catch (error) {
4597
- console.warn('auro-dropdown: Unable to access the trigger content slot.', error); // eslint-disable-line no-console
4598
- }
4599
- }
4600
-
4601
- if (this.triggerContentSlot) {
4602
- this.setupTriggerFocusEventBinding();
4603
-
4604
- this.hasTriggerContent = this.triggerContentSlot.some((slot) => {
4605
- if (slot.textContent.trim()) {
4606
- return true;
4607
- }
4608
- const slotInSlot = slot.querySelector('slot');
4609
- if (!slotInSlot) {
4610
- return false;
4611
- }
4612
- const slotsInSlotNodes = slotInSlot.assignedNodes();
4613
- return slotsInSlotNodes.some((ss) => Boolean(ss.textContent.trim()));
4614
- });
4615
- } else {
4616
- this.hasTriggerContent = false;
4617
- }
4618
- }
4619
-
4620
- /**
4621
- * Handles the default slot change event and updates the content.
4622
- *
4623
- * This method retrieves all nodes assigned to the default slot of the event target and appends them
4624
- * to the `bibContent` element. If a callback function `onSlotChange` is defined, it is invoked to
4625
- * notify about the slot change.
4626
- *
4627
- * @private
4628
- * @method handleDefaultSlot
4629
- * @fires Function#onSlotChange - Optional callback invoked when the slot content changes.
4630
- */
4631
- handleDefaultSlot() {
4632
-
4633
- if (this.onSlotChange) {
4634
- this.onSlotChange();
4635
- }
4636
- }
4637
-
4638
- /**
4639
- * Returns HTML for the common portion of the layouts.
4640
- * @private
4641
- * @param {Object} helpTextClasses - Classes to apply to the help text container.
4642
- * @returns {html} - Returns HTML.
4643
- */
4644
- renderBasicHtml(helpTextClasses) {
4645
- return u$2`
4646
- <div>
4647
- <div
4648
- id="trigger"
4649
- class="${e$3(this.commonWrapperClasses)}" part="wrapper"
4650
- tabindex="${o(this.triggerContentFocusable ? undefined : this.tabIndex)}"
4651
- role="${o(this.triggerContentFocusable ? undefined : this.a11yRole)}"
4652
- aria-expanded="${o(this.a11yRole === 'button' || this.triggerContentFocusable ? undefined : this.isPopoverVisible)}"
4653
- aria-controls="${o(this.a11yRole === 'button' || this.triggerContentFocusable ? undefined : this.dropdownId)}"
4654
- aria-labelledby="${o(this.triggerContentFocusable ? undefined : 'triggerLabel')}"
4655
- @focusin="${this.handleFocusin}"
4656
- @blur="${this.handleFocusOut}">
4657
- <div class="triggerContentWrapper" id="triggerLabel">
4658
- <slot
4659
- name="trigger"
4660
- @slotchange="${this.handleTriggerContentSlotChange}"></slot>
4661
- </div>
4662
- ${this.chevron ? u$2`
4663
- <div
4664
- id="showStateIcon"
4665
- class="chevron"
4666
- part="chevron"
4667
- aria-hidden="true">
4668
- <${this.iconTag}
4669
- category="interface"
4670
- name="${this.isPopoverVisible ? 'chevron-up' : `chevron-down`}"
4671
- appearance="${this.onDark ? 'inverse' : this.appearance}"
4672
- variant="${this.disabled ? 'disabled' : 'muted'}"
4673
- ariaHidden="true">
4674
- </${this.iconTag}>
4675
- </div>
4676
- ` : undefined }
4677
- </div>
4678
- <div class="${e$3(helpTextClasses)}">
4679
- <slot name="helpText"></slot>
4680
- </div>
4681
- <div id="bibSizer" part="size"></div>
4682
- <${this.dropdownBibTag}
4683
- id="bib"
4684
- shape="${this.shape}"
4685
- ?data-show="${this.isPopoverVisible}"
4686
- ?isfullscreen="${this.isBibFullscreen}"
4687
- .dialogLabel="${this.bibDialogLabel}"
4688
- ${n$2(this.bibElement)}
4689
- >
4690
- <div class="slotContent">
4691
- <slot @slotchange="${this.handleDefaultSlot}"></slot>
4692
- </div>
4693
- </${this.dropdownBibTag}>
4694
- </div>
4695
- `;
4696
- }
4697
-
4698
- /**
4699
- * Returns HTML for the classic layout. Does not support type="*".
4700
- * @private
4701
- * @returns {html} - Returns HTML for the classic layout.
4702
- */
4703
- renderLayoutClassic() {
4704
- // TODO: check with Doug why this was never used?
4705
- const helpTextClasses = {
4706
- 'helpText': true
4707
- };
4708
-
4709
- return u$2`
4710
- ${this.renderBasicHtml(helpTextClasses)}
4711
- `;
4712
- }
4713
-
4714
- /**
4715
- * Returns HTML for the snowflake layout. Does not support type="*".
4716
- * @private
4717
- * @returns {html} - Returns HTML for the snowflake layout.
4718
- */
4719
- renderLayoutSnowflake() {
4720
- const helpTextClasses = {
4721
- 'helpText': true,
4722
- 'leftIndent': true,
4723
- 'rightIndent': true
4724
- };
4725
-
4726
- return u$2`
4727
- ${this.renderBasicHtml(helpTextClasses)}
4728
- `;
4729
- }
4730
-
4731
- /**
4732
- * Returns HTML for the emphasized layout. Does not support type="*".
4733
- * @private
4734
- * @returns {html} - Returns HTML for the emphasized layout.
4735
- */
4736
- renderLayoutEmphasized() {
4737
- const helpTextClasses = {
4738
- 'helpText': true,
4739
- 'leftIndent': this.shape.toLowerCase().includes('pill') && !this.shape.toLowerCase().includes('right'),
4740
- 'rightIndent': this.shape.toLowerCase().includes('pill') && !this.shape.toLowerCase().includes('left')
4741
- };
4742
-
4743
- return u$2`
4744
- ${this.renderBasicHtml(helpTextClasses)}
4745
- `;
4746
- }
4747
-
4748
- /**
4749
- * Logic to determine the layout of the component.
4750
- * @private
4751
- * @param {string} [ForcedLayout] - Used to force a specific layout, pass in the layout name to use.
4752
- * @returns {HTMLCollection} - Returns the HTML for the layout.
4753
- */
4754
- renderLayout(ForcedLayout) {
4755
- const layout = ForcedLayout || this.layout;
4756
-
4757
- switch (layout) {
4758
- case 'emphasized':
4759
- return this.renderLayoutEmphasized();
4760
- case 'emphasized-left':
4761
- return this.renderLayoutEmphasized();
4762
- case 'emphasized-right':
4763
- return this.renderLayoutEmphasized();
4764
- case 'snowflake':
4765
- return this.renderLayoutSnowflake();
4766
- case 'snowflake-left':
4767
- return this.renderLayoutSnowflake();
4768
- case 'snowflake-right':
4769
- return this.renderLayoutSnowflake();
4770
- default:
4771
- return this.renderLayoutClassic();
4772
- }
4773
- }
4774
- }
4775
-
4776
- /* eslint-disable jsdoc/require-jsdoc, no-magic-numbers, no-param-reassign */
4777
-
4778
- AuroDropdown.register();
4779
- AuroDropdown.register('custom-dropdown');
4780
-
4781
- function initExamples() {
4782
- // javascript example function calls to be added here upon creation to test examples
4783
- classicExample();
4784
- classicInverseExample();
4785
- customExample();
4786
- }
4787
-
4788
- export { initExamples };