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,427 @@
1
+ # Nav Component Documentation
2
+
3
+ The `NavComponent` is a reusable, configurable navigation control that supports multiple design variants and plug-and-play theming via SCSS mixins and CSS variables.
4
+
5
+ ## Features
6
+
7
+ - **Multiple Variants**: Ships with three visual styles — `filled`, `underline`, and `pills` — switchable via a single input.
8
+ - **Configurable Items**: Accepts an array of navigation items, each with optional icon, badge count, and disabled state.
9
+ - **Active State Management**: Tracks the selected item via `activeId` and highlights it. Supports an active indicator border (e.g., a red bottom/top border).
10
+ - **Orientation**: Supports `horizontal` (default) and `vertical` layouts.
11
+ - **Theming**: Completely externalized theming support via the Style Externalization pattern.
12
+ - **Styling Overrides**: Per-instance customization via a single `styleConfig` object — no SCSS needed.
13
+ - **Responsive**: Adapts to mobile screens (scrollable horizontal nav or stacking).
14
+ - **i18n Support**: All item labels are passed from the consumer; the component renders whatever strings are provided.
15
+
16
+ ---
17
+
18
+ ## Design Variants
19
+
20
+ The component ships with three built-in visual variants. The variant is selected via the `variant` input and the visual appearance is controlled entirely by CSS variables.
21
+
22
+ ### Variant 1: `filled` (Default)
23
+
24
+ The active item has a solid background, creating a "tab" look. Best suited for primary navigation bars.
25
+
26
+ | Element | Visual |
27
+ | :--------------- | :------------------------------------------------------------------------------ |
28
+ | Container | Light background (`container-bg`), full width. |
29
+ | Inactive Item | Transparent background, default text color. |
30
+ | Active Item | Filled background (`item-active-bg`), bold/contrast text (`item-active-color`). |
31
+ | Active Indicator | Optional bottom border via `item-active-border-color`. |
32
+
33
+ **Use Case**: Top-of-page tab bars (e.g., "Open Tickets / Resolved / Audit").
34
+
35
+ ### Variant 2: `underline`
36
+
37
+ Minimal style. Active item is indicated by a bottom border line. No background fills.
38
+
39
+ | Element | Visual |
40
+ | :------------ | :---------------------------------------------------------------------- |
41
+ | Container | Transparent background with an optional bottom border. |
42
+ | Inactive Item | Default text, no background. |
43
+ | Active Item | Accent text color + a thick bottom border (`item-active-border-color`). |
44
+ | Hover | Subtle bottom border preview on hover. |
45
+
46
+ **Use Case**: Sub-section navigation, secondary tabs inside a card or panel.
47
+
48
+ ### Variant 3: `pills`
49
+
50
+ Active item gets a pill-shaped (fully rounded) background. Inactive items are plain text.
51
+
52
+ | Element | Visual |
53
+ | :------------ | :--------------------------------------------------------------- |
54
+ | Container | Transparent, typically with some gap between items. |
55
+ | Inactive Item | Default text, transparent background. |
56
+ | Active Item | Pill-shaped filled background (`item-active-bg`), contrast text. |
57
+ | Hover | Slightly tinted hover background. |
58
+
59
+ **Use Case**: Filter selectors, toggle groups, compact navigation in toolbars.
60
+
61
+ ---
62
+
63
+ ## Installation
64
+
65
+ To install the latest version of the `commons-shared-web-ui` library, run the following command:
66
+
67
+ ```bash
68
+ npm install commons-shared-web-ui@latest
69
+ ```
70
+
71
+ Import the `NavModule` into your feature module or `SharedModule`.
72
+
73
+ ```typescript
74
+ import { NavModule } from "@campus-cloud/shared-ui";
75
+
76
+ @NgModule({
77
+ imports: [
78
+ NavModule,
79
+ // ...
80
+ ],
81
+ })
82
+ export class MyFeatureModule {}
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Theming & Styling
88
+
89
+ The Nav Module uses the **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.
90
+
91
+ ### 1. Import the Mixin
92
+
93
+ In your application's global styles (e.g., `styles.scss` or a dedicated theme file):
94
+
95
+ ```scss
96
+ @use "commons-shared-web-ui/src/lib/modules/nav/nav.theme" as nav;
97
+ ```
98
+
99
+ ### 2. Define Your Theme
100
+
101
+ Create a class (or apply to `:root`) and include the mixin.
102
+
103
+ #### Option A: Use Defaults (No Override)
104
+
105
+ ```scss
106
+ .default-theme-nav {
107
+ @include nav.nav-theme();
108
+ }
109
+ ```
110
+
111
+ #### Option B: Override Specific Values
112
+
113
+ ```scss
114
+ .my-app-nav-theme {
115
+ @include nav.nav-theme(
116
+ (
117
+ item-active-bg: #1a1a2e,
118
+ item-active-color: #ffffff,
119
+ item-active-border-color: #e74c3c,
120
+ )
121
+ );
122
+ }
123
+ ```
124
+
125
+ #### Option C: Dark Theme Example
126
+
127
+ ```scss
128
+ .dark-theme-nav {
129
+ @include nav.nav-theme(
130
+ (
131
+ container-bg: #1e1e2f,
132
+ item-color: #a0a0b0,
133
+ item-active-bg: #2a2a3d,
134
+ item-active-color: #ffffff,
135
+ item-active-border-color: #ff4081,
136
+ item-hover-bg: #25253a,
137
+ )
138
+ );
139
+ }
140
+ ```
141
+
142
+ ### 3. Usage in App
143
+
144
+ Apply the theme class to the wrapper of the nav component.
145
+
146
+ ```html
147
+ <div class="my-app-nav-theme">
148
+ <lib-nav
149
+ [items]="navItems"
150
+ [activeId]="currentTab"
151
+ variant="filled"
152
+ (selectionChange)="onTabChange($event)"
153
+ >
154
+ </lib-nav>
155
+ </div>
156
+ ```
157
+
158
+ ### Configuration Key Reference
159
+
160
+ The `nav-theme` mixin accepts a map with the following optional keys. Any key not provided will fall back to its default value.
161
+
162
+ #### Container
163
+
164
+ | Key | Default | Description |
165
+ | --------------------- | --------- | ------------------------------------------------- |
166
+ | **container-bg** | `#f5f5f5` | Background color of the nav bar container. |
167
+ | **container-padding** | `4px` | Internal padding of the container. |
168
+ | **container-radius** | `6px` | Border radius of the container. |
169
+ | **container-border** | `none` | Border of the container (e.g., `1px solid #ddd`). |
170
+ | **container-gap** | `4px` | Gap between nav items. |
171
+
172
+ #### Item (Default State)
173
+
174
+ | Key | Default | Description |
175
+ | ---------------- | ---------------------- | -------------------------------------- |
176
+ | **font-family** | `'Roboto', sans-serif` | Font stack for item text. |
177
+ | **font-size** | `14px` | Font size for item text. |
178
+ | **font-weight** | `500` | Font weight for item text. |
179
+ | **item-color** | `#666666` | Default text color for inactive items. |
180
+ | **item-bg** | `transparent` | Background color for inactive items. |
181
+ | **item-padding** | `8px 16px` | Padding inside each item. |
182
+ | **item-radius** | `4px` | Border radius of each item. |
183
+ | **item-border** | `none` | Border for inactive items. |
184
+
185
+ #### Item (Active State)
186
+
187
+ | Key | Default | Description |
188
+ | ---------------------------- | --------------------------- | ---------------------------------------------------- |
189
+ | **item-active-bg** | `#ffffff` | Background of the active item. |
190
+ | **item-active-color** | `#1a1a1a` | Text color of the active item. |
191
+ | **item-active-font-weight** | `600` | Font weight of the active item. |
192
+ | **item-active-border-color** | `transparent` | Bottom or top border color for the active indicator. |
193
+ | **item-active-border-width** | `2px` | Thickness of the active indicator border. |
194
+ | **item-active-shadow** | `0 1px 3px rgba(0,0,0,0.1)` | Box shadow on the active item. |
195
+
196
+ #### Item (Hover State)
197
+
198
+ | Key | Default | Description |
199
+ | -------------------- | --------- | -------------------------- |
200
+ | **item-hover-bg** | `#eeeeee` | Background color on hover. |
201
+ | **item-hover-color** | `#333333` | Text color on hover. |
202
+
203
+ #### Item (Disabled State)
204
+
205
+ | Key | Default | Description |
206
+ | -------------------- | ------- | -------------------------- |
207
+ | **disabled-opacity** | `0.5` | Opacity of disabled items. |
208
+
209
+ #### Badge
210
+
211
+ | Key | Default | Description |
212
+ | ------------------- | --------- | ------------------------------------- |
213
+ | **badge-bg** | `#e74c3c` | Background color of the badge circle. |
214
+ | **badge-color** | `#ffffff` | Text color inside the badge. |
215
+ | **badge-size** | `18px` | Size (width/height) of the badge. |
216
+ | **badge-font-size** | `10px` | Font size of the badge text. |
217
+
218
+ ### FAQ: Theme Configuration
219
+
220
+ **Q: Where should I put the theme configuration?**
221
+ A: In the `styles.scss` (or equivalent global stylesheet) of the application that is **rendering** the component.
222
+
223
+ - If used in a **Remote MFE**: Define it in the MFE's `styles.scss`.
224
+ - If used in the **Shell**: Define it in the Shell's `styles.scss`.
225
+
226
+ **Q: Do I have to import it if I don't want to override anything?**
227
+ A: **Yes**. The component relies 100% on CSS variables. If you do not include the mixin (even without arguments), variables like `--cc-nav-container-bg` will be undefined, and the component will look broken (transparent, unstyled). Use `Option A` above to get the default look.
228
+
229
+ **Q: How do I get the "red border" active indicator?**
230
+ A: Override `item-active-border-color` in your theme configuration:
231
+
232
+ ```scss
233
+ .my-theme {
234
+ @include nav.nav-theme(
235
+ (
236
+ item-active-border-color: #e74c3c,
237
+ )
238
+ );
239
+ }
240
+ ```
241
+
242
+ **Q: Theme vs `styleConfig` — when to use which?**
243
+ A: Use the **Theme Mixin** (SCSS) when you want a consistent brand look across all `<lib-nav>` instances. Use **`styleConfig`** when you need a one-off customization for a specific instance.
244
+
245
+ ---
246
+
247
+ ## Responsive Design
248
+
249
+ The component is built with Flexbox and includes a mobile breakpoint at `600px`.
250
+
251
+ - **Desktop (horizontal)**: Items are laid out in a row. Overflow scrolls if items exceed container width.
252
+ - **Mobile (horizontal)**: Items become scrollable (horizontal scroll with hidden scrollbar) for touch-friendly navigation.
253
+ - **Vertical orientation**: Items stack top-to-bottom. No responsive change needed since it already stacks.
254
+
255
+ ---
256
+
257
+ ## API Reference
258
+
259
+ ### Inputs
260
+
261
+ | Input | Type | Default | Description |
262
+ | ------------- | ------------------------------------ | -------------- | ------------------------------------------------------ |
263
+ | `items` | `NavItem[]` | `[]` | Array of navigation items to display. |
264
+ | `activeId` | `string \| number \| null` | `null` | The `id` of the currently active item. |
265
+ | `variant` | `'filled' \| 'underline' \| 'pills'` | `'filled'` | Visual style of the navigation. |
266
+ | `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Layout direction. |
267
+ | `styleConfig` | `NavStyleConfig` | `{}` | Object for per-instance styling overrides (see below). |
268
+
269
+ ### Styling Overrides via `styleConfig`
270
+
271
+ All styling overrides are bundled into a single `NavStyleConfig` object. Import it from the library:
272
+
273
+ ```typescript
274
+ import { NavStyleConfig } from "@campus-cloud/shared-ui";
275
+ ```
276
+
277
+ #### `NavStyleConfig` Interface
278
+
279
+ ```typescript
280
+ export interface NavStyleConfig {
281
+ // Container
282
+ width?: string;
283
+ backgroundColor?: string;
284
+ borderRadius?: string;
285
+ border?: string;
286
+ padding?: string;
287
+ gap?: string;
288
+ boxShadow?: string;
289
+
290
+ // Item
291
+ itemColor?: string;
292
+ itemRadius?: string;
293
+ itemPadding?: string;
294
+ fontSize?: string;
295
+ fontWeight?: string;
296
+
297
+ // Active Item
298
+ activeItemBg?: string;
299
+ activeItemColor?: string;
300
+ activeItemFontWeight?: string;
301
+ activeItemBorderColor?: string;
302
+
303
+ // Hover Item
304
+ hoverItemBg?: string;
305
+ hoverItemColor?: string;
306
+
307
+ // Badge
308
+ badgeBg?: string;
309
+ badgeColor?: string;
310
+ }
311
+ ```
312
+
313
+ #### Property Reference
314
+
315
+ | Property | Maps to CSS Variable / Style | Description |
316
+ | ----------------------- | ----------------------------------- | ------------------------------ |
317
+ | `width` | `style.width` | Container width. |
318
+ | `backgroundColor` | `--cc-nav-container-bg` | Container background. |
319
+ | `borderRadius` | `--cc-nav-container-radius` | Container border radius. |
320
+ | `border` | `--cc-nav-container-border` | Container border. |
321
+ | `padding` | `--cc-nav-container-padding` | Container padding. |
322
+ | `gap` | `--cc-nav-container-gap` | Gap between items. |
323
+ | `boxShadow` | `style.box-shadow` | Container box shadow. |
324
+ | `itemColor` | `--cc-nav-item-color` | Inactive item text color. |
325
+ | `itemRadius` | `--cc-nav-item-radius` | Item border radius. |
326
+ | `itemPadding` | `--cc-nav-item-padding` | Item padding. |
327
+ | `fontSize` | `--cc-nav-font-size` | Item font size. |
328
+ | `fontWeight` | `--cc-nav-font-weight` | Item font weight. |
329
+ | `activeItemBg` | `--cc-nav-item-active-bg` | Active item background. |
330
+ | `activeItemColor` | `--cc-nav-item-active-color` | Active item text color. |
331
+ | `activeItemFontWeight` | `--cc-nav-item-active-font-weight` | Active item font weight. |
332
+ | `activeItemBorderColor` | `--cc-nav-item-active-border-color` | Active indicator border color. |
333
+ | `hoverItemBg` | `--cc-nav-item-hover-bg` | Hover background color. |
334
+ | `hoverItemColor` | `--cc-nav-item-hover-color` | Hover text color. |
335
+ | `badgeBg` | `--cc-nav-badge-bg` | Badge background color. |
336
+ | `badgeColor` | `--cc-nav-badge-color` | Badge text color. |
337
+
338
+ ### NavItem Interface
339
+
340
+ ```typescript
341
+ export interface NavItem {
342
+ id: string | number; // Unique identifier for the item.
343
+ label: string; // Display text (supports i18n — pass translated strings).
344
+ icon?: string; // Optional icon class (e.g., 'home', 'settings').
345
+ badge?: string | number; // Optional badge value (e.g., count of unread items).
346
+ disabled?: boolean; // If true, the item is non-clickable and visually dimmed.
347
+ }
348
+ ```
349
+
350
+ ### Usage Examples
351
+
352
+ #### Basic Usage (with theme class)
353
+
354
+ ```html
355
+ <div class="my-app-nav-theme">
356
+ <lib-nav
357
+ [items]="navItems"
358
+ [activeId]="currentTab"
359
+ variant="filled"
360
+ (selectionChange)="onTabChange($event)"
361
+ >
362
+ </lib-nav>
363
+ </div>
364
+ ```
365
+
366
+ #### With `styleConfig` Overrides
367
+
368
+ ```typescript
369
+ // component.ts
370
+ import { NavItem, NavStyleConfig } from '@campus-cloud/shared-ui';
371
+
372
+ navItems: NavItem[] = [
373
+ { id: 'open', label: 'Open Tickets' },
374
+ { id: 'resolved', label: 'Resolved' },
375
+ { id: 'audit', label: 'Audit', badge: 3 },
376
+ ];
377
+
378
+ currentTab = 'open';
379
+
380
+ navStyle: NavStyleConfig = {
381
+ backgroundColor: '#ffffff',
382
+ borderRadius: '8px',
383
+ gap: '1rem',
384
+ padding: '0.5rem 1rem',
385
+ itemColor: '#666',
386
+ activeItemColor: '#d32f2f',
387
+ activeItemBorderColor: '#d32f2f',
388
+ };
389
+
390
+ onTabChange(item: NavItem): void {
391
+ this.currentTab = item.id;
392
+ }
393
+ ```
394
+
395
+ ```html
396
+ <!-- template.html -->
397
+ <lib-nav
398
+ [items]="navItems"
399
+ [activeId]="currentTab"
400
+ variant="underline"
401
+ [styleConfig]="navStyle"
402
+ (selectionChange)="onTabChange($event)"
403
+ >
404
+ </lib-nav>
405
+ ```
406
+
407
+ ### Outputs
408
+
409
+ | Output | Type | Description |
410
+ | ----------------- | ----------------------- | ------------------------------------------------------------------------------------------- |
411
+ | `selectionChange` | `EventEmitter<NavItem>` | Emitted when the user clicks a non-disabled item. Payload is the selected `NavItem` object. |
412
+
413
+ ---
414
+
415
+ ## File Structure
416
+
417
+ ```
418
+ src/lib/modules/nav/
419
+ ├── nav.module.ts
420
+ ├── nav.models.ts ← NavStyleConfig interface
421
+ ├── nav.theme.scss
422
+ └── components/
423
+ └── nav/
424
+ ├── nav.component.ts
425
+ ├── nav.component.html
426
+ └── nav.component.scss
427
+ ```
@@ -0,0 +1,181 @@
1
+ # Pagination Component Documentation
2
+
3
+ The `PaginationComponent` is a reusable, dynamic pagination control that supports plug-and-play theming via SCSS mixins and CSS variables.
4
+
5
+ ## Features
6
+
7
+ - **Dynamic Paging**: Automatically calculates pages based on `totalItems` and `itemsPerPage`.
8
+ - **Configurable Items Per Page**: Dropdown to select page size. Automatically hides if only one option is provided.
9
+ - **Theming**: Completely externalized theming support.
10
+ - **Responsive**: Adapts to mobile screens (wraps and stacks controls).
11
+ - **i18n Support**: Configurable labels for "items", "of", and "Per Page".
12
+
13
+ ## Installation
14
+
15
+ To install the latest version of the `commons-shared-web-ui` library, run the following command:
16
+
17
+ ```bash
18
+ npm install commons-shared-web-ui@latest
19
+ ```
20
+
21
+ Import the `PaginationModule` into your feature module or `SharedModule`.
22
+
23
+ ```typescript
24
+ import { PaginationModule } from "@campus-cloud/shared-ui";
25
+ // Adjust path based on your library structure
26
+
27
+ @NgModule({
28
+ imports: [
29
+ PaginationModule,
30
+ // ...
31
+ ],
32
+ })
33
+ export class MyFeatureModule {}
34
+ ```
35
+
36
+ ## Theming & Styling
37
+
38
+ The Pagination 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.
39
+
40
+ ### 1. Import the Mixin
41
+
42
+ In your application's global styles (e.g., `styles.scss` or a dedicated theme file):
43
+
44
+ ```scss
45
+ @use "commons-shared-web-ui/src/lib/modules/pagination/pagination.theme" as
46
+ pagination;
47
+ ```
48
+
49
+ ### 2. Define Your Theme
50
+
51
+ Create a class (or apply to `:root`) and include the mixin.
52
+
53
+ #### Option A: Use Defaults (No Override)
54
+
55
+ If you want the default look but still need the styles to load:
56
+
57
+ ```scss
58
+ .default-theme-pagination {
59
+ @include pagination.pagination-theme();
60
+ }
61
+ ```
62
+
63
+ #### Option B: Override Specific Values
64
+
65
+ Pass only the variables you want to change.
66
+
67
+ ```scss
68
+ .my-custom-theme {
69
+ @include pagination.pagination-theme(
70
+ (
71
+ text-color: #333333,
72
+ btn-active-bg: purple,
73
+ )
74
+ );
75
+ }
76
+ ```
77
+
78
+ ### 3. Usage in App
79
+
80
+ Apply the theme class to the wrapper of the pagination component.
81
+
82
+ ```html
83
+ <div class="default-theme-pagination">
84
+ <lib-pagination ...></lib-pagination>
85
+ </div>
86
+ ```
87
+
88
+ ### Configuration Key Reference
89
+
90
+ The `pagination-theme` mixin accepts a map with the following optional keys. Any key not provided will fall back to its default value.
91
+
92
+ | Key | Default | Description |
93
+ | ---------------------- | ---------------------- | -------------------------------------------------- |
94
+ | **font-family** | `'Roboto', sans-serif` | Font stack for the component. |
95
+ | **text-color** | `#757575` | Primary text color. |
96
+ | **font-size** | `14px` | Base font size. |
97
+ | **select-bg** | `#f5f5f5` | Background color of the "Items per page" dropdown. |
98
+ | **select-border** | `none` | Border of the dropdown. |
99
+ | **select-radius** | `4px` | Border radius of the dropdown. |
100
+ | **select-padding** | `6px 12px` | Padding inside the dropdown. |
101
+ | **select-text-color** | `#333` | Text color inside the dropdown. |
102
+ | **select-arrow-color** | `#f44336` | Color of the dropdown arrow icon. |
103
+ | **btn-size** | `32px` | Width and height of pagination buttons. |
104
+ | **btn-bg** | `#ffffff` | Background color of buttons. |
105
+ | **btn-border** | `1px solid #e0e0e0` | Border of buttons. |
106
+ | **btn-radius** | `4px` | Border radius of buttons. |
107
+ | **btn-text-color** | `#333` | Text color of buttons. |
108
+ | **btn-hover-bg** | `#f5f5f5` | Background color on hover. |
109
+ | **btn-active-bg** | `#ffffff` | Background color of the active page button. |
110
+ | **btn-active-border** | `1px solid #ff4081` | Border color of the active page button. |
111
+ | **btn-active-text** | `#ff4081` | Text color of the active page button. |
112
+ | **disabled-opacity** | `0.5` | Opacity of disabled buttons (First/Last). |
113
+ | **disabled-bg** | `#f9f9f9` | Background color of disabled buttons. |
114
+
115
+ ### FAQ: Theme Configuration
116
+
117
+ **Q: Where should I put the theme configuration?**
118
+ A: In the `styles.scss` (or equivalent global stylesheet) of the application that is **rendering** the component.
119
+
120
+ - If used in a **Remote MFE**: Define it in the MFE's `styles.scss`.
121
+ - If used in the **Shell**: Define it in the Shell's `styles.scss`.
122
+
123
+ **Q: Do I have to import it if I don't want to override anything?**
124
+ A: **Yes**. The component relies 100% on CSS variables. If you do not include the mixin (even without arguments), variables like `--cc-pagination-bg` will be undefined, and the component will look broken (transparent, unstyled). Use `Option A` above to get the default look.
125
+
126
+ ---
127
+
128
+ ## Responsive Design
129
+
130
+ The component is built with Flexbox and includes a mobile breakpoint at `600px`.
131
+
132
+ - On desktop, controls and page information are spread apart.
133
+ - On mobile, they stack vertically for better touch accessibility.
134
+
135
+ ## API Reference
136
+
137
+ ### Inputs
138
+
139
+ | Input | Type | Default | Description |
140
+ | ----------------- | ------------------ | -------------- | --------------------------------------------- |
141
+ | `totalItems` | `number` | `0` | Total number of items to paginate. |
142
+ | `itemsPerPage` | `number` | `10` | Number of items to show per page. |
143
+ | `currentPage` | `number` | `1` | The current active page (1-based index). |
144
+ | `pageSizeOptions` | `number[]` | `[10, 20, 50]` | Options available in the "Per Page" dropdown. |
145
+ | `labels` | `PaginationLabels` | `{...}` | (Optional) i18n labels. See details below. |
146
+
147
+ ### Internationalization (Labels)
148
+
149
+ To support multiple languages, you can pass a `labels` object to the component.
150
+
151
+ **Interface:**
152
+
153
+ ```typescript
154
+ interface PaginationLabels {
155
+ items: string; // e.g., 'items'
156
+ of: string; // e.g., 'of'
157
+ perPage: string; // e.g., 'Per Page'
158
+ }
159
+ ```
160
+
161
+ **Usage Example:**
162
+
163
+ ```typescript
164
+ // in your component.ts
165
+ myLabels = {
166
+ items: "éléments",
167
+ of: "de",
168
+ perPage: "par page",
169
+ };
170
+ ```
171
+
172
+ ```html
173
+ <lib-pagination [labels]="myLabels" ...> </lib-pagination>
174
+ ```
175
+
176
+ ### Outputs
177
+
178
+ | Output | Type | Description |
179
+ | -------------------- | ---------------------- | --------------------------------------------------------------------------- |
180
+ | `pageChange` | `EventEmitter<number>` | Emitted when the page number changes. Value is the new page number. |
181
+ | `itemsPerPageChange` | `EventEmitter<number>` | Emitted when the user selects a different page size. Value is the new size. |