UI stuffs
This commit is contained in:
@@ -1,46 +1,18 @@
|
||||
@props([
|
||||
'type' => $attributes->get('type') ?? 'button',
|
||||
'disabled' => null,
|
||||
'confirm' => null,
|
||||
'confirmAction' => null,
|
||||
'tooltip' => null,
|
||||
])
|
||||
@isset($tooltip)
|
||||
<div class="tooltip tooltip-warning" data-tip="{{ $tooltip }}">
|
||||
@endisset
|
||||
@if ($type === 'submit')
|
||||
<button
|
||||
{{ $attributes->class(['btn btn-xs border-none no-animation normal-case text-white rounded', 'hover:bg-coolgray-400 bg-coolgray-200 h-7' => !$attributes->has('class')]) }}
|
||||
type="submit" @if ($disabled !== null) disabled @endif
|
||||
@isset($confirm)
|
||||
<button @disabled($disabled) {{ $attributes->merge(['class' => $defaultClass]) }}
|
||||
{{ $attributes->merge(['type' => 'button']) }}
|
||||
@isset($confirm)
|
||||
x-on:click="toggleConfirmModal('{{ $confirm }}', '{{ explode('(', $confirmAction)[0] }}')"
|
||||
@endisset
|
||||
@isset($confirmAction)
|
||||
@isset($confirmAction)
|
||||
x-on:{{ explode('(', $confirmAction)[0] }}.window="$wire.{{ explode('(', $confirmAction)[0] }}"
|
||||
@endisset>
|
||||
@if ($attributes->whereStartsWith('wire:click')->first())
|
||||
<span wire:target="submit" wire:loading.delay class="loading loading-spinner"></span>
|
||||
@endif
|
||||
{{ $slot }}
|
||||
</button>
|
||||
@elseif($type === 'button')
|
||||
<button
|
||||
{{ $attributes->class(['btn btn-xs border-none no-animation normal-case text-white rounded', 'hover:bg-coolgray-400 bg-coolgray-200 h-7' => !$attributes->has('class')]) }}
|
||||
@if ($disabled !== null) disabled @endif type="button"
|
||||
@isset($confirm)
|
||||
x-on:click="toggleConfirmModal('{{ $confirm }}', '{{ explode('(', $confirmAction)[0] }}')"
|
||||
@endisset
|
||||
@isset($confirmAction)
|
||||
x-on:{{ explode('(', $confirmAction)[0] }}.window="$wire.{{ explode('(', $confirmAction)[0] }}"
|
||||
@endisset>
|
||||
@if ($attributes->whereStartsWith('wire:click')->first())
|
||||
<span wire:target="{{ explode('(', $attributes->whereStartsWith('wire:click')->first())[0] }}"
|
||||
wire:loading.delay class="loading loading-spinner"></span>
|
||||
@endif
|
||||
{{ $slot }}
|
||||
</button>
|
||||
@endif
|
||||
@if ($isModal) onclick="{{ $modalId }}.showModal()" @endif>
|
||||
|
||||
@isset($tooltip)
|
||||
</div>
|
||||
@endisset
|
||||
@if ($attributes->get('type') === 'submit')
|
||||
<span wire:target="submit" wire:loading.delay class="loading loading-xs text-warning loading-spinner"></span>
|
||||
@else
|
||||
<span wire:target="{{ explode('(', $attributes->whereStartsWith('wire:click')->first())[0] }}" wire:loading.delay
|
||||
class="loading loading-xs loading-spinner"></span>
|
||||
@endif
|
||||
{{ $slot }}
|
||||
</button>
|
||||
|
||||
@@ -1,39 +1,29 @@
|
||||
@props([
|
||||
'id' => $attributes->has('id') || $attributes->has('label'),
|
||||
'required' => $attributes->has('required'),
|
||||
'label' => $attributes->has('label'),
|
||||
'helper' => $attributes->has('helper'),
|
||||
'instantSave' => $attributes->has('instantSave'),
|
||||
'noLabel' => $attributes->has('noLabel'),
|
||||
'noDirty' => $attributes->has('noDirty'),
|
||||
'disabled' => null,
|
||||
])
|
||||
<div {{ $attributes->merge(['class' => 'flex cursor-pointer label']) }}>
|
||||
<div class="flex gap-1 label-text">
|
||||
@if ($label)
|
||||
{{ $label }}
|
||||
@else
|
||||
{{ $id }}
|
||||
@endif
|
||||
@if ($helper)
|
||||
<div class="group w-fit">
|
||||
<div class="cursor-pointer text-warning">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
class="w-4 h-4 stroke-current">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="absolute hidden text-xs group-hover:block border-coolgray-400 bg-coolgray-500">
|
||||
<div class="p-4 card-body">
|
||||
{!! $helper !!}
|
||||
<div class="form-control min-w-fit">
|
||||
<label class="flex gap-4 cursor-pointer label">
|
||||
<span class="flex gap-2 label-text min-w-fit">
|
||||
@if ($label)
|
||||
{{ $label }}
|
||||
@else
|
||||
{{ $id }}
|
||||
@endif
|
||||
@if ($helper)
|
||||
<div class="group w-fit">
|
||||
<div class="cursor-pointer text-warning">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
class="w-4 h-4 stroke-current">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="absolute hidden text-xs group-hover:block border-coolgray-400 bg-coolgray-500">
|
||||
<div class="p-4 card-body">
|
||||
{!! $helper !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="flex-1"></div>
|
||||
<input type="checkbox" @if ($disabled !== null) disabled @endif name={{ $id }}
|
||||
@if (!$noDirty) wire:dirty.class="input-warning" @endif
|
||||
@if ($instantSave) wire:click='{{ $instantSave === 'instantSave' || $instantSave == '1' ? 'instantSave' : $instantSave }}' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
|
||||
@endif
|
||||
</span>
|
||||
<input @disabled($disabled) type="checkbox" {{ $attributes->merge(['class' => $defaultClass]) }}
|
||||
@if ($instantSave) wire:click='{{ $instantSave === 'instantSave' || $instantSave == '1' ? 'instantSave' : $instantSave }}' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -1,58 +1,40 @@
|
||||
<div class="w-full">
|
||||
@if ($label)
|
||||
<label class="label">
|
||||
<span class="flex gap-1 label-text">
|
||||
{{ $label }}
|
||||
@if ($required)
|
||||
<span class="text-warning">*</span>
|
||||
@endif
|
||||
@if ($helper)
|
||||
<x-helper :helper="$helper" />
|
||||
@endif
|
||||
</span>
|
||||
<label for="small-input"
|
||||
class="flex items-center gap-1 mb-2 text-sm font-medium text-neutral-400">{{ $label }}
|
||||
@if ($required)
|
||||
<span class="text-warning">*</span>
|
||||
@endif
|
||||
@if ($helper)
|
||||
<x-helper :helper="$helper" />
|
||||
@endif
|
||||
</label>
|
||||
@endif
|
||||
|
||||
<div class="w-full">
|
||||
@if ($type === 'password')
|
||||
<div class="w-full rounded join" x-data>
|
||||
<input {{ $attributes }} class="join-item" wire:model.defer={{ $id }}
|
||||
wire:dirty.class="input-warning" wire:loading.attr='disabled' @readonly($readonly)
|
||||
@disabled($disabled) type={{ $type }} id={{ $id }}
|
||||
name={{ $name }} @isset($value) value={{ $value }} @endisset
|
||||
@isset($placeholder) placeholder={{ $placeholder }} @endisset>
|
||||
@if (!$cannotPeakPassword)
|
||||
<span x-on:click="changePasswordFieldType" x-cloak @class([
|
||||
'border-l-0 border-none rounded-r no-animation h-7 btn join-item btn-xs',
|
||||
'bg-coolgray-200/50 hover:bg-coolgray-200/50 text-opacity-25' =>
|
||||
$disabled || $readonly,
|
||||
'bg-coolgray-200 hover:bg-coolgray-200' => !$disabled || !$readonly,
|
||||
])><svg
|
||||
xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 icon" viewBox="0 0 24 24"
|
||||
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
|
||||
stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
|
||||
<path
|
||||
d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6" />
|
||||
</svg>
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<input {{ $attributes }} id={{ $id }} name={{ $name }}
|
||||
wire:model.defer={{ $id }} wire:dirty.class="input-warning" wire:loading.attr='disabled'
|
||||
@readonly($readonly) @disabled($disabled)
|
||||
@isset($value) value="{{ $value }}" @endisset
|
||||
@isset($placeholder) placeholder="{{ $placeholder }}" @endisset>
|
||||
@endif
|
||||
@if (!$label && $helper)
|
||||
<x-helper :helper="$helper" />
|
||||
@endif
|
||||
@error($id)
|
||||
<label class="label">
|
||||
<span class="text-red-500 label-text-alt">{{ $message }}</span>
|
||||
</label>
|
||||
@enderror
|
||||
</div>
|
||||
@if ($type !== 'password')
|
||||
<input {{ $attributes->merge(['class' => $defaultClass]) }} @required($required)
|
||||
wire:model.defer={{ $id }} wire:dirty.class.remove='text-white'
|
||||
wire:dirty.class="text-black bg-warning" wire:loading.attr="disabled" type="{{ $type }}"
|
||||
@disabled($disabled) id="{{ $id }}" name="{{ $name }}">
|
||||
@elseif ($type === 'password')
|
||||
<div class="relative" x-data>
|
||||
@if ($allowToPeak)
|
||||
<div x-on:click="changePasswordFieldType"
|
||||
class="absolute inset-y-0 left-0 flex items-center pl-2 cursor-pointer hover:text-white">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" stroke-width="1.5"
|
||||
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
|
||||
<path d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6" />
|
||||
</svg>
|
||||
</div>
|
||||
@endif
|
||||
<input {{ $attributes->merge(['class' => $defaultClass . ' pl-10']) }} @required($required)
|
||||
wire:model.defer={{ $id }} wire:dirty.class.remove='text-white'
|
||||
wire:dirty.class="text-black bg-warning" wire:loading.attr="disabled" type="{{ $type }}"
|
||||
@disabled($disabled) id="{{ $id }}" name="{{ $name }}">
|
||||
</div>
|
||||
@endif
|
||||
@if (!$label && $helper)
|
||||
<x-helper :helper="$helper" />
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -1,43 +1,18 @@
|
||||
@props([
|
||||
'id' => null,
|
||||
'label' => null,
|
||||
'helper' => $attributes->has('helper'),
|
||||
'required' => false,
|
||||
])
|
||||
|
||||
<div {{ $attributes->merge(['class' => 'flex flex-col']) }}>
|
||||
<div class="w-full">
|
||||
@if ($label)
|
||||
<label class="label" for={{ $id }}>
|
||||
<span class="flex gap-1 label-text">
|
||||
{{ $label }}
|
||||
@if ($required)
|
||||
<span class="text-warning">*</span>
|
||||
@endif
|
||||
@if ($helper)
|
||||
<div class="group">
|
||||
<div class="cursor-pointer text-warning">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
class="w-4 h-4 stroke-current">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="absolute hidden text-xs group-hover:block border-coolgray-400 bg-coolgray-500">
|
||||
<div class="p-4 card-body">
|
||||
{!! $helper !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</span>
|
||||
<label for="small-input"
|
||||
class="flex items-center gap-1 mb-2 text-sm font-medium text-neutral-400">{{ $label }}
|
||||
@if ($required)
|
||||
<span class="text-warning">*</span>
|
||||
@endif
|
||||
@if ($helper)
|
||||
<x-helper :helper="$helper" />
|
||||
@endif
|
||||
</label>
|
||||
@endif
|
||||
<select {{ $attributes }}
|
||||
@if ($id) name={{ $id }} wire:model.defer={{ $id }} @endif>
|
||||
<select {{ $attributes->merge(['class' => $defaultClass]) }} @required($required)
|
||||
wire:dirty.class="text-black bg-warning" wire:loading.attr="disabled" name={{ $id }}
|
||||
wire:model.defer={{ $id }}>
|
||||
{{ $slot }}
|
||||
</select>
|
||||
|
||||
@error($id)
|
||||
<div class="text-red-500">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
@props([
|
||||
'id' => $attributes->has('id'),
|
||||
'label' => $attributes->has('label'),
|
||||
'required' => null,
|
||||
'disabled' => null,
|
||||
'helper' => $attributes->has('helper'),
|
||||
'noDirty' => $attributes->has('noDirty'),
|
||||
])
|
||||
|
||||
<div class=" form-control">
|
||||
<div class="form-control">
|
||||
@if ($label)
|
||||
<label class="label">
|
||||
<span class="label-text">
|
||||
@@ -38,11 +29,9 @@
|
||||
</span>
|
||||
</label>
|
||||
@endif
|
||||
<textarea {{ $attributes }}
|
||||
@if ($id) name={{ $id }} wire:model.defer={{ $id }} @endisset
|
||||
@if ($disabled !== null) disabled @endif
|
||||
@if ($required !== null) required @endif name={{ $id }} wire:model.defer={{ $value ?? $id }}
|
||||
@if (!$noDirty) wire:dirty.class="input-warning" @endif></textarea>
|
||||
<textarea {{ $attributes->merge(['class' => $defaultClass]) }} @required($required) wire:model.defer={{ $id }}
|
||||
@disabled($disabled) id="{{ $id }}" name="{{ $name }}" name={{ $id }}
|
||||
wire:model.defer={{ $value ?? $id }} wire:dirty.class="input-warning"></textarea>
|
||||
@error($id)
|
||||
<label class="label">
|
||||
<span class="text-red-500 label-text-alt">{{ $message }}</span>
|
||||
|
||||
Reference in New Issue
Block a user