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

Commit 6f8aa70

Browse files
authored
Merge pull request #14 from MartijnCuppens/print
Fix print issues
2 parents 325da70 + 39405bc commit 6f8aa70

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

index.js

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module.exports = function ({ addUtilities, addComponents, theme }) {
4141
backgroundColor: options.backgroundColor,
4242
backgroundOrigin: 'border-box',
4343
userSelect: 'none',
44+
colorAdjust: 'exact',
4445
'&:focus': {
4546
outline: 'none',
4647
boxShadow: options.focusBoxShadow,
@@ -57,12 +58,14 @@ module.exports = function ({ addUtilities, addComponents, theme }) {
5758
backgroundRepeat: 'no-repeat',
5859
},
5960
'&::-ms-check': {
60-
color: 'transparent', // Hide the check
61-
background: 'inherit',
62-
borderColor: 'inherit',
63-
borderRadius: 'inherit',
64-
borderWidth: options.borderWidth,
65-
}
61+
'@media not print': {
62+
color: 'transparent', // Hide the check
63+
background: 'inherit',
64+
borderColor: 'inherit',
65+
borderRadius: 'inherit',
66+
borderWidth: options.borderWidth,
67+
}
68+
},
6669
},
6770
'.form-radio': {
6871
appearance: 'none',
@@ -78,6 +81,7 @@ module.exports = function ({ addUtilities, addComponents, theme }) {
7881
backgroundColor: options.backgroundColor,
7982
backgroundOrigin: 'border-box',
8083
userSelect: 'none',
84+
colorAdjust: 'exact',
8185
'&:focus': {
8286
outline: 'none',
8387
boxShadow: options.focusBoxShadow,
@@ -94,12 +98,14 @@ module.exports = function ({ addUtilities, addComponents, theme }) {
9498
backgroundRepeat: 'no-repeat',
9599
},
96100
'&::-ms-check': {
97-
color: 'transparent', // Hide the dot
98-
background: 'inherit',
99-
borderColor: 'inherit',
100-
borderRadius: 'inherit',
101-
borderWidth: options.borderWidth,
102-
}
101+
'@media not print': {
102+
color: 'transparent', // Hide the dot
103+
background: 'inherit',
104+
borderColor: 'inherit',
105+
borderRadius: 'inherit',
106+
borderWidth: options.borderWidth,
107+
},
108+
},
103109
},
104110
'.form-input, .form-textarea, .form-multiselect': {
105111
appearance: 'none',
@@ -134,8 +140,16 @@ module.exports = function ({ addUtilities, addComponents, theme }) {
134140
backgroundPosition: `right ${options.selectIconOffset} center`,
135141
backgroundRepeat: 'no-repeat',
136142
backgroundSize: `${options.selectIconSize} ${options.selectIconSize}`,
143+
colorAdjust: 'exact',
137144
'&::-ms-expand': {
138-
display: 'none',
145+
border: 'none', // The select padding is causing some whitespace around the chevron which looks weird with a border
146+
color: defaultTheme.colors.gray[500], // Chevron color
147+
'@media not print': {
148+
display: 'none',
149+
},
150+
},
151+
'@media print and (-ms-high-contrast: active), print and (-ms-high-contrast: none)': {
152+
paddingRight: options.horizontalPadding, // Fix padding for print in IE
139153
},
140154
'&:focus': {
141155
outline: 'none',

0 commit comments

Comments
 (0)