77class FilterPillData
88{
99 public function __construct (
10- protected string $ filterPillTitle ,
11- protected string $ filterSelectName ,
12- protected string |array |null $ filterPillValue ,
13- protected string $ separator ,
14- public bool $ isAnExternalLivewireFilter ,
15- public bool $ hasCustomPillBlade ,
16- protected ?string $ customPillBlade ,
17- protected array $ filterPillsItemAttributes ,
18- protected ?string $ separatedValues ,
10+ protected string $ filterPillTitle ,
11+ protected string $ filterSelectName ,
12+ protected string |array |null $ filterPillValue ,
13+ protected string $ separator ,
14+ public bool $ isAnExternalLivewireFilter ,
15+ public bool $ hasCustomPillBlade ,
16+ protected ?string $ customPillBlade ,
17+ protected array $ filterPillsItemAttributes ,
18+ protected ?string $ separatedValues ,
1919 protected bool $ renderPillsAsHtml ,
2020 protected bool $ watchForEvents ,
21- protected array $ customResetButtonAttributes ,) {}
21+ protected array $ customResetButtonAttributes , ) {}
2222
2323 public static function make (string $ filterPillTitle , string $ filterSelectName , string |array |null $ filterPillValue , string $ separator = ', ' , bool $ isAnExternalLivewireFilter = false , bool $ hasCustomPillBlade = false , ?string $ customPillBlade = null , array $ filterPillsItemAttributes = [], ?string $ separatedValues = null , bool $ renderPillsAsHtml = false , bool $ watchForEvents = false , array $ customResetButtonAttributes = []): FilterPillData
2424 {
25- if ($ isAnExternalLivewireFilter )
26- {
25+ if ($ isAnExternalLivewireFilter ) {
2726 $ watchForEvents = true ;
2827 }
28+
2929 return new self ($ filterPillTitle , $ filterSelectName , $ filterPillValue , $ separator , $ isAnExternalLivewireFilter , $ hasCustomPillBlade , $ customPillBlade , $ filterPillsItemAttributes , $ separatedValues , $ renderPillsAsHtml , $ watchForEvents , $ customResetButtonAttributes );
3030 }
3131
@@ -109,15 +109,13 @@ public function shouldWatchForEvents(): int
109109
110110 public function getFilterPillDisplayData (): ComponentAttributeBag
111111 {
112- if ($ this ->getIsAnExternalLivewireFilter ())
113- {
112+ if ($ this ->getIsAnExternalLivewireFilter ()) {
114113 return $ this ->getExternalFilterPillDisplayData ();
115114 }
116115
117116 return $ this ->getInternalFilterPillDisplayData ();
118117 }
119118
120-
121119 public function getInternalFilterPillDisplayData (): ComponentAttributeBag
122120 {
123121 return new ComponentAttributeBag ([
@@ -134,10 +132,10 @@ public function getExternalFilterPillDisplayData(): ComponentAttributeBag
134132 ]);
135133 }
136134
137-
138135 public function getPillSetupData (string $ filterKey = '' , bool $ shouldWatch = false ): array
139136 {
140137 $ array = array_merge (['filterKey ' => $ filterKey , 'watchForEvents ' => $ shouldWatch ], $ this ->toArray ());
138+
141139 return $ array ;
142140 }
143141
@@ -148,18 +146,18 @@ public function getCustomResetButtonAttributes(): array
148146
149147 public function getCalculatedCustomResetButtonAttributes (string $ filterKey , array $ filterPillsResetFilterButtonAttributes ): array
150148 {
151- return ( array_merge (
149+ return array_merge (
152150 [
153151 'x-on:click.prevent ' => "resetSpecificFilter(' " .$ filterKey ."') " ,
154- 'type ' => " button " ,
155- 'default ' => true ,
152+ 'type ' => ' button ' ,
153+ 'default ' => true ,
156154 'default-colors ' => true ,
157- 'default-styling ' => true ,
155+ 'default-styling ' => true ,
158156 'default-text ' => true ,
159157 ],
160158 $ filterPillsResetFilterButtonAttributes ,
161159 $ this ->getCustomResetButtonAttributes ()
162- )) ;
160+ );
163161 }
164162
165163 public function toArray (): array
0 commit comments