@softpak/components 0.0.0-beta.17 → 0.0.0-beta.170

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 (86) hide show
  1. package/esm2022/spx-button/spx-button.component.mjs +12 -3
  2. package/esm2022/spx-change-details/public-api.mjs +2 -0
  3. package/esm2022/spx-change-details/softpak-components-spx-change-details.mjs +5 -0
  4. package/esm2022/spx-change-details/spx-change-details-value.interface.mjs +2 -0
  5. package/esm2022/spx-change-details/spx-change-details.component.mjs +138 -0
  6. package/esm2022/spx-channel-selection/src/spx-channel-selection.component.mjs +1 -1
  7. package/esm2022/spx-channel-selection/src/spx-company-selection.component.mjs +2 -2
  8. package/esm2022/spx-check-digit/spx-check-digit.component.mjs +12 -4
  9. package/esm2022/spx-form-section/spx-form-section.component.mjs +9 -9
  10. package/esm2022/spx-form-view/public-api.mjs +4 -0
  11. package/esm2022/spx-form-view/softpak-components-spx-form-view.mjs +5 -0
  12. package/esm2022/spx-form-view/spx-autocomplete-search.component.mjs +106 -0
  13. package/esm2022/spx-form-view/spx-form-field.interface.mjs +2 -0
  14. package/esm2022/spx-form-view/spx-form-section.interface.mjs +2 -0
  15. package/esm2022/spx-form-view/spx-form-view.component.mjs +213 -0
  16. package/esm2022/spx-inputs/spx-dropdown.component.mjs +94 -0
  17. package/esm2022/spx-inputs/spx-input-box.component.mjs +70 -46
  18. package/esm2022/spx-inputs/spx-input-date.component.mjs +1 -1
  19. package/esm2022/spx-inputs/spx-input-float.component.mjs +10 -5
  20. package/esm2022/spx-inputs/spx-input-number.component.mjs +10 -5
  21. package/esm2022/spx-inputs/spx-input-radio.component.mjs +93 -27
  22. package/esm2022/spx-inputs/spx-input-text.component.mjs +21 -32
  23. package/esm2022/spx-inputs/spx-input-type.enum.mjs +2 -1
  24. package/esm2022/spx-inputs/spx-input.component.mjs +48 -13
  25. package/esm2022/spx-navigation/spx-home-tile.component.mjs +29 -10
  26. package/esm2022/spx-navigation/spx-navigation-item.interface.mjs +1 -1
  27. package/esm2022/spx-navigation/spx-navigation.component.mjs +11 -5
  28. package/esm2022/spx-number-check/public-api.mjs +2 -0
  29. package/esm2022/spx-number-check/softpak-components-spx-number-check.mjs +5 -0
  30. package/esm2022/spx-number-check/spx-number-check.component.mjs +259 -0
  31. package/esm2022/spx-spinner/spx-spinner.component.mjs +5 -5
  32. package/esm2022/spx-suggestion/spx-suggestion.component.mjs +28 -10
  33. package/esm2022/spx-update/src/spx-update-info.component.mjs +1 -1
  34. package/fesm2022/softpak-components-spx-button.mjs +11 -2
  35. package/fesm2022/softpak-components-spx-button.mjs.map +1 -1
  36. package/fesm2022/softpak-components-spx-change-details.mjs +145 -0
  37. package/fesm2022/softpak-components-spx-change-details.mjs.map +1 -0
  38. package/fesm2022/softpak-components-spx-channel-selection.mjs +2 -2
  39. package/fesm2022/softpak-components-spx-channel-selection.mjs.map +1 -1
  40. package/fesm2022/softpak-components-spx-check-digit.mjs +11 -3
  41. package/fesm2022/softpak-components-spx-check-digit.mjs.map +1 -1
  42. package/fesm2022/softpak-components-spx-form-section.mjs +8 -8
  43. package/fesm2022/softpak-components-spx-form-section.mjs.map +1 -1
  44. package/fesm2022/softpak-components-spx-form-view.mjs +319 -0
  45. package/fesm2022/softpak-components-spx-form-view.mjs.map +1 -0
  46. package/fesm2022/softpak-components-spx-inputs.mjs +331 -118
  47. package/fesm2022/softpak-components-spx-inputs.mjs.map +1 -1
  48. package/fesm2022/softpak-components-spx-navigation.mjs +37 -12
  49. package/fesm2022/softpak-components-spx-navigation.mjs.map +1 -1
  50. package/fesm2022/softpak-components-spx-number-check.mjs +266 -0
  51. package/fesm2022/softpak-components-spx-number-check.mjs.map +1 -0
  52. package/fesm2022/softpak-components-spx-spinner.mjs +4 -4
  53. package/fesm2022/softpak-components-spx-spinner.mjs.map +1 -1
  54. package/fesm2022/softpak-components-spx-suggestion.mjs +27 -9
  55. package/fesm2022/softpak-components-spx-suggestion.mjs.map +1 -1
  56. package/fesm2022/softpak-components-spx-update.mjs +1 -1
  57. package/fesm2022/softpak-components-spx-update.mjs.map +1 -1
  58. package/package.json +25 -7
  59. package/spx-button/spx-button.component.d.ts +3 -1
  60. package/spx-change-details/index.d.ts +5 -0
  61. package/spx-change-details/public-api.d.ts +1 -0
  62. package/spx-change-details/spx-change-details-value.interface.d.ts +7 -0
  63. package/spx-change-details/spx-change-details.component.d.ts +47 -0
  64. package/spx-check-digit/spx-check-digit.component.d.ts +3 -1
  65. package/spx-form-view/index.d.ts +5 -0
  66. package/spx-form-view/public-api.d.ts +3 -0
  67. package/spx-form-view/spx-autocomplete-search.component.d.ts +40 -0
  68. package/spx-form-view/spx-form-field.interface.d.ts +16 -0
  69. package/spx-form-view/spx-form-section.interface.d.ts +9 -0
  70. package/spx-form-view/spx-form-view.component.d.ts +37 -0
  71. package/spx-inputs/spx-dropdown.component.d.ts +18 -0
  72. package/spx-inputs/spx-input-box.component.d.ts +14 -7
  73. package/spx-inputs/spx-input-float.component.d.ts +3 -2
  74. package/spx-inputs/spx-input-number.component.d.ts +3 -2
  75. package/spx-inputs/spx-input-radio.component.d.ts +13 -5
  76. package/spx-inputs/spx-input-text.component.d.ts +3 -2
  77. package/spx-inputs/spx-input-type.enum.d.ts +2 -1
  78. package/spx-inputs/spx-input.component.d.ts +11 -3
  79. package/spx-navigation/spx-home-tile.component.d.ts +5 -1
  80. package/spx-navigation/spx-navigation-item.interface.d.ts +1 -0
  81. package/spx-navigation/spx-navigation.component.d.ts +4 -1
  82. package/spx-number-check/index.d.ts +5 -0
  83. package/spx-number-check/public-api.d.ts +1 -0
  84. package/spx-number-check/spx-number-check.component.d.ts +48 -0
  85. package/spx-suggestion/spx-suggestion.component.d.ts +3 -1
  86. package/tailwind.css +1 -1
@@ -1,6 +1,6 @@
1
1
  import { NgIf, NgFor } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { EventEmitter, Component, Input, Output, HostListener } from '@angular/core';
3
+ import { EventEmitter, Component, Input, Output, HostListener, ViewChild } from '@angular/core';
4
4
  import { SpxButtonComponent } from '@softpak/components/spx-button';
5
5
  import * as i1 from '@fortawesome/angular-fontawesome';
6
6
  import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
@@ -8,59 +8,72 @@ import { faEdit } from '@fortawesome/free-solid-svg-icons/faEdit';
8
8
  import { faQuestion } from '@fortawesome/free-solid-svg-icons/faQuestion';
9
9
  import { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';
10
10
  import { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';
11
+ import { fromEvent } from 'rxjs';
11
12
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
12
13
  import { SpxSuggestionComponent } from '@softpak/components/spx-suggestion';
13
14
  import { DateTime } from 'luxon';
15
+ import { valuePairToValue } from '@softpak/components/spx-helpers';
14
16
 
15
17
  class SpxInputBoxComponent {
16
- constructor() {
18
+ handleFocusIn(ev) {
19
+ this.emitFocusIn();
20
+ }
21
+ handleFocusOut(ev) {
22
+ const thisEl = this.elRef.nativeElement;
23
+ const relatedElement = ev.relatedTarget;
24
+ if (!relatedElement || !thisEl.contains(relatedElement)) {
25
+ this.emitFocusOut();
26
+ }
27
+ }
28
+ handleWindowClick(ev) {
29
+ if (ev.composedPath().includes(this.elRef.nativeElement)) {
30
+ this.emitFocusIn();
31
+ }
32
+ else {
33
+ this.emitFocusOut();
34
+ }
35
+ }
36
+ onClear() {
37
+ this.spxClear.emit();
38
+ }
39
+ onSearch() {
40
+ this.spxSearch.emit();
41
+ }
42
+ onEdit() {
43
+ this.spxEdit.emit();
44
+ }
45
+ onHelp() {
46
+ this.spxHelp.emit();
47
+ }
48
+ constructor(elRef) {
49
+ this.elRef = elRef;
17
50
  this.faEdit = faEdit;
18
51
  this.faSearch = faSearch;
19
52
  this.faQuestion = faQuestion;
20
53
  this.faTimes = faTimes;
54
+ this.spxFocused = false;
21
55
  this.spxReadonly = false;
22
56
  this.spxShowClear = true;
57
+ this.spxShowLabel = true;
23
58
  this.spxClear = new EventEmitter();
24
59
  this.spxSearch = new EventEmitter();
25
60
  this.spxFocus = new EventEmitter();
26
61
  this.spxFocusOut = new EventEmitter();
27
62
  this.spxEdit = new EventEmitter();
28
63
  this.spxHelp = new EventEmitter();
29
- this.spxFocused = false;
30
- }
31
- // @Listen('focusout', { capture: true })
32
- // handleFocusOut() {
33
- // this.spxFocused = false;
34
- // this.spxFocusOut.emit();
35
- // }
36
- // @Listen('click', { target: 'window' })
37
- // handleWindowClick(ev) {
38
- // if (ev.composedPath().includes(this.el)) {
39
- // if (!this.spxFocused) {
40
- // this.spxFocused = true;
41
- // this.spxFocus.emit();
42
- // }
43
- // } else {
44
- // this.spxFocused = false;
45
- // }
46
- // }
47
- async spxSetFocus() {
48
- this.spxFocused = true;
49
- }
50
- onClear() {
51
- this.spxClear.emit();
52
- }
53
- onSearch() {
54
- this.spxSearch.emit();
55
64
  }
56
- onEdit() {
57
- this.spxEdit.emit();
65
+ emitFocusIn() {
66
+ if (!this.spxFocused) {
67
+ this.spxFocus.emit();
68
+ }
58
69
  }
59
- onHelp() {
60
- this.spxHelp.emit();
70
+ emitFocusOut() {
71
+ if (this.spxFocused) {
72
+ this.spxFocusOut.emit();
73
+ }
61
74
  }
62
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
63
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputBoxComponent, isStandalone: true, selector: "spx-input-box", inputs: { spxLabel: "spxLabel", spxRequired: "spxRequired", spxReadonly: "spxReadonly", spxShowHelp: "spxShowHelp", spxCompact: "spxCompact", spxShowClear: "spxShowClear", spxShowEdit: "spxShowEdit", spxShowSearch: "spxShowSearch", spxShowValidationMessages: "spxShowValidationMessages", spxValue: "spxValue", spxFocused: "spxFocused" }, outputs: { spxClear: "spxClear", spxSearch: "spxSearch", spxFocus: "spxFocus", spxFocusOut: "spxFocusOut", spxEdit: "spxEdit", spxHelp: "spxHelp" }, ngImport: i0, template: `<div class="flex rounded w-full gap-3"
75
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputBoxComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
76
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputBoxComponent, isStandalone: true, selector: "spx-input-box", inputs: { spxCompact: "spxCompact", spxFocused: "spxFocused", spxLabel: "spxLabel", spxReadonly: "spxReadonly", spxRequired: "spxRequired", spxShowClear: "spxShowClear", spxShowEdit: "spxShowEdit", spxShowHelp: "spxShowHelp", spxShowLabel: "spxShowLabel", spxShowSearch: "spxShowSearch", spxShowValidationMessages: "spxShowValidationMessages", spxValue: "spxValue" }, outputs: { spxClear: "spxClear", spxSearch: "spxSearch", spxFocus: "spxFocus", spxFocusOut: "spxFocusOut", spxEdit: "spxEdit", spxHelp: "spxHelp" }, host: { listeners: { "focusin": "handleFocusIn($event)", "focusout": "handleFocusOut($event)", "document:click": "handleWindowClick($event)" } }, ngImport: i0, template: `<div class="flex rounded w-full gap-3"
64
77
  [class.rounded-none]="this.spxShowValidationMessages"
65
78
  [class.rounded-t]="this.spxShowValidationMessages"
66
79
  [class.outline-none]="this.spxFocused && !this.spxReadonly"
@@ -74,7 +87,7 @@ class SpxInputBoxComponent {
74
87
  [class.p-0]="this.spxCompact"
75
88
  [class.flex]="this.spxCompact"
76
89
  [class.items-center]="this.spxCompact">
77
- <div class="text-sm mb-1 text-gray-800"
90
+ <div *ngIf="this.spxShowLabel" class="font-bold text-sm mb-1 text-gray-800"
78
91
  [class.mb-0]="this.spxCompact"
79
92
  [class.px-3]="this.spxCompact">
80
93
  {{this.spxLabel}} <span *ngIf="spxRequired" class="text-red-800">*</span>
@@ -87,7 +100,6 @@ class SpxInputBoxComponent {
87
100
  (spxClick)="onEdit()"
88
101
  [spxFullHeight]="true"
89
102
  [spxSize]="'xl'"
90
- [spxTabIndex]="-1"
91
103
  [spxType]="'button'">
92
104
  <fa-icon [icon]="faEdit" class="block text-xl"></fa-icon>
93
105
  </spx-button>
@@ -95,6 +107,7 @@ class SpxInputBoxComponent {
95
107
  *ngIf="this.spxShowHelp"
96
108
  (spxClick)="onHelp()"
97
109
  [spxFullHeight]="true"
110
+ [spxDisabled]="this.spxReadonly"
98
111
  [spxSize]="'xl'"
99
112
  [spxTabIndex]="-1"
100
113
  [spxType]="'button'">
@@ -104,6 +117,7 @@ class SpxInputBoxComponent {
104
117
  *ngIf="this.spxShowSearch"
105
118
  (spxClick)="onSearch()"
106
119
  [spxFullHeight]="true"
120
+ [spxDisabled]="this.spxReadonly"
107
121
  [spxSize]="'xl'"
108
122
  [spxTabIndex]="-1"
109
123
  [spxType]="'button'">
@@ -149,7 +163,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
149
163
  [class.p-0]="this.spxCompact"
150
164
  [class.flex]="this.spxCompact"
151
165
  [class.items-center]="this.spxCompact">
152
- <div class="text-sm mb-1 text-gray-800"
166
+ <div *ngIf="this.spxShowLabel" class="font-bold text-sm mb-1 text-gray-800"
153
167
  [class.mb-0]="this.spxCompact"
154
168
  [class.px-3]="this.spxCompact">
155
169
  {{this.spxLabel}} <span *ngIf="spxRequired" class="text-red-800">*</span>
@@ -162,7 +176,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
162
176
  (spxClick)="onEdit()"
163
177
  [spxFullHeight]="true"
164
178
  [spxSize]="'xl'"
165
- [spxTabIndex]="-1"
166
179
  [spxType]="'button'">
167
180
  <fa-icon [icon]="faEdit" class="block text-xl"></fa-icon>
168
181
  </spx-button>
@@ -170,6 +183,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
170
183
  *ngIf="this.spxShowHelp"
171
184
  (spxClick)="onHelp()"
172
185
  [spxFullHeight]="true"
186
+ [spxDisabled]="this.spxReadonly"
173
187
  [spxSize]="'xl'"
174
188
  [spxTabIndex]="-1"
175
189
  [spxType]="'button'">
@@ -179,6 +193,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
179
193
  *ngIf="this.spxShowSearch"
180
194
  (spxClick)="onSearch()"
181
195
  [spxFullHeight]="true"
196
+ [spxDisabled]="this.spxReadonly"
182
197
  [spxSize]="'xl'"
183
198
  [spxTabIndex]="-1"
184
199
  [spxType]="'button'">
@@ -200,20 +215,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
200
215
  <ng-content select="[validation-messages]"></ng-content>
201
216
  </div>`,
202
217
  }]
203
- }], propDecorators: { spxLabel: [{
218
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { spxCompact: [{
204
219
  type: Input
205
- }], spxRequired: [{
220
+ }], spxFocused: [{
206
221
  type: Input
207
- }], spxReadonly: [{
222
+ }], spxLabel: [{
208
223
  type: Input
209
- }], spxShowHelp: [{
224
+ }], spxReadonly: [{
210
225
  type: Input
211
- }], spxCompact: [{
226
+ }], spxRequired: [{
212
227
  type: Input
213
228
  }], spxShowClear: [{
214
229
  type: Input
215
230
  }], spxShowEdit: [{
216
231
  type: Input
232
+ }], spxShowHelp: [{
233
+ type: Input
234
+ }], spxShowLabel: [{
235
+ type: Input
217
236
  }], spxShowSearch: [{
218
237
  type: Input
219
238
  }], spxShowValidationMessages: [{
@@ -232,8 +251,104 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
232
251
  type: Output
233
252
  }], spxHelp: [{
234
253
  type: Output
235
- }], spxFocused: [{
254
+ }], handleFocusIn: [{
255
+ type: HostListener,
256
+ args: ['focusin', ["$event"]]
257
+ }], handleFocusOut: [{
258
+ type: HostListener,
259
+ args: ['focusout', ["$event"]]
260
+ }], handleWindowClick: [{
261
+ type: HostListener,
262
+ args: ['document:click', ["$event"]]
263
+ }] } });
264
+
265
+ class SpxDropdownComponent {
266
+ constructor() {
267
+ this.focusPosition = 0;
268
+ this.spxSuggestions = [];
269
+ this.spxSelect = new EventEmitter();
270
+ }
271
+ ngOnInit() {
272
+ this.listenToKeyUp();
273
+ }
274
+ ngOnChanges(changes) {
275
+ this.focusPosition = 0;
276
+ }
277
+ ngOnDestroy() {
278
+ this.subscriptionKeyUp?.unsubscribe();
279
+ }
280
+ handleSuggestionClick(valuePair) {
281
+ this.select(valuePair);
282
+ }
283
+ listenToKeyUp() {
284
+ this.subscriptionKeyUp = fromEvent(window, 'keyup').subscribe((event) => {
285
+ if (event.key === 'ArrowUp' && this.focusPosition > 0) {
286
+ this.focusPosition = this.focusPosition - 1;
287
+ event.preventDefault();
288
+ }
289
+ if (event.key === 'ArrowDown' && this.focusPosition < this.spxSuggestions.length - 1) {
290
+ this.focusPosition = this.focusPosition + 1;
291
+ event.preventDefault();
292
+ }
293
+ if (event.key === 'Enter' && this.spxSuggestions.length > 0) {
294
+ this.select(this.spxSuggestions.at(this.focusPosition));
295
+ event.preventDefault();
296
+ }
297
+ });
298
+ }
299
+ select(valuePair) {
300
+ this.focusPosition = 0;
301
+ this.spxSelect.emit(valuePair);
302
+ }
303
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
304
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxDropdownComponent, isStandalone: true, selector: "spx-dropdown", inputs: { spxSuggestions: "spxSuggestions" }, outputs: { spxSelect: "spxSelect" }, usesOnChanges: true, ngImport: i0, template: `<div class="relative text-black">
305
+ <div
306
+ class="absolute bg-gray-100 left-0 right-0 z-20">
307
+ <button
308
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
309
+ class="text-black block w-full p-2 border border-gray-200 rounded-lg shadow hover:bg-gray-200 flex items-center text-left"
310
+ [class.bg-gray-100]="i === this.focusPosition"
311
+ [class.bg-white]="i !== this.focusPosition"
312
+ (click)="this.handleSuggestionClick(valuePair)"
313
+ [attr.tabindex]="-1"
314
+ [attr.type]="'button'">
315
+ <div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
316
+ <spx-button (spxClick)="this.handleSuggestionClick(valuePair)" [spxType]="'button'" [spxTabIndex]="-1">Select</spx-button>
317
+ </button>
318
+ </div>
319
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SpxButtonComponent, selector: "spx-button", inputs: ["spxDisabled", "spxClass", "spxClassObject", "spxForm", "spxFullHeight", "spxFullWidth", "spxSeverity", "spxSize", "spxTabIndex", "spxType"], outputs: ["spxClick"] }] }); }
320
+ }
321
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxDropdownComponent, decorators: [{
322
+ type: Component,
323
+ args: [{
324
+ selector: 'spx-dropdown',
325
+ standalone: true,
326
+ imports: [
327
+ NgIf,
328
+ NgFor,
329
+ SpxButtonComponent,
330
+ ],
331
+ template: `<div class="relative text-black">
332
+ <div
333
+ class="absolute bg-gray-100 left-0 right-0 z-20">
334
+ <button
335
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
336
+ class="text-black block w-full p-2 border border-gray-200 rounded-lg shadow hover:bg-gray-200 flex items-center text-left"
337
+ [class.bg-gray-100]="i === this.focusPosition"
338
+ [class.bg-white]="i !== this.focusPosition"
339
+ (click)="this.handleSuggestionClick(valuePair)"
340
+ [attr.tabindex]="-1"
341
+ [attr.type]="'button'">
342
+ <div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
343
+ <spx-button (spxClick)="this.handleSuggestionClick(valuePair)" [spxType]="'button'" [spxTabIndex]="-1">Select</spx-button>
344
+ </button>
345
+ </div>
346
+ </div>`,
347
+ }]
348
+ }], propDecorators: { spxSuggestions: [{
236
349
  type: Input
350
+ }], spxSelect: [{
351
+ type: Output
237
352
  }] } });
238
353
 
239
354
  class SpxInputTextComponent {
@@ -249,8 +364,8 @@ class SpxInputTextComponent {
249
364
  this.spxFocus = new EventEmitter();
250
365
  this.spxWasInternalUpdate = false;
251
366
  }
252
- async spxSetFocus() {
253
- // this.elInput.focus();
367
+ spxSetFocus() {
368
+ this.inputRef?.nativeElement?.focus();
254
369
  }
255
370
  componentDidLoad() {
256
371
  if (this.spxAutofocus) {
@@ -282,8 +397,9 @@ class SpxInputTextComponent {
282
397
  this.spxFocused = true;
283
398
  }
284
399
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputTextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
285
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputTextComponent, isStandalone: true, selector: "spx-input-text", inputs: { spxName: "spxName", spxAutofocus: "spxAutofocus", spxInputMode: "spxInputMode", spxPattern: "spxPattern", spxSuggestions: "spxSuggestions", spxReadonly: "spxReadonly", spxValidators: "spxValidators", spxCapitalize: "spxCapitalize", spxFocused: "spxFocused", spxType: "spxType", value: "value", spxWasInternalUpdate: "spxWasInternalUpdate" }, outputs: { spxBlurFromChild: "spxBlurFromChild", spxChange: "spxChange", spxFocus: "spxFocus" }, ngImport: i0, template: `<div class="relative text-black">
400
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputTextComponent, isStandalone: true, selector: "spx-input-text", inputs: { spxName: "spxName", spxAutofocus: "spxAutofocus", spxInputMode: "spxInputMode", spxPattern: "spxPattern", spxSuggestions: "spxSuggestions", spxReadonly: "spxReadonly", spxValidators: "spxValidators", spxCapitalize: "spxCapitalize", spxFocused: "spxFocused", spxType: "spxType", value: "value", spxWasInternalUpdate: "spxWasInternalUpdate" }, outputs: { spxBlurFromChild: "spxBlurFromChild", spxChange: "spxChange", spxFocus: "spxFocus" }, viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: `<div class="relative text-black">
286
401
  <input
402
+ #input
287
403
  class="font-bold text-lg w-full outline-none"
288
404
  [class.bg-white]="!this.spxReadonly"
289
405
  [class.bg-gray-300]="this.spxReadonly"
@@ -295,27 +411,18 @@ class SpxInputTextComponent {
295
411
  [attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
296
412
  [attr.name]="this.spxName"
297
413
  [attr.type]="this.spxType"
298
- [attr.value]="this.value?.description ? this.value?.description : this.value?.value"
414
+ [value]="this.value?.description ? this.value?.description : this.value?.value"
299
415
  (blur)="this.handleBlur()"
300
416
  (keyUp)="this.handleKeyUp()"
301
417
  (focus)="this.handleFocus()"
302
418
  (input)="this.handleDescriptionInput($event)"
303
419
  />
304
420
  <span *ngIf="this.value?.description && this.value?.value && this.value?.description?.valueOf() !== this.value?.value?.valueOf()">{{this.value?.value}}</span>
305
- <div
421
+ <spx-dropdown
306
422
  *ngIf="this.spxFocused && (this.spxType === 'overlay' || this.spxType === 'overlaynumber')"
307
- class="absolute bg-gray-100 left-0 right-0 z-20">
308
- <div
309
- *ngFor="let valuePair of this.spxSuggestions"
310
- class="text-black block w-full p-2 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 flex items-center"
311
- (click)="this.handleSuggestionClick($event)"
312
- [attr.tabindex]="0"
313
- >
314
- <div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
315
- <spx-button spxType="button">Select</spx-button>
316
- </div>
317
- </div>
318
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SpxButtonComponent, selector: "spx-button", inputs: ["spxDisabled", "spxClass", "spxClassObject", "spxForm", "spxFullHeight", "spxFullWidth", "spxSeverity", "spxSize", "spxTabIndex", "spxType"], outputs: ["spxClick"] }] }); }
423
+ [spxSuggestions]="this.spxSuggestions" (spxSelect)="this.handleSuggestionClick($event)">
424
+ </spx-dropdown>
425
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SpxDropdownComponent, selector: "spx-dropdown", inputs: ["spxSuggestions"], outputs: ["spxSelect"] }] }); }
319
426
  }
320
427
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputTextComponent, decorators: [{
321
428
  type: Component,
@@ -326,9 +433,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
326
433
  NgIf,
327
434
  NgFor,
328
435
  SpxButtonComponent,
436
+ SpxDropdownComponent,
329
437
  ],
330
438
  template: `<div class="relative text-black">
331
439
  <input
440
+ #input
332
441
  class="font-bold text-lg w-full outline-none"
333
442
  [class.bg-white]="!this.spxReadonly"
334
443
  [class.bg-gray-300]="this.spxReadonly"
@@ -340,26 +449,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
340
449
  [attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
341
450
  [attr.name]="this.spxName"
342
451
  [attr.type]="this.spxType"
343
- [attr.value]="this.value?.description ? this.value?.description : this.value?.value"
452
+ [value]="this.value?.description ? this.value?.description : this.value?.value"
344
453
  (blur)="this.handleBlur()"
345
454
  (keyUp)="this.handleKeyUp()"
346
455
  (focus)="this.handleFocus()"
347
456
  (input)="this.handleDescriptionInput($event)"
348
457
  />
349
458
  <span *ngIf="this.value?.description && this.value?.value && this.value?.description?.valueOf() !== this.value?.value?.valueOf()">{{this.value?.value}}</span>
350
- <div
459
+ <spx-dropdown
351
460
  *ngIf="this.spxFocused && (this.spxType === 'overlay' || this.spxType === 'overlaynumber')"
352
- class="absolute bg-gray-100 left-0 right-0 z-20">
353
- <div
354
- *ngFor="let valuePair of this.spxSuggestions"
355
- class="text-black block w-full p-2 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 flex items-center"
356
- (click)="this.handleSuggestionClick($event)"
357
- [attr.tabindex]="0"
358
- >
359
- <div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
360
- <spx-button spxType="button">Select</spx-button>
361
- </div>
362
- </div>
461
+ [spxSuggestions]="this.spxSuggestions" (spxSelect)="this.handleSuggestionClick($event)">
462
+ </spx-dropdown>
363
463
  </div>`,
364
464
  }]
365
465
  }], propDecorators: { spxName: [{
@@ -392,6 +492,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
392
492
  type: Output
393
493
  }], spxWasInternalUpdate: [{
394
494
  type: Input
495
+ }], inputRef: [{
496
+ type: ViewChild,
497
+ args: ['input', { static: true }]
395
498
  }] } });
396
499
 
397
500
  class SpxInputDateComponent {
@@ -596,7 +699,7 @@ class SpxInputDateComponent {
596
699
  <spx-suggestion
597
700
  *ngFor="let valuePair of spxSuggestions[spxSelectStep]"
598
701
  (click)="this.handleSuggestionClick(valuePair.value)">{{valuePair?.description}}</spx-suggestion>
599
- </div>`, isInline: true, styles: [":host{display:block}.spx-input-date__input{background-color:transparent;border:1px solid #979797;border-radius:4px;color:var(--spx-input--color, rgba(0, 0, 0, .9));box-sizing:border-box;font-size:16px;margin-right:10px;padding:6px;text-align:center;width:100%}.spx-input-date__input:active{transform:scale(.95)}.spx-input-date__input:focus{border:var(--spx-input-box--focus--border, 1px solid rgb(115, 168, 210));border-radius:4px;outline:none}.spx-input-date__control-label{align-items:center;color:#000000b3;display:inline-grid;font-size:13px;letter-spacing:1px}.spx-input-date__input::-webkit-outer-spin-button,.spx-input-date__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.spx-input-date__input[type=number]{-moz-appearance:textfield}.spx-input-date__suggestions,.spx-input-date__controls{display:grid;grid-gap:8px;grid-template-columns:repeat(4,1fr);margin-top:8px}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SpxSuggestionComponent, selector: "spx-suggestion", inputs: ["spxDisabled", "spxSelected"] }] }); }
702
+ </div>`, isInline: true, styles: [":host{display:block}.spx-input-date__input{background-color:transparent;border:1px solid #979797;border-radius:4px;color:var(--spx-input--color, rgba(0, 0, 0, .9));box-sizing:border-box;font-size:16px;margin-right:10px;padding:6px;text-align:center;width:100%}.spx-input-date__input:active{transform:scale(.95)}.spx-input-date__input:focus{border:var(--spx-input-box--focus--border, 1px solid rgb(115, 168, 210));border-radius:4px;outline:none}.spx-input-date__control-label{align-items:center;color:#000000b3;display:inline-grid;font-size:13px;letter-spacing:1px}.spx-input-date__input::-webkit-outer-spin-button,.spx-input-date__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.spx-input-date__input[type=number]{-moz-appearance:textfield}.spx-input-date__suggestions,.spx-input-date__controls{display:grid;grid-gap:8px;grid-template-columns:repeat(4,1fr);margin-top:8px}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SpxSuggestionComponent, selector: "spx-suggestion", inputs: ["spxDisabled", "spxFocused", "spxSelected", "spxTabbable"] }] }); }
600
703
  }
601
704
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputDateComponent, decorators: [{
602
705
  type: Component,
@@ -698,8 +801,8 @@ class SpxInputFloatComponent {
698
801
  this.spxWasInternalUpdate = false;
699
802
  this.tick = {};
700
803
  }
701
- async spxSetFocus() {
702
- // this.elFirstInput.focus();
804
+ spxSetFocus() {
805
+ this.firstInputRef?.nativeElement?.focus();
703
806
  }
704
807
  // @Watch('value') onValueChanged(newValue: SpxValuePair<any>, _oldValue: SpxValuePair<any>) {
705
808
  // this.handleSetValue(newValue);
@@ -751,8 +854,9 @@ class SpxInputFloatComponent {
751
854
  return /^[+-]?\d+(\.\d+)?$/.test(value);
752
855
  }
753
856
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputFloatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
754
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputFloatComponent, isStandalone: true, selector: "spx-input-float", inputs: { spxName: "spxName", spxAutofocus: "spxAutofocus", spxReadonly: "spxReadonly", spxValidators: "spxValidators", spxFocused: "spxFocused", spxStep: "spxStep", value: "value", spxWasInternalUpdate: "spxWasInternalUpdate", tick: "tick" }, outputs: { spxChange: "spxChange", spxFocus: "spxFocus" }, ngImport: i0, template: `<div class="flex items-end">
857
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputFloatComponent, isStandalone: true, selector: "spx-input-float", inputs: { spxName: "spxName", spxAutofocus: "spxAutofocus", spxReadonly: "spxReadonly", spxValidators: "spxValidators", spxFocused: "spxFocused", spxStep: "spxStep", value: "value", spxWasInternalUpdate: "spxWasInternalUpdate", tick: "tick" }, outputs: { spxChange: "spxChange", spxFocus: "spxFocus" }, viewQueries: [{ propertyName: "firstInputRef", first: true, predicate: ["firstInputRef"], descendants: true, static: true }], ngImport: i0, template: `<div class="flex items-end">
755
858
  <input
859
+ #firstInputRef
756
860
  class="spx-input-float__input"
757
861
  [attr.autofocus]="this.spxAutofocus ? this.spxAutofocus : undefined"
758
862
  [attr.disabled]="this.spxReadonly ? this.spxReadonly : undefined"
@@ -785,6 +889,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
785
889
  SpxButtonComponent,
786
890
  ], template: `<div class="flex items-end">
787
891
  <input
892
+ #firstInputRef
788
893
  class="spx-input-float__input"
789
894
  [attr.autofocus]="this.spxAutofocus ? this.spxAutofocus : undefined"
790
895
  [attr.disabled]="this.spxReadonly ? this.spxReadonly : undefined"
@@ -830,6 +935,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
830
935
  type: Input
831
936
  }], tick: [{
832
937
  type: Input
938
+ }], firstInputRef: [{
939
+ type: ViewChild,
940
+ args: ['firstInputRef', { static: true }]
833
941
  }] } });
834
942
 
835
943
  class SpxInputNumberComponent {
@@ -841,8 +949,8 @@ class SpxInputNumberComponent {
841
949
  this.spxFocus = new EventEmitter();
842
950
  this.spxWasInternalUpdate = false;
843
951
  }
844
- async spxSetFocus() {
845
- // this.elInput.focus();
952
+ spxSetFocus() {
953
+ this.inputRef?.nativeElement?.focus();
846
954
  }
847
955
  componentDidLoad() {
848
956
  if (this.spxAutofocus) {
@@ -861,8 +969,9 @@ class SpxInputNumberComponent {
861
969
  this.spxChange.emit(this.value);
862
970
  }
863
971
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputNumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
864
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputNumberComponent, isStandalone: true, selector: "spx-input-number", inputs: { spxName: "spxName", spxAutofocus: "spxAutofocus", spxInputMode: "spxInputMode", spxReadonly: "spxReadonly", spxValidators: "spxValidators", spxFocused: "spxFocused", spxStep: "spxStep", value: "value" }, outputs: { spxChange: "spxChange", spxFocus: "spxFocus" }, ngImport: i0, template: `<div class="spx-input-number__controls">
972
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputNumberComponent, isStandalone: true, selector: "spx-input-number", inputs: { spxName: "spxName", spxAutofocus: "spxAutofocus", spxInputMode: "spxInputMode", spxReadonly: "spxReadonly", spxValidators: "spxValidators", spxFocused: "spxFocused", spxStep: "spxStep", value: "value" }, outputs: { spxChange: "spxChange", spxFocus: "spxFocus" }, viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: `<div class="spx-input-number__controls">
865
973
  <input
974
+ #input
866
975
  class="spx-input-number__input"
867
976
  [attr.autofocus]="this.spxAutofocus ? this.spxAutofocus : undefined"
868
977
  [class.spx-input-number--readonly]="this.spxReadonly ? this.spxReadonly : undefined"
@@ -879,6 +988,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
879
988
  type: Component,
880
989
  args: [{ selector: 'spx-input-number', standalone: true, imports: [], template: `<div class="spx-input-number__controls">
881
990
  <input
991
+ #input
882
992
  class="spx-input-number__input"
883
993
  [attr.autofocus]="this.spxAutofocus ? this.spxAutofocus : undefined"
884
994
  [class.spx-input-number--readonly]="this.spxReadonly ? this.spxReadonly : undefined"
@@ -910,55 +1020,122 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
910
1020
  type: Output
911
1021
  }], spxFocus: [{
912
1022
  type: Output
1023
+ }], inputRef: [{
1024
+ type: ViewChild,
1025
+ args: ['input', { static: true }]
913
1026
  }] } });
914
1027
 
915
1028
  class SpxInputRadioComponent {
916
1029
  constructor() {
917
- this.spxFocused = true;
1030
+ this.focusPosition = 0;
1031
+ this.spxFocused = false;
1032
+ this.spxShowLabel = true;
918
1033
  this.spxReadonly = false;
919
1034
  this.spxSuggestions = [];
920
1035
  this.spxChange = new EventEmitter();
921
1036
  this.spxFocus = new EventEmitter();
922
- this.spxWasInternalUpdate = false;
923
1037
  }
924
- async spxSetFocus() {
925
- // this.elYear.focus();
1038
+ spxFocusIn() {
1039
+ this.listenToKeys();
1040
+ this.determineFocusPosition();
926
1041
  }
927
- handleSuggestionClick(value) {
928
- this.value = value;
929
- this.spxChange.emit(this.value);
1042
+ spxFocusOut() {
1043
+ this.subscriptionKeyDown?.unsubscribe();
1044
+ this.subscriptionKeyUp?.unsubscribe();
1045
+ }
1046
+ ngOnChanges(changes) {
1047
+ if ((changes['spxSuggestions'] && changes['spxSuggestions'].previousValue !== changes['spxSuggestions'].currentValue) ||
1048
+ (changes['value'] && changes['value'].previousValue !== changes['value'].currentValue)) {
1049
+ this.determineFocusPosition();
1050
+ }
1051
+ }
1052
+ handleSuggestionClick(valuePair) {
1053
+ if (this.spxReadonly) {
1054
+ console.log('spxInputRadio: clicked, but readonly');
1055
+ }
1056
+ else {
1057
+ console.log('spxInputRadio: clicked');
1058
+ this.select(valuePair);
1059
+ }
1060
+ }
1061
+ determineFocusPosition() {
1062
+ if (this.value && this.spxSuggestions?.length) {
1063
+ const index = this.spxSuggestions.findIndex(valuePair => valuePairToValue(valuePair) === valuePairToValue(this.value));
1064
+ this.focusPosition = index >= 0 ? index : 0;
1065
+ }
1066
+ else {
1067
+ this.focusPosition = 0;
1068
+ }
1069
+ }
1070
+ select(valuePair) {
1071
+ this.focusPosition = 0;
1072
+ this.value = valuePair;
1073
+ this.spxChange.emit(valuePair);
1074
+ }
1075
+ listenToKeys() {
1076
+ this.subscriptionKeyUp = fromEvent(window, 'keyup').subscribe((event) => {
1077
+ if ((event.key === 'ArrowUp' || event.key === 'ArrowLeft') && this.focusPosition > 0) {
1078
+ this.focusPosition = this.focusPosition - 1;
1079
+ this.select(this.spxSuggestions.at(this.focusPosition));
1080
+ event.preventDefault();
1081
+ }
1082
+ if ((event.key === 'ArrowDown' || event.key === 'ArrowRight') && this.focusPosition < this.spxSuggestions.length - 1) {
1083
+ this.focusPosition = this.focusPosition + 1;
1084
+ this.select(this.spxSuggestions.at(this.focusPosition));
1085
+ event.preventDefault();
1086
+ }
1087
+ });
1088
+ this.subscriptionKeyDown = fromEvent(window, 'keydown').subscribe((event) => {
1089
+ if (event.key === 'ArrowDown' ||
1090
+ event.key === 'ArrowLeft' ||
1091
+ event.key === 'ArrowRight' ||
1092
+ event.key === 'ArrowUp') {
1093
+ event.preventDefault();
1094
+ }
1095
+ });
930
1096
  }
931
1097
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputRadioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
932
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputRadioComponent, isStandalone: true, selector: "spx-input-radio", inputs: { spxName: "spxName", spxValidators: "spxValidators", spxFocused: "spxFocused", spxReadonly: "spxReadonly", spxSuggestions: "spxSuggestions", value: "value" }, outputs: { spxChange: "spxChange", spxFocus: "spxFocus" }, ngImport: i0, template: `<div class="spx-input-radio__suggestions">
933
- <spx-suggestion
934
- *ngFor="let valuePair of this.spxSuggestions"
935
- [spxDisabled]="this.spxReadonly"
936
- [spxSelected]="this.value?.value === this.valuePair?.value"
937
- (click)="this.spxReadonly ? undefined : this.handleSuggestionClick(valuePair)">
938
- {{this.valuePair?.description}}
939
- </spx-suggestion>
940
- </div>`, isInline: true, styles: [":host{display:block}.spx-input-radio__suggestions{display:grid;grid-gap:8px;grid-template-columns:repeat(2,1fr);margin-top:8px}.spx-input-radio--readonly{background-color:transparent;border:0;box-sizing:border-box;font-size:20px;font-weight:700;margin-right:10px;padding:0;width:100%}\n"], dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SpxSuggestionComponent, selector: "spx-suggestion", inputs: ["spxDisabled", "spxSelected"] }] }); }
1098
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputRadioComponent, isStandalone: true, selector: "spx-input-radio", inputs: { spxName: "spxName", spxValidators: "spxValidators", spxFocused: "spxFocused", spxShowLabel: "spxShowLabel", spxReadonly: "spxReadonly", spxSuggestions: "spxSuggestions", value: "value" }, outputs: { spxChange: "spxChange", spxFocus: "spxFocus" }, usesOnChanges: true, ngImport: i0, template: `<div class="grid grid-cols-2 gap-2" [class.mt-3]="this.spxShowLabel">
1099
+ <spx-suggestion
1100
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
1101
+ [spxDisabled]="this.spxReadonly"
1102
+ [spxFocused]="this.spxFocused && i === this.focusPosition"
1103
+ [spxSelected]="this.value?.value === this.valuePair?.value"
1104
+ [spxTabbable]="this.focusPosition === i"
1105
+ (pointerdown)="this.handleSuggestionClick(valuePair)">
1106
+ {{this.valuePair?.description}}
1107
+ </spx-suggestion>
1108
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SpxSuggestionComponent, selector: "spx-suggestion", inputs: ["spxDisabled", "spxFocused", "spxSelected", "spxTabbable"] }] }); }
941
1109
  }
942
1110
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputRadioComponent, decorators: [{
943
1111
  type: Component,
944
- args: [{ selector: 'spx-input-radio', standalone: true, imports: [
1112
+ args: [{
1113
+ selector: 'spx-input-radio',
1114
+ standalone: true,
1115
+ imports: [
945
1116
  NgFor,
946
1117
  SpxSuggestionComponent,
947
- ], template: `<div class="spx-input-radio__suggestions">
948
- <spx-suggestion
949
- *ngFor="let valuePair of this.spxSuggestions"
950
- [spxDisabled]="this.spxReadonly"
951
- [spxSelected]="this.value?.value === this.valuePair?.value"
952
- (click)="this.spxReadonly ? undefined : this.handleSuggestionClick(valuePair)">
953
- {{this.valuePair?.description}}
954
- </spx-suggestion>
955
- </div>`, styles: [":host{display:block}.spx-input-radio__suggestions{display:grid;grid-gap:8px;grid-template-columns:repeat(2,1fr);margin-top:8px}.spx-input-radio--readonly{background-color:transparent;border:0;box-sizing:border-box;font-size:20px;font-weight:700;margin-right:10px;padding:0;width:100%}\n"] }]
1118
+ ],
1119
+ template: `<div class="grid grid-cols-2 gap-2" [class.mt-3]="this.spxShowLabel">
1120
+ <spx-suggestion
1121
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
1122
+ [spxDisabled]="this.spxReadonly"
1123
+ [spxFocused]="this.spxFocused && i === this.focusPosition"
1124
+ [spxSelected]="this.value?.value === this.valuePair?.value"
1125
+ [spxTabbable]="this.focusPosition === i"
1126
+ (pointerdown)="this.handleSuggestionClick(valuePair)">
1127
+ {{this.valuePair?.description}}
1128
+ </spx-suggestion>
1129
+ </div>`,
1130
+ }]
956
1131
  }], propDecorators: { spxName: [{
957
1132
  type: Input
958
1133
  }], spxValidators: [{
959
1134
  type: Input
960
1135
  }], spxFocused: [{
961
1136
  type: Input
1137
+ }], spxShowLabel: [{
1138
+ type: Input
962
1139
  }], spxReadonly: [{
963
1140
  type: Input
964
1141
  }], spxSuggestions: [{
@@ -982,6 +1159,7 @@ var SpxInputTypeEnum;
982
1159
  SpxInputTypeEnum["number"] = "number";
983
1160
  SpxInputTypeEnum["password"] = "password";
984
1161
  SpxInputTypeEnum["text"] = "text";
1162
+ SpxInputTypeEnum["textNumericKeyboard"] = "textNumericKeyboard";
985
1163
  })(SpxInputTypeEnum || (SpxInputTypeEnum = {}));
986
1164
 
987
1165
  class SpxInputComponent {
@@ -994,6 +1172,7 @@ class SpxInputComponent {
994
1172
  this.spxSelectDay = true;
995
1173
  this.spxShowEdit = false;
996
1174
  this.spxShowHelp = false;
1175
+ this.spxShowLabel = true;
997
1176
  this.spxCompact = false;
998
1177
  this.spxShowClear = true;
999
1178
  this.spxShowSearch = false;
@@ -1012,9 +1191,6 @@ class SpxInputComponent {
1012
1191
  this.onChange = () => { };
1013
1192
  this.onTouched = () => { };
1014
1193
  }
1015
- spxSetFocus() {
1016
- this.passFocusToControl();
1017
- }
1018
1194
  handleBlur() {
1019
1195
  this.spxBlur.emit();
1020
1196
  }
@@ -1035,17 +1211,19 @@ class SpxInputComponent {
1035
1211
  handleFocus() {
1036
1212
  this.spxFocus.emit();
1037
1213
  this.spxFocused = true;
1038
- // this.elBox.spxSetFocus();
1039
1214
  }
1040
1215
  handleSearch() {
1041
1216
  this.spxSearch.emit();
1042
1217
  }
1043
- setFocus() {
1218
+ setFocusIn() {
1044
1219
  this.spxFocused = true;
1045
1220
  this.passFocusToControl();
1046
1221
  }
1047
1222
  setFocusOut() {
1048
1223
  this.spxFocused = false;
1224
+ if (this.spxType === SpxInputTypeEnum.radio) {
1225
+ this.radioInput?.spxFocusOut();
1226
+ }
1049
1227
  }
1050
1228
  handleEdit() {
1051
1229
  this.spxEdit.emit();
@@ -1056,9 +1234,22 @@ class SpxInputComponent {
1056
1234
  this.spxFocused = true;
1057
1235
  }
1058
1236
  passFocusToControl() {
1237
+ switch (this.spxType) {
1238
+ case SpxInputTypeEnum.autocomplete:
1239
+ case SpxInputTypeEnum.text:
1240
+ case SpxInputTypeEnum.overlayNumber:
1241
+ this.textInput?.spxSetFocus();
1242
+ break;
1243
+ case SpxInputTypeEnum.number:
1244
+ this.numberInput?.spxSetFocus();
1245
+ break;
1246
+ case SpxInputTypeEnum.radio:
1247
+ this.radioInput?.spxFocusIn();
1248
+ break;
1249
+ }
1059
1250
  }
1060
1251
  writeValue(value) {
1061
- this.value = this.lastValue = value == null ? '' : value;
1252
+ this.value = this.lastValue = value;
1062
1253
  }
1063
1254
  handleChangeEvent(value) {
1064
1255
  if (value !== this.lastValue) {
@@ -1076,13 +1267,14 @@ class SpxInputComponent {
1076
1267
  this.onTouched = fn;
1077
1268
  }
1078
1269
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1079
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputComponent, isStandalone: true, selector: "spx-input", inputs: { spxLabel: "spxLabel", spxMax: "spxMax", spxMin: "spxMin", spxName: "spxName", spxReadonly: "spxReadonly", spxAutofocus: "spxAutofocus", spxInputMode: "spxInputMode", spxPattern: "spxPattern", spxRequired: "spxRequired", spxSelectMonth: "spxSelectMonth", spxSelectDay: "spxSelectDay", spxShowEdit: "spxShowEdit", spxShowHelp: "spxShowHelp", spxCompact: "spxCompact", spxShowClear: "spxShowClear", spxShowSearch: "spxShowSearch", spxShowValidationMessages: "spxShowValidationMessages", spxStep: "spxStep", spxSuggestions: "spxSuggestions", spxType: "spxType", spxValidators: "spxValidators", value: "value", spxCapitalize: "spxCapitalize", spxFocused: "spxFocused" }, outputs: { spxBlur: "spxBlur", spxClear: "spxClear", spxChange: "spxChange", spxFocus: "spxFocus", spxEdit: "spxEdit", spxHelp: "spxHelp", spxSearch: "spxSearch" }, host: { listeners: { "spxChange": "handleChangeEvent($event)", "focusout": "_handleBlurEvent()" } }, providers: [
1270
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputComponent, isStandalone: true, selector: "spx-input", inputs: { spxLabel: "spxLabel", spxMax: "spxMax", spxMin: "spxMin", spxName: "spxName", spxReadonly: "spxReadonly", spxAutofocus: "spxAutofocus", spxInputMode: "spxInputMode", spxPattern: "spxPattern", spxRequired: "spxRequired", spxSelectMonth: "spxSelectMonth", spxSelectDay: "spxSelectDay", spxShowEdit: "spxShowEdit", spxShowHelp: "spxShowHelp", spxShowLabel: "spxShowLabel", spxCompact: "spxCompact", spxShowClear: "spxShowClear", spxShowSearch: "spxShowSearch", spxShowValidationMessages: "spxShowValidationMessages", spxStep: "spxStep", spxSuggestions: "spxSuggestions", spxType: "spxType", spxValidators: "spxValidators", value: "value", spxCapitalize: "spxCapitalize", spxFocused: "spxFocused" }, outputs: { spxBlur: "spxBlur", spxClear: "spxClear", spxChange: "spxChange", spxFocus: "spxFocus", spxEdit: "spxEdit", spxHelp: "spxHelp", spxSearch: "spxSearch" }, host: { listeners: { "spxChange": "handleChangeEvent($event)", "focusout": "_handleBlurEvent()" } }, providers: [
1080
1271
  {
1081
1272
  provide: NG_VALUE_ACCESSOR,
1082
1273
  useExisting: SpxInputComponent,
1083
1274
  multi: true
1084
1275
  }
1085
- ], ngImport: i0, template: `<spx-input-box
1276
+ ], viewQueries: [{ propertyName: "floatInput", first: true, predicate: SpxInputFloatComponent, descendants: true }, { propertyName: "numberInput", first: true, predicate: SpxInputNumberComponent, descendants: true }, { propertyName: "textInput", first: true, predicate: SpxInputTextComponent, descendants: true }, { propertyName: "radioInput", first: true, predicate: SpxInputRadioComponent, descendants: true }], ngImport: i0, template: `<spx-input-box
1277
+ [spxFocused]="this.spxFocused"
1086
1278
  [spxLabel]="this.spxLabel"
1087
1279
  [spxReadonly]="this.spxReadonly"
1088
1280
  [spxRequired]="this.spxRequired"
@@ -1091,12 +1283,13 @@ class SpxInputComponent {
1091
1283
  [spxCompact]="this.spxCompact"
1092
1284
  [spxShowClear]="this.spxShowClear"
1093
1285
  [spxShowEdit]="this.spxShowEdit"
1286
+ [spxShowLabel]="this.spxShowLabel"
1094
1287
  [spxShowSearch]="this.spxShowSearch ? this.spxShowSearch : this.spxType === 'autocomplete'"
1095
1288
  [spxShowValidationMessages]="this.spxShowValidationMessages"
1096
1289
  (spxClear)="this.handleClear()"
1097
1290
  (spxEdit)="this.handleEdit()"
1098
1291
  (spxHelp)="this.handleHelp()"
1099
- (spxFocus)="this.setFocus()"
1292
+ (spxFocus)="this.setFocusIn()"
1100
1293
  (spxFocusOut)="this.setFocusOut()"
1101
1294
  (spxSearch)="this.handleSearch()">
1102
1295
  <div controls>
@@ -1157,12 +1350,14 @@ class SpxInputComponent {
1157
1350
  [value]="this.value"
1158
1351
  ></spx-input-number>
1159
1352
  <spx-input-radio
1353
+ #radioInput
1160
1354
  *ngIf="this.spxType === 'radio'"
1161
1355
  (spxChange)="this.handleChange($event)"
1162
1356
  (spxFocus)="this.handleFocus()"
1163
1357
  [spxFocused]="this.spxFocused"
1164
1358
  [spxName]="this.spxName"
1165
1359
  [spxReadonly]="this.spxReadonly"
1360
+ [spxShowLabel]="this.spxShowLabel"
1166
1361
  [spxSuggestions]="this.spxSuggestions"
1167
1362
  [spxValidators]="this.spxValidators"
1168
1363
  [value]="this.value"
@@ -1171,7 +1366,7 @@ class SpxInputComponent {
1171
1366
  <div validation-messages>
1172
1367
  <ng-content></ng-content>
1173
1368
  </div>
1174
- </spx-input-box>`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SpxInputBoxComponent, selector: "spx-input-box", inputs: ["spxLabel", "spxRequired", "spxReadonly", "spxShowHelp", "spxCompact", "spxShowClear", "spxShowEdit", "spxShowSearch", "spxShowValidationMessages", "spxValue", "spxFocused"], outputs: ["spxClear", "spxSearch", "spxFocus", "spxFocusOut", "spxEdit", "spxHelp"] }, { kind: "component", type: SpxInputDateComponent, selector: "spx-input-date", inputs: ["spxMax", "spxMin", "spxName", "spxReadonly", "spxValidators", "spxFocused", "spxSelectMonth", "spxSelectDay", "value", "spxLastKeyPressed", "spxSelectStep", "spxInternalValue", "spxSuggestions", "spxWasInternalUpdate"], outputs: ["spxChange", "spxFocus"] }, { kind: "component", type: SpxInputFloatComponent, selector: "spx-input-float", inputs: ["spxName", "spxAutofocus", "spxReadonly", "spxValidators", "spxFocused", "spxStep", "value", "spxWasInternalUpdate", "tick"], outputs: ["spxChange", "spxFocus"] }, { kind: "component", type: SpxInputNumberComponent, selector: "spx-input-number", inputs: ["spxName", "spxAutofocus", "spxInputMode", "spxReadonly", "spxValidators", "spxFocused", "spxStep", "value"], outputs: ["spxChange", "spxFocus"] }, { kind: "component", type: SpxInputRadioComponent, selector: "spx-input-radio", inputs: ["spxName", "spxValidators", "spxFocused", "spxReadonly", "spxSuggestions", "value"], outputs: ["spxChange", "spxFocus"] }, { kind: "component", type: SpxInputTextComponent, selector: "spx-input-text", inputs: ["spxName", "spxAutofocus", "spxInputMode", "spxPattern", "spxSuggestions", "spxReadonly", "spxValidators", "spxCapitalize", "spxFocused", "spxType", "value", "spxWasInternalUpdate"], outputs: ["spxBlurFromChild", "spxChange", "spxFocus"] }] }); }
1369
+ </spx-input-box>`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SpxInputBoxComponent, selector: "spx-input-box", inputs: ["spxCompact", "spxFocused", "spxLabel", "spxReadonly", "spxRequired", "spxShowClear", "spxShowEdit", "spxShowHelp", "spxShowLabel", "spxShowSearch", "spxShowValidationMessages", "spxValue"], outputs: ["spxClear", "spxSearch", "spxFocus", "spxFocusOut", "spxEdit", "spxHelp"] }, { kind: "component", type: SpxInputDateComponent, selector: "spx-input-date", inputs: ["spxMax", "spxMin", "spxName", "spxReadonly", "spxValidators", "spxFocused", "spxSelectMonth", "spxSelectDay", "value", "spxLastKeyPressed", "spxSelectStep", "spxInternalValue", "spxSuggestions", "spxWasInternalUpdate"], outputs: ["spxChange", "spxFocus"] }, { kind: "component", type: SpxInputFloatComponent, selector: "spx-input-float", inputs: ["spxName", "spxAutofocus", "spxReadonly", "spxValidators", "spxFocused", "spxStep", "value", "spxWasInternalUpdate", "tick"], outputs: ["spxChange", "spxFocus"] }, { kind: "component", type: SpxInputNumberComponent, selector: "spx-input-number", inputs: ["spxName", "spxAutofocus", "spxInputMode", "spxReadonly", "spxValidators", "spxFocused", "spxStep", "value"], outputs: ["spxChange", "spxFocus"] }, { kind: "component", type: SpxInputRadioComponent, selector: "spx-input-radio", inputs: ["spxName", "spxValidators", "spxFocused", "spxShowLabel", "spxReadonly", "spxSuggestions", "value"], outputs: ["spxChange", "spxFocus"] }, { kind: "component", type: SpxInputTextComponent, selector: "spx-input-text", inputs: ["spxName", "spxAutofocus", "spxInputMode", "spxPattern", "spxSuggestions", "spxReadonly", "spxValidators", "spxCapitalize", "spxFocused", "spxType", "value", "spxWasInternalUpdate"], outputs: ["spxBlurFromChild", "spxChange", "spxFocus"] }] }); }
1175
1370
  }
1176
1371
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputComponent, decorators: [{
1177
1372
  type: Component,
@@ -1198,6 +1393,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1198
1393
  }
1199
1394
  ],
1200
1395
  template: `<spx-input-box
1396
+ [spxFocused]="this.spxFocused"
1201
1397
  [spxLabel]="this.spxLabel"
1202
1398
  [spxReadonly]="this.spxReadonly"
1203
1399
  [spxRequired]="this.spxRequired"
@@ -1206,12 +1402,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1206
1402
  [spxCompact]="this.spxCompact"
1207
1403
  [spxShowClear]="this.spxShowClear"
1208
1404
  [spxShowEdit]="this.spxShowEdit"
1405
+ [spxShowLabel]="this.spxShowLabel"
1209
1406
  [spxShowSearch]="this.spxShowSearch ? this.spxShowSearch : this.spxType === 'autocomplete'"
1210
1407
  [spxShowValidationMessages]="this.spxShowValidationMessages"
1211
1408
  (spxClear)="this.handleClear()"
1212
1409
  (spxEdit)="this.handleEdit()"
1213
1410
  (spxHelp)="this.handleHelp()"
1214
- (spxFocus)="this.setFocus()"
1411
+ (spxFocus)="this.setFocusIn()"
1215
1412
  (spxFocusOut)="this.setFocusOut()"
1216
1413
  (spxSearch)="this.handleSearch()">
1217
1414
  <div controls>
@@ -1272,12 +1469,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1272
1469
  [value]="this.value"
1273
1470
  ></spx-input-number>
1274
1471
  <spx-input-radio
1472
+ #radioInput
1275
1473
  *ngIf="this.spxType === 'radio'"
1276
1474
  (spxChange)="this.handleChange($event)"
1277
1475
  (spxFocus)="this.handleFocus()"
1278
1476
  [spxFocused]="this.spxFocused"
1279
1477
  [spxName]="this.spxName"
1280
1478
  [spxReadonly]="this.spxReadonly"
1479
+ [spxShowLabel]="this.spxShowLabel"
1281
1480
  [spxSuggestions]="this.spxSuggestions"
1282
1481
  [spxValidators]="this.spxValidators"
1283
1482
  [value]="this.value"
@@ -1314,6 +1513,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1314
1513
  type: Input
1315
1514
  }], spxShowHelp: [{
1316
1515
  type: Input
1516
+ }], spxShowLabel: [{
1517
+ type: Input
1317
1518
  }], spxCompact: [{
1318
1519
  type: Input
1319
1520
  }], spxShowClear: [{
@@ -1348,6 +1549,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1348
1549
  type: Output
1349
1550
  }], spxSearch: [{
1350
1551
  type: Output
1552
+ }], floatInput: [{
1553
+ type: ViewChild,
1554
+ args: [SpxInputFloatComponent]
1555
+ }], numberInput: [{
1556
+ type: ViewChild,
1557
+ args: [SpxInputNumberComponent]
1558
+ }], textInput: [{
1559
+ type: ViewChild,
1560
+ args: [SpxInputTextComponent]
1561
+ }], radioInput: [{
1562
+ type: ViewChild,
1563
+ args: [SpxInputRadioComponent]
1351
1564
  }], spxFocused: [{
1352
1565
  type: Input
1353
1566
  }], _handleBlurEvent: [{