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

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 +4 -20
  2. package/fesm2022/tacdaed-fragments.mjs +8928 -0
  3. package/fesm2022/tacdaed-fragments.mjs.map +1 -0
  4. package/index.d.ts +3929 -0
  5. package/package.json +29 -22
  6. package/ng-package.json +0 -25
  7. package/src/lib/components/accordion/accordion.component.html +0 -103
  8. package/src/lib/components/accordion/accordion.component.scss +0 -382
  9. package/src/lib/components/accordion/accordion.component.spec.ts +0 -147
  10. package/src/lib/components/accordion/accordion.component.ts +0 -211
  11. package/src/lib/components/accordion/accordion.type.ts +0 -82
  12. package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -43
  13. package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -112
  14. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +0 -33
  15. package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -103
  16. package/src/lib/components/breadcrumb/breadcrumb.interface.ts +0 -7
  17. package/src/lib/components/button/button.component.html +0 -57
  18. package/src/lib/components/button/button.component.scss +0 -445
  19. package/src/lib/components/button/button.component.spec.ts +0 -99
  20. package/src/lib/components/button/button.component.ts +0 -143
  21. package/src/lib/components/button/button.type.ts +0 -7
  22. package/src/lib/components/card/card.component.html +0 -44
  23. package/src/lib/components/card/card.component.scss +0 -114
  24. package/src/lib/components/card/card.component.spec.ts +0 -65
  25. package/src/lib/components/card/card.component.ts +0 -21
  26. package/src/lib/components/card/card.type.ts +0 -3
  27. package/src/lib/components/code-block/code-block.component.html +0 -55
  28. package/src/lib/components/code-block/code-block.component.scss +0 -122
  29. package/src/lib/components/code-block/code-block.component.spec.ts +0 -81
  30. package/src/lib/components/code-block/code-block.component.ts +0 -302
  31. package/src/lib/components/code-block/code-block.interface.ts +0 -28
  32. package/src/lib/components/code-block/code-block.type.ts +0 -73
  33. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.html +0 -14
  34. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.scss +0 -20
  35. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.spec.ts +0 -38
  36. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.ts +0 -181
  37. package/src/lib/components/input/input-base.ts +0 -187
  38. package/src/lib/components/input/input-calendar/input-calendar.component.html +0 -76
  39. package/src/lib/components/input/input-calendar/input-calendar.component.scss +0 -179
  40. package/src/lib/components/input/input-calendar/input-calendar.component.spec.ts +0 -44
  41. package/src/lib/components/input/input-calendar/input-calendar.component.ts +0 -299
  42. package/src/lib/components/input/input-checkbox/input-checkbox.component.html +0 -37
  43. package/src/lib/components/input/input-checkbox/input-checkbox.component.scss +0 -128
  44. package/src/lib/components/input/input-checkbox/input-checkbox.component.spec.ts +0 -43
  45. package/src/lib/components/input/input-checkbox/input-checkbox.component.ts +0 -112
  46. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.html +0 -43
  47. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.scss +0 -140
  48. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.spec.ts +0 -62
  49. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.ts +0 -136
  50. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.html +0 -81
  51. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.scss +0 -228
  52. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.spec.ts +0 -62
  53. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.ts +0 -178
  54. package/src/lib/components/input/input-consts.ts +0 -132
  55. package/src/lib/components/input/input-date/input-date-validators.ts +0 -41
  56. package/src/lib/components/input/input-date/input-date.component.html +0 -41
  57. package/src/lib/components/input/input-date/input-date.component.scss +0 -95
  58. package/src/lib/components/input/input-date/input-date.component.spec.ts +0 -43
  59. package/src/lib/components/input/input-date/input-date.component.ts +0 -359
  60. package/src/lib/components/input/input-date-time/input-date-time.component.html +0 -70
  61. package/src/lib/components/input/input-date-time/input-date-time.component.scss +0 -133
  62. package/src/lib/components/input/input-date-time/input-date-time.component.spec.ts +0 -36
  63. package/src/lib/components/input/input-date-time/input-date-time.component.ts +0 -387
  64. package/src/lib/components/input/input-file-upload/input-file-upload.component.html +0 -89
  65. package/src/lib/components/input/input-file-upload/input-file-upload.component.scss +0 -171
  66. package/src/lib/components/input/input-file-upload/input-file-upload.component.spec.ts +0 -43
  67. package/src/lib/components/input/input-file-upload/input-file-upload.component.ts +0 -351
  68. package/src/lib/components/input/input-interface.ts +0 -8
  69. package/src/lib/components/input/input-number/input-number-validators.ts +0 -0
  70. package/src/lib/components/input/input-number/input-number.component.html +0 -51
  71. package/src/lib/components/input/input-number/input-number.component.scss +0 -140
  72. package/src/lib/components/input/input-number/input-number.component.spec.ts +0 -44
  73. package/src/lib/components/input/input-number/input-number.component.ts +0 -343
  74. package/src/lib/components/input/input-radio-group/input-radio-group.component.html +0 -44
  75. package/src/lib/components/input/input-radio-group/input-radio-group.component.scss +0 -139
  76. package/src/lib/components/input/input-radio-group/input-radio-group.component.spec.ts +0 -58
  77. package/src/lib/components/input/input-radio-group/input-radio-group.component.ts +0 -132
  78. package/src/lib/components/input/input-slider/input-slider.component.html +0 -111
  79. package/src/lib/components/input/input-slider/input-slider.component.scss +0 -203
  80. package/src/lib/components/input/input-slider/input-slider.component.spec.ts +0 -46
  81. package/src/lib/components/input/input-slider/input-slider.component.ts +0 -410
  82. package/src/lib/components/input/input-text/input-text-validators.ts +0 -67
  83. package/src/lib/components/input/input-text/input-text.component.html +0 -71
  84. package/src/lib/components/input/input-text/input-text.component.scss +0 -118
  85. package/src/lib/components/input/input-text/input-text.component.spec.ts +0 -55
  86. package/src/lib/components/input/input-text/input-text.component.ts +0 -215
  87. package/src/lib/components/input/input-time/input-time-validators.ts +0 -42
  88. package/src/lib/components/input/input-time/input-time.component.html +0 -92
  89. package/src/lib/components/input/input-time/input-time.component.scss +0 -191
  90. package/src/lib/components/input/input-time/input-time.component.spec.ts +0 -39
  91. package/src/lib/components/input/input-time/input-time.component.ts +0 -691
  92. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.html +0 -36
  93. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.scss +0 -121
  94. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.spec.ts +0 -54
  95. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.ts +0 -117
  96. package/src/lib/components/input/input-type.ts +0 -18
  97. package/src/lib/components/input/input-validation/input-validation.component.html +0 -19
  98. package/src/lib/components/input/input-validation/input-validation.component.scss +0 -39
  99. package/src/lib/components/input/input-validation/input-validation.component.spec.ts +0 -45
  100. package/src/lib/components/input/input-validation/input-validation.component.ts +0 -13
  101. package/src/lib/components/input/input.pipe.ts +0 -14
  102. package/src/lib/components/layout/container/container.component.html +0 -1
  103. package/src/lib/components/layout/container/container.component.scss +0 -33
  104. package/src/lib/components/layout/container/container.component.ts +0 -32
  105. package/src/lib/components/layout/container/container.type.ts +0 -1
  106. package/src/lib/components/layout/divider/divider.component.html +0 -1
  107. package/src/lib/components/layout/divider/divider.component.scss +0 -60
  108. package/src/lib/components/layout/divider/divider.component.ts +0 -38
  109. package/src/lib/components/layout/divider/divider.type.ts +0 -2
  110. package/src/lib/components/layout/section/section.component.html +0 -21
  111. package/src/lib/components/layout/section/section.component.scss +0 -43
  112. package/src/lib/components/layout/section/section.component.ts +0 -33
  113. package/src/lib/components/layout/section/section.type.ts +0 -2
  114. package/src/lib/components/layout/separator/separator.component.html +0 -9
  115. package/src/lib/components/layout/separator/separator.component.scss +0 -52
  116. package/src/lib/components/layout/separator/separator.component.ts +0 -25
  117. package/src/lib/components/layout/separator/separator.type.ts +0 -1
  118. package/src/lib/components/loader/content-blur/content-blur.component.html +0 -13
  119. package/src/lib/components/loader/content-blur/content-blur.component.scss +0 -43
  120. package/src/lib/components/loader/content-blur/content-blur.component.spec.ts +0 -42
  121. package/src/lib/components/loader/content-blur/content-blur.component.ts +0 -34
  122. package/src/lib/components/loader/loader.type.ts +0 -2
  123. package/src/lib/components/loader/progress-bar/progress-bar.component.html +0 -26
  124. package/src/lib/components/loader/progress-bar/progress-bar.component.scss +0 -151
  125. package/src/lib/components/loader/progress-bar/progress-bar.component.spec.ts +0 -47
  126. package/src/lib/components/loader/progress-bar/progress-bar.component.ts +0 -28
  127. package/src/lib/components/loader/progress-bar/progress-bar.type.ts +0 -8
  128. package/src/lib/components/loader/pulse-loader/pulse-loader.component.html +0 -12
  129. package/src/lib/components/loader/pulse-loader/pulse-loader.component.scss +0 -202
  130. package/src/lib/components/loader/pulse-loader/pulse-loader.component.spec.ts +0 -55
  131. package/src/lib/components/loader/pulse-loader/pulse-loader.component.ts +0 -73
  132. package/src/lib/components/loader/pulse-loader/pulse-loader.type.ts +0 -6
  133. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.html +0 -13
  134. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.scss +0 -113
  135. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.spec.ts +0 -37
  136. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.ts +0 -51
  137. package/src/lib/components/loader/skeleton-loader/skeleton-loader.type.ts +0 -6
  138. package/src/lib/components/loader/spinner/spinner.component.html +0 -20
  139. package/src/lib/components/loader/spinner/spinner.component.scss +0 -137
  140. package/src/lib/components/loader/spinner/spinner.component.spec.ts +0 -43
  141. package/src/lib/components/loader/spinner/spinner.component.ts +0 -32
  142. package/src/lib/components/loader/spinner/spinner.type.ts +0 -6
  143. package/src/lib/components/modal/modal.component.html +0 -47
  144. package/src/lib/components/modal/modal.component.scss +0 -139
  145. package/src/lib/components/modal/modal.component.spec.ts +0 -60
  146. package/src/lib/components/modal/modal.component.ts +0 -83
  147. package/src/lib/components/modal/modal.type.ts +0 -9
  148. package/src/lib/components/morph/blob-moph/blob-moprh.component.spec.ts +0 -79
  149. package/src/lib/components/morph/blob-moph/blob-moprh.component.ts +0 -96
  150. package/src/lib/components/morph/blob-moph/blob-morph.component.html +0 -34
  151. package/src/lib/components/morph/blob-moph/blob-morph.component.scss +0 -7
  152. package/src/lib/components/morph/morph.abstract.ts +0 -13
  153. package/src/lib/components/pagination/pagination.interface.ts +0 -4
  154. package/src/lib/components/pagination/small-pagination/small-pagination.component.html +0 -61
  155. package/src/lib/components/pagination/small-pagination/small-pagination.component.scss +0 -187
  156. package/src/lib/components/pagination/small-pagination/small-pagination.component.spec.ts +0 -88
  157. package/src/lib/components/pagination/small-pagination/small-pagination.component.ts +0 -177
  158. package/src/lib/components/selection-lists/multi-select/multi-select.component.html +0 -170
  159. package/src/lib/components/selection-lists/multi-select/multi-select.component.scss +0 -312
  160. package/src/lib/components/selection-lists/multi-select/multi-select.component.spec.ts +0 -61
  161. package/src/lib/components/selection-lists/multi-select/multi-select.component.ts +0 -372
  162. package/src/lib/components/selection-lists/selection-list/selection-list.component.html +0 -125
  163. package/src/lib/components/selection-lists/selection-list/selection-list.component.scss +0 -267
  164. package/src/lib/components/selection-lists/selection-list/selection-list.component.spec.ts +0 -66
  165. package/src/lib/components/selection-lists/selection-list/selection-list.component.ts +0 -315
  166. package/src/lib/components/selection-lists/selection-lists-base.ts +0 -35
  167. package/src/lib/components/selection-lists/selection-lists-const.ts +0 -17
  168. package/src/lib/components/selection-lists/selection-lists-interface.ts +0 -7
  169. package/src/lib/components/selection-lists/selection-lists.type.ts +0 -1
  170. package/src/lib/components/side-nav/side-nav.component.html +0 -101
  171. package/src/lib/components/side-nav/side-nav.component.scss +0 -295
  172. package/src/lib/components/side-nav/side-nav.component.spec.ts +0 -0
  173. package/src/lib/components/side-nav/side-nav.component.ts +0 -18
  174. package/src/lib/components/side-nav/side-nav.type.ts +0 -28
  175. package/src/lib/components/snackbar/snackbar.component.html +0 -33
  176. package/src/lib/components/snackbar/snackbar.component.scss +0 -195
  177. package/src/lib/components/snackbar/snackbar.component.ts +0 -112
  178. package/src/lib/components/snackbar/snackbar.type.ts +0 -27
  179. package/src/lib/components/status/chip/chip.component.html +0 -51
  180. package/src/lib/components/status/chip/chip.component.scss +0 -149
  181. package/src/lib/components/status/chip/chip.component.spec.ts +0 -62
  182. package/src/lib/components/status/chip/chip.component.ts +0 -83
  183. package/src/lib/components/status/chip/chip.type.ts +0 -42
  184. package/src/lib/components/status/directives/badge/badge.directive.spec.ts +0 -60
  185. package/src/lib/components/status/directives/badge/badge.directive.ts +0 -190
  186. package/src/lib/components/status/directives/badge/badge.interface.ts +0 -19
  187. package/src/lib/components/status/pill/pill.component.html +0 -40
  188. package/src/lib/components/status/pill/pill.component.scss +0 -113
  189. package/src/lib/components/status/pill/pill.component.spec.ts +0 -47
  190. package/src/lib/components/status/pill/pill.component.ts +0 -83
  191. package/src/lib/components/status/pill/pill.type.ts +0 -42
  192. package/src/lib/components/status/status.interface.ts +0 -57
  193. package/src/lib/components/status/status.type.ts +0 -62
  194. package/src/lib/components/status/tag/tag.component.html +0 -39
  195. package/src/lib/components/status/tag/tag.component.scss +0 -140
  196. package/src/lib/components/status/tag/tag.component.spec.ts +0 -47
  197. package/src/lib/components/status/tag/tag.component.ts +0 -83
  198. package/src/lib/components/status/tag/tag.type.ts +0 -42
  199. package/src/lib/components/stepper/stepper.component.html +0 -83
  200. package/src/lib/components/stepper/stepper.component.scss +0 -196
  201. package/src/lib/components/stepper/stepper.component.ts +0 -482
  202. package/src/lib/components/stepper/stepper.type.ts +0 -60
  203. package/src/lib/components/table/table.component.html +0 -438
  204. package/src/lib/components/table/table.component.scss +0 -259
  205. package/src/lib/components/table/table.component.spec.ts +0 -117
  206. package/src/lib/components/table/table.component.ts +0 -215
  207. package/src/lib/components/table/table.enum.ts +0 -4
  208. package/src/lib/components/table/table.function.ts +0 -47
  209. package/src/lib/components/table/table.interface.ts +0 -143
  210. package/src/lib/components/table/table.pipe.ts +0 -62
  211. package/src/lib/components/table/table.type.ts +0 -15
  212. package/src/lib/components/tabs/tabs.component.html +0 -88
  213. package/src/lib/components/tabs/tabs.component.scss +0 -305
  214. package/src/lib/components/tabs/tabs.component.spec.ts +0 -94
  215. package/src/lib/components/tabs/tabs.component.ts +0 -282
  216. package/src/lib/components/tabs/tabs.type.ts +0 -81
  217. package/src/lib/components/title-bar/title-bar.component.html +0 -21
  218. package/src/lib/components/title-bar/title-bar.component.scss +0 -139
  219. package/src/lib/components/title-bar/title-bar.component.spec.ts +0 -44
  220. package/src/lib/components/title-bar/title-bar.component.ts +0 -13
  221. package/src/lib/components/toast/toast.component.html +0 -36
  222. package/src/lib/components/toast/toast.component.scss +0 -241
  223. package/src/lib/components/toast/toast.component.ts +0 -165
  224. package/src/lib/components/toast/toast.type.ts +0 -37
  225. package/src/lib/components/toast-stack/toast-stack.component.html +0 -30
  226. package/src/lib/components/toast-stack/toast-stack.component.scss +0 -35
  227. package/src/lib/components/toast-stack/toast-stack.component.ts +0 -51
  228. package/src/lib/consts/country-prefix.ts +0 -244
  229. package/src/lib/directives/tooltip/popover.directive.ts +0 -274
  230. package/src/lib/directives/tooltip/tooltip.directive.spec.ts +0 -86
  231. package/src/lib/directives/tooltip/tooltip.directive.ts +0 -234
  232. package/src/lib/directives/tooltip/tooltip.interface.ts +0 -29
  233. package/src/lib/directives/tooltip/tooltip.type.ts +0 -9
  234. package/src/lib/interfaces/common.interfaces.ts +0 -4
  235. package/src/lib/pipes/chunk.pipe.ts +0 -16
  236. package/src/lib/pipes/safe-html.pipe.ts +0 -14
  237. package/src/lib/pipes/sanitize-html.pipe.ts +0 -23
  238. package/src/lib/types/base.types.ts +0 -23
  239. package/src/lib/types/common.types.ts +0 -98
  240. package/src/lib/types/form.types.ts +0 -5
  241. package/src/lib/utils/common.utils.ts +0 -53
  242. package/src/lib/utils/date.utils.ts +0 -474
  243. package/src/lib/utils/number.utils.ts +0 -16
  244. package/src/lib/utils/uuid.utils.ts +0 -39
  245. package/src/public-api.ts +0 -114
  246. package/tsconfig.lib.json +0 -17
  247. package/tsconfig.lib.prod.json +0 -10
  248. package/tsconfig.spec.json +0 -9
@@ -1,359 +0,0 @@
1
- import { AsyncPipe } from '@angular/common';
2
- import { Component, HostListener, Input } from '@angular/core';
3
- import { Validators } from '@angular/forms';
4
- import { BehaviorSubject } from 'rxjs';
5
- import { DateFormat } from '../../../types/common.types';
6
- import { buildDateFormatRegex, convertStringToDate, formatDateToString, isValidDate } from '../../../utils/date.utils';
7
- import { InputBase } from '../input-base';
8
- import { InputCalendarComponent } from '../input-calendar/input-calendar.component';
9
- import { DEFAULT_INPUT_DATE_ERROR_MESSAGES, DEFAULT_INPUT_DATE_WARNINGS_MESSAGES } from '../input-consts';
10
- import { InputDateType } from '../input-type';
11
- import { InputValidationComponent } from '../input-validation/input-validation.component';
12
- import { InputRequiredLabelPipe } from '../input.pipe';
13
- import { maxDate, minDate } from './input-date-validators';
14
-
15
- @Component({
16
- selector: 'frg-input-date',
17
- imports: [InputValidationComponent, InputRequiredLabelPipe, InputCalendarComponent, AsyncPipe],
18
- templateUrl: './input-date.component.html',
19
- styleUrl: './input-date.component.scss',
20
- })
21
- export class InputDateComponent extends InputBase<Date | null> {
22
-
23
- @HostListener('document:click', ['$event'])
24
- onDocumentClick(event: MouseEvent) {
25
- const target = event.target as HTMLElement;
26
-
27
- if (!target.closest('.frg-input__wrapper')) {
28
- this.showCalendar$.next(false);
29
- }
30
- }
31
-
32
- /**
33
- * @inheritdoc
34
- */
35
- @Input() public override label: string = '';
36
- /**
37
- * @inheritdoc
38
- */
39
- @Input() public override placeholder: string = '';
40
- /**
41
- * @inheritdoc
42
- */
43
- @Input() public override required: boolean = false;
44
- /**
45
- * @inheritdoc
46
- */
47
- @Input() public override showValidation: boolean = true;
48
- /**
49
- * @inheritdoc
50
- */
51
- @Input() public override errorMessages: Record<string, string> = {};
52
- /**
53
- * The type of the input element.
54
- * Can be 'text', 'password', 'email', 'tel', etc.
55
- * Defaults to 'text'.
56
- *
57
- * @see InputTextType
58
- */
59
- @Input() public type: InputDateType = 'date';
60
- /**
61
- * Minimum year selectable in the calendar
62
- */
63
- @Input() public minDate: Date = new Date(1900, 0, 1);
64
- /**
65
- * Maximum year selectable in the calendar
66
- */
67
- @Input() public maxDate: Date = new Date(2099, 11, 31);
68
- /**
69
- * The format of date
70
- */
71
- @Input() public format: DateFormat = 'dd/MM/yyyy';
72
- /**
73
- * Enables strict mode for email validation.
74
- * When set to true, the email validator will use a more stringent pattern.
75
- * Defaults to false.
76
- */
77
- @Input() public validatorStrictMode: boolean = false;
78
-
79
- /**
80
- * Used for show calendar
81
- */
82
- public showCalendar$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
83
-
84
- /**
85
- * Determines the actual input type to be used in the template.
86
- * If the type is 'password', it toggles between 'text' and 'password'
87
- * based on the showPassword property.
88
- *
89
- * @returns The input type as a string.
90
- */
91
- public get inputType(): string {
92
- if (this.type === 'date') {
93
- return 'text';
94
- }
95
- return this.type;
96
- }
97
-
98
- /** Internal store for warnings */
99
- private warnings: Record<string, boolean> = {};
100
-
101
- /**
102
- * @inheritdoc
103
- */
104
- public override ngOnInit(): void {
105
- super.ngOnInit();
106
- this.initPlaceholder();
107
- this.initValidators();
108
- }
109
-
110
- /**
111
- * Handles the blur event on the input element.
112
- * Validates and formats the input value.
113
- * Marks the control as touched and updates the model value.
114
- * @param event Focus event
115
- */
116
- public override onBlur(event: FocusEvent): void {
117
- const input = event.target as HTMLInputElement;
118
- const value = input.value.trim();
119
-
120
- this.validate(value);
121
-
122
- if (isValidDate(value, this.format)) {
123
- let date = convertStringToDate(value, this.format);
124
- if (date) {
125
- date = this.clampDate(date);
126
- }
127
- this.value = date ?? null;
128
- input.value = this.formatDate(this.value);
129
- } else {
130
- input.value = '';
131
- this.value = null;
132
- }
133
-
134
- this.onTouched();
135
- this.onChange(this.value);
136
- }
137
-
138
- /**
139
- * Handles the input event on the input element.
140
- * Validates the input value.
141
- * @param event Input event
142
- */
143
- public override onInput(event: Event): void {
144
- const input = event.target as HTMLInputElement;
145
- const value = input.value.trim();
146
-
147
- this.validate(value);
148
- }
149
-
150
- /**
151
- * Handles the blur event on the input element.
152
- * Marks the control as touched.
153
- */
154
- public override onFocus(_event: FocusEvent): void {
155
- this.showCalendar$.next(true);
156
- }
157
-
158
- /**
159
- * Format value for input display
160
- * @param value Date value
161
- * @returns Formatted date string
162
- */
163
- protected formatDate(value: Date | null): string {
164
- if(value){
165
- return formatDateToString(value, this.format);
166
- }
167
-
168
- return '';
169
- }
170
-
171
- protected selectDate(date: Date): void {
172
- this.value = date;
173
-
174
- this.onChange(this.value);
175
- this.onTouched();
176
-
177
- this.showCalendar$.next(false);
178
- }
179
-
180
- protected toggleCalendar(){
181
- this.showCalendar$.next(!this.showCalendar$.value);
182
- }
183
-
184
- /**
185
- * @inheritdoc
186
- */
187
- protected updateView(_value: Date | null): void {
188
- // Handled by Angular binding
189
- }
190
-
191
- /**
192
- * @inheritdoc
193
- */
194
- protected updateDisabledState(_isDisabled: boolean): void {
195
- // Handled by Angular binding
196
- }
197
-
198
- /**
199
- * @inheritdoc
200
- */
201
- protected override get errorList(): string[] {
202
- if (!this.control?.errors) return [];
203
-
204
- const errors = this.control.errors;
205
- return Object.keys(errors)
206
- .filter(key => !key.startsWith('warning_'))
207
- .map(key => {
208
- if (this.errorMessages[key]) {
209
- return this.errorMessages[key];
210
- }
211
- let template = this.errorMessages[key] || DEFAULT_INPUT_DATE_ERROR_MESSAGES[key] || 'Invalid field.';
212
-
213
- switch (key) {
214
- case 'min':
215
- template = template.replace('{{date}}', formatDateToString(this.minDate, this.format));
216
- break;
217
- case 'max':
218
- template = template.replace('{{date}}', formatDateToString(this.maxDate, this.format));
219
- break;
220
- }
221
-
222
- return template;
223
- });
224
- }
225
-
226
- /**
227
- * Returns dynamic warning messages, replacing {{limit}} with actual values.
228
- */
229
- protected override get warningList(): string[] {
230
- return Object.keys(this.warnings).map(key => {
231
- const template = DEFAULT_INPUT_DATE_WARNINGS_MESSAGES[key] || 'Check this value.';
232
-
233
- let replacement: string | undefined;
234
-
235
- switch (key) {
236
- case 'format':
237
- replacement = this.format;
238
- break;
239
- case 'min':
240
- replacement = formatDateToString(this.minDate, this.format);
241
- break;
242
- case 'max':
243
- replacement = formatDateToString(this.maxDate, this.format);
244
- break;
245
- }
246
-
247
- if (replacement != null) {
248
- const placeholder = key === 'format' ? '{{format}}' : '{{limit}}';
249
- return template.replace(placeholder, replacement.toString());
250
- }
251
-
252
- return template;
253
- });
254
- }
255
-
256
- /**
257
- * Returns whether any warnings are active.
258
- */
259
- protected get hasWarning(): boolean {
260
- return this.warningList.length > 0;
261
- }
262
-
263
- /**
264
- * Adds a warning flag
265
- * @param key Warning key
266
- */
267
- private addWarning(key: string): void {
268
- this.warnings[key] = true;
269
- }
270
-
271
- /**
272
- * Clamp a date within min/max boundaries
273
- * @param date Date to clamp
274
- * @returns Clamped date and sets warnings if needed
275
- */
276
- private clampDate(date: Date): Date {
277
- let clamped = date;
278
-
279
- if (this.minDate && date < this.minDate) {
280
- this.addWarning('min');
281
- clamped = this.minDate;
282
- }
283
-
284
- if (this.maxDate && date > this.maxDate) {
285
- this.addWarning('max');
286
- clamped = this.maxDate;
287
- }
288
-
289
- return clamped;
290
- }
291
-
292
- /**
293
- * Initialize the placeholder based on the date format
294
- */
295
- private initPlaceholder() {
296
- this.placeholder = this.format;
297
- }
298
-
299
- /**
300
- * Initialize validators based on inputs
301
- */
302
- private initValidators(): void {
303
- if (this.control) {
304
- const validators = [];
305
-
306
- if (this.required) {
307
- validators.push(Validators.required);
308
- }
309
-
310
- if (this.minDate) {
311
- validators.push(minDate(this.minDate));
312
- }
313
-
314
- if (this.maxDate) {
315
- validators.push(maxDate(this.maxDate));
316
- }
317
-
318
- this.control.setValidators(validators);
319
- this.control.updateValueAndValidity();
320
- }
321
- }
322
-
323
- /**
324
- * Validate the input value against the specified format
325
- * @param value Input value
326
- */
327
- private validate(value: string): void {
328
- this.removeWarning('format');
329
- this.removeWarning('min');
330
- this.removeWarning('max');
331
-
332
- if (!value) return;
333
-
334
- if (this.format) {
335
- const regex = buildDateFormatRegex(this.format);
336
- if (!regex.test(value)) {
337
- this.addWarning('format');
338
- return;
339
- }
340
- }
341
-
342
- const date = convertStringToDate(value, this.format);
343
- if (!date) return;
344
-
345
- if (this.minDate && date < this.minDate) {
346
- this.addWarning('min');
347
- } else if (this.maxDate && date > this.maxDate) {
348
- this.addWarning('max');
349
- }
350
- }
351
-
352
- /**
353
- * Remove a warning flag
354
- * @param key Warning key
355
- */
356
- private removeWarning(key: string): void {
357
- delete this.warnings[key];
358
- }
359
- }
@@ -1,70 +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">{{ label | inputRequiredLabel: required }}</label>
7
- }
8
- <div class="frg-input__field">
9
- <input
10
- [id]="id"
11
- type="text"
12
- [placeholder]="placeholder"
13
- [required]="required"
14
- [disabled]="disabled"
15
- [value]="formatDate(value)"
16
- (blur)="onBlur($event)"
17
- (focus)="onFocus($event)"
18
- (input)="onInput($event)"
19
- />
20
- <div class="frg-input__handle-buttons">
21
- @if(value){
22
- <button
23
- type="button"
24
- class="frg-input__clear-button"
25
- aria-label="Clear input"
26
- (click)="clearValue()"
27
- >
28
- &times;
29
- </button>
30
-
31
- }
32
- <button class="fa-regular fa-calendar-days frg-input__calendar-button"
33
- aria-label="Open calendar"
34
- (click)="toggleDateTimePicker()"
35
- ></button>
36
- </div>
37
- </div>
38
- @if(showDateTimePicker$ | async){
39
- <div class="frg-input__date-time-picker">
40
- <div class="frg-input__date-time-panel">
41
- <frg-input-calendar
42
- [minDate]="minDateTime"
43
- [maxDate]="maxDateTime"
44
- [selectedValue]="value"
45
- (selectDate)="selectDate($event)"
46
- >
47
- </frg-input-calendar>
48
-
49
- <frg-input-clock-picker
50
- [timeFormat]="timeFormat"
51
- [selectedHour]="value ? value.getHours().toString() : null"
52
- [selectedMinute]="value ? value.getMinutes().toString() : null"
53
- [selectedMeridiem]="currentMeridiem"
54
- (selectHour)="selectHour($event)"
55
- (selectMinute)="selectMinute($event)"
56
- (selectMeridiem)="selectMeridiem($event)">
57
- </frg-input-clock-picker>
58
- </div>
59
- </div>
60
- }
61
- </div>
62
-
63
- @if (showValidation) {
64
- <frg-input-validation
65
- [errorList]="errorList"
66
- [warningList]="warningList"
67
- [isFormInvalid]="hasError"
68
- >
69
- </frg-input-validation>
70
- }
@@ -1,133 +0,0 @@
1
- @use "sass:color";
2
- @use './../../../../../assets/styles/scss/variables' as *;
3
-
4
- :host {
5
- display: block;
6
-
7
- label {
8
- display: flex;
9
- font-size: $font-size-xs;
10
- color: $input-text-color;
11
- padding: $input-padding;
12
- }
13
-
14
- .frg-input {
15
- font-family: $input-font-family;
16
- &__wrapper {
17
- display: inline-block;
18
- position: relative;
19
- width: 100%;
20
-
21
- &.input-error label {
22
- color: $color-danger;
23
- }
24
-
25
- &.input-error .frg-input__field::after {
26
- width: 100%;
27
- right: 0;
28
- }
29
- }
30
-
31
- &__field {
32
- display: inline-flex;
33
- align-items: center;
34
- justify-content: space-between;
35
- padding: $input-padding;
36
- border-bottom: 2px solid $input-border-color;
37
- font-family: $input-font-family;
38
- background: transparent;
39
- position: relative;
40
- width: 100%;
41
-
42
- input {
43
- border: none;
44
- background: transparent;
45
-
46
- &:focus {
47
- outline: none;
48
- }
49
- }
50
-
51
- span {
52
- margin-left: 0.5rem;
53
- cursor: pointer;
54
- color: $input-text-color;
55
- }
56
-
57
- &::before {
58
- content: "";
59
- position: absolute;
60
- bottom: -2px;
61
- left: -50%;
62
- width: 0;
63
- height: 0.125rem;
64
- background: $input-focus-border-color;
65
- transition: width 0.3s ease, left 0.3s ease;
66
- }
67
-
68
- &:has(input:focus)::before {
69
- width: 100%;
70
- left: 0;
71
- }
72
-
73
- &::after {
74
- content: "";
75
- position: absolute;
76
- bottom: -2px;
77
- right: -50%;
78
- width: 0;
79
- height: 0.125rem;
80
- background: $color-danger;
81
- transition: width 0.3s ease, right 0.3s ease;
82
- }
83
- }
84
-
85
- &__clear-button {
86
- background: transparent;
87
- border: none;
88
- font-size: $font-size-2xl;
89
- color: $color-dark-neutral;
90
- line-height: 0;
91
- font-weight: lighter;
92
- }
93
-
94
- &__calendar-button {
95
- border: none;
96
- background: transparent;
97
- color: $color-dark-neutral;
98
-
99
- &:focus,
100
- &:focus-visible,
101
- &:focus-within {
102
- border: none;
103
- outline: none;
104
- }
105
- }
106
-
107
- &__date-time-picker {
108
- position: absolute;
109
- top: calc(100% + 0.5rem);
110
- left: 0;
111
- z-index: 5;
112
- }
113
-
114
- &__date-time-panel {
115
- display: flex;
116
- align-items: center;
117
- gap: 0.75rem;
118
- padding: 0.5rem;
119
- border-radius: 0.5rem;
120
- background: $color-light;
121
- box-shadow: $box-shadow-md;
122
- flex-wrap: nowrap;
123
- justify-content: center;
124
- }
125
-
126
- &__date-time-panel frg-input-calendar,
127
- &__date-time-panel frg-input-clock-picker {
128
- display: block;
129
- flex: 0 0 auto;
130
- margin: 0;
131
- }
132
- }
133
- }
@@ -1,36 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { By } from '@angular/platform-browser';
3
- import { InputDateTimeComponent } from './input-date-time.component';
4
-
5
- describe('InputDateTimeComponent', () => {
6
- let fixture: ComponentFixture<InputDateTimeComponent>;
7
- let component: InputDateTimeComponent;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [InputDateTimeComponent]
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(InputDateTimeComponent);
15
- component = fixture.componentInstance;
16
- });
17
-
18
- it('toggles the date time picker on button click', () => {
19
- fixture.detectChanges();
20
-
21
- const button = fixture.debugElement.query(By.css('.frg-input__calendar-button'));
22
- button.nativeElement.click();
23
-
24
- expect(component.showDateTimePicker$.value).toBeTrue();
25
- });
26
-
27
- it('clears value and closes pickers', () => {
28
- component.value = new Date(2024, 0, 1, 9, 30);
29
- component.showDateTimePicker$.next(true);
30
-
31
- component.clearValue();
32
-
33
- expect(component.value).toBeNull();
34
- expect(component.showDateTimePicker$.value).toBeFalse();
35
- });
36
- });