ngwr 7.3.0 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (450) hide show
  1. package/README.md +79 -31
  2. package/action-sheet/styles/_index.scss +93 -0
  3. package/alert/styles/_index.scss +45 -18
  4. package/anchor/styles/_index.scss +3 -3
  5. package/avatar/styles/_index.scss +2 -2
  6. package/back-top/styles/_index.scss +1 -1
  7. package/badge/styles/_index.scss +11 -7
  8. package/badge/styles/_tag.scss +4 -4
  9. package/bar-chart/styles/_index.scss +5 -6
  10. package/border-glow/styles/_index.scss +3 -3
  11. package/breadcrumbs/styles/_index.scss +7 -5
  12. package/burger/styles/_index.scss +3 -3
  13. package/button/styles/_index.scss +34 -24
  14. package/calendar/styles/_index.scss +15 -13
  15. package/calendar-heatmap/styles/_index.scss +5 -3
  16. package/card/styles/_index.scss +5 -5
  17. package/carousel/styles/_index.scss +6 -6
  18. package/cascader/styles/_index.scss +69 -29
  19. package/checkbox/styles/_index.scss +41 -9
  20. package/collapse/styles/_index.scss +7 -7
  21. package/color-picker/styles/_index.scss +26 -21
  22. package/command-palette/styles/_index.scss +22 -19
  23. package/compare/styles/_index.scss +6 -6
  24. package/context-menu/styles/_index.scss +17 -7
  25. package/counter/styles/_index.scss +12 -1
  26. package/date-picker/styles/_index.scss +13 -14
  27. package/density/styles/_index.scss +3 -3
  28. package/descriptions/styles/_index.scss +9 -9
  29. package/dialog/styles/_index.scss +10 -9
  30. package/divider/styles/_index.scss +3 -3
  31. package/donut-chart/styles/_index.scss +3 -3
  32. package/drag-drop/styles/_index.scss +11 -6
  33. package/drawer/styles/_index.scss +26 -17
  34. package/dropdown/styles/_index.scss +7 -7
  35. package/empty/styles/_index.scss +4 -4
  36. package/fesm2022/ngwr-action-sheet.mjs +81 -0
  37. package/fesm2022/ngwr-action-sheet.mjs.map +1 -0
  38. package/fesm2022/ngwr-affix.mjs +3 -3
  39. package/fesm2022/ngwr-alert.mjs +23 -11
  40. package/fesm2022/ngwr-alert.mjs.map +1 -1
  41. package/fesm2022/ngwr-anchor.mjs +4 -4
  42. package/fesm2022/ngwr-anchor.mjs.map +1 -1
  43. package/fesm2022/ngwr-aurora.mjs +5 -4
  44. package/fesm2022/ngwr-aurora.mjs.map +1 -1
  45. package/fesm2022/ngwr-avatar.mjs +4 -4
  46. package/fesm2022/ngwr-avatar.mjs.map +1 -1
  47. package/fesm2022/ngwr-back-top.mjs +4 -4
  48. package/fesm2022/ngwr-back-top.mjs.map +1 -1
  49. package/fesm2022/ngwr-badge.mjs +8 -8
  50. package/fesm2022/ngwr-badge.mjs.map +1 -1
  51. package/fesm2022/ngwr-bar-chart.mjs +4 -4
  52. package/fesm2022/ngwr-bar-chart.mjs.map +1 -1
  53. package/fesm2022/ngwr-blur-text.mjs +3 -3
  54. package/fesm2022/ngwr-border-glow.mjs +4 -4
  55. package/fesm2022/ngwr-border-glow.mjs.map +1 -1
  56. package/fesm2022/ngwr-breadcrumbs.mjs +8 -8
  57. package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
  58. package/fesm2022/ngwr-burger.mjs +4 -4
  59. package/fesm2022/ngwr-burger.mjs.map +1 -1
  60. package/fesm2022/ngwr-button.mjs +8 -8
  61. package/fesm2022/ngwr-button.mjs.map +1 -1
  62. package/fesm2022/ngwr-calendar-heatmap.mjs +4 -4
  63. package/fesm2022/ngwr-calendar-heatmap.mjs.map +1 -1
  64. package/fesm2022/ngwr-calendar.mjs +5 -5
  65. package/fesm2022/ngwr-calendar.mjs.map +1 -1
  66. package/fesm2022/ngwr-card.mjs +11 -11
  67. package/fesm2022/ngwr-card.mjs.map +1 -1
  68. package/fesm2022/ngwr-carousel.mjs +7 -7
  69. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  70. package/fesm2022/ngwr-cascader.mjs +58 -89
  71. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  72. package/fesm2022/ngwr-checkbox.mjs +80 -129
  73. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  74. package/fesm2022/ngwr-circular-text.mjs +5 -4
  75. package/fesm2022/ngwr-circular-text.mjs.map +1 -1
  76. package/fesm2022/ngwr-click-spark.mjs +27 -7
  77. package/fesm2022/ngwr-click-spark.mjs.map +1 -1
  78. package/fesm2022/ngwr-clipboard.mjs +28 -7
  79. package/fesm2022/ngwr-clipboard.mjs.map +1 -1
  80. package/fesm2022/ngwr-collapse.mjs +12 -12
  81. package/fesm2022/ngwr-collapse.mjs.map +1 -1
  82. package/fesm2022/ngwr-color-picker.mjs +58 -66
  83. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  84. package/fesm2022/ngwr-command-palette.mjs +4 -4
  85. package/fesm2022/ngwr-command-palette.mjs.map +1 -1
  86. package/fesm2022/ngwr-compare.mjs +4 -4
  87. package/fesm2022/ngwr-compare.mjs.map +1 -1
  88. package/fesm2022/ngwr-confetti.mjs +3 -3
  89. package/fesm2022/ngwr-context-menu.mjs +98 -75
  90. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  91. package/fesm2022/ngwr-cookie.mjs +19 -6
  92. package/fesm2022/ngwr-cookie.mjs.map +1 -1
  93. package/fesm2022/ngwr-counter.mjs +32 -14
  94. package/fesm2022/ngwr-counter.mjs.map +1 -1
  95. package/fesm2022/ngwr-date-adapter-fns.mjs +3 -3
  96. package/fesm2022/ngwr-date-adapter-luxon.mjs +3 -3
  97. package/fesm2022/ngwr-date-adapter.mjs +10 -5
  98. package/fesm2022/ngwr-date-adapter.mjs.map +1 -1
  99. package/fesm2022/ngwr-date-picker.mjs +142 -123
  100. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  101. package/fesm2022/ngwr-decrypt-text.mjs +3 -3
  102. package/fesm2022/ngwr-density.mjs +15 -15
  103. package/fesm2022/ngwr-density.mjs.map +1 -1
  104. package/fesm2022/ngwr-descriptions.mjs +7 -7
  105. package/fesm2022/ngwr-descriptions.mjs.map +1 -1
  106. package/fesm2022/ngwr-dialog.mjs +16 -16
  107. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  108. package/fesm2022/ngwr-directives.mjs +22 -88
  109. package/fesm2022/ngwr-directives.mjs.map +1 -1
  110. package/fesm2022/ngwr-divider.mjs +4 -4
  111. package/fesm2022/ngwr-divider.mjs.map +1 -1
  112. package/fesm2022/ngwr-donut-chart.mjs +11 -5
  113. package/fesm2022/ngwr-donut-chart.mjs.map +1 -1
  114. package/fesm2022/ngwr-drag-drop.mjs +10 -9
  115. package/fesm2022/ngwr-drag-drop.mjs.map +1 -1
  116. package/fesm2022/ngwr-drawer.mjs +19 -18
  117. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  118. package/fesm2022/ngwr-dropdown.mjs +13 -12
  119. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  120. package/fesm2022/ngwr-empty.mjs +4 -4
  121. package/fesm2022/ngwr-empty.mjs.map +1 -1
  122. package/fesm2022/ngwr-falling-text.mjs +5 -4
  123. package/fesm2022/ngwr-falling-text.mjs.map +1 -1
  124. package/fesm2022/ngwr-file-upload.mjs +58 -60
  125. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  126. package/fesm2022/ngwr-form.mjs +11 -11
  127. package/fesm2022/ngwr-form.mjs.map +1 -1
  128. package/fesm2022/ngwr-fuzzy-text.mjs +10 -8
  129. package/fesm2022/ngwr-fuzzy-text.mjs.map +1 -1
  130. package/fesm2022/ngwr-gauge.mjs +4 -4
  131. package/fesm2022/ngwr-gauge.mjs.map +1 -1
  132. package/fesm2022/ngwr-glitch-text.mjs +15 -7
  133. package/fesm2022/ngwr-glitch-text.mjs.map +1 -1
  134. package/fesm2022/ngwr-gradient-text.mjs +4 -4
  135. package/fesm2022/ngwr-gradient-text.mjs.map +1 -1
  136. package/fesm2022/ngwr-hotkey.mjs +7 -7
  137. package/fesm2022/ngwr-hotkey.mjs.map +1 -1
  138. package/fesm2022/ngwr-i18n.mjs +10 -10
  139. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  140. package/fesm2022/ngwr-icon-adapters-lucide.mjs +6 -7
  141. package/fesm2022/ngwr-icon-adapters-lucide.mjs.map +1 -1
  142. package/fesm2022/ngwr-icon.mjs +4 -4
  143. package/fesm2022/ngwr-icon.mjs.map +1 -1
  144. package/fesm2022/ngwr-image-cropper.mjs +6 -5
  145. package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
  146. package/fesm2022/ngwr-input-number.mjs +56 -73
  147. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  148. package/fesm2022/ngwr-input-otp.mjs +52 -52
  149. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  150. package/fesm2022/ngwr-input.mjs +27 -18
  151. package/fesm2022/ngwr-input.mjs.map +1 -1
  152. package/fesm2022/ngwr-keyboard.mjs +4 -4
  153. package/fesm2022/ngwr-keyboard.mjs.map +1 -1
  154. package/fesm2022/ngwr-knob.mjs +47 -58
  155. package/fesm2022/ngwr-knob.mjs.map +1 -1
  156. package/fesm2022/ngwr-layout.mjs +16 -16
  157. package/fesm2022/ngwr-layout.mjs.map +1 -1
  158. package/fesm2022/ngwr-lightbox.mjs +20 -7
  159. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  160. package/fesm2022/ngwr-line-chart.mjs +4 -4
  161. package/fesm2022/ngwr-line-chart.mjs.map +1 -1
  162. package/fesm2022/ngwr-list.mjs +8 -8
  163. package/fesm2022/ngwr-list.mjs.map +1 -1
  164. package/fesm2022/ngwr-loading-bar.mjs +7 -7
  165. package/fesm2022/ngwr-loading-bar.mjs.map +1 -1
  166. package/fesm2022/ngwr-marquee.mjs +6 -5
  167. package/fesm2022/ngwr-marquee.mjs.map +1 -1
  168. package/fesm2022/ngwr-media.mjs +4 -4
  169. package/fesm2022/ngwr-media.mjs.map +1 -1
  170. package/fesm2022/ngwr-mention.mjs +15 -9
  171. package/fesm2022/ngwr-mention.mjs.map +1 -1
  172. package/fesm2022/ngwr-meta.mjs +7 -7
  173. package/fesm2022/ngwr-meta.mjs.map +1 -1
  174. package/fesm2022/ngwr-meter-group.mjs +4 -4
  175. package/fesm2022/ngwr-meter-group.mjs.map +1 -1
  176. package/fesm2022/ngwr-overlay.mjs +9 -4
  177. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  178. package/fesm2022/ngwr-page-header.mjs +4 -4
  179. package/fesm2022/ngwr-page-header.mjs.map +1 -1
  180. package/fesm2022/ngwr-pagination.mjs +6 -16
  181. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  182. package/fesm2022/ngwr-pipes.mjs +21 -21
  183. package/fesm2022/ngwr-platform.mjs +169 -5
  184. package/fesm2022/ngwr-platform.mjs.map +1 -1
  185. package/fesm2022/ngwr-popconfirm.mjs +7 -7
  186. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  187. package/fesm2022/ngwr-popover.mjs +7 -7
  188. package/fesm2022/ngwr-popover.mjs.map +1 -1
  189. package/fesm2022/ngwr-progress.mjs +4 -4
  190. package/fesm2022/ngwr-progress.mjs.map +1 -1
  191. package/fesm2022/ngwr-pull-to-refresh.mjs +172 -0
  192. package/fesm2022/ngwr-pull-to-refresh.mjs.map +1 -0
  193. package/fesm2022/ngwr-qr.mjs +5 -5
  194. package/fesm2022/ngwr-qr.mjs.map +1 -1
  195. package/fesm2022/ngwr-radio.mjs +49 -72
  196. package/fesm2022/ngwr-radio.mjs.map +1 -1
  197. package/fesm2022/ngwr-rating.mjs +41 -65
  198. package/fesm2022/ngwr-rating.mjs.map +1 -1
  199. package/fesm2022/ngwr-result.mjs +13 -13
  200. package/fesm2022/ngwr-result.mjs.map +1 -1
  201. package/fesm2022/ngwr-rotating-text.mjs +15 -4
  202. package/fesm2022/ngwr-rotating-text.mjs.map +1 -1
  203. package/fesm2022/ngwr-scroll.mjs +4 -4
  204. package/fesm2022/ngwr-scroll.mjs.map +1 -1
  205. package/fesm2022/ngwr-segmented.mjs +10 -22
  206. package/fesm2022/ngwr-segmented.mjs.map +1 -1
  207. package/fesm2022/ngwr-select.mjs +303 -86
  208. package/fesm2022/ngwr-select.mjs.map +1 -1
  209. package/fesm2022/ngwr-shiny-text.mjs +7 -7
  210. package/fesm2022/ngwr-shiny-text.mjs.map +1 -1
  211. package/fesm2022/ngwr-sidebar.mjs +4 -4
  212. package/fesm2022/ngwr-sidebar.mjs.map +1 -1
  213. package/fesm2022/ngwr-skeleton.mjs +4 -4
  214. package/fesm2022/ngwr-skeleton.mjs.map +1 -1
  215. package/fesm2022/ngwr-slider.mjs +79 -73
  216. package/fesm2022/ngwr-slider.mjs.map +1 -1
  217. package/fesm2022/ngwr-sparkline.mjs +4 -4
  218. package/fesm2022/ngwr-sparkline.mjs.map +1 -1
  219. package/fesm2022/ngwr-speed-dial.mjs +13 -5
  220. package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
  221. package/fesm2022/ngwr-spinner.mjs +4 -4
  222. package/fesm2022/ngwr-spinner.mjs.map +1 -1
  223. package/fesm2022/ngwr-splash-cursor.mjs +4 -4
  224. package/fesm2022/ngwr-splash-cursor.mjs.map +1 -1
  225. package/fesm2022/ngwr-split-text.mjs +3 -3
  226. package/fesm2022/ngwr-splitter.mjs +4 -4
  227. package/fesm2022/ngwr-splitter.mjs.map +1 -1
  228. package/fesm2022/ngwr-spotlight-card.mjs +8 -8
  229. package/fesm2022/ngwr-spotlight-card.mjs.map +1 -1
  230. package/fesm2022/ngwr-squircle.mjs +7 -7
  231. package/fesm2022/ngwr-squircle.mjs.map +1 -1
  232. package/fesm2022/ngwr-star-border.mjs +4 -4
  233. package/fesm2022/ngwr-star-border.mjs.map +1 -1
  234. package/fesm2022/ngwr-statistic.mjs +138 -14
  235. package/fesm2022/ngwr-statistic.mjs.map +1 -1
  236. package/fesm2022/ngwr-stepper.mjs +8 -8
  237. package/fesm2022/ngwr-stepper.mjs.map +1 -1
  238. package/fesm2022/ngwr-storage.mjs +4 -4
  239. package/fesm2022/ngwr-storage.mjs.map +1 -1
  240. package/fesm2022/ngwr-switch.mjs +22 -58
  241. package/fesm2022/ngwr-switch.mjs.map +1 -1
  242. package/fesm2022/ngwr-table.mjs +824 -20
  243. package/fesm2022/ngwr-table.mjs.map +1 -1
  244. package/fesm2022/ngwr-tabs.mjs +11 -8
  245. package/fesm2022/ngwr-tabs.mjs.map +1 -1
  246. package/fesm2022/ngwr-textarea.mjs +94 -67
  247. package/fesm2022/ngwr-textarea.mjs.map +1 -1
  248. package/fesm2022/ngwr-theme.mjs +20 -5
  249. package/fesm2022/ngwr-theme.mjs.map +1 -1
  250. package/fesm2022/ngwr-tilt-card.mjs +27 -11
  251. package/fesm2022/ngwr-tilt-card.mjs.map +1 -1
  252. package/fesm2022/ngwr-timeline.mjs +7 -7
  253. package/fesm2022/ngwr-timeline.mjs.map +1 -1
  254. package/fesm2022/ngwr-toast.mjs +47 -25
  255. package/fesm2022/ngwr-toast.mjs.map +1 -1
  256. package/fesm2022/ngwr-toolbar.mjs +4 -4
  257. package/fesm2022/ngwr-toolbar.mjs.map +1 -1
  258. package/fesm2022/ngwr-tree.mjs +280 -84
  259. package/fesm2022/ngwr-tree.mjs.map +1 -1
  260. package/fesm2022/ngwr-typewriter.mjs +10 -5
  261. package/fesm2022/ngwr-typewriter.mjs.map +1 -1
  262. package/fesm2022/ngwr-typography.mjs +4 -4
  263. package/fesm2022/ngwr-typography.mjs.map +1 -1
  264. package/fesm2022/ngwr-validators.mjs +42 -4
  265. package/fesm2022/ngwr-validators.mjs.map +1 -1
  266. package/fesm2022/ngwr-version.mjs +1 -1
  267. package/fesm2022/ngwr-version.mjs.map +1 -1
  268. package/fesm2022/ngwr-virtual-scroll.mjs +9 -7
  269. package/fesm2022/ngwr-virtual-scroll.mjs.map +1 -1
  270. package/fesm2022/ngwr-waves.mjs +6 -5
  271. package/fesm2022/ngwr-waves.mjs.map +1 -1
  272. package/fesm2022/ngwr-window.mjs +16 -15
  273. package/fesm2022/ngwr-window.mjs.map +1 -1
  274. package/file-upload/styles/_index.scss +14 -14
  275. package/form/styles/_index.scss +9 -9
  276. package/gauge/styles/_index.scss +2 -2
  277. package/glitch-text/styles/_index.scss +4 -7
  278. package/gradient-text/styles/_index.scss +1 -1
  279. package/image-cropper/styles/_index.scss +8 -7
  280. package/input/styles/_index.scss +35 -16
  281. package/input-number/styles/_index.scss +1 -1
  282. package/input-otp/styles/_index.scss +28 -10
  283. package/keyboard/styles/_index.scss +11 -9
  284. package/knob/styles/_index.scss +7 -3
  285. package/layout/styles/_index.scss +12 -12
  286. package/lightbox/styles/_index.scss +31 -10
  287. package/line-chart/styles/_index.scss +5 -5
  288. package/list/styles/_index.scss +6 -6
  289. package/llms-full.txt +45 -24
  290. package/llms.txt +48 -32
  291. package/marquee/styles/_index.scss +1 -1
  292. package/mention/styles/_index.scss +6 -6
  293. package/meter-group/styles/_index.scss +4 -4
  294. package/overlay/styles/_index.scss +9 -1
  295. package/package.json +21 -14
  296. package/page-header/styles/_index.scss +4 -4
  297. package/pagination/styles/_index.scss +6 -29
  298. package/popconfirm/styles/_index.scss +4 -4
  299. package/popover/styles/_index.scss +7 -7
  300. package/progress/styles/_index.scss +1 -1
  301. package/pull-to-refresh/styles/_index.scss +38 -0
  302. package/radio/styles/_index.scss +24 -9
  303. package/rating/styles/_index.scss +13 -2
  304. package/result/styles/_index.scss +3 -3
  305. package/schematics/migrations/v8/index.js +122 -0
  306. package/schematics/migrations/v9/index.js +71 -0
  307. package/schematics/migrations.json +10 -0
  308. package/schematics/ng-add/index.js +3 -3
  309. package/schematics/ng-add/schema.json +7 -7
  310. package/schematics/provider/schema.json +1 -1
  311. package/schematics/use/symbol-map.json +24 -2
  312. package/segmented/styles/_index.scss +35 -12
  313. package/select/styles/_index.scss +126 -43
  314. package/shiny-text/styles/_index.scss +4 -4
  315. package/sidebar/styles/_index.scss +15 -15
  316. package/slider/styles/_index.scss +7 -8
  317. package/speed-dial/styles/_index.scss +23 -6
  318. package/splash-cursor/styles/_index.scss +1 -0
  319. package/splitter/styles/_index.scss +11 -8
  320. package/spotlight-card/styles/_index.scss +11 -7
  321. package/star-border/styles/_index.scss +3 -3
  322. package/statistic/styles/_index.scss +51 -4
  323. package/stepper/styles/_index.scss +10 -10
  324. package/styles/_animations.scss +0 -23
  325. package/styles/_typography.scss +4 -1
  326. package/styles.scss +2 -1
  327. package/switch/styles/_index.scss +29 -10
  328. package/table/styles/_index.scss +456 -26
  329. package/tabs/styles/_index.scss +25 -6
  330. package/textarea/styles/_index.scss +65 -10
  331. package/theme/styles/_colors.scss +82 -1
  332. package/theme/styles/_dark.scss +22 -8
  333. package/theme/styles/_focus.scss +5 -0
  334. package/theme/styles/_variables.scss +24 -0
  335. package/tilt-card/styles/_index.scss +4 -4
  336. package/timeline/styles/_index.scss +18 -8
  337. package/toast/styles/_index.scss +24 -16
  338. package/toolbar/styles/_index.scss +5 -5
  339. package/tree/styles/_index.scss +63 -32
  340. package/types/ngwr-action-sheet.d.ts +75 -0
  341. package/types/ngwr-alert.d.ts +17 -7
  342. package/types/ngwr-anchor.d.ts +1 -1
  343. package/types/ngwr-avatar.d.ts +1 -1
  344. package/types/ngwr-back-top.d.ts +1 -1
  345. package/types/ngwr-badge.d.ts +4 -4
  346. package/types/ngwr-bar-chart.d.ts +1 -1
  347. package/types/ngwr-breadcrumbs.d.ts +1 -1
  348. package/types/ngwr-burger.d.ts +1 -1
  349. package/types/ngwr-button.d.ts +3 -3
  350. package/types/ngwr-calendar-heatmap.d.ts +1 -1
  351. package/types/ngwr-calendar.d.ts +1 -1
  352. package/types/ngwr-card.d.ts +1 -1
  353. package/types/ngwr-carousel.d.ts +1 -1
  354. package/types/ngwr-cascader.d.ts +31 -17
  355. package/types/ngwr-checkbox.d.ts +67 -44
  356. package/types/ngwr-click-spark.d.ts +13 -1
  357. package/types/ngwr-clipboard.d.ts +13 -2
  358. package/types/ngwr-collapse.d.ts +3 -3
  359. package/types/ngwr-color-picker.d.ts +24 -19
  360. package/types/ngwr-command-palette.d.ts +1 -1
  361. package/types/ngwr-compare.d.ts +1 -1
  362. package/types/ngwr-context-menu.d.ts +42 -23
  363. package/types/ngwr-cookie.d.ts +7 -1
  364. package/types/ngwr-counter.d.ts +9 -2
  365. package/types/ngwr-date-picker.d.ts +39 -23
  366. package/types/ngwr-density.d.ts +8 -8
  367. package/types/ngwr-descriptions.d.ts +1 -1
  368. package/types/ngwr-dialog.d.ts +1 -1
  369. package/types/ngwr-directives.d.ts +18 -49
  370. package/types/ngwr-divider.d.ts +2 -2
  371. package/types/ngwr-donut-chart.d.ts +1 -1
  372. package/types/ngwr-drag-drop.d.ts +1 -1
  373. package/types/ngwr-drawer.d.ts +1 -1
  374. package/types/ngwr-dropdown.d.ts +1 -1
  375. package/types/ngwr-empty.d.ts +1 -1
  376. package/types/ngwr-file-upload.d.ts +28 -17
  377. package/types/ngwr-form.d.ts +2 -2
  378. package/types/ngwr-fuzzy-text.d.ts +1 -1
  379. package/types/ngwr-gauge.d.ts +1 -1
  380. package/types/ngwr-glitch-text.d.ts +9 -3
  381. package/types/ngwr-hotkey.d.ts +1 -1
  382. package/types/ngwr-i18n.d.ts +1 -1
  383. package/types/ngwr-icon-adapters-lucide.d.ts +5 -3
  384. package/types/ngwr-icon.d.ts +1 -1
  385. package/types/ngwr-image-cropper.d.ts +1 -1
  386. package/types/ngwr-input-number.d.ts +25 -19
  387. package/types/ngwr-input-otp.d.ts +28 -18
  388. package/types/ngwr-input.d.ts +29 -15
  389. package/types/ngwr-keyboard.d.ts +1 -1
  390. package/types/ngwr-knob.d.ts +24 -19
  391. package/types/ngwr-layout.d.ts +1 -1
  392. package/types/ngwr-lightbox.d.ts +10 -2
  393. package/types/ngwr-line-chart.d.ts +1 -1
  394. package/types/ngwr-list.d.ts +1 -1
  395. package/types/ngwr-loading-bar.d.ts +1 -1
  396. package/types/ngwr-marquee.d.ts +1 -1
  397. package/types/ngwr-media.d.ts +1 -1
  398. package/types/ngwr-mention.d.ts +1 -1
  399. package/types/ngwr-meta.d.ts +1 -1
  400. package/types/ngwr-meter-group.d.ts +1 -1
  401. package/types/ngwr-page-header.d.ts +1 -1
  402. package/types/ngwr-pagination.d.ts +4 -10
  403. package/types/ngwr-platform.d.ts +93 -2
  404. package/types/ngwr-popconfirm.d.ts +3 -3
  405. package/types/ngwr-progress.d.ts +2 -2
  406. package/types/ngwr-pull-to-refresh.d.ts +69 -0
  407. package/types/ngwr-qr.d.ts +1 -1
  408. package/types/ngwr-radio.d.ts +39 -25
  409. package/types/ngwr-rating.d.ts +32 -20
  410. package/types/ngwr-result.d.ts +1 -1
  411. package/types/ngwr-rotating-text.d.ts +1 -0
  412. package/types/ngwr-scroll.d.ts +1 -1
  413. package/types/ngwr-segmented.d.ts +6 -3
  414. package/types/ngwr-select.d.ts +98 -27
  415. package/types/ngwr-sidebar.d.ts +1 -1
  416. package/types/ngwr-skeleton.d.ts +2 -2
  417. package/types/ngwr-slider.d.ts +35 -21
  418. package/types/ngwr-sparkline.d.ts +1 -1
  419. package/types/ngwr-speed-dial.d.ts +8 -2
  420. package/types/ngwr-spinner.d.ts +1 -1
  421. package/types/ngwr-splitter.d.ts +1 -1
  422. package/types/ngwr-spotlight-card.d.ts +1 -1
  423. package/types/ngwr-squircle.d.ts +1 -1
  424. package/types/ngwr-statistic.d.ts +75 -6
  425. package/types/ngwr-stepper.d.ts +2 -2
  426. package/types/ngwr-storage.d.ts +1 -1
  427. package/types/ngwr-switch.d.ts +24 -16
  428. package/types/ngwr-table.d.ts +417 -6
  429. package/types/ngwr-tabs.d.ts +1 -1
  430. package/types/ngwr-textarea.d.ts +45 -20
  431. package/types/ngwr-theme.d.ts +7 -2
  432. package/types/ngwr-tilt-card.d.ts +3 -0
  433. package/types/ngwr-timeline.d.ts +1 -1
  434. package/types/ngwr-toast.d.ts +8 -2
  435. package/types/ngwr-toolbar.d.ts +1 -1
  436. package/types/ngwr-tree.d.ts +100 -19
  437. package/types/ngwr-typography.d.ts +1 -1
  438. package/types/ngwr-validators.d.ts +4 -2
  439. package/types/ngwr-version.d.ts +1 -1
  440. package/types/ngwr-virtual-scroll.d.ts +1 -1
  441. package/types/ngwr-window.d.ts +1 -1
  442. package/typography/styles/_index.scss +11 -11
  443. package/virtual-scroll/styles/_index.scss +1 -1
  444. package/waves/styles/_index.scss +1 -1
  445. package/window/styles/_index.scss +26 -26
  446. package/fesm2022/ngwr-scramble-text.mjs +0 -165
  447. package/fesm2022/ngwr-scramble-text.mjs.map +0 -1
  448. package/scramble-text/scramble-text.scss +0 -1
  449. package/scramble-text/styles/_index.scss +0 -8
  450. package/types/ngwr-scramble-text.d.ts +0 -49
@@ -1,9 +1,8 @@
1
1
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
2
2
  import * as i0 from '@angular/core';
3
- import { InjectionToken, input, inject, signal, computed, forwardRef, ViewEncapsulation, Component } from '@angular/core';
4
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
+ import { InjectionToken, input, model, output, inject, computed, ViewEncapsulation, Component, forwardRef } from '@angular/core';
5
4
  import { WrIcon } from 'ngwr/icon';
6
- import { randomId, noop } from 'ngwr/utils';
5
+ import { randomId } from 'ngwr/utils';
7
6
 
8
7
  /**
9
8
  * @license
@@ -25,29 +24,6 @@ const WR_CHECKBOX_GROUP = new InjectionToken('WR_CHECKBOX_GROUP');
25
24
  * Use of this source code is governed by an MIT-style license that can be
26
25
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
27
26
  */
28
- /**
29
- * Two-state checkbox.
30
- *
31
- * **Standalone mode** — boolean value, works as a `ControlValueAccessor`:
32
- *
33
- * @example
34
- * ```html
35
- * <wr-checkbox [(ngModel)]="agree">I agree</wr-checkbox>
36
- * ```
37
- *
38
- * **Inside `<wr-checkbox-group>`** — the checkbox's `value` is added to
39
- * or removed from the group's array. The standalone CVA is ignored.
40
- *
41
- * @example
42
- * ```html
43
- * <wr-checkbox-group [(ngModel)]="features">
44
- * <wr-checkbox value="autosave">Autosave</wr-checkbox>
45
- * <wr-checkbox value="notifications">Notifications</wr-checkbox>
46
- * </wr-checkbox-group>
47
- * ```
48
- *
49
- * @see https://ngwr.dev/components/checkbox
50
- */
51
27
  class WrCheckbox {
52
28
  /**
53
29
  * Stable id used to associate the native input with its label.
@@ -57,99 +33,90 @@ class WrCheckbox {
57
33
  id = input(randomId('wr-checkbox'), /* @ts-ignore */
58
34
  ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
59
35
  /**
60
- * Per-checkbox value used only when inside a `<wr-checkbox-group>`.
61
- * Ignored in standalone mode.
36
+ * This checkbox's identity when inside a `<wr-checkbox-group>` — the value
37
+ * added to / removed from the group's array. Ignored in standalone mode.
38
+ * (Named `checkboxValue`, not `value`, because `FormCheckboxControl` reserves
39
+ * `value`.)
62
40
  */
63
- value = input(null, /* @ts-ignore */
64
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
41
+ checkboxValue = input(null, /* @ts-ignore */
42
+ ...(ngDevMode ? [{ debugName: "checkboxValue" }] : /* istanbul ignore next */ []));
43
+ /**
44
+ * Checked state — the form value. Bound by `[formField]`, two-way via
45
+ * `[(checked)]`, or `[(ngModel)]`. Ignored inside a `<wr-checkbox-group>`,
46
+ * where the group's array is the source of truth.
47
+ */
48
+ checked = model(false, /* @ts-ignore */
49
+ ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
50
+ /** Emitted on blur so a bound field can mark itself touched. */
51
+ touch = output();
65
52
  /**
66
- * Disable the checkbox. Also set automatically by Angular forms.
53
+ * Disable the checkbox. Bound automatically from the field's disabled state
54
+ * when used with `[formField]`.
67
55
  *
68
56
  * @default false
69
57
  */
70
58
  disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
59
+ /** Control size — shares the `--wr-control-*` contract. @default 'md' */
60
+ size = input('md', /* @ts-ignore */
61
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
71
62
  /**
72
63
  * Optional icon name rendered inside the box when checked, in place of the
73
64
  * default checkmark. Use any registered NGWR icon.
74
65
  */
75
66
  icon = input(null, /* @ts-ignore */
76
67
  ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
68
+ /**
69
+ * Show the indeterminate ("mixed") state — a dash instead of a check. Visual
70
+ * only and controlled: set it yourself for a parent "select all" whose
71
+ * children are partly checked, and clear it on the next toggle. Takes visual
72
+ * precedence over `checked`; the native input reports `aria-checked="mixed"`.
73
+ *
74
+ * @default false
75
+ */
76
+ indeterminate = input(false, { ...(ngDevMode ? { debugName: "indeterminate" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
77
77
  group = inject(WR_CHECKBOX_GROUP, { optional: true });
78
- // Standalone state. When inside a group, these are not used as the source of truth.
79
- standaloneChecked = signal(false, /* @ts-ignore */
80
- ...(ngDevMode ? [{ debugName: "standaloneChecked" }] : /* istanbul ignore next */ []));
81
- standaloneDisabledFromCva = signal(false, /* @ts-ignore */
82
- ...(ngDevMode ? [{ debugName: "standaloneDisabledFromCva" }] : /* istanbul ignore next */ []));
83
- /** Derived "is checked". Reads from group when grouped, else local state. */
84
- checked = computed(() => {
85
- return this.group ? this.group.isSelected(this.value()) : this.standaloneChecked();
86
- }, /* @ts-ignore */
87
- ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
88
- /** Effective disabled — input wins, then group, then CVA. */
78
+ /** Rendered "is checked" — reads the group when grouped, else the `checked` model. */
79
+ isChecked = computed(() => this.group ? this.group.isSelected(this.checkboxValue()) : this.checked(), /* @ts-ignore */
80
+ ...(ngDevMode ? [{ debugName: "isChecked" }] : /* istanbul ignore next */ []));
81
+ /** Effective disabled — the `disabled` input wins, then the group. */
89
82
  effectiveDisabled = computed(() => {
90
83
  if (this.disabled())
91
84
  return true;
92
- return this.group ? this.group.isDisabled() : this.standaloneDisabledFromCva();
85
+ return this.group ? this.group.isDisabled() : false;
93
86
  }, /* @ts-ignore */
94
87
  ...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
95
88
  classes = computed(() => {
96
89
  const parts = ['wr-checkbox'];
97
- if (this.checked())
90
+ const size = this.size();
91
+ if (size !== 'md')
92
+ parts.push(`wr-checkbox--${size}`);
93
+ if (this.indeterminate())
94
+ parts.push('wr-checkbox--indeterminate');
95
+ else if (this.isChecked())
98
96
  parts.push('wr-checkbox--checked');
99
97
  if (this.effectiveDisabled())
100
98
  parts.push('wr-checkbox--disabled');
101
99
  return parts.join(' ');
102
100
  }, /* @ts-ignore */
103
101
  ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
104
- onChange = noop;
105
- onTouched = noop;
106
- // ControlValueAccessor (standalone mode)
107
- writeValue(value) {
108
- this.standaloneChecked.set(!!value);
109
- }
110
- registerOnChange(fn) {
111
- this.onChange = fn;
112
- }
113
- registerOnTouched(fn) {
114
- this.onTouched = fn;
115
- }
116
- setDisabledState(isDisabled) {
117
- this.standaloneDisabledFromCva.set(coerceBooleanProperty(isDisabled));
118
- }
119
102
  // Template handlers
120
103
  onInputChange(event) {
121
- const checked = event.target.checked;
122
104
  if (this.group) {
123
- this.group.toggle(this.value());
105
+ this.group.toggle(this.checkboxValue());
124
106
  return;
125
107
  }
126
- this.standaloneChecked.set(checked);
127
- this.onChange(checked);
108
+ this.checked.set(event.target.checked);
128
109
  }
129
110
  onInputBlur() {
130
- this.onTouched();
111
+ this.touch.emit();
131
112
  }
132
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
133
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: WrCheckbox, isStandalone: true, selector: "wr-checkbox", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, providers: [
134
- {
135
- provide: NG_VALUE_ACCESSOR,
136
- // eslint-disable-next-line @angular-eslint/no-forward-ref
137
- useExisting: forwardRef(() => WrCheckbox),
138
- multi: true,
139
- },
140
- ], ngImport: i0, template: "<label class=\"wr-checkbox__label\" [for]=\"id()\">\n <input\n class=\"wr-checkbox__input\"\n type=\"checkbox\"\n [id]=\"id()\"\n [checked]=\"checked()\"\n [disabled]=\"effectiveDisabled()\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-checkbox__box\" aria-hidden=\"true\">\n @if (icon(); as iconName) {\n <wr-icon class=\"wr-checkbox__icon\" [name]=\"iconName\" />\n } @else {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__mark\">\n <polyline\n points=\"3.5 8.5 6.5 11.5 12.5 5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n }\n </span>\n\n <span class=\"wr-checkbox__text\">\n <ng-content />\n </span>\n</label>\n", dependencies: [{ kind: "component", type: WrIcon, selector: "wr-icon", inputs: ["name"] }], encapsulation: i0.ViewEncapsulation.None });
113
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: WrCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
114
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: WrCheckbox, isStandalone: true, selector: "wr-checkbox", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, checkboxValue: { classPropertyName: "checkboxValue", publicName: "checkboxValue", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", touch: "touch" }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: "<label class=\"wr-checkbox__label\" [for]=\"id()\">\n <input\n class=\"wr-checkbox__input\"\n type=\"checkbox\"\n [id]=\"id()\"\n [checked]=\"isChecked()\"\n [indeterminate]=\"indeterminate()\"\n [disabled]=\"effectiveDisabled()\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-checkbox__box\" aria-hidden=\"true\">\n @if (indeterminate()) {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__dash\">\n <line x1=\"3.5\" y1=\"8\" x2=\"12.5\" y2=\"8\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" />\n </svg>\n } @else if (icon(); as iconName) {\n <wr-icon class=\"wr-checkbox__icon\" [name]=\"iconName\" />\n } @else {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__mark\">\n <polyline\n points=\"3.5 8.5 6.5 11.5 12.5 5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n }\n </span>\n\n <span class=\"wr-checkbox__text\">\n <ng-content />\n </span>\n</label>\n", dependencies: [{ kind: "component", type: WrIcon, selector: "wr-icon", inputs: ["name"] }], encapsulation: i0.ViewEncapsulation.None });
141
115
  }
142
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrCheckbox, decorators: [{
116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: WrCheckbox, decorators: [{
143
117
  type: Component,
144
- args: [{ selector: 'wr-checkbox', encapsulation: ViewEncapsulation.None, host: { '[class]': 'classes()' }, imports: [WrIcon], providers: [
145
- {
146
- provide: NG_VALUE_ACCESSOR,
147
- // eslint-disable-next-line @angular-eslint/no-forward-ref
148
- useExisting: forwardRef(() => WrCheckbox),
149
- multi: true,
150
- },
151
- ], template: "<label class=\"wr-checkbox__label\" [for]=\"id()\">\n <input\n class=\"wr-checkbox__input\"\n type=\"checkbox\"\n [id]=\"id()\"\n [checked]=\"checked()\"\n [disabled]=\"effectiveDisabled()\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-checkbox__box\" aria-hidden=\"true\">\n @if (icon(); as iconName) {\n <wr-icon class=\"wr-checkbox__icon\" [name]=\"iconName\" />\n } @else {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__mark\">\n <polyline\n points=\"3.5 8.5 6.5 11.5 12.5 5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n }\n </span>\n\n <span class=\"wr-checkbox__text\">\n <ng-content />\n </span>\n</label>\n" }]
152
- }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }] } });
118
+ args: [{ selector: 'wr-checkbox', encapsulation: ViewEncapsulation.None, host: { '[class]': 'classes()' }, imports: [WrIcon], template: "<label class=\"wr-checkbox__label\" [for]=\"id()\">\n <input\n class=\"wr-checkbox__input\"\n type=\"checkbox\"\n [id]=\"id()\"\n [checked]=\"isChecked()\"\n [indeterminate]=\"indeterminate()\"\n [disabled]=\"effectiveDisabled()\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-checkbox__box\" aria-hidden=\"true\">\n @if (indeterminate()) {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__dash\">\n <line x1=\"3.5\" y1=\"8\" x2=\"12.5\" y2=\"8\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" />\n </svg>\n } @else if (icon(); as iconName) {\n <wr-icon class=\"wr-checkbox__icon\" [name]=\"iconName\" />\n } @else {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__mark\">\n <polyline\n points=\"3.5 8.5 6.5 11.5 12.5 5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n }\n </span>\n\n <span class=\"wr-checkbox__text\">\n <ng-content />\n </span>\n</label>\n" }]
119
+ }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], checkboxValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkboxValue", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], touch: [{ type: i0.Output, args: ["touch"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }] } });
153
120
 
154
121
  /**
155
122
  * @license
@@ -161,34 +128,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
161
128
  * Manages a group of `<wr-checkbox>` children as a single form value
162
129
  * (an array of the checked items' `value` inputs).
163
130
  *
131
+ * A signal-forms native control: it implements `FormValueControl<unknown[]>`,
132
+ * so `[formField]` binds to its `value` model. `[(value)]` works standalone,
133
+ * and classic `[(ngModel)]` / reactive forms keep working through the bridge.
134
+ *
164
135
  * @example
165
136
  * ```html
166
- * <wr-checkbox-group [(ngModel)]="features">
167
- * <wr-checkbox value="autosave">Autosave</wr-checkbox>
168
- * <wr-checkbox value="notifications">Notifications</wr-checkbox>
169
- * <wr-checkbox value="darkmode">Dark mode</wr-checkbox>
137
+ * <wr-checkbox-group [formField]="form.features">
138
+ * <wr-checkbox checkboxValue="autosave">Autosave</wr-checkbox>
139
+ * <wr-checkbox checkboxValue="notifications">Notifications</wr-checkbox>
140
+ * <wr-checkbox checkboxValue="darkmode">Dark mode</wr-checkbox>
170
141
  * </wr-checkbox-group>
171
142
  * ```
172
143
  *
173
- * @see https://ngwr.dev/components/checkbox
144
+ * @see https://ngwr.dev/reference/components/checkbox
174
145
  */
175
146
  class WrCheckboxGroup {
176
147
  /**
177
- * Disable every child checkbox. Also set by Angular forms via
178
- * `setDisabledState`.
148
+ * Disable every child checkbox. Bound automatically from the field's
149
+ * disabled state when used with `[formField]`.
179
150
  *
180
151
  * @default false
181
152
  */
182
153
  disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
183
- selected = signal([], /* @ts-ignore */
154
+ /** The checked items' values. Bound by `[formField]`, or two-way via `[(value)]`. */
155
+ value = model([], /* @ts-ignore */
156
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
157
+ /** Emitted when a child toggles so a bound field can mark itself touched. */
158
+ touch = output();
159
+ // The current selection as a guaranteed array — a classic-forms binding can
160
+ // write null even though the type is `unknown[]`, so normalise every read.
161
+ selected = computed(() => {
162
+ const v = this.value();
163
+ return Array.isArray(v) ? v : [];
164
+ }, /* @ts-ignore */
184
165
  ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
185
- disabledFromCva = signal(false, /* @ts-ignore */
186
- ...(ngDevMode ? [{ debugName: "disabledFromCva" }] : /* istanbul ignore next */ []));
187
- /** Effective disabled state — input wins, CVA second. */
188
- isDisabled = computed(() => this.disabled() || this.disabledFromCva(), /* @ts-ignore */
166
+ /** Effective disabled state (WrCheckboxGroupContext). */
167
+ isDisabled = computed(() => this.disabled(), /* @ts-ignore */
189
168
  ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
190
- onChange = noop;
191
- onTouched = noop;
192
169
  // WrCheckboxGroupContext
193
170
  isSelected(value) {
194
171
  return this.selected().includes(value);
@@ -198,31 +175,11 @@ class WrCheckboxGroup {
198
175
  return;
199
176
  const current = this.selected();
200
177
  const next = current.includes(value) ? current.filter(v => v !== value) : [...current, value];
201
- this.selected.set(next);
202
- this.onChange([...next]);
203
- this.onTouched();
178
+ this.value.set(next);
179
+ this.touch.emit();
204
180
  }
205
- // ControlValueAccessor
206
- writeValue(value) {
207
- this.selected.set(Array.isArray(value) ? [...value] : []);
208
- }
209
- registerOnChange(fn) {
210
- this.onChange = fn;
211
- }
212
- registerOnTouched(fn) {
213
- this.onTouched = fn;
214
- }
215
- setDisabledState(isDisabled) {
216
- this.disabledFromCva.set(coerceBooleanProperty(isDisabled));
217
- }
218
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrCheckboxGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
219
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: WrCheckboxGroup, isStandalone: true, selector: "wr-checkbox-group", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, classAttribute: "wr-checkbox-group" }, providers: [
220
- {
221
- provide: NG_VALUE_ACCESSOR,
222
- // eslint-disable-next-line @angular-eslint/no-forward-ref
223
- useExisting: forwardRef(() => WrCheckboxGroup),
224
- multi: true,
225
- },
181
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: WrCheckboxGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
182
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.0", type: WrCheckboxGroup, isStandalone: true, selector: "wr-checkbox-group", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touch: "touch" }, host: { attributes: { "role": "group" }, classAttribute: "wr-checkbox-group" }, providers: [
226
183
  {
227
184
  provide: WR_CHECKBOX_GROUP,
228
185
  // eslint-disable-next-line @angular-eslint/no-forward-ref
@@ -230,7 +187,7 @@ class WrCheckboxGroup {
230
187
  },
231
188
  ], ngImport: i0, template: '<ng-content />', isInline: true, encapsulation: i0.ViewEncapsulation.None });
232
189
  }
233
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrCheckboxGroup, decorators: [{
190
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: WrCheckboxGroup, decorators: [{
234
191
  type: Component,
235
192
  args: [{
236
193
  selector: 'wr-checkbox-group',
@@ -238,12 +195,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
238
195
  encapsulation: ViewEncapsulation.None,
239
196
  host: { class: 'wr-checkbox-group', role: 'group' },
240
197
  providers: [
241
- {
242
- provide: NG_VALUE_ACCESSOR,
243
- // eslint-disable-next-line @angular-eslint/no-forward-ref
244
- useExisting: forwardRef(() => WrCheckboxGroup),
245
- multi: true,
246
- },
247
198
  {
248
199
  provide: WR_CHECKBOX_GROUP,
249
200
  // eslint-disable-next-line @angular-eslint/no-forward-ref
@@ -251,7 +202,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
251
202
  },
252
203
  ],
253
204
  }]
254
- }], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
205
+ }], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], touch: [{ type: i0.Output, args: ["touch"] }] } });
255
206
 
256
207
  /**
257
208
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-checkbox.mjs","sources":["../../../projects/lib/checkbox/tokens/checkbox-group.token.ts","../../../projects/lib/checkbox/checkbox.ts","../../../projects/lib/checkbox/checkbox.html","../../../projects/lib/checkbox/checkbox-group.ts","../../../projects/lib/checkbox/ngwr-checkbox.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 { InjectionToken, type Signal } from '@angular/core';\n\n/**\n * Contract a checkbox uses to talk to its parent `<wr-checkbox-group>`.\n *\n * @internal\n */\nexport interface WrCheckboxGroupContext {\n /** Is the given value currently selected? */\n isSelected(value: unknown): boolean;\n /** Toggle the given value in the group. */\n toggle(value: unknown): void;\n /** Whether the entire group is disabled. */\n readonly isDisabled: Signal<boolean>;\n}\n\n/**\n * Token a `<wr-checkbox>` injects to read selection state from — and\n * toggle values in — its parent `<wr-checkbox-group>` (when present).\n *\n * @internal\n */\nexport const WR_CHECKBOX_GROUP = new InjectionToken<WrCheckboxGroupContext>('WR_CHECKBOX_GROUP');\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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, forwardRef, inject, input, signal } from '@angular/core';\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { noop, randomId } from 'ngwr/utils';\n\nimport { WR_CHECKBOX_GROUP } from './tokens';\n\n/**\n * Two-state checkbox.\n *\n * **Standalone mode** — boolean value, works as a `ControlValueAccessor`:\n *\n * @example\n * ```html\n * <wr-checkbox [(ngModel)]=\"agree\">I agree</wr-checkbox>\n * ```\n *\n * **Inside `<wr-checkbox-group>`** — the checkbox's `value` is added to\n * or removed from the group's array. The standalone CVA is ignored.\n *\n * @example\n * ```html\n * <wr-checkbox-group [(ngModel)]=\"features\">\n * <wr-checkbox value=\"autosave\">Autosave</wr-checkbox>\n * <wr-checkbox value=\"notifications\">Notifications</wr-checkbox>\n * </wr-checkbox-group>\n * ```\n *\n * @see https://ngwr.dev/components/checkbox\n */\n@Component({\n selector: 'wr-checkbox',\n templateUrl: './checkbox.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n imports: [WrIcon],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrCheckbox),\n multi: true,\n },\n ],\n})\nexport class WrCheckbox implements ControlValueAccessor {\n /**\n * Stable id used to associate the native input with its label.\n *\n * @default Randomly generated\n */\n readonly id = input<string>(randomId('wr-checkbox'));\n\n /**\n * Per-checkbox value used only when inside a `<wr-checkbox-group>`.\n * Ignored in standalone mode.\n */\n readonly value = input<unknown>(null);\n\n /**\n * Disable the checkbox. Also set automatically by Angular forms.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Optional icon name rendered inside the box when checked, in place of the\n * default checkmark. Use any registered NGWR icon.\n */\n readonly icon = input<WrIconName | null>(null);\n\n private readonly group = inject(WR_CHECKBOX_GROUP, { optional: true });\n\n // Standalone state. When inside a group, these are not used as the source of truth.\n protected readonly standaloneChecked = signal(false);\n protected readonly standaloneDisabledFromCva = signal(false);\n\n /** Derived \"is checked\". Reads from group when grouped, else local state. */\n protected readonly checked = computed(() => {\n return this.group ? this.group.isSelected(this.value()) : this.standaloneChecked();\n });\n\n /** Effective disabled — input wins, then group, then CVA. */\n protected readonly effectiveDisabled = computed(() => {\n if (this.disabled()) return true;\n return this.group ? this.group.isDisabled() : this.standaloneDisabledFromCva();\n });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-checkbox'];\n if (this.checked()) parts.push('wr-checkbox--checked');\n if (this.effectiveDisabled()) parts.push('wr-checkbox--disabled');\n return parts.join(' ');\n });\n\n private onChange: (value: boolean) => void = noop;\n private onTouched: () => void = noop;\n\n // ControlValueAccessor (standalone mode)\n\n writeValue(value: boolean | null): void {\n this.standaloneChecked.set(!!value);\n }\n\n registerOnChange(fn: (value: boolean) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.standaloneDisabledFromCva.set(coerceBooleanProperty(isDisabled));\n }\n\n // Template handlers\n\n protected onInputChange(event: Event): void {\n const checked = (event.target as HTMLInputElement).checked;\n if (this.group) {\n this.group.toggle(this.value());\n return;\n }\n this.standaloneChecked.set(checked);\n this.onChange(checked);\n }\n\n protected onInputBlur(): void {\n this.onTouched();\n }\n}\n","<label class=\"wr-checkbox__label\" [for]=\"id()\">\n <input\n class=\"wr-checkbox__input\"\n type=\"checkbox\"\n [id]=\"id()\"\n [checked]=\"checked()\"\n [disabled]=\"effectiveDisabled()\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-checkbox__box\" aria-hidden=\"true\">\n @if (icon(); as iconName) {\n <wr-icon class=\"wr-checkbox__icon\" [name]=\"iconName\" />\n } @else {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__mark\">\n <polyline\n points=\"3.5 8.5 6.5 11.5 12.5 5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n }\n </span>\n\n <span class=\"wr-checkbox__text\">\n <ng-content />\n </span>\n</label>\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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, forwardRef, input, signal } from '@angular/core';\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport { noop } from 'ngwr/utils';\n\nimport { WR_CHECKBOX_GROUP, type WrCheckboxGroupContext } from './tokens';\n\n/**\n * Manages a group of `<wr-checkbox>` children as a single form value\n * (an array of the checked items' `value` inputs).\n *\n * @example\n * ```html\n * <wr-checkbox-group [(ngModel)]=\"features\">\n * <wr-checkbox value=\"autosave\">Autosave</wr-checkbox>\n * <wr-checkbox value=\"notifications\">Notifications</wr-checkbox>\n * <wr-checkbox value=\"darkmode\">Dark mode</wr-checkbox>\n * </wr-checkbox-group>\n * ```\n *\n * @see https://ngwr.dev/components/checkbox\n */\n@Component({\n selector: 'wr-checkbox-group',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-checkbox-group', role: 'group' },\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrCheckboxGroup),\n multi: true,\n },\n {\n provide: WR_CHECKBOX_GROUP,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrCheckboxGroup),\n },\n ],\n})\nexport class WrCheckboxGroup implements ControlValueAccessor, WrCheckboxGroupContext {\n /**\n * Disable every child checkbox. Also set by Angular forms via\n * `setDisabledState`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n private readonly selected = signal<readonly unknown[]>([]);\n private readonly disabledFromCva = signal(false);\n\n /** Effective disabled state — input wins, CVA second. */\n readonly isDisabled = computed(() => this.disabled() || this.disabledFromCva());\n\n private onChange: (value: unknown[]) => void = noop;\n private onTouched: () => void = noop;\n\n // WrCheckboxGroupContext\n\n isSelected(value: unknown): boolean {\n return this.selected().includes(value);\n }\n\n toggle(value: unknown): void {\n if (this.isDisabled()) return;\n const current = this.selected();\n const next = current.includes(value) ? current.filter(v => v !== value) : [...current, value];\n this.selected.set(next);\n this.onChange([...next]);\n this.onTouched();\n }\n\n // ControlValueAccessor\n\n writeValue(value: unknown): void {\n this.selected.set(Array.isArray(value) ? [...(value as unknown[])] : []);\n }\n\n registerOnChange(fn: (value: unknown[]) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabledFromCva.set(coerceBooleanProperty(isDisabled));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;AAKG;AAkBH;;;;;AAKG;MACU,iBAAiB,GAAG,IAAI,cAAc,CAAyB,mBAAmB;;AC7B/F;;;;;AAKG;AAWH;;;;;;;;;;;;;;;;;;;;;;AAsBG;MAgBU,UAAU,CAAA;AACrB;;;;AAIG;AACM,IAAA,EAAE,GAAG,KAAK,CAAS,QAAQ,CAAC,aAAa,CAAC;2EAAC;AAEpD;;;AAGG;IACM,KAAK,GAAG,KAAK,CAAU,IAAI;8EAAC;AAErC;;;;AAIG;IACM,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,qBAAqB,EAAA,CAAG;AAEtE;;;AAGG;IACM,IAAI,GAAG,KAAK,CAAoB,IAAI;6EAAC;IAE7B,KAAK,GAAG,MAAM,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;IAGnD,iBAAiB,GAAG,MAAM,CAAC,KAAK;0FAAC;IACjC,yBAAyB,GAAG,MAAM,CAAC,KAAK;kGAAC;;AAGzC,IAAA,OAAO,GAAG,QAAQ,CAAC,MAAK;QACzC,OAAO,IAAI,CAAC,KAAK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AK,EAAE,IAAI;AACZ,yBAAA;AACD,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;;AAE1B,4BAAA,WAAW,EAAE,UAAU,CAAC,qBAAqB,CAAC;AAC/C,yBAAA;AACF,qBAAA;AACF,iBAAA;;;AChDD;;AAEG;;;;"}
1
+ {"version":3,"file":"ngwr-checkbox.mjs","sources":["../../../projects/lib/checkbox/tokens/checkbox-group.token.ts","../../../projects/lib/checkbox/checkbox.ts","../../../projects/lib/checkbox/checkbox.html","../../../projects/lib/checkbox/checkbox-group.ts","../../../projects/lib/checkbox/ngwr-checkbox.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 { InjectionToken, type Signal } from '@angular/core';\n\n/**\n * Contract a checkbox uses to talk to its parent `<wr-checkbox-group>`.\n *\n * @internal\n */\nexport interface WrCheckboxGroupContext {\n /** Is the given value currently selected? */\n isSelected(value: unknown): boolean;\n /** Toggle the given value in the group. */\n toggle(value: unknown): void;\n /** Whether the entire group is disabled. */\n readonly isDisabled: Signal<boolean>;\n}\n\n/**\n * Token a `<wr-checkbox>` injects to read selection state from — and\n * toggle values in — its parent `<wr-checkbox-group>` (when present).\n *\n * @internal\n */\nexport const WR_CHECKBOX_GROUP = new InjectionToken<WrCheckboxGroupContext>('WR_CHECKBOX_GROUP');\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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, inject, input, model, output } from '@angular/core';\nimport type { FormCheckboxControl } from '@angular/forms/signals';\n\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { randomId } from 'ngwr/utils';\n\nimport { WR_CHECKBOX_GROUP } from './tokens';\n\n/**\n * Two-state checkbox.\n *\n * A signal-forms native control: it implements `FormCheckboxControl`, so\n * `[formField]` binds straight to its `checked` model — no\n * `ControlValueAccessor` in between. `[(checked)]` works standalone, and\n * classic `[(ngModel)]` / reactive forms keep working through Angular's bridge.\n *\n * @example\n * ```html\n * <wr-checkbox [(checked)]=\"agree\">I agree</wr-checkbox>\n * <wr-checkbox [formField]=\"form.agree\">I agree</wr-checkbox>\n * ```\n *\n * **Inside `<wr-checkbox-group>`** — the checkbox's `checkboxValue` is added to\n * or removed from the group's array, and the group is the native form control.\n * (The identity input is `checkboxValue`, not `value`, because\n * `FormCheckboxControl` reserves `value` — its form state is the boolean\n * `checked`.)\n *\n * @example\n * ```html\n * <wr-checkbox-group [formField]=\"form.features\">\n * <wr-checkbox checkboxValue=\"autosave\">Autosave</wr-checkbox>\n * <wr-checkbox checkboxValue=\"notifications\">Notifications</wr-checkbox>\n * </wr-checkbox-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/checkbox\n */\nexport type WrCheckboxSize = 'sm' | 'md' | 'lg';\n\n@Component({\n selector: 'wr-checkbox',\n templateUrl: './checkbox.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n imports: [WrIcon],\n})\nexport class WrCheckbox implements FormCheckboxControl {\n /**\n * Stable id used to associate the native input with its label.\n *\n * @default Randomly generated\n */\n readonly id = input<string>(randomId('wr-checkbox'));\n\n /**\n * This checkbox's identity when inside a `<wr-checkbox-group>` — the value\n * added to / removed from the group's array. Ignored in standalone mode.\n * (Named `checkboxValue`, not `value`, because `FormCheckboxControl` reserves\n * `value`.)\n */\n readonly checkboxValue = input<unknown>(null);\n\n /**\n * Checked state — the form value. Bound by `[formField]`, two-way via\n * `[(checked)]`, or `[(ngModel)]`. Ignored inside a `<wr-checkbox-group>`,\n * where the group's array is the source of truth.\n */\n readonly checked = model<boolean>(false);\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n /**\n * Disable the checkbox. 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 /** Control size — shares the `--wr-control-*` contract. @default 'md' */\n readonly size = input<WrCheckboxSize>('md');\n\n /**\n * Optional icon name rendered inside the box when checked, in place of the\n * default checkmark. Use any registered NGWR icon.\n */\n readonly icon = input<WrIconName | null>(null);\n\n /**\n * Show the indeterminate (\"mixed\") state — a dash instead of a check. Visual\n * only and controlled: set it yourself for a parent \"select all\" whose\n * children are partly checked, and clear it on the next toggle. Takes visual\n * precedence over `checked`; the native input reports `aria-checked=\"mixed\"`.\n *\n * @default false\n */\n readonly indeterminate = input(false, { transform: coerceBooleanProperty });\n\n private readonly group = inject(WR_CHECKBOX_GROUP, { optional: true });\n\n /** Rendered \"is checked\" — reads the group when grouped, else the `checked` model. */\n protected readonly isChecked = computed(() =>\n this.group ? this.group.isSelected(this.checkboxValue()) : this.checked()\n );\n\n /** Effective disabled — the `disabled` input wins, then the group. */\n protected readonly effectiveDisabled = computed(() => {\n if (this.disabled()) return true;\n return this.group ? this.group.isDisabled() : false;\n });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-checkbox'];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-checkbox--${size}`);\n if (this.indeterminate()) parts.push('wr-checkbox--indeterminate');\n else if (this.isChecked()) parts.push('wr-checkbox--checked');\n if (this.effectiveDisabled()) parts.push('wr-checkbox--disabled');\n return parts.join(' ');\n });\n\n // Template handlers\n\n protected onInputChange(event: Event): void {\n if (this.group) {\n this.group.toggle(this.checkboxValue());\n return;\n }\n this.checked.set((event.target as HTMLInputElement).checked);\n }\n\n protected onInputBlur(): void {\n this.touch.emit();\n }\n}\n","<label class=\"wr-checkbox__label\" [for]=\"id()\">\n <input\n class=\"wr-checkbox__input\"\n type=\"checkbox\"\n [id]=\"id()\"\n [checked]=\"isChecked()\"\n [indeterminate]=\"indeterminate()\"\n [disabled]=\"effectiveDisabled()\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-checkbox__box\" aria-hidden=\"true\">\n @if (indeterminate()) {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__dash\">\n <line x1=\"3.5\" y1=\"8\" x2=\"12.5\" y2=\"8\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" />\n </svg>\n } @else if (icon(); as iconName) {\n <wr-icon class=\"wr-checkbox__icon\" [name]=\"iconName\" />\n } @else {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__mark\">\n <polyline\n points=\"3.5 8.5 6.5 11.5 12.5 5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n }\n </span>\n\n <span class=\"wr-checkbox__text\">\n <ng-content />\n </span>\n</label>\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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, forwardRef, input, model, output } from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { WR_CHECKBOX_GROUP, type WrCheckboxGroupContext } from './tokens';\n\n/**\n * Manages a group of `<wr-checkbox>` children as a single form value\n * (an array of the checked items' `value` inputs).\n *\n * A signal-forms native control: it implements `FormValueControl<unknown[]>`,\n * so `[formField]` binds to its `value` model. `[(value)]` works standalone,\n * and classic `[(ngModel)]` / reactive forms keep working through the bridge.\n *\n * @example\n * ```html\n * <wr-checkbox-group [formField]=\"form.features\">\n * <wr-checkbox checkboxValue=\"autosave\">Autosave</wr-checkbox>\n * <wr-checkbox checkboxValue=\"notifications\">Notifications</wr-checkbox>\n * <wr-checkbox checkboxValue=\"darkmode\">Dark mode</wr-checkbox>\n * </wr-checkbox-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/checkbox\n */\n@Component({\n selector: 'wr-checkbox-group',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-checkbox-group', role: 'group' },\n providers: [\n {\n provide: WR_CHECKBOX_GROUP,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrCheckboxGroup),\n },\n ],\n})\nexport class WrCheckboxGroup implements FormValueControl<unknown[]>, WrCheckboxGroupContext {\n /**\n * Disable every child checkbox. Bound automatically from the field's\n * disabled state when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** The checked items' values. Bound by `[formField]`, or two-way via `[(value)]`. */\n readonly value = model<unknown[]>([]);\n\n /** Emitted when a child toggles so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n // The current selection as a guaranteed array — a classic-forms binding can\n // write null even though the type is `unknown[]`, so normalise every read.\n private readonly selected = computed<readonly unknown[]>(() => {\n const v = this.value();\n return Array.isArray(v) ? v : [];\n });\n\n /** Effective disabled state (WrCheckboxGroupContext). */\n readonly isDisabled = computed(() => this.disabled());\n\n // WrCheckboxGroupContext\n\n isSelected(value: unknown): boolean {\n return this.selected().includes(value);\n }\n\n toggle(value: unknown): void {\n if (this.isDisabled()) return;\n const current = this.selected();\n const next = current.includes(value) ? current.filter(v => v !== value) : [...current, value];\n this.value.set(next);\n this.touch.emit();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;AAKG;AAkBH;;;;;AAKG;MACU,iBAAiB,GAAG,IAAI,cAAc,CAAyB,mBAAmB;;AC7B/F;;;;;AAKG;MAkDU,UAAU,CAAA;AACrB;;;;AAIG;AACM,IAAA,EAAE,GAAG,KAAK,CAAS,QAAQ,CAAC,aAAa,CAAC;2EAAC;AAEpD;;;;;AAKG;IACM,aAAa,GAAG,KAAK,CAAU,IAAI;sFAAC;AAE7C;;;;AAIG;IACM,OAAO,GAAG,KAAK,CAAU,KAAK;gFAAC;;IAG/B,KAAK,GAAG,MAAM,EAA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ignore */
61
61
  ...(ngDevMode ? [{ debugName: "chars" }] : /* istanbul ignore next */ []));
62
- spinEl = viewChild.required('spin');
62
+ spinEl = viewChild.required('spin', /* @ts-ignore */
63
+ ...(ngDevMode ? [{ debugName: "spinEl" }] : /* istanbul ignore next */ []));
63
64
  destroyRef = inject(DestroyRef);
64
65
  isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
65
66
  platform = inject(WrPlatform);
@@ -149,10 +150,10 @@ class WrCircularText {
149
150
  this.rotation = this.spinEl().nativeElement.animate([{ transform: 'rotate(0deg)' }, { transform: 'rotate(360deg)' }], { duration: newDurMs, iterations: Infinity, easing: 'linear' });
150
151
  this.rotation.currentTime = ratio * newDurMs;
151
152
  }
152
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrCircularText, deps: [], target: i0.ɵɵFactoryTarget.Component });
153
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: WrCircularText, isStandalone: true, selector: "wr-circular-text", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: true, transformFunction: null }, spinDuration: { classPropertyName: "spinDuration", publicName: "spinDuration", isSignal: true, isRequired: false, transformFunction: null }, onHover: { classPropertyName: "onHover", publicName: "onHover", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.wr-circular-text--bonkers": "onHover() === 'goBonkers'" }, classAttribute: "wr-circular-text" }, viewQueries: [{ propertyName: "spinEl", first: true, predicate: ["spin"], descendants: true, isSignal: true }], ngImport: i0, template: "<span class=\"wr-circular-text__spin\" #spin>\n @for (c of chars(); track $index) {\n <span class=\"wr-circular-text__char\" [style.transform]=\"c.transform\">{{ c.ch }}</span>\n }\n</span>\n", styles: [".wr-circular-text{--wr-circular-text-size: 12rem;--wr-circular-text-radius: calc(var(--wr-circular-text-size) / 2);position:relative;display:inline-block;width:var(--wr-circular-text-size);height:var(--wr-circular-text-size);border-radius:50%;font-weight:700;text-align:center;-webkit-user-select:none;user-select:none;transition:transform .6s cubic-bezier(.2,.9,.3,1.4)}.wr-circular-text__spin{position:absolute;inset:0;will-change:transform}.wr-circular-text__char{position:absolute;top:50%;left:50%;display:inline-block;margin-left:-.5em;margin-top:-.5em;line-height:1}.wr-circular-text--bonkers:hover{transform:scale(.8)}\n"], encapsulation: i0.ViewEncapsulation.None });
153
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: WrCircularText, deps: [], target: i0.ɵɵFactoryTarget.Component });
154
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: WrCircularText, isStandalone: true, selector: "wr-circular-text", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: true, transformFunction: null }, spinDuration: { classPropertyName: "spinDuration", publicName: "spinDuration", isSignal: true, isRequired: false, transformFunction: null }, onHover: { classPropertyName: "onHover", publicName: "onHover", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.wr-circular-text--bonkers": "onHover() === 'goBonkers'" }, classAttribute: "wr-circular-text" }, viewQueries: [{ propertyName: "spinEl", first: true, predicate: ["spin"], descendants: true, isSignal: true }], ngImport: i0, template: "<span class=\"wr-circular-text__spin\" #spin>\n @for (c of chars(); track $index) {\n <span class=\"wr-circular-text__char\" [style.transform]=\"c.transform\">{{ c.ch }}</span>\n }\n</span>\n", styles: [".wr-circular-text{--wr-circular-text-size: 12rem;--wr-circular-text-radius: calc(var(--wr-circular-text-size) / 2);position:relative;display:inline-block;width:var(--wr-circular-text-size);height:var(--wr-circular-text-size);border-radius:50%;font-weight:700;text-align:center;-webkit-user-select:none;user-select:none;transition:transform .6s cubic-bezier(.2,.9,.3,1.4)}.wr-circular-text__spin{position:absolute;inset:0;will-change:transform}.wr-circular-text__char{position:absolute;top:50%;left:50%;display:inline-block;margin-left:-.5em;margin-top:-.5em;line-height:1}.wr-circular-text--bonkers:hover{transform:scale(.8)}\n"], encapsulation: i0.ViewEncapsulation.None });
154
155
  }
155
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrCircularText, decorators: [{
156
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: WrCircularText, decorators: [{
156
157
  type: Component,
157
158
  args: [{ selector: 'wr-circular-text', encapsulation: ViewEncapsulation.None, host: {
158
159
  class: 'wr-circular-text',
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-circular-text.mjs","sources":["../../../projects/lib/circular-text/circular-text.ts","../../../projects/lib/circular-text/circular-text.html","../../../projects/lib/circular-text/ngwr-circular-text.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 * Angular adaptation of the CircularText effect by David Haz / reactbits.dev.\n * Original: https://www.reactbits.dev/text-animations/circular-text\n *\n * Reactbits drives the rotation with `motion/react`, which lets the spin\n * angle persist across speed changes. CSS keyframes can't do that — when\n * `animation-duration` changes mid-flight, the browser recomputes the\n * progress as `(elapsed % newDuration) / newDuration`, which visibly\n * jumps the rotation. So this port drives the rotation through the\n * Web Animations API and preserves the current angle when hover swaps\n * the duration. Bonkers `scale` is still CSS-driven (no conflict — the\n * rotation lives on an inner wrapper).\n */\n\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n viewChild,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { numAttr } from 'ngwr/utils';\n\nimport type { WrCircularTextHover } from './interfaces';\n\ninterface Char {\n readonly ch: string;\n readonly transform: string;\n}\n\n/**\n * Text laid out around a circle, with the whole circle spinning. Hover\n * behaviour swaps the spin rate (or pauses it) — the current rotation\n * angle is preserved across the swap so there's no visible jump.\n *\n * @example\n * ```html\n * <wr-circular-text text=\"HELLO * NGWR * \" />\n * <wr-circular-text text=\"GO BONKERS\" onHover=\"goBonkers\" [spinDuration]=\"12\" />\n * ```\n *\n * @see https://www.reactbits.dev/text-animations/circular-text\n */\n@Component({\n selector: 'wr-circular-text',\n templateUrl: './circular-text.html',\n styleUrl: './circular-text.scss',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-circular-text',\n '[class.wr-circular-text--bonkers]': \"onHover() === 'goBonkers'\",\n },\n})\nexport class WrCircularText {\n /** Text to lay out around the circle. */\n readonly text = input.required<string>();\n\n /** Seconds per full revolution at rest. @default 20 */\n readonly spinDuration = input(20, { transform: numAttr(20) });\n\n /** Hover behaviour. `null` disables hover reactivity. @default 'speedUp' */\n readonly onHover = input<WrCircularTextHover>('speedUp');\n\n protected readonly chars = computed<readonly Char[]>(() => {\n const letters = Array.from(this.text());\n const len = letters.length;\n if (len === 0) return [];\n return letters.map((ch, i) => {\n const rotation = (360 / len) * i;\n // Rotate around the spinner's centre, then push each char outward\n // by the orbit radius (set via CSS var). All chars end up on a\n // circle of constant radius — not a diagonal line.\n const transform = `rotate(${rotation}deg) translateY(calc(-1 * var(--wr-circular-text-radius)))`;\n return { ch, transform };\n });\n });\n\n private readonly spinEl = viewChild.required<ElementRef<HTMLElement>>('spin');\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly platform = inject(WrPlatform);\n private rotation: Animation | null = null;\n private hovered = false;\n\n /** Active spin duration in seconds — base, or hover-modified. */\n private effectiveDuration(): number | 'pause' {\n const base = this.spinDuration();\n if (!this.hovered) return base;\n switch (this.onHover()) {\n case 'speedUp':\n return base / 4;\n case 'slowDown':\n return base * 2;\n case 'pause':\n return 'pause';\n case 'goBonkers':\n return base / 20;\n default:\n return base;\n }\n }\n\n constructor() {\n if (!this.isBrowser) return;\n\n afterNextRender(() => {\n this.startOrSwap();\n\n const host = this.spinEl().nativeElement.parentElement!;\n const onEnter = (): void => {\n this.hovered = true;\n this.startOrSwap();\n };\n const onLeave = (): void => {\n this.hovered = false;\n this.startOrSwap();\n };\n host.addEventListener('mouseenter', onEnter);\n host.addEventListener('mouseleave', onLeave);\n this.destroyRef.onDestroy(() => {\n host.removeEventListener('mouseenter', onEnter);\n host.removeEventListener('mouseleave', onLeave);\n this.rotation?.cancel();\n });\n });\n\n // React to input changes (spinDuration, onHover) — and the OS\n // reduced-motion setting — without losing angle.\n effect(() => {\n this.spinDuration();\n this.onHover();\n this.platform.prefersReducedMotion();\n queueMicrotask(() => this.startOrSwap());\n });\n }\n\n /**\n * Start the rotation, or swap its duration while preserving the\n * current angle. If the new mode is `pause`, just pause the animation.\n */\n private startOrSwap(): void {\n if (!this.spinEl()) return;\n\n // Reduced motion: hold the ring still — the circular layout is the\n // point of the component; only the revolution is decorative.\n if (this.platform.prefersReducedMotion()) {\n this.rotation?.pause();\n return;\n }\n\n const target = this.effectiveDuration();\n\n if (target === 'pause') {\n this.rotation?.pause();\n return;\n }\n\n const newDurMs = Math.max(1, target * 1000);\n\n // First start — no previous animation to preserve.\n if (!this.rotation) {\n this.rotation = this.spinEl().nativeElement.animate(\n [{ transform: 'rotate(0deg)' }, { transform: 'rotate(360deg)' }],\n { duration: newDurMs, iterations: Infinity, easing: 'linear' }\n );\n return;\n }\n\n // Compute the current angle (0..1 of a full turn) under the old\n // timing, then restart with the new duration seeked to the same\n // angle — keeps the visual continuous across speed changes.\n const oldEffect = this.rotation.effect as KeyframeEffect | null;\n const oldDurMs = (oldEffect?.getTiming().duration as number) || newDurMs || newDurMs;\n const oldTime = (this.rotation.currentTime as number) ?? 0;\n const ratio = (((oldTime % oldDurMs) + oldDurMs) % oldDurMs) / oldDurMs;\n\n this.rotation.cancel();\n this.rotation = this.spinEl().nativeElement.animate(\n [{ transform: 'rotate(0deg)' }, { transform: 'rotate(360deg)' }],\n { duration: newDurMs, iterations: Infinity, easing: 'linear' }\n );\n this.rotation.currentTime = ratio * newDurMs;\n }\n}\n\nexport type { WrCircularTextHover } from './interfaces';\n","<span class=\"wr-circular-text__spin\" #spin>\n @for (c of chars(); track $index) {\n <span class=\"wr-circular-text__char\" [style.transform]=\"c.transform\">{{ c.ch }}</span>\n }\n</span>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;AAiBG;AA2BH;;;;;;;;;;;;AAYG;MAWU,cAAc,CAAA;;IAEhB,IAAI,GAAG,KAAK,CAAC,QAAQ;6EAAU;;AAG/B,IAAA,YAAY,GAAG,KAAK,CAAC,EAAE,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,cAAA,EAAA,8BAAA,EAAA,CAAA,EAAI,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,EAAA,CAAG;;IAGpD,OAAO,GAAG,KAAK,CAAsB,SAAS;gFAAC;AAErC,IAAA,KAAK,GAAG,QAAQ,CAAkB,MAAK;QACxD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AACvC,QAAA,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM;QAC1B,IAAI,GAAG,KAAK,CAAC;AAAE,YAAA,OAAO,EAAE;QACxB,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,KAAI;YAC3B,MAAM,QAAQ,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;;;;AAIhC,YAAA,MAAM,SAAS,GAAG,CAAA,OAAA,EAAU,QAAQ,4DAA4D;AAChG,YAAA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE;AAC1B,QAAA,CAAC,CAAC;IACJ,CAAC;8EAAC;AAEe,IAAA,MAAM,GAAG,SAAS,CAAC,QAAQ,CAA0B,MAAM,CAAC;AAE5D,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC/B,SAAS,GAAG,iBA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EAAE,kBAAkB;AACzB,wBAAA,mCAAmC,EAAE,2BAA2B;AACjE,qBAAA,EAAA,QAAA,EAAA,sMAAA,EAAA,MAAA,EAAA,CAAA,qnBAAA,CAAA,EAAA;2XA0BqE,MAAM,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE3F9E;;AAEG;;;;"}
1
+ {"version":3,"file":"ngwr-circular-text.mjs","sources":["../../../projects/lib/circular-text/circular-text.ts","../../../projects/lib/circular-text/circular-text.html","../../../projects/lib/circular-text/ngwr-circular-text.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 * Angular adaptation of the CircularText effect by David Haz / reactbits.dev.\n * Original: https://www.reactbits.dev/text-animations/circular-text\n *\n * Reactbits drives the rotation with `motion/react`, which lets the spin\n * angle persist across speed changes. CSS keyframes can't do that — when\n * `animation-duration` changes mid-flight, the browser recomputes the\n * progress as `(elapsed % newDuration) / newDuration`, which visibly\n * jumps the rotation. So this port drives the rotation through the\n * Web Animations API and preserves the current angle when hover swaps\n * the duration. Bonkers `scale` is still CSS-driven (no conflict — the\n * rotation lives on an inner wrapper).\n */\n\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n viewChild,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { numAttr } from 'ngwr/utils';\n\nimport type { WrCircularTextHover } from './interfaces';\n\ninterface Char {\n readonly ch: string;\n readonly transform: string;\n}\n\n/**\n * Text laid out around a circle, with the whole circle spinning. Hover\n * behaviour swaps the spin rate (or pauses it) — the current rotation\n * angle is preserved across the swap so there's no visible jump.\n *\n * @example\n * ```html\n * <wr-circular-text text=\"HELLO * NGWR * \" />\n * <wr-circular-text text=\"GO BONKERS\" onHover=\"goBonkers\" [spinDuration]=\"12\" />\n * ```\n *\n * @see https://www.reactbits.dev/text-animations/circular-text\n */\n@Component({\n selector: 'wr-circular-text',\n templateUrl: './circular-text.html',\n styleUrl: './circular-text.scss',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-circular-text',\n '[class.wr-circular-text--bonkers]': \"onHover() === 'goBonkers'\",\n },\n})\nexport class WrCircularText {\n /** Text to lay out around the circle. */\n readonly text = input.required<string>();\n\n /** Seconds per full revolution at rest. @default 20 */\n readonly spinDuration = input(20, { transform: numAttr(20) });\n\n /** Hover behaviour. `null` disables hover reactivity. @default 'speedUp' */\n readonly onHover = input<WrCircularTextHover>('speedUp');\n\n protected readonly chars = computed<readonly Char[]>(() => {\n const letters = Array.from(this.text());\n const len = letters.length;\n if (len === 0) return [];\n return letters.map((ch, i) => {\n const rotation = (360 / len) * i;\n // Rotate around the spinner's centre, then push each char outward\n // by the orbit radius (set via CSS var). All chars end up on a\n // circle of constant radius — not a diagonal line.\n const transform = `rotate(${rotation}deg) translateY(calc(-1 * var(--wr-circular-text-radius)))`;\n return { ch, transform };\n });\n });\n\n private readonly spinEl = viewChild.required<ElementRef<HTMLElement>>('spin');\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly platform = inject(WrPlatform);\n private rotation: Animation | null = null;\n private hovered = false;\n\n /** Active spin duration in seconds — base, or hover-modified. */\n private effectiveDuration(): number | 'pause' {\n const base = this.spinDuration();\n if (!this.hovered) return base;\n switch (this.onHover()) {\n case 'speedUp':\n return base / 4;\n case 'slowDown':\n return base * 2;\n case 'pause':\n return 'pause';\n case 'goBonkers':\n return base / 20;\n default:\n return base;\n }\n }\n\n constructor() {\n if (!this.isBrowser) return;\n\n afterNextRender(() => {\n this.startOrSwap();\n\n const host = this.spinEl().nativeElement.parentElement!;\n const onEnter = (): void => {\n this.hovered = true;\n this.startOrSwap();\n };\n const onLeave = (): void => {\n this.hovered = false;\n this.startOrSwap();\n };\n host.addEventListener('mouseenter', onEnter);\n host.addEventListener('mouseleave', onLeave);\n this.destroyRef.onDestroy(() => {\n host.removeEventListener('mouseenter', onEnter);\n host.removeEventListener('mouseleave', onLeave);\n this.rotation?.cancel();\n });\n });\n\n // React to input changes (spinDuration, onHover) — and the OS\n // reduced-motion setting — without losing angle.\n effect(() => {\n this.spinDuration();\n this.onHover();\n this.platform.prefersReducedMotion();\n queueMicrotask(() => this.startOrSwap());\n });\n }\n\n /**\n * Start the rotation, or swap its duration while preserving the\n * current angle. If the new mode is `pause`, just pause the animation.\n */\n private startOrSwap(): void {\n if (!this.spinEl()) return;\n\n // Reduced motion: hold the ring still — the circular layout is the\n // point of the component; only the revolution is decorative.\n if (this.platform.prefersReducedMotion()) {\n this.rotation?.pause();\n return;\n }\n\n const target = this.effectiveDuration();\n\n if (target === 'pause') {\n this.rotation?.pause();\n return;\n }\n\n const newDurMs = Math.max(1, target * 1000);\n\n // First start — no previous animation to preserve.\n if (!this.rotation) {\n this.rotation = this.spinEl().nativeElement.animate(\n [{ transform: 'rotate(0deg)' }, { transform: 'rotate(360deg)' }],\n { duration: newDurMs, iterations: Infinity, easing: 'linear' }\n );\n return;\n }\n\n // Compute the current angle (0..1 of a full turn) under the old\n // timing, then restart with the new duration seeked to the same\n // angle — keeps the visual continuous across speed changes.\n const oldEffect = this.rotation.effect as KeyframeEffect | null;\n const oldDurMs = (oldEffect?.getTiming().duration as number) || newDurMs || newDurMs;\n const oldTime = (this.rotation.currentTime as number) ?? 0;\n const ratio = (((oldTime % oldDurMs) + oldDurMs) % oldDurMs) / oldDurMs;\n\n this.rotation.cancel();\n this.rotation = this.spinEl().nativeElement.animate(\n [{ transform: 'rotate(0deg)' }, { transform: 'rotate(360deg)' }],\n { duration: newDurMs, iterations: Infinity, easing: 'linear' }\n );\n this.rotation.currentTime = ratio * newDurMs;\n }\n}\n\nexport type { WrCircularTextHover } from './interfaces';\n","<span class=\"wr-circular-text__spin\" #spin>\n @for (c of chars(); track $index) {\n <span class=\"wr-circular-text__char\" [style.transform]=\"c.transform\">{{ c.ch }}</span>\n }\n</span>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;AAiBG;AA2BH;;;;;;;;;;;;AAYG;MAWU,cAAc,CAAA;;IAEhB,IAAI,GAAG,KAAK,CAAC,QAAQ;6EAAU;;AAG/B,IAAA,YAAY,GAAG,KAAK,CAAC,EAAE,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,cAAA,EAAA,8BAAA,EAAA,CAAA,EAAI,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,EAAA,CAAG;;IAGpD,OAAO,GAAG,KAAK,CAAsB,SAAS;gFAAC;AAErC,IAAA,KAAK,GAAG,QAAQ,CAAkB,MAAK;QACxD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AACvC,QAAA,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM;QAC1B,IAAI,GAAG,KAAK,CAAC;AAAE,YAAA,OAAO,EAAE;QACxB,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,KAAI;YAC3B,MAAM,QAAQ,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;;;;AAIhC,YAAA,MAAM,SAAS,GAAG,CAAA,OAAA,EAAU,QAAQ,4DAA4D;AAChG,YAAA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE;AAC1B,QAAA,CAAC,CAAC;IACJ,CAAC;8EAAC;AAEe,IAAA,MAAM,GAAG,SAAS,CAAC,QAAQ,CAA0B,MAAM;+EAAC;AAE5D,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC/B,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAClD,IAAA,QAAQ,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AA,EAAA,QAAA,EAAA,sMAAA,EAAA,MAAA,EAAA,CAAA,qnBAAA,CAAA,EAAA;2XA0BqE,MAAM,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE3F9E;;AAEG;;;;"}
@@ -36,8 +36,13 @@ const EASINGS = {
36
36
  * @see https://www.reactbits.dev/animations/click-spark
37
37
  */
38
38
  class WrClickSpark {
39
- /** Spark line colour. @default '#fff' */
40
- sparkColor = input('#fff', /* @ts-ignore */
39
+ /**
40
+ * Spark line colour. Accepts any CSS colour, or a `var(--wr-…)` token which is
41
+ * resolved against the host so it tracks the theme. The default flips with the
42
+ * theme — dark sparks in light mode, light sparks in dark.
43
+ * @default 'var(--wr-color-dark)'
44
+ */
45
+ sparkColor = input('var(--wr-color-dark)', /* @ts-ignore */
41
46
  ...(ngDevMode ? [{ debugName: "sparkColor" }] : /* istanbul ignore next */ []));
42
47
  /** Length of each spark line in pixels (at t=0; tapers to 0 at t=1). @default 10 */
43
48
  sparkSize = input(10, { ...(ngDevMode ? { debugName: "sparkSize" } : /* istanbul ignore next */ {}), transform: numAttr(10) });
@@ -52,7 +57,8 @@ class WrClickSpark {
52
57
  ...(ngDevMode ? [{ debugName: "easing" }] : /* istanbul ignore next */ []));
53
58
  /** Multiplier on the travel distance — bumps the radius without changing `sparkRadius`. @default 1 */
54
59
  extraScale = input(1, { ...(ngDevMode ? { debugName: "extraScale" } : /* istanbul ignore next */ {}), transform: numAttr(1) });
55
- canvasRef = viewChild.required('canvas');
60
+ canvasRef = viewChild.required('canvas', /* @ts-ignore */
61
+ ...(ngDevMode ? [{ debugName: "canvasRef" }] : /* istanbul ignore next */ []));
56
62
  host = inject(ElementRef);
57
63
  destroyRef = inject(DestroyRef);
58
64
  isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
@@ -82,6 +88,20 @@ class WrClickSpark {
82
88
  }
83
89
  }
84
90
  // Internals
91
+ /**
92
+ * Canvas `strokeStyle` can't read CSS custom properties, so a `var(--wr-…)`
93
+ * token is resolved against the host's computed style here. Plain colours
94
+ * pass through untouched. Falls back to a dark literal if the custom
95
+ * property resolves to nothing.
96
+ */
97
+ resolveColor() {
98
+ const color = this.sparkColor();
99
+ const match = /^var\((--[\w-]+)\)$/.exec(color.trim());
100
+ if (!match)
101
+ return color;
102
+ const resolved = getComputedStyle(this.host.nativeElement).getPropertyValue(match[1]).trim();
103
+ return resolved || '#0f172a';
104
+ }
85
105
  syncCanvasSize() {
86
106
  const canvas = this.canvasRef().nativeElement;
87
107
  const host = this.host.nativeElement;
@@ -118,7 +138,7 @@ class WrClickSpark {
118
138
  const sparkRadius = this.sparkRadius();
119
139
  const sparkSize = this.sparkSize();
120
140
  const extraScale = this.extraScale();
121
- const color = this.sparkColor();
141
+ const color = this.resolveColor();
122
142
  this.sparks = this.sparks.filter(spark => {
123
143
  const elapsed = ts - spark.startTime;
124
144
  if (elapsed >= duration)
@@ -144,10 +164,10 @@ class WrClickSpark {
144
164
  raf = requestAnimationFrame(draw);
145
165
  this.destroyRef.onDestroy(() => cancelAnimationFrame(raf));
146
166
  }
147
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrClickSpark, deps: [], target: i0.ɵɵFactoryTarget.Component });
148
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.2", type: WrClickSpark, isStandalone: true, selector: "wr-click-spark", inputs: { sparkColor: { classPropertyName: "sparkColor", publicName: "sparkColor", isSignal: true, isRequired: false, transformFunction: null }, sparkSize: { classPropertyName: "sparkSize", publicName: "sparkSize", isSignal: true, isRequired: false, transformFunction: null }, sparkRadius: { classPropertyName: "sparkRadius", publicName: "sparkRadius", isSignal: true, isRequired: false, transformFunction: null }, sparkCount: { classPropertyName: "sparkCount", publicName: "sparkCount", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, easing: { classPropertyName: "easing", publicName: "easing", isSignal: true, isRequired: false, transformFunction: null }, extraScale: { classPropertyName: "extraScale", publicName: "extraScale", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, classAttribute: "wr-click-spark" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["canvas"], descendants: true, isSignal: true }], ngImport: i0, template: "<canvas #canvas class=\"wr-click-spark__canvas\"></canvas>\n<ng-content />\n", styles: [".wr-click-spark{position:relative;display:block}.wr-click-spark__canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:1}\n"], encapsulation: i0.ViewEncapsulation.None });
167
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: WrClickSpark, deps: [], target: i0.ɵɵFactoryTarget.Component });
168
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: WrClickSpark, isStandalone: true, selector: "wr-click-spark", inputs: { sparkColor: { classPropertyName: "sparkColor", publicName: "sparkColor", isSignal: true, isRequired: false, transformFunction: null }, sparkSize: { classPropertyName: "sparkSize", publicName: "sparkSize", isSignal: true, isRequired: false, transformFunction: null }, sparkRadius: { classPropertyName: "sparkRadius", publicName: "sparkRadius", isSignal: true, isRequired: false, transformFunction: null }, sparkCount: { classPropertyName: "sparkCount", publicName: "sparkCount", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, easing: { classPropertyName: "easing", publicName: "easing", isSignal: true, isRequired: false, transformFunction: null }, extraScale: { classPropertyName: "extraScale", publicName: "extraScale", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, classAttribute: "wr-click-spark" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["canvas"], descendants: true, isSignal: true }], ngImport: i0, template: "<canvas #canvas class=\"wr-click-spark__canvas\"></canvas>\n<ng-content />\n", styles: [".wr-click-spark{position:relative;display:block}.wr-click-spark__canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:1}\n"], encapsulation: i0.ViewEncapsulation.None });
149
169
  }
150
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrClickSpark, decorators: [{
170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: WrClickSpark, decorators: [{
151
171
  type: Component,
152
172
  args: [{ selector: 'wr-click-spark', encapsulation: ViewEncapsulation.None, host: {
153
173
  class: 'wr-click-spark',