v1.0.0 initial release

This commit is contained in:
samy
2025-06-13 10:48:20 -10:00
commit 0c8f70bca5
3333 changed files with 189946 additions and 0 deletions
@@ -0,0 +1,18 @@
@props([
'title' => null,
'gridLayout' => 'col-span-12 md:col-span-6',
'required' => false
])
<fieldset class="form-control {{ $gridLayout }}">
@if($title)
<legend class="label-text font-semibold mb-2">
{{ $title }}
@if ($required)
<span class="text-error">*</span>
@endif
</legend>
@endif
<div class="space-y-2">
{{ $slot }}
</div>
</fieldset>
@@ -0,0 +1,42 @@
@php($isLivewire = sk_is_livewire($attributes))
<div
@unless($isLivewire) x-data="{ checked: Boolean(@json($checked)) }" @endunless
class="form-control {{ $gridLayout }} @if($readonly) cursor-not-allowed @endif"
>
@unless($isLivewire)
<input
type="hidden"
name="{{ $name }}"
x-bind:value="checked ? 1 : 0"
/>
@endunless
<div class="flex items-center space-x-2">
<input
id="{{ $id }}"
type="checkbox"
@unless($isLivewire) x-model="checked" @endunless
@if($disabled) disabled @endif
@if($readonly) readonly @endif
@if($required) required @endif
{{ $attributes->merge(['class' => $inputClasses]) }}
/>
@if ($label)
<x-sk::form.label
for="{{ $id }}"
:required="$required"
>
{{ $label }}
</x-sk::form.label>
@endif
</div>
@if ($help)
<x-sk::form.help>{{ $help }}</x-sk::form.help>
@endif
<x-sk::form.error :name="$name" />
</div>
@@ -0,0 +1,7 @@
@props(['name'])
@error($name)
<p class="text-sm text-error mt-1">
{{ $message }}
</p>
@enderror
@@ -0,0 +1,23 @@
@props([
'method' => 'post',
'action' => null,
])
@php
$spoofed = in_array(strtolower($method), ['put', 'patch', 'delete']);
@endphp
<form method="{{ strtolower($method) === 'get' ? 'get' : 'post' }}"
action="{{ $action }}"
{{ $attributes }}>
@if(strtolower($method) !== 'get')
@csrf
@endif
@if($spoofed)
@method($method)
@endif
{{ $slot }}
</form>
@@ -0,0 +1,3 @@
<p class="mt-1 text-sm text-base-content/70 font-normal">
{{ $slot }}
</p>
@@ -0,0 +1,26 @@
@php($isLivewire = sk_is_livewire($attributes))
<div class="form-control {{ $gridLayout }} @if($readonly) cursor-not-allowed @endif">
@if ($label)
<x-sk::form.label :for="$id" :required="$required">{{ $label }}</x-sk::form.label>
@endif
<input
id="{{ $id }}"
name="{{ $name }}"
type="{{ $type }}"
placeholder="{{ $placeholder }}"
@if($required) required @endif
@if($disabled) disabled @endif
@if (! $isLivewire)
value="{{ $resolvedValue }}"
@endif
{{ $attributes->merge(['class' => $inputClasses]) }}
/>
@if ($help)
<x-sk::form.help>{{ $help }}</x-sk::form.help>
@endif
<x-sk::form.error :name="$name" />
</div>
@@ -0,0 +1,13 @@
@props([
'for',
'required' => false,
])
<label for="{{ $for }}" class="label">
<span class="label-text">
{{ $slot }}
@if ($required)
<span class="text-error">*</span>
@endif
</span>
</label>
@@ -0,0 +1,5 @@
@props(['title'])
<h2 class="card-title text-3xl font-bold">
{{ $title }}
</h2>
@@ -0,0 +1,5 @@
<div class="card bg-base-100">
<div class="card-body">
{{ $slot }}
</div>
</div>
@@ -0,0 +1,32 @@
@props([
'id',
'name',
'value',
'label',
'isLivewire',
'checked' => false,
'inline' => false,
'error' => false,
])
<label
for="{{ $id }}"
class="cursor-pointer {{ $inline ? 'inline-flex items-center gap-2' : 'flex items-center gap-2 mb-1' }}"
>
<input
type="radio"
id="{{ $id }}"
name="{{ $name }}"
value="{{ $value }}"
@if(!$isLivewire)
@checked($checked)
@else
wire:model="{{ $name }}"
@endif
@disabled($disabled ?? false)
@readonly($readonly ?? false)
@required($required ?? false)
{{ $attributes->merge(['class' => 'radio' . ($error ? ' radio-error' : '')]) }}
>
<span>{{ $label }}</span>
</label>
@@ -0,0 +1,35 @@
@php($isLivewire = sk_is_livewire($attributes))
<fieldset class="form-control {{ $gridLayout }} @if($readonly) cursor-not-allowed @endif">
@if($title)
<legend class="label-text font-semibold mb-2">
{{ $title }}
@if ($required)
<span class="text-error">*</span>
@endif
@if($help)
<x-sk::form.help>{{ $help }}</x-sk::form.help>
@endif
</legend>
@endif
@php($hasError = $errors->has($name))
<div class="space-y-2">
@foreach($options as $option => $optionLabel)
<x-sk::form.radio-option
:name="$name"
:value="$option"
:label="$optionLabel"
:inline="$inline"
:id="$getOptionId($option)"
:checked="$resolvedValue === $option"
:error="$hasError"
:$isLivewire
/>
@endforeach
</div>
<x-sk::form.error :name="$name" />
</fieldset>
@@ -0,0 +1,12 @@
@props([
'title',
'description' => null,
])
<h3 class="text-xl font-semibold mb-1">{{ $title }}</h3>
@isset($description)
<p class="text-sm text-base-content/70 mb-4">
{{ $description }}
</p>
@endisset
@@ -0,0 +1,14 @@
@props([
'title' => null,
'description' => null,
])
<div class="border-b border-base-300 pb-6 mt-3">
@if ($title)
<x-sk::form.section-title :title="$title" :description="$description" class="mb-4" />
@endif
<div class="grid grid-cols-12 gap-4">
{{ $slot }}
</div>
</div>
@@ -0,0 +1,41 @@
@php
$isLivewire = sk_is_livewire($attributes);
if($readonly)
{
$inputClasses .= ' pointer-events-none opacity-50';
}
@endphp
<div class="form-control w-full {{ $gridLayout }} @if($readonly) cursor-not-allowed @endif">
@if ($label)
<x-sk::form.label :for="$id" :required="$required">{{ $label }}</x-sk::form.label>
@endif
<select
id="{{ $id }}"
name="{{ $name }}"
@if($required) required @endif
@if($disabled) disabled @endif
{{ $attributes->merge(['class' => $inputClasses]) }}
>
@if ($placeholder)
<option value="" hidden @selected(empty($resolvedValue))>
{{ $placeholder }}
</option>
@endif
@foreach ($options as $key => $text)
<option value="{{ $key }}" @selected((string) $resolvedValue === (string) $key)>
{{ $text }}
</option>
@endforeach
</select>
@if ($help)
<x-sk::form.help>{{ $help }}</x-sk::form.help>
@endif
<x-sk::form.error :name="$name" />
</div>
@@ -0,0 +1,23 @@
@props([
'label' => 'Submit',
'cancel' => null,
'cancelLabel' => 'Cancel',
])
@if ($cancel)
<div class="flex flex-col md:flex-row mt-3 gap-3">
<a href="{{ $cancel }}" class="btn btn-ghost w-full md:w-1/2">
{{ $cancelLabel }}
</a>
<button type="submit" class="btn btn-primary w-full md:w-1/2">
{{ $label }}
</button>
</div>
@else
<div class="mt-3">
<button type="submit" class="btn btn-primary w-full">
{{ $label }}
</button>
</div>
@endif
@@ -0,0 +1,27 @@
@php
$isLivewire = sk_is_livewire($attributes);
@endphp
<div class="form-control w-full mb-4 {{ $gridLayout }} @if($readonly) cursor-not-allowed @endif"">
@if ($label)
<x-sk::form.label :for="$id" :required="$required">{{ $label }}</x-sk::form.label>
@endif
<textarea
id="{{ $id }}"
name="{{ $name }}"
placeholder="{{ $placeholder }}"
rows="{{ $rows }}"
@if($required) required @endif
@if($disabled && $isLivewire) readonly
@elseif($disabled) disabled @endif
@if($readonly) readonly @endif
{{ $attributes->merge(['class' => $inputClasses]) }}
>@unless($isLivewire){{ $resolvedValue }}@endunless</textarea>
@if ($help)
<x-sk::form.help>{{ $help }}</x-sk::form.help>
@endif
<x-sk::form.error :name="$name" />
</div>
@@ -0,0 +1,12 @@
@props([
'title' => '',
])
<li class="z-10">
<details>
<summary>{{ $title }}</summary>
<ul class="p-2 bg-primary">
{{ $slot }}
</ul>
</details>
</li>
@@ -0,0 +1,6 @@
@props([
'label' => '',
'link' => null,
])
<li><a class="whitespace-nowrap" @if($link) href="{{ $link }}" @endif>{{ $label }}</a></li>
@@ -0,0 +1,33 @@
<div class="navbar bg-primary text-primary-content shadow-sm">
<div class="navbar-start">
<!-- Mobile Dropdown -->
<div class="dropdown">
<div tabindex="0" role="button" class="btn btn-ghost lg:hidden">
<x-heroicon-m-bars-4 class="h-5 w-5" />
</div>
<ul tabindex="0"
class="menu menu-sm dropdown-content bg-primary rounded-box z-1 mt-3 w-52 p-2 shadow">
{{ $menu }}
</ul>
</div>
<!-- Brand -->
@if($brand)
<a class="btn btn-ghost text-xl">
{{ $brand }}
</a>
@endif
</div>
<!-- Desktop Menu -->
<div class="navbar-center hidden lg:flex">
<ul class="menu menu-horizontal px-1">
{{ $menu }}
</ul>
</div>
<!-- User -->
<div class="navbar-end">
{{ $user ?? '' }}
</div>
</div>
@@ -0,0 +1,17 @@
@props([
'avatar' => 'https://upload.wikimedia.org/wikipedia/commons/9/99/Sample_User_Icon.png?20200919003010',
])
<div class="dropdown dropdown-end">
<div tabindex="0" role="button" class="btn btn-ghost btn-circle avatar">
<div class="w-10 rounded-full">
<img
alt="User avatar"
src="{{ $avatar }}" />
</div>
</div>
<ul tabindex="0"
class="menu menu-sm dropdown-content bg-primary rounded-box mt-3 w-52 p-2 z-50 drop-shadow-xl">
{{ $slot }}
</ul>
</div>