@softpak/components 0.0.0-beta.13 → 0.0.0-beta.130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/esm2022/spx-alert/spx-alert.component.mjs +5 -2
  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 +118 -0
  6. package/esm2022/spx-channel-selection/src/spx-channel-selection.component.mjs +6 -5
  7. package/esm2022/spx-channel-selection/src/spx-company-selection.component.mjs +6 -5
  8. package/esm2022/spx-check-digit/spx-check-digit.component.mjs +6 -4
  9. package/esm2022/spx-form-section/spx-form-section.component.mjs +7 -7
  10. package/esm2022/spx-form-view/public-api.mjs +4 -0
  11. package/esm2022/spx-form-view/softpak-components-spx-form-view.mjs +5 -0
  12. package/esm2022/spx-form-view/spx-form-field.interface.mjs +2 -0
  13. package/esm2022/spx-form-view/spx-form-section.interface.mjs +2 -0
  14. package/esm2022/spx-form-view/spx-form-view.component.mjs +163 -0
  15. package/esm2022/spx-inputs/public-api.mjs +2 -1
  16. package/esm2022/spx-inputs/spx-dropdown.component.mjs +94 -0
  17. package/esm2022/spx-inputs/spx-input-box.component.mjs +74 -50
  18. package/esm2022/spx-inputs/spx-input-date.component.mjs +1 -1
  19. package/esm2022/spx-inputs/spx-input-radio.component.mjs +81 -27
  20. package/esm2022/spx-inputs/spx-input-text.component.mjs +20 -31
  21. package/esm2022/spx-inputs/spx-input-type.enum.mjs +14 -0
  22. package/esm2022/spx-inputs/spx-input.component.mjs +43 -16
  23. package/esm2022/spx-navigation/spx-home-tile.component.mjs +29 -10
  24. package/esm2022/spx-navigation/spx-navigation-item.interface.mjs +1 -1
  25. package/esm2022/spx-navigation/spx-navigation.component.mjs +11 -5
  26. package/esm2022/spx-number-check/public-api.mjs +2 -0
  27. package/esm2022/spx-number-check/softpak-components-spx-number-check.mjs +5 -0
  28. package/esm2022/spx-number-check/spx-number-check.component.mjs +262 -0
  29. package/esm2022/spx-spinner/spx-spinner.component.mjs +5 -5
  30. package/esm2022/spx-suggestion/spx-suggestion.component.mjs +26 -10
  31. package/esm2022/spx-toaster/src/spx-toaster.component.mjs +3 -3
  32. package/esm2022/spx-update/src/spx-update-info.component.mjs +1 -1
  33. package/fesm2022/softpak-components-spx-alert.mjs +4 -1
  34. package/fesm2022/softpak-components-spx-alert.mjs.map +1 -1
  35. package/fesm2022/softpak-components-spx-change-details.mjs +125 -0
  36. package/fesm2022/softpak-components-spx-change-details.mjs.map +1 -0
  37. package/fesm2022/softpak-components-spx-channel-selection.mjs +9 -7
  38. package/fesm2022/softpak-components-spx-channel-selection.mjs.map +1 -1
  39. package/fesm2022/softpak-components-spx-check-digit.mjs +5 -3
  40. package/fesm2022/softpak-components-spx-check-digit.mjs.map +1 -1
  41. package/fesm2022/softpak-components-spx-form-section.mjs +6 -6
  42. package/fesm2022/softpak-components-spx-form-section.mjs.map +1 -1
  43. package/fesm2022/softpak-components-spx-form-view.mjs +170 -0
  44. package/fesm2022/softpak-components-spx-form-view.mjs.map +1 -0
  45. package/fesm2022/softpak-components-spx-inputs.mjs +314 -119
  46. package/fesm2022/softpak-components-spx-inputs.mjs.map +1 -1
  47. package/fesm2022/softpak-components-spx-navigation.mjs +37 -12
  48. package/fesm2022/softpak-components-spx-navigation.mjs.map +1 -1
  49. package/fesm2022/softpak-components-spx-number-check.mjs +269 -0
  50. package/fesm2022/softpak-components-spx-number-check.mjs.map +1 -0
  51. package/fesm2022/softpak-components-spx-spinner.mjs +4 -4
  52. package/fesm2022/softpak-components-spx-spinner.mjs.map +1 -1
  53. package/fesm2022/softpak-components-spx-suggestion.mjs +25 -9
  54. package/fesm2022/softpak-components-spx-suggestion.mjs.map +1 -1
  55. package/fesm2022/softpak-components-spx-toaster.mjs +2 -2
  56. package/fesm2022/softpak-components-spx-toaster.mjs.map +1 -1
  57. package/fesm2022/softpak-components-spx-update.mjs +1 -1
  58. package/fesm2022/softpak-components-spx-update.mjs.map +1 -1
  59. package/package.json +31 -13
  60. package/spx-change-details/index.d.ts +5 -0
  61. package/spx-change-details/public-api.d.ts +1 -0
  62. package/spx-change-details/spx-change-details-value.interface.d.ts +7 -0
  63. package/spx-change-details/spx-change-details.component.d.ts +40 -0
  64. package/spx-channel-selection/src/spx-channel-selection.component.d.ts +2 -1
  65. package/spx-channel-selection/src/spx-company-selection.component.d.ts +2 -1
  66. package/spx-check-digit/spx-check-digit.component.d.ts +3 -0
  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/public-api.d.ts +1 -0
  73. package/spx-inputs/spx-dropdown.component.d.ts +18 -0
  74. package/spx-inputs/spx-input-box.component.d.ts +13 -8
  75. package/spx-inputs/spx-input-radio.component.d.ts +12 -5
  76. package/spx-inputs/spx-input-text.component.d.ts +2 -1
  77. package/spx-inputs/spx-input-type.enum.d.ts +12 -0
  78. package/spx-inputs/spx-input.component.d.ts +9 -4
  79. package/spx-navigation/spx-home-tile.component.d.ts +5 -1
  80. package/spx-navigation/spx-navigation-item.interface.d.ts +1 -0
  81. package/spx-navigation/spx-navigation.component.d.ts +4 -1
  82. package/spx-number-check/index.d.ts +5 -0
  83. package/spx-number-check/public-api.d.ts +1 -0
  84. package/spx-number-check/spx-number-check.component.d.ts +48 -0
  85. package/spx-suggestion/spx-suggestion.component.d.ts +3 -1
  86. package/tailwind.css +1 -1
@@ -1,54 +1,48 @@
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';
11
15
 
12
16
  class SpxInputBoxComponent {
13
- constructor() {
14
- this.faEdit = faEdit;
15
- this.faSearch = faSearch;
16
- this.faQuestion = faQuestion;
17
- this.faTimes = faTimes;
18
- this.spxReadonly = false;
19
- this.spxShowClear = true;
20
- this.spxClear = new EventEmitter();
21
- this.spxSearchOutput = new EventEmitter();
22
- this.spxFocus = new EventEmitter();
23
- this.spxFocusOut = new EventEmitter();
24
- this.spxEdit = new EventEmitter();
25
- 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() {
17
+ handleFocusIn(ev) {
45
18
  this.spxFocused = true;
19
+ if (!this.spxFocused) {
20
+ this.spxFocus.emit();
21
+ }
22
+ }
23
+ handleFocusOut(ev) {
24
+ const thisEl = this.elRef.nativeElement;
25
+ const relatedElement = ev.relatedTarget;
26
+ if (!relatedElement || !thisEl.contains(relatedElement)) {
27
+ this.spxFocusOut.emit();
28
+ this.spxFocused = false;
29
+ }
30
+ }
31
+ handleWindowClick(ev) {
32
+ if (ev.composedPath().includes(this.elRef.nativeElement)) {
33
+ if (!this.spxFocused) {
34
+ this.spxFocus.emit();
35
+ }
36
+ }
37
+ else {
38
+ this.spxFocused = false;
39
+ }
46
40
  }
47
41
  onClear() {
48
42
  this.spxClear.emit();
49
43
  }
50
44
  onSearch() {
51
- this.spxSearchOutput.emit();
45
+ this.spxSearch.emit();
52
46
  }
53
47
  onEdit() {
54
48
  this.spxEdit.emit();
@@ -56,8 +50,26 @@ class SpxInputBoxComponent {
56
50
  onHelp() {
57
51
  this.spxHelp.emit();
58
52
  }
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", spxSearchOutput: "spxSearchOutput", spxFocus: "spxFocus", spxFocusOut: "spxFocusOut", spxEdit: "spxEdit", spxHelp: "spxHelp" }, ngImport: i0, template: `<div class="flex rounded w-full gap-3"
53
+ constructor(elRef) {
54
+ this.elRef = elRef;
55
+ this.faEdit = faEdit;
56
+ this.faSearch = faSearch;
57
+ this.faQuestion = faQuestion;
58
+ this.faTimes = faTimes;
59
+ this.spxFocused = false;
60
+ this.spxReadonly = false;
61
+ this.spxShowClear = true;
62
+ this.spxShowLabel = true;
63
+ this.spxClear = new EventEmitter();
64
+ this.spxSearch = new EventEmitter();
65
+ this.spxFocus = new EventEmitter();
66
+ this.spxFocusOut = new EventEmitter();
67
+ this.spxEdit = new EventEmitter();
68
+ this.spxHelp = new EventEmitter();
69
+ console.log('spx-input-box: constructor');
70
+ }
71
+ 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 }); }
72
+ 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
73
  [class.rounded-none]="this.spxShowValidationMessages"
62
74
  [class.rounded-t]="this.spxShowValidationMessages"
63
75
  [class.outline-none]="this.spxFocused && !this.spxReadonly"
@@ -71,7 +83,7 @@ class SpxInputBoxComponent {
71
83
  [class.p-0]="this.spxCompact"
72
84
  [class.flex]="this.spxCompact"
73
85
  [class.items-center]="this.spxCompact">
74
- <div class="text-sm mb-1 text-gray-800"
86
+ <div *ngIf="this.spxShowLabel" class="font-bold text-sm mb-1 text-gray-800"
75
87
  [class.mb-0]="this.spxCompact"
76
88
  [class.px-3]="this.spxCompact">
77
89
  {{this.spxLabel}} <span *ngIf="spxRequired" class="text-red-800">*</span>
@@ -84,7 +96,6 @@ class SpxInputBoxComponent {
84
96
  (spxClick)="onEdit()"
85
97
  [spxFullHeight]="true"
86
98
  [spxSize]="'xl'"
87
- [spxTabIndex]="-1"
88
99
  [spxType]="'button'">
89
100
  <fa-icon [icon]="faEdit" class="block text-xl"></fa-icon>
90
101
  </spx-button>
@@ -92,6 +103,7 @@ class SpxInputBoxComponent {
92
103
  *ngIf="this.spxShowHelp"
93
104
  (spxClick)="onHelp()"
94
105
  [spxFullHeight]="true"
106
+ [spxDisabled]="this.spxReadonly"
95
107
  [spxSize]="'xl'"
96
108
  [spxTabIndex]="-1"
97
109
  [spxType]="'button'">
@@ -101,6 +113,7 @@ class SpxInputBoxComponent {
101
113
  *ngIf="this.spxShowSearch"
102
114
  (spxClick)="onSearch()"
103
115
  [spxFullHeight]="true"
116
+ [spxDisabled]="this.spxReadonly"
104
117
  [spxSize]="'xl'"
105
118
  [spxTabIndex]="-1"
106
119
  [spxType]="'button'">
@@ -146,7 +159,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
146
159
  [class.p-0]="this.spxCompact"
147
160
  [class.flex]="this.spxCompact"
148
161
  [class.items-center]="this.spxCompact">
149
- <div class="text-sm mb-1 text-gray-800"
162
+ <div *ngIf="this.spxShowLabel" class="font-bold text-sm mb-1 text-gray-800"
150
163
  [class.mb-0]="this.spxCompact"
151
164
  [class.px-3]="this.spxCompact">
152
165
  {{this.spxLabel}} <span *ngIf="spxRequired" class="text-red-800">*</span>
@@ -159,7 +172,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
159
172
  (spxClick)="onEdit()"
160
173
  [spxFullHeight]="true"
161
174
  [spxSize]="'xl'"
162
- [spxTabIndex]="-1"
163
175
  [spxType]="'button'">
164
176
  <fa-icon [icon]="faEdit" class="block text-xl"></fa-icon>
165
177
  </spx-button>
@@ -167,6 +179,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
167
179
  *ngIf="this.spxShowHelp"
168
180
  (spxClick)="onHelp()"
169
181
  [spxFullHeight]="true"
182
+ [spxDisabled]="this.spxReadonly"
170
183
  [spxSize]="'xl'"
171
184
  [spxTabIndex]="-1"
172
185
  [spxType]="'button'">
@@ -176,6 +189,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
176
189
  *ngIf="this.spxShowSearch"
177
190
  (spxClick)="onSearch()"
178
191
  [spxFullHeight]="true"
192
+ [spxDisabled]="this.spxReadonly"
179
193
  [spxSize]="'xl'"
180
194
  [spxTabIndex]="-1"
181
195
  [spxType]="'button'">
@@ -197,20 +211,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
197
211
  <ng-content select="[validation-messages]"></ng-content>
198
212
  </div>`,
199
213
  }]
200
- }], propDecorators: { spxLabel: [{
214
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { spxCompact: [{
201
215
  type: Input
202
- }], spxRequired: [{
216
+ }], spxFocused: [{
203
217
  type: Input
204
- }], spxReadonly: [{
218
+ }], spxLabel: [{
205
219
  type: Input
206
- }], spxShowHelp: [{
220
+ }], spxReadonly: [{
207
221
  type: Input
208
- }], spxCompact: [{
222
+ }], spxRequired: [{
209
223
  type: Input
210
224
  }], spxShowClear: [{
211
225
  type: Input
212
226
  }], spxShowEdit: [{
213
227
  type: Input
228
+ }], spxShowHelp: [{
229
+ type: Input
230
+ }], spxShowLabel: [{
231
+ type: Input
214
232
  }], spxShowSearch: [{
215
233
  type: Input
216
234
  }], spxShowValidationMessages: [{
@@ -219,7 +237,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
219
237
  type: Input
220
238
  }], spxClear: [{
221
239
  type: Output
222
- }], spxSearchOutput: [{
240
+ }], spxSearch: [{
223
241
  type: Output
224
242
  }], spxFocus: [{
225
243
  type: Output
@@ -229,8 +247,104 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
229
247
  type: Output
230
248
  }], spxHelp: [{
231
249
  type: Output
232
- }], spxFocused: [{
250
+ }], handleFocusIn: [{
251
+ type: HostListener,
252
+ args: ['focusin', ["$event"]]
253
+ }], handleFocusOut: [{
254
+ type: HostListener,
255
+ args: ['focusout', ["$event"]]
256
+ }], handleWindowClick: [{
257
+ type: HostListener,
258
+ args: ['document:click', ["$event"]]
259
+ }] } });
260
+
261
+ class SpxDropdownComponent {
262
+ constructor() {
263
+ this.focusPosition = 0;
264
+ this.spxSuggestions = [];
265
+ this.spxSelect = new EventEmitter();
266
+ }
267
+ ngOnInit() {
268
+ this.listenToKeyUp();
269
+ }
270
+ ngOnChanges(changes) {
271
+ this.focusPosition = 0;
272
+ }
273
+ ngOnDestroy() {
274
+ this.subscriptionKeyUp?.unsubscribe();
275
+ }
276
+ handleSuggestionClick(valuePair) {
277
+ this.select(valuePair);
278
+ }
279
+ listenToKeyUp() {
280
+ this.subscriptionKeyUp = fromEvent(window, 'keyup').subscribe((event) => {
281
+ if (event.key === 'ArrowUp' && this.focusPosition > 0) {
282
+ this.focusPosition = this.focusPosition - 1;
283
+ event.preventDefault();
284
+ }
285
+ if (event.key === 'ArrowDown' && this.focusPosition < this.spxSuggestions.length - 1) {
286
+ this.focusPosition = this.focusPosition + 1;
287
+ event.preventDefault();
288
+ }
289
+ if (event.key === 'Enter' && this.spxSuggestions.length > 0) {
290
+ this.select(this.spxSuggestions.at(this.focusPosition));
291
+ event.preventDefault();
292
+ }
293
+ });
294
+ }
295
+ select(valuePair) {
296
+ this.focusPosition = 0;
297
+ this.spxSelect.emit(valuePair);
298
+ }
299
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
300
+ 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">
301
+ <div
302
+ class="absolute bg-gray-100 left-0 right-0 z-20">
303
+ <button
304
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
305
+ class="text-black block w-full p-2 border border-gray-200 rounded-lg shadow hover:bg-gray-200 flex items-center text-left"
306
+ [class.bg-gray-100]="i === this.focusPosition"
307
+ [class.bg-white]="i !== this.focusPosition"
308
+ (click)="this.handleSuggestionClick(valuePair)"
309
+ [attr.tabindex]="-1"
310
+ [attr.type]="'button'">
311
+ <div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
312
+ <spx-button (spxClick)="this.handleSuggestionClick(valuePair)" [spxType]="'button'" [spxTabIndex]="-1">Select</spx-button>
313
+ </button>
314
+ </div>
315
+ </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"] }] }); }
316
+ }
317
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxDropdownComponent, decorators: [{
318
+ type: Component,
319
+ args: [{
320
+ selector: 'spx-dropdown',
321
+ standalone: true,
322
+ imports: [
323
+ NgIf,
324
+ NgFor,
325
+ SpxButtonComponent,
326
+ ],
327
+ template: `<div class="relative text-black">
328
+ <div
329
+ class="absolute bg-gray-100 left-0 right-0 z-20">
330
+ <button
331
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
332
+ class="text-black block w-full p-2 border border-gray-200 rounded-lg shadow hover:bg-gray-200 flex items-center text-left"
333
+ [class.bg-gray-100]="i === this.focusPosition"
334
+ [class.bg-white]="i !== this.focusPosition"
335
+ (click)="this.handleSuggestionClick(valuePair)"
336
+ [attr.tabindex]="-1"
337
+ [attr.type]="'button'">
338
+ <div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
339
+ <spx-button (spxClick)="this.handleSuggestionClick(valuePair)" [spxType]="'button'" [spxTabIndex]="-1">Select</spx-button>
340
+ </button>
341
+ </div>
342
+ </div>`,
343
+ }]
344
+ }], propDecorators: { spxSuggestions: [{
233
345
  type: Input
346
+ }], spxSelect: [{
347
+ type: Output
234
348
  }] } });
235
349
 
236
350
  class SpxInputTextComponent {
@@ -247,7 +361,7 @@ class SpxInputTextComponent {
247
361
  this.spxWasInternalUpdate = false;
248
362
  }
249
363
  async spxSetFocus() {
250
- // this.elInput.focus();
364
+ this.inputRef?.nativeElement?.focus();
251
365
  }
252
366
  componentDidLoad() {
253
367
  if (this.spxAutofocus) {
@@ -279,8 +393,9 @@ class SpxInputTextComponent {
279
393
  this.spxFocused = true;
280
394
  }
281
395
  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">
396
+ 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
397
  <input
398
+ #input
284
399
  class="font-bold text-lg w-full outline-none"
285
400
  [class.bg-white]="!this.spxReadonly"
286
401
  [class.bg-gray-300]="this.spxReadonly"
@@ -292,27 +407,18 @@ class SpxInputTextComponent {
292
407
  [attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
293
408
  [attr.name]="this.spxName"
294
409
  [attr.type]="this.spxType"
295
- [attr.value]="this.value?.description ? this.value?.description : this.value?.value"
410
+ [value]="this.value?.description ? this.value?.description : this.value?.value"
296
411
  (blur)="this.handleBlur()"
297
412
  (keyUp)="this.handleKeyUp()"
298
413
  (focus)="this.handleFocus()"
299
414
  (input)="this.handleDescriptionInput($event)"
300
415
  />
301
416
  <span *ngIf="this.value?.description && this.value?.value && this.value?.description?.valueOf() !== this.value?.value?.valueOf()">{{this.value?.value}}</span>
302
- <div
417
+ <spx-dropdown
303
418
  *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"] }] }); }
419
+ [spxSuggestions]="this.spxSuggestions" (spxSelect)="this.handleSuggestionClick($event)">
420
+ </spx-dropdown>
421
+ </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
422
  }
317
423
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputTextComponent, decorators: [{
318
424
  type: Component,
@@ -323,9 +429,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
323
429
  NgIf,
324
430
  NgFor,
325
431
  SpxButtonComponent,
432
+ SpxDropdownComponent,
326
433
  ],
327
434
  template: `<div class="relative text-black">
328
435
  <input
436
+ #input
329
437
  class="font-bold text-lg w-full outline-none"
330
438
  [class.bg-white]="!this.spxReadonly"
331
439
  [class.bg-gray-300]="this.spxReadonly"
@@ -337,26 +445,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
337
445
  [attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
338
446
  [attr.name]="this.spxName"
339
447
  [attr.type]="this.spxType"
340
- [attr.value]="this.value?.description ? this.value?.description : this.value?.value"
448
+ [value]="this.value?.description ? this.value?.description : this.value?.value"
341
449
  (blur)="this.handleBlur()"
342
450
  (keyUp)="this.handleKeyUp()"
343
451
  (focus)="this.handleFocus()"
344
452
  (input)="this.handleDescriptionInput($event)"
345
453
  />
346
454
  <span *ngIf="this.value?.description && this.value?.value && this.value?.description?.valueOf() !== this.value?.value?.valueOf()">{{this.value?.value}}</span>
347
- <div
455
+ <spx-dropdown
348
456
  *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>
457
+ [spxSuggestions]="this.spxSuggestions" (spxSelect)="this.handleSuggestionClick($event)">
458
+ </spx-dropdown>
360
459
  </div>`,
361
460
  }]
362
461
  }], propDecorators: { spxName: [{
@@ -389,6 +488,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
389
488
  type: Output
390
489
  }], spxWasInternalUpdate: [{
391
490
  type: Input
491
+ }], inputRef: [{
492
+ type: ViewChild,
493
+ args: ['input', { static: true }]
392
494
  }] } });
393
495
 
394
496
  class SpxInputDateComponent {
@@ -593,7 +695,7 @@ class SpxInputDateComponent {
593
695
  <spx-suggestion
594
696
  *ngFor="let valuePair of spxSuggestions[spxSelectStep]"
595
697
  (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"] }] }); }
698
+ </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
699
  }
598
700
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputDateComponent, decorators: [{
599
701
  type: Component,
@@ -911,51 +1013,104 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
911
1013
 
912
1014
  class SpxInputRadioComponent {
913
1015
  constructor() {
914
- this.spxFocused = true;
1016
+ this.focusPosition = 0;
1017
+ this.spxFocused = false;
1018
+ this.spxShowLabel = true;
915
1019
  this.spxReadonly = false;
916
1020
  this.spxSuggestions = [];
917
1021
  this.spxChange = new EventEmitter();
918
1022
  this.spxFocus = new EventEmitter();
919
- this.spxWasInternalUpdate = false;
920
1023
  }
921
- async spxSetFocus() {
922
- // this.elYear.focus();
1024
+ spxFocusIn() {
1025
+ this.listenToKeys();
1026
+ this.focusPosition = 0;
923
1027
  }
924
- handleSuggestionClick(value) {
925
- this.value = value;
926
- this.spxChange.emit(this.value);
1028
+ spxFocusOut() {
1029
+ this.subscriptionKeyDown?.unsubscribe();
1030
+ this.subscriptionKeyUp?.unsubscribe();
1031
+ }
1032
+ ngOnChanges(changes) {
1033
+ this.focusPosition = 0;
1034
+ }
1035
+ handleSuggestionClick(valuePair) {
1036
+ this.select(valuePair);
1037
+ }
1038
+ select(valuePair) {
1039
+ this.focusPosition = 0;
1040
+ this.value = valuePair;
1041
+ this.spxChange.emit(valuePair);
1042
+ }
1043
+ listenToKeys() {
1044
+ console.log('listenToKeys');
1045
+ this.subscriptionKeyUp = fromEvent(window, 'keyup').subscribe((event) => {
1046
+ if ((event.key === 'ArrowUp' || event.key === 'ArrowLeft') && this.focusPosition > 0) {
1047
+ this.focusPosition = this.focusPosition - 1;
1048
+ event.preventDefault();
1049
+ }
1050
+ if ((event.key === 'ArrowDown' || event.key === 'ArrowUp') && this.focusPosition < this.spxSuggestions.length - 1) {
1051
+ this.focusPosition = this.focusPosition + 1;
1052
+ event.preventDefault();
1053
+ }
1054
+ if (event.key === 'Enter' && this.spxSuggestions.length > 0) {
1055
+ this.select(this.spxSuggestions.at(this.focusPosition));
1056
+ event.preventDefault();
1057
+ }
1058
+ console.log(this.focusPosition);
1059
+ });
1060
+ this.subscriptionKeyDown = fromEvent(window, 'keydown').subscribe((event) => {
1061
+ if (event.key === 'ArrowDown' ||
1062
+ event.key === 'ArrowLeft' ||
1063
+ event.key === 'ArrowRight' ||
1064
+ event.key === 'ArrowUp' ||
1065
+ event.key === 'Enter') {
1066
+ event.preventDefault();
1067
+ }
1068
+ });
927
1069
  }
928
1070
  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"] }] }); }
1071
+ 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"
1072
+ [class.mt-3]="this.spxShowLabel">
1073
+ <spx-suggestion
1074
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
1075
+ [spxDisabled]="this.spxReadonly"
1076
+ [spxFocused]="this.spxFocused && i === this.focusPosition"
1077
+ [spxSelected]="this.value?.value === this.valuePair?.value"
1078
+ [spxTabbable]="this.focusPosition === i"
1079
+ (click)="this.spxReadonly ? undefined : this.handleSuggestionClick(valuePair)">
1080
+ {{this.valuePair?.description}}
1081
+ </spx-suggestion>
1082
+ </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
1083
  }
939
1084
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputRadioComponent, decorators: [{
940
1085
  type: Component,
941
- args: [{ selector: 'spx-input-radio', standalone: true, imports: [
1086
+ args: [{
1087
+ selector: 'spx-input-radio',
1088
+ standalone: true,
1089
+ imports: [
942
1090
  NgFor,
943
1091
  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"] }]
1092
+ ],
1093
+ template: `<div class="grid grid-cols-2 gap-2"
1094
+ [class.mt-3]="this.spxShowLabel">
1095
+ <spx-suggestion
1096
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
1097
+ [spxDisabled]="this.spxReadonly"
1098
+ [spxFocused]="this.spxFocused && i === this.focusPosition"
1099
+ [spxSelected]="this.value?.value === this.valuePair?.value"
1100
+ [spxTabbable]="this.focusPosition === i"
1101
+ (click)="this.spxReadonly ? undefined : this.handleSuggestionClick(valuePair)">
1102
+ {{this.valuePair?.description}}
1103
+ </spx-suggestion>
1104
+ </div>`,
1105
+ }]
953
1106
  }], propDecorators: { spxName: [{
954
1107
  type: Input
955
1108
  }], spxValidators: [{
956
1109
  type: Input
957
1110
  }], spxFocused: [{
958
1111
  type: Input
1112
+ }], spxShowLabel: [{
1113
+ type: Input
959
1114
  }], spxReadonly: [{
960
1115
  type: Input
961
1116
  }], spxSuggestions: [{
@@ -968,6 +1123,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
968
1123
  type: Output
969
1124
  }] } });
970
1125
 
1126
+ var SpxInputTypeEnum;
1127
+ (function (SpxInputTypeEnum) {
1128
+ SpxInputTypeEnum["autocomplete"] = "autocomplete";
1129
+ SpxInputTypeEnum["date"] = "date";
1130
+ SpxInputTypeEnum["float"] = "float";
1131
+ SpxInputTypeEnum["overlay"] = "overlay";
1132
+ SpxInputTypeEnum["overlayNumber"] = "overlaynumber";
1133
+ SpxInputTypeEnum["radio"] = "radio";
1134
+ SpxInputTypeEnum["number"] = "number";
1135
+ SpxInputTypeEnum["password"] = "password";
1136
+ SpxInputTypeEnum["text"] = "text";
1137
+ SpxInputTypeEnum["textNumericKeyboard"] = "textNumericKeyboard";
1138
+ })(SpxInputTypeEnum || (SpxInputTypeEnum = {}));
1139
+
971
1140
  class SpxInputComponent {
972
1141
  constructor() {
973
1142
  this.spxLabel = 'label';
@@ -978,12 +1147,13 @@ class SpxInputComponent {
978
1147
  this.spxSelectDay = true;
979
1148
  this.spxShowEdit = false;
980
1149
  this.spxShowHelp = false;
1150
+ this.spxShowLabel = true;
981
1151
  this.spxCompact = false;
982
1152
  this.spxShowClear = true;
983
1153
  this.spxShowSearch = false;
984
1154
  this.spxShowValidationMessages = false;
985
1155
  this.spxSuggestions = [];
986
- this.spxType = 'text';
1156
+ this.spxType = SpxInputTypeEnum.text;
987
1157
  this.spxCapitalize = false;
988
1158
  this.spxBlur = new EventEmitter();
989
1159
  this.spxClear = new EventEmitter();
@@ -996,9 +1166,6 @@ class SpxInputComponent {
996
1166
  this.onChange = () => { };
997
1167
  this.onTouched = () => { };
998
1168
  }
999
- async spxSetFocus() {
1000
- this.passFocusToControl();
1001
- }
1002
1169
  handleBlur() {
1003
1170
  this.spxBlur.emit();
1004
1171
  }
@@ -1019,17 +1186,19 @@ class SpxInputComponent {
1019
1186
  handleFocus() {
1020
1187
  this.spxFocus.emit();
1021
1188
  this.spxFocused = true;
1022
- // this.elBox.spxSetFocus();
1023
1189
  }
1024
1190
  handleSearch() {
1025
1191
  this.spxSearch.emit();
1026
1192
  }
1027
- setFocus() {
1193
+ setFocusIn() {
1028
1194
  this.spxFocused = true;
1029
1195
  this.passFocusToControl();
1030
1196
  }
1031
1197
  setFocusOut() {
1032
1198
  this.spxFocused = false;
1199
+ if (this.spxType === SpxInputTypeEnum.radio) {
1200
+ this.radioInput?.spxFocusOut();
1201
+ }
1033
1202
  }
1034
1203
  handleEdit() {
1035
1204
  this.spxEdit.emit();
@@ -1040,9 +1209,19 @@ class SpxInputComponent {
1040
1209
  this.spxFocused = true;
1041
1210
  }
1042
1211
  passFocusToControl() {
1212
+ switch (this.spxType) {
1213
+ case SpxInputTypeEnum.autocomplete:
1214
+ case SpxInputTypeEnum.text:
1215
+ case SpxInputTypeEnum.overlayNumber:
1216
+ this.textInput?.spxSetFocus();
1217
+ break;
1218
+ case SpxInputTypeEnum.radio:
1219
+ this.radioInput?.spxFocusIn();
1220
+ break;
1221
+ }
1043
1222
  }
1044
1223
  writeValue(value) {
1045
- this.value = this.lastValue = value == null ? '' : value;
1224
+ this.value = this.lastValue = value;
1046
1225
  }
1047
1226
  handleChangeEvent(value) {
1048
1227
  if (value !== this.lastValue) {
@@ -1060,13 +1239,14 @@ class SpxInputComponent {
1060
1239
  this.onTouched = fn;
1061
1240
  }
1062
1241
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1063
- 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: [
1242
+ 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: [
1064
1243
  {
1065
1244
  provide: NG_VALUE_ACCESSOR,
1066
1245
  useExisting: SpxInputComponent,
1067
1246
  multi: true
1068
1247
  }
1069
- ], ngImport: i0, template: `<spx-input-box
1248
+ ], viewQueries: [{ propertyName: "textInput", first: true, predicate: SpxInputTextComponent, descendants: true }, { propertyName: "radioInput", first: true, predicate: SpxInputRadioComponent, descendants: true }], ngImport: i0, template: `<spx-input-box
1249
+ [spxFocused]="this.spxFocused"
1070
1250
  [spxLabel]="this.spxLabel"
1071
1251
  [spxReadonly]="this.spxReadonly"
1072
1252
  [spxRequired]="this.spxRequired"
@@ -1075,14 +1255,15 @@ class SpxInputComponent {
1075
1255
  [spxCompact]="this.spxCompact"
1076
1256
  [spxShowClear]="this.spxShowClear"
1077
1257
  [spxShowEdit]="this.spxShowEdit"
1258
+ [spxShowLabel]="this.spxShowLabel"
1078
1259
  [spxShowSearch]="this.spxShowSearch ? this.spxShowSearch : this.spxType === 'autocomplete'"
1079
1260
  [spxShowValidationMessages]="this.spxShowValidationMessages"
1080
1261
  (spxClear)="this.handleClear()"
1081
1262
  (spxEdit)="this.handleEdit()"
1082
1263
  (spxHelp)="this.handleHelp()"
1083
- (spxFocus)="this.setFocus()"
1264
+ (spxFocus)="this.setFocusIn()"
1084
1265
  (spxFocusOut)="this.setFocusOut()"
1085
- (spxSearchOutput)="this.handleSearch()">
1266
+ (spxSearch)="this.handleSearch()">
1086
1267
  <div controls>
1087
1268
  <spx-input-text
1088
1269
  *ngIf="this.spxType === 'autocomplete' || this.spxType === 'overlay' || this.spxType === 'overlaynumber' || this.spxType === 'text' || this.spxType === 'password'"
@@ -1141,12 +1322,14 @@ class SpxInputComponent {
1141
1322
  [value]="this.value"
1142
1323
  ></spx-input-number>
1143
1324
  <spx-input-radio
1325
+ #radioInput
1144
1326
  *ngIf="this.spxType === 'radio'"
1145
1327
  (spxChange)="this.handleChange($event)"
1146
1328
  (spxFocus)="this.handleFocus()"
1147
1329
  [spxFocused]="this.spxFocused"
1148
1330
  [spxName]="this.spxName"
1149
1331
  [spxReadonly]="this.spxReadonly"
1332
+ [spxShowLabel]="this.spxShowLabel"
1150
1333
  [spxSuggestions]="this.spxSuggestions"
1151
1334
  [spxValidators]="this.spxValidators"
1152
1335
  [value]="this.value"
@@ -1155,7 +1338,7 @@ class SpxInputComponent {
1155
1338
  <div validation-messages>
1156
1339
  <ng-content></ng-content>
1157
1340
  </div>
1158
- </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", "spxSearchOutput", "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"] }] }); }
1341
+ </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"] }] }); }
1159
1342
  }
1160
1343
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputComponent, decorators: [{
1161
1344
  type: Component,
@@ -1182,6 +1365,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1182
1365
  }
1183
1366
  ],
1184
1367
  template: `<spx-input-box
1368
+ [spxFocused]="this.spxFocused"
1185
1369
  [spxLabel]="this.spxLabel"
1186
1370
  [spxReadonly]="this.spxReadonly"
1187
1371
  [spxRequired]="this.spxRequired"
@@ -1190,14 +1374,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1190
1374
  [spxCompact]="this.spxCompact"
1191
1375
  [spxShowClear]="this.spxShowClear"
1192
1376
  [spxShowEdit]="this.spxShowEdit"
1377
+ [spxShowLabel]="this.spxShowLabel"
1193
1378
  [spxShowSearch]="this.spxShowSearch ? this.spxShowSearch : this.spxType === 'autocomplete'"
1194
1379
  [spxShowValidationMessages]="this.spxShowValidationMessages"
1195
1380
  (spxClear)="this.handleClear()"
1196
1381
  (spxEdit)="this.handleEdit()"
1197
1382
  (spxHelp)="this.handleHelp()"
1198
- (spxFocus)="this.setFocus()"
1383
+ (spxFocus)="this.setFocusIn()"
1199
1384
  (spxFocusOut)="this.setFocusOut()"
1200
- (spxSearchOutput)="this.handleSearch()">
1385
+ (spxSearch)="this.handleSearch()">
1201
1386
  <div controls>
1202
1387
  <spx-input-text
1203
1388
  *ngIf="this.spxType === 'autocomplete' || this.spxType === 'overlay' || this.spxType === 'overlaynumber' || this.spxType === 'text' || this.spxType === 'password'"
@@ -1256,12 +1441,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1256
1441
  [value]="this.value"
1257
1442
  ></spx-input-number>
1258
1443
  <spx-input-radio
1444
+ #radioInput
1259
1445
  *ngIf="this.spxType === 'radio'"
1260
1446
  (spxChange)="this.handleChange($event)"
1261
1447
  (spxFocus)="this.handleFocus()"
1262
1448
  [spxFocused]="this.spxFocused"
1263
1449
  [spxName]="this.spxName"
1264
1450
  [spxReadonly]="this.spxReadonly"
1451
+ [spxShowLabel]="this.spxShowLabel"
1265
1452
  [spxSuggestions]="this.spxSuggestions"
1266
1453
  [spxValidators]="this.spxValidators"
1267
1454
  [value]="this.value"
@@ -1298,6 +1485,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1298
1485
  type: Input
1299
1486
  }], spxShowHelp: [{
1300
1487
  type: Input
1488
+ }], spxShowLabel: [{
1489
+ type: Input
1301
1490
  }], spxCompact: [{
1302
1491
  type: Input
1303
1492
  }], spxShowClear: [{
@@ -1332,6 +1521,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1332
1521
  type: Output
1333
1522
  }], spxSearch: [{
1334
1523
  type: Output
1524
+ }], textInput: [{
1525
+ type: ViewChild,
1526
+ args: [SpxInputTextComponent]
1527
+ }], radioInput: [{
1528
+ type: ViewChild,
1529
+ args: [SpxInputRadioComponent]
1335
1530
  }], spxFocused: [{
1336
1531
  type: Input
1337
1532
  }], _handleBlurEvent: [{
@@ -1343,5 +1538,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1343
1538
  * Generated bundle index. Do not edit.
1344
1539
  */
1345
1540
 
1346
- export { SpxInputBoxComponent, SpxInputComponent, SpxInputTextComponent };
1541
+ export { SpxInputBoxComponent, SpxInputComponent, SpxInputTextComponent, SpxInputTypeEnum };
1347
1542
  //# sourceMappingURL=softpak-components-spx-inputs.mjs.map