11const svgToDataUri = require ( 'mini-svg-data-uri' )
2- const defaultTheme = require ( 'tailwindcss/defaultTheme' )
2+ const defaultTheme = require ( 'tailwindcss/resolveConfig' ) ( require ( 'tailwindcss/defaultConfig' ) ) . theme
33
44module . exports = function ( { addUtilities, addComponents, theme } ) {
55
@@ -16,8 +16,8 @@ module.exports = function ({ addUtilities, addComponents, theme }) {
1616 focusShadow : defaultTheme . boxShadow . outline ,
1717 checkboxSize : '1em' ,
1818 radioSize : '1em' ,
19- checkboxIcon : `<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="#fff" ><path d="M13.293 4 .293a1 1 0 0 1 0 1.414L7 12a1 1 0 0 1-1 .414 0L3.293 9.707a1 1 0 0 1 1 .414-1.414l1.586 1 .586 5.586-5.586a1 1 0 0 1 1.414 0z "/></svg>` ,
20- radioIcon : `<svg viewBox="0 0 24 24 " fill="#fff" xmlns="http://www.w3.org/2000/svg"><circle cx="12 " cy="12 " r="5 "/></svg>` ,
19+ checkboxIcon : `<svg viewBox="0 0 14 14" fill="#fff" xmlns="http://www.w3.org/2000/svg"><path d="M4.707 6 .293a1 1 0 0 0-1.414 1.414l2 2a1 1 0 0 0 1 .414 0l4-4a1 1 0 0 0-1 .414-1.414L6 7 .586 4.707 6.293z "/></svg>` ,
20+ radioIcon : `<svg viewBox="0 0 14 14 " fill="#fff" xmlns="http://www.w3.org/2000/svg"><circle cx="7 " cy="7 " r="3 "/></svg>` ,
2121 checkedColor : 'currentColor' ,
2222 selectIcon : `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="${ defaultTheme . colors . gray [ 500 ] } "><path d="M15.3 9.3a1 1 0 0 1 1.4 1.4l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 0 1 1.4-1.4l3.3 3.29 3.3-3.3z"/></svg>` ,
2323 selectIconOffset : defaultTheme . spacing [ 2 ] ,
@@ -32,26 +32,29 @@ module.exports = function ({ addUtilities, addComponents, theme }) {
3232 height : options . checkboxSize ,
3333 width : options . checkboxSize ,
3434 verticalAlign : 'middle' ,
35- borderColor : options . borderColor ,
36- borderWidth : options . borderWidth ,
35+ boxShadow : `inset 0 0 0 ${ options . borderWidth } ${ options . borderColor } ` ,
3736 borderRadius : options . borderRadius ,
3837 backgroundColor : options . backgroundColor ,
3938 userSelect : 'none' ,
4039 '&:focus' : {
4140 outline : 'none' ,
42- boxShadow : options . focusShadow ,
41+ boxShadow : `inset 0 0 0 ${ options . borderWidth } ${ options . borderColor } , ${ options . focusShadow } ` ,
4342 } ,
4443 '&:focus:not(:checked)' : {
45- borderColor : options . focusBorderColor ,
44+ boxShadow : `inset 0 0 0 ${ options . borderWidth } ${ options . focusBorderColor } , ${ options . focusShadow } ` ,
4645 } ,
4746 '&:checked' : {
47+ boxShadow : 'none' ,
4848 backgroundColor : options . checkedColor ,
4949 borderColor : options . checkedColor ,
5050 backgroundImage : `url("${ svgToDataUri ( options . checkboxIcon ) } ")` ,
51- backgroundSize : 'cover ' ,
51+ backgroundSize : '100% 100% ' ,
5252 backgroundPosition : 'center' ,
5353 backgroundRepeat : 'no-repeat' ,
5454 } ,
55+ '&:focus:checked' : {
56+ boxShadow : `${ options . focusShadow } ` ,
57+ } ,
5558 '&::-ms-check' : {
5659 color : 'transparent' , // Hide the check
5760 background : 'inherit' ,
@@ -66,26 +69,28 @@ module.exports = function ({ addUtilities, addComponents, theme }) {
6669 height : options . radioSize ,
6770 width : options . radioSize ,
6871 verticalAlign : 'middle' ,
69- borderColor : options . borderColor ,
70- borderWidth : options . borderWidth ,
72+ boxShadow : `inset 0 0 0 ${ options . borderWidth } ${ options . borderColor } ` ,
7173 borderRadius : '50%' ,
7274 backgroundColor : options . backgroundColor ,
7375 userSelect : 'none' ,
7476 '&:focus' : {
7577 outline : 'none' ,
76- boxShadow : options . focusShadow ,
78+ boxShadow : `inset 0 0 0 ${ options . borderWidth } ${ options . borderColor } , ${ options . focusShadow } ` ,
7779 } ,
7880 '&:focus:not(:checked)' : {
79- borderColor : options . focusBorderColor ,
81+ boxShadow : `inset 0 0 0 ${ options . borderWidth } ${ options . focusBorderColor } , ${ options . focusShadow } ` ,
8082 } ,
8183 '&:checked' : {
84+ boxShadow : 'none' ,
8285 backgroundColor : options . checkedColor ,
83- borderColor : options . checkedColor ,
8486 backgroundImage : `url("${ svgToDataUri ( options . radioIcon ) } ")` ,
85- backgroundSize : 'cover ' ,
87+ backgroundSize : '100% 100% ' ,
8688 backgroundPosition : 'center' ,
8789 backgroundRepeat : 'no-repeat' ,
8890 } ,
91+ '&:focus:checked' : {
92+ boxShadow : `${ options . focusShadow } ` ,
93+ } ,
8994 '&::-ms-check' : {
9095 color : 'transparent' , // Hide the dot
9196 background : 'inherit' ,
0 commit comments