-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathborderRadius.js
51 lines (48 loc) · 1.54 KB
/
borderRadius.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
const _ = require("lodash");
module.exports = function(
{ addUtilities, e, theme, variants, config },
isEnabled
) {
if (isEnabled) {
const generators = [
(value, modifier) => ({
[`.${e(`rounded-bs${modifier}`)}`]: {
"border-start-start-radius": `${value}`,
"border-start-end-radius": `${value}`
},
[`.${e(`rounded-be${modifier}`)}`]: {
"border-end-start-radius": `${value}`,
"border-end-end-radius": `${value}`
},
[`.${e(`rounded-is${modifier}`)}`]: {
"border-start-start-radius": `${value}`,
"border-end-start-radius": `${value}`
},
[`.${e(`rounded-ie${modifier}`)}`]: {
"border-start-end-radius": `${value}`,
"border-end-end-radius": `${value}`
}
}),
(value, modifier) => ({
[`.${e(`rounded-ss${modifier}`)}`]: {
"border-start-start-radius": `${value}`
},
[`.${e(`rounded-se${modifier}`)}`]: {
"border-start-end-radius": `${value}`
},
[`.${e(`rounded-es${modifier}`)}`]: {
"border-end-start-radius": `${value}`
},
[`.${e(`rounded-ee${modifier}`)}`]: {
"border-end-end-radius": `${value}`
}
})
];
const utilities = _.flatMap(generators, generator => {
return _.flatMap(theme("borderRadius"), (value, modifier) => {
return generator(value, modifier === "default" ? "" : `-${modifier}`);
});
});
addUtilities(utilities, variants("borderRadius"));
}
};