@softpak/components 0.0.0-beta.22 → 0.0.0-beta.220

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