Skip to content
This repository was archived by the owner on Sep 11, 2021. It is now read-only.

Commit 99f0cdd

Browse files
committed
Switch back to using borders, fix image placement with background-origin
1 parent 53893e1 commit 99f0cdd

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

index.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,27 @@ module.exports = function ({ addUtilities, addComponents, theme }) {
3232
height: options.checkboxSize,
3333
width: options.checkboxSize,
3434
verticalAlign: 'middle',
35-
boxShadow: `inset 0 0 0 ${options.borderWidth} ${options.borderColor}`,
35+
borderColor: options.borderColor,
36+
borderWidth: options.borderWidth,
3637
borderRadius: options.borderRadius,
3738
backgroundColor: options.backgroundColor,
39+
backgroundOrigin: 'border-box',
3840
userSelect: 'none',
3941
'&:focus': {
4042
outline: 'none',
41-
boxShadow: `inset 0 0 0 ${options.borderWidth} ${options.borderColor}, ${options.focusShadow}`,
43+
boxShadow: options.focusShadow,
4244
},
4345
'&:focus:not(:checked)': {
44-
boxShadow: `inset 0 0 0 ${options.borderWidth} ${options.focusBorderColor}, ${options.focusShadow}`,
46+
borderColor: options.focusBorderColor,
4547
},
4648
'&:checked': {
47-
boxShadow: 'none',
4849
backgroundColor: options.checkedColor,
4950
borderColor: options.checkedColor,
5051
backgroundImage: `url("${svgToDataUri(options.checkboxIcon)}")`,
5152
backgroundSize: '100% 100%',
5253
backgroundPosition: 'center',
5354
backgroundRepeat: 'no-repeat',
5455
},
55-
'&:focus:checked': {
56-
boxShadow: `${options.focusShadow}`,
57-
},
5856
'&::-ms-check': {
5957
color: 'transparent', // Hide the check
6058
background: 'inherit',
@@ -69,28 +67,27 @@ module.exports = function ({ addUtilities, addComponents, theme }) {
6967
height: options.radioSize,
7068
width: options.radioSize,
7169
verticalAlign: 'middle',
72-
boxShadow: `inset 0 0 0 ${options.borderWidth} ${options.borderColor}`,
70+
borderColor: options.borderColor,
71+
borderWidth: options.borderWidth,
7372
borderRadius: '50%',
7473
backgroundColor: options.backgroundColor,
74+
backgroundOrigin: 'border-box',
7575
userSelect: 'none',
7676
'&:focus': {
7777
outline: 'none',
78-
boxShadow: `inset 0 0 0 ${options.borderWidth} ${options.borderColor}, ${options.focusShadow}`,
78+
boxShadow: options.focusShadow,
7979
},
8080
'&:focus:not(:checked)': {
81-
boxShadow: `inset 0 0 0 ${options.borderWidth} ${options.focusBorderColor}, ${options.focusShadow}`,
81+
borderColor: options.focusBorderColor,
8282
},
8383
'&:checked': {
84-
boxShadow: 'none',
8584
backgroundColor: options.checkedColor,
85+
borderColor: options.checkedColor,
8686
backgroundImage: `url("${svgToDataUri(options.radioIcon)}")`,
8787
backgroundSize: '100% 100%',
8888
backgroundPosition: 'center',
8989
backgroundRepeat: 'no-repeat',
9090
},
91-
'&:focus:checked': {
92-
boxShadow: `${options.focusShadow}`,
93-
},
9491
'&::-ms-check': {
9592
color: 'transparent', // Hide the dot
9693
background: 'inherit',

0 commit comments

Comments
 (0)