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

import { defineComponent, ref, watch } from '@vue/composition-api';
import props from '../props.js';
import { C as COLOR_MODES } from '../../../_chunks/dep-770375f0.js';
import { RadioGroup, RadioButton } from '../../radio/index.js';
import { useBaseClassName } from '../hooks/index.js';
import '../../radio/radio.js';
import '../../../_chunks/dep-9cf53923.js';
import 'vue';
import '../../../utils/helper.js';
import 'lodash/camelCase';
import '../../../utils/render-node.js';
import 'lodash/kebabCase';
import '../../radio/props.js';
import '../../../utils/event.js';
import '../../config-provider/config-receiver.js';
import 'lodash/mergeWith';
import 'lodash';
import '../../config-provider/context.js';
import '../../../_chunks/dep-b1584b65.js';
import '../../../utils/mixins.js';
import '../../radio/group.js';
import 'lodash/isString';
import 'lodash/isNumber';
import '../../radio/radio-button.js';
import '../../../utils/map-props.js';
import '../../../utils/with-install.js';
import '../../../config.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
