commons-shared-web-ui 0.0.52 → 0.0.53

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 (214) 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 +2532 -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/ng-package.json +28 -0
  23. package/package.json +53 -34
  24. package/src/lib/modules/alert/alert.models.ts +6 -0
  25. package/src/lib/modules/alert/alert.module.ts +16 -0
  26. package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
  27. package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
  28. package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
  29. package/src/lib/modules/button/button.models.ts +13 -0
  30. package/src/lib/modules/button/button.module.ts +16 -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/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +77 -0
  47. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +395 -0
  48. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +266 -0
  49. package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +71 -0
  50. package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +20 -0
  51. package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
  52. package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
  53. package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
  54. package/src/lib/modules/filter/filter.models.ts +88 -0
  55. package/src/lib/modules/filter/filter.module.ts +24 -0
  56. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
  57. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
  58. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
  59. package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
  60. package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
  61. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
  62. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
  63. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
  64. package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
  65. package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
  66. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
  67. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
  68. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
  69. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
  70. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
  71. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
  72. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
  73. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
  74. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
  75. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
  76. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
  77. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
  78. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
  79. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
  80. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
  81. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
  82. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
  83. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
  84. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
  85. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
  86. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
  87. package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
  88. package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
  89. package/src/lib/modules/form-builder/index.ts +9 -0
  90. package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
  91. package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
  92. package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
  93. package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
  94. package/src/lib/modules/form-builder/services/field-selection.service.ts +299 -0
  95. package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +670 -0
  96. package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
  97. package/src/lib/modules/form-builder/utils/constants.ts +43 -0
  98. package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
  99. package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
  100. package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
  101. package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
  102. package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
  103. package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
  104. package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
  105. package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
  106. package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
  107. package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
  108. package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
  109. package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
  110. package/src/lib/modules/form-components/components/input/input.component.html +51 -0
  111. package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
  112. package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
  113. package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
  114. package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
  115. package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
  116. package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
  117. package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
  118. package/src/lib/modules/form-components/components/search/search.component.html +15 -0
  119. package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
  120. package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
  121. package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
  122. package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
  123. package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
  124. package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
  125. package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
  126. package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
  127. package/src/lib/modules/form-components/form-components.module.ts +41 -0
  128. package/src/lib/modules/form-field-configuration/components/_ffc-controls.scss +89 -0
  129. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.html +68 -0
  130. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.scss +73 -0
  131. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.ts +34 -0
  132. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.html +78 -0
  133. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.scss +83 -0
  134. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.ts +94 -0
  135. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.html +38 -0
  136. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.scss +42 -0
  137. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.ts +92 -0
  138. package/src/lib/modules/form-field-configuration/form-field-configuration.module.ts +23 -0
  139. package/src/lib/modules/form-field-configuration/index.ts +7 -0
  140. package/src/lib/modules/form-field-configuration/models/field-configuration.models.ts +62 -0
  141. package/src/lib/modules/form-field-configuration/services/config-schema-tree.service.ts +148 -0
  142. package/src/lib/modules/form-field-configuration/services/field-configuration.service.ts +228 -0
  143. package/src/lib/modules/material/material.module.ts +94 -0
  144. package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
  145. package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
  146. package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
  147. package/src/lib/modules/nav/nav.models.ts +31 -0
  148. package/src/lib/modules/nav/nav.module.ts +17 -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/side-nav/components/side-nav/side-nav.component.html +56 -0
  154. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +342 -0
  155. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +135 -0
  156. package/src/lib/modules/side-nav/side-nav.models.ts +38 -0
  157. package/src/lib/modules/side-nav/side-nav.module.ts +16 -0
  158. package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1196 -0
  159. package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +2014 -0
  160. package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +2782 -0
  161. package/src/lib/modules/smart-form/components/form-section/form-section.component.html +65 -0
  162. package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
  163. package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +131 -0
  164. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
  165. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
  166. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1131 -0
  167. package/src/lib/modules/smart-form/index.ts +10 -0
  168. package/src/lib/modules/smart-form/models/form-schema.model.ts +749 -0
  169. package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +21 -0
  170. package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
  171. package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +67 -0
  172. package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
  173. package/src/lib/modules/smart-form/smart-form.module.ts +36 -0
  174. package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
  175. package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
  176. package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
  177. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
  178. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
  179. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1128 -0
  180. package/src/lib/modules/smart-table/models/table-config.model.ts +213 -0
  181. package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
  182. package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +28 -0
  183. package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
  184. package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
  185. package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
  186. package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
  187. package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
  188. package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
  189. package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
  190. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
  191. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
  192. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
  193. package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
  194. package/src/lib/modules/table-column-configuration/components/_tcc-controls.scss +53 -0
  195. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.html +47 -0
  196. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.scss +50 -0
  197. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.ts +33 -0
  198. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.html +30 -0
  199. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.scss +36 -0
  200. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.ts +78 -0
  201. package/src/lib/modules/table-column-configuration/index.ts +5 -0
  202. package/src/lib/modules/table-column-configuration/models/table-column-configuration.models.ts +20 -0
  203. package/src/lib/modules/table-column-configuration/services/table-column-configuration.service.ts +77 -0
  204. package/src/lib/modules/table-column-configuration/table-column-configuration.module.ts +21 -0
  205. package/src/lib/shared-ui.module.ts +50 -0
  206. package/src/lib/utils/constants.ts +11 -0
  207. package/src/lib/utils/storage.utils.ts +37 -0
  208. package/src/lib/utils/string.utils.ts +23 -0
  209. package/src/lib/utils/translation.utils.ts +87 -0
  210. package/src/public-api.ts +121 -0
  211. package/tsconfig.lib.json +15 -0
  212. package/fesm2022/commons-shared-web-ui.mjs +0 -14557
  213. package/fesm2022/commons-shared-web-ui.mjs.map +0 -1
  214. package/index.d.ts +0 -4534
@@ -0,0 +1,43 @@
1
+ /** Available field types that users can switch to in the configurator. */
2
+ export const SWITCHABLE_FIELD_TYPES = [
3
+ { label: 'Short Text', value: 'shortText' },
4
+ { label: 'Long Text', value: 'longText' },
5
+ { label: 'Email', value: 'email' },
6
+ { label: 'Phone', value: 'phone' },
7
+ { label: 'Password', value: 'password' },
8
+ { label: 'Number (Integer)',value: 'number' },
9
+ { label: 'Number (Decimal)',value: 'decimal' },
10
+ { label: 'Date', value: 'date' },
11
+ { label: 'Time', value: 'time' },
12
+ { label: 'Date & Time', value: 'dateTime' },
13
+ { label: 'Dropdown', value: 'dropdown' },
14
+ { label: 'Multi-Select', value: 'multiSelect' },
15
+ { label: 'Autocomplete', value: 'autocomplete' },
16
+ { label: 'Checkbox', value: 'checkbox' },
17
+ { label: 'Multi-Checkbox', value: 'multiCheckbox' },
18
+ { label: 'Radio', value: 'radio' },
19
+ { label: 'Toggle', value: 'toggle' },
20
+ { label: 'Chips', value: 'chip' },
21
+ { label: 'Rich Text', value: 'richText' },
22
+ { label: 'File Upload', value: 'file' },
23
+ { label: 'Rating', value: 'rating' },
24
+ { label: 'Location', value: 'location' },
25
+ { label: 'Formula (Auto)', value: 'generated' },
26
+ ];
27
+
28
+ /**
29
+ * Field types that are driven by option configurations (optionConfig).
30
+ * When `hideToggleForOptionTypes` is true on the field-selection configurator,
31
+ * these field types will not show the enable/disable toggle — they are
32
+ * UI element types whose options are pre-filled by the developer.
33
+ */
34
+ export const OPTION_DRIVEN_FIELD_TYPES: ReadonlySet<string> = new Set([
35
+ 'DROPDOWN',
36
+ 'MULTI_SELECT',
37
+ 'RADIO',
38
+ 'AUTOCOMPLETE',
39
+ 'CHECKBOX',
40
+ 'MULTI_CHECKBOX',
41
+ 'CHIP',
42
+ ]);
43
+
@@ -0,0 +1,29 @@
1
+ <div class="cc-checkbox-wrapper" [ngStyle]="wrapperStyles">
2
+
3
+ <!-- Single Checkbox -->
4
+ <label *ngIf="!isGroup" class="cc-checkbox-label" [class.label-before]="labelPosition === 'before'"
5
+ [class.disabled]="disabled" [class.checked]="checked">
6
+ <input type="checkbox" class="cc-native-checkbox" [checked]="checked" [disabled]="disabled"
7
+ [required]="required" [indeterminate]="indeterminate" (change)="onCheckboxChange($event)" />
8
+ <span class="cc-checkmark"></span>
9
+ <span class="cc-text" *ngIf="label">{{ label }}</span>
10
+ </label>
11
+
12
+ <!-- Checkbox Group -->
13
+ <div *ngIf="isGroup" class="cc-checkbox-group">
14
+ <label *ngIf="label" class="cc-checkbox-group-label" [class.label-before]="labelPosition === 'before'">
15
+ {{ label }}
16
+ <span *ngIf="required" class="cc-required">{{ requiredMarker }}</span>
17
+ </label>
18
+
19
+ <label *ngFor="let option of visibleOptions" class="cc-checkbox-label" [class.disabled]="disabled || option.disabled"
20
+ [class.checked]="option.checked">
21
+ <input type="checkbox" class="cc-native-checkbox" [checked]="option.checked"
22
+ [disabled]="disabled || option.disabled" (change)="onGroupCheckboxChange(option, $event)" />
23
+ <span class="cc-checkmark"></span>
24
+ <span class="cc-text">{{ option.label }}</span>
25
+ </label>
26
+ </div>
27
+
28
+ <div class="cc-error-message" *ngIf="errorMessage">{{ errorMessage }}</div>
29
+ </div>
@@ -0,0 +1,111 @@
1
+ .cc-checkbox-wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ font-family: var(--cc-checkbox-font-family, inherit);
5
+ }
6
+
7
+ .cc-checkbox-label {
8
+ display: inline-flex;
9
+ align-items: center; // Vertical center align
10
+ position: relative;
11
+ cursor: pointer;
12
+ font-size: var(--cc-checkbox-label-font-size, var(--cc-checkbox-font-size, 0.875rem));
13
+ font-weight: var(--cc-checkbox-label-font-weight, var(--cc-checkbox-font-weight, 400));
14
+ color: var(--cc-checkbox-label-color, #202124);
15
+ user-select: none;
16
+ margin-bottom: var(--cc-checkbox-margin-bottom, 0.5rem);
17
+
18
+ &.label-before {
19
+ flex-direction: row-reverse;
20
+
21
+ .cc-checkmark {
22
+ margin-right: 0;
23
+ margin-left: 0.5rem;
24
+ }
25
+ }
26
+
27
+ &.disabled {
28
+ cursor: not-allowed;
29
+ color: var(--cc-checkbox-disabled-color, #80868B);
30
+
31
+ .cc-checkmark {
32
+ border-color: var(--cc-checkbox-disabled-color, #80868B);
33
+ background-color: transparent;
34
+ }
35
+ }
36
+ }
37
+
38
+ .cc-native-checkbox {
39
+ position: absolute;
40
+ opacity: 0;
41
+ cursor: pointer;
42
+ height: 0;
43
+ width: 0;
44
+
45
+ // Checked State
46
+ &:checked~.cc-checkmark {
47
+ background-color: var(--cc-checkbox-checked-color, #1A73E8);
48
+ border-color: var(--cc-checkbox-checked-color, #1A73E8);
49
+ }
50
+
51
+ // Checkmark/Indicator
52
+ &:checked~.cc-checkmark:after {
53
+ display: block;
54
+ }
55
+
56
+ // Disabled & Checked
57
+ &:disabled:checked~.cc-checkmark {
58
+ background-color: var(--cc-checkbox-disabled-color, #80868B);
59
+ border-color: var(--cc-checkbox-disabled-color, #80868B);
60
+ }
61
+ }
62
+
63
+ .cc-checkmark {
64
+ position: relative;
65
+ height: var(--cc-checkbox-size, 1.125rem);
66
+ width: var(--cc-checkbox-size, 1.125rem);
67
+ background-color: transparent;
68
+ border: 2px solid var(--cc-checkbox-unchecked-color, #BDC1C6);
69
+ border-radius: var(--cc-checkbox-border-radius, 2px);
70
+ transition: all 0.2s ease-in-out;
71
+ margin-right: 0.5rem;
72
+ flex-shrink: 0; // Prevent shrinking
73
+
74
+ // The check icon (pure CSS arrow)
75
+ &:after {
76
+ content: "";
77
+ position: absolute;
78
+ display: none;
79
+ left: 50%;
80
+ top: 45%; // Optical centering
81
+ width: 30%;
82
+ height: 60%;
83
+ border: solid white;
84
+ border-width: 0 2px 2px 0;
85
+ transform: translate(-50%, -50%) rotate(45deg);
86
+ }
87
+ }
88
+
89
+ .cc-checkbox-group {
90
+ display: flex;
91
+ flex-direction: column;
92
+ gap: var(--cc-checkbox-group-gap, 0.75rem);
93
+ }
94
+
95
+ .cc-checkbox-group-label {
96
+ font-size: var(--cc-checkbox-group-label-font-size, 0.875rem);
97
+ font-weight: var(--cc-checkbox-group-label-font-weight, 500);
98
+ color: var(--cc-checkbox-group-label-color, #202124);
99
+ margin-bottom: 0.5rem;
100
+ }
101
+
102
+ .cc-required {
103
+ color: var(--cc-checkbox-required-color, #D93025);
104
+ margin-left: 0.25rem;
105
+ }
106
+
107
+ .cc-error-message {
108
+ font-size: 0.75rem;
109
+ color: var(--cc-checkbox-error-color, #D93025);
110
+ margin-top: 0.25rem;
111
+ }
@@ -0,0 +1,207 @@
1
+ import { Component, Input, Output, EventEmitter, forwardRef, OnInit, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
3
+ import { CheckboxConfig, CheckboxOption, CheckboxLabels } from './checkbox.models';
4
+
5
+ @Component({
6
+ selector: 'lib-checkbox',
7
+ templateUrl: './checkbox.component.html',
8
+ styleUrls: ['./checkbox.component.scss'],
9
+ standalone: false,
10
+ providers: [
11
+ {
12
+ provide: NG_VALUE_ACCESSOR,
13
+ useExisting: forwardRef(() => CheckboxComponent),
14
+ multi: true
15
+ }
16
+ ]
17
+ })
18
+ export class CheckboxComponent implements ControlValueAccessor, OnInit, OnChanges {
19
+ @Input() config: CheckboxConfig = {};
20
+ @Input() labels?: CheckboxLabels;
21
+ @Input() label: string = '';
22
+ @Input() checked: boolean = false;
23
+ @Input() disabled: boolean = false;
24
+ @Input() required: boolean = false;
25
+ @Input() indeterminate: boolean = false;
26
+ @Input() options: CheckboxOption[] = [];
27
+ @Input() labelPosition: 'before' | 'after' = 'after';
28
+ @Input() color: string = '#007bff';
29
+ @Input() borderRadius: string = '4px';
30
+ @Input() value: any = null;
31
+ @Input() errorMessage: string = '';
32
+
33
+ // Style inputs
34
+ @Input() width?: string;
35
+ @Input() height?: string;
36
+ @Input() fontSize?: string;
37
+ @Input() fontWeight?: string;
38
+ @Input() labelColor?: string;
39
+ @Input() labelFontSize?: string;
40
+ @Input() labelFontWeight?: string;
41
+ @Input() gap?: string;
42
+ @Input() fontFamily?: string;
43
+ @Input() backgroundColor?: string;
44
+ @Input() borderColor?: string;
45
+ @Input() borderWidth?: string;
46
+ @Input() padding?: string;
47
+ @Input() placeholderColor?: string;
48
+ @Input() focusBorderColor?: string;
49
+ @Input() errorColor?: string;
50
+ @Input() disabledBackgroundColor?: string;
51
+ @Input() disabledColor?: string;
52
+ @Input() boxShadow?: string;
53
+
54
+ @Input() size?: string;
55
+ @Input() checkedColor?: string;
56
+ @Input() uncheckedColor?: string;
57
+ @Input() groupLabelColor?: string;
58
+ @Input() groupLabelFontSize?: string;
59
+ @Input() groupLabelFontWeight?: string;
60
+
61
+ @Output() checkedChange = new EventEmitter<any>();
62
+
63
+ onChange: (value: any) => void = () => { };
64
+ onTouched: () => void = () => { };
65
+
66
+ ngOnInit(): void {
67
+ this.updateFromConfig();
68
+ this.updateFromLabels();
69
+
70
+ if (this.isGroup) {
71
+ this.value = this.options
72
+ .filter(opt => opt.checked)
73
+ .map(opt => opt.value);
74
+ } else {
75
+ this.value = this.checked;
76
+ }
77
+ }
78
+
79
+ ngOnChanges(changes: SimpleChanges): void {
80
+ if (changes['config']) {
81
+ this.updateFromConfig();
82
+ }
83
+ if (changes['labels']) {
84
+ this.updateFromLabels();
85
+ }
86
+ }
87
+
88
+ private updateFromConfig(): void {
89
+ if (this.config) {
90
+ this.label = this.config.label ?? this.label;
91
+ this.checked = this.config.checked ?? this.checked;
92
+ this.disabled = this.config.disabled ?? this.disabled;
93
+ this.required = this.config.required ?? this.required;
94
+ this.indeterminate = this.config.indeterminate ?? this.indeterminate;
95
+ this.options = this.config.options || this.options;
96
+ this.labelPosition = this.config.labelPosition ?? this.labelPosition;
97
+ this.color = this.config.color ?? this.color;
98
+ this.borderRadius = this.config.borderRadius ?? this.borderRadius;
99
+ this.size = this.config.size ?? this.size;
100
+ this.checkedColor = this.config.checkedColor ?? this.checkedColor;
101
+ this.uncheckedColor = this.config.uncheckedColor ?? this.uncheckedColor;
102
+ this.groupLabelColor = this.config.groupLabelColor ?? this.groupLabelColor;
103
+ this.groupLabelFontSize = this.config.groupLabelFontSize ?? this.groupLabelFontSize;
104
+ this.groupLabelFontWeight = this.config.groupLabelFontWeight ?? this.groupLabelFontWeight;
105
+ this.labelFontSize = this.config.labelFontSize ?? this.labelFontSize;
106
+ this.labelFontWeight = this.config.labelFontWeight ?? this.labelFontWeight;
107
+ this.labelColor = this.config.labelColor ?? this.labelColor;
108
+ this.gap = this.config.gap ?? this.gap;
109
+ this.fontFamily = this.config.fontFamily ?? this.fontFamily;
110
+ }
111
+ }
112
+
113
+ private updateFromLabels(): void {
114
+ if (this.labels) {
115
+ this.label = this.labels.label || this.label;
116
+ }
117
+ }
118
+
119
+ get isGroup(): boolean {
120
+ return this.options && this.options.length > 0;
121
+ }
122
+
123
+ get visibleOptions(): CheckboxOption[] {
124
+ return this.options.filter(o => o.label != null && o.label !== '');
125
+ }
126
+
127
+ get requiredMarker(): string {
128
+ return this.labels?.requiredMarker || '*';
129
+ }
130
+
131
+ writeValue(value: any): void {
132
+ if (this.isGroup) {
133
+ this.value = Array.isArray(value) ? value : [];
134
+ this.options.forEach(opt => {
135
+ opt.checked = (this.value as any[]).includes(opt.value);
136
+ });
137
+ } else {
138
+ this.value = !!value;
139
+ this.checked = this.value as boolean;
140
+ }
141
+ }
142
+
143
+ registerOnChange(fn: any): void {
144
+ this.onChange = fn;
145
+ }
146
+
147
+ registerOnTouched(fn: any): void {
148
+ this.onTouched = fn;
149
+ }
150
+
151
+ setDisabledState(isDisabled: boolean): void {
152
+ this.disabled = isDisabled;
153
+ }
154
+
155
+ onCheckboxChange(event: any): void {
156
+ const checked = event.target.checked;
157
+ this.value = checked;
158
+ this.checked = checked;
159
+ this.onChange(this.value);
160
+ this.onTouched();
161
+ this.checkedChange.emit(this.value);
162
+ }
163
+
164
+ onGroupCheckboxChange(option: CheckboxOption, event: any): void {
165
+ const checked = event.target.checked;
166
+ option.checked = checked;
167
+
168
+ const valueArray = this.value as any[];
169
+ if (checked) {
170
+ if (!valueArray.includes(option.value)) {
171
+ this.value = [...valueArray, option.value];
172
+ }
173
+ } else {
174
+ this.value = valueArray.filter(v => v !== option.value);
175
+ }
176
+
177
+ this.onChange(this.value);
178
+ this.onTouched();
179
+ this.checkedChange.emit(this.value);
180
+ }
181
+
182
+ private getStyleValue(value: string | undefined): string | undefined {
183
+ return value ? `${value}` : undefined;
184
+ }
185
+
186
+ get wrapperStyles(): { [key: string]: string | undefined } {
187
+ return {
188
+ '--cc-checkbox-font-family': this.getStyleValue(this.fontFamily),
189
+ '--cc-checkbox-font-size': this.getStyleValue(this.fontSize),
190
+ '--cc-checkbox-font-weight': this.getStyleValue(this.fontWeight),
191
+ '--cc-checkbox-label-color': this.getStyleValue(this.labelColor),
192
+ '--cc-checkbox-size': this.getStyleValue(this.size),
193
+ '--cc-checkbox-checked-color': this.getStyleValue(this.checkedColor),
194
+ '--cc-checkbox-unchecked-color': this.getStyleValue(this.uncheckedColor),
195
+ '--cc-checkbox-disabled-color': this.getStyleValue(this.disabledColor),
196
+ '--cc-checkbox-error-color': this.getStyleValue(this.errorColor),
197
+ '--cc-checkbox-group-gap': this.getStyleValue(this.gap),
198
+ '--cc-checkbox-group-label-color': this.getStyleValue(this.groupLabelColor),
199
+ '--cc-checkbox-group-label-font-size': this.getStyleValue(this.groupLabelFontSize),
200
+ '--cc-checkbox-group-label-font-weight': this.getStyleValue(this.groupLabelFontWeight),
201
+ '--cc-checkbox-label-font-size': this.getStyleValue(this.labelFontSize),
202
+ '--cc-checkbox-label-font-weight': this.getStyleValue(this.labelFontWeight),
203
+ '--cc-checkbox-border-radius': this.getStyleValue(this.borderRadius)
204
+ };
205
+ }
206
+ }
207
+
@@ -0,0 +1,35 @@
1
+ export interface CheckboxOption {
2
+ value: any;
3
+ label: string;
4
+ disabled?: boolean;
5
+ checked?: boolean;
6
+ }
7
+
8
+ export interface CheckboxLabels {
9
+ label?: string;
10
+ requiredMarker?: string;
11
+ }
12
+
13
+ export interface CheckboxConfig {
14
+ label?: string;
15
+ checked?: boolean;
16
+ disabled?: boolean;
17
+ required?: boolean;
18
+ indeterminate?: boolean;
19
+ options?: CheckboxOption[];
20
+ labelPosition?: 'before' | 'after';
21
+ color?: 'primary' | 'accent' | 'warn';
22
+ borderRadius?: string;
23
+ size?: string;
24
+ checkedColor?: string;
25
+ uncheckedColor?: string;
26
+ groupLabelColor?: string;
27
+ groupLabelFontSize?: string;
28
+ groupLabelFontWeight?: string;
29
+ // Style props
30
+ labelFontSize?: string;
31
+ labelFontWeight?: string;
32
+ labelColor?: string;
33
+ gap?: string;
34
+ fontFamily?: string;
35
+ }
@@ -0,0 +1,42 @@
1
+ <div class="cc-datepicker-wrapper" [ngStyle]="wrapperStyles">
2
+ <label *ngIf="label" class="cc-datepicker-label" [ngStyle]="labelStyles">
3
+ {{ label }}
4
+ <span *ngIf="required" class="cc-required">{{ requiredMarker }}</span>
5
+ </label>
6
+
7
+ <!-- Single Date Picker -->
8
+ <div *ngIf="!isRange" class="cc-datepicker-field" [class.focused]="focused" [class.disabled]="disabled"
9
+ [class.error]="errorMessage" [ngStyle]="fieldStyles">
10
+
11
+ <input type="date" class="cc-datepicker-input" #dateInput [value]="formattedValue" [disabled]="disabled"
12
+ [required]="required" [min]="formattedMin" [max]="formattedMax" [placeholder]="placeholder"
13
+ (input)="onDateInput($event)" (blur)="onBlur()" (focus)="onFocus()" (click)="dateInput.showPicker()" />
14
+
15
+ <span class="cc-datepicker-icon material-icons" (click)="dateInput.showPicker()">calendar_today</span>
16
+ </div>
17
+
18
+ <!-- Range Date Picker -->
19
+ <div *ngIf="isRange" class="cc-datepicker-range">
20
+ <!-- Start Date -->
21
+ <div class="cc-datepicker-subfield">
22
+ <label class="cc-datepicker-sublabel">{{ startDateLabel }}</label>
23
+ <div class="cc-datepicker-field" [class.disabled]="disabled" [ngStyle]="fieldStyles">
24
+ <input type="date" class="cc-datepicker-input" [value]="formattedStartDate" [disabled]="disabled"
25
+ [required]="required" [min]="formattedMin" [max]="formattedEndDate || formattedMax"
26
+ (input)="onRangeStartInput($event)" />
27
+ </div>
28
+ </div>
29
+
30
+ <!-- End Date -->
31
+ <div class="cc-datepicker-subfield">
32
+ <label class="cc-datepicker-sublabel">{{ endDateLabel }}</label>
33
+ <div class="cc-datepicker-field" [class.disabled]="disabled" [ngStyle]="fieldStyles">
34
+ <input type="date" class="cc-datepicker-input" [value]="formattedEndDate" [disabled]="disabled"
35
+ [required]="required" [min]="formattedStartDate || formattedMin" [max]="formattedMax"
36
+ (input)="onRangeEndInput($event)" />
37
+ </div>
38
+ </div>
39
+ </div>
40
+
41
+ <div class="cc-error-message" *ngIf="errorMessage">{{ errorMessage }}</div>
42
+ </div>
@@ -0,0 +1,115 @@
1
+ .cc-datepicker-wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: var(--cc-datepicker-label-gap, 0.5rem);
5
+ width: 100%;
6
+ font-family: var(--cc-datepicker-font-family, inherit);
7
+ }
8
+
9
+ .cc-datepicker-label {
10
+ font-size: var(--cc-datepicker-label-font-size, 0.875rem);
11
+ font-weight: var(--cc-datepicker-label-font-weight, 500);
12
+ color: var(--cc-datepicker-label-color, #202124);
13
+ margin: 0;
14
+ line-height: 1.4;
15
+ }
16
+
17
+ .cc-required {
18
+ color: var(--cc-datepicker-required-color, #D93025);
19
+ margin-left: 0.25rem;
20
+ }
21
+
22
+ .cc-datepicker-field {
23
+ display: flex;
24
+ align-items: center;
25
+ width: 100%;
26
+ box-sizing: border-box;
27
+ background-color: var(--cc-datepicker-bg, #FEFEFE);
28
+ border: var(--cc-datepicker-border-width, 1px) solid var(--cc-datepicker-border-color, #BDC1C6);
29
+ border-radius: var(--cc-datepicker-border-radius, 0.4375rem);
30
+ padding: var(--cc-datepicker-padding, 0.5rem 0.75rem);
31
+ min-height: var(--cc-datepicker-height, 2.5rem);
32
+ transition: border-color 0.2s, box-shadow 0.2s;
33
+ position: relative;
34
+
35
+ &.focused {
36
+ border-color: var(--cc-datepicker-focus-border-color, #1A73E8);
37
+ }
38
+
39
+ &.error {
40
+ border-color: var(--cc-datepicker-error-color, #D93025);
41
+ }
42
+
43
+ &.disabled {
44
+ background-color: var(--cc-datepicker-disabled-bg, #F1F3F4);
45
+ cursor: not-allowed;
46
+
47
+ .cc-datepicker-input {
48
+ cursor: not-allowed;
49
+ color: var(--cc-datepicker-disabled-color, #80868B);
50
+ }
51
+
52
+ .cc-datepicker-icon {
53
+ color: var(--cc-datepicker-disabled-color, #80868B);
54
+ }
55
+ }
56
+ }
57
+
58
+ .cc-datepicker-input {
59
+ flex: 1;
60
+ border: none;
61
+ background: transparent;
62
+ outline: none;
63
+ font-family: inherit;
64
+ font-size: var(--cc-datepicker-font-size, 0.875rem);
65
+ font-weight: var(--cc-datepicker-font-weight, 400);
66
+ color: var(--cc-datepicker-color, #202124);
67
+ padding: 0;
68
+ margin: 0;
69
+ width: 100%;
70
+ // Ensure text is visible
71
+ opacity: 1;
72
+
73
+ // Calendar icon override for native input
74
+ &::-webkit-calendar-picker-indicator {
75
+ opacity: 0; // Hide native icon so we can use custom one
76
+ position: absolute;
77
+ right: 0;
78
+ top: 0;
79
+ bottom: 0;
80
+ width: 2.5rem; // Match icon width roughly
81
+ height: 100%;
82
+ cursor: pointer;
83
+ z-index: 10; // Ensure it's on top of the custom icon
84
+ }
85
+ }
86
+
87
+ .cc-datepicker-icon {
88
+ margin-left: 0.5rem;
89
+ color: var(--cc-datepicker-icon-color, #5F6368);
90
+ pointer-events: none; // Allow click through to input
91
+ }
92
+
93
+ .cc-datepicker-range {
94
+ display: flex;
95
+ gap: 1rem;
96
+ align-items: flex-start;
97
+
98
+ .cc-datepicker-subfield {
99
+ flex: 1;
100
+ display: flex;
101
+ flex-direction: column;
102
+ gap: 0.25rem;
103
+ }
104
+
105
+ .cc-datepicker-sublabel {
106
+ font-size: 0.75rem;
107
+ color: #5F6368;
108
+ }
109
+ }
110
+
111
+ .cc-error-message {
112
+ font-size: 0.75rem;
113
+ color: var(--cc-datepicker-error-color, #D93025);
114
+ margin-top: 0.25rem;
115
+ }