Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
rupadana authored and github-actions[bot] committed Oct 5, 2023
1 parent 6250220 commit bb21854
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 41 deletions.
3 changes: 0 additions & 3 deletions src/Components/Concerns/HasRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace Rupadana\FilamentCustomForms\Components\Concerns;

use Closure;

trait HasRange
{

}
10 changes: 5 additions & 5 deletions src/Components/Concerns/InputSliderBehaviour.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Rupadana\FilamentCustomForms\Components\Concerns;


class InputSliderBehaviour {
class InputSliderBehaviour
{
const DRAG = 'drag';

const DRAGALL = 'drag-all';
Expand All @@ -15,8 +15,8 @@ class InputSliderBehaviour {
const SNAP = 'snap';

const UNCONSTRAINED = 'unconstrained';

const HOVER = 'hover-snap';

const NONE = 'none';
}
}
9 changes: 3 additions & 6 deletions src/Components/InputSlider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -18,5 +16,4 @@ public static function make(string $name): static

return $static;
}

}
}
50 changes: 24 additions & 26 deletions src/Components/InputSliderGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@

namespace Rupadana\FilamentCustomForms\Components;

use Closure;
use Error;
use Filament\Forms\Components\Component;
use Filament\Forms\Components\Concerns\CanBeValidated;
use Filament\Forms\Components\Concerns\HasChildComponents;
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';

Expand All @@ -46,10 +43,10 @@ class InputSliderGroup extends Component
public static function make(): static
{
$static = new static;

Check failure on line 45 in src/Components/InputSliderGroup.php

View workflow job for this annotation

GitHub Actions / phpstan

Unsafe usage of new static().

return $static;
}


/**
* Get the value of max
*/
Expand Down Expand Up @@ -115,7 +112,7 @@ public function step($step)
*/
public function getBehaviour(): string
{
return join("-", $this->behaviour);
return implode('-', $this->behaviour);
}

/**
Expand Down Expand Up @@ -163,7 +160,7 @@ public function getSliders(): array
*
* @return self
*/
public function sliders(array $sliders)
public function sliders(array $sliders)
{
$this->sliders = $sliders;

Expand All @@ -185,7 +182,6 @@ public function getStates(): array
})
->toArray();


return $states;
}

Expand All @@ -198,33 +194,31 @@ 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);
}

/**
* Set the value of connect
*
* @return self
*/
*/
public function connect(array $connect)
{
$this->connect = $connect;
Expand All @@ -234,43 +228,47 @@ 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(),
];
}

/**
* Set the value of range
*
* @return self
*/
*/
public function range(array $range)
{
$this->range = $range;

return $this;
}

public function enableTooltips(bool $condition = true) {
public function enableTooltips(bool $condition = true)
{
$this->isEnableTooltips = $condition;

return $this;
}

/**
* 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);
}
Expand All @@ -279,7 +277,7 @@ public function getTooltips()
* Set the value of tooltips
*
* @return self
*/
*/
public function tooltips(array $tooltips)
{
$this->tooltips = $tooltips;
Expand Down
1 change: 0 additions & 1 deletion src/FilamentCustomFormsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;


class FilamentCustomFormsServiceProvider extends PackageServiceProvider
{
public static string $name = 'filament-custom-forms';
Expand Down

0 comments on commit bb21854

Please sign in to comment.