@block-auth.io/angular 0.3.2 → 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 -2001
  8. package/.turbo/turbo-typecheck.log +0 -19
  9. package/CHANGELOG.md +0 -245
  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 -22
  16. package/src/lib/components/btns/btn-base-provider.component.ts +0 -55
  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 -234
  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 -170
  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 -93
  47. package/src/lib/components/flow-block-auth.component.ts +0 -226
  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 -290
  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 -120
  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 -661
  75. package/src/lib/components/txns/internals/solicited-data-modal.component.ts +0 -415
  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 -580
  81. package/src/lib/components/txns/internals/txn.component.ts +0 -461
  82. package/src/lib/components/txns/txns-overview.component.test.ts +0 -421
  83. package/src/lib/components/txns/txns-overview.component.ts +0 -424
  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 -19
  119. package/src/lib/primitives/horizontal-loader.component.ts +0 -70
  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 -12
  123. package/src/lib/primitives/img-loader.component.ts +0 -118
  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 -9
  130. package/src/lib/primitives/oval-spinner.component.ts +0 -158
  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 -18
  137. package/src/lib/primitives/progressbar.component.ts +0 -93
  138. package/src/lib/primitives/providersStyles.ts +0 -268
  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 -23
  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,188 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- effect,
5
- input,
6
- output,
7
- signal,
8
- untracked,
9
- } from '@angular/core';
10
- import { getSecFromTimeValue } from '../helpers';
11
- import { TimeUnitSelectorComponent } from './time-unit-selector.component';
12
-
13
- export interface TimeArrays {
14
- minRange: string[];
15
- defaultRange: string[];
16
- maxRange: string[];
17
- }
18
-
19
- // Selector de tiempo de tres columnas (horas/minutos/segundos) dentro del
20
- // dropdown del picker, más el botón Guardar. `onChangeTimeUnit` reconcilia los
21
- // rangos min/max a medida que el usuario cambia cada unidad (máximo total
22
- // 29100s → 08:05:00); Guardar confía el tiempo elegido al padre como segundos
23
- // totales vía el output `timeChanged`. Los `useState` de react -> signals; el
24
- // `useEffect([defaultValues])` (reset) -> effect() que sólo trackea
25
- // `defaultValues`. `:host { display: contents }`: el grid interno es el hijo
26
- // real del contenedor del dropdown.
27
- const range = (length: number, offset = 0): string[] =>
28
- Array.from({ length }, (_, i) => String(i + offset).padStart(2, '0'));
29
-
30
- const initialStates = {
31
- hoursArray: range(8, 1),
32
- minutesArrays: { minRange: range(50, 10), defaultRange: range(60), maxRange: range(41) },
33
- secondsArrays: { minRange: range(50, 10), defaultRange: range(60), maxRange: range(1) },
34
- };
35
-
36
- @Component({
37
- selector: 'ba-time-picker-dropdown-selector',
38
- standalone: true,
39
- changeDetection: ChangeDetectionStrategy.OnPush,
40
- host: { style: 'display: contents' },
41
- imports: [TimeUnitSelectorComponent],
42
- template: `
43
- <div class="bas-grid bas-grid-rows-[232px_32px] bas-justify-center bas-gap-1 bas-py-1.5 bas-pl-2.5 bas-pr-1">
44
- <div class="bas-grid bas-h-full bas-w-[136px] bas-grid-cols-3 bas-gap-0.5">
45
- <ba-time-unit-selector
46
- [id]="id()"
47
- [timeUnitArray]="hoursArray()"
48
- timeUnit="hours"
49
- [selectedValue]="selectedValues()[0]"
50
- [firstValue]="parseIntSafe(hoursArray()[0])"
51
- (changeTimeUnit)="onChangeTimeUnit($event.timeUnit, $event.value)"
52
- />
53
- <ba-time-unit-selector
54
- [id]="id()"
55
- [timeUnitArray]="minutesArray()"
56
- timeUnit="minutes"
57
- [selectedValue]="selectedValues()[1]"
58
- [firstValue]="parseIntSafe(minutesArray()[0])"
59
- (changeTimeUnit)="onChangeTimeUnit($event.timeUnit, $event.value)"
60
- />
61
- <ba-time-unit-selector
62
- [id]="id()"
63
- [timeUnitArray]="secondsArray()"
64
- timeUnit="seconds"
65
- [selectedValue]="selectedValues()[2]"
66
- [firstValue]="parseIntSafe(secondsArray()[0])"
67
- (changeTimeUnit)="onChangeTimeUnit($event.timeUnit, $event.value)"
68
- />
69
- </div>
70
- <div class="bas-flex bas-items-center bas-justify-end bas-px-1.5">
71
- <button
72
- type="button"
73
- [id]="id() + '-btn-save'"
74
- class="bal-ba-transition-2 bas-cursor-pointer bas-rounded-md
75
- bas-border-none bas-bg-[var(--bal-primary-300)] bas-px-1.5 bas-py-1
76
- bas-text-sm bas-text-white hover:bas-bg-[#4d849b]
77
- disabled:bas-cursor-not-allowed disabled:bas-opacity-50"
78
- [disabled]="isBtnSaveDisabled()"
79
- (click)="onSaveTimeBtnClicked()"
80
- >
81
- {{ btnSaveText() }}
82
- </button>
83
- </div>
84
- </div>
85
- `,
86
- })
87
- export class TimePickerDropdownSelectorComponent {
88
- id = input('time-picker');
89
- hoursArray = input<string[]>(initialStates.hoursArray);
90
- minutesArrays = input<TimeArrays>(initialStates.minutesArrays);
91
- secondsArrays = input<TimeArrays>(initialStates.secondsArrays);
92
- defaultValues = input('08:05:00');
93
- btnSaveText = input('Save');
94
-
95
- timeChanged = output<number>();
96
- toggleTimerDropdown = output<void>();
97
-
98
- protected readonly minutesArray = signal<string[]>(initialStates.minutesArrays.defaultRange);
99
- protected readonly secondsArray = signal<string[]>(initialStates.secondsArrays.defaultRange);
100
- protected readonly selectedValues = signal<string[]>('08:05:00'.split(':'));
101
- protected readonly isBtnSaveDisabled = signal(true);
102
- private initialValues: string[] = '08:05:00'.split(':');
103
-
104
- constructor() {
105
- // Reset: sólo trackea defaultValues;
106
- // el resto se lee sin tracking para no re-disparar en cascada.
107
- effect(() => {
108
- const defaultValues = this.defaultValues();
109
- untracked(() => {
110
- const splitted = defaultValues.split(':');
111
- this.initialValues = [...splitted];
112
- this.selectedValues.set([...splitted]);
113
- this.isBtnSaveDisabled.set(true);
114
- this.onChangeTimeUnit('hours', splitted[0], [...splitted], true);
115
- });
116
- });
117
- }
118
-
119
- parseIntSafe(v: string | undefined): number {
120
- return parseInt(v ?? '0', 10) || 0;
121
- }
122
-
123
- onChangeTimeUnit(
124
- timeUnit: string,
125
- newValue: string,
126
- timeArrayValues: string[] = this.selectedValues(),
127
- isDefaultTime = false,
128
- ): void {
129
- const timeArray = [...timeArrayValues];
130
- const hoursArray = this.hoursArray();
131
- if (timeUnit === 'hours' || timeUnit === 'minutes') {
132
- const minMinutesArray = this.minutesArrays().minRange;
133
- const defaultMinutesArray = this.minutesArrays().defaultRange;
134
- const maxMinutesArray = this.minutesArrays().maxRange;
135
- const minSecondsArray = this.secondsArrays().minRange;
136
- const defaultSecondsArray = this.secondsArrays().defaultRange;
137
- const maxSecondsArray = this.secondsArrays().maxRange;
138
- let newMinutesArray = defaultMinutesArray;
139
- let newSecondsArray = defaultSecondsArray;
140
- if (timeUnit === 'hours') timeArray[0] = newValue;
141
- else timeArray[1] = newValue;
142
- if (timeArray[0] === hoursArray[hoursArray.length - 1]) {
143
- newMinutesArray = maxMinutesArray;
144
- if (
145
- !maxMinutesArray.includes(timeArray[1]) ||
146
- timeArray[1] === maxMinutesArray[maxMinutesArray.length - 1]
147
- ) {
148
- if (!maxMinutesArray.includes(timeArray[1])) {
149
- timeArray[1] = maxMinutesArray[maxMinutesArray.length - 1];
150
- }
151
- newSecondsArray = maxSecondsArray;
152
- if (!maxSecondsArray.includes(timeArray[2])) {
153
- timeArray[2] = maxSecondsArray[maxSecondsArray.length - 1];
154
- }
155
- }
156
- } else if (timeArray[0] === hoursArray[0]) {
157
- newMinutesArray = minMinutesArray;
158
- if (!minMinutesArray.includes(timeArray[1]) || timeArray[1] === minMinutesArray[0]) {
159
- if (!minMinutesArray.includes(timeArray[1])) {
160
- timeArray[1] = minMinutesArray[0];
161
- }
162
- newSecondsArray = minSecondsArray;
163
- if (!minSecondsArray.includes(timeArray[2])) {
164
- timeArray[2] = minSecondsArray[0];
165
- }
166
- }
167
- }
168
- this.minutesArray.set([...newMinutesArray]);
169
- this.secondsArray.set([...newSecondsArray]);
170
- } else timeArray[2] = newValue;
171
-
172
- this.selectedValues.set([...timeArray]);
173
-
174
- if (isDefaultTime) this.isBtnSaveDisabled.set(true);
175
- else {
176
- this.isBtnSaveDisabled.set(
177
- timeArray.every((timeValue, index) => timeValue === this.initialValues[index]),
178
- );
179
- }
180
- }
181
-
182
- onSaveTimeBtnClicked(): void {
183
- this.initialValues = this.selectedValues();
184
- const newTimeValue = this.selectedValues().join(':');
185
- this.timeChanged.emit(getSecFromTimeValue(newTimeValue));
186
- this.toggleTimerDropdown.emit();
187
- }
188
- }
@@ -1,124 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';
2
- import { convertSecondsToTime, formatNumberToString } from '../helpers';
3
- import { CiClock2Component } from '../../icons';
4
- import { DropdownPickerAnimatedBaseComponent } from './dropdown-picker-animated-base.component';
5
- import {
6
- TimePickerDropdownSelectorComponent,
7
- type TimeArrays,
8
- } from './time-picker-dropdown-selector.component';
9
-
10
- // Picker de tiempo `HH:MM:SS`. Construye los rangos de horas/minutos/segundos a
11
- // partir de los límites `min`/`max` en segundos y los renderiza dentro del
12
- // `<ba-dropdown-picker-animated-base>`. El label de Guardar llega por
13
- // `btnSaveText`. El icono del reloj usa `<ba-ci-clock2>`.
14
- // `:host { display: contents }`: el shell del picker es el hijo real del
15
- // contenedor.
16
- @Component({
17
- selector: 'ba-time-picker',
18
- standalone: true,
19
- changeDetection: ChangeDetectionStrategy.OnPush,
20
- host: { style: 'display: contents' },
21
- imports: [
22
- DropdownPickerAnimatedBaseComponent,
23
- TimePickerDropdownSelectorComponent,
24
- CiClock2Component,
25
- ],
26
- template: `
27
- <ba-dropdown-picker-animated-base
28
- [isOpen]="isOpen()"
29
- [size]="size()"
30
- [enableError]="enableError()"
31
- [enableWhiteSpaces]="enableWhiteSpaces()"
32
- [error]="error()"
33
- [errorMessage]="errorMessage()"
34
- [btnId]="id() + '-btn'"
35
- [inputId]="id() + '-time-input'"
36
- [inputValue]="timeInputValue()"
37
- [container]="container()"
38
- [exceptions]="exceptions()"
39
- [width]="width()"
40
- [isInsideModal]="isInsideModal()"
41
- [modalId]="modalId()"
42
- [dropdownDirection]="dropdownDirection()"
43
- [classNames]="classNames()"
44
- [btnZIndexClassNames]="btnZIndexClassNames()"
45
- [dropdownZIndexClassNames]="dropdownZIndexClassNames()"
46
- (isOpenChange)="isOpenChange.emit($event)"
47
- (toggleDropdown)="toggleTimerDropdown.emit()"
48
- >
49
- <ba-ci-clock2
50
- slot="icon"
51
- class="bal-ba-transition-150 bas-h-6 bas-w-6 bas-cursor-pointer bas-text-[#468faf] hover:bas-text-[#014f86]"
52
- />
53
-
54
- <ba-time-picker-dropdown-selector
55
- [id]="id()"
56
- [hoursArray]="hoursArray()"
57
- [minutesArrays]="minutesArrays()"
58
- [secondsArrays]="secondsArrays()"
59
- [defaultValues]="timeInputValue()"
60
- [btnSaveText]="btnSaveText()"
61
- (timeChanged)="timeChanged.emit($event)"
62
- (toggleTimerDropdown)="toggleTimerDropdown.emit()"
63
- />
64
- </ba-dropdown-picker-animated-base>
65
- `,
66
- })
67
- export class TimePickerComponent {
68
- id = input('time-picker');
69
- size = input<'xxs' | 'xs' | 'small' | 'base' | 'large'>('base');
70
- isOpen = input(false);
71
- min = input(10);
72
- max = input(29100);
73
- enableError = input(false);
74
- enableWhiteSpaces = input(true);
75
- error = input(false);
76
- errorMessage = input('');
77
- timeInputValue = input('01:00:00');
78
- container = input<HTMLElement | null>(null);
79
- exceptions = input<(HTMLElement | null)[]>([]);
80
- btnSaveText = input('Save');
81
- width = input<number | string>(152);
82
- isInsideModal = input(false);
83
- modalId = input('txns-overview');
84
- dropdownDirection = input<'up' | 'down'>('down');
85
- classNames = input('');
86
- btnZIndexClassNames = input('bas-z-0');
87
- dropdownZIndexClassNames = input('bas-z-50');
88
-
89
- isOpenChange = output<boolean>();
90
- toggleTimerDropdown = output<void>();
91
- timeChanged = output<number>();
92
-
93
- protected readonly hoursArray = computed(() =>
94
- this.getHoursArray(this.min(), this.max()),
95
- );
96
- protected readonly minutesArrays = computed(() =>
97
- this.getTimeArrays(this.min(), this.max(), 'minutes'),
98
- );
99
- protected readonly secondsArrays = computed(() =>
100
- this.getTimeArrays(this.min(), this.max(), 'seconds'),
101
- );
102
-
103
- private getHoursArray(minSeconds: number, maxSeconds: number): string[] {
104
- const minHours = convertSecondsToTime(minSeconds).hours;
105
- const maxHours = convertSecondsToTime(maxSeconds).hours;
106
- return Array.from({ length: maxHours - minHours + 1 }, (_, i) =>
107
- formatNumberToString(i + minHours),
108
- );
109
- }
110
-
111
- private getTimeArrays(
112
- minSeconds: number,
113
- maxSeconds: number,
114
- timeType: 'minutes' | 'seconds',
115
- ): TimeArrays {
116
- const minTime = convertSecondsToTime(minSeconds)[timeType];
117
- const maxTime = convertSecondsToTime(maxSeconds)[timeType];
118
- return {
119
- minRange: Array.from({ length: 60 - minTime }, (_, i) => formatNumberToString(i + minTime)),
120
- defaultRange: Array.from({ length: 60 }, (_, i) => formatNumberToString(i)),
121
- maxRange: Array.from({ length: maxTime + 1 }, (_, i) => formatNumberToString(i)),
122
- };
123
- }
124
- }
@@ -1,82 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- ElementRef,
5
- effect,
6
- input,
7
- output,
8
- signal,
9
- viewChild,
10
- } from '@angular/core';
11
-
12
- // Una columna scrolleable (horas | minutos | segundos) del time picker: al
13
- // hacer click en un valor lo emite; la columna auto-scrollea para alinear el
14
- // valor seleccionado arriba (fila de 32px). El `useState(hovered)` +
15
- // `useEffect(scrollTop)` de react -> signal + effect. `onChangeTimeUnit`
16
- // (callback prop) -> output `changeTimeUnit`.
17
- // `:host { display: contents }`: el `<div>` scrolleable es el hijo real del
18
- // grid de 3 columnas (como en react/vue).
19
- @Component({
20
- selector: 'ba-time-unit-selector',
21
- standalone: true,
22
- changeDetection: ChangeDetectionStrategy.OnPush,
23
- host: { style: 'display: contents' },
24
- template: `
25
- <div
26
- #scrollableContainer
27
- [id]="id() + '-' + timeUnit() + '-selector-container'"
28
- [class]="
29
- 'bas-overflow-y-scroll bas-scroll-smooth ' +
30
- (hovered() ? 'bal-ba-scroll-base' : 'bal-ba-no-scrollbar')
31
- "
32
- (mouseenter)="hovered.set(true)"
33
- (mouseleave)="hovered.set(false)"
34
- >
35
- <div class="bas-flex bas-h-full bas-w-[38px] bas-flex-col">
36
- @for (timeValue of timeUnitArray(); track $index) {
37
- <button
38
- type="button"
39
- [id]="id() + '-' + timeUnit() + '-' + timeValue"
40
- [class]="
41
- 'bal-ba-transition-150 bas-min-h-8 bas-flex bas-w-full bas-cursor-pointer ' +
42
- 'bas-items-center bas-justify-center bas-rounded-md bas-border-none ' +
43
- 'bas-text-sm bas-text-[--bal-primary-800] hover:bas-text-[--bal-primary-900] ' +
44
- (selectedValue() === timeValue
45
- ? 'bas-bg-[#caf0f8]'
46
- : 'bas-bg-transparent hover:bas-bg-[#e1f6fb]')
47
- "
48
- (click)="changeTimeUnit.emit({ timeUnit: timeUnit(), value: timeValue })"
49
- >
50
- <p class="bas-m-0">{{ timeValue }}</p>
51
- </button>
52
- }
53
- <span class="bas-min-h-[200px] bas-w-full"></span>
54
- </div>
55
- </div>
56
- `,
57
- })
58
- export class TimeUnitSelectorComponent {
59
- id = input('time-picker');
60
- timeUnitArray = input<string[]>([]);
61
- timeUnit = input<'hours' | 'minutes' | 'seconds' | ''>('');
62
- selectedValue = input('');
63
- firstValue = input(0);
64
-
65
- changeTimeUnit = output<{ timeUnit: string; value: string }>();
66
-
67
- protected readonly hovered = signal(false);
68
- private readonly scrollableContainer =
69
- viewChild<ElementRef<HTMLDivElement>>('scrollableContainer');
70
-
71
- constructor() {
72
- // Alinea el valor seleccionado arriba (32px por fila).
73
- effect(() => {
74
- const selectedNumber = parseInt(this.selectedValue(), 10);
75
- const firstNumber = Number(this.firstValue());
76
- const el = this.scrollableContainer()?.nativeElement;
77
- if (el && !Number.isNaN(selectedNumber)) {
78
- el.scrollTop = 32 * (selectedNumber - firstNumber);
79
- }
80
- });
81
- }
82
- }
@@ -1,18 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { Component } from '@angular/core';
3
- import { render, screen } from '@testing-library/angular';
4
- import { ProgressbarComponent } from './progressbar.component';
5
- describe('ProgressbarComponent', () => {
6
- it('percent 100 cuando step3', async () => {
7
- @Component({ standalone: true, imports: [ProgressbarComponent], template: `<ba-progressbar [step3]="true" />` })
8
- class Host {}
9
- await render(Host);
10
- expect(screen.getByTestId('progressbar-fill').getAttribute('data-percent')).toBe('100');
11
- });
12
- it('percent 15 cuando step1', async () => {
13
- @Component({ standalone: true, imports: [ProgressbarComponent], template: `<ba-progressbar [step1]="true" />` })
14
- class Host {}
15
- await render(Host);
16
- expect(screen.getByTestId('progressbar-fill').getAttribute('data-percent')).toBe('15');
17
- });
18
- });
@@ -1,93 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
2
-
3
- // El original orquesta 12
4
- // AnimationControls de framer-motion; siguiendo el port Vue, esa coreografía
5
- // se sustituye por un único porcentaje derivado de los mismos props (`percent`)
6
- // que revela una capa coloreada superpuesta a la de fondo mediante `clip-path`,
7
- // animado con `transition` CSS. El subrayado decorativo no se reproduce.
8
- //
9
- // `activeUnderlineWhenFillStep1`/`activeUnderlineWhenFillToStep2` se aceptan
10
- // por paridad de API pero no afectan a `percent` (solo controlaban el
11
- // subrayado). Prioridad de `percent`: gana el flag del paso más avanzado
12
- // (misma elección deliberada documentada en Progressbar.vue).
13
- @Component({
14
- selector: 'ba-progressbar',
15
- standalone: true,
16
- changeDetection: ChangeDetectionStrategy.OnPush,
17
- template: `
18
- <div class="bas-relative bas-flex bas-h-[54px] bas-w-60 bas-flex-row bas-items-center bas-justify-between">
19
- <!-- Fondo apagado (siempre visible) -->
20
- <svg height="30" width="30" style="z-index: 1" xmlns="http://www.w3.org/2000/svg">
21
- <path d="M4,15a11,11 0 1,0 22,0a11,11 0 1,0 -22,0" stroke="#acd4e4" stroke-width="5" fill="transparent" />
22
- </svg>
23
- <svg width="82" height="8" style="position: absolute; left: 26px; z-index: 0" xmlns="http://www.w3.org/2000/svg">
24
- <path fill="#c4e0ec" d="M0 0h90v10H0Z" />
25
- </svg>
26
- <svg height="30" width="30" style="z-index: 1" xmlns="http://www.w3.org/2000/svg">
27
- <path d="M4,15a11,11 0 1,0 22,0a11,11 0 1,0 -22,0" stroke="#acd4e4" stroke-width="5" fill="transparent" />
28
- </svg>
29
- <svg width="82" height="8" style="position: absolute; left: 130px; z-index: 0" xmlns="http://www.w3.org/2000/svg">
30
- <path fill="#c4e0ec" d="M0 0h90v10H0Z" />
31
- </svg>
32
- <svg height="30" width="30" style="z-index: 1" xmlns="http://www.w3.org/2000/svg">
33
- <path d="M4,15a11,11 0 1,0 22,0a11,11 0 1,0 -22,0" stroke="#acd4e4" stroke-width="5" fill="transparent" />
34
- </svg>
35
-
36
- <!-- Capa coloreada, revelada según percent -->
37
- <div
38
- class="bas-absolute bas-flex bas-h-full bas-w-full bas-flex-row bas-items-center bas-justify-between bas-progress-fill"
39
- [style.clip-path]="'inset(0 ' + (100 - percent()) + '% 0 0)'"
40
- data-testid="progressbar-fill"
41
- [attr.data-percent]="percent()"
42
- >
43
- <svg height="30" width="30" style="z-index: 1" xmlns="http://www.w3.org/2000/svg">
44
- <path d="M4,15a11,11 0 1,0 22,0a11,11 0 1,0 -22,0" stroke="#1961a4" stroke-width="5" fill="transparent" />
45
- <circle r="5" cx="15" cy="15" fill="#1961a4" />
46
- </svg>
47
- <svg width="84" height="8" style="position: absolute; left: 26px; z-index: 0" xmlns="http://www.w3.org/2000/svg">
48
- <path fill="#1961a4" d="M0 0h90v10H0Z" />
49
- </svg>
50
- <svg height="30" width="30" style="z-index: 1" xmlns="http://www.w3.org/2000/svg">
51
- <path d="M4,15a11,11 0 1,0 22,0a11,11 0 1,0 -22,0" stroke="#1961a4" stroke-width="5" fill="transparent" />
52
- <circle r="5" cx="15" cy="15" fill="#1961a4" />
53
- </svg>
54
- <svg width="84" height="8" style="position: absolute; left: 130px; z-index: 0" xmlns="http://www.w3.org/2000/svg">
55
- <path fill="#1961a4" d="M0 0h90v10H0Z" />
56
- </svg>
57
- <svg height="30" width="30" style="z-index: 1" xmlns="http://www.w3.org/2000/svg">
58
- <path d="M4,15a11,11 0 1,0 22,0a11,11 0 1,0 -22,0" stroke="#1961a4" stroke-width="5" fill="transparent" />
59
- <circle r="5" cx="15" cy="15" fill="#1961a4" />
60
- </svg>
61
- </div>
62
- </div>
63
- `,
64
- styles: [
65
- `
66
- .bas-progress-fill {
67
- transition: clip-path 0.6s ease;
68
- }
69
- `,
70
- ],
71
- })
72
- export class ProgressbarComponent {
73
- step1 = input(false);
74
- step2 = input(false);
75
- step3 = input(false);
76
- goBackToStep1 = input(false);
77
- goBackToStep2 = input(false);
78
- fillStep1 = input(false);
79
- activeUnderlineWhenFillStep1 = input(false);
80
- fillToStep2 = input(false);
81
- activeUnderlineWhenFillToStep2 = input(false);
82
-
83
- percent = computed(() => {
84
- if (this.step3()) return 100;
85
- if (this.step2()) return 50;
86
- if (this.step1()) return 15;
87
- if (this.goBackToStep2()) return 50;
88
- if (this.goBackToStep1()) return 15;
89
- if (this.fillToStep2()) return 50;
90
- if (this.fillStep1()) return 15;
91
- return 0;
92
- });
93
- }