merge()
+ ->class(['flex-col' => $isTailwind && ($toolsAttributes['default-styling'] ?? true)])
+ ->class(['d-flex flex-column' => $isBootstrap && ($toolsAttributes['default-styling'] ?? true)])
+ ->except(['default','default-styling','default-colors'])
+ }}
+>
{{ $slot }}
diff --git a/resources/views/components/tools/toolbar.blade.php b/resources/views/components/tools/toolbar.blade.php
index 8a3c8901b..65e8c086b 100644
--- a/resources/views/components/tools/toolbar.blade.php
+++ b/resources/views/components/tools/toolbar.blade.php
@@ -1,10 +1,14 @@
@aware(['component', 'tableName','isTailwind','isBootstrap'])
@props([])
+@php($toolBarAttributes = $this->getToolBarAttributesBag())
-
$this->isBootstrap,
- 'md:flex md:justify-between mb-4 px-4 md:p-0' => $this->isTailwind,
- ])
+
merge()
+ ->class(['md:flex md:justify-between mb-4 px-4 md:p-0' => $isTailwind && ($toolBarAttributes['default-styling'] ?? true)])
+ ->class(['d-md-flex justify-content-between mb-3' => $isBootstrap && ($toolBarAttributes['default-styling'] ?? true)])
+ ->except(['default','default-styling','default-colors'])
+ }}
>
$this->isBootstrap,
@@ -52,9 +56,7 @@
'md:flex md:items-center space-y-4 md:space-y-0 md:space-x-2' => $this->isTailwind,
])
>
- @if ($this->hasConfigurableAreaFor('toolbar-right-start'))
- @include($this->getConfigurableAreaFor('toolbar-right-start'), $this->getParametersForConfigurableArea('toolbar-right-start'))
- @endif
+ @includeWhen($this->hasConfigurableAreaFor('toolbar-right-start'), $this->getConfigurableAreaFor('toolbar-right-start'), $this->getParametersForConfigurableArea('toolbar-right-start'))
@if($this->hasActions && $this->showActionsInToolbar && $this->getActionsPosition == 'right')
@@ -72,9 +74,7 @@
@endif
- @if ($this->hasConfigurableAreaFor('toolbar-right-end'))
- @include($this->getConfigurableAreaFor('toolbar-right-end'), $this->getParametersForConfigurableArea('toolbar-right-end'))
- @endif
+ @includeWhen($this->hasConfigurableAreaFor('toolbar-right-end'), $this->getConfigurableAreaFor('toolbar-right-end'), $this->getParametersForConfigurableArea('toolbar-right-end'))
@if (
diff --git a/src/Traits/Styling/Configuration/ToolsStylingConfiguration.php b/src/Traits/Styling/Configuration/ToolsStylingConfiguration.php
new file mode 100644
index 000000000..27679f04b
--- /dev/null
+++ b/src/Traits/Styling/Configuration/ToolsStylingConfiguration.php
@@ -0,0 +1,20 @@
+setCustomAttributes(propertyName: 'toolsAttributes', customAttributes: $toolsAttributes);
+
+ return $this;
+ }
+
+ public function setToolBarAttributes(array $toolBarAttributes = []): self
+ {
+ $this->setCustomAttributes(propertyName: 'toolBarAttributes', customAttributes: $toolBarAttributes);
+
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/src/Traits/Styling/HasToolsStyling.php b/src/Traits/Styling/HasToolsStyling.php
new file mode 100644
index 000000000..d5bab60ec
--- /dev/null
+++ b/src/Traits/Styling/HasToolsStyling.php
@@ -0,0 +1,17 @@
+ true, 'default-colors' => true, 'class' => ''];
+
+ protected array $toolBarAttributes = ['default-styling' => true, 'default-colors' => true, 'class' => ''];
+
+}
diff --git a/src/Traits/Styling/Helpers/ToolsStylingHelpers.php b/src/Traits/Styling/Helpers/ToolsStylingHelpers.php
new file mode 100644
index 000000000..2b9f152d7
--- /dev/null
+++ b/src/Traits/Styling/Helpers/ToolsStylingHelpers.php
@@ -0,0 +1,33 @@
+getCustomAttributes(propertyName: 'toolsAttributes', default: false, classicMode: false);
+ }
+
+ #[Computed]
+ public function getToolsAttributesBag(): ComponentAttributeBag
+ {
+ return $this->getCustomAttributesBagFromArray($this->getToolsAttributes());
+ }
+
+ protected function getToolBarAttributes(): array
+ {
+ return $this->getCustomAttributes(propertyName: 'toolBarAttributes', default: false, classicMode: false);
+ }
+
+ #[Computed]
+ public function getToolBarAttributesBag(): ComponentAttributeBag
+ {
+ return $this->getCustomAttributesBagFromArray($this->getToolBarAttributes());
+
+ }
+}
\ No newline at end of file
diff --git a/src/Traits/WithTools.php b/src/Traits/WithTools.php
index 31d91a57a..1c81fde6b 100644
--- a/src/Traits/WithTools.php
+++ b/src/Traits/WithTools.php
@@ -4,13 +4,17 @@
use Rappasoft\LaravelLivewireTables\Traits\Configuration\ToolsConfiguration;
use Rappasoft\LaravelLivewireTables\Traits\Helpers\ToolsHelpers;
+use Rappasoft\LaravelLivewireTables\Traits\Styling\HasToolsStyling;
trait WithTools
{
use ToolsConfiguration,
- ToolsHelpers;
+ ToolsHelpers,
+ HasToolsStyling;
protected bool $toolsStatus = true;
protected bool $toolBarStatus = true;
+
+
}
diff --git a/tests/Traits/Helpers/ToolsStylingHelpersTest.php b/tests/Traits/Helpers/ToolsStylingHelpersTest.php
new file mode 100644
index 000000000..b56a0fe13
--- /dev/null
+++ b/tests/Traits/Helpers/ToolsStylingHelpersTest.php
@@ -0,0 +1,29 @@
+assertTrue($this->basicTable->hasCustomAttributes('toolsAttributes'));
+ }
+
+ public function test_can_get_tools_attributes_initial_values(): void
+ {
+ $this->assertSame(['default-styling' => true, 'default-colors' => true, 'class' => ''], $this->basicTable->getToolsAttributesBag()->getAttributes());
+ }
+
+ public function test_can_get_toolbar_attributes_initial_status(): void
+ {
+ $this->assertTrue($this->basicTable->hasCustomAttributes('toolBarAttributes'));
+ }
+
+ public function test_can_get_toolbar_attributes_initial_values(): void
+ {
+ $this->assertSame(['default-styling' => true, 'default-colors' => true, 'class' => ''], $this->basicTable->getToolBarAttributesBag()->getAttributes());
+ }
+
+}
\ No newline at end of file