Commit awal: prototipe UI SIAKAD Untan

This commit is contained in:
Ariyutta
2026-10-24 11:45:32 +07:00
commit d9b9cb5c0f
477 changed files with 51958 additions and 0 deletions
@@ -0,0 +1,71 @@
{{--
Tombol pemicu + dialog konfirmasi. Dirender sebagai <form> (atribut tambahan ke form).
Tanpa JS pemicu adalah tombol kirim biasa: formulir langsung terkirim (progressive enhancement).
Jangan taruh di dalam <form> lain.
--}}
@props([
'action',
'method' => 'POST',
'title',
'message' => null,
'confirmLabel' => 'Ya, lanjutkan',
'cancelLabel' => 'Batal',
'tone' => 'primary',
'icon' => null,
'iconOnly' => false,
'triggerLabel' => null,
'label' => null,
'variant' => 'ghost',
])
@php
$method = strtoupper($method);
$method = in_array($method, ['POST', 'PUT', 'PATCH', 'DELETE'], true) ? $method : 'POST';
$tone = $tone === 'danger' ? 'danger' : 'primary';
$variant = $variant === 'secondary' ? 'secondary' : 'ghost';
$uid = 'confirm-'.\Illuminate\Support\Str::random(8);
@endphp
<form
method="POST"
action="{{ $action }}"
x-data="confirmDialog"
{{ $attributes->class('confirm') }}
>
@csrf
@if ($method !== 'POST') @method($method) @endif
<x-ui.button
type="submit"
:variant="$variant"
:icon="$icon"
:icon-only="$iconOnly"
:class="$tone === 'danger' ? 'confirm__trigger--danger' : ''"
:aria-label="$iconOnly ? ($label ?? $title) : null"
x-ref="trigger"
x-on:click.prevent="show()"
>{{ $triggerLabel ?? $title }}</x-ui.button>
<dialog
x-ref="dialog"
@class(['dialog', 'dialog--danger' => $tone === 'danger'])
aria-labelledby="{{ $uid }}-title"
@if ($message) aria-describedby="{{ $uid }}-message" @endif
x-on:click="backdrop($event)"
x-on:close="restore()"
>
<div class="dialog__body">
<div class="dialog__head">
<span class="dialog__icon" aria-hidden="true">
@if ($tone === 'danger') <x-heroicon-o-exclamation-triangle /> @else <x-heroicon-o-question-mark-circle /> @endif
</span>
<p id="{{ $uid }}-title" class="dialog__title">{{ $title }}</p>
</div>
@if ($message) <p id="{{ $uid }}-message" class="dialog__message">{{ $message }}</p> @endif
<div class="dialog__actions">
<x-ui.button type="submit" :variant="$tone === 'danger' ? 'danger' : 'primary'">{{ $confirmLabel }}</x-ui.button>
<x-ui.button variant="secondary" x-ref="cancel" x-on:click="close()">{{ $cancelLabel }}</x-ui.button>
</div>
</div>
</dialog>
</form>