platformcommons-web-lib 1.0.0

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 (208) hide show
  1. package/commons-shared-web-ui-1.0.0.tgz +0 -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 +597 -0
  11. package/documentation/form-components.md +384 -0
  12. package/documentation/nav.md +427 -0
  13. package/documentation/pagination.md +181 -0
  14. package/documentation/side-nav-documentation.md +169 -0
  15. package/documentation/smart-form.md +2177 -0
  16. package/documentation/smart-table.md +1198 -0
  17. package/documentation/snackbar.md +118 -0
  18. package/documentation/style-externalization.md +88 -0
  19. package/documentation/summary-card.md +279 -0
  20. package/ng-package.json +28 -0
  21. package/package.json +54 -0
  22. package/src/lib/modules/alert/alert.models.ts +6 -0
  23. package/src/lib/modules/alert/alert.module.ts +16 -0
  24. package/src/lib/modules/alert/alert.theme.scss +85 -0
  25. package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
  26. package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
  27. package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
  28. package/src/lib/modules/button/button.models.ts +13 -0
  29. package/src/lib/modules/button/button.module.ts +16 -0
  30. package/src/lib/modules/button/button.theme.scss +121 -0
  31. package/src/lib/modules/button/components/button/button.component.html +22 -0
  32. package/src/lib/modules/button/components/button/button.component.scss +88 -0
  33. package/src/lib/modules/button/components/button/button.component.ts +67 -0
  34. package/src/lib/modules/button-dropdown/button-dropdown.models.ts +26 -0
  35. package/src/lib/modules/button-dropdown/button-dropdown.module.ts +22 -0
  36. package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +87 -0
  37. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +41 -0
  38. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +135 -0
  39. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +160 -0
  40. package/src/lib/modules/configurable-form/component/configurable-form.component.html +294 -0
  41. package/src/lib/modules/configurable-form/component/configurable-form.component.scss +503 -0
  42. package/src/lib/modules/configurable-form/component/configurable-form.component.ts +628 -0
  43. package/src/lib/modules/configurable-form/configurable-form.examples.ts +154 -0
  44. package/src/lib/modules/configurable-form/configurable-form.model.ts +131 -0
  45. package/src/lib/modules/configurable-form/configurable-form.module.ts +19 -0
  46. package/src/lib/modules/configurable-form/configurable-form.theme.scss +78 -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/confirmation-modal/confirmation-modal.theme.scss +87 -0
  53. package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
  54. package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
  55. package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
  56. package/src/lib/modules/filter/filter.models.ts +88 -0
  57. package/src/lib/modules/filter/filter.module.ts +24 -0
  58. package/src/lib/modules/filter/filter.theme.scss +92 -0
  59. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
  60. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
  61. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
  62. package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
  63. package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
  64. package/src/lib/modules/filter-sidebar/filter-sidebar.theme.scss +38 -0
  65. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
  66. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
  67. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
  68. package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
  69. package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
  70. package/src/lib/modules/filter-table-selector/filter-table-selector.theme.scss +36 -0
  71. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
  72. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
  73. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
  74. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
  75. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
  76. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
  77. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
  78. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
  79. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
  80. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
  81. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
  82. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
  83. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
  84. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
  85. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
  86. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
  87. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
  88. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
  89. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
  90. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
  91. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
  92. package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
  93. package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
  94. package/src/lib/modules/form-builder/form-builder.theme.scss +212 -0
  95. package/src/lib/modules/form-builder/index.ts +9 -0
  96. package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
  97. package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
  98. package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
  99. package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
  100. package/src/lib/modules/form-builder/services/field-selection.service.ts +300 -0
  101. package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +652 -0
  102. package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
  103. package/src/lib/modules/form-builder/utils/constants.ts +43 -0
  104. package/src/lib/modules/form-components/components/checkbox/_theme.scss +63 -0
  105. package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
  106. package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
  107. package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
  108. package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
  109. package/src/lib/modules/form-components/components/datepicker/_theme.scss +82 -0
  110. package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
  111. package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
  112. package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
  113. package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
  114. package/src/lib/modules/form-components/components/dropdown/_theme.scss +91 -0
  115. package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
  116. package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
  117. package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
  118. package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
  119. package/src/lib/modules/form-components/components/input/_theme.scss +77 -0
  120. package/src/lib/modules/form-components/components/input/input.component.html +51 -0
  121. package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
  122. package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
  123. package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
  124. package/src/lib/modules/form-components/components/radio/_theme.scss +61 -0
  125. package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
  126. package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
  127. package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
  128. package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
  129. package/src/lib/modules/form-components/components/search/_theme.scss +73 -0
  130. package/src/lib/modules/form-components/components/search/search.component.html +15 -0
  131. package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
  132. package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
  133. package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
  134. package/src/lib/modules/form-components/components/toggle/_theme.scss +45 -0
  135. package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
  136. package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
  137. package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
  138. package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
  139. package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
  140. package/src/lib/modules/form-components/form-components.module.ts +41 -0
  141. package/src/lib/modules/form-components/form-components.theme.scss +25 -0
  142. package/src/lib/modules/material/material.module.ts +94 -0
  143. package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
  144. package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
  145. package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
  146. package/src/lib/modules/nav/nav.models.ts +31 -0
  147. package/src/lib/modules/nav/nav.module.ts +17 -0
  148. package/src/lib/modules/nav/nav.theme.scss +86 -0
  149. package/src/lib/modules/pagination/components/pagination/pagination.component.html +52 -0
  150. package/src/lib/modules/pagination/components/pagination/pagination.component.scss +155 -0
  151. package/src/lib/modules/pagination/components/pagination/pagination.component.ts +109 -0
  152. package/src/lib/modules/pagination/pagination.module.ts +17 -0
  153. package/src/lib/modules/pagination/pagination.theme.scss +66 -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/side-nav/side-nav.theme.scss +111 -0
  160. package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1109 -0
  161. package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +1860 -0
  162. package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +2232 -0
  163. package/src/lib/modules/smart-form/components/form-section/form-section.component.html +64 -0
  164. package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
  165. package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +119 -0
  166. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
  167. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
  168. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1087 -0
  169. package/src/lib/modules/smart-form/index.ts +10 -0
  170. package/src/lib/modules/smart-form/models/form-schema.model.ts +700 -0
  171. package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +21 -0
  172. package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
  173. package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +65 -0
  174. package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
  175. package/src/lib/modules/smart-form/smart-form.module.ts +36 -0
  176. package/src/lib/modules/smart-form/smart-form.theme.scss +890 -0
  177. package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
  178. package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
  179. package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
  180. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
  181. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
  182. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1118 -0
  183. package/src/lib/modules/smart-table/models/table-config.model.ts +202 -0
  184. package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
  185. package/src/lib/modules/smart-table/smart-table.theme.scss +335 -0
  186. package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +22 -0
  187. package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
  188. package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
  189. package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
  190. package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
  191. package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
  192. package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
  193. package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
  194. package/src/lib/modules/snackbar/snackbar.theme.scss +93 -0
  195. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
  196. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
  197. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
  198. package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
  199. package/src/lib/modules/summary-card/summary-card.theme.scss +176 -0
  200. package/src/lib/shared-ui.module.ts +44 -0
  201. package/src/lib/styles/global.scss +152 -0
  202. package/src/lib/styles/utilities.scss +250 -0
  203. package/src/lib/utils/constants.ts +11 -0
  204. package/src/lib/utils/storage.utils.ts +37 -0
  205. package/src/lib/utils/string.utils.ts +23 -0
  206. package/src/lib/utils/translation.utils.ts +87 -0
  207. package/src/public-api.ts +104 -0
  208. package/tsconfig.lib.json +15 -0
@@ -0,0 +1,118 @@
1
+ # Snackbar Component
2
+
3
+ The Configurable Snackbar component (`lib-snackbar`) is a fully customizable toast-style notification module built on top of `@angular/material/snack-bar`. It supports four distinct UI variants (success, error, warning, info) and is powered by a robust SCSS CSS-variables-based theming engine matching the design system of the `nav` and `pagination` components.
4
+
5
+ ## Implementation Details
6
+
7
+ ### Module Import
8
+
9
+ To use the Snackbar, import the `SnackbarModule` into your Angular application module.
10
+
11
+ ```typescript
12
+ import { SnackbarModule } from "commons-shared-web-ui";
13
+
14
+ @NgModule({
15
+ imports: [SnackbarModule],
16
+ })
17
+ export class AppModule {}
18
+ ```
19
+
20
+ ### Displaying a Snackbar Programmatically
21
+
22
+ The `SnackbarService` is provided in root and handles the instantiation of the custom component template seamlessly. You inject the service into your component/service:
23
+
24
+ ```typescript
25
+ import { Component } from "@angular/core";
26
+ import { SnackbarService } from "commons-shared-web-ui";
27
+
28
+ @Component({
29
+ selector: "app-example",
30
+ template: `<button (click)="submitForm()">Submit</button>`,
31
+ })
32
+ export class ExampleComponent {
33
+ constructor(private snackbarService: SnackbarService) {}
34
+
35
+ submitForm() {
36
+ // Show a basic success toast
37
+ this.snackbarService.success("Form submitted successfully!");
38
+
39
+ // Show a basic error toast
40
+ this.snackbarService.error("Failed to submit form.");
41
+ }
42
+ }
43
+ ```
44
+
45
+ ### Core Service API Methods
46
+
47
+ - `success(message: string, duration?: number)`
48
+ - `error(message: string, duration?: number)`
49
+ - `warning(message: string, duration?: number)`
50
+ - `info(message: string, duration?: number)`
51
+ - `show(config: SnackbarConfig)`
52
+
53
+ The `show()` method provides advanced initialization:
54
+
55
+ ```typescript
56
+ this.snackbarService.show({
57
+ message: "Custom positioned explicit alert.",
58
+ variant: "warning",
59
+ duration: 8000,
60
+ horizontalPosition: "center",
61
+ verticalPosition: "bottom",
62
+ showCloseButton: true,
63
+ });
64
+ ```
65
+
66
+ ### Models
67
+
68
+ #### `SnackbarConfig`
69
+
70
+ | Property | Type | Default | Description |
71
+ | -------------------- | --------------------------------------------------- | ------- | ------------------------------------------------------------- |
72
+ | `message` | `string` | - | **Required.** The primary text to display in the snackbar. |
73
+ | `variant` | `'success' \| 'error' \| 'warning' \| 'info'` | `info` | The visual severity of the toast, driving icon and colors. |
74
+ | `duration` | `number` | `5000` | Auto-dismiss duration in milliseconds. |
75
+ | `horizontalPosition` | `'start' \| 'center' \| 'end' \| 'left' \| 'right'` | `right` | Standard Material horizontal anchoring. |
76
+ | `verticalPosition` | `'top' \| 'bottom'` | `top` | Standard Material vertical anchoring. |
77
+ | `showCloseButton` | `boolean` | `false` | Renders a manual "X" close button inside the toast if `true`. |
78
+
79
+ ## Customizing Theming & SCSS Overrides
80
+
81
+ The notification toasts strictly use CSS variables that can be fully overridden in your consumer application.
82
+
83
+ You can customize the styling of the snackbars globally in your application's main `styles.scss` using the exposed SCSS mixin `@include snackbar-theme(...)`.
84
+
85
+ ```scss
86
+ @use "commons-shared-web-ui/lib/modules/snackbar/snackbar.theme.scss" as
87
+ snackbar;
88
+
89
+ // Configure your application's specific branding limits
90
+ :root {
91
+ @include snackbar.snackbar-theme(
92
+ (
93
+ font-family: (
94
+ "Roboto",
95
+ sans-serif,
96
+ ),
97
+ radius: 4px,
98
+ min-width: 350px,
99
+ padding: 16px 20px,
100
+ icon-size: 24px,
101
+
102
+ // Branding Success overrides
103
+ success-bg: #e8f5e9,
104
+ success-color: #2e7d32,
105
+ success-border: #c8e6c9,
106
+ success-icon-color: #388e3c,
107
+
108
+ // Branding Error overrides
109
+ error-bg: #ffebee,
110
+ error-color: #c62828,
111
+ error-border: #ef9a9a,
112
+ error-icon-color: #d32f2f,
113
+ )
114
+ );
115
+ }
116
+ ```
117
+
118
+ If you only want to style the snackbar component exclusively within a nested layout or micro-frontend element space, simply invoke the mixin inside a constrained selector instead of `:root`.
@@ -0,0 +1,88 @@
1
+ # Style Externalization Guide
2
+
3
+ This guide describes the recommended pattern for externalizing styles in the shared UI library. This approach allows consuming applications (MFEs, Shell) to have full control over the visual appearance of components without modifying the library code.
4
+
5
+ ## The Approach: Mixin + CSS Variables
6
+
7
+ The core idea is to separate the **Theme Definition** (colors, fonts, etc.) from the **Component Implementation** (layout, structure).
8
+
9
+ 1. **Library provides a Mixin**: The shared library exports a SCSS mixin that accepts a configuration map.
10
+ 2. **Mixin generates CSS Variables**: The mixin processes the map and outputs CSS Custom Properties (Variables).
11
+ 3. **Component uses CSS Variables**: The component's SCSS file uses _only_ `var(--...)` for dynamic styles.
12
+ 4. **Consumer applies Mixin**: The parent app imports the mixin and generates the specific theme classes it needs.
13
+
14
+ ## Implementation Steps for Library Developers
15
+
16
+ ### 1. Create a `_theme.scss` file
17
+
18
+ Create a file next to your component (e.g., `my-component.theme.scss`).
19
+
20
+ ```scss
21
+ @use "sass:map";
22
+
23
+ // 1. Define Defaults
24
+ $default-config: (
25
+ primary-color: #007bff,
26
+ bg-color: #ffffff,
27
+ border-radius: 4px,
28
+ );
29
+
30
+ // 2. Create the Mixin
31
+ @mixin my-component-theme($user-config: ()) {
32
+ $config: map.merge($default-config, $user-config);
33
+
34
+ // 3. Output Variables
35
+ --cc-comp-primary: #{map.get($config, primary-color)};
36
+ --cc-comp-bg: #{map.get($config, bg-color)};
37
+ --cc-comp-radius: #{map.get($config, border-radius)};
38
+ }
39
+ ```
40
+
41
+ ### 2. Update Component SCSS
42
+
43
+ Refactor `my-component.component.scss` to use the variables.
44
+
45
+ ```scss
46
+ .my-component {
47
+ background-color: var(--cc-comp-bg);
48
+ border-radius: var(--cc-comp-radius);
49
+
50
+ .btn {
51
+ background-color: var(--cc-comp-primary);
52
+ }
53
+ }
54
+ ```
55
+
56
+ ## Usage for Application Developers
57
+
58
+ In your application's `styles.scss`:
59
+
60
+ ```scss
61
+ @use "path/to/shared-ui/my-component.theme" as myComp;
62
+
63
+ // Define a Light Theme
64
+ .light-theme-app {
65
+ @include myComp.my-component-theme(
66
+ (
67
+ primary-color: blue,
68
+ bg-color: white,
69
+ )
70
+ );
71
+ }
72
+
73
+ // Define a Dark Theme
74
+ .dark-theme-app {
75
+ @include myComp.my-component-theme(
76
+ (
77
+ primary-color: lightblue,
78
+ bg-color: #333,
79
+ )
80
+ );
81
+ }
82
+ ```
83
+
84
+ ## Benefits
85
+
86
+ - **True Decoupling**: The library has no opinion on the "Dark Mode" implementation of the parent app.
87
+ - **Responsiveness**: CSS variables are runtime-dynamic.
88
+ - **Maintenance**: Adding a new style parameter (e.g., specific padding) is as easy as adding a variable map.
@@ -0,0 +1,279 @@
1
+ # Summary Card Component Documentation
2
+
3
+ The `SummaryCardComponent` is a flexible and themeable card component for displaying key metrics and information with support for icons, images, and customizable layouts.
4
+
5
+ ## Features
6
+
7
+ - **Icon or Image Support**: Display either a Material icon or custom image
8
+ - **Flexible Description Layout**: Position description text either below the value (default) or inline (right side)
9
+ - **Fully Configurable Colors**: Customize colors for value, header, description, icon, and icon background
10
+ - **Theme Support**: Two built-in themes (theme-1: clean/minimal, theme-2: aesthetic/modern)
11
+ - **Responsive Design**: Mobile-friendly with responsive breakpoints
12
+ - **Click Interaction**: Optional click events with disabled state support
13
+ - **Theming**: Completely externalized theming support via SCSS mixins
14
+
15
+ ## Installation
16
+
17
+ To install the latest version of the `commons-shared-web-ui` library, run the following command:
18
+
19
+ ```bash
20
+ npm install commons-shared-web-ui@latest
21
+ ```
22
+
23
+ Import the `SummaryCardModule` into your feature module or `SharedModule`.
24
+
25
+ ```typescript
26
+ import { SummaryCardModule } from "@campus-cloud/shared-ui";
27
+
28
+ @NgModule({
29
+ imports: [
30
+ SummaryCardModule,
31
+ // ...
32
+ ],
33
+ })
34
+ export class MyFeatureModule {}
35
+ ```
36
+
37
+ ## Theming & Styling
38
+
39
+ The Summary Card Module uses a **Theme Externalization** pattern. It does not ship with hardcoded themes. Instead, the usage context (Parent App) **MUST** define the theme using the provided SCSS mixin.
40
+
41
+ ### 1. Import the Mixin
42
+
43
+ In your application's global styles (e.g., `styles.scss` or a dedicated theme file):
44
+
45
+ ```scss
46
+ @use "commons-shared-web-ui/src/lib/modules/summary-card/summary-card.theme"
47
+ as summary-card;
48
+ ```
49
+
50
+ ### 2. Define Your Theme
51
+
52
+ Create a class (or apply to `:root`) and include the mixin.
53
+
54
+ #### Option A: Use Defaults (No Override)
55
+
56
+ If you want the default look but still need the styles to load:
57
+
58
+ ```scss
59
+ .default-theme-summary-card {
60
+ @include summary-card.summary-card-theme();
61
+ }
62
+ ```
63
+
64
+ #### Option B: Override Specific Values
65
+
66
+ Pass only the variables you want to change.
67
+
68
+ ```scss
69
+ .my-custom-theme {
70
+ @include summary-card.summary-card-theme(
71
+ (
72
+ theme-1-bg: #ffffff,
73
+ theme-2-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1),
74
+ )
75
+ );
76
+ }
77
+ ```
78
+
79
+ ### 3. Usage in App
80
+
81
+ Apply the theme class to the wrapper of the summary card component.
82
+
83
+ ```html
84
+ <div class="default-theme-summary-card">
85
+ <lib-summary-card
86
+ [config]="cardConfig"
87
+ [theme]="'theme-1'"
88
+ ></lib-summary-card>
89
+ </div>
90
+ ```
91
+
92
+ ### Configuration Key Reference
93
+
94
+ The `summary-card-theme` mixin accepts a map with the following optional keys. Any key not provided will fall back to its default value.
95
+
96
+ | Key | Default | Description |
97
+ | ------------------ | -------------------------------------- | ---------------------------------- |
98
+ | **theme-1-border** | `1px solid #e8eaed` | Border for theme-1 cards |
99
+ | **theme-1-shadow** | `0 1px 3px rgba(0, 0, 0, 0.1)` | Shadow for theme-1 cards |
100
+ | **theme-1-bg** | `#ffffff` | Background color for theme-1 cards |
101
+ | **theme-2-border** | `none` | Border for theme-2 cards |
102
+ | **theme-2-shadow** | `0 10px 30px -10px rgba(0, 0, 0, 0.1)` | Shadow for theme-2 cards |
103
+ | **theme-2-bg** | `#ffffff` | Background color for theme-2 cards |
104
+
105
+ ### FAQ: Theme Configuration
106
+
107
+ **Q: Where should I put the theme configuration?**
108
+ A: In the `styles.scss` (or equivalent global stylesheet) of the application that is **rendering** the component.
109
+
110
+ - If used in a **Remote MFE**: Define it in the MFE's `styles.scss`.
111
+ - If used in the **Shell**: Define it in the Shell's `styles.scss`.
112
+
113
+ **Q: Do I have to import it if I don't want to override anything?**
114
+ A: **Yes**. The component relies 100% on CSS variables. If you do not include the mixin (even without arguments), variables will be undefined, and the component will look broken. Use `Option A` above to get the default look.
115
+
116
+ ---
117
+
118
+ ## API Reference
119
+
120
+ ### Inputs
121
+
122
+ | Input | Type | Default | Description |
123
+ | -------- | ------------------------ | ----------- | ------------------------- |
124
+ | `config` | `SummaryCardConfig` | required | Card configuration object |
125
+ | `theme` | `'theme-1' \| 'theme-2'` | `'theme-1'` | Theme variant |
126
+
127
+ ### Outputs
128
+
129
+ | Output | Type | Description |
130
+ | ----------- | -------------------- | ---------------------------- |
131
+ | `cardClick` | `EventEmitter<void>` | Emitted when card is clicked |
132
+
133
+ ### SummaryCardConfig Interface
134
+
135
+ | Property | Type | Default | Description |
136
+ | --------------------- | ---------------------- | ------------- | ---------------------------------------- |
137
+ | `header` | `string` | required | Header text (usually uppercase label) |
138
+ | `value` | `string` | required | Main value to display |
139
+ | `description` | `string` | optional | Additional description text |
140
+ | `icon` | `string` | optional | Material icon name (e.g., 'location_on') |
141
+ | `iconImage` | `string` | optional | URL for custom image icon |
142
+ | `descriptionPosition` | `'bottom' \| 'inline'` | `'bottom'` | Position of description text |
143
+ | `valueColor` | `string` | theme default | Custom color for value text |
144
+ | `headerColor` | `string` | theme default | Custom color for header text |
145
+ | `descriptionColor` | `string` | theme default | Custom color for description text |
146
+ | `iconColor` | `string` | theme default | Custom color for icon |
147
+ | `iconBackgroundColor` | `string` | theme default | Background color for icon container |
148
+ | `iconClass` | `string` | optional | Additional CSS classes for icon |
149
+ | `valueClass` | `string` | optional | Additional CSS classes for value |
150
+ | `headerClass` | `string` | optional | Additional CSS classes for header |
151
+ | `descriptionClass` | `string` | optional | Additional CSS classes for description |
152
+ | `isDisabled` | `boolean` | `false` | Disable click interaction |
153
+ | `isClickable` | `boolean` | `true` | Whether card is clickable |
154
+
155
+ ## Usage Examples
156
+
157
+ ### Basic Example
158
+
159
+ ```typescript
160
+ import { SummaryCardModule } from "shared-ui";
161
+
162
+ // In your component
163
+ cardConfig = {
164
+ header: "TOTAL GRANT AMOUNT",
165
+ value: "₹ 25,00,000",
166
+ description: "Across 3 campaigns",
167
+ };
168
+ ```
169
+
170
+ ```html
171
+ <lib-summary-card
172
+ [config]="cardConfig"
173
+ [theme]="'theme-1'"
174
+ (cardClick)="onCardClick()"
175
+ >
176
+ </lib-summary-card>
177
+ ```
178
+
179
+ ### With Icon
180
+
181
+ ```typescript
182
+ cardConfig = {
183
+ header: "APPROVED STATES",
184
+ value: "02",
185
+ description: "Karnataka, Maharashtra",
186
+ icon: "location_on",
187
+ iconBackgroundColor: "#fff0f0",
188
+ iconColor: "#c21e25",
189
+ };
190
+ ```
191
+
192
+ ### With Image
193
+
194
+ ```typescript
195
+ cardConfig = {
196
+ header: "TOTAL BENEFICIARIES",
197
+ value: "45,000",
198
+ description: "Target",
199
+ iconImage: "assets/icons/beneficiaries.png",
200
+ iconBackgroundColor: "#fff7e6",
201
+ iconColor: "#fa8c16",
202
+ };
203
+ ```
204
+
205
+ ### With Inline Description
206
+
207
+ ```typescript
208
+ cardConfig = {
209
+ header: "RECCE STATUS",
210
+ value: "Completed",
211
+ description: "75% Approval Rate",
212
+ descriptionPosition: "inline", // Description appears on the right side of value
213
+ valueColor: "#52c41a",
214
+ };
215
+ ```
216
+
217
+ ### With Custom Colors
218
+
219
+ ```typescript
220
+ cardConfig = {
221
+ header: "EXPECTED IMPACT",
222
+ value: "2,150",
223
+ description: "Beneficiaries found",
224
+ valueColor: "#1890ff",
225
+ headerColor: "#8c8c8c",
226
+ descriptionColor: "#595959",
227
+ };
228
+ ```
229
+
230
+ ## Themes
231
+
232
+ ### Theme 1 (Clean & Minimal)
233
+
234
+ - Clean borders and subtle shadows
235
+ - Compact padding
236
+ - Professional appearance
237
+ - Best for dashboard layouts
238
+
239
+ ### Theme 2 (Aesthetic & Modern)
240
+
241
+ - No borders, elevated shadows
242
+ - Generous padding
243
+ - Modern gradient icon backgrounds
244
+ - Best for landing pages and marketing content
245
+
246
+ ## Responsive Design
247
+
248
+ The component automatically adjusts for mobile devices:
249
+
250
+ - Icon margins reduce on smaller screens
251
+ - Font sizes scale down appropriately
252
+ - Maintains readability and touch targets
253
+
254
+ ## Accessibility
255
+
256
+ - Semantic HTML structure
257
+ - Proper color contrast ratios
258
+ - Click events respect disabled state
259
+ - Icon alt text support for images
260
+
261
+ ## Playground Example
262
+
263
+ You can use the following configuration in the UI Playground to test the component:
264
+
265
+ ```json
266
+ {
267
+ "config": {
268
+ "header": "TOTAL GRANT AMOUNT",
269
+ "value": "₹ 25,00,000",
270
+ "description": "Across 3 campaigns",
271
+ "icon": "work_outline",
272
+ "iconBackgroundColor": "#E3F2FD",
273
+ "iconColor": "#1976D2"
274
+ },
275
+ "labels": {
276
+ "iconAlt": "Grant Icon"
277
+ }
278
+ }
279
+ ```
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "./node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "./dist/commons-shared-web-ui",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ },
7
+ "assets": [
8
+ "src/lib/styles/global.scss",
9
+ "src/lib/styles/utilities.scss",
10
+ "src/lib/modules/pagination/pagination.theme.scss",
11
+ "src/lib/modules/summary-card/summary-card.theme.scss",
12
+ "src/lib/modules/button/button.theme.scss",
13
+ "src/lib/modules/alert/alert.theme.scss",
14
+ "src/lib/modules/confirmation-modal/confirmation-modal.theme.scss",
15
+ "src/lib/modules/filter-sidebar/filter-sidebar.theme.scss",
16
+ "src/lib/modules/filter/filter.theme.scss",
17
+ "src/lib/modules/nav/nav.theme.scss",
18
+ "src/lib/modules/configurable-form/configurable-form.theme.scss",
19
+ "src/lib/modules/form-components/form-components.theme.scss",
20
+ "src/lib/modules/form-components/**/_theme.scss",
21
+ "src/lib/modules/smart-table/smart-table.theme.scss",
22
+ "src/lib/modules/smart-form/smart-form.theme.scss",
23
+ "src/lib/modules/side-nav/side-nav.theme.scss",
24
+ "src/lib/modules/form-builder/form-builder.theme.scss",
25
+ "src/lib/modules/filter-table-selector/filter-table-selector.theme.scss",
26
+ "src/lib/modules/snackbar/snackbar.theme.scss"
27
+ ]
28
+ }
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "platformcommons-web-lib",
3
+ "version": "1.0.0",
4
+ "peerDependencies": {
5
+ "@angular/animations": "20.3.15",
6
+ "@angular/cdk": "20.2.14",
7
+ "@angular/common": "20.3.15",
8
+ "@angular/compiler": "20.3.15",
9
+ "@angular/core": "20.3.15",
10
+ "@angular/forms": "20.3.15",
11
+ "@angular/material": "20.2.14",
12
+ "@angular/platform-browser": "20.3.15",
13
+ "@angular/platform-browser-dynamic": "20.3.15",
14
+ "@angular/router": "20.3.15",
15
+ "rxjs": "7.8.0",
16
+ "tslib": "^2.3.0",
17
+ "zone.js": "~0.14.0 || ~0.15.0",
18
+ "ngx-quill": "^28.0.0",
19
+ "quill": "^2.0.3"
20
+ },
21
+ "dependencies": {
22
+ "tslib": "^2.3.0"
23
+ },
24
+ "devDependencies": {
25
+ "@angular-devkit/build-angular": "20.3.13",
26
+ "@angular/animations": "20.3.15",
27
+ "@angular/cdk": "20.2.14",
28
+ "@angular/cli": "20.3.13",
29
+ "@angular/common": "20.3.15",
30
+ "@angular/compiler": "20.3.15",
31
+ "@angular/compiler-cli": "20.3.15",
32
+ "@angular/core": "20.3.15",
33
+ "@angular/forms": "20.3.15",
34
+ "@angular/material": "20.2.14",
35
+ "@angular/platform-browser": "20.3.15",
36
+ "@angular/platform-browser-dynamic": "20.3.15",
37
+ "@angular/router": "20.3.15",
38
+ "@types/jasmine": "~3.10.0",
39
+ "@types/node": "^20.11.1",
40
+ "jasmine-core": "~4.0.0",
41
+ "karma": "^6.4.4",
42
+ "karma-chrome-launcher": "~3.1.0",
43
+ "karma-coverage": "~2.1.0",
44
+ "karma-jasmine": "~4.0.0",
45
+ "karma-jasmine-html-reporter": "~1.7.0",
46
+ "ng-packagr": "^20.0.0",
47
+ "rxjs": "7.8.0",
48
+ "typescript": "^5.9.3",
49
+ "zone.js": "~0.15.0"
50
+ },
51
+ "scripts": {
52
+ "build": "ng-packagr -p ng-package.json"
53
+ }
54
+ }
@@ -0,0 +1,6 @@
1
+ export type AlertVariant = 'info' | 'warning' | 'warning-shadow' | 'success' | 'error';
2
+ export type IconInput = boolean | string | { type: 'material' | 'fontawesome' | 'img'; value: string };
3
+
4
+ export interface AlertLabels {
5
+ iconAltText?: string;
6
+ }
@@ -0,0 +1,16 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { AlertComponent } from './components/alert/alert.component';
4
+
5
+ @NgModule({
6
+ declarations: [
7
+ AlertComponent
8
+ ],
9
+ imports: [
10
+ CommonModule
11
+ ],
12
+ exports: [
13
+ AlertComponent
14
+ ]
15
+ })
16
+ export class AlertModule { }
@@ -0,0 +1,85 @@
1
+ @use 'sass:map';
2
+
3
+ $default-alert-config: (
4
+ font-family: ('Roboto', sans-serif),
5
+
6
+ // Structure (Default values in rem, assuming 16px root)
7
+ padding: 1rem 2rem,
8
+ // 16px 32px
9
+ radius: 0.75rem,
10
+ // 12px
11
+ gap: 1rem,
12
+ // 16px
13
+
14
+ // Icon
15
+ icon-size: 1.25rem,
16
+ // 20px
17
+ icon-margin-top: 0.125rem,
18
+ // 2px
19
+
20
+ // Text
21
+ title-size: 1rem,
22
+ // 16px
23
+ title-line-height: 1.5rem,
24
+ // 24px
25
+ message-size: 0.875rem,
26
+ // 14px
27
+
28
+ // Info
29
+ info-bg: #F1F3F4,
30
+ info-color: #3C4043,
31
+
32
+ // Warning
33
+ warning-bg: #F9C80E1F,
34
+ warning-color: #3C4043,
35
+ // Default text color for warning usually dark
36
+ warning-title-color: #3C4043,
37
+ // Making title dark for better contrast with light yellow bg
38
+ warning-shadow: none,
39
+ // Removing shadow as per clean flat design, or keeping if specified. User said "warning-shadow" variant exists.
40
+
41
+ // Success
42
+ success-bg: #E6F4EA,
43
+ // Light green similar to Info/Error pattern
44
+ success-color: #16A34A,
45
+
46
+ // Error
47
+ error-bg: #FCE8E6,
48
+ // Light red
49
+ error-color: #D93025
50
+ );
51
+
52
+ @mixin alert-theme($user-config: ()) {
53
+ $config: map.merge($default-alert-config, $user-config);
54
+
55
+ --cc-alert-font-family: #{map.get($config, font-family)};
56
+
57
+ // Structure
58
+ --cc-alert-padding: #{map.get($config, padding)};
59
+ --cc-alert-radius: #{map.get($config, radius)};
60
+ --cc-alert-gap: #{map.get($config, gap)};
61
+
62
+ // Icon
63
+ --cc-alert-icon-size: #{map.get($config, icon-size)};
64
+ --cc-alert-icon-margin-top: #{map.get($config, icon-margin-top)};
65
+
66
+ // Text
67
+ --cc-alert-title-size: #{map.get($config, title-size)};
68
+ --cc-alert-title-line-height: #{map.get($config, title-line-height)};
69
+ --cc-alert-message-size: #{map.get($config, message-size)};
70
+
71
+ // Colors
72
+ --cc-alert-info-bg: #{map.get($config, info-bg)};
73
+ --cc-alert-info-color: #{map.get($config, info-color)};
74
+
75
+ --cc-alert-warning-bg: #{map.get($config, warning-bg)};
76
+ --cc-alert-warning-color: #{map.get($config, warning-color)};
77
+ --cc-alert-warning-title-color: #{map.get($config, warning-title-color)};
78
+ --cc-alert-warning-shadow: #{map.get($config, warning-shadow)};
79
+ --cc-alert-success-bg: #{map.get($config, success-bg)};
80
+ --cc-alert-success-color: #{map.get($config, success-color)};
81
+
82
+ --cc-alert-error-bg: #{map.get($config, error-bg)};
83
+ --cc-alert-error-color: #{map.get($config, error-color)};
84
+ --cc-alert-warning-shadow: 0 0.25rem 0.25rem rgba(0, 0, 0, 0.25); // 0px 4px 4px
85
+ }