@helixui/library 1.0.0 → 1.0.1

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 (208) hide show
  1. package/custom-elements.json +213 -22
  2. package/dist/components/hx-accordion/hx-accordion-item.d.ts +20 -0
  3. package/dist/components/hx-accordion/hx-accordion-item.d.ts.map +1 -1
  4. package/dist/components/hx-accordion/index.js +1 -1
  5. package/dist/components/hx-alert/hx-alert.d.ts +10 -0
  6. package/dist/components/hx-alert/hx-alert.d.ts.map +1 -1
  7. package/dist/components/hx-alert/hx-alert.styles.d.ts.map +1 -1
  8. package/dist/components/hx-alert/index.js +1 -1
  9. package/dist/components/hx-badge/hx-badge.d.ts +2 -0
  10. package/dist/components/hx-badge/hx-badge.d.ts.map +1 -1
  11. package/dist/components/hx-badge/hx-badge.styles.d.ts.map +1 -1
  12. package/dist/components/hx-badge/index.js +1 -1
  13. package/dist/components/hx-banner/hx-banner.d.ts +6 -0
  14. package/dist/components/hx-banner/hx-banner.d.ts.map +1 -1
  15. package/dist/components/hx-banner/index.js +1 -1
  16. package/dist/components/hx-breadcrumb/hx-breadcrumb-item.styles.d.ts.map +1 -1
  17. package/dist/components/hx-breadcrumb/index.js +1 -1
  18. package/dist/components/hx-card/hx-card.d.ts +1 -0
  19. package/dist/components/hx-card/hx-card.d.ts.map +1 -1
  20. package/dist/components/hx-card/hx-card.styles.d.ts.map +1 -1
  21. package/dist/components/hx-card/index.js +1 -1
  22. package/dist/components/hx-carousel/hx-carousel.styles.d.ts.map +1 -1
  23. package/dist/components/hx-carousel/index.js +1 -1
  24. package/dist/components/hx-checkbox/hx-checkbox.styles.d.ts.map +1 -1
  25. package/dist/components/hx-checkbox/index.js +1 -1
  26. package/dist/components/hx-code-snippet/index.js +1 -1
  27. package/dist/components/hx-color-picker/hx-color-picker.d.ts +44 -10
  28. package/dist/components/hx-color-picker/hx-color-picker.d.ts.map +1 -1
  29. package/dist/components/hx-color-picker/index.js +1 -1
  30. package/dist/components/hx-combobox/hx-combobox.styles.d.ts.map +1 -1
  31. package/dist/components/hx-combobox/index.js +1 -1
  32. package/dist/components/hx-data-table/hx-data-table.styles.d.ts.map +1 -1
  33. package/dist/components/hx-data-table/index.js +1 -1
  34. package/dist/components/hx-date-picker/hx-date-picker.styles.d.ts.map +1 -1
  35. package/dist/components/hx-date-picker/index.js +1 -1
  36. package/dist/components/hx-dialog/hx-dialog.styles.d.ts.map +1 -1
  37. package/dist/components/hx-dialog/index.js +1 -1
  38. package/dist/components/hx-drawer/hx-drawer.d.ts.map +1 -1
  39. package/dist/components/hx-drawer/hx-drawer.styles.d.ts.map +1 -1
  40. package/dist/components/hx-drawer/index.js +1 -1
  41. package/dist/components/hx-dropdown/hx-dropdown.d.ts +20 -5
  42. package/dist/components/hx-dropdown/hx-dropdown.d.ts.map +1 -1
  43. package/dist/components/hx-dropdown/index.js +1 -1
  44. package/dist/components/hx-file-upload/hx-file-upload.styles.d.ts.map +1 -1
  45. package/dist/components/hx-file-upload/index.js +1 -1
  46. package/dist/components/hx-icon-button/hx-icon-button.styles.d.ts.map +1 -1
  47. package/dist/components/hx-icon-button/index.js +1 -1
  48. package/dist/components/hx-menu/hx-menu-item.d.ts +1 -0
  49. package/dist/components/hx-menu/hx-menu-item.d.ts.map +1 -1
  50. package/dist/components/hx-menu/hx-menu.d.ts +1 -0
  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 +1 -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-nav/hx-nav.styles.d.ts.map +1 -1
  58. package/dist/components/hx-nav/index.js +1 -1
  59. package/dist/components/hx-overflow-menu/hx-overflow-menu.styles.d.ts.map +1 -1
  60. package/dist/components/hx-overflow-menu/index.js +1 -1
  61. package/dist/components/hx-pagination/hx-pagination.styles.d.ts.map +1 -1
  62. package/dist/components/hx-pagination/index.js +1 -1
  63. package/dist/components/hx-popover/hx-popover.d.ts +41 -9
  64. package/dist/components/hx-popover/hx-popover.d.ts.map +1 -1
  65. package/dist/components/hx-popover/hx-popover.styles.d.ts.map +1 -1
  66. package/dist/components/hx-popover/index.js +1 -1
  67. package/dist/components/hx-progress-bar/hx-progress-bar.d.ts +2 -0
  68. package/dist/components/hx-progress-bar/hx-progress-bar.d.ts.map +1 -1
  69. package/dist/components/hx-progress-bar/index.js +1 -1
  70. package/dist/components/hx-radio-group/hx-radio.styles.d.ts.map +1 -1
  71. package/dist/components/hx-radio-group/index.js +1 -1
  72. package/dist/components/hx-select/hx-select.styles.d.ts.map +1 -1
  73. package/dist/components/hx-select/index.js +1 -1
  74. package/dist/components/hx-slider/hx-slider.d.ts.map +1 -1
  75. package/dist/components/hx-slider/index.js +1 -1
  76. package/dist/components/hx-split-button/index.js +1 -1
  77. package/dist/components/hx-split-panel/hx-split-panel.d.ts +44 -11
  78. package/dist/components/hx-split-panel/hx-split-panel.d.ts.map +1 -1
  79. package/dist/components/hx-split-panel/hx-split-panel.styles.d.ts.map +1 -1
  80. package/dist/components/hx-split-panel/index.js +1 -1
  81. package/dist/components/hx-tabs/hx-tabs.d.ts.map +1 -1
  82. package/dist/components/hx-tabs/index.js +1 -1
  83. package/dist/components/hx-tag/hx-tag.d.ts +2 -0
  84. package/dist/components/hx-tag/hx-tag.d.ts.map +1 -1
  85. package/dist/components/hx-tag/hx-tag.styles.d.ts.map +1 -1
  86. package/dist/components/hx-tag/index.js +1 -1
  87. package/dist/components/hx-text-input/hx-text-input.d.ts +1 -1
  88. package/dist/components/hx-text-input/index.js +1 -1
  89. package/dist/components/hx-time-picker/hx-time-picker.d.ts +80 -19
  90. package/dist/components/hx-time-picker/hx-time-picker.d.ts.map +1 -1
  91. package/dist/components/hx-time-picker/index.js +1 -1
  92. package/dist/components/hx-toast/hx-toast.d.ts +10 -0
  93. package/dist/components/hx-toast/hx-toast.d.ts.map +1 -1
  94. package/dist/components/hx-toast/hx-toast.styles.d.ts.map +1 -1
  95. package/dist/components/hx-toast/index.js +1 -1
  96. package/dist/components/hx-top-nav/index.js +1 -1
  97. package/dist/components/hx-tree-view/hx-tree-item.d.ts +11 -1
  98. package/dist/components/hx-tree-view/hx-tree-item.d.ts.map +1 -1
  99. package/dist/components/hx-tree-view/hx-tree-item.styles.d.ts.map +1 -1
  100. package/dist/components/hx-tree-view/hx-tree-view.d.ts +1 -0
  101. package/dist/components/hx-tree-view/hx-tree-view.d.ts.map +1 -1
  102. package/dist/components/hx-tree-view/index.js +1 -1
  103. package/dist/index.js +37 -37
  104. package/dist/shared/{hx-accordion-Cyswa6J3.js → hx-accordion-DT8qHOay.js} +54 -37
  105. package/dist/shared/hx-accordion-DT8qHOay.js.map +1 -0
  106. package/dist/shared/{hx-alert-Cg-zxRiU.js → hx-alert-D6uok29t.js} +95 -28
  107. package/dist/shared/hx-alert-D6uok29t.js.map +1 -0
  108. package/dist/shared/{hx-badge-CjT0d8NK.js → hx-badge-BeuWuUj_.js} +57 -31
  109. package/dist/shared/hx-badge-BeuWuUj_.js.map +1 -0
  110. package/dist/shared/{hx-banner-lxAIJ2kR.js → hx-banner-DnCBJtRR.js} +27 -23
  111. package/dist/shared/{hx-banner-lxAIJ2kR.js.map → hx-banner-DnCBJtRR.js.map} +1 -1
  112. package/dist/shared/{hx-breadcrumb-item-C0rz0fzV.js → hx-breadcrumb-item-Bj2UqhzR.js} +12 -8
  113. package/dist/shared/{hx-breadcrumb-item-C0rz0fzV.js.map → hx-breadcrumb-item-Bj2UqhzR.js.map} +1 -1
  114. package/dist/shared/{hx-card-Bg4W4uXC.js → hx-card-B9j2SHyI.js} +15 -11
  115. package/dist/shared/hx-card-B9j2SHyI.js.map +1 -0
  116. package/dist/shared/{hx-carousel-item-BKpmFbUT.js → hx-carousel-item-Be0bC-7o.js} +91 -77
  117. package/dist/shared/hx-carousel-item-Be0bC-7o.js.map +1 -0
  118. package/dist/shared/{hx-checkbox-BMayOpAM.js → hx-checkbox-CuaJqEo7.js} +3 -1
  119. package/dist/shared/hx-checkbox-CuaJqEo7.js.map +1 -0
  120. package/dist/shared/{hx-code-snippet-B4hV7rWG.js → hx-code-snippet-DBwIjl5p.js} +11 -11
  121. package/dist/shared/{hx-code-snippet-B4hV7rWG.js.map → hx-code-snippet-DBwIjl5p.js.map} +1 -1
  122. package/dist/shared/{hx-color-picker-BvfJ_h16.js → hx-color-picker-Bb2UPVc3.js} +2 -2
  123. package/dist/shared/hx-color-picker-Bb2UPVc3.js.map +1 -0
  124. package/dist/shared/{hx-combobox-BBi3izKJ.js → hx-combobox-CNvY-es8.js} +42 -39
  125. package/dist/shared/hx-combobox-CNvY-es8.js.map +1 -0
  126. package/dist/shared/{hx-data-table-DNiDVWR2.js → hx-data-table-BwoJCFgs.js} +9 -8
  127. package/dist/shared/hx-data-table-BwoJCFgs.js.map +1 -0
  128. package/dist/shared/{hx-date-picker-D7yCK0nk.js → hx-date-picker-DDcIBJir.js} +43 -37
  129. package/dist/shared/hx-date-picker-DDcIBJir.js.map +1 -0
  130. package/dist/shared/{hx-dialog-Z7Ou_AZ9.js → hx-dialog-M7so0sRT.js} +41 -34
  131. package/dist/shared/hx-dialog-M7so0sRT.js.map +1 -0
  132. package/dist/shared/{hx-drawer-Dk-_xzy0.js → hx-drawer-CYxuhIQ0.js} +50 -43
  133. package/dist/shared/hx-drawer-CYxuhIQ0.js.map +1 -0
  134. package/dist/shared/{hx-dropdown-DnjLnkTj.js → hx-dropdown-7cfowTWv.js} +30 -30
  135. package/dist/shared/hx-dropdown-7cfowTWv.js.map +1 -0
  136. package/dist/shared/{hx-file-upload-CUORgnKc.js → hx-file-upload-9HbONfqt.js} +49 -43
  137. package/dist/shared/hx-file-upload-9HbONfqt.js.map +1 -0
  138. package/dist/shared/{hx-icon-button-C83bCR0K.js → hx-icon-button-iu0i_faq.js} +39 -29
  139. package/dist/shared/hx-icon-button-iu0i_faq.js.map +1 -0
  140. package/dist/shared/{hx-menu-divider-11Dp2VfM.js → hx-menu-divider-DR8klkFT.js} +32 -26
  141. package/dist/shared/hx-menu-divider-DR8klkFT.js.map +1 -0
  142. package/dist/shared/{hx-meter-UinDQjl6.js → hx-meter-CZ7lnMra.js} +67 -35
  143. package/dist/shared/hx-meter-CZ7lnMra.js.map +1 -0
  144. package/dist/shared/{hx-nav-DSpwWYUX.js → hx-nav-DM6-cGKF.js} +49 -47
  145. package/dist/shared/hx-nav-DM6-cGKF.js.map +1 -0
  146. package/dist/shared/{hx-overflow-menu-C7k5wlZy.js → hx-overflow-menu-CobkjAb8.js} +17 -9
  147. package/dist/shared/{hx-overflow-menu-C7k5wlZy.js.map → hx-overflow-menu-CobkjAb8.js.map} +1 -1
  148. package/dist/shared/{hx-pagination-BQ0cLTuB.js → hx-pagination-10dpXS95.js} +14 -12
  149. package/dist/shared/hx-pagination-10dpXS95.js.map +1 -0
  150. package/dist/shared/hx-popover-ULjonbaO.js +269 -0
  151. package/dist/shared/hx-popover-ULjonbaO.js.map +1 -0
  152. package/dist/shared/{hx-progress-bar-C_mdPVF-.js → hx-progress-bar-CnTibV63.js} +67 -57
  153. package/dist/shared/{hx-progress-bar-C_mdPVF-.js.map → hx-progress-bar-CnTibV63.js.map} +1 -1
  154. package/dist/shared/{hx-radio-Bqyi8re3.js → hx-radio-BnKcRuQu.js} +10 -8
  155. package/dist/shared/{hx-radio-Bqyi8re3.js.map → hx-radio-BnKcRuQu.js.map} +1 -1
  156. package/dist/shared/{hx-select-BBae2LqN.js → hx-select-C50lD7NS.js} +4 -3
  157. package/dist/shared/hx-select-C50lD7NS.js.map +1 -0
  158. package/dist/shared/{hx-slider-CpnxH2UP.js → hx-slider-CprSNrRi.js} +3 -2
  159. package/dist/shared/hx-slider-CprSNrRi.js.map +1 -0
  160. package/dist/shared/{hx-split-button-BvwoG8h2.js → hx-split-button-CHGy4FUc.js} +11 -11
  161. package/dist/shared/{hx-split-button-BvwoG8h2.js.map → hx-split-button-CHGy4FUc.js.map} +1 -1
  162. package/dist/shared/{hx-split-panel-Cxkeauwe.js → hx-split-panel-DYtB45Tr.js} +16 -8
  163. package/dist/shared/hx-split-panel-DYtB45Tr.js.map +1 -0
  164. package/dist/shared/{hx-tab-panel-CHB0u1zF.js → hx-tab-panel-BRNcLICw.js} +55 -52
  165. package/dist/shared/hx-tab-panel-BRNcLICw.js.map +1 -0
  166. package/dist/shared/{hx-tag-SJJtMlOS.js → hx-tag-B3N-vZ6B.js} +80 -55
  167. package/dist/shared/hx-tag-B3N-vZ6B.js.map +1 -0
  168. package/dist/shared/{hx-text-input-BrCjo4fJ.js → hx-text-input-CCZZbWQ9.js} +6 -6
  169. package/dist/shared/hx-text-input-CCZZbWQ9.js.map +1 -0
  170. package/dist/shared/{hx-time-picker-DRRAFuVd.js → hx-time-picker-CJcIjH3C.js} +5 -2
  171. package/dist/shared/hx-time-picker-CJcIjH3C.js.map +1 -0
  172. package/dist/shared/{hx-top-nav-DzW7XLv-.js → hx-top-nav-D2bQpns3.js} +2 -2
  173. package/dist/shared/{hx-top-nav-DzW7XLv-.js.map → hx-top-nav-D2bQpns3.js.map} +1 -1
  174. package/dist/shared/{hx-tree-item-DdH6RbMs.js → hx-tree-item-BobGN76x.js} +119 -96
  175. package/dist/shared/hx-tree-item-BobGN76x.js.map +1 -0
  176. package/dist/shared/{toast-factory-B8jicczW.js → toast-factory-MvMMreTu.js} +178 -94
  177. package/dist/shared/toast-factory-MvMMreTu.js.map +1 -0
  178. package/package.json +1 -1
  179. package/dist/shared/hx-accordion-Cyswa6J3.js.map +0 -1
  180. package/dist/shared/hx-alert-Cg-zxRiU.js.map +0 -1
  181. package/dist/shared/hx-badge-CjT0d8NK.js.map +0 -1
  182. package/dist/shared/hx-card-Bg4W4uXC.js.map +0 -1
  183. package/dist/shared/hx-carousel-item-BKpmFbUT.js.map +0 -1
  184. package/dist/shared/hx-checkbox-BMayOpAM.js.map +0 -1
  185. package/dist/shared/hx-color-picker-BvfJ_h16.js.map +0 -1
  186. package/dist/shared/hx-combobox-BBi3izKJ.js.map +0 -1
  187. package/dist/shared/hx-data-table-DNiDVWR2.js.map +0 -1
  188. package/dist/shared/hx-date-picker-D7yCK0nk.js.map +0 -1
  189. package/dist/shared/hx-dialog-Z7Ou_AZ9.js.map +0 -1
  190. package/dist/shared/hx-drawer-Dk-_xzy0.js.map +0 -1
  191. package/dist/shared/hx-dropdown-DnjLnkTj.js.map +0 -1
  192. package/dist/shared/hx-file-upload-CUORgnKc.js.map +0 -1
  193. package/dist/shared/hx-icon-button-C83bCR0K.js.map +0 -1
  194. package/dist/shared/hx-menu-divider-11Dp2VfM.js.map +0 -1
  195. package/dist/shared/hx-meter-UinDQjl6.js.map +0 -1
  196. package/dist/shared/hx-nav-DSpwWYUX.js.map +0 -1
  197. package/dist/shared/hx-pagination-BQ0cLTuB.js.map +0 -1
  198. package/dist/shared/hx-popover-BQsgrJCW.js +0 -226
  199. package/dist/shared/hx-popover-BQsgrJCW.js.map +0 -1
  200. package/dist/shared/hx-select-BBae2LqN.js.map +0 -1
  201. package/dist/shared/hx-slider-CpnxH2UP.js.map +0 -1
  202. package/dist/shared/hx-split-panel-Cxkeauwe.js.map +0 -1
  203. package/dist/shared/hx-tab-panel-CHB0u1zF.js.map +0 -1
  204. package/dist/shared/hx-tag-SJJtMlOS.js.map +0 -1
  205. package/dist/shared/hx-text-input-BrCjo4fJ.js.map +0 -1
  206. package/dist/shared/hx-time-picker-DRRAFuVd.js.map +0 -1
  207. package/dist/shared/hx-tree-item-DdH6RbMs.js.map +0 -1
  208. package/dist/shared/toast-factory-B8jicczW.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hx-pagination-10dpXS95.js","sources":["../../src/components/hx-pagination/hx-pagination.styles.ts","../../src/components/hx-pagination/hx-pagination.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const helixPaginationStyles = css`\n :host {\n display: block;\n font-family: var(--hx-font-family-sans, sans-serif);\n }\n\n .pagination-root {\n display: flex;\n align-items: center;\n gap: var(--hx-spacing-4, 1rem);\n flex-wrap: wrap;\n }\n\n nav {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .list {\n display: flex;\n align-items: center;\n gap: var(--hx-pagination-gap, var(--hx-spacing-1, 0.25rem));\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n .item {\n display: flex;\n }\n\n .button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: var(--hx-pagination-button-size, 2.25rem);\n height: var(--hx-pagination-button-size, 2.25rem);\n padding: 0 var(--hx-spacing-2, 0.5rem);\n border: 1px solid var(--hx-pagination-border-color, var(--hx-color-border, #d1d5db));\n border-radius: var(--hx-pagination-border-radius, var(--hx-border-radius-md, 0.375rem));\n background: var(--hx-pagination-bg, var(--hx-color-surface, #ffffff));\n color: var(--hx-pagination-color, var(--hx-color-text-primary, #111827));\n font-size: var(--hx-font-size-sm, 0.875rem);\n font-family: inherit;\n cursor: pointer;\n transition:\n background-color var(--hx-transition-fast, 150ms) ease,\n border-color var(--hx-transition-fast, 150ms) ease,\n color var(--hx-transition-fast, 150ms) ease;\n text-decoration: none;\n white-space: nowrap;\n }\n\n .button:hover:not(:disabled) {\n background: var(--hx-pagination-hover-bg, var(--hx-color-surface-hover, #f3f4f6));\n border-color: var(--hx-pagination-hover-border-color, var(--hx-color-primary, #2563eb));\n }\n\n .button:focus-visible {\n outline: var(--hx-focus-ring-width, 2px) solid\n var(--hx-pagination-focus-ring-color, var(--hx-focus-ring-color, var(--hx-color-primary-500)));\n outline-offset: var(--hx-focus-ring-offset, 2px);\n }\n\n .button[aria-current='page'] {\n background: var(--hx-pagination-active-bg, var(--hx-color-primary, #2563eb));\n border-color: var(\n --hx-pagination-active-border-color,\n var(--hx-pagination-active-bg, var(--hx-color-primary, #2563eb))\n );\n color: var(--hx-pagination-active-color, var(--hx-color-surface, #ffffff));\n font-weight: var(--hx-font-weight-semibold, 600);\n cursor: default;\n pointer-events: none;\n }\n\n .button:disabled {\n opacity: 0.4;\n pointer-events: none;\n }\n\n .ellipsis {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: var(--hx-pagination-button-size, 2.25rem);\n height: var(--hx-pagination-button-size, 2.25rem);\n color: var(--hx-pagination-ellipsis-color, var(--hx-color-text-secondary, #6b7280));\n font-size: var(--hx-font-size-sm, 0.875rem);\n user-select: none;\n }\n\n .button[aria-disabled='true'] {\n cursor: default;\n pointer-events: none;\n }\n\n /* Page size selector */\n .page-size-wrapper {\n display: flex;\n align-items: center;\n }\n\n .page-size-label {\n display: flex;\n align-items: center;\n gap: var(--hx-spacing-2, 0.5rem);\n font-size: var(--hx-font-size-sm, 0.875rem);\n color: var(--hx-color-text-secondary, #6b7280);\n white-space: nowrap;\n }\n\n .page-size-select {\n height: var(--hx-pagination-button-size, 2.25rem);\n padding: 0 var(--hx-spacing-2, 0.5rem);\n border: 1px solid var(--hx-pagination-border-color, var(--hx-color-border, #d1d5db));\n border-radius: var(--hx-pagination-border-radius, var(--hx-border-radius-md, 0.375rem));\n background: var(--hx-pagination-bg, var(--hx-color-surface, #ffffff));\n color: var(--hx-pagination-color, var(--hx-color-text-primary, #111827));\n font-size: var(--hx-font-size-sm, 0.875rem);\n font-family: inherit;\n cursor: pointer;\n }\n\n .page-size-select:focus-visible {\n outline: var(--hx-focus-ring-width, 2px) solid\n var(--hx-pagination-focus-ring-color, var(--hx-focus-ring-color, var(--hx-color-primary-500)));\n outline-offset: var(--hx-focus-ring-offset, 2px);\n }\n\n /* Visually hidden — used for aria-live status messages */\n .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n\n @media (prefers-reduced-motion: reduce) {\n .button {\n transition: none;\n }\n }\n\n /* Windows High Contrast / forced-colors support */\n @media (forced-colors: active) {\n .button {\n border: 1px solid ButtonText;\n color: ButtonText;\n background: ButtonFace;\n forced-color-adjust: none;\n }\n\n .button:hover:not(:disabled) {\n border-color: Highlight;\n color: Highlight;\n }\n\n .button:focus-visible {\n outline-color: Highlight;\n }\n\n .button[aria-current='page'] {\n background: Highlight;\n border-color: Highlight;\n color: HighlightText;\n }\n\n .button:disabled {\n color: GrayText;\n border-color: GrayText;\n opacity: 1;\n }\n\n .button[aria-disabled='true'] {\n color: GrayText;\n }\n\n .page-size-select {\n border-color: ButtonText;\n color: ButtonText;\n background: ButtonFace;\n forced-color-adjust: none;\n }\n }\n`;\n","import { LitElement, html, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { tokenStyles } from '@helixui/tokens/lit';\nimport { helixPaginationStyles } from './hx-pagination.styles.js';\n\n/**\n * A pagination component for navigating content listings.\n *\n * @summary Page navigation with page numbers, prev/next, and ellipsis.\n *\n * @tag hx-pagination\n *\n * @csspart nav - The wrapping `<nav>` element.\n * @csspart list - The `<ul>` containing pagination items.\n * @csspart item - Each `<li>` item.\n * @csspart button - Each page button or prev/next control.\n * @csspart ellipsis - The ellipsis (`…`) span between page groups.\n * @csspart page-size-wrapper - The wrapper `<div>` around the page-size selector.\n * @csspart page-size-label - The `<label>` element for the page-size selector.\n * @csspart page-size-select - The `<select>` element for page-size.\n *\n * @cssprop [--hx-pagination-gap=0.25rem] - Gap between pagination buttons. Inherits from --hx-spacing-1.\n * @cssprop [--hx-pagination-button-size=2.25rem] - Minimum width and height of each button.\n * @cssprop [--hx-pagination-border-color] - Border color of buttons. Inherits from --hx-color-border (final fallback: #d1d5db).\n * @cssprop [--hx-pagination-border-radius] - Border radius of buttons. Inherits from --hx-border-radius-md (final fallback: 0.375rem).\n * @cssprop [--hx-pagination-bg] - Background color of buttons. Inherits from --hx-color-surface (final fallback: #ffffff).\n * @cssprop [--hx-pagination-color] - Text color of buttons. Inherits from --hx-color-text-primary (final fallback: #111827).\n * @cssprop [--hx-pagination-hover-bg] - Background color of buttons on hover. Inherits from --hx-color-surface-hover (final fallback: #f3f4f6).\n * @cssprop [--hx-pagination-hover-border-color] - Border color of buttons on hover. Inherits from --hx-color-primary (final fallback: #2563eb).\n * @cssprop [--hx-pagination-active-bg] - Background color of the active/current page button. Inherits from --hx-color-primary (final fallback: #2563eb).\n * @cssprop [--hx-pagination-active-color] - Text color of the active/current page button. Inherits from --hx-color-surface (final fallback: #ffffff).\n * @cssprop [--hx-pagination-active-border-color] - Border color of the active/current page button. Defaults to --hx-pagination-active-bg.\n * @cssprop [--hx-pagination-ellipsis-color] - Color of ellipsis characters. Inherits from --hx-color-text-secondary (final fallback: #6b7280).\n * @cssprop [--hx-transition-fast=150ms] - Duration used for hover/focus transitions.\n *\n * @fires {CustomEvent<{ page: number }>} hx-page-change - Fired when the user navigates to a new page.\n * @fires {CustomEvent<{ pageSize: number }>} hx-page-size-change - Fired when the user selects a new page size.\n *\n * @example\n * ```html\n * <hx-pagination total-pages=\"10\" current-page=\"1\"></hx-pagination>\n * ```\n *\n * @example Drupal / Twig integration\n * ```twig\n * {#\n * Drupal's pager uses 0-based page index in the URL (?page=N).\n * This component is 1-based, so add 1 to the Drupal page value.\n * Listen to hx-page-change and update the URL query param:\n * element.addEventListener('hx-page-change', (e) => {\n * const params = new URLSearchParams(location.search);\n * params.set('page', e.detail.page - 1); // convert back to 0-based\n * history.pushState({}, '', '?' + params.toString());\n * });\n * #}\n * <hx-pagination\n * total-pages=\"{{ total_pages }}\"\n * current-page=\"{{ pager.current_page + 1 }}\"\n * label=\"{{ 'Pagination'|t }}\"\n * {{ show_first_last ? 'show-first-last' : '' }}\n * ></hx-pagination>\n * ```\n */\n@customElement('hx-pagination')\nexport class HelixPagination extends LitElement {\n static override styles = [tokenStyles, helixPaginationStyles];\n\n /**\n * Total number of pages.\n * @attr total-pages\n */\n @property({ type: Number, attribute: 'total-pages', reflect: true })\n totalPages = 1;\n\n /**\n * The currently active page (1-based).\n * @attr current-page\n */\n @property({ type: Number, attribute: 'current-page' })\n currentPage = 1;\n\n /**\n * Number of page buttons shown on each side of the current page.\n * @attr sibling-count\n */\n @property({ type: Number, attribute: 'sibling-count', reflect: true })\n siblingCount = 1;\n\n /**\n * Number of pages always shown at the start and end of the list.\n * @attr boundary-count\n */\n @property({ type: Number, attribute: 'boundary-count', reflect: true })\n boundaryCount = 1;\n\n /**\n * Whether to show First and Last page buttons.\n * @attr show-first-last\n */\n @property({ type: Boolean, attribute: 'show-first-last', reflect: true })\n showFirstLast = false;\n\n /**\n * Accessible label for the `<nav>` element.\n * @attr label\n */\n @property({ type: String, reflect: true })\n label = 'Pagination';\n\n /**\n * The number of items displayed per page. When set, a page-size selector\n * `<select>` is rendered. Set `show-page-size` to display the selector.\n * @attr page-size\n */\n @property({ type: Number, attribute: 'page-size', reflect: true })\n pageSize = 25;\n\n /**\n * Whether to show the page-size selector UI.\n * @attr show-page-size\n */\n @property({ type: Boolean, attribute: 'show-page-size', reflect: true })\n showPageSize = false;\n\n /**\n * Label text for the rows-per-page selector.\n * @attr label-rows-per-page\n */\n @property({ type: String, attribute: 'label-rows-per-page' })\n labelRowsPerPage = 'Rows per page:';\n\n /** Tracks the roving tabindex target. Null means default to currentPage. */\n @state() private _rovingKey: number | string | null = null;\n\n /** Text for the aria-live region, updated on navigation. */\n @state() private _liveMessage = '';\n\n /** Memoization cache for _buildPageRange. */\n private _pageRangeCache: { key: string; result: Array<number | 'ellipsis'> } | null = null;\n\n // ─── Helpers ───\n\n private _buildPageRange(): Array<number | 'ellipsis'> {\n const key = `${this.totalPages}-${this.currentPage}-${this.siblingCount}-${this.boundaryCount}`;\n if (this._pageRangeCache?.key === key) return this._pageRangeCache.result;\n\n const total = Math.max(1, this.totalPages);\n const current = Math.min(Math.max(1, this.currentPage), total);\n const boundary = Math.max(0, this.boundaryCount);\n const sibling = Math.max(0, this.siblingCount);\n\n const startPages = this._range(1, Math.min(boundary, total));\n const endPages = this._range(Math.max(total - boundary + 1, boundary + 1), total);\n\n const siblingStart = Math.max(\n Math.min(current - sibling, total - boundary - sibling * 2 - 1),\n boundary + 2,\n );\n const siblingEnd = Math.min(\n Math.max(current + sibling, boundary + sibling * 2 + 2),\n endPages.length > 0 ? (endPages[0] ?? total) - 2 : total - 1,\n );\n\n const items: Array<number | 'ellipsis'> = [];\n\n for (const p of startPages) items.push(p);\n\n if (siblingStart > boundary + 2) {\n items.push('ellipsis');\n } else if (boundary + 1 < siblingStart) {\n items.push(boundary + 1);\n }\n\n for (const p of this._range(siblingStart, siblingEnd)) items.push(p);\n\n if (siblingEnd < total - boundary - 1) {\n items.push('ellipsis');\n } else if (siblingEnd < total - boundary) {\n items.push(total - boundary);\n }\n\n for (const p of endPages) items.push(p);\n\n this._pageRangeCache = { key, result: items };\n return items;\n }\n\n private _range(start: number, end: number): number[] {\n const result: number[] = [];\n for (let i = start; i <= end; i++) result.push(i);\n return result;\n }\n\n private _navigate(page: number): void {\n const clamped = Math.min(Math.max(1, page), this.totalPages);\n if (clamped === this.currentPage) return;\n\n this.currentPage = clamped;\n this._rovingKey = null; // reset so focus follows the new current page\n this._liveMessage = `Page ${clamped} of ${this.totalPages}`;\n this.dispatchEvent(\n new CustomEvent<{ page: number }>('hx-page-change', {\n detail: { page: clamped },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private _handlePageSizeChange(e: Event): void {\n const select = e.target as HTMLSelectElement;\n const newSize = Number(select.value);\n if (newSize === this.pageSize) return;\n\n this.pageSize = newSize;\n this.dispatchEvent(\n new CustomEvent<{ pageSize: number }>('hx-page-size-change', {\n detail: { pageSize: newSize },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private get _effectiveRovingKey(): number | string {\n return this._rovingKey ?? this.currentPage;\n }\n\n private _handleFocusin(e: FocusEvent): void {\n const btn = e.target as HTMLElement;\n if (btn.tagName !== 'BUTTON') return;\n const key = btn.dataset['rovingKey'];\n if (key === undefined) return;\n this._rovingKey = isNaN(Number(key)) ? key : Number(key);\n }\n\n private _handleKeydown(e: KeyboardEvent): void {\n if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight') return;\n e.preventDefault();\n\n const list = this.shadowRoot?.querySelector('.list');\n if (!list) return;\n\n // Collect all non-disabled buttons (disabled prev/next excluded; aria-disabled current page included)\n const buttons = Array.from(list.querySelectorAll<HTMLButtonElement>('button:not([disabled])'));\n const focused = this.shadowRoot?.activeElement as HTMLButtonElement | null;\n const currentIdx = focused ? buttons.indexOf(focused) : 0;\n\n const nextIdx =\n e.key === 'ArrowLeft'\n ? Math.max(0, currentIdx - 1)\n : Math.min(buttons.length - 1, currentIdx + 1);\n\n if (nextIdx !== currentIdx) {\n const nextBtn = buttons[nextIdx];\n if (!nextBtn) return;\n const key = nextBtn.dataset['rovingKey'];\n if (key !== undefined) {\n this._rovingKey = isNaN(Number(key)) ? key : Number(key);\n }\n nextBtn.focus();\n }\n }\n\n // ─── Render ───\n\n override render() {\n const pages = this._buildPageRange();\n const isFirst = this.currentPage <= 1;\n const isLast = this.currentPage >= this.totalPages;\n const rovingKey = this._effectiveRovingKey;\n\n return html`\n <div class=\"pagination-root\">\n ${this.showPageSize\n ? html`\n <div part=\"page-size-wrapper\" class=\"page-size-wrapper\">\n <label part=\"page-size-label\" class=\"page-size-label\">\n ${this.labelRowsPerPage}\n <select\n part=\"page-size-select\"\n class=\"page-size-select\"\n @change=${this._handlePageSizeChange}\n >\n ${[10, 25, 50, 100].map(\n (n) =>\n html`<option value=${n} ?selected=${n === this.pageSize}>${n}</option>`,\n )}\n </select>\n </label>\n </div>\n `\n : nothing}\n\n <nav part=\"nav\" aria-label=${this.label}>\n <span class=\"visually-hidden\" aria-live=\"polite\" aria-atomic=\"true\"\n >${this._liveMessage}</span\n >\n <ul\n part=\"list\"\n class=\"list\"\n role=\"list\"\n @keydown=${this._handleKeydown}\n @focusin=${this._handleFocusin}\n >\n ${this.showFirstLast\n ? html`\n <li part=\"item\" class=\"item\">\n <button\n part=\"button\"\n class=\"button\"\n ?disabled=${isFirst}\n tabindex=${rovingKey === 'first' ? 0 : -1}\n data-roving-key=\"first\"\n aria-label=\"First page\"\n @click=${() => this._navigate(1)}\n >\n «\n </button>\n </li>\n `\n : nothing}\n\n <li part=\"item\" class=\"item\">\n <button\n part=\"button\"\n class=\"button\"\n ?disabled=${isFirst}\n tabindex=${rovingKey === 'prev' ? 0 : -1}\n data-roving-key=\"prev\"\n aria-label=\"Previous page\"\n @click=${() => this._navigate(this.currentPage - 1)}\n >\n ‹\n </button>\n </li>\n\n ${repeat(\n pages,\n (page, i) => (page === 'ellipsis' ? `ellipsis-${i}` : `page-${page}`),\n (page) => {\n if (page === 'ellipsis') {\n return html`\n <li part=\"item\" class=\"item\">\n <span part=\"ellipsis\" class=\"ellipsis\" aria-hidden=\"true\">…</span>\n </li>\n `;\n }\n const isCurrent = page === this.currentPage;\n return html`\n <li part=\"item\" class=\"item\">\n <button\n part=\"button\"\n class=${classMap({ button: true })}\n aria-disabled=${isCurrent ? 'true' : nothing}\n tabindex=${rovingKey === page ? 0 : -1}\n data-roving-key=${page}\n aria-current=${isCurrent ? 'page' : nothing}\n aria-label=${`Page ${page}`}\n @click=${() => this._navigate(page)}\n >\n ${page}\n </button>\n </li>\n `;\n },\n )}\n\n <li part=\"item\" class=\"item\">\n <button\n part=\"button\"\n class=\"button\"\n ?disabled=${isLast}\n tabindex=${rovingKey === 'next' ? 0 : -1}\n data-roving-key=\"next\"\n aria-label=\"Next page\"\n @click=${() => this._navigate(this.currentPage + 1)}\n >\n ›\n </button>\n </li>\n\n ${this.showFirstLast\n ? html`\n <li part=\"item\" class=\"item\">\n <button\n part=\"button\"\n class=\"button\"\n ?disabled=${isLast}\n tabindex=${rovingKey === 'last' ? 0 : -1}\n data-roving-key=\"last\"\n aria-label=\"Last page\"\n @click=${() => this._navigate(this.totalPages)}\n >\n »\n </button>\n </li>\n `\n : nothing}\n </ul>\n </nav>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'hx-pagination': HelixPagination;\n }\n}\n\n/** Canonical type alias for HelixPagination. Use this when typing hx-pagination element references. */\nexport type HxPagination = HelixPagination;\n"],"names":["helixPaginationStyles","css","HelixPagination","LitElement","key","_a","total","current","boundary","sibling","startPages","endPages","siblingStart","siblingEnd","items","p","start","end","result","i","page","clamped","e","select","newSize","btn","list","buttons","focused","_b","currentIdx","nextIdx","nextBtn","pages","isFirst","isLast","rovingKey","html","n","nothing","repeat","isCurrent","classMap","tokenStyles","__decorateClass","property","state","customElement"],"mappings":";;;;;AAEO,MAAMA,IAAwBC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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MAAM,QAAQ,WAAW,iBAAiB,SAAS,IAAM;AAAA,GArB1D3C,EAsBX,WAAA,gBAAA,CAAA;AAOA0C,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,WAAW,kBAAkB,SAAS,IAAM;AAAA,GA5B3D3C,EA6BX,WAAA,iBAAA,CAAA;AAOA0C,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,SAAS,WAAW,mBAAmB,SAAS,IAAM;AAAA,GAnC7D3C,EAoCX,WAAA,iBAAA,CAAA;AAOA0C,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GA1C9B3C,EA2CX,WAAA,SAAA,CAAA;AAQA0C,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,WAAW,aAAa,SAAS,IAAM;AAAA,GAlDtD3C,EAmDX,WAAA,YAAA,CAAA;AAOA0C,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,SAAS,WAAW,kBAAkB,SAAS,IAAM;AAAA,GAzD5D3C,EA0DX,WAAA,gBAAA,CAAA;AAOA0C,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,WAAW,uBAAuB;AAAA,GAhEjD3C,EAiEX,WAAA,oBAAA,CAAA;AAGiB0C,EAAA;AAAA,EAAhBE,EAAA;AAAM,GApEI5C,EAoEM,WAAA,cAAA,CAAA;AAGA0C,EAAA;AAAA,EAAhBE,EAAA;AAAM,GAvEI5C,EAuEM,WAAA,gBAAA,CAAA;AAvENA,IAAN0C,EAAA;AAAA,EADNG,EAAc,eAAe;AAAA,GACjB7C,CAAA;"}
@@ -0,0 +1,269 @@
1
+ import { css as w, LitElement as E, html as y } from "lit";
2
+ import { property as l, state as A, customElement as k } from "lit/decorators.js";
3
+ import { tokenStyles as S } from "@helixui/tokens/lit";
4
+ import { offset as $, flip as C, shift as F, arrow as P, computePosition as D } from "@floating-ui/dom";
5
+ const L = w`
6
+ :host {
7
+ /* P2-05: display:contents lets the trigger-wrapper control layout inline;
8
+ position:relative was vestigial — body uses position:fixed via Floating UI */
9
+ display: contents;
10
+ }
11
+
12
+ .trigger-wrapper {
13
+ display: inline-block;
14
+ }
15
+
16
+ [part='body'] {
17
+ position: fixed;
18
+ z-index: var(--hx-popover-z-index, 9999);
19
+ max-width: var(--hx-popover-max-width, 320px);
20
+ padding: var(--hx-popover-padding, var(--hx-space-3, 0.75rem));
21
+ background: var(--hx-popover-bg, var(--hx-color-neutral-0, #ffffff));
22
+ color: var(--hx-popover-color, var(--hx-color-neutral-900, #111827));
23
+ font-family: var(--hx-font-family-sans, sans-serif);
24
+ font-size: var(--hx-popover-font-size, var(--hx-font-size-sm, 0.875rem));
25
+ line-height: var(--hx-line-height-normal, 1.5);
26
+ border: 1px solid var(--hx-popover-border-color, var(--hx-color-neutral-200, #e5e7eb));
27
+ border-radius: var(--hx-popover-border-radius, var(--hx-border-radius-md, 0.375rem));
28
+ box-shadow: var(
29
+ --hx-popover-shadow,
30
+ var(--hx-shadow-md, 0 4px 16px var(--hx-overlay-black-12, rgba(0, 0, 0, 0.12)))
31
+ );
32
+ visibility: hidden;
33
+ opacity: 0;
34
+ transition:
35
+ opacity var(--hx-popover-transition-duration, 0.2s) ease,
36
+ visibility var(--hx-popover-transition-duration, 0.2s) ease;
37
+ word-wrap: break-word;
38
+ }
39
+
40
+ [part='body'].visible {
41
+ visibility: visible;
42
+ opacity: 1;
43
+ }
44
+
45
+ [part='body']:focus-visible {
46
+ outline: var(--hx-focus-ring-width, 2px) solid
47
+ var(--hx-popover-focus-ring-color, var(--hx-focus-ring-color, var(--hx-color-primary-500)));
48
+ outline-offset: var(--hx-focus-ring-offset, 2px);
49
+ }
50
+
51
+ [part='arrow'] {
52
+ position: absolute;
53
+ width: var(--hx-popover-arrow-size, 10px);
54
+ height: var(--hx-popover-arrow-size, 10px);
55
+ background: var(--hx-popover-bg, var(--hx-color-neutral-0, #ffffff));
56
+ border: 1px solid var(--hx-popover-border-color, var(--hx-color-neutral-200, #e5e7eb));
57
+ transform: rotate(45deg);
58
+ pointer-events: none;
59
+ }
60
+
61
+ @media (prefers-reduced-motion: reduce) {
62
+ [part='body'] {
63
+ transition: none;
64
+ }
65
+ }
66
+ `;
67
+ var M = Object.defineProperty, R = Object.getOwnPropertyDescriptor, h = (t, e, r, o) => {
68
+ for (var i = o > 1 ? void 0 : o ? R(e, r) : e, n = t.length - 1, s; n >= 0; n--)
69
+ (s = t[n]) && (i = (o ? s(e, r, i) : s(i)) || i);
70
+ return o && i && M(e, r, i), i;
71
+ };
72
+ let q = 0, a = class extends E {
73
+ constructor() {
74
+ super(...arguments), this.open = !1, this.placement = "bottom", this.trigger = "click", this.distance = 8, this.skidding = 0, this.arrow = !1, this.label = "Popover", this._visible = !1, this._previousFocus = null, this._popoverId = `hx-popover-${++q}`, this._handleFocusTrap = (t) => {
75
+ var d, c, p;
76
+ const e = t;
77
+ if (e.key !== "Tab" || !this._visible) return;
78
+ const r = this._getFocusableElements();
79
+ if (r.length === 0) return;
80
+ const o = (d = this.shadowRoot) == null ? void 0 : d.querySelector('[part="body"]'), i = o ? [o, ...r] : r;
81
+ if (i.length === 0) return;
82
+ const n = i[0], s = i[i.length - 1];
83
+ e.shiftKey ? (document.activeElement === n || ((c = this.shadowRoot) == null ? void 0 : c.activeElement) === n) && (e.preventDefault(), s.focus()) : (document.activeElement === s || ((p = this.shadowRoot) == null ? void 0 : p.activeElement) === s) && (e.preventDefault(), n.focus());
84
+ }, this._handleDocumentKeydown = (t) => {
85
+ t.key === "Escape" && this._visible && this._hide(!0);
86
+ }, this._handleDocumentClick = (t) => {
87
+ t.target !== this && !this.contains(t.target) && this._hide(!1);
88
+ }, this._handleAnchorClick = () => {
89
+ this.trigger === "click" && (this._visible ? this._hide(!0) : this._show());
90
+ }, this._handleAnchorMouseEnter = () => {
91
+ this.trigger === "hover" && this._show();
92
+ }, this._handleAnchorMouseLeave = () => {
93
+ this.trigger === "hover" && this._hide(!1);
94
+ }, this._handleBodyMouseEnter = () => {
95
+ this.trigger === "hover" && this._show();
96
+ }, this._handleBodyMouseLeave = () => {
97
+ this.trigger === "hover" && this._hide(!1);
98
+ }, this._handleAnchorFocusIn = () => {
99
+ this.trigger !== "focus" && this.trigger !== "hover" || this._show();
100
+ }, this._handleAnchorFocusOut = (t) => {
101
+ var r;
102
+ if (this.trigger !== "focus" && this.trigger !== "hover") return;
103
+ const e = t.relatedTarget;
104
+ e && (this.contains(e) || (r = this.shadowRoot) != null && r.contains(e)) || this._hide(!0);
105
+ };
106
+ }
107
+ // ─── Lifecycle ───
108
+ disconnectedCallback() {
109
+ super.disconnectedCallback(), document.removeEventListener("click", this._handleDocumentClick), document.removeEventListener("keydown", this._handleDocumentKeydown);
110
+ }
111
+ firstUpdated() {
112
+ this._setAnchorAriaAttributes(!1), this.open && this._show();
113
+ }
114
+ updated(t) {
115
+ t.has("open") && (this.open ? this._show() : this._hide());
116
+ }
117
+ // ─── ARIA setup ───
118
+ // HIGH-02: set aria-haspopup="dialog" on firstUpdated and keep aria-expanded in sync
119
+ _setAnchorAriaAttributes(t) {
120
+ var o;
121
+ const e = (o = this.shadowRoot) == null ? void 0 : o.querySelector(
122
+ 'slot[name="anchor"]'
123
+ );
124
+ if (!e) return;
125
+ const r = e.assignedElements()[0];
126
+ r && (r.setAttribute("aria-expanded", String(t)), r.setAttribute("aria-haspopup", "dialog"));
127
+ }
128
+ // ─── Focus helpers ───
129
+ /** Return all keyboard-focusable elements inside the popover body's slotted content. */
130
+ _getFocusableElements() {
131
+ var n;
132
+ const t = (n = this.shadowRoot) == null ? void 0 : n.querySelector('[part="body"]');
133
+ if (!t) return [];
134
+ const e = t.querySelector("slot:not([name])");
135
+ if (!e) return [];
136
+ const r = e.assignedElements({ flatten: !0 }), o = 'a[href], area[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), details > summary', i = [];
137
+ for (const s of r) {
138
+ s.matches(o) && i.push(s);
139
+ const d = s.querySelectorAll(o);
140
+ i.push(...d);
141
+ }
142
+ return i;
143
+ }
144
+ // ─── Show/Hide ───
145
+ async _show() {
146
+ var e;
147
+ if (this._visible) return;
148
+ this._previousFocus = document.activeElement, this.dispatchEvent(new CustomEvent("hx-show", { bubbles: !0, composed: !0 })), this._visible = !0, this.open = !0, this._setAnchorAriaAttributes(!0), document.addEventListener("keydown", this._handleDocumentKeydown), document.addEventListener("keydown", this._handleFocusTrap), await this.updateComplete, this.dispatchEvent(new CustomEvent("hx-after-show", { bubbles: !0, composed: !0 }));
149
+ const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector('[part="body"]');
150
+ t && t.focus(), setTimeout(() => {
151
+ document.addEventListener("click", this._handleDocumentClick);
152
+ }, 0), await this._updatePosition();
153
+ }
154
+ // HIGH-03: _hideWithFocusRestore controls whether _previousFocus is restored.
155
+ // Escape and programmatic close restore focus; click-outside does not.
156
+ async _hide(t = !0) {
157
+ var e;
158
+ this._visible && (document.removeEventListener("click", this._handleDocumentClick), document.removeEventListener("keydown", this._handleDocumentKeydown), document.removeEventListener("keydown", this._handleFocusTrap), this.dispatchEvent(new CustomEvent("hx-hide", { bubbles: !0, composed: !0 })), this._visible = !1, this.open = !1, this._setAnchorAriaAttributes(!1), t && ((e = this._previousFocus) == null || e.focus()), this._previousFocus = null, await this.updateComplete, this.dispatchEvent(new CustomEvent("hx-after-hide", { bubbles: !0, composed: !0 })));
159
+ }
160
+ // ─── Positioning ───
161
+ async _updatePosition() {
162
+ var p, v, f;
163
+ const t = (p = this.shadowRoot) == null ? void 0 : p.querySelector(
164
+ 'slot[name="anchor"]'
165
+ );
166
+ if (!t) return;
167
+ const e = t.assignedElements()[0], r = (v = this.shadowRoot) == null ? void 0 : v.querySelector('[part="body"]'), o = this.arrow ? (f = this.shadowRoot) == null ? void 0 : f.querySelector('[part="arrow"]') : null;
168
+ if (!e || !r) return;
169
+ const i = [
170
+ $({ mainAxis: this.distance, crossAxis: this.skidding }),
171
+ C(),
172
+ F({ padding: 8 })
173
+ ];
174
+ o && i.push(P({ element: o }));
175
+ const { x: n, y: s, placement: d, middlewareData: c } = await D(e, r, {
176
+ placement: this.placement,
177
+ strategy: "fixed",
178
+ middleware: i
179
+ });
180
+ if (Object.assign(r.style, {
181
+ left: `${n}px`,
182
+ top: `${s}px`
183
+ }), o && c.arrow) {
184
+ const u = c.arrow, b = d.split("-")[0] ?? "bottom", g = { top: "bottom", right: "left", bottom: "top", left: "right" }[b] ?? "bottom";
185
+ Object.assign(o.style, {
186
+ left: u.x != null ? `${u.x}px` : "",
187
+ top: u.y != null ? `${u.y}px` : "",
188
+ right: "",
189
+ bottom: "",
190
+ [g]: "-5px"
191
+ });
192
+ const _ = ["border-top", "border-right", "border-bottom", "border-left"];
193
+ for (const x of _)
194
+ o.style.setProperty(x, "");
195
+ const m = {
196
+ bottom: ["border-bottom", "border-right"],
197
+ top: ["border-top", "border-left"],
198
+ right: ["border-top", "border-right"],
199
+ left: ["border-bottom", "border-left"]
200
+ }[b] ?? ["border-bottom", "border-right"];
201
+ o.style.setProperty(m[0], "1px solid transparent"), o.style.setProperty(m[1], "1px solid transparent");
202
+ }
203
+ }
204
+ _handleAnchorSlotChange() {
205
+ this._setAnchorAriaAttributes(this._visible);
206
+ }
207
+ // ─── Render ───
208
+ render() {
209
+ return y`
210
+ <div
211
+ class="trigger-wrapper"
212
+ @click=${this._handleAnchorClick}
213
+ @mouseenter=${this._handleAnchorMouseEnter}
214
+ @mouseleave=${this._handleAnchorMouseLeave}
215
+ @focusin=${this._handleAnchorFocusIn}
216
+ @focusout=${this._handleAnchorFocusOut}
217
+ >
218
+ <slot name="anchor" @slotchange=${this._handleAnchorSlotChange}></slot>
219
+ </div>
220
+ <div
221
+ part="body"
222
+ id=${this._popoverId}
223
+ role="dialog"
224
+ aria-label=${this.label}
225
+ aria-hidden="${this._visible ? "false" : "true"}"
226
+ tabindex="-1"
227
+ ?inert=${!this._visible}
228
+ class=${this._visible ? "visible" : ""}
229
+ @mouseenter=${this._handleBodyMouseEnter}
230
+ @mouseleave=${this._handleBodyMouseLeave}
231
+ >
232
+ <slot></slot>
233
+ ${this.arrow ? y`<div part="arrow"></div>` : ""}
234
+ </div>
235
+ `;
236
+ }
237
+ };
238
+ a.styles = [S, L];
239
+ h([
240
+ l({ type: Boolean, reflect: !0 })
241
+ ], a.prototype, "open", 2);
242
+ h([
243
+ l({ type: String, reflect: !0 })
244
+ ], a.prototype, "placement", 2);
245
+ h([
246
+ l({ type: String, reflect: !0 })
247
+ ], a.prototype, "trigger", 2);
248
+ h([
249
+ l({ type: Number, reflect: !0 })
250
+ ], a.prototype, "distance", 2);
251
+ h([
252
+ l({ type: Number, reflect: !0 })
253
+ ], a.prototype, "skidding", 2);
254
+ h([
255
+ l({ type: Boolean, reflect: !0 })
256
+ ], a.prototype, "arrow", 2);
257
+ h([
258
+ l({ type: String, reflect: !0 })
259
+ ], a.prototype, "label", 2);
260
+ h([
261
+ A()
262
+ ], a.prototype, "_visible", 2);
263
+ a = h([
264
+ k("hx-popover")
265
+ ], a);
266
+ export {
267
+ a as H
268
+ };
269
+ //# sourceMappingURL=hx-popover-ULjonbaO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hx-popover-ULjonbaO.js","sources":["../../src/components/hx-popover/hx-popover.styles.ts","../../src/components/hx-popover/hx-popover.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const helixPopoverStyles = css`\n :host {\n /* P2-05: display:contents lets the trigger-wrapper control layout inline;\n position:relative was vestigial — body uses position:fixed via Floating UI */\n display: contents;\n }\n\n .trigger-wrapper {\n display: inline-block;\n }\n\n [part='body'] {\n position: fixed;\n z-index: var(--hx-popover-z-index, 9999);\n max-width: var(--hx-popover-max-width, 320px);\n padding: var(--hx-popover-padding, var(--hx-space-3, 0.75rem));\n background: var(--hx-popover-bg, var(--hx-color-neutral-0, #ffffff));\n color: var(--hx-popover-color, var(--hx-color-neutral-900, #111827));\n font-family: var(--hx-font-family-sans, sans-serif);\n font-size: var(--hx-popover-font-size, var(--hx-font-size-sm, 0.875rem));\n line-height: var(--hx-line-height-normal, 1.5);\n border: 1px solid var(--hx-popover-border-color, var(--hx-color-neutral-200, #e5e7eb));\n border-radius: var(--hx-popover-border-radius, var(--hx-border-radius-md, 0.375rem));\n box-shadow: var(\n --hx-popover-shadow,\n var(--hx-shadow-md, 0 4px 16px var(--hx-overlay-black-12, rgba(0, 0, 0, 0.12)))\n );\n visibility: hidden;\n opacity: 0;\n transition:\n opacity var(--hx-popover-transition-duration, 0.2s) ease,\n visibility var(--hx-popover-transition-duration, 0.2s) ease;\n word-wrap: break-word;\n }\n\n [part='body'].visible {\n visibility: visible;\n opacity: 1;\n }\n\n [part='body']:focus-visible {\n outline: var(--hx-focus-ring-width, 2px) solid\n var(--hx-popover-focus-ring-color, var(--hx-focus-ring-color, var(--hx-color-primary-500)));\n outline-offset: var(--hx-focus-ring-offset, 2px);\n }\n\n [part='arrow'] {\n position: absolute;\n width: var(--hx-popover-arrow-size, 10px);\n height: var(--hx-popover-arrow-size, 10px);\n background: var(--hx-popover-bg, var(--hx-color-neutral-0, #ffffff));\n border: 1px solid var(--hx-popover-border-color, var(--hx-color-neutral-200, #e5e7eb));\n transform: rotate(45deg);\n pointer-events: none;\n }\n\n @media (prefers-reduced-motion: reduce) {\n [part='body'] {\n transition: none;\n }\n }\n`;\n","import { LitElement, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { tokenStyles } from '@helixui/tokens/lit';\nimport { computePosition, flip, shift, offset, arrow } from '@floating-ui/dom';\nimport { helixPopoverStyles } from './hx-popover.styles.js';\n\ntype PopoverPlacement =\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end';\n\ntype TriggerMode = 'click' | 'hover' | 'focus' | 'manual';\n\n/**\n * A popover that displays rich floating content attached to a trigger element.\n *\n * @summary Rich floating overlay attached to a trigger element.\n *\n * @tag hx-popover\n *\n * @slot anchor - The trigger element that opens the popover.\n * @slot - Default slot for popover body content.\n *\n * @csspart body - The popover body container element.\n * @csspart arrow - The arrow indicator element.\n *\n * @cssprop [--hx-popover-bg=var(--hx-color-neutral-0)] - Popover background color.\n * @cssprop [--hx-popover-color=var(--hx-color-neutral-900)] - Popover text color.\n * @cssprop [--hx-popover-font-size=var(--hx-font-size-sm)] - Popover font size.\n * @cssprop [--hx-popover-max-width=320px] - Maximum popover width.\n * @cssprop [--hx-popover-padding] - Popover padding.\n * @cssprop [--hx-popover-border-color=var(--hx-color-neutral-200)] - Popover border color.\n * @cssprop [--hx-popover-border-radius=var(--hx-border-radius-md)] - Popover border radius.\n * @cssprop [--hx-popover-shadow] - Popover box shadow.\n * @cssprop [--hx-popover-z-index=9999] - Popover z-index.\n * @cssprop [--hx-popover-transition-duration=0.2s] - Show/hide transition duration.\n * @cssprop [--hx-popover-arrow-size=10px] - Size of the arrow indicator.\n *\n * @fires hx-show - Dispatched when the popover begins to show.\n * @fires hx-after-show - Dispatched after the popover is fully visible.\n * @fires hx-hide - Dispatched when the popover begins to hide.\n * @fires hx-after-hide - Dispatched after the popover is fully hidden.\n *\n * @example\n * ```html\n * <hx-popover placement=\"bottom\" trigger=\"click\">\n * <button slot=\"anchor\">Open Popover</button>\n * <p>Rich popover content here.</p>\n * </hx-popover>\n * ```\n */\nlet _popoverCounter = 0;\n\n@customElement('hx-popover')\nexport class HelixPopover extends LitElement {\n static override styles = [tokenStyles, helixPopoverStyles];\n\n /**\n * Whether the popover is open.\n * @attr open\n */\n @property({ type: Boolean, reflect: true })\n open = false;\n\n /**\n * Preferred placement of the popover relative to the anchor.\n * @attr placement\n */\n @property({ type: String, reflect: true })\n placement: PopoverPlacement = 'bottom';\n\n /**\n * How the popover is triggered.\n * @attr trigger\n */\n @property({ type: String, reflect: true })\n trigger: TriggerMode = 'click';\n\n /**\n * Distance in pixels between the popover and the anchor.\n * @attr distance\n */\n @property({ type: Number, reflect: true })\n distance = 8;\n\n /**\n * Alignment offset in pixels along the anchor.\n * @attr skidding\n */\n @property({ type: Number, reflect: true })\n skidding = 0;\n\n /**\n * Whether to show an arrow pointing to the anchor.\n * @attr arrow\n */\n @property({ type: Boolean, reflect: true })\n arrow = false;\n\n /**\n * Accessible label for the popover body (sets aria-label on the dialog).\n * @attr label\n */\n @property({ type: String, reflect: true })\n label = 'Popover';\n\n /**\n * Tracks whether the popover body is currently visible.\n * @internal\n */\n @state() private _visible = false;\n\n /**\n * The element that held focus before the popover opened, used to restore focus on close.\n * @internal\n */\n private _previousFocus: HTMLElement | null = null;\n\n /**\n * Unique ID assigned to the popover body element.\n * @internal\n */\n private readonly _popoverId = `hx-popover-${++_popoverCounter}`;\n\n // ─── Lifecycle ───\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener('click', this._handleDocumentClick);\n document.removeEventListener('keydown', this._handleDocumentKeydown);\n }\n\n override firstUpdated(): void {\n // HIGH-02: set aria-haspopup=\"dialog\" once on the anchor so assistive technology\n // announces the control's popup type before it is ever opened.\n this._setAnchorAriaAttributes(false);\n // Sync initial open state\n if (this.open) {\n void this._show();\n }\n }\n\n override updated(changedProperties: Map<string, unknown>): void {\n if (changedProperties.has('open')) {\n if (this.open) {\n void this._show();\n } else {\n void this._hide();\n }\n }\n }\n\n // ─── ARIA setup ───\n\n // HIGH-02: set aria-haspopup=\"dialog\" on firstUpdated and keep aria-expanded in sync\n private _setAnchorAriaAttributes(expanded: boolean): void {\n const anchorSlot = this.shadowRoot?.querySelector(\n 'slot[name=\"anchor\"]',\n ) as HTMLSlotElement | null;\n if (!anchorSlot) return;\n const anchorEl = anchorSlot.assignedElements()[0] as HTMLElement | undefined;\n if (anchorEl) {\n anchorEl.setAttribute('aria-expanded', String(expanded));\n anchorEl.setAttribute('aria-haspopup', 'dialog');\n // aria-controls is omitted: the body lives in Shadow DOM and axe-core\n // cannot resolve cross-root IDREF values, which causes a critical violation.\n }\n }\n\n // ─── Focus helpers ───\n\n /** Return all keyboard-focusable elements inside the popover body's slotted content. */\n private _getFocusableElements(): HTMLElement[] {\n const bodyEl = this.shadowRoot?.querySelector('[part=\"body\"]') as HTMLElement | null;\n if (!bodyEl) return [];\n\n // Gather focusable elements from the default slot's assigned nodes\n const defaultSlot = bodyEl.querySelector('slot:not([name])') as HTMLSlotElement | null;\n if (!defaultSlot) return [];\n\n const assigned = defaultSlot.assignedElements({ flatten: true });\n const focusableSelector =\n 'a[href], area[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]), details > summary';\n\n const result: HTMLElement[] = [];\n for (const el of assigned) {\n if (el.matches(focusableSelector)) {\n result.push(el as HTMLElement);\n }\n const nested = el.querySelectorAll<HTMLElement>(focusableSelector);\n result.push(...nested);\n }\n return result;\n }\n\n /** Trap Tab/Shift+Tab focus within the popover body when it contains interactive elements. */\n private _handleFocusTrap = (e: Event): void => {\n const ke = e as KeyboardEvent;\n if (ke.key !== 'Tab' || !this._visible) return;\n\n const focusable = this._getFocusableElements();\n // If no interactive children, keep focus on the body itself — no cycling needed.\n if (focusable.length === 0) return;\n\n const bodyEl = this.shadowRoot?.querySelector('[part=\"body\"]') as HTMLElement | null;\n const allFocusable = bodyEl ? [bodyEl, ...focusable] : focusable;\n if (allFocusable.length === 0) return;\n\n const first = allFocusable[0] as HTMLElement;\n const last = allFocusable[allFocusable.length - 1] as HTMLElement;\n\n if (ke.shiftKey) {\n if (document.activeElement === first || this.shadowRoot?.activeElement === first) {\n ke.preventDefault();\n last.focus();\n }\n } else {\n if (document.activeElement === last || this.shadowRoot?.activeElement === last) {\n ke.preventDefault();\n first.focus();\n }\n }\n };\n\n // ─── Show/Hide ───\n\n private async _show(): Promise<void> {\n if (this._visible) return;\n // P0-02: save focus target before moving focus into dialog\n this._previousFocus = document.activeElement as HTMLElement | null;\n this.dispatchEvent(new CustomEvent('hx-show', { bubbles: true, composed: true }));\n this._visible = true;\n this.open = true;\n this._setAnchorAriaAttributes(true);\n // P1-03: add Escape listener synchronously before any await so it is registered\n // by the time the test fires an Escape keydown after a single await el.updateComplete.\n document.addEventListener('keydown', this._handleDocumentKeydown);\n // HIGH-01: focus trap listener active while popover is open\n document.addEventListener('keydown', this._handleFocusTrap);\n await this.updateComplete;\n // hx-after-show fires after Lit has rendered the visible state. Dispatching here\n // (before _updatePosition) ensures it fires in the same microtask as the test's\n // await-continuation, so tests can rely on a single await el.updateComplete.\n this.dispatchEvent(new CustomEvent('hx-after-show', { bubbles: true, composed: true }));\n // P0-02: move focus into dialog body\n const bodyEl = this.shadowRoot?.querySelector('[part=\"body\"]') as HTMLElement | null;\n if (bodyEl) bodyEl.focus();\n // P0-01: listen for outside clicks; deferred to avoid catching the opening click\n setTimeout(() => {\n document.addEventListener('click', this._handleDocumentClick);\n }, 0);\n await this._updatePosition();\n }\n\n // HIGH-03: _hideWithFocusRestore controls whether _previousFocus is restored.\n // Escape and programmatic close restore focus; click-outside does not.\n private async _hide(restoreFocus = true): Promise<void> {\n if (!this._visible) return;\n document.removeEventListener('click', this._handleDocumentClick);\n document.removeEventListener('keydown', this._handleDocumentKeydown);\n document.removeEventListener('keydown', this._handleFocusTrap);\n this.dispatchEvent(new CustomEvent('hx-hide', { bubbles: true, composed: true }));\n this._visible = false;\n this.open = false;\n this._setAnchorAriaAttributes(false);\n // HIGH-03: only restore focus on Escape / programmatic close\n if (restoreFocus) {\n this._previousFocus?.focus();\n }\n this._previousFocus = null;\n await this.updateComplete;\n this.dispatchEvent(new CustomEvent('hx-after-hide', { bubbles: true, composed: true }));\n }\n\n // ─── Positioning ───\n\n private async _updatePosition(): Promise<void> {\n const anchorSlot = this.shadowRoot?.querySelector(\n 'slot[name=\"anchor\"]',\n ) as HTMLSlotElement | null;\n if (!anchorSlot) return;\n const anchorEl = anchorSlot.assignedElements()[0] as HTMLElement | undefined;\n const bodyEl = this.shadowRoot?.querySelector('[part=\"body\"]') as HTMLElement | null;\n const arrowEl = this.arrow\n ? (this.shadowRoot?.querySelector('[part=\"arrow\"]') as HTMLElement | null)\n : null;\n\n if (!anchorEl || !bodyEl) return;\n\n const middleware = [\n offset({ mainAxis: this.distance, crossAxis: this.skidding }),\n flip(),\n shift({ padding: 8 }),\n ];\n\n if (arrowEl) {\n middleware.push(arrow({ element: arrowEl }));\n }\n\n const { x, y, placement, middlewareData } = await computePosition(anchorEl, bodyEl, {\n placement: this.placement,\n strategy: 'fixed',\n middleware,\n });\n\n Object.assign(bodyEl.style, {\n left: `${x}px`,\n top: `${y}px`,\n });\n\n if (arrowEl && middlewareData.arrow) {\n const arrowData = middlewareData.arrow;\n const basePlacement = placement.split('-')[0] ?? 'bottom';\n const staticSide =\n ({ top: 'bottom', right: 'left', bottom: 'top', left: 'right' } as Record<string, string>)[\n basePlacement\n ] ?? 'bottom';\n\n Object.assign(arrowEl.style, {\n left: arrowData.x != null ? `${arrowData.x}px` : '',\n top: arrowData.y != null ? `${arrowData.y}px` : '',\n right: '',\n bottom: '',\n [staticSide]: '-5px',\n });\n\n // P2-02: hide the two border sides facing the popover body so only\n // the outward-facing corner is visible (avoids the inner border line).\n // Reset all four sides first, then make the two inner-facing ones transparent.\n const borderSides = ['border-top', 'border-right', 'border-bottom', 'border-left'] as const;\n for (const side of borderSides) {\n arrowEl.style.setProperty(side, '');\n }\n // Maps base placement → the two sides that face inward toward the popover body\n const innerBorderMap: Record<string, readonly [string, string]> = {\n bottom: ['border-bottom', 'border-right'],\n top: ['border-top', 'border-left'],\n right: ['border-top', 'border-right'],\n left: ['border-bottom', 'border-left'],\n };\n const innerSides = innerBorderMap[basePlacement] ?? ['border-bottom', 'border-right'];\n arrowEl.style.setProperty(innerSides[0], '1px solid transparent');\n arrowEl.style.setProperty(innerSides[1], '1px solid transparent');\n }\n }\n\n // ─── Event Handlers ───\n\n // P1-03 / P0-01: document-level handlers active only while popover is open\n /**\n * Closes the popover when the Escape key is pressed while it is open.\n * @internal\n */\n private _handleDocumentKeydown = (e: Event): void => {\n if ((e as KeyboardEvent).key === 'Escape' && this._visible) {\n // HIGH-03: Escape always restores focus to the prior element\n void this._hide(true);\n }\n };\n\n // P0-01: close when click target is outside this component\n /**\n * Closes the popover when a click occurs outside the component boundary.\n * @internal\n */\n private _handleDocumentClick = (e: Event): void => {\n // Shadow DOM retargets events from within to the host at document level,\n // so a click on the trigger wrapper appears as e.target === this.\n if (e.target !== this && !this.contains(e.target as Node)) {\n // HIGH-03: click-outside does NOT restore focus — let browser handle naturally\n void this._hide(false);\n }\n };\n\n /**\n * Toggles the popover open/closed when the anchor is clicked in click trigger mode.\n * @internal\n */\n private _handleAnchorClick = (): void => {\n if (this.trigger !== 'click') return;\n if (this._visible) {\n void this._hide(true);\n } else {\n void this._show();\n }\n };\n\n /**\n * Opens the popover when the anchor receives a mouseenter event in hover trigger mode.\n * @internal\n */\n private _handleAnchorMouseEnter = (): void => {\n if (this.trigger !== 'hover') return;\n void this._show();\n };\n\n /**\n * Closes the popover when the anchor receives a mouseleave event in hover trigger mode.\n * @internal\n */\n private _handleAnchorMouseLeave = (): void => {\n if (this.trigger !== 'hover') return;\n void this._hide(false);\n };\n\n // CRITICAL-02: body hover handlers so moving the pointer from anchor into\n // the popover content does not trigger a hide.\n /** @internal */\n private _handleBodyMouseEnter = (): void => {\n // Cancel a pending hide that would have fired from the anchor's mouseleave\n // by re-showing (no-op if already visible).\n if (this.trigger !== 'hover') return;\n void this._show();\n };\n\n /** @internal */\n private _handleBodyMouseLeave = (): void => {\n if (this.trigger !== 'hover') return;\n void this._hide(false);\n };\n\n /** @internal */\n private _handleAnchorFocusIn = (): void => {\n // CRITICAL-02: keyboard users trigger hover-mode popovers via focusin\n if (this.trigger !== 'focus' && this.trigger !== 'hover') return;\n void this._show();\n };\n\n /** @internal */\n private _handleAnchorFocusOut = (e: FocusEvent): void => {\n // CRITICAL-02: for hover mode, only hide when focus leaves both the anchor\n // and the popover body (i.e. relatedTarget is outside the component).\n if (this.trigger !== 'focus' && this.trigger !== 'hover') return;\n const related = e.relatedTarget as Node | null;\n // If focus is moving into the shadow root (body element), keep popover open\n if (related && (this.contains(related) || this.shadowRoot?.contains(related))) return;\n void this._hide(true);\n };\n\n private _handleAnchorSlotChange(): void {\n this._setAnchorAriaAttributes(this._visible);\n }\n\n // ─── Render ───\n\n override render() {\n return html`\n <div\n class=\"trigger-wrapper\"\n @click=${this._handleAnchorClick}\n @mouseenter=${this._handleAnchorMouseEnter}\n @mouseleave=${this._handleAnchorMouseLeave}\n @focusin=${this._handleAnchorFocusIn}\n @focusout=${this._handleAnchorFocusOut}\n >\n <slot name=\"anchor\" @slotchange=${this._handleAnchorSlotChange}></slot>\n </div>\n <div\n part=\"body\"\n id=${this._popoverId}\n role=\"dialog\"\n aria-label=${this.label}\n aria-hidden=\"${!this._visible ? 'true' : 'false'}\"\n tabindex=\"-1\"\n ?inert=${!this._visible}\n class=${this._visible ? 'visible' : ''}\n @mouseenter=${this._handleBodyMouseEnter}\n @mouseleave=${this._handleBodyMouseLeave}\n >\n <slot></slot>\n ${this.arrow ? html`<div part=\"arrow\"></div>` : ''}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'hx-popover': HelixPopover;\n }\n}\n"],"names":["helixPopoverStyles","css","_popoverCounter","HelixPopover","LitElement","e","ke","focusable","bodyEl","_a","allFocusable","first","last","_b","_c","related","changedProperties","expanded","anchorSlot","anchorEl","defaultSlot","assigned","focusableSelector","result","el","nested","restoreFocus","arrowEl","middleware","offset","flip","shift","arrow","x","y","placement","middlewareData","computePosition","arrowData","basePlacement","staticSide","borderSides","side","innerSides","html","tokenStyles","__decorateClass","property","state","customElement"],"mappings":";;;;AAEO,MAAMA,IAAqBC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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AAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAnC9B5C,EAoCX,WAAA,YAAA,CAAA;AAOA2C,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GA1C/B5C,EA2CX,WAAA,SAAA,CAAA;AAOA2C,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAjD9B5C,EAkDX,WAAA,SAAA,CAAA;AAMiB2C,EAAA;AAAA,EAAhBE,EAAA;AAAM,GAxDI7C,EAwDM,WAAA,YAAA,CAAA;AAxDNA,IAAN2C,EAAA;AAAA,EADNG,EAAc,YAAY;AAAA,GACd9C,CAAA;"}
@@ -1,9 +1,9 @@
1
- import { css as c, LitElement as m, nothing as d, html as g } from "lit";
2
- import { property as i, state as b, customElement as u } from "lit/decorators.js";
3
- import { classMap as v } from "lit/directives/class-map.js";
4
- import { ifDefined as h } from "lit/directives/if-defined.js";
5
- import { tokenStyles as _ } from "@helixui/tokens/lit";
6
- const f = c`
1
+ import { css as u, LitElement as v, nothing as d, html as p } from "lit";
2
+ import { property as o, state as c, customElement as _ } from "lit/decorators.js";
3
+ import { classMap as f } from "lit/directives/class-map.js";
4
+ import { ifDefined as g } from "lit/directives/if-defined.js";
5
+ import { tokenStyles as x } from "@helixui/tokens/lit";
6
+ const y = u`
7
7
  :host {
8
8
  display: block;
9
9
  }
@@ -124,14 +124,14 @@ const f = c`
124
124
  }
125
125
  }
126
126
  `;
127
- var x = Object.defineProperty, y = Object.getOwnPropertyDescriptor, t = (e, s, o, l) => {
128
- for (var a = l > 1 ? void 0 : l ? y(s, o) : s, n = e.length - 1, p; n >= 0; n--)
129
- (p = e[n]) && (a = (l ? p(s, o, a) : p(a)) || a);
130
- return l && a && x(s, o, a), a;
127
+ var $ = Object.defineProperty, w = Object.getOwnPropertyDescriptor, t = (r, s, l, n) => {
128
+ for (var a = n > 1 ? void 0 : n ? w(s, l) : s, h = r.length - 1, i; h >= 0; h--)
129
+ (i = r[h]) && (a = (n ? i(s, l, a) : i(a)) || a);
130
+ return n && a && $(s, l, a), a;
131
131
  };
132
- let r = class extends m {
132
+ let e = class extends v {
133
133
  constructor() {
134
- super(...arguments), this.value = null, this.min = 0, this.max = 100, this.indeterminate = !1, this.label = "", this.description = "", this.size = "md", this.variant = "default", this._liveMessage = "", this._hasLabelSlotContent = !1, this._uid = `hx-pb-${++r._counter}`;
134
+ super(...arguments), this.value = null, this.min = 0, this.max = 100, this.indeterminate = !1, this.label = "", this.description = "", this.size = "md", this.variant = "default", this._liveMessage = "", this._hasLabelSlotContent = !1, this._uid = `hx-pb-${++e._counter}`;
135
135
  }
136
136
  /** @internal */
137
137
  get _isIndeterminate() {
@@ -140,87 +140,97 @@ let r = class extends m {
140
140
  /** @internal */
141
141
  get _percentage() {
142
142
  if (this._isIndeterminate) return 0;
143
- const e = this.max - this.min;
144
- return e <= 0 ? 0 : (Math.max(this.min, Math.min(this.value ?? this.min, this.max)) - this.min) / e * 100;
143
+ const r = this.max - this.min;
144
+ return r <= 0 ? 0 : (Math.max(this.min, Math.min(this.value ?? this.min, this.max)) - this.min) / r * 100;
145
145
  }
146
146
  /** @internal */
147
147
  get _isComplete() {
148
148
  return !this._isIndeterminate && this.value !== null && this.value >= this.max;
149
149
  }
150
- updated(e) {
151
- (e.has("value") || e.has("max")) && this._isComplete ? (this._liveMessage = "Complete", this.dispatchEvent(new CustomEvent("hx-complete", { bubbles: !0, composed: !0 }))) : e.has("value") && !this._isComplete && (this._liveMessage = ""), this.label;
150
+ updated(r) {
151
+ (r.has("value") || r.has("max")) && this._isComplete ? (this._liveMessage = "Complete", this.dispatchEvent(new CustomEvent("hx-complete", { bubbles: !0, composed: !0 }))) : r.has("value") && !this._isComplete && (this._liveMessage = ""), this.label;
152
152
  }
153
- _onLabelSlotChange(e) {
154
- const s = e.target;
153
+ _onLabelSlotChange(r) {
154
+ const s = r.target;
155
155
  this._hasLabelSlotContent = s.assignedNodes({ flatten: !0 }).length > 0;
156
156
  }
157
+ get _variantLabel() {
158
+ return e._VARIANT_LABELS[this.variant] ?? "";
159
+ }
157
160
  render() {
158
- const e = `${this._uid}-label`, s = this.description ? `${this._uid}-desc` : void 0, o = this._hasLabelSlotContent, l = {
161
+ const r = `${this._uid}-label`, s = this.description ? `${this._uid}-desc` : void 0, l = this._hasLabelSlotContent, n = {
159
162
  "progress-bar": !0,
160
163
  [`progress-bar--${this.size}`]: !0,
161
164
  [`progress-bar--${this.variant}`]: !0,
162
165
  "progress-bar--indeterminate": this._isIndeterminate
163
- }, a = this._isIndeterminate ? "" : `width: ${this._percentage}%`, n = this._isIndeterminate ? void 0 : this.value ?? this.min;
164
- return g`
165
- <div class=${v(l)}>
166
- <span id=${e} part="label" class="progress-bar__label">
167
- <slot name="label" @slotchange=${this._onLabelSlotChange}></slot>
168
- </span>
169
- ${this.description ? g`<span id=${s} class="sr-only">${this.description}</span>` : d}
166
+ }, a = this._isIndeterminate ? "" : `width: ${this._percentage}%`, h = this._isIndeterminate ? void 0 : this.value ?? this.min, i = this._variantLabel, b = this._isIndeterminate ? "In progress" : `${Math.round(this._percentage)}%`, m = i ? `${b} — ${i}` : b;
167
+ return p`
168
+ <div class=${f(n)}>
169
+ ${l || this.label ? p`<span id=${r} part="label" class="progress-bar__label">
170
+ <slot name="label" @slotchange=${this._onLabelSlotChange}></slot>
171
+ </span>` : p`<slot name="label" @slotchange=${this._onLabelSlotChange} hidden></slot>`}
172
+ ${this.description ? p`<span id=${s} class="sr-only">${this.description}</span>` : d}
170
173
  <div
171
174
  part="track"
172
175
  class="progress-bar__track"
173
176
  role="progressbar"
174
- aria-valuenow=${h(n)}
177
+ aria-valuenow=${g(h)}
175
178
  aria-valuemin=${this.min}
176
179
  aria-valuemax=${this.max}
177
- aria-label=${h(!o && this.label ? this.label : void 0)}
178
- aria-labelledby=${h(o ? e : void 0)}
179
- aria-describedby=${h(s)}
180
+ aria-valuetext=${m}
181
+ aria-label=${g(!l && this.label ? this.label : void 0)}
182
+ aria-labelledby=${g(l ? r : void 0)}
183
+ aria-describedby=${g(s)}
180
184
  >
181
185
  <div part="fill" class="progress-bar__fill" style=${a || d}></div>
182
186
  </div>
187
+ ${i ? p`<span class="sr-only progress-bar__variant-label">${i}</span>` : d}
183
188
  <div aria-live="polite" aria-atomic="true" class="sr-only">${this._liveMessage}</div>
184
189
  </div>
185
190
  `;
186
191
  }
187
192
  };
188
- r.styles = [_, f];
189
- r._counter = 0;
193
+ e.styles = [x, y];
194
+ e._counter = 0;
195
+ e._VARIANT_LABELS = {
196
+ success: "Success",
197
+ warning: "Warning",
198
+ danger: "Danger"
199
+ };
190
200
  t([
191
- i({ type: Number, reflect: !0 })
192
- ], r.prototype, "value", 2);
201
+ o({ type: Number, reflect: !0 })
202
+ ], e.prototype, "value", 2);
193
203
  t([
194
- i({ type: Number, reflect: !0 })
195
- ], r.prototype, "min", 2);
204
+ o({ type: Number, reflect: !0 })
205
+ ], e.prototype, "min", 2);
196
206
  t([
197
- i({ type: Number, reflect: !0 })
198
- ], r.prototype, "max", 2);
207
+ o({ type: Number, reflect: !0 })
208
+ ], e.prototype, "max", 2);
199
209
  t([
200
- i({ type: Boolean, reflect: !0 })
201
- ], r.prototype, "indeterminate", 2);
210
+ o({ type: Boolean, reflect: !0 })
211
+ ], e.prototype, "indeterminate", 2);
202
212
  t([
203
- i({ type: String, reflect: !0 })
204
- ], r.prototype, "label", 2);
213
+ o({ type: String, reflect: !0 })
214
+ ], e.prototype, "label", 2);
205
215
  t([
206
- i({ type: String, reflect: !0 })
207
- ], r.prototype, "description", 2);
216
+ o({ type: String, reflect: !0 })
217
+ ], e.prototype, "description", 2);
208
218
  t([
209
- i({ type: String, reflect: !0, attribute: "hx-size" })
210
- ], r.prototype, "size", 2);
219
+ o({ type: String, reflect: !0, attribute: "hx-size" })
220
+ ], e.prototype, "size", 2);
211
221
  t([
212
- i({ type: String, reflect: !0 })
213
- ], r.prototype, "variant", 2);
222
+ o({ type: String, reflect: !0 })
223
+ ], e.prototype, "variant", 2);
214
224
  t([
215
- b()
216
- ], r.prototype, "_liveMessage", 2);
225
+ c()
226
+ ], e.prototype, "_liveMessage", 2);
217
227
  t([
218
- b()
219
- ], r.prototype, "_hasLabelSlotContent", 2);
220
- r = t([
221
- u("hx-progress-bar")
222
- ], r);
228
+ c()
229
+ ], e.prototype, "_hasLabelSlotContent", 2);
230
+ e = t([
231
+ _("hx-progress-bar")
232
+ ], e);
223
233
  export {
224
- r as H
234
+ e as H
225
235
  };
226
- //# sourceMappingURL=hx-progress-bar-C_mdPVF-.js.map
236
+ //# sourceMappingURL=hx-progress-bar-CnTibV63.js.map