commons-shared-web-ui 0.0.54 → 0.0.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/.claude/settings.local.json +10 -0
  2. package/documentation/alert.md +123 -0
  3. package/documentation/button-dropdown.md +126 -0
  4. package/documentation/button.md +184 -0
  5. package/documentation/cards-usage-guidelines.md +131 -0
  6. package/documentation/configurable-form.md +605 -0
  7. package/documentation/confirmation-modal.md +250 -0
  8. package/documentation/filter-sidebar.md +178 -0
  9. package/documentation/filter-table-selector.md +228 -0
  10. package/documentation/form-builder.md +599 -0
  11. package/documentation/form-components.md +384 -0
  12. package/documentation/form-field-configuration.md +250 -0
  13. package/documentation/nav.md +427 -0
  14. package/documentation/pagination.md +181 -0
  15. package/documentation/side-nav-documentation.md +169 -0
  16. package/documentation/smart-form.md +2765 -0
  17. package/documentation/smart-table.md +1221 -0
  18. package/documentation/snackbar.md +118 -0
  19. package/documentation/style-externalization.md +88 -0
  20. package/documentation/summary-card.md +279 -0
  21. package/documentation/table-column-configuration.md +221 -0
  22. package/documentation/time-picker.md +274 -0
  23. package/ng-package.json +30 -0
  24. package/package.json +53 -34
  25. package/src/lib/modules/alert/alert.models.ts +6 -0
  26. package/src/lib/modules/alert/alert.module.ts +16 -0
  27. package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
  28. package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
  29. package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
  30. package/src/lib/modules/button/button.models.ts +13 -0
  31. package/src/lib/modules/button/button.module.ts +16 -0
  32. package/src/lib/modules/button/components/button/button.component.html +22 -0
  33. package/src/lib/modules/button/components/button/button.component.scss +88 -0
  34. package/src/lib/modules/button/components/button/button.component.ts +67 -0
  35. package/src/lib/modules/button-dropdown/button-dropdown.models.ts +26 -0
  36. package/src/lib/modules/button-dropdown/button-dropdown.module.ts +22 -0
  37. package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +87 -0
  38. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +41 -0
  39. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +135 -0
  40. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +160 -0
  41. package/src/lib/modules/configurable-form/component/configurable-form.component.html +294 -0
  42. package/src/lib/modules/configurable-form/component/configurable-form.component.scss +503 -0
  43. package/src/lib/modules/configurable-form/component/configurable-form.component.ts +628 -0
  44. package/src/lib/modules/configurable-form/configurable-form.examples.ts +154 -0
  45. package/src/lib/modules/configurable-form/configurable-form.model.ts +131 -0
  46. package/src/lib/modules/configurable-form/configurable-form.module.ts +19 -0
  47. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +77 -0
  48. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +395 -0
  49. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +266 -0
  50. package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +71 -0
  51. package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +20 -0
  52. package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
  53. package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
  54. package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
  55. package/src/lib/modules/filter/filter.models.ts +88 -0
  56. package/src/lib/modules/filter/filter.module.ts +24 -0
  57. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
  58. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
  59. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
  60. package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
  61. package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
  62. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
  63. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
  64. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
  65. package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
  66. package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
  67. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
  68. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
  69. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
  70. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
  71. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
  72. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
  73. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
  74. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
  75. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
  76. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
  77. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
  78. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
  79. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
  80. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
  81. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
  82. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
  83. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
  84. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
  85. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
  86. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
  87. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
  88. package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
  89. package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
  90. package/src/lib/modules/form-builder/index.ts +9 -0
  91. package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
  92. package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
  93. package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
  94. package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
  95. package/src/lib/modules/form-builder/services/field-selection.service.ts +299 -0
  96. package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +670 -0
  97. package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
  98. package/src/lib/modules/form-builder/utils/constants.ts +43 -0
  99. package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
  100. package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
  101. package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
  102. package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
  103. package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
  104. package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
  105. package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
  106. package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
  107. package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
  108. package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
  109. package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
  110. package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
  111. package/src/lib/modules/form-components/components/input/input.component.html +51 -0
  112. package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
  113. package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
  114. package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
  115. package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
  116. package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
  117. package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
  118. package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
  119. package/src/lib/modules/form-components/components/search/search.component.html +15 -0
  120. package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
  121. package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
  122. package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
  123. package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
  124. package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
  125. package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
  126. package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
  127. package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
  128. package/src/lib/modules/form-components/form-components.module.ts +42 -0
  129. package/src/lib/modules/form-field-configuration/components/_ffc-controls.scss +89 -0
  130. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.html +68 -0
  131. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.scss +73 -0
  132. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.ts +34 -0
  133. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.html +78 -0
  134. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.scss +83 -0
  135. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.ts +94 -0
  136. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.html +38 -0
  137. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.scss +42 -0
  138. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.ts +92 -0
  139. package/src/lib/modules/form-field-configuration/form-field-configuration.module.ts +23 -0
  140. package/src/lib/modules/form-field-configuration/index.ts +7 -0
  141. package/src/lib/modules/form-field-configuration/models/field-configuration.models.ts +62 -0
  142. package/src/lib/modules/form-field-configuration/services/config-schema-tree.service.ts +159 -0
  143. package/src/lib/modules/form-field-configuration/services/field-configuration.service.ts +228 -0
  144. package/src/lib/modules/material/material.module.ts +94 -0
  145. package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
  146. package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
  147. package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
  148. package/src/lib/modules/nav/nav.models.ts +31 -0
  149. package/src/lib/modules/nav/nav.module.ts +17 -0
  150. package/src/lib/modules/pagination/components/pagination/pagination.component.html +52 -0
  151. package/src/lib/modules/pagination/components/pagination/pagination.component.scss +155 -0
  152. package/src/lib/modules/pagination/components/pagination/pagination.component.ts +109 -0
  153. package/src/lib/modules/pagination/pagination.module.ts +17 -0
  154. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +56 -0
  155. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +342 -0
  156. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +135 -0
  157. package/src/lib/modules/side-nav/side-nav.models.ts +38 -0
  158. package/src/lib/modules/side-nav/side-nav.module.ts +16 -0
  159. package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1330 -0
  160. package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +2112 -0
  161. package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +3006 -0
  162. package/src/lib/modules/smart-form/components/form-section/form-section.component.html +65 -0
  163. package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
  164. package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +131 -0
  165. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
  166. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
  167. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1131 -0
  168. package/src/lib/modules/smart-form/index.ts +10 -0
  169. package/src/lib/modules/smart-form/models/form-schema.model.ts +793 -0
  170. package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +21 -0
  171. package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
  172. package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +67 -0
  173. package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
  174. package/src/lib/modules/smart-form/smart-form.module.ts +38 -0
  175. package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
  176. package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
  177. package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
  178. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
  179. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
  180. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1128 -0
  181. package/src/lib/modules/smart-table/models/table-config.model.ts +213 -0
  182. package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
  183. package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +28 -0
  184. package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
  185. package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
  186. package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
  187. package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
  188. package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
  189. package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
  190. package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
  191. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
  192. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
  193. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
  194. package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
  195. package/src/lib/modules/table-column-configuration/components/_tcc-controls.scss +53 -0
  196. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.html +47 -0
  197. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.scss +50 -0
  198. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.ts +33 -0
  199. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.html +30 -0
  200. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.scss +36 -0
  201. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.ts +78 -0
  202. package/src/lib/modules/table-column-configuration/index.ts +5 -0
  203. package/src/lib/modules/table-column-configuration/models/table-column-configuration.models.ts +20 -0
  204. package/src/lib/modules/table-column-configuration/services/table-column-configuration.service.ts +77 -0
  205. package/src/lib/modules/table-column-configuration/table-column-configuration.module.ts +21 -0
  206. package/src/lib/modules/time-picker/components/time-picker/time-picker.component.html +37 -0
  207. package/src/lib/modules/time-picker/components/time-picker/time-picker.component.scss +102 -0
  208. package/src/lib/modules/time-picker/components/time-picker/time-picker.component.ts +178 -0
  209. package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.html +78 -0
  210. package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.scss +226 -0
  211. package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.ts +595 -0
  212. package/src/lib/modules/time-picker/models/time-picker.models.ts +49 -0
  213. package/src/lib/modules/time-picker/time-picker.module.ts +23 -0
  214. package/src/lib/modules/time-picker/time-picker.theme.scss +87 -0
  215. package/src/lib/shared-ui.module.ts +55 -0
  216. package/src/lib/styles/global.scss +10 -0
  217. package/src/lib/utils/constants.ts +11 -0
  218. package/src/lib/utils/storage.utils.ts +37 -0
  219. package/src/lib/utils/string.utils.ts +23 -0
  220. package/src/lib/utils/translation.utils.ts +87 -0
  221. package/src/public-api.ts +127 -0
  222. package/tsconfig.lib.json +15 -0
  223. package/fesm2022/commons-shared-web-ui.mjs +0 -14823
  224. package/fesm2022/commons-shared-web-ui.mjs.map +0 -1
  225. package/index.d.ts +0 -4679
@@ -0,0 +1,20 @@
1
+ import { TableColumn } from '../../smart-table/models/table-config.model';
2
+
3
+ /**
4
+ * A single editable column row in the column configurator.
5
+ * Wraps a TableColumn with its visibility + lock state.
6
+ *
7
+ * `column` is a live reference into the module's working (cloned) config, so
8
+ * writing the node state back onto it is all that's needed to produce the
9
+ * updated config — no fragile index re-matching required.
10
+ */
11
+ export interface ConfigColumnNode {
12
+ /** Live reference to the TableColumn inside the working config clone. */
13
+ column: TableColumn;
14
+ /** Raw label (i18n key or text); resolved through the optional translate fn at render time. */
15
+ label: string;
16
+ /** Whether the column is shown in the table. */
17
+ visible: boolean;
18
+ /** When true, the visibility toggle is locked ON (column can never be hidden). */
19
+ lockVisibility: boolean;
20
+ }
@@ -0,0 +1,77 @@
1
+ import { Injectable, computed, signal } from '@angular/core';
2
+ import { TableColumn, TableConfig } from '../../smart-table/models/table-config.model';
3
+ import { ConfigColumnNode } from '../models/table-column-configuration.models';
4
+
5
+ interface TableColumnConfigurationState {
6
+ columns: ConfigColumnNode[];
7
+ /** Deep clone of the input config; node references point into this object. */
8
+ workingConfig: TableConfig | null;
9
+ }
10
+
11
+ /**
12
+ * Signal-based store for the table-column-configuration component.
13
+ * Owns the column list and the visibility toggle logic.
14
+ * Provided at the component level (one store instance per configurator).
15
+ */
16
+ @Injectable()
17
+ export class TableColumnConfigurationService {
18
+ private readonly _state = signal<TableColumnConfigurationState>({
19
+ columns: [],
20
+ workingConfig: null,
21
+ });
22
+
23
+ readonly columns = computed(() => this._state().columns);
24
+
25
+ // ── Load ──────────────────────────────────────────────────────────────────
26
+
27
+ /**
28
+ * Initialise from an input table config. The config is deep-cloned so the
29
+ * caller's object is never mutated; the nodes reference the clone.
30
+ */
31
+ loadConfig(config: TableConfig): void {
32
+ const workingConfig: TableConfig = JSON.parse(JSON.stringify(config));
33
+ const columns = (workingConfig.columns ?? []).map(col => this._buildColumn(col));
34
+ this._state.set({ columns, workingConfig });
35
+ }
36
+
37
+ // ── Mutations ─────────────────────────────────────────────────────────────
38
+
39
+ /** Toggle a column's visibility. Locked columns are ignored. */
40
+ toggleColumnVisible(index: number): void {
41
+ this._state.update(state => ({
42
+ ...state,
43
+ columns: state.columns.map((c, i) =>
44
+ i === index && !c.lockVisibility ? { ...c, visible: !c.visible } : c,
45
+ ),
46
+ }));
47
+ }
48
+
49
+ // ── Output ────────────────────────────────────────────────────────────────
50
+
51
+ /**
52
+ * Produce the updated config. Writes the current node state onto the working
53
+ * clone and returns a fresh deep clone (safe to hand to the host / persist).
54
+ * Returns null if no config has been loaded.
55
+ */
56
+ buildUpdatedConfig(): TableConfig | null {
57
+ const { columns, workingConfig } = this._state();
58
+ if (!workingConfig) return null;
59
+ for (const node of columns) {
60
+ node.column.isEnabled = node.visible;
61
+ node.column.visible = node.visible; // backward compatibility
62
+ }
63
+ return JSON.parse(JSON.stringify(workingConfig));
64
+ }
65
+
66
+ // ── Private helpers ─────────────────────────────────────────────────────────
67
+
68
+ private _buildColumn(column: TableColumn): ConfigColumnNode {
69
+ const visible = column.isEnabled ?? column.visible ?? true;
70
+ return {
71
+ column,
72
+ label: column.label || column.key || 'Column',
73
+ visible,
74
+ lockVisibility: column.lockVisibility === true,
75
+ };
76
+ }
77
+ }
@@ -0,0 +1,21 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+ import { TableColumnConfigurationComponent } from './components/table-column-configuration/table-column-configuration.component';
5
+ import { ConfigColumnNodeComponent } from './components/config-column-node/config-column-node.component';
6
+
7
+ const COMPONENTS = [
8
+ TableColumnConfigurationComponent,
9
+ ConfigColumnNodeComponent,
10
+ ];
11
+
12
+ @NgModule({
13
+ declarations: [...COMPONENTS],
14
+ imports: [
15
+ CommonModule,
16
+ ],
17
+ exports: [
18
+ TableColumnConfigurationComponent,
19
+ ],
20
+ })
21
+ export class TableColumnConfigurationModule {}
@@ -0,0 +1,37 @@
1
+ <div class="cc-timepicker-wrapper" [ngStyle]="wrapperStyles">
2
+ <label *ngIf="label" class="cc-timepicker-label" [ngStyle]="labelStyles">
3
+ {{ label }}
4
+ <span *ngIf="required" class="cc-timepicker-required">{{ labels?.requiredMarker || '*' }}</span>
5
+ </label>
6
+
7
+ <!-- Trigger Field -->
8
+ <div class="cc-timepicker-field"
9
+ [class.focused]="isOpen"
10
+ [class.disabled]="disabled"
11
+ [class.error]="errorMessage"
12
+ [ngStyle]="fieldStyles"
13
+ (click)="!disabled && togglePanel()">
14
+ <span class="cc-timepicker-value" [class.is-placeholder]="!displayValue">
15
+ {{ displayValue || placeholder || 'Select time' }}
16
+ </span>
17
+ <span class="cc-timepicker-icon material-icons">schedule</span>
18
+ </div>
19
+
20
+ <!-- Centered Modal Overlay -->
21
+ <div class="cc-timepicker-overlay" *ngIf="isOpen" (click)="onCancelled()">
22
+ <div class="cc-timepicker-modal-content" (click)="$event.stopPropagation()">
23
+ <lib-time-wheel-panel
24
+ [mode]="mode"
25
+ [value]="displayValue"
26
+ [labels]="labels"
27
+ [minuteStep]="minuteStep"
28
+ [minTime]="minTime"
29
+ [maxTime]="maxTime"
30
+ (confirmed)="onConfirmed($event)"
31
+ (cancelled)="onCancelled()">
32
+ </lib-time-wheel-panel>
33
+ </div>
34
+ </div>
35
+
36
+ <div class="cc-error-message" *ngIf="errorMessage">{{ errorMessage }}</div>
37
+ </div>
@@ -0,0 +1,102 @@
1
+ .cc-timepicker-wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: var(--cc-timepicker-label-gap, 0.5rem);
5
+ font-family: var(--cc-timepicker-font-family, inherit);
6
+ position: relative;
7
+ width: 100%;
8
+ }
9
+
10
+ .cc-timepicker-label {
11
+ font-size: var(--cc-timepicker-label-font-size, 0.875rem);
12
+ font-weight: var(--cc-timepicker-label-font-weight, 500);
13
+ color: var(--cc-timepicker-label-color, #202124);
14
+ display: flex;
15
+ align-items: center;
16
+ }
17
+
18
+ .cc-timepicker-required {
19
+ color: var(--cc-timepicker-required-color, #D93025);
20
+ margin-left: 0.125rem;
21
+ }
22
+
23
+ .cc-timepicker-field {
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: space-between;
27
+ height: var(--cc-timepicker-height, 2.5rem);
28
+ padding: var(--cc-timepicker-padding, 0.375rem 1rem);
29
+ border-radius: var(--cc-timepicker-border-radius, 0.4375rem);
30
+ border: var(--cc-timepicker-border-width, 1px) solid var(--cc-timepicker-border-color, #BDC1C6);
31
+ background-color: var(--cc-timepicker-bg, #FEFEFE);
32
+ cursor: pointer;
33
+ box-sizing: border-box;
34
+ transition: border-color 0.2s ease, box-shadow 0.2s ease;
35
+ user-select: none;
36
+ }
37
+
38
+ .cc-timepicker-field:hover:not(.disabled) {
39
+ border-color: var(--cc-timepicker-focus-border-color, #1A73E8);
40
+ }
41
+
42
+ .cc-timepicker-field.focused {
43
+ border-color: var(--cc-timepicker-focus-border-color, #1A73E8);
44
+ box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
45
+ }
46
+
47
+ .cc-timepicker-field.disabled {
48
+ background-color: var(--cc-timepicker-disabled-bg, #F1F3F4);
49
+ border-color: var(--cc-timepicker-border-color, #BDC1C6);
50
+ cursor: not-allowed;
51
+ }
52
+
53
+ .cc-timepicker-value {
54
+ font-size: var(--cc-timepicker-font-size, 0.875rem);
55
+ font-weight: var(--cc-timepicker-font-weight, 400);
56
+ color: var(--cc-timepicker-color, #202124);
57
+ font-variant-numeric: tabular-nums;
58
+ }
59
+
60
+ .cc-timepicker-field.disabled .cc-timepicker-value {
61
+ color: var(--cc-timepicker-disabled-color, #80868B);
62
+ }
63
+
64
+ .cc-timepicker-value.is-placeholder {
65
+ color: var(--cc-timepicker-placeholder-color, #80868B);
66
+ }
67
+
68
+ .cc-timepicker-icon {
69
+ font-size: 20px;
70
+ color: var(--cc-timepicker-icon-color, #5F6368);
71
+ display: flex;
72
+ align-items: center;
73
+ justify-content: center;
74
+ }
75
+
76
+ .cc-timepicker-field.disabled .cc-timepicker-icon {
77
+ color: var(--cc-timepicker-disabled-color, #80868B);
78
+ }
79
+
80
+ /* ─── Centered Modal Overlay Backdrop ─── */
81
+ .cc-timepicker-overlay {
82
+ position: fixed;
83
+ top: 0;
84
+ left: 0;
85
+ right: 0;
86
+ bottom: 0;
87
+ background-color: rgba(0, 0, 0, 0.4); /* dim backdrop */
88
+ display: flex;
89
+ align-items: center;
90
+ justify-content: center;
91
+ z-index: 9999;
92
+ }
93
+
94
+ .cc-timepicker-modal-content {
95
+ display: block;
96
+ }
97
+
98
+ .cc-error-message {
99
+ font-size: 0.75rem;
100
+ color: var(--cc-timepicker-error-color, #D93025);
101
+ margin-top: 0.25rem;
102
+ }
@@ -0,0 +1,178 @@
1
+ import { Component, Input, Output, EventEmitter, forwardRef, OnInit, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
3
+ import { TimePickerConfig, TimePickerLabels, TimeMode, TimePickerVariant } from '../../models/time-picker.models';
4
+
5
+ @Component({
6
+ selector: 'lib-time-picker',
7
+ templateUrl: './time-picker.component.html',
8
+ styleUrls: ['./time-picker.component.scss'],
9
+ standalone: false,
10
+ providers: [
11
+ {
12
+ provide: NG_VALUE_ACCESSOR,
13
+ useExisting: forwardRef(() => TimePickerComponent),
14
+ multi: true
15
+ }
16
+ ]
17
+ })
18
+ export class TimePickerComponent implements ControlValueAccessor, OnInit, OnChanges {
19
+ @Input() config?: TimePickerConfig;
20
+ @Input() labels?: TimePickerLabels;
21
+ @Input() label: string = '';
22
+ @Input() placeholder: string = '';
23
+ @Input() variant: TimePickerVariant = 'wheel';
24
+ @Input() mode: TimeMode = '12';
25
+ @Input() minuteStep: number = 0;
26
+ @Input() disabled: boolean = false;
27
+ @Input() required: boolean = false;
28
+ @Input() errorMessage: string = '';
29
+ @Input() minTime?: string;
30
+ @Input() maxTime?: string;
31
+
32
+ // Style inputs (to mirror datepicker pattern)
33
+ @Input() width?: string;
34
+ @Input() height?: string;
35
+ @Input() borderRadius?: string;
36
+ @Input() fontSize?: string;
37
+ @Input() gap?: string;
38
+ @Input() fontFamily?: string;
39
+ @Input() labelColor?: string;
40
+ @Input() labelFontSize?: string;
41
+ @Input() labelFontWeight?: string;
42
+ @Input() backgroundColor?: string;
43
+ @Input() borderColor?: string;
44
+ @Input() borderWidth?: string;
45
+ @Input() padding?: string;
46
+ @Input() fontWeight?: string;
47
+ @Input() color?: string;
48
+ @Input() placeholderColor?: string;
49
+ @Input() focusBorderColor?: string;
50
+ @Input() errorColor?: string;
51
+ @Input() disabledBackgroundColor?: string;
52
+ @Input() disabledColor?: string;
53
+
54
+ @Output() timeChange = new EventEmitter<string>();
55
+
56
+ displayValue: string = '';
57
+ isOpen: boolean = false;
58
+
59
+ onChange: (value: string) => void = () => {};
60
+ onTouched: () => void = () => {};
61
+
62
+ ngOnInit(): void {
63
+ this.updateFromConfig();
64
+ }
65
+
66
+ ngOnChanges(changes: SimpleChanges): void {
67
+ if (changes['config']) {
68
+ this.updateFromConfig();
69
+ }
70
+ }
71
+
72
+ private updateFromConfig(): void {
73
+ if (this.config) {
74
+ this.label = this.config.label ?? this.label;
75
+ this.placeholder = this.config.placeholder ?? this.placeholder;
76
+ this.variant = this.config.variant ?? this.variant;
77
+ this.mode = this.config.mode ?? this.mode;
78
+ this.minuteStep = this.config.minuteStep ?? this.minuteStep;
79
+ this.disabled = this.config.disabled ?? this.disabled;
80
+ this.required = this.config.required ?? this.required;
81
+ this.errorMessage = this.config.errorMessage ?? this.errorMessage;
82
+
83
+ this.width = this.config.width ?? this.width;
84
+ this.height = this.config.height ?? this.height;
85
+ this.borderRadius = this.config.borderRadius ?? this.borderRadius;
86
+ this.fontSize = this.config.fontSize ?? this.fontSize;
87
+ this.gap = this.config.gap ?? this.gap;
88
+ this.fontFamily = this.config.fontFamily ?? this.fontFamily;
89
+ this.labelColor = this.config.labelColor ?? this.labelColor;
90
+ this.labelFontSize = this.config.labelFontSize ?? this.labelFontSize;
91
+ this.labelFontWeight = this.config.labelFontWeight ?? this.labelFontWeight;
92
+ this.backgroundColor = this.config.backgroundColor ?? this.backgroundColor;
93
+ this.borderColor = this.config.borderColor ?? this.borderColor;
94
+ this.borderWidth = this.config.borderWidth ?? this.borderWidth;
95
+ this.padding = this.config.padding ?? this.padding;
96
+ this.fontWeight = this.config.fontWeight ?? this.fontWeight;
97
+ this.color = this.config.color ?? this.color;
98
+ this.placeholderColor = this.config.placeholderColor ?? this.placeholderColor;
99
+ this.focusBorderColor = this.config.focusBorderColor ?? this.focusBorderColor;
100
+ this.errorColor = this.config.errorColor ?? this.errorColor;
101
+ this.disabledBackgroundColor = this.config.disabledBackgroundColor ?? this.disabledBackgroundColor;
102
+ this.disabledColor = this.config.disabledColor ?? this.disabledColor;
103
+ }
104
+ }
105
+
106
+ writeValue(value: string): void {
107
+ this.displayValue = value || '';
108
+ }
109
+
110
+ registerOnChange(fn: any): void {
111
+ this.onChange = fn;
112
+ }
113
+
114
+ registerOnTouched(fn: any): void {
115
+ this.onTouched = fn;
116
+ }
117
+
118
+ setDisabledState(isDisabled: boolean): void {
119
+ this.disabled = isDisabled;
120
+ }
121
+
122
+ togglePanel(): void {
123
+ if (this.disabled) return;
124
+ this.isOpen = !this.isOpen;
125
+ }
126
+
127
+ closePanel(): void {
128
+ this.isOpen = false;
129
+ }
130
+
131
+ onConfirmed(timeString: string): void {
132
+ this.displayValue = timeString;
133
+ this.onChange(timeString);
134
+ this.timeChange.emit(timeString);
135
+ this.isOpen = false;
136
+ this.onTouched();
137
+ }
138
+
139
+ onCancelled(): void {
140
+ this.isOpen = false;
141
+ this.onTouched();
142
+ }
143
+
144
+ get wrapperStyles(): { [key: string]: string | undefined } {
145
+ return {
146
+ 'width': this.width ? `${this.width}` : undefined,
147
+ '--cc-timepicker-label-gap': this.gap ? `${this.gap}` : undefined,
148
+ '--cc-timepicker-font-family': this.fontFamily ? `${this.fontFamily}` : undefined
149
+ };
150
+ }
151
+
152
+ get labelStyles(): { [key: string]: string | undefined } {
153
+ return {
154
+ '--cc-timepicker-label-color': this.labelColor ? `${this.labelColor}` : undefined,
155
+ '--cc-timepicker-label-font-size': this.labelFontSize ? `${this.labelFontSize}` : undefined,
156
+ '--cc-timepicker-label-font-weight': this.labelFontWeight ? `${this.labelFontWeight}` : undefined
157
+ };
158
+ }
159
+
160
+ get fieldStyles(): { [key: string]: string | undefined } {
161
+ return {
162
+ '--cc-timepicker-bg': this.backgroundColor ? `${this.backgroundColor}` : undefined,
163
+ '--cc-timepicker-border-radius': this.borderRadius ? `${this.borderRadius}` : undefined,
164
+ '--cc-timepicker-border-color': this.borderColor ? `${this.borderColor}` : undefined,
165
+ '--cc-timepicker-border-width': this.borderWidth ? `${this.borderWidth}` : undefined,
166
+ '--cc-timepicker-height': this.height ? `${this.height}` : undefined,
167
+ '--cc-timepicker-padding': this.padding ? `${this.padding}` : undefined,
168
+ '--cc-timepicker-font-size': this.fontSize ? `${this.fontSize}` : undefined,
169
+ '--cc-timepicker-font-weight': this.fontWeight ? `${this.fontWeight}` : undefined,
170
+ '--cc-timepicker-color': this.color ? `${this.color}` : undefined,
171
+ '--cc-timepicker-placeholder-color': this.placeholderColor ? `${this.placeholderColor}` : undefined,
172
+ '--cc-timepicker-focus-border-color': this.focusBorderColor ? `${this.focusBorderColor}` : undefined,
173
+ '--cc-timepicker-error-color': this.errorColor ? `${this.errorColor}` : undefined,
174
+ '--cc-timepicker-disabled-bg': this.disabledBackgroundColor ? `${this.disabledBackgroundColor}` : undefined,
175
+ '--cc-timepicker-disabled-color': this.disabledColor ? `${this.disabledColor}` : undefined
176
+ };
177
+ }
178
+ }
@@ -0,0 +1,78 @@
1
+ <div class="cc-twp-dialog">
2
+ <!-- Subtle Configurable Title Header -->
3
+ <div class="cc-twp-header">
4
+ <span class="cc-twp-title">{{ labels?.selectTimeTitle || 'Select Time' }}</span>
5
+ </div>
6
+
7
+ <!-- Digital Preview -->
8
+ <div class="cc-twp-preview">
9
+ <span class="cc-twp-preview-num">{{ selectedHour }}</span>
10
+ <span class="cc-twp-preview-colon">:</span>
11
+ <span class="cc-twp-preview-num">{{ selectedMinute }}</span>
12
+ <span class="cc-twp-preview-period" *ngIf="mode === '12'"> {{ selectedPeriod }}</span>
13
+ </div>
14
+
15
+ <!-- Wheel Area -->
16
+ <div class="cc-twp-wheels" [class.mode-24]="mode === '24'">
17
+ <div class="cc-twp-highlight-bar"></div>
18
+
19
+ <!-- Hour Column -->
20
+ <div class="cc-twp-col">
21
+ <span class="cc-twp-col-label">{{ labels?.hourLabel || 'Hour' }}</span>
22
+ <div class="cc-twp-scroll" #hourWheel>
23
+ <div class="cc-twp-spacer" *ngFor="let s of spacerRows"></div>
24
+ <ng-container *ngFor="let rep of hourRepeats">
25
+ <div *ngFor="let h of hours"
26
+ class="cc-twp-item"
27
+ [class.active]="selectedHour === h"
28
+ [class.disabled]="disabledHours.has(h)"
29
+ [attr.aria-disabled]="disabledHours.has(h)"
30
+ (click)="selectValue('hour', h)">{{ h }}</div>
31
+ </ng-container>
32
+ <div class="cc-twp-spacer" *ngFor="let s of spacerRows"></div>
33
+ </div>
34
+ </div>
35
+
36
+ <!-- Minute Column -->
37
+ <div class="cc-twp-col">
38
+ <span class="cc-twp-col-label">{{ labels?.minuteLabel || 'Minute' }}</span>
39
+ <div class="cc-twp-scroll" #minuteWheel>
40
+ <div class="cc-twp-spacer" *ngFor="let s of spacerRows"></div>
41
+ <ng-container *ngFor="let rep of minuteRepeats">
42
+ <div *ngFor="let m of minutes"
43
+ class="cc-twp-item"
44
+ [class.active]="selectedMinute === m"
45
+ [class.disabled]="disabledMinutes.has(m)"
46
+ [attr.aria-disabled]="disabledMinutes.has(m)"
47
+ (click)="selectValue('minute', m)">{{ m }}</div>
48
+ </ng-container>
49
+ <div class="cc-twp-spacer" *ngFor="let s of spacerRows"></div>
50
+ </div>
51
+ </div>
52
+
53
+ <!-- AM/PM Column — 12hr mode only -->
54
+ <div class="cc-twp-col" *ngIf="mode === '12'">
55
+ <span class="cc-twp-col-label">{{ labels?.periodLabel || 'AM/PM' }}</span>
56
+ <div class="cc-twp-scroll" #periodWheel>
57
+ <div class="cc-twp-spacer" *ngFor="let s of spacerRows"></div>
58
+ <div *ngFor="let p of periods"
59
+ class="cc-twp-item"
60
+ [class.active]="selectedPeriod === p"
61
+ [class.disabled]="disabledPeriods.has(p)"
62
+ [attr.aria-disabled]="disabledPeriods.has(p)"
63
+ (click)="selectValue('period', p)">{{ p }}</div>
64
+ <div class="cc-twp-spacer" *ngFor="let s of spacerRows"></div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+
69
+ <!-- Footer -->
70
+ <div class="cc-twp-footer">
71
+ <button class="cc-twp-btn cc-twp-btn-cancel" (click)="onCancel()">
72
+ {{ labels?.cancelLabel || 'Cancel' }}
73
+ </button>
74
+ <button class="cc-twp-btn cc-twp-btn-confirm" (click)="onConfirm()">
75
+ {{ labels?.confirmLabel || 'Confirm' }}
76
+ </button>
77
+ </div>
78
+ </div>