tudu-components 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/esm2020/lib/components/card-layout/card-layout.component.mjs +77 -0
  2. package/esm2020/lib/components/fallback-message/fallback-message.component.mjs +128 -0
  3. package/esm2020/lib/components/nav/nav.component.mjs +74 -0
  4. package/esm2020/lib/tudu-components.component.mjs +22 -0
  5. package/esm2020/lib/tudu-components.module.mjs +21 -0
  6. package/esm2020/lib/tudu-components.service.mjs +14 -0
  7. package/esm2020/public-api.mjs +11 -0
  8. package/esm2020/tudu-components.mjs +5 -0
  9. package/fesm2015/tudu-components.mjs +333 -0
  10. package/fesm2015/tudu-components.mjs.map +1 -0
  11. package/fesm2020/tudu-components.mjs +331 -0
  12. package/fesm2020/tudu-components.mjs.map +1 -0
  13. package/index.d.ts +5 -0
  14. package/lib/components/card-layout/card-layout.component.d.ts +31 -0
  15. package/lib/components/fallback-message/fallback-message.component.d.ts +29 -0
  16. package/lib/components/nav/nav.component.d.ts +25 -0
  17. package/lib/tudu-components.component.d.ts +8 -0
  18. package/lib/tudu-components.module.d.ts +11 -0
  19. package/lib/tudu-components.service.d.ts +6 -0
  20. package/package.json +22 -3
  21. package/{src/public-api.ts → public-api.d.ts} +6 -11
  22. package/karma.conf.js +0 -44
  23. package/ng-package.json +0 -7
  24. package/src/lib/components/card-layout/card-layout.component.css +0 -166
  25. package/src/lib/components/card-layout/card-layout.component.html +0 -100
  26. package/src/lib/components/card-layout/card-layout.component.spec.ts +0 -23
  27. package/src/lib/components/card-layout/card-layout.component.ts +0 -78
  28. package/src/lib/components/fallback-message/fallback-message.component.css +0 -36
  29. package/src/lib/components/fallback-message/fallback-message.component.html +0 -95
  30. package/src/lib/components/fallback-message/fallback-message.component.spec.ts +0 -23
  31. package/src/lib/components/fallback-message/fallback-message.component.ts +0 -140
  32. package/src/lib/components/nav/nav.component.css +0 -40
  33. package/src/lib/components/nav/nav.component.html +0 -40
  34. package/src/lib/components/nav/nav.component.spec.ts +0 -23
  35. package/src/lib/components/nav/nav.component.ts +0 -84
  36. package/src/lib/tudu-components.component.spec.ts +0 -23
  37. package/src/lib/tudu-components.component.ts +0 -20
  38. package/src/lib/tudu-components.module.ts +0 -13
  39. package/src/lib/tudu-components.service.spec.ts +0 -16
  40. package/src/lib/tudu-components.service.ts +0 -9
  41. package/src/test.ts +0 -27
  42. package/tsconfig.lib.json +0 -19
  43. package/tsconfig.lib.prod.json +0 -10
  44. package/tsconfig.spec.json +0 -17
@@ -1,140 +0,0 @@
1
- import { Component, Input, Output, EventEmitter } from '@angular/core';
2
-
3
- interface EmptyStateConfig {
4
- title: string;
5
- description: string;
6
- icon: string;
7
- iconColor: string;
8
- bgColor: string;
9
- primaryActionText?: string;
10
- secondaryActionText?: string;
11
- }
12
-
13
- @Component({
14
- selector: 'lib-fallback-message',
15
- templateUrl: './fallback-message.component.html',
16
- styleUrls: ['./fallback-message.component.css'],
17
- })
18
- export class FallbackMessageComponent {
19
- @Input() card: any[] = [];
20
- @Input() statusPedido: string = '';
21
- @Input() customTitle?: string;
22
- @Input() customDescription?: string;
23
- @Input() primaryActionText?: string;
24
- @Input() secondaryActionText?: string;
25
-
26
- @Output() primaryAction = new EventEmitter<void>();
27
- @Output() secondaryAction = new EventEmitter<void>();
28
-
29
- get emptyStateConfig(): EmptyStateConfig {
30
- // Se não há propostas
31
- // if (this.card.length === 0) {
32
- // return {
33
- // title: 'Nenhuma Proposta',
34
- // description:
35
- // 'Você ainda não possui negociações ou propostas recebidas.',
36
- // icon: '📄',
37
- // iconColor: 'text-gray-500',
38
- // bgColor: 'bg-gray-100',
39
- // primaryActionText: this.primaryActionText || 'Anúnciar Grátis',
40
- // secondaryActionText: this.secondaryActionText,
41
- // };
42
- // }
43
-
44
- // Se há status de pedido
45
- if (this.statusPedido) {
46
- switch (this.statusPedido.toLowerCase()) {
47
- case 'finalizado':
48
- return {
49
- title: this.customTitle || 'Serviço Concluído! 🎉',
50
- description:
51
- this.customDescription ||
52
- 'O serviço foi finalizado com sucesso. Agradecemos pela confiança!',
53
- icon: '✅',
54
- iconColor: 'text-green-500',
55
- bgColor: 'bg-green-100',
56
- primaryActionText: this.primaryActionText || 'Ver Detalhes',
57
- secondaryActionText: this.secondaryActionText || 'Avaliar Serviço',
58
- };
59
-
60
- // case 'cancelado':
61
- // return {
62
- // title: this.customTitle || 'Serviço Cancelado',
63
- // description:
64
- // this.customDescription ||
65
- // 'O serviço foi cancelado pelo prestador. Você pode buscar outros profissionais disponíveis.',
66
- // icon: '❌',
67
- // iconColor: 'text-red-500',
68
- // bgColor: 'bg-red-100',
69
- // primaryActionText: this.primaryActionText || 'Buscar Profissionais',
70
- // secondaryActionText: this.secondaryActionText || 'Voltar ao Início',
71
- // };
72
-
73
- case 'sem servicos':
74
- return {
75
- title: this.customTitle || 'Sem serviço',
76
- description:
77
- this.customDescription ||
78
- 'Não há serviços disponíveis aqui.',
79
- icon: '📄',
80
- // iconColor: 'text-yellow-500',
81
- // bgColor: 'bg-yellow-100',
82
- iconColor: 'text-gray-500',
83
- bgColor: 'bg-gray-100',
84
- primaryActionText: this.primaryActionText || 'Procurar serviços',
85
- // secondaryActionText: this.secondaryActionText || 'Meus Anúncios',
86
- };
87
- case 'indisponivel':
88
- return {
89
- title: this.customTitle || 'Proposta Indisponível',
90
- description:
91
- this.customDescription ||
92
- 'Esta proposta não está mais disponível para visualização.',
93
- icon: '📄',
94
- // iconColor: 'text-yellow-500',
95
- // bgColor: 'bg-yellow-100',
96
- iconColor: 'text-gray-500',
97
- bgColor: 'bg-gray-100',
98
- primaryActionText: this.primaryActionText || 'Ver Outras Propostas',
99
- // secondaryActionText: this.secondaryActionText || 'Meus Anúncios',
100
- };
101
-
102
- default:
103
- return this.getDefaultConfig();
104
- }
105
- }
106
-
107
- return this.getDefaultConfig();
108
- }
109
-
110
- private getDefaultConfig(): EmptyStateConfig {
111
- return {
112
- title: this.customTitle || 'Nenhuma Proposta',
113
- description:
114
- this.customDescription || 'Você ainda não possui negociações.',
115
- icon: '📄',
116
- iconColor: 'text-gray-500',
117
- bgColor: 'bg-gray-100',
118
- primaryActionText: this.primaryActionText || 'Anúnciar Grátis',
119
- secondaryActionText: this.secondaryActionText,
120
- };
121
- }
122
-
123
- // Método para determinar se deve mostrar o componente
124
- shouldShowEmptyState(): boolean {
125
- return (
126
- this.card.length === 0 ||
127
- ['finalizado', 'cancelado', 'indisponível', 'indisponivel'].includes(
128
- this.statusPedido?.toLowerCase()
129
- )
130
- );
131
- }
132
-
133
- onPrimaryAction() {
134
- this.primaryAction.emit();
135
- }
136
-
137
- onSecondaryAction() {
138
- this.secondaryAction.emit();
139
- }
140
- }
@@ -1,40 +0,0 @@
1
- .navbar-ajust {
2
- background-color: var(--medium);
3
- padding: 1em;
4
- }
5
-
6
- .container-fluid {
7
- display: flex;
8
- justify-content: space-between;
9
- align-items: center;
10
- }
11
-
12
- .navbar-left,
13
- .navbar-right {
14
- flex: 1; /* Ambos ocupam o mesmo espaço */
15
- display: flex;
16
- justify-content: flex-start; /* Alinha o da esquerda à esquerda */
17
- }
18
-
19
- .navbar-right {
20
- justify-content: flex-end; /* Alinha o da direita à direita */
21
- }
22
-
23
- .navbar-center {
24
- flex: 2; /* O dobro do espaço para centralizar corretamente */
25
- display: flex;
26
- justify-content: center;
27
- }
28
- :host {
29
- display: block;
30
- }
31
-
32
- .-translate-y-full {
33
- transform: translateY(calc(-100% - 1px));
34
- }
35
-
36
- @media (max-width: 767px) {
37
- .-translate-y-full {
38
- transform: translateY(calc(-100% - 1px));
39
- }
40
- }
@@ -1,40 +0,0 @@
1
- <!-- Overlay -->
2
- <div
3
- *ngIf="openClose"
4
- (click)="openClose = false"
5
- class="fixed inset-0 bg-black bg-opacity-40 z-40 md:hidden"
6
- ></div>
7
-
8
- <!-- Navbar Container -->
9
- <div
10
- class="fixed top-0 left-0 right-0 z-50 shadow-none transition-transform duration-300 ease-out "
11
- [class.-translate-y-full]="!isHeaderVisible"
12
- [style.backgroundColor]="
13
- changeNavColor ? 'var(--primary)' : 'var(--primary)'
14
- "
15
- >
16
- <!-- Main Navbar -->
17
- <div class="w-full">
18
- <div class="mx-auto px-2 h-16 flex items-center justify-between">
19
- <!-- Left Content -->
20
- <div class="flex-1 flex justify-start">
21
- <ng-content select="[left-content]"></ng-content>
22
- </div>
23
-
24
- <!-- Center Content -->
25
- <div class="flex-1 flex justify-center">
26
- <ng-content select="[central-content]"></ng-content>
27
- </div>
28
-
29
- <!-- Right Content -->
30
- <div class="flex-1" style="display: flex; justify-content: flex-end">
31
- <ng-content select="[right-content]"></ng-content>
32
- </div>
33
- </div>
34
- </div>
35
-
36
- <!-- Header Menu (Submenu) -->
37
- <div header-menu class="w-full hr-nav">
38
- <ng-content select="[header-menu]"></ng-content>
39
- </div>
40
- </div>
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { NavComponent } from './nav.component';
4
-
5
- describe('NavComponent', () => {
6
- let component: NavComponent;
7
- let fixture: ComponentFixture<NavComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ NavComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(NavComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,84 +0,0 @@
1
- import {
2
- Component,
3
- ElementRef,
4
- HostListener,
5
- Input,
6
- OnInit,
7
- } from '@angular/core';
8
- import { Router } from '@angular/router';
9
-
10
- @Component({
11
- selector: 'lib-nav',
12
- templateUrl: './nav.component.html',
13
- styleUrls: ['./nav.component.css'],
14
- })
15
- export class NavComponent implements OnInit {
16
- @Input() changeNavColor: boolean = false;
17
-
18
- openClose: boolean = false;
19
- message: string = '';
20
-
21
- lastScrollPosition = 0;
22
- isHeaderVisible = true;
23
- headerHeight = 0;
24
- isMobile = false;
25
-
26
- hasOffer: boolean = false;
27
-
28
- constructor(private router: Router, private el: ElementRef) {}
29
-
30
- ngAfterViewInit() {
31
- this.checkMobile();
32
-
33
- // Obtém a altura do header-menu após a view ser inicializada
34
- const headerMenu = this.el.nativeElement.querySelector('[header-menu]');
35
- if (headerMenu) {
36
- this.headerHeight = headerMenu.offsetHeight;
37
- }
38
- }
39
-
40
- ngOnInit(): void {
41
- this.hasOffer = this.router.url.includes('offer');
42
- }
43
-
44
- @HostListener('window:resize')
45
- onResize() {
46
- this.checkMobile();
47
- }
48
-
49
- private checkMobile() {
50
- this.isMobile = window.innerWidth < 768; // 768px é o breakpoint padrão do Tailwind para md
51
- if (!this.isMobile) {
52
- this.isHeaderVisible = true; // Garante que fique visível em desktop
53
- }
54
- }
55
- public menu() {
56
- this.openClose = !this.openClose;
57
- }
58
-
59
- receiveMessage(event: string) {
60
- this.message = event;
61
- }
62
-
63
- @HostListener('window:scroll', [])
64
- onWindowScroll() {
65
- if (!this.isMobile) return;
66
-
67
- const currentScrollPosition =
68
- window.pageYOffset || document.documentElement.scrollTop;
69
-
70
- // Scroll DOWN - esconde o header
71
- if (
72
- currentScrollPosition > this.lastScrollPosition &&
73
- currentScrollPosition > 50
74
- ) {
75
- this.isHeaderVisible = false;
76
- }
77
- // Scroll UP - mostra o header
78
- else if (currentScrollPosition < this.lastScrollPosition) {
79
- this.isHeaderVisible = true;
80
- }
81
-
82
- this.lastScrollPosition = currentScrollPosition;
83
- }
84
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { TuduComponentsComponent } from './tudu-components.component';
4
-
5
- describe('TuduComponentsComponent', () => {
6
- let component: TuduComponentsComponent;
7
- let fixture: ComponentFixture<TuduComponentsComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ TuduComponentsComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(TuduComponentsComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,20 +0,0 @@
1
- import { Component, OnInit } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'lib-tudu-components',
5
- template: `
6
- <p>
7
- tudu-components works!sss
8
- </p>
9
- `,
10
- styles: [
11
- ]
12
- })
13
- export class TuduComponentsComponent implements OnInit {
14
-
15
- constructor() { }
16
-
17
- ngOnInit(): void {
18
- }
19
-
20
- }
@@ -1,13 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { TuduComponentsComponent } from './tudu-components.component';
3
- import { CommonModule } from '@angular/common';
4
- import { CardLayoutComponent } from '../lib/components/card-layout/card-layout.component';
5
- import { NavComponent } from './components/nav/nav.component';
6
- import { FallbackMessageComponent } from './components/fallback-message/fallback-message.component';
7
-
8
- @NgModule({
9
- declarations: [TuduComponentsComponent, CardLayoutComponent, NavComponent, FallbackMessageComponent],
10
- imports: [CommonModule],
11
- exports: [TuduComponentsComponent, CardLayoutComponent, NavComponent, FallbackMessageComponent],
12
- })
13
- export class TuduComponentsModule {}
@@ -1,16 +0,0 @@
1
- import { TestBed } from '@angular/core/testing';
2
-
3
- import { TuduComponentsService } from './tudu-components.service';
4
-
5
- describe('TuduComponentsService', () => {
6
- let service: TuduComponentsService;
7
-
8
- beforeEach(() => {
9
- TestBed.configureTestingModule({});
10
- service = TestBed.inject(TuduComponentsService);
11
- });
12
-
13
- it('should be created', () => {
14
- expect(service).toBeTruthy();
15
- });
16
- });
@@ -1,9 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
-
3
- @Injectable({
4
- providedIn: 'root'
5
- })
6
- export class TuduComponentsService {
7
-
8
- constructor() { }
9
- }
package/src/test.ts DELETED
@@ -1,27 +0,0 @@
1
- // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
-
3
- import 'zone.js';
4
- import 'zone.js/testing';
5
- import { getTestBed } from '@angular/core/testing';
6
- import {
7
- BrowserDynamicTestingModule,
8
- platformBrowserDynamicTesting
9
- } from '@angular/platform-browser-dynamic/testing';
10
-
11
- declare const require: {
12
- context(path: string, deep?: boolean, filter?: RegExp): {
13
- <T>(id: string): T;
14
- keys(): string[];
15
- };
16
- };
17
-
18
- // First, initialize the Angular testing environment.
19
- getTestBed().initTestEnvironment(
20
- BrowserDynamicTestingModule,
21
- platformBrowserDynamicTesting(),
22
- );
23
-
24
- // Then we find all the tests.
25
- const context = require.context('./', true, /\.spec\.ts$/);
26
- // And load the modules.
27
- context.keys().forEach(context);
package/tsconfig.lib.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../out-tsc/lib",
5
- "target": "ES2020",
6
- "declaration": true,
7
- "declarationMap": true,
8
- "inlineSources": true,
9
- "types": [],
10
- "lib": ["dom", "es2020"]
11
- },
12
- "angularCompilerOptions": {
13
- "skipTemplateCodegen": true,
14
- "strictMetadataEmit": true,
15
- "enableResourceInlining": true,
16
- "compilationMode": "partial"
17
- },
18
- "exclude": ["src/test.ts", "**/*.spec.ts"]
19
- }
@@ -1,10 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "./tsconfig.lib.json",
4
- "compilerOptions": {
5
- "declarationMap": false
6
- },
7
- "angularCompilerOptions": {
8
- "compilationMode": "partial"
9
- }
10
- }
@@ -1,17 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/spec",
6
- "types": [
7
- "jasmine"
8
- ]
9
- },
10
- "files": [
11
- "src/test.ts"
12
- ],
13
- "include": [
14
- "**/*.spec.ts",
15
- "**/*.d.ts"
16
- ]
17
- }