File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
16
- Don't transition ` visibility ` when using ` transition ` ([ #18795 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18795 ) )
17
17
- Discard matched variants with unknown named values ([ #18799 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18799 ) )
18
18
- Discard matched variants with non-string values ([ #18799 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18799 ) )
19
+ - Show suggestions for known ` matchVariant ` values ([ #18798 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18798 ) )
19
20
20
21
## [ 4.1.12] - 2025-08-13
21
22
Original file line number Diff line number Diff line change @@ -247,6 +247,10 @@ export function buildPluginApi({
247
247
return aValue < zValue ? - 1 : 1
248
248
} ,
249
249
)
250
+
251
+ designSystem . variants . suggest ( name , ( ) =>
252
+ Object . keys ( options ?. values ?? { } ) . filter ( ( v ) => v !== 'DEFAULT' ) ,
253
+ )
250
254
} ,
251
255
252
256
addUtilities ( utilities ) {
Original file line number Diff line number Diff line change @@ -675,3 +675,40 @@ test('Custom @utility and existing utility with names matching theme keys dont g
675
675
expect ( matches ) . toHaveLength ( 1 )
676
676
expect ( classMap . get ( 'text-header' ) ?. modifiers ) . toEqual ( [ 'sm' ] )
677
677
} )
678
+
679
+ test ( 'matchVariant' , async ( ) => {
680
+ let input = css `
681
+ @import 'tailwindcss/utilities' ;
682
+ @plugin "./plugin.js" ;
683
+ `
684
+
685
+ let design = await __unstable__loadDesignSystem ( input , {
686
+ loadStylesheet : async ( _ , base ) => ( {
687
+ path : '' ,
688
+ base,
689
+ content : '@tailwind utilities;' ,
690
+ } ) ,
691
+ loadModule : async ( ) => ( {
692
+ path : '' ,
693
+ base : '' ,
694
+ module : plugin ( ( { matchVariant } ) => {
695
+ matchVariant ( 'foo' , ( val ) => `&:is(${ val } )` , {
696
+ values : {
697
+ DEFAULT : '1' ,
698
+ a : 'a' ,
699
+ b : 'b' ,
700
+ } ,
701
+ } )
702
+ } ) ,
703
+ } ) ,
704
+ } )
705
+
706
+ let variants = design . getVariants ( )
707
+ let v1 = variants . find ( ( v ) => v . name === 'foo' ) !
708
+ expect ( v1 ) . not . toBeUndefined ( )
709
+
710
+ expect ( v1 . hasDash ) . toEqual ( true )
711
+ expect ( v1 . isArbitrary ) . toEqual ( true )
712
+ expect ( v1 . name ) . toEqual ( 'foo' )
713
+ expect ( v1 . values ) . toEqual ( [ 'a' , 'b' ] )
714
+ } )
You can’t perform that action at this time.
0 commit comments