ng-comps 1.0.2 → 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/ng-comps.mjs +4254 -0
- package/package.json +54 -58
- package/src/styles.css +54 -0
- package/types/ng-comps.d.ts +1348 -0
- package/.editorconfig +0 -17
- package/.github/copilot-instructions.md +0 -55
- package/.github/workflows/ci.yml +0 -29
- package/.prettierrc +0 -12
- package/.storybook/main.ts +0 -21
- package/.storybook/preview.ts +0 -27
- package/.storybook/tsconfig.doc.json +0 -10
- package/.storybook/tsconfig.json +0 -15
- package/.storybook/typings.d.ts +0 -4
- package/.vscode/extensions.json +0 -4
- package/.vscode/launch.json +0 -20
- package/.vscode/mcp.json +0 -9
- package/.vscode/tasks.json +0 -42
- package/ACCESSIBILITY.md +0 -127
- package/angular.json +0 -106
- package/documentation.json +0 -13394
- package/ng-package.json +0 -27
- package/public/favicon.ico +0 -0
- package/scripts/prepare-package.mjs +0 -80
- package/src/app/a11y/accessibility.utils.ts +0 -35
- package/src/app/a11y/index.ts +0 -6
- package/src/app/accessibility/ng-comps.a11y.spec.ts +0 -108
- package/src/app/app.config.ts +0 -11
- package/src/app/app.css +0 -107
- package/src/app/app.html +0 -48
- package/src/app/app.routes.ts +0 -3
- package/src/app/app.spec.ts +0 -23
- package/src/app/app.ts +0 -10
- package/src/app/components/accordion/index.ts +0 -2
- package/src/app/components/accordion/mf-accordion.component.css +0 -38
- package/src/app/components/accordion/mf-accordion.component.spec.ts +0 -48
- package/src/app/components/accordion/mf-accordion.component.ts +0 -53
- package/src/app/components/alert/index.ts +0 -2
- package/src/app/components/alert/mf-alert.component.css +0 -100
- package/src/app/components/alert/mf-alert.component.spec.ts +0 -59
- package/src/app/components/alert/mf-alert.component.ts +0 -68
- package/src/app/components/autocomplete/index.ts +0 -5
- package/src/app/components/autocomplete/mf-autocomplete.component.css +0 -105
- package/src/app/components/autocomplete/mf-autocomplete.component.spec.ts +0 -116
- package/src/app/components/autocomplete/mf-autocomplete.component.ts +0 -307
- package/src/app/components/avatar/index.ts +0 -2
- package/src/app/components/avatar/mf-avatar.component.css +0 -27
- package/src/app/components/avatar/mf-avatar.component.spec.ts +0 -49
- package/src/app/components/avatar/mf-avatar.component.ts +0 -99
- package/src/app/components/badge/index.ts +0 -2
- package/src/app/components/badge/mf-badge.component.css +0 -32
- package/src/app/components/badge/mf-badge.component.spec.ts +0 -40
- package/src/app/components/badge/mf-badge.component.ts +0 -105
- package/src/app/components/breadcrumb/index.ts +0 -2
- package/src/app/components/breadcrumb/mf-breadcrumb.component.css +0 -61
- package/src/app/components/breadcrumb/mf-breadcrumb.component.spec.ts +0 -61
- package/src/app/components/breadcrumb/mf-breadcrumb.component.ts +0 -75
- package/src/app/components/button/index.ts +0 -2
- package/src/app/components/button/mf-button.component.css +0 -136
- package/src/app/components/button/mf-button.component.ts +0 -174
- package/src/app/components/card/index.ts +0 -2
- package/src/app/components/card/mf-card.component.css +0 -82
- package/src/app/components/card/mf-card.component.ts +0 -59
- package/src/app/components/checkbox/index.ts +0 -1
- package/src/app/components/checkbox/mf-checkbox.component.css +0 -75
- package/src/app/components/checkbox/mf-checkbox.component.ts +0 -187
- package/src/app/components/chip/index.ts +0 -2
- package/src/app/components/chip/mf-chip.component.css +0 -69
- package/src/app/components/chip/mf-chip.component.spec.ts +0 -47
- package/src/app/components/chip/mf-chip.component.ts +0 -77
- package/src/app/components/datepicker/index.ts +0 -2
- package/src/app/components/datepicker/mf-datepicker.component.css +0 -102
- package/src/app/components/datepicker/mf-datepicker.component.spec.ts +0 -69
- package/src/app/components/datepicker/mf-datepicker.component.ts +0 -233
- package/src/app/components/dialog/index.ts +0 -3
- package/src/app/components/dialog/mf-dialog.component.css +0 -73
- package/src/app/components/dialog/mf-dialog.component.ts +0 -160
- package/src/app/components/dialog/mf-dialog.service.spec.ts +0 -61
- package/src/app/components/dialog/mf-dialog.service.ts +0 -52
- package/src/app/components/divider/index.ts +0 -2
- package/src/app/components/divider/mf-divider.component.css +0 -38
- package/src/app/components/divider/mf-divider.component.spec.ts +0 -40
- package/src/app/components/divider/mf-divider.component.ts +0 -44
- package/src/app/components/form-field/index.ts +0 -1
- package/src/app/components/form-field/mf-form-field.component.css +0 -51
- package/src/app/components/form-field/mf-form-field.component.ts +0 -74
- package/src/app/components/grid-list/index.ts +0 -2
- package/src/app/components/grid-list/mf-grid-list.component.css +0 -47
- package/src/app/components/grid-list/mf-grid-list.component.spec.ts +0 -57
- package/src/app/components/grid-list/mf-grid-list.component.ts +0 -68
- package/src/app/components/icon/index.ts +0 -2
- package/src/app/components/icon/mf-icon.component.css +0 -56
- package/src/app/components/icon/mf-icon.component.ts +0 -41
- package/src/app/components/input/index.ts +0 -2
- package/src/app/components/input/mf-input.component.css +0 -105
- package/src/app/components/input/mf-input.component.ts +0 -217
- package/src/app/components/menu/index.ts +0 -2
- package/src/app/components/menu/mf-menu.component.css +0 -31
- package/src/app/components/menu/mf-menu.component.spec.ts +0 -49
- package/src/app/components/menu/mf-menu.component.ts +0 -66
- package/src/app/components/paginator/index.ts +0 -1
- package/src/app/components/paginator/mf-paginator.component.css +0 -32
- package/src/app/components/paginator/mf-paginator.component.spec.ts +0 -44
- package/src/app/components/paginator/mf-paginator.component.ts +0 -52
- package/src/app/components/progress-bar/index.ts +0 -2
- package/src/app/components/progress-bar/mf-progress-bar.component.css +0 -53
- package/src/app/components/progress-bar/mf-progress-bar.component.spec.ts +0 -65
- package/src/app/components/progress-bar/mf-progress-bar.component.ts +0 -79
- package/src/app/components/progress-spinner/index.ts +0 -2
- package/src/app/components/progress-spinner/mf-progress-spinner.component.css +0 -38
- package/src/app/components/progress-spinner/mf-progress-spinner.component.spec.ts +0 -59
- package/src/app/components/progress-spinner/mf-progress-spinner.component.ts +0 -81
- package/src/app/components/radio-button/index.ts +0 -2
- package/src/app/components/radio-button/mf-radio-button.component.css +0 -86
- package/src/app/components/radio-button/mf-radio-button.component.spec.ts +0 -55
- package/src/app/components/radio-button/mf-radio-button.component.ts +0 -219
- package/src/app/components/select/index.ts +0 -2
- package/src/app/components/select/mf-select.component.css +0 -121
- package/src/app/components/select/mf-select.component.spec.ts +0 -108
- package/src/app/components/select/mf-select.component.ts +0 -252
- package/src/app/components/sidenav/index.ts +0 -2
- package/src/app/components/sidenav/mf-sidenav.component.css +0 -168
- package/src/app/components/sidenav/mf-sidenav.component.spec.ts +0 -57
- package/src/app/components/sidenav/mf-sidenav.component.ts +0 -126
- package/src/app/components/slide-toggle/index.ts +0 -1
- package/src/app/components/slide-toggle/mf-slide-toggle.component.css +0 -42
- package/src/app/components/slide-toggle/mf-slide-toggle.component.spec.ts +0 -43
- package/src/app/components/slide-toggle/mf-slide-toggle.component.ts +0 -188
- package/src/app/components/snackbar/index.ts +0 -2
- package/src/app/components/snackbar/mf-snackbar.service.css +0 -31
- package/src/app/components/snackbar/mf-snackbar.service.spec.ts +0 -81
- package/src/app/components/snackbar/mf-snackbar.service.ts +0 -77
- package/src/app/components/table/index.ts +0 -2
- package/src/app/components/table/mf-table.component.css +0 -68
- package/src/app/components/table/mf-table.component.spec.ts +0 -76
- package/src/app/components/table/mf-table.component.ts +0 -117
- package/src/app/components/tabs/index.ts +0 -2
- package/src/app/components/tabs/mf-tabs.component.css +0 -31
- package/src/app/components/tabs/mf-tabs.component.spec.ts +0 -50
- package/src/app/components/tabs/mf-tabs.component.ts +0 -62
- package/src/app/components/textarea/index.ts +0 -2
- package/src/app/components/textarea/mf-textarea.component.css +0 -48
- package/src/app/components/textarea/mf-textarea.component.spec.ts +0 -55
- package/src/app/components/textarea/mf-textarea.component.ts +0 -227
- package/src/app/components/toolbar/index.ts +0 -2
- package/src/app/components/toolbar/mf-toolbar.component.css +0 -77
- package/src/app/components/toolbar/mf-toolbar.component.ts +0 -56
- package/src/app/components/tooltip/index.ts +0 -3
- package/src/app/components/tooltip/mf-tooltip.component.css +0 -7
- package/src/app/components/tooltip/mf-tooltip.component.spec.ts +0 -37
- package/src/app/components/tooltip/mf-tooltip.component.ts +0 -47
- package/src/app/components/tooltip/mf-tooltip.directive.ts +0 -22
- package/src/index.html +0 -18
- package/src/main.ts +0 -6
- package/src/public-api.ts +0 -31
- package/src/stories/About.mdx +0 -72
- package/src/stories/Accessibility.mdx +0 -59
- package/src/stories/Welcome.mdx +0 -26
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -1
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -1
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -1
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -1
- package/src/stories/assets/youtube.svg +0 -1
- package/src/stories/mf-a11y-contracts.stories.ts +0 -472
- package/src/stories/mf-autocomplete.stories.ts +0 -194
- package/src/stories/mf-button.stories.ts +0 -152
- package/src/stories/mf-card.stories.ts +0 -147
- package/src/stories/mf-checkbox.stories.ts +0 -88
- package/src/stories/mf-datepicker.stories.ts +0 -118
- package/src/stories/mf-dialog.stories.ts +0 -159
- package/src/stories/mf-form-field.stories.ts +0 -108
- package/src/stories/mf-grid-list.stories.ts +0 -104
- package/src/stories/mf-icon.stories.ts +0 -133
- package/src/stories/mf-input.stories.ts +0 -158
- package/src/stories/mf-menu.stories.ts +0 -71
- package/src/stories/mf-progress-bar.stories.ts +0 -119
- package/src/stories/mf-progress-spinner.stories.ts +0 -124
- package/src/stories/mf-radio-button.stories.ts +0 -111
- package/src/stories/mf-select.stories.ts +0 -184
- package/src/stories/mf-sidenav.stories.ts +0 -331
- package/src/stories/mf-table.stories.ts +0 -80
- package/src/stories/mf-toolbar.stories.ts +0 -112
- package/src/stories/user.ts +0 -3
- package/tsconfig.app.json +0 -15
- package/tsconfig.json +0 -33
- package/tsconfig.spec.json +0 -15
- package/vercel.json +0 -6
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
display: block;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.mf-breadcrumb__list {
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
flex-wrap: wrap;
|
|
9
|
-
list-style: none;
|
|
10
|
-
margin: 0;
|
|
11
|
-
padding: 0;
|
|
12
|
-
gap: var(--mf-space-1);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.mf-breadcrumb__item {
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
gap: var(--mf-space-1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.mf-breadcrumb__link {
|
|
22
|
-
display: inline-flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
gap: var(--mf-space-1);
|
|
25
|
-
color: var(--mf-color-brand);
|
|
26
|
-
text-decoration: none;
|
|
27
|
-
font-family: var(--mf-font-base);
|
|
28
|
-
font-size: var(--mf-text-sm);
|
|
29
|
-
font-weight: var(--mf-weight-medium);
|
|
30
|
-
padding: var(--mf-space-1) var(--mf-space-2);
|
|
31
|
-
border-radius: var(--mf-radius-sm);
|
|
32
|
-
transition: background-color var(--mf-duration-fast) var(--mf-ease-standard);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.mf-breadcrumb__link:hover {
|
|
36
|
-
background-color: var(--mf-color-brand-light);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.mf-breadcrumb__current {
|
|
40
|
-
display: inline-flex;
|
|
41
|
-
align-items: center;
|
|
42
|
-
gap: var(--mf-space-1);
|
|
43
|
-
color: var(--mf-color-neutral-400);
|
|
44
|
-
font-family: var(--mf-font-base);
|
|
45
|
-
font-size: var(--mf-text-sm);
|
|
46
|
-
font-weight: var(--mf-weight-medium);
|
|
47
|
-
padding: var(--mf-space-1) var(--mf-space-2);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.mf-breadcrumb__separator {
|
|
51
|
-
font-size: 18px !important;
|
|
52
|
-
width: 18px !important;
|
|
53
|
-
height: 18px !important;
|
|
54
|
-
color: var(--mf-color-neutral-300);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.mf-breadcrumb__icon {
|
|
58
|
-
font-size: 16px !important;
|
|
59
|
-
width: 16px !important;
|
|
60
|
-
height: 16px !important;
|
|
61
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { MfBreadcrumbComponent } from './mf-breadcrumb.component';
|
|
3
|
-
|
|
4
|
-
describe('MfBreadcrumbComponent', () => {
|
|
5
|
-
let fixture: ComponentFixture<MfBreadcrumbComponent>;
|
|
6
|
-
let component: MfBreadcrumbComponent;
|
|
7
|
-
|
|
8
|
-
const testItems = [
|
|
9
|
-
{ label: 'Home', href: '/', icon: 'home' },
|
|
10
|
-
{ label: 'Products', href: '/products' },
|
|
11
|
-
{ label: 'Detail' },
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
beforeEach(async () => {
|
|
15
|
-
await TestBed.configureTestingModule({
|
|
16
|
-
imports: [MfBreadcrumbComponent],
|
|
17
|
-
}).compileComponents();
|
|
18
|
-
|
|
19
|
-
fixture = TestBed.createComponent(MfBreadcrumbComponent);
|
|
20
|
-
component = fixture.componentInstance;
|
|
21
|
-
fixture.componentRef.setInput('items', testItems);
|
|
22
|
-
fixture.detectChanges();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should create', () => {
|
|
26
|
-
expect(component).toBeTruthy();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('should render breadcrumb items', () => {
|
|
30
|
-
const items = fixture.nativeElement.querySelectorAll('.mf-breadcrumb__item');
|
|
31
|
-
expect(items.length).toBe(3);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should render links for non-last items with href', () => {
|
|
35
|
-
const links = fixture.nativeElement.querySelectorAll('.mf-breadcrumb__link');
|
|
36
|
-
expect(links.length).toBe(2);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should render last item as current', () => {
|
|
40
|
-
const current = fixture.nativeElement.querySelectorAll('.mf-breadcrumb__current');
|
|
41
|
-
expect(current.length).toBeGreaterThanOrEqual(1);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should have aria-label', () => {
|
|
45
|
-
const nav = fixture.nativeElement.querySelector('nav');
|
|
46
|
-
expect(nav?.getAttribute('aria-label')).toBe('Breadcrumb');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should render separators', () => {
|
|
50
|
-
const separators = fixture.nativeElement.querySelectorAll('.mf-breadcrumb__separator');
|
|
51
|
-
expect(separators.length).toBe(2);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('should emit item click', () => {
|
|
55
|
-
const spy = vi.fn();
|
|
56
|
-
component.mfItemClick.subscribe(spy);
|
|
57
|
-
const link = fixture.nativeElement.querySelector('.mf-breadcrumb__link');
|
|
58
|
-
link?.click();
|
|
59
|
-
expect(spy).toHaveBeenCalled();
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
computed,
|
|
5
|
-
input,
|
|
6
|
-
output,
|
|
7
|
-
} from '@angular/core';
|
|
8
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
9
|
-
|
|
10
|
-
export interface MfBreadcrumbItem {
|
|
11
|
-
label: string;
|
|
12
|
-
href?: string;
|
|
13
|
-
icon?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Breadcrumb de la librería ng-comps.
|
|
18
|
-
* Componente de navegación jerárquica para indicar la ubicación
|
|
19
|
-
* del usuario en la aplicación.
|
|
20
|
-
*/
|
|
21
|
-
@Component({
|
|
22
|
-
selector: 'mf-breadcrumb',
|
|
23
|
-
imports: [MatIconModule],
|
|
24
|
-
template: `
|
|
25
|
-
<nav [attr.aria-label]="ariaLabel()" [class]="hostClasses()">
|
|
26
|
-
<ol class="mf-breadcrumb__list">
|
|
27
|
-
@for (item of items(); track item.label; let last = $last) {
|
|
28
|
-
<li class="mf-breadcrumb__item">
|
|
29
|
-
@if (!last && item.href) {
|
|
30
|
-
<a
|
|
31
|
-
class="mf-breadcrumb__link"
|
|
32
|
-
[href]="item.href"
|
|
33
|
-
(click)="onItemClick($event, item)"
|
|
34
|
-
>
|
|
35
|
-
@if (item.icon) {
|
|
36
|
-
<mat-icon class="mf-breadcrumb__icon" aria-hidden="true">{{ item.icon }}</mat-icon>
|
|
37
|
-
}
|
|
38
|
-
{{ item.label }}
|
|
39
|
-
</a>
|
|
40
|
-
} @else {
|
|
41
|
-
<span class="mf-breadcrumb__current" [attr.aria-current]="last ? 'page' : null">
|
|
42
|
-
@if (item.icon) {
|
|
43
|
-
<mat-icon class="mf-breadcrumb__icon" aria-hidden="true">{{ item.icon }}</mat-icon>
|
|
44
|
-
}
|
|
45
|
-
{{ item.label }}
|
|
46
|
-
</span>
|
|
47
|
-
}
|
|
48
|
-
@if (!last) {
|
|
49
|
-
<mat-icon class="mf-breadcrumb__separator" aria-hidden="true">{{ separator() }}</mat-icon>
|
|
50
|
-
}
|
|
51
|
-
</li>
|
|
52
|
-
}
|
|
53
|
-
</ol>
|
|
54
|
-
</nav>
|
|
55
|
-
`,
|
|
56
|
-
styleUrl: './mf-breadcrumb.component.css',
|
|
57
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
58
|
-
})
|
|
59
|
-
export class MfBreadcrumbComponent {
|
|
60
|
-
/** Items del breadcrumb */
|
|
61
|
-
readonly items = input.required<MfBreadcrumbItem[]>();
|
|
62
|
-
/** Icono separador */
|
|
63
|
-
readonly separator = input<string>('chevron_right');
|
|
64
|
-
/** Label de accesibilidad */
|
|
65
|
-
readonly ariaLabel = input<string>('Breadcrumb');
|
|
66
|
-
|
|
67
|
-
readonly mfItemClick = output<MfBreadcrumbItem>();
|
|
68
|
-
|
|
69
|
-
readonly hostClasses = computed(() => 'mf-breadcrumb');
|
|
70
|
-
|
|
71
|
-
onItemClick(event: Event, item: MfBreadcrumbItem): void {
|
|
72
|
-
event.preventDefault();
|
|
73
|
-
this.mfItemClick.emit(item);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
:host([fullWidth]),
|
|
6
|
-
:host-context(.mf-btn--full) {
|
|
7
|
-
display: block;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/* ── Base ──────────────────────────────────────────────────────── */
|
|
11
|
-
.mf-btn {
|
|
12
|
-
border-radius: var(--mf-radius-full) !important;
|
|
13
|
-
font-family: var(--mf-font-base) !important;
|
|
14
|
-
font-weight: var(--mf-weight-bold) !important;
|
|
15
|
-
letter-spacing: 0.01em;
|
|
16
|
-
transition:
|
|
17
|
-
background-color var(--mf-duration-base) var(--mf-ease-standard),
|
|
18
|
-
box-shadow var(--mf-duration-base) var(--mf-ease-standard),
|
|
19
|
-
opacity var(--mf-duration-fast) var(--mf-ease-standard);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.mf-btn.mf-btn--full {
|
|
23
|
-
width: 100%;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.mf-btn--icon {
|
|
27
|
-
border-radius: var(--mf-radius-full) !important;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/* ── Filled ────────────────────────────────────────────────────── */
|
|
31
|
-
.mf-btn--filled.mdc-button,
|
|
32
|
-
.mf-btn--filled.mat-mdc-unelevated-button {
|
|
33
|
-
background-color: var(--mf-color-brand) !important;
|
|
34
|
-
color: var(--mf-color-on-brand) !important;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.mf-btn--filled.mdc-button:hover:not([disabled]),
|
|
38
|
-
.mf-btn--filled.mat-mdc-unelevated-button:hover:not([disabled]) {
|
|
39
|
-
background-color: var(--mf-color-brand-hover) !important;
|
|
40
|
-
box-shadow: var(--mf-shadow-md);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/* ── Outlined ──────────────────────────────────────────────────── */
|
|
44
|
-
.mf-btn--outlined.mdc-button,
|
|
45
|
-
.mf-btn--outlined.mat-mdc-outlined-button {
|
|
46
|
-
color: var(--mf-color-secondary-900) !important;
|
|
47
|
-
border-color: var(--mf-color-border) !important;
|
|
48
|
-
background-color: var(--mf-color-surface);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.mf-btn--outlined.mdc-button:hover:not([disabled]),
|
|
52
|
-
.mf-btn--outlined.mat-mdc-outlined-button:hover:not([disabled]) {
|
|
53
|
-
background-color: var(--mf-color-surface-raised);
|
|
54
|
-
box-shadow: var(--mf-shadow-sm);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* ── Text ──────────────────────────────────────────────────────── */
|
|
58
|
-
.mf-btn--text.mdc-button,
|
|
59
|
-
.mf-btn--text.mat-mdc-button {
|
|
60
|
-
color: var(--mf-color-brand) !important;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.mf-btn--text.mdc-button:hover:not([disabled]),
|
|
64
|
-
.mf-btn--text.mat-mdc-button:hover:not([disabled]) {
|
|
65
|
-
background-color: var(--mf-color-brand-light);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.mf-btn--text.mat-mdc-icon-button:hover:not([disabled]),
|
|
69
|
-
.mf-btn--filled.mat-mdc-icon-button:hover:not([disabled]),
|
|
70
|
-
.mf-btn--outlined.mat-mdc-icon-button:hover:not([disabled]) {
|
|
71
|
-
background-color: var(--mf-color-brand-light);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.mf-btn--filled.mat-mdc-icon-button {
|
|
75
|
-
color: var(--mf-color-brand) !important;
|
|
76
|
-
background-color: var(--mf-color-brand-light) !important;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.mf-btn--outlined.mat-mdc-icon-button {
|
|
80
|
-
color: var(--mf-color-secondary-900) !important;
|
|
81
|
-
border: 1px solid var(--mf-color-border) !important;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/* ── Tamaños ───────────────────────────────────────────────────── */
|
|
85
|
-
.mf-btn--sm.mdc-button {
|
|
86
|
-
height: 34px !important;
|
|
87
|
-
padding: 0 var(--mf-space-4) !important;
|
|
88
|
-
font-size: var(--mf-text-sm) !important;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.mf-btn--md.mdc-button {
|
|
92
|
-
height: 40px !important;
|
|
93
|
-
padding: 0 var(--mf-space-5) !important;
|
|
94
|
-
font-size: var(--mf-text-sm) !important;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.mf-btn--lg.mdc-button {
|
|
98
|
-
height: 48px !important;
|
|
99
|
-
padding: 0 var(--mf-space-6) !important;
|
|
100
|
-
font-size: var(--mf-text-base) !important;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.mf-btn--icon.mf-btn--sm.mat-mdc-icon-button {
|
|
104
|
-
width: 34px;
|
|
105
|
-
height: 34px;
|
|
106
|
-
padding: 5px;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.mf-btn--icon.mf-btn--md.mat-mdc-icon-button {
|
|
110
|
-
width: 40px;
|
|
111
|
-
height: 40px;
|
|
112
|
-
padding: 8px;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.mf-btn--icon.mf-btn--lg.mat-mdc-icon-button {
|
|
116
|
-
width: 48px;
|
|
117
|
-
height: 48px;
|
|
118
|
-
padding: 11px;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/* ── Disabled ──────────────────────────────────────────────────── */
|
|
122
|
-
.mf-btn[disabled],
|
|
123
|
-
.mf-btn.mdc-button:disabled {
|
|
124
|
-
opacity: 0.42;
|
|
125
|
-
cursor: default;
|
|
126
|
-
pointer-events: none;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/* ── Iconos ────────────────────────────────────────────────────── */
|
|
130
|
-
.mf-btn .mat-icon {
|
|
131
|
-
font-size: 1.1em;
|
|
132
|
-
height: 1.1em;
|
|
133
|
-
width: 1.1em;
|
|
134
|
-
vertical-align: middle;
|
|
135
|
-
line-height: 1;
|
|
136
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
computed,
|
|
5
|
-
effect,
|
|
6
|
-
input,
|
|
7
|
-
output,
|
|
8
|
-
} from '@angular/core';
|
|
9
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
10
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
11
|
-
import { hasAccessibleName, warnInDev } from '../../a11y';
|
|
12
|
-
|
|
13
|
-
export type MfButtonVariant = 'filled' | 'outlined' | 'text';
|
|
14
|
-
export type MfButtonSize = 'sm' | 'md' | 'lg';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Botón de la librerÃa ng-comps.
|
|
18
|
-
* Envuelve Angular Material `mat-button` / `mat-flat-button` / `mat-stroked-button`
|
|
19
|
-
* y expone una API uniforme con look and feel de marca.
|
|
20
|
-
*/
|
|
21
|
-
@Component({
|
|
22
|
-
selector: 'mf-button',
|
|
23
|
-
imports: [MatButtonModule, MatIconModule],
|
|
24
|
-
template: `
|
|
25
|
-
@if (rendersAsIconButton()) {
|
|
26
|
-
<button
|
|
27
|
-
mat-icon-button
|
|
28
|
-
[id]="id() || null"
|
|
29
|
-
[type]="type()"
|
|
30
|
-
[disabled]="disabled()"
|
|
31
|
-
[class]="hostClasses()"
|
|
32
|
-
[attr.aria-label]="iconButtonAriaLabel()"
|
|
33
|
-
[attr.aria-labelledby]="ariaLabelledby() || null"
|
|
34
|
-
[attr.aria-describedby]="ariaDescribedby() || null"
|
|
35
|
-
(click)="mfClick.emit($event)"
|
|
36
|
-
>
|
|
37
|
-
<mat-icon aria-hidden="true">{{ iconName() }}</mat-icon>
|
|
38
|
-
</button>
|
|
39
|
-
} @else if (variant() === 'filled') {
|
|
40
|
-
<button
|
|
41
|
-
mat-flat-button
|
|
42
|
-
[id]="id() || null"
|
|
43
|
-
[type]="type()"
|
|
44
|
-
[disabled]="disabled()"
|
|
45
|
-
[class]="hostClasses()"
|
|
46
|
-
[attr.aria-label]="resolvedAriaLabel()"
|
|
47
|
-
[attr.aria-labelledby]="ariaLabelledby() || null"
|
|
48
|
-
[attr.aria-describedby]="ariaDescribedby() || null"
|
|
49
|
-
(click)="mfClick.emit($event)"
|
|
50
|
-
>
|
|
51
|
-
@if (leadingIcon()) {
|
|
52
|
-
<mat-icon aria-hidden="true">{{ leadingIcon() }}</mat-icon>
|
|
53
|
-
}
|
|
54
|
-
@if (label()) {
|
|
55
|
-
<span>{{ label() }}</span>
|
|
56
|
-
}
|
|
57
|
-
@if (trailingIcon()) {
|
|
58
|
-
<mat-icon aria-hidden="true">{{ trailingIcon() }}</mat-icon>
|
|
59
|
-
}
|
|
60
|
-
</button>
|
|
61
|
-
} @else if (variant() === 'outlined') {
|
|
62
|
-
<button
|
|
63
|
-
mat-stroked-button
|
|
64
|
-
[id]="id() || null"
|
|
65
|
-
[type]="type()"
|
|
66
|
-
[disabled]="disabled()"
|
|
67
|
-
[class]="hostClasses()"
|
|
68
|
-
[attr.aria-label]="resolvedAriaLabel()"
|
|
69
|
-
[attr.aria-labelledby]="ariaLabelledby() || null"
|
|
70
|
-
[attr.aria-describedby]="ariaDescribedby() || null"
|
|
71
|
-
(click)="mfClick.emit($event)"
|
|
72
|
-
>
|
|
73
|
-
@if (leadingIcon()) {
|
|
74
|
-
<mat-icon aria-hidden="true">{{ leadingIcon() }}</mat-icon>
|
|
75
|
-
}
|
|
76
|
-
@if (label()) {
|
|
77
|
-
<span>{{ label() }}</span>
|
|
78
|
-
}
|
|
79
|
-
@if (trailingIcon()) {
|
|
80
|
-
<mat-icon aria-hidden="true">{{ trailingIcon() }}</mat-icon>
|
|
81
|
-
}
|
|
82
|
-
</button>
|
|
83
|
-
} @else {
|
|
84
|
-
<button
|
|
85
|
-
mat-button
|
|
86
|
-
[id]="id() || null"
|
|
87
|
-
[type]="type()"
|
|
88
|
-
[disabled]="disabled()"
|
|
89
|
-
[class]="hostClasses()"
|
|
90
|
-
[attr.aria-label]="resolvedAriaLabel()"
|
|
91
|
-
[attr.aria-labelledby]="ariaLabelledby() || null"
|
|
92
|
-
[attr.aria-describedby]="ariaDescribedby() || null"
|
|
93
|
-
(click)="mfClick.emit($event)"
|
|
94
|
-
>
|
|
95
|
-
@if (leadingIcon()) {
|
|
96
|
-
<mat-icon aria-hidden="true">{{ leadingIcon() }}</mat-icon>
|
|
97
|
-
}
|
|
98
|
-
@if (label()) {
|
|
99
|
-
<span>{{ label() }}</span>
|
|
100
|
-
}
|
|
101
|
-
@if (trailingIcon()) {
|
|
102
|
-
<mat-icon aria-hidden="true">{{ trailingIcon() }}</mat-icon>
|
|
103
|
-
}
|
|
104
|
-
</button>
|
|
105
|
-
}
|
|
106
|
-
`,
|
|
107
|
-
styleUrl: './mf-button.component.css',
|
|
108
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
109
|
-
})
|
|
110
|
-
export class MfButtonComponent {
|
|
111
|
-
readonly id = input<string | undefined>(undefined);
|
|
112
|
-
readonly label = input<string | undefined>(undefined);
|
|
113
|
-
readonly ariaLabel = input<string | undefined>(undefined);
|
|
114
|
-
readonly ariaLabelledby = input<string | undefined>(undefined);
|
|
115
|
-
readonly ariaDescribedby = input<string | undefined>(undefined);
|
|
116
|
-
readonly variant = input<MfButtonVariant>('filled');
|
|
117
|
-
readonly size = input<MfButtonSize>('md');
|
|
118
|
-
readonly type = input<'button' | 'submit' | 'reset'>('button');
|
|
119
|
-
readonly disabled = input(false);
|
|
120
|
-
readonly leadingIcon = input<string | undefined>(undefined);
|
|
121
|
-
readonly trailingIcon = input<string | undefined>(undefined);
|
|
122
|
-
readonly fullWidth = input(false);
|
|
123
|
-
readonly iconOnly = input(false);
|
|
124
|
-
|
|
125
|
-
readonly mfClick = output<MouseEvent>();
|
|
126
|
-
|
|
127
|
-
constructor() {
|
|
128
|
-
effect(() => {
|
|
129
|
-
if (
|
|
130
|
-
!hasAccessibleName(
|
|
131
|
-
this.label(),
|
|
132
|
-
this.ariaLabel(),
|
|
133
|
-
this.ariaLabelledby(),
|
|
134
|
-
)
|
|
135
|
-
) {
|
|
136
|
-
warnInDev(
|
|
137
|
-
'mf-button requiere texto visible, `ariaLabel` o `ariaLabelledby` para exponer un nombre accesible.',
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (this.rendersAsIconButton() && !this.iconName()) {
|
|
142
|
-
warnInDev(
|
|
143
|
-
'mf-button en modo `iconOnly` requiere `leadingIcon` o `trailingIcon`.',
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
readonly rendersAsIconButton = computed(
|
|
150
|
-
() => this.iconOnly() || (!this.label()?.trim() && Boolean(this.iconName())),
|
|
151
|
-
);
|
|
152
|
-
readonly iconName = computed(
|
|
153
|
-
() => this.leadingIcon() ?? this.trailingIcon() ?? 'help',
|
|
154
|
-
);
|
|
155
|
-
readonly resolvedAriaLabel = computed(() =>
|
|
156
|
-
this.label() ? null : this.ariaLabel() ?? null,
|
|
157
|
-
);
|
|
158
|
-
readonly iconButtonAriaLabel = computed(
|
|
159
|
-
() => this.ariaLabel() ?? this.label() ?? null,
|
|
160
|
-
);
|
|
161
|
-
|
|
162
|
-
readonly hostClasses = computed(() => {
|
|
163
|
-
const classes = [
|
|
164
|
-
'mf-btn',
|
|
165
|
-
`mf-btn--${this.variant()}`,
|
|
166
|
-
`mf-btn--${this.size()}`,
|
|
167
|
-
];
|
|
168
|
-
|
|
169
|
-
if (this.fullWidth()) classes.push('mf-btn--full');
|
|
170
|
-
if (this.rendersAsIconButton()) classes.push('mf-btn--icon');
|
|
171
|
-
|
|
172
|
-
return classes.join(' ');
|
|
173
|
-
});
|
|
174
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
display: block;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
/* ── Base ──────────────────────────────────────────────────────── */
|
|
6
|
-
.mf-card {
|
|
7
|
-
font-family: var(--mf-font-base) !important;
|
|
8
|
-
border-radius: var(--mf-radius-xl) !important;
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
transition:
|
|
11
|
-
box-shadow var(--mf-duration-base) var(--mf-ease-standard),
|
|
12
|
-
transform var(--mf-duration-base) var(--mf-ease-standard);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/* ── Variants ──────────────────────────────────────────────────── */
|
|
16
|
-
.mf-card--elevated {
|
|
17
|
-
background-color: var(--mf-color-surface) !important;
|
|
18
|
-
box-shadow: var(--mf-shadow-md) !important;
|
|
19
|
-
border: none !important;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.mf-card--outlined {
|
|
23
|
-
background-color: var(--mf-color-surface) !important;
|
|
24
|
-
box-shadow: none !important;
|
|
25
|
-
border: 1px solid var(--mf-color-border) !important;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.mf-card--flat {
|
|
29
|
-
background-color: var(--mf-color-surface-raised) !important;
|
|
30
|
-
box-shadow: none !important;
|
|
31
|
-
border: none !important;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/* ── Interactive ───────────────────────────────────────────────── */
|
|
35
|
-
.mf-card--interactive {
|
|
36
|
-
cursor: pointer;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.mf-card--interactive:hover {
|
|
40
|
-
box-shadow: var(--mf-shadow-lg) !important;
|
|
41
|
-
transform: translateY(-2px);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.mf-card--interactive:active {
|
|
45
|
-
transform: translateY(0);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* ── Padding ───────────────────────────────────────────────────── */
|
|
49
|
-
.mf-card--pad-none .mat-mdc-card-content {
|
|
50
|
-
padding: 0 !important;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.mf-card--pad-sm .mat-mdc-card-content {
|
|
54
|
-
padding: var(--mf-space-3) !important;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.mf-card--pad-md .mat-mdc-card-content {
|
|
58
|
-
padding: var(--mf-space-5) !important;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.mf-card--pad-lg .mat-mdc-card-content {
|
|
62
|
-
padding: var(--mf-space-8) !important;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/* ── Header ────────────────────────────────────────────────────── */
|
|
66
|
-
.mf-card .mat-mdc-card-header {
|
|
67
|
-
padding: var(--mf-space-5) var(--mf-space-5) 0 !important;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.mf-card__title {
|
|
71
|
-
font-family: var(--mf-font-display) !important;
|
|
72
|
-
font-size: var(--mf-text-lg) !important;
|
|
73
|
-
font-weight: var(--mf-weight-bold) !important;
|
|
74
|
-
color: var(--mf-color-on-surface) !important;
|
|
75
|
-
margin: 0 !important;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.mf-card__subtitle {
|
|
79
|
-
font-size: var(--mf-text-sm) !important;
|
|
80
|
-
color: var(--mf-color-neutral-400) !important;
|
|
81
|
-
margin-top: var(--mf-space-1) !important;
|
|
82
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
computed,
|
|
5
|
-
input,
|
|
6
|
-
} from '@angular/core';
|
|
7
|
-
import { MatCardModule } from '@angular/material/card';
|
|
8
|
-
|
|
9
|
-
export type MfCardVariant = 'elevated' | 'outlined' | 'flat';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Card de la librería ng-comps.
|
|
13
|
-
* Envuelve Angular Material `mat-card` y expone una API uniforme
|
|
14
|
-
* con look and feel de marca. Admite contenido proyectado mediante slots.
|
|
15
|
-
*/
|
|
16
|
-
@Component({
|
|
17
|
-
selector: 'mf-card',
|
|
18
|
-
imports: [MatCardModule],
|
|
19
|
-
template: `
|
|
20
|
-
<mat-card [class]="hostClasses()">
|
|
21
|
-
@if (hasHeader()) {
|
|
22
|
-
<mat-card-header>
|
|
23
|
-
@if (title()) {
|
|
24
|
-
<mat-card-title class="mf-card__title">{{ title() }}</mat-card-title>
|
|
25
|
-
}
|
|
26
|
-
@if (subtitle()) {
|
|
27
|
-
<mat-card-subtitle class="mf-card__subtitle">{{ subtitle() }}</mat-card-subtitle>
|
|
28
|
-
}
|
|
29
|
-
</mat-card-header>
|
|
30
|
-
}
|
|
31
|
-
<mat-card-content>
|
|
32
|
-
<ng-content />
|
|
33
|
-
</mat-card-content>
|
|
34
|
-
<ng-content select="[mfCardFooter]" />
|
|
35
|
-
</mat-card>
|
|
36
|
-
`,
|
|
37
|
-
styleUrl: './mf-card.component.css',
|
|
38
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
39
|
-
})
|
|
40
|
-
export class MfCardComponent {
|
|
41
|
-
/** Título de la card */
|
|
42
|
-
readonly title = input<string | undefined>(undefined);
|
|
43
|
-
/** Subtítulo de la card */
|
|
44
|
-
readonly subtitle = input<string | undefined>(undefined);
|
|
45
|
-
/** Variante visual */
|
|
46
|
-
readonly variant = input<MfCardVariant>('elevated');
|
|
47
|
-
/** Padding interno */
|
|
48
|
-
readonly padding = input<'none' | 'sm' | 'md' | 'lg'>('md');
|
|
49
|
-
/** Interactiva (hover effect) */
|
|
50
|
-
readonly interactive = input(false);
|
|
51
|
-
|
|
52
|
-
readonly hasHeader = computed(() => !!this.title() || !!this.subtitle());
|
|
53
|
-
|
|
54
|
-
readonly hostClasses = computed(() => {
|
|
55
|
-
const classes = ['mf-card', `mf-card--${this.variant()}`, `mf-card--pad-${this.padding()}`];
|
|
56
|
-
if (this.interactive()) classes.push('mf-card--interactive');
|
|
57
|
-
return classes.join(' ');
|
|
58
|
-
});
|
|
59
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MfCheckboxComponent } from './mf-checkbox.component';
|