@tacdaed/fragments 1.0.0-beta.3 → 1.0.0-beta.4

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 +14 -0
  2. package/ng-package.json +20 -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/tacdaed-fragments.mjs +0 -8928
  247. package/fesm2022/tacdaed-fragments.mjs.map +0 -1
  248. package/index.d.ts +0 -3929
@@ -0,0 +1,143 @@
1
+ import { NgClass } from '@angular/common';
2
+ import { Component, EventEmitter, Input, Output } from '@angular/core';
3
+ import { RouterLink, RouterLinkActive } from '@angular/router';
4
+
5
+ import { TButtonIconPosition, TButtonShape, TButtonSize, TButtonStyle, TButtonType } from './button.type';
6
+ import { TBaseStyle } from '../../types/base.types';
7
+
8
+ /**
9
+ * Button component for displaying a button with various styles and behaviors
10
+ */
11
+ @Component({
12
+ selector: 'frg-button',
13
+ imports: [NgClass, RouterLink, RouterLinkActive],
14
+ templateUrl: './button.component.html',
15
+ styleUrl: './button.component.scss'
16
+ })
17
+ export class ButtonComponent {
18
+ /**
19
+ * Unique identifier for the button
20
+ */
21
+ @Input() id: string = '';
22
+ /**
23
+ * CSS classes applied to the button element
24
+ */
25
+ @Input() class: string = '';
26
+ /**
27
+ * CSS classes for the text span
28
+ */
29
+ @Input() textClass: string = '';
30
+ /**
31
+ * CSS classes for the icon element
32
+ */
33
+ @Input() iconClass: string = '';
34
+ /**
35
+ * Optional style token for icon color
36
+ */
37
+ @Input() iconStyleType: TBaseStyle | undefined = undefined;
38
+ /**
39
+ * Position of the icon relative to the text
40
+ * @see TButtonIconPosition
41
+ */
42
+ @Input() iconPosition: TButtonIconPosition = 'left';
43
+ /**
44
+ * Type of the button
45
+ * @see TButtonType
46
+ */
47
+ @Input() type: TButtonType = 'button';
48
+ /**
49
+ * Size of the button
50
+ * @see TButtonSize
51
+ */
52
+ @Input() size: TButtonSize = 'medium';
53
+ /**
54
+ * Router link for navigation
55
+ */
56
+ @Input() buttonRouterLink: string | (string | number)[] | null | undefined = null;
57
+ /**
58
+ * CSS classes applied when the button is active
59
+ */
60
+ @Input() buttonRouterLinkActive: string | string[] = '';
61
+ /**
62
+ * Determines whether the button is disabled
63
+ */
64
+ @Input() disabled: boolean | null = null;
65
+ /**
66
+ * Style type of the button
67
+ * @see TButtonStyle
68
+ */
69
+ @Input() styleType: TButtonStyle = 'primary';
70
+ /**
71
+ * Shape of the button.
72
+ * @see TButtonShape
73
+ */
74
+ @Input() shape: TButtonShape = 'default';
75
+ /**
76
+ * Text content of the button
77
+ */
78
+ @Input() text: string = '';
79
+ /**
80
+ * Accessible label for icon-only buttons
81
+ */
82
+ @Input() ariaLabel: string = '';
83
+ /**
84
+ * Emits when the button is clicked
85
+ */
86
+ @Output() clickEvent: EventEmitter<void> = new EventEmitter();
87
+
88
+ /**
89
+ * CSS classes applied to the container element based on its position
90
+ * @see TButtonStyle
91
+ */
92
+ public get containerNgClass() {
93
+ return {
94
+ 'flex-column-reverse': this.iconPosition === 'top',
95
+ 'flex-row-reverse': this.iconPosition === 'left',
96
+ 'flex-row': this.iconPosition === 'right',
97
+ 'flex-column': this.iconPosition === 'bottom'
98
+ };
99
+ }
100
+
101
+ /**
102
+ * CSS classes applied to the icon element based on its position
103
+ * @see TButtonIconPosition
104
+ */
105
+ public get iconNgClass() {
106
+ return {
107
+ 'mb-2': this.iconPosition === 'top',
108
+ 'me-2': this.iconPosition === 'left',
109
+ 'ms-2': this.iconPosition === 'right',
110
+ 'mt-2': this.iconPosition === 'bottom'
111
+ };
112
+ }
113
+
114
+ /**
115
+ * Combined classes for icon color + spacing
116
+ */
117
+ public get iconClassMap() {
118
+ const hasText = !!this.text;
119
+ return {
120
+ 'frg-btn__icon-primary': this.iconStyleType === 'primary',
121
+ 'frg-btn__icon-secondary': this.iconStyleType === 'secondary',
122
+ 'frg-btn__icon-tertiary': this.iconStyleType === 'tertiary',
123
+ 'frg-btn__icon-info': this.iconStyleType === 'info',
124
+ 'frg-btn__icon-success': this.iconStyleType === 'success',
125
+ 'frg-btn__icon-warning': this.iconStyleType === 'warning',
126
+ 'frg-btn__icon-danger': this.iconStyleType === 'danger',
127
+ 'frg-btn__icon-dark': this.iconStyleType === 'dark',
128
+ 'frg-btn__icon-light': this.iconStyleType === 'light',
129
+ 'frg-btn__icon-pill': this.shape === 'pill' && hasText,
130
+ ...(hasText ? this.iconNgClass : {})
131
+ };
132
+ }
133
+
134
+ /**
135
+ * Emits when the button is clicked
136
+ */
137
+ onClick(): void {
138
+ if(!this.disabled) {
139
+ this.clickEvent.emit();
140
+ }
141
+ }
142
+
143
+ }
@@ -0,0 +1,7 @@
1
+ import { TBasePosition, TBaseSize, TBaseStyle } from '../../types/base.types';
2
+
3
+ export type TButtonType = 'button' | 'reset' | 'submit';
4
+ export type TButtonStyle = TBaseStyle | 'ghost' | 'icon' | 'neutral';
5
+ export type TButtonSize = TBaseSize;
6
+ export type TButtonIconPosition = TBasePosition;
7
+ export type TButtonShape = 'default' | 'pill';
@@ -0,0 +1,44 @@
1
+ @if (!isClosed) {
2
+ <div
3
+ class="frg-card"
4
+ [ngClass]="{
5
+ 'frg-card__primary': styleType === 'primary',
6
+ 'frg-card__secondary': styleType === 'secondary',
7
+ 'frg-card__tertiary': styleType === 'tertiary',
8
+ 'frg-card__dark': styleType === 'dark',
9
+ 'frg-card__light': styleType === 'light',
10
+ 'frg-card__success': styleType === 'success',
11
+ 'frg-card__warning': styleType === 'warning',
12
+ 'frg-card__danger': styleType === 'danger',
13
+ 'frg-card__outline-primary': styleType === 'outline-primary',
14
+ 'frg-card__outline-secondary': styleType === 'outline-secondary',
15
+ 'frg-card__outline-tertiary': styleType === 'outline-tertiary',
16
+ 'frg-card__outline-dark': styleType === 'outline-dark',
17
+ 'frg-card__outline-light': styleType === 'outline-light',
18
+ 'frg-card__outline-success': styleType === 'outline-success',
19
+ 'frg-card__outline-warning': styleType === 'outline-warning',
20
+ 'frg-card__outline-danger': styleType === 'outline-danger'
21
+ }"
22
+ >
23
+ @if(hasCloseCard) {
24
+ <button
25
+ type="button"
26
+ class="frg-card__close-btn"
27
+ (click)="onCloseCard()"
28
+ aria-label="Close"
29
+ >
30
+ &times;
31
+ </button>
32
+ }
33
+
34
+ <div class="frg-card__head">
35
+ <ng-content select="[frg-card-head]"></ng-content>
36
+ </div>
37
+ <div class="frg-card__body">
38
+ <ng-content select="[frg-card-body]"></ng-content>
39
+ </div>
40
+ <div class="frg-card__footer">
41
+ <ng-content select="[frg-card-footer]"></ng-content>
42
+ </div>
43
+ </div>
44
+ }
@@ -0,0 +1,114 @@
1
+ @use '../../../../assets/styles/scss/variables' as *;
2
+
3
+ :host {
4
+ .frg-card {
5
+ position: relative;
6
+ margin-top: 0;
7
+ border-radius: 0.25rem;
8
+ padding: 20px 1.5rem;
9
+ box-shadow:
10
+ 0 1px 3px 0 rgba(0, 0, 0, 0.1),
11
+ 0 1px 2px -1px rgba(0, 0, 0, 0.1);
12
+ transition: all 0.15s ease-in-out;
13
+ color: $color-dark;
14
+ background-color: $color-light;
15
+ font-family: $base-font;
16
+
17
+ &__primary {
18
+ color: $color-light;
19
+ background-color: $color-primary;
20
+ }
21
+
22
+ &__secondary {
23
+ color: $color-light;
24
+ background-color: $color-secondary;
25
+ }
26
+
27
+ &__tertiary {
28
+ color: $color-light;
29
+ background-color: $color-tertiary;
30
+ }
31
+
32
+ &__danger {
33
+ color: $color-light;
34
+ background-color: $color-danger;
35
+ }
36
+
37
+ &__warning {
38
+ color: $color-light;
39
+ background-color: $color-warning;
40
+ }
41
+
42
+ &__success {
43
+ color: $color-light;
44
+ background-color: $color-success;
45
+ }
46
+
47
+ // Outline variants
48
+ &__outline-primary {
49
+ color: $color-dark;
50
+ background-color: $color-light;
51
+ border: 2px solid $color-primary;
52
+ }
53
+
54
+ &__outline-secondary {
55
+ color: $color-dark;
56
+ background-color: $color-light;
57
+ border: 2px solid $color-secondary;
58
+ }
59
+
60
+ &__outline-tertiary {
61
+ color: $color-dark;
62
+ background-color: $color-light;
63
+ border: 2px solid $color-tertiary;
64
+ }
65
+
66
+ &__outline-danger {
67
+ color: $color-dark;
68
+ background-color: $color-light;
69
+ border: 2px solid $color-danger;
70
+ }
71
+
72
+ &__outline-warning {
73
+ color: $color-dark;
74
+ background-color: $color-light;
75
+ border: 2px solid $color-warning;
76
+ }
77
+
78
+ &__outline-success {
79
+ color: $color-dark;
80
+ background-color: $color-light;
81
+ border: 2px solid $color-success;
82
+ }
83
+
84
+ &__head {
85
+ display: flex;
86
+ justify-content: space-between;
87
+ align-items: center;
88
+ }
89
+
90
+ &__close-btn {
91
+ position: absolute;
92
+ top: .5rem;
93
+ right: .5rem;
94
+ background: transparent;
95
+ border: none;
96
+ color: $color-dark-soft;
97
+ font-size: 1.5rem;
98
+ line-height: 1;
99
+ cursor: pointer;
100
+ padding: 0.25rem 0.5rem;
101
+ border-radius: 50%;
102
+ display: flex;
103
+ align-items: center;
104
+ justify-content: center;
105
+ z-index: 2;
106
+
107
+ &:hover,
108
+ &:focus {
109
+ color: $color-dark;
110
+ outline: none;
111
+ }
112
+ }
113
+ }
114
+ }
@@ -0,0 +1,65 @@
1
+ import { Component } from '@angular/core';
2
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
3
+ import { By } from '@angular/platform-browser';
4
+ import { CardComponent } from './card.component';
5
+
6
+ @Component({
7
+ standalone: true,
8
+ imports: [CardComponent],
9
+ template: `
10
+ <frg-card [styleType]="styleType" [hasCloseCard]="hasCloseCard" (closeCard)="closed = true">
11
+ <div frg-card-head>Head</div>
12
+ <div frg-card-body>Body</div>
13
+ <div frg-card-footer>Footer</div>
14
+ </frg-card>
15
+ `
16
+ })
17
+ class TestHostComponent {
18
+ styleType: any = 'default';
19
+ hasCloseCard = false;
20
+ closed = false;
21
+ }
22
+
23
+ describe('CardComponent', () => {
24
+ let fixture: ComponentFixture<TestHostComponent>;
25
+
26
+ beforeEach(async () => {
27
+ await TestBed.configureTestingModule({
28
+ imports: [TestHostComponent]
29
+ }).compileComponents();
30
+
31
+ fixture = TestBed.createComponent(TestHostComponent);
32
+ });
33
+
34
+ it('renders projected head, body, and footer content', () => {
35
+ fixture.detectChanges();
36
+
37
+ expect(fixture.debugElement.query(By.css('.frg-card__head'))?.nativeElement.textContent).toContain('Head');
38
+ expect(fixture.debugElement.query(By.css('.frg-card__body'))?.nativeElement.textContent).toContain('Body');
39
+ expect(fixture.debugElement.query(By.css('.frg-card__footer'))?.nativeElement.textContent).toContain('Footer');
40
+ });
41
+
42
+ it('applies style classes based on styleType', () => {
43
+ fixture.componentInstance.styleType = 'primary';
44
+
45
+ fixture.detectChanges();
46
+
47
+ const card = fixture.debugElement.query(By.css('.frg-card'));
48
+ expect(card.nativeElement.classList).toContain('frg-card__primary');
49
+ });
50
+
51
+ it('shows and triggers close behavior when enabled', () => {
52
+ fixture.componentInstance.hasCloseCard = true;
53
+
54
+ fixture.detectChanges();
55
+
56
+ const closeBtn = fixture.debugElement.query(By.css('.frg-card__close-btn'));
57
+ expect(closeBtn).toBeTruthy();
58
+
59
+ closeBtn.nativeElement.click();
60
+ fixture.detectChanges();
61
+
62
+ expect(fixture.componentInstance.closed).toBeTrue();
63
+ expect(fixture.debugElement.query(By.css('.frg-card'))).toBeNull();
64
+ });
65
+ });
@@ -0,0 +1,21 @@
1
+ import { NgClass } from '@angular/common';
2
+ import { Component, EventEmitter, Input, Output } from '@angular/core';
3
+ import { TCardStyle } from './card.type';
4
+
5
+ @Component({
6
+ selector: 'frg-card',
7
+ imports: [NgClass],
8
+ templateUrl: './card.component.html',
9
+ styleUrl: './card.component.scss'
10
+ })
11
+ export class CardComponent {
12
+ @Input() styleType: TCardStyle = 'default';
13
+ @Input() hasCloseCard: boolean = false;
14
+ @Output() closeCard = new EventEmitter<void>();
15
+ isClosed = false;
16
+
17
+ onCloseCard() {
18
+ this.closeCard.emit();
19
+ this.isClosed = true;
20
+ }
21
+ }
@@ -0,0 +1,3 @@
1
+ import { TBaseStyle } from '../../types/base.types';
2
+
3
+ export type TCardStyle = TBaseStyle;
@@ -0,0 +1,55 @@
1
+ @if (config) {
2
+ <div #container class="code-block">
3
+ @if (header) {
4
+ <div class="code-block__header">
5
+ <span class="code-block__header__title">{{ title }}</span>
6
+ @if (showCopyButton) {
7
+ <button
8
+ type="button"
9
+ class="code-block__header__action"
10
+ (click)="copyToClipboard()"
11
+ [attr.aria-label]="copied ? copiedLabel : copyLabel"
12
+ >
13
+ <span class="code-block__header__action-content" [class.is-copied]="copied">
14
+ @if (copied) {
15
+ <span class="code-block__header__action-label">{{ copiedLabel }}</span>
16
+ } @else {
17
+ <span class="fa-regular fa-copy" aria-hidden="true"></span>
18
+ }
19
+ </span>
20
+ </button>
21
+ }
22
+ </div>
23
+ }
24
+
25
+ @if (body) {
26
+ <div class="code-block__body">
27
+ @switch (type) {
28
+ @case ('text') {
29
+ <pre
30
+ #codeElement
31
+ class="language-{{ language || 'typescript' }}"
32
+ [attr.data-line]="highlightLines"
33
+ >
34
+ <code [textContent]="content"></code>
35
+ </pre>
36
+ }
37
+ @case ('component') {
38
+ @if (component) {
39
+ <ng-template
40
+ addComponent
41
+ [component]="component"
42
+ [inputComponent]="inputs"
43
+ ></ng-template>
44
+ }
45
+ }
46
+ }
47
+ </div>
48
+ }
49
+ @if (config.footer?.text) {
50
+ <div class="code-block__footer">
51
+ {{ config.footer?.text }}
52
+ </div>
53
+ }
54
+ </div>
55
+ }
@@ -0,0 +1,122 @@
1
+ @use './../../../../assets/styles/scss/variables' as *;
2
+
3
+ :host {
4
+ display: block;
5
+
6
+ .code-block {
7
+ display: inline-block;
8
+ position: relative;
9
+ background: $color-dark;
10
+ box-shadow: $box-shadow-sm;
11
+ border-radius: .25rem;
12
+ min-width: 0; // Prevent overflow
13
+ max-width: 100%;
14
+
15
+ &__header {
16
+ display: flex;
17
+ justify-content: space-between;
18
+ align-items: center;
19
+ border-radius: .25rem .25rem 0 0;
20
+ gap: 0.25rem;
21
+ width: 100%;
22
+ height: 1.5rem;
23
+ background: $color-dark-neutral;
24
+ box-shadow: $box-shadow-sm;
25
+
26
+ &__title {
27
+ font-size: 0.7rem;
28
+ padding: 0 0.5rem;
29
+ font-weight: 300;
30
+ color: $color-light;
31
+ }
32
+
33
+ &__action {
34
+ border: 0;
35
+ background: transparent;
36
+ color: $color-light;
37
+ font-size: 0.7rem;
38
+ font-weight: 400;
39
+ cursor: pointer;
40
+ display: inline-flex;
41
+ align-items: center;
42
+ gap: 0.25rem;
43
+ }
44
+
45
+ &__action:hover,
46
+ &__action:focus-visible {
47
+ color: $color-light-soft;
48
+ }
49
+
50
+ &__action-content {
51
+ display: inline-flex;
52
+ align-items: center;
53
+ justify-content: center;
54
+ min-width: 1.25rem;
55
+ transition: transform 0.2s ease, opacity 0.2s ease;
56
+ }
57
+
58
+ &__action-content.is-copied {
59
+ animation: code-block-copy-pop 0.35s ease;
60
+ }
61
+
62
+ &__action-label {
63
+ letter-spacing: 0.02em;
64
+ }
65
+ }
66
+
67
+ &__body {
68
+ color: $color-light;
69
+ text-align: left;
70
+ font-size: 0.75rem;
71
+ padding: 0.5rem 1rem;
72
+ white-space: pre;
73
+ }
74
+
75
+ &__footer {
76
+ padding: 0.5rem 1rem;
77
+ font-size: 0.6rem;
78
+ color: $color-light-soft;
79
+ background: $color-dark-neutral;
80
+ border-radius: 0 0 .25rem .25rem;
81
+ }
82
+
83
+ pre[class*='language-'] {
84
+ padding: 0;
85
+ margin: 0;
86
+ background: none;
87
+ box-shadow: none;
88
+ }
89
+ }
90
+
91
+ @keyframes code-block-copy-pop {
92
+ 0% {
93
+ transform: scale(0.85);
94
+ opacity: 0.6;
95
+ }
96
+ 60% {
97
+ transform: scale(1.08);
98
+ opacity: 1;
99
+ }
100
+ 100% {
101
+ transform: scale(1);
102
+ opacity: 1;
103
+ }
104
+ }
105
+ }
106
+ pre.hljs {
107
+ scrollbar-width: thin;
108
+ scrollbar-color: $color-light-soft transparent;
109
+ }
110
+
111
+ pre.hljs::-webkit-scrollbar-track {
112
+ background: transparent;
113
+ }
114
+
115
+ pre.hljs::-webkit-scrollbar-thumb {
116
+ background-color: $color-light-soft;
117
+ border-radius: 6px;
118
+ }
119
+
120
+ pre.hljs::-webkit-scrollbar-button {
121
+ display: none;
122
+ }
@@ -0,0 +1,81 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { By } from '@angular/platform-browser';
3
+ import hljs from 'highlight.js';
4
+ import { CodeBlockComponent } from './code-block.component';
5
+ import { CodeBlockConfig } from './code-block.interface';
6
+
7
+ describe('CodeBlockComponent', () => {
8
+ let fixture: ComponentFixture<CodeBlockComponent>;
9
+ let component: CodeBlockComponent;
10
+
11
+ beforeEach(async () => {
12
+ await TestBed.configureTestingModule({
13
+ imports: [CodeBlockComponent]
14
+ }).compileComponents();
15
+
16
+ fixture = TestBed.createComponent(CodeBlockComponent);
17
+ component = fixture.componentInstance;
18
+ });
19
+
20
+ it('renders the header title when provided', () => {
21
+ component.config = {
22
+ header: { title: 'Example' },
23
+ body: { type: 'text', content: 'const a = 1;' }
24
+ } as CodeBlockConfig;
25
+
26
+ fixture.detectChanges();
27
+
28
+ const title = fixture.debugElement.query(By.css('.code-block__header__title'));
29
+ expect(title.nativeElement.textContent).toContain('Example');
30
+ });
31
+
32
+ it('renders the footer text when provided', () => {
33
+ component.config = {
34
+ header: { title: 'Example' },
35
+ body: { type: 'text', content: 'const a = 1;' },
36
+ footer: { text: 'Footer text' }
37
+ } as CodeBlockConfig;
38
+
39
+ fixture.detectChanges();
40
+
41
+ const footer = fixture.debugElement.query(By.css('.code-block__footer'));
42
+ expect(footer.nativeElement.textContent).toContain('Footer text');
43
+ });
44
+
45
+ it('highlights code after view init for text body', () => {
46
+ const highlightSpy = spyOn(hljs, 'highlightElement').and.callThrough();
47
+
48
+ component.config = {
49
+ header: { title: 'Example' },
50
+ body: { type: 'text', content: 'const a = 1;', language: 'typescript' }
51
+ } as CodeBlockConfig;
52
+
53
+ fixture.detectChanges();
54
+
55
+ expect(highlightSpy).toHaveBeenCalled();
56
+ });
57
+
58
+ it('adds line numbers when configured', () => {
59
+ const highlightSpy = spyOn(hljs, 'highlightElement').and.callThrough();
60
+
61
+ component.config = {
62
+ header: { title: 'Example' },
63
+ body: { type: 'text', content: 'first\nsecond', hasNumberLine: true }
64
+ } as CodeBlockConfig;
65
+
66
+ fixture.detectChanges();
67
+
68
+ const pre = fixture.debugElement.query(By.css('pre')).nativeElement as HTMLElement;
69
+ expect(pre.textContent).toContain('1 | first');
70
+ expect(pre.textContent).toContain('2 | second');
71
+ expect(highlightSpy).toHaveBeenCalled();
72
+ });
73
+
74
+ it('does not render when config is undefined', () => {
75
+ component.config = undefined;
76
+
77
+ fixture.detectChanges();
78
+
79
+ expect(fixture.debugElement.query(By.css('.code-block'))).toBeNull();
80
+ });
81
+ });