@tacdaed/fragments 1.0.0-beta.0 → 1.0.0-beta.1

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 (248) hide show
  1. package/README.md +1 -1
  2. package/ng-package.json +25 -0
  3. package/package.json +22 -29
  4. package/src/lib/components/accordion/accordion.component.html +103 -0
  5. package/src/lib/components/accordion/accordion.component.scss +382 -0
  6. package/src/lib/components/accordion/accordion.component.spec.ts +147 -0
  7. package/src/lib/components/accordion/accordion.component.ts +211 -0
  8. package/src/lib/components/accordion/accordion.type.ts +82 -0
  9. package/src/lib/components/breadcrumb/breadcrumb.component.html +43 -0
  10. package/src/lib/components/breadcrumb/breadcrumb.component.scss +112 -0
  11. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +33 -0
  12. package/src/lib/components/breadcrumb/breadcrumb.component.ts +103 -0
  13. package/src/lib/components/breadcrumb/breadcrumb.interface.ts +7 -0
  14. package/src/lib/components/button/button.component.html +57 -0
  15. package/src/lib/components/button/button.component.scss +445 -0
  16. package/src/lib/components/button/button.component.spec.ts +99 -0
  17. package/src/lib/components/button/button.component.ts +143 -0
  18. package/src/lib/components/button/button.type.ts +7 -0
  19. package/src/lib/components/card/card.component.html +44 -0
  20. package/src/lib/components/card/card.component.scss +114 -0
  21. package/src/lib/components/card/card.component.spec.ts +65 -0
  22. package/src/lib/components/card/card.component.ts +21 -0
  23. package/src/lib/components/card/card.type.ts +3 -0
  24. package/src/lib/components/code-block/code-block.component.html +55 -0
  25. package/src/lib/components/code-block/code-block.component.scss +122 -0
  26. package/src/lib/components/code-block/code-block.component.spec.ts +81 -0
  27. package/src/lib/components/code-block/code-block.component.ts +302 -0
  28. package/src/lib/components/code-block/code-block.interface.ts +28 -0
  29. package/src/lib/components/code-block/code-block.type.ts +73 -0
  30. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.html +14 -0
  31. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.scss +20 -0
  32. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.spec.ts +38 -0
  33. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.ts +181 -0
  34. package/src/lib/components/input/input-base.ts +187 -0
  35. package/src/lib/components/input/input-calendar/input-calendar.component.html +76 -0
  36. package/src/lib/components/input/input-calendar/input-calendar.component.scss +179 -0
  37. package/src/lib/components/input/input-calendar/input-calendar.component.spec.ts +44 -0
  38. package/src/lib/components/input/input-calendar/input-calendar.component.ts +299 -0
  39. package/src/lib/components/input/input-checkbox/input-checkbox.component.html +37 -0
  40. package/src/lib/components/input/input-checkbox/input-checkbox.component.scss +128 -0
  41. package/src/lib/components/input/input-checkbox/input-checkbox.component.spec.ts +43 -0
  42. package/src/lib/components/input/input-checkbox/input-checkbox.component.ts +112 -0
  43. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.html +43 -0
  44. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.scss +140 -0
  45. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.spec.ts +62 -0
  46. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.ts +136 -0
  47. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.html +81 -0
  48. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.scss +228 -0
  49. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.spec.ts +62 -0
  50. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.ts +178 -0
  51. package/src/lib/components/input/input-consts.ts +132 -0
  52. package/src/lib/components/input/input-date/input-date-validators.ts +41 -0
  53. package/src/lib/components/input/input-date/input-date.component.html +41 -0
  54. package/src/lib/components/input/input-date/input-date.component.scss +95 -0
  55. package/src/lib/components/input/input-date/input-date.component.spec.ts +43 -0
  56. package/src/lib/components/input/input-date/input-date.component.ts +359 -0
  57. package/src/lib/components/input/input-date-time/input-date-time.component.html +70 -0
  58. package/src/lib/components/input/input-date-time/input-date-time.component.scss +133 -0
  59. package/src/lib/components/input/input-date-time/input-date-time.component.spec.ts +36 -0
  60. package/src/lib/components/input/input-date-time/input-date-time.component.ts +387 -0
  61. package/src/lib/components/input/input-file-upload/input-file-upload.component.html +89 -0
  62. package/src/lib/components/input/input-file-upload/input-file-upload.component.scss +171 -0
  63. package/src/lib/components/input/input-file-upload/input-file-upload.component.spec.ts +43 -0
  64. package/src/lib/components/input/input-file-upload/input-file-upload.component.ts +351 -0
  65. package/src/lib/components/input/input-interface.ts +8 -0
  66. package/src/lib/components/input/input-number/input-number-validators.ts +0 -0
  67. package/src/lib/components/input/input-number/input-number.component.html +51 -0
  68. package/src/lib/components/input/input-number/input-number.component.scss +140 -0
  69. package/src/lib/components/input/input-number/input-number.component.spec.ts +44 -0
  70. package/src/lib/components/input/input-number/input-number.component.ts +343 -0
  71. package/src/lib/components/input/input-radio-group/input-radio-group.component.html +44 -0
  72. package/src/lib/components/input/input-radio-group/input-radio-group.component.scss +139 -0
  73. package/src/lib/components/input/input-radio-group/input-radio-group.component.spec.ts +58 -0
  74. package/src/lib/components/input/input-radio-group/input-radio-group.component.ts +132 -0
  75. package/src/lib/components/input/input-slider/input-slider.component.html +111 -0
  76. package/src/lib/components/input/input-slider/input-slider.component.scss +203 -0
  77. package/src/lib/components/input/input-slider/input-slider.component.spec.ts +46 -0
  78. package/src/lib/components/input/input-slider/input-slider.component.ts +410 -0
  79. package/src/lib/components/input/input-text/input-text-validators.ts +67 -0
  80. package/src/lib/components/input/input-text/input-text.component.html +71 -0
  81. package/src/lib/components/input/input-text/input-text.component.scss +118 -0
  82. package/src/lib/components/input/input-text/input-text.component.spec.ts +55 -0
  83. package/src/lib/components/input/input-text/input-text.component.ts +215 -0
  84. package/src/lib/components/input/input-time/input-time-validators.ts +42 -0
  85. package/src/lib/components/input/input-time/input-time.component.html +92 -0
  86. package/src/lib/components/input/input-time/input-time.component.scss +191 -0
  87. package/src/lib/components/input/input-time/input-time.component.spec.ts +39 -0
  88. package/src/lib/components/input/input-time/input-time.component.ts +691 -0
  89. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.html +36 -0
  90. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.scss +121 -0
  91. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.spec.ts +54 -0
  92. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.ts +117 -0
  93. package/src/lib/components/input/input-type.ts +18 -0
  94. package/src/lib/components/input/input-validation/input-validation.component.html +19 -0
  95. package/src/lib/components/input/input-validation/input-validation.component.scss +39 -0
  96. package/src/lib/components/input/input-validation/input-validation.component.spec.ts +45 -0
  97. package/src/lib/components/input/input-validation/input-validation.component.ts +13 -0
  98. package/src/lib/components/input/input.pipe.ts +14 -0
  99. package/src/lib/components/layout/container/container.component.html +1 -0
  100. package/src/lib/components/layout/container/container.component.scss +33 -0
  101. package/src/lib/components/layout/container/container.component.ts +32 -0
  102. package/src/lib/components/layout/container/container.type.ts +1 -0
  103. package/src/lib/components/layout/divider/divider.component.html +1 -0
  104. package/src/lib/components/layout/divider/divider.component.scss +60 -0
  105. package/src/lib/components/layout/divider/divider.component.ts +38 -0
  106. package/src/lib/components/layout/divider/divider.type.ts +2 -0
  107. package/src/lib/components/layout/section/section.component.html +21 -0
  108. package/src/lib/components/layout/section/section.component.scss +43 -0
  109. package/src/lib/components/layout/section/section.component.ts +33 -0
  110. package/src/lib/components/layout/section/section.type.ts +2 -0
  111. package/src/lib/components/layout/separator/separator.component.html +9 -0
  112. package/src/lib/components/layout/separator/separator.component.scss +52 -0
  113. package/src/lib/components/layout/separator/separator.component.ts +25 -0
  114. package/src/lib/components/layout/separator/separator.type.ts +1 -0
  115. package/src/lib/components/loader/content-blur/content-blur.component.html +13 -0
  116. package/src/lib/components/loader/content-blur/content-blur.component.scss +43 -0
  117. package/src/lib/components/loader/content-blur/content-blur.component.spec.ts +42 -0
  118. package/src/lib/components/loader/content-blur/content-blur.component.ts +34 -0
  119. package/src/lib/components/loader/loader.type.ts +2 -0
  120. package/src/lib/components/loader/progress-bar/progress-bar.component.html +26 -0
  121. package/src/lib/components/loader/progress-bar/progress-bar.component.scss +151 -0
  122. package/src/lib/components/loader/progress-bar/progress-bar.component.spec.ts +47 -0
  123. package/src/lib/components/loader/progress-bar/progress-bar.component.ts +28 -0
  124. package/src/lib/components/loader/progress-bar/progress-bar.type.ts +8 -0
  125. package/src/lib/components/loader/pulse-loader/pulse-loader.component.html +12 -0
  126. package/src/lib/components/loader/pulse-loader/pulse-loader.component.scss +202 -0
  127. package/src/lib/components/loader/pulse-loader/pulse-loader.component.spec.ts +55 -0
  128. package/src/lib/components/loader/pulse-loader/pulse-loader.component.ts +73 -0
  129. package/src/lib/components/loader/pulse-loader/pulse-loader.type.ts +6 -0
  130. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.html +13 -0
  131. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.scss +113 -0
  132. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.spec.ts +37 -0
  133. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.ts +51 -0
  134. package/src/lib/components/loader/skeleton-loader/skeleton-loader.type.ts +6 -0
  135. package/src/lib/components/loader/spinner/spinner.component.html +20 -0
  136. package/src/lib/components/loader/spinner/spinner.component.scss +137 -0
  137. package/src/lib/components/loader/spinner/spinner.component.spec.ts +43 -0
  138. package/src/lib/components/loader/spinner/spinner.component.ts +32 -0
  139. package/src/lib/components/loader/spinner/spinner.type.ts +6 -0
  140. package/src/lib/components/modal/modal.component.html +47 -0
  141. package/src/lib/components/modal/modal.component.scss +139 -0
  142. package/src/lib/components/modal/modal.component.spec.ts +60 -0
  143. package/src/lib/components/modal/modal.component.ts +83 -0
  144. package/src/lib/components/modal/modal.type.ts +9 -0
  145. package/src/lib/components/morph/blob-moph/blob-moprh.component.spec.ts +79 -0
  146. package/src/lib/components/morph/blob-moph/blob-moprh.component.ts +96 -0
  147. package/src/lib/components/morph/blob-moph/blob-morph.component.html +34 -0
  148. package/src/lib/components/morph/blob-moph/blob-morph.component.scss +7 -0
  149. package/src/lib/components/morph/morph.abstract.ts +13 -0
  150. package/src/lib/components/pagination/pagination.interface.ts +4 -0
  151. package/src/lib/components/pagination/small-pagination/small-pagination.component.html +61 -0
  152. package/src/lib/components/pagination/small-pagination/small-pagination.component.scss +187 -0
  153. package/src/lib/components/pagination/small-pagination/small-pagination.component.spec.ts +88 -0
  154. package/src/lib/components/pagination/small-pagination/small-pagination.component.ts +177 -0
  155. package/src/lib/components/selection-lists/multi-select/multi-select.component.html +170 -0
  156. package/src/lib/components/selection-lists/multi-select/multi-select.component.scss +312 -0
  157. package/src/lib/components/selection-lists/multi-select/multi-select.component.spec.ts +61 -0
  158. package/src/lib/components/selection-lists/multi-select/multi-select.component.ts +372 -0
  159. package/src/lib/components/selection-lists/selection-list/selection-list.component.html +125 -0
  160. package/src/lib/components/selection-lists/selection-list/selection-list.component.scss +267 -0
  161. package/src/lib/components/selection-lists/selection-list/selection-list.component.spec.ts +66 -0
  162. package/src/lib/components/selection-lists/selection-list/selection-list.component.ts +315 -0
  163. package/src/lib/components/selection-lists/selection-lists-base.ts +35 -0
  164. package/src/lib/components/selection-lists/selection-lists-const.ts +17 -0
  165. package/src/lib/components/selection-lists/selection-lists-interface.ts +7 -0
  166. package/src/lib/components/selection-lists/selection-lists.type.ts +1 -0
  167. package/src/lib/components/side-nav/side-nav.component.html +101 -0
  168. package/src/lib/components/side-nav/side-nav.component.scss +295 -0
  169. package/src/lib/components/side-nav/side-nav.component.spec.ts +0 -0
  170. package/src/lib/components/side-nav/side-nav.component.ts +18 -0
  171. package/src/lib/components/side-nav/side-nav.type.ts +28 -0
  172. package/src/lib/components/snackbar/snackbar.component.html +33 -0
  173. package/src/lib/components/snackbar/snackbar.component.scss +195 -0
  174. package/src/lib/components/snackbar/snackbar.component.ts +112 -0
  175. package/src/lib/components/snackbar/snackbar.type.ts +27 -0
  176. package/src/lib/components/status/chip/chip.component.html +51 -0
  177. package/src/lib/components/status/chip/chip.component.scss +149 -0
  178. package/src/lib/components/status/chip/chip.component.spec.ts +62 -0
  179. package/src/lib/components/status/chip/chip.component.ts +83 -0
  180. package/src/lib/components/status/chip/chip.type.ts +42 -0
  181. package/src/lib/components/status/directives/badge/badge.directive.spec.ts +60 -0
  182. package/src/lib/components/status/directives/badge/badge.directive.ts +190 -0
  183. package/src/lib/components/status/directives/badge/badge.interface.ts +19 -0
  184. package/src/lib/components/status/pill/pill.component.html +40 -0
  185. package/src/lib/components/status/pill/pill.component.scss +113 -0
  186. package/src/lib/components/status/pill/pill.component.spec.ts +47 -0
  187. package/src/lib/components/status/pill/pill.component.ts +83 -0
  188. package/src/lib/components/status/pill/pill.type.ts +42 -0
  189. package/src/lib/components/status/status.interface.ts +57 -0
  190. package/src/lib/components/status/status.type.ts +62 -0
  191. package/src/lib/components/status/tag/tag.component.html +39 -0
  192. package/src/lib/components/status/tag/tag.component.scss +140 -0
  193. package/src/lib/components/status/tag/tag.component.spec.ts +47 -0
  194. package/src/lib/components/status/tag/tag.component.ts +83 -0
  195. package/src/lib/components/status/tag/tag.type.ts +42 -0
  196. package/src/lib/components/stepper/stepper.component.html +83 -0
  197. package/src/lib/components/stepper/stepper.component.scss +196 -0
  198. package/src/lib/components/stepper/stepper.component.ts +482 -0
  199. package/src/lib/components/stepper/stepper.type.ts +60 -0
  200. package/src/lib/components/table/table.component.html +438 -0
  201. package/src/lib/components/table/table.component.scss +259 -0
  202. package/src/lib/components/table/table.component.spec.ts +117 -0
  203. package/src/lib/components/table/table.component.ts +215 -0
  204. package/src/lib/components/table/table.enum.ts +4 -0
  205. package/src/lib/components/table/table.function.ts +47 -0
  206. package/src/lib/components/table/table.interface.ts +143 -0
  207. package/src/lib/components/table/table.pipe.ts +62 -0
  208. package/src/lib/components/table/table.type.ts +15 -0
  209. package/src/lib/components/tabs/tabs.component.html +88 -0
  210. package/src/lib/components/tabs/tabs.component.scss +305 -0
  211. package/src/lib/components/tabs/tabs.component.spec.ts +94 -0
  212. package/src/lib/components/tabs/tabs.component.ts +282 -0
  213. package/src/lib/components/tabs/tabs.type.ts +81 -0
  214. package/src/lib/components/title-bar/title-bar.component.html +21 -0
  215. package/src/lib/components/title-bar/title-bar.component.scss +139 -0
  216. package/src/lib/components/title-bar/title-bar.component.spec.ts +44 -0
  217. package/src/lib/components/title-bar/title-bar.component.ts +13 -0
  218. package/src/lib/components/toast/toast.component.html +36 -0
  219. package/src/lib/components/toast/toast.component.scss +241 -0
  220. package/src/lib/components/toast/toast.component.ts +165 -0
  221. package/src/lib/components/toast/toast.type.ts +37 -0
  222. package/src/lib/components/toast-stack/toast-stack.component.html +30 -0
  223. package/src/lib/components/toast-stack/toast-stack.component.scss +35 -0
  224. package/src/lib/components/toast-stack/toast-stack.component.ts +51 -0
  225. package/src/lib/consts/country-prefix.ts +244 -0
  226. package/src/lib/directives/tooltip/popover.directive.ts +274 -0
  227. package/src/lib/directives/tooltip/tooltip.directive.spec.ts +86 -0
  228. package/src/lib/directives/tooltip/tooltip.directive.ts +234 -0
  229. package/src/lib/directives/tooltip/tooltip.interface.ts +29 -0
  230. package/src/lib/directives/tooltip/tooltip.type.ts +9 -0
  231. package/src/lib/interfaces/common.interfaces.ts +4 -0
  232. package/src/lib/pipes/chunk.pipe.ts +16 -0
  233. package/src/lib/pipes/safe-html.pipe.ts +14 -0
  234. package/src/lib/pipes/sanitize-html.pipe.ts +23 -0
  235. package/src/lib/types/base.types.ts +23 -0
  236. package/src/lib/types/common.types.ts +98 -0
  237. package/src/lib/types/form.types.ts +5 -0
  238. package/src/lib/utils/common.utils.ts +53 -0
  239. package/src/lib/utils/date.utils.ts +474 -0
  240. package/src/lib/utils/number.utils.ts +16 -0
  241. package/src/lib/utils/uuid.utils.ts +39 -0
  242. package/src/public-api.ts +114 -0
  243. package/tsconfig.lib.json +17 -0
  244. package/tsconfig.lib.prod.json +10 -0
  245. package/tsconfig.spec.json +9 -0
  246. package/fesm2022/fragments.mjs +0 -8928
  247. package/fesm2022/fragments.mjs.map +0 -1
  248. package/index.d.ts +0 -3929
@@ -0,0 +1,103 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, inject, Input, OnDestroy, OnInit } from '@angular/core';
3
+ import { ActivatedRoute, NavigationEnd, Router, RouterLink } from '@angular/router';
4
+ import { filter, Subject, takeUntil } from 'rxjs';
5
+ import { BreadcrumbItem } from './breadcrumb.interface';
6
+ import { TBaseStyle } from '../../types/base.types';
7
+
8
+ @Component({
9
+ selector: 'frg-breadcrumb',
10
+ imports: [CommonModule, RouterLink],
11
+ templateUrl: './breadcrumb.component.html',
12
+ styleUrl: './breadcrumb.component.scss',
13
+ })
14
+ export class BreadcrumbComponent implements OnInit, OnDestroy {
15
+ private readonly router: Router = inject(Router);
16
+ private readonly activatedRoute: ActivatedRoute = inject(ActivatedRoute);
17
+ /**
18
+ * Breadcrumb items to render.
19
+ */
20
+ @Input() items: BreadcrumbItem[] = [];
21
+ /**
22
+ * Build breadcrumbs automatically from the current route tree.
23
+ */
24
+ @Input() auto: boolean = false;
25
+ /**
26
+ * Separator displayed between breadcrumb items.
27
+ */
28
+ @Input() separator: string = '/';
29
+ /**
30
+ * Color theme for breadcrumb text.
31
+ */
32
+ @Input() styleType: TBaseStyle = 'default';
33
+
34
+ protected autoItems: BreadcrumbItem[] = [];
35
+ private readonly destroy$ = new Subject<void>();
36
+
37
+ public ngOnInit(): void {
38
+ if (this.auto) {
39
+ this.buildAutoItems();
40
+ this.router.events
41
+ .pipe(filter(event => event instanceof NavigationEnd), takeUntil(this.destroy$))
42
+ .subscribe(() => this.buildAutoItems());
43
+ }
44
+ }
45
+
46
+ public ngOnDestroy(): void {
47
+ this.destroy$.next();
48
+ this.destroy$.complete();
49
+ }
50
+
51
+ public get breadcrumbItems(): BreadcrumbItem[] {
52
+ const items = this.auto ? this.autoItems : this.items;
53
+ if (!items.length) return [];
54
+
55
+ return items.map((item, index) => ({
56
+ ...item,
57
+ isActive: item.isActive ?? index === items.length - 1
58
+ }));
59
+ }
60
+
61
+ private buildAutoItems(): void {
62
+ const items: BreadcrumbItem[] = [];
63
+ let url = '';
64
+ let route: ActivatedRoute | null = this.activatedRoute.root;
65
+
66
+ while (route?.firstChild) {
67
+ route = route.firstChild;
68
+ const config = route.routeConfig;
69
+ if (!config?.path || config.path === '**') {
70
+ continue;
71
+ }
72
+
73
+ const segments = route.snapshot.url.map(segment => segment.path).filter(Boolean);
74
+ if (!segments.length) {
75
+ continue;
76
+ }
77
+
78
+ const label = this.resolveLabel(route, segments);
79
+ url += `/${segments.join('/')}`;
80
+
81
+ items.push({
82
+ label,
83
+ url,
84
+ iconClass: route.snapshot.data?.['breadcrumbIcon']
85
+ });
86
+ }
87
+
88
+ this.autoItems = items;
89
+ }
90
+
91
+ private resolveLabel(route: ActivatedRoute, segments: string[]): string {
92
+ const dataLabel = route.snapshot.data?.['breadcrumb'];
93
+ if (typeof dataLabel === 'string' && dataLabel.trim().length) {
94
+ return dataLabel;
95
+ }
96
+
97
+ const fallback = segments.join(' ');
98
+ return fallback
99
+ .split('-')
100
+ .map(part => part.charAt(0).toUpperCase() + part.slice(1))
101
+ .join(' ');
102
+ }
103
+ }
@@ -0,0 +1,7 @@
1
+ export interface BreadcrumbItem {
2
+ label: string;
3
+ url?: string | (string | number)[];
4
+ iconClass?: string;
5
+ ariaLabel?: string;
6
+ isActive?: boolean;
7
+ }
@@ -0,0 +1,57 @@
1
+ <button
2
+ class="frg-btn"
3
+ [id]="id"
4
+ [class]="class"
5
+ [attr.aria-label]="ariaLabel || null"
6
+ [attr.disabled]="disabled ? true : null"
7
+ [attr.type]="type"
8
+ [routerLink]="buttonRouterLink"
9
+ [routerLinkActive]="buttonRouterLinkActive"
10
+ [ngClass]="{
11
+ 'frg-btn__ghost': styleType === 'ghost',
12
+ 'frg-btn__icon': styleType === 'icon',
13
+ 'frg-btn__primary': styleType === 'primary',
14
+ 'frg-btn__secondary': styleType === 'secondary',
15
+ 'frg-btn__tertiary': styleType === 'tertiary',
16
+ 'frg-btn__neutral': styleType === 'neutral',
17
+ 'frg-btn__dark': styleType === 'dark',
18
+ 'frg-btn__light': styleType === 'light',
19
+ 'frg-btn__info': styleType === 'info',
20
+ 'frg-btn__success': styleType === 'success',
21
+ 'frg-btn__warning': styleType === 'warning',
22
+ 'frg-btn__danger': styleType === 'danger',
23
+ 'frg-btn__outline-primary': styleType === 'outline-primary',
24
+ 'frg-btn__outline-secondary': styleType === 'outline-secondary',
25
+ 'frg-btn__outline-tertiary': styleType === 'outline-tertiary',
26
+ 'frg-btn__outline-dark': styleType === 'outline-dark',
27
+ 'frg-btn__outline-light': styleType === 'outline-light',
28
+ 'frg-btn__outline-info': styleType === 'outline-info',
29
+ 'frg-btn__outline-success': styleType === 'outline-success',
30
+ 'frg-btn__outline-warning': styleType === 'outline-warning',
31
+ 'frg-btn__outline-danger': styleType === 'outline-danger',
32
+ 'frg-btn--pill': shape === 'pill',
33
+ 'frg-btn--small': size === 'small',
34
+ 'frg-btn--medium': size === 'medium',
35
+ 'frg-btn--large': size === 'large'
36
+ }"
37
+ (click)="onClick()"
38
+ >
39
+ <div
40
+ class="d-flex justify-content-center align-items-center"
41
+ [ngClass]="containerNgClass"
42
+ >
43
+ @if(text){
44
+ <span
45
+ [class]="textClass"
46
+ >
47
+ {{text}}
48
+ </span>
49
+ }
50
+ @if(iconClass){
51
+ <span
52
+ [class]="iconClass"
53
+ [ngClass]="iconClassMap"
54
+ ></span>
55
+ }
56
+ </div>
57
+ </button>
@@ -0,0 +1,445 @@
1
+ @use "sass:color";
2
+ @use './../../../../assets/styles/scss/variables' as *;
3
+
4
+ :host {
5
+ display: inline-block;
6
+
7
+ button {
8
+ appearance: none;
9
+ -webkit-appearance: none;
10
+ -moz-appearance: none;
11
+ border: none;
12
+ margin: 0;
13
+ padding: 0;
14
+ background: none;
15
+ color: inherit;
16
+ font: inherit;
17
+ cursor: pointer;
18
+ outline: none;
19
+ }
20
+
21
+ .frg-btn {
22
+ padding: .25rem 1rem;
23
+ min-height: 2.5rem;
24
+ line-height: 1;
25
+ margin: .5rem;
26
+ font-family: $base-font;
27
+ font-size: 1rem;
28
+ font-weight: 500;
29
+ border: 2px solid transparent;
30
+ box-shadow: 2px 2px 5px rgba($color-dark-soft, 0.4);
31
+ border-radius: 5px;
32
+ transition: all 0.15s ease-in-out;
33
+
34
+ &--small {
35
+ font-size: 0.875rem;
36
+ padding: 0 .75rem;
37
+ min-height: 2rem;
38
+ .frg-btn__icon-pill {
39
+ width: 1rem;
40
+ height: 1rem;
41
+ font-size: 0.5rem;
42
+ }
43
+ }
44
+
45
+ &--large {
46
+ font-size: 1.125rem;
47
+ padding: 0 1.25rem;
48
+ min-height: 3rem;
49
+ .frg-btn__icon-pill {
50
+ width: 1.8rem;
51
+ height: 1.8rem;
52
+ font-size: 1rem;
53
+ }
54
+ }
55
+
56
+ &--pill {
57
+ border-radius: 999px;
58
+ padding-left: 1.1rem;
59
+ padding-right: 1.1rem;
60
+ }
61
+
62
+ &:hover {
63
+ box-shadow: 0 1px 2px rgba($color-dark, 0.2);
64
+ transform: translateY(1px);
65
+ cursor: pointer;
66
+ }
67
+
68
+ &:focus-visible {
69
+ outline-offset: 5px;
70
+ }
71
+
72
+ &[disabled='true'] {
73
+ border-color: $color-disabled;
74
+ background-color: $color-disabled !important;
75
+ color: $color-dark-soft !important;
76
+ opacity: 0.6;
77
+ pointer-events: none;
78
+ }
79
+
80
+ &__ghost {
81
+ box-shadow: none;
82
+ color: $color-dark;
83
+ background-color: transparent;
84
+ }
85
+
86
+ &__ghost:hover {
87
+ text-decoration: underline;
88
+ box-shadow: none;
89
+ cursor: pointer;
90
+ }
91
+
92
+ &__icon {
93
+ margin: 0;
94
+ padding: 0;
95
+ min-height: auto;
96
+ border: none;
97
+ box-shadow: none;
98
+ background-color: transparent;
99
+ color: $color-dark-neutral;
100
+
101
+ span {
102
+ transition: color 0.15s ease, transform 0.15s ease;
103
+ transform: scale(1);
104
+ display: inline-block;
105
+ }
106
+ }
107
+
108
+ &__icon:hover {
109
+ text-decoration: none;
110
+ box-shadow: none;
111
+ cursor: pointer;
112
+
113
+ span {
114
+ transform: scale(1.06);
115
+ }
116
+ }
117
+
118
+ &__icon-primary { color: $color-primary; }
119
+ &__icon-secondary { color: $color-secondary; }
120
+ &__icon-tertiary { color: $color-tertiary; }
121
+ &__icon-info { color: $color-info; }
122
+ &__icon-success { color: $color-success; }
123
+ &__icon-warning { color: $color-warning; }
124
+ &__icon-danger { color: $color-danger; }
125
+ &__icon-dark { color: $color-dark-neutral; }
126
+ &__icon-light { color: $color-light; }
127
+
128
+ &__icon-primary:hover { color: color.scale($color-primary, $lightness: -15%); }
129
+ &__icon-secondary:hover { color: color.scale($color-secondary, $lightness: -15%); }
130
+ &__icon-tertiary:hover { color: color.scale($color-tertiary, $lightness: -15%); }
131
+ &__icon-info:hover { color: color.scale($color-info, $lightness: -15%); }
132
+ &__icon-success:hover { color: color.scale($color-success, $lightness: -15%); }
133
+ &__icon-warning:hover { color: color.scale($color-warning, $lightness: -15%); }
134
+ &__icon-danger:hover { color: color.scale($color-danger, $lightness: -15%); }
135
+ &__icon-dark:hover { color: color.scale($color-dark-neutral, $lightness: 20%); }
136
+ &__icon-light:hover { color: color.scale($color-light, $lightness: -10%); }
137
+
138
+ &__icon-pill {
139
+ display: inline-flex;
140
+ align-items: center;
141
+ justify-content: center;
142
+ width: 1.5rem;
143
+ height: 1.5rem;
144
+ border-radius: 50%;
145
+ background: rgba(255, 255, 255, 0.2);
146
+ font-size: 0.75rem;
147
+ line-height: 1;
148
+ box-shadow: $box-shadow-sm;
149
+ }
150
+
151
+ &__icon-pill::before {
152
+ display: block;
153
+ line-height: 1;
154
+ }
155
+
156
+ &__primary {
157
+ color: $color-light;
158
+ background-color: $color-primary;
159
+ }
160
+
161
+ &__primary:hover {
162
+ color: $color-light;
163
+ background-color: $color-primary-dark;
164
+ }
165
+
166
+ &__primary:focus-visible,
167
+ &__outline-primary:focus-visible {
168
+ outline: 3px solid $color-primary;
169
+ box-shadow: none;
170
+ }
171
+
172
+ &__secondary {
173
+ color: $color-light;
174
+ background-color: $color-secondary;
175
+ }
176
+
177
+ &__secondary:hover {
178
+ color: $color-light;
179
+ background-color: $color-secondary-dark;
180
+ }
181
+
182
+ &__secondary:focus-visible,
183
+ &__outline-secondary:focus-visible {
184
+ outline: 3px solid $color-secondary;
185
+ box-shadow: none;
186
+ }
187
+
188
+ &__tertiary {
189
+ color: $color-light;
190
+ background-color: $color-tertiary;
191
+ }
192
+
193
+ &__tertiary:hover {
194
+ color: $color-light;
195
+ background-color: $color-tertiary-dark;
196
+ }
197
+
198
+ &__tertiary:focus-visible,
199
+ &__outline-tertiary:focus-visible {
200
+ outline: 3px solid $color-tertiary;
201
+ box-shadow: none;
202
+ }
203
+
204
+ &__neutral {
205
+ color: $color-neutral-text;
206
+ background-color: $color-neutral;
207
+ }
208
+
209
+ &__neutral:hover {
210
+ color: $color-neutral-text;
211
+ background-color: color.scale($color-neutral, $lightness: -4%);
212
+ }
213
+
214
+ &__neutral:focus-visible {
215
+ outline: 3px solid color.scale($color-neutral, $lightness: -10%);
216
+ box-shadow: none;
217
+ }
218
+
219
+ &__light {
220
+ color: $color-dark-soft;
221
+ background-color: $color-light;
222
+ }
223
+
224
+ &__light:hover {
225
+ color: $color-light;
226
+ background-color: $color-dark;
227
+ }
228
+
229
+ &__light:focus-visible,
230
+ &__outline-light:focus-visible {
231
+ outline: 3px solid $color-light;
232
+ box-shadow: none;
233
+ }
234
+
235
+ &__dark {
236
+ color: $color-light;
237
+ background-color: $color-dark;
238
+ }
239
+
240
+ &__dark:hover {
241
+ color: $color-dark;
242
+ background-color: $color-light;
243
+ }
244
+
245
+ &__dark:focus-visible,
246
+ &__outline-dark:focus-visible {
247
+ outline: 3px solid $color-dark;
248
+ box-shadow: none;
249
+ }
250
+
251
+ &__info {
252
+ color: $color-light;
253
+ background-color: $color-info;
254
+ }
255
+
256
+ &__info:hover {
257
+ color: $color-light;
258
+ background-color: color.scale($color-info, $lightness: -15%);
259
+ }
260
+
261
+ &__info:focus-visible,
262
+ &__outline-info:focus-visible {
263
+ outline: 3px solid $color-info;
264
+ box-shadow: none;
265
+ }
266
+
267
+
268
+ &__success {
269
+ color: $color-light;
270
+ background-color: $color-success;
271
+ }
272
+
273
+ &__success:hover {
274
+ color: $color-light;
275
+ background-color: color.scale($color-success, $lightness: -15%);
276
+ }
277
+
278
+ &__success:focus-visible,
279
+ &__outline-success:focus-visible {
280
+ outline: 3px solid $color-success;
281
+ box-shadow: none;
282
+ }
283
+
284
+ &__warning {
285
+ color: $color-light;
286
+ background-color: $color-warning;
287
+ }
288
+
289
+ &__warning:hover {
290
+ color: $color-light;
291
+ background-color: color.scale($color-warning, $lightness: -15%);
292
+ }
293
+
294
+ &__warning:focus-visible,
295
+ &__outline-warning:focus-visible {
296
+ outline: 3px solid $color-warning;
297
+ box-shadow: none;
298
+ }
299
+
300
+ &__danger {
301
+ color: $color-light;
302
+ background-color: $color-danger;
303
+ }
304
+
305
+ &__danger:hover {
306
+ color: $color-light;
307
+ background-color: color.scale($color-danger, $lightness: -15%);
308
+ }
309
+
310
+ &__danger:focus-visible,
311
+ &__outline-danger:focus-visible {
312
+ outline: 3px solid $color-danger;
313
+ box-shadow: none;
314
+ }
315
+
316
+ &__outline-primary {
317
+ color: $color-dark;
318
+ border: 2px solid $color-primary;
319
+ background-color: transparent;
320
+ }
321
+
322
+ &__outline-primary:hover {
323
+ color: $color-light;
324
+ background-color: $color-primary;
325
+ }
326
+
327
+ &__outline-secondary {
328
+ color: $color-dark;
329
+ border: 2px solid $color-secondary;
330
+ background-color: transparent;
331
+ }
332
+
333
+ &__outline-secondary:hover {
334
+ color: $color-light;
335
+ background-color: $color-secondary;
336
+ }
337
+
338
+ &__outline-tertiary {
339
+ color: $color-dark;
340
+ border: 2px solid $color-tertiary;
341
+ background-color: transparent;
342
+ }
343
+
344
+ &__outline-tertiary:hover {
345
+ color: $color-light;
346
+ background-color: $color-tertiary;
347
+ }
348
+
349
+ &__outline-light {
350
+ color: $color-light;
351
+ border: 2px solid $color-light;
352
+ background-color: transparent;
353
+ }
354
+
355
+ &__outline-light:hover {
356
+ color: $color-dark;
357
+ background-color: $color-light;
358
+ }
359
+
360
+ &__outline-dark {
361
+ color: $color-dark;
362
+ border: 2px solid $color-dark;
363
+ background-color: transparent;
364
+ }
365
+
366
+ &__outline-dark:hover {
367
+ color: $color-light;
368
+ background-color: $color-dark;
369
+ }
370
+
371
+ &__outline-info {
372
+ color: $color-dark;
373
+ border: 2px solid $color-info;
374
+ background-color: transparent;
375
+ }
376
+
377
+ &__outline-info:hover {
378
+ color: $color-light;
379
+ background-color: $color-info;
380
+ }
381
+
382
+ &__outline-success {
383
+ color: $color-dark;
384
+ border: 2px solid $color-success;
385
+ background-color: transparent;
386
+ }
387
+
388
+ &__outline-success:hover {
389
+ color: $color-light;
390
+ background-color: $color-success;
391
+ }
392
+
393
+ &__outline-warning {
394
+ color: $color-dark;
395
+ border: 2px solid $color-warning;
396
+ background-color: transparent;
397
+ }
398
+
399
+ &__outline-warning:hover {
400
+ color: $color-light;
401
+ background-color: $color-warning;
402
+ }
403
+
404
+ &__outline-danger {
405
+ color: $color-dark;
406
+ border: 2px solid $color-danger;
407
+ background-color: transparent;
408
+ }
409
+
410
+ &__outline-danger:hover {
411
+ color: $color-light;
412
+ background-color: $color-danger;
413
+ }
414
+
415
+ &__primary:active,
416
+ &__outline-primary:active {
417
+ background-color: color.scale($color-primary, $lightness: -20%);
418
+ }
419
+
420
+ &__secondary:active,
421
+ &__outline-secondary:active {
422
+ background-color: color.scale($color-secondary, $lightness: -20%);
423
+ }
424
+
425
+ &__tertiary:active,
426
+ &__outline-tertiary:active {
427
+ background-color: color.scale($color-tertiary, $lightness: -20%);
428
+ }
429
+
430
+ &__success:active,
431
+ &__outline-success:active {
432
+ background-color: color.scale($color-success, $lightness: -20%);
433
+ }
434
+
435
+ &__warning:active,
436
+ &__outline-warning:active {
437
+ background-color: color.scale($color-warning, $lightness: -20%);
438
+ }
439
+
440
+ &__danger:active,
441
+ &__outline-danger:active {
442
+ background-color: color.scale($color-danger, $lightness: -20%);
443
+ }
444
+ }
445
+ }
@@ -0,0 +1,99 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { By } from '@angular/platform-browser';
3
+ import { RouterTestingModule } from '@angular/router/testing';
4
+ import { ButtonComponent } from './button.component';
5
+
6
+ describe('ButtonComponent', () => {
7
+ let fixture: ComponentFixture<ButtonComponent>;
8
+ let component: ButtonComponent;
9
+
10
+ beforeEach(async () => {
11
+ await TestBed.configureTestingModule({
12
+ imports: [ButtonComponent, RouterTestingModule]
13
+ }).compileComponents();
14
+
15
+ fixture = TestBed.createComponent(ButtonComponent);
16
+ component = fixture.componentInstance;
17
+ });
18
+
19
+ it('renders text when provided', () => {
20
+ component.text = 'Click me';
21
+
22
+ fixture.detectChanges();
23
+
24
+ const textEl = fixture.debugElement.query(By.css('span'));
25
+ expect(textEl.nativeElement.textContent).toContain('Click me');
26
+ });
27
+
28
+ it('renders icon span when iconClass is provided', () => {
29
+ component.iconClass = 'fa fa-star';
30
+
31
+ fixture.detectChanges();
32
+
33
+ const iconEl = fixture.debugElement.query(By.css('span.fa'));
34
+ expect(iconEl).toBeTruthy();
35
+ });
36
+
37
+ it('applies aria-label when provided', () => {
38
+ component.ariaLabel = 'Icon action';
39
+ component.iconClass = 'fa fa-star';
40
+
41
+ fixture.detectChanges();
42
+
43
+ const button = fixture.debugElement.query(By.css('button')).nativeElement as HTMLButtonElement;
44
+ expect(button.getAttribute('aria-label')).toBe('Icon action');
45
+ });
46
+
47
+ it('applies iconStyleType classes', () => {
48
+ component.iconClass = 'fa fa-star';
49
+ component.iconStyleType = 'primary';
50
+
51
+ fixture.detectChanges();
52
+
53
+ const iconEl = fixture.debugElement.query(By.css('span.fa'));
54
+ expect(iconEl.nativeElement.classList).toContain('frg-btn__icon-primary');
55
+ });
56
+
57
+ it('applies container classes based on icon position', () => {
58
+ component.iconPosition = 'top';
59
+
60
+ fixture.detectChanges();
61
+
62
+ const container = fixture.debugElement.query(By.css('button > div'));
63
+ expect(container.nativeElement.classList).toContain('flex-column-reverse');
64
+ });
65
+
66
+ it('emits clickEvent when clicked and not disabled', () => {
67
+ const emitSpy = spyOn(component.clickEvent, 'emit');
68
+
69
+ fixture.detectChanges();
70
+
71
+ const button = fixture.debugElement.query(By.css('button'));
72
+ button.nativeElement.click();
73
+
74
+ expect(emitSpy).toHaveBeenCalled();
75
+ });
76
+
77
+ it('does not emit clickEvent when disabled', () => {
78
+ const emitSpy = spyOn(component.clickEvent, 'emit');
79
+ component.disabled = true;
80
+
81
+ fixture.detectChanges();
82
+
83
+ const button = fixture.debugElement.query(By.css('button'));
84
+ button.nativeElement.click();
85
+
86
+ expect(emitSpy).not.toHaveBeenCalled();
87
+ });
88
+
89
+ it('sets type and disabled attributes', () => {
90
+ component.type = 'submit';
91
+ component.disabled = true;
92
+
93
+ fixture.detectChanges();
94
+
95
+ const button = fixture.debugElement.query(By.css('button')).nativeElement as HTMLButtonElement;
96
+ expect(button.getAttribute('type')).toBe('submit');
97
+ expect(button.getAttribute('disabled')).toBe('true');
98
+ });
99
+ });