UNPKG

@nextcloud/vue

Version:
113 lines (112 loc) 3.75 kB
import '../assets/NcActionLink-DAEr-vmd.css'; import { A as ActionTextMixin } from "./actionText-DYzDdbVe.mjs"; import { a as NC_ACTIONS_IS_SEMANTIC_MENU } from "./useNcActions-CiGWxAJE.mjs"; import { createElementBlock, openBlock, createElementVNode, renderSlot, createCommentVNode, normalizeStyle, normalizeClass, toDisplayString } from "vue"; import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.mjs"; const _sfc_main = { name: "NcActionLink", mixins: [ActionTextMixin], inject: { isInSemanticMenu: { from: NC_ACTIONS_IS_SEMANTIC_MENU, default: false } }, props: { /** * destionation to link to */ href: { type: String, required: true, validator: (value) => { try { return new URL(value); } catch { return value.startsWith("#") || value.startsWith("/"); } } }, /** * download the link instead of opening */ download: { type: String, default: null }, /** * target to open the link */ target: { type: String, default: "_self", validator: (value) => { return value && (!value.startsWith("_") || ["_blank", "_self", "_parent", "_top"].indexOf(value) > -1); } }, /** * Declares a native tooltip when not null */ title: { type: String, default: null } } }; const _hoisted_1 = ["role"]; const _hoisted_2 = ["download", "href", "aria-label", "target", "title", "role"]; const _hoisted_3 = { key: 0, class: "action-link__longtext-wrapper" }; const _hoisted_4 = { class: "action-link__name" }; const _hoisted_5 = ["textContent"]; const _hoisted_6 = ["textContent"]; const _hoisted_7 = { key: 2, class: "action-link__text" }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("li", { class: "action", role: $options.isInSemanticMenu && "presentation" }, [ createElementVNode("a", { download: $props.download, href: $props.href, "aria-label": _ctx.ariaLabel, target: $props.target, title: $props.title, class: "action-link focusable", rel: "nofollow noreferrer noopener", role: $options.isInSemanticMenu && "menuitem", onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args)) }, [ renderSlot(_ctx.$slots, "icon", {}, () => [ createElementVNode("span", { "aria-hidden": "true", class: normalizeClass(["action-link__icon", [_ctx.isIconUrl ? "action-link__icon--url" : _ctx.icon]]), style: normalizeStyle({ backgroundImage: _ctx.isIconUrl ? `url(${_ctx.icon})` : null }) }, null, 6) ], true), _ctx.name ? (openBlock(), createElementBlock("span", _hoisted_3, [ createElementVNode("strong", _hoisted_4, toDisplayString(_ctx.name), 1), _cache[1] || (_cache[1] = createElementVNode("br", null, null, -1)), createElementVNode("span", { class: "action-link__longtext", textContent: toDisplayString(_ctx.text) }, null, 8, _hoisted_5) ])) : _ctx.isLongText ? (openBlock(), createElementBlock("span", { key: 1, class: "action-link__longtext", textContent: toDisplayString(_ctx.text) }, null, 8, _hoisted_6)) : (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(_ctx.text), 1)), createCommentVNode("", true) ], 8, _hoisted_2) ], 8, _hoisted_1); } const NcActionLink = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-32f01b7a"]]); export { NcActionLink as N }; //# sourceMappingURL=NcActionLink-vEvKSV4N.mjs.map