support for passworded files
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
'outline' => 'hover:bg-gray-500 focus-visible:outline-primary-color text-gray-800 border border-gray-400 bg-white hover:text-white',
|
||||
'primary' => 'hover:bg-primary-color-dark focus-visible:outline-primary-color bg-primary-color text-white',
|
||||
'primary-outline' => 'hover:bg-primary-color-dark focus-visible:outline-primary-color text-primary-color border border-primary-color bg-white hover:text-white',
|
||||
'primary-outline-sm' => '!font-normal !text-xs !px-4 !py-1 hover:bg-primary-color-dark focus-visible:outline-primary-color text-primary-color border border-primary-color bg-white hover:text-white',
|
||||
'danger' => 'hover:bg-danger-color-dark focus-visible:outline-danger-color bg-danger-color text-white',
|
||||
'success' => 'hover:bg-success-color-dark focus-visible:outline-success-color bg-success-color text-white'
|
||||
][$color];
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
@props(['name', 'label', 'checked' => false])
|
||||
@props(['name', 'label', 'checked' => false, 'small' => false])
|
||||
|
||||
@php
|
||||
$checkBoxClasses = '';
|
||||
$labelClasses = '';
|
||||
if($small) {
|
||||
$checkBoxClasses = 'h-6 w-6 rounded-md text-xs';
|
||||
$labelClasses = 'pl-1 text-xs';
|
||||
}
|
||||
@endphp
|
||||
|
||||
<style>
|
||||
input[type="checkbox"]:checked {
|
||||
@@ -9,15 +18,24 @@
|
||||
width: 0.6rem;
|
||||
border-width: 0 0.25rem 0.25rem 0;
|
||||
border-style: solid;
|
||||
border-color: #000;
|
||||
border-color: #0370A1;
|
||||
transform: rotate(40deg) translateY(-0.2rem) translateX(0.65rem);
|
||||
}
|
||||
}
|
||||
|
||||
input.text-xs[type="checkbox"]:checked {
|
||||
&:after {
|
||||
height: 1rem;
|
||||
width: 0.55rem;
|
||||
border-width: 0 0.225rem 0.225rem 0;
|
||||
transform: rotate(40deg) translateY(-0.2rem) translateX(0.4rem);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="mb-4">
|
||||
<div class="{{ twMerge(['mb-4'], $attributes->get('class')) }}">
|
||||
<div class="flex items-center">
|
||||
<input class="{{ twMerge(['bg-white','mt-1','h-8','w-8','rounded-lg','border','border-gray-300','appearance-none','focus:outline-none','focus:ring-0','focus:border-blue-600','peer','focus:ring-indigo-300'], $classes ?? '') }}" type="checkbox" {{ $checked ? 'checked' : '' }} id="{{ $name }}" name="{{ $name }}" {{ $attributes }} />
|
||||
<label for="{{ $name }}" class="text-sm pl-2 pt-1">{{ $label }}</label>
|
||||
<input class="{{ twMerge(['bg-white','mt-1','h-8','w-8','rounded-lg','border','border-gray-300','appearance-none','focus:outline-none','focus:ring-0','focus:border-blue-600','peer','focus:ring-indigo-300'], $checkBoxClasses ?? '') }}" type="checkbox" {{ $checked ? 'checked' : '' }} id="{{ $name }}" name="{{ $name }}" {{ $attributes }} />
|
||||
<label for="{{ $name }}" class="{{ twMerge(['text-sm','pl-2','pt-1'], $labelClasses ?? '') }}">{{ $label }}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
37
resources/views/components/ui/password.blade.php
Normal file
37
resources/views/components/ui/password.blade.php
Normal file
@@ -0,0 +1,37 @@
|
||||
@props(['name', 'label' => '', 'value' => '', 'error' => null])
|
||||
|
||||
@php
|
||||
if($error === null) {
|
||||
$error = $errors->first($name);
|
||||
}
|
||||
|
||||
$hasError = $error !== '';
|
||||
$classes = 'disabled:bg-gray-100 bg-white block px-2.5 pb-2.5 w-full text-sm text-gray-900 rounded-lg border appearance-nonefocus:outline-none focus:ring-0 focus:border-blue-600 ' . ($hasError ? 'border-red-600 ring-red-600 focus:border-red-600 focus:ring-red-600' : 'border-gray-300 focus:border-indigo-300 focus:ring-indigo-300');
|
||||
|
||||
$label = ($value === '' ? '' : 'Change ') . $label;
|
||||
@endphp
|
||||
|
||||
<div class="{{ twMerge(['mb-4'], $attributes->get('class')) }}">
|
||||
<div>
|
||||
<label for="{{ $name }}" class="block text-sm pl-1 pr-4">
|
||||
{{ $label }}
|
||||
@if($value !== '')
|
||||
<span class="ml-3 text-xs text-gray-500">(Password has been set)</span>
|
||||
@else
|
||||
<span class="ml-3 text-xs text-gray-500">(No password has been set)</span>
|
||||
@endif
|
||||
</label>
|
||||
<div class="flex items-center gap-4">
|
||||
<input class="{{ twMerge(['pt-2.5','mt-1'], $classes) }}" autocomplete="off" placeholder=" " value="" type="password" id="{{ $name }}_password" name="{{ $name }}" {{ $attributes }} />
|
||||
@if($value !== '')
|
||||
<x-ui.checkbox label="Clear" id="{{ $name }}_clear" name="{{ $name }}_clear" class="mb-0" small="true" />
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@if(isset($info) && $info !== '')
|
||||
<div class="text-xs text-gray-500 ml-2 mt-1">{{ $info }}</div>
|
||||
@endif
|
||||
@if ($hasError)
|
||||
<div class="text-xs text-red-600 ml-2 mt-2">{{ $error }}</div>
|
||||
@endif
|
||||
</div>
|
||||
Reference in New Issue
Block a user