import { defineComponent, computed, openBlock, createElementBlock, Fragment, renderList, normalizeClass, unref, normalizeStyle, withModifiers } from "vue";
var index_vue_vue_type_style_index_0_lang = "";
const _hoisted_1 = { class: "color-select" };
const _hoisted_2 = ["onClick"];
const __default__ = {
  name: "RfColorSelect"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    modelValue: { default: "" },
    colorList: { default: null },
    themeColor: { default: "var(--wl-primary-color)" }
  },
  emits: ["update:modelValue"],
  setup(__props, { emit }) {
    const props = __props;
    const colorStyle = computed(() => {
      return function(item) {
        let whiteBorder = {};
        let whiteList = ["white", "#ffffff", "rgb(255, 255, 255)"];
        if (whiteList.includes(item)) {
          whiteBorder = {
            borderColor: props.modelValue === item ? props.themeColor : "#EEEEEE",
            borderWidth: props.modelValue === item ? "" : "2px"
          };
        }
        return {
          backgroundColor: item,
          borderColor: props.modelValue === item ? props.themeColor : "transparent",
          ...whiteBorder
        };
      };
    });
    const colorClass = computed(() => {
      return function(index) {
        return index === 0 ? "space-right" : index === props.colorList.length - 1 ? "space-left" : "space";
      };
    });
    const onClick = (val) => emit("update:modelValue", val);
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        (openBlock(true), createElementBlock(Fragment, null, renderList(__props.colorList, (item, index) => {
          return openBlock(), createElementBlock("div", {
            class: normalizeClass(["color", unref(colorClass)(index)]),
            key: item,
            style: normalizeStyle(unref(colorStyle)(item)),
            onClick: withModifiers(($event) => onClick(item), ["stop"])
          }, null, 14, _hoisted_2);
        }), 128))
      ]);
    };
  }
});
export { _sfc_main as default };
