Skip to content

Commit ee756b0

Browse files
committed
Add variant for file-selector-button pseudo element
1 parent c315db5 commit ee756b0

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/corePlugins.js

+12
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ export default {
6262
}),
6363
])
6464

65+
addVariant(
66+
'file-selector-button',
67+
transformAllSelectors((selector) => {
68+
return updateAllClasses(selector, (className, { withPseudo }) => {
69+
return withPseudo(
70+
`file-selector-button${config('separator')}${className}`,
71+
'::file-selector-button'
72+
)
73+
})
74+
})
75+
)
76+
6577
addVariant(
6678
'before',
6779
transformAllSelectors(

tests/variants.test.css

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@
5252
--tw-text-opacity: 1;
5353
color: rgba(255, 255, 255, var(--tw-text-opacity));
5454
}
55+
.file-selector-button\:bg-blue-500::file-selector-button {
56+
--tw-bg-opacity: 1;
57+
background-color: rgba(59, 130, 246, var(--tw-bg-opacity));
58+
}
59+
.file-selector-button\:text-white::file-selector-button {
60+
--tw-text-opacity: 1;
61+
color: rgba(255, 255, 255, var(--tw-text-opacity));
62+
}
5563
.before\:block::before {
5664
content: '';
5765
display: block;

tests/variants.test.html

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<li class="marker:text-red-500 marker:text-lg"></li>
4646
</ul>
4747
<div class="selection:bg-blue-500 selection:text-white"></div>
48+
<div class="file-selector-button:bg-blue-500 file-selector-button:text-white"></div>
4849
<div class="before:block before:bg-red-500"></div>
4950
<div class="after:flex after:uppercase"></div>
5051

0 commit comments

Comments
 (0)