diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 5d73740..82070d2 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v1.6.0 + uses: dependabot/fetch-metadata@v2.4.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml index 802d168..af3491c 100644 --- a/.github/workflows/fix-php-code-style-issues.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -21,6 +21,6 @@ jobs: args: --config=.php-cs-fixer.dist.php --allow-risky=yes - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v5 + uses: stefanzweifel/git-auto-commit-action@v6 with: commit_message: Fix styling diff --git a/.github/workflows/run-phpunit.yml b/.github/workflows/run-phpunit.yml index a35cd53..d75dee5 100644 --- a/.github/workflows/run-phpunit.yml +++ b/.github/workflows/run-phpunit.yml @@ -39,7 +39,7 @@ jobs: XDEBUG_MODE: coverage - name: Upload to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./build/coverage.xml diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index ec40921..859924d 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -24,7 +24,7 @@ jobs: release-notes: ${{ github.event.release.body }} - name: Commit updated CHANGELOG - uses: stefanzweifel/git-auto-commit-action@v5 + uses: stefanzweifel/git-auto-commit-action@v6 with: branch: main commit_message: Update CHANGELOG diff --git a/CHANGELOG.md b/CHANGELOG.md index 33b9965..b36a0ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ All notable changes to `cva` will be documented in this file. +## 0.3.0 - 2024-09-25 + +### What's Changed + +* Improve code coverage by @rojtjo in https://github.com/feature-ninja/cva/pull/10 +* Allow passing additional class names by @rojtjo in https://github.com/feature-ninja/cva/pull/11 + +**Full Changelog**: https://github.com/feature-ninja/cva/compare/0.2.1...0.3.0 + ## 0.2.1 - 2024-09-10 ### What's Changed diff --git a/README.md b/README.md index 97a0e22..2c7bdf0 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,35 @@ $button = ClassVarianceAuthority::new( ], ], ); + +# Or by using the cva helper function + +$button = fn\cva( + ['font-semibold', 'border', 'rounded'], + [ + 'variants' => [ + 'intent' => [ + 'primary' => ['bg-blue-500', 'text-white', 'border-transparent', 'hover:bg-blue-600'], + 'secondary' => 'bg-white text-gray-800 border-gray-400 hover:bg-gray-100', + ], + 'size' => [ + 'small' => ['text-sm', 'py-1', 'px-2'], + 'medium' => 'text-base py-2 px-4', + ], + ], + 'compoundVariants' => [ + [ + 'intent' => 'primary', + 'size' => 'medium', + 'class' => 'uppercase', + ], + ], + 'defaultVariants' => [ + 'intent' => 'primary', + 'size' => 'medium', + ], + ], +); ``` ```html diff --git a/src/StringCollection.php b/src/StringCollection.php index 0afd781..409c557 100644 --- a/src/StringCollection.php +++ b/src/StringCollection.php @@ -19,7 +19,7 @@ public function implode(string $separator): string return implode($separator, $this->items); } - public function filter(callable $callback = null): self + public function filter(?callable $callback = null): self { return new self(array_filter($this->items, $callback)); }