ng-comps 1.0.2 → 3.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.
Files changed (197) hide show
  1. package/fesm2022/ng-comps.mjs +4254 -0
  2. package/package.json +54 -58
  3. package/src/styles.css +54 -0
  4. package/types/ng-comps.d.ts +1348 -0
  5. package/.editorconfig +0 -17
  6. package/.github/copilot-instructions.md +0 -55
  7. package/.github/workflows/ci.yml +0 -29
  8. package/.prettierrc +0 -12
  9. package/.storybook/main.ts +0 -21
  10. package/.storybook/preview.ts +0 -27
  11. package/.storybook/tsconfig.doc.json +0 -10
  12. package/.storybook/tsconfig.json +0 -15
  13. package/.storybook/typings.d.ts +0 -4
  14. package/.vscode/extensions.json +0 -4
  15. package/.vscode/launch.json +0 -20
  16. package/.vscode/mcp.json +0 -9
  17. package/.vscode/tasks.json +0 -42
  18. package/ACCESSIBILITY.md +0 -127
  19. package/angular.json +0 -106
  20. package/documentation.json +0 -13394
  21. package/ng-package.json +0 -27
  22. package/public/favicon.ico +0 -0
  23. package/scripts/prepare-package.mjs +0 -80
  24. package/src/app/a11y/accessibility.utils.ts +0 -35
  25. package/src/app/a11y/index.ts +0 -6
  26. package/src/app/accessibility/ng-comps.a11y.spec.ts +0 -108
  27. package/src/app/app.config.ts +0 -11
  28. package/src/app/app.css +0 -107
  29. package/src/app/app.html +0 -48
  30. package/src/app/app.routes.ts +0 -3
  31. package/src/app/app.spec.ts +0 -23
  32. package/src/app/app.ts +0 -10
  33. package/src/app/components/accordion/index.ts +0 -2
  34. package/src/app/components/accordion/mf-accordion.component.css +0 -38
  35. package/src/app/components/accordion/mf-accordion.component.spec.ts +0 -48
  36. package/src/app/components/accordion/mf-accordion.component.ts +0 -53
  37. package/src/app/components/alert/index.ts +0 -2
  38. package/src/app/components/alert/mf-alert.component.css +0 -100
  39. package/src/app/components/alert/mf-alert.component.spec.ts +0 -59
  40. package/src/app/components/alert/mf-alert.component.ts +0 -68
  41. package/src/app/components/autocomplete/index.ts +0 -5
  42. package/src/app/components/autocomplete/mf-autocomplete.component.css +0 -105
  43. package/src/app/components/autocomplete/mf-autocomplete.component.spec.ts +0 -116
  44. package/src/app/components/autocomplete/mf-autocomplete.component.ts +0 -307
  45. package/src/app/components/avatar/index.ts +0 -2
  46. package/src/app/components/avatar/mf-avatar.component.css +0 -27
  47. package/src/app/components/avatar/mf-avatar.component.spec.ts +0 -49
  48. package/src/app/components/avatar/mf-avatar.component.ts +0 -99
  49. package/src/app/components/badge/index.ts +0 -2
  50. package/src/app/components/badge/mf-badge.component.css +0 -32
  51. package/src/app/components/badge/mf-badge.component.spec.ts +0 -40
  52. package/src/app/components/badge/mf-badge.component.ts +0 -105
  53. package/src/app/components/breadcrumb/index.ts +0 -2
  54. package/src/app/components/breadcrumb/mf-breadcrumb.component.css +0 -61
  55. package/src/app/components/breadcrumb/mf-breadcrumb.component.spec.ts +0 -61
  56. package/src/app/components/breadcrumb/mf-breadcrumb.component.ts +0 -75
  57. package/src/app/components/button/index.ts +0 -2
  58. package/src/app/components/button/mf-button.component.css +0 -136
  59. package/src/app/components/button/mf-button.component.ts +0 -174
  60. package/src/app/components/card/index.ts +0 -2
  61. package/src/app/components/card/mf-card.component.css +0 -82
  62. package/src/app/components/card/mf-card.component.ts +0 -59
  63. package/src/app/components/checkbox/index.ts +0 -1
  64. package/src/app/components/checkbox/mf-checkbox.component.css +0 -75
  65. package/src/app/components/checkbox/mf-checkbox.component.ts +0 -187
  66. package/src/app/components/chip/index.ts +0 -2
  67. package/src/app/components/chip/mf-chip.component.css +0 -69
  68. package/src/app/components/chip/mf-chip.component.spec.ts +0 -47
  69. package/src/app/components/chip/mf-chip.component.ts +0 -77
  70. package/src/app/components/datepicker/index.ts +0 -2
  71. package/src/app/components/datepicker/mf-datepicker.component.css +0 -102
  72. package/src/app/components/datepicker/mf-datepicker.component.spec.ts +0 -69
  73. package/src/app/components/datepicker/mf-datepicker.component.ts +0 -233
  74. package/src/app/components/dialog/index.ts +0 -3
  75. package/src/app/components/dialog/mf-dialog.component.css +0 -73
  76. package/src/app/components/dialog/mf-dialog.component.ts +0 -160
  77. package/src/app/components/dialog/mf-dialog.service.spec.ts +0 -61
  78. package/src/app/components/dialog/mf-dialog.service.ts +0 -52
  79. package/src/app/components/divider/index.ts +0 -2
  80. package/src/app/components/divider/mf-divider.component.css +0 -38
  81. package/src/app/components/divider/mf-divider.component.spec.ts +0 -40
  82. package/src/app/components/divider/mf-divider.component.ts +0 -44
  83. package/src/app/components/form-field/index.ts +0 -1
  84. package/src/app/components/form-field/mf-form-field.component.css +0 -51
  85. package/src/app/components/form-field/mf-form-field.component.ts +0 -74
  86. package/src/app/components/grid-list/index.ts +0 -2
  87. package/src/app/components/grid-list/mf-grid-list.component.css +0 -47
  88. package/src/app/components/grid-list/mf-grid-list.component.spec.ts +0 -57
  89. package/src/app/components/grid-list/mf-grid-list.component.ts +0 -68
  90. package/src/app/components/icon/index.ts +0 -2
  91. package/src/app/components/icon/mf-icon.component.css +0 -56
  92. package/src/app/components/icon/mf-icon.component.ts +0 -41
  93. package/src/app/components/input/index.ts +0 -2
  94. package/src/app/components/input/mf-input.component.css +0 -105
  95. package/src/app/components/input/mf-input.component.ts +0 -217
  96. package/src/app/components/menu/index.ts +0 -2
  97. package/src/app/components/menu/mf-menu.component.css +0 -31
  98. package/src/app/components/menu/mf-menu.component.spec.ts +0 -49
  99. package/src/app/components/menu/mf-menu.component.ts +0 -66
  100. package/src/app/components/paginator/index.ts +0 -1
  101. package/src/app/components/paginator/mf-paginator.component.css +0 -32
  102. package/src/app/components/paginator/mf-paginator.component.spec.ts +0 -44
  103. package/src/app/components/paginator/mf-paginator.component.ts +0 -52
  104. package/src/app/components/progress-bar/index.ts +0 -2
  105. package/src/app/components/progress-bar/mf-progress-bar.component.css +0 -53
  106. package/src/app/components/progress-bar/mf-progress-bar.component.spec.ts +0 -65
  107. package/src/app/components/progress-bar/mf-progress-bar.component.ts +0 -79
  108. package/src/app/components/progress-spinner/index.ts +0 -2
  109. package/src/app/components/progress-spinner/mf-progress-spinner.component.css +0 -38
  110. package/src/app/components/progress-spinner/mf-progress-spinner.component.spec.ts +0 -59
  111. package/src/app/components/progress-spinner/mf-progress-spinner.component.ts +0 -81
  112. package/src/app/components/radio-button/index.ts +0 -2
  113. package/src/app/components/radio-button/mf-radio-button.component.css +0 -86
  114. package/src/app/components/radio-button/mf-radio-button.component.spec.ts +0 -55
  115. package/src/app/components/radio-button/mf-radio-button.component.ts +0 -219
  116. package/src/app/components/select/index.ts +0 -2
  117. package/src/app/components/select/mf-select.component.css +0 -121
  118. package/src/app/components/select/mf-select.component.spec.ts +0 -108
  119. package/src/app/components/select/mf-select.component.ts +0 -252
  120. package/src/app/components/sidenav/index.ts +0 -2
  121. package/src/app/components/sidenav/mf-sidenav.component.css +0 -168
  122. package/src/app/components/sidenav/mf-sidenav.component.spec.ts +0 -57
  123. package/src/app/components/sidenav/mf-sidenav.component.ts +0 -126
  124. package/src/app/components/slide-toggle/index.ts +0 -1
  125. package/src/app/components/slide-toggle/mf-slide-toggle.component.css +0 -42
  126. package/src/app/components/slide-toggle/mf-slide-toggle.component.spec.ts +0 -43
  127. package/src/app/components/slide-toggle/mf-slide-toggle.component.ts +0 -188
  128. package/src/app/components/snackbar/index.ts +0 -2
  129. package/src/app/components/snackbar/mf-snackbar.service.css +0 -31
  130. package/src/app/components/snackbar/mf-snackbar.service.spec.ts +0 -81
  131. package/src/app/components/snackbar/mf-snackbar.service.ts +0 -77
  132. package/src/app/components/table/index.ts +0 -2
  133. package/src/app/components/table/mf-table.component.css +0 -68
  134. package/src/app/components/table/mf-table.component.spec.ts +0 -76
  135. package/src/app/components/table/mf-table.component.ts +0 -117
  136. package/src/app/components/tabs/index.ts +0 -2
  137. package/src/app/components/tabs/mf-tabs.component.css +0 -31
  138. package/src/app/components/tabs/mf-tabs.component.spec.ts +0 -50
  139. package/src/app/components/tabs/mf-tabs.component.ts +0 -62
  140. package/src/app/components/textarea/index.ts +0 -2
  141. package/src/app/components/textarea/mf-textarea.component.css +0 -48
  142. package/src/app/components/textarea/mf-textarea.component.spec.ts +0 -55
  143. package/src/app/components/textarea/mf-textarea.component.ts +0 -227
  144. package/src/app/components/toolbar/index.ts +0 -2
  145. package/src/app/components/toolbar/mf-toolbar.component.css +0 -77
  146. package/src/app/components/toolbar/mf-toolbar.component.ts +0 -56
  147. package/src/app/components/tooltip/index.ts +0 -3
  148. package/src/app/components/tooltip/mf-tooltip.component.css +0 -7
  149. package/src/app/components/tooltip/mf-tooltip.component.spec.ts +0 -37
  150. package/src/app/components/tooltip/mf-tooltip.component.ts +0 -47
  151. package/src/app/components/tooltip/mf-tooltip.directive.ts +0 -22
  152. package/src/index.html +0 -18
  153. package/src/main.ts +0 -6
  154. package/src/public-api.ts +0 -31
  155. package/src/stories/About.mdx +0 -72
  156. package/src/stories/Accessibility.mdx +0 -59
  157. package/src/stories/Welcome.mdx +0 -26
  158. package/src/stories/assets/accessibility.png +0 -0
  159. package/src/stories/assets/accessibility.svg +0 -1
  160. package/src/stories/assets/addon-library.png +0 -0
  161. package/src/stories/assets/assets.png +0 -0
  162. package/src/stories/assets/avif-test-image.avif +0 -0
  163. package/src/stories/assets/context.png +0 -0
  164. package/src/stories/assets/discord.svg +0 -1
  165. package/src/stories/assets/docs.png +0 -0
  166. package/src/stories/assets/figma-plugin.png +0 -0
  167. package/src/stories/assets/github.svg +0 -1
  168. package/src/stories/assets/share.png +0 -0
  169. package/src/stories/assets/styling.png +0 -0
  170. package/src/stories/assets/testing.png +0 -0
  171. package/src/stories/assets/theming.png +0 -0
  172. package/src/stories/assets/tutorials.svg +0 -1
  173. package/src/stories/assets/youtube.svg +0 -1
  174. package/src/stories/mf-a11y-contracts.stories.ts +0 -472
  175. package/src/stories/mf-autocomplete.stories.ts +0 -194
  176. package/src/stories/mf-button.stories.ts +0 -152
  177. package/src/stories/mf-card.stories.ts +0 -147
  178. package/src/stories/mf-checkbox.stories.ts +0 -88
  179. package/src/stories/mf-datepicker.stories.ts +0 -118
  180. package/src/stories/mf-dialog.stories.ts +0 -159
  181. package/src/stories/mf-form-field.stories.ts +0 -108
  182. package/src/stories/mf-grid-list.stories.ts +0 -104
  183. package/src/stories/mf-icon.stories.ts +0 -133
  184. package/src/stories/mf-input.stories.ts +0 -158
  185. package/src/stories/mf-menu.stories.ts +0 -71
  186. package/src/stories/mf-progress-bar.stories.ts +0 -119
  187. package/src/stories/mf-progress-spinner.stories.ts +0 -124
  188. package/src/stories/mf-radio-button.stories.ts +0 -111
  189. package/src/stories/mf-select.stories.ts +0 -184
  190. package/src/stories/mf-sidenav.stories.ts +0 -331
  191. package/src/stories/mf-table.stories.ts +0 -80
  192. package/src/stories/mf-toolbar.stories.ts +0 -112
  193. package/src/stories/user.ts +0 -3
  194. package/tsconfig.app.json +0 -15
  195. package/tsconfig.json +0 -33
  196. package/tsconfig.spec.json +0 -15
  197. 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,2 +0,0 @@
1
- export { MfButtonComponent } from './mf-button.component';
2
- export type { MfButtonVariant, MfButtonSize } from './mf-button.component';
@@ -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,2 +0,0 @@
1
- export { MfCardComponent } from './mf-card.component';
2
- export type { MfCardVariant } from './mf-card.component';
@@ -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';