@nextcloud/vue
Version:
Nextcloud vue components
83 lines (82 loc) • 3.17 kB
JavaScript
require('../assets/NcActionLink-7Wp6P-Nk.css');
"use strict";
const actionText = require("../chunks/actionText-D2-z0ud3.cjs");
const _pluginVue2_normalizer = require("../chunks/_plugin-vue2_normalizer-V0q-tHlQ.cjs");
const _sfc_main = {
name: "NcActionLink",
mixins: [actionText.ActionTextMixin],
inject: {
isInSemanticMenu: {
from: "NcActions:isSemanticMenu",
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
},
/**
* @deprecated To be removed in @nextcloud/vue 9. Migration guide: remove ariaHidden prop from NcAction* components.
* @todo Add a check in @nextcloud/vue 9 that this prop is not provided,
* otherwise root element will inherit incorrect aria-hidden.
*/
ariaHidden: {
type: Boolean,
// eslint-disable-next-line vue/no-boolean-default
default: null
}
}
};
var _sfc_render = function render() {
var _vm = this, _c = _vm._self._c;
return _c("li", { staticClass: "action", attrs: { "role": _vm.isInSemanticMenu && "presentation" } }, [_c("a", { staticClass: "action-link focusable", attrs: { "download": _vm.download, "href": _vm.href, "aria-label": _vm.ariaLabel, "target": _vm.target, "title": _vm.title, "rel": "nofollow noreferrer noopener", "role": _vm.isInSemanticMenu && "menuitem" }, on: { "click": _vm.onClick } }, [_vm._t("icon", function() {
return [_c("span", { staticClass: "action-link__icon", class: [_vm.isIconUrl ? "action-link__icon--url" : _vm.icon], style: { backgroundImage: _vm.isIconUrl ? `url(${_vm.icon})` : null }, attrs: { "aria-hidden": "true" } })];
}), _vm.name ? _c("span", { staticClass: "action-link__longtext-wrapper" }, [_c("strong", { staticClass: "action-link__name" }, [_vm._v(" " + _vm._s(_vm.name) + " ")]), _c("br"), _c("span", { staticClass: "action-link__longtext", domProps: { "textContent": _vm._s(_vm.text) } })]) : _vm.isLongText ? _c("span", { staticClass: "action-link__longtext", domProps: { "textContent": _vm._s(_vm.text) } }) : _c("span", { staticClass: "action-link__text" }, [_vm._v(_vm._s(_vm.text))]), _vm._e()], 2)]);
};
var _sfc_staticRenderFns = [];
var __component__ = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
_sfc_main,
_sfc_render,
_sfc_staticRenderFns,
false,
null,
"0dc8b2f3"
);
const NcActionLink = __component__.exports;
module.exports = NcActionLink;
//# sourceMappingURL=NcActionLink.cjs.map