/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

import { defineComponent, ref, watch } from '@vue/composition-api';
import props from '../props.js';
import { C as COLOR_MODES } from '../../../_chunks/dep-d1f2fda1.js';
import { RadioGroup, RadioButton } from '../../radio/index.js';
import { useBaseClassName } from '../hooks/index.js';
import '../../../utils/map-props.js';
import 'vue';
import '../../../utils/with-install.js';
import 'lodash';
import '../../../config.js';
import '../../radio/radio.js';
import '../../../_chunks/dep-29915b8e.js';
import '../../../utils/helper.js';
import 'lodash/camelCase';
import '../../../utils/render-node.js';
import '../../../utils/event.js';
import '../../config-provider/config-receiver.js';
import 'lodash/mergeWith';
import '../../config-provider/context.js';
import '../../../_chunks/dep-def4c2ce.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 '../../../hooks/use-config.js';
import '../../config-provider/useConfig.js';

var PanelHeader = defineComponent({
  name: "PanelHeader",
  components: {
    LRadioGroup: RadioGroup,
    LRadioButton: 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() {
    var _this$colorModes, _this$colorModes2;
    const h = arguments[0];
    if (((_this$colorModes = this.colorModes) === null || _this$colorModes === void 0 ? void 0 : _this$colorModes.length) === 1) return null;
    const {
      baseClassName
    } = this;
    return h("div", {
      "class": `${baseClassName}__head`
    }, [h("div", {
      "class": `${baseClassName}__mode`
    }, [((_this$colorModes2 = this.colorModes) === null || _this$colorModes2 === void 0 ? void 0 : _this$colorModes2.length) === 1 ? COLOR_MODES[this.colorModes[0]] : h("l-radio-group", {
      "attrs": {
        "variant": "default-filled",
        "size": "small"
      },
      "on": {
        "change": this.handleModeChange
      },
      "model": {
        value: this.modeValue,
        callback: $$v => {
          this.modeValue = $$v;
        }
      }
    }, [Object.keys(COLOR_MODES).map(key => h("l-radio-button", {
      "key": key,
      "attrs": {
        "value": key
      }
    }, [COLOR_MODES[key]]))])])]);
  }
});

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