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

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