@ng-cn/core 1.0.15 → 1.0.17

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 (380) hide show
  1. package/package.json +34 -33
  2. package/schematics/component/index.js +454 -95
  3. package/schematics/component/index.ts +459 -98
  4. package/schematics/ng-add/index.js +539 -55
  5. package/schematics/ng-add/index.ts +555 -62
  6. package/schematics/ng-add/schema.json +8 -2
  7. package/schematics/test-schematic.js +1 -2
  8. package/src/app/lib/components/ui/.gitkeep +0 -0
  9. package/src/app/lib/components/ui/accordion/accordion-content.component.ts +16 -24
  10. package/src/app/lib/components/ui/accordion/accordion-context.ts +4 -9
  11. package/src/app/lib/components/ui/accordion/accordion-item.component.ts +33 -29
  12. package/src/app/lib/components/ui/accordion/accordion-trigger.component.ts +11 -14
  13. package/src/app/lib/components/ui/accordion/accordion.component.ts +60 -49
  14. package/src/app/lib/components/ui/accordion/index.ts +5 -6
  15. package/src/app/lib/components/ui/alert/alert-description.component.ts +3 -8
  16. package/src/app/lib/components/ui/alert/alert-title.component.ts +2 -7
  17. package/src/app/lib/components/ui/alert/alert-variants.ts +19 -5
  18. package/src/app/lib/components/ui/alert/alert.component.ts +2 -10
  19. package/src/app/lib/components/ui/alert/index.ts +0 -1
  20. package/src/app/lib/components/ui/alert-dialog/alert-dialog-action.component.ts +5 -12
  21. package/src/app/lib/components/ui/alert-dialog/alert-dialog-cancel.component.ts +5 -11
  22. package/src/app/lib/components/ui/alert-dialog/alert-dialog-content.component.ts +63 -66
  23. package/src/app/lib/components/ui/alert-dialog/alert-dialog-context.ts +10 -5
  24. package/src/app/lib/components/ui/alert-dialog/alert-dialog-description.component.ts +5 -10
  25. package/src/app/lib/components/ui/alert-dialog/alert-dialog-footer.component.ts +3 -7
  26. package/src/app/lib/components/ui/alert-dialog/alert-dialog-header.component.ts +3 -7
  27. package/src/app/lib/components/ui/alert-dialog/alert-dialog-title.component.ts +5 -12
  28. package/src/app/lib/components/ui/alert-dialog/alert-dialog-trigger.component.ts +8 -12
  29. package/src/app/lib/components/ui/alert-dialog/alert-dialog.component.ts +28 -34
  30. package/src/app/lib/components/ui/alert-dialog/index.ts +0 -1
  31. package/src/app/lib/components/ui/aspect-ratio/aspect-ratio.component.ts +3 -9
  32. package/src/app/lib/components/ui/avatar/avatar-context.ts +9 -0
  33. package/src/app/lib/components/ui/avatar/avatar-fallback.component.ts +7 -18
  34. package/src/app/lib/components/ui/avatar/avatar-image.component.ts +39 -17
  35. package/src/app/lib/components/ui/avatar/avatar.component.ts +17 -20
  36. package/src/app/lib/components/ui/avatar/index.ts +1 -1
  37. package/src/app/lib/components/ui/avatar/ui-avatar.component.ts +9 -30
  38. package/src/app/lib/components/ui/badge/badge-variants.ts +5 -5
  39. package/src/app/lib/components/ui/badge/badge.component.ts +4 -8
  40. package/src/app/lib/components/ui/badge/index.ts +0 -1
  41. package/src/app/lib/components/ui/breadcrumb/breadcrumb-ellipsis.component.ts +3 -7
  42. package/src/app/lib/components/ui/breadcrumb/breadcrumb-item.component.ts +5 -14
  43. package/src/app/lib/components/ui/breadcrumb/breadcrumb-link.component.ts +6 -18
  44. package/src/app/lib/components/ui/breadcrumb/breadcrumb-list.component.ts +6 -15
  45. package/src/app/lib/components/ui/breadcrumb/breadcrumb-page.component.ts +3 -7
  46. package/src/app/lib/components/ui/breadcrumb/breadcrumb-separator.component.ts +22 -31
  47. package/src/app/lib/components/ui/breadcrumb/breadcrumb.component.ts +3 -9
  48. package/src/app/lib/components/ui/breadcrumb/index.ts +0 -1
  49. package/src/app/lib/components/ui/button/button-variants.ts +6 -8
  50. package/src/app/lib/components/ui/button/button.component.ts +4 -8
  51. package/src/app/lib/components/ui/button/index.ts +0 -1
  52. package/src/app/lib/components/ui/button-group/button-group-variants.ts +12 -15
  53. package/src/app/lib/components/ui/button-group/button-group.component.ts +6 -14
  54. package/src/app/lib/components/ui/button-group/index.ts +1 -5
  55. package/src/app/lib/components/ui/calendar/calendar.component.ts +103 -115
  56. package/src/app/lib/components/ui/card/card-action.component.ts +2 -10
  57. package/src/app/lib/components/ui/card/card-content.component.ts +1 -6
  58. package/src/app/lib/components/ui/card/card-description.component.ts +2 -7
  59. package/src/app/lib/components/ui/card/card-footer.component.ts +2 -7
  60. package/src/app/lib/components/ui/card/card-header.component.ts +3 -8
  61. package/src/app/lib/components/ui/card/card-title.component.ts +2 -9
  62. package/src/app/lib/components/ui/card/card.component.ts +3 -8
  63. package/src/app/lib/components/ui/card/index.ts +0 -1
  64. package/src/app/lib/components/ui/carousel/carousel-content.component.ts +3 -9
  65. package/src/app/lib/components/ui/carousel/carousel-item.component.ts +5 -5
  66. package/src/app/lib/components/ui/carousel/carousel-next.component.ts +9 -8
  67. package/src/app/lib/components/ui/carousel/carousel-previous.component.ts +9 -8
  68. package/src/app/lib/components/ui/carousel/carousel.component.ts +14 -25
  69. package/src/app/lib/components/ui/carousel/index.ts +5 -2
  70. package/src/app/lib/components/ui/chart/chart-container.component.ts +20 -26
  71. package/src/app/lib/components/ui/chart/chart-legend-content.component.ts +6 -16
  72. package/src/app/lib/components/ui/chart/chart-legend.component.ts +2 -7
  73. package/src/app/lib/components/ui/chart/chart-tooltip-content.component.ts +2 -9
  74. package/src/app/lib/components/ui/chart/chart-tooltip.component.ts +2 -7
  75. package/src/app/lib/components/ui/chart/chart.component.ts +12 -32
  76. package/src/app/lib/components/ui/chart/index.ts +7 -8
  77. package/src/app/lib/components/ui/checkbox/checkbox.component.ts +55 -74
  78. package/src/app/lib/components/ui/collapsible/collapsible-content.component.ts +16 -25
  79. package/src/app/lib/components/ui/collapsible/collapsible-context.ts +0 -8
  80. package/src/app/lib/components/ui/collapsible/collapsible-trigger.component.ts +6 -16
  81. package/src/app/lib/components/ui/collapsible/collapsible.component.ts +29 -33
  82. package/src/app/lib/components/ui/collapsible/index.ts +0 -1
  83. package/src/app/lib/components/ui/combobox/combobox-content.component.ts +8 -15
  84. package/src/app/lib/components/ui/combobox/combobox-context.ts +5 -4
  85. package/src/app/lib/components/ui/combobox/combobox-empty.component.ts +5 -12
  86. package/src/app/lib/components/ui/combobox/combobox-group.component.ts +3 -7
  87. package/src/app/lib/components/ui/combobox/combobox-input.component.ts +25 -25
  88. package/src/app/lib/components/ui/combobox/combobox-item.component.ts +45 -44
  89. package/src/app/lib/components/ui/combobox/combobox-list.component.ts +14 -12
  90. package/src/app/lib/components/ui/combobox/combobox-trigger.component.ts +24 -14
  91. package/src/app/lib/components/ui/combobox/combobox-value.component.ts +27 -22
  92. package/src/app/lib/components/ui/combobox/combobox.component.ts +74 -54
  93. package/src/app/lib/components/ui/combobox/index.ts +1 -6
  94. package/src/app/lib/components/ui/command/command-context.ts +1 -5
  95. package/src/app/lib/components/ui/command/command-dialog.component.ts +12 -14
  96. package/src/app/lib/components/ui/command/command-empty.component.ts +2 -3
  97. package/src/app/lib/components/ui/command/command-group.component.ts +32 -25
  98. package/src/app/lib/components/ui/command/command-input.component.ts +29 -28
  99. package/src/app/lib/components/ui/command/command-item.component.ts +46 -58
  100. package/src/app/lib/components/ui/command/command-list.component.ts +5 -4
  101. package/src/app/lib/components/ui/command/command-separator.component.ts +2 -3
  102. package/src/app/lib/components/ui/command/command-shortcut.component.ts +2 -1
  103. package/src/app/lib/components/ui/command/command.component.ts +33 -22
  104. package/src/app/lib/components/ui/command/index.ts +0 -1
  105. package/src/app/lib/components/ui/context-menu/context-menu-checkbox-item.component.ts +20 -11
  106. package/src/app/lib/components/ui/context-menu/context-menu-content.component.ts +36 -43
  107. package/src/app/lib/components/ui/context-menu/context-menu-context.ts +1 -1
  108. package/src/app/lib/components/ui/context-menu/context-menu-item.component.ts +12 -13
  109. package/src/app/lib/components/ui/context-menu/context-menu-label.component.ts +2 -5
  110. package/src/app/lib/components/ui/context-menu/context-menu-radio-group.component.ts +9 -2
  111. package/src/app/lib/components/ui/context-menu/context-menu-radio-item.component.ts +14 -14
  112. package/src/app/lib/components/ui/context-menu/context-menu-separator.component.ts +2 -3
  113. package/src/app/lib/components/ui/context-menu/context-menu-shortcut.component.ts +2 -1
  114. package/src/app/lib/components/ui/context-menu/context-menu-sub-content.component.ts +5 -5
  115. package/src/app/lib/components/ui/context-menu/context-menu-sub-trigger.component.ts +8 -7
  116. package/src/app/lib/components/ui/context-menu/context-menu-sub.component.ts +9 -2
  117. package/src/app/lib/components/ui/context-menu/context-menu-trigger.component.ts +8 -7
  118. package/src/app/lib/components/ui/context-menu/context-menu.component.ts +1 -0
  119. package/src/app/lib/components/ui/context-menu/index.ts +15 -4
  120. package/src/app/lib/components/ui/data-table/data-table-content.component.ts +22 -28
  121. package/src/app/lib/components/ui/data-table/data-table-context.ts +1 -3
  122. package/src/app/lib/components/ui/data-table/data-table-pagination.component.ts +17 -27
  123. package/src/app/lib/components/ui/data-table/data-table-search.component.ts +6 -14
  124. package/src/app/lib/components/ui/data-table/data-table-toolbar.component.ts +3 -7
  125. package/src/app/lib/components/ui/data-table/data-table-view-options.component.ts +11 -20
  126. package/src/app/lib/components/ui/data-table/data-table.component.ts +41 -49
  127. package/src/app/lib/components/ui/data-table/index.ts +7 -8
  128. package/src/app/lib/components/ui/date-picker/date-picker.component.ts +24 -24
  129. package/src/app/lib/components/ui/dialog/dialog-close.component.ts +4 -8
  130. package/src/app/lib/components/ui/dialog/dialog-content.component.ts +72 -73
  131. package/src/app/lib/components/ui/dialog/dialog-context.ts +7 -5
  132. package/src/app/lib/components/ui/dialog/dialog-description.component.ts +5 -10
  133. package/src/app/lib/components/ui/dialog/dialog-footer.component.ts +3 -7
  134. package/src/app/lib/components/ui/dialog/dialog-header.component.ts +3 -7
  135. package/src/app/lib/components/ui/dialog/dialog-title.component.ts +5 -10
  136. package/src/app/lib/components/ui/dialog/dialog-trigger.component.ts +7 -11
  137. package/src/app/lib/components/ui/dialog/dialog.component.ts +29 -34
  138. package/src/app/lib/components/ui/dialog/index.ts +0 -1
  139. package/src/app/lib/components/ui/drawer/drawer-close.component.ts +4 -8
  140. package/src/app/lib/components/ui/drawer/drawer-content.component.ts +39 -35
  141. package/src/app/lib/components/ui/drawer/drawer-description.component.ts +5 -10
  142. package/src/app/lib/components/ui/drawer/drawer-footer.component.ts +3 -7
  143. package/src/app/lib/components/ui/drawer/drawer-header.component.ts +3 -7
  144. package/src/app/lib/components/ui/drawer/drawer-title.component.ts +5 -10
  145. package/src/app/lib/components/ui/drawer/drawer-trigger.component.ts +7 -11
  146. package/src/app/lib/components/ui/drawer/drawer.component.ts +25 -26
  147. package/src/app/lib/components/ui/drawer/index.ts +0 -1
  148. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.component.ts +20 -11
  149. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-content.component.ts +96 -61
  150. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-context.ts +1 -1
  151. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-group.component.ts +1 -0
  152. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-item.component.ts +10 -11
  153. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-label.component.ts +2 -5
  154. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.component.ts +14 -5
  155. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.component.ts +14 -14
  156. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-separator.component.ts +2 -3
  157. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.component.ts +2 -1
  158. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.component.ts +5 -5
  159. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.component.ts +8 -7
  160. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub.component.ts +9 -2
  161. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-trigger.component.ts +6 -5
  162. package/src/app/lib/components/ui/dropdown-menu/dropdown-menu.component.ts +1 -0
  163. package/src/app/lib/components/ui/dropdown-menu/index.ts +10 -3
  164. package/src/app/lib/components/ui/empty/empty-action.component.ts +2 -9
  165. package/src/app/lib/components/ui/empty/empty-description.component.ts +2 -10
  166. package/src/app/lib/components/ui/empty/empty-icon.component.ts +3 -8
  167. package/src/app/lib/components/ui/empty/empty-title.component.ts +2 -9
  168. package/src/app/lib/components/ui/empty/empty.component.ts +3 -8
  169. package/src/app/lib/components/ui/empty/index.ts +0 -1
  170. package/src/app/lib/components/ui/form/form-context.ts +1 -11
  171. package/src/app/lib/components/ui/form/form-control.component.ts +22 -22
  172. package/src/app/lib/components/ui/form/form-description.component.ts +4 -10
  173. package/src/app/lib/components/ui/form/form-field.component.ts +7 -10
  174. package/src/app/lib/components/ui/form/form-item.component.ts +2 -12
  175. package/src/app/lib/components/ui/form/form-label.component.ts +15 -15
  176. package/src/app/lib/components/ui/form/form-message.component.ts +7 -15
  177. package/src/app/lib/components/ui/form/form.component.ts +9 -20
  178. package/src/app/lib/components/ui/form/index.ts +4 -5
  179. package/src/app/lib/components/ui/hover-card/hover-card-content.component.ts +21 -33
  180. package/src/app/lib/components/ui/hover-card/hover-card-context.ts +0 -8
  181. package/src/app/lib/components/ui/hover-card/hover-card-trigger.component.ts +17 -26
  182. package/src/app/lib/components/ui/hover-card/hover-card.component.ts +18 -28
  183. package/src/app/lib/components/ui/hover-card/index.ts +9 -6
  184. package/src/app/lib/components/ui/input/input.component.ts +57 -75
  185. package/src/app/lib/components/ui/input-group/index.ts +0 -1
  186. package/src/app/lib/components/ui/input-group/input-group-addon.component.ts +4 -11
  187. package/src/app/lib/components/ui/input-group/input-group-input.component.ts +3 -8
  188. package/src/app/lib/components/ui/input-group/input-group.component.ts +4 -9
  189. package/src/app/lib/components/ui/input-otp/index.ts +4 -5
  190. package/src/app/lib/components/ui/input-otp/input-otp-context.ts +0 -8
  191. package/src/app/lib/components/ui/input-otp/input-otp-group.component.ts +2 -3
  192. package/src/app/lib/components/ui/input-otp/input-otp-separator.component.ts +4 -3
  193. package/src/app/lib/components/ui/input-otp/input-otp-slot.component.ts +8 -10
  194. package/src/app/lib/components/ui/input-otp/input-otp.component.ts +27 -45
  195. package/src/app/lib/components/ui/kbd/index.ts +0 -1
  196. package/src/app/lib/components/ui/kbd/kbd-variants.ts +1 -1
  197. package/src/app/lib/components/ui/kbd/kbd.component.ts +4 -8
  198. package/src/app/lib/components/ui/label/label.component.ts +15 -28
  199. package/src/app/lib/components/ui/menubar/index.ts +11 -8
  200. package/src/app/lib/components/ui/menubar/menubar-checkbox-item.component.ts +21 -12
  201. package/src/app/lib/components/ui/menubar/menubar-content.component.ts +46 -53
  202. package/src/app/lib/components/ui/menubar/menubar-context.ts +3 -9
  203. package/src/app/lib/components/ui/menubar/menubar-item.component.ts +13 -14
  204. package/src/app/lib/components/ui/menubar/menubar-label.component.ts +2 -5
  205. package/src/app/lib/components/ui/menubar/menubar-menu.component.ts +14 -2
  206. package/src/app/lib/components/ui/menubar/menubar-radio-group.component.ts +9 -2
  207. package/src/app/lib/components/ui/menubar/menubar-radio-item.component.ts +13 -13
  208. package/src/app/lib/components/ui/menubar/menubar-separator.component.ts +2 -3
  209. package/src/app/lib/components/ui/menubar/menubar-shortcut.component.ts +2 -1
  210. package/src/app/lib/components/ui/menubar/menubar-sub-content.component.ts +5 -5
  211. package/src/app/lib/components/ui/menubar/menubar-sub-trigger.component.ts +7 -6
  212. package/src/app/lib/components/ui/menubar/menubar-sub.component.ts +8 -1
  213. package/src/app/lib/components/ui/menubar/menubar-trigger.component.ts +26 -21
  214. package/src/app/lib/components/ui/menubar/menubar.component.ts +6 -13
  215. package/src/app/lib/components/ui/native-select/index.ts +1 -5
  216. package/src/app/lib/components/ui/native-select/native-select-variants.ts +1 -1
  217. package/src/app/lib/components/ui/native-select/native-select.component.ts +14 -15
  218. package/src/app/lib/components/ui/navigation-menu/index.ts +10 -8
  219. package/src/app/lib/components/ui/navigation-menu/navigation-menu-content.component.ts +18 -13
  220. package/src/app/lib/components/ui/navigation-menu/navigation-menu-context.ts +2 -10
  221. package/src/app/lib/components/ui/navigation-menu/navigation-menu-indicator.component.ts +3 -2
  222. package/src/app/lib/components/ui/navigation-menu/navigation-menu-item.component.ts +6 -1
  223. package/src/app/lib/components/ui/navigation-menu/navigation-menu-link.component.ts +3 -8
  224. package/src/app/lib/components/ui/navigation-menu/navigation-menu-list.component.ts +2 -4
  225. package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger-style.ts +1 -1
  226. package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger.component.ts +8 -7
  227. package/src/app/lib/components/ui/navigation-menu/navigation-menu-viewport.component.ts +3 -2
  228. package/src/app/lib/components/ui/navigation-menu/navigation-menu.component.ts +8 -15
  229. package/src/app/lib/components/ui/pagination/index.ts +0 -1
  230. package/src/app/lib/components/ui/pagination/pagination-content.component.ts +3 -7
  231. package/src/app/lib/components/ui/pagination/pagination-ellipsis.component.ts +3 -7
  232. package/src/app/lib/components/ui/pagination/pagination-item.component.ts +3 -9
  233. package/src/app/lib/components/ui/pagination/pagination-link.component.ts +4 -8
  234. package/src/app/lib/components/ui/pagination/pagination-next.component.ts +3 -11
  235. package/src/app/lib/components/ui/pagination/pagination-previous.component.ts +3 -11
  236. package/src/app/lib/components/ui/pagination/pagination.component.ts +3 -7
  237. package/src/app/lib/components/ui/popover/index.ts +9 -6
  238. package/src/app/lib/components/ui/popover/popover-anchor.component.ts +2 -13
  239. package/src/app/lib/components/ui/popover/popover-content.component.ts +119 -69
  240. package/src/app/lib/components/ui/popover/popover-context.ts +0 -8
  241. package/src/app/lib/components/ui/popover/popover-trigger.component.ts +22 -22
  242. package/src/app/lib/components/ui/popover/popover.component.ts +20 -33
  243. package/src/app/lib/components/ui/progress/index.ts +1 -6
  244. package/src/app/lib/components/ui/progress/progress.component.ts +15 -30
  245. package/src/app/lib/components/ui/radio-group/index.ts +1 -4
  246. package/src/app/lib/components/ui/radio-group/radio-group-context.ts +1 -7
  247. package/src/app/lib/components/ui/radio-group/radio-group-item.component.ts +36 -69
  248. package/src/app/lib/components/ui/radio-group/radio-group.component.ts +38 -67
  249. package/src/app/lib/components/ui/resizable/index.ts +0 -1
  250. package/src/app/lib/components/ui/resizable/resizable-handle.component.ts +25 -39
  251. package/src/app/lib/components/ui/resizable/resizable-panel-group.component.ts +15 -18
  252. package/src/app/lib/components/ui/resizable/resizable-panel.component.ts +12 -31
  253. package/src/app/lib/components/ui/scroll-area/index.ts +4 -5
  254. package/src/app/lib/components/ui/scroll-area/scroll-area.component.ts +5 -19
  255. package/src/app/lib/components/ui/scroll-area/scroll-bar.component.ts +8 -27
  256. package/src/app/lib/components/ui/segmented/index.ts +5 -9
  257. package/src/app/lib/components/ui/segmented/segmented-context.ts +1 -3
  258. package/src/app/lib/components/ui/segmented/segmented-item.component.ts +21 -29
  259. package/src/app/lib/components/ui/segmented/segmented-variants.ts +2 -2
  260. package/src/app/lib/components/ui/segmented/segmented.component.ts +24 -32
  261. package/src/app/lib/components/ui/select/index.ts +5 -6
  262. package/src/app/lib/components/ui/select/select-content.component.ts +34 -62
  263. package/src/app/lib/components/ui/select/select-context.ts +4 -14
  264. package/src/app/lib/components/ui/select/select-group.component.ts +6 -7
  265. package/src/app/lib/components/ui/select/select-item.component.ts +46 -55
  266. package/src/app/lib/components/ui/select/select-label.component.ts +2 -7
  267. package/src/app/lib/components/ui/select/select-separator.component.ts +3 -8
  268. package/src/app/lib/components/ui/select/select-trigger.component.ts +28 -25
  269. package/src/app/lib/components/ui/select/select-value.component.ts +7 -13
  270. package/src/app/lib/components/ui/select/select.component.ts +52 -64
  271. package/src/app/lib/components/ui/separator/index.ts +1 -6
  272. package/src/app/lib/components/ui/separator/separator.component.ts +4 -19
  273. package/src/app/lib/components/ui/sheet/index.ts +0 -1
  274. package/src/app/lib/components/ui/sheet/sheet-close.component.ts +4 -8
  275. package/src/app/lib/components/ui/sheet/sheet-content.component.ts +31 -36
  276. package/src/app/lib/components/ui/sheet/sheet-description.component.ts +5 -10
  277. package/src/app/lib/components/ui/sheet/sheet-footer.component.ts +3 -7
  278. package/src/app/lib/components/ui/sheet/sheet-header.component.ts +3 -7
  279. package/src/app/lib/components/ui/sheet/sheet-title.component.ts +5 -10
  280. package/src/app/lib/components/ui/sheet/sheet-trigger.component.ts +7 -11
  281. package/src/app/lib/components/ui/sheet/sheet-variants.ts +1 -1
  282. package/src/app/lib/components/ui/sheet/sheet.component.ts +36 -36
  283. package/src/app/lib/components/ui/sidebar/index.ts +14 -15
  284. package/src/app/lib/components/ui/sidebar/sidebar-content.component.ts +4 -8
  285. package/src/app/lib/components/ui/sidebar/sidebar-context.ts +1 -3
  286. package/src/app/lib/components/ui/sidebar/sidebar-footer.component.ts +3 -9
  287. package/src/app/lib/components/ui/sidebar/sidebar-group-action.component.ts +4 -8
  288. package/src/app/lib/components/ui/sidebar/sidebar-group-content.component.ts +3 -9
  289. package/src/app/lib/components/ui/sidebar/sidebar-group-label.component.ts +4 -8
  290. package/src/app/lib/components/ui/sidebar/sidebar-group.component.ts +3 -7
  291. package/src/app/lib/components/ui/sidebar/sidebar-header.component.ts +3 -9
  292. package/src/app/lib/components/ui/sidebar/sidebar-input.component.ts +4 -8
  293. package/src/app/lib/components/ui/sidebar/sidebar-inset.component.ts +4 -8
  294. package/src/app/lib/components/ui/sidebar/sidebar-menu-action.component.ts +4 -8
  295. package/src/app/lib/components/ui/sidebar/sidebar-menu-badge.component.ts +4 -8
  296. package/src/app/lib/components/ui/sidebar/sidebar-menu-button.component.ts +4 -9
  297. package/src/app/lib/components/ui/sidebar/sidebar-menu-item.component.ts +3 -9
  298. package/src/app/lib/components/ui/sidebar/sidebar-menu-skeleton.component.ts +6 -11
  299. package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-button.component.ts +4 -8
  300. package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-item.component.ts +2 -6
  301. package/src/app/lib/components/ui/sidebar/sidebar-menu-sub.component.ts +4 -8
  302. package/src/app/lib/components/ui/sidebar/sidebar-menu.component.ts +3 -7
  303. package/src/app/lib/components/ui/sidebar/sidebar-provider.component.ts +46 -52
  304. package/src/app/lib/components/ui/sidebar/sidebar-rail.component.ts +6 -11
  305. package/src/app/lib/components/ui/sidebar/sidebar-route-active.service.ts +17 -17
  306. package/src/app/lib/components/ui/sidebar/sidebar-separator.component.ts +3 -7
  307. package/src/app/lib/components/ui/sidebar/sidebar-trigger.component.ts +6 -11
  308. package/src/app/lib/components/ui/sidebar/sidebar.component.ts +20 -31
  309. package/src/app/lib/components/ui/skeleton/skeleton.component.ts +3 -8
  310. package/src/app/lib/components/ui/slider/index.ts +1 -6
  311. package/src/app/lib/components/ui/slider/slider.component.ts +73 -138
  312. package/src/app/lib/components/ui/spinner/index.ts +0 -1
  313. package/src/app/lib/components/ui/spinner/spinner-variants.ts +19 -22
  314. package/src/app/lib/components/ui/spinner/spinner.component.ts +4 -8
  315. package/src/app/lib/components/ui/switch/index.ts +1 -6
  316. package/src/app/lib/components/ui/switch/switch.component.ts +83 -108
  317. package/src/app/lib/components/ui/table/index.ts +0 -1
  318. package/src/app/lib/components/ui/table/table-body.component.ts +6 -10
  319. package/src/app/lib/components/ui/table/table-caption.component.ts +6 -8
  320. package/src/app/lib/components/ui/table/table-cell.component.ts +4 -8
  321. package/src/app/lib/components/ui/table/table-footer.component.ts +6 -8
  322. package/src/app/lib/components/ui/table/table-head.component.ts +4 -8
  323. package/src/app/lib/components/ui/table/table-header.component.ts +6 -10
  324. package/src/app/lib/components/ui/table/table-row.component.ts +6 -11
  325. package/src/app/lib/components/ui/table/table.component.ts +4 -8
  326. package/src/app/lib/components/ui/tabs/index.ts +14 -7
  327. package/src/app/lib/components/ui/tabs/tabs-content.component.ts +11 -36
  328. package/src/app/lib/components/ui/tabs/tabs-context.ts +0 -8
  329. package/src/app/lib/components/ui/tabs/tabs-list.component.ts +54 -60
  330. package/src/app/lib/components/ui/tabs/tabs-trigger.component.ts +20 -35
  331. package/src/app/lib/components/ui/tabs/tabs.component.ts +32 -49
  332. package/src/app/lib/components/ui/textarea/textarea.component.ts +3 -8
  333. package/src/app/lib/components/ui/toast/index.ts +6 -7
  334. package/src/app/lib/components/ui/toast/toast-action.component.ts +7 -18
  335. package/src/app/lib/components/ui/toast/toast-description.component.ts +2 -11
  336. package/src/app/lib/components/ui/toast/toast-title.component.ts +2 -9
  337. package/src/app/lib/components/ui/toast/toast-variants.ts +1 -1
  338. package/src/app/lib/components/ui/toast/toast.component.ts +18 -24
  339. package/src/app/lib/components/ui/toast/toast.service.ts +22 -37
  340. package/src/app/lib/components/ui/toast/toaster.component.ts +6 -16
  341. package/src/app/lib/components/ui/toggle/index.ts +1 -5
  342. package/src/app/lib/components/ui/toggle/toggle-variants.ts +2 -2
  343. package/src/app/lib/components/ui/toggle/toggle.component.ts +32 -51
  344. package/src/app/lib/components/ui/toggle-group/index.ts +1 -4
  345. package/src/app/lib/components/ui/toggle-group/toggle-group-context.ts +1 -7
  346. package/src/app/lib/components/ui/toggle-group/toggle-group-item.component.ts +38 -59
  347. package/src/app/lib/components/ui/toggle-group/toggle-group.component.ts +33 -51
  348. package/src/app/lib/components/ui/tooltip/index.ts +9 -6
  349. package/src/app/lib/components/ui/tooltip/tooltip-content.component.ts +6 -24
  350. package/src/app/lib/components/ui/tooltip/tooltip-context.ts +0 -8
  351. package/src/app/lib/components/ui/tooltip/tooltip-provider.component.ts +12 -24
  352. package/src/app/lib/components/ui/tooltip/tooltip-trigger.component.ts +4 -21
  353. package/src/app/lib/components/ui/tooltip/tooltip.component.ts +21 -33
  354. package/src/app/lib/components/ui/typography/index.ts +0 -1
  355. package/src/app/lib/components/ui/typography/typography-blockquote.component.ts +3 -7
  356. package/src/app/lib/components/ui/typography/typography-h1.component.ts +3 -10
  357. package/src/app/lib/components/ui/typography/typography-h2.component.ts +3 -10
  358. package/src/app/lib/components/ui/typography/typography-h3.component.ts +3 -7
  359. package/src/app/lib/components/ui/typography/typography-h4.component.ts +3 -7
  360. package/src/app/lib/components/ui/typography/typography-inline-code.component.ts +4 -8
  361. package/src/app/lib/components/ui/typography/typography-large.component.ts +3 -9
  362. package/src/app/lib/components/ui/typography/typography-lead.component.ts +3 -7
  363. package/src/app/lib/components/ui/typography/typography-list.component.ts +3 -7
  364. package/src/app/lib/components/ui/typography/typography-muted.component.ts +3 -7
  365. package/src/app/lib/components/ui/typography/typography-p.component.ts +3 -7
  366. package/src/app/lib/components/ui/typography/typography-small.component.ts +3 -7
  367. package/src/app/lib/utils/accessibility/click-outside.directive.ts +1 -8
  368. package/src/app/lib/utils/accessibility/focus-management.service.ts +4 -15
  369. package/src/app/lib/utils/accessibility/focus-trap.directive.ts +32 -106
  370. package/src/app/lib/utils/accessibility/index.ts +16 -5
  371. package/src/app/lib/utils/accessibility/keyboard-navigation.directive.ts +5 -8
  372. package/src/app/lib/utils/accessibility/live-region.directive.ts +10 -13
  373. package/src/app/lib/utils/accessibility/touch-target.directive.ts +1 -8
  374. package/src/app/lib/utils/animation/animation.utils.ts +4 -7
  375. package/src/app/lib/utils/animation/index.ts +15 -5
  376. package/src/app/lib/utils/animation/presence.component.ts +1 -1
  377. package/src/app/lib/utils/animation/presence.directive.ts +2 -2
  378. package/src/app/lib/utils/positioning/index.ts +40 -18
  379. package/src/app/lib/components/ui/index.ts +0 -551
  380. package/src/app/lib/index.ts +0 -7
@@ -1,13 +1,16 @@
1
1
  import { cn } from '@/lib/utils';
2
2
  import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';
3
- import { AlertCircle, AlertTriangle, CheckCircle, Info, LucideAngularModule, X } from 'lucide-angular';
3
+ import {
4
+ AlertCircle,
5
+ AlertTriangle,
6
+ CheckCircle,
7
+ Info,
8
+ LucideAngularModule,
9
+ X,
10
+ } from 'lucide-angular';
4
11
  import { toastVariants, type ToastVariants } from './toast-variants';
5
12
  import type { ToastType } from './toast.service';
6
13
 
7
- // ============================================================================
8
- // Types
9
- // ============================================================================
10
-
11
14
  /**
12
15
  * Toast visual state for animations
13
16
  */
@@ -35,10 +38,6 @@ export interface ToastProps {
35
38
  class?: string;
36
39
  }
37
40
 
38
- // ============================================================================
39
- // Component
40
- // ============================================================================
41
-
42
41
  /**
43
42
  * @component Toast
44
43
  *
@@ -134,32 +133,24 @@ export interface ToastProps {
134
133
  </div>
135
134
  `,
136
135
  host: {
136
+ 'attr.data-slot': '"toast"',
137
137
  class: 'contents',
138
138
  },
139
139
  changeDetection: ChangeDetectionStrategy.OnPush,
140
140
  })
141
141
  export class Toast {
142
- protected readonly XIcon = X;
143
- protected readonly CheckCircleIcon = CheckCircle;
144
- protected readonly AlertCircleIcon = AlertCircle;
145
- protected readonly AlertTriangleIcon = AlertTriangle;
146
- protected readonly InfoIcon = Info;
142
+ /** Event emitted when close button is clicked */
143
+ readonly onClose = output<void>();
147
144
 
148
145
  /** Visual variant of the toast */
149
146
  readonly variant = input<ToastType>('default');
150
-
151
147
  /** Whether to display the variant icon */
152
148
  readonly showIcon = input<boolean>(true);
153
-
154
149
  /** Whether the toast is visible (controls animation state) */
155
150
  readonly isVisible = input<boolean>(true);
156
-
157
151
  /** Additional CSS classes */
158
152
  readonly class = input<string>('');
159
153
 
160
- /** Event emitted when close button is clicked */
161
- readonly onClose = output<void>();
162
-
163
154
  protected readonly computedClass = computed(() => {
164
155
  const variantMap: Record<ToastType, ToastVariants['variant']> = {
165
156
  default: 'default',
@@ -169,9 +160,12 @@ export class Toast {
169
160
  info: 'info',
170
161
  };
171
162
 
172
- return cn(
173
- toastVariants({ variant: variantMap[this.variant()] }),
174
- this.class()
175
- );
163
+ return cn(toastVariants({ variant: variantMap[this.variant()] }), this.class());
176
164
  });
165
+
166
+ protected readonly XIcon = X;
167
+ protected readonly CheckCircleIcon = CheckCircle;
168
+ protected readonly AlertCircleIcon = AlertCircle;
169
+ protected readonly AlertTriangleIcon = AlertTriangle;
170
+ protected readonly InfoIcon = Info;
177
171
  }
@@ -1,9 +1,5 @@
1
1
  import { computed, Injectable, signal } from '@angular/core';
2
2
 
3
- // ============================================================================
4
- // Types
5
- // ============================================================================
6
-
7
3
  /**
8
4
  * Toast variant types for different notification styles
9
5
  */
@@ -68,10 +64,6 @@ export interface ToastOptions {
68
64
  onDismiss?: () => void;
69
65
  }
70
66
 
71
- // ============================================================================
72
- // Service
73
- // ============================================================================
74
-
75
67
  /**
76
68
  * @service ToastService
77
69
  *
@@ -96,7 +88,7 @@ export interface ToastOptions {
96
88
  * @example Basic usage
97
89
  * ```typescript
98
90
  * export class MyComponent {
99
- * private toast = inject(ToastService);
91
+ * private readonly _toast = inject(ToastService);
100
92
  *
101
93
  * showNotification() {
102
94
  * this.toast.success({
@@ -133,70 +125,63 @@ export interface ToastOptions {
133
125
  */
134
126
  @Injectable({ providedIn: 'root' })
135
127
  export class ToastService {
136
- private readonly _toasts = signal<Toast[]>([]);
137
-
138
128
  /** Reactive list of active toasts */
139
129
  readonly toasts = computed(() => this._toasts());
140
130
 
141
- private generateId(): string {
142
- return Math.random().toString(36).substring(2, 9);
143
- }
144
-
145
- private addToast(toast: Omit<Toast, 'id'>): string {
146
- const id = this.generateId();
147
- const newToast: Toast = { ...toast, id };
148
-
149
- this._toasts.update(toasts => [...toasts, newToast]);
150
-
151
- const duration = toast.duration ?? 4000;
152
- if (duration > 0) {
153
- setTimeout(() => this.dismiss(id), duration);
154
- }
155
-
156
- return id;
157
- }
131
+ private readonly _toasts = signal<Toast[]>([]);
158
132
 
159
133
  /** Show a default toast */
160
134
  toast(options: ToastOptions): string {
161
135
  return this.addToast({ ...options, type: 'default' });
162
136
  }
163
-
164
137
  /** Show a success toast */
165
138
  success(options: ToastOptions): string {
166
139
  return this.addToast({ ...options, type: 'success' });
167
140
  }
168
-
169
141
  /** Show an error toast */
170
142
  error(options: ToastOptions): string {
171
143
  return this.addToast({ ...options, type: 'error' });
172
144
  }
173
-
174
145
  /** Show a warning toast */
175
146
  warning(options: ToastOptions): string {
176
147
  return this.addToast({ ...options, type: 'warning' });
177
148
  }
178
-
179
149
  /** Show an info toast */
180
150
  info(options: ToastOptions): string {
181
151
  return this.addToast({ ...options, type: 'info' });
182
152
  }
183
-
184
153
  /** Dismiss a specific toast by ID */
185
154
  dismiss(id: string): void {
186
- const toast = this._toasts().find(t => t.id === id);
155
+ const toast = this._toasts().find((t) => t.id === id);
187
156
  if (toast?.onDismiss) {
188
157
  toast.onDismiss();
189
158
  }
190
- this._toasts.update(toasts => toasts.filter(t => t.id !== id));
159
+ this._toasts.update((toasts) => toasts.filter((t) => t.id !== id));
191
160
  }
192
-
193
161
  /** Dismiss all active toasts */
194
162
  dismissAll(): void {
195
- this._toasts().forEach(toast => {
163
+ this._toasts().forEach((toast) => {
196
164
  if (toast.onDismiss) {
197
165
  toast.onDismiss();
198
166
  }
199
167
  });
200
168
  this._toasts.set([]);
201
169
  }
170
+
171
+ private generateId(): string {
172
+ return Math.random().toString(36).substring(2, 9);
173
+ }
174
+ private addToast(toast: Omit<Toast, 'id'>): string {
175
+ const id = this.generateId();
176
+ const newToast: Toast = { ...toast, id };
177
+
178
+ this._toasts.update((toasts) => [...toasts, newToast]);
179
+
180
+ const duration = toast.duration ?? 4000;
181
+ if (duration > 0) {
182
+ setTimeout(() => this.dismiss(id), duration);
183
+ }
184
+
185
+ return id;
186
+ }
202
187
  }
@@ -6,10 +6,6 @@ import { ToastTitle } from './toast-title.component';
6
6
  import { Toast } from './toast.component';
7
7
  import { ToastService, type ToastPosition } from './toast.service';
8
8
 
9
- // ============================================================================
10
- // Types
11
- // ============================================================================
12
-
13
9
  /**
14
10
  * Props for the Toaster component
15
11
  */
@@ -21,10 +17,6 @@ export interface ToasterProps {
21
17
  class?: string;
22
18
  }
23
19
 
24
- // ============================================================================
25
- // Component
26
- // ============================================================================
27
-
28
20
  /**
29
21
  * @component Toaster
30
22
  *
@@ -75,10 +67,7 @@ export interface ToasterProps {
75
67
  aria-relevant="additions"
76
68
  >
77
69
  @for (toast of toastService.toasts(); track toast.id) {
78
- <Toast
79
- [variant]="toast.type"
80
- (onClose)="toastService.dismiss(toast.id)"
81
- >
70
+ <Toast [variant]="toast.type" (onClose)="toastService.dismiss(toast.id)">
82
71
  @if (toast.title) {
83
72
  <ToastTitle>{{ toast.title }}</ToastTitle>
84
73
  }
@@ -95,20 +84,21 @@ export interface ToasterProps {
95
84
  </div>
96
85
  `,
97
86
  host: {
87
+ 'attr.data-slot': '"toaster"',
98
88
  class: 'contents',
99
- 'ngSkipHydration': 'true',
89
+ ngSkipHydration: 'true',
100
90
  },
101
91
  changeDetection: ChangeDetectionStrategy.OnPush,
102
92
  })
103
93
  export class Toaster {
104
- protected readonly toastService = inject(ToastService);
105
-
106
94
  /** Position of the toast container */
107
95
  readonly position = input<ToastPosition>('bottom-right');
108
96
 
109
97
  /** Additional CSS classes */
110
98
  readonly class = input<string>('');
111
99
 
100
+ protected readonly toastService = inject(ToastService);
101
+
112
102
  protected readonly computedClass = computed(() => {
113
103
  const positionClasses: Record<ToastPosition, string> = {
114
104
  'top-left': 'top-0 left-0',
@@ -122,7 +112,7 @@ export class Toaster {
122
112
  return cn(
123
113
  'fixed z-[100] flex max-h-screen w-full flex-col-reverse gap-2 p-4 sm:flex-col md:max-w-[420px]',
124
114
  positionClasses[this.position()],
125
- this.class()
115
+ this.class(),
126
116
  );
127
117
  });
128
118
  }
@@ -1,6 +1,2 @@
1
1
  export { toggleVariants, type ToggleVariants } from './toggle-variants';
2
- export {
3
- Toggle,
4
- type ToggleProps,
5
- type ToggleState,
6
- } from './toggle.component';
2
+ export { Toggle, type ToggleProps, type ToggleState } from './toggle.component';
@@ -6,7 +6,7 @@ import { cva, type VariantProps } from 'class-variance-authority';
6
6
  * WCAG AA compliant contrast ratios for all variants
7
7
  */
8
8
  export const toggleVariants = cva(
9
- "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium text-foreground transition-colors hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
9
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium text-foreground transition-colors hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 [&_lucide-icon]:pointer-events-none [&_lucide-icon:not([class*='size-'])]:size-4 [&_lucide-icon]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
10
10
  {
11
11
  variants: {
12
12
  variant: {
@@ -24,7 +24,7 @@ export const toggleVariants = cva(
24
24
  variant: 'default',
25
25
  size: 'default',
26
26
  },
27
- }
27
+ },
28
28
  );
29
29
 
30
30
  export type ToggleVariants = VariantProps<typeof toggleVariants>;
@@ -1,20 +1,16 @@
1
1
  import { cn } from '@/lib/utils';
2
2
  import {
3
- ChangeDetectionStrategy,
4
- Component,
5
- computed,
6
- forwardRef,
7
- input,
8
- model,
9
- output,
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ computed,
6
+ forwardRef,
7
+ input,
8
+ model,
9
+ output,
10
10
  } from '@angular/core';
11
11
  import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
12
12
  import { toggleVariants, type ToggleVariants } from './toggle-variants';
13
13
 
14
- // ============================================================================
15
- // Types
16
- // ============================================================================
17
-
18
14
  export type ToggleState = 'on' | 'off';
19
15
 
20
16
  export type ToggleProps = {
@@ -32,10 +28,6 @@ export type ToggleProps = {
32
28
  class?: string;
33
29
  };
34
30
 
35
- // ============================================================================
36
- // Toggle Component
37
- // ============================================================================
38
-
39
31
  /**
40
32
  * Toggle component - a two-state button that can be on or off.
41
33
  * Based on Radix UI Toggle primitive with shadcn/ui styling.
@@ -120,41 +112,49 @@ export type ToggleProps = {
120
112
  changeDetection: ChangeDetectionStrategy.OnPush,
121
113
  })
122
114
  export class Toggle implements ControlValueAccessor {
115
+ constructor() {
116
+ // Initialize from defaultPressed if provided
117
+ if (this.defaultPressed()) {
118
+ this.pressed.set(true);
119
+ }
120
+ }
121
+
122
+ /** Emitted when pressed state changes */
123
+ readonly pressedChange = output<boolean>();
124
+
123
125
  /** Whether the toggle is pressed/on */
124
126
  readonly pressed = model<boolean>(false);
125
127
 
126
128
  /** Whether the toggle starts pressed (uncontrolled mode) */
127
129
  readonly defaultPressed = input<boolean>(false);
128
-
129
130
  /** The visual style variant of the toggle */
130
131
  readonly variant = input<ToggleVariants['variant']>('default');
131
-
132
132
  /** The size of the toggle */
133
133
  readonly size = input<ToggleVariants['size']>('default');
134
-
135
134
  /** Whether the toggle is disabled */
136
135
  readonly disabled = input<boolean>(false);
137
-
138
136
  /** Additional CSS classes to apply */
139
137
  readonly class = input<string>('');
140
138
 
141
- /** Emitted when pressed state changes */
142
- readonly pressedChange = output<boolean>();
139
+ /** Current state for data attribute */
140
+ protected readonly state = computed((): ToggleState => (this.pressed() ? 'on' : 'off'));
141
+ /** Computed class combining variants and custom classes */
142
+ protected readonly computedClass = computed(() =>
143
+ cn(
144
+ toggleVariants({
145
+ variant: this.variant(),
146
+ size: this.size(),
147
+ }),
148
+ this.class(),
149
+ ),
150
+ );
143
151
 
144
152
  /** ControlValueAccessor callbacks */
145
153
  private onChange: (value: boolean) => void = () => {};
146
154
  private onTouched: () => void = () => {};
147
-
148
- /** Current state for data attribute */
149
- protected readonly state = computed((): ToggleState =>
150
- this.pressed() ? 'on' : 'off'
151
- );
152
-
153
- constructor() {
154
- // Initialize from defaultPressed if provided
155
- if (this.defaultPressed()) {
156
- this.pressed.set(true);
157
- }
155
+ setDisabledState?(isDisabled: boolean): void {
156
+ // Disabled state is managed by the disabled input
157
+ // Angular forms will call this but we use the input binding
158
158
  }
159
159
 
160
160
  /** Toggle the pressed state */
@@ -167,33 +167,14 @@ export class Toggle implements ControlValueAccessor {
167
167
  this.pressedChange.emit(newValue);
168
168
  }
169
169
  }
170
-
171
170
  // ControlValueAccessor implementation
172
171
  writeValue(value: boolean): void {
173
172
  this.pressed.set(value ?? false);
174
173
  }
175
-
176
174
  registerOnChange(fn: (value: boolean) => void): void {
177
175
  this.onChange = fn;
178
176
  }
179
-
180
177
  registerOnTouched(fn: () => void): void {
181
178
  this.onTouched = fn;
182
179
  }
183
-
184
- setDisabledState?(isDisabled: boolean): void {
185
- // Disabled state is managed by the disabled input
186
- // Angular forms will call this but we use the input binding
187
- }
188
-
189
- /** Computed class combining variants and custom classes */
190
- protected readonly computedClass = computed(() =>
191
- cn(
192
- toggleVariants({
193
- variant: this.variant(),
194
- size: this.size(),
195
- }),
196
- this.class()
197
- )
198
- );
199
180
  }
@@ -4,8 +4,5 @@ export {
4
4
  type ToggleGroupOrientation,
5
5
  type ToggleGroupType,
6
6
  } from './toggle-group-context';
7
- export {
8
- ToggleGroupItem,
9
- type ToggleGroupItemProps,
10
- } from './toggle-group-item.component';
7
+ export { ToggleGroupItem, type ToggleGroupItemProps } from './toggle-group-item.component';
11
8
  export { ToggleGroup, type ToggleGroupProps } from './toggle-group.component';
@@ -1,10 +1,6 @@
1
1
  import { InjectionToken, WritableSignal } from '@angular/core';
2
2
  import type { ToggleVariants } from '../toggle/toggle-variants';
3
3
 
4
- // ============================================================================
5
- // Types
6
- // ============================================================================
7
-
8
4
  export type ToggleGroupType = 'single' | 'multiple';
9
5
  export type ToggleGroupOrientation = 'horizontal' | 'vertical';
10
6
 
@@ -43,6 +39,4 @@ export interface ToggleGroupContext {
43
39
  focusLast: () => void;
44
40
  }
45
41
 
46
- export const TOGGLE_GROUP_CONTEXT = new InjectionToken<ToggleGroupContext>(
47
- 'ToggleGroupContext'
48
- );
42
+ export const TOGGLE_GROUP_CONTEXT = new InjectionToken<ToggleGroupContext>('ToggleGroupContext');
@@ -1,20 +1,16 @@
1
1
  import { cn } from '@/lib/utils';
2
2
  import {
3
- ChangeDetectionStrategy,
4
- Component,
5
- computed,
6
- inject,
7
- input,
8
- OnDestroy,
9
- OnInit,
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ computed,
6
+ inject,
7
+ input,
8
+ OnDestroy,
9
+ OnInit,
10
10
  } from '@angular/core';
11
11
  import { toggleVariants, type ToggleVariants } from '../toggle/toggle-variants';
12
12
  import { TOGGLE_GROUP_CONTEXT } from './toggle-group-context';
13
13
 
14
- // ============================================================================
15
- // Types
16
- // ============================================================================
17
-
18
14
  export type ToggleGroupItemProps = {
19
15
  /** The unique value for this toggle item */
20
16
  value: string;
@@ -28,10 +24,6 @@ export type ToggleGroupItemProps = {
28
24
  class?: string;
29
25
  };
30
26
 
31
- // ============================================================================
32
- // ToggleGroupItem Component
33
- // ============================================================================
34
-
35
27
  /**
36
28
  * ToggleGroupItem component - individual toggle button within a group.
37
29
  * Based on Radix UI ToggleGroup.Item with shadcn/ui styling.
@@ -92,36 +84,30 @@ export type ToggleGroupItemProps = {
92
84
  changeDetection: ChangeDetectionStrategy.OnPush,
93
85
  })
94
86
  export class ToggleGroupItem implements OnInit, OnDestroy {
95
- private readonly context = inject(TOGGLE_GROUP_CONTEXT, { optional: true });
96
-
97
87
  /** The value of this toggle item */
98
88
  readonly value = input.required<string>();
99
89
 
100
90
  /** Override the variant from the group */
101
91
  readonly variant = input<ToggleVariants['variant']>();
102
-
103
92
  /** Override the size from the group */
104
93
  readonly size = input<ToggleVariants['size']>();
105
-
106
94
  /** Whether this toggle item is disabled */
107
95
  readonly disabled = input<boolean>(false);
108
-
109
96
  /** Additional CSS classes to apply */
110
97
  readonly class = input<string>('');
111
98
 
99
+ private readonly _context = inject(TOGGLE_GROUP_CONTEXT, { optional: true });
100
+
112
101
  /** Whether this item is pressed */
113
102
  protected readonly isPressed = computed(() => {
114
- return this.context?.isPressed(this.value()) ?? false;
103
+ return this._context?.isPressed(this.value()) ?? false;
115
104
  });
116
-
117
105
  /** State for data attribute */
118
106
  protected readonly state = computed(() => (this.isPressed() ? 'on' : 'off'));
119
-
120
107
  /** Whether this item is disabled */
121
108
  protected readonly isDisabled = computed(() => {
122
- return this.disabled() || this.context?.disabled() || false;
109
+ return this.disabled() || this._context?.disabled() || false;
123
110
  });
124
-
125
111
  /**
126
112
  * Roving tabindex pattern:
127
113
  * - If roving focus is enabled: first item or focused item is tabbable
@@ -129,13 +115,13 @@ export class ToggleGroupItem implements OnInit, OnDestroy {
129
115
  */
130
116
  protected readonly tabIndex = computed(() => {
131
117
  if (this.isDisabled()) return -1;
132
- if (!this.context) return 0;
118
+ if (!this._context) return 0;
133
119
 
134
- const rovingFocus = this.context.rovingFocus();
120
+ const rovingFocus = this._context.rovingFocus();
135
121
  if (!rovingFocus) return 0;
136
122
 
137
- const itemValues = this.context.itemValues();
138
- const focusedValue = this.context.focusedValue();
123
+ const itemValues = this._context.itemValues();
124
+ const focusedValue = this._context.focusedValue();
139
125
 
140
126
  // If an item is explicitly focused, only that item is tabbable
141
127
  if (focusedValue !== null) {
@@ -149,46 +135,50 @@ export class ToggleGroupItem implements OnInit, OnDestroy {
149
135
 
150
136
  return -1;
151
137
  });
152
-
153
138
  /** Get the effective variant */
154
139
  protected readonly effectiveVariant = computed(() => {
155
- return this.variant() ?? this.context?.variant() ?? 'default';
140
+ return this.variant() ?? this._context?.variant() ?? 'default';
156
141
  });
157
-
158
142
  /** Get the effective size */
159
143
  protected readonly effectiveSize = computed(() => {
160
- return this.size() ?? this.context?.size() ?? 'default';
144
+ return this.size() ?? this._context?.size() ?? 'default';
161
145
  });
146
+ /** Computed class combining variants and custom classes */
147
+ protected readonly computedClass = computed(() =>
148
+ cn(
149
+ toggleVariants({
150
+ variant: this.effectiveVariant(),
151
+ size: this.effectiveSize(),
152
+ }),
153
+ this.class(),
154
+ ),
155
+ );
162
156
 
163
157
  ngOnInit(): void {
164
158
  // Register this item with the group
165
- this.context?.itemValues.update((values) => {
159
+ this._context?.itemValues.update((values) => {
166
160
  if (!values.includes(this.value())) {
167
161
  return [...values, this.value()];
168
162
  }
169
163
  return values;
170
164
  });
171
165
  }
172
-
173
166
  ngOnDestroy(): void {
174
167
  // Unregister this item from the group
175
- this.context?.itemValues.update((values) =>
176
- values.filter((v) => v !== this.value())
177
- );
168
+ this._context?.itemValues.update((values) => values.filter((v) => v !== this.value()));
178
169
  }
179
170
 
180
171
  /** Toggle this item */
181
172
  toggle(): void {
182
173
  if (!this.isDisabled()) {
183
- this.context?.toggle(this.value());
174
+ this._context?.toggle(this.value());
184
175
  }
185
176
  }
186
-
187
177
  /** Handle keyboard navigation */
188
178
  onKeyDown(event: KeyboardEvent): void {
189
- if (this.isDisabled() || !this.context) return;
179
+ if (this.isDisabled() || !this._context) return;
190
180
 
191
- const orientation = this.context.orientation();
181
+ const orientation = this._context.orientation();
192
182
  const isVertical = orientation === 'vertical';
193
183
  const isHorizontal = orientation === 'horizontal';
194
184
 
@@ -196,46 +186,35 @@ export class ToggleGroupItem implements OnInit, OnDestroy {
196
186
  case 'ArrowDown':
197
187
  if (isVertical) {
198
188
  event.preventDefault();
199
- this.context.focusNext(this.value());
189
+ this._context.focusNext(this.value());
200
190
  }
201
191
  break;
202
192
  case 'ArrowUp':
203
193
  if (isVertical) {
204
194
  event.preventDefault();
205
- this.context.focusPrevious(this.value());
195
+ this._context.focusPrevious(this.value());
206
196
  }
207
197
  break;
208
198
  case 'ArrowRight':
209
199
  if (isHorizontal) {
210
200
  event.preventDefault();
211
- this.context.focusNext(this.value());
201
+ this._context.focusNext(this.value());
212
202
  }
213
203
  break;
214
204
  case 'ArrowLeft':
215
205
  if (isHorizontal) {
216
206
  event.preventDefault();
217
- this.context.focusPrevious(this.value());
207
+ this._context.focusPrevious(this.value());
218
208
  }
219
209
  break;
220
210
  case 'Home':
221
211
  event.preventDefault();
222
- this.context.focusFirst();
212
+ this._context.focusFirst();
223
213
  break;
224
214
  case 'End':
225
215
  event.preventDefault();
226
- this.context.focusLast();
216
+ this._context.focusLast();
227
217
  break;
228
218
  }
229
219
  }
230
-
231
- /** Computed class combining variants and custom classes */
232
- protected readonly computedClass = computed(() =>
233
- cn(
234
- toggleVariants({
235
- variant: this.effectiveVariant(),
236
- size: this.effectiveSize(),
237
- }),
238
- this.class()
239
- )
240
- );
241
220
  }