ng-comps 1.0.0 → 1.0.2

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 (38) hide show
  1. package/angular.json +9 -8
  2. package/documentation.json +32 -32
  3. package/package.json +1 -1
  4. package/scripts/prepare-package.mjs +38 -19
  5. package/src/app/components/alert/mf-alert.component.spec.ts +2 -2
  6. package/src/app/components/alert/mf-alert.component.ts +1 -1
  7. package/src/app/components/chip/mf-chip.component.ts +1 -1
  8. package/src/app/components/datepicker/mf-datepicker.component.spec.ts +4 -4
  9. package/src/app/components/datepicker/mf-datepicker.component.ts +1 -1
  10. package/src/app/components/dialog/mf-dialog.component.ts +1 -1
  11. package/src/app/components/dialog/mf-dialog.service.spec.ts +2 -2
  12. package/src/app/components/menu/mf-menu.component.spec.ts +1 -1
  13. package/src/app/components/menu/mf-menu.component.ts +1 -1
  14. package/src/app/components/progress-bar/mf-progress-bar.component.spec.ts +2 -2
  15. package/src/app/components/progress-spinner/mf-progress-spinner.component.spec.ts +3 -3
  16. package/src/app/components/sidenav/mf-sidenav.component.ts +2 -2
  17. package/src/app/components/table/mf-table.component.ts +1 -1
  18. package/src/stories/About.mdx +72 -72
  19. package/src/stories/Welcome.mdx +26 -27
  20. package/src/stories/mf-a11y-contracts.stories.ts +49 -49
  21. package/src/stories/mf-autocomplete.stories.ts +194 -188
  22. package/src/stories/mf-button.stories.ts +152 -156
  23. package/src/stories/mf-card.stories.ts +147 -148
  24. package/src/stories/mf-checkbox.stories.ts +88 -88
  25. package/src/stories/mf-datepicker.stories.ts +118 -118
  26. package/src/stories/mf-dialog.stories.ts +159 -167
  27. package/src/stories/mf-form-field.stories.ts +108 -108
  28. package/src/stories/mf-grid-list.stories.ts +104 -105
  29. package/src/stories/mf-icon.stories.ts +133 -130
  30. package/src/stories/mf-input.stories.ts +158 -158
  31. package/src/stories/mf-menu.stories.ts +10 -10
  32. package/src/stories/mf-progress-bar.stories.ts +119 -119
  33. package/src/stories/mf-progress-spinner.stories.ts +124 -124
  34. package/src/stories/mf-radio-button.stories.ts +111 -111
  35. package/src/stories/mf-select.stories.ts +184 -178
  36. package/src/stories/mf-sidenav.stories.ts +331 -334
  37. package/src/stories/mf-table.stories.ts +13 -13
  38. package/src/stories/mf-toolbar.stories.ts +112 -112
@@ -1,158 +1,158 @@
1
- import type { Meta, StoryObj } from '@storybook/angular';
2
-
3
- import { MfInputComponent } from '../app/components/input';
4
-
5
- const meta: Meta<MfInputComponent> = {
6
- title: 'Atoms/MfInput',
7
- component: MfInputComponent,
8
- tags: ['autodocs'],
9
- parameters: {
10
- docs: {
11
- description: {
12
- component: `
13
- **MfInput** es el campo de texto de la librería ng-comps.
14
- Usa Angular Material \`mat-form-field\` por debajo pero expone una API uniforme con look and feel de marca.
15
-
16
- | Propiedad | Descripción |
17
- |---------------|------------------------------------------|
18
- | \`label\` | Etiqueta flotante del campo |
19
- | \`placeholder\` | Texto de placeholder |
20
- | \`hint\` | Texto de ayuda debajo del campo |
21
- | \`error\` | Mensaje de error |
22
- | \`leadingIcon\` | Icono al inicio del campo |
23
- | \`trailingIcon\`| Icono al final del campo |
24
- `,
25
- },
26
- },
27
- },
28
- argTypes: {
29
- label: { control: 'text', description: 'Etiqueta flotante' },
30
- placeholder: { control: 'text', description: 'Placeholder' },
31
- type: {
32
- control: 'select',
33
- options: ['text', 'email', 'password', 'number', 'search', 'tel', 'url'],
34
- },
35
- size: {
36
- control: 'select',
37
- options: ['sm', 'md', 'lg'],
38
- description: 'Tamaño del campo',
39
- },
40
- value: { control: 'text' },
41
- disabled: { control: 'boolean' },
42
- readonly: { control: 'boolean' },
43
- hint: { control: 'text', description: 'Texto de ayuda' },
44
- error: { control: 'text', description: 'Mensaje de error' },
45
- leadingIcon: { control: 'text' },
46
- trailingIcon: { control: 'text' },
47
- fullWidth: { control: 'boolean' },
48
- mfInput: { action: 'mfInput' },
49
- mfBlur: { action: 'mfBlur' },
50
- },
51
- };
52
-
53
- export default meta;
54
- type Story = StoryObj<MfInputComponent>;
55
-
56
- export const Default: Story = {
57
- args: {
58
- label: 'Correo electrónico',
59
- placeholder: 'nombre@ejemplo.com',
60
- },
61
- };
62
-
63
- export const WithHint: Story = {
64
- name: 'Con texto de ayuda',
65
- args: {
66
- label: 'Contraseña',
67
- type: 'password',
68
- hint: 'Mínimo 8 caracteres',
69
- },
70
- };
71
-
72
- export const WithError: Story = {
73
- name: 'Con error',
74
- args: {
75
- label: 'Email',
76
- value: 'correo-invalido',
77
- error: 'Introduce un email válido',
78
- },
79
- };
80
-
81
- export const WithLeadingIcon: Story = {
82
- name: 'Con icono al inicio',
83
- args: {
84
- label: 'Buscar',
85
- placeholder: 'Buscar...',
86
- leadingIcon: 'search',
87
- },
88
- };
89
-
90
- export const WithTrailingIcon: Story = {
91
- name: 'Con icono al final',
92
- args: {
93
- label: 'Correo',
94
- placeholder: 'nombre@ejemplo.com',
95
- trailingIcon: 'mail',
96
- },
97
- };
98
-
99
- export const Disabled: Story = {
100
- args: {
101
- label: 'Campo deshabilitado',
102
- value: 'No editable',
103
- disabled: true,
104
- },
105
- };
106
-
107
- export const Readonly: Story = {
108
- name: 'Solo lectura',
109
- args: {
110
- label: 'Solo lectura',
111
- value: 'Valor fijo',
112
- readonly: true,
113
- },
114
- };
115
-
116
- export const Small: Story = {
117
- args: {
118
- label: 'Pequeño',
119
- placeholder: 'Texto...',
120
- size: 'sm',
121
- },
122
- };
123
-
124
- export const Large: Story = {
125
- args: {
126
- label: 'Grande',
127
- placeholder: 'Texto...',
128
- size: 'lg',
129
- },
130
- };
131
-
132
- export const FullWidth: Story = {
133
- name: 'Ancho completo',
134
- args: {
135
- label: 'Nombre completo',
136
- placeholder: 'Juan Pérez',
137
- fullWidth: true,
138
- },
139
- parameters: {
140
- layout: 'padded',
141
- },
142
- };
143
-
144
- export const AllVariants: Story = {
145
- name: 'Todas las variantes',
146
- render: () => ({
147
- template: `
148
- <div style="display: flex; flex-direction: column; gap: 16px; max-width: 360px;">
149
- <mf-input label="Normal" placeholder="Escribe aquí..." />
150
- <mf-input label="Con ayuda" hint="Este es un texto de ayuda" />
151
- <mf-input label="Con error" value="mal" error="Este campo es obligatorio" />
152
- <mf-input label="Búsqueda" leadingIcon="search" placeholder="Buscar..." />
153
- <mf-input label="Deshabilitado" value="No editable" [disabled]="true" />
154
- </div>
155
- `,
156
- moduleMetadata: { imports: [MfInputComponent] },
157
- }),
158
- };
1
+ import type { Meta, StoryObj } from '@storybook/angular';
2
+
3
+ import { MfInputComponent } from '../app/components/input';
4
+
5
+ const meta: Meta<MfInputComponent> = {
6
+ title: 'Atoms/MfInput',
7
+ component: MfInputComponent,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component: `
13
+ **MfInput** is the text field component from the ng-comps library.
14
+ It uses Angular Material \`mat-form-field\` under the hood while exposing a consistent branded API.
15
+
16
+ | Property | Description |
17
+ |----------------|-------------------------------|
18
+ | \`label\` | Floating field label |
19
+ | \`placeholder\` | Placeholder text |
20
+ | \`hint\` | Helper text below the field |
21
+ | \`error\` | Error message |
22
+ | \`leadingIcon\` | Icon shown at the start |
23
+ | \`trailingIcon\` | Icon shown at the end |
24
+ `,
25
+ },
26
+ },
27
+ },
28
+ argTypes: {
29
+ label: { control: 'text', description: 'Floating label' },
30
+ placeholder: { control: 'text', description: 'Placeholder' },
31
+ type: {
32
+ control: 'select',
33
+ options: ['text', 'email', 'password', 'number', 'search', 'tel', 'url'],
34
+ },
35
+ size: {
36
+ control: 'select',
37
+ options: ['sm', 'md', 'lg'],
38
+ description: 'Field size',
39
+ },
40
+ value: { control: 'text' },
41
+ disabled: { control: 'boolean' },
42
+ readonly: { control: 'boolean' },
43
+ hint: { control: 'text', description: 'Helper text' },
44
+ error: { control: 'text', description: 'Error message' },
45
+ leadingIcon: { control: 'text' },
46
+ trailingIcon: { control: 'text' },
47
+ fullWidth: { control: 'boolean' },
48
+ mfInput: { action: 'mfInput' },
49
+ mfBlur: { action: 'mfBlur' },
50
+ },
51
+ };
52
+
53
+ export default meta;
54
+ type Story = StoryObj<MfInputComponent>;
55
+
56
+ export const Default: Story = {
57
+ args: {
58
+ label: 'Email address',
59
+ placeholder: 'name@example.com',
60
+ },
61
+ };
62
+
63
+ export const WithHint: Story = {
64
+ name: 'With helper text',
65
+ args: {
66
+ label: 'Password',
67
+ type: 'password',
68
+ hint: 'Minimum 8 characters',
69
+ },
70
+ };
71
+
72
+ export const WithError: Story = {
73
+ name: 'With error',
74
+ args: {
75
+ label: 'Email',
76
+ value: 'invalid-email',
77
+ error: 'Enter a valid email address',
78
+ },
79
+ };
80
+
81
+ export const WithLeadingIcon: Story = {
82
+ name: 'With leading icon',
83
+ args: {
84
+ label: 'Search',
85
+ placeholder: 'Search...',
86
+ leadingIcon: 'search',
87
+ },
88
+ };
89
+
90
+ export const WithTrailingIcon: Story = {
91
+ name: 'With trailing icon',
92
+ args: {
93
+ label: 'Email',
94
+ placeholder: 'name@example.com',
95
+ trailingIcon: 'mail',
96
+ },
97
+ };
98
+
99
+ export const Disabled: Story = {
100
+ args: {
101
+ label: 'Disabled field',
102
+ value: 'Not editable',
103
+ disabled: true,
104
+ },
105
+ };
106
+
107
+ export const Readonly: Story = {
108
+ name: 'Read only',
109
+ args: {
110
+ label: 'Read only',
111
+ value: 'Fixed value',
112
+ readonly: true,
113
+ },
114
+ };
115
+
116
+ export const Small: Story = {
117
+ args: {
118
+ label: 'Small',
119
+ placeholder: 'Text...',
120
+ size: 'sm',
121
+ },
122
+ };
123
+
124
+ export const Large: Story = {
125
+ args: {
126
+ label: 'Large',
127
+ placeholder: 'Text...',
128
+ size: 'lg',
129
+ },
130
+ };
131
+
132
+ export const FullWidth: Story = {
133
+ name: 'Full width',
134
+ args: {
135
+ label: 'Full name',
136
+ placeholder: 'Jane Doe',
137
+ fullWidth: true,
138
+ },
139
+ parameters: {
140
+ layout: 'padded',
141
+ },
142
+ };
143
+
144
+ export const AllVariants: Story = {
145
+ name: 'All variants',
146
+ render: () => ({
147
+ template: `
148
+ <div style="display: flex; flex-direction: column; gap: 16px; max-width: 360px;">
149
+ <mf-input label="Default" placeholder="Type here..." />
150
+ <mf-input label="With help" hint="This is helper text" />
151
+ <mf-input label="With error" value="bad" error="This field is required" />
152
+ <mf-input label="Search" leadingIcon="search" placeholder="Search..." />
153
+ <mf-input label="Disabled" value="Not editable" [disabled]="true" />
154
+ </div>
155
+ `,
156
+ moduleMetadata: { imports: [MfInputComponent] },
157
+ }),
158
+ };
@@ -3,10 +3,10 @@ import type { Meta, StoryObj } from '@storybook/angular';
3
3
  import { MfMenuComponent } from '../app/components/menu';
4
4
 
5
5
  const MENU_ITEMS = [
6
- { value: 'edit', label: 'Editar', icon: 'edit' },
7
- { value: 'duplicate', label: 'Duplicar', icon: 'content_copy' },
8
- { value: 'archive', label: 'Archivar', icon: 'archive' },
9
- { value: 'delete', label: 'Eliminar', icon: 'delete' },
6
+ { value: 'edit', label: 'Edit', icon: 'edit' },
7
+ { value: 'duplicate', label: 'Duplicate', icon: 'content_copy' },
8
+ { value: 'archive', label: 'Archive', icon: 'archive' },
9
+ { value: 'delete', label: 'Delete', icon: 'delete' },
10
10
  ];
11
11
 
12
12
  const meta: Meta<MfMenuComponent> = {
@@ -41,7 +41,7 @@ type Story = StoryObj<MfMenuComponent>;
41
41
  export const Default: Story = {
42
42
  args: {
43
43
  items: MENU_ITEMS,
44
- triggerLabel: 'Abrir acciones del registro',
44
+ triggerLabel: 'Open record actions',
45
45
  },
46
46
  };
47
47
 
@@ -49,7 +49,7 @@ export const CorrectUsage: Story = {
49
49
  name: 'Correct Usage',
50
50
  args: {
51
51
  items: MENU_ITEMS,
52
- triggerLabel: 'Abrir acciones del proyecto',
52
+ triggerLabel: 'Open project actions',
53
53
  },
54
54
  };
55
55
 
@@ -58,11 +58,11 @@ export const IncorrectUsage: Story = {
58
58
  render: () => ({
59
59
  template: `
60
60
  <section style="max-width: 720px; border: 1px solid var(--mf-color-border); border-radius: 16px; padding: 20px; background: var(--mf-color-surface);">
61
- <h2 style="margin: 0 0 12px; font-size: 1rem;">Anti-patrones</h2>
61
+ <h2 style="margin: 0 0 12px; font-size: 1rem;">Anti-patterns</h2>
62
62
  <ul style="margin: 0 0 16px; padding-left: 18px;">
63
- <li>Trigger icon-only sin nombre accesible.</li>
64
- <li>Usar elementos del menu como navegacion visual sin accion real.</li>
65
- <li>Bloquear Escape o el retorno de foco al trigger.</li>
63
+ <li>Icon-only trigger with no accessible name.</li>
64
+ <li>Using menu items as visual navigation with no real action.</li>
65
+ <li>Blocking Escape or preventing focus from returning to the trigger.</li>
66
66
  </ul>
67
67
  <pre style="margin: 0; padding: 16px; border-radius: 12px; background: #111827; color: #f9fafb; overflow: auto;"><code>&lt;mf-menu [items]="items" triggerLabel="" /&gt;</code></pre>
68
68
  </section>
@@ -1,119 +1,119 @@
1
- import type { Meta, StoryObj } from '@storybook/angular';
2
-
3
- import { MfProgressBarComponent } from '../app/components/progress-bar';
4
-
5
- const meta: Meta<MfProgressBarComponent> = {
6
- title: 'Atoms/MfProgressBar',
7
- component: MfProgressBarComponent,
8
- tags: ['autodocs'],
9
- parameters: {
10
- docs: {
11
- description: {
12
- component: `
13
- **MfProgressBar** es la barra de progreso de la librería ng-comps.
14
- Usa Angular Material \`mat-progress-bar\` por debajo pero expone una API uniforme con look and feel de marca.
15
-
16
- | Modo | Descripción |
17
- |------------------|----------------------------------------------------|
18
- | \`determinate\` | Muestra el progreso exacto (0100) |
19
- | \`indeterminate\` | Animación continua sin valor conocido |
20
- | \`buffer\` | Muestra progreso + buffer |
21
- | \`query\` | Animación inversa para operaciones de consulta |
22
- `,
23
- },
24
- },
25
- },
26
- argTypes: {
27
- mode: {
28
- control: 'select',
29
- options: ['determinate', 'indeterminate', 'buffer', 'query'],
30
- description: 'Modo de la barra',
31
- },
32
- value: {
33
- control: { type: 'range', min: 0, max: 100 },
34
- description: 'Valor actual (0100)',
35
- },
36
- bufferValue: {
37
- control: { type: 'range', min: 0, max: 100 },
38
- description: 'Valor del buffer (solo en modo buffer)',
39
- },
40
- color: {
41
- control: 'select',
42
- options: ['brand', 'accent', 'warn'],
43
- description: 'Color de la barra',
44
- },
45
- label: { control: 'text', description: 'Etiqueta accesible' },
46
- showValue: { control: 'boolean', description: 'Muestra el porcentaje' },
47
- },
48
- };
49
-
50
- export default meta;
51
- type Story = StoryObj<MfProgressBarComponent>;
52
-
53
- export const Determinate: Story = {
54
- args: {
55
- mode: 'determinate',
56
- value: 65,
57
- label: 'Progreso de carga',
58
- showValue: true,
59
- },
60
- };
61
-
62
- export const Indeterminate: Story = {
63
- args: {
64
- mode: 'indeterminate',
65
- label: 'Cargando...',
66
- },
67
- };
68
-
69
- export const Buffer: Story = {
70
- args: {
71
- mode: 'buffer',
72
- value: 40,
73
- bufferValue: 70,
74
- label: 'Descargando...',
75
- },
76
- };
77
-
78
- export const Query: Story = {
79
- args: {
80
- mode: 'query',
81
- label: 'Consultando...',
82
- },
83
- };
84
-
85
- export const ColorAccent: Story = {
86
- name: 'Color accent',
87
- args: {
88
- mode: 'determinate',
89
- value: 50,
90
- color: 'accent',
91
- showValue: true,
92
- },
93
- };
94
-
95
- export const ColorWarn: Story = {
96
- name: 'Color warn',
97
- args: {
98
- mode: 'determinate',
99
- value: 80,
100
- color: 'warn',
101
- showValue: true,
102
- },
103
- };
104
-
105
- export const AllVariants: Story = {
106
- name: 'Todas las variantes',
107
- render: () => ({
108
- template: `
109
- <div style="display: flex; flex-direction: column; gap: 24px; max-width: 400px;">
110
- <mf-progress-bar mode="determinate" [value]="75" label="Completado" [showValue]="true" />
111
- <mf-progress-bar mode="indeterminate" label="Cargando..." />
112
- <mf-progress-bar mode="determinate" [value]="50" color="accent" [showValue]="true" />
113
- <mf-progress-bar mode="determinate" [value]="90" color="warn" [showValue]="true" />
114
- <mf-progress-bar mode="buffer" [value]="40" [bufferValue]="70" label="Descargando..." />
115
- </div>
116
- `,
117
- moduleMetadata: { imports: [MfProgressBarComponent] },
118
- }),
119
- };
1
+ import type { Meta, StoryObj } from '@storybook/angular';
2
+
3
+ import { MfProgressBarComponent } from '../app/components/progress-bar';
4
+
5
+ const meta: Meta<MfProgressBarComponent> = {
6
+ title: 'Atoms/MfProgressBar',
7
+ component: MfProgressBarComponent,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component: `
13
+ **MfProgressBar** is the progress bar component from the ng-comps library.
14
+ It uses Angular Material \`mat-progress-bar\` under the hood while exposing a consistent branded API.
15
+
16
+ | Mode | Description |
17
+ |------------------|---------------------------------------|
18
+ | \`determinate\` | Shows exact progress (0-100) |
19
+ | \`indeterminate\` | Continuous animation, no known value |
20
+ | \`buffer\` | Shows progress plus buffer |
21
+ | \`query\` | Reverse animation for query states |
22
+ `,
23
+ },
24
+ },
25
+ },
26
+ argTypes: {
27
+ mode: {
28
+ control: 'select',
29
+ options: ['determinate', 'indeterminate', 'buffer', 'query'],
30
+ description: 'Bar mode',
31
+ },
32
+ value: {
33
+ control: { type: 'range', min: 0, max: 100 },
34
+ description: 'Current value (0-100)',
35
+ },
36
+ bufferValue: {
37
+ control: { type: 'range', min: 0, max: 100 },
38
+ description: 'Buffer value (buffer mode only)',
39
+ },
40
+ color: {
41
+ control: 'select',
42
+ options: ['brand', 'accent', 'warn'],
43
+ description: 'Bar color',
44
+ },
45
+ label: { control: 'text', description: 'Accessible label' },
46
+ showValue: { control: 'boolean', description: 'Show percentage' },
47
+ },
48
+ };
49
+
50
+ export default meta;
51
+ type Story = StoryObj<MfProgressBarComponent>;
52
+
53
+ export const Determinate: Story = {
54
+ args: {
55
+ mode: 'determinate',
56
+ value: 65,
57
+ label: 'Loading progress',
58
+ showValue: true,
59
+ },
60
+ };
61
+
62
+ export const Indeterminate: Story = {
63
+ args: {
64
+ mode: 'indeterminate',
65
+ label: 'Loading...',
66
+ },
67
+ };
68
+
69
+ export const Buffer: Story = {
70
+ args: {
71
+ mode: 'buffer',
72
+ value: 40,
73
+ bufferValue: 70,
74
+ label: 'Downloading...',
75
+ },
76
+ };
77
+
78
+ export const Query: Story = {
79
+ args: {
80
+ mode: 'query',
81
+ label: 'Querying...',
82
+ },
83
+ };
84
+
85
+ export const ColorAccent: Story = {
86
+ name: 'Color accent',
87
+ args: {
88
+ mode: 'determinate',
89
+ value: 50,
90
+ color: 'accent',
91
+ showValue: true,
92
+ },
93
+ };
94
+
95
+ export const ColorWarn: Story = {
96
+ name: 'Color warn',
97
+ args: {
98
+ mode: 'determinate',
99
+ value: 80,
100
+ color: 'warn',
101
+ showValue: true,
102
+ },
103
+ };
104
+
105
+ export const AllVariants: Story = {
106
+ name: 'All variants',
107
+ render: () => ({
108
+ template: `
109
+ <div style="display: flex; flex-direction: column; gap: 24px; max-width: 400px;">
110
+ <mf-progress-bar mode="determinate" [value]="75" label="Completed" [showValue]="true" />
111
+ <mf-progress-bar mode="indeterminate" label="Loading..." />
112
+ <mf-progress-bar mode="determinate" [value]="50" color="accent" [showValue]="true" />
113
+ <mf-progress-bar mode="determinate" [value]="90" color="warn" [showValue]="true" />
114
+ <mf-progress-bar mode="buffer" [value]="40" [bufferValue]="70" label="Downloading..." />
115
+ </div>
116
+ `,
117
+ moduleMetadata: { imports: [MfProgressBarComponent] },
118
+ }),
119
+ };