crdx-components 1.0.0 → 2.0.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.
- package/fesm2022/crdx-components.mjs +1960 -0
- package/fesm2022/crdx-components.mjs.map +1 -0
- package/package.json +28 -23
- package/src/lib/styles/index.scss +1 -0
- package/src/lib/styles/overrides/_index.scss +2 -4
- package/src/lib/styles/overrides/_mat-button-overrides.scss +0 -11
- package/src/lib/styles/overrides/_mat-checkbox-overrides.scss +2 -2
- package/src/lib/styles/overrides/_mat-radio-overrides.scss +40 -0
- package/types/crdx-components.d.ts +811 -0
- package/types/crdx-components.d.ts.map +1 -0
- package/.github/workflows/publish.yml +0 -38
- package/bun.lock +0 -491
- package/crdx-components-1.0.0.tgz +0 -0
- package/crdx-components-tokenized-components-1.0.1.tgz +0 -0
- package/ng-package.json +0 -12
- package/npm +0 -0
- package/src/index.ts +0 -45
- package/src/lib/components/breadcrumb/breadcrumb.component.css +0 -206
- package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -15
- package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -47
- package/src/lib/components/button/button.css +0 -371
- package/src/lib/components/button/button.html +0 -187
- package/src/lib/components/button/button.ts +0 -103
- package/src/lib/components/card/card.css +0 -285
- package/src/lib/components/card/card.html +0 -69
- package/src/lib/components/card/card.ts +0 -93
- package/src/lib/components/checkbox/checkbox-showcase.component.css +0 -42
- package/src/lib/components/checkbox/checkbox-showcase.component.html +0 -36
- package/src/lib/components/checkbox/checkbox-showcase.component.ts +0 -13
- package/src/lib/components/checkbox/checkbox.css +0 -10
- package/src/lib/components/checkbox/checkbox.html +0 -13
- package/src/lib/components/checkbox/checkbox.ts +0 -64
- package/src/lib/components/circular-progress-stepper/circular-progress-stepper.css +0 -89
- package/src/lib/components/circular-progress-stepper/circular-progress-stepper.html +0 -23
- package/src/lib/components/circular-progress-stepper/circular-progress-stepper.ts +0 -40
- package/src/lib/components/dialogs/alert-modal/alert-modal.css +0 -118
- package/src/lib/components/dialogs/alert-modal/alert-modal.html +0 -29
- package/src/lib/components/dialogs/alert-modal/alert-modal.ts +0 -28
- package/src/lib/components/dialogs/confirm-modal/confirm-modal.css +0 -219
- package/src/lib/components/dialogs/confirm-modal/confirm-modal.html +0 -60
- package/src/lib/components/dialogs/confirm-modal/confirm-modal.store.ts +0 -139
- package/src/lib/components/dialogs/confirm-modal/confirm-modal.ts +0 -63
- package/src/lib/components/dialogs/container-custom/container-custom.css +0 -11
- package/src/lib/components/dialogs/container-custom/container-custom.html +0 -3
- package/src/lib/components/dialogs/container-custom/container-custom.ts +0 -37
- package/src/lib/components/dialogs/container-custom/custom-modal.state.ts +0 -57
- package/src/lib/components/dialogs/error-modal/error-modal.css +0 -53
- package/src/lib/components/dialogs/error-modal/error-modal.html +0 -17
- package/src/lib/components/dialogs/error-modal/error-modal.ts +0 -20
- package/src/lib/components/dialogs/side-modal/side-modal.css +0 -80
- package/src/lib/components/dialogs/side-modal/side-modal.html +0 -30
- package/src/lib/components/dialogs/side-modal/side-modal.state.ts +0 -78
- package/src/lib/components/dialogs/side-modal/side-modal.ts +0 -50
- package/src/lib/components/divider/divider.css +0 -24
- package/src/lib/components/divider/divider.html +0 -7
- package/src/lib/components/divider/divider.ts +0 -13
- package/src/lib/components/footer-actions/footer/footer-flow.store.ts +0 -30
- package/src/lib/components/footer-actions/footer/footer.html +0 -14
- package/src/lib/components/footer-actions/footer/footer.ts +0 -50
- package/src/lib/components/footer-actions/modal-footer-actions/modal-footer-actions.css +0 -44
- package/src/lib/components/footer-actions/modal-footer-actions/modal-footer-actions.html +0 -7
- package/src/lib/components/footer-actions/modal-footer-actions/modal-footer-actions.ts +0 -12
- package/src/lib/components/footer-actions/page-footer-actions/page-footer-actions.css +0 -31
- package/src/lib/components/footer-actions/page-footer-actions/page-footer-actions.html +0 -7
- package/src/lib/components/footer-actions/page-footer-actions/page-footer-actions.ts +0 -12
- package/src/lib/components/form-field/select-field.css +0 -178
- package/src/lib/components/form-field/select-field.html +0 -94
- package/src/lib/components/form-field/select-field.ts +0 -324
- package/src/lib/components/form-field/text-field.css +0 -41
- package/src/lib/components/form-field/text-field.html +0 -38
- package/src/lib/components/form-field/text-field.ts +0 -102
- package/src/lib/components/header/header.css +0 -142
- package/src/lib/components/header/header.html +0 -36
- package/src/lib/components/header/header.ts +0 -101
- package/src/lib/components/icon-button/icon-button.css +0 -445
- package/src/lib/components/icon-button/icon-button.html +0 -15
- package/src/lib/components/icon-button/icon-button.ts +0 -49
- package/src/lib/components/list-item/list-item.css +0 -122
- package/src/lib/components/list-item/list-item.html +0 -79
- package/src/lib/components/list-item/list-item.ts +0 -104
- package/src/lib/components/menu/menu.css +0 -39
- package/src/lib/components/menu/menu.html +0 -57
- package/src/lib/components/menu/menu.ts +0 -159
- package/src/lib/components/shared-table/shared-table-cell-template.directive.ts +0 -25
- package/src/lib/components/shared-table/shared-table.component.css +0 -223
- package/src/lib/components/shared-table/shared-table.component.html +0 -96
- package/src/lib/components/shared-table/shared-table.component.ts +0 -172
- package/src/lib/components/sidebar/sidebar.css +0 -234
- package/src/lib/components/sidebar/sidebar.html +0 -67
- package/src/lib/components/sidebar/sidebar.ts +0 -92
- package/src/lib/components/slide-toggle/slide-toggle.css +0 -0
- package/src/lib/components/slide-toggle/slide-toggle.html +0 -3
- package/src/lib/components/slide-toggle/slide-toggle.ts +0 -18
- package/src/lib/components/spinner/spinner.css +0 -9
- package/src/lib/components/spinner/spinner.html +0 -9
- package/src/lib/components/spinner/spinner.ts +0 -17
- package/src/lib/components/tooltip/tooltip.css +0 -32
- package/src/lib/components/tooltip/tooltip.html +0 -3
- package/src/lib/components/tooltip/tooltip.ts +0 -31
- package/src/lib/icons/register-icons.ts +0 -101
- package/src/lib/lib-ui/lib-ui.html +0 -1
- package/src/lib/lib-ui/lib-ui.scss +0 -0
- package/src/lib/lib-ui/lib-ui.ts +0 -9
- package/tsconfig.json +0 -30
- package/tsconfig.lib.json +0 -20
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<figure class="shared-table">
|
|
2
|
-
<div
|
|
3
|
-
class="shared-table__container mdc-data-table"
|
|
4
|
-
[class.shared-table__container--no-paginator]="!shouldRenderPaginator()"
|
|
5
|
-
>
|
|
6
|
-
<!-- Header: scroll sincronizado con el cuerpo, sin barra visible -->
|
|
7
|
-
<div class="shared-table__header-wrap" #headerWrap>
|
|
8
|
-
<table
|
|
9
|
-
mat-table
|
|
10
|
-
[dataSource]="dataSource"
|
|
11
|
-
class="shared-table__mat-table shared-table__mat-table--header"
|
|
12
|
-
>
|
|
13
|
-
@for (column of columns(); track columnTrackBy($index, column)) {
|
|
14
|
-
<ng-container [matColumnDef]="columnId(column)">
|
|
15
|
-
<th
|
|
16
|
-
mat-header-cell
|
|
17
|
-
*matHeaderCellDef
|
|
18
|
-
[style.text-align]="resolveTextAlign(column)"
|
|
19
|
-
[style.width]="resolveWidth(column)"
|
|
20
|
-
>
|
|
21
|
-
{{ column.header }}
|
|
22
|
-
</th>
|
|
23
|
-
</ng-container>
|
|
24
|
-
}
|
|
25
|
-
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
|
26
|
-
</table>
|
|
27
|
-
</div>
|
|
28
|
-
<!-- Cuerpo: scroll horizontal aquí (barra debajo del header) -->
|
|
29
|
-
<div
|
|
30
|
-
class="shared-table__body-wrap"
|
|
31
|
-
[class.shared-table__body-wrap--loading]="loading()"
|
|
32
|
-
#bodyWrap
|
|
33
|
-
>
|
|
34
|
-
<table
|
|
35
|
-
mat-table
|
|
36
|
-
[dataSource]="dataSource"
|
|
37
|
-
class="shared-table__mat-table shared-table__mat-table--body"
|
|
38
|
-
>
|
|
39
|
-
@for (column of columns(); track columnTrackBy($index, column)) {
|
|
40
|
-
<ng-container [matColumnDef]="columnId(column)">
|
|
41
|
-
<td
|
|
42
|
-
mat-cell
|
|
43
|
-
*matCellDef="let row; let i = index"
|
|
44
|
-
[style.text-align]="resolveTextAlign(column)"
|
|
45
|
-
[style.width]="resolveWidth(column)"
|
|
46
|
-
>
|
|
47
|
-
@if (cellTemplates[column.key]) {
|
|
48
|
-
<ng-container
|
|
49
|
-
[ngTemplateOutlet]="cellTemplates[column.key]"
|
|
50
|
-
[ngTemplateOutletContext]="{
|
|
51
|
-
$implicit: row,
|
|
52
|
-
index: i,
|
|
53
|
-
column: column,
|
|
54
|
-
}"
|
|
55
|
-
></ng-container>
|
|
56
|
-
} @else {
|
|
57
|
-
{{ getCellValue(column, row, i) }}
|
|
58
|
-
}
|
|
59
|
-
</td>
|
|
60
|
-
</ng-container>
|
|
61
|
-
}
|
|
62
|
-
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
|
63
|
-
<tr mat-no-data-row>
|
|
64
|
-
<td
|
|
65
|
-
class="shared-table__empty"
|
|
66
|
-
[attr.colspan]="displayedColumns.length || 1"
|
|
67
|
-
>
|
|
68
|
-
|
|
69
|
-
<span>loading: {{ loading() }}</span>
|
|
70
|
-
@if (!loading()) {
|
|
71
|
-
{{ emptyState() }}
|
|
72
|
-
}
|
|
73
|
-
</td>
|
|
74
|
-
</tr>
|
|
75
|
-
</table>
|
|
76
|
-
@if (loading()) {
|
|
77
|
-
<div class="shared-table__loading-overlay">
|
|
78
|
-
<mat-spinner
|
|
79
|
-
class="shared-table__loading-spinner"
|
|
80
|
-
[diameter]="48"
|
|
81
|
-
[strokeWidth]="4"
|
|
82
|
-
></mat-spinner>
|
|
83
|
-
</div>
|
|
84
|
-
}
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
@if (shouldRenderPaginator()) {
|
|
89
|
-
<mat-paginator
|
|
90
|
-
class="shared-table__paginator"
|
|
91
|
-
[length]="totalElements() ?? data().length"
|
|
92
|
-
[pageSize]="pageSize()"
|
|
93
|
-
[pageSizeOptions]="pageSizeOptions()"
|
|
94
|
-
></mat-paginator>
|
|
95
|
-
}
|
|
96
|
-
</figure>
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import {
|
|
3
|
-
AfterContentInit,
|
|
4
|
-
AfterViewInit,
|
|
5
|
-
Component,
|
|
6
|
-
ContentChildren,
|
|
7
|
-
DestroyRef,
|
|
8
|
-
ElementRef,
|
|
9
|
-
EventEmitter,
|
|
10
|
-
effect,
|
|
11
|
-
input,
|
|
12
|
-
OnDestroy,
|
|
13
|
-
Output,
|
|
14
|
-
QueryList,
|
|
15
|
-
ViewChild,
|
|
16
|
-
inject,
|
|
17
|
-
} from '@angular/core';
|
|
18
|
-
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
19
|
-
import { MatPaginator, MatPaginatorModule, PageEvent } from '@angular/material/paginator';
|
|
20
|
-
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
21
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
22
|
-
import { SharedTableCellTemplateDirective } from './shared-table-cell-template.directive';
|
|
23
|
-
|
|
24
|
-
export interface TablePageEvent {
|
|
25
|
-
pageIndex: number;
|
|
26
|
-
pageSize: number;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface SharedTableColumn<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
30
|
-
key: string;
|
|
31
|
-
header: string;
|
|
32
|
-
align?: 'start' | 'center' | 'end';
|
|
33
|
-
width?: string;
|
|
34
|
-
cell?: (row: T, index: number) => unknown;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@Component({
|
|
38
|
-
selector: 'lib-shared-table, shared-table',
|
|
39
|
-
standalone: true,
|
|
40
|
-
imports: [CommonModule, MatTableModule, MatPaginatorModule, MatProgressSpinnerModule],
|
|
41
|
-
templateUrl: './shared-table.component.html',
|
|
42
|
-
styleUrl: './shared-table.component.css'
|
|
43
|
-
})
|
|
44
|
-
export class SharedTableComponent<T extends Record<string, unknown> = Record<string, unknown>>
|
|
45
|
-
implements AfterContentInit, AfterViewInit, OnDestroy {
|
|
46
|
-
readonly columns = input.required<ReadonlyArray<SharedTableColumn<T>>>();
|
|
47
|
-
readonly data = input.required<ReadonlyArray<T>>();
|
|
48
|
-
readonly caption = input<string | undefined>();
|
|
49
|
-
readonly emptyState = input('Sin registros disponibles');
|
|
50
|
-
readonly loading = input(false);
|
|
51
|
-
readonly showPaginator = input(true);
|
|
52
|
-
readonly pageSize = input(10);
|
|
53
|
-
readonly pageSizeOptions = input<ReadonlyArray<number>>([5, 10, 20]);
|
|
54
|
-
readonly enableRowClick = input(false);
|
|
55
|
-
readonly totalElements = input<number | undefined>();
|
|
56
|
-
@Output() rowClick = new EventEmitter<T>();
|
|
57
|
-
@Output() pageChange = new EventEmitter<TablePageEvent>();
|
|
58
|
-
@ContentChildren(SharedTableCellTemplateDirective, { descendants: true })
|
|
59
|
-
cellTemplatesQuery!: QueryList<SharedTableCellTemplateDirective>;
|
|
60
|
-
cellTemplates: Record<string, SharedTableCellTemplateDirective['template']> = {};
|
|
61
|
-
private removeScrollSync: (() => void) | null = null;
|
|
62
|
-
private _paginator?: MatPaginator;
|
|
63
|
-
private readonly destroyRef = inject(DestroyRef);
|
|
64
|
-
|
|
65
|
-
readonly dataSource = new MatTableDataSource<T>();
|
|
66
|
-
displayedColumns: string[] = [];
|
|
67
|
-
|
|
68
|
-
constructor() {
|
|
69
|
-
effect(() => {
|
|
70
|
-
const columns = this.columns();
|
|
71
|
-
this.displayedColumns = columns.map((column) => String(column.key));
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
effect(() => {
|
|
75
|
-
const rows = this.data();
|
|
76
|
-
this.dataSource.data = rows.slice();
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@ViewChild(MatPaginator) set paginator(paginator: MatPaginator | undefined) {
|
|
81
|
-
this._paginator = paginator;
|
|
82
|
-
// En modo server-side (totalElements definido) NO conectamos al dataSource
|
|
83
|
-
// para que Material no intente paginar los datos localmente
|
|
84
|
-
if (this.totalElements() === undefined) {
|
|
85
|
-
this.dataSource.paginator = paginator ?? null;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@ViewChild('headerWrap') headerWrapRef?: ElementRef<HTMLDivElement>;
|
|
90
|
-
@ViewChild('bodyWrap') bodyWrapRef?: ElementRef<HTMLDivElement>;
|
|
91
|
-
|
|
92
|
-
ngAfterViewInit(): void {
|
|
93
|
-
const header = this.headerWrapRef?.nativeElement;
|
|
94
|
-
const body = this.bodyWrapRef?.nativeElement;
|
|
95
|
-
if (header && body) {
|
|
96
|
-
const onScroll = () => { header.scrollLeft = body.scrollLeft; };
|
|
97
|
-
body.addEventListener('scroll', onScroll);
|
|
98
|
-
this.removeScrollSync = () => body.removeEventListener('scroll', onScroll);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Modo server-side: escuchar eventos del paginator y emitirlos hacia arriba
|
|
102
|
-
if (this._paginator && this.totalElements() !== undefined) {
|
|
103
|
-
this._paginator.page.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event: PageEvent) => {
|
|
104
|
-
this.pageChange.emit({ pageIndex: event.pageIndex, pageSize: event.pageSize });
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
ngAfterContentInit(): void {
|
|
110
|
-
const rebuildTemplateMap = () => {
|
|
111
|
-
const map: Record<string, SharedTableCellTemplateDirective['template']> = {};
|
|
112
|
-
this.cellTemplatesQuery.forEach((entry) => {
|
|
113
|
-
if (entry.key) {
|
|
114
|
-
map[entry.key] = entry.template;
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
this.cellTemplates = map;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
rebuildTemplateMap();
|
|
121
|
-
this.cellTemplatesQuery.changes
|
|
122
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
123
|
-
.subscribe(() => rebuildTemplateMap());
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
ngOnDestroy(): void {
|
|
127
|
-
this.removeScrollSync?.();
|
|
128
|
-
this.removeScrollSync = null;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
getCellValue(column: SharedTableColumn<T>, row: T, index: number): unknown {
|
|
132
|
-
if (column.cell) {
|
|
133
|
-
return column.cell(row, index);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const key = column.key as keyof T;
|
|
137
|
-
const fallbackKey = column.key as keyof typeof row;
|
|
138
|
-
return (row?.[key] ?? row?.[fallbackKey]) ?? '';
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
columnId(column: SharedTableColumn<T>): string {
|
|
142
|
-
return String(column.key);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
columnTrackBy = (_: number, column: SharedTableColumn<T>) => column.key;
|
|
146
|
-
|
|
147
|
-
resolveTextAlign(column: SharedTableColumn<T>): 'start' | 'center' | 'end' {
|
|
148
|
-
return column.align ?? 'start';
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
resolveWidth(column: SharedTableColumn<T>): string | null {
|
|
152
|
-
return column.width ?? null;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
shouldRenderPaginator(): boolean {
|
|
156
|
-
return this.showPaginator();
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
onRowClick(event: MouseEvent, row: T): void {
|
|
160
|
-
if (!this.enableRowClick()) return;
|
|
161
|
-
|
|
162
|
-
const el = event.target as HTMLElement | null;
|
|
163
|
-
// Evita abrir el side modal si el click fue sobre un elemento interactivo (acciones dentro de la fila)
|
|
164
|
-
if (el?.closest('button, a, input, textarea, select, [role="button"], mat-icon, mat-slide-toggle, mat-checkbox')) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
this.rowClick.emit(row);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export { SharedTableCellTemplateDirective } from './shared-table-cell-template.directive';
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
display: block;
|
|
3
|
-
height: 100%;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.sidebar {
|
|
7
|
-
position: relative;
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
align-items: center;
|
|
11
|
-
width: calc(var(--navigation-rail-nav-rail-collapsed-nav-rail-collapsed-container-width, 96) * 1px);
|
|
12
|
-
min-width: calc(var(--navigation-rail-nav-rail-collapsed-nav-rail-collapsed-container-width, 96) * 1px);
|
|
13
|
-
height: 100%;
|
|
14
|
-
padding: calc(var(--navigation-rail-nav-rail-collapsed-nav-rail-collapsed-item-top-space, 44) * 1px) 0
|
|
15
|
-
calc(var(--navigation-rail-nav-rail-collapsed-nav-rail-collapsed-item-vertical-space, 4) * 1px);
|
|
16
|
-
box-sizing: border-box;
|
|
17
|
-
gap: calc(var(--navigation-rail-nav-rail-collapsed-nav-rail-collapsed-item-vertical-space, 4) * 1px);
|
|
18
|
-
background-color: var(--navigation-rail-nav-rail-collapsed-nav-rail-collapsed-container-color, #ebeef0);
|
|
19
|
-
border-radius: calc(var(--navigation-rail-nav-rail-collapsed-nav-rail-collapsed-container-shape, 0) * 1px);
|
|
20
|
-
color: var(--navigation-rail-nav-rail-item-vertical-nav-rail-item-vertical-text-color, #434749);
|
|
21
|
-
transition: width 280ms ease, min-width 280ms ease, padding 280ms ease;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.sidebar--show-labels {
|
|
25
|
-
align-items: stretch;
|
|
26
|
-
width: calc(var(--navigation-rail-nav-rail-expanded-nav-rail-expanded-container-width-minimum, 220) * 1px);
|
|
27
|
-
min-width: calc(var(--navigation-rail-nav-rail-expanded-nav-rail-expanded-container-width-minimum, 220) * 1px);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.sidebar__header,
|
|
31
|
-
.sidebar__footer {
|
|
32
|
-
display: flex;
|
|
33
|
-
justify-content: center;
|
|
34
|
-
padding-inline: calc(var(--navigation-rail-nav-rail-item-vertical-nav-rail-item-vertical-leading-space, 16) * 1px);
|
|
35
|
-
width: 100%;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.sidebar__header {
|
|
39
|
-
min-height: calc(var(--navigation-rail-nav-rail-item-common-nav-rail-item-header-space-minimum, 40) * 1px);
|
|
40
|
-
align-items: center;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.sidebar__header:empty,
|
|
44
|
-
.sidebar__footer:empty {
|
|
45
|
-
display: none;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.sidebar__nav {
|
|
49
|
-
flex: 1;
|
|
50
|
-
display: flex;
|
|
51
|
-
flex-direction: column;
|
|
52
|
-
width: 100%;
|
|
53
|
-
padding: 0 var(--padding-container-main, 16px) 0;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.sidebar__list {
|
|
57
|
-
list-style: none;
|
|
58
|
-
margin: 0;
|
|
59
|
-
padding: 0;
|
|
60
|
-
display: flex;
|
|
61
|
-
flex-direction: column;
|
|
62
|
-
align-items: center;
|
|
63
|
-
gap: calc(var(--navigation-rail-nav-rail-item-common-nav-rail-item-container-vertical-space, 6) * 1px);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.sidebar--show-labels .sidebar__list {
|
|
67
|
-
align-items: stretch;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.sidebar__item {
|
|
71
|
-
width: 100%;
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.sidebar--show-labels .sidebar__item {
|
|
77
|
-
justify-content: flex-start;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.sidebar__button {
|
|
81
|
-
position: relative;
|
|
82
|
-
display: flex;
|
|
83
|
-
justify-content: center;
|
|
84
|
-
width: auto;
|
|
85
|
-
max-width: 100%;
|
|
86
|
-
height: calc(var(--navigation-rail-nav-rail-item-common-nav-rail-item-container-height, 64) * 1px);
|
|
87
|
-
margin: 0;
|
|
88
|
-
padding-inline: 0;
|
|
89
|
-
padding-block: 0;
|
|
90
|
-
border: 0;
|
|
91
|
-
background: none;
|
|
92
|
-
cursor: pointer;
|
|
93
|
-
color: var(--navigation-rail-nav-rail-item-common-nav-rail-item-icon-color, #181c1e);
|
|
94
|
-
text-decoration: none;
|
|
95
|
-
transition:
|
|
96
|
-
color 180ms ease,
|
|
97
|
-
height 320ms ease,
|
|
98
|
-
max-width 320ms ease,
|
|
99
|
-
padding 320ms ease;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.sidebar__button--expanded {
|
|
103
|
-
align-self: center;
|
|
104
|
-
width: auto;
|
|
105
|
-
max-width: 100%;
|
|
106
|
-
height: calc(var(--navigation-rail-nav-rail-item-common-nav-rail-item-container-height, 64) * 1px);
|
|
107
|
-
justify-content: flex-start;
|
|
108
|
-
padding-inline: 0;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.sidebar__button:focus-visible {
|
|
112
|
-
outline: 2px solid var(--navigation-rail-nav-rail-item-common-nav-rail-item-focus-indicator, #5b5f61);
|
|
113
|
-
outline-offset: 4px;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.sidebar__button:disabled {
|
|
117
|
-
cursor: default;
|
|
118
|
-
opacity: 0.48;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.sidebar__active {
|
|
122
|
-
position: relative;
|
|
123
|
-
display: inline-flex;
|
|
124
|
-
align-items: center;
|
|
125
|
-
justify-content: center;
|
|
126
|
-
gap: calc(var(--navigation-rail-nav-rail-item-common-nav-rail-item-active-indicator-icon-label-space, 8) * 1px);
|
|
127
|
-
height: calc(var(--navigation-rail-nav-rail-item-vertical-nav-rail-item-vertical-active-indicator-height, 32) * 1px);
|
|
128
|
-
padding-inline: calc(var(--navigation-rail-nav-rail-item-common-nav-rail-item-active-indicator-leading-space, 16) * 1px)
|
|
129
|
-
calc(var(--navigation-rail-nav-rail-item-common-nav-rail-item-active-indicator-trailing-space, 16) * 1px);
|
|
130
|
-
border-radius: calc(var(--navigation-rail-nav-rail-item-common-nav-rail-item-active-indicator-shape, 1000) * 1px);
|
|
131
|
-
background-color: transparent;
|
|
132
|
-
transition:
|
|
133
|
-
background-color 180ms ease,
|
|
134
|
-
color 180ms ease,
|
|
135
|
-
gap 320ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
136
|
-
padding 320ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
137
|
-
width 320ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
138
|
-
max-width 320ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
139
|
-
max-width: calc(var(--navigation-rail-nav-rail-expanded-nav-rail-expanded-container-width-minimum, 220) * 1px);
|
|
140
|
-
overflow: hidden;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.sidebar__button--expanded .sidebar__active,
|
|
144
|
-
.sidebar__active--expanded {
|
|
145
|
-
width: auto;
|
|
146
|
-
max-width: 100%;
|
|
147
|
-
height: 100%;
|
|
148
|
-
align-items: center;
|
|
149
|
-
justify-content: flex-start;
|
|
150
|
-
padding-inline: calc(var(--navigation-rail-nav-rail-item-horizontal-nav-rail-item-horizontal-full-width-leading-space, 16) * 1px);
|
|
151
|
-
gap: calc(var(--navigation-rail-nav-rail-item-horizontal-nav-rail-item-horizontal-icon-label-space, 8) * 1px);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.sidebar__button:not(:disabled):hover .sidebar__active {
|
|
155
|
-
background-color: rgba(24, 28, 30, 0.08);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.sidebar__button:not(:disabled):active .sidebar__active {
|
|
159
|
-
background-color: rgba(24, 28, 30, 0.12);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.sidebar__button--selected .sidebar__active {
|
|
163
|
-
background-color: var(--navigation-rail-nav-rail-item-common-nav-rail-item-container-selected-color, #e42313);
|
|
164
|
-
color: var(--navigation-rail-nav-rail-item-common-nav-rail-item-icon-selected-color, #ffffff);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.sidebar__button--selected:not(:disabled):hover .sidebar__active {
|
|
168
|
-
background-color: rgba(228, 35, 19, 0.88);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.sidebar__button--selected:not(:disabled):active .sidebar__active {
|
|
172
|
-
background-color: rgba(228, 35, 19, 0.76);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.sidebar__icon {
|
|
176
|
-
display: flex;
|
|
177
|
-
align-items: center;
|
|
178
|
-
justify-content: center;
|
|
179
|
-
width: calc(var(--navigation-rail-nav-rail-item-common-nav-rail-item-icon-size, 24) * 1px);
|
|
180
|
-
height: calc(var(--navigation-rail-nav-rail-item-common-nav-rail-item-icon-size, 24) * 1px);
|
|
181
|
-
color: currentColor;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.sidebar__icon-svg,
|
|
185
|
-
.sidebar__icon-img {
|
|
186
|
-
width: 100%;
|
|
187
|
-
height: 100%;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.sidebar__icon-svg {
|
|
191
|
-
fill: currentColor;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.sidebar__icon-img {
|
|
195
|
-
object-fit: contain;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.sidebar__label {
|
|
199
|
-
flex: 1 1 auto;
|
|
200
|
-
min-width: 0;
|
|
201
|
-
font-size: 0.8125rem;
|
|
202
|
-
font-weight: 600;
|
|
203
|
-
letter-spacing: 0.01em;
|
|
204
|
-
line-height: 1.2;
|
|
205
|
-
color: inherit;
|
|
206
|
-
white-space: nowrap;
|
|
207
|
-
overflow: hidden;
|
|
208
|
-
text-overflow: ellipsis;
|
|
209
|
-
max-width: 100%;
|
|
210
|
-
transition: opacity 200ms ease;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.sidebar__accessory {
|
|
214
|
-
display: flex;
|
|
215
|
-
align-items: center;
|
|
216
|
-
justify-content: center;
|
|
217
|
-
width: 16px;
|
|
218
|
-
height: 16px;
|
|
219
|
-
margin-left: auto;
|
|
220
|
-
color: inherit;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.sidebar__accessory-svg,
|
|
224
|
-
.sidebar__accessory-img {
|
|
225
|
-
width: 100%;
|
|
226
|
-
height: 100%;
|
|
227
|
-
fill: currentColor;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.sidebar__footer {
|
|
231
|
-
margin-top: auto;
|
|
232
|
-
align-items: flex-end;
|
|
233
|
-
padding-bottom: calc(var(--navigation-rail-nav-rail-collapsed-nav-rail-collapsed-item-vertical-space, 4) * 1px);
|
|
234
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<aside class="sidebar" role="navigation" aria-label="Navegación principal" [class.sidebar--show-labels]="hasLabels()">
|
|
2
|
-
<div class="sidebar__header">
|
|
3
|
-
<ng-content select="[sidebar-header]"></ng-content>
|
|
4
|
-
</div>
|
|
5
|
-
|
|
6
|
-
<nav class="sidebar__nav" aria-label="Secciones">
|
|
7
|
-
<ul class="sidebar__list">
|
|
8
|
-
@for (item of items(); track trackById($index, item)) {
|
|
9
|
-
<li
|
|
10
|
-
class="sidebar__item"
|
|
11
|
-
[class.sidebar__item--selected]="isSelected(item)"
|
|
12
|
-
[class.sidebar__item--disabled]="item.disabled"
|
|
13
|
-
>
|
|
14
|
-
<button
|
|
15
|
-
type="button"
|
|
16
|
-
class="sidebar__button"
|
|
17
|
-
[class.sidebar__button--expanded]="hasLabels()"
|
|
18
|
-
[class.sidebar__button--selected]="isSelected(item)"
|
|
19
|
-
[attr.aria-label]="item.ariaLabel ?? item.label"
|
|
20
|
-
[attr.aria-current]="isSelected(item) ? 'page' : null"
|
|
21
|
-
[attr.title]="shouldShowLabel(item) ? null : (item.ariaLabel || item.label)"
|
|
22
|
-
[disabled]="item.disabled"
|
|
23
|
-
(click)="onSelect(item)"
|
|
24
|
-
>
|
|
25
|
-
<span class="sidebar__active" [class.sidebar__active--expanded]="hasLabels()">
|
|
26
|
-
@if (iconRef(item); as iconSrc) {
|
|
27
|
-
<span class="sidebar__icon" aria-hidden="true">
|
|
28
|
-
<ng-container
|
|
29
|
-
[ngTemplateOutlet]="renderIcon"
|
|
30
|
-
[ngTemplateOutletContext]="{ $implicit: iconSrc, svgClass: 'sidebar__icon-svg', imgClass: 'sidebar__icon-img' }"
|
|
31
|
-
></ng-container>
|
|
32
|
-
</span>
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@if (shouldShowLabel(item)) {
|
|
36
|
-
<span class="sidebar__label">{{ item.label }}</span>
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@if (accessoryRef(item); as accessorySrc) {
|
|
40
|
-
<span class="sidebar__accessory" aria-hidden="true">
|
|
41
|
-
<ng-container
|
|
42
|
-
[ngTemplateOutlet]="renderIcon"
|
|
43
|
-
[ngTemplateOutletContext]="{ $implicit: accessorySrc, svgClass: 'sidebar__accessory-svg', imgClass: 'sidebar__accessory-img' }"
|
|
44
|
-
></ng-container>
|
|
45
|
-
</span>
|
|
46
|
-
}
|
|
47
|
-
</span>
|
|
48
|
-
</button>
|
|
49
|
-
</li>
|
|
50
|
-
}
|
|
51
|
-
</ul>
|
|
52
|
-
</nav>
|
|
53
|
-
|
|
54
|
-
<div class="sidebar__footer">
|
|
55
|
-
<ng-content select="[sidebar-footer]"></ng-content>
|
|
56
|
-
</div>
|
|
57
|
-
|
|
58
|
-
<ng-template #renderIcon let-src let-svgClass="svgClass" let-imgClass="imgClass">
|
|
59
|
-
@if (isSprite(src)) {
|
|
60
|
-
<svg [attr.class]="svgClass">
|
|
61
|
-
<use [attr.href]="src"></use>
|
|
62
|
-
</svg>
|
|
63
|
-
} @else {
|
|
64
|
-
<img [attr.class]="imgClass" [src]="src" alt="" />
|
|
65
|
-
}
|
|
66
|
-
</ng-template>
|
|
67
|
-
</aside>
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, EventEmitter, Output, computed, input } from '@angular/core';
|
|
2
|
-
import { NgTemplateOutlet } from '@angular/common';
|
|
3
|
-
|
|
4
|
-
export interface SidebarNavItem {
|
|
5
|
-
id: string;
|
|
6
|
-
label: string;
|
|
7
|
-
icon: string;
|
|
8
|
-
iconPath?: string;
|
|
9
|
-
accessoryIcon?: string;
|
|
10
|
-
accessoryIconPath?: string;
|
|
11
|
-
ariaLabel?: string;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@Component({
|
|
16
|
-
selector: 'lib-sidebar',
|
|
17
|
-
standalone: true,
|
|
18
|
-
imports: [NgTemplateOutlet],
|
|
19
|
-
templateUrl: './sidebar.html',
|
|
20
|
-
styleUrl: './sidebar.css',
|
|
21
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
22
|
-
})
|
|
23
|
-
export class SidebarComponent {
|
|
24
|
-
readonly items = input<readonly SidebarNavItem[]>([]);
|
|
25
|
-
readonly selectedId = input<string | null>(null);
|
|
26
|
-
readonly showLabels = input(true);
|
|
27
|
-
readonly spritePath = input('assets/icons/sprite.svg');
|
|
28
|
-
|
|
29
|
-
@Output() readonly itemSelected = new EventEmitter<SidebarNavItem>();
|
|
30
|
-
|
|
31
|
-
protected readonly hasLabels = computed(() => this.showLabels() && this.items().some(({ label }) => !!label));
|
|
32
|
-
|
|
33
|
-
protected onSelect(item: SidebarNavItem): void {
|
|
34
|
-
if (item.disabled) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
this.itemSelected.emit(item);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
protected isSelected(item: SidebarNavItem): boolean {
|
|
42
|
-
return item.id === this.selectedId();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
protected trackById(_index: number, item: SidebarNavItem): string {
|
|
46
|
-
return item.id;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
protected iconHref(icon: string): string {
|
|
50
|
-
return `${this.spritePath()}#${icon}`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
protected accessoryHref(accessoryIcon: string): string {
|
|
54
|
-
return `${this.spritePath()}#${accessoryIcon}`;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
protected iconRef(item: SidebarNavItem): string | null {
|
|
58
|
-
if (item.iconPath) {
|
|
59
|
-
return item.iconPath;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (item.icon) {
|
|
63
|
-
return this.iconHref(item.icon);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
protected accessoryRef(item: SidebarNavItem): string | null {
|
|
70
|
-
if (item.accessoryIconPath) {
|
|
71
|
-
return item.accessoryIconPath;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (item.accessoryIcon) {
|
|
75
|
-
return this.accessoryHref(item.accessoryIcon);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
protected isSprite(ref: string | null | undefined): ref is string {
|
|
82
|
-
return !!ref && ref.includes('#');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
protected shouldShowLabel(item: SidebarNavItem): boolean {
|
|
86
|
-
if (!item.label) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return this.showLabels();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
File without changes
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Component, input, output } from '@angular/core';
|
|
2
|
-
import { MatSlideToggleModule, MatSlideToggleChange } from '@angular/material/slide-toggle';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'lib-slide-toggle, slide-toggle',
|
|
6
|
-
standalone: true,
|
|
7
|
-
imports: [MatSlideToggleModule],
|
|
8
|
-
templateUrl: './slide-toggle.html',
|
|
9
|
-
styleUrl: './slide-toggle.css',
|
|
10
|
-
})
|
|
11
|
-
export class SlideToggle {
|
|
12
|
-
checked = input(false);
|
|
13
|
-
checkedChange = output<boolean>();
|
|
14
|
-
|
|
15
|
-
onChange(event: MatSlideToggleChange) {
|
|
16
|
-
this.checkedChange.emit(event.checked);
|
|
17
|
-
}
|
|
18
|
-
}
|