Commit 0f9f70f 1 parent d0431c3 commit 0f9f70f Copy full SHA for 0f9f70f
File tree 5 files changed +31
-10
lines changed
5 files changed +31
-10
lines changed Original file line number Diff line number Diff line change 70
70
'default_classes ' => [
71
71
'input ' => 'text-grey-darkest bg-white border rounded-sm ' ,
72
72
'summary ' => 'border border-red bg-red-lightest text-red font-bold rounded p-4 my-4 ' ,
73
+ 'button ' => 'inline-block font-normal text-center whitespace-no-wrap align-middle select-none border
74
+ rounded font-normal leading-normal text-white bg-blue-dark border-blue-darker hover:bg-blue-darker
75
+ hover:border-blue-darkest p-2 px-4 ' ,
73
76
],
74
77
75
78
/*
Original file line number Diff line number Diff line change @@ -103,7 +103,13 @@ public function __toString()
103
103
*/
104
104
protected function defaults () : ?string
105
105
{
106
- return Arr::get (static ::$ default_classes , $ this ->element ->name );
106
+ $ key = $ this ->element ->name ;
107
+
108
+ if ('textarea ' === $ key && !Arr::has (static ::$ default_classes , 'textarea ' )) {
109
+ $ key = 'input ' ;
110
+ }
111
+
112
+ return Arr::get (static ::$ default_classes , $ key );
107
113
}
108
114
109
115
/**
@@ -113,13 +119,19 @@ protected function defaults() : ?string
113
119
*/
114
120
protected function validation () : ?string
115
121
{
122
+ $ element_key = $ this ->element ->name ;
123
+
124
+ if ('textarea ' === $ element_key && !Arr::has (static ::$ validation_classes , 'textarea ' )) {
125
+ $ element_key = 'input ' ;
126
+ }
127
+
116
128
if ($ this ->element ->group ) {
117
- $ key = "{$ this ->element ->group ->validation_state }. {$ this -> element -> name }" ;
129
+ $ key = "{$ this ->element ->group ->validation_state }. {$ element_key }" ;
118
130
return Arr::get (static ::$ validation_classes , $ key );
119
131
}
120
132
121
133
if ($ this ->element instanceof Group) {
122
- $ key = "{$ this ->element ->validation_state }. {$ this -> element -> name }" ;
134
+ $ key = "{$ this ->element ->validation_state }. {$ element_key }" ;
123
135
return Arr::get (static ::$ validation_classes , $ key );
124
136
}
125
137
Original file line number Diff line number Diff line change @@ -276,6 +276,15 @@ public function delete() : self
276
276
return $ this ;
277
277
}
278
278
279
+ public function method ($ method = null )
280
+ {
281
+ if (method_exists ($ this , strtolower ($ method ))) {
282
+ return $ this ->$ method ();
283
+ }
284
+
285
+ return parent ::method ($ method );
286
+ }
287
+
279
288
/**
280
289
* Enable client-side validation
281
290
*
Original file line number Diff line number Diff line change 2
2
3
3
<button
4
4
{{ $attributes -> except (' class' ) } }
5
- class =" inline-block font-normal text-center whitespace-no-wrap align-middle select-none border
6
- rounded font-normal leading-normal text-white bg-blue-dark border-blue-darker
7
- hover:bg-blue-darker hover:border-blue-darkest
8
- p-2 px-4 {{ $class } }"
5
+ class =" {{ $class } }"
9
6
>
10
7
11
8
{{ $slot } }
Original file line number Diff line number Diff line change 1
1
<?php /** @var \Galahad\Aire\Elements\Attributes\Attributes $attributes */ ? >
2
2
3
- <textarea {{ $attributes -> except ( ' class ' , ' value ' ) } }
4
- class = " h-auto block w-full p-2 text-base leading-normal text-grey-darkest
5
- bg-white border rounded-sm {{ $class } }" >{{ $value ?? null } } </textarea >
3
+ <textarea
4
+ {{ $attributes -> except ( ' class ' , ' value ' ) } }
5
+ class = " h-auto w-full p-2 text-base leading-normal {{ $class } }" >{{ $value ?? null } } </textarea >
You can’t perform that action at this time.
0 commit comments