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