@@ -5,6 +5,22 @@ import CustomComponentText from './examples-texts/custom-component';
55import WizardText from './examples-texts/wizard' ;
66import SelectText from './examples-texts/select' ;
77
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+
824export const baseExamples = [ {
925 component : componentTypes . TEXT_FIELD ,
1026 link : componentTypes . TEXT_FIELD ,
@@ -16,30 +32,21 @@ export const baseExamples = [{
1632 name : 'first-name' ,
1733 } ] } ,
1834 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+ } ] ,
4350} , {
4451 component : componentTypes . TEXTAREA_FIELD ,
4552 link : componentTypes . TEXTAREA_FIELD ,
@@ -51,26 +58,17 @@ export const baseExamples = [{
5158 label : 'Long text' ,
5259 name : 'long-text' ,
5360 } ] } ,
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+ } ] ,
7472} ,
7573{
7674 component : componentTypes . CHECKBOX ,
@@ -86,15 +84,13 @@ export const baseExamples = [{
8684 label : 'Checkbox' ,
8785 name : 'checkbox' ,
8886 } ] } ,
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+ } ] ,
9894} ,
9995{
10096 component : componentTypes . RADIO ,
@@ -112,10 +108,7 @@ export const baseExamples = [{
112108 { label : 'Hamsters' , value : '3' } ,
113109 ] ,
114110 } ] } ,
115- variants : [ {
116- name : 'isDisabled' ,
117- title : 'Disabled' ,
118- } , {
111+ variants : [ ...formGroupVariants , , {
119112 name : 'label' ,
120113 title : 'Label' ,
121114 component : 'input' ,
@@ -139,10 +132,7 @@ export const baseExamples = [{
139132 { label : 'Hamsters' , value : '3' } ,
140133 ] ,
141134 } ] } ,
142- variants : [ {
143- name : 'isDisabled' ,
144- title : 'Disabled' ,
145- } , {
135+ variants : [ ...formGroupVariants , {
146136 name : 'label' ,
147137 title : 'Label' ,
148138 component : 'input' ,
@@ -182,13 +172,7 @@ export const baseExamples = [{
182172 label : 'Switch' ,
183173 name : 'switch' ,
184174 } ] } ,
185- variants : [ {
186- name : 'isReadOnly' ,
187- title : 'Read only' ,
188- } , {
189- name : 'isDisabled' ,
190- title : 'Disabled' ,
191- } , {
175+ variants : [ ...formGroupVariants , {
192176 name : 'label' ,
193177 title : 'Label' ,
194178 component : 'input' ,
@@ -215,7 +199,7 @@ export const baseExamples = [{
215199 label : 'Date Picker' ,
216200 name : 'date-picker' ,
217201 } ] } ,
218- variants : [ {
202+ variants : [ ... formGroupVariants , {
219203 name : 'label' ,
220204 title : 'Label' ,
221205 component : 'input' ,
@@ -251,7 +235,7 @@ export const baseExamples = [{
251235 label : 'Time Picker' ,
252236 name : 'time-picker' ,
253237 } ] } ,
254- variants : [ {
238+ variants : [ ... formGroupVariants , {
255239 name : 'label' ,
256240 title : 'Label' ,
257241 component : 'input' ,
@@ -351,10 +335,7 @@ export const baseExamples = [{
351335 { label : 'Hamsters' , value : '3' } ,
352336 ] ,
353337 } ] } ,
354- variants : [ {
355- name : 'isDisabled' ,
356- title : 'Disabled' ,
357- } , {
338+ variants : [ ...formGroupVariants , {
358339 name : 'label' ,
359340 title : 'Label' ,
360341 component : 'input' ,
0 commit comments