matcha-components 1.0.2 → 1.0.6

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 (175) hide show
  1. package/README.md +236 -12
  2. package/assets/open_in_new.png +0 -0
  3. package/ng-package.json +7 -0
  4. package/package.json +10 -24
  5. package/src/foundation/colors/base/amber.mdx +232 -0
  6. package/src/foundation/colors/base/blue.mdx +232 -0
  7. package/src/foundation/colors/base/cyan.mdx +232 -0
  8. package/src/foundation/colors/base/deep-orange.mdx +232 -0
  9. package/src/foundation/colors/base/deep-purple.mdx +232 -0
  10. package/src/foundation/colors/base/green.mdx +232 -0
  11. package/src/foundation/colors/base/indigo.mdx +232 -0
  12. package/src/foundation/colors/base/light-blue.mdx +232 -0
  13. package/src/foundation/colors/base/light-green.mdx +232 -0
  14. package/src/foundation/colors/base/lime.mdx +232 -0
  15. package/src/foundation/colors/base/orange.mdx +232 -0
  16. package/src/foundation/colors/base/pink.mdx +232 -0
  17. package/src/foundation/colors/base/purple.mdx +232 -0
  18. package/src/foundation/colors/base/red.mdx +232 -0
  19. package/src/foundation/colors/base/teal.mdx +232 -0
  20. package/src/foundation/colors/base/yellow.mdx +232 -0
  21. package/src/foundation/colors/base-colors.mdx +141 -0
  22. package/src/foundation/colors/surface-colors.mdx +93 -0
  23. package/src/foundation/colors/theme/accent.mdx +232 -0
  24. package/src/foundation/colors/theme/primary.mdx +232 -0
  25. package/src/foundation/colors/theme/warn.mdx +232 -0
  26. package/src/foundation/colors/theme-colors.mdx +159 -0
  27. package/src/foundation/sizes/heights.mdx +232 -0
  28. package/src/foundation/sizes/max-heights.mdx +237 -0
  29. package/src/foundation/sizes/max-width.mdx +236 -0
  30. package/src/foundation/sizes/min-heights.mdx +237 -0
  31. package/src/foundation/sizes/min-width.mdx +236 -0
  32. package/src/foundation/sizes/sizes.mdx +219 -0
  33. package/src/foundation/sizes/widths.mdx +234 -0
  34. package/src/lib/matcha-autocomplete/autocomplete-overview.directive.ts +16 -0
  35. package/src/lib/matcha-autocomplete/autocomplete.argtypes.ts +64 -0
  36. package/src/lib/matcha-autocomplete/autocomplete.directive.ts +14 -0
  37. package/src/lib/matcha-autocomplete/autocomplete.mdx +112 -0
  38. package/src/lib/matcha-autocomplete/autocomplete.module.ts +14 -0
  39. package/src/lib/matcha-autocomplete/autocomplete.stories.ts +113 -0
  40. package/src/lib/matcha-badge/badge.module.ts +14 -0
  41. package/src/lib/matcha-badge/matcha-badge.directive.ts +16 -0
  42. package/src/lib/matcha-bottom-sheet/bottom-sheet.module.ts +14 -0
  43. package/src/lib/matcha-bottom-sheet/matcha-bottom-sheet.directive.ts +16 -0
  44. package/src/lib/matcha-button-toggle/button-toggle.module.ts +14 -0
  45. package/src/lib/matcha-button-toggle/matcha-button-toggle.directive.ts +16 -0
  46. package/src/lib/matcha-buttons/button.stories.ts +111 -0
  47. package/src/lib/matcha-buttons/buttons.module.ts +27 -0
  48. package/src/lib/matcha-buttons/matcha-btn-md.directive.ts +16 -0
  49. package/src/lib/matcha-buttons/matcha-btn-pill.directive.ts +15 -0
  50. package/src/lib/matcha-buttons/matcha-btn-size.directive.ts +17 -0
  51. package/src/lib/matcha-buttons/matcha-btn-xl.directive.ts +15 -0
  52. package/src/lib/matcha-card/card.mdx.txt +55 -0
  53. package/src/lib/matcha-card/matcha-card-argtype.ts +123 -0
  54. package/src/lib/matcha-card/matcha-card-content/matcha-card-content.component.html +3 -0
  55. package/src/lib/matcha-card/matcha-card-content/matcha-card-content.component.scss +0 -0
  56. package/src/lib/matcha-card/matcha-card-content/matcha-card-content.component.spec.ts +21 -0
  57. package/src/lib/matcha-card/matcha-card-content/matcha-card-content.component.ts +10 -0
  58. package/src/lib/matcha-card/matcha-card-footer/matcha-card-footer.component.html +3 -0
  59. package/src/lib/matcha-card/matcha-card-footer/matcha-card-footer.component.scss +0 -0
  60. package/src/lib/matcha-card/matcha-card-footer/matcha-card-footer.component.spec.ts +21 -0
  61. package/src/lib/matcha-card/matcha-card-footer/matcha-card-footer.component.ts +10 -0
  62. package/src/lib/matcha-card/matcha-card-header/matcha-card-header.component.html +4 -0
  63. package/src/lib/matcha-card/matcha-card-header/matcha-card-header.component.scss +0 -0
  64. package/src/lib/matcha-card/matcha-card-header/matcha-card-header.component.spec.ts +21 -0
  65. package/src/lib/matcha-card/matcha-card-header/matcha-card-header.component.ts +10 -0
  66. package/src/lib/matcha-card/matcha-card.component.html +3 -0
  67. package/src/lib/matcha-card/matcha-card.component.scss +117 -0
  68. package/src/lib/matcha-card/matcha-card.component.spec.ts +21 -0
  69. package/src/lib/matcha-card/matcha-card.component.ts +43 -0
  70. package/src/lib/matcha-card/matcha-card.module.ts +27 -0
  71. package/src/lib/matcha-card/matcha-card.stories.ts +80 -0
  72. package/src/lib/matcha-checkbox/checkbox.argtype.ts +79 -0
  73. package/src/lib/matcha-checkbox/checkbox.directive.ts +14 -0
  74. package/src/lib/matcha-checkbox/checkbox.mdx +76 -0
  75. package/src/lib/matcha-checkbox/checkbox.module.ts +9 -0
  76. package/src/lib/matcha-checkbox/checkbox.stories.ts +161 -0
  77. package/src/lib/matcha-checkbox/checkbox.stories.txt +74 -0
  78. package/src/lib/matcha-chips/chips.module.ts +12 -0
  79. package/src/lib/matcha-chips/matcha-chips.directive.ts +16 -0
  80. package/src/lib/matcha-components.module.ts +78 -0
  81. package/src/lib/matcha-datepicker/datepicker.argtypes.ts +63 -0
  82. package/src/lib/matcha-datepicker/datepicker.directive.ts +14 -0
  83. package/src/lib/matcha-datepicker/datepicker.mdx +73 -0
  84. package/src/lib/matcha-datepicker/datepicker.module.ts +9 -0
  85. package/src/lib/matcha-datepicker/datepicker.stories.ts +277 -0
  86. package/src/lib/matcha-dialog/dialog.module.ts +14 -0
  87. package/src/lib/matcha-dialog/matcha-dialog.directive.ts +16 -0
  88. package/src/lib/matcha-dialog2/confirmation-dialog.component.ts.txt +54 -0
  89. package/src/lib/matcha-dialog2/confirmation-dialog.stories.ts.txt +24 -0
  90. package/src/lib/matcha-divider/divider.module.ts +14 -0
  91. package/src/lib/matcha-divider/matcha-divider.directive.ts +16 -0
  92. package/src/lib/matcha-expansion-panel/expansion-panel.module.ts +14 -0
  93. package/src/lib/matcha-expansion-panel/matcha-expansion-panel.directive.ts +16 -0
  94. package/src/lib/matcha-forms/forms.module.ts +19 -0
  95. package/src/lib/matcha-forms/matcha-form-field-appearance.directive.ts +16 -0
  96. package/src/lib/matcha-forms/matcha-form-field-argtype.ts +73 -0
  97. package/src/lib/matcha-forms/matcha-form-field.mdx +284 -0
  98. package/src/lib/matcha-forms/matcha-form-field.stories.ts +345 -0
  99. package/src/lib/matcha-forms/matcha-form-input-text.directive.ts +16 -0
  100. package/src/lib/matcha-icon/icon.module.ts +19 -0
  101. package/src/lib/matcha-icon/matcha-icon-position-pos.directive.ts +15 -0
  102. package/src/lib/matcha-icon/matcha-icon-position-pre.directive.ts +15 -0
  103. package/src/lib/matcha-list/list.module.ts +14 -0
  104. package/src/lib/matcha-list/matcha-list.directive.ts +16 -0
  105. package/src/lib/matcha-menu/matcha-menu.directive.ts +16 -0
  106. package/src/lib/matcha-menu/menu.module.ts +14 -0
  107. package/src/lib/matcha-menu/menu.stories.txt +76 -0
  108. package/src/lib/matcha-paginator/matcha-paginator.directive.ts +16 -0
  109. package/src/lib/matcha-paginator/paginator.module.ts +14 -0
  110. package/src/lib/matcha-progress-bar/progress-bar.argtype.ts +48 -0
  111. package/src/lib/matcha-progress-bar/progress-bar.directive.ts +16 -0
  112. package/src/lib/matcha-progress-bar/progress-bar.mdx +95 -0
  113. package/src/lib/matcha-progress-bar/progress-bar.module.ts +14 -0
  114. package/src/lib/matcha-progress-bar/progress-bar.stories.ts +89 -0
  115. package/src/lib/matcha-progress-spinner/progress-spinner.argtype.ts +65 -0
  116. package/src/lib/matcha-progress-spinner/progress-spinner.directive.ts +16 -0
  117. package/src/lib/matcha-progress-spinner/progress-spinner.mdx +23 -0
  118. package/src/lib/matcha-progress-spinner/progress-spinner.module.ts +14 -0
  119. package/src/lib/matcha-progress-spinner/progress-spinner.stories.ts +44 -0
  120. package/src/lib/matcha-radio-button/matcha-radio-button.argtype.ts +85 -0
  121. package/src/lib/matcha-radio-button/matcha-radio-button.directive.ts +16 -0
  122. package/src/lib/matcha-radio-button/matcha-radio-button.stories.ts +44 -0
  123. package/src/lib/matcha-radio-button/radio-button.module.ts +12 -0
  124. package/src/lib/matcha-select/matcha-select.directive.ts +16 -0
  125. package/src/lib/matcha-select/select.module.ts +12 -0
  126. package/src/lib/matcha-select/select.stories.txt +109 -0
  127. package/src/lib/matcha-slide-toggle/slide-toggle.argtype.ts +66 -0
  128. package/src/lib/matcha-slide-toggle/slide-toggle.directive.ts +16 -0
  129. package/src/lib/matcha-slide-toggle/slide-toggle.mdx +92 -0
  130. package/src/lib/matcha-slide-toggle/slide-toggle.module.ts +12 -0
  131. package/src/lib/matcha-slide-toggle/slide-toggle.stories.ts +167 -0
  132. package/src/lib/matcha-slider/matcha-slider.directive.ts +16 -0
  133. package/src/lib/matcha-slider/slider.module.ts +12 -0
  134. package/src/lib/matcha-snackbar/matcha-snackbar.directive.ts +16 -0
  135. package/src/lib/matcha-snackbar/snackbar.module.ts +12 -0
  136. package/src/lib/matcha-sort-header/matcha-sort-header.directive.ts +16 -0
  137. package/src/lib/matcha-sort-header/sort-header.module.ts +12 -0
  138. package/src/lib/matcha-stepper/matcha-stepper.directive.ts +16 -0
  139. package/src/lib/matcha-stepper/stepper.module.ts +12 -0
  140. package/src/lib/matcha-table/matcha-table.directive.ts +16 -0
  141. package/src/lib/matcha-table/table.module.ts +12 -0
  142. package/src/lib/matcha-tabs/matcha-tabs.directive.ts +17 -0
  143. package/src/lib/matcha-tabs/tabs.module.ts +16 -0
  144. package/src/lib/matcha-tabs/tabs.stories.txt +18 -0
  145. package/src/lib/matcha-title/matcha-title.component.html +33 -0
  146. package/src/lib/matcha-title/matcha-title.component.scss +0 -0
  147. package/src/lib/matcha-title/matcha-title.component.spec.ts +21 -0
  148. package/src/lib/matcha-title/matcha-title.component.ts +24 -0
  149. package/src/lib/matcha-title/matcha-title.module.ts +18 -0
  150. package/src/lib/matcha-tooltip/matcha-tooltip.directive.ts +16 -0
  151. package/src/lib/matcha-tooltip/tooltip.module.ts +12 -0
  152. package/src/lib/matcha-tree/matcha-tree.directive.ts +16 -0
  153. package/src/lib/matcha-tree/tree.module.ts +12 -0
  154. package/src/public-api.ts +93 -0
  155. package/tsconfig.lib.json +18 -0
  156. package/tsconfig.lib.prod.json +10 -0
  157. package/tsconfig.spec.json +14 -0
  158. package/esm2022/lib/components/matcha-confirm-dialog/matcha-confirm-dialog.component.mjs +0 -47
  159. package/esm2022/lib/components/matcha-confirm-dialog/matcha-confirm-dialog.module.mjs +0 -18
  160. package/esm2022/lib/components/matcha-input-search/matcha-input-search.component.mjs +0 -12
  161. package/esm2022/lib/components/matcha-input-search/matcha-input-search.module.mjs +0 -18
  162. package/esm2022/lib/matcha-components.component.mjs +0 -12
  163. package/esm2022/lib/matcha-components.module.mjs +0 -44
  164. package/esm2022/matcha-components.mjs +0 -5
  165. package/esm2022/public-api.mjs +0 -11
  166. package/fesm2022/matcha-components.mjs +0 -141
  167. package/fesm2022/matcha-components.mjs.map +0 -1
  168. package/index.d.ts +0 -5
  169. package/lib/components/matcha-confirm-dialog/matcha-confirm-dialog.component.d.ts +0 -20
  170. package/lib/components/matcha-confirm-dialog/matcha-confirm-dialog.module.d.ts +0 -8
  171. package/lib/components/matcha-input-search/matcha-input-search.component.d.ts +0 -5
  172. package/lib/components/matcha-input-search/matcha-input-search.module.d.ts +0 -8
  173. package/lib/matcha-components.component.d.ts +0 -5
  174. package/lib/matcha-components.module.d.ts +0 -11
  175. package/public-api.d.ts +0 -5
@@ -0,0 +1,345 @@
1
+ import { Meta, moduleMetadata, StoryObj } from '@storybook/angular';
2
+ import { MatFormFieldModule } from '@angular/material/form-field';
3
+ import { MatInputModule } from '@angular/material/input';
4
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
5
+ import { formFieldArgtypes } from './matcha-form-field-argtype';
6
+ import { MatSelectModule } from '@angular/material/select';
7
+ import { MatIconModule } from '@angular/material/icon';
8
+ import { MatButtonModule } from '@angular/material/button';
9
+ import {
10
+ FormControl,
11
+ FormsModule,
12
+ ReactiveFormsModule,
13
+ Validators,
14
+ } from '@angular/forms';
15
+ import { userEvent, within } from '@storybook/testing-library';
16
+ import { expect } from '@storybook/jest';
17
+
18
+ export default {
19
+ title: 'Atoms / Form field',
20
+ // tags: ['autodocs'],
21
+ decorators: [
22
+ moduleMetadata({
23
+ imports: [
24
+ BrowserAnimationsModule,
25
+ MatFormFieldModule,
26
+ MatInputModule,
27
+ MatSelectModule,
28
+ MatIconModule,
29
+ MatButtonModule,
30
+ ReactiveFormsModule,
31
+ FormsModule,
32
+ ],
33
+ }),
34
+ ],
35
+ parameters: {
36
+ actions: { argTypesRegex: '^on.*' },
37
+ controls: {
38
+ expanded: true,
39
+ },
40
+ },
41
+ argTypes: formFieldArgtypes,
42
+ } as Meta;
43
+
44
+ export const WithBasicUsage: StoryObj = {
45
+ render: (args) => ({
46
+ props: args,
47
+ template: `
48
+
49
+ <mat-form-field id="email" appearance="outline" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
50
+ <mat-label>email</mat-label>
51
+ <input type="text" matInput>
52
+ </mat-form-field>
53
+
54
+ <mat-form-field id="password" appearance="outline" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
55
+ <mat-label>Password</mat-label>
56
+ <input type="text" matInput>
57
+ </mat-form-field>
58
+ `,
59
+ }),
60
+ // Added an example of how to use the play function
61
+ // For more information, see https://storybook.js.org/docs/angular/writing-tests/interaction-testing
62
+ // See https://storybook.js.org/docs/angular/essentials/actions#automatically-matching-args to learn how to setup logging in the Actions panel
63
+ play: async ({ canvasElement }) => {
64
+ const canvas = within(canvasElement);
65
+
66
+ // 👇 Simulate interactions with the component
67
+ await userEvent.type(canvas.getByTestId('email'), 'email@provider.com');
68
+ await userEvent.type(
69
+ canvas.getByTestId('password'),
70
+ 'a-random-password'
71
+ );
72
+ await userEvent.click(canvas.getByRole('button'));
73
+ // 👇 Assert DOM structure
74
+ await expect(
75
+ canvas.getByText(
76
+ 'Everything is perfect. Your account is ready and we should probably get you started!'
77
+ )
78
+ );
79
+ },
80
+ name: 'basic usage',
81
+ parameters: {
82
+ controls: {
83
+ exclude: ['alignHint'],
84
+ },
85
+ },
86
+ };
87
+
88
+ export const WithStateFilled: StoryObj = {
89
+ render: (args) => ({
90
+ props: args,
91
+ template: `
92
+ <mat-form-field [appearance]="appearance" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
93
+ <mat-label>Password</mat-label>
94
+ <input type="text" matInput [ngModel]="'admin'">
95
+ </mat-form-field>
96
+ `,
97
+ }),
98
+ name: 'with state (filled)',
99
+ parameters: {
100
+ controls: {
101
+ exclude: ['alignHint'],
102
+ },
103
+ },
104
+ };
105
+
106
+ export const WithStateDisabled: StoryObj = {
107
+ render: (args) => ({
108
+ props: {
109
+ ...args,
110
+ appearance: 'outline',
111
+ },
112
+ template: `
113
+ <mat-form-field [appearance]="appearance" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
114
+ <mat-label>Password</mat-label>
115
+ <input type="text" matInput disabled>
116
+ </mat-form-field>
117
+ `,
118
+ }),
119
+ name: 'with state (disabled)',
120
+ parameters: {
121
+ controls: {
122
+ exclude: ['alignHint'],
123
+ },
124
+ },
125
+ };
126
+
127
+ export const WithStateFocused: StoryObj = {
128
+ render: (args) => ({
129
+ props: {
130
+ ...args,
131
+ appearance: 'outline',
132
+ },
133
+ template: `
134
+ <mat-form-field class="mat-focused" [appearance]="appearance" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
135
+ <mat-label>Password 1</mat-label>
136
+ <input type="text" matInput [ngModel]="'admin'">
137
+ </mat-form-field>
138
+ `,
139
+ }),
140
+ name: 'with state (focused)',
141
+ parameters: {
142
+ controls: {
143
+ exclude: ['alignHint'],
144
+ },
145
+ },
146
+ };
147
+
148
+ export const WithStateHover: StoryObj = {
149
+ render: (args) => ({
150
+ props: {
151
+ ...args,
152
+ appearance: 'outline',
153
+ },
154
+ template: `
155
+ <mat-form-field class="mat-focused" [appearance]="appearance" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
156
+ <mat-label>Password</mat-label>
157
+ <input type="text" matInput>
158
+ </mat-form-field>
159
+ `,
160
+ }),
161
+ name: 'with state (hover)',
162
+ parameters: {
163
+ controls: {
164
+ exclude: ['alignHint'],
165
+ },
166
+ pseudo: {
167
+ hover: true,
168
+ },
169
+ },
170
+ };
171
+
172
+ export const WithAppearanceOutline: StoryObj = {
173
+ render: (args) => ({
174
+ props: {
175
+ ...args,
176
+ appearance: 'outline',
177
+ },
178
+ template: `
179
+ <mat-form-field [appearance]="appearance" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
180
+ <mat-label>Password</mat-label>
181
+ <input type="text" matInput>
182
+ </mat-form-field>
183
+ `,
184
+ }),
185
+ name: 'with appearance (outline)',
186
+ parameters: {
187
+ controls: {
188
+ exclude: ['alignHint'],
189
+ },
190
+ },
191
+ };
192
+
193
+ export const WithStartHint: StoryObj = {
194
+ render: (args) => ({
195
+ props: args,
196
+ template: `
197
+ <mat-form-field [appearance]="appearance" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
198
+ <mat-label>Password</mat-label>
199
+ <input type="text" matInput>
200
+ <mat-hint align="start">at least 8 characters</mat-hint>
201
+ </mat-form-field>
202
+ `,
203
+ }),
204
+ name: 'with hint (start)',
205
+ };
206
+
207
+ export const WithEndHint: StoryObj = {
208
+ render: (args) => ({
209
+ props: args,
210
+ template: `
211
+ <mat-form-field [appearance]="appearance" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
212
+ <mat-label>Contributions</mat-label>
213
+ <mat-select>
214
+ <mat-option>Components</mat-option>
215
+ <mat-option>Use cases</mat-option>
216
+ </mat-select>
217
+ <mat-hint align="end">Choose an option ^</mat-hint>
218
+ </mat-form-field>
219
+ `,
220
+ }),
221
+ name: 'with hint (end)',
222
+ };
223
+
224
+ export const WithDoubleHints: StoryObj = {
225
+ render: (args) => ({
226
+ props: args,
227
+ template: `
228
+ <mat-form-field [appearance]="appearance" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
229
+ <mat-label>Username</mat-label>
230
+ <input type="text" matInput #input [attr.maxlength]="10">
231
+ <mat-hint align="start">Max 10 characters</mat-hint>
232
+ <mat-hint align="end">{{input.value.length || 0}}/10</mat-hint>
233
+ </mat-form-field>
234
+ `,
235
+ }),
236
+ name: 'with hint (double)',
237
+ };
238
+
239
+ export const WithPrefix: StoryObj = {
240
+ render: (args) => ({
241
+ props: {
242
+ ...args,
243
+ hide: true,
244
+ },
245
+ template: `
246
+ <mat-form-field [appearance]="appearance" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
247
+ <mat-label>Password</mat-label>
248
+ <input matInput [type]="hide ? 'password' : 'text'">
249
+ <span class="i-matcha-action_key"></span>
250
+ </mat-form-field>
251
+ `,
252
+ }),
253
+ name: 'with prefix',
254
+ parameters: {
255
+ controls: {
256
+ exclude: ['alignHint'],
257
+ },
258
+ },
259
+ };
260
+
261
+ export const WithSuffix: StoryObj = {
262
+ render: (args) => ({
263
+ props: {
264
+ ...args,
265
+ hide: true,
266
+ },
267
+ template: `
268
+ <mat-form-field [appearance]="appearance" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
269
+ <mat-label>Password</mat-label>
270
+ <input matInput [type]="hide ? 'password' : 'text'">
271
+ <button mat-icon-button matSuffix (click)="hide = !hide" [attr.aria-label]="'Hide password'" [attr.aria-pressed]="hide">
272
+ <span class="{{hide ? 'i-matcha-visibility-on' : 'i-matcha-visibility-off'}}"></span>
273
+ </button>
274
+ </mat-form-field>
275
+ `,
276
+ }),
277
+ name: 'with suffix',
278
+ parameters: {
279
+ controls: {
280
+ exclude: ['alignHint'],
281
+ },
282
+ },
283
+ };
284
+
285
+ export const WithPrefixAndSuffix: StoryObj = {
286
+ render: (args) => ({
287
+ props: {
288
+ ...args,
289
+ hide: true,
290
+ },
291
+ template: `
292
+ <style>
293
+ .example-right-align {
294
+ text-align: right;
295
+ }
296
+
297
+ input.example-right-align::-webkit-outer-spin-button,
298
+ input.example-right-align::-webkit-inner-spin-button {
299
+ display: none;
300
+ }
301
+
302
+ input.example-right-align {
303
+ -moz-appearance: textfield;
304
+ }
305
+ </style>
306
+ <mat-form-field [appearance]="appearance" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
307
+ <mat-label>Amount</mat-label>
308
+ <input matInput type="number" class="example-right-align" placeholder="0">
309
+ <span matPrefix>$&nbsp;</span>
310
+ <span matSuffix>.00</span>
311
+ </mat-form-field>
312
+ `,
313
+ }),
314
+ name: 'with prefix and suffix',
315
+ parameters: {
316
+ controls: {
317
+ exclude: ['alignHint'],
318
+ },
319
+ },
320
+ };
321
+
322
+ const control = new FormControl('', Validators.required);
323
+ control.markAsTouched();
324
+
325
+ export const WithErrorMessage: StoryObj = {
326
+ render: (args) => ({
327
+ props: {
328
+ ...args,
329
+ control: control,
330
+ },
331
+ template: `
332
+ <mat-form-field [appearance]="appearance" [color]="color" [floatLabel]="floatLabel" [hideRequiredMarker]="hideRequiredMarker" [hintLabel]="hintLabel">
333
+ <mat-label>Password</mat-label>
334
+ <input type="text" matInput [formControl]="control">
335
+ <mat-error *ngIf="control.hasError('required')">This field is required</mat-error>
336
+ </mat-form-field>
337
+ `,
338
+ }),
339
+ name: 'with error message',
340
+ parameters: {
341
+ controls: {
342
+ exclude: ['alignHint'],
343
+ },
344
+ },
345
+ };
@@ -0,0 +1,16 @@
1
+ import { Directive, ElementRef, Renderer2 } from '@angular/core';
2
+
3
+ @Directive({
4
+ selector: '[matcha-form-input-text]'
5
+ })
6
+ export class MatchaFormInputTextDirective {
7
+
8
+ constructor(
9
+ private _elementRef: ElementRef,
10
+ private _renderer: Renderer2
11
+ ) {
12
+ //this._elementRef.nativeElement.style.backgroundColor = 'grey';
13
+ this._renderer.addClass(this._elementRef.nativeElement, 'matcha-form-input-text')
14
+ }
15
+
16
+ }
@@ -0,0 +1,19 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { MatchaIconPositionPreDirective } from './matcha-icon-position-pre.directive';
4
+ import { MatchaIconPositionPosDirective } from './matcha-icon-position-pos.directive';
5
+
6
+ @NgModule({
7
+ declarations: [
8
+ MatchaIconPositionPreDirective,
9
+ MatchaIconPositionPosDirective
10
+ ],
11
+ imports: [
12
+ CommonModule
13
+ ],
14
+ exports: [
15
+ MatchaIconPositionPreDirective,
16
+ MatchaIconPositionPosDirective
17
+ ]
18
+ })
19
+ export class MatchaIconModule { }
@@ -0,0 +1,15 @@
1
+ import { Directive, ElementRef, Renderer2 } from '@angular/core';
2
+
3
+ @Directive({
4
+ selector: '[icon-position-pos]'
5
+ })
6
+ export class MatchaIconPositionPosDirective {
7
+
8
+ constructor(
9
+ private _elementRef: ElementRef,
10
+ private _renderer: Renderer2
11
+ ) {
12
+ this._renderer.addClass(this._elementRef.nativeElement,'icon-position-pos')
13
+ }
14
+
15
+ }
@@ -0,0 +1,15 @@
1
+ import { Directive, ElementRef, Renderer2 } from '@angular/core';
2
+
3
+ @Directive({
4
+ selector: '[icon-position-pre]'
5
+ })
6
+ export class MatchaIconPositionPreDirective {
7
+
8
+ constructor(
9
+ private _elementRef: ElementRef,
10
+ private _renderer: Renderer2
11
+ ) {
12
+ this._renderer.addClass(this._elementRef.nativeElement,'icon-position-pre')
13
+ }
14
+
15
+ }
@@ -0,0 +1,14 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { MatchaListDirective } from './matcha-list.directive';
4
+
5
+ @NgModule({
6
+ declarations: [MatchaListDirective],
7
+ imports: [
8
+ CommonModule
9
+ ],
10
+ exports:[
11
+ MatchaListDirective
12
+ ]
13
+ })
14
+ export class MatchaListModule { }
@@ -0,0 +1,16 @@
1
+ import { Directive, ElementRef, Renderer2 } from '@angular/core';
2
+
3
+ @Directive({
4
+ selector: '[matchaList]'
5
+ })
6
+ export class MatchaListDirective {
7
+
8
+ constructor(
9
+ private _elementRef: ElementRef,
10
+ private _renderer: Renderer2
11
+ ) {
12
+ //this._elementRef.nativeElement.style.backgroundColor = 'grey';
13
+ this._renderer.addClass(this._elementRef.nativeElement, 'matcha-list')
14
+ }
15
+
16
+ }
@@ -0,0 +1,16 @@
1
+ import { Directive, ElementRef, Renderer2 } from '@angular/core';
2
+
3
+ @Directive({
4
+ selector: '[matchaMenu]'
5
+ })
6
+ export class MatchaMenuDirective {
7
+
8
+ constructor(
9
+ private _elementRef: ElementRef,
10
+ private _renderer: Renderer2
11
+ ) {
12
+ //this._elementRef.nativeElement.style.backgroundColor = 'grey';
13
+ this._renderer.addClass(this._elementRef.nativeElement, 'matcha-menu')
14
+ }
15
+
16
+ }
@@ -0,0 +1,14 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { MatchaMenuDirective } from './matcha-menu.directive';
4
+
5
+ @NgModule({
6
+ declarations: [MatchaMenuDirective],
7
+ imports: [
8
+ CommonModule
9
+ ],
10
+ exports:[
11
+ MatchaMenuDirective
12
+ ]
13
+ })
14
+ export class MatchaMenuModule { }
@@ -0,0 +1,76 @@
1
+ import { storiesOf } from '@storybook/angular';
2
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
3
+ import { MatMenuModule } from '@angular/material/menu';
4
+ import { MatButtonModule } from '@angular/material/button';
5
+
6
+ storiesOf('Menu', module)
7
+ .add('Basic', () => ({
8
+ template: `
9
+ <div>
10
+ <button mat-button [disabled]="disabled" [matMenuTriggerFor]="menu">Menu</button>
11
+ <mat-menu #menu="matMenu">
12
+ <button mat-menu-item>Item 1</button>
13
+ <button mat-menu-item>Item 2</button>
14
+ </mat-menu>
15
+ </div>
16
+ `,
17
+ props: {
18
+ disabled: { disabled: false },
19
+ },
20
+ moduleMetadata: {
21
+ imports: [MatMenuModule, MatButtonModule, BrowserAnimationsModule],
22
+ },
23
+ }))
24
+ .add('Nested', () => ({
25
+ template: `
26
+ <div>
27
+ <button mat-button [disabled]="disabled" [matMenuTriggerFor]="animals">Animal index</button>
28
+ <mat-menu #animals="matMenu">
29
+ <button mat-menu-item [matMenuTriggerFor]="vertebrates">Vertebrates</button>
30
+ <button mat-menu-item [matMenuTriggerFor]="invertebrates">Invertebrates</button>
31
+ </mat-menu>
32
+ <mat-menu #vertebrates="matMenu">
33
+ <button mat-menu-item [matMenuTriggerFor]="fish">Fishes</button>
34
+ <button mat-menu-item [matMenuTriggerFor]="amphibians">Amphibians</button>
35
+ <button mat-menu-item [matMenuTriggerFor]="reptiles">Reptiles</button>
36
+ <button mat-menu-item>Birds</button>
37
+ <button mat-menu-item>Mammals</button>
38
+ </mat-menu>
39
+ <mat-menu #invertebrates="matMenu">
40
+ <button mat-menu-item>Insects</button>
41
+ <button mat-menu-item>Molluscs</button>
42
+ <button mat-menu-item>Crustaceans</button>
43
+ <button mat-menu-item>Corals</button>
44
+ <button mat-menu-item>Arachnids</button>
45
+ <button mat-menu-item>Velvet worms</button>
46
+ <button mat-menu-item>Horseshoe crabs</button>
47
+ </mat-menu>
48
+ <mat-menu #fish="matMenu">
49
+ <button mat-menu-item>Baikal oilfish</button>
50
+ <button mat-menu-item>Bala shark</button>
51
+ <button mat-menu-item>Ballan wrasse</button>
52
+ <button mat-menu-item>Bamboo shark</button>
53
+ <button mat-menu-item>Banded killifish</button>
54
+ </mat-menu>
55
+ <mat-menu #amphibians="matMenu">
56
+ <button mat-menu-item>Sonoran desert toad</button>
57
+ <button mat-menu-item>Western toad</button>
58
+ <button mat-menu-item>Arroyo toad</button>
59
+ <button mat-menu-item>Yosemite toad</button>
60
+ </mat-menu>
61
+ <mat-menu #reptiles="matMenu">
62
+ <button mat-menu-item>Banded Day Gecko</button>
63
+ <button mat-menu-item>Banded Gila Monster</button>
64
+ <button mat-menu-item>Black Tree Monitor</button>
65
+ <button mat-menu-item>Blue Spiny Lizard</button>
66
+ <button mat-menu-item disabled>Velociraptor</button>
67
+ </mat-menu>
68
+ </div>
69
+ `,
70
+ props: {
71
+ disabled: { disabled: false },
72
+ },
73
+ moduleMetadata: {
74
+ imports: [MatMenuModule, MatButtonModule, BrowserAnimationsModule],
75
+ },
76
+ }));
@@ -0,0 +1,16 @@
1
+ import { Directive, ElementRef, Renderer2 } from '@angular/core';
2
+
3
+ @Directive({
4
+ selector: '[matchaPaginator]'
5
+ })
6
+ export class MatchaPaginatorDirective {
7
+
8
+ constructor(
9
+ private _elementRef: ElementRef,
10
+ private _renderer: Renderer2
11
+ ) {
12
+ //this._elementRef.nativeElement.style.backgroundColor = 'grey';
13
+ this._renderer.addClass(this._elementRef.nativeElement, 'matcha-paginator')
14
+ }
15
+
16
+ }
@@ -0,0 +1,14 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { MatchaPaginatorDirective } from './matcha-paginator.directive';
4
+
5
+ @NgModule({
6
+ declarations: [MatchaPaginatorDirective],
7
+ imports: [
8
+ CommonModule
9
+ ],
10
+ exports:[
11
+ MatchaPaginatorDirective
12
+ ]
13
+ })
14
+ export class MatchaPaginatorModule { }
@@ -0,0 +1,48 @@
1
+ export const progressBarArgtypes = {
2
+ bufferValue: {
3
+ description: 'Buffer value of the progress bar',
4
+ defaultValue: 0,
5
+ table: {
6
+ type: { summary: 'range' },
7
+ defaultValue: { summary: 75 },
8
+ },
9
+ control: {
10
+ type: 'range',
11
+ min: 0,
12
+ max: 100,
13
+ step: 1,
14
+ },
15
+ },
16
+ color: {
17
+ description: 'Theme color palette',
18
+ control: 'select',
19
+ defaultValue: 'accent',
20
+ table: {
21
+ defaultValue: { summary: 'accent' },
22
+ },
23
+ options: ['primary', 'accent', 'warn'],
24
+ },
25
+ mode: {
26
+ description: 'Mode of the progress bar',
27
+ control: 'select',
28
+ defaultValue: 'indeterminate',
29
+ table: {
30
+ defaultValue: { summary: 'indeterminate' },
31
+ },
32
+ options: ['determinate', 'indeterminate', 'buffer', 'query'],
33
+ },
34
+ value: {
35
+ description: 'Value of the progress bar',
36
+ defaultValue: 0,
37
+ table: {
38
+ type: { summary: 'range' },
39
+ defaultValue: { summary: 25 },
40
+ },
41
+ control: {
42
+ type: 'range',
43
+ min: 0,
44
+ max: 100,
45
+ step: 1,
46
+ },
47
+ },
48
+ };
@@ -0,0 +1,16 @@
1
+ import { Directive, ElementRef, Renderer2 } from '@angular/core';
2
+
3
+ @Directive({
4
+ selector: '[matcha-progress-bar]'
5
+ })
6
+ export class MatchaProgressBarDirective {
7
+
8
+ constructor(
9
+ private _elementRef: ElementRef,
10
+ private _renderer: Renderer2
11
+ ) {
12
+ //this._elementRef.nativeElement.style.backgroundColor = 'grey';
13
+ this._renderer.addClass(this._elementRef.nativeElement, 'matcha-progress-bar')
14
+ }
15
+
16
+ }