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

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 +2 -18
  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,305 @@
1
+ @use "sass:color";
2
+ @use "sass:list";
3
+ @use './../../../../assets/styles/scss/variables' as *;
4
+
5
+ :host {
6
+ display: block;
7
+ font-family: $base-font;
8
+ }
9
+
10
+ .frg-tabs {
11
+ display: flex;
12
+ flex-direction: column;
13
+
14
+ &[data-align='center'] .frg-tabs__list {
15
+ justify-content: center;
16
+ }
17
+
18
+ &[data-align='end'] .frg-tabs__list {
19
+ justify-content: flex-end;
20
+ }
21
+
22
+ &[data-align='stretch'] .frg-tabs__list {
23
+ justify-content: stretch;
24
+
25
+ .frg-tabs__tab {
26
+ flex: 1 1 auto;
27
+ text-align: center;
28
+ }
29
+ }
30
+ }
31
+
32
+ .frg-tabs__list {
33
+ display: flex;
34
+ align-items: flex-end;
35
+ border-bottom: 1px solid $color-light-soft;
36
+ flex-wrap: wrap;
37
+ overflow: visible;
38
+ }
39
+
40
+ .frg-tabs__tab {
41
+ position: relative;
42
+ display: inline-flex;
43
+ align-items: center;
44
+ border: none;
45
+ background: transparent;
46
+ color: $color-dark-soft;
47
+ padding: 0.65rem 0.9rem;
48
+ border-radius: 0.2rem 0.2rem 0 0;
49
+ cursor: pointer;
50
+ overflow: hidden;
51
+ transition:
52
+ color 0.16s ease,
53
+ background-color 0.22s ease,
54
+ box-shadow 0.22s ease,
55
+ transform 0.18s ease;
56
+
57
+ &.is-disabled {
58
+ opacity: 0.6;
59
+ cursor: not-allowed;
60
+ }
61
+
62
+ &:hover:not(.is-disabled) {
63
+ color: $color-dark-neutral;
64
+ }
65
+
66
+ &:focus-visible {
67
+ outline: none;
68
+ box-shadow: 0 0 0 2px color.scale($color-primary, $lightness: 35%);
69
+ }
70
+
71
+ &.is-active {
72
+ color: $color-dark;
73
+ }
74
+
75
+ .frg-tabs__tab-inner {
76
+ display: inline-flex;
77
+ align-items: center;
78
+ }
79
+
80
+ .frg-tabs__icon {
81
+ min-width: 1.75rem;
82
+ height: 1.75rem;
83
+ border-radius: 0.35rem;
84
+ display: inline-flex;
85
+ align-items: center;
86
+ justify-content: center;
87
+ background-color: color.scale($color-light, $lightness: -3%);
88
+ color: $color-dark;
89
+ flex-shrink: 0;
90
+ margin: 0 0.5rem;
91
+ font-weight: 600;
92
+ font-size: $font-size-xs;
93
+ }
94
+
95
+ .frg-tabs__icon-shape {
96
+ font-size: $font-size-sm;
97
+ line-height: 1;
98
+ }
99
+
100
+ .frg-tabs__label {
101
+ display: flex;
102
+ flex-direction: column;
103
+ gap: 0.05rem;
104
+ text-align: left;
105
+ }
106
+
107
+ .frg-tabs__label-text {
108
+ font-size: $font-size-sm;
109
+ font-weight: 600;
110
+ line-height: 1.35;
111
+ }
112
+
113
+ .frg-tabs__label-desc {
114
+ color: $color-dark-soft;
115
+ font-size: $font-size-2xs;
116
+ line-height: 1.3;
117
+ }
118
+
119
+ .frg-tabs__underline {
120
+ position: absolute;
121
+ left: 0;
122
+ right: 0;
123
+ bottom: -1px;
124
+ height: 2px;
125
+ border-radius: 2px;
126
+ background-color: $color-primary;
127
+ opacity: 0;
128
+ transform: scaleX(0);
129
+ transform-origin: left center;
130
+ transition:
131
+ transform 0.250s cubic-bezier(0.25, 0.8, 0.4, 1),
132
+ opacity 0.18s ease;
133
+ }
134
+
135
+ &::after {
136
+ content: '';
137
+ position: absolute;
138
+ inset: 0;
139
+ border-radius: inherit;
140
+ background-color: transparent;
141
+ z-index: -1;
142
+ display: none;
143
+ }
144
+ }
145
+
146
+ .frg-tabs__tab[data-style^='outline-'] {
147
+ border-bottom: 2px solid transparent;
148
+ margin-bottom: -1px;
149
+ }
150
+
151
+ .frg-tabs__tab[data-style^='outline-'] .frg-tabs__underline {
152
+ display: none;
153
+ }
154
+
155
+ .frg-tabs.is-animated {
156
+ .frg-tabs__panel {
157
+ transition: opacity 0.18s ease, transform 0.18s ease;
158
+ }
159
+ }
160
+
161
+ .frg-tabs__panels {
162
+ position: relative;
163
+ padding-top: 0.85rem;
164
+ }
165
+
166
+ .frg-tabs__panel {
167
+ padding: 0.75rem 0;
168
+ color: $color-dark-neutral;
169
+ outline: none;
170
+ line-height: 1.5;
171
+ opacity: 0;
172
+ transform: translateY(2px);
173
+
174
+ &.is-active {
175
+ opacity: 1;
176
+ transform: translateY(0);
177
+ }
178
+
179
+ &:focus-visible {
180
+ outline: 2px solid $color-primary;
181
+ outline-offset: 2px;
182
+ }
183
+ }
184
+
185
+ .frg-tabs__tab[data-size='small'] {
186
+ padding: 0.5rem 0.7rem;
187
+
188
+ .frg-tabs__icon {
189
+ min-width: 1.5rem;
190
+ height: 1.5rem;
191
+ border-radius: 0.3rem;
192
+ }
193
+
194
+ .frg-tabs__label-text {
195
+ font-size: $font-size-xs;
196
+ }
197
+
198
+ .frg-tabs__label-desc {
199
+ font-size: $font-size-2xs;
200
+ }
201
+ }
202
+
203
+ .frg-tabs__tab[data-size='large'] {
204
+ padding: 0.85rem 1.05rem;
205
+
206
+ .frg-tabs__icon {
207
+ min-width: 2rem;
208
+ height: 2rem;
209
+ }
210
+
211
+ .frg-tabs__label-text {
212
+ font-size: $font-size-md;
213
+ }
214
+ }
215
+
216
+ $tab-colors: (
217
+ 'primary': $color-primary,
218
+ 'secondary': $color-secondary,
219
+ 'tertiary': $color-tertiary,
220
+ 'info': $color-info,
221
+ 'success': $color-success,
222
+ 'warning': $color-warning,
223
+ 'danger': $color-danger,
224
+ 'dark': $color-dark,
225
+ 'light': $color-light,
226
+ 'outline-primary': $color-primary,
227
+ 'outline-secondary': $color-secondary,
228
+ 'outline-tertiary': $color-tertiary,
229
+ 'outline-info': $color-info,
230
+ 'outline-success': $color-success,
231
+ 'outline-warning': $color-warning,
232
+ 'outline-danger': $color-danger,
233
+ 'outline-dark': $color-dark,
234
+ 'outline-light': $color-light-soft,
235
+ 'default': $color-dark-neutral
236
+ );
237
+
238
+ $solid-variants: ('primary', 'secondary', 'tertiary', 'info', 'success', 'warning', 'danger', 'dark', 'light', 'default');
239
+ $outline-variants: (
240
+ 'outline-primary',
241
+ 'outline-secondary',
242
+ 'outline-tertiary',
243
+ 'outline-info',
244
+ 'outline-success',
245
+ 'outline-warning',
246
+ 'outline-danger',
247
+ 'outline-dark',
248
+ 'outline-light'
249
+ );
250
+
251
+ @each $variant, $tone in $tab-colors {
252
+ .frg-tabs__tab[data-style="#{$variant}"] {
253
+ border: none;
254
+
255
+ .frg-tabs__underline {
256
+ background-color: $tone;
257
+ }
258
+
259
+ &.is-active {
260
+ @if list.index($solid-variants, $variant) {
261
+ $fill: if($variant == 'light', color.scale($tone, $lightness: -8%), $tone);
262
+ background-color: $fill;
263
+ color: if($variant == 'light', $color-dark, $color-light);
264
+ border-color: transparent;
265
+ box-shadow: inset 0 -2px 0 rgba($tone, 0.28);
266
+ .frg-tabs__underline {
267
+ opacity: 0;
268
+ height: 2px;
269
+ transform: scaleX(0);
270
+ }
271
+ } @else if list.index($outline-variants, $variant) {
272
+ background-color: transparent;
273
+ border-color: transparent;
274
+ border-width: 2px;
275
+ color: if($variant == 'outline-light', $color-dark, $tone);
276
+ border-bottom: 2px solid $tone;
277
+ margin-bottom: -1px;
278
+ .frg-tabs__underline {
279
+ display: none;
280
+ }
281
+ .frg-tabs__label-desc {
282
+ color: $color-dark-neutral;
283
+ }
284
+ }
285
+
286
+ .frg-tabs__label-desc {
287
+ color: if(
288
+ list.index($outline-variants, $variant),
289
+ $color-dark-neutral,
290
+ if($variant == 'light', $color-dark-soft, color.scale($color-light, $lightness: -5%))
291
+ );
292
+ }
293
+
294
+ .frg-tabs__icon {
295
+ @if list.index($solid-variants, $variant) {
296
+ background-color: color.scale($tone, $lightness: 12%);
297
+ color: if($variant == 'light', $color-dark, $color-light);
298
+ } @else {
299
+ background-color: transparent;
300
+ color: if($variant == 'outline-light', $color-dark, $tone);
301
+ }
302
+ }
303
+ }
304
+ }
305
+ }
@@ -0,0 +1,94 @@
1
+ import { Component } from '@angular/core';
2
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
3
+ import { By } from '@angular/platform-browser';
4
+ import { TabsComponent } from './tabs.component';
5
+ import { TabItem } from './tabs.type';
6
+
7
+ const items: TabItem[] = [
8
+ { id: 'tab-a', label: 'Alpha', content: 'A' },
9
+ { id: 'tab-b', label: 'Beta', content: 'B' },
10
+ { id: 'tab-c', label: 'Gamma', content: 'C', disabled: true }
11
+ ];
12
+
13
+ @Component({
14
+ standalone: true,
15
+ imports: [TabsComponent],
16
+ template: `
17
+ <frg-tabs
18
+ [items]="items"
19
+ [activeId]="activeId"
20
+ (activeIdChange)="activeId = $event">
21
+ </frg-tabs>
22
+ `
23
+ })
24
+ class TestHostComponent {
25
+ items = [...items];
26
+ activeId: string | null = null;
27
+ }
28
+
29
+ describe('TabsComponent', () => {
30
+ let fixture: ComponentFixture<TestHostComponent>;
31
+
32
+ const getTabs = (): TabsComponent =>
33
+ fixture.debugElement.query(By.directive(TabsComponent)).componentInstance as TabsComponent;
34
+
35
+ const getTabButtons = () =>
36
+ fixture.debugElement.queryAll(By.css('.frg-tabs__tab'));
37
+
38
+ beforeEach(async () => {
39
+ await TestBed.configureTestingModule({
40
+ imports: [TestHostComponent]
41
+ }).compileComponents();
42
+
43
+ fixture = TestBed.createComponent(TestHostComponent);
44
+ });
45
+
46
+ it('renders the tab labels', () => {
47
+ fixture.detectChanges();
48
+
49
+ const labels = fixture.debugElement.queryAll(By.css('.frg-tabs__label-text'));
50
+ expect(labels.length).toBe(3);
51
+ expect(labels[0].nativeElement.textContent).toContain('Alpha');
52
+ expect(labels[1].nativeElement.textContent).toContain('Beta');
53
+ });
54
+
55
+ it('defaults to the first enabled tab when activeId is null', () => {
56
+ fixture.detectChanges();
57
+
58
+ const tabs = getTabs();
59
+ expect(tabs.activeId as unknown as string).toBe('tab-a');
60
+ });
61
+
62
+ it('emits changes when a tab is clicked', () => {
63
+ const tabs = getTabs();
64
+ const changeSpy = spyOn(tabs.changed, 'emit');
65
+ fixture.detectChanges();
66
+
67
+ const buttons = getTabButtons();
68
+ buttons[1].nativeElement.click();
69
+
70
+ expect(tabs.activeId).toBe('tab-b');
71
+ expect(fixture.componentInstance.activeId).toBe('tab-b');
72
+ expect(changeSpy).toHaveBeenCalled();
73
+ });
74
+
75
+ it('does not activate disabled tabs', () => {
76
+ fixture.detectChanges();
77
+
78
+ const tabs = getTabs();
79
+ const buttons = getTabButtons();
80
+ buttons[2].nativeElement.click();
81
+
82
+ expect(tabs.activeId).toBe('tab-a');
83
+ });
84
+
85
+ it('activates tab on Enter keydown', () => {
86
+ fixture.detectChanges();
87
+
88
+ const tabs = getTabs();
89
+ const buttons = getTabButtons();
90
+ buttons[1].nativeElement.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
91
+
92
+ expect(tabs.activeId).toBe('tab-b');
93
+ });
94
+ });
@@ -0,0 +1,282 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
2
+ import {
3
+ Component,
4
+ ContentChild,
5
+ ElementRef,
6
+ EventEmitter,
7
+ Input,
8
+ OnChanges,
9
+ Output,
10
+ QueryList,
11
+ SimpleChanges,
12
+ TemplateRef,
13
+ ViewChildren
14
+ } from '@angular/core';
15
+ import { TabChangeEvent, TabItem, TabItemContext, TTabSize, TTabStyle } from './tabs.type';
16
+
17
+ /**
18
+ * TabsComponent
19
+ *
20
+ * Accessible tabset that supports keyboard navigation, style variants,
21
+ * projected templates, and two-way active state management.
22
+ */
23
+ @Component({
24
+ selector: 'frg-tabs',
25
+ standalone: true,
26
+ imports: [NgTemplateOutlet],
27
+ templateUrl: './tabs.component.html',
28
+ styleUrl: './tabs.component.scss'
29
+ })
30
+ export class TabsComponent implements OnChanges {
31
+ /**
32
+ * Tab definitions rendered by the component.
33
+ */
34
+ @Input() items: TabItem[] = [];
35
+ /**
36
+ * Identifier of the currently active tab. Auto-resolved when null.
37
+ */
38
+ @Input() activeId: string | null = null;
39
+ /**
40
+ * Visual style applied to tabs when no per-item style is provided.
41
+ */
42
+ @Input() styleType: TTabStyle = 'default';
43
+ /**
44
+ * Size variant applied to tabs when no per-item size is provided.
45
+ */
46
+ @Input() size: TTabSize = 'medium';
47
+ /**
48
+ * Horizontal alignment of the tab list.
49
+ */
50
+ @Input() align: 'start' | 'center' | 'end' | 'stretch' = 'start';
51
+ /**
52
+ * Enables panel fade/slide animations.
53
+ */
54
+ @Input() animated: boolean = true;
55
+ /**
56
+ * When true, moves focus to the active panel after selection.
57
+ */
58
+ @Input() focusPanelOnSelect: boolean = false;
59
+
60
+ /**
61
+ * Emits whenever the active tab changes (for two-way binding).
62
+ */
63
+ @Output() activeIdChange = new EventEmitter<string | null>();
64
+ /**
65
+ * Detailed change event emitted on active tab updates.
66
+ */
67
+ @Output() changed = new EventEmitter<TabChangeEvent>();
68
+
69
+ /**
70
+ * Optional projected template for tab labels.
71
+ */
72
+ @ContentChild('frgTabLabel', { read: TemplateRef }) labelTemplate?: TemplateRef<TabItemContext>;
73
+ /**
74
+ * Optional projected template for tab panels.
75
+ */
76
+ @ContentChild('frgTabContent', { read: TemplateRef }) contentTemplate?: TemplateRef<TabItemContext>;
77
+ /**
78
+ * Optional projected template for tab icons.
79
+ */
80
+ @ContentChild('frgTabIcon', { read: TemplateRef }) iconTemplate?: TemplateRef<TabItemContext>;
81
+
82
+ /**
83
+ * References to rendered tab buttons for keyboard focus.
84
+ */
85
+ @ViewChildren('tabBtn') tabButtons!: QueryList<ElementRef<HTMLButtonElement>>;
86
+ /**
87
+ * References to rendered panel elements for focus management.
88
+ */
89
+ @ViewChildren('panelBody') panelBodies!: QueryList<ElementRef<HTMLElement>>;
90
+
91
+ /**
92
+ * Normalized copy of `items` with generated ids and active flags.
93
+ */
94
+ viewItems: TabItem[] = [];
95
+ /**
96
+ * Internal counter used for deterministic id generation.
97
+ */
98
+ private uidCounter = 0;
99
+
100
+ /**
101
+ * Syncs inputs into internal view state and resolves active tab.
102
+ */
103
+ ngOnChanges(changes: SimpleChanges): void {
104
+ if (changes['items']) {
105
+ this.viewItems = this.normalizeItems(this.items);
106
+ const initialActive = this.resolveActiveId(this.activeId);
107
+ this.setActiveId(initialActive, false);
108
+ }
109
+
110
+ if (changes['activeId'] && !changes['activeId'].firstChange) {
111
+ this.setActiveId(this.activeId, false);
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Determines whether a given tab id matches the current active id.
117
+ */
118
+ isActive(id?: string | null): boolean {
119
+ return !!id && this.activeId === id;
120
+ }
121
+
122
+ /**
123
+ * Builds the DOM id for a tab element.
124
+ */
125
+ tabId(id: string): string {
126
+ return `${id}-tab`;
127
+ }
128
+
129
+ /**
130
+ * Builds the DOM id for a panel element.
131
+ */
132
+ panelId(id: string): string {
133
+ return `${id}-panel`;
134
+ }
135
+
136
+ /**
137
+ * Handles click selection for a tab at the given index.
138
+ */
139
+ onTabClick(index: number, event: Event): void {
140
+ event.preventDefault();
141
+ this.selectAt(index);
142
+ }
143
+
144
+ /**
145
+ * Keyboard interaction handler to navigate and activate tabs.
146
+ */
147
+ onTabKeydown(event: KeyboardEvent, index: number): void {
148
+ const key = event.key;
149
+ const tabs = this.tabButtons?.toArray() || [];
150
+ if (!tabs.length) {
151
+ return;
152
+ }
153
+
154
+ if (key === 'Enter' || key === ' ') {
155
+ event.preventDefault();
156
+ this.selectAt(index);
157
+ return;
158
+ }
159
+
160
+ if (key === 'ArrowRight' || key === 'ArrowDown') {
161
+ event.preventDefault();
162
+ this.focusTab((index + 1) % tabs.length);
163
+ } else if (key === 'ArrowLeft' || key === 'ArrowUp') {
164
+ event.preventDefault();
165
+ this.focusTab((index - 1 + tabs.length) % tabs.length);
166
+ } else if (key === 'Home') {
167
+ event.preventDefault();
168
+ this.focusTab(0);
169
+ } else if (key === 'End') {
170
+ event.preventDefault();
171
+ this.focusTab(tabs.length - 1);
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Builds a template context for projected templates.
177
+ */
178
+ buildContext<T = unknown>(item: TabItem<T>, index: number): TabItemContext<T> {
179
+ return {
180
+ $implicit: item,
181
+ item,
182
+ index,
183
+ active: this.isActive(item.id),
184
+ select: () => this.selectAt(index)
185
+ };
186
+ }
187
+
188
+ /**
189
+ * Selects the tab at the given index if enabled and different.
190
+ */
191
+ private selectAt(index: number): void {
192
+ const item = this.viewItems[index];
193
+ if (!item || item.disabled || !item.id || this.isActive(item.id)) {
194
+ return;
195
+ }
196
+ this.setActiveId(item.id, true, item, index);
197
+ }
198
+
199
+ /**
200
+ * Ensures every tab has an id and returns a new items array.
201
+ */
202
+ private normalizeItems(items: TabItem[]): TabItem[] {
203
+ return (items || []).map((item, index) => ({
204
+ ...item,
205
+ id: item.id ?? this.generateId(index)
206
+ }));
207
+ }
208
+
209
+ /**
210
+ * Generates a deterministic id for tabs lacking one.
211
+ */
212
+ private generateId(index: number): string {
213
+ this.uidCounter += 1;
214
+ return `frg-tab-${index}-${this.uidCounter}`;
215
+ }
216
+
217
+ /**
218
+ * Resolves the next active id based on provided preference and availability.
219
+ */
220
+ private resolveActiveId(candidate: string | null): string | null {
221
+ const available = (this.viewItems || []).filter(item => !item.disabled);
222
+ if (!available.length) {
223
+ return null;
224
+ }
225
+ if (candidate && available.some(item => item.id === candidate)) {
226
+ return candidate;
227
+ }
228
+ const preselected = available.find(item => item.active && item.id);
229
+ if (preselected?.id) {
230
+ return preselected.id;
231
+ }
232
+ return available[0].id ?? null;
233
+ }
234
+
235
+ /**
236
+ * Applies the active id, updates view state, emits events, and manages focus.
237
+ */
238
+ private setActiveId(nextId: string | null, emit: boolean, item?: TabItem, index?: number): void {
239
+ const resolved = this.resolveActiveId(nextId);
240
+ this.activeId = resolved;
241
+ this.viewItems = this.viewItems.map(viewItem => ({
242
+ ...viewItem,
243
+ active: resolved ? viewItem.id === resolved : false
244
+ }));
245
+
246
+ if (emit) {
247
+ this.activeIdChange.emit(this.activeId);
248
+ this.changed.emit({
249
+ id: this.activeId,
250
+ index: index ?? this.viewItems.findIndex(viewItem => viewItem.id === this.activeId),
251
+ item
252
+ });
253
+ }
254
+
255
+ if (this.focusPanelOnSelect && resolved) {
256
+ const targetIndex = index ?? this.viewItems.findIndex(viewItem => viewItem.id === resolved);
257
+ if (targetIndex >= 0) {
258
+ setTimeout(() => this.focusPanel(targetIndex), 0);
259
+ }
260
+ }
261
+ }
262
+
263
+ /**
264
+ * Moves focus to the tab at the given index.
265
+ */
266
+ private focusTab(index: number): void {
267
+ const tab = this.tabButtons?.get(index);
268
+ if (tab?.nativeElement) {
269
+ tab.nativeElement.focus();
270
+ }
271
+ }
272
+
273
+ /**
274
+ * Moves focus to the panel at the given index.
275
+ */
276
+ private focusPanel(index: number): void {
277
+ const panel = this.panelBodies?.get(index);
278
+ if (panel?.nativeElement) {
279
+ panel.nativeElement.focus();
280
+ }
281
+ }
282
+ }