commons-shared-web-ui 0.0.49 → 0.0.50
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 +597 -0
- package/documentation/form-components.md +384 -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 +2405 -0
- package/documentation/smart-table.md +1221 -0
- package/documentation/snackbar.md +118 -0
- package/documentation/style-externalization.md +88 -0
- package/documentation/summary-card.md +279 -0
- package/ng-package.json +28 -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 +88 -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/button-dropdown.theme.scss +87 -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 +41 -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 +1196 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +2014 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +2525 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.html +65 -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 +131 -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 +1124 -0
- package/src/lib/modules/smart-form/index.ts +10 -0
- package/src/lib/modules/smart-form/models/form-schema.model.ts +733 -0
- package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +21 -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 +65 -0
- package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
- package/src/lib/modules/smart-form/smart-form.module.ts +36 -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 +1128 -0
- package/src/lib/modules/smart-table/models/table-config.model.ts +207 -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/shared-ui.module.ts +44 -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 +104 -0
- package/tsconfig.lib.json +15 -0
- package/fesm2022/commons-shared-web-ui.mjs +0 -13737
- package/fesm2022/commons-shared-web-ui.mjs.map +0 -1
- package/index.d.ts +0 -4231
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, forwardRef, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import { InputConfig, InputType, InputLabels } from './input.models';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'lib-input',
|
|
7
|
+
templateUrl: './input.component.html',
|
|
8
|
+
styleUrls: ['./input.component.scss'],
|
|
9
|
+
standalone: false,
|
|
10
|
+
providers: [
|
|
11
|
+
{
|
|
12
|
+
provide: NG_VALUE_ACCESSOR,
|
|
13
|
+
useExisting: forwardRef(() => InputComponent),
|
|
14
|
+
multi: true
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
})
|
|
18
|
+
export class InputComponent implements ControlValueAccessor, OnInit, OnChanges {
|
|
19
|
+
@Input() config?: InputConfig;
|
|
20
|
+
@Input() labels?: InputLabels;
|
|
21
|
+
@Input() type: InputType = 'text';
|
|
22
|
+
@Input() label: string = '';
|
|
23
|
+
@Input() placeholder: string = '';
|
|
24
|
+
@Input() disabled: boolean = false;
|
|
25
|
+
@Input() required: boolean = false;
|
|
26
|
+
@Input() readonly: boolean = false;
|
|
27
|
+
@Input() clearable: boolean = true;
|
|
28
|
+
@Input() maxLength?: number;
|
|
29
|
+
@Input() minLength?: number;
|
|
30
|
+
@Input() min?: number | string;
|
|
31
|
+
@Input() max?: number | string;
|
|
32
|
+
@Input() pattern?: string;
|
|
33
|
+
@Input() errorMessage: string = '';
|
|
34
|
+
@Input() helperText: string = '';
|
|
35
|
+
@Input() rows: number = 3;
|
|
36
|
+
@Input() prefixIcon?: any;
|
|
37
|
+
@Input() suffixIcon?: any;
|
|
38
|
+
@Input() value: any = '';
|
|
39
|
+
|
|
40
|
+
// Style inputs
|
|
41
|
+
@Input() width?: string;
|
|
42
|
+
@Input() height?: string;
|
|
43
|
+
@Input() borderRadius?: string;
|
|
44
|
+
@Input() fontSize?: string;
|
|
45
|
+
|
|
46
|
+
@Input() gap?: string;
|
|
47
|
+
@Input() fontFamily?: string;
|
|
48
|
+
@Input() labelColor?: string;
|
|
49
|
+
@Input() labelFontSize?: string;
|
|
50
|
+
@Input() labelFontWeight?: string;
|
|
51
|
+
|
|
52
|
+
@Input() backgroundColor?: string;
|
|
53
|
+
@Input() borderColor?: string;
|
|
54
|
+
@Input() borderWidth?: string;
|
|
55
|
+
@Input() padding?: string;
|
|
56
|
+
@Input() fontWeight?: string;
|
|
57
|
+
@Input() color?: string;
|
|
58
|
+
@Input() placeholderColor?: string;
|
|
59
|
+
@Input() focusBorderColor?: string;
|
|
60
|
+
@Input() errorColor?: string;
|
|
61
|
+
@Input() disabledBackgroundColor?: string;
|
|
62
|
+
@Input() disabledColor?: string;
|
|
63
|
+
@Input() boxShadow?: string;
|
|
64
|
+
|
|
65
|
+
@Output() valueChange = new EventEmitter<any>();
|
|
66
|
+
@Output() inputBlur = new EventEmitter<void>();
|
|
67
|
+
@Output() inputFocus = new EventEmitter<void>();
|
|
68
|
+
|
|
69
|
+
showPassword = false;
|
|
70
|
+
focused = false;
|
|
71
|
+
onChange: (value: any) => void = () => { };
|
|
72
|
+
onTouched: () => void = () => { };
|
|
73
|
+
|
|
74
|
+
ngOnInit(): void {
|
|
75
|
+
this.updateFromConfig();
|
|
76
|
+
this.updateFromLabels();
|
|
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.type = this.config.type ?? this.type;
|
|
91
|
+
this.label = this.config.label ?? this.label;
|
|
92
|
+
this.placeholder = this.config.placeholder ?? this.placeholder;
|
|
93
|
+
this.disabled = this.config.disabled ?? this.disabled;
|
|
94
|
+
this.required = this.config.required ?? this.required;
|
|
95
|
+
this.readonly = this.config.readonly ?? this.readonly;
|
|
96
|
+
this.maxLength = this.config.maxLength ?? this.maxLength;
|
|
97
|
+
this.minLength = this.config.minLength ?? this.minLength;
|
|
98
|
+
this.min = this.config.min ?? this.min;
|
|
99
|
+
this.max = this.config.max ?? this.max;
|
|
100
|
+
this.pattern = this.config.pattern ?? this.pattern;
|
|
101
|
+
this.errorMessage = this.config.errorMessage ?? this.errorMessage;
|
|
102
|
+
this.helperText = this.config.helperText ?? this.helperText;
|
|
103
|
+
this.rows = this.config.rows ?? this.rows;
|
|
104
|
+
this.prefixIcon = this.config.prefixIcon ?? this.prefixIcon;
|
|
105
|
+
this.suffixIcon = this.config.suffixIcon ?? this.suffixIcon;
|
|
106
|
+
|
|
107
|
+
// Style inputs
|
|
108
|
+
this.width = this.config.width ?? this.width;
|
|
109
|
+
this.height = this.config.height ?? this.height;
|
|
110
|
+
this.borderRadius = this.config.borderRadius ?? this.borderRadius;
|
|
111
|
+
this.fontSize = this.config.fontSize ?? this.fontSize;
|
|
112
|
+
this.gap = this.config.gap ?? this.gap;
|
|
113
|
+
this.fontFamily = this.config.fontFamily ?? this.fontFamily;
|
|
114
|
+
this.labelColor = this.config.labelColor ?? this.labelColor;
|
|
115
|
+
this.labelFontSize = this.config.labelFontSize ?? this.labelFontSize;
|
|
116
|
+
this.labelFontWeight = this.config.labelFontWeight ?? this.labelFontWeight;
|
|
117
|
+
this.backgroundColor = this.config.backgroundColor ?? this.backgroundColor;
|
|
118
|
+
this.borderColor = this.config.borderColor ?? this.borderColor;
|
|
119
|
+
this.borderWidth = this.config.borderWidth ?? this.borderWidth;
|
|
120
|
+
this.padding = this.config.padding ?? this.padding;
|
|
121
|
+
this.fontWeight = this.config.fontWeight ?? this.fontWeight;
|
|
122
|
+
this.color = this.config.color ?? this.color;
|
|
123
|
+
this.placeholderColor = this.config.placeholderColor ?? this.placeholderColor;
|
|
124
|
+
this.focusBorderColor = this.config.focusBorderColor ?? this.focusBorderColor;
|
|
125
|
+
this.errorColor = this.config.errorColor ?? this.errorColor;
|
|
126
|
+
this.disabledBackgroundColor = this.config.disabledBackgroundColor ?? this.disabledBackgroundColor;
|
|
127
|
+
this.disabledColor = this.config.disabledColor ?? this.disabledColor;
|
|
128
|
+
this.boxShadow = this.config.boxShadow ?? this.boxShadow;
|
|
129
|
+
|
|
130
|
+
if (this.config.value !== undefined) {
|
|
131
|
+
this.value = this.config.value;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private updateFromLabels(): void {
|
|
137
|
+
if (this.labels) {
|
|
138
|
+
this.label = this.labels.label || this.label;
|
|
139
|
+
this.placeholder = this.labels.placeholder || this.placeholder;
|
|
140
|
+
this.errorMessage = this.labels.errorMessage || this.errorMessage;
|
|
141
|
+
this.helperText = this.labels.helperText || this.helperText;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
get requiredMarker(): string {
|
|
146
|
+
return this.labels?.requiredMarker || '*';
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
writeValue(value: any): void {
|
|
150
|
+
this.value = value;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
registerOnChange(fn: any): void {
|
|
154
|
+
this.onChange = fn;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
registerOnTouched(fn: any): void {
|
|
158
|
+
this.onTouched = fn;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
setDisabledState(isDisabled: boolean): void {
|
|
162
|
+
this.disabled = isDisabled;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
onInputChange(event: any): void {
|
|
166
|
+
const value = event.target.value;
|
|
167
|
+
this.value = this.type === 'number' ? (value ? Number(value) : null) : value;
|
|
168
|
+
this.onChange(this.value);
|
|
169
|
+
this.valueChange.emit(this.value);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
onBlur(): void {
|
|
173
|
+
this.focused = false;
|
|
174
|
+
this.onTouched();
|
|
175
|
+
this.inputBlur.emit();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
onFocus(): void {
|
|
179
|
+
this.focused = true;
|
|
180
|
+
this.inputFocus.emit();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
togglePasswordVisibility(): void {
|
|
184
|
+
this.showPassword = !this.showPassword;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
getIconType(icon: any): 'material' | 'fontawesome' | 'img' | 'none' {
|
|
188
|
+
if (!icon) return 'none';
|
|
189
|
+
if (typeof icon === 'string') {
|
|
190
|
+
if (icon.includes('/') || icon.includes('.') || icon.startsWith('http')) {
|
|
191
|
+
return 'img';
|
|
192
|
+
}
|
|
193
|
+
return 'material';
|
|
194
|
+
}
|
|
195
|
+
return icon.type || 'material';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
getIconValue(icon: any): string {
|
|
199
|
+
if (typeof icon === 'string') return icon;
|
|
200
|
+
return icon?.value || '';
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
get inputType(): string {
|
|
204
|
+
if (this.type === 'password' && this.showPassword) {
|
|
205
|
+
return 'text';
|
|
206
|
+
}
|
|
207
|
+
return this.type === 'textarea' ? 'text' : this.type;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private getStyleValue(value: string | undefined): string | undefined {
|
|
211
|
+
return value ? `${value}` : undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
get wrapperStyles(): { [key: string]: string | undefined } {
|
|
215
|
+
return {
|
|
216
|
+
'width': this.getStyleValue(this.width),
|
|
217
|
+
'--cc-input-label-gap': this.getStyleValue(this.gap),
|
|
218
|
+
'--cc-input-font-family': this.getStyleValue(this.fontFamily)
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
get labelStyles(): { [key: string]: string | undefined } {
|
|
223
|
+
return {
|
|
224
|
+
'--cc-input-label-color': this.getStyleValue(this.labelColor),
|
|
225
|
+
'--cc-input-label-font-size': this.getStyleValue(this.labelFontSize),
|
|
226
|
+
'--cc-input-label-font-weight': this.getStyleValue(this.labelFontWeight)
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
get fieldStyles(): { [key: string]: string | undefined } {
|
|
231
|
+
return {
|
|
232
|
+
'--cc-input-bg': this.getStyleValue(this.backgroundColor),
|
|
233
|
+
'--cc-input-border-radius': this.getStyleValue(this.borderRadius),
|
|
234
|
+
'--cc-input-border-color': this.getStyleValue(this.borderColor),
|
|
235
|
+
'--cc-input-border-width': this.getStyleValue(this.borderWidth),
|
|
236
|
+
'--cc-input-height': this.getStyleValue(this.height),
|
|
237
|
+
'--cc-input-padding': this.getStyleValue(this.padding),
|
|
238
|
+
'--cc-input-font-size': this.getStyleValue(this.fontSize),
|
|
239
|
+
'--cc-input-font-weight': this.getStyleValue(this.fontWeight),
|
|
240
|
+
'--cc-input-color': this.getStyleValue(this.color),
|
|
241
|
+
'--cc-input-placeholder-color': this.getStyleValue(this.placeholderColor),
|
|
242
|
+
'--cc-input-focus-border-color': this.getStyleValue(this.focusBorderColor),
|
|
243
|
+
'--cc-input-error-color': this.getStyleValue(this.errorColor),
|
|
244
|
+
'--cc-input-disabled-bg': this.getStyleValue(this.disabledBackgroundColor),
|
|
245
|
+
'--cc-input-disabled-color': this.getStyleValue(this.disabledColor),
|
|
246
|
+
'box-shadow': this.getStyleValue(this.boxShadow)
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type InputType = 'text' | 'number' | 'email' | 'password' | 'tel' | 'url' | 'textarea';
|
|
2
|
+
|
|
3
|
+
export interface InputLabels {
|
|
4
|
+
label?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
errorMessage?: string;
|
|
7
|
+
helperText?: string;
|
|
8
|
+
requiredMarker?: string;
|
|
9
|
+
passwordToggleAriaLabel?: string;
|
|
10
|
+
prefixAltText?: string;
|
|
11
|
+
suffixAltText?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface InputConfig {
|
|
15
|
+
type?: InputType;
|
|
16
|
+
label?: string;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
value?: any;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
readonly?: boolean;
|
|
22
|
+
maxLength?: number;
|
|
23
|
+
minLength?: number;
|
|
24
|
+
min?: number;
|
|
25
|
+
max?: number;
|
|
26
|
+
pattern?: string;
|
|
27
|
+
errorMessage?: string;
|
|
28
|
+
helperText?: string;
|
|
29
|
+
rows?: number; // For textarea
|
|
30
|
+
// Icons
|
|
31
|
+
prefixIcon?: string | { type: 'material' | 'fontawesome' | 'img'; value: string };
|
|
32
|
+
suffixIcon?: string | { type: 'material' | 'fontawesome' | 'img'; value: string };
|
|
33
|
+
// Customization
|
|
34
|
+
width?: string;
|
|
35
|
+
height?: string;
|
|
36
|
+
borderRadius?: string;
|
|
37
|
+
fontSize?: string;
|
|
38
|
+
gap?: string;
|
|
39
|
+
fontFamily?: string;
|
|
40
|
+
labelColor?: string;
|
|
41
|
+
labelFontSize?: string;
|
|
42
|
+
labelFontWeight?: string;
|
|
43
|
+
backgroundColor?: string;
|
|
44
|
+
borderColor?: string;
|
|
45
|
+
borderWidth?: string;
|
|
46
|
+
padding?: string;
|
|
47
|
+
fontWeight?: string;
|
|
48
|
+
color?: string;
|
|
49
|
+
placeholderColor?: string;
|
|
50
|
+
focusBorderColor?: string;
|
|
51
|
+
errorColor?: string;
|
|
52
|
+
disabledBackgroundColor?: string;
|
|
53
|
+
disabledColor?: string;
|
|
54
|
+
boxShadow?: string;
|
|
55
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<div class="cc-radio-wrapper" [ngStyle]="wrapperStyles">
|
|
2
|
+
<label *ngIf="label" class="cc-radio-group-label" [class.disabled]="disabled">
|
|
3
|
+
{{ label }}
|
|
4
|
+
<span *ngIf="required" class="cc-required">{{ requiredMarker }}</span>
|
|
5
|
+
</label>
|
|
6
|
+
|
|
7
|
+
<div class="cc-radio-group" [class.horizontal]="layout === 'horizontal'" [class.vertical]="layout === 'vertical'"
|
|
8
|
+
role="radiogroup">
|
|
9
|
+
|
|
10
|
+
<label class="cc-radio-label" *ngFor="let option of visibleOptions; let i = index"
|
|
11
|
+
[class.disabled]="disabled || option.disabled" [class.checked]="value === option.value"
|
|
12
|
+
[class.label-before]="labelPosition === 'before'">
|
|
13
|
+
|
|
14
|
+
<input type="radio" [name]="uuid" [value]="option.value" [checked]="value === option.value"
|
|
15
|
+
[disabled]="disabled || option.disabled" (change)="onRadioChange(option)" class="cc-native-radio"
|
|
16
|
+
[id]="uuid + '-' + i">
|
|
17
|
+
|
|
18
|
+
<span class="cc-radio-circle"></span>
|
|
19
|
+
<span class="cc-text">{{ option.label }}</span>
|
|
20
|
+
</label>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* Radio Component - Alternative Approach with Native Fallback */
|
|
2
|
+
|
|
3
|
+
.cc-radio-wrapper {
|
|
4
|
+
display: block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
font-family: var(--cc-radio-font-family, inherit);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cc-radio-group-label {
|
|
10
|
+
display: block;
|
|
11
|
+
font-size: var(--cc-radio-group-label-font-size, 14px);
|
|
12
|
+
font-weight: var(--cc-radio-group-label-font-weight, 500);
|
|
13
|
+
color: var(--cc-radio-group-label-color, #202124);
|
|
14
|
+
margin-bottom: 8px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.cc-radio-group {
|
|
18
|
+
display: flex;
|
|
19
|
+
gap: var(--cc-radio-group-gap, 12px);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.cc-radio-group.vertical {
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.cc-radio-group.horizontal {
|
|
27
|
+
flex-direction: row;
|
|
28
|
+
flex-wrap: wrap;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.cc-radio-label {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
font-size: var(--cc-radio-font-size, 14px);
|
|
36
|
+
color: var(--cc-radio-label-color, #202124);
|
|
37
|
+
user-select: none;
|
|
38
|
+
padding: 4px 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* APPROACH 1: Custom Circle (Primary) */
|
|
42
|
+
.cc-native-radio {
|
|
43
|
+
/* Completely hide but keep accessible */
|
|
44
|
+
position: absolute;
|
|
45
|
+
left: -9999px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.cc-radio-circle {
|
|
49
|
+
width: var(--cc-radio-size, 20px);
|
|
50
|
+
height: var(--cc-radio-size, 20px);
|
|
51
|
+
border: 2px solid var(--cc-radio-unchecked-color, #5F6368);
|
|
52
|
+
border-radius: var(--cc-radio-border-radius, 50%);
|
|
53
|
+
margin-right: 8px;
|
|
54
|
+
flex-shrink: 0;
|
|
55
|
+
position: relative;
|
|
56
|
+
background: white;
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.cc-radio-circle::after {
|
|
61
|
+
content: '';
|
|
62
|
+
width: calc(var(--cc-radio-size, 20px) * 0.5);
|
|
63
|
+
height: calc(var(--cc-radio-size, 20px) * 0.5);
|
|
64
|
+
background: var(--cc-radio-checked-color, #1A73E8);
|
|
65
|
+
border-radius: var(--cc-radio-border-radius, 50%);
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: 50%;
|
|
68
|
+
left: 50%;
|
|
69
|
+
transform: translate(-50%, -50%) scale(0);
|
|
70
|
+
transition: transform 0.2s;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.cc-native-radio:checked+.cc-radio-circle {
|
|
74
|
+
border-color: var(--cc-radio-checked-color, #1A73E8);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.cc-native-radio:checked+.cc-radio-circle::after {
|
|
78
|
+
transform: translate(-50%, -50%) scale(1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* APPROACH 2: Visible Native Radio (Fallback - uncomment if custom doesn't work) */
|
|
82
|
+
/*
|
|
83
|
+
.cc-native-radio {
|
|
84
|
+
width: 20px;
|
|
85
|
+
height: 20px;
|
|
86
|
+
margin-right: 8px;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
flex-shrink: 0;
|
|
89
|
+
appearance: auto;
|
|
90
|
+
-webkit-appearance: radio;
|
|
91
|
+
-moz-appearance: radio;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.cc-radio-circle {
|
|
95
|
+
display: none;
|
|
96
|
+
}
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
.cc-text {
|
|
100
|
+
line-height: 1.5;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Disabled states */
|
|
104
|
+
.cc-radio-label.disabled {
|
|
105
|
+
opacity: 0.5;
|
|
106
|
+
cursor: not-allowed;
|
|
107
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, forwardRef, OnInit } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import { RadioConfig, RadioOption, RadioLabels } from './radio.models';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'lib-radio',
|
|
7
|
+
templateUrl: './radio.component.html',
|
|
8
|
+
styleUrls: ['./radio.component.scss'],
|
|
9
|
+
standalone: false,
|
|
10
|
+
providers: [
|
|
11
|
+
{
|
|
12
|
+
provide: NG_VALUE_ACCESSOR,
|
|
13
|
+
useExisting: forwardRef(() => RadioComponent),
|
|
14
|
+
multi: true
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
})
|
|
18
|
+
export class RadioComponent implements ControlValueAccessor, OnInit {
|
|
19
|
+
@Input() config?: RadioConfig;
|
|
20
|
+
@Input() label: string = '';
|
|
21
|
+
@Input() options: RadioOption[] = [];
|
|
22
|
+
@Input() disabled: boolean = false;
|
|
23
|
+
@Input() required: boolean = false;
|
|
24
|
+
@Input() labelPosition: 'before' | 'after' = 'after';
|
|
25
|
+
@Input() color: 'primary' | 'warning' | 'danger' | 'success' | 'accent' | 'warn' | string = 'primary';
|
|
26
|
+
@Input() layout: 'vertical' | 'horizontal' = 'vertical';
|
|
27
|
+
|
|
28
|
+
// i18n Labels
|
|
29
|
+
@Input() labels: RadioLabels = {};
|
|
30
|
+
|
|
31
|
+
// Customization — Layout
|
|
32
|
+
@Input() gap?: string;
|
|
33
|
+
|
|
34
|
+
// Customization — Colors
|
|
35
|
+
@Input() labelColor?: string;
|
|
36
|
+
@Input() checkedColor?: string;
|
|
37
|
+
@Input() uncheckedColor?: string;
|
|
38
|
+
|
|
39
|
+
// Customization — Typography
|
|
40
|
+
@Input() fontSize?: string;
|
|
41
|
+
@Input() fontWeight?: string;
|
|
42
|
+
@Input() fontFamily?: string;
|
|
43
|
+
|
|
44
|
+
// Customization — Group label
|
|
45
|
+
@Input() groupLabelColor?: string;
|
|
46
|
+
@Input() groupLabelFontSize?: string;
|
|
47
|
+
@Input() groupLabelFontWeight?: string;
|
|
48
|
+
|
|
49
|
+
// Customization — States
|
|
50
|
+
@Input() disabledColor?: string;
|
|
51
|
+
@Input() errorColor?: string;
|
|
52
|
+
|
|
53
|
+
// Customization — Size
|
|
54
|
+
@Input() size?: string;
|
|
55
|
+
@Input() borderRadius?: string;
|
|
56
|
+
|
|
57
|
+
// Customization — Synonyms for Playground
|
|
58
|
+
@Input() labelFontSize?: string;
|
|
59
|
+
@Input() labelFontWeight?: string;
|
|
60
|
+
|
|
61
|
+
@Output() selectionChange = new EventEmitter<any>();
|
|
62
|
+
|
|
63
|
+
value: any;
|
|
64
|
+
uuid = `radio-group-${Math.random().toString(36).substr(2, 9)}`;
|
|
65
|
+
|
|
66
|
+
private onChange: (value: any) => void = () => { };
|
|
67
|
+
private onTouched: () => void = () => { };
|
|
68
|
+
|
|
69
|
+
ngOnInit(): void {
|
|
70
|
+
this.updateFromConfig();
|
|
71
|
+
// i18n labels override
|
|
72
|
+
if (this.labels) {
|
|
73
|
+
this.label = this.labels.label || this.label;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
ngOnChanges(changes: any): void {
|
|
78
|
+
if (changes.config) {
|
|
79
|
+
this.updateFromConfig();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private updateFromConfig(): void {
|
|
84
|
+
if (this.config) {
|
|
85
|
+
this.label = this.config.label ?? this.label;
|
|
86
|
+
this.options = this.config.options || this.options;
|
|
87
|
+
this.disabled = this.config.disabled ?? this.disabled;
|
|
88
|
+
this.required = this.config.required ?? this.required;
|
|
89
|
+
this.labelPosition = this.config.labelPosition ?? this.labelPosition;
|
|
90
|
+
this.color = this.config.color ?? this.color;
|
|
91
|
+
this.layout = this.config.layout ?? this.layout;
|
|
92
|
+
this.value = this.config.value;
|
|
93
|
+
|
|
94
|
+
// Style mappings
|
|
95
|
+
this.gap = this.config.gap ?? this.gap;
|
|
96
|
+
this.labelColor = this.config.labelColor ?? this.labelColor;
|
|
97
|
+
this.checkedColor = this.config.checkedColor ?? this.checkedColor;
|
|
98
|
+
this.uncheckedColor = this.config.uncheckedColor ?? this.uncheckedColor;
|
|
99
|
+
this.fontSize = this.config.fontSize ?? this.fontSize;
|
|
100
|
+
this.fontWeight = this.config.fontWeight ?? this.fontWeight;
|
|
101
|
+
this.fontFamily = this.config.fontFamily ?? this.fontFamily;
|
|
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.disabledColor = this.config.disabledColor ?? this.disabledColor;
|
|
106
|
+
this.errorColor = this.config.errorColor ?? this.errorColor;
|
|
107
|
+
this.size = this.config.size ?? this.size;
|
|
108
|
+
this.borderRadius = this.config.borderRadius ?? this.borderRadius;
|
|
109
|
+
this.labelFontSize = this.config.labelFontSize ?? this.labelFontSize;
|
|
110
|
+
this.labelFontWeight = this.config.labelFontWeight ?? this.labelFontWeight;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
get requiredMarker(): string {
|
|
116
|
+
return this.labels?.requiredMarker || '*';
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
get visibleOptions(): RadioOption[] {
|
|
120
|
+
return this.options.filter(o => o.label != null && o.label !== '');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
writeValue(value: any): void {
|
|
124
|
+
this.value = value;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
registerOnChange(fn: any): void {
|
|
128
|
+
this.onChange = fn;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
registerOnTouched(fn: any): void {
|
|
132
|
+
this.onTouched = fn;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
setDisabledState(isDisabled: boolean): void {
|
|
136
|
+
this.disabled = isDisabled;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
onRadioChange(option: RadioOption): void {
|
|
140
|
+
this.value = option.value;
|
|
141
|
+
this.onChange(this.value);
|
|
142
|
+
this.onTouched();
|
|
143
|
+
this.selectionChange.emit(this.value);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private getStyleValue(value: string | undefined): string | undefined {
|
|
147
|
+
return value ? `${value}` : undefined;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private getThemeColor(colorStr: string | undefined): string | undefined {
|
|
151
|
+
if (!colorStr) return undefined;
|
|
152
|
+
const themeColors: { [key: string]: string } = {
|
|
153
|
+
'primary': 'var(--cc-radio-primary-bg, var(--cc-btn-primary-bg, #1A73E8))',
|
|
154
|
+
'warning': 'var(--cc-radio-warning-bg, var(--cc-btn-warning-bg, #F9C80E))',
|
|
155
|
+
'danger': 'var(--cc-radio-danger-bg, var(--cc-btn-danger-bg, #dc3545))',
|
|
156
|
+
'success': 'var(--cc-radio-success-bg, var(--cc-btn-success-bg, #28a745))',
|
|
157
|
+
'warn': 'var(--cc-radio-danger-bg, var(--cc-btn-danger-bg, #dc3545))',
|
|
158
|
+
'accent': 'var(--cc-radio-accent-bg, #ff4081)'
|
|
159
|
+
};
|
|
160
|
+
return themeColors[colorStr] || colorStr;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
get wrapperStyles(): { [key: string]: string | undefined } {
|
|
164
|
+
return {
|
|
165
|
+
'--cc-radio-font-family': this.getStyleValue(this.fontFamily),
|
|
166
|
+
'--cc-radio-font-size': this.getStyleValue(this.fontSize || this.labelFontSize),
|
|
167
|
+
'--cc-radio-font-weight': this.getStyleValue(this.fontWeight || this.labelFontWeight),
|
|
168
|
+
'--cc-radio-label-color': this.getStyleValue(this.labelColor),
|
|
169
|
+
'--cc-radio-size': this.getStyleValue(this.size),
|
|
170
|
+
'--cc-radio-border-radius': this.getStyleValue(this.borderRadius),
|
|
171
|
+
'--cc-radio-checked-color': this.getStyleValue(this.getThemeColor(this.checkedColor || this.color)),
|
|
172
|
+
'--cc-radio-unchecked-color': this.getStyleValue(this.uncheckedColor),
|
|
173
|
+
'--cc-radio-disabled-color': this.getStyleValue(this.disabledColor),
|
|
174
|
+
'--cc-radio-error-color': this.getStyleValue(this.errorColor),
|
|
175
|
+
'--cc-radio-group-gap': this.getStyleValue(this.gap),
|
|
176
|
+
'--cc-radio-group-label-color': this.getStyleValue(this.groupLabelColor),
|
|
177
|
+
'--cc-radio-group-label-font-size': this.getStyleValue(this.groupLabelFontSize),
|
|
178
|
+
'--cc-radio-group-label-font-weight': this.getStyleValue(this.groupLabelFontWeight)
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface RadioOption {
|
|
2
|
+
value: any;
|
|
3
|
+
label: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface RadioLabels {
|
|
8
|
+
label?: string;
|
|
9
|
+
requiredMarker?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface RadioConfig {
|
|
13
|
+
label?: string;
|
|
14
|
+
options: RadioOption[];
|
|
15
|
+
value?: any;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
labelPosition?: 'before' | 'after';
|
|
19
|
+
color?: 'primary' | 'warning' | 'danger' | 'success' | 'accent' | 'warn' | string;
|
|
20
|
+
layout?: 'vertical' | 'horizontal';
|
|
21
|
+
|
|
22
|
+
// Customization
|
|
23
|
+
gap?: string;
|
|
24
|
+
labelColor?: string;
|
|
25
|
+
checkedColor?: string;
|
|
26
|
+
uncheckedColor?: string;
|
|
27
|
+
fontSize?: string;
|
|
28
|
+
fontWeight?: string;
|
|
29
|
+
fontFamily?: string;
|
|
30
|
+
groupLabelColor?: string;
|
|
31
|
+
groupLabelFontSize?: string;
|
|
32
|
+
groupLabelFontWeight?: string;
|
|
33
|
+
disabledColor?: string;
|
|
34
|
+
errorColor?: string;
|
|
35
|
+
size?: string;
|
|
36
|
+
borderRadius?: string;
|
|
37
|
+
labelFontSize?: string;
|
|
38
|
+
labelFontWeight?: string;
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="cc-search-wrapper" [ngStyle]="wrapperStyles">
|
|
2
|
+
<label *ngIf="label" class="cc-search-label" [ngStyle]="labelStyles">{{ label }}</label>
|
|
3
|
+
|
|
4
|
+
<div class="cc-search-field" [class.focused]="focused" [class.disabled]="disabled" [ngStyle]="fieldStyles">
|
|
5
|
+
<span class="cc-search-icon material-icons">search</span>
|
|
6
|
+
|
|
7
|
+
<input type="text" class="cc-search-input" [value]="value" [placeholder]="placeholder" [disabled]="disabled"
|
|
8
|
+
(input)="onInputChange($event)" (blur)="onBlur()" (focus)="onFocus()" />
|
|
9
|
+
|
|
10
|
+
<button *ngIf="clearable && value && !disabled" type="button" class="cc-clear-btn" (click)="onClear()"
|
|
11
|
+
[attr.aria-label]="clearAriaLabel">
|
|
12
|
+
<span class="material-icons">close</span>
|
|
13
|
+
</button>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|