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

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 (263) hide show
  1. package/README.md +16 -11
  2. package/assets/styles/scss/_all.scss +0 -1
  3. package/fesm2022/tacdaed-fragments.mjs +8928 -0
  4. package/index.d.ts +3929 -0
  5. package/package.json +34 -22
  6. package/assets/resources/fonts/OpenSans/OpenSans-Italic-VariableFont_wdth_wght.ttf +0 -0
  7. package/assets/resources/fonts/OpenSans/OpenSans-VariableFont_wdth_wght.ttf +0 -0
  8. package/assets/resources/fonts/Roboto/Roboto-Black.ttf +0 -0
  9. package/assets/resources/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
  10. package/assets/resources/fonts/Roboto/Roboto-Bold.ttf +0 -0
  11. package/assets/resources/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
  12. package/assets/resources/fonts/Roboto/Roboto-Italic.ttf +0 -0
  13. package/assets/resources/fonts/Roboto/Roboto-Light.ttf +0 -0
  14. package/assets/resources/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
  15. package/assets/resources/fonts/Roboto/Roboto-Medium.ttf +0 -0
  16. package/assets/resources/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  17. package/assets/resources/fonts/Roboto/Roboto-Regular.ttf +0 -0
  18. package/assets/resources/fonts/Roboto/Roboto-Thin.ttf +0 -0
  19. package/assets/resources/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
  20. package/assets/styles/scss/_fonts.scss +0 -122
  21. package/ng-package.json +0 -20
  22. package/src/lib/components/accordion/accordion.component.html +0 -103
  23. package/src/lib/components/accordion/accordion.component.scss +0 -382
  24. package/src/lib/components/accordion/accordion.component.spec.ts +0 -147
  25. package/src/lib/components/accordion/accordion.component.ts +0 -211
  26. package/src/lib/components/accordion/accordion.type.ts +0 -82
  27. package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -43
  28. package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -112
  29. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +0 -33
  30. package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -103
  31. package/src/lib/components/breadcrumb/breadcrumb.interface.ts +0 -7
  32. package/src/lib/components/button/button.component.html +0 -57
  33. package/src/lib/components/button/button.component.scss +0 -445
  34. package/src/lib/components/button/button.component.spec.ts +0 -99
  35. package/src/lib/components/button/button.component.ts +0 -143
  36. package/src/lib/components/button/button.type.ts +0 -7
  37. package/src/lib/components/card/card.component.html +0 -44
  38. package/src/lib/components/card/card.component.scss +0 -114
  39. package/src/lib/components/card/card.component.spec.ts +0 -65
  40. package/src/lib/components/card/card.component.ts +0 -21
  41. package/src/lib/components/card/card.type.ts +0 -3
  42. package/src/lib/components/code-block/code-block.component.html +0 -55
  43. package/src/lib/components/code-block/code-block.component.scss +0 -122
  44. package/src/lib/components/code-block/code-block.component.spec.ts +0 -81
  45. package/src/lib/components/code-block/code-block.component.ts +0 -302
  46. package/src/lib/components/code-block/code-block.interface.ts +0 -28
  47. package/src/lib/components/code-block/code-block.type.ts +0 -73
  48. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.html +0 -14
  49. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.scss +0 -20
  50. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.spec.ts +0 -38
  51. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.ts +0 -181
  52. package/src/lib/components/input/input-base.ts +0 -187
  53. package/src/lib/components/input/input-calendar/input-calendar.component.html +0 -76
  54. package/src/lib/components/input/input-calendar/input-calendar.component.scss +0 -179
  55. package/src/lib/components/input/input-calendar/input-calendar.component.spec.ts +0 -44
  56. package/src/lib/components/input/input-calendar/input-calendar.component.ts +0 -299
  57. package/src/lib/components/input/input-checkbox/input-checkbox.component.html +0 -37
  58. package/src/lib/components/input/input-checkbox/input-checkbox.component.scss +0 -128
  59. package/src/lib/components/input/input-checkbox/input-checkbox.component.spec.ts +0 -43
  60. package/src/lib/components/input/input-checkbox/input-checkbox.component.ts +0 -112
  61. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.html +0 -43
  62. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.scss +0 -140
  63. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.spec.ts +0 -62
  64. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.ts +0 -136
  65. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.html +0 -81
  66. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.scss +0 -228
  67. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.spec.ts +0 -62
  68. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.ts +0 -178
  69. package/src/lib/components/input/input-consts.ts +0 -132
  70. package/src/lib/components/input/input-date/input-date-validators.ts +0 -41
  71. package/src/lib/components/input/input-date/input-date.component.html +0 -41
  72. package/src/lib/components/input/input-date/input-date.component.scss +0 -95
  73. package/src/lib/components/input/input-date/input-date.component.spec.ts +0 -43
  74. package/src/lib/components/input/input-date/input-date.component.ts +0 -359
  75. package/src/lib/components/input/input-date-time/input-date-time.component.html +0 -70
  76. package/src/lib/components/input/input-date-time/input-date-time.component.scss +0 -133
  77. package/src/lib/components/input/input-date-time/input-date-time.component.spec.ts +0 -36
  78. package/src/lib/components/input/input-date-time/input-date-time.component.ts +0 -387
  79. package/src/lib/components/input/input-file-upload/input-file-upload.component.html +0 -89
  80. package/src/lib/components/input/input-file-upload/input-file-upload.component.scss +0 -171
  81. package/src/lib/components/input/input-file-upload/input-file-upload.component.spec.ts +0 -43
  82. package/src/lib/components/input/input-file-upload/input-file-upload.component.ts +0 -351
  83. package/src/lib/components/input/input-interface.ts +0 -8
  84. package/src/lib/components/input/input-number/input-number-validators.ts +0 -0
  85. package/src/lib/components/input/input-number/input-number.component.html +0 -51
  86. package/src/lib/components/input/input-number/input-number.component.scss +0 -140
  87. package/src/lib/components/input/input-number/input-number.component.spec.ts +0 -44
  88. package/src/lib/components/input/input-number/input-number.component.ts +0 -343
  89. package/src/lib/components/input/input-radio-group/input-radio-group.component.html +0 -44
  90. package/src/lib/components/input/input-radio-group/input-radio-group.component.scss +0 -139
  91. package/src/lib/components/input/input-radio-group/input-radio-group.component.spec.ts +0 -58
  92. package/src/lib/components/input/input-radio-group/input-radio-group.component.ts +0 -132
  93. package/src/lib/components/input/input-slider/input-slider.component.html +0 -111
  94. package/src/lib/components/input/input-slider/input-slider.component.scss +0 -203
  95. package/src/lib/components/input/input-slider/input-slider.component.spec.ts +0 -46
  96. package/src/lib/components/input/input-slider/input-slider.component.ts +0 -410
  97. package/src/lib/components/input/input-text/input-text-validators.ts +0 -67
  98. package/src/lib/components/input/input-text/input-text.component.html +0 -71
  99. package/src/lib/components/input/input-text/input-text.component.scss +0 -118
  100. package/src/lib/components/input/input-text/input-text.component.spec.ts +0 -55
  101. package/src/lib/components/input/input-text/input-text.component.ts +0 -215
  102. package/src/lib/components/input/input-time/input-time-validators.ts +0 -42
  103. package/src/lib/components/input/input-time/input-time.component.html +0 -92
  104. package/src/lib/components/input/input-time/input-time.component.scss +0 -191
  105. package/src/lib/components/input/input-time/input-time.component.spec.ts +0 -39
  106. package/src/lib/components/input/input-time/input-time.component.ts +0 -691
  107. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.html +0 -36
  108. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.scss +0 -121
  109. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.spec.ts +0 -54
  110. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.ts +0 -117
  111. package/src/lib/components/input/input-type.ts +0 -18
  112. package/src/lib/components/input/input-validation/input-validation.component.html +0 -19
  113. package/src/lib/components/input/input-validation/input-validation.component.scss +0 -39
  114. package/src/lib/components/input/input-validation/input-validation.component.spec.ts +0 -45
  115. package/src/lib/components/input/input-validation/input-validation.component.ts +0 -13
  116. package/src/lib/components/input/input.pipe.ts +0 -14
  117. package/src/lib/components/layout/container/container.component.html +0 -1
  118. package/src/lib/components/layout/container/container.component.scss +0 -33
  119. package/src/lib/components/layout/container/container.component.ts +0 -32
  120. package/src/lib/components/layout/container/container.type.ts +0 -1
  121. package/src/lib/components/layout/divider/divider.component.html +0 -1
  122. package/src/lib/components/layout/divider/divider.component.scss +0 -60
  123. package/src/lib/components/layout/divider/divider.component.ts +0 -38
  124. package/src/lib/components/layout/divider/divider.type.ts +0 -2
  125. package/src/lib/components/layout/section/section.component.html +0 -21
  126. package/src/lib/components/layout/section/section.component.scss +0 -43
  127. package/src/lib/components/layout/section/section.component.ts +0 -33
  128. package/src/lib/components/layout/section/section.type.ts +0 -2
  129. package/src/lib/components/layout/separator/separator.component.html +0 -9
  130. package/src/lib/components/layout/separator/separator.component.scss +0 -52
  131. package/src/lib/components/layout/separator/separator.component.ts +0 -25
  132. package/src/lib/components/layout/separator/separator.type.ts +0 -1
  133. package/src/lib/components/loader/content-blur/content-blur.component.html +0 -13
  134. package/src/lib/components/loader/content-blur/content-blur.component.scss +0 -43
  135. package/src/lib/components/loader/content-blur/content-blur.component.spec.ts +0 -42
  136. package/src/lib/components/loader/content-blur/content-blur.component.ts +0 -34
  137. package/src/lib/components/loader/loader.type.ts +0 -2
  138. package/src/lib/components/loader/progress-bar/progress-bar.component.html +0 -26
  139. package/src/lib/components/loader/progress-bar/progress-bar.component.scss +0 -151
  140. package/src/lib/components/loader/progress-bar/progress-bar.component.spec.ts +0 -47
  141. package/src/lib/components/loader/progress-bar/progress-bar.component.ts +0 -28
  142. package/src/lib/components/loader/progress-bar/progress-bar.type.ts +0 -8
  143. package/src/lib/components/loader/pulse-loader/pulse-loader.component.html +0 -12
  144. package/src/lib/components/loader/pulse-loader/pulse-loader.component.scss +0 -202
  145. package/src/lib/components/loader/pulse-loader/pulse-loader.component.spec.ts +0 -55
  146. package/src/lib/components/loader/pulse-loader/pulse-loader.component.ts +0 -73
  147. package/src/lib/components/loader/pulse-loader/pulse-loader.type.ts +0 -6
  148. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.html +0 -13
  149. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.scss +0 -113
  150. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.spec.ts +0 -37
  151. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.ts +0 -51
  152. package/src/lib/components/loader/skeleton-loader/skeleton-loader.type.ts +0 -6
  153. package/src/lib/components/loader/spinner/spinner.component.html +0 -20
  154. package/src/lib/components/loader/spinner/spinner.component.scss +0 -137
  155. package/src/lib/components/loader/spinner/spinner.component.spec.ts +0 -43
  156. package/src/lib/components/loader/spinner/spinner.component.ts +0 -32
  157. package/src/lib/components/loader/spinner/spinner.type.ts +0 -6
  158. package/src/lib/components/modal/modal.component.html +0 -47
  159. package/src/lib/components/modal/modal.component.scss +0 -139
  160. package/src/lib/components/modal/modal.component.spec.ts +0 -60
  161. package/src/lib/components/modal/modal.component.ts +0 -83
  162. package/src/lib/components/modal/modal.type.ts +0 -9
  163. package/src/lib/components/morph/blob-moph/blob-moprh.component.spec.ts +0 -79
  164. package/src/lib/components/morph/blob-moph/blob-moprh.component.ts +0 -96
  165. package/src/lib/components/morph/blob-moph/blob-morph.component.html +0 -34
  166. package/src/lib/components/morph/blob-moph/blob-morph.component.scss +0 -7
  167. package/src/lib/components/morph/morph.abstract.ts +0 -13
  168. package/src/lib/components/pagination/pagination.interface.ts +0 -4
  169. package/src/lib/components/pagination/small-pagination/small-pagination.component.html +0 -61
  170. package/src/lib/components/pagination/small-pagination/small-pagination.component.scss +0 -187
  171. package/src/lib/components/pagination/small-pagination/small-pagination.component.spec.ts +0 -88
  172. package/src/lib/components/pagination/small-pagination/small-pagination.component.ts +0 -177
  173. package/src/lib/components/selection-lists/multi-select/multi-select.component.html +0 -170
  174. package/src/lib/components/selection-lists/multi-select/multi-select.component.scss +0 -312
  175. package/src/lib/components/selection-lists/multi-select/multi-select.component.spec.ts +0 -61
  176. package/src/lib/components/selection-lists/multi-select/multi-select.component.ts +0 -372
  177. package/src/lib/components/selection-lists/selection-list/selection-list.component.html +0 -125
  178. package/src/lib/components/selection-lists/selection-list/selection-list.component.scss +0 -267
  179. package/src/lib/components/selection-lists/selection-list/selection-list.component.spec.ts +0 -66
  180. package/src/lib/components/selection-lists/selection-list/selection-list.component.ts +0 -315
  181. package/src/lib/components/selection-lists/selection-lists-base.ts +0 -35
  182. package/src/lib/components/selection-lists/selection-lists-const.ts +0 -17
  183. package/src/lib/components/selection-lists/selection-lists-interface.ts +0 -7
  184. package/src/lib/components/selection-lists/selection-lists.type.ts +0 -1
  185. package/src/lib/components/side-nav/side-nav.component.html +0 -101
  186. package/src/lib/components/side-nav/side-nav.component.scss +0 -295
  187. package/src/lib/components/side-nav/side-nav.component.spec.ts +0 -0
  188. package/src/lib/components/side-nav/side-nav.component.ts +0 -18
  189. package/src/lib/components/side-nav/side-nav.type.ts +0 -28
  190. package/src/lib/components/snackbar/snackbar.component.html +0 -33
  191. package/src/lib/components/snackbar/snackbar.component.scss +0 -195
  192. package/src/lib/components/snackbar/snackbar.component.ts +0 -112
  193. package/src/lib/components/snackbar/snackbar.type.ts +0 -27
  194. package/src/lib/components/status/chip/chip.component.html +0 -51
  195. package/src/lib/components/status/chip/chip.component.scss +0 -149
  196. package/src/lib/components/status/chip/chip.component.spec.ts +0 -62
  197. package/src/lib/components/status/chip/chip.component.ts +0 -83
  198. package/src/lib/components/status/chip/chip.type.ts +0 -42
  199. package/src/lib/components/status/directives/badge/badge.directive.spec.ts +0 -60
  200. package/src/lib/components/status/directives/badge/badge.directive.ts +0 -190
  201. package/src/lib/components/status/directives/badge/badge.interface.ts +0 -19
  202. package/src/lib/components/status/pill/pill.component.html +0 -40
  203. package/src/lib/components/status/pill/pill.component.scss +0 -113
  204. package/src/lib/components/status/pill/pill.component.spec.ts +0 -47
  205. package/src/lib/components/status/pill/pill.component.ts +0 -83
  206. package/src/lib/components/status/pill/pill.type.ts +0 -42
  207. package/src/lib/components/status/status.interface.ts +0 -57
  208. package/src/lib/components/status/status.type.ts +0 -62
  209. package/src/lib/components/status/tag/tag.component.html +0 -39
  210. package/src/lib/components/status/tag/tag.component.scss +0 -140
  211. package/src/lib/components/status/tag/tag.component.spec.ts +0 -47
  212. package/src/lib/components/status/tag/tag.component.ts +0 -83
  213. package/src/lib/components/status/tag/tag.type.ts +0 -42
  214. package/src/lib/components/stepper/stepper.component.html +0 -83
  215. package/src/lib/components/stepper/stepper.component.scss +0 -196
  216. package/src/lib/components/stepper/stepper.component.ts +0 -482
  217. package/src/lib/components/stepper/stepper.type.ts +0 -60
  218. package/src/lib/components/table/table.component.html +0 -438
  219. package/src/lib/components/table/table.component.scss +0 -259
  220. package/src/lib/components/table/table.component.spec.ts +0 -117
  221. package/src/lib/components/table/table.component.ts +0 -215
  222. package/src/lib/components/table/table.enum.ts +0 -4
  223. package/src/lib/components/table/table.function.ts +0 -47
  224. package/src/lib/components/table/table.interface.ts +0 -143
  225. package/src/lib/components/table/table.pipe.ts +0 -62
  226. package/src/lib/components/table/table.type.ts +0 -15
  227. package/src/lib/components/tabs/tabs.component.html +0 -88
  228. package/src/lib/components/tabs/tabs.component.scss +0 -305
  229. package/src/lib/components/tabs/tabs.component.spec.ts +0 -94
  230. package/src/lib/components/tabs/tabs.component.ts +0 -282
  231. package/src/lib/components/tabs/tabs.type.ts +0 -81
  232. package/src/lib/components/title-bar/title-bar.component.html +0 -21
  233. package/src/lib/components/title-bar/title-bar.component.scss +0 -139
  234. package/src/lib/components/title-bar/title-bar.component.spec.ts +0 -44
  235. package/src/lib/components/title-bar/title-bar.component.ts +0 -13
  236. package/src/lib/components/toast/toast.component.html +0 -36
  237. package/src/lib/components/toast/toast.component.scss +0 -241
  238. package/src/lib/components/toast/toast.component.ts +0 -165
  239. package/src/lib/components/toast/toast.type.ts +0 -37
  240. package/src/lib/components/toast-stack/toast-stack.component.html +0 -30
  241. package/src/lib/components/toast-stack/toast-stack.component.scss +0 -35
  242. package/src/lib/components/toast-stack/toast-stack.component.ts +0 -51
  243. package/src/lib/consts/country-prefix.ts +0 -244
  244. package/src/lib/directives/tooltip/popover.directive.ts +0 -274
  245. package/src/lib/directives/tooltip/tooltip.directive.spec.ts +0 -86
  246. package/src/lib/directives/tooltip/tooltip.directive.ts +0 -234
  247. package/src/lib/directives/tooltip/tooltip.interface.ts +0 -29
  248. package/src/lib/directives/tooltip/tooltip.type.ts +0 -9
  249. package/src/lib/interfaces/common.interfaces.ts +0 -4
  250. package/src/lib/pipes/chunk.pipe.ts +0 -16
  251. package/src/lib/pipes/safe-html.pipe.ts +0 -14
  252. package/src/lib/pipes/sanitize-html.pipe.ts +0 -23
  253. package/src/lib/types/base.types.ts +0 -23
  254. package/src/lib/types/common.types.ts +0 -98
  255. package/src/lib/types/form.types.ts +0 -5
  256. package/src/lib/utils/common.utils.ts +0 -53
  257. package/src/lib/utils/date.utils.ts +0 -474
  258. package/src/lib/utils/number.utils.ts +0 -16
  259. package/src/lib/utils/uuid.utils.ts +0 -39
  260. package/src/public-api.ts +0 -114
  261. package/tsconfig.lib.json +0 -17
  262. package/tsconfig.lib.prod.json +0 -10
  263. package/tsconfig.spec.json +0 -9
@@ -1,55 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { By } from '@angular/platform-browser';
3
- import { InputTextComponent } from './input-text.component';
4
-
5
- describe('InputTextComponent', () => {
6
- let fixture: ComponentFixture<InputTextComponent>;
7
- let component: InputTextComponent;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [InputTextComponent]
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(InputTextComponent);
15
- component = fixture.componentInstance;
16
- });
17
-
18
- it('renders label when provided', () => {
19
- component.label = 'Username';
20
-
21
- fixture.detectChanges();
22
-
23
- const label = fixture.debugElement.query(By.css('label'));
24
- expect(label.nativeElement.textContent).toContain('Username');
25
- });
26
-
27
- it('toggles password visibility', () => {
28
- component.type = 'password';
29
-
30
- fixture.detectChanges();
31
-
32
- const input = fixture.debugElement.query(By.css('input')).nativeElement as HTMLInputElement;
33
- expect(input.type).toBe('password');
34
-
35
- const toggleBtn = fixture.debugElement.query(By.css('.frg-input__toggle-password'));
36
- toggleBtn.nativeElement.click();
37
- fixture.detectChanges();
38
-
39
- expect(input.type).toBe('text');
40
- });
41
-
42
- it('updates value on input', () => {
43
- const onChangeSpy = jasmine.createSpy('onChange');
44
- component.registerOnChange(onChangeSpy);
45
-
46
- fixture.detectChanges();
47
-
48
- const input = fixture.debugElement.query(By.css('input')).nativeElement as HTMLInputElement;
49
- input.value = 'hello';
50
- input.dispatchEvent(new Event('input'));
51
-
52
- expect(component.value).toBe('hello');
53
- expect(onChangeSpy).toHaveBeenCalledWith('hello');
54
- });
55
- });
@@ -1,215 +0,0 @@
1
- import { NgTemplateOutlet } from '@angular/common';
2
- import { Component, Input, OnInit } from '@angular/core';
3
- import { Validators } from '@angular/forms';
4
- import { InputBase } from '../input-base';
5
- import { DEFAULT_INPUT_TEXT_ERROR_MESSAGES, DEFAULT_INPUT_TEXT_WARNINGS_MESSAGES } from '../input-consts';
6
- import { InputTextType } from '../input-type';
7
- import { InputValidationComponent } from '../input-validation/input-validation.component';
8
- import { InputRequiredLabelPipe } from '../input.pipe';
9
- import { phoneNumberValidator, strictEmailValidator, strictPhoneNumberValidator, strictUrlValidator, urlValidator } from './input-text-validators';
10
-
11
- @Component({
12
- selector: 'frg-input-text',
13
- imports: [InputRequiredLabelPipe, NgTemplateOutlet, InputValidationComponent],
14
- templateUrl: './input-text.component.html',
15
- styleUrl: './input-text.component.scss',
16
- })
17
- export class InputTextComponent extends InputBase<string> implements OnInit {
18
- /**
19
- * @inheritdoc
20
- */
21
- @Input() public override label: string = '';
22
- /**
23
- * @inheritdoc
24
- */
25
- @Input() public override placeholder: string = '';
26
- /**
27
- * @inheritdoc
28
- */
29
- @Input() public override required: boolean = false;
30
- /**
31
- * @inheritdoc
32
- */
33
- @Input() public override showValidation: boolean = true;
34
- /**
35
- * @inheritdoc
36
- */
37
- @Input() public override errorMessages: Record<string, string> = {};
38
- /**
39
- * The type of the input element.
40
- * Can be 'text', 'password', 'email', 'tel', etc.
41
- * Defaults to 'text'.
42
- *
43
- * @see InputTextType
44
- */
45
- @Input() public type: InputTextType = 'text';
46
- /**
47
- * Enables strict mode for email validation.
48
- * When set to true, the email validator will use a more stringent pattern.
49
- * Defaults to false.
50
- */
51
- @Input() public validatorStrictMode: boolean = false;
52
-
53
- protected override get errorList(): string[] {
54
- if (!this.control?.errors) return [];
55
- const errors = this.control.errors;
56
- return Object.keys(errors).map(key => {
57
- if (this.errorMessages[key]) {
58
- return this.errorMessages[key];
59
- }
60
-
61
- if (key === 'minlength' && errors[key]?.requiredLength) {
62
- return `Minimum length is ${errors[key].requiredLength} characters.`;
63
- }
64
-
65
- if (key === 'maxlength' && errors[key]?.requiredLength) {
66
- return `Maximum length is ${errors[key].requiredLength} characters.`;
67
- }
68
-
69
- return DEFAULT_INPUT_TEXT_ERROR_MESSAGES[key] || 'Invalid field.';
70
- });
71
- }
72
-
73
- /**
74
- * Handles the blur event on the input element.
75
- * Marks the control as touched.
76
- */
77
- public override onBlur(): void {
78
- this.onTouched();
79
- }
80
-
81
- /**
82
- * Handles the input event on the input element.
83
- * Updates the value and notifies the form control.
84
- */
85
- public override onInput(event: Event): void {
86
- const input = event.target as HTMLInputElement;
87
- this.value = input.value;
88
- this.onChange(this.value);
89
- }
90
-
91
- /**
92
- * @inheritdoc
93
- */
94
- public override ngOnInit(): void {
95
- super.ngOnInit();
96
- if (this.type === 'email' && this.control) {
97
- this.validateEmail();
98
- }
99
- if (this.type === 'tel' && this.control) {
100
- this.validatePhoneNumber();
101
- }
102
- if (this.type === 'url' && this.control){
103
- this.validateUrl();
104
- }
105
- }
106
-
107
- /**
108
- * @inheritdoc
109
- */
110
- protected updateView(_value: string | null): void {
111
- // Handled by Angular binding
112
- }
113
-
114
- /**
115
- * @inheritdoc
116
- */
117
- protected updateDisabledState(_isDisabled: boolean): void {
118
- // Handled by Angular binding
119
- }
120
-
121
- /**
122
- * Indicates whether the password is visible or hidden.
123
- *
124
- * Used only when the input type is 'password'.
125
- */
126
- protected showPassword: boolean = false;
127
-
128
- /**
129
- * Determines the actual input type to be used in the template.
130
- * If the type is 'password', it toggles between 'text' and 'password'
131
- * based on the showPassword property.
132
- *
133
- * @returns The input type as a string.
134
- */
135
- public get inputType(): string {
136
- if (this.type === 'password') {
137
- return this.showPassword ? 'text' : 'password';
138
- }
139
- return this.type;
140
- }
141
-
142
- /**
143
- * Returns warning messages. Consumers may pass arbitrary warnings via `warningMessages`.
144
- * Falls back to DEFAULT_INPUT_TEXT_WARNINGS_MESSAGES or a generic message.
145
- */
146
- protected override get warningList(): string[] {
147
- return Object.keys(this.warningMessages).map(key => {
148
- return (
149
- this.warningMessages[key] ||
150
- DEFAULT_INPUT_TEXT_WARNINGS_MESSAGES[key] ||
151
- ''
152
- );
153
- });
154
- }
155
-
156
- /**
157
- * Returns whether any warnings are active.
158
- */
159
- protected get hasWarning(): boolean {
160
- return this.warningList.length > 0;
161
- }
162
-
163
- /**
164
- * Toggles the visibility of the password input field.
165
- * This method switches the input type between 'text' and 'password'.
166
- *
167
- * Used only when the input type is 'password'.
168
- */
169
- protected toggleShowPassword(): void {
170
- this.showPassword = !this.showPassword;
171
- }
172
-
173
- /**
174
- * Adds email validator to the control if the type is 'email'.
175
- * This ensures that the input value is a valid email address.
176
- */
177
- private validateEmail(): void {
178
- const existingValidators = this.control?.validator
179
- ? [this.control.validator]
180
- : [];
181
-
182
- this.control?.setValidators([
183
- ...existingValidators,
184
- this.validatorStrictMode ? strictEmailValidator() : Validators.email
185
- ]);
186
-
187
- this.control?.updateValueAndValidity();
188
- }
189
-
190
- private validatePhoneNumber(): void {
191
- const existingValidators = this.control?.validator
192
- ? [this.control.validator]
193
- : [];
194
-
195
- this.control?.setValidators([
196
- ...existingValidators,
197
- this.validatorStrictMode ? strictPhoneNumberValidator() : phoneNumberValidator()
198
- ]);
199
-
200
- this.control?.updateValueAndValidity();
201
- }
202
-
203
- private validateUrl(): void {
204
- const existingValidators = this.control?.validator
205
- ? [this.control.validator]
206
- : [];
207
-
208
- this.control?.setValidators([
209
- ...existingValidators,
210
- this.validatorStrictMode ? strictUrlValidator() : urlValidator()
211
- ]);
212
-
213
- this.control?.updateValueAndValidity();
214
- }
215
- }
@@ -1,42 +0,0 @@
1
- import { AbstractControl, ValidationErrors, ValidatorFn } from "@angular/forms";
2
- import { parseTimeToMinutes } from "../../../utils/date.utils";
3
-
4
- export function minTime(min: string): ValidatorFn {
5
- return (control: AbstractControl): ValidationErrors | null => {
6
- const value = control.value as string | null;
7
- if (!value) return null;
8
-
9
- const minMinutes = parseTimeToMinutes(min);
10
- const valueMinutes = parseTimeToMinutes(value);
11
-
12
- if (minMinutes === null || valueMinutes === null) {
13
- return { invalidFormat: true };
14
- }
15
-
16
- if (valueMinutes < minMinutes) {
17
- return { min: true };
18
- }
19
-
20
- return null;
21
- };
22
- }
23
-
24
- export function maxTime(max: string): ValidatorFn {
25
- return (control: AbstractControl): ValidationErrors | null => {
26
- const value = control.value as string | null;
27
- if (!value) return null;
28
-
29
- const maxMinutes = parseTimeToMinutes(max);
30
- const valueMinutes = parseTimeToMinutes(value);
31
-
32
- if (maxMinutes === null || valueMinutes === null) {
33
- return { invalidFormat: true };
34
- }
35
-
36
- if (valueMinutes > maxMinutes) {
37
- return { max: true };
38
- }
39
-
40
- return null;
41
- };
42
- }
@@ -1,92 +0,0 @@
1
- <div class="frg-input__wrapper"
2
- [class.input-error]="hasError"
3
- [class.input-warning]="hasWarning"
4
- >
5
- @if(label){
6
- <label [for]="id + '-full'">{{ label | inputRequiredLabel: required }}</label>
7
- }
8
- <div class="frg-input__field">
9
- @if(format.includes('HH') || format.includes('hh')) {
10
- <ng-container *ngTemplateOutlet="timeControl; context:{partial:'hour', min:minHour, max:maxHour, placeholder: format.includes('HH') ? 'HH' : 'hh'}"></ng-container>
11
- }
12
-
13
- @if(format.includes('mm')) {
14
- <span class="colon-seprator">:</span>
15
- <ng-container *ngTemplateOutlet="timeControl; context:{partial:'minute', min:minMinute, max:maxMinute, placeholder:'mm'}"></ng-container>
16
- }
17
-
18
- @if(format.includes('ss')) {
19
- <span class="colon-seprator">:</span>
20
- <ng-container *ngTemplateOutlet="timeControl; context:{partial:'second', min:minSecond, max:maxSecond, placeholder:'ss'}"></ng-container>
21
- }
22
-
23
- @if(format.includes('a')) {
24
- <div class="frg-input__time__container frg-input__time__meridiem">
25
- <input
26
- [id]="id + '-meridiem'"
27
- [attr.data-partialTime]="'meridiem'"
28
- type="checkbox"
29
- tabindex="0"
30
- role="switch"
31
- [checked]="formatTime(value, 'meridiem') === 'PM'"
32
- aria-checked="{{ formatTime(value, 'meridiem') === 'PM' }}"
33
- placeholder="AM/PM"
34
- [required]="required"
35
- [disabled]="disabled"
36
- (blur)="onBlur($event)"
37
- (focus)="onFocus($event)"
38
- (change)="onInput($event)"
39
- (keydown.enter)="onKeydown($event)"
40
- />
41
- </div>
42
- <span class="focus-line"></span>
43
-
44
- }
45
-
46
- <input type="text" [id]="id + '-full'" [value]="value" hidden />
47
- </div>
48
-
49
- @if(showValidation) {
50
- <frg-input-validation
51
- [errorList]="errorList"
52
- [warningList]="warningList"
53
- [isFormInvalid]="hasError"
54
- ></frg-input-validation>
55
- }
56
- </div>
57
-
58
- <ng-template #timeControl let-partial="partial" let-min="min" let-max="max" let-placeholder="placeholder">
59
- <div class="frg-input__time__container" [ngClass]="'frg-input__time__' + partial">
60
- <button
61
- type="button"
62
- class="frg-input__time__arrow frg-input__time__arrow--increment"
63
- (click)="increase(partial)"
64
- aria-label="Increase value"
65
- >
66
- <span class="fas fa-chevron-up"></span>
67
- </button>
68
- <input
69
- [id]="id + '-' + partial"
70
- [attr.data-partialTime]="partial"
71
- type="number"
72
- [placeholder]="placeholder"
73
- [min]="min"
74
- [max]="max"
75
- [required]="required"
76
- [disabled]="disabled"
77
- [value]="formatTime(value, partial) !== placeholder ? formatTime(value, partial) : ''"
78
- (blur)="onBlur($event)"
79
- (focus)="onFocus($event)"
80
- (input)="onInput($event)"
81
- />
82
- <span class="focus-line"></span>
83
- <button
84
- type="button"
85
- class="frg-input__time__arrow frg-input__time__arrow--decrement"
86
- (click)="decrease(partial)"
87
- aria-label="Decrease value"
88
- >
89
- <span class="fas fa-chevron-down"></span>
90
- </button>
91
- </div>
92
- </ng-template>
@@ -1,191 +0,0 @@
1
- @use "sass:color";
2
- @use './../../../../../assets/styles/scss/variables' as *;
3
-
4
- :host {
5
- display: block;
6
-
7
- input::-webkit-outer-spin-button,
8
- input::-webkit-inner-spin-button {
9
- -webkit-appearance: none;
10
- margin: 0;
11
- }
12
-
13
- .frg-input {
14
- &__wrapper {
15
- position: relative;
16
- box-sizing: border-box;
17
-
18
- label {
19
- font-size: $font-size-xs;
20
- color: $input-text-color;
21
- display: block;
22
- padding: $input-padding;
23
- }
24
-
25
- &.input-error label {
26
- color: $color-danger;
27
- }
28
-
29
- &.input-warning label {
30
- color: $color-warning;
31
- }
32
- }
33
-
34
- &__field {
35
- display: inline-flex;
36
- justify-content: center;
37
- align-items: center;
38
-
39
- input[type="number"],
40
- input[type="number"]:focus,
41
- input[type="number"]:focus-visible {
42
- border: none;
43
- outline: none;
44
- }
45
-
46
- input[type="number"] {
47
- background: transparent;
48
- text-align: center;
49
- padding: 0.5rem 0;
50
- letter-spacing: .1rem;
51
- font-size: $font-size-md;
52
- font-weight: 600;
53
- color: $color-dark-soft;
54
- display: block;
55
- }
56
-
57
- .partial-label {
58
- display: block;
59
- font-size: $font-size-xs;
60
- text-transform: capitalize;
61
- width: 100%;
62
- text-align: center;
63
- color: $color-dark-soft;
64
- }
65
-
66
- .colon-seprator {
67
- display: flex;
68
- align-items: center;
69
- justify-content: center;
70
- font-size: $font-size-md;
71
- font-weight: 600;
72
- }
73
- }
74
-
75
- &__time {
76
- &__container {
77
- display: flex;
78
- flex-direction: column;
79
- align-items: center;
80
-
81
- .focus-line {
82
- display: block;
83
- width: 50%;
84
- margin: 0 auto;
85
- height: 2px;
86
- background-color: $color-primary;
87
- transform: scaleX(0);
88
- transform-origin: left center;
89
- transition: transform 0.2s ease, background-color 0.2s ease;
90
- }
91
-
92
- &:focus-within .focus-line {
93
- transform: scaleX(1);
94
- }
95
-
96
- .frg-input__wrapper.input-error & .focus-line {
97
- background-color: $color-danger;
98
- transform: scaleX(1);
99
- }
100
-
101
- .frg-input__wrapper.input-warning & .focus-line {
102
- background-color: $color-warning;
103
- transform: scaleX(1);
104
- }
105
- }
106
-
107
- &__meridiem {
108
- position: relative;
109
- width: 3.5rem;
110
- height: 1.5rem;
111
-
112
- input[type="checkbox"] {
113
- appearance: none;
114
- -webkit-appearance: none;
115
- width: 100%;
116
- height: 100%;
117
- border-radius: 0.25rem;
118
- background-color: $color-light-soft;
119
- cursor: pointer;
120
- position: relative;
121
- overflow: hidden;
122
- transition: background-color 0.25s ease;
123
-
124
- &:focus {
125
- outline: none;
126
- }
127
-
128
- &:focus-visible {
129
- outline-offset: 0.25rem;
130
- outline: 2px solid $color-dark-neutral;
131
- box-shadow: 0 0 0 2px rgba($color-primary, 0.2);
132
-
133
- .frg-input__wrapper.input-error & {
134
- outline-color: $color-danger;
135
- box-shadow: 0 0 0 2px rgba($color-danger, 0.2);
136
- }
137
-
138
- .frg-input__wrapper.input-warning & {
139
- outline-color: $color-warning;
140
- box-shadow: 0 0 0 2px rgba($color-warning, 0.2);
141
- }
142
- }
143
-
144
- &:before,
145
- &:after {
146
- content: "AM";
147
- position: absolute;
148
- top: 50%;
149
- left: 50%;
150
- transform: translate(-50%, -50%);
151
- font-size: $font-size-md;
152
- font-weight: 600;
153
- color: $color-dark-neutral;
154
- transition: transform 0.25s ease, opacity 0.25s ease;
155
- }
156
-
157
- &:after {
158
- content: "PM";
159
- opacity: 0;
160
- transform: translate(-50%, 150%);
161
- color: $color-light;
162
- }
163
-
164
- &:checked {
165
- background-color: $color-primary;
166
-
167
- &:before {
168
- transform: translate(-50%, -150%);
169
- opacity: 0;
170
- }
171
-
172
- &:after {
173
- transform: translate(-50%, -50%);
174
- opacity: 1;
175
- }
176
- }
177
- }
178
- }
179
-
180
- &__arrow {
181
- background: transparent;
182
- color: $color-dark-neutral;
183
- border: none;
184
- display: block;
185
- width: 100%;
186
- padding: 0 0.5rem;
187
- cursor: pointer;
188
- }
189
- }
190
- }
191
- }
@@ -1,39 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { By } from '@angular/platform-browser';
3
- import { InputTimeComponent } from './input-time.component';
4
-
5
- describe('InputTimeComponent', () => {
6
- let fixture: ComponentFixture<InputTimeComponent>;
7
- let component: InputTimeComponent;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [InputTimeComponent]
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(InputTimeComponent);
15
- component = fixture.componentInstance;
16
- });
17
-
18
- it('renders hour and minute inputs', () => {
19
- fixture.detectChanges();
20
-
21
- const hour = fixture.debugElement.query(By.css('input[id$="-hour"]'));
22
- const minute = fixture.debugElement.query(By.css('input[id$="-minute"]'));
23
-
24
- expect(hour).toBeTruthy();
25
- expect(minute).toBeTruthy();
26
- });
27
-
28
- it('increments hour when clicking the first increment button', () => {
29
- component.value = '10:15';
30
-
31
- fixture.detectChanges();
32
-
33
- const buttons = fixture.debugElement.queryAll(By.css('.frg-input__time__arrow--increment'));
34
- buttons[0].nativeElement.click();
35
- fixture.detectChanges();
36
-
37
- expect(component.value).toBe('11:15');
38
- });
39
- });