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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/README.md +87 -113
  3. package/components/combobox/demo/keyboardBehavior.html +81 -0
  4. package/components/counter/demo/keyboardBehavior.html +81 -0
  5. package/components/datepicker/demo/keyboard-behavior.html +81 -0
  6. package/components/dropdown/demo/keyboardBehavior.html +81 -0
  7. package/components/select/demo/keyboardBehavior.html +81 -0
  8. package/package.json +64 -53
  9. package/components/bibtemplate/dist/auro-bibtemplate.d.ts +0 -66
  10. package/components/bibtemplate/dist/buttonVersion.d.ts +0 -2
  11. package/components/bibtemplate/dist/headerVersion.d.ts +0 -2
  12. package/components/bibtemplate/dist/iconVersion.d.ts +0 -2
  13. package/components/bibtemplate/dist/index.d.ts +0 -2
  14. package/components/bibtemplate/dist/index.js +0 -395
  15. package/components/bibtemplate/dist/registered.js +0 -395
  16. package/components/bibtemplate/dist/styles/color-css.d.ts +0 -2
  17. package/components/bibtemplate/dist/styles/style-css.d.ts +0 -2
  18. package/components/bibtemplate/dist/styles/tokens-css.d.ts +0 -2
  19. package/components/checkbox/demo/api.md +0 -489
  20. package/components/checkbox/demo/api.min.js +0 -2133
  21. package/components/checkbox/demo/index.md +0 -55
  22. package/components/checkbox/demo/index.min.js +0 -2108
  23. package/components/checkbox/demo/readme.md +0 -142
  24. package/components/checkbox/dist/auro-checkbox-group.d.ts +0 -176
  25. package/components/checkbox/dist/auro-checkbox.d.ts +0 -209
  26. package/components/checkbox/dist/index.d.ts +0 -3
  27. package/components/checkbox/dist/index.js +0 -2057
  28. package/components/checkbox/dist/registered.js +0 -2058
  29. package/components/checkbox/dist/styles/auro-checkbox-css.d.ts +0 -2
  30. package/components/checkbox/dist/styles/auro-checkbox-group-css.d.ts +0 -2
  31. package/components/checkbox/dist/styles/color-css.d.ts +0 -2
  32. package/components/checkbox/dist/styles/colorGroup-css.d.ts +0 -2
  33. package/components/checkbox/dist/styles/tokens-css.d.ts +0 -2
  34. package/components/combobox/demo/api.md +0 -2287
  35. package/components/combobox/demo/api.min.js +0 -17549
  36. package/components/combobox/demo/index.md +0 -196
  37. package/components/combobox/demo/index.min.js +0 -17454
  38. package/components/combobox/demo/readme.md +0 -158
  39. package/components/combobox/dist/auro-combobox.d.ts +0 -552
  40. package/components/combobox/dist/comboboxKeyboardStrategy.d.ts +0 -6
  41. package/components/combobox/dist/index.d.ts +0 -2
  42. package/components/combobox/dist/index.js +0 -15474
  43. package/components/combobox/dist/registered.js +0 -15476
  44. package/components/combobox/dist/styles/emphasized/style-css.d.ts +0 -2
  45. package/components/combobox/dist/styles/snowflake/style-css.d.ts +0 -2
  46. package/components/combobox/dist/styles/style-css.d.ts +0 -2
  47. package/components/counter/demo/api.md +0 -1285
  48. package/components/counter/demo/api.min.js +0 -7993
  49. package/components/counter/demo/index.md +0 -92
  50. package/components/counter/demo/index.min.js +0 -7974
  51. package/components/counter/demo/readme.md +0 -161
  52. package/components/counter/dist/auro-counter-button.d.ts +0 -14
  53. package/components/counter/dist/auro-counter-group.d.ts +0 -390
  54. package/components/counter/dist/auro-counter-wrapper.d.ts +0 -17
  55. package/components/counter/dist/auro-counter.d.ts +0 -126
  56. package/components/counter/dist/buttonVersion.d.ts +0 -2
  57. package/components/counter/dist/iconVersion.d.ts +0 -2
  58. package/components/counter/dist/index.d.ts +0 -3
  59. package/components/counter/dist/index.js +0 -7896
  60. package/components/counter/dist/registered.js +0 -7897
  61. package/components/counter/dist/styles/color-css.d.ts +0 -2
  62. package/components/counter/dist/styles/counter-button-color-css.d.ts +0 -2
  63. package/components/counter/dist/styles/counter-button-css.d.ts +0 -2
  64. package/components/counter/dist/styles/counter-group-css.d.ts +0 -2
  65. package/components/counter/dist/styles/counter-wrapper-color-css.d.ts +0 -2
  66. package/components/counter/dist/styles/counter-wrapper-css.d.ts +0 -2
  67. package/components/counter/dist/styles/shapeSize-css.d.ts +0 -2
  68. package/components/counter/dist/styles/style-css.d.ts +0 -2
  69. package/components/counter/dist/styles/tokens-css.d.ts +0 -2
  70. package/components/datepicker/demo/api.md +0 -1824
  71. package/components/datepicker/demo/api.min.js +0 -24530
  72. package/components/datepicker/demo/index.md +0 -158
  73. package/components/datepicker/demo/index.min.js +0 -24251
  74. package/components/datepicker/demo/readme.md +0 -137
  75. package/components/datepicker/dist/auro-calendar-cell.d.ts +0 -169
  76. package/components/datepicker/dist/auro-calendar-month.d.ts +0 -20
  77. package/components/datepicker/dist/auro-calendar.d.ts +0 -173
  78. package/components/datepicker/dist/auro-datepicker.d.ts +0 -722
  79. package/components/datepicker/dist/buttonVersion.d.ts +0 -2
  80. package/components/datepicker/dist/iconVersion.d.ts +0 -2
  81. package/components/datepicker/dist/index.d.ts +0 -2
  82. package/components/datepicker/dist/index.js +0 -24166
  83. package/components/datepicker/dist/popoverVersion.d.ts +0 -2
  84. package/components/datepicker/dist/registered.js +0 -24166
  85. package/components/datepicker/dist/styles/classic/color-css.d.ts +0 -2
  86. package/components/datepicker/dist/styles/classic/style-css.d.ts +0 -2
  87. package/components/datepicker/dist/styles/color-calendar-css.d.ts +0 -2
  88. package/components/datepicker/dist/styles/color-cell-css.d.ts +0 -2
  89. package/components/datepicker/dist/styles/color-css.d.ts +0 -2
  90. package/components/datepicker/dist/styles/color-month-css.d.ts +0 -2
  91. package/components/datepicker/dist/styles/shapeSize-css.d.ts +0 -2
  92. package/components/datepicker/dist/styles/snowflake/color-css.d.ts +0 -2
  93. package/components/datepicker/dist/styles/snowflake/style-css.d.ts +0 -2
  94. package/components/datepicker/dist/styles/style-auro-calendar-cell-css.d.ts +0 -2
  95. package/components/datepicker/dist/styles/style-auro-calendar-css.d.ts +0 -2
  96. package/components/datepicker/dist/styles/style-auro-calendar-month-css.d.ts +0 -2
  97. package/components/datepicker/dist/styles/style-css.d.ts +0 -2
  98. package/components/datepicker/dist/styles/tokens-css.d.ts +0 -2
  99. package/components/datepicker/dist/utilities.d.ts +0 -78
  100. package/components/datepicker/dist/utilitiesCalendar.d.ts +0 -38
  101. package/components/datepicker/dist/utilitiesCalendarRender.d.ts +0 -50
  102. package/components/datepicker/dist/vendor/wc-range-datepicker/day.d.ts +0 -5
  103. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-calendar.d.ts +0 -60
  104. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-cell.d.ts +0 -1
  105. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker.d.ts +0 -57
  106. package/components/dropdown/demo/api.md +0 -1358
  107. package/components/dropdown/demo/api.min.js +0 -4853
  108. package/components/dropdown/demo/index.md +0 -283
  109. package/components/dropdown/demo/index.min.js +0 -4788
  110. package/components/dropdown/demo/readme.md +0 -160
  111. package/components/dropdown/dist/auro-dropdown.d.ts +0 -482
  112. package/components/dropdown/dist/auro-dropdownBib.d.ts +0 -155
  113. package/components/dropdown/dist/iconVersion.d.ts +0 -2
  114. package/components/dropdown/dist/index.d.ts +0 -2
  115. package/components/dropdown/dist/index.js +0 -4685
  116. package/components/dropdown/dist/keyboardUtils.d.ts +0 -18
  117. package/components/dropdown/dist/registered.js +0 -4685
  118. package/components/dropdown/dist/styles/classic/bibColors-css.d.ts +0 -2
  119. package/components/dropdown/dist/styles/classic/bibStyles-css.d.ts +0 -2
  120. package/components/dropdown/dist/styles/classic/color-css.d.ts +0 -2
  121. package/components/dropdown/dist/styles/classic/style-css.d.ts +0 -2
  122. package/components/dropdown/dist/styles/color-css.d.ts +0 -2
  123. package/components/dropdown/dist/styles/emphasized/style-css.d.ts +0 -2
  124. package/components/dropdown/dist/styles/shapeSize-css.d.ts +0 -2
  125. package/components/dropdown/dist/styles/snowflake/style-css.d.ts +0 -2
  126. package/components/dropdown/dist/styles/style-css.d.ts +0 -2
  127. package/components/dropdown/dist/styles/tokens-css.d.ts +0 -2
  128. package/components/form/demo/api.md +0 -319
  129. package/components/form/demo/api.min.js +0 -69996
  130. package/components/form/demo/index.md +0 -128
  131. package/components/form/demo/index.min.js +0 -69996
  132. package/components/form/demo/readme.md +0 -145
  133. package/components/form/dist/auro-form.d.ts +0 -280
  134. package/components/form/dist/index.d.ts +0 -2
  135. package/components/form/dist/index.js +0 -718
  136. package/components/form/dist/registered.d.ts +0 -1
  137. package/components/form/dist/registered.js +0 -718
  138. package/components/form/dist/styles/style-css.d.ts +0 -2
  139. package/components/helptext/dist/auro-helptext.d.ts +0 -69
  140. package/components/helptext/dist/index.d.ts +0 -2
  141. package/components/helptext/dist/index.js +0 -231
  142. package/components/helptext/dist/registered.js +0 -231
  143. package/components/helptext/dist/styles/color-css.d.ts +0 -2
  144. package/components/helptext/dist/styles/style-css.d.ts +0 -2
  145. package/components/helptext/dist/styles/tokens-css.d.ts +0 -2
  146. package/components/input/demo/api.md +0 -1397
  147. package/components/input/demo/api.min.js +0 -7435
  148. package/components/input/demo/index.md +0 -161
  149. package/components/input/demo/index.min.js +0 -7355
  150. package/components/input/demo/readme.md +0 -134
  151. package/components/input/dist/auro-input.d.ts +0 -195
  152. package/components/input/dist/base-input.d.ts +0 -628
  153. package/components/input/dist/buttonVersion.d.ts +0 -2
  154. package/components/input/dist/i18n.d.ts +0 -18
  155. package/components/input/dist/iconVersion.d.ts +0 -2
  156. package/components/input/dist/index.d.ts +0 -2
  157. package/components/input/dist/index.js +0 -7278
  158. package/components/input/dist/registered.js +0 -7278
  159. package/components/input/dist/styles/classic/color-css.d.ts +0 -2
  160. package/components/input/dist/styles/classic/style-css.d.ts +0 -2
  161. package/components/input/dist/styles/color-css.d.ts +0 -2
  162. package/components/input/dist/styles/default/borders-css.d.ts +0 -2
  163. package/components/input/dist/styles/default/color-css.d.ts +0 -2
  164. package/components/input/dist/styles/default/mixins-css.d.ts +0 -2
  165. package/components/input/dist/styles/default/notificationIcons-css.d.ts +0 -2
  166. package/components/input/dist/styles/default/style-css.d.ts +0 -2
  167. package/components/input/dist/styles/emphasized/color-css.d.ts +0 -2
  168. package/components/input/dist/styles/emphasized/style-css.d.ts +0 -2
  169. package/components/input/dist/styles/mixins-css.d.ts +0 -2
  170. package/components/input/dist/styles/shapeSize-css.d.ts +0 -2
  171. package/components/input/dist/styles/snowflake/style-css.d.ts +0 -2
  172. package/components/input/dist/styles/style-css.d.ts +0 -2
  173. package/components/input/dist/styles/tokens-css.d.ts +0 -2
  174. package/components/input/dist/utilities.d.ts +0 -25
  175. package/components/layoutElement/dist/auroElement.d.ts +0 -40
  176. package/components/layoutElement/dist/index.d.ts +0 -2
  177. package/components/layoutElement/dist/index.js +0 -107
  178. package/components/layoutElement/dist/registered.js +0 -107
  179. package/components/menu/demo/api.md +0 -1200
  180. package/components/menu/demo/api.min.js +0 -2292
  181. package/components/menu/demo/index.md +0 -72
  182. package/components/menu/demo/index.min.js +0 -2185
  183. package/components/menu/demo/readme.md +0 -145
  184. package/components/menu/dist/auro-menu-utils.d.ts +0 -34
  185. package/components/menu/dist/auro-menu.context.d.ts +0 -227
  186. package/components/menu/dist/auro-menu.d.ts +0 -324
  187. package/components/menu/dist/auro-menuoption.d.ts +0 -210
  188. package/components/menu/dist/iconVersion.d.ts +0 -2
  189. package/components/menu/dist/index.d.ts +0 -4
  190. package/components/menu/dist/index.js +0 -2148
  191. package/components/menu/dist/registered.js +0 -2096
  192. package/components/menu/dist/styles/default/color-menu-css.d.ts +0 -2
  193. package/components/menu/dist/styles/default/color-menuoption-css.d.ts +0 -2
  194. package/components/menu/dist/styles/default/style-menu-css.d.ts +0 -2
  195. package/components/menu/dist/styles/default/style-menuoption-css.d.ts +0 -2
  196. package/components/menu/dist/styles/default/tokens-css.d.ts +0 -2
  197. package/components/radio/demo/api.md +0 -675
  198. package/components/radio/demo/api.min.js +0 -2210
  199. package/components/radio/demo/index.md +0 -73
  200. package/components/radio/demo/index.min.js +0 -2167
  201. package/components/radio/demo/readme.md +0 -141
  202. package/components/radio/dist/auro-radio-group.d.ts +0 -250
  203. package/components/radio/dist/auro-radio.d.ts +0 -180
  204. package/components/radio/dist/index.d.ts +0 -3
  205. package/components/radio/dist/index.js +0 -2116
  206. package/components/radio/dist/registered.js +0 -2117
  207. package/components/radio/dist/styles/auro-radio-group-css.d.ts +0 -2
  208. package/components/radio/dist/styles/color-css.d.ts +0 -2
  209. package/components/radio/dist/styles/groupColor-css.d.ts +0 -2
  210. package/components/radio/dist/styles/style-css.d.ts +0 -2
  211. package/components/radio/dist/styles/tokens-css.d.ts +0 -2
  212. package/components/select/demo/api.md +0 -2378
  213. package/components/select/demo/api.min.js +0 -10133
  214. package/components/select/demo/index.md +0 -355
  215. package/components/select/demo/index.min.js +0 -10040
  216. package/components/select/demo/readme.md +0 -148
  217. package/components/select/dist/auro-select.d.ts +0 -545
  218. package/components/select/dist/index.d.ts +0 -2
  219. package/components/select/dist/index.js +0 -8072
  220. package/components/select/dist/registered.js +0 -8072
  221. package/components/select/dist/selectKeyboardStrategy.d.ts +0 -8
  222. package/components/select/dist/styles/emphasized/color-css.d.ts +0 -2
  223. package/components/select/dist/styles/shapeSize-css.d.ts +0 -2
  224. package/components/select/dist/styles/style-css.d.ts +0 -2
  225. package/components/select/dist/styles/tokens-css.d.ts +0 -2
  226. package/custom-elements.json +0 -18656
@@ -1,2096 +0,0 @@
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;vertical-align:middle;line-height:0}: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;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));padding-top:var(--ds-size-50, 0.25rem);padding-bottom:var(--ds-size-50, 0.25rem);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
- const valueAttr = this.getAttribute('value');
484
- const keyAttr = this.getAttribute('key');
485
- this.key = keyAttr !== null ? keyAttr : valueAttr;
486
- }
487
-
488
- firstUpdated() {
489
- // Add the tag name as an attribute if it is different than the component name
490
- this.runtimeUtils.handleComponentTagRename(this, 'auro-menuoption');
491
-
492
- // Generate unique ID if not already set (required for aria-activedescendant)
493
- if (!this.id) {
494
- menuOptionIdCounter += 1;
495
- this.id = `menuoption-${menuOptionIdCounter}`;
496
- }
497
-
498
- this.setAttribute('role', 'option');
499
- this.setAttribute('aria-selected', 'false');
500
-
501
- this.addEventListener('mouseover', () => {
502
- this.dispatchEvent(new CustomEvent('auroMenuOption-mouseover', {
503
- bubbles: true,
504
- cancelable: false,
505
- composed: true,
506
- detail: this
507
- }));
508
- });
509
- }
510
-
511
- updated(changedProperties) {
512
- super.updated(changedProperties);
513
-
514
- // Update aria-selected attribute if selected changed
515
- if (changedProperties.has('selected')) {
516
-
517
- // Update aria-selected attribute
518
- this.setAttribute('aria-selected', this.selected.toString());
519
-
520
- // Update menu service selection state if this isn't an internal update
521
- if (this.internalUpdateInProgress !== true) {
522
- this.menuService[this.selected ? 'selectOption' : 'deselectOption'](this);
523
- }
524
- }
525
-
526
- if (changedProperties.has('active')) {
527
- this.updateActiveClasses();
528
- }
529
-
530
- // Update text highlight if matchWord changed
531
- if (changedProperties.has('matchWord')) {
532
- this.updateTextHighlight();
533
- }
534
-
535
- // Set the key to be the passed value if no key is provided
536
- if (changedProperties.has('value') && this.key === undefined) {
537
- this.key = this.value;
538
- }
539
- }
540
-
541
- disconnectedCallback() {
542
- if (this.menuService) {
543
- this.menuService.unsubscribe(this.handleMenuChange);
544
- this.menuService.removeMenuOption(this);
545
- }
546
- }
547
-
548
- /**
549
- * Sets up event listeners for user interaction with the menu option.
550
- * This function enables click and mouse enter events to trigger selection and highlighting logic.
551
- */
552
- bindEvents() {
553
- this.addEventListener('click', this.handleClick.bind(this));
554
- this.addEventListener('mouseenter', this.handleMouseEnter.bind(this));
555
- }
556
-
557
- /**
558
- * Attaches this menu option to a menu service and subscribes to its events.
559
- * This method enables the option to participate in menu selection and highlighting logic.
560
- * @param {Object} service - The menu service instance to attach to.
561
- */
562
- attachTo(service) {
563
- if (!service) {
564
- return;
565
- }
566
- this.menuService = service;
567
- this.menuService.addMenuOption(this);
568
- this.menuService.subscribe(this.handleMenuChange);
569
- }
570
-
571
- /**
572
- * Handles changes from the menu service and updates the option's state.
573
- * This function synchronizes the option's properties and selection/highlight state with menu events.
574
- * @param {Object} event - The event object from the menu service.
575
- */
576
- handleMenuChange(event) {
577
-
578
- // Ignore events without a type or property
579
- if (!event || (!event.type && !event.property)) {
580
- return;
581
- }
582
-
583
- // Update reactive properties based on event type
584
- if (event.property && Object.keys(AuroMenuOption.properties).includes(event.property)) {
585
- this[event.property] = event.value;
586
- }
587
-
588
- // Handle highlight changes
589
- if (event.type === 'highlightChange') {
590
- const isActive = event.option === this;
591
- this.active = isActive;
592
- this.updateActiveClasses();
593
- }
594
-
595
- if (event.type === 'stateChange') {
596
- const isSelected = event.selectedOptions.includes(this);
597
- this.setInternalSelected(isSelected);
598
- }
599
- }
600
-
601
- /**
602
- * Updates the internal selected state of the menu option bypassing 'updated' and triggers custom events if selected.
603
- * This function ensures the option's selection state is synchronized with menu logic and notifies listeners.
604
- * @param {boolean} isSelected - Whether the option should be marked as selected.
605
- */
606
- setInternalSelected(isSelected) {
607
- this.internalUpdateInProgress = true;
608
- this.selected = isSelected;
609
-
610
- // Fire custom event if selected
611
- if (isSelected) {
612
- this.handleCustomEvent();
613
- }
614
-
615
- setTimeout(() => {
616
- this.internalUpdateInProgress = false;
617
- }, 0);
618
- }
619
-
620
- /**
621
- * Sets the selected state of the menu option.
622
- * This function updates whether the option is currently selected.
623
- * @param {boolean} isSelected - Whether the option should be marked as selected.
624
- * @deprecated Simply modify the `selected` property directly instead.
625
- */
626
- setSelected(isSelected) {
627
- this.selected = isSelected;
628
- }
629
-
630
- /**
631
- * Updates the active state and visual highlighting of the menu option.
632
- * This function toggles the option's active status and applies or removes the active CSS class.
633
- * @param {boolean} isActive - Whether the option should be marked as active.
634
- * @deprecated Simply modify the `active` property directly instead.
635
- */
636
- updateActive(isActive) {
637
-
638
- // Set active state
639
- this.active = isActive;
640
- this.updateActiveClasses();
641
- }
642
-
643
- /**
644
- * Updates the CSS class for the menu option based on its active state.
645
- * This function adds or removes the 'active' class to visually indicate the option's active status.
646
- * @private
647
- */
648
- updateActiveClasses() {
649
- // Update class based on active state
650
- if (this.active) this.classList.add('active');
651
- else this.classList.remove('active');
652
- }
653
-
654
-
655
- /**
656
- * Updates the visual highlighting of text within the menu option based on the current match word.
657
- * This function highlights matching text segments and manages nested spacers for display formatting.
658
- * @private
659
- */
660
- updateTextHighlight() {
661
-
662
- // Regex for matchWord if needed
663
- let regexWord = null;
664
-
665
- if (this.matchWord && this.matchWord.length) {
666
- const escapedWord = this.matchWord.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
667
- regexWord = new RegExp(escapedWord, 'giu');
668
- }
669
-
670
- // Update text highlighting if matchWord changed
671
- if (regexWord &&
672
- this.isActive && !this.hasAttribute('persistent')) {
673
- const nested = this.querySelectorAll('.nestingSpacer');
674
-
675
- const displayValueEl = this.querySelector('[slot="displayValue"]');
676
- if (displayValueEl) {
677
- this.removeChild(displayValueEl);
678
- }
679
-
680
- // Create nested spacers
681
- const nestingSpacerBundle = [...nested].map(() => this.nestingSpacer).join('');
682
-
683
- // Update with spacers and matchWord
684
- this.innerHTML = nestingSpacerBundle +
685
- this.textContent.replace(
686
- regexWord,
687
- (match) => `<strong>${match}</strong>`
688
- );
689
- if (displayValueEl) {
690
- this.append(displayValueEl);
691
- }
692
- }
693
- }
694
-
695
- /**
696
- * Handles click events on the menu option, toggling its selected state.
697
- * This function dispatches a click event and updates selection if the option is not disabled.
698
- * @private
699
- */
700
- handleClick() {
701
- if (!this.disabled) {
702
- this.dispatchClickEvent();
703
- this.selected = !this.selected;
704
- }
705
- }
706
-
707
- /**
708
- * Handles mouse enter events to highlight the menu option.
709
- * This function updates the menu service to set this option as the currently highlighted item if not disabled.
710
- * @private
711
- */
712
- handleMouseEnter() {
713
- if (!this.disabled) {
714
- this.menuService.setHighlightedOption(this);
715
- }
716
- }
717
-
718
- /**
719
- * Dispatches custom events defined for this menu option.
720
- * This function notifies listeners when a custom event is triggered by the option.
721
- * @private
722
- */
723
- handleCustomEvent() {
724
- if (this.event) {
725
- dispatchMenuEvent(this, this.event, { option: this });
726
- dispatchMenuEvent(this, 'auroMenu-customEventFired', { option: this });
727
- }
728
- }
729
-
730
- /**
731
- * Dispatches a click event for this menu option.
732
- * This function notifies listeners that the option has been clicked.
733
- * @private
734
- */
735
- dispatchClickEvent() {
736
- this.dispatchEvent(new CustomEvent('auroMenuOption-click', {
737
- bubbles: true,
738
- cancelable: false,
739
- composed: true,
740
- detail: this
741
- }));
742
- }
743
-
744
- /**
745
- * Generates an HTML element containing an SVG icon based on the provided `svgContent`.
746
- *
747
- * @private
748
- * @param {string} svgContent - The SVG content to be embedded.
749
- * @returns {Element} The HTML element containing the SVG icon.
750
- */
751
- generateIconHtml(svgContent) {
752
- const dom = new DOMParser().parseFromString(svgContent, 'text/html');
753
- const svg = dom.body.firstChild;
754
-
755
- svg.setAttribute('slot', 'svg');
756
-
757
- return html$1`<${this.iconTag} customColor customSvg>${svg}</${this.iconTag}>`;
758
- }
759
-
760
- /**
761
- * Logic to determine the layout of the component.
762
- * @protected
763
- * @returns {void}
764
- */
765
- renderLayout() {
766
-
767
- const fontClassMap = {
768
- xs: 'body-sm',
769
- sm: 'body-default',
770
- md: 'body-default',
771
- lg: 'body-lg',
772
- xl: 'body-lg'
773
- };
774
-
775
- const classes = classMap({
776
- 'wrapper': true,
777
- [this.size ? fontClassMap[this.size] : 'body-sm']: true,
778
- });
779
-
780
- return html$1`
781
- <div class="${classes}">
782
- ${this.selected && !this.noCheckmark
783
- ? this.generateIconHtml(checkmarkIcon.svg)
784
- : undefined}
785
- <slot></slot>
786
- </div>
787
- `;
788
- }
789
- }
790
-
791
- /* eslint-disable */
792
-
793
- class MenuService {
794
-
795
- /**
796
- * PROPERTIES AND GETTERS
797
- */
798
-
799
- /**
800
- * Gets the list of registered menu options.
801
- * @returns {AuroMenuOption[]}
802
- */
803
- get menuOptions() {
804
- return this._menuOptions;
805
- }
806
-
807
- /**
808
- * Gets the currently highlighted option.
809
- * @returns {AuroMenuOption|null}
810
- */
811
- get highlightedOption() {
812
- return this._menuOptions[this.highlightedIndex] || null;
813
- }
814
-
815
- /**
816
- * Gets the current value(s) of the selected option(s).
817
- * @returns {string|string[]|undefined}
818
- */
819
- get currentValue() {
820
- const values = (this.selectedOptions || []).map(option => option.value);
821
- return this.multiSelect ? values : values[0];
822
- }
823
-
824
- /**
825
- * Gets the label(s) of the currently selected option(s).
826
- * @returns {string}
827
- */
828
- get currentLabel() {
829
- const labels = (this.selectedOptions || []).map(option => option.textContent);
830
- return this.multiSelect ? labels.join(", ") : labels[0] || '';
831
- }
832
-
833
- /**
834
- * Gets the string representation of the current value(s).
835
- * For multi-select, this is a JSON stringified array.
836
- * @returns {string|undefined}
837
- */
838
- get stringValue() {
839
- const { currentValue } = this;
840
-
841
- if (Array.isArray(currentValue)) {
842
- if (currentValue.length > 0) {
843
- return JSON.stringify(currentValue);
844
- }
845
- return undefined;
846
- }
847
-
848
- if (typeof currentValue === 'string') {
849
- if (currentValue.length > 0) {
850
- return currentValue;
851
- }
852
- return undefined;
853
- }
854
-
855
- // Future: handle other types here (e.g., number, object, etc.)
856
- return undefined;
857
- }
858
-
859
- /**
860
- * Gets the key(s) of the currently selected option(s).
861
- * @returns {string|string[]|undefined}
862
- */
863
- get currentKeys() {
864
- const keys = (this.selectedOptions || []).map(option => option.key);
865
- return this.multiSelect ? keys : keys[0];
866
- }
867
-
868
- /**
869
- * CONSTRUCTOR
870
- */
871
-
872
- /**
873
- * Creates a new MenuService instance.
874
- * @param {Object} options - The options object.
875
- * @param {AuroMenu} options.host - The host element that this service will control. Required.
876
- * @throws {Error} If the host is not provided.
877
- */
878
- constructor({ host } = {}) {
879
-
880
- // Ensure a host was passed
881
- if (!host) {
882
- throw new Error("MenuService requires a host element.");
883
- }
884
-
885
- // Attach the service to the host
886
- this.host = host;
887
- this.host.addController(this);
888
-
889
- // Set default properties
890
- this.size = undefined;
891
- this.shape = undefined;
892
- this.noCheckmark = undefined;
893
- this.disabled = undefined;
894
- this.matchWord = undefined;
895
- this.multiSelect = undefined;
896
- this.allowDeselect = undefined;
897
- this.selectAllMatchingOptions = undefined;
898
-
899
- this.highlightedIndex = -1;
900
-
901
- this._menuOptions = [];
902
- this._subscribers = [];
903
- this.internalUpdateInProgress = false;
904
- this.selectedOptions = [];
905
- }
906
-
907
- /**
908
- * PROPERTY SYNCING
909
- */
910
-
911
- /**
912
- * Handles host updates.
913
- * This is a lit reactive lifecycle method.
914
- * This comes from the Lit controller interface provided by adding this service as a controller to the host.
915
- * See constructor for `this.host.addController(this)`
916
- * You can read more about Lit reactive controllers here: https://lit.dev/docs/composition/controllers/
917
- */
918
- hostUpdated() {
919
-
920
- // Reset selection if multiSelect mode changes
921
- if (this.host.multiSelect !== this.multiSelect) {
922
- this.selectedOptions = [];
923
- }
924
-
925
- // Update properties on host update
926
- this.setProperties({
927
- size: this.host.size,
928
- shape: this.host.shape,
929
- noCheckmark: this.host.noCheckmark,
930
- disabled: this.host.disabled,
931
- matchWord: this.host.matchWord,
932
- multiSelect: this.host.multiSelect,
933
- allowDeselect: this.host.allowDeselect,
934
- selectAllMatchingOptions: this.host.selectAllMatchingOptions
935
- });
936
- }
937
-
938
- /**
939
- * Handles host disconnection and memory cleanup.
940
- */
941
- hostDisconnected() {
942
- this._subscribers = [];
943
- this._menuOptions = [];
944
- }
945
-
946
- /**
947
- * Sets a property value if it exists on the instance and the value has changed.
948
- * @param {string} property
949
- * @param {any} value
950
- */
951
- setProperty(property, value) {
952
-
953
- // Only update if we are tracking the property in this service
954
- if (this.hasOwnProperty(property)) {
955
-
956
- // Check if the value has changed
957
- const valueChanged = this[property] !== value;
958
-
959
- // Update and notify if changed
960
- if (valueChanged) {
961
- this[property] = value;
962
- this.notify({ property, value });
963
- }
964
- }
965
- }
966
-
967
- /**
968
- * Sets multiple properties on the instance.
969
- * @param {Object} properties - Key-value pairs of properties to set.
970
- */
971
- setProperties(properties) {
972
- for (const [key, value] of Object.entries(properties)) {
973
- this.setProperty(key, value);
974
- }
975
- }
976
-
977
- /**
978
- * MENU OPTION HIGHLIGHTING
979
- */
980
-
981
- /**
982
- * Highlights the next active option in the menu.
983
- */
984
- highlightNext() {
985
- this.moveHighlightedOption("next");
986
- }
987
-
988
- /**
989
- * Highlights the previous active option in the menu.
990
- */
991
- highlightPrevious() {
992
- this.moveHighlightedOption("previous");
993
- }
994
-
995
- /**
996
- * Moves the highlighted option in the specified direction.
997
- * @param {string} direction - The direction to move the highlight ("next" or "previous").
998
- */
999
- moveHighlightedOption(direction) {
1000
-
1001
- // Get the active options
1002
- const activeOptions = this._menuOptions.filter(option => option.isActive);
1003
-
1004
- // Get the currently active option
1005
- const currentActiveOption = activeOptions[activeOptions.indexOf(this.highlightedOption)];
1006
-
1007
- // Determine the new index based on the currently active option and direction
1008
- let newIndex = currentActiveOption
1009
- ? direction === "previous"
1010
- ? activeOptions.indexOf(currentActiveOption) - 1
1011
- : activeOptions.indexOf(currentActiveOption) + 1
1012
- : direction === "previous"
1013
- ? activeOptions.length - 1
1014
- : 0;
1015
-
1016
- // Wrap around the index if needed
1017
- newIndex = newIndex < 0 ? activeOptions.length - 1 : newIndex >= activeOptions.length ? 0 : newIndex;
1018
-
1019
- // Get the new active option and set it as highlighted
1020
- const newActiveOption = activeOptions[newIndex];
1021
- this.setHighlightedOption(newActiveOption);
1022
- }
1023
-
1024
- /**
1025
- * Sets the highlighted index to the specified option.
1026
- * @param {AuroMenuOption} option - The option to highlight.
1027
- */
1028
- setHighlightedOption(option) {
1029
-
1030
- if (!option) return;
1031
-
1032
- // Get the index of the option to highlight
1033
- const index = this._menuOptions.indexOf(option);
1034
-
1035
- // Update highlighted index
1036
- this.highlightedIndex = index;
1037
-
1038
- // Notify subscribers of highlight change
1039
- this.notify({ type: 'highlightChange', option, index: this.highlightedIndex });
1040
-
1041
- // Dispatch the change event
1042
- this.dispatchChangeEvent('auroMenu-activatedOption', option);
1043
- }
1044
-
1045
- /**
1046
- * Sets the highlighted option to the option at the specified index if it exists.
1047
- * @param {number} index
1048
- */
1049
- setHighlightedIndex(index) {
1050
- const option = this._menuOptions[index] || null;
1051
- this.setHighlightedOption(option);
1052
- }
1053
-
1054
- /**
1055
- * Selects the currently highlighted option.
1056
- */
1057
- selectHighlightedOption() {
1058
- if (this.highlightedOption) {
1059
- this.toggleOption(this.highlightedOption);
1060
- }
1061
- }
1062
-
1063
- /**
1064
- * SELECTION AND DESELECTION METHODS
1065
- */
1066
-
1067
- /**
1068
- * Selects one or more options in a batch operation
1069
- * @param {AuroMenuOption|AuroMenuOption[]} options - Single option or array of options to select
1070
- */
1071
- selectOptions(options) {
1072
- let optionsToSelect = Array.isArray(options) ? options : [options];
1073
-
1074
- // Filter out options that are inactive
1075
- optionsToSelect = optionsToSelect.filter(option => option.isActive);
1076
-
1077
- if (!optionsToSelect.length) return;
1078
-
1079
- if (this.multiSelect) {
1080
- this.selectedOptions = [...(this.selectedOptions || []), ...optionsToSelect];
1081
- } else {
1082
- // In single select mode, only take the last option
1083
- this.selectedOptions = [optionsToSelect[optionsToSelect.length - 1]];
1084
- }
1085
-
1086
- this.stageUpdate();
1087
- }
1088
-
1089
- /**
1090
- * Deselects one or more options in a batch operation
1091
- * @param {AuroMenuOption|AuroMenuOption[]} options - Single option or array of options to deselect
1092
- */
1093
- deselectOptions(options) {
1094
- const optionsToDeselect = Array.isArray(options) ? options : [options];
1095
-
1096
- if (!optionsToDeselect.length) return;
1097
-
1098
- // Check if deselection should be prevented
1099
- const shouldPreventDeselect = !this.allowDeselect && !this.multiSelect;
1100
- const isOnlySelectedOption = this.selectedOptions.length === 1 && optionsToDeselect.includes(this.selectedOptions[0]);
1101
-
1102
- // Prevent deselecting the only selected option if not allowed
1103
- if (shouldPreventDeselect && isOnlySelectedOption) return;
1104
-
1105
- const optionsSet = new Set(optionsToDeselect);
1106
- this.selectedOptions = (this.selectedOptions || [])
1107
- .filter(opt => !optionsSet.has(opt));
1108
-
1109
- this.stageUpdate();
1110
- }
1111
-
1112
- /**
1113
- * Selects a single option.
1114
- * @param {AuroMenuOption} option
1115
- */
1116
- selectOption(option) {
1117
- this.selectOptions(option);
1118
- }
1119
-
1120
- /**
1121
- * Deselects a single option.
1122
- * @param {AuroMenuOption} option
1123
- */
1124
- deselectOption(option) {
1125
- this.deselectOptions(option);
1126
- }
1127
-
1128
- /**
1129
- * Toggles the selection state of a single option.
1130
- * @param {AuroMenuOption} option
1131
- */
1132
- toggleOption(option) {
1133
- if (option.selected) {
1134
- this.deselectOption(option);
1135
- } else {
1136
- this.selectOption(option);
1137
- }
1138
- }
1139
-
1140
- /**
1141
- * Selects options based on their value(s) when compared to a passed value or values.
1142
- * Value or values are normalized to an array of strings that can be matched to option keys.
1143
- * @param {string|number|Array<string|number>} value - The value(s) to select.
1144
- */
1145
- selectByValue(value) {
1146
- // Early exit for invalid/empty values or internal updates
1147
- if (this.internalUpdateInProgress ||
1148
- this.host.internalUpdateInProgress ||
1149
- value === undefined ||
1150
- value === null ||
1151
- (Array.isArray(value) && value.length === 0) ||
1152
- (typeof value === 'string' && value.trim() === '')) {
1153
- return;
1154
- }
1155
-
1156
- this.reset();
1157
-
1158
- // Normalize values to array of strings
1159
- const normalizedValues = this._getNormalizedValues(value);
1160
-
1161
- // Validate for single-select mode
1162
- let validatedValues = normalizedValues;
1163
- if (normalizedValues.length > 1 && !this.multiSelect) {
1164
- console.warn("MenuService - Multiple values provided for single-select menu. Only the first value will be selected.");
1165
- validatedValues = [normalizedValues[0]];
1166
- }
1167
-
1168
- // Find matching options by comparing available options to validated values
1169
- const trackedKeys = new Set();
1170
- const optionsToSelect = this._menuOptions.filter(option => {
1171
- const passesFilter = validatedValues.includes(option.key);
1172
- const alreadyTracked = trackedKeys.has(option.key);
1173
-
1174
- trackedKeys.add(option.key);
1175
-
1176
- // Include the option in the options to be selected if it passes the filter check and
1177
- // either hasn't been tracked yet or selectAllMatchingOptions is true
1178
- return passesFilter && (!alreadyTracked || (alreadyTracked && this.selectAllMatchingOptions));
1179
- });
1180
-
1181
- // Handle selection result
1182
- if (optionsToSelect.length && !this.optionsArraysMatch(optionsToSelect, this.selectedOptions)) {
1183
- this.selectOptions(optionsToSelect);
1184
- } else {
1185
- this.stageUpdate();
1186
- }
1187
-
1188
- // Dispatch failure event if no matches found
1189
- if (!optionsToSelect.length && validatedValues.length) {
1190
- this.dispatchChangeEvent('auroMenu-selectValueFailure', {
1191
- message: 'No matching options found for the provided value(s).',
1192
- values: validatedValues
1193
- });
1194
- }
1195
- }
1196
-
1197
- /**
1198
- * Resets the selected options to an empty array.
1199
- */
1200
- reset() {
1201
- const previousOptions = [...this.selectedOptions];
1202
- this.selectedOptions = [];
1203
-
1204
- // Single update after clearing all
1205
- if (previousOptions.length) {
1206
- this.stageUpdate();
1207
- }
1208
- }
1209
-
1210
- /**
1211
- * SUBSCRIPTION, NOTIFICATION AND EVENT DISPATCH METHODS
1212
- */
1213
-
1214
- /**
1215
- * Subscribes a callback to menu service events.
1216
- * @param {Function} callback - The callback to invoke on events.
1217
- */
1218
- subscribe(callback) {
1219
- this._subscribers.push(callback);
1220
- }
1221
-
1222
- /**
1223
- * Remove a previously subscribed callback from menu service events.
1224
- * @param {Function} callback
1225
- */
1226
- unsubscribe(callback) {
1227
- this._subscribers = this._subscribers.filter(cb => cb !== callback);
1228
- }
1229
-
1230
- /**
1231
- * Stages an update to notify subscribers of state and value changes.
1232
- */
1233
- stageUpdate() {
1234
- this.notifyStateChange();
1235
- this.notifyValueChange();
1236
- }
1237
-
1238
- /**
1239
- * Notifies subscribers of a menu service event.
1240
- * All notifications are sent to all subscribers.
1241
- * @param {string} event - The event to send to subscribers.
1242
- */
1243
- notify(event) {
1244
- this._subscribers.forEach(callback => callback(event));
1245
- }
1246
-
1247
- /**
1248
- * Notifies subscribers of a state change (selected options has changed).
1249
- */
1250
- notifyStateChange() {
1251
- this.notify({ type: 'stateChange', selectedOptions: this.selectedOptions });
1252
- }
1253
-
1254
- /**
1255
- * Notifies subscribers of a value change (current value has changed).
1256
- */
1257
- notifyValueChange() {
1258
-
1259
- // Prepare details for the event
1260
- const details = {
1261
- value: this.currentValue,
1262
- stringValue: this.stringValue,
1263
- keys: this.currentKeys,
1264
- options: this.selectedOptions,
1265
- label: this.currentLabel
1266
- };
1267
-
1268
- // If only one option is selected, include its index
1269
- if (this.selectedOptions.length === 1) details.index = this._menuOptions.indexOf(this.selectedOptions[0]);
1270
-
1271
- this.notify({
1272
- type: 'valueChange',
1273
- ...details
1274
- });
1275
-
1276
- this.dispatchChangeEvent('auroMenu-selectedOption', details);
1277
- }
1278
-
1279
- /**
1280
- * Dispatches a custom event from the host element.
1281
- * @param {string} eventName
1282
- * @param {any} detail
1283
- */
1284
- dispatchChangeEvent(eventName, detail) {
1285
- this.host.dispatchEvent(new CustomEvent(eventName, {
1286
- bubbles: true,
1287
- cancelable: false,
1288
- composed: true,
1289
- detail
1290
- }));
1291
- }
1292
-
1293
- /**
1294
- * MENU OPTION MANAGEMENT METHODS
1295
- */
1296
-
1297
- /**
1298
- * Adds a menu option to the service's list.
1299
- * @param {AuroMenuOption} option - the option to track
1300
- */
1301
- addMenuOption(option) {
1302
- this._menuOptions.push(option);
1303
- this.notify({ type: 'optionsChange', options: this._menuOptions });
1304
- }
1305
-
1306
- /**
1307
- * Removes a menu option from the service's list.
1308
- * @param {AuroMenuOption} option - the option to remove
1309
- */
1310
- removeMenuOption(option) {
1311
- this._menuOptions = this._menuOptions.filter(opt => opt !== option);
1312
- this.notify({ type: 'optionsChange', options: this._menuOptions });
1313
- }
1314
-
1315
- /**
1316
- * UTILITIES
1317
- */
1318
-
1319
- /**
1320
- * Normalizes a value or array of values into an array of strings for option selection.
1321
- * This function ensures that input values are consistently formatted for matching menu options.
1322
- *
1323
- * @param {string|number|Array<string|number>} value - The value(s) to normalize.
1324
- * @returns {Array<string>} An array of string values suitable for option matching.
1325
- * @throws {Error} If any value is not a string or number.
1326
- */
1327
- _getNormalizedValues(value) {
1328
- let values = value;
1329
-
1330
- // Handle JSON string and single value string input
1331
- if (!Array.isArray(values) && typeof values === 'string') {
1332
-
1333
- // Attempt to parse as JSON array
1334
- try {
1335
-
1336
- // Normalize single quotes to double quotes for JSON parsing
1337
- // This will not handle complex cases but will cover basic usage
1338
- const parseValue = values.replace(/'([^']*?)'/g, '"$1"');
1339
-
1340
- // Attempt parse
1341
- const parsed = JSON.parse(parseValue);
1342
-
1343
- // Ensure parsed value is an array
1344
- if (!Array.isArray(parsed)) throw new Error('Not an array');
1345
-
1346
- // Set values to parsed array
1347
- values = parsed;
1348
- } catch (err) {
1349
-
1350
- // If parsing fails, treat as single value
1351
- values = [value];
1352
- }
1353
- }
1354
-
1355
- // Handle a single number being passed
1356
- if (typeof values === 'number') {
1357
- values = [String(values)];
1358
- }
1359
-
1360
- // Coerce each value to string and validate types
1361
- values.forEach((val, index) => {
1362
-
1363
- // Throw an error for invalid value types
1364
- if (typeof val !== 'string' && typeof val !== 'number') {
1365
- throw new Error('Value contains invalid value type. Supported types are string and number.');
1366
- }
1367
-
1368
- // Convert numbers to strings for consistency
1369
- if (typeof val === 'number') {
1370
- values[index] = String(val);
1371
- }
1372
- });
1373
-
1374
- // Return the resulting array of string values
1375
- return values;
1376
- }
1377
-
1378
- /**
1379
- * Returns whether two arrays of options contain the same elements.
1380
- * @param {AuroMenuOption[]} arr1 - First array of options.
1381
- * @param {AuroMenuOption[]} arr2 - Second array of options.
1382
- * @returns {boolean} True if arrays match, false otherwise.
1383
- */
1384
- optionsArraysMatch(arr1, arr2) {
1385
- if (arr1.length !== arr2.length) return false;
1386
-
1387
- const set1 = new Set(arr1);
1388
- const set2 = new Set(arr2);
1389
-
1390
- for (let item of set1) {
1391
- if (!set2.has(item)) {
1392
- return false;
1393
- }
1394
- }
1395
-
1396
- return true;
1397
- }
1398
- }
1399
-
1400
- const MenuContext = createContext('menu-context');
1401
-
1402
- /* eslint-disable no-underscore-dangle */
1403
- // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
1404
- // See LICENSE in the project root for license information.
1405
-
1406
-
1407
-
1408
- /**
1409
- * The `auro-menu` element provides users a way to select from a list of options.
1410
- * @customElement auro-menu
1411
- *
1412
- * @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
1413
- * @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
1414
- * @event {CustomEvent<{ loading: boolean; hasLoadingPlaceholder: boolean; }>} auroMenu-loadingChange - Notifies when the loading attribute is changed.
1415
- * @event {CustomEvent<any>} auroMenu-selectValueFailure - Notifies that an attempt to select a menuoption by matching a value has failed.
1416
- * @event {CustomEvent<any>} auroMenu-selectValueReset - Notifies that the component value has been reset.
1417
- * @event {CustomEvent<any>} auroMenu-selectedOption - Notifies that a new menuoption selection has been made.
1418
- * @slot loadingText - Text to show while loading attribute is set
1419
- * @slot loadingIcon - Icon to show while loading attribute is set
1420
- * @slot - Slot for insertion of menu options.
1421
- */
1422
-
1423
- /* eslint-disable max-lines */
1424
-
1425
- class AuroMenu extends AuroElement {
1426
-
1427
- constructor() {
1428
- super();
1429
-
1430
- // State properties (reactive)
1431
-
1432
- /**
1433
- * @private
1434
- */
1435
- this.shape = "box";
1436
-
1437
- /**
1438
- * @private
1439
- */
1440
- this.size = "sm";
1441
-
1442
- // Value of the selected options
1443
- this.value = undefined;
1444
- // Currently selected option
1445
- this.optionSelected = undefined;
1446
- // String used for highlighting/filtering
1447
- this.matchWord = undefined;
1448
- // Hide the checkmark icon on selected options
1449
- this.noCheckmark = false;
1450
- // Currently active option
1451
- this.optionActive = undefined;
1452
- // Loading state
1453
- this.loading = false;
1454
- // Multi-select mode
1455
- this.multiSelect = false;
1456
- // Allow deselecting of menu options
1457
- this.allowDeselect = false;
1458
- // Select all matching options when setting value in multi-select mode
1459
- this.selectAllMatchingOptions = false;
1460
-
1461
- // Event Bindings
1462
-
1463
- /**
1464
- * @private
1465
- */
1466
- this.handleKeyDown = this.handleKeyDown.bind(this);
1467
-
1468
-
1469
- /**
1470
- * @private
1471
- */
1472
- this.handleSlotChange = this.handleSlotChange.bind(this);
1473
-
1474
- // Instance properties (non-reactive)
1475
-
1476
- /**
1477
- * @private
1478
- */
1479
- Object.assign(this, {
1480
- // Root-level menu (true) or a nested submenu (false)
1481
- rootMenu: true,
1482
- // Currently focused/active menu item index
1483
- _index: -1,
1484
- // Nested menu spacer
1485
- nestingSpacer: '<span class="nestingSpacer"></span>',
1486
- // Loading indicator for slot elements
1487
- loadingSlots: null,
1488
- });
1489
- }
1490
-
1491
- static get properties() {
1492
- return {
1493
- ...super.properties,
1494
-
1495
- /**
1496
- * Allows deselecting an already selected option when clicked again in single-select mode.
1497
- */
1498
- allowDeselect: {
1499
- type: Boolean,
1500
- reflect: true,
1501
- },
1502
-
1503
- /**
1504
- * When true, the entire menu and all options are disabled.
1505
- */
1506
- disabled: {
1507
- type: Boolean,
1508
- reflect: true
1509
- },
1510
-
1511
- /**
1512
- * Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
1513
- */
1514
- hasLoadingPlaceholder: {
1515
- type: Boolean
1516
- },
1517
-
1518
- /**
1519
- * @private
1520
- */
1521
- layout: {
1522
- type: String
1523
- },
1524
-
1525
- /**
1526
- * Indent level for submenus.
1527
- * @private
1528
- */
1529
- level: {
1530
- type: Number,
1531
- reflect: false,
1532
- attribute: false
1533
- },
1534
-
1535
- /**
1536
- * When true, displays a loading state using the loadingIcon and loadingText slots if provided.
1537
- */
1538
- loading: {
1539
- type: Boolean,
1540
- reflect: true
1541
- },
1542
-
1543
- /**
1544
- * Specifies a string used to highlight matched string parts in options.
1545
- */
1546
- matchWord: {
1547
- type: String,
1548
- attribute: 'matchword'
1549
- },
1550
-
1551
- /**
1552
- * When true, the selected option can be multiple options.
1553
- */
1554
- multiSelect: {
1555
- type: Boolean,
1556
- reflect: true,
1557
- attribute: 'multiselect'
1558
- },
1559
-
1560
- /**
1561
- * When true, selected option will not show the checkmark.
1562
- */
1563
- noCheckmark: {
1564
- type: Boolean,
1565
- reflect: true,
1566
- attribute: 'nocheckmark'
1567
- },
1568
-
1569
- /**
1570
- * Specifies the current active menuOption.
1571
- */
1572
- optionActive: {
1573
- type: Object,
1574
- attribute: 'optionactive'
1575
- },
1576
-
1577
- /**
1578
- * An array of currently selected menu options, type `HTMLElement` by default. In multi-select mode, `optionSelected` is an array of HTML elements.
1579
- */
1580
- optionSelected: {
1581
- // Allow HTMLElement, HTMLElement[] arrays and undefined
1582
- type: Object
1583
- },
1584
-
1585
- /**
1586
- * Available menu options
1587
- * @readonly
1588
- */
1589
- options: {
1590
- type: Array,
1591
- reflect: false,
1592
- attribute: false
1593
- },
1594
-
1595
- /**
1596
- * Sets the size of the menu.
1597
- * @type {'sm' | 'md'}
1598
- * @default 'sm'
1599
- */
1600
- size: {
1601
- type: String,
1602
- reflect: true
1603
- },
1604
-
1605
- /**
1606
- * When true, selects all options that match the provided value/key when setting value and multiselect is enabled.
1607
- */
1608
- selectAllMatchingOptions: {
1609
- type: Boolean,
1610
- reflect: true,
1611
- },
1612
-
1613
- /**
1614
- * Sets the shape of the menu.
1615
- * @type {'box' | 'round'}
1616
- * @default 'box'
1617
- */
1618
- shape: {
1619
- type: String,
1620
- reflect: true
1621
- },
1622
-
1623
- /**
1624
- * The value of the selected option. In multi-select mode, this is a JSON stringified array of selected option values.
1625
- */
1626
- value: {
1627
- type: String,
1628
- reflect: true,
1629
- attribute: 'value'
1630
- }
1631
- };
1632
- }
1633
-
1634
- static get styles() {
1635
- return [
1636
- styleCss$1,
1637
- colorCss$1,
1638
- tokensCss
1639
- ];
1640
- }
1641
-
1642
- /**
1643
- * @readonly
1644
- * @returns {string} - Returns the label of the currently selected option(s).
1645
- */
1646
- get currentLabel() {
1647
- return this.menuService.currentLabel;
1648
- };
1649
-
1650
- /**
1651
- * @readonly
1652
- * @returns {Array<HTMLElement>} - Returns the array of available menu options.
1653
- * @deprecated use `options` property instead.
1654
- */
1655
- get items() {
1656
- return this.options;
1657
- }
1658
-
1659
- /**
1660
- * @returns {number} - Returns the index of the currently active option.
1661
- */
1662
- get index() {
1663
- return this._index;
1664
- }
1665
-
1666
- /**
1667
- * @param {number} value - Sets the index of the currently active option.
1668
- */
1669
- set index(value) {
1670
- this.menuService.setHighlightedIndex(value);
1671
- }
1672
-
1673
- /**
1674
- * This will register this element with the browser.
1675
- * @param {string} [name="auro-menu"] - The name of the element that you want to register.
1676
- *
1677
- * @example
1678
- * AuroMenu.register("custom-menu") // this will register this element to <custom-menu/>
1679
- *
1680
- */
1681
- static register(name = "auro-menu") {
1682
- AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenu);
1683
- }
1684
-
1685
- /**
1686
- * Formatted value based on `multiSelect` state.
1687
- * Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
1688
- * @private
1689
- * @returns {String|Array<String>}
1690
- */
1691
- get formattedValue() {
1692
- return this.menuService.currentValue;
1693
- }
1694
-
1695
- /**
1696
- * Gets the current property values for the menu service.
1697
- * @private
1698
- * @returns {Object}
1699
- */
1700
- get propertyValues() {
1701
- return {
1702
- size: this.size,
1703
- shape: this.shape,
1704
- noCheckmark: this.nocheckmark,
1705
- disabled: this.disabled
1706
- };
1707
- }
1708
-
1709
- /**
1710
- * Provides the menu context to child components.
1711
- * Initializes the MenuService and subscribes to menu changes.
1712
- * @protected
1713
- */
1714
- provideContext() {
1715
- this.menuService = new MenuService({host: this});
1716
- this.menuService.setProperties(this.propertyValues);
1717
- this.menuService.subscribe(this.handleMenuChange.bind(this));
1718
- this._contextProvider = new ContextProvider(this, {
1719
- context: MenuContext,
1720
- initialValue: this.menuService
1721
- });
1722
- }
1723
-
1724
- /**
1725
- * Updates the currently active option in the menu.
1726
- * @param {HTMLElement} option - The option to set as active.
1727
- */
1728
- updateActiveOption(option) {
1729
- this.menuService.setHighlightedOption(option);
1730
- }
1731
-
1732
- /**
1733
- * Sets the internal value and manages update state.
1734
- * @param {String|Array<String>} value - The value to set.
1735
- * @protected
1736
- */
1737
- setInternalValue(value) {
1738
- if (this.value !== value) {
1739
- this.internalUpdateInProgress = true;
1740
- this.value = value;
1741
-
1742
- setTimeout(() => {
1743
- this.internalUpdateInProgress = false;
1744
- });
1745
- }
1746
- }
1747
-
1748
- /**
1749
- * Handles changes from the menu service and updates component state.
1750
- * @param {Object} event - The event object from the menu service.
1751
- * @protected
1752
- */
1753
- handleMenuChange(event) {
1754
- if (event.type === 'valueChange') {
1755
-
1756
- // New option is array value or first option with fallback to undefined for empty array in all cases
1757
- const newOption = this.multiSelect && event.options.length ? event.options : event.options[0] || undefined;
1758
- const newValue = event.stringValue;
1759
-
1760
- // Check if the option or value has actually changed
1761
- if (newValue === undefined || (this.optionSelected !== newOption || this.stringValue !== newValue)) {
1762
- this.optionSelected = newOption;
1763
- this.setInternalValue(newValue);
1764
- }
1765
-
1766
- // Notify components of selection change
1767
- this.notifySelectionChange(event);
1768
- }
1769
-
1770
- if (event.type === 'highlightChange') {
1771
- this.optionActive = event.option;
1772
- this._index = event.index;
1773
- }
1774
-
1775
- if (event.type === 'optionsChange') {
1776
- this.options = event.options;
1777
- this.dispatchEvent(new CustomEvent('auroMenu-optionsChange', {
1778
- detail: {
1779
- options: event.options
1780
- }
1781
- }));
1782
- }
1783
- }
1784
-
1785
- /**
1786
- * Gets the currently selected options.
1787
- * @returns {Array<HTMLElement>}
1788
- */
1789
- get selectedOptions() {
1790
- return this.menuService ? this.menuService.selectedOptions : [];
1791
- }
1792
-
1793
- /**
1794
- * Gets the first selected option, or null if none.
1795
- * @returns {HTMLElement|null}
1796
- */
1797
- get selectedOption() {
1798
- return this.menuService ? this.menuService.selectedOptions[0] : null;
1799
- }
1800
-
1801
- // Lifecycle Methods
1802
-
1803
- connectedCallback() {
1804
- super.connectedCallback();
1805
-
1806
- this.provideContext();
1807
-
1808
- this.addEventListener('keydown', this.handleKeyDown);
1809
- this.addEventListener('auroMenuOption-click', this.handleMouseSelect);
1810
- this.addEventListener('auroMenuOption-mouseover', this.handleOptionHover);
1811
- this.addEventListener('slotchange', this.handleSlotChange);
1812
- this.setTagAttribute("auro-menu");
1813
- }
1814
-
1815
- disconnectedCallback() {
1816
- this.removeEventListener('keydown', this.handleKeyDown);
1817
- this.removeEventListener('auroMenuOption-click', this.handleMouseSelect);
1818
- this.removeEventListener('auroMenuOption-mouseover', this.handleOptionHover);
1819
- this.removeEventListener('slotchange', this.handleSlotChange);
1820
-
1821
- super.disconnectedCallback();
1822
- }
1823
-
1824
- firstUpdated() {
1825
- AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-menu');
1826
-
1827
- this.loadingSlots = this.querySelectorAll("[slot='loadingText'], [slot='loadingIcon']");
1828
- this.initializeMenu();
1829
- }
1830
-
1831
-
1832
- updated(changedProperties) {
1833
- super.updated(changedProperties);
1834
-
1835
- // Update menu service properties on host update
1836
- if (changedProperties.has('value')) {
1837
- this.menuService.selectByValue(this.value);
1838
- }
1839
-
1840
- // Handle loading state changes
1841
- if (changedProperties.has('loading')) {
1842
- this.setLoadingState(this.loading);
1843
- }
1844
-
1845
- if (changedProperties.has('multiSelect') && this.rootMenu) {
1846
- if (this.multiSelect) {
1847
- this.setAttribute('aria-multiselectable', 'true');
1848
- } else {
1849
- this.removeAttribute('aria-multiselectable');
1850
- }
1851
- }
1852
- }
1853
-
1854
- /**
1855
- * Sets an attribute that matches the default tag name if the tag name is not the default.
1856
- * @param {string} tagName - The tag name to set as an attribute.
1857
- * @private
1858
- */
1859
- setTagAttribute(tagName) {
1860
- if (this.tagName.toLowerCase() !== tagName) {
1861
- this.setAttribute(tagName, true);
1862
- }
1863
- }
1864
-
1865
- /**
1866
- * Sets the loading state and dispatches a loading change event.
1867
- * @param {boolean} isLoading - Whether the menu is loading.
1868
- * @protected
1869
- */
1870
- setLoadingState(isLoading) {
1871
- this.setAttribute("aria-busy", isLoading);
1872
- dispatchMenuEvent(this, "auroMenu-loadingChange", {
1873
- loading: isLoading,
1874
- hasLoadingPlaceholder: this.hasLoadingPlaceholder
1875
- });
1876
- }
1877
-
1878
- // Init Methods
1879
-
1880
- /**
1881
- * Initializes the menu's state and structure.
1882
- * @private
1883
- */
1884
- initializeMenu() {
1885
- if (this.rootMenu) {
1886
- this.setAttribute('role', 'listbox');
1887
- this.setAttribute('root', '');
1888
-
1889
- if (this.multiSelect) {
1890
- this.setAttribute('aria-multiselectable', 'true');
1891
- }
1892
-
1893
- this.handleNestedMenus(this);
1894
- }
1895
- }
1896
-
1897
- /**
1898
- * Selects the currently highlighted option.
1899
- * @protected
1900
- */
1901
- makeSelection() {
1902
- this.menuService.selectHighlightedOption();
1903
- }
1904
-
1905
- /**
1906
- * Resets all options to their default state.
1907
- * @private
1908
- */
1909
- clearSelection() {
1910
- this.optionSelected = undefined;
1911
- this.value = undefined;
1912
- this._index = -1;
1913
- }
1914
-
1915
- /**
1916
- * Resets the menu to its initial state.
1917
- * This is the only way to return value to undefined.
1918
- * @public
1919
- */
1920
- reset() {
1921
- this.menuService.reset();
1922
-
1923
- // Dispatch reset event
1924
- dispatchMenuEvent(this, 'auroMenu-selectValueReset');
1925
- }
1926
-
1927
- /**
1928
- * Handles nested menu structure.
1929
- * @private
1930
- * @param {HTMLElement} menu - Root menu element.
1931
- */
1932
- handleNestedMenus(menu) {
1933
- menu.level = menu.parentElement.level >= 0 ? menu.parentElement.level + 1 : 0;
1934
-
1935
- if (menu.level > 0) {
1936
- menu.setAttribute('role', 'group');
1937
- menu.removeAttribute("root");
1938
- if (!menu.hasAttribute('aria-label')) {
1939
- menu.setAttribute('aria-label', 'submenu');
1940
- }
1941
- }
1942
-
1943
- const options = menu.querySelectorAll(':scope > auro-menuoption, :scope > [auro-menuoption]');
1944
- options.forEach((option) => {
1945
- const regex = new RegExp(this.nestingSpacer, "gu");
1946
- option.innerHTML = this.nestingSpacer.repeat(menu.level) + option.innerHTML.replace(regex, '');
1947
- });
1948
- }
1949
-
1950
- // Event Handlers
1951
-
1952
- /**
1953
- * Handles keyboard navigation.
1954
- * @private
1955
- * @param {KeyboardEvent} event - Event object from the browser.
1956
- */
1957
- handleKeyDown(event) {
1958
- event.preventDefault();
1959
- switch (event.key) {
1960
- case "ArrowDown":
1961
- this.menuService.highlightNext();
1962
- break;
1963
- case "ArrowUp":
1964
- this.menuService.highlightPrevious();
1965
- break;
1966
- case "Tab":
1967
- case "Enter":
1968
- this.menuService.selectHighlightedOption();
1969
- break;
1970
- }
1971
- }
1972
-
1973
- /**
1974
- * Navigates the menu options in the specified direction.
1975
- * @param {'up'|'down'} direction - The direction to navigate.
1976
- * @protected
1977
- */
1978
- navigateOptions(direction) {
1979
- if (direction === 'up') {
1980
- this.menuService.highlightPrevious();
1981
- } else if (direction === 'down') {
1982
- this.menuService.highlightNext();
1983
- }
1984
- }
1985
-
1986
- /**
1987
- * Handles slot change events.
1988
- * @private
1989
- */
1990
- handleSlotChange() {
1991
- if (this.parentElement && this.parentElement.closest('auro-menu, [auro-menu]')) {
1992
- this.rootMenu = false;
1993
- }
1994
-
1995
- if (this.rootMenu) {
1996
- this.initializeMenu();
1997
- }
1998
- }
1999
-
2000
- /**
2001
- * Handles custom events defined on options.
2002
- * @private
2003
- * @param {HTMLElement} option - Option with custom event.
2004
- */
2005
- handleCustomEvent(option) {
2006
- const eventName = option.getAttribute('event');
2007
- dispatchMenuEvent(this, eventName);
2008
- dispatchMenuEvent(this, 'auroMenu-customEventFired');
2009
- }
2010
-
2011
- /**
2012
- * Notifies selection change to parent components.
2013
- * @param {any} source - The source that triggers this event.
2014
- * @private
2015
- */
2016
- notifySelectionChange({value, stringValue, keys, options} = {}) {
2017
- dispatchMenuEvent(this, 'auroMenu-selectedOption', {
2018
- value,
2019
- stringValue,
2020
- keys,
2021
- options
2022
- });
2023
- }
2024
-
2025
- /**
2026
- * Checks if an option is currently selected.
2027
- * @private
2028
- * @param {HTMLElement} option - The option to check.
2029
- * @returns {boolean}
2030
- */
2031
- isOptionSelected(option) {
2032
- if (!this.optionSelected) {
2033
- return false;
2034
- }
2035
-
2036
- if (this.multiSelect) {
2037
- // In multi-select mode, check if the option is in the selected array
2038
- return Array.isArray(this.optionSelected) && this.optionSelected.some((selectedOption) => selectedOption === option);
2039
- }
2040
-
2041
- return this.optionSelected === option;
2042
- }
2043
-
2044
- /**
2045
- * Getter for loading placeholder state.
2046
- * @returns {boolean} - True if loading slots are present and non-empty.
2047
- */
2048
- get hasLoadingPlaceholder() {
2049
- return this.loadingSlots && this.loadingSlots.length > 0;
2050
- }
2051
-
2052
- /**
2053
- * Getter for wrapper classes based on size.
2054
- * @returns {Object} - Class map for the wrapper element.
2055
- * @private
2056
- */
2057
- get wrapperClasses() {
2058
- return classMap({
2059
- 'menuWrapper': true,
2060
- [this.size]: true,
2061
- });
2062
- }
2063
-
2064
- /**
2065
- * Logic to determine the layout of the component.
2066
- * @protected
2067
- * @returns {void}
2068
- */
2069
- renderLayout() {
2070
- if (this.loading) {
2071
- return html`
2072
- <div class="${this.wrapperClasses}">
2073
- <auro-menuoption
2074
- disabled
2075
- loadingplaceholder
2076
- class="${this.hasLoadingPlaceholder ? "" : "empty"}"
2077
- >
2078
- <div>
2079
- <slot name="loadingIcon" class="body-lg"></slot>
2080
- <slot name="loadingText"></slot>
2081
- </div>
2082
- </auro-menuoption>
2083
- </div>
2084
- `;
2085
- }
2086
-
2087
- return html`
2088
- <div class="${this.wrapperClasses}">
2089
- <slot @slotchange=${this.handleSlotChange}></slot>
2090
- </div>
2091
- `;
2092
- }
2093
- }
2094
-
2095
- AuroMenu.register();
2096
- AuroMenuOption.register();