{{-- Sidebar Group (collapsible nav group) Props: $item – nav item array { label, icon?, children[] }, $nested – nested group styling --}} @props([ 'item', 'nested' => false, ]) @php $anyActive = collect($item['children'] ?? [])->contains(function($c) { $route = $c['route'] ?? ''; $activePattern = $c['active'] ?? (str_ends_with($route, '.index') ? substr($route, 0, -6) . '.*' : $route); return request()->routeIs($route) || ($activePattern && request()->routeIs($activePattern)); }); $act = "bg-sidebar-primary font-semibold text-sidebar-primary-foreground before:pointer-events-none before:absolute before:bottom-1.5 before:start-0 before:top-1.5 before:w-1 before:rounded-r before:bg-sidebar-ring before:content-[''] dark:bg-sidebar-active"; $navLabel = $item['label'] ?? ''; $buttonClass = $nested ? 'group relative flex w-full cursor-pointer select-none items-center gap-2 rounded-lg px-3 py-2 text-left text-[13px] font-medium transition-all duration-200' : 'group relative flex w-full cursor-pointer select-none items-center gap-3 rounded-lg px-3 py-2.5 text-left text-[13.5px] font-medium transition-all duration-200'; @endphp
@foreach($item['children'] ?? [] as $child) @if(isset($child['children'])) @else @endif @endforeach