@softpak/components 0.1.3-beta.9 → 0.1.4-beta.2

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.
@@ -1,6 +1,6 @@
1
1
  import { NgIf, NgFor } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { EventEmitter, Component, Input, Output, HostListener, ViewChild, inject } 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';
@@ -13,7 +13,9 @@ import { NG_VALUE_ACCESSOR } from '@angular/forms';
13
13
  import { SpxSuggestionComponent } from '@softpak/components/spx-suggestion';
14
14
  import { DateTime } from 'luxon';
15
15
  import { valuePairToValue, SpxSeverityEnum } from '@softpak/components/spx-helpers';
16
- import { ModalController, IonButtons, IonContent, IonHeader, IonToolbar, IonTitle } from '@ionic/angular/standalone';
16
+ import { faXmark } from '@fortawesome/free-solid-svg-icons';
17
+ import * as i1$1 from '@ionic/angular';
18
+ import { IonicModule } from '@ionic/angular';
17
19
 
18
20
  class SpxInputBoxComponent {
19
21
  handleFocusIn(ev) {
@@ -1171,53 +1173,56 @@ var SpxInputTypeEnum;
1171
1173
  })(SpxInputTypeEnum || (SpxInputTypeEnum = {}));
1172
1174
 
1173
1175
  class SpxInputTimeModalComponent {
1174
- constructor() {
1176
+ constructor(modalController) {
1177
+ this.modalController = modalController;
1175
1178
  this.change = new EventEmitter();
1179
+ this.faXmark = faXmark;
1176
1180
  this.hourOptions = Array.from({ length: 24 }, (_, i) => i); // 0 to 23
1177
1181
  this.minuteOptions = Array.from({ length: 12 }, (_, i) => i * 5); // Minutes in incrementen van 5
1178
- this.modalController = inject(ModalController);
1179
1182
  this.typeError = SpxSeverityEnum.error;
1180
1183
  this.hourOptions.push(this.hourOptions.shift());
1184
+ this.minuteOptions.push(this.minuteOptions.shift());
1181
1185
  }
1182
1186
  closeDialog() {
1183
1187
  this.modalController.dismiss();
1184
1188
  }
1185
1189
  onChange(value) {
1186
1190
  this.change.emit(value);
1191
+ console.log(value);
1187
1192
  this.modalController.dismiss(value);
1188
1193
  }
1189
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: SpxInputTimeModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1194
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: SpxInputTimeModalComponent, deps: [{ token: i1$1.ModalController }], target: i0.ɵɵFactoryTarget.Component }); }
1190
1195
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: SpxInputTimeModalComponent, isStandalone: true, selector: "spx-input-time-modal", inputs: { view: "view", value: "value" }, outputs: { change: "change" }, ngImport: i0, template: `<ion-header>
1191
1196
  <ion-toolbar>
1192
- <ion-title>Inline Modal</ion-title>
1197
+ <ion-title>Select {{view}}</ion-title>
1193
1198
  <ion-buttons slot="end">
1194
- <spx-button [spxSeverity]="typeError" (spxClick)="closeDialog()">Close</spx-button>
1199
+ <spx-button [spxSeverity]="typeError" (spxClick)="closeDialog()">
1200
+ <fa-icon [icon]="faXmark"></fa-icon>
1201
+ </spx-button>
1195
1202
  </ion-buttons>
1196
1203
  </ion-toolbar>
1197
1204
  </ion-header>
1198
- <ion-content class="ion-padding">
1205
+ <ion-content class="ion-padding bg-white">
1199
1206
  <!-- Uren -->
1200
- <div class="grid grid-cols-1 gap-3">
1207
+ <div class="custom-bg grid grid-cols-1 gap-3">
1201
1208
  <div *ngIf="view === 'hours'" class="flex-wrap gap-2">
1202
- <p> Select Hour </p>
1203
- <div class="grid grid-cols-4 gap-3">
1204
- <div *ngFor="let hour of hourOptions" class="custom-square rounded text-gray-900 text-sm p-3 w-full text-left truncate outline-none bg-sky-100 focus:ring-sky-300 hover:bg-sky-300 active:bg-sky-300" [class.selected]="value === hour" (click)="onChange(hour)">
1209
+ <div class="grid grid-cols-3 md:grid-cols-4 gap-3">
1210
+ <div *ngFor="let hour of hourOptions" class="text-center font-bold custom-square rounded text-gray-900 text-lg p-3 w-full truncate outline-none bg-sky-100 focus:ring-sky-300 hover:bg-sky-300 active:bg-sky-300" [class.selected]="value === hour" (click)="onChange(hour)">
1205
1211
  {{ hour }}
1206
1212
  </div>
1207
1213
  </div>
1208
1214
  </div>
1209
1215
  <!-- Minuten -->
1210
1216
  <div *ngIf="view === 'minutes'" class="grid grid-cols-1 gap-3">
1211
- <p>Select Minute</p>
1212
- <div class="grid grid-cols-5 gap-3">
1213
- <div *ngFor="let minute of minuteOptions" class="custom-square rounded text-gray-900 text-sm p-3 w-full text-left truncate outline-none bg-sky-100 focus:ring-sky-300 hover:bg-sky-300 active:bg-sky-300" [class.selected]="value === minute" (click)="onChange(minute)">
1217
+ <div class="grid grid-cols-4 md:grid-cols-5 gap-3">
1218
+ <div *ngFor="let minute of minuteOptions" class="text-center font-bold custom-square rounded text-gray-900 text-lg p-3 w-ful truncate outline-none bg-sky-100 focus:ring-sky-300 hover:bg-sky-300 active:bg-sky-300" [class.selected]="value === minute" (click)="onChange(minute)">
1214
1219
  {{ minute }}
1215
1220
  </div>
1216
1221
  </div>
1217
1222
  </div>
1218
1223
  </div>
1219
1224
  </ion-content>
1220
- `, 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: IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: IonContent, selector: "ion-content", inputs: ["color", "fixedSlotPlacement", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "component", type: IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "component", type: SpxButtonComponent, selector: "spx-button", inputs: ["spxDisabled", "spxClass", "spxClassObject", "spxForm", "spxFullHeight", "spxFullWidth", "spxSeverity", "spxSize", "spxTabIndex", "spxType"], outputs: ["spxClick"] }] }); }
1225
+ `, 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: "ngmodule", type: IonicModule }, { kind: "component", type: i1$1.IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: i1$1.IonContent, selector: "ion-content", inputs: ["color", "fixedSlotPlacement", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: i1$1.IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: i1$1.IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "component", type: i1$1.IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "component", type: SpxButtonComponent, selector: "spx-button", inputs: ["spxDisabled", "spxClass", "spxClassObject", "spxForm", "spxFullHeight", "spxFullWidth", "spxSeverity", "spxSize", "spxTabIndex", "spxType"], outputs: ["spxClick"] }, { kind: "ngmodule", type: FontAwesomeModule }, { kind: "component", type: i1.FaIconComponent, selector: "fa-icon", inputs: ["icon", "title", "animation", "mask", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }] }); }
1221
1226
  }
1222
1227
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: SpxInputTimeModalComponent, decorators: [{
1223
1228
  type: Component,
@@ -1227,38 +1232,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImpor
1227
1232
  imports: [
1228
1233
  NgIf,
1229
1234
  NgFor,
1230
- IonButtons,
1231
- IonContent,
1232
- IonHeader,
1233
- IonToolbar,
1234
- IonTitle,
1235
+ IonicModule,
1235
1236
  SpxButtonComponent,
1236
1237
  SpxDropdownComponent,
1238
+ FontAwesomeModule,
1237
1239
  ],
1238
1240
  template: `<ion-header>
1239
1241
  <ion-toolbar>
1240
- <ion-title>Inline Modal</ion-title>
1242
+ <ion-title>Select {{view}}</ion-title>
1241
1243
  <ion-buttons slot="end">
1242
- <spx-button [spxSeverity]="typeError" (spxClick)="closeDialog()">Close</spx-button>
1244
+ <spx-button [spxSeverity]="typeError" (spxClick)="closeDialog()">
1245
+ <fa-icon [icon]="faXmark"></fa-icon>
1246
+ </spx-button>
1243
1247
  </ion-buttons>
1244
1248
  </ion-toolbar>
1245
1249
  </ion-header>
1246
- <ion-content class="ion-padding">
1250
+ <ion-content class="ion-padding bg-white">
1247
1251
  <!-- Uren -->
1248
- <div class="grid grid-cols-1 gap-3">
1252
+ <div class="custom-bg grid grid-cols-1 gap-3">
1249
1253
  <div *ngIf="view === 'hours'" class="flex-wrap gap-2">
1250
- <p> Select Hour </p>
1251
- <div class="grid grid-cols-4 gap-3">
1252
- <div *ngFor="let hour of hourOptions" class="custom-square rounded text-gray-900 text-sm p-3 w-full text-left truncate outline-none bg-sky-100 focus:ring-sky-300 hover:bg-sky-300 active:bg-sky-300" [class.selected]="value === hour" (click)="onChange(hour)">
1254
+ <div class="grid grid-cols-3 md:grid-cols-4 gap-3">
1255
+ <div *ngFor="let hour of hourOptions" class="text-center font-bold custom-square rounded text-gray-900 text-lg p-3 w-full truncate outline-none bg-sky-100 focus:ring-sky-300 hover:bg-sky-300 active:bg-sky-300" [class.selected]="value === hour" (click)="onChange(hour)">
1253
1256
  {{ hour }}
1254
1257
  </div>
1255
1258
  </div>
1256
1259
  </div>
1257
1260
  <!-- Minuten -->
1258
1261
  <div *ngIf="view === 'minutes'" class="grid grid-cols-1 gap-3">
1259
- <p>Select Minute</p>
1260
- <div class="grid grid-cols-5 gap-3">
1261
- <div *ngFor="let minute of minuteOptions" class="custom-square rounded text-gray-900 text-sm p-3 w-full text-left truncate outline-none bg-sky-100 focus:ring-sky-300 hover:bg-sky-300 active:bg-sky-300" [class.selected]="value === minute" (click)="onChange(minute)">
1262
+ <div class="grid grid-cols-4 md:grid-cols-5 gap-3">
1263
+ <div *ngFor="let minute of minuteOptions" class="text-center font-bold custom-square rounded text-gray-900 text-lg p-3 w-ful truncate outline-none bg-sky-100 focus:ring-sky-300 hover:bg-sky-300 active:bg-sky-300" [class.selected]="value === minute" (click)="onChange(minute)">
1262
1264
  {{ minute }}
1263
1265
  </div>
1264
1266
  </div>
@@ -1267,7 +1269,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImpor
1267
1269
  </ion-content>
1268
1270
  `,
1269
1271
  }]
1270
- }], ctorParameters: () => [], propDecorators: { view: [{
1272
+ }], ctorParameters: () => [{ type: i1$1.ModalController }], propDecorators: { view: [{
1271
1273
  type: Input
1272
1274
  }], value: [{
1273
1275
  type: Input
@@ -1276,7 +1278,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImpor
1276
1278
  }] } });
1277
1279
 
1278
1280
  class SpxInputTimeComponent {
1279
- constructor() {
1281
+ get formattedHour() {
1282
+ return this.selectedHour !== null && this.selectedHour < 10 ? `0${this.selectedHour}` : this.selectedHour;
1283
+ }
1284
+ get formattedMinute() {
1285
+ return this.selectedMinute !== null && this.selectedMinute < 10 ? `0${this.selectedMinute}` : this.selectedMinute;
1286
+ }
1287
+ get hour() { return this.value?.value ? DateTime.fromISO(this.value.value).hour : null; }
1288
+ get minute() { return this.value?.value ? DateTime.fromISO(this.value.value).minute : null; }
1289
+ constructor(modalController) {
1290
+ this.modalController = modalController;
1280
1291
  this.spxAutofocus = false;
1281
1292
  this.spxSuggestions = [];
1282
1293
  this.spxReadonly = false;
@@ -1286,21 +1297,12 @@ class SpxInputTimeComponent {
1286
1297
  this.spxChange = new EventEmitter();
1287
1298
  this.spxFocus = new EventEmitter();
1288
1299
  this.spxWasInternalUpdate = false;
1289
- this.modalController = inject(ModalController);
1290
1300
  this.severitySuccess = SpxSeverityEnum.success;
1291
1301
  this.hourOptions = Array.from({ length: 24 }, (_, i) => i).unshift(); // 0 to 23
1292
- this.minuteOptions = Array.from({ length: 12 }, (_, i) => i * 5); // Minutes in incrementen van 5
1302
+ this.minuteOptions = Array.from({ length: 12 }, (_, i) => i * 5).unshift(); // Minutes in incrementen van 5
1293
1303
  this.selectedHour = null;
1294
1304
  this.selectedMinute = null;
1295
1305
  }
1296
- get formattedHour() {
1297
- return this.selectedHour !== null && this.selectedHour < 10 ? `0${this.selectedHour}` : this.selectedHour;
1298
- }
1299
- get formattedMinute() {
1300
- return this.selectedMinute !== null && this.selectedMinute < 10 ? `0${this.selectedMinute}` : this.selectedMinute;
1301
- }
1302
- get hour() { return this.value?.value ? DateTime.fromISO(this.value.value).hour : null; }
1303
- get minute() { return this.value?.value ? DateTime.fromISO(this.value.value).minute : null; }
1304
1306
  spxSetFocus() {
1305
1307
  this.inputRef?.nativeElement?.focus();
1306
1308
  }
@@ -1342,21 +1344,22 @@ class SpxInputTimeComponent {
1342
1344
  view,
1343
1345
  },
1344
1346
  });
1345
- modal.onDidDismiss().then(() => {
1347
+ modal.onDidDismiss().then((data) => {
1346
1348
  // this.appStore.dispatch(infArticleActions.reset({}));
1347
- });
1348
- const { data } = await modal.onDidDismiss();
1349
- if (data) {
1350
1349
  if (view === 'hours') {
1351
- this.selectedHour = data; // Update selectedHour with the emitted value
1352
- console.log('dit is de uur weg');
1350
+ // console.log('hours');
1351
+ // console.log(data);
1352
+ this.selectedHour = data.data;
1353
+ this.openDialog('minutes');
1354
+ this.updateValue();
1353
1355
  }
1354
1356
  else if (view === 'minutes') {
1355
- this.selectedMinute = data; // Update selectedMinute with the emitted value
1356
- console.log('dit is de minuut weg');
1357
+ // console.log('minutes');
1358
+ // console.log(data);
1359
+ this.selectedMinute = data.data;
1360
+ this.updateValue();
1357
1361
  }
1358
- this.updateValue(); // Call updateValue to format and emit the new time
1359
- }
1362
+ });
1360
1363
  await modal.present();
1361
1364
  }
1362
1365
  updateValue() {
@@ -1371,16 +1374,14 @@ class SpxInputTimeComponent {
1371
1374
  this.spxChange.emit(this.value);
1372
1375
  }
1373
1376
  }
1374
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: SpxInputTimeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1375
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: SpxInputTimeComponent, isStandalone: true, selector: "spx-input-time", 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" }, providers: [
1376
- ModalController,
1377
- ], viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: `<div class="relative text-black">
1377
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: SpxInputTimeComponent, deps: [{ token: i1$1.ModalController }], target: i0.ɵɵFactoryTarget.Component }); }
1378
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: SpxInputTimeComponent, isStandalone: true, selector: "spx-input-time", 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">
1378
1379
  <div class="flex items-center justify-around gap-3">
1379
- <div class="grow rounded bg-gray-100 p-3 text-xl text-center font-bold" (click)="openDialog('hours')">{{ hour }}</div>
1380
+ <div class="grow rounded bg-gray-100 p-3 text-xl text-center font-bold" (click)="openDialog('hours')">{{ formattedHour ?? '--' }}</div>
1380
1381
  <div class="text-gray text-xl">:</div>
1381
- <div class="grow rounded bg-gray-100 p-3 text-xl text-center font-bold" (click)="openDialog('minutes')">{{ minute }}</div>
1382
+ <div class="grow rounded bg-gray-100 p-3 text-xl text-center font-bold" (click)="openDialog('minutes')">{{ formattedMinute ?? '--' }}</div>
1382
1383
  </div>
1383
- </div>`, isInline: true, styles: [".custom-square.selected{background-color:#007bff;color:#fff;border-color:#007bff}\n"] }); }
1384
+ </div>`, isInline: true, styles: [".custom-square.selected{background-color:#007bff;color:#fff;border-color:#007bff}.custom-bg{--background: #FFFFFF}\n"], dependencies: [{ kind: "ngmodule", type: IonicModule }] }); }
1384
1385
  }
1385
1386
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: SpxInputTimeComponent, decorators: [{
1386
1387
  type: Component,
@@ -1389,16 +1390,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImpor
1389
1390
  NgFor,
1390
1391
  SpxButtonComponent,
1391
1392
  SpxDropdownComponent,
1392
- ], providers: [
1393
- ModalController,
1393
+ IonicModule,
1394
1394
  ], template: `<div class="relative text-black">
1395
1395
  <div class="flex items-center justify-around gap-3">
1396
- <div class="grow rounded bg-gray-100 p-3 text-xl text-center font-bold" (click)="openDialog('hours')">{{ hour }}</div>
1396
+ <div class="grow rounded bg-gray-100 p-3 text-xl text-center font-bold" (click)="openDialog('hours')">{{ formattedHour ?? '--' }}</div>
1397
1397
  <div class="text-gray text-xl">:</div>
1398
- <div class="grow rounded bg-gray-100 p-3 text-xl text-center font-bold" (click)="openDialog('minutes')">{{ minute }}</div>
1398
+ <div class="grow rounded bg-gray-100 p-3 text-xl text-center font-bold" (click)="openDialog('minutes')">{{ formattedMinute ?? '--' }}</div>
1399
1399
  </div>
1400
- </div>`, styles: [".custom-square.selected{background-color:#007bff;color:#fff;border-color:#007bff}\n"] }]
1401
- }], propDecorators: { spxName: [{
1400
+ </div>`, styles: [".custom-square.selected{background-color:#007bff;color:#fff;border-color:#007bff}.custom-bg{--background: #FFFFFF}\n"] }]
1401
+ }], ctorParameters: () => [{ type: i1$1.ModalController }], propDecorators: { spxName: [{
1402
1402
  type: Input
1403
1403
  }], spxAutofocus: [{
1404
1404
  type: Input