diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index be45875..0052c14 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -3,41 +3,41 @@ name: run-tests on: [push, pull_request] jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - php: [8.1, 8.0, 7.4] - laravel: [8.*] - framework: [tailwind, tailwind-2, bootstrap-4, bootstrap-5] - dependency-version: [prefer-lowest, prefer-stable] - include: - - laravel: 8.* - testbench: 6.* - exclude: - - laravel: 7.* - php: 8.1 + test: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + php: [8.1, 8.0, 7.4] + laravel: [8.*] + framework: [tailwind, tailwind-2, tailwind-forms-simple, bootstrap-4, bootstrap-5] + dependency-version: [prefer-lowest, prefer-stable] + include: + - laravel: 8.* + testbench: 6.* + exclude: + - laravel: 7.* + php: 8.1 - name: P${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.dependency-version }} - Front-end Framework ${{ matrix.framework }} + name: P${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.dependency-version }} - Front-end Framework ${{ matrix.framework }} - steps: - - name: Checkout code - uses: actions/checkout@v2 + steps: + - name: Checkout code + uses: actions/checkout@v2 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, mysql, mysqli, pdo_mysql - coverage: none + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, mysql, mysqli, pdo_mysql + coverage: none - - name: Install dependencies - run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update - composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest + - name: Install dependencies + run: | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest - - name: Execute tests - env: - FORM_COMPONENTS_FRAMEWORK: ${{ matrix.framework }} - run: vendor/bin/phpunit + - name: Execute tests + env: + FORM_COMPONENTS_FRAMEWORK: ${{ matrix.framework }} + run: vendor/bin/phpunit diff --git a/README.md b/README.md index 3227496..065a25f 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ The `action` attribute is optional, but you can pass a hard-coded, primitive val ## Configuration -You can switch frameworks by updating the `framework` setting in the `form-components.php` configuration file. Check out the [customization section](#customize-the-blade-views) on publishing the configuration and view files. +You can switch frameworks by updating the `framework` setting in the `form-components.php` configuration file. Check out the [customization section](#customize-the-blade-views) on publishing the configuration and view files. If you're using the [Livewire Stack with Laravel Jetstream](https://jetstream.laravel.com/2.x/stacks/livewire.html), you probably want to set the `framework` configuration key to `tailwind-forms-simple`. ```php return [ diff --git a/config/config.php b/config/config.php index 1a99cff..638a58e 100644 --- a/config/config.php +++ b/config/config.php @@ -5,7 +5,7 @@ return [ 'prefix' => '', - /** tailwind | tailwind-2 | bootstrap-4 | bootstrap-5 */ + /** tailwind | tailwind-2 | tailwind-forms-simple | bootstrap-4 | bootstrap-5 */ 'framework' => 'tailwind', 'use_eloquent_date_casting' => false, diff --git a/resources/views/tailwind-forms-simple/form-checkbox.blade.php b/resources/views/tailwind-forms-simple/form-checkbox.blade.php new file mode 100644 index 0000000..3bac545 --- /dev/null +++ b/resources/views/tailwind-forms-simple/form-checkbox.blade.php @@ -0,0 +1,24 @@ +
+ + + @if($hasErrorAndShow($name)) + + @endif +
\ No newline at end of file diff --git a/resources/views/tailwind-forms-simple/form-errors.blade.php b/resources/views/tailwind-forms-simple/form-errors.blade.php new file mode 100644 index 0000000..ba2d5d6 --- /dev/null +++ b/resources/views/tailwind-forms-simple/form-errors.blade.php @@ -0,0 +1,5 @@ +@error($name, $bag) +

merge(['class' => 'mt-2 text-sm text-red-600']) !!}> + {{ $message }} +

+@enderror \ No newline at end of file diff --git a/resources/views/tailwind-forms-simple/form-group.blade.php b/resources/views/tailwind-forms-simple/form-group.blade.php new file mode 100644 index 0000000..dd492e0 --- /dev/null +++ b/resources/views/tailwind-forms-simple/form-group.blade.php @@ -0,0 +1,11 @@ +
merge(['class' => 'mt-4']) !!}> + + +
+ {!! $slot !!} +
+ + @if($hasErrorAndShow($name)) + + @endif +
\ No newline at end of file diff --git a/resources/views/tailwind-forms-simple/form-input.blade.php b/resources/views/tailwind-forms-simple/form-input.blade.php new file mode 100644 index 0000000..846d855 --- /dev/null +++ b/resources/views/tailwind-forms-simple/form-input.blade.php @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/resources/views/tailwind-forms-simple/form-label.blade.php b/resources/views/tailwind-forms-simple/form-label.blade.php new file mode 100644 index 0000000..dae6c08 --- /dev/null +++ b/resources/views/tailwind-forms-simple/form-label.blade.php @@ -0,0 +1,3 @@ +@if($label) + merge(['class' => 'text-gray-700']) !!}>{{ $label }} +@endif \ No newline at end of file diff --git a/resources/views/tailwind-forms-simple/form-radio.blade.php b/resources/views/tailwind-forms-simple/form-radio.blade.php new file mode 100644 index 0000000..8280148 --- /dev/null +++ b/resources/views/tailwind-forms-simple/form-radio.blade.php @@ -0,0 +1,24 @@ +
+ + + @if($hasErrorAndShow($name)) + + @endif +
\ No newline at end of file diff --git a/resources/views/tailwind-forms-simple/form-select.blade.php b/resources/views/tailwind-forms-simple/form-select.blade.php new file mode 100644 index 0000000..7dff3de --- /dev/null +++ b/resources/views/tailwind-forms-simple/form-select.blade.php @@ -0,0 +1,43 @@ +
+ + + @if($hasErrorAndShow($name)) + + @endif +
\ No newline at end of file diff --git a/resources/views/tailwind-forms-simple/form-submit.blade.php b/resources/views/tailwind-forms-simple/form-submit.blade.php new file mode 100644 index 0000000..a6d8072 --- /dev/null +++ b/resources/views/tailwind-forms-simple/form-submit.blade.php @@ -0,0 +1,8 @@ +
+ +
\ No newline at end of file diff --git a/resources/views/tailwind-forms-simple/form-textarea.blade.php b/resources/views/tailwind-forms-simple/form-textarea.blade.php new file mode 100644 index 0000000..95728b1 --- /dev/null +++ b/resources/views/tailwind-forms-simple/form-textarea.blade.php @@ -0,0 +1,19 @@ +
+ + + @if($hasErrorAndShow($name)) + + @endif +
\ No newline at end of file diff --git a/resources/views/tailwind-forms-simple/form.blade.php b/resources/views/tailwind-forms-simple/form.blade.php new file mode 100644 index 0000000..c5b3331 --- /dev/null +++ b/resources/views/tailwind-forms-simple/form.blade.php @@ -0,0 +1,11 @@ +
+@unless(in_array($method, ['HEAD', 'GET', 'OPTIONS'])) + @csrf +@endunless + +@if($spoofMethod) + @method($method) +@endif + + {!! $slot !!} +