commons-shared-web-ui 0.0.54 → 0.0.55

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 (225) hide show
  1. package/.claude/settings.local.json +10 -0
  2. package/documentation/alert.md +123 -0
  3. package/documentation/button-dropdown.md +126 -0
  4. package/documentation/button.md +184 -0
  5. package/documentation/cards-usage-guidelines.md +131 -0
  6. package/documentation/configurable-form.md +605 -0
  7. package/documentation/confirmation-modal.md +250 -0
  8. package/documentation/filter-sidebar.md +178 -0
  9. package/documentation/filter-table-selector.md +228 -0
  10. package/documentation/form-builder.md +599 -0
  11. package/documentation/form-components.md +384 -0
  12. package/documentation/form-field-configuration.md +250 -0
  13. package/documentation/nav.md +427 -0
  14. package/documentation/pagination.md +181 -0
  15. package/documentation/side-nav-documentation.md +169 -0
  16. package/documentation/smart-form.md +2765 -0
  17. package/documentation/smart-table.md +1221 -0
  18. package/documentation/snackbar.md +118 -0
  19. package/documentation/style-externalization.md +88 -0
  20. package/documentation/summary-card.md +279 -0
  21. package/documentation/table-column-configuration.md +221 -0
  22. package/documentation/time-picker.md +274 -0
  23. package/ng-package.json +30 -0
  24. package/package.json +53 -34
  25. package/src/lib/modules/alert/alert.models.ts +6 -0
  26. package/src/lib/modules/alert/alert.module.ts +16 -0
  27. package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
  28. package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
  29. package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
  30. package/src/lib/modules/button/button.models.ts +13 -0
  31. package/src/lib/modules/button/button.module.ts +16 -0
  32. package/src/lib/modules/button/components/button/button.component.html +22 -0
  33. package/src/lib/modules/button/components/button/button.component.scss +88 -0
  34. package/src/lib/modules/button/components/button/button.component.ts +67 -0
  35. package/src/lib/modules/button-dropdown/button-dropdown.models.ts +26 -0
  36. package/src/lib/modules/button-dropdown/button-dropdown.module.ts +22 -0
  37. package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +87 -0
  38. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +41 -0
  39. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +135 -0
  40. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +160 -0
  41. package/src/lib/modules/configurable-form/component/configurable-form.component.html +294 -0
  42. package/src/lib/modules/configurable-form/component/configurable-form.component.scss +503 -0
  43. package/src/lib/modules/configurable-form/component/configurable-form.component.ts +628 -0
  44. package/src/lib/modules/configurable-form/configurable-form.examples.ts +154 -0
  45. package/src/lib/modules/configurable-form/configurable-form.model.ts +131 -0
  46. package/src/lib/modules/configurable-form/configurable-form.module.ts +19 -0
  47. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +77 -0
  48. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +395 -0
  49. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +266 -0
  50. package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +71 -0
  51. package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +20 -0
  52. package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
  53. package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
  54. package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
  55. package/src/lib/modules/filter/filter.models.ts +88 -0
  56. package/src/lib/modules/filter/filter.module.ts +24 -0
  57. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
  58. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
  59. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
  60. package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
  61. package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
  62. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
  63. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
  64. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
  65. package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
  66. package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
  67. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
  68. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
  69. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
  70. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
  71. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
  72. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
  73. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
  74. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
  75. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
  76. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
  77. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
  78. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
  79. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
  80. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
  81. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
  82. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
  83. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
  84. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
  85. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
  86. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
  87. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
  88. package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
  89. package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
  90. package/src/lib/modules/form-builder/index.ts +9 -0
  91. package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
  92. package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
  93. package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
  94. package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
  95. package/src/lib/modules/form-builder/services/field-selection.service.ts +299 -0
  96. package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +670 -0
  97. package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
  98. package/src/lib/modules/form-builder/utils/constants.ts +43 -0
  99. package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
  100. package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
  101. package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
  102. package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
  103. package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
  104. package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
  105. package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
  106. package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
  107. package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
  108. package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
  109. package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
  110. package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
  111. package/src/lib/modules/form-components/components/input/input.component.html +51 -0
  112. package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
  113. package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
  114. package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
  115. package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
  116. package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
  117. package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
  118. package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
  119. package/src/lib/modules/form-components/components/search/search.component.html +15 -0
  120. package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
  121. package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
  122. package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
  123. package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
  124. package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
  125. package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
  126. package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
  127. package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
  128. package/src/lib/modules/form-components/form-components.module.ts +42 -0
  129. package/src/lib/modules/form-field-configuration/components/_ffc-controls.scss +89 -0
  130. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.html +68 -0
  131. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.scss +73 -0
  132. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.ts +34 -0
  133. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.html +78 -0
  134. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.scss +83 -0
  135. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.ts +94 -0
  136. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.html +38 -0
  137. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.scss +42 -0
  138. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.ts +92 -0
  139. package/src/lib/modules/form-field-configuration/form-field-configuration.module.ts +23 -0
  140. package/src/lib/modules/form-field-configuration/index.ts +7 -0
  141. package/src/lib/modules/form-field-configuration/models/field-configuration.models.ts +62 -0
  142. package/src/lib/modules/form-field-configuration/services/config-schema-tree.service.ts +159 -0
  143. package/src/lib/modules/form-field-configuration/services/field-configuration.service.ts +228 -0
  144. package/src/lib/modules/material/material.module.ts +94 -0
  145. package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
  146. package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
  147. package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
  148. package/src/lib/modules/nav/nav.models.ts +31 -0
  149. package/src/lib/modules/nav/nav.module.ts +17 -0
  150. package/src/lib/modules/pagination/components/pagination/pagination.component.html +52 -0
  151. package/src/lib/modules/pagination/components/pagination/pagination.component.scss +155 -0
  152. package/src/lib/modules/pagination/components/pagination/pagination.component.ts +109 -0
  153. package/src/lib/modules/pagination/pagination.module.ts +17 -0
  154. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +56 -0
  155. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +342 -0
  156. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +135 -0
  157. package/src/lib/modules/side-nav/side-nav.models.ts +38 -0
  158. package/src/lib/modules/side-nav/side-nav.module.ts +16 -0
  159. package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1330 -0
  160. package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +2112 -0
  161. package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +3006 -0
  162. package/src/lib/modules/smart-form/components/form-section/form-section.component.html +65 -0
  163. package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
  164. package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +131 -0
  165. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
  166. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
  167. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1131 -0
  168. package/src/lib/modules/smart-form/index.ts +10 -0
  169. package/src/lib/modules/smart-form/models/form-schema.model.ts +793 -0
  170. package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +21 -0
  171. package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
  172. package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +67 -0
  173. package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
  174. package/src/lib/modules/smart-form/smart-form.module.ts +38 -0
  175. package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
  176. package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
  177. package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
  178. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
  179. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
  180. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1128 -0
  181. package/src/lib/modules/smart-table/models/table-config.model.ts +213 -0
  182. package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
  183. package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +28 -0
  184. package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
  185. package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
  186. package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
  187. package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
  188. package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
  189. package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
  190. package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
  191. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
  192. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
  193. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
  194. package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
  195. package/src/lib/modules/table-column-configuration/components/_tcc-controls.scss +53 -0
  196. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.html +47 -0
  197. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.scss +50 -0
  198. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.ts +33 -0
  199. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.html +30 -0
  200. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.scss +36 -0
  201. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.ts +78 -0
  202. package/src/lib/modules/table-column-configuration/index.ts +5 -0
  203. package/src/lib/modules/table-column-configuration/models/table-column-configuration.models.ts +20 -0
  204. package/src/lib/modules/table-column-configuration/services/table-column-configuration.service.ts +77 -0
  205. package/src/lib/modules/table-column-configuration/table-column-configuration.module.ts +21 -0
  206. package/src/lib/modules/time-picker/components/time-picker/time-picker.component.html +37 -0
  207. package/src/lib/modules/time-picker/components/time-picker/time-picker.component.scss +102 -0
  208. package/src/lib/modules/time-picker/components/time-picker/time-picker.component.ts +178 -0
  209. package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.html +78 -0
  210. package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.scss +226 -0
  211. package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.ts +595 -0
  212. package/src/lib/modules/time-picker/models/time-picker.models.ts +49 -0
  213. package/src/lib/modules/time-picker/time-picker.module.ts +23 -0
  214. package/src/lib/modules/time-picker/time-picker.theme.scss +87 -0
  215. package/src/lib/shared-ui.module.ts +55 -0
  216. package/src/lib/styles/global.scss +10 -0
  217. package/src/lib/utils/constants.ts +11 -0
  218. package/src/lib/utils/storage.utils.ts +37 -0
  219. package/src/lib/utils/string.utils.ts +23 -0
  220. package/src/lib/utils/translation.utils.ts +87 -0
  221. package/src/public-api.ts +127 -0
  222. package/tsconfig.lib.json +15 -0
  223. package/fesm2022/commons-shared-web-ui.mjs +0 -14823
  224. package/fesm2022/commons-shared-web-ui.mjs.map +0 -1
  225. package/index.d.ts +0 -4679
@@ -0,0 +1,88 @@
1
+ .cc-btn {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ box-sizing: border-box;
6
+ cursor: pointer;
7
+ transition: all 0.2s ease-in-out;
8
+
9
+ // Common styles from variables
10
+ font-family: var(--cc-btn-font-family);
11
+ font-weight: var(--cc-btn-font-weight);
12
+ font-size: var(--cc-btn-font-size);
13
+ padding: var(--cc-btn-padding);
14
+
15
+ // Disabled State
16
+ &:disabled {
17
+ opacity: var(--cc-btn-disabled-opacity);
18
+ cursor: var(--cc-btn-disabled-cursor);
19
+ pointer-events: none;
20
+ }
21
+
22
+ // Variants
23
+ &.cc-btn-primary {
24
+ background-color: var(--cc-btn-primary-bg);
25
+ color: var(--cc-btn-primary-color);
26
+ border-radius: var(--cc-btn-primary-radius);
27
+ border: var(--cc-btn-primary-border);
28
+ }
29
+
30
+ &.cc-btn-warning {
31
+ background-color: var(--cc-btn-warning-bg);
32
+ color: var(--cc-btn-warning-color);
33
+ border-radius: var(--cc-btn-warning-radius);
34
+ border: var(--cc-btn-warning-border);
35
+ }
36
+
37
+ &.cc-btn-outline {
38
+ background-color: var(--cc-btn-outline-bg);
39
+ color: var(--cc-btn-outline-color);
40
+ border-radius: var(--cc-btn-outline-radius);
41
+ border: var(--cc-btn-outline-border);
42
+ }
43
+
44
+ &.cc-btn-secondary {
45
+ background-color: var(--cc-btn-secondary-bg);
46
+ color: var(--cc-btn-secondary-color);
47
+ border-radius: var(--cc-btn-secondary-radius);
48
+ border: var(--cc-btn-secondary-border);
49
+ }
50
+
51
+ &.cc-btn-success {
52
+ background-color: var(--cc-btn-success-bg);
53
+ color: var(--cc-btn-success-color);
54
+ border-radius: var(--cc-btn-success-radius);
55
+ border: var(--cc-btn-success-border);
56
+ }
57
+
58
+ &.cc-btn-danger {
59
+ background-color: var(--cc-btn-danger-bg);
60
+ color: var(--cc-btn-danger-color);
61
+ border-radius: var(--cc-btn-danger-radius);
62
+ border: var(--cc-btn-danger-border);
63
+ }
64
+
65
+ &.cc-btn-danger-outline {
66
+ background-color: var(--cc-btn-danger-outline-bg);
67
+ color: var(--cc-btn-danger-outline-color);
68
+ border-radius: var(--cc-btn-danger-outline-radius);
69
+ border: var(--cc-btn-danger-outline-border);
70
+ }
71
+
72
+ .cc-btn-icon-wrapper {
73
+ display: inline-flex;
74
+ align-items: center;
75
+ margin-right: 0.5rem; // 8px
76
+ }
77
+
78
+ .cc-btn-icon {
79
+ font-size: 1.1em;
80
+ line-height: 1;
81
+ }
82
+
83
+ .cc-btn-img-icon {
84
+ width: 1.25rem;
85
+ height: 1.25rem;
86
+ object-fit: contain;
87
+ }
88
+ }
@@ -0,0 +1,67 @@
1
+ import { Component, Input, OnInit, HostBinding } from '@angular/core';
2
+
3
+ import { ButtonLabels, ButtonVariant } from '../../button.models';
4
+
5
+ @Component({
6
+ selector: 'lib-button',
7
+ templateUrl: './button.component.html',
8
+ styleUrls: ['./button.component.scss'],
9
+ standalone: false
10
+ })
11
+ export class ButtonComponent implements OnInit {
12
+
13
+ @Input() variant: ButtonVariant = 'primary';
14
+ @Input() type: 'button' | 'submit' | 'reset' = 'button';
15
+ @Input() disabled: boolean = false;
16
+
17
+ @HostBinding('style.pointer-events')
18
+ get pointerEvents(): string {
19
+ return this.disabled ? 'none' : 'auto';
20
+ }
21
+
22
+ // Customization Inputs
23
+ @Input() width?: string;
24
+ @Input() height?: string;
25
+ @Input() borderRadius?: string;
26
+ @Input() fontSize?: string;
27
+ @Input() fontWeight?: string;
28
+ @Input() backgroundColor?: string;
29
+ @Input() color?: string;
30
+ @Input() border?: string;
31
+ @Input() icon: boolean | string | { type: 'material' | 'fontawesome' | 'img'; value: string } = '';
32
+ @Input() labels?: ButtonLabels;
33
+
34
+ constructor() { }
35
+
36
+ ngOnInit(): void {
37
+ }
38
+
39
+ get isDefaultIcon(): boolean {
40
+ return this.icon === true;
41
+ }
42
+
43
+ get isStringIcon(): boolean {
44
+ return typeof this.icon === 'string' && this.icon !== '';
45
+ }
46
+
47
+ get isImgIcon(): boolean {
48
+ const icon = this.icon;
49
+ if (typeof icon === 'string') {
50
+ return icon.includes('/') || icon.includes('.') || icon.startsWith('http');
51
+ }
52
+ return typeof icon === 'object' && icon !== null && !!icon.value && (icon.type === 'img' || icon.value.includes('/') || icon.value.includes('.') || icon.value.startsWith('http'));
53
+ }
54
+
55
+ get isObjectIcon(): boolean {
56
+ return typeof this.icon === 'object' && this.icon !== null;
57
+ }
58
+
59
+ get iconString(): string {
60
+ return typeof this.icon === 'string' ? this.icon : '';
61
+ }
62
+
63
+ get iconObject(): { type: string; value: string } {
64
+ return typeof this.icon === 'object' ? this.icon as any : { type: '', value: '' };
65
+ }
66
+
67
+ }
@@ -0,0 +1,26 @@
1
+ import { ButtonVariant } from '../button/button.models';
2
+
3
+ export interface DropdownAction {
4
+ label: string;
5
+ type: 'api' | 'route' | 'callback';
6
+ icon?: string;
7
+ color?: string; // Generic override
8
+ variant?: ButtonVariant; // Explict variant (primary, warning, danger, etc)
9
+
10
+ // For 'route' type
11
+ route?: string;
12
+
13
+ // For 'api' type
14
+ apiUrl?: string;
15
+ apiMethod?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
16
+ apiPayload?: any;
17
+
18
+ // For 'callback' type
19
+ callback?: (data: any) => void;
20
+
21
+ // Universal options
22
+ disabled?: boolean;
23
+ confirmationNeeded?: boolean;
24
+ confirmationMessage?: string;
25
+ confirmationTitle?: string;
26
+ }
@@ -0,0 +1,22 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { RouterModule } from '@angular/router';
4
+ import { ButtonDropdownComponent } from './components/button-dropdown/button-dropdown.component';
5
+ import { ButtonModule } from '../button/button.module';
6
+ import { ConfirmationModalModule } from '../confirmation-modal/confirmation-modal.module';
7
+
8
+ @NgModule({
9
+ declarations: [
10
+ ButtonDropdownComponent
11
+ ],
12
+ imports: [
13
+ CommonModule,
14
+ RouterModule,
15
+ ButtonModule,
16
+ ConfirmationModalModule
17
+ ],
18
+ exports: [
19
+ ButtonDropdownComponent
20
+ ]
21
+ })
22
+ export class ButtonDropdownModule { }
@@ -0,0 +1,87 @@
1
+ @use 'sass:map';
2
+
3
+ $default-button-dropdown-config: (
4
+ // General Structure
5
+ menu-radius: 4px,
6
+ menu-border-light: 1px solid #e0e0e0,
7
+ menu-border-dark: 1px solid #444444,
8
+ menu-shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1),
9
+ menu-shadow-dark: 0 4px 6px rgba(0, 0, 0, 0.5),
10
+
11
+ // Light Theme Map
12
+ light-bg: #ffffff,
13
+ light-item-color: #333333,
14
+ light-item-hover-bg: #f5f5f5,
15
+
16
+ // Dark Theme Map
17
+ dark-bg: #1a1a1a,
18
+ dark-item-color: #ffffff,
19
+ dark-item-hover-bg: #2d2d2d,
20
+
21
+ // Button Variants (For Explicit Actions)
22
+ primary-bg: #262125,
23
+ primary-color: #ffffff,
24
+ primary-hover: #3d353b,
25
+
26
+ warning-bg: #F9C80E,
27
+ warning-color: #000000,
28
+ warning-hover: #ebd573,
29
+
30
+ success-bg: #16A34A,
31
+ success-color: #ffffff,
32
+ success-hover: #148f41,
33
+
34
+ danger-bg: #E63E30,
35
+ danger-color: #ffffff,
36
+ danger-hover: #c93528,
37
+
38
+ secondary-bg: #E8EAED,
39
+ secondary-color: #000000,
40
+ secondary-hover: #d1d5db,
41
+
42
+ outline-bg: transparent,
43
+ outline-color: #000000,
44
+ outline-hover: rgba(0,0,0,0.05)
45
+ );
46
+
47
+ @mixin button-dropdown-theme($user-config: ()) {
48
+ $config: map.merge($default-button-dropdown-config, $user-config);
49
+
50
+ --cc-btn-dropdown-radius: #{map.get($config, menu-radius)};
51
+ --cc-btn-dropdown-border-light: #{map.get($config, menu-border-light)};
52
+ --cc-btn-dropdown-border-dark: #{map.get($config, menu-border-dark)};
53
+ --cc-btn-dropdown-shadow-light: #{map.get($config, menu-shadow-light)};
54
+ --cc-btn-dropdown-shadow-dark: #{map.get($config, menu-shadow-dark)};
55
+
56
+ --cc-btn-dropdown-light-bg: #{map.get($config, light-bg)};
57
+ --cc-btn-dropdown-light-item-color: #{map.get($config, light-item-color)};
58
+ --cc-btn-dropdown-light-item-hover-bg: #{map.get($config, light-item-hover-bg)};
59
+
60
+ --cc-btn-dropdown-dark-bg: #{map.get($config, dark-bg)};
61
+ --cc-btn-dropdown-dark-item-color: #{map.get($config, dark-item-color)};
62
+ --cc-btn-dropdown-dark-item-hover-bg: #{map.get($config, dark-item-hover-bg)};
63
+
64
+ --cc-btn-dropdown-primary-bg: #{map.get($config, primary-bg)};
65
+ --cc-btn-dropdown-primary-color: #{map.get($config, primary-color)};
66
+ --cc-btn-dropdown-primary-hover: #{map.get($config, primary-hover)};
67
+
68
+ --cc-btn-dropdown-warning-bg: #{map.get($config, warning-bg)};
69
+ --cc-btn-dropdown-warning-color: #{map.get($config, warning-color)};
70
+ --cc-btn-dropdown-warning-hover: #{map.get($config, warning-hover)};
71
+
72
+ --cc-btn-dropdown-success-bg: #{map.get($config, success-bg)};
73
+ --cc-btn-dropdown-success-color: #{map.get($config, success-color)};
74
+ --cc-btn-dropdown-success-hover: #{map.get($config, success-hover)};
75
+
76
+ --cc-btn-dropdown-danger-bg: #{map.get($config, danger-bg)};
77
+ --cc-btn-dropdown-danger-color: #{map.get($config, danger-color)};
78
+ --cc-btn-dropdown-danger-hover: #{map.get($config, danger-hover)};
79
+
80
+ --cc-btn-dropdown-secondary-bg: #{map.get($config, secondary-bg)};
81
+ --cc-btn-dropdown-secondary-color: #{map.get($config, secondary-color)};
82
+ --cc-btn-dropdown-secondary-hover: #{map.get($config, secondary-hover)};
83
+
84
+ --cc-btn-dropdown-outline-bg: #{map.get($config, outline-bg)};
85
+ --cc-btn-dropdown-outline-color: #{map.get($config, outline-color)};
86
+ --cc-btn-dropdown-outline-hover: #{map.get($config, outline-hover)};
87
+ }
@@ -0,0 +1,41 @@
1
+ <div class="cc-btn-dropdown-container">
2
+ <!-- Main Toggle Button -->
3
+ <lib-button
4
+ [variant]="variant"
5
+ [disabled]="disabled"
6
+ (click)="toggleDropdown($event)">
7
+ <span class="cc-btn-dropdown-content">
8
+ {{ label }}
9
+ <i *ngIf="icon" [class]="icon" class="cc-btn-dropdown-icon"></i>
10
+ </span>
11
+ </lib-button>
12
+
13
+ <!-- Dropdown Menu -->
14
+ <div class="cc-dropdown-menu" [ngClass]="'cc-dropdown-menu--' + menuTheme" *ngIf="isOpen">
15
+ <button
16
+ type="button"
17
+ class="cc-dropdown-item"
18
+ *ngFor="let action of actions"
19
+ [disabled]="action.disabled"
20
+ [ngClass]="action.variant ? 'cc-dropdown-item--' + action.variant : (action.color === 'red' || action.color === 'danger') ? 'cc-dropdown-item--danger' : ''"
21
+ [style.color]="action.color && !action.variant && action.color !== 'red' && action.color !== 'danger' ? action.color : null"
22
+ (click)="onActionItemClick(action, $event)">
23
+ <i *ngIf="action.icon" [class]="action.icon" class="cc-dropdown-item-icon"></i>
24
+ <span>{{ action.label }}</span>
25
+ </button>
26
+ <div class="cc-dropdown-empty" *ngIf="!actions || actions.length === 0">
27
+ No actions available
28
+ </div>
29
+ </div>
30
+ </div>
31
+
32
+ <!-- Confirmation Modal for Critical Actions -->
33
+ <cc-confirmation-modal
34
+ *ngIf="isConfirmModalOpen"
35
+ [isOpen]="isConfirmModalOpen"
36
+ [config]="confirmConfig!"
37
+ (confirm)="invokePendingAction()"
38
+ (close)="closeConfirmModal()"
39
+ (cancel)="closeConfirmModal()">
40
+ <p>{{ confirmMessage }}</p>
41
+ </cc-confirmation-modal>
@@ -0,0 +1,135 @@
1
+ .cc-btn-dropdown-container {
2
+ position: relative;
3
+ display: inline-block;
4
+
5
+ .cc-btn-dropdown-content {
6
+ display: flex;
7
+ align-items: center;
8
+ gap: 0.5rem;
9
+ }
10
+
11
+ .cc-btn-dropdown-icon {
12
+ font-size: 0.85em;
13
+ margin-left: 2px;
14
+ }
15
+ }
16
+
17
+ .cc-dropdown-menu {
18
+ position: absolute;
19
+ top: calc(100% + 4px);
20
+ right: 0; // Align right edge
21
+ z-index: 1000;
22
+ min-width: 140px;
23
+ border-radius: var(--cc-btn-dropdown-radius, 4px);
24
+ padding: 0.25rem 0;
25
+ font-family: var(--cc-btn-font-family, 'Inter', sans-serif);
26
+ font-size: var(--cc-btn-font-size, 0.875rem);
27
+
28
+ /* ------------------------------ */
29
+ /* Light vs Dark Global Container */
30
+ /* ------------------------------ */
31
+ &--light {
32
+ background-color: var(--cc-btn-dropdown-light-bg, #ffffff);
33
+ border: var(--cc-btn-dropdown-border-light, 1px solid #e0e0e0);
34
+ box-shadow: var(--cc-btn-dropdown-shadow-light, 0 4px 6px rgba(0, 0, 0, 0.1));
35
+
36
+ .cc-dropdown-item {
37
+ color: var(--cc-btn-dropdown-light-item-color, #333333);
38
+ &:hover:not(:disabled) {
39
+ background-color: var(--cc-btn-dropdown-light-item-hover-bg, #f5f5f5);
40
+ }
41
+ }
42
+
43
+ .cc-dropdown-empty {
44
+ color: #888888;
45
+ }
46
+ }
47
+
48
+ &--dark {
49
+ background-color: var(--cc-btn-dropdown-dark-bg, #1a1a1a);
50
+ border: var(--cc-btn-dropdown-border-dark, 1px solid #444444);
51
+ box-shadow: var(--cc-btn-dropdown-shadow-dark, 0 4px 6px rgba(0, 0, 0, 0.5));
52
+
53
+ .cc-dropdown-item {
54
+ color: var(--cc-btn-dropdown-dark-item-color, #ffffff);
55
+ &:hover:not(:disabled) {
56
+ background-color: var(--cc-btn-dropdown-dark-item-hover-bg, #2d2d2d);
57
+ }
58
+ }
59
+
60
+ .cc-dropdown-empty {
61
+ color: #bbbbbb;
62
+ }
63
+ }
64
+
65
+ /* ------------------------------ */
66
+ /* Shared Item Styles */
67
+ /* ------------------------------ */
68
+ .cc-dropdown-empty {
69
+ padding: 0.5rem 1rem;
70
+ font-style: italic;
71
+ }
72
+
73
+ .cc-dropdown-item {
74
+ display: flex;
75
+ align-items: center;
76
+ width: 100%;
77
+ padding: 0.5rem 1rem;
78
+ border: none;
79
+ background: transparent;
80
+ text-align: left;
81
+ cursor: pointer;
82
+ transition: background-color 0.2s, color 0.2s;
83
+
84
+ &:disabled {
85
+ opacity: 0.5;
86
+ cursor: not-allowed;
87
+ }
88
+
89
+ .cc-dropdown-item-icon {
90
+ margin-right: 0.5rem;
91
+ width: 1rem;
92
+ text-align: center;
93
+ }
94
+
95
+ /* ------------------------------ */
96
+ /* Explicit Action Variants */
97
+ /* ------------------------------ */
98
+ &--primary {
99
+ background-color: var(--cc-btn-dropdown-primary-bg, #262125);
100
+ color: var(--cc-btn-dropdown-primary-color, #ffffff);
101
+ &:hover:not(:disabled) { background-color: var(--cc-btn-dropdown-primary-hover, #3d353b); }
102
+ }
103
+
104
+ &--warning {
105
+ background-color: var(--cc-btn-dropdown-warning-bg, #F9C80E);
106
+ color: var(--cc-btn-dropdown-warning-color, #000000);
107
+ &:hover:not(:disabled) { background-color: var(--cc-btn-dropdown-warning-hover, #ebd573); }
108
+ }
109
+
110
+ &--danger {
111
+ background-color: var(--cc-btn-dropdown-danger-bg, #E63E30);
112
+ color: var(--cc-btn-dropdown-danger-color, #ffffff);
113
+ &:hover:not(:disabled) { background-color: var(--cc-btn-dropdown-danger-hover, #c93528); }
114
+ }
115
+
116
+ &--success {
117
+ background-color: var(--cc-btn-dropdown-success-bg, #16A34A);
118
+ color: var(--cc-btn-dropdown-success-color, #ffffff);
119
+ &:hover:not(:disabled) { background-color: var(--cc-btn-dropdown-success-hover, #148f41); }
120
+ }
121
+
122
+ &--secondary {
123
+ background-color: var(--cc-btn-dropdown-secondary-bg, #E8EAED);
124
+ color: var(--cc-btn-dropdown-secondary-color, #000000);
125
+ &:hover:not(:disabled) { background-color: var(--cc-btn-dropdown-secondary-hover, #d1d5db); }
126
+ }
127
+
128
+ &--outline {
129
+ background-color: var(--cc-btn-dropdown-outline-bg, transparent);
130
+ color: var(--cc-btn-dropdown-outline-color, #000000);
131
+ border: 1px solid var(--cc-btn-dropdown-outline-color, #000000); // Usually actions don't have borders, but adding for completeness
132
+ &:hover:not(:disabled) { background-color: var(--cc-btn-dropdown-outline-hover, rgba(0,0,0,0.05)); }
133
+ }
134
+ }
135
+ }
@@ -0,0 +1,160 @@
1
+ import {
2
+ Component,
3
+ Input,
4
+ Output,
5
+ EventEmitter,
6
+ HostListener,
7
+ ElementRef
8
+ } from '@angular/core';
9
+ import { Router } from '@angular/router';
10
+ import { HttpClient } from '@angular/common/http';
11
+ import { DropdownAction } from '../../button-dropdown.models';
12
+ import { ButtonVariant } from '../../../button/button.models';
13
+ import { ConfirmationModalConfig } from '../../../confirmation-modal/confirmation-modal.models';
14
+
15
+ @Component({
16
+ selector: 'lib-button-dropdown',
17
+ templateUrl: './button-dropdown.component.html',
18
+ styleUrls: ['./button-dropdown.component.scss'],
19
+ standalone: false
20
+ })
21
+ export class ButtonDropdownComponent {
22
+ @Input() label: string = 'Actions';
23
+ @Input() variant: ButtonVariant = 'primary';
24
+ @Input() menuTheme: 'light' | 'dark' = 'light';
25
+ @Input() icon: string = 'fa fa-chevron-down';
26
+ @Input() actions: DropdownAction[] = [];
27
+ @Input() data: any = null;
28
+ @Input() disabled: boolean = false;
29
+
30
+ @Output() apiActionStart = new EventEmitter<DropdownAction>();
31
+ @Output() apiActionSuccess = new EventEmitter<{ action: DropdownAction, response: any }>();
32
+ @Output() apiActionError = new EventEmitter<{ action: DropdownAction, error: any }>();
33
+ @Output() actionClick = new EventEmitter<{ action: DropdownAction, data: any }>();
34
+
35
+ isOpen = false;
36
+ isConfirmModalOpen = false;
37
+ pendingAction: DropdownAction | null = null;
38
+ confirmConfig: ConfirmationModalConfig | null = null;
39
+ confirmMessage: string = '';
40
+
41
+ constructor(
42
+ private elementRef: ElementRef,
43
+ private router: Router,
44
+ private http: HttpClient
45
+ ) {}
46
+
47
+ @HostListener('document:click', ['$event'])
48
+ onClickOutside(event: Event) {
49
+ if (!this.elementRef.nativeElement.contains(event.target)) {
50
+ this.isOpen = false;
51
+ }
52
+ }
53
+
54
+ toggleDropdown(event: Event) {
55
+ if (this.disabled) return;
56
+ event.stopPropagation();
57
+ this.isOpen = !this.isOpen;
58
+ }
59
+
60
+ onActionItemClick(action: DropdownAction, event: Event) {
61
+ event.stopPropagation();
62
+ this.isOpen = false;
63
+
64
+ if (action.disabled) return;
65
+
66
+ if (action.confirmationNeeded) {
67
+ this.pendingAction = action;
68
+
69
+ // Smart inference for "delete" actions
70
+ const isDelete = action.apiMethod === 'DELETE' ||
71
+ action.variant === 'danger' ||
72
+ action.color === 'red' ||
73
+ action.label.toLowerCase().includes('delete');
74
+
75
+ // Apply intelligent fallbacks based on action intent
76
+ this.confirmMessage = action.confirmationMessage || (isDelete
77
+ ? 'Are you sure you want to delete this item? This action cannot be undone.'
78
+ : 'Are you sure you want to proceed?');
79
+
80
+ this.confirmConfig = {
81
+ title: action.confirmationTitle || (isDelete ? 'Confirm Deletion' : 'Please Confirm'),
82
+ icon: { type: 'material', value: 'warning', color: isDelete ? '#E63E30' : '#F9C80E' },
83
+ confirmButton: {
84
+ label: isDelete ? 'Delete' : 'Confirm',
85
+ type: isDelete ? 'danger' : 'primary'
86
+ },
87
+ cancelButton: {
88
+ show: true,
89
+ label: 'Cancel'
90
+ }
91
+ };
92
+ this.isConfirmModalOpen = true;
93
+ } else {
94
+ this.executeAction(action);
95
+ }
96
+ }
97
+
98
+ private executeAction(action: DropdownAction) {
99
+ this.actionClick.emit({ action, data: this.data });
100
+
101
+ if (action.type === 'callback' && action.callback) {
102
+ action.callback(this.data);
103
+ } else if (action.type === 'route' && action.route) {
104
+ this.navigateToRoute(action.route, this.data);
105
+ } else if (action.type === 'api' && action.apiUrl) {
106
+ this.executeApiCall(action);
107
+ }
108
+ }
109
+
110
+ private navigateToRoute(routePattern: string, rowData: any) {
111
+ let finalRoute = routePattern;
112
+ // Simple parameter replacement like smart-table: /users/:id -> /users/123
113
+ if (rowData) {
114
+ Object.keys(rowData).forEach(key => {
115
+ finalRoute = finalRoute.replace(`:${key}`, rowData[key]);
116
+ });
117
+ }
118
+ this.router.navigate([finalRoute]);
119
+ }
120
+
121
+ private executeApiCall(action: DropdownAction) {
122
+ this.apiActionStart.emit(action);
123
+
124
+ let url = action.apiUrl!;
125
+ if (this.data) {
126
+ Object.keys(this.data).forEach(key => {
127
+ url = url.replace(`:${key}`, this.data[key]);
128
+ });
129
+ }
130
+
131
+ const method = (action.apiMethod || 'GET').toUpperCase();
132
+ let request$;
133
+
134
+ if (method === 'GET') request$ = this.http.get(url);
135
+ else if (method === 'POST') request$ = this.http.post(url, action.apiPayload || this.data);
136
+ else if (method === 'PUT') request$ = this.http.put(url, action.apiPayload || this.data);
137
+ else if (method === 'DELETE') request$ = this.http.delete(url);
138
+ else if (method === 'PATCH') request$ = this.http.patch(url, action.apiPayload || this.data);
139
+ else request$ = this.http.get(url); // fallback
140
+
141
+ request$.subscribe({
142
+ next: (res) => this.apiActionSuccess.emit({ action, response: res }),
143
+ error: (err) => this.apiActionError.emit({ action, error: err })
144
+ });
145
+ }
146
+
147
+ invokePendingAction() {
148
+ if (this.pendingAction) {
149
+ this.executeAction(this.pendingAction);
150
+ }
151
+ this.closeConfirmModal();
152
+ }
153
+
154
+ closeConfirmModal() {
155
+ this.isConfirmModalOpen = false;
156
+ this.pendingAction = null;
157
+ this.confirmConfig = null;
158
+ this.confirmMessage = '';
159
+ }
160
+ }