-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
51 lines (44 loc) · 1.12 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module.exports = function (variants) {
return function({ addUtilities }) {
const className = 'visuallyhidden';
const focusClassName = 'focusable';
const original = {
clip: 'auto',
clipPath: 'none',
height: 'auto',
margin: 'auto',
overflow: 'auto',
position: 'relative',
width: 'auto',
whiteSpace: 'normal',
}
const focusable = {
clip: 'auto',
clipPath: 'none',
height: 'auto',
margin: '0',
overflow: 'visible',
position: 'static',
width: 'auto',
whiteSpace: 'inherit',
};
const utilities = {
[`.${className}`]: {
border: '0',
clip: 'rect(0 0 0 0)',
clipPath: 'inset(50%)',
height: '1px',
margin: '-1px',
overflow: 'hidden',
padding: '0',
position: 'absolute',
width: '1px',
whiteSpace: 'nowrap', /* 1 */
},
[`.not-${className}`]: original,
[`.${className}.${focusClassName}:active`]: focusable,
[`.${className}.${focusClassName}:focus`]: focusable,
}
addUtilities(utilities, variants)
}
}