Skip to content

Commit 6d0809b

Browse files
Merge pull request #5 from CodeWithDennis/add-hidden-input-icon
Add hidden input icon
2 parents e794aa6 + 67894b5 commit 6d0809b

5 files changed

Lines changed: 28 additions & 24 deletions

File tree

resources/views/checkbox-cards.blade.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,8 @@ class="fi-fo-checkbox-list-option group relative flex rounded-lg border border-g
180180
/>
181181
@endif
182182
@if($hiddenInputs)
183-
<svg class="invisible size-5 text-custom-600 dark:text-custom-500 group-has-checked:visible absolute top-2 right-2" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon">
184-
<path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z" clip-rule="evenodd" />
185-
</svg>
183+
<x-filament::icon :icon="$getHiddenInputIcon()"
184+
class="invisible size-5 text-custom-600 dark:text-custom-500 group-has-checked:visible absolute top-2 right-2" />
186185
@endif
187186
</label>
188187
</div>

resources/views/checkbox-stacked-cards.blade.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,8 @@ class="fi-fo-checkbox-list-option group relative block rounded-lg border border-
188188
@endif
189189
</div>
190190
@if($hiddenInputs)
191-
<svg class="invisible size-5 text-custom-600 dark:text-custom-500 group-has-checked:visible absolute top-2 right-2" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon">
192-
<path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z" clip-rule="evenodd" />
193-
</svg>
191+
<x-filament::icon :icon="$getHiddenInputIcon()"
192+
class="invisible size-5 text-custom-600 dark:text-custom-500 group-has-checked:visible absolute top-2 right-2" />
194193
@endif
195194
</label>
196195
</div>

resources/views/radio-cards.blade.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class="fi-fo-checkbox-list-option group relative flex rounded-lg border border-g
9090
->class([
9191
'absolute inset-0 appearance-none focus:outline-none',
9292
])
93-
}} />
93+
}} />
9494
@endif
9595
<div class="fi-fo-checkbox-list-option-text flex-1">
9696
<span
@@ -119,15 +119,11 @@ class="fi-fo-checkbox-list-option-extra mt-6 block text-sm font-medium text-gray
119119
'fi-valid' => !$errors->has($statePath),
120120
'fi-invalid' => $errors->has($statePath),
121121
])
122-
}} style="{{ $colors }}" />
122+
}} style="{{ $colors }}" />
123123
@endif
124124
@if($hiddenInputs)
125-
<svg class="invisible size-5 text-custom-600 dark:text-custom-500 group-has-checked:visible absolute top-2 right-2"
126-
viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon">
127-
<path fill-rule="evenodd"
128-
d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z"
129-
clip-rule="evenodd" />
130-
</svg>
125+
<x-filament::icon :icon="$getHiddenInputIcon()"
126+
class="invisible size-5 text-custom-600 dark:text-custom-500 group-has-checked:visible absolute top-2 right-2" />
131127
@endif
132128
</label>
133129
</div>
@@ -141,4 +137,4 @@ class="fi-fo-checkbox-list-no-search-results-message">
141137
</div>
142138
@endif
143139
</div>
144-
</x-dynamic-component>
140+
</x-dynamic-component>

resources/views/radio-stacked-cards.blade.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class="fi-fo-checkbox-list-option group relative flex rounded-lg border border-g
9292
->class([
9393
'absolute inset-0 appearance-none focus:outline-none',
9494
])
95-
}} />
95+
}} />
9696
@endif
9797
<div class="fi-fo-checkbox-list-option-text flex-1">
9898
<span
@@ -121,15 +121,11 @@ class="fi-fo-checkbox-list-option-extra mt-6 block text-sm font-medium text-gray
121121
'fi-valid' => !$errors->has($statePath),
122122
'fi-invalid' => $errors->has($statePath),
123123
])
124-
}} style="{{ $colors }}" />
124+
}} style="{{ $colors }}" />
125125
@endif
126126
@if($hiddenInputs)
127-
<svg class="invisible size-5 text-custom-600 dark:text-custom-500 group-has-checked:visible absolute top-2 right-2"
128-
viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon">
129-
<path fill-rule="evenodd"
130-
d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z"
131-
clip-rule="evenodd" />
132-
</svg>
127+
<x-filament::icon :icon="$getHiddenInputIcon()"
128+
class="invisible size-5 text-custom-600 dark:text-custom-500 group-has-checked:visible absolute top-2 right-2" />
133129
@endif
134130
</label>
135131
</div>
@@ -143,4 +139,4 @@ class="fi-fo-checkbox-list-no-search-results-message">
143139
</div>
144140
@endif
145141
</div>
146-
</x-dynamic-component>
142+
</x-dynamic-component>

src/Filament/Forms/Components/Concerns/HasHiddenInputs.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ trait HasHiddenInputs
1010
{
1111
protected bool | Closure $hiddenInputs = false;
1212

13+
protected string | \BackedEnum | \Closure | null $hiddenInputIcon = null;
14+
1315
public function hiddenInputs(bool | Closure $condition = true): static
1416
{
1517
$this->hiddenInputs = $condition;
@@ -28,4 +30,16 @@ public function getHiddenInputs(): bool
2830
{
2931
return $this->evaluate($this->hiddenInputs);
3032
}
33+
34+
public function hiddenInputIcon(string | \BackedEnum | \Closure | null $icon): static
35+
{
36+
$this->hiddenInputIcon = $icon;
37+
38+
return $this;
39+
}
40+
41+
public function getHiddenInputIcon(): string | \BackedEnum | null
42+
{
43+
return $this->evaluate($this->hiddenInputIcon);
44+
}
3145
}

0 commit comments

Comments
 (0)