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

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 +1 -1
  2. package/ng-package.json +25 -0
  3. package/package.json +22 -29
  4. package/src/lib/components/accordion/accordion.component.html +103 -0
  5. package/src/lib/components/accordion/accordion.component.scss +382 -0
  6. package/src/lib/components/accordion/accordion.component.spec.ts +147 -0
  7. package/src/lib/components/accordion/accordion.component.ts +211 -0
  8. package/src/lib/components/accordion/accordion.type.ts +82 -0
  9. package/src/lib/components/breadcrumb/breadcrumb.component.html +43 -0
  10. package/src/lib/components/breadcrumb/breadcrumb.component.scss +112 -0
  11. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +33 -0
  12. package/src/lib/components/breadcrumb/breadcrumb.component.ts +103 -0
  13. package/src/lib/components/breadcrumb/breadcrumb.interface.ts +7 -0
  14. package/src/lib/components/button/button.component.html +57 -0
  15. package/src/lib/components/button/button.component.scss +445 -0
  16. package/src/lib/components/button/button.component.spec.ts +99 -0
  17. package/src/lib/components/button/button.component.ts +143 -0
  18. package/src/lib/components/button/button.type.ts +7 -0
  19. package/src/lib/components/card/card.component.html +44 -0
  20. package/src/lib/components/card/card.component.scss +114 -0
  21. package/src/lib/components/card/card.component.spec.ts +65 -0
  22. package/src/lib/components/card/card.component.ts +21 -0
  23. package/src/lib/components/card/card.type.ts +3 -0
  24. package/src/lib/components/code-block/code-block.component.html +55 -0
  25. package/src/lib/components/code-block/code-block.component.scss +122 -0
  26. package/src/lib/components/code-block/code-block.component.spec.ts +81 -0
  27. package/src/lib/components/code-block/code-block.component.ts +302 -0
  28. package/src/lib/components/code-block/code-block.interface.ts +28 -0
  29. package/src/lib/components/code-block/code-block.type.ts +73 -0
  30. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.html +14 -0
  31. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.scss +20 -0
  32. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.spec.ts +38 -0
  33. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.ts +181 -0
  34. package/src/lib/components/input/input-base.ts +187 -0
  35. package/src/lib/components/input/input-calendar/input-calendar.component.html +76 -0
  36. package/src/lib/components/input/input-calendar/input-calendar.component.scss +179 -0
  37. package/src/lib/components/input/input-calendar/input-calendar.component.spec.ts +44 -0
  38. package/src/lib/components/input/input-calendar/input-calendar.component.ts +299 -0
  39. package/src/lib/components/input/input-checkbox/input-checkbox.component.html +37 -0
  40. package/src/lib/components/input/input-checkbox/input-checkbox.component.scss +128 -0
  41. package/src/lib/components/input/input-checkbox/input-checkbox.component.spec.ts +43 -0
  42. package/src/lib/components/input/input-checkbox/input-checkbox.component.ts +112 -0
  43. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.html +43 -0
  44. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.scss +140 -0
  45. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.spec.ts +62 -0
  46. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.ts +136 -0
  47. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.html +81 -0
  48. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.scss +228 -0
  49. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.spec.ts +62 -0
  50. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.ts +178 -0
  51. package/src/lib/components/input/input-consts.ts +132 -0
  52. package/src/lib/components/input/input-date/input-date-validators.ts +41 -0
  53. package/src/lib/components/input/input-date/input-date.component.html +41 -0
  54. package/src/lib/components/input/input-date/input-date.component.scss +95 -0
  55. package/src/lib/components/input/input-date/input-date.component.spec.ts +43 -0
  56. package/src/lib/components/input/input-date/input-date.component.ts +359 -0
  57. package/src/lib/components/input/input-date-time/input-date-time.component.html +70 -0
  58. package/src/lib/components/input/input-date-time/input-date-time.component.scss +133 -0
  59. package/src/lib/components/input/input-date-time/input-date-time.component.spec.ts +36 -0
  60. package/src/lib/components/input/input-date-time/input-date-time.component.ts +387 -0
  61. package/src/lib/components/input/input-file-upload/input-file-upload.component.html +89 -0
  62. package/src/lib/components/input/input-file-upload/input-file-upload.component.scss +171 -0
  63. package/src/lib/components/input/input-file-upload/input-file-upload.component.spec.ts +43 -0
  64. package/src/lib/components/input/input-file-upload/input-file-upload.component.ts +351 -0
  65. package/src/lib/components/input/input-interface.ts +8 -0
  66. package/src/lib/components/input/input-number/input-number-validators.ts +0 -0
  67. package/src/lib/components/input/input-number/input-number.component.html +51 -0
  68. package/src/lib/components/input/input-number/input-number.component.scss +140 -0
  69. package/src/lib/components/input/input-number/input-number.component.spec.ts +44 -0
  70. package/src/lib/components/input/input-number/input-number.component.ts +343 -0
  71. package/src/lib/components/input/input-radio-group/input-radio-group.component.html +44 -0
  72. package/src/lib/components/input/input-radio-group/input-radio-group.component.scss +139 -0
  73. package/src/lib/components/input/input-radio-group/input-radio-group.component.spec.ts +58 -0
  74. package/src/lib/components/input/input-radio-group/input-radio-group.component.ts +132 -0
  75. package/src/lib/components/input/input-slider/input-slider.component.html +111 -0
  76. package/src/lib/components/input/input-slider/input-slider.component.scss +203 -0
  77. package/src/lib/components/input/input-slider/input-slider.component.spec.ts +46 -0
  78. package/src/lib/components/input/input-slider/input-slider.component.ts +410 -0
  79. package/src/lib/components/input/input-text/input-text-validators.ts +67 -0
  80. package/src/lib/components/input/input-text/input-text.component.html +71 -0
  81. package/src/lib/components/input/input-text/input-text.component.scss +118 -0
  82. package/src/lib/components/input/input-text/input-text.component.spec.ts +55 -0
  83. package/src/lib/components/input/input-text/input-text.component.ts +215 -0
  84. package/src/lib/components/input/input-time/input-time-validators.ts +42 -0
  85. package/src/lib/components/input/input-time/input-time.component.html +92 -0
  86. package/src/lib/components/input/input-time/input-time.component.scss +191 -0
  87. package/src/lib/components/input/input-time/input-time.component.spec.ts +39 -0
  88. package/src/lib/components/input/input-time/input-time.component.ts +691 -0
  89. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.html +36 -0
  90. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.scss +121 -0
  91. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.spec.ts +54 -0
  92. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.ts +117 -0
  93. package/src/lib/components/input/input-type.ts +18 -0
  94. package/src/lib/components/input/input-validation/input-validation.component.html +19 -0
  95. package/src/lib/components/input/input-validation/input-validation.component.scss +39 -0
  96. package/src/lib/components/input/input-validation/input-validation.component.spec.ts +45 -0
  97. package/src/lib/components/input/input-validation/input-validation.component.ts +13 -0
  98. package/src/lib/components/input/input.pipe.ts +14 -0
  99. package/src/lib/components/layout/container/container.component.html +1 -0
  100. package/src/lib/components/layout/container/container.component.scss +33 -0
  101. package/src/lib/components/layout/container/container.component.ts +32 -0
  102. package/src/lib/components/layout/container/container.type.ts +1 -0
  103. package/src/lib/components/layout/divider/divider.component.html +1 -0
  104. package/src/lib/components/layout/divider/divider.component.scss +60 -0
  105. package/src/lib/components/layout/divider/divider.component.ts +38 -0
  106. package/src/lib/components/layout/divider/divider.type.ts +2 -0
  107. package/src/lib/components/layout/section/section.component.html +21 -0
  108. package/src/lib/components/layout/section/section.component.scss +43 -0
  109. package/src/lib/components/layout/section/section.component.ts +33 -0
  110. package/src/lib/components/layout/section/section.type.ts +2 -0
  111. package/src/lib/components/layout/separator/separator.component.html +9 -0
  112. package/src/lib/components/layout/separator/separator.component.scss +52 -0
  113. package/src/lib/components/layout/separator/separator.component.ts +25 -0
  114. package/src/lib/components/layout/separator/separator.type.ts +1 -0
  115. package/src/lib/components/loader/content-blur/content-blur.component.html +13 -0
  116. package/src/lib/components/loader/content-blur/content-blur.component.scss +43 -0
  117. package/src/lib/components/loader/content-blur/content-blur.component.spec.ts +42 -0
  118. package/src/lib/components/loader/content-blur/content-blur.component.ts +34 -0
  119. package/src/lib/components/loader/loader.type.ts +2 -0
  120. package/src/lib/components/loader/progress-bar/progress-bar.component.html +26 -0
  121. package/src/lib/components/loader/progress-bar/progress-bar.component.scss +151 -0
  122. package/src/lib/components/loader/progress-bar/progress-bar.component.spec.ts +47 -0
  123. package/src/lib/components/loader/progress-bar/progress-bar.component.ts +28 -0
  124. package/src/lib/components/loader/progress-bar/progress-bar.type.ts +8 -0
  125. package/src/lib/components/loader/pulse-loader/pulse-loader.component.html +12 -0
  126. package/src/lib/components/loader/pulse-loader/pulse-loader.component.scss +202 -0
  127. package/src/lib/components/loader/pulse-loader/pulse-loader.component.spec.ts +55 -0
  128. package/src/lib/components/loader/pulse-loader/pulse-loader.component.ts +73 -0
  129. package/src/lib/components/loader/pulse-loader/pulse-loader.type.ts +6 -0
  130. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.html +13 -0
  131. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.scss +113 -0
  132. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.spec.ts +37 -0
  133. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.ts +51 -0
  134. package/src/lib/components/loader/skeleton-loader/skeleton-loader.type.ts +6 -0
  135. package/src/lib/components/loader/spinner/spinner.component.html +20 -0
  136. package/src/lib/components/loader/spinner/spinner.component.scss +137 -0
  137. package/src/lib/components/loader/spinner/spinner.component.spec.ts +43 -0
  138. package/src/lib/components/loader/spinner/spinner.component.ts +32 -0
  139. package/src/lib/components/loader/spinner/spinner.type.ts +6 -0
  140. package/src/lib/components/modal/modal.component.html +47 -0
  141. package/src/lib/components/modal/modal.component.scss +139 -0
  142. package/src/lib/components/modal/modal.component.spec.ts +60 -0
  143. package/src/lib/components/modal/modal.component.ts +83 -0
  144. package/src/lib/components/modal/modal.type.ts +9 -0
  145. package/src/lib/components/morph/blob-moph/blob-moprh.component.spec.ts +79 -0
  146. package/src/lib/components/morph/blob-moph/blob-moprh.component.ts +96 -0
  147. package/src/lib/components/morph/blob-moph/blob-morph.component.html +34 -0
  148. package/src/lib/components/morph/blob-moph/blob-morph.component.scss +7 -0
  149. package/src/lib/components/morph/morph.abstract.ts +13 -0
  150. package/src/lib/components/pagination/pagination.interface.ts +4 -0
  151. package/src/lib/components/pagination/small-pagination/small-pagination.component.html +61 -0
  152. package/src/lib/components/pagination/small-pagination/small-pagination.component.scss +187 -0
  153. package/src/lib/components/pagination/small-pagination/small-pagination.component.spec.ts +88 -0
  154. package/src/lib/components/pagination/small-pagination/small-pagination.component.ts +177 -0
  155. package/src/lib/components/selection-lists/multi-select/multi-select.component.html +170 -0
  156. package/src/lib/components/selection-lists/multi-select/multi-select.component.scss +312 -0
  157. package/src/lib/components/selection-lists/multi-select/multi-select.component.spec.ts +61 -0
  158. package/src/lib/components/selection-lists/multi-select/multi-select.component.ts +372 -0
  159. package/src/lib/components/selection-lists/selection-list/selection-list.component.html +125 -0
  160. package/src/lib/components/selection-lists/selection-list/selection-list.component.scss +267 -0
  161. package/src/lib/components/selection-lists/selection-list/selection-list.component.spec.ts +66 -0
  162. package/src/lib/components/selection-lists/selection-list/selection-list.component.ts +315 -0
  163. package/src/lib/components/selection-lists/selection-lists-base.ts +35 -0
  164. package/src/lib/components/selection-lists/selection-lists-const.ts +17 -0
  165. package/src/lib/components/selection-lists/selection-lists-interface.ts +7 -0
  166. package/src/lib/components/selection-lists/selection-lists.type.ts +1 -0
  167. package/src/lib/components/side-nav/side-nav.component.html +101 -0
  168. package/src/lib/components/side-nav/side-nav.component.scss +295 -0
  169. package/src/lib/components/side-nav/side-nav.component.spec.ts +0 -0
  170. package/src/lib/components/side-nav/side-nav.component.ts +18 -0
  171. package/src/lib/components/side-nav/side-nav.type.ts +28 -0
  172. package/src/lib/components/snackbar/snackbar.component.html +33 -0
  173. package/src/lib/components/snackbar/snackbar.component.scss +195 -0
  174. package/src/lib/components/snackbar/snackbar.component.ts +112 -0
  175. package/src/lib/components/snackbar/snackbar.type.ts +27 -0
  176. package/src/lib/components/status/chip/chip.component.html +51 -0
  177. package/src/lib/components/status/chip/chip.component.scss +149 -0
  178. package/src/lib/components/status/chip/chip.component.spec.ts +62 -0
  179. package/src/lib/components/status/chip/chip.component.ts +83 -0
  180. package/src/lib/components/status/chip/chip.type.ts +42 -0
  181. package/src/lib/components/status/directives/badge/badge.directive.spec.ts +60 -0
  182. package/src/lib/components/status/directives/badge/badge.directive.ts +190 -0
  183. package/src/lib/components/status/directives/badge/badge.interface.ts +19 -0
  184. package/src/lib/components/status/pill/pill.component.html +40 -0
  185. package/src/lib/components/status/pill/pill.component.scss +113 -0
  186. package/src/lib/components/status/pill/pill.component.spec.ts +47 -0
  187. package/src/lib/components/status/pill/pill.component.ts +83 -0
  188. package/src/lib/components/status/pill/pill.type.ts +42 -0
  189. package/src/lib/components/status/status.interface.ts +57 -0
  190. package/src/lib/components/status/status.type.ts +62 -0
  191. package/src/lib/components/status/tag/tag.component.html +39 -0
  192. package/src/lib/components/status/tag/tag.component.scss +140 -0
  193. package/src/lib/components/status/tag/tag.component.spec.ts +47 -0
  194. package/src/lib/components/status/tag/tag.component.ts +83 -0
  195. package/src/lib/components/status/tag/tag.type.ts +42 -0
  196. package/src/lib/components/stepper/stepper.component.html +83 -0
  197. package/src/lib/components/stepper/stepper.component.scss +196 -0
  198. package/src/lib/components/stepper/stepper.component.ts +482 -0
  199. package/src/lib/components/stepper/stepper.type.ts +60 -0
  200. package/src/lib/components/table/table.component.html +438 -0
  201. package/src/lib/components/table/table.component.scss +259 -0
  202. package/src/lib/components/table/table.component.spec.ts +117 -0
  203. package/src/lib/components/table/table.component.ts +215 -0
  204. package/src/lib/components/table/table.enum.ts +4 -0
  205. package/src/lib/components/table/table.function.ts +47 -0
  206. package/src/lib/components/table/table.interface.ts +143 -0
  207. package/src/lib/components/table/table.pipe.ts +62 -0
  208. package/src/lib/components/table/table.type.ts +15 -0
  209. package/src/lib/components/tabs/tabs.component.html +88 -0
  210. package/src/lib/components/tabs/tabs.component.scss +305 -0
  211. package/src/lib/components/tabs/tabs.component.spec.ts +94 -0
  212. package/src/lib/components/tabs/tabs.component.ts +282 -0
  213. package/src/lib/components/tabs/tabs.type.ts +81 -0
  214. package/src/lib/components/title-bar/title-bar.component.html +21 -0
  215. package/src/lib/components/title-bar/title-bar.component.scss +139 -0
  216. package/src/lib/components/title-bar/title-bar.component.spec.ts +44 -0
  217. package/src/lib/components/title-bar/title-bar.component.ts +13 -0
  218. package/src/lib/components/toast/toast.component.html +36 -0
  219. package/src/lib/components/toast/toast.component.scss +241 -0
  220. package/src/lib/components/toast/toast.component.ts +165 -0
  221. package/src/lib/components/toast/toast.type.ts +37 -0
  222. package/src/lib/components/toast-stack/toast-stack.component.html +30 -0
  223. package/src/lib/components/toast-stack/toast-stack.component.scss +35 -0
  224. package/src/lib/components/toast-stack/toast-stack.component.ts +51 -0
  225. package/src/lib/consts/country-prefix.ts +244 -0
  226. package/src/lib/directives/tooltip/popover.directive.ts +274 -0
  227. package/src/lib/directives/tooltip/tooltip.directive.spec.ts +86 -0
  228. package/src/lib/directives/tooltip/tooltip.directive.ts +234 -0
  229. package/src/lib/directives/tooltip/tooltip.interface.ts +29 -0
  230. package/src/lib/directives/tooltip/tooltip.type.ts +9 -0
  231. package/src/lib/interfaces/common.interfaces.ts +4 -0
  232. package/src/lib/pipes/chunk.pipe.ts +16 -0
  233. package/src/lib/pipes/safe-html.pipe.ts +14 -0
  234. package/src/lib/pipes/sanitize-html.pipe.ts +23 -0
  235. package/src/lib/types/base.types.ts +23 -0
  236. package/src/lib/types/common.types.ts +98 -0
  237. package/src/lib/types/form.types.ts +5 -0
  238. package/src/lib/utils/common.utils.ts +53 -0
  239. package/src/lib/utils/date.utils.ts +474 -0
  240. package/src/lib/utils/number.utils.ts +16 -0
  241. package/src/lib/utils/uuid.utils.ts +39 -0
  242. package/src/public-api.ts +114 -0
  243. package/tsconfig.lib.json +17 -0
  244. package/tsconfig.lib.prod.json +10 -0
  245. package/tsconfig.spec.json +9 -0
  246. package/fesm2022/fragments.mjs +0 -8928
  247. package/fesm2022/fragments.mjs.map +0 -1
  248. package/index.d.ts +0 -3929
@@ -0,0 +1,36 @@
1
+
2
+ <div class="frg-toggle-switch__wrapper"
3
+ [class.input-error]="hasError"
4
+ [class.input-warning]="hasWarning"
5
+ >
6
+ @if(label){
7
+ <label [for]="id">{{ label | inputRequiredLabel: required }}</label>
8
+ }
9
+ <button
10
+ type="button"
11
+ class="frg-toggle-switch"
12
+ [ngClass]="[
13
+ 'frg-toggle-switch--' + type,
14
+ value ? 'frg-toggle-switch--on' : 'frg-toggle-switch--off',
15
+ disabled ? 'disabled' : ''
16
+ ]"
17
+ [aria-checked]="value"
18
+ [disabled]="disabled"
19
+ (click)="toggle()"
20
+ (keydown)="onKeydown($event)"
21
+ >
22
+ <span class="handle">
23
+ @if (disabled) {
24
+ <span class="fas fa-ban"></span>
25
+ }
26
+ </span>
27
+ </button>
28
+
29
+ @if(showValidation) {
30
+ <frg-input-validation
31
+ [errorList]="errorList"
32
+ [warningList]="warningList"
33
+ [isFormInvalid]="hasError"
34
+ ></frg-input-validation>
35
+ }
36
+ </div>
@@ -0,0 +1,121 @@
1
+ @use "sass:color";
2
+ @use './../../../../../assets/styles/scss/variables' as *;
3
+ @use './../../../../../assets/styles/scss/functions' as *;
4
+
5
+ :host {
6
+ $switch-width: 40px;
7
+ $switch-height: 20px;
8
+ $switch-padding: 2px;
9
+ $handle-size: $switch-height - ($switch-padding * 2);
10
+ $handle-font-ratio: 0.7;
11
+ $handle-font-size: $handle-size * $handle-font-ratio;
12
+ $handle-font-size-rem: px-to-rem($handle-font-size);
13
+ $translate-x: $switch-width - $switch-height;
14
+
15
+
16
+ label {
17
+ display: flex;
18
+ font-size: $font-size-xs;
19
+ color: $input-text-color;
20
+ }
21
+
22
+ .input-error label {
23
+ color: $color-danger;
24
+ }
25
+
26
+ .frg-toggle-switch {
27
+ width: $switch-width;
28
+ height: $switch-height;
29
+ position: relative;
30
+ display: inline-block;
31
+ background: $color-light-soft;
32
+ border-radius: .25rem;
33
+ border: none;
34
+ padding: 0;
35
+ box-shadow: $box-shadow-inner-sm;
36
+ box-sizing: content-box;
37
+ cursor: pointer;
38
+ -webkit-appearance: none;
39
+ -moz-appearance: none;
40
+ appearance: none;
41
+ transition: background 180ms ease, border-color 180ms ease, box-shadow 160ms ease;
42
+ vertical-align: middle;
43
+ user-select: none;
44
+ -webkit-tap-highlight-color: transparent;
45
+
46
+ &:focus {
47
+ outline: none;
48
+ }
49
+
50
+ &:focus-visible {
51
+ box-shadow: 0 0 0 4px rgba($color-primary, 0.14);
52
+ }
53
+
54
+ &.disabled {
55
+ cursor: not-allowed;
56
+ opacity: 0.65;
57
+ pointer-events: none;
58
+ background: $input-disabled-background;
59
+ border-color: $input-disabled-border-color;
60
+ }
61
+
62
+ &--off {
63
+ background: $color-light-soft;
64
+ }
65
+
66
+ &--on {
67
+ background: $color-primary;
68
+ border-color: color.scale($color-primary, $lightness: -20%);
69
+ }
70
+
71
+ .handle {
72
+ width: $handle-size;
73
+ height: $handle-size;
74
+ background: $color-light;
75
+ border-radius: .25rem;
76
+ position: absolute;
77
+ top: $switch-padding;
78
+ left: $switch-padding;
79
+ box-shadow: $box-shadow-md;
80
+ transition: transform 160ms cubic-bezier(.2, .8, .2, 1), box-shadow 120ms ease;
81
+ will-change: transform;
82
+ display: block;
83
+ font-weight: 600;
84
+ color: $color-dark-neutral;
85
+ text-transform: uppercase;
86
+ font-size: $handle-font-size-rem;
87
+ }
88
+
89
+ &--circle {
90
+ border-radius: $switch-height;
91
+
92
+ .handle {
93
+ border-radius: 50%;
94
+ }
95
+ }
96
+
97
+ &.frg-toggle-switch--on .handle {
98
+ transform: translateX($translate-x);
99
+ }
100
+
101
+ &:not(.disabled):hover .handle {
102
+ box-shadow: $box-shadow-md;
103
+ }
104
+
105
+ &:active .handle {
106
+ transform: translateX(0) scale(0.98);
107
+ }
108
+
109
+ &.frg-toggle-switch--on:active .handle {
110
+ transform: translateX($translate-x) scale(0.98);
111
+ }
112
+
113
+ @media (prefers-reduced-motion: reduce) {
114
+
115
+ .handle,
116
+ & {
117
+ transition: none !important;
118
+ }
119
+ }
120
+ }
121
+ }
@@ -0,0 +1,54 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { By } from '@angular/platform-browser';
3
+ import { InputToggleSwitchComponent } from './input-toggle-switch.component';
4
+
5
+ describe('InputToggleSwitchComponent', () => {
6
+ let fixture: ComponentFixture<InputToggleSwitchComponent>;
7
+ let component: InputToggleSwitchComponent;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [InputToggleSwitchComponent]
12
+ }).compileComponents();
13
+
14
+ fixture = TestBed.createComponent(InputToggleSwitchComponent);
15
+ component = fixture.componentInstance;
16
+ });
17
+
18
+ it('toggles on click', () => {
19
+ component.value = false;
20
+
21
+ fixture.detectChanges();
22
+
23
+ const button = fixture.debugElement.query(By.css('.frg-toggle-switch'));
24
+ button.nativeElement.click();
25
+ fixture.detectChanges();
26
+
27
+ expect(component.value).toBeTrue();
28
+ expect(button.nativeElement.classList).toContain('frg-toggle-switch--on');
29
+ });
30
+
31
+ it('does not toggle when disabled', () => {
32
+ component.value = false;
33
+ component.disabled = true;
34
+
35
+ fixture.detectChanges();
36
+
37
+ const button = fixture.debugElement.query(By.css('.frg-toggle-switch'));
38
+ button.nativeElement.click();
39
+
40
+ expect(component.value).toBeFalse();
41
+ });
42
+
43
+ it('toggles on Enter key', () => {
44
+ component.value = false;
45
+
46
+ fixture.detectChanges();
47
+
48
+ const button = fixture.debugElement.query(By.css('.frg-toggle-switch'));
49
+ button.nativeElement.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
50
+ fixture.detectChanges();
51
+
52
+ expect(component.value).toBeTrue();
53
+ });
54
+ });
@@ -0,0 +1,117 @@
1
+ import { Component, Input } from '@angular/core';
2
+ import { InputBase } from '../input-base';
3
+ import { DEFAULT_INPUT_TOGGLE_SWITCH_ERROR_MESSAGES, DEFAULT_INPUT_TOGGLE_SWITCH_WARNINGS_MESSAGES } from '../input-consts';
4
+ import { InputToggleSwitchType } from '../input-type';
5
+ import { InputValidationComponent } from '../input-validation/input-validation.component';
6
+ import { InputRequiredLabelPipe } from '../input.pipe';
7
+ import { NgClass } from '@angular/common';
8
+
9
+ @Component({
10
+ selector: 'frg-input-toggle-switch',
11
+ imports: [InputRequiredLabelPipe ,InputValidationComponent, NgClass],
12
+ templateUrl: './input-toggle-switch.component.html',
13
+ styleUrls: ['./input-toggle-switch.component.scss'],
14
+ })
15
+ export class InputToggleSwitchComponent extends InputBase<boolean> {
16
+
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 disabled: boolean = false;
29
+ /**
30
+ * @inheritdoc
31
+ */
32
+ @Input() public override errorMessages: Record<string, string> = {};
33
+ /**
34
+ * @inheritdoc
35
+ */
36
+ @Input() public override warningMessages: Record<string, string> = {};
37
+ /**
38
+ * @inheritdoc
39
+ */
40
+ @Input() public override showValidation: boolean = true;
41
+ /**
42
+ * The toggle switch type
43
+ * @default 'square'
44
+ */
45
+ @Input() public type: InputToggleSwitchType = 'square';
46
+
47
+ /**
48
+ * Toggles the switch value
49
+ */
50
+ public toggle(): void {
51
+ if(this.disabled) return;
52
+
53
+ this.value = !this.value;
54
+ this.onChange(this.value);
55
+ this.onTouched();
56
+ }
57
+
58
+ public onKeydown(event: KeyboardEvent) {
59
+ if (this.disabled) return;
60
+
61
+ const keys = ['Enter', ' ', 'Spacebar', 'ArrowLeft', 'ArrowRight'];
62
+ if (keys.includes(event.key)) {
63
+ event.preventDefault();
64
+ this.toggle();
65
+ }
66
+ }
67
+
68
+ /**
69
+ * @inheritdoc
70
+ */
71
+ protected updateView(_value: boolean | null): void {
72
+ // Handled by Angular binding
73
+ }
74
+
75
+ /**
76
+ * @inheritdoc
77
+ */
78
+ protected updateDisabledState(_isDisabled: boolean): void {
79
+ // Handled by Angular binding
80
+ }
81
+
82
+ /**
83
+ * @inheritdoc
84
+ */
85
+ protected override get errorList(): string[] {
86
+ if (!this.control?.errors) return [];
87
+ const errors = this.control.errors;
88
+ return Object.keys(errors).map(key => {
89
+ if (this.errorMessages[key]) {
90
+ return this.errorMessages[key];
91
+ }
92
+ return DEFAULT_INPUT_TOGGLE_SWITCH_ERROR_MESSAGES[key] || 'Invalid field.';
93
+ });
94
+ }
95
+
96
+ /**
97
+ * Returns warning messages. Consumers may pass arbitrary warnings via `warningMessages`.
98
+ * Falls back to DEFAULT_INPUT_TOGGLE_SWITCH_WARNINGS_MESSAGES or a generic message.
99
+ */
100
+ protected override get warningList(): string[] {
101
+ return Object.keys(this.warningMessages).map(key => {
102
+ return (
103
+ this.warningMessages[key] ||
104
+ DEFAULT_INPUT_TOGGLE_SWITCH_WARNINGS_MESSAGES[key] ||
105
+ ''
106
+ );
107
+ });
108
+ }
109
+
110
+ /**
111
+ * Returns whether any warnings are active.
112
+ */
113
+ protected get hasWarning(): boolean {
114
+ return this.warningList.length > 0;
115
+ }
116
+
117
+ }
@@ -0,0 +1,18 @@
1
+ export type InputTextType = 'text' | 'email' | 'password' | 'tel' | 'url';
2
+ export type InputNumberType = 'number' | 'decimal';
3
+ export type InputDateType = 'date' | 'datetime-local';
4
+ export type InputTimeType = 'time';
5
+ export type InputTimePartial = 'hour' | 'minute' | 'second' | 'meridiem';
6
+ export type InputTimeMeridiem = 'AM' | 'PM';
7
+ export type InputToggleSwitchType = 'square' | 'circle';
8
+ export type InputSliderSize = 'small' | 'medium' | 'big';
9
+ export type InputChoiceStyleType =
10
+ | 'primary'
11
+ | 'secondary'
12
+ | 'tertiary'
13
+ | 'info'
14
+ | 'success'
15
+ | 'warning'
16
+ | 'danger'
17
+ | 'light'
18
+ | 'dark';
@@ -0,0 +1,19 @@
1
+ @if(errorList.length && isFormInvalid){
2
+ <div class="frg-input__error-list">
3
+ <ul>
4
+ @for(error of errorList; track error){
5
+ <li>{{ error }}</li>
6
+ }
7
+ </ul>
8
+ </div>
9
+ }
10
+
11
+ @if(warningList.length){
12
+ <div class="frg-input__warning-list">
13
+ <ul>
14
+ @for(warning of warningList; track warning){
15
+ <li>{{ warning }}</li>
16
+ }
17
+ </ul>
18
+ </div>
19
+ }
@@ -0,0 +1,39 @@
1
+ @use './../../../../../assets/styles/scss/variables' as *;
2
+
3
+ :host {
4
+ .frg-input {
5
+ &__error-list {
6
+ width: 100%;
7
+ margin-top: 0.25rem;
8
+
9
+ ul {
10
+ padding: 0 0 0 1.5rem;
11
+ font-size: $font-size-xs;
12
+ color: $color-danger;
13
+ list-style: square;
14
+ margin-bottom: 0;
15
+ }
16
+
17
+ li {
18
+ margin-bottom: 0.25rem;
19
+ }
20
+ }
21
+
22
+ &__warning-list {
23
+ width: 100%;
24
+ margin-top: 0.25rem;
25
+
26
+ ul {
27
+ padding: 0 0 0 1.5rem;
28
+ font-size: $font-size-xs;
29
+ color: $color-warning;
30
+ list-style: square;
31
+ margin-bottom: 0;
32
+ }
33
+
34
+ li {
35
+ margin-bottom: 0.25rem;
36
+ }
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,45 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { By } from '@angular/platform-browser';
3
+ import { InputValidationComponent } from './input-validation.component';
4
+
5
+ describe('InputValidationComponent', () => {
6
+ let fixture: ComponentFixture<InputValidationComponent>;
7
+ let component: InputValidationComponent;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [InputValidationComponent]
12
+ }).compileComponents();
13
+
14
+ fixture = TestBed.createComponent(InputValidationComponent);
15
+ component = fixture.componentInstance;
16
+ });
17
+
18
+ it('renders error list when form is invalid', () => {
19
+ component.errorList = ['Required', 'Too short'];
20
+ component.isFormInvalid = true;
21
+
22
+ fixture.detectChanges();
23
+
24
+ const errors = fixture.debugElement.queryAll(By.css('.frg-input__error-list li'));
25
+ expect(errors.length).toBe(2);
26
+ });
27
+
28
+ it('does not render errors when form is valid', () => {
29
+ component.errorList = ['Required'];
30
+ component.isFormInvalid = false;
31
+
32
+ fixture.detectChanges();
33
+
34
+ expect(fixture.debugElement.query(By.css('.frg-input__error-list'))).toBeNull();
35
+ });
36
+
37
+ it('renders warning list when provided', () => {
38
+ component.warningList = ['Check value'];
39
+
40
+ fixture.detectChanges();
41
+
42
+ const warnings = fixture.debugElement.queryAll(By.css('.frg-input__warning-list li'));
43
+ expect(warnings.length).toBe(1);
44
+ });
45
+ });
@@ -0,0 +1,13 @@
1
+ import { Component, Input } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'frg-input-validation',
5
+ imports: [],
6
+ templateUrl: './input-validation.component.html',
7
+ styleUrl: './input-validation.component.scss',
8
+ })
9
+ export class InputValidationComponent {
10
+ @Input() errorList: string[] = [];
11
+ @Input() warningList: string[] = [];
12
+ @Input() isFormInvalid: boolean = true;
13
+ }
@@ -0,0 +1,14 @@
1
+ import { Pipe, PipeTransform } from '@angular/core';
2
+
3
+ @Pipe({
4
+ name: 'inputRequiredLabel',
5
+ standalone: true
6
+ })
7
+ export class InputRequiredLabelPipe implements PipeTransform {
8
+ transform(label: string, isRequired: boolean): string {
9
+ if (isRequired) {
10
+ return `${label} *`;
11
+ }
12
+ return label;
13
+ }
14
+ }
@@ -0,0 +1 @@
1
+ <ng-content></ng-content>
@@ -0,0 +1,33 @@
1
+ :host {
2
+ box-sizing: border-box;
3
+ display: block;
4
+ width: 100%;
5
+ }
6
+
7
+ :host(.frg-container) {
8
+ margin-inline: auto;
9
+ }
10
+
11
+ :host(.frg-container--padded) {
12
+ padding-inline: 1.5rem;
13
+ }
14
+
15
+ :host(.frg-container--sm) {
16
+ max-width: 36rem;
17
+ }
18
+
19
+ :host(.frg-container--md) {
20
+ max-width: 54rem;
21
+ }
22
+
23
+ :host(.frg-container--lg) {
24
+ max-width: 72rem;
25
+ }
26
+
27
+ :host(.frg-container--xl) {
28
+ max-width: 90rem;
29
+ }
30
+
31
+ :host(.frg-container--full) {
32
+ max-width: none;
33
+ }
@@ -0,0 +1,32 @@
1
+ import { Component, HostBinding, Input } from '@angular/core';
2
+ import { TContainerSize } from './container.type';
3
+
4
+ @Component({
5
+ selector: 'frg-container',
6
+ templateUrl: './container.component.html',
7
+ styleUrl: './container.component.scss'
8
+ })
9
+ export class ContainerComponent {
10
+ @Input() size: TContainerSize = 'lg';
11
+ @Input() padded: boolean = true;
12
+
13
+ @HostBinding('class.frg-container') baseClass = true;
14
+ @HostBinding('class.frg-container--sm') get isSmall() {
15
+ return this.size === 'sm';
16
+ }
17
+ @HostBinding('class.frg-container--md') get isMedium() {
18
+ return this.size === 'md';
19
+ }
20
+ @HostBinding('class.frg-container--lg') get isLarge() {
21
+ return this.size === 'lg';
22
+ }
23
+ @HostBinding('class.frg-container--xl') get isXLarge() {
24
+ return this.size === 'xl';
25
+ }
26
+ @HostBinding('class.frg-container--full') get isFull() {
27
+ return this.size === 'full';
28
+ }
29
+ @HostBinding('class.frg-container--padded') get isPadded() {
30
+ return this.padded;
31
+ }
32
+ }
@@ -0,0 +1 @@
1
+ export type TContainerSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';
@@ -0,0 +1 @@
1
+ <span class="frg-divider__line" aria-hidden="true"></span>
@@ -0,0 +1,60 @@
1
+ @use './../../../../../assets/styles/scss/variables' as *;
2
+
3
+ :host {
4
+ box-sizing: border-box;
5
+ display: block;
6
+ }
7
+
8
+ :host(.frg-divider--horizontal) {
9
+ width: 100%;
10
+ }
11
+
12
+ :host(.frg-divider--sm.frg-divider--horizontal) {
13
+ margin-block: 0.5rem;
14
+ }
15
+
16
+ :host(.frg-divider--md.frg-divider--horizontal) {
17
+ margin-block: 1rem;
18
+ }
19
+
20
+ :host(.frg-divider--lg.frg-divider--horizontal) {
21
+ margin-block: 1.5rem;
22
+ }
23
+
24
+ :host(.frg-divider--sm.frg-divider--vertical) {
25
+ margin-inline: 0.5rem;
26
+ }
27
+
28
+ :host(.frg-divider--md.frg-divider--vertical) {
29
+ margin-inline: 1rem;
30
+ }
31
+
32
+ :host(.frg-divider--lg.frg-divider--vertical) {
33
+ margin-inline: 1.5rem;
34
+ }
35
+
36
+ .frg-divider__line {
37
+ display: block;
38
+ width: 100%;
39
+ border-color: $color-light-soft;
40
+ border-style: solid;
41
+ border-width: 0;
42
+ }
43
+
44
+ :host(.frg-divider--horizontal) .frg-divider__line {
45
+ border-top-width: 1px;
46
+ }
47
+
48
+ :host(.frg-divider--vertical) {
49
+ height: 100%;
50
+ }
51
+
52
+ :host(.frg-divider--vertical) .frg-divider__line {
53
+ width: 0;
54
+ height: 100%;
55
+ border-left-width: 1px;
56
+ }
57
+
58
+ :host(.frg-divider--dashed) .frg-divider__line {
59
+ border-style: dashed;
60
+ }
@@ -0,0 +1,38 @@
1
+ import { Component, HostBinding, Input } from '@angular/core';
2
+ import { TDividerOrientation, TDividerSpacing } from './divider.type';
3
+
4
+ @Component({
5
+ selector: 'frg-divider',
6
+ templateUrl: './divider.component.html',
7
+ styleUrl: './divider.component.scss'
8
+ })
9
+ export class DividerComponent {
10
+ @Input() orientation: TDividerOrientation = 'horizontal';
11
+ @Input() spacing: TDividerSpacing = 'md';
12
+ @Input() dashed: boolean = false;
13
+
14
+ @HostBinding('class.frg-divider') baseClass = true;
15
+ @HostBinding('class.frg-divider--horizontal') get isHorizontal() {
16
+ return this.orientation === 'horizontal';
17
+ }
18
+ @HostBinding('class.frg-divider--vertical') get isVertical() {
19
+ return this.orientation === 'vertical';
20
+ }
21
+ @HostBinding('class.frg-divider--sm') get isSmall() {
22
+ return this.spacing === 'sm';
23
+ }
24
+ @HostBinding('class.frg-divider--md') get isMedium() {
25
+ return this.spacing === 'md';
26
+ }
27
+ @HostBinding('class.frg-divider--lg') get isLarge() {
28
+ return this.spacing === 'lg';
29
+ }
30
+ @HostBinding('class.frg-divider--dashed') get isDashed() {
31
+ return this.dashed;
32
+ }
33
+
34
+ @HostBinding('attr.role') role = 'separator';
35
+ @HostBinding('attr.aria-orientation') get ariaOrientation() {
36
+ return this.orientation;
37
+ }
38
+ }
@@ -0,0 +1,2 @@
1
+ export type TDividerOrientation = 'horizontal' | 'vertical';
2
+ export type TDividerSpacing = 'sm' | 'md' | 'lg';
@@ -0,0 +1,21 @@
1
+ @if (hasHeader) {
2
+ <div class="frg-section__header">
3
+ @if (title) {
4
+ @switch (headingLevel) {
5
+ @case (1) { <h1 class="frg-section__title">{{ title }}</h1> }
6
+ @case (2) { <h2 class="frg-section__title">{{ title }}</h2> }
7
+ @case (3) { <h3 class="frg-section__title">{{ title }}</h3> }
8
+ @case (4) { <h4 class="frg-section__title">{{ title }}</h4> }
9
+ @case (5) { <h5 class="frg-section__title">{{ title }}</h5> }
10
+ @case (6) { <h6 class="frg-section__title">{{ title }}</h6> }
11
+ @default { <h2 class="frg-section__title">{{ title }}</h2> }
12
+ }
13
+ }
14
+ @if (description) {
15
+ <p class="frg-section__description">{{ description }}</p>
16
+ }
17
+ </div>
18
+ }
19
+ <div class="frg-section__content">
20
+ <ng-content></ng-content>
21
+ </div>