ngx-opalbytes-components 1.19.0 → 1.21.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 +103 -0
- package/cli/cao-comp.cjs +456 -0
- package/fesm2022/ngx-opalbytes-components.mjs +23 -7
- package/fesm2022/ngx-opalbytes-components.mjs.map +1 -1
- package/package.json +4 -1
- package/src/lib/shared/components/autocomplete/autocomplete.component.html +126 -0
- package/src/lib/shared/components/autocomplete/autocomplete.component.scss +150 -0
- package/src/lib/shared/components/autocomplete/autocomplete.component.ts +552 -0
- package/src/lib/shared/components/autocomplete/autocomplete.stories.ts +133 -0
- package/src/lib/shared/components/base-button/base-button.component.html +33 -0
- package/src/lib/shared/components/base-button/base-button.component.scss +14 -0
- package/src/lib/shared/components/base-button/base-button.component.spec.ts +64 -0
- package/src/lib/shared/components/base-button/base-button.component.ts +48 -0
- package/src/lib/shared/components/base-button/base-button.stories.ts +102 -0
- package/src/lib/shared/components/base-icon/base-icon.css +0 -0
- package/src/lib/shared/components/base-icon/base-icon.html +11 -0
- package/src/lib/shared/components/base-icon/base-icon.spec.ts +23 -0
- package/src/lib/shared/components/base-icon/base-icon.stories.ts +56 -0
- package/src/lib/shared/components/base-icon/base-icon.ts +18 -0
- package/src/lib/shared/components/base-input/base-input.css +193 -0
- package/src/lib/shared/components/base-input/base-input.html +43 -0
- package/src/lib/shared/components/base-input/base-input.spec.ts +146 -0
- package/src/lib/shared/components/base-input/base-input.stories.ts +137 -0
- package/src/lib/shared/components/base-input/base-input.ts +133 -0
- package/src/lib/shared/components/base-time-range/base-time-range.css +27 -0
- package/src/lib/shared/components/base-time-range/base-time-range.html +23 -0
- package/src/lib/shared/components/base-time-range/base-time-range.spec.ts +27 -0
- package/src/lib/shared/components/base-time-range/base-time-range.stories.ts +54 -0
- package/src/lib/shared/components/base-time-range/base-time-range.ts +61 -0
- package/src/lib/shared/components/base-toggle/base-toggle.component.html +28 -0
- package/src/lib/shared/components/base-toggle/base-toggle.component.scss +45 -0
- package/src/lib/shared/components/base-toggle/base-toggle.component.spec.ts +22 -0
- package/src/lib/shared/components/base-toggle/base-toggle.component.ts +138 -0
- package/src/lib/shared/components/base-toggle/base-toggle.stories.ts +63 -0
- package/src/lib/shared/components/card/card.component.css +264 -0
- package/src/lib/shared/components/card/card.component.html +103 -0
- package/src/lib/shared/components/card/card.component.ts +63 -0
- package/src/lib/shared/components/card/card.stories.ts +114 -0
- package/src/lib/shared/components/date-picker/date-picker.html +82 -0
- package/src/lib/shared/components/date-picker/date-picker.scss +8 -0
- package/src/lib/shared/components/date-picker/date-picker.spec.ts +23 -0
- package/src/lib/shared/components/date-picker/date-picker.stories.ts +91 -0
- package/src/lib/shared/components/date-picker/date-picker.ts +165 -0
- package/src/lib/shared/components/drop-down/drop-down.css +61 -0
- package/src/lib/shared/components/drop-down/drop-down.html +96 -0
- package/src/lib/shared/components/drop-down/drop-down.spec.ts +335 -0
- package/src/lib/shared/components/drop-down/drop-down.stories.ts +90 -0
- package/src/lib/shared/components/drop-down/drop-down.ts +335 -0
- package/src/lib/shared/components/footer/footer.css +29 -0
- package/src/lib/shared/components/footer/footer.html +10 -0
- package/src/lib/shared/components/footer/footer.spec.ts +22 -0
- package/src/lib/shared/components/footer/footer.stories.ts +51 -0
- package/src/lib/shared/components/footer/footer.ts +15 -0
- package/src/lib/shared/components/index.ts +19 -0
- package/src/lib/shared/components/kpi/kpi.css +0 -0
- package/src/lib/shared/components/kpi/kpi.html +11 -0
- package/src/lib/shared/components/kpi/kpi.spec.ts +38 -0
- package/src/lib/shared/components/kpi/kpi.stories.ts +65 -0
- package/src/lib/shared/components/kpi/kpi.ts +25 -0
- package/src/lib/shared/components/links-button/links-button.css +70 -0
- package/src/lib/shared/components/links-button/links-button.html +23 -0
- package/src/lib/shared/components/links-button/links-button.spec.ts +139 -0
- package/src/lib/shared/components/links-button/links-button.stories.ts +75 -0
- package/src/lib/shared/components/links-button/links-button.ts +45 -0
- package/src/lib/shared/components/paginator/paginator.css +0 -0
- package/src/lib/shared/components/paginator/paginator.html +10 -0
- package/src/lib/shared/components/paginator/paginator.spec.ts +23 -0
- package/src/lib/shared/components/paginator/paginator.stories.ts +56 -0
- package/src/lib/shared/components/paginator/paginator.ts +25 -0
- package/src/lib/shared/components/stepper/step/step.css +8 -0
- package/src/lib/shared/components/stepper/step/step.html +1 -0
- package/src/lib/shared/components/stepper/step/step.spec.ts +131 -0
- package/src/lib/shared/components/stepper/step/step.ts +14 -0
- package/src/lib/shared/components/stepper/stepper.css +17 -0
- package/src/lib/shared/components/stepper/stepper.html +11 -0
- package/src/lib/shared/components/stepper/stepper.spec.ts +238 -0
- package/src/lib/shared/components/stepper/stepper.stories.ts +77 -0
- package/src/lib/shared/components/stepper/stepper.ts +57 -0
- package/src/lib/shared/components/tab-group/tab-group.component.html +84 -0
- package/src/lib/shared/components/tab-group/tab-group.component.scss +151 -0
- package/src/lib/shared/components/tab-group/tab-group.spec.ts +22 -0
- package/src/lib/shared/components/tab-group/tab-group.stories.ts +102 -0
- package/src/lib/shared/components/tab-group/tab-group.ts +218 -0
- package/src/lib/shared/components/tab-panel/tab-content.directive.ts +7 -0
- package/src/lib/shared/components/tab-panel/tab-label.directive.ts +7 -0
- package/src/lib/shared/components/tab-panel/tab-panel.css +0 -0
- package/src/lib/shared/components/tab-panel/tab-panel.spec.ts +22 -0
- package/src/lib/shared/components/tab-panel/tab-panel.stories.ts +54 -0
- package/src/lib/shared/components/tab-panel/tab-panel.ts +31 -0
- package/src/lib/shared/components/time-picker/time-picker.css +84 -0
- package/src/lib/shared/components/time-picker/time-picker.html +21 -0
- package/src/lib/shared/components/time-picker/time-picker.spec.ts +23 -0
- package/src/lib/shared/components/time-picker/time-picker.stories.ts +66 -0
- package/src/lib/shared/components/time-picker/time-picker.ts +90 -0
- package/types/ngx-opalbytes-components.d.ts +23 -4
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from "@angular/core/testing";
|
|
2
|
+
import { CaoBaseButtonComponent } from "./base-button.component";
|
|
3
|
+
|
|
4
|
+
describe("CaoBaseButtonComponent", () => {
|
|
5
|
+
let component: CaoBaseButtonComponent;
|
|
6
|
+
let fixture: ComponentFixture<CaoBaseButtonComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [CaoBaseButtonComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
fixture = TestBed.createComponent(CaoBaseButtonComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("deveria criar", () => {
|
|
20
|
+
fixture.detectChanges();
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("deve emitir o evento buttonClick quando clicado", () => {
|
|
25
|
+
vi.spyOn(component.buttonClick, "emit");
|
|
26
|
+
component.onClick();
|
|
27
|
+
expect(component.buttonClick.emit).toHaveBeenCalledWith();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("não deve emitir o evento buttonClick quando desabilitado", () => {
|
|
31
|
+
component.isDisabled = true;
|
|
32
|
+
vi.spyOn(component.buttonClick, "emit");
|
|
33
|
+
component.onClick();
|
|
34
|
+
expect(component.buttonClick.emit).not.toHaveBeenCalled();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("não deve emitir o evento buttonClick ao carregar", () => {
|
|
38
|
+
component.isLoading = true;
|
|
39
|
+
vi.spyOn(component.buttonClick, "emit");
|
|
40
|
+
component.onClick();
|
|
41
|
+
expect(component.buttonClick.emit).not.toHaveBeenCalled();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("deve aplicar a classe de modo escuro quando isDarkMode for verdadeiro", () => {
|
|
45
|
+
component.isDarkMode = true;
|
|
46
|
+
fixture.detectChanges();
|
|
47
|
+
const button = fixture.nativeElement.querySelector("button");
|
|
48
|
+
expect(button.classList.contains("dark-mode")).toBeTruthy();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("deve aplicar a classe desabilitada quando isDisabled for verdadeiro", () => {
|
|
52
|
+
component.isDisabled = true;
|
|
53
|
+
fixture.detectChanges();
|
|
54
|
+
const button = fixture.nativeElement.querySelector("button");
|
|
55
|
+
expect(button.classList.contains("disabled")).toBeTruthy();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("deve aplicar a classe de carregamento quando isLoading for verdadeiro", () => {
|
|
59
|
+
component.isLoading = true;
|
|
60
|
+
fixture.detectChanges();
|
|
61
|
+
const button = fixture.nativeElement.querySelector("button");
|
|
62
|
+
expect(button.classList.contains("loading")).toBeTruthy();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { CommonModule } from "@angular/common";
|
|
2
|
+
import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
|
|
3
|
+
import { MatTooltipModule } from "@angular/material/tooltip";
|
|
4
|
+
|
|
5
|
+
import { LucideDynamicIcon } from "@lucide/angular";
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
standalone: true,
|
|
9
|
+
selector: "cao-button",
|
|
10
|
+
templateUrl: "./base-button.component.html",
|
|
11
|
+
styleUrls: ["./base-button.component.scss"],
|
|
12
|
+
imports: [CommonModule, MatTooltipModule, LucideDynamicIcon],
|
|
13
|
+
})
|
|
14
|
+
export class CaoBaseButtonComponent implements OnInit{
|
|
15
|
+
@Output() readonly buttonClick = new EventEmitter<void>();
|
|
16
|
+
|
|
17
|
+
@Input() buttonText = "Clique!";
|
|
18
|
+
@Input() isDarkMode = false;
|
|
19
|
+
@Input() isDisabled = false;
|
|
20
|
+
@Input() isLoading = false;
|
|
21
|
+
@Input() btnClass = "";
|
|
22
|
+
|
|
23
|
+
@Input() tooltip?:string;
|
|
24
|
+
@Input() trailingIcon?: string;
|
|
25
|
+
@Input() leadingIcon?: string;
|
|
26
|
+
@Input() isLucideIcon = true;
|
|
27
|
+
@Input() dataCy?: string;
|
|
28
|
+
@Input() iconColor?: string;
|
|
29
|
+
@Input() strokeWidthIcon = 1
|
|
30
|
+
@Input() minTextToTooltip = 20
|
|
31
|
+
@Input() iconSize = 24
|
|
32
|
+
|
|
33
|
+
ngOnInit(): void {
|
|
34
|
+
if (!this.dataCy) {
|
|
35
|
+
this.dataCy = `btn-${this.buttonText.replace(/\s+/g, '-').toLowerCase()}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if(!this.tooltip && this.buttonText.length >= this.minTextToTooltip){
|
|
39
|
+
this.tooltip = this.buttonText
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
onClick(): void {
|
|
44
|
+
if (!this.isDisabled && !this.isLoading) {
|
|
45
|
+
this.buttonClick.emit();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular-vite';
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
|
+
|
|
4
|
+
import { CaoBaseButtonComponent } from './base-button.component';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<CaoBaseButtonComponent> = {
|
|
7
|
+
title: 'Componentes/Base Button',
|
|
8
|
+
component: CaoBaseButtonComponent,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
buttonText: { control: 'text' },
|
|
12
|
+
btnClass: { control: 'text' },
|
|
13
|
+
tooltip: { control: 'text' },
|
|
14
|
+
leadingIcon: { control: 'text' },
|
|
15
|
+
trailingIcon: { control: 'text' },
|
|
16
|
+
isLucideIcon: { control: 'boolean' },
|
|
17
|
+
iconColor: { control: 'color' },
|
|
18
|
+
isDarkMode: { control: 'boolean' },
|
|
19
|
+
isDisabled: { control: 'boolean' },
|
|
20
|
+
isLoading: { control: 'boolean' },
|
|
21
|
+
strokeWidthIcon: { control: { type: 'number', min: 0.5, max: 3, step: 0.1 } },
|
|
22
|
+
minTextToTooltip: { control: { type: 'number', min: 1, max: 100 } },
|
|
23
|
+
iconSize: { control: { type: 'number', min: 8, max: 64 } },
|
|
24
|
+
dataCy: { control: 'text' },
|
|
25
|
+
},
|
|
26
|
+
args: {
|
|
27
|
+
buttonClick: fn(),
|
|
28
|
+
buttonText: 'Clique!',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default meta;
|
|
33
|
+
type Story = StoryObj<CaoBaseButtonComponent>;
|
|
34
|
+
|
|
35
|
+
export const Padrao: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
buttonText: 'Clique!',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Principal: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
buttonText: 'Salvar',
|
|
44
|
+
btnClass: 'btn-primary',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const ComLeadingIcon: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
buttonText: 'Salvar',
|
|
51
|
+
leadingIcon: 'Save',
|
|
52
|
+
isLucideIcon: true,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const ComTrailingIcon: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
buttonText: 'Próximo',
|
|
59
|
+
trailingIcon: 'ArrowRight',
|
|
60
|
+
isLucideIcon: true,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const ComAmbosIcones: Story = {
|
|
65
|
+
args: {
|
|
66
|
+
buttonText: 'Enviar',
|
|
67
|
+
leadingIcon: 'Send',
|
|
68
|
+
trailingIcon: 'ArrowRight',
|
|
69
|
+
isLucideIcon: true,
|
|
70
|
+
iconColor: '#f97316',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Desabilitado: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
buttonText: 'Desabilitado',
|
|
77
|
+
isDisabled: true,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const Carregando: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
buttonText: 'Carregando...',
|
|
84
|
+
isLoading: true,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const ModoEscuro: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
buttonText: 'Tema Escuro',
|
|
91
|
+
isDarkMode: true,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const DesabilitadoComIcone: Story = {
|
|
96
|
+
args: {
|
|
97
|
+
buttonText: 'Bloqueado',
|
|
98
|
+
leadingIcon: 'Lock',
|
|
99
|
+
isLucideIcon: true,
|
|
100
|
+
isDisabled: true,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@if (imgSource) {
|
|
2
|
+
@if (isLucideIcon) {
|
|
3
|
+
<div class="icon">
|
|
4
|
+
<svg [lucideIcon]="imgSource" [style.color]="iconColor" [strokeWidth]="strokeWidthIcon" [size]="size"></svg>
|
|
5
|
+
</div>
|
|
6
|
+
} @else {
|
|
7
|
+
<div class="icon">
|
|
8
|
+
<img alt="ícone de início" [src]="imgSource" />
|
|
9
|
+
</div>
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { CaoBaseIcon } from './base-icon';
|
|
4
|
+
|
|
5
|
+
describe('CaoBaseIcon', () => {
|
|
6
|
+
let component: CaoBaseIcon;
|
|
7
|
+
let fixture: ComponentFixture<CaoBaseIcon>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [CaoBaseIcon]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(CaoBaseIcon);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
await fixture.whenStable();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular-vite';
|
|
2
|
+
|
|
3
|
+
import { CaoBaseIcon } from './base-icon';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<CaoBaseIcon> = {
|
|
6
|
+
title: 'Componentes/Base Icon',
|
|
7
|
+
component: CaoBaseIcon,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
imgSource: { control: 'text' },
|
|
11
|
+
isLucideIcon: { control: 'boolean' },
|
|
12
|
+
strokeWidthIcon: { control: { type: 'number', min: 0.5, max: 3, step: 0.1 } },
|
|
13
|
+
iconColor: { control: 'color' },
|
|
14
|
+
size: { control: { type: 'number', min: 8, max: 96 } },
|
|
15
|
+
},
|
|
16
|
+
args: {
|
|
17
|
+
imgSource: 'Home',
|
|
18
|
+
isLucideIcon: true,
|
|
19
|
+
size: 32,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<CaoBaseIcon>;
|
|
25
|
+
|
|
26
|
+
export const IconeLucide: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
imgSource: 'Home',
|
|
29
|
+
isLucideIcon: true,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const IconeLucideComCor: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
imgSource: 'Settings',
|
|
36
|
+
isLucideIcon: true,
|
|
37
|
+
iconColor: '#3b82f6',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const TamanhoPersonalizado: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
imgSource: 'Bell',
|
|
44
|
+
isLucideIcon: true,
|
|
45
|
+
size: 48,
|
|
46
|
+
strokeWidthIcon: 2,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const IconeSVG: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
imgSource: 'https://lucide.dev/icons/home.svg',
|
|
53
|
+
isLucideIcon: false,
|
|
54
|
+
size: 32,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, Input } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
import { LucideDynamicIcon } from '@lucide/angular';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'cao-base-icon',
|
|
8
|
+
imports: [CommonModule, LucideDynamicIcon],
|
|
9
|
+
templateUrl: './base-icon.html',
|
|
10
|
+
styleUrl: './base-icon.css',
|
|
11
|
+
})
|
|
12
|
+
export class CaoBaseIcon {
|
|
13
|
+
@Input() imgSource = ""
|
|
14
|
+
@Input() isLucideIcon = true
|
|
15
|
+
@Input() strokeWidthIcon = 1
|
|
16
|
+
@Input() iconColor = ""
|
|
17
|
+
@Input() size = 32
|
|
18
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
.form-field {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
label {
|
|
9
|
+
font-size: 12px;
|
|
10
|
+
color: var(--primary);
|
|
11
|
+
font-weight: 700;
|
|
12
|
+
text-transform: uppercase;
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.input-wrapper {
|
|
17
|
+
position: relative;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.input-wrapper input,
|
|
23
|
+
.input-wrapper textarea {
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
border: none;
|
|
27
|
+
background-color: var(--input-background);
|
|
28
|
+
border-radius: 8px;
|
|
29
|
+
padding: 14px 10px;
|
|
30
|
+
color: var(--text-color-input);
|
|
31
|
+
text-overflow: ellipsis;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.input-wrapper input::placeholder,
|
|
37
|
+
.input-wrapper textarea::placeholder {
|
|
38
|
+
color: var(--input-text);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.input-wrapper input:focus,
|
|
42
|
+
.input-wrapper textarea:focus {
|
|
43
|
+
outline: none;
|
|
44
|
+
box-shadow: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.input-wrapper.has-leading-icon input {
|
|
48
|
+
padding-left: 33px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.input-wrapper.has-trailing-icon input {
|
|
52
|
+
padding-right: 30px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.input-wrapper img {
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: auto;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.input-wrapper .icon {
|
|
61
|
+
position: absolute;
|
|
62
|
+
top: 50%;
|
|
63
|
+
transform: translateY(-50%);
|
|
64
|
+
width: 15px;
|
|
65
|
+
height: 15px;
|
|
66
|
+
pointer-events: none;
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.input-wrapper.has-leading-icon .icon:first-of-type {
|
|
73
|
+
left: 8px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.input-wrapper.has-trailing-icon .icon:last-of-type {
|
|
77
|
+
right: 8px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.input-wrapper .search-icon-border {
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: 50%;
|
|
83
|
+
right: 14px;
|
|
84
|
+
transform: translateY(-50%);
|
|
85
|
+
border-left: 1px solid var(--line-color);
|
|
86
|
+
padding-left: 8px;
|
|
87
|
+
height: 24px;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.input-wrapper .search-icon {
|
|
93
|
+
width: 16px;
|
|
94
|
+
height: 24px;
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
transition: filter 0.2s;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.input-wrapper .search-icon:hover {
|
|
100
|
+
filter: invert(62%) sepia(92%) saturate(747%) hue-rotate(142deg) brightness(97%) contrast(101%);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
[type="date"] {
|
|
104
|
+
height: 43px;
|
|
105
|
+
padding: 14px 0 14px 12px !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
[type="date"].invalid::-webkit-calendar-picker-indicator {
|
|
110
|
+
border-left: 1px solid var(--error);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
[type="date"].valid::-webkit-calendar-picker-indicator {
|
|
114
|
+
border-left: 1px solid var(--success);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.input-date-disabled {
|
|
118
|
+
background: url("/assets/images/svg/icon-date-border.svg") no-repeat right 12px center;
|
|
119
|
+
background-size: 30px;
|
|
120
|
+
border: none;
|
|
121
|
+
border-radius: 8px;
|
|
122
|
+
background-color: var(--input-background);
|
|
123
|
+
padding: 12px 40px 12px 16px;
|
|
124
|
+
width: 100%;
|
|
125
|
+
color: var(--input-text);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.input-date-disabled::placeholder {
|
|
129
|
+
color: var(--input-text);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.input-secondary {
|
|
133
|
+
width: 100%;
|
|
134
|
+
border: 1px solid var(--data-bg) !important;
|
|
135
|
+
background-color: var(--white) !important;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.input-secondary.invalid {
|
|
139
|
+
border: 1px solid var(--error) !important;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.input-secondary.valid {
|
|
143
|
+
border: 1px solid var(--success) !important;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.input-wrapper .invalid {
|
|
147
|
+
border: 1px solid var(--error);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.input-wrapper .valid {
|
|
151
|
+
border: 1px solid var(--success);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.input-border-primary {
|
|
155
|
+
border: 1px solid var(--primary) !important;
|
|
156
|
+
background-color: var(--white) !important;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.input-border-primary.invalid {
|
|
160
|
+
border: 1px solid var(--error) !important;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.input-border-primary.valid {
|
|
164
|
+
border: 1px solid var(--success) !important;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* stylelint-disable selector-pseudo-element-no-unknown */
|
|
168
|
+
::ng-deep .custom-arrow-tooltip {
|
|
169
|
+
background-color: var(--color-tooltip);
|
|
170
|
+
color: var(--white);
|
|
171
|
+
padding: 0 4px;
|
|
172
|
+
border-radius: 6px;
|
|
173
|
+
font-size: 12px;
|
|
174
|
+
position: relative;
|
|
175
|
+
text-align: center;
|
|
176
|
+
max-width: 260px;
|
|
177
|
+
box-shadow: 0 2px 10px rgb(0 0 0 / 30%);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
::ng-deep .input-component .cdk-overlay-pane .custom-arrow-tooltip::after {
|
|
181
|
+
content: "";
|
|
182
|
+
position: absolute;
|
|
183
|
+
top: -6px;
|
|
184
|
+
rotate: 180deg;
|
|
185
|
+
right: 50%;
|
|
186
|
+
transform: translateX(-50%);
|
|
187
|
+
width: 0;
|
|
188
|
+
height: 0;
|
|
189
|
+
border-left: 8px solid transparent;
|
|
190
|
+
border-right: 8px solid transparent;
|
|
191
|
+
border-top: 8px solid var(--color-tooltip);
|
|
192
|
+
}
|
|
193
|
+
/* stylelint-enable selector-pseudo-element-no-unknown */
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<div class="form-field input-component" [class.search-mode]="searchMode">
|
|
2
|
+
<div class="input-wrapper" [class.has-leading-icon]="_leadingIcon" [class.has-trailing-icon]="_trailingIcon"
|
|
3
|
+
[class.focused]="isFocused">
|
|
4
|
+
@if (_leadingIcon) { @if (isLucideIcon) {
|
|
5
|
+
<div class="icon">
|
|
6
|
+
<svg [lucideIcon]="_leadingIcon" [style.color]="iconColor"></svg>
|
|
7
|
+
</div>
|
|
8
|
+
} @else {
|
|
9
|
+
<div class="icon">
|
|
10
|
+
<img alt="ícone de início" [src]="_leadingIcon"/>
|
|
11
|
+
</div>
|
|
12
|
+
} } @switch (type) {
|
|
13
|
+
@case ('textarea') {
|
|
14
|
+
<textarea matTooltip="{{ tooltip }}" matTooltipPosition="above" matTooltipClass="custom-arrow-tooltip" [attr.data-cy]="dataCy"
|
|
15
|
+
[placeholder]="placeholder" [disabled]="isDisabled" [ngClass]="[
|
|
16
|
+
inputClass,
|
|
17
|
+
control?.touched && control?.invalid ? 'invalid' : '',
|
|
18
|
+
control?.touched && control?.valid && control?.value ? 'valid' : ''
|
|
19
|
+
]" [attr.maxlength]="maxLength"
|
|
20
|
+
[rows]="textareaRows" [mask]="mask" [allowNegativeNumbers]="allowNegativeNumbers" [thousandSeparator]="thousandSeparator" [decimalMarker]="decimalMarker" [separatorLimit]="separatorLimit"
|
|
21
|
+
[(ngModel)]="value" (input)="onInput($event)"
|
|
22
|
+
(focus)="onFocus()" (blur)="onBlur()"></textarea>
|
|
23
|
+
}
|
|
24
|
+
@default {
|
|
25
|
+
<input matTooltip="{{ tooltip }}" matTooltipPosition="below" matTooltipClass="custom-arrow-tooltip" [attr.data-cy]="dataCy" [type]="type"
|
|
26
|
+
[placeholder]="placeholder" [disabled]="isDisabled" [ngClass]="[
|
|
27
|
+
inputClass,
|
|
28
|
+
control?.touched && control?.invalid ? 'invalid' : '',
|
|
29
|
+
control?.touched && control?.valid && control?.value ? 'valid' : ''
|
|
30
|
+
]" [attr.maxlength]="maxLength"
|
|
31
|
+
[mask]="mask" [allowNegativeNumbers]="allowNegativeNumbers" [thousandSeparator]="thousandSeparator" [decimalMarker]="decimalMarker" [separatorLimit]="separatorLimit" [(ngModel)]="value" (input)="onInput($event)"
|
|
32
|
+
(change)="onInputChange($event)" (focus)="onFocus()" (blur)="onBlur()" />
|
|
33
|
+
} } @if (_trailingIcon) { @if (isLucideIcon) {
|
|
34
|
+
<div class="icon">
|
|
35
|
+
<svg [lucideIcon]="_trailingIcon" [style.color]="iconColor"></svg>
|
|
36
|
+
</div>
|
|
37
|
+
} @else {
|
|
38
|
+
<div class="icon">
|
|
39
|
+
<img alt="ícone de fim" [src]="_trailingIcon" />
|
|
40
|
+
</div>
|
|
41
|
+
} }
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|