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

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 +2 -18
  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,170 @@
1
+ <div class="frg-multi-select" [class.multi-select-error]="hasError">
2
+ <label [attr.for]="id + '-options'">{{ label }}</label>
3
+
4
+ @if(hasSearch) {
5
+ <div class="options-search">
6
+ <input
7
+ #searchInput
8
+ type="text"
9
+ [attr.name]="id + '-options'"
10
+ [attr.id]="id + '-options'"
11
+ class="options-search__input"
12
+ [class.open]="isOpen"
13
+ [attr.placeholder]="'Search…'"
14
+ aria-label="Search options"
15
+ role="searchbox"
16
+ [value]="searchTerm"
17
+ (input)="onSearch($event)"
18
+ (blur)="onBlur($event)"
19
+ (focus)="onFocus()"
20
+ (keydown)="onSearchKeyDown($event)"
21
+ />
22
+ <ng-container [ngTemplateOutlet]="buttonsTemplate"></ng-container>
23
+ </div>
24
+
25
+ @if(showChips && selectedItems.length) {
26
+ <div class="selected-chips selected-chips--below">
27
+ @for(item of selectedItems; track item.id) {
28
+ <frg-chip
29
+ [id]="item.id"
30
+ [label]="item.label || ''"
31
+ size="sm"
32
+ [style]="chipsStyle"
33
+ [removable]="true"
34
+ [disabled]="disabled"
35
+ (removed)="removeItemById($event)"
36
+ ></frg-chip>
37
+ }
38
+ </div>
39
+ } @else if(selectedItems.length) {
40
+ <div class="selected-labels">
41
+ {{ selectedLabels }}
42
+ </div>
43
+ }
44
+ } @else {
45
+ <div class="frg-multi-select__handle-buttons">
46
+ @if(showChips) {
47
+ <div
48
+ class="custom-select custom-select--chips"
49
+ [id]="id + '-options'"
50
+ [attr.name]="id + '-options'"
51
+ [class.open]="isOpen"
52
+ [class.disabled]="disabled"
53
+ [attr.tabindex]="disabled ? -1 : 0"
54
+ [attr.aria-expanded]="isOpen"
55
+ (click)="toggleDropdown($event)"
56
+ (keydown)="onKeyDown($event)"
57
+ [attr.aria-controls]="id + '-options'"
58
+ >
59
+ @if(selectedItems.length) {
60
+ <div class="selected-chips">
61
+ @for(item of selectedItems; track item.id) {
62
+ <frg-chip
63
+ [id]="item.id"
64
+ [label]="item.label || ''"
65
+ size="sm"
66
+ [style]="chipsStyle"
67
+ [removable]="true"
68
+ [disabled]="disabled"
69
+ (removed)="removeItemById($event)"
70
+ ></frg-chip>
71
+ }
72
+ </div>
73
+ } @else {
74
+ <span class="selected-labels__text selected-labels__placeholder">{{ placeholder || 'Select.' }}</span>
75
+ }
76
+ </div>
77
+ } @else {
78
+ <button
79
+ type="button"
80
+ class="custom-select"
81
+ [id]="id + '-options'"
82
+ [attr.name]="id + '-options'"
83
+ [class.open]="isOpen"
84
+ [disabled]="disabled"
85
+ [attr.aria-expanded]="isOpen"
86
+ (click)="toggleDropdown($event)"
87
+ (keydown)="onKeyDown($event)"
88
+ [attr.aria-controls]="id + '-options'"
89
+ >
90
+ @if(valuesTemplate) {
91
+ <ng-container
92
+ [ngTemplateOutlet]="valuesTemplate"
93
+ [ngTemplateOutletContext]="{ $implicit: selectedItems }"
94
+ ></ng-container>
95
+ } @else {
96
+ <span class="selected-labels__text" [class.selected-labels__placeholder]="!selectedItems.length">{{ selectedLabels }}</span>
97
+ }
98
+ </button>
99
+ }
100
+ <ng-container [ngTemplateOutlet]="buttonsTemplate"></ng-container>
101
+ </div>
102
+ }
103
+
104
+ @if(isOpen) {
105
+ <div
106
+ class="options"
107
+ [id]="id + '-options'"
108
+ [class.open-up]="openDirection === 'top'"
109
+ [class.open-down]="openDirection === 'down'"
110
+ >
111
+ @for(item of filteredItems; track item.id; let idx = $index) {
112
+ <button
113
+ #optionButton
114
+ type="button"
115
+ class="option"
116
+ [class.disabled]="item.disabled"
117
+ [class.selected]="selectedIds.includes(item.id)"
118
+ [disabled]="item.disabled"
119
+ (focus)="onFocus()"
120
+ (blur)="onBlur($event)"
121
+ (click)="selectItem(item, $event)"
122
+ (keydown)="onOptionKeyDown($event, item, idx)"
123
+ >
124
+ <input
125
+ type="checkbox"
126
+ [attr.id]="id + '-option-' + idx"
127
+ [attr.name]="id + '-option'"
128
+ [checked]="item.selected"
129
+ readonly
130
+ />
131
+ @if(optionTemplate) {
132
+ <ng-container [ngTemplateOutlet]="optionTemplate" [ngTemplateOutletContext]="{ $implicit: item }"></ng-container>
133
+ } @else {
134
+ {{ item.label }}
135
+ }
136
+ </button>
137
+ }
138
+ </div>
139
+ }
140
+
141
+ <frg-input-validation
142
+ [errorList]="errorList"
143
+ [isFormInvalid]="hasError"
144
+ ></frg-input-validation>
145
+ </div>
146
+
147
+ <ng-template #buttonsTemplate>
148
+ <div class="multi-select__actions">
149
+ @if((value && selectedItems.length) || (hasSearch && searchTerm.length)) {
150
+ <button
151
+ type="button"
152
+ class="clear-button"
153
+ aria-label="Clear selection"
154
+ (click)="clearValue($event)"
155
+ >
156
+ <span class="fas fa-xmark"></span>
157
+ </button>
158
+ }
159
+ <button
160
+ type="button"
161
+ class="arrow-button"
162
+ [class.open]="isOpen"
163
+ aria-label="Toggle dropdown"
164
+ (click)="toggleDropdown($event)"
165
+ >
166
+ <span class="arrow-icon fas fa-chevron-down"></span>
167
+ </button>
168
+ </div>
169
+ </ng-template>
170
+
@@ -0,0 +1,312 @@
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
+ label {
9
+ display: flex;
10
+ font-size: $font-size-xs;
11
+ color: $input-text-color;
12
+ padding: $input-padding 0;
13
+ }
14
+
15
+ .frg-multi-select {
16
+ position: relative;
17
+ display: inline-block;
18
+ width: 100%;
19
+
20
+ .options-search {
21
+ position: relative;
22
+ display: flex;
23
+ align-items: center;
24
+ width: 100%;
25
+ border-bottom: 2px solid $input-border-color;
26
+ transition: border-color 0.3s;
27
+
28
+ &:has(.open) {
29
+ border-color: $input-focus-border-color;
30
+ }
31
+
32
+ &.focus,
33
+ &:focus-visible,
34
+ &:hover {
35
+ border-color: $input-focus-border-color;
36
+ }
37
+
38
+ &__input {
39
+ flex: 1;
40
+ padding: $input-padding;
41
+ padding-right: 3rem;
42
+ border: none;
43
+ background: transparent;
44
+ font-family: $input-font-family;
45
+ font-size: 1rem;
46
+ color: $color-dark-neutral;
47
+ cursor: pointer;
48
+ outline: none;
49
+
50
+ &::placeholder {
51
+ color: $input-text-color;
52
+ opacity: 0.7;
53
+ }
54
+
55
+ &:disabled {
56
+ cursor: not-allowed;
57
+ opacity: 0.6;
58
+ }
59
+ }
60
+ }
61
+
62
+ &__handle-buttons {
63
+ display: flex;
64
+ align-items: center;
65
+ width: 100%;
66
+ border-bottom: 2px solid $input-border-color;
67
+ background: transparent;
68
+ font-family: $input-font-family;
69
+ color: $input-text-color;
70
+ cursor: pointer;
71
+ transition: border-color 0.3s;
72
+ position: relative;
73
+
74
+ &:has(.open) {
75
+ border-color: $input-focus-border-color;
76
+ }
77
+
78
+ &:hover,
79
+ &:focus-visible,
80
+ &.focus {
81
+ border-color: $input-focus-border-color;
82
+ }
83
+
84
+ .custom-select {
85
+ flex: 1 1 auto;
86
+ min-width: 0;
87
+ display: flex;
88
+ align-items: center;
89
+ padding: $input-padding;
90
+ padding-right: 3rem;
91
+ border: none;
92
+ background: transparent;
93
+ text-align: left;
94
+ font-size: 1rem;
95
+ overflow: hidden;
96
+
97
+ &:focus-visible {
98
+ outline: none;
99
+ }
100
+
101
+ &:disabled {
102
+ cursor: not-allowed;
103
+ opacity: 0.6;
104
+ }
105
+
106
+ &.open {
107
+ border-bottom-color: $color-primary;
108
+ }
109
+
110
+ .item-label {
111
+ flex: 1 1 auto;
112
+ min-width: 0; // critical for ellipsis in flex
113
+ overflow: hidden;
114
+ white-space: nowrap;
115
+ text-overflow: ellipsis;
116
+ opacity: 0.7;
117
+ }
118
+
119
+ .selected {
120
+ flex: 1 1 auto;
121
+ min-width: 0;
122
+ overflow: hidden;
123
+ white-space: nowrap;
124
+ text-overflow: ellipsis;
125
+ }
126
+ }
127
+
128
+ .custom-select--chips {
129
+ min-height: 2.25rem;
130
+ cursor: pointer;
131
+ }
132
+
133
+ .custom-select--chips.disabled {
134
+ cursor: not-allowed;
135
+ opacity: 0.6;
136
+ }
137
+
138
+ }
139
+
140
+ .multi-select__actions {
141
+ position: absolute;
142
+ right: 0;
143
+ top: 50%;
144
+ transform: translateY(-50%);
145
+ display: inline-flex;
146
+ align-items: center;
147
+ padding-right: 0.25rem;
148
+ }
149
+
150
+ .options {
151
+ position: absolute;
152
+ left: 0;
153
+ right: 0;
154
+ background: #fff;
155
+ border-radius: 0.25rem;
156
+ box-shadow: $box-shadow-md;
157
+ z-index: 10;
158
+ max-height: 240px;
159
+ overflow-y: auto;
160
+ animation: dropdown-fade-in 0.2s ease-in-out;
161
+
162
+ &::-webkit-scrollbar {
163
+ width: 0.3rem;
164
+ background-color: transparent;
165
+ }
166
+
167
+ &::-webkit-scrollbar-thumb {
168
+ background-color: $color-primary;
169
+ border-radius: 0.1rem;
170
+ }
171
+
172
+ &::-webkit-scrollbar-thumb:hover {
173
+ background-color: color.adjust($color-primary, $lightness: -10%);
174
+ }
175
+
176
+ .option {
177
+ display: inline-flex;
178
+ gap: .75rem;
179
+ width: 100%;
180
+ padding: 0.5rem 1rem;
181
+ background: transparent;
182
+ border: none;
183
+ text-align: left;
184
+ color: $input-text-color;
185
+ font-size: 0.95rem;
186
+ cursor: pointer;
187
+ transition: background-color 0.15s ease, color 0.15s ease;
188
+
189
+ &:hover:not(:disabled),
190
+ &:focus-visible:not(:disabled) {
191
+ background-color: color.scale($color-primary, $lightness: 90%);
192
+ outline: none;
193
+ }
194
+
195
+ &.selected {
196
+ background-color: color.scale($color-primary, $lightness: 85%);
197
+ }
198
+
199
+ &:disabled,
200
+ &.disabled {
201
+ opacity: 0.5;
202
+ cursor: not-allowed;
203
+ }
204
+ }
205
+
206
+ &.open-down {
207
+ top: calc(100% + 0.25rem);
208
+ }
209
+
210
+ &.open-up {
211
+ bottom: calc(100% + 0.25rem);
212
+ }
213
+ }
214
+
215
+ .clear-button,
216
+ .arrow-button {
217
+ background: transparent;
218
+ border: none;
219
+ cursor: pointer;
220
+ padding: 0;
221
+ width: 1.25rem;
222
+ height: 1.25rem;
223
+ display: flex;
224
+ align-items: center;
225
+ justify-content: center;
226
+ font-size: 0.75rem;
227
+ line-height: 1;
228
+ color: $color-dark-neutral;
229
+ }
230
+
231
+ .clear-button .fas {
232
+ line-height: 1;
233
+ }
234
+
235
+ .arrow-button {
236
+ display: flex;
237
+ align-items: center;
238
+ justify-content: center;
239
+ background: transparent;
240
+ border: none;
241
+ cursor: pointer;
242
+ transition: transform 0.3s ease;
243
+
244
+ &:disabled {
245
+ cursor: not-allowed;
246
+ opacity: 0.5;
247
+ }
248
+ }
249
+
250
+ .arrow-icon {
251
+ font-size: 0.75rem;
252
+ transition: transform 0.3s ease;
253
+ }
254
+
255
+ .arrow-button.open .arrow-icon {
256
+ transform: rotate(180deg);
257
+ }
258
+
259
+ .selected-labels {
260
+ padding: .2rem .5rem;
261
+ font-size: .875rem;
262
+ color: $color-dark-neutral;
263
+
264
+ &__text {
265
+ color: $color-dark-neutral;
266
+ }
267
+
268
+ &__placeholder {
269
+ color: $input-text-color;
270
+ opacity: 0.7;
271
+ }
272
+ }
273
+
274
+ .selected-chips {
275
+ display: flex;
276
+ flex-wrap: wrap;
277
+ align-items: center;
278
+ gap: 0.25rem;
279
+ min-height: 1.5rem;
280
+ }
281
+
282
+ .selected-chips--below {
283
+ padding: 0.25rem 0.5rem 0;
284
+ }
285
+
286
+ .custom-select--chips.disabled frg-chip {
287
+ pointer-events: none;
288
+ opacity: 0.6;
289
+ }
290
+
291
+ &.multi-select-error .options-search,
292
+ &.multi-select-error .frg-multi-select__handle-buttons {
293
+ border-bottom-color: $color-danger;
294
+ }
295
+
296
+ &.multi-select-error label {
297
+ color: $color-danger;
298
+ }
299
+
300
+ @keyframes dropdown-fade-in {
301
+ from {
302
+ opacity: 0;
303
+ transform: translateY(-10px);
304
+ }
305
+
306
+ to {
307
+ opacity: 1;
308
+ transform: translateY(0);
309
+ }
310
+ }
311
+ }
312
+ }
@@ -0,0 +1,61 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { By } from '@angular/platform-browser';
3
+ import { MultiSelectComponent } from './multi-select.component';
4
+ import { SelectionListItem } from '../selection-lists-interface';
5
+
6
+ describe('MultiSelectComponent', () => {
7
+ let fixture: ComponentFixture<MultiSelectComponent<string>>;
8
+ let component: MultiSelectComponent<string>;
9
+
10
+ const items: SelectionListItem<string>[] = [
11
+ { id: 'a', label: 'Alpha', value: 'alpha', selected: false },
12
+ { id: 'b', label: 'Beta', value: 'beta', selected: false }
13
+ ];
14
+
15
+ beforeEach(async () => {
16
+ await TestBed.configureTestingModule({
17
+ imports: [MultiSelectComponent]
18
+ }).compileComponents();
19
+
20
+ fixture = TestBed.createComponent(MultiSelectComponent<string>);
21
+ component = fixture.componentInstance;
22
+ component.items = [...items];
23
+ });
24
+
25
+ it('opens dropdown when trigger is clicked', () => {
26
+ fixture.detectChanges();
27
+
28
+ const trigger = fixture.debugElement.query(By.css('.custom-select'));
29
+ trigger.nativeElement.click();
30
+
31
+ expect((component as any).isOpen).toBeTrue();
32
+ });
33
+
34
+ it('selects multiple items and updates value', () => {
35
+ const onChangeSpy = jasmine.createSpy('onChange');
36
+ component.registerOnChange(onChangeSpy);
37
+
38
+ fixture.detectChanges();
39
+
40
+ component.selectItem(items[0], new Event('click'));
41
+ component.selectItem(items[1], new Event('click'));
42
+
43
+ expect(component.value).toEqual(['alpha', 'beta']);
44
+ expect((component as any).selectedIds).toEqual(['a', 'b']);
45
+ expect(onChangeSpy).toHaveBeenCalledWith(['alpha', 'beta']);
46
+ });
47
+
48
+ it('clears selections', () => {
49
+ component.items = [
50
+ { id: 'a', label: 'Alpha', value: 'alpha', selected: true },
51
+ { id: 'b', label: 'Beta', value: 'beta', selected: true }
52
+ ];
53
+ (component as any).selectedIds = ['a', 'b'];
54
+ component.value = ['alpha', 'beta'];
55
+
56
+ (component as any).clearValue(new MouseEvent('click'));
57
+
58
+ expect(component.value).toBeNull();
59
+ expect((component as any).selectedIds.length).toBe(0);
60
+ });
61
+ });