ysfkaya / filament-phone-input

A phone input component that uses intl-tel-input for Laravel Filament
https://filamentphp.com/plugins/ysfkaya-phone-input
MIT License
132 stars 30 forks source link

Suffix Action Not Working on PhoneInput Component #42

Closed abbasmashaddy72 closed 3 months ago

abbasmashaddy72 commented 3 months ago

Title:

Suffix Action Not Working on PhoneInput Component

Description:

I'm having trouble implementing a suffixAction on a PhoneInput component to copy the value from one field to another. Below is the code snippet that I'm using. The suffixAction button appears next to the contact_number field, but when clicked, it does not copy the value to the whatsapp_number field as expected.

Code Snippet:

use Filament\Forms\Components\Button;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Fieldset;
use Filament\Forms\Components\Card;
use Filament\Forms\Components\Grid;
use Ysfkaya\FilamentPhoneInput\Forms\PhoneInput;
use Filament\Forms\Components\Actions\Action;

$form->schema([
    Card::make()
        ->schema([
            Fieldset::make('Contact Information')
                ->schema([
                    Grid::make(2)
                        ->schema([
                            PhoneInput::make('contact_number')
                                ->label('Contact Number')
                                ->required()
                                ->reactive()
                                ->suffixAction(
                                    Action::make('copyContactToWhatsApp')
                                        ->icon('heroicon-m-clipboard')
                                        ->action(function (Forms\Set $set, $state) {
                                            $set('whatsapp_number', $state);
                                        })
                                ),
                            PhoneInput::make('whatsapp_number')
                                ->label('WhatsApp Number')
                                ->reactive(),
                        ]),
                ])
        ])
]);

Expected Behavior:

Clicking the suffixAction button should copy the value from the contact_number field to the whatsapp_number field.

Actual Behavior:

The suffixAction button appears, but clicking it does not copy the value as expected.

ysfkaya commented 3 months ago

Hey @abbasmashaddy72

Thanks for your bug report.

Fixed in v2.3.6

abbasmashaddy72 commented 3 months ago

Thanks, Brother Working

@ysfkaya