@softpak/components 0.0.0-beta.8 → 0.0.0-beta.81

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 +91 -0
  17. package/esm2022/spx-inputs/spx-input-box.component.mjs +51 -44
  18. package/esm2022/spx-inputs/spx-input-text.component.mjs +20 -31
  19. package/esm2022/spx-inputs/spx-input-type.enum.mjs +14 -0
  20. package/esm2022/spx-inputs/spx-input.component.mjs +25 -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 -81
  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 +25 -7
  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,98 @@ 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
+ console.log(event.key);
265
+ if (event.key === 'ArrowUp' && this.focusPosition > 0) {
266
+ this.focusPosition--;
267
+ event.preventDefault();
268
+ }
269
+ if (event.key === 'ArrowDown' && this.focusPosition < this.spxSuggestions.length) {
270
+ this.focusPosition++;
271
+ event.preventDefault();
272
+ }
273
+ if (event.key === 'Enter' && this.focusPosition > 0) {
274
+ this.select(this.spxSuggestions.at(this.focusPosition - 1));
275
+ event.preventDefault();
276
+ }
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
+ <div
288
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
289
+ class="text-black block w-full p-2 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-200 flex items-center"
290
+ [class.bg-gray-100]="i === this.focusPosition"
291
+ (click)="this.handleSuggestionClick(valuePair)"
292
+ [attr.tabindex]="0">
293
+ <div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
294
+ <spx-button [spxType]="'button'">Select</spx-button>
295
+ </div>
296
+ </div>
297
+ </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"] }] }); }
298
+ }
299
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxDropdownComponent, decorators: [{
300
+ type: Component,
301
+ args: [{
302
+ selector: 'spx-dropdown',
303
+ standalone: true,
304
+ imports: [
305
+ NgIf,
306
+ NgFor,
307
+ SpxButtonComponent,
308
+ ],
309
+ template: `<div class="relative text-black">
310
+ <div
311
+ class="absolute bg-gray-100 left-0 right-0 z-20">
312
+ <div
313
+ *ngFor="let valuePair of this.spxSuggestions; let i = index"
314
+ class="text-black block w-full p-2 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-200 flex items-center"
315
+ [class.bg-gray-100]="i === this.focusPosition"
316
+ (click)="this.handleSuggestionClick(valuePair)"
317
+ [attr.tabindex]="0">
318
+ <div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
319
+ <spx-button [spxType]="'button'">Select</spx-button>
320
+ </div>
321
+ </div>
322
+ </div>`,
323
+ }]
324
+ }], propDecorators: { spxSuggestions: [{
233
325
  type: Input
326
+ }], spxSelect: [{
327
+ type: Output
234
328
  }] } });
235
329
 
236
330
  class SpxInputTextComponent {
@@ -247,7 +341,7 @@ class SpxInputTextComponent {
247
341
  this.spxWasInternalUpdate = false;
248
342
  }
249
343
  async spxSetFocus() {
250
- // this.elInput.focus();
344
+ this.inputRef?.nativeElement?.focus();
251
345
  }
252
346
  componentDidLoad() {
253
347
  if (this.spxAutofocus) {
@@ -279,8 +373,9 @@ class SpxInputTextComponent {
279
373
  this.spxFocused = true;
280
374
  }
281
375
  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">
376
+ 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
377
  <input
378
+ #input
284
379
  class="font-bold text-lg w-full outline-none"
285
380
  [class.bg-white]="!this.spxReadonly"
286
381
  [class.bg-gray-300]="this.spxReadonly"
@@ -292,27 +387,18 @@ class SpxInputTextComponent {
292
387
  [attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
293
388
  [attr.name]="this.spxName"
294
389
  [attr.type]="this.spxType"
295
- [attr.value]="this.value?.description ? this.value?.description : this.value?.value"
390
+ [value]="this.value?.description ? this.value?.description : this.value?.value"
296
391
  (blur)="this.handleBlur()"
297
392
  (keyUp)="this.handleKeyUp()"
298
393
  (focus)="this.handleFocus()"
299
394
  (input)="this.handleDescriptionInput($event)"
300
395
  />
301
396
  <span *ngIf="this.value?.description && this.value?.value && this.value?.description?.valueOf() !== this.value?.value?.valueOf()">{{this.value?.value}}</span>
302
- <div
397
+ <spx-dropdown
303
398
  *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"] }] }); }
399
+ [spxSuggestions]="this.spxSuggestions" (spxSelect)="this.handleSuggestionClick($event)">
400
+ </spx-dropdown>
401
+ </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
402
  }
317
403
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputTextComponent, decorators: [{
318
404
  type: Component,
@@ -323,9 +409,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
323
409
  NgIf,
324
410
  NgFor,
325
411
  SpxButtonComponent,
412
+ SpxDropdownComponent,
326
413
  ],
327
414
  template: `<div class="relative text-black">
328
415
  <input
416
+ #input
329
417
  class="font-bold text-lg w-full outline-none"
330
418
  [class.bg-white]="!this.spxReadonly"
331
419
  [class.bg-gray-300]="this.spxReadonly"
@@ -337,26 +425,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
337
425
  [attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
338
426
  [attr.name]="this.spxName"
339
427
  [attr.type]="this.spxType"
340
- [attr.value]="this.value?.description ? this.value?.description : this.value?.value"
428
+ [value]="this.value?.description ? this.value?.description : this.value?.value"
341
429
  (blur)="this.handleBlur()"
342
430
  (keyUp)="this.handleKeyUp()"
343
431
  (focus)="this.handleFocus()"
344
432
  (input)="this.handleDescriptionInput($event)"
345
433
  />
346
434
  <span *ngIf="this.value?.description && this.value?.value && this.value?.description?.valueOf() !== this.value?.value?.valueOf()">{{this.value?.value}}</span>
347
- <div
435
+ <spx-dropdown
348
436
  *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>
437
+ [spxSuggestions]="this.spxSuggestions" (spxSelect)="this.handleSuggestionClick($event)">
438
+ </spx-dropdown>
360
439
  </div>`,
361
440
  }]
362
441
  }], propDecorators: { spxName: [{
@@ -389,6 +468,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
389
468
  type: Output
390
469
  }], spxWasInternalUpdate: [{
391
470
  type: Input
471
+ }], inputRef: [{
472
+ type: ViewChild,
473
+ args: ['input', { static: true }]
392
474
  }] } });
393
475
 
394
476
  class SpxInputDateComponent {
@@ -968,6 +1050,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
968
1050
  type: Output
969
1051
  }] } });
970
1052
 
1053
+ var SpxInputTypeEnum;
1054
+ (function (SpxInputTypeEnum) {
1055
+ SpxInputTypeEnum["autocomplete"] = "autocomplete";
1056
+ SpxInputTypeEnum["date"] = "date";
1057
+ SpxInputTypeEnum["float"] = "float";
1058
+ SpxInputTypeEnum["overlay"] = "overlay";
1059
+ SpxInputTypeEnum["overlayNumber"] = "overlaynumber";
1060
+ SpxInputTypeEnum["radio"] = "radio";
1061
+ SpxInputTypeEnum["number"] = "number";
1062
+ SpxInputTypeEnum["password"] = "password";
1063
+ SpxInputTypeEnum["text"] = "text";
1064
+ SpxInputTypeEnum["textNumericKeyboard"] = "textNumericKeyboard";
1065
+ })(SpxInputTypeEnum || (SpxInputTypeEnum = {}));
1066
+
971
1067
  class SpxInputComponent {
972
1068
  constructor() {
973
1069
  this.spxLabel = 'label';
@@ -983,7 +1079,7 @@ class SpxInputComponent {
983
1079
  this.spxShowSearch = false;
984
1080
  this.spxShowValidationMessages = false;
985
1081
  this.spxSuggestions = [];
986
- this.spxType = 'text';
1082
+ this.spxType = SpxInputTypeEnum.text;
987
1083
  this.spxCapitalize = false;
988
1084
  this.spxBlur = new EventEmitter();
989
1085
  this.spxClear = new EventEmitter();
@@ -996,9 +1092,6 @@ class SpxInputComponent {
996
1092
  this.onChange = () => { };
997
1093
  this.onTouched = () => { };
998
1094
  }
999
- async spxSetFocus() {
1000
- this.passFocusToControl();
1001
- }
1002
1095
  handleBlur() {
1003
1096
  this.spxBlur.emit();
1004
1097
  }
@@ -1007,6 +1100,7 @@ class SpxInputComponent {
1007
1100
  this.spxChange.emit(this.value);
1008
1101
  }
1009
1102
  handleClear() {
1103
+ this.spxClear.emit();
1010
1104
  this.spxFocused = true;
1011
1105
  this.passFocusToControl();
1012
1106
  this.value = {
@@ -1016,6 +1110,7 @@ class SpxInputComponent {
1016
1110
  this.spxChange.emit(this.value);
1017
1111
  }
1018
1112
  handleFocus() {
1113
+ this.spxFocus.emit();
1019
1114
  this.spxFocused = true;
1020
1115
  // this.elBox.spxSetFocus();
1021
1116
  }
@@ -1030,15 +1125,24 @@ class SpxInputComponent {
1030
1125
  this.spxFocused = false;
1031
1126
  }
1032
1127
  handleEdit() {
1128
+ this.spxEdit.emit();
1033
1129
  this.spxFocused = true;
1034
1130
  }
1035
1131
  handleHelp() {
1132
+ this.spxHelp.emit();
1036
1133
  this.spxFocused = true;
1037
1134
  }
1038
1135
  passFocusToControl() {
1136
+ switch (this.spxType) {
1137
+ case SpxInputTypeEnum.autocomplete:
1138
+ case SpxInputTypeEnum.text:
1139
+ case SpxInputTypeEnum.overlayNumber:
1140
+ this.textInput?.spxSetFocus();
1141
+ break;
1142
+ }
1039
1143
  }
1040
1144
  writeValue(value) {
1041
- this.value = this.lastValue = value == null ? '' : value;
1145
+ this.value = this.lastValue = value;
1042
1146
  }
1043
1147
  handleChangeEvent(value) {
1044
1148
  if (value !== this.lastValue) {
@@ -1062,7 +1166,8 @@ class SpxInputComponent {
1062
1166
  useExisting: SpxInputComponent,
1063
1167
  multi: true
1064
1168
  }
1065
- ], ngImport: i0, template: `<spx-input-box
1169
+ ], viewQueries: [{ propertyName: "textInput", first: true, predicate: SpxInputTextComponent, descendants: true }], ngImport: i0, template: `<spx-input-box
1170
+ [spxFocused]="this.spxFocused"
1066
1171
  [spxLabel]="this.spxLabel"
1067
1172
  [spxReadonly]="this.spxReadonly"
1068
1173
  [spxRequired]="this.spxRequired"
@@ -1078,7 +1183,7 @@ class SpxInputComponent {
1078
1183
  (spxHelp)="this.handleHelp()"
1079
1184
  (spxFocus)="this.setFocus()"
1080
1185
  (spxFocusOut)="this.setFocusOut()"
1081
- (spxSearchOutput)="this.handleSearch()">
1186
+ (spxSearch)="this.handleSearch()">
1082
1187
  <div controls>
1083
1188
  <spx-input-text
1084
1189
  *ngIf="this.spxType === 'autocomplete' || this.spxType === 'overlay' || this.spxType === 'overlaynumber' || this.spxType === 'text' || this.spxType === 'password'"
@@ -1151,7 +1256,7 @@ class SpxInputComponent {
1151
1256
  <div validation-messages>
1152
1257
  <ng-content></ng-content>
1153
1258
  </div>
1154
- </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"] }] }); }
1259
+ </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"] }] }); }
1155
1260
  }
1156
1261
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputComponent, decorators: [{
1157
1262
  type: Component,
@@ -1178,6 +1283,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1178
1283
  }
1179
1284
  ],
1180
1285
  template: `<spx-input-box
1286
+ [spxFocused]="this.spxFocused"
1181
1287
  [spxLabel]="this.spxLabel"
1182
1288
  [spxReadonly]="this.spxReadonly"
1183
1289
  [spxRequired]="this.spxRequired"
@@ -1193,7 +1299,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1193
1299
  (spxHelp)="this.handleHelp()"
1194
1300
  (spxFocus)="this.setFocus()"
1195
1301
  (spxFocusOut)="this.setFocusOut()"
1196
- (spxSearchOutput)="this.handleSearch()">
1302
+ (spxSearch)="this.handleSearch()">
1197
1303
  <div controls>
1198
1304
  <spx-input-text
1199
1305
  *ngIf="this.spxType === 'autocomplete' || this.spxType === 'overlay' || this.spxType === 'overlaynumber' || this.spxType === 'text' || this.spxType === 'password'"
@@ -1328,6 +1434,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1328
1434
  type: Output
1329
1435
  }], spxSearch: [{
1330
1436
  type: Output
1437
+ }], textInput: [{
1438
+ type: ViewChild,
1439
+ args: [SpxInputTextComponent]
1331
1440
  }], spxFocused: [{
1332
1441
  type: Input
1333
1442
  }], _handleBlurEvent: [{
@@ -1339,5 +1448,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
1339
1448
  * Generated bundle index. Do not edit.
1340
1449
  */
1341
1450
 
1342
- export { SpxInputBoxComponent, SpxInputComponent, SpxInputTextComponent };
1451
+ export { SpxInputBoxComponent, SpxInputComponent, SpxInputTextComponent, SpxInputTypeEnum };
1343
1452
  //# sourceMappingURL=softpak-components-spx-inputs.mjs.map