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

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/components/bibtemplate/dist/auro-bibtemplate.d.ts +66 -0
  2. package/components/bibtemplate/dist/buttonVersion.d.ts +2 -0
  3. package/components/bibtemplate/dist/headerVersion.d.ts +2 -0
  4. package/components/bibtemplate/dist/iconVersion.d.ts +2 -0
  5. package/components/bibtemplate/dist/index.d.ts +2 -0
  6. package/components/bibtemplate/dist/index.js +395 -0
  7. package/components/bibtemplate/dist/registered.js +395 -0
  8. package/components/bibtemplate/dist/styles/color-css.d.ts +2 -0
  9. package/components/bibtemplate/dist/styles/style-css.d.ts +2 -0
  10. package/components/bibtemplate/dist/styles/tokens-css.d.ts +2 -0
  11. package/components/checkbox/demo/api.md +489 -0
  12. package/components/checkbox/demo/api.min.js +2133 -0
  13. package/components/checkbox/demo/index.md +55 -0
  14. package/components/checkbox/demo/index.min.js +2108 -0
  15. package/components/checkbox/demo/keyboardBehavior.md +0 -0
  16. package/components/checkbox/demo/readme.md +142 -0
  17. package/components/checkbox/dist/auro-checkbox-group.d.ts +176 -0
  18. package/components/checkbox/dist/auro-checkbox.d.ts +209 -0
  19. package/components/checkbox/dist/index.d.ts +3 -0
  20. package/components/checkbox/dist/index.js +2057 -0
  21. package/components/checkbox/dist/registered.js +2058 -0
  22. package/components/checkbox/dist/styles/auro-checkbox-css.d.ts +2 -0
  23. package/components/checkbox/dist/styles/auro-checkbox-group-css.d.ts +2 -0
  24. package/components/checkbox/dist/styles/color-css.d.ts +2 -0
  25. package/components/checkbox/dist/styles/colorGroup-css.d.ts +2 -0
  26. package/components/checkbox/dist/styles/tokens-css.d.ts +2 -0
  27. package/components/combobox/demo/api.md +2287 -0
  28. package/components/combobox/demo/api.min.js +18025 -0
  29. package/components/combobox/demo/index.md +196 -0
  30. package/components/combobox/demo/index.min.js +17930 -0
  31. package/components/combobox/demo/keyboardBehavior.md +281 -0
  32. package/components/combobox/demo/readme.md +158 -0
  33. package/components/combobox/dist/auro-combobox.d.ts +578 -0
  34. package/components/combobox/dist/comboboxKeyboardStrategy.d.ts +9 -0
  35. package/components/combobox/dist/index.d.ts +2 -0
  36. package/components/combobox/dist/index.js +15845 -0
  37. package/components/combobox/dist/registered.js +15847 -0
  38. package/components/combobox/dist/styles/emphasized/style-css.d.ts +2 -0
  39. package/components/combobox/dist/styles/snowflake/style-css.d.ts +2 -0
  40. package/components/combobox/dist/styles/style-css.d.ts +2 -0
  41. package/components/counter/demo/api.md +1285 -0
  42. package/components/counter/demo/api.min.js +8237 -0
  43. package/components/counter/demo/index.md +92 -0
  44. package/components/counter/demo/index.min.js +8218 -0
  45. package/components/counter/demo/keyboardBehavior.md +127 -0
  46. package/components/counter/demo/readme.md +161 -0
  47. package/components/counter/dist/auro-counter-button.d.ts +14 -0
  48. package/components/counter/dist/auro-counter-group.d.ts +390 -0
  49. package/components/counter/dist/auro-counter-wrapper.d.ts +17 -0
  50. package/components/counter/dist/auro-counter.d.ts +136 -0
  51. package/components/counter/dist/buttonVersion.d.ts +2 -0
  52. package/components/counter/dist/iconVersion.d.ts +2 -0
  53. package/components/counter/dist/index.d.ts +3 -0
  54. package/components/counter/dist/index.js +8140 -0
  55. package/components/counter/dist/keyboardStrategy.d.ts +4 -0
  56. package/components/counter/dist/registered.js +8141 -0
  57. package/components/counter/dist/styles/color-css.d.ts +2 -0
  58. package/components/counter/dist/styles/counter-button-color-css.d.ts +2 -0
  59. package/components/counter/dist/styles/counter-button-css.d.ts +2 -0
  60. package/components/counter/dist/styles/counter-group-css.d.ts +2 -0
  61. package/components/counter/dist/styles/counter-wrapper-color-css.d.ts +2 -0
  62. package/components/counter/dist/styles/counter-wrapper-css.d.ts +2 -0
  63. package/components/counter/dist/styles/shapeSize-css.d.ts +2 -0
  64. package/components/counter/dist/styles/style-css.d.ts +2 -0
  65. package/components/counter/dist/styles/tokens-css.d.ts +2 -0
  66. package/components/datepicker/demo/api.md +1824 -0
  67. package/components/datepicker/demo/api.min.js +24654 -0
  68. package/components/datepicker/demo/index.md +158 -0
  69. package/components/datepicker/demo/index.min.js +24375 -0
  70. package/components/datepicker/demo/keyboardBehavior.md +19 -0
  71. package/components/datepicker/demo/readme.md +137 -0
  72. package/components/datepicker/dist/auro-calendar-cell.d.ts +169 -0
  73. package/components/datepicker/dist/auro-calendar-month.d.ts +20 -0
  74. package/components/datepicker/dist/auro-calendar.d.ts +173 -0
  75. package/components/datepicker/dist/auro-datepicker.d.ts +716 -0
  76. package/components/datepicker/dist/buttonVersion.d.ts +2 -0
  77. package/components/datepicker/dist/datepickerKeyboardStrategy.d.ts +1 -0
  78. package/components/datepicker/dist/iconVersion.d.ts +2 -0
  79. package/components/datepicker/dist/index.d.ts +2 -0
  80. package/components/datepicker/dist/index.js +24290 -0
  81. package/components/datepicker/dist/popoverVersion.d.ts +2 -0
  82. package/components/datepicker/dist/registered.js +24290 -0
  83. package/components/datepicker/dist/styles/classic/color-css.d.ts +2 -0
  84. package/components/datepicker/dist/styles/classic/style-css.d.ts +2 -0
  85. package/components/datepicker/dist/styles/color-calendar-css.d.ts +2 -0
  86. package/components/datepicker/dist/styles/color-cell-css.d.ts +2 -0
  87. package/components/datepicker/dist/styles/color-css.d.ts +2 -0
  88. package/components/datepicker/dist/styles/color-month-css.d.ts +2 -0
  89. package/components/datepicker/dist/styles/shapeSize-css.d.ts +2 -0
  90. package/components/datepicker/dist/styles/snowflake/color-css.d.ts +2 -0
  91. package/components/datepicker/dist/styles/snowflake/style-css.d.ts +2 -0
  92. package/components/datepicker/dist/styles/style-auro-calendar-cell-css.d.ts +2 -0
  93. package/components/datepicker/dist/styles/style-auro-calendar-css.d.ts +2 -0
  94. package/components/datepicker/dist/styles/style-auro-calendar-month-css.d.ts +2 -0
  95. package/components/datepicker/dist/styles/style-css.d.ts +2 -0
  96. package/components/datepicker/dist/styles/tokens-css.d.ts +2 -0
  97. package/components/datepicker/dist/utilities.d.ts +78 -0
  98. package/components/datepicker/dist/utilitiesCalendar.d.ts +38 -0
  99. package/components/datepicker/dist/utilitiesCalendarRender.d.ts +50 -0
  100. package/components/datepicker/dist/vendor/wc-range-datepicker/day.d.ts +5 -0
  101. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-calendar.d.ts +60 -0
  102. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-cell.d.ts +1 -0
  103. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker.d.ts +57 -0
  104. package/components/dropdown/demo/api.md +1358 -0
  105. package/components/dropdown/demo/api.min.js +5019 -0
  106. package/components/dropdown/demo/index.md +283 -0
  107. package/components/dropdown/demo/index.min.js +4954 -0
  108. package/components/dropdown/demo/keyboardBehavior.md +77 -0
  109. package/components/dropdown/demo/readme.md +160 -0
  110. package/components/dropdown/dist/auro-dropdown.d.ts +482 -0
  111. package/components/dropdown/dist/auro-dropdownBib.d.ts +128 -0
  112. package/components/dropdown/dist/dropdownBibKeyboardStrategy.d.ts +7 -0
  113. package/components/dropdown/dist/iconVersion.d.ts +2 -0
  114. package/components/dropdown/dist/index.d.ts +2 -0
  115. package/components/dropdown/dist/index.js +4847 -0
  116. package/components/dropdown/dist/registered.js +4847 -0
  117. package/components/dropdown/dist/styles/classic/bibColors-css.d.ts +2 -0
  118. package/components/dropdown/dist/styles/classic/bibStyles-css.d.ts +2 -0
  119. package/components/dropdown/dist/styles/classic/color-css.d.ts +2 -0
  120. package/components/dropdown/dist/styles/classic/style-css.d.ts +2 -0
  121. package/components/dropdown/dist/styles/color-css.d.ts +2 -0
  122. package/components/dropdown/dist/styles/emphasized/style-css.d.ts +2 -0
  123. package/components/dropdown/dist/styles/shapeSize-css.d.ts +2 -0
  124. package/components/dropdown/dist/styles/snowflake/style-css.d.ts +2 -0
  125. package/components/dropdown/dist/styles/style-css.d.ts +2 -0
  126. package/components/dropdown/dist/styles/tokens-css.d.ts +2 -0
  127. package/components/form/demo/api.md +319 -0
  128. package/components/form/demo/api.min.js +71170 -0
  129. package/components/form/demo/index.md +128 -0
  130. package/components/form/demo/index.min.js +71170 -0
  131. package/components/form/demo/keyboardBehavior.md +0 -0
  132. package/components/form/demo/readme.md +145 -0
  133. package/components/form/dist/auro-form.d.ts +280 -0
  134. package/components/form/dist/index.d.ts +2 -0
  135. package/components/form/dist/index.js +718 -0
  136. package/components/form/dist/registered.d.ts +1 -0
  137. package/components/form/dist/registered.js +718 -0
  138. package/components/form/dist/styles/style-css.d.ts +2 -0
  139. package/components/helptext/dist/auro-helptext.d.ts +69 -0
  140. package/components/helptext/dist/index.d.ts +2 -0
  141. package/components/helptext/dist/index.js +231 -0
  142. package/components/helptext/dist/registered.js +231 -0
  143. package/components/helptext/dist/styles/color-css.d.ts +2 -0
  144. package/components/helptext/dist/styles/style-css.d.ts +2 -0
  145. package/components/helptext/dist/styles/tokens-css.d.ts +2 -0
  146. package/components/input/demo/api.md +1397 -0
  147. package/components/input/demo/api.min.js +7473 -0
  148. package/components/input/demo/index.md +161 -0
  149. package/components/input/demo/index.min.js +7393 -0
  150. package/components/input/demo/keyboardBehavior.md +0 -0
  151. package/components/input/demo/readme.md +134 -0
  152. package/components/input/dist/auro-input.d.ts +207 -0
  153. package/components/input/dist/base-input.d.ts +628 -0
  154. package/components/input/dist/buttonVersion.d.ts +2 -0
  155. package/components/input/dist/i18n.d.ts +18 -0
  156. package/components/input/dist/iconVersion.d.ts +2 -0
  157. package/components/input/dist/index.d.ts +2 -0
  158. package/components/input/dist/index.js +7305 -0
  159. package/components/input/dist/registered.js +7305 -0
  160. package/components/input/dist/styles/classic/color-css.d.ts +2 -0
  161. package/components/input/dist/styles/classic/style-css.d.ts +2 -0
  162. package/components/input/dist/styles/color-css.d.ts +2 -0
  163. package/components/input/dist/styles/default/borders-css.d.ts +2 -0
  164. package/components/input/dist/styles/default/color-css.d.ts +2 -0
  165. package/components/input/dist/styles/default/mixins-css.d.ts +2 -0
  166. package/components/input/dist/styles/default/notificationIcons-css.d.ts +2 -0
  167. package/components/input/dist/styles/default/style-css.d.ts +2 -0
  168. package/components/input/dist/styles/emphasized/color-css.d.ts +2 -0
  169. package/components/input/dist/styles/emphasized/style-css.d.ts +2 -0
  170. package/components/input/dist/styles/mixins-css.d.ts +2 -0
  171. package/components/input/dist/styles/shapeSize-css.d.ts +2 -0
  172. package/components/input/dist/styles/snowflake/style-css.d.ts +2 -0
  173. package/components/input/dist/styles/style-css.d.ts +2 -0
  174. package/components/input/dist/styles/tokens-css.d.ts +2 -0
  175. package/components/input/dist/utilities.d.ts +25 -0
  176. package/components/layoutElement/dist/auroElement.d.ts +40 -0
  177. package/components/layoutElement/dist/index.d.ts +2 -0
  178. package/components/layoutElement/dist/index.js +107 -0
  179. package/components/layoutElement/dist/registered.js +107 -0
  180. package/components/menu/demo/api.md +1201 -0
  181. package/components/menu/demo/api.min.js +2397 -0
  182. package/components/menu/demo/index.md +72 -0
  183. package/components/menu/demo/index.min.js +2290 -0
  184. package/components/menu/demo/keyboardBehavior.md +0 -0
  185. package/components/menu/demo/readme.md +145 -0
  186. package/components/menu/dist/auro-menu-utils.d.ts +34 -0
  187. package/components/menu/dist/auro-menu.context.d.ts +239 -0
  188. package/components/menu/dist/auro-menu.d.ts +317 -0
  189. package/components/menu/dist/auro-menuoption.d.ts +210 -0
  190. package/components/menu/dist/iconVersion.d.ts +2 -0
  191. package/components/menu/dist/index.d.ts +4 -0
  192. package/components/menu/dist/index.js +2253 -0
  193. package/components/menu/dist/registered.js +2201 -0
  194. package/components/menu/dist/styles/default/color-menu-css.d.ts +2 -0
  195. package/components/menu/dist/styles/default/color-menuoption-css.d.ts +2 -0
  196. package/components/menu/dist/styles/default/style-menu-css.d.ts +2 -0
  197. package/components/menu/dist/styles/default/style-menuoption-css.d.ts +2 -0
  198. package/components/menu/dist/styles/default/tokens-css.d.ts +2 -0
  199. package/components/radio/demo/api.md +675 -0
  200. package/components/radio/demo/api.min.js +2210 -0
  201. package/components/radio/demo/index.md +73 -0
  202. package/components/radio/demo/index.min.js +2167 -0
  203. package/components/radio/demo/keyboardBehavior.md +0 -0
  204. package/components/radio/demo/readme.md +141 -0
  205. package/components/radio/dist/auro-radio-group.d.ts +250 -0
  206. package/components/radio/dist/auro-radio.d.ts +180 -0
  207. package/components/radio/dist/index.d.ts +3 -0
  208. package/components/radio/dist/index.js +2116 -0
  209. package/components/radio/dist/registered.js +2117 -0
  210. package/components/radio/dist/styles/auro-radio-group-css.d.ts +2 -0
  211. package/components/radio/dist/styles/color-css.d.ts +2 -0
  212. package/components/radio/dist/styles/groupColor-css.d.ts +2 -0
  213. package/components/radio/dist/styles/style-css.d.ts +2 -0
  214. package/components/radio/dist/styles/tokens-css.d.ts +2 -0
  215. package/components/select/demo/api.md +2378 -0
  216. package/components/select/demo/api.min.js +10542 -0
  217. package/components/select/demo/index.md +355 -0
  218. package/components/select/demo/index.min.js +10449 -0
  219. package/components/select/demo/keyboardBehavior.md +245 -0
  220. package/components/select/demo/readme.md +148 -0
  221. package/components/select/dist/auro-select.d.ts +553 -0
  222. package/components/select/dist/index.d.ts +2 -0
  223. package/components/select/dist/index.js +8376 -0
  224. package/components/select/dist/registered.js +8376 -0
  225. package/components/select/dist/selectKeyboardStrategy.d.ts +11 -0
  226. package/components/select/dist/styles/emphasized/color-css.d.ts +2 -0
  227. package/components/select/dist/styles/shapeSize-css.d.ts +2 -0
  228. package/components/select/dist/styles/style-css.d.ts +2 -0
  229. package/components/select/dist/styles/tokens-css.d.ts +2 -0
  230. package/custom-elements.json +18806 -0
  231. package/package.json +2 -2
@@ -0,0 +1,2253 @@
1
+ import { css, LitElement, html } from 'lit';
2
+ import { ContextConsumer, createContext, ContextProvider } from '@lit/context';
3
+ import { unsafeStatic, literal, html as html$1 } from 'lit/static-html.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
5
+ import { ifDefined } from 'lit/directives/if-defined.js';
6
+
7
+ var styleCss$1 = css`:focus:not(:focus-visible){outline:3px solid transparent}.body-default{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.body-lg{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-sm-font-size, 0.875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.body-xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-xs-font-size, 0.75rem);line-height:var(--wcss-body-xs-line-height, 1rem)}.body-2xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-2xs-font-size, 0.625rem);line-height:var(--wcss-body-2xs-line-height, 0.875rem)}.display-2xl{font-family:var(--wcss-display-2xl-family, "AS Circular"),var(--wcss-display-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);font-weight:var(--wcss-display-2xl-weight, 300);line-height:var(--wcss-display-2xl-line-height, 1.3);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem))}.display-xl{font-family:var(--wcss-display-xl-family, "AS Circular"),var(--wcss-display-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);font-weight:var(--wcss-display-xl-weight, 300);line-height:var(--wcss-display-xl-line-height, 1.3);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem))}.display-lg{font-family:var(--wcss-display-lg-family, "AS Circular"),var(--wcss-display-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);font-weight:var(--wcss-display-lg-weight, 300);line-height:var(--wcss-display-lg-line-height, 1.3);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem))}.display-md{font-family:var(--wcss-display-md-family, "AS Circular"),var(--wcss-display-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-display-md-letter-spacing, 0);font-weight:var(--wcss-display-md-weight, 300);line-height:var(--wcss-display-md-line-height, 1.3);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem))}.display-sm{font-family:var(--wcss-display-sm-family, "AS Circular"),var(--wcss-display-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);font-weight:var(--wcss-display-sm-weight, 300);line-height:var(--wcss-display-sm-line-height, 1.3);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem))}.display-xs{font-family:var(--wcss-display-xs-family, "AS Circular"),var(--wcss-display-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);font-weight:var(--wcss-display-xs-weight, 300);line-height:var(--wcss-display-xs-line-height, 1.3);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem))}.heading-xl{font-family:var(--wcss-heading-xl-family, "AS Circular"),var(--wcss-heading-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);font-weight:var(--wcss-heading-xl-weight, 300);line-height:var(--wcss-heading-xl-line-height, 1.3);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem))}.heading-lg{font-family:var(--wcss-heading-lg-family, "AS Circular"),var(--wcss-heading-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);font-weight:var(--wcss-heading-lg-weight, 300);line-height:var(--wcss-heading-lg-line-height, 1.3);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem))}.heading-md{font-family:var(--wcss-heading-md-family, "AS Circular"),var(--wcss-heading-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);font-weight:var(--wcss-heading-md-weight, 300);line-height:var(--wcss-heading-md-line-height, 1.3);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem))}.heading-sm{font-family:var(--wcss-heading-sm-family, "AS Circular"),var(--wcss-heading-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);font-weight:var(--wcss-heading-sm-weight, 300);line-height:var(--wcss-heading-sm-line-height, 1.3);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem))}.heading-xs{font-family:var(--wcss-heading-xs-family, "AS Circular"),var(--wcss-heading-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);font-weight:var(--wcss-heading-xs-weight, 450);line-height:var(--wcss-heading-xs-line-height, 1.3);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem))}.heading-2xs{font-family:var(--wcss-heading-2xs-family, "AS Circular"),var(--wcss-heading-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);font-weight:var(--wcss-heading-2xs-weight, 450);line-height:var(--wcss-heading-2xs-line-height, 1.3);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem))}.accent-2xl{font-family:var(--wcss-accent-2xl-family, "Good OT"),var(--wcss-accent-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-2xl-letter-spacing, 0.05em);font-weight:var(--wcss-accent-2xl-weight, 450);line-height:var(--wcss-accent-2xl-line-height, 1);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));text-transform:uppercase}.accent-xl{font-family:var(--wcss-accent-xl-family, "Good OT"),var(--wcss-accent-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-xl-letter-spacing, 0.05em);font-weight:var(--wcss-accent-xl-weight, 450);line-height:var(--wcss-accent-xl-line-height, 1.3);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));text-transform:uppercase}.accent-lg{font-family:var(--wcss-accent-lg-family, "Good OT"),var(--wcss-accent-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-lg-letter-spacing, 0.05em);font-weight:var(--wcss-accent-lg-weight, 450);line-height:var(--wcss-accent-lg-line-height, 1.3);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));text-transform:uppercase}.accent-md{font-family:var(--wcss-accent-md-family, "Good OT"),var(--wcss-accent-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-md-letter-spacing, 0.05em);font-weight:var(--wcss-accent-md-weight, 500);line-height:var(--wcss-accent-md-line-height, 1.3);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));text-transform:uppercase}.accent-sm{font-family:var(--wcss-accent-sm-family, "Good OT"),var(--wcss-accent-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-sm-letter-spacing, 0.05em);font-weight:var(--wcss-accent-sm-weight, 500);line-height:var(--wcss-accent-sm-line-height, 1.3);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));text-transform:uppercase}.accent-xs{font-family:var(--wcss-accent-xs-family, "Good OT"),var(--wcss-accent-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-xs-letter-spacing, 0.1em);font-weight:var(--wcss-accent-xs-weight, 500);line-height:var(--wcss-accent-xs-line-height, 1.3);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));text-transform:uppercase}.accent-2xs{font-family:var(--wcss-accent-2xs-family, "Good OT"),var(--wcss-accent-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-2xs-letter-spacing, 0.1em);font-weight:var(--wcss-accent-2xs-weight, 450);line-height:var(--wcss-accent-2xs-line-height, 1.3);font-size:var(--wcss-accent-2xs-font-size, clamp(0.875rem, 1.1666666667vw, 0.875rem));text-transform:uppercase}:host{display:block;line-height:0;overflow-y:auto}:host .menuWrapper{box-sizing:border-box;display:flex;flex-direction:column;width:100%;margin:0;padding:0}:host ::slotted(hr){box-sizing:content-box !important;height:0 !important;overflow:visible !important;margin:var(--ds-size-100, 0.5rem) 0 !important;border-width:0 !important;border-top-width:1px !important;border-top-style:solid !important}:host [loadingplaceholder].empty{opacity:0;position:absolute}:host [loadingplaceholder] slot[name=loadingIcon]{vertical-align:middle;display:inline-block;margin-bottom:var(--ds-size-25, 0.125rem)}:host [loadingplaceholder] slot[name=loadingIcon]::slotted(*){margin-right:var(--ds-size-150, 0.75rem)}:host([root]) .menuWrapper.lg{padding:var(--ds-size-150, 0.75rem);gap:var(--ds-size-50, 0.25rem)}:host([root]) .menuWrapper.xl{padding:var(--ds-size-200, 1rem);gap:var(--ds-size-100, 0.5rem)}`;
8
+
9
+ var colorCss$1 = css`:host ::slotted(hr){border-top-color:var(--ds-auro-menu-divider-color)}[loadingplaceholder] slot[name=loadingIcon]{color:var(--ds-auro-menu-loader-color)}[loadingplaceholder] slot[name=loadingText]{color:var(--ds-auro-menu-loader-text-color)}`;
10
+
11
+ var tokensCss = css`:host{--ds-auro-menu-divider-color: var(--ds-basic-color-border-divider, rgba(0, 0, 0, 0.15));--ds-auro-menu-loader-color: var(--ds-basic-color-brand-primary, #01426a);--ds-auro-menu-loader-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-menuoption-container-color: transparent;--ds-auro-menuoption-container-border-color: var(--ds-auro-menuoption-container-color);--ds-auro-menuoption-icon-color: transparent;--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}`;
12
+
13
+ class AuroElement extends LitElement {
14
+ static get properties() {
15
+ return {
16
+
17
+ /**
18
+ * Defines the language of an element.
19
+ * @default {'default'}
20
+ */
21
+ layout: {
22
+ type: String,
23
+ attribute: "layout",
24
+ reflect: true
25
+ },
26
+
27
+ shape: {
28
+ type: String,
29
+ attribute: "shape",
30
+ reflect: true
31
+ },
32
+
33
+ size: {
34
+ type: String,
35
+ attribute: "size",
36
+ reflect: true
37
+ },
38
+
39
+ onDark: {
40
+ type: Boolean,
41
+ attribute: "ondark",
42
+ reflect: true
43
+ }
44
+ };
45
+ }
46
+
47
+ /**
48
+ * Returns true if the element has focus.
49
+ * @private
50
+ * @returns {boolean} - Returns true if the element has focus.
51
+ */
52
+ get componentHasFocus() {
53
+ return this.matches(':focus') || this.matches(':focus-within');
54
+ }
55
+
56
+ resetShapeClasses() {
57
+ const wrapper = this.shadowRoot.querySelector('.wrapper');
58
+
59
+ if (wrapper) {
60
+ wrapper.classList.forEach((className) => {
61
+ if (className.startsWith('shape-')) {
62
+ wrapper.classList.remove(className);
63
+ }
64
+ });
65
+
66
+ if (this.shape && this.size) {
67
+ wrapper.classList.add(`shape-${this.shape.toLowerCase()}-${this.size.toLowerCase()}`);
68
+ } else {
69
+ wrapper.classList.add('shape-none');
70
+ }
71
+ }
72
+
73
+ }
74
+
75
+ resetLayoutClasses() {
76
+ if (this.layout) {
77
+ const wrapper = this.shadowRoot.querySelector('.wrapper');
78
+
79
+ if (wrapper) {
80
+ wrapper.classList.forEach((className) => {
81
+ if (className.startsWith('layout-')) {
82
+ wrapper.classList.remove(className);
83
+ }
84
+ });
85
+
86
+ wrapper.classList.add(`layout-${this.layout.toLowerCase()}`);
87
+ }
88
+ }
89
+ }
90
+
91
+ updateComponentArchitecture() {
92
+ this.resetLayoutClasses();
93
+ this.resetShapeClasses();
94
+ }
95
+
96
+ updated(changedProperties) {
97
+ if (changedProperties.has('layout') || changedProperties.has('shape') || changedProperties.has('size')) {
98
+ this.updateComponentArchitecture();
99
+ }
100
+ }
101
+
102
+ // Try to render the defined `this.layout` layout. If that fails, fall back to the default layout.
103
+ // This will catch if an invalid layout value is passed in and render the default layout if so.
104
+ render() {
105
+ try {
106
+ return this.renderLayout();
107
+ } catch (error) {
108
+ // failed to get the defined layout
109
+ console.error('Failed to get the defined layout - using the default layout', error); // eslint-disable-line no-console
110
+
111
+ // fallback to the default layout
112
+ return this.getLayout('default');
113
+ }
114
+ }
115
+ }
116
+
117
+ var styleCss = css`.body-default{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.body-lg{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-sm-font-size, 0.875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.body-xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-xs-font-size, 0.75rem);line-height:var(--wcss-body-xs-line-height, 1rem)}.body-2xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);font-size:var(--wcss-body-2xs-font-size, 0.625rem);line-height:var(--wcss-body-2xs-line-height, 0.875rem)}.display-2xl{font-family:var(--wcss-display-2xl-family, "AS Circular"),var(--wcss-display-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);font-weight:var(--wcss-display-2xl-weight, 300);line-height:var(--wcss-display-2xl-line-height, 1.3);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem))}.display-xl{font-family:var(--wcss-display-xl-family, "AS Circular"),var(--wcss-display-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);font-weight:var(--wcss-display-xl-weight, 300);line-height:var(--wcss-display-xl-line-height, 1.3);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem))}.display-lg{font-family:var(--wcss-display-lg-family, "AS Circular"),var(--wcss-display-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);font-weight:var(--wcss-display-lg-weight, 300);line-height:var(--wcss-display-lg-line-height, 1.3);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem))}.display-md{font-family:var(--wcss-display-md-family, "AS Circular"),var(--wcss-display-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-display-md-letter-spacing, 0);font-weight:var(--wcss-display-md-weight, 300);line-height:var(--wcss-display-md-line-height, 1.3);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem))}.display-sm{font-family:var(--wcss-display-sm-family, "AS Circular"),var(--wcss-display-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);font-weight:var(--wcss-display-sm-weight, 300);line-height:var(--wcss-display-sm-line-height, 1.3);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem))}.display-xs{font-family:var(--wcss-display-xs-family, "AS Circular"),var(--wcss-display-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);font-weight:var(--wcss-display-xs-weight, 300);line-height:var(--wcss-display-xs-line-height, 1.3);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem))}.heading-xl{font-family:var(--wcss-heading-xl-family, "AS Circular"),var(--wcss-heading-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);font-weight:var(--wcss-heading-xl-weight, 300);line-height:var(--wcss-heading-xl-line-height, 1.3);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem))}.heading-lg{font-family:var(--wcss-heading-lg-family, "AS Circular"),var(--wcss-heading-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);font-weight:var(--wcss-heading-lg-weight, 300);line-height:var(--wcss-heading-lg-line-height, 1.3);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem))}.heading-md{font-family:var(--wcss-heading-md-family, "AS Circular"),var(--wcss-heading-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);font-weight:var(--wcss-heading-md-weight, 300);line-height:var(--wcss-heading-md-line-height, 1.3);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem))}.heading-sm{font-family:var(--wcss-heading-sm-family, "AS Circular"),var(--wcss-heading-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);font-weight:var(--wcss-heading-sm-weight, 300);line-height:var(--wcss-heading-sm-line-height, 1.3);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem))}.heading-xs{font-family:var(--wcss-heading-xs-family, "AS Circular"),var(--wcss-heading-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);font-weight:var(--wcss-heading-xs-weight, 450);line-height:var(--wcss-heading-xs-line-height, 1.3);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem))}.heading-2xs{font-family:var(--wcss-heading-2xs-family, "AS Circular"),var(--wcss-heading-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);font-weight:var(--wcss-heading-2xs-weight, 450);line-height:var(--wcss-heading-2xs-line-height, 1.3);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem))}.accent-2xl{font-family:var(--wcss-accent-2xl-family, "Good OT"),var(--wcss-accent-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-2xl-letter-spacing, 0.05em);font-weight:var(--wcss-accent-2xl-weight, 450);line-height:var(--wcss-accent-2xl-line-height, 1);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));text-transform:uppercase}.accent-xl{font-family:var(--wcss-accent-xl-family, "Good OT"),var(--wcss-accent-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-xl-letter-spacing, 0.05em);font-weight:var(--wcss-accent-xl-weight, 450);line-height:var(--wcss-accent-xl-line-height, 1.3);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));text-transform:uppercase}.accent-lg{font-family:var(--wcss-accent-lg-family, "Good OT"),var(--wcss-accent-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-lg-letter-spacing, 0.05em);font-weight:var(--wcss-accent-lg-weight, 450);line-height:var(--wcss-accent-lg-line-height, 1.3);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));text-transform:uppercase}.accent-md{font-family:var(--wcss-accent-md-family, "Good OT"),var(--wcss-accent-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-md-letter-spacing, 0.05em);font-weight:var(--wcss-accent-md-weight, 500);line-height:var(--wcss-accent-md-line-height, 1.3);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));text-transform:uppercase}.accent-sm{font-family:var(--wcss-accent-sm-family, "Good OT"),var(--wcss-accent-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-sm-letter-spacing, 0.05em);font-weight:var(--wcss-accent-sm-weight, 500);line-height:var(--wcss-accent-sm-line-height, 1.3);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));text-transform:uppercase}.accent-xs{font-family:var(--wcss-accent-xs-family, "Good OT"),var(--wcss-accent-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-xs-letter-spacing, 0.1em);font-weight:var(--wcss-accent-xs-weight, 500);line-height:var(--wcss-accent-xs-line-height, 1.3);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));text-transform:uppercase}.accent-2xs{font-family:var(--wcss-accent-2xs-family, "Good OT"),var(--wcss-accent-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);letter-spacing:var(--wcss-accent-2xs-letter-spacing, 0.1em);font-weight:var(--wcss-accent-2xs-weight, 450);line-height:var(--wcss-accent-2xs-line-height, 1.3);font-size:var(--wcss-accent-2xs-font-size, clamp(0.875rem, 1.1666666667vw, 0.875rem));text-transform:uppercase}:host{cursor:pointer;user-select:none;text-overflow:ellipsis;max-width:100dvw}:host .wrapper{display:flex;align-items:center;height:var(--ds-size-400, 2rem);padding-right:var(--ds-size-200, 1rem);padding-left:calc(var(--ds-size-150, 0.75rem) + var(--ds-size-300, 1.5rem) + var(--ds-size-100, 0.5rem));border-radius:var(--ds-size-100, 0.5rem);-webkit-tap-highlight-color:transparent}:host .wrapper[class*=shape-box]{border-radius:unset}:host .wrapper[class*=shape-snowflake]{border-radius:unset;line-height:24px}:host .wrapper[class*=shape-pill]{border-radius:30px}:host .wrapper[class*=-lg]{padding-top:var(--ds-size-75, 0.375rem);padding-bottom:var(--ds-size-75, 0.375rem);padding-right:var(--ds-size-150, 0.75rem);line-height:26px}:host .wrapper[class*=-xl]{padding-top:var(--ds-size-100, 0.5rem);padding-bottom:var(--ds-size-100, 0.5rem);padding-right:var(--ds-size-200, 1rem);line-height:26px}:host slot{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host [auro-icon]{--ds-auro-icon-size: var(--ds-size-300, 1.5rem);margin-right:var(--ds-size-150, 0.75rem);margin-left:var(--ds-size-100, 0.5rem)}:host ::slotted(.nestingSpacer){display:inline-block;width:var(--ds-size-300, 1.5rem)}[slot=displayValue]{display:none}:host([loadingplaceholder]) .wrapper{padding-left:calc(var(--ds-size-150, 0.75rem) + var(--ds-size-300, 1.5rem) + var(--ds-size-100, 0.5rem))}:host([selected]) .wrapper{padding-left:0}:host([nocheckmark]) .wrapper{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-lg]{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-xl]{padding-left:var(--ds-size-200, 1rem)}:host([hidden]){display:none}:host([static]){pointer-events:none}:host([disabled]:hover){cursor:auto}:host([disabled]){user-select:none;pointer-events:none}`;
118
+
119
+ var colorCss = css`:host .wrapper{background-color:var(--ds-auro-menuoption-container-color, transparent);box-shadow:inset 0 0 0 1px var(--ds-auro-menuoption-container-border-color, transparent);color:var(--ds-auro-menuoption-text-color)}:host svg{fill:var(--ds-auro-menuoption-icon-color)}:host([disabled]){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0);--ds-auro-menuoption-icon-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd)}@media(hover: hover){:host(:hover){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd)}}:host(:focus){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}:host([selected]){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-subtle, #b4eff9);--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-menuoption-icon-color: var(--ds-basic-color-texticon-default, #2a2a2a)}:host([selected].active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd)}@media(hover: hover){:host([selected]:hover){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd)}}:host([selected]:focus){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-subtle, #b4eff9);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}:host(:focus.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}@media(hover: hover){:host(:focus:hover){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}}:host([selected]:focus.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}@media(hover: hover){:host([selected]:focus:hover){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-accent1-muted, #ebfafd);--ds-auro-menuoption-container-border-color: var(--ds-basic-color-border-brand, #00274a)}}`;
120
+
121
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
122
+ // See LICENSE in the project root for license information.
123
+
124
+ // ---------------------------------------------------------------------
125
+
126
+ /* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
127
+
128
+ class AuroLibraryRuntimeUtils {
129
+
130
+ /* eslint-disable jsdoc/require-param */
131
+
132
+ /**
133
+ * This will register a new custom element with the browser.
134
+ * @param {String} name - The name of the custom element.
135
+ * @param {Object} componentClass - The class to register as a custom element.
136
+ * @returns {void}
137
+ */
138
+ registerComponent(name, componentClass) {
139
+ if (!customElements.get(name)) {
140
+ customElements.define(name, class extends componentClass {});
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Finds and returns the closest HTML Element based on a selector.
146
+ * @returns {void}
147
+ */
148
+ closestElement(
149
+ selector, // selector like in .closest()
150
+ base = this, // extra functionality to skip a parent
151
+ __Closest = (el, found = el && el.closest(selector)) =>
152
+ !el || el === document || el === window
153
+ ? null // standard .closest() returns null for non-found selectors also
154
+ : found
155
+ ? found // found a selector INside this element
156
+ : __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
157
+ ) {
158
+ return __Closest(base);
159
+ }
160
+ /* eslint-enable jsdoc/require-param */
161
+
162
+ /**
163
+ * 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.
164
+ * @param {Object} elem - The element to check.
165
+ * @param {String} tagName - The name of the Auro component to check for or add as an attribute.
166
+ * @returns {void}
167
+ */
168
+ handleComponentTagRename(elem, tagName) {
169
+ const tag = tagName.toLowerCase();
170
+ const elemTag = elem.tagName.toLowerCase();
171
+
172
+ if (elemTag !== tag) {
173
+ elem.setAttribute(tag, true);
174
+ }
175
+ }
176
+
177
+ /**
178
+ * Validates if an element is a specific Auro component.
179
+ * @param {Object} elem - The element to validate.
180
+ * @param {String} tagName - The name of the Auro component to check against.
181
+ * @returns {Boolean} - Returns true if the element is the specified Auro component.
182
+ */
183
+ elementMatch(elem, tagName) {
184
+ const tag = tagName.toLowerCase();
185
+ const elemTag = elem.tagName.toLowerCase();
186
+
187
+ return elemTag === tag || elem.hasAttribute(tag);
188
+ }
189
+
190
+ /**
191
+ * Gets the text content of a named slot.
192
+ * @returns {String}
193
+ * @private
194
+ */
195
+ getSlotText(elem, name) {
196
+ const slot = elem.shadowRoot?.querySelector(`slot[name="${name}"]`);
197
+ const nodes = slot?.assignedNodes({ flatten: true }) || [];
198
+ const text = nodes.map(n => n.textContent?.trim()).join(' ').trim();
199
+
200
+ return text || null;
201
+ }
202
+ }
203
+
204
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
205
+ // See LICENSE in the project root for license information.
206
+
207
+
208
+ class AuroDependencyVersioning {
209
+
210
+ /**
211
+ * Generates a unique string to be used for child auro element naming.
212
+ * @private
213
+ * @param {string} baseName - Defines the first part of the unique element name.
214
+ * @param {string} version - Version of the component that will be appended to the baseName.
215
+ * @returns {string} - Unique string to be used for naming.
216
+ */
217
+ generateElementName(baseName, version) {
218
+ let result = baseName;
219
+
220
+ result += '-';
221
+ result += version.replace(/[.]/g, '_');
222
+
223
+ return result;
224
+ }
225
+
226
+ /**
227
+ * Generates a unique string to be used for child auro element naming.
228
+ * @param {string} baseName - Defines the first part of the unique element name.
229
+ * @param {string} version - Version of the component that will be appended to the baseName.
230
+ * @returns {string} - Unique string to be used for naming.
231
+ */
232
+ generateTag(baseName, version, tagClass) {
233
+ const elementName = this.generateElementName(baseName, version);
234
+ const tag = literal`${unsafeStatic(elementName)}`;
235
+
236
+ if (!customElements.get(elementName)) {
237
+ customElements.define(elementName, class extends tagClass {});
238
+ }
239
+
240
+ return tag;
241
+ }
242
+ }
243
+
244
+ 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 LitElement{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=css`: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}
245
+ `;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;}}}css`.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}
246
+ `;var y=css`: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)}
247
+ `;var x=css`: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)}
248
+ `;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 html`
249
+ <div class="componentWrapper">
250
+ <div
251
+ class="${classMap({svgWrapper:true})}"
252
+ title="${ifDefined(this.title||void 0)}">
253
+ <span aria-hidden="${ifDefined(this.ariaHidden||true)}" part="svg">
254
+ ${this.customSvg?html`
255
+ <slot name="svg"></slot>
256
+ `:html`
257
+ ${this.svg}
258
+ `}
259
+ </span>
260
+ </div>
261
+
262
+ <div class="${classMap(t)}" part="label">
263
+ <slot></slot>
264
+ </div>
265
+ </div>
266
+ `}}
267
+
268
+ var iconVersion = '9.1.2';
269
+
270
+ var checkmarkIcon = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"checkmark-sm__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"checkmark-sm__desc\">a small check mark.</desc><path d=\"M8.461 11.84a.625.625 0 1 0-.922.844l2.504 2.738c.247.27.674.27.922 0l5.496-6a.625.625 0 1 0-.922-.844l-5.035 5.496z\"/></svg>"};
271
+
272
+ // Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
273
+ // See LICENSE in the project root for license information.
274
+
275
+ // ---------------------------------------------------------------------
276
+
277
+ /**
278
+ * Converts value to an array.
279
+ * If the value is a JSON string representing an array, it will be parsed.
280
+ * If the value is already an array, it is returned.
281
+ * If the value is undefined, it returns undefined.
282
+ * @private
283
+ * @param {any} value - The value to be converted. Can be a string, array, or undefined.
284
+ * @returns {Array|undefined} - The converted array or undefined.
285
+ * @throws {Error} - Throws an error if the value is not an array, undefined,
286
+ * or if the value cannot be parsed into an array from a JSON string.
287
+ */
288
+ function arrayConverter(value) {
289
+ // Allow undefined
290
+ if (value === undefined) {
291
+ return undefined;
292
+ }
293
+
294
+ // Return the value if it is already an array
295
+ if (Array.isArray(value)) {
296
+ return value;
297
+ }
298
+
299
+ try {
300
+ // If value is a JSON string, parse it
301
+ const parsed = typeof value === 'string' ? JSON.parse(value) : value;
302
+
303
+ // Check if the parsed value is an array
304
+ if (Array.isArray(parsed)) {
305
+ return parsed;
306
+ }
307
+ } catch (error) {
308
+ // If JSON parsing fails, continue to throw an error below
309
+ /* eslint-disable no-console */
310
+ console.error('JSON parsing failed:', error);
311
+ }
312
+
313
+ // Throw error if the input is not an array or undefined
314
+ throw new Error('Invalid value: Input must be an array or undefined');
315
+ }
316
+
317
+ /**
318
+ * Validates if an option can be interacted with.
319
+ * @private
320
+ * @param {HTMLElement} option - The option to check.
321
+ * @returns {boolean} True if option is interactive.
322
+ */
323
+ function isOptionInteractive(option) {
324
+ return !option.hasAttribute('hidden') &&
325
+ !option.hasAttribute('disabled') &&
326
+ !option.hasAttribute('static');
327
+ }
328
+
329
+ /**
330
+ * Helper method to dispatch custom events.
331
+ * @param {HTMLElement} element - Element to dispatch event from.
332
+ * @param {string} eventName - Name of the event to dispatch.
333
+ * @param {Object} [detail] - Optional detail object to include with the event.
334
+ */
335
+ function dispatchMenuEvent(element, eventName, detail = null) {
336
+ const eventConfig = {
337
+ bubbles: true,
338
+ cancelable: false,
339
+ composed: true
340
+ };
341
+
342
+ if (detail !== null) {
343
+ eventConfig.detail = detail;
344
+ }
345
+
346
+ element.dispatchEvent(new CustomEvent(eventName, eventConfig));
347
+ }
348
+
349
+ // Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
350
+ // See LICENSE in the project root for license information.
351
+
352
+
353
+ let menuOptionIdCounter = 0;
354
+
355
+ /**
356
+ * The `auro-menuoption` element provides users a way to define a menu option.
357
+ * @customElement auro-menuoption
358
+ *
359
+ * @slot default - The default slot for the menu option text.
360
+ *
361
+ * @event auroMenuOption-mouseover - Notifies that this option has been hovered over.
362
+ */
363
+ class AuroMenuOption extends AuroElement {
364
+
365
+ /**
366
+ * This will register this element with the browser.
367
+ * @param {string} [name="auro-menuoption"] - The name of the element that you want to register.
368
+ *
369
+ * @example
370
+ * AuroMenuOption.register("custom-menuoption") // this will register this element to <custom-menuoption/>
371
+ *
372
+ */
373
+ static register(name = "auro-menuoption") {
374
+ AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenuOption);
375
+ }
376
+
377
+ /**
378
+ * Returns whether the menu option is currently active and selectable.
379
+ * An option is considered active if it is not hidden, not disabled, and not static.
380
+ * @returns {boolean} True if the option is active, false otherwise.
381
+ */
382
+ get isActive() {
383
+ return !this.hasAttribute('hidden') &&
384
+ !this.disabled &&
385
+ !this.hasAttribute('static');
386
+ }
387
+
388
+ constructor() {
389
+ super();
390
+
391
+ this.bindEvents();
392
+
393
+ /**
394
+ * @private
395
+ */
396
+ this.shape = undefined;
397
+
398
+ /**
399
+ * @private
400
+ */
401
+ this.size = undefined;
402
+
403
+ /**
404
+ * Generate unique names for dependency components.
405
+ */
406
+ const versioning = new AuroDependencyVersioning();
407
+ this.iconTag = versioning.generateTag('auro-formkit-menuoption-icon', iconVersion, _);
408
+
409
+ this.selected = false;
410
+ this.noCheckmark = false;
411
+ this.disabled = false;
412
+
413
+ /**
414
+ * @private
415
+ */
416
+ this.runtimeUtils = new AuroLibraryRuntimeUtils();
417
+
418
+ // Initialize context-related properties
419
+ this.menuService = null;
420
+ this.unsubscribe = null;
421
+
422
+ /**
423
+ * @private
424
+ */
425
+ this.handleMenuChange = this.handleMenuChange.bind(this);
426
+ }
427
+
428
+ static get properties() {
429
+ return {
430
+ ...super.properties,
431
+
432
+ /**
433
+ * When true, disables the menu option.
434
+ */
435
+ disabled: {
436
+ type: Boolean,
437
+ reflect: true
438
+ },
439
+
440
+ /**
441
+ * @private
442
+ */
443
+ event: {
444
+ type: String,
445
+ reflect: true
446
+ },
447
+
448
+ /**
449
+ * @private
450
+ */
451
+ layout: {
452
+ type: String
453
+ },
454
+
455
+ /**
456
+ * Allows users to set a unique key for the menu option for specified option selection. If no key is provided, the value property will be used.
457
+ */
458
+ key: {
459
+ type: String,
460
+ reflect: true
461
+ },
462
+
463
+ /**
464
+ * @private
465
+ */
466
+ menuService: {
467
+ type: Object,
468
+ state: true
469
+ },
470
+
471
+ /**
472
+ * @private
473
+ */
474
+ matchWord: {
475
+ type: String,
476
+ state: true
477
+ },
478
+
479
+ /**
480
+ * @private
481
+ */
482
+ noCheckmark: {
483
+ type: Boolean,
484
+ reflect: true
485
+ },
486
+
487
+ /**
488
+ * Specifies that an option is selected.
489
+ */
490
+ selected: {
491
+ type: Boolean,
492
+ reflect: true
493
+ },
494
+
495
+ /**
496
+ * Specifies the tab index of the menu option.
497
+ */
498
+ tabIndex: {
499
+ type: Number,
500
+ reflect: true
501
+ },
502
+
503
+ /**
504
+ * Specifies the value to be sent to a server.
505
+ */
506
+ value: {
507
+ type: String,
508
+ reflect: true
509
+ },
510
+ };
511
+ }
512
+
513
+ static get styles() {
514
+ return [
515
+ styleCss,
516
+ colorCss,
517
+ tokensCss
518
+ ];
519
+ }
520
+
521
+ connectedCallback() {
522
+ super.connectedCallback();
523
+
524
+ // Add the tag name as an attribute if it is different than the component name
525
+ // Add this step soon as this node gets attached to the DOM to avoid racing condition with menu's value setting logic.
526
+ this.runtimeUtils.handleComponentTagRename(this, 'auro-menuoption');
527
+
528
+ // Set up context consumption in connectedCallback
529
+ this._contextConsumer = new ContextConsumer(this, {
530
+ context: MenuContext,
531
+ callback: this.attachTo.bind(this),
532
+ subscribe: true
533
+ });
534
+
535
+ // Establish the key property as early as possible.
536
+ // When a framework (e.g. Svelte) inserts the element into the DOM before
537
+ // setting its `value` property, both `getAttribute('value')` and
538
+ // `getAttribute('key')` return null here. Setting `this.key = null`
539
+ // would block the fallback in `updated()` that assigns key from the
540
+ // value property (the guard checked `=== undefined`). Only assign key
541
+ // if at least one source attribute is actually present so that the
542
+ // `updated()` fallback can run when the value property arrives later.
543
+ const valueAttr = this.getAttribute('value');
544
+ const keyAttr = this.getAttribute('key');
545
+ const resolvedKey = keyAttr !== null ? keyAttr : valueAttr;
546
+ if (resolvedKey !== null) {
547
+ this.key = resolvedKey;
548
+ }
549
+ }
550
+
551
+ firstUpdated() {
552
+ // Add the tag name as an attribute if it is different than the component name
553
+ this.runtimeUtils.handleComponentTagRename(this, 'auro-menuoption');
554
+
555
+ // Generate unique ID if not already set (required for aria-activedescendant)
556
+ if (!this.id) {
557
+ menuOptionIdCounter += 1;
558
+ this.id = `menuoption-${menuOptionIdCounter}`;
559
+ }
560
+
561
+ this.setAttribute('role', 'option');
562
+ this.setAttribute('aria-selected', 'false');
563
+
564
+ this.addEventListener('mouseover', () => {
565
+ this.dispatchEvent(new CustomEvent('auroMenuOption-mouseover', {
566
+ bubbles: true,
567
+ cancelable: false,
568
+ composed: true,
569
+ detail: this
570
+ }));
571
+ });
572
+ }
573
+
574
+ updated(changedProperties) {
575
+ super.updated(changedProperties);
576
+
577
+ // Update aria-selected attribute if selected changed
578
+ if (changedProperties.has('selected')) {
579
+
580
+ // Update aria-selected attribute
581
+ this.setAttribute('aria-selected', this.selected.toString());
582
+
583
+ // Update menu service selection state if this isn't an internal update
584
+ if (this.internalUpdateInProgress !== true) {
585
+ this.menuService[this.selected ? 'selectOption' : 'deselectOption'](this);
586
+ }
587
+ }
588
+
589
+ if (changedProperties.has('disabled')) {
590
+ if (this.disabled) {
591
+ this.setAttribute('aria-disabled', 'true');
592
+ } else {
593
+ this.removeAttribute('aria-disabled');
594
+ }
595
+ }
596
+
597
+ if (changedProperties.has('active')) {
598
+ this.updateActiveClasses();
599
+ }
600
+
601
+ // Update text highlight if matchWord changed
602
+ if (changedProperties.has('matchWord')) {
603
+ this.updateTextHighlight();
604
+ }
605
+
606
+ // Set the key to be the passed value if no key is provided.
607
+ // Loose equality (== null) is intentional: it catches both null AND
608
+ // undefined. When a framework (e.g. Svelte, React) inserts the element
609
+ // before setting its value property, connectedCallback skips key
610
+ // assignment because both attributes are null at that point. The Lit
611
+ // property default for `key` is undefined (not null), so strict
612
+ // === null would miss the case and the fallback would never run.
613
+ if (changedProperties.has('value') && this.key == null) { // eslint-disable-line eqeqeq, no-eq-null
614
+ this.key = this.value;
615
+ }
616
+ }
617
+
618
+ disconnectedCallback() {
619
+ if (this.menuService) {
620
+ this.menuService.unsubscribe(this.handleMenuChange);
621
+ this.menuService.removeMenuOption(this);
622
+ }
623
+ }
624
+
625
+ /**
626
+ * Sets up event listeners for user interaction with the menu option.
627
+ * This function enables click and mouse enter events to trigger selection and highlighting logic.
628
+ */
629
+ bindEvents() {
630
+ this.addEventListener('click', this.handleClick.bind(this));
631
+ this.addEventListener('mouseenter', this.handleMouseEnter.bind(this));
632
+ }
633
+
634
+ /**
635
+ * Attaches this menu option to a menu service and subscribes to its events.
636
+ * This method enables the option to participate in menu selection and highlighting logic.
637
+ * @param {Object} service - The menu service instance to attach to.
638
+ */
639
+ attachTo(service) {
640
+ if (!service) {
641
+ return;
642
+ }
643
+ this.menuService = service;
644
+ this.menuService.addMenuOption(this);
645
+ this.menuService.subscribe(this.handleMenuChange);
646
+ }
647
+
648
+ /**
649
+ * Handles changes from the menu service and updates the option's state.
650
+ * This function synchronizes the option's properties and selection/highlight state with menu events.
651
+ * @param {Object} event - The event object from the menu service.
652
+ */
653
+ handleMenuChange(event) {
654
+
655
+ // Ignore events without a type or property
656
+ if (!event || (!event.type && !event.property)) {
657
+ return;
658
+ }
659
+
660
+ // Update reactive properties based on event type
661
+ if (event.property && Object.keys(AuroMenuOption.properties).includes(event.property)) {
662
+ this[event.property] = event.value;
663
+ }
664
+
665
+ // Handle highlight changes
666
+ if (event.type === 'highlightChange') {
667
+ const isActive = event.option === this;
668
+ this.active = isActive;
669
+ this.updateActiveClasses();
670
+ }
671
+
672
+ if (event.type === 'stateChange') {
673
+ const isSelected = event.selectedOptions.includes(this);
674
+ this.setInternalSelected(isSelected);
675
+ }
676
+ }
677
+
678
+ /**
679
+ * Updates the internal selected state of the menu option bypassing 'updated' and triggers custom events if selected.
680
+ * This function ensures the option's selection state is synchronized with menu logic and notifies listeners.
681
+ * @param {boolean} isSelected - Whether the option should be marked as selected.
682
+ */
683
+ setInternalSelected(isSelected) {
684
+ this.internalUpdateInProgress = true;
685
+ this.selected = isSelected;
686
+
687
+ // Fire custom event if selected
688
+ if (isSelected) {
689
+ this.handleCustomEvent();
690
+ }
691
+
692
+ setTimeout(() => {
693
+ this.internalUpdateInProgress = false;
694
+ }, 0);
695
+ }
696
+
697
+ /**
698
+ * Sets the selected state of the menu option.
699
+ * This function updates whether the option is currently selected.
700
+ * @param {boolean} isSelected - Whether the option should be marked as selected.
701
+ * @deprecated Simply modify the `selected` property directly instead.
702
+ */
703
+ setSelected(isSelected) {
704
+ this.selected = isSelected;
705
+ }
706
+
707
+ /**
708
+ * Updates the active state and visual highlighting of the menu option.
709
+ * This function toggles the option's active status and applies or removes the active CSS class.
710
+ * @param {boolean} isActive - Whether the option should be marked as active.
711
+ * @deprecated Simply modify the `active` property directly instead.
712
+ */
713
+ updateActive(isActive) {
714
+
715
+ // Set active state
716
+ this.active = isActive;
717
+ this.updateActiveClasses();
718
+ }
719
+
720
+ /**
721
+ * Updates the CSS class for the menu option based on its active state.
722
+ * This function adds or removes the 'active' class to visually indicate the option's active status.
723
+ * @private
724
+ */
725
+ updateActiveClasses() {
726
+ // Update class based on active state
727
+ if (this.active) this.classList.add('active');
728
+ else this.classList.remove('active');
729
+ }
730
+
731
+
732
+ /**
733
+ * Updates the visual highlighting of text within the menu option based on the current match word.
734
+ * This function highlights matching text segments and manages nested spacers for display formatting.
735
+ * @private
736
+ */
737
+ updateTextHighlight() {
738
+
739
+ // Regex for matchWord if needed
740
+ let regexWord = null;
741
+
742
+ if (this.matchWord && this.matchWord.length) {
743
+ const escapedWord = this.matchWord.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
744
+ regexWord = new RegExp(escapedWord, 'giu');
745
+ }
746
+
747
+ // Update text highlighting if matchWord changed
748
+ if (regexWord &&
749
+ this.isActive && !this.hasAttribute('persistent')) {
750
+ const nested = this.querySelectorAll('.nestingSpacer');
751
+
752
+ const displayValueEl = this.querySelector('[slot="displayValue"]');
753
+ if (displayValueEl) {
754
+ this.removeChild(displayValueEl);
755
+ }
756
+
757
+ // Create nested spacers
758
+ const nestingSpacerBundle = [...nested].map(() => this.nestingSpacer).join('');
759
+
760
+ // Update with spacers and matchWord
761
+ this.innerHTML = nestingSpacerBundle +
762
+ this.textContent.replace(
763
+ regexWord,
764
+ (match) => `<strong>${match}</strong>`
765
+ );
766
+ if (displayValueEl) {
767
+ this.append(displayValueEl);
768
+ }
769
+ }
770
+ }
771
+
772
+ /**
773
+ * Handles click events on the menu option, toggling its selected state.
774
+ * This function dispatches a click event and updates selection if the option is not disabled.
775
+ * @private
776
+ */
777
+ handleClick() {
778
+ if (!this.disabled) {
779
+ this.dispatchClickEvent();
780
+ this.selected = !this.selected;
781
+ }
782
+ }
783
+
784
+ /**
785
+ * Handles mouse enter events to highlight the menu option.
786
+ * This function updates the menu service to set this option as the currently highlighted item if not disabled.
787
+ * @private
788
+ */
789
+ handleMouseEnter() {
790
+ if (!this.disabled) {
791
+ this.menuService.setHighlightedOption(this);
792
+ }
793
+ }
794
+
795
+ /**
796
+ * Dispatches custom events defined for this menu option.
797
+ * This function notifies listeners when a custom event is triggered by the option.
798
+ * @private
799
+ */
800
+ handleCustomEvent() {
801
+ if (this.event) {
802
+ dispatchMenuEvent(this, this.event, { option: this });
803
+ dispatchMenuEvent(this, 'auroMenu-customEventFired', { option: this });
804
+ }
805
+ }
806
+
807
+ /**
808
+ * Dispatches a click event for this menu option.
809
+ * This function notifies listeners that the option has been clicked.
810
+ * @private
811
+ */
812
+ dispatchClickEvent() {
813
+ this.dispatchEvent(new CustomEvent('auroMenuOption-click', {
814
+ bubbles: true,
815
+ cancelable: false,
816
+ composed: true,
817
+ detail: this
818
+ }));
819
+ }
820
+
821
+ /**
822
+ * Generates an HTML element containing an SVG icon based on the provided `svgContent`.
823
+ *
824
+ * @private
825
+ * @param {string} svgContent - The SVG content to be embedded.
826
+ * @returns {Element} The HTML element containing the SVG icon.
827
+ */
828
+ generateIconHtml(svgContent) {
829
+ const dom = new DOMParser().parseFromString(svgContent, 'text/html');
830
+ const svg = dom.body.firstChild;
831
+
832
+ svg.setAttribute('slot', 'svg');
833
+
834
+ return html$1`<${this.iconTag} customColor customSvg>${svg}</${this.iconTag}>`;
835
+ }
836
+
837
+ /**
838
+ * Logic to determine the layout of the component.
839
+ * @protected
840
+ * @returns {void}
841
+ */
842
+ renderLayout() {
843
+
844
+ const fontClassMap = {
845
+ xs: 'body-sm',
846
+ sm: 'body-default',
847
+ md: 'body-default',
848
+ lg: 'body-lg',
849
+ xl: 'body-lg'
850
+ };
851
+
852
+ const classes = classMap({
853
+ 'wrapper': true,
854
+ [this.size ? fontClassMap[this.size] : 'body-sm']: true,
855
+ });
856
+
857
+ return html$1`
858
+ <div class="${classes}">
859
+ ${this.selected && !this.noCheckmark
860
+ ? this.generateIconHtml(checkmarkIcon.svg)
861
+ : undefined}
862
+ <slot></slot>
863
+ </div>
864
+ `;
865
+ }
866
+ }
867
+
868
+ /* eslint-disable */
869
+
870
+ class MenuService {
871
+
872
+ /**
873
+ * PROPERTIES AND GETTERS
874
+ */
875
+
876
+ /**
877
+ * Gets the list of registered menu options.
878
+ * @returns {AuroMenuOption[]}
879
+ */
880
+ get menuOptions() {
881
+ return this._menuOptions;
882
+ }
883
+
884
+ /**
885
+ * Gets the currently highlighted option.
886
+ * @returns {AuroMenuOption|null}
887
+ */
888
+ get highlightedOption() {
889
+ return this._menuOptions[this.highlightedIndex] || null;
890
+ }
891
+
892
+ /**
893
+ * Gets the current value(s) of the selected option(s).
894
+ * @returns {string|string[]|undefined}
895
+ */
896
+ get currentValue() {
897
+ const values = (this.selectedOptions || []).map(option => option.value);
898
+ return this.multiSelect ? values : values[0];
899
+ }
900
+
901
+ /**
902
+ * Gets the label(s) of the currently selected option(s).
903
+ * @returns {string}
904
+ */
905
+ get currentLabel() {
906
+ const labels = (this.selectedOptions || []).map(option => option.textContent);
907
+ return this.multiSelect ? labels.join(", ") : labels[0] || '';
908
+ }
909
+
910
+ /**
911
+ * Gets the string representation of the current value(s).
912
+ * For multi-select, this is a JSON stringified array.
913
+ * @returns {string|undefined}
914
+ */
915
+ get stringValue() {
916
+ const { currentValue } = this;
917
+
918
+ if (Array.isArray(currentValue)) {
919
+ if (currentValue.length > 0) {
920
+ return JSON.stringify(currentValue);
921
+ }
922
+ return undefined;
923
+ }
924
+
925
+ if (typeof currentValue === 'string') {
926
+ if (currentValue.length > 0) {
927
+ return currentValue;
928
+ }
929
+ return undefined;
930
+ }
931
+
932
+ // Future: handle other types here (e.g., number, object, etc.)
933
+ return undefined;
934
+ }
935
+
936
+ /**
937
+ * Gets the key(s) of the currently selected option(s).
938
+ * @returns {string|string[]|undefined}
939
+ */
940
+ get currentKeys() {
941
+ const keys = (this.selectedOptions || []).map(option => option.key);
942
+ return this.multiSelect ? keys : keys[0];
943
+ }
944
+
945
+ /**
946
+ * CONSTRUCTOR
947
+ */
948
+
949
+ /**
950
+ * Creates a new MenuService instance.
951
+ * @param {Object} options - The options object.
952
+ * @param {AuroMenu} options.host - The host element that this service will control. Required.
953
+ * @throws {Error} If the host is not provided.
954
+ */
955
+ constructor({ host } = {}) {
956
+
957
+ // Ensure a host was passed
958
+ if (!host) {
959
+ throw new Error("MenuService requires a host element.");
960
+ }
961
+
962
+ // Attach the service to the host
963
+ this.host = host;
964
+ this.host.addController(this);
965
+
966
+ // Set default properties
967
+ this.size = undefined;
968
+ this.shape = undefined;
969
+ this.noCheckmark = undefined;
970
+ this.disabled = undefined;
971
+ this.matchWord = undefined;
972
+ this.multiSelect = undefined;
973
+ this.allowDeselect = undefined;
974
+ this.selectAllMatchingOptions = undefined;
975
+
976
+ this.highlightedIndex = -1;
977
+
978
+ this._menuOptions = [];
979
+ this._subscribers = [];
980
+ this.internalUpdateInProgress = false;
981
+ this.selectedOptions = [];
982
+ this._pendingValue = null;
983
+ this._pendingRetryScheduled = false;
984
+ this._pendingRetryCount = 0;
985
+ }
986
+
987
+ /**
988
+ * PROPERTY SYNCING
989
+ */
990
+
991
+ /**
992
+ * Handles host updates.
993
+ * This is a lit reactive lifecycle method.
994
+ * This comes from the Lit controller interface provided by adding this service as a controller to the host.
995
+ * See constructor for `this.host.addController(this)`
996
+ * You can read more about Lit reactive controllers here: https://lit.dev/docs/composition/controllers/
997
+ */
998
+ hostUpdated() {
999
+
1000
+ // Reset selection if multiSelect mode changes
1001
+ if (this.host.multiSelect !== this.multiSelect) {
1002
+ this.selectedOptions = [];
1003
+ }
1004
+
1005
+ // Update properties on host update
1006
+ this.setProperties({
1007
+ size: this.host.size,
1008
+ shape: this.host.shape,
1009
+ noCheckmark: this.host.noCheckmark,
1010
+ disabled: this.host.disabled,
1011
+ matchWord: this.host.matchWord,
1012
+ multiSelect: this.host.multiSelect,
1013
+ allowDeselect: this.host.allowDeselect,
1014
+ selectAllMatchingOptions: this.host.selectAllMatchingOptions
1015
+ });
1016
+ }
1017
+
1018
+ /**
1019
+ * Handles host disconnection and memory cleanup.
1020
+ */
1021
+ hostDisconnected() {
1022
+ this._subscribers = [];
1023
+ this._menuOptions = [];
1024
+ this._pendingValue = null;
1025
+ this._pendingRetryScheduled = false;
1026
+ this._pendingRetryCount = 0;
1027
+ }
1028
+
1029
+ /**
1030
+ * Sets a property value if it exists on the instance and the value has changed.
1031
+ * @param {string} property
1032
+ * @param {any} value
1033
+ */
1034
+ setProperty(property, value) {
1035
+
1036
+ // Only update if we are tracking the property in this service
1037
+ if (this.hasOwnProperty(property)) {
1038
+
1039
+ // Check if the value has changed
1040
+ const valueChanged = this[property] !== value;
1041
+
1042
+ // Update and notify if changed
1043
+ if (valueChanged) {
1044
+ this[property] = value;
1045
+ this.notify({ property, value });
1046
+ }
1047
+ }
1048
+ }
1049
+
1050
+ /**
1051
+ * Sets multiple properties on the instance.
1052
+ * @param {Object} properties - Key-value pairs of properties to set.
1053
+ */
1054
+ setProperties(properties) {
1055
+ for (const [key, value] of Object.entries(properties)) {
1056
+ this.setProperty(key, value);
1057
+ }
1058
+ }
1059
+
1060
+ /**
1061
+ * MENU OPTION HIGHLIGHTING
1062
+ */
1063
+
1064
+ /**
1065
+ * Highlights the next active option in the menu.
1066
+ */
1067
+ highlightNext() {
1068
+ this.moveHighlightedOption("next");
1069
+ }
1070
+
1071
+ /**
1072
+ * Highlights the previous active option in the menu.
1073
+ */
1074
+ highlightPrevious() {
1075
+ this.moveHighlightedOption("previous");
1076
+ }
1077
+
1078
+ /**
1079
+ * Moves the highlighted option in the specified direction.
1080
+ * @param {string} direction - The direction to move the highlight ("next" or "previous").
1081
+ */
1082
+ moveHighlightedOption(direction) {
1083
+
1084
+ // Get the active options
1085
+ const activeOptions = this._menuOptions.filter(option => option.isActive);
1086
+
1087
+ // Get the currently active option
1088
+ const currentActiveOption = activeOptions[activeOptions.indexOf(this.highlightedOption)];
1089
+
1090
+ // Determine the new index based on the currently active option and direction
1091
+ let newIndex = currentActiveOption
1092
+ ? direction === "previous"
1093
+ ? activeOptions.indexOf(currentActiveOption) - 1
1094
+ : activeOptions.indexOf(currentActiveOption) + 1
1095
+ : direction === "previous"
1096
+ ? activeOptions.length - 1
1097
+ : 0;
1098
+
1099
+ // Wrap around the index if needed
1100
+ newIndex = newIndex < 0 ? activeOptions.length - 1 : newIndex >= activeOptions.length ? 0 : newIndex;
1101
+
1102
+ // Get the new active option and set it as highlighted
1103
+ const newActiveOption = activeOptions[newIndex];
1104
+ this.setHighlightedOption(newActiveOption);
1105
+ }
1106
+
1107
+ /**
1108
+ * Sets the highlighted index to the specified option.
1109
+ * @param {AuroMenuOption} option - The option to highlight.
1110
+ */
1111
+ setHighlightedOption(option) {
1112
+
1113
+ if (!option) return;
1114
+
1115
+ // Get the index of the option to highlight
1116
+ const index = this._menuOptions.indexOf(option);
1117
+
1118
+ // Update highlighted index
1119
+ this.highlightedIndex = index;
1120
+
1121
+ // Notify subscribers of highlight change
1122
+ this.notify({ type: 'highlightChange', option, index: this.highlightedIndex });
1123
+
1124
+ // Dispatch the change event
1125
+ this.dispatchChangeEvent('auroMenu-activatedOption', option);
1126
+ }
1127
+
1128
+ /**
1129
+ * Sets the highlighted option to the option at the specified index if it exists.
1130
+ * @param {number} index
1131
+ */
1132
+ setHighlightedIndex(index) {
1133
+ const option = this._menuOptions[index] || null;
1134
+ this.setHighlightedOption(option);
1135
+ }
1136
+
1137
+ /**
1138
+ * Selects the currently highlighted option.
1139
+ */
1140
+ selectHighlightedOption() {
1141
+ if (this.highlightedOption) {
1142
+ this.toggleOption(this.highlightedOption);
1143
+ }
1144
+ }
1145
+
1146
+ /**
1147
+ * SELECTION AND DESELECTION METHODS
1148
+ */
1149
+
1150
+ /**
1151
+ * Selects one or more options in a batch operation
1152
+ * @param {AuroMenuOption|AuroMenuOption[]} options - Single option or array of options to select
1153
+ */
1154
+ selectOptions(options) {
1155
+ let optionsToSelect = Array.isArray(options) ? options : [options];
1156
+
1157
+ // Filter out options that are inactive
1158
+ optionsToSelect = optionsToSelect.filter(option => option.isActive);
1159
+
1160
+ if (!optionsToSelect.length) return;
1161
+
1162
+ if (this.multiSelect) {
1163
+ this.selectedOptions = [...(this.selectedOptions || []), ...optionsToSelect];
1164
+ } else {
1165
+ // In single select mode, only take the last option
1166
+ this.selectedOptions = [optionsToSelect[optionsToSelect.length - 1]];
1167
+ }
1168
+
1169
+ this.stageUpdate();
1170
+ }
1171
+
1172
+ /**
1173
+ * Deselects one or more options in a batch operation
1174
+ * @param {AuroMenuOption|AuroMenuOption[]} options - Single option or array of options to deselect
1175
+ */
1176
+ deselectOptions(options) {
1177
+ const optionsToDeselect = Array.isArray(options) ? options : [options];
1178
+
1179
+ if (!optionsToDeselect.length) return;
1180
+
1181
+ // Check if deselection should be prevented
1182
+ const shouldPreventDeselect = !this.allowDeselect && !this.multiSelect;
1183
+ const isOnlySelectedOption = this.selectedOptions.length === 1 && optionsToDeselect.includes(this.selectedOptions[0]);
1184
+
1185
+ // Prevent deselecting the only selected option if not allowed
1186
+ if (shouldPreventDeselect && isOnlySelectedOption) {
1187
+ optionsToDeselect.forEach(option => {
1188
+ option.selected = true;
1189
+ });
1190
+ this.dispatchChangeEvent('auroMenu-deselectPrevented', {
1191
+ values: optionsToDeselect
1192
+ });
1193
+ return;
1194
+ }
1195
+
1196
+ const optionsSet = new Set(optionsToDeselect);
1197
+ this.selectedOptions = (this.selectedOptions || [])
1198
+ .filter(opt => !optionsSet.has(opt));
1199
+
1200
+ this.stageUpdate();
1201
+ }
1202
+
1203
+ /**
1204
+ * Selects a single option.
1205
+ * @param {AuroMenuOption} option
1206
+ */
1207
+ selectOption(option) {
1208
+ this.selectOptions(option);
1209
+ }
1210
+
1211
+ /**
1212
+ * Deselects a single option.
1213
+ * @param {AuroMenuOption} option
1214
+ */
1215
+ deselectOption(option) {
1216
+ this.deselectOptions(option);
1217
+ }
1218
+
1219
+ /**
1220
+ * Toggles the selection state of a single option.
1221
+ * @param {AuroMenuOption} option
1222
+ */
1223
+ toggleOption(option) {
1224
+ if (option.selected) {
1225
+ this.deselectOption(option);
1226
+ } else {
1227
+ this.selectOption(option);
1228
+ }
1229
+ }
1230
+
1231
+ /**
1232
+ * Selects options based on their value(s) when compared to a passed value or values.
1233
+ * Value or values are normalized to an array of strings that can be matched to option keys.
1234
+ * @param {string|number|Array<string|number>} value - The value(s) to select.
1235
+ */
1236
+ selectByValue(value) {
1237
+ const isEmptyValue = value === undefined ||
1238
+ value === null ||
1239
+ (Array.isArray(value) && value.length === 0) ||
1240
+ (typeof value === 'string' && value.trim() === '');
1241
+
1242
+ // Early exit for invalid/empty values
1243
+ if (isEmptyValue) {
1244
+ this.selectedOptions.forEach(opt => opt.selected = false);
1245
+ this.selectedOptions = [];
1246
+ return;
1247
+ }
1248
+
1249
+ // If an internal update cycle is still in progress, defer value application
1250
+ // rather than dropping it.
1251
+ if (this.internalUpdateInProgress || this.host.internalUpdateInProgress) {
1252
+ this.queuePendingValue(value);
1253
+ return;
1254
+ }
1255
+
1256
+ // Normalize values to array of strings
1257
+ const normalizedValues = this._getNormalizedValues(value);
1258
+
1259
+ // Validate for single-select mode
1260
+ let validatedValues = normalizedValues;
1261
+ if (normalizedValues.length > 1 && !this.multiSelect) {
1262
+ console.warn("MenuService - Multiple values provided for single-select menu. Only the first value will be selected.");
1263
+ validatedValues = [normalizedValues[0]];
1264
+ }
1265
+
1266
+ if (this._menuOptions.length === 0) {
1267
+ this.queuePendingValue(value);
1268
+ return;
1269
+ }
1270
+
1271
+ // Find matching options by comparing available options to validated values
1272
+ const trackedKeys = new Set();
1273
+ const optionsToSelect = this._menuOptions.filter(option => {
1274
+ const passesFilter = validatedValues.includes(option.key);
1275
+ const alreadyTracked = trackedKeys.has(option.key);
1276
+ const isActive = option.isActive;
1277
+
1278
+ trackedKeys.add(option.key);
1279
+
1280
+ // Include the option in the options to be selected if it passes the filter check and
1281
+ // either hasn't been tracked yet or selectAllMatchingOptions is true
1282
+ return isActive && passesFilter && (!alreadyTracked || (alreadyTracked && this.selectAllMatchingOptions));
1283
+ });
1284
+
1285
+ // Handle no matches: clear existing selection, but do not dispatch an intermediate
1286
+ // undefined value that can overwrite the host value in parent components.
1287
+ if (!optionsToSelect.length) {
1288
+ const hasUnresolvedKeys = this._menuOptions.some((option) => option.isActive && option.key == null);
1289
+
1290
+ if (hasUnresolvedKeys) {
1291
+ this.queuePendingValue(value);
1292
+ return;
1293
+ }
1294
+
1295
+ this.clearPendingValue();
1296
+
1297
+ if (this.selectedOptions.length > 0) {
1298
+ this.selectedOptions = [];
1299
+ }
1300
+
1301
+ // Always notify so the host resets any stale invalid value, even when
1302
+ // selectedOptions was already empty (e.g. double-clicking set-invalid).
1303
+ this.stageUpdate({ reason: 'no-match' });
1304
+
1305
+ // Dispatch failure event if no matches found
1306
+ if (validatedValues.length) {
1307
+ this.dispatchChangeEvent('auroMenu-selectValueFailure', {
1308
+ message: 'No matching options found for the provided value(s).',
1309
+ values: validatedValues
1310
+ });
1311
+ }
1312
+
1313
+ return;
1314
+ }
1315
+
1316
+ this.clearPendingValue();
1317
+
1318
+ if (this.optionsArraysMatch(optionsToSelect, this.selectedOptions)) {
1319
+ return;
1320
+ }
1321
+
1322
+ // Apply programmatic selection as a single transaction and emit one final state.
1323
+ this.selectedOptions = optionsToSelect;
1324
+ this.stageUpdate();
1325
+ }
1326
+
1327
+ /**
1328
+ * Queues a pending value and schedules a bounded retry.
1329
+ * @param {string|number|Array<string|number>} value - The value to retry.
1330
+ */
1331
+ queuePendingValue(value) {
1332
+ this._pendingValue = value;
1333
+
1334
+ if (this._pendingRetryScheduled || this._pendingRetryCount >= 5) {
1335
+ return;
1336
+ }
1337
+
1338
+ this._pendingRetryScheduled = true;
1339
+ this._pendingRetryCount += 1;
1340
+
1341
+ setTimeout(() => {
1342
+ this._pendingRetryScheduled = false;
1343
+
1344
+ if (this._pendingValue == null) {
1345
+ return;
1346
+ }
1347
+
1348
+ const pendingValue = this._pendingValue;
1349
+ this.selectByValue(pendingValue);
1350
+ }, 0);
1351
+ }
1352
+
1353
+ /**
1354
+ * Clears pending retry state.
1355
+ */
1356
+ clearPendingValue() {
1357
+ this._pendingValue = null;
1358
+ this._pendingRetryScheduled = false;
1359
+ this._pendingRetryCount = 0;
1360
+ }
1361
+
1362
+ /**
1363
+ * Resets the selected options to an empty array.
1364
+ */
1365
+ reset() {
1366
+ const previousOptions = [...this.selectedOptions];
1367
+ previousOptions.forEach(opt => opt.selected = false);
1368
+ this.selectedOptions = [];
1369
+
1370
+ // Single update after clearing all
1371
+ if (previousOptions.length) {
1372
+ this.stageUpdate();
1373
+ }
1374
+ }
1375
+
1376
+ /**
1377
+ * SUBSCRIPTION, NOTIFICATION AND EVENT DISPATCH METHODS
1378
+ */
1379
+
1380
+ /**
1381
+ * Subscribes a callback to menu service events.
1382
+ * @param {Function} callback - The callback to invoke on events.
1383
+ */
1384
+ subscribe(callback) {
1385
+ this._subscribers.push(callback);
1386
+ }
1387
+
1388
+ /**
1389
+ * Remove a previously subscribed callback from menu service events.
1390
+ * @param {Function} callback
1391
+ */
1392
+ unsubscribe(callback) {
1393
+ this._subscribers = this._subscribers.filter(cb => cb !== callback);
1394
+ }
1395
+
1396
+ /**
1397
+ * Stages an update to notify subscribers of state and value changes.
1398
+ */
1399
+ stageUpdate(meta = {}) {
1400
+ this.notifyStateChange(meta);
1401
+ this.notifyValueChange(meta);
1402
+ }
1403
+
1404
+ /**
1405
+ * Notifies subscribers of a menu service event.
1406
+ * All notifications are sent to all subscribers.
1407
+ * @param {string} event - The event to send to subscribers.
1408
+ */
1409
+ notify(event) {
1410
+ this._subscribers.forEach(callback => callback(event));
1411
+ }
1412
+
1413
+ /**
1414
+ * Notifies subscribers of a state change (selected options has changed).
1415
+ */
1416
+ notifyStateChange(meta = {}) {
1417
+ this.notify({
1418
+ type: 'stateChange',
1419
+ selectedOptions: this.selectedOptions,
1420
+ ...meta
1421
+ });
1422
+ }
1423
+
1424
+ /**
1425
+ * Notifies subscribers of a value change (current value has changed).
1426
+ */
1427
+ notifyValueChange(meta = {}) {
1428
+
1429
+ // Prepare details for the event
1430
+ const details = {
1431
+ value: this.currentValue,
1432
+ stringValue: this.stringValue,
1433
+ keys: this.currentKeys,
1434
+ options: this.selectedOptions,
1435
+ label: this.currentLabel
1436
+ };
1437
+
1438
+ // If only one option is selected, include its index
1439
+ if (this.selectedOptions.length === 1) details.index = this._menuOptions.indexOf(this.selectedOptions[0]);
1440
+
1441
+ this.notify({
1442
+ type: 'valueChange',
1443
+ ...meta,
1444
+ ...details
1445
+ });
1446
+ }
1447
+
1448
+ /**
1449
+ * Dispatches a custom event from the host element.
1450
+ * @param {string} eventName
1451
+ * @param {any} detail
1452
+ */
1453
+ dispatchChangeEvent(eventName, detail) {
1454
+ this.host.dispatchEvent(new CustomEvent(eventName, {
1455
+ bubbles: true,
1456
+ cancelable: false,
1457
+ composed: true,
1458
+ detail
1459
+ }));
1460
+ }
1461
+
1462
+ /**
1463
+ * MENU OPTION MANAGEMENT METHODS
1464
+ */
1465
+
1466
+ /**
1467
+ * Adds a menu option to the service's list.
1468
+ * @param {AuroMenuOption} option - the option to track
1469
+ */
1470
+ addMenuOption(option) {
1471
+ this._menuOptions.push(option);
1472
+ this.notify({ type: 'optionsChange', options: this._menuOptions });
1473
+
1474
+ if (this._pendingValue != null) {
1475
+ this.queuePendingValue(this._pendingValue);
1476
+ }
1477
+ }
1478
+
1479
+ /**
1480
+ * Removes a menu option from the service's list.
1481
+ * @param {AuroMenuOption} option - the option to remove
1482
+ */
1483
+ removeMenuOption(option) {
1484
+ this._menuOptions = this._menuOptions.filter(opt => opt !== option);
1485
+ this.notify({ type: 'optionsChange', options: this._menuOptions });
1486
+
1487
+ if (this._menuOptions.length === 0) {
1488
+ this.clearPendingValue();
1489
+ }
1490
+ }
1491
+
1492
+ /**
1493
+ * UTILITIES
1494
+ */
1495
+
1496
+ /**
1497
+ * Normalizes a value or array of values into an array of strings for option selection.
1498
+ * This function ensures that input values are consistently formatted for matching menu options.
1499
+ *
1500
+ * @param {string|number|Array<string|number>} value - The value(s) to normalize.
1501
+ * @returns {Array<string>} An array of string values suitable for option matching.
1502
+ * @throws {Error} If any value is not a string or number.
1503
+ */
1504
+ _getNormalizedValues(value) {
1505
+ let values = value;
1506
+
1507
+ // Handle JSON string and single value string input
1508
+ if (!Array.isArray(values) && typeof values === 'string') {
1509
+
1510
+ // Attempt to parse as JSON array
1511
+ try {
1512
+
1513
+ // Normalize single quotes to double quotes for JSON parsing
1514
+ // This will not handle complex cases but will cover basic usage
1515
+ const parseValue = values.replace(/'([^']*?)'/g, '"$1"');
1516
+
1517
+ // Attempt parse
1518
+ const parsed = JSON.parse(parseValue);
1519
+
1520
+ // Ensure parsed value is an array
1521
+ if (!Array.isArray(parsed)) throw new Error('Not an array');
1522
+
1523
+ // Set values to parsed array
1524
+ values = parsed;
1525
+ } catch (err) {
1526
+
1527
+ // If parsing fails, treat as single value
1528
+ values = [value];
1529
+ }
1530
+ }
1531
+
1532
+ // Handle a single number being passed
1533
+ if (typeof values === 'number') {
1534
+ values = [String(values)];
1535
+ }
1536
+
1537
+ // Coerce each value to string and validate types
1538
+ values.forEach((val, index) => {
1539
+
1540
+ // Throw an error for invalid value types
1541
+ if (typeof val !== 'string' && typeof val !== 'number') {
1542
+ throw new Error('Value contains invalid value type. Supported types are string and number.');
1543
+ }
1544
+
1545
+ // Convert numbers to strings for consistency
1546
+ if (typeof val === 'number') {
1547
+ values[index] = String(val);
1548
+ }
1549
+ });
1550
+
1551
+ // Return the resulting array of string values
1552
+ return values;
1553
+ }
1554
+
1555
+ /**
1556
+ * Returns whether two arrays of options contain the same elements.
1557
+ * @param {AuroMenuOption[]} arr1 - First array of options.
1558
+ * @param {AuroMenuOption[]} arr2 - Second array of options.
1559
+ * @returns {boolean} True if arrays match, false otherwise.
1560
+ */
1561
+ optionsArraysMatch(arr1, arr2) {
1562
+ if (arr1.length !== arr2.length) return false;
1563
+
1564
+ const set1 = new Set(arr1);
1565
+ const set2 = new Set(arr2);
1566
+
1567
+ for (let item of set1) {
1568
+ if (!set2.has(item)) {
1569
+ return false;
1570
+ }
1571
+ }
1572
+
1573
+ return true;
1574
+ }
1575
+ }
1576
+
1577
+ const MenuContext = createContext('menu-context');
1578
+
1579
+ /* eslint-disable no-underscore-dangle */
1580
+ // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
1581
+ // See LICENSE in the project root for license information.
1582
+
1583
+
1584
+
1585
+ /**
1586
+ * The `auro-menu` element provides users a way to select from a list of options.
1587
+ * @customElement auro-menu
1588
+ *
1589
+ * @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
1590
+ * @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
1591
+ * @event {CustomEvent<{ loading: boolean; hasLoadingPlaceholder: boolean; }>} auroMenu-loadingChange - Notifies when the loading attribute is changed.
1592
+ * @event {CustomEvent<any>} auroMenu-selectValueFailure - Notifies that an attempt to select a menuoption by matching a value has failed.
1593
+ * @event {CustomEvent<{ values: HTMLElement[] }>} auroMenu-deselectPrevented - Notifies that deselection was prevented and includes the affected options in `detail.values`.
1594
+ * @event {CustomEvent<any>} auroMenu-selectValueReset - Notifies that the component value has been reset.
1595
+ * @event {CustomEvent<any>} auroMenu-selectedOption - Notifies that a new menuoption selection has been made.
1596
+ * @slot loadingText - Text to show while loading attribute is set
1597
+ * @slot loadingIcon - Icon to show while loading attribute is set
1598
+ * @slot - Slot for insertion of menu options.
1599
+ */
1600
+
1601
+ /* eslint-disable max-lines */
1602
+
1603
+ class AuroMenu extends AuroElement {
1604
+
1605
+ constructor() {
1606
+ super();
1607
+
1608
+ // State properties (reactive)
1609
+
1610
+ /**
1611
+ * @private
1612
+ */
1613
+ this.shape = "box";
1614
+
1615
+ /**
1616
+ * @private
1617
+ */
1618
+ this.size = "sm";
1619
+
1620
+ // Value of the selected options
1621
+ this.value = undefined;
1622
+ // Currently selected option
1623
+ this.optionSelected = undefined;
1624
+ // String used for highlighting/filtering
1625
+ this.matchWord = undefined;
1626
+ // Hide the checkmark icon on selected options
1627
+ this.noCheckmark = false;
1628
+ // Currently active option
1629
+ this.optionActive = undefined;
1630
+ // Loading state
1631
+ this.loading = false;
1632
+ // Multi-select mode
1633
+ this.multiSelect = false;
1634
+ // Allow deselecting of menu options
1635
+ this.allowDeselect = false;
1636
+ // Select all matching options when setting value in multi-select mode
1637
+ this.selectAllMatchingOptions = false;
1638
+
1639
+ // Event Bindings
1640
+
1641
+ /**
1642
+ * @private
1643
+ */
1644
+ this.handleSlotChange = this.handleSlotChange.bind(this);
1645
+
1646
+ // Instance properties (non-reactive)
1647
+
1648
+ /**
1649
+ * @private
1650
+ */
1651
+ Object.assign(this, {
1652
+ // Root-level menu (true) or a nested submenu (false)
1653
+ rootMenu: true,
1654
+ // Currently focused/active menu item index
1655
+ _index: -1,
1656
+ // Nested menu spacer
1657
+ nestingSpacer: '<span class="nestingSpacer"></span>',
1658
+ // Loading indicator for slot elements
1659
+ loadingSlots: null,
1660
+ });
1661
+ }
1662
+
1663
+ static get properties() {
1664
+ return {
1665
+ ...super.properties,
1666
+
1667
+ /**
1668
+ * Allows deselecting an already selected option when clicked again in single-select mode.
1669
+ */
1670
+ allowDeselect: {
1671
+ type: Boolean,
1672
+ reflect: true,
1673
+ },
1674
+
1675
+ /**
1676
+ * When true, the entire menu and all options are disabled.
1677
+ */
1678
+ disabled: {
1679
+ type: Boolean,
1680
+ reflect: true
1681
+ },
1682
+
1683
+ /**
1684
+ * Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
1685
+ */
1686
+ hasLoadingPlaceholder: {
1687
+ type: Boolean
1688
+ },
1689
+
1690
+ /**
1691
+ * @private
1692
+ */
1693
+ layout: {
1694
+ type: String
1695
+ },
1696
+
1697
+ /**
1698
+ * Indent level for submenus.
1699
+ * @private
1700
+ */
1701
+ level: {
1702
+ type: Number,
1703
+ reflect: false,
1704
+ attribute: false
1705
+ },
1706
+
1707
+ /**
1708
+ * When true, displays a loading state using the loadingIcon and loadingText slots if provided.
1709
+ */
1710
+ loading: {
1711
+ type: Boolean,
1712
+ reflect: true
1713
+ },
1714
+
1715
+ /**
1716
+ * Specifies a string used to highlight matched string parts in options.
1717
+ */
1718
+ matchWord: {
1719
+ type: String,
1720
+ attribute: 'matchword'
1721
+ },
1722
+
1723
+ /**
1724
+ * When true, the selected option can be multiple options.
1725
+ */
1726
+ multiSelect: {
1727
+ type: Boolean,
1728
+ reflect: true,
1729
+ attribute: 'multiselect'
1730
+ },
1731
+
1732
+ /**
1733
+ * When true, selected option will not show the checkmark.
1734
+ */
1735
+ noCheckmark: {
1736
+ type: Boolean,
1737
+ reflect: true,
1738
+ attribute: 'nocheckmark'
1739
+ },
1740
+
1741
+ /**
1742
+ * Specifies the current active menuOption.
1743
+ */
1744
+ optionActive: {
1745
+ type: Object,
1746
+ attribute: 'optionactive'
1747
+ },
1748
+
1749
+ /**
1750
+ * An array of currently selected menu options, type `HTMLElement` by default. In multi-select mode, `optionSelected` is an array of HTML elements.
1751
+ */
1752
+ optionSelected: {
1753
+ // Allow HTMLElement, HTMLElement[] arrays and undefined
1754
+ type: Object
1755
+ },
1756
+
1757
+ /**
1758
+ * Available menu options.
1759
+ * @readonly
1760
+ */
1761
+ options: {
1762
+ type: Array,
1763
+ reflect: false,
1764
+ attribute: false
1765
+ },
1766
+
1767
+ /**
1768
+ * Sets the size of the menu.
1769
+ * @type {'sm' | 'md'}
1770
+ * @default 'sm'
1771
+ */
1772
+ size: {
1773
+ type: String,
1774
+ reflect: true
1775
+ },
1776
+
1777
+ /**
1778
+ * When true, selects all options that match the provided value/key when setting value and multiselect is enabled.
1779
+ */
1780
+ selectAllMatchingOptions: {
1781
+ type: Boolean,
1782
+ reflect: true,
1783
+ },
1784
+
1785
+ /**
1786
+ * Sets the shape of the menu.
1787
+ * @type {'box' | 'round'}
1788
+ * @default 'box'
1789
+ */
1790
+ shape: {
1791
+ type: String,
1792
+ reflect: true
1793
+ },
1794
+
1795
+ /**
1796
+ * The value of the selected option. In multi-select mode, this is a JSON stringified array of selected option values.
1797
+ */
1798
+ value: {
1799
+ type: String,
1800
+ reflect: true,
1801
+ attribute: 'value'
1802
+ }
1803
+ };
1804
+ }
1805
+
1806
+ static get styles() {
1807
+ return [
1808
+ styleCss$1,
1809
+ colorCss$1,
1810
+ tokensCss
1811
+ ];
1812
+ }
1813
+
1814
+ /**
1815
+ * @readonly
1816
+ * @returns {string} - Returns the label of the currently selected option(s).
1817
+ */
1818
+ get currentLabel() {
1819
+ return this.menuService.currentLabel;
1820
+ };
1821
+
1822
+ /**
1823
+ * @readonly
1824
+ * @returns {Array<HTMLElement>} - Returns the array of available menu options.
1825
+ * @deprecated Use `options` property instead.
1826
+ */
1827
+ get items() {
1828
+ return this.options;
1829
+ }
1830
+
1831
+ /**
1832
+ * @returns {number} - Returns the index of the currently active option.
1833
+ */
1834
+ get index() {
1835
+ return this._index;
1836
+ }
1837
+
1838
+ /**
1839
+ * @param {number} value - Sets the index of the currently active option.
1840
+ */
1841
+ set index(value) {
1842
+ this.menuService.setHighlightedIndex(value);
1843
+ }
1844
+
1845
+ /**
1846
+ * This will register this element with the browser.
1847
+ * @param {string} [name="auro-menu"] - The name of the element that you want to register.
1848
+ *
1849
+ * @example
1850
+ * AuroMenu.register("custom-menu") // this will register this element to <custom-menu/>
1851
+ *
1852
+ */
1853
+ static register(name = "auro-menu") {
1854
+ AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenu);
1855
+ }
1856
+
1857
+ /**
1858
+ * Formatted value based on `multiSelect` state.
1859
+ * Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
1860
+ * @private
1861
+ * @returns {String|Array<String>}
1862
+ */
1863
+ get formattedValue() {
1864
+ return this.menuService.currentValue;
1865
+ }
1866
+
1867
+ /**
1868
+ * Gets the current property values for the menu service.
1869
+ * @private
1870
+ * @returns {Object}
1871
+ */
1872
+ get propertyValues() {
1873
+ return {
1874
+ size: this.size,
1875
+ shape: this.shape,
1876
+ noCheckmark: this.nocheckmark,
1877
+ disabled: this.disabled
1878
+ };
1879
+ }
1880
+
1881
+ /**
1882
+ * Provides the menu context to child components.
1883
+ * Initializes the MenuService and subscribes to menu changes.
1884
+ * @protected
1885
+ */
1886
+ provideContext() {
1887
+ if (this.parentElement && this.parentElement.closest('auro-menu, [auro-menu]')) {
1888
+ this.rootMenu = false;
1889
+ this.menuService = this.parentElement.menuService;
1890
+ this._contextProvider = this.parentElement._contextProvider;
1891
+ return;
1892
+ }
1893
+
1894
+ this.menuService = new MenuService({host: this});
1895
+ this.menuService.setProperties(this.propertyValues);
1896
+ this.menuService.subscribe(this.handleMenuChange.bind(this));
1897
+ this._contextProvider = new ContextProvider(this, {
1898
+ context: MenuContext,
1899
+ initialValue: this.menuService
1900
+ });
1901
+ }
1902
+
1903
+ /**
1904
+ * Updates the currently active option in the menu.
1905
+ * @param {HTMLElement} option - The option to set as active.
1906
+ */
1907
+ updateActiveOption(option) {
1908
+ this.menuService.setHighlightedOption(option);
1909
+ }
1910
+
1911
+ /**
1912
+ * Sets the internal value and manages update state.
1913
+ * @param {String|Array<String>} value - The value to set.
1914
+ * @protected
1915
+ */
1916
+ setInternalValue(value) {
1917
+ if (this.value !== value) {
1918
+ this.internalUpdateInProgress = true;
1919
+ this.value = value;
1920
+
1921
+ setTimeout(() => {
1922
+ this.internalUpdateInProgress = false;
1923
+ });
1924
+ }
1925
+ }
1926
+
1927
+ /**
1928
+ * Handles changes from the menu service and updates component state.
1929
+ * @param {Object} event - The event object from the menu service.
1930
+ * @protected
1931
+ */
1932
+ handleMenuChange(event) {
1933
+ if (event.type === 'valueChange') {
1934
+
1935
+ // New option is array value or first option with fallback to undefined for empty array in all cases
1936
+ const newOption = this.multiSelect && event.options.length ? event.options : event.options[0] || undefined;
1937
+ const newValue = event.stringValue;
1938
+
1939
+ // Check if the option or value has actually changed
1940
+ if (this.optionSelected !== newOption || this.stringValue !== newValue) {
1941
+ this.optionSelected = newOption;
1942
+ this.setInternalValue(newValue);
1943
+ }
1944
+
1945
+ // Notify components of selection change
1946
+ this.notifySelectionChange(event);
1947
+ }
1948
+
1949
+ if (event.type === 'highlightChange') {
1950
+ this.optionActive = event.option;
1951
+ this._index = event.index;
1952
+ }
1953
+
1954
+ if (event.type === 'optionsChange') {
1955
+ this.options = event.options;
1956
+ this.dispatchEvent(new CustomEvent('auroMenu-optionsChange', {
1957
+ detail: {
1958
+ options: event.options
1959
+ }
1960
+ }));
1961
+ }
1962
+ }
1963
+
1964
+ /**
1965
+ * Gets the currently selected options.
1966
+ * @returns {Array<HTMLElement>}
1967
+ */
1968
+ get selectedOptions() {
1969
+ return this.menuService ? this.menuService.selectedOptions : [];
1970
+ }
1971
+
1972
+ /**
1973
+ * Gets the first selected option, or null if none.
1974
+ * @returns {HTMLElement|null}
1975
+ */
1976
+ get selectedOption() {
1977
+ return this.menuService ? this.menuService.selectedOptions[0] : null;
1978
+ }
1979
+
1980
+ // Lifecycle Methods
1981
+
1982
+ connectedCallback() {
1983
+ super.connectedCallback();
1984
+
1985
+ this.provideContext();
1986
+
1987
+ // this.addEventListener('keydown', this.handleKeyDown);
1988
+ this.addEventListener('auroMenuOption-click', this.handleMouseSelect);
1989
+ this.addEventListener('auroMenuOption-mouseover', this.handleOptionHover);
1990
+ this.addEventListener('slotchange', this.handleSlotChange);
1991
+ this.setTagAttribute("auro-menu");
1992
+ }
1993
+
1994
+ disconnectedCallback() {
1995
+ // this.removeEventListener('keydown', this.handleKeyDown);
1996
+ this.removeEventListener('auroMenuOption-click', this.handleMouseSelect);
1997
+ this.removeEventListener('auroMenuOption-mouseover', this.handleOptionHover);
1998
+ this.removeEventListener('slotchange', this.handleSlotChange);
1999
+
2000
+ super.disconnectedCallback();
2001
+ }
2002
+
2003
+ firstUpdated() {
2004
+ AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-menu');
2005
+
2006
+ this.loadingSlots = this.querySelectorAll("[slot='loadingText'], [slot='loadingIcon']");
2007
+ this.initializeMenu();
2008
+ }
2009
+
2010
+
2011
+ updated(changedProperties) {
2012
+ super.updated(changedProperties);
2013
+
2014
+ // Apply value selection synchronously so that static-HTML fixtures
2015
+ // resolve within a single update cycle. The refactored selectByValue
2016
+ // no longer calls reset() first, so the destructive intermediate-event
2017
+ // cascade that originally required deferral is eliminated. If option
2018
+ // keys are not yet resolved (framework mount-order race), selectByValue
2019
+ // queues a bounded retry automatically via queuePendingValue.
2020
+ if (changedProperties.has('value') && !this.internalUpdateInProgress) {
2021
+ this.menuService.selectByValue(this.value);
2022
+ }
2023
+
2024
+ // Handle loading state changes
2025
+ if (changedProperties.has('loading')) {
2026
+ this.setLoadingState(this.loading);
2027
+ }
2028
+
2029
+ if (changedProperties.has('multiSelect') && this.rootMenu) {
2030
+ if (this.multiSelect) {
2031
+ this.setAttribute('aria-multiselectable', 'true');
2032
+ } else {
2033
+ this.removeAttribute('aria-multiselectable');
2034
+ }
2035
+ }
2036
+ }
2037
+
2038
+ /**
2039
+ * Sets an attribute that matches the default tag name if the tag name is not the default.
2040
+ * @param {string} tagName - The tag name to set as an attribute.
2041
+ * @private
2042
+ */
2043
+ setTagAttribute(tagName) {
2044
+ if (this.tagName.toLowerCase() !== tagName) {
2045
+ this.setAttribute(tagName, true);
2046
+ }
2047
+ }
2048
+
2049
+ /**
2050
+ * Sets the loading state and dispatches a loading change event.
2051
+ * @param {boolean} isLoading - Whether the menu is loading.
2052
+ * @protected
2053
+ */
2054
+ setLoadingState(isLoading) {
2055
+ this.setAttribute("aria-busy", isLoading);
2056
+ dispatchMenuEvent(this, "auroMenu-loadingChange", {
2057
+ loading: isLoading,
2058
+ hasLoadingPlaceholder: this.hasLoadingPlaceholder
2059
+ });
2060
+ }
2061
+
2062
+ // Init Methods
2063
+
2064
+ /**
2065
+ * Initializes the menu's state and structure.
2066
+ * @private
2067
+ */
2068
+ initializeMenu() {
2069
+ if (this.rootMenu) {
2070
+ this.setAttribute('role', 'listbox');
2071
+ this.setAttribute('root', '');
2072
+
2073
+ if (this.multiSelect) {
2074
+ this.setAttribute('aria-multiselectable', 'true');
2075
+ }
2076
+ }
2077
+
2078
+ this.handleNestedMenus(this);
2079
+ }
2080
+
2081
+ /**
2082
+ * Selects the currently highlighted option.
2083
+ * @protected
2084
+ */
2085
+ makeSelection() {
2086
+ this.menuService.selectHighlightedOption();
2087
+ }
2088
+
2089
+ /**
2090
+ * Resets all options to their default state.
2091
+ * @private
2092
+ */
2093
+ clearSelection() {
2094
+ this.optionSelected = undefined;
2095
+ this.value = undefined;
2096
+ this._index = -1;
2097
+ }
2098
+
2099
+ /**
2100
+ * Resets the menu to its initial state.
2101
+ * This is the only way to return value to undefined.
2102
+ * @public
2103
+ */
2104
+ reset() {
2105
+ this.menuService.reset();
2106
+
2107
+ // Dispatch reset event
2108
+ dispatchMenuEvent(this, 'auroMenu-selectValueReset');
2109
+ }
2110
+
2111
+ /**
2112
+ * Handles nested menu structure.
2113
+ * @private
2114
+ * @param {HTMLElement} menu - Root menu element.
2115
+ */
2116
+ handleNestedMenus(menu) {
2117
+ menu.level = menu.parentElement.level >= 0 ? menu.parentElement.level + 1 : 0;
2118
+
2119
+ if (menu.level > 0) {
2120
+ menu.setAttribute('role', 'group');
2121
+ menu.removeAttribute("root");
2122
+ if (!menu.hasAttribute('aria-label')) {
2123
+ menu.setAttribute('aria-label', 'submenu');
2124
+ }
2125
+ }
2126
+
2127
+ const options = menu.querySelectorAll(':scope > auro-menuoption, :scope > [auro-menuoption]');
2128
+ options.forEach((option) => {
2129
+ const regex = new RegExp(this.nestingSpacer, "gu");
2130
+ option.innerHTML = this.nestingSpacer.repeat(menu.level) + option.innerHTML.replace(regex, '');
2131
+ });
2132
+ }
2133
+
2134
+ /**
2135
+ * Navigates the menu options in the specified direction.
2136
+ * @param {'up'|'down'} direction - The direction to navigate.
2137
+ * @protected
2138
+ */
2139
+ navigateOptions(direction) {
2140
+ if (direction === 'up') {
2141
+ this.menuService.highlightPrevious();
2142
+ } else if (direction === 'down') {
2143
+ this.menuService.highlightNext();
2144
+ }
2145
+ }
2146
+
2147
+ /**
2148
+ * Handles slot change events.
2149
+ * @private
2150
+ */
2151
+ handleSlotChange() {
2152
+ if (this.rootMenu) {
2153
+ this.initializeMenu();
2154
+ }
2155
+ }
2156
+
2157
+ /**
2158
+ * Handles custom events defined on options.
2159
+ * @private
2160
+ * @param {HTMLElement} option - Option with custom event.
2161
+ */
2162
+ handleCustomEvent(option) {
2163
+ const eventName = option.getAttribute('event');
2164
+ dispatchMenuEvent(this, eventName);
2165
+ dispatchMenuEvent(this, 'auroMenu-customEventFired');
2166
+ }
2167
+
2168
+ /**
2169
+ * Notifies selection change to parent components.
2170
+ * @param {any} source - The source that triggers this event.
2171
+ * @private
2172
+ */
2173
+ notifySelectionChange({value, stringValue, keys, options, reason} = {}) {
2174
+ dispatchMenuEvent(this, 'auroMenu-selectedOption', {
2175
+ value,
2176
+ stringValue,
2177
+ keys,
2178
+ options,
2179
+ reason
2180
+ });
2181
+ }
2182
+
2183
+ /**
2184
+ * Checks if an option is currently selected.
2185
+ * @private
2186
+ * @param {HTMLElement} option - The option to check.
2187
+ * @returns {boolean}
2188
+ */
2189
+ isOptionSelected(option) {
2190
+ if (!this.optionSelected) {
2191
+ return false;
2192
+ }
2193
+
2194
+ if (this.multiSelect) {
2195
+ // In multi-select mode, check if the option is in the selected array
2196
+ return Array.isArray(this.optionSelected) && this.optionSelected.some((selectedOption) => selectedOption === option);
2197
+ }
2198
+
2199
+ return this.optionSelected === option;
2200
+ }
2201
+
2202
+ /**
2203
+ * Getter for loading placeholder state.
2204
+ * @returns {boolean} - True if loading slots are present and non-empty.
2205
+ */
2206
+ get hasLoadingPlaceholder() {
2207
+ return this.loadingSlots && this.loadingSlots.length > 0;
2208
+ }
2209
+
2210
+ /**
2211
+ * Getter for wrapper classes based on size.
2212
+ * @returns {Object} - Class map for the wrapper element.
2213
+ * @private
2214
+ */
2215
+ get wrapperClasses() {
2216
+ return classMap({
2217
+ 'menuWrapper': true,
2218
+ [this.size]: true,
2219
+ });
2220
+ }
2221
+
2222
+ /**
2223
+ * Logic to determine the layout of the component.
2224
+ * @protected
2225
+ * @returns {void}
2226
+ */
2227
+ renderLayout() {
2228
+ if (this.loading) {
2229
+ return html`
2230
+ <div class="${this.wrapperClasses}">
2231
+ <auro-menuoption
2232
+ disabled
2233
+ loadingplaceholder
2234
+ class="${this.hasLoadingPlaceholder ? "" : "empty"}"
2235
+ >
2236
+ <div>
2237
+ <slot name="loadingIcon" class="body-lg"></slot>
2238
+ <slot name="loadingText"></slot>
2239
+ </div>
2240
+ </auro-menuoption>
2241
+ </div>
2242
+ `;
2243
+ }
2244
+
2245
+ return html`
2246
+ <div class="${this.wrapperClasses}">
2247
+ <slot @slotchange=${this.handleSlotChange}></slot>
2248
+ </div>
2249
+ `;
2250
+ }
2251
+ }
2252
+
2253
+ export { AuroMenu, AuroMenuOption, arrayConverter, dispatchMenuEvent, isOptionInteractive };