@aurodesignsystem-dev/auro-formkit 0.0.0-pr1413.2 → 0.0.0-pr1420.0

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