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

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,343 +0,0 @@
1
- import { Component, Input, OnInit } from '@angular/core';
2
- import { InputBase } from '../input-base';
3
- import {
4
- DEFAULT_INPUT_NUMBER_ERROR_MESSAGES,
5
- DEFAULT_INPUT_NUMBER_WARNING_MESSAGES,
6
- } from '../input-consts';
7
- import { InputNumberType } from '../input-type';
8
- import { normalizeNumber } from '../../../utils/number.utils';
9
- import { InputRequiredLabelPipe } from '../input.pipe';
10
- import { InputValidationComponent } from '../input-validation/input-validation.component';
11
-
12
- @Component({
13
- selector: 'frg-input-number',
14
- imports: [InputRequiredLabelPipe, InputValidationComponent],
15
- templateUrl: './input-number.component.html',
16
- styleUrl: './input-number.component.scss',
17
- })
18
- export class InputNumberComponent extends InputBase<number | null> implements OnInit {
19
- /**
20
- * @inheritdoc
21
- */
22
- @Input() public override label: string = '';
23
- /**
24
- * @inheritdoc
25
- */
26
- @Input() public override placeholder: string = '';
27
- /**
28
- * @inheritdoc
29
- */
30
- @Input() public override required: boolean = false;
31
- /**
32
- * @inheritdoc
33
- */
34
- @Input() public override showValidation: boolean = true;
35
- /**
36
- * @inheritdoc
37
- */
38
- @Input() public override errorMessages: Record<string, string> = {};
39
-
40
- /**
41
- * The type of the input element.
42
- * Can be 'number' or 'decimal'.
43
- * Defaults to 'number'.
44
- */
45
- @Input() public type: InputNumberType = 'number';
46
-
47
- /**
48
- * Minimum allowed value for the input.
49
- */
50
- @Input() public min: number | null = null;
51
-
52
- /**
53
- * Maximum allowed value for the input.
54
- */
55
- @Input() public max: number | null = null;
56
-
57
- /**
58
- * Increment/decrement step for the input value.
59
- */
60
- @Input() public step: number | null = null;
61
-
62
- /**
63
- * Maximum number of decimal places allowed.
64
- */
65
- @Input() public precision: number | null = null;
66
-
67
- /**
68
- * Enables strict mode for validation.
69
- * Defaults to false.
70
- */
71
- @Input() public validatorStrictMode: boolean = false;
72
-
73
- /** Internal store for warnings */
74
- private warnings: Record<string, boolean> = {};
75
-
76
- /**
77
- * @inheritdoc
78
- */
79
- public override ngOnInit(): void {
80
- super.ngOnInit();
81
- this.initPlaceholder();
82
- }
83
-
84
- /**
85
- * Returns the step value for the input based on type and precision.
86
- */
87
- public get inputStep(): number {
88
- if (this.step != null) return this.step;
89
- if (this.type === 'decimal') return this.precision ? Math.pow(10, -this.precision) : 0.01;
90
- return 1;
91
- }
92
-
93
- /**
94
- * Handles blur event:
95
- * - Aligns value to step
96
- * - Clamps to min/max/precision
97
- * - Runs validation
98
- */
99
- protected override onBlur(event: FocusEvent): void {
100
- const relatedTarget = event.relatedTarget as HTMLElement | null;
101
- const isStepButton = relatedTarget?.classList.contains('frg-input__number__arrow');
102
-
103
- if (this.value != null && !isStepButton) {
104
- this.validate(this.value);
105
- const snappedValue = this.step ? this.alignToStep(this.value, this.inputStep) : this.value;
106
- this.value = this.applyClamping(snappedValue);
107
- }
108
-
109
- this.onChange(this.value);
110
- this.onTouched();
111
- }
112
-
113
- /**
114
- * Handles input event:
115
- * - Normalizes value
116
- * - Runs validation
117
- */
118
- protected override onInput(event: Event): void {
119
- const input = event.target as HTMLInputElement;
120
- this.value = normalizeNumber(input);
121
-
122
- if (this.value != null) {
123
- this.validate(this.value);
124
- }
125
-
126
- this.onChange(this.value);
127
- }
128
-
129
- /**
130
- * @inheritdoc
131
- */
132
- protected updateView(_value: number | null): void {
133
- // Handled by Angular binding
134
- }
135
-
136
- /**
137
- * @inheritdoc
138
- */
139
- protected updateDisabledState(_isDisabled: boolean): void {
140
- // Handled by Angular binding
141
- }
142
-
143
- /**
144
- * Returns error messages, excluding warnings.
145
- */
146
- protected override get errorList(): string[] {
147
- if (!this.control?.errors) return [];
148
- return Object.keys(this.control.errors)
149
- .filter(key => !key.startsWith('warning_'))
150
- .map(key => this.errorMessages[key] ?? DEFAULT_INPUT_NUMBER_ERROR_MESSAGES[key] ?? 'Invalid field.');
151
- }
152
-
153
- /**
154
- * Returns dynamic warning messages, replacing {{limit}} with actual values.
155
- */
156
- protected override get warningList(): string[] {
157
- return Object.keys(this.warnings).map(key => {
158
- const template = DEFAULT_INPUT_NUMBER_WARNING_MESSAGES[key] || 'Check this value.';
159
-
160
- let limit: number | undefined;
161
- switch (key) {
162
- case 'min':
163
- limit = this.min ?? undefined;
164
- break;
165
- case 'max':
166
- limit = this.max ?? undefined;
167
- break;
168
- case 'step':
169
- limit = this.inputStep;
170
- break;
171
- case 'precision':
172
- limit = this.precision ?? undefined;
173
- break;
174
- default:
175
- limit = undefined;
176
- }
177
-
178
- return limit != null ? template.replace('{{limit}}', limit.toString()) : template;
179
- });
180
- }
181
-
182
- /**
183
- * Returns whether any warnings are active.
184
- */
185
- protected get hasWarning(): boolean {
186
- return this.warningList.length > 0;
187
- }
188
-
189
- /**
190
- * Increase value by step, respecting precision, step alignment and max.
191
- */
192
- protected increase(): void {
193
- const step = this.inputStep;
194
- const baseValue = this.value ?? this.min ?? 0;
195
-
196
- let newValue: number;
197
-
198
- if (this.step != null) {
199
- const snapped = this.alignToStep(baseValue, step);
200
- newValue = snapped === baseValue ? baseValue + step : snapped;
201
- } else {
202
- newValue = baseValue + step;
203
- }
204
-
205
- newValue = +newValue.toFixed(this.precision ?? 12);
206
- newValue = this.applyClamping(newValue);
207
- this.validate(newValue);
208
-
209
- if (newValue !== this.value) {
210
- this.value = newValue;
211
- this.onChange(this.value);
212
- this.onTouched();
213
- }
214
- }
215
-
216
- /**
217
- * Decrease value by step, respecting precision, step alignment and min.
218
- */
219
- protected decrease(): void {
220
- const step = this.inputStep;
221
- const baseValue = this.value ?? this.min ?? 0;
222
-
223
- let newValue: number;
224
-
225
- if (this.step != null) {
226
- const snapped = this.alignToStep(baseValue, step);
227
- newValue = snapped === baseValue ? baseValue - step : snapped;
228
- } else {
229
- newValue = baseValue - step;
230
- }
231
-
232
- newValue = +newValue.toFixed(this.precision ?? 12);
233
- newValue = this.applyClamping(newValue);
234
- this.validate(newValue);
235
-
236
- if (newValue !== this.value) {
237
- this.value = newValue;
238
- this.onChange(this.value);
239
- this.onTouched();
240
- }
241
- }
242
-
243
- /**
244
- * Clamps a value to respect precision, min, and max
245
- * @param value Value to clamp
246
- */
247
- private applyClamping(value: number): number {
248
- let clampedValue = value;
249
-
250
- if (this.precision != null) {
251
- clampedValue = +clampedValue.toFixed(this.precision);
252
- }
253
- if (this.max != null && clampedValue > this.max) {
254
- clampedValue = this.max;
255
- }
256
- if (this.min != null && clampedValue < this.min) {
257
- clampedValue = this.min;
258
- }
259
-
260
- return clampedValue;
261
- }
262
-
263
- /**
264
- * Validates a value against precision, min, max, and step
265
- * @param value Value to validate
266
- */
267
- private validate(value: number): void {
268
- if (this.precision != null) {
269
- const decimals = this.countDecimals(value);
270
- if (decimals > this.precision) {
271
- this.addWarning('precision');
272
- } else {
273
- this.removeWarning('precision');
274
- }
275
- }
276
-
277
- if (this.max != null && value > this.max) {
278
- this.addWarning('max');
279
- } else {
280
- this.removeWarning('max');
281
- }
282
-
283
- if (this.min != null && value < this.min) {
284
- this.addWarning('min');
285
- } else {
286
- this.removeWarning('min');
287
- }
288
-
289
- if (this.step != null) {
290
- const base = this.min ?? 0;
291
- const diff = (value - base) / this.step;
292
- if (!Number.isInteger(diff)) {
293
- this.addWarning('step');
294
- } else {
295
- this.removeWarning('step');
296
- }
297
- }
298
- }
299
-
300
- /** Initializes placeholder based on type */
301
- private initPlaceholder(): void {
302
- if (!this.placeholder) {
303
- this.placeholder = this.type === 'decimal' ? (0).toFixed(this.precision ?? 2) : '0';
304
- }
305
- }
306
-
307
- /**
308
- * Adds a warning flag
309
- * @param key Warning type
310
- */
311
- private addWarning(key: string): void {
312
- this.warnings[key] = true;
313
- }
314
-
315
- /**
316
- * Removes a warning flag
317
- * @param key Warning type
318
- */
319
- private removeWarning(key: string): void {
320
- delete this.warnings[key];
321
- }
322
-
323
- /**
324
- * Aligns a value to the nearest multiple of step
325
- * @param value Value to align
326
- * @param step Step size
327
- */
328
- private alignToStep(value: number, step: number): number {
329
- const base = this.min ?? 0;
330
- const offset = value - base;
331
- const steps = Math.round(offset / step);
332
- return base + steps * step;
333
- }
334
-
335
- /**
336
- * Counts the number of decimals in a number
337
- * @param num Number to check
338
- */
339
- private countDecimals(num: number): number {
340
- if (Math.floor(num) === num) return 0;
341
- return num.toString().split('.')[1]?.length ?? 0;
342
- }
343
- }
@@ -1,44 +0,0 @@
1
- <div
2
- class="frg-radio-group__wrapper"
3
- [class.input-error]="hasError"
4
- [class.input-warning]="hasWarning"
5
- [ngClass]="{
6
- 'frg-radio-group__primary': styleType === 'primary',
7
- 'frg-radio-group__secondary': styleType === 'secondary',
8
- 'frg-radio-group__tertiary': styleType === 'tertiary',
9
- 'frg-radio-group__success': styleType === 'success',
10
- 'frg-radio-group__warning': styleType === 'warning',
11
- 'frg-radio-group__danger': styleType === 'danger',
12
- 'frg-radio-group__light': styleType === 'light',
13
- 'frg-radio-group__dark': styleType === 'dark'
14
- }"
15
- >
16
- @if(label){
17
- <span class="frg-radio-group__label">{{ label | inputRequiredLabel: required }}</span>
18
- }
19
-
20
- <div class="frg-radio-group__list">
21
- @for (item of items; track item.id) {
22
- <label class="frg-radio" [class.disabled]="disabled || item.disabled">
23
- <input
24
- type="radio"
25
- [id]="id + '-' + item.id"
26
- [name]="id"
27
- [checked]="isSelected(item)"
28
- [disabled]="disabled || item.disabled"
29
- (change)="selectItem(item, $event)"
30
- (blur)="onBlur()"
31
- />
32
- <span class="frg-radio__label">{{ item.label }}</span>
33
- </label>
34
- }
35
- </div>
36
-
37
- @if(showValidation) {
38
- <frg-input-validation
39
- [errorList]="errorList"
40
- [warningList]="warningList"
41
- [isFormInvalid]="hasError"
42
- ></frg-input-validation>
43
- }
44
- </div>
@@ -1,139 +0,0 @@
1
- @use './../../../../../assets/styles/scss/variables' as *;
2
-
3
- :host {
4
- display: block;
5
-
6
- @mixin radio-group-style($color) {
7
- input[type="radio"]::after {
8
- background: $color;
9
- }
10
-
11
- input[type="radio"]:checked {
12
- border-color: $color;
13
- }
14
-
15
- input[type="radio"]:focus-visible {
16
- box-shadow: 0 0 0 4px rgba($color, 0.14);
17
- }
18
- }
19
-
20
- .frg-radio-group__wrapper {
21
- display: flex;
22
- flex-direction: column;
23
- gap: 0.5rem;
24
- }
25
-
26
- .frg-radio-group__wrapper.frg-radio-group__primary {
27
- @include radio-group-style($color-primary);
28
- }
29
-
30
- .frg-radio-group__wrapper.frg-radio-group__secondary {
31
- @include radio-group-style($color-secondary);
32
- }
33
-
34
- .frg-radio-group__wrapper.frg-radio-group__tertiary {
35
- @include radio-group-style($color-tertiary);
36
- }
37
-
38
- .frg-radio-group__wrapper.frg-radio-group__success {
39
- @include radio-group-style($color-success);
40
- }
41
-
42
- .frg-radio-group__wrapper.frg-radio-group__warning {
43
- @include radio-group-style($color-warning);
44
- }
45
-
46
- .frg-radio-group__wrapper.frg-radio-group__danger {
47
- @include radio-group-style($color-danger);
48
- }
49
-
50
- .frg-radio-group__wrapper.frg-radio-group__light {
51
- @include radio-group-style($color-light);
52
- }
53
-
54
- .frg-radio-group__wrapper.frg-radio-group__dark {
55
- @include radio-group-style($color-dark);
56
- }
57
-
58
- .frg-radio-group__label {
59
- font-size: $font-size-xs;
60
- color: $input-text-color;
61
- }
62
-
63
- .frg-radio-group__list {
64
- display: grid;
65
- gap: 0.5rem;
66
- }
67
-
68
- .frg-radio {
69
- display: inline-flex;
70
- align-items: center;
71
- gap: 0.5rem;
72
- cursor: pointer;
73
- font-size: $font-size-xs;
74
- color: $input-text-color;
75
- }
76
-
77
- .input-error .frg-radio-group__label,
78
- .input-error .frg-radio {
79
- color: $color-danger;
80
- }
81
-
82
- .input-warning .frg-radio-group__label,
83
- .input-warning .frg-radio {
84
- color: $color-warning;
85
- }
86
-
87
- input[type="radio"] {
88
- appearance: none;
89
- -webkit-appearance: none;
90
- width: 1rem;
91
- height: 1rem;
92
- border-radius: 50%;
93
- background: transparent;
94
- border: 1px solid $input-border-color;
95
- display: inline-grid;
96
- place-content: center;
97
- transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
98
- cursor: pointer;
99
- }
100
-
101
- input[type="radio"]::after {
102
- content: "";
103
- width: 0.5rem;
104
- height: 0.5rem;
105
- border-radius: 50%;
106
- background: $color-primary;
107
- transform: scale(0);
108
- transform-origin: center;
109
- transition: transform 140ms ease;
110
- }
111
-
112
- input[type="radio"]:checked {
113
- background: transparent;
114
- border-color: $color-primary;
115
- }
116
-
117
- input[type="radio"]:checked::after {
118
- transform: scale(1);
119
- }
120
-
121
- input[type="radio"]:focus {
122
- outline: none;
123
- }
124
-
125
- input[type="radio"]:focus-visible {
126
- box-shadow: 0 0 0 4px rgba($color-primary, 0.14);
127
- }
128
-
129
- input[type="radio"]:disabled {
130
- cursor: not-allowed;
131
- opacity: 0.65;
132
- background: transparent;
133
- border-color: $input-disabled-border-color;
134
- }
135
-
136
- .frg-radio.disabled {
137
- cursor: not-allowed;
138
- }
139
- }
@@ -1,58 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { By } from '@angular/platform-browser';
3
- import { InputRadioGroupComponent, InputRadioGroupItem } from './input-radio-group.component';
4
-
5
- describe('InputRadioGroupComponent', () => {
6
- let fixture: ComponentFixture<InputRadioGroupComponent<string>>;
7
- let component: InputRadioGroupComponent<string>;
8
-
9
- const items: Array<InputRadioGroupItem<string>> = [
10
- { id: 'a', label: 'Option A', value: 'a' },
11
- { id: 'b', label: 'Option B', value: 'b' }
12
- ];
13
-
14
- beforeEach(async () => {
15
- await TestBed.configureTestingModule({
16
- imports: [InputRadioGroupComponent]
17
- }).compileComponents();
18
-
19
- fixture = TestBed.createComponent(InputRadioGroupComponent<string>);
20
- component = fixture.componentInstance;
21
- component.items = items;
22
- });
23
-
24
- it('selects a value when checked', () => {
25
- fixture.detectChanges();
26
-
27
- const input = fixture.debugElement.query(By.css('input[type="radio"]'));
28
- input.nativeElement.checked = true;
29
- input.nativeElement.dispatchEvent(new Event('change'));
30
- fixture.detectChanges();
31
-
32
- expect(component.value).toEqual('a');
33
- });
34
-
35
- it('does not select when group is disabled', () => {
36
- component.disabled = true;
37
-
38
- fixture.detectChanges();
39
-
40
- const input = fixture.debugElement.query(By.css('input[type="radio"]'));
41
- input.nativeElement.checked = true;
42
- input.nativeElement.dispatchEvent(new Event('change'));
43
-
44
- expect(component.value).toBeNull();
45
- });
46
-
47
- it('does not select when item is disabled', () => {
48
- component.items = [{ id: 'a', label: 'Option A', value: 'a', disabled: true }];
49
-
50
- fixture.detectChanges();
51
-
52
- const input = fixture.debugElement.query(By.css('input[type="radio"]'));
53
- input.nativeElement.checked = true;
54
- input.nativeElement.dispatchEvent(new Event('change'));
55
-
56
- expect(component.value).toBeNull();
57
- });
58
- });
@@ -1,132 +0,0 @@
1
- import { NgClass } from '@angular/common';
2
- import { Component, Input } from '@angular/core';
3
- import { InputBase } from '../input-base';
4
- import { DEFAULT_INPUT_RADIO_GROUP_ERROR_MESSAGES, DEFAULT_INPUT_RADIO_GROUP_WARNINGS_MESSAGES } from '../input-consts';
5
- import { InputChoiceStyleType } from '../input-type';
6
- import { InputValidationComponent } from '../input-validation/input-validation.component';
7
- import { InputRequiredLabelPipe } from '../input.pipe';
8
-
9
- export interface InputRadioGroupItem<T> {
10
- id: string;
11
- label: string;
12
- value: T;
13
- disabled?: boolean;
14
- }
15
-
16
- @Component({
17
- selector: 'frg-input-radio-group',
18
- imports: [NgClass, InputRequiredLabelPipe, InputValidationComponent],
19
- templateUrl: './input-radio-group.component.html',
20
- styleUrl: './input-radio-group.component.scss',
21
- })
22
- export class InputRadioGroupComponent<T> extends InputBase<T> {
23
- /**
24
- * @inheritdoc
25
- */
26
- @Input() public override label: string = '';
27
- /**
28
- * @inheritdoc
29
- */
30
- @Input() public override required: boolean = false;
31
- /**
32
- * @inheritdoc
33
- */
34
- @Input() public override disabled: boolean = false;
35
- /**
36
- * @inheritdoc
37
- */
38
- @Input() public override errorMessages: Record<string, string> = {};
39
- /**
40
- * @inheritdoc
41
- */
42
- @Input() public override warningMessages: Record<string, string> = {};
43
- /**
44
- * @inheritdoc
45
- */
46
- @Input() public override showValidation: boolean = true;
47
- /**
48
- * Sets the visual style of the radio group.
49
- */
50
- @Input() public styleType: InputChoiceStyleType = 'primary';
51
-
52
- @Input() public items: Array<InputRadioGroupItem<T>> = [];
53
- @Input() public compareWith: (a: T, b: T) => boolean = (a, b) => a === b;
54
-
55
- /**
56
- * Selects a radio item value.
57
- */
58
- public selectItem(item: InputRadioGroupItem<T>, event: Event): void {
59
- if (this.disabled || item.disabled) return;
60
-
61
- const input = event.target as HTMLInputElement;
62
- if (!input.checked) return;
63
-
64
- this.value = item.value;
65
- this.onChange(this.value);
66
- this.onTouched();
67
- }
68
-
69
- /**
70
- * Checks if the item is selected.
71
- */
72
- public isSelected(item: InputRadioGroupItem<T>): boolean {
73
- if (this.value === null || this.value === undefined) return false;
74
- return this.compareWith(this.value, item.value);
75
- }
76
-
77
- /**
78
- * @inheritdoc
79
- */
80
- public override onBlur(): void {
81
- this.onTouched();
82
- }
83
-
84
- /**
85
- * @inheritdoc
86
- */
87
- protected updateView(_value: T | null): void {
88
- // Handled by Angular binding
89
- }
90
-
91
- /**
92
- * @inheritdoc
93
- */
94
- protected updateDisabledState(_isDisabled: boolean): void {
95
- // Handled by Angular binding
96
- }
97
-
98
- /**
99
- * @inheritdoc
100
- */
101
- protected override get errorList(): string[] {
102
- if (!this.control?.errors) return [];
103
- const errors = this.control.errors;
104
- return Object.keys(errors).map(key => {
105
- if (this.errorMessages[key]) {
106
- return this.errorMessages[key];
107
- }
108
- return DEFAULT_INPUT_RADIO_GROUP_ERROR_MESSAGES[key] || 'Invalid field.';
109
- });
110
- }
111
-
112
- /**
113
- * Returns warning messages. Consumers may pass arbitrary warnings via `warningMessages`.
114
- * Falls back to DEFAULT_INPUT_RADIO_GROUP_WARNINGS_MESSAGES or a generic message.
115
- */
116
- protected override get warningList(): string[] {
117
- return Object.keys(this.warningMessages).map(key => {
118
- return (
119
- this.warningMessages[key] ||
120
- DEFAULT_INPUT_RADIO_GROUP_WARNINGS_MESSAGES[key] ||
121
- ''
122
- );
123
- });
124
- }
125
-
126
- /**
127
- * Returns whether any warnings are active.
128
- */
129
- protected get hasWarning(): boolean {
130
- return this.warningList.length > 0;
131
- }
132
- }