mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2026-01-18 16:17:36 +00:00
Moves rounded out to it's own `radiuses` config, provide fewer default shadows, remove `defaults` key, instead add a default to each utility that has a no-suffix variant.
58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
import _ from 'lodash'
|
|
import defineClasses from '../util/defineClasses'
|
|
|
|
function defaultRounded(radius) {
|
|
return defineClasses({
|
|
'rounded': {
|
|
'border-radius': `${radius}`,
|
|
},
|
|
'rounded-t': {
|
|
'border-top-left-radius': `${radius}`,
|
|
'border-top-right-radius': `${radius}`,
|
|
},
|
|
'rounded-r': {
|
|
'border-top-right-radius': `${radius}`,
|
|
'border-bottom-right-radius': `${radius}`,
|
|
},
|
|
'rounded-b': {
|
|
'border-bottom-right-radius': `${radius}`,
|
|
'border-bottom-left-radius': `${radius}`,
|
|
},
|
|
'rounded-l': {
|
|
'border-bottom-left-radius': `${radius}`,
|
|
'border-top-left-radius': `${radius}`,
|
|
},
|
|
})
|
|
}
|
|
|
|
function roundedVariant(modifier, radius) {
|
|
return defineClasses({
|
|
[`rounded-${modifier}`]: {
|
|
'border-radius': `${radius}`,
|
|
},
|
|
[`rounded-t-${modifier}`]: {
|
|
'border-top-left-radius': `${radius}`,
|
|
'border-top-right-radius': `${radius}`,
|
|
},
|
|
[`rounded-r-${modifier}`]: {
|
|
'border-top-right-radius': `${radius}`,
|
|
'border-bottom-right-radius': `${radius}`,
|
|
},
|
|
[`rounded-b-${modifier}`]: {
|
|
'border-bottom-right-radius': `${radius}`,
|
|
'border-bottom-left-radius': `${radius}`,
|
|
},
|
|
[`rounded-l-${modifier}`]: {
|
|
'border-bottom-left-radius': `${radius}`,
|
|
'border-top-left-radius': `${radius}`,
|
|
},
|
|
})
|
|
}
|
|
|
|
module.exports = function({ radiuses }) {
|
|
return _.flatten([
|
|
defaultRounded(radiuses.default),
|
|
..._.map(_.omit(radiuses, 'default'), (radius, modifier) => roundedVariant(modifier, radius)),
|
|
])
|
|
}
|