@melodicdev/components 2.0.2 → 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 (330) hide show
  1. package/README.md +7 -6
  2. package/assets/melodic-components.js +5568 -4145
  3. package/assets/melodic-components.js.map +1 -1
  4. package/assets/melodic-components.min.js +6469 -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.styles.d.ts.map +1 -1
  49. package/lib/components/data-display/table/table.styles.js +5 -2
  50. package/lib/components/data-display/table/table.template.d.ts.map +1 -1
  51. package/lib/components/data-display/table/table.template.js +1 -6
  52. package/lib/components/data-display/table-core/index.d.ts +3 -0
  53. package/lib/components/data-display/table-core/index.d.ts.map +1 -0
  54. package/lib/components/data-display/table-core/index.js +2 -0
  55. package/lib/components/data-display/table-core/table-core.d.ts +137 -0
  56. package/lib/components/data-display/table-core/table-core.d.ts.map +1 -0
  57. package/lib/components/data-display/table-core/table-core.js +225 -0
  58. package/lib/components/data-display/tag/tag.component.d.ts +14 -7
  59. package/lib/components/data-display/tag/tag.component.d.ts.map +1 -1
  60. package/lib/components/data-display/tag/tag.component.js +29 -5
  61. package/lib/components/data-display/tag/tag.template.js +2 -2
  62. package/lib/components/data-display/tag/tag.types.d.ts +8 -1
  63. package/lib/components/data-display/tag/tag.types.d.ts.map +1 -1
  64. package/lib/components/feedback/alert/alert.component.d.ts +6 -3
  65. package/lib/components/feedback/alert/alert.component.d.ts.map +1 -1
  66. package/lib/components/feedback/alert/alert.component.js +13 -4
  67. package/lib/components/feedback/alert/alert.template.js +1 -1
  68. package/lib/components/feedback/progress/progress.component.d.ts +4 -0
  69. package/lib/components/feedback/progress/progress.component.d.ts.map +1 -1
  70. package/lib/components/feedback/progress/progress.component.js +9 -0
  71. package/lib/components/feedback/progress/progress.template.d.ts.map +1 -1
  72. package/lib/components/feedback/progress/progress.template.js +19 -5
  73. package/lib/components/feedback/toast/toast.component.d.ts +6 -3
  74. package/lib/components/feedback/toast/toast.component.d.ts.map +1 -1
  75. package/lib/components/feedback/toast/toast.component.js +13 -4
  76. package/lib/components/feedback/toast/toast.service.d.ts.map +1 -1
  77. package/lib/components/feedback/toast/toast.service.js +2 -1
  78. package/lib/components/feedback/toast/toast.template.js +1 -1
  79. package/lib/components/forms/autocomplete/autocomplete.component.d.ts +12 -4
  80. package/lib/components/forms/autocomplete/autocomplete.component.d.ts.map +1 -1
  81. package/lib/components/forms/autocomplete/autocomplete.component.js +39 -30
  82. package/lib/components/forms/autocomplete/autocomplete.template.d.ts.map +1 -1
  83. package/lib/components/forms/autocomplete/autocomplete.template.js +14 -0
  84. package/lib/components/forms/button/button.component.d.ts +28 -3
  85. package/lib/components/forms/button/button.component.d.ts.map +1 -1
  86. package/lib/components/forms/button/button.component.js +81 -6
  87. package/lib/components/forms/button/button.template.js +1 -1
  88. package/lib/components/forms/button/button.types.d.ts +8 -1
  89. package/lib/components/forms/button/button.types.d.ts.map +1 -1
  90. package/lib/components/forms/button-group/button-group-item.component.d.ts +2 -2
  91. package/lib/components/forms/button-group/button-group-item.component.d.ts.map +1 -1
  92. package/lib/components/forms/button-group/button-group.component.d.ts +4 -2
  93. package/lib/components/forms/button-group/button-group.component.d.ts.map +1 -1
  94. package/lib/components/forms/button-group/button-group.component.js +3 -1
  95. package/lib/components/forms/button-group/button-group.styles.d.ts.map +1 -1
  96. package/lib/components/forms/button-group/button-group.styles.js +15 -1
  97. package/lib/components/forms/button-group/button-group.template.d.ts.map +1 -1
  98. package/lib/components/forms/button-group/button-group.template.js +4 -2
  99. package/lib/components/forms/checkbox/checkbox.component.d.ts +4 -2
  100. package/lib/components/forms/checkbox/checkbox.component.d.ts.map +1 -1
  101. package/lib/components/forms/checkbox/checkbox.component.js +3 -1
  102. package/lib/components/forms/checkbox/checkbox.styles.d.ts.map +1 -1
  103. package/lib/components/forms/checkbox/checkbox.styles.js +19 -0
  104. package/lib/components/forms/checkbox/checkbox.template.d.ts.map +1 -1
  105. package/lib/components/forms/checkbox/checkbox.template.js +4 -2
  106. package/lib/components/forms/date-picker/calendar.component.js +1 -1
  107. package/lib/components/forms/date-picker/date-picker.component.d.ts +11 -4
  108. package/lib/components/forms/date-picker/date-picker.component.d.ts.map +1 -1
  109. package/lib/components/forms/date-picker/date-picker.component.js +99 -32
  110. package/lib/components/forms/date-picker/date-picker.styles.d.ts.map +1 -1
  111. package/lib/components/forms/date-picker/date-picker.styles.js +0 -10
  112. package/lib/components/forms/date-picker/date-picker.template.d.ts.map +1 -1
  113. package/lib/components/forms/date-picker/date-picker.template.js +3 -4
  114. package/lib/components/forms/file-upload/file-upload-item.component.d.ts +7 -0
  115. package/lib/components/forms/file-upload/file-upload-item.component.d.ts.map +1 -1
  116. package/lib/components/forms/file-upload/file-upload-item.component.js +15 -0
  117. package/lib/components/forms/file-upload/file-upload.component.d.ts +15 -0
  118. package/lib/components/forms/file-upload/file-upload.component.d.ts.map +1 -1
  119. package/lib/components/forms/file-upload/file-upload.component.js +56 -0
  120. package/lib/components/forms/form-field/form-field.component.d.ts +12 -4
  121. package/lib/components/forms/form-field/form-field.component.d.ts.map +1 -1
  122. package/lib/components/forms/form-field/form-field.component.js +50 -31
  123. package/lib/components/forms/form-field/form-field.template.js +1 -1
  124. package/lib/components/forms/input/input.component.d.ts +2 -2
  125. package/lib/components/forms/input/input.component.d.ts.map +1 -1
  126. package/lib/components/forms/radio/radio-group.component.d.ts +6 -0
  127. package/lib/components/forms/radio/radio-group.component.d.ts.map +1 -1
  128. package/lib/components/forms/radio/radio-group.component.js +69 -2
  129. package/lib/components/forms/radio/radio-group.template.js +1 -1
  130. package/lib/components/forms/radio/radio.component.d.ts +7 -2
  131. package/lib/components/forms/radio/radio.component.d.ts.map +1 -1
  132. package/lib/components/forms/radio/radio.component.js +5 -0
  133. package/lib/components/forms/radio/radio.template.d.ts.map +1 -1
  134. package/lib/components/forms/radio/radio.template.js +1 -0
  135. package/lib/components/forms/select/select.component.d.ts +13 -6
  136. package/lib/components/forms/select/select.component.d.ts.map +1 -1
  137. package/lib/components/forms/select/select.component.js +32 -36
  138. package/lib/components/forms/select/select.template.d.ts.map +1 -1
  139. package/lib/components/forms/select/select.template.js +6 -2
  140. package/lib/components/forms/slider/slider.component.d.ts +2 -2
  141. package/lib/components/forms/slider/slider.component.d.ts.map +1 -1
  142. package/lib/components/forms/slider/slider.component.js +5 -1
  143. package/lib/components/forms/textarea/textarea.component.d.ts +2 -2
  144. package/lib/components/forms/textarea/textarea.component.d.ts.map +1 -1
  145. package/lib/components/forms/toggle/toggle.component.d.ts +4 -2
  146. package/lib/components/forms/toggle/toggle.component.d.ts.map +1 -1
  147. package/lib/components/forms/toggle/toggle.component.js +3 -1
  148. package/lib/components/forms/toggle/toggle.styles.d.ts.map +1 -1
  149. package/lib/components/forms/toggle/toggle.styles.js +19 -0
  150. package/lib/components/forms/toggle/toggle.template.d.ts.map +1 -1
  151. package/lib/components/forms/toggle/toggle.template.js +11 -3
  152. package/lib/components/foundation/card/card.component.d.ts +7 -6
  153. package/lib/components/foundation/card/card.component.d.ts.map +1 -1
  154. package/lib/components/foundation/card/card.component.js +18 -7
  155. package/lib/components/foundation/card/card.styles.d.ts.map +1 -1
  156. package/lib/components/foundation/card/card.styles.js +5 -0
  157. package/lib/components/foundation/card/card.template.d.ts.map +1 -1
  158. package/lib/components/foundation/card/card.template.js +16 -11
  159. package/lib/components/foundation/divider/divider.component.d.ts +5 -4
  160. package/lib/components/foundation/divider/divider.component.d.ts.map +1 -1
  161. package/lib/components/foundation/divider/divider.component.js +11 -3
  162. package/lib/components/foundation/divider/divider.styles.d.ts.map +1 -1
  163. package/lib/components/foundation/divider/divider.styles.js +6 -0
  164. package/lib/components/foundation/divider/divider.template.d.ts +5 -0
  165. package/lib/components/foundation/divider/divider.template.d.ts.map +1 -1
  166. package/lib/components/foundation/divider/divider.template.js +9 -6
  167. package/lib/components/general/icon/icon.template.d.ts.map +1 -1
  168. package/lib/components/general/icon/icon.template.js +3 -1
  169. package/lib/components/navigation/pagination/pagination.component.d.ts +5 -0
  170. package/lib/components/navigation/pagination/pagination.component.d.ts.map +1 -1
  171. package/lib/components/navigation/pagination/pagination.component.js +22 -10
  172. package/lib/components/navigation/pagination/pagination.styles.d.ts.map +1 -1
  173. package/lib/components/navigation/pagination/pagination.styles.js +6 -4
  174. package/lib/components/navigation/sidebar/sidebar-item.component.d.ts +4 -4
  175. package/lib/components/navigation/sidebar/sidebar-item.component.d.ts.map +1 -1
  176. package/lib/components/navigation/sidebar/sidebar-item.component.js +11 -4
  177. package/lib/components/navigation/sidebar/sidebar-item.template.js +2 -2
  178. package/lib/components/navigation/sidebar/sidebar.component.d.ts +7 -0
  179. package/lib/components/navigation/sidebar/sidebar.component.d.ts.map +1 -1
  180. package/lib/components/navigation/sidebar/sidebar.component.js +48 -5
  181. package/lib/components/navigation/steps/step-panel.component.d.ts +7 -0
  182. package/lib/components/navigation/steps/step-panel.component.d.ts.map +1 -1
  183. package/lib/components/navigation/steps/step-panel.component.js +7 -0
  184. package/lib/components/navigation/steps/step-panel.template.d.ts +1 -1
  185. package/lib/components/navigation/steps/step-panel.template.d.ts.map +1 -1
  186. package/lib/components/navigation/steps/step-panel.template.js +2 -2
  187. package/lib/components/navigation/steps/step.component.d.ts +2 -2
  188. package/lib/components/navigation/steps/step.component.d.ts.map +1 -1
  189. package/lib/components/navigation/steps/step.component.js +8 -2
  190. package/lib/components/navigation/steps/step.template.js +1 -1
  191. package/lib/components/navigation/steps/steps.component.d.ts +3 -1
  192. package/lib/components/navigation/steps/steps.component.d.ts.map +1 -1
  193. package/lib/components/navigation/steps/steps.component.js +47 -14
  194. package/lib/components/navigation/steps/steps.template.d.ts.map +1 -1
  195. package/lib/components/navigation/steps/steps.template.js +5 -1
  196. package/lib/components/navigation/tabs/tab-panel.component.d.ts +7 -0
  197. package/lib/components/navigation/tabs/tab-panel.component.d.ts.map +1 -1
  198. package/lib/components/navigation/tabs/tab-panel.component.js +7 -0
  199. package/lib/components/navigation/tabs/tab-panel.template.d.ts +1 -1
  200. package/lib/components/navigation/tabs/tab-panel.template.d.ts.map +1 -1
  201. package/lib/components/navigation/tabs/tab-panel.template.js +2 -2
  202. package/lib/components/navigation/tabs/tabs.component.d.ts +5 -3
  203. package/lib/components/navigation/tabs/tabs.component.d.ts.map +1 -1
  204. package/lib/components/navigation/tabs/tabs.component.js +49 -14
  205. package/lib/components/navigation/tabs/tabs.template.d.ts.map +1 -1
  206. package/lib/components/navigation/tabs/tabs.template.js +6 -1
  207. package/lib/components/overlays/dialog/dialog-ref.class.d.ts +17 -2
  208. package/lib/components/overlays/dialog/dialog-ref.class.d.ts.map +1 -1
  209. package/lib/components/overlays/dialog/dialog-ref.class.js +52 -6
  210. package/lib/components/overlays/dialog/dialog.component.d.ts.map +1 -1
  211. package/lib/components/overlays/dialog/dialog.component.js +5 -1
  212. package/lib/components/overlays/dialog/dialog.service.d.ts +2 -2
  213. package/lib/components/overlays/dialog/dialog.service.d.ts.map +1 -1
  214. package/lib/components/overlays/dialog/dialog.service.js +46 -18
  215. package/lib/components/overlays/drawer/drawer.component.d.ts +9 -2
  216. package/lib/components/overlays/drawer/drawer.component.d.ts.map +1 -1
  217. package/lib/components/overlays/drawer/drawer.component.js +34 -4
  218. package/lib/components/overlays/drawer/drawer.styles.d.ts.map +1 -1
  219. package/lib/components/overlays/drawer/drawer.styles.js +4 -0
  220. package/lib/components/overlays/dropdown/dropdown-item.component.d.ts +5 -2
  221. package/lib/components/overlays/dropdown/dropdown-item.component.d.ts.map +1 -1
  222. package/lib/components/overlays/dropdown/dropdown-item.component.js +18 -0
  223. package/lib/components/overlays/dropdown/dropdown-item.template.d.ts.map +1 -1
  224. package/lib/components/overlays/dropdown/dropdown-item.template.js +0 -3
  225. package/lib/components/overlays/dropdown/dropdown.component.d.ts +8 -4
  226. package/lib/components/overlays/dropdown/dropdown.component.d.ts.map +1 -1
  227. package/lib/components/overlays/dropdown/dropdown.component.js +61 -60
  228. package/lib/components/overlays/popover/popover.component.d.ts +6 -4
  229. package/lib/components/overlays/popover/popover.component.d.ts.map +1 -1
  230. package/lib/components/overlays/popover/popover.component.js +37 -51
  231. package/lib/components/overlays/tooltip/tooltip.component.d.ts +29 -4
  232. package/lib/components/overlays/tooltip/tooltip.component.d.ts.map +1 -1
  233. package/lib/components/overlays/tooltip/tooltip.component.js +73 -31
  234. package/lib/components/overlays/tooltip/tooltip.styles.d.ts.map +1 -1
  235. package/lib/components/overlays/tooltip/tooltip.styles.js +22 -10
  236. package/lib/components/overlays/tooltip/tooltip.template.d.ts.map +1 -1
  237. package/lib/components/overlays/tooltip/tooltip.template.js +3 -2
  238. package/lib/components/pages/auth/login-page.component.d.ts +11 -4
  239. package/lib/components/pages/auth/login-page.component.d.ts.map +1 -1
  240. package/lib/components/pages/auth/login-page.component.js +18 -5
  241. package/lib/components/pages/auth/login-page.template.d.ts.map +1 -1
  242. package/lib/components/pages/auth/login-page.template.js +9 -10
  243. package/lib/components/pages/auth/signup-page.component.d.ts +11 -4
  244. package/lib/components/pages/auth/signup-page.component.d.ts.map +1 -1
  245. package/lib/components/pages/auth/signup-page.component.js +18 -5
  246. package/lib/components/pages/auth/signup-page.template.d.ts.map +1 -1
  247. package/lib/components/pages/auth/signup-page.template.js +9 -10
  248. package/lib/components/pages/dashboard/dashboard-page.component.d.ts +18 -11
  249. package/lib/components/pages/dashboard/dashboard-page.component.d.ts.map +1 -1
  250. package/lib/components/pages/dashboard/dashboard-page.component.js +55 -13
  251. package/lib/components/pages/dashboard/dashboard-page.template.js +1 -1
  252. package/lib/components/sections/app-shell/app-shell.component.d.ts +6 -6
  253. package/lib/components/sections/app-shell/app-shell.component.d.ts.map +1 -1
  254. package/lib/components/sections/app-shell/app-shell.component.js +14 -6
  255. package/lib/components/sections/app-shell/app-shell.template.js +3 -3
  256. package/lib/components/sections/hero/hero-section.component.d.ts +6 -3
  257. package/lib/components/sections/hero/hero-section.component.d.ts.map +1 -1
  258. package/lib/components/sections/hero/hero-section.component.js +13 -4
  259. package/lib/components/sections/hero/hero-section.template.js +2 -2
  260. package/lib/components/sections/page-header/page-header.component.d.ts +16 -17
  261. package/lib/components/sections/page-header/page-header.component.d.ts.map +1 -1
  262. package/lib/components/sections/page-header/page-header.component.js +36 -25
  263. package/lib/components/sections/page-header/page-header.styles.d.ts.map +1 -1
  264. package/lib/components/sections/page-header/page-header.styles.js +9 -0
  265. package/lib/components/sections/page-header/page-header.template.d.ts +5 -0
  266. package/lib/components/sections/page-header/page-header.template.d.ts.map +1 -1
  267. package/lib/components/sections/page-header/page-header.template.js +42 -31
  268. package/lib/components/sections/page-section/page-section.component.d.ts +16 -12
  269. package/lib/components/sections/page-section/page-section.component.d.ts.map +1 -1
  270. package/lib/components/sections/page-section/page-section.component.js +34 -12
  271. package/lib/components/sections/page-section/page-section.styles.d.ts.map +1 -1
  272. package/lib/components/sections/page-section/page-section.styles.js +6 -0
  273. package/lib/components/sections/page-section/page-section.template.d.ts +6 -0
  274. package/lib/components/sections/page-section/page-section.template.d.ts.map +1 -1
  275. package/lib/components/sections/page-section/page-section.template.js +26 -15
  276. package/lib/components/sections/page-section/sanitize-href.function.d.ts +12 -0
  277. package/lib/components/sections/page-section/sanitize-href.function.d.ts.map +1 -0
  278. package/lib/components/sections/page-section/sanitize-href.function.js +15 -0
  279. package/lib/directives/tooltip.directive.d.ts +8 -2
  280. package/lib/directives/tooltip.directive.d.ts.map +1 -1
  281. package/lib/directives/tooltip.directive.js +103 -9
  282. package/lib/functions/deprecation.functions.d.ts +21 -0
  283. package/lib/functions/deprecation.functions.d.ts.map +1 -0
  284. package/lib/functions/deprecation.functions.js +44 -0
  285. package/lib/functions/index.d.ts +2 -0
  286. package/lib/functions/index.d.ts.map +1 -1
  287. package/lib/functions/index.js +2 -0
  288. package/lib/functions/watch-slot-presence.function.d.ts +17 -0
  289. package/lib/functions/watch-slot-presence.function.d.ts.map +1 -0
  290. package/lib/functions/watch-slot-presence.function.js +27 -0
  291. package/lib/theme/functions/create-theme.function.d.ts +15 -1
  292. package/lib/theme/functions/create-theme.function.d.ts.map +1 -1
  293. package/lib/theme/functions/create-theme.function.js +57 -11
  294. package/lib/theme/index.d.ts +1 -0
  295. package/lib/theme/index.d.ts.map +1 -1
  296. package/lib/types/index.d.ts +8 -2
  297. package/lib/types/index.d.ts.map +1 -1
  298. package/lib/utils/accessibility/focus-trap.d.ts +19 -1
  299. package/lib/utils/accessibility/focus-trap.d.ts.map +1 -1
  300. package/lib/utils/accessibility/focus-trap.js +77 -8
  301. package/lib/utils/accessibility/index.d.ts +2 -1
  302. package/lib/utils/accessibility/index.d.ts.map +1 -1
  303. package/lib/utils/accessibility/index.js +1 -1
  304. package/lib/utils/accessibility/live-region.d.ts +10 -3
  305. package/lib/utils/accessibility/live-region.d.ts.map +1 -1
  306. package/lib/utils/accessibility/live-region.js +64 -35
  307. package/lib/utils/directives/click-outside.directive.d.ts.map +1 -1
  308. package/lib/utils/directives/click-outside.directive.js +5 -3
  309. package/lib/utils/overlay/index.d.ts +4 -0
  310. package/lib/utils/overlay/index.d.ts.map +1 -0
  311. package/lib/utils/overlay/index.js +2 -0
  312. package/lib/utils/overlay/overlay-positioner.d.ts +54 -0
  313. package/lib/utils/overlay/overlay-positioner.d.ts.map +1 -0
  314. package/lib/utils/overlay/overlay-positioner.js +85 -0
  315. package/lib/utils/overlay/toggle-dismiss-guard.d.ts +24 -0
  316. package/lib/utils/overlay/toggle-dismiss-guard.d.ts.map +1 -0
  317. package/lib/utils/overlay/toggle-dismiss-guard.js +36 -0
  318. package/lib/utils/positioning/auto-update.d.ts.map +1 -1
  319. package/lib/utils/positioning/auto-update.js +3 -0
  320. package/lib/utils/positioning/compute-position.d.ts.map +1 -1
  321. package/lib/utils/positioning/compute-position.js +8 -4
  322. package/lib/utils/positioning/middlewares/flip.middleware.d.ts.map +1 -1
  323. package/lib/utils/positioning/middlewares/flip.middleware.js +10 -3
  324. package/lib/utils/positioning/middlewares/offset.middleware.d.ts +15 -0
  325. package/lib/utils/positioning/middlewares/offset.middleware.d.ts.map +1 -1
  326. package/lib/utils/positioning/middlewares/offset.middleware.js +31 -1
  327. package/lib/utils/positioning/middlewares/shift.middleware.d.ts +13 -3
  328. package/lib/utils/positioning/middlewares/shift.middleware.d.ts.map +1 -1
  329. package/lib/utils/positioning/middlewares/shift.middleware.js +15 -7
  330. package/package.json +6 -2
@@ -5,8 +5,43 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { MelodicComponent } from '@melodicdev/core';
8
+ import { registerAdapter } from '@melodicdev/core/forms';
8
9
  import { fileUploadTemplate } from './file-upload.template.js';
9
10
  import { fileUploadStyles } from './file-upload.styles.js';
11
+ // Forms adapter: lets `:formControl` bind to ml-file-upload. The control value
12
+ // is the selected File[] in `multiple` mode, or a single File | null otherwise.
13
+ // Validator messages auto-populate the existing `error` attribute via the
14
+ // directive's standard error sync.
15
+ registerAdapter((el) => el.tagName === 'ML-FILE-UPLOAD', {
16
+ inputEvent: 'ml:change',
17
+ blurEvent: 'focusout',
18
+ getValue: (el) => {
19
+ const e = el;
20
+ return e.multiple ? e.files : (e.files[0] ?? null);
21
+ },
22
+ setValue: (el, value) => {
23
+ const e = el;
24
+ if (value === null || value === undefined) {
25
+ if (e.files.length > 0)
26
+ e.files = [];
27
+ }
28
+ else if (Array.isArray(value)) {
29
+ e.files = value;
30
+ }
31
+ else {
32
+ e.files = [value];
33
+ }
34
+ },
35
+ setDisabled: (el, disabled) => {
36
+ el.disabled = disabled;
37
+ }
38
+ });
39
+ /**
40
+ * ml-file-upload - Drag-and-drop / click-to-browse file selection dropzone
41
+ *
42
+ * @fires ml:change - Emitted when valid files are selected. Detail: { files }
43
+ * @fires ml:error - Emitted when files fail validation. Detail: { errors }
44
+ */
10
45
  let FileUploadComponent = class FileUploadComponent {
11
46
  constructor() {
12
47
  this.accept = '';
@@ -21,6 +56,24 @@ let FileUploadComponent = class FileUploadComponent {
21
56
  this.icon = 'cloud-arrow-up';
22
57
  this.dragOver = false;
23
58
  this._dragCounter = 0;
59
+ /**
60
+ * The currently selected (valid) files. Accumulates across selections in
61
+ * `multiple` mode and is replaced by the latest selection otherwise. This
62
+ * backs the forms adapter, so a bound FormControl stays in sync; it can
63
+ * also be set programmatically (e.g. control.setValue([]) to reset).
64
+ */
65
+ this.files = [];
66
+ /** Remove a previously selected file (keeps a bound FormControl in sync). */
67
+ this.removeFile = (file) => {
68
+ if (!this.files.includes(file))
69
+ return;
70
+ this.files = this.files.filter((f) => f !== file);
71
+ this.elementRef.dispatchEvent(new CustomEvent('ml:change', {
72
+ bubbles: true,
73
+ composed: true,
74
+ detail: { files: this.files }
75
+ }));
76
+ };
24
77
  this.handleClick = () => {
25
78
  if (this.disabled)
26
79
  return;
@@ -111,6 +164,9 @@ let FileUploadComponent = class FileUploadComponent {
111
164
  }));
112
165
  }
113
166
  if (validFiles.length > 0) {
167
+ // Track selection state (backs the forms adapter): accumulate in
168
+ // multiple mode, replace in single mode.
169
+ this.files = this.multiple ? [...this.files, ...validFiles] : validFiles.slice(0, 1);
114
170
  this.elementRef.dispatchEvent(new CustomEvent('ml:change', {
115
171
  bubbles: true,
116
172
  composed: true,
@@ -1,5 +1,5 @@
1
- import type { IElementRef, OnCreate } from '@melodicdev/core';
2
- import type { Size } from '../../../types/index.js';
1
+ import type { IElementRef, OnCreate, OnRender } from '@melodicdev/core';
2
+ import type { ControlSize } from '../../../types/index.js';
3
3
  import type { FormFieldOrientation } from './form-field.types.js';
4
4
  /**
5
5
  * ml-form-field - Wrapper component that adds label, hint, and error to any form control
@@ -21,7 +21,7 @@ import type { FormFieldOrientation } from './form-field.types.js';
21
21
  *
22
22
  * @slot default - The form control element
23
23
  */
24
- export declare class FormFieldComponent implements IElementRef, OnCreate {
24
+ export declare class FormFieldComponent implements IElementRef, OnCreate, OnRender {
25
25
  elementRef: HTMLElement;
26
26
  /** Label text */
27
27
  label: string;
@@ -30,7 +30,7 @@ export declare class FormFieldComponent implements IElementRef, OnCreate {
30
30
  /** Error message (shows error state when set) */
31
31
  error: string;
32
32
  /** Field size */
33
- size: Size;
33
+ size: ControlSize;
34
34
  /** Layout orientation */
35
35
  orientation: FormFieldOrientation;
36
36
  /** Disabled state */
@@ -44,8 +44,16 @@ export declare class FormFieldComponent implements IElementRef, OnCreate {
44
44
  get errorId(): string;
45
45
  get describedBy(): string;
46
46
  onCreate(): void;
47
+ onRender(): void;
47
48
  handleSlotChange: () => void;
49
+ /** Cached slotted control — connectSlottedControl runs every render, so the
50
+ * slot scan + recursive control search must not. Invalidated on slotchange
51
+ * (and when the cached element leaves the DOM, e.g. a nested swap that
52
+ * doesn't re-assign the slot). */
53
+ private _control;
54
+ private _controlResolved;
48
55
  private connectSlottedControl;
56
+ private syncAttribute;
49
57
  private findFormControl;
50
58
  }
51
59
  //# sourceMappingURL=form-field.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-field.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/form-field/form-field.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAIlE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAMa,kBAAmB,YAAW,WAAW,EAAE,QAAQ;IACxD,UAAU,EAAG,WAAW,CAAC;IAEhC,iBAAiB;IACV,KAAK,SAAM;IAElB,wCAAwC;IACjC,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,iBAAiB;IACV,IAAI,EAAE,IAAI,CAAQ;IAEzB,yBAAyB;IAClB,WAAW,EAAE,oBAAoB,CAAc;IAEtD,qBAAqB;IACd,QAAQ,UAAS;IAExB,+BAA+B;IACxB,QAAQ,UAAS;IAExB,gDAAgD;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6D;IAEtF,IAAW,OAAO,IAAI,MAAM,CAE3B;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,OAAO,IAAI,MAAM,CAE3B;IAED,IAAW,WAAW,IAAI,MAAM,CAI/B;IAEM,QAAQ,IAAI,IAAI;IAIhB,gBAAgB,QAAO,IAAI,CAEhC;IAEF,OAAO,CAAC,qBAAqB;IAqC7B,OAAO,CAAC,eAAe;CAqCvB"}
1
+ {"version":3,"file":"form-field.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/form-field/form-field.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAIlE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAMa,kBAAmB,YAAW,WAAW,EAAE,QAAQ,EAAE,QAAQ;IAClE,UAAU,EAAG,WAAW,CAAC;IAEhC,iBAAiB;IACV,KAAK,SAAM;IAElB,wCAAwC;IACjC,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,iBAAiB;IACV,IAAI,EAAE,WAAW,CAAQ;IAEhC,yBAAyB;IAClB,WAAW,EAAE,oBAAoB,CAAc;IAEtD,qBAAqB;IACd,QAAQ,UAAS;IAExB,+BAA+B;IACxB,QAAQ,UAAS;IAExB,gDAAgD;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6D;IAEtF,IAAW,OAAO,IAAI,MAAM,CAE3B;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,OAAO,IAAI,MAAM,CAE3B;IAED,IAAW,WAAW,IAAI,MAAM,CAM/B;IAEM,QAAQ,IAAI,IAAI;IAIhB,QAAQ,IAAI,IAAI;IAOhB,gBAAgB,QAAO,IAAI,CAGhC;IAEF;;;sCAGkC;IAClC,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,gBAAgB,CAAS;IAEjC,OAAO,CAAC,qBAAqB;IAiC7B,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,eAAe;CAqCvB"}
@@ -46,8 +46,15 @@ let FormFieldComponent = class FormFieldComponent {
46
46
  /** Unique ID for connecting label to control */
47
47
  this._fieldId = `ml-form-field-${Math.random().toString(36).slice(2, 9)}`;
48
48
  this.handleSlotChange = () => {
49
+ this._controlResolved = false;
49
50
  this.connectSlottedControl();
50
51
  };
52
+ /** Cached slotted control — connectSlottedControl runs every render, so the
53
+ * slot scan + recursive control search must not. Invalidated on slotchange
54
+ * (and when the cached element leaves the DOM, e.g. a nested swap that
55
+ * doesn't re-assign the slot). */
56
+ this._control = null;
57
+ this._controlResolved = false;
51
58
  }
52
59
  get fieldId() {
53
60
  return this._fieldId;
@@ -59,45 +66,57 @@ let FormFieldComponent = class FormFieldComponent {
59
66
  return `${this._fieldId}-error`;
60
67
  }
61
68
  get describedBy() {
69
+ // Both the error and the hint describe the control when both are present.
70
+ const ids = [];
62
71
  if (this.error)
63
- return this.errorId;
72
+ ids.push(this.errorId);
64
73
  if (this.hint)
65
- return this.hintId;
66
- return '';
74
+ ids.push(this.hintId);
75
+ return ids.join(' ');
67
76
  }
68
77
  onCreate() {
69
78
  this.connectSlottedControl();
70
79
  }
80
+ onRender() {
81
+ // Re-sync ARIA after every render so reactive changes to error/hint/
82
+ // required (e.g. validation errors set after submit) reach the slotted
83
+ // control — and are removed again when the error clears.
84
+ this.connectSlottedControl();
85
+ }
71
86
  connectSlottedControl() {
72
- const slot = this.elementRef.shadowRoot?.querySelector('slot:not([name])');
73
- if (!slot)
87
+ if (this._control && !this._control.isConnected) {
88
+ this._controlResolved = false;
89
+ }
90
+ if (!this._controlResolved) {
91
+ const slot = this.elementRef.shadowRoot?.querySelector('slot:not([name])');
92
+ if (!slot)
93
+ return;
94
+ this._control = this.findFormControl(slot.assignedElements({ flatten: true }));
95
+ this._controlResolved = true;
96
+ }
97
+ const control = this._control;
98
+ if (!control)
74
99
  return;
75
- const elements = slot.assignedElements({ flatten: true });
76
- const control = this.findFormControl(elements);
77
- if (control) {
78
- // Set ID if not present
79
- if (!control.id) {
80
- control.id = this.fieldId;
81
- }
82
- // Connect aria-describedby for hint/error
83
- if (this.describedBy) {
84
- control.setAttribute('aria-describedby', this.describedBy);
85
- }
86
- // Set aria-invalid for error state
87
- if (this.error) {
88
- control.setAttribute('aria-invalid', 'true');
89
- }
90
- else {
91
- control.removeAttribute('aria-invalid');
92
- }
93
- // Set aria-required
94
- if (this.required) {
95
- control.setAttribute('aria-required', 'true');
96
- }
97
- // Set disabled if applicable
98
- if (this.disabled && 'disabled' in control) {
99
- control.disabled = true;
100
- }
100
+ // Set ID if not present
101
+ if (!control.id) {
102
+ control.id = this.fieldId;
103
+ }
104
+ // Connect aria-describedby for hint/error; remove when neither is set.
105
+ // Writes are diffed so a no-change render doesn't touch the DOM.
106
+ this.syncAttribute(control, 'aria-describedby', this.describedBy || null);
107
+ this.syncAttribute(control, 'aria-invalid', this.error ? 'true' : null);
108
+ this.syncAttribute(control, 'aria-required', this.required ? 'true' : null);
109
+ // Set disabled if applicable
110
+ if (this.disabled && 'disabled' in control) {
111
+ control.disabled = true;
112
+ }
113
+ }
114
+ syncAttribute(el, name, value) {
115
+ if (value === null) {
116
+ el.removeAttribute(name);
117
+ }
118
+ else if (el.getAttribute(name) !== value) {
119
+ el.setAttribute(name, value);
101
120
  }
102
121
  }
103
122
  findFormControl(elements) {
@@ -22,7 +22,7 @@ export function formFieldTemplate(c) {
22
22
  </div>
23
23
 
24
24
  ${when(!!c.error, () => html `<span id=${c.errorId} class="ml-form-field__error">${c.error}</span>`)}
25
- ${when(!c.error && !!c.hint, () => html `<span id=${c.hintId} class="ml-form-field__hint">${c.hint}</span>`)}
25
+ ${when(!!c.hint, () => html `<span id=${c.hintId} class="ml-form-field__hint">${c.hint}</span>`)}
26
26
  </div>
27
27
  `;
28
28
  }
@@ -1,5 +1,5 @@
1
1
  import type { IElementRef, OnInit } from '@melodicdev/core';
2
- import type { Size } from '../../../types/index.js';
2
+ import type { ControlSize } from '../../../types/index.js';
3
3
  import type { InputType } from './input.types.js';
4
4
  /**
5
5
  * ml-input - Text input component with label, hint, and error states
@@ -35,7 +35,7 @@ export declare class InputComponent implements IElementRef, OnInit {
35
35
  /** Error message (shows error state when set) */
36
36
  error: string;
37
37
  /** Input size */
38
- size: Size;
38
+ size: ControlSize;
39
39
  /** Disable the input */
40
40
  disabled: boolean;
41
41
  /** Make input readonly */
@@ -1 +1 @@
1
- {"version":3,"file":"input.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/input/input.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAYlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAMa,cAAe,YAAW,WAAW,EAAE,MAAM;IAClD,UAAU,EAAG,WAAW,CAAC;IAEhC,iBAAiB;IACV,IAAI,EAAE,SAAS,CAAU;IAEhC,oBAAoB;IACb,KAAK,SAAM;IAElB,uBAAuB;IAChB,WAAW,SAAM;IAExB,iBAAiB;IACV,KAAK,SAAM;IAElB,kCAAkC;IAC3B,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,iBAAiB;IACV,IAAI,EAAE,IAAI,CAAQ;IAEzB,wBAAwB;IACjB,QAAQ,UAAS;IAExB,0BAA0B;IACnB,QAAQ,UAAS;IAExB,uBAAuB;IAChB,QAAQ,UAAS;IAExB,6BAA6B;IACtB,YAAY,SAAS;IAE5B,2BAA2B;IACpB,OAAO,UAAS;IAEhB,MAAM,IAAI,IAAI;IAOd,WAAW,GAAI,OAAO,KAAK,KAAG,IAAI,CAWvC;IAEK,YAAY,GAAI,OAAO,KAAK,KAAG,IAAI,CAWxC;IAEK,WAAW,QAAO,IAAI,CAQ3B;IAEK,UAAU,QAAO,IAAI,CAQ1B;CACF"}
1
+ {"version":3,"file":"input.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/input/input.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAYlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAMa,cAAe,YAAW,WAAW,EAAE,MAAM;IAClD,UAAU,EAAG,WAAW,CAAC;IAEhC,iBAAiB;IACV,IAAI,EAAE,SAAS,CAAU;IAEhC,oBAAoB;IACb,KAAK,SAAM;IAElB,uBAAuB;IAChB,WAAW,SAAM;IAExB,iBAAiB;IACV,KAAK,SAAM;IAElB,kCAAkC;IAC3B,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,iBAAiB;IACV,IAAI,EAAE,WAAW,CAAQ;IAEhC,wBAAwB;IACjB,QAAQ,UAAS;IAExB,0BAA0B;IACnB,QAAQ,UAAS;IAExB,uBAAuB;IAChB,QAAQ,UAAS;IAExB,6BAA6B;IACtB,YAAY,SAAS;IAE5B,2BAA2B;IACpB,OAAO,UAAS;IAEhB,MAAM,IAAI,IAAI;IAOd,WAAW,GAAI,OAAO,KAAK,KAAG,IAAI,CAWvC;IAEK,YAAY,GAAI,OAAO,KAAK,KAAG,IAAI,CAWxC;IAEK,WAAW,QAAO,IAAI,CAQ3B;IAEK,UAAU,QAAO,IAAI,CAQ1B;CACF"}
@@ -35,6 +35,12 @@ export declare class RadioGroupComponent implements IElementRef, OnInit {
35
35
  onCreate(): void;
36
36
  onRender(): void;
37
37
  private handleChildChange;
38
+ /** WAI-ARIA radio group keyboard support: arrows move focus AND selection. */
39
+ private handleKeyDown;
40
+ private selectRadio;
41
+ private focusRadio;
42
+ private getRadioValue;
43
+ private getEnabledRadios;
38
44
  private updateChildRadios;
39
45
  }
40
46
  //# sourceMappingURL=radio-group.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-group.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio-group.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAY3D;;;;;;;;;;;;GAYG;AACH,qBAMa,mBAAoB,YAAW,WAAW,EAAE,MAAM;IACvD,UAAU,EAAG,WAAW,CAAC;IAEhC,kBAAkB;IACX,KAAK,SAAM;IAElB,sBAAsB;IACf,IAAI,SAAM;IAEjB,6BAA6B;IACtB,KAAK,SAAM;IAElB,gBAAgB;IACT,IAAI,SAAM;IAEjB,oBAAoB;IACb,KAAK,SAAM;IAElB,yBAAyB;IAClB,WAAW,EAAE,WAAW,CAAc;IAE7C,qBAAqB;IACd,QAAQ,UAAS;IAExB,qBAAqB;IACd,QAAQ,UAAS;IAEjB,MAAM,IAAI,IAAI;IAKd,QAAQ,IAAI,IAAI;IAMhB,QAAQ,IAAI,IAAI;IAOvB,OAAO,CAAC,iBAAiB,CAmBvB;IAEF,OAAO,CAAC,iBAAiB;CAuBzB"}
1
+ {"version":3,"file":"radio-group.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio-group.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAY3D;;;;;;;;;;;;GAYG;AACH,qBAMa,mBAAoB,YAAW,WAAW,EAAE,MAAM;IACvD,UAAU,EAAG,WAAW,CAAC;IAEhC,kBAAkB;IACX,KAAK,SAAM;IAElB,sBAAsB;IACf,IAAI,SAAM;IAEjB,6BAA6B;IACtB,KAAK,SAAM;IAElB,gBAAgB;IACT,IAAI,SAAM;IAEjB,oBAAoB;IACb,KAAK,SAAM;IAElB,yBAAyB;IAClB,WAAW,EAAE,WAAW,CAAc;IAE7C,qBAAqB;IACd,QAAQ,UAAS;IAExB,qBAAqB;IACd,QAAQ,UAAS;IAEjB,MAAM,IAAI,IAAI;IAQd,QAAQ,IAAI,IAAI;IAMhB,QAAQ,IAAI,IAAI;IAOvB,OAAO,CAAC,iBAAiB,CAuBvB;IAEF,8EAA8E;IAC9E,OAAO,CAAC,aAAa,CA8BnB;IAEF,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,iBAAiB;CAoCzB"}
@@ -50,6 +50,9 @@ let RadioGroupComponent = class RadioGroupComponent {
50
50
  if (event.target === this.elementRef) {
51
51
  return;
52
52
  }
53
+ // Consume the child radio's event so consumers observe exactly one
54
+ // ml:change per selection (the group's re-emit below).
55
+ event.stopImmediatePropagation();
53
56
  const detail = event.detail;
54
57
  this.value = detail.value;
55
58
  // Update checked state on all child radios
@@ -61,10 +64,44 @@ let RadioGroupComponent = class RadioGroupComponent {
61
64
  detail: { value: this.value }
62
65
  }));
63
66
  };
67
+ /** WAI-ARIA radio group keyboard support: arrows move focus AND selection. */
68
+ this.handleKeyDown = (event) => {
69
+ if (this.disabled)
70
+ return;
71
+ let direction = 0;
72
+ if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {
73
+ direction = 1;
74
+ }
75
+ else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {
76
+ direction = -1;
77
+ }
78
+ else {
79
+ return;
80
+ }
81
+ const radios = this.getEnabledRadios();
82
+ if (radios.length === 0)
83
+ return;
84
+ event.preventDefault();
85
+ // Current position: the radio that received the key, falling back to the
86
+ // checked radio, falling back to just before/at the first.
87
+ const originRadio = event.target?.closest?.('ml-radio') ?? null;
88
+ let index = originRadio ? radios.indexOf(originRadio) : -1;
89
+ if (index === -1) {
90
+ index = radios.findIndex((radio) => this.getRadioValue(radio) === this.value && this.value !== '');
91
+ }
92
+ if (index === -1) {
93
+ index = direction === 1 ? -1 : 0;
94
+ }
95
+ const next = radios[(index + direction + radios.length) % radios.length];
96
+ this.selectRadio(next);
97
+ };
64
98
  }
65
99
  onInit() {
66
100
  // Listen for changes from child radios
67
101
  this.elementRef.addEventListener('ml:change', this.handleChildChange);
102
+ // Arrow-key navigation (roving tabindex) — radios live in their own
103
+ // shadow roots so native radio grouping does not apply.
104
+ this.elementRef.addEventListener('keydown', this.handleKeyDown);
68
105
  }
69
106
  onCreate() {
70
107
  // Re-sync when slotted radios are added/removed.
@@ -77,24 +114,54 @@ let RadioGroupComponent = class RadioGroupComponent {
77
114
  // reset — are reflected on the slotted radios.
78
115
  this.updateChildRadios();
79
116
  }
117
+ selectRadio(radio) {
118
+ this.value = this.getRadioValue(radio);
119
+ this.updateChildRadios();
120
+ this.focusRadio(radio);
121
+ this.elementRef.dispatchEvent(new CustomEvent('ml:change', {
122
+ bubbles: true,
123
+ composed: true,
124
+ detail: { value: this.value }
125
+ }));
126
+ }
127
+ focusRadio(radio) {
128
+ const input = radio.shadowRoot?.querySelector('.ml-radio__input');
129
+ input?.focus();
130
+ }
131
+ getRadioValue(radio) {
132
+ return radio.value ?? radio.getAttribute('value') ?? '';
133
+ }
134
+ getEnabledRadios() {
135
+ return Array.from(this.elementRef.querySelectorAll('ml-radio')).filter((radio) => radio.disabled !== true && !radio.hasAttribute('disabled'));
136
+ }
80
137
  updateChildRadios() {
81
138
  const radios = this.elementRef.querySelectorAll('ml-radio');
82
139
  if (this.value === '') {
83
140
  for (const radio of radios) {
84
141
  const isChecked = radio.checked === true || radio.hasAttribute('checked');
85
142
  if (isChecked) {
86
- this.value = radio.value ?? radio.getAttribute('value') ?? '';
143
+ this.value = this.getRadioValue(radio);
87
144
  break;
88
145
  }
89
146
  }
90
147
  }
148
+ // Roving tabindex: the checked radio is the single tab stop; when nothing
149
+ // is checked, the first enabled radio takes it.
150
+ let tabbableRadio = null;
151
+ if (this.value !== '') {
152
+ tabbableRadio = Array.from(radios).find((radio) => this.getRadioValue(radio) === this.value && radio.disabled !== true && !radio.hasAttribute('disabled')) ?? null;
153
+ }
154
+ if (!tabbableRadio) {
155
+ tabbableRadio = this.getEnabledRadios()[0] ?? null;
156
+ }
91
157
  radios.forEach((radio) => {
92
158
  if (this.name) {
93
159
  radio.name = this.name;
94
160
  }
95
161
  radio.disabled = this.disabled;
96
- const radioValue = radio.value ?? radio.getAttribute('value') ?? '';
162
+ const radioValue = this.getRadioValue(radio);
97
163
  radio.checked = this.value !== '' && radioValue === this.value;
164
+ radio.tabbable = radio === tabbableRadio;
98
165
  });
99
166
  }
100
167
  };
@@ -9,7 +9,7 @@ export function radioGroupTemplate(c) {
9
9
  'ml-radio-group--error': !!c.error
10
10
  })}
11
11
  role="radiogroup"
12
- aria-labelledby=${c.label ? 'legend' : ''}
12
+ aria-labelledby=${c.label ? 'legend' : undefined}
13
13
  >
14
14
  ${when(!!c.label, () => html `
15
15
  <legend id="legend" class="ml-radio-group__legend">
@@ -1,5 +1,5 @@
1
1
  import type { IElementRef } from '@melodicdev/core';
2
- import type { Size } from '../../../types/index.js';
2
+ import type { ControlSize } from '../../../types/index.js';
3
3
  /**
4
4
  * ml-radio - Radio input component
5
5
  *
@@ -22,11 +22,16 @@ export declare class RadioComponent implements IElementRef {
22
22
  /** Hint text */
23
23
  hint: string;
24
24
  /** Radio size */
25
- size: Size;
25
+ size: ControlSize;
26
26
  /** Checked state */
27
27
  checked: boolean;
28
28
  /** Disabled state */
29
29
  disabled: boolean;
30
+ /**
31
+ * Whether the radio participates in the tab order (roving tabindex).
32
+ * Managed by ml-radio-group; standalone radios remain tabbable.
33
+ */
34
+ tabbable: boolean;
30
35
  handleChange: () => void;
31
36
  }
32
37
  //# sourceMappingURL=radio.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIpD;;;;;;;;;;GAUG;AACH,qBAMa,cAAe,YAAW,WAAW;IAC1C,UAAU,EAAG,WAAW,CAAC;IAEhC,uBAAuB;IAChB,IAAI,SAAM;IAEjB,kBAAkB;IACX,KAAK,SAAM;IAElB,kBAAkB;IACX,KAAK,SAAM;IAElB,gBAAgB;IACT,IAAI,SAAM;IAEjB,iBAAiB;IACV,IAAI,EAAE,IAAI,CAAQ;IAEzB,oBAAoB;IACb,OAAO,UAAS;IAEvB,qBAAqB;IACd,QAAQ,UAAS;IAEjB,YAAY,QAAO,IAAI,CAU5B;CACF"}
1
+ {"version":3,"file":"radio.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D;;;;;;;;;;GAUG;AACH,qBAMa,cAAe,YAAW,WAAW;IAC1C,UAAU,EAAG,WAAW,CAAC;IAEhC,uBAAuB;IAChB,IAAI,SAAM;IAEjB,kBAAkB;IACX,KAAK,SAAM;IAElB,kBAAkB;IACX,KAAK,SAAM;IAElB,gBAAgB;IACT,IAAI,SAAM;IAEjB,iBAAiB;IACV,IAAI,EAAE,WAAW,CAAQ;IAEhC,oBAAoB;IACb,OAAO,UAAS;IAEvB,qBAAqB;IACd,QAAQ,UAAS;IAExB;;;OAGG;IACI,QAAQ,UAAQ;IAEhB,YAAY,QAAO,IAAI,CAU5B;CACF"}
@@ -34,6 +34,11 @@ let RadioComponent = class RadioComponent {
34
34
  this.checked = false;
35
35
  /** Disabled state */
36
36
  this.disabled = false;
37
+ /**
38
+ * Whether the radio participates in the tab order (roving tabindex).
39
+ * Managed by ml-radio-group; standalone radios remain tabbable.
40
+ */
41
+ this.tabbable = true;
37
42
  this.handleChange = () => {
38
43
  this.checked = true;
39
44
  this.elementRef.dispatchEvent(new CustomEvent('ml:change', {
@@ -1 +1 @@
1
- {"version":3,"file":"radio.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,wBAAgB,aAAa,CAAC,CAAC,EAAE,cAAc,6CA0B9C"}
1
+ {"version":3,"file":"radio.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio/radio.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,wBAAgB,aAAa,CAAC,CAAC,EAAE,cAAc,6CA2B9C"}
@@ -14,6 +14,7 @@ export function radioTemplate(c) {
14
14
  class="ml-radio__input"
15
15
  name="${c.name}"
16
16
  value="${c.value}"
17
+ tabindex=${c.tabbable ? '0' : '-1'}
17
18
  .checked=${c.checked}
18
19
  ?disabled=${c.disabled}
19
20
  @change=${c.handleChange}
@@ -66,7 +66,8 @@ export declare class SelectComponent implements IElementRef, OnCreate, OnDestroy
66
66
  /** Bound event handlers for cleanup */
67
67
  private readonly _handleKeyDown;
68
68
  private readonly _handlePopoverToggle;
69
- private _handleScroll;
69
+ private readonly _uid;
70
+ private readonly _positioner;
70
71
  private _lastCloseTime;
71
72
  private _syncingValues;
72
73
  onCreate(): void;
@@ -80,6 +81,14 @@ export declare class SelectComponent implements IElementRef, OnCreate, OnDestroy
80
81
  get displayText(): string;
81
82
  get filteredOptions(): SelectOption[];
82
83
  get hasValue(): boolean;
84
+ /** Unique id of the label element (for aria-labelledby) */
85
+ get labelId(): string;
86
+ /** Unique id of the listbox element (for aria-controls) */
87
+ get listboxId(): string;
88
+ /** Unique id for the option at the given display index */
89
+ optionId: (index: number) => string;
90
+ /** Id of the keyboard-focused option, or undefined when none (omits the attribute) */
91
+ get activeDescendant(): string | undefined;
83
92
  /** Toggle dropdown open/close */
84
93
  toggle: () => void;
85
94
  /** Open the dropdown */
@@ -97,11 +106,9 @@ export declare class SelectComponent implements IElementRef, OnCreate, OnDestroy
97
106
  handleSearchClick: (event: Event) => void;
98
107
  /** Handle popover toggle events (open/close via Popover API) */
99
108
  private onPopoverToggle;
100
- /** Position the dropdown relative to the trigger using fixed positioning */
101
- private positionDropdown;
102
- /** Close dropdown when any ancestor scrolls */
103
- private addScrollListener;
104
- private removeScrollListener;
109
+ /** Keep the dropdown positioned while open (repositions on scroll/resize). */
110
+ private startPositioning;
111
+ private stopPositioning;
105
112
  private getDropdownEl;
106
113
  /** Handle keyboard navigation */
107
114
  private onKeyDown;
@@ -1 +1 @@
1
- {"version":3,"file":"select.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.component.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"select.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.component.ts"],"names":[],"mappings":"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"}
@@ -6,7 +6,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { MelodicComponent } from '@melodicdev/core';
8
8
  import { registerAdapter } from '@melodicdev/core/forms';
9
- import { computePosition, offset, flip, shift } from '../../../utils/positioning/index.js';
9
+ import { OverlayPositioner } from '../../../utils/overlay/index.js';
10
+ import { newID } from '../../../functions/index.js';
10
11
  import { selectTemplate } from './select.template.js';
11
12
  import { selectStyles } from './select.styles.js';
12
13
  registerAdapter((el) => el.tagName === 'ML-SELECT', {
@@ -90,19 +91,22 @@ let SelectComponent = class SelectComponent {
90
91
  /** Bound event handlers for cleanup */
91
92
  this._handleKeyDown = this.onKeyDown.bind(this);
92
93
  this._handlePopoverToggle = this.onPopoverToggle.bind(this);
93
- this._handleScroll = null;
94
+ this._uid = newID();
95
+ this._positioner = new OverlayPositioner(() => ({
96
+ placement: 'bottom-start',
97
+ offset: 4,
98
+ matchTriggerWidth: true
99
+ }));
94
100
  this._lastCloseTime = 0;
95
101
  this._syncingValues = false;
102
+ /** Unique id for the option at the given display index */
103
+ this.optionId = (index) => {
104
+ return `${this.listboxId}-option-${index}`;
105
+ };
96
106
  /** Toggle dropdown open/close */
97
107
  this.toggle = () => {
98
108
  if (this.disabled)
99
109
  return;
100
- if (this.multiple) {
101
- if (!this.isOpen) {
102
- this.open();
103
- }
104
- return;
105
- }
106
110
  if (this.isOpen) {
107
111
  this.close();
108
112
  }
@@ -177,7 +181,7 @@ let SelectComponent = class SelectComponent {
177
181
  }
178
182
  onDestroy() {
179
183
  this.elementRef.removeEventListener('keydown', this._handleKeyDown);
180
- this.removeScrollListener();
184
+ this.stopPositioning();
181
185
  this.getDropdownEl()?.removeEventListener('toggle', this._handlePopoverToggle);
182
186
  }
183
187
  onPropertyChange(name) {
@@ -260,6 +264,18 @@ let SelectComponent = class SelectComponent {
260
264
  get hasValue() {
261
265
  return this.multiple ? this.values.length > 0 : !!this.value;
262
266
  }
267
+ /** Unique id of the label element (for aria-labelledby) */
268
+ get labelId() {
269
+ return `ml-select-label-${this._uid}`;
270
+ }
271
+ /** Unique id of the listbox element (for aria-controls) */
272
+ get listboxId() {
273
+ return `ml-select-listbox-${this._uid}`;
274
+ }
275
+ /** Id of the keyboard-focused option, or undefined when none (omits the attribute) */
276
+ get activeDescendant() {
277
+ return this.isOpen && this.focusedIndex >= 0 ? this.optionId(this.focusedIndex) : undefined;
278
+ }
263
279
  /** Toggle a value in multi-select mode */
264
280
  toggleOption(option) {
265
281
  const exists = this.values.includes(option.value);
@@ -276,8 +292,7 @@ let SelectComponent = class SelectComponent {
276
292
  if (toggleEvent.newState === 'open') {
277
293
  this.isOpen = true;
278
294
  this.focusedIndex = this.getInitialFocusIndex();
279
- this.positionDropdown();
280
- this.addScrollListener();
295
+ this.startPositioning();
281
296
  this.elementRef.dispatchEvent(new CustomEvent('ml:open', { bubbles: true, composed: true }));
282
297
  }
283
298
  else {
@@ -285,39 +300,20 @@ let SelectComponent = class SelectComponent {
285
300
  this.focusedIndex = -1;
286
301
  this.search = '';
287
302
  this._lastCloseTime = Date.now();
288
- this.removeScrollListener();
303
+ this.stopPositioning();
289
304
  this.elementRef.dispatchEvent(new CustomEvent('ml:close', { bubbles: true, composed: true }));
290
305
  }
291
306
  }
292
- /** Position the dropdown relative to the trigger using fixed positioning */
293
- positionDropdown() {
307
+ /** Keep the dropdown positioned while open (repositions on scroll/resize). */
308
+ startPositioning() {
294
309
  const triggerEl = this.elementRef.shadowRoot?.querySelector('.ml-select__trigger');
295
310
  const dropdownEl = this.getDropdownEl();
296
311
  if (!triggerEl || !dropdownEl)
297
312
  return;
298
- dropdownEl.style.width = `${triggerEl.offsetWidth}px`;
299
- const { x, y } = computePosition(triggerEl, dropdownEl, {
300
- placement: 'bottom-start',
301
- middleware: [offset(4), flip(), shift({ padding: 8 })]
302
- });
303
- dropdownEl.style.left = `${x}px`;
304
- dropdownEl.style.top = `${y}px`;
313
+ this._positioner.start(triggerEl, dropdownEl);
305
314
  }
306
- /** Close dropdown when any ancestor scrolls */
307
- addScrollListener() {
308
- this._handleScroll = (event) => {
309
- const dropdownEl = this.getDropdownEl();
310
- if (dropdownEl?.contains(event.target))
311
- return;
312
- this.close();
313
- };
314
- window.addEventListener('scroll', this._handleScroll, true);
315
- }
316
- removeScrollListener() {
317
- if (this._handleScroll) {
318
- window.removeEventListener('scroll', this._handleScroll, true);
319
- this._handleScroll = null;
320
- }
315
+ stopPositioning() {
316
+ this._positioner.stop();
321
317
  }
322
318
  getDropdownEl() {
323
319
  return this.elementRef.shadowRoot?.querySelector('.ml-select__dropdown');