diff --git a/.github/workflows/ISSUE_TEMPLATE/config.yml b/.github/workflows/ISSUE_TEMPLATE/config.yml index 399bc7b..8562769 100644 --- a/.github/workflows/ISSUE_TEMPLATE/config.yml +++ b/.github/workflows/ISSUE_TEMPLATE/config.yml @@ -1,14 +1,14 @@ blank_issues_enabled: false contact_links: - name: Feature request - url: https://github.com/codedor/filament-form-architect/discussions/new?category=ideas + url: https://github.com/wotz/filament-form-architect/discussions/new?category=ideas about: Share ideas for new features - name: Support question - url: https://github.com/codedor/filament-form-architect/discussions/new?category=q-a + url: https://github.com/wotz/filament-form-architect/discussions/new?category=q-a about: Ask the community for help - name: Report a security issue - url: https://github.com/codedor/filament-form-architect/README.md#security + url: https://github.com/wotz/filament-form-architect/README.md#security about: Learn how to notify us for sensitive bugs - name: Report a bug - url: https://github.com/codedor/filament-form-architect/issues/new + url: https://github.com/wotz/filament-form-architect/issues/new about: Report a reproducable bug diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 141896e..968560b 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -16,7 +16,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.3" + php-version: "8.4" coverage: none - name: Install composer dependencies diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 660338a..91878e2 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,8 +13,8 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest] - php: [8.2, 8.3] - laravel: [10.*] + php: [8.3, 8.4, 8.5] + laravel: [12.*, 13.*] stability: [prefer-stable] name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 6869745..bdc9485 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -60,7 +60,7 @@ representative at an online or offline event. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at -info@codedor.be. +info@whoownsthezebra.be. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d1294e..c9feb57 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,7 +45,7 @@ Some things to consider before submitting an issue ## Coding style -See our [guidelines](https://guidelines.codedor.be/coding-standards/php). +See our [guidelines](https://guidelines.whoownsthezebra.be/coding-standards/php). ### Laravel Pint diff --git a/README.md b/README.md index 37438d0..41c0bc0 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This is where your description should go. Limit it to a paragraph or two. Consid You can install the package via composer: ```bash -composer require codedor/filament-form-architect +composer require wotz/filament-form-architect ``` You can publish and run the migrations with: @@ -30,8 +30,8 @@ This is the contents of the published config file: ```php return [ 'default-blocks' => [ - \Codedor\FormArchitect\Architect\RadioButtonBlock::class, - \Codedor\FormArchitect\Architect\TextInputBlock::class, + \Wotz\FormArchitect\Architect\RadioButtonBlock::class, + \Wotz\FormArchitect\Architect\TextInputBlock::class, ], ]; ``` @@ -66,7 +66,7 @@ Please see [CONTRIBUTING](CONTRIBUTING.md) for details. ## Security Vulnerabilities -If you discover any security-related issues, please email info@codedor.be instead of using the issue tracker. +If you discover any security-related issues, please email info@whoownsthezebra.be instead of using the issue tracker. ## License diff --git a/UPGRADING.md b/UPGRADING.md index c7d86ae..297ae4d 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -1,3 +1,23 @@ # Upgrading -## From vx to vy +## From v1 to v2 + +v2 moves the package to the wotzebra organisation, targets Filament 4/5, +Laravel 12/13 and PHP 8.3+, and swaps the `codedor/*` dependencies for their +`wotz/*` successors. + +- Install `wotz/filament-form-architect` instead of `codedor/filament-form-architect`. +- Replace all occurrences of the `Codedor\FormArchitect` namespace with the new + `Wotz\FormArchitect` namespace. +- If your project references classes of the underlying `codedor/*` packages + directly, replace their `Codedor\` namespace prefix with `Wotz\` as well + (e.g. `Codedor\LivewireForms\...` becomes `Wotz\LivewireForms\...`). +- `awcodes/filament-tiptap-editor` has been replaced by Filament's native + `RichEditor`. The `checkbox-tiptap-profile` config key has been renamed to + `checkbox-toolbar-buttons` and now takes an array of RichEditor toolbar buttons + (default: `['bold', 'italic', 'link']`). +- `guava/filament-drafts` was an unused dependency and has been dropped. +- The `Wotz\TranslatableTabs\Resources\Traits\HasTranslations` page trait no longer + exists; wotz/filament-translatable-tabs v3 handles translations through the schema + lifecycle. If your project used it on custom Create/Edit pages, delete the `use` + statement. diff --git a/composer.json b/composer.json index 9d6295a..89c9055 100644 --- a/composer.json +++ b/composer.json @@ -1,54 +1,54 @@ { - "name": "codedor/filament-form-architect", + "name": "wotz/filament-form-architect", "description": "Build beautiful forms together with our Architect package", "keywords": [ - "codedor", + "who owns the zebra", "laravel", "filament-form-architect" ], - "homepage": "https://github.com/codedor/filament-form-architect", + "homepage": "https://github.com/wotz/filament-form-architect", "license": "MIT", "require": { - "php": "^8.2", - "awcodes/filament-tiptap-editor": "^3.2", - "codedor/filament-architect": "^1.0|^2.0", - "codedor/filament-mail-templates": "^1.1", - "codedor/filament-translatable-strings": "^1.0", - "codedor/laravel-livewire-forms": "^4.0", - "codedor/laravel-locale-collection": "^1.1", - "filament/filament": "^3.1", - "guava/filament-drafts": "^2.1", - "maatwebsite/excel": "^3.1", - "illuminate/contracts": "^10.0|^11.0", - "spatie/laravel-package-tools": "^1.12" + "php": "^8.3", + "filament/filament": "^4.0|^5.0", + "illuminate/contracts": "^12.0|^13.0", + "maatwebsite/excel": "^4.0", + "spatie/laravel-package-tools": "^1.12", + "wotz/filament-architect": "^3.0", + "wotz/filament-mail-templates": "^2.0", + "wotz/filament-media-library": "^4.0", + "wotz/filament-translatable-strings": "^3.0", + "wotz/filament-translatable-tabs": "^3.0", + "wotz/laravel-livewire-forms": "^5.0", + "wotz/laravel-locale-collection": "^2.0" }, "require-dev": { + "larastan/larastan": "^3.0", "laravel/pint": "^1.0", - "nunomaduro/collision": "^7.0|^8.0", - "larastan/larastan": "^2.0", - "orchestra/testbench": "^8.0|^9.0", - "pestphp/pest": "^2.0", - "pestphp/pest-plugin-laravel": "^2.0", - "pestphp/pest-plugin-livewire": "^2.1", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0" + "nunomaduro/collision": "^8.0", + "orchestra/testbench": "^10.0|^11.0", + "pestphp/pest": "^4.0", + "pestphp/pest-plugin-laravel": "^4.0", + "pestphp/pest-plugin-livewire": "^4.0", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0" }, "autoload": { "psr-4": { - "Codedor\\FormArchitect\\": "src", - "Codedor\\FormArchitect\\Database\\Factories\\": "database/factories" + "Wotz\\FormArchitect\\": "src", + "Wotz\\FormArchitect\\Database\\Factories\\": "database/factories" } }, "autoload-dev": { "psr-4": { - "Codedor\\FormArchitect\\Tests\\": "tests" + "Wotz\\FormArchitect\\Tests\\": "tests" } }, "extra": { "laravel": { "providers": [ - "Codedor\\FormArchitect\\Providers\\FormArchitectServiceProvider" + "Wotz\\FormArchitect\\Providers\\FormArchitectServiceProvider" ] } }, diff --git a/config/filament-form-architect.php b/config/filament-form-architect.php index 9e9159d..67e5111 100644 --- a/config/filament-form-architect.php +++ b/config/filament-form-architect.php @@ -1,6 +1,6 @@ false, @@ -18,5 +18,5 @@ Architect\TextInputBlock::class => [], Architect\TitleBlock::class => [], ], - 'checkbox-tiptap-profile' => 'minimal', + 'checkbox-toolbar-buttons' => ['bold', 'italic', 'link'], ]; diff --git a/database/factories/FormFactory.php b/database/factories/FormFactory.php index 4df552f..e3da37c 100644 --- a/database/factories/FormFactory.php +++ b/database/factories/FormFactory.php @@ -1,9 +1,9 @@ plugins([ - \Codedor\FormArchitect\Filament\FormArchitectPlugin::make(), + \Wotz\FormArchitect\Filament\FormArchitectPlugin::make(), ]); } @@ -48,7 +48,7 @@ public function panel(Panel $panel): Panel ## Creating a block/field -See our [Architect](https://github.com/codedor/filament-architect) package for how to create new blocks. +See our [Architect](https://github.com/wotzebra/filament-architect) package for how to create new blocks. The only difference here is that we have a `toLivewireForm` function instead of a `render` function, which returns the Livewire form component. @@ -87,7 +87,7 @@ public static function toExcelExport(mixed $value): string This package has a couple of config values: ```php -use Codedor\FormArchitect\Architect; +use Wotz\FormArchitect\Architect; return [ 'enable-submission-field' => false, @@ -118,7 +118,7 @@ This configures the default attributes for the row block. For example the `divCl ### default-blocks -This configures which blocks will be used in the form builder, see our [Architect](https://github.com/codedor/filament-architect) package for more information about blocks. +This configures which blocks will be used in the form builder, see our [Architect](https://github.com/wotzebra/filament-architect) package for more information about blocks. A slight difference with the normal Architect blocks is that we can pass an array per block, which will be used as the default attributes for that block. For example: @@ -132,7 +132,7 @@ A slight difference with the normal Architect blocks is that we can pass an arra ], ``` -See our [Livewire Forms](https://github.com/codedor/laravel-livewire-forms) package for an overview of available attributes. +See our [Livewire Forms](https://github.com/wotzebra/laravel-livewire-forms) package for an overview of available attributes. ### checkbox-tiptap-profile diff --git a/phpstan.neon.dist b/phpstan.neon.dist index a91953b..843ce64 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -8,7 +8,5 @@ parameters: - config - database tmpDir: build/phpstan - checkOctaneCompatibility: true checkModelProperties: true - checkMissingIterableValueType: false diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 314c7c5..11e4917 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,26 +1,30 @@ - - - - tests - - - - - - - - - - - - - - - - - - ./src - - + + + + tests + + + + + + + + ./src + + diff --git a/resources/views/livewire/rendered-form.blade.php b/resources/views/livewire/rendered-form.blade.php index 1cb63e0..487caa7 100644 --- a/resources/views/livewire/rendered-form.blade.php +++ b/resources/views/livewire/rendered-form.blade.php @@ -1,7 +1,7 @@
- @if ($formModel->allowSubmissions()) + @if ($formModel?->allowSubmissions()) @include('livewire-forms::form') @else - {!! $formModel->getMaxSubmissionMessage() !!} + {!! $formModel?->getMaxSubmissionMessage() !!} @endif
diff --git a/src/Architect/BaseFormBlock.php b/src/Architect/BaseFormBlock.php index 2124a7f..99db0cd 100644 --- a/src/Architect/BaseFormBlock.php +++ b/src/Architect/BaseFormBlock.php @@ -1,8 +1,8 @@ persistInQueryString(false) + ->persistTabInQueryString(null) ->defaultFields([ Toggle::make('is_required'), ]) ->translatableFields(fn () => [ - TiptapEditor::make('label') + RichEditor::make('label') ->required(fn (Get $get) => $get('online')) - ->profile(config('filament-form-architect.checkbox-tiptap-profile', 'minimal')), + ->toolbarButtons(config('filament-form-architect.checkbox-toolbar-buttons', ['bold', 'italic', 'link'])), TextInput::make('gdpr_notice') ->label('GDPR Notice') diff --git a/src/Architect/CountryInputBlock.php b/src/Architect/CountryInputBlock.php index b87aab5..5b73960 100644 --- a/src/Architect/CountryInputBlock.php +++ b/src/Architect/CountryInputBlock.php @@ -1,16 +1,16 @@ persistInQueryString(false) + ->persistTabInQueryString(null) ->defaultFields([ Select::make('default_value') ->label('Default selected country') diff --git a/src/Architect/FileInputBlock.php b/src/Architect/FileInputBlock.php index b19417d..49f9ed8 100644 --- a/src/Architect/FileInputBlock.php +++ b/src/Architect/FileInputBlock.php @@ -1,18 +1,18 @@ persistInQueryString(false) + ->persistTabInQueryString(null) ->defaultFields([ Toggle::make('multiple') ->helperText('Allow multiple files to be uploaded'), diff --git a/src/Architect/RadioButtonBlock.php b/src/Architect/RadioButtonBlock.php index 46421ec..69ec926 100644 --- a/src/Architect/RadioButtonBlock.php +++ b/src/Architect/RadioButtonBlock.php @@ -1,15 +1,15 @@ persistInQueryString(false) + ->persistTabInQueryString(null) ->defaultFields([ Toggle::make('is_required'), ]) diff --git a/src/Architect/SelectInputBlock.php b/src/Architect/SelectInputBlock.php index dc23118..da38b64 100644 --- a/src/Architect/SelectInputBlock.php +++ b/src/Architect/SelectInputBlock.php @@ -1,15 +1,15 @@ persistInQueryString(false) + ->persistTabInQueryString(null) ->defaultFields([ Toggle::make('is_required'), ]) diff --git a/src/Architect/TextInputBlock.php b/src/Architect/TextInputBlock.php index 495d326..860fb9b 100644 --- a/src/Architect/TextInputBlock.php +++ b/src/Architect/TextInputBlock.php @@ -1,16 +1,16 @@ persistInQueryString(false) + ->persistTabInQueryString(null) ->defaultFields([ Select::make('type') ->selectablePlaceholder(false) @@ -56,7 +56,7 @@ public function schema(): array TextInput::make('label') ->required(fn (Get $get) => $get('online')), - TiptapEditor::make('gdpr_notice') + RichEditor::make('gdpr_notice') ->label('GDPR Notice') ->helperText('This will explain why you need this information and how you will use it.'), diff --git a/src/Architect/TextareaBlock.php b/src/Architect/TextareaBlock.php index c820420..b42b521 100644 --- a/src/Architect/TextareaBlock.php +++ b/src/Architect/TextareaBlock.php @@ -1,14 +1,14 @@ persistInQueryString(false) + ->persistTabInQueryString(null) ->defaultFields([ TextInput::make('max') ->label('Maximum allowed characters') diff --git a/src/Architect/TitleBlock.php b/src/Architect/TitleBlock.php index fcd3f3f..5a648b7 100644 --- a/src/Architect/TitleBlock.php +++ b/src/Architect/TitleBlock.php @@ -1,15 +1,15 @@ persistInQueryString(false) + ->persistTabInQueryString(null) ->defaultFields([ Select::make('tag') ->label('Styling') @@ -41,8 +41,8 @@ public function schema(): array ]), ]) ->translatableFields(fn () => [ - TiptapEditor::make('label') - ->tools(['link']) + RichEditor::make('label') + ->toolbarButtons(['link']) ->required(fn (Get $get) => $get('online')), Toggle::make('online'), diff --git a/src/Exports/FormSubmissionsExport.php b/src/Exports/FormSubmissionsExport.php index 4f8b08c..b9df6d0 100644 --- a/src/Exports/FormSubmissionsExport.php +++ b/src/Exports/FormSubmissionsExport.php @@ -1,11 +1,11 @@ icon('heroicon-o-arrow-down-tray'); - $this->form(fn () => [ + $this->schema(fn () => [ TextInput::make('filename') ->label('Filename') ->default('form-submissions'), diff --git a/src/Filament/Fields/FormArchitectInput.php b/src/Filament/Fields/FormArchitectInput.php index e7a613f..9b377a9 100644 --- a/src/Filament/Fields/FormArchitectInput.php +++ b/src/Filament/Fields/FormArchitectInput.php @@ -1,9 +1,9 @@ schema([ + return $schema + ->components([ TranslatableTabs::make() ->icon('heroicon-o-check-circle') ->defaultFields([ - Forms\Components\TextInput::make('name') + TextInput::make('name') ->label('Form name') ->required() ->maxLength(255), - Forms\Components\TextInput::make('email_from') + TextInput::make('email_from') ->label('Admin mail sender address') ->helperText( 'If left empty, the sites default mail will be used: ' . @@ -69,7 +71,7 @@ public static function form(Form $form): Form ]) ->hidden(ModelsForm::adminEmailsDisabled()), - Forms\Components\TextInput::make('max_submissions') + TextInput::make('max_submissions') ->required() ->numeric() ->default(0) @@ -79,19 +81,19 @@ public static function form(Form $form): Form FormArchitectInput::make('fields'), ]) ->translatableFields(fn () => [ - Forms\Components\TextInput::make('email_subject') + TextInput::make('email_subject') ->label('E-mail subject') ->hidden(ModelsForm::adminEmailsDisabled()), - TiptapEditor::make('email_body') + RichEditor::make('email_body') ->label('E-mail body') ->hidden(ModelsForm::adminEmailsDisabled()), - TiptapEditor::make('completion_message') + RichEditor::make('completion_message') ->label('After submit completion message') ->helperText('This message will be shown to the user after submitting the form.'), - TiptapEditor::make('max_submissions_message') + RichEditor::make('max_submissions_message') ->label('Maximum submissions message') ->helperText('This message will be shown to the user when the maximum amount of submissions has been reached.') ->hidden(ModelsForm::maxSubmissionsDisabled()), @@ -125,20 +127,20 @@ public static function table(Table $table): Table ->sortable() ->getStateUsing(fn ($record) => $record->submissions()->count()), ]) - ->actions([ - Tables\Actions\Action::make('submissions') + ->recordActions([ + Action::make('submissions') ->url(fn ($record): string => self::getUrl('submissions', [$record])) ->color('gray') ->icon('heroicon-s-eye'), - Tables\Actions\EditAction::make(), - Tables\Actions\DeleteAction::make(), + EditAction::make(), + DeleteAction::make(), ]); } - public static function infolist(Infolist $infolist): Infolist + public static function infolist(Schema $schema): Schema { - return $infolist->schema([ + return $schema->components([ Section::make()->schema([ TextEntry::make('name')->label('Form'), diff --git a/src/Filament/Resources/FormSubmissionResource.php b/src/Filament/Resources/FormSubmissionResource.php index 11e3694..ed2cc4c 100644 --- a/src/Filament/Resources/FormSubmissionResource.php +++ b/src/Filament/Resources/FormSubmissionResource.php @@ -1,25 +1,27 @@ schema([ + return $schema->components([ TextEntry::make('created_at') ->dateTime(), @@ -43,12 +45,12 @@ public static function table(Table $table): Table ->sortable(), ]) ->defaultSort('id', 'desc') - ->actions([ - Tables\Actions\ViewAction::make(), + ->recordActions([ + ViewAction::make(), ]) - ->bulkActions([ + ->toolbarActions([ ExportFormSubmissions::make(), - Tables\Actions\DeleteBulkAction::make(), + DeleteBulkAction::make(), ]); } diff --git a/src/Filament/Resources/Pages/CreateForm.php b/src/Filament/Resources/Pages/CreateForm.php index 377c845..a691ffb 100644 --- a/src/Filament/Resources/Pages/CreateForm.php +++ b/src/Filament/Resources/Pages/CreateForm.php @@ -1,14 +1,11 @@ record = $record; + parent::mount(); } public function getFilteredTableQuery(): Builder { - return parent::getFilteredTableQuery()->where('form_id', $this->record->id); + return parent::getFilteredTableQuery() + ->when($this->record, fn (Builder $query) => $query->where('form_id', $this->record->id)); } } diff --git a/src/Filament/Resources/Pages/ListForms.php b/src/Filament/Resources/Pages/ListForms.php index 09cac36..4a75991 100644 --- a/src/Filament/Resources/Pages/ListForms.php +++ b/src/Filament/Resources/Pages/ListForms.php @@ -1,10 +1,10 @@ formModel) extends LivewireFormsForm { - public function __construct(public Form $formModel) + public function __construct(public ?Form $formModel) { parent::__construct(); } public function fields() { + if (! $this->formModel) { + return []; + } + return [ ...$this->formModel->getLivewireFormFields(), Button::make(__('form.submit')), diff --git a/src/Mail/SendFormSubmission.php b/src/Mail/SendFormSubmission.php index 5e018fd..051701e 100644 --- a/src/Mail/SendFormSubmission.php +++ b/src/Mail/SendFormSubmission.php @@ -1,18 +1,19 @@ + * @return array */ public function attachments(): array { diff --git a/src/Models/Form.php b/src/Models/Form.php index e79c68d..4ca2584 100644 --- a/src/Models/Form.php +++ b/src/Models/Form.php @@ -1,15 +1,16 @@ actingAs(User::factory()->create()); diff --git a/tests/Feature/Livewire/RenderedFormTest.php b/tests/Feature/Livewire/RenderedFormTest.php index eecd5fe..9f1d1d0 100644 --- a/tests/Feature/Livewire/RenderedFormTest.php +++ b/tests/Feature/Livewire/RenderedFormTest.php @@ -1,12 +1,12 @@ in('Feature'); diff --git a/tests/TestCase.php b/tests/TestCase.php index b879bbb..03606c7 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,28 +1,28 @@ 'Codedor\\FormArchitect\\Database\\Factories\\' . class_basename($modelName) . 'Factory' + fn (string $modelName) => 'Wotz\\FormArchitect\\Database\\Factories\\' . class_basename($modelName) . 'Factory' ); } @@ -40,21 +40,18 @@ protected function getPackageProviders($app) return [ FilamentArchitectServiceProvider::class, FormArchitectServiceProvider::class, - LivewireServiceProvider::class, - FilamentServiceProvider::class, - BladeCaptureDirectiveServiceProvider::class, BladeHeroiconsServiceProvider::class, BladeIconsServiceProvider::class, - BaseFilamentServiceProvider::class, + FilamentServiceProvider::class, + SchemasServiceProvider::class, + InfolistsServiceProvider::class, FormsServiceProvider::class, ActionsServiceProvider::class, WidgetsServiceProvider::class, - LivewireServiceProvider::class, NotificationsServiceProvider::class, SupportServiceProvider::class, TablesServiceProvider::class, - FilamentDraftsServiceProvider::class, - LaravelDraftsServiceProvider::class, + LivewireServiceProvider::class, LivewireFormsServiceProvider::class, FilamentMailTemplatesServiceProvider::class, ]; @@ -64,13 +61,13 @@ public function getEnvironmentSetUp($app) { config()->set('database.default', 'testing'); - $panel = new \Filament\Panel; + $panel = new Panel; $panel ->id('resource-test') ->default(true) ->plugin(FormArchitectPlugin::make()); - \Filament\Facades\Filament::registerPanel($panel); + Filament::registerPanel($panel); } protected function defineDatabaseMigrations(): void