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
1616- Don't transition ` visibility ` when using ` transition ` ([ #18795 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18795 ) )
1717- Discard matched variants with unknown named values ([ #18799 ] ( https://github.com/tailwindlabs/tailwindcss/pull/18799 ) )
1818- 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 ) )
1920
2021## [ 4.1.12] - 2025-08-13
2122
Original file line number Diff line number Diff line change @@ -247,6 +247,10 @@ export function buildPluginApi({
247247 return aValue < zValue ? - 1 : 1
248248 } ,
249249 )
250+
251+ designSystem . variants . suggest ( name , ( ) =>
252+ Object . keys ( options ?. values ?? { } ) . filter ( ( v ) => v !== 'DEFAULT' ) ,
253+ )
250254 } ,
251255
252256 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
675675 expect ( matches ) . toHaveLength ( 1 )
676676 expect ( classMap . get ( 'text-header' ) ?. modifiers ) . toEqual ( [ 'sm' ] )
677677} )
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