/**
 * tdesign v0.46.4
 * (c) 2022 tdesign
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { defineComponent, ref, watch } from '@vue/composition-api';
import props from '../props.js';
import '../const.js';
import { RadioGroup, RadioButton } from '../../radio/index.js';
import { useBaseClassName } from '../hooks.js';
import { COLOR_MODES } from '../../_common/js/color-picker/constants.js';
import '../../radio/radio.js';
import '../../_chunks/dep-a4bd011a.js';
import 'vue';
import '../../utils/helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/helpers/slicedToArray';
import 'lodash/camelCase';
import '../../utils/render-tnode.js';
import '@babel/runtime/helpers/typeof';
import 'lodash/kebabCase';
import '../../radio/props.js';
import '../../utils/event.js';
import '../../config-provider/config-receiver.js';
import 'lodash/mergeWith';
import '../../config-provider/context.js';
import 'lodash/merge';
import '../../_common/js/global-config/default-config.js';
import '../../_common/js/global-config/locale/zh_CN.js';
import '../../config-provider/type.js';
import '../../utils/mixins.js';
import '../../radio/group.js';
import 'lodash/isString';
import 'lodash/isNumber';
import '../../radio/radio-group-props.js';
import '../../radio/radio-button.js';
import '../../utils/map-props.js';
import '../../utils/withInstall.js';
import 'lodash/capitalize';
import './style/css.js';
import '../../radio/type.js';
import '../../hooks/useConfig.js';
import '../../config-provider/useConfig.js';

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(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 = defineComponent({
  name: "PanelHeader",
  components: {
    TRadioGroup: RadioGroup,
    TRadioButton: RadioButton
  },
  props: _objectSpread(_objectSpread({}, props), {}, {
    mode: {
      type: String,
      "default": "color"
    },
    togglePopup: {
      type: Function
    },
    handleModeChange: {
      type: Function,
      "default": function _default() {
        return function () {};
      }
    }
  }),
  setup: function setup(props2) {
    var baseClassName = useBaseClassName();
    var modeValue = ref(props2.mode);
    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 ? COLOR_MODES[this.colorModes[0]] : h("t-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(COLOR_MODES).map(function (key) {
      return h("t-radio-button", {
        "key": key,
        "attrs": {
          "value": key
        }
      }, [COLOR_MODES[key]]);
    })])])]);
  }
});

export { PanelHeader as default };
//# sourceMappingURL=header.js.map
