commons-shared-web-ui 0.0.55 → 0.0.57

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 (223) hide show
  1. package/fesm2022/commons-shared-web-ui.mjs +15897 -0
  2. package/fesm2022/commons-shared-web-ui.mjs.map +1 -0
  3. package/index.d.ts +4916 -0
  4. package/package.json +34 -53
  5. package/src/lib/modules/button/button.theme.scss +4 -4
  6. package/.claude/settings.local.json +0 -10
  7. package/documentation/alert.md +0 -123
  8. package/documentation/button-dropdown.md +0 -126
  9. package/documentation/button.md +0 -184
  10. package/documentation/cards-usage-guidelines.md +0 -131
  11. package/documentation/configurable-form.md +0 -605
  12. package/documentation/confirmation-modal.md +0 -250
  13. package/documentation/filter-sidebar.md +0 -178
  14. package/documentation/filter-table-selector.md +0 -228
  15. package/documentation/form-builder.md +0 -599
  16. package/documentation/form-components.md +0 -384
  17. package/documentation/form-field-configuration.md +0 -250
  18. package/documentation/nav.md +0 -427
  19. package/documentation/pagination.md +0 -181
  20. package/documentation/side-nav-documentation.md +0 -169
  21. package/documentation/smart-form.md +0 -2765
  22. package/documentation/smart-table.md +0 -1221
  23. package/documentation/snackbar.md +0 -118
  24. package/documentation/style-externalization.md +0 -88
  25. package/documentation/summary-card.md +0 -279
  26. package/documentation/table-column-configuration.md +0 -221
  27. package/documentation/time-picker.md +0 -274
  28. package/ng-package.json +0 -30
  29. package/src/lib/modules/alert/alert.models.ts +0 -6
  30. package/src/lib/modules/alert/alert.module.ts +0 -16
  31. package/src/lib/modules/alert/components/alert/alert.component.html +0 -27
  32. package/src/lib/modules/alert/components/alert/alert.component.scss +0 -92
  33. package/src/lib/modules/alert/components/alert/alert.component.ts +0 -81
  34. package/src/lib/modules/button/button.models.ts +0 -13
  35. package/src/lib/modules/button/button.module.ts +0 -16
  36. package/src/lib/modules/button/components/button/button.component.html +0 -22
  37. package/src/lib/modules/button/components/button/button.component.scss +0 -88
  38. package/src/lib/modules/button/components/button/button.component.ts +0 -67
  39. package/src/lib/modules/button-dropdown/button-dropdown.models.ts +0 -26
  40. package/src/lib/modules/button-dropdown/button-dropdown.module.ts +0 -22
  41. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +0 -41
  42. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +0 -135
  43. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +0 -160
  44. package/src/lib/modules/configurable-form/component/configurable-form.component.html +0 -294
  45. package/src/lib/modules/configurable-form/component/configurable-form.component.scss +0 -503
  46. package/src/lib/modules/configurable-form/component/configurable-form.component.ts +0 -628
  47. package/src/lib/modules/configurable-form/configurable-form.examples.ts +0 -154
  48. package/src/lib/modules/configurable-form/configurable-form.model.ts +0 -131
  49. package/src/lib/modules/configurable-form/configurable-form.module.ts +0 -19
  50. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +0 -77
  51. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +0 -395
  52. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +0 -266
  53. package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +0 -71
  54. package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +0 -20
  55. package/src/lib/modules/filter/components/filter/filter.component.html +0 -131
  56. package/src/lib/modules/filter/components/filter/filter.component.scss +0 -245
  57. package/src/lib/modules/filter/components/filter/filter.component.ts +0 -216
  58. package/src/lib/modules/filter/filter.models.ts +0 -88
  59. package/src/lib/modules/filter/filter.module.ts +0 -24
  60. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +0 -112
  61. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +0 -186
  62. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +0 -163
  63. package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +0 -95
  64. package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +0 -24
  65. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +0 -73
  66. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +0 -321
  67. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +0 -361
  68. package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +0 -91
  69. package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +0 -22
  70. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +0 -63
  71. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +0 -496
  72. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +0 -445
  73. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +0 -75
  74. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +0 -210
  75. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +0 -55
  76. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +0 -25
  77. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +0 -82
  78. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +0 -95
  79. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +0 -20
  80. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +0 -37
  81. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +0 -94
  82. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +0 -46
  83. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +0 -102
  84. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +0 -50
  85. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +0 -35
  86. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +0 -67
  87. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +0 -34
  88. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +0 -68
  89. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +0 -113
  90. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +0 -74
  91. package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +0 -533
  92. package/src/lib/modules/form-builder/form-builder.module.ts +0 -36
  93. package/src/lib/modules/form-builder/index.ts +0 -9
  94. package/src/lib/modules/form-builder/models/builder.models.ts +0 -7
  95. package/src/lib/modules/form-builder/models/field-configurator.models.ts +0 -38
  96. package/src/lib/modules/form-builder/models/field-selection.models.ts +0 -51
  97. package/src/lib/modules/form-builder/services/field-configurator.service.ts +0 -258
  98. package/src/lib/modules/form-builder/services/field-selection.service.ts +0 -299
  99. package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +0 -670
  100. package/src/lib/modules/form-builder/tokens/builder.tokens.ts +0 -10
  101. package/src/lib/modules/form-builder/utils/constants.ts +0 -43
  102. package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +0 -29
  103. package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +0 -111
  104. package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +0 -207
  105. package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +0 -35
  106. package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +0 -42
  107. package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +0 -115
  108. package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +0 -267
  109. package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +0 -45
  110. package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +0 -74
  111. package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +0 -252
  112. package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +0 -377
  113. package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +0 -53
  114. package/src/lib/modules/form-components/components/input/input.component.html +0 -51
  115. package/src/lib/modules/form-components/components/input/input.component.scss +0 -128
  116. package/src/lib/modules/form-components/components/input/input.component.ts +0 -250
  117. package/src/lib/modules/form-components/components/input/input.models.ts +0 -55
  118. package/src/lib/modules/form-components/components/radio/radio.component.html +0 -22
  119. package/src/lib/modules/form-components/components/radio/radio.component.scss +0 -107
  120. package/src/lib/modules/form-components/components/radio/radio.component.ts +0 -181
  121. package/src/lib/modules/form-components/components/radio/radio.models.ts +0 -39
  122. package/src/lib/modules/form-components/components/search/search.component.html +0 -15
  123. package/src/lib/modules/form-components/components/search/search.component.scss +0 -87
  124. package/src/lib/modules/form-components/components/search/search.component.ts +0 -213
  125. package/src/lib/modules/form-components/components/search/search.models.ts +0 -40
  126. package/src/lib/modules/form-components/components/toggle/toggle.component.html +0 -15
  127. package/src/lib/modules/form-components/components/toggle/toggle.component.scss +0 -81
  128. package/src/lib/modules/form-components/components/toggle/toggle.component.ts +0 -166
  129. package/src/lib/modules/form-components/components/toggle/toggle.models.ts +0 -27
  130. package/src/lib/modules/form-components/directives/click-outside.directive.ts +0 -22
  131. package/src/lib/modules/form-components/form-components.module.ts +0 -42
  132. package/src/lib/modules/form-field-configuration/components/_ffc-controls.scss +0 -89
  133. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.html +0 -68
  134. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.scss +0 -73
  135. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.ts +0 -34
  136. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.html +0 -78
  137. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.scss +0 -83
  138. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.ts +0 -94
  139. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.html +0 -38
  140. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.scss +0 -42
  141. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.ts +0 -92
  142. package/src/lib/modules/form-field-configuration/form-field-configuration.module.ts +0 -23
  143. package/src/lib/modules/form-field-configuration/index.ts +0 -7
  144. package/src/lib/modules/form-field-configuration/models/field-configuration.models.ts +0 -62
  145. package/src/lib/modules/form-field-configuration/services/config-schema-tree.service.ts +0 -159
  146. package/src/lib/modules/form-field-configuration/services/field-configuration.service.ts +0 -228
  147. package/src/lib/modules/material/material.module.ts +0 -94
  148. package/src/lib/modules/nav/components/nav/nav.component.html +0 -34
  149. package/src/lib/modules/nav/components/nav/nav.component.scss +0 -171
  150. package/src/lib/modules/nav/components/nav/nav.component.ts +0 -82
  151. package/src/lib/modules/nav/nav.models.ts +0 -31
  152. package/src/lib/modules/nav/nav.module.ts +0 -17
  153. package/src/lib/modules/pagination/components/pagination/pagination.component.html +0 -52
  154. package/src/lib/modules/pagination/components/pagination/pagination.component.scss +0 -155
  155. package/src/lib/modules/pagination/components/pagination/pagination.component.ts +0 -109
  156. package/src/lib/modules/pagination/pagination.module.ts +0 -17
  157. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +0 -56
  158. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +0 -342
  159. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +0 -135
  160. package/src/lib/modules/side-nav/side-nav.models.ts +0 -38
  161. package/src/lib/modules/side-nav/side-nav.module.ts +0 -16
  162. package/src/lib/modules/smart-form/components/form-field/form-field.component.html +0 -1330
  163. package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +0 -2112
  164. package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +0 -3006
  165. package/src/lib/modules/smart-form/components/form-section/form-section.component.html +0 -65
  166. package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +0 -209
  167. package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +0 -131
  168. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +0 -253
  169. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +0 -689
  170. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +0 -1131
  171. package/src/lib/modules/smart-form/index.ts +0 -10
  172. package/src/lib/modules/smart-form/models/form-schema.model.ts +0 -793
  173. package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +0 -21
  174. package/src/lib/modules/smart-form/services/expression.service.ts +0 -75
  175. package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +0 -67
  176. package/src/lib/modules/smart-form/smart-form.examples.ts +0 -1324
  177. package/src/lib/modules/smart-form/smart-form.module.ts +0 -38
  178. package/src/lib/modules/smart-form/utils/translation.utils.ts +0 -82
  179. package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +0 -25
  180. package/src/lib/modules/smart-form/utils/validation.utils.ts +0 -98
  181. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +0 -283
  182. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +0 -685
  183. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +0 -1128
  184. package/src/lib/modules/smart-table/models/table-config.model.ts +0 -213
  185. package/src/lib/modules/smart-table/smart-table.module.ts +0 -30
  186. package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +0 -28
  187. package/src/lib/modules/smart-table/utils/smart-table.utils.ts +0 -18
  188. package/src/lib/modules/snackbar/components/snackbar.component.html +0 -41
  189. package/src/lib/modules/snackbar/components/snackbar.component.scss +0 -99
  190. package/src/lib/modules/snackbar/components/snackbar.component.ts +0 -18
  191. package/src/lib/modules/snackbar/models/snackbar.models.ts +0 -10
  192. package/src/lib/modules/snackbar/services/snackbar.service.ts +0 -40
  193. package/src/lib/modules/snackbar/snackbar.module.ts +0 -11
  194. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +0 -47
  195. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +0 -199
  196. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +0 -126
  197. package/src/lib/modules/summary-card/summary-card.module.ts +0 -18
  198. package/src/lib/modules/table-column-configuration/components/_tcc-controls.scss +0 -53
  199. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.html +0 -47
  200. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.scss +0 -50
  201. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.ts +0 -33
  202. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.html +0 -30
  203. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.scss +0 -36
  204. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.ts +0 -78
  205. package/src/lib/modules/table-column-configuration/index.ts +0 -5
  206. package/src/lib/modules/table-column-configuration/models/table-column-configuration.models.ts +0 -20
  207. package/src/lib/modules/table-column-configuration/services/table-column-configuration.service.ts +0 -77
  208. package/src/lib/modules/table-column-configuration/table-column-configuration.module.ts +0 -21
  209. package/src/lib/modules/time-picker/components/time-picker/time-picker.component.html +0 -37
  210. package/src/lib/modules/time-picker/components/time-picker/time-picker.component.scss +0 -102
  211. package/src/lib/modules/time-picker/components/time-picker/time-picker.component.ts +0 -178
  212. package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.html +0 -78
  213. package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.scss +0 -226
  214. package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.ts +0 -595
  215. package/src/lib/modules/time-picker/models/time-picker.models.ts +0 -49
  216. package/src/lib/modules/time-picker/time-picker.module.ts +0 -23
  217. package/src/lib/shared-ui.module.ts +0 -55
  218. package/src/lib/utils/constants.ts +0 -11
  219. package/src/lib/utils/storage.utils.ts +0 -37
  220. package/src/lib/utils/string.utils.ts +0 -23
  221. package/src/lib/utils/translation.utils.ts +0 -87
  222. package/src/public-api.ts +0 -127
  223. package/tsconfig.lib.json +0 -15
@@ -1,377 +0,0 @@
1
- import { Component, Input, Output, EventEmitter, forwardRef, OnInit, OnChanges, SimpleChanges, HostListener, ViewChild, ElementRef } from '@angular/core';
2
- import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
3
- import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
4
- import { DropdownOption, DropdownConfig, DropdownLabels } from './dropdown.models';
5
-
6
- @Component({
7
- selector: 'lib-dropdown',
8
- templateUrl: './dropdown.component.html',
9
- styleUrls: ['./dropdown.component.scss'],
10
- standalone: false,
11
- providers: [
12
- {
13
- provide: NG_VALUE_ACCESSOR,
14
- useExisting: forwardRef(() => DropdownComponent),
15
- multi: true
16
- }
17
- ]
18
- })
19
- export class DropdownComponent implements ControlValueAccessor, OnInit, OnChanges {
20
- @Input() config?: DropdownConfig;
21
- @Input() labels?: DropdownLabels;
22
- @Input() options: DropdownOption[] = [];
23
- @Input() selectedValue?: any;
24
- @Input() placeholder: string = '';
25
- @Input() label: string = '';
26
- @Input() multiple: boolean = false;
27
- @Input() searchable: boolean = false;
28
- @Input() clearable: boolean = false;
29
- @Input() disabled: boolean = false;
30
- @Input() required: boolean = false;
31
- @Input() errorMessage: string = '';
32
-
33
- // Configurable styles
34
- @Input() width?: string;
35
- @Input() height?: string;
36
- @Input() borderRadius?: string;
37
- @Input() fontSize?: string;
38
-
39
- // Additional style inputs inferred from template/getters
40
- @Input() gap?: string;
41
- @Input() fontFamily?: string;
42
- @Input() labelColor?: string;
43
- @Input() labelFontSize?: string;
44
- @Input() labelFontWeight?: string;
45
-
46
- @Input() backgroundColor?: string;
47
- @Input() borderColor?: string;
48
- @Input() borderWidth?: string;
49
- @Input() padding?: string;
50
- @Input() fontWeight?: string;
51
- @Input() color?: string;
52
- @Input() placeholderColor?: string;
53
- @Input() focusBorderColor?: string;
54
- @Input() errorColor?: string;
55
- @Input() disabledBackgroundColor?: string;
56
- @Input() disabledColor?: string;
57
- @Input() boxShadow?: string;
58
-
59
- @Output() selectionChange = new EventEmitter<any>();
60
-
61
- @ViewChild(CdkVirtualScrollViewport) viewport?: CdkVirtualScrollViewport;
62
- @ViewChild('searchInput') searchInput?: ElementRef;
63
- @ViewChild('triggerEl') triggerEl?: ElementRef;
64
-
65
- filteredOptions: DropdownOption[] = [];
66
- searchTerm: string = '';
67
- value: any = null;
68
- isOpen = false;
69
- focusedIndex = -1;
70
- menuPosition = { top: 0, left: 0, width: 0 };
71
-
72
- onChange: (value: any) => void = () => { };
73
- onTouched: () => void = () => { };
74
-
75
- constructor(private el: ElementRef) { }
76
-
77
- ngOnInit(): void {
78
- this.updateFromConfig();
79
- this.updateFromLabels();
80
- this.filteredOptions = this.validOptions;
81
- }
82
-
83
- ngOnChanges(changes: SimpleChanges): void {
84
- if (changes['config']) {
85
- this.updateFromConfig();
86
- }
87
- if (changes['labels']) {
88
- this.updateFromLabels();
89
- }
90
- if (changes['config'] || changes['options']) {
91
- this.filteredOptions = this.validOptions;
92
- }
93
- if (changes['selectedValue']) {
94
- const incoming = changes['selectedValue'].currentValue;
95
- if (incoming !== undefined && incoming !== this.value) {
96
- this.value = incoming ?? null;
97
- }
98
- }
99
- }
100
-
101
- private get validOptions(): DropdownOption[] {
102
- return this.options.filter(o => o.label != null && o.label !== '');
103
- }
104
-
105
- private updateFromConfig(): void {
106
- if (this.config) {
107
- this.options = this.config.options || this.options;
108
- this.placeholder = this.config.placeholder ?? this.placeholder;
109
- this.label = this.config.label ?? this.label;
110
- this.multiple = this.config.multiple ?? this.multiple;
111
- this.searchable = this.config.searchable ?? this.searchable;
112
- this.clearable = this.config.clearable ?? this.clearable;
113
- this.disabled = this.config.disabled ?? this.disabled;
114
- this.required = this.config.required ?? this.required;
115
- this.errorMessage = this.config.errorMessage ?? this.errorMessage;
116
- this.width = this.config.width ?? this.width;
117
- this.height = this.config.height ?? this.height;
118
- this.borderRadius = this.config.borderRadius ?? this.borderRadius;
119
- this.fontSize = this.config.fontSize ?? this.fontSize;
120
- this.gap = this.config.gap ?? this.gap;
121
- this.fontFamily = this.config.fontFamily ?? this.fontFamily;
122
- this.labelColor = this.config.labelColor ?? this.labelColor;
123
- this.labelFontSize = this.config.labelFontSize ?? this.labelFontSize;
124
- this.labelFontWeight = this.config.labelFontWeight ?? this.labelFontWeight;
125
- this.backgroundColor = this.config.backgroundColor ?? this.backgroundColor;
126
- this.borderColor = this.config.borderColor ?? this.borderColor;
127
- this.borderWidth = this.config.borderWidth ?? this.borderWidth;
128
- this.padding = this.config.padding ?? this.padding;
129
- this.fontWeight = this.config.fontWeight ?? this.fontWeight;
130
- this.color = this.config.color ?? this.color;
131
- this.placeholderColor = this.config.placeholderColor ?? this.placeholderColor;
132
- this.focusBorderColor = this.config.focusBorderColor ?? this.focusBorderColor;
133
- this.errorColor = this.config.errorColor ?? this.errorColor;
134
- this.disabledBackgroundColor = this.config.disabledBackgroundColor ?? this.disabledBackgroundColor;
135
- this.disabledColor = this.config.disabledColor ?? this.disabledColor;
136
- this.boxShadow = this.config.boxShadow ?? this.boxShadow;
137
- }
138
- }
139
-
140
- private updateFromLabels(): void {
141
- if (this.labels) {
142
- this.label = this.labels.label || this.label;
143
- this.placeholder = this.labels.placeholder || this.placeholder;
144
- this.errorMessage = this.labels.errorMessage || this.errorMessage;
145
- }
146
- }
147
-
148
- get resolvedLabels() {
149
- return {
150
- requiredMarker: this.labels?.requiredMarker || '*',
151
- searchPlaceholder: this.labels?.searchPlaceholder || 'Search...',
152
- selectedSuffix: this.labels?.selectedSuffix || 'selected',
153
- clearAriaLabel: this.labels?.clearAriaLabel || 'Clear selection',
154
- noResultsFound: this.labels?.noResultsFound || 'No results found',
155
- };
156
- }
157
-
158
- writeValue(value: any): void {
159
- this.value = value;
160
- }
161
-
162
- registerOnChange(fn: any): void {
163
- this.onChange = fn;
164
- }
165
-
166
- registerOnTouched(fn: any): void {
167
- this.onTouched = fn;
168
- }
169
-
170
- setDisabledState(isDisabled: boolean): void {
171
- this.disabled = isDisabled;
172
- }
173
-
174
- toggle(): void {
175
- if (this.disabled) return;
176
- if (!this.isOpen && this.triggerEl) {
177
- const rect: DOMRect = this.triggerEl.nativeElement.getBoundingClientRect();
178
- const optCount = this.filteredOptions.length || 1;
179
- const menuH = Math.min(optCount * 40, 240) + (this.searchable ? 50 : 0) + 8;
180
- const spaceBelow = window.innerHeight - rect.bottom;
181
- const top = spaceBelow < menuH + 8 ? rect.top - menuH - 4 : rect.bottom + 2;
182
- this.menuPosition = { top, left: rect.left, width: rect.width };
183
- const closeOnScroll = (e: Event) => {
184
- if (this.el.nativeElement.contains(e.target as Node)) return;
185
- this.close();
186
- document.removeEventListener('scroll', closeOnScroll, true);
187
- };
188
- document.addEventListener('scroll', closeOnScroll, true);
189
- }
190
- this.isOpen = !this.isOpen;
191
- if (this.isOpen) {
192
- this.focusedIndex = -1;
193
- setTimeout(() => {
194
- if (this.searchable && this.searchInput) {
195
- this.searchInput.nativeElement.focus();
196
- } else if (this.viewport) {
197
- this.viewport.elementRef.nativeElement.focus();
198
- }
199
- });
200
- } else {
201
- this.onTouched();
202
- }
203
- }
204
-
205
- close(): void {
206
- if (this.isOpen) {
207
- this.isOpen = false;
208
- this.onTouched();
209
- }
210
- }
211
-
212
- selectOption(option: DropdownOption): void {
213
- if (option.disabled) return;
214
-
215
- if (this.multiple) {
216
- const currentValues = Array.isArray(this.value) ? [...this.value] : [];
217
- const index = currentValues.indexOf(option.value);
218
- if (index > -1) {
219
- currentValues.splice(index, 1);
220
- } else {
221
- currentValues.push(option.value);
222
- }
223
- this.value = currentValues;
224
- } else {
225
- this.value = option.value;
226
- this.close();
227
- }
228
-
229
- this.onChange(this.value);
230
- this.selectionChange.emit(this.value);
231
- }
232
-
233
- isSelected(option: DropdownOption): boolean {
234
- if (this.multiple) {
235
- return Array.isArray(this.value) && this.value.includes(option.value);
236
- }
237
- return this.value === option.value;
238
- }
239
-
240
- onSearch(term: string): void {
241
- this.searchTerm = term;
242
- if (!term) {
243
- this.filteredOptions = this.validOptions;
244
- } else {
245
- this.filteredOptions = this.validOptions.filter(option =>
246
- option.label.toLowerCase().includes(term.toLowerCase())
247
- );
248
- }
249
- this.focusedIndex = -1;
250
- }
251
-
252
- clearSelection(event?: Event): void {
253
- if (event) {
254
- event.stopPropagation();
255
- }
256
- this.value = this.multiple ? [] : null;
257
- this.onChange(this.value);
258
- this.selectionChange.emit(this.value);
259
- }
260
-
261
- getIconType(icon: any): 'material' | 'fontawesome' | 'img' | 'none' {
262
- if (!icon) return 'none';
263
- if (typeof icon === 'string') {
264
- if (icon.includes('/') || icon.includes('.') || icon.startsWith('http')) {
265
- return 'img';
266
- }
267
- return 'material';
268
- }
269
- return icon.type || 'material';
270
- }
271
-
272
- getIconValue(icon: any): string {
273
- if (typeof icon === 'string') return icon;
274
- return icon?.value || '';
275
- }
276
-
277
- getSelectedLabel(): string {
278
- if (this.multiple) {
279
- const count = Array.isArray(this.value) ? this.value.length : 0;
280
- return count > 0 ? `${count} ${this.resolvedLabels.selectedSuffix}` : '';
281
- }
282
-
283
- if (!this.value) return '';
284
- const selected = this.options.find(opt => opt.value === this.value);
285
- return selected?.label || '';
286
- }
287
-
288
- hasValue(): boolean {
289
- if (this.multiple) {
290
- return Array.isArray(this.value) && this.value.length > 0;
291
- }
292
- return this.value !== null && this.value !== undefined && this.value !== '';
293
- }
294
-
295
- @HostListener('keydown', ['$event'])
296
- handleKeyboardEvent(event: KeyboardEvent): void {
297
- if (this.disabled) return;
298
-
299
- if (event.key === 'Escape') {
300
- this.close();
301
- return;
302
- }
303
-
304
- if (!this.isOpen && (event.key === 'Enter' || event.key === ' ' || event.key === 'ArrowDown')) {
305
- this.toggle();
306
- event.preventDefault();
307
- return;
308
- }
309
-
310
- if (!this.isOpen) return;
311
-
312
- switch (event.key) {
313
- case 'ArrowDown':
314
- this.focusedIndex = Math.min(this.focusedIndex + 1, this.filteredOptions.length - 1);
315
- this.scrollToIndex(this.focusedIndex);
316
- event.preventDefault();
317
- break;
318
- case 'ArrowUp':
319
- this.focusedIndex = Math.max(this.focusedIndex - 1, 0);
320
- this.scrollToIndex(this.focusedIndex);
321
- event.preventDefault();
322
- break;
323
- case 'Enter':
324
- if (this.focusedIndex > -1) {
325
- this.selectOption(this.filteredOptions[this.focusedIndex]);
326
- }
327
- event.preventDefault();
328
- break;
329
- }
330
- }
331
-
332
- scrollToIndex(index: number): void {
333
- if (this.viewport) {
334
- this.viewport.scrollToIndex(index);
335
- }
336
- }
337
-
338
- private getStyleValue(value: string | undefined): string | undefined {
339
- return value ? `${value}` : undefined;
340
- }
341
-
342
- get wrapperStyles(): { [key: string]: string | undefined } {
343
- return {
344
- 'width': this.getStyleValue(this.width),
345
- '--cc-dropdown-label-gap': this.getStyleValue(this.gap),
346
- '--cc-dropdown-font-family': this.getStyleValue(this.fontFamily)
347
- };
348
- }
349
-
350
- get labelStyles(): { [key: string]: string | undefined } {
351
- return {
352
- '--cc-dropdown-label-color': this.getStyleValue(this.labelColor),
353
- '--cc-dropdown-font-size': this.getStyleValue(this.labelFontSize),
354
- '--cc-dropdown-font-weight': this.getStyleValue(this.labelFontWeight)
355
- };
356
- }
357
-
358
- get fieldStyles(): { [key: string]: string | undefined } {
359
- return {
360
- '--cc-dropdown-bg': this.getStyleValue(this.backgroundColor),
361
- '--cc-dropdown-border-radius': this.getStyleValue(this.borderRadius),
362
- '--cc-dropdown-border-color': this.getStyleValue(this.borderColor),
363
- '--cc-dropdown-border-width': this.getStyleValue(this.borderWidth),
364
- '--cc-dropdown-height': this.getStyleValue(this.height),
365
- '--cc-dropdown-padding': this.getStyleValue(this.padding),
366
- '--cc-dropdown-font-size': this.getStyleValue(this.fontSize),
367
- '--cc-dropdown-font-weight': this.getStyleValue(this.fontWeight),
368
- '--cc-dropdown-color': this.getStyleValue(this.color),
369
- '--cc-dropdown-placeholder-color': this.getStyleValue(this.placeholderColor),
370
- '--cc-dropdown-focus-border-color': this.getStyleValue(this.focusBorderColor),
371
- '--cc-dropdown-error-color': this.getStyleValue(this.errorColor),
372
- '--cc-dropdown-disabled-bg': this.getStyleValue(this.disabledBackgroundColor),
373
- '--cc-dropdown-disabled-color': this.getStyleValue(this.disabledColor),
374
- 'box-shadow': this.getStyleValue(this.boxShadow)
375
- };
376
- }
377
- }
@@ -1,53 +0,0 @@
1
- export interface DropdownOption {
2
- value: any;
3
- label: string;
4
- disabled?: boolean;
5
- icon?: string | { type: 'material' | 'fontawesome' | 'img'; value: string };
6
- }
7
-
8
- export interface DropdownLabels {
9
- label?: string;
10
- placeholder?: string;
11
- searchPlaceholder?: string;
12
- errorMessage?: string;
13
- selectedSuffix?: string;
14
- clearAriaLabel?: string;
15
- noResultsFound?: string;
16
- requiredMarker?: string;
17
- }
18
-
19
- export interface DropdownConfig {
20
- options: DropdownOption[];
21
- placeholder?: string;
22
- label?: string;
23
- multiple?: boolean;
24
- searchable?: boolean;
25
- clearable?: boolean;
26
- disabled?: boolean;
27
- required?: boolean;
28
- errorMessage?: string;
29
- // Customization
30
- width?: string;
31
- height?: string;
32
- borderRadius?: string;
33
- fontSize?: string;
34
-
35
- // Additional Style Props
36
- gap?: string;
37
- fontFamily?: string;
38
- labelColor?: string;
39
- labelFontSize?: string;
40
- labelFontWeight?: string;
41
- backgroundColor?: string;
42
- borderColor?: string;
43
- borderWidth?: string;
44
- padding?: string;
45
- fontWeight?: string;
46
- color?: string;
47
- placeholderColor?: string;
48
- focusBorderColor?: string;
49
- errorColor?: string;
50
- disabledBackgroundColor?: string;
51
- disabledColor?: string;
52
- boxShadow?: string;
53
- }
@@ -1,51 +0,0 @@
1
- <div class="cc-input-container" [ngStyle]="wrapperStyles">
2
- <label *ngIf="label" class="cc-input-label" [ngStyle]="labelStyles">
3
- {{ label }}
4
- <span *ngIf="required" class="cc-required">{{ requiredMarker }}</span>
5
- </label>
6
-
7
- <div class="cc-input-wrapper" [class.focused]="focused" [class.disabled]="disabled" [class.error]="errorMessage"
8
- [ngStyle]="fieldStyles">
9
-
10
- <!-- Prefix Icon -->
11
- <span class="cc-input-prefix" *ngIf="prefixIcon">
12
- <span class="material-icons" *ngIf="getIconType(prefixIcon) === 'material'">{{ getIconValue(prefixIcon)
13
- }}</span>
14
- <i *ngIf="getIconType(prefixIcon) === 'fontawesome'" [class]="getIconValue(prefixIcon)"></i>
15
- <img *ngIf="getIconType(prefixIcon) === 'img'" [src]="getIconValue(prefixIcon)" class="cc-icon-img"
16
- [attr.alt]="labels?.prefixAltText || 'prefix'" />
17
- </span>
18
-
19
- <!-- Input -->
20
- <input *ngIf="type !== 'textarea'" class="cc-input-element" [type]="inputType" [value]="value"
21
- [placeholder]="placeholder" [disabled]="disabled" [required]="required" [readonly]="readonly"
22
- [maxLength]="maxLength || 524288" [minLength]="minLength || 0" [min]="min" [max]="max" [pattern]="pattern"
23
- (input)="onInputChange($event)" (blur)="onBlur()" (focus)="onFocus()" [attr.aria-invalid]="!!errorMessage"
24
- [attr.aria-describedby]="helperText ? 'helper-text' : null" />
25
-
26
- <!-- Textarea -->
27
- <textarea *ngIf="type === 'textarea'" class="cc-input-element cc-textarea" [value]="value"
28
- [placeholder]="placeholder" [disabled]="disabled" [required]="required" [readonly]="readonly"
29
- [maxLength]="maxLength || 524288" [minLength]="minLength || 0" [rows]="rows" (input)="onInputChange($event)"
30
- (blur)="onBlur()" (focus)="onFocus()" [attr.aria-invalid]="!!errorMessage"></textarea>
31
-
32
- <!-- Suffix Icon / Password Toggle -->
33
- <span class="cc-input-suffix">
34
- <button *ngIf="type === 'password'" type="button" class="cc-icon-btn" (click)="togglePasswordVisibility()"
35
- [attr.aria-label]="labels?.passwordToggleAriaLabel">
36
- <span class="material-icons">{{ showPassword ? 'visibility_off' : 'visibility' }}</span>
37
- </button>
38
-
39
- <ng-container *ngIf="suffixIcon && type !== 'password'">
40
- <span class="material-icons" *ngIf="getIconType(suffixIcon) === 'material'">{{ getIconValue(suffixIcon)
41
- }}</span>
42
- <i *ngIf="getIconType(suffixIcon) === 'fontawesome'" [class]="getIconValue(suffixIcon)"></i>
43
- <img *ngIf="getIconType(suffixIcon) === 'img'" [src]="getIconValue(suffixIcon)" class="cc-icon-img"
44
- [attr.alt]="labels?.suffixAltText || 'suffix'" />
45
- </ng-container>
46
- </span>
47
- </div>
48
-
49
- <div class="cc-helper-text" *ngIf="helperText" id="helper-text">{{ helperText }}</div>
50
- <div class="cc-error-message" *ngIf="errorMessage">{{ errorMessage }}</div>
51
- </div>
@@ -1,128 +0,0 @@
1
- .cc-input-container {
2
- display: flex;
3
- flex-direction: column;
4
- gap: var(--cc-input-label-gap, 0.5rem);
5
- width: 100%;
6
- font-family: var(--cc-input-font-family, inherit);
7
- }
8
-
9
- .cc-input-label {
10
- font-size: var(--cc-input-label-font-size, 0.875rem);
11
- font-weight: var(--cc-input-label-font-weight, 500);
12
- color: var(--cc-input-label-color, #202124);
13
- margin: 0;
14
- line-height: 1.4;
15
- }
16
-
17
- .cc-required {
18
- color: var(--cc-input-required-color, #D93025);
19
- margin-left: 0.25rem;
20
- }
21
-
22
- .cc-input-wrapper {
23
- display: flex;
24
- align-items: center;
25
- width: 100%;
26
- box-sizing: border-box;
27
- background-color: var(--cc-input-bg, #FEFEFE);
28
- border: var(--cc-input-border-width, 1px) solid var(--cc-input-border-color, #BDC1C6);
29
- border-radius: var(--cc-input-border-radius, 0.4375rem);
30
- padding: var(--cc-input-padding, 0.5rem 0.75rem);
31
- min-height: var(--cc-input-height, 2.5rem);
32
- transition: border-color 0.2s, box-shadow 0.2s;
33
-
34
- &.focused {
35
- border-color: var(--cc-input-focus-border-color, #1A73E8);
36
- // Optional: add box-shadow for better accessibility/focus ring
37
- }
38
-
39
- &.error {
40
- border-color: var(--cc-input-error-color, #D93025);
41
- }
42
-
43
- &.disabled {
44
- background-color: var(--cc-input-disabled-bg, #F1F3F4);
45
- cursor: not-allowed;
46
-
47
- .cc-input-element {
48
- cursor: not-allowed;
49
- color: var(--cc-input-disabled-color, #80868B);
50
- }
51
-
52
- .material-icons,
53
- i,
54
- img {
55
- opacity: 0.5;
56
- }
57
- }
58
- }
59
-
60
- .cc-input-element {
61
- flex: 1;
62
- border: none;
63
- background: none;
64
- outline: none;
65
- font-family: inherit;
66
- font-size: var(--cc-input-font-size, 0.875rem);
67
- font-weight: var(--cc-input-font-weight, 400);
68
- color: var(--cc-input-color, #202124);
69
- padding: 0;
70
- margin: 0;
71
- width: 100%;
72
-
73
- &::placeholder {
74
- color: var(--cc-input-placeholder-color, #80868B);
75
- }
76
-
77
- &.cc-textarea {
78
- resize: vertical;
79
- min-height: 4rem;
80
- }
81
- }
82
-
83
- .cc-input-prefix,
84
- .cc-input-suffix {
85
- display: flex;
86
- align-items: center;
87
- color: var(--cc-input-icon-color, #5F6368);
88
- }
89
-
90
- .cc-input-prefix {
91
- margin-right: 0.5rem;
92
- }
93
-
94
- .cc-input-suffix {
95
- margin-left: 0.5rem;
96
- }
97
-
98
- .cc-icon-img {
99
- width: 1.25rem;
100
- height: 1.25rem;
101
- object-fit: contain;
102
- }
103
-
104
- .cc-icon-btn {
105
- background: none;
106
- border: none;
107
- cursor: pointer;
108
- padding: 0;
109
- display: flex;
110
- align-items: center;
111
- color: inherit;
112
-
113
- &:focus {
114
- outline: none;
115
- }
116
- }
117
-
118
- .cc-helper-text {
119
- font-size: 0.75rem;
120
- color: #5F6368; // Default, can be variable if needed
121
- margin-top: 0.25rem;
122
- }
123
-
124
- .cc-error-message {
125
- font-size: 0.75rem;
126
- color: var(--cc-input-error-color, #D93025);
127
- margin-top: 0.25rem;
128
- }