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,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**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
|
17
|
-
|
|
18
|
-
| \`label\`
|
|
19
|
-
| \`placeholder\`
|
|
20
|
-
| \`hint\`
|
|
21
|
-
| \`error\`
|
|
22
|
-
| \`leadingIcon\`
|
|
23
|
-
| \`trailingIcon
|
|
24
|
-
`,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
argTypes: {
|
|
29
|
-
label: { control: 'text', description: '
|
|
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: '
|
|
39
|
-
},
|
|
40
|
-
value: { control: 'text' },
|
|
41
|
-
disabled: { control: 'boolean' },
|
|
42
|
-
readonly: { control: 'boolean' },
|
|
43
|
-
hint: { control: 'text', description: '
|
|
44
|
-
error: { control: 'text', description: '
|
|
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: '
|
|
59
|
-
placeholder: '
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const WithHint: Story = {
|
|
64
|
-
name: '
|
|
65
|
-
args: {
|
|
66
|
-
label: '
|
|
67
|
-
type: 'password',
|
|
68
|
-
hint: '
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export const WithError: Story = {
|
|
73
|
-
name: '
|
|
74
|
-
args: {
|
|
75
|
-
label: 'Email',
|
|
76
|
-
value: '
|
|
77
|
-
error: '
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const WithLeadingIcon: Story = {
|
|
82
|
-
name: '
|
|
83
|
-
args: {
|
|
84
|
-
label: '
|
|
85
|
-
placeholder: '
|
|
86
|
-
leadingIcon: 'search',
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export const WithTrailingIcon: Story = {
|
|
91
|
-
name: '
|
|
92
|
-
args: {
|
|
93
|
-
label: '
|
|
94
|
-
placeholder: '
|
|
95
|
-
trailingIcon: 'mail',
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export const Disabled: Story = {
|
|
100
|
-
args: {
|
|
101
|
-
label: '
|
|
102
|
-
value: '
|
|
103
|
-
disabled: true,
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export const Readonly: Story = {
|
|
108
|
-
name: '
|
|
109
|
-
args: {
|
|
110
|
-
label: '
|
|
111
|
-
value: '
|
|
112
|
-
readonly: true,
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export const Small: Story = {
|
|
117
|
-
args: {
|
|
118
|
-
label: '
|
|
119
|
-
placeholder: '
|
|
120
|
-
size: 'sm',
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export const Large: Story = {
|
|
125
|
-
args: {
|
|
126
|
-
label: '
|
|
127
|
-
placeholder: '
|
|
128
|
-
size: 'lg',
|
|
129
|
-
},
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export const FullWidth: Story = {
|
|
133
|
-
name: '
|
|
134
|
-
args: {
|
|
135
|
-
label: '
|
|
136
|
-
placeholder: '
|
|
137
|
-
fullWidth: true,
|
|
138
|
-
},
|
|
139
|
-
parameters: {
|
|
140
|
-
layout: 'padded',
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
export const AllVariants: Story = {
|
|
145
|
-
name: '
|
|
146
|
-
render: () => ({
|
|
147
|
-
template: `
|
|
148
|
-
<div style="display: flex; flex-direction: column; gap: 16px; max-width: 360px;">
|
|
149
|
-
<mf-input label="
|
|
150
|
-
<mf-input label="
|
|
151
|
-
<mf-input label="
|
|
152
|
-
<mf-input label="
|
|
153
|
-
<mf-input label="
|
|
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: '
|
|
7
|
-
{ value: 'duplicate', label: '
|
|
8
|
-
{ value: 'archive', label: '
|
|
9
|
-
{ value: 'delete', label: '
|
|
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: '
|
|
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: '
|
|
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-
|
|
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>
|
|
64
|
-
<li>
|
|
65
|
-
<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><mf-menu [items]="items" triggerLabel="" /></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**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
|
17
|
-
|
|
18
|
-
| \`determinate\` |
|
|
19
|
-
| \`indeterminate\` |
|
|
20
|
-
| \`buffer\` |
|
|
21
|
-
| \`query\` |
|
|
22
|
-
`,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
argTypes: {
|
|
27
|
-
mode: {
|
|
28
|
-
control: 'select',
|
|
29
|
-
options: ['determinate', 'indeterminate', 'buffer', 'query'],
|
|
30
|
-
description: '
|
|
31
|
-
},
|
|
32
|
-
value: {
|
|
33
|
-
control: { type: 'range', min: 0, max: 100 },
|
|
34
|
-
description: '
|
|
35
|
-
},
|
|
36
|
-
bufferValue: {
|
|
37
|
-
control: { type: 'range', min: 0, max: 100 },
|
|
38
|
-
description: '
|
|
39
|
-
},
|
|
40
|
-
color: {
|
|
41
|
-
control: 'select',
|
|
42
|
-
options: ['brand', 'accent', 'warn'],
|
|
43
|
-
description: '
|
|
44
|
-
},
|
|
45
|
-
label: { control: 'text', description: '
|
|
46
|
-
showValue: { control: 'boolean', description: '
|
|
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: '
|
|
58
|
-
showValue: true,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const Indeterminate: Story = {
|
|
63
|
-
args: {
|
|
64
|
-
mode: 'indeterminate',
|
|
65
|
-
label: '
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const Buffer: Story = {
|
|
70
|
-
args: {
|
|
71
|
-
mode: 'buffer',
|
|
72
|
-
value: 40,
|
|
73
|
-
bufferValue: 70,
|
|
74
|
-
label: '
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const Query: Story = {
|
|
79
|
-
args: {
|
|
80
|
-
mode: 'query',
|
|
81
|
-
label: '
|
|
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: '
|
|
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="
|
|
111
|
-
<mf-progress-bar mode="indeterminate" label="
|
|
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="
|
|
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
|
+
};
|