ngx-opalbytes-components 1.26.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -0
- package/fesm2022/ngx-opalbytes-components.mjs +269 -1
- package/fesm2022/ngx-opalbytes-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/shared/components/checkbox/checkbox.component.css +131 -0
- package/src/lib/shared/components/checkbox/checkbox.component.html +84 -0
- package/src/lib/shared/components/checkbox/checkbox.component.spec.ts +344 -0
- package/src/lib/shared/components/checkbox/checkbox.component.ts +258 -0
- package/src/lib/shared/components/checkbox/checkbox.stories.ts +240 -0
- package/src/lib/shared/components/index.ts +1 -0
- package/types/ngx-opalbytes-components.d.ts +72 -2
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { CommonModule } from "@angular/common";
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
ChangeDetectorRef,
|
|
5
|
+
Component,
|
|
6
|
+
EventEmitter,
|
|
7
|
+
forwardRef,
|
|
8
|
+
HostBinding,
|
|
9
|
+
inject,
|
|
10
|
+
Input,
|
|
11
|
+
OnChanges,
|
|
12
|
+
OnDestroy,
|
|
13
|
+
Output,
|
|
14
|
+
SimpleChanges,
|
|
15
|
+
} from "@angular/core";
|
|
16
|
+
import { AbstractControl, ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
17
|
+
|
|
18
|
+
import { LucideDynamicIcon } from "@lucide/angular";
|
|
19
|
+
import { Subscription } from "rxjs";
|
|
20
|
+
|
|
21
|
+
let nextCheckboxId = 0;
|
|
22
|
+
|
|
23
|
+
export interface ICaoCheckboxChangeEvent {
|
|
24
|
+
checked: boolean;
|
|
25
|
+
source: CaoCheckboxComponent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@Component({
|
|
29
|
+
selector: "cao-checkbox",
|
|
30
|
+
standalone: true,
|
|
31
|
+
imports: [CommonModule, LucideDynamicIcon],
|
|
32
|
+
templateUrl: "./checkbox.component.html",
|
|
33
|
+
styleUrl: "./checkbox.component.css",
|
|
34
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
35
|
+
providers: [
|
|
36
|
+
{
|
|
37
|
+
provide: NG_VALUE_ACCESSOR,
|
|
38
|
+
useExisting: forwardRef(() => CaoCheckboxComponent),
|
|
39
|
+
multi: true,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
})
|
|
43
|
+
export class CaoCheckboxComponent implements ControlValueAccessor, OnChanges, OnDestroy {
|
|
44
|
+
@Input() checked = false;
|
|
45
|
+
@Input() indeterminate = false;
|
|
46
|
+
@Input() isDisabled = false;
|
|
47
|
+
@Input() required = false;
|
|
48
|
+
@Input() label = "";
|
|
49
|
+
@Input() labelPosition: "before" | "after" = "after";
|
|
50
|
+
@Input() name = "";
|
|
51
|
+
@Input() id = "";
|
|
52
|
+
@Input() ariaLabel = "";
|
|
53
|
+
@Input() ariaLabelledBy = "";
|
|
54
|
+
@Input() dataCy = "";
|
|
55
|
+
@Input() control?: AbstractControl | null;
|
|
56
|
+
@Input() errorMessage = "";
|
|
57
|
+
|
|
58
|
+
@Input() color?: string;
|
|
59
|
+
@Input() uncheckedColor?: string;
|
|
60
|
+
@Input() disabledColor?: string;
|
|
61
|
+
@Input() labelColor?: string;
|
|
62
|
+
@Input() disabledLabelColor?: string;
|
|
63
|
+
@Input() focusRingColor?: string;
|
|
64
|
+
|
|
65
|
+
@Input() size?: string;
|
|
66
|
+
@Input() borderRadius?: string;
|
|
67
|
+
@Input() animationDuration?: string;
|
|
68
|
+
|
|
69
|
+
@Input() checkedIcon = "";
|
|
70
|
+
@Input() uncheckedIcon = "";
|
|
71
|
+
@Input() indeterminateIcon = "";
|
|
72
|
+
@Input() isLucideIcon = false;
|
|
73
|
+
@Input() iconColor = "";
|
|
74
|
+
@Input() checkedIconColor = "";
|
|
75
|
+
@Input() uncheckedIconColor = "";
|
|
76
|
+
@Input() iconSize: string | number = 14;
|
|
77
|
+
@Input() iconStrokeWidth: string | number = 2.5;
|
|
78
|
+
|
|
79
|
+
@Input() set disabled(value: boolean) {
|
|
80
|
+
this.isDisabled = value;
|
|
81
|
+
this.cdr.markForCheck();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
get disabled(): boolean {
|
|
85
|
+
return this.isDisabled;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@Output() readonly checkedChange = new EventEmitter<boolean>();
|
|
89
|
+
@Output() readonly indeterminateChange = new EventEmitter<boolean>();
|
|
90
|
+
@Output() readonly checkboxChange = new EventEmitter<ICaoCheckboxChangeEvent>();
|
|
91
|
+
|
|
92
|
+
private readonly cdr = inject(ChangeDetectorRef);
|
|
93
|
+
private readonly uid = `cao-checkbox-${nextCheckboxId++}`;
|
|
94
|
+
private controlSub?: Subscription;
|
|
95
|
+
private onChange: (value: boolean) => void = () => {};
|
|
96
|
+
private onTouched: () => void = () => {};
|
|
97
|
+
|
|
98
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
99
|
+
if (changes["control"]) {
|
|
100
|
+
this.controlSub?.unsubscribe();
|
|
101
|
+
this.controlSub = this.control?.statusChanges.subscribe(() =>
|
|
102
|
+
this.cdr.markForCheck(),
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
ngOnDestroy(): void {
|
|
108
|
+
this.controlSub?.unsubscribe();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
get inputId(): string {
|
|
112
|
+
return this.id || this.uid;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
get hasError(): boolean {
|
|
116
|
+
return !!this.errorMessage;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
get hasInvalidState(): boolean {
|
|
120
|
+
return !!(this.control?.touched && this.control?.invalid);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
get hasValidState(): boolean {
|
|
124
|
+
return !!(this.control?.touched && this.control?.valid);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
get resolvedIconColor(): string {
|
|
128
|
+
if (this.indeterminate) {
|
|
129
|
+
return this.iconColor || this.checkedIconColor;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return this.checked
|
|
133
|
+
? this.checkedIconColor || this.iconColor
|
|
134
|
+
: this.uncheckedIconColor || this.iconColor;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@HostBinding("style")
|
|
138
|
+
get hostStyles(): Record<string, string> {
|
|
139
|
+
const styles: Record<string, string> = {};
|
|
140
|
+
|
|
141
|
+
if (this.color) {
|
|
142
|
+
styles["--cao-checkbox-color"] = this.color;
|
|
143
|
+
}
|
|
144
|
+
if (this.uncheckedColor) {
|
|
145
|
+
styles["--cao-checkbox-unselected"] = this.uncheckedColor;
|
|
146
|
+
}
|
|
147
|
+
if (this.disabledColor) {
|
|
148
|
+
styles["--cao-checkbox-disabled"] = this.disabledColor;
|
|
149
|
+
}
|
|
150
|
+
if (this.labelColor) {
|
|
151
|
+
styles["--cao-checkbox-label"] = this.labelColor;
|
|
152
|
+
}
|
|
153
|
+
if (this.disabledLabelColor) {
|
|
154
|
+
styles["--cao-checkbox-label-disabled"] = this.disabledLabelColor;
|
|
155
|
+
}
|
|
156
|
+
if (this.focusRingColor) {
|
|
157
|
+
styles["--cao-checkbox-focus-ring"] = this.focusRingColor;
|
|
158
|
+
}
|
|
159
|
+
if (this.size) {
|
|
160
|
+
styles["--cao-checkbox-size"] = this.size;
|
|
161
|
+
}
|
|
162
|
+
if (this.borderRadius) {
|
|
163
|
+
styles["--cao-checkbox-radius"] = this.borderRadius;
|
|
164
|
+
}
|
|
165
|
+
if (this.animationDuration) {
|
|
166
|
+
styles["--cao-checkbox-duration"] = this.animationDuration;
|
|
167
|
+
}
|
|
168
|
+
if (this.resolvedIconColor) {
|
|
169
|
+
styles["--cao-checkbox-icon-color"] = this.resolvedIconColor;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
styles["--cao-checkbox-icon-size"] = this.toCssLength(this.iconSize);
|
|
173
|
+
|
|
174
|
+
return styles;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
toggle(): void {
|
|
178
|
+
if (this.isDisabled) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
this.setChecked(!this.checked, true);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
setChecked(value: boolean, emit = true): void {
|
|
186
|
+
if (this.isDisabled) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const wasIndeterminate = this.indeterminate;
|
|
191
|
+
|
|
192
|
+
this.checked = value;
|
|
193
|
+
this.indeterminate = false;
|
|
194
|
+
this.onChange(value);
|
|
195
|
+
|
|
196
|
+
if (emit) {
|
|
197
|
+
this.checkedChange.emit(value);
|
|
198
|
+
this.checkboxChange.emit({ checked: value, source: this });
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (wasIndeterminate) {
|
|
202
|
+
this.indeterminateChange.emit(false);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
this.cdr.markForCheck();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
setIndeterminate(value: boolean): void {
|
|
209
|
+
if (this.isDisabled || this.indeterminate === value) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
this.indeterminate = value;
|
|
214
|
+
this.indeterminateChange.emit(value);
|
|
215
|
+
this.cdr.markForCheck();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
enable(): void {
|
|
219
|
+
this.isDisabled = false;
|
|
220
|
+
this.cdr.markForCheck();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
disable(): void {
|
|
224
|
+
this.isDisabled = true;
|
|
225
|
+
this.cdr.markForCheck();
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
onInputChange(event: Event): void {
|
|
229
|
+
const target = event.target as HTMLInputElement;
|
|
230
|
+
this.setChecked(target.checked, true);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
onBlur(): void {
|
|
234
|
+
this.onTouched();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
writeValue(value: boolean | null): void {
|
|
238
|
+
this.checked = !!value;
|
|
239
|
+
this.cdr.markForCheck();
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
registerOnChange(fn: (value: boolean) => void): void {
|
|
243
|
+
this.onChange = fn;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
registerOnTouched(fn: () => void): void {
|
|
247
|
+
this.onTouched = fn;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
setDisabledState(isDisabled: boolean): void {
|
|
251
|
+
this.isDisabled = isDisabled;
|
|
252
|
+
this.cdr.markForCheck();
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
private toCssLength(value: string | number): string {
|
|
256
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { FormsModule } from '@angular/forms';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
LucideCheck,
|
|
5
|
+
LucideCircle,
|
|
6
|
+
LucideHeart,
|
|
7
|
+
LucideMinus,
|
|
8
|
+
LucideX,
|
|
9
|
+
provideLucideIcons,
|
|
10
|
+
} from '@lucide/angular';
|
|
11
|
+
import { applicationConfig, type Meta, type StoryObj } from '@storybook/angular-vite';
|
|
12
|
+
import { fn } from 'storybook/test';
|
|
13
|
+
|
|
14
|
+
import { CaoCheckboxComponent } from './checkbox.component';
|
|
15
|
+
|
|
16
|
+
const imageIcon =
|
|
17
|
+
'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Ccircle cx="12" cy="12" r="8" fill="%234f46e5"/%3E%3C/svg%3E';
|
|
18
|
+
|
|
19
|
+
const meta: Meta<CaoCheckboxComponent> = {
|
|
20
|
+
title: 'Componentes/Checkbox',
|
|
21
|
+
component: CaoCheckboxComponent,
|
|
22
|
+
tags: ['autodocs'],
|
|
23
|
+
decorators: [
|
|
24
|
+
applicationConfig({
|
|
25
|
+
providers: [
|
|
26
|
+
provideLucideIcons(
|
|
27
|
+
LucideCheck,
|
|
28
|
+
LucideMinus,
|
|
29
|
+
LucideX,
|
|
30
|
+
LucideCircle,
|
|
31
|
+
LucideHeart,
|
|
32
|
+
),
|
|
33
|
+
],
|
|
34
|
+
}),
|
|
35
|
+
(story) => ({
|
|
36
|
+
...story,
|
|
37
|
+
moduleMetadata: {
|
|
38
|
+
imports: [FormsModule],
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
],
|
|
42
|
+
argTypes: {
|
|
43
|
+
checked: { control: 'boolean' },
|
|
44
|
+
indeterminate: { control: 'boolean' },
|
|
45
|
+
isDisabled: { control: 'boolean' },
|
|
46
|
+
disabled: { control: 'boolean' },
|
|
47
|
+
required: { control: 'boolean' },
|
|
48
|
+
label: { control: 'text' },
|
|
49
|
+
labelPosition: { control: 'select', options: ['before', 'after'] },
|
|
50
|
+
name: { control: 'text' },
|
|
51
|
+
id: { control: 'text' },
|
|
52
|
+
ariaLabel: { control: 'text' },
|
|
53
|
+
ariaLabelledBy: { control: 'text' },
|
|
54
|
+
dataCy: { control: 'text' },
|
|
55
|
+
color: { control: 'color' },
|
|
56
|
+
uncheckedColor: { control: 'color' },
|
|
57
|
+
disabledColor: { control: 'color' },
|
|
58
|
+
labelColor: { control: 'color' },
|
|
59
|
+
disabledLabelColor: { control: 'color' },
|
|
60
|
+
focusRingColor: { control: 'color' },
|
|
61
|
+
size: { control: 'text' },
|
|
62
|
+
borderRadius: { control: 'text' },
|
|
63
|
+
animationDuration: { control: 'text' },
|
|
64
|
+
checkedIcon: { control: 'text' },
|
|
65
|
+
uncheckedIcon: { control: 'text' },
|
|
66
|
+
indeterminateIcon: { control: 'text' },
|
|
67
|
+
isLucideIcon: { control: 'boolean' },
|
|
68
|
+
iconColor: { control: 'color' },
|
|
69
|
+
checkedIconColor: { control: 'color' },
|
|
70
|
+
uncheckedIconColor: { control: 'color' },
|
|
71
|
+
iconSize: { control: 'text' },
|
|
72
|
+
iconStrokeWidth: { control: 'text' },
|
|
73
|
+
},
|
|
74
|
+
args: {
|
|
75
|
+
checked: false,
|
|
76
|
+
indeterminate: false,
|
|
77
|
+
isDisabled: false,
|
|
78
|
+
required: false,
|
|
79
|
+
label: 'Aceito os termos',
|
|
80
|
+
labelPosition: 'after',
|
|
81
|
+
checkedIcon: '',
|
|
82
|
+
uncheckedIcon: '',
|
|
83
|
+
indeterminateIcon: '',
|
|
84
|
+
isLucideIcon: false,
|
|
85
|
+
iconColor: '',
|
|
86
|
+
checkedIconColor: '',
|
|
87
|
+
uncheckedIconColor: '',
|
|
88
|
+
iconSize: 14,
|
|
89
|
+
iconStrokeWidth: 2.5,
|
|
90
|
+
checkedChange: fn(),
|
|
91
|
+
indeterminateChange: fn(),
|
|
92
|
+
checkboxChange: fn(),
|
|
93
|
+
},
|
|
94
|
+
render: (args) => ({
|
|
95
|
+
props: args,
|
|
96
|
+
template: `
|
|
97
|
+
<cao-checkbox
|
|
98
|
+
[(ngModel)]="checked"
|
|
99
|
+
[indeterminate]="indeterminate"
|
|
100
|
+
[isDisabled]="isDisabled"
|
|
101
|
+
[required]="required"
|
|
102
|
+
[label]="label"
|
|
103
|
+
[labelPosition]="labelPosition"
|
|
104
|
+
[name]="name"
|
|
105
|
+
[id]="id"
|
|
106
|
+
[ariaLabel]="ariaLabel"
|
|
107
|
+
[ariaLabelledBy]="ariaLabelledBy"
|
|
108
|
+
[dataCy]="dataCy"
|
|
109
|
+
[color]="color"
|
|
110
|
+
[uncheckedColor]="uncheckedColor"
|
|
111
|
+
[disabledColor]="disabledColor"
|
|
112
|
+
[labelColor]="labelColor"
|
|
113
|
+
[disabledLabelColor]="disabledLabelColor"
|
|
114
|
+
[focusRingColor]="focusRingColor"
|
|
115
|
+
[size]="size"
|
|
116
|
+
[borderRadius]="borderRadius"
|
|
117
|
+
[animationDuration]="animationDuration"
|
|
118
|
+
[checkedIcon]="checkedIcon"
|
|
119
|
+
[uncheckedIcon]="uncheckedIcon"
|
|
120
|
+
[indeterminateIcon]="indeterminateIcon"
|
|
121
|
+
[isLucideIcon]="isLucideIcon"
|
|
122
|
+
[iconColor]="iconColor"
|
|
123
|
+
[checkedIconColor]="checkedIconColor"
|
|
124
|
+
[uncheckedIconColor]="uncheckedIconColor"
|
|
125
|
+
[iconSize]="iconSize"
|
|
126
|
+
[iconStrokeWidth]="iconStrokeWidth"
|
|
127
|
+
(checkedChange)="checkedChange($event)"
|
|
128
|
+
(indeterminateChange)="indeterminateChange($event)"
|
|
129
|
+
(checkboxChange)="checkboxChange($event)">
|
|
130
|
+
</cao-checkbox>
|
|
131
|
+
`,
|
|
132
|
+
}),
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export default meta;
|
|
136
|
+
type Story = StoryObj<CaoCheckboxComponent>;
|
|
137
|
+
|
|
138
|
+
export const Padrao: Story = {};
|
|
139
|
+
|
|
140
|
+
export const Marcado: Story = {
|
|
141
|
+
args: {
|
|
142
|
+
checked: true,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const Indeterminado: Story = {
|
|
147
|
+
args: {
|
|
148
|
+
indeterminate: true,
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const Desabilitado: Story = {
|
|
153
|
+
args: {
|
|
154
|
+
isDisabled: true,
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export const DesabilitadoMarcado: Story = {
|
|
159
|
+
args: {
|
|
160
|
+
checked: true,
|
|
161
|
+
isDisabled: true,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export const LabelAntes: Story = {
|
|
166
|
+
args: {
|
|
167
|
+
checked: true,
|
|
168
|
+
labelPosition: 'before',
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export const Obrigatorio: Story = {
|
|
173
|
+
args: {
|
|
174
|
+
required: true,
|
|
175
|
+
label: 'Campo obrigatório',
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const CoresCustomizadas: Story = {
|
|
180
|
+
args: {
|
|
181
|
+
checked: true,
|
|
182
|
+
label: 'Cores customizadas',
|
|
183
|
+
color: '#16a34a',
|
|
184
|
+
uncheckedColor: '#94a3b8',
|
|
185
|
+
labelColor: '#166534',
|
|
186
|
+
focusRingColor: 'rgba(22, 163, 74, 0.35)',
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export const TamanhoCustomizado: Story = {
|
|
191
|
+
args: {
|
|
192
|
+
checked: true,
|
|
193
|
+
label: 'Tamanho customizado',
|
|
194
|
+
size: '28px',
|
|
195
|
+
borderRadius: '8px',
|
|
196
|
+
animationDuration: '300ms',
|
|
197
|
+
iconSize: 20,
|
|
198
|
+
iconStrokeWidth: 3,
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export const IconesLucide: Story = {
|
|
203
|
+
args: {
|
|
204
|
+
checked: true,
|
|
205
|
+
label: 'Ícones Lucide',
|
|
206
|
+
checkedIcon: 'check',
|
|
207
|
+
uncheckedIcon: 'x',
|
|
208
|
+
indeterminateIcon: 'minus',
|
|
209
|
+
isLucideIcon: true,
|
|
210
|
+
checkedIconColor: '#ffffff',
|
|
211
|
+
uncheckedIconColor: '#6b7280',
|
|
212
|
+
iconSize: 14,
|
|
213
|
+
iconStrokeWidth: 2.5,
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export const IconesCustomizados: Story = {
|
|
218
|
+
args: {
|
|
219
|
+
checked: true,
|
|
220
|
+
label: 'Ícones customizados',
|
|
221
|
+
checkedIcon: 'heart',
|
|
222
|
+
uncheckedIcon: 'circle',
|
|
223
|
+
isLucideIcon: true,
|
|
224
|
+
checkedIconColor: '#ffffff',
|
|
225
|
+
uncheckedIconColor: '#db2777',
|
|
226
|
+
color: '#db2777',
|
|
227
|
+
uncheckedColor: '#f9a8d4',
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export const IconeImagem: Story = {
|
|
232
|
+
args: {
|
|
233
|
+
checked: true,
|
|
234
|
+
label: 'Ícone via URL/data URI',
|
|
235
|
+
checkedIcon: imageIcon,
|
|
236
|
+
uncheckedIcon: imageIcon,
|
|
237
|
+
isLucideIcon: false,
|
|
238
|
+
iconSize: 12,
|
|
239
|
+
},
|
|
240
|
+
};
|
|
@@ -30,4 +30,5 @@ export * from "./base-toggle/base-toggle.component"
|
|
|
30
30
|
export * from "./slide-toggle/slide-toggle.component"
|
|
31
31
|
export * from "./radio/radio-group.component"
|
|
32
32
|
export * from "./radio/radio-button.component"
|
|
33
|
+
export * from "./checkbox/checkbox.component"
|
|
33
34
|
export * from "./footer/footer"
|
|
@@ -793,6 +793,76 @@ declare class CaoRadioGroupComponent implements ControlValueAccessor {
|
|
|
793
793
|
static ɵcmp: i0.ɵɵComponentDeclaration<CaoRadioGroupComponent, "cao-radio-group", never, { "value": { "alias": "value"; "required": false; }; "name": { "alias": "name"; "required": false; }; "isDisabled": { "alias": "isDisabled"; "required": false; }; "required": { "alias": "required"; "required": false; }; "orientation": { "alias": "orientation"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "compareWith": { "alias": "compareWith"; "required": false; }; "color": { "alias": "color"; "required": false; }; "unselectedColor": { "alias": "unselectedColor"; "required": false; }; "disabledColor": { "alias": "disabledColor"; "required": false; }; "labelColor": { "alias": "labelColor"; "required": false; }; "disabledLabelColor": { "alias": "disabledLabelColor"; "required": false; }; "focusRingColor": { "alias": "focusRingColor"; "required": false; }; "size": { "alias": "size"; "required": false; }; "animationDuration": { "alias": "animationDuration"; "required": false; }; "gap": { "alias": "gap"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; }; "dataCy": { "alias": "dataCy"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "valueChange": "valueChange"; "selectionChange": "selectionChange"; }, never, ["*"], true, never>;
|
|
794
794
|
}
|
|
795
795
|
|
|
796
|
+
interface ICaoCheckboxChangeEvent {
|
|
797
|
+
checked: boolean;
|
|
798
|
+
source: CaoCheckboxComponent;
|
|
799
|
+
}
|
|
800
|
+
declare class CaoCheckboxComponent implements ControlValueAccessor, OnChanges, OnDestroy {
|
|
801
|
+
checked: boolean;
|
|
802
|
+
indeterminate: boolean;
|
|
803
|
+
isDisabled: boolean;
|
|
804
|
+
required: boolean;
|
|
805
|
+
label: string;
|
|
806
|
+
labelPosition: "before" | "after";
|
|
807
|
+
name: string;
|
|
808
|
+
id: string;
|
|
809
|
+
ariaLabel: string;
|
|
810
|
+
ariaLabelledBy: string;
|
|
811
|
+
dataCy: string;
|
|
812
|
+
control?: AbstractControl | null;
|
|
813
|
+
errorMessage: string;
|
|
814
|
+
color?: string;
|
|
815
|
+
uncheckedColor?: string;
|
|
816
|
+
disabledColor?: string;
|
|
817
|
+
labelColor?: string;
|
|
818
|
+
disabledLabelColor?: string;
|
|
819
|
+
focusRingColor?: string;
|
|
820
|
+
size?: string;
|
|
821
|
+
borderRadius?: string;
|
|
822
|
+
animationDuration?: string;
|
|
823
|
+
checkedIcon: string;
|
|
824
|
+
uncheckedIcon: string;
|
|
825
|
+
indeterminateIcon: string;
|
|
826
|
+
isLucideIcon: boolean;
|
|
827
|
+
iconColor: string;
|
|
828
|
+
checkedIconColor: string;
|
|
829
|
+
uncheckedIconColor: string;
|
|
830
|
+
iconSize: string | number;
|
|
831
|
+
iconStrokeWidth: string | number;
|
|
832
|
+
set disabled(value: boolean);
|
|
833
|
+
get disabled(): boolean;
|
|
834
|
+
readonly checkedChange: EventEmitter<boolean>;
|
|
835
|
+
readonly indeterminateChange: EventEmitter<boolean>;
|
|
836
|
+
readonly checkboxChange: EventEmitter<ICaoCheckboxChangeEvent>;
|
|
837
|
+
private readonly cdr;
|
|
838
|
+
private readonly uid;
|
|
839
|
+
private controlSub?;
|
|
840
|
+
private onChange;
|
|
841
|
+
private onTouched;
|
|
842
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
843
|
+
ngOnDestroy(): void;
|
|
844
|
+
get inputId(): string;
|
|
845
|
+
get hasError(): boolean;
|
|
846
|
+
get hasInvalidState(): boolean;
|
|
847
|
+
get hasValidState(): boolean;
|
|
848
|
+
get resolvedIconColor(): string;
|
|
849
|
+
get hostStyles(): Record<string, string>;
|
|
850
|
+
toggle(): void;
|
|
851
|
+
setChecked(value: boolean, emit?: boolean): void;
|
|
852
|
+
setIndeterminate(value: boolean): void;
|
|
853
|
+
enable(): void;
|
|
854
|
+
disable(): void;
|
|
855
|
+
onInputChange(event: Event): void;
|
|
856
|
+
onBlur(): void;
|
|
857
|
+
writeValue(value: boolean | null): void;
|
|
858
|
+
registerOnChange(fn: (value: boolean) => void): void;
|
|
859
|
+
registerOnTouched(fn: () => void): void;
|
|
860
|
+
setDisabledState(isDisabled: boolean): void;
|
|
861
|
+
private toCssLength;
|
|
862
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CaoCheckboxComponent, never>;
|
|
863
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CaoCheckboxComponent, "cao-checkbox", never, { "checked": { "alias": "checked"; "required": false; }; "indeterminate": { "alias": "indeterminate"; "required": false; }; "isDisabled": { "alias": "isDisabled"; "required": false; }; "required": { "alias": "required"; "required": false; }; "label": { "alias": "label"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "name": { "alias": "name"; "required": false; }; "id": { "alias": "id"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; }; "dataCy": { "alias": "dataCy"; "required": false; }; "control": { "alias": "control"; "required": false; }; "errorMessage": { "alias": "errorMessage"; "required": false; }; "color": { "alias": "color"; "required": false; }; "uncheckedColor": { "alias": "uncheckedColor"; "required": false; }; "disabledColor": { "alias": "disabledColor"; "required": false; }; "labelColor": { "alias": "labelColor"; "required": false; }; "disabledLabelColor": { "alias": "disabledLabelColor"; "required": false; }; "focusRingColor": { "alias": "focusRingColor"; "required": false; }; "size": { "alias": "size"; "required": false; }; "borderRadius": { "alias": "borderRadius"; "required": false; }; "animationDuration": { "alias": "animationDuration"; "required": false; }; "checkedIcon": { "alias": "checkedIcon"; "required": false; }; "uncheckedIcon": { "alias": "uncheckedIcon"; "required": false; }; "indeterminateIcon": { "alias": "indeterminateIcon"; "required": false; }; "isLucideIcon": { "alias": "isLucideIcon"; "required": false; }; "iconColor": { "alias": "iconColor"; "required": false; }; "checkedIconColor": { "alias": "checkedIconColor"; "required": false; }; "uncheckedIconColor": { "alias": "uncheckedIconColor"; "required": false; }; "iconSize": { "alias": "iconSize"; "required": false; }; "iconStrokeWidth": { "alias": "iconStrokeWidth"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "checkedChange": "checkedChange"; "indeterminateChange": "indeterminateChange"; "checkboxChange": "checkboxChange"; }, never, ["*"], true, never>;
|
|
864
|
+
}
|
|
865
|
+
|
|
796
866
|
type ModalType = "validation" | "finger" | "facial" | "clinic" | "graph" | "restriction" | "default";
|
|
797
867
|
interface IModal {
|
|
798
868
|
status: boolean;
|
|
@@ -1248,5 +1318,5 @@ declare class CaoBaseWidgetComponent<TData = unknown> {
|
|
|
1248
1318
|
static ɵcmp: i0.ɵɵComponentDeclaration<CaoBaseWidgetComponent<any>, "cao-base-widget", never, { "title": { "alias": "title"; "required": false; "isSignal": true; }; "subtitle": { "alias": "subtitle"; "required": false; "isSignal": true; }; "widgetIcon": { "alias": "widgetIcon"; "required": false; "isSignal": true; }; "cancelTextButton": { "alias": "cancelTextButton"; "required": false; "isSignal": true; }; "saveTextButton": { "alias": "saveTextButton"; "required": false; "isSignal": true; }; "displayActionButton": { "alias": "displayActionButton"; "required": false; "isSignal": true; }; "displaySaveButton": { "alias": "displaySaveButton"; "required": false; "isSignal": true; }; "displayCancelButton": { "alias": "displayCancelButton"; "required": false; "isSignal": true; }; "shouldCloseWhenCancel": { "alias": "shouldCloseWhenCancel"; "required": false; "isSignal": true; }; "widgetDirection": { "alias": "widgetDirection"; "required": false; "isSignal": true; }; "typeCancel": { "alias": "typeCancel"; "required": false; "isSignal": true; }; "saveDisabled": { "alias": "saveDisabled"; "required": false; "isSignal": true; }; "saveIcon": { "alias": "saveIcon"; "required": false; "isSignal": true; }; "saveIconPosition": { "alias": "saveIconPosition"; "required": false; "isSignal": true; }; "closeOnClickOutside": { "alias": "closeOnClickOutside"; "required": false; "isSignal": true; }; "confirmOnClose": { "alias": "confirmOnClose"; "required": false; "isSignal": true; }; "widgetData": { "alias": "widgetData"; "required": false; "isSignal": true; }; }, { "save": "save"; "deleted": "deleted"; "cancelEvent": "cancelEvent"; "closeRequest": "closeRequest"; }, never, ["widget-title", "*"], true, never>;
|
|
1249
1319
|
}
|
|
1250
1320
|
|
|
1251
|
-
export { BaseAlert, BaseAlertService, BaseDialog, BaseDialogService, BaseFilterTablePaginatedService, BaseFilterTableService, BaseModal, BaseModalService, BasePaginationService, BaseTable, BaseTablePaginated, BaseTableService, BaseTimeRange, CaoAutocompleteComponent, CaoBaseButtonComponent, CaoBaseIcon, CaoBaseInput, CaoBaseToggleComponent, CaoBaseWidgetComponent, CaoCardComponent, CaoDropDownComponent, CaoError, CaoFormField, CaoHint, CaoKpi, CaoRadioButtonComponent, CaoRadioGroupComponent, CaoSkeletonComponent, CaoSlideToggleComponent, CaoTabGroup, CaoTabPanel, CaoWidgetService, DEFAULT_ERROR_STATE_MATCHER, ErrorStateMatcher, Footer, LinksButton, Paginator, ShowOnDirtyErrorStateMatcher, StepComponent, StepperComponent, TablePaginatedService, TimePicker, getPtBrPaginatorIntlBasePaginated, getPtBrPaginatorIntlBaseTable };
|
|
1252
|
-
export type { AlertType, CaoCardVariant, CaoSkeletonVariant, CaoTypeInputs, CaoWidgetDirection, DialogType, IAlertConfig, ICaoAutoCompleteOption, ICaoCardAvatar, ICaoCardBadge, ICaoCardMeta, ICaoDropDownOption, ICaoImage, ICaoKPI, ICaoRadioChangeEvent, ICaoSlideToggleChangeEvent, ICaoTabChangeEvent, ICaoWidgetOptions, IColumnButton, IColumnConfig, IColumnPaginatedButton, IColumnPaginatedConfig, IDialogConfig, IErrorStateMatcher, IFormFieldControl, IModal, INavContent, INavLink, ITableConfig, ITablePaginatedConfig, ModalType, ModalTypeClass, ModalTypeSize };
|
|
1321
|
+
export { BaseAlert, BaseAlertService, BaseDialog, BaseDialogService, BaseFilterTablePaginatedService, BaseFilterTableService, BaseModal, BaseModalService, BasePaginationService, BaseTable, BaseTablePaginated, BaseTableService, BaseTimeRange, CaoAutocompleteComponent, CaoBaseButtonComponent, CaoBaseIcon, CaoBaseInput, CaoBaseToggleComponent, CaoBaseWidgetComponent, CaoCardComponent, CaoCheckboxComponent, CaoDropDownComponent, CaoError, CaoFormField, CaoHint, CaoKpi, CaoRadioButtonComponent, CaoRadioGroupComponent, CaoSkeletonComponent, CaoSlideToggleComponent, CaoTabGroup, CaoTabPanel, CaoWidgetService, DEFAULT_ERROR_STATE_MATCHER, ErrorStateMatcher, Footer, LinksButton, Paginator, ShowOnDirtyErrorStateMatcher, StepComponent, StepperComponent, TablePaginatedService, TimePicker, getPtBrPaginatorIntlBasePaginated, getPtBrPaginatorIntlBaseTable };
|
|
1322
|
+
export type { AlertType, CaoCardVariant, CaoSkeletonVariant, CaoTypeInputs, CaoWidgetDirection, DialogType, IAlertConfig, ICaoAutoCompleteOption, ICaoCardAvatar, ICaoCardBadge, ICaoCardMeta, ICaoCheckboxChangeEvent, ICaoDropDownOption, ICaoImage, ICaoKPI, ICaoRadioChangeEvent, ICaoSlideToggleChangeEvent, ICaoTabChangeEvent, ICaoWidgetOptions, IColumnButton, IColumnConfig, IColumnPaginatedButton, IColumnPaginatedConfig, IDialogConfig, IErrorStateMatcher, IFormFieldControl, IModal, INavContent, INavLink, ITableConfig, ITablePaginatedConfig, ModalType, ModalTypeClass, ModalTypeSize };
|