From 5649fc73a6406abf446b3370cfe1b2d230fd733b Mon Sep 17 00:00:00 2001 From: Johan Montenij Date: Fri, 31 Mar 2023 15:05:18 +0200 Subject: [PATCH 1/5] Version bump (Vite 4.0) --- src/Commands/SpladeInstallCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Commands/SpladeInstallCommand.php b/src/Commands/SpladeInstallCommand.php index 86278ef7..4666668c 100644 --- a/src/Commands/SpladeInstallCommand.php +++ b/src/Commands/SpladeInstallCommand.php @@ -35,10 +35,10 @@ public function handle(): int '@tailwindcss/typography' => '^0.5.2', '@vitejs/plugin-vue' => '^3.0.0', 'autoprefixer' => '^10.4.7', - 'laravel-vite-plugin' => '^0.5.0', + 'laravel-vite-plugin' => '^0.7.2', 'postcss' => '^8.4.14', 'tailwindcss' => '^3.1.0', - 'vite' => '^3.0.0', + 'vite' => '^4.0.0', 'vue' => '^3.2.37', ] + $packages; }); From 5f02b77c7a7353da7fd8057949c9a9779d3e5af2 Mon Sep 17 00:00:00 2001 From: Johan Montenij Date: Fri, 31 Mar 2023 15:18:55 +0200 Subject: [PATCH 2/5] Version bump (Vite 4.0 / vitejs/plugin-vue) --- src/Commands/SpladeInstallCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/SpladeInstallCommand.php b/src/Commands/SpladeInstallCommand.php index 4666668c..74a3c0ce 100644 --- a/src/Commands/SpladeInstallCommand.php +++ b/src/Commands/SpladeInstallCommand.php @@ -33,7 +33,7 @@ public function handle(): int '@protonemedia/laravel-splade' => '^1.4.7', '@tailwindcss/forms' => '^0.5.2', '@tailwindcss/typography' => '^0.5.2', - '@vitejs/plugin-vue' => '^3.0.0', + '@vitejs/plugin-vue' => '^4.1.0', 'autoprefixer' => '^10.4.7', 'laravel-vite-plugin' => '^0.7.2', 'postcss' => '^8.4.14', From 27c8d1d57031297da8b1c23ac1af35ce9a794122 Mon Sep 17 00:00:00 2001 From: Johan Montenij Date: Sun, 2 Apr 2023 17:12:28 +0200 Subject: [PATCH 3/5] Added a wrapper around submit buttons --- resources/views/form/submit.blade.php | 54 ++++++++++++++------------- src/Components/Form/Submit.php | 1 + src/FormBuilder/Button.php | 39 ++++++++++++++----- 3 files changed, 58 insertions(+), 36 deletions(-) diff --git a/resources/views/form/submit.blade.php b/resources/views/form/submit.blade.php index 2d1d03f0..8ab2fa92 100644 --- a/resources/views/form/submit.blade.php +++ b/resources/views/form/submit.blade.php @@ -1,29 +1,31 @@ @php $customStyling = $hasCustomStyling($attributes) @endphp - \ No newline at end of file + + {{ $label }} + + + @endif + + diff --git a/src/Components/Form/Submit.php b/src/Components/Form/Submit.php index ca29f858..a5e08c13 100644 --- a/src/Components/Form/Submit.php +++ b/src/Components/Form/Submit.php @@ -27,6 +27,7 @@ public function __construct( public $value = null, public $danger = false, public $secondary = false, + public string $parentClasses = '', ) { $this->primary = !$this->danger && !$this->secondary; } diff --git a/src/FormBuilder/Button.php b/src/FormBuilder/Button.php index bc2b199d..d0c41b9e 100644 --- a/src/FormBuilder/Button.php +++ b/src/FormBuilder/Button.php @@ -2,6 +2,7 @@ namespace ProtoneMedia\Splade\FormBuilder; +use Illuminate\Support\Arr; use ProtoneMedia\Splade\Components\Form\Submit as SpladeSubmit; use ProtoneMedia\Splade\FormBuilder\Concerns\HasValue; @@ -11,6 +12,8 @@ class Button extends Component protected bool $danger = false; + protected string $parentClasses = ''; + protected bool $secondary = false; protected bool $spinner = true; @@ -18,7 +21,7 @@ class Button extends Component protected string $type = 'button'; /** - * Applies danger-styling to the button + * Applies danger-styling to the button. * * @return $this */ @@ -30,9 +33,24 @@ public function danger(bool $danger = true): self } /** - * Applies secondary-styling to the button + * Add one or more classes to the fields' wrapper. + * + * @param array|string $classes + * @return $this + */ + public function parentClass(...$classes): self + { + $classes = Arr::flatten($classes); + + $this->parentClasses = Arr::toCssClasses($classes); + + return $this; + } + + /** + * Applies secondary-styling to the button. * - * @param bool $danger + * @param bool $secondary * @return $this */ public function secondary(bool $secondary = true): self @@ -50,13 +68,14 @@ public function secondary(bool $secondary = true): self public function toSpladeComponent() { return new SpladeSubmit( - label: $this->label, - type: $this->type, - spinner: $this->spinner, - name: $this->name, - value: $this->value ?? null, - danger: $this->danger, - secondary: $this->secondary + label: $this->label, + type: $this->type, + spinner: $this->spinner, + name: $this->name, + value: $this->value ?? null, + danger: $this->danger, + secondary: $this->secondary, + parentClasses: $this->parentClasses ); } } From ad116047d891aa617f3c79178426d6edd87d8d42 Mon Sep 17 00:00:00 2001 From: Johan Montenij Date: Sun, 2 Apr 2023 17:13:51 +0200 Subject: [PATCH 4/5] Added a wrapper around submit buttons - revert SpladeInstallCommand changes --- src/Commands/SpladeInstallCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Commands/SpladeInstallCommand.php b/src/Commands/SpladeInstallCommand.php index 74a3c0ce..86278ef7 100644 --- a/src/Commands/SpladeInstallCommand.php +++ b/src/Commands/SpladeInstallCommand.php @@ -33,12 +33,12 @@ public function handle(): int '@protonemedia/laravel-splade' => '^1.4.7', '@tailwindcss/forms' => '^0.5.2', '@tailwindcss/typography' => '^0.5.2', - '@vitejs/plugin-vue' => '^4.1.0', + '@vitejs/plugin-vue' => '^3.0.0', 'autoprefixer' => '^10.4.7', - 'laravel-vite-plugin' => '^0.7.2', + 'laravel-vite-plugin' => '^0.5.0', 'postcss' => '^8.4.14', 'tailwindcss' => '^3.1.0', - 'vite' => '^4.0.0', + 'vite' => '^3.0.0', 'vue' => '^3.2.37', ] + $packages; }); From 07c201175f38246acf9be1a2a17c171c0ed3acb0 Mon Sep 17 00:00:00 2001 From: Pascal Baljet Date: Wed, 14 Jun 2023 16:32:13 +0200 Subject: [PATCH 5/5] Renamed `parentClasses` to `wrapperClass` --- resources/views/form/submit.blade.php | 2 +- src/Components/Form/Submit.php | 2 +- src/FormBuilder/Button.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/views/form/submit.blade.php b/resources/views/form/submit.blade.php index 8ab2fa92..b46fbb21 100644 --- a/resources/views/form/submit.blade.php +++ b/resources/views/form/submit.blade.php @@ -1,6 +1,6 @@ @php $customStyling = $hasCustomStyling($attributes) @endphp -
+