vue-swatches
Version:
Help the user picking beautiful colors!
1,185 lines (1,058 loc) • 51.6 kB
JavaScript
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "fb15");
/******/ })
/************************************************************************/
/******/ ({
/***/ "0ca3":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VSwatch_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("c6aa");
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VSwatch_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VSwatch_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */
/* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VSwatch_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0___default.a);
/***/ }),
/***/ "7937":
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "7fca":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VCheck_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("c10a");
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VCheck_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VCheck_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */
/* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VCheck_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0___default.a);
/***/ }),
/***/ "8875":
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller
// MIT license
// source: https://github.com/amiller-gh/currentScript-polyfill
// added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505
(function (root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}(typeof self !== 'undefined' ? self : this, function () {
function getCurrentScript () {
if (document.currentScript) {
return document.currentScript
}
// IE 8-10 support script readyState
// IE 11+ & Firefox support stack trace
try {
throw new Error();
}
catch (err) {
// Find the second match for the "at" string to get file src url from stack.
var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig,
ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig,
stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),
scriptLocation = (stackDetails && stackDetails[1]) || false,
line = (stackDetails && stackDetails[2]) || false,
currentLocation = document.location.href.replace(document.location.hash, ''),
pageSource,
inlineScriptSourceRegExp,
inlineScriptSource,
scripts = document.getElementsByTagName('script'); // Live NodeList collection
if (scriptLocation === currentLocation) {
pageSource = document.documentElement.outerHTML;
inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
}
for (var i = 0; i < scripts.length; i++) {
// If ready state is interactive, return the script tag
if (scripts[i].readyState === 'interactive') {
return scripts[i];
}
// If src matches, return the script tag
if (scripts[i].src === scriptLocation) {
return scripts[i];
}
// If inline source matches, return the script tag
if (
scriptLocation === currentLocation &&
scripts[i].innerHTML &&
scripts[i].innerHTML.trim() === inlineScriptSource
) {
return scripts[i];
}
}
// If no match, return null
return null;
}
};
return getCurrentScript
}));
/***/ }),
/***/ "9334":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VSwatches_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("7937");
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VSwatches_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VSwatches_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */
/* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VSwatches_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0___default.a);
/***/ }),
/***/ "c10a":
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "c6aa":
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "fb15":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "DEFAULT_BACKGROUND_COLOR", function() { return /* reexport */ DEFAULT_BACKGROUND_COLOR; });
__webpack_require__.d(__webpack_exports__, "DEFAULT_BORDER_RADIUS", function() { return /* reexport */ DEFAULT_BORDER_RADIUS; });
__webpack_require__.d(__webpack_exports__, "DEFAULT_ROW_LENGTH", function() { return /* reexport */ DEFAULT_ROW_LENGTH; });
__webpack_require__.d(__webpack_exports__, "DEFAULT_TRIGGER_CONTAINER_SPACE", function() { return /* reexport */ DEFAULT_TRIGGER_CONTAINER_SPACE; });
__webpack_require__.d(__webpack_exports__, "DEFAULT_SWATCH_SIZE", function() { return /* reexport */ DEFAULT_SWATCH_SIZE; });
__webpack_require__.d(__webpack_exports__, "DEFAULT_SHOW_BORDER", function() { return /* reexport */ DEFAULT_SHOW_BORDER; });
__webpack_require__.d(__webpack_exports__, "extractPropertyFromPreset", function() { return /* reexport */ VSwatchesvue_type_script_lang_js_extractPropertyFromPreset; });
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
// This file is imported into lib/wc client bundles.
if (typeof window !== 'undefined') {
var currentScript = window.document.currentScript
if (true) {
var getCurrentScript = __webpack_require__("8875")
currentScript = getCurrentScript()
// for backward compatibility, because previously we directly included the polyfill
if (!('currentScript' in document)) {
Object.defineProperty(document, 'currentScript', { get: getCurrentScript })
}
}
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
if (src) {
__webpack_require__.p = src[1] // eslint-disable-line
}
}
// Indicate to webpack that this file can be concatenated
/* harmony default export */ var setPublicPath = (null);
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"74eff3ec-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VSwatches.vue?vue&type=template&id=518a4ec6&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vue-swatches",attrs:{"tabindex":"-1"},on:{"blur":function (e) { return _vm.onBlur(e.relatedTarget); }}},[(!_vm.inline)?_c('div',{ref:"triggerWrapper",staticClass:"vue-swatches__trigger__wrapper",on:{"click":_vm.togglePopover}},[_vm._t("trigger",[_c('div',{staticClass:"vue-swatches__trigger",class:{
'vue-swatches--is-empty': !_vm.value,
'vue-swatches--is-disabled': _vm.disabled
},style:(_vm.triggerStyles)},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.isNoColor),expression:"isNoColor"}],staticClass:"vue-swatches__diagonal__wrapper vue-swatches--has-children-centered"},[_c('div',{staticClass:"vue-swatches__diagonal"})])])])],2):_vm._e(),_c('transition',{attrs:{"name":"vue-swatches-show-hide"}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.inline || _vm.isOpen),expression:"inline || isOpen"}],ref:"containerWrapper",staticClass:"vue-swatches__container",class:{ 'vue-swatches--inline': _vm.inline },style:(_vm.containerStyles)},[_c('div',{staticClass:"vue-swatches__wrapper",style:(_vm.wrapperStyles)},[(_vm.isNested)?_vm._l((_vm.computedSwatches),function(swatchRow,index){return _c('div',{key:index,staticClass:"vue-swatches__row"},_vm._l((swatchRow),function(swatch,swatchIndex){return _c('v-swatch',{key:swatchIndex,attrs:{"is-last":index === _vm.computedSwatches.length - 1 &&
swatchIndex === swatchRow.length,"row-length-setted":_vm.rowLength !== null || _vm.presetRowLength !== null,"border-radius":_vm.computedBorderRadius,"disabled":_vm.getSwatchDisabled(swatch),"inline":_vm.inline,"selected":_vm.checkEquality(_vm.getSwatchColor(swatch), _vm.value),"swatch-size":_vm.computedSwatchSize,"spacing-size":_vm.computedSpacingSize,"show-border":_vm.getSwatchShowBorder(swatch),"show-checkbox":_vm.showCheckbox,"show-labels":_vm.showLabels,"swatch-color":_vm.getSwatchColor(swatch),"swatch-label":_vm.getSwatchLabel(swatch),"swatch-alt":_vm.getSwatchAlt(swatch),"swatch-style":_vm.swatchStyle},on:{"blur":function (relatedTarget) { return _vm.onBlur(relatedTarget); },"click":function($event){return _vm.updateSwatch(swatch)}},nativeOn:{"click":function($event){return _vm.updateSwatch(swatch)}}})}),1)}):_vm._l((_vm.computedSwatches),function(swatch,swatchIndex){return _c('v-swatch',{key:swatchIndex,attrs:{"is-last":swatchIndex === _vm.computedSwatches.length - 1,"row-length-setted":_vm.rowLength !== null || _vm.presetRowLength !== null,"border-radius":_vm.computedBorderRadius,"disabled":_vm.getSwatchDisabled(swatch),"inline":_vm.inline,"selected":_vm.checkEquality(_vm.getSwatchColor(swatch), _vm.value),"swatch-size":_vm.computedSwatchSize,"spacing-size":_vm.computedSpacingSize,"show-border":_vm.getSwatchShowBorder(swatch),"show-checkbox":_vm.showCheckbox,"show-labels":_vm.showLabels,"swatch-color":_vm.getSwatchColor(swatch),"swatch-label":_vm.getSwatchLabel(swatch),"swatch-alt":_vm.getSwatchAlt(swatch),"swatch-style":_vm.swatchStyle},on:{"blur":function (relatedTarget) { return _vm.onBlur(relatedTarget); },"click":function($event){return _vm.updateSwatch(swatch)}},nativeOn:{"click":function($event){return _vm.updateSwatch(swatch)}}})})],2),(_vm.showFallback)?_c('div',{staticClass:"vue-swatches__fallback__wrapper",style:(_vm.computedFallbackWrapperStyles)},[_c('span',{staticClass:"vue-swatches__fallback__input--wrapper"},[_c('input',{ref:"fallbackInput",staticClass:"vue-swatches__fallback__input",class:_vm.fallbackInputClass,attrs:{"type":_vm.fallbackInputType},domProps:{"value":_vm.internalValue},on:{"input":function (e) { return _vm.updateSwatch(e.target.value, { fromFallbackInput: true }); }}})]),(_vm.showFallbackOk)?_c('button',{staticClass:"vue-swatches__fallback__button",class:_vm.fallbackOkClass,on:{"click":function($event){$event.preventDefault();return _vm.onFallbackButtonClick($event)}}},[_vm._v(" "+_vm._s(_vm.fallbackOkText)+" ")]):_vm._e()]):_vm._e()])])],1)}
var staticRenderFns = []
// CONCATENATED MODULE: ./src/VSwatches.vue?vue&type=template&id=518a4ec6&
// CONCATENATED MODULE: ./src/presets/basic.js
/* harmony default export */ var basic = ({
colors: ["#1FBC9C", "#1CA085", "#2ECC70", "#27AF60", "#3398DB", "#2980B9", "#A463BF", "#8E43AD", "#3D556E", "#222F3D", "#F2C511", "#F39C19", "#E84B3C", "#C0382B", "#DDE6E8", "#BDC3C8"],
rowLength: 4
});
// CONCATENATED MODULE: ./src/presets/text-basic.js
/* harmony default export */ var text_basic = ({
colors: ["#CC0001", "#E36101", "#FFCC00", "#009900", "#0066CB", "#000000", "#FFFFFF"],
showBorder: true
});
// CONCATENATED MODULE: ./src/presets/text-advanced.js
/* harmony default export */ var text_advanced = ({
colors: [["#000000", "#434343", "#666666", "#999999", "#b7b7b7", "#cccccc", "#d9d9d9", "#efefef", "#f3f3f3", "#ffffff"], ["#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff", "#4a86e8", "#0000ff", "#9900ff", "#ff00ff"], ["#e6b8af", "#f4cccc", "#fce5cd", "#fff2cc", "#d9ead3", "#d0e0e3", "#c9daf8", "#cfe2f3", "#d9d2e9", "#ead1dc"], ["#dd7e6b", "#ea9999", "#f9cb9c", "#ffe599", "#b6d7a8", "#a2c4c9", "#a4c2f4", "#9fc5e8", "#b4a7d6", "#d5a6bd"], ["#cc4125", "#e06666", "#f6b26b", "#ffd966", "#93c47d", "#76a5af", "#6d9eeb", "#6fa8dc", "#8e7cc3", "#c27ba0"], ["#a61c00", "#cc0000", "#e69138", "#f1c232", "#6aa84f", "#45818e", "#3c78d8", "#3d85c6", "#674ea7", "#a64d79"], ["#85200c", "#990000", "#b45f06", "#bf9000", "#38761d", "#134f5c", "#1155cc", "#0b5394", "#351c75", "#741b47"], ["#5b0f00", "#660000", "#783f04", "#7f6000", "#274e13", "#0c343d", "#1c4587", "#073763", "#20124d", "#4c1130"]],
borderRadius: "0",
rowLength: 10,
swatchSize: 24,
spacingSize: 0
});
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"74eff3ec-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VSwatch.vue?vue&type=template&id=50bc40ed&
var VSwatchvue_type_template_id_50bc40ed_render = function () {
var this$1 = this;
var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vue-swatches__swatch",class:{
'vue-swatches__swatch--border': _vm.showBorder,
'vue-swatches__swatch--selected': _vm.selected,
'vue-swatches__swatch--is-disabled': _vm.disabled
},style:(_vm.swatchStyles),attrs:{"aria-label":_vm.swatchAlt,"role":"button","tabindex":"0"},on:{"keyup":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.$emit('click', _vm.swatchColor)},"blur":function (e) { return this$1.$emit('blur', e.relatedTarget); }}},[(_vm.swatchColor === '')?_c('div',{staticClass:"vue-swatches__diagonal__wrapper vue-swatches--has-children-centered"},[_c('div',{staticClass:"vue-swatches__diagonal"})]):_vm._e(),_c('v-check',{directives:[{name:"show",rawName:"v-show",value:(_vm.showCheckbox && _vm.selected),expression:"showCheckbox && selected"}]}),(_vm.showLabels)?_c('div',{staticClass:"vue-swatches__swatch__label",style:(_vm.labelStyles)},[_vm._v(" "+_vm._s(_vm.swatchLabel)+" ")]):_vm._e()],1)}
var VSwatchvue_type_template_id_50bc40ed_staticRenderFns = []
// CONCATENATED MODULE: ./src/VSwatch.vue?vue&type=template&id=50bc40ed&
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"74eff3ec-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VCheck.vue?vue&type=template&id=a04741f2&
var VCheckvue_type_template_id_a04741f2_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vue-swatches__check__wrapper vue-swatches--has-children-centered"},[_c('div',{staticClass:"vue-swatches__check__circle vue-swatches--has-children-centered"},[_c('svg',{staticClass:"check",attrs:{"version":"1.1","role":"presentation","width":"12","height":"12","viewBox":"0 0 1792 1792"}},[_c('path',{staticClass:"vue-swatches__check__path",attrs:{"d":"M1671 566q0 40-28 68l-724 724-136 136q-28 28-68 28t-68-28l-136-136-362-362q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 295 656-657q28-28 68-28t68 28l136 136q28 28 28 68z"}})])])])}
var VCheckvue_type_template_id_a04741f2_staticRenderFns = []
// CONCATENATED MODULE: ./src/VCheck.vue?vue&type=template&id=a04741f2&
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VCheck.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var VCheckvue_type_script_lang_js_ = ({
name: "v-check",
data: function data() {
return {};
}
});
// CONCATENATED MODULE: ./src/VCheck.vue?vue&type=script&lang=js&
/* harmony default export */ var src_VCheckvue_type_script_lang_js_ = (VCheckvue_type_script_lang_js_);
// EXTERNAL MODULE: ./src/VCheck.vue?vue&type=style&index=0&lang=scss&
var VCheckvue_type_style_index_0_lang_scss_ = __webpack_require__("7fca");
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent (
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier, /* server only */
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
// CONCATENATED MODULE: ./src/VCheck.vue
/* normalize component */
var component = normalizeComponent(
src_VCheckvue_type_script_lang_js_,
VCheckvue_type_template_id_a04741f2_render,
VCheckvue_type_template_id_a04741f2_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var VCheck = (component.exports);
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VSwatch.vue?vue&type=script&lang=js&
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var VSwatchvue_type_script_lang_js_ = ({
name: "v-swatch",
components: {
VCheck: VCheck
},
props: {
borderRadius: {
type: String // default is calculated in `Swatches.vue`
},
isLast: {
type: Boolean,
default: false
},
rowLengthSetted: {
type: Boolean,
default: false
},
disabled: {
type: Boolean // this prop comes from computed property and always should have a value
},
inline: {
type: Boolean // default is calculated in `Swatches.vue`
},
selected: {
type: Boolean,
default: false
},
showCheckbox: {
type: Boolean // default is calculated in `Swatches.vue`
},
showBorder: {
type: Boolean // default is calculated in `Swatches.vue`
},
showLabels: {
type: Boolean // default is especified in `Swatches.vue`
},
spacingSize: {
type: Number // this prop comes from computed property and always should have a value
},
swatchColor: {
type: String,
default: ""
},
swatchLabel: {
type: String // this prop comes from computed property and always should have a value
},
swatchAlt: {
type: String // this prop comes from computed property and always should have a value
},
swatchSize: {
type: Number // default is especified in `Swatches.vue`
},
swatchStyle: {
type: Object // default is especified in `Swatches.vue`
}
},
data: function data() {
return {};
},
computed: {
computedLabelStyle: function computedLabelStyle() {
var offset = 8 + Math.floor(this.spacingSize / 5) * 3;
return {
bottom: "-".concat(offset, "px")
};
},
computedSwatchStyle: function computedSwatchStyle() {
var baseStyles = {
width: "".concat(this.swatchSize, "px"),
height: "".concat(this.swatchSize, "px"),
borderRadius: this.borderRadius,
backgroundColor: this.swatchColor !== "" ? this.swatchColor : "#FFFFFF",
cursor: this.cursorStyle
};
if (!this.inline || !this.isLast) {
baseStyles.marginRight = "".concat(this.spacingSize, "px");
}
if (this.inline && !this.rowLengthSetted) return baseStyles;
return _objectSpread({}, baseStyles, {
marginBottom: "".concat(this.spacingSize, "px")
});
},
cursorStyle: function cursorStyle() {
if (this.disabled) return "not-allowed";
return "pointer";
},
labelStyles: function labelStyles() {
return [this.computedLabelStyle];
},
swatchStyles: function swatchStyles() {
return [this.computedSwatchStyle, this.swatchStyle];
}
}
});
// CONCATENATED MODULE: ./src/VSwatch.vue?vue&type=script&lang=js&
/* harmony default export */ var src_VSwatchvue_type_script_lang_js_ = (VSwatchvue_type_script_lang_js_);
// EXTERNAL MODULE: ./src/VSwatch.vue?vue&type=style&index=0&lang=scss&
var VSwatchvue_type_style_index_0_lang_scss_ = __webpack_require__("0ca3");
// CONCATENATED MODULE: ./src/VSwatch.vue
/* normalize component */
var VSwatch_component = normalizeComponent(
src_VSwatchvue_type_script_lang_js_,
VSwatchvue_type_template_id_50bc40ed_render,
VSwatchvue_type_template_id_50bc40ed_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var VSwatch = (VSwatch_component.exports);
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VSwatches.vue?vue&type=script&lang=js&
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function VSwatchesvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function VSwatchesvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { VSwatchesvue_type_script_lang_js_ownKeys(Object(source), true).forEach(function (key) { VSwatchesvue_type_script_lang_js_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { VSwatchesvue_type_script_lang_js_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function VSwatchesvue_type_script_lang_js_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; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var DEFAULT_BACKGROUND_COLOR = "#ffffff";
var DEFAULT_BORDER_RADIUS = "10px";
var DEFAULT_ROW_LENGTH = 4;
var DEFAULT_TRIGGER_CONTAINER_SPACE = 5;
var DEFAULT_SWATCH_SIZE = 42;
var DEFAULT_SHOW_BORDER = false;
var VSwatchesvue_type_script_lang_js_extractPropertyFromPreset = function extractPropertyFromPreset(presetName, property, alwaysReturn) {
if (typeof presetName !== "string") return null;else if (presetName === "text-basic") return text_basic[property] === undefined ? null : text_basic[property];else if (presetName === "text-advanced") return text_advanced[property] === undefined ? null : text_advanced[property];else if (presetName === "basic") return basic[property] === undefined ? null : basic[property];else if (alwaysReturn) return basic[property] === undefined ? null : basic[property];else return null;
};
/* harmony default export */ var VSwatchesvue_type_script_lang_js_ = ({
name: "v-swatches",
components: {
VSwatch: VSwatch
},
props: {
backgroundColor: {
type: String,
default: DEFAULT_BACKGROUND_COLOR
},
closeOnSelect: {
type: Boolean,
default: true
},
swatches: {
type: [Array, String],
default: function _default() {
return "basic";
}
},
disabled: {
type: Boolean,
default: false
},
fallbackInputClass: {
type: [Array, Object, String],
default: null
},
fallbackInputType: {
type: String,
default: function _default() {
return "text";
},
validator: function validator(value) {
return ["text", "color"].indexOf(value) !== -1;
}
},
fallbackOkClass: {
type: [Array, Object, String],
default: null
},
fallbackOkText: {
type: String,
default: "Ok"
},
inline: {
type: Boolean,
default: false
},
shapes: {
type: String,
default: "squares"
},
popoverX: {
type: String,
default: "right"
},
popoverY: {
type: String,
default: "bottom"
},
rowLength: {
type: [Number, String],
default: null // The default is especified as DEFAULT_ROW_LENGTH
},
showBorder: {
type: Boolean,
default: null // The default is especified as DEFAULT_SHOW_BORDER
},
showFallback: {
type: Boolean,
default: false
},
showCheckbox: {
type: Boolean,
default: true
},
showLabels: {
type: Boolean,
default: false
},
spacingSize: {
type: Number,
default: null // The default depends on swatch size
},
swatchSize: {
type: [Number, String],
default: null // The default is especified as DEFAULT_SWATCH_SIZE
},
swatchStyle: {
type: [Object, Array],
default: function _default() {}
},
triggerStyle: {
type: [Object, Array],
default: function _default() {}
},
wrapperStyle: {
type: [Object, Array],
default: function _default() {}
},
value: {
type: String,
default: null
}
},
data: function data() {
return {
alwaysOnScreenStyle: {},
componentMounted: false,
internalValue: this.value,
internalIsOpen: false
};
},
computed: {
isNested: function isNested() {
if (this.computedSwatches && this.computedSwatches.length && this.computedSwatches[0] instanceof Array) {
return true;
}
return false;
},
isOpen: function isOpen() {
if (this.inline) return false;
return this.internalIsOpen;
},
isNoColor: function isNoColor() {
return this.checkEquality("", this.value);
},
/** REAL COMPUTEDS (depends on user's props and preset's values, these have 'computed' prefix) **/
// Preset Computeds
presetBorderRadius: function presetBorderRadius() {
return VSwatchesvue_type_script_lang_js_extractPropertyFromPreset(this.swatches, "borderRadius");
},
presetRowLength: function presetRowLength() {
return VSwatchesvue_type_script_lang_js_extractPropertyFromPreset(this.swatches, "rowLength");
},
presetShowBorder: function presetShowBorder() {
return VSwatchesvue_type_script_lang_js_extractPropertyFromPreset(this.swatches, "showBorder");
},
presetSwatchSize: function presetSwatchSize() {
return VSwatchesvue_type_script_lang_js_extractPropertyFromPreset(this.swatches, "swatchSize");
},
presetSpacingSize: function presetSpacingSize() {
return VSwatchesvue_type_script_lang_js_extractPropertyFromPreset(this.swatches, "spacingSize");
},
// Computed value for `swatches`
computedSwatches: function computedSwatches() {
if (this.swatches instanceof Array) return this.swatches;
/* istanbul ignore else */
if (typeof this.swatches === "string") {
return VSwatchesvue_type_script_lang_js_extractPropertyFromPreset(this.swatches, "colors", true);
} else {
return [];
}
},
// Computed value for `borderRadius`
computedBorderRadius: function computedBorderRadius() {
// Priorize preset value
if (this.presetBorderRadius !== null) return this.presetBorderRadius; // over computed value
return this.borderRadius;
},
// Computed value for `rowLength`
computedRowLength: function computedRowLength() {
// Priorize user value
if (this.rowLength !== null) return Number(this.rowLength); // Over preset value
else if (this.presetRowLength !== null) return this.presetRowLength; // If there are less swatches than the default
else if (this.computedSwatches.length < DEFAULT_ROW_LENGTH && !this.isNested) return this.computedSwatches.length; // Use default otherwise
return DEFAULT_ROW_LENGTH;
},
// Computed value for `swatchSize`
computedSwatchSize: function computedSwatchSize() {
// Priorize user value
if (this.swatchSize !== null) return Number(this.swatchSize);else if (this.presetSwatchSize !== null) // over preset value
return this.presetSwatchSize; // Use default value if these two are unset
return DEFAULT_SWATCH_SIZE;
},
// Computed value for `spacingSize`
computedSpacingSize: function computedSpacingSize() {
// Priorize user value
if (this.spacingSize !== null) return this.spacingSize; // Priorize preset value
if (this.presetSpacingSize !== null) return this.presetSpacingSize; // over computed value
return Math.round(this.computedSwatchSize * 0.25);
},
// Computed value for `showBorder`
computedShowBorder: function computedShowBorder() {
// Priorize user value
if (this.showBorder !== null) return this.showBorder; // over preset value
if (this.presetShowBorder !== null) return this.presetShowBorder; // Use default value if these two are unset
return DEFAULT_SHOW_BORDER;
},
showFallbackOk: function showFallbackOk() {
return !this.inline;
},
/** DUMB COMPUTEDS (these only mutate props) **/
borderRadius: function borderRadius() {
if (this.shapes === "squares") return "".concat(Math.round(this.computedSwatchSize * 0.25), "px");else if (this.shapes === "circles") return "50%";
/* istanbul ignore next */
return "";
},
wrapperWidth: function wrapperWidth() {
return this.computedRowLength * (this.computedSwatchSize + this.computedSpacingSize);
},
/** COMPUTED STYLES **/
computedtriggerStyle: function computedtriggerStyle() {
return {
width: "42px",
height: "42px",
backgroundColor: this.value ? this.value : "#ffffff",
borderRadius: this.shapes === "circles" ? "50%" : DEFAULT_BORDER_RADIUS
};
},
triggerStyles: function triggerStyles() {
return [this.computedtriggerStyle, this.triggerStyle];
},
containerStyles: function containerStyles() {
var baseStyles = [{
backgroundColor: this.backgroundColor
}, this.alwaysOnScreenStyle];
if (this.inline) return baseStyles;
return [].concat(baseStyles, [{
padding: "5px",
marginBottom: "5px"
}]);
},
computedWrapperStyle: function computedWrapperStyle() {
if (this.inline) return {};
return {
paddingTop: "".concat(this.computedSpacingSize, "px"),
paddingLeft: "".concat(this.computedSpacingSize, "px"),
width: "".concat(this.wrapperWidth, "px")
};
},
wrapperStyles: function wrapperStyles() {
return [this.computedWrapperStyle, this.wrapperStyle];
},
computedFallbackWrapperStyle: function computedFallbackWrapperStyle() {
var baseStyles = {
marginLeft: "".concat(this.computedSpacingSize, "px"),
paddingBottom: "".concat(this.computedSpacingSize, "px")
};
if (this.inline) return baseStyles;
return VSwatchesvue_type_script_lang_js_objectSpread({}, baseStyles, {
width: "".concat(this.wrapperWidth - this.computedSpacingSize, "px")
});
},
computedFallbackWrapperStyles: function computedFallbackWrapperStyles() {
return [this.computedFallbackWrapperStyle];
}
},
watch: {
value: function value(newValue) {
this.internalValue = newValue;
}
},
mounted: function mounted() {
this.componentMounted = true;
},
methods: {
// Called programmatically
checkEquality: function checkEquality(color1, color2) {
if (!color1 && color1 !== "" || !color2 && color2 !== "") return false;
return color1.toUpperCase() === color2.toUpperCase();
},
hidePopover: function hidePopover() {
this.internalIsOpen = false;
this.$el.blur();
this.$emit("close", this.internalValue);
},
getAlwaysOnScreenStyle: function getAlwaysOnScreenStyle() {
var styles = {};
var triggerEl = this.$refs.triggerWrapper;
var containerEl = this.$refs.containerWrapper;
/* istanbul ignore if */
if (!this.componentMounted || this.inline || !triggerEl || !window || !document) return styles;
var triggerRect = triggerEl.getBoundingClientRect();
var leftMin = 5;
var rightMax = (document.documentElement.clientWidth || window.innerWidth) - 5;
var topMin = 5;
var bottomMax = (document.documentElement.clientHeight || window.innerHeight) - 5;
containerEl.style.visibility = "hidden";
containerEl.style.display = "block";
var containerRect = containerEl.getBoundingClientRect();
containerEl.style.display = "none";
containerEl.style.visibility = "visible";
if (this.popoverY === "top") {
if (triggerRect.top - containerRect.height < topMin) {
// Showing bellow
styles.top = "".concat(triggerRect.height + DEFAULT_TRIGGER_CONTAINER_SPACE, "px");
styles.bottom = "auto";
} else {
// Showing above
styles.bottom = "".concat(triggerRect.height + DEFAULT_TRIGGER_CONTAINER_SPACE, "px");
styles.top = "auto";
}
} else {
/* istanbul ignore else */
if (this.popoverY === "bottom") {
if (triggerRect.bottom + containerRect.height > bottomMax) {
// Showing above
styles.bottom = "".concat(triggerRect.height + DEFAULT_TRIGGER_CONTAINER_SPACE, "px");
styles.top = "auto";
} else {
// Showing bellow
styles.top = "".concat(triggerRect.height + DEFAULT_TRIGGER_CONTAINER_SPACE, "px");
styles.bottom = "auto";
}
}
}
if (this.popoverX === "left") {
if (triggerRect.right - containerRect.width < leftMin) {
// Showing at the right
styles.left = 0;
styles.right = "auto";
} else {
// Showing at the left
styles.right = 0;
styles.left = "auto";
}
} else {
/* istanbul ignore else */
if (this.popoverX === "right") {
if (triggerRect.left + containerRect.width > rightMax) {
// Showing at the left
styles.right = 0;
styles.left = "auto";
} else {
// Showing at the right
styles.left = 0;
styles.right = "auto";
}
}
}
return styles;
},
getSwatchShowBorder: function getSwatchShowBorder(swatch) {
if (typeof swatch === "string") return this.computedShowBorder;else if (_typeof(swatch) === "object") return swatch.showBorder !== undefined ? swatch.showBorder : this.computedShowBorder;
},
getSwatchColor: function getSwatchColor(swatch) {
if (typeof swatch === "string") return swatch;else if (_typeof(swatch) === "object") return swatch.color;
},
getSwatchDisabled: function getSwatchDisabled(swatch) {
if (typeof swatch === "string") return this.disabled;else if (_typeof(swatch) === "object") return swatch.disabled !== undefined ? swatch.disabled : this.disabled;
},
getSwatchLabel: function getSwatchLabel(swatch) {
if (typeof swatch === "string") return swatch;else if (_typeof(swatch) === "object") return swatch.label || swatch.color;
},
getSwatchAlt: function getSwatchAlt(swatch) {
if (typeof swatch === "string") return swatch;else if (_typeof(swatch) === "object") return swatch.alt || this.getSwatchLabel(swatch);
},
// Called by user action
onBlur: function onBlur(relatedTarget) {
/* istanbul ignore if */
if (!this.isOpen) return;
/* dont hide */
// We only close the Popover if the relatedTarget came from outside the component
// Check if the relatedTarget is inside the component
if (relatedTarget !== null && this.$el.contains(relatedTarget)) return;
/* dont hide */
this.internalIsOpen = false;
this.$emit("close", this.internalValue);
},
onFallbackButtonClick: function onFallbackButtonClick() {
this.hidePopover();
},
// Called programmatically
showPopover: function showPopover() {
/* istanbul ignore if */
if (this.isOpen || this.inline || this.disabled) return;
/* dont show */
this.alwaysOnScreenStyle = this.getAlwaysOnScreenStyle();
this.internalIsOpen