@up_si_vale/sivale-componentes-angular 1.0.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 +81 -0
- package/ng-package.json +9 -0
- package/package.json +40 -0
- package/src/lib/atoms/button/button.component.html +21 -0
- package/src/lib/atoms/button/button.component.scss +242 -0
- package/src/lib/atoms/button/button.component.ts +43 -0
- package/src/lib/atoms/checkbox/checkbox.component.scss +131 -0
- package/src/lib/atoms/checkbox/checkbox.component.ts +130 -0
- package/src/lib/atoms/date-picker/date-picker.component.html +295 -0
- package/src/lib/atoms/date-picker/date-picker.component.scss +1002 -0
- package/src/lib/atoms/date-picker/date-picker.component.ts +942 -0
- package/src/lib/atoms/input/input.component.ts +239 -0
- package/src/lib/atoms/loader/loader.component.scss +144 -0
- package/src/lib/atoms/loader/loader.component.ts +44 -0
- package/src/lib/atoms/radio/radio.component.scss +115 -0
- package/src/lib/atoms/radio/radio.component.ts +103 -0
- package/src/lib/atoms/textarea/textarea.component.ts +155 -0
- package/src/lib/directives/asset-source.directive.ts +64 -0
- package/src/lib/directives/icon-source.directive.ts +74 -0
- package/src/lib/directives/no-leading-space.directive.ts +18 -0
- package/src/lib/directives/only-letters.directive.ts +21 -0
- package/src/lib/directives/only-number.directive.ts +15 -0
- package/src/lib/directives/rfc.directive.ts +60 -0
- package/src/lib/directives/tooltip.directive.ts +211 -0
- package/src/lib/models/snackbar.models.ts +16 -0
- package/src/lib/molecules/copy-input/copy-input.component.html +29 -0
- package/src/lib/molecules/copy-input/copy-input.component.scss +101 -0
- package/src/lib/molecules/copy-input/copy-input.component.ts +41 -0
- package/src/lib/molecules/multiselect/multiselect.component.scss +298 -0
- package/src/lib/molecules/multiselect/multiselect.component.ts +487 -0
- package/src/lib/molecules/option/option.component.ts +45 -0
- package/src/lib/molecules/phone-input/phone-input.component.scss +78 -0
- package/src/lib/molecules/phone-input/phone-input.component.ts +43 -0
- package/src/lib/molecules/select/select.component.ts +482 -0
- package/src/lib/molecules/snackbar/snackbar.component.scss +201 -0
- package/src/lib/molecules/snackbar/snackbar.component.ts +321 -0
- package/src/lib/services/snackbar.service.ts +103 -0
- package/src/lib/tokens/asset-base-url.token.ts +10 -0
- package/src/public-api.ts +38 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { Component, OnInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { Subscription } from 'rxjs';
|
|
4
|
+
import { SnackbarService } from '../../services/snackbar.service';
|
|
5
|
+
import { SnackbarData } from '../../models/snackbar.models';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'app-snackbar',
|
|
9
|
+
standalone: true,
|
|
10
|
+
imports: [CommonModule],
|
|
11
|
+
template: `
|
|
12
|
+
<!-- Top Right -->
|
|
13
|
+
<div class="snackbar-container snackbar-container--top-right" *ngIf="getSnackbarsByPosition('top-right').length > 0">
|
|
14
|
+
<div
|
|
15
|
+
*ngFor="let snackbar of getSnackbarsByPosition('top-right')"
|
|
16
|
+
class="snackbar"
|
|
17
|
+
[class.snackbar--success]="snackbar.type === 'success'"
|
|
18
|
+
[class.snackbar--error]="snackbar.type === 'error'"
|
|
19
|
+
[class.snackbar--warning]="snackbar.type === 'warning'"
|
|
20
|
+
[class.snackbar--info]="snackbar.type === 'info'"
|
|
21
|
+
>
|
|
22
|
+
<div class="snackbar__icon">
|
|
23
|
+
<svg *ngIf="snackbar.type === 'success'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
24
|
+
<path d="M16.6667 5L7.50004 14.1667L3.33337 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
25
|
+
</svg>
|
|
26
|
+
<svg *ngIf="snackbar.type === 'error'" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
27
|
+
<path d="M11.96 2.37695C13.2212 2.38797 14.4681 2.65061 15.627 3.14844C16.7858 3.64631 17.8337 4.37013 18.71 5.27734L18.7158 5.2832L18.7227 5.28906C19.63 6.1654 20.3537 7.21402 20.8516 8.37305C21.3494 9.53204 21.6111 10.7787 21.6221 12.04C21.633 13.3014 21.3927 14.5523 20.915 15.7197C20.4374 16.8872 19.7318 17.9479 18.8398 18.8398C17.9479 19.7318 16.8872 20.4374 15.7197 20.915C14.5523 21.3927 13.3014 21.633 12.04 21.6221C10.7787 21.6111 9.53204 21.3494 8.37305 20.8516C7.21402 20.3537 6.1654 19.63 5.28906 18.7227L5.2832 18.7158L5.27734 18.71L4.94531 18.374C4.19221 17.5705 3.58408 16.641 3.14844 15.627C2.65061 14.4681 2.38797 13.2212 2.37695 11.96C2.36599 10.6986 2.60632 9.44681 3.08398 8.2793C3.56165 7.11184 4.26724 6.05112 5.15918 5.15918C6.05112 4.26724 7.11184 3.56165 8.2793 3.08398C9.44681 2.60632 10.6986 2.36599 11.96 2.37695ZM13.6523 3.66797C11.7234 3.28574 9.7209 3.58451 7.9873 4.5127C6.25388 5.4409 4.89578 6.94166 4.14453 8.75879C3.39335 10.5759 3.29528 12.5973 3.86719 14.4785C4.43922 16.3599 5.64653 17.9847 7.28223 19.0762C8.91789 20.1676 10.8811 20.6587 12.8379 20.4648C14.7947 20.271 16.623 19.4038 18.0127 18.0127C18.8041 17.2243 19.4316 16.2872 19.8584 15.2549C20.2319 14.3515 20.4462 13.3914 20.4912 12.417L20.5 11.998C20.4981 10.0321 19.8148 8.12717 18.5664 6.6084C17.3178 5.08945 15.5811 4.05022 13.6523 3.66797ZM15 8.49414C15.0659 8.49416 15.1315 8.50686 15.1924 8.53223C15.2531 8.55755 15.3081 8.59493 15.3545 8.6416L15.3574 8.64453C15.4043 8.69099 15.4414 8.74672 15.4668 8.80762C15.4922 8.86855 15.5059 8.93399 15.5059 9C15.5058 9.06595 15.4922 9.1315 15.4668 9.19238C15.4414 9.25316 15.4042 9.3081 15.3574 9.35449V9.35547L13.0566 11.6455L12.7012 12L13.0566 12.3545L15.3574 14.6445C15.4043 14.691 15.4414 14.7467 15.4668 14.8076C15.4922 14.8685 15.5059 14.934 15.5059 15C15.5058 15.0659 15.4922 15.1315 15.4668 15.1924C15.4414 15.2532 15.4042 15.3081 15.3574 15.3545L15.3545 15.3574C15.3081 15.4042 15.2532 15.4414 15.1924 15.4668C15.1315 15.4922 15.0659 15.5058 15 15.5059C14.934 15.5059 14.8685 15.4922 14.8076 15.4668C14.7467 15.4414 14.691 15.4043 14.6445 15.3574L12.3545 13.0566L12 12.7012L11.6455 13.0566L9.35547 15.3574H9.35449C9.3081 15.4042 9.25316 15.4414 9.19238 15.4668C9.1315 15.4922 9.06595 15.5058 9 15.5059C8.93399 15.5059 8.86855 15.4922 8.80762 15.4668C8.74672 15.4414 8.69099 15.4043 8.64453 15.3574L8.6416 15.3545C8.59493 15.3081 8.55755 15.2531 8.53223 15.1924C8.50686 15.1315 8.49416 15.0659 8.49414 15C8.49414 14.9341 8.50688 14.8685 8.53223 14.8076C8.55761 14.7467 8.59475 14.691 8.6416 14.6445H8.64258L10.9424 12.3545L11.2988 12L10.9424 11.6455L8.64258 9.35547C8.54859 9.26105 8.49614 9.13325 8.49609 9C8.49609 8.86631 8.54902 8.73809 8.64355 8.64355C8.73809 8.54902 8.86631 8.49609 9 8.49609C9.10009 8.49613 9.1972 8.52542 9.2793 8.58008L9.35645 8.64355L11.6455 10.9424L12 11.2988L12.3545 10.9424L14.6445 8.64258V8.6416C14.691 8.59475 14.7467 8.55761 14.8076 8.53223C14.8685 8.50688 14.9341 8.49414 15 8.49414Z" stroke="#F04438"/>
|
|
28
|
+
</svg>
|
|
29
|
+
<svg *ngIf="snackbar.type === 'warning'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
30
|
+
<path d="M10 7V11M10 15H10.01M8.60001 3.5L1.95001 15C1.69137 15.4584 1.55396 15.9753 1.55189 16.5015C1.54982 17.0277 1.68317 17.5456 1.93827 18.006C2.19337 18.4663 2.56117 18.8535 3.00616 19.1305C3.45115 19.4075 3.95928 19.5648 4.48001 19.5882H17.52C18.0407 19.5648 18.5489 19.4075 18.9939 19.1305C19.4388 18.8535 19.8066 18.4663 20.0617 18.006C20.3168 17.5456 20.4502 17.0277 20.4481 16.5015C20.446 15.9753 20.3086 15.4584 20.05 15L13.4 3.5C13.1332 3.05942 12.7619 2.69355 12.3198 2.43406C11.8777 2.17458 11.3783 2.02954 10.87 2.00967C10.3617 1.98981 9.85362 2.09565 9.39278 2.31848C8.93194 2.5413 8.53223 2.87461 8.23001 3.29L8.60001 3.5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31
|
+
</svg>
|
|
32
|
+
<svg *ngIf="snackbar.type === 'info'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
33
|
+
<path d="M10 14V10M10 6H10.01M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
34
|
+
</svg>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="snackbar__content">
|
|
37
|
+
<p class="snackbar__message">{{ snackbar.message }}</p>
|
|
38
|
+
</div>
|
|
39
|
+
<button
|
|
40
|
+
*ngIf="snackbar.action"
|
|
41
|
+
class="snackbar__action"
|
|
42
|
+
(click)="handleAction(snackbar)">
|
|
43
|
+
{{ snackbar.action }}
|
|
44
|
+
</button>
|
|
45
|
+
<button
|
|
46
|
+
class="snackbar__close"
|
|
47
|
+
(click)="dismiss(snackbar.id)"
|
|
48
|
+
aria-label="Cerrar">
|
|
49
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
50
|
+
<path d="M13 1L1 13M1 1L13 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
51
|
+
</svg>
|
|
52
|
+
</button>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<!-- Top Left -->
|
|
57
|
+
<div class="snackbar-container snackbar-container--top-left" *ngIf="getSnackbarsByPosition('top-left').length > 0">
|
|
58
|
+
<div
|
|
59
|
+
*ngFor="let snackbar of getSnackbarsByPosition('top-left')"
|
|
60
|
+
class="snackbar"
|
|
61
|
+
[class.snackbar--success]="snackbar.type === 'success'"
|
|
62
|
+
[class.snackbar--error]="snackbar.type === 'error'"
|
|
63
|
+
[class.snackbar--warning]="snackbar.type === 'warning'"
|
|
64
|
+
[class.snackbar--info]="snackbar.type === 'info'"
|
|
65
|
+
>
|
|
66
|
+
<div class="snackbar__icon">
|
|
67
|
+
<svg *ngIf="snackbar.type === 'success'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
68
|
+
<path d="M16.6667 5L7.50004 14.1667L3.33337 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
69
|
+
</svg>
|
|
70
|
+
<svg *ngIf="snackbar.type === 'error'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
71
|
+
<path d="M10 6V10M10 14H10.01M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
72
|
+
</svg>
|
|
73
|
+
<svg *ngIf="snackbar.type === 'warning'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
74
|
+
<path d="M10 7V11M10 15H10.01M8.60001 3.5L1.95001 15C1.69137 15.4584 1.55396 15.9753 1.55189 16.5015C1.54982 17.0277 1.68317 17.5456 1.93827 18.006C2.19337 18.4663 2.56117 18.8535 3.00616 19.1305C3.45115 19.4075 3.95928 19.5648 4.48001 19.5882H17.52C18.0407 19.5648 18.5489 19.4075 18.9939 19.1305C19.4388 18.8535 19.8066 18.4663 20.0617 18.006C20.3168 17.5456 20.4502 17.0277 20.4481 16.5015C20.446 15.9753 20.3086 15.4584 20.05 15L13.4 3.5C13.1332 3.05942 12.7619 2.69355 12.3198 2.43406C11.8777 2.17458 11.3783 2.02954 10.87 2.00967C10.3617 1.98981 9.85362 2.09565 9.39278 2.31848C8.93194 2.5413 8.53223 2.87461 8.23001 3.29L8.60001 3.5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
75
|
+
</svg>
|
|
76
|
+
<svg *ngIf="snackbar.type === 'info'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
77
|
+
<path d="M10 14V10M10 6H10.01M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
78
|
+
</svg>
|
|
79
|
+
</div>
|
|
80
|
+
<div class="snackbar__content">
|
|
81
|
+
<p class="snackbar__message">{{ snackbar.message }}</p>
|
|
82
|
+
</div>
|
|
83
|
+
<button
|
|
84
|
+
*ngIf="snackbar.action"
|
|
85
|
+
class="snackbar__action"
|
|
86
|
+
(click)="handleAction(snackbar)">
|
|
87
|
+
{{ snackbar.action }}
|
|
88
|
+
</button>
|
|
89
|
+
<button
|
|
90
|
+
class="snackbar__close"
|
|
91
|
+
(click)="dismiss(snackbar.id)"
|
|
92
|
+
aria-label="Cerrar">
|
|
93
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
94
|
+
<path d="M13 1L1 13M1 1L13 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
95
|
+
</svg>
|
|
96
|
+
</button>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<!-- Top Center -->
|
|
101
|
+
<div class="snackbar-container snackbar-container--top-center" *ngIf="getSnackbarsByPosition('top-center').length > 0">
|
|
102
|
+
<div
|
|
103
|
+
*ngFor="let snackbar of getSnackbarsByPosition('top-center')"
|
|
104
|
+
class="snackbar"
|
|
105
|
+
[class.snackbar--success]="snackbar.type === 'success'"
|
|
106
|
+
[class.snackbar--error]="snackbar.type === 'error'"
|
|
107
|
+
[class.snackbar--warning]="snackbar.type === 'warning'"
|
|
108
|
+
[class.snackbar--info]="snackbar.type === 'info'"
|
|
109
|
+
>
|
|
110
|
+
<div class="snackbar__icon">
|
|
111
|
+
<svg *ngIf="snackbar.type === 'success'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
112
|
+
<path d="M16.6667 5L7.50004 14.1667L3.33337 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
113
|
+
</svg>
|
|
114
|
+
<svg *ngIf="snackbar.type === 'error'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
115
|
+
<path d="M10 6V10M10 14H10.01M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
116
|
+
</svg>
|
|
117
|
+
<svg *ngIf="snackbar.type === 'warning'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
118
|
+
<path d="M10 7V11M10 15H10.01M8.60001 3.5L1.95001 15C1.69137 15.4584 1.55396 15.9753 1.55189 16.5015C1.54982 17.0277 1.68317 17.5456 1.93827 18.006C2.19337 18.4663 2.56117 18.8535 3.00616 19.1305C3.45115 19.4075 3.95928 19.5648 4.48001 19.5882H17.52C18.0407 19.5648 18.5489 19.4075 18.9939 19.1305C19.4388 18.8535 19.8066 18.4663 20.0617 18.006C20.3168 17.5456 20.4502 17.0277 20.4481 16.5015C20.446 15.9753 20.3086 15.4584 20.05 15L13.4 3.5C13.1332 3.05942 12.7619 2.69355 12.3198 2.43406C11.8777 2.17458 11.3783 2.02954 10.87 2.00967C10.3617 1.98981 9.85362 2.09565 9.39278 2.31848C8.93194 2.5413 8.53223 2.87461 8.23001 3.29L8.60001 3.5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
119
|
+
</svg>
|
|
120
|
+
<svg *ngIf="snackbar.type === 'info'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
121
|
+
<path d="M10 14V10M10 6H10.01M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
122
|
+
</svg>
|
|
123
|
+
</div>
|
|
124
|
+
<div class="snackbar__content">
|
|
125
|
+
<p class="snackbar__message">{{ snackbar.message }}</p>
|
|
126
|
+
</div>
|
|
127
|
+
<button
|
|
128
|
+
*ngIf="snackbar.action"
|
|
129
|
+
class="snackbar__action"
|
|
130
|
+
(click)="handleAction(snackbar)">
|
|
131
|
+
{{ snackbar.action }}
|
|
132
|
+
</button>
|
|
133
|
+
<button
|
|
134
|
+
class="snackbar__close"
|
|
135
|
+
(click)="dismiss(snackbar.id)"
|
|
136
|
+
aria-label="Cerrar">
|
|
137
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
138
|
+
<path d="M13 1L1 13M1 1L13 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
139
|
+
</svg>
|
|
140
|
+
</button>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<!-- Bottom Right -->
|
|
145
|
+
<div class="snackbar-container snackbar-container--bottom-right" *ngIf="getSnackbarsByPosition('bottom-right').length > 0">
|
|
146
|
+
<div
|
|
147
|
+
*ngFor="let snackbar of getSnackbarsByPosition('bottom-right')"
|
|
148
|
+
class="snackbar"
|
|
149
|
+
[class.snackbar--success]="snackbar.type === 'success'"
|
|
150
|
+
[class.snackbar--error]="snackbar.type === 'error'"
|
|
151
|
+
[class.snackbar--warning]="snackbar.type === 'warning'"
|
|
152
|
+
[class.snackbar--info]="snackbar.type === 'info'"
|
|
153
|
+
>
|
|
154
|
+
<div class="snackbar__icon">
|
|
155
|
+
<svg *ngIf="snackbar.type === 'success'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
156
|
+
<path d="M16.6667 5L7.50004 14.1667L3.33337 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
157
|
+
</svg>
|
|
158
|
+
<svg *ngIf="snackbar.type === 'error'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
159
|
+
<path d="M10 6V10M10 14H10.01M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
160
|
+
</svg>
|
|
161
|
+
<svg *ngIf="snackbar.type === 'warning'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
162
|
+
<path d="M10 7V11M10 15H10.01M8.60001 3.5L1.95001 15C1.69137 15.4584 1.55396 15.9753 1.55189 16.5015C1.54982 17.0277 1.68317 17.5456 1.93827 18.006C2.19337 18.4663 2.56117 18.8535 3.00616 19.1305C3.45115 19.4075 3.95928 19.5648 4.48001 19.5882H17.52C18.0407 19.5648 18.5489 19.4075 18.9939 19.1305C19.4388 18.8535 19.8066 18.4663 20.0617 18.006C20.3168 17.5456 20.4502 17.0277 20.4481 16.5015C20.446 15.9753 20.3086 15.4584 20.05 15L13.4 3.5C13.1332 3.05942 12.7619 2.69355 12.3198 2.43406C11.8777 2.17458 11.3783 2.02954 10.87 2.00967C10.3617 1.98981 9.85362 2.09565 9.39278 2.31848C8.93194 2.5413 8.53223 2.87461 8.23001 3.29L8.60001 3.5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
163
|
+
</svg>
|
|
164
|
+
<svg *ngIf="snackbar.type === 'info'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
165
|
+
<path d="M10 14V10M10 6H10.01M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
166
|
+
</svg>
|
|
167
|
+
</div>
|
|
168
|
+
<div class="snackbar__content">
|
|
169
|
+
<p class="snackbar__message">{{ snackbar.message }}</p>
|
|
170
|
+
</div>
|
|
171
|
+
<button
|
|
172
|
+
*ngIf="snackbar.action"
|
|
173
|
+
class="snackbar__action"
|
|
174
|
+
(click)="handleAction(snackbar)">
|
|
175
|
+
{{ snackbar.action }}
|
|
176
|
+
</button>
|
|
177
|
+
<button
|
|
178
|
+
class="snackbar__close"
|
|
179
|
+
(click)="dismiss(snackbar.id)"
|
|
180
|
+
aria-label="Cerrar">
|
|
181
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
182
|
+
<path d="M13 1L1 13M1 1L13 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
183
|
+
</svg>
|
|
184
|
+
</button>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<!-- Bottom Left -->
|
|
189
|
+
<div class="snackbar-container snackbar-container--bottom-left" *ngIf="getSnackbarsByPosition('bottom-left').length > 0">
|
|
190
|
+
<div
|
|
191
|
+
*ngFor="let snackbar of getSnackbarsByPosition('bottom-left')"
|
|
192
|
+
class="snackbar"
|
|
193
|
+
[class.snackbar--success]="snackbar.type === 'success'"
|
|
194
|
+
[class.snackbar--error]="snackbar.type === 'error'"
|
|
195
|
+
[class.snackbar--warning]="snackbar.type === 'warning'"
|
|
196
|
+
[class.snackbar--info]="snackbar.type === 'info'"
|
|
197
|
+
>
|
|
198
|
+
<div class="snackbar__icon">
|
|
199
|
+
<svg *ngIf="snackbar.type === 'success'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
200
|
+
<path d="M16.6667 5L7.50004 14.1667L3.33337 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
201
|
+
</svg>
|
|
202
|
+
<svg *ngIf="snackbar.type === 'error'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
203
|
+
<path d="M10 6V10M10 14H10.01M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
204
|
+
</svg>
|
|
205
|
+
<svg *ngIf="snackbar.type === 'warning'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
206
|
+
<path d="M10 7V11M10 15H10.01M8.60001 3.5L1.95001 15C1.69137 15.4584 1.55396 15.9753 1.55189 16.5015C1.54982 17.0277 1.68317 17.5456 1.93827 18.006C2.19337 18.4663 2.56117 18.8535 3.00616 19.1305C3.45115 19.4075 3.95928 19.5648 4.48001 19.5882H17.52C18.0407 19.5648 18.5489 19.4075 18.9939 19.1305C19.4388 18.8535 19.8066 18.4663 20.0617 18.006C20.3168 17.5456 20.4502 17.0277 20.4481 16.5015C20.446 15.9753 20.3086 15.4584 20.05 15L13.4 3.5C13.1332 3.05942 12.7619 2.69355 12.3198 2.43406C11.8777 2.17458 11.3783 2.02954 10.87 2.00967C10.3617 1.98981 9.85362 2.09565 9.39278 2.31848C8.93194 2.5413 8.53223 2.87461 8.23001 3.29L8.60001 3.5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
207
|
+
</svg>
|
|
208
|
+
<svg *ngIf="snackbar.type === 'info'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
209
|
+
<path d="M10 14V10M10 6H10.01M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
210
|
+
</svg>
|
|
211
|
+
</div>
|
|
212
|
+
<div class="snackbar__content">
|
|
213
|
+
<p class="snackbar__message">{{ snackbar.message }}</p>
|
|
214
|
+
</div>
|
|
215
|
+
<button
|
|
216
|
+
*ngIf="snackbar.action"
|
|
217
|
+
class="snackbar__action"
|
|
218
|
+
(click)="handleAction(snackbar)">
|
|
219
|
+
{{ snackbar.action }}
|
|
220
|
+
</button>
|
|
221
|
+
<button
|
|
222
|
+
class="snackbar__close"
|
|
223
|
+
(click)="dismiss(snackbar.id)"
|
|
224
|
+
aria-label="Cerrar">
|
|
225
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
226
|
+
<path d="M13 1L1 13M1 1L13 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
227
|
+
</svg>
|
|
228
|
+
</button>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
<!-- Bottom Center -->
|
|
233
|
+
<div class="snackbar-container snackbar-container--bottom-center" *ngIf="getSnackbarsByPosition('bottom-center').length > 0">
|
|
234
|
+
<div
|
|
235
|
+
*ngFor="let snackbar of getSnackbarsByPosition('bottom-center')"
|
|
236
|
+
class="snackbar"
|
|
237
|
+
[class.snackbar--success]="snackbar.type === 'success'"
|
|
238
|
+
[class.snackbar--error]="snackbar.type === 'error'"
|
|
239
|
+
[class.snackbar--warning]="snackbar.type === 'warning'"
|
|
240
|
+
[class.snackbar--info]="snackbar.type === 'info'"
|
|
241
|
+
>
|
|
242
|
+
<div class="snackbar__icon">
|
|
243
|
+
<svg *ngIf="snackbar.type === 'success'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
244
|
+
<path d="M16.6667 5L7.50004 14.1667L3.33337 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
245
|
+
</svg>
|
|
246
|
+
<svg *ngIf="snackbar.type === 'error'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
247
|
+
<path d="M10 6V10M10 14H10.01M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
248
|
+
</svg>
|
|
249
|
+
<svg *ngIf="snackbar.type === 'warning'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
250
|
+
<path d="M10 7V11M10 15H10.01M8.60001 3.5L1.95001 15C1.69137 15.4584 1.55396 15.9753 1.55189 16.5015C1.54982 17.0277 1.68317 17.5456 1.93827 18.006C2.19337 18.4663 2.56117 18.8535 3.00616 19.1305C3.45115 19.4075 3.95928 19.5648 4.48001 19.5882H17.52C18.0407 19.5648 18.5489 19.4075 18.9939 19.1305C19.4388 18.8535 19.8066 18.4663 20.0617 18.006C20.3168 17.5456 20.4502 17.0277 20.4481 16.5015C20.446 15.9753 20.3086 15.4584 20.05 15L13.4 3.5C13.1332 3.05942 12.7619 2.69355 12.3198 2.43406C11.8777 2.17458 11.3783 2.02954 10.87 2.00967C10.3617 1.98981 9.85362 2.09565 9.39278 2.31848C8.93194 2.5413 8.53223 2.87461 8.23001 3.29L8.60001 3.5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
251
|
+
</svg>
|
|
252
|
+
<svg *ngIf="snackbar.type === 'info'" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
253
|
+
<path d="M10 14V10M10 6H10.01M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
254
|
+
</svg>
|
|
255
|
+
</div>
|
|
256
|
+
<div class="snackbar__content">
|
|
257
|
+
<p class="snackbar__message">{{ snackbar.message }}</p>
|
|
258
|
+
</div>
|
|
259
|
+
<button
|
|
260
|
+
*ngIf="snackbar.action"
|
|
261
|
+
class="snackbar__action"
|
|
262
|
+
(click)="handleAction(snackbar)">
|
|
263
|
+
{{ snackbar.action }}
|
|
264
|
+
</button>
|
|
265
|
+
<button
|
|
266
|
+
class="snackbar__close"
|
|
267
|
+
(click)="dismiss(snackbar.id)"
|
|
268
|
+
aria-label="Cerrar">
|
|
269
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
270
|
+
<path d="M13 1L1 13M1 1L13 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
271
|
+
</svg>
|
|
272
|
+
</button>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
`,
|
|
276
|
+
styleUrls: ['./snackbar.component.scss']
|
|
277
|
+
})
|
|
278
|
+
export class SnackbarComponent implements OnInit, OnDestroy {
|
|
279
|
+
snackbars: SnackbarData[] = [];
|
|
280
|
+
private subscriptions: Subscription[] = [];
|
|
281
|
+
|
|
282
|
+
constructor(private snackbarService: SnackbarService) {}
|
|
283
|
+
|
|
284
|
+
ngOnInit(): void {
|
|
285
|
+
// Subscribe to new snackbars
|
|
286
|
+
const snackbarSub = this.snackbarService.snackbar$.subscribe((snackbar) => {
|
|
287
|
+
this.snackbars.push(snackbar);
|
|
288
|
+
});
|
|
289
|
+
this.subscriptions.push(snackbarSub);
|
|
290
|
+
|
|
291
|
+
// Subscribe to dismiss events
|
|
292
|
+
const dismissSub = this.snackbarService.dismiss$.subscribe((id) => {
|
|
293
|
+
if (id === 'all') {
|
|
294
|
+
this.snackbars = [];
|
|
295
|
+
} else {
|
|
296
|
+
this.snackbars = this.snackbars.filter(s => s.id !== id);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
this.subscriptions.push(dismissSub);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
ngOnDestroy(): void {
|
|
303
|
+
this.subscriptions.forEach(sub => sub.unsubscribe());
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
getSnackbarsByPosition(position: string): SnackbarData[] {
|
|
307
|
+
return this.snackbars.filter(s => s.position === position);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
dismiss(id: string): void {
|
|
311
|
+
this.snackbars = this.snackbars.filter(s => s.id !== id);
|
|
312
|
+
this.snackbarService.dismiss(id);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
handleAction(snackbar: SnackbarData): void {
|
|
316
|
+
if (snackbar.actionCallback) {
|
|
317
|
+
snackbar.actionCallback();
|
|
318
|
+
}
|
|
319
|
+
this.dismiss(snackbar.id);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
import { SnackbarConfig, SnackbarData, SnackbarPosition } from '../models/snackbar.models';
|
|
4
|
+
|
|
5
|
+
@Injectable({
|
|
6
|
+
providedIn: 'root'
|
|
7
|
+
})
|
|
8
|
+
export class SnackbarService {
|
|
9
|
+
private snackbarSubject = new Subject<SnackbarData>();
|
|
10
|
+
public snackbar$ = this.snackbarSubject.asObservable();
|
|
11
|
+
|
|
12
|
+
private dismissSubject = new Subject<string>();
|
|
13
|
+
public dismiss$ = this.dismissSubject.asObservable();
|
|
14
|
+
|
|
15
|
+
private snackbarIdCounter = 0;
|
|
16
|
+
|
|
17
|
+
constructor() {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Show success snackbar
|
|
22
|
+
*/
|
|
23
|
+
success(message: string, duration: number = 5000, position?: SnackbarPosition): void {
|
|
24
|
+
this.show({
|
|
25
|
+
message,
|
|
26
|
+
type: 'success',
|
|
27
|
+
duration,
|
|
28
|
+
position
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Show error snackbar
|
|
34
|
+
*/
|
|
35
|
+
error(message: string, duration: number = 5000, position?: SnackbarPosition): void {
|
|
36
|
+
this.show({
|
|
37
|
+
message,
|
|
38
|
+
type: 'error',
|
|
39
|
+
duration,
|
|
40
|
+
position
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Show warning snackbar
|
|
46
|
+
*/
|
|
47
|
+
warning(message: string, duration: number = 5000, position?: SnackbarPosition): void {
|
|
48
|
+
this.show({
|
|
49
|
+
message,
|
|
50
|
+
type: 'warning',
|
|
51
|
+
duration,
|
|
52
|
+
position
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Show info snackbar
|
|
58
|
+
*/
|
|
59
|
+
info(message: string, duration: number = 5000, position?: SnackbarPosition): void {
|
|
60
|
+
this.show({
|
|
61
|
+
message,
|
|
62
|
+
type: 'info',
|
|
63
|
+
duration,
|
|
64
|
+
position
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Show snackbar with custom configuration
|
|
70
|
+
*/
|
|
71
|
+
show(config: SnackbarConfig): void {
|
|
72
|
+
const id = `snackbar-${++this.snackbarIdCounter}`;
|
|
73
|
+
const snackbarData: SnackbarData = {
|
|
74
|
+
...config,
|
|
75
|
+
id,
|
|
76
|
+
duration: config.duration ?? 5000,
|
|
77
|
+
position: config.position ?? 'top-right'
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
this.snackbarSubject.next(snackbarData);
|
|
81
|
+
|
|
82
|
+
// Auto dismiss after duration
|
|
83
|
+
if (snackbarData.duration && snackbarData.duration > 0) {
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
this.dismiss(id);
|
|
86
|
+
}, snackbarData.duration);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Dismiss specific snackbar by id
|
|
92
|
+
*/
|
|
93
|
+
dismiss(id: string): void {
|
|
94
|
+
this.dismissSubject.next(id);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Dismiss all snackbars
|
|
99
|
+
*/
|
|
100
|
+
dismissAll(): void {
|
|
101
|
+
this.dismissSubject.next('all');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base URL para los assets remotos del microfrontend (íconos, imágenes).
|
|
5
|
+
* El consumidor debe proveerlo, normalmente con el valor de `environment.mfAssetsUrl`.
|
|
6
|
+
*/
|
|
7
|
+
export const ASSET_BASE_URL = new InjectionToken<string>('ASSET_BASE_URL', {
|
|
8
|
+
providedIn: 'root',
|
|
9
|
+
factory: () => ''
|
|
10
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of @up_si_vale/sivale-componentes-angular
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Tokens
|
|
6
|
+
export * from './lib/tokens/asset-base-url.token';
|
|
7
|
+
|
|
8
|
+
// Models
|
|
9
|
+
export * from './lib/models/snackbar.models';
|
|
10
|
+
|
|
11
|
+
// Services
|
|
12
|
+
export * from './lib/services/snackbar.service';
|
|
13
|
+
|
|
14
|
+
// Directives
|
|
15
|
+
export * from './lib/directives/asset-source.directive';
|
|
16
|
+
export * from './lib/directives/icon-source.directive';
|
|
17
|
+
export * from './lib/directives/only-number.directive';
|
|
18
|
+
export * from './lib/directives/only-letters.directive';
|
|
19
|
+
export * from './lib/directives/rfc.directive';
|
|
20
|
+
export * from './lib/directives/no-leading-space.directive';
|
|
21
|
+
export * from './lib/directives/tooltip.directive';
|
|
22
|
+
|
|
23
|
+
// Atoms
|
|
24
|
+
export * from './lib/atoms/button/button.component';
|
|
25
|
+
export * from './lib/atoms/input/input.component';
|
|
26
|
+
export * from './lib/atoms/textarea/textarea.component';
|
|
27
|
+
export * from './lib/atoms/checkbox/checkbox.component';
|
|
28
|
+
export * from './lib/atoms/radio/radio.component';
|
|
29
|
+
export * from './lib/atoms/date-picker/date-picker.component';
|
|
30
|
+
export * from './lib/atoms/loader/loader.component';
|
|
31
|
+
|
|
32
|
+
// Molecules
|
|
33
|
+
export * from './lib/molecules/option/option.component';
|
|
34
|
+
export * from './lib/molecules/select/select.component';
|
|
35
|
+
export * from './lib/molecules/multiselect/multiselect.component';
|
|
36
|
+
export * from './lib/molecules/phone-input/phone-input.component';
|
|
37
|
+
export * from './lib/molecules/copy-input/copy-input.component';
|
|
38
|
+
export * from './lib/molecules/snackbar/snackbar.component';
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compileOnSave": false,
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": "./",
|
|
5
|
+
"outDir": "./dist/out-tsc",
|
|
6
|
+
"forceConsistentCasingInFileNames": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noImplicitOverride": true,
|
|
9
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
10
|
+
"noImplicitReturns": true,
|
|
11
|
+
"noFallthroughCasesInSwitch": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"declarationMap": true,
|
|
17
|
+
"experimentalDecorators": true,
|
|
18
|
+
"moduleResolution": "node",
|
|
19
|
+
"importHelpers": true,
|
|
20
|
+
"target": "ES2022",
|
|
21
|
+
"module": "ES2022",
|
|
22
|
+
"useDefineForClassFields": false,
|
|
23
|
+
"lib": ["ES2022", "dom"]
|
|
24
|
+
},
|
|
25
|
+
"angularCompilerOptions": {
|
|
26
|
+
"enableI18nLegacyMessageIdFormat": false,
|
|
27
|
+
"strictInjectionParameters": true,
|
|
28
|
+
"strictInputAccessModifiers": true,
|
|
29
|
+
"strictTemplates": true
|
|
30
|
+
}
|
|
31
|
+
}
|