@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,11 +1,5 @@
1
1
  import { cn } from '@/lib/utils';
2
- import {
3
- ChangeDetectionStrategy,
4
- Component,
5
- computed,
6
- inject,
7
- input,
8
- } from '@angular/core';
2
+ import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
9
3
  import {
10
4
  SIDEBAR_CONTEXT,
11
5
  type SidebarCollapsible,
@@ -32,11 +26,7 @@ import {
32
26
  (click)="context.setOpenMobile(false)"
33
27
  aria-hidden="true"
34
28
  ></div>
35
- <aside
36
- [class]="computedMobileClass()"
37
- role="complementary"
38
- [attr.aria-label]="ariaLabel()"
39
- >
29
+ <aside [class]="computedMobileClass()" role="complementary" [attr.aria-label]="ariaLabel()">
40
30
  <nav [attr.aria-label]="navLabel()">
41
31
  <ng-content />
42
32
  </nav>
@@ -51,43 +41,45 @@ import {
51
41
  [attr.aria-label]="ariaLabel()"
52
42
  [attr.aria-hidden]="context.state() === 'collapsed' && collapsible() === 'offcanvas'"
53
43
  >
54
- <nav [attr.aria-label]="navLabel()" [attr.data-sidebar]="'sidebar'" [class]="computedInnerClass()">
44
+ <nav
45
+ [attr.aria-label]="navLabel()"
46
+ [attr.data-sidebar]="'sidebar'"
47
+ [class]="computedInnerClass()"
48
+ >
55
49
  <ng-content />
56
50
  </nav>
57
51
  </aside>
58
52
  }
59
53
  `,
60
54
  host: {
55
+ 'attr.data-slot': '"sidebar"',
61
56
  '[attr.data-state]': 'context.state()',
62
- '[attr.data-collapsible]':
63
- 'context.state() === "collapsed" ? collapsible() : ""',
57
+ '[attr.data-collapsible]': 'context.state() === "collapsed" ? collapsible() : ""',
64
58
  '[attr.data-variant]': 'variant()',
65
59
  '[attr.data-side]': 'side()',
66
- 'ngSkipHydration': 'true',
60
+ ngSkipHydration: 'true',
67
61
  },
68
62
  changeDetection: ChangeDetectionStrategy.OnPush,
69
63
  })
70
64
  export class Sidebar {
71
- protected readonly context = inject(SIDEBAR_CONTEXT);
72
-
73
65
  /** Side of the screen */
74
66
  readonly side = input<SidebarSide>('left');
75
67
 
76
68
  /** Variant style */
77
69
  readonly variant = input<SidebarVariant>('sidebar');
78
-
79
70
  /** Collapsible behavior */
80
71
  readonly collapsible = input<SidebarCollapsible>('offcanvas');
81
72
 
82
73
  /** Accessible label for the sidebar landmark */
83
74
  readonly ariaLabel = input<string>('Sidebar');
84
-
85
75
  /** Accessible label for the navigation within */
86
76
  readonly navLabel = input<string>('Main navigation');
87
77
 
88
78
  /** Additional CSS classes */
89
79
  readonly class = input<string>('');
90
80
 
81
+ protected readonly context = inject(SIDEBAR_CONTEXT);
82
+
91
83
  protected readonly computedGapClass = computed(() =>
92
84
  cn(
93
85
  'duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear',
@@ -95,10 +87,9 @@ export class Sidebar {
95
87
  'group-data-[side=right]/sidebar-wrapper:rotate-180',
96
88
  this.variant() === 'floating' || this.variant() === 'inset'
97
89
  ? 'group-data-[collapsible=icon]/sidebar-wrapper:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'
98
- : 'group-data-[collapsible=icon]/sidebar-wrapper:w-[--sidebar-width-icon]'
99
- )
90
+ : 'group-data-[collapsible=icon]/sidebar-wrapper:w-[--sidebar-width-icon]',
91
+ ),
100
92
  );
101
-
102
93
  protected readonly computedClass = computed(() =>
103
94
  cn(
104
95
  'duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex',
@@ -108,23 +99,21 @@ export class Sidebar {
108
99
  this.variant() === 'floating' || this.variant() === 'inset'
109
100
  ? 'p-2 group-data-[collapsible=icon]/sidebar-wrapper:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'
110
101
  : 'group-data-[collapsible=icon]/sidebar-wrapper:w-[--sidebar-width-icon] group-data-[side=left]/sidebar-wrapper:border-r group-data-[side=right]/sidebar-wrapper:border-l',
111
- this.class()
112
- )
102
+ this.class(),
103
+ ),
113
104
  );
114
-
115
105
  protected readonly computedInnerClass = computed(() =>
116
106
  cn(
117
- 'flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]/sidebar-wrapper:rounded-lg group-data-[variant=floating]/sidebar-wrapper:border group-data-[variant=floating]/sidebar-wrapper:border-sidebar-border group-data-[variant=floating]/sidebar-wrapper:shadow'
118
- )
107
+ 'flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]/sidebar-wrapper:rounded-lg group-data-[variant=floating]/sidebar-wrapper:border group-data-[variant=floating]/sidebar-wrapper:border-sidebar-border group-data-[variant=floating]/sidebar-wrapper:shadow',
108
+ ),
119
109
  );
120
-
121
110
  protected readonly computedMobileClass = computed(() =>
122
111
  cn(
123
112
  'fixed inset-y-0 z-50 flex h-full w-[--sidebar-width] flex-col bg-sidebar p-0 text-sidebar-foreground',
124
113
  this.side() === 'left'
125
114
  ? 'left-0 animate-in slide-in-from-left'
126
115
  : 'right-0 animate-in slide-in-from-right',
127
- this.class()
128
- )
116
+ this.class(),
117
+ ),
129
118
  );
130
119
  }
@@ -1,10 +1,5 @@
1
1
  import { cn } from '@/lib/utils';
2
- import {
3
- ChangeDetectionStrategy,
4
- Component,
5
- computed,
6
- input,
7
- } from '@angular/core';
2
+ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
8
3
 
9
4
  /**
10
5
  * Skeleton component that creates a loading placeholder.
@@ -33,7 +28,7 @@ import {
33
28
  '[class]': 'computedClass()',
34
29
  'aria-busy': 'true',
35
30
  '[attr.aria-label]': 'ariaLabel()',
36
- 'role': 'status',
31
+ role: 'status',
37
32
  'data-slot': 'skeleton',
38
33
  },
39
34
  changeDetection: ChangeDetectionStrategy.OnPush,
@@ -47,6 +42,6 @@ export class Skeleton {
47
42
 
48
43
  /** Computed class combining base styles and custom classes */
49
44
  protected readonly computedClass = computed(() =>
50
- cn('bg-accent animate-pulse rounded-md', this.class())
45
+ cn('bg-accent animate-pulse rounded-md', this.class()),
51
46
  );
52
47
  }
@@ -1,6 +1 @@
1
- export {
2
- Slider,
3
- type SliderOrientation,
4
- type SliderProps
5
- } from './slider.component';
6
-
1
+ export { Slider, type SliderOrientation, type SliderProps } from './slider.component';
@@ -1,22 +1,18 @@
1
1
  import { cn } from '@/lib/utils';
2
2
  import {
3
- ChangeDetectionStrategy,
4
- Component,
5
- computed,
6
- ElementRef,
7
- forwardRef,
8
- input,
9
- model,
10
- output,
11
- signal,
12
- viewChild,
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ computed,
6
+ ElementRef,
7
+ forwardRef,
8
+ input,
9
+ model,
10
+ output,
11
+ signal,
12
+ viewChild,
13
13
  } from '@angular/core';
14
14
  import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
15
15
 
16
- // ============================================================================
17
- // Types
18
- // ============================================================================
19
-
20
16
  export type SliderOrientation = 'horizontal' | 'vertical';
21
17
 
22
18
  export type SliderProps = {
@@ -44,10 +40,6 @@ export type SliderProps = {
44
40
  class?: string;
45
41
  };
46
42
 
47
- // ============================================================================
48
- // Slider Component
49
- // ============================================================================
50
-
51
43
  /**
52
44
  * Slider component for range selection.
53
45
  * Based on Radix UI Slider primitive with shadcn/ui styling.
@@ -152,12 +144,7 @@ export type SliderProps = {
152
144
  (blur)="onBlur()"
153
145
  ></span>
154
146
  @if (name()) {
155
- <input
156
- type="hidden"
157
- [attr.name]="name()"
158
- [value]="value()"
159
- [disabled]="isDisabled()"
160
- />
147
+ <input type="hidden" [attr.name]="name()" [value]="value()" [disabled]="isDisabled()" />
161
148
  }
162
149
  `,
163
150
  host: {
@@ -181,103 +168,72 @@ export class Slider implements ControlValueAccessor {
181
168
  private readonly thumb = viewChild<ElementRef<HTMLElement>>('thumb');
182
169
  private readonly elementRef = viewChild<ElementRef<HTMLElement>>('slider');
183
170
 
171
+ /** Emitted when value changes */
172
+ readonly valueChange = output<number>();
173
+ /** Emitted when value change is committed (on release) */
174
+ readonly valueCommit = output<number>();
175
+
184
176
  /** The current slider value */
185
177
  readonly value = model<number>(0);
186
178
 
187
179
  /** The default value for uncontrolled mode */
188
180
  readonly defaultValue = input<number>(0);
189
-
190
181
  /** The minimum value */
191
182
  readonly min = input<number>(0);
192
-
193
183
  /** The maximum value */
194
184
  readonly max = input<number>(100);
195
-
196
185
  /** The step increment */
197
186
  readonly step = input<number>(1);
198
-
199
187
  /** Whether the slider is disabled via input */
200
188
  readonly disabled = input<boolean>(false);
201
-
202
189
  /** The orientation of the slider */
203
190
  readonly orientation = input<SliderOrientation>('horizontal');
204
-
205
191
  /** Whether the direction is inverted */
206
192
  readonly inverted = input<boolean>(false);
207
-
208
193
  /** The name for form submission */
209
194
  readonly name = input<string>();
210
-
211
195
  /** Function to get value label for accessibility */
212
- readonly getAriaValueText = input<((value: number) => string) | undefined>(
213
- undefined
214
- );
215
-
196
+ readonly getAriaValueText = input<((value: number) => string) | undefined>(undefined);
216
197
  /** Additional CSS classes to apply */
217
198
  readonly class = input<string>('');
218
199
 
219
- /** Emitted when value changes */
220
- readonly valueChange = output<number>();
221
-
222
- /** Emitted when value change is committed (on release) */
223
- readonly valueCommit = output<number>();
224
-
225
- /** Whether the slider is disabled via forms */
226
- private readonly formsDisabled = signal<boolean>(false);
227
-
228
200
  /** Whether the slider is disabled (either via input or forms) */
229
- readonly isDisabled = computed(() => this.disabled() || this.formsDisabled());
230
-
201
+ readonly isDisabled = computed(() => this.disabled() || this.isFormsDisabled());
231
202
  /** Whether the slider is horizontal */
232
- protected readonly isHorizontal = computed(
233
- () => this.orientation() === 'horizontal'
234
- );
235
-
236
- /** ControlValueAccessor callbacks */
237
- private onChange: (value: number) => void = () => {};
238
- private onTouched: () => void = () => {};
239
-
203
+ protected readonly isHorizontal = computed(() => this.orientation() === 'horizontal');
240
204
  /** Calculate percentage position */
241
205
  protected readonly percentage = computed(() => {
242
- const val = this.value();
206
+ const currentValue = this.value();
243
207
  const minVal = this.min();
244
208
  const maxVal = this.max();
245
- const percent = ((val - minVal) / (maxVal - minVal)) * 100;
209
+ const percent = ((currentValue - minVal) / (maxVal - minVal)) * 100;
246
210
  return this.inverted() ? 100 - percent : percent;
247
211
  });
248
-
249
212
  /** Generate aria-valuetext */
250
213
  protected readonly computedAriaValueText = computed(() => {
251
214
  const fn = this.getAriaValueText();
252
215
  return fn ? fn(this.value()) : undefined;
253
216
  });
254
-
255
217
  /** Computed class combining base styles and custom classes */
256
218
  protected readonly computedClass = computed(() =>
257
219
  cn(
258
220
  'relative flex touch-none select-none items-center',
259
221
  this.isHorizontal() ? 'w-full' : 'flex-col h-full',
260
222
  this.isDisabled() && 'opacity-50 pointer-events-none',
261
- this.class()
262
- )
223
+ this.class(),
224
+ ),
263
225
  );
264
-
265
226
  /** Track class */
266
227
  protected readonly trackClass = computed(() =>
267
228
  cn(
268
229
  'bg-primary/20 relative overflow-hidden rounded-full',
269
- this.isHorizontal() ? 'h-1.5 w-full grow' : 'w-1.5 h-full grow'
270
- )
230
+ this.isHorizontal() ? 'h-1.5 w-full grow' : 'w-1.5 h-full grow',
231
+ ),
271
232
  );
272
-
273
233
  /** Range class */
274
234
  protected readonly rangeClass = computed(() =>
275
- cn(
276
- 'bg-primary absolute',
277
- this.isHorizontal() ? 'h-full' : 'w-full bottom-0'
278
- )
235
+ cn('bg-primary absolute', this.isHorizontal() ? 'h-full' : 'w-full bottom-0'),
279
236
  );
280
-
281
237
  /** Thumb class */
282
238
  protected readonly thumbClass = computed(() =>
283
239
  cn(
@@ -288,70 +244,34 @@ export class Slider implements ControlValueAccessor {
288
244
  'absolute cursor-grab active:cursor-grabbing',
289
245
  this.isHorizontal()
290
246
  ? 'size-4 top-1/2 -translate-x-1/2 -translate-y-1/2'
291
- : 'size-4 left-1/2 -translate-x-1/2 translate-y-1/2'
292
- )
247
+ : 'size-4 left-1/2 -translate-x-1/2 translate-y-1/2',
248
+ ),
293
249
  );
294
250
 
251
+ /** Whether the slider is disabled via forms */
252
+ private readonly isFormsDisabled = signal<boolean>(false);
253
+
254
+ /** ControlValueAccessor callbacks */
255
+ private onChange: (value: number) => void = () => {};
256
+ private onTouched: () => void = () => {};
257
+
295
258
  // ControlValueAccessor implementation
296
259
  writeValue(value: number): void {
297
260
  this.value.set(value ?? this.defaultValue());
298
261
  }
299
-
300
262
  registerOnChange(fn: (value: number) => void): void {
301
263
  this.onChange = fn;
302
264
  }
303
-
304
265
  registerOnTouched(fn: () => void): void {
305
266
  this.onTouched = fn;
306
267
  }
307
-
308
268
  setDisabledState(isDisabled: boolean): void {
309
- this.formsDisabled.set(isDisabled);
269
+ this.isFormsDisabled.set(isDisabled);
310
270
  }
311
-
312
271
  /** Handle blur for forms touched state */
313
272
  onBlur(): void {
314
273
  this.onTouched();
315
274
  }
316
-
317
- /** Clamp and step a value */
318
- private clampValue(rawValue: number): number {
319
- const stepValue = this.step();
320
- const steppedValue = Math.round(rawValue / stepValue) * stepValue;
321
- return Math.max(this.min(), Math.min(this.max(), steppedValue));
322
- }
323
-
324
- /** Update value from position */
325
- private updateValueFromPosition(
326
- clientPos: number,
327
- rect: DOMRect,
328
- isVertical: boolean
329
- ): void {
330
- if (this.isDisabled()) return;
331
-
332
- let percentage: number;
333
- if (isVertical) {
334
- percentage = 1 - (clientPos - rect.top) / rect.height;
335
- } else {
336
- percentage = (clientPos - rect.left) / rect.width;
337
- }
338
-
339
- if (this.inverted()) {
340
- percentage = 1 - percentage;
341
- }
342
-
343
- percentage = Math.max(0, Math.min(1, percentage));
344
- const range = this.max() - this.min();
345
- const rawValue = this.min() + percentage * range;
346
- const newValue = this.clampValue(rawValue);
347
-
348
- if (newValue !== this.value()) {
349
- this.value.set(newValue);
350
- this.onChange(newValue);
351
- this.valueChange.emit(newValue);
352
- }
353
- }
354
-
355
275
  /** Handle mouse down */
356
276
  onMouseDown(event: MouseEvent): void {
357
277
  if (this.isDisabled() || event.button !== 0) return;
@@ -361,21 +281,13 @@ export class Slider implements ControlValueAccessor {
361
281
  const rect = target.getBoundingClientRect();
362
282
  const isVertical = !this.isHorizontal();
363
283
 
364
- this.updateValueFromPosition(
365
- isVertical ? event.clientY : event.clientX,
366
- rect,
367
- isVertical
368
- );
284
+ this.updateValueFromPosition(isVertical ? event.clientY : event.clientX, rect, isVertical);
369
285
 
370
286
  // Focus the thumb
371
287
  this.thumb()?.nativeElement.focus();
372
288
 
373
289
  const onMouseMove = (e: MouseEvent) => {
374
- this.updateValueFromPosition(
375
- isVertical ? e.clientY : e.clientX,
376
- rect,
377
- isVertical
378
- );
290
+ this.updateValueFromPosition(isVertical ? e.clientY : e.clientX, rect, isVertical);
379
291
  };
380
292
 
381
293
  const onMouseUp = () => {
@@ -388,7 +300,6 @@ export class Slider implements ControlValueAccessor {
388
300
  document.addEventListener('mousemove', onMouseMove);
389
301
  document.addEventListener('mouseup', onMouseUp);
390
302
  }
391
-
392
303
  /** Handle touch start */
393
304
  onTouchStart(event: TouchEvent): void {
394
305
  if (this.isDisabled()) return;
@@ -398,19 +309,11 @@ export class Slider implements ControlValueAccessor {
398
309
  const touch = event.touches[0];
399
310
  const isVertical = !this.isHorizontal();
400
311
 
401
- this.updateValueFromPosition(
402
- isVertical ? touch.clientY : touch.clientX,
403
- rect,
404
- isVertical
405
- );
312
+ this.updateValueFromPosition(isVertical ? touch.clientY : touch.clientX, rect, isVertical);
406
313
 
407
314
  const onTouchMove = (e: TouchEvent) => {
408
315
  const touch = e.touches[0];
409
- this.updateValueFromPosition(
410
- isVertical ? touch.clientY : touch.clientX,
411
- rect,
412
- isVertical
413
- );
316
+ this.updateValueFromPosition(isVertical ? touch.clientY : touch.clientX, rect, isVertical);
414
317
  };
415
318
 
416
319
  const onTouchEnd = () => {
@@ -423,7 +326,6 @@ export class Slider implements ControlValueAccessor {
423
326
  document.addEventListener('touchmove', onTouchMove);
424
327
  document.addEventListener('touchend', onTouchEnd);
425
328
  }
426
-
427
329
  /** Handle keyboard navigation */
428
330
  onKeyDown(event: KeyboardEvent): void {
429
331
  if (this.isDisabled()) return;
@@ -474,4 +376,37 @@ export class Slider implements ControlValueAccessor {
474
376
  this.valueChange.emit(newValue);
475
377
  }
476
378
  }
379
+
380
+ /** Clamp and step a value */
381
+ private clampValue(rawValue: number): number {
382
+ const stepValue = this.step();
383
+ const steppedValue = Math.round(rawValue / stepValue) * stepValue;
384
+ return Math.max(this.min(), Math.min(this.max(), steppedValue));
385
+ }
386
+ /** Update value from position */
387
+ private updateValueFromPosition(clientPos: number, rect: DOMRect, isVertical: boolean): void {
388
+ if (this.isDisabled()) return;
389
+
390
+ let percentage: number;
391
+ if (isVertical) {
392
+ percentage = 1 - (clientPos - rect.top) / rect.height;
393
+ } else {
394
+ percentage = (clientPos - rect.left) / rect.width;
395
+ }
396
+
397
+ if (this.inverted()) {
398
+ percentage = 1 - percentage;
399
+ }
400
+
401
+ percentage = Math.max(0, Math.min(1, percentage));
402
+ const range = this.max() - this.min();
403
+ const rawValue = this.min() + percentage * range;
404
+ const newValue = this.clampValue(rawValue);
405
+
406
+ if (newValue !== this.value()) {
407
+ this.value.set(newValue);
408
+ this.onChange(newValue);
409
+ this.valueChange.emit(newValue);
410
+ }
411
+ }
477
412
  }
@@ -1,3 +1,2 @@
1
1
  export { spinnerVariants, type SpinnerVariants } from './spinner-variants';
2
2
  export { Spinner } from './spinner.component';
3
-
@@ -4,29 +4,26 @@ import { cva, type VariantProps } from 'class-variance-authority';
4
4
  * Spinner variants using class-variance-authority
5
5
  * Loading indicator animations with multiple sizes and variants
6
6
  */
7
- export const spinnerVariants = cva(
8
- 'animate-spin',
9
- {
10
- variants: {
11
- variant: {
12
- default: 'text-primary',
13
- secondary: 'text-secondary',
14
- muted: 'text-muted-foreground',
15
- destructive: 'text-destructive',
16
- },
17
- size: {
18
- xs: 'size-3',
19
- sm: 'size-4',
20
- default: 'size-6',
21
- lg: 'size-8',
22
- xl: 'size-12',
23
- },
7
+ export const spinnerVariants = cva('animate-spin', {
8
+ variants: {
9
+ variant: {
10
+ default: 'text-primary',
11
+ secondary: 'text-secondary',
12
+ muted: 'text-muted-foreground',
13
+ destructive: 'text-destructive',
24
14
  },
25
- defaultVariants: {
26
- variant: 'default',
27
- size: 'default',
15
+ size: {
16
+ xs: 'size-3',
17
+ sm: 'size-4',
18
+ default: 'size-6',
19
+ lg: 'size-8',
20
+ xl: 'size-12',
28
21
  },
29
- }
30
- );
22
+ },
23
+ defaultVariants: {
24
+ variant: 'default',
25
+ size: 'default',
26
+ },
27
+ });
31
28
 
32
29
  export type SpinnerVariants = VariantProps<typeof spinnerVariants>;
@@ -1,10 +1,5 @@
1
1
  import { cn } from '@/lib/utils';
2
- import {
3
- ChangeDetectionStrategy,
4
- Component,
5
- computed,
6
- input,
7
- } from '@angular/core';
2
+ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
8
3
  import { spinnerVariants, type SpinnerVariants } from './spinner-variants';
9
4
 
10
5
  /**
@@ -48,6 +43,7 @@ import { spinnerVariants, type SpinnerVariants } from './spinner-variants';
48
43
  </svg>
49
44
  `,
50
45
  host: {
46
+ 'attr.data-slot': '"spinner"',
51
47
  role: 'status',
52
48
  'aria-label': 'Loading',
53
49
  '[attr.aria-busy]': 'true',
@@ -71,7 +67,7 @@ export class Spinner {
71
67
  variant: this.variant(),
72
68
  size: this.size(),
73
69
  }),
74
- this.class()
75
- )
70
+ this.class(),
71
+ ),
76
72
  );
77
73
  }
@@ -1,6 +1 @@
1
- export {
2
- Switch,
3
- type SwitchProps,
4
- type SwitchState
5
- } from './switch.component';
6
-
1
+ export { Switch, type SwitchProps, type SwitchState } from './switch.component';