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.
- package/angular.json +9 -8
- package/documentation.json +32 -32
- package/package.json +1 -1
- package/scripts/prepare-package.mjs +38 -19
- package/src/app/components/alert/mf-alert.component.spec.ts +2 -2
- package/src/app/components/alert/mf-alert.component.ts +1 -1
- package/src/app/components/chip/mf-chip.component.ts +1 -1
- package/src/app/components/datepicker/mf-datepicker.component.spec.ts +4 -4
- package/src/app/components/datepicker/mf-datepicker.component.ts +1 -1
- package/src/app/components/dialog/mf-dialog.component.ts +1 -1
- package/src/app/components/dialog/mf-dialog.service.spec.ts +2 -2
- package/src/app/components/menu/mf-menu.component.spec.ts +1 -1
- package/src/app/components/menu/mf-menu.component.ts +1 -1
- package/src/app/components/progress-bar/mf-progress-bar.component.spec.ts +2 -2
- package/src/app/components/progress-spinner/mf-progress-spinner.component.spec.ts +3 -3
- package/src/app/components/sidenav/mf-sidenav.component.ts +2 -2
- package/src/app/components/table/mf-table.component.ts +1 -1
- package/src/stories/About.mdx +72 -72
- package/src/stories/Welcome.mdx +26 -27
- package/src/stories/mf-a11y-contracts.stories.ts +49 -49
- package/src/stories/mf-autocomplete.stories.ts +194 -188
- package/src/stories/mf-button.stories.ts +152 -156
- package/src/stories/mf-card.stories.ts +147 -148
- package/src/stories/mf-checkbox.stories.ts +88 -88
- package/src/stories/mf-datepicker.stories.ts +118 -118
- package/src/stories/mf-dialog.stories.ts +159 -167
- package/src/stories/mf-form-field.stories.ts +108 -108
- package/src/stories/mf-grid-list.stories.ts +104 -105
- package/src/stories/mf-icon.stories.ts +133 -130
- package/src/stories/mf-input.stories.ts +158 -158
- package/src/stories/mf-menu.stories.ts +10 -10
- package/src/stories/mf-progress-bar.stories.ts +119 -119
- package/src/stories/mf-progress-spinner.stories.ts +124 -124
- package/src/stories/mf-radio-button.stories.ts +111 -111
- package/src/stories/mf-select.stories.ts +184 -178
- package/src/stories/mf-sidenav.stories.ts +331 -334
- package/src/stories/mf-table.stories.ts +13 -13
- package/src/stories/mf-toolbar.stories.ts +112 -112
|
@@ -1,178 +1,184 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
-
|
|
3
|
-
import { MfSelectComponent } from '../app/components/select';
|
|
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' },
|
|
10
|
-
{ value: 'solid', label: 'SolidJS', disabled: true },
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
const meta: Meta<MfSelectComponent> = {
|
|
14
|
-
title: 'Atoms/MfSelect',
|
|
15
|
-
component: MfSelectComponent,
|
|
16
|
-
tags: ['autodocs'],
|
|
17
|
-
parameters: {
|
|
18
|
-
docs: {
|
|
19
|
-
description: {
|
|
20
|
-
component: `
|
|
21
|
-
**MfSelect**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
|
27
|
-
|
|
28
|
-
| \`options\`
|
|
29
|
-
| \`label\`
|
|
30
|
-
| \`placeholder\`
|
|
31
|
-
| \`hint\`
|
|
32
|
-
| \`error\`
|
|
33
|
-
| \`multiple\`
|
|
34
|
-
| \`leadingIcon\`
|
|
35
|
-
| \`trailingIcon\`
|
|
36
|
-
| \`panelClass\`
|
|
37
|
-
`,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
argTypes: {
|
|
42
|
-
label: { control: 'text', description: '
|
|
43
|
-
placeholder: { control: 'text', description: 'Placeholder' },
|
|
44
|
-
size: {
|
|
45
|
-
control: 'select',
|
|
46
|
-
options: ['sm', 'md', 'lg'],
|
|
47
|
-
description: '
|
|
48
|
-
},
|
|
49
|
-
multiple: { control: 'boolean', description: '
|
|
50
|
-
disabled: { control: 'boolean' },
|
|
51
|
-
hint: { control: 'text', description: '
|
|
52
|
-
error: { control: 'text', description: '
|
|
53
|
-
leadingIcon: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
|
|
3
|
+
import { MfSelectComponent } from '../app/components/select';
|
|
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' },
|
|
10
|
+
{ value: 'solid', label: 'SolidJS', disabled: true },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const meta: Meta<MfSelectComponent> = {
|
|
14
|
+
title: 'Atoms/MfSelect',
|
|
15
|
+
component: MfSelectComponent,
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
parameters: {
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component: `
|
|
21
|
+
**MfSelect** is the dropdown select component from the ng-comps library.
|
|
22
|
+
It uses Angular Material \`mat-select\` under the hood while exposing a consistent branded API.
|
|
23
|
+
|
|
24
|
+
The dropdown panel is styled through the global \`mf-select-panel\` class. You can inject additional classes with the \`panelClass\` property to customize the panel at the story or component level.
|
|
25
|
+
|
|
26
|
+
| Property | Description |
|
|
27
|
+
|-----------------|-------------------------------------------------|
|
|
28
|
+
| \`options\` | Array of options \`{ value, label, disabled? }\` |
|
|
29
|
+
| \`label\` | Floating field label |
|
|
30
|
+
| \`placeholder\` | Placeholder text |
|
|
31
|
+
| \`hint\` | Helper text shown below the field |
|
|
32
|
+
| \`error\` | Error message |
|
|
33
|
+
| \`multiple\` | Multiple selection |
|
|
34
|
+
| \`leadingIcon\` | Material icon shown at the start |
|
|
35
|
+
| \`trailingIcon\` | Material icon shown at the end |
|
|
36
|
+
| \`panelClass\` | Extra classes for the dropdown panel |
|
|
37
|
+
`,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
argTypes: {
|
|
42
|
+
label: { control: 'text', description: 'Floating label' },
|
|
43
|
+
placeholder: { control: 'text', description: 'Placeholder' },
|
|
44
|
+
size: {
|
|
45
|
+
control: 'select',
|
|
46
|
+
options: ['sm', 'md', 'lg'],
|
|
47
|
+
description: 'Field size',
|
|
48
|
+
},
|
|
49
|
+
multiple: { control: 'boolean', description: 'Multiple selection' },
|
|
50
|
+
disabled: { control: 'boolean' },
|
|
51
|
+
hint: { control: 'text', description: 'Helper text' },
|
|
52
|
+
error: { control: 'text', description: 'Error message' },
|
|
53
|
+
leadingIcon: {
|
|
54
|
+
control: 'text',
|
|
55
|
+
description: 'Leading icon (Material icon name)',
|
|
56
|
+
},
|
|
57
|
+
trailingIcon: {
|
|
58
|
+
control: 'text',
|
|
59
|
+
description: 'Trailing icon (Material icon name)',
|
|
60
|
+
},
|
|
61
|
+
fullWidth: { control: 'boolean', description: 'Full width' },
|
|
62
|
+
mfSelectionChange: { action: 'mfSelectionChange' },
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default meta;
|
|
67
|
+
type Story = StoryObj<MfSelectComponent>;
|
|
68
|
+
|
|
69
|
+
export const Default: Story = {
|
|
70
|
+
args: {
|
|
71
|
+
options: SAMPLE_OPTIONS,
|
|
72
|
+
label: 'Framework',
|
|
73
|
+
placeholder: 'Select a framework',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const WithHint: Story = {
|
|
78
|
+
name: 'With helper text',
|
|
79
|
+
args: {
|
|
80
|
+
options: SAMPLE_OPTIONS,
|
|
81
|
+
label: 'Framework',
|
|
82
|
+
hint: 'Choose the main framework for your project',
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const WithError: Story = {
|
|
87
|
+
name: 'With error',
|
|
88
|
+
args: {
|
|
89
|
+
options: SAMPLE_OPTIONS,
|
|
90
|
+
label: 'Framework',
|
|
91
|
+
error: 'This field is required',
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const Multiple: Story = {
|
|
96
|
+
name: 'Multiple selection',
|
|
97
|
+
args: {
|
|
98
|
+
options: SAMPLE_OPTIONS,
|
|
99
|
+
label: 'Frameworks',
|
|
100
|
+
multiple: true,
|
|
101
|
+
placeholder: 'Select one or more',
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const WithLeadingIcon: Story = {
|
|
106
|
+
name: 'With leading icon',
|
|
107
|
+
args: {
|
|
108
|
+
options: SAMPLE_OPTIONS,
|
|
109
|
+
label: 'Framework',
|
|
110
|
+
leadingIcon: 'code',
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const Disabled: Story = {
|
|
115
|
+
args: {
|
|
116
|
+
options: SAMPLE_OPTIONS,
|
|
117
|
+
label: 'Framework (disabled)',
|
|
118
|
+
value: 'angular',
|
|
119
|
+
disabled: true,
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const Small: Story = {
|
|
124
|
+
args: {
|
|
125
|
+
options: SAMPLE_OPTIONS,
|
|
126
|
+
label: 'Small',
|
|
127
|
+
size: 'sm',
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const Large: Story = {
|
|
132
|
+
args: {
|
|
133
|
+
options: SAMPLE_OPTIONS,
|
|
134
|
+
label: 'Large',
|
|
135
|
+
size: 'lg',
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const FullWidth: Story = {
|
|
140
|
+
name: 'Full width',
|
|
141
|
+
args: {
|
|
142
|
+
options: SAMPLE_OPTIONS,
|
|
143
|
+
label: 'Framework',
|
|
144
|
+
fullWidth: true,
|
|
145
|
+
},
|
|
146
|
+
parameters: {
|
|
147
|
+
layout: 'padded',
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const CustomPanelClass: Story = {
|
|
152
|
+
name: 'Panel with custom class',
|
|
153
|
+
args: {
|
|
154
|
+
options: SAMPLE_OPTIONS,
|
|
155
|
+
label: 'Framework',
|
|
156
|
+
panelClass: 'my-custom-panel',
|
|
157
|
+
},
|
|
158
|
+
parameters: {
|
|
159
|
+
docs: {
|
|
160
|
+
description: {
|
|
161
|
+
story:
|
|
162
|
+
'Use `panelClass` to add CSS classes to the dropdown panel and apply custom styling.',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const AllVariants: Story = {
|
|
169
|
+
name: 'All variants',
|
|
170
|
+
render: () => ({
|
|
171
|
+
template: `
|
|
172
|
+
<div style="display: flex; flex-direction: column; gap: 16px; max-width: 360px;">
|
|
173
|
+
<mf-select [options]="opts" label="Default" placeholder="Select..." />
|
|
174
|
+
<mf-select [options]="opts" label="With help" hint="Choose your favorite framework" />
|
|
175
|
+
<mf-select [options]="opts" label="With error" error="This field is required" />
|
|
176
|
+
<mf-select [options]="opts" label="With icon" leadingIcon="code" />
|
|
177
|
+
<mf-select [options]="opts" label="Disabled" value="angular" [disabled]="true" />
|
|
178
|
+
<mf-select [options]="opts" label="Multiple" [multiple]="true" />
|
|
179
|
+
</div>
|
|
180
|
+
`,
|
|
181
|
+
props: { opts: SAMPLE_OPTIONS },
|
|
182
|
+
moduleMetadata: { imports: [MfSelectComponent] },
|
|
183
|
+
}),
|
|
184
|
+
};
|