frontile 0.18.0-beta.2 → 0.18.0-beta.3

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 (518) hide show
  1. package/declarations/-private/control-blur.d.ts +1 -0
  2. package/declarations/-private/control-blur.d.ts.map +1 -0
  3. package/declarations/-private/deprecated-args.d.ts +1 -0
  4. package/declarations/-private/deprecated-args.d.ts.map +1 -0
  5. package/declarations/-private/dialog.d.ts +1 -0
  6. package/declarations/-private/dialog.d.ts.map +1 -0
  7. package/declarations/-private/dom.d.ts +1 -0
  8. package/declarations/-private/dom.d.ts.map +1 -0
  9. package/declarations/-private/get-config.d.ts +1 -0
  10. package/declarations/-private/get-config.d.ts.map +1 -0
  11. package/declarations/-private/icons.d.ts +23 -0
  12. package/declarations/-private/icons.d.ts.map +1 -0
  13. package/declarations/-private/manager.d.ts +1 -0
  14. package/declarations/-private/manager.d.ts.map +1 -0
  15. package/declarations/-private/notification-stack.d.ts +1 -0
  16. package/declarations/-private/notification-stack.d.ts.map +1 -0
  17. package/declarations/-private/notification.d.ts +1 -0
  18. package/declarations/-private/notification.d.ts.map +1 -0
  19. package/declarations/-private/timer.d.ts +1 -0
  20. package/declarations/-private/timer.d.ts.map +1 -0
  21. package/declarations/-private/types.d.ts +1 -0
  22. package/declarations/-private/types.d.ts.map +1 -0
  23. package/declarations/buttons.d.ts +1 -0
  24. package/declarations/buttons.d.ts.map +1 -0
  25. package/declarations/collections.d.ts +1 -0
  26. package/declarations/collections.d.ts.map +1 -0
  27. package/declarations/components/buttons/button-group.d.ts +1 -0
  28. package/declarations/components/buttons/button-group.d.ts.map +1 -0
  29. package/declarations/components/buttons/button.d.ts +1 -0
  30. package/declarations/components/buttons/button.d.ts.map +1 -0
  31. package/declarations/components/buttons/chip.d.ts +1 -0
  32. package/declarations/components/buttons/chip.d.ts.map +1 -0
  33. package/declarations/components/buttons/close-button.d.ts +1 -0
  34. package/declarations/components/buttons/close-button.d.ts.map +1 -0
  35. package/declarations/components/buttons/index.d.ts +1 -0
  36. package/declarations/components/buttons/index.d.ts.map +1 -0
  37. package/declarations/components/buttons/segmented-control/item.d.ts +1 -0
  38. package/declarations/components/buttons/segmented-control/item.d.ts.map +1 -0
  39. package/declarations/components/buttons/segmented-control/segmented-control.d.ts +12 -1
  40. package/declarations/components/buttons/segmented-control/segmented-control.d.ts.map +1 -0
  41. package/declarations/components/buttons/segmented-control.d.ts +1 -0
  42. package/declarations/components/buttons/segmented-control.d.ts.map +1 -0
  43. package/declarations/components/buttons/toggle-button.d.ts +1 -0
  44. package/declarations/components/buttons/toggle-button.d.ts.map +1 -0
  45. package/declarations/components/collections/calendar/calendar.d.ts +9 -12
  46. package/declarations/components/collections/calendar/calendar.d.ts.map +1 -0
  47. package/declarations/components/collections/calendar/day-cell.d.ts +1 -0
  48. package/declarations/components/collections/calendar/day-cell.d.ts.map +1 -0
  49. package/declarations/components/collections/calendar/header.d.ts +1 -0
  50. package/declarations/components/collections/calendar/header.d.ts.map +1 -0
  51. package/declarations/components/collections/calendar/month-grid.d.ts +1 -0
  52. package/declarations/components/collections/calendar/month-grid.d.ts.map +1 -0
  53. package/declarations/components/collections/calendar/types.d.ts +1 -0
  54. package/declarations/components/collections/calendar/types.d.ts.map +1 -0
  55. package/declarations/components/collections/calendar/utils.d.ts +1 -0
  56. package/declarations/components/collections/calendar/utils.d.ts.map +1 -0
  57. package/declarations/components/collections/calendar/year-grid.d.ts +1 -0
  58. package/declarations/components/collections/calendar/year-grid.d.ts.map +1 -0
  59. package/declarations/components/collections/calendar.d.ts +1 -0
  60. package/declarations/components/collections/calendar.d.ts.map +1 -0
  61. package/declarations/components/collections/command/command.d.ts +2 -11
  62. package/declarations/components/collections/command/command.d.ts.map +1 -0
  63. package/declarations/components/collections/command/dialog.d.ts +1 -0
  64. package/declarations/components/collections/command/dialog.d.ts.map +1 -0
  65. package/declarations/components/collections/command/footer.d.ts +1 -0
  66. package/declarations/components/collections/command/footer.d.ts.map +1 -0
  67. package/declarations/components/collections/command/index.d.ts +1 -0
  68. package/declarations/components/collections/command/index.d.ts.map +1 -0
  69. package/declarations/components/collections/command/input.d.ts +7 -1
  70. package/declarations/components/collections/command/input.d.ts.map +1 -0
  71. package/declarations/components/collections/command/list.d.ts +4 -0
  72. package/declarations/components/collections/command/list.d.ts.map +1 -0
  73. package/declarations/components/collections/command.d.ts +1 -0
  74. package/declarations/components/collections/command.d.ts.map +1 -0
  75. package/declarations/components/collections/dropdown/dropdown.d.ts +61 -2
  76. package/declarations/components/collections/dropdown/dropdown.d.ts.map +1 -0
  77. package/declarations/components/collections/dropdown/menu-context.d.ts +34 -7
  78. package/declarations/components/collections/dropdown/menu-context.d.ts.map +1 -0
  79. package/declarations/components/collections/dropdown/sub.d.ts +4 -8
  80. package/declarations/components/collections/dropdown/sub.d.ts.map +1 -0
  81. package/declarations/components/collections/dropdown.d.ts +1 -0
  82. package/declarations/components/collections/dropdown.d.ts.map +1 -0
  83. package/declarations/components/collections/index.d.ts +1 -0
  84. package/declarations/components/collections/index.d.ts.map +1 -0
  85. package/declarations/components/collections/listbox/group.d.ts +1 -0
  86. package/declarations/components/collections/listbox/group.d.ts.map +1 -0
  87. package/declarations/components/collections/listbox/item.d.ts +22 -1
  88. package/declarations/components/collections/listbox/item.d.ts.map +1 -0
  89. package/declarations/components/collections/listbox/listbox.d.ts +1 -0
  90. package/declarations/components/collections/listbox/listbox.d.ts.map +1 -0
  91. package/declarations/components/collections/listbox.d.ts +1 -0
  92. package/declarations/components/collections/listbox.d.ts.map +1 -0
  93. package/declarations/components/collections/simple-table/body.d.ts +50 -35
  94. package/declarations/components/collections/simple-table/body.d.ts.map +1 -0
  95. package/declarations/components/collections/simple-table/cell.d.ts +50 -35
  96. package/declarations/components/collections/simple-table/cell.d.ts.map +1 -0
  97. package/declarations/components/collections/simple-table/column.d.ts +50 -35
  98. package/declarations/components/collections/simple-table/column.d.ts.map +1 -0
  99. package/declarations/components/collections/simple-table/footer.d.ts +50 -35
  100. package/declarations/components/collections/simple-table/footer.d.ts.map +1 -0
  101. package/declarations/components/collections/simple-table/header.d.ts +50 -35
  102. package/declarations/components/collections/simple-table/header.d.ts.map +1 -0
  103. package/declarations/components/collections/simple-table/index.d.ts +50 -35
  104. package/declarations/components/collections/simple-table/index.d.ts.map +1 -0
  105. package/declarations/components/collections/simple-table/row.d.ts +50 -35
  106. package/declarations/components/collections/simple-table/row.d.ts.map +1 -0
  107. package/declarations/components/collections/table/cell-default.d.ts +1 -0
  108. package/declarations/components/collections/table/cell-default.d.ts.map +1 -0
  109. package/declarations/components/collections/table/cell-for.d.ts +1 -0
  110. package/declarations/components/collections/table/cell-for.d.ts.map +1 -0
  111. package/declarations/components/collections/table/cell-rendering-context.d.ts +1 -0
  112. package/declarations/components/collections/table/cell-rendering-context.d.ts.map +1 -0
  113. package/declarations/components/collections/table/checkbox.d.ts +6 -1
  114. package/declarations/components/collections/table/checkbox.d.ts.map +1 -0
  115. package/declarations/components/collections/table/column-visibility.d.ts +51 -36
  116. package/declarations/components/collections/table/column-visibility.d.ts.map +1 -0
  117. package/declarations/components/collections/table/index.d.ts +1 -0
  118. package/declarations/components/collections/table/index.d.ts.map +1 -0
  119. package/declarations/components/collections/table/sort-button.d.ts +50 -35
  120. package/declarations/components/collections/table/sort-button.d.ts.map +1 -0
  121. package/declarations/components/collections/table/table.d.ts +50 -35
  122. package/declarations/components/collections/table/table.d.ts.map +1 -0
  123. package/declarations/components/collections/table/types.d.ts +1 -0
  124. package/declarations/components/collections/table/types.d.ts.map +1 -0
  125. package/declarations/components/collections/table/utils.d.ts +1 -0
  126. package/declarations/components/collections/table/utils.d.ts.map +1 -0
  127. package/declarations/components/collections/table.d.ts +1 -0
  128. package/declarations/components/collections/table.d.ts.map +1 -0
  129. package/declarations/components/disclosure/accordion/accordion.d.ts +8 -1
  130. package/declarations/components/disclosure/accordion/accordion.d.ts.map +1 -0
  131. package/declarations/components/disclosure/accordion/item.d.ts +1 -0
  132. package/declarations/components/disclosure/accordion/item.d.ts.map +1 -0
  133. package/declarations/components/disclosure/accordion.d.ts +1 -0
  134. package/declarations/components/disclosure/accordion.d.ts.map +1 -0
  135. package/declarations/components/disclosure/index.d.ts +1 -0
  136. package/declarations/components/disclosure/index.d.ts.map +1 -0
  137. package/declarations/components/forms/autocomplete.d.ts +13 -23
  138. package/declarations/components/forms/autocomplete.d.ts.map +1 -0
  139. package/declarations/components/forms/checkbox-group.d.ts +8 -1
  140. package/declarations/components/forms/checkbox-group.d.ts.map +1 -0
  141. package/declarations/components/forms/checkbox.d.ts +6 -1
  142. package/declarations/components/forms/checkbox.d.ts.map +1 -0
  143. package/declarations/components/forms/date-picker/date-picker.d.ts +13 -23
  144. package/declarations/components/forms/date-picker/date-picker.d.ts.map +1 -0
  145. package/declarations/components/forms/date-picker/end-content.d.ts +1 -0
  146. package/declarations/components/forms/date-picker/end-content.d.ts.map +1 -0
  147. package/declarations/components/forms/date-picker/trigger.d.ts +1 -0
  148. package/declarations/components/forms/date-picker/trigger.d.ts.map +1 -0
  149. package/declarations/components/forms/date-picker/types.d.ts +1 -0
  150. package/declarations/components/forms/date-picker/types.d.ts.map +1 -0
  151. package/declarations/components/forms/date-picker/value.d.ts +1 -0
  152. package/declarations/components/forms/date-picker/value.d.ts.map +1 -0
  153. package/declarations/components/forms/date-picker.d.ts +1 -0
  154. package/declarations/components/forms/date-picker.d.ts.map +1 -0
  155. package/declarations/components/forms/field-types.d.ts +2 -1
  156. package/declarations/components/forms/field-types.d.ts.map +1 -0
  157. package/declarations/components/forms/field.d.ts +1 -0
  158. package/declarations/components/forms/field.d.ts.map +1 -0
  159. package/declarations/components/forms/form-control.d.ts +1 -0
  160. package/declarations/components/forms/form-control.d.ts.map +1 -0
  161. package/declarations/components/forms/form-description.d.ts +1 -0
  162. package/declarations/components/forms/form-description.d.ts.map +1 -0
  163. package/declarations/components/forms/form-feedback.d.ts +1 -0
  164. package/declarations/components/forms/form-feedback.d.ts.map +1 -0
  165. package/declarations/components/forms/form.d.ts +2 -11
  166. package/declarations/components/forms/form.d.ts.map +1 -0
  167. package/declarations/components/forms/index.d.ts +1 -0
  168. package/declarations/components/forms/index.d.ts.map +1 -0
  169. package/declarations/components/forms/input-otp.d.ts +10 -12
  170. package/declarations/components/forms/input-otp.d.ts.map +1 -0
  171. package/declarations/components/forms/input.d.ts +12 -12
  172. package/declarations/components/forms/input.d.ts.map +1 -0
  173. package/declarations/components/forms/label.d.ts +6 -1
  174. package/declarations/components/forms/label.d.ts.map +1 -0
  175. package/declarations/components/forms/native-select.d.ts +11 -1
  176. package/declarations/components/forms/native-select.d.ts.map +1 -0
  177. package/declarations/components/forms/radio-group.d.ts +8 -1
  178. package/declarations/components/forms/radio-group.d.ts.map +1 -0
  179. package/declarations/components/forms/radio.d.ts +6 -1
  180. package/declarations/components/forms/radio.d.ts.map +1 -0
  181. package/declarations/components/forms/select/end-content.d.ts +1 -0
  182. package/declarations/components/forms/select/end-content.d.ts.map +1 -0
  183. package/declarations/components/forms/select/native-mirror.d.ts +1 -0
  184. package/declarations/components/forms/select/native-mirror.d.ts.map +1 -0
  185. package/declarations/components/forms/select/select.d.ts +15 -34
  186. package/declarations/components/forms/select/select.d.ts.map +1 -0
  187. package/declarations/components/forms/select/selected-items.d.ts +1 -0
  188. package/declarations/components/forms/select/selected-items.d.ts.map +1 -0
  189. package/declarations/components/forms/select/trigger.d.ts +1 -0
  190. package/declarations/components/forms/select/trigger.d.ts.map +1 -0
  191. package/declarations/components/forms/select/types.d.ts +1 -0
  192. package/declarations/components/forms/select/types.d.ts.map +1 -0
  193. package/declarations/components/forms/select.d.ts +1 -0
  194. package/declarations/components/forms/select.d.ts.map +1 -0
  195. package/declarations/components/forms/switch.d.ts +8 -1
  196. package/declarations/components/forms/switch.d.ts.map +1 -0
  197. package/declarations/components/forms/textarea.d.ts +11 -1
  198. package/declarations/components/forms/textarea.d.ts.map +1 -0
  199. package/declarations/components/navigation/external-link.d.ts +2 -1
  200. package/declarations/components/navigation/external-link.d.ts.map +1 -0
  201. package/declarations/components/navigation/index.d.ts +1 -0
  202. package/declarations/components/navigation/index.d.ts.map +1 -0
  203. package/declarations/components/navigation/pagination/pagination.d.ts +8 -1
  204. package/declarations/components/navigation/pagination/pagination.d.ts.map +1 -0
  205. package/declarations/components/navigation/pagination/range.d.ts +1 -0
  206. package/declarations/components/navigation/pagination/range.d.ts.map +1 -0
  207. package/declarations/components/navigation/pagination.d.ts +1 -0
  208. package/declarations/components/navigation/pagination.d.ts.map +1 -0
  209. package/declarations/components/navigation/tab-nav/item.d.ts +1 -0
  210. package/declarations/components/navigation/tab-nav/item.d.ts.map +1 -0
  211. package/declarations/components/navigation/tab-nav/tab-nav.d.ts +11 -1
  212. package/declarations/components/navigation/tab-nav/tab-nav.d.ts.map +1 -0
  213. package/declarations/components/navigation/tab-nav.d.ts +1 -0
  214. package/declarations/components/navigation/tab-nav.d.ts.map +1 -0
  215. package/declarations/components/navigation/tabs/panel.d.ts +1 -0
  216. package/declarations/components/navigation/tabs/panel.d.ts.map +1 -0
  217. package/declarations/components/navigation/tabs/tab.d.ts +1 -0
  218. package/declarations/components/navigation/tabs/tab.d.ts.map +1 -0
  219. package/declarations/components/navigation/tabs/tabs.d.ts +11 -1
  220. package/declarations/components/navigation/tabs/tabs.d.ts.map +1 -0
  221. package/declarations/components/navigation/tabs.d.ts +1 -0
  222. package/declarations/components/navigation/tabs.d.ts.map +1 -0
  223. package/declarations/components/notifications/index.d.ts +1 -0
  224. package/declarations/components/notifications/index.d.ts.map +1 -0
  225. package/declarations/components/notifications/notification-card.d.ts +2 -3
  226. package/declarations/components/notifications/notification-card.d.ts.map +1 -0
  227. package/declarations/components/notifications/notifications-container.d.ts +1 -0
  228. package/declarations/components/notifications/notifications-container.d.ts.map +1 -0
  229. package/declarations/components/overlays/backdrop.d.ts +1 -0
  230. package/declarations/components/overlays/backdrop.d.ts.map +1 -0
  231. package/declarations/components/overlays/drawer/body.d.ts +1 -0
  232. package/declarations/components/overlays/drawer/body.d.ts.map +1 -0
  233. package/declarations/components/overlays/drawer/drag-handle.d.ts +1 -0
  234. package/declarations/components/overlays/drawer/drag-handle.d.ts.map +1 -0
  235. package/declarations/components/overlays/drawer/footer.d.ts +1 -0
  236. package/declarations/components/overlays/drawer/footer.d.ts.map +1 -0
  237. package/declarations/components/overlays/drawer/header.d.ts +1 -0
  238. package/declarations/components/overlays/drawer/header.d.ts.map +1 -0
  239. package/declarations/components/overlays/drawer/selectors.d.ts +1 -0
  240. package/declarations/components/overlays/drawer/selectors.d.ts.map +1 -0
  241. package/declarations/components/overlays/drawer.d.ts +62 -54
  242. package/declarations/components/overlays/drawer.d.ts.map +1 -0
  243. package/declarations/components/overlays/index.d.ts +1 -0
  244. package/declarations/components/overlays/index.d.ts.map +1 -0
  245. package/declarations/components/overlays/modal/body.d.ts +1 -0
  246. package/declarations/components/overlays/modal/body.d.ts.map +1 -0
  247. package/declarations/components/overlays/modal/footer.d.ts +1 -0
  248. package/declarations/components/overlays/modal/footer.d.ts.map +1 -0
  249. package/declarations/components/overlays/modal/header.d.ts +1 -0
  250. package/declarations/components/overlays/modal/header.d.ts.map +1 -0
  251. package/declarations/components/overlays/modal.d.ts +18 -12
  252. package/declarations/components/overlays/modal.d.ts.map +1 -0
  253. package/declarations/components/overlays/mount-animation.d.ts +1 -0
  254. package/declarations/components/overlays/mount-animation.d.ts.map +1 -0
  255. package/declarations/components/overlays/overlay.d.ts +14 -0
  256. package/declarations/components/overlays/overlay.d.ts.map +1 -0
  257. package/declarations/components/overlays/popover.d.ts +1 -0
  258. package/declarations/components/overlays/popover.d.ts.map +1 -0
  259. package/declarations/components/overlays/portal-target.d.ts +1 -0
  260. package/declarations/components/overlays/portal-target.d.ts.map +1 -0
  261. package/declarations/components/overlays/portal.d.ts +1 -0
  262. package/declarations/components/overlays/portal.d.ts.map +1 -0
  263. package/declarations/components/overlays/tooltip.d.ts +1 -0
  264. package/declarations/components/overlays/tooltip.d.ts.map +1 -0
  265. package/declarations/components/status/alert.d.ts +2 -3
  266. package/declarations/components/status/alert.d.ts.map +1 -0
  267. package/declarations/components/status/index.d.ts +1 -0
  268. package/declarations/components/status/index.d.ts.map +1 -0
  269. package/declarations/components/status/progress-bar.d.ts +1 -0
  270. package/declarations/components/status/progress-bar.d.ts.map +1 -0
  271. package/declarations/components/utilities/avatar.d.ts +13 -7
  272. package/declarations/components/utilities/avatar.d.ts.map +1 -0
  273. package/declarations/components/utilities/collapsible.d.ts +1 -0
  274. package/declarations/components/utilities/collapsible.d.ts.map +1 -0
  275. package/declarations/components/utilities/divider.d.ts +12 -0
  276. package/declarations/components/utilities/divider.d.ts.map +1 -0
  277. package/declarations/components/utilities/index.d.ts +1 -0
  278. package/declarations/components/utilities/index.d.ts.map +1 -0
  279. package/declarations/components/utilities/kbd.d.ts +1 -0
  280. package/declarations/components/utilities/kbd.d.ts.map +1 -0
  281. package/declarations/components/utilities/skeleton.d.ts +1 -0
  282. package/declarations/components/utilities/skeleton.d.ts.map +1 -0
  283. package/declarations/components/utilities/spinner.d.ts +1 -0
  284. package/declarations/components/utilities/spinner.d.ts.map +1 -0
  285. package/declarations/components/utilities/visually-hidden.d.ts +1 -0
  286. package/declarations/components/utilities/visually-hidden.d.ts.map +1 -0
  287. package/declarations/disclosure.d.ts +1 -0
  288. package/declarations/disclosure.d.ts.map +1 -0
  289. package/declarations/forms.d.ts +1 -0
  290. package/declarations/forms.d.ts.map +1 -0
  291. package/declarations/index.d.ts +1 -0
  292. package/declarations/index.d.ts.map +1 -0
  293. package/declarations/modifiers/drag-to-dismiss.d.ts +1 -0
  294. package/declarations/modifiers/drag-to-dismiss.d.ts.map +1 -0
  295. package/declarations/modifiers/press.d.ts +1 -0
  296. package/declarations/modifiers/press.d.ts.map +1 -0
  297. package/declarations/navigation.d.ts +1 -0
  298. package/declarations/navigation.d.ts.map +1 -0
  299. package/declarations/notifications.d.ts +1 -0
  300. package/declarations/notifications.d.ts.map +1 -0
  301. package/declarations/overlays.d.ts +1 -0
  302. package/declarations/overlays.d.ts.map +1 -0
  303. package/declarations/services/notifications.d.ts +1 -0
  304. package/declarations/services/notifications.d.ts.map +1 -0
  305. package/declarations/status.d.ts +1 -0
  306. package/declarations/status.d.ts.map +1 -0
  307. package/declarations/test-support.d.ts +1 -0
  308. package/declarations/test-support.d.ts.map +1 -0
  309. package/declarations/utilities.d.ts +1 -0
  310. package/declarations/utilities.d.ts.map +1 -0
  311. package/declarations/utils/deferred-work.d.ts +1 -0
  312. package/declarations/utils/deferred-work.d.ts.map +1 -0
  313. package/declarations/utils/filter.d.ts +1 -0
  314. package/declarations/utils/filter.d.ts.map +1 -0
  315. package/declarations/utils/forms-utils-index.d.ts +1 -0
  316. package/declarations/utils/forms-utils-index.d.ts.map +1 -0
  317. package/declarations/utils/keys.d.ts +1 -0
  318. package/declarations/utils/keys.d.ts.map +1 -0
  319. package/declarations/utils/listManager.d.ts +22 -0
  320. package/declarations/utils/listManager.d.ts.map +1 -0
  321. package/declarations/utils/nested-data.d.ts +1 -0
  322. package/declarations/utils/nested-data.d.ts.map +1 -0
  323. package/declarations/utils/prefers-reduced-motion.d.ts +1 -0
  324. package/declarations/utils/prefers-reduced-motion.d.ts.map +1 -0
  325. package/declarations/utils/ref.d.ts +2 -1
  326. package/declarations/utils/ref.d.ts.map +1 -0
  327. package/declarations/utils/roving-focus.d.ts +1 -0
  328. package/declarations/utils/roving-focus.d.ts.map +1 -0
  329. package/declarations/utils/safe-area.d.ts +1 -0
  330. package/declarations/utils/safe-area.d.ts.map +1 -0
  331. package/declarations/utils/safe-styles.d.ts +1 -0
  332. package/declarations/utils/safe-styles.d.ts.map +1 -0
  333. package/declarations/utils/selection-indicator.d.ts +1 -0
  334. package/declarations/utils/selection-indicator.d.ts.map +1 -0
  335. package/declarations/utils/standard-validator.d.ts +1 -0
  336. package/declarations/utils/standard-validator.d.ts.map +1 -0
  337. package/declarations/utils/toggle.d.ts +1 -0
  338. package/declarations/utils/toggle.d.ts.map +1 -0
  339. package/dist/components/buttons/button-group.js.map +1 -1
  340. package/dist/components/buttons/button.js.map +1 -1
  341. package/dist/components/buttons/chip.js.map +1 -1
  342. package/dist/components/buttons/close-button.js +1 -1
  343. package/dist/components/buttons/close-button.js.map +1 -1
  344. package/dist/components/buttons/segmented-control/item.js.map +1 -1
  345. package/dist/components/buttons/segmented-control/segmented-control.js.map +1 -1
  346. package/dist/components/buttons/toggle-button.js.map +1 -1
  347. package/dist/components/collections/calendar/calendar.js.map +1 -1
  348. package/dist/components/collections/calendar/day-cell.js.map +1 -1
  349. package/dist/components/collections/calendar/header.js +1 -2
  350. package/dist/components/collections/calendar/header.js.map +1 -1
  351. package/dist/components/collections/calendar/month-grid.js.map +1 -1
  352. package/dist/components/collections/calendar/utils.js.map +1 -1
  353. package/dist/components/collections/calendar/year-grid.js.map +1 -1
  354. package/dist/components/collections/command/command.js.map +1 -1
  355. package/dist/components/collections/command/dialog.js +0 -1
  356. package/dist/components/collections/command/dialog.js.map +1 -1
  357. package/dist/components/collections/command/footer.js.map +1 -1
  358. package/dist/components/collections/command/input.js.map +1 -1
  359. package/dist/components/collections/command/list.js.map +1 -1
  360. package/dist/components/collections/dropdown/dropdown.js +72 -7
  361. package/dist/components/collections/dropdown/dropdown.js.map +1 -1
  362. package/dist/components/collections/dropdown/menu-context.js +52 -1
  363. package/dist/components/collections/dropdown/menu-context.js.map +1 -1
  364. package/dist/components/collections/dropdown/sub.js +2 -9
  365. package/dist/components/collections/dropdown/sub.js.map +1 -1
  366. package/dist/components/collections/listbox/group.js.map +1 -1
  367. package/dist/components/collections/listbox/item.js +32 -6
  368. package/dist/components/collections/listbox/item.js.map +1 -1
  369. package/dist/components/collections/listbox/listbox.js.map +1 -1
  370. package/dist/components/collections/simple-table/body.js.map +1 -1
  371. package/dist/components/collections/simple-table/cell.js.map +1 -1
  372. package/dist/components/collections/simple-table/column.js.map +1 -1
  373. package/dist/components/collections/simple-table/footer.js.map +1 -1
  374. package/dist/components/collections/simple-table/header.js.map +1 -1
  375. package/dist/components/collections/simple-table/index.js.map +1 -1
  376. package/dist/components/collections/simple-table/row.js.map +1 -1
  377. package/dist/components/collections/table/cell-default.js.map +1 -1
  378. package/dist/components/collections/table/cell-for.js.map +1 -1
  379. package/dist/components/collections/table/cell-rendering-context.js.map +1 -1
  380. package/dist/components/collections/table/checkbox.js.map +1 -1
  381. package/dist/components/collections/table/column-visibility.js +1 -1
  382. package/dist/components/collections/table/column-visibility.js.map +1 -1
  383. package/dist/components/collections/table/sort-button.js +1 -1
  384. package/dist/components/collections/table/sort-button.js.map +1 -1
  385. package/dist/components/collections/table/table.js +1 -2
  386. package/dist/components/collections/table/table.js.map +1 -1
  387. package/dist/components/collections/table/utils.js.map +1 -1
  388. package/dist/components/disclosure/accordion/accordion.js.map +1 -1
  389. package/dist/components/disclosure/accordion/item.js +1 -1
  390. package/dist/components/disclosure/accordion/item.js.map +1 -1
  391. package/dist/components/forms/autocomplete.js +1 -1
  392. package/dist/components/forms/autocomplete.js.map +1 -1
  393. package/dist/components/forms/checkbox-group.js.map +1 -1
  394. package/dist/components/forms/checkbox.js.map +1 -1
  395. package/dist/components/forms/date-picker/date-picker.js.map +1 -1
  396. package/dist/components/forms/date-picker/end-content.js +1 -1
  397. package/dist/components/forms/date-picker/end-content.js.map +1 -1
  398. package/dist/components/forms/date-picker/trigger.js.map +1 -1
  399. package/dist/components/forms/date-picker/value.js.map +1 -1
  400. package/dist/components/forms/field.js.map +1 -1
  401. package/dist/components/forms/form-control.js.map +1 -1
  402. package/dist/components/forms/form-description.js.map +1 -1
  403. package/dist/components/forms/form-feedback.js.map +1 -1
  404. package/dist/components/forms/form.js.map +1 -1
  405. package/dist/components/forms/input-otp.js.map +1 -1
  406. package/dist/components/forms/input.js.map +1 -1
  407. package/dist/components/forms/label.js.map +1 -1
  408. package/dist/components/forms/native-select.js +2 -2
  409. package/dist/components/forms/native-select.js.map +1 -1
  410. package/dist/components/forms/radio-group.js.map +1 -1
  411. package/dist/components/forms/radio.js.map +1 -1
  412. package/dist/components/forms/select/end-content.js +1 -1
  413. package/dist/components/forms/select/end-content.js.map +1 -1
  414. package/dist/components/forms/select/native-mirror.js.map +1 -1
  415. package/dist/components/forms/select/select.js.map +1 -1
  416. package/dist/components/forms/select/selected-items.js.map +1 -1
  417. package/dist/components/forms/select/trigger.js.map +1 -1
  418. package/dist/components/forms/switch.js.map +1 -1
  419. package/dist/components/forms/textarea.js.map +1 -1
  420. package/dist/components/navigation/external-link.js.map +1 -1
  421. package/dist/components/navigation/pagination/pagination.js +1 -1
  422. package/dist/components/navigation/pagination/pagination.js.map +1 -1
  423. package/dist/components/navigation/pagination/range.js.map +1 -1
  424. package/dist/components/navigation/tab-nav/item.js.map +1 -1
  425. package/dist/components/navigation/tab-nav/tab-nav.js.map +1 -1
  426. package/dist/components/navigation/tabs/panel.js.map +1 -1
  427. package/dist/components/navigation/tabs/tab.js.map +1 -1
  428. package/dist/components/navigation/tabs/tabs.js.map +1 -1
  429. package/dist/components/notifications/index.js +2 -2
  430. package/dist/components/notifications/notification-card.js +2 -2
  431. package/dist/components/notifications/notifications-container.js +1 -1
  432. package/dist/components/notifications/notifications-container.js.map +1 -1
  433. package/dist/components/overlays/backdrop.js +1 -1
  434. package/dist/components/overlays/backdrop.js.map +1 -1
  435. package/dist/components/overlays/drawer/body.js.map +1 -1
  436. package/dist/components/overlays/drawer/drag-handle.js.map +1 -1
  437. package/dist/components/overlays/drawer/footer.js.map +1 -1
  438. package/dist/components/overlays/drawer/header.js.map +1 -1
  439. package/dist/components/overlays/drawer/selectors.js.map +1 -1
  440. package/dist/components/overlays/drawer.js +1 -1
  441. package/dist/components/overlays/drawer.js.map +1 -1
  442. package/dist/components/overlays/modal/body.js.map +1 -1
  443. package/dist/components/overlays/modal/footer.js.map +1 -1
  444. package/dist/components/overlays/modal/header.js.map +1 -1
  445. package/dist/components/overlays/modal.js +1 -1
  446. package/dist/components/overlays/modal.js.map +1 -1
  447. package/dist/components/overlays/mount-animation.js.map +1 -1
  448. package/dist/components/overlays/overlay.js +52 -3
  449. package/dist/components/overlays/overlay.js.map +1 -1
  450. package/dist/components/overlays/popover.js +2 -2
  451. package/dist/components/overlays/popover.js.map +1 -1
  452. package/dist/components/overlays/portal-target.js.map +1 -1
  453. package/dist/components/overlays/portal.js.map +1 -1
  454. package/dist/components/overlays/tooltip.js.map +1 -1
  455. package/dist/components/status/alert.js +11 -6
  456. package/dist/components/status/alert.js.map +1 -1
  457. package/dist/components/status/progress-bar.js.map +1 -1
  458. package/dist/components/utilities/avatar.js.map +1 -1
  459. package/dist/components/utilities/collapsible.js.map +1 -1
  460. package/dist/components/utilities/divider.js +1 -1
  461. package/dist/components/utilities/divider.js.map +1 -1
  462. package/dist/components/utilities/index.js +1 -1
  463. package/dist/components/utilities/kbd.js.map +1 -1
  464. package/dist/components/utilities/skeleton.js.map +1 -1
  465. package/dist/components/utilities/spinner.js.map +1 -1
  466. package/dist/components/utilities/visually-hidden.js.map +1 -1
  467. package/dist/control-blur-C8OnSQR5.js.map +1 -1
  468. package/dist/deprecated-args-BIUjLA8y.js.map +1 -1
  469. package/dist/dialog-CreV7aPQ.js.map +1 -1
  470. package/dist/dom-cKWVvtkd.js.map +1 -1
  471. package/dist/icons-DZ61nCzv.js +51 -0
  472. package/dist/icons-DZ61nCzv.js.map +1 -0
  473. package/dist/index.js +3 -3
  474. package/dist/{manager-B-PnYqDs.js → manager-jDaRVZ5o.js} +1 -3
  475. package/dist/manager-jDaRVZ5o.js.map +1 -0
  476. package/dist/modifiers/drag-to-dismiss.js.map +1 -1
  477. package/dist/modifiers/press.js.map +1 -1
  478. package/dist/{notification-card-CYmWQ35W.js → notification-card-dz-eE6z9.js} +2 -2
  479. package/dist/notification-card-dz-eE6z9.js.map +1 -0
  480. package/dist/notifications.js +2 -2
  481. package/dist/runtime--fcdnjmJ-BOdRhmsS.js.map +1 -1
  482. package/dist/services/notifications.js +1 -1
  483. package/dist/services/notifications.js.map +1 -1
  484. package/dist/test-support.js.map +1 -1
  485. package/dist/utilities.js +1 -1
  486. package/dist/utils/deferred-work.js.map +1 -1
  487. package/dist/utils/filter.js.map +1 -1
  488. package/dist/utils/forms-utils-index.js.map +1 -1
  489. package/dist/utils/keys.js.map +1 -1
  490. package/dist/utils/listManager.js +34 -4
  491. package/dist/utils/listManager.js.map +1 -1
  492. package/dist/utils/nested-data.js.map +1 -1
  493. package/dist/utils/prefers-reduced-motion.js.map +1 -1
  494. package/dist/utils/ref.js +1 -1
  495. package/dist/utils/ref.js.map +1 -1
  496. package/dist/utils/roving-focus.js.map +1 -1
  497. package/dist/utils/safe-area.js.map +1 -1
  498. package/dist/utils/safe-styles.js.map +1 -1
  499. package/dist/utils/selection-indicator.js.map +1 -1
  500. package/dist/utils/standard-validator.js.map +1 -1
  501. package/dist/utils/toggle.js.map +1 -1
  502. package/package.json +23 -24
  503. package/dist/components/collections/calendar/icons.js +0 -23
  504. package/dist/components/collections/calendar/icons.js.map +0 -1
  505. package/dist/components/collections/table/icons.js +0 -19
  506. package/dist/components/collections/table/icons.js.map +0 -1
  507. package/dist/components/disclosure/icons.js +0 -13
  508. package/dist/components/disclosure/icons.js.map +0 -1
  509. package/dist/components/forms/icons.js +0 -16
  510. package/dist/components/forms/icons.js.map +0 -1
  511. package/dist/components/navigation/pagination/icons.js +0 -23
  512. package/dist/components/navigation/pagination/icons.js.map +0 -1
  513. package/dist/intent-icons-DpEViO8C.js +0 -19
  514. package/dist/intent-icons-DpEViO8C.js.map +0 -1
  515. package/dist/manager-B-PnYqDs.js.map +0 -1
  516. package/dist/notification-card-CYmWQ35W.js.map +0 -1
  517. package/dist/template-registry.js +0 -2
  518. package/dist/template-registry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","sources":["../../../src/components/forms/field.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { action, get } from '@ember/object';\nimport { debounce } from '@ember/runloop';\nimport Checkbox from './checkbox';\nimport CheckboxGroup from './checkbox-group';\nimport DatePicker from './date-picker';\nimport Input from './input';\nimport InputOtp from './input-otp';\nimport Radio from './radio';\nimport RadioGroup from './radio-group';\nimport Select from './select';\nimport Switch from './switch';\nimport Textarea from './textarea';\n\nimport type { WithBoundArgs } from '@glint/template';\nimport type { FormDataCompiled, FormErrors } from './form';\nimport type { DatePickerSignature } from './date-picker';\nimport type { SelectSignature } from './select';\nimport type { WithBoundArgsForSignature } from './field-types';\n\ntype BoundSingleSelect<S = unknown> = WithBoundArgsForSignature<\n SelectSignature<S>,\n 'name' | 'errors' | 'selectedKey' | 'onBlur' | 'isDisabled'\n>;\n\ntype BoundMultiSelect<S = unknown> = WithBoundArgsForSignature<\n SelectSignature<S>,\n 'selectionMode' | 'name' | 'errors' | 'selectedKeys' | 'onBlur' | 'isDisabled'\n>;\n\ntype BoundDatePicker = WithBoundArgsForSignature<\n DatePickerSignature<'single'>,\n 'name' | 'errors' | 'value' | 'onBlur' | 'isDisabled'\n>;\n\ntype BoundDateRangePicker = WithBoundArgsForSignature<\n DatePickerSignature<'range'>,\n 'mode' | 'name' | 'errors' | 'value' | 'onBlur' | 'isDisabled'\n>;\n\ninterface FieldSignature<T extends Record<string, unknown> = FormDataCompiled> {\n Element: HTMLElement;\n Args: {\n /** The name of the form field. */\n name: string;\n /** The validation errors for the form, keyed by field name. */\n errors?: FormErrors;\n /** The form data as key/value pairs. */\n formData?: T;\n /** Whether the field should be disabled. */\n disabled?: boolean;\n /** When to run validation. */\n validateOn?: ('change' | 'input' | 'blur')[];\n /** Function to validate a single field by name. */\n validateField?: (data: T, name: string) => Promise<FormErrors | undefined>;\n };\n Blocks: {\n default: [\n {\n Checkbox: WithBoundArgs<\n typeof Checkbox,\n 'name' | 'errors' | 'checked' | 'onChange' | 'onBlur' | 'isDisabled'\n >;\n CheckboxGroup: WithBoundArgs<\n typeof CheckboxGroup,\n 'name' | 'errors' | 'isDisabled'\n >;\n Input: WithBoundArgs<\n typeof Input,\n | 'name'\n | 'errors'\n | 'value'\n | 'onChange'\n | 'onInput'\n | 'onBlur'\n | 'isDisabled'\n >;\n InputOtp: WithBoundArgs<\n typeof InputOtp,\n | 'name'\n | 'errors'\n | 'value'\n | 'onChange'\n | 'onInput'\n | 'onBlur'\n | 'isDisabled'\n >;\n Radio: WithBoundArgs<\n typeof Radio,\n | 'name'\n | 'errors'\n | 'checkedValue'\n | 'onChange'\n | 'onBlur'\n | 'isDisabled'\n >;\n RadioGroup: WithBoundArgs<\n typeof RadioGroup,\n 'name' | 'errors' | 'value' | 'onChange' | 'isDisabled'\n >;\n SingleSelect: BoundSingleSelect;\n MultiSelect: BoundMultiSelect;\n DatePicker: BoundDatePicker;\n DateRangePicker: BoundDateRangePicker;\n Switch: WithBoundArgs<\n typeof Switch,\n | 'name'\n | 'errors'\n | 'isSelected'\n | 'onChange'\n | 'onBlur'\n | 'isDisabled'\n >;\n Textarea: WithBoundArgs<\n typeof Textarea,\n | 'name'\n | 'errors'\n | 'value'\n | 'onChange'\n | 'onInput'\n | 'onBlur'\n | 'isDisabled'\n >;\n }\n ];\n };\n}\n\n/**\n * Field is a component wrapper that provides conveniences for form fields.\n * It automatically binds the appropriate form errors by name to yielded\n * components.\n */\nclass Field<\n T extends Record<string, unknown> = FormDataCompiled\n> extends Component<FieldSignature<T>> {\n /**\n * Returns the validation errors for the field.\n * Supports dotted field names (e.g., 'profile.email').\n */\n get fieldErrors() {\n return this.args.errors?.[this.args.name];\n }\n\n /** The events on which validation should run. Defaults to ['change']. */\n get validateOn(): ('change' | 'input' | 'blur')[] {\n return this.args.validateOn ?? ['change'];\n }\n\n /**\n * Returns the current value for the field from formData.\n * Supports both flat and dotted field names (e.g., 'email' or 'profile.email').\n * Uses Ember's get() which handles both flat keys and dotted paths.\n */\n get fieldValue() {\n if (!this.args.formData) return undefined;\n\n // Ember's get() handles both flat keys and dotted paths correctly\n return get(this.args.formData, this.args.name);\n }\n\n /**\n * Validates the field by calling the validateField function passed in args.\n */\n validateField() {\n this.args.validateField?.(this.args.formData as T, this.args.name);\n }\n\n /**\n * Validates the field on change if change validation is enabled.\n */\n @action\n handleChange() {\n if (this.validateOn?.includes('change')) {\n this.validateField();\n }\n }\n\n /**\n * Validates the field on input if input validation is enabled.\n * Debounces validation to avoid excessive validation calls on every keystroke.\n */\n @action\n handleInput() {\n if (this.validateOn?.includes('input')) {\n debounce(this, this.validateField, 300);\n }\n }\n\n /**\n * Validates the field on blur if blur validation is enabled.\n */\n @action\n handleBlur() {\n if (this.validateOn.includes('blur')) {\n this.validateField();\n }\n }\n\n <template>\n {{! @glint-nocheck component generics (radio, radio-group, select) trigger: type instantiation is excessively deep and possibly infinite }}\n {{yield\n (hash\n Checkbox=(component\n Checkbox\n name=@name\n errors=this.fieldErrors\n checked=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onBlur=this.handleBlur\n )\n CheckboxGroup=(component\n CheckboxGroup name=@name errors=this.fieldErrors isDisabled=@disabled\n )\n Input=(component\n Input\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onInput=this.handleInput\n onBlur=this.handleBlur\n )\n InputOtp=(component\n InputOtp\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onInput=this.handleInput\n onBlur=this.handleBlur\n )\n Radio=(component\n Radio\n name=@name\n errors=this.fieldErrors\n checkedValue=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onBlur=this.handleBlur\n )\n RadioGroup=(component\n RadioGroup\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n )\n SingleSelect=(component\n Select\n name=@name\n errors=this.fieldErrors\n selectedKey=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n MultiSelect=(component\n Select\n selectionMode=\"multiple\"\n name=@name\n errors=this.fieldErrors\n selectedKeys=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n DatePicker=(component\n DatePicker\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n DateRangePicker=(component\n DatePicker\n mode=\"range\"\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n Switch=(component\n Switch\n name=@name\n errors=this.fieldErrors\n isSelected=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onBlur=this.handleBlur\n )\n Textarea=(component\n Textarea\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onInput=this.handleInput\n onBlur=this.handleBlur\n )\n )\n to=\"default\"\n }}\n </template>\n}\n\nexport { Field, type FieldSignature };\nexport default Field;\n"],"names":["Field","Component","fieldErrors","args","errors","name","validateOn","fieldValue","formData","undefined","get","validateField","handleChange","includes","n","prototype","action","handleInput","debounce","handleBlur","setComponentTemplate","precompileTemplate","strictMode","scope","hash","Checkbox","CheckboxGroup","Input","InputOtp","Radio","RadioGroup","Select","DatePicker","Switch","Textarea"],"mappings":";;;;;;;;;;;;;;;;;;AAiIA;;;;;AAKA,MAAMA,KAAA,SAEIC,SAAA,CAAyB;AACjC;;;AAGC;EACD,IAAIC,WAAAA,GAAc;IAChB,OAAO,IAAI,CAACC,IAAI,CAACC,MAAM,GAAG,IAAI,CAACD,IAAI,CAACE,IAAI,CAAC;AAC3C,EAAA;AAEA;EACA,IAAIC,UAAAA,GAA8C;IAChD,OAAO,IAAI,CAACH,IAAI,CAACG,UAAU,IAAI,CAAC,QAAA,CAAS;AAC3C,EAAA;AAEA;;;;AAIC;EACD,IAAIC,UAAAA,GAAa;IACf,IAAI,CAAC,IAAI,CAACJ,IAAI,CAACK,QAAQ,EAAE,OAAOC,SAAA;AAEhC;AACA,IAAA,OAAOC,GAAA,CAAI,IAAI,CAACP,IAAI,CAACK,QAAQ,EAAE,IAAI,CAACL,IAAI,CAACE,IAAI,CAAA;AAC/C,EAAA;AAEA;;AAEC;AACDM,EAAAA,aAA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A;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"field.js","sources":["../../../src/components/forms/field.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { action, get } from '@ember/object';\nimport { debounce } from '@ember/runloop';\nimport Checkbox from './checkbox';\nimport CheckboxGroup from './checkbox-group';\nimport DatePicker from './date-picker';\nimport Input from './input';\nimport InputOtp from './input-otp';\nimport Radio from './radio';\nimport RadioGroup from './radio-group';\nimport Select from './select';\nimport Switch from './switch';\nimport Textarea from './textarea';\n\nimport type { WithBoundArgs } from '@glint/template';\nimport type { FormDataCompiled, FormErrors } from './form';\nimport type { DatePickerSignature } from './date-picker';\nimport type { SelectSignature } from './select';\nimport type { WithBoundArgsForSignature } from './field-types';\n\ntype BoundSingleSelect<S = unknown> = WithBoundArgsForSignature<\n SelectSignature<S>,\n 'name' | 'errors' | 'selectedKey' | 'onBlur' | 'isDisabled'\n>;\n\ntype BoundMultiSelect<S = unknown> = WithBoundArgsForSignature<\n SelectSignature<S>,\n 'selectionMode' | 'name' | 'errors' | 'selectedKeys' | 'onBlur' | 'isDisabled'\n>;\n\ntype BoundDatePicker = WithBoundArgsForSignature<\n DatePickerSignature<'single'>,\n 'name' | 'errors' | 'value' | 'onBlur' | 'isDisabled'\n>;\n\ntype BoundDateRangePicker = WithBoundArgsForSignature<\n DatePickerSignature<'range'>,\n 'mode' | 'name' | 'errors' | 'value' | 'onBlur' | 'isDisabled'\n>;\n\ninterface FieldSignature<T extends Record<string, unknown> = FormDataCompiled> {\n Element: HTMLElement;\n Args: {\n /** The name of the form field. */\n name: string;\n /** The validation errors for the form, keyed by field name. */\n errors?: FormErrors;\n /** The form data as key/value pairs. */\n formData?: T;\n /** Whether the field should be disabled. */\n disabled?: boolean;\n /** When to run validation. */\n validateOn?: ('change' | 'input' | 'blur')[];\n /** Function to validate a single field by name. */\n validateField?: (data: T, name: string) => Promise<FormErrors | undefined>;\n };\n Blocks: {\n default: [\n {\n Checkbox: WithBoundArgs<\n typeof Checkbox,\n 'name' | 'errors' | 'checked' | 'onChange' | 'onBlur' | 'isDisabled'\n >;\n CheckboxGroup: WithBoundArgs<\n typeof CheckboxGroup,\n 'name' | 'errors' | 'isDisabled'\n >;\n Input: WithBoundArgs<\n typeof Input,\n | 'name'\n | 'errors'\n | 'value'\n | 'onChange'\n | 'onInput'\n | 'onBlur'\n | 'isDisabled'\n >;\n InputOtp: WithBoundArgs<\n typeof InputOtp,\n | 'name'\n | 'errors'\n | 'value'\n | 'onChange'\n | 'onInput'\n | 'onBlur'\n | 'isDisabled'\n >;\n Radio: WithBoundArgs<\n typeof Radio,\n | 'name'\n | 'errors'\n | 'checkedValue'\n | 'onChange'\n | 'onBlur'\n | 'isDisabled'\n >;\n RadioGroup: WithBoundArgs<\n typeof RadioGroup,\n 'name' | 'errors' | 'value' | 'onChange' | 'isDisabled'\n >;\n SingleSelect: BoundSingleSelect;\n MultiSelect: BoundMultiSelect;\n DatePicker: BoundDatePicker;\n DateRangePicker: BoundDateRangePicker;\n Switch: WithBoundArgs<\n typeof Switch,\n | 'name'\n | 'errors'\n | 'isSelected'\n | 'onChange'\n | 'onBlur'\n | 'isDisabled'\n >;\n Textarea: WithBoundArgs<\n typeof Textarea,\n | 'name'\n | 'errors'\n | 'value'\n | 'onChange'\n | 'onInput'\n | 'onBlur'\n | 'isDisabled'\n >;\n }\n ];\n };\n}\n\n/**\n * Field is a component wrapper that provides conveniences for form fields.\n * It automatically binds the appropriate form errors by name to yielded\n * components.\n */\nclass Field<\n T extends Record<string, unknown> = FormDataCompiled\n> extends Component<FieldSignature<T>> {\n /**\n * Returns the validation errors for the field.\n * Supports dotted field names (e.g., 'profile.email').\n */\n get fieldErrors() {\n return this.args.errors?.[this.args.name];\n }\n\n /** The events on which validation should run. Defaults to ['change']. */\n get validateOn(): ('change' | 'input' | 'blur')[] {\n return this.args.validateOn ?? ['change'];\n }\n\n /**\n * Returns the current value for the field from formData.\n * Supports both flat and dotted field names (e.g., 'email' or 'profile.email').\n * Uses Ember's get() which handles both flat keys and dotted paths.\n */\n get fieldValue() {\n if (!this.args.formData) return undefined;\n\n // Ember's get() handles both flat keys and dotted paths correctly\n return get(this.args.formData, this.args.name);\n }\n\n /**\n * Validates the field by calling the validateField function passed in args.\n */\n validateField() {\n this.args.validateField?.(this.args.formData as T, this.args.name);\n }\n\n /**\n * Validates the field on change if change validation is enabled.\n */\n @action\n handleChange() {\n if (this.validateOn?.includes('change')) {\n this.validateField();\n }\n }\n\n /**\n * Validates the field on input if input validation is enabled.\n * Debounces validation to avoid excessive validation calls on every keystroke.\n */\n @action\n handleInput() {\n if (this.validateOn?.includes('input')) {\n debounce(this, this.validateField, 300);\n }\n }\n\n /**\n * Validates the field on blur if blur validation is enabled.\n */\n @action\n handleBlur() {\n if (this.validateOn.includes('blur')) {\n this.validateField();\n }\n }\n\n <template>\n {{! @glint-nocheck component generics (radio, radio-group, select) trigger: type instantiation is excessively deep and possibly infinite }}\n {{yield\n (hash\n Checkbox=(component\n Checkbox\n name=@name\n errors=this.fieldErrors\n checked=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onBlur=this.handleBlur\n )\n CheckboxGroup=(component\n CheckboxGroup name=@name errors=this.fieldErrors isDisabled=@disabled\n )\n Input=(component\n Input\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onInput=this.handleInput\n onBlur=this.handleBlur\n )\n InputOtp=(component\n InputOtp\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onInput=this.handleInput\n onBlur=this.handleBlur\n )\n Radio=(component\n Radio\n name=@name\n errors=this.fieldErrors\n checkedValue=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onBlur=this.handleBlur\n )\n RadioGroup=(component\n RadioGroup\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n )\n SingleSelect=(component\n Select\n name=@name\n errors=this.fieldErrors\n selectedKey=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n MultiSelect=(component\n Select\n selectionMode=\"multiple\"\n name=@name\n errors=this.fieldErrors\n selectedKeys=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n DatePicker=(component\n DatePicker\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n DateRangePicker=(component\n DatePicker\n mode=\"range\"\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n Switch=(component\n Switch\n name=@name\n errors=this.fieldErrors\n isSelected=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onBlur=this.handleBlur\n )\n Textarea=(component\n Textarea\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onInput=this.handleInput\n onBlur=this.handleBlur\n )\n )\n to=\"default\"\n }}\n </template>\n}\n\nexport { Field, type FieldSignature };\nexport default Field;\n"],"names":["Field","Component","fieldErrors","args","errors","name","validateOn","fieldValue","formData","undefined","get","validateField","handleChange","includes","n","prototype","action","handleInput","debounce","handleBlur","setComponentTemplate","precompileTemplate","strictMode","scope","hash","Checkbox","CheckboxGroup","Input","InputOtp","Radio","RadioGroup","Select","DatePicker","Switch","Textarea"],"mappings":";;;;;;;;;;;;;;;;;;AAiIA;;;;;AAKA,MAAMA,KAAA,SAEIC,SAAA,CAAyB;AACjC;;;AAGC;EACD,IAAIC,WAAAA,GAAc;IAChB,OAAO,IAAI,CAACC,IAAI,CAACC,MAAM,GAAG,IAAI,CAACD,IAAI,CAACE,IAAI,CAAC;AAC3C,EAAA;AAEA;EACA,IAAIC,UAAAA,GAA8C;IAChD,OAAO,IAAI,CAACH,IAAI,CAACG,UAAU,IAAI,CAAC,QAAA,CAAS;AAC3C,EAAA;AAEA;;;;AAI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AAAC,kBAAA,CAAA,8+DAAA,EA6GA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;QAAAC,QAAA;QAAAC,aAAA;QAAAC,KAAA;QAAAC,QAAA;QAAAC,KAAA;QAAAC,UAAA;QAAAC,MAAA;QAAAC,UAAA;QAAAC,MAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-control.js","sources":["../../../src/components/forms/form-control.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { guidFor } from '@ember/object/internals';\nimport { hash } from '@ember/helper';\nimport Feedback, {\n feedbackMessageText,\n type FormFeedbackSignature\n} from './form-feedback';\nimport Description, { type FormDescriptionSignature } from './form-description';\nimport Label, { type LabelSignature } from './label';\nimport VisuallyHidden from '../utilities/visually-hidden';\nimport type { ComponentLike, WithBoundArgs } from '@glint/template';\n\ninterface FormControlSharedArgs {\n /**\n * The label text rendered above the control and associated with it via `for`.\n * Use the `:label` block instead when the label needs markup.\n */\n label?: string;\n\n /**\n * Whether the field is required. Adds an asterisk to the label; it does not\n * set the `required` attribute on the control itself.\n *\n * @defaultValue false\n */\n isRequired?: boolean;\n\n /**\n * Help text rendered between the label and the control, and referenced by the\n * ids `describedBy` returns.\n */\n description?: string;\n\n /**\n * Validation messages for the field. A non-empty value also marks the control\n * invalid, and an array is joined with `; ` when displayed.\n */\n errors?: string[] | string;\n\n /**\n * Marks the control invalid without supplying messages, for validation that is\n * reported elsewhere.\n *\n * @defaultValue false\n */\n isInvalid?: boolean;\n\n /**\n * Whether the field is disabled. FormControl passes this through for styling;\n * the control it wraps is responsible for the `disabled` attribute.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n}\n\ninterface Args extends FormControlSharedArgs {\n /**\n * The id given to the control, and the base for the description and feedback\n * ids. Generated when omitted, so pass one only when something outside the\n * block has to reference it.\n */\n id?: string;\n\n /**\n * The size of the label, description and feedback text.\n *\n * @defaultValue 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n\n /**\n * Suppresses the automatic error feedback, for when the block renders the\n * yielded `Feedback` itself or places messages elsewhere.\n *\n * @defaultValue false\n */\n preventErrorFeedback?: boolean;\n\n /**\n * Class names for the wrapping element.\n */\n class?: string;\n}\n\ninterface FormControlSignature {\n Args: Args;\n Blocks: {\n default: [\n {\n id: string;\n isInvalid: boolean;\n describedBy: (\n hasDescription?: string | boolean,\n hasFeedback?: string | boolean\n ) => string | undefined;\n Label: WithBoundArgs<\n ComponentLike<LabelSignature>,\n 'for' | 'size' | 'isRequired'\n >;\n Description: WithBoundArgs<\n ComponentLike<FormDescriptionSignature>,\n 'id' | 'size'\n >;\n Feedback: WithBoundArgs<\n ComponentLike<FormFeedbackSignature>,\n 'id' | 'size' | 'messages' | 'status'\n >;\n }\n ];\n label: [];\n description: [];\n };\n Element: HTMLDivElement;\n}\n\nfunction or(arg1: unknown, arg2: unknown): boolean {\n return !!(arg1 || arg2);\n}\n\nclass FormControl extends Component<FormControlSignature> {\n id = this.args.id || guidFor(this);\n\n get descriptionId(): string {\n return this.id + '-description';\n }\n\n get feedbackId(): string {\n return this.id + '-feedback';\n }\n\n describedBy = (\n hasDescription?: string | boolean,\n hasFeedback?: string | boolean\n ): string | undefined => {\n const ids = [];\n\n if (hasDescription) {\n ids.push(this.descriptionId);\n }\n\n if (hasFeedback) {\n ids.push(this.feedbackId);\n }\n\n if (ids.length > 0) {\n return ids.join(' ');\n }\n };\n\n get isInvalid(): boolean {\n if (\n this.args.isInvalid ||\n (this.args.errors && this.args.errors.length > 0)\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * The error messages as a single string, used by the persistent live region.\n * Uses `FormFeedback`'s own join, so both render the same separator.\n */\n get errorMessageText(): string {\n return feedbackMessageText(this.args.errors);\n }\n\n get showErrorFeedback(): boolean {\n if (!(this.args.preventErrorFeedback === true) && this.isInvalid) {\n return true;\n }\n return false;\n }\n\n <template>\n <div class={{@class}} ...attributes>\n {{#if (or @label (has-block \"label\"))}}\n <Label @for={{this.id}} @isRequired={{@isRequired}} @size={{@size}}>\n {{@label}}\n {{yield to=\"label\"}}\n </Label>\n {{/if}}\n\n {{#if (or @description (has-block \"description\"))}}\n <Description @id={{this.descriptionId}} @size={{@size}}>\n {{@description}}\n {{yield to=\"description\"}}\n </Description>\n {{/if}}\n\n {{yield\n (hash\n id=this.id\n isInvalid=this.isInvalid\n describedBy=this.describedBy\n Label=(component Label for=this.id size=@size isRequired=@isRequired)\n Description=(component Description id=this.descriptionId size=@size)\n Feedback=(component\n Feedback\n id=this.feedbackId\n size=@size\n messages=@errors\n status=\"danger\"\n announce=false\n )\n )\n to=\"default\"\n }}\n\n {{#if this.showErrorFeedback}}\n <Feedback\n @id={{this.feedbackId}}\n @size={{@size}}\n @messages={{@errors}}\n @status=\"danger\"\n @announce={{false}}\n />\n {{/if}}\n\n {{!\n The visible feedback is only rendered once the field is invalid, and a\n live region that appears at the same moment as its content is not\n reliably announced. This region is always in the DOM, visually hidden\n and empty, so assistive technology is already observing it when the\n messages arrive. It is intentionally not part of describedBy; the\n visible feedback is what describes the control.\n }}\n <VisuallyHidden\n aria-live=\"assertive\"\n data-test-id=\"form-feedback-live-region\"\n >{{this.errorMessageText}}</VisuallyHidden>\n </div>\n </template>\n}\n\nexport { FormControl, type FormControlSignature, type FormControlSharedArgs };\nexport default FormControl;\n"],"names":["or","arg1","arg2","FormControl","Component","id","args","guidFor","descriptionId","feedbackId","describedBy","hasDescription","hasFeedback","ids","push","length","join","isInvalid","errors","errorMessageText","feedbackMessageText","showErrorFeedback","preventErrorFeedback","setComponentTemplate","precompileTemplate","strictMode","scope","Label","Description","hash","Feedback","VisuallyHidden"],"mappings":";;;;;;;;;;AAoHA,SAASA,GAAGC,IAAa,EAAEC,IAAa,EAAU;AAChD,EAAA,OAAO,CAAC,EAAED,IAAA,IAAQC,IAAI,CAAA;AACxB;AAEA,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SAAS,EAAE;AAChE,MAAA,OAAO,IAAA;AACT,IAAA;AACA,IAAA,OAAO,KAAA;AACT,EAAA;AAEA,EAAA;IAAAM,oBAAA,CAAAC,kBAAA,CAAA,8/CAAA,EA0DA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAA1B,EAAA;QAAA2B,KAAA;qBAAAC,eAAA;QAAAC,IAAA;kBAAAC,YAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"form-control.js","sources":["../../../src/components/forms/form-control.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { guidFor } from '@ember/object/internals';\nimport { hash } from '@ember/helper';\nimport Feedback, {\n feedbackMessageText,\n type FormFeedbackSignature\n} from './form-feedback';\nimport Description, { type FormDescriptionSignature } from './form-description';\nimport Label, { type LabelSignature } from './label';\nimport VisuallyHidden from '../utilities/visually-hidden';\nimport type { ComponentLike, WithBoundArgs } from '@glint/template';\n\ninterface FormControlSharedArgs {\n /**\n * The label text rendered above the control and associated with it via `for`.\n * Use the `:label` block instead when the label needs markup.\n */\n label?: string;\n\n /**\n * Whether the field is required. Adds an asterisk to the label; it does not\n * set the `required` attribute on the control itself.\n *\n * @defaultValue false\n */\n isRequired?: boolean;\n\n /**\n * Help text rendered between the label and the control, and referenced by the\n * ids `describedBy` returns.\n */\n description?: string;\n\n /**\n * Validation messages for the field. A non-empty value also marks the control\n * invalid, and an array is joined with `; ` when displayed.\n */\n errors?: string[] | string;\n\n /**\n * Marks the control invalid without supplying messages, for validation that is\n * reported elsewhere.\n *\n * @defaultValue false\n */\n isInvalid?: boolean;\n\n /**\n * Whether the field is disabled. FormControl passes this through for styling;\n * the control it wraps is responsible for the `disabled` attribute.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n}\n\ninterface Args extends FormControlSharedArgs {\n /**\n * The id given to the control, and the base for the description and feedback\n * ids. Generated when omitted, so pass one only when something outside the\n * block has to reference it.\n */\n id?: string;\n\n /**\n * The size of the label, description and feedback text.\n *\n * @defaultValue 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n\n /**\n * Suppresses the automatic error feedback, for when the block renders the\n * yielded `Feedback` itself or places messages elsewhere.\n *\n * @defaultValue false\n */\n preventErrorFeedback?: boolean;\n\n /**\n * Class names for the wrapping element.\n */\n class?: string;\n}\n\ninterface FormControlSignature {\n Args: Args;\n Blocks: {\n default: [\n {\n id: string;\n isInvalid: boolean;\n describedBy: (\n hasDescription?: string | boolean,\n hasFeedback?: string | boolean\n ) => string | undefined;\n Label: WithBoundArgs<\n ComponentLike<LabelSignature>,\n 'for' | 'size' | 'isRequired'\n >;\n Description: WithBoundArgs<\n ComponentLike<FormDescriptionSignature>,\n 'id' | 'size'\n >;\n Feedback: WithBoundArgs<\n ComponentLike<FormFeedbackSignature>,\n 'id' | 'size' | 'messages' | 'status'\n >;\n }\n ];\n label: [];\n description: [];\n };\n Element: HTMLDivElement;\n}\n\nfunction or(arg1: unknown, arg2: unknown): boolean {\n return !!(arg1 || arg2);\n}\n\nclass FormControl extends Component<FormControlSignature> {\n id = this.args.id || guidFor(this);\n\n get descriptionId(): string {\n return this.id + '-description';\n }\n\n get feedbackId(): string {\n return this.id + '-feedback';\n }\n\n describedBy = (\n hasDescription?: string | boolean,\n hasFeedback?: string | boolean\n ): string | undefined => {\n const ids = [];\n\n if (hasDescription) {\n ids.push(this.descriptionId);\n }\n\n if (hasFeedback) {\n ids.push(this.feedbackId);\n }\n\n if (ids.length > 0) {\n return ids.join(' ');\n }\n };\n\n get isInvalid(): boolean {\n if (\n this.args.isInvalid ||\n (this.args.errors && this.args.errors.length > 0)\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * The error messages as a single string, used by the persistent live region.\n * Uses `FormFeedback`'s own join, so both render the same separator.\n */\n get errorMessageText(): string {\n return feedbackMessageText(this.args.errors);\n }\n\n get showErrorFeedback(): boolean {\n if (!(this.args.preventErrorFeedback === true) && this.isInvalid) {\n return true;\n }\n return false;\n }\n\n <template>\n <div class={{@class}} ...attributes>\n {{#if (or @label (has-block \"label\"))}}\n <Label @for={{this.id}} @isRequired={{@isRequired}} @size={{@size}}>\n {{@label}}\n {{yield to=\"label\"}}\n </Label>\n {{/if}}\n\n {{#if (or @description (has-block \"description\"))}}\n <Description @id={{this.descriptionId}} @size={{@size}}>\n {{@description}}\n {{yield to=\"description\"}}\n </Description>\n {{/if}}\n\n {{yield\n (hash\n id=this.id\n isInvalid=this.isInvalid\n describedBy=this.describedBy\n Label=(component Label for=this.id size=@size isRequired=@isRequired)\n Description=(component Description id=this.descriptionId size=@size)\n Feedback=(component\n Feedback\n id=this.feedbackId\n size=@size\n messages=@errors\n status=\"danger\"\n announce=false\n )\n )\n to=\"default\"\n }}\n\n {{#if this.showErrorFeedback}}\n <Feedback\n @id={{this.feedbackId}}\n @size={{@size}}\n @messages={{@errors}}\n @status=\"danger\"\n @announce={{false}}\n />\n {{/if}}\n\n {{!\n The visible feedback is only rendered once the field is invalid, and a\n live region that appears at the same moment as its content is not\n reliably announced. This region is always in the DOM, visually hidden\n and empty, so assistive technology is already observing it when the\n messages arrive. It is intentionally not part of describedBy; the\n visible feedback is what describes the control.\n }}\n <VisuallyHidden\n aria-live=\"assertive\"\n data-test-id=\"form-feedback-live-region\"\n >{{this.errorMessageText}}</VisuallyHidden>\n </div>\n </template>\n}\n\nexport { FormControl, type FormControlSignature, type FormControlSharedArgs };\nexport default FormControl;\n"],"names":["or","arg1","arg2","FormControl","Component","id","args","guidFor","descriptionId","feedbackId","describedBy","hasDescription","hasFeedback","ids","push","length","join","isInvalid","errors","errorMessageText","feedbackMessageText","showErrorFeedback","preventErrorFeedback","setComponentTemplate","precompileTemplate","strictMode","scope","Label","Description","hash","Feedback","VisuallyHidden"],"mappings":";;;;;;;;;;AAoHA,SAASA,GAAGC,IAAa,EAAEC,IAAa,EAAU;AAChD,EAAA,OAAO,CAAC,EAAED,I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KAAK,IAAI,CAAA,IAAK,IAAI,CAACL,SAAS,EAAE;AAChE,MAAA,OAAO,IAAA;AACT,IAAA;AACA,IAAA,OAAO,KAAA;AACT,EAAA;AAEA,EAAA;IAAAM,oBAAA,CAAAC,kBAAA,CAAA,8/CAAA,EA0DA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAA1B,EAAA;QAAA2B,KAAA;qBAAAC,eAAA;QAAAC,IAAA;kBAAAC,YAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-description.js","sources":["../../../src/components/forms/form-description.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles, type FormDescriptionVariants } from '@frontile/theme';\n\ninterface FormDescriptionSignature {\n Args: {\n /**\n * The id of the description element, referenced by the control's\n * `aria-describedby`.\n */\n id?: string;\n\n /**\n * The size of the description text.\n *\n * @defaultValue 'md'\n */\n size?: FormDescriptionVariants['size'];\n\n /**\n * Class names for the description element, merged with the theme's.\n */\n class?: string;\n };\n Element: HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\n\nclass FormDescription extends Component<FormDescriptionSignature> {\n get classes() {\n const { formDescription } = useStyles();\n\n return formDescription({\n size: this.args.size || 'md',\n class: this.args.class\n });\n }\n\n <template>\n <div\n id={{@id}}\n class={{this.classes}}\n data-component=\"form-description\"\n data-part=\"base\"\n ...attributes\n >\n {{yield}}\n </div>\n </template>\n}\n\nexport { FormDescription, type FormDescriptionSignature };\nexport default FormDescription;\n"],"names":["FormDescription","Component","classes","formDescription","useStyles","size","args","class","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AA6BA,MAAMA,wBAAwBC,SAAA,CAAU;EACtC,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAiB,GAAGC,SAAA,EAAA;AAE5B,IAAA,OAAOD,eAAA,CAAgB;AACrBE,MAAAA,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD,IAAI,IAAI,IAAA;AACxBE,MAAAA,KAAA,EAAO,IAAI,CAACD,IAAI,CAACC;AACnB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,mIAAA,EAUA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"form-description.js","sources":["../../../src/components/forms/form-description.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles, type FormDescriptionVariants } from '@frontile/theme';\n\ninterface FormDescriptionSignature {\n Args: {\n /**\n * The id of the description element, referenced by the control's\n * `aria-describedby`.\n */\n id?: string;\n\n /**\n * The size of the description text.\n *\n * @defaultValue 'md'\n */\n size?: FormDescriptionVariants['size'];\n\n /**\n * Class names for the description element, merged with the theme's.\n */\n class?: string;\n };\n Element: HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\n\nclass FormDescription extends Component<FormDescriptionSignature> {\n get classes() {\n const { formDescription } = useStyles();\n\n return formDescription({\n size: this.args.size || 'md',\n class: this.args.class\n });\n }\n\n <template>\n <div\n id={{@id}}\n class={{this.classes}}\n data-component=\"form-description\"\n data-part=\"base\"\n ...attributes\n >\n {{yield}}\n </div>\n </template>\n}\n\nexport { FormDescription, type FormDescriptionSignature };\nexport default FormDescription;\n"],"names":["FormDescription","Component","classes","formDescription","useStyles","size","args","class","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AA6BA,MAAMA,wBAAwBC,SAAA,CAAU;EACtC,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAiB,GAAGC,SAAA,EAAA;AAE5B,IAAA,OAAOD,eAAA,CAAgB;AACrBE,MAAAA,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD,IAAI,IAAI,IAAA;AACxBE,MAAAA,KAAA,EAAO,IAAI,CAACD,IAAI,CAACC;AACnB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,mIAAA,EAUA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-feedback.js","sources":["../../../src/components/forms/form-feedback.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached } from '@glimmer/tracking';\nimport { useStyles, type FormFeedbackVariants } from '@frontile/theme';\nimport { renamedArgValue } from '../../-private/deprecated-args';\n\ninterface FormFeedbackSignature {\n Args: {\n /**\n * The id of the feedback element, referenced by the control's\n * `aria-describedby`.\n */\n id?: string;\n\n /**\n * A list of messages or a single message string. An array is joined with `; `.\n */\n messages?: string[] | string;\n\n /**\n * The status of the feedback, which also decides whether it is announced\n * assertively (`danger`) or politely.\n *\n * @defaultValue 'danger'\n */\n status?: FormFeedbackVariants['status'];\n\n /**\n * @deprecated Use `status`. The name changed because this value also\n * decides whether the message is announced assertively.\n */\n intent?: FormFeedbackVariants['status'];\n\n /**\n * The size of the feedback text.\n *\n * @defaultValue 'md'\n */\n size?: FormFeedbackVariants['size'];\n\n /**\n * Whether the element is itself an `aria-live` region. Set this to `false`\n * when something else (such as `FormControl`, which keeps a persistent\n * live region in the DOM) already announces the messages, so they are not\n * announced twice.\n *\n * @defaultValue true\n */\n announce?: boolean;\n\n /**\n * Class names for the feedback element, merged with the theme's.\n */\n class?: string;\n };\n Element: HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\n\n/**\n * Renders feedback messages as a single string. An array is joined with `; `.\n *\n * Shared with `FormControl`, whose persistent live region announces the same\n * text, so both render an identical separator.\n *\n * @param messages A list of messages or a single message string.\n * @returns The messages as one string, or an empty string when there are none.\n */\nfunction feedbackMessageText(messages: string[] | string | undefined): string {\n if (!messages) return '';\n\n return typeof messages === 'string' ? messages : messages.join('; ');\n}\n\nclass FormFeedback extends Component<FormFeedbackSignature> {\n /**\n * Resolved once so `isError` and `classes` agree, and so the deprecation\n * fires once per render rather than per reader.\n */\n @cached\n get status(): FormFeedbackVariants['status'] {\n return renamedArgValue(this.args.status, this.args.intent, {} as const, {\n component: 'FormFeedback',\n from: 'intent',\n to: 'status',\n id: 'frontile.form-feedback.intent'\n });\n }\n\n /**\n * Drives `aria-live=\"assertive\"`. The default is `danger`, so the ABSENCE\n * of the arg must stay assertive -- a missing value must never quietly\n * downgrade an error announcement to polite.\n */\n get isError(): boolean {\n return (\n typeof this.args.messages !== 'undefined' &&\n (this.status === 'danger' || typeof this.status === 'undefined')\n );\n }\n\n get classes() {\n const { formFeedback } = useStyles();\n\n return formFeedback({\n size: this.args.size || 'md',\n status: this.status || 'danger',\n class: this.args.class\n });\n }\n\n get announce(): boolean {\n return this.args.announce !== false;\n }\n\n get ariaLive(): string | undefined {\n if (!this.announce) {\n return undefined;\n }\n return this.isError ? 'assertive' : 'polite';\n }\n\n get messageText(): string {\n return feedbackMessageText(this.args.messages);\n }\n\n <template>\n <div\n id={{@id}}\n class={{this.classes}}\n data-component=\"form-feedback\"\n data-part=\"base\"\n aria-live={{this.ariaLive}}\n ...attributes\n >\n {{this.messageText}}\n {{yield}}\n </div>\n </template>\n}\n\nexport { FormFeedback, feedbackMessageText, type FormFeedbackSignature };\nexport default FormFeedback;\n"],"names":["feedbackMessageText","messages","join","FormFeedback","Component","status","renamedArgValue","args","intent","component","from","to","id","n","prototype","cached","isError","classes","formFeedback","useStyles","size","class","announce","ariaLive","undefined","messageText","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;;;;AA4DA;;;;;;;;;AASA,SAASA,oBAAoBC,QAAuC,EAAS;AAC3E,EAAA,IAAI,CAACA,UAAU,OAAO,EAAA;AAEtB,EAAA,OAAO,OAAOA,QAAA,KAAa,QAAA,GAAWA,QAAA,GAAWA,QAAA,CAASC,IAAI,CAAC,IAAA,CAAA;AACjE;AAEA,MAAMC,qBAAqBC,SAAA,CAAU;AACnC;;;AAGC;EACD,IACIC,M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,CAAoB,IAAI,CAACO,IAAI,CAACN,QAAQ,CAAA;AAC/C,EAAA;AAEA,EAAA;IAAAyB,oBAAA,CAAAC,kBAAA,CAAA,oLAAA,EAYA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"form-feedback.js","sources":["../../../src/components/forms/form-feedback.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached } from '@glimmer/tracking';\nimport { useStyles, type FormFeedbackVariants } from '@frontile/theme';\nimport { renamedArgValue } from '../../-private/deprecated-args';\n\ninterface FormFeedbackSignature {\n Args: {\n /**\n * The id of the feedback element, referenced by the control's\n * `aria-describedby`.\n */\n id?: string;\n\n /**\n * A list of messages or a single message string. An array is joined with `; `.\n */\n messages?: string[] | string;\n\n /**\n * The status of the feedback, which also decides whether it is announced\n * assertively (`danger`) or politely.\n *\n * @defaultValue 'danger'\n */\n status?: FormFeedbackVariants['status'];\n\n /**\n * @deprecated Use `status`. The name changed because this value also\n * decides whether the message is announced assertively.\n */\n intent?: FormFeedbackVariants['status'];\n\n /**\n * The size of the feedback text.\n *\n * @defaultValue 'md'\n */\n size?: FormFeedbackVariants['size'];\n\n /**\n * Whether the element is itself an `aria-live` region. Set this to `false`\n * when something else (such as `FormControl`, which keeps a persistent\n * live region in the DOM) already announces the messages, so they are not\n * announced twice.\n *\n * @defaultValue true\n */\n announce?: boolean;\n\n /**\n * Class names for the feedback element, merged with the theme's.\n */\n class?: string;\n };\n Element: HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\n\n/**\n * Renders feedback messages as a single string. An array is joined with `; `.\n *\n * Shared with `FormControl`, whose persistent live region announces the same\n * text, so both render an identical separator.\n *\n * @param messages A list of messages or a single message string.\n * @returns The messages as one string, or an empty string when there are none.\n */\nfunction feedbackMessageText(messages: string[] | string | undefined): string {\n if (!messages) return '';\n\n return typeof messages === 'string' ? messages : messages.join('; ');\n}\n\nclass FormFeedback extends Component<FormFeedbackSignature> {\n /**\n * Resolved once so `isError` and `classes` agree, and so the deprecation\n * fires once per render rather than per reader.\n */\n @cached\n get status(): FormFeedbackVariants['status'] {\n return renamedArgValue(this.args.status, this.args.intent, {} as const, {\n component: 'FormFeedback',\n from: 'intent',\n to: 'status',\n id: 'frontile.form-feedback.intent'\n });\n }\n\n /**\n * Drives `aria-live=\"assertive\"`. The default is `danger`, so the ABSENCE\n * of the arg must stay assertive -- a missing value must never quietly\n * downgrade an error announcement to polite.\n */\n get isError(): boolean {\n return (\n typeof this.args.messages !== 'undefined' &&\n (this.status === 'danger' || typeof this.status === 'undefined')\n );\n }\n\n get classes() {\n const { formFeedback } = useStyles();\n\n return formFeedback({\n size: this.args.size || 'md',\n status: this.status || 'danger',\n class: this.args.class\n });\n }\n\n get announce(): boolean {\n return this.args.announce !== false;\n }\n\n get ariaLive(): string | undefined {\n if (!this.announce) {\n return undefined;\n }\n return this.isError ? 'assertive' : 'polite';\n }\n\n get messageText(): string {\n return feedbackMessageText(this.args.messages);\n }\n\n <template>\n <div\n id={{@id}}\n class={{this.classes}}\n data-component=\"form-feedback\"\n data-part=\"base\"\n aria-live={{this.ariaLive}}\n ...attributes\n >\n {{this.messageText}}\n {{yield}}\n </div>\n </template>\n}\n\nexport { FormFeedback, feedbackMessageText, type FormFeedbackSignature };\nexport default FormFeedback;\n"],"names":["feedbackMessageText","messages","join","FormFeedback","Component","status","renamedArgValue","args","intent","component","from","to","id","n","prototype","cached","isError","classes","formFeedback","useStyles","size","class","announce","ariaLive","undefined","messageText","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;;;;AA4DA;;;;;;;;;AASA,SAASA,oBAAoBC,QAAuC,EAAS;AAC3E,EAAA,IAAI,CAACA,UAAU,OAAO,EAAA;AAEtB,EAAA,OAAO,OAAOA,QAAA,KAAa,QAAA,GAAWA,QAAA,GAAWA,QAAA,CAASC,IAAI,CAAC,IAAA,CAAA;AACjE;AAEA,MAAMC,qBAAqBC,SAAA,CAAU;A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ACxB,IAAA,OAAOzB,mBAAA,CAAoB,IAAI,CAACO,IAAI,CAACN,QAAQ,CAAA;AAC/C,EAAA;AAEA,EAAA;IAAAyB,oBAAA,CAAAC,kBAAA,CAAA,oLAAA,EAYA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","sources":["../../../src/components/forms/form.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport { ref } from '../../utils/ref';\nimport { dataFrom } from 'form-data-utils';\nimport {\n StandardValidator,\n issuePathToFieldName\n} from '../../utils/standard-validator';\nimport { flattenData, unflattenData, deepEqual } from '../../utils/nested-data';\nimport { Field } from './field';\n\nimport type { WithBoundArgs } from '@glint/template';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { Issues, CustomValidatorFn } from '../../utils/standard-validator';\nimport type Owner from '@ember/owner';\n\n/** The form data as key/value pairs. */\ntype FormDataCompiled = ReturnType<typeof dataFrom>;\n/** The validation errors for the form, keyed by field name. */\ntype FormErrors = Record<string, string | string[] | undefined>;\n\n/**\n * The data passed to `onChange` and `onSubmit` callbacks, which is similar\n * to `FormContext` but also includes the form data.\n */\ntype FormResultData<T = FormDataCompiled> = {\n /** The form data as key/value pairs. */\n data: T;\n /** Whether the form is valid (i.e. has no validation errors). */\n isValid: boolean;\n /** Whether the form is invalid (i.e. has validation errors). */\n isInvalid: boolean;\n /** The current form validation errors. */\n errors: FormErrors;\n /**\n * The set of fields that have changed from their initial values.\n * For flat data structures: contains top-level keys (e.g., \"firstName\", \"email\")\n * For nested data structures: contains dotted paths (e.g., \"user.name.first\", \"profile.email\")\n */\n dirty: Set<string>;\n};\n\n/**\n * The context yielded to the default block of the `Form` component.\n */\ninterface FormContext<T = FormDataCompiled> {\n /** The form data as key/value pairs. */\n data?: T;\n /** Whether the form is currently submitting. */\n isLoading: boolean;\n /** Whether the form is valid (i.e. has no validation errors). */\n isValid: boolean;\n /** Whether the form is invalid (i.e. has validation errors). */\n isInvalid: boolean;\n /** The current form validation errors. */\n errors: FormErrors;\n /**\n * The set of fields that have changed from their initial values.\n * For flat data structures: contains top-level keys (e.g., \"firstName\", \"email\")\n * For nested data structures: contains dotted paths (e.g., \"user.name.first\", \"profile.email\")\n */\n dirty: Set<string>;\n /**\n * Resets the form to its initial state.\n * Clears all form fields, validation errors, and dirty tracking.\n */\n reset: () => void;\n /** The `Field` component, with args bound. */\n Field: WithBoundArgs<\n typeof Field,\n 'errors' | 'formData' | 'disabled' | 'validateOn' | 'validateField'\n >;\n}\n\ninterface FormSignature<T = FormDataCompiled> {\n Element: HTMLFormElement;\n Args: {\n /**\n * The standard schema to validate form data against.\n */\n schema?: StandardSchemaV1<T>;\n /**\n * Optional custom validation function. A custom validator should return\n * an array of Standard Schema issues, or `undefined` if there are none.\n * This function may be async or sync.\n */\n validate?: CustomValidatorFn<T>;\n /**\n * When to run validation.\n */\n validateOn?: ('change' | 'input' | 'blur' | 'submit')[];\n /**\n * The initial form data as key/value pairs.\n * This is primarily useful for setting default values in the form.\n * This object receives changes as the user interacts with the form.\n */\n data?: T;\n /**\n * Whether the entire form and all its fields should be disabled. This only\n * applies when using the yielded `Field` component.\n */\n disabled?: boolean;\n /**\n * Optional callback invoked on input changes within the form.\n * @param result - The current form result data.\n * @param event - The input event that triggered the change.\n * @returns A promise or void.\n */\n onChange?: (\n result: FormResultData<T>,\n event: Event\n ) => Promise<void> | void;\n /**\n * Callback invoked on form submission. If `onSubmit` returns a promise,\n * the form will be marked as `isLoading` until the promise resolves.\n * @param result - The current form result data.\n * @param event - The submit event that triggered the submission.\n * @returns A promise or void.\n */\n onSubmit: (\n result: FormResultData<T>,\n event: SubmitEvent\n ) => Promise<void> | void;\n /**\n * Optional callback invoked when validation errors occur on form submission.\n * @param errors - The validation errors found.\n * @param data - The form data that was validated.\n * @param event - The submit event that triggered the validation.\n * @returns A promise or void.\n */\n onError?: (\n errors: FormErrors,\n data: T,\n event: SubmitEvent\n ) => Promise<void> | void;\n };\n Blocks: {\n default: [FormContext<T>];\n };\n}\n\n/**\n * A form component that handles form submissions and input changes.\n *\n * @example\n * ```hbs\n * <Form\n * @data={{this.formData}}\n * @schema={{this.schema}}\n * @validate={{this.customValidator}}\n * @onSubmit={{this.onSubmit}}\n * @onChange={{this.onChange}}\n * as |form|\n * >\n * <form.Field name=\"firstName\" as |field|>\n * <field.Input />\n * </form.Field>\n * <form.Field name=\"lastName\" as |field|>\n * <field.Input />\n * </form.Field>\n * <Button type=\"submit\" @isLoading={{form.isLoading}}>\n * Submit\n * <:loading>Submitting...</:loading>\n * </Button>\n * </Form>\n * ```\n */\nclass Form<T = FormDataCompiled> extends Component<FormSignature<T>> {\n /** Whether the form is currently submitting. */\n @tracked isLoading = false;\n\n /** The current form validation errors. */\n @tracked errors: FormErrors = {};\n\n /** The current uncontrolled form data. */\n @tracked uncontrolledData?: T;\n\n /**\n * Flattened snapshot of initial data for dirty field comparison.\n * Stored in flattened form regardless of whether source data is nested or flat.\n */\n @tracked initialDataSnapshot?: Record<string, unknown>;\n\n /**\n * The set of fields that have changed from their initial values.\n * For flat data structures: contains top-level keys (e.g., \"firstName\", \"email\")\n * For nested data structures: contains dotted paths (e.g., \"user.name.first\", \"profile.email\")\n */\n @tracked dirty: Set<string> = new Set();\n\n /** Reference to the form element. */\n element = ref<HTMLFormElement>();\n\n /**\n * Creates a new instance of the Form component.\n * Initializes internal state based on provided args.\n * @param owner - The owner of the component.\n * @param args - The arguments passed to the component.\n */\n constructor(owner: Owner, args: FormSignature<T>['Args']) {\n super(owner, args);\n // Create copy of initial data\n if (args.data) {\n // Always store flattened snapshot for dirty tracking\n // This ensures consistent comparison regardless of initial structure\n this.initialDataSnapshot = flattenData(\n args.data as Record<string, unknown>\n );\n\n // Keep uncontrolled data in original structure\n this.uncontrolledData = { ...args.data };\n }\n }\n\n /** Whether the form is valid (i.e. has no validation errors). */\n get isValid() {\n return Object.keys(this.errors).length === 0;\n }\n\n /** Whether the form is invalid (i.e. has validation errors). */\n get isInvalid() {\n return !this.isValid;\n }\n\n /** Whether the form is controlled (`onChange` is provided). */\n get isControlled(): boolean {\n return !!this.args.onChange;\n }\n\n /** The events on which validation should run. */\n get validateOn(): ('change' | 'input' | 'blur' | 'submit')[] {\n return this.args.validateOn ?? ['change', 'blur', 'submit'];\n }\n\n /** The events on which field-level validation should run. */\n get fieldValidateOn(): ('change' | 'input' | 'blur')[] {\n return this.validateOn.filter((e) => e !== 'submit');\n }\n\n /** The current form data, from args if controlled, or internal state if uncontrolled. */\n get currentData(): T | undefined {\n if (this.isControlled) {\n return this.args.data;\n }\n return this.uncontrolledData;\n }\n\n /**\n * Validates data against the provided schema using StandardValidator.\n * Updates the `errors` property with any validation errors found.\n *\n * @param data - The form data to validate.\n * @returns A promise that resolves to the validation errors, if any.\n */\n async validate(data: T): Promise<FormErrors | undefined> {\n // Run validator and get issues\n const errors = await StandardValidator.validateAll(\n data,\n this.args.schema,\n this.args.validate\n );\n // Convert validator errors to FormErrors\n if (errors) {\n const formErrors = validatorToFormErrors(errors);\n this.errors = formErrors;\n return formErrors;\n }\n // Clear errors if no issues\n this.errors = {};\n }\n\n /**\n * Validates a single field against the provided schema using\n * StandardValidator. Updates the `errors` property with any validation\n * errors found for the field. If the field had previous errors but\n * is now valid, those errors are cleared.\n *\n * @param data - The form data to validate against.\n * @param name - The name of the field to validate.\n * @returns A promise that resolves to errors for the field, if any.\n */\n @action\n async validateField(data: T, name: string): Promise<FormErrors | undefined> {\n if (!this.args.schema && !this.args.validate) {\n return;\n }\n // Run validator and get issues\n const errors = await StandardValidator.validateFieldAll(\n data,\n name,\n this.args.schema,\n this.args.validate\n );\n // Convert validator errors to FormErrors\n if (errors) {\n const formErrors = validatorToFormErrors(errors);\n if (formErrors[name]) {\n // Merge with existing errors immutably\n this.errors = { ...this.errors, [name]: formErrors[name] };\n }\n return { [name]: formErrors[name] };\n }\n // Clear field error if no issues\n // Remove field error using immutable pattern:\n // 1. Use destructuring to extract the field we want to remove\n // (assigned to '_' since unused)\n // 2. Capture all remaining fields in 'rest' using the spread operator\n // 3. Reassign this.errors to the 'rest' object, effectively removing\n // the field\n // This approach maintains immutability by creating a new object rather than\n // mutating the existing errors object with 'delete'\n if (this.errors[name]) {\n const { [name]: _, ...rest } = this.errors;\n this.errors = rest;\n }\n }\n\n /**\n * Computes which fields have changed from their initial values.\n * Uses deep comparison for consistency across flat and nested structures.\n * This is a pure function with no side effects.\n *\n * @param data - The current form data.\n * @returns A set of field names that have changed.\n */\n computeDirtyFields(data: T): Set<string> {\n const dirty = new Set<string>();\n\n if (!this.initialDataSnapshot) {\n return dirty;\n }\n\n // Flatten current data to same representation as snapshot\n const currentFlat = flattenData(data as Record<string, unknown>);\n\n // Compare all keys in current data\n for (const key in currentFlat) {\n if (!deepEqual(currentFlat[key], this.initialDataSnapshot[key])) {\n dirty.add(key);\n }\n }\n\n // Check for keys in initial data that are missing in current data\n for (const key in this.initialDataSnapshot) {\n if (\n !(key in currentFlat) &&\n this.initialDataSnapshot[key] !== undefined\n ) {\n dirty.add(key);\n }\n }\n\n return dirty;\n }\n\n /**\n * Builds the form result data object to pass to callbacks.\n * Also updates the dirty state as a side effect.\n *\n * @param data - The current form data.\n * @returns The form result data object.\n */\n buildFormResultData(data: T): FormResultData<T> {\n const { isValid, isInvalid, errors } = this;\n const dirty = this.computeDirtyFields(data);\n this.dirty = dirty; // Update tracked state\n return {\n data,\n isValid,\n isInvalid,\n errors,\n dirty\n };\n }\n\n /**\n * Handles the `input` event on the form element.\n * Calls the `onChange` callback with the current form data if provided.\n * Automatically unflattens dotted field names to nested structure.\n */\n @action\n handleInput(event: Event) {\n const form = event.currentTarget;\n if (form instanceof HTMLFormElement) {\n let data = dataFrom(event) as T;\n\n // Always unflatten form data to handle dotted field names\n // This is safe for flat data too - keys without dots remain unchanged\n data = unflattenData(data as Record<string, unknown>) as T;\n\n const resultData = this.buildFormResultData(data);\n this.uncontrolledData = data;\n this.args.onChange?.(resultData, event);\n }\n }\n\n /**\n * Handles the `submit` event on the form element.\n * Prevents the default form submission and calls the `onSubmit` callback\n * with the current form data. Manages the `isLoading` state during the\n * submission process. Automatically unflattens dotted field names to nested structure.\n */\n @action\n async handleSubmit(event: SubmitEvent) {\n event.preventDefault();\n const form = event.currentTarget;\n if (form instanceof HTMLFormElement) {\n this.isLoading = true;\n let data = dataFrom(event) as T;\n\n // Always unflatten form data to handle dotted field names\n // This is safe for flat data too - keys without dots remain unchanged\n data = unflattenData(data as Record<string, unknown>) as T;\n\n let errors: FormErrors | undefined;\n if (this.validateOn.includes('submit')) {\n errors = await this.validate(data);\n }\n\n const resultData = this.buildFormResultData(data);\n this.uncontrolledData = data;\n try {\n if (errors && this.args.onError) {\n // Call onError handler when there are validation errors\n await this.args.onError(errors, data, event);\n } else if (!errors && this.args.onSubmit) {\n // Run `onSubmit` if validation was skipped OR if validation passed\n await this.args.onSubmit(resultData, event);\n // Update snapshot on successful submit (new baseline)\n this.initialDataSnapshot = flattenData(\n data as Record<string, unknown>\n );\n // Clear dirty state since we've updated the baseline\n this.dirty = new Set();\n }\n } finally {\n this.isLoading = false;\n }\n }\n }\n\n /**\n * Handles the `reset` event on the form element.\n * Clears validation errors and dirty tracking.\n * Restores the form data to its initial state.\n * Calls `onChange` if the form is controlled to let parent update state.\n */\n @action\n handleReset(event: Event) {\n // Clear state\n this.errors = {};\n this.dirty = new Set();\n\n // Restore initial data\n if (this.initialDataSnapshot) {\n // Unflatten data if it was nested\n const restoredData = unflattenData(this.initialDataSnapshot) as T;\n\n // For controlled forms, call onChange to let parent update state\n if (this.isControlled && this.args.onChange) {\n const resultData = this.buildFormResultData(restoredData);\n\n this.args.onChange(resultData, event);\n } else {\n // For uncontrolled forms, update internal state\n this.uncontrolledData = restoredData;\n }\n } else {\n // No initial data, just clear uncontrolled data\n this.uncontrolledData = undefined;\n }\n }\n\n /**\n * Resets the form to its initial state.\n * This method calls the native form reset() to clear all form controls,\n * triggering a `reset` event that is handled in `handleReset`.\n */\n @action\n reset() {\n this.element?.current?.reset();\n }\n\n <template>\n {{! @glint-nocheck component generics (field) trigger: type instantiation is excessively deep and possibly infinite }}\n <form\n {{this.element.setup}}\n {{on \"input\" this.handleInput}}\n {{on \"submit\" this.handleSubmit}}\n {{on \"reset\" this.handleReset}}\n ...attributes\n >\n {{yield\n (hash\n data=this.currentData\n isLoading=this.isLoading\n isValid=this.isValid\n isInvalid=this.isInvalid\n errors=this.errors\n dirty=this.dirty\n reset=this.reset\n Field=(component\n Field\n errors=this.errors\n formData=this.currentData\n disabled=@disabled\n validateOn=this.fieldValidateOn\n validateField=this.validateField\n )\n )\n to=\"default\"\n }}\n </form>\n </template>\n}\n\n/**\n * Helper function.\n * Converts validation type `Issues` from StandardValidator into a format\n * suitable for the form component, type `FormErrors`.\n *\n * For example, an issue with path `['email']` will be converted\n * to a form error for the field `email`, `{\"email\": \"error message\" }`.\n * Numeric path segments are kept, so an issue with path\n * `['items', 0, 'name']` becomes `{\"items.0.name\": \"error message\"}`.\n *\n * @param errors - The validation issues to convert.\n * @returns A mapping of field names to their validation error messages.\n */\nfunction validatorToFormErrors(errors: Issues): FormErrors {\n const formErrors: FormErrors = {};\n\n for (const issue of errors) {\n if (!issue.path || issue.path.length === 0) continue;\n\n // `issuePathToFieldName` is shared with\n // `StandardValidator.filterFieldIssues`, so the keys written here are\n // by construction the dotted names field lookup resolves against.\n const fieldName = issuePathToFieldName(issue);\n const message = issue.message;\n\n // Add message to the field's errors\n const existing = formErrors[fieldName];\n if (existing === undefined) {\n formErrors[fieldName] = message;\n } else if (Array.isArray(existing)) {\n existing.push(message);\n } else {\n formErrors[fieldName] = [existing, message];\n }\n }\n\n return formErrors;\n}\n\nexport {\n Form,\n type FormContext,\n type FormSignature,\n type FormDataCompiled,\n type FormResultData,\n type FormErrors\n};\nexport default Form;\n"],"names":["Form","Component","g","prototype","tracked","i","Set","element","ref","constructor","owner","args","data","initialDataSnapshot","flattenData","uncontrolledData","isValid","Object","keys","errors","length","isInvalid","isControlled","onChange","validateOn","fieldValidateOn","filter","e","currentData","validate","StandardValidator","validateAll","schema","formErrors","validatorToFormErrors","validateField","name","validateFieldAll","_","rest","n","action","computeDirtyFields","dirty","currentFlat","key","deepEqual","add","undefined","buildFormResultData","handleInput","event","form","currentTarget","HTMLFormElement","dataFrom","unflattenData","resultData","handleSubmit","preventDefault","isLoading","includes","onError","onSubmit","handleReset","restoredData","reset","current","setComponentTemplate","precompileTemplate","strictMode","scope","on","hash","Field","issue","path","fieldName","issuePathToFieldName","message","existing","Array","isArray","push"],"mappings":";;;;;;;;;;;;;;AAgJA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBC;AACD,MAAMA,IAAA,SAAmCC,UAAwB;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CAE9DC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAoB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,UAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAA,MAAA;AADrB;AAAA,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CAICC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAA6B,EAAC;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,OAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,QAAA,CAAA,EAAA,MAAA;AAD/B;AAAA,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,kBAAA,EAAA,CAICC,OAAA,CAAA,CAAA;AAAA;EAAA,iBAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,kBAAA,CAAA,EAAA,MAAA;AADD;AAAA,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,qBA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AI,CAACwD,MAAMC,IAAI,IAAID,MAAMC,IAAI,CAACxD,MAAM,KAAK,CAAA,EAAG;AAE5C;AACA;AACA;AACA,IAAA,MAAMyD,YAAYC,oBAAA,CAAqBH,KAAA,CAAA;AACvC,IAAA,MAAMI,OAAA,GAAUJ,MAAMI,OAAO;AAE7B;AACA,IAAA,MAAMC,QAAA,GAAW/C,UAAU,CAAC4C,SAAA,CAAU;IACtC,IAAIG,aAAahC,SAAA,EAAW;AAC1Bf,MAAAA,UAAU,CAAC4C,UAAU,GAAGE,OAAA;IAC1B,CAAA,MAAO,IAAIE,KAAA,CAAMC,OAAO,CAACF,QAAA,CAAA,EAAW;AAClCA,MAAAA,QAAA,CAASG,IAAI,CAACJ,OAAA,CAAA;AAChB,IAAA,CAAA,MAAO;MACL9C,UAAU,CAAC4C,UAAU,GAAG,CAACG,QAAA,EAAUD,OAAA,CAAQ;AAC7C,IAAA;AACF,EAAA;AAEA,EAAA,OAAO9C,UAAA;AACT;;;;"}
1
+ {"version":3,"file":"form.js","sources":["../../../src/components/forms/form.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport { ref } from '../../utils/ref';\nimport { dataFrom } from 'form-data-utils';\nimport {\n StandardValidator,\n issuePathToFieldName\n} from '../../utils/standard-validator';\nimport { flattenData, unflattenData, deepEqual } from '../../utils/nested-data';\nimport { Field } from './field';\n\nimport type { WithBoundArgs } from '@glint/template';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { Issues, CustomValidatorFn } from '../../utils/standard-validator';\nimport type Owner from '@ember/owner';\n\n/** The form data as key/value pairs. */\ntype FormDataCompiled = ReturnType<typeof dataFrom>;\n/** The validation errors for the form, keyed by field name. */\ntype FormErrors = Record<string, string | string[] | undefined>;\n\n/**\n * The data passed to `onChange` and `onSubmit` callbacks, which is similar\n * to `FormContext` but also includes the form data.\n */\ntype FormResultData<T = FormDataCompiled> = {\n /** The form data as key/value pairs. */\n data: T;\n /** Whether the form is valid (i.e. has no validation errors). */\n isValid: boolean;\n /** Whether the form is invalid (i.e. has validation errors). */\n isInvalid: boolean;\n /** The current form validation errors. */\n errors: FormErrors;\n /**\n * The set of fields that have changed from their initial values.\n * For flat data structures: contains top-level keys (e.g., \"firstName\", \"email\")\n * For nested data structures: contains dotted paths (e.g., \"user.name.first\", \"profile.email\")\n */\n dirty: Set<string>;\n};\n\n/**\n * The context yielded to the default block of the `Form` component.\n */\ninterface FormContext<T = FormDataCompiled> {\n /** The form data as key/value pairs. */\n data?: T;\n /** Whether the form is currently submitting. */\n isLoading: boolean;\n /** Whether the form is valid (i.e. has no validation errors). */\n isValid: boolean;\n /** Whether the form is invalid (i.e. has validation errors). */\n isInvalid: boolean;\n /** The current form validation errors. */\n errors: FormErrors;\n /**\n * The set of fields that have changed from their initial values.\n * For flat data structures: contains top-level keys (e.g., \"firstName\", \"email\")\n * For nested data structures: contains dotted paths (e.g., \"user.name.first\", \"profile.email\")\n */\n dirty: Set<string>;\n /**\n * Resets the form to its initial state.\n * Clears all form fields, validation errors, and dirty tracking.\n */\n reset: () => void;\n /** The `Field` component, with args bound. */\n Field: WithBoundArgs<\n typeof Field,\n 'errors' | 'formData' | 'disabled' | 'validateOn' | 'validateField'\n >;\n}\n\ninterface FormSignature<T = FormDataCompiled> {\n Element: HTMLFormElement;\n Args: {\n /**\n * The standard schema to validate form data against.\n */\n schema?: StandardSchemaV1<T>;\n /**\n * Optional custom validation function. A custom validator should return\n * an array of Standard Schema issues, or `undefined` if there are none.\n * This function may be async or sync.\n */\n validate?: CustomValidatorFn<T>;\n /**\n * When to run validation.\n */\n validateOn?: ('change' | 'input' | 'blur' | 'submit')[];\n /**\n * The initial form data as key/value pairs.\n * This is primarily useful for setting default values in the form.\n * This object receives changes as the user interacts with the form.\n */\n data?: T;\n /**\n * Whether the entire form and all its fields should be disabled. This only\n * applies when using the yielded `Field` component.\n */\n disabled?: boolean;\n /**\n * Optional callback invoked on input changes within the form.\n * @param result - The current form result data.\n * @param event - The input event that triggered the change.\n * @returns A promise or void.\n */\n onChange?: (\n result: FormResultData<T>,\n event: Event\n ) => Promise<void> | void;\n /**\n * Callback invoked on form submission. If `onSubmit` returns a promise,\n * the form will be marked as `isLoading` until the promise resolves.\n * @param result - The current form result data.\n * @param event - The submit event that triggered the submission.\n * @returns A promise or void.\n */\n onSubmit: (\n result: FormResultData<T>,\n event: SubmitEvent\n ) => Promise<void> | void;\n /**\n * Optional callback invoked when validation errors occur on form submission.\n * @param errors - The validation errors found.\n * @param data - The form data that was validated.\n * @param event - The submit event that triggered the validation.\n * @returns A promise or void.\n */\n onError?: (\n errors: FormErrors,\n data: T,\n event: SubmitEvent\n ) => Promise<void> | void;\n };\n Blocks: {\n default: [FormContext<T>];\n };\n}\n\n/**\n * A form component that handles form submissions and input changes.\n *\n * @example\n * ```hbs\n * <Form\n * @data={{this.formData}}\n * @schema={{this.schema}}\n * @validate={{this.customValidator}}\n * @onSubmit={{this.onSubmit}}\n * @onChange={{this.onChange}}\n * as |form|\n * >\n * <form.Field name=\"firstName\" as |field|>\n * <field.Input />\n * </form.Field>\n * <form.Field name=\"lastName\" as |field|>\n * <field.Input />\n * </form.Field>\n * <Button type=\"submit\" @isLoading={{form.isLoading}}>\n * Submit\n * <:loading>Submitting...</:loading>\n * </Button>\n * </Form>\n * ```\n */\nclass Form<T = FormDataCompiled> extends Component<FormSignature<T>> {\n /** Whether the form is currently submitting. */\n @tracked isLoading = false;\n\n /** The current form validation errors. */\n @tracked errors: FormErrors = {};\n\n /** The current uncontrolled form data. */\n @tracked uncontrolledData?: T;\n\n /**\n * Flattened snapshot of initial data for dirty field comparison.\n * Stored in flattened form regardless of whether source data is nested or flat.\n */\n @tracked initialDataSnapshot?: Record<string, unknown>;\n\n /**\n * The set of fields that have changed from their initial values.\n * For flat data structures: contains top-level keys (e.g., \"firstName\", \"email\")\n * For nested data structures: contains dotted paths (e.g., \"user.name.first\", \"profile.email\")\n */\n @tracked dirty: Set<string> = new Set();\n\n /** Reference to the form element. */\n element = ref<HTMLFormElement>();\n\n /**\n * Creates a new instance of the Form component.\n * Initializes internal state based on provided args.\n * @param owner - The owner of the component.\n * @param args - The arguments passed to the component.\n */\n constructor(owner: Owner, args: FormSignature<T>['Args']) {\n super(owner, args);\n // Create copy of initial data\n if (args.data) {\n // Always store flattened snapshot for dirty tracking\n // This ensures consistent comparison regardless of initial structure\n this.initialDataSnapshot = flattenData(\n args.data as Record<string, unknown>\n );\n\n // Keep uncontrolled data in original structure\n this.uncontrolledData = { ...args.data };\n }\n }\n\n /** Whether the form is valid (i.e. has no validation errors). */\n get isValid() {\n return Object.keys(this.errors).length === 0;\n }\n\n /** Whether the form is invalid (i.e. has validation errors). */\n get isInvalid() {\n return !this.isValid;\n }\n\n /** Whether the form is controlled (`onChange` is provided). */\n get isControlled(): boolean {\n return !!this.args.onChange;\n }\n\n /** The events on which validation should run. */\n get validateOn(): ('change' | 'input' | 'blur' | 'submit')[] {\n return this.args.validateOn ?? ['change', 'blur', 'submit'];\n }\n\n /** The events on which field-level validation should run. */\n get fieldValidateOn(): ('change' | 'input' | 'blur')[] {\n return this.validateOn.filter((e) => e !== 'submit');\n }\n\n /** The current form data, from args if controlled, or internal state if uncontrolled. */\n get currentData(): T | undefined {\n if (this.isControlled) {\n return this.args.data;\n }\n return this.uncontrolledData;\n }\n\n /**\n * Validates data against the provided schema using StandardValidator.\n * Updates the `errors` property with any validation errors found.\n *\n * @param data - The form data to validate.\n * @returns A promise that resolves to the validation errors, if any.\n */\n async validate(data: T): Promise<FormErrors | undefined> {\n // Run validator and get issues\n const errors = await StandardValidator.validateAll(\n data,\n this.args.schema,\n this.args.validate\n );\n // Convert validator errors to FormErrors\n if (errors) {\n const formErrors = validatorToFormErrors(errors);\n this.errors = formErrors;\n return formErrors;\n }\n // Clear errors if no issues\n this.errors = {};\n }\n\n /**\n * Validates a single field against the provided schema using\n * StandardValidator. Updates the `errors` property with any validation\n * errors found for the field. If the field had previous errors but\n * is now valid, those errors are cleared.\n *\n * @param data - The form data to validate against.\n * @param name - The name of the field to validate.\n * @returns A promise that resolves to errors for the field, if any.\n */\n @action\n async validateField(data: T, name: string): Promise<FormErrors | undefined> {\n if (!this.args.schema && !this.args.validate) {\n return;\n }\n // Run validator and get issues\n const errors = await StandardValidator.validateFieldAll(\n data,\n name,\n this.args.schema,\n this.args.validate\n );\n // Convert validator errors to FormErrors\n if (errors) {\n const formErrors = validatorToFormErrors(errors);\n if (formErrors[name]) {\n // Merge with existing errors immutably\n this.errors = { ...this.errors, [name]: formErrors[name] };\n }\n return { [name]: formErrors[name] };\n }\n // Clear field error if no issues\n // Remove field error using immutable pattern:\n // 1. Use destructuring to extract the field we want to remove\n // (assigned to '_' since unused)\n // 2. Capture all remaining fields in 'rest' using the spread operator\n // 3. Reassign this.errors to the 'rest' object, effectively removing\n // the field\n // This approach maintains immutability by creating a new object rather than\n // mutating the existing errors object with 'delete'\n if (this.errors[name]) {\n const { [name]: _, ...rest } = this.errors;\n this.errors = rest;\n }\n }\n\n /**\n * Computes which fields have changed from their initial values.\n * Uses deep comparison for consistency across flat and nested structures.\n * This is a pure function with no side effects.\n *\n * @param data - The current form data.\n * @returns A set of field names that have changed.\n */\n computeDirtyFields(data: T): Set<string> {\n const dirty = new Set<string>();\n\n if (!this.initialDataSnapshot) {\n return dirty;\n }\n\n // Flatten current data to same representation as snapshot\n const currentFlat = flattenData(data as Record<string, unknown>);\n\n // Compare all keys in current data\n for (const key in currentFlat) {\n if (!deepEqual(currentFlat[key], this.initialDataSnapshot[key])) {\n dirty.add(key);\n }\n }\n\n // Check for keys in initial data that are missing in current data\n for (const key in this.initialDataSnapshot) {\n if (\n !(key in currentFlat) &&\n this.initialDataSnapshot[key] !== undefined\n ) {\n dirty.add(key);\n }\n }\n\n return dirty;\n }\n\n /**\n * Builds the form result data object to pass to callbacks.\n * Also updates the dirty state as a side effect.\n *\n * @param data - The current form data.\n * @returns The form result data object.\n */\n buildFormResultData(data: T): FormResultData<T> {\n const { isValid, isInvalid, errors } = this;\n const dirty = this.computeDirtyFields(data);\n this.dirty = dirty; // Update tracked state\n return {\n data,\n isValid,\n isInvalid,\n errors,\n dirty\n };\n }\n\n /**\n * Handles the `input` event on the form element.\n * Calls the `onChange` callback with the current form data if provided.\n * Automatically unflattens dotted field names to nested structure.\n */\n @action\n handleInput(event: Event) {\n const form = event.currentTarget;\n if (form instanceof HTMLFormElement) {\n let data = dataFrom(event) as T;\n\n // Always unflatten form data to handle dotted field names\n // This is safe for flat data too - keys without dots remain unchanged\n data = unflattenData(data as Record<string, unknown>) as T;\n\n const resultData = this.buildFormResultData(data);\n this.uncontrolledData = data;\n this.args.onChange?.(resultData, event);\n }\n }\n\n /**\n * Handles the `submit` event on the form element.\n * Prevents the default form submission and calls the `onSubmit` callback\n * with the current form data. Manages the `isLoading` state during the\n * submission process. Automatically unflattens dotted field names to nested structure.\n */\n @action\n async handleSubmit(event: SubmitEvent) {\n event.preventDefault();\n const form = event.currentTarget;\n if (form instanceof HTMLFormElement) {\n this.isLoading = true;\n let data = dataFrom(event) as T;\n\n // Always unflatten form data to handle dotted field names\n // This is safe for flat data too - keys without dots remain unchanged\n data = unflattenData(data as Record<string, unknown>) as T;\n\n let errors: FormErrors | undefined;\n if (this.validateOn.includes('submit')) {\n errors = await this.validate(data);\n }\n\n const resultData = this.buildFormResultData(data);\n this.uncontrolledData = data;\n try {\n if (errors && this.args.onError) {\n // Call onError handler when there are validation errors\n await this.args.onError(errors, data, event);\n } else if (!errors && this.args.onSubmit) {\n // Run `onSubmit` if validation was skipped OR if validation passed\n await this.args.onSubmit(resultData, event);\n // Update snapshot on successful submit (new baseline)\n this.initialDataSnapshot = flattenData(\n data as Record<string, unknown>\n );\n // Clear dirty state since we've updated the baseline\n this.dirty = new Set();\n }\n } finally {\n this.isLoading = false;\n }\n }\n }\n\n /**\n * Handles the `reset` event on the form element.\n * Clears validation errors and dirty tracking.\n * Restores the form data to its initial state.\n * Calls `onChange` if the form is controlled to let parent update state.\n */\n @action\n handleReset(event: Event) {\n // Clear state\n this.errors = {};\n this.dirty = new Set();\n\n // Restore initial data\n if (this.initialDataSnapshot) {\n // Unflatten data if it was nested\n const restoredData = unflattenData(this.initialDataSnapshot) as T;\n\n // For controlled forms, call onChange to let parent update state\n if (this.isControlled && this.args.onChange) {\n const resultData = this.buildFormResultData(restoredData);\n\n this.args.onChange(resultData, event);\n } else {\n // For uncontrolled forms, update internal state\n this.uncontrolledData = restoredData;\n }\n } else {\n // No initial data, just clear uncontrolled data\n this.uncontrolledData = undefined;\n }\n }\n\n /**\n * Resets the form to its initial state.\n * This method calls the native form reset() to clear all form controls,\n * triggering a `reset` event that is handled in `handleReset`.\n */\n @action\n reset() {\n this.element?.current?.reset();\n }\n\n <template>\n {{! @glint-nocheck component generics (field) trigger: type instantiation is excessively deep and possibly infinite }}\n <form\n {{this.element.setup}}\n {{on \"input\" this.handleInput}}\n {{on \"submit\" this.handleSubmit}}\n {{on \"reset\" this.handleReset}}\n ...attributes\n >\n {{yield\n (hash\n data=this.currentData\n isLoading=this.isLoading\n isValid=this.isValid\n isInvalid=this.isInvalid\n errors=this.errors\n dirty=this.dirty\n reset=this.reset\n Field=(component\n Field\n errors=this.errors\n formData=this.currentData\n disabled=@disabled\n validateOn=this.fieldValidateOn\n validateField=this.validateField\n )\n )\n to=\"default\"\n }}\n </form>\n </template>\n}\n\n/**\n * Helper function.\n * Converts validation type `Issues` from StandardValidator into a format\n * suitable for the form component, type `FormErrors`.\n *\n * For example, an issue with path `['email']` will be converted\n * to a form error for the field `email`, `{\"email\": \"error message\" }`.\n * Numeric path segments are kept, so an issue with path\n * `['items', 0, 'name']` becomes `{\"items.0.name\": \"error message\"}`.\n *\n * @param errors - The validation issues to convert.\n * @returns A mapping of field names to their validation error messages.\n */\nfunction validatorToFormErrors(errors: Issues): FormErrors {\n const formErrors: FormErrors = {};\n\n for (const issue of errors) {\n if (!issue.path || issue.path.length === 0) continue;\n\n // `issuePathToFieldName` is shared with\n // `StandardValidator.filterFieldIssues`, so the keys written here are\n // by construction the dotted names field lookup resolves against.\n const fieldName = issuePathToFieldName(issue);\n const message = issue.message;\n\n // Add message to the field's errors\n const existing = formErrors[fieldName];\n if (existing === undefined) {\n formErrors[fieldName] = message;\n } else if (Array.isArray(existing)) {\n existing.push(message);\n } else {\n formErrors[fieldName] = [existing, message];\n }\n }\n\n return formErrors;\n}\n\nexport {\n Form,\n type FormContext,\n type FormSignature,\n type FormDataCompiled,\n type FormResultData,\n type FormErrors\n};\nexport default Form;\n"],"names":["Form","Component","g","prototype","tracked","i","Set","element","ref","constructor","owner","args","data","initialDataSnapshot","flattenData","uncontrolledData","isValid","Object","keys","errors","length","isInvalid","isControlled","onChange","validateOn","fieldValidateOn","filter","e","currentData","validate","StandardValidator","validateAll","schema","formErrors","validatorToFormErrors","validateField","name","validateFieldAll","_","rest","n","action","computeDirtyFields","dirty","currentFlat","key","deepEqual","add","undefined","buildFormResultData","handleInput","event","form","currentTarget","HTMLFormElement","dataFrom","unflattenData","resultData","handleSubmit","preventDefault","isLoading","includes","onError","onSubmit","handleReset","restoredData","reset","current","setComponentTemplate","precompileTemplate","strictMode","scope","on","hash","Field","issue","path","fieldName","issuePathToFieldName","message","existing","Array","isArray","push"],"mappings":";;;;;;;;;;;;;;AAgJA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBC;AACD,MAAMA,IAAA,SAAmCC,UAAwB;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CAE9DC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAoB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,UAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAA,MAAA;AADrB;AAAA,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CAICC,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AA,CAAA;AAAA;AAKD,EAAA;IAAA2B,oBAAA,CAAAC,kBAAA,CAAA,ymBAAA,EA8BA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,EAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;AAEA;;;;;;;;;;;;AAYC;AACD,SAASxC,qBAAAA,CAAsBf,MAAc,EAAG;EAC9C,MAAMc,aAAyB,EAAC;AAEhC,EAAA,KAAK,MAAM0C,SAASxD,MAAA,EAAQ;AAC1B,IAAA,IAAI,CAACwD,MAAMC,IAAI,IAAID,MAAMC,IAAI,CAACxD,MAAM,KAAK,CAAA,EAAG;AAE5C;AACA;AACA;AACA,IAAA,MAAMyD,YAAYC,oBAAA,CAAqBH,KAAA,CAAA;AACvC,IAAA,MAAMI,OAAA,GAAUJ,MAAMI,OAAO;AAE7B;AACA,IAAA,MAAMC,QAAA,GAAW/C,UAAU,CAAC4C,SAAA,CAAU;IACtC,IAAIG,aAAahC,SAAA,EAAW;AAC1Bf,MAAAA,UAAU,CAAC4C,UAAU,GAAGE,OAAA;IAC1B,CAAA,MAAO,IAAIE,KAAA,CAAMC,OAAO,CAACF,QAAA,CAAA,EAAW;AAClCA,MAAAA,QAAA,CAASG,IAAI,CAACJ,OAAA,CAAA;AAChB,IAAA,CAAA,MAAO;MACL9C,UAAU,CAAC4C,UAAU,GAAG,CAACG,QAAA,EAAUD,OAAA,CAAQ;AAC7C,IAAA;AACF,EAAA;AAEA,EAAA,OAAO9C,UAAA;AACT;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"input-otp.js","sources":["../../../src/components/forms/input-otp.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport { warn } from '@ember/debug';\nimport { next } from '@ember/runloop';\nimport { modifier } from 'ember-modifier';\nimport {\n useStyles,\n type InputOtpSlots,\n type InputOtpVariants,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport { ref } from '../../utils/ref';\n\n/**\n * These must match PARTIAL values. A pattern anchored to the full length --\n * `/^\\d{6}$/` -- rejects the very first keystroke and makes the field\n * impossible to type into.\n */\nconst OTP_PATTERNS = {\n digits: /^\\d+$/,\n letters: /^[a-zA-Z]+$/,\n alphanumeric: /^[a-zA-Z0-9]+$/\n} as const;\n\ntype AllowedChars = keyof typeof OTP_PATTERNS;\n\n/**\n * The on-screen keyboard and autocapitalisation each character set implies.\n *\n * `tel` is deliberately not offered: its keypad carries `*`, `#` and pause\n * characters that every one of our patterns rejects.\n */\nconst OTP_INPUT_HINTS = {\n digits: { inputMode: 'numeric', autoCapitalize: 'off' },\n letters: { inputMode: 'text', autoCapitalize: 'characters' },\n alphanumeric: { inputMode: 'text', autoCapitalize: 'characters' }\n} as const satisfies Record<\n AllowedChars,\n { inputMode: 'numeric' | 'text'; autoCapitalize: 'off' | 'characters' }\n>;\n\ninterface Cell {\n index: number;\n /** What the cell actually draws: the character, a mask, or a placeholder. */\n displayChar: string | null;\n isActive: boolean;\n hasFakeCaret: boolean;\n}\n\ninterface Args extends FormControlSharedArgs {\n /**\n * How many characters the code has. Also the input's `maxlength`.\n *\n * @defaultValue 6\n */\n length?: number;\n\n /**\n * The name attribute of the underlying input, used when the code is\n * submitted as part of a form.\n */\n name?: string;\n\n /**\n * Which characters the code may contain. Also decides the on-screen keyboard\n * (`inputmode`) and autocapitalisation.\n *\n * @defaultValue 'digits'\n */\n allowedChars?: AllowedChars;\n\n /**\n * A custom character rule, overriding `allowedChars`. It is tested against\n * every intermediate value, so it must accept partial input: `/^\\d+$/`, not\n * `/^\\d{6}$/`.\n */\n pattern?: RegExp;\n\n /**\n * The size of the cells and the label.\n *\n * @defaultValue 'md'\n */\n size?: InputOtpVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<InputOtpSlots>;\n\n /**\n * The value of the input. Pair with `onInput` or `onChange` to control the\n * input; leave it unset to let the component track its own value.\n */\n value?: string;\n\n /**\n * Callback when oninput is triggered.\n */\n onInput?: (value: string, event?: Event) => void;\n\n /**\n * Callback when onchange is triggered.\n */\n onChange?: (value: string, event?: Event) => void;\n\n /**\n * Callback when onblur is triggered.\n */\n onBlur?: () => void;\n\n /**\n * Called when the code becomes complete. Fires on the transition from a\n * shorter value to exactly `length` characters, so re-rendering an already\n * full value does not fire it again.\n */\n onComplete?: (value: string) => void;\n\n /**\n * Splits the cells into visual groups, e.g. `[3, 3]` for a six-digit code.\n * Omit it for a single group. Entries that do not sum to `length` warn in\n * development; the groups then run out of cells or take a final group of the\n * remainder, so exactly `length` cells render either way.\n */\n groups?: number[];\n\n /**\n * The character shown between groups. Rendered `aria-hidden`, because the\n * value itself contains no separator.\n *\n * @defaultValue '–'\n */\n separator?: string;\n\n /**\n * Renders a bullet in place of each entered character. The real input's text\n * is already transparent, so this is purely what the cells draw -- the input\n * stays `type=\"text\"`, which `type=\"password\"` would break for autofill.\n *\n * @defaultValue false\n */\n isMasked?: boolean;\n\n /**\n * Characters shown in empty cells before anything is entered. Also exposed as\n * `aria-placeholder`.\n */\n placeholder?: string;\n}\n\ninterface InputOtpSignature {\n Args: Args;\n Element: HTMLInputElement;\n}\n\n/**\n * Ownership model, stated once.\n *\n * The `<input>` element is the source of truth for what the user typed -- the\n * browser guarantees that -- so a parent-owned `@value` is *written down into*\n * it (by `syncFromValueArg` and `reconcileWithParent`) rather than bound over\n * it with `value={{...}}`.\n *\n * That binding is what broke typing inside a `<Form>`. `elementValue` is\n * dirtied mid-dispatch and the template reads it (through `cellGroups`), so\n * Glimmer revalidates in a microtask that runs *between* event listeners --\n * rewriting the `value` attribute from a still-stale `@value` before the\n * `input` event had finished bubbling to the `<form>`, wiping the keystroke and\n * handing `<Form>` an empty value to store.\n *\n * The one invariant that keeps the mirror honest: every code path that writes\n * `element.value` goes through `writeValue`, which re-derives the selection\n * mirror straight afterwards.\n */\nclass InputOtp extends Component<InputOtpSignature> {\n /** What the element holds, and what the cells draw. */\n @tracked elementValue: string = this.args.value || '';\n\n @tracked isFocused = false;\n @tracked selectionStart: number | null = null;\n @tracked selectionEnd: number | null = null;\n\n /**\n * The previous selection. The selection API cannot tell us which side of a\n * character boundary the user meant, so direction is inferred by comparing\n * against where the caret was a moment ago.\n */\n prevSelection: [number | null, number | null] = [null, null];\n\n /**\n * `selectionchange` only fires on `document`, and capture phase keeps us\n * ahead of anything else listening.\n */\n inputRef = ref<HTMLInputElement>((element) => {\n if (element) {\n document.addEventListener('selectionchange', this.onSelectionChange, {\n capture: true\n });\n } else {\n document.removeEventListener('selectionchange', this.onSelectionChange, {\n capture: true\n });\n }\n });\n\n get length(): number {\n return this.args.length ?? 6;\n }\n\n get allowedChars(): AllowedChars {\n return this.args.allowedChars ?? 'digits';\n }\n\n get pattern(): RegExp {\n return this.args.pattern ?? OTP_PATTERNS[this.allowedChars];\n }\n\n get inputMode(): 'numeric' | 'text' {\n return OTP_INPUT_HINTS[this.allowedChars].inputMode;\n }\n\n get autoCapitalize(): 'off' | 'characters' {\n return OTP_INPUT_HINTS[this.allowedChars].autoCapitalize;\n }\n\n /**\n * The only way the element's value is ever written. Keeping the element, the\n * mirror of its value and the mirror of its selection in step here is what\n * lets every reader downstream just read them.\n */\n writeValue(element: HTMLInputElement, value: string): void {\n // Assigning to `value` resets the selection even when the string is\n // unchanged, so a redundant write is not merely wasteful.\n if (element.value !== value) {\n element.value = value;\n }\n\n // Deliberately unguarded: `syncFromValueArg` reaches here from inside a\n // modifier, and reading `elementValue` there would consume it into the same\n // computation that then writes it -- which Glimmer rejects outright.\n this.elementValue = value;\n\n // No browser fires `selectionchange` for a programmatic write (nor for a\n // deletion or a cut), so the mirror is re-derived by hand. It is a no-op\n // while the input is not focused, which is exactly right.\n this.onSelectionChange();\n }\n\n /**\n * Writes a parent-owned value down into the element. A modifier re-runs only\n * when its tracked arguments actually change, so a `@value` that is merely\n * lagging behind what the user typed never re-runs this and never clobbers a\n * keystroke.\n */\n syncFromValueArg = modifier(\n (element: HTMLInputElement, [value]: [string | undefined]) => {\n if (typeof value === 'string' && value !== element.value) {\n this.writeValue(element, value);\n }\n }\n );\n\n /**\n * Gives a controlled parent the last word on an edit -- but only once the\n * `input` (or `change`) event has finished travelling.\n *\n * A parent that has been told the new value and still holds a different one\n * has *rejected* it, and controlled semantics say its value wins. A parent\n * that has not caught up yet has not rejected anything, and the two are\n * indistinguishable from `@value` at the moment we notify: `<Form>` updates\n * its data from a handler on the `<form>` element, which runs after ours.\n * Waiting for the dispatch to finish is what separates them.\n */\n reconcileWithParent(element: HTMLInputElement, emitted: string): void {\n next(this, () => {\n if (this.isDestroying || this.isDestroyed) {\n return;\n }\n\n const { value } = this.args;\n\n // Anything typed since this was scheduled wins: it is a later edit, with\n // a reconciliation of its own already on its way.\n if (\n typeof value !== 'string' ||\n value === emitted ||\n element.value !== emitted\n ) {\n return;\n }\n\n this.writeValue(element, value);\n });\n }\n\n /** The selection mirror, kept in step by `writeValue`. */\n get mirroredSelection(): [number | null, number | null] {\n return [this.selectionStart, this.selectionEnd];\n }\n\n get separator(): string {\n return this.args.separator ?? '–';\n }\n\n /**\n * Cell counts per group. A mismatched `@groups` warns in development and\n * still renders `length` cells, so development and production behave the\n * same way.\n */\n get groupSizes(): number[] {\n const { groups } = this.args;\n\n if (!groups || groups.length === 0) {\n return [this.length];\n }\n\n const total = groups.reduce((sum, size) => sum + size, 0);\n\n if (total !== this.length) {\n warn(\n `<InputOtp>: @groups must sum to @length (${this.length}), got ${total}. ` +\n `Rendering ${this.length} cells and adjusting the groups to fit.`,\n false,\n { id: 'frontile.input-otp.groups-mismatch' }\n );\n }\n\n return groups;\n }\n\n get cellGroups(): Cell[][] {\n const value = this.elementValue;\n const cells: Cell[] = [];\n\n const [start, end] = this.mirroredSelection;\n\n for (let index = 0; index < this.length; index++) {\n const char = value[index] ?? null;\n // The placeholder is an all-or-nothing preview: it survives only while\n // nothing at all has been entered.\n const placeholderChar =\n value.length === 0 ? (this.args.placeholder?.[index] ?? null) : null;\n\n let displayChar: string | null = placeholderChar;\n if (char !== null) {\n displayChar = this.args.isMasked ? '•' : char;\n }\n\n // A range selection lights up every cell it covers -- that is correct,\n // not a bug.\n const isActive =\n this.isFocused &&\n start !== null &&\n end !== null &&\n ((start === end && index === start) || (index >= start && index < end));\n\n cells.push({\n index,\n displayChar,\n isActive,\n hasFakeCaret: isActive && char === null\n });\n }\n\n // `slice` clamps on its own, so a `@groups` that overshoots simply runs out\n // of cells; anything left over becomes a final group. Either way exactly\n // `length` cells render.\n const groups: Cell[][] = [];\n let offset = 0;\n\n for (const size of this.groupSizes) {\n if (offset >= cells.length) {\n break;\n }\n if (size <= 0) {\n continue;\n }\n groups.push(cells.slice(offset, offset + size));\n offset += size;\n }\n\n if (offset < cells.length) {\n groups.push(cells.slice(offset));\n }\n\n return groups;\n }\n\n @cached\n get classes() {\n const { inputOtp } = useStyles();\n return inputOtp({ size: this.args.size });\n }\n\n /**\n * Both `input` and `change` funnel through here so the element, our mirror of\n * it, and the parent never disagree about the value.\n */\n syncValue(event: Event, notify: 'input' | 'change'): void {\n const element = event.target as HTMLInputElement;\n const next = element.value.slice(0, this.length);\n\n // The value as it stood before this edit, read before anything is mutated.\n const previous = this.elementValue;\n\n // All-or-nothing: a value that fails the rule is dropped whole rather than\n // filtered, so a pasted \"123-456\" never silently becomes \"123456\".\n if (next.length > 0 && !this.pattern.test(next)) {\n this.writeValue(element, previous);\n return;\n }\n\n this.writeValue(element, next);\n\n // Only a parent that was actually told gets a say in the reconciliation --\n // an `@onChange`-only parent is not credited with knowing about an `input`\n // it never heard.\n const notifyParent =\n notify === 'input' ? this.args.onInput : this.args.onChange;\n\n if (notifyParent) {\n notifyParent(next, event);\n this.reconcileWithParent(element, next);\n }\n\n if (\n next !== previous &&\n previous.length < this.length &&\n next.length === this.length\n ) {\n this.args.onComplete?.(next);\n }\n }\n\n @action handleOnInput(event: Event): void {\n this.syncValue(event, 'input');\n }\n\n @action handleOnChange(event: Event): void {\n this.syncValue(event, 'change');\n }\n\n /**\n * Maps the input's text caret onto discrete cells. A collapsed caret sits\n * between characters and so belongs to no cell; widening it to a\n * one-character range makes exactly one cell active and makes typing\n * overwrite rather than insert.\n */\n @action onSelectionChange(): void {\n const input = this.inputRef.current;\n if (!input || document.activeElement !== input) {\n return;\n }\n\n const value = input.value;\n const maxLength = this.length;\n const caretStart = input.selectionStart;\n const caretEnd = input.selectionEnd;\n\n if (caretStart === null || caretEnd === null) {\n return;\n }\n\n let start = -1;\n let end = -1;\n let direction: 'forward' | 'backward' | 'none' =\n input.selectionDirection ?? 'none';\n\n const isSingleCaret = caretStart === caretEnd;\n // Appending to a not-yet-full code: leave the caret collapsed, or the next\n // keystroke would replace the character before it instead of adding one.\n const isInsertMode =\n caretStart === value.length && value.length < maxLength;\n\n if (isSingleCaret && !isInsertMode) {\n const caret = caretStart;\n\n if (caret === 0) {\n start = 0;\n end = 1;\n direction = 'forward';\n } else if (caret === maxLength) {\n start = caret - 1;\n end = caret;\n direction = 'backward';\n } else if (maxLength > 1 && value.length > 1) {\n let offset = 0;\n const [prevStart, prevEnd] = this.prevSelection;\n\n if (prevStart !== null && prevEnd !== null) {\n direction = caret < prevEnd ? 'backward' : 'forward';\n const wasInserting = prevStart === prevEnd && prevStart < maxLength;\n // Without this, ArrowLeft appears to skip a cell -- except when\n // leaving append mode, where the shift would overshoot.\n if (direction === 'backward' && !wasInserting) {\n offset = -1;\n }\n }\n\n start = offset + caret;\n end = offset + caret + 1;\n }\n }\n\n if (start !== -1 && end !== -1 && start !== end) {\n input.setSelectionRange(start, end, direction);\n }\n\n // `selectionchange` fires several times per keystroke; writing an identical\n // value would still dirty the tag and rebuild every cell. The comparison\n // goes through the untracked `prevSelection`, which holds exactly what was\n // last mirrored -- reading the tracked fields here would consume them into\n // the modifier computation that `writeValue` calls this from.\n const [lastStart, lastEnd] = this.prevSelection;\n\n if (lastStart !== input.selectionStart) {\n this.selectionStart = input.selectionStart;\n }\n\n if (lastEnd !== input.selectionEnd) {\n this.selectionEnd = input.selectionEnd;\n }\n\n this.prevSelection = [input.selectionStart, input.selectionEnd];\n }\n\n @action handleFocus(): void {\n this.isFocused = true;\n\n const input = this.inputRef.current;\n if (!input) {\n return;\n }\n\n // Park on the last cell rather than past the end of a full code.\n const start = Math.min(input.value.length, this.length - 1);\n input.setSelectionRange(start, input.value.length);\n this.onSelectionChange();\n }\n\n @action handleOnBlur(): void {\n this.isFocused = false;\n this.selectionStart = null;\n this.selectionEnd = null;\n this.prevSelection = [null, null];\n this.args.onBlur?.();\n }\n\n <template>\n <FormControl\n @size={{@size}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n data-component=\"input-otp\"\n data-part=\"base\"\n as |c|\n >\n {{! Chrome's translate feature rewrites the cell text nodes, wrapping\n them in <font> elements that Glimmer then tries to update. }}\n <div\n class={{this.classes.container class=@classes.container}}\n data-part=\"container\"\n translate=\"no\"\n >\n {{#each this.cellGroups key=\"@index\" as |group groupIndex|}}\n {{#if groupIndex}}\n <div\n class={{this.classes.separator class=@classes.separator}}\n data-part=\"separator\"\n aria-hidden=\"true\"\n >{{this.separator}}</div>\n {{/if}}\n <div\n class={{this.classes.group class=@classes.group}}\n data-part=\"group\"\n >\n {{#each group key=\"index\" as |cell|}}\n <div\n class={{this.classes.cell\n class=@classes.cell\n isActive=cell.isActive\n isInvalid=c.isInvalid\n isDisabled=@isDisabled\n }}\n data-part=\"cell\"\n data-active={{if cell.isActive \"true\"}}\n aria-hidden=\"true\"\n >\n <span\n class={{this.classes.cellChar class=@classes.cellChar}}\n data-part=\"cell-char\"\n >\n {{cell.displayChar}}\n </span>\n {{#if cell.hasFakeCaret}}\n {{! Never the only focus affordance -- under\n prefers-reduced-motion it stops blinking and reads as a\n static bar, so the active cell also rings. }}\n <span\n class={{this.classes.caret class=@classes.caret}}\n data-part=\"caret\"\n ></span>\n {{/if}}\n </div>\n {{/each}}\n </div>\n {{/each}}\n\n {{! False positive in no-unsupported-role-attributes\n (ember-template-lint 7.9.3). Its getImplicitRole helper matches an\n aria-query key on the type attribute alone and ignores that key's\n other constraints, so a plain text input resolves to the\n list-bearing combobox entry instead of textbox. This input has no\n list attribute, so textbox is its real implicit role, and textbox\n does support aria-placeholder. The rule is disabled for this\n element only, so its autofixer cannot silently delete\n aria-placeholder when someone runs pnpm lint:hbs --fix. See the\n @placeholder test in input-otp-test.gts. }}\n {{! template-lint-disable no-unsupported-role-attributes }}\n <input\n {{this.inputRef.setup}}\n {{this.syncFromValueArg @value}}\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n {{on \"focus\" this.handleFocus}}\n {{on \"blur\" this.handleOnBlur}}\n id={{c.id}}\n name={{@name}}\n type=\"text\"\n maxlength={{this.length}}\n disabled={{@isDisabled}}\n class={{this.classes.input class=@classes.input}}\n data-part=\"input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n aria-placeholder={{@placeholder}}\n autocomplete=\"one-time-code\"\n inputmode={{this.inputMode}}\n pattern={{this.pattern.source}}\n autocapitalize={{this.autoCapitalize}}\n autocorrect=\"off\"\n spellcheck=\"false\"\n ...attributes\n />\n {{! template-lint-enable no-unsupported-role-attributes }}\n </div>\n </FormControl>\n </template>\n}\n\nexport { InputOtp, type InputOtpSignature };\nexport default InputOtp;\n"],"names":["OTP_PATTERNS","digits","letters","alphanumeric","OTP_INPUT_HINTS","inputMode","autoCapitalize","InputOtp","Component","g","prototype","tracked","args","value","i","prevSelection","inputRef","ref","element","document","addEventListener","onSelectionChange","capture","removeEventListener","length","allowedChars","pattern","writeValue","elementValue","syncFromValueArg","modifier","reconcileWithParent","emitted","next","isDestroying","isDestroyed","mirroredSelection","selectionStart","selectionEnd","separator","groupSizes","groups","total","reduce","sum","size","warn","id","cellGroups","cells","start","end","index","char","placeholderChar","placeholder","displayChar","isMasked","isActive","isFocused","push","hasFakeCaret","offset","slice","classes","inputOtp","useStyles","n","cached","syncValue","event","notify","target","previous","test","notifyParent","onInput","onChange","onComplete","handleOnInput","action","handleOnChange","input","current","activeElement","maxLength","caretStart","caretEnd","direction","selectionDirection","isSingleCaret","isInsertMode","caret","prevStart","prevEnd","wasInserting","setSelectionRange","lastStart","lastEnd","handleFocus","Math","min","handleOnBlur","onBlur","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAMA,YAAA,GAAe;AACnBC,EAAAA,MAAA,EAAQ,OAAA;AACRC,EAAAA,OAAA,EAAS,aAAA;AACTC,EAAAA,YAAA,EAAc;AAChB,CAAA;AAIA;;;;;AAKC;AACD,MAAMC,eAAA,GAAkB;AACtBH,EAAAA,MAAA,EAAQ;AAAEI,IAAAA,SAAA,EAAW,SAAA;AAAWC,IAAAA,cAAA,EAAgB;GAAM;AACtDJ,EAAAA,OAAA,EAAS;AAAEG,IAAAA,SAAA,EAAW,MAAA;AAAQC,IAAAA,cAAA,EAAgB;GAAa;AAC3DH,EAAAA,YAAA,EAAc;AAAEE,IAAAA,SAAA,EAAW,MAAA;AAAQC,IAAAA,cAAA,EAAgB;AAAa;AAClE;AAuHA;;;;;;;;;;;;;;;;;;;AAmBA,MAAMC,iBAAiBC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CAE9BC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAA+B,IAAI,CAACC,IAAI,CAACC,KAAK,IAAI,EAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,aAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,cAAA,CAAA,EAAA,MAAA;AADnD;AAAA,EAAA;IAAAL,eAAA,CAAA,IAA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rE,KAAK,CAACW,MAAM,EAAE,IAAI,CAACA,MAAM,GAAG,CAAA,CAAA;IACzD0D,KAAA,CAAMc,iBAAiB,CAAC9C,KAAA,EAAOgC,KAAA,CAAMrE,KAAK,CAACW,MAAM,CAAA;IACjD,IAAI,CAACH,iBAAiB,EAAA;AACxB,EAAA;AAAA,EAAA;IAAA8C,gBAAA,CAAA,IAAA,CAAAzD,SAAA,EAAA,aAAA,EAAA,CAZCsE,MAAA,CAAA,CAAA;AAAA;AAcOsB,EAAAA,YAAAA,GAAqB;IAC3B,IAAI,CAAC3C,SAAS,GAAG,KAAA;IACjB,IAAI,CAACtB,cAAc,GAAG,IAAA;IACtB,IAAI,CAACC,YAAY,GAAG,IAAA;AACpB,IAAA,IAAI,CAACvB,aAAa,GAAG,CAAC,IAAA,EAAM,IAAA,CAAK;AACjC,IAAA,IAAI,CAACH,IAAI,CAAC2F,MAAM,IAAA;AAClB,EAAA;AAAA,EAAA;IAAApC,gBAAA,CAAA,IAAA,CAAAzD,SAAA,EAAA,cAAA,EAAA,CANCsE,MAAA,CAAA,CAAA;AAAA;AAQD,EAAA;IAAAwB,oBAAA,CAAAC,kBAAA,CAAA,6qGAAA,EAuGA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"input-otp.js","sources":["../../../src/components/forms/input-otp.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport { warn } from '@ember/debug';\nimport { next } from '@ember/runloop';\nimport { modifier } from 'ember-modifier';\nimport {\n useStyles,\n type InputOtpSlots,\n type InputOtpVariants,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport { ref } from '../../utils/ref';\n\n/**\n * These must match PARTIAL values. A pattern anchored to the full length --\n * `/^\\d{6}$/` -- rejects the very first keystroke and makes the field\n * impossible to type into.\n */\nconst OTP_PATTERNS = {\n digits: /^\\d+$/,\n letters: /^[a-zA-Z]+$/,\n alphanumeric: /^[a-zA-Z0-9]+$/\n} as const;\n\ntype AllowedChars = keyof typeof OTP_PATTERNS;\n\n/**\n * The on-screen keyboard and autocapitalisation each character set implies.\n *\n * `tel` is deliberately not offered: its keypad carries `*`, `#` and pause\n * characters that every one of our patterns rejects.\n */\nconst OTP_INPUT_HINTS = {\n digits: { inputMode: 'numeric', autoCapitalize: 'off' },\n letters: { inputMode: 'text', autoCapitalize: 'characters' },\n alphanumeric: { inputMode: 'text', autoCapitalize: 'characters' }\n} as const satisfies Record<\n AllowedChars,\n { inputMode: 'numeric' | 'text'; autoCapitalize: 'off' | 'characters' }\n>;\n\ninterface Cell {\n index: number;\n /** What the cell actually draws: the character, a mask, or a placeholder. */\n displayChar: string | null;\n isActive: boolean;\n hasFakeCaret: boolean;\n}\n\ninterface Args extends FormControlSharedArgs {\n /**\n * How many characters the code has. Also the input's `maxlength`.\n *\n * @defaultValue 6\n */\n length?: number;\n\n /**\n * The name attribute of the underlying input, used when the code is\n * submitted as part of a form.\n */\n name?: string;\n\n /**\n * Which characters the code may contain. Also decides the on-screen keyboard\n * (`inputmode`) and autocapitalisation.\n *\n * @defaultValue 'digits'\n */\n allowedChars?: AllowedChars;\n\n /**\n * A custom character rule, overriding `allowedChars`. It is tested against\n * every intermediate value, so it must accept partial input: `/^\\d+$/`, not\n * `/^\\d{6}$/`.\n */\n pattern?: RegExp;\n\n /**\n * The size of the cells and the label.\n *\n * @defaultValue 'md'\n */\n size?: InputOtpVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<InputOtpSlots>;\n\n /**\n * The value of the input. Pair with `onInput` or `onChange` to control the\n * input; leave it unset to let the component track its own value.\n */\n value?: string;\n\n /**\n * Callback when oninput is triggered.\n */\n onInput?: (value: string, event?: Event) => void;\n\n /**\n * Callback when onchange is triggered.\n */\n onChange?: (value: string, event?: Event) => void;\n\n /**\n * Callback when onblur is triggered.\n */\n onBlur?: () => void;\n\n /**\n * Called when the code becomes complete. Fires on the transition from a\n * shorter value to exactly `length` characters, so re-rendering an already\n * full value does not fire it again.\n */\n onComplete?: (value: string) => void;\n\n /**\n * Splits the cells into visual groups, e.g. `[3, 3]` for a six-digit code.\n * Omit it for a single group. Entries that do not sum to `length` warn in\n * development; the groups then run out of cells or take a final group of the\n * remainder, so exactly `length` cells render either way.\n */\n groups?: number[];\n\n /**\n * The character shown between groups. Rendered `aria-hidden`, because the\n * value itself contains no separator.\n *\n * @defaultValue '–'\n */\n separator?: string;\n\n /**\n * Renders a bullet in place of each entered character. The real input's text\n * is already transparent, so this is purely what the cells draw -- the input\n * stays `type=\"text\"`, which `type=\"password\"` would break for autofill.\n *\n * @defaultValue false\n */\n isMasked?: boolean;\n\n /**\n * Characters shown in empty cells before anything is entered. Also exposed as\n * `aria-placeholder`.\n */\n placeholder?: string;\n}\n\ninterface InputOtpSignature {\n Args: Args;\n Element: HTMLInputElement;\n}\n\n/**\n * Ownership model, stated once.\n *\n * The `<input>` element is the source of truth for what the user typed -- the\n * browser guarantees that -- so a parent-owned `@value` is *written down into*\n * it (by `syncFromValueArg` and `reconcileWithParent`) rather than bound over\n * it with `value={{...}}`.\n *\n * That binding is what broke typing inside a `<Form>`. `elementValue` is\n * dirtied mid-dispatch and the template reads it (through `cellGroups`), so\n * Glimmer revalidates in a microtask that runs *between* event listeners --\n * rewriting the `value` attribute from a still-stale `@value` before the\n * `input` event had finished bubbling to the `<form>`, wiping the keystroke and\n * handing `<Form>` an empty value to store.\n *\n * The one invariant that keeps the mirror honest: every code path that writes\n * `element.value` goes through `writeValue`, which re-derives the selection\n * mirror straight afterwards.\n */\nclass InputOtp extends Component<InputOtpSignature> {\n /** What the element holds, and what the cells draw. */\n @tracked elementValue: string = this.args.value || '';\n\n @tracked isFocused = false;\n @tracked selectionStart: number | null = null;\n @tracked selectionEnd: number | null = null;\n\n /**\n * The previous selection. The selection API cannot tell us which side of a\n * character boundary the user meant, so direction is inferred by comparing\n * against where the caret was a moment ago.\n */\n prevSelection: [number | null, number | null] = [null, null];\n\n /**\n * `selectionchange` only fires on `document`, and capture phase keeps us\n * ahead of anything else listening.\n */\n inputRef = ref<HTMLInputElement>((element) => {\n if (element) {\n document.addEventListener('selectionchange', this.onSelectionChange, {\n capture: true\n });\n } else {\n document.removeEventListener('selectionchange', this.onSelectionChange, {\n capture: true\n });\n }\n });\n\n get length(): number {\n return this.args.length ?? 6;\n }\n\n get allowedChars(): AllowedChars {\n return this.args.allowedChars ?? 'digits';\n }\n\n get pattern(): RegExp {\n return this.args.pattern ?? OTP_PATTERNS[this.allowedChars];\n }\n\n get inputMode(): 'numeric' | 'text' {\n return OTP_INPUT_HINTS[this.allowedChars].inputMode;\n }\n\n get autoCapitalize(): 'off' | 'characters' {\n return OTP_INPUT_HINTS[this.allowedChars].autoCapitalize;\n }\n\n /**\n * The only way the element's value is ever written. Keeping the element, the\n * mirror of its value and the mirror of its selection in step here is what\n * lets every reader downstream just read them.\n */\n writeValue(element: HTMLInputElement, value: string): void {\n // Assigning to `value` resets the selection even when the string is\n // unchanged, so a redundant write is not merely wasteful.\n if (element.value !== value) {\n element.value = value;\n }\n\n // Deliberately unguarded: `syncFromValueArg` reaches here from inside a\n // modifier, and reading `elementValue` there would consume it into the same\n // computation that then writes it -- which Glimmer rejects outright.\n this.elementValue = value;\n\n // No browser fires `selectionchange` for a programmatic write (nor for a\n // deletion or a cut), so the mirror is re-derived by hand. It is a no-op\n // while the input is not focused, which is exactly right.\n this.onSelectionChange();\n }\n\n /**\n * Writes a parent-owned value down into the element. A modifier re-runs only\n * when its tracked arguments actually change, so a `@value` that is merely\n * lagging behind what the user typed never re-runs this and never clobbers a\n * keystroke.\n */\n syncFromValueArg = modifier(\n (element: HTMLInputElement, [value]: [string | undefined]) => {\n if (typeof value === 'string' && value !== element.value) {\n this.writeValue(element, value);\n }\n }\n );\n\n /**\n * Gives a controlled parent the last word on an edit -- but only once the\n * `input` (or `change`) event has finished travelling.\n *\n * A parent that has been told the new value and still holds a different one\n * has *rejected* it, and controlled semantics say its value wins. A parent\n * that has not caught up yet has not rejected anything, and the two are\n * indistinguishable from `@value` at the moment we notify: `<Form>` updates\n * its data from a handler on the `<form>` element, which runs after ours.\n * Waiting for the dispatch to finish is what separates them.\n */\n reconcileWithParent(element: HTMLInputElement, emitted: string): void {\n next(this, () => {\n if (this.isDestroying || this.isDestroyed) {\n return;\n }\n\n const { value } = this.args;\n\n // Anything typed since this was scheduled wins: it is a later edit, with\n // a reconciliation of its own already on its way.\n if (\n typeof value !== 'string' ||\n value === emitted ||\n element.value !== emitted\n ) {\n return;\n }\n\n this.writeValue(element, value);\n });\n }\n\n /** The selection mirror, kept in step by `writeValue`. */\n get mirroredSelection(): [number | null, number | null] {\n return [this.selectionStart, this.selectionEnd];\n }\n\n get separator(): string {\n return this.args.separator ?? '–';\n }\n\n /**\n * Cell counts per group. A mismatched `@groups` warns in development and\n * still renders `length` cells, so development and production behave the\n * same way.\n */\n get groupSizes(): number[] {\n const { groups } = this.args;\n\n if (!groups || groups.length === 0) {\n return [this.length];\n }\n\n const total = groups.reduce((sum, size) => sum + size, 0);\n\n if (total !== this.length) {\n warn(\n `<InputOtp>: @groups must sum to @length (${this.length}), got ${total}. ` +\n `Rendering ${this.length} cells and adjusting the groups to fit.`,\n false,\n { id: 'frontile.input-otp.groups-mismatch' }\n );\n }\n\n return groups;\n }\n\n get cellGroups(): Cell[][] {\n const value = this.elementValue;\n const cells: Cell[] = [];\n\n const [start, end] = this.mirroredSelection;\n\n for (let index = 0; index < this.length; index++) {\n const char = value[index] ?? null;\n // The placeholder is an all-or-nothing preview: it survives only while\n // nothing at all has been entered.\n const placeholderChar =\n value.length === 0 ? (this.args.placeholder?.[index] ?? null) : null;\n\n let displayChar: string | null = placeholderChar;\n if (char !== null) {\n displayChar = this.args.isMasked ? '•' : char;\n }\n\n // A range selection lights up every cell it covers -- that is correct,\n // not a bug.\n const isActive =\n this.isFocused &&\n start !== null &&\n end !== null &&\n ((start === end && index === start) || (index >= start && index < end));\n\n cells.push({\n index,\n displayChar,\n isActive,\n hasFakeCaret: isActive && char === null\n });\n }\n\n // `slice` clamps on its own, so a `@groups` that overshoots simply runs out\n // of cells; anything left over becomes a final group. Either way exactly\n // `length` cells render.\n const groups: Cell[][] = [];\n let offset = 0;\n\n for (const size of this.groupSizes) {\n if (offset >= cells.length) {\n break;\n }\n if (size <= 0) {\n continue;\n }\n groups.push(cells.slice(offset, offset + size));\n offset += size;\n }\n\n if (offset < cells.length) {\n groups.push(cells.slice(offset));\n }\n\n return groups;\n }\n\n @cached\n get classes() {\n const { inputOtp } = useStyles();\n return inputOtp({ size: this.args.size });\n }\n\n /**\n * Both `input` and `change` funnel through here so the element, our mirror of\n * it, and the parent never disagree about the value.\n */\n syncValue(event: Event, notify: 'input' | 'change'): void {\n const element = event.target as HTMLInputElement;\n const next = element.value.slice(0, this.length);\n\n // The value as it stood before this edit, read before anything is mutated.\n const previous = this.elementValue;\n\n // All-or-nothing: a value that fails the rule is dropped whole rather than\n // filtered, so a pasted \"123-456\" never silently becomes \"123456\".\n if (next.length > 0 && !this.pattern.test(next)) {\n this.writeValue(element, previous);\n return;\n }\n\n this.writeValue(element, next);\n\n // Only a parent that was actually told gets a say in the reconciliation --\n // an `@onChange`-only parent is not credited with knowing about an `input`\n // it never heard.\n const notifyParent =\n notify === 'input' ? this.args.onInput : this.args.onChange;\n\n if (notifyParent) {\n notifyParent(next, event);\n this.reconcileWithParent(element, next);\n }\n\n if (\n next !== previous &&\n previous.length < this.length &&\n next.length === this.length\n ) {\n this.args.onComplete?.(next);\n }\n }\n\n @action handleOnInput(event: Event): void {\n this.syncValue(event, 'input');\n }\n\n @action handleOnChange(event: Event): void {\n this.syncValue(event, 'change');\n }\n\n /**\n * Maps the input's text caret onto discrete cells. A collapsed caret sits\n * between characters and so belongs to no cell; widening it to a\n * one-character range makes exactly one cell active and makes typing\n * overwrite rather than insert.\n */\n @action onSelectionChange(): void {\n const input = this.inputRef.current;\n if (!input || document.activeElement !== input) {\n return;\n }\n\n const value = input.value;\n const maxLength = this.length;\n const caretStart = input.selectionStart;\n const caretEnd = input.selectionEnd;\n\n if (caretStart === null || caretEnd === null) {\n return;\n }\n\n let start = -1;\n let end = -1;\n let direction: 'forward' | 'backward' | 'none' =\n input.selectionDirection ?? 'none';\n\n const isSingleCaret = caretStart === caretEnd;\n // Appending to a not-yet-full code: leave the caret collapsed, or the next\n // keystroke would replace the character before it instead of adding one.\n const isInsertMode =\n caretStart === value.length && value.length < maxLength;\n\n if (isSingleCaret && !isInsertMode) {\n const caret = caretStart;\n\n if (caret === 0) {\n start = 0;\n end = 1;\n direction = 'forward';\n } else if (caret === maxLength) {\n start = caret - 1;\n end = caret;\n direction = 'backward';\n } else if (maxLength > 1 && value.length > 1) {\n let offset = 0;\n const [prevStart, prevEnd] = this.prevSelection;\n\n if (prevStart !== null && prevEnd !== null) {\n direction = caret < prevEnd ? 'backward' : 'forward';\n const wasInserting = prevStart === prevEnd && prevStart < maxLength;\n // Without this, ArrowLeft appears to skip a cell -- except when\n // leaving append mode, where the shift would overshoot.\n if (direction === 'backward' && !wasInserting) {\n offset = -1;\n }\n }\n\n start = offset + caret;\n end = offset + caret + 1;\n }\n }\n\n if (start !== -1 && end !== -1 && start !== end) {\n input.setSelectionRange(start, end, direction);\n }\n\n // `selectionchange` fires several times per keystroke; writing an identical\n // value would still dirty the tag and rebuild every cell. The comparison\n // goes through the untracked `prevSelection`, which holds exactly what was\n // last mirrored -- reading the tracked fields here would consume them into\n // the modifier computation that `writeValue` calls this from.\n const [lastStart, lastEnd] = this.prevSelection;\n\n if (lastStart !== input.selectionStart) {\n this.selectionStart = input.selectionStart;\n }\n\n if (lastEnd !== input.selectionEnd) {\n this.selectionEnd = input.selectionEnd;\n }\n\n this.prevSelection = [input.selectionStart, input.selectionEnd];\n }\n\n @action handleFocus(): void {\n this.isFocused = true;\n\n const input = this.inputRef.current;\n if (!input) {\n return;\n }\n\n // Park on the last cell rather than past the end of a full code.\n const start = Math.min(input.value.length, this.length - 1);\n input.setSelectionRange(start, input.value.length);\n this.onSelectionChange();\n }\n\n @action handleOnBlur(): void {\n this.isFocused = false;\n this.selectionStart = null;\n this.selectionEnd = null;\n this.prevSelection = [null, null];\n this.args.onBlur?.();\n }\n\n <template>\n <FormControl\n @size={{@size}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n data-component=\"input-otp\"\n data-part=\"base\"\n as |c|\n >\n {{! Chrome's translate feature rewrites the cell text nodes, wrapping\n them in <font> elements that Glimmer then tries to update. }}\n <div\n class={{this.classes.container class=@classes.container}}\n data-part=\"container\"\n translate=\"no\"\n >\n {{#each this.cellGroups key=\"@index\" as |group groupIndex|}}\n {{#if groupIndex}}\n <div\n class={{this.classes.separator class=@classes.separator}}\n data-part=\"separator\"\n aria-hidden=\"true\"\n >{{this.separator}}</div>\n {{/if}}\n <div\n class={{this.classes.group class=@classes.group}}\n data-part=\"group\"\n >\n {{#each group key=\"index\" as |cell|}}\n <div\n class={{this.classes.cell\n class=@classes.cell\n isActive=cell.isActive\n isInvalid=c.isInvalid\n isDisabled=@isDisabled\n }}\n data-part=\"cell\"\n data-active={{if cell.isActive \"true\"}}\n aria-hidden=\"true\"\n >\n <span\n class={{this.classes.cellChar class=@classes.cellChar}}\n data-part=\"cell-char\"\n >\n {{cell.displayChar}}\n </span>\n {{#if cell.hasFakeCaret}}\n {{! Never the only focus affordance -- under\n prefers-reduced-motion it stops blinking and reads as a\n static bar, so the active cell also rings. }}\n <span\n class={{this.classes.caret class=@classes.caret}}\n data-part=\"caret\"\n ></span>\n {{/if}}\n </div>\n {{/each}}\n </div>\n {{/each}}\n\n {{! False positive in no-unsupported-role-attributes\n (ember-template-lint 7.9.3). Its getImplicitRole helper matches an\n aria-query key on the type attribute alone and ignores that key's\n other constraints, so a plain text input resolves to the\n list-bearing combobox entry instead of textbox. This input has no\n list attribute, so textbox is its real implicit role, and textbox\n does support aria-placeholder. The rule is disabled for this\n element only, so its autofixer cannot silently delete\n aria-placeholder when someone runs pnpm lint:hbs --fix. See the\n @placeholder test in input-otp-test.gts. }}\n {{! template-lint-disable no-unsupported-role-attributes }}\n <input\n {{this.inputRef.setup}}\n {{this.syncFromValueArg @value}}\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n {{on \"focus\" this.handleFocus}}\n {{on \"blur\" this.handleOnBlur}}\n id={{c.id}}\n name={{@name}}\n type=\"text\"\n maxlength={{this.length}}\n disabled={{@isDisabled}}\n class={{this.classes.input class=@classes.input}}\n data-part=\"input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n aria-placeholder={{@placeholder}}\n autocomplete=\"one-time-code\"\n inputmode={{this.inputMode}}\n pattern={{this.pattern.source}}\n autocapitalize={{this.autoCapitalize}}\n autocorrect=\"off\"\n spellcheck=\"false\"\n ...attributes\n />\n {{! template-lint-enable no-unsupported-role-attributes }}\n </div>\n </FormControl>\n </template>\n}\n\nexport { InputOtp, type InputOtpSignature };\nexport default InputOtp;\n"],"names":["OTP_PATTERNS","digits","letters","alphanumeric","OTP_INPUT_HINTS","inputMode","autoCapitalize","InputOtp","Component","g","prototype","tracked","args","value","i","prevSelection","inputRef","ref","element","document","addEventListener","onSelectionChange","capture","removeEventListener","length","allowedChars","pattern","writeValue","elementValue","syncFromValueArg","modifier","reconcileWithParent","emitted","next","isDestroying","isDestroyed","mirroredSelection","selectionStart","selectionEnd","separator","groupSizes","groups","total","reduce","sum","size","warn","id","cellGroups","cells","start","end","index","char","placeholderChar","placeholder","displayChar","isMasked","isActive","isFocused","push","hasFakeCaret","offset","slice","classes","inputOtp","useStyles","n","cached","syncValue","event","notify","target","previous","test","notifyParent","onInput","onChange","onComplete","handleOnInput","action","handleOnChange","input","current","activeElement","maxLength","caretStart","caretEnd","direction","selectionDirection","isSingleCaret","isInsertMode","caret","prevStart","prevEnd","wasInserting","setSelectionRange","lastStart","lastEnd","handleFocus","Math","min","handleOnBlur","onBlur","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAMA,YAAA,GAAe;AACnBC,EAAAA,MAAA,EAAQ,OAAA;AACRC,EAAAA,OAAA,EAAS,aAAA;AACTC,EAAAA,YAAA,EAAc;AAChB,CAAA;AAIA;;;;;AAKC;AACD,MAAMC,eAAA,GAAkB;AACtBH,EAAAA,MAAA,EAAQ;AAAEI,IAAAA,SAAA,EAAW,SAAA;AAAWC,IAAAA,cAAA,EAAgB;GAAM;AACtDJ,EAAAA,OAAA,EAAS;AAAEG,IAAAA,SAAA,EAAW,MAAA;AAAQC,IAAAA,cAAA,EAAgB;GAAa;AAC3DH,EAAAA,YAAA,EAAc;AAAEE,IAAAA,SAAA,EAAW,MAAA;AAAQC,IAAAA,cAAA,EAAgB;AAAa;AAClE;AAuHA;;;;;;;;;;;;;;;;;;;AAmBA,MAAMC,iBAAiBC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CAE9BC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAA+B,IAAI,CAACC,IAAI,CAACC,KAAK,IAAI,EAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,aAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,cAAA,CAAA,EAAA,MAAA;AADnD;AAAA,EAAA;IAAAL,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CAGCC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAoB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,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MrE,KAAK,CAACW,MAAM,CAAA;IACjD,IAAI,CAACH,iBAAiB,EAAA;AACxB,EAAA;AAAA,EAAA;IAAA8C,gBAAA,CAAA,IAAA,CAAAzD,SAAA,EAAA,aAAA,EAAA,CAZCsE,MAAA,CAAA,CAAA;AAAA;AAcOsB,EAAAA,YAAAA,GAAqB;IAC3B,IAAI,CAAC3C,SAAS,GAAG,KAAA;IACjB,IAAI,CAACtB,cAAc,GAAG,IAAA;IACtB,IAAI,CAACC,YAAY,GAAG,IAAA;AACpB,IAAA,IAAI,CAACvB,aAAa,GAAG,CAAC,IAAA,EAAM,IAAA,CAAK;AACjC,IAAA,IAAI,CAACH,IAAI,CAAC2F,MAAM,IAAA;AAClB,EAAA;AAAA,EAAA;IAAApC,gBAAA,CAAA,IAAA,CAAAzD,SAAA,EAAA,cAAA,EAAA,CANCsE,MAAA,CAAA,CAAA;AAAA;AAQD,EAAA;IAAAwB,oBAAA,CAAAC,kBAAA,CAAA,6qGAAA,EAuGA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sources":["../../../src/components/forms/input.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport {\n useStyles,\n type InputSlots,\n type InputVariants,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport { triggerFormInputEvent } from '../../utils/forms-utils-index';\nimport { ref } from '../../utils/ref';\nimport { CloseButton } from '../buttons/close-button';\n\ninterface Args extends FormControlSharedArgs {\n /**\n * The type attribute of the underlying input element.\n *\n * @defaultValue 'text'\n */\n type?: string;\n\n /**\n * The value of the input. Pair with `onInput` or `onChange` to control the\n * input; leave it unset to let the element track its own value.\n */\n value?: string;\n\n /**\n * The name attribute of the underlying input, used when the input is\n * submitted as part of a form.\n */\n name?: string;\n\n /**\n * The size of the input and its label.\n *\n * @defaultValue 'md'\n */\n size?: InputVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<InputSlots>;\n\n /**\n * Whether to include a clear button\n */\n isClearable?: boolean;\n\n /**\n * Controls pointer-events property of startContent.\n * If you want to pass the click event to the input, set it to `none`.\n *\n * @defaultValue 'auto'\n */\n startContentPointerEvents?: 'none' | 'auto';\n\n /**\n * Controls pointer-events property of endContent.\n * If you want to pass the click event to the input, set it to `none`.\n *\n * @defaultValue 'auto'\n */\n endContentPointerEvents?: 'none' | 'auto';\n\n /**\n * Callback when oninput is triggered\n */\n onInput?: (value: string, event?: InputEvent) => void;\n\n /**\n * Callback when onchange is triggered\n */\n onChange?: (value: string, event?: InputEvent) => void;\n\n /**\n * Callback when onblur is triggered\n */\n onBlur?: () => void;\n}\n\ninterface InputSignature {\n Args: Args;\n Blocks: {\n startContent: [];\n endContent: [];\n };\n Element: HTMLInputElement;\n}\n\nfunction or(arg1: unknown, arg2: unknown): boolean {\n return !!(arg1 || arg2);\n}\n\nclass Input extends Component<InputSignature> {\n @tracked uncontrolledValue: string = this.args.value || '';\n\n /**\n * What the element itself currently holds. A controlled parent does not\n * always feed the value back through `@value` — `<Form>`, for one, reads it\n * off the DOM instead — so the argument alone cannot tell us whether there\n * is anything to clear.\n */\n @tracked elementValue: string = this.args.value || '';\n\n inputRef = ref<HTMLInputElement>();\n\n get isControlled() {\n return (\n typeof this.args.onChange === 'function' ||\n typeof this.args.onInput === 'function'\n );\n }\n\n get value(): string | undefined {\n return this.isControlled ? this.args.value : this.uncontrolledValue;\n }\n\n /**\n * The value in the field regardless of who owns it: the argument when the\n * parent feeds one back, the element's own value otherwise.\n */\n get currentValue(): string | undefined {\n if (!this.isControlled) {\n return this.uncontrolledValue;\n }\n\n return typeof this.args.value === 'undefined'\n ? this.elementValue\n : this.args.value;\n }\n\n get type(): string {\n if (typeof this.args.type === 'string') {\n return this.args.type;\n }\n return 'text';\n }\n\n @action handleOnInput(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n this.elementValue = value;\n\n if (this.isControlled) {\n this.args.onInput?.(value, event as InputEvent);\n } else {\n this.uncontrolledValue = value;\n }\n }\n\n @action handleOnChange(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n this.elementValue = value;\n\n if (this.isControlled) {\n this.args.onChange?.(value, event as InputEvent);\n } else {\n this.uncontrolledValue = value;\n }\n }\n\n @action handleOnBlur(): void {\n this.args.onBlur?.();\n }\n\n @action clearValue(): void {\n // Clear the element first: a parent that owns the value may derive it from\n // the DOM (as `<Form>` does via FormData), in which case notifying it\n // before the element is empty would just hand back the stale value.\n if (this.inputRef.current) {\n this.inputRef.current.value = '';\n }\n this.elementValue = '';\n\n if (this.isControlled) {\n this.args.onChange?.('');\n this.args.onInput?.('');\n } else {\n this.uncontrolledValue = '';\n }\n\n this.inputRef.current?.focus();\n triggerFormInputEvent(this.inputRef.current);\n }\n\n get isClearable(): boolean {\n if (\n this.args.isClearable === true &&\n this.currentValue !== '' &&\n typeof this.currentValue !== 'undefined'\n ) {\n return true;\n }\n return false;\n }\n\n get classes() {\n const { input } = useStyles();\n return input({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @size={{@size}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n data-component=\"input\"\n data-part=\"base\"\n as |c|\n >\n <div\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n >\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent\n class=@classes.startContent\n startContentPointerEvents=(if\n @startContentPointerEvents @startContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n <input\n {{this.inputRef.setup}}\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n {{on \"blur\" this.handleOnBlur}}\n id={{c.id}}\n name={{@name}}\n value={{this.value}}\n type={{this.type}}\n disabled={{@isDisabled}}\n class={{this.classes.input\n class=@classes.input\n hasStartContent=(has-block \"startContent\")\n hasEndContent=(or (has-block \"endContent\") this.isClearable)\n }}\n data-part=\"input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n {{#if (or (has-block \"endContent\") this.isClearable)}}\n <div\n data-part=\"end-content\"\n class={{this.classes.endContent\n class=@classes.endContent\n endContentPointerEvents=(if\n @endContentPointerEvents @endContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"endContent\"}}\n\n {{#if this.isClearable}}\n <CloseButton\n @title=\"Clear\"\n @variant=\"soft\"\n @size=\"xs\"\n @onPress={{this.clearValue}}\n />\n {{/if}}\n </div>\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Input, type InputSignature };\nexport default Input;\n"],"names":["or","arg1","arg2","Input","Component","g","prototype","tracked","args","value","i","inputRef","ref","isControlled","onChange","onInput","uncontrolledValue","currentValue","elementValue","type","handleOnInput","event","target","n","action","handleOnChange","handleOnBlur","onBlur","clearValue","current","focus","triggerFormInputEvent","isClearable","classes","input","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on","CloseButton"],"mappings":";;;;;;;;;;;;;AA6FA,SAASA,GAAGC,IAAa,EAAEC,IAAa,EAAU;AAChD,EAAA,OAAO,CAAC,EAAED,IAAA,IAAQC,IAAI,CAAA;AACxB;AAEA,MAAMC,cAAcC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,mBAAA,EAAA,CAC3BC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAoC,IAAI,CAACC,IAAI,CAACC,KAAK,IAA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AAY,EAAE;AACrB,MAAA,IAAI,CAACL,IAAI,CAACM,QAAQ,GAAG,EAAA,CAAA;AACrB,MAAA,IAAI,CAACN,IAAI,CAACO,OAAO,GAAG,EAAA,CAAA;AACtB,IAAA,CAAA,MAAO;MACL,IAAI,CAACC,iBAAiB,GAAG,EAAA;AAC3B,IAAA;AAEA,IAAA,IAAI,CAACL,QAAQ,CAACkB,OAAO,EAAEC,KAAA,EAAA;AACvBC,IAAAA,qBAAA,CAAsB,IAAI,CAACpB,QAAQ,CAACkB,OAAO,CAAA;AAC7C,EAAA;AAAA,EAAA;IAAAN,gBAAA,CAAA,IAAA,CAAAjB,SAAA,EAAA,YAAA,EAAA,CAlBCkB,MAAA,CAAA,CAAA;AAAA;EAoBD,IAAIQ,WAAAA,GAAuB;IACzB,IACE,IAAI,CAACxB,IAAI,CAACwB,WAAW,KAAK,IAAA,IAC1B,IAAI,CAACf,YAAY,KAAK,EAAA,IACtB,OAAO,IAAI,CAACA,YAAY,KAAK,WAAA,EAC7B;AACA,MAAA,OAAO,IAAA;AACT,IAAA;AACA,IAAA,OAAO,KAAA;AACT,EAAA;EAEA,IAAIgB,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;AAClB,IAAA,OAAOD,KAAA,CAAM;AACXE,MAAAA,IAAA,EAAM,IAAI,CAAC5B,IAAI,CAAC4B;AAClB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,+pDAAA,EA0EA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;QAAAzC,EAAA;QAAA0C,EAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"input.js","sources":["../../../src/components/forms/input.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport {\n useStyles,\n type InputSlots,\n type InputVariants,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport { triggerFormInputEvent } from '../../utils/forms-utils-index';\nimport { ref } from '../../utils/ref';\nimport { CloseButton } from '../buttons/close-button';\n\ninterface Args extends FormControlSharedArgs {\n /**\n * The type attribute of the underlying input element.\n *\n * @defaultValue 'text'\n */\n type?: string;\n\n /**\n * The value of the input. Pair with `onInput` or `onChange` to control the\n * input; leave it unset to let the element track its own value.\n */\n value?: string;\n\n /**\n * The name attribute of the underlying input, used when the input is\n * submitted as part of a form.\n */\n name?: string;\n\n /**\n * The size of the input and its label.\n *\n * @defaultValue 'md'\n */\n size?: InputVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<InputSlots>;\n\n /**\n * Whether to include a clear button\n */\n isClearable?: boolean;\n\n /**\n * Controls pointer-events property of startContent.\n * If you want to pass the click event to the input, set it to `none`.\n *\n * @defaultValue 'auto'\n */\n startContentPointerEvents?: 'none' | 'auto';\n\n /**\n * Controls pointer-events property of endContent.\n * If you want to pass the click event to the input, set it to `none`.\n *\n * @defaultValue 'auto'\n */\n endContentPointerEvents?: 'none' | 'auto';\n\n /**\n * Callback when oninput is triggered\n */\n onInput?: (value: string, event?: InputEvent) => void;\n\n /**\n * Callback when onchange is triggered\n */\n onChange?: (value: string, event?: InputEvent) => void;\n\n /**\n * Callback when onblur is triggered\n */\n onBlur?: () => void;\n}\n\ninterface InputSignature {\n Args: Args;\n Blocks: {\n startContent: [];\n endContent: [];\n };\n Element: HTMLInputElement;\n}\n\nfunction or(arg1: unknown, arg2: unknown): boolean {\n return !!(arg1 || arg2);\n}\n\nclass Input extends Component<InputSignature> {\n @tracked uncontrolledValue: string = this.args.value || '';\n\n /**\n * What the element itself currently holds. A controlled parent does not\n * always feed the value back through `@value` — `<Form>`, for one, reads it\n * off the DOM instead — so the argument alone cannot tell us whether there\n * is anything to clear.\n */\n @tracked elementValue: string = this.args.value || '';\n\n inputRef = ref<HTMLInputElement>();\n\n get isControlled() {\n return (\n typeof this.args.onChange === 'function' ||\n typeof this.args.onInput === 'function'\n );\n }\n\n get value(): string | undefined {\n return this.isControlled ? this.args.value : this.uncontrolledValue;\n }\n\n /**\n * The value in the field regardless of who owns it: the argument when the\n * parent feeds one back, the element's own value otherwise.\n */\n get currentValue(): string | undefined {\n if (!this.isControlled) {\n return this.uncontrolledValue;\n }\n\n return typeof this.args.value === 'undefined'\n ? this.elementValue\n : this.args.value;\n }\n\n get type(): string {\n if (typeof this.args.type === 'string') {\n return this.args.type;\n }\n return 'text';\n }\n\n @action handleOnInput(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n this.elementValue = value;\n\n if (this.isControlled) {\n this.args.onInput?.(value, event as InputEvent);\n } else {\n this.uncontrolledValue = value;\n }\n }\n\n @action handleOnChange(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n this.elementValue = value;\n\n if (this.isControlled) {\n this.args.onChange?.(value, event as InputEvent);\n } else {\n this.uncontrolledValue = value;\n }\n }\n\n @action handleOnBlur(): void {\n this.args.onBlur?.();\n }\n\n @action clearValue(): void {\n // Clear the element first: a parent that owns the value may derive it from\n // the DOM (as `<Form>` does via FormData), in which case notifying it\n // before the element is empty would just hand back the stale value.\n if (this.inputRef.current) {\n this.inputRef.current.value = '';\n }\n this.elementValue = '';\n\n if (this.isControlled) {\n this.args.onChange?.('');\n this.args.onInput?.('');\n } else {\n this.uncontrolledValue = '';\n }\n\n this.inputRef.current?.focus();\n triggerFormInputEvent(this.inputRef.current);\n }\n\n get isClearable(): boolean {\n if (\n this.args.isClearable === true &&\n this.currentValue !== '' &&\n typeof this.currentValue !== 'undefined'\n ) {\n return true;\n }\n return false;\n }\n\n get classes() {\n const { input } = useStyles();\n return input({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @size={{@size}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n data-component=\"input\"\n data-part=\"base\"\n as |c|\n >\n <div\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n >\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent\n class=@classes.startContent\n startContentPointerEvents=(if\n @startContentPointerEvents @startContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n <input\n {{this.inputRef.setup}}\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n {{on \"blur\" this.handleOnBlur}}\n id={{c.id}}\n name={{@name}}\n value={{this.value}}\n type={{this.type}}\n disabled={{@isDisabled}}\n class={{this.classes.input\n class=@classes.input\n hasStartContent=(has-block \"startContent\")\n hasEndContent=(or (has-block \"endContent\") this.isClearable)\n }}\n data-part=\"input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n {{#if (or (has-block \"endContent\") this.isClearable)}}\n <div\n data-part=\"end-content\"\n class={{this.classes.endContent\n class=@classes.endContent\n endContentPointerEvents=(if\n @endContentPointerEvents @endContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"endContent\"}}\n\n {{#if this.isClearable}}\n <CloseButton\n @title=\"Clear\"\n @variant=\"soft\"\n @size=\"xs\"\n @onPress={{this.clearValue}}\n />\n {{/if}}\n </div>\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Input, type InputSignature };\nexport default Input;\n"],"names":["or","arg1","arg2","Input","Component","g","prototype","tracked","args","value","i","inputRef","ref","isControlled","onChange","onInput","uncontrolledValue","currentValue","elementValue","type","handleOnInput","event","target","n","action","handleOnChange","handleOnBlur","onBlur","clearValue","current","focus","triggerFormInputEvent","isClearable","classes","input","useStyles","size","setComponentTemplate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;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,+pDAAA,EA0EA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;QAAAzC,EAAA;QAAA0C,EAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"label.js","sources":["../../../src/components/forms/label.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport {\n useStyles,\n type LabelSlots,\n type LabelVariants,\n type SlotsToClasses\n} from '@frontile/theme';\n\ninterface LabelSignature {\n Args: {\n /**\n * The 'for' attribute of a <label>.\n */\n for?: string;\n\n /**\n * The size of the label text.\n *\n * @defaultValue 'md'\n */\n size?: LabelVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<LabelSlots>;\n\n /**\n * The class name to be passed to the label base slot.\n */\n class?: string;\n\n /**\n * Whether the field is required or not, if true, an asterisk will be added to the label.\n *\n * @defaultValue false\n */\n isRequired?: boolean;\n };\n Element: HTMLLabelElement;\n Blocks: {\n default: [];\n };\n}\n\nclass Label extends Component<LabelSignature> {\n get classes() {\n const { label } = useStyles();\n return label({\n size: this.args.size || 'md'\n });\n }\n\n <template>\n <label\n for={{@for}}\n class={{this.classes.base class=@class}}\n data-component=\"label\"\n data-part=\"base\"\n ...attributes\n >\n {{yield}}\n {{#if @isRequired}}\n <span\n class={{this.classes.asterisk class=@classes.asterisk}}\n data-part=\"asterisk\"\n >*</span>\n {{/if}}\n </label>\n </template>\n}\n\nexport { Label, type LabelSignature };\nexport default Label;\n"],"names":["Label","Component","classes","label","useStyles","size","args","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AA6CA,MAAMA,cAAcC,SAAA,CAAU;EAC5B,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;AAClB,IAAA,OAAOD,KAAA,CAAM;AACXE,MAAAA,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD,IAAI,IAAI;AAC1B,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CAAA,qRAAA,EAgBA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"label.js","sources":["../../../src/components/forms/label.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport {\n useStyles,\n type LabelSlots,\n type LabelVariants,\n type SlotsToClasses\n} from '@frontile/theme';\n\ninterface LabelSignature {\n Args: {\n /**\n * The 'for' attribute of a <label>.\n */\n for?: string;\n\n /**\n * The size of the label text.\n *\n * @defaultValue 'md'\n */\n size?: LabelVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<LabelSlots>;\n\n /**\n * The class name to be passed to the label base slot.\n */\n class?: string;\n\n /**\n * Whether the field is required or not, if true, an asterisk will be added to the label.\n *\n * @defaultValue false\n */\n isRequired?: boolean;\n };\n Element: HTMLLabelElement;\n Blocks: {\n default: [];\n };\n}\n\nclass Label extends Component<LabelSignature> {\n get classes() {\n const { label } = useStyles();\n return label({\n size: this.args.size || 'md'\n });\n }\n\n <template>\n <label\n for={{@for}}\n class={{this.classes.base class=@class}}\n data-component=\"label\"\n data-part=\"base\"\n ...attributes\n >\n {{yield}}\n {{#if @isRequired}}\n <span\n class={{this.classes.asterisk class=@classes.asterisk}}\n data-part=\"asterisk\"\n >*</span>\n {{/if}}\n </label>\n </template>\n}\n\nexport { Label, type LabelSignature };\nexport default Label;\n"],"names":["Label","Component","classes","label","useStyles","size","args","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AA6CA,MAAMA,cAAcC,SAAA,CAAU;EAC5B,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;AAClB,IAAA,OAAOD,KAAA,CAAM;AACXE,MAAAA,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD,IAAI,IAAI;AAC1B,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CAAA,qRAAA,EAgBA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -7,7 +7,7 @@ import { assert } from '@ember/debug';
7
7
  import { useStyles } from '@frontile/theme';
8
8
  import { FormControl } from './form-control.js';
9
9
  import { ListManager, keyAndLabelForItem } from '../../utils/listManager.js';
10
- import { IconChevronUpDown } from './icons.js';
10
+ import { I as IconChevronUpDown } from '../../icons-DZ61nCzv.js';
11
11
  import { precompileTemplate } from '@ember/template-compilation';
12
12
  import { setComponentTemplate } from '@ember/component';
13
13
  import { a as decorateMethodV2, d as decorateFieldV2, i as initializeDeferredDecorator } from '../../runtime--fcdnjmJ-BOdRhmsS.js';
@@ -73,7 +73,7 @@ class NativeSelect extends Component {
73
73
  handleOnChange(event) {
74
74
  const selectElement = event.target;
75
75
  let newSelectedKeys = [];
76
- for (var i = 0; i < selectElement.options.length; i++) {
76
+ for (let i = 0; i < selectElement.options.length; i++) {
77
77
  const option = selectElement.options[i];
78
78
  if (option && option.selected && option.value !== '') {
79
79
  newSelectedKeys.push(option.value);