import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import { createVNode as _createVNode, Fragment as _Fragment } from "vue";
import { computed, defineComponent, provide } from 'vue';
import { PanelPickerContext, PanelPresetsContext } from './context';
import Divider from '../divider';
import PanelPicker from './components/PanelPicker';
import PanelPresets from './components/PanelPresets';
var ColorPickerPanel = defineComponent({
  name: 'ColorPickerPanel',
  inheritAttrs: false,
  props: ['prefixCls', 'presets', 'onChange', 'onClear', 'color', 'panelRender', 'formatOptions'],
  setup: function setup(props, _ref) {
    var attrs = _ref.attrs;
    var colorPickerPanelPrefixCls = computed(function () {
      return "".concat(props.prefixCls, "-inner-content");
    });
    // ==== Inject props ===
    var panelPickerProps = computed(function () {
      return _objectSpread({
        prefixCls: props.prefixCls,
        value: props.color,
        formatOptions: props.formatOptions,
        onChange: props.onChange,
        onClear: props.onClear
      }, attrs);
    });
    var panelPresetsProps = computed(function () {
      return {
        prefixCls: props.prefixCls,
        value: props.color,
        presets: props.presets,
        onChange: props.onChange
      };
    });
    // ==== Inject ===
    provide(PanelPickerContext, panelPickerProps);
    provide(PanelPresetsContext, panelPresetsProps);
    // ==== Render ===
    var innerPanel = computed(function () {
      return _createVNode(_Fragment, null, [_createVNode(PanelPicker, null, null), Array.isArray(props.presets) && _createVNode(Divider, {
        "class": "".concat(colorPickerPanelPrefixCls.value, "-divider")
      }, null), _createVNode(PanelPresets, null, null)]);
    });
    return function () {
      return _createVNode("div", {
        "class": colorPickerPanelPrefixCls.value
      }, [typeof props.panelRender === 'function' ? props.panelRender(innerPanel.value, {
        components: {
          Picker: PanelPicker,
          Presets: PanelPresets
        }
      }) : innerPanel.value]);
    };
  }
});
export default ColorPickerPanel;