@opensig/opendesign
Version:
63 lines (62 loc) • 1.9 kB
JavaScript
;
const vue = require("vue");
const types = require("./types.js");
const icons = require("../_utils/icons.js");
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
__name: "ORateItem",
props: types.rateItemProps,
emits: ["hover", "change"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const onHover = (isHalf) => {
emits("hover", isHalf);
};
const onClick = (isHalf) => {
emits("change", isHalf);
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"div",
{
class: vue.normalizeClass(["o-rate-item", { "is-full": props.status === "full", "is-half": props.status === "half" }])
},
[
vue.createElementVNode(
"span",
{
class: "o-rate-icon o-rate-icon-top",
onMouseenter: _cache[0] || (_cache[0] = ($event) => onHover(true)),
onClick: _cache[1] || (_cache[1] = ($event) => onClick(true))
},
[
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createVNode(vue.unref(icons.IconStar))
])
],
32
/* NEED_HYDRATION */
),
vue.createElementVNode(
"span",
{
class: "o-rate-icon o-rate-icon-bottom",
onMouseenter: _cache[2] || (_cache[2] = ($event) => onHover(false)),
onClick: _cache[3] || (_cache[3] = ($event) => onClick(false))
},
[
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createVNode(vue.unref(icons.IconStar))
])
],
32
/* NEED_HYDRATION */
)
],
2
/* CLASS */
);
};
}
});
module.exports = _sfc_main;