@lamenna/lxp-angular 0.0.7 → 0.2.0

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,8 +1,11 @@
1
1
  import * as i1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { EventEmitter, HostBinding, Output, Input, Component } from '@angular/core';
5
- import { buttonConfig } from '@lamenna/lxp-shared-components';
4
+ import { EventEmitter, HostBinding, Output, Input, Component, Injectable } from '@angular/core';
5
+ import { buttonConfig, tableThemeConfig, tableConfig, defaultTheme, badgeConfig, textFieldConfig, chipConfig, toggleConfig, radioConfig, avatarConfig, cardConfig, segmentedControlConfig, quantityStepperConfig } from '@lamenna/lxp-shared-components';
6
+ import * as i2 from '@angular/forms';
7
+ import { FormsModule } from '@angular/forms';
8
+ import { BehaviorSubject } from 'rxjs';
6
9
 
7
10
  class ButtonComponent {
8
11
  content;
@@ -13,7 +16,12 @@ class ButtonComponent {
13
16
  id;
14
17
  ariaLabel;
15
18
  testID;
16
- label;
19
+ get label() {
20
+ return this.content;
21
+ }
22
+ set label(value) {
23
+ this.content = value;
24
+ }
17
25
  onClick = new EventEmitter();
18
26
  get hostStyles() {
19
27
  const variantConfig = buttonConfig.variants[this.variant];
@@ -31,8 +39,8 @@ class ButtonComponent {
31
39
  [this.className || ""]: !!this.className,
32
40
  };
33
41
  }
34
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
35
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: ButtonComponent, isStandalone: true, selector: "lxp-button", inputs: { content: "content", variant: "variant", size: "size", disabled: "disabled", className: "className", id: "id", ariaLabel: "ariaLabel", testID: "testID", label: "label" }, outputs: { onClick: "onClick" }, host: { properties: { "style": "this.hostStyles" } }, ngImport: i0, template: `
42
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
43
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: ButtonComponent, isStandalone: true, selector: "lxp-button", inputs: { content: "content", variant: "variant", size: "size", disabled: "disabled", className: "className", id: "id", ariaLabel: "ariaLabel", testID: "testID", label: "label" }, outputs: { onClick: "onClick" }, host: { properties: { "style": "this.hostStyles" } }, ngImport: i0, template: `
36
44
  <button
37
45
  [attr.id]="id"
38
46
  [attr.data-testid]="testID"
@@ -45,7 +53,7 @@ class ButtonComponent {
45
53
  </button>
46
54
  `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
47
55
  }
48
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ButtonComponent, decorators: [{
56
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ButtonComponent, decorators: [{
49
57
  type: Component,
50
58
  args: [{
51
59
  selector: "lxp-button",
@@ -89,9 +97,1545 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
89
97
  args: ["style"]
90
98
  }] } });
91
99
 
100
+ class TableComponent {
101
+ columns = [];
102
+ data = [];
103
+ actions = [];
104
+ selectable = false;
105
+ showPagination = true;
106
+ showSearch = true;
107
+ loading = false;
108
+ theme = "tera";
109
+ title;
110
+ titleLink;
111
+ serverSide = false;
112
+ totalCount;
113
+ currentPage;
114
+ pageSize;
115
+ pageSizeOptions;
116
+ emptyState;
117
+ enableRowClick = false;
118
+ searchPlaceholder;
119
+ onSelectionChange = new EventEmitter();
120
+ onPageChange = new EventEmitter();
121
+ onPageSizeChange = new EventEmitter();
122
+ onSearch = new EventEmitter();
123
+ onRowClick = new EventEmitter();
124
+ get fontFamily() {
125
+ return tableThemeConfig[this.theme].fontFamily;
126
+ }
127
+ defaultTitle = tableConfig.defaultTitle;
128
+ loadingMessage = tableConfig.loadingMessage;
129
+ searchTerm = "";
130
+ selectedRows = [];
131
+ get columnSpan() {
132
+ return (this.columns.length +
133
+ (this.selectable ? 1 : 0) +
134
+ (this.actions?.length ? 1 : 0));
135
+ }
136
+ get totalItems() {
137
+ if (this.serverSide) {
138
+ return this.totalCount ?? this.data.length;
139
+ }
140
+ return this.filteredData.length;
141
+ }
142
+ get currentPageInternal() {
143
+ return this.currentPage ?? this._currentPage;
144
+ }
145
+ get pageSizeInternal() {
146
+ return this.pageSize ?? this._pageSize;
147
+ }
148
+ get pageSizeOptionsInternal() {
149
+ return this.pageSizeOptions ?? tableConfig.defaultPageSizeOptions;
150
+ }
151
+ _currentPage = 1;
152
+ _pageSize = tableConfig.defaultPageSize;
153
+ get filteredData() {
154
+ if (!this.showSearch || !this.searchTerm.trim()) {
155
+ return this.data;
156
+ }
157
+ const term = this.searchTerm.toLowerCase();
158
+ return this.data.filter((row) => Object.values(row).some((value) => String(typeof value === "object" && value !== null
159
+ ? value.line1 ?? value.line2 ?? ""
160
+ : value ?? "")
161
+ .toLowerCase()
162
+ .includes(term)));
163
+ }
164
+ get pagedData() {
165
+ if (!this.showPagination || this.serverSide) {
166
+ return this.filteredData;
167
+ }
168
+ const start = (this.currentPageInternal - 1) * this.pageSizeInternal;
169
+ return this.filteredData.slice(start, start + this.pageSizeInternal);
170
+ }
171
+ get totalPages() {
172
+ if (!this.showPagination) {
173
+ return 1;
174
+ }
175
+ return Math.max(1, Math.ceil(this.totalItems / this.pageSizeInternal));
176
+ }
177
+ isRichCell(value) {
178
+ return (value &&
179
+ typeof value === "object" &&
180
+ ("line1" in value || "line2" in value || "text" in value || "name" in value));
181
+ }
182
+ isRowSelected(index) {
183
+ return this.selectedRows.includes(index);
184
+ }
185
+ globalRowIndex(localIndex) {
186
+ if (this.serverSide) {
187
+ return localIndex;
188
+ }
189
+ return (this.currentPageInternal - 1) * this.pageSizeInternal + localIndex;
190
+ }
191
+ toggleRowSelection(index) {
192
+ const exists = this.selectedRows.includes(index);
193
+ this.selectedRows = exists
194
+ ? this.selectedRows.filter((i) => i !== index)
195
+ : [...this.selectedRows, index];
196
+ this.onSelectionChange.emit(this.selectedRows);
197
+ }
198
+ get emptyMessage() {
199
+ const custom = this.emptyState?.message;
200
+ const showDefault = this.emptyState?.showDefault ?? true;
201
+ if (custom)
202
+ return custom;
203
+ return showDefault ? tableConfig.emptyMessage : "";
204
+ }
205
+ onSearchChange(term) {
206
+ const value = typeof term === "string"
207
+ ? term
208
+ : term?.target?.value ?? "";
209
+ this.searchTerm = value;
210
+ this.onSearch.emit({
211
+ page: this.currentPageInternal,
212
+ pageSize: this.pageSizeInternal,
213
+ searchTerm: value,
214
+ filters: {},
215
+ });
216
+ }
217
+ onPageChangeInternal(nextPage) {
218
+ if (nextPage < 1 || nextPage > this.totalPages)
219
+ return;
220
+ if (this.currentPage == null) {
221
+ this._currentPage = nextPage;
222
+ }
223
+ this.onPageChange.emit({
224
+ page: nextPage,
225
+ pageSize: this.pageSizeInternal,
226
+ searchTerm: this.searchTerm,
227
+ filters: {},
228
+ });
229
+ }
230
+ onPageSizeChangeInternal(nextSize) {
231
+ const size = typeof nextSize === "number" ? nextSize : Number(nextSize ?? 0);
232
+ if (this.pageSize == null) {
233
+ this._pageSize = size;
234
+ this._currentPage = 1;
235
+ }
236
+ this.onPageSizeChange.emit({
237
+ page: 1,
238
+ pageSize: size,
239
+ searchTerm: this.searchTerm,
240
+ filters: {},
241
+ });
242
+ }
243
+ handleRowClick(row, localIndex) {
244
+ if (!this.enableRowClick)
245
+ return;
246
+ const globalIndex = this.globalRowIndex(localIndex);
247
+ this.onRowClick.emit({ row, index: globalIndex });
248
+ }
249
+ isActionDisabled(action, row) {
250
+ return action.disabled ? action.disabled(row) : false;
251
+ }
252
+ runAction(action, row) {
253
+ if (this.isActionDisabled(action, row))
254
+ return;
255
+ action.action(row);
256
+ }
257
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
258
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: TableComponent, isStandalone: true, selector: "lxp-table", inputs: { columns: "columns", data: "data", actions: "actions", selectable: "selectable", showPagination: "showPagination", showSearch: "showSearch", loading: "loading", theme: "theme", title: "title", titleLink: "titleLink", serverSide: "serverSide", totalCount: "totalCount", currentPage: "currentPage", pageSize: "pageSize", pageSizeOptions: "pageSizeOptions", emptyState: "emptyState", enableRowClick: "enableRowClick", searchPlaceholder: "searchPlaceholder" }, outputs: { onSelectionChange: "onSelectionChange", onPageChange: "onPageChange", onPageSizeChange: "onPageSizeChange", onSearch: "onSearch", onRowClick: "onRowClick" }, host: { properties: { "style.fontFamily": "this.fontFamily" } }, ngImport: i0, template: `
259
+ <div class="lxp-table">
260
+ <div class="lxp-table__header">
261
+ <div class="lxp-table__title">
262
+ <h3 class="lxp-table__title-text">{{ title || defaultTitle }}</h3>
263
+ <span
264
+ *ngIf="totalItems > 0"
265
+ class="lxp-table__title-count"
266
+ >
267
+ ({{ totalItems }})
268
+ </span>
269
+ </div>
270
+
271
+ <div class="lxp-table__controls" *ngIf="showSearch">
272
+ <input
273
+ type="search"
274
+ class="lxp-table__search"
275
+ [placeholder]="searchPlaceholder || 'Search...'"
276
+ [(ngModel)]="searchTerm"
277
+ (ngModelChange)="onSearchChange($event)"
278
+ />
279
+ </div>
280
+ </div>
281
+
282
+ <div class="lxp-table__body-wrapper">
283
+ <table class="lxp-table__table">
284
+ <thead>
285
+ <tr>
286
+ <th
287
+ *ngIf="selectable"
288
+ class="lxp-table__cell lxp-table__cell--checkbox"
289
+ ></th>
290
+ <th
291
+ *ngFor="let column of columns"
292
+ class="lxp-table__cell lxp-table__cell--header"
293
+ [style.text-align]="column.align || 'left'"
294
+ >
295
+ {{ column.label }}
296
+ </th>
297
+ <th
298
+ *ngIf="actions?.length"
299
+ class="lxp-table__cell lxp-table__cell--header lxp-table__cell--actions"
300
+ >
301
+ Actions
302
+ </th>
303
+ </tr>
304
+ </thead>
305
+ <tbody>
306
+ <tr *ngIf="loading">
307
+ <td
308
+ class="lxp-table__cell lxp-table__cell--status"
309
+ [attr.colspan]="columnSpan"
310
+ >
311
+ {{ loadingMessage }}
312
+ </td>
313
+ </tr>
314
+
315
+ <tr *ngIf="!loading && pagedData.length === 0">
316
+ <td
317
+ class="lxp-table__cell lxp-table__cell--status"
318
+ [attr.colspan]="columnSpan"
319
+ >
320
+ {{ emptyMessage }}
321
+ </td>
322
+ </tr>
323
+
324
+ <tr
325
+ *ngFor="let row of pagedData; let rowIndex = index"
326
+ class="lxp-table__row"
327
+ (click)="handleRowClick(row, rowIndex)"
328
+ >
329
+ <td
330
+ *ngIf="selectable"
331
+ class="lxp-table__cell lxp-table__cell--checkbox"
332
+ >
333
+ <input
334
+ type="checkbox"
335
+ [checked]="isRowSelected(globalRowIndex(rowIndex))"
336
+ (click)="$event.stopPropagation()"
337
+ (change)="toggleRowSelection(globalRowIndex(rowIndex))"
338
+ />
339
+ </td>
340
+
341
+ <td
342
+ *ngFor="let column of columns"
343
+ class="lxp-table__cell"
344
+ [style.text-align]="column.align || 'left'"
345
+ >
346
+ <ng-container [ngTemplateOutlet]="cellTemplate"
347
+ [ngTemplateOutletContext]="{ column: column, row: row }">
348
+ </ng-container>
349
+ </td>
350
+
351
+ <td
352
+ *ngIf="actions?.length"
353
+ class="lxp-table__cell lxp-table__cell--actions"
354
+ >
355
+ <button
356
+ *ngFor="let action of actions"
357
+ type="button"
358
+ class="lxp-table__action"
359
+ [disabled]="isActionDisabled(action, row)"
360
+ (click)="runAction(action, row); $event.stopPropagation()"
361
+ >
362
+ {{ action.label }}
363
+ </button>
364
+ </td>
365
+ </tr>
366
+ </tbody>
367
+ </table>
368
+ </div>
369
+
370
+ <div
371
+ *ngIf="showPagination && totalPages > 1"
372
+ class="lxp-table__footer"
373
+ >
374
+ <div class="lxp-table__footer-info">
375
+ Page {{ currentPageInternal }} of {{ totalPages }}
376
+ </div>
377
+ <div class="lxp-table__footer-controls">
378
+ <label class="lxp-table__page-size">
379
+ <span>Rows per page</span>
380
+ <select
381
+ [ngModel]="pageSizeInternal"
382
+ (ngModelChange)="onPageSizeChangeInternal($event)"
383
+ >
384
+ <option *ngFor="let size of pageSizeOptionsInternal" [ngValue]="size">
385
+ {{ size }}
386
+ </option>
387
+ </select>
388
+ </label>
389
+
390
+ <button
391
+ type="button"
392
+ class="lxp-table__pager"
393
+ [disabled]="currentPageInternal === 1"
394
+ (click)="onPageChangeInternal(currentPageInternal - 1)"
395
+ >
396
+ Previous
397
+ </button>
398
+ <button
399
+ type="button"
400
+ class="lxp-table__pager"
401
+ [disabled]="currentPageInternal === totalPages"
402
+ (click)="onPageChangeInternal(currentPageInternal + 1)"
403
+ >
404
+ Next
405
+ </button>
406
+ </div>
407
+ </div>
408
+
409
+ <ng-template #cellTemplate let-column="column" let-row="row">
410
+ <ng-container *ngIf="column.render; else defaultCell">
411
+ {{ column.render(row[column.key], row) }}
412
+ </ng-container>
413
+ <ng-template #defaultCell>
414
+ <ng-container
415
+ *ngIf="isRichCell(row[column.key]); else plainCell"
416
+ >
417
+ <div class="lxp-table__cell-text">
418
+ <div class="lxp-table__cell-line1">
419
+ {{ row[column.key].line1 || row[column.key].text || row[column.key].name }}
420
+ </div>
421
+ <div
422
+ *ngIf="row[column.key].line2"
423
+ class="lxp-table__cell-line2"
424
+ >
425
+ {{ row[column.key].line2 }}
426
+ </div>
427
+ </div>
428
+ </ng-container>
429
+ <ng-template #plainCell>
430
+ {{ row[column.key] }}
431
+ </ng-template>
432
+ </ng-template>
433
+ </ng-template>
434
+ </div>
435
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
436
+ }
437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TableComponent, decorators: [{
438
+ type: Component,
439
+ args: [{
440
+ selector: "lxp-table",
441
+ standalone: true,
442
+ imports: [CommonModule, FormsModule],
443
+ template: `
444
+ <div class="lxp-table">
445
+ <div class="lxp-table__header">
446
+ <div class="lxp-table__title">
447
+ <h3 class="lxp-table__title-text">{{ title || defaultTitle }}</h3>
448
+ <span
449
+ *ngIf="totalItems > 0"
450
+ class="lxp-table__title-count"
451
+ >
452
+ ({{ totalItems }})
453
+ </span>
454
+ </div>
455
+
456
+ <div class="lxp-table__controls" *ngIf="showSearch">
457
+ <input
458
+ type="search"
459
+ class="lxp-table__search"
460
+ [placeholder]="searchPlaceholder || 'Search...'"
461
+ [(ngModel)]="searchTerm"
462
+ (ngModelChange)="onSearchChange($event)"
463
+ />
464
+ </div>
465
+ </div>
466
+
467
+ <div class="lxp-table__body-wrapper">
468
+ <table class="lxp-table__table">
469
+ <thead>
470
+ <tr>
471
+ <th
472
+ *ngIf="selectable"
473
+ class="lxp-table__cell lxp-table__cell--checkbox"
474
+ ></th>
475
+ <th
476
+ *ngFor="let column of columns"
477
+ class="lxp-table__cell lxp-table__cell--header"
478
+ [style.text-align]="column.align || 'left'"
479
+ >
480
+ {{ column.label }}
481
+ </th>
482
+ <th
483
+ *ngIf="actions?.length"
484
+ class="lxp-table__cell lxp-table__cell--header lxp-table__cell--actions"
485
+ >
486
+ Actions
487
+ </th>
488
+ </tr>
489
+ </thead>
490
+ <tbody>
491
+ <tr *ngIf="loading">
492
+ <td
493
+ class="lxp-table__cell lxp-table__cell--status"
494
+ [attr.colspan]="columnSpan"
495
+ >
496
+ {{ loadingMessage }}
497
+ </td>
498
+ </tr>
499
+
500
+ <tr *ngIf="!loading && pagedData.length === 0">
501
+ <td
502
+ class="lxp-table__cell lxp-table__cell--status"
503
+ [attr.colspan]="columnSpan"
504
+ >
505
+ {{ emptyMessage }}
506
+ </td>
507
+ </tr>
508
+
509
+ <tr
510
+ *ngFor="let row of pagedData; let rowIndex = index"
511
+ class="lxp-table__row"
512
+ (click)="handleRowClick(row, rowIndex)"
513
+ >
514
+ <td
515
+ *ngIf="selectable"
516
+ class="lxp-table__cell lxp-table__cell--checkbox"
517
+ >
518
+ <input
519
+ type="checkbox"
520
+ [checked]="isRowSelected(globalRowIndex(rowIndex))"
521
+ (click)="$event.stopPropagation()"
522
+ (change)="toggleRowSelection(globalRowIndex(rowIndex))"
523
+ />
524
+ </td>
525
+
526
+ <td
527
+ *ngFor="let column of columns"
528
+ class="lxp-table__cell"
529
+ [style.text-align]="column.align || 'left'"
530
+ >
531
+ <ng-container [ngTemplateOutlet]="cellTemplate"
532
+ [ngTemplateOutletContext]="{ column: column, row: row }">
533
+ </ng-container>
534
+ </td>
535
+
536
+ <td
537
+ *ngIf="actions?.length"
538
+ class="lxp-table__cell lxp-table__cell--actions"
539
+ >
540
+ <button
541
+ *ngFor="let action of actions"
542
+ type="button"
543
+ class="lxp-table__action"
544
+ [disabled]="isActionDisabled(action, row)"
545
+ (click)="runAction(action, row); $event.stopPropagation()"
546
+ >
547
+ {{ action.label }}
548
+ </button>
549
+ </td>
550
+ </tr>
551
+ </tbody>
552
+ </table>
553
+ </div>
554
+
555
+ <div
556
+ *ngIf="showPagination && totalPages > 1"
557
+ class="lxp-table__footer"
558
+ >
559
+ <div class="lxp-table__footer-info">
560
+ Page {{ currentPageInternal }} of {{ totalPages }}
561
+ </div>
562
+ <div class="lxp-table__footer-controls">
563
+ <label class="lxp-table__page-size">
564
+ <span>Rows per page</span>
565
+ <select
566
+ [ngModel]="pageSizeInternal"
567
+ (ngModelChange)="onPageSizeChangeInternal($event)"
568
+ >
569
+ <option *ngFor="let size of pageSizeOptionsInternal" [ngValue]="size">
570
+ {{ size }}
571
+ </option>
572
+ </select>
573
+ </label>
574
+
575
+ <button
576
+ type="button"
577
+ class="lxp-table__pager"
578
+ [disabled]="currentPageInternal === 1"
579
+ (click)="onPageChangeInternal(currentPageInternal - 1)"
580
+ >
581
+ Previous
582
+ </button>
583
+ <button
584
+ type="button"
585
+ class="lxp-table__pager"
586
+ [disabled]="currentPageInternal === totalPages"
587
+ (click)="onPageChangeInternal(currentPageInternal + 1)"
588
+ >
589
+ Next
590
+ </button>
591
+ </div>
592
+ </div>
593
+
594
+ <ng-template #cellTemplate let-column="column" let-row="row">
595
+ <ng-container *ngIf="column.render; else defaultCell">
596
+ {{ column.render(row[column.key], row) }}
597
+ </ng-container>
598
+ <ng-template #defaultCell>
599
+ <ng-container
600
+ *ngIf="isRichCell(row[column.key]); else plainCell"
601
+ >
602
+ <div class="lxp-table__cell-text">
603
+ <div class="lxp-table__cell-line1">
604
+ {{ row[column.key].line1 || row[column.key].text || row[column.key].name }}
605
+ </div>
606
+ <div
607
+ *ngIf="row[column.key].line2"
608
+ class="lxp-table__cell-line2"
609
+ >
610
+ {{ row[column.key].line2 }}
611
+ </div>
612
+ </div>
613
+ </ng-container>
614
+ <ng-template #plainCell>
615
+ {{ row[column.key] }}
616
+ </ng-template>
617
+ </ng-template>
618
+ </ng-template>
619
+ </div>
620
+ `,
621
+ }]
622
+ }], propDecorators: { columns: [{
623
+ type: Input
624
+ }], data: [{
625
+ type: Input
626
+ }], actions: [{
627
+ type: Input
628
+ }], selectable: [{
629
+ type: Input
630
+ }], showPagination: [{
631
+ type: Input
632
+ }], showSearch: [{
633
+ type: Input
634
+ }], loading: [{
635
+ type: Input
636
+ }], theme: [{
637
+ type: Input
638
+ }], title: [{
639
+ type: Input
640
+ }], titleLink: [{
641
+ type: Input
642
+ }], serverSide: [{
643
+ type: Input
644
+ }], totalCount: [{
645
+ type: Input
646
+ }], currentPage: [{
647
+ type: Input
648
+ }], pageSize: [{
649
+ type: Input
650
+ }], pageSizeOptions: [{
651
+ type: Input
652
+ }], emptyState: [{
653
+ type: Input
654
+ }], enableRowClick: [{
655
+ type: Input
656
+ }], searchPlaceholder: [{
657
+ type: Input
658
+ }], onSelectionChange: [{
659
+ type: Output
660
+ }], onPageChange: [{
661
+ type: Output
662
+ }], onPageSizeChange: [{
663
+ type: Output
664
+ }], onSearch: [{
665
+ type: Output
666
+ }], onRowClick: [{
667
+ type: Output
668
+ }], fontFamily: [{
669
+ type: HostBinding,
670
+ args: ["style.fontFamily"]
671
+ }] } });
672
+
673
+ class ThemeService {
674
+ themeSubject = new BehaviorSubject(defaultTheme);
675
+ theme$ = this.themeSubject.asObservable();
676
+ get theme() {
677
+ return this.themeSubject.value;
678
+ }
679
+ setTheme(theme) {
680
+ this.themeSubject.next(theme);
681
+ }
682
+ toggleTheme() {
683
+ this.themeSubject.next(this.theme === "tera" ? "cynk" : "tera");
684
+ }
685
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
686
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ThemeService, providedIn: "root" });
687
+ }
688
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ThemeService, decorators: [{
689
+ type: Injectable,
690
+ args: [{
691
+ providedIn: "root",
692
+ }]
693
+ }] });
694
+
695
+ class ThemeSwitcherComponent {
696
+ themeService;
697
+ className;
698
+ showLabels = true;
699
+ constructor(themeService) {
700
+ this.themeService = themeService;
701
+ }
702
+ get label() {
703
+ return this.themeService.theme === "tera" ? "Tera theme" : "Cynk theme";
704
+ }
705
+ get shortLabel() {
706
+ return this.themeService.theme === "tera" ? "T" : "C";
707
+ }
708
+ get buttonTitle() {
709
+ const next = this.themeService.theme === "tera" ? "Cynk" : "Tera";
710
+ return `Switch to ${next} theme`;
711
+ }
712
+ toggleTheme() {
713
+ this.themeService.toggleTheme();
714
+ }
715
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ThemeSwitcherComponent, deps: [{ token: ThemeService }], target: i0.ɵɵFactoryTarget.Component });
716
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: ThemeSwitcherComponent, isStandalone: true, selector: "lxp-theme-switcher", inputs: { className: "className", showLabels: "showLabels" }, ngImport: i0, template: `
717
+ <button
718
+ type="button"
719
+ class="lxp-theme-switcher"
720
+ [ngClass]="className"
721
+ (click)="toggleTheme()"
722
+ [title]="buttonTitle"
723
+ >
724
+ <ng-container *ngIf="showLabels; else iconOnly">
725
+ {{ label }}
726
+ </ng-container>
727
+ <ng-template #iconOnly>
728
+ {{ shortLabel }}
729
+ </ng-template>
730
+ </button>
731
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
732
+ }
733
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ThemeSwitcherComponent, decorators: [{
734
+ type: Component,
735
+ args: [{
736
+ selector: "lxp-theme-switcher",
737
+ standalone: true,
738
+ imports: [CommonModule],
739
+ template: `
740
+ <button
741
+ type="button"
742
+ class="lxp-theme-switcher"
743
+ [ngClass]="className"
744
+ (click)="toggleTheme()"
745
+ [title]="buttonTitle"
746
+ >
747
+ <ng-container *ngIf="showLabels; else iconOnly">
748
+ {{ label }}
749
+ </ng-container>
750
+ <ng-template #iconOnly>
751
+ {{ shortLabel }}
752
+ </ng-template>
753
+ </button>
754
+ `,
755
+ }]
756
+ }], ctorParameters: () => [{ type: ThemeService }], propDecorators: { className: [{
757
+ type: Input
758
+ }], showLabels: [{
759
+ type: Input
760
+ }] } });
761
+
762
+ class BadgeComponent {
763
+ content;
764
+ label;
765
+ variant = "neutral";
766
+ dot = false;
767
+ id;
768
+ className;
769
+ testID;
770
+ get text() {
771
+ return this.content ?? this.label;
772
+ }
773
+ get v() {
774
+ return badgeConfig.variants[this.variant];
775
+ }
776
+ get containerStyles() {
777
+ const c = badgeConfig.common;
778
+ return {
779
+ display: "inline-flex",
780
+ "align-items": "center",
781
+ gap: `${c.gap}px`,
782
+ "background-color": this.v.backgroundColor,
783
+ color: this.v.color,
784
+ "border-radius": c.borderRadius,
785
+ "font-size": c.fontSize,
786
+ "font-weight": `${c.fontWeight}`,
787
+ padding: `${c.paddingVertical} ${c.paddingHorizontal}`,
788
+ "line-height": "1",
789
+ };
790
+ }
791
+ get dotStyles() {
792
+ const c = badgeConfig.common;
793
+ return {
794
+ width: `${c.dotSize}px`,
795
+ height: `${c.dotSize}px`,
796
+ "border-radius": "50%",
797
+ "background-color": this.v.color,
798
+ display: "inline-block",
799
+ };
800
+ }
801
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
802
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: BadgeComponent, isStandalone: true, selector: "lxp-badge", inputs: { content: "content", label: "label", variant: "variant", dot: "dot", id: "id", className: "className", testID: "testID" }, ngImport: i0, template: `
803
+ <span
804
+ [attr.id]="id"
805
+ [attr.data-testid]="testID"
806
+ [ngStyle]="containerStyles"
807
+ >
808
+ <span *ngIf="dot" [ngStyle]="dotStyles"></span>
809
+ {{ text }}
810
+ </span>
811
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
812
+ }
813
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BadgeComponent, decorators: [{
814
+ type: Component,
815
+ args: [{
816
+ selector: "lxp-badge",
817
+ standalone: true,
818
+ imports: [CommonModule],
819
+ template: `
820
+ <span
821
+ [attr.id]="id"
822
+ [attr.data-testid]="testID"
823
+ [ngStyle]="containerStyles"
824
+ >
825
+ <span *ngIf="dot" [ngStyle]="dotStyles"></span>
826
+ {{ text }}
827
+ </span>
828
+ `,
829
+ }]
830
+ }], propDecorators: { content: [{
831
+ type: Input
832
+ }], label: [{
833
+ type: Input
834
+ }], variant: [{
835
+ type: Input
836
+ }], dot: [{
837
+ type: Input
838
+ }], id: [{
839
+ type: Input
840
+ }], className: [{
841
+ type: Input
842
+ }], testID: [{
843
+ type: Input
844
+ }] } });
845
+
846
+ class TextFieldComponent {
847
+ label;
848
+ value;
849
+ placeholder;
850
+ helperText;
851
+ error;
852
+ disabled = false;
853
+ id;
854
+ className;
855
+ testID;
856
+ type = "text";
857
+ valueChange = new EventEmitter();
858
+ focused = false;
859
+ onInput(e) {
860
+ const val = e.target.value;
861
+ this.value = val;
862
+ this.valueChange.emit(val);
863
+ }
864
+ get state() {
865
+ return this.disabled
866
+ ? "disabled"
867
+ : this.error
868
+ ? "error"
869
+ : this.focused
870
+ ? "focused"
871
+ : "default";
872
+ }
873
+ get s() {
874
+ return textFieldConfig.states[this.state];
875
+ }
876
+ get c() {
877
+ return textFieldConfig.common;
878
+ }
879
+ get wrapperStyles() {
880
+ return { display: "flex", "flex-direction": "column", gap: this.c.gap };
881
+ }
882
+ get labelStyles() {
883
+ return {
884
+ "font-size": "13px",
885
+ "font-weight": "500",
886
+ color: this.c.labelColor,
887
+ };
888
+ }
889
+ get inputStyles() {
890
+ const s = this.s;
891
+ const c = this.c;
892
+ return {
893
+ "box-sizing": "border-box",
894
+ width: "100%",
895
+ border: `${s.borderWidth}px solid ${s.borderColor}`,
896
+ "background-color": s.backgroundColor,
897
+ "border-radius": c.borderRadius,
898
+ padding: `${c.paddingVertical} ${c.paddingHorizontal}`,
899
+ "font-size": c.fontSize,
900
+ color: c.textColor,
901
+ outline: "none",
902
+ };
903
+ }
904
+ get helperStyles() {
905
+ return {
906
+ "font-size": "12px",
907
+ color: this.error ? this.c.errorColor : this.c.helperColor,
908
+ };
909
+ }
910
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TextFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
911
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: TextFieldComponent, isStandalone: true, selector: "lxp-text-field", inputs: { label: "label", value: "value", placeholder: "placeholder", helperText: "helperText", error: "error", disabled: "disabled", id: "id", className: "className", testID: "testID", type: "type" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
912
+ <div [ngStyle]="wrapperStyles">
913
+ <label *ngIf="label" [attr.for]="id" [ngStyle]="labelStyles">{{
914
+ label
915
+ }}</label>
916
+ <input
917
+ [attr.id]="id"
918
+ [attr.data-testid]="testID"
919
+ [type]="type"
920
+ [value]="value || ''"
921
+ [attr.placeholder]="placeholder"
922
+ [disabled]="disabled"
923
+ (input)="onInput($event)"
924
+ (focus)="focused = true"
925
+ (blur)="focused = false"
926
+ [ngStyle]="inputStyles"
927
+ />
928
+ <span *ngIf="error || helperText" [ngStyle]="helperStyles">{{
929
+ error || helperText
930
+ }}</span>
931
+ </div>
932
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
933
+ }
934
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TextFieldComponent, decorators: [{
935
+ type: Component,
936
+ args: [{
937
+ selector: "lxp-text-field",
938
+ standalone: true,
939
+ imports: [CommonModule],
940
+ template: `
941
+ <div [ngStyle]="wrapperStyles">
942
+ <label *ngIf="label" [attr.for]="id" [ngStyle]="labelStyles">{{
943
+ label
944
+ }}</label>
945
+ <input
946
+ [attr.id]="id"
947
+ [attr.data-testid]="testID"
948
+ [type]="type"
949
+ [value]="value || ''"
950
+ [attr.placeholder]="placeholder"
951
+ [disabled]="disabled"
952
+ (input)="onInput($event)"
953
+ (focus)="focused = true"
954
+ (blur)="focused = false"
955
+ [ngStyle]="inputStyles"
956
+ />
957
+ <span *ngIf="error || helperText" [ngStyle]="helperStyles">{{
958
+ error || helperText
959
+ }}</span>
960
+ </div>
961
+ `,
962
+ }]
963
+ }], propDecorators: { label: [{
964
+ type: Input
965
+ }], value: [{
966
+ type: Input
967
+ }], placeholder: [{
968
+ type: Input
969
+ }], helperText: [{
970
+ type: Input
971
+ }], error: [{
972
+ type: Input
973
+ }], disabled: [{
974
+ type: Input
975
+ }], id: [{
976
+ type: Input
977
+ }], className: [{
978
+ type: Input
979
+ }], testID: [{
980
+ type: Input
981
+ }], type: [{
982
+ type: Input
983
+ }], valueChange: [{
984
+ type: Output
985
+ }] } });
986
+
987
+ class ChipComponent {
988
+ content;
989
+ label;
990
+ selected = false;
991
+ disabled = false;
992
+ id;
993
+ className;
994
+ testID;
995
+ onClick = new EventEmitter();
996
+ get text() {
997
+ return this.content ?? this.label;
998
+ }
999
+ get st() {
1000
+ return this.selected ? chipConfig.states.active : chipConfig.states.default;
1001
+ }
1002
+ get styles() {
1003
+ const c = chipConfig.common;
1004
+ const st = this.st;
1005
+ return {
1006
+ "background-color": st.backgroundColor,
1007
+ color: st.color,
1008
+ border: st.borderWidth
1009
+ ? `${st.borderWidth}px solid ${st.borderColor}`
1010
+ : "none",
1011
+ "border-radius": c.borderRadius,
1012
+ "font-size": c.fontSize,
1013
+ "font-weight": `${c.fontWeight}`,
1014
+ padding: `${c.paddingVertical} ${c.paddingHorizontal}`,
1015
+ cursor: this.disabled ? "not-allowed" : "pointer",
1016
+ opacity: this.disabled ? "0.6" : "1",
1017
+ };
1018
+ }
1019
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1020
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: ChipComponent, isStandalone: true, selector: "lxp-chip", inputs: { content: "content", label: "label", selected: "selected", disabled: "disabled", id: "id", className: "className", testID: "testID" }, outputs: { onClick: "onClick" }, ngImport: i0, template: `
1021
+ <button
1022
+ type="button"
1023
+ [attr.id]="id"
1024
+ [attr.data-testid]="testID"
1025
+ [disabled]="disabled"
1026
+ (click)="onClick.emit($event)"
1027
+ [ngStyle]="styles"
1028
+ >
1029
+ {{ text }}
1030
+ </button>
1031
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
1032
+ }
1033
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ChipComponent, decorators: [{
1034
+ type: Component,
1035
+ args: [{
1036
+ selector: "lxp-chip",
1037
+ standalone: true,
1038
+ imports: [CommonModule],
1039
+ template: `
1040
+ <button
1041
+ type="button"
1042
+ [attr.id]="id"
1043
+ [attr.data-testid]="testID"
1044
+ [disabled]="disabled"
1045
+ (click)="onClick.emit($event)"
1046
+ [ngStyle]="styles"
1047
+ >
1048
+ {{ text }}
1049
+ </button>
1050
+ `,
1051
+ }]
1052
+ }], propDecorators: { content: [{
1053
+ type: Input
1054
+ }], label: [{
1055
+ type: Input
1056
+ }], selected: [{
1057
+ type: Input
1058
+ }], disabled: [{
1059
+ type: Input
1060
+ }], id: [{
1061
+ type: Input
1062
+ }], className: [{
1063
+ type: Input
1064
+ }], testID: [{
1065
+ type: Input
1066
+ }], onClick: [{
1067
+ type: Output
1068
+ }] } });
1069
+
1070
+ class ToggleComponent {
1071
+ checked = false;
1072
+ disabled = false;
1073
+ id;
1074
+ className;
1075
+ ariaLabel;
1076
+ testID;
1077
+ checkedChange = new EventEmitter();
1078
+ toggle() {
1079
+ this.checked = !this.checked;
1080
+ this.checkedChange.emit(this.checked);
1081
+ }
1082
+ get trackStyles() {
1083
+ const t = toggleConfig.track;
1084
+ return {
1085
+ width: `${t.width}px`,
1086
+ height: `${t.height}px`,
1087
+ "border-radius": t.borderRadius,
1088
+ "background-color": this.checked ? t.onColor : t.offColor,
1089
+ border: "none",
1090
+ padding: `${t.padding}px`,
1091
+ display: "inline-flex",
1092
+ "align-items": "center",
1093
+ "justify-content": this.checked ? "flex-end" : "flex-start",
1094
+ cursor: this.disabled ? "not-allowed" : "pointer",
1095
+ opacity: this.disabled ? `${toggleConfig.common.disabledOpacity}` : "1",
1096
+ transition: "background-color 0.2s",
1097
+ };
1098
+ }
1099
+ get knobStyles() {
1100
+ const k = toggleConfig.knob;
1101
+ return {
1102
+ width: `${k.size}px`,
1103
+ height: `${k.size}px`,
1104
+ "border-radius": k.borderRadius,
1105
+ "background-color": k.color,
1106
+ "box-shadow": "0 1px 2px rgba(0,0,0,0.2)",
1107
+ };
1108
+ }
1109
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1110
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: ToggleComponent, isStandalone: true, selector: "lxp-toggle", inputs: { checked: "checked", disabled: "disabled", id: "id", className: "className", ariaLabel: "ariaLabel", testID: "testID" }, outputs: { checkedChange: "checkedChange" }, ngImport: i0, template: `
1111
+ <button
1112
+ type="button"
1113
+ role="switch"
1114
+ [attr.aria-checked]="checked"
1115
+ [attr.aria-label]="ariaLabel"
1116
+ [attr.id]="id"
1117
+ [attr.data-testid]="testID"
1118
+ [disabled]="disabled"
1119
+ (click)="toggle()"
1120
+ [ngStyle]="trackStyles"
1121
+ >
1122
+ <span [ngStyle]="knobStyles"></span>
1123
+ </button>
1124
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
1125
+ }
1126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ToggleComponent, decorators: [{
1127
+ type: Component,
1128
+ args: [{
1129
+ selector: "lxp-toggle",
1130
+ standalone: true,
1131
+ imports: [CommonModule],
1132
+ template: `
1133
+ <button
1134
+ type="button"
1135
+ role="switch"
1136
+ [attr.aria-checked]="checked"
1137
+ [attr.aria-label]="ariaLabel"
1138
+ [attr.id]="id"
1139
+ [attr.data-testid]="testID"
1140
+ [disabled]="disabled"
1141
+ (click)="toggle()"
1142
+ [ngStyle]="trackStyles"
1143
+ >
1144
+ <span [ngStyle]="knobStyles"></span>
1145
+ </button>
1146
+ `,
1147
+ }]
1148
+ }], propDecorators: { checked: [{
1149
+ type: Input
1150
+ }], disabled: [{
1151
+ type: Input
1152
+ }], id: [{
1153
+ type: Input
1154
+ }], className: [{
1155
+ type: Input
1156
+ }], ariaLabel: [{
1157
+ type: Input
1158
+ }], testID: [{
1159
+ type: Input
1160
+ }], checkedChange: [{
1161
+ type: Output
1162
+ }] } });
1163
+
1164
+ class RadioComponent {
1165
+ checked = false;
1166
+ disabled = false;
1167
+ label;
1168
+ value;
1169
+ id;
1170
+ className;
1171
+ testID;
1172
+ onSelect = new EventEmitter();
1173
+ get st() {
1174
+ return this.checked
1175
+ ? radioConfig.states.selected
1176
+ : radioConfig.states.unselected;
1177
+ }
1178
+ get c() {
1179
+ return radioConfig.common;
1180
+ }
1181
+ get rootStyles() {
1182
+ return {
1183
+ display: "inline-flex",
1184
+ "align-items": "center",
1185
+ gap: `${this.c.gap}`,
1186
+ background: "none",
1187
+ border: "none",
1188
+ padding: "0",
1189
+ cursor: this.disabled ? "not-allowed" : "pointer",
1190
+ opacity: this.disabled ? `${this.c.disabledOpacity}` : "1",
1191
+ };
1192
+ }
1193
+ get circleStyles() {
1194
+ const c = this.c;
1195
+ return {
1196
+ width: `${c.size}px`,
1197
+ height: `${c.size}px`,
1198
+ "border-radius": "50%",
1199
+ border: `${c.borderWidth}px solid ${this.st.borderColor}`,
1200
+ display: "inline-flex",
1201
+ "align-items": "center",
1202
+ "justify-content": "center",
1203
+ "box-sizing": "border-box",
1204
+ };
1205
+ }
1206
+ get dotStyles() {
1207
+ const c = this.c;
1208
+ return {
1209
+ width: `${c.dotSize}px`,
1210
+ height: `${c.dotSize}px`,
1211
+ "border-radius": "50%",
1212
+ "background-color": this.st.dotColor,
1213
+ };
1214
+ }
1215
+ get labelStyles() {
1216
+ return { "font-size": this.c.fontSize, color: this.c.labelColor };
1217
+ }
1218
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: RadioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1219
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: RadioComponent, isStandalone: true, selector: "lxp-radio", inputs: { checked: "checked", disabled: "disabled", label: "label", value: "value", id: "id", className: "className", testID: "testID" }, outputs: { onSelect: "onSelect" }, ngImport: i0, template: `
1220
+ <button
1221
+ type="button"
1222
+ role="radio"
1223
+ [attr.aria-checked]="checked"
1224
+ [attr.id]="id"
1225
+ [attr.data-testid]="testID"
1226
+ [disabled]="disabled"
1227
+ (click)="onSelect.emit(value)"
1228
+ [ngStyle]="rootStyles"
1229
+ >
1230
+ <span [ngStyle]="circleStyles">
1231
+ <span *ngIf="checked" [ngStyle]="dotStyles"></span>
1232
+ </span>
1233
+ <span *ngIf="label" [ngStyle]="labelStyles">{{ label }}</span>
1234
+ </button>
1235
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
1236
+ }
1237
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: RadioComponent, decorators: [{
1238
+ type: Component,
1239
+ args: [{
1240
+ selector: "lxp-radio",
1241
+ standalone: true,
1242
+ imports: [CommonModule],
1243
+ template: `
1244
+ <button
1245
+ type="button"
1246
+ role="radio"
1247
+ [attr.aria-checked]="checked"
1248
+ [attr.id]="id"
1249
+ [attr.data-testid]="testID"
1250
+ [disabled]="disabled"
1251
+ (click)="onSelect.emit(value)"
1252
+ [ngStyle]="rootStyles"
1253
+ >
1254
+ <span [ngStyle]="circleStyles">
1255
+ <span *ngIf="checked" [ngStyle]="dotStyles"></span>
1256
+ </span>
1257
+ <span *ngIf="label" [ngStyle]="labelStyles">{{ label }}</span>
1258
+ </button>
1259
+ `,
1260
+ }]
1261
+ }], propDecorators: { checked: [{
1262
+ type: Input
1263
+ }], disabled: [{
1264
+ type: Input
1265
+ }], label: [{
1266
+ type: Input
1267
+ }], value: [{
1268
+ type: Input
1269
+ }], id: [{
1270
+ type: Input
1271
+ }], className: [{
1272
+ type: Input
1273
+ }], testID: [{
1274
+ type: Input
1275
+ }], onSelect: [{
1276
+ type: Output
1277
+ }] } });
1278
+
1279
+ class AvatarComponent {
1280
+ initials;
1281
+ src;
1282
+ size = "md";
1283
+ id;
1284
+ className;
1285
+ testID;
1286
+ get s() {
1287
+ return avatarConfig.sizes[this.size];
1288
+ }
1289
+ get rootStyles() {
1290
+ const c = avatarConfig.common;
1291
+ const s = this.s;
1292
+ return {
1293
+ width: `${s.size}px`,
1294
+ height: `${s.size}px`,
1295
+ "border-radius": c.borderRadius,
1296
+ "background-color": c.backgroundColor,
1297
+ color: c.color,
1298
+ display: "inline-flex",
1299
+ "align-items": "center",
1300
+ "justify-content": "center",
1301
+ "font-size": s.fontSize,
1302
+ "font-weight": `${c.fontWeight}`,
1303
+ overflow: "hidden",
1304
+ };
1305
+ }
1306
+ get imgStyles() {
1307
+ return { width: "100%", height: "100%", "object-fit": "cover" };
1308
+ }
1309
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: AvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1310
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: AvatarComponent, isStandalone: true, selector: "lxp-avatar", inputs: { initials: "initials", src: "src", size: "size", id: "id", className: "className", testID: "testID" }, ngImport: i0, template: `
1311
+ <span [attr.id]="id" [attr.data-testid]="testID" [ngStyle]="rootStyles">
1312
+ <img
1313
+ *ngIf="src; else initialsTpl"
1314
+ [src]="src"
1315
+ [attr.alt]="initials || ''"
1316
+ [ngStyle]="imgStyles"
1317
+ />
1318
+ <ng-template #initialsTpl>{{ initials }}</ng-template>
1319
+ </span>
1320
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
1321
+ }
1322
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: AvatarComponent, decorators: [{
1323
+ type: Component,
1324
+ args: [{
1325
+ selector: "lxp-avatar",
1326
+ standalone: true,
1327
+ imports: [CommonModule],
1328
+ template: `
1329
+ <span [attr.id]="id" [attr.data-testid]="testID" [ngStyle]="rootStyles">
1330
+ <img
1331
+ *ngIf="src; else initialsTpl"
1332
+ [src]="src"
1333
+ [attr.alt]="initials || ''"
1334
+ [ngStyle]="imgStyles"
1335
+ />
1336
+ <ng-template #initialsTpl>{{ initials }}</ng-template>
1337
+ </span>
1338
+ `,
1339
+ }]
1340
+ }], propDecorators: { initials: [{
1341
+ type: Input
1342
+ }], src: [{
1343
+ type: Input
1344
+ }], size: [{
1345
+ type: Input
1346
+ }], id: [{
1347
+ type: Input
1348
+ }], className: [{
1349
+ type: Input
1350
+ }], testID: [{
1351
+ type: Input
1352
+ }] } });
1353
+
1354
+ class CardComponent {
1355
+ padding = "md";
1356
+ elevation = "sm";
1357
+ bordered = true;
1358
+ id;
1359
+ className;
1360
+ testID;
1361
+ get styles() {
1362
+ const c = cardConfig.common;
1363
+ return {
1364
+ "background-color": c.backgroundColor,
1365
+ border: this.bordered
1366
+ ? `${c.borderWidth}px solid ${c.borderColor}`
1367
+ : "none",
1368
+ "border-radius": c.borderRadius,
1369
+ padding: cardConfig.paddings[this.padding],
1370
+ "box-shadow": cardConfig.elevations[this.elevation],
1371
+ };
1372
+ }
1373
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1374
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: CardComponent, isStandalone: true, selector: "lxp-card", inputs: { padding: "padding", elevation: "elevation", bordered: "bordered", id: "id", className: "className", testID: "testID" }, ngImport: i0, template: `
1375
+ <div [attr.id]="id" [attr.data-testid]="testID" [ngStyle]="styles">
1376
+ <ng-content></ng-content>
1377
+ </div>
1378
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
1379
+ }
1380
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CardComponent, decorators: [{
1381
+ type: Component,
1382
+ args: [{
1383
+ selector: "lxp-card",
1384
+ standalone: true,
1385
+ imports: [CommonModule],
1386
+ template: `
1387
+ <div [attr.id]="id" [attr.data-testid]="testID" [ngStyle]="styles">
1388
+ <ng-content></ng-content>
1389
+ </div>
1390
+ `,
1391
+ }]
1392
+ }], propDecorators: { padding: [{
1393
+ type: Input
1394
+ }], elevation: [{
1395
+ type: Input
1396
+ }], bordered: [{
1397
+ type: Input
1398
+ }], id: [{
1399
+ type: Input
1400
+ }], className: [{
1401
+ type: Input
1402
+ }], testID: [{
1403
+ type: Input
1404
+ }] } });
1405
+
1406
+ class SegmentedControlComponent {
1407
+ options = [];
1408
+ value;
1409
+ disabled = false;
1410
+ id;
1411
+ className;
1412
+ testID;
1413
+ valueChange = new EventEmitter();
1414
+ get normalized() {
1415
+ return (this.options || []).map((o) => typeof o === "string" ? { label: o, value: o } : o);
1416
+ }
1417
+ get c() {
1418
+ return segmentedControlConfig.common;
1419
+ }
1420
+ get containerStyles() {
1421
+ const c = this.c;
1422
+ return {
1423
+ display: "inline-flex",
1424
+ "background-color": c.backgroundColor,
1425
+ "border-radius": c.borderRadius,
1426
+ padding: `${c.padding}px`,
1427
+ };
1428
+ }
1429
+ segmentStyles(active) {
1430
+ const c = this.c;
1431
+ return {
1432
+ border: "none",
1433
+ cursor: this.disabled ? "not-allowed" : "pointer",
1434
+ "background-color": active ? c.activeBackground : "transparent",
1435
+ color: active ? c.activeColor : c.inactiveColor,
1436
+ "border-radius": c.segmentRadius,
1437
+ "font-size": c.fontSize,
1438
+ "font-weight": `${c.fontWeight}`,
1439
+ padding: `${c.segmentPaddingVertical} ${c.segmentPaddingHorizontal}`,
1440
+ "box-shadow": active ? c.activeShadow : "none",
1441
+ transition: "all 0.15s",
1442
+ };
1443
+ }
1444
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SegmentedControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1445
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: SegmentedControlComponent, isStandalone: true, selector: "lxp-segmented-control", inputs: { options: "options", value: "value", disabled: "disabled", id: "id", className: "className", testID: "testID" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
1446
+ <div
1447
+ [attr.id]="id"
1448
+ [attr.data-testid]="testID"
1449
+ role="tablist"
1450
+ [ngStyle]="containerStyles"
1451
+ >
1452
+ <button
1453
+ *ngFor="let o of normalized"
1454
+ type="button"
1455
+ role="tab"
1456
+ [attr.aria-selected]="o.value === value"
1457
+ [disabled]="disabled"
1458
+ (click)="valueChange.emit(o.value)"
1459
+ [ngStyle]="segmentStyles(o.value === value)"
1460
+ >
1461
+ {{ o.label }}
1462
+ </button>
1463
+ </div>
1464
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
1465
+ }
1466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SegmentedControlComponent, decorators: [{
1467
+ type: Component,
1468
+ args: [{
1469
+ selector: "lxp-segmented-control",
1470
+ standalone: true,
1471
+ imports: [CommonModule],
1472
+ template: `
1473
+ <div
1474
+ [attr.id]="id"
1475
+ [attr.data-testid]="testID"
1476
+ role="tablist"
1477
+ [ngStyle]="containerStyles"
1478
+ >
1479
+ <button
1480
+ *ngFor="let o of normalized"
1481
+ type="button"
1482
+ role="tab"
1483
+ [attr.aria-selected]="o.value === value"
1484
+ [disabled]="disabled"
1485
+ (click)="valueChange.emit(o.value)"
1486
+ [ngStyle]="segmentStyles(o.value === value)"
1487
+ >
1488
+ {{ o.label }}
1489
+ </button>
1490
+ </div>
1491
+ `,
1492
+ }]
1493
+ }], propDecorators: { options: [{
1494
+ type: Input
1495
+ }], value: [{
1496
+ type: Input
1497
+ }], disabled: [{
1498
+ type: Input
1499
+ }], id: [{
1500
+ type: Input
1501
+ }], className: [{
1502
+ type: Input
1503
+ }], testID: [{
1504
+ type: Input
1505
+ }], valueChange: [{
1506
+ type: Output
1507
+ }] } });
1508
+
1509
+ class QuantityStepperComponent {
1510
+ value = 0;
1511
+ min = 0;
1512
+ max = Number.POSITIVE_INFINITY;
1513
+ step = 1;
1514
+ disabled = false;
1515
+ id;
1516
+ className;
1517
+ testID;
1518
+ valueChange = new EventEmitter();
1519
+ set(v) {
1520
+ const nv = Math.max(this.min, Math.min(this.max, v));
1521
+ this.value = nv;
1522
+ this.valueChange.emit(nv);
1523
+ }
1524
+ get c() {
1525
+ return quantityStepperConfig.common;
1526
+ }
1527
+ get containerStyles() {
1528
+ const c = this.c;
1529
+ return {
1530
+ display: "inline-flex",
1531
+ "align-items": "stretch",
1532
+ border: `1px solid ${c.borderColor}`,
1533
+ "border-radius": c.borderRadius,
1534
+ overflow: "hidden",
1535
+ opacity: this.disabled ? `${c.disabledOpacity}` : "1",
1536
+ };
1537
+ }
1538
+ get buttonStyles() {
1539
+ const c = this.c;
1540
+ return {
1541
+ width: `${c.buttonWidth}px`,
1542
+ height: `${c.height}px`,
1543
+ border: "none",
1544
+ "background-color": c.buttonBackground,
1545
+ color: c.buttonColor,
1546
+ "font-size": c.fontSize,
1547
+ "font-weight": `${c.fontWeight}`,
1548
+ cursor: "pointer",
1549
+ };
1550
+ }
1551
+ get valueStyles() {
1552
+ const c = this.c;
1553
+ return {
1554
+ "min-width": `${c.valueWidth}px`,
1555
+ height: `${c.height}px`,
1556
+ display: "inline-flex",
1557
+ "align-items": "center",
1558
+ "justify-content": "center",
1559
+ "background-color": c.valueBackground,
1560
+ color: c.valueColor,
1561
+ "font-size": c.fontSize,
1562
+ "font-weight": `${c.fontWeight}`,
1563
+ };
1564
+ }
1565
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: QuantityStepperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1566
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: QuantityStepperComponent, isStandalone: true, selector: "lxp-quantity-stepper", inputs: { value: "value", min: "min", max: "max", step: "step", disabled: "disabled", id: "id", className: "className", testID: "testID" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `
1567
+ <div [attr.id]="id" [attr.data-testid]="testID" [ngStyle]="containerStyles">
1568
+ <button
1569
+ type="button"
1570
+ [disabled]="disabled || value <= min"
1571
+ (click)="set(value - step)"
1572
+ [ngStyle]="buttonStyles"
1573
+ >
1574
+
1575
+ </button>
1576
+ <span [ngStyle]="valueStyles">{{ value }}</span>
1577
+ <button
1578
+ type="button"
1579
+ [disabled]="disabled || value >= max"
1580
+ (click)="set(value + step)"
1581
+ [ngStyle]="buttonStyles"
1582
+ >
1583
+ +
1584
+ </button>
1585
+ </div>
1586
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
1587
+ }
1588
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: QuantityStepperComponent, decorators: [{
1589
+ type: Component,
1590
+ args: [{
1591
+ selector: "lxp-quantity-stepper",
1592
+ standalone: true,
1593
+ imports: [CommonModule],
1594
+ template: `
1595
+ <div [attr.id]="id" [attr.data-testid]="testID" [ngStyle]="containerStyles">
1596
+ <button
1597
+ type="button"
1598
+ [disabled]="disabled || value <= min"
1599
+ (click)="set(value - step)"
1600
+ [ngStyle]="buttonStyles"
1601
+ >
1602
+
1603
+ </button>
1604
+ <span [ngStyle]="valueStyles">{{ value }}</span>
1605
+ <button
1606
+ type="button"
1607
+ [disabled]="disabled || value >= max"
1608
+ (click)="set(value + step)"
1609
+ [ngStyle]="buttonStyles"
1610
+ >
1611
+ +
1612
+ </button>
1613
+ </div>
1614
+ `,
1615
+ }]
1616
+ }], propDecorators: { value: [{
1617
+ type: Input
1618
+ }], min: [{
1619
+ type: Input
1620
+ }], max: [{
1621
+ type: Input
1622
+ }], step: [{
1623
+ type: Input
1624
+ }], disabled: [{
1625
+ type: Input
1626
+ }], id: [{
1627
+ type: Input
1628
+ }], className: [{
1629
+ type: Input
1630
+ }], testID: [{
1631
+ type: Input
1632
+ }], valueChange: [{
1633
+ type: Output
1634
+ }] } });
1635
+
92
1636
  /**
93
1637
  * Generated bundle index. Do not edit.
94
1638
  */
95
1639
 
96
- export { ButtonComponent };
1640
+ export { AvatarComponent, BadgeComponent, ButtonComponent, CardComponent, ChipComponent, QuantityStepperComponent, RadioComponent, SegmentedControlComponent, TableComponent, TextFieldComponent, ThemeService, ThemeSwitcherComponent, ToggleComponent };
97
1641
  //# sourceMappingURL=lamenna-lxp-angular.mjs.map