Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'variant' => null,
'size' => null,
'name' => null,
'indicator' => true,
])

@php
Expand Down
16 changes: 14 additions & 2 deletions stubs/resources/views/flux/radio/variants/cards.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@
])

@php
// Normalize the "indicator" prop into a position while preserving the previous truthy/falsy behavior...
$indicatorPosition = $indicator ? 'end' : false;

if ($indicator === 'start' || $indicator === 'left') {
$indicatorPosition = 'start';
}

$iconClasses = Flux::classes()
->add('inline-block mt-0.5 text-zinc-400 [ui-radio[data-checked]_&]:text-zinc-800 dark:[ui-radio[data-checked]_&]:text-white')
// When using the outline icon variant, we need to size it down to match the default icon sizes...
->add($iconVariant === 'outline' ? 'size-4' : '')
;

$classes = Flux::classes()
->add('relative flex justify-between gap-3 flex-1 p-4')
->add('relative flex gap-3 flex-1 p-4')
->add($indicatorPosition === 'start' ? 'justify-start' : 'justify-between')
->add('rounded-lg shadow-xs')
->add('bg-white dark:bg-white/10 dark:hover:bg-white/15 dark:data-checked:bg-white/15')
->add('after:absolute after:-inset-px after:rounded-lg')
Expand Down Expand Up @@ -54,6 +62,10 @@
{{-- We have to put "data-flux-field" so that a single box can be disabled without "disabling" the group field label... --}}
<ui-radio {{ $attributes->class($classes) }} data-flux-control data-flux-radio-cards tabindex="-1" data-flux-field>
<?php if ($label): ?>
<?php if ($indicatorPosition === 'start'): ?>
<flux:radio.indicator />
<?php endif; ?>

<div class="flex-1 flex gap-2">
<?php if (is_string($icon) && $icon !== ''): ?>
<flux:icon :icon="$icon" :variant="$iconVariant" :class="$iconClasses" />
Expand All @@ -70,7 +82,7 @@
</div>
</div>

<?php if ($indicator): ?>
<?php if ($indicatorPosition === 'end'): ?>
<flux:radio.indicator />
<?php endif; ?>
<?php else: ?>
Expand Down