From 9b767d80d8f0ec4bbb0d100b09aa048136d362a2 Mon Sep 17 00:00:00 2001 From: WilgnerFSDev Date: Wed, 27 Dec 2023 20:52:45 -0300 Subject: [PATCH 01/10] add isLineInput function and variable --- .../views/components/tags-input.blade.php | 1 + packages/forms/src/Components/TagsInput.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/packages/forms/resources/views/components/tags-input.blade.php b/packages/forms/resources/views/components/tags-input.blade.php index bb41d56766..80318ea22e 100644 --- a/packages/forms/resources/views/components/tags-input.blade.php +++ b/packages/forms/resources/views/components/tags-input.blade.php @@ -6,6 +6,7 @@ $isDisabled = $isDisabled(); $isReorderable = $isReorderable(); $statePath = $getStatePath(); + $isInlineInput = $getInlineInput(); @endphp evaluate($this->isReorderable); } + + public function inlineInput(bool | null $inlineInput = true): static + { + $this->inlineInput = $inlineInput; + + return $this; + } + + public function getInlineInput(): bool + { + return (bool) $this->evaluate($this->inlineInput); + } } From 02a01a24602c2f3268237e1ad9b1d9809345adba Mon Sep 17 00:00:00 2001 From: WilgnerFSDev Date: Thu, 28 Dec 2023 15:03:25 -0300 Subject: [PATCH 02/10] Added badge color to tagsInput --- packages/forms/resources/views/components/tags-input.blade.php | 2 ++ packages/forms/src/Components/TagsInput.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/forms/resources/views/components/tags-input.blade.php b/packages/forms/resources/views/components/tags-input.blade.php index 80318ea22e..7018df0883 100644 --- a/packages/forms/resources/views/components/tags-input.blade.php +++ b/packages/forms/resources/views/components/tags-input.blade.php @@ -7,6 +7,7 @@ $isReorderable = $isReorderable(); $statePath = $getStatePath(); $isInlineInput = $getInlineInput(); + $color = $getColor(); @endphp $isReorderable, ]) + :color="$color" > {{ $getTagPrefix() }} diff --git a/packages/forms/src/Components/TagsInput.php b/packages/forms/src/Components/TagsInput.php index e33e7c83cd..23c1d2ed83 100644 --- a/packages/forms/src/Components/TagsInput.php +++ b/packages/forms/src/Components/TagsInput.php @@ -3,6 +3,7 @@ namespace Filament\Forms\Components; use Closure; +use Filament\Support\Concerns\HasColor; use Filament\Support\Concerns\HasExtraAlpineAttributes; use Filament\Support\Concerns\HasReorderAnimationDuration; use Illuminate\Contracts\Support\Arrayable; @@ -14,6 +15,7 @@ class TagsInput extends Field implements Contracts\HasNestedRecursiveValidationR use Concerns\HasPlaceholder; use HasExtraAlpineAttributes; use HasReorderAnimationDuration; + use HasColor; /** * @var view-string From aa9426c93fbf0b912f8b903146576b74543a5a12 Mon Sep 17 00:00:00 2001 From: WilgnerFSDev Date: Thu, 28 Dec 2023 19:09:30 -0300 Subject: [PATCH 03/10] Added inlineInput to TagsInput --- .../views/components/tags-input.blade.php | 52 +++++++++++++------ packages/forms/src/Components/TagsInput.php | 6 +-- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/packages/forms/resources/views/components/tags-input.blade.php b/packages/forms/resources/views/components/tags-input.blade.php index 7018df0883..2ffaab72fb 100644 --- a/packages/forms/resources/views/components/tags-input.blade.php +++ b/packages/forms/resources/views/components/tags-input.blade.php @@ -47,17 +47,19 @@ x-ignore {{ $getExtraAlpineAttributeBag() }} > - + @if(!$isInlineInput) + + @endif @foreach ($getSuggestions() as $suggestion) @@ -65,7 +67,7 @@ x-bind:key="@js($suggestion)" x-if="! state.includes(@js($suggestion))" > - @@ -75,13 +77,13 @@ '[&_.fi-badge-delete-button]:hidden' => $isDisabled, ]) > -
-
diff --git a/packages/forms/src/Components/TagsInput.php b/packages/forms/src/Components/TagsInput.php index 23c1d2ed83..9b73e3a044 100644 --- a/packages/forms/src/Components/TagsInput.php +++ b/packages/forms/src/Components/TagsInput.php @@ -13,9 +13,9 @@ class TagsInput extends Field implements Contracts\HasNestedRecursiveValidationR use Concerns\HasExtraInputAttributes; use Concerns\HasNestedRecursiveValidationRules; use Concerns\HasPlaceholder; + use HasColor; use HasExtraAlpineAttributes; use HasReorderAnimationDuration; - use HasColor; /** * @var view-string @@ -40,7 +40,7 @@ class TagsInput extends Field implements Contracts\HasNestedRecursiveValidationR protected string | Closure | null $tagSuffix = null; - protected bool | null $inlineInput = false; + protected ?bool $inlineInput = false; protected function setUp(): void { @@ -171,7 +171,7 @@ class TagsInput extends Field implements Contracts\HasNestedRecursiveValidationR return (bool) $this->evaluate($this->isReorderable); } - public function inlineInput(bool | null $inlineInput = true): static + public function inlineInput(?bool $inlineInput = true): static { $this->inlineInput = $inlineInput; From 339c10cf5555ded36367e9ee33300b64db5a03cf Mon Sep 17 00:00:00 2001 From: WilgnerFSDev Date: Thu, 28 Dec 2023 19:49:12 -0300 Subject: [PATCH 04/10] tagsinput documentation updated --- .../forms/docs/03-fields/14-tags-input.md | 22 +++++++++++++++++++ .../views/components/tags-input.blade.php | 16 ++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/packages/forms/docs/03-fields/14-tags-input.md b/packages/forms/docs/03-fields/14-tags-input.md index c9b88cfb58..b1e873311d 100644 --- a/packages/forms/docs/03-fields/14-tags-input.md +++ b/packages/forms/docs/03-fields/14-tags-input.md @@ -109,3 +109,25 @@ use Filament\Forms\Components\TagsInput; TagsInput::make('tags') ->reorderable() ``` + +## Changing tag color + +You can change the color of the tags by passing a color to the `color()` method: + +```php +use Filament\Forms\Components\TagsInput; + +TagsInput::make('tags') + ->color('purple') +``` + +## Inline input + +You can change the input to be inline by using the `inlineInput()` method: + +```php +use Filament\Forms\Components\TagsInput; + +TagsInput::make('tags') + ->inlineInput() +``` diff --git a/packages/forms/resources/views/components/tags-input.blade.php b/packages/forms/resources/views/components/tags-input.blade.php index 2ffaab72fb..36c1a1a9d8 100644 --- a/packages/forms/resources/views/components/tags-input.blade.php +++ b/packages/forms/resources/views/components/tags-input.blade.php @@ -47,7 +47,7 @@ x-ignore {{ $getExtraAlpineAttributeBag() }} > - @if(!$isInlineInput) + @if (! $isInlineInput) -