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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/README.md +3 -3
  2. package/fesm2022/tacdaed-fragments.mjs +8928 -0
  3. package/fesm2022/tacdaed-fragments.mjs.map +1 -0
  4. package/index.d.ts +3929 -0
  5. package/package.json +29 -22
  6. package/ng-package.json +0 -25
  7. package/src/lib/components/accordion/accordion.component.html +0 -103
  8. package/src/lib/components/accordion/accordion.component.scss +0 -382
  9. package/src/lib/components/accordion/accordion.component.spec.ts +0 -147
  10. package/src/lib/components/accordion/accordion.component.ts +0 -211
  11. package/src/lib/components/accordion/accordion.type.ts +0 -82
  12. package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -43
  13. package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -112
  14. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +0 -33
  15. package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -103
  16. package/src/lib/components/breadcrumb/breadcrumb.interface.ts +0 -7
  17. package/src/lib/components/button/button.component.html +0 -57
  18. package/src/lib/components/button/button.component.scss +0 -445
  19. package/src/lib/components/button/button.component.spec.ts +0 -99
  20. package/src/lib/components/button/button.component.ts +0 -143
  21. package/src/lib/components/button/button.type.ts +0 -7
  22. package/src/lib/components/card/card.component.html +0 -44
  23. package/src/lib/components/card/card.component.scss +0 -114
  24. package/src/lib/components/card/card.component.spec.ts +0 -65
  25. package/src/lib/components/card/card.component.ts +0 -21
  26. package/src/lib/components/card/card.type.ts +0 -3
  27. package/src/lib/components/code-block/code-block.component.html +0 -55
  28. package/src/lib/components/code-block/code-block.component.scss +0 -122
  29. package/src/lib/components/code-block/code-block.component.spec.ts +0 -81
  30. package/src/lib/components/code-block/code-block.component.ts +0 -302
  31. package/src/lib/components/code-block/code-block.interface.ts +0 -28
  32. package/src/lib/components/code-block/code-block.type.ts +0 -73
  33. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.html +0 -14
  34. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.scss +0 -20
  35. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.spec.ts +0 -38
  36. package/src/lib/components/decorative/sparkle-field/sparkle-field.component.ts +0 -181
  37. package/src/lib/components/input/input-base.ts +0 -187
  38. package/src/lib/components/input/input-calendar/input-calendar.component.html +0 -76
  39. package/src/lib/components/input/input-calendar/input-calendar.component.scss +0 -179
  40. package/src/lib/components/input/input-calendar/input-calendar.component.spec.ts +0 -44
  41. package/src/lib/components/input/input-calendar/input-calendar.component.ts +0 -299
  42. package/src/lib/components/input/input-checkbox/input-checkbox.component.html +0 -37
  43. package/src/lib/components/input/input-checkbox/input-checkbox.component.scss +0 -128
  44. package/src/lib/components/input/input-checkbox/input-checkbox.component.spec.ts +0 -43
  45. package/src/lib/components/input/input-checkbox/input-checkbox.component.ts +0 -112
  46. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.html +0 -43
  47. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.scss +0 -140
  48. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.spec.ts +0 -62
  49. package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.ts +0 -136
  50. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.html +0 -81
  51. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.scss +0 -228
  52. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.spec.ts +0 -62
  53. package/src/lib/components/input/input-clock-picker/input-clock-picker.component.ts +0 -178
  54. package/src/lib/components/input/input-consts.ts +0 -132
  55. package/src/lib/components/input/input-date/input-date-validators.ts +0 -41
  56. package/src/lib/components/input/input-date/input-date.component.html +0 -41
  57. package/src/lib/components/input/input-date/input-date.component.scss +0 -95
  58. package/src/lib/components/input/input-date/input-date.component.spec.ts +0 -43
  59. package/src/lib/components/input/input-date/input-date.component.ts +0 -359
  60. package/src/lib/components/input/input-date-time/input-date-time.component.html +0 -70
  61. package/src/lib/components/input/input-date-time/input-date-time.component.scss +0 -133
  62. package/src/lib/components/input/input-date-time/input-date-time.component.spec.ts +0 -36
  63. package/src/lib/components/input/input-date-time/input-date-time.component.ts +0 -387
  64. package/src/lib/components/input/input-file-upload/input-file-upload.component.html +0 -89
  65. package/src/lib/components/input/input-file-upload/input-file-upload.component.scss +0 -171
  66. package/src/lib/components/input/input-file-upload/input-file-upload.component.spec.ts +0 -43
  67. package/src/lib/components/input/input-file-upload/input-file-upload.component.ts +0 -351
  68. package/src/lib/components/input/input-interface.ts +0 -8
  69. package/src/lib/components/input/input-number/input-number-validators.ts +0 -0
  70. package/src/lib/components/input/input-number/input-number.component.html +0 -51
  71. package/src/lib/components/input/input-number/input-number.component.scss +0 -140
  72. package/src/lib/components/input/input-number/input-number.component.spec.ts +0 -44
  73. package/src/lib/components/input/input-number/input-number.component.ts +0 -343
  74. package/src/lib/components/input/input-radio-group/input-radio-group.component.html +0 -44
  75. package/src/lib/components/input/input-radio-group/input-radio-group.component.scss +0 -139
  76. package/src/lib/components/input/input-radio-group/input-radio-group.component.spec.ts +0 -58
  77. package/src/lib/components/input/input-radio-group/input-radio-group.component.ts +0 -132
  78. package/src/lib/components/input/input-slider/input-slider.component.html +0 -111
  79. package/src/lib/components/input/input-slider/input-slider.component.scss +0 -203
  80. package/src/lib/components/input/input-slider/input-slider.component.spec.ts +0 -46
  81. package/src/lib/components/input/input-slider/input-slider.component.ts +0 -410
  82. package/src/lib/components/input/input-text/input-text-validators.ts +0 -67
  83. package/src/lib/components/input/input-text/input-text.component.html +0 -71
  84. package/src/lib/components/input/input-text/input-text.component.scss +0 -118
  85. package/src/lib/components/input/input-text/input-text.component.spec.ts +0 -55
  86. package/src/lib/components/input/input-text/input-text.component.ts +0 -215
  87. package/src/lib/components/input/input-time/input-time-validators.ts +0 -42
  88. package/src/lib/components/input/input-time/input-time.component.html +0 -92
  89. package/src/lib/components/input/input-time/input-time.component.scss +0 -191
  90. package/src/lib/components/input/input-time/input-time.component.spec.ts +0 -39
  91. package/src/lib/components/input/input-time/input-time.component.ts +0 -691
  92. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.html +0 -36
  93. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.scss +0 -121
  94. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.spec.ts +0 -54
  95. package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.ts +0 -117
  96. package/src/lib/components/input/input-type.ts +0 -18
  97. package/src/lib/components/input/input-validation/input-validation.component.html +0 -19
  98. package/src/lib/components/input/input-validation/input-validation.component.scss +0 -39
  99. package/src/lib/components/input/input-validation/input-validation.component.spec.ts +0 -45
  100. package/src/lib/components/input/input-validation/input-validation.component.ts +0 -13
  101. package/src/lib/components/input/input.pipe.ts +0 -14
  102. package/src/lib/components/layout/container/container.component.html +0 -1
  103. package/src/lib/components/layout/container/container.component.scss +0 -33
  104. package/src/lib/components/layout/container/container.component.ts +0 -32
  105. package/src/lib/components/layout/container/container.type.ts +0 -1
  106. package/src/lib/components/layout/divider/divider.component.html +0 -1
  107. package/src/lib/components/layout/divider/divider.component.scss +0 -60
  108. package/src/lib/components/layout/divider/divider.component.ts +0 -38
  109. package/src/lib/components/layout/divider/divider.type.ts +0 -2
  110. package/src/lib/components/layout/section/section.component.html +0 -21
  111. package/src/lib/components/layout/section/section.component.scss +0 -43
  112. package/src/lib/components/layout/section/section.component.ts +0 -33
  113. package/src/lib/components/layout/section/section.type.ts +0 -2
  114. package/src/lib/components/layout/separator/separator.component.html +0 -9
  115. package/src/lib/components/layout/separator/separator.component.scss +0 -52
  116. package/src/lib/components/layout/separator/separator.component.ts +0 -25
  117. package/src/lib/components/layout/separator/separator.type.ts +0 -1
  118. package/src/lib/components/loader/content-blur/content-blur.component.html +0 -13
  119. package/src/lib/components/loader/content-blur/content-blur.component.scss +0 -43
  120. package/src/lib/components/loader/content-blur/content-blur.component.spec.ts +0 -42
  121. package/src/lib/components/loader/content-blur/content-blur.component.ts +0 -34
  122. package/src/lib/components/loader/loader.type.ts +0 -2
  123. package/src/lib/components/loader/progress-bar/progress-bar.component.html +0 -26
  124. package/src/lib/components/loader/progress-bar/progress-bar.component.scss +0 -151
  125. package/src/lib/components/loader/progress-bar/progress-bar.component.spec.ts +0 -47
  126. package/src/lib/components/loader/progress-bar/progress-bar.component.ts +0 -28
  127. package/src/lib/components/loader/progress-bar/progress-bar.type.ts +0 -8
  128. package/src/lib/components/loader/pulse-loader/pulse-loader.component.html +0 -12
  129. package/src/lib/components/loader/pulse-loader/pulse-loader.component.scss +0 -202
  130. package/src/lib/components/loader/pulse-loader/pulse-loader.component.spec.ts +0 -55
  131. package/src/lib/components/loader/pulse-loader/pulse-loader.component.ts +0 -73
  132. package/src/lib/components/loader/pulse-loader/pulse-loader.type.ts +0 -6
  133. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.html +0 -13
  134. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.scss +0 -113
  135. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.spec.ts +0 -37
  136. package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.ts +0 -51
  137. package/src/lib/components/loader/skeleton-loader/skeleton-loader.type.ts +0 -6
  138. package/src/lib/components/loader/spinner/spinner.component.html +0 -20
  139. package/src/lib/components/loader/spinner/spinner.component.scss +0 -137
  140. package/src/lib/components/loader/spinner/spinner.component.spec.ts +0 -43
  141. package/src/lib/components/loader/spinner/spinner.component.ts +0 -32
  142. package/src/lib/components/loader/spinner/spinner.type.ts +0 -6
  143. package/src/lib/components/modal/modal.component.html +0 -47
  144. package/src/lib/components/modal/modal.component.scss +0 -139
  145. package/src/lib/components/modal/modal.component.spec.ts +0 -60
  146. package/src/lib/components/modal/modal.component.ts +0 -83
  147. package/src/lib/components/modal/modal.type.ts +0 -9
  148. package/src/lib/components/morph/blob-moph/blob-moprh.component.spec.ts +0 -79
  149. package/src/lib/components/morph/blob-moph/blob-moprh.component.ts +0 -96
  150. package/src/lib/components/morph/blob-moph/blob-morph.component.html +0 -34
  151. package/src/lib/components/morph/blob-moph/blob-morph.component.scss +0 -7
  152. package/src/lib/components/morph/morph.abstract.ts +0 -13
  153. package/src/lib/components/pagination/pagination.interface.ts +0 -4
  154. package/src/lib/components/pagination/small-pagination/small-pagination.component.html +0 -61
  155. package/src/lib/components/pagination/small-pagination/small-pagination.component.scss +0 -187
  156. package/src/lib/components/pagination/small-pagination/small-pagination.component.spec.ts +0 -88
  157. package/src/lib/components/pagination/small-pagination/small-pagination.component.ts +0 -177
  158. package/src/lib/components/selection-lists/multi-select/multi-select.component.html +0 -170
  159. package/src/lib/components/selection-lists/multi-select/multi-select.component.scss +0 -312
  160. package/src/lib/components/selection-lists/multi-select/multi-select.component.spec.ts +0 -61
  161. package/src/lib/components/selection-lists/multi-select/multi-select.component.ts +0 -372
  162. package/src/lib/components/selection-lists/selection-list/selection-list.component.html +0 -125
  163. package/src/lib/components/selection-lists/selection-list/selection-list.component.scss +0 -267
  164. package/src/lib/components/selection-lists/selection-list/selection-list.component.spec.ts +0 -66
  165. package/src/lib/components/selection-lists/selection-list/selection-list.component.ts +0 -315
  166. package/src/lib/components/selection-lists/selection-lists-base.ts +0 -35
  167. package/src/lib/components/selection-lists/selection-lists-const.ts +0 -17
  168. package/src/lib/components/selection-lists/selection-lists-interface.ts +0 -7
  169. package/src/lib/components/selection-lists/selection-lists.type.ts +0 -1
  170. package/src/lib/components/side-nav/side-nav.component.html +0 -101
  171. package/src/lib/components/side-nav/side-nav.component.scss +0 -295
  172. package/src/lib/components/side-nav/side-nav.component.spec.ts +0 -0
  173. package/src/lib/components/side-nav/side-nav.component.ts +0 -18
  174. package/src/lib/components/side-nav/side-nav.type.ts +0 -28
  175. package/src/lib/components/snackbar/snackbar.component.html +0 -33
  176. package/src/lib/components/snackbar/snackbar.component.scss +0 -195
  177. package/src/lib/components/snackbar/snackbar.component.ts +0 -112
  178. package/src/lib/components/snackbar/snackbar.type.ts +0 -27
  179. package/src/lib/components/status/chip/chip.component.html +0 -51
  180. package/src/lib/components/status/chip/chip.component.scss +0 -149
  181. package/src/lib/components/status/chip/chip.component.spec.ts +0 -62
  182. package/src/lib/components/status/chip/chip.component.ts +0 -83
  183. package/src/lib/components/status/chip/chip.type.ts +0 -42
  184. package/src/lib/components/status/directives/badge/badge.directive.spec.ts +0 -60
  185. package/src/lib/components/status/directives/badge/badge.directive.ts +0 -190
  186. package/src/lib/components/status/directives/badge/badge.interface.ts +0 -19
  187. package/src/lib/components/status/pill/pill.component.html +0 -40
  188. package/src/lib/components/status/pill/pill.component.scss +0 -113
  189. package/src/lib/components/status/pill/pill.component.spec.ts +0 -47
  190. package/src/lib/components/status/pill/pill.component.ts +0 -83
  191. package/src/lib/components/status/pill/pill.type.ts +0 -42
  192. package/src/lib/components/status/status.interface.ts +0 -57
  193. package/src/lib/components/status/status.type.ts +0 -62
  194. package/src/lib/components/status/tag/tag.component.html +0 -39
  195. package/src/lib/components/status/tag/tag.component.scss +0 -140
  196. package/src/lib/components/status/tag/tag.component.spec.ts +0 -47
  197. package/src/lib/components/status/tag/tag.component.ts +0 -83
  198. package/src/lib/components/status/tag/tag.type.ts +0 -42
  199. package/src/lib/components/stepper/stepper.component.html +0 -83
  200. package/src/lib/components/stepper/stepper.component.scss +0 -196
  201. package/src/lib/components/stepper/stepper.component.ts +0 -482
  202. package/src/lib/components/stepper/stepper.type.ts +0 -60
  203. package/src/lib/components/table/table.component.html +0 -438
  204. package/src/lib/components/table/table.component.scss +0 -259
  205. package/src/lib/components/table/table.component.spec.ts +0 -117
  206. package/src/lib/components/table/table.component.ts +0 -215
  207. package/src/lib/components/table/table.enum.ts +0 -4
  208. package/src/lib/components/table/table.function.ts +0 -47
  209. package/src/lib/components/table/table.interface.ts +0 -143
  210. package/src/lib/components/table/table.pipe.ts +0 -62
  211. package/src/lib/components/table/table.type.ts +0 -15
  212. package/src/lib/components/tabs/tabs.component.html +0 -88
  213. package/src/lib/components/tabs/tabs.component.scss +0 -305
  214. package/src/lib/components/tabs/tabs.component.spec.ts +0 -94
  215. package/src/lib/components/tabs/tabs.component.ts +0 -282
  216. package/src/lib/components/tabs/tabs.type.ts +0 -81
  217. package/src/lib/components/title-bar/title-bar.component.html +0 -21
  218. package/src/lib/components/title-bar/title-bar.component.scss +0 -139
  219. package/src/lib/components/title-bar/title-bar.component.spec.ts +0 -44
  220. package/src/lib/components/title-bar/title-bar.component.ts +0 -13
  221. package/src/lib/components/toast/toast.component.html +0 -36
  222. package/src/lib/components/toast/toast.component.scss +0 -241
  223. package/src/lib/components/toast/toast.component.ts +0 -165
  224. package/src/lib/components/toast/toast.type.ts +0 -37
  225. package/src/lib/components/toast-stack/toast-stack.component.html +0 -30
  226. package/src/lib/components/toast-stack/toast-stack.component.scss +0 -35
  227. package/src/lib/components/toast-stack/toast-stack.component.ts +0 -51
  228. package/src/lib/consts/country-prefix.ts +0 -244
  229. package/src/lib/directives/tooltip/popover.directive.ts +0 -274
  230. package/src/lib/directives/tooltip/tooltip.directive.spec.ts +0 -86
  231. package/src/lib/directives/tooltip/tooltip.directive.ts +0 -234
  232. package/src/lib/directives/tooltip/tooltip.interface.ts +0 -29
  233. package/src/lib/directives/tooltip/tooltip.type.ts +0 -9
  234. package/src/lib/interfaces/common.interfaces.ts +0 -4
  235. package/src/lib/pipes/chunk.pipe.ts +0 -16
  236. package/src/lib/pipes/safe-html.pipe.ts +0 -14
  237. package/src/lib/pipes/sanitize-html.pipe.ts +0 -23
  238. package/src/lib/types/base.types.ts +0 -23
  239. package/src/lib/types/common.types.ts +0 -98
  240. package/src/lib/types/form.types.ts +0 -5
  241. package/src/lib/utils/common.utils.ts +0 -53
  242. package/src/lib/utils/date.utils.ts +0 -474
  243. package/src/lib/utils/number.utils.ts +0 -16
  244. package/src/lib/utils/uuid.utils.ts +0 -39
  245. package/src/public-api.ts +0 -114
  246. package/tsconfig.lib.json +0 -17
  247. package/tsconfig.lib.prod.json +0 -10
  248. package/tsconfig.spec.json +0 -9
@@ -1,211 +0,0 @@
1
- import { NgTemplateOutlet } from '@angular/common';
2
- import {
3
- Component,
4
- ContentChild,
5
- ElementRef,
6
- EventEmitter,
7
- Input,
8
- OnChanges,
9
- Output,
10
- QueryList,
11
- SimpleChanges,
12
- TemplateRef,
13
- ViewChildren
14
- } from '@angular/core';
15
- import {
16
- AccordionItem,
17
- AccordionItemContext,
18
- AccordionToggleEvent,
19
- TAccordionSize,
20
- TAccordionStyle
21
- } from './accordion.type';
22
-
23
- @Component({
24
- selector: 'frg-accordion',
25
- standalone: true,
26
- imports: [NgTemplateOutlet],
27
- templateUrl: './accordion.component.html',
28
- styleUrl: './accordion.component.scss'
29
- })
30
- export class AccordionComponent implements OnChanges {
31
- @Input() items: AccordionItem[] = [];
32
- @Input() expandedIds: string[] = [];
33
- @Input() multi: boolean = false;
34
- @Input() styleType: TAccordionStyle = 'default';
35
- @Input() size: TAccordionSize = 'large';
36
- @Input() toggleOnHeaderClick: boolean = true;
37
- @Input() animated: boolean = true;
38
- @Input() focusPanelOnOpen: boolean = false;
39
-
40
- @Output() expandedIdsChange = new EventEmitter<string[]>();
41
- @Output() toggled = new EventEmitter<AccordionToggleEvent>();
42
- @Output() opened = new EventEmitter<AccordionToggleEvent>();
43
- @Output() closed = new EventEmitter<AccordionToggleEvent>();
44
-
45
- @ContentChild('frgAccordionHeader', { read: TemplateRef }) headerTemplate?: TemplateRef<AccordionItemContext>;
46
- @ContentChild('frgAccordionContent', { read: TemplateRef }) contentTemplate?: TemplateRef<AccordionItemContext>;
47
- @ContentChild('frgAccordionIcon', { read: TemplateRef }) iconTemplate?: TemplateRef<AccordionItemContext>;
48
- @ContentChild('frgAccordionToggle', { read: TemplateRef }) toggleIconTemplate?: TemplateRef<AccordionItemContext>;
49
-
50
- @ViewChildren('headerBtn') headerButtons!: QueryList<ElementRef<HTMLButtonElement>>;
51
- @ViewChildren('panelBody') panelBodies!: QueryList<ElementRef<HTMLElement>>;
52
-
53
- public viewItems: AccordionItem[] = [];
54
- private uidCounter = 0;
55
-
56
- ngOnChanges(changes: SimpleChanges): void {
57
- if (changes['items']) {
58
- this.viewItems = this.normalizeItems(this.items);
59
- const initialExpanded = this.expandedIds?.length
60
- ? [...this.expandedIds]
61
- : this.viewItems.filter(item => item.expanded).map(item => item.id!) || [];
62
- this.setExpandedIds(initialExpanded, false);
63
- }
64
-
65
- if (changes['expandedIds'] && !changes['expandedIds'].firstChange) {
66
- this.setExpandedIds(this.expandedIds || [], false);
67
- }
68
- }
69
-
70
- isExpanded(id?: string): boolean {
71
- return !!id && (this.expandedIds?.includes(id) ?? false);
72
- }
73
-
74
- headerId(id: string): string {
75
- return `${id}-header`;
76
- }
77
-
78
- panelId(id: string): string {
79
- return `${id}-panel`;
80
- }
81
-
82
- onHeaderClick(index: number, event: Event): void {
83
- if (!this.toggleOnHeaderClick) {
84
- return;
85
- }
86
- event.preventDefault();
87
- this.toggleAt(index);
88
- }
89
-
90
- onHeaderKeydown(event: KeyboardEvent, index: number): void {
91
- const key = event.key;
92
- if (key === 'Enter' || key === ' ') {
93
- event.preventDefault();
94
- this.toggleAt(index);
95
- return;
96
- }
97
-
98
- const headers = this.headerButtons?.toArray() || [];
99
- if (!headers.length) {
100
- return;
101
- }
102
-
103
- if (key === 'ArrowDown' || key === 'ArrowRight') {
104
- event.preventDefault();
105
- const next = (index + 1) % headers.length;
106
- headers[next].nativeElement.focus();
107
- } else if (key === 'ArrowUp' || key === 'ArrowLeft') {
108
- event.preventDefault();
109
- const prev = (index - 1 + headers.length) % headers.length;
110
- headers[prev].nativeElement.focus();
111
- } else if (key === 'Home') {
112
- event.preventDefault();
113
- headers[0].nativeElement.focus();
114
- } else if (key === 'End') {
115
- event.preventDefault();
116
- headers.at(-1)?.nativeElement.focus();
117
- }
118
- }
119
-
120
- toggleAt(index: number): void {
121
- const item = this.viewItems[index];
122
- if (!item || item.disabled) {
123
- return;
124
- }
125
-
126
- const itemId = item.id!;
127
- const currentlyExpanded = this.isExpanded(itemId);
128
- let nextExpandedIds: string[];
129
-
130
- if (this.multi) {
131
- nextExpandedIds = currentlyExpanded ? this.collapseMulti(itemId) : this.expandMulti(itemId);
132
- } else {
133
- nextExpandedIds = currentlyExpanded ? this.collapseSingle() : this.expandSingle(itemId);
134
- }
135
-
136
- this.setExpandedIds(nextExpandedIds, true, item, index);
137
- }
138
-
139
- buildContext<T = unknown>(item: AccordionItem<T>, index: number): AccordionItemContext<T> {
140
- return {
141
- $implicit: item,
142
- item,
143
- index,
144
- expanded: this.isExpanded(item.id),
145
- toggle: () => this.toggleAt(index)
146
- };
147
- }
148
-
149
- private normalizeItems(items: AccordionItem[]): AccordionItem[] {
150
- return (items || []).map((item, index) => ({
151
- ...item,
152
- id: item.id ?? this.generateId(index)
153
- }));
154
- }
155
-
156
- private generateId(index: number): string {
157
- this.uidCounter += 1;
158
- return `frg-accordion-item-${index}-${this.uidCounter}`;
159
- }
160
-
161
- private expandSingle(id: string): string[] {
162
- return [id];
163
- }
164
-
165
- private collapseSingle(): string[] {
166
- return [];
167
- }
168
-
169
- private expandMulti(id: string): string[] {
170
- return Array.from(new Set([...(this.expandedIds || []), id]));
171
- }
172
-
173
- private collapseMulti(id: string): string[] {
174
- return (this.expandedIds || []).filter(activeId => activeId !== id);
175
- }
176
-
177
- private setExpandedIds(nextIds: string[], emit: boolean, item?: AccordionItem, index?: number): void {
178
- const normalized = this.multi ? nextIds : nextIds.slice(0, 1);
179
- this.expandedIds = normalized;
180
- this.viewItems = this.viewItems.map(viewItem => ({
181
- ...viewItem,
182
- expanded: normalized.includes(viewItem.id!)
183
- }));
184
-
185
- if (emit) {
186
- this.expandedIdsChange.emit(this.expandedIds);
187
- if (item && index !== undefined) {
188
- const payload: AccordionToggleEvent = {
189
- id: item.id!,
190
- index,
191
- expanded: this.isExpanded(item.id),
192
- item,
193
- expandedIds: this.expandedIds
194
- };
195
- this.toggled.emit(payload);
196
- (payload.expanded ? this.opened : this.closed).emit(payload);
197
- }
198
- }
199
-
200
- if (item && this.focusPanelOnOpen && this.isExpanded(item.id)) {
201
- setTimeout(() => this.focusPanel(index!), 0);
202
- }
203
- }
204
-
205
- private focusPanel(index: number): void {
206
- const panel = this.panelBodies?.get(index);
207
- if (panel?.nativeElement) {
208
- panel.nativeElement.focus();
209
- }
210
- }
211
- }
@@ -1,82 +0,0 @@
1
- import { TemplateRef } from '@angular/core';
2
- import { TBaseSize, TBaseStyle } from '../../types/base.types';
3
-
4
- export type TAccordionStyle = TBaseStyle;
5
- export type TAccordionSize = TBaseSize;
6
-
7
- export interface AccordionItemContext<T = unknown> {
8
- $implicit: AccordionItem<T>;
9
- item: AccordionItem<T>;
10
- index: number;
11
- expanded: boolean;
12
- toggle: () => void;
13
- }
14
-
15
- export interface AccordionItem<T = unknown> {
16
- /**
17
- * Unique identifier for the accordion item.
18
- * If not provided, it will be generated automatically.
19
- */
20
- id?: string;
21
- /**
22
- * Visible title inside the header.
23
- */
24
- title: string;
25
- /**
26
- * Optional subtitle rendered below the title in the default header.
27
- */
28
- subtitle?: string;
29
- /**
30
- * Prevents interaction when true.
31
- */
32
- disabled?: boolean;
33
- /**
34
- * Allows setting initial expansion per item.
35
- */
36
- expanded?: boolean;
37
- /**
38
- * Optional style override using the shared palette.
39
- */
40
- style?: TAccordionStyle;
41
- /**
42
- * Optional size override for the item header.
43
- */
44
- size?: TAccordionSize;
45
- /**
46
- * Optional icon rendered on the left of the header when no custom template is provided.
47
- * Typically a CSS class (e.g., for an icon font) or plain text.
48
- */
49
- icon?: string;
50
- /**
51
- * Custom icon template for this item only.
52
- */
53
- iconTemplate?: TemplateRef<AccordionItemContext<T>>;
54
- /**
55
- * Custom toggle icon template for this item only (replaces the default chevron).
56
- */
57
- toggleIconTemplate?: TemplateRef<AccordionItemContext<T>>;
58
- /**
59
- * Arbitrary data that can be passed to templates for custom rendering.
60
- */
61
- data?: T;
62
- /**
63
- * Optional plain content for quick rendering when no template is provided.
64
- */
65
- content?: string;
66
- /**
67
- * Custom header template for this item only.
68
- */
69
- headerTemplate?: TemplateRef<AccordionItemContext<T>>;
70
- /**
71
- * Custom body template for this item only.
72
- */
73
- contentTemplate?: TemplateRef<AccordionItemContext<T>>;
74
- }
75
-
76
- export interface AccordionToggleEvent<T = unknown> {
77
- id: string;
78
- index: number;
79
- expanded: boolean;
80
- item: AccordionItem<T>;
81
- expandedIds: string[];
82
- }
@@ -1,43 +0,0 @@
1
- @if (breadcrumbItems.length) {
2
- <nav
3
- class="frg-breadcrumb"
4
- aria-label="Breadcrumb"
5
- [ngClass]="{
6
- 'frg-breadcrumb--primary': styleType === 'primary' || styleType === 'outline-primary',
7
- 'frg-breadcrumb--secondary': styleType === 'secondary' || styleType === 'outline-secondary',
8
- 'frg-breadcrumb--tertiary': styleType === 'tertiary' || styleType === 'outline-tertiary',
9
- 'frg-breadcrumb--info': styleType === 'info' || styleType === 'outline-info',
10
- 'frg-breadcrumb--success': styleType === 'success' || styleType === 'outline-success',
11
- 'frg-breadcrumb--warning': styleType === 'warning' || styleType === 'outline-warning',
12
- 'frg-breadcrumb--danger': styleType === 'danger' || styleType === 'outline-danger',
13
- 'frg-breadcrumb--dark': styleType === 'dark' || styleType === 'outline-dark',
14
- 'frg-breadcrumb--light': styleType === 'light' || styleType === 'outline-light'
15
- }"
16
- >
17
- <ol class="frg-breadcrumb__list">
18
- @for (item of breadcrumbItems; track item.label; let isLast = $last) {
19
- <li class="frg-breadcrumb__item" [class.is-active]="item.isActive || isLast">
20
- @if (item.url && !isLast) {
21
- <a class="frg-breadcrumb__link" [routerLink]="item.url" [attr.aria-label]="item.ariaLabel || null">
22
- @if (item.iconClass) {
23
- <span class="frg-breadcrumb__icon" [ngClass]="item.iconClass" aria-hidden="true"></span>
24
- }
25
- <span class="frg-breadcrumb__label">{{ item.label }}</span>
26
- </a>
27
- } @else {
28
- <span class="frg-breadcrumb__current" [attr.aria-label]="item.ariaLabel || null">
29
- @if (item.iconClass) {
30
- <span class="frg-breadcrumb__icon" [ngClass]="item.iconClass" aria-hidden="true"></span>
31
- }
32
- <span class="frg-breadcrumb__label">{{ item.label }}</span>
33
- </span>
34
- }
35
-
36
- @if (!isLast) {
37
- <span class="frg-breadcrumb__separator">{{ separator }}</span>
38
- }
39
- </li>
40
- }
41
- </ol>
42
- </nav>
43
- }
@@ -1,112 +0,0 @@
1
- @use './../../../../assets/styles/scss/variables' as *;
2
-
3
- :host {
4
- display: block;
5
- }
6
-
7
- .frg-breadcrumb {
8
- font-family: $base-font;
9
- color: var(--frg-breadcrumb-text, $color-dark-neutral);
10
- --frg-breadcrumb-accent: #{$color-dark-neutral};
11
- --frg-breadcrumb-text: #{$color-dark-soft};
12
- --frg-breadcrumb-muted: #{$color-light-neutral};
13
-
14
- &__list {
15
- display: flex;
16
- flex-wrap: wrap;
17
- align-items: center;
18
- gap: 0.35rem;
19
- margin: 0;
20
- padding: 0;
21
- list-style: none;
22
- }
23
-
24
- &__item {
25
- display: inline-flex;
26
- align-items: center;
27
- gap: 0.35rem;
28
- font-size: $font-size-xs;
29
- color: var(--frg-breadcrumb-text);
30
-
31
- &.is-active {
32
- color: var(--frg-breadcrumb-text);
33
- font-weight: 600;
34
- }
35
- }
36
-
37
- &__link,
38
- &__current {
39
- display: inline-flex;
40
- align-items: center;
41
- gap: 0.35rem;
42
- text-decoration: none;
43
- color: inherit;
44
- }
45
-
46
- &__link:hover {
47
- color: var(--frg-breadcrumb-accent);
48
- }
49
-
50
- &__link:hover .frg-breadcrumb__label {
51
- text-decoration: underline;
52
- text-underline-offset: 2px;
53
- }
54
-
55
- &__icon {
56
- font-size: 0.9em;
57
- line-height: 1;
58
- display: inline-flex;
59
- align-items: center;
60
- }
61
-
62
- &__separator {
63
- color: var(--frg-breadcrumb-muted);
64
- font-size: $font-size-xs;
65
- }
66
-
67
- &--primary {
68
- --frg-breadcrumb-text: #{$color-primary};
69
- --frg-breadcrumb-accent: #{$color-primary-dark};
70
- --frg-breadcrumb-muted: #{$color-primary-light};
71
- }
72
- &--secondary {
73
- --frg-breadcrumb-text: #{$color-secondary};
74
- --frg-breadcrumb-accent: #{$color-secondary-dark};
75
- --frg-breadcrumb-muted: #{$color-secondary-light};
76
- }
77
- &--tertiary {
78
- --frg-breadcrumb-text: #{$color-tertiary};
79
- --frg-breadcrumb-accent: #{$color-tertiary-dark};
80
- --frg-breadcrumb-muted: #{$color-tertiary-light};
81
- }
82
- &--info {
83
- --frg-breadcrumb-text: #{$color-info};
84
- --frg-breadcrumb-accent: #{$color-info-dark};
85
- --frg-breadcrumb-muted: #{$color-info-light};
86
- }
87
- &--success {
88
- --frg-breadcrumb-text: #{$color-success};
89
- --frg-breadcrumb-accent: #{$color-success-dark};
90
- --frg-breadcrumb-muted: #{$color-success-light};
91
- }
92
- &--warning {
93
- --frg-breadcrumb-text: #{$color-warning};
94
- --frg-breadcrumb-accent: #{$color-warning-dark};
95
- --frg-breadcrumb-muted: #{$color-warning-light};
96
- }
97
- &--danger {
98
- --frg-breadcrumb-text: #{$color-danger};
99
- --frg-breadcrumb-accent: #{$color-danger-dark};
100
- --frg-breadcrumb-muted: #{$color-danger-light};
101
- }
102
- &--dark {
103
- --frg-breadcrumb-text: #{$color-dark-neutral};
104
- --frg-breadcrumb-accent: #{$color-dark};
105
- --frg-breadcrumb-muted: #{$color-dark-soft};
106
- }
107
- &--light {
108
- --frg-breadcrumb-text: #{$color-light-neutral};
109
- --frg-breadcrumb-accent: #{$color-light};
110
- --frg-breadcrumb-muted: #{$color-light-soft};
111
- }
112
- }
@@ -1,33 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { By } from '@angular/platform-browser';
3
- import { provideRouter } from '@angular/router';
4
- import { BreadcrumbComponent } from './breadcrumb.component';
5
-
6
- describe('BreadcrumbComponent', () => {
7
- let fixture: ComponentFixture<BreadcrumbComponent>;
8
- let component: BreadcrumbComponent;
9
-
10
- beforeEach(async () => {
11
- await TestBed.configureTestingModule({
12
- imports: [BreadcrumbComponent],
13
- providers: [provideRouter([])]
14
- }).compileComponents();
15
-
16
- fixture = TestBed.createComponent(BreadcrumbComponent);
17
- component = fixture.componentInstance;
18
- });
19
-
20
- it('renders items provided via input', () => {
21
- component.items = [
22
- { label: 'Home', url: '/' },
23
- { label: 'Library', url: '/library' },
24
- { label: 'Books' }
25
- ];
26
-
27
- fixture.detectChanges();
28
-
29
- const items = fixture.debugElement.queryAll(By.css('.frg-breadcrumb__item'));
30
- expect(items.length).toBe(3);
31
- expect(items[2].nativeElement.classList).toContain('is-active');
32
- });
33
- });
@@ -1,103 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { Component, inject, Input, OnDestroy, OnInit } from '@angular/core';
3
- import { ActivatedRoute, NavigationEnd, Router, RouterLink } from '@angular/router';
4
- import { filter, Subject, takeUntil } from 'rxjs';
5
- import { BreadcrumbItem } from './breadcrumb.interface';
6
- import { TBaseStyle } from '../../types/base.types';
7
-
8
- @Component({
9
- selector: 'frg-breadcrumb',
10
- imports: [CommonModule, RouterLink],
11
- templateUrl: './breadcrumb.component.html',
12
- styleUrl: './breadcrumb.component.scss',
13
- })
14
- export class BreadcrumbComponent implements OnInit, OnDestroy {
15
- private readonly router: Router = inject(Router);
16
- private readonly activatedRoute: ActivatedRoute = inject(ActivatedRoute);
17
- /**
18
- * Breadcrumb items to render.
19
- */
20
- @Input() items: BreadcrumbItem[] = [];
21
- /**
22
- * Build breadcrumbs automatically from the current route tree.
23
- */
24
- @Input() auto: boolean = false;
25
- /**
26
- * Separator displayed between breadcrumb items.
27
- */
28
- @Input() separator: string = '/';
29
- /**
30
- * Color theme for breadcrumb text.
31
- */
32
- @Input() styleType: TBaseStyle = 'default';
33
-
34
- protected autoItems: BreadcrumbItem[] = [];
35
- private readonly destroy$ = new Subject<void>();
36
-
37
- public ngOnInit(): void {
38
- if (this.auto) {
39
- this.buildAutoItems();
40
- this.router.events
41
- .pipe(filter(event => event instanceof NavigationEnd), takeUntil(this.destroy$))
42
- .subscribe(() => this.buildAutoItems());
43
- }
44
- }
45
-
46
- public ngOnDestroy(): void {
47
- this.destroy$.next();
48
- this.destroy$.complete();
49
- }
50
-
51
- public get breadcrumbItems(): BreadcrumbItem[] {
52
- const items = this.auto ? this.autoItems : this.items;
53
- if (!items.length) return [];
54
-
55
- return items.map((item, index) => ({
56
- ...item,
57
- isActive: item.isActive ?? index === items.length - 1
58
- }));
59
- }
60
-
61
- private buildAutoItems(): void {
62
- const items: BreadcrumbItem[] = [];
63
- let url = '';
64
- let route: ActivatedRoute | null = this.activatedRoute.root;
65
-
66
- while (route?.firstChild) {
67
- route = route.firstChild;
68
- const config = route.routeConfig;
69
- if (!config?.path || config.path === '**') {
70
- continue;
71
- }
72
-
73
- const segments = route.snapshot.url.map(segment => segment.path).filter(Boolean);
74
- if (!segments.length) {
75
- continue;
76
- }
77
-
78
- const label = this.resolveLabel(route, segments);
79
- url += `/${segments.join('/')}`;
80
-
81
- items.push({
82
- label,
83
- url,
84
- iconClass: route.snapshot.data?.['breadcrumbIcon']
85
- });
86
- }
87
-
88
- this.autoItems = items;
89
- }
90
-
91
- private resolveLabel(route: ActivatedRoute, segments: string[]): string {
92
- const dataLabel = route.snapshot.data?.['breadcrumb'];
93
- if (typeof dataLabel === 'string' && dataLabel.trim().length) {
94
- return dataLabel;
95
- }
96
-
97
- const fallback = segments.join(' ');
98
- return fallback
99
- .split('-')
100
- .map(part => part.charAt(0).toUpperCase() + part.slice(1))
101
- .join(' ');
102
- }
103
- }
@@ -1,7 +0,0 @@
1
- export interface BreadcrumbItem {
2
- label: string;
3
- url?: string | (string | number)[];
4
- iconClass?: string;
5
- ariaLabel?: string;
6
- isActive?: boolean;
7
- }
@@ -1,57 +0,0 @@
1
- <button
2
- class="frg-btn"
3
- [id]="id"
4
- [class]="class"
5
- [attr.aria-label]="ariaLabel || null"
6
- [attr.disabled]="disabled ? true : null"
7
- [attr.type]="type"
8
- [routerLink]="buttonRouterLink"
9
- [routerLinkActive]="buttonRouterLinkActive"
10
- [ngClass]="{
11
- 'frg-btn__ghost': styleType === 'ghost',
12
- 'frg-btn__icon': styleType === 'icon',
13
- 'frg-btn__primary': styleType === 'primary',
14
- 'frg-btn__secondary': styleType === 'secondary',
15
- 'frg-btn__tertiary': styleType === 'tertiary',
16
- 'frg-btn__neutral': styleType === 'neutral',
17
- 'frg-btn__dark': styleType === 'dark',
18
- 'frg-btn__light': styleType === 'light',
19
- 'frg-btn__info': styleType === 'info',
20
- 'frg-btn__success': styleType === 'success',
21
- 'frg-btn__warning': styleType === 'warning',
22
- 'frg-btn__danger': styleType === 'danger',
23
- 'frg-btn__outline-primary': styleType === 'outline-primary',
24
- 'frg-btn__outline-secondary': styleType === 'outline-secondary',
25
- 'frg-btn__outline-tertiary': styleType === 'outline-tertiary',
26
- 'frg-btn__outline-dark': styleType === 'outline-dark',
27
- 'frg-btn__outline-light': styleType === 'outline-light',
28
- 'frg-btn__outline-info': styleType === 'outline-info',
29
- 'frg-btn__outline-success': styleType === 'outline-success',
30
- 'frg-btn__outline-warning': styleType === 'outline-warning',
31
- 'frg-btn__outline-danger': styleType === 'outline-danger',
32
- 'frg-btn--pill': shape === 'pill',
33
- 'frg-btn--small': size === 'small',
34
- 'frg-btn--medium': size === 'medium',
35
- 'frg-btn--large': size === 'large'
36
- }"
37
- (click)="onClick()"
38
- >
39
- <div
40
- class="d-flex justify-content-center align-items-center"
41
- [ngClass]="containerNgClass"
42
- >
43
- @if(text){
44
- <span
45
- [class]="textClass"
46
- >
47
- {{text}}
48
- </span>
49
- }
50
- @if(iconClass){
51
- <span
52
- [class]="iconClass"
53
- [ngClass]="iconClassMap"
54
- ></span>
55
- }
56
- </div>
57
- </button>