ngwr 16.2.0 → 16.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (398) hide show
  1. package/badge/styles/_tag.scss +73 -1
  2. package/calendar/styles/_index.scss +22 -0
  3. package/cascader/styles/_rules.scss +7 -0
  4. package/color-picker/styles/_index.scss +21 -0
  5. package/date-picker/styles/_index.scss +19 -0
  6. package/dropdown/styles/_index.scss +13 -19
  7. package/fesm2022/ngwr-affix.mjs +3 -3
  8. package/fesm2022/ngwr-alert-testing.mjs +70 -0
  9. package/fesm2022/ngwr-alert-testing.mjs.map +1 -0
  10. package/fesm2022/ngwr-alert.mjs +3 -3
  11. package/fesm2022/ngwr-anchor.mjs +17 -6
  12. package/fesm2022/ngwr-anchor.mjs.map +1 -1
  13. package/fesm2022/ngwr-animations-aurora.mjs +3 -3
  14. package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
  15. package/fesm2022/ngwr-animations-click-sparks.mjs +3 -3
  16. package/fesm2022/ngwr-animations-confetti.mjs +3 -3
  17. package/fesm2022/ngwr-animations-decode.mjs +3 -3
  18. package/fesm2022/ngwr-animations-destruct.mjs +3 -3
  19. package/fesm2022/ngwr-animations-dot-grid.mjs +3 -3
  20. package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
  21. package/fesm2022/ngwr-animations-flow-lines.mjs +3 -3
  22. package/fesm2022/ngwr-animations-fluid-cursor.mjs +3 -3
  23. package/fesm2022/ngwr-animations-glitch.mjs +3 -3
  24. package/fesm2022/ngwr-animations-glow-border.mjs +3 -3
  25. package/fesm2022/ngwr-animations-gradient-flow.mjs +3 -3
  26. package/fesm2022/ngwr-animations-marquee.mjs +3 -3
  27. package/fesm2022/ngwr-animations-orbit.mjs +3 -3
  28. package/fesm2022/ngwr-animations-reveal.mjs +3 -3
  29. package/fesm2022/ngwr-animations-ripple-grid.mjs +3 -3
  30. package/fesm2022/ngwr-animations-rotate-reveal.mjs +3 -3
  31. package/fesm2022/ngwr-animations-shimmer.mjs +3 -3
  32. package/fesm2022/ngwr-animations-spotlight.mjs +3 -3
  33. package/fesm2022/ngwr-animations-thread-lines.mjs +3 -3
  34. package/fesm2022/ngwr-animations-tilt.mjs +3 -3
  35. package/fesm2022/ngwr-animations-typewriter.mjs +3 -3
  36. package/fesm2022/ngwr-avatar.mjs +3 -3
  37. package/fesm2022/ngwr-back-top.mjs +3 -3
  38. package/fesm2022/ngwr-badge.mjs +129 -11
  39. package/fesm2022/ngwr-badge.mjs.map +1 -1
  40. package/fesm2022/ngwr-breadcrumbs-testing.mjs +83 -0
  41. package/fesm2022/ngwr-breadcrumbs-testing.mjs.map +1 -0
  42. package/fesm2022/ngwr-breadcrumbs.mjs +8 -8
  43. package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
  44. package/fesm2022/ngwr-burger-testing.mjs +45 -0
  45. package/fesm2022/ngwr-burger-testing.mjs.map +1 -0
  46. package/fesm2022/ngwr-burger.mjs +3 -3
  47. package/fesm2022/ngwr-button.mjs +6 -6
  48. package/fesm2022/ngwr-calendar-testing.mjs +18 -0
  49. package/fesm2022/ngwr-calendar-testing.mjs.map +1 -1
  50. package/fesm2022/ngwr-calendar.mjs +500 -73
  51. package/fesm2022/ngwr-calendar.mjs.map +1 -1
  52. package/fesm2022/ngwr-card.mjs +9 -9
  53. package/fesm2022/ngwr-carousel.mjs +6 -6
  54. package/fesm2022/ngwr-cascader.mjs +37 -16
  55. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  56. package/fesm2022/ngwr-charts-bar-chart.mjs +5 -4
  57. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  58. package/fesm2022/ngwr-charts-boxplot-chart.mjs +3 -3
  59. package/fesm2022/ngwr-charts-bullet-chart.mjs +3 -3
  60. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -3
  61. package/fesm2022/ngwr-charts-candlestick-chart.mjs +3 -3
  62. package/fesm2022/ngwr-charts-chart-legend.mjs +26 -11
  63. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  64. package/fesm2022/ngwr-charts-core.mjs +3 -3
  65. package/fesm2022/ngwr-charts-donut-chart.mjs +5 -4
  66. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  67. package/fesm2022/ngwr-charts-funnel-chart.mjs +3 -3
  68. package/fesm2022/ngwr-charts-gauge.mjs +3 -3
  69. package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
  70. package/fesm2022/ngwr-charts-line-chart-testing.mjs +3 -2
  71. package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
  72. package/fesm2022/ngwr-charts-line-chart.mjs +17 -7
  73. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  74. package/fesm2022/ngwr-charts-meter-group.mjs +5 -4
  75. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  76. package/fesm2022/ngwr-charts-radar-chart.mjs +5 -4
  77. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  78. package/fesm2022/ngwr-charts-scatter-chart.mjs +5 -4
  79. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  80. package/fesm2022/ngwr-charts-sparkline.mjs +3 -3
  81. package/fesm2022/ngwr-charts-treemap-chart.mjs +3 -3
  82. package/fesm2022/ngwr-charts-waterfall-chart.mjs +3 -3
  83. package/fesm2022/ngwr-checkbox.mjs +6 -6
  84. package/fesm2022/ngwr-clipboard.mjs +3 -3
  85. package/fesm2022/ngwr-collapse.mjs +9 -9
  86. package/fesm2022/ngwr-color-picker-testing.mjs +11 -1
  87. package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
  88. package/fesm2022/ngwr-color-picker.mjs +153 -37
  89. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  90. package/fesm2022/ngwr-command-palette.mjs +3 -3
  91. package/fesm2022/ngwr-comment.mjs +10 -6
  92. package/fesm2022/ngwr-comment.mjs.map +1 -1
  93. package/fesm2022/ngwr-compare-testing.mjs +84 -0
  94. package/fesm2022/ngwr-compare-testing.mjs.map +1 -0
  95. package/fesm2022/ngwr-compare.mjs +3 -3
  96. package/fesm2022/ngwr-context-menu.mjs +12 -12
  97. package/fesm2022/ngwr-cookie.mjs +3 -3
  98. package/fesm2022/ngwr-copy-value.mjs +3 -3
  99. package/fesm2022/ngwr-counter.mjs +6 -6
  100. package/fesm2022/ngwr-date-picker-testing.mjs +30 -4
  101. package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
  102. package/fesm2022/ngwr-date-picker.mjs +342 -69
  103. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  104. package/fesm2022/ngwr-date-stamp.mjs +3 -3
  105. package/fesm2022/ngwr-date.mjs +59 -8
  106. package/fesm2022/ngwr-date.mjs.map +1 -1
  107. package/fesm2022/ngwr-density.mjs +6 -6
  108. package/fesm2022/ngwr-descriptions.mjs +6 -6
  109. package/fesm2022/ngwr-dialog.mjs +18 -18
  110. package/fesm2022/ngwr-directives.mjs +15 -15
  111. package/fesm2022/ngwr-divider.mjs +3 -3
  112. package/fesm2022/ngwr-drawer.mjs +51 -29
  113. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  114. package/fesm2022/ngwr-dropdown-testing.mjs +11 -3
  115. package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
  116. package/fesm2022/ngwr-dropdown.mjs +52 -95
  117. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  118. package/fesm2022/ngwr-editor.mjs +4 -3
  119. package/fesm2022/ngwr-editor.mjs.map +1 -1
  120. package/fesm2022/ngwr-empty.mjs +3 -3
  121. package/fesm2022/ngwr-event-calendar.mjs +186 -33
  122. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  123. package/fesm2022/ngwr-file-upload-testing.mjs +34 -2
  124. package/fesm2022/ngwr-file-upload-testing.mjs.map +1 -1
  125. package/fesm2022/ngwr-file-upload.mjs +274 -15
  126. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  127. package/fesm2022/ngwr-form.mjs +9 -9
  128. package/fesm2022/ngwr-form.mjs.map +1 -1
  129. package/fesm2022/ngwr-graph-testing.mjs +3 -0
  130. package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
  131. package/fesm2022/ngwr-graph.mjs +102 -42
  132. package/fesm2022/ngwr-graph.mjs.map +1 -1
  133. package/fesm2022/ngwr-hotkey.mjs +6 -6
  134. package/fesm2022/ngwr-i18n-ar.mjs +19 -4
  135. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  136. package/fesm2022/ngwr-i18n-cs.mjs +19 -4
  137. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  138. package/fesm2022/ngwr-i18n-de.mjs +19 -4
  139. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  140. package/fesm2022/ngwr-i18n-en.mjs +19 -4
  141. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  142. package/fesm2022/ngwr-i18n-es.mjs +19 -4
  143. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  144. package/fesm2022/ngwr-i18n-fr.mjs +19 -4
  145. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  146. package/fesm2022/ngwr-i18n-he.mjs +19 -4
  147. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  148. package/fesm2022/ngwr-i18n-hi.mjs +19 -4
  149. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  150. package/fesm2022/ngwr-i18n-id.mjs +19 -4
  151. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  152. package/fesm2022/ngwr-i18n-it.mjs +19 -4
  153. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  154. package/fesm2022/ngwr-i18n-ja.mjs +19 -4
  155. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  156. package/fesm2022/ngwr-i18n-ko.mjs +19 -4
  157. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  158. package/fesm2022/ngwr-i18n-nl.mjs +19 -4
  159. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  160. package/fesm2022/ngwr-i18n-pl.mjs +19 -4
  161. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  162. package/fesm2022/ngwr-i18n-pt.mjs +19 -4
  163. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  164. package/fesm2022/ngwr-i18n-ru.mjs +19 -4
  165. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  166. package/fesm2022/ngwr-i18n-sv.mjs +19 -4
  167. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  168. package/fesm2022/ngwr-i18n-tr.mjs +19 -4
  169. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  170. package/fesm2022/ngwr-i18n-uk.mjs +19 -4
  171. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  172. package/fesm2022/ngwr-i18n-vi.mjs +19 -4
  173. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  174. package/fesm2022/ngwr-i18n-zh-tw.mjs +19 -4
  175. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  176. package/fesm2022/ngwr-i18n-zh.mjs +19 -4
  177. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  178. package/fesm2022/ngwr-i18n.mjs +9 -9
  179. package/fesm2022/ngwr-icon.mjs +6 -6
  180. package/fesm2022/ngwr-image-cropper.mjs +3 -3
  181. package/fesm2022/ngwr-input-number-testing.mjs +11 -0
  182. package/fesm2022/ngwr-input-number-testing.mjs.map +1 -1
  183. package/fesm2022/ngwr-input-number.mjs +68 -7
  184. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  185. package/fesm2022/ngwr-input-otp.mjs +23 -3
  186. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  187. package/fesm2022/ngwr-input-testing.mjs +24 -1
  188. package/fesm2022/ngwr-input-testing.mjs.map +1 -1
  189. package/fesm2022/ngwr-input.mjs +152 -36
  190. package/fesm2022/ngwr-input.mjs.map +1 -1
  191. package/fesm2022/ngwr-keyboard.mjs +3 -3
  192. package/fesm2022/ngwr-knob.mjs +3 -3
  193. package/fesm2022/ngwr-layout.mjs +15 -15
  194. package/fesm2022/ngwr-lightbox.mjs +8 -8
  195. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  196. package/fesm2022/ngwr-list.mjs +8 -8
  197. package/fesm2022/ngwr-list.mjs.map +1 -1
  198. package/fesm2022/ngwr-load-state.mjs +15 -15
  199. package/fesm2022/ngwr-loading-bar.mjs +6 -6
  200. package/fesm2022/ngwr-mention.mjs +6 -6
  201. package/fesm2022/ngwr-meta.mjs +6 -6
  202. package/fesm2022/ngwr-overlay.mjs +175 -13
  203. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  204. package/fesm2022/ngwr-page-header.mjs +3 -3
  205. package/fesm2022/ngwr-pagination.mjs +5 -3
  206. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  207. package/fesm2022/ngwr-pipes.mjs +31 -29
  208. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  209. package/fesm2022/ngwr-platform.mjs +9 -9
  210. package/fesm2022/ngwr-popconfirm-testing.mjs +5 -2
  211. package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
  212. package/fesm2022/ngwr-popconfirm.mjs +44 -63
  213. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  214. package/fesm2022/ngwr-popover-testing.mjs +7 -1
  215. package/fesm2022/ngwr-popover-testing.mjs.map +1 -1
  216. package/fesm2022/ngwr-popover.mjs +58 -156
  217. package/fesm2022/ngwr-popover.mjs.map +1 -1
  218. package/fesm2022/ngwr-progress.mjs +50 -9
  219. package/fesm2022/ngwr-progress.mjs.map +1 -1
  220. package/fesm2022/ngwr-pull-to-refresh-testing.mjs +57 -0
  221. package/fesm2022/ngwr-pull-to-refresh-testing.mjs.map +1 -0
  222. package/fesm2022/ngwr-pull-to-refresh.mjs +3 -3
  223. package/fesm2022/ngwr-qr.mjs +3 -3
  224. package/fesm2022/ngwr-radio.mjs +6 -6
  225. package/fesm2022/ngwr-rating.mjs +3 -3
  226. package/fesm2022/ngwr-resizable-testing.mjs +113 -0
  227. package/fesm2022/ngwr-resizable-testing.mjs.map +1 -0
  228. package/fesm2022/ngwr-resizable.mjs +3 -3
  229. package/fesm2022/ngwr-result.mjs +12 -12
  230. package/fesm2022/ngwr-schema-form-testing.mjs +336 -0
  231. package/fesm2022/ngwr-schema-form-testing.mjs.map +1 -0
  232. package/fesm2022/ngwr-schema-form.mjs +415 -19
  233. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  234. package/fesm2022/ngwr-scroll.mjs +3 -3
  235. package/fesm2022/ngwr-segmented.mjs +3 -3
  236. package/fesm2022/ngwr-select-testing.mjs +19 -0
  237. package/fesm2022/ngwr-select-testing.mjs.map +1 -1
  238. package/fesm2022/ngwr-select.mjs +263 -83
  239. package/fesm2022/ngwr-select.mjs.map +1 -1
  240. package/fesm2022/ngwr-sidebar-testing.mjs +176 -0
  241. package/fesm2022/ngwr-sidebar-testing.mjs.map +1 -0
  242. package/fesm2022/ngwr-sidebar.mjs +3 -3
  243. package/fesm2022/ngwr-skeleton.mjs +3 -3
  244. package/fesm2022/ngwr-slider-testing.mjs +6 -0
  245. package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
  246. package/fesm2022/ngwr-slider.mjs +21 -3
  247. package/fesm2022/ngwr-slider.mjs.map +1 -1
  248. package/fesm2022/ngwr-sortable-list.mjs +29 -12
  249. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  250. package/fesm2022/ngwr-speed-dial.mjs +3 -3
  251. package/fesm2022/ngwr-spinner.mjs +3 -3
  252. package/fesm2022/ngwr-splitter.mjs +3 -3
  253. package/fesm2022/ngwr-statistic.mjs +9 -9
  254. package/fesm2022/ngwr-stepper.mjs +42 -11
  255. package/fesm2022/ngwr-stepper.mjs.map +1 -1
  256. package/fesm2022/ngwr-storage.mjs +3 -3
  257. package/fesm2022/ngwr-switch.mjs +3 -3
  258. package/fesm2022/ngwr-table-testing.mjs +88 -2
  259. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  260. package/fesm2022/ngwr-table.mjs +891 -74
  261. package/fesm2022/ngwr-table.mjs.map +1 -1
  262. package/fesm2022/ngwr-tabs-router.mjs +3 -3
  263. package/fesm2022/ngwr-tabs-testing.mjs +1 -1
  264. package/fesm2022/ngwr-tabs-testing.mjs.map +1 -1
  265. package/fesm2022/ngwr-tabs.mjs +15 -10
  266. package/fesm2022/ngwr-tabs.mjs.map +1 -1
  267. package/fesm2022/ngwr-textarea-testing.mjs +11 -0
  268. package/fesm2022/ngwr-textarea-testing.mjs.map +1 -1
  269. package/fesm2022/ngwr-textarea.mjs +128 -16
  270. package/fesm2022/ngwr-textarea.mjs.map +1 -1
  271. package/fesm2022/ngwr-theme.mjs +3 -3
  272. package/fesm2022/ngwr-timeline.mjs +6 -6
  273. package/fesm2022/ngwr-toast.mjs +40 -19
  274. package/fesm2022/ngwr-toast.mjs.map +1 -1
  275. package/fesm2022/ngwr-toolbar.mjs +3 -3
  276. package/fesm2022/ngwr-tour.mjs +6 -6
  277. package/fesm2022/ngwr-transfer-testing.mjs +6 -0
  278. package/fesm2022/ngwr-transfer-testing.mjs.map +1 -1
  279. package/fesm2022/ngwr-transfer.mjs +24 -5
  280. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  281. package/fesm2022/ngwr-tree-testing.mjs +62 -2
  282. package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
  283. package/fesm2022/ngwr-tree.mjs +966 -78
  284. package/fesm2022/ngwr-tree.mjs.map +1 -1
  285. package/fesm2022/ngwr-typography.mjs +3 -3
  286. package/fesm2022/ngwr-utils-router.mjs +3 -3
  287. package/fesm2022/ngwr-utils.mjs +34 -1
  288. package/fesm2022/ngwr-utils.mjs.map +1 -1
  289. package/fesm2022/ngwr-version.mjs +1 -1
  290. package/fesm2022/ngwr-version.mjs.map +1 -1
  291. package/fesm2022/ngwr-virtual-scroll.mjs +3 -3
  292. package/fesm2022/ngwr-window.mjs +33 -22
  293. package/fesm2022/ngwr-window.mjs.map +1 -1
  294. package/file-upload/styles/_index.scss +156 -0
  295. package/i18n/ar.json +21 -4
  296. package/i18n/cs.json +21 -4
  297. package/i18n/de.json +21 -4
  298. package/i18n/en.json +21 -4
  299. package/i18n/es.json +21 -4
  300. package/i18n/fr.json +21 -4
  301. package/i18n/he.json +21 -4
  302. package/i18n/hi.json +21 -4
  303. package/i18n/id.json +21 -4
  304. package/i18n/it.json +21 -4
  305. package/i18n/ja.json +21 -4
  306. package/i18n/ko.json +21 -4
  307. package/i18n/nl.json +21 -4
  308. package/i18n/pl.json +21 -4
  309. package/i18n/pt.json +21 -4
  310. package/i18n/ru.json +21 -4
  311. package/i18n/sv.json +21 -4
  312. package/i18n/tr.json +21 -4
  313. package/i18n/uk.json +21 -4
  314. package/i18n/vi.json +21 -4
  315. package/i18n/zh-TW.json +21 -4
  316. package/i18n/zh.json +21 -4
  317. package/input/styles/_index.scss +68 -1
  318. package/input-otp/styles/_index.scss +14 -0
  319. package/llms-full.txt +52 -20
  320. package/overlay/styles/_arrow.scss +4 -4
  321. package/package.json +33 -1
  322. package/popconfirm/styles/_index.scss +3 -11
  323. package/progress/styles/_index.scss +32 -0
  324. package/schema-form/styles/_index.scss +78 -0
  325. package/schematics/use/rule.js +2 -0
  326. package/schematics/use/symbol-map.json +4 -0
  327. package/select/styles/_index.scss +114 -22
  328. package/skills/ngwr/SKILL.md +1 -1
  329. package/skills/ngwr/references/catalog.md +9 -1
  330. package/slider/styles/_index.scss +22 -0
  331. package/table/styles/_index.scss +167 -3
  332. package/textarea/styles/_index.scss +80 -0
  333. package/theme/styles/_focus.scss +5 -0
  334. package/theme/styles/_motion.scss +5 -0
  335. package/transfer/styles/_index.scss +84 -0
  336. package/tree/styles/_index.scss +138 -5
  337. package/types/ngwr-alert-testing.d.ts +88 -0
  338. package/types/ngwr-badge.d.ts +72 -2
  339. package/types/ngwr-breadcrumbs-testing.d.ts +92 -0
  340. package/types/ngwr-burger-testing.d.ts +51 -0
  341. package/types/ngwr-calendar-testing.d.ts +18 -6
  342. package/types/ngwr-calendar.d.ts +272 -22
  343. package/types/ngwr-cascader.d.ts +10 -1
  344. package/types/ngwr-charts-chart-legend.d.ts +9 -4
  345. package/types/ngwr-charts-line-chart-testing.d.ts +4 -1
  346. package/types/ngwr-charts-line-chart.d.ts +7 -4
  347. package/types/ngwr-color-picker-testing.d.ts +15 -4
  348. package/types/ngwr-color-picker.d.ts +76 -6
  349. package/types/ngwr-compare-testing.d.ts +72 -0
  350. package/types/ngwr-date-picker-testing.d.ts +23 -8
  351. package/types/ngwr-date-picker.d.ts +100 -9
  352. package/types/ngwr-date.d.ts +71 -1
  353. package/types/ngwr-drawer.d.ts +9 -0
  354. package/types/ngwr-dropdown-testing.d.ts +20 -0
  355. package/types/ngwr-dropdown.d.ts +24 -6
  356. package/types/ngwr-event-calendar.d.ts +66 -8
  357. package/types/ngwr-file-upload-testing.d.ts +31 -2
  358. package/types/ngwr-file-upload.d.ts +148 -1
  359. package/types/ngwr-form.d.ts +47 -3
  360. package/types/ngwr-graph-testing.d.ts +8 -3
  361. package/types/ngwr-graph.d.ts +147 -7
  362. package/types/ngwr-input-number-testing.d.ts +10 -0
  363. package/types/ngwr-input-number.d.ts +30 -1
  364. package/types/ngwr-input-otp.d.ts +10 -0
  365. package/types/ngwr-input-testing.d.ts +30 -0
  366. package/types/ngwr-input.d.ts +54 -3
  367. package/types/ngwr-overlay.d.ts +84 -5
  368. package/types/ngwr-pipes.d.ts +2 -1
  369. package/types/ngwr-popconfirm-testing.d.ts +12 -3
  370. package/types/ngwr-popconfirm.d.ts +28 -3
  371. package/types/ngwr-popover-testing.d.ts +19 -2
  372. package/types/ngwr-popover.d.ts +22 -2
  373. package/types/ngwr-progress.d.ts +29 -1
  374. package/types/ngwr-pull-to-refresh-testing.d.ts +83 -0
  375. package/types/ngwr-resizable-testing.d.ts +116 -0
  376. package/types/ngwr-schema-form-testing.d.ts +260 -0
  377. package/types/ngwr-schema-form.d.ts +76 -6
  378. package/types/ngwr-select-testing.d.ts +20 -0
  379. package/types/ngwr-select.d.ts +112 -11
  380. package/types/ngwr-sidebar-testing.d.ts +176 -0
  381. package/types/ngwr-slider-testing.d.ts +3 -1
  382. package/types/ngwr-slider.d.ts +21 -1
  383. package/types/ngwr-sortable-list.d.ts +6 -0
  384. package/types/ngwr-stepper.d.ts +20 -11
  385. package/types/ngwr-table-testing.d.ts +70 -6
  386. package/types/ngwr-table.d.ts +480 -50
  387. package/types/ngwr-tabs-testing.d.ts +14 -17
  388. package/types/ngwr-tabs.d.ts +6 -0
  389. package/types/ngwr-textarea-testing.d.ts +10 -0
  390. package/types/ngwr-textarea.d.ts +48 -2
  391. package/types/ngwr-toast.d.ts +8 -1
  392. package/types/ngwr-transfer-testing.d.ts +3 -0
  393. package/types/ngwr-transfer.d.ts +24 -1
  394. package/types/ngwr-tree-testing.d.ts +65 -1
  395. package/types/ngwr-tree.d.ts +333 -12
  396. package/types/ngwr-utils.d.ts +28 -0
  397. package/types/ngwr-version.d.ts +1 -1
  398. package/types/ngwr-window.d.ts +7 -4
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-input-number.mjs","names":[],"sources":["../../../projects/lib/input-number/input-number.ts","../../../projects/lib/input-number/input-number.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrInput, WrInputGroup, WrInputPrefix, WrInputSuffix, type WrInputSize } from 'ngwr/input';\nimport {\n wrClamp,\n wrRound,\n wrCheckStyles,\n wrDecimal,\n wrDecimalAdd,\n wrDecimalCompare,\n wrDecimalMultiply,\n wrDecimalRound,\n} from 'ngwr/utils';\n\nimport type { WrInputNumberMode, WrInputNumberValue } from './types';\n\n/** Resolve the locale's decimal + grouping separators from `Intl.NumberFormat`. */\nfunction resolveSeparators(locale: string): { decimal: string; group: string } {\n const parts = new Intl.NumberFormat(locale).formatToParts(12345.6);\n const decimal = parts.find(p => p.type === 'decimal')?.value ?? '.';\n const group = parts.find(p => p.type === 'group')?.value ?? '';\n return { decimal, group };\n}\n\n/**\n * The ten digits `locale` writes, index 0 to 9 — empty when the system is\n * algorithmic. ar-EG prints `١٬٢٣٤٫٥`, and `Number()` reads none of those digits,\n * so an edit to the field's own display could never commit. A copy of the time\n * panel's helper in `ngwr/date-picker`, kept a copy for the reason given there.\n */\nfunction resolveNumerals(locale: string): readonly string[] {\n try {\n const formatter = new Intl.NumberFormat(locale, { useGrouping: false });\n const digits: string[] = [];\n for (let i = 0; i < 10; i++) {\n const digit = formatter.format(i);\n if ([...digit].length !== 1 || digits.includes(digit)) return [];\n digits.push(digit);\n }\n return digits;\n } catch {\n return [];\n }\n}\n\n/**\n * Characters a user types for a separator the locale prints as something else:\n * a keyboard sends a plain space where ru / uk / kk group with U+00A0 and fr with\n * U+202F, and a plain apostrophe where de-CH groups with U+2019.\n */\nfunction groupPattern(group: string): RegExp | null {\n if (!group) return null;\n if (/\\s/.test(group)) return /\\s/g;\n if (/['\\u2019]/.test(group)) return /['\\u2019]/g;\n return new RegExp(group.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'g');\n}\n\n/** A finite `min` / `max` as a decimal; an infinite one is no bound. */\nfunction decimalBound(bound: number): string | null {\n return Number.isFinite(bound) ? wrDecimal(bound) : null;\n}\n\n/**\n * `min` / `max` are numbers at runtime in either mode. The declared type is\n * `FormValueControl`'s, which names the bound after the value, so the number\n * is cast into it here and read back out in `minValue` / `maxValue`.\n */\nfunction asBound<M extends WrInputNumberMode>(bound: number): NonNullable<WrInputNumberValue<M>> {\n return bound as unknown as NonNullable<WrInputNumberValue<M>>;\n}\n\n/**\n * Numeric input with locale-aware formatting + ▲▼ stepper buttons.\n *\n * A signal-forms native control: it implements `FormValueControl`, so\n * `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone.\n *\n * Parses leniently while typing (allows partial input like `\"1.\"` or `\"-\"`),\n * re-formats with grouping + fixed decimals on blur.\n *\n * `M` is the `mode`, and it decides what `value` holds: `number | null` by\n * default, `string | null` under `mode=\"decimal\"`, where the digits are kept\n * exact (see `WrInputNumberValue`).\n *\n * Locale comes from Angular's `LOCALE_ID` — input-number intentionally does\n * NOT depend on `ngwr/date` so it can be used in date-free apps.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-input-number [formField]=\"form.qty\" [min]=\"0\" [max]=\"100\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-input-number [(value)]=\"price\" [decimals]=\"2\" suffix=\"USD\" />\n *\n * <!-- exact decimals: `amount` is a `string | null` such as '1234.56' -->\n * <wr-input-number mode=\"decimal\" [(value)]=\"amount\" [decimals]=\"2\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/input-number\n */\n@Component({\n selector: 'wr-input-number',\n templateUrl: './input-number.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-input-number', '[class]': 'classes()' },\n imports: [WrInput, WrInputGroup, WrInputPrefix, WrInputSuffix],\n})\nexport class WrInputNumber<M extends WrInputNumberMode = 'number'> implements FormValueControl<WrInputNumberValue<M>> {\n /**\n * What `value` holds. `'number'` is the engine's double. `'decimal'` keeps\n * the typed digits exact as a canonical string (`'1234.56'`: a `.` for the\n * point, no grouping), reads a decimal comma and pasted spaces, and steps,\n * clamps and rounds through `wrDecimal` from `ngwr/utils`, so `0.2` stepped\n * by `0.1` is `'0.3'`. A lone `.` or `,` is read in the locale's role: its\n * decimal separator is a point, its grouping character is grouping when\n * exactly three digits follow it (`1,234` in en-US is `'1234'`, but `0,125`\n * is `'0.125'`) and a point otherwise. With both present,\n * the last one is the point: `1,234.56` and `1.234,56` are `'1234.56'`.\n * Grouping comes in threes, so `1.2.3` is unreadable and the committed\n * value stays, as it does for any text the field cannot read.\n *\n * @default 'number'\n */\n readonly mode = input<M>('number' as M);\n\n private readonly decimal = computed(() => this.mode() === 'decimal');\n\n /** Minimum allowed value, a number in either mode. @default -Infinity */\n readonly min = input<NonNullable<WrInputNumberValue<M>> | undefined, unknown>(asBound<M>(Number.NEGATIVE_INFINITY), {\n transform: (v: unknown) => asBound<M>(coerceNumberProperty(v, Number.NEGATIVE_INFINITY)),\n });\n\n /** Maximum allowed value, a number in either mode. @default Infinity */\n readonly max = input<NonNullable<WrInputNumberValue<M>> | undefined, unknown>(asBound<M>(Number.POSITIVE_INFINITY), {\n transform: (v: unknown) => asBound<M>(coerceNumberProperty(v, Number.POSITIVE_INFINITY)),\n });\n\n private readonly minValue = computed(() => (this.min() as number | undefined) ?? Number.NEGATIVE_INFINITY);\n private readonly maxValue = computed(() => (this.max() as number | undefined) ?? Number.POSITIVE_INFINITY);\n\n /** Step used by stepper buttons + arrow keys. @default 1 */\n readonly step = input(1, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 1)) });\n\n /**\n * Fixed number of decimals. Rounds the value as it is COMMITTED, and fixes the\n * digits shown once the field reformats on blur. `null` keeps the entered\n * precision and formats with up to 20.\n *\n * Clamped to 0–100, the range `Intl.NumberFormat`'s `minimumFractionDigits` /\n * `maximumFractionDigits` accept — because it is the one numeric input on this\n * component that had no transform, and the value goes straight into the\n * formatter, which THROWS a `RangeError` outside that range rather than\n * degrading. A `[decimals]=\"-1\"` bound from a config object took the whole\n * component down on blur.\n *\n * @default null\n */\n readonly decimals = input<number | null, unknown>(null, {\n transform: (v: unknown): number | null =>\n v === null || v === undefined ? null : Math.min(100, Math.max(0, Math.trunc(coerceNumberProperty(v, 0)))),\n });\n\n /** Render the ▲▼ stepper column. @default true */\n readonly showSteppers = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Control size — forwarded to the field's `[size]`, and shares the\n * `--wr-control-*` contract. @default 'md'\n */\n readonly size = input<WrInputSize>('md');\n\n /** Pill-shaped corners — forwarded to the group AND the field. @default false */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /** Optional prefix label (e.g. `\"$\"`). */\n readonly prefix = input<string>('');\n\n /** Optional suffix label (e.g. `\"kg\"`). */\n readonly suffix = input<string>('');\n\n /** Placeholder shown when the input is empty. */\n readonly placeholder = input<string>('');\n\n /**\n * Accessible name for the field. Unset, the field is named by whatever labels\n * it — there is deliberately no fallback here.\n *\n * It used to mirror the `placeholder`, and an `aria-label` OUTRANKS a\n * `<label>` in the accname order: inside a `<wr-form-field label=\"Quantity\">`\n * the very input that adopts the field's id announced the placeholder (\"0\")\n * instead, and a placeholder disappears as soon as the user types. Standalone\n * nothing was lost by dropping it — an input with no other name already falls\n * back to its own `placeholder` attribute, which is the name axe's `label`\n * rule accepts too.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = computed(() => {\n // Not `??`: an empty binding is no name at all, and an empty `aria-label` is\n // worse than none — it still wins the accname order, and announces nothing.\n const explicit = this.ariaLabel();\n if (explicit) return explicit;\n return null;\n });\n\n /** Increment button aria-label. Falls back to `inputNumber.increment`. */\n readonly incrementLabel = input<string | null>(null);\n\n /** Decrement button aria-label. Falls back to `inputNumber.decrement`. */\n readonly decrementLabel = input<string | null>(null);\n\n /**\n * The steppers are icon-only buttons, so these ARE their accessible names.\n * They were hard-coded English while the catalog carried the keys for them\n * unread — a Russian app announced \"Increment\".\n */\n protected readonly resolvedIncrement = useI18nText(this.incrementLabel, 'inputNumber.increment', 'Increment');\n protected readonly resolvedDecrement = useI18nText(this.decrementLabel, 'inputNumber.decrement', 'Decrement');\n\n /** Disable interaction. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Read-only — values cannot be changed (steppers + typing disabled). @default false */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The value, `null` when empty: a `number` in `'number'` mode, a canonical\n * decimal string in `'decimal'` mode. Bound by `[formField]`, or two-way via\n * `[(value)]`.\n */\n readonly value = model<WrInputNumberValue<M>>(null);\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n private readonly locale = inject(LOCALE_ID);\n private readonly separators = resolveSeparators(this.locale);\n private readonly numerals = resolveNumerals(this.locale);\n private readonly group = groupPattern(this.separators.group);\n\n /** Text currently in the input (may be partial / invalid mid-type). */\n protected readonly text = signal<string>('');\n\n /** Whether the input is focused. While true, the input handlers own `text`. */\n protected readonly focused = signal(false);\n\n private readonly field = viewChild.required<ElementRef<HTMLInputElement>>('input');\n\n protected readonly interactive = computed(() => !this.disabled() && !this.readonly());\n\n /** The value as the decimal core reads it; `null` when empty or unreadable. */\n private readonly decimalValue = computed(() => {\n const v = this.value();\n return v === null ? null : wrDecimal(v);\n });\n\n protected readonly atMin = computed(() => {\n if (this.decimal()) return this.atDecimalBound(this.minValue(), -1);\n const v = this.value() as number | null;\n return v !== null && v <= this.minValue();\n });\n\n protected readonly atMax = computed(() => {\n if (this.decimal()) return this.atDecimalBound(this.maxValue(), 1);\n const v = this.value() as number | null;\n return v !== null && v >= this.maxValue();\n });\n\n private atDecimalBound(bound: number, side: -1 | 1): boolean {\n const v = this.decimalValue();\n const limit = decimalBound(bound);\n if (v === null || limit === null) return false;\n const order = wrDecimalCompare(v, limit);\n return order !== null && order * side >= 0;\n }\n\n /**\n * The size and pill modifiers mirror what is bound down to the chrome, because\n * the stepper column belongs to neither half of it: the field carries\n * `wr-input--<size>`, the column is its SIBLING, and the group carries no size\n * at all. Without a modifier of its own the column drew one 10x6 chevron at\n * every size and ran its dividers into a pill's rounded end.\n */\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-input-number--${size}`);\n if (this.rounded()) parts.push('wr-input-number--rounded');\n if (this.disabled()) parts.push('wr-input-number--disabled');\n return parts.join(' ');\n });\n\n /**\n * Fraction digits the stepper rounds its arithmetic to when `decimals` says\n * nothing. High enough to leave a real value alone, low enough to erase the\n * binary-float tail that repeated stepping accumulates.\n */\n private static readonly STEP_PRECISION = 10;\n\n /**\n * Above this, the anti-drift round is skipped — it would MANUFACTURE drift.\n *\n * `wrRound(v, 10)` is `Math.round((v + EPSILON) * 1e10) / 1e10`, and the scale\n * factor is only exact while `v * 1e10` stays inside 2^53, i.e. |v| under\n * about 900,720. In practice the round-trip still recovers up to ~9.2e8 and\n * then breaks: `wrRound(1000000001, 10)` is `1000000000.9999999`, and since\n * `format` prints up to 20 fraction digits that tail reaches the screen —\n * and compounds, because the next press starts from it. Integer stepping at\n * that magnitude is exact in IEEE754 and needed no help; the only thing this\n * rounding exists to defend is `0.1 + 0.1 + 0.1`.\n */\n private static readonly SAFE_ROUND_MAGNITUDE = 1e6;\n\n /** Steps finer than this would be rounded away by {@link STEP_PRECISION}. */\n private static readonly SAFE_ROUND_STEP = 1e-9;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('input-number');\n // Keep the display `text` in sync with external writes to `value` (via\n // `[formField]` / `[(value)]`). While the user is editing, the input\n // handlers own `text`, so skip re-formatting to avoid clobbering partial\n // input (e.g. mid-typed grouping or a value that is still being clamped).\n effect(() => {\n const v = this.value();\n if (this.focused()) return;\n if (v === null || Number.isNaN(v)) {\n this.text.set('');\n return;\n }\n // SHOW WHAT THE MODEL HOLDS. It used to format `constrain(v)`, so a\n // `[max]=\"10\"` field handed 500 drew \"10\" over a model that still said\n // 500 — the display was the thing lying, not the model.\n //\n // The tempting repair is to write the clamp back so the two agree, and\n // that is worse: under `[formField]` the bounds arrive ONLY through the\n // schema's `min()` / `max()` rules (binding `[min]` next to `[formField]`\n // is an NG8022 compile error), so overwriting the value ERASES the very\n // error those rules exist to raise — and the write marks a pristine form\n // dirty, tripping unsaved-changes guards and opening every other\n // validator's message on first paint.\n //\n // So: `min` / `max` bound what this component's own edits may produce,\n // and a value written from outside is displayed as it is and left for\n // validation to judge.\n this.text.set(this.format(v));\n });\n }\n\n /**\n * Focus the text field — what Signal Forms calls to focus this control, from\n * `focusBoundControl()`. The host is a plain element, so without this the\n * call landed on something that cannot take focus and nothing moved.\n */\n focus(options?: FocusOptions): void {\n this.field().nativeElement.focus(options);\n }\n\n // Template handlers\n\n protected onInput(event: Event): void {\n const raw = (event.target as HTMLInputElement).value;\n this.text.set(raw);\n if (!raw.trim()) {\n this.commit(null);\n return;\n }\n if (this.decimal()) {\n const parsed = this.parseDecimal(raw);\n if (parsed === null) return; // partial or unreadable - the committed value stays\n this.commit(this.constrainDecimal(parsed));\n return;\n }\n const parsed = this.parse(raw);\n if (parsed === null) return; // partial input — wait for more\n const next = this.constrain(parsed);\n this.commit(next);\n }\n\n protected onFocus(): void {\n this.focused.set(true);\n }\n\n protected onBlur(): void {\n // Flipping `focused` false lets the sync effect re-format `text` from the\n // committed `value` (e.g. `\"1.\"` → `\"1\"`, or grouping the final number).\n this.focused.set(false);\n this.touch.emit();\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (!this.interactive()) return;\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;\n event.preventDefault();\n const direction = event.key === 'ArrowUp' ? 1 : -1;\n const multiplier = event.shiftKey ? 10 : 1;\n this.bump(direction * multiplier);\n }\n\n protected stepBy(direction: 1 | -1): void {\n if (!this.interactive()) return;\n this.bump(direction);\n }\n\n // Internals\n\n /** The one write to `value`: what a mode holds is decided above, not here. */\n private commit(next: number | string | null): void {\n this.value.set(next as WrInputNumberValue<M>);\n }\n\n private bump(units: number): void {\n const stepSize = this.step() || 1;\n if (this.decimal()) {\n const base = this.decimalValue() ?? wrDecimal(this.fallbackBase()) ?? '0';\n const next = this.constrainDecimal(wrDecimalAdd(base, wrDecimalMultiply(stepSize, units)) ?? base);\n this.commit(next);\n this.text.set(this.format(next));\n return;\n }\n const base = (this.value() as number | null) ?? this.fallbackBase();\n // `wrRound` before `constrain`, and only on the stepped ARITHMETIC. Binary\n // floats do not add: three presses of a `step=\"0.1\"` stepper produced\n // 0.30000000000000004, `constrain` only rounds when `decimals` is set, and\n // `format` prints up to 20 fraction digits — so the drift went into the\n // model AND onto the screen. Ten digits erases IEEE noise without\n // quantising a value the user typed (0.15000000000000002 stays 0.15, it\n // does not snap to the step grid).\n //\n // Guarded on BOTH ends, because outside them the correction is the thing\n // that corrupts: see SAFE_ROUND_MAGNITUDE, and a step finer than 1e-9 would\n // simply be rounded away to nothing.\n const raw = base + units * stepSize;\n const correctable =\n Math.abs(raw) < WrInputNumber.SAFE_ROUND_MAGNITUDE && Math.abs(stepSize) >= WrInputNumber.SAFE_ROUND_STEP;\n const next = this.constrain(correctable ? wrRound(raw, WrInputNumber.STEP_PRECISION) : raw);\n this.commit(next);\n this.text.set(this.format(next));\n }\n\n /** Choose a sensible starting point when bumping from `null`. */\n private fallbackBase(): number {\n if (Number.isFinite(this.minValue()) && this.minValue() > 0) return this.minValue();\n if (Number.isFinite(this.maxValue()) && this.maxValue() < 0) return this.maxValue();\n return 0;\n }\n\n private constrain(v: number): number {\n let next = wrClamp(v, this.minValue(), this.maxValue());\n const d = this.decimals();\n if (d !== null) next = wrRound(next, d);\n return next;\n }\n\n /** `constrain` for a decimal string: the bounds and `decimals` through the decimal core. */\n private constrainDecimal(v: string): string {\n let next = v;\n const min = decimalBound(this.minValue());\n const max = decimalBound(this.maxValue());\n if (min !== null && wrDecimalCompare(next, min) === -1) next = min;\n if (max !== null && wrDecimalCompare(next, max) === 1) next = max;\n const d = this.decimals();\n if (d !== null) next = wrDecimalRound(next, d) ?? next;\n return next;\n }\n\n /**\n * The locale's digits to ASCII, its minus sign (U+2212 in sv, fi, …) to a\n * hyphen, and the bidi marks it puts around a negative number dropped — every\n * one of them is in the text this field formats, and neither `Number()` nor\n * `wrDecimal` reads them.\n */\n private toAscii(text: string): string {\n return [...text]\n .map(ch => {\n const digit = this.numerals.indexOf(ch);\n return digit < 0 ? ch : String(digit);\n })\n .join('')\n .replace(/[\\u200e\\u200f\\u061c]/g, '')\n .replace(/\\u2212/g, '-');\n }\n\n /**\n * Decimal-mode parse: a canonical decimal string, or `null` for partial or\n * unreadable text. Spaces of every width and the Swiss apostrophe are\n * grouping; `.` and `,` are read by the rule on `mode`, and a separator read\n * as grouping has to come in threes, so `1.2.3` is unreadable rather than 123.\n */\n private parseDecimal(raw: string): string | null {\n // fa and ar-EG write U+066B and U+066C, which the `.` and `,` rule never sees.\n const { decimal, group } = this.separators;\n const ownMarks = decimal !== '.' && decimal !== ',';\n let text = this.toAscii(raw.trim()).replace(/[\\s'\\u2019]/g, '');\n if (ownMarks) text = text.replaceAll(group, '').replaceAll(decimal, '.');\n const separators = [...text.matchAll(/[.,]/g)];\n if (separators.length) {\n const last = separators[separators.length - 1];\n let point: number | null = last.index;\n if (separators.length === 1) {\n // Three digits after the locale's grouping character is grouping,\n // unless nothing or a lone zero precedes it: `0,125` is a fraction.\n const after = text.length - last.index - 1;\n const lead = text.slice(0, last.index);\n if (last[0] !== (ownMarks ? '.' : decimal) && after === 3 && !/^-?0?$/.test(lead)) point = null;\n } else if (separators.every(s => s[0] === last[0])) {\n point = null;\n }\n const groups = (point === null ? text : text.slice(0, point)).split(/[.,]/);\n if (groups.slice(1).some(group => group.length !== 3)) return null;\n text = point === null ? groups.join('') : `${groups.join('')}.${text.slice(point + 1)}`;\n }\n if (/^-?\\.?$/.test(text) || text.endsWith('.')) return null;\n return wrDecimal(text);\n }\n\n /** Parse a locale-formatted string. Returns `null` for partial / not-yet-numeric input. */\n private parse(raw: string): number | null {\n const trimmed = raw.trim();\n if (!trimmed) return null;\n let normalised = this.toAscii(trimmed);\n // Strip group separators, normalise the decimal separator to `.`.\n if (this.group) {\n normalised = normalised.replace(this.group, '');\n }\n if (this.separators.decimal !== '.') {\n normalised = normalised.split(this.separators.decimal).join('.');\n }\n // Partial inputs we don't want to clobber while the user is still typing:\n // `-`, `-.`, `.`, `1.`, `-1.` etc.\n if (/^-?\\.?$/.test(normalised) || normalised.endsWith('.')) return null;\n const n = Number(normalised);\n return Number.isFinite(n) ? n : null;\n }\n\n /** Format a value using `Intl.NumberFormat` for the active locale. */\n private format(v: number | string): string {\n const d = this.decimals();\n if (this.decimal()) {\n const canonical = wrDecimal(v);\n if (canonical === null) return String(v);\n // The string's own places, so `'1.50'` shows as typed; `decimals` fixes them.\n const point = canonical.indexOf('.');\n const places = d ?? Math.min(100, point < 0 ? 0 : canonical.length - point - 1);\n const formatter = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: places,\n maximumFractionDigits: places,\n useGrouping: true,\n });\n // ES2023 formats a decimal string exactly; the lib typings here stop at ES2022.\n return formatter.format(canonical as unknown as number);\n }\n const formatter = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: d ?? 0,\n maximumFractionDigits: d ?? 20,\n useGrouping: true,\n });\n return formatter.format(v as number);\n }\n}\n","<wr-input-group [rounded]=\"rounded()\">\n @if (prefix(); as p) {\n <span wrInputPrefix>{{ p }}</span>\n }\n <input\n #input\n wrInput\n type=\"text\"\n inputmode=\"decimal\"\n autocomplete=\"off\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n spellcheck=\"false\"\n [value]=\"text()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeydown($event)\"\n />\n @if (suffix(); as s) {\n <span wrInputSuffix>{{ s }}</span>\n }\n @if (showSteppers()) {\n <div class=\"wr-input-number__steppers\" wrInputSuffix>\n <button\n type=\"button\"\n class=\"wr-input-number__step\"\n tabindex=\"-1\"\n [attr.aria-label]=\"resolvedIncrement()\"\n [disabled]=\"!interactive() || atMax()\"\n (click)=\"stepBy(1)\"\n >\n <svg\n class=\"wr-icon__svg\"\n width=\"14\"\n height=\"14\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m18 15-6-6-6 6\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-input-number__step\"\n tabindex=\"-1\"\n [attr.aria-label]=\"resolvedDecrement()\"\n [disabled]=\"!interactive() || atMin()\"\n (click)=\"stepBy(-1)\"\n >\n <svg\n class=\"wr-icon__svg\"\n width=\"14\"\n height=\"14\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </button>\n </div>\n }\n</wr-input-group>\n"],"mappings":";;;;;;;;;;;;AAwCA,SAAS,kBAAkB,QAAc;CACvC,MAAM,QAAQ,IAAI,KAAK,aAAa,MAAM,CAAC,CAAC,cAAc,OAAO;CAGjE,OAAO;EAAE,SAFO,MAAM,MAAK,MAAK,EAAE,SAAS,SAAS,CAAC,EAAE,SAAS;EAE9C,OADJ,MAAM,MAAK,MAAK,EAAE,SAAS,OAAO,CAAC,EAAE,SAAS;CACrC;AACzB;AAQA,SAAS,gBAAgB,QAAc;CACrC,IAAI;EACF,MAAM,YAAY,IAAI,KAAK,aAAa,QAAQ,EAAE,aAAa,MAAK,CAAE;EACtE,MAAM,SAAmB,CAAA;EACzB,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,KAAK;GAC3B,MAAM,QAAQ,UAAU,OAAO,CAAC;GAChC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,WAAW,KAAK,OAAO,SAAS,KAAK,GAAG,OAAO,CAAA;GAC9D,OAAO,KAAK,KAAK;EACnB;EACA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A;EAAA,gBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,gBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-input-number.mjs","names":[],"sources":["../../../projects/lib/input-number/input-number.ts","../../../projects/lib/input-number/input-number.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrInput, WrInputGroup, WrInputPrefix, WrInputSuffix, type WrInputSize } from 'ngwr/input';\nimport {\n wrClamp,\n wrRound,\n wrCheckStyles,\n wrDecimal,\n wrDecimalAdd,\n wrDecimalCompare,\n wrDecimalMultiply,\n wrDecimalRound,\n} from 'ngwr/utils';\n\nimport type { WrInputNumberMode, WrInputNumberValue } from './types';\n\n/** Resolve the locale's decimal + grouping separators from `Intl.NumberFormat`. */\nfunction resolveSeparators(locale: string): { decimal: string; group: string } {\n const parts = new Intl.NumberFormat(locale).formatToParts(12345.6);\n const decimal = parts.find(p => p.type === 'decimal')?.value ?? '.';\n const group = parts.find(p => p.type === 'group')?.value ?? '';\n return { decimal, group };\n}\n\n/**\n * The ten digits `locale` writes, index 0 to 9 — empty when the system is\n * algorithmic. ar-EG prints `١٬٢٣٤٫٥`, and `Number()` reads none of those digits,\n * so an edit to the field's own display could never commit. A copy of the time\n * panel's helper in `ngwr/date-picker`, kept a copy for the reason given there.\n */\nfunction resolveNumerals(locale: string): readonly string[] {\n try {\n const formatter = new Intl.NumberFormat(locale, { useGrouping: false });\n const digits: string[] = [];\n for (let i = 0; i < 10; i++) {\n const digit = formatter.format(i);\n if ([...digit].length !== 1 || digits.includes(digit)) return [];\n digits.push(digit);\n }\n return digits;\n } catch {\n return [];\n }\n}\n\n/**\n * Characters a user types for a separator the locale prints as something else:\n * a keyboard sends a plain space where ru / uk / kk group with U+00A0 and fr with\n * U+202F, and a plain apostrophe where de-CH groups with U+2019.\n */\nfunction groupPattern(group: string): RegExp | null {\n if (!group) return null;\n if (/\\s/.test(group)) return /\\s/g;\n if (/['\\u2019]/.test(group)) return /['\\u2019]/g;\n return new RegExp(group.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'g');\n}\n\n/** A finite `min` / `max` as a decimal; an infinite one is no bound. */\nfunction decimalBound(bound: number): string | null {\n return Number.isFinite(bound) ? wrDecimal(bound) : null;\n}\n\n/**\n * `min` / `max` are numbers at runtime in either mode. The declared type is\n * `FormValueControl`'s, which names the bound after the value, so the number\n * is cast into it here and read back out in `minValue` / `maxValue`.\n */\nfunction asBound<M extends WrInputNumberMode>(bound: number): NonNullable<WrInputNumberValue<M>> {\n return bound as unknown as NonNullable<WrInputNumberValue<M>>;\n}\n\n/**\n * Numeric input with locale-aware formatting + ▲▼ stepper buttons.\n *\n * A signal-forms native control: it implements `FormValueControl`, so\n * `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone.\n *\n * Parses leniently while typing (allows partial input like `\"1.\"` or `\"-\"`),\n * re-formats with grouping + fixed decimals on blur.\n *\n * `M` is the `mode`, and it decides what `value` holds: `number | null` by\n * default, `string | null` under `mode=\"decimal\"`, where the digits are kept\n * exact (see `WrInputNumberValue`).\n *\n * Locale comes from Angular's `LOCALE_ID` — input-number intentionally does\n * NOT depend on `ngwr/date` so it can be used in date-free apps.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-input-number [formField]=\"form.qty\" [min]=\"0\" [max]=\"100\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-input-number [(value)]=\"price\" [decimals]=\"2\" suffix=\"USD\" />\n *\n * <!-- exact decimals: `amount` is a `string | null` such as '1234.56' -->\n * <wr-input-number mode=\"decimal\" [(value)]=\"amount\" [decimals]=\"2\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/input-number\n */\n@Component({\n selector: 'wr-input-number',\n templateUrl: './input-number.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-input-number', '[class]': 'classes()' },\n imports: [WrInput, WrInputGroup, WrInputPrefix, WrInputSuffix],\n})\nexport class WrInputNumber<M extends WrInputNumberMode = 'number'> implements FormValueControl<WrInputNumberValue<M>> {\n /**\n * What `value` holds. `'number'` is the engine's double. `'decimal'` keeps\n * the typed digits exact as a canonical string (`'1234.56'`: a `.` for the\n * point, no grouping), reads a decimal comma and pasted spaces, and steps,\n * clamps and rounds through `wrDecimal` from `ngwr/utils`, so `0.2` stepped\n * by `0.1` is `'0.3'`. A lone `.` or `,` is read in the locale's role: its\n * decimal separator is a point, its grouping character is grouping when\n * exactly three digits follow it (`1,234` in en-US is `'1234'`, but `0,125`\n * is `'0.125'`) and a point otherwise. With both present,\n * the last one is the point: `1,234.56` and `1.234,56` are `'1234.56'`.\n * Grouping comes in threes, so `1.2.3` is unreadable and the committed\n * value stays, as it does for any text the field cannot read.\n *\n * @default 'number'\n */\n readonly mode = input<M>('number' as M);\n\n private readonly decimal = computed(() => this.mode() === 'decimal');\n\n /** Minimum allowed value, a number in either mode. @default -Infinity */\n readonly min = input<NonNullable<WrInputNumberValue<M>> | undefined, unknown>(asBound<M>(Number.NEGATIVE_INFINITY), {\n transform: (v: unknown) => asBound<M>(coerceNumberProperty(v, Number.NEGATIVE_INFINITY)),\n });\n\n /** Maximum allowed value, a number in either mode. @default Infinity */\n readonly max = input<NonNullable<WrInputNumberValue<M>> | undefined, unknown>(asBound<M>(Number.POSITIVE_INFINITY), {\n transform: (v: unknown) => asBound<M>(coerceNumberProperty(v, Number.POSITIVE_INFINITY)),\n });\n\n private readonly minValue = computed(() => (this.min() as number | undefined) ?? Number.NEGATIVE_INFINITY);\n private readonly maxValue = computed(() => (this.max() as number | undefined) ?? Number.POSITIVE_INFINITY);\n\n /** Step used by stepper buttons + arrow keys. @default 1 */\n readonly step = input(1, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 1)) });\n\n /**\n * Fixed number of decimals. Rounds the value as it is COMMITTED, and fixes the\n * digits shown once the field reformats on blur. `null` keeps the entered\n * precision and formats with up to 20.\n *\n * Clamped to 0–100, the range `Intl.NumberFormat`'s `minimumFractionDigits` /\n * `maximumFractionDigits` accept — because it is the one numeric input on this\n * component that had no transform, and the value goes straight into the\n * formatter, which THROWS a `RangeError` outside that range rather than\n * degrading. A `[decimals]=\"-1\"` bound from a config object took the whole\n * component down on blur.\n *\n * @default null\n */\n readonly decimals = input<number | null, unknown>(null, {\n transform: (v: unknown): number | null =>\n v === null || v === undefined ? null : Math.min(100, Math.max(0, Math.trunc(coerceNumberProperty(v, 0)))),\n });\n\n /** Render the ▲▼ stepper column. @default true */\n readonly showSteppers = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Control size — forwarded to the field's `[size]`, and shares the\n * `--wr-control-*` contract. @default 'md'\n */\n readonly size = input<WrInputSize>('md');\n\n /** Pill-shaped corners — forwarded to the group AND the field. @default false */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /** Optional prefix label (e.g. `\"$\"`). */\n readonly prefix = input<string>('');\n\n /** Optional suffix label (e.g. `\"kg\"`). */\n readonly suffix = input<string>('');\n\n /** Placeholder shown when the input is empty. */\n readonly placeholder = input<string>('');\n\n /**\n * Accessible name for the field. Unset, the field is named by whatever labels\n * it — there is deliberately no fallback here.\n *\n * It used to mirror the `placeholder`, and an `aria-label` OUTRANKS a\n * `<label>` in the accname order: inside a `<wr-form-field label=\"Quantity\">`\n * the very input that adopts the field's id announced the placeholder (\"0\")\n * instead, and a placeholder disappears as soon as the user types. Standalone\n * nothing was lost by dropping it — an input with no other name already falls\n * back to its own `placeholder` attribute, which is the name axe's `label`\n * rule accepts too.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = computed(() => {\n // Not `??`: an empty binding is no name at all, and an empty `aria-label` is\n // worse than none — it still wins the accname order, and announces nothing.\n const explicit = this.ariaLabel();\n if (explicit) return explicit;\n return null;\n });\n\n /** Increment button aria-label. Falls back to `inputNumber.increment`. */\n readonly incrementLabel = input<string | null>(null);\n\n /** Decrement button aria-label. Falls back to `inputNumber.decrement`. */\n readonly decrementLabel = input<string | null>(null);\n\n /**\n * The steppers are icon-only buttons, so these ARE their accessible names.\n * They were hard-coded English while the catalog carried the keys for them\n * unread — a Russian app announced \"Increment\".\n */\n protected readonly resolvedIncrement = useI18nText(this.incrementLabel, 'inputNumber.increment', 'Increment');\n protected readonly resolvedDecrement = useI18nText(this.decrementLabel, 'inputNumber.decrement', 'Decrement');\n\n /**\n * Show a clear (×) button while the field holds text and is neither disabled\n * nor read-only. Clearing sets `value` to `null`, emits `touch` and puts focus\n * back in the field. It is a pointer control: from the keyboard, emptying the\n * field clears the value. @default false\n */\n readonly clearable = input(false, { transform: coerceBooleanProperty });\n\n /** Clear (×) button aria-label. Falls back to `common.clear`. */\n readonly clearLabel = input<string | null>(null);\n\n /**\n * Show a spinner after the field and mark the field `aria-busy`. The field\n * stays editable. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /** Disable interaction. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Read-only — values cannot be changed (steppers + typing disabled). @default false */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The value, `null` when empty: a `number` in `'number'` mode, a canonical\n * decimal string in `'decimal'` mode. Bound by `[formField]`, or two-way via\n * `[(value)]`.\n */\n readonly value = model<WrInputNumberValue<M>>(null);\n\n /** Emitted on blur, and by the clear (×) button, so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n private readonly locale = inject(LOCALE_ID);\n private readonly separators = resolveSeparators(this.locale);\n private readonly numerals = resolveNumerals(this.locale);\n private readonly group = groupPattern(this.separators.group);\n\n /** Text currently in the input (may be partial / invalid mid-type). */\n protected readonly text = signal<string>('');\n\n /** Whether the input is focused. While true, the input handlers own `text`. */\n protected readonly focused = signal(false);\n\n private readonly field = viewChild.required<ElementRef<HTMLInputElement>>('input');\n\n protected readonly interactive = computed(() => !this.disabled() && !this.readonly());\n\n /** The value as the decimal core reads it; `null` when empty or unreadable. */\n private readonly decimalValue = computed(() => {\n const v = this.value();\n return v === null ? null : wrDecimal(v);\n });\n\n protected readonly atMin = computed(() => {\n if (this.decimal()) return this.atDecimalBound(this.minValue(), -1);\n const v = this.value() as number | null;\n return v !== null && v <= this.minValue();\n });\n\n protected readonly atMax = computed(() => {\n if (this.decimal()) return this.atDecimalBound(this.maxValue(), 1);\n const v = this.value() as number | null;\n return v !== null && v >= this.maxValue();\n });\n\n private atDecimalBound(bound: number, side: -1 | 1): boolean {\n const v = this.decimalValue();\n const limit = decimalBound(bound);\n if (v === null || limit === null) return false;\n const order = wrDecimalCompare(v, limit);\n return order !== null && order * side >= 0;\n }\n\n /**\n * The size and pill modifiers mirror what is bound down to the chrome, because\n * the stepper column belongs to neither half of it: the field carries\n * `wr-input--<size>`, the column is its SIBLING, and the group carries no size\n * at all. Without a modifier of its own the column drew one 10x6 chevron at\n * every size and ran its dividers into a pill's rounded end.\n */\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-input-number--${size}`);\n if (this.rounded()) parts.push('wr-input-number--rounded');\n if (this.disabled()) parts.push('wr-input-number--disabled');\n return parts.join(' ');\n });\n\n /**\n * Fraction digits the stepper rounds its arithmetic to when `decimals` says\n * nothing. High enough to leave a real value alone, low enough to erase the\n * binary-float tail that repeated stepping accumulates.\n */\n private static readonly STEP_PRECISION = 10;\n\n /**\n * Above this, the anti-drift round is skipped — it would MANUFACTURE drift.\n *\n * `wrRound(v, 10)` is `Math.round((v + EPSILON) * 1e10) / 1e10`, and the scale\n * factor is only exact while `v * 1e10` stays inside 2^53, i.e. |v| under\n * about 900,720. In practice the round-trip still recovers up to ~9.2e8 and\n * then breaks: `wrRound(1000000001, 10)` is `1000000000.9999999`, and since\n * `format` prints up to 20 fraction digits that tail reaches the screen —\n * and compounds, because the next press starts from it. Integer stepping at\n * that magnitude is exact in IEEE754 and needed no help; the only thing this\n * rounding exists to defend is `0.1 + 0.1 + 0.1`.\n */\n private static readonly SAFE_ROUND_MAGNITUDE = 1e6;\n\n /** Steps finer than this would be rounded away by {@link STEP_PRECISION}. */\n private static readonly SAFE_ROUND_STEP = 1e-9;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('input-number');\n // Keep the display `text` in sync with external writes to `value` (via\n // `[formField]` / `[(value)]`). While the user is editing, the input\n // handlers own `text`, so skip re-formatting to avoid clobbering partial\n // input (e.g. mid-typed grouping or a value that is still being clamped).\n effect(() => {\n const v = this.value();\n if (this.focused()) return;\n if (v === null || Number.isNaN(v)) {\n this.text.set('');\n return;\n }\n // SHOW WHAT THE MODEL HOLDS. It used to format `constrain(v)`, so a\n // `[max]=\"10\"` field handed 500 drew \"10\" over a model that still said\n // 500 — the display was the thing lying, not the model.\n //\n // The tempting repair is to write the clamp back so the two agree, and\n // that is worse: under `[formField]` the bounds arrive ONLY through the\n // schema's `min()` / `max()` rules (binding `[min]` next to `[formField]`\n // is an NG8022 compile error), so overwriting the value ERASES the very\n // error those rules exist to raise — and the write marks a pristine form\n // dirty, tripping unsaved-changes guards and opening every other\n // validator's message on first paint.\n //\n // So: `min` / `max` bound what this component's own edits may produce,\n // and a value written from outside is displayed as it is and left for\n // validation to judge.\n this.text.set(this.format(v));\n });\n }\n\n /**\n * Focus the text field — what Signal Forms calls to focus this control, from\n * `focusBoundControl()`. The host is a plain element, so without this the\n * call landed on something that cannot take focus and nothing moved.\n */\n focus(options?: FocusOptions): void {\n this.field().nativeElement.focus(options);\n }\n\n // Template handlers\n\n protected onInput(event: Event): void {\n const raw = (event.target as HTMLInputElement).value;\n this.text.set(raw);\n if (!raw.trim()) {\n this.commit(null);\n return;\n }\n if (this.decimal()) {\n const parsed = this.parseDecimal(raw);\n if (parsed === null) return; // partial or unreadable - the committed value stays\n this.commit(this.constrainDecimal(parsed));\n return;\n }\n const parsed = this.parse(raw);\n if (parsed === null) return; // partial input — wait for more\n const next = this.constrain(parsed);\n this.commit(next);\n }\n\n protected onFocus(): void {\n this.focused.set(true);\n }\n\n protected onBlur(): void {\n // Flipping `focused` false lets the sync effect re-format `text` from the\n // committed `value` (e.g. `\"1.\"` → `\"1\"`, or grouping the final number).\n this.focused.set(false);\n this.touch.emit();\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (!this.interactive()) return;\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;\n event.preventDefault();\n const direction = event.key === 'ArrowUp' ? 1 : -1;\n const multiplier = event.shiftKey ? 10 : 1;\n this.bump(direction * multiplier);\n }\n\n protected stepBy(direction: 1 | -1): void {\n if (!this.interactive()) return;\n this.bump(direction);\n }\n\n // Internals\n\n /** The one write to `value`: what a mode holds is decided above, not here. */\n private commit(next: number | string | null): void {\n this.value.set(next as WrInputNumberValue<M>);\n }\n\n private bump(units: number): void {\n const stepSize = this.step() || 1;\n if (this.decimal()) {\n const base = this.decimalValue() ?? wrDecimal(this.fallbackBase()) ?? '0';\n const next = this.constrainDecimal(wrDecimalAdd(base, wrDecimalMultiply(stepSize, units)) ?? base);\n this.commit(next);\n this.text.set(this.format(next));\n return;\n }\n const current = this.value() as number | null;\n // A non-finite value gives no number to step from, so it steps like an empty field.\n const base = current !== null && Number.isFinite(current) ? current : this.fallbackBase();\n // `wrRound` before `constrain`, and only on the stepped ARITHMETIC. Binary\n // floats do not add: three presses of a `step=\"0.1\"` stepper produced\n // 0.30000000000000004, `constrain` only rounds when `decimals` is set, and\n // `format` prints up to 20 fraction digits — so the drift went into the\n // model AND onto the screen. Ten digits erases IEEE noise without\n // quantising a value the user typed (0.15000000000000002 stays 0.15, it\n // does not snap to the step grid).\n //\n // Guarded on BOTH ends, because outside them the correction is the thing\n // that corrupts: see SAFE_ROUND_MAGNITUDE, and a step finer than 1e-9 would\n // simply be rounded away to nothing.\n const raw = base + units * stepSize;\n const correctable =\n Math.abs(raw) < WrInputNumber.SAFE_ROUND_MAGNITUDE && Math.abs(stepSize) >= WrInputNumber.SAFE_ROUND_STEP;\n const next = this.constrain(correctable ? wrRound(raw, WrInputNumber.STEP_PRECISION) : raw);\n this.commit(next);\n this.text.set(this.format(next));\n }\n\n /** Choose a sensible starting point when bumping from `null`. */\n private fallbackBase(): number {\n if (Number.isFinite(this.minValue()) && this.minValue() > 0) return this.minValue();\n if (Number.isFinite(this.maxValue()) && this.maxValue() < 0) return this.maxValue();\n return 0;\n }\n\n private constrain(v: number): number {\n let next = wrClamp(v, this.minValue(), this.maxValue());\n const d = this.decimals();\n if (d !== null) next = wrRound(next, d);\n return next;\n }\n\n /** `constrain` for a decimal string: the bounds and `decimals` through the decimal core. */\n private constrainDecimal(v: string): string {\n let next = v;\n const min = decimalBound(this.minValue());\n const max = decimalBound(this.maxValue());\n if (min !== null && wrDecimalCompare(next, min) === -1) next = min;\n if (max !== null && wrDecimalCompare(next, max) === 1) next = max;\n const d = this.decimals();\n if (d !== null) next = wrDecimalRound(next, d) ?? next;\n return next;\n }\n\n /**\n * The locale's digits to ASCII, its minus sign (U+2212 in sv, fi, …) to a\n * hyphen, and the bidi marks it puts around a negative number dropped — every\n * one of them is in the text this field formats, and neither `Number()` nor\n * `wrDecimal` reads them.\n */\n private toAscii(text: string): string {\n return [...text]\n .map(ch => {\n const digit = this.numerals.indexOf(ch);\n return digit < 0 ? ch : String(digit);\n })\n .join('')\n .replace(/[\\u200e\\u200f\\u061c]/g, '')\n .replace(/\\u2212/g, '-');\n }\n\n /**\n * Decimal-mode parse: a canonical decimal string, or `null` for partial or\n * unreadable text. Spaces of every width and the Swiss apostrophe are\n * grouping; `.` and `,` are read by the rule on `mode`, and a separator read\n * as grouping has to come in threes, so `1.2.3` is unreadable rather than 123.\n */\n private parseDecimal(raw: string): string | null {\n // fa and ar-EG write U+066B and U+066C, which the `.` and `,` rule never sees.\n const { decimal, group } = this.separators;\n const ownMarks = decimal !== '.' && decimal !== ',';\n let text = this.toAscii(raw.trim()).replace(/[\\s'\\u2019]/g, '');\n if (ownMarks) text = text.replaceAll(group, '').replaceAll(decimal, '.');\n const separators = [...text.matchAll(/[.,]/g)];\n if (separators.length) {\n const last = separators[separators.length - 1];\n let point: number | null = last.index;\n if (separators.length === 1) {\n // Three digits after the locale's grouping character is grouping,\n // unless nothing or a lone zero precedes it: `0,125` is a fraction.\n const after = text.length - last.index - 1;\n const lead = text.slice(0, last.index);\n if (last[0] !== (ownMarks ? '.' : decimal) && after === 3 && !/^-?0?$/.test(lead)) point = null;\n } else if (separators.every(s => s[0] === last[0])) {\n point = null;\n }\n const groups = (point === null ? text : text.slice(0, point)).split(/[.,]/);\n if (groups.slice(1).some(group => group.length !== 3)) return null;\n text = point === null ? groups.join('') : `${groups.join('')}.${text.slice(point + 1)}`;\n }\n if (/^-?\\.?$/.test(text) || text.endsWith('.')) return null;\n return wrDecimal(text);\n }\n\n /** Parse a locale-formatted string. Returns `null` for partial / not-yet-numeric input. */\n private parse(raw: string): number | null {\n const trimmed = raw.trim();\n if (!trimmed) return null;\n let normalised = this.toAscii(trimmed);\n // Strip group separators, normalise the decimal separator to `.`.\n if (this.group) {\n normalised = normalised.replace(this.group, '');\n }\n if (this.separators.decimal !== '.') {\n normalised = normalised.split(this.separators.decimal).join('.');\n }\n // Partial inputs we don't want to clobber while the user is still typing:\n // `-`, `-.`, `.`, `1.`, `-1.` etc.\n if (/^-?\\.?$/.test(normalised) || normalised.endsWith('.')) return null;\n const n = Number(normalised);\n return Number.isFinite(n) ? n : null;\n }\n\n /** Format a value using `Intl.NumberFormat` for the active locale. */\n private format(v: number | string): string {\n const d = this.decimals();\n if (this.decimal()) {\n const canonical = wrDecimal(v);\n if (canonical === null) return String(v);\n // The string's own places, so `'1.50'` shows as typed; `decimals` fixes them.\n const point = canonical.indexOf('.');\n const places = d ?? Math.min(100, point < 0 ? 0 : canonical.length - point - 1);\n const formatter = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: places,\n maximumFractionDigits: places,\n useGrouping: true,\n });\n // ES2023 formats a decimal string exactly; the lib typings here stop at ES2022.\n return formatter.format(canonical as unknown as number);\n }\n const formatter = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: d ?? 0,\n maximumFractionDigits: d ?? 20,\n useGrouping: true,\n });\n return formatter.format(v as number);\n }\n}\n","<wr-input-group\n [rounded]=\"rounded()\"\n [clearable]=\"clearable()\"\n [clearLabel]=\"clearLabel()\"\n [loading]=\"loading()\"\n (cleared)=\"touch.emit()\"\n>\n @if (prefix(); as p) {\n <span wrInputPrefix>{{ p }}</span>\n }\n <input\n #input\n wrInput\n type=\"text\"\n inputmode=\"decimal\"\n autocomplete=\"off\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n spellcheck=\"false\"\n [value]=\"text()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeydown($event)\"\n />\n @if (suffix(); as s) {\n <span wrInputSuffix>{{ s }}</span>\n }\n @if (showSteppers()) {\n <div class=\"wr-input-number__steppers\" wrInputSuffix>\n <button\n type=\"button\"\n class=\"wr-input-number__step\"\n tabindex=\"-1\"\n [attr.aria-label]=\"resolvedIncrement()\"\n [disabled]=\"!interactive() || atMax()\"\n (click)=\"stepBy(1)\"\n >\n <svg\n class=\"wr-icon__svg\"\n width=\"14\"\n height=\"14\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m18 15-6-6-6 6\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-input-number__step\"\n tabindex=\"-1\"\n [attr.aria-label]=\"resolvedDecrement()\"\n [disabled]=\"!interactive() || atMin()\"\n (click)=\"stepBy(-1)\"\n >\n <svg\n class=\"wr-icon__svg\"\n width=\"14\"\n height=\"14\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </button>\n </div>\n }\n</wr-input-group>\n"],"mappings":";;;;;;;;;;;;AAwCA,SAAS,kBAAkB,Q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ore next */ []);
24
24
  size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
25
+ rounded = input(false, {
26
+ ...ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {},
27
+ transform: coerceBooleanProperty
28
+ });
25
29
  mask = input(false, {
26
30
  ...ngDevMode ? { debugName: "mask" } : /* istanbul ignore next */ {},
27
31
  transform: coerceBooleanProperty
@@ -46,6 +50,7 @@ var WrInputOtp = class WrInputOtp {
46
50
  const parts = [];
47
51
  const size = this.size();
48
52
  if (size !== "md") parts.push(`wr-input-otp--${size}`);
53
+ if (this.rounded()) parts.push("wr-input-otp--rounded");
49
54
  if (this.disabled()) parts.push("wr-input-otp--disabled");
50
55
  else if (this.readonly()) parts.push("wr-input-otp--readonly");
51
56
  return parts.join(" ");
@@ -191,7 +196,7 @@ var WrInputOtp = class WrInputOtp {
191
196
  }
192
197
  static ɵfac = i0.ɵɵngDeclareFactory({
193
198
  minVersion: "12.0.0",
194
- version: "22.2.5",
199
+ version: "22.2.6",
195
200
  ngImport: i0,
196
201
  type: WrInputOtp,
197
202
  deps: [],
@@ -199,7 +204,7 @@ var WrInputOtp = class WrInputOtp {
199
204
  });
200
205
  static ɵcmp = i0.ɵɵngDeclareComponent({
201
206
  minVersion: "17.0.0",
202
- version: "22.2.5",
207
+ version: "22.2.6",
203
208
  type: WrInputOtp,
204
209
  isStandalone: true,
205
210
  selector: "wr-input-otp",
@@ -232,6 +237,13 @@ var WrInputOtp = class WrInputOtp {
232
237
  isRequired: false,
233
238
  transformFunction: null
234
239
  },
240
+ rounded: {
241
+ classPropertyName: "rounded",
242
+ publicName: "rounded",
243
+ isSignal: true,
244
+ isRequired: false,
245
+ transformFunction: null
246
+ },
235
247
  mask: {
236
248
  classPropertyName: "mask",
237
249
  publicName: "mask",
@@ -295,7 +307,7 @@ var WrInputOtp = class WrInputOtp {
295
307
  };
296
308
  i0.ɵɵngDeclareClassMetadata({
297
309
  minVersion: "12.0.0",
298
- version: "22.2.5",
310
+ version: "22.2.6",
299
311
  ngImport: i0,
300
312
  type: WrInputOtp,
301
313
  decorators: [{
@@ -347,6 +359,14 @@ i0.ɵɵngDeclareClassMetadata({
347
359
  required: false
348
360
  }]
349
361
  }],
362
+ rounded: [{
363
+ type: i0.Input,
364
+ args: [{
365
+ isSignal: true,
366
+ alias: "rounded",
367
+ required: false
368
+ }]
369
+ }],
350
370
  mask: [{
351
371
  type: i0.Input,
352
372
  args: [{
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-input-otp.mjs","names":[],"sources":["../../../projects/lib/input-otp/input-otp.ts","../../../projects/lib/input-otp/input-otp.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n type ElementRef,\n untracked,\n viewChildren,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { wrIsComposing, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrInputOtpMode, WrInputOtpSize } from './types';\n\n/**\n * Fixed-length one-time-code input. Renders one `<input>` per character,\n * auto-advances focus on typing, handles paste of a full code, and supports\n * masking like a password field.\n *\n * A signal-forms native control: it implements `FormValueControl<string>`, so\n * `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone. Emits\n * `completed` whenever the code changes while all cells are filled (useful for\n * auto-submission).\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-input-otp [formField]=\"form.code\" length=\"6\" (completed)=\"verify($event)\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-input-otp [(value)]=\"code\" length=\"6\" (completed)=\"verify($event)\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/input-otp\n */\n@Component({\n selector: 'wr-input-otp',\n templateUrl: './input-otp.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-input-otp',\n '[class]': 'classes()',\n role: 'group',\n '[attr.aria-label]': 'groupName()',\n '[attr.aria-labelledby]': 'labelledBy()',\n },\n})\nexport class WrInputOtp implements FormValueControl<string> {\n private readonly dir = inject(Directionality, { optional: true });\n private readonly injector = inject(Injector);\n\n /** Accessible name of the whole strip. Falls back to `inputOtp.label`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'inputOtp.label', 'Verification code');\n\n /** Number of cells to render. Clamped to `[1, 20]`. @default 6 */\n readonly length = input(6, {\n transform: (v: unknown): number => Math.max(1, Math.min(20, coerceNumberProperty(v, 6))),\n });\n\n /** Character set per cell. @default 'numeric' */\n readonly mode = input<WrInputOtpMode>('numeric');\n\n /**\n * Control size — shares the `--wr-control-*` contract. A box carries no size\n * of its own: the host modifier sets `--wr-input-otp-size` / `-font` /\n * `-radius` / `-gap` and every box reads them from the cascade, so one value\n * sizes the whole strip however many boxes `length` renders. @default 'md'\n */\n readonly size = input<WrInputOtpSize>('md');\n\n /** Mask the typed characters like a password. @default false */\n readonly mask = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Disable interaction. Bound automatically from the field's disabled state\n * when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse edits while every box stays focusable and the code still submits.\n * Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * Each box is a real text input, so this is the native `readonly` attribute —\n * arrow keys, Home / End and selection keep working, which is the whole\n * difference from `disabled`. Paste is cancelled too, since a `paste` still\n * reaches a read-only input even though typing does not.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The surrounding `<wr-form-field>`'s error state — bound per BOX rather than\n * on the `role=\"group\"` host, because the box is what takes focus and a reader\n * queries the focused element.\n *\n * @internal\n */\n protected readonly fieldAria = useFormFieldAria();\n\n /**\n * The field's label names the strip, when there is one.\n *\n * The host is a `role=\"group\"`, which `<wr-form-field>`'s `<label for>` cannot\n * reach — `for` binds only to a labelable element — so a field wrapping this\n * rendered a label that named nothing and the strip announced its own generic\n * default instead. An explicit `ariaLabel` still wins over both.\n */\n protected readonly labelledBy = computed(() => (this.ariaLabel() ? null : this.fieldAria.labelledBy()));\n\n /** `null` while the field's label carries the name, or the two are announced together. */\n protected readonly groupName = computed(() => (this.labelledBy() ? null : this.resolvedAriaLabel()));\n\n /** Character shown in empty cells. @default '•' */\n readonly placeholder = input<string>('•');\n\n /** The entered code. Bound by `[formField]`, or two-way via `[(value)]`. */\n readonly value = model<string>('');\n\n /**\n * Fires on every change made while every cell holds a character — so\n * correcting a digit of an already-complete code emits again. Not latched on\n * the incomplete-to-complete transition: a host auto-submitting on it has to\n * guard its own re-entry, and gets the corrected code for free.\n */\n readonly completed = output<string>();\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n protected readonly cells = signal<readonly string[]>(Array.from({ length: 6 }, () => ''));\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-input-otp--${size}`);\n if (this.disabled()) parts.push('wr-input-otp--disabled');\n else if (this.readonly()) parts.push('wr-input-otp--readonly');\n return parts.join(' ');\n });\n\n protected readonly cellType = computed<'password' | 'text'>(() => (this.mask() ? 'password' : 'text'));\n protected readonly cellInputMode = computed(() => (this.mode() === 'numeric' ? 'numeric' : 'text'));\n\n private readonly digitLabel = useI18nFormatter('inputOtp.digit', 'Digit {{index}}');\n private readonly characterLabel = useI18nFormatter('inputOtp.character', 'Character {{index}}');\n\n protected readonly cellRefs = viewChildren<ElementRef<HTMLInputElement>>('cell');\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('input-otp');\n // Resize the cell array whenever `length` changes — preserves existing\n // values, and tells the model about the ones it dropped.\n //\n // The write-back is the half that was missing. Shrinking `length` trimmed\n // the cells and left `value` holding the longer string: six boxes with\n // `123456` typed in, `length` set to 4, four boxes showing `1234` and a\n // form still submitting `123456` — a code the user could not see and had\n // no way to correct, since nothing resynced until the next keystroke. The\n // other effect cannot cover it: it tracks `value` alone and reads `length`\n // inside `untracked`, so a `length` change never re-runs it.\n effect(() => {\n const len = this.length();\n const current = untracked(() => this.cells());\n if (current.length === len) return;\n const next = Array.from({ length: len }, (_, i) => current[i] ?? '');\n this.cells.set(next);\n\n // ONLY when the resize threw characters away. Emitting on every resize\n // clobbers the first render — the array is sized before the `value`\n // effect has split an incoming code into it, so an empty `next` would\n // write `''` over the value the host just set.\n const dropped = current.slice(len).join('');\n if (dropped !== '') this.emitChange();\n });\n\n // Split an external `value` write back into cells (mirrors the old\n // writeValue). Skipped when the value is merely the echo of an in-cell\n // edit, so re-splitting can never shift or clobber what the user typed.\n effect(() => {\n // Coerce null/undefined to '' — a classic-forms binding can write null,\n // which the old `writeValue(v: string | null)` accepted too.\n const v = this.value() ?? '';\n untracked(() => {\n if (this.cells().join('') === v) return;\n const len = this.length();\n const raw = v.slice(0, len);\n const next = Array.from({ length: len }, (_, i) => this.sanitiseChar(raw[i] ?? ''));\n this.cells.set(next);\n });\n });\n }\n\n /**\n * Focus the strip — what Signal Forms calls to focus this control, from\n * `focusBoundControl()`. The host is a `role=\"group\"` with no tab stop of its\n * own, so the call goes to a box: the first EMPTY one, where the next\n * character belongs, or the first box once the code is complete, its\n * character selected so a keystroke replaces it.\n */\n focus(options?: FocusOptions): void {\n const empty = this.cells().indexOf('');\n this.focusCell(empty === -1 ? 0 : empty, options);\n }\n\n // Template handlers\n\n protected onInput(event: Event, index: number): void {\n // An input method leaves its half-built reading in the box and only replaces\n // it on `compositionend`. Sanitising that intermediate text writes `''` back\n // into the field the IME is still composing in, which aborts the conversion\n // outright — so the box is left alone until the text is real.\n if ((event as InputEvent).isComposing) return;\n this.commitCell(event.target as HTMLInputElement, index);\n }\n\n /** @see onInput — this is where an IME's text finally arrives. */\n protected onCompositionEnd(event: CompositionEvent, index: number): void {\n this.commitCell(event.target as HTMLInputElement, index);\n }\n\n private commitCell(target: HTMLInputElement, index: number): void {\n if (this.readonly()) {\n // A read-only input refuses typed characters on its own; this covers the\n // synthetic writes a script (or a spec) can still make.\n target.value = this.cells()[index] ?? '';\n return;\n }\n // The character just typed is the one before the caret, not the last one in the\n // box: typing into a filled box puts the new character beside the old, and where\n // depends on the caret — WebKit put it in FRONT, so `slice(-1)` kept the old one.\n const caret = target.selectionStart;\n const typed = caret ? target.value.slice(caret - 1, caret) : target.value.slice(-1);\n const char = this.sanitiseChar(typed);\n target.value = char;\n this.update(index, char);\n if (char) this.focusCell(index + 1);\n }\n\n protected onKeyDown(event: KeyboardEvent, index: number): void {\n // Backspace and the arrows move the caret between boxes; while a conversion\n // is open they belong to the candidate window, and moving focus out of the\n // composing box discards it.\n if (wrIsComposing(event)) return;\n\n const target = event.target as HTMLInputElement;\n switch (this.inlineKey(event.key)) {\n case 'Backspace':\n if (this.readonly()) {\n // Backspace on an empty box is an EDIT (it clears the previous one),\n // so it goes; the pure navigation keys below stay.\n event.preventDefault();\n break;\n }\n if (target.value === '') {\n event.preventDefault();\n this.update(index - 1, '');\n this.focusCell(index - 1);\n }\n break;\n case 'ArrowLeft':\n event.preventDefault();\n this.focusCell(index - 1);\n break;\n case 'ArrowRight':\n event.preventDefault();\n this.focusCell(index + 1);\n break;\n case 'Home':\n event.preventDefault();\n this.focusCell(0);\n break;\n case 'End':\n event.preventDefault();\n this.focusCell(this.length() - 1);\n break;\n }\n }\n\n protected onPaste(event: ClipboardEvent): void {\n event.preventDefault();\n if (this.readonly()) return;\n const text = event.clipboardData?.getData('text') ?? '';\n const chars = text\n .split('')\n .map(c => this.sanitiseChar(c))\n .filter(c => c.length > 0);\n if (chars.length === 0) return;\n const trimmed = chars.slice(0, this.length());\n const next = Array.from({ length: this.length() }, (_, i) => trimmed[i] ?? '');\n this.cells.set(next);\n this.emitChange();\n // `afterNextRender`, not a straight call. `focusCell` ends in `select()`, and\n // under zoneless CD the DOM still holds the PREVIOUS value at this point —\n // change detection runs in a macrotask. So the selection was made over an\n // empty box and the caret ended up after the character instead of over it:\n // measured, the landing box read `3` with the selection at `1-1`. With\n // `maxlength=\"1\"` and one character already in the box, the very next\n // keystroke was then refused, so a user who pasted a code and typed to\n // correct its last digit got nothing.\n //\n // Only the paste path needs this. Arrow keys move between boxes whose values\n // are not changing, so a synchronous select there is over settled DOM.\n afterNextRender(() => this.focusCell(Math.min(trimmed.length, this.length() - 1)), {\n injector: this.injector,\n });\n }\n\n /**\n * A click selects the box's character, the way Tab into it already does, so the\n * next keystroke replaces it. Left with the caret beside it, `maxlength=\"1\"` made\n * the browser refuse the keystroke outright — the box kept its digit and nothing\n * said why. On `click` rather than `focus`, because the browser places the caret\n * at the pointer after focusing, which would undo a select made on focus.\n */\n protected onClick(event: MouseEvent): void {\n (event.target as HTMLInputElement).select();\n }\n\n protected onBlur(): void {\n this.touch.emit();\n }\n\n protected trackIndex(index: number): number {\n return index;\n }\n\n /**\n * A box's accessible name. It projects no text and carries no label of its own,\n * so this string IS the name a screen reader reads for it.\n *\n * Keyed off `mode`, not fixed: `sanitiseChar` passes any letter through in\n * `alphanumeric` and `text`, so the old literal announced \"Digit 3\" over a box\n * holding `A` — wrong in a way translating it would not have fixed.\n */\n protected cellLabel(index: number): string {\n const params = { index: index + 1 };\n return this.mode() === 'numeric' ? this.digitLabel(params) : this.characterLabel(params);\n }\n\n // Internals\n\n private update(index: number, char: string): void {\n if (index < 0 || index >= this.length()) return;\n const next = [...this.cells()];\n next[index] = char;\n this.cells.set(next);\n this.emitChange();\n }\n\n private emitChange(): void {\n const code = this.cells().join('');\n this.value.set(code);\n if (code.length === this.length() && code.split('').every(c => c.length === 1)) {\n this.completed.emit(code);\n }\n }\n\n private focusCell(i: number, options?: FocusOptions): void {\n if (i < 0 || i >= this.length()) return;\n const el = this.cellRefs()[i]?.nativeElement;\n if (!el) return;\n el.focus(options);\n el.select();\n }\n\n /** Drop a character that doesn't match the configured mode. */\n private sanitiseChar(c: string): string {\n if (!c) return '';\n const one = c.slice(0, 1);\n switch (this.mode()) {\n case 'numeric':\n return /\\d/.test(one) ? one : '';\n case 'alphanumeric':\n return /[a-zA-Z0-9]/.test(one) ? one : '';\n case 'text':\n default:\n return one;\n }\n }\n\n /**\n * The key as the strip SEES it.\n *\n * The boxes run along the inline axis, so under `dir=\"rtl\"` the box to the\n * visual right of the caret is the PREVIOUS one. Home/End stay semantic (first\n * and last box), and Backspace is not a direction at all.\n */\n private inlineKey(key: string): string {\n if (this.dir?.value !== 'rtl') return key;\n if (key === 'ArrowRight') return 'ArrowLeft';\n if (key === 'ArrowLeft') return 'ArrowRight';\n return key;\n }\n}\n","@for (cell of cells(); track trackIndex($index)) {\n <input\n #cell\n class=\"wr-input-otp__cell\"\n [type]=\"cellType()\"\n [attr.inputmode]=\"cellInputMode()\"\n maxlength=\"1\"\n autocomplete=\"one-time-code\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [value]=\"cell\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [placeholder]=\"placeholder()\"\n [attr.aria-label]=\"cellLabel($index)\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (input)=\"onInput($event, $index)\"\n (keydown)=\"onKeyDown($event, $index)\"\n (compositionend)=\"onCompositionEnd($event, $index)\"\n (paste)=\"onPaste($event)\"\n (click)=\"onClick($event)\"\n (blur)=\"onBlur()\"\n />\n}\n"],"mappings":";;;;;;;;;;;;;AAmEA,IAAa,aAAb,MAAa,WAAU;CACJ,MAAM,OAAO,gBAAgB,EAAE,UAAU,KAAI,CAAE;CAC/C,WAAW,OAAO,QAAQ;CAGlC,YAAY,MAAqB,M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AA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-input-otp.mjs","names":[],"sources":["../../../projects/lib/input-otp/input-otp.ts","../../../projects/lib/input-otp/input-otp.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n type ElementRef,\n untracked,\n viewChildren,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { wrIsComposing, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrInputOtpMode, WrInputOtpSize } from './types';\n\n/**\n * Fixed-length one-time-code input. Renders one `<input>` per character,\n * auto-advances focus on typing, handles paste of a full code, and supports\n * masking like a password field.\n *\n * A signal-forms native control: it implements `FormValueControl<string>`, so\n * `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone. Emits\n * `completed` whenever the code changes while all cells are filled (useful for\n * auto-submission).\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-input-otp [formField]=\"form.code\" length=\"6\" (completed)=\"verify($event)\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-input-otp [(value)]=\"code\" length=\"6\" (completed)=\"verify($event)\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/input-otp\n */\n@Component({\n selector: 'wr-input-otp',\n templateUrl: './input-otp.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-input-otp',\n '[class]': 'classes()',\n role: 'group',\n '[attr.aria-label]': 'groupName()',\n '[attr.aria-labelledby]': 'labelledBy()',\n },\n})\nexport class WrInputOtp implements FormValueControl<string> {\n private readonly dir = inject(Directionality, { optional: true });\n private readonly injector = inject(Injector);\n\n /** Accessible name of the whole strip. Falls back to `inputOtp.label`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'inputOtp.label', 'Verification code');\n\n /** Number of cells to render. Clamped to `[1, 20]`. @default 6 */\n readonly length = input(6, {\n transform: (v: unknown): number => Math.max(1, Math.min(20, coerceNumberProperty(v, 6))),\n });\n\n /** Character set per cell. @default 'numeric' */\n readonly mode = input<WrInputOtpMode>('numeric');\n\n /**\n * Control size — shares the `--wr-control-*` contract. A box carries no size\n * of its own: the host modifier sets `--wr-input-otp-size` / `-font` /\n * `-radius` / `-gap` and every box reads them from the cascade, so one value\n * sizes the whole strip however many boxes `length` renders. @default 'md'\n */\n readonly size = input<WrInputOtpSize>('md');\n\n /**\n * Pill-shaped corners. Every box takes them, so a square box draws a circle.\n * @default false\n */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /** Mask the typed characters like a password. @default false */\n readonly mask = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Disable interaction. Bound automatically from the field's disabled state\n * when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse edits while every box stays focusable and the code still submits.\n * Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * Each box is a real text input, so this is the native `readonly` attribute —\n * arrow keys, Home / End and selection keep working, which is the whole\n * difference from `disabled`. Paste is cancelled too, since a `paste` still\n * reaches a read-only input even though typing does not.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The surrounding `<wr-form-field>`'s error state — bound per BOX rather than\n * on the `role=\"group\"` host, because the box is what takes focus and a reader\n * queries the focused element.\n *\n * @internal\n */\n protected readonly fieldAria = useFormFieldAria();\n\n /**\n * The field's label names the strip, when there is one.\n *\n * The host is a `role=\"group\"`, which `<wr-form-field>`'s `<label for>` cannot\n * reach — `for` binds only to a labelable element — so a field wrapping this\n * rendered a label that named nothing and the strip announced its own generic\n * default instead. An explicit `ariaLabel` still wins over both.\n */\n protected readonly labelledBy = computed(() => (this.ariaLabel() ? null : this.fieldAria.labelledBy()));\n\n /** `null` while the field's label carries the name, or the two are announced together. */\n protected readonly groupName = computed(() => (this.labelledBy() ? null : this.resolvedAriaLabel()));\n\n /** Character shown in empty cells. @default '•' */\n readonly placeholder = input<string>('•');\n\n /** The entered code. Bound by `[formField]`, or two-way via `[(value)]`. */\n readonly value = model<string>('');\n\n /**\n * Fires on every change made while every cell holds a character — so\n * correcting a digit of an already-complete code emits again. Not latched on\n * the incomplete-to-complete transition: a host auto-submitting on it has to\n * guard its own re-entry, and gets the corrected code for free.\n */\n readonly completed = output<string>();\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n protected readonly cells = signal<readonly string[]>(Array.from({ length: 6 }, () => ''));\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-input-otp--${size}`);\n if (this.rounded()) parts.push('wr-input-otp--rounded');\n if (this.disabled()) parts.push('wr-input-otp--disabled');\n else if (this.readonly()) parts.push('wr-input-otp--readonly');\n return parts.join(' ');\n });\n\n protected readonly cellType = computed<'password' | 'text'>(() => (this.mask() ? 'password' : 'text'));\n protected readonly cellInputMode = computed(() => (this.mode() === 'numeric' ? 'numeric' : 'text'));\n\n private readonly digitLabel = useI18nFormatter('inputOtp.digit', 'Digit {{index}}');\n private readonly characterLabel = useI18nFormatter('inputOtp.character', 'Character {{index}}');\n\n protected readonly cellRefs = viewChildren<ElementRef<HTMLInputElement>>('cell');\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('input-otp');\n // Resize the cell array whenever `length` changes — preserves existing\n // values, and tells the model about the ones it dropped.\n //\n // The write-back is the half that was missing. Shrinking `length` trimmed\n // the cells and left `value` holding the longer string: six boxes with\n // `123456` typed in, `length` set to 4, four boxes showing `1234` and a\n // form still submitting `123456` — a code the user could not see and had\n // no way to correct, since nothing resynced until the next keystroke. The\n // other effect cannot cover it: it tracks `value` alone and reads `length`\n // inside `untracked`, so a `length` change never re-runs it.\n effect(() => {\n const len = this.length();\n const current = untracked(() => this.cells());\n if (current.length === len) return;\n const next = Array.from({ length: len }, (_, i) => current[i] ?? '');\n this.cells.set(next);\n\n // ONLY when the resize threw characters away. Emitting on every resize\n // clobbers the first render — the array is sized before the `value`\n // effect has split an incoming code into it, so an empty `next` would\n // write `''` over the value the host just set.\n const dropped = current.slice(len).join('');\n if (dropped !== '') this.emitChange();\n });\n\n // Split an external `value` write back into cells (mirrors the old\n // writeValue). Skipped when the value is merely the echo of an in-cell\n // edit, so re-splitting can never shift or clobber what the user typed.\n effect(() => {\n // Coerce null/undefined to '' — a classic-forms binding can write null,\n // which the old `writeValue(v: string | null)` accepted too.\n const v = this.value() ?? '';\n untracked(() => {\n if (this.cells().join('') === v) return;\n const len = this.length();\n const raw = v.slice(0, len);\n const next = Array.from({ length: len }, (_, i) => this.sanitiseChar(raw[i] ?? ''));\n this.cells.set(next);\n });\n });\n }\n\n /**\n * Focus the strip — what Signal Forms calls to focus this control, from\n * `focusBoundControl()`. The host is a `role=\"group\"` with no tab stop of its\n * own, so the call goes to a box: the first EMPTY one, where the next\n * character belongs, or the first box once the code is complete, its\n * character selected so a keystroke replaces it.\n */\n focus(options?: FocusOptions): void {\n const empty = this.cells().indexOf('');\n this.focusCell(empty === -1 ? 0 : empty, options);\n }\n\n // Template handlers\n\n protected onInput(event: Event, index: number): void {\n // An input method leaves its half-built reading in the box and only replaces\n // it on `compositionend`. Sanitising that intermediate text writes `''` back\n // into the field the IME is still composing in, which aborts the conversion\n // outright — so the box is left alone until the text is real.\n if ((event as InputEvent).isComposing) return;\n this.commitCell(event.target as HTMLInputElement, index);\n }\n\n /** @see onInput — this is where an IME's text finally arrives. */\n protected onCompositionEnd(event: CompositionEvent, index: number): void {\n this.commitCell(event.target as HTMLInputElement, index);\n }\n\n private commitCell(target: HTMLInputElement, index: number): void {\n if (this.readonly()) {\n // A read-only input refuses typed characters on its own; this covers the\n // synthetic writes a script (or a spec) can still make.\n target.value = this.cells()[index] ?? '';\n return;\n }\n // The character just typed is the one before the caret, not the last one in the\n // box: typing into a filled box puts the new character beside the old, and where\n // depends on the caret — WebKit put it in FRONT, so `slice(-1)` kept the old one.\n const caret = target.selectionStart;\n const typed = caret ? target.value.slice(caret - 1, caret) : target.value.slice(-1);\n const char = this.sanitiseChar(typed);\n target.value = char;\n this.update(index, char);\n if (char) this.focusCell(index + 1);\n }\n\n protected onKeyDown(event: KeyboardEvent, index: number): void {\n // Backspace and the arrows move the caret between boxes; while a conversion\n // is open they belong to the candidate window, and moving focus out of the\n // composing box discards it.\n if (wrIsComposing(event)) return;\n\n const target = event.target as HTMLInputElement;\n switch (this.inlineKey(event.key)) {\n case 'Backspace':\n if (this.readonly()) {\n // Backspace on an empty box is an EDIT (it clears the previous one),\n // so it goes; the pure navigation keys below stay.\n event.preventDefault();\n break;\n }\n if (target.value === '') {\n event.preventDefault();\n this.update(index - 1, '');\n this.focusCell(index - 1);\n }\n break;\n case 'ArrowLeft':\n event.preventDefault();\n this.focusCell(index - 1);\n break;\n case 'ArrowRight':\n event.preventDefault();\n this.focusCell(index + 1);\n break;\n case 'Home':\n event.preventDefault();\n this.focusCell(0);\n break;\n case 'End':\n event.preventDefault();\n this.focusCell(this.length() - 1);\n break;\n }\n }\n\n protected onPaste(event: ClipboardEvent): void {\n event.preventDefault();\n if (this.readonly()) return;\n const text = event.clipboardData?.getData('text') ?? '';\n const chars = text\n .split('')\n .map(c => this.sanitiseChar(c))\n .filter(c => c.length > 0);\n if (chars.length === 0) return;\n const trimmed = chars.slice(0, this.length());\n const next = Array.from({ length: this.length() }, (_, i) => trimmed[i] ?? '');\n this.cells.set(next);\n this.emitChange();\n // `afterNextRender`, not a straight call. `focusCell` ends in `select()`, and\n // under zoneless CD the DOM still holds the PREVIOUS value at this point —\n // change detection runs in a macrotask. So the selection was made over an\n // empty box and the caret ended up after the character instead of over it:\n // measured, the landing box read `3` with the selection at `1-1`. With\n // `maxlength=\"1\"` and one character already in the box, the very next\n // keystroke was then refused, so a user who pasted a code and typed to\n // correct its last digit got nothing.\n //\n // Only the paste path needs this. Arrow keys move between boxes whose values\n // are not changing, so a synchronous select there is over settled DOM.\n afterNextRender(() => this.focusCell(Math.min(trimmed.length, this.length() - 1)), {\n injector: this.injector,\n });\n }\n\n /**\n * A click selects the box's character, the way Tab into it already does, so the\n * next keystroke replaces it. Left with the caret beside it, `maxlength=\"1\"` made\n * the browser refuse the keystroke outright — the box kept its digit and nothing\n * said why. On `click` rather than `focus`, because the browser places the caret\n * at the pointer after focusing, which would undo a select made on focus.\n */\n protected onClick(event: MouseEvent): void {\n (event.target as HTMLInputElement).select();\n }\n\n protected onBlur(): void {\n this.touch.emit();\n }\n\n protected trackIndex(index: number): number {\n return index;\n }\n\n /**\n * A box's accessible name. It projects no text and carries no label of its own,\n * so this string IS the name a screen reader reads for it.\n *\n * Keyed off `mode`, not fixed: `sanitiseChar` passes any letter through in\n * `alphanumeric` and `text`, so the old literal announced \"Digit 3\" over a box\n * holding `A` — wrong in a way translating it would not have fixed.\n */\n protected cellLabel(index: number): string {\n const params = { index: index + 1 };\n return this.mode() === 'numeric' ? this.digitLabel(params) : this.characterLabel(params);\n }\n\n // Internals\n\n private update(index: number, char: string): void {\n if (index < 0 || index >= this.length()) return;\n const next = [...this.cells()];\n next[index] = char;\n this.cells.set(next);\n this.emitChange();\n }\n\n private emitChange(): void {\n const code = this.cells().join('');\n this.value.set(code);\n if (code.length === this.length() && code.split('').every(c => c.length === 1)) {\n this.completed.emit(code);\n }\n }\n\n private focusCell(i: number, options?: FocusOptions): void {\n if (i < 0 || i >= this.length()) return;\n const el = this.cellRefs()[i]?.nativeElement;\n if (!el) return;\n el.focus(options);\n el.select();\n }\n\n /** Drop a character that doesn't match the configured mode. */\n private sanitiseChar(c: string): string {\n if (!c) return '';\n const one = c.slice(0, 1);\n switch (this.mode()) {\n case 'numeric':\n return /\\d/.test(one) ? one : '';\n case 'alphanumeric':\n return /[a-zA-Z0-9]/.test(one) ? one : '';\n case 'text':\n default:\n return one;\n }\n }\n\n /**\n * The key as the strip SEES it.\n *\n * The boxes run along the inline axis, so under `dir=\"rtl\"` the box to the\n * visual right of the caret is the PREVIOUS one. Home/End stay semantic (first\n * and last box), and Backspace is not a direction at all.\n */\n private inlineKey(key: string): string {\n if (this.dir?.value !== 'rtl') return key;\n if (key === 'ArrowRight') return 'ArrowLeft';\n if (key === 'ArrowLeft') return 'ArrowRight';\n return key;\n }\n}\n","@for (cell of cells(); track trackIndex($index)) {\n <input\n #cell\n class=\"wr-input-otp__cell\"\n [type]=\"cellType()\"\n [attr.inputmode]=\"cellInputMode()\"\n maxlength=\"1\"\n autocomplete=\"one-time-code\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [value]=\"cell\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [placeholder]=\"placeholder()\"\n [attr.aria-label]=\"cellLabel($index)\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (input)=\"onInput($event, $index)\"\n (keydown)=\"onKeyDown($event, $index)\"\n (compositionend)=\"onCompositionEnd($event, $index)\"\n (paste)=\"onPaste($event)\"\n (click)=\"onClick($event)\"\n (blur)=\"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AA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -49,6 +49,29 @@ var WrInputHarness = class WrInputHarness extends ComponentHarness {
49
49
  return (await this.host()).isFocused();
50
50
  }
51
51
  };
52
- export { WrInputHarness };
52
+ /**
53
+ * @license
54
+ *
55
+ * Use of this source code is governed by an MIT-style license that can be
56
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
57
+ */
58
+ var WrInputGroupHarness = class extends ComponentHarness {
59
+ static hostSelector = "wr-input-group";
60
+ async getInput() {
61
+ return this.locatorFor(WrInputHarness)();
62
+ }
63
+ async hasClearButton() {
64
+ return await this.locatorForOptional(".wr-input-group__clear")() !== null;
65
+ }
66
+ async clear() {
67
+ const button = await this.locatorForOptional(".wr-input-group__clear")();
68
+ if (!button) throw new Error("WrInputGroupHarness.clear(): no clear button. It shows on a `clearable` group whose field has text and is neither disabled nor read-only.");
69
+ await button.click();
70
+ }
71
+ async isLoading() {
72
+ return await this.locatorForOptional(".wr-input-group__spinner")() !== null;
73
+ }
74
+ };
75
+ export { WrInputGroupHarness, WrInputHarness };
53
76
 
54
77
  //# sourceMappingURL=ngwr-input-testing.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-input-testing.mjs","names":[],"sources":["../../../projects/lib/input/testing/wr-input-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrInputHarnessFilters } from './types';\n\n/**\n * Test harness for `[wrInput]` — the directive form, on a real `<input>` or\n * `<textarea>`.\n *\n * There is no `<wr-input>` component to wrap: ngwr styles the native control in\n * place, which is why the value, the placeholder and the disabled state are all\n * read straight off the host. {@link setValue} dispatches `input` AND `change`,\n * because a signal-forms control listens to the first and classic `[(ngModel)]`\n * setups to the second — typing into only one of them makes a harness that works\n * in some consumers' specs and not others.\n *\n * @example\n * ```ts\n * const email = await loader.getHarness(WrInputHarness.with({ placeholder: 'Email' }));\n * await email.setValue('ada@example.test');\n * expect(await email.getValue()).toBe('ada@example.test');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrInputHarness extends ComponentHarness {\n static hostSelector = 'input[wrInput], textarea[wrInput]';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrInputHarnessFilters = {}): HarnessPredicate<WrInputHarness> {\n return new HarnessPredicate(WrInputHarness, options)\n .addOption('value', options.value, (harness, value) => HarnessPredicate.stringMatches(harness.getValue(), value))\n .addOption('placeholder', options.placeholder, (harness, placeholder) =>\n HarnessPredicate.stringMatches(harness.getPlaceholder(), placeholder)\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n async getValue(): Promise<string> {\n return (await this.host()).getProperty<string>('value');\n }\n\n /**\n * Type a value in, the way a user would as far as the framework can tell.\n *\n * `input` is the one that carries the value — a signal-forms control listens to\n * it, and so does Angular's `DefaultValueAccessor`, which is what `[(ngModel)]`\n * and a reactive form bind through (its listeners are `input`, `blur` and the\n * two composition events; `change` is NOT among them). `change` is dispatched\n * after it for the consumer's own `(change)` handler: a browser defers that\n * event to the commit — blur, or Enter — which a harness write never reaches, so\n * a spec binding it would otherwise never see it fire.\n */\n async setValue(value: string): Promise<void> {\n const host = await this.host();\n await host.clear();\n await host.sendKeys(value);\n await host.dispatchEvent('change');\n }\n\n /** Clear the field, dispatching the same pair of events as {@link setValue}. */\n async clear(): Promise<void> {\n const host = await this.host();\n await host.clear();\n await host.dispatchEvent('change');\n }\n\n async getPlaceholder(): Promise<string> {\n return (await this.host()).getProperty<string>('placeholder');\n }\n\n async isDisabled(): Promise<boolean> {\n return (await this.host()).getProperty<boolean>('disabled');\n }\n\n async isReadonly(): Promise<boolean> {\n return (await this.host()).getProperty<boolean>('readOnly');\n }\n\n /** `input` or `textarea` — the directive styles both. */\n async getTagName(): Promise<string> {\n return (await (await this.host()).getProperty<string>('tagName')).toLowerCase();\n }\n\n /**\n * Whether the field is marked invalid.\n *\n * `<wr-form-field>` sets `aria-invalid` when it has an error to describe, so\n * this answers what a screen reader is told rather than what the model thinks.\n */\n async isInvalid(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-invalid')) === 'true';\n }\n\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n}\n"],"mappings":";;;;;;;AA+BA,IAAa,iBAAb,MAAa,uBA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KAAI,EAAA,CAAI,MAAK;CAClC;CAEA,MAAM,OAAI;EACR,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,KAAI;CACjC;CAEA,MAAM,YAAS;EACb,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,UAAS;CACtC"}
1
+ {"version":3,"file":"ngwr-input-testing.mjs","names":[],"sources":["../../../projects/lib/input/testing/wr-input-harness.ts","../../../projects/lib/input/testing/wr-input-group-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrInputHarnessFilters } from './types';\n\n/**\n * Test harness for `[wrInput]` — the directive form, on a real `<input>` or\n * `<textarea>`.\n *\n * There is no `<wr-input>` component to wrap: ngwr styles the native control in\n * place, which is why the value, the placeholder and the disabled state are all\n * read straight off the host. {@link setValue} dispatches `input` AND `change`,\n * because a signal-forms control listens to the first and classic `[(ngModel)]`\n * setups to the second — typing into only one of them makes a harness that works\n * in some consumers' specs and not others.\n *\n * @example\n * ```ts\n * const email = await loader.getHarness(WrInputHarness.with({ placeholder: 'Email' }));\n * await email.setValue('ada@example.test');\n * expect(await email.getValue()).toBe('ada@example.test');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrInputHarness extends ComponentHarness {\n static hostSelector = 'input[wrInput], textarea[wrInput]';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrInputHarnessFilters = {}): HarnessPredicate<WrInputHarness> {\n return new HarnessPredicate(WrInputHarness, options)\n .addOption('value', options.value, (harness, value) => HarnessPredicate.stringMatches(harness.getValue(), value))\n .addOption('placeholder', options.placeholder, (harness, placeholder) =>\n HarnessPredicate.stringMatches(harness.getPlaceholder(), placeholder)\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n async getValue(): Promise<string> {\n return (await this.host()).getProperty<string>('value');\n }\n\n /**\n * Type a value in, the way a user would as far as the framework can tell.\n *\n * `input` is the one that carries the value — a signal-forms control listens to\n * it, and so does Angular's `DefaultValueAccessor`, which is what `[(ngModel)]`\n * and a reactive form bind through (its listeners are `input`, `blur` and the\n * two composition events; `change` is NOT among them). `change` is dispatched\n * after it for the consumer's own `(change)` handler: a browser defers that\n * event to the commit — blur, or Enter — which a harness write never reaches, so\n * a spec binding it would otherwise never see it fire.\n */\n async setValue(value: string): Promise<void> {\n const host = await this.host();\n await host.clear();\n await host.sendKeys(value);\n await host.dispatchEvent('change');\n }\n\n /** Clear the field, dispatching the same pair of events as {@link setValue}. */\n async clear(): Promise<void> {\n const host = await this.host();\n await host.clear();\n await host.dispatchEvent('change');\n }\n\n async getPlaceholder(): Promise<string> {\n return (await this.host()).getProperty<string>('placeholder');\n }\n\n async isDisabled(): Promise<boolean> {\n return (await this.host()).getProperty<boolean>('disabled');\n }\n\n async isReadonly(): Promise<boolean> {\n return (await this.host()).getProperty<boolean>('readOnly');\n }\n\n /** `input` or `textarea` — the directive styles both. */\n async getTagName(): Promise<string> {\n return (await (await this.host()).getProperty<string>('tagName')).toLowerCase();\n }\n\n /**\n * Whether the field is marked invalid.\n *\n * `<wr-form-field>` sets `aria-invalid` when it has an error to describe, so\n * this answers what a screen reader is told rather than what the model thinks.\n */\n async isInvalid(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-invalid')) === 'true';\n }\n\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness } from '@angular/cdk/testing';\n\nimport { WrInputHarness } from './wr-input-harness';\n\n/**\n * Harness for `<wr-input-group>`: the clear (×) button and the spinner it draws\n * around the field it wraps. The field itself is a {@link WrInputHarness}, from\n * {@link getInput}.\n *\n * There is no `getPrefix()` / `getSuffix()`: an affix is the app's own markup,\n * so a spec reads it straight off its own template.\n *\n * @example\n * ```ts\n * const search = await loader.getHarness(WrInputGroupHarness);\n *\n * await (await search.getInput()).setValue('ada');\n * expect(await search.isLoading()).toBe(true);\n * await search.clear();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrInputGroupHarness extends ComponentHarness {\n static hostSelector = 'wr-input-group';\n\n /** The first field the group wraps, the one `clearable` and `loading` act on. */\n async getInput(): Promise<WrInputHarness> {\n return this.locatorFor(WrInputHarness)();\n }\n\n /** Whether the clear (×) button is on show: `clearable`, with text, neither disabled nor read-only. */\n async hasClearButton(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-input-group__clear')()) !== null;\n }\n\n /** Click the clear (×) button. Throws when it is not on show. */\n async clear(): Promise<void> {\n const button = await this.locatorForOptional('.wr-input-group__clear')();\n if (!button) {\n throw new Error(\n 'WrInputGroupHarness.clear(): no clear button. It shows on a `clearable` group ' +\n 'whose field has text and is neither disabled nor read-only.'\n );\n }\n await button.click();\n }\n\n /** Whether the group is drawing its `loading` spinner. */\n async isLoading(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-input-group__spinner')()) !== null;\n }\n}\n"],"mappings":";;;;;;;AA+BA,IAAa,iBAAb,MAAa,uBAAuB,iBAAgB;CAClD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAiC,CAAA,GAAE;EAC7C,OAAO,IAAI,iBAAiB,gBAAgB,OAAO,CAAC,CACjD,UAAU,SAAS,QAAQ,QAAQ,SAAS,UAAU,iBAAiB,cAAc,QAAQ,SAAQ,GAAI,KAAK,CAAC,CAAC,CAChH,UAAU,eAAe,QAAQ,cAAc,SAAS,gBACvD,iBAAiB,cAAc,QAAQ,eAAc,GAAI,WAAW,CAAC,CACtE,CACA,UAAU,YAAY,QAAQ,U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