@softpak/components 0.0.0-beta.9 → 0.0.0-beta.91

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 (84) hide show
  1. package/esm2022/spx-alert/spx-alert.component.mjs +9 -4
  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 +5 -4
  7. package/esm2022/spx-channel-selection/src/spx-company-selection.component.mjs +5 -4
  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 +95 -0
  17. package/esm2022/spx-inputs/spx-input-box.component.mjs +51 -44
  18. package/esm2022/spx-inputs/spx-input-text.component.mjs +20 -32
  19. package/esm2022/spx-inputs/spx-input-type.enum.mjs +14 -0
  20. package/esm2022/spx-inputs/spx-input.component.mjs +21 -11
  21. package/esm2022/spx-navigation/spx-home-tile.component.mjs +29 -10
  22. package/esm2022/spx-navigation/spx-navigation-item.interface.mjs +1 -1
  23. package/esm2022/spx-navigation/spx-navigation.component.mjs +11 -5
  24. package/esm2022/spx-number-check/public-api.mjs +2 -0
  25. package/esm2022/spx-number-check/softpak-components-spx-number-check.mjs +5 -0
  26. package/esm2022/spx-number-check/spx-number-check.component.mjs +262 -0
  27. package/esm2022/spx-progress-bar/spx-progress-bar.component.mjs +3 -3
  28. package/esm2022/spx-spinner/spx-spinner.component.mjs +5 -5
  29. package/esm2022/spx-suggestion/spx-suggestion.component.mjs +10 -6
  30. package/esm2022/spx-toaster/src/spx-toaster.component.mjs +33 -21
  31. package/fesm2022/softpak-components-spx-alert.mjs +8 -3
  32. package/fesm2022/softpak-components-spx-alert.mjs.map +1 -1
  33. package/fesm2022/softpak-components-spx-change-details.mjs +125 -0
  34. package/fesm2022/softpak-components-spx-change-details.mjs.map +1 -0
  35. package/fesm2022/softpak-components-spx-channel-selection.mjs +7 -5
  36. package/fesm2022/softpak-components-spx-channel-selection.mjs.map +1 -1
  37. package/fesm2022/softpak-components-spx-check-digit.mjs +5 -3
  38. package/fesm2022/softpak-components-spx-check-digit.mjs.map +1 -1
  39. package/fesm2022/softpak-components-spx-form-section.mjs +6 -6
  40. package/fesm2022/softpak-components-spx-form-section.mjs.map +1 -1
  41. package/fesm2022/softpak-components-spx-form-view.mjs +170 -0
  42. package/fesm2022/softpak-components-spx-form-view.mjs.map +1 -0
  43. package/fesm2022/softpak-components-spx-inputs.mjs +190 -82
  44. package/fesm2022/softpak-components-spx-inputs.mjs.map +1 -1
  45. package/fesm2022/softpak-components-spx-navigation.mjs +37 -12
  46. package/fesm2022/softpak-components-spx-navigation.mjs.map +1 -1
  47. package/fesm2022/softpak-components-spx-number-check.mjs +269 -0
  48. package/fesm2022/softpak-components-spx-number-check.mjs.map +1 -0
  49. package/fesm2022/softpak-components-spx-progress-bar.mjs +2 -2
  50. package/fesm2022/softpak-components-spx-progress-bar.mjs.map +1 -1
  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 +9 -5
  54. package/fesm2022/softpak-components-spx-suggestion.mjs.map +1 -1
  55. package/fesm2022/softpak-components-spx-toaster.mjs +32 -20
  56. package/fesm2022/softpak-components-spx-toaster.mjs.map +1 -1
  57. package/package.json +29 -11
  58. package/spx-change-details/index.d.ts +5 -0
  59. package/spx-change-details/public-api.d.ts +1 -0
  60. package/spx-change-details/spx-change-details-value.interface.d.ts +7 -0
  61. package/spx-change-details/spx-change-details.component.d.ts +40 -0
  62. package/spx-channel-selection/src/spx-channel-selection.component.d.ts +2 -1
  63. package/spx-channel-selection/src/spx-company-selection.component.d.ts +2 -1
  64. package/spx-check-digit/spx-check-digit.component.d.ts +3 -0
  65. package/spx-form-view/index.d.ts +5 -0
  66. package/spx-form-view/public-api.d.ts +3 -0
  67. package/spx-form-view/spx-form-field.interface.d.ts +16 -0
  68. package/spx-form-view/spx-form-section.interface.d.ts +9 -0
  69. package/spx-form-view/spx-form-view.component.d.ts +27 -0
  70. package/spx-inputs/public-api.d.ts +1 -0
  71. package/spx-inputs/spx-dropdown.component.d.ts +18 -0
  72. package/spx-inputs/spx-input-box.component.d.ts +8 -5
  73. package/spx-inputs/spx-input-text.component.d.ts +2 -1
  74. package/spx-inputs/spx-input-type.enum.d.ts +12 -0
  75. package/spx-inputs/spx-input.component.d.ts +4 -2
  76. package/spx-navigation/spx-home-tile.component.d.ts +5 -1
  77. package/spx-navigation/spx-navigation-item.interface.d.ts +1 -0
  78. package/spx-navigation/spx-navigation.component.d.ts +4 -1
  79. package/spx-number-check/index.d.ts +5 -0
  80. package/spx-number-check/public-api.d.ts +1 -0
  81. package/spx-number-check/spx-number-check.component.d.ts +48 -0
  82. package/spx-suggestion/spx-suggestion.component.d.ts +1 -0
  83. package/spx-toaster/src/spx-toaster.component.d.ts +1 -1
  84. package/tailwind.css +1 -1
@@ -1,54 +1,37 @@
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;
17
+ handleFocusOut() {
18
+ this.spxFocusOut.emit();
27
19
  }
28
- // @Listen('focusout', { capture: true })
29
- // handleFocusOut() {
30
- // this.spxFocused = false;
31
- // this.spxFocusOut.emit();
32
- // }
33
- // @Listen('click', { target: 'window' })
34
- // handleWindowClick(ev) {
35
- // if (ev.composedPath().includes(this.el)) {
36
- // if (!this.spxFocused) {
37
- // this.spxFocused = true;
38
- // this.spxFocus.emit();
39
- // }
40
- // } else {
41
- // this.spxFocused = false;
42
- // }
43
- // }
44
- async spxSetFocus() {
45
- this.spxFocused = true;
20
+ handleWindowClick(ev) {
21
+ if (ev.composedPath().includes(this.elRef.nativeElement)) {
22
+ if (!this.spxFocused) {
23
+ this.spxFocus.emit();
24
+ }
25
+ }
26
+ else {
27
+ this.spxFocused = false;
28
+ }
46
29
  }
47
30
  onClear() {
48
31
  this.spxClear.emit();
49
32
  }
50
33
  onSearch() {
51
- this.spxSearchOutput.emit();
34
+ this.spxSearch.emit();
52
35
  }
53
36
  onEdit() {
54
37
  this.spxEdit.emit();
@@ -56,8 +39,25 @@ class SpxInputBoxComponent {
56
39
  onHelp() {
57
40
  this.spxHelp.emit();
58
41
  }
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"
42
+ constructor(elRef) {
43
+ this.elRef = elRef;
44
+ this.faEdit = faEdit;
45
+ this.faSearch = faSearch;
46
+ this.faQuestion = faQuestion;
47
+ this.faTimes = faTimes;
48
+ // @Element() el: HTMLElement;
49
+ this.spxFocused = false;
50
+ this.spxReadonly = false;
51
+ this.spxShowClear = true;
52
+ this.spxClear = new EventEmitter();
53
+ this.spxSearch = new EventEmitter();
54
+ this.spxFocus = new EventEmitter();
55
+ this.spxFocusOut = new EventEmitter();
56
+ this.spxEdit = new EventEmitter();
57
+ this.spxHelp = new EventEmitter();
58
+ }
59
+ 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 }); }
60
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputBoxComponent, isStandalone: true, selector: "spx-input-box", inputs: { spxFocused: "spxFocused", spxLabel: "spxLabel", spxRequired: "spxRequired", spxReadonly: "spxReadonly", spxShowHelp: "spxShowHelp", spxCompact: "spxCompact", spxShowClear: "spxShowClear", spxShowEdit: "spxShowEdit", spxShowSearch: "spxShowSearch", spxShowValidationMessages: "spxShowValidationMessages", spxValue: "spxValue" }, outputs: { spxClear: "spxClear", spxSearch: "spxSearch", spxFocus: "spxFocus", spxFocusOut: "spxFocusOut", spxEdit: "spxEdit", spxHelp: "spxHelp" }, host: { listeners: { "focusout": "handleFocusOut()", "document:click": "handleWindowClick($event)" } }, ngImport: i0, template: `<div class="flex rounded w-full gap-3"
61
61
  [class.rounded-none]="this.spxShowValidationMessages"
62
62
  [class.rounded-t]="this.spxShowValidationMessages"
63
63
  [class.outline-none]="this.spxFocused && !this.spxReadonly"
@@ -84,7 +84,6 @@ class SpxInputBoxComponent {
84
84
  (spxClick)="onEdit()"
85
85
  [spxFullHeight]="true"
86
86
  [spxSize]="'xl'"
87
- [spxTabIndex]="-1"
88
87
  [spxType]="'button'">
89
88
  <fa-icon [icon]="faEdit" class="block text-xl"></fa-icon>
90
89
  </spx-button>
@@ -92,6 +91,7 @@ class SpxInputBoxComponent {
92
91
  *ngIf="this.spxShowHelp"
93
92
  (spxClick)="onHelp()"
94
93
  [spxFullHeight]="true"
94
+ [spxDisabled]="this.spxReadonly"
95
95
  [spxSize]="'xl'"
96
96
  [spxTabIndex]="-1"
97
97
  [spxType]="'button'">
@@ -101,6 +101,7 @@ class SpxInputBoxComponent {
101
101
  *ngIf="this.spxShowSearch"
102
102
  (spxClick)="onSearch()"
103
103
  [spxFullHeight]="true"
104
+ [spxDisabled]="this.spxReadonly"
104
105
  [spxSize]="'xl'"
105
106
  [spxTabIndex]="-1"
106
107
  [spxType]="'button'">
@@ -159,7 +160,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
159
160
  (spxClick)="onEdit()"
160
161
  [spxFullHeight]="true"
161
162
  [spxSize]="'xl'"
162
- [spxTabIndex]="-1"
163
163
  [spxType]="'button'">
164
164
  <fa-icon [icon]="faEdit" class="block text-xl"></fa-icon>
165
165
  </spx-button>
@@ -167,6 +167,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
167
167
  *ngIf="this.spxShowHelp"
168
168
  (spxClick)="onHelp()"
169
169
  [spxFullHeight]="true"
170
+ [spxDisabled]="this.spxReadonly"
170
171
  [spxSize]="'xl'"
171
172
  [spxTabIndex]="-1"
172
173
  [spxType]="'button'">
@@ -176,6 +177,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
176
177
  *ngIf="this.spxShowSearch"
177
178
  (spxClick)="onSearch()"
178
179
  [spxFullHeight]="true"
180
+ [spxDisabled]="this.spxReadonly"
179
181
  [spxSize]="'xl'"
180
182
  [spxTabIndex]="-1"
181
183
  [spxType]="'button'">
@@ -197,7 +199,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
197
199
  <ng-content select="[validation-messages]"></ng-content>
198
200
  </div>`,
199
201
  }]
200
- }], propDecorators: { spxLabel: [{
202
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { spxFocused: [{
203
+ type: Input
204
+ }], spxLabel: [{
201
205
  type: Input
202
206
  }], spxRequired: [{
203
207
  type: Input
@@ -219,7 +223,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
219
223
  type: Input
220
224
  }], spxClear: [{
221
225
  type: Output
222
- }], spxSearchOutput: [{
226
+ }], spxSearch: [{
223
227
  type: Output
224
228
  }], spxFocus: [{
225
229
  type: Output
@@ -229,8 +233,102 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
229
233
  type: Output
230
234
  }], spxHelp: [{
231
235
  type: Output
232
- }], spxFocused: [{
236
+ }], handleFocusOut: [{
237
+ type: HostListener,
238
+ args: ['focusout']
239
+ }], handleWindowClick: [{
240
+ type: HostListener,
241
+ args: ['document:click', ["$event"]]
242
+ }] } });
243
+
244
+ class SpxDropdownComponent {
245
+ constructor() {
246
+ this.focusPosition = 0;
247
+ this.spxSuggestions = [];
248
+ this.spxSelect = new EventEmitter();
249
+ }
250
+ ngOnInit() {
251
+ this.listenToKeyUp();
252
+ }
253
+ ngOnChanges(changes) {
254
+ this.focusPosition = 0;
255
+ }
256
+ ngOnDestroy() {
257
+ this.subscriptionKeyUp?.unsubscribe();
258
+ }
259
+ handleSuggestionClick(valuePair) {
260
+ this.select(valuePair);
261
+ }
262
+ listenToKeyUp() {
263
+ this.subscriptionKeyUp = fromEvent(window, 'keyup').subscribe((event) => {
264
+ if (event.key === 'ArrowUp' && this.focusPosition > 0) {
265
+ this.focusPosition = this.focusPosition - 1;
266
+ event.preventDefault();
267
+ }
268
+ if (event.key === 'ArrowDown' && this.focusPosition < this.spxSuggestions.length - 1) {
269
+ this.focusPosition = this.focusPosition + 1;
270
+ event.preventDefault();
271
+ }
272
+ if (event.key === 'Enter' && this.spxSuggestions.length > 0) {
273
+ this.select(this.spxSuggestions.at(this.focusPosition));
274
+ event.preventDefault();
275
+ }
276
+ console.log(this.focusPosition);
277
+ });
278
+ }
279
+ select(valuePair) {
280
+ this.focusPosition = 0;
281
+ this.spxSelect.emit(valuePair);
282
+ }
283
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
284
+ 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">
285
+ <div
286
+ class="absolute bg-gray-100 left-0 right-0 z-20">
287
+ <button
288
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
289
+ class="text-black block w-full p-2 border border-gray-200 rounded-lg shadow hover:bg-gray-200 flex items-center text-left"
290
+ [class.bg-gray-100]="i === this.focusPosition"
291
+ [class.bg-white]="i !== this.focusPosition"
292
+ (click)="this.handleSuggestionClick(valuePair)"
293
+ [attr.tabindex]="0"
294
+ [type]="'button'">
295
+ <div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
296
+ <spx-button (spxClick)="this.handleSuggestionClick(valuePair)" [spxType]="'button'">Select</spx-button>
297
+ </button>
298
+ </div>
299
+ </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"] }] }); }
300
+ }
301
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxDropdownComponent, decorators: [{
302
+ type: Component,
303
+ args: [{
304
+ selector: 'spx-dropdown',
305
+ standalone: true,
306
+ imports: [
307
+ NgIf,
308
+ NgFor,
309
+ SpxButtonComponent,
310
+ ],
311
+ template: `<div class="relative text-black">
312
+ <div
313
+ class="absolute bg-gray-100 left-0 right-0 z-20">
314
+ <button
315
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
316
+ class="text-black block w-full p-2 border border-gray-200 rounded-lg shadow hover:bg-gray-200 flex items-center text-left"
317
+ [class.bg-gray-100]="i === this.focusPosition"
318
+ [class.bg-white]="i !== this.focusPosition"
319
+ (click)="this.handleSuggestionClick(valuePair)"
320
+ [attr.tabindex]="0"
321
+ [type]="'button'">
322
+ <div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
323
+ <spx-button (spxClick)="this.handleSuggestionClick(valuePair)" [spxType]="'button'">Select</spx-button>
324
+ </button>
325
+ </div>
326
+ </div>`,
327
+ }]
328
+ }], propDecorators: { spxSuggestions: [{
233
329
  type: Input
330
+ }], spxSelect: [{
331
+ type: Output
234
332
  }] } });
235
333
 
236
334
  class SpxInputTextComponent {
@@ -247,7 +345,7 @@ class SpxInputTextComponent {
247
345
  this.spxWasInternalUpdate = false;
248
346
  }
249
347
  async spxSetFocus() {
250
- // this.elInput.focus();
348
+ this.inputRef?.nativeElement?.focus();
251
349
  }
252
350
  componentDidLoad() {
253
351
  if (this.spxAutofocus) {
@@ -272,15 +370,15 @@ class SpxInputTextComponent {
272
370
  if (!this.spxReadonly) {
273
371
  this.value = value;
274
372
  this.spxChange.emit(this.value);
275
- this.spxFocused = false;
276
373
  }
277
374
  }
278
375
  handleKeyUp() {
279
376
  this.spxFocused = true;
280
377
  }
281
378
  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">
379
+ 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
380
  <input
381
+ #input
284
382
  class="font-bold text-lg w-full outline-none"
285
383
  [class.bg-white]="!this.spxReadonly"
286
384
  [class.bg-gray-300]="this.spxReadonly"
@@ -292,27 +390,18 @@ class SpxInputTextComponent {
292
390
  [attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
293
391
  [attr.name]="this.spxName"
294
392
  [attr.type]="this.spxType"
295
- [attr.value]="this.value?.description ? this.value?.description : this.value?.value"
393
+ [value]="this.value?.description ? this.value?.description : this.value?.value"
296
394
  (blur)="this.handleBlur()"
297
395
  (keyUp)="this.handleKeyUp()"
298
396
  (focus)="this.handleFocus()"
299
397
  (input)="this.handleDescriptionInput($event)"
300
398
  />
301
399
  <span *ngIf="this.value?.description && this.value?.value && this.value?.description?.valueOf() !== this.value?.value?.valueOf()">{{this.value?.value}}</span>
302
- <div
400
+ <spx-dropdown
303
401
  *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"] }] }); }
402
+ [spxSuggestions]="this.spxSuggestions" (spxSelect)="this.handleSuggestionClick($event)">
403
+ </spx-dropdown>
404
+ </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
405
  }
317
406
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputTextComponent, decorators: [{
318
407
  type: Component,
@@ -323,9 +412,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
323
412
  NgIf,
324
413
  NgFor,
325
414
  SpxButtonComponent,
415
+ SpxDropdownComponent,
326
416
  ],
327
417
  template: `<div class="relative text-black">
328
418
  <input
419
+ #input
329
420
  class="font-bold text-lg w-full outline-none"
330
421
  [class.bg-white]="!this.spxReadonly"
331
422
  [class.bg-gray-300]="this.spxReadonly"
@@ -337,26 +428,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
337
428
  [attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
338
429
  [attr.name]="this.spxName"
339
430
  [attr.type]="this.spxType"
340
- [attr.value]="this.value?.description ? this.value?.description : this.value?.value"
431
+ [value]="this.value?.description ? this.value?.description : this.value?.value"
341
432
  (blur)="this.handleBlur()"
342
433
  (keyUp)="this.handleKeyUp()"
343
434
  (focus)="this.handleFocus()"
344
435
  (input)="this.handleDescriptionInput($event)"
345
436
  />
346
437
  <span *ngIf="this.value?.description && this.value?.value && this.value?.description?.valueOf() !== this.value?.value?.valueOf()">{{this.value?.value}}</span>
347
- <div
438
+ <spx-dropdown
348
439
  *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>
440
+ [spxSuggestions]="this.spxSuggestions" (spxSelect)="this.handleSuggestionClick($event)">
441
+ </spx-dropdown>
360
442
  </div>`,
361
443
  }]
362
444
  }], propDecorators: { spxName: [{
@@ -389,6 +471,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
389
471
  type: Output
390
472
  }], spxWasInternalUpdate: [{
391
473
  type: Input
474
+ }], inputRef: [{
475
+ type: ViewChild,
476
+ args: ['input', { static: true }]
392
477
  }] } });
393
478
 
394
479
  class SpxInputDateComponent {
@@ -968,6 +1053,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
968
1053
  type: Output
969
1054
  }] } });
970
1055
 
1056
+ var SpxInputTypeEnum;
1057
+ (function (SpxInputTypeEnum) {
1058
+ SpxInputTypeEnum["autocomplete"] = "autocomplete";
1059
+ SpxInputTypeEnum["date"] = "date";
1060
+ SpxInputTypeEnum["float"] = "float";
1061
+ SpxInputTypeEnum["overlay"] = "overlay";
1062
+ SpxInputTypeEnum["overlayNumber"] = "overlaynumber";
1063
+ SpxInputTypeEnum["radio"] = "radio";
1064
+ SpxInputTypeEnum["number"] = "number";
1065
+ SpxInputTypeEnum["password"] = "password";
1066
+ SpxInputTypeEnum["text"] = "text";
1067
+ SpxInputTypeEnum["textNumericKeyboard"] = "textNumericKeyboard";
1068
+ })(SpxInputTypeEnum || (SpxInputTypeEnum = {}));
1069
+
971
1070
  class SpxInputComponent {
972
1071
  constructor() {
973
1072
  this.spxLabel = 'label';
@@ -983,7 +1082,7 @@ class SpxInputComponent {
983
1082
  this.spxShowSearch = false;
984
1083
  this.spxShowValidationMessages = false;
985
1084
  this.spxSuggestions = [];
986
- this.spxType = 'text';
1085
+ this.spxType = SpxInputTypeEnum.text;
987
1086
  this.spxCapitalize = false;
988
1087
  this.spxBlur = new EventEmitter();
989
1088
  this.spxClear = new EventEmitter();
@@ -996,9 +1095,6 @@ class SpxInputComponent {
996
1095
  this.onChange = () => { };
997
1096
  this.onTouched = () => { };
998
1097
  }
999
- async spxSetFocus() {
1000
- this.passFocusToControl();
1001
- }
1002
1098
  handleBlur() {
1003
1099
  this.spxBlur.emit();
1004
1100
  }
@@ -1040,9 +1136,16 @@ class SpxInputComponent {
1040
1136
  this.spxFocused = true;
1041
1137
  }
1042
1138
  passFocusToControl() {
1139
+ switch (this.spxType) {
1140
+ case SpxInputTypeEnum.autocomplete:
1141
+ case SpxInputTypeEnum.text:
1142
+ case SpxInputTypeEnum.overlayNumber:
1143
+ this.textInput?.spxSetFocus();
1144
+ break;
1145
+ }
1043
1146
  }
1044
1147
  writeValue(value) {
1045
- this.value = this.lastValue = value == null ? '' : value;
1148
+ this.value = this.lastValue = value;
1046
1149
  }
1047
1150
  handleChangeEvent(value) {
1048
1151
  if (value !== this.lastValue) {
@@ -1066,7 +1169,8 @@ class SpxInputComponent {
1066
1169
  useExisting: SpxInputComponent,
1067
1170
  multi: true
1068
1171
  }
1069
- ], ngImport: i0, template: `<spx-input-box
1172
+ ], viewQueries: [{ propertyName: "textInput", first: true, predicate: SpxInputTextComponent, descendants: true }], ngImport: i0, template: `<spx-input-box
1173
+ [spxFocused]="this.spxFocused"
1070
1174
  [spxLabel]="this.spxLabel"
1071
1175
  [spxReadonly]="this.spxReadonly"
1072
1176
  [spxRequired]="this.spxRequired"
@@ -1082,7 +1186,7 @@ class SpxInputComponent {
1082
1186
  (spxHelp)="this.handleHelp()"
1083
1187
  (spxFocus)="this.setFocus()"
1084
1188
  (spxFocusOut)="this.setFocusOut()"
1085
- (spxSearchOutput)="this.handleSearch()">
1189
+ (spxSearch)="this.handleSearch()">
1086
1190
  <div controls>
1087
1191
  <spx-input-text
1088
1192
  *ngIf="this.spxType === 'autocomplete' || this.spxType === 'overlay' || this.spxType === 'overlaynumber' || this.spxType === 'text' || this.spxType === 'password'"
@@ -1155,7 +1259,7 @@ class SpxInputComponent {
1155
1259
  <div validation-messages>
1156
1260
  <ng-content></ng-content>
1157
1261
  </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"] }] }); }
1262
+ </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: ["spxFocused", "spxLabel", "spxRequired", "spxReadonly", "spxShowHelp", "spxCompact", "spxShowClear", "spxShowEdit", "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", "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
1263
  }
1160
1264
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputComponent, decorators: [{
1161
1265
  type: Component,
@@ -1182,6 +1286,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1182
1286
  }
1183
1287
  ],
1184
1288
  template: `<spx-input-box
1289
+ [spxFocused]="this.spxFocused"
1185
1290
  [spxLabel]="this.spxLabel"
1186
1291
  [spxReadonly]="this.spxReadonly"
1187
1292
  [spxRequired]="this.spxRequired"
@@ -1197,7 +1302,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1197
1302
  (spxHelp)="this.handleHelp()"
1198
1303
  (spxFocus)="this.setFocus()"
1199
1304
  (spxFocusOut)="this.setFocusOut()"
1200
- (spxSearchOutput)="this.handleSearch()">
1305
+ (spxSearch)="this.handleSearch()">
1201
1306
  <div controls>
1202
1307
  <spx-input-text
1203
1308
  *ngIf="this.spxType === 'autocomplete' || this.spxType === 'overlay' || this.spxType === 'overlaynumber' || this.spxType === 'text' || this.spxType === 'password'"
@@ -1332,6 +1437,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1332
1437
  type: Output
1333
1438
  }], spxSearch: [{
1334
1439
  type: Output
1440
+ }], textInput: [{
1441
+ type: ViewChild,
1442
+ args: [SpxInputTextComponent]
1335
1443
  }], spxFocused: [{
1336
1444
  type: Input
1337
1445
  }], _handleBlurEvent: [{
@@ -1343,5 +1451,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1343
1451
  * Generated bundle index. Do not edit.
1344
1452
  */
1345
1453
 
1346
- export { SpxInputBoxComponent, SpxInputComponent, SpxInputTextComponent };
1454
+ export { SpxInputBoxComponent, SpxInputComponent, SpxInputTextComponent, SpxInputTypeEnum };
1347
1455
  //# sourceMappingURL=softpak-components-spx-inputs.mjs.map