@melodicdev/components 2.0.3 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/README.md +7 -6
  2. package/assets/melodic-components.js +5570 -4150
  3. package/assets/melodic-components.js.map +1 -1
  4. package/assets/melodic-components.min.js +6466 -5147
  5. package/lib/components/data-display/activity-feed/activity-feed-item.component.d.ts +15 -14
  6. package/lib/components/data-display/activity-feed/activity-feed-item.component.d.ts.map +1 -1
  7. package/lib/components/data-display/activity-feed/activity-feed-item.component.js +36 -16
  8. package/lib/components/data-display/activity-feed/activity-feed-item.styles.d.ts.map +1 -1
  9. package/lib/components/data-display/activity-feed/activity-feed-item.styles.js +4 -0
  10. package/lib/components/data-display/activity-feed/activity-feed-item.template.d.ts.map +1 -1
  11. package/lib/components/data-display/activity-feed/activity-feed-item.template.js +15 -14
  12. package/lib/components/data-display/avatar/avatar.component.d.ts +9 -4
  13. package/lib/components/data-display/avatar/avatar.component.d.ts.map +1 -1
  14. package/lib/components/data-display/avatar/avatar.component.js +12 -3
  15. package/lib/components/data-display/avatar/avatar.template.js +1 -1
  16. package/lib/components/data-display/badge/badge.component.d.ts +2 -3
  17. package/lib/components/data-display/badge/badge.component.d.ts.map +1 -1
  18. package/lib/components/data-display/badge/badge.styles.d.ts.map +1 -1
  19. package/lib/components/data-display/badge/badge.styles.js +56 -35
  20. package/lib/components/data-display/badge/badge.types.d.ts +2 -0
  21. package/lib/components/data-display/badge/badge.types.d.ts.map +1 -1
  22. package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts +10 -0
  23. package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts.map +1 -1
  24. package/lib/components/data-display/calendar-view/calendar-view.utils.js +59 -27
  25. package/lib/components/data-display/data-grid/data-grid.component.d.ts +6 -5
  26. package/lib/components/data-display/data-grid/data-grid.component.d.ts.map +1 -1
  27. package/lib/components/data-display/data-grid/data-grid.component.js +49 -110
  28. package/lib/components/data-display/data-grid/data-grid.template.d.ts.map +1 -1
  29. package/lib/components/data-display/data-grid/data-grid.template.js +2 -6
  30. package/lib/components/data-display/list/list-item.component.d.ts +15 -6
  31. package/lib/components/data-display/list/list-item.component.d.ts.map +1 -1
  32. package/lib/components/data-display/list/list-item.component.js +57 -6
  33. package/lib/components/data-display/list/list-item.styles.d.ts.map +1 -1
  34. package/lib/components/data-display/list/list-item.styles.js +5 -0
  35. package/lib/components/data-display/list/list-item.template.d.ts.map +1 -1
  36. package/lib/components/data-display/list/list-item.template.js +18 -12
  37. package/lib/components/data-display/profile-card/profile-card.component.d.ts +2 -2
  38. package/lib/components/data-display/profile-card/profile-card.component.d.ts.map +1 -1
  39. package/lib/components/data-display/profile-card/profile-card.component.js +17 -15
  40. package/lib/components/data-display/profile-card/profile-card.template.js +1 -1
  41. package/lib/components/data-display/stat-card/stat-card.component.d.ts +6 -6
  42. package/lib/components/data-display/stat-card/stat-card.component.d.ts.map +1 -1
  43. package/lib/components/data-display/stat-card/stat-card.component.js +14 -6
  44. package/lib/components/data-display/stat-card/stat-card.template.js +4 -4
  45. package/lib/components/data-display/table/table.component.d.ts +7 -5
  46. package/lib/components/data-display/table/table.component.d.ts.map +1 -1
  47. package/lib/components/data-display/table/table.component.js +40 -117
  48. package/lib/components/data-display/table/table.template.d.ts.map +1 -1
  49. package/lib/components/data-display/table/table.template.js +1 -6
  50. package/lib/components/data-display/table-core/index.d.ts +3 -0
  51. package/lib/components/data-display/table-core/index.d.ts.map +1 -0
  52. package/lib/components/data-display/table-core/index.js +2 -0
  53. package/lib/components/data-display/table-core/table-core.d.ts +137 -0
  54. package/lib/components/data-display/table-core/table-core.d.ts.map +1 -0
  55. package/lib/components/data-display/table-core/table-core.js +225 -0
  56. package/lib/components/data-display/tag/tag.component.d.ts +14 -7
  57. package/lib/components/data-display/tag/tag.component.d.ts.map +1 -1
  58. package/lib/components/data-display/tag/tag.component.js +29 -5
  59. package/lib/components/data-display/tag/tag.template.js +2 -2
  60. package/lib/components/data-display/tag/tag.types.d.ts +8 -1
  61. package/lib/components/data-display/tag/tag.types.d.ts.map +1 -1
  62. package/lib/components/feedback/alert/alert.component.d.ts +6 -3
  63. package/lib/components/feedback/alert/alert.component.d.ts.map +1 -1
  64. package/lib/components/feedback/alert/alert.component.js +13 -4
  65. package/lib/components/feedback/alert/alert.template.js +1 -1
  66. package/lib/components/feedback/progress/progress.component.d.ts +4 -0
  67. package/lib/components/feedback/progress/progress.component.d.ts.map +1 -1
  68. package/lib/components/feedback/progress/progress.component.js +9 -0
  69. package/lib/components/feedback/progress/progress.template.d.ts.map +1 -1
  70. package/lib/components/feedback/progress/progress.template.js +19 -5
  71. package/lib/components/feedback/toast/toast.component.d.ts +6 -3
  72. package/lib/components/feedback/toast/toast.component.d.ts.map +1 -1
  73. package/lib/components/feedback/toast/toast.component.js +13 -4
  74. package/lib/components/feedback/toast/toast.service.d.ts.map +1 -1
  75. package/lib/components/feedback/toast/toast.service.js +2 -1
  76. package/lib/components/feedback/toast/toast.template.js +1 -1
  77. package/lib/components/forms/autocomplete/autocomplete.component.d.ts +12 -4
  78. package/lib/components/forms/autocomplete/autocomplete.component.d.ts.map +1 -1
  79. package/lib/components/forms/autocomplete/autocomplete.component.js +39 -30
  80. package/lib/components/forms/autocomplete/autocomplete.template.d.ts.map +1 -1
  81. package/lib/components/forms/autocomplete/autocomplete.template.js +14 -0
  82. package/lib/components/forms/button/button.component.d.ts +28 -3
  83. package/lib/components/forms/button/button.component.d.ts.map +1 -1
  84. package/lib/components/forms/button/button.component.js +81 -6
  85. package/lib/components/forms/button/button.template.js +1 -1
  86. package/lib/components/forms/button/button.types.d.ts +8 -1
  87. package/lib/components/forms/button/button.types.d.ts.map +1 -1
  88. package/lib/components/forms/button-group/button-group-item.component.d.ts +2 -2
  89. package/lib/components/forms/button-group/button-group-item.component.d.ts.map +1 -1
  90. package/lib/components/forms/button-group/button-group.component.d.ts +4 -2
  91. package/lib/components/forms/button-group/button-group.component.d.ts.map +1 -1
  92. package/lib/components/forms/button-group/button-group.component.js +3 -1
  93. package/lib/components/forms/button-group/button-group.styles.d.ts.map +1 -1
  94. package/lib/components/forms/button-group/button-group.styles.js +15 -1
  95. package/lib/components/forms/button-group/button-group.template.d.ts.map +1 -1
  96. package/lib/components/forms/button-group/button-group.template.js +4 -2
  97. package/lib/components/forms/checkbox/checkbox.component.d.ts +4 -2
  98. package/lib/components/forms/checkbox/checkbox.component.d.ts.map +1 -1
  99. package/lib/components/forms/checkbox/checkbox.component.js +3 -1
  100. package/lib/components/forms/checkbox/checkbox.styles.d.ts.map +1 -1
  101. package/lib/components/forms/checkbox/checkbox.styles.js +19 -0
  102. package/lib/components/forms/checkbox/checkbox.template.d.ts.map +1 -1
  103. package/lib/components/forms/checkbox/checkbox.template.js +4 -2
  104. package/lib/components/forms/date-picker/calendar.component.js +1 -1
  105. package/lib/components/forms/date-picker/date-picker.component.d.ts +11 -4
  106. package/lib/components/forms/date-picker/date-picker.component.d.ts.map +1 -1
  107. package/lib/components/forms/date-picker/date-picker.component.js +99 -32
  108. package/lib/components/forms/date-picker/date-picker.styles.d.ts.map +1 -1
  109. package/lib/components/forms/date-picker/date-picker.styles.js +0 -10
  110. package/lib/components/forms/date-picker/date-picker.template.d.ts.map +1 -1
  111. package/lib/components/forms/date-picker/date-picker.template.js +3 -4
  112. package/lib/components/forms/file-upload/file-upload-item.component.d.ts +7 -0
  113. package/lib/components/forms/file-upload/file-upload-item.component.d.ts.map +1 -1
  114. package/lib/components/forms/file-upload/file-upload-item.component.js +15 -0
  115. package/lib/components/forms/file-upload/file-upload.component.d.ts +15 -0
  116. package/lib/components/forms/file-upload/file-upload.component.d.ts.map +1 -1
  117. package/lib/components/forms/file-upload/file-upload.component.js +56 -0
  118. package/lib/components/forms/form-field/form-field.component.d.ts +12 -4
  119. package/lib/components/forms/form-field/form-field.component.d.ts.map +1 -1
  120. package/lib/components/forms/form-field/form-field.component.js +50 -31
  121. package/lib/components/forms/form-field/form-field.template.js +1 -1
  122. package/lib/components/forms/input/input.component.d.ts +2 -2
  123. package/lib/components/forms/input/input.component.d.ts.map +1 -1
  124. package/lib/components/forms/radio/radio-group.component.d.ts +6 -0
  125. package/lib/components/forms/radio/radio-group.component.d.ts.map +1 -1
  126. package/lib/components/forms/radio/radio-group.component.js +69 -2
  127. package/lib/components/forms/radio/radio-group.template.js +1 -1
  128. package/lib/components/forms/radio/radio.component.d.ts +7 -2
  129. package/lib/components/forms/radio/radio.component.d.ts.map +1 -1
  130. package/lib/components/forms/radio/radio.component.js +5 -0
  131. package/lib/components/forms/radio/radio.template.d.ts.map +1 -1
  132. package/lib/components/forms/radio/radio.template.js +1 -0
  133. package/lib/components/forms/select/select.component.d.ts +13 -6
  134. package/lib/components/forms/select/select.component.d.ts.map +1 -1
  135. package/lib/components/forms/select/select.component.js +32 -36
  136. package/lib/components/forms/select/select.template.d.ts.map +1 -1
  137. package/lib/components/forms/select/select.template.js +6 -2
  138. package/lib/components/forms/slider/slider.component.d.ts +2 -2
  139. package/lib/components/forms/slider/slider.component.d.ts.map +1 -1
  140. package/lib/components/forms/slider/slider.component.js +5 -1
  141. package/lib/components/forms/textarea/textarea.component.d.ts +2 -2
  142. package/lib/components/forms/textarea/textarea.component.d.ts.map +1 -1
  143. package/lib/components/forms/toggle/toggle.component.d.ts +4 -2
  144. package/lib/components/forms/toggle/toggle.component.d.ts.map +1 -1
  145. package/lib/components/forms/toggle/toggle.component.js +3 -1
  146. package/lib/components/forms/toggle/toggle.styles.d.ts.map +1 -1
  147. package/lib/components/forms/toggle/toggle.styles.js +19 -0
  148. package/lib/components/forms/toggle/toggle.template.d.ts.map +1 -1
  149. package/lib/components/forms/toggle/toggle.template.js +11 -3
  150. package/lib/components/foundation/card/card.component.d.ts +7 -6
  151. package/lib/components/foundation/card/card.component.d.ts.map +1 -1
  152. package/lib/components/foundation/card/card.component.js +18 -7
  153. package/lib/components/foundation/card/card.styles.d.ts.map +1 -1
  154. package/lib/components/foundation/card/card.styles.js +5 -0
  155. package/lib/components/foundation/card/card.template.d.ts.map +1 -1
  156. package/lib/components/foundation/card/card.template.js +16 -11
  157. package/lib/components/foundation/divider/divider.component.d.ts +5 -4
  158. package/lib/components/foundation/divider/divider.component.d.ts.map +1 -1
  159. package/lib/components/foundation/divider/divider.component.js +11 -3
  160. package/lib/components/foundation/divider/divider.styles.d.ts.map +1 -1
  161. package/lib/components/foundation/divider/divider.styles.js +6 -0
  162. package/lib/components/foundation/divider/divider.template.d.ts +5 -0
  163. package/lib/components/foundation/divider/divider.template.d.ts.map +1 -1
  164. package/lib/components/foundation/divider/divider.template.js +9 -6
  165. package/lib/components/general/icon/icon.template.d.ts.map +1 -1
  166. package/lib/components/general/icon/icon.template.js +3 -1
  167. package/lib/components/navigation/pagination/pagination.component.d.ts +5 -0
  168. package/lib/components/navigation/pagination/pagination.component.d.ts.map +1 -1
  169. package/lib/components/navigation/pagination/pagination.component.js +22 -10
  170. package/lib/components/navigation/pagination/pagination.styles.d.ts.map +1 -1
  171. package/lib/components/navigation/pagination/pagination.styles.js +6 -4
  172. package/lib/components/navigation/sidebar/sidebar-item.component.d.ts +4 -4
  173. package/lib/components/navigation/sidebar/sidebar-item.component.d.ts.map +1 -1
  174. package/lib/components/navigation/sidebar/sidebar-item.component.js +11 -4
  175. package/lib/components/navigation/sidebar/sidebar-item.template.js +2 -2
  176. package/lib/components/navigation/sidebar/sidebar.component.d.ts +7 -0
  177. package/lib/components/navigation/sidebar/sidebar.component.d.ts.map +1 -1
  178. package/lib/components/navigation/sidebar/sidebar.component.js +48 -5
  179. package/lib/components/navigation/steps/step-panel.component.d.ts +7 -0
  180. package/lib/components/navigation/steps/step-panel.component.d.ts.map +1 -1
  181. package/lib/components/navigation/steps/step-panel.component.js +7 -0
  182. package/lib/components/navigation/steps/step-panel.template.d.ts +1 -1
  183. package/lib/components/navigation/steps/step-panel.template.d.ts.map +1 -1
  184. package/lib/components/navigation/steps/step-panel.template.js +2 -2
  185. package/lib/components/navigation/steps/step.component.d.ts +2 -2
  186. package/lib/components/navigation/steps/step.component.d.ts.map +1 -1
  187. package/lib/components/navigation/steps/step.component.js +8 -2
  188. package/lib/components/navigation/steps/step.template.js +1 -1
  189. package/lib/components/navigation/steps/steps.component.d.ts +3 -1
  190. package/lib/components/navigation/steps/steps.component.d.ts.map +1 -1
  191. package/lib/components/navigation/steps/steps.component.js +47 -14
  192. package/lib/components/navigation/steps/steps.template.d.ts.map +1 -1
  193. package/lib/components/navigation/steps/steps.template.js +5 -1
  194. package/lib/components/navigation/tabs/tab-panel.component.d.ts +7 -0
  195. package/lib/components/navigation/tabs/tab-panel.component.d.ts.map +1 -1
  196. package/lib/components/navigation/tabs/tab-panel.component.js +7 -0
  197. package/lib/components/navigation/tabs/tab-panel.template.d.ts +1 -1
  198. package/lib/components/navigation/tabs/tab-panel.template.d.ts.map +1 -1
  199. package/lib/components/navigation/tabs/tab-panel.template.js +2 -2
  200. package/lib/components/navigation/tabs/tabs.component.d.ts +5 -3
  201. package/lib/components/navigation/tabs/tabs.component.d.ts.map +1 -1
  202. package/lib/components/navigation/tabs/tabs.component.js +49 -14
  203. package/lib/components/navigation/tabs/tabs.template.d.ts.map +1 -1
  204. package/lib/components/navigation/tabs/tabs.template.js +6 -1
  205. package/lib/components/overlays/dialog/dialog-ref.class.d.ts +17 -2
  206. package/lib/components/overlays/dialog/dialog-ref.class.d.ts.map +1 -1
  207. package/lib/components/overlays/dialog/dialog-ref.class.js +52 -6
  208. package/lib/components/overlays/dialog/dialog.component.d.ts.map +1 -1
  209. package/lib/components/overlays/dialog/dialog.component.js +5 -1
  210. package/lib/components/overlays/dialog/dialog.service.d.ts +2 -2
  211. package/lib/components/overlays/dialog/dialog.service.d.ts.map +1 -1
  212. package/lib/components/overlays/dialog/dialog.service.js +46 -18
  213. package/lib/components/overlays/drawer/drawer.component.d.ts +9 -2
  214. package/lib/components/overlays/drawer/drawer.component.d.ts.map +1 -1
  215. package/lib/components/overlays/drawer/drawer.component.js +34 -4
  216. package/lib/components/overlays/drawer/drawer.styles.d.ts.map +1 -1
  217. package/lib/components/overlays/drawer/drawer.styles.js +4 -0
  218. package/lib/components/overlays/dropdown/dropdown-item.component.d.ts +5 -2
  219. package/lib/components/overlays/dropdown/dropdown-item.component.d.ts.map +1 -1
  220. package/lib/components/overlays/dropdown/dropdown-item.component.js +18 -0
  221. package/lib/components/overlays/dropdown/dropdown-item.template.d.ts.map +1 -1
  222. package/lib/components/overlays/dropdown/dropdown-item.template.js +0 -3
  223. package/lib/components/overlays/dropdown/dropdown.component.d.ts +8 -4
  224. package/lib/components/overlays/dropdown/dropdown.component.d.ts.map +1 -1
  225. package/lib/components/overlays/dropdown/dropdown.component.js +61 -60
  226. package/lib/components/overlays/popover/popover.component.d.ts +6 -4
  227. package/lib/components/overlays/popover/popover.component.d.ts.map +1 -1
  228. package/lib/components/overlays/popover/popover.component.js +37 -51
  229. package/lib/components/overlays/tooltip/tooltip.component.d.ts +29 -4
  230. package/lib/components/overlays/tooltip/tooltip.component.d.ts.map +1 -1
  231. package/lib/components/overlays/tooltip/tooltip.component.js +73 -31
  232. package/lib/components/overlays/tooltip/tooltip.styles.d.ts.map +1 -1
  233. package/lib/components/overlays/tooltip/tooltip.styles.js +22 -10
  234. package/lib/components/overlays/tooltip/tooltip.template.d.ts.map +1 -1
  235. package/lib/components/overlays/tooltip/tooltip.template.js +3 -2
  236. package/lib/components/pages/auth/login-page.component.d.ts +11 -4
  237. package/lib/components/pages/auth/login-page.component.d.ts.map +1 -1
  238. package/lib/components/pages/auth/login-page.component.js +18 -5
  239. package/lib/components/pages/auth/login-page.template.d.ts.map +1 -1
  240. package/lib/components/pages/auth/login-page.template.js +9 -10
  241. package/lib/components/pages/auth/signup-page.component.d.ts +11 -4
  242. package/lib/components/pages/auth/signup-page.component.d.ts.map +1 -1
  243. package/lib/components/pages/auth/signup-page.component.js +18 -5
  244. package/lib/components/pages/auth/signup-page.template.d.ts.map +1 -1
  245. package/lib/components/pages/auth/signup-page.template.js +9 -10
  246. package/lib/components/pages/dashboard/dashboard-page.component.d.ts +18 -11
  247. package/lib/components/pages/dashboard/dashboard-page.component.d.ts.map +1 -1
  248. package/lib/components/pages/dashboard/dashboard-page.component.js +55 -13
  249. package/lib/components/pages/dashboard/dashboard-page.template.js +1 -1
  250. package/lib/components/sections/app-shell/app-shell.component.d.ts +6 -6
  251. package/lib/components/sections/app-shell/app-shell.component.d.ts.map +1 -1
  252. package/lib/components/sections/app-shell/app-shell.component.js +14 -6
  253. package/lib/components/sections/app-shell/app-shell.template.js +3 -3
  254. package/lib/components/sections/hero/hero-section.component.d.ts +6 -3
  255. package/lib/components/sections/hero/hero-section.component.d.ts.map +1 -1
  256. package/lib/components/sections/hero/hero-section.component.js +13 -4
  257. package/lib/components/sections/hero/hero-section.template.js +2 -2
  258. package/lib/components/sections/page-header/page-header.component.d.ts +16 -17
  259. package/lib/components/sections/page-header/page-header.component.d.ts.map +1 -1
  260. package/lib/components/sections/page-header/page-header.component.js +36 -25
  261. package/lib/components/sections/page-header/page-header.styles.d.ts.map +1 -1
  262. package/lib/components/sections/page-header/page-header.styles.js +9 -0
  263. package/lib/components/sections/page-header/page-header.template.d.ts +5 -0
  264. package/lib/components/sections/page-header/page-header.template.d.ts.map +1 -1
  265. package/lib/components/sections/page-header/page-header.template.js +42 -31
  266. package/lib/components/sections/page-section/page-section.component.d.ts +16 -12
  267. package/lib/components/sections/page-section/page-section.component.d.ts.map +1 -1
  268. package/lib/components/sections/page-section/page-section.component.js +34 -12
  269. package/lib/components/sections/page-section/page-section.styles.d.ts.map +1 -1
  270. package/lib/components/sections/page-section/page-section.styles.js +6 -0
  271. package/lib/components/sections/page-section/page-section.template.d.ts +6 -0
  272. package/lib/components/sections/page-section/page-section.template.d.ts.map +1 -1
  273. package/lib/components/sections/page-section/page-section.template.js +26 -15
  274. package/lib/components/sections/page-section/sanitize-href.function.d.ts +12 -0
  275. package/lib/components/sections/page-section/sanitize-href.function.d.ts.map +1 -0
  276. package/lib/components/sections/page-section/sanitize-href.function.js +15 -0
  277. package/lib/directives/tooltip.directive.d.ts +8 -2
  278. package/lib/directives/tooltip.directive.d.ts.map +1 -1
  279. package/lib/directives/tooltip.directive.js +103 -9
  280. package/lib/functions/deprecation.functions.d.ts +21 -0
  281. package/lib/functions/deprecation.functions.d.ts.map +1 -0
  282. package/lib/functions/deprecation.functions.js +44 -0
  283. package/lib/functions/index.d.ts +2 -0
  284. package/lib/functions/index.d.ts.map +1 -1
  285. package/lib/functions/index.js +2 -0
  286. package/lib/functions/watch-slot-presence.function.d.ts +17 -0
  287. package/lib/functions/watch-slot-presence.function.d.ts.map +1 -0
  288. package/lib/functions/watch-slot-presence.function.js +27 -0
  289. package/lib/theme/functions/create-theme.function.d.ts +15 -1
  290. package/lib/theme/functions/create-theme.function.d.ts.map +1 -1
  291. package/lib/theme/functions/create-theme.function.js +57 -11
  292. package/lib/theme/index.d.ts +1 -0
  293. package/lib/theme/index.d.ts.map +1 -1
  294. package/lib/types/index.d.ts +8 -2
  295. package/lib/types/index.d.ts.map +1 -1
  296. package/lib/utils/accessibility/focus-trap.d.ts +19 -1
  297. package/lib/utils/accessibility/focus-trap.d.ts.map +1 -1
  298. package/lib/utils/accessibility/focus-trap.js +77 -8
  299. package/lib/utils/accessibility/index.d.ts +2 -1
  300. package/lib/utils/accessibility/index.d.ts.map +1 -1
  301. package/lib/utils/accessibility/index.js +1 -1
  302. package/lib/utils/accessibility/live-region.d.ts +10 -3
  303. package/lib/utils/accessibility/live-region.d.ts.map +1 -1
  304. package/lib/utils/accessibility/live-region.js +64 -35
  305. package/lib/utils/directives/click-outside.directive.d.ts.map +1 -1
  306. package/lib/utils/directives/click-outside.directive.js +5 -3
  307. package/lib/utils/overlay/index.d.ts +4 -0
  308. package/lib/utils/overlay/index.d.ts.map +1 -0
  309. package/lib/utils/overlay/index.js +2 -0
  310. package/lib/utils/overlay/overlay-positioner.d.ts +54 -0
  311. package/lib/utils/overlay/overlay-positioner.d.ts.map +1 -0
  312. package/lib/utils/overlay/overlay-positioner.js +85 -0
  313. package/lib/utils/overlay/toggle-dismiss-guard.d.ts +24 -0
  314. package/lib/utils/overlay/toggle-dismiss-guard.d.ts.map +1 -0
  315. package/lib/utils/overlay/toggle-dismiss-guard.js +36 -0
  316. package/lib/utils/positioning/auto-update.d.ts.map +1 -1
  317. package/lib/utils/positioning/auto-update.js +3 -0
  318. package/lib/utils/positioning/compute-position.d.ts.map +1 -1
  319. package/lib/utils/positioning/compute-position.js +8 -4
  320. package/lib/utils/positioning/middlewares/flip.middleware.d.ts.map +1 -1
  321. package/lib/utils/positioning/middlewares/flip.middleware.js +10 -3
  322. package/lib/utils/positioning/middlewares/offset.middleware.d.ts +15 -0
  323. package/lib/utils/positioning/middlewares/offset.middleware.d.ts.map +1 -1
  324. package/lib/utils/positioning/middlewares/offset.middleware.js +31 -1
  325. package/lib/utils/positioning/middlewares/shift.middleware.d.ts +13 -3
  326. package/lib/utils/positioning/middlewares/shift.middleware.d.ts.map +1 -1
  327. package/lib/utils/positioning/middlewares/shift.middleware.js +15 -7
  328. package/package.json +6 -2
@@ -1,4 +1,55 @@
1
- import { getFocusableElements, getFirstFocusable } from './focus-utils.js';
1
+ import { getFocusableElements } from './focus-utils.js';
2
+ /**
3
+ * The element that actually has focus, descending through nested shadow roots.
4
+ * `document.activeElement` alone reports the outermost shadow host.
5
+ */
6
+ export function getDeepActiveElement() {
7
+ let active = document.activeElement;
8
+ while (active?.shadowRoot?.activeElement) {
9
+ active = active.shadowRoot.activeElement;
10
+ }
11
+ return active;
12
+ }
13
+ /**
14
+ * True when the (deep) focused element is `container` or lives inside it,
15
+ * crossing shadow boundaries in both directions: the active element is
16
+ * resolved through nested shadow roots, and the ancestor walk climbs from
17
+ * shadow roots to their hosts. Overlays use this to decide whether a
18
+ * dismissal happened while focus was parked in their content (and therefore
19
+ * whether focus should be returned to the trigger).
20
+ */
21
+ export function isDeepFocusWithin(container) {
22
+ let node = getDeepActiveElement();
23
+ while (node) {
24
+ if (node === container)
25
+ return true;
26
+ node = node instanceof ShadowRoot ? node.host : node.parentNode;
27
+ }
28
+ return false;
29
+ }
30
+ /**
31
+ * Collect focusable elements within a container, expanding `<slot>` elements
32
+ * to their assigned (light DOM) content so traps work on shadow containers
33
+ * that project slotted content.
34
+ */
35
+ function collectFocusables(container) {
36
+ const slots = Array.from(container.querySelectorAll('slot'));
37
+ if (slots.length === 0) {
38
+ return getFocusableElements(container);
39
+ }
40
+ const focusables = getFocusableElements(container);
41
+ for (const slot of slots) {
42
+ for (const assigned of slot.assignedElements({ flatten: true })) {
43
+ if (assigned instanceof HTMLElement) {
44
+ focusables.push(...getFocusableElements(assigned));
45
+ if (assigned.matches('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')) {
46
+ focusables.push(assigned);
47
+ }
48
+ }
49
+ }
50
+ }
51
+ return focusables;
52
+ }
2
53
  /**
3
54
  * Create a focus trap within a container element
4
55
  */
@@ -6,24 +57,37 @@ export function createFocusTrap(container, options = {}) {
6
57
  const { initialFocus = null, returnFocus = null, autoFocus = true } = options;
7
58
  let active = false;
8
59
  let previouslyFocused = null;
60
+ // When the container lives in a shadow root, keydown events from slotted
61
+ // (light DOM) content bubble through the host element's tree; listen there
62
+ // too so projected content is trapped.
63
+ const containerRoot = container.getRootNode();
64
+ const hostEl = containerRoot instanceof ShadowRoot ? containerRoot.host : null;
65
+ const handledEvents = new WeakSet();
9
66
  function handleKeydown(event) {
10
67
  if (event.key !== 'Tab' || !active)
11
68
  return;
12
- const focusables = getFocusableElements(container);
69
+ // The same event can reach both the container and the host listener.
70
+ if (handledEvents.has(event))
71
+ return;
72
+ handledEvents.add(event);
73
+ const focusables = collectFocusables(container);
13
74
  if (focusables.length === 0)
14
75
  return;
15
76
  const first = focusables[0];
16
77
  const last = focusables[focusables.length - 1];
78
+ // document.activeElement is always the outer shadow host for content
79
+ // inside shadow DOM; resolve the deep active element instead.
80
+ const activeElement = getDeepActiveElement();
17
81
  if (event.shiftKey) {
18
82
  // Shift + Tab: going backwards
19
- if (document.activeElement === first) {
83
+ if (activeElement === first) {
20
84
  event.preventDefault();
21
85
  last.focus();
22
86
  }
23
87
  }
24
88
  else {
25
89
  // Tab: going forwards
26
- if (document.activeElement === last) {
90
+ if (activeElement === last) {
27
91
  event.preventDefault();
28
92
  first.focus();
29
93
  }
@@ -33,26 +97,31 @@ export function createFocusTrap(container, options = {}) {
33
97
  if (active)
34
98
  return;
35
99
  active = true;
36
- previouslyFocused = document.activeElement;
37
- // Add keydown listener
100
+ previouslyFocused = getDeepActiveElement();
101
+ // Add keydown listeners
38
102
  container.addEventListener('keydown', handleKeydown);
103
+ hostEl?.addEventListener('keydown', handleKeydown);
39
104
  // Focus initial element
40
105
  if (initialFocus) {
41
106
  initialFocus.focus();
42
107
  }
43
108
  else if (autoFocus) {
44
- const first = getFirstFocusable(container);
109
+ const first = collectFocusables(container)[0];
45
110
  if (first) {
46
111
  first.focus();
47
112
  }
48
113
  }
49
114
  }
50
- function deactivate() {
115
+ function deactivate(deactivateOptions = {}) {
51
116
  if (!active)
52
117
  return;
53
118
  active = false;
54
119
  container.removeEventListener('keydown', handleKeydown);
120
+ hostEl?.removeEventListener('keydown', handleKeydown);
55
121
  // Return focus
122
+ if (deactivateOptions.returnFocus === false) {
123
+ return;
124
+ }
56
125
  const focusTarget = returnFocus ?? previouslyFocused;
57
126
  if (focusTarget && typeof focusTarget.focus === 'function') {
58
127
  focusTarget.focus();
@@ -1,4 +1,5 @@
1
- export { focusTrap, createFocusTrap } from './focus-trap.js';
1
+ export { focusTrap, createFocusTrap, getDeepActiveElement, isDeepFocusWithin } from './focus-trap.js';
2
+ export type { FocusTrap, FocusTrapOptions, FocusTrapDeactivateOptions } from './focus-trap.js';
2
3
  export { focusVisible, isFocusVisible } from './focus-visible.js';
3
4
  export { announce, createLiveRegion } from './live-region.js';
4
5
  export { getFirstFocusable, getLastFocusable, getFocusableElements, focusFirst, focusLast } from './focus-utils.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/accessibility/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/accessibility/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACtG,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,4 +1,4 @@
1
- export { focusTrap, createFocusTrap } from './focus-trap.js';
1
+ export { focusTrap, createFocusTrap, getDeepActiveElement, isDeepFocusWithin } from './focus-trap.js';
2
2
  export { focusVisible, isFocusVisible } from './focus-visible.js';
3
3
  export { announce, createLiveRegion } from './live-region.js';
4
4
  export { getFirstFocusable, getLastFocusable, getFocusableElements, focusFirst, focusLast } from './focus-utils.js';
@@ -1,15 +1,22 @@
1
+ type AnnouncePriority = 'polite' | 'assertive';
1
2
  /**
2
- * Announce a message to screen readers
3
+ * Announce a message to screen readers.
4
+ *
5
+ * Messages are queued per politeness level, so rapid successive calls are
6
+ * announced one after another instead of the last call silently cancelling
7
+ * the earlier ones.
8
+ *
3
9
  * @param message - The message to announce
4
10
  * @param priority - 'polite' waits for silence, 'assertive' interrupts
5
11
  */
6
- export declare function announce(message: string, priority?: 'polite' | 'assertive'): void;
12
+ export declare function announce(message: string, priority?: AnnouncePriority): void;
7
13
  /**
8
14
  * Create a custom live region with specific options
9
15
  */
10
16
  export declare function createLiveRegion(options?: {
11
17
  id?: string;
12
- priority?: 'polite' | 'assertive';
18
+ priority?: AnnouncePriority;
13
19
  atomic?: boolean;
14
20
  }): HTMLElement;
21
+ export {};
15
22
  //# sourceMappingURL=live-region.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"live-region.d.ts","sourceRoot":"","sources":["../../../src/utils/accessibility/live-region.ts"],"names":[],"mappings":"AAiCA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAQ,GAAG,WAAsB,GAAG,IAAI,CAW3F;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,WAAW,CAuBhI"}
1
+ {"version":3,"file":"live-region.d.ts","sourceRoot":"","sources":["../../../src/utils/accessibility/live-region.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAqF/C;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,gBAA2B,GAAG,IAAI,CAOrF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,WAAW,CAW1H"}
@@ -1,18 +1,14 @@
1
- let liveRegion = null;
2
- /**
3
- * Get or create the global live region element
4
- */
5
- function getLiveRegion() {
6
- if (liveRegion && document.body.contains(liveRegion)) {
7
- return liveRegion;
8
- }
9
- liveRegion = document.createElement('div');
10
- liveRegion.id = 'ml-live-region';
11
- liveRegion.setAttribute('aria-live', 'polite');
12
- liveRegion.setAttribute('aria-atomic', 'true');
13
- liveRegion.setAttribute('role', 'status');
1
+ /** Delay before writing a message so screen readers register the clear/set cycle. */
2
+ const CLEAR_DELAY_MS = 50;
3
+ /** Minimum time a message stays in the region before the next queued one replaces it. */
4
+ const MESSAGE_GAP_MS = 150;
5
+ const regions = {
6
+ polite: { element: null, queue: [], flushing: false },
7
+ assertive: { element: null, queue: [], flushing: false }
8
+ };
9
+ function applyVisuallyHiddenStyles(element) {
14
10
  // Visually hidden but accessible to screen readers
15
- Object.assign(liveRegion.style, {
11
+ Object.assign(element.style, {
16
12
  position: 'absolute',
17
13
  width: '1px',
18
14
  height: '1px',
@@ -23,23 +19,67 @@ function getLiveRegion() {
23
19
  whiteSpace: 'nowrap',
24
20
  border: '0'
25
21
  });
26
- document.body.appendChild(liveRegion);
27
- return liveRegion;
28
22
  }
29
23
  /**
30
- * Announce a message to screen readers
31
- * @param message - The message to announce
32
- * @param priority - 'polite' waits for silence, 'assertive' interrupts
24
+ * Get or create the global live region element for a politeness level.
25
+ * Each level has its own region so assertive announcements can't clobber
26
+ * polite ones (and vice versa).
33
27
  */
34
- export function announce(message, priority = 'polite') {
35
- const region = getLiveRegion();
28
+ function getLiveRegion(priority) {
29
+ const state = regions[priority];
30
+ if (state.element && document.body.contains(state.element)) {
31
+ return state.element;
32
+ }
33
+ const region = document.createElement('div');
34
+ // The polite region keeps the historical id for backwards compatibility.
35
+ region.id = priority === 'polite' ? 'ml-live-region' : 'ml-live-region-assertive';
36
36
  region.setAttribute('aria-live', priority);
37
+ region.setAttribute('aria-atomic', 'true');
38
+ region.setAttribute('role', priority === 'assertive' ? 'alert' : 'status');
39
+ applyVisuallyHiddenStyles(region);
40
+ document.body.appendChild(region);
41
+ state.element = region;
42
+ return region;
43
+ }
44
+ /**
45
+ * Drain the queue for one politeness level, one message at a time. Each
46
+ * message gets a clear → (delay) → set cycle so screen readers re-announce
47
+ * identical consecutive messages, and stays in the region for a minimum gap
48
+ * before the next queued message replaces it — rapid successive calls are
49
+ * announced in order instead of overwriting each other.
50
+ */
51
+ function flushQueue(priority) {
52
+ const state = regions[priority];
53
+ const message = state.queue.shift();
54
+ if (message === undefined) {
55
+ state.flushing = false;
56
+ return;
57
+ }
58
+ state.flushing = true;
59
+ const region = getLiveRegion(priority);
37
60
  // Clear and set message (screen readers need this pattern to re-announce)
38
61
  region.textContent = '';
39
- // Use setTimeout to ensure the clear is processed first
40
62
  setTimeout(() => {
41
63
  region.textContent = message;
42
- }, 50);
64
+ setTimeout(() => flushQueue(priority), MESSAGE_GAP_MS);
65
+ }, CLEAR_DELAY_MS);
66
+ }
67
+ /**
68
+ * Announce a message to screen readers.
69
+ *
70
+ * Messages are queued per politeness level, so rapid successive calls are
71
+ * announced one after another instead of the last call silently cancelling
72
+ * the earlier ones.
73
+ *
74
+ * @param message - The message to announce
75
+ * @param priority - 'polite' waits for silence, 'assertive' interrupts
76
+ */
77
+ export function announce(message, priority = 'polite') {
78
+ const state = regions[priority];
79
+ state.queue.push(message);
80
+ if (!state.flushing) {
81
+ flushQueue(priority);
82
+ }
43
83
  }
44
84
  /**
45
85
  * Create a custom live region with specific options
@@ -52,17 +92,6 @@ export function createLiveRegion(options = {}) {
52
92
  region.setAttribute('aria-live', priority);
53
93
  region.setAttribute('aria-atomic', atomic.toString());
54
94
  region.setAttribute('role', 'status');
55
- // Visually hidden
56
- Object.assign(region.style, {
57
- position: 'absolute',
58
- width: '1px',
59
- height: '1px',
60
- padding: '0',
61
- margin: '-1px',
62
- overflow: 'hidden',
63
- clip: 'rect(0, 0, 0, 0)',
64
- whiteSpace: 'nowrap',
65
- border: '0'
66
- });
95
+ applyVisuallyHiddenStyles(region);
67
96
  return region;
68
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"click-outside.directive.d.ts","sourceRoot":"","sources":["../../../src/utils/directives/click-outside.directive.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI,CAgBpG;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,MAAM,IAAI,CAErH"}
1
+ {"version":3,"file":"click-outside.directive.d.ts","sourceRoot":"","sources":["../../../src/utils/directives/click-outside.directive.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI,CAiBpG;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,MAAM,IAAI,CAErH"}
@@ -6,9 +6,11 @@
6
6
  */
7
7
  export function clickOutside(element, callback) {
8
8
  function handleClick(event) {
9
- const target = event.target;
10
- // Check if click is outside the element
11
- if (!element.contains(target)) {
9
+ // event.target is retargeted to the outer host at the document level, so
10
+ // element.contains() misreports clicks INSIDE shadow-hosted content as
11
+ // outside. composedPath() includes every node the event passed through,
12
+ // across shadow boundaries.
13
+ if (!event.composedPath().includes(element)) {
12
14
  callback(event);
13
15
  }
14
16
  }
@@ -0,0 +1,4 @@
1
+ export { OverlayPositioner, positionOverlayArrow } from './overlay-positioner.js';
2
+ export type { OverlayPositionConfig } from './overlay-positioner.js';
3
+ export { ToggleDismissGuard } from './toggle-dismiss-guard.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/overlay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { OverlayPositioner, positionOverlayArrow } from './overlay-positioner.js';
2
+ export { ToggleDismissGuard } from './toggle-dismiss-guard.js';
@@ -0,0 +1,54 @@
1
+ import type { Placement } from '../positioning/types.js';
2
+ /**
3
+ * Per-update positioning configuration. Resolved via a callback on every
4
+ * update so reactive component properties (placement, offset, arrow) are
5
+ * always read fresh.
6
+ */
7
+ export interface OverlayPositionConfig {
8
+ /** Preferred placement relative to the trigger. */
9
+ placement: Placement;
10
+ /** Gap between trigger and floating element in px (offset middleware). */
11
+ offset: number;
12
+ /** Padding passed to the shift middleware (default: 8). */
13
+ shiftPadding?: number;
14
+ /** Arrow element to position (arrow middleware); omit/null for none. */
15
+ arrowElement?: HTMLElement | null;
16
+ /** Padding passed to the arrow middleware (default: 8). */
17
+ arrowPadding?: number;
18
+ /** Match the floating element's width to the trigger's width (select/autocomplete). */
19
+ matchTriggerWidth?: boolean;
20
+ /** Reflect the resolved placement as `data-placement` on the floating element. */
21
+ placementAttribute?: boolean;
22
+ }
23
+ /**
24
+ * Shared open/close positioning lifecycle for anchored overlays
25
+ * (popover, dropdown, select, autocomplete, date-picker).
26
+ *
27
+ * Owns the `autoUpdate` subscription: `start()` begins repositioning the
28
+ * floating element against its trigger (initial position + scroll/resize
29
+ * tracking) and `stop()` tears it down. Calling `start()` while already
30
+ * active restarts cleanly; `stop()` is idempotent and doubles as the
31
+ * on-destroy cleanup.
32
+ */
33
+ export declare class OverlayPositioner {
34
+ private readonly _getConfig;
35
+ private _cleanupAutoUpdate;
36
+ constructor(_getConfig: () => OverlayPositionConfig);
37
+ /** Whether the positioner is currently tracking an open overlay. */
38
+ get active(): boolean;
39
+ /** Begin positioning `floatingEl` against `triggerEl` (positions immediately). */
40
+ start(triggerEl: HTMLElement, floatingEl: HTMLElement): void;
41
+ /** Stop positioning. Idempotent; call from close handlers and onDestroy. */
42
+ stop(): void;
43
+ /** Compute and apply the floating element's position once. */
44
+ position(triggerEl: HTMLElement, floatingEl: HTMLElement): void;
45
+ }
46
+ /**
47
+ * Apply arrow middleware coordinates to the arrow element and pin it to the
48
+ * side of the floating element facing the trigger.
49
+ */
50
+ export declare function positionOverlayArrow(arrowEl: HTMLElement, placement: string, arrowData: {
51
+ x?: number;
52
+ y?: number;
53
+ }): void;
54
+ //# sourceMappingURL=overlay-positioner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-positioner.d.ts","sourceRoot":"","sources":["../../../src/utils/overlay/overlay-positioner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAQzD;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACrC,mDAAmD;IACnD,SAAS,EAAE,SAAS,CAAC;IACrB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uFAAuF;IACvF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,qBAAa,iBAAiB;IAGjB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAFvC,OAAO,CAAC,kBAAkB,CAA6B;gBAE1B,UAAU,EAAE,MAAM,qBAAqB;IAEpE,oEAAoE;IACpE,IAAW,MAAM,IAAI,OAAO,CAE3B;IAED,kFAAkF;IAC3E,KAAK,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,GAAG,IAAI;IAOnE,4EAA4E;IACrE,IAAI,IAAI,IAAI;IAKnB,8DAA8D;IACvD,QAAQ,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,GAAG,IAAI;CA8BtE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAoBzH"}
@@ -0,0 +1,85 @@
1
+ import { computePosition } from '../positioning/compute-position.js';
2
+ import { autoUpdate } from '../positioning/auto-update.js';
3
+ import { offset } from '../positioning/middlewares/offset.middleware.js';
4
+ import { flip } from '../positioning/middlewares/flip.middleware.js';
5
+ import { shift } from '../positioning/middlewares/shift.middleware.js';
6
+ import { arrow as arrowMiddleware } from '../positioning/middlewares/arrow.middleware.js';
7
+ /**
8
+ * Shared open/close positioning lifecycle for anchored overlays
9
+ * (popover, dropdown, select, autocomplete, date-picker).
10
+ *
11
+ * Owns the `autoUpdate` subscription: `start()` begins repositioning the
12
+ * floating element against its trigger (initial position + scroll/resize
13
+ * tracking) and `stop()` tears it down. Calling `start()` while already
14
+ * active restarts cleanly; `stop()` is idempotent and doubles as the
15
+ * on-destroy cleanup.
16
+ */
17
+ export class OverlayPositioner {
18
+ constructor(_getConfig) {
19
+ this._getConfig = _getConfig;
20
+ this._cleanupAutoUpdate = null;
21
+ }
22
+ /** Whether the positioner is currently tracking an open overlay. */
23
+ get active() {
24
+ return this._cleanupAutoUpdate !== null;
25
+ }
26
+ /** Begin positioning `floatingEl` against `triggerEl` (positions immediately). */
27
+ start(triggerEl, floatingEl) {
28
+ this.stop();
29
+ // autoUpdate runs an initial update immediately, then keeps the overlay
30
+ // positioned on scroll/resize while open.
31
+ this._cleanupAutoUpdate = autoUpdate(triggerEl, floatingEl, () => this.position(triggerEl, floatingEl));
32
+ }
33
+ /** Stop positioning. Idempotent; call from close handlers and onDestroy. */
34
+ stop() {
35
+ this._cleanupAutoUpdate?.();
36
+ this._cleanupAutoUpdate = null;
37
+ }
38
+ /** Compute and apply the floating element's position once. */
39
+ position(triggerEl, floatingEl) {
40
+ const config = this._getConfig();
41
+ if (config.matchTriggerWidth) {
42
+ floatingEl.style.width = `${triggerEl.offsetWidth}px`;
43
+ }
44
+ const middleware = [offset(config.offset), flip(), shift({ padding: config.shiftPadding ?? 8 })];
45
+ const arrowEl = config.arrowElement ?? null;
46
+ if (arrowEl) {
47
+ middleware.push(arrowMiddleware({ element: arrowEl, padding: config.arrowPadding ?? 8 }));
48
+ }
49
+ const { x, y, placement, middlewareData } = computePosition(triggerEl, floatingEl, {
50
+ placement: config.placement,
51
+ middleware
52
+ });
53
+ floatingEl.style.left = `${x}px`;
54
+ floatingEl.style.top = `${y}px`;
55
+ if (config.placementAttribute) {
56
+ floatingEl.dataset.placement = placement;
57
+ }
58
+ if (arrowEl && middlewareData.arrow) {
59
+ positionOverlayArrow(arrowEl, placement, middlewareData.arrow);
60
+ }
61
+ }
62
+ }
63
+ /**
64
+ * Apply arrow middleware coordinates to the arrow element and pin it to the
65
+ * side of the floating element facing the trigger.
66
+ */
67
+ export function positionOverlayArrow(arrowEl, placement, arrowData) {
68
+ const side = placement.split('-')[0];
69
+ arrowEl.style.left = arrowData.x === undefined ? '' : `${arrowData.x}px`;
70
+ arrowEl.style.right = '';
71
+ arrowEl.style.top = arrowData.y === undefined ? '' : `${arrowData.y}px`;
72
+ arrowEl.style.bottom = '';
73
+ if (side === 'top') {
74
+ arrowEl.style.bottom = '-4px';
75
+ }
76
+ if (side === 'bottom') {
77
+ arrowEl.style.top = '-4px';
78
+ }
79
+ if (side === 'left') {
80
+ arrowEl.style.right = '-4px';
81
+ }
82
+ if (side === 'right') {
83
+ arrowEl.style.left = '-4px';
84
+ }
85
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Guard against the trigger click that just light-dismissed an open overlay
3
+ * immediately reopening it (popover, dropdown).
4
+ *
5
+ * With the Popover API, clicking the trigger of an open light-dismiss overlay
6
+ * fires the dismissal first (pointerdown outside the popover) and THEN the
7
+ * trigger's click handler — which would toggle the overlay straight back
8
+ * open. Components call `dismissed()` from their close path and gate their
9
+ * toggle handler on `shouldSkipToggle()`, which consumes the guard.
10
+ *
11
+ * The guard self-clears on the next macrotask, so it only ever swallows the
12
+ * click belonging to the dismissal itself.
13
+ */
14
+ export declare class ToggleDismissGuard {
15
+ private _justDismissed;
16
+ /** Record that the overlay just light-dismissed. */
17
+ dismissed(): void;
18
+ /**
19
+ * True when the current toggle should be swallowed (the trigger click that
20
+ * caused the dismissal). Consumes the guard.
21
+ */
22
+ shouldSkipToggle(): boolean;
23
+ }
24
+ //# sourceMappingURL=toggle-dismiss-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggle-dismiss-guard.d.ts","sourceRoot":"","sources":["../../../src/utils/overlay/toggle-dismiss-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,qBAAa,kBAAkB;IAC9B,OAAO,CAAC,cAAc,CAAS;IAE/B,oDAAoD;IAC7C,SAAS,IAAI,IAAI;IAOxB;;;OAGG;IACI,gBAAgB,IAAI,OAAO;CAOlC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Guard against the trigger click that just light-dismissed an open overlay
3
+ * immediately reopening it (popover, dropdown).
4
+ *
5
+ * With the Popover API, clicking the trigger of an open light-dismiss overlay
6
+ * fires the dismissal first (pointerdown outside the popover) and THEN the
7
+ * trigger's click handler — which would toggle the overlay straight back
8
+ * open. Components call `dismissed()` from their close path and gate their
9
+ * toggle handler on `shouldSkipToggle()`, which consumes the guard.
10
+ *
11
+ * The guard self-clears on the next macrotask, so it only ever swallows the
12
+ * click belonging to the dismissal itself.
13
+ */
14
+ export class ToggleDismissGuard {
15
+ constructor() {
16
+ this._justDismissed = false;
17
+ }
18
+ /** Record that the overlay just light-dismissed. */
19
+ dismissed() {
20
+ this._justDismissed = true;
21
+ setTimeout(() => {
22
+ this._justDismissed = false;
23
+ }, 0);
24
+ }
25
+ /**
26
+ * True when the current toggle should be swallowed (the trigger click that
27
+ * caused the dismissal). Consumes the guard.
28
+ */
29
+ shouldSkipToggle() {
30
+ if (this._justDismissed) {
31
+ this._justDismissed = false;
32
+ return true;
33
+ }
34
+ return false;
35
+ }
36
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"auto-update.d.ts","sourceRoot":"","sources":["../../../src/utils/positioning/auto-update.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,uDAAuD;IACvD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,uDAAuD;IACvD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sDAAsD;IACtD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iEAAiE;IACjE,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAgCD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,IAAI,CA+CrI"}
1
+ {"version":3,"file":"auto-update.d.ts","sourceRoot":"","sources":["../../../src/utils/positioning/auto-update.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,uDAAuD;IACvD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,uDAAuD;IACvD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sDAAsD;IACtD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iEAAiE;IACjE,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAgCD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,IAAI,CAmDrI"}
@@ -55,6 +55,9 @@ export function autoUpdate(reference, floating, update, options = {}) {
55
55
  observer.observe(floating);
56
56
  cleanups.push(() => observer.disconnect());
57
57
  }
58
+ // Run an initial update immediately (matches floating-ui) so the first
59
+ // paint is positioned without relying on a ResizeObserver tick.
60
+ update();
58
61
  // Update on animation frame (for animations/transitions)
59
62
  if (animationFrame) {
60
63
  let frameId;
@@ -1 +1 @@
1
- {"version":3,"file":"compute-position.d.ts","sourceRoot":"","sources":["../../../src/utils/positioning/compute-position.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAY,qBAAqB,EAAE,qBAAqB,EAAmB,MAAM,YAAY,CAAC;AA2DrH;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAE,qBAA0B,GAAG,qBAAqB,CAmCpI;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CASpE;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAEjF"}
1
+ {"version":3,"file":"compute-position.d.ts","sourceRoot":"","sources":["../../../src/utils/positioning/compute-position.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAY,qBAAqB,EAAE,qBAAqB,EAAmB,MAAM,YAAY,CAAC;AA2DrH;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAE,qBAA0B,GAAG,qBAAqB,CAuCpI;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CASpE;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAEjF"}
@@ -72,10 +72,14 @@ export function computePosition(reference, floating, config = {}) {
72
72
  for (const mw of middleware) {
73
73
  const result = mw.fn(state);
74
74
  if (result) {
75
- state = { ...state, ...result };
76
- if (result.middlewareData) {
77
- state.middlewareData = { ...state.middlewareData, ...result.middlewareData };
78
- }
75
+ // Merge middlewareData instead of replacing it, so data recorded by
76
+ // earlier middleware (e.g. offset) survives later middleware results.
77
+ const { middlewareData: resultData, ...rest } = result;
78
+ state = {
79
+ ...state,
80
+ ...rest,
81
+ middlewareData: resultData ? { ...state.middlewareData, ...resultData } : state.middlewareData
82
+ };
79
83
  }
80
84
  }
81
85
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"flip.middleware.d.ts","sourceRoot":"","sources":["../../../../src/utils/positioning/middlewares/flip.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGzD,MAAM,WAAW,WAAW;IAC3B,wCAAwC;IACxC,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC;IACjC,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AA4CD;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,UAAU,CAsC1D"}
1
+ {"version":3,"file":"flip.middleware.d.ts","sourceRoot":"","sources":["../../../../src/utils/positioning/middlewares/flip.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIzD,MAAM,WAAW,WAAW;IAC3B,wCAAwC;IACxC,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC;IACjC,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AA4CD;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,UAAU,CA6C1D"}
@@ -1,4 +1,5 @@
1
1
  import { getOppositePlacement, getSide } from '../compute-position.js';
2
+ import { applyOffsetToPosition } from './offset.middleware.js';
2
3
  /**
3
4
  * Detect overflow relative to viewport
4
5
  */
@@ -39,21 +40,27 @@ export function flip(options = {}) {
39
40
  return {
40
41
  name: 'flip',
41
42
  fn(state) {
42
- const { x, y, placement, rects } = state;
43
+ const { x, y, placement, rects, middlewareData } = state;
43
44
  const side = getSide(placement);
44
45
  const overflow = detectOverflow(x, y, rects.floating, padding);
45
46
  // Check if current placement has overflow
46
47
  if (!hasOverflow(overflow, side)) {
47
48
  return;
48
49
  }
50
+ // An earlier offset() records its amounts in middlewareData; re-apply
51
+ // them for each fallback so flipping preserves the configured gap.
52
+ const offsetData = middlewareData.offset;
49
53
  // Try opposite placement
50
54
  const oppositePlacement = getOppositePlacement(placement);
51
55
  const fallbacks = options.fallbackPlacements ?? [oppositePlacement];
52
56
  for (const fallback of fallbacks) {
53
57
  // Calculate position for fallback placement
54
- const newPos = getBasePlacementForFlip(rects.reference, rects.floating, fallback);
55
- const newOverflow = detectOverflow(newPos.x, newPos.y, rects.floating, padding);
56
58
  const newSide = getSide(fallback);
59
+ let newPos = getBasePlacementForFlip(rects.reference, rects.floating, fallback);
60
+ if (offsetData) {
61
+ newPos = applyOffsetToPosition(newPos, newSide, offsetData);
62
+ }
63
+ const newOverflow = detectOverflow(newPos.x, newPos.y, rects.floating, padding);
57
64
  if (!hasOverflow(newOverflow, newSide)) {
58
65
  return {
59
66
  x: newPos.x,