/**
 * ldesign v0.4.6
 * (c) 2023 ldesign
 * @license MIT
 */

'use strict';

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

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var VueCompositionAPI = require('@vue/composition-api');
var colorPicker_props = require('../props.js');
var radio_index = require('../../radio/index.js');
var colorPicker_hooks = require('../hooks.js');
var _common_js_colorPicker_constants = require('../../_common/js/color-picker/constants.js');
require('../../utils/map-props.js');
require('@babel/runtime/helpers/objectWithoutProperties');
require('vue');
require('../../utils/withInstall.js');
require('lodash/capitalize');
require('../../radio/radio.js');
require('../../_chunks/dep-c3e1ffac.js');
require('../../utils/helper.js');
require('@babel/runtime/helpers/slicedToArray');
require('lodash/camelCase');
require('../../utils/render-tnode.js');
require('@babel/runtime/helpers/typeof');
require('lodash/kebabCase');
require('../../utils/event.js');
require('../../config-provider/config-receiver.js');
require('lodash/mergeWith');
require('../../config-provider/context.js');
require('lodash/merge');
require('../../_common/js/global-config/default-config.js');
require('../../_common/js/global-config/locale/zh_CN.js');
require('../../_chunks/dep-7c884501.js');
require('dayjs');
require('../../utils/mixins.js');
require('../../radio/props.js');
require('../../radio/group.js');
require('lodash/isString');
require('lodash/isNumber');
require('../../utils/dom.js');
require('raf');
require('../../utils/easing.js');
require('../../radio/radio-group-props.js');
require('../../radio/radio-button.js');
require('../../hooks/useConfig.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: {
    TRadioGroup: radio_index.RadioGroup,
    TRadioButton: radio_index.RadioButton
  },
  props: _objectSpread(_objectSpread({}, 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 = colorPicker_hooks.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 ? _common_js_colorPicker_constants.COLOR_MODES[this.colorModes[0]] : h("l-radio-group", {
      "attrs": {
        "variant": "default-filled",
        "size": "small",
        "disabled": this.disabled
      },
      "on": {
        "change": this.handleModeChange
      },
      "model": {
        value: _this.modeValue,
        callback: function callback($$v) {
          _this.modeValue = $$v;
        }
      }
    }, [Object.keys(_common_js_colorPicker_constants.COLOR_MODES).map(function (key) {
      return h("l-radio-button", {
        "key": key,
        "attrs": {
          "value": key
        }
      }, [_common_js_colorPicker_constants.COLOR_MODES[key]]);
    })])])]);
  }
});

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