diff --git a/src/Components/Concerns/HasRange.php b/src/Components/Concerns/HasRange.php index d6cfb26..23d779f 100644 --- a/src/Components/Concerns/HasRange.php +++ b/src/Components/Concerns/HasRange.php @@ -2,9 +2,6 @@ namespace Rupadana\FilamentCustomForms\Components\Concerns; -use Closure; - trait HasRange { - } diff --git a/src/Components/Concerns/InputSliderBehaviour.php b/src/Components/Concerns/InputSliderBehaviour.php index b6e7bf5..0cff68f 100644 --- a/src/Components/Concerns/InputSliderBehaviour.php +++ b/src/Components/Concerns/InputSliderBehaviour.php @@ -2,8 +2,8 @@ namespace Rupadana\FilamentCustomForms\Components\Concerns; - -class InputSliderBehaviour { +class InputSliderBehaviour +{ const DRAG = 'drag'; const DRAGALL = 'drag-all'; @@ -15,8 +15,8 @@ class InputSliderBehaviour { const SNAP = 'snap'; const UNCONSTRAINED = 'unconstrained'; - + const HOVER = 'hover-snap'; - + const NONE = 'none'; -} \ No newline at end of file +} diff --git a/src/Components/InputSlider.php b/src/Components/InputSlider.php index 92ca1a7..40f4669 100644 --- a/src/Components/InputSlider.php +++ b/src/Components/InputSlider.php @@ -2,12 +2,10 @@ namespace Rupadana\FilamentCustomForms\Components; -use Closure; -use Filament\Forms\Components\Component; -use Filament\Forms\Components\Concerns\HasLabel; use Filament\Forms\Components\Field; -class InputSlider extends Field { +class InputSlider extends Field +{ protected string $view = 'filament-custom-forms::components.hidden-input'; public static function make(string $name): static @@ -18,5 +16,4 @@ public static function make(string $name): static return $static; } - -} \ No newline at end of file +} diff --git a/src/Components/InputSliderGroup.php b/src/Components/InputSliderGroup.php index 83b1c98..7ae7cb1 100644 --- a/src/Components/InputSliderGroup.php +++ b/src/Components/InputSliderGroup.php @@ -2,7 +2,6 @@ namespace Rupadana\FilamentCustomForms\Components; -use Closure; use Error; use Filament\Forms\Components\Component; use Filament\Forms\Components\Concerns\CanBeValidated; @@ -10,16 +9,14 @@ use Filament\Forms\Components\Concerns\HasHelperText; use Filament\Forms\Components\Concerns\HasHint; use Filament\Forms\Components\Concerns\HasLabel; -use Filament\Forms\Components\Field; -use Illuminate\Support\Arr; class InputSliderGroup extends Component { - use HasLabel; - use HasHelperText; - use HasHint; use CanBeValidated; use HasChildComponents; + use HasHelperText; + use HasHint; + use HasLabel; protected string $view = 'filament-custom-forms::components.input-slider'; @@ -46,10 +43,10 @@ class InputSliderGroup extends Component public static function make(): static { $static = new static; + return $static; } - /** * Get the value of max */ @@ -115,7 +112,7 @@ public function step($step) */ public function getBehaviour(): string { - return join("-", $this->behaviour); + return implode('-', $this->behaviour); } /** @@ -163,7 +160,7 @@ public function getSliders(): array * * @return self */ - public function sliders(array $sliders) + public function sliders(array $sliders) { $this->sliders = $sliders; @@ -185,7 +182,6 @@ public function getStates(): array }) ->toArray(); - return $states; } @@ -198,25 +194,23 @@ public function getStart(): array }) ->toArray(); - return $start; } /** * Get the value of connect - */ + */ public function getConnect() { - if($this->connect) { - if(!(count($this->connect) == count($this->getSliders()) + 1)) { - throw new Error("connect property must be total sliders + 1 "); + if ($this->connect) { + if (! (count($this->connect) == count($this->getSliders()) + 1)) { + throw new Error('connect property must be total sliders + 1 '); } return $this->connect; } - return array_fill(0, count($this->getSliders()) + 1, false); } @@ -224,7 +218,7 @@ public function getConnect() * Set the value of connect * * @return self - */ + */ public function connect(array $connect) { $this->connect = $connect; @@ -234,14 +228,16 @@ public function connect(array $connect) /** * Get the value of range - */ + */ public function getRange() { - if($this->range) return $this->range; + if ($this->range) { + return $this->range; + } return [ 'min' => $this->getMin(), - 'max' => $this->getMax() + 'max' => $this->getMax(), ]; } @@ -249,7 +245,7 @@ public function getRange() * Set the value of range * * @return self - */ + */ public function range(array $range) { $this->range = $range; @@ -257,7 +253,8 @@ public function range(array $range) return $this; } - public function enableTooltips(bool $condition = true) { + public function enableTooltips(bool $condition = true) + { $this->isEnableTooltips = $condition; return $this; @@ -265,12 +262,13 @@ public function enableTooltips(bool $condition = true) { /** * Get the value of tooltips - */ + */ public function getTooltips() { - if($this->tooltips) return $this->tooltips; - + if ($this->tooltips) { + return $this->tooltips; + } return array_fill(0, count($this->getSliders()), $this->isEnableTooltips); } @@ -279,7 +277,7 @@ public function getTooltips() * Set the value of tooltips * * @return self - */ + */ public function tooltips(array $tooltips) { $this->tooltips = $tooltips; diff --git a/src/FilamentCustomFormsServiceProvider.php b/src/FilamentCustomFormsServiceProvider.php index fd5682c..011b953 100644 --- a/src/FilamentCustomFormsServiceProvider.php +++ b/src/FilamentCustomFormsServiceProvider.php @@ -16,7 +16,6 @@ use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; - class FilamentCustomFormsServiceProvider extends PackageServiceProvider { public static string $name = 'filament-custom-forms';