commons-shared-web-ui 0.0.61 → 0.0.62
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.
- package/.claude/settings.local.json +10 -0
- package/documentation/alert.md +123 -0
- package/documentation/button-dropdown.md +126 -0
- package/documentation/button.md +184 -0
- package/documentation/cards-usage-guidelines.md +131 -0
- package/documentation/configurable-form.md +605 -0
- package/documentation/confirmation-modal.md +250 -0
- package/documentation/filter-sidebar.md +178 -0
- package/documentation/filter-table-selector.md +228 -0
- package/documentation/form-builder.md +599 -0
- package/documentation/form-components.md +384 -0
- package/documentation/form-field-configuration.md +250 -0
- package/documentation/nav.md +427 -0
- package/documentation/pagination.md +181 -0
- package/documentation/side-nav-documentation.md +169 -0
- package/documentation/smart-form.md +2819 -0
- package/documentation/smart-table.md +1297 -0
- package/documentation/snackbar.md +118 -0
- package/documentation/style-externalization.md +88 -0
- package/documentation/summary-card.md +279 -0
- package/documentation/table-column-configuration.md +221 -0
- package/documentation/time-picker.md +274 -0
- package/ng-package.json +30 -0
- package/package.json +53 -34
- package/src/lib/modules/alert/alert.models.ts +6 -0
- package/src/lib/modules/alert/alert.module.ts +16 -0
- package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
- package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
- package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
- package/src/lib/modules/button/button.models.ts +13 -0
- package/src/lib/modules/button/button.module.ts +16 -0
- package/src/lib/modules/button/components/button/button.component.html +22 -0
- package/src/lib/modules/button/components/button/button.component.scss +92 -0
- package/src/lib/modules/button/components/button/button.component.ts +67 -0
- package/src/lib/modules/button-dropdown/button-dropdown.models.ts +26 -0
- package/src/lib/modules/button-dropdown/button-dropdown.module.ts +22 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +41 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +135 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +160 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.html +294 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.scss +503 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.ts +628 -0
- package/src/lib/modules/configurable-form/configurable-form.examples.ts +154 -0
- package/src/lib/modules/configurable-form/configurable-form.model.ts +131 -0
- package/src/lib/modules/configurable-form/configurable-form.module.ts +19 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +77 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +395 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +266 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +71 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +20 -0
- package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
- package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
- package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
- package/src/lib/modules/filter/filter.models.ts +88 -0
- package/src/lib/modules/filter/filter.module.ts +24 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
- package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
- package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
- package/src/lib/modules/form-builder/index.ts +9 -0
- package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
- package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
- package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
- package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
- package/src/lib/modules/form-builder/services/field-selection.service.ts +299 -0
- package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +670 -0
- package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
- package/src/lib/modules/form-builder/utils/constants.ts +43 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
- package/src/lib/modules/form-components/components/input/input.component.html +51 -0
- package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
- package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
- package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
- package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
- package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
- package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
- package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
- package/src/lib/modules/form-components/components/search/search.component.html +15 -0
- package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
- package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
- package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
- package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
- package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
- package/src/lib/modules/form-components/form-components.module.ts +42 -0
- package/src/lib/modules/form-field-configuration/components/_ffc-controls.scss +89 -0
- package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.html +68 -0
- package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.scss +73 -0
- package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.ts +34 -0
- package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.html +78 -0
- package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.scss +83 -0
- package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.ts +94 -0
- package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.html +38 -0
- package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.scss +42 -0
- package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.ts +92 -0
- package/src/lib/modules/form-field-configuration/form-field-configuration.module.ts +23 -0
- package/src/lib/modules/form-field-configuration/index.ts +7 -0
- package/src/lib/modules/form-field-configuration/models/field-configuration.models.ts +62 -0
- package/src/lib/modules/form-field-configuration/services/config-schema-tree.service.ts +159 -0
- package/src/lib/modules/form-field-configuration/services/field-configuration.service.ts +228 -0
- package/src/lib/modules/material/material.module.ts +94 -0
- package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
- package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
- package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
- package/src/lib/modules/nav/nav.models.ts +31 -0
- package/src/lib/modules/nav/nav.module.ts +17 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.html +52 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.scss +155 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.ts +109 -0
- package/src/lib/modules/pagination/pagination.module.ts +17 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +56 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +342 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +135 -0
- package/src/lib/modules/side-nav/side-nav.models.ts +38 -0
- package/src/lib/modules/side-nav/side-nav.module.ts +16 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1379 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +2255 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +3174 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.html +67 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +142 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1134 -0
- package/src/lib/modules/smart-form/index.ts +10 -0
- package/src/lib/modules/smart-form/models/form-schema.model.ts +803 -0
- package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +22 -0
- package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
- package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +67 -0
- package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
- package/src/lib/modules/smart-form/smart-form.module.ts +40 -0
- package/src/lib/modules/smart-form/smart-form.theme.scss +1 -0
- package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
- package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
- package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1219 -0
- package/src/lib/modules/smart-table/models/table-config.model.ts +247 -0
- package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
- package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +28 -0
- package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
- package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
- package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
- package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
- package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
- package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
- package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
- package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
- package/src/lib/modules/table-column-configuration/components/_tcc-controls.scss +53 -0
- package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.html +47 -0
- package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.scss +50 -0
- package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.ts +33 -0
- package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.html +30 -0
- package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.scss +36 -0
- package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.ts +78 -0
- package/src/lib/modules/table-column-configuration/index.ts +5 -0
- package/src/lib/modules/table-column-configuration/models/table-column-configuration.models.ts +20 -0
- package/src/lib/modules/table-column-configuration/services/table-column-configuration.service.ts +77 -0
- package/src/lib/modules/table-column-configuration/table-column-configuration.module.ts +21 -0
- package/src/lib/modules/time-picker/components/time-picker/time-picker.component.html +37 -0
- package/src/lib/modules/time-picker/components/time-picker/time-picker.component.scss +102 -0
- package/src/lib/modules/time-picker/components/time-picker/time-picker.component.ts +178 -0
- package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.html +78 -0
- package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.scss +226 -0
- package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.ts +595 -0
- package/src/lib/modules/time-picker/models/time-picker.models.ts +49 -0
- package/src/lib/modules/time-picker/time-picker.module.ts +23 -0
- package/src/lib/shared-ui.module.ts +55 -0
- package/src/lib/utils/constants.ts +11 -0
- package/src/lib/utils/storage.utils.ts +37 -0
- package/src/lib/utils/string.utils.ts +23 -0
- package/src/lib/utils/translation.utils.ts +87 -0
- package/src/public-api.ts +127 -0
- package/tsconfig.lib.json +15 -0
- package/fesm2022/commons-shared-web-ui.mjs +0 -16097
- package/fesm2022/commons-shared-web-ui.mjs.map +0 -1
- package/index.d.ts +0 -5022
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# Time Picker Component (`lib-time-picker`)
|
|
2
|
+
|
|
3
|
+
A highly customizable, slot-machine / drum-roll style wheel picker component that supports 12-hour or 24-hour modes, custom minute steps, disabled time range limits (`minTime` and `maxTime`), full touch interaction, and accessibility attributes.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Importing the Module
|
|
8
|
+
|
|
9
|
+
To use the time picker in your Angular application (or within a Micro Frontend Remote MFE), import `TimePickerModule` into your Angular module:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { NgModule } from '@angular/core';
|
|
13
|
+
import { CommonModule } from '@angular/common';
|
|
14
|
+
import { TimePickerModule } from 'commons-shared-web-ui';
|
|
15
|
+
|
|
16
|
+
@NgModule({
|
|
17
|
+
imports: [
|
|
18
|
+
CommonModule,
|
|
19
|
+
TimePickerModule
|
|
20
|
+
]
|
|
21
|
+
})
|
|
22
|
+
export class MyFeatureModule {}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 2. Basic Component Usage
|
|
28
|
+
|
|
29
|
+
### Template-Driven Form / Two-Way Binding (`ngModel`)
|
|
30
|
+
```html
|
|
31
|
+
<lib-time-picker
|
|
32
|
+
[(ngModel)]="selectedTime"
|
|
33
|
+
[label]="'Meeting Time'"
|
|
34
|
+
[placeholder]="'Choose a time'"
|
|
35
|
+
[required]="true"
|
|
36
|
+
[mode]="'12'"
|
|
37
|
+
[minuteStep]="15">
|
|
38
|
+
</lib-time-picker>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Reactive Forms (`formControlName`)
|
|
42
|
+
```html
|
|
43
|
+
<form [formGroup]="form">
|
|
44
|
+
<lib-time-picker
|
|
45
|
+
[formControlName]="'startTime'"
|
|
46
|
+
[label]="'Start Time'"
|
|
47
|
+
[mode]="'24'"
|
|
48
|
+
[minTime]="'08:00'"
|
|
49
|
+
[maxTime]="'18:00'">
|
|
50
|
+
</lib-time-picker>
|
|
51
|
+
</form>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Complete Example (Reactive Form + Events)
|
|
55
|
+
|
|
56
|
+
A full working component wiring up two pickers with a time range, a minute step, and the `(timeChange)` output.
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { Component } from '@angular/core';
|
|
60
|
+
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
61
|
+
|
|
62
|
+
@Component({
|
|
63
|
+
selector: 'app-schedule-form',
|
|
64
|
+
templateUrl: './schedule-form.component.html'
|
|
65
|
+
})
|
|
66
|
+
export class ScheduleFormComponent {
|
|
67
|
+
form: FormGroup = this.fb.group({
|
|
68
|
+
startTime: ['09:00 AM', Validators.required],
|
|
69
|
+
endTime: ['05:00 PM', Validators.required]
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
constructor(private fb: FormBuilder) {}
|
|
73
|
+
|
|
74
|
+
onStartChange(value: string): void {
|
|
75
|
+
// Emitted on Confirm — "hh:mm AM|PM" (12h) or "HH:mm" (24h)
|
|
76
|
+
console.log('Start time selected:', value);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
submit(): void {
|
|
80
|
+
if (this.form.valid) {
|
|
81
|
+
console.log('Schedule:', this.form.value);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<form [formGroup]="form" (ngSubmit)="submit()">
|
|
89
|
+
<lib-time-picker
|
|
90
|
+
formControlName="startTime"
|
|
91
|
+
[label]="'Start Time'"
|
|
92
|
+
[placeholder]="'Select start'"
|
|
93
|
+
[required]="true"
|
|
94
|
+
[mode]="'12'"
|
|
95
|
+
[minuteStep]="15"
|
|
96
|
+
[errorMessage]="form.get('startTime')?.touched && form.get('startTime')?.invalid ? 'Start time is required' : ''"
|
|
97
|
+
(timeChange)="onStartChange($event)">
|
|
98
|
+
</lib-time-picker>
|
|
99
|
+
|
|
100
|
+
<lib-time-picker
|
|
101
|
+
formControlName="endTime"
|
|
102
|
+
[label]="'End Time'"
|
|
103
|
+
[mode]="'12'"
|
|
104
|
+
[minuteStep]="15"
|
|
105
|
+
[minTime]="'09:00'"
|
|
106
|
+
[maxTime]="'21:00'">
|
|
107
|
+
</lib-time-picker>
|
|
108
|
+
|
|
109
|
+
<button type="submit" [disabled]="form.invalid">Save</button>
|
|
110
|
+
</form>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Complete Example (Single `config` object)
|
|
114
|
+
|
|
115
|
+
Every input can also be supplied through one `TimePickerConfig` object — handy when the config comes from JSON/i18n.
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import { Component } from '@angular/core';
|
|
119
|
+
import { TimePickerConfig } from 'commons-shared-web-ui';
|
|
120
|
+
|
|
121
|
+
@Component({
|
|
122
|
+
selector: 'app-reminder',
|
|
123
|
+
template: `
|
|
124
|
+
<lib-time-picker
|
|
125
|
+
[(ngModel)]="reminderTime"
|
|
126
|
+
[config]="pickerConfig"
|
|
127
|
+
(timeChange)="reminderTime = $event">
|
|
128
|
+
</lib-time-picker>
|
|
129
|
+
`
|
|
130
|
+
})
|
|
131
|
+
export class ReminderComponent {
|
|
132
|
+
reminderTime = '';
|
|
133
|
+
|
|
134
|
+
pickerConfig: TimePickerConfig = {
|
|
135
|
+
label: 'Daily Reminder',
|
|
136
|
+
placeholder: 'Pick a time',
|
|
137
|
+
mode: '24',
|
|
138
|
+
minuteStep: 5, // 0/1 = every minute; > 0 adds the break
|
|
139
|
+
required: true,
|
|
140
|
+
minTime: '06:00',
|
|
141
|
+
maxTime: '23:30'
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 3. Configuration Properties
|
|
149
|
+
|
|
150
|
+
### Inputs
|
|
151
|
+
| Input | Type | Default | Description |
|
|
152
|
+
| --- | --- | --- | --- |
|
|
153
|
+
| `config` | `TimePickerConfig` | `undefined` | Unified configuration object that mirrors individual inputs. |
|
|
154
|
+
| `labels` | `TimePickerLabels` | `undefined` | i18n label map keys. |
|
|
155
|
+
| `label` | `string` | `""` | The label text displayed above the trigger input. |
|
|
156
|
+
| `placeholder` | `string` | `""` | Placeholder text shown inside the input when no time is selected. |
|
|
157
|
+
| `mode` | `'12' \| '24'` | `'12'` | Hour display format. `'12'` shows a AM/PM column, while `'24'` runs from 00-23. |
|
|
158
|
+
| `minuteStep` | `number` | `0` | Increment for the minutes column. `0` (or `1`) shows every minute `00–59` with no break; a value greater than `0` adds the step break (e.g. `15` → `00, 15, 30, 45`). |
|
|
159
|
+
| `disabled` | `boolean` | `false` | Disables the trigger field, blocking popup opening. |
|
|
160
|
+
| `required` | `boolean` | `false` | Appends a red asterisk to the field label. |
|
|
161
|
+
| `errorMessage` | `string` | `""` | Validation error message text. |
|
|
162
|
+
| `minTime` | `string` | `undefined` | Minimum allowed limit in 24hr `"HH:mm"` string format (e.g., `"09:30"`). |
|
|
163
|
+
| `maxTime` | `string` | `undefined` | Maximum allowed limit in 24hr `"HH:mm"` string format (e.g., `"17:00"`). |
|
|
164
|
+
|
|
165
|
+
### `TimePickerLabels` Properties
|
|
166
|
+
When passing the `[labels]` input, you can provide any of the following fields (all optional, falling back to English defaults):
|
|
167
|
+
|
|
168
|
+
| Property | Type | Default | Description |
|
|
169
|
+
| --- | --- | --- | --- |
|
|
170
|
+
| `selectTimeTitle` | `string` | `'Select Time'` | The subtle header title printed at the top of the dialog. |
|
|
171
|
+
| `hourLabel` | `string` | `'Hour'` | Header label shown above the hour column. |
|
|
172
|
+
| `minuteLabel` | `string` | `'Minute'` | Header label shown above the minute column. |
|
|
173
|
+
| `periodLabel` | `string` | `'AM/PM'` | Header label shown above the AM/PM column (12h mode only). |
|
|
174
|
+
| `confirmLabel` | `string` | `'Confirm'` | Confirm button text. |
|
|
175
|
+
| `cancelLabel` | `string` | `'Cancel'` | Cancel button text. |
|
|
176
|
+
|
|
177
|
+
### Outputs
|
|
178
|
+
| Output | Type | Description |
|
|
179
|
+
| --- | --- | --- |
|
|
180
|
+
| `timeChange` | `EventEmitter<string>` | Emitted when a time is confirmed and closed. Emits `"hh:mm AM\|PM"` for `'12'` mode, or `"HH:mm"` for `'24'` mode. |
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 4. Styling & Customization in MFEs
|
|
185
|
+
|
|
186
|
+
The time-picker has two main styling options: the **Default (Black/Grey)** scheme (matching Image 2) and the **Blue Accent** scheme. These are easily set via the theme mixin or global CSS variables.
|
|
187
|
+
|
|
188
|
+
### Variant Options (SCSS)
|
|
189
|
+
|
|
190
|
+
#### Option 1: Default (Black/Grey Theme — Image 2)
|
|
191
|
+
The default theme features black text active indicators, borderless wheels, a light-grey center highlight bar, a black Confirm button, and a light-grey Cancel button.
|
|
192
|
+
|
|
193
|
+
```scss
|
|
194
|
+
@use 'commons-shared-web-ui/lib/modules/time-picker/time-picker.theme' as tp;
|
|
195
|
+
|
|
196
|
+
:root {
|
|
197
|
+
@include tp.time-picker-theme();
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### Option 2: Blue Accent Variant
|
|
202
|
+
The blue accent theme uses the same layout and headers, but changes highlights, preview text, active wheel items, and buttons to use the blue accent color.
|
|
203
|
+
|
|
204
|
+
```scss
|
|
205
|
+
@use 'commons-shared-web-ui/lib/modules/time-picker/time-picker.theme' as tp;
|
|
206
|
+
|
|
207
|
+
:root {
|
|
208
|
+
@include tp.time-picker-theme((
|
|
209
|
+
accent: #4D89EB,
|
|
210
|
+
accent-light: rgba(77, 137, 235, 0.08),
|
|
211
|
+
accent-border: rgba(77, 137, 235, 0.15),
|
|
212
|
+
btn-confirm-bg: #4D89EB,
|
|
213
|
+
btn-confirm-hover: #3b74d1,
|
|
214
|
+
btn-cancel-bg: transparent,
|
|
215
|
+
btn-cancel-border: #e5e7eb,
|
|
216
|
+
btn-cancel-hover: #e5e7eb
|
|
217
|
+
));
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
You can style the trigger inputs and picker wheels using two different methods: using Scss Mixins or CSS Custom Properties.
|
|
222
|
+
|
|
223
|
+
### Method A: Including Theme Mixin inside MFE Component SCSS
|
|
224
|
+
|
|
225
|
+
To scope the theme changes inside a specific feature component or the main MFE root stylesheet, use the `@use` rule to import the SCSS file and `@include` the mixin:
|
|
226
|
+
|
|
227
|
+
```scss
|
|
228
|
+
// remote-mfe/src/app/feature/feature.component.scss
|
|
229
|
+
|
|
230
|
+
@use 'commons-shared-web-ui/lib/modules/time-picker/time-picker.theme' as tp;
|
|
231
|
+
|
|
232
|
+
// Apply default theme to component scope
|
|
233
|
+
:host {
|
|
234
|
+
@include tp.time-picker-theme();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// OR customize theme properties:
|
|
238
|
+
.custom-theme-picker {
|
|
239
|
+
@include tp.time-picker-theme((
|
|
240
|
+
accent: #C21E25, // Crimson Red brand color
|
|
241
|
+
accent-light: rgba(194, 30, 37, 0.08),
|
|
242
|
+
accent-border: rgba(194, 30, 37, 0.15),
|
|
243
|
+
btn-confirm-bg: #C21E25,
|
|
244
|
+
btn-confirm-hover: #a1141a,
|
|
245
|
+
border-radius: 8px
|
|
246
|
+
));
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Method B: Overriding CSS Custom Properties directly
|
|
251
|
+
|
|
252
|
+
If you prefer not to include mixins, you can set the CSS variables directly in your MFE stylesheet:
|
|
253
|
+
|
|
254
|
+
```css
|
|
255
|
+
/* remote-mfe/src/styles.scss */
|
|
256
|
+
:root {
|
|
257
|
+
--cc-timepicker-accent: #C21E25;
|
|
258
|
+
--cc-timepicker-accent-light: rgba(194, 30, 37, 0.08);
|
|
259
|
+
--cc-timepicker-accent-border: rgba(194, 30, 37, 0.15);
|
|
260
|
+
--cc-timepicker-btn-confirm-bg: #C21E25;
|
|
261
|
+
--cc-timepicker-btn-confirm-hover: #a1141a;
|
|
262
|
+
--cc-timepicker-border-radius: 8px;
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## 5. Constraint Engine Enforcement
|
|
269
|
+
|
|
270
|
+
When `minTime` and/or `maxTime` is specified:
|
|
271
|
+
1. Slices of time that violate the boundaries are **automatically greyed out** (`opacity: 0.25`) and have pointer events disabled.
|
|
272
|
+
2. Clicking on a disabled item will not trigger selection.
|
|
273
|
+
3. Flicking or scrolling past a disabled value snaps to the **closest valid item** automatically.
|
|
274
|
+
4. Changing the AM/PM column to a period where the current hour is disabled triggers an automatic visual snap transition to a valid hour.
|
package/ng-package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
+
"dest": "./dist/commons-shared-web-ui",
|
|
4
|
+
"lib": {
|
|
5
|
+
"entryFile": "src/public-api.ts"
|
|
6
|
+
},
|
|
7
|
+
"assets": [
|
|
8
|
+
"src/lib/styles/global.scss",
|
|
9
|
+
"src/lib/styles/utilities.scss",
|
|
10
|
+
"src/lib/modules/pagination/pagination.theme.scss",
|
|
11
|
+
"src/lib/modules/summary-card/summary-card.theme.scss",
|
|
12
|
+
"src/lib/modules/button/button.theme.scss",
|
|
13
|
+
"src/lib/modules/alert/alert.theme.scss",
|
|
14
|
+
"src/lib/modules/confirmation-modal/confirmation-modal.theme.scss",
|
|
15
|
+
"src/lib/modules/filter-sidebar/filter-sidebar.theme.scss",
|
|
16
|
+
"src/lib/modules/filter/filter.theme.scss",
|
|
17
|
+
"src/lib/modules/nav/nav.theme.scss",
|
|
18
|
+
"src/lib/modules/configurable-form/configurable-form.theme.scss",
|
|
19
|
+
"src/lib/modules/form-components/form-components.theme.scss",
|
|
20
|
+
"src/lib/modules/form-components/**/_theme.scss",
|
|
21
|
+
"src/lib/modules/smart-table/smart-table.theme.scss",
|
|
22
|
+
"src/lib/modules/smart-form/smart-form.theme.scss",
|
|
23
|
+
"src/lib/modules/side-nav/side-nav.theme.scss",
|
|
24
|
+
"src/lib/modules/form-builder/form-builder.theme.scss",
|
|
25
|
+
"src/lib/modules/filter-table-selector/filter-table-selector.theme.scss",
|
|
26
|
+
"src/lib/modules/snackbar/snackbar.theme.scss",
|
|
27
|
+
"src/lib/modules/button-dropdown/button-dropdown.theme.scss",
|
|
28
|
+
"src/lib/modules/time-picker/time-picker.theme.scss"
|
|
29
|
+
]
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,35 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "commons-shared-web-ui",
|
|
3
|
+
"version": "0.0.62",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/animations": "20.3.15",
|
|
6
|
+
"@angular/cdk": "20.2.14",
|
|
7
|
+
"@angular/common": "20.3.15",
|
|
8
|
+
"@angular/compiler": "20.3.15",
|
|
9
|
+
"@angular/core": "20.3.15",
|
|
10
|
+
"@angular/forms": "20.3.15",
|
|
11
|
+
"@angular/material": "20.2.14",
|
|
12
|
+
"@angular/platform-browser": "20.3.15",
|
|
13
|
+
"@angular/platform-browser-dynamic": "20.3.15",
|
|
14
|
+
"@angular/router": "20.3.15",
|
|
15
|
+
"rxjs": "7.8.0",
|
|
16
|
+
"tslib": "^2.3.0",
|
|
17
|
+
"zone.js": "~0.14.0 || ~0.15.0",
|
|
18
|
+
"ngx-quill": "^28.0.0",
|
|
19
|
+
"quill": "^2.0.3"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"tslib": "^2.3.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@angular-devkit/build-angular": "20.3.13",
|
|
26
|
+
"@angular/animations": "20.3.15",
|
|
27
|
+
"@angular/cdk": "20.2.14",
|
|
28
|
+
"@angular/cli": "20.3.13",
|
|
29
|
+
"@angular/common": "20.3.15",
|
|
30
|
+
"@angular/compiler": "20.3.15",
|
|
31
|
+
"@angular/compiler-cli": "20.3.15",
|
|
32
|
+
"@angular/core": "20.3.15",
|
|
33
|
+
"@angular/forms": "20.3.15",
|
|
34
|
+
"@angular/material": "20.2.14",
|
|
35
|
+
"@angular/platform-browser": "20.3.15",
|
|
36
|
+
"@angular/platform-browser-dynamic": "20.3.15",
|
|
37
|
+
"@angular/router": "20.3.15",
|
|
38
|
+
"@types/jasmine": "~3.10.0",
|
|
39
|
+
"@types/node": "^20.11.1",
|
|
40
|
+
"jasmine-core": "~4.0.0",
|
|
41
|
+
"karma": "^6.4.4",
|
|
42
|
+
"karma-chrome-launcher": "~3.1.0",
|
|
43
|
+
"karma-coverage": "~2.1.0",
|
|
44
|
+
"karma-jasmine": "~4.0.0",
|
|
45
|
+
"karma-jasmine-html-reporter": "~1.7.0",
|
|
46
|
+
"ng-packagr": "^20.0.0",
|
|
47
|
+
"rxjs": "7.8.0",
|
|
48
|
+
"typescript": "^5.9.3",
|
|
49
|
+
"zone.js": "~0.15.0"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "ng-packagr -p ng-package.json"
|
|
53
|
+
}
|
|
35
54
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { AlertComponent } from './components/alert/alert.component';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
declarations: [
|
|
7
|
+
AlertComponent
|
|
8
|
+
],
|
|
9
|
+
imports: [
|
|
10
|
+
CommonModule
|
|
11
|
+
],
|
|
12
|
+
exports: [
|
|
13
|
+
AlertComponent
|
|
14
|
+
]
|
|
15
|
+
})
|
|
16
|
+
export class AlertModule { }
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<div class="cc-alert" [ngClass]="'cc-alert-' + variant" [style.width]="width" [style.height]="height"
|
|
2
|
+
[style.border-radius]="borderRadius" [style.border-top-left-radius]="borderTopLeftRadius"
|
|
3
|
+
[style.border-top-right-radius]="borderTopRightRadius" [style.border-bottom-left-radius]="borderBottomLeftRadius"
|
|
4
|
+
[style.border-bottom-right-radius]="borderBottomRightRadius" [style.padding]="padding" [style.gap]="gap"
|
|
5
|
+
[style.background-color]="backgroundColor" [style.color]="color" [style.border-color]="borderColor"
|
|
6
|
+
[style.font-size]="fontSize" [style.font-weight]="fontWeight" [style.box-shadow]="boxShadow">
|
|
7
|
+
|
|
8
|
+
<div class="cc-alert-icon" *ngIf="icon">
|
|
9
|
+
<i *ngIf="customIcon" [ngClass]="customIcon"></i>
|
|
10
|
+
<i *ngIf="!customIcon && isDefaultIcon" [ngClass]="defaultIconClass"></i>
|
|
11
|
+
<i *ngIf="!customIcon && isStringIcon && !isImgIcon" [ngClass]="iconString"></i>
|
|
12
|
+
<img *ngIf="!customIcon && isStringIcon && isImgIcon" [src]="iconString"
|
|
13
|
+
[attr.alt]="labels?.iconAltText || 'alert icon'" />
|
|
14
|
+
<ng-container *ngIf="isObjectIcon">
|
|
15
|
+
<i *ngIf="iconObject.type === 'fontawesome'" [ngClass]="iconObject.value"></i>
|
|
16
|
+
<span *ngIf="iconObject.type === 'material'" class="material-icons">{{ iconObject.value }}</span>
|
|
17
|
+
<img *ngIf="iconObject.type === 'img'" [src]="iconObject.value"
|
|
18
|
+
[attr.alt]="labels?.iconAltText || 'alert icon'" />
|
|
19
|
+
</ng-container>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div class="cc-alert-content">
|
|
23
|
+
<div class="cc-alert-title" *ngIf="title">{{ title }}</div>
|
|
24
|
+
<div class="cc-alert-message" *ngIf="message">{{ message }}</div>
|
|
25
|
+
<ng-content></ng-content>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
.cc-alert {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: flex-start;
|
|
4
|
+
width: 100%;
|
|
5
|
+
padding: var(--cc-alert-padding, 1rem 2rem);
|
|
6
|
+
border-radius: var(--cc-alert-radius, 0.75rem);
|
|
7
|
+
gap: var(--cc-alert-gap, 1rem);
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
font-family: var(--cc-alert-font-family, inherit);
|
|
10
|
+
|
|
11
|
+
.cc-alert-icon {
|
|
12
|
+
font-size: var(--cc-alert-icon-size, 1.25rem);
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
margin-top: var(--cc-alert-icon-margin-top, 0.125rem);
|
|
15
|
+
|
|
16
|
+
img {
|
|
17
|
+
width: var(--cc-alert-icon-size, 1.25rem);
|
|
18
|
+
height: var(--cc-alert-icon-size, 1.25rem);
|
|
19
|
+
object-fit: contain;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.cc-alert-content {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: 0.25rem; // Keeping small internal gap as is, or could be a var
|
|
27
|
+
flex-grow: 1;
|
|
28
|
+
|
|
29
|
+
.cc-alert-title {
|
|
30
|
+
font-weight: 700;
|
|
31
|
+
font-size: var(--cc-alert-title-size, 1rem);
|
|
32
|
+
line-height: var(--cc-alert-title-line-height, 1.5rem);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.cc-alert-message {
|
|
36
|
+
font-size: var(--cc-alert-message-size, 0.875rem);
|
|
37
|
+
line-height: 200%; // Relative unit is fine
|
|
38
|
+
opacity: 0.9;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Variants
|
|
43
|
+
&.cc-alert-info {
|
|
44
|
+
background-color: var(--cc-alert-info-bg);
|
|
45
|
+
color: var(--cc-alert-info-color);
|
|
46
|
+
|
|
47
|
+
.cc-alert-icon {
|
|
48
|
+
color: #5F6368;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.cc-alert-warning {
|
|
53
|
+
background-color: var(--cc-alert-warning-bg);
|
|
54
|
+
color: var(--cc-alert-warning-color);
|
|
55
|
+
|
|
56
|
+
.cc-alert-title {
|
|
57
|
+
color: var(--cc-alert-warning-title-color);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.cc-alert-icon {
|
|
61
|
+
color: var(--cc-alert-warning-title-color);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&.cc-alert-warning-shadow {
|
|
66
|
+
background-color: var(--cc-alert-warning-bg);
|
|
67
|
+
color: var(--cc-alert-warning-color);
|
|
68
|
+
box-shadow: var(--cc-alert-warning-shadow);
|
|
69
|
+
|
|
70
|
+
.cc-alert-title {
|
|
71
|
+
color: var(--cc-alert-warning-title-color);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.cc-alert-icon {
|
|
75
|
+
color: var(--cc-alert-warning-title-color);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.cc-alert-success {
|
|
80
|
+
background-color: var(--cc-alert-success-bg);
|
|
81
|
+
color: var(--cc-alert-success-color);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.cc-alert-error {
|
|
85
|
+
background-color: var(--cc-alert-error-bg);
|
|
86
|
+
color: var(--cc-alert-error-color);
|
|
87
|
+
|
|
88
|
+
.cc-alert-icon {
|
|
89
|
+
color: var(--cc-alert-error-color);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { AlertLabels, AlertVariant, IconInput } from '../../alert.models';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'lib-alert',
|
|
7
|
+
templateUrl: './alert.component.html',
|
|
8
|
+
styleUrls: ['./alert.component.scss'],
|
|
9
|
+
standalone: false
|
|
10
|
+
})
|
|
11
|
+
export class AlertComponent implements OnInit {
|
|
12
|
+
@Input() variant: AlertVariant = 'info';
|
|
13
|
+
@Input() title: string = '';
|
|
14
|
+
@Input() message: string = '';
|
|
15
|
+
@Input() icon: IconInput = true;
|
|
16
|
+
@Input() customIcon: string = ''; // New input for custom class
|
|
17
|
+
@Input() labels?: AlertLabels;
|
|
18
|
+
|
|
19
|
+
// Customization Inputs
|
|
20
|
+
@Input() width?: string;
|
|
21
|
+
@Input() height?: string;
|
|
22
|
+
@Input() borderRadius?: string;
|
|
23
|
+
@Input() padding?: string;
|
|
24
|
+
@Input() gap?: string;
|
|
25
|
+
@Input() backgroundColor?: string;
|
|
26
|
+
@Input() color?: string; // New input for custom text color
|
|
27
|
+
@Input() borderColor?: string;
|
|
28
|
+
@Input() fontSize?: string;
|
|
29
|
+
@Input() fontWeight?: string;
|
|
30
|
+
@Input() boxShadow?: string;
|
|
31
|
+
|
|
32
|
+
// Granular Border Radius Customization
|
|
33
|
+
@Input() borderTopLeftRadius?: string;
|
|
34
|
+
@Input() borderTopRightRadius?: string;
|
|
35
|
+
@Input() borderBottomLeftRadius?: string;
|
|
36
|
+
@Input() borderBottomRightRadius?: string;
|
|
37
|
+
|
|
38
|
+
constructor() { }
|
|
39
|
+
|
|
40
|
+
ngOnInit(): void {
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get isDefaultIcon(): boolean {
|
|
44
|
+
return this.icon === true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get isStringIcon(): boolean {
|
|
48
|
+
return typeof this.icon === 'string';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get isObjectIcon(): boolean {
|
|
52
|
+
return typeof this.icon === 'object' && this.icon !== null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get iconString(): string {
|
|
56
|
+
return typeof this.icon === 'string' ? this.icon : '';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get isImgIcon(): boolean {
|
|
60
|
+
const icon = this.icon;
|
|
61
|
+
if (typeof icon === 'string') {
|
|
62
|
+
return icon.includes('/') || icon.includes('.') || icon.startsWith('http');
|
|
63
|
+
}
|
|
64
|
+
return typeof icon === 'object' && icon !== null && icon.type === 'img';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get iconObject(): { type: string; value: string } {
|
|
68
|
+
return typeof this.icon === 'object' ? this.icon as any : { type: '', value: '' };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get defaultIconClass(): string {
|
|
72
|
+
switch (this.variant) {
|
|
73
|
+
case 'success': return 'fa-solid fa-circle-check';
|
|
74
|
+
case 'warning':
|
|
75
|
+
case 'warning-shadow': return 'fa-solid fa-triangle-exclamation';
|
|
76
|
+
case 'error': return 'fa-solid fa-triangle-exclamation';
|
|
77
|
+
case 'info':
|
|
78
|
+
default: return 'fa-solid fa-circle-info';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { ButtonComponent } from './components/button/button.component';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
declarations: [
|
|
7
|
+
ButtonComponent
|
|
8
|
+
],
|
|
9
|
+
imports: [
|
|
10
|
+
CommonModule
|
|
11
|
+
],
|
|
12
|
+
exports: [
|
|
13
|
+
ButtonComponent
|
|
14
|
+
]
|
|
15
|
+
})
|
|
16
|
+
export class ButtonModule { }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<button [type]="type" [disabled]="disabled" class="cc-btn" [ngClass]="'cc-btn-' + variant" [style.width]="width"
|
|
2
|
+
[style.height]="height" [style.border-radius]="borderRadius" [style.font-size]="fontSize"
|
|
3
|
+
[style.font-weight]="fontWeight" [style.background-color]="backgroundColor" [style.color]="color"
|
|
4
|
+
[style.border]="border">
|
|
5
|
+
<div class="cc-btn-icon-wrapper" *ngIf="icon">
|
|
6
|
+
<!-- String Icons -->
|
|
7
|
+
<ng-container *ngIf="isStringIcon">
|
|
8
|
+
<i *ngIf="!isImgIcon" [ngClass]="iconString" class="cc-btn-icon"></i>
|
|
9
|
+
<img *ngIf="isImgIcon" [src]="iconString" [attr.alt]="labels?.iconAltText || 'button icon'"
|
|
10
|
+
class="cc-btn-icon cc-btn-img-icon" />
|
|
11
|
+
</ng-container>
|
|
12
|
+
|
|
13
|
+
<!-- Object Icons -->
|
|
14
|
+
<ng-container *ngIf="isObjectIcon">
|
|
15
|
+
<i *ngIf="iconObject.type === 'fontawesome'" [ngClass]="iconObject.value" class="cc-btn-icon"></i>
|
|
16
|
+
<span *ngIf="iconObject.type === 'material'" class="material-icons cc-btn-icon">{{ iconObject.value }}</span>
|
|
17
|
+
<img *ngIf="iconObject.type === 'img'" [src]="iconObject.value" [attr.alt]="labels?.iconAltText || 'button icon'"
|
|
18
|
+
class="cc-btn-icon cc-btn-img-icon" />
|
|
19
|
+
</ng-container>
|
|
20
|
+
</div>
|
|
21
|
+
<ng-content></ng-content>
|
|
22
|
+
</button>
|