@@ -5,6 +5,22 @@ import CustomComponentText from './examples-texts/custom-component';
5
5
import WizardText from './examples-texts/wizard' ;
6
6
import SelectText from './examples-texts/select' ;
7
7
8
+ const formGroupVariants = [ {
9
+ name : 'isDisabled' ,
10
+ title : 'Disabled' ,
11
+ } , {
12
+ name : 'helperText' ,
13
+ title : 'Helper text' ,
14
+ component : 'input' ,
15
+ } , {
16
+ name : 'description' ,
17
+ title : 'Description' ,
18
+ component : 'input' ,
19
+ } , {
20
+ name : 'isReadOnly' ,
21
+ title : 'Read only' ,
22
+ } ] ;
23
+
8
24
export const baseExamples = [ {
9
25
component : componentTypes . TEXT_FIELD ,
10
26
link : componentTypes . TEXT_FIELD ,
@@ -16,30 +32,21 @@ export const baseExamples = [{
16
32
name : 'first-name' ,
17
33
} ] } ,
18
34
canBeRequired : true ,
19
- variants : [ {
20
- name : 'isDisabled' ,
21
- title : 'Disabled' ,
22
- } , {
23
- name : 'helperText' ,
24
- title : 'Helper text' ,
25
- component : 'input' ,
26
- } , {
27
- name : 'label' ,
28
- title : 'Label' ,
29
- component : 'input' ,
30
- value : 'First name' ,
31
- } , {
32
- title : 'Input Type' ,
33
- name : 'type' ,
34
- options : [ 'text' , 'number' , 'password' ] ,
35
- } , {
36
- name : 'placeholder' ,
37
- title : 'Placeholder' ,
38
- component : 'input' ,
39
- } , {
40
- name : 'isReadOnly' ,
41
- title : 'Read only' ,
42
- } ] ,
35
+ variants : [
36
+ ...formGroupVariants , {
37
+ name : 'label' ,
38
+ title : 'Label' ,
39
+ component : 'input' ,
40
+ value : 'First name' ,
41
+ } , {
42
+ title : 'Input Type' ,
43
+ name : 'type' ,
44
+ options : [ 'text' , 'number' , 'password' ] ,
45
+ } , {
46
+ name : 'placeholder' ,
47
+ title : 'Placeholder' ,
48
+ component : 'input' ,
49
+ } ] ,
43
50
} , {
44
51
component : componentTypes . TEXTAREA_FIELD ,
45
52
link : componentTypes . TEXTAREA_FIELD ,
@@ -51,26 +58,17 @@ export const baseExamples = [{
51
58
label : 'Long text' ,
52
59
name : 'long-text' ,
53
60
} ] } ,
54
- variants : [ {
55
- name : 'isDisabled' ,
56
- title : 'Disabled' ,
57
- } , {
58
- name : 'helperText' ,
59
- title : 'Helper text' ,
60
- component : 'input' ,
61
- } , {
62
- name : 'label' ,
63
- title : 'Label' ,
64
- component : 'input' ,
65
- value : 'Long text' ,
66
- } , {
67
- name : 'placeholder' ,
68
- title : 'Placeholder' ,
69
- component : 'input' ,
70
- } , {
71
- name : 'isReadOnly' ,
72
- title : 'Read only' ,
73
- } ] ,
61
+ variants : [
62
+ ...formGroupVariants , {
63
+ name : 'label' ,
64
+ title : 'Label' ,
65
+ component : 'input' ,
66
+ value : 'Long text' ,
67
+ } , {
68
+ name : 'placeholder' ,
69
+ title : 'Placeholder' ,
70
+ component : 'input' ,
71
+ } ] ,
74
72
} ,
75
73
{
76
74
component : componentTypes . CHECKBOX ,
@@ -86,15 +84,13 @@ export const baseExamples = [{
86
84
label : 'Checkbox' ,
87
85
name : 'checkbox' ,
88
86
} ] } ,
89
- variants : [ {
90
- name : 'isDisabled' ,
91
- title : 'Disabled' ,
92
- } , {
93
- name : 'label' ,
94
- title : 'Label' ,
95
- component : 'input' ,
96
- value : 'Checkbox' ,
97
- } ] ,
87
+ variants : [
88
+ ...formGroupVariants , {
89
+ name : 'label' ,
90
+ title : 'Label' ,
91
+ component : 'input' ,
92
+ value : 'Checkbox' ,
93
+ } ] ,
98
94
} ,
99
95
{
100
96
component : componentTypes . RADIO ,
@@ -112,10 +108,7 @@ export const baseExamples = [{
112
108
{ label : 'Hamsters' , value : '3' } ,
113
109
] ,
114
110
} ] } ,
115
- variants : [ {
116
- name : 'isDisabled' ,
117
- title : 'Disabled' ,
118
- } , {
111
+ variants : [ ...formGroupVariants , , {
119
112
name : 'label' ,
120
113
title : 'Label' ,
121
114
component : 'input' ,
@@ -139,10 +132,7 @@ export const baseExamples = [{
139
132
{ label : 'Hamsters' , value : '3' } ,
140
133
] ,
141
134
} ] } ,
142
- variants : [ {
143
- name : 'isDisabled' ,
144
- title : 'Disabled' ,
145
- } , {
135
+ variants : [ ...formGroupVariants , {
146
136
name : 'label' ,
147
137
title : 'Label' ,
148
138
component : 'input' ,
@@ -182,13 +172,7 @@ export const baseExamples = [{
182
172
label : 'Switch' ,
183
173
name : 'switch' ,
184
174
} ] } ,
185
- variants : [ {
186
- name : 'isReadOnly' ,
187
- title : 'Read only' ,
188
- } , {
189
- name : 'isDisabled' ,
190
- title : 'Disabled' ,
191
- } , {
175
+ variants : [ ...formGroupVariants , {
192
176
name : 'label' ,
193
177
title : 'Label' ,
194
178
component : 'input' ,
@@ -215,7 +199,7 @@ export const baseExamples = [{
215
199
label : 'Date Picker' ,
216
200
name : 'date-picker' ,
217
201
} ] } ,
218
- variants : [ {
202
+ variants : [ ... formGroupVariants , {
219
203
name : 'label' ,
220
204
title : 'Label' ,
221
205
component : 'input' ,
@@ -251,7 +235,7 @@ export const baseExamples = [{
251
235
label : 'Time Picker' ,
252
236
name : 'time-picker' ,
253
237
} ] } ,
254
- variants : [ {
238
+ variants : [ ... formGroupVariants , {
255
239
name : 'label' ,
256
240
title : 'Label' ,
257
241
component : 'input' ,
@@ -351,10 +335,7 @@ export const baseExamples = [{
351
335
{ label : 'Hamsters' , value : '3' } ,
352
336
] ,
353
337
} ] } ,
354
- variants : [ {
355
- name : 'isDisabled' ,
356
- title : 'Disabled' ,
357
- } , {
338
+ variants : [ ...formGroupVariants , {
358
339
name : 'label' ,
359
340
title : 'Label' ,
360
341
component : 'input' ,
0 commit comments