Skip to content

Commit fccdcc7

Browse files
authored
Merge pull request #9 from Jackardios/v2
V2
2 parents a54b170 + 4285122 commit fccdcc7

20 files changed

+5493
-2642
lines changed

.changeset/major-v2-refactor.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
'react-class-variants': major
3+
---
4+
5+
Complete v2 refactor with consolidated architecture and enhanced functionality
6+
7+
**Breaking Changes:**
8+
- Complete library restructure - all functionality consolidated into single module
9+
- `styled()` API removed in favor of `variantComponent()`
10+
- `cx()` utility removed - class merging now handled via `defineConfig({ onClassesMerged })`
11+
- Changed exports structure - now use `defineConfig()` factory pattern
12+
13+
**New Features:**
14+
- `defineConfig(options)` - Factory function for creating variants, variantPropsResolver, and variantComponent with shared configuration
15+
- `variantComponent()` - Create React components with variants support and polymorphic rendering
16+
- `variantPropsResolver()` - Extract variant props and resolve className from full props objects
17+
- Enhanced render prop pattern - supports both React elements and render functions
18+
- `forwardProps` option - Control which variant props get forwarded to DOM
19+
- `withoutRenderProp` option - Disable render prop pattern when not needed
20+
- Improved ref forwarding and merging with `useMergeRefs()`
21+
- Better event handler and props composition with `mergeProps()`
22+
23+
**Type System Improvements:**
24+
- Stronger type inference for optional vs required variants
25+
- Boolean variants automatically optional
26+
- Variants with defaults automatically optional
27+
- Better polymorphic component type support
28+
29+
**Testing:**
30+
- Complete comprehensive test suite with 170+ tests
31+
- Tests for variants resolution, React components, utilities, edge cases, and TypeScript types
32+
- Vitest + React Testing Library + tsd for type testing
33+
34+
**Documentation:**
35+
- Complete README rewrite with all new APIs and examples

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
.DS_Store
2+
13
node_modules
24
dist

0 commit comments

Comments
 (0)