Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for select and checkbox inputs styling with Bootstrap 5 theme #864

Merged
merged 2 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion resources/views/components/table/td/bulk-actions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class="rounded border-gray-300 text-indigo-600 shadow-sm transition duration-150
/>
</div>
</x-livewire-tables::table.td.plain>
@elseif ($theme === 'bootstrap-4' || $theme === 'bootstrap-5')
@elseif ($theme === 'bootstrap-4')
<x-livewire-tables::table.td.plain>
<input
wire:model="selected"
Expand All @@ -27,5 +27,17 @@ class="rounded border-gray-300 text-indigo-600 shadow-sm transition duration-150
type="checkbox"
/>
</x-livewire-tables::table.td.plain>
@elseif ($theme === 'bootstrap-5')
<x-livewire-tables::table.td.plain>
<div class="form-check">
<input
wire:model="selected"
wire:loading.attr.delay="disabled"
value="{{ $row->{$this->getPrimaryKey()} }}"
type="checkbox"
class="form-check-input"
/>
</div>
</x-livewire-tables::table.td.plain>
@endif
@endif
12 changes: 11 additions & 1 deletion resources/views/components/table/th/bulk-actions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@ class="rounded border-gray-300 text-indigo-600 shadow-sm transition duration-150
/>
</div>
</x-livewire-tables::table.th.plain>
@elseif ($theme === 'bootstrap-4' || $theme === 'bootstrap-5')
@elseif ($theme === 'bootstrap-4')
<x-livewire-tables::table.th.plain>
<input
wire:model="selectAll"
type="checkbox"
/>
</x-livewire-tables::table.th.plain>
@elseif ($theme === 'bootstrap-5')
<x-livewire-tables::table.th.plain>
<div class="form-check">
<input
wire:model="selectAll"
type="checkbox"
class="form-check-input"
/>
</div>
</x-livewire-tables::table.th.plain>
@endif
@endif
2 changes: 1 addition & 1 deletion resources/views/components/tools/filters/select.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class="block w-full border-gray-300 rounded-md shadow-sm transition duration-150
wire:model.stop="{{ $component->getTableName() }}.filters.{{ $filter->getKey() }}"
wire:key="{{ $component->getTableName() }}-filter-{{ $filter->getKey() }}"
id="{{ $component->getTableName() }}-filter-{{ $filter->getKey() }}"
class="form-control"
class="{{ $theme === 'bootstrap-4' ? 'form-control' : 'form-select' }}"
>
@foreach($filter->getOptions() as $key => $value)
<option value="{{ $key }}">{{ $value }}</option>
Expand Down
76 changes: 40 additions & 36 deletions resources/views/components/tools/toolbar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,21 @@ class="inline-flex justify-center w-full rounded-md border border-gray-300 shado
@endif
>
@lang('Filters')

@if ($count = $component->getFilterBadgeCount())
<span class="ml-1 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium leading-4 bg-indigo-100 text-indigo-800 capitalize dark:bg-indigo-200 dark:text-indigo-900">
{{ $count }}
</span>
@endif

<svg class="-mr-1 ml-2 h-5 w-5" xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" />
</svg>
</button>
</div>

@if ($component->isFilterLayoutPopover())
<div
x-cloak
Expand All @@ -113,7 +113,7 @@ class="origin-top-left absolute left-0 mt-2 w-full md:w-56 rounded-md shadow-lg
class="block text-sm font-medium leading-5 text-gray-700 dark:text-white">
{{ $filter->getName() }}
</label>

{{ $filter->render($component) }}
</div>
</div>
Expand Down Expand Up @@ -225,14 +225,14 @@ class="inline-flex justify-center px-4 py-2 w-full text-sm font-medium text-gray
aria-expanded="true"
>
@lang('Columns')

<svg class="-mr-1 ml-2 w-5 h-5" x-description="Heroicon name: chevron-down" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path>
</svg>
</button>
</span>
</div>

<div
x-cloak
x-show="open"
Expand Down Expand Up @@ -413,13 +413,13 @@ class="btn dropdown-toggle d-block w-100 d-md-inline"
@endif
>
@lang('Filters')

@if ($count = $component->getFilterBadgeCount())
<span class="badge badge-info">
{{ $count }}
</span>
@endif

<span class="caret"></span>
</button>
</div>
Expand Down Expand Up @@ -675,13 +675,13 @@ class="btn dropdown-toggle d-block w-100 d-md-inline"
@endif
>
@lang('Filters')

@if ($count = $component->getFilterBadgeCount())
<span class="badge bg-info">
{{ $count }}
</span>
@endif

<span class="caret"></span>
</button>
</div>
Expand Down Expand Up @@ -780,41 +780,45 @@ class="dropdown-menu dropdown-menu-end w-100"
x-bind:class="{'show' : open}"
aria-labelledby="columnSelect-{{ $component->getTableName() }}"
>
<div>
<div class="form-check ms-2">
<input
@if($component->allDefaultVisibleColumnsAreSelected())
checked
wire:click="deselectAllColumns"
@else
unchecked
wire:click="selectAllColumns"
@endif
wire:loading.attr="disabled"
type="checkbox"
class="form-check-input"
/>
<label
wire:loading.attr="disabled"
class="px-2 mb-1"
class="form-check-label"
>
<input
@if($component->allDefaultVisibleColumnsAreSelected())
checked
wire:click="deselectAllColumns"
@else
unchecked
wire:click="selectAllColumns"
@endif
wire:loading.attr="disabled"
type="checkbox"
/>
<span class="ml-2">{{ __('All Columns') }}</span>
{{ __('All Columns') }}
</label>
</div>
@foreach($component->getColumns() as $column)
@if ($column->isVisible() && $column->isSelectable())
<div wire:key="columnSelect-{{ $loop->index }}-{{ $component->getTableName() }}">
<div wire:key="columnSelect-{{ $loop->index }}-{{ $component->getTableName() }}"
class="form-check ms-2"
>
<input
wire:model="selectedColumns"
wire:target="selectedColumns"
wire:loading.attr="disabled"
type="checkbox"
class="form-check-input"
value="{{ $column->getSlug() }}"
/>
<label
wire:loading.attr="disabled"
wire:target="selectedColumns"
class="px-2 {{ $loop->last ? 'mb-0' : 'mb-1' }}"
>
<input
wire:model="selectedColumns"
wire:target="selectedColumns"
wire:loading.attr="disabled"
type="checkbox"
value="{{ $column->getSlug() }}"
/>
<span class="ml-2">{{ $column->getTitle() }}</span>
class="{{ $loop->last ? 'mb-0' : 'mb-1' }} form-check-label"
>{{ $column->getTitle() }}</label>

</label>
</div>
@endif
Expand All @@ -829,7 +833,7 @@ class="px-2 {{ $loop->last ? 'mb-0' : 'mb-1' }}"
<select
wire:model="perPage"
id="perPage"
class="form-control"
class="form-select"
>
@foreach ($component->getPerPageAccepted() as $item)
<option value="{{ $item }}" wire:key="per-page-{{ $item }}-{{ $component->getTableName() }}">{{ $item === -1 ? __('All') : $item }}</option>
Expand Down