ng-comps 1.0.0 → 1.0.1

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 (36) hide show
  1. package/documentation.json +32 -32
  2. package/package.json +1 -1
  3. package/src/app/components/alert/mf-alert.component.spec.ts +2 -2
  4. package/src/app/components/alert/mf-alert.component.ts +1 -1
  5. package/src/app/components/chip/mf-chip.component.ts +1 -1
  6. package/src/app/components/datepicker/mf-datepicker.component.spec.ts +4 -4
  7. package/src/app/components/datepicker/mf-datepicker.component.ts +1 -1
  8. package/src/app/components/dialog/mf-dialog.component.ts +1 -1
  9. package/src/app/components/dialog/mf-dialog.service.spec.ts +2 -2
  10. package/src/app/components/menu/mf-menu.component.spec.ts +1 -1
  11. package/src/app/components/menu/mf-menu.component.ts +1 -1
  12. package/src/app/components/progress-bar/mf-progress-bar.component.spec.ts +2 -2
  13. package/src/app/components/progress-spinner/mf-progress-spinner.component.spec.ts +3 -3
  14. package/src/app/components/sidenav/mf-sidenav.component.ts +2 -2
  15. package/src/app/components/table/mf-table.component.ts +1 -1
  16. package/src/stories/About.mdx +72 -72
  17. package/src/stories/Welcome.mdx +26 -27
  18. package/src/stories/mf-a11y-contracts.stories.ts +49 -49
  19. package/src/stories/mf-autocomplete.stories.ts +194 -188
  20. package/src/stories/mf-button.stories.ts +152 -156
  21. package/src/stories/mf-card.stories.ts +147 -148
  22. package/src/stories/mf-checkbox.stories.ts +88 -88
  23. package/src/stories/mf-datepicker.stories.ts +118 -118
  24. package/src/stories/mf-dialog.stories.ts +159 -167
  25. package/src/stories/mf-form-field.stories.ts +108 -108
  26. package/src/stories/mf-grid-list.stories.ts +104 -105
  27. package/src/stories/mf-icon.stories.ts +133 -130
  28. package/src/stories/mf-input.stories.ts +158 -158
  29. package/src/stories/mf-menu.stories.ts +10 -10
  30. package/src/stories/mf-progress-bar.stories.ts +119 -119
  31. package/src/stories/mf-progress-spinner.stories.ts +124 -124
  32. package/src/stories/mf-radio-button.stories.ts +111 -111
  33. package/src/stories/mf-select.stories.ts +184 -178
  34. package/src/stories/mf-sidenav.stories.ts +331 -334
  35. package/src/stories/mf-table.stories.ts +13 -13
  36. package/src/stories/mf-toolbar.stories.ts +112 -112
@@ -1,156 +1,152 @@
1
- import type { Meta, StoryObj } from '@storybook/angular';
2
-
3
- import { MfButtonComponent } from '../app/components/button';
4
-
5
- const meta: Meta<MfButtonComponent> = {
6
- title: 'Components/MfButton',
7
- component: MfButtonComponent,
8
- tags: ['autodocs'],
9
- parameters: {
10
- docs: {
11
- description: {
12
- component: `
13
- **MfButton** es el botón de la librería ng-comps.
14
- Usa Angular Material por debajo pero expone una API uniforme con el look and feel de marca.
15
-
16
- | Variante | Cuándo usarla |
17
- |------------|-----------------------------------------------------|
18
- | \`filled\` | Acción principal una sola por sección |
19
- | \`outlined\` | Acción secundaria o destructiva suave |
20
- | \`text\` | Acción terciaria, navegación interna o links |
21
- `,
22
- },
23
- },
24
- },
25
- argTypes: {
26
- variant: {
27
- control: 'select',
28
- options: ['filled', 'outlined', 'text'],
29
- description: 'Variante visual del botón',
30
- },
31
- size: {
32
- control: 'select',
33
- options: ['sm', 'md', 'lg'],
34
- description: 'Tamaño del botón',
35
- },
36
- type: {
37
- control: 'select',
38
- options: ['button', 'submit', 'reset'],
39
- },
40
- disabled: { control: 'boolean' },
41
- fullWidth: { control: 'boolean' },
42
- leadingIcon: { control: 'text', description: 'Nombre de icono Material antes del texto' },
43
- trailingIcon: { control: 'text', description: 'Nombre de icono Material después del texto' },
44
- mfClick: { action: 'mfClick' },
45
- },
46
- };
47
-
48
- export default meta;
49
- type Story = StoryObj<MfButtonComponent>;
50
-
51
- // ── Stories básicas ───────────────────────────────────────────────────────────
52
-
53
- export const Filled: Story = {
54
- args: {
55
- label: 'Guardar cambios',
56
- variant: 'filled',
57
- },
58
- };
59
-
60
- export const Outlined: Story = {
61
- args: {
62
- label: 'Cancelar',
63
- variant: 'outlined',
64
- },
65
- };
66
-
67
- export const Text: Story = {
68
- args: {
69
- label: 'Ver más detalles',
70
- variant: 'text',
71
- },
72
- };
73
-
74
- // ── Tamaños ───────────────────────────────────────────────────────────────────
75
-
76
- export const Small: Story = {
77
- args: {
78
- label: 'Pequeño',
79
- variant: 'filled',
80
- size: 'sm',
81
- },
82
- };
83
-
84
- export const Medium: Story = {
85
- args: {
86
- label: 'Mediano',
87
- variant: 'filled',
88
- size: 'md',
89
- },
90
- };
91
-
92
- export const Large: Story = {
93
- args: {
94
- label: 'Grande',
95
- variant: 'filled',
96
- size: 'lg',
97
- },
98
- };
99
-
100
- // ── Con iconos ────────────────────────────────────────────────────────────────
101
-
102
- export const WithLeadingIcon: Story = {
103
- name: 'Con icono al inicio',
104
- args: {
105
- label: 'Crear nuevo',
106
- variant: 'filled',
107
- leadingIcon: 'add',
108
- },
109
- };
110
-
111
- export const WithTrailingIcon: Story = {
112
- name: 'Con icono al final',
113
- args: {
114
- label: 'Siguiente',
115
- variant: 'filled',
116
- trailingIcon: 'arrow_forward',
117
- },
118
- };
119
-
120
- // ── Estados ───────────────────────────────────────────────────────────────────
121
-
122
- export const Disabled: Story = {
123
- args: {
124
- label: 'Deshabilitado',
125
- variant: 'filled',
126
- disabled: true,
127
- },
128
- };
129
-
130
- export const FullWidth: Story = {
131
- name: 'Ancho completo',
132
- args: {
133
- label: 'Iniciar sesión',
134
- variant: 'filled',
135
- fullWidth: true,
136
- },
137
- parameters: {
138
- layout: 'padded',
139
- },
140
- };
141
-
142
- // ── Comparativa de variantes ──────────────────────────────────────────────────
143
-
144
- export const AllVariants: Story = {
145
- name: 'Todas las variantes',
146
- render: () => ({
147
- template: `
148
- <div style="display: flex; gap: 12px; flex-wrap: wrap; align-items: center;">
149
- <mf-button label="Filled" variant="filled" />
150
- <mf-button label="Outlined" variant="outlined" />
151
- <mf-button label="Text" variant="text" />
152
- </div>
153
- `,
154
- moduleMetadata: { imports: [MfButtonComponent] },
155
- }),
156
- };
1
+ import type { Meta, StoryObj } from '@storybook/angular';
2
+
3
+ import { MfButtonComponent } from '../app/components/button';
4
+
5
+ const meta: Meta<MfButtonComponent> = {
6
+ title: 'Components/MfButton',
7
+ component: MfButtonComponent,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component: `
13
+ **MfButton** is the button component from the ng-comps library.
14
+ It uses Angular Material under the hood while exposing a consistent branded API.
15
+
16
+ | Variant | When to use it |
17
+ |------------|-----------------------------------------------|
18
+ | \`filled\` | Primary action, usually one per section |
19
+ | \`outlined\` | Secondary action or soft destructive action |
20
+ | \`text\` | Tertiary action, internal navigation, or link |
21
+ `,
22
+ },
23
+ },
24
+ },
25
+ argTypes: {
26
+ variant: {
27
+ control: 'select',
28
+ options: ['filled', 'outlined', 'text'],
29
+ description: 'Visual button variant',
30
+ },
31
+ size: {
32
+ control: 'select',
33
+ options: ['sm', 'md', 'lg'],
34
+ description: 'Button size',
35
+ },
36
+ type: {
37
+ control: 'select',
38
+ options: ['button', 'submit', 'reset'],
39
+ },
40
+ disabled: { control: 'boolean' },
41
+ fullWidth: { control: 'boolean' },
42
+ leadingIcon: {
43
+ control: 'text',
44
+ description: 'Material icon name shown before the label',
45
+ },
46
+ trailingIcon: {
47
+ control: 'text',
48
+ description: 'Material icon name shown after the label',
49
+ },
50
+ mfClick: { action: 'mfClick' },
51
+ },
52
+ };
53
+
54
+ export default meta;
55
+ type Story = StoryObj<MfButtonComponent>;
56
+
57
+ export const Filled: Story = {
58
+ args: {
59
+ label: 'Save changes',
60
+ variant: 'filled',
61
+ },
62
+ };
63
+
64
+ export const Outlined: Story = {
65
+ args: {
66
+ label: 'Cancel',
67
+ variant: 'outlined',
68
+ },
69
+ };
70
+
71
+ export const Text: Story = {
72
+ args: {
73
+ label: 'View details',
74
+ variant: 'text',
75
+ },
76
+ };
77
+
78
+ export const Small: Story = {
79
+ args: {
80
+ label: 'Small',
81
+ variant: 'filled',
82
+ size: 'sm',
83
+ },
84
+ };
85
+
86
+ export const Medium: Story = {
87
+ args: {
88
+ label: 'Medium',
89
+ variant: 'filled',
90
+ size: 'md',
91
+ },
92
+ };
93
+
94
+ export const Large: Story = {
95
+ args: {
96
+ label: 'Large',
97
+ variant: 'filled',
98
+ size: 'lg',
99
+ },
100
+ };
101
+
102
+ export const WithLeadingIcon: Story = {
103
+ name: 'With leading icon',
104
+ args: {
105
+ label: 'Create new',
106
+ variant: 'filled',
107
+ leadingIcon: 'add',
108
+ },
109
+ };
110
+
111
+ export const WithTrailingIcon: Story = {
112
+ name: 'With trailing icon',
113
+ args: {
114
+ label: 'Next',
115
+ variant: 'filled',
116
+ trailingIcon: 'arrow_forward',
117
+ },
118
+ };
119
+
120
+ export const Disabled: Story = {
121
+ args: {
122
+ label: 'Disabled',
123
+ variant: 'filled',
124
+ disabled: true,
125
+ },
126
+ };
127
+
128
+ export const FullWidth: Story = {
129
+ name: 'Full width',
130
+ args: {
131
+ label: 'Sign in',
132
+ variant: 'filled',
133
+ fullWidth: true,
134
+ },
135
+ parameters: {
136
+ layout: 'padded',
137
+ },
138
+ };
139
+
140
+ export const AllVariants: Story = {
141
+ name: 'All variants',
142
+ render: () => ({
143
+ template: `
144
+ <div style="display: flex; gap: 12px; flex-wrap: wrap; align-items: center;">
145
+ <mf-button label="Filled" variant="filled" />
146
+ <mf-button label="Outlined" variant="outlined" />
147
+ <mf-button label="Text" variant="text" />
148
+ </div>
149
+ `,
150
+ moduleMetadata: { imports: [MfButtonComponent] },
151
+ }),
152
+ };
@@ -1,148 +1,147 @@
1
- import type { Meta, StoryObj } from '@storybook/angular';
2
-
3
- import { MfCardComponent } from '../app/components/card';
4
-
5
- const meta: Meta<MfCardComponent> = {
6
- title: 'Molecules/MfCard',
7
- component: MfCardComponent,
8
- tags: ['autodocs'],
9
- parameters: {
10
- docs: {
11
- description: {
12
- component: `
13
- **MfCard** es el componente de card de la librería ng-comps.
14
- Usa Angular Material \`mat-card\` por debajo pero con un estilo propio: minimalista, elegante y moderno.
15
-
16
- | Variante | Cuándo usarla |
17
- |-------------|--------------------------------------------------|
18
- | \`elevated\` | Contenido principal, destacado con sombra |
19
- | \`outlined\` | Contenido secundario, con borde sutil |
20
- | \`flat\` | Contenido de fondo, sin elevación ni borde |
21
- `,
22
- },
23
- },
24
- },
25
- argTypes: {
26
- title: { control: 'text', description: 'Título de la card' },
27
- subtitle: { control: 'text', description: 'Subtítulo de la card' },
28
- variant: {
29
- control: 'select',
30
- options: ['elevated', 'outlined', 'flat'],
31
- description: 'Variante visual',
32
- },
33
- padding: {
34
- control: 'select',
35
- options: ['none', 'sm', 'md', 'lg'],
36
- description: 'Padding interno',
37
- },
38
- interactive: { control: 'boolean', description: 'Efecto hover interactivo' },
39
- },
40
- };
41
-
42
- export default meta;
43
- type Story = StoryObj<MfCardComponent>;
44
-
45
- export const Elevated: Story = {
46
- render: (args) => ({
47
- props: args,
48
- template: `
49
- <mf-card [title]="title" [subtitle]="subtitle" [variant]="variant" [padding]="padding" [interactive]="interactive">
50
- <p style="margin: 0; color: var(--mf-color-neutral-600);">
51
- Este es el contenido de la card. Puede incluir texto, formularios, listas u otros componentes.
52
- </p>
53
- </mf-card>
54
- `,
55
- moduleMetadata: { imports: [MfCardComponent] },
56
- }),
57
- args: {
58
- title: 'Título de la card',
59
- subtitle: 'Subtítulo descriptivo',
60
- variant: 'elevated',
61
- padding: 'md',
62
- interactive: false,
63
- },
64
- };
65
-
66
- export const Outlined: Story = {
67
- render: (args) => ({
68
- props: args,
69
- template: `
70
- <mf-card [title]="title" [subtitle]="subtitle" variant="outlined">
71
- <p style="margin: 0; color: var(--mf-color-neutral-600);">
72
- Card con borde sutil, ideal para contenido secundario.
73
- </p>
74
- </mf-card>
75
- `,
76
- moduleMetadata: { imports: [MfCardComponent] },
77
- }),
78
- args: {
79
- title: 'Card con borde',
80
- subtitle: 'Variante outlined',
81
- },
82
- };
83
-
84
- export const Flat: Story = {
85
- render: (args) => ({
86
- props: args,
87
- template: `
88
- <mf-card [title]="title" variant="flat">
89
- <p style="margin: 0; color: var(--mf-color-neutral-600);">
90
- Card plana con fondo sutil, sin elevación ni borde.
91
- </p>
92
- </mf-card>
93
- `,
94
- moduleMetadata: { imports: [MfCardComponent] },
95
- }),
96
- args: {
97
- title: 'Card plana',
98
- },
99
- };
100
-
101
- export const Interactive: Story = {
102
- render: (args) => ({
103
- props: args,
104
- template: `
105
- <mf-card title="Card interactiva" subtitle="Haz hover para ver el efecto" variant="elevated" [interactive]="true">
106
- <p style="margin: 0; color: var(--mf-color-neutral-600);">
107
- Esta card responde al hover con elevación y movimiento sutil.
108
- </p>
109
- </mf-card>
110
- `,
111
- moduleMetadata: { imports: [MfCardComponent] },
112
- }),
113
- args: {},
114
- };
115
-
116
- export const NoHeader: Story = {
117
- name: 'Sin header',
118
- render: () => ({
119
- template: `
120
- <mf-card variant="outlined" padding="lg">
121
- <p style="margin: 0; color: var(--mf-color-neutral-600); font-size: var(--mf-text-lg);">
122
- Card sin header, solo contenido proyectado.
123
- </p>
124
- </mf-card>
125
- `,
126
- moduleMetadata: { imports: [MfCardComponent] },
127
- }),
128
- };
129
-
130
- export const AllVariants: Story = {
131
- name: 'Todas las variantes',
132
- render: () => ({
133
- template: `
134
- <div style="display: flex; gap: 20px; flex-wrap: wrap;">
135
- <mf-card title="Elevated" subtitle="Con sombra" variant="elevated" style="width: 280px;">
136
- <p style="margin: 0; color: var(--mf-color-neutral-600);">Contenido de ejemplo.</p>
137
- </mf-card>
138
- <mf-card title="Outlined" subtitle="Con borde" variant="outlined" style="width: 280px;">
139
- <p style="margin: 0; color: var(--mf-color-neutral-600);">Contenido de ejemplo.</p>
140
- </mf-card>
141
- <mf-card title="Flat" subtitle="Sin elevación" variant="flat" style="width: 280px;">
142
- <p style="margin: 0; color: var(--mf-color-neutral-600);">Contenido de ejemplo.</p>
143
- </mf-card>
144
- </div>
145
- `,
146
- moduleMetadata: { imports: [MfCardComponent] },
147
- }),
148
- };
1
+ import type { Meta, StoryObj } from '@storybook/angular';
2
+
3
+ import { MfCardComponent } from '../app/components/card';
4
+
5
+ const meta: Meta<MfCardComponent> = {
6
+ title: 'Molecules/MfCard',
7
+ component: MfCardComponent,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component: `
13
+ **MfCard** is the card component from the ng-comps library.
14
+ It uses Angular Material \`mat-card\` under the hood with a custom visual style that feels clean, elegant, and modern.
15
+
16
+ | Variant | When to use it |
17
+ |-------------|---------------------------------------------|
18
+ | \`elevated\` | Primary content highlighted with a shadow |
19
+ | \`outlined\` | Secondary content with a subtle border |
20
+ | \`flat\` | Background content with no border or shadow |
21
+ `,
22
+ },
23
+ },
24
+ },
25
+ argTypes: {
26
+ title: { control: 'text', description: 'Card title' },
27
+ subtitle: { control: 'text', description: 'Card subtitle' },
28
+ variant: {
29
+ control: 'select',
30
+ options: ['elevated', 'outlined', 'flat'],
31
+ description: 'Visual variant',
32
+ },
33
+ padding: {
34
+ control: 'select',
35
+ options: ['none', 'sm', 'md', 'lg'],
36
+ description: 'Internal padding',
37
+ },
38
+ interactive: { control: 'boolean', description: 'Interactive hover effect' },
39
+ },
40
+ };
41
+
42
+ export default meta;
43
+ type Story = StoryObj<MfCardComponent>;
44
+
45
+ export const Elevated: Story = {
46
+ render: (args) => ({
47
+ props: args,
48
+ template: `
49
+ <mf-card [title]="title" [subtitle]="subtitle" [variant]="variant" [padding]="padding" [interactive]="interactive">
50
+ <p style="margin: 0; color: var(--mf-color-neutral-600);">
51
+ This is the card content. It can include text, forms, lists, or other components.
52
+ </p>
53
+ </mf-card>
54
+ `,
55
+ moduleMetadata: { imports: [MfCardComponent] },
56
+ }),
57
+ args: {
58
+ title: 'Card title',
59
+ subtitle: 'Descriptive subtitle',
60
+ variant: 'elevated',
61
+ padding: 'md',
62
+ interactive: false,
63
+ },
64
+ };
65
+
66
+ export const Outlined: Story = {
67
+ render: (args) => ({
68
+ props: args,
69
+ template: `
70
+ <mf-card [title]="title" [subtitle]="subtitle" variant="outlined">
71
+ <p style="margin: 0; color: var(--mf-color-neutral-600);">
72
+ A subtle bordered card, ideal for secondary content.
73
+ </p>
74
+ </mf-card>
75
+ `,
76
+ moduleMetadata: { imports: [MfCardComponent] },
77
+ }),
78
+ args: {
79
+ title: 'Outlined card',
80
+ subtitle: 'Outlined variant',
81
+ },
82
+ };
83
+
84
+ export const Flat: Story = {
85
+ render: (args) => ({
86
+ props: args,
87
+ template: `
88
+ <mf-card [title]="title" variant="flat">
89
+ <p style="margin: 0; color: var(--mf-color-neutral-600);">
90
+ A flat card with a subtle background and no border or shadow.
91
+ </p>
92
+ </mf-card>
93
+ `,
94
+ moduleMetadata: { imports: [MfCardComponent] },
95
+ }),
96
+ args: {
97
+ title: 'Flat card',
98
+ },
99
+ };
100
+
101
+ export const Interactive: Story = {
102
+ render: () => ({
103
+ template: `
104
+ <mf-card title="Interactive card" subtitle="Hover to see the effect" variant="elevated" [interactive]="true">
105
+ <p style="margin: 0; color: var(--mf-color-neutral-600);">
106
+ This card responds to hover with subtle elevation and motion.
107
+ </p>
108
+ </mf-card>
109
+ `,
110
+ moduleMetadata: { imports: [MfCardComponent] },
111
+ }),
112
+ args: {},
113
+ };
114
+
115
+ export const NoHeader: Story = {
116
+ name: 'No header',
117
+ render: () => ({
118
+ template: `
119
+ <mf-card variant="outlined" padding="lg">
120
+ <p style="margin: 0; color: var(--mf-color-neutral-600); font-size: var(--mf-text-lg);">
121
+ Card without a header, using only projected content.
122
+ </p>
123
+ </mf-card>
124
+ `,
125
+ moduleMetadata: { imports: [MfCardComponent] },
126
+ }),
127
+ };
128
+
129
+ export const AllVariants: Story = {
130
+ name: 'All variants',
131
+ render: () => ({
132
+ template: `
133
+ <div style="display: flex; gap: 20px; flex-wrap: wrap;">
134
+ <mf-card title="Elevated" subtitle="With shadow" variant="elevated" style="width: 280px;">
135
+ <p style="margin: 0; color: var(--mf-color-neutral-600);">Sample content.</p>
136
+ </mf-card>
137
+ <mf-card title="Outlined" subtitle="With border" variant="outlined" style="width: 280px;">
138
+ <p style="margin: 0; color: var(--mf-color-neutral-600);">Sample content.</p>
139
+ </mf-card>
140
+ <mf-card title="Flat" subtitle="No elevation" variant="flat" style="width: 280px;">
141
+ <p style="margin: 0; color: var(--mf-color-neutral-600);">Sample content.</p>
142
+ </mf-card>
143
+ </div>
144
+ `,
145
+ moduleMetadata: { imports: [MfCardComponent] },
146
+ }),
147
+ };