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