/**
 * ldesign v0.2.2
 * (c) 2022年9月20日 swimly
 * @license MIT
 */

'use strict';

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

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var VueCompositionAPI = require('@vue/composition-api');
var components_colorPicker_props = require('../props.js');
var constants = require('../../../chunks/constants.js');
var components_radio_index = require('../../radio/index.js');
var components_colorPicker_hooks_index = require('../hooks/index.js');
require('../../radio/radio.js');
require('../../../chunks/helper.js');
require('vue');
require('../../../utils/helper.js');
require('@babel/runtime/helpers/objectWithoutProperties');
require('@babel/runtime/helpers/slicedToArray');
require('lodash/camelCase');
require('../../../utils/render-node.js');
require('@babel/runtime/helpers/typeof');
require('lodash/kebabCase');
require('../../radio/props.js');
require('../../../utils/event.js');
require('../../config-provider/config-receiver.js');
require('lodash/mergeWith');
require('lodash');
require('../../config-provider/context.js');
require('../../../chunks/zh_CN.js');
require('../../../utils/mixins.js');
require('../../radio/group.js');
require('lodash/isString');
require('lodash/isNumber');
require('../../radio/radio-button.js');
require('../../../utils/map-props.js');
require('../../../utils/with-install.js');
require('../../../config.js');
require('../../../hooks/use-config.js');
require('../../config-provider/useConfig.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var PanelHeader = VueCompositionAPI.defineComponent({
  name: "PanelHeader",
  components: {
    LRadioGroup: components_radio_index.RadioGroup,
    LRadioButton: components_radio_index.RadioButton
  },
  props: _objectSpread(_objectSpread({}, components_colorPicker_props["default"]), {}, {
    mode: {
      type: String,
      "default": "color"
    },
    togglePopup: {
      type: Function
    },
    handleModeChange: {
      type: Function,
      "default": function _default() {
        return function () {};
      }
    }
  }),
  setup: function setup(props2) {
    var baseClassName = components_colorPicker_hooks_index.useBaseClassName();
    var modeValue = VueCompositionAPI.ref(props2.mode);
    VueCompositionAPI.watch(function () {
      return props2.mode;
    }, function (v) {
      modeValue.value = v;
    });
    return {
      baseClassName: baseClassName,
      modeValue: modeValue
    };
  },
  render: function render() {
    var _this$colorModes,
        _this$colorModes2,
        _this = this;

    var h = arguments[0];

    if (((_this$colorModes = this.colorModes) === null || _this$colorModes === void 0 ? void 0 : _this$colorModes.length) === 1) {
      return null;
    }

    var baseClassName = this.baseClassName;
    return h("div", {
      "class": "".concat(baseClassName, "__head")
    }, [h("div", {
      "class": "".concat(baseClassName, "__mode")
    }, [((_this$colorModes2 = this.colorModes) === null || _this$colorModes2 === void 0 ? void 0 : _this$colorModes2.length) === 1 ? constants.COLOR_MODES[this.colorModes[0]] : h("l-radio-group", {
      "attrs": {
        "variant": "default-filled",
        "size": "small"
      },
      "on": {
        "change": this.handleModeChange
      },
      "model": {
        value: _this.modeValue,
        callback: function callback($$v) {
          _this.modeValue = $$v;
        }
      }
    }, [Object.keys(constants.COLOR_MODES).map(function (key) {
      return h("l-radio-button", {
        "key": key,
        "attrs": {
          "value": key
        }
      }, [constants.COLOR_MODES[key]]);
    })])])]);
  }
});

exports["default"] = PanelHeader;
//# sourceMappingURL=header.js.map
