What's Changed
- Bump stefanzweifel/git-auto-commit-action from 5 to 6 by @dependabot[bot] in #47
- Bump actions/checkout from 4 to 5 by @dependabot[bot] in #46
Major Release - Filament v4 Support
This major version brings full compatibility with Filament v4 along with significant improvements to the MediaManagerPicker component and new model integration features.
New Features
MediaManagerPicker Component
-
Enhanced UI/UX
- Completely redesigned modal layout with folder navigation on the left and media grid on the right
- Live preview section showing selected items with thumbnails, file info, and individual remove buttons
- Success notifications with selection count
- Auto-close modal after selection with proper state management
- Full dark mode support using Filament v4 color system
-
Selection Management
- Support for single and multiple selection modes via
->single()
and->multiple()
- Added
->maxItems(n)
to limit maximum selections - Added
->minItems(n)
to enforce minimum selections - Real-time validation with user-friendly warning notifications
- Selection state preserved when navigating between folders
- Support for single and multiple selection modes via
-
File Upload in Modal
- Upload files directly from the MediaManagerPicker modal
- Auto-select uploaded files after successful upload
- Respects max items limit during auto-selection
- Fixed file upload error handling
-
Password Protected Folders
- Secure folder access with password verification
- Password input with reveal toggle
- Prevented browser autocomplete on password fields
- Fixed folder opening after correct password entry
-
Search & Navigation
- Search across folders and media files
- Fixed browser autocomplete on search fields
- Breadcrumb navigation with back button
- Support for folder hierarchy (model type � collection � instance)
InteractsWithMediaManager Trait
- New Model Trait for easy media management in Eloquent models
- 11 Helper Methods including:
getMediaManagerMedia()
- Get all attached mediagetMediaManagerMediaByUuids()
- Get specific media by UUIDsgetMediaManagerInputMedia()
- Get Spatie collection mediaattachMediaManagerMedia()
- Attach media programmaticallydetachMediaManagerMedia()
- Detach mediasyncMediaManagerMedia()
- Sync media (replace all)hasMediaManagerMedia()
- Check if media existsgetFirstMediaManagerMedia()
- Get first media itemgetMediaManagerUrl()
- Get media URL with conversionsgetMediaManagerUrls()
- Get all media URLs
- Complete Documentation in
docs/TRAITS.md
MediaManagerPicker Form Component
- Empty State Styling - Filament v4 styled empty state with proper icons and messaging
- Section Border - Added styled container around empty state matching Filament's design system
- Preview List - Media items displayed as list with thumbnails, file info, and remove buttons
- Individual Item Removal - Remove items with confirmation modal
Bug Fixes
File Upload
- Fixed "FileDoesNotExist" error by using
->storeFiles(false)
and passing files directly to Spatie Media Library - Proper file handling for TemporaryUploadedFile instances
- Fixed file path issues on upload
Selection & State Management
- Fixed media selection only working in secure folders
- Fixed modal not closing after selection
- Fixed selected media not attaching to form
- Fixed nested array error in
whereIn
query by addingflatten()
filter - Fixed duplicate event processing with
isProcessing
flag - Fixed modal remounting instead of closing
Event System
- Switched from Livewire events to window CustomEvents for better reliability
- Fixed event propagation across folder navigation
- Handled both event data formats (
{media: array}
and direct array) - Fixed "Could not find Livewire component in DOM tree" error
Folder Navigation
- Fixed files from sub-folders appearing in parent folders
- Implemented proper hierarchical filtering based on folder structure
- Fixed media query to respect folder organization
UI/UX Fixes
- Fixed password input autocomplete interference with search field
- Fixed browser email autocomplete on password fields
- Fixed search field autocomplete
- Added unique IDs to form fields to prevent autocomplete conflicts
- Fixed dark mode styling for all components
- Added padding around preview items for better spacing
Modal Management
- Fixed modal close by clearing
mountedActions
array properly - Fixed redirect issue when trying to close modal with button clicks
- Removed ESC key fallback that caused issues
- Proper modal lifecycle management
Changes
Breaking Changes
- Filament v4 Required - This version is compatible with Filament v4 only
- Updated CSS Classes - Changed to Filament v4 class structure (e.g.,
fi-ta-empty-state
) - Dark Mode Pattern - Updated to use
.classname:where(.dark,.dark *)
pattern - CSS Variables - Now uses Filament v4 CSS variables (e.g.,
var(--gray-950)
)
Improvements
- Performance - Optimized media queries with proper scope handling
- Code Quality - Removed debug console.log statements
- Event Handling - More reliable event system using native browser events
- State Synchronization - Better
$wire.set()
usage for state management - Validation - Improved min/max items validation with clear user feedback
Documentation
- Updated README.md with:
- MediaManagerPicker features and usage
- InteractsWithMediaManager trait documentation
- Usage examples for all major features
- Updated feature list with emojis
- New TRAITS.md - Complete guide for the InteractsWithMediaManager trait
- New CHANGELOG.md - This comprehensive changelog
- New tests/README.md - Comprehensive testing guide
🧪 Testing
- MediaManagerPickerTest - 30+ test cases covering component configuration, folder navigation, password protection, and file upload
- MediaManagerInputTest - 35+ test cases covering file uploads, media retrieval, deletion, and validation
- InteractsWithMediaManagerTest - 20+ test cases covering all 11 trait methods
- Test Infrastructure: Product model factory, in-memory SQLite, comprehensive documentation
🔧 Technical Details
Files Modified
src/Livewire/MediaPicker.php
- Enhanced with password protection, upload, selection managementsrc/Form/MediaManagerPicker.php
- Added remove action, browse action improvementsresources/views/livewire/media-picker.blade.php
- Complete UI overhaulresources/views/forms/media-manager-picker.blade.php
- Preview list, empty state, event handlingresources/views/components/media-picker-modal.blade.php
- Initial state supportresources/lang/en/messages.php
- Added new translation keysresources/lang/ar/messages.php
- Added Arabic translations
Files Created
src/Traits/InteractsWithMediaManager.php
- New trait for model integrationdocs/TRAITS.md
- Trait documentationCHANGELOG.md
- This changelog
Files Created (Tests)
tests/src/MediaManagerPickerTest.php
- Comprehensive MediaManagerPicker teststests/src/MediaManagerInputTest.php
- Comprehensive MediaManagerInput teststests/src/InteractsWithMediaManagerTest.php
- Trait functionality teststests/src/Models/Product.php
- Test model with media supporttests/database/factories/ProductFactory.php
- Product factory for testingtests/database/migrations/2025_10_07_000001_create_products_table.php
- Products table migrationtests/README.md
- Testing documentation and guide
New Contributors
- @dependabot[bot] made their first contribution in #47
Full Changelog: v1.1.6...v4.0.0