commons-shared-web-ui 0.0.50 → 0.0.52

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 (187) hide show
  1. package/fesm2022/commons-shared-web-ui.mjs +14557 -0
  2. package/fesm2022/commons-shared-web-ui.mjs.map +1 -0
  3. package/index.d.ts +4534 -0
  4. package/package.json +34 -53
  5. package/src/lib/styles/utilities.scss +1 -0
  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 -597
  16. package/documentation/form-components.md +0 -384
  17. package/documentation/nav.md +0 -427
  18. package/documentation/pagination.md +0 -181
  19. package/documentation/side-nav-documentation.md +0 -169
  20. package/documentation/smart-form.md +0 -2405
  21. package/documentation/smart-table.md +0 -1221
  22. package/documentation/snackbar.md +0 -118
  23. package/documentation/style-externalization.md +0 -88
  24. package/documentation/summary-card.md +0 -279
  25. package/ng-package.json +0 -28
  26. package/src/lib/modules/alert/alert.models.ts +0 -6
  27. package/src/lib/modules/alert/alert.module.ts +0 -16
  28. package/src/lib/modules/alert/components/alert/alert.component.html +0 -27
  29. package/src/lib/modules/alert/components/alert/alert.component.scss +0 -92
  30. package/src/lib/modules/alert/components/alert/alert.component.ts +0 -81
  31. package/src/lib/modules/button/button.models.ts +0 -13
  32. package/src/lib/modules/button/button.module.ts +0 -16
  33. package/src/lib/modules/button/components/button/button.component.html +0 -22
  34. package/src/lib/modules/button/components/button/button.component.scss +0 -88
  35. package/src/lib/modules/button/components/button/button.component.ts +0 -67
  36. package/src/lib/modules/button-dropdown/button-dropdown.models.ts +0 -26
  37. package/src/lib/modules/button-dropdown/button-dropdown.module.ts +0 -22
  38. package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +0 -87
  39. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +0 -41
  40. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +0 -135
  41. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +0 -160
  42. package/src/lib/modules/configurable-form/component/configurable-form.component.html +0 -294
  43. package/src/lib/modules/configurable-form/component/configurable-form.component.scss +0 -503
  44. package/src/lib/modules/configurable-form/component/configurable-form.component.ts +0 -628
  45. package/src/lib/modules/configurable-form/configurable-form.examples.ts +0 -154
  46. package/src/lib/modules/configurable-form/configurable-form.model.ts +0 -131
  47. package/src/lib/modules/configurable-form/configurable-form.module.ts +0 -19
  48. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +0 -77
  49. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +0 -395
  50. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +0 -266
  51. package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +0 -71
  52. package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +0 -20
  53. package/src/lib/modules/filter/components/filter/filter.component.html +0 -131
  54. package/src/lib/modules/filter/components/filter/filter.component.scss +0 -245
  55. package/src/lib/modules/filter/components/filter/filter.component.ts +0 -216
  56. package/src/lib/modules/filter/filter.models.ts +0 -88
  57. package/src/lib/modules/filter/filter.module.ts +0 -24
  58. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +0 -112
  59. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +0 -186
  60. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +0 -163
  61. package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +0 -95
  62. package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +0 -24
  63. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +0 -73
  64. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +0 -321
  65. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +0 -361
  66. package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +0 -91
  67. package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +0 -22
  68. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +0 -63
  69. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +0 -496
  70. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +0 -445
  71. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +0 -75
  72. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +0 -210
  73. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +0 -55
  74. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +0 -25
  75. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +0 -82
  76. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +0 -95
  77. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +0 -20
  78. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +0 -37
  79. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +0 -94
  80. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +0 -46
  81. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +0 -102
  82. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +0 -50
  83. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +0 -35
  84. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +0 -67
  85. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +0 -34
  86. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +0 -68
  87. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +0 -113
  88. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +0 -74
  89. package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +0 -533
  90. package/src/lib/modules/form-builder/form-builder.module.ts +0 -36
  91. package/src/lib/modules/form-builder/index.ts +0 -9
  92. package/src/lib/modules/form-builder/models/builder.models.ts +0 -7
  93. package/src/lib/modules/form-builder/models/field-configurator.models.ts +0 -38
  94. package/src/lib/modules/form-builder/models/field-selection.models.ts +0 -51
  95. package/src/lib/modules/form-builder/services/field-configurator.service.ts +0 -258
  96. package/src/lib/modules/form-builder/services/field-selection.service.ts +0 -299
  97. package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +0 -670
  98. package/src/lib/modules/form-builder/tokens/builder.tokens.ts +0 -10
  99. package/src/lib/modules/form-builder/utils/constants.ts +0 -43
  100. package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +0 -29
  101. package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +0 -111
  102. package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +0 -207
  103. package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +0 -35
  104. package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +0 -42
  105. package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +0 -115
  106. package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +0 -267
  107. package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +0 -45
  108. package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +0 -74
  109. package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +0 -252
  110. package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +0 -377
  111. package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +0 -53
  112. package/src/lib/modules/form-components/components/input/input.component.html +0 -51
  113. package/src/lib/modules/form-components/components/input/input.component.scss +0 -128
  114. package/src/lib/modules/form-components/components/input/input.component.ts +0 -250
  115. package/src/lib/modules/form-components/components/input/input.models.ts +0 -55
  116. package/src/lib/modules/form-components/components/radio/radio.component.html +0 -22
  117. package/src/lib/modules/form-components/components/radio/radio.component.scss +0 -107
  118. package/src/lib/modules/form-components/components/radio/radio.component.ts +0 -181
  119. package/src/lib/modules/form-components/components/radio/radio.models.ts +0 -39
  120. package/src/lib/modules/form-components/components/search/search.component.html +0 -15
  121. package/src/lib/modules/form-components/components/search/search.component.scss +0 -87
  122. package/src/lib/modules/form-components/components/search/search.component.ts +0 -213
  123. package/src/lib/modules/form-components/components/search/search.models.ts +0 -40
  124. package/src/lib/modules/form-components/components/toggle/toggle.component.html +0 -15
  125. package/src/lib/modules/form-components/components/toggle/toggle.component.scss +0 -81
  126. package/src/lib/modules/form-components/components/toggle/toggle.component.ts +0 -166
  127. package/src/lib/modules/form-components/components/toggle/toggle.models.ts +0 -27
  128. package/src/lib/modules/form-components/directives/click-outside.directive.ts +0 -22
  129. package/src/lib/modules/form-components/form-components.module.ts +0 -41
  130. package/src/lib/modules/material/material.module.ts +0 -94
  131. package/src/lib/modules/nav/components/nav/nav.component.html +0 -34
  132. package/src/lib/modules/nav/components/nav/nav.component.scss +0 -171
  133. package/src/lib/modules/nav/components/nav/nav.component.ts +0 -82
  134. package/src/lib/modules/nav/nav.models.ts +0 -31
  135. package/src/lib/modules/nav/nav.module.ts +0 -17
  136. package/src/lib/modules/pagination/components/pagination/pagination.component.html +0 -52
  137. package/src/lib/modules/pagination/components/pagination/pagination.component.scss +0 -155
  138. package/src/lib/modules/pagination/components/pagination/pagination.component.ts +0 -109
  139. package/src/lib/modules/pagination/pagination.module.ts +0 -17
  140. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +0 -56
  141. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +0 -342
  142. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +0 -135
  143. package/src/lib/modules/side-nav/side-nav.models.ts +0 -38
  144. package/src/lib/modules/side-nav/side-nav.module.ts +0 -16
  145. package/src/lib/modules/smart-form/components/form-field/form-field.component.html +0 -1196
  146. package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +0 -2014
  147. package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +0 -2525
  148. package/src/lib/modules/smart-form/components/form-section/form-section.component.html +0 -65
  149. package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +0 -209
  150. package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +0 -131
  151. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +0 -253
  152. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +0 -689
  153. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +0 -1124
  154. package/src/lib/modules/smart-form/index.ts +0 -10
  155. package/src/lib/modules/smart-form/models/form-schema.model.ts +0 -733
  156. package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +0 -21
  157. package/src/lib/modules/smart-form/services/expression.service.ts +0 -75
  158. package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +0 -65
  159. package/src/lib/modules/smart-form/smart-form.examples.ts +0 -1324
  160. package/src/lib/modules/smart-form/smart-form.module.ts +0 -36
  161. package/src/lib/modules/smart-form/utils/translation.utils.ts +0 -82
  162. package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +0 -25
  163. package/src/lib/modules/smart-form/utils/validation.utils.ts +0 -98
  164. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +0 -283
  165. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +0 -685
  166. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +0 -1128
  167. package/src/lib/modules/smart-table/models/table-config.model.ts +0 -207
  168. package/src/lib/modules/smart-table/smart-table.module.ts +0 -30
  169. package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +0 -28
  170. package/src/lib/modules/smart-table/utils/smart-table.utils.ts +0 -18
  171. package/src/lib/modules/snackbar/components/snackbar.component.html +0 -41
  172. package/src/lib/modules/snackbar/components/snackbar.component.scss +0 -99
  173. package/src/lib/modules/snackbar/components/snackbar.component.ts +0 -18
  174. package/src/lib/modules/snackbar/models/snackbar.models.ts +0 -10
  175. package/src/lib/modules/snackbar/services/snackbar.service.ts +0 -40
  176. package/src/lib/modules/snackbar/snackbar.module.ts +0 -11
  177. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +0 -47
  178. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +0 -199
  179. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +0 -126
  180. package/src/lib/modules/summary-card/summary-card.module.ts +0 -18
  181. package/src/lib/shared-ui.module.ts +0 -44
  182. package/src/lib/utils/constants.ts +0 -11
  183. package/src/lib/utils/storage.utils.ts +0 -37
  184. package/src/lib/utils/string.utils.ts +0 -23
  185. package/src/lib/utils/translation.utils.ts +0 -87
  186. package/src/public-api.ts +0 -104
  187. package/tsconfig.lib.json +0 -15
@@ -1,118 +0,0 @@
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`.
@@ -1,88 +0,0 @@
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.
@@ -1,279 +0,0 @@
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
- ```
package/ng-package.json DELETED
@@ -1,28 +0,0 @@
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
- }
@@ -1,6 +0,0 @@
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
- }
@@ -1,16 +0,0 @@
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 { }
@@ -1,27 +0,0 @@
1
- <div class="cc-alert" [ngClass]="'cc-alert-' + variant" [style.width]="width" [style.height]="height"
2
- [style.border-radius]="borderRadius" [style.border-top-left-radius]="borderTopLeftRadius"
3
- [style.border-top-right-radius]="borderTopRightRadius" [style.border-bottom-left-radius]="borderBottomLeftRadius"
4
- [style.border-bottom-right-radius]="borderBottomRightRadius" [style.padding]="padding" [style.gap]="gap"
5
- [style.background-color]="backgroundColor" [style.color]="color" [style.border-color]="borderColor"
6
- [style.font-size]="fontSize" [style.font-weight]="fontWeight" [style.box-shadow]="boxShadow">
7
-
8
- <div class="cc-alert-icon" *ngIf="icon">
9
- <i *ngIf="customIcon" [ngClass]="customIcon"></i>
10
- <i *ngIf="!customIcon && isDefaultIcon" [ngClass]="defaultIconClass"></i>
11
- <i *ngIf="!customIcon && isStringIcon && !isImgIcon" [ngClass]="iconString"></i>
12
- <img *ngIf="!customIcon && isStringIcon && isImgIcon" [src]="iconString"
13
- [attr.alt]="labels?.iconAltText || 'alert icon'" />
14
- <ng-container *ngIf="isObjectIcon">
15
- <i *ngIf="iconObject.type === 'fontawesome'" [ngClass]="iconObject.value"></i>
16
- <span *ngIf="iconObject.type === 'material'" class="material-icons">{{ iconObject.value }}</span>
17
- <img *ngIf="iconObject.type === 'img'" [src]="iconObject.value"
18
- [attr.alt]="labels?.iconAltText || 'alert icon'" />
19
- </ng-container>
20
- </div>
21
-
22
- <div class="cc-alert-content">
23
- <div class="cc-alert-title" *ngIf="title">{{ title }}</div>
24
- <div class="cc-alert-message" *ngIf="message">{{ message }}</div>
25
- <ng-content></ng-content>
26
- </div>
27
- </div>
@@ -1,92 +0,0 @@
1
- .cc-alert {
2
- display: flex;
3
- align-items: flex-start;
4
- width: 100%;
5
- padding: var(--cc-alert-padding, 1rem 2rem);
6
- border-radius: var(--cc-alert-radius, 0.75rem);
7
- gap: var(--cc-alert-gap, 1rem);
8
- box-sizing: border-box;
9
- font-family: var(--cc-alert-font-family, inherit);
10
-
11
- .cc-alert-icon {
12
- font-size: var(--cc-alert-icon-size, 1.25rem);
13
- flex-shrink: 0;
14
- margin-top: var(--cc-alert-icon-margin-top, 0.125rem);
15
-
16
- img {
17
- width: var(--cc-alert-icon-size, 1.25rem);
18
- height: var(--cc-alert-icon-size, 1.25rem);
19
- object-fit: contain;
20
- }
21
- }
22
-
23
- .cc-alert-content {
24
- display: flex;
25
- flex-direction: column;
26
- gap: 0.25rem; // Keeping small internal gap as is, or could be a var
27
- flex-grow: 1;
28
-
29
- .cc-alert-title {
30
- font-weight: 700;
31
- font-size: var(--cc-alert-title-size, 1rem);
32
- line-height: var(--cc-alert-title-line-height, 1.5rem);
33
- }
34
-
35
- .cc-alert-message {
36
- font-size: var(--cc-alert-message-size, 0.875rem);
37
- line-height: 200%; // Relative unit is fine
38
- opacity: 0.9;
39
- }
40
- }
41
-
42
- // Variants
43
- &.cc-alert-info {
44
- background-color: var(--cc-alert-info-bg);
45
- color: var(--cc-alert-info-color);
46
-
47
- .cc-alert-icon {
48
- color: #5F6368;
49
- }
50
- }
51
-
52
- &.cc-alert-warning {
53
- background-color: var(--cc-alert-warning-bg);
54
- color: var(--cc-alert-warning-color);
55
-
56
- .cc-alert-title {
57
- color: var(--cc-alert-warning-title-color);
58
- }
59
-
60
- .cc-alert-icon {
61
- color: var(--cc-alert-warning-title-color);
62
- }
63
- }
64
-
65
- &.cc-alert-warning-shadow {
66
- background-color: var(--cc-alert-warning-bg);
67
- color: var(--cc-alert-warning-color);
68
- box-shadow: var(--cc-alert-warning-shadow);
69
-
70
- .cc-alert-title {
71
- color: var(--cc-alert-warning-title-color);
72
- }
73
-
74
- .cc-alert-icon {
75
- color: var(--cc-alert-warning-title-color);
76
- }
77
- }
78
-
79
- &.cc-alert-success {
80
- background-color: var(--cc-alert-success-bg);
81
- color: var(--cc-alert-success-color);
82
- }
83
-
84
- &.cc-alert-error {
85
- background-color: var(--cc-alert-error-bg);
86
- color: var(--cc-alert-error-color);
87
-
88
- .cc-alert-icon {
89
- color: var(--cc-alert-error-color);
90
- }
91
- }
92
- }