diff --git a/__tests__/fixtures/tailwind-output-important.css b/__tests__/fixtures/tailwind-output-important.css index c23f8657fb04..e50e8b5b9ebc 100644 --- a/__tests__/fixtures/tailwind-output-important.css +++ b/__tests__/fixtures/tailwind-output-important.css @@ -414,7 +414,9 @@ fieldset { ol, ul { + list-style: none; margin: 0; + padding: 0; } /** @@ -569,11 +571,6 @@ samp { } } -.list-reset { - list-style: none !important; - padding: 0 !important; -} - .appearance-none { appearance: none !important; } @@ -3180,6 +3177,26 @@ samp { line-height: 2 !important; } +.list-inside { + list-style-position: inside !important; +} + +.list-outside { + list-style-position: outside !important; +} + +.list-none { + list-style-type: none !important; +} + +.list-disc { + list-style-type: disc !important; +} + +.list-decimal { + list-style-type: decimal !important; +} + .m-0 { margin: 0 !important; } @@ -6602,11 +6619,6 @@ samp { } @media (min-width: 640px) { - .sm\:list-reset { - list-style: none !important; - padding: 0 !important; - } - .sm\:appearance-none { appearance: none !important; } @@ -9205,6 +9217,26 @@ samp { line-height: 2 !important; } + .sm\:list-inside { + list-style-position: inside !important; + } + + .sm\:list-outside { + list-style-position: outside !important; + } + + .sm\:list-none { + list-style-type: none !important; + } + + .sm\:list-disc { + list-style-type: disc !important; + } + + .sm\:list-decimal { + list-style-type: decimal !important; + } + .sm\:m-0 { margin: 0 !important; } @@ -12612,11 +12644,6 @@ samp { } @media (min-width: 768px) { - .md\:list-reset { - list-style: none !important; - padding: 0 !important; - } - .md\:appearance-none { appearance: none !important; } @@ -15215,6 +15242,26 @@ samp { line-height: 2 !important; } + .md\:list-inside { + list-style-position: inside !important; + } + + .md\:list-outside { + list-style-position: outside !important; + } + + .md\:list-none { + list-style-type: none !important; + } + + .md\:list-disc { + list-style-type: disc !important; + } + + .md\:list-decimal { + list-style-type: decimal !important; + } + .md\:m-0 { margin: 0 !important; } @@ -18622,11 +18669,6 @@ samp { } @media (min-width: 1024px) { - .lg\:list-reset { - list-style: none !important; - padding: 0 !important; - } - .lg\:appearance-none { appearance: none !important; } @@ -21225,6 +21267,26 @@ samp { line-height: 2 !important; } + .lg\:list-inside { + list-style-position: inside !important; + } + + .lg\:list-outside { + list-style-position: outside !important; + } + + .lg\:list-none { + list-style-type: none !important; + } + + .lg\:list-disc { + list-style-type: disc !important; + } + + .lg\:list-decimal { + list-style-type: decimal !important; + } + .lg\:m-0 { margin: 0 !important; } @@ -24632,11 +24694,6 @@ samp { } @media (min-width: 1280px) { - .xl\:list-reset { - list-style: none !important; - padding: 0 !important; - } - .xl\:appearance-none { appearance: none !important; } @@ -27235,6 +27292,26 @@ samp { line-height: 2 !important; } + .xl\:list-inside { + list-style-position: inside !important; + } + + .xl\:list-outside { + list-style-position: outside !important; + } + + .xl\:list-none { + list-style-type: none !important; + } + + .xl\:list-disc { + list-style-type: disc !important; + } + + .xl\:list-decimal { + list-style-type: decimal !important; + } + .xl\:m-0 { margin: 0 !important; } diff --git a/__tests__/fixtures/tailwind-output.css b/__tests__/fixtures/tailwind-output.css index d8b5cdfc0fbe..a0eee25a23dd 100644 --- a/__tests__/fixtures/tailwind-output.css +++ b/__tests__/fixtures/tailwind-output.css @@ -414,7 +414,9 @@ fieldset { ol, ul { + list-style: none; margin: 0; + padding: 0; } /** @@ -569,11 +571,6 @@ samp { } } -.list-reset { - list-style: none; - padding: 0; -} - .appearance-none { appearance: none; } @@ -3180,6 +3177,26 @@ samp { line-height: 2; } +.list-inside { + list-style-position: inside; +} + +.list-outside { + list-style-position: outside; +} + +.list-none { + list-style-type: none; +} + +.list-disc { + list-style-type: disc; +} + +.list-decimal { + list-style-type: decimal; +} + .m-0 { margin: 0; } @@ -6602,11 +6619,6 @@ samp { } @media (min-width: 640px) { - .sm\:list-reset { - list-style: none; - padding: 0; - } - .sm\:appearance-none { appearance: none; } @@ -9205,6 +9217,26 @@ samp { line-height: 2; } + .sm\:list-inside { + list-style-position: inside; + } + + .sm\:list-outside { + list-style-position: outside; + } + + .sm\:list-none { + list-style-type: none; + } + + .sm\:list-disc { + list-style-type: disc; + } + + .sm\:list-decimal { + list-style-type: decimal; + } + .sm\:m-0 { margin: 0; } @@ -12612,11 +12644,6 @@ samp { } @media (min-width: 768px) { - .md\:list-reset { - list-style: none; - padding: 0; - } - .md\:appearance-none { appearance: none; } @@ -15215,6 +15242,26 @@ samp { line-height: 2; } + .md\:list-inside { + list-style-position: inside; + } + + .md\:list-outside { + list-style-position: outside; + } + + .md\:list-none { + list-style-type: none; + } + + .md\:list-disc { + list-style-type: disc; + } + + .md\:list-decimal { + list-style-type: decimal; + } + .md\:m-0 { margin: 0; } @@ -18622,11 +18669,6 @@ samp { } @media (min-width: 1024px) { - .lg\:list-reset { - list-style: none; - padding: 0; - } - .lg\:appearance-none { appearance: none; } @@ -21225,6 +21267,26 @@ samp { line-height: 2; } + .lg\:list-inside { + list-style-position: inside; + } + + .lg\:list-outside { + list-style-position: outside; + } + + .lg\:list-none { + list-style-type: none; + } + + .lg\:list-disc { + list-style-type: disc; + } + + .lg\:list-decimal { + list-style-type: decimal; + } + .lg\:m-0 { margin: 0; } @@ -24632,11 +24694,6 @@ samp { } @media (min-width: 1280px) { - .xl\:list-reset { - list-style: none; - padding: 0; - } - .xl\:appearance-none { appearance: none; } @@ -27235,6 +27292,26 @@ samp { line-height: 2; } + .xl\:list-inside { + list-style-position: inside; + } + + .xl\:list-outside { + list-style-position: outside; + } + + .xl\:list-none { + list-style-type: none; + } + + .xl\:list-disc { + list-style-type: disc; + } + + .xl\:list-decimal { + list-style-type: decimal; + } + .xl\:m-0 { margin: 0; } diff --git a/defaultConfig.stub.js b/defaultConfig.stub.js index 48104ae6ccb3..044b2555a6e6 100644 --- a/defaultConfig.stub.js +++ b/defaultConfig.stub.js @@ -33,7 +33,8 @@ module.exports = { fontWeight: ['responsive', 'hover', 'focus'], height: ['responsive'], lineHeight: ['responsive'], - listStyle: ['responsive'], + listStylePosition: ['responsive'], + listStyleType: ['responsive'], margin: ['responsive'], maxHeight: ['responsive'], maxWidth: ['responsive'], diff --git a/defaultTheme.js b/defaultTheme.js index 2d35ec952a67..5da60f9adeb5 100644 --- a/defaultTheme.js +++ b/defaultTheme.js @@ -329,5 +329,10 @@ module.exports = function() { '0': 0, default: 1, }, + listStyleType: { + none: 'none', + disc: 'disc', + decimal: 'decimal', + }, } } diff --git a/src/corePlugins.js b/src/corePlugins.js index 7711076af1ef..b26d6dfe067e 100644 --- a/src/corePlugins.js +++ b/src/corePlugins.js @@ -1,5 +1,4 @@ import preflight from './plugins/preflight' -import listStyle from './plugins/listStyle' import appearance from './plugins/appearance' import backgroundAttachment from './plugins/backgroundAttachment' import backgroundColor from './plugins/backgroundColor' @@ -27,6 +26,8 @@ import fontFamily from './plugins/fontFamily' import fontWeight from './plugins/fontWeight' import height from './plugins/height' import lineHeight from './plugins/lineHeight' +import listStylePosition from './plugins/listStylePosition' +import listStyleType from './plugins/listStyleType' import margin from './plugins/margin' import maxHeight from './plugins/maxHeight' import maxWidth from './plugins/maxWidth' @@ -66,7 +67,6 @@ import configurePlugins from './util/configurePlugins' export default function({ corePlugins: corePluginConfig }) { return configurePlugins(corePluginConfig, { preflight, - listStyle, appearance, backgroundAttachment, backgroundColor, @@ -94,6 +94,8 @@ export default function({ corePlugins: corePluginConfig }) { fontWeight, height, lineHeight, + listStylePosition, + listStyleType, margin, maxHeight, maxWidth, diff --git a/src/plugins/css/preflight.css b/src/plugins/css/preflight.css index c6e9bfc5497a..f9beeefb3dcf 100644 --- a/src/plugins/css/preflight.css +++ b/src/plugins/css/preflight.css @@ -62,7 +62,9 @@ fieldset { ol, ul { + list-style: none; margin: 0; + padding: 0; } /** diff --git a/src/plugins/listStyle.js b/src/plugins/listStyle.js deleted file mode 100644 index 13a3f5cd258f..000000000000 --- a/src/plugins/listStyle.js +++ /dev/null @@ -1,13 +0,0 @@ -export default function() { - return function({ addUtilities, config }) { - addUtilities( - { - '.list-reset': { - 'list-style': 'none', - padding: '0', - }, - }, - config('variants.listStyle') - ) - } -} diff --git a/src/plugins/listStylePosition.js b/src/plugins/listStylePosition.js new file mode 100644 index 000000000000..230dd94211d4 --- /dev/null +++ b/src/plugins/listStylePosition.js @@ -0,0 +1,11 @@ +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.list-inside': { 'list-style-position': 'inside' }, + '.list-outside': { 'list-style-position': 'outside' }, + }, + config('variants.listStylePosition') + ) + } +} diff --git a/src/plugins/listStyleType.js b/src/plugins/listStyleType.js new file mode 100644 index 000000000000..224a42e341df --- /dev/null +++ b/src/plugins/listStyleType.js @@ -0,0 +1,18 @@ +import _ from 'lodash' + +export default function() { + return function({ addUtilities, e, config }) { + const utilities = _.fromPairs( + _.map(config('theme.listStyleType'), (value, modifier) => { + return [ + `.${e(`list-${modifier}`)}`, + { + 'list-style-type': value, + }, + ] + }) + ) + + addUtilities(utilities, config('variants.listStyleType')) + } +}