gentera-rdnd 0.2.2 → 0.2.3

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 (49) hide show
  1. package/fesm2022/gentera-rdnd.mjs +794 -0
  2. package/fesm2022/gentera-rdnd.mjs.map +1 -0
  3. package/index.d.ts +552 -0
  4. package/package.json +17 -9
  5. package/ng-package.json +0 -7
  6. package/src/lib/components/button/button.component.html +0 -21
  7. package/src/lib/components/button/button.component.scss +0 -41
  8. package/src/lib/components/button/button.component.ts +0 -82
  9. package/src/lib/components/input/Readme.md +0 -33
  10. package/src/lib/components/input/input.component.html +0 -50
  11. package/src/lib/components/input/input.component.scss +0 -86
  12. package/src/lib/components/input/input.component.ts +0 -133
  13. package/src/lib/components/modal/modal.component.html +0 -51
  14. package/src/lib/components/modal/modal.component.scss +0 -50
  15. package/src/lib/components/modal/modal.component.ts +0 -41
  16. package/src/lib/components/rdnd-active-indicator/rdnd-active-indicator.component.css +0 -24
  17. package/src/lib/components/rdnd-active-indicator/rdnd-active-indicator.component.html +0 -12
  18. package/src/lib/components/rdnd-active-indicator/rdnd-active-indicator.component.ts +0 -18
  19. package/src/lib/components/rdnd-loader/rdnd-loader.component.html +0 -129
  20. package/src/lib/components/rdnd-loader/rdnd-loader.component.scss +0 -33
  21. package/src/lib/components/rdnd-loader/rdnd-loader.component.ts +0 -27
  22. package/src/lib/components/rdnd-navbar/rdnd-navbar.component.html +0 -19
  23. package/src/lib/components/rdnd-navbar/rdnd-navbar.component.scss +0 -40
  24. package/src/lib/components/rdnd-navbar/rdnd-navbar.component.ts +0 -59
  25. package/src/lib/components/rdnd-sidebar/rdnd-sidebar.component.html +0 -144
  26. package/src/lib/components/rdnd-sidebar/rdnd-sidebar.component.scss +0 -221
  27. package/src/lib/components/rdnd-sidebar/rdnd-sidebar.component.ts +0 -65
  28. package/src/lib/components/screen-title/screen-title.component.html +0 -5
  29. package/src/lib/components/screen-title/screen-title.component.scss +0 -15
  30. package/src/lib/components/screen-title/screen-title.component.ts +0 -20
  31. package/src/lib/config/rdnd-config.token.ts +0 -6
  32. package/src/lib/gentera-rdnd.component.ts +0 -16
  33. package/src/lib/gentera-rdnd.service.ts +0 -9
  34. package/src/lib/hooks/button.service.ts +0 -31
  35. package/src/lib/hooks/input.service.ts +0 -73
  36. package/src/lib/hooks/modal.service.ts +0 -112
  37. package/src/lib/services/storage.service.ts +0 -31
  38. package/src/lib/styles/colors.scss +0 -63
  39. package/src/lib/styles/colors.ts +0 -55
  40. package/src/lib/styles/fonts.scss +0 -93
  41. package/src/lib/styles/sizes.scss +0 -10
  42. package/src/lib/styles/themes.ts +0 -114
  43. package/src/lib/styles/z_indexes.scss +0 -3
  44. package/src/lib/types/Loader-config.types.ts +0 -8
  45. package/src/lib/types/Sidebar.types.ts +0 -6
  46. package/src/public-api.ts +0 -31
  47. package/tsconfig.lib.json +0 -25
  48. package/tsconfig.lib.prod.json +0 -11
  49. package/tsconfig.spec.json +0 -15
@@ -1,82 +0,0 @@
1
- import { Component, Input, Output, EventEmitter, OnInit, OnDestroy } from '@angular/core';
2
- import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
3
- import {Observable, Subscription} from 'rxjs';
4
- import {FaIconComponent} from "@fortawesome/angular-fontawesome";
5
- import {NgClass, NgIf} from "@angular/common";
6
- // @ts-ignore
7
- import {themes} from "../../styles/themes";
8
- import {ButtonService, ButtonServiceType} from "../../hooks/button.service";
9
- // @ts-ignore
10
-
11
-
12
-
13
- @Component({
14
- selector: 'rdnd-button',
15
- templateUrl: './button.component.html',
16
- standalone: true,
17
- imports: [
18
- FaIconComponent,
19
- NgIf,
20
- NgClass
21
- ],
22
- styleUrls: ['./button.component.scss']
23
- })
24
- export class RdndButton implements OnInit, OnDestroy {
25
- @Input() id!: string;
26
- @Input() icon?: IconDefinition;
27
- @Input() text: string = 'Enviar';
28
- @Input() theme: any = themes.magenta;
29
- @Input() size: 'contained' | 'full' = 'full';
30
- @Input() type: 'button' | 'submit' | 'reset' = 'submit';
31
- @Input() borders: boolean = true;
32
- @Input() disabled: boolean = false;
33
-
34
- @Output() callback: EventEmitter<void> = new EventEmitter<void>();
35
-
36
- protected readonly themes = themes;
37
- private subscription!: Subscription;
38
- hoverBackgroundColor: string = this.theme.default;
39
-
40
- buttonControl!: ButtonServiceType ;
41
-
42
- constructor(private buttonService: ButtonService) {
43
- }
44
-
45
- ngOnInit(): void {
46
- this.buttonControl = this.buttonService.useButton(this.id);
47
-
48
- this.subscription = new Subscription( () =>
49
- this.buttonControl.disabled$.subscribe((isDisabled: boolean) => {
50
- this.disabled = isDisabled;
51
- })
52
- )
53
-
54
- }
55
-
56
- ngOnDestroy(): void {
57
- if(this.subscription){
58
- this.subscription.unsubscribe();
59
- }
60
- }
61
-
62
- handleClick(event: MouseEvent): void {
63
- event.stopPropagation();
64
- if (!this.disabled && this.type !== 'submit') {
65
- this.callback.emit();
66
- }
67
- }
68
-
69
- onMouseEnter() {
70
- if (!this.disabled) {
71
- this.hoverBackgroundColor = this.theme.hover;
72
- }
73
- }
74
-
75
- onMouseLeave() {
76
- if (!this.disabled) {
77
- this.hoverBackgroundColor = this.theme.default;
78
- }
79
- }
80
-
81
- protected readonly event = event;
82
- }
@@ -1,33 +0,0 @@
1
- # 📥 Componente: `rdnd-input`
2
-
3
- Este componente representa un campo de entrada (`input`) reutilizable con soporte para validaciones, tipos de entrada (`text`, `password`, `number`), íconos de error, y control de visibilidad de contraseñas.
4
-
5
- ---
6
-
7
- ## ✅ Uso básico
8
-
9
- ```html
10
- <rdnd-input
11
- [id]="'usuario'"
12
- [name]="'usuario'"
13
- [type]="'text'"
14
- [placeholder]="'Ingresa tu usuario'"
15
- [value]="usuario"
16
- [validators]="[Validators.required]"
17
- (valueChange)="usuario = $event"
18
- ></rdnd-input>
19
- ```
20
-
21
-
22
- ## ✅ Ejemplo de uso avanzado
23
- ```html
24
- <rdnd-input
25
- id="input-login-username"
26
- name="login-username"
27
- type="text"
28
- placeholder="Contraseña"
29
- [value]="clave"
30
- [validators]="[Validators.required, Validators.minLength(6)]"
31
- (valueChange)="clave = $event"
32
- (onBlur)="validarClave($event)"
33
- ></rdnd-input>
@@ -1,50 +0,0 @@
1
- <div [ngClass]="{ 'disabled': disabled }" class="input-container">
2
- <!-- Ícono de error que aparece por encima del campo si hay error -->
3
- <span *ngIf="hasError()" class="error-icon" (click)="toggleErrorDisplay()">&#9432;</span>
4
-
5
- <!-- Botón de mostrar/ocultar contraseña centrado verticalmente -->
6
- <button *ngIf="type === 'password'" type="button" (click)="handleTogglePassword()" class="toggle-button">
7
- <fa-icon [icon]="faEyeSlash" class="icon" [class.active]="showPassword"></fa-icon>
8
- </button>
9
-
10
- @if (showLabel) {
11
- <label class="text-small dark-gray">{{ placeholder }}</label>
12
- }
13
-
14
-
15
- <!-- Input compatible con FormControl o signals -->
16
- <input
17
- *ngIf="control; else signalInput"
18
- [type]="type === 'password' && showPassword ? 'text' : type"
19
- [formControl]="control"
20
- [placeholder]="showLabel ? '' : placeholder"
21
- [disabled]="disabled"
22
- (keydown)="handleKeyDown($event)"
23
- (paste)="handlePaste($event)"
24
- (focus)="handleFocus($event)"
25
- (blur)="handleBlur($event)"
26
- [ngClass]="{ 'error-border': hasError() }"
27
- />
28
-
29
- <!-- Input para signals -->
30
- <ng-template #signalInput>
31
- <input
32
- [type]="type === 'password' && showPassword ? 'text' : type"
33
- [value]="value"
34
- [placeholder]="showLabel ? '' : placeholder"
35
- [disabled]="disabled"
36
- (input)="handleChange($event)"
37
- (keydown)="handleKeyDown($event)"
38
- (paste)="handlePaste($event)"
39
- (focus)="handleFocus($event)"
40
- (blur)="handleBlur($event)"
41
- [ngClass]="{ 'error-border': false }"
42
- />
43
- </ng-template>
44
-
45
-
46
- <!-- Mensaje de error que aparece solo cuando se clickea en el ícono de error -->
47
- <div *ngIf="control?.invalid && control?.dirty && showError" class="error-message">
48
- {{ getErrorMessage() }}
49
- </div>
50
- </div>
@@ -1,86 +0,0 @@
1
- .input-container {
2
- width: 100%;
3
- min-width: 100%;
4
- box-sizing: border-box;
5
- position: relative;
6
- display: block;
7
- }
8
-
9
- input {
10
- position: relative;
11
- width: 100%;
12
- min-width: 100%;
13
- padding: 7px 35px 7px 8px;
14
- border-radius: 3px;
15
- font-family: 'Poppins', sans-serif;
16
- height: 36px;
17
- font-size: 14px;
18
- border: 1px solid #ccc;
19
- outline: none;
20
- box-sizing: border-box;
21
- transition: all 0.3s ease;
22
- background-color: white !important;
23
- appearance: none;
24
- -moz-appearance: textfield;
25
- -webkit-appearance: textfield;
26
-
27
- &:-webkit-autofill {
28
- background-color: white !important;
29
- }
30
-
31
- &.error-border {
32
- border-color: red;
33
- }
34
- }
35
-
36
- input:focus {
37
- border: 1px solid blue;
38
- }
39
-
40
- .error-icon {
41
- position: absolute;
42
- right: 8px;
43
- top: 1px;
44
- bottom: 1px;
45
- font-size: 24px;
46
- color: red;
47
- cursor: pointer;
48
- display: flex;
49
- flex-direction: column;
50
- justify-content: center;
51
- align-items: center;
52
- z-index: 3;
53
- background-color: white;
54
- }
55
-
56
- .error-message {
57
- position: absolute;
58
- bottom: 0;
59
- left: 0;
60
- //background-color: #ffdddd;
61
- color: red;
62
- padding: 0 0 0 8px;
63
- border-radius: 4px;
64
- font-size: 12px;
65
- font-family: sans-serif;
66
- white-space: nowrap;
67
- }
68
-
69
- .toggle-button {
70
- position: absolute;
71
- right: 8px;
72
- top: 50%;
73
- transform: translateY(-50%);
74
- background: transparent;
75
- border: none;
76
- cursor: pointer;
77
- z-index: 2;
78
- }
79
-
80
- .icon {
81
- transition: opacity 0.3s ease;
82
- }
83
-
84
- .icon.active {
85
- opacity: 0.5;
86
- }
@@ -1,133 +0,0 @@
1
- import {Component, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges} from '@angular/core';
2
- import {FormControl, ReactiveFormsModule, ValidationErrors, ValidatorFn, Validators} from '@angular/forms';
3
- import {faEyeSlash} from '@fortawesome/free-solid-svg-icons';
4
- import {NgClass, NgIf} from '@angular/common';
5
- import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
6
- import {InputService} from "../../hooks/input.service";
7
-
8
-
9
- @Component({
10
- selector: 'rdnd-input',
11
- templateUrl: './input.component.html',
12
- standalone: true,
13
- imports: [
14
- NgIf,
15
- NgClass,
16
- FontAwesomeModule,
17
- ReactiveFormsModule
18
- ],
19
- styleUrls: ['./input.component.scss']
20
- })
21
- export class RdndInput implements OnInit, OnChanges {
22
- @Input() id!: string;
23
- @Input() name!: string;
24
- @Input() type: 'text' | 'password' | 'number' = 'text';
25
- @Input() placeholder: string = '';
26
- @Input() showLabel: boolean = false;
27
- @Input() control?: FormControl;
28
- @Input() value: string = '';
29
- @Input() validators: ValidatorFn[] = [];
30
- @Input() disabled: boolean = false;
31
-
32
- @Output() valueChange = new EventEmitter<string>();
33
- @Output() onKeyDown = new EventEmitter<KeyboardEvent>();
34
- @Output() onPaste = new EventEmitter<ClipboardEvent>();
35
- @Output() onFocus = new EventEmitter<FocusEvent>();
36
- @Output() onBlur = new EventEmitter<FocusEvent>();
37
-
38
- faEyeSlash = faEyeSlash;
39
- showPassword: boolean = false;
40
- showError: boolean = false;
41
-
42
- constructor(private inputService: InputService) {
43
- }
44
-
45
-
46
- ngOnInit() {
47
- if (this.control) {
48
- this.control.addValidators(this.validators);
49
- this.control.valueChanges.subscribe((value) => {
50
- this.valueChange.emit(value);
51
- this.inputService.updateInputState(this.control!, this.id);
52
- });
53
- } else {
54
- this.control = new FormControl(this.value, this.validators);
55
- this.control.valueChanges.subscribe((value) => {
56
- this.valueChange.emit(value);
57
- this.inputService.updateInputState(this.control!, this.id);
58
- });
59
- }
60
- }
61
-
62
- ngOnChanges(changes: SimpleChanges) {
63
- if (this.control) {
64
- this.control.addValidators(this.validators);
65
- this.control.valueChanges.subscribe((value) => {
66
- this.valueChange.emit(value);
67
- this.inputService.updateInputState(this.control!, this.id);
68
- });
69
- } else {
70
- this.control = new FormControl(this.value, this.validators);
71
- this.control.valueChanges.subscribe((value) => {
72
- this.valueChange.emit(value);
73
- this.inputService.updateInputState(this.control!, this.id);
74
- });
75
- }
76
- }
77
-
78
-
79
-
80
- getErrorMessage(): string | null {
81
- if (this.control && this.control.errors) {
82
- const errorKeys = Object.keys(this.control.errors);
83
- if (errorKeys.length > 0) {
84
- const firstErrorKey = errorKeys[0];
85
- return (this.control.errors as ValidationErrors)[firstErrorKey];
86
- }
87
- }
88
- return null;
89
- }
90
-
91
- toggleErrorDisplay() {
92
- this.showError = !this.showError;
93
- }
94
-
95
- hasError(): boolean {
96
- return !!this.control && this.control.invalid && (this.control.dirty || this.control.touched);
97
- }
98
-
99
- handleTogglePassword(): void {
100
- this.showPassword = !this.showPassword;
101
- }
102
-
103
- handleChange(event: Event) {
104
- const e = event.target as HTMLInputElement
105
- this.valueChange.emit(e.value);
106
- }
107
-
108
- handleKeyDown(event: KeyboardEvent): void {
109
- const allowRegex = /^[a-zA-Z!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]*$/
110
-
111
- if (
112
- this.type === 'number' && !(
113
- ['Backspace', 'Shift', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(event.key)
114
- ) && !(event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
115
- ) {
116
- event.key.match(allowRegex) ? event.preventDefault() : this.onKeyDown.emit(event);
117
- } else {
118
- this.onKeyDown.emit(event);
119
- }
120
- }
121
-
122
- handlePaste(event: ClipboardEvent): void {
123
- this.onPaste.emit(event);
124
- }
125
-
126
- handleFocus(event: FocusEvent): void {
127
- this.onFocus.emit(event);
128
- }
129
-
130
- handleBlur(event: FocusEvent): void {
131
- this.onBlur.emit(event);
132
- }
133
- }
@@ -1,51 +0,0 @@
1
- <div class="modal-wrapper">
2
-
3
- <div class="container" (click)="$event.stopPropagation()">
4
-
5
- <div class="content">
6
-
7
- @if (icon) {
8
- <fa-icon [icon]="icon" class="icon" [style.color]="theme.default"
9
- />
10
- }
11
-
12
- <span class="subtitle align-center">{{ title }}</span>
13
-
14
- <div class="text align-center" [innerHTML]="content">
15
- </div>
16
-
17
-
18
- @if (type !== 'question') {
19
- <rdnd-button
20
- [id]="'btn-modal'"
21
- [type]="'button'"
22
- (callback)="closeModal(true)"
23
- [text]="'Aceptar'"
24
- [theme]="theme"
25
- [size]="'full'"
26
- />
27
- } @else {
28
- <rdnd-button
29
- [id]="'btn-modal-accept'"
30
- [type]="'button'"
31
- (callback)="closeModal(true)"
32
- [text]="confirmText"
33
- [theme]="theme"
34
- [size]="'full'"
35
- />
36
- <rdnd-button
37
- [id]="'btn-modal-cancel'"
38
- [type]="'button'"
39
- (callback)="closeModal(false)"
40
- [text]="cancelText"
41
- [theme]="themes.borderedMagenta"
42
- [size]="'full'"
43
- />
44
- }
45
-
46
- </div>
47
-
48
-
49
- </div>
50
- </div>
51
-
@@ -1,50 +0,0 @@
1
- @use "../../styles/z_indexes";
2
- @use "../../styles/sizes";
3
- @use "../../styles/fonts";
4
- @use "../../styles/colors";
5
-
6
- .modal-wrapper {
7
- position: fixed;
8
- top: 0;
9
- bottom: 0;
10
- left: 0;
11
- right: 0;
12
- z-index: z_indexes.$z-index-modal;
13
- background-color: rgba(0, 0, 0, 0.7);
14
- backdrop-filter: blur(5px);
15
- display: flex;
16
- justify-content: center;
17
- align-items: center;
18
- padding: 16px;
19
- }
20
-
21
- .modal-wrapper .container {
22
- width: 100%;
23
- max-width: sizes.$screen-max-width-small;
24
- background-color: white;
25
- padding: 32px 16px;
26
- border-radius: 4px;
27
- position: relative;
28
- }
29
-
30
- .modal-wrapper .container .content {
31
- display: flex;
32
- flex-direction: column;
33
- gap: 8px;
34
- width: 100%;
35
- max-width: 380px;
36
- margin: auto;
37
-
38
- .icon {
39
- margin: auto;
40
- font-size: 40px;
41
- line-height: normal;
42
- }
43
-
44
- p {
45
- margin: 14px 0;
46
- }
47
-
48
-
49
-
50
- }
@@ -1,41 +0,0 @@
1
- import {Component, EventEmitter, Input, Output} from '@angular/core';
2
- import {CommonModule} from '@angular/common';
3
- import {IconDefinition} from '@fortawesome/free-solid-svg-icons';
4
- import {themes} from "../../styles/themes";
5
- import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
6
- import {RdndButton} from "../button/button.component";
7
- import {RdndScreenTitle} from "../screen-title/screen-title.component";
8
-
9
- @Component({
10
- selector: 'rdnd-modal',
11
- standalone: true,
12
- imports: [
13
- CommonModule,
14
- FontAwesomeModule,
15
- RdndButton,
16
- RdndScreenTitle,
17
- ],
18
- templateUrl: './modal.component.html',
19
- styleUrl: './modal.component.scss'
20
- })
21
- export class RdndModal {
22
- @Input() title: string = '';
23
- @Input() type: 'success' | 'error' | 'question' | 'warning' | 'info' = 'success';
24
- @Input() theme: any = themes.magenta;
25
- @Input() confirmText: string = '';
26
- @Input() cancelText: string = '';
27
- @Output() close = new EventEmitter<boolean>();
28
-
29
- protected readonly themes = themes;
30
-
31
- icon?: IconDefinition;
32
- content: string = '';
33
-
34
- closeModal(result: boolean) {
35
- this.close.emit(result);
36
- }
37
-
38
- constructor() {
39
- }
40
-
41
- }
@@ -1,24 +0,0 @@
1
- .rdnd-active-indicator-wrapper {
2
- width: 70px;
3
- height: 24px;
4
- padding: 1px 4px;
5
- border-radius: 4px;
6
- display: flex;
7
- flex-direction: row;
8
- place-content: center;
9
- place-items: center;
10
- box-sizing: border-box;
11
- &.active {
12
- background-color: #19C496;
13
- color: #156a29;
14
- }
15
- &.inactive {
16
- background-color: #f16683;
17
- color: #77113a;
18
- }
19
-
20
- span {
21
- font-size: 12px;
22
- }
23
-
24
- }
@@ -1,12 +0,0 @@
1
- <div class="rdnd-active-indicator-wrapper" [ngClass]="{
2
- active: isActive,
3
- inactive: !isActive
4
- }">
5
- <span>
6
- @if (isActive) {
7
- {{ activeDisplay }}
8
- } @else {
9
- {{ inactiveDisplay }}
10
- }
11
- </span>
12
- </div>
@@ -1,18 +0,0 @@
1
- import {Component, Input} from '@angular/core';
2
- import {NgClass} from "@angular/common";
3
-
4
- @Component({
5
- selector: 'rdnd-active-indicator',
6
- standalone: true,
7
- imports: [
8
- NgClass
9
- ],
10
- templateUrl: './rdnd-active-indicator.component.html',
11
- styleUrl: './rdnd-active-indicator.component.css'
12
- })
13
- export class RdndActiveIndicator {
14
- @Input() isActive: boolean = false;
15
- @Input() activeDisplay?: string = "Activo";
16
- @Input() inactiveDisplay?: string = "Inactivo";
17
-
18
- }