Skip to content

Commit b221e81

Browse files
committed
Rename option to strategy with base & class options
1 parent 810b807 commit b221e81

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/index.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ const { colors, spacing, borderWidth, borderRadius, outline } = defaultTheme
66

77
const forms = plugin.withOptions(function (options) {
88
return function ({ addBase, theme }) {
9-
const swap = function (initial, classes) {
10-
return options && options.useFormClasses === true ? classes : initial
9+
const strategy = options && options.strategy === 'class' ? 'class' : 'base'
10+
11+
const swap = function (baseSelectors, classSelectors) {
12+
return strategy === 'class' ? classSelectors : baseSelectors
1113
}
1214

13-
const baseSelectors =
14-
(options && options.useFormClasses) === true
15-
? '.form-input, .form-textarea, .form-select'
16-
: "[type='text'], [type='email'], [type='url'], [type='password'], [type='number'], [type='date'], [type='datetime-local'], [type='month'], [type='search'], [type='tel'], [type='time'], [type='week'], [multiple], textarea, select"
15+
const baseSelectors = {
16+
class: '.form-input, .form-textarea, .form-select',
17+
base:
18+
"[type='text'],[type='email'], [type='url'], [type='password'], [type='number'], [type='date'], [type='datetime-local'], [type='month'], [type='search'], [type='tel'], [type='time'], [type='week'], [multiple], textarea, select",
19+
}
1720

1821
addBase({
19-
[baseSelectors]: {
22+
[baseSelectors[strategy]]: {
2023
appearance: 'none',
2124
'background-color': '#fff',
2225
'border-color': theme('colors.gray.500', colors.gray[500]),

0 commit comments

Comments
 (0)