diff --git a/packages/actions/src/Concerns/CanOpenModal.php b/packages/actions/src/Concerns/CanOpenModal.php index c259ede21e..425f71a3e9 100644 --- a/packages/actions/src/Concerns/CanOpenModal.php +++ b/packages/actions/src/Concerns/CanOpenModal.php @@ -86,7 +86,7 @@ trait CanOpenModal protected string | Closure | null $modalIcon = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $modalIconColor = null; @@ -145,7 +145,7 @@ trait CanOpenModal } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function modalIconColor(string | array | Closure | null $color = null): static { @@ -691,7 +691,7 @@ trait CanOpenModal } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getModalIconColor(): string | array | null { diff --git a/packages/forms/src/Components/Concerns/HasAffixes.php b/packages/forms/src/Components/Concerns/HasAffixes.php index 175f427cb6..c6833e07cc 100644 --- a/packages/forms/src/Components/Concerns/HasAffixes.php +++ b/packages/forms/src/Components/Concerns/HasAffixes.php @@ -37,14 +37,14 @@ trait HasAffixes protected string | Closure | null $prefixIcon = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $prefixIconColor = null; protected string | Closure | null $suffixIcon = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $suffixIconColor = null; @@ -138,7 +138,7 @@ trait HasAffixes } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function prefixIconColor(string | array | Closure | null $color = null): static { @@ -156,7 +156,7 @@ trait HasAffixes } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function suffixIconColor(string | array | Closure | null $color = null): static { @@ -242,7 +242,7 @@ trait HasAffixes } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getPrefixIconColor(): string | array | null { @@ -250,7 +250,7 @@ trait HasAffixes } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getSuffixIconColor(): string | array | null { diff --git a/packages/forms/src/Components/Concerns/HasColors.php b/packages/forms/src/Components/Concerns/HasColors.php index de604b0ac5..b881f5489b 100644 --- a/packages/forms/src/Components/Concerns/HasColors.php +++ b/packages/forms/src/Components/Concerns/HasColors.php @@ -10,12 +10,12 @@ use UnitEnum; trait HasColors { /** - * @var array | Arrayable | Closure | null + * @var array | null> | Arrayable | Closure | null */ protected array | Arrayable | Closure | null $colors = null; /** - * @param array | Arrayable | Closure | null $colors + * @param array | null> | Arrayable | Closure | null $colors */ public function colors(array | Arrayable | Closure | null $colors): static { @@ -25,7 +25,7 @@ trait HasColors } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getColor(mixed $value): string | array | null { @@ -33,7 +33,7 @@ trait HasColors } /** - * @return array + * @return array | null> */ public function getColors(): array { diff --git a/packages/forms/src/Components/Concerns/HasHint.php b/packages/forms/src/Components/Concerns/HasHint.php index 07cad57033..e8328a11ae 100644 --- a/packages/forms/src/Components/Concerns/HasHint.php +++ b/packages/forms/src/Components/Concerns/HasHint.php @@ -20,7 +20,7 @@ trait HasHint protected array $hintActions = []; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $hintColor = null; @@ -62,7 +62,7 @@ trait HasHint } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function hintColor(string | array | Closure | null $color): static { @@ -112,7 +112,7 @@ trait HasHint } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getHintColor(): string | array | null { diff --git a/packages/forms/src/Components/Concerns/HasToggleColors.php b/packages/forms/src/Components/Concerns/HasToggleColors.php index 57cb6222e2..e8a0bf83e2 100644 --- a/packages/forms/src/Components/Concerns/HasToggleColors.php +++ b/packages/forms/src/Components/Concerns/HasToggleColors.php @@ -7,17 +7,17 @@ use Closure; trait HasToggleColors { /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $offColor = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $onColor = null; /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function offColor(string | array | Closure | null $color): static { @@ -27,7 +27,7 @@ trait HasToggleColors } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function onColor(string | array | Closure | null $color): static { @@ -37,7 +37,7 @@ trait HasToggleColors } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getOffColor(): string | array | null { @@ -45,7 +45,7 @@ trait HasToggleColors } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getOnColor(): string | array | null { diff --git a/packages/infolists/src/Components/Concerns/HasColor.php b/packages/infolists/src/Components/Concerns/HasColor.php index 29993c9104..ade4cbcd47 100644 --- a/packages/infolists/src/Components/Concerns/HasColor.php +++ b/packages/infolists/src/Components/Concerns/HasColor.php @@ -9,12 +9,12 @@ use Filament\Support\Contracts\HasColor as ColorInterface; trait HasColor { /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | bool | Closure | null + * @var string | array | bool | Closure | null */ protected string | array | bool | Closure | null $color = null; /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | bool | Closure | null $color + * @param string | array | bool | Closure | null $color */ public function color(string | array | bool | Closure | null $color): static { @@ -50,7 +50,7 @@ trait HasColor } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getColor(mixed $state): string | array | null { diff --git a/packages/infolists/src/Components/Concerns/HasHint.php b/packages/infolists/src/Components/Concerns/HasHint.php index 153b21c72c..38c12740be 100644 --- a/packages/infolists/src/Components/Concerns/HasHint.php +++ b/packages/infolists/src/Components/Concerns/HasHint.php @@ -19,7 +19,7 @@ trait HasHint protected array $hintActions = []; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $hintColor = null; @@ -61,7 +61,7 @@ trait HasHint } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function hintColor(string | array | Closure | null $color): static { @@ -111,7 +111,7 @@ trait HasHint } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getHintColor(): string | array | null { diff --git a/packages/infolists/src/Components/Concerns/HasIconColor.php b/packages/infolists/src/Components/Concerns/HasIconColor.php index 4effff317d..a7447c7173 100644 --- a/packages/infolists/src/Components/Concerns/HasIconColor.php +++ b/packages/infolists/src/Components/Concerns/HasIconColor.php @@ -7,12 +7,12 @@ use Closure; trait HasIconColor { /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $iconColor = null; /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function iconColor(string | array | Closure | null $color): static { @@ -22,7 +22,7 @@ trait HasIconColor } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getIconColor(mixed $state): string | array | null { diff --git a/packages/infolists/src/Components/IconEntry.php b/packages/infolists/src/Components/IconEntry.php index 3c847463e4..cafeffd844 100644 --- a/packages/infolists/src/Components/IconEntry.php +++ b/packages/infolists/src/Components/IconEntry.php @@ -23,14 +23,14 @@ class IconEntry extends Entry protected bool | Closure | null $isBoolean = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $falseColor = null; protected string | Closure | null $falseIcon = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $trueColor = null; @@ -46,7 +46,7 @@ class IconEntry extends Entry } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function false(string | Closure | null $icon = null, string | array | Closure | null $color = null): static { @@ -57,7 +57,7 @@ class IconEntry extends Entry } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function falseColor(string | array | Closure | null $color): static { @@ -76,7 +76,7 @@ class IconEntry extends Entry } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function true(string | Closure | null $icon = null, string | array | Closure | null $color = null): static { @@ -87,7 +87,7 @@ class IconEntry extends Entry } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function trueColor(string | array | Closure | null $color): static { @@ -137,7 +137,7 @@ class IconEntry extends Entry } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getColor(mixed $state): string | array | null { @@ -157,7 +157,7 @@ class IconEntry extends Entry } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} + * @return string | array */ public function getFalseColor(): string | array { @@ -172,7 +172,7 @@ class IconEntry extends Entry } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} + * @return string | array */ public function getTrueColor(): string | array { diff --git a/packages/notifications/src/Concerns/HasIconColor.php b/packages/notifications/src/Concerns/HasIconColor.php index 9fb55bb350..7d736fa7dd 100644 --- a/packages/notifications/src/Concerns/HasIconColor.php +++ b/packages/notifications/src/Concerns/HasIconColor.php @@ -11,7 +11,7 @@ trait HasIconColor } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getIconColor(): string | array | null { diff --git a/packages/panels/src/AvatarProviders/UiAvatarsProvider.php b/packages/panels/src/AvatarProviders/UiAvatarsProvider.php index 78abb244f2..990a623bbe 100644 --- a/packages/panels/src/AvatarProviders/UiAvatarsProvider.php +++ b/packages/panels/src/AvatarProviders/UiAvatarsProvider.php @@ -18,6 +18,6 @@ class UiAvatarsProvider implements Contracts\AvatarProvider ->map(fn (string $segment): string => filled($segment) ? mb_substr($segment, 0, 1) : '') ->join(' '); - return 'https://ui-avatars.com/api/?name=' . urlencode($name) . '&color=FFFFFF&background=' . FilamentColor::getColor('gray')[950] ?? Color::Gray[950]; + return 'https://ui-avatars.com/api/?name=' . urlencode($name) . '&color=FFFFFF&background=' . (FilamentColor::getColor('gray')[950] ?? Color::Gray[950]); } } diff --git a/packages/panels/src/Navigation/MenuItem.php b/packages/panels/src/Navigation/MenuItem.php index 4d7e59d052..011ee76166 100644 --- a/packages/panels/src/Navigation/MenuItem.php +++ b/packages/panels/src/Navigation/MenuItem.php @@ -14,7 +14,7 @@ use Laravel\SerializableClosure\Serializers\Native; class MenuItem extends Component { /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $color = null; @@ -45,7 +45,7 @@ class MenuItem extends Component } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function color(string | array | Closure | null $color): static { @@ -126,7 +126,7 @@ class MenuItem extends Component } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getColor(): string | array | null { diff --git a/packages/panels/src/Navigation/NavigationItem.php b/packages/panels/src/Navigation/NavigationItem.php index 7b512a6c79..3d439dc0f0 100644 --- a/packages/panels/src/Navigation/NavigationItem.php +++ b/packages/panels/src/Navigation/NavigationItem.php @@ -25,7 +25,7 @@ class NavigationItem extends Component protected string | Closure | null $badge = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $badgeColor = null; @@ -62,7 +62,7 @@ class NavigationItem extends Component } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function badge(string | Closure | null $badge, string | array | Closure | null $color = null): static { @@ -163,7 +163,7 @@ class NavigationItem extends Component } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getBadgeColor(): string | array | null { diff --git a/packages/panels/src/Pages/Page.php b/packages/panels/src/Pages/Page.php index 55f98818c8..6d3c39d41e 100644 --- a/packages/panels/src/Pages/Page.php +++ b/packages/panels/src/Pages/Page.php @@ -185,7 +185,7 @@ abstract class Page extends BasePage } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public static function getNavigationBadgeColor(): string | array | null { diff --git a/packages/panels/src/Panel/Concerns/HasColors.php b/packages/panels/src/Panel/Concerns/HasColors.php index 7cc49bfe4e..878b70f489 100644 --- a/packages/panels/src/Panel/Concerns/HasColors.php +++ b/packages/panels/src/Panel/Concerns/HasColors.php @@ -7,12 +7,12 @@ use Closure; trait HasColors { /** - * @var array | Closure> + * @var array | string> | Closure> */ protected array $colors = []; /** - * @param array | Closure $colors + * @param array | string> | Closure $colors */ public function colors(array | Closure $colors): static { @@ -22,7 +22,7 @@ trait HasColors } /** - * @return array + * @return array | string> */ public function getColors(): array { diff --git a/packages/panels/src/Resources/Resource/Concerns/HasNavigation.php b/packages/panels/src/Resources/Resource/Concerns/HasNavigation.php index 0d90496029..fffa94b0d2 100644 --- a/packages/panels/src/Resources/Resource/Concerns/HasNavigation.php +++ b/packages/panels/src/Resources/Resource/Concerns/HasNavigation.php @@ -140,7 +140,7 @@ trait HasNavigation } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public static function getNavigationBadgeColor(): string | array | null { diff --git a/packages/support/resources/css/components/button.css b/packages/support/resources/css/components/button.css index 7f5ab8644a..a82cf3f064 100644 --- a/packages/support/resources/css/components/button.css +++ b/packages/support/resources/css/components/button.css @@ -50,10 +50,10 @@ } &.fi-color { - @apply text-(--color-gray-100-text) ring-color-600 dark:text-(--color-gray-700-text) dark:ring-color-500; + @apply ring-color-600 dark:ring-color-500 text-(--color-gray-100-text) dark:text-(--color-gray-700-text); &:not(.fi-disabled):not([disabled]) { - @apply hover:bg-(--hover-bg)/10 dark:hover:bg-(--dark-hover-bg)/10 focus-visible:ring-color-500/40 dark:focus-visible:ring-color-400/40; + @apply focus-visible:ring-color-500/40 dark:focus-visible:ring-color-400/40 hover:bg-(--hover-bg)/10 dark:hover:bg-(--dark-hover-bg)/10; } & > .fi-icon { @@ -79,10 +79,10 @@ &.fi-color { &:not(label) { - @apply bg-(--bg) dark:bg-(--dark-bg) text-(--text) dark:text-(--dark-text); + @apply bg-(--bg) text-(--text) dark:bg-(--dark-bg) dark:text-(--dark-text); &:not(.fi-disabled):not([disabled]) { - @apply hover:bg-(--hover-bg) hover:text-(--hover-text) focus-visible:ring-color-500/50 dark:hover:bg-(--dark-hover-bg) dark:hover:text-(--dark-hover-text) dark:focus-visible:ring-color-400/50; + @apply focus-visible:ring-color-500/50 dark:focus-visible:ring-color-400/50 hover:bg-(--hover-bg) hover:text-(--hover-text) dark:hover:bg-(--dark-hover-bg) dark:hover:text-(--dark-hover-text); } & > .fi-icon { @@ -92,12 +92,12 @@ &label { input:checked + & { - @apply bg-(--bg) dark:bg-(--dark-bg) text-(--text) dark:text-(--dark-text) ring-0; + @apply bg-(--bg) text-(--text) ring-0 dark:bg-(--dark-bg) dark:text-(--dark-text); } &:not(.fi-disabled):not([disabled]) { input:checked + & { - @apply hover:bg-(--hover-bg) dark:hover:bg-(--dark-hover-bg) hover:text-(--hover-text) dark:hover:text-(--dark-hover-text); + @apply hover:bg-(--hover-bg) hover:text-(--hover-text) dark:hover:bg-(--dark-hover-bg) dark:hover:text-(--dark-hover-text); } input:focus-visible + & { diff --git a/packages/support/resources/views/components/button/index.blade.php b/packages/support/resources/views/components/button/index.blade.php index 90f835ef87..955ef14455 100644 --- a/packages/support/resources/views/components/button/index.blade.php +++ b/packages/support/resources/views/components/button/index.blade.php @@ -129,7 +129,7 @@ ($size instanceof ActionSize) ? "fi-size-{$size->value}" : (is_string($size) ? $size : ''), is_string($labeledFrom) ? "fi-labeled-from-{$labeledFrom}" : null, ]) - ->color($color, Button::class) + ->color(Button::class, $color) }} > @if ($iconPosition === IconPosition::Before) diff --git a/packages/support/src/Assets/AssetManager.php b/packages/support/src/Assets/AssetManager.php index ca83b8c00e..0f98f90606 100644 --- a/packages/support/src/Assets/AssetManager.php +++ b/packages/support/src/Assets/AssetManager.php @@ -3,7 +3,6 @@ namespace Filament\Support\Assets; use Exception; -use Filament\Support\Colors\Color; use Filament\Support\Facades\FilamentColor; use Illuminate\Support\Arr; @@ -286,6 +285,9 @@ class AssetManager ])->render(); } + /** + * @param array $palette + */ protected function resolveColorShadeFromPalette(array $palette, string | int $shade): string { $color = $palette[$shade]; diff --git a/packages/support/src/Colors/Color.php b/packages/support/src/Colors/Color.php index cd5771d549..78e655c9f1 100644 --- a/packages/support/src/Colors/Color.php +++ b/packages/support/src/Colors/Color.php @@ -956,8 +956,8 @@ class Color } /** - * @param array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} $palette - * @return array{50-text: int, 100-text: int, 200-text: int, 300-text: int, 400-text: int, 500-text: int, 600-text: int, 700-text: int, 800-text: int, 900-text: int, 950-text: int} + * @param array $palette + * @return array */ public static function findMatchingAccessibleTextColorsForBackgroundColors(array $palette): array { @@ -1003,8 +1003,8 @@ class Color } /** - * @param array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} $palette - * @return array{white-text: int, gray-50-text: int, gray-100-text: int, gray-200-text: int, gray-300-text: int, gray-400-text: int, gray-500-text: int, gray-600-text: int, gray-700-text: int, gray-800-text: int, gray-900-text: int, gray-950-text: int} + * @param array $palette + * @return array */ public static function findMatchingAccessibleTextColorsForGrayBackgroundColors(array $palette): array { @@ -1083,7 +1083,7 @@ class Color } /** - * @return array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} + * @return array */ public static function hex(string $color): array { @@ -1091,7 +1091,7 @@ class Color } /** - * @return array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} + * @return array */ public static function rgb(string $color): array { @@ -1099,13 +1099,13 @@ class Color } /** - * @return array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} + * @return array */ public static function generatePalette(string $color): array { $color = static::convertToOklch($color); - [$originalLightness, $chroma, $hue] = sscanf($color, 'oklch(%f %f %f)'); + [, $chroma, $hue] = sscanf($color, 'oklch(%f %f %f)'); return array_map( fn (float $lightness): string => "oklch({$lightness} {$chroma} {$hue})", @@ -1126,7 +1126,7 @@ class Color } /** - * @return array + * @return array> */ public static function all(): array { diff --git a/packages/support/src/Colors/ColorManager.php b/packages/support/src/Colors/ColorManager.php index fe8ba9c7f0..bc63acae9e 100644 --- a/packages/support/src/Colors/ColorManager.php +++ b/packages/support/src/Colors/ColorManager.php @@ -4,10 +4,9 @@ namespace Filament\Support\Colors; use Closure; use Filament\Support\Concerns\EvaluatesClosures; -use Filament\Support\Facades\FilamentColor; -use Filament\Support\View\Components\Contracts\DoesNotHaveGrayColor; +use Filament\Support\View\Components\Contracts\HasColor; +use Filament\Support\View\Components\Contracts\HasDefaultGrayColor; use Illuminate\Support\Arr; -use Illuminate\View\ComponentAttributeBag; class ColorManager { @@ -23,12 +22,12 @@ class ColorManager ]; /** - * @var array | Closure> + * @var array | string> | Closure> */ protected array $colors = []; /** - * @var array + * @var array> */ protected array $cachedColors; @@ -47,10 +46,13 @@ class ColorManager */ protected array $removedShades = []; - protected array $componentColorClasses = []; + /** + * @var array, array>> + */ + protected array $componentClasses = []; /** - * @param array | Closure $colors + * @param array | string> | Closure $colors */ public function register(array | Closure $colors): static { @@ -60,7 +62,7 @@ class ColorManager } /** - * @return array + * @return array> */ public function getColors(): array { @@ -70,10 +72,10 @@ class ColorManager $this->cachedColors = static::DEFAULT_COLORS; - foreach ($this->colors as $index => $colors) { - $this->colors[$index] = $this->evaluate($colors); + foreach ($this->colors as $colors) { + $colors = $this->evaluate($colors); - foreach ($this->colors[$index] as $name => $color) { + foreach ($colors as $name => $color) { if (is_string($color)) { $color = Color::generatePalette($color); } else { @@ -85,7 +87,7 @@ class ColorManager $shades = collect($color) ->keys() - ->filter(fn (int | string $key): bool => is_numeric($key)) + ->filter(fn (int | string $shade): bool => is_numeric($shade)) ->all(); $colorOnlyShades = Arr::only($color, $shades); @@ -97,7 +99,7 @@ class ColorManager ]; } - if (! array_key_exists("white-text", $color)) { + if (! array_key_exists('white-text', $color)) { $color = [ ...Color::findMatchingAccessibleTextColorsForGrayBackgroundColors($colorOnlyShades), ...$color, @@ -112,7 +114,7 @@ class ColorManager } /** - * @return array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} + * @return ?array */ public function getColor(string $color): ?array { @@ -167,35 +169,33 @@ class ColorManager return $this->removedShades[$alias] ?? null; } - public function applyColorToComponentAttributes(string $color, string $component, ComponentAttributeBag $attributes): ComponentAttributeBag + /** + * @param class-string $component + * @return array + */ + public function getComponentClasses(string $component, string $color): array { $component = app($component); - if (($color === 'gray') && ($component instanceof DoesNotHaveGrayColor)) { - return $attributes; + if (($color === 'gray') && ($component instanceof HasDefaultGrayColor)) { + return []; } - if ($this->componentColorClasses[$component::class][$color] ?? []) { - return $attributes->class($this->componentColorClasses[$component::class][$color]); + if ($this->componentClasses[$component::class][$color] ?? []) { + return $this->componentClasses[$component::class][$color]; } $classes = ['fi-color', "fi-color-{$color}"]; - $resolvedColor = FilamentColor::getColor($color); + $resolvedColor = $this->getColor($color); if (! $resolvedColor) { - $this->componentColorClasses[$component::class][$color] = $classes; - - return $attributes->class($classes); + return $this->componentClasses[$component::class][$color] = $classes; } - $classes = [ + return $this->componentClasses[$component::class][$color] = [ ...$classes, ...$component->getColorClasses($resolvedColor), ]; - - $this->componentColorClasses[$component::class][$color] = $classes; - - return $attributes->class($classes); } } diff --git a/packages/support/src/Concerns/HasBadge.php b/packages/support/src/Concerns/HasBadge.php index 241c705c58..59f538d313 100644 --- a/packages/support/src/Concerns/HasBadge.php +++ b/packages/support/src/Concerns/HasBadge.php @@ -10,7 +10,7 @@ trait HasBadge protected string | int | float | Closure | null $badge = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $badgeColor = null; @@ -36,7 +36,7 @@ trait HasBadge } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function badgeColor(string | array | Closure | null $color): static { @@ -69,7 +69,7 @@ trait HasBadge /** * @deprecated Use `badgeColor()` instead. * - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function indicatorColor(string | array | Closure | null $color): static { @@ -82,7 +82,7 @@ trait HasBadge } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getBadgeColor(): string | array | null { diff --git a/packages/support/src/Concerns/HasColor.php b/packages/support/src/Concerns/HasColor.php index 4e3934a08f..1e15dc46ff 100644 --- a/packages/support/src/Concerns/HasColor.php +++ b/packages/support/src/Concerns/HasColor.php @@ -7,17 +7,17 @@ use Closure; trait HasColor { /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $color = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $defaultColor = null; /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function color(string | array | Closure | null $color): static { @@ -27,7 +27,7 @@ trait HasColor } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function defaultColor(string | array | Closure | null $color): static { @@ -37,7 +37,7 @@ trait HasColor } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getColor(): string | array | null { diff --git a/packages/support/src/Concerns/HasIconColor.php b/packages/support/src/Concerns/HasIconColor.php index b0780d51b2..a8ac58309f 100644 --- a/packages/support/src/Concerns/HasIconColor.php +++ b/packages/support/src/Concerns/HasIconColor.php @@ -7,12 +7,12 @@ use Closure; trait HasIconColor { /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $iconColor = null; /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function iconColor(string | array | Closure | null $color): static { @@ -22,7 +22,7 @@ trait HasIconColor } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getIconColor(): string | array | null { diff --git a/packages/support/src/Contracts/HasColor.php b/packages/support/src/Contracts/HasColor.php index a904de10f9..79a50bf595 100644 --- a/packages/support/src/Contracts/HasColor.php +++ b/packages/support/src/Contracts/HasColor.php @@ -5,7 +5,7 @@ namespace Filament\Support\Contracts; interface HasColor { /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getColor(): string | array | null; } diff --git a/packages/support/src/Facades/FilamentColor.php b/packages/support/src/Facades/FilamentColor.php index a93aaa203e..81df935270 100644 --- a/packages/support/src/Facades/FilamentColor.php +++ b/packages/support/src/Facades/FilamentColor.php @@ -4,13 +4,15 @@ namespace Filament\Support\Facades; use Closure; use Filament\Support\Colors\ColorManager; +use Filament\Support\View\Components\Contracts\HasColor; use Illuminate\Support\Facades\Facade; /** * @method static void addShades(string $alias, array $shades) * @method static array | null getAddedShades(string $alias) - * @method static array getColors() - * @method static array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} getColor(string $color) + * @method static array> getColors() + * @method static ?array getColor(string $color) + * @method static array getComponentClasses(class-string $component, string $color) * @method static array | null getOverridingShades(string $alias) * @method static array | null getRemovedShades(string $alias) * @method static void overrideShades(string $alias, array $shades) @@ -26,7 +28,7 @@ class FilamentColor extends Facade } /** - * @param array | Closure $colors + * @param array | string> | Closure $colors */ public static function register(array | Closure $colors): void { diff --git a/packages/support/src/SupportServiceProvider.php b/packages/support/src/SupportServiceProvider.php index 07d6a7d103..60d8c43b8e 100644 --- a/packages/support/src/SupportServiceProvider.php +++ b/packages/support/src/SupportServiceProvider.php @@ -157,8 +157,8 @@ class SupportServiceProvider extends PackageServiceProvider return preg_replace('/\s*@trim\s*/m', '', $view); }); - ComponentAttributeBag::macro('color', function (string | array $color, string $component): ComponentAttributeBag { - return FilamentColor::applyColorToComponentAttributes($color, $component, $this); + ComponentAttributeBag::macro('color', function (string $component, string $color): ComponentAttributeBag { + return $this->class(FilamentColor::getComponentClasses($component, $color)); }); ComponentAttributeBag::macro('grid', function (array | int | null $columns = [], GridDirection $direction = GridDirection::Row): ComponentAttributeBag { diff --git a/packages/support/src/View/Components/Button.php b/packages/support/src/View/Components/Button.php index bce3bee401..757984fc63 100644 --- a/packages/support/src/View/Components/Button.php +++ b/packages/support/src/View/Components/Button.php @@ -3,14 +3,13 @@ namespace Filament\Support\View\Components; use Filament\Support\Colors\Color; -use Filament\Support\Facades\FilamentColor; -use Filament\Support\View\Components\Contracts\DoesNotHaveGrayColor; use Filament\Support\View\Components\Contracts\HasColor; +use Filament\Support\View\Components\Contracts\HasDefaultGrayColor; -class Button implements HasColor, DoesNotHaveGrayColor +class Button implements HasColor, HasDefaultGrayColor { /** - * @param array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} $color + * @param array $color * @return array */ public function getColorClasses(array $color): array @@ -29,7 +28,7 @@ class Button implements HasColor, DoesNotHaveGrayColor ]; } - $textLightnessIndex = $this->generateTextLightnessIndexForColor($color); + $textLightnessIndex = $this->generateTextLightnessIndexForColorShades($color); if (blank($bg)) { if ($textLightnessIndex[600] && $textLightnessIndex[500]) { @@ -74,7 +73,11 @@ class Button implements HasColor, DoesNotHaveGrayColor ]; } - protected function generateTextLightnessIndexForColor(array $color): array + /** + * @param array $color + * @return array + */ + protected function generateTextLightnessIndexForColorShades(array $color): array { $textLightnessIndex = []; diff --git a/packages/support/src/View/Components/Contracts/HasColor.php b/packages/support/src/View/Components/Contracts/HasColor.php index cfe4eac479..947d236c66 100644 --- a/packages/support/src/View/Components/Contracts/HasColor.php +++ b/packages/support/src/View/Components/Contracts/HasColor.php @@ -5,7 +5,7 @@ namespace Filament\Support\View\Components\Contracts; interface HasColor { /** - * @param array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} $color + * @param array $color * @return array */ public function getColorClasses(array $color): array; diff --git a/packages/support/src/View/Components/Contracts/DoesNotHaveGrayColor.php b/packages/support/src/View/Components/Contracts/HasDefaultGrayColor.php similarity index 63% rename from packages/support/src/View/Components/Contracts/DoesNotHaveGrayColor.php rename to packages/support/src/View/Components/Contracts/HasDefaultGrayColor.php index 79efbfad26..c1ba8dd5b2 100644 --- a/packages/support/src/View/Components/Contracts/DoesNotHaveGrayColor.php +++ b/packages/support/src/View/Components/Contracts/HasDefaultGrayColor.php @@ -2,7 +2,4 @@ namespace Filament\Support\View\Components\Contracts; -interface DoesNotHaveGrayColor -{ - -} +interface HasDefaultGrayColor {} diff --git a/packages/support/src/helpers.php b/packages/support/src/helpers.php index 267a3336f0..39ff73de6c 100644 --- a/packages/support/src/helpers.php +++ b/packages/support/src/helpers.php @@ -63,7 +63,7 @@ if (! function_exists('Filament\Support\locale_has_pluralization')) { if (! function_exists('Filament\Support\get_color_css_variables')) { /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null $color + * @param string | array | null $color * @param array $shades */ function get_color_css_variables(string | array | null $color, array $shades, ?string $alias = null): ?string diff --git a/packages/tables/src/Columns/Concerns/HasColor.php b/packages/tables/src/Columns/Concerns/HasColor.php index f8b027be9a..f0b3b35d7b 100644 --- a/packages/tables/src/Columns/Concerns/HasColor.php +++ b/packages/tables/src/Columns/Concerns/HasColor.php @@ -9,12 +9,12 @@ use Filament\Tables\Columns\Column; trait HasColor { /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | bool | Closure | null + * @var string | array | bool | Closure | null */ protected string | array | bool | Closure | null $color = null; /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | bool | Closure | null $color + * @param string | array | bool | Closure | null $color */ public function color(string | array | bool | Closure | null $color): static { @@ -50,7 +50,7 @@ trait HasColor } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getColor(mixed $state): string | array | null { diff --git a/packages/tables/src/Columns/Concerns/HasIconColor.php b/packages/tables/src/Columns/Concerns/HasIconColor.php index 5088bc2b84..6a75e6d20a 100644 --- a/packages/tables/src/Columns/Concerns/HasIconColor.php +++ b/packages/tables/src/Columns/Concerns/HasIconColor.php @@ -7,12 +7,12 @@ use Closure; trait HasIconColor { /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $iconColor = null; /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function iconColor(string | array | Closure | null $color): static { @@ -22,7 +22,7 @@ trait HasIconColor } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getIconColor(mixed $state): string | array | null { diff --git a/packages/tables/src/Columns/IconColumn.php b/packages/tables/src/Columns/IconColumn.php index 4366af10e2..6c1c36ab26 100644 --- a/packages/tables/src/Columns/IconColumn.php +++ b/packages/tables/src/Columns/IconColumn.php @@ -29,14 +29,14 @@ class IconColumn extends Column implements HasEmbeddedView protected bool | Closure | null $isBoolean = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $falseColor = null; protected string | Closure | null $falseIcon = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + * @var string | array | Closure | null */ protected string | array | Closure | null $trueColor = null; @@ -61,7 +61,7 @@ class IconColumn extends Column implements HasEmbeddedView } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function false(string | Closure | null $icon = null, string | array | Closure | null $color = null): static { @@ -72,7 +72,7 @@ class IconColumn extends Column implements HasEmbeddedView } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function falseColor(string | array | Closure | null $color): static { @@ -91,7 +91,7 @@ class IconColumn extends Column implements HasEmbeddedView } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function true(string | Closure | null $icon = null, string | array | Closure | null $color = null): static { @@ -102,7 +102,7 @@ class IconColumn extends Column implements HasEmbeddedView } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + * @param string | array | Closure | null $color */ public function trueColor(string | array | Closure | null $color): static { @@ -178,7 +178,7 @@ class IconColumn extends Column implements HasEmbeddedView } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getColor(mixed $state): string | array | null { @@ -198,7 +198,7 @@ class IconColumn extends Column implements HasEmbeddedView } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} + * @return string | array */ public function getFalseColor(): string | array { @@ -213,7 +213,7 @@ class IconColumn extends Column implements HasEmbeddedView } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} + * @return string | array */ public function getTrueColor(): string | array { diff --git a/packages/widgets/src/StatsOverviewWidget/Stat.php b/packages/widgets/src/StatsOverviewWidget/Stat.php index 714837c25b..8d3707c8c1 100644 --- a/packages/widgets/src/StatsOverviewWidget/Stat.php +++ b/packages/widgets/src/StatsOverviewWidget/Stat.php @@ -24,7 +24,7 @@ class Stat extends Component protected ?array $chart = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @var string | array | null */ protected string | array | null $chartColor = null; @@ -35,7 +35,7 @@ class Stat extends Component protected IconPosition | string | null $descriptionIconPosition = null; /** - * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @var string | array | null */ protected string | array | null $descriptionColor = null; @@ -62,7 +62,7 @@ class Stat extends Component } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null $color + * @param string | array | null $color */ public function chartColor(string | array | null $color): static { @@ -79,7 +79,7 @@ class Stat extends Component } /** - * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null $color + * @param string | array | null $color */ public function descriptionColor(string | array | null $color): static { @@ -125,7 +125,7 @@ class Stat extends Component } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getChartColor(): string | array | null { @@ -138,7 +138,7 @@ class Stat extends Component } /** - * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + * @return string | array | null */ public function getDescriptionColor(): string | array | null {