199ocero/radio-deck

[Bug]: Enun support not working

Closed this issue · 1 comments

What happened?

When using enuns, the description and icon are not recognized. The enum value is used instead

How to reproduce the bug

// Resource form

RadioDeck::make('export_type')
    ->label('Tipo de exportação')
    ->options(ExportType::class)
    ->descriptions(ExportType::class)
    ->icons(ExportType::class)
    ->iconSize(IconSize::Large)
    ->iconPosition(IconPosition::Before)
    ->alignment(Alignment::Center)
    ->color('danger')
    ->columns(3)
// enum

enum ExportType: int implements HasDescription, HasIcon, HasLabel
{
    case PERSONAL_DATA = 1;

    case JUST_TOTAL_NUMBERS = 2;

    public function getLabel(): string
    {
        return match ($this) {
            self::PERSONAL_DATA => 'Dados pessoais',
            self::JUST_TOTAL_NUMBERS => 'Quantitativo',
        };
    }

    public function getDescription(): string
    {
        return match ($this) {
            self::PERSONAL_DATA => 'Nome, e-mail, etc.',
            self::JUST_TOTAL_NUMBERS => 'Apenas o número de registros encontrados.',
        };
    }

    public function getIcon(): ?string
    {
        return match ($this) {
            self::PERSONAL_DATA => 'heroicon-m-finger-print',
            self::JUST_TOTAL_NUMBERS => 'heroicon-o-chart-pie',
        };
    }
}

Package Version

1.2.4

PHP Version

8.3.6

Laravel Version

11.5.0

Which operating systems does with happen with?

Windows

Notes

No response

Hey @henryavila can you add a sample repository and what is the error message if you encounter the bug? And if you miss maybe the namespace?

use JaOcero\RadioDeck\Contracts\HasDescriptions;
use JaOcero\RadioDeck\Contracts\HasIcons;