'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var normalizeComponent = require('./normalize-component-6fa50395.js');
var ThemeMixin = require('./ThemeMixin-a2f817cd.js');
require('./svg-atom-d2541b7d.js');
require('./icon-atom-65241b51.js');
require('./hover-atom-17a12a07.js');
require('./tooltip-atom-8f536df5.js');
var fieldAtom = require('./field-atom-fe4b7c7b.js');
var labelMolecule = require('./label-molecule-9793dd9f.js');
var descriptionAtom = require('./description-atom-34b2b8a7.js');

var inputId = 1;
var script = {
  name: 'FileSelectAtom',
  props: {
    skin: {
      type: String,
      default: 'primary',
      validator: function validator(value) {
        return ['primary', 'ghost'].indexOf(value) !== -1;
      }
    },
    size: {
      type: String,
      default: 'normal',
      validator: function validator(value) {
        return ['normal', 'big', 'area'].indexOf(value) !== -1;
      }
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  data: function data() {
    return {
      // eslint-disable-next-line no-plusplus
      inputId: "file-select-atom-idx-".concat(inputId++)
    };
  },
  computed: {
    buttonCssClass: function buttonCssClass() {
      var _objectSpread2;

      return ThemeMixin._objectSpread2(ThemeMixin._objectSpread2({}, this.themeCssClass), {}, (_objectSpread2 = {}, ThemeMixin._defineProperty(_objectSpread2, "size-".concat(this.size), true), ThemeMixin._defineProperty(_objectSpread2, "skin-".concat(this.skin), true), _objectSpread2));
    }
  },
  methods: {
    onChange: function onChange(e) {
      this.$emit('change', e); // drop value for reselect file(s)
      // eslint-disable-next-line no-param-reassign

      e.target.value = '';
    }
  },
  mixins: [ThemeMixin.ThemeMixin]
};

/* script */
const __vue_script__ = script;

/* template */
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('button',{staticClass:"file-select-atom",class:_vm.buttonCssClass,attrs:{"type":"button"}},[_c('label',{staticClass:"file-select-atom-label",attrs:{"for":_vm.inputId}},[_c('span',{staticClass:"file-select-atom-slot"},[_vm._t("default")],2),_vm._v(" "),_c('input',_vm._b({staticClass:"file-select-atom-input",attrs:{"id":_vm.inputId,"disabled":_vm.disabled,"type":"file"},on:{"change":_vm.onChange}},'input',_vm.$attrs,false))])])};
var __vue_staticRenderFns__ = [];

  /* style */
  const __vue_inject_styles__ = undefined;
  /* scoped */
  const __vue_scope_id__ = undefined;
  /* module identifier */
  const __vue_module_identifier__ = undefined;
  /* functional template */
  const __vue_is_functional_template__ = false;
  /* style inject */
  
  /* style inject SSR */
  

  
  var FileSelectAtom = normalizeComponent.__vue_normalize__(
    { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
    __vue_inject_styles__,
    __vue_script__,
    __vue_scope_id__,
    __vue_is_functional_template__,
    __vue_module_identifier__,
    undefined,
    undefined
  );

//
var script$1 = {
  name: 'VFileSelectButton',
  props: {
    label: {
      type: String,
      default: null
    },
    tooltipLabel: {
      type: String,
      default: null
    },
    description: {
      type: String,
      default: null
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    isDefaultSlot: function isDefaultSlot() {
      return !!this.$slots.default;
    }
  },
  methods: {
    onChange: function onChange(e) {
      this.$emit('change', e.target.files);
    }
  },
  mixins: [ThemeMixin.ThemeMixin],
  components: {
    LabelMolecule: labelMolecule.LabelMolecule,
    DescriptionAtom: descriptionAtom.DescriptionAtom,
    FieldAtom: fieldAtom.FieldAtom,
    FileSelectAtom: FileSelectAtom
  }
};

/* script */
const __vue_script__$1 = script$1;

/* template */
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('field-atom',{staticClass:"v-file-select-button",class:_vm.themeCssClass},[(_vm.label)?_c('label-molecule',{attrs:{"label":_vm.label,"tooltip-label":_vm.tooltipLabel,"disabled":_vm.disabled}}):_vm._e(),_vm._v(" "),(_vm.description)?_c('description-atom',_vm._b({staticClass:"v-file-select-button-desc",attrs:{"description":_vm.description}},'description-atom',_vm.$attrs,false)):_vm._e(),_vm._v(" "),_c('file-select-atom',_vm._b({attrs:{"disabled":_vm.disabled},on:{"change":_vm.onChange}},'file-select-atom',_vm.$attrs,false),[_vm._t("default"),_vm._v("\n    "+_vm._s(!_vm.isDefaultSlot ? 'Add File' : '')+"\n  ")],2)],1)};
var __vue_staticRenderFns__$1 = [];

  /* style */
  const __vue_inject_styles__$1 = undefined;
  /* scoped */
  const __vue_scope_id__$1 = undefined;
  /* module identifier */
  const __vue_module_identifier__$1 = undefined;
  /* functional template */
  const __vue_is_functional_template__$1 = false;
  /* style inject */
  
  /* style inject SSR */
  

  
  var VFileSelectButton = normalizeComponent.__vue_normalize__(
    { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
    __vue_inject_styles__$1,
    __vue_script__$1,
    __vue_scope_id__$1,
    __vue_is_functional_template__$1,
    __vue_module_identifier__$1,
    undefined,
    undefined
  );

exports.default = VFileSelectButton;
