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,124 +1,124 @@
1
- import type { Meta, StoryObj } from '@storybook/angular';
2
-
3
- import { MfProgressSpinnerComponent } from '../app/components/progress-spinner';
4
-
5
- const meta: Meta<MfProgressSpinnerComponent> = {
6
- title: 'Atoms/MfProgressSpinner',
7
- component: MfProgressSpinnerComponent,
8
- tags: ['autodocs'],
9
- parameters: {
10
- docs: {
11
- description: {
12
- component: `
13
- **MfProgressSpinner** es el spinner de progreso de la librería ng-comps.
14
- Usa Angular Material \`mat-progress-spinner\` por debajo y expone una API uniforme con look and feel de marca.
15
-
16
- | Modo | Descripción |
17
- |-------------------|--------------------------------------------|
18
- | \`indeterminate\` | Animación continua sin valor conocido |
19
- | \`determinate\` | Muestra el progreso exacto (0100) |
20
- `,
21
- },
22
- },
23
- },
24
- argTypes: {
25
- mode: {
26
- control: 'select',
27
- options: ['indeterminate', 'determinate'],
28
- description: 'Modo del spinner',
29
- },
30
- value: {
31
- control: { type: 'range', min: 0, max: 100 },
32
- description: 'Valor actual (0100, solo en determinate)',
33
- },
34
- diameter: {
35
- control: { type: 'range', min: 16, max: 120 },
36
- description: 'Diámetro en px',
37
- },
38
- strokeWidth: {
39
- control: { type: 'range', min: 1, max: 12 },
40
- description: 'Grosor del trazo',
41
- },
42
- color: {
43
- control: 'select',
44
- options: ['brand', 'accent', 'warn'],
45
- description: 'Color del spinner',
46
- },
47
- label: { control: 'text', description: 'Etiqueta visible junto al spinner' },
48
- },
49
- };
50
-
51
- export default meta;
52
- type Story = StoryObj<MfProgressSpinnerComponent>;
53
-
54
- export const Indeterminate: Story = {
55
- args: {
56
- mode: 'indeterminate',
57
- diameter: 40,
58
- },
59
- };
60
-
61
- export const Determinate: Story = {
62
- args: {
63
- mode: 'determinate',
64
- value: 70,
65
- diameter: 60,
66
- },
67
- };
68
-
69
- export const WithLabel: Story = {
70
- name: 'Con etiqueta',
71
- args: {
72
- mode: 'indeterminate',
73
- label: 'Cargando datos...',
74
- diameter: 32,
75
- },
76
- };
77
-
78
- export const ColorAccent: Story = {
79
- name: 'Color accent',
80
- args: {
81
- mode: 'indeterminate',
82
- color: 'accent',
83
- diameter: 40,
84
- },
85
- };
86
-
87
- export const ColorWarn: Story = {
88
- name: 'Color warn',
89
- args: {
90
- mode: 'indeterminate',
91
- color: 'warn',
92
- diameter: 40,
93
- },
94
- };
95
-
96
- export const Sizes: Story = {
97
- name: 'Tamaños',
98
- render: () => ({
99
- template: `
100
- <div style="display: flex; gap: 24px; align-items: center;">
101
- <mf-progress-spinner mode="indeterminate" [diameter]="24" />
102
- <mf-progress-spinner mode="indeterminate" [diameter]="40" />
103
- <mf-progress-spinner mode="indeterminate" [diameter]="64" />
104
- <mf-progress-spinner mode="indeterminate" [diameter]="80" />
105
- </div>
106
- `,
107
- moduleMetadata: { imports: [MfProgressSpinnerComponent] },
108
- }),
109
- };
110
-
111
- export const AllVariants: Story = {
112
- name: 'Todas las variantes',
113
- render: () => ({
114
- template: `
115
- <div style="display: flex; gap: 32px; align-items: center; flex-wrap: wrap;">
116
- <mf-progress-spinner mode="indeterminate" label="Cargando..." />
117
- <mf-progress-spinner mode="determinate" [value]="60" label="60%" />
118
- <mf-progress-spinner mode="indeterminate" color="accent" label="Accent" />
119
- <mf-progress-spinner mode="indeterminate" color="warn" label="Warn" />
120
- </div>
121
- `,
122
- moduleMetadata: { imports: [MfProgressSpinnerComponent] },
123
- }),
124
- };
1
+ import type { Meta, StoryObj } from '@storybook/angular';
2
+
3
+ import { MfProgressSpinnerComponent } from '../app/components/progress-spinner';
4
+
5
+ const meta: Meta<MfProgressSpinnerComponent> = {
6
+ title: 'Atoms/MfProgressSpinner',
7
+ component: MfProgressSpinnerComponent,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component: `
13
+ **MfProgressSpinner** is the progress spinner component from the ng-comps library.
14
+ It uses Angular Material \`mat-progress-spinner\` under the hood while exposing a consistent branded API.
15
+
16
+ | Mode | Description |
17
+ |-------------------|--------------------------------------|
18
+ | \`indeterminate\` | Continuous animation, no known value |
19
+ | \`determinate\` | Shows exact progress (0-100) |
20
+ `,
21
+ },
22
+ },
23
+ },
24
+ argTypes: {
25
+ mode: {
26
+ control: 'select',
27
+ options: ['indeterminate', 'determinate'],
28
+ description: 'Spinner mode',
29
+ },
30
+ value: {
31
+ control: { type: 'range', min: 0, max: 100 },
32
+ description: 'Current value (0-100, determinate only)',
33
+ },
34
+ diameter: {
35
+ control: { type: 'range', min: 16, max: 120 },
36
+ description: 'Diameter in px',
37
+ },
38
+ strokeWidth: {
39
+ control: { type: 'range', min: 1, max: 12 },
40
+ description: 'Stroke width',
41
+ },
42
+ color: {
43
+ control: 'select',
44
+ options: ['brand', 'accent', 'warn'],
45
+ description: 'Spinner color',
46
+ },
47
+ label: { control: 'text', description: 'Visible label next to the spinner' },
48
+ },
49
+ };
50
+
51
+ export default meta;
52
+ type Story = StoryObj<MfProgressSpinnerComponent>;
53
+
54
+ export const Indeterminate: Story = {
55
+ args: {
56
+ mode: 'indeterminate',
57
+ diameter: 40,
58
+ },
59
+ };
60
+
61
+ export const Determinate: Story = {
62
+ args: {
63
+ mode: 'determinate',
64
+ value: 70,
65
+ diameter: 60,
66
+ },
67
+ };
68
+
69
+ export const WithLabel: Story = {
70
+ name: 'With label',
71
+ args: {
72
+ mode: 'indeterminate',
73
+ label: 'Loading data...',
74
+ diameter: 32,
75
+ },
76
+ };
77
+
78
+ export const ColorAccent: Story = {
79
+ name: 'Color accent',
80
+ args: {
81
+ mode: 'indeterminate',
82
+ color: 'accent',
83
+ diameter: 40,
84
+ },
85
+ };
86
+
87
+ export const ColorWarn: Story = {
88
+ name: 'Color warn',
89
+ args: {
90
+ mode: 'indeterminate',
91
+ color: 'warn',
92
+ diameter: 40,
93
+ },
94
+ };
95
+
96
+ export const Sizes: Story = {
97
+ name: 'Sizes',
98
+ render: () => ({
99
+ template: `
100
+ <div style="display: flex; gap: 24px; align-items: center;">
101
+ <mf-progress-spinner mode="indeterminate" [diameter]="24" />
102
+ <mf-progress-spinner mode="indeterminate" [diameter]="40" />
103
+ <mf-progress-spinner mode="indeterminate" [diameter]="64" />
104
+ <mf-progress-spinner mode="indeterminate" [diameter]="80" />
105
+ </div>
106
+ `,
107
+ moduleMetadata: { imports: [MfProgressSpinnerComponent] },
108
+ }),
109
+ };
110
+
111
+ export const AllVariants: Story = {
112
+ name: 'All variants',
113
+ render: () => ({
114
+ template: `
115
+ <div style="display: flex; gap: 32px; align-items: center; flex-wrap: wrap;">
116
+ <mf-progress-spinner mode="indeterminate" label="Loading..." />
117
+ <mf-progress-spinner mode="determinate" [value]="60" label="60%" />
118
+ <mf-progress-spinner mode="indeterminate" color="accent" label="Accent" />
119
+ <mf-progress-spinner mode="indeterminate" color="warn" label="Warn" />
120
+ </div>
121
+ `,
122
+ moduleMetadata: { imports: [MfProgressSpinnerComponent] },
123
+ }),
124
+ };
@@ -1,111 +1,111 @@
1
- import type { Meta, StoryObj } from '@storybook/angular';
2
-
3
- import { MfRadioButtonComponent } from '../app/components/radio-button';
4
-
5
- const SAMPLE_OPTIONS = [
6
- { value: 'angular', label: 'Angular' },
7
- { value: 'react', label: 'React' },
8
- { value: 'vue', label: 'Vue' },
9
- { value: 'svelte', label: 'Svelte', disabled: true },
10
- ];
11
-
12
- const meta: Meta<MfRadioButtonComponent> = {
13
- title: 'Atoms/MfRadioButton',
14
- component: MfRadioButtonComponent,
15
- tags: ['autodocs'],
16
- parameters: {
17
- docs: {
18
- description: {
19
- component: `
20
- **MfRadioButton** es el grupo de radio buttons de la librería ng-comps.
21
- Envuelve Angular Material \`mat-radio-group\` + \`mat-radio-button\` y expone una API uniforme con look and feel de marca.
22
-
23
- Recibe un array de \`MfRadioOption\` y gestiona la selección internamente.
24
- `,
25
- },
26
- },
27
- },
28
- argTypes: {
29
- direction: {
30
- control: 'select',
31
- options: ['vertical', 'horizontal'],
32
- description: 'Dirección del grupo',
33
- },
34
- disabled: { control: 'boolean' },
35
- ariaLabel: { control: 'text', description: 'Etiqueta accesible del grupo' },
36
- mfChange: { action: 'mfChange' },
37
- },
38
- };
39
-
40
- export default meta;
41
- type Story = StoryObj<MfRadioButtonComponent>;
42
-
43
- export const Vertical: Story = {
44
- args: {
45
- options: SAMPLE_OPTIONS,
46
- direction: 'vertical',
47
- ariaLabel: 'Framework preferido',
48
- },
49
- };
50
-
51
- export const Horizontal: Story = {
52
- args: {
53
- options: SAMPLE_OPTIONS,
54
- direction: 'horizontal',
55
- ariaLabel: 'Framework preferido',
56
- },
57
- };
58
-
59
- export const WithDefault: Story = {
60
- name: 'Con valor por defecto',
61
- args: {
62
- options: SAMPLE_OPTIONS,
63
- value: 'angular',
64
- ariaLabel: 'Framework preferido',
65
- },
66
- };
67
-
68
- export const Disabled: Story = {
69
- args: {
70
- options: SAMPLE_OPTIONS,
71
- disabled: true,
72
- ariaLabel: 'Framework preferido (deshabilitado)',
73
- },
74
- };
75
-
76
- export const AllVariants: Story = {
77
- name: 'Todas las variantes',
78
- render: () => ({
79
- template: `
80
- <div style="display: flex; flex-direction: column; gap: 32px;">
81
- <div>
82
- <p style="font-size: 0.875rem; color: #475569; margin-bottom: 8px;">Vertical</p>
83
- <mf-radio-button
84
- [options]="options"
85
- ariaLabel="Opciones vertical"
86
- />
87
- </div>
88
- <div>
89
- <p style="font-size: 0.875rem; color: #475569; margin-bottom: 8px;">Horizontal</p>
90
- <mf-radio-button
91
- [options]="options"
92
- direction="horizontal"
93
- ariaLabel="Opciones horizontal"
94
- />
95
- </div>
96
- <div>
97
- <p style="font-size: 0.875rem; color: #475569; margin-bottom: 8px;">Deshabilitado</p>
98
- <mf-radio-button
99
- [options]="options"
100
- [disabled]="true"
101
- ariaLabel="Opciones deshabilitadas"
102
- />
103
- </div>
104
- </div>
105
- `,
106
- props: {
107
- options: SAMPLE_OPTIONS,
108
- },
109
- moduleMetadata: { imports: [MfRadioButtonComponent] },
110
- }),
111
- };
1
+ import type { Meta, StoryObj } from '@storybook/angular';
2
+
3
+ import { MfRadioButtonComponent } from '../app/components/radio-button';
4
+
5
+ const SAMPLE_OPTIONS = [
6
+ { value: 'angular', label: 'Angular' },
7
+ { value: 'react', label: 'React' },
8
+ { value: 'vue', label: 'Vue' },
9
+ { value: 'svelte', label: 'Svelte', disabled: true },
10
+ ];
11
+
12
+ const meta: Meta<MfRadioButtonComponent> = {
13
+ title: 'Atoms/MfRadioButton',
14
+ component: MfRadioButtonComponent,
15
+ tags: ['autodocs'],
16
+ parameters: {
17
+ docs: {
18
+ description: {
19
+ component: `
20
+ **MfRadioButton** is the radio button group from the ng-comps library.
21
+ It wraps Angular Material \`mat-radio-group\` and \`mat-radio-button\` while exposing a consistent branded API.
22
+
23
+ It receives an array of \`MfRadioOption\` objects and manages the selection internally.
24
+ `,
25
+ },
26
+ },
27
+ },
28
+ argTypes: {
29
+ direction: {
30
+ control: 'select',
31
+ options: ['vertical', 'horizontal'],
32
+ description: 'Group direction',
33
+ },
34
+ disabled: { control: 'boolean' },
35
+ ariaLabel: { control: 'text', description: 'Accessible group label' },
36
+ mfChange: { action: 'mfChange' },
37
+ },
38
+ };
39
+
40
+ export default meta;
41
+ type Story = StoryObj<MfRadioButtonComponent>;
42
+
43
+ export const Vertical: Story = {
44
+ args: {
45
+ options: SAMPLE_OPTIONS,
46
+ direction: 'vertical',
47
+ ariaLabel: 'Preferred framework',
48
+ },
49
+ };
50
+
51
+ export const Horizontal: Story = {
52
+ args: {
53
+ options: SAMPLE_OPTIONS,
54
+ direction: 'horizontal',
55
+ ariaLabel: 'Preferred framework',
56
+ },
57
+ };
58
+
59
+ export const WithDefault: Story = {
60
+ name: 'With default value',
61
+ args: {
62
+ options: SAMPLE_OPTIONS,
63
+ value: 'angular',
64
+ ariaLabel: 'Preferred framework',
65
+ },
66
+ };
67
+
68
+ export const Disabled: Story = {
69
+ args: {
70
+ options: SAMPLE_OPTIONS,
71
+ disabled: true,
72
+ ariaLabel: 'Preferred framework (disabled)',
73
+ },
74
+ };
75
+
76
+ export const AllVariants: Story = {
77
+ name: 'All variants',
78
+ render: () => ({
79
+ template: `
80
+ <div style="display: flex; flex-direction: column; gap: 32px;">
81
+ <div>
82
+ <p style="font-size: 0.875rem; color: #475569; margin-bottom: 8px;">Vertical</p>
83
+ <mf-radio-button
84
+ [options]="options"
85
+ ariaLabel="Vertical options"
86
+ />
87
+ </div>
88
+ <div>
89
+ <p style="font-size: 0.875rem; color: #475569; margin-bottom: 8px;">Horizontal</p>
90
+ <mf-radio-button
91
+ [options]="options"
92
+ direction="horizontal"
93
+ ariaLabel="Horizontal options"
94
+ />
95
+ </div>
96
+ <div>
97
+ <p style="font-size: 0.875rem; color: #475569; margin-bottom: 8px;">Disabled</p>
98
+ <mf-radio-button
99
+ [options]="options"
100
+ [disabled]="true"
101
+ ariaLabel="Disabled options"
102
+ />
103
+ </div>
104
+ </div>
105
+ `,
106
+ props: {
107
+ options: SAMPLE_OPTIONS,
108
+ },
109
+ moduleMetadata: { imports: [MfRadioButtonComponent] },
110
+ }),
111
+ };