ng-comps 1.0.2 → 2.0.0

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 (197) hide show
  1. package/fesm2022/ng-comps.mjs +4254 -0
  2. package/package.json +54 -58
  3. package/src/styles.css +54 -0
  4. package/types/ng-comps.d.ts +1348 -0
  5. package/.editorconfig +0 -17
  6. package/.github/copilot-instructions.md +0 -55
  7. package/.github/workflows/ci.yml +0 -29
  8. package/.prettierrc +0 -12
  9. package/.storybook/main.ts +0 -21
  10. package/.storybook/preview.ts +0 -27
  11. package/.storybook/tsconfig.doc.json +0 -10
  12. package/.storybook/tsconfig.json +0 -15
  13. package/.storybook/typings.d.ts +0 -4
  14. package/.vscode/extensions.json +0 -4
  15. package/.vscode/launch.json +0 -20
  16. package/.vscode/mcp.json +0 -9
  17. package/.vscode/tasks.json +0 -42
  18. package/ACCESSIBILITY.md +0 -127
  19. package/angular.json +0 -106
  20. package/documentation.json +0 -13394
  21. package/ng-package.json +0 -27
  22. package/public/favicon.ico +0 -0
  23. package/scripts/prepare-package.mjs +0 -80
  24. package/src/app/a11y/accessibility.utils.ts +0 -35
  25. package/src/app/a11y/index.ts +0 -6
  26. package/src/app/accessibility/ng-comps.a11y.spec.ts +0 -108
  27. package/src/app/app.config.ts +0 -11
  28. package/src/app/app.css +0 -107
  29. package/src/app/app.html +0 -48
  30. package/src/app/app.routes.ts +0 -3
  31. package/src/app/app.spec.ts +0 -23
  32. package/src/app/app.ts +0 -10
  33. package/src/app/components/accordion/index.ts +0 -2
  34. package/src/app/components/accordion/mf-accordion.component.css +0 -38
  35. package/src/app/components/accordion/mf-accordion.component.spec.ts +0 -48
  36. package/src/app/components/accordion/mf-accordion.component.ts +0 -53
  37. package/src/app/components/alert/index.ts +0 -2
  38. package/src/app/components/alert/mf-alert.component.css +0 -100
  39. package/src/app/components/alert/mf-alert.component.spec.ts +0 -59
  40. package/src/app/components/alert/mf-alert.component.ts +0 -68
  41. package/src/app/components/autocomplete/index.ts +0 -5
  42. package/src/app/components/autocomplete/mf-autocomplete.component.css +0 -105
  43. package/src/app/components/autocomplete/mf-autocomplete.component.spec.ts +0 -116
  44. package/src/app/components/autocomplete/mf-autocomplete.component.ts +0 -307
  45. package/src/app/components/avatar/index.ts +0 -2
  46. package/src/app/components/avatar/mf-avatar.component.css +0 -27
  47. package/src/app/components/avatar/mf-avatar.component.spec.ts +0 -49
  48. package/src/app/components/avatar/mf-avatar.component.ts +0 -99
  49. package/src/app/components/badge/index.ts +0 -2
  50. package/src/app/components/badge/mf-badge.component.css +0 -32
  51. package/src/app/components/badge/mf-badge.component.spec.ts +0 -40
  52. package/src/app/components/badge/mf-badge.component.ts +0 -105
  53. package/src/app/components/breadcrumb/index.ts +0 -2
  54. package/src/app/components/breadcrumb/mf-breadcrumb.component.css +0 -61
  55. package/src/app/components/breadcrumb/mf-breadcrumb.component.spec.ts +0 -61
  56. package/src/app/components/breadcrumb/mf-breadcrumb.component.ts +0 -75
  57. package/src/app/components/button/index.ts +0 -2
  58. package/src/app/components/button/mf-button.component.css +0 -136
  59. package/src/app/components/button/mf-button.component.ts +0 -174
  60. package/src/app/components/card/index.ts +0 -2
  61. package/src/app/components/card/mf-card.component.css +0 -82
  62. package/src/app/components/card/mf-card.component.ts +0 -59
  63. package/src/app/components/checkbox/index.ts +0 -1
  64. package/src/app/components/checkbox/mf-checkbox.component.css +0 -75
  65. package/src/app/components/checkbox/mf-checkbox.component.ts +0 -187
  66. package/src/app/components/chip/index.ts +0 -2
  67. package/src/app/components/chip/mf-chip.component.css +0 -69
  68. package/src/app/components/chip/mf-chip.component.spec.ts +0 -47
  69. package/src/app/components/chip/mf-chip.component.ts +0 -77
  70. package/src/app/components/datepicker/index.ts +0 -2
  71. package/src/app/components/datepicker/mf-datepicker.component.css +0 -102
  72. package/src/app/components/datepicker/mf-datepicker.component.spec.ts +0 -69
  73. package/src/app/components/datepicker/mf-datepicker.component.ts +0 -233
  74. package/src/app/components/dialog/index.ts +0 -3
  75. package/src/app/components/dialog/mf-dialog.component.css +0 -73
  76. package/src/app/components/dialog/mf-dialog.component.ts +0 -160
  77. package/src/app/components/dialog/mf-dialog.service.spec.ts +0 -61
  78. package/src/app/components/dialog/mf-dialog.service.ts +0 -52
  79. package/src/app/components/divider/index.ts +0 -2
  80. package/src/app/components/divider/mf-divider.component.css +0 -38
  81. package/src/app/components/divider/mf-divider.component.spec.ts +0 -40
  82. package/src/app/components/divider/mf-divider.component.ts +0 -44
  83. package/src/app/components/form-field/index.ts +0 -1
  84. package/src/app/components/form-field/mf-form-field.component.css +0 -51
  85. package/src/app/components/form-field/mf-form-field.component.ts +0 -74
  86. package/src/app/components/grid-list/index.ts +0 -2
  87. package/src/app/components/grid-list/mf-grid-list.component.css +0 -47
  88. package/src/app/components/grid-list/mf-grid-list.component.spec.ts +0 -57
  89. package/src/app/components/grid-list/mf-grid-list.component.ts +0 -68
  90. package/src/app/components/icon/index.ts +0 -2
  91. package/src/app/components/icon/mf-icon.component.css +0 -56
  92. package/src/app/components/icon/mf-icon.component.ts +0 -41
  93. package/src/app/components/input/index.ts +0 -2
  94. package/src/app/components/input/mf-input.component.css +0 -105
  95. package/src/app/components/input/mf-input.component.ts +0 -217
  96. package/src/app/components/menu/index.ts +0 -2
  97. package/src/app/components/menu/mf-menu.component.css +0 -31
  98. package/src/app/components/menu/mf-menu.component.spec.ts +0 -49
  99. package/src/app/components/menu/mf-menu.component.ts +0 -66
  100. package/src/app/components/paginator/index.ts +0 -1
  101. package/src/app/components/paginator/mf-paginator.component.css +0 -32
  102. package/src/app/components/paginator/mf-paginator.component.spec.ts +0 -44
  103. package/src/app/components/paginator/mf-paginator.component.ts +0 -52
  104. package/src/app/components/progress-bar/index.ts +0 -2
  105. package/src/app/components/progress-bar/mf-progress-bar.component.css +0 -53
  106. package/src/app/components/progress-bar/mf-progress-bar.component.spec.ts +0 -65
  107. package/src/app/components/progress-bar/mf-progress-bar.component.ts +0 -79
  108. package/src/app/components/progress-spinner/index.ts +0 -2
  109. package/src/app/components/progress-spinner/mf-progress-spinner.component.css +0 -38
  110. package/src/app/components/progress-spinner/mf-progress-spinner.component.spec.ts +0 -59
  111. package/src/app/components/progress-spinner/mf-progress-spinner.component.ts +0 -81
  112. package/src/app/components/radio-button/index.ts +0 -2
  113. package/src/app/components/radio-button/mf-radio-button.component.css +0 -86
  114. package/src/app/components/radio-button/mf-radio-button.component.spec.ts +0 -55
  115. package/src/app/components/radio-button/mf-radio-button.component.ts +0 -219
  116. package/src/app/components/select/index.ts +0 -2
  117. package/src/app/components/select/mf-select.component.css +0 -121
  118. package/src/app/components/select/mf-select.component.spec.ts +0 -108
  119. package/src/app/components/select/mf-select.component.ts +0 -252
  120. package/src/app/components/sidenav/index.ts +0 -2
  121. package/src/app/components/sidenav/mf-sidenav.component.css +0 -168
  122. package/src/app/components/sidenav/mf-sidenav.component.spec.ts +0 -57
  123. package/src/app/components/sidenav/mf-sidenav.component.ts +0 -126
  124. package/src/app/components/slide-toggle/index.ts +0 -1
  125. package/src/app/components/slide-toggle/mf-slide-toggle.component.css +0 -42
  126. package/src/app/components/slide-toggle/mf-slide-toggle.component.spec.ts +0 -43
  127. package/src/app/components/slide-toggle/mf-slide-toggle.component.ts +0 -188
  128. package/src/app/components/snackbar/index.ts +0 -2
  129. package/src/app/components/snackbar/mf-snackbar.service.css +0 -31
  130. package/src/app/components/snackbar/mf-snackbar.service.spec.ts +0 -81
  131. package/src/app/components/snackbar/mf-snackbar.service.ts +0 -77
  132. package/src/app/components/table/index.ts +0 -2
  133. package/src/app/components/table/mf-table.component.css +0 -68
  134. package/src/app/components/table/mf-table.component.spec.ts +0 -76
  135. package/src/app/components/table/mf-table.component.ts +0 -117
  136. package/src/app/components/tabs/index.ts +0 -2
  137. package/src/app/components/tabs/mf-tabs.component.css +0 -31
  138. package/src/app/components/tabs/mf-tabs.component.spec.ts +0 -50
  139. package/src/app/components/tabs/mf-tabs.component.ts +0 -62
  140. package/src/app/components/textarea/index.ts +0 -2
  141. package/src/app/components/textarea/mf-textarea.component.css +0 -48
  142. package/src/app/components/textarea/mf-textarea.component.spec.ts +0 -55
  143. package/src/app/components/textarea/mf-textarea.component.ts +0 -227
  144. package/src/app/components/toolbar/index.ts +0 -2
  145. package/src/app/components/toolbar/mf-toolbar.component.css +0 -77
  146. package/src/app/components/toolbar/mf-toolbar.component.ts +0 -56
  147. package/src/app/components/tooltip/index.ts +0 -3
  148. package/src/app/components/tooltip/mf-tooltip.component.css +0 -7
  149. package/src/app/components/tooltip/mf-tooltip.component.spec.ts +0 -37
  150. package/src/app/components/tooltip/mf-tooltip.component.ts +0 -47
  151. package/src/app/components/tooltip/mf-tooltip.directive.ts +0 -22
  152. package/src/index.html +0 -18
  153. package/src/main.ts +0 -6
  154. package/src/public-api.ts +0 -31
  155. package/src/stories/About.mdx +0 -72
  156. package/src/stories/Accessibility.mdx +0 -59
  157. package/src/stories/Welcome.mdx +0 -26
  158. package/src/stories/assets/accessibility.png +0 -0
  159. package/src/stories/assets/accessibility.svg +0 -1
  160. package/src/stories/assets/addon-library.png +0 -0
  161. package/src/stories/assets/assets.png +0 -0
  162. package/src/stories/assets/avif-test-image.avif +0 -0
  163. package/src/stories/assets/context.png +0 -0
  164. package/src/stories/assets/discord.svg +0 -1
  165. package/src/stories/assets/docs.png +0 -0
  166. package/src/stories/assets/figma-plugin.png +0 -0
  167. package/src/stories/assets/github.svg +0 -1
  168. package/src/stories/assets/share.png +0 -0
  169. package/src/stories/assets/styling.png +0 -0
  170. package/src/stories/assets/testing.png +0 -0
  171. package/src/stories/assets/theming.png +0 -0
  172. package/src/stories/assets/tutorials.svg +0 -1
  173. package/src/stories/assets/youtube.svg +0 -1
  174. package/src/stories/mf-a11y-contracts.stories.ts +0 -472
  175. package/src/stories/mf-autocomplete.stories.ts +0 -194
  176. package/src/stories/mf-button.stories.ts +0 -152
  177. package/src/stories/mf-card.stories.ts +0 -147
  178. package/src/stories/mf-checkbox.stories.ts +0 -88
  179. package/src/stories/mf-datepicker.stories.ts +0 -118
  180. package/src/stories/mf-dialog.stories.ts +0 -159
  181. package/src/stories/mf-form-field.stories.ts +0 -108
  182. package/src/stories/mf-grid-list.stories.ts +0 -104
  183. package/src/stories/mf-icon.stories.ts +0 -133
  184. package/src/stories/mf-input.stories.ts +0 -158
  185. package/src/stories/mf-menu.stories.ts +0 -71
  186. package/src/stories/mf-progress-bar.stories.ts +0 -119
  187. package/src/stories/mf-progress-spinner.stories.ts +0 -124
  188. package/src/stories/mf-radio-button.stories.ts +0 -111
  189. package/src/stories/mf-select.stories.ts +0 -184
  190. package/src/stories/mf-sidenav.stories.ts +0 -331
  191. package/src/stories/mf-table.stories.ts +0 -80
  192. package/src/stories/mf-toolbar.stories.ts +0 -112
  193. package/src/stories/user.ts +0 -3
  194. package/tsconfig.app.json +0 -15
  195. package/tsconfig.json +0 -33
  196. package/tsconfig.spec.json +0 -15
  197. package/vercel.json +0 -6
@@ -1,71 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/angular';
2
-
3
- import { MfMenuComponent } from '../app/components/menu';
4
-
5
- const MENU_ITEMS = [
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
- ];
11
-
12
- const meta: Meta<MfMenuComponent> = {
13
- title: 'Atoms/MfMenu',
14
- component: MfMenuComponent,
15
- tags: ['autodocs'],
16
- parameters: {
17
- docs: {
18
- description: {
19
- component: `
20
- **MfMenu** exposes an accessible menu trigger over Angular Material \`mat-menu\`.
21
-
22
- Use this component when:
23
-
24
- - the trigger has an explicit accessible label
25
- - menu items are actions, not layout containers
26
- - keyboard users must be able to open with Enter or Space and close with Escape
27
- `,
28
- },
29
- },
30
- },
31
- argTypes: {
32
- triggerIcon: { control: 'text', description: 'Material icon used in the trigger' },
33
- triggerLabel: { control: 'text', description: 'Accessible name of the trigger button' },
34
- mfItemClick: { action: 'mfItemClick' },
35
- },
36
- };
37
-
38
- export default meta;
39
- type Story = StoryObj<MfMenuComponent>;
40
-
41
- export const Default: Story = {
42
- args: {
43
- items: MENU_ITEMS,
44
- triggerLabel: 'Open record actions',
45
- },
46
- };
47
-
48
- export const CorrectUsage: Story = {
49
- name: 'Correct Usage',
50
- args: {
51
- items: MENU_ITEMS,
52
- triggerLabel: 'Open project actions',
53
- },
54
- };
55
-
56
- export const IncorrectUsage: Story = {
57
- name: 'Incorrect Usage',
58
- render: () => ({
59
- template: `
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-patterns</h2>
62
- <ul style="margin: 0 0 16px; padding-left: 18px;">
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
- </ul>
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
- </section>
69
- `,
70
- }),
71
- };
@@ -1,119 +0,0 @@
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
- };
@@ -1,124 +0,0 @@
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 +0,0 @@
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
- };
@@ -1,184 +0,0 @@
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
- };