"use strict";

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

/*
Copyright 2021 Q-CTRL. All rights reserved.

Licensed under the Q-CTRL Terms of service (the "License"). Unauthorized
copying or use of this file, via any medium, is strictly prohibited.
Proprietary and confidential. You may not use this file except in compliance
with the License. You may obtain a copy of the License at

     https://q-ctrl.com/terms

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS. See the
License for the specific language.
*/
// const { flattenColorPalette, getRGB } = require("../../utilities/convertColors");
var _require = require("../../tokens/spacing"),
    spacing = _require.spacing;

var _require2 = require("../../tokens/border"),
    borderWidth = _require2.borderWidth,
    borderRadius = _require2.borderRadius;

var _require3 = require("../../tokens/typography"),
    fontSizes = _require3.fontSizes;

var baseFontSize = fontSizes.base[0];
var baseLineHeight = fontSizes.base[1].lineHeight;

var plugin = require("tailwindcss/plugin");

module.exports = function (_ref) {
  var addBase = _ref.addBase,
      theme = _ref.theme;
  addBase({
    "[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": {
      appearance: 'none',
      'background-color': '#fff',
      'border-color': theme('colors.gray.300'),
      'border-width': borderWidth['DEFAULT'],
      'border-radius': borderRadius['sm'],
      'padding-top': spacing[1],
      'padding-right': spacing[4],
      'padding-bottom': spacing[1],
      'padding-left': spacing[4],
      'font-size': baseFontSize,
      'line-height': baseLineHeight,
      '&:focus': {
        outline: "none",
        'outline-offset': "none",
        '--tw-ring-inset': 'var(--tw-empty,/*!*/ /*!*/)',
        '--tw-ring-offset-width': '0px',
        '--tw-ring-offset-color': '#fff',
        '--tw-ring-color': theme('colors.primary.DEFAULT'),
        '--tw-ring-offset-shadow': "var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)",
        '--tw-ring-shadow': "var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)",
        'box-shadow': "var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)",
        'border-color': theme('colors.primary.DEFAULT')
      }
    },
    "input::placeholder, textarea::placeholder": {
      color: theme('colors.gray.300'),
      opacity: '1'
    },
    "::-webkit-datetime-edit-fields-wrapper": {
      padding: '0'
    },
    "::-webkit-date-and-time-value": {
      'min-height': '1.5em'
    },
    "select": {
      'background-position': "right ".concat(spacing[1], " center"),
      'background-repeat': "no-repeat",
      'background-size': "1.5em 1.5em",
      'padding-right': spacing[8],
      'color-adjust': "exact"
    },
    "[multiple]": {
      'background-image': 'initial',
      'background-position': 'initial',
      'background-repeat': 'unset',
      'background-size': 'initial',
      'padding-right': spacing[3],
      'color-adjust': 'unset'
    },
    "[type='checkbox'], [type='radio']": {
      appearance: 'none',
      padding: '0',
      'color-adjust': 'exact',
      display: 'inline-block',
      'vertical-align': 'middle',
      'background-origin': 'border-box',
      'user-select': 'none',
      'flex-shrink': '0',
      height: spacing[6],
      width: spacing[6],
      color: theme('colors.primary.DEFAULT'),
      'background-color': '#fff',
      'background-position': 'center',
      'background-repeat': 'no-repeat',
      'border-color': theme('colors.gray.300'),
      'border-width': borderWidth['DEFAULT']
    },
    "[type='checkbox']": {
      'border-radius': borderRadius['none']
    },
    "[type='radio']": {
      'border-radius': '100%'
    },
    "[type='checkbox']:focus, [type='radio']:focus": {
      outline: "none",
      'outline-offset': "none",
      '--tw-ring-inset': 'var(--tw-empty,/*!*/ /*!*/)',
      '--tw-ring-offset-width': '0px',
      '--tw-ring-offset-color': '#fff',
      '--tw-ring-color': theme('colors.primary.DEFAULT'),
      '--tw-ring-offset-shadow': "var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)",
      '--tw-ring-shadow': "var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)",
      'box-shadow': "var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)"
    },
    "[type='checkbox']:checked`, `[type='radio']:checked": {
      'background-size': "100% 100%",
      'background-position': "center",
      'background-repeat': "no-repeat"
    },
    "[type='checkbox']:indeterminate": {
      'background-size': "100% 100%",
      'background-position': "center",
      'background-repeat': "no-repeat"
    },
    "[type='file']": {
      background: 'unset',
      'border-color': 'inherit',
      'border-width': '0',
      'border-radius': '0',
      padding: '0',
      'font-size': 'unset',
      'line-height': 'inherit'
    },
    "[type='file']:focus": _defineProperty({
      outline: "1px solid ButtonText"
    }, "outline", "1px auto -webkit-focus-ring-color")
  });
};