@softpak/components 0.0.0-beta.16 → 0.0.0-beta.160

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 (89) hide show
  1. package/esm2022/spx-alert/spx-alert.component.mjs +5 -2
  2. package/esm2022/spx-button/spx-button.component.mjs +12 -3
  3. package/esm2022/spx-change-details/public-api.mjs +2 -0
  4. package/esm2022/spx-change-details/softpak-components-spx-change-details.mjs +5 -0
  5. package/esm2022/spx-change-details/spx-change-details-value.interface.mjs +2 -0
  6. package/esm2022/spx-change-details/spx-change-details.component.mjs +126 -0
  7. package/esm2022/spx-channel-selection/src/spx-channel-selection.component.mjs +1 -1
  8. package/esm2022/spx-channel-selection/src/spx-company-selection.component.mjs +2 -2
  9. package/esm2022/spx-check-digit/spx-check-digit.component.mjs +12 -4
  10. package/esm2022/spx-form-section/spx-form-section.component.mjs +9 -9
  11. package/esm2022/spx-form-view/public-api.mjs +4 -0
  12. package/esm2022/spx-form-view/softpak-components-spx-form-view.mjs +5 -0
  13. package/esm2022/spx-form-view/spx-autocomplete-search.component.mjs +99 -0
  14. package/esm2022/spx-form-view/spx-form-field.interface.mjs +2 -0
  15. package/esm2022/spx-form-view/spx-form-section.interface.mjs +2 -0
  16. package/esm2022/spx-form-view/spx-form-view.component.mjs +196 -0
  17. package/esm2022/spx-inputs/spx-dropdown.component.mjs +94 -0
  18. package/esm2022/spx-inputs/spx-input-box.component.mjs +74 -47
  19. package/esm2022/spx-inputs/spx-input-date.component.mjs +1 -1
  20. package/esm2022/spx-inputs/spx-input-float.component.mjs +10 -5
  21. package/esm2022/spx-inputs/spx-input-number.component.mjs +10 -5
  22. package/esm2022/spx-inputs/spx-input-radio.component.mjs +93 -27
  23. package/esm2022/spx-inputs/spx-input-text.component.mjs +21 -32
  24. package/esm2022/spx-inputs/spx-input-type.enum.mjs +2 -1
  25. package/esm2022/spx-inputs/spx-input.component.mjs +48 -13
  26. package/esm2022/spx-navigation/spx-home-tile.component.mjs +29 -10
  27. package/esm2022/spx-navigation/spx-navigation-item.interface.mjs +1 -1
  28. package/esm2022/spx-navigation/spx-navigation.component.mjs +11 -5
  29. package/esm2022/spx-number-check/public-api.mjs +2 -0
  30. package/esm2022/spx-number-check/softpak-components-spx-number-check.mjs +5 -0
  31. package/esm2022/spx-number-check/spx-number-check.component.mjs +259 -0
  32. package/esm2022/spx-spinner/spx-spinner.component.mjs +5 -5
  33. package/esm2022/spx-suggestion/spx-suggestion.component.mjs +28 -10
  34. package/esm2022/spx-update/src/spx-update-info.component.mjs +1 -1
  35. package/fesm2022/softpak-components-spx-alert.mjs +4 -1
  36. package/fesm2022/softpak-components-spx-alert.mjs.map +1 -1
  37. package/fesm2022/softpak-components-spx-button.mjs +11 -2
  38. package/fesm2022/softpak-components-spx-button.mjs.map +1 -1
  39. package/fesm2022/softpak-components-spx-change-details.mjs +133 -0
  40. package/fesm2022/softpak-components-spx-change-details.mjs.map +1 -0
  41. package/fesm2022/softpak-components-spx-channel-selection.mjs +2 -2
  42. package/fesm2022/softpak-components-spx-channel-selection.mjs.map +1 -1
  43. package/fesm2022/softpak-components-spx-check-digit.mjs +11 -3
  44. package/fesm2022/softpak-components-spx-check-digit.mjs.map +1 -1
  45. package/fesm2022/softpak-components-spx-form-section.mjs +8 -8
  46. package/fesm2022/softpak-components-spx-form-section.mjs.map +1 -1
  47. package/fesm2022/softpak-components-spx-form-view.mjs +295 -0
  48. package/fesm2022/softpak-components-spx-form-view.mjs.map +1 -0
  49. package/fesm2022/softpak-components-spx-inputs.mjs +335 -119
  50. package/fesm2022/softpak-components-spx-inputs.mjs.map +1 -1
  51. package/fesm2022/softpak-components-spx-navigation.mjs +37 -12
  52. package/fesm2022/softpak-components-spx-navigation.mjs.map +1 -1
  53. package/fesm2022/softpak-components-spx-number-check.mjs +266 -0
  54. package/fesm2022/softpak-components-spx-number-check.mjs.map +1 -0
  55. package/fesm2022/softpak-components-spx-spinner.mjs +4 -4
  56. package/fesm2022/softpak-components-spx-spinner.mjs.map +1 -1
  57. package/fesm2022/softpak-components-spx-suggestion.mjs +27 -9
  58. package/fesm2022/softpak-components-spx-suggestion.mjs.map +1 -1
  59. package/fesm2022/softpak-components-spx-update.mjs +1 -1
  60. package/fesm2022/softpak-components-spx-update.mjs.map +1 -1
  61. package/package.json +34 -16
  62. package/spx-button/spx-button.component.d.ts +3 -1
  63. package/spx-change-details/index.d.ts +5 -0
  64. package/spx-change-details/public-api.d.ts +1 -0
  65. package/spx-change-details/spx-change-details-value.interface.d.ts +7 -0
  66. package/spx-change-details/spx-change-details.component.d.ts +42 -0
  67. package/spx-check-digit/spx-check-digit.component.d.ts +3 -1
  68. package/spx-form-view/index.d.ts +5 -0
  69. package/spx-form-view/public-api.d.ts +3 -0
  70. package/spx-form-view/spx-autocomplete-search.component.d.ts +36 -0
  71. package/spx-form-view/spx-form-field.interface.d.ts +16 -0
  72. package/spx-form-view/spx-form-section.interface.d.ts +9 -0
  73. package/spx-form-view/spx-form-view.component.d.ts +32 -0
  74. package/spx-inputs/spx-dropdown.component.d.ts +18 -0
  75. package/spx-inputs/spx-input-box.component.d.ts +14 -7
  76. package/spx-inputs/spx-input-float.component.d.ts +3 -2
  77. package/spx-inputs/spx-input-number.component.d.ts +3 -2
  78. package/spx-inputs/spx-input-radio.component.d.ts +13 -5
  79. package/spx-inputs/spx-input-text.component.d.ts +3 -2
  80. package/spx-inputs/spx-input-type.enum.d.ts +2 -1
  81. package/spx-inputs/spx-input.component.d.ts +11 -3
  82. package/spx-navigation/spx-home-tile.component.d.ts +5 -1
  83. package/spx-navigation/spx-navigation-item.interface.d.ts +1 -0
  84. package/spx-navigation/spx-navigation.component.d.ts +4 -1
  85. package/spx-number-check/index.d.ts +5 -0
  86. package/spx-number-check/public-api.d.ts +1 -0
  87. package/spx-number-check/spx-number-check.component.d.ts +48 -0
  88. package/spx-suggestion/spx-suggestion.component.d.ts +3 -1
  89. package/tailwind.css +1 -1
@@ -1,63 +1,79 @@
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';
7
- import { faEdit, faSearch, faQuestion, faTimes } from '@fortawesome/free-solid-svg-icons';
7
+ import { faEdit } from '@fortawesome/free-solid-svg-icons/faEdit';
8
+ import { faQuestion } from '@fortawesome/free-solid-svg-icons/faQuestion';
9
+ import { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';
10
+ import { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';
11
+ import { fromEvent } from 'rxjs';
8
12
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
9
13
  import { SpxSuggestionComponent } from '@softpak/components/spx-suggestion';
10
14
  import { DateTime } from 'luxon';
15
+ import { valuePairToValue } from '@softpak/components/spx-helpers';
11
16
 
12
17
  class SpxInputBoxComponent {
13
- 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;
14
50
  this.faEdit = faEdit;
15
51
  this.faSearch = faSearch;
16
52
  this.faQuestion = faQuestion;
17
53
  this.faTimes = faTimes;
54
+ this.spxFocused = false;
18
55
  this.spxReadonly = false;
19
56
  this.spxShowClear = true;
57
+ this.spxShowLabel = true;
20
58
  this.spxClear = new EventEmitter();
21
59
  this.spxSearch = new EventEmitter();
22
60
  this.spxFocus = new EventEmitter();
23
61
  this.spxFocusOut = new EventEmitter();
24
62
  this.spxEdit = new EventEmitter();
25
63
  this.spxHelp = new EventEmitter();
26
- this.spxFocused = false;
27
- }
28
- // @Listen('focusout', { capture: true })
29
- // handleFocusOut() {
30
- // this.spxFocused = false;
31
- // this.spxFocusOut.emit();
32
- // }
33
- // @Listen('click', { target: 'window' })
34
- // handleWindowClick(ev) {
35
- // if (ev.composedPath().includes(this.el)) {
36
- // if (!this.spxFocused) {
37
- // this.spxFocused = true;
38
- // this.spxFocus.emit();
39
- // }
40
- // } else {
41
- // this.spxFocused = false;
42
- // }
43
- // }
44
- async spxSetFocus() {
45
- this.spxFocused = true;
46
- }
47
- onClear() {
48
- this.spxClear.emit();
49
- }
50
- onSearch() {
51
- this.spxSearch.emit();
52
64
  }
53
- onEdit() {
54
- this.spxEdit.emit();
65
+ emitFocusIn() {
66
+ if (!this.spxFocused) {
67
+ this.spxFocus.emit();
68
+ }
55
69
  }
56
- onHelp() {
57
- this.spxHelp.emit();
70
+ emitFocusOut() {
71
+ if (this.spxFocused) {
72
+ this.spxFocusOut.emit();
73
+ }
58
74
  }
59
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
60
- 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"
61
77
  [class.rounded-none]="this.spxShowValidationMessages"
62
78
  [class.rounded-t]="this.spxShowValidationMessages"
63
79
  [class.outline-none]="this.spxFocused && !this.spxReadonly"
@@ -71,7 +87,7 @@ class SpxInputBoxComponent {
71
87
  [class.p-0]="this.spxCompact"
72
88
  [class.flex]="this.spxCompact"
73
89
  [class.items-center]="this.spxCompact">
74
- <div class="text-sm mb-1 text-gray-800"
90
+ <div *ngIf="this.spxShowLabel" class="font-bold text-sm mb-1 text-gray-800"
75
91
  [class.mb-0]="this.spxCompact"
76
92
  [class.px-3]="this.spxCompact">
77
93
  {{this.spxLabel}} <span *ngIf="spxRequired" class="text-red-800">*</span>
@@ -84,7 +100,6 @@ class SpxInputBoxComponent {
84
100
  (spxClick)="onEdit()"
85
101
  [spxFullHeight]="true"
86
102
  [spxSize]="'xl'"
87
- [spxTabIndex]="-1"
88
103
  [spxType]="'button'">
89
104
  <fa-icon [icon]="faEdit" class="block text-xl"></fa-icon>
90
105
  </spx-button>
@@ -92,6 +107,7 @@ class SpxInputBoxComponent {
92
107
  *ngIf="this.spxShowHelp"
93
108
  (spxClick)="onHelp()"
94
109
  [spxFullHeight]="true"
110
+ [spxDisabled]="this.spxReadonly"
95
111
  [spxSize]="'xl'"
96
112
  [spxTabIndex]="-1"
97
113
  [spxType]="'button'">
@@ -101,6 +117,7 @@ class SpxInputBoxComponent {
101
117
  *ngIf="this.spxShowSearch"
102
118
  (spxClick)="onSearch()"
103
119
  [spxFullHeight]="true"
120
+ [spxDisabled]="this.spxReadonly"
104
121
  [spxSize]="'xl'"
105
122
  [spxTabIndex]="-1"
106
123
  [spxType]="'button'">
@@ -146,7 +163,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
146
163
  [class.p-0]="this.spxCompact"
147
164
  [class.flex]="this.spxCompact"
148
165
  [class.items-center]="this.spxCompact">
149
- <div class="text-sm mb-1 text-gray-800"
166
+ <div *ngIf="this.spxShowLabel" class="font-bold text-sm mb-1 text-gray-800"
150
167
  [class.mb-0]="this.spxCompact"
151
168
  [class.px-3]="this.spxCompact">
152
169
  {{this.spxLabel}} <span *ngIf="spxRequired" class="text-red-800">*</span>
@@ -159,7 +176,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
159
176
  (spxClick)="onEdit()"
160
177
  [spxFullHeight]="true"
161
178
  [spxSize]="'xl'"
162
- [spxTabIndex]="-1"
163
179
  [spxType]="'button'">
164
180
  <fa-icon [icon]="faEdit" class="block text-xl"></fa-icon>
165
181
  </spx-button>
@@ -167,6 +183,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
167
183
  *ngIf="this.spxShowHelp"
168
184
  (spxClick)="onHelp()"
169
185
  [spxFullHeight]="true"
186
+ [spxDisabled]="this.spxReadonly"
170
187
  [spxSize]="'xl'"
171
188
  [spxTabIndex]="-1"
172
189
  [spxType]="'button'">
@@ -176,6 +193,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
176
193
  *ngIf="this.spxShowSearch"
177
194
  (spxClick)="onSearch()"
178
195
  [spxFullHeight]="true"
196
+ [spxDisabled]="this.spxReadonly"
179
197
  [spxSize]="'xl'"
180
198
  [spxTabIndex]="-1"
181
199
  [spxType]="'button'">
@@ -197,20 +215,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
197
215
  <ng-content select="[validation-messages]"></ng-content>
198
216
  </div>`,
199
217
  }]
200
- }], propDecorators: { spxLabel: [{
218
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { spxCompact: [{
201
219
  type: Input
202
- }], spxRequired: [{
220
+ }], spxFocused: [{
203
221
  type: Input
204
- }], spxReadonly: [{
222
+ }], spxLabel: [{
205
223
  type: Input
206
- }], spxShowHelp: [{
224
+ }], spxReadonly: [{
207
225
  type: Input
208
- }], spxCompact: [{
226
+ }], spxRequired: [{
209
227
  type: Input
210
228
  }], spxShowClear: [{
211
229
  type: Input
212
230
  }], spxShowEdit: [{
213
231
  type: Input
232
+ }], spxShowHelp: [{
233
+ type: Input
234
+ }], spxShowLabel: [{
235
+ type: Input
214
236
  }], spxShowSearch: [{
215
237
  type: Input
216
238
  }], spxShowValidationMessages: [{
@@ -229,8 +251,104 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
229
251
  type: Output
230
252
  }], spxHelp: [{
231
253
  type: Output
232
- }], 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: [{
233
349
  type: Input
350
+ }], spxSelect: [{
351
+ type: Output
234
352
  }] } });
235
353
 
236
354
  class SpxInputTextComponent {
@@ -246,8 +364,8 @@ class SpxInputTextComponent {
246
364
  this.spxFocus = new EventEmitter();
247
365
  this.spxWasInternalUpdate = false;
248
366
  }
249
- async spxSetFocus() {
250
- // this.elInput.focus();
367
+ spxSetFocus() {
368
+ this.inputRef?.nativeElement?.focus();
251
369
  }
252
370
  componentDidLoad() {
253
371
  if (this.spxAutofocus) {
@@ -279,8 +397,9 @@ class SpxInputTextComponent {
279
397
  this.spxFocused = true;
280
398
  }
281
399
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputTextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
282
- 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">
283
401
  <input
402
+ #input
284
403
  class="font-bold text-lg w-full outline-none"
285
404
  [class.bg-white]="!this.spxReadonly"
286
405
  [class.bg-gray-300]="this.spxReadonly"
@@ -292,27 +411,18 @@ class SpxInputTextComponent {
292
411
  [attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
293
412
  [attr.name]="this.spxName"
294
413
  [attr.type]="this.spxType"
295
- [attr.value]="this.value?.description ? this.value?.description : this.value?.value"
414
+ [value]="this.value?.description ? this.value?.description : this.value?.value"
296
415
  (blur)="this.handleBlur()"
297
416
  (keyUp)="this.handleKeyUp()"
298
417
  (focus)="this.handleFocus()"
299
418
  (input)="this.handleDescriptionInput($event)"
300
419
  />
301
420
  <span *ngIf="this.value?.description && this.value?.value && this.value?.description?.valueOf() !== this.value?.value?.valueOf()">{{this.value?.value}}</span>
302
- <div
421
+ <spx-dropdown
303
422
  *ngIf="this.spxFocused && (this.spxType === 'overlay' || this.spxType === 'overlaynumber')"
304
- class="absolute bg-gray-100 left-0 right-0 z-20">
305
- <div
306
- *ngFor="let valuePair of this.spxSuggestions"
307
- class="text-black block w-full p-2 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 flex items-center"
308
- (click)="this.handleSuggestionClick($event)"
309
- [attr.tabindex]="0"
310
- >
311
- <div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
312
- <spx-button spxType="button">Select</spx-button>
313
- </div>
314
- </div>
315
- </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"] }] }); }
316
426
  }
317
427
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputTextComponent, decorators: [{
318
428
  type: Component,
@@ -323,9 +433,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
323
433
  NgIf,
324
434
  NgFor,
325
435
  SpxButtonComponent,
436
+ SpxDropdownComponent,
326
437
  ],
327
438
  template: `<div class="relative text-black">
328
439
  <input
440
+ #input
329
441
  class="font-bold text-lg w-full outline-none"
330
442
  [class.bg-white]="!this.spxReadonly"
331
443
  [class.bg-gray-300]="this.spxReadonly"
@@ -337,26 +449,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
337
449
  [attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
338
450
  [attr.name]="this.spxName"
339
451
  [attr.type]="this.spxType"
340
- [attr.value]="this.value?.description ? this.value?.description : this.value?.value"
452
+ [value]="this.value?.description ? this.value?.description : this.value?.value"
341
453
  (blur)="this.handleBlur()"
342
454
  (keyUp)="this.handleKeyUp()"
343
455
  (focus)="this.handleFocus()"
344
456
  (input)="this.handleDescriptionInput($event)"
345
457
  />
346
458
  <span *ngIf="this.value?.description && this.value?.value && this.value?.description?.valueOf() !== this.value?.value?.valueOf()">{{this.value?.value}}</span>
347
- <div
459
+ <spx-dropdown
348
460
  *ngIf="this.spxFocused && (this.spxType === 'overlay' || this.spxType === 'overlaynumber')"
349
- class="absolute bg-gray-100 left-0 right-0 z-20">
350
- <div
351
- *ngFor="let valuePair of this.spxSuggestions"
352
- class="text-black block w-full p-2 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 flex items-center"
353
- (click)="this.handleSuggestionClick($event)"
354
- [attr.tabindex]="0"
355
- >
356
- <div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
357
- <spx-button spxType="button">Select</spx-button>
358
- </div>
359
- </div>
461
+ [spxSuggestions]="this.spxSuggestions" (spxSelect)="this.handleSuggestionClick($event)">
462
+ </spx-dropdown>
360
463
  </div>`,
361
464
  }]
362
465
  }], propDecorators: { spxName: [{
@@ -389,6 +492,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
389
492
  type: Output
390
493
  }], spxWasInternalUpdate: [{
391
494
  type: Input
495
+ }], inputRef: [{
496
+ type: ViewChild,
497
+ args: ['input', { static: true }]
392
498
  }] } });
393
499
 
394
500
  class SpxInputDateComponent {
@@ -593,7 +699,7 @@ class SpxInputDateComponent {
593
699
  <spx-suggestion
594
700
  *ngFor="let valuePair of spxSuggestions[spxSelectStep]"
595
701
  (click)="this.handleSuggestionClick(valuePair.value)">{{valuePair?.description}}</spx-suggestion>
596
- </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"] }] }); }
597
703
  }
598
704
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputDateComponent, decorators: [{
599
705
  type: Component,
@@ -695,8 +801,8 @@ class SpxInputFloatComponent {
695
801
  this.spxWasInternalUpdate = false;
696
802
  this.tick = {};
697
803
  }
698
- async spxSetFocus() {
699
- // this.elFirstInput.focus();
804
+ spxSetFocus() {
805
+ this.firstInputRef?.nativeElement?.focus();
700
806
  }
701
807
  // @Watch('value') onValueChanged(newValue: SpxValuePair<any>, _oldValue: SpxValuePair<any>) {
702
808
  // this.handleSetValue(newValue);
@@ -748,8 +854,9 @@ class SpxInputFloatComponent {
748
854
  return /^[+-]?\d+(\.\d+)?$/.test(value);
749
855
  }
750
856
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputFloatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
751
- 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">
752
858
  <input
859
+ #firstInputRef
753
860
  class="spx-input-float__input"
754
861
  [attr.autofocus]="this.spxAutofocus ? this.spxAutofocus : undefined"
755
862
  [attr.disabled]="this.spxReadonly ? this.spxReadonly : undefined"
@@ -782,6 +889,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
782
889
  SpxButtonComponent,
783
890
  ], template: `<div class="flex items-end">
784
891
  <input
892
+ #firstInputRef
785
893
  class="spx-input-float__input"
786
894
  [attr.autofocus]="this.spxAutofocus ? this.spxAutofocus : undefined"
787
895
  [attr.disabled]="this.spxReadonly ? this.spxReadonly : undefined"
@@ -827,6 +935,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
827
935
  type: Input
828
936
  }], tick: [{
829
937
  type: Input
938
+ }], firstInputRef: [{
939
+ type: ViewChild,
940
+ args: ['firstInputRef', { static: true }]
830
941
  }] } });
831
942
 
832
943
  class SpxInputNumberComponent {
@@ -838,8 +949,8 @@ class SpxInputNumberComponent {
838
949
  this.spxFocus = new EventEmitter();
839
950
  this.spxWasInternalUpdate = false;
840
951
  }
841
- async spxSetFocus() {
842
- // this.elInput.focus();
952
+ spxSetFocus() {
953
+ this.inputRef?.nativeElement?.focus();
843
954
  }
844
955
  componentDidLoad() {
845
956
  if (this.spxAutofocus) {
@@ -858,8 +969,9 @@ class SpxInputNumberComponent {
858
969
  this.spxChange.emit(this.value);
859
970
  }
860
971
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputNumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
861
- 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">
862
973
  <input
974
+ #input
863
975
  class="spx-input-number__input"
864
976
  [attr.autofocus]="this.spxAutofocus ? this.spxAutofocus : undefined"
865
977
  [class.spx-input-number--readonly]="this.spxReadonly ? this.spxReadonly : undefined"
@@ -876,6 +988,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
876
988
  type: Component,
877
989
  args: [{ selector: 'spx-input-number', standalone: true, imports: [], template: `<div class="spx-input-number__controls">
878
990
  <input
991
+ #input
879
992
  class="spx-input-number__input"
880
993
  [attr.autofocus]="this.spxAutofocus ? this.spxAutofocus : undefined"
881
994
  [class.spx-input-number--readonly]="this.spxReadonly ? this.spxReadonly : undefined"
@@ -907,55 +1020,122 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
907
1020
  type: Output
908
1021
  }], spxFocus: [{
909
1022
  type: Output
1023
+ }], inputRef: [{
1024
+ type: ViewChild,
1025
+ args: ['input', { static: true }]
910
1026
  }] } });
911
1027
 
912
1028
  class SpxInputRadioComponent {
913
1029
  constructor() {
914
- this.spxFocused = true;
1030
+ this.focusPosition = 0;
1031
+ this.spxFocused = false;
1032
+ this.spxShowLabel = true;
915
1033
  this.spxReadonly = false;
916
1034
  this.spxSuggestions = [];
917
1035
  this.spxChange = new EventEmitter();
918
1036
  this.spxFocus = new EventEmitter();
919
- this.spxWasInternalUpdate = false;
920
1037
  }
921
- async spxSetFocus() {
922
- // this.elYear.focus();
1038
+ spxFocusIn() {
1039
+ this.listenToKeys();
1040
+ this.determineFocusPosition();
923
1041
  }
924
- handleSuggestionClick(value) {
925
- this.value = value;
926
- 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
+ });
927
1096
  }
928
1097
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputRadioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
929
- 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">
930
- <spx-suggestion
931
- *ngFor="let valuePair of this.spxSuggestions"
932
- [spxDisabled]="this.spxReadonly"
933
- [spxSelected]="this.value?.value === this.valuePair?.value"
934
- (click)="this.spxReadonly ? undefined : this.handleSuggestionClick(valuePair)">
935
- {{this.valuePair?.description}}
936
- </spx-suggestion>
937
- </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"] }] }); }
938
1109
  }
939
1110
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputRadioComponent, decorators: [{
940
1111
  type: Component,
941
- args: [{ selector: 'spx-input-radio', standalone: true, imports: [
1112
+ args: [{
1113
+ selector: 'spx-input-radio',
1114
+ standalone: true,
1115
+ imports: [
942
1116
  NgFor,
943
1117
  SpxSuggestionComponent,
944
- ], template: `<div class="spx-input-radio__suggestions">
945
- <spx-suggestion
946
- *ngFor="let valuePair of this.spxSuggestions"
947
- [spxDisabled]="this.spxReadonly"
948
- [spxSelected]="this.value?.value === this.valuePair?.value"
949
- (click)="this.spxReadonly ? undefined : this.handleSuggestionClick(valuePair)">
950
- {{this.valuePair?.description}}
951
- </spx-suggestion>
952
- </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
+ }]
953
1131
  }], propDecorators: { spxName: [{
954
1132
  type: Input
955
1133
  }], spxValidators: [{
956
1134
  type: Input
957
1135
  }], spxFocused: [{
958
1136
  type: Input
1137
+ }], spxShowLabel: [{
1138
+ type: Input
959
1139
  }], spxReadonly: [{
960
1140
  type: Input
961
1141
  }], spxSuggestions: [{
@@ -979,6 +1159,7 @@ var SpxInputTypeEnum;
979
1159
  SpxInputTypeEnum["number"] = "number";
980
1160
  SpxInputTypeEnum["password"] = "password";
981
1161
  SpxInputTypeEnum["text"] = "text";
1162
+ SpxInputTypeEnum["textNumericKeyboard"] = "textNumericKeyboard";
982
1163
  })(SpxInputTypeEnum || (SpxInputTypeEnum = {}));
983
1164
 
984
1165
  class SpxInputComponent {
@@ -991,6 +1172,7 @@ class SpxInputComponent {
991
1172
  this.spxSelectDay = true;
992
1173
  this.spxShowEdit = false;
993
1174
  this.spxShowHelp = false;
1175
+ this.spxShowLabel = true;
994
1176
  this.spxCompact = false;
995
1177
  this.spxShowClear = true;
996
1178
  this.spxShowSearch = false;
@@ -1009,9 +1191,6 @@ class SpxInputComponent {
1009
1191
  this.onChange = () => { };
1010
1192
  this.onTouched = () => { };
1011
1193
  }
1012
- spxSetFocus() {
1013
- this.passFocusToControl();
1014
- }
1015
1194
  handleBlur() {
1016
1195
  this.spxBlur.emit();
1017
1196
  }
@@ -1032,17 +1211,19 @@ class SpxInputComponent {
1032
1211
  handleFocus() {
1033
1212
  this.spxFocus.emit();
1034
1213
  this.spxFocused = true;
1035
- // this.elBox.spxSetFocus();
1036
1214
  }
1037
1215
  handleSearch() {
1038
1216
  this.spxSearch.emit();
1039
1217
  }
1040
- setFocus() {
1218
+ setFocusIn() {
1041
1219
  this.spxFocused = true;
1042
1220
  this.passFocusToControl();
1043
1221
  }
1044
1222
  setFocusOut() {
1045
1223
  this.spxFocused = false;
1224
+ if (this.spxType === SpxInputTypeEnum.radio) {
1225
+ this.radioInput?.spxFocusOut();
1226
+ }
1046
1227
  }
1047
1228
  handleEdit() {
1048
1229
  this.spxEdit.emit();
@@ -1053,9 +1234,22 @@ class SpxInputComponent {
1053
1234
  this.spxFocused = true;
1054
1235
  }
1055
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
+ }
1056
1250
  }
1057
1251
  writeValue(value) {
1058
- this.value = this.lastValue = value == null ? '' : value;
1252
+ this.value = this.lastValue = value;
1059
1253
  }
1060
1254
  handleChangeEvent(value) {
1061
1255
  if (value !== this.lastValue) {
@@ -1073,13 +1267,14 @@ class SpxInputComponent {
1073
1267
  this.onTouched = fn;
1074
1268
  }
1075
1269
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1076
- 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: [
1077
1271
  {
1078
1272
  provide: NG_VALUE_ACCESSOR,
1079
1273
  useExisting: SpxInputComponent,
1080
1274
  multi: true
1081
1275
  }
1082
- ], 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"
1083
1278
  [spxLabel]="this.spxLabel"
1084
1279
  [spxReadonly]="this.spxReadonly"
1085
1280
  [spxRequired]="this.spxRequired"
@@ -1088,12 +1283,13 @@ class SpxInputComponent {
1088
1283
  [spxCompact]="this.spxCompact"
1089
1284
  [spxShowClear]="this.spxShowClear"
1090
1285
  [spxShowEdit]="this.spxShowEdit"
1286
+ [spxShowLabel]="this.spxShowLabel"
1091
1287
  [spxShowSearch]="this.spxShowSearch ? this.spxShowSearch : this.spxType === 'autocomplete'"
1092
1288
  [spxShowValidationMessages]="this.spxShowValidationMessages"
1093
1289
  (spxClear)="this.handleClear()"
1094
1290
  (spxEdit)="this.handleEdit()"
1095
1291
  (spxHelp)="this.handleHelp()"
1096
- (spxFocus)="this.setFocus()"
1292
+ (spxFocus)="this.setFocusIn()"
1097
1293
  (spxFocusOut)="this.setFocusOut()"
1098
1294
  (spxSearch)="this.handleSearch()">
1099
1295
  <div controls>
@@ -1154,12 +1350,14 @@ class SpxInputComponent {
1154
1350
  [value]="this.value"
1155
1351
  ></spx-input-number>
1156
1352
  <spx-input-radio
1353
+ #radioInput
1157
1354
  *ngIf="this.spxType === 'radio'"
1158
1355
  (spxChange)="this.handleChange($event)"
1159
1356
  (spxFocus)="this.handleFocus()"
1160
1357
  [spxFocused]="this.spxFocused"
1161
1358
  [spxName]="this.spxName"
1162
1359
  [spxReadonly]="this.spxReadonly"
1360
+ [spxShowLabel]="this.spxShowLabel"
1163
1361
  [spxSuggestions]="this.spxSuggestions"
1164
1362
  [spxValidators]="this.spxValidators"
1165
1363
  [value]="this.value"
@@ -1168,7 +1366,7 @@ class SpxInputComponent {
1168
1366
  <div validation-messages>
1169
1367
  <ng-content></ng-content>
1170
1368
  </div>
1171
- </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"] }] }); }
1172
1370
  }
1173
1371
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputComponent, decorators: [{
1174
1372
  type: Component,
@@ -1195,6 +1393,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1195
1393
  }
1196
1394
  ],
1197
1395
  template: `<spx-input-box
1396
+ [spxFocused]="this.spxFocused"
1198
1397
  [spxLabel]="this.spxLabel"
1199
1398
  [spxReadonly]="this.spxReadonly"
1200
1399
  [spxRequired]="this.spxRequired"
@@ -1203,12 +1402,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1203
1402
  [spxCompact]="this.spxCompact"
1204
1403
  [spxShowClear]="this.spxShowClear"
1205
1404
  [spxShowEdit]="this.spxShowEdit"
1405
+ [spxShowLabel]="this.spxShowLabel"
1206
1406
  [spxShowSearch]="this.spxShowSearch ? this.spxShowSearch : this.spxType === 'autocomplete'"
1207
1407
  [spxShowValidationMessages]="this.spxShowValidationMessages"
1208
1408
  (spxClear)="this.handleClear()"
1209
1409
  (spxEdit)="this.handleEdit()"
1210
1410
  (spxHelp)="this.handleHelp()"
1211
- (spxFocus)="this.setFocus()"
1411
+ (spxFocus)="this.setFocusIn()"
1212
1412
  (spxFocusOut)="this.setFocusOut()"
1213
1413
  (spxSearch)="this.handleSearch()">
1214
1414
  <div controls>
@@ -1269,12 +1469,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1269
1469
  [value]="this.value"
1270
1470
  ></spx-input-number>
1271
1471
  <spx-input-radio
1472
+ #radioInput
1272
1473
  *ngIf="this.spxType === 'radio'"
1273
1474
  (spxChange)="this.handleChange($event)"
1274
1475
  (spxFocus)="this.handleFocus()"
1275
1476
  [spxFocused]="this.spxFocused"
1276
1477
  [spxName]="this.spxName"
1277
1478
  [spxReadonly]="this.spxReadonly"
1479
+ [spxShowLabel]="this.spxShowLabel"
1278
1480
  [spxSuggestions]="this.spxSuggestions"
1279
1481
  [spxValidators]="this.spxValidators"
1280
1482
  [value]="this.value"
@@ -1311,6 +1513,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1311
1513
  type: Input
1312
1514
  }], spxShowHelp: [{
1313
1515
  type: Input
1516
+ }], spxShowLabel: [{
1517
+ type: Input
1314
1518
  }], spxCompact: [{
1315
1519
  type: Input
1316
1520
  }], spxShowClear: [{
@@ -1345,6 +1549,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1345
1549
  type: Output
1346
1550
  }], spxSearch: [{
1347
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]
1348
1564
  }], spxFocused: [{
1349
1565
  type: Input
1350
1566
  }], _handleBlurEvent: [{