@block-auth.io/angular 0.3.1 → 0.4.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/.turbo/turbo-build.log +7 -7
- package/.turbo/turbo-lint.log +4 -4
- package/.turbo/turbo-test.log +1400 -94
- package/.turbo/turbo-typecheck.log +19 -19
- package/CHANGELOG.md +46 -0
- package/package.json +3 -3
- package/src/lib/components/btns/btn-base-provider.component.test.ts +14 -0
- package/src/lib/components/btns/btn-base-provider.component.ts +7 -1
- package/src/lib/components/btns/btn-block-auth.component.test.ts +27 -1
- package/src/lib/components/btns/btn-block-auth.component.ts +6 -2
- package/src/lib/components/contents/content-signup.component.test.ts +8 -0
- package/src/lib/components/contents/content-signup.component.ts +15 -18
- package/src/lib/components/dds/dropdown-profile-btn.component.ts +5 -3
- package/src/lib/components/flow-block-auth.component.test.ts +2 -0
- package/src/lib/components/flow-block-auth.component.ts +10 -8
- package/src/lib/components/modals/modal-signin.component.ts +2 -2
- package/src/lib/components/modals/modal-signup.component.ts +1 -1
- package/src/lib/components/sections/internals/providers-buttons.component.ts +1 -11
- package/src/lib/components/sections/login-section.component.ts +4 -5
- package/src/lib/components/txns/internals/permissions-required-modal.component.ts +1 -1
- package/src/lib/components/txns/internals/solicited-data-modal.component.test.ts +39 -0
- package/src/lib/components/txns/internals/solicited-data-modal.component.ts +25 -10
- package/src/lib/components/txns/internals/txn.component.test.ts +13 -0
- package/src/lib/components/txns/internals/txn.component.ts +15 -23
- package/src/lib/components/txns/txns-overview.component.ts +49 -12
- package/src/lib/primitives/horizontal-loader.component.test.ts +3 -2
- package/src/lib/primitives/horizontal-loader.component.ts +15 -39
- package/src/lib/primitives/img-loader.component.test.ts +10 -0
- package/src/lib/primitives/img-loader.component.ts +5 -2
- package/src/lib/primitives/oval-spinner.component.test.ts +10 -2
- package/src/lib/primitives/oval-spinner.component.ts +35 -57
- package/src/lib/primitives/progressbar.component.test.ts +27 -11
- package/src/lib/primitives/progressbar.component.ts +24 -81
- package/src/lib/primitives/providersStyles.ts +0 -50
- package/src/lib/transitions.css +0 -4
|
@@ -128,13 +128,13 @@ interface TxnPreParams {
|
|
|
128
128
|
(click)="closeLifetime()"
|
|
129
129
|
></div>
|
|
130
130
|
<div
|
|
131
|
-
class="bal-ba-glass-popup-slot bas-absolute bas-inset-x-0 bas-top-44 bas-z-40"
|
|
131
|
+
class="bal-ba-glass-popup-slot bas-absolute bas-inset-x-0 bas-top-44 bas-z-40 bas-box-border bas-px-4"
|
|
132
132
|
>
|
|
133
133
|
<div
|
|
134
134
|
role="dialog"
|
|
135
135
|
id="txn-lifetime-modal"
|
|
136
136
|
[attr.aria-label]="configureSessionTimeTxtResolved()"
|
|
137
|
-
class="bal-ba-glass-panel bal-ba-glass-pop bal-ba-glass-lifetime bas-box-border bas-w-[334px] bas-p-4"
|
|
137
|
+
class="bal-ba-glass-panel bal-ba-glass-pop bal-ba-glass-lifetime bas-box-border bas-w-full bas-max-w-[334px] bas-p-4"
|
|
138
138
|
>
|
|
139
139
|
<div class="bal-ba-glass-modal-head">
|
|
140
140
|
<button
|
|
@@ -217,34 +217,26 @@ interface TxnPreParams {
|
|
|
217
217
|
></span>
|
|
218
218
|
</label>
|
|
219
219
|
</div>
|
|
220
|
-
<
|
|
221
|
-
class="
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
(click)="openPrivacyPolicy()"
|
|
232
|
-
>
|
|
233
|
-
{{ privacyPolicyTxtResolved() }}
|
|
234
|
-
</button>
|
|
235
|
-
<p class="bal-ba-transition-2 bas-m-0 bas-cursor-default">
|
|
236
|
-
{{ andTheTxtResolved() }}
|
|
237
|
-
</p>
|
|
238
|
-
</div>
|
|
220
|
+
<p class="bas-m-0 bas-text-sm bas-text-[var(--bal-primary-500)] group-hover:bas-text-[var(--bal-primary-800)]">
|
|
221
|
+
<span class="bal-ba-transition-2 bas-cursor-default">{{ iAuthorizeTheTxtResolved() }} </span>
|
|
222
|
+
<button
|
|
223
|
+
type="button"
|
|
224
|
+
data-testid="btn-privacy-policy"
|
|
225
|
+
class="bal-ba-transition-2 bas-inline bas-cursor-pointer bas-border-none bas-bg-transparent bas-p-0 bas-text-left bas-text-sm bas-text-[var(--bal-primary-700)] bas-underline group-hover:bas-text-[var(--bal-primary-900)]"
|
|
226
|
+
(click)="openPrivacyPolicy()"
|
|
227
|
+
>
|
|
228
|
+
{{ privacyPolicyTxtResolved() }}
|
|
229
|
+
</button>
|
|
230
|
+
<span class="bal-ba-transition-2 bas-cursor-default"> {{ andTheTxtResolved() }} </span>
|
|
239
231
|
<button
|
|
240
232
|
type="button"
|
|
241
233
|
data-testid="btn-terms-and-conditions"
|
|
242
|
-
class="bal-ba-transition-2 bas-
|
|
234
|
+
class="bal-ba-transition-2 bas-inline bas-cursor-pointer bas-border-none bas-bg-transparent bas-p-0 bas-text-left bas-text-sm bas-text-[var(--bal-primary-700)] bas-underline group-hover:bas-text-[var(--bal-primary-900)]"
|
|
243
235
|
(click)="openTermsAndConditions()"
|
|
244
236
|
>
|
|
245
237
|
{{ termsAndConditionsTxtResolved() }}
|
|
246
238
|
</button>
|
|
247
|
-
</
|
|
239
|
+
</p>
|
|
248
240
|
</div>
|
|
249
241
|
<div
|
|
250
242
|
class="bas-flex bas-w-full bas-flex-row bas-items-center bas-justify-between bas-gap-2"
|
|
@@ -86,7 +86,10 @@ const TXN_ERROR_TEXT_KEYS: Record<string, TextKey> = {
|
|
|
86
86
|
template: `
|
|
87
87
|
<div
|
|
88
88
|
data-testid="txns-overview"
|
|
89
|
-
class="
|
|
89
|
+
[class]="
|
|
90
|
+
'bas-relative bas-box-border bas-flex bas-h-full bas-w-full bas-flex-col bas-font-medium ' +
|
|
91
|
+
(hasHeader() ? '' : 'bas-items-center bas-justify-center bas-gap-6 bas-p-6')
|
|
92
|
+
"
|
|
90
93
|
>
|
|
91
94
|
@if (isEmpty() && isSigning() && !isOtpRequired()) {
|
|
92
95
|
<ba-txn-error
|
|
@@ -104,9 +107,12 @@ const TXN_ERROR_TEXT_KEYS: Record<string, TextKey> = {
|
|
|
104
107
|
/>
|
|
105
108
|
} @else if (!isEmpty() || isOtpRequired()) {
|
|
106
109
|
<!-- No txn yet when the session expired before it was created. -->
|
|
107
|
-
@if (
|
|
110
|
+
@if (hasHeader()) {
|
|
111
|
+
<header
|
|
112
|
+
class="bal-ba-glass-card-header bas-box-border bas-flex bas-w-full bas-shrink-0 bas-justify-center bas-px-6 bas-pb-9 bas-pt-5"
|
|
113
|
+
>
|
|
108
114
|
<div
|
|
109
|
-
class="bal-ba-glass-rise bas-flex bas-flex-col bas-items-center bas-gap-
|
|
115
|
+
class="bal-ba-glass-rise bas-flex bas-flex-col bas-items-center bas-gap-2"
|
|
110
116
|
>
|
|
111
117
|
<img
|
|
112
118
|
[src]="
|
|
@@ -127,6 +133,16 @@ const TXN_ERROR_TEXT_KEYS: Record<string, TextKey> = {
|
|
|
127
133
|
{{ accountShort(did()) }}
|
|
128
134
|
</p>
|
|
129
135
|
</div>
|
|
136
|
+
</header>
|
|
137
|
+
}
|
|
138
|
+
<div
|
|
139
|
+
[class]="
|
|
140
|
+
hasHeader()
|
|
141
|
+
? 'bal-ba-glass-card-body -bas-mt-4 bas-box-border bas-flex bas-min-h-0 bas-w-full bas-flex-1 bas-flex-col bas-items-center bas-gap-5 bas-overflow-y-auto bal-ba-scroll-base bas-px-6 bas-pb-6 bas-pt-5'
|
|
142
|
+
: 'bas-contents'
|
|
143
|
+
"
|
|
144
|
+
>
|
|
145
|
+
@if (hasHeader()) {
|
|
130
146
|
<ba-txn-type
|
|
131
147
|
[txnType]="preParams().txnType || t('login')"
|
|
132
148
|
[txnsLength]="txns().length"
|
|
@@ -166,8 +182,9 @@ const TXN_ERROR_TEXT_KEYS: Record<string, TextKey> = {
|
|
|
166
182
|
}
|
|
167
183
|
</div>
|
|
168
184
|
} @else {
|
|
169
|
-
<div class="bas-
|
|
185
|
+
<div class="bas-flex bas-w-full bas-max-w-[330px] bas-flex-1">
|
|
170
186
|
<ba-txn
|
|
187
|
+
class="bas-w-full"
|
|
171
188
|
[hasSolicitedData]="hasSolicitedData()"
|
|
172
189
|
[allRequiredFilled]="allRequiredFilled()"
|
|
173
190
|
[solicitedDataPending]="solicitedDataPending()"
|
|
@@ -178,24 +195,30 @@ const TXN_ERROR_TEXT_KEYS: Record<string, TextKey> = {
|
|
|
178
195
|
[revokedParams]="acceptParams().revokedParams"
|
|
179
196
|
[addError]="addError"
|
|
180
197
|
(permissionsRequiredClicked)="showPermissions.set(true)"
|
|
181
|
-
(solicitedDataClicked)="
|
|
198
|
+
(solicitedDataClicked)="openSolicitedData()"
|
|
182
199
|
/>
|
|
183
200
|
</div>
|
|
184
|
-
}
|
|
201
|
+
}
|
|
202
|
+
</div>
|
|
203
|
+
} @if (showPermissions()) {
|
|
185
204
|
<div
|
|
186
205
|
class="bal-ba-glass-backdrop bal-ba-backdrop-blur-base bal-ba-backdrop-blur-sm bas-absolute bas-z-30 bas-box-border bas-h-full bas-w-full"
|
|
187
206
|
(click)="showPermissions.set(false)"
|
|
188
207
|
></div>
|
|
189
|
-
<div
|
|
190
|
-
|
|
208
|
+
<div
|
|
209
|
+
class="bas-pointer-events-none bas-absolute bas-inset-x-0 bas-top-44 bas-z-40 bas-box-border bas-flex bas-justify-center bas-px-4"
|
|
210
|
+
>
|
|
211
|
+
<div class="bas-pointer-events-auto bas-w-full bas-max-w-[334px]">
|
|
212
|
+
<ba-permissions-required-modal />
|
|
213
|
+
</div>
|
|
191
214
|
</div>
|
|
192
215
|
} @if (showSolicitedData()) {
|
|
193
216
|
<div
|
|
194
217
|
class="bal-ba-glass-backdrop bal-ba-backdrop-blur-base bal-ba-backdrop-blur-sm bas-absolute bas-z-30 bas-box-border bas-h-full bas-w-full"
|
|
195
|
-
(click)="
|
|
218
|
+
(click)="cancelSolicitedData()"
|
|
196
219
|
></div>
|
|
197
220
|
<ba-solicited-data-modal
|
|
198
|
-
class="bal-ba-glass-modal-slot bas-absolute bas-inset-y-6 bas-z-40"
|
|
221
|
+
class="bal-ba-glass-modal-slot bas-absolute bas-inset-x-0 bas-inset-y-6 bas-z-40 bas-box-border bas-flex bas-justify-center bas-px-4"
|
|
199
222
|
[requiredParams]="requiredParams()"
|
|
200
223
|
[optionalParams]="optionalParams()"
|
|
201
224
|
[params]="txnData()?.params"
|
|
@@ -209,7 +232,7 @@ const TXN_ERROR_TEXT_KEYS: Record<string, TextKey> = {
|
|
|
209
232
|
(shareChange)="handleShareChange($event)"
|
|
210
233
|
(saveParam)="handleSaveParam($event)"
|
|
211
234
|
(undoParam)="handleUndoParam($event)"
|
|
212
|
-
(closed)="
|
|
235
|
+
(closed)="cancelSolicitedData()"
|
|
213
236
|
(accepted)="showSolicitedData.set(false)"
|
|
214
237
|
/>
|
|
215
238
|
}
|
|
@@ -234,6 +257,7 @@ export class TxnsOverviewComponent {
|
|
|
234
257
|
protected readonly solicitedForm = signal<SolicitedDataForm>(
|
|
235
258
|
EMPTY_SOLICITED_DATA_FORM,
|
|
236
259
|
);
|
|
260
|
+
private solicitedSnapshot: SolicitedDataForm = EMPTY_SOLICITED_DATA_FORM;
|
|
237
261
|
protected readonly txnData = signal<TxnDataRequest | null>(null);
|
|
238
262
|
private readonly isLoadingTxnData = signal(false);
|
|
239
263
|
private readonly txnDataReload = signal(0);
|
|
@@ -249,6 +273,9 @@ export class TxnsOverviewComponent {
|
|
|
249
273
|
protected readonly acceptTxnError = computed(() => this.ui().acceptTxnError);
|
|
250
274
|
protected readonly openExtensionOnTxn = openExtensionOnTxn;
|
|
251
275
|
protected readonly isEmpty = computed(() => this.txns().length === 0);
|
|
276
|
+
protected readonly hasHeader = computed(
|
|
277
|
+
() => !this.isEmpty() && !this.error().value,
|
|
278
|
+
);
|
|
252
279
|
protected readonly errorText = computed(() =>
|
|
253
280
|
this.t(
|
|
254
281
|
TXN_ERROR_TEXT_KEYS[this.error().messageSlug] ??
|
|
@@ -362,7 +389,7 @@ export class TxnsOverviewComponent {
|
|
|
362
389
|
effect(() => {
|
|
363
390
|
if (!this.acceptTxnError()) return;
|
|
364
391
|
untracked(() => {
|
|
365
|
-
this.
|
|
392
|
+
this.openSolicitedData();
|
|
366
393
|
this.txnDataReload.update((n) => n + 1);
|
|
367
394
|
});
|
|
368
395
|
});
|
|
@@ -411,6 +438,16 @@ export class TxnsOverviewComponent {
|
|
|
411
438
|
this.updateParam(slug, undoSolicitedValue);
|
|
412
439
|
}
|
|
413
440
|
|
|
441
|
+
openSolicitedData(): void {
|
|
442
|
+
this.solicitedSnapshot = this.solicitedForm();
|
|
443
|
+
this.showSolicitedData.set(true);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
cancelSolicitedData(): void {
|
|
447
|
+
this.solicitedForm.set(this.solicitedSnapshot);
|
|
448
|
+
this.showSolicitedData.set(false);
|
|
449
|
+
}
|
|
450
|
+
|
|
414
451
|
onPrevTxnClicked(): void {
|
|
415
452
|
const len = this.txns().length;
|
|
416
453
|
if (len === 0) return;
|
|
@@ -2,9 +2,10 @@ import { describe, it, expect } from 'vitest';
|
|
|
2
2
|
import { render } from '@testing-library/angular';
|
|
3
3
|
import { HorizontalLoaderComponent } from './horizontal-loader.component';
|
|
4
4
|
describe('HorizontalLoaderComponent', () => {
|
|
5
|
-
it('renderiza
|
|
5
|
+
it('renderiza los 3 puntos glass', async () => {
|
|
6
6
|
const { container } = await render(HorizontalLoaderComponent);
|
|
7
|
-
expect(container.querySelector('
|
|
7
|
+
expect(container.querySelector('.bal-ba-glass-dots')).toBeTruthy();
|
|
8
|
+
expect(container.querySelectorAll('.bal-ba-glass-dot')).toHaveLength(3);
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
// Regresión: el host debe ser `display: contents` para que el <div> absoluto
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
2
2
|
|
|
3
|
-
// Sin react-loader-spinner:
|
|
4
|
-
// se dibujan 3 puntos SVG con una animación de opacidad escalonada
|
|
5
|
-
// (definida en `styles`), reproduciendo el look del `ThreeDots` original.
|
|
6
3
|
@Component({
|
|
7
4
|
selector: 'ba-horizontal-loader',
|
|
8
5
|
standalone: true,
|
|
@@ -21,50 +18,29 @@ import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
|
21
18
|
classNames()
|
|
22
19
|
"
|
|
23
20
|
>
|
|
24
|
-
<
|
|
25
|
-
class="
|
|
26
|
-
[attr.height]="loaderHeight()"
|
|
27
|
-
[attr.width]="loaderWidth()"
|
|
28
|
-
viewBox="0 0 80 40"
|
|
21
|
+
<div
|
|
22
|
+
class="bal-ba-glass-dots"
|
|
29
23
|
role="img"
|
|
30
24
|
aria-label="three-dots-loading"
|
|
25
|
+
[style.width.px]="loaderWidth()"
|
|
26
|
+
[style.height.px]="loaderHeight()"
|
|
27
|
+
[style.--bal-glass-dot-color]="loaderColor()"
|
|
28
|
+
[style.--bal-glass-dot-size]="dotSize() + 'px'"
|
|
31
29
|
>
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
</
|
|
30
|
+
<span class="bal-ba-glass-dot"></span>
|
|
31
|
+
<span class="bal-ba-glass-dot"></span>
|
|
32
|
+
<span class="bal-ba-glass-dot"></span>
|
|
33
|
+
</div>
|
|
36
34
|
</div>
|
|
37
35
|
`,
|
|
38
|
-
styles: [
|
|
39
|
-
`
|
|
40
|
-
@keyframes bas-three-dots-fade {
|
|
41
|
-
0%,
|
|
42
|
-
80%,
|
|
43
|
-
100% {
|
|
44
|
-
opacity: 0.25;
|
|
45
|
-
}
|
|
46
|
-
40% {
|
|
47
|
-
opacity: 1;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
.bas-dot {
|
|
51
|
-
animation: bas-three-dots-fade 1.2s ease-in-out infinite;
|
|
52
|
-
}
|
|
53
|
-
.bas-dot-1 {
|
|
54
|
-
animation-delay: -0.32s;
|
|
55
|
-
}
|
|
56
|
-
.bas-dot-2 {
|
|
57
|
-
animation-delay: -0.16s;
|
|
58
|
-
}
|
|
59
|
-
.bas-dot-3 {
|
|
60
|
-
animation-delay: 0s;
|
|
61
|
-
}
|
|
62
|
-
`,
|
|
63
|
-
],
|
|
64
36
|
})
|
|
65
37
|
export class HorizontalLoaderComponent {
|
|
66
38
|
loaderColor = input('#61a5c2');
|
|
67
39
|
loaderHeight = input(40);
|
|
68
40
|
loaderWidth = input(80);
|
|
69
41
|
classNames = input('bas-rounded-md');
|
|
42
|
+
|
|
43
|
+
dotSize = computed(() =>
|
|
44
|
+
Math.round(Math.min(this.loaderHeight() * 0.4, this.loaderWidth() / 5)),
|
|
45
|
+
);
|
|
70
46
|
}
|
|
@@ -10,3 +10,13 @@ describe('ImgLoaderComponent', () => {
|
|
|
10
10
|
expect(container.querySelector('img')?.getAttribute('src')).toBe('https://x/y.png');
|
|
11
11
|
});
|
|
12
12
|
});
|
|
13
|
+
|
|
14
|
+
describe('ImgLoaderComponent sin anillo', () => {
|
|
15
|
+
it('no monta el anillo giratorio cuando showLoaderRing es false', async () => {
|
|
16
|
+
const { container } = await render(ImgLoaderComponent, {
|
|
17
|
+
componentInputs: { showLoaderRing: false },
|
|
18
|
+
});
|
|
19
|
+
expect(container.querySelector('.bas-img-loader-ring')).toBeNull();
|
|
20
|
+
expect(container.querySelector('.bal-ba-img-loader')).not.toBeNull();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -47,14 +47,14 @@ const MOTION_SPAN_SIZES: Record<ImgLoaderSize, string> = {
|
|
|
47
47
|
template: `
|
|
48
48
|
<div
|
|
49
49
|
[class]="
|
|
50
|
-
'bas-relative bas-flex ' +
|
|
50
|
+
'bal-ba-img-loader bas-relative bas-flex ' +
|
|
51
51
|
SIZES_CONTAINER[size()] +
|
|
52
52
|
' bas-items-center bas-justify-center bas-overflow-hidden bas-rounded-lg'
|
|
53
53
|
"
|
|
54
54
|
>
|
|
55
55
|
<div
|
|
56
56
|
[class]="
|
|
57
|
-
'bas-z-10 bas-flex ' +
|
|
57
|
+
'bal-ba-img-loader-icon bas-z-10 bas-flex ' +
|
|
58
58
|
SIZES_ICON_CONTAINER[size()] +
|
|
59
59
|
' bas-items-center bas-justify-center bas-rounded-md bas-bg-white'
|
|
60
60
|
"
|
|
@@ -74,6 +74,7 @@ const MOTION_SPAN_SIZES: Record<ImgLoaderSize, string> = {
|
|
|
74
74
|
(load)="loaded.set(true)"
|
|
75
75
|
/>
|
|
76
76
|
</div>
|
|
77
|
+
@if (showLoaderRing()) {
|
|
77
78
|
<div [class]="'bas-absolute ' + MOTION_SIZES[size()]">
|
|
78
79
|
<span
|
|
79
80
|
[id]="loaderId()"
|
|
@@ -84,6 +85,7 @@ const MOTION_SPAN_SIZES: Record<ImgLoaderSize, string> = {
|
|
|
84
85
|
[style.border-top-color]="loaderColor()"
|
|
85
86
|
></span>
|
|
86
87
|
</div>
|
|
88
|
+
}
|
|
87
89
|
</div>
|
|
88
90
|
`,
|
|
89
91
|
styles: [
|
|
@@ -113,6 +115,7 @@ export class ImgLoaderComponent {
|
|
|
113
115
|
loaderColor = input('');
|
|
114
116
|
scaleImgWhenHovered = input(false);
|
|
115
117
|
size = input<ImgLoaderSize>('small');
|
|
118
|
+
showLoaderRing = input(true);
|
|
116
119
|
|
|
117
120
|
loaded = signal(false);
|
|
118
121
|
}
|
|
@@ -2,8 +2,16 @@ import { describe, it, expect } from 'vitest';
|
|
|
2
2
|
import { render } from '@testing-library/angular';
|
|
3
3
|
import { OvalSpinnerComponent } from './oval-spinner.component';
|
|
4
4
|
describe('OvalSpinnerComponent', () => {
|
|
5
|
-
it('renderiza
|
|
5
|
+
it('renderiza el glass loader', async () => {
|
|
6
6
|
const { container } = await render(OvalSpinnerComponent);
|
|
7
|
-
expect(container.querySelector('.
|
|
7
|
+
expect(container.querySelector('.bal-ba-glass-loader-panel')).toBeTruthy();
|
|
8
|
+
expect(container.querySelector('#loader-image')).toBeNull();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('muestra el logo dentro del cristal cuando showLogo', async () => {
|
|
12
|
+
const { container } = await render(OvalSpinnerComponent, {
|
|
13
|
+
componentInputs: { showLogo: true },
|
|
14
|
+
});
|
|
15
|
+
expect(container.querySelector('.bal-ba-glass-loader-logo #loader-image')).toBeTruthy();
|
|
8
16
|
});
|
|
9
17
|
});
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
2
2
|
|
|
3
|
-
// Sin react-loader-spinner (`<Oval>`)
|
|
4
|
-
// ni `animate.css`: el anillo animado se dibuja con un <svg> propio (pista +
|
|
5
|
-
// arco giratorio con la clase `bas-oval-spin` de transitions.css) y el
|
|
6
|
-
// fade-in de entrada se resuelve con una animación CSS local equivalente a
|
|
7
|
-
// `animate__fadeIn`. `icon` (ReactNode / slot `icon`) pasa a ser
|
|
8
|
-
// `<ng-content select="[slot=icon]" />`.
|
|
9
3
|
const BLOCKAUTH_LOGO = 'https://dashboard.block-auth.io/img/blockauth_logo.png';
|
|
10
4
|
|
|
11
5
|
type OvalSize = 'xs' | 'small' | 'medium' | 'large';
|
|
@@ -40,46 +34,35 @@ type OvalPosition =
|
|
|
40
34
|
<div
|
|
41
35
|
[class]="'bas-relative bas-flex bas-items-center bas-justify-center ' + positionClassNames()"
|
|
42
36
|
>
|
|
43
|
-
<
|
|
44
|
-
class="
|
|
45
|
-
[attr.width]="ovalSize()"
|
|
46
|
-
[attr.height]="ovalSize()"
|
|
37
|
+
<div
|
|
38
|
+
class="bal-ba-glass-loader"
|
|
47
39
|
role="img"
|
|
48
40
|
aria-label="oval-loading"
|
|
49
|
-
[
|
|
41
|
+
[style.width.px]="ovalSize()"
|
|
42
|
+
[style.height.px]="ovalSize()"
|
|
43
|
+
[style.--bal-glass-loader-size]="ovalSize() + 'px'"
|
|
50
44
|
>
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<div [class]="showLogo() ? 'bas-absolute ' + (customLogoSize() || imageSize()) : 'bas-hidden'">
|
|
73
|
-
@if (!isIcon()) {
|
|
74
|
-
<img
|
|
75
|
-
id="loader-image"
|
|
76
|
-
[src]="imageLogoSrc()"
|
|
77
|
-
class="bas-aspect-square bas-h-full bas-w-full bas-rounded-full"
|
|
78
|
-
[alt]="imageAlt()"
|
|
79
|
-
/>
|
|
80
|
-
} @else {
|
|
81
|
-
<ng-content select="[slot=icon]" />
|
|
82
|
-
}
|
|
45
|
+
<span class="bal-ba-glass-loader-ground" aria-hidden="true"></span>
|
|
46
|
+
<span class="bal-ba-glass-loader-halo" aria-hidden="true"></span>
|
|
47
|
+
<div class="bal-ba-glass-loader-body">
|
|
48
|
+
<span class="bal-ba-glass-loader-panel" aria-hidden="true"></span>
|
|
49
|
+
<span class="bal-ba-glass-loader-arc" aria-hidden="true"></span>
|
|
50
|
+
<span class="bal-ba-glass-loader-spec" aria-hidden="true"></span>
|
|
51
|
+
<span class="bal-ba-glass-loader-sheen" aria-hidden="true"></span>
|
|
52
|
+
@if (showLogo()) {
|
|
53
|
+
<div
|
|
54
|
+
[class]="'bal-ba-glass-loader-logo ' + (customLogoSize() ?? '')"
|
|
55
|
+
[style.width]="customLogoSize() ? null : logoScale()"
|
|
56
|
+
[style.height]="customLogoSize() ? null : logoScale()"
|
|
57
|
+
>
|
|
58
|
+
@if (!isIcon()) {
|
|
59
|
+
<img id="loader-image" [src]="imageLogoSrc()" [alt]="imageAlt()" />
|
|
60
|
+
} @else {
|
|
61
|
+
<ng-content select="[slot=icon]" />
|
|
62
|
+
}
|
|
63
|
+
</div>
|
|
64
|
+
}
|
|
65
|
+
</div>
|
|
83
66
|
</div>
|
|
84
67
|
</div>
|
|
85
68
|
</div>
|
|
@@ -114,14 +97,12 @@ export class OvalSpinnerComponent {
|
|
|
114
97
|
imageLogoSrc = input(BLOCKAUTH_LOGO);
|
|
115
98
|
zIndex = input('bas-z-50');
|
|
116
99
|
|
|
117
|
-
readonly strokeWidth = 2;
|
|
118
|
-
|
|
119
100
|
ovalSize = computed(() => {
|
|
120
101
|
if (this.customSize()) return this.customSize()!;
|
|
121
|
-
if (this.size() === 'xs') return
|
|
122
|
-
if (this.size() === 'small') return
|
|
123
|
-
if (this.size() === 'medium') return
|
|
124
|
-
return
|
|
102
|
+
if (this.size() === 'xs') return 56;
|
|
103
|
+
if (this.size() === 'small') return 76;
|
|
104
|
+
if (this.size() === 'medium') return 104;
|
|
105
|
+
return 132; // large
|
|
125
106
|
});
|
|
126
107
|
|
|
127
108
|
positionClasses = computed(
|
|
@@ -139,20 +120,17 @@ export class OvalSpinnerComponent {
|
|
|
139
120
|
})[this.position()],
|
|
140
121
|
);
|
|
141
122
|
|
|
142
|
-
|
|
123
|
+
logoScale = computed(
|
|
143
124
|
() =>
|
|
144
125
|
({
|
|
145
|
-
xs: '
|
|
146
|
-
small: '
|
|
147
|
-
medium: '
|
|
148
|
-
large: '
|
|
126
|
+
xs: '57%',
|
|
127
|
+
small: '62%',
|
|
128
|
+
medium: '67%',
|
|
129
|
+
large: '72%',
|
|
149
130
|
})[this.logoSize()],
|
|
150
131
|
);
|
|
151
132
|
|
|
152
133
|
imageAlt = computed(() =>
|
|
153
134
|
this.imageLogoSrc() === BLOCKAUTH_LOGO ? 'Block-Auth Logo' : 'Image inside loader',
|
|
154
135
|
);
|
|
155
|
-
|
|
156
|
-
radius = computed(() => this.ovalSize() / 2 - this.strokeWidth);
|
|
157
|
-
circumference = computed(() => 2 * Math.PI * this.radius());
|
|
158
136
|
}
|
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { Component } from '@angular/core';
|
|
3
2
|
import { render, screen } from '@testing-library/angular';
|
|
4
3
|
import { ProgressbarComponent } from './progressbar.component';
|
|
4
|
+
|
|
5
|
+
const nodeStates = () =>
|
|
6
|
+
Array.from(screen.getByTestId('progressbar').querySelectorAll('.bal-ba-stepper-node')).map((node) =>
|
|
7
|
+
node.getAttribute('data-state'),
|
|
8
|
+
);
|
|
9
|
+
|
|
5
10
|
describe('ProgressbarComponent', () => {
|
|
6
|
-
it(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
it.each([
|
|
12
|
+
[1, ['active', 'pending', 'pending']],
|
|
13
|
+
[2, ['done', 'active', 'pending']],
|
|
14
|
+
[3, ['done', 'done', 'active']],
|
|
15
|
+
] as const)('paso %i pinta cada nodo según el paso', async (step, states) => {
|
|
16
|
+
await render(ProgressbarComponent, { inputs: { step } });
|
|
17
|
+
const bar = screen.getByTestId('progressbar');
|
|
18
|
+
expect(bar.getAttribute('data-step')).toBe(String(step));
|
|
19
|
+
expect(bar.getAttribute('aria-valuenow')).toBe(String(step));
|
|
20
|
+
expect(nodeStates()).toEqual(states);
|
|
11
21
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
await
|
|
16
|
-
expect(screen.getByTestId('progressbar
|
|
22
|
+
|
|
23
|
+
it('al volver del paso 3 al 2 no deja restos del paso 3', async () => {
|
|
24
|
+
const { rerender } = await render(ProgressbarComponent, { inputs: { step: 3 } });
|
|
25
|
+
await rerender({ inputs: { step: 2 }, partialUpdate: true });
|
|
26
|
+
expect(screen.getByTestId('progressbar').getAttribute('data-step')).toBe('2');
|
|
27
|
+
expect(nodeStates()).toEqual(['done', 'active', 'pending']);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('un solo indicador de paso activo', async () => {
|
|
31
|
+
await render(ProgressbarComponent, { inputs: { step: 2 } });
|
|
32
|
+
expect(screen.getByTestId('progressbar').querySelectorAll('.bal-ba-stepper-indicator')).toHaveLength(1);
|
|
17
33
|
});
|
|
18
34
|
});
|