-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for
hide_display
property
- Loading branch information
Showing
13 changed files
with
134 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
<fieldset class="flex flex-col gap-y-3"> | ||
<div> | ||
<fieldset> | ||
<div class="flex flex-col gap-y-3"> | ||
@formView('messages.legend') | ||
|
||
@if($field->instructions && $field->instructions_position === 'above') | ||
@formView('messages.instructions') | ||
@endif | ||
</div> | ||
|
||
<div class="{{ $field->inline ? 'flex items-start flex-wrap gap-x-6 gap-y-2' : 'flex flex-col gap-y-2' }}"> | ||
@foreach($field->options as $option => $label) | ||
<div wire:key="{{ $field->id }}-{{ $option }}" class="flex items-start gap-x-3"> | ||
<div class="flex items-center h-5"> | ||
<input | ||
id="{{ $field->id }}-{{ $option }}" | ||
name="{{ $field->id }}" | ||
value="{{ $option }}" | ||
type="checkbox" | ||
<div class="{{ $field->inline ? 'flex items-start flex-wrap gap-x-6 gap-y-2' : 'flex flex-col gap-y-2' }}"> | ||
@foreach($field->options as $option => $label) | ||
<div wire:key="{{ $field->id }}-{{ $option }}" class="flex items-start gap-x-3"> | ||
<div class="flex items-center h-5"> | ||
<input | ||
id="{{ $field->id }}-{{ $option }}" | ||
name="{{ $field->id }}" | ||
value="{{ $option }}" | ||
type="checkbox" | ||
|
||
@if($field->wire_model) | ||
wire:model.{{ $field->wire_model }}="{{ $field->key }}" | ||
@else | ||
wire:model="{{ $field->key }}" | ||
@endif | ||
@if($field->wire_model) | ||
wire:model.{{ $field->wire_model }}="{{ $field->key }}" | ||
@else | ||
wire:model="{{ $field->key }}" | ||
@endif | ||
|
||
@if(! $errors->has($field->key)) | ||
class="w-4 h-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500" | ||
@if($field->instructions) | ||
aria-describedby="{{ $field->id }}-instructions" | ||
@if(! $errors->has($field->key)) | ||
class="w-4 h-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500" | ||
@if($field->instructions) | ||
aria-describedby="{{ $field->id }}-instructions" | ||
@endif | ||
@else | ||
class="w-4 h-4 text-indigo-600 border-red-300 rounded focus:ring-red-500" | ||
aria-invalid="true" | ||
aria-describedby="{{ $field->id }}-error" | ||
@endif | ||
@else | ||
class="w-4 h-4 text-indigo-600 border-red-300 rounded focus:ring-red-500" | ||
aria-invalid="true" | ||
aria-describedby="{{ $field->id }}-error" | ||
@endif | ||
/> | ||
</div> | ||
/> | ||
</div> | ||
|
||
<div class="text-sm leading-5"> | ||
<label | ||
for="{{ $field->id }}-{{ $option }}" | ||
class="font-medium {{ $errors->has($field->key) ? 'text-red-800' : 'text-gray-900' }}" | ||
> | ||
{{ $label }} | ||
</label> | ||
<div class="text-sm leading-5"> | ||
<label | ||
for="{{ $field->id }}-{{ $option }}" | ||
class="font-medium {{ $errors->has($field->key) ? 'text-red-800' : 'text-gray-900' }}" | ||
> | ||
{{ $label }} | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
@endforeach | ||
</div> | ||
@endforeach | ||
</div> | ||
|
||
@if($errors->has($field->key)) | ||
@formView('messages.error') | ||
@elseif($field->instructions && $field->instructions_position === 'below') | ||
@formView('messages.instructions') | ||
@endif | ||
@if($errors->has($field->key)) | ||
@formView('messages.error') | ||
@elseif($field->instructions && $field->instructions_position === 'below') | ||
@formView('messages.instructions') | ||
@endif | ||
</div> | ||
</fieldset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<div class="hidden" aria-hidden="true"> | ||
<input | ||
id="{{ $this->honeypot->id }}" | ||
name="{{ $this->honeypot->id }}" | ||
type="text" | ||
wire:model="{{ $this->honeypot->key }}" | ||
tabindex="-1" | ||
autocomplete="off" | ||
/> | ||
</div> | ||
<input | ||
id="{{ $this->honeypot->id }}" | ||
name="{{ $this->honeypot->id }}" | ||
type="text" | ||
wire:model="{{ $this->honeypot->key }}" | ||
tabindex="-1" | ||
autocomplete="off" | ||
class="hidden" | ||
aria-hidden="true" | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
<fieldset class="flex flex-col gap-y-3"> | ||
<div> | ||
<fieldset> | ||
<div class="flex flex-col gap-y-3"> | ||
@formView('messages.legend') | ||
|
||
@if($field->instructions && $field->instructions_position === 'above') | ||
@formView('messages.instructions') | ||
@endif | ||
</div> | ||
|
||
<div class="{{ $field->inline ? 'flex items-start flex-wrap gap-x-6 gap-y-2' : 'flex flex-col gap-y-2' }}"> | ||
@foreach($field->options as $option => $label) | ||
<div wire:key="{{ $field->id }}-{{ $option }}" class="flex items-start gap-x-3"> | ||
<div class="flex items-center h-5"> | ||
<input | ||
id="{{ $field->id }}-{{ $option }}" | ||
name="{{ $field->id }}" | ||
value="{{ $option }}" | ||
type="radio" | ||
<div class="{{ $field->inline ? 'flex items-start flex-wrap gap-x-6 gap-y-2' : 'flex flex-col gap-y-2' }}"> | ||
@foreach($field->options as $option => $label) | ||
<div wire:key="{{ $field->id }}-{{ $option }}" class="flex items-start gap-x-3"> | ||
<div class="flex items-center h-5"> | ||
<input | ||
id="{{ $field->id }}-{{ $option }}" | ||
name="{{ $field->id }}" | ||
value="{{ $option }}" | ||
type="radio" | ||
|
||
@if($field->wire_model) | ||
wire:model.{{ $field->wire_model }}="{{ $field->key }}" | ||
@else | ||
wire:model="{{ $field->key }}" | ||
@endif | ||
@if($field->wire_model) | ||
wire:model.{{ $field->wire_model }}="{{ $field->key }}" | ||
@else | ||
wire:model="{{ $field->key }}" | ||
@endif | ||
|
||
@if(! $errors->has($field->key)) | ||
class="w-4 h-4 text-indigo-600 border-gray-300 focus:ring-indigo-500" | ||
@if($field->instructions) | ||
aria-describedby="{{ $field->id }}-instructions" | ||
@if(! $errors->has($field->key)) | ||
class="w-4 h-4 text-indigo-600 border-gray-300 focus:ring-indigo-500" | ||
@if($field->instructions) | ||
aria-describedby="{{ $field->id }}-instructions" | ||
@endif | ||
@else | ||
class="w-4 h-4 text-indigo-600 border-red-300 focus:ring-red-500" | ||
aria-invalid="true" | ||
aria-describedby="{{ $field->id }}-error" | ||
@endif | ||
@else | ||
class="w-4 h-4 text-indigo-600 border-red-300 focus:ring-red-500" | ||
aria-invalid="true" | ||
aria-describedby="{{ $field->id }}-error" | ||
@endif | ||
/> | ||
</div> | ||
/> | ||
</div> | ||
|
||
<div class="text-sm leading-5"> | ||
<label | ||
for="{{ $field->id }}-{{ $option }}" | ||
class="font-medium {{ $errors->has($field->key) ? 'text-red-800' : 'text-gray-900' }}" | ||
> | ||
{{ $label }} | ||
</label> | ||
<div class="text-sm leading-5"> | ||
<label | ||
for="{{ $field->id }}-{{ $option }}" | ||
class="font-medium {{ $errors->has($field->key) ? 'text-red-800' : 'text-gray-900' }}" | ||
> | ||
{{ $label }} | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
@endforeach | ||
</div> | ||
@endforeach | ||
</div> | ||
|
||
@if($errors->has($field->key)) | ||
@formView('messages.error') | ||
@elseif($field->instructions && $field->instructions_position === 'below') | ||
@formView('messages.instructions') | ||
@endif | ||
@if($errors->has($field->key)) | ||
@formView('messages.error') | ||
@elseif($field->instructions && $field->instructions_position === 'below') | ||
@formView('messages.instructions') | ||
@endif | ||
</div> | ||
</fieldset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<label | ||
for="{{ $field->id }}" | ||
id="{{ $field->id }}-label" | ||
class="block text-sm font-medium text-gray-700" | ||
class="{{ $field->hide_display ? 'sr-only' : 'block text-sm font-medium text-gray-700 [&_+_p]:-mt-2' }}" | ||
> | ||
{{ $field->display }} | ||
</label> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
@if($field->instructions) | ||
<p id="{{ $field->id }}-instructions" class="text-[13px] text-gray-500">{{ $field->instructions }}</p> | ||
<p id="{{ $field->id }}-instructions" class="text-[13px] text-gray-500"> | ||
{{ $field->instructions }} | ||
</p> | ||
@endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<legend | ||
id="{{ $field->id }}-legend" | ||
class="text-sm font-medium text-gray-900" | ||
class="{{ $field->hide_display ? 'sr-only' : 'text-sm font-medium text-gray-900 [&_+_p]:-mt-3' }}" | ||
> | ||
{{ $field->display }} | ||
</legend> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Aerni\LivewireForms\Fields\Properties; | ||
|
||
trait WithHideDisplay | ||
{ | ||
protected function hideDisplayProperty(?bool $hideDisplay = null): bool | ||
{ | ||
return $hideDisplay ?? (bool) $this->field->get('hide_display'); | ||
} | ||
} |