UNPKG

@opensig/opendesign

Version:

41 lines (40 loc) 1.2 kB
import { defineComponent, inject, createElementBlock, openBlock, normalizeClass, renderSlot, createTextVNode, toDisplayString } from "vue"; import { dropdownInjectKey } from "./provide.mjs"; import { dropdownItemProps } from "./types.mjs"; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ODropdownItem", props: dropdownItemProps, setup(__props) { const props = __props; const dropdownInjection = inject(dropdownInjectKey, null); const onItemClick = () => { if (props.disabled) { return; } dropdownInjection == null ? void 0 : dropdownInjection.updateVisible(false); }; return (_ctx, _cache) => { return openBlock(), createElementBlock( "li", { class: normalizeClass(["o-dropdown-item", { "o-dropdown-disabled": props.disabled }]), onClick: onItemClick }, [ renderSlot(_ctx.$slots, "default", {}, () => [ createTextVNode( toDisplayString(props.label || `${props.value}`), 1 /* TEXT */ ) ]) ], 2 /* CLASS */ ); }; } }); export { _sfc_main as default };