Skip to content

Commit 7b2786a

Browse files
committed
fix: tailwind disabled prop conflict #67
1 parent 5d0d460 commit 7b2786a

File tree

1 file changed

+59
-42
lines changed

1 file changed

+59
-42
lines changed

tailwind.js

Lines changed: 59 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const plugin = require('tailwindcss/plugin')
22

33
module.exports = plugin(({ theme, addBase, addVariant, addUtilities, e }) => {
44
const plain = {
5+
'.slider-txt-rtl': {},
56
'.cursor-grab': {
67
cursor: 'grab',
78
},
@@ -36,53 +37,69 @@ module.exports = plugin(({ theme, addBase, addVariant, addUtilities, e }) => {
3637
[`.slider-vertical .${e('v:cursor-ns-resize')}`]: {
3738
cursor: 'ns-resize',
3839
},
39-
[`.slider-vertical .${e('v:arrow-right')}:before`]: {
40-
content: '""',
41-
position: 'absolute',
42-
right: '-10px',
43-
top: '50%',
44-
width: '0',
45-
height: '0',
46-
border: '5px solid transparent',
47-
borderLeftColor: 'inherit',
48-
transform: 'translateY(-50%)',
40+
}
41+
42+
const h = {
43+
'.arrow-bottom': {
44+
'&:before': {
45+
content: '""',
46+
position: 'absolute',
47+
bottom: '-10px',
48+
left: '50%',
49+
width: '0',
50+
height: '0',
51+
border: '5px solid transparent',
52+
borderTopColor: 'inherit',
53+
transform: 'translate(-50%)',
54+
}
4955
},
50-
[`.slider-vertical .${e('v:arrow-left')}:before`]: {
51-
content: '""',
52-
position: 'absolute',
53-
left: '-10px',
54-
top: '50%',
55-
width: '0',
56-
height: '0',
57-
border: '5px solid transparent',
58-
borderRightColor: 'inherit',
59-
transform: 'translateY(-50%)',
56+
'.arrow-top': {
57+
'&:before': {
58+
content: '""',
59+
position: 'absolute',
60+
top: '-10px',
61+
left: '50%',
62+
width: '0',
63+
height: '0',
64+
border: '5px solid transparent',
65+
borderBottomColor: 'inherit',
66+
transform: 'translate(-50%)',
67+
}
6068
},
61-
[`.slider-horizontal .${e('h:arrow-bottom')}:before`]: {
62-
content: '""',
63-
position: 'absolute',
64-
bottom: '-10px',
65-
left: '50%',
66-
width: '0',
67-
height: '0',
68-
border: '5px solid transparent',
69-
borderTopColor: 'inherit',
70-
transform: 'translate(-50%)',
69+
}
70+
71+
const v = {
72+
'.arrow-left': {
73+
'&:before': {
74+
content: '""',
75+
position: 'absolute',
76+
left: '-10px',
77+
top: '50%',
78+
width: '0',
79+
height: '0',
80+
border: '5px solid transparent',
81+
borderRightColor: 'inherit',
82+
transform: 'translateY(-50%)',
83+
}
7184
},
72-
[`.slider-horizontal .${e('h:arrow-top')}:before`]: {
73-
content: '""',
74-
position: 'absolute',
75-
top: '-10px',
76-
left: '50%',
77-
width: '0',
78-
height: '0',
79-
border: '5px solid transparent',
80-
borderBottomColor: 'inherit',
81-
transform: 'translate(-50%)',
85+
'.arrow-right': {
86+
'&:before': {
87+
content: '""',
88+
position: 'absolute',
89+
right: '-10px',
90+
top: '50%',
91+
width: '0',
92+
height: '0',
93+
border: '5px solid transparent',
94+
borderLeftColor: 'inherit',
95+
transform: 'translateY(-50%)',
96+
}
8297
},
8398
}
8499

85100
addUtilities(plain)
101+
addUtilities(h, ['h'])
102+
addUtilities(v, ['v'])
86103

87104
addVariant('h', ({ modifySelectors, separator }) => {
88105
modifySelectors(({ className }) => {
@@ -120,9 +137,9 @@ module.exports = plugin(({ theme, addBase, addVariant, addUtilities, e }) => {
120137
})
121138
})
122139

123-
addVariant('disabled', ({ modifySelectors, separator }) => {
140+
addVariant('slider-disabled', ({ modifySelectors, separator }) => {
124141
modifySelectors(({ className }) => {
125-
return `[disabled] .${e(`disabled${separator}${className}`)}`
142+
return `[disabled] .${e(`slider-disabled${separator}${className}`)}`
126143
})
127144
})
128145

0 commit comments

Comments
 (0)