@helixui/library 3.3.1-next.118 → 3.4.0-next.121

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 (249) hide show
  1. package/custom-elements.json +422 -322
  2. package/dist/components/hx-alert/hx-alert.d.ts +11 -0
  3. package/dist/components/hx-alert/hx-alert.d.ts.map +1 -1
  4. package/dist/components/hx-alert/hx-alert.styles.d.ts.map +1 -1
  5. package/dist/components/hx-alert/index.js +1 -1
  6. package/dist/components/hx-badge/hx-badge.styles.d.ts.map +1 -1
  7. package/dist/components/hx-badge/index.js +1 -1
  8. package/dist/components/hx-banner/hx-banner.d.ts +9 -1
  9. package/dist/components/hx-banner/hx-banner.d.ts.map +1 -1
  10. package/dist/components/hx-banner/index.js +1 -1
  11. package/dist/components/hx-button/hx-button.d.ts +11 -1
  12. package/dist/components/hx-button/hx-button.d.ts.map +1 -1
  13. package/dist/components/hx-button/index.js +1 -1
  14. package/dist/components/hx-button-group/hx-button-group.d.ts +13 -0
  15. package/dist/components/hx-button-group/hx-button-group.d.ts.map +1 -1
  16. package/dist/components/hx-button-group/index.js +1 -1
  17. package/dist/components/hx-checkbox/hx-checkbox.d.ts.map +1 -1
  18. package/dist/components/hx-checkbox/index.js +1 -1
  19. package/dist/components/hx-checkbox-group/index.js +1 -1
  20. package/dist/components/hx-color-picker/index.js +1 -1
  21. package/dist/components/hx-combobox/index.js +1 -1
  22. package/dist/components/hx-data-table/hx-data-table.d.ts.map +1 -1
  23. package/dist/components/hx-data-table/index.js +1 -1
  24. package/dist/components/hx-date-picker/index.js +1 -1
  25. package/dist/components/hx-dialog/index.js +1 -1
  26. package/dist/components/hx-drawer/hx-drawer.d.ts +201 -0
  27. package/dist/components/hx-drawer/hx-drawer.d.ts.map +1 -1
  28. package/dist/components/hx-drawer/hx-drawer.styles.d.ts.map +1 -1
  29. package/dist/components/hx-drawer/index.js +1 -1
  30. package/dist/components/hx-dropdown/hx-dropdown.d.ts +96 -8
  31. package/dist/components/hx-dropdown/hx-dropdown.d.ts.map +1 -1
  32. package/dist/components/hx-dropdown/index.js +1 -1
  33. package/dist/components/hx-icon-button/hx-icon-button.d.ts +16 -3
  34. package/dist/components/hx-icon-button/hx-icon-button.d.ts.map +1 -1
  35. package/dist/components/hx-icon-button/hx-icon-button.styles.d.ts.map +1 -1
  36. package/dist/components/hx-icon-button/index.js +1 -1
  37. package/dist/components/hx-link/hx-link.d.ts +10 -1
  38. package/dist/components/hx-link/hx-link.d.ts.map +1 -1
  39. package/dist/components/hx-link/index.js +1 -1
  40. package/dist/components/hx-list/hx-list-item.d.ts +27 -1
  41. package/dist/components/hx-list/hx-list-item.d.ts.map +1 -1
  42. package/dist/components/hx-list/hx-list.d.ts +28 -0
  43. package/dist/components/hx-list/hx-list.d.ts.map +1 -1
  44. package/dist/components/hx-list/index.js +1 -1
  45. package/dist/components/hx-menu/hx-menu-divider.d.ts +10 -0
  46. package/dist/components/hx-menu/hx-menu-divider.d.ts.map +1 -1
  47. package/dist/components/hx-menu/hx-menu-item.d.ts +99 -2
  48. package/dist/components/hx-menu/hx-menu-item.d.ts.map +1 -1
  49. package/dist/components/hx-menu/hx-menu-item.styles.d.ts.map +1 -1
  50. package/dist/components/hx-menu/hx-menu.d.ts +117 -2
  51. package/dist/components/hx-menu/hx-menu.d.ts.map +1 -1
  52. package/dist/components/hx-menu/index.js +1 -1
  53. package/dist/components/hx-meter/hx-meter.d.ts +39 -0
  54. package/dist/components/hx-meter/hx-meter.d.ts.map +1 -1
  55. package/dist/components/hx-meter/hx-meter.styles.d.ts.map +1 -1
  56. package/dist/components/hx-meter/index.js +1 -1
  57. package/dist/components/hx-overflow-menu/hx-overflow-menu.d.ts +132 -1
  58. package/dist/components/hx-overflow-menu/hx-overflow-menu.d.ts.map +1 -1
  59. package/dist/components/hx-overflow-menu/index.js +1 -1
  60. package/dist/components/hx-phi-field/hx-phi-field.d.ts +0 -1
  61. package/dist/components/hx-phi-field/hx-phi-field.d.ts.map +1 -1
  62. package/dist/components/hx-popover/index.js +1 -1
  63. package/dist/components/hx-progress-bar/hx-progress-bar.d.ts +33 -0
  64. package/dist/components/hx-progress-bar/hx-progress-bar.d.ts.map +1 -1
  65. package/dist/components/hx-progress-bar/index.js +1 -1
  66. package/dist/components/hx-radio-group/index.js +1 -1
  67. package/dist/components/hx-select/hx-select.d.ts +1 -0
  68. package/dist/components/hx-select/hx-select.d.ts.map +1 -1
  69. package/dist/components/hx-select/index.js +1 -1
  70. package/dist/components/hx-spinner/hx-spinner.d.ts +14 -0
  71. package/dist/components/hx-spinner/hx-spinner.d.ts.map +1 -1
  72. package/dist/components/hx-spinner/index.js +1 -1
  73. package/dist/components/hx-split-button/hx-split-button.d.ts +94 -7
  74. package/dist/components/hx-split-button/hx-split-button.d.ts.map +1 -1
  75. package/dist/components/hx-split-button/index.js +1 -1
  76. package/dist/components/hx-stat/hx-stat.d.ts +28 -0
  77. package/dist/components/hx-stat/hx-stat.d.ts.map +1 -1
  78. package/dist/components/hx-stat/index.js +1 -1
  79. package/dist/components/hx-switch/index.js +1 -1
  80. package/dist/components/hx-table/hx-td.d.ts +30 -3
  81. package/dist/components/hx-table/hx-td.d.ts.map +1 -1
  82. package/dist/components/hx-table/hx-th.d.ts +39 -3
  83. package/dist/components/hx-table/hx-th.d.ts.map +1 -1
  84. package/dist/components/hx-table/hx-tr.d.ts +26 -0
  85. package/dist/components/hx-table/hx-tr.d.ts.map +1 -1
  86. package/dist/components/hx-table/index.js +1 -1
  87. package/dist/components/hx-tabs/hx-tab-panel.d.ts +34 -0
  88. package/dist/components/hx-tabs/hx-tab-panel.d.ts.map +1 -1
  89. package/dist/components/hx-tabs/hx-tab.d.ts +45 -2
  90. package/dist/components/hx-tabs/hx-tab.d.ts.map +1 -1
  91. package/dist/components/hx-tabs/hx-tab.styles.d.ts.map +1 -1
  92. package/dist/components/hx-tabs/hx-tabs.d.ts +32 -2
  93. package/dist/components/hx-tabs/hx-tabs.d.ts.map +1 -1
  94. package/dist/components/hx-tabs/index.js +1 -1
  95. package/dist/components/hx-tag/hx-tag.styles.d.ts.map +1 -1
  96. package/dist/components/hx-tag/index.js +1 -1
  97. package/dist/components/hx-theme/hx-theme.d.ts +10 -5
  98. package/dist/components/hx-theme/hx-theme.d.ts.map +1 -1
  99. package/dist/components/hx-time-picker/hx-time-picker.d.ts +210 -2
  100. package/dist/components/hx-time-picker/hx-time-picker.d.ts.map +1 -1
  101. package/dist/components/hx-time-picker/hx-time-picker.styles.d.ts.map +1 -1
  102. package/dist/components/hx-time-picker/index.js +1 -1
  103. package/dist/components/hx-toast/hx-toast-stack.d.ts +14 -0
  104. package/dist/components/hx-toast/hx-toast-stack.d.ts.map +1 -1
  105. package/dist/components/hx-toast/hx-toast.d.ts +22 -3
  106. package/dist/components/hx-toast/hx-toast.d.ts.map +1 -1
  107. package/dist/components/hx-toast/index.js +1 -1
  108. package/dist/components/hx-toast/toast-factory.d.ts.map +1 -1
  109. package/dist/components/hx-toggle-button/index.js +1 -1
  110. package/dist/components/hx-tree-view/hx-tree-item.d.ts +117 -12
  111. package/dist/components/hx-tree-view/hx-tree-item.d.ts.map +1 -1
  112. package/dist/components/hx-tree-view/hx-tree-view.d.ts +87 -7
  113. package/dist/components/hx-tree-view/hx-tree-view.d.ts.map +1 -1
  114. package/dist/components/hx-tree-view/index.js +1 -1
  115. package/dist/css/helix-all.css +123 -0
  116. package/dist/css/helix-core.css +81 -0
  117. package/dist/css/helix-feedback.css +14 -0
  118. package/dist/css/helix-forms.css +11 -0
  119. package/dist/css/helix-overlay.css +17 -0
  120. package/dist/css/hx-alert.css +9 -0
  121. package/dist/css/hx-badge.css +28 -0
  122. package/dist/css/hx-drawer.css +17 -0
  123. package/dist/css/hx-icon-button.css +30 -0
  124. package/dist/css/hx-meter.css +5 -0
  125. package/dist/css/hx-tag.css +23 -0
  126. package/dist/css/hx-time-picker.css +11 -0
  127. package/dist/css/index.css +1 -1
  128. package/dist/css/manifest.json +3 -1
  129. package/dist/index.js +35 -35
  130. package/dist/shared/aria-idref-CxvyzfQS.js +126 -0
  131. package/dist/shared/aria-idref-CxvyzfQS.js.map +1 -0
  132. package/dist/shared/{hx-alert-CLn7CstP.js → hx-alert-Bto8-TIi.js} +55 -37
  133. package/dist/shared/hx-alert-Bto8-TIi.js.map +1 -0
  134. package/dist/shared/{hx-badge-CQXgOXJM.js → hx-badge-JlFtAdxS.js} +37 -9
  135. package/dist/shared/hx-badge-JlFtAdxS.js.map +1 -0
  136. package/dist/shared/{hx-banner-D3DzpfcP.js → hx-banner-fpRnciIO.js} +13 -5
  137. package/dist/shared/hx-banner-fpRnciIO.js.map +1 -0
  138. package/dist/shared/{hx-button-DPY6SPVT.js → hx-button-BOwAEcF1.js} +108 -85
  139. package/dist/shared/{hx-button-DPY6SPVT.js.map → hx-button-BOwAEcF1.js.map} +1 -1
  140. package/dist/shared/{hx-button-group-BI-QBqmO.js → hx-button-group-DcHP5MBv.js} +15 -16
  141. package/dist/shared/{hx-button-group-BI-QBqmO.js.map → hx-button-group-DcHP5MBv.js.map} +1 -1
  142. package/dist/shared/{hx-checkbox-BdgoUeWi.js → hx-checkbox-C48KYKFq.js} +87 -87
  143. package/dist/shared/hx-checkbox-C48KYKFq.js.map +1 -0
  144. package/dist/shared/{hx-checkbox-group-LWezHrvS.js → hx-checkbox-group-BJIAX3zU.js} +2 -2
  145. package/dist/shared/{hx-checkbox-group-LWezHrvS.js.map → hx-checkbox-group-BJIAX3zU.js.map} +1 -1
  146. package/dist/shared/{hx-color-picker-DVhZl88b.js → hx-color-picker-Dk4cBwYQ.js} +2 -2
  147. package/dist/shared/{hx-color-picker-DVhZl88b.js.map → hx-color-picker-Dk4cBwYQ.js.map} +1 -1
  148. package/dist/shared/{hx-combobox-DvlezcDV.js → hx-combobox-BTLO9qiK.js} +2 -2
  149. package/dist/shared/{hx-combobox-DvlezcDV.js.map → hx-combobox-BTLO9qiK.js.map} +1 -1
  150. package/dist/shared/{hx-data-table-CLqVqdxr.js → hx-data-table-Ct3gQ6ya.js} +3 -2
  151. package/dist/shared/{hx-data-table-CLqVqdxr.js.map → hx-data-table-Ct3gQ6ya.js.map} +1 -1
  152. package/dist/shared/{hx-date-picker-N-0aG5XL.js → hx-date-picker-CiR7FVnR.js} +2 -2
  153. package/dist/shared/{hx-date-picker-N-0aG5XL.js.map → hx-date-picker-CiR7FVnR.js.map} +1 -1
  154. package/dist/shared/{hx-dialog-DzB7VytW.js → hx-dialog-AOZpHSuF.js} +2 -2
  155. package/dist/shared/{hx-dialog-DzB7VytW.js.map → hx-dialog-AOZpHSuF.js.map} +1 -1
  156. package/dist/shared/{hx-drawer-Y1Ui2IWJ.js → hx-drawer-DH6CdAN1.js} +300 -98
  157. package/dist/shared/hx-drawer-DH6CdAN1.js.map +1 -0
  158. package/dist/shared/hx-dropdown-DiLd40Lm.js +401 -0
  159. package/dist/shared/hx-dropdown-DiLd40Lm.js.map +1 -0
  160. package/dist/shared/{hx-icon-button-CGNdQSFM.js → hx-icon-button-a6OpeQz5.js} +149 -68
  161. package/dist/shared/hx-icon-button-a6OpeQz5.js.map +1 -0
  162. package/dist/shared/{hx-link-C-O6vq0Q.js → hx-link-CMnZRUtQ.js} +55 -43
  163. package/dist/shared/hx-link-CMnZRUtQ.js.map +1 -0
  164. package/dist/shared/{hx-list-MyEhh8c7.js → hx-list-De66EtAP.js} +163 -107
  165. package/dist/shared/hx-list-De66EtAP.js.map +1 -0
  166. package/dist/shared/hx-menu-divider-BjiRIWKq.js +797 -0
  167. package/dist/shared/hx-menu-divider-BjiRIWKq.js.map +1 -0
  168. package/dist/shared/{hx-meter-BPscsw5t.js → hx-meter-BJdh6nrF.js} +105 -64
  169. package/dist/shared/hx-meter-BJdh6nrF.js.map +1 -0
  170. package/dist/shared/hx-overflow-menu-BQ4fiMYu.js +492 -0
  171. package/dist/shared/hx-overflow-menu-BQ4fiMYu.js.map +1 -0
  172. package/dist/shared/hx-phi-field-C19oxlrr.js.map +1 -1
  173. package/dist/shared/{hx-popover-CHxWY_cd.js → hx-popover-B9W8-tC0.js} +2 -2
  174. package/dist/shared/{hx-popover-CHxWY_cd.js.map → hx-popover-B9W8-tC0.js.map} +1 -1
  175. package/dist/shared/hx-progress-bar-C8nDMdYa.js +290 -0
  176. package/dist/shared/hx-progress-bar-C8nDMdYa.js.map +1 -0
  177. package/dist/shared/{hx-radio-CeGzARNk.js → hx-radio-Z1lV1zTO.js} +2 -2
  178. package/dist/shared/{hx-radio-CeGzARNk.js.map → hx-radio-Z1lV1zTO.js.map} +1 -1
  179. package/dist/shared/{hx-select-DrcS-YRJ.js → hx-select-D18CnJ0e.js} +2 -2
  180. package/dist/shared/hx-select-D18CnJ0e.js.map +1 -0
  181. package/dist/shared/{hx-spinner-DL5AYr16.js → hx-spinner-BB0h2hKZ.js} +62 -34
  182. package/dist/shared/hx-spinner-BB0h2hKZ.js.map +1 -0
  183. package/dist/shared/{hx-split-button-Djnc5Aeg.js → hx-split-button-BoABoEm5.js} +153 -82
  184. package/dist/shared/hx-split-button-BoABoEm5.js.map +1 -0
  185. package/dist/shared/{hx-stat-WOcNV1Ry.js → hx-stat-Dtf9lz-O.js} +77 -47
  186. package/dist/shared/hx-stat-Dtf9lz-O.js.map +1 -0
  187. package/dist/shared/{hx-switch-BX_8uNUs.js → hx-switch-B6kr-EwE.js} +2 -2
  188. package/dist/shared/{hx-switch-BX_8uNUs.js.map → hx-switch-B6kr-EwE.js.map} +1 -1
  189. package/dist/shared/{hx-tab-panel-DspCrKqo.js → hx-tab-panel-BQtBXKLD.js} +255 -131
  190. package/dist/shared/hx-tab-panel-BQtBXKLD.js.map +1 -0
  191. package/dist/shared/{hx-tag-CNSmdyaK.js → hx-tag-C5aCUpVi.js} +63 -40
  192. package/dist/shared/hx-tag-C5aCUpVi.js.map +1 -0
  193. package/dist/shared/{hx-td-DnnEMIuA.js → hx-td-BGkFOJEK.js} +267 -123
  194. package/dist/shared/hx-td-BGkFOJEK.js.map +1 -0
  195. package/dist/shared/hx-theme-BsefFWTO.js.map +1 -1
  196. package/dist/shared/hx-time-picker-iwCD7rzW.js +1038 -0
  197. package/dist/shared/hx-time-picker-iwCD7rzW.js.map +1 -0
  198. package/dist/shared/{hx-toggle-button-Dcz9IlUm.js → hx-toggle-button-BQ81EDkl.js} +2 -2
  199. package/dist/shared/{hx-toggle-button-Dcz9IlUm.js.map → hx-toggle-button-BQ81EDkl.js.map} +1 -1
  200. package/dist/shared/hx-tree-item-CHrUhuZL.js +925 -0
  201. package/dist/shared/hx-tree-item-CHrUhuZL.js.map +1 -0
  202. package/dist/shared/menu-roving-DmMnzJhn.js +14 -0
  203. package/dist/shared/menu-roving-DmMnzJhn.js.map +1 -0
  204. package/dist/shared/menu-tree-BNM0SYYq.js +42 -0
  205. package/dist/shared/menu-tree-BNM0SYYq.js.map +1 -0
  206. package/dist/shared/{toast-factory-YSznocIV.js → toast-factory-CL2BzdSB.js} +128 -77
  207. package/dist/shared/toast-factory-CL2BzdSB.js.map +1 -0
  208. package/dist/utils/aria-idref.d.ts.map +1 -1
  209. package/dist/utils/menu-label.d.ts +18 -0
  210. package/dist/utils/menu-label.d.ts.map +1 -0
  211. package/dist/utils/menu-roving.d.ts +28 -0
  212. package/dist/utils/menu-roving.d.ts.map +1 -0
  213. package/dist/utils/menu-tree.d.ts +41 -0
  214. package/dist/utils/menu-tree.d.ts.map +1 -0
  215. package/dist/utils/tree-walk.d.ts +53 -0
  216. package/dist/utils/tree-walk.d.ts.map +1 -0
  217. package/figma-inventory.json +69 -20
  218. package/package.json +2 -2
  219. package/dist/shared/aria-idref-Q0yiSR3p.js +0 -104
  220. package/dist/shared/aria-idref-Q0yiSR3p.js.map +0 -1
  221. package/dist/shared/hx-alert-CLn7CstP.js.map +0 -1
  222. package/dist/shared/hx-badge-CQXgOXJM.js.map +0 -1
  223. package/dist/shared/hx-banner-D3DzpfcP.js.map +0 -1
  224. package/dist/shared/hx-checkbox-BdgoUeWi.js.map +0 -1
  225. package/dist/shared/hx-drawer-Y1Ui2IWJ.js.map +0 -1
  226. package/dist/shared/hx-dropdown-DJWlF94E.js +0 -316
  227. package/dist/shared/hx-dropdown-DJWlF94E.js.map +0 -1
  228. package/dist/shared/hx-icon-button-CGNdQSFM.js.map +0 -1
  229. package/dist/shared/hx-link-C-O6vq0Q.js.map +0 -1
  230. package/dist/shared/hx-list-MyEhh8c7.js.map +0 -1
  231. package/dist/shared/hx-menu-divider-C2omnPtj.js +0 -558
  232. package/dist/shared/hx-menu-divider-C2omnPtj.js.map +0 -1
  233. package/dist/shared/hx-meter-BPscsw5t.js.map +0 -1
  234. package/dist/shared/hx-overflow-menu-DCLsdIBy.js +0 -374
  235. package/dist/shared/hx-overflow-menu-DCLsdIBy.js.map +0 -1
  236. package/dist/shared/hx-progress-bar-Bn3JEPUf.js +0 -258
  237. package/dist/shared/hx-progress-bar-Bn3JEPUf.js.map +0 -1
  238. package/dist/shared/hx-select-DrcS-YRJ.js.map +0 -1
  239. package/dist/shared/hx-spinner-DL5AYr16.js.map +0 -1
  240. package/dist/shared/hx-split-button-Djnc5Aeg.js.map +0 -1
  241. package/dist/shared/hx-stat-WOcNV1Ry.js.map +0 -1
  242. package/dist/shared/hx-tab-panel-DspCrKqo.js.map +0 -1
  243. package/dist/shared/hx-tag-CNSmdyaK.js.map +0 -1
  244. package/dist/shared/hx-td-DnnEMIuA.js.map +0 -1
  245. package/dist/shared/hx-time-picker-BoEIZwzv.js +0 -688
  246. package/dist/shared/hx-time-picker-BoEIZwzv.js.map +0 -1
  247. package/dist/shared/hx-tree-item-C2CiWuDE.js +0 -703
  248. package/dist/shared/hx-tree-item-C2CiWuDE.js.map +0 -1
  249. package/dist/shared/toast-factory-YSznocIV.js.map +0 -1
@@ -0,0 +1,797 @@
1
+ import { css as _, html as u, nothing as o } from "lit";
2
+ import { property as d, customElement as v, state as x, query as T } from "lit/decorators.js";
3
+ import { f as g } from "./forced-colors-CTEDFRGa.js";
4
+ import { d as R } from "./dev-warn-YlwPHjtX.js";
5
+ import { s as y, i as w, r as S } from "./aria-idref-CxvyzfQS.js";
6
+ import { f as C } from "./aria-flatten-DY6v2vah.js";
7
+ import { g as H, f as A, a as M } from "./menu-tree-BNM0SYYq.js";
8
+ import { H as I } from "./helix-element-BNEYeiys.js";
9
+ import { classMap as k } from "lit/directives/class-map.js";
10
+ const O = _`
11
+ :host {
12
+ display: block;
13
+ }
14
+
15
+ .menu {
16
+ display: flex;
17
+ flex-direction: column;
18
+ padding: var(--hx-space-1, 0.25rem);
19
+ background: var(--hx-menu-bg, var(--hx-color-surface-default, #ffffff));
20
+ border: var(--hx-border-width-thin, 1px) solid
21
+ var(--hx-menu-border-color, var(--hx-color-border-default, #d6dbd5));
22
+ border-radius: var(--hx-menu-border-radius, var(--hx-border-radius-md, 0.375rem));
23
+ box-shadow: var(
24
+ --hx-menu-shadow,
25
+ var(--hx-shadow-md, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1))
26
+ );
27
+ min-width: var(--hx-menu-min-width, 10rem);
28
+ max-height: var(--hx-menu-max-height, 20rem);
29
+ overflow-y: auto;
30
+ outline: none;
31
+ }
32
+
33
+ /* ─── High Contrast Mode (forced-colors) ─── */
34
+
35
+ @media (forced-colors: active) {
36
+ .menu {
37
+ background-color: Canvas;
38
+ border: 2px solid CanvasText;
39
+ }
40
+ }
41
+ `;
42
+ var $ = Object.defineProperty, D = Object.getOwnPropertyDescriptor, E = (e, t, s, n) => {
43
+ for (var i = n > 1 ? void 0 : n ? D(t, s) : t, r = e.length - 1, a; r >= 0; r--)
44
+ (a = e[r]) && (i = (n ? a(t, s, i) : a(i)) || i);
45
+ return n && i && $(t, s, i), i;
46
+ };
47
+ function p(e) {
48
+ const t = A(e);
49
+ return t instanceof Element && t.tagName.toLowerCase() === "hx-menu" ? t : null;
50
+ }
51
+ function B(e) {
52
+ const t = M(e);
53
+ return t instanceof Element && t.tagName.toLowerCase() === "hx-menu-item" ? t : null;
54
+ }
55
+ let f = class extends I {
56
+ constructor() {
57
+ super(...arguments), this.label = "", this._focusedIndex = -1, this._typeaheadBuffer = "", this._typeaheadTimer = null, this._supportsIdrefRefs = !0, this._ariaMirror = null, this._resolvedAccessibleName = "", this._handleSubmenuOpen = (e) => {
58
+ if (!(e instanceof CustomEvent)) return;
59
+ const t = e.detail, s = t == null ? void 0 : t.item;
60
+ s && queueMicrotask(() => {
61
+ e.defaultPrevented || (s.setSubmenuOpen(!0), s.updateComplete.then(() => {
62
+ var r;
63
+ const n = (r = s.shadowRoot) == null ? void 0 : r.querySelector('slot[name="submenu"]'), i = n == null ? void 0 : n.assignedElements({ flatten: !0 }).find((a) => a.tagName.toLowerCase() === "hx-menu");
64
+ i == null || i.focusFirst();
65
+ }).catch(() => {
66
+ }));
67
+ });
68
+ }, this._handleSubmenuClose = (e) => {
69
+ if (!(e instanceof CustomEvent)) return;
70
+ const t = e.detail, s = t == null ? void 0 : t.item;
71
+ if (!s || p(s) !== this) return;
72
+ const i = B(this) ?? s;
73
+ queueMicrotask(() => {
74
+ e.defaultPrevented || (i.setSubmenuOpen(!1), i.focus());
75
+ });
76
+ }, this._handleHostKeyDown = (e) => {
77
+ const t = e.target;
78
+ t instanceof Element && p(t) !== this || this._handleKeyDown(e);
79
+ }, this._handleItemSelectHost = (e) => {
80
+ if (!(e instanceof CustomEvent)) return;
81
+ const t = e.detail, s = t == null ? void 0 : t.item;
82
+ s && p(s) !== this || this._handleItemSelect(e);
83
+ };
84
+ }
85
+ /**
86
+ * Return the menu's enabled, top-level `hx-menu-item` children.
87
+ *
88
+ * Codex push-gate round-6 finding 3: `querySelectorAll('hx-menu-item')`
89
+ * walks the entire descendant tree, which on a parent menuitem
90
+ * includes the slotted nested `<hx-menu>` and ITS items. Treating
91
+ * those as top-level options corrupts roving tabindex, ArrowUp/Down
92
+ * navigation, and typeahead matching (typing the first letter of a
93
+ * grandchild item lands focus there instead of on the next sibling).
94
+ * Restrict to direct children of `this` so each menu owns only its
95
+ * own items.
96
+ *
97
+ * @internal
98
+ */
99
+ _getItems() {
100
+ return Array.from(this.children).filter(
101
+ (e) => e.tagName.toLowerCase() === "hx-menu-item" && !e.disabled && !e.loading
102
+ );
103
+ }
104
+ /**
105
+ * Synchronize roving tabindex across all enabled items.
106
+ * Only the active item (or first item if none active) gets tabindex=0.
107
+ */
108
+ /** @internal */
109
+ _syncRovingTabIndex() {
110
+ const e = this._getItems(), t = this._focusedIndex >= 0 ? this._focusedIndex : 0;
111
+ e.forEach((s, n) => {
112
+ s.setRovingTabIndex(n === t ? 0 : -1);
113
+ });
114
+ }
115
+ /** Focus the first menu item. */
116
+ focusFirst() {
117
+ const t = this._getItems()[0];
118
+ t !== void 0 && (this._focusedIndex = 0, this._syncRovingTabIndex(), t.focus());
119
+ }
120
+ /** Focus the last menu item. */
121
+ focusLast() {
122
+ const e = this._getItems(), t = e[e.length - 1];
123
+ t !== void 0 && (this._focusedIndex = e.length - 1, this._syncRovingTabIndex(), t.focus());
124
+ }
125
+ /** @internal */
126
+ _focusItem(e) {
127
+ const t = this._getItems();
128
+ if (t.length === 0) return;
129
+ this._focusedIndex = Math.max(0, Math.min(e, t.length - 1)), this._syncRovingTabIndex();
130
+ const s = t[this._focusedIndex];
131
+ s !== void 0 && s.focus();
132
+ }
133
+ /** @internal */
134
+ _updateFocusedIndex() {
135
+ var n;
136
+ const e = this._getItems(), t = ((n = this.shadowRoot) == null ? void 0 : n.activeElement) ?? document.activeElement, s = e.findIndex((i) => i.matches(":focus-within") || i === t);
137
+ s !== -1 && (this._focusedIndex = s);
138
+ }
139
+ /** @internal */
140
+ _handleKeyDown(e) {
141
+ this._updateFocusedIndex();
142
+ const t = this._getItems();
143
+ if (t.length !== 0)
144
+ switch (e.key) {
145
+ case "ArrowDown":
146
+ e.preventDefault(), this._focusItem(this._focusedIndex + 1 < t.length ? this._focusedIndex + 1 : 0);
147
+ break;
148
+ case "ArrowUp":
149
+ e.preventDefault(), this._focusItem(this._focusedIndex > 0 ? this._focusedIndex - 1 : t.length - 1);
150
+ break;
151
+ case "Home":
152
+ e.preventDefault(), this._focusItem(0);
153
+ break;
154
+ case "End":
155
+ e.preventDefault(), this._focusItem(t.length - 1);
156
+ break;
157
+ case "Escape":
158
+ e.preventDefault(), this.dispatchEvent(new CustomEvent("hx-close", { bubbles: !0, composed: !0 }));
159
+ break;
160
+ default:
161
+ e.key.length === 1 && e.key !== " " && !e.ctrlKey && !e.metaKey && !e.altKey && this._handleTypeahead(e.key, t);
162
+ break;
163
+ }
164
+ }
165
+ /** @internal */
166
+ _handleTypeahead(e, t) {
167
+ this._typeaheadTimer !== null && clearTimeout(this._typeaheadTimer), this._typeaheadBuffer += e.toLowerCase(), this._typeaheadTimer = setTimeout(() => {
168
+ this._typeaheadBuffer = "", this._typeaheadTimer = null;
169
+ }, 500);
170
+ const s = t.findIndex((n) => n.disabled || n.hasAttribute("disabled") ? !1 : this._getTypeaheadLabel(n).toLowerCase().startsWith(this._typeaheadBuffer));
171
+ s !== -1 && this._focusItem(s);
172
+ }
173
+ /**
174
+ * Read the typeahead label for an item — delegates to the shared
175
+ * `getMenuItemTypeaheadLabel` util so all four menu-bearing components
176
+ * (`hx-menu`, `hx-dropdown`, `hx-overflow-menu`, `hx-split-button`)
177
+ * share one submenu-aware extractor. Codex push-gate round-7 finding 3
178
+ * extracted this helper from its original home here in `hx-menu.ts`.
179
+ *
180
+ * @internal
181
+ */
182
+ _getTypeaheadLabel(e) {
183
+ return H(e);
184
+ }
185
+ /** @internal */
186
+ _handleSlotChange(e) {
187
+ const t = e.target;
188
+ if (!(t instanceof HTMLSlotElement)) return;
189
+ const s = /* @__PURE__ */ new Set(["hx-menu-item", "hx-menu-divider"]), n = t.assignedElements().filter((i) => !s.has(i.tagName.toLowerCase()));
190
+ n.length > 0 && R(
191
+ "hx-menu",
192
+ `Default slot expects <hx-menu-item> or <hx-menu-divider> elements. Found unexpected: ${n.map((i) => `<${i.tagName.toLowerCase()}>`).join(", ")}`
193
+ ), this._syncRovingTabIndex();
194
+ }
195
+ /** @internal */
196
+ _handleItemSelect(e) {
197
+ if (!(e instanceof CustomEvent)) return;
198
+ const t = e.detail, s = this._getItems();
199
+ this._focusedIndex = s.indexOf(t.item), this.dispatchEvent(
200
+ new CustomEvent("hx-select", {
201
+ bubbles: !0,
202
+ composed: !0,
203
+ detail: { item: t.item, value: t.value }
204
+ })
205
+ );
206
+ }
207
+ // ─── Lifecycle ───
208
+ connectedCallback() {
209
+ super.connectedCallback();
210
+ const e = this.constructor;
211
+ this._supportsIdrefRefs = e.__testSupportsIdrefRefsOverride !== null ? e.__testSupportsIdrefRefsOverride : y(this._internals), this.addEventListener("keydown", this._handleHostKeyDown), this.addEventListener("hx-item-select", this._handleItemSelectHost), this.addEventListener("hx-item-submenu-open", this._handleSubmenuOpen), this.addEventListener("hx-item-submenu-close", this._handleSubmenuClose), this._syncHostAriaSemantics(), this._ariaMirror = w(this, () => {
212
+ this._syncHostAriaSemantics();
213
+ });
214
+ }
215
+ disconnectedCallback() {
216
+ var e;
217
+ super.disconnectedCallback(), this._typeaheadTimer !== null && (clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null), this.removeEventListener("keydown", this._handleHostKeyDown), this.removeEventListener("hx-item-select", this._handleItemSelectHost), this.removeEventListener("hx-item-submenu-open", this._handleSubmenuOpen), this.removeEventListener("hx-item-submenu-close", this._handleSubmenuClose), (e = this._ariaMirror) == null || e.disconnect(), this._ariaMirror = null;
218
+ }
219
+ updated(e) {
220
+ super.updated(e), e.has("label") && this._syncHostAriaSemantics();
221
+ }
222
+ firstUpdated() {
223
+ this.hasAttribute("aria-label") || this.hasAttribute("aria-labelledby") || this.label;
224
+ }
225
+ /**
226
+ * Mirror menu semantics onto the host via ElementInternals so consumer-
227
+ * supplied `aria-label`, `aria-labelledby`, and the `label` property all
228
+ * reach the announced control. Falls back to a flattened-string label on
229
+ * engines that do not implement `ariaLabelledByElements`.
230
+ * @internal
231
+ */
232
+ _syncHostAriaSemantics() {
233
+ var a;
234
+ const e = this._internals;
235
+ this._supportsIdrefRefs ? e.role = "menu" : (e.role = null, e.ariaLabel = null);
236
+ const t = ((a = this.getAttribute("aria-label")) == null ? void 0 : a.trim()) || "", s = this.getAttribute("aria-labelledby"), n = S(this, s), i = n.length > 0;
237
+ if (this._supportsIdrefRefs) {
238
+ const m = e;
239
+ m.ariaLabelledByElements = i ? n : null;
240
+ }
241
+ let r = "";
242
+ i ? (r = n.map((c) => C(c)).filter(Boolean).join(" ") || t || this.label || "Menu", this._supportsIdrefRefs && (e.ariaLabel = null)) : t ? (r = t, this._supportsIdrefRefs && (e.ariaLabel = t)) : (r = this.label || "Menu", this._supportsIdrefRefs && (e.ariaLabel = r)), this._resolvedAccessibleName !== r && (this._resolvedAccessibleName = r, this._supportsIdrefRefs || this.requestUpdate());
243
+ }
244
+ render() {
245
+ if (this._supportsIdrefRefs)
246
+ return u`
247
+ <div part="base" class="menu">
248
+ <slot @slotchange=${this._handleSlotChange}></slot>
249
+ </div>
250
+ `;
251
+ const e = this._resolvedAccessibleName || this.label || o;
252
+ return u`
253
+ <div part="base" class="menu" role="menu" aria-label=${e}>
254
+ <slot @slotchange=${this._handleSlotChange}></slot>
255
+ </div>
256
+ `;
257
+ }
258
+ };
259
+ f.styles = [O, g];
260
+ f.__testSupportsIdrefRefsOverride = null;
261
+ E([
262
+ d({ type: String, reflect: !0 })
263
+ ], f.prototype, "label", 2);
264
+ f = E([
265
+ v("hx-menu")
266
+ ], f);
267
+ const N = _`
268
+ :host {
269
+ display: block;
270
+ /* Host carries the roving tabindex on the modern host-canonical path,
271
+ so it becomes the focusable surface. Strip the default focus outline
272
+ from the host so the inner .menu-item:focus-visible (and the host
273
+ :focus-visible rule below) own the visual treatment. */
274
+ outline: none;
275
+ }
276
+
277
+ :host([disabled]) {
278
+ pointer-events: none;
279
+ opacity: var(--hx-opacity-disabled, 0.5);
280
+ }
281
+
282
+ /* Host is the Tab stop on the modern path; mirror the inner focus-ring
283
+ onto the host so keyboard focus is visible on whichever surface the
284
+ UA paints. The inner-element rule below still applies on the legacy
285
+ fallback path (where the inner div carries the role + tabindex). */
286
+ :host(:focus-visible) .menu-item {
287
+ background-color: var(--hx-menu-item-hover-bg, var(--hx-color-surface-sunken, #ebeee9));
288
+ outline: var(--hx-focus-ring-width, 2px) solid
289
+ var(--hx-menu-item-focus-ring-color, var(--hx-focus-ring-color, #0f7078));
290
+ outline-offset: var(--hx-menu-item-focus-ring-offset, 0px);
291
+ }
292
+
293
+ .menu-item {
294
+ display: flex;
295
+ align-items: center;
296
+ gap: var(--hx-space-2, 0.5rem);
297
+ min-height: var(--hx-touch-target-min, 44px);
298
+ padding: var(--hx-space-2, 0.5rem) var(--hx-space-3, 0.75rem);
299
+ border-radius: var(--hx-border-radius-sm, 0.25rem);
300
+ cursor: pointer;
301
+ color: var(--hx-menu-item-color, var(--hx-color-text-primary, #0d1825));
302
+ font-size: var(--hx-font-size-sm, 0.875rem);
303
+ font-family: var(--hx-menu-item-font-family, var(--hx-font-family-sans, sans-serif));
304
+ line-height: var(--hx-line-height-tight, 1.25);
305
+ user-select: none;
306
+ -webkit-user-select: none;
307
+ outline: none;
308
+ background: none;
309
+ width: 100%;
310
+ box-sizing: border-box;
311
+ transition: background-color var(--hx-transition-fast, 150ms ease);
312
+ }
313
+
314
+ .menu-item:hover,
315
+ .menu-item:focus-visible {
316
+ background-color: var(--hx-menu-item-hover-bg, var(--hx-color-surface-sunken, #ebeee9));
317
+ }
318
+
319
+ .menu-item:focus-visible {
320
+ outline: var(--hx-focus-ring-width, 2px) solid
321
+ var(--hx-menu-item-focus-ring-color, var(--hx-focus-ring-color, #0f7078));
322
+ outline-offset: var(--hx-menu-item-focus-ring-offset, 0px);
323
+ }
324
+
325
+ .menu-item__prefix,
326
+ .menu-item__suffix {
327
+ display: inline-flex;
328
+ align-items: center;
329
+ flex-shrink: 0;
330
+ }
331
+
332
+ .menu-item__label {
333
+ flex: 1 1 auto;
334
+ }
335
+
336
+ .menu-item__checked-icon {
337
+ display: inline-flex;
338
+ align-items: center;
339
+ flex-shrink: 0;
340
+ width: 1em;
341
+ opacity: 0;
342
+ transition: opacity var(--hx-transition-fast, 150ms ease);
343
+ }
344
+
345
+ .menu-item--checked .menu-item__checked-icon {
346
+ opacity: 1;
347
+ }
348
+
349
+ .menu-item__submenu-icon {
350
+ display: inline-flex;
351
+ align-items: center;
352
+ flex-shrink: 0;
353
+ margin-inline-start: auto;
354
+ }
355
+
356
+ .menu-item__spinner {
357
+ width: 1em;
358
+ height: 1em;
359
+ flex-shrink: 0;
360
+ animation: hx-menu-spin var(--hx-duration-spinner, 750ms) linear infinite;
361
+ }
362
+
363
+ @keyframes hx-menu-spin {
364
+ to {
365
+ transform: rotate(360deg);
366
+ }
367
+ }
368
+
369
+ @media (prefers-reduced-motion: reduce) {
370
+ .menu-item {
371
+ transition: none;
372
+ }
373
+
374
+ .menu-item__checked-icon {
375
+ transition: none;
376
+ }
377
+
378
+ .menu-item__spinner {
379
+ animation: none;
380
+ opacity: var(--hx-opacity-muted, 0.6);
381
+ }
382
+ }
383
+
384
+ /* ─── High Contrast Mode (forced-colors) ─── */
385
+
386
+ @media (forced-colors: active) {
387
+ .menu-item {
388
+ forced-color-adjust: none;
389
+ color: CanvasText;
390
+ background-color: Canvas;
391
+ }
392
+
393
+ .menu-item:hover,
394
+ .menu-item:focus-visible {
395
+ background-color: Highlight;
396
+ color: HighlightText;
397
+ }
398
+
399
+ .menu-item:focus-visible {
400
+ outline: 2px solid Highlight;
401
+ outline-offset: -2px;
402
+ }
403
+
404
+ /* Host-canonical focus parity in forced-colors mode. */
405
+ :host(:focus-visible) .menu-item {
406
+ background-color: Highlight;
407
+ color: HighlightText;
408
+ outline: 2px solid Highlight;
409
+ outline-offset: -2px;
410
+ }
411
+
412
+ :host([disabled]) .menu-item {
413
+ color: GrayText;
414
+ opacity: 1;
415
+ }
416
+ }
417
+ `;
418
+ var j = Object.defineProperty, K = Object.getOwnPropertyDescriptor, h = (e, t, s, n) => {
419
+ for (var i = n > 1 ? void 0 : n ? K(t, s) : t, r = e.length - 1, a; r >= 0; r--)
420
+ (a = e[r]) && (i = (n ? a(t, s, i) : a(i)) || i);
421
+ return n && i && j(t, s, i), i;
422
+ };
423
+ let l = class extends I {
424
+ constructor() {
425
+ super(...arguments), this._rovingTabIndex = -1, this.value = "", this.disabled = !1, this.checked = !1, this.type = "normal", this.loading = !1, this._hasSubmenu = !1, this._submenuOpen = !1, this._supportsIdrefRefs = !0, this._ariaMirror = null, this._resolvedAccessibleName = "", this._handleClick = (e) => {
426
+ if (this._isOwnEvent(e)) {
427
+ if (this.disabled || this.loading) {
428
+ e.preventDefault(), e.stopPropagation();
429
+ return;
430
+ }
431
+ this._activate();
432
+ }
433
+ }, this._handleKeyDown = (e) => {
434
+ if (this._isOwnEvent(e)) {
435
+ if (e.key === "Enter" || e.key === " ") {
436
+ e.preventDefault(), this._activate();
437
+ return;
438
+ }
439
+ if (e.key === "ArrowRight" && this._hasSubmenu) {
440
+ e.preventDefault(), this.dispatchEvent(
441
+ new CustomEvent("hx-item-submenu-open", {
442
+ bubbles: !0,
443
+ composed: !0,
444
+ cancelable: !0,
445
+ detail: { item: this }
446
+ })
447
+ );
448
+ return;
449
+ }
450
+ e.key === "ArrowLeft" && (e.preventDefault(), this.dispatchEvent(
451
+ new CustomEvent("hx-item-submenu-close", {
452
+ bubbles: !0,
453
+ composed: !0,
454
+ cancelable: !0,
455
+ detail: { item: this }
456
+ })
457
+ ));
458
+ }
459
+ };
460
+ }
461
+ /** @internal Set the roving tabindex value. Called by parent hx-menu. */
462
+ setRovingTabIndex(e) {
463
+ this._rovingTabIndex = e, this._applyHostTabIndex();
464
+ }
465
+ /** Set whether the nested submenu is open. Called by the component managing submenu visibility. */
466
+ setSubmenuOpen(e) {
467
+ this._submenuOpen = e;
468
+ }
469
+ /**
470
+ * Focus the menu item. On the modern host-canonical path, focus lands on
471
+ * the host (which carries the roving tabindex and announced role). On the
472
+ * legacy fallback path, focus delegates to the inner element which still
473
+ * carries the role.
474
+ */
475
+ focus(e) {
476
+ var t;
477
+ this._supportsIdrefRefs ? HTMLElement.prototype.focus.call(this, e) : (t = this._menuItemEl) == null || t.focus(e);
478
+ }
479
+ connectedCallback() {
480
+ super.connectedCallback();
481
+ const e = this.constructor;
482
+ this._supportsIdrefRefs = e.__testSupportsIdrefRefsOverride !== null ? e.__testSupportsIdrefRefsOverride : y(this._internals), this.closest('hx-menu, hx-split-button, [role="menu"], [role="menubar"]'), this.addEventListener("keydown", this._handleKeyDown), this.addEventListener("click", this._handleClick), this._syncHostAriaSemantics(), this._applyHostTabIndex(), this._ariaMirror = w(this, () => {
483
+ this._syncHostAriaSemantics();
484
+ });
485
+ }
486
+ disconnectedCallback() {
487
+ var e;
488
+ super.disconnectedCallback(), this.removeEventListener("keydown", this._handleKeyDown), this.removeEventListener("click", this._handleClick), (e = this._ariaMirror) == null || e.disconnect(), this._ariaMirror = null;
489
+ }
490
+ updated(e) {
491
+ super.updated(e), (e.has("disabled") || e.has("checked") || e.has("type") || e.has("loading") || e.has("_hasSubmenu") || e.has("_submenuOpen")) && this._syncHostAriaSemantics(), (e.has("_rovingTabIndex") || e.has("disabled")) && this._applyHostTabIndex();
492
+ }
493
+ /**
494
+ * Apply the roving tabindex to the host (modern path) so the host is the
495
+ * Tab stop. Disabled items are non-tabbable.
496
+ *
497
+ * Codex push-gate round-1 finding 3: on the fallback path
498
+ * (`_supportsIdrefRefs === false`), the inner `.menu-item` element
499
+ * carries `role="menuitem"` and the roving tabindex via the template
500
+ * (see `render()`'s legacy branch). If we ALSO assign a non-negative
501
+ * tabindex to the host, the user gets two focusable surfaces per item —
502
+ * Tab can land on the host even though the AT-announced role/aria-* live
503
+ * on the inner element. The host MUST be removed from the tab order on
504
+ * the fallback path; the inner element is the canonical Tab stop.
505
+ * @internal
506
+ */
507
+ _applyHostTabIndex() {
508
+ if (!this._supportsIdrefRefs) {
509
+ this.tabIndex = -1;
510
+ return;
511
+ }
512
+ this.disabled ? this.tabIndex = -1 : this.tabIndex = this._rovingTabIndex;
513
+ }
514
+ /**
515
+ * Mirror menuitem semantics onto the host via ElementInternals. Role is
516
+ * derived from `type` (normal → menuitem, checkbox → menuitemcheckbox,
517
+ * radio → menuitemradio). aria-disabled, aria-checked, aria-haspopup,
518
+ * aria-expanded, and aria-busy reactively follow component state.
519
+ * Consumer-supplied `aria-label` / `aria-labelledby` on the host project
520
+ * onto `internals.ariaLabel` / `internals.ariaLabelledByElements`.
521
+ * @internal
522
+ */
523
+ _syncHostAriaSemantics() {
524
+ var m;
525
+ const e = this._internals, t = this._getRole();
526
+ if (!this._supportsIdrefRefs)
527
+ e.role = null, e.ariaDisabled = null, e.ariaChecked = null, e.ariaHasPopup = null, e.ariaExpanded = null, e.ariaBusy = null;
528
+ else {
529
+ e.role = t, e.ariaDisabled = this.disabled ? "true" : null;
530
+ const c = this.type === "checkbox" || this.type === "radio";
531
+ e.ariaChecked = c ? this.checked ? "true" : "false" : null, e.ariaHasPopup = this._hasSubmenu ? "menu" : null, e.ariaExpanded = this._hasSubmenu ? this._submenuOpen ? "true" : "false" : null, e.ariaBusy = this.loading ? "true" : null;
532
+ }
533
+ const s = ((m = this.getAttribute("aria-label")) == null ? void 0 : m.trim()) || "", n = this.getAttribute("aria-labelledby"), i = S(this, n), r = i.length > 0;
534
+ if (this._supportsIdrefRefs) {
535
+ const c = e;
536
+ c.ariaLabelledByElements = r ? i : null;
537
+ }
538
+ let a = "";
539
+ if (r) {
540
+ const c = i.map((L) => C(L)).filter(Boolean).join(" ") || s || "";
541
+ a = c, this._supportsIdrefRefs ? e.ariaLabel = null : e.ariaLabel = c || null;
542
+ } else s ? (a = s, this._supportsIdrefRefs ? e.ariaLabel = s : e.ariaLabel = null) : e.ariaLabel = null;
543
+ this._resolvedAccessibleName !== a && (this._resolvedAccessibleName = a, this._supportsIdrefRefs || this.requestUpdate());
544
+ }
545
+ /** @internal */
546
+ _handleSubmenuSlotChange(e) {
547
+ const t = e.target;
548
+ this._hasSubmenu = t.assignedElements().length > 0;
549
+ }
550
+ /** @internal */
551
+ _activate() {
552
+ if (!(this.disabled || this.loading)) {
553
+ if (this.type === "checkbox")
554
+ this.checked = !this.checked;
555
+ else if (this.type === "radio") {
556
+ const e = this.closest("hx-menu");
557
+ e ? e.querySelectorAll(':scope > hx-menu-item[type="radio"]').forEach((t) => {
558
+ t.checked = t === this;
559
+ }) : this.checked = !0;
560
+ }
561
+ this.dispatchEvent(
562
+ new CustomEvent("hx-item-select", {
563
+ bubbles: !0,
564
+ composed: !0,
565
+ detail: { item: this, value: this.value }
566
+ })
567
+ );
568
+ }
569
+ }
570
+ /**
571
+ * Origin guard for host-bound click/keydown handlers. Returns `true` only
572
+ * when the event originated on THIS host (its shadow tree) and not on a
573
+ * nested `hx-menu-item` projected into the `submenu` slot.
574
+ *
575
+ * Codex push-gate round-5 P1: nested submenu items are slotted descendants
576
+ * in the parent's light DOM. Click/keydown events from a Child item bubble
577
+ * through the parent host's listeners — without this guard, selecting Child
578
+ * also activates Parent (double `hx-item-select`) and Enter/Space/ArrowRight
579
+ * on Child re-trigger Parent's handlers (wrong-level activation, second
580
+ * submenu reopen).
581
+ *
582
+ * Walks `composedPath()` and returns the closest `hx-menu-item` ancestor of
583
+ * the original target; the event is "ours" iff that ancestor is `this`.
584
+ * Mirrors the inner-vs-host origin discipline used by `hx-checkbox`,
585
+ * `hx-switch`, and `hx-toggle-button`'s host handlers (`path[0] !== this`)
586
+ * but adapts for hx-menu-item's nested-host case where path[0] is the
587
+ * deepest inner element of a slotted child's own shadow tree.
588
+ * @internal
589
+ */
590
+ _isOwnEvent(e) {
591
+ const t = e.composedPath();
592
+ for (const s of t)
593
+ if (s instanceof Element && s.tagName === "HX-MENU-ITEM")
594
+ return s === this;
595
+ return !1;
596
+ }
597
+ /** @internal */
598
+ _renderCheckedIcon() {
599
+ return u`
600
+ <span part="checked-icon" class="menu-item__checked-icon" aria-hidden="true">
601
+ <svg
602
+ width="1em"
603
+ height="1em"
604
+ viewBox="0 0 24 24"
605
+ fill="none"
606
+ stroke="currentColor"
607
+ stroke-width="3"
608
+ stroke-linecap="round"
609
+ stroke-linejoin="round"
610
+ >
611
+ <polyline points="20 6 9 17 4 12" />
612
+ </svg>
613
+ </span>
614
+ `;
615
+ }
616
+ /** @internal */
617
+ _renderSubmenuIcon() {
618
+ return u`
619
+ <span part="submenu-icon" class="menu-item__submenu-icon" aria-hidden="true">
620
+ <svg
621
+ width="1em"
622
+ height="1em"
623
+ viewBox="0 0 24 24"
624
+ fill="none"
625
+ stroke="currentColor"
626
+ stroke-width="2"
627
+ stroke-linecap="round"
628
+ stroke-linejoin="round"
629
+ >
630
+ <polyline points="9 18 15 12 9 6" />
631
+ </svg>
632
+ </span>
633
+ `;
634
+ }
635
+ /** @internal */
636
+ _renderSpinner() {
637
+ return u`
638
+ <svg class="menu-item__spinner" aria-hidden="true" viewBox="0 0 24 24" fill="none">
639
+ <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="3" opacity="0.3" />
640
+ <path
641
+ d="M12 2a10 10 0 0 1 10 10"
642
+ stroke="currentColor"
643
+ stroke-width="3"
644
+ stroke-linecap="round"
645
+ />
646
+ </svg>
647
+ `;
648
+ }
649
+ /** @internal */
650
+ _getRole() {
651
+ switch (this.type) {
652
+ case "checkbox":
653
+ return "menuitemcheckbox";
654
+ case "radio":
655
+ return "menuitemradio";
656
+ default:
657
+ return "menuitem";
658
+ }
659
+ }
660
+ render() {
661
+ const e = this._getRole(), t = this.type === "checkbox" || this.type === "radio", s = {
662
+ "menu-item": !0,
663
+ "menu-item--checked": this.checked
664
+ };
665
+ if (this._supportsIdrefRefs)
666
+ return u`
667
+ <div part="base" class=${k(s)}>
668
+ ${this.loading ? this._renderSpinner() : o}
669
+ ${t ? this._renderCheckedIcon() : o}
670
+ <span part="prefix" class="menu-item__prefix">
671
+ <slot name="prefix"></slot>
672
+ </span>
673
+ <span part="label" class="menu-item__label">
674
+ <slot></slot>
675
+ </span>
676
+ <span part="suffix" class="menu-item__suffix">
677
+ <slot name="suffix"></slot>
678
+ </span>
679
+ ${this._hasSubmenu ? this._renderSubmenuIcon() : o}
680
+ <slot name="submenu" @slotchange=${this._handleSubmenuSlotChange}></slot>
681
+ </div>
682
+ `;
683
+ const n = this._resolvedAccessibleName || o;
684
+ return u`
685
+ <div
686
+ part="base"
687
+ class=${k(s)}
688
+ role=${e}
689
+ tabindex=${this.disabled ? "-1" : String(this._rovingTabIndex)}
690
+ aria-label=${n}
691
+ aria-disabled=${this.disabled ? "true" : o}
692
+ aria-checked=${t ? this.checked ? "true" : "false" : o}
693
+ aria-haspopup=${this._hasSubmenu ? "menu" : o}
694
+ aria-expanded=${this._hasSubmenu ? this._submenuOpen ? "true" : "false" : o}
695
+ aria-busy=${this.loading ? "true" : o}
696
+ >
697
+ ${this.loading ? this._renderSpinner() : o}
698
+ ${t ? this._renderCheckedIcon() : o}
699
+ <span part="prefix" class="menu-item__prefix">
700
+ <slot name="prefix"></slot>
701
+ </span>
702
+ <span part="label" class="menu-item__label">
703
+ <slot></slot>
704
+ </span>
705
+ <span part="suffix" class="menu-item__suffix">
706
+ <slot name="suffix"></slot>
707
+ </span>
708
+ ${this._hasSubmenu ? this._renderSubmenuIcon() : o}
709
+ <slot name="submenu" @slotchange=${this._handleSubmenuSlotChange}></slot>
710
+ </div>
711
+ `;
712
+ }
713
+ };
714
+ l.styles = [N, g];
715
+ l.__testSupportsIdrefRefsOverride = null;
716
+ h([
717
+ x()
718
+ ], l.prototype, "_rovingTabIndex", 2);
719
+ h([
720
+ d({ type: String })
721
+ ], l.prototype, "value", 2);
722
+ h([
723
+ d({ type: Boolean, reflect: !0 })
724
+ ], l.prototype, "disabled", 2);
725
+ h([
726
+ d({ type: Boolean, reflect: !0 })
727
+ ], l.prototype, "checked", 2);
728
+ h([
729
+ d({ type: String, reflect: !0 })
730
+ ], l.prototype, "type", 2);
731
+ h([
732
+ d({ type: Boolean, reflect: !0 })
733
+ ], l.prototype, "loading", 2);
734
+ h([
735
+ x()
736
+ ], l.prototype, "_hasSubmenu", 2);
737
+ h([
738
+ x()
739
+ ], l.prototype, "_submenuOpen", 2);
740
+ h([
741
+ T(".menu-item")
742
+ ], l.prototype, "_menuItemEl", 2);
743
+ l = h([
744
+ v("hx-menu-item")
745
+ ], l);
746
+ const q = _`
747
+ :host {
748
+ display: block;
749
+ }
750
+
751
+ .menu-divider {
752
+ height: var(--hx-border-width-thin, 1px);
753
+ background-color: var(--hx-menu-divider-color, var(--hx-color-border-default, #d6dbd5));
754
+ margin: var(--hx-space-1, 0.25rem) calc(-1 * var(--hx-space-1, 0.25rem));
755
+ }
756
+
757
+ /* ─── High Contrast Mode (forced-colors) ─── */
758
+
759
+ @media (forced-colors: active) {
760
+ .menu-divider {
761
+ background-color: GrayText;
762
+ }
763
+ }
764
+ `;
765
+ var P = Object.getOwnPropertyDescriptor, U = (e, t, s, n) => {
766
+ for (var i = n > 1 ? void 0 : n ? P(t, s) : t, r = e.length - 1, a; r >= 0; r--)
767
+ (a = e[r]) && (i = a(i) || i);
768
+ return i;
769
+ };
770
+ let b = class extends I {
771
+ constructor() {
772
+ super(...arguments), this._supportsIdrefRefs = !0;
773
+ }
774
+ connectedCallback() {
775
+ super.connectedCallback(), this._supportsIdrefRefs = y(this._internals);
776
+ const e = this._internals;
777
+ e.role = "separator", e.ariaOrientation = "horizontal";
778
+ }
779
+ render() {
780
+ return this._supportsIdrefRefs ? u`<div part="base" class="menu-divider"></div>` : u`<div
781
+ part="base"
782
+ class="menu-divider"
783
+ role="separator"
784
+ aria-orientation="horizontal"
785
+ ></div>`;
786
+ }
787
+ };
788
+ b.styles = [q, g];
789
+ b = U([
790
+ v("hx-menu-divider")
791
+ ], b);
792
+ export {
793
+ f as H,
794
+ b as a,
795
+ l as b
796
+ };
797
+ //# sourceMappingURL=hx-menu-divider-BjiRIWKq.js.map