@block-auth.io/angular 0.4.0 → 0.4.1

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 (153) hide show
  1. package/fesm2022/block-auth.io-angular.mjs +9828 -0
  2. package/fesm2022/block-auth.io-angular.mjs.map +1 -0
  3. package/index.d.ts +1144 -0
  4. package/package.json +16 -37
  5. package/.turbo/turbo-build.log +0 -37
  6. package/.turbo/turbo-lint.log +0 -4
  7. package/.turbo/turbo-test.log +0 -1400
  8. package/.turbo/turbo-typecheck.log +0 -19
  9. package/CHANGELOG.md +0 -273
  10. package/ng-package.json +0 -6
  11. package/scripts/css-to-ts.mjs +0 -14
  12. package/src/lib/__tests__/integration.test.ts +0 -45
  13. package/src/lib/block-auth.service.test.ts +0 -69
  14. package/src/lib/block-auth.service.ts +0 -81
  15. package/src/lib/components/btns/btn-base-provider.component.test.ts +0 -36
  16. package/src/lib/components/btns/btn-base-provider.component.ts +0 -61
  17. package/src/lib/components/btns/btn-block-auth.component.test.ts +0 -105
  18. package/src/lib/components/btns/btn-block-auth.component.ts +0 -117
  19. package/src/lib/components/btns/btn-gmail.component.test.ts +0 -16
  20. package/src/lib/components/btns/btn-gmail.component.ts +0 -41
  21. package/src/lib/components/btns/btn-google-base.component.test.ts +0 -16
  22. package/src/lib/components/btns/btn-google-base.component.ts +0 -73
  23. package/src/lib/components/btns/btn-metamask.component.test.ts +0 -20
  24. package/src/lib/components/btns/btn-metamask.component.ts +0 -98
  25. package/src/lib/components/btns/btn-microsoft.component.test.ts +0 -16
  26. package/src/lib/components/btns/btn-microsoft.component.ts +0 -77
  27. package/src/lib/components/btns/btn-phantom.component.test.ts +0 -20
  28. package/src/lib/components/btns/btn-phantom.component.ts +0 -93
  29. package/src/lib/components/btns/btn-signin.component.test.ts +0 -55
  30. package/src/lib/components/btns/btn-signin.component.ts +0 -108
  31. package/src/lib/components/btns/btn-wallet-connect.component.test.ts +0 -20
  32. package/src/lib/components/btns/btn-wallet-connect.component.ts +0 -109
  33. package/src/lib/components/btns/index.ts +0 -11
  34. package/src/lib/components/contents/content-signin.component.test.ts +0 -33
  35. package/src/lib/components/contents/content-signin.component.ts +0 -68
  36. package/src/lib/components/contents/content-signup.component.test.ts +0 -86
  37. package/src/lib/components/contents/content-signup.component.ts +0 -222
  38. package/src/lib/components/dds/change-account.component.test.ts +0 -66
  39. package/src/lib/components/dds/change-account.component.ts +0 -112
  40. package/src/lib/components/dds/dropdown-profile-btn.component.test.ts +0 -66
  41. package/src/lib/components/dds/dropdown-profile-btn.component.ts +0 -172
  42. package/src/lib/components/dds/dropdown-profile-item.component.test.ts +0 -75
  43. package/src/lib/components/dds/dropdown-profile-item.component.ts +0 -74
  44. package/src/lib/components/dds/dropdown-profile.component.test.ts +0 -110
  45. package/src/lib/components/dds/dropdown-profile.component.ts +0 -264
  46. package/src/lib/components/flow-block-auth.component.test.ts +0 -95
  47. package/src/lib/components/flow-block-auth.component.ts +0 -228
  48. package/src/lib/components/modals/modal-overlay.component.test.ts +0 -81
  49. package/src/lib/components/modals/modal-overlay.component.ts +0 -43
  50. package/src/lib/components/modals/modal-restoration-expired.component.test.ts +0 -71
  51. package/src/lib/components/modals/modal-restoration-expired.component.ts +0 -83
  52. package/src/lib/components/modals/modal-restore.component.test.ts +0 -74
  53. package/src/lib/components/modals/modal-restore.component.ts +0 -104
  54. package/src/lib/components/modals/modal-signin.component.test.ts +0 -66
  55. package/src/lib/components/modals/modal-signin.component.ts +0 -44
  56. package/src/lib/components/modals/modal-signup.component.test.ts +0 -56
  57. package/src/lib/components/modals/modal-signup.component.ts +0 -40
  58. package/src/lib/components/sections/footer-section.component.test.ts +0 -19
  59. package/src/lib/components/sections/footer-section.component.ts +0 -49
  60. package/src/lib/components/sections/internals/providers-buttons.component.test.ts +0 -27
  61. package/src/lib/components/sections/internals/providers-buttons.component.ts +0 -280
  62. package/src/lib/components/sections/internals/providers-filters.component.test.ts +0 -25
  63. package/src/lib/components/sections/internals/providers-filters.component.ts +0 -139
  64. package/src/lib/components/sections/internals/selected-button.component.test.ts +0 -36
  65. package/src/lib/components/sections/internals/selected-button.component.ts +0 -92
  66. package/src/lib/components/sections/login-section.component.test.ts +0 -49
  67. package/src/lib/components/sections/login-section.component.ts +0 -119
  68. package/src/lib/components/sections/providers-section.component.test.ts +0 -22
  69. package/src/lib/components/sections/providers-section.component.ts +0 -187
  70. package/src/lib/components/txns/internals/permissions-required-modal.component.test.ts +0 -36
  71. package/src/lib/components/txns/internals/permissions-required-modal.component.ts +0 -43
  72. package/src/lib/components/txns/internals/phone-input.component.test.ts +0 -119
  73. package/src/lib/components/txns/internals/phone-input.component.ts +0 -301
  74. package/src/lib/components/txns/internals/solicited-data-modal.component.test.ts +0 -700
  75. package/src/lib/components/txns/internals/solicited-data-modal.component.ts +0 -430
  76. package/src/lib/components/txns/internals/txn-error.component.test.ts +0 -127
  77. package/src/lib/components/txns/internals/txn-error.component.ts +0 -144
  78. package/src/lib/components/txns/internals/txn-type.component.test.ts +0 -52
  79. package/src/lib/components/txns/internals/txn-type.component.ts +0 -51
  80. package/src/lib/components/txns/internals/txn.component.test.ts +0 -593
  81. package/src/lib/components/txns/internals/txn.component.ts +0 -453
  82. package/src/lib/components/txns/txns-overview.component.test.ts +0 -421
  83. package/src/lib/components/txns/txns-overview.component.ts +0 -461
  84. package/src/lib/icons/ai-outline-disconnect.component.ts +0 -21
  85. package/src/lib/icons/bi-logo-gmail.component.ts +0 -21
  86. package/src/lib/icons/cg-profile.component.ts +0 -31
  87. package/src/lib/icons/check-icon.component.ts +0 -27
  88. package/src/lib/icons/ci-clock2.component.ts +0 -31
  89. package/src/lib/icons/fa-arrow-right.component.ts +0 -21
  90. package/src/lib/icons/fa-times.component.ts +0 -21
  91. package/src/lib/icons/fa-undo.component.ts +0 -21
  92. package/src/lib/icons/icons.test.ts +0 -25
  93. package/src/lib/icons/index.ts +0 -22
  94. package/src/lib/icons/io-ios-arrow-back.component.ts +0 -21
  95. package/src/lib/icons/io-ios-arrow-forward.component.ts +0 -21
  96. package/src/lib/icons/io-md-arrow-back.component.ts +0 -19
  97. package/src/lib/icons/io-md-arrow-forward.component.ts +0 -19
  98. package/src/lib/icons/pi-warning-fill.component.ts +0 -21
  99. package/src/lib/icons/tb-arrows-exchange2.component.ts +0 -30
  100. package/src/lib/icons/tb-copy-check-filled.component.ts +0 -21
  101. package/src/lib/icons/tb-copy.component.ts +0 -34
  102. package/src/lib/icons/ti-vendor-microsoft.component.ts +0 -21
  103. package/src/lib/inject-store.test.ts +0 -26
  104. package/src/lib/inject-store.ts +0 -16
  105. package/src/lib/primitives/arrow-icon.component.test.ts +0 -25
  106. package/src/lib/primitives/arrow-icon.component.ts +0 -45
  107. package/src/lib/primitives/btn-arrow-dir.component.test.ts +0 -22
  108. package/src/lib/primitives/btn-arrow-dir.component.ts +0 -65
  109. package/src/lib/primitives/btn-base.component.test.ts +0 -38
  110. package/src/lib/primitives/btn-base.component.ts +0 -140
  111. package/src/lib/primitives/divider-base.component.test.ts +0 -12
  112. package/src/lib/primitives/divider-base.component.ts +0 -74
  113. package/src/lib/primitives/dropdown-arrow.component.test.ts +0 -12
  114. package/src/lib/primitives/dropdown-arrow.component.ts +0 -46
  115. package/src/lib/primitives/dropdown-base.component.test.ts +0 -49
  116. package/src/lib/primitives/dropdown-base.component.ts +0 -329
  117. package/src/lib/primitives/helpers.ts +0 -151
  118. package/src/lib/primitives/horizontal-loader.component.test.ts +0 -20
  119. package/src/lib/primitives/horizontal-loader.component.ts +0 -46
  120. package/src/lib/primitives/icon-base.component.test.ts +0 -19
  121. package/src/lib/primitives/icon-base.component.ts +0 -58
  122. package/src/lib/primitives/img-loader.component.test.ts +0 -22
  123. package/src/lib/primitives/img-loader.component.ts +0 -121
  124. package/src/lib/primitives/index.ts +0 -29
  125. package/src/lib/primitives/input-base.component.test.ts +0 -20
  126. package/src/lib/primitives/input-base.component.ts +0 -210
  127. package/src/lib/primitives/lifetime-slider-base.component.test.ts +0 -88
  128. package/src/lib/primitives/lifetime-slider-base.component.ts +0 -75
  129. package/src/lib/primitives/oval-spinner.component.test.ts +0 -17
  130. package/src/lib/primitives/oval-spinner.component.ts +0 -136
  131. package/src/lib/primitives/pickers/dropdown-picker-animated-base.component.ts +0 -220
  132. package/src/lib/primitives/pickers/picker-button.component.ts +0 -74
  133. package/src/lib/primitives/pickers/time-picker-dropdown-selector.component.ts +0 -188
  134. package/src/lib/primitives/pickers/time-picker.component.ts +0 -124
  135. package/src/lib/primitives/pickers/time-unit-selector.component.ts +0 -82
  136. package/src/lib/primitives/progressbar.component.test.ts +0 -34
  137. package/src/lib/primitives/progressbar.component.ts +0 -36
  138. package/src/lib/primitives/providersStyles.ts +0 -218
  139. package/src/lib/primitives/slider-base.component.ts +0 -56
  140. package/src/lib/provide-block-auth.test.ts +0 -43
  141. package/src/lib/provide-block-auth.ts +0 -43
  142. package/src/lib/runtime/block-auth-runtime.directive.test.ts +0 -89
  143. package/src/lib/runtime/block-auth-runtime.directive.ts +0 -68
  144. package/src/lib/teleport-body.directive.test.ts +0 -29
  145. package/src/lib/teleport-body.directive.ts +0 -21
  146. package/src/lib/testing.ts +0 -15
  147. package/src/lib/transitions.css +0 -19
  148. package/src/public-api.ts +0 -86
  149. package/src/vitest.setup.ts +0 -8
  150. package/tailwind.config.cjs +0 -6
  151. package/tsconfig.json +0 -15
  152. package/tsconfig.lib.json +0 -9
  153. package/vite.config.mts +0 -44
@@ -1,75 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';
2
- import { TimePickerComponent } from './pickers/time-picker.component';
3
- import { SliderBaseComponent } from './slider-base.component';
4
-
5
- // Control de lifetime de sesión: un `<ba-time-picker>` `HH:MM:SS` junto a un
6
- // `<ba-slider-base>`, ambos manejando el mismo valor. El padre guarda el valor
7
- // en segundos y lo pasa como `sliderValue` (número) y `timeInputValue` (el mismo
8
- // valor formateado `HH:MM:SS`); tanto `sliderValueChanged` como `timeChanged`
9
- // reportan de vuelta en segundos, así el padre mantiene ambas vistas en sync.
10
- // `:host { display: contents }`: el grid raíz es el hijo real del contenedor.
11
- @Component({
12
- selector: 'ba-lifetime-slider-base',
13
- standalone: true,
14
- changeDetection: ChangeDetectionStrategy.OnPush,
15
- host: { style: 'display: contents' },
16
- imports: [TimePickerComponent, SliderBaseComponent],
17
- template: `
18
- <div [class]="classNames()">
19
- <div [class]="timePickerContainerClassNames()">
20
- <ba-time-picker
21
- [id]="id() + '-time-picker'"
22
- size="small"
23
- [error]="timeInputError()"
24
- [errorMessage]="timeInputErrorMessage()"
25
- [isOpen]="isOpen()"
26
- [min]="min()"
27
- [max]="max()"
28
- [btnSaveText]="btnSaveText()"
29
- [timeInputValue]="timeInputValue()"
30
- [isInsideModal]="isTimePickerInsideModal()"
31
- [modalId]="modalId()"
32
- [dropdownDirection]="timePickerDropdownDirection()"
33
- (isOpenChange)="isOpenChange.emit($event)"
34
- (toggleTimerDropdown)="toggleTimerDropdown.emit()"
35
- (timeChanged)="timeChanged.emit($event)"
36
- />
37
- </div>
38
- <ba-slider-base
39
- [id]="id() + '-slider'"
40
- [sliderValue]="sliderValue()"
41
- [step]="step()"
42
- [min]="min()"
43
- [max]="max()"
44
- [classNames]="sliderContainerClassNames()"
45
- (sliderValueChanged)="sliderValueChanged.emit($event)"
46
- />
47
- </div>
48
- `,
49
- })
50
- export class LifetimeSliderBaseComponent {
51
- id = input('lifetime-slider');
52
- sliderValue = input(150);
53
- step = input(1);
54
- min = input(0);
55
- max = input(100);
56
- btnSaveText = input('Save');
57
- timeInputError = input(false);
58
- timeInputErrorMessage = input('');
59
- timeInputValue = input('08:05:00');
60
- isOpen = input(false);
61
- isTimePickerInsideModal = input(false);
62
- modalId = input('txns-overview');
63
- timePickerDropdownDirection = input<'up' | 'down'>('down');
64
- classNames = input(
65
- 'bas-grid bas-h-auto bas-w-full bas-grid-rows-[auto_auto] bas-items-center bas-gap-2 ' +
66
- '2xsm1:bas-grid-cols-[152px_1fr] 2xsm1:bas-grid-rows-1 1xl:bas-gap-4 2xl:bas-gap-8 bas-mb-6 bas-mt-2',
67
- );
68
- timePickerContainerClassNames = input('bas-flex bas-w-full bas-items-center bas-justify-center');
69
- sliderContainerClassNames = input('');
70
-
71
- sliderValueChanged = output<number>();
72
- timeChanged = output<number>();
73
- isOpenChange = output<boolean>();
74
- toggleTimerDropdown = output<void>();
75
- }
@@ -1,17 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { render } from '@testing-library/angular';
3
- import { OvalSpinnerComponent } from './oval-spinner.component';
4
- describe('OvalSpinnerComponent', () => {
5
- it('renderiza el glass loader', async () => {
6
- const { container } = await render(OvalSpinnerComponent);
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();
16
- });
17
- });
@@ -1,136 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
2
-
3
- const BLOCKAUTH_LOGO = 'https://dashboard.block-auth.io/img/blockauth_logo.png';
4
-
5
- type OvalSize = 'xs' | 'small' | 'medium' | 'large';
6
- type OvalPosition =
7
- | 'center'
8
- | 'top'
9
- | 'bottom'
10
- | 'left'
11
- | 'right'
12
- | 'top-left'
13
- | 'top-right'
14
- | 'bottom-left'
15
- | 'bottom-right';
16
-
17
- @Component({
18
- selector: 'ba-oval-spinner',
19
- standalone: true,
20
- changeDetection: ChangeDetectionStrategy.OnPush,
21
- template: `
22
- <div
23
- [class]="
24
- 'bal-ba-backdrop-blur-base bal-ba-backdrop-blur-xl bas-absolute bas-flex bas-h-full bas-w-full ' +
25
- (animateBg() ? 'bas-oval-fadein' : '') +
26
- ' ' +
27
- positionClasses() +
28
- ' ' +
29
- zIndex() +
30
- ' ' +
31
- classNames()
32
- "
33
- >
34
- <div
35
- [class]="'bas-relative bas-flex bas-items-center bas-justify-center ' + positionClassNames()"
36
- >
37
- <div
38
- class="bal-ba-glass-loader"
39
- role="img"
40
- aria-label="oval-loading"
41
- [style.width.px]="ovalSize()"
42
- [style.height.px]="ovalSize()"
43
- [style.--bal-glass-loader-size]="ovalSize() + 'px'"
44
- >
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>
66
- </div>
67
- </div>
68
- </div>
69
- `,
70
- styles: [
71
- `
72
- @keyframes bas-oval-fadein-kf {
73
- from {
74
- opacity: 0;
75
- }
76
- to {
77
- opacity: 1;
78
- }
79
- }
80
- .bas-oval-fadein {
81
- animation: bas-oval-fadein-kf 0.3s ease-in;
82
- }
83
- `,
84
- ],
85
- })
86
- export class OvalSpinnerComponent {
87
- size = input<OvalSize>('medium');
88
- customSize = input<number | undefined>(undefined);
89
- classNames = input('');
90
- position = input<OvalPosition>('center');
91
- positionClassNames = input('');
92
- animateBg = input(true);
93
- showLogo = input(false);
94
- logoSize = input<OvalSize>('medium');
95
- customLogoSize = input<string | undefined>(undefined);
96
- isIcon = input(false);
97
- imageLogoSrc = input(BLOCKAUTH_LOGO);
98
- zIndex = input('bas-z-50');
99
-
100
- ovalSize = computed(() => {
101
- if (this.customSize()) return this.customSize()!;
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
106
- });
107
-
108
- positionClasses = computed(
109
- () =>
110
- ({
111
- center: 'bas-items-center bas-justify-center',
112
- top: 'bas-items-start bas-justify-center',
113
- bottom: 'bas-items-end bas-justify-center',
114
- left: 'bas-items-center bas-justify-start',
115
- right: 'bas-items-center bas-justify-end',
116
- 'top-left': 'bas-items-start bas-justify-start',
117
- 'top-right': 'bas-items-start bas-justify-end',
118
- 'bottom-left': 'bas-items-end bas-justify-start',
119
- 'bottom-right': 'bas-items-end bas-justify-end',
120
- })[this.position()],
121
- );
122
-
123
- logoScale = computed(
124
- () =>
125
- ({
126
- xs: '57%',
127
- small: '62%',
128
- medium: '67%',
129
- large: '72%',
130
- })[this.logoSize()],
131
- );
132
-
133
- imageAlt = computed(() =>
134
- this.imageLogoSrc() === BLOCKAUTH_LOGO ? 'Block-Auth Logo' : 'Image inside loader',
135
- );
136
- }
@@ -1,220 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- ElementRef,
5
- PLATFORM_ID,
6
- computed,
7
- effect,
8
- inject,
9
- input,
10
- output,
11
- viewChild,
12
- } from '@angular/core';
13
- import { isPlatformBrowser } from '@angular/common';
14
- import { PickerButtonComponent } from './picker-button.component';
15
-
16
- // Shell animado de los pickers: el `<ba-picker-button>` más el revelado del
17
- // cuerpo del dropdown (posicionado en absoluto, por lo que su orden en el DOM
18
- // respecto del botón es irrelevante — se renderiza el botón UNA sola vez y el
19
- // dropdown se coloca arriba/abajo según `dropdownDirection`).
20
- //
21
- // - La animación (framer-motion en react / `<Transition clip-path>` en vue)
22
- // pasa a una animación CSS `.ba-clip-down`/`.ba-clip-up` (revelado circular).
23
- // - `icon` (ReactNode / slot #icon) se reenvía por `[slot=icon]` a
24
- // `<ba-picker-button>` (vía `ngProjectAs`); los hijos van al slot por defecto.
25
- // - `setIsOpen`/`toggleDropdown`/`clickedOutside` -> outputs `isOpenChange`/
26
- // `toggleDropdown`/`clickOutside`.
27
- // - Click-outside anclado a `document` (o al elemento del modal cuando
28
- // `isInsideModal`); NO se retira el listener del modal (al desmontar ya no
29
- // existe — mismo leak deliberado que el original). Se replica con `effect()`
30
- // sobre `isOpen()`, sólo en navegador (SSR-safe).
31
- @Component({
32
- selector: 'ba-dropdown-picker-animated-base',
33
- standalone: true,
34
- changeDetection: ChangeDetectionStrategy.OnPush,
35
- host: { style: 'display: contents' },
36
- imports: [PickerButtonComponent],
37
- template: `
38
- <div
39
- [class]="
40
- displayClassNames() + ' bas-w-full bas-items-center bas-gap-1.5 ' +
41
- getHeightAndGridClassNames(size(), enableError(), enableWhiteSpaces()) + ' ' + classNames()
42
- "
43
- [style.width]="widthStyle()"
44
- >
45
- @if (enableError() && enableWhiteSpaces()) {
46
- <p
47
- [class]="
48
- 'bas-m-0 bas-h-[18px] ' + (error() ? 'bal-ba-error-text' : 'bal-ba-error-text-invisible')
49
- "
50
- >{{ errorMessage() }}</p>
51
- }
52
- <div #internalContainer class="bas-relative bas-h-full bas-w-full">
53
- <section
54
- [class]="
55
- 'bal-ba-transition-2 bas-relative bas-flex bas-w-full bas-flex-col bas-items-center ' +
56
- 'bas-justify-start ' + getHeightAndGridClassNames(size(), false, false)
57
- "
58
- >
59
- <ba-picker-button
60
- [size]="size()"
61
- [isOpen]="isOpen()"
62
- [blueStyles]="blueStyles()"
63
- [btnId]="btnId()"
64
- [inputId]="inputId()"
65
- [inputValue]="inputValue()"
66
- [btnZIndexClassNames]="btnZIndexClassNames()"
67
- (toggleDropdown)="toggleDropdown.emit()"
68
- >
69
- <ng-container ngProjectAs="[slot=icon]"><ng-content select="[slot=icon]" /></ng-container>
70
- </ba-picker-button>
71
-
72
- @if (activeDropdown() && isOpen()) {
73
- <div [class]="dropdownClasses()">
74
- <ng-content />
75
- </div>
76
- }
77
- </section>
78
- </div>
79
- @if (enableError()) {
80
- <p class="bal-ba-error-text-invisible bas-m-0 bas-h-[18px]">white space</p>
81
- }
82
- </div>
83
- `,
84
- styles: [
85
- `
86
- .ba-clip-down {
87
- animation: ba-clip-down-in 0.2s ease;
88
- transform-origin: top center;
89
- }
90
- .ba-clip-up {
91
- animation: ba-clip-up-in 0.2s ease;
92
- transform-origin: bottom center;
93
- }
94
- @keyframes ba-clip-down-in {
95
- from { clip-path: circle(0% at 50% 0%); opacity: 0.4; }
96
- to { clip-path: circle(150% at 50% 0%); opacity: 1; }
97
- }
98
- @keyframes ba-clip-up-in {
99
- from { clip-path: circle(0% at 50% 100%); opacity: 0.4; }
100
- to { clip-path: circle(150% at 50% 100%); opacity: 1; }
101
- }
102
- `,
103
- ],
104
- })
105
- export class DropdownPickerAnimatedBaseComponent {
106
- size = input<'xxs' | 'xs' | 'small' | 'base' | 'large'>('base');
107
- isOpen = input(false);
108
- closeWhenClickedOutside = input(true);
109
- enableError = input(true);
110
- enableWhiteSpaces = input(true);
111
- error = input(false);
112
- errorMessage = input('');
113
- btnId = input('');
114
- inputId = input('');
115
- inputValue = input('');
116
- container = input<HTMLElement | null>(null);
117
- exceptions = input<(HTMLElement | null)[]>([]);
118
- blueStyles = input(true);
119
- activeDropdown = input(true);
120
- width = input<number | string>('100%');
121
- classNames = input('');
122
- displayClassNames = input('bas-grid');
123
- btnZIndexClassNames = input('bas-z-0');
124
- dropdownZIndexClassNames = input('bas-z-50');
125
- isInsideModal = input(false);
126
- modalId = input('txns-overview');
127
- dropdownDirection = input<'up' | 'down'>('down');
128
-
129
- isOpenChange = output<boolean>();
130
- toggleDropdown = output<void>();
131
- clickOutside = output<EventTarget | null>();
132
-
133
- private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
134
- private readonly internalContainer =
135
- viewChild<ElementRef<HTMLDivElement>>('internalContainer');
136
-
137
- protected readonly widthStyle = computed(() => {
138
- const w = this.width();
139
- return typeof w === 'number' ? `${w}px` : w;
140
- });
141
-
142
- protected readonly dropdownClasses = computed(() => {
143
- const down = this.dropdownDirection() === 'down';
144
- return (
145
- 'bal-ba-transition-2 bal-ba-shadow-base bas-w-full bas-min-w-[152px] ' +
146
- 'bas-rounded-md bas-border bas-border-solid bas-border-[#a9d6e5] ' +
147
- 'bas-bg-white hover:bas-border-[#98c0ce] ' +
148
- this.dropdownZIndexClassNames() +
149
- ' ' +
150
- (down
151
- ? 'ba-clip-down bal-ba-hover-shadow-md bas-absolute bas-top-full bas-mt-2'
152
- : 'ba-clip-up bal-ba-hover-shadow-top-md bas-absolute bas-mb-2 bas-bottom-full')
153
- );
154
- });
155
-
156
- private readonly handleClickOutsideTimer = (e: Event): void => {
157
- if (!this.isOpen()) return;
158
- const target = e.target as HTMLElement;
159
- const activeException = this.exceptions().some((el) => el && el.id === target.id);
160
- if (activeException) return;
161
- const el = this.internalContainer()?.nativeElement;
162
- if (el && !el.contains(target)) {
163
- if (this.closeWhenClickedOutside()) this.isOpenChange.emit(false);
164
- else this.clickOutside.emit(target);
165
- }
166
- };
167
-
168
- constructor() {
169
- // Port 1:1 del useEffect([isOpen]) de DropdownPickerAnimatedBase.tsx.
170
- effect((onCleanup) => {
171
- if (!this.isBrowser || !this.activeDropdown()) return;
172
- const open = this.isOpen();
173
- const insideModal = this.isInsideModal();
174
- const removeListener = (): void => {
175
- if (!insideModal) document.removeEventListener('click', this.handleClickOutsideTimer);
176
- };
177
- if (open) {
178
- if (!insideModal) {
179
- document.addEventListener('click', this.handleClickOutsideTimer);
180
- } else {
181
- const modal = document.getElementById(this.modalId());
182
- if (modal) modal.addEventListener('click', this.handleClickOutsideTimer);
183
- }
184
- } else {
185
- removeListener();
186
- }
187
- onCleanup(removeListener);
188
- });
189
- }
190
-
191
- getHeightAndGridClassNames(size: string, enableError: boolean, enableWhiteSpaces: boolean): string {
192
- return {
193
- xxs: enableError
194
- ? enableWhiteSpaces
195
- ? 'bas-h-[82px] bas-grid-rows-[18px_34px_18px]'
196
- : 'bas-h-[58px] bas-grid-rows-[34px_18px]'
197
- : 'bas-h-[34px]',
198
- xs: enableError
199
- ? enableWhiteSpaces
200
- ? 'bas-h-[86px] bas-grid-rows-[18px_38px_18px]'
201
- : 'bas-h-[62px] bas-grid-rows-[38px_18px]'
202
- : 'bas-h-[38px]',
203
- small: enableError
204
- ? enableWhiteSpaces
205
- ? 'bas-h-[90px] bas-grid-rows-[18px_42px_18px]'
206
- : 'bas-h-[66px] bas-grid-rows-[42px_18px]'
207
- : 'bas-h-[42px]',
208
- base: enableError
209
- ? enableWhiteSpaces
210
- ? 'bas-h-[94px] bas-grid-rows-[18px_46px_18px]'
211
- : 'bas-h-[70px] bas-grid-rows-[46px_18px]'
212
- : 'bas-h-[46px]',
213
- large: enableError
214
- ? enableWhiteSpaces
215
- ? 'bas-h-[102px] bas-grid-rows-[18px_54px_18px]'
216
- : 'bas-h-[78px] bas-grid-rows-[54px_18px]'
217
- : 'bas-h-[54px]',
218
- }[size]!;
219
- }
220
- }
@@ -1,74 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';
2
-
3
- // Input de solo-lectura + icono al final que alterna la apertura del dropdown
4
- // del picker. El icono llega por el slot `[slot=icon]` (en react era la prop
5
- // `icon?: ReactNode`). `toggleDropdown` (callback prop) -> output `toggleDropdown`.
6
- // `:host { display: contents }`: el `<button>` es el hijo real del flex/grid del
7
- // contenedor del picker (como en react/vue).
8
- @Component({
9
- selector: 'ba-picker-button',
10
- standalone: true,
11
- changeDetection: ChangeDetectionStrategy.OnPush,
12
- host: { style: 'display: contents' },
13
- template: `
14
- <button
15
- type="button"
16
- [id]="btnId()"
17
- [class]="
18
- 'bal-ba-outline-none bal-ba-transition-150 bas-grid bas-h-full ' +
19
- 'bas-w-full bas-cursor-pointer bas-grid-cols-[1fr_28px] bas-items-center ' +
20
- 'bas-rounded-lg bas-border-2 bas-border-solid ' + bgColor() + ' ' +
21
- getHeightClassNames(size()) + ' ' + btnZIndexClassNames() + ' ' +
22
- (blueStyles() || isOpen()
23
- ? 'bas-border-[var(--bal-primary-100)] hover:bas-border-[var(--bal-primary-300)]'
24
- : 'bas-border-gray-300 hover:bas-border-slate-400')
25
- "
26
- (click)="onBtnClicked($event)"
27
- >
28
- <input
29
- [id]="inputId()"
30
- [class]="
31
- 'bal-ba-outline-none bal-ba-transition-150 bal-ba-shadow-base bal-ba-focus-shadow-none ' +
32
- 'bas-box-border bas-h-full bas-w-full bas-cursor-pointer bas-border-none bas-px-0 ' +
33
- 'bas-py-1 bas-text-start bas-font-normal xsm1:bas-pl-2 ' +
34
- (size() !== 'xxs' ? 'bas-text-lg' : 'bas-text-sm') + ' ' +
35
- (blueStyles() || isOpen()
36
- ? 'bas-text-[#004e98] hover:bas-text-[#00296b]'
37
- : 'bas-text-gray-500 hover:bas-text-slate-600') + ' ' + bgColor()
38
- "
39
- [value]="inputValue()"
40
- readonly
41
- />
42
- <span class="bas-flex bas-h-full bas-w-full bas-items-center bas-justify-center bas-rounded-full">
43
- <ng-content select="[slot=icon]" />
44
- </span>
45
- </button>
46
- `,
47
- })
48
- export class PickerButtonComponent {
49
- size = input<'xxs' | 'xs' | 'small' | 'base' | 'large'>('base');
50
- isOpen = input(false);
51
- blueStyles = input(false);
52
- btnId = input('picker-btn-id');
53
- inputId = input('picker-btn-id');
54
- inputValue = input('Picker Value');
55
- bgColor = input('bas-bg-transparent');
56
- btnZIndexClassNames = input('bas-z-0');
57
-
58
- toggleDropdown = output<void>();
59
-
60
- onBtnClicked(e: MouseEvent): void {
61
- e.preventDefault();
62
- this.toggleDropdown.emit();
63
- }
64
-
65
- getHeightClassNames(size: string): string {
66
- return {
67
- xxs: 'bas-h-[34px] bas-px-1.5 bas-pb-0.5 bas-pt-0.5',
68
- xs: 'bas-h-[38px] bas-px-1.5 bas-pb-0.5 bas-pt-1',
69
- small: 'bas-h-[42px] bas-px-1.5 bas-pb-1 bas-pt-1.5',
70
- base: 'bas-h-[46px] bas-px-1.5 bas-pb-1.5 bas-pt-2',
71
- large: 'bas-h-[54px] bas-px-1.5 bas-pb-2.5 bas-pt-3',
72
- }[size]!;
73
- }
74
- }