@softpak/components 0.0.0-beta.15 → 0.0.0-beta.150

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 (87) 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 +118 -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 +13 -5
  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-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 +163 -0
  16. package/esm2022/spx-inputs/spx-dropdown.component.mjs +94 -0
  17. package/esm2022/spx-inputs/spx-input-box.component.mjs +74 -47
  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 +89 -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-alert.mjs +4 -1
  35. package/fesm2022/softpak-components-spx-alert.mjs.map +1 -1
  36. package/fesm2022/softpak-components-spx-button.mjs +11 -2
  37. package/fesm2022/softpak-components-spx-button.mjs.map +1 -1
  38. package/fesm2022/softpak-components-spx-change-details.mjs +125 -0
  39. package/fesm2022/softpak-components-spx-change-details.mjs.map +1 -0
  40. package/fesm2022/softpak-components-spx-channel-selection.mjs +2 -2
  41. package/fesm2022/softpak-components-spx-channel-selection.mjs.map +1 -1
  42. package/fesm2022/softpak-components-spx-check-digit.mjs +12 -4
  43. package/fesm2022/softpak-components-spx-check-digit.mjs.map +1 -1
  44. package/fesm2022/softpak-components-spx-form-section.mjs +8 -8
  45. package/fesm2022/softpak-components-spx-form-section.mjs.map +1 -1
  46. package/fesm2022/softpak-components-spx-form-view.mjs +170 -0
  47. package/fesm2022/softpak-components-spx-form-view.mjs.map +1 -0
  48. package/fesm2022/softpak-components-spx-inputs.mjs +331 -119
  49. package/fesm2022/softpak-components-spx-inputs.mjs.map +1 -1
  50. package/fesm2022/softpak-components-spx-navigation.mjs +37 -12
  51. package/fesm2022/softpak-components-spx-navigation.mjs.map +1 -1
  52. package/fesm2022/softpak-components-spx-number-check.mjs +266 -0
  53. package/fesm2022/softpak-components-spx-number-check.mjs.map +1 -0
  54. package/fesm2022/softpak-components-spx-spinner.mjs +4 -4
  55. package/fesm2022/softpak-components-spx-spinner.mjs.map +1 -1
  56. package/fesm2022/softpak-components-spx-suggestion.mjs +27 -9
  57. package/fesm2022/softpak-components-spx-suggestion.mjs.map +1 -1
  58. package/fesm2022/softpak-components-spx-update.mjs +1 -1
  59. package/fesm2022/softpak-components-spx-update.mjs.map +1 -1
  60. package/package.json +29 -11
  61. package/spx-button/spx-button.component.d.ts +3 -1
  62. package/spx-change-details/index.d.ts +5 -0
  63. package/spx-change-details/public-api.d.ts +1 -0
  64. package/spx-change-details/spx-change-details-value.interface.d.ts +7 -0
  65. package/spx-change-details/spx-change-details.component.d.ts +40 -0
  66. package/spx-check-digit/spx-check-digit.component.d.ts +3 -1
  67. package/spx-form-view/index.d.ts +5 -0
  68. package/spx-form-view/public-api.d.ts +3 -0
  69. package/spx-form-view/spx-form-field.interface.d.ts +16 -0
  70. package/spx-form-view/spx-form-section.interface.d.ts +9 -0
  71. package/spx-form-view/spx-form-view.component.d.ts +27 -0
  72. package/spx-inputs/spx-dropdown.component.d.ts +18 -0
  73. package/spx-inputs/spx-input-box.component.d.ts +14 -7
  74. package/spx-inputs/spx-input-float.component.d.ts +3 -2
  75. package/spx-inputs/spx-input-number.component.d.ts +3 -2
  76. package/spx-inputs/spx-input-radio.component.d.ts +13 -5
  77. package/spx-inputs/spx-input-text.component.d.ts +3 -2
  78. package/spx-inputs/spx-input-type.enum.d.ts +2 -1
  79. package/spx-inputs/spx-input.component.d.ts +11 -3
  80. package/spx-navigation/spx-home-tile.component.d.ts +5 -1
  81. package/spx-navigation/spx-navigation-item.interface.d.ts +1 -0
  82. package/spx-navigation/spx-navigation.component.d.ts +4 -1
  83. package/spx-number-check/index.d.ts +5 -0
  84. package/spx-number-check/public-api.d.ts +1 -0
  85. package/spx-number-check/spx-number-check.component.d.ts +48 -0
  86. package/spx-suggestion/spx-suggestion.component.d.ts +3 -1
  87. 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,118 @@ 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
+ this.select(valuePair);
1054
+ }
1055
+ determineFocusPosition() {
1056
+ if (this.value && this.spxSuggestions?.length) {
1057
+ const index = this.spxSuggestions.findIndex(valuePair => valuePairToValue(valuePair) === valuePairToValue(this.value));
1058
+ this.focusPosition = index >= 0 ? index : 0;
1059
+ }
1060
+ else {
1061
+ this.focusPosition = 0;
1062
+ }
1063
+ }
1064
+ select(valuePair) {
1065
+ this.focusPosition = 0;
1066
+ this.value = valuePair;
1067
+ this.spxChange.emit(valuePair);
1068
+ }
1069
+ listenToKeys() {
1070
+ this.subscriptionKeyUp = fromEvent(window, 'keyup').subscribe((event) => {
1071
+ if ((event.key === 'ArrowUp' || event.key === 'ArrowLeft') && this.focusPosition > 0) {
1072
+ this.focusPosition = this.focusPosition - 1;
1073
+ this.select(this.spxSuggestions.at(this.focusPosition));
1074
+ event.preventDefault();
1075
+ }
1076
+ if ((event.key === 'ArrowDown' || event.key === 'ArrowRight') && this.focusPosition < this.spxSuggestions.length - 1) {
1077
+ this.focusPosition = this.focusPosition + 1;
1078
+ this.select(this.spxSuggestions.at(this.focusPosition));
1079
+ event.preventDefault();
1080
+ }
1081
+ });
1082
+ this.subscriptionKeyDown = fromEvent(window, 'keydown').subscribe((event) => {
1083
+ if (event.key === 'ArrowDown' ||
1084
+ event.key === 'ArrowLeft' ||
1085
+ event.key === 'ArrowRight' ||
1086
+ event.key === 'ArrowUp') {
1087
+ event.preventDefault();
1088
+ }
1089
+ });
927
1090
  }
928
1091
  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"] }] }); }
1092
+ 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"
1093
+ [class.mt-3]="this.spxShowLabel">
1094
+ <spx-suggestion
1095
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
1096
+ [spxDisabled]="this.spxReadonly"
1097
+ [spxFocused]="this.spxFocused && i === this.focusPosition"
1098
+ [spxSelected]="this.value?.value === this.valuePair?.value"
1099
+ [spxTabbable]="this.focusPosition === i"
1100
+ (click)="this.spxReadonly ? undefined : this.handleSuggestionClick(valuePair)">
1101
+ {{this.valuePair?.description}}
1102
+ </spx-suggestion>
1103
+ </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
1104
  }
939
1105
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputRadioComponent, decorators: [{
940
1106
  type: Component,
941
- args: [{ selector: 'spx-input-radio', standalone: true, imports: [
1107
+ args: [{
1108
+ selector: 'spx-input-radio',
1109
+ standalone: true,
1110
+ imports: [
942
1111
  NgFor,
943
1112
  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"] }]
1113
+ ],
1114
+ template: `<div class="grid grid-cols-2 gap-2"
1115
+ [class.mt-3]="this.spxShowLabel">
1116
+ <spx-suggestion
1117
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
1118
+ [spxDisabled]="this.spxReadonly"
1119
+ [spxFocused]="this.spxFocused && i === this.focusPosition"
1120
+ [spxSelected]="this.value?.value === this.valuePair?.value"
1121
+ [spxTabbable]="this.focusPosition === i"
1122
+ (click)="this.spxReadonly ? undefined : this.handleSuggestionClick(valuePair)">
1123
+ {{this.valuePair?.description}}
1124
+ </spx-suggestion>
1125
+ </div>`,
1126
+ }]
953
1127
  }], propDecorators: { spxName: [{
954
1128
  type: Input
955
1129
  }], spxValidators: [{
956
1130
  type: Input
957
1131
  }], spxFocused: [{
958
1132
  type: Input
1133
+ }], spxShowLabel: [{
1134
+ type: Input
959
1135
  }], spxReadonly: [{
960
1136
  type: Input
961
1137
  }], spxSuggestions: [{
@@ -979,6 +1155,7 @@ var SpxInputTypeEnum;
979
1155
  SpxInputTypeEnum["number"] = "number";
980
1156
  SpxInputTypeEnum["password"] = "password";
981
1157
  SpxInputTypeEnum["text"] = "text";
1158
+ SpxInputTypeEnum["textNumericKeyboard"] = "textNumericKeyboard";
982
1159
  })(SpxInputTypeEnum || (SpxInputTypeEnum = {}));
983
1160
 
984
1161
  class SpxInputComponent {
@@ -991,6 +1168,7 @@ class SpxInputComponent {
991
1168
  this.spxSelectDay = true;
992
1169
  this.spxShowEdit = false;
993
1170
  this.spxShowHelp = false;
1171
+ this.spxShowLabel = true;
994
1172
  this.spxCompact = false;
995
1173
  this.spxShowClear = true;
996
1174
  this.spxShowSearch = false;
@@ -1009,9 +1187,6 @@ class SpxInputComponent {
1009
1187
  this.onChange = () => { };
1010
1188
  this.onTouched = () => { };
1011
1189
  }
1012
- spxSetFocus() {
1013
- this.passFocusToControl();
1014
- }
1015
1190
  handleBlur() {
1016
1191
  this.spxBlur.emit();
1017
1192
  }
@@ -1032,17 +1207,19 @@ class SpxInputComponent {
1032
1207
  handleFocus() {
1033
1208
  this.spxFocus.emit();
1034
1209
  this.spxFocused = true;
1035
- // this.elBox.spxSetFocus();
1036
1210
  }
1037
1211
  handleSearch() {
1038
1212
  this.spxSearch.emit();
1039
1213
  }
1040
- setFocus() {
1214
+ setFocusIn() {
1041
1215
  this.spxFocused = true;
1042
1216
  this.passFocusToControl();
1043
1217
  }
1044
1218
  setFocusOut() {
1045
1219
  this.spxFocused = false;
1220
+ if (this.spxType === SpxInputTypeEnum.radio) {
1221
+ this.radioInput?.spxFocusOut();
1222
+ }
1046
1223
  }
1047
1224
  handleEdit() {
1048
1225
  this.spxEdit.emit();
@@ -1053,9 +1230,22 @@ class SpxInputComponent {
1053
1230
  this.spxFocused = true;
1054
1231
  }
1055
1232
  passFocusToControl() {
1233
+ switch (this.spxType) {
1234
+ case SpxInputTypeEnum.autocomplete:
1235
+ case SpxInputTypeEnum.text:
1236
+ case SpxInputTypeEnum.overlayNumber:
1237
+ this.textInput?.spxSetFocus();
1238
+ break;
1239
+ case SpxInputTypeEnum.number:
1240
+ this.numberInput?.spxSetFocus();
1241
+ break;
1242
+ case SpxInputTypeEnum.radio:
1243
+ this.radioInput?.spxFocusIn();
1244
+ break;
1245
+ }
1056
1246
  }
1057
1247
  writeValue(value) {
1058
- this.value = this.lastValue = value == null ? '' : value;
1248
+ this.value = this.lastValue = value;
1059
1249
  }
1060
1250
  handleChangeEvent(value) {
1061
1251
  if (value !== this.lastValue) {
@@ -1073,13 +1263,14 @@ class SpxInputComponent {
1073
1263
  this.onTouched = fn;
1074
1264
  }
1075
1265
  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: [
1266
+ 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
1267
  {
1078
1268
  provide: NG_VALUE_ACCESSOR,
1079
1269
  useExisting: SpxInputComponent,
1080
1270
  multi: true
1081
1271
  }
1082
- ], ngImport: i0, template: `<spx-input-box
1272
+ ], 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
1273
+ [spxFocused]="this.spxFocused"
1083
1274
  [spxLabel]="this.spxLabel"
1084
1275
  [spxReadonly]="this.spxReadonly"
1085
1276
  [spxRequired]="this.spxRequired"
@@ -1088,12 +1279,13 @@ class SpxInputComponent {
1088
1279
  [spxCompact]="this.spxCompact"
1089
1280
  [spxShowClear]="this.spxShowClear"
1090
1281
  [spxShowEdit]="this.spxShowEdit"
1282
+ [spxShowLabel]="this.spxShowLabel"
1091
1283
  [spxShowSearch]="this.spxShowSearch ? this.spxShowSearch : this.spxType === 'autocomplete'"
1092
1284
  [spxShowValidationMessages]="this.spxShowValidationMessages"
1093
1285
  (spxClear)="this.handleClear()"
1094
1286
  (spxEdit)="this.handleEdit()"
1095
1287
  (spxHelp)="this.handleHelp()"
1096
- (spxFocus)="this.setFocus()"
1288
+ (spxFocus)="this.setFocusIn()"
1097
1289
  (spxFocusOut)="this.setFocusOut()"
1098
1290
  (spxSearch)="this.handleSearch()">
1099
1291
  <div controls>
@@ -1154,12 +1346,14 @@ class SpxInputComponent {
1154
1346
  [value]="this.value"
1155
1347
  ></spx-input-number>
1156
1348
  <spx-input-radio
1349
+ #radioInput
1157
1350
  *ngIf="this.spxType === 'radio'"
1158
1351
  (spxChange)="this.handleChange($event)"
1159
1352
  (spxFocus)="this.handleFocus()"
1160
1353
  [spxFocused]="this.spxFocused"
1161
1354
  [spxName]="this.spxName"
1162
1355
  [spxReadonly]="this.spxReadonly"
1356
+ [spxShowLabel]="this.spxShowLabel"
1163
1357
  [spxSuggestions]="this.spxSuggestions"
1164
1358
  [spxValidators]="this.spxValidators"
1165
1359
  [value]="this.value"
@@ -1168,7 +1362,7 @@ class SpxInputComponent {
1168
1362
  <div validation-messages>
1169
1363
  <ng-content></ng-content>
1170
1364
  </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"] }] }); }
1365
+ </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
1366
  }
1173
1367
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputComponent, decorators: [{
1174
1368
  type: Component,
@@ -1195,6 +1389,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1195
1389
  }
1196
1390
  ],
1197
1391
  template: `<spx-input-box
1392
+ [spxFocused]="this.spxFocused"
1198
1393
  [spxLabel]="this.spxLabel"
1199
1394
  [spxReadonly]="this.spxReadonly"
1200
1395
  [spxRequired]="this.spxRequired"
@@ -1203,12 +1398,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1203
1398
  [spxCompact]="this.spxCompact"
1204
1399
  [spxShowClear]="this.spxShowClear"
1205
1400
  [spxShowEdit]="this.spxShowEdit"
1401
+ [spxShowLabel]="this.spxShowLabel"
1206
1402
  [spxShowSearch]="this.spxShowSearch ? this.spxShowSearch : this.spxType === 'autocomplete'"
1207
1403
  [spxShowValidationMessages]="this.spxShowValidationMessages"
1208
1404
  (spxClear)="this.handleClear()"
1209
1405
  (spxEdit)="this.handleEdit()"
1210
1406
  (spxHelp)="this.handleHelp()"
1211
- (spxFocus)="this.setFocus()"
1407
+ (spxFocus)="this.setFocusIn()"
1212
1408
  (spxFocusOut)="this.setFocusOut()"
1213
1409
  (spxSearch)="this.handleSearch()">
1214
1410
  <div controls>
@@ -1269,12 +1465,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1269
1465
  [value]="this.value"
1270
1466
  ></spx-input-number>
1271
1467
  <spx-input-radio
1468
+ #radioInput
1272
1469
  *ngIf="this.spxType === 'radio'"
1273
1470
  (spxChange)="this.handleChange($event)"
1274
1471
  (spxFocus)="this.handleFocus()"
1275
1472
  [spxFocused]="this.spxFocused"
1276
1473
  [spxName]="this.spxName"
1277
1474
  [spxReadonly]="this.spxReadonly"
1475
+ [spxShowLabel]="this.spxShowLabel"
1278
1476
  [spxSuggestions]="this.spxSuggestions"
1279
1477
  [spxValidators]="this.spxValidators"
1280
1478
  [value]="this.value"
@@ -1311,6 +1509,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1311
1509
  type: Input
1312
1510
  }], spxShowHelp: [{
1313
1511
  type: Input
1512
+ }], spxShowLabel: [{
1513
+ type: Input
1314
1514
  }], spxCompact: [{
1315
1515
  type: Input
1316
1516
  }], spxShowClear: [{
@@ -1345,6 +1545,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1345
1545
  type: Output
1346
1546
  }], spxSearch: [{
1347
1547
  type: Output
1548
+ }], floatInput: [{
1549
+ type: ViewChild,
1550
+ args: [SpxInputFloatComponent]
1551
+ }], numberInput: [{
1552
+ type: ViewChild,
1553
+ args: [SpxInputNumberComponent]
1554
+ }], textInput: [{
1555
+ type: ViewChild,
1556
+ args: [SpxInputTextComponent]
1557
+ }], radioInput: [{
1558
+ type: ViewChild,
1559
+ args: [SpxInputRadioComponent]
1348
1560
  }], spxFocused: [{
1349
1561
  type: Input
1350
1562
  }], _handleBlurEvent: [{