diff --git a/defaultTheme.js b/defaultTheme.js index d13bce6f9..72c30190c 100644 --- a/defaultTheme.js +++ b/defaultTheme.js @@ -210,6 +210,14 @@ module.exports = function() { lg: '.5rem', full: '9999px', }, + cursor: { + auto: 'auto', + default: 'default', + pointer: 'pointer', + wait: 'wait', + move: 'move', + 'not-allowed': 'not-allowed', + }, width: theme => ({ auto: 'auto', ...theme.spacing, diff --git a/src/plugins/cursor.js b/src/plugins/cursor.js index 1de7683b8..a81f34ef0 100644 --- a/src/plugins/cursor.js +++ b/src/plugins/cursor.js @@ -1,15 +1,18 @@ -export default function({ variants }) { - return function({ addUtilities }) { - addUtilities( - { - '.cursor-auto': { cursor: 'auto' }, - '.cursor-default': { cursor: 'default' }, - '.cursor-pointer': { cursor: 'pointer' }, - '.cursor-wait': { cursor: 'wait' }, - '.cursor-move': { cursor: 'move' }, - '.cursor-not-allowed': { cursor: 'not-allowed' }, - }, - variants +import _ from 'lodash' + +export default function({ values, variants }) { + return function({ addUtilities, e }) { + const utilities = _.fromPairs( + _.map(values, (value, modifier) => { + return [ + `.${e(`cursor-${modifier}`)}`, + { + cursor: value, + }, + ] + }) ) + + addUtilities(utilities, variants) } }