@tacdaed/fragments 1.0.0-beta.2 → 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 +3 -3
  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,351 +0,0 @@
1
- import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
2
- import { InputBase } from '../input-base';
3
- import { InputRequiredLabelPipe } from '../input.pipe';
4
- import { ButtonComponent } from '../../button/button.component';
5
- import { InputValidationComponent } from '../input-validation/input-validation.component';
6
- import { DEFAULT_INPUT_FILE_UPLOAD_ERROR_MESSAGES } from '../input-consts';
7
-
8
- type InputFileUploadValue = File | File[] | null;
9
-
10
- @Component({
11
- selector: 'frg-input-file-upload',
12
- imports: [InputRequiredLabelPipe, InputValidationComponent, ButtonComponent],
13
- templateUrl: './input-file-upload.component.html',
14
- styleUrl: './input-file-upload.component.scss',
15
- })
16
- export class InputFileUploadComponent extends InputBase<InputFileUploadValue> implements OnInit {
17
- /**
18
- * @inheritdoc
19
- */
20
- @Input() public override label: string = '';
21
- /**
22
- * @inheritdoc
23
- */
24
- @Input() public override required: boolean = false;
25
- /**
26
- * @inheritdoc
27
- */
28
- @Input() public override showValidation: boolean = true;
29
- /**
30
- * @inheritdoc
31
- */
32
- @Input() public override errorMessages: Record<string, string> = {};
33
-
34
- /**
35
- * Accepted file types (e.g. ".pdf,.png" or "image/*").
36
- */
37
- @Input() public accept: string = '';
38
- /**
39
- * Allow multiple file selection.
40
- */
41
- @Input() public multiple: boolean = false;
42
- /**
43
- * Maximum number of files allowed.
44
- */
45
- @Input() public maxFiles: number | null = null;
46
- /**
47
- * Maximum size per file in bytes.
48
- */
49
- @Input() public maxFileSize: number | null = null;
50
- /**
51
- * Maximum total size in bytes.
52
- */
53
- @Input() public maxTotalSize: number | null = null;
54
- /**
55
- * Button label for opening the file dialog.
56
- */
57
- @Input() public buttonLabel: string = 'Browse';
58
- /**
59
- * Placeholder text when no file is selected.
60
- */
61
- @Input() public noFileText: string = 'No file selected';
62
- /**
63
- * Show a clear button when files are selected.
64
- */
65
- @Input() public showClearButton: boolean = true;
66
- /**
67
- * Show individual file list.
68
- */
69
- @Input() public showFileList: boolean = true;
70
- /**
71
- * Show file size in the list.
72
- */
73
- @Input() public showFileSize: boolean = true;
74
-
75
- @ViewChild('fileInput', { static: true }) private readonly fileInput!: ElementRef<HTMLInputElement>;
76
-
77
- public files: File[] = [];
78
- public isDragOver: boolean = false;
79
-
80
- private readonly ownedErrors = new Set([
81
- 'required',
82
- 'maxFiles',
83
- 'maxFileSize',
84
- 'maxTotalSize',
85
- 'accept',
86
- ]);
87
-
88
- public override ngOnInit(): void {
89
- super.ngOnInit();
90
- this.syncFromValue(this.value);
91
- this.updateErrors();
92
- }
93
-
94
- protected override updateView(value: InputFileUploadValue | null): void {
95
- this.syncFromValue(value);
96
- if (!value) {
97
- this.resetNativeInput();
98
- }
99
- this.updateErrors();
100
- }
101
-
102
- protected override updateDisabledState(_isDisabled: boolean): void {
103
- // Handled by Angular binding
104
- }
105
-
106
- protected override get errorList(): string[] {
107
- if (!this.control?.errors) return [];
108
- return Object.keys(this.control.errors).map(key => {
109
- if (this.errorMessages[key]) {
110
- return this.errorMessages[key];
111
- }
112
-
113
- let template = DEFAULT_INPUT_FILE_UPLOAD_ERROR_MESSAGES[key] || 'Invalid field.';
114
-
115
- switch (key) {
116
- case 'maxFiles':
117
- if (this.maxFiles != null) {
118
- template = template.replace('{{limit}}', this.maxFiles.toString());
119
- }
120
- break;
121
- case 'maxFileSize':
122
- if (this.maxFileSize != null) {
123
- template = template.replace('{{limit}}', this.formatBytes(this.maxFileSize));
124
- }
125
- break;
126
- case 'maxTotalSize':
127
- if (this.maxTotalSize != null) {
128
- template = template.replace('{{limit}}', this.formatBytes(this.maxTotalSize));
129
- }
130
- break;
131
- case 'accept':
132
- if (this.accept) {
133
- template = template.replace('{{accept}}', this.accept);
134
- }
135
- break;
136
- }
137
-
138
- return template;
139
- });
140
- }
141
-
142
- protected override get warningList(): string[] {
143
- return [];
144
- }
145
-
146
- public get fileSummary(): string {
147
- if (!this.files.length) return this.noFileText;
148
- if (this.files.length === 1) return this.files[0].name;
149
- return `${this.files.length} files selected`;
150
- }
151
-
152
- public get hasFiles(): boolean {
153
- return this.files.length > 0;
154
- }
155
-
156
- public triggerFileDialog(): void {
157
- if (this.disabled) return;
158
- this.fileInput.nativeElement.click();
159
- }
160
-
161
- public onFileChange(event: Event): void {
162
- const input = event.target as HTMLInputElement;
163
- const selectedFiles = Array.from(input.files ?? []);
164
- if (!selectedFiles.length) {
165
- return;
166
- }
167
- this.handleSelectedFiles(selectedFiles);
168
- }
169
-
170
- public onDragOver(event: DragEvent): void {
171
- if (this.disabled) return;
172
- event.preventDefault();
173
- event.stopPropagation();
174
- this.isDragOver = true;
175
- }
176
-
177
- public onDragLeave(event: DragEvent): void {
178
- if (this.disabled) return;
179
- event.preventDefault();
180
- event.stopPropagation();
181
- this.isDragOver = false;
182
- }
183
-
184
- public onDrop(event: DragEvent): void {
185
- if (this.disabled) return;
186
- event.preventDefault();
187
- event.stopPropagation();
188
- this.isDragOver = false;
189
-
190
- const droppedFiles = Array.from(event.dataTransfer?.files ?? []);
191
- if (!droppedFiles.length) {
192
- return;
193
- }
194
-
195
- this.handleSelectedFiles(droppedFiles);
196
- }
197
-
198
- public override onBlur(_event: FocusEvent): void {
199
- this.onTouched();
200
- }
201
-
202
- public clearFiles(): void {
203
- if (this.disabled) return;
204
- this.files = [];
205
- this.value = null;
206
- this.resetNativeInput();
207
- this.onChange(this.value);
208
- this.updateErrors();
209
- this.onTouched();
210
- }
211
-
212
- public removeFile(index: number): void {
213
- if (this.disabled || !this.multiple) {
214
- this.clearFiles();
215
- return;
216
- }
217
-
218
- this.files = this.files.filter((_, idx) => idx !== index);
219
- this.value = this.files.length ? [...this.files] : null;
220
- this.resetNativeInput();
221
- this.onChange(this.value);
222
- this.updateErrors();
223
- this.onTouched();
224
- }
225
-
226
- public trackFile(_index: number, file: File): string {
227
- return `${file.name}-${file.size}-${file.lastModified}`;
228
- }
229
-
230
- public formatBytes(bytes: number): string {
231
- if (bytes < 1024) return `${bytes} B`;
232
- const units = ['KB', 'MB', 'GB', 'TB'];
233
- let size = bytes / 1024;
234
- let unitIndex = 0;
235
- while (size >= 1024 && unitIndex < units.length - 1) {
236
- size /= 1024;
237
- unitIndex += 1;
238
- }
239
- return `${size.toFixed(size < 10 ? 1 : 0)} ${units[unitIndex]}`;
240
- }
241
-
242
- private syncFromValue(value: InputFileUploadValue | null): void {
243
- if (!value) {
244
- this.files = [];
245
- return;
246
- }
247
-
248
- const normalized = Array.isArray(value) ? value : [value];
249
- this.files = this.multiple ? normalized : normalized.slice(0, 1);
250
- }
251
-
252
- private resetNativeInput(): void {
253
- if (this.fileInput?.nativeElement) {
254
- this.fileInput.nativeElement.value = '';
255
- }
256
- }
257
-
258
- private handleSelectedFiles(selectedFiles: File[]): void {
259
- const nextFiles = this.multiple
260
- ? [...this.files, ...selectedFiles]
261
- : selectedFiles.slice(0, 1);
262
-
263
- this.files = nextFiles;
264
- this.value = this.multiple ? nextFiles : nextFiles[0] ?? null;
265
-
266
- this.onChange(this.value);
267
- this.updateErrors();
268
- this.onTouched();
269
- }
270
-
271
- private updateErrors(): void {
272
- if (!this.control) return;
273
-
274
- const errors = this.validateFiles();
275
- const nextErrors = this.mergeErrors(errors);
276
-
277
- this.control.setErrors(Object.keys(nextErrors).length ? nextErrors : null);
278
- }
279
-
280
- private validateFiles(): Record<string, unknown> {
281
- const errors: Record<string, unknown> = {};
282
-
283
- if (this.required && !this.files.length) {
284
- errors['required'] = true;
285
- }
286
-
287
- if (this.maxFiles && this.files.length > this.maxFiles) {
288
- errors['maxFiles'] = true;
289
- }
290
-
291
- if (this.maxFileSize && this.files.some(file => file.size > (this.maxFileSize || 0))) {
292
- errors['maxFileSize'] = true;
293
- }
294
-
295
- if (this.maxTotalSize != null && this.totalSize() > this.maxTotalSize) {
296
- errors['maxTotalSize'] = true;
297
- }
298
-
299
- if (this.accept && this.files.some(file => !this.isAccepted(file))) {
300
- errors['accept'] = true;
301
- }
302
-
303
- return errors;
304
- }
305
-
306
- private mergeErrors(newErrors: Record<string, unknown>): Record<string, unknown> {
307
- const currentErrors = this.control?.errors ?? {};
308
- const nextErrors: Record<string, unknown> = {};
309
-
310
- for (const [key, value] of Object.entries(currentErrors)) {
311
- if (!this.ownedErrors.has(key)) {
312
- nextErrors[key] = value;
313
- }
314
- }
315
-
316
- for (const [key, value] of Object.entries(newErrors)) {
317
- nextErrors[key] = value;
318
- }
319
-
320
- return nextErrors;
321
- }
322
-
323
- private totalSize(): number {
324
- return this.files.reduce((sum, file) => sum + file.size, 0);
325
- }
326
-
327
- private isAccepted(file: File): boolean {
328
- if (!this.accept) return true;
329
-
330
- const acceptList = this.accept
331
- .split(',')
332
- .map(item => item.trim().toLowerCase())
333
- .filter(Boolean);
334
-
335
- if (!acceptList.length) return true;
336
-
337
- const fileName = file.name.toLowerCase();
338
- const fileType = (file.type || '').toLowerCase();
339
-
340
- return acceptList.some(accept => {
341
- if (accept.startsWith('.')) {
342
- return fileName.endsWith(accept);
343
- }
344
- if (accept.endsWith('/*')) {
345
- const baseType = accept.replace('/*', '');
346
- return fileType.startsWith(`${baseType}/`);
347
- }
348
- return fileType === accept;
349
- });
350
- }
351
- }
@@ -1,8 +0,0 @@
1
- import { InputTimeMeridiem } from "./input-type";
2
-
3
- export interface InputTimeParts {
4
- hour?: number;
5
- minute?: number;
6
- second?: number;
7
- meridiem?: InputTimeMeridiem;
8
- }
@@ -1,51 +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
-
9
- <div class="frg-input__number__container">
10
- <button
11
- type="button"
12
- class="frg-input__number__arrow frg-input__number__arrow--decrement"
13
- (click)="decrease()"
14
- aria-label="Decrease value"
15
- >
16
-
17
- </button>
18
-
19
- <input
20
- [id]="id"
21
- type="number"
22
- [placeholder]="placeholder"
23
- [required]="required"
24
- [disabled]="disabled"
25
- [attr.step]="inputStep"
26
- [attr.min]="min"
27
- [attr.max]="max"
28
- [value]="value"
29
- (input)="onInput($event)"
30
- (blur)="onBlur($event)"
31
- />
32
-
33
- <button
34
- type="button"
35
- class="frg-input__number__arrow frg-input__number__arrow--increment"
36
- (click)="increase()"
37
- aria-label="Increase value"
38
- >
39
- +
40
- </button>
41
- </div>
42
- </div>
43
-
44
- @if (showValidation) {
45
- <frg-input-validation
46
- [errorList]="errorList"
47
- [warningList]="warningList"
48
- [isFormInvalid]="hasError"
49
- >
50
- </frg-input-validation>
51
- }
@@ -1,140 +0,0 @@
1
- @use "sass:color";
2
- @use './../../../../../assets/styles/scss/variables' as *;
3
-
4
- :host {
5
- display: block;
6
- font-family: $input-font-family;
7
-
8
- input::-webkit-outer-spin-button,
9
- input::-webkit-inner-spin-button {
10
- -webkit-appearance: none;
11
- margin: 0;
12
- }
13
-
14
- input[type="number"] {
15
- -moz-appearance: textfield;
16
- appearance: none;
17
- }
18
-
19
- .frg-input {
20
- &__wrapper {
21
- position: relative;
22
- box-sizing: border-box;
23
-
24
- label {
25
- font-size: $font-size-xs;
26
- color: $input-text-color;
27
- padding: $input-padding;
28
- }
29
-
30
- &.input-error label {
31
- color: $color-danger;
32
- }
33
-
34
- &.input-warning label {
35
- color: $color-warning;
36
- }
37
-
38
- &::before,
39
- &::after {
40
- content: "";
41
- position: absolute;
42
- bottom: 0;
43
- width: 0;
44
- height: 0.125rem;
45
- transition: width 0.3s ease, left 0.3s ease, right 0.3s ease;
46
- }
47
-
48
- &::before {
49
- left: -50%;
50
- background: $input-focus-border-color;
51
- z-index: 1;
52
- }
53
-
54
- &::after {
55
- right: -50%;
56
-
57
- z-index: 2;
58
- }
59
-
60
- &:focus-within::before,
61
- &.input-error::before,
62
- &.input-error::after,
63
- &.input-warning::after {
64
- width: 100%;
65
- }
66
-
67
- &.input-error::after {
68
- background: $color-danger;
69
- right: 0;
70
- }
71
-
72
- &.input-warning::after {
73
- background: $color-warning;
74
- right: 0;
75
- }
76
-
77
- &:focus-within::before,
78
- &.input-error::before,
79
- &.input-warning::before {
80
- left: 0;
81
- }
82
-
83
- }
84
-
85
- &__number {
86
- &__container {
87
- display: flex;
88
- align-items: center;
89
- box-sizing: border-box;
90
- position: relative;
91
- border-bottom: 2px solid $input-border-color;
92
- width: 100%;
93
- max-width: 100%;
94
- overflow: hidden;
95
-
96
- input[type="number"] {
97
- flex: 1 1 auto;
98
- min-width: 0;
99
- height: 100%;
100
- border: none;
101
- margin: 0;
102
- padding: $input-padding;
103
- text-align: center;
104
- font-size: $input-font-size;
105
- font-family: $input-font-family;
106
- background: transparent;
107
- color: $input-text-color;
108
- outline: none;
109
-
110
- &:disabled {
111
- background: $input-disabled-background;
112
- color: $input-border-color;
113
- cursor: not-allowed;
114
- }
115
- }
116
- }
117
-
118
- &__arrow {
119
- flex: 0 0 auto;
120
- height: 100%;
121
- margin: 0;
122
- border: none;
123
- background: transparent;
124
- cursor: pointer;
125
- font-size: 1.4rem;
126
- color: $input-text-color;
127
- user-select: none;
128
-
129
- &:disabled {
130
- opacity: 0.45;
131
- cursor: not-allowed;
132
- }
133
-
134
- &:focus {
135
- outline: none;
136
- }
137
- }
138
- }
139
- }
140
- }
@@ -1,44 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { By } from '@angular/platform-browser';
3
- import { InputNumberComponent } from './input-number.component';
4
-
5
- describe('InputNumberComponent', () => {
6
- let fixture: ComponentFixture<InputNumberComponent>;
7
- let component: InputNumberComponent;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [InputNumberComponent]
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(InputNumberComponent);
15
- component = fixture.componentInstance;
16
- });
17
-
18
- it('sets default placeholder for decimal inputs', () => {
19
- component.type = 'decimal';
20
- component.precision = 2;
21
-
22
- fixture.detectChanges();
23
-
24
- const input = fixture.debugElement.query(By.css('input')).nativeElement as HTMLInputElement;
25
- expect(input.placeholder).toBe('0.00');
26
- });
27
-
28
- it('increments and decrements value via buttons', () => {
29
- component.value = 1;
30
-
31
- fixture.detectChanges();
32
-
33
- const buttons = fixture.debugElement.queryAll(By.css('.frg-input__number__arrow'));
34
- buttons[1].nativeElement.click();
35
- fixture.detectChanges();
36
-
37
- expect(component.value).toBe(2);
38
-
39
- buttons[0].nativeElement.click();
40
- fixture.detectChanges();
41
-
42
- expect(component.value).toBe(1);
43
- });
44
- });