@@ -24,6 +24,7 @@ public function boot()
24
24
'group_errors ' => 'd-none ' ,
25
25
'label ' => '' ,
26
26
'input ' => 'form-control ' ,
27
+
27
28
'checkbox ' => 'custom-control-input ' ,
28
29
'checkbox_label ' => 'custom-control-label ' ,
29
30
'checkbox_wrapper ' => 'custom-control custom-checkbox ' ,
@@ -66,47 +67,76 @@ public function boot()
66
67
'group_help_text ' => 'invalid-feedback d-block ' ,
67
68
],
68
69
],
70
+ 'variant_classes ' => [
71
+ 'input ' => [
72
+ 'default ' => 'form-control ' ,
73
+ 'sm ' => 'form-control-sm ' ,
74
+ 'lg ' => 'form-control-lg ' ,
75
+ ],
76
+ 'group_input_group ' => [
77
+ 'default ' => 'input-group ' ,
78
+ 'sm ' => 'input-group-sm ' ,
79
+ 'lg ' => 'input-group-lg ' ,
80
+ ],
81
+ 'group_input_range ' => [
82
+ 'default ' => [
83
+ 'display ' => 'range-default '
84
+ ]
85
+ ],
86
+ 'select ' => [
87
+ 'default ' => [
88
+ 'display ' => 'custom-select ' ,
89
+ 'size ' => '' ,
90
+ 'color ' => '' ,
91
+ ],
92
+ 'sm ' => 'custom-select-sm ' ,
93
+ 'lg ' => 'custom-select-lg ' ,
94
+ ],
95
+ 'button ' => [
96
+ 'default ' => [
97
+ 'display ' => 'btn ' ,
98
+ 'size ' => '' ,
99
+ 'color ' => 'btn-primary ' ,
100
+ ],
101
+ 'sm ' => [
102
+ 'size ' => 'btn-sm ' ,
103
+ ],
104
+ 'lg ' => [
105
+ 'size ' => 'btn-sm ' ,
106
+ ],
107
+ 'primary ' => [
108
+ 'color ' => 'btn-primary '
109
+ ],
110
+ 'secondary ' => [
111
+ 'color ' => 'btn-secondary '
112
+ ],
113
+ 'success ' => [
114
+ 'color ' => 'btn-success '
115
+ ],
116
+ 'danger ' => [
117
+ 'color ' => 'btn-danger '
118
+ ],
119
+ 'warning ' => [
120
+ 'color ' => 'btn-warning '
121
+ ],
122
+ 'info ' => [
123
+ 'color ' => 'btn-info '
124
+ ],
125
+ 'light ' => [
126
+ 'color ' => 'btn-light '
127
+ ],
128
+ 'dark ' => [
129
+ 'color ' => 'btn-dark '
130
+ ],
131
+ ]
132
+ ]
69
133
]);
70
134
71
135
Checkbox::registerElementMutator (function (Checkbox $ checkbox ) {
72
136
$ checkbox ->group ->addClass ('custom-control custom-checkbox ' );
73
137
});
74
138
75
139
Input::registerElementMutator (function (Input $ input ) {
76
- $ input ->attributes ->registerMutator ('class ' , function (ClassNames $ classNames ) use ($ input ) {
77
- if (in_array ($ input ->getViewData ('variant ' ), ['sm ' , 'small ' ])) {
78
- $ classNames ->add ('form-control-sm ' );
79
- }
80
-
81
- if (in_array ($ input ->getViewData ('variant ' ), ['lg ' , 'large ' ])) {
82
- $ classNames ->add ('form-control-lg ' );
83
- }
84
-
85
- return $ classNames ;
86
- });
87
-
88
- $ input ->group ->attributes ->input_group ->registerMutator ('class ' , function (ClassNames $ classNames ) use ($ input ) {
89
-
90
- if ($ input ->attributes ->primary ()->class ->has ('form-control-sm ' )) {
91
- $ classNames ->add ('input-group-sm ' );
92
- }
93
-
94
- if ($ input ->attributes ->primary ()->class ->has ('form-control-lg ' )) {
95
- $ classNames ->add ('input-group-lg ' );
96
- }
97
-
98
- if (in_array ($ input ->getViewData ('variant ' ), ['sm ' , 'small ' ])) {
99
- $ classNames ->add ('input-group-sm ' );
100
- }
101
-
102
- if (in_array ($ input ->getViewData ('variant ' ), ['lg ' , 'large ' ])) {
103
- $ classNames ->add ('input-group-lg ' );
104
- }
105
-
106
-
107
- return $ classNames ;
108
- });
109
-
110
140
$ input ->attributes ->registerMutator ('class ' , function (ClassNames $ classNames ) use ($ input ) {
111
141
112
142
if ('range ' === $ input ->attributes ->get ('type ' )) {
0 commit comments