crdx-components 1.0.0 → 2.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.
Files changed (105) hide show
  1. package/fesm2022/crdx-components.mjs +1960 -0
  2. package/fesm2022/crdx-components.mjs.map +1 -0
  3. package/package.json +28 -23
  4. package/src/lib/styles/index.scss +1 -0
  5. package/src/lib/styles/overrides/_index.scss +2 -4
  6. package/src/lib/styles/overrides/_mat-button-overrides.scss +0 -11
  7. package/src/lib/styles/overrides/_mat-checkbox-overrides.scss +2 -2
  8. package/src/lib/styles/overrides/_mat-radio-overrides.scss +40 -0
  9. package/types/crdx-components.d.ts +811 -0
  10. package/types/crdx-components.d.ts.map +1 -0
  11. package/.github/workflows/publish.yml +0 -38
  12. package/bun.lock +0 -491
  13. package/crdx-components-1.0.0.tgz +0 -0
  14. package/crdx-components-tokenized-components-1.0.1.tgz +0 -0
  15. package/ng-package.json +0 -12
  16. package/npm +0 -0
  17. package/src/index.ts +0 -45
  18. package/src/lib/components/breadcrumb/breadcrumb.component.css +0 -206
  19. package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -15
  20. package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -47
  21. package/src/lib/components/button/button.css +0 -371
  22. package/src/lib/components/button/button.html +0 -187
  23. package/src/lib/components/button/button.ts +0 -103
  24. package/src/lib/components/card/card.css +0 -285
  25. package/src/lib/components/card/card.html +0 -69
  26. package/src/lib/components/card/card.ts +0 -93
  27. package/src/lib/components/checkbox/checkbox-showcase.component.css +0 -42
  28. package/src/lib/components/checkbox/checkbox-showcase.component.html +0 -36
  29. package/src/lib/components/checkbox/checkbox-showcase.component.ts +0 -13
  30. package/src/lib/components/checkbox/checkbox.css +0 -10
  31. package/src/lib/components/checkbox/checkbox.html +0 -13
  32. package/src/lib/components/checkbox/checkbox.ts +0 -64
  33. package/src/lib/components/circular-progress-stepper/circular-progress-stepper.css +0 -89
  34. package/src/lib/components/circular-progress-stepper/circular-progress-stepper.html +0 -23
  35. package/src/lib/components/circular-progress-stepper/circular-progress-stepper.ts +0 -40
  36. package/src/lib/components/dialogs/alert-modal/alert-modal.css +0 -118
  37. package/src/lib/components/dialogs/alert-modal/alert-modal.html +0 -29
  38. package/src/lib/components/dialogs/alert-modal/alert-modal.ts +0 -28
  39. package/src/lib/components/dialogs/confirm-modal/confirm-modal.css +0 -219
  40. package/src/lib/components/dialogs/confirm-modal/confirm-modal.html +0 -60
  41. package/src/lib/components/dialogs/confirm-modal/confirm-modal.store.ts +0 -139
  42. package/src/lib/components/dialogs/confirm-modal/confirm-modal.ts +0 -63
  43. package/src/lib/components/dialogs/container-custom/container-custom.css +0 -11
  44. package/src/lib/components/dialogs/container-custom/container-custom.html +0 -3
  45. package/src/lib/components/dialogs/container-custom/container-custom.ts +0 -37
  46. package/src/lib/components/dialogs/container-custom/custom-modal.state.ts +0 -57
  47. package/src/lib/components/dialogs/error-modal/error-modal.css +0 -53
  48. package/src/lib/components/dialogs/error-modal/error-modal.html +0 -17
  49. package/src/lib/components/dialogs/error-modal/error-modal.ts +0 -20
  50. package/src/lib/components/dialogs/side-modal/side-modal.css +0 -80
  51. package/src/lib/components/dialogs/side-modal/side-modal.html +0 -30
  52. package/src/lib/components/dialogs/side-modal/side-modal.state.ts +0 -78
  53. package/src/lib/components/dialogs/side-modal/side-modal.ts +0 -50
  54. package/src/lib/components/divider/divider.css +0 -24
  55. package/src/lib/components/divider/divider.html +0 -7
  56. package/src/lib/components/divider/divider.ts +0 -13
  57. package/src/lib/components/footer-actions/footer/footer-flow.store.ts +0 -30
  58. package/src/lib/components/footer-actions/footer/footer.html +0 -14
  59. package/src/lib/components/footer-actions/footer/footer.ts +0 -50
  60. package/src/lib/components/footer-actions/modal-footer-actions/modal-footer-actions.css +0 -44
  61. package/src/lib/components/footer-actions/modal-footer-actions/modal-footer-actions.html +0 -7
  62. package/src/lib/components/footer-actions/modal-footer-actions/modal-footer-actions.ts +0 -12
  63. package/src/lib/components/footer-actions/page-footer-actions/page-footer-actions.css +0 -31
  64. package/src/lib/components/footer-actions/page-footer-actions/page-footer-actions.html +0 -7
  65. package/src/lib/components/footer-actions/page-footer-actions/page-footer-actions.ts +0 -12
  66. package/src/lib/components/form-field/select-field.css +0 -178
  67. package/src/lib/components/form-field/select-field.html +0 -94
  68. package/src/lib/components/form-field/select-field.ts +0 -324
  69. package/src/lib/components/form-field/text-field.css +0 -41
  70. package/src/lib/components/form-field/text-field.html +0 -38
  71. package/src/lib/components/form-field/text-field.ts +0 -102
  72. package/src/lib/components/header/header.css +0 -142
  73. package/src/lib/components/header/header.html +0 -36
  74. package/src/lib/components/header/header.ts +0 -101
  75. package/src/lib/components/icon-button/icon-button.css +0 -445
  76. package/src/lib/components/icon-button/icon-button.html +0 -15
  77. package/src/lib/components/icon-button/icon-button.ts +0 -49
  78. package/src/lib/components/list-item/list-item.css +0 -122
  79. package/src/lib/components/list-item/list-item.html +0 -79
  80. package/src/lib/components/list-item/list-item.ts +0 -104
  81. package/src/lib/components/menu/menu.css +0 -39
  82. package/src/lib/components/menu/menu.html +0 -57
  83. package/src/lib/components/menu/menu.ts +0 -159
  84. package/src/lib/components/shared-table/shared-table-cell-template.directive.ts +0 -25
  85. package/src/lib/components/shared-table/shared-table.component.css +0 -223
  86. package/src/lib/components/shared-table/shared-table.component.html +0 -96
  87. package/src/lib/components/shared-table/shared-table.component.ts +0 -172
  88. package/src/lib/components/sidebar/sidebar.css +0 -234
  89. package/src/lib/components/sidebar/sidebar.html +0 -67
  90. package/src/lib/components/sidebar/sidebar.ts +0 -92
  91. package/src/lib/components/slide-toggle/slide-toggle.css +0 -0
  92. package/src/lib/components/slide-toggle/slide-toggle.html +0 -3
  93. package/src/lib/components/slide-toggle/slide-toggle.ts +0 -18
  94. package/src/lib/components/spinner/spinner.css +0 -9
  95. package/src/lib/components/spinner/spinner.html +0 -9
  96. package/src/lib/components/spinner/spinner.ts +0 -17
  97. package/src/lib/components/tooltip/tooltip.css +0 -32
  98. package/src/lib/components/tooltip/tooltip.html +0 -3
  99. package/src/lib/components/tooltip/tooltip.ts +0 -31
  100. package/src/lib/icons/register-icons.ts +0 -101
  101. package/src/lib/lib-ui/lib-ui.html +0 -1
  102. package/src/lib/lib-ui/lib-ui.scss +0 -0
  103. package/src/lib/lib-ui/lib-ui.ts +0 -9
  104. package/tsconfig.json +0 -30
  105. package/tsconfig.lib.json +0 -20
@@ -1,219 +0,0 @@
1
- /*
2
- * Confirm modal — Diseño desde Figma Tokens (node 323-2101).
3
- * Tokens: --app-dialogs-basic-*, --app-colors-*, --app-font-*, --app-shape-*.
4
- */
5
- .confirm-modal {
6
- --confirm-container-color: var(--app-dialogs-basic-enabled-container-dialog-container-color, #f7fafc);
7
- --confirm-container-elevation: var(--app-dialogs-basic-enabled-container-dialog-container-elevation, 6);
8
- --confirm-container-shape: var(--app-dialogs-basic-enabled-container-dialog-container-shape, 28);
9
- --confirm-headline-color: var(--app-dialogs-basic-enabled-headline-dialog-headline-color, #181c1e);
10
- --confirm-headline-font: var(--app-dialogs-basic-enabled-headline-dialog-headline-font, Heebo);
11
- --confirm-headline-size: var(--app-dialogs-basic-enabled-headline-dialog-headline-size, 24);
12
- --confirm-headline-weight: var(--app-dialogs-basic-enabled-headline-dialog-headline-weight, 400);
13
- --confirm-headline-line-height: var(--app-dialogs-basic-enabled-headline-dialog-headline-line-height, 32);
14
- --confirm-supporting-color: var(--app-dialogs-basic-enabled-supporting-text-dialog-supporting-text-color, #434749);
15
- --confirm-supporting-font: var(--app-dialogs-basic-enabled-supporting-text-dialog-supporting-text-font, Heebo);
16
- --confirm-supporting-size: var(--app-dialogs-basic-enabled-supporting-text-dialog-supporting-text-size, 14);
17
- --confirm-supporting-weight: var(--app-dialogs-basic-enabled-supporting-text-dialog-supporting-text-weight, 400);
18
- --confirm-supporting-line-height: var(--app-dialogs-basic-enabled-supporting-text-dialog-supporting-text-line-height, 20);
19
- --confirm-action-color: var(--app-dialogs-basic-enabled-label-text-dialog-action-label-text-color, #e42313);
20
- --confirm-action-font: var(--app-dialogs-basic-enabled-label-text-dialog-action-label-text-font, Heebo);
21
- --confirm-action-size: var(--app-dialogs-basic-enabled-label-text-dialog-action-label-text-size, 14);
22
- --confirm-action-weight: var(--app-dialogs-basic-enabled-label-text-dialog-action-label-text-weight, 500);
23
- --confirm-primary: var(--app-colors-rojo-primary-rojo-50, #e42313);
24
- --confirm-primary-hover: var(--app-colors-rojo-primary-rojo-40, #bf0600);
25
- --confirm-primary-on: var(--app-colors-rojo-primary-rojo-100, #ffffff);
26
- --confirm-btn-shape: var(--app-shape-large, 16);
27
-
28
- display: flex;
29
- width: 100%;
30
- background: var(--confirm-container-color);
31
- border-radius: calc(var(--confirm-container-shape) * 1px);
32
- box-shadow:
33
- 0 1px 3px 0 rgba(0, 0, 0, 0.3),
34
- 0 4px 8px 3px rgba(0, 0, 0, 0.15);
35
- min-width: 280px;
36
- max-width: 560px;
37
- }
38
-
39
- .confirm-modal__container {
40
- display: flex;
41
- padding: 1.5rem 1.5rem 1.25rem 1.5rem;
42
- flex-direction: column;
43
- align-items: flex-start;
44
- gap: 1.25rem;
45
- align-self: stretch;
46
- width: 100%;
47
- }
48
-
49
- .confirm-modal__top-icon {
50
- width: 100%;
51
- display: flex;
52
- justify-content: center;
53
- color: #5f6368;
54
- }
55
-
56
- .confirm-modal__top-icon .mat-icon {
57
- width: 1.5rem;
58
- height: 1.5rem;
59
- font-size: 1.5rem;
60
- }
61
-
62
- .confirm-modal__header {
63
- display: flex;
64
- flex-direction: column;
65
- gap: 1rem;
66
- align-items: flex-start;
67
- align-self: stretch;
68
- width: 100%;
69
- }
70
-
71
- .confirm-modal__title {
72
- align-self: stretch;
73
- color: var(--confirm-headline-color);
74
- font-family: var(--confirm-headline-font), var(--app-font-type-brand, Heebo), sans-serif;
75
- font-size: calc(var(--confirm-headline-size) * 1px);
76
- font-weight: var(--confirm-headline-weight);
77
- line-height: calc(var(--confirm-headline-line-height) * 1px);
78
- text-align: start;
79
- margin: 0;
80
- }
81
-
82
- .confirm-modal__reference,
83
- .confirm-modal__content {
84
- align-self: stretch;
85
- width: 100%;
86
- color: var(--confirm-supporting-color);
87
- font-family: var(--confirm-supporting-font), var(--app-font-type-plain, Heebo), sans-serif;
88
- font-size: calc(var(--confirm-supporting-size) * 1px);
89
- font-weight: var(--confirm-supporting-weight);
90
- line-height: calc(var(--confirm-supporting-line-height) * 1px);
91
- text-align: start;
92
- margin: 0;
93
- }
94
-
95
- .confirm-modal__list {
96
- width: 100%;
97
- border-top: 1px solid #c4c7c5;
98
- border-bottom: 1px solid #c4c7c5;
99
- }
100
-
101
- .confirm-modal__list--scrollable {
102
- max-height: 14rem;
103
- overflow-y: auto;
104
- }
105
-
106
- .confirm-modal__list-item {
107
- width: 100%;
108
- display: grid;
109
- grid-template-columns: 2.5rem 1fr auto auto;
110
- align-items: center;
111
- gap: 0.75rem;
112
- border: 0;
113
- border-bottom: 1px solid #c4c7c5;
114
- background: transparent;
115
- padding: 0.75rem 0;
116
- text-align: left;
117
- cursor: pointer;
118
- }
119
-
120
- .confirm-modal__list-item:last-child {
121
- border-bottom: 0;
122
- }
123
-
124
- .confirm-modal__list-item-leading-icon {
125
- color: #1f2328;
126
- width: 1.25rem;
127
- height: 1.25rem;
128
- font-size: 1.25rem;
129
- }
130
-
131
- .confirm-modal__list-item-label {
132
- color: #1d1b20;
133
- font-size: 1.125rem;
134
- line-height: 1.5rem;
135
- font-weight: 400;
136
- }
137
-
138
- .confirm-modal__list-item-amount {
139
- color: #5f6368;
140
- font-size: 0.75rem;
141
- line-height: 1rem;
142
- }
143
-
144
- .confirm-modal__list-item-check {
145
- color: #1f2328;
146
- width: 1.25rem;
147
- height: 1.25rem;
148
- font-size: 1.25rem;
149
- }
150
-
151
- .confirm-modal__actions {
152
- display: flex;
153
- flex-direction: row;
154
- align-items: flex-end;
155
- align-self: stretch;
156
- width: 100%;
157
- min-width: 0;
158
- justify-content: flex-end;
159
- gap: 0.5rem;
160
- }
161
-
162
- .confirm-modal__actions > * {
163
- display: flex;
164
- width: auto;
165
- align-self: flex-end;
166
- }
167
-
168
- .confirm-modal__btn {
169
- display: inline-flex;
170
- align-items: center;
171
- justify-content: center;
172
- padding: 1rem 1.5rem;
173
- min-width: 120px;
174
- font-family: var(--confirm-action-font), var(--app-font-type-brand, Heebo), sans-serif;
175
- font-size: calc(var(--confirm-action-size) * 1px);
176
- font-weight: var(--confirm-action-weight);
177
- line-height: 1.25;
178
- border-radius: calc(var(--confirm-btn-shape) * 1px);
179
- border: none;
180
- cursor: pointer;
181
- transition: background-color 0.2s, color 0.2s, border-color 0.2s;
182
- box-shadow: none;
183
- outline: none;
184
- }
185
-
186
- .confirm-modal__btn:focus-visible {
187
- outline: 2px solid var(--confirm-primary);
188
- outline-offset: 2px;
189
- }
190
-
191
- .confirm-modal__btn--cancel {
192
- flex: 1;
193
- max-width: 180px;
194
- background: var(--confirm-container-color);
195
- color: var(--confirm-action-color);
196
- border: 1px solid var(--confirm-action-color);
197
- }
198
-
199
- .confirm-modal__btn--cancel:hover,
200
- .confirm-modal__btn--cancel:focus,
201
- .confirm-modal__btn--cancel:active {
202
- background: var(--confirm-container-color);
203
- color: var(--confirm-primary-hover);
204
- border-color: var(--confirm-primary-hover);
205
- }
206
-
207
- .confirm-modal__btn--confirm {
208
- flex: 1;
209
- max-width: 180px;
210
- background: var(--confirm-primary);
211
- color: var(--confirm-primary-on);
212
- }
213
-
214
- .confirm-modal__btn--confirm:hover,
215
- .confirm-modal__btn--confirm:focus,
216
- .confirm-modal__btn--confirm:active {
217
- background: var(--confirm-primary-hover);
218
- color: var(--confirm-primary-on);
219
- }
@@ -1,60 +0,0 @@
1
- <div
2
- class="confirm-modal"
3
- role="dialog"
4
- aria-modal="true"
5
- aria-labelledby="confirm-modal-title"
6
- [attr.aria-describedby]="supportingText || isListVariant ? 'confirm-modal-desc' : null"
7
- >
8
- <div class="confirm-modal__container">
9
- @if (data.showTopIcon) {
10
- <div class="confirm-modal__top-icon" aria-hidden="true">
11
- <mat-icon>{{ topIconName }}</mat-icon>
12
- </div>
13
- }
14
-
15
- <header class="confirm-modal__header">
16
- <h2 id="confirm-modal-title" class="confirm-modal__title">{{ data.title }}</h2>
17
- @if (supportingText) {
18
- <p id="confirm-modal-desc" class="confirm-modal__reference">{{ supportingText }}</p>
19
- }
20
- </header>
21
-
22
- @if (isListVariant) {
23
- <div
24
- class="confirm-modal__list"
25
- [class.confirm-modal__list--scrollable]="isScrollableList"
26
- [attr.id]="!supportingText ? 'confirm-modal-desc' : null"
27
- >
28
- @for (item of listItems(); track item.id) {
29
- <button type="button" class="confirm-modal__list-item" (click)="toggleListItem(item.id)">
30
- <mat-icon class="confirm-modal__list-item-leading-icon" aria-hidden="true">error_outline</mat-icon>
31
- <span class="confirm-modal__list-item-label">{{ item.label }}</span>
32
- @if (item.amount) {
33
- <span class="confirm-modal__list-item-amount">{{ item.amount }}</span>
34
- }
35
- <mat-icon class="confirm-modal__list-item-check" aria-hidden="true">
36
- {{ item.selected ? 'check_box' : 'check_box_outline_blank' }}
37
- </mat-icon>
38
- </button>
39
- }
40
- </div>
41
- }
42
-
43
- <div class="confirm-modal__actions">
44
- <lib-button
45
- type="button"
46
- variant="text"
47
- (click)="onCancel()"
48
- [label]="labelButtonCancel"
49
- contentAlign="center"
50
- ></lib-button>
51
- <lib-button
52
- type="button"
53
- variant="text"
54
- (click)="onConfirm()"
55
- [label]="data.labelButtonConfirm"
56
- contentAlign="center"
57
- ></lib-button>
58
- </div>
59
- </div>
60
- </div>
@@ -1,139 +0,0 @@
1
- import { inject, Injectable, signal, WritableSignal } from '@angular/core';
2
- import { Dialog, DialogRef } from '@angular/cdk/dialog';
3
- import { Overlay } from '@angular/cdk/overlay';
4
- import { ConfirmModal, ConfirmModalData } from './confirm-modal';
5
- import { NavigationStart, Router } from '@angular/router';
6
-
7
- export interface ConfirmModalOpenOptions {
8
- description?: string;
9
- showTopIcon?: boolean;
10
- topIconName?: string;
11
- variant?: ConfirmModalData['variant'];
12
- listItems?: ConfirmModalData['listItems'];
13
- height?: string;
14
- }
15
-
16
- @Injectable({
17
- providedIn: 'root'
18
- })
19
- export class ConfirmModalStore {
20
- readonly dialog = inject(Dialog);
21
- private readonly overlay = inject(Overlay);
22
- protected dialogState: WritableSignal<'open' | 'closed'> = signal('open');
23
- private readonly router = inject(Router);
24
- private currentDialogRef?: DialogRef<string, unknown>;
25
-
26
- open(
27
- title: string,
28
- labelButtonConfirm: string,
29
- reference = '',
30
- content = '',
31
- width = '19.5rem',
32
- labelButtonCancel = 'Cancelar',
33
- options: ConfirmModalOpenOptions = {}
34
- ): DialogRef<string, unknown> {
35
- this.dialogState.set('open');
36
- const positionBuilder = this.overlay.position();
37
- const strategy = positionBuilder.global().centerHorizontally().centerVertically();
38
-
39
- this.currentDialogRef = this.dialog.open<string>(ConfirmModal, {
40
- width,
41
- height: options.height,
42
- disableClose: true,
43
- autoFocus: false,
44
- positionStrategy: strategy,
45
- panelClass: 'lib-confirm-modal-panel',
46
- backdropClass: 'lib-confirm-modal-backdrop',
47
- data: {
48
- title: title,
49
- reference: reference,
50
- content: content,
51
- description: options.description,
52
- showTopIcon: options.showTopIcon,
53
- topIconName: options.topIconName,
54
- variant: options.variant,
55
- listItems: options.listItems,
56
- labelButtonConfirm: labelButtonConfirm,
57
- labelButtonCancel: labelButtonCancel,
58
- },
59
- closeOnNavigation: true
60
- });
61
- const sub = this.router.events.subscribe(event => {
62
- if (event instanceof NavigationStart) {
63
- this.close();
64
- sub.unsubscribe();
65
- }
66
- });
67
- return this.currentDialogRef
68
- }
69
-
70
- openBasic(title: string, confirmLabel: string, cancelLabel = 'Cancelar'): DialogRef<string, unknown> {
71
- return this.open(title, confirmLabel, '', '', '19.5rem', cancelLabel);
72
- }
73
-
74
- openWithDescription(
75
- title: string,
76
- description: string,
77
- confirmLabel: string,
78
- cancelLabel = 'Cancelar'
79
- ): DialogRef<string, unknown> {
80
- return this.open(title, confirmLabel, '', '', '19.5rem', cancelLabel, {
81
- description,
82
- });
83
- }
84
-
85
- openWithIcon(
86
- title: string,
87
- description: string,
88
- confirmLabel: string,
89
- cancelLabel = 'Cancelar',
90
- topIconName = 'check_box'
91
- ): DialogRef<string, unknown> {
92
- return this.open(title, confirmLabel, '', '', '19.5rem', cancelLabel, {
93
- description,
94
- showTopIcon: true,
95
- topIconName,
96
- });
97
- }
98
-
99
- openWithList(
100
- title: string,
101
- description: string,
102
- listItems: ConfirmModalData['listItems'],
103
- confirmLabel: string,
104
- cancelLabel = 'Cancelar',
105
- showTopIcon = false
106
- ): DialogRef<string, unknown> {
107
- return this.open(title, confirmLabel, '', '', '19.5rem', cancelLabel, {
108
- description,
109
- showTopIcon,
110
- variant: 'list',
111
- listItems,
112
- });
113
- }
114
-
115
- openWithScrollableList(
116
- title: string,
117
- description: string,
118
- listItems: ConfirmModalData['listItems'],
119
- confirmLabel: string,
120
- cancelLabel = 'Cancelar',
121
- showTopIcon = false
122
- ): DialogRef<string, unknown> {
123
- return this.open(title, confirmLabel, '', '', '19.5rem', cancelLabel, {
124
- description,
125
- showTopIcon,
126
- variant: 'scrollable-list',
127
- listItems,
128
- height: 'auto',
129
- });
130
- }
131
-
132
- close(): void {
133
- if (this.currentDialogRef) {
134
- this.currentDialogRef.close();
135
- this.currentDialogRef = undefined;
136
- }
137
- this.dialogState.set('closed');
138
- }
139
- }
@@ -1,63 +0,0 @@
1
- import { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';
2
- import { Component, inject, signal } from '@angular/core';
3
- import { MatIconModule } from '@angular/material/icon';
4
-
5
- import { LibButtonComponent } from '../../button/button';
6
-
7
- export type ConfirmModalVariant = 'basic' | 'list' | 'scrollable-list';
8
-
9
- export interface ConfirmModalListItem {
10
- id: string;
11
- label: string;
12
- supportingText?: string;
13
- amount?: string;
14
- selected?: boolean;
15
- }
16
-
17
- export interface ConfirmModalData {
18
- title: string;
19
- reference?: string;
20
- content?: string;
21
- description?: string;
22
- showTopIcon?: boolean;
23
- topIconName?: string;
24
- variant?: ConfirmModalVariant;
25
- listItems?: ConfirmModalListItem[];
26
- labelButtonCancel?: string;
27
- labelButtonConfirm: string;
28
- }
29
-
30
- @Component({
31
- selector: 'lib-confirm',
32
- templateUrl: './confirm-modal.html',
33
- imports: [LibButtonComponent, MatIconModule],
34
- styleUrl: './confirm-modal.css',
35
- })
36
- export class ConfirmModal {
37
- readonly dialogRef = inject(DialogRef);
38
- readonly data: ConfirmModalData = inject(DIALOG_DATA) as ConfirmModalData;
39
- readonly listItems = signal<ConfirmModalListItem[]>(this.data.listItems ?? []);
40
-
41
- readonly labelButtonCancel = this.data.labelButtonCancel ?? 'Cancelar';
42
-
43
- readonly supportingText = this.data.description ?? this.data.content ?? this.data.reference ?? '';
44
-
45
- readonly isListVariant = this.data.variant === 'list' || this.data.variant === 'scrollable-list';
46
- readonly isScrollableList = this.data.variant === 'scrollable-list';
47
-
48
- readonly topIconName = this.data.topIconName ?? 'check_box';
49
-
50
- toggleListItem(itemId: string): void {
51
- this.listItems.update((items) =>
52
- items.map((item) => (item.id === itemId ? { ...item, selected: !item.selected } : item))
53
- );
54
- }
55
-
56
- onCancel(): void {
57
- this.dialogRef.close(false);
58
- }
59
-
60
- onConfirm(): void {
61
- this.dialogRef.close(true);
62
- }
63
- }
@@ -1,11 +0,0 @@
1
- .container{
2
- width: 100%;
3
- display: flex;
4
- flex-direction: column;
5
- background-color: white;
6
- border-radius: 8px;
7
- }
8
-
9
- .content{
10
- width: 100%;
11
- }
@@ -1,3 +0,0 @@
1
- <div class="container">
2
- <ng-content class="content" *ngComponentOutlet="content; injector: injector" ></ng-content>
3
- </div>
@@ -1,37 +0,0 @@
1
- import { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';
2
- import { NgComponentOutlet } from '@angular/common';
3
- import { Component, effect, inject, Injector, Type, WritableSignal } from '@angular/core';
4
-
5
- @Component({
6
- selector: 'lib-container-custom, app-container-custom',
7
- imports: [NgComponentOutlet],
8
- templateUrl: './container-custom.html',
9
- styleUrl: './container-custom.css'
10
- })
11
- export class ContainerCustom {
12
- private readonly dialogData = inject(DIALOG_DATA);
13
- readonly content: Type<any> = this.dialogData.content;
14
- readonly dialogState: WritableSignal<'open' | 'closed'> = this.dialogData.dialogState;
15
- readonly injector:Injector;
16
- private readonly dialogRef = inject(DialogRef);
17
-
18
- constructor() {
19
- effect(() => {
20
- const state = this.dialogState();
21
- if (state === 'closed') {
22
- this.dialogRef.close();
23
- }
24
- });
25
-
26
- this.injector = Injector.create({
27
- providers: [
28
- { provide: DIALOG_DATA, useValue: this.dialogData.modalData }
29
- ]
30
- });
31
- }
32
-
33
-
34
-
35
-
36
-
37
- }
@@ -1,57 +0,0 @@
1
- import { Dialog, DialogRef } from '@angular/cdk/dialog';
2
- import { Overlay } from '@angular/cdk/overlay';
3
- import { inject, Injectable, signal, Type, WritableSignal } from '@angular/core';
4
- import { NavigationStart, Router } from '@angular/router';
5
- import { ContainerCustom } from './container-custom';
6
-
7
- export interface ModalData {
8
- [key: string]: any;
9
- }
10
-
11
- @Injectable({
12
- providedIn: 'root'
13
- })
14
- export class CustomModalState {
15
- private readonly dialog = inject(Dialog);
16
- private readonly overlay = inject(Overlay);
17
- readonly dialogState: WritableSignal<'open' | 'closed'> = signal('open');
18
- private currentDialogRef?: DialogRef<any>;
19
- private readonly router = inject(Router);
20
-
21
- constructor() { }
22
-
23
- openCustomModal(content: Type<any>, width: string, modalData?: {}): DialogRef<string, any> {
24
- this.dialogState.set('open');
25
- const positionBuilder = this.overlay.position();
26
- const strategy = positionBuilder.global().centerHorizontally().centerVertically();
27
-
28
- this.currentDialogRef = this.dialog.open<string>(ContainerCustom, {
29
- width: width,
30
- height: 'max-content',
31
- disableClose: true,
32
- positionStrategy: strategy,
33
- data: {
34
- content,
35
- modalData,
36
- dialogState: this.dialogState // Pasar el estado como dato en lugar de inyectar el servicio
37
- },
38
- closeOnNavigation: true
39
- });
40
- const sub = this.router.events.subscribe(event => {
41
- if (event instanceof NavigationStart) {
42
- this.closeCustomModal();
43
- sub.unsubscribe();
44
- }
45
- });
46
- return this.currentDialogRef;
47
- }
48
-
49
- closeCustomModal(): void {
50
- if (this.currentDialogRef) {
51
- this.currentDialogRef.close();
52
- this.currentDialogRef = undefined;
53
- }
54
- this.dialogState.set('closed');
55
- }
56
-
57
- }
@@ -1,53 +0,0 @@
1
- .container{
2
- display: flex;
3
- flex-direction: column;
4
- align-items: center;
5
- justify-content: center;
6
- background-color: #ffffff;
7
- width: 100%;
8
- height: 100%;
9
- outline: none;
10
- border: none;
11
- padding: 40px 48px;
12
- border-radius: 8px;
13
- }
14
-
15
- .container > *:not(:last-child):not(:first-child){
16
- margin-top: 24px;
17
- }
18
-
19
- .container > *:last-child{
20
- margin-top: 40px;
21
- }
22
-
23
- .container h5{
24
- font-size: 24px;
25
- font-weight: 700;
26
- color: #3E3E3E;
27
- }
28
-
29
- .container p{
30
- flex: 1;
31
- font-size: 16px;
32
- font-weight: 400;
33
- color: #3E3E3E;
34
- text-align: center;
35
- font-style: normal;
36
- line-height: 24px;
37
- }
38
-
39
- .container .icon{
40
- width: 90px;
41
- height: 90px;
42
- font-size: 90px;
43
- color: #FF4965;
44
- }
45
-
46
- .container button{
47
- height: 56px;
48
- width: 160px;
49
- border-radius: 16px;
50
- font-size: 16px;
51
- font-style: normal;
52
- font-weight: 500;
53
- }
@@ -1,17 +0,0 @@
1
- <div class="container">
2
- <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="90" height="90" viewBox="0 0 90 90" fill="none">
3
- <path d="M49.5 58.5L40.5 58.5L40.5 67.5H49.5L49.5 58.5ZM45 9C52.1201 9 59.0803 11.1114 65.0005 15.0671C70.9207 19.0228 75.5349 24.6453 78.2596 31.2234C80.9844 37.8015 81.6973 45.0399 80.3082 52.0233C78.9192 59.0066 75.4905 65.4212 70.4558 70.4558C65.4211 75.4905 59.0065 78.9192 52.0232 80.3083C45.0399 81.6973 37.8015 80.9844 31.2234 78.2597C24.6452 75.5349 19.0228 70.9207 15.0671 65.0005C11.1113 59.0804 8.99998 52.1201 8.99998 45C9.01093 35.4556 12.8073 26.3052 19.5562 19.5563C26.3052 12.8073 35.4555 9.01096 45 9ZM45 90C53.9001 90 62.6004 87.3608 70.0006 82.4161C77.4009 77.4715 83.1686 70.4434 86.5746 62.2208C89.9805 53.9981 90.8717 44.9501 89.1353 36.2209C87.399 27.4918 83.1131 19.4736 76.8198 13.1802C70.5264 6.88683 62.5082 2.601 53.779 0.864662C45.0499 -0.871674 36.0019 0.0194702 27.7792 3.42542C19.5565 6.83136 12.5285 12.5991 7.58385 19.9993C2.63918 27.3996 -2.28882e-05 36.0998 -2.28882e-05 45C-2.28882e-05 56.9347 4.74104 68.3807 13.1802 76.8198C21.6193 85.2589 33.0652 90 45 90V90ZM49.5 22.5H40.5V49.5H49.5V22.5Z" fill="#FF4965"/>
4
- </svg>
5
- <h5>Ocurrió un error inesperado</h5>
6
- <p style="white-space: pre-wrap;" >
7
- {{data.message}}
8
- </p>
9
- @if(data.detail){
10
- <p>
11
- Detalle: {{data.detail}}
12
- </p>
13
- }
14
- <button matButton="filled" (click)="onConfirm()" >
15
- Entendido
16
- </button>
17
- </div>
@@ -1,20 +0,0 @@
1
- import { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';
2
- import { Component, inject } from '@angular/core';
3
- import { MatButtonModule } from '@angular/material/button';
4
-
5
- @Component({
6
- selector: 'lib-error-modal, app-error-modal',
7
- imports: [MatButtonModule],
8
- templateUrl: './error-modal.html',
9
- styleUrl: './error-modal.css'
10
- })
11
- export class ErrorModal {
12
- private readonly dialogRef = inject(DialogRef);
13
- readonly data = inject(DIALOG_DATA);
14
-
15
- onConfirm(): void {
16
- this.dialogRef.close(true);
17
-
18
- }
19
-
20
- }