/**
 * ldesign v0.2.22
 * (c) 2022/12/7 16:21 built by swimly
 * @license MIT
 */

import { defineComponent, ref, watch } from '@vue/composition-api';
import props from '../props.js';
import { COLOR_MODES } from '../const.js';
import { RadioGroup, RadioButton } from '../../radio/index.js';
import { useBaseClassName } from '../hooks/index.js';
import '../../../utils/map-props.js';
import 'vue';
import '../../../utils/withInstall.js';
import 'lodash/capitalize';
import '../../../config.js';
import '../../radio/radio.js';
import '../../../chunks/helper.js';
import '../../../chunks/_commonjsHelpers.js';
import '../../../utils/helper.js';
import 'lodash/camelCase';
import '../../../utils/render-node.js';
import 'lodash';
import '../../../utils/event.js';
import '../../config-provider/config-receiver.js';
import 'lodash/mergeWith';
import '../../config-provider/context.js';
import 'lodash/merge';
import '../../../chunks/zh_CN.js';
import '../../config-provider/type.js';
import '../../../utils/mixins.js';
import '../../radio/props.js';
import '../../radio/group.js';
import 'lodash/isString';
import 'lodash/isNumber';
import '../../radio/radio-button.js';
import '../../radio/style/css.js';
import '../../radio/type.js';
import '../../../hooks/useConfig.js';
import '../../config-provider/useConfig.js';

var PanelHeader = defineComponent({
  name: "PanelHeader",
  components: {
    TRadioGroup: RadioGroup,
    TRadioButton: RadioButton
  },
  props: {
    ...props,
    mode: {
      type: String,
      default: "color"
    },
    togglePopup: {
      type: Function
    },
    handleModeChange: {
      type: Function,
      default: () => () => {}
    }
  },
  setup(props2) {
    const baseClassName = useBaseClassName();
    const modeValue = ref(props2.mode);
    watch(() => props2.mode, v => {
      modeValue.value = v;
    });
    return {
      baseClassName,
      modeValue
    };
  },
  render() {
    const h = arguments[0];
    if (this.colorModes?.length === 1) return null;
    const {
      baseClassName
    } = this;
    return h("div", {
      "class": `${baseClassName}__head`
    }, [h("div", {
      "class": `${baseClassName}__mode`
    }, [this.colorModes?.length === 1 ? COLOR_MODES[this.colorModes[0]] : h("t-radio-group", {
      "attrs": {
        "variant": "default-filled",
        "size": "small",
        "disabled": this.disabled
      },
      "on": {
        "change": this.handleModeChange
      },
      "model": {
        value: this.modeValue,
        callback: $$v => {
          this.modeValue = $$v;
        }
      }
    }, [Object.keys(COLOR_MODES).map(key => h("t-radio-button", {
      "key": key,
      "attrs": {
        "value": key
      }
    }, [COLOR_MODES[key]]))])])]);
  }
});

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