Skip to content

Commit

Permalink
Merge pull request #570 from ben-rogerson/feature/not-placeholder-shown
Browse files Browse the repository at this point in the history
Add not-placeholder-shown variants
  • Loading branch information
ben-rogerson committed Mar 25, 2022
2 parents 1fe7475 + 1f3bf39 commit 0d640f8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions __fixtures__/!variants.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ tw`out-of-range:flex`
tw`required:flex`
tw`placeholder:flex`
tw`placeholder-shown:flex`
tw`not-placeholder-shown:flex`
tw`read-only:flex`
tw`read-write:flex`

Expand Down
1 change: 1 addition & 0 deletions __fixtures__/peers/peers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ tw`peer-default:block`
tw`peer-checked:block`
tw`peer-indeterminate:block`
tw`peer-placeholder-shown:block`
tw`peer-not-placeholder-shown:block`
tw`peer-autofill:block`
tw`peer-required:block`
tw`peer-valid:block`
Expand Down
12 changes: 12 additions & 0 deletions __snapshots__/plugin.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,7 @@ tw\`out-of-range:flex\`
tw\`required:flex\`
tw\`placeholder:flex\`
tw\`placeholder-shown:flex\`
tw\`not-placeholder-shown:flex\`
tw\`read-only:flex\`
tw\`read-write:flex\`

Expand Down Expand Up @@ -1582,6 +1583,11 @@ tw\`xl:placeholder-red-500! first:md:block sm:disabled:flex\`
display: 'flex',
},
})
;({
':not(:placeholder-shown)': {
display: 'flex',
},
})
;({
':read-only': {
display: 'flex',
Expand Down Expand Up @@ -36489,6 +36495,7 @@ tw\`peer-default:block\`
tw\`peer-checked:block\`
tw\`peer-indeterminate:block\`
tw\`peer-placeholder-shown:block\`
tw\`peer-not-placeholder-shown:block\`
tw\`peer-autofill:block\`
tw\`peer-required:block\`
tw\`peer-valid:block\`
Expand Down Expand Up @@ -36576,6 +36583,11 @@ tw\`peer-focus:first:peer-hover:peer-active:block\`
display: 'block',
},
})
;({
'.peer:not(:placeholder-shown) ~ &': {
display: 'block',
},
})
;({
'.peer:autofill ~ &': {
display: 'block',
Expand Down
2 changes: 2 additions & 0 deletions src/config/variantConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const variantConfig = ({
'out-of-range': ':out-of-range',
required: ':required',
'placeholder-shown': ':placeholder-shown',
'not-placeholder-shown': ':not(:placeholder-shown)',
placeholder: '::placeholder',
'read-only': ':read-only',
'read-write': ':read-write',
Expand Down Expand Up @@ -197,6 +198,7 @@ const variantConfig = ({
'peer-checked': createPeer('checked'),
'peer-indeterminate': createPeer('indeterminate'),
'peer-placeholder-shown': createPeer('placeholder-shown'),
'peer-not-placeholder-shown': createPeer('not(:placeholder-shown)'),
'peer-autofill': createPeer('autofill'),
'peer-focus-within': createPeer('focus-within'),
'peer-focus-visible': createPeer('focus-visible'),
Expand Down

0 comments on commit 0d640f8

Please sign in to comment.