ConditionalComponentStyle
in package
implements
ConditionalInterface
Conditional properties for component styles.
Allows style properties like backgroundColor, border, and opacity to change based on conditions.
Tags
Table of Contents
Interfaces
- ConditionalInterface
- Interface for all conditional objects.
Properties
- $backgroundColor : string|null
- The background color.
- $border : array<string, mixed>|null
- The border configuration.
- $conditions : array<int, Condition>
- The conditions that must be met.
- $fill : array<string, mixed>|null
- The fill configuration.
- $mask : array<string, mixed>|null
- The mask configuration.
- $opacity : float|null
- The opacity (0.0 to 1.0).
- $shadow : array<string, mixed>|null
- The shadow configuration.
Methods
- addCondition() : $this
- Add a condition.
- darkMode() : self
- Create a dark mode style.
- hasConditions() : bool
- Check if any conditions have been set.
- jsonSerialize() : array<string, mixed>
- {@inheritdoc}
- lightMode() : self
- Create a light mode style.
- setBackgroundColor() : $this
- Set the background color.
- setBorder() : $this
- Set the border configuration.
- setFill() : $this
- Set the fill configuration.
- setMask() : $this
- Set the mask configuration.
- setOpacity() : $this
- Set the opacity.
- setShadow() : $this
- Set the shadow configuration.
Properties
$backgroundColor
The background color.
private
string|null
$backgroundColor
= null
$border
The border configuration.
private
array<string, mixed>|null
$border
= null
$conditions
The conditions that must be met.
private
array<int, Condition>
$conditions
= []
$fill
The fill configuration.
private
array<string, mixed>|null
$fill
= null
$mask
The mask configuration.
private
array<string, mixed>|null
$mask
= null
$opacity
The opacity (0.0 to 1.0).
private
float|null
$opacity
= null
$shadow
The shadow configuration.
private
array<string, mixed>|null
$shadow
= null
Methods
addCondition()
Add a condition.
public
addCondition(Condition $condition) : $this
Parameters
- $condition : Condition
-
The condition to add.
Return values
$thisdarkMode()
Create a dark mode style.
public
static darkMode(string $backgroundColor) : self
Parameters
- $backgroundColor : string
-
The dark mode background color.
Return values
self —A new instance.
hasConditions()
Check if any conditions have been set.
public
hasConditions() : bool
Return values
bool —True if conditions exist.
jsonSerialize()
{@inheritdoc}
public
jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>lightMode()
Create a light mode style.
public
static lightMode(string $backgroundColor) : self
Parameters
- $backgroundColor : string
-
The light mode background color.
Return values
self —A new instance.
setBackgroundColor()
Set the background color.
public
setBackgroundColor(string $color) : $this
Parameters
- $color : string
-
The color in hex format.
Return values
$thissetBorder()
Set the border configuration.
public
setBorder(array<string, mixed> $border) : $this
Parameters
- $border : array<string, mixed>
-
The border configuration.
Return values
$thissetFill()
Set the fill configuration.
public
setFill(array<string, mixed> $fill) : $this
Parameters
- $fill : array<string, mixed>
-
The fill configuration.
Return values
$thissetMask()
Set the mask configuration.
public
setMask(array<string, mixed> $mask) : $this
Parameters
- $mask : array<string, mixed>
-
The mask configuration.
Return values
$thissetOpacity()
Set the opacity.
public
setOpacity(float $opacity) : $this
Parameters
- $opacity : float
-
Opacity from 0.0 to 1.0.
Return values
$thissetShadow()
Set the shadow configuration.
public
setShadow(array<string, mixed> $shadow) : $this
Parameters
- $shadow : array<string, mixed>
-
The shadow configuration.