import '../assets/NcMentionBubble-BL05HUeF.css'; import '../assets/NcListItemIcon-UmX9YoH3.css'; import { N as NcAvatar, u as userStatus } from "./NcAvatar-BjwyJw34.mjs"; import { N as NcHighlight } from "./index-Bz6q9mZw.mjs"; import { N as NcIconSvgWrapper } from "./NcIconSvgWrapper-CHmdAuhg.mjs"; import "../Composables/useIsFullscreen.mjs"; import "../Composables/useIsMobile.mjs"; import "@nextcloud/router"; /* empty css */ import { n as normalizeComponent } from "./_plugin-vue2_normalizer-DU4iP6Vu.mjs"; import "escape-html"; import "striptags"; import "vue"; const margin = 8; const defaultSize = 32; const _sfc_main = { name: "NcListItemIcon", components: { NcAvatar, NcHighlight, NcIconSvgWrapper }, mixins: [ userStatus ], props: { /** * Default first line text */ name: { type: String, required: true }, /** * Secondary optional line * Only visible on size of 32 and above */ subname: { type: String, default: "" }, /** * Icon class to be displayed at the end of the component */ icon: { type: String, default: "" }, /** * SVG icon to be displayed at the end of the component */ iconSvg: { type: String, default: "" }, /** * Descriptive name for the icon */ iconName: { type: String, default: "" }, /** * Search within the highlight of name/subname */ search: { type: String, default: "" }, /** * Set a size in px that will define the avatar height/width * and therefore, the height of the component */ avatarSize: { type: Number, default: defaultSize }, /** * Disable the margins of this component. * Useful for integration in `NcSelect` for example */ noMargin: { type: Boolean, default: false }, /** * See the [Avatar](#Avatar) displayName prop * Fallback to name */ displayName: { type: String, default: null }, /** * See the [Avatar](#Avatar) isNoUser prop * Enable/disable the UserStatus fetching */ isNoUser: { type: Boolean, default: false }, /** * Unique list item ID */ id: { type: String, default: null } }, setup() { return { margin, defaultSize }; }, computed: { hasIcon() { return this.icon !== ""; }, hasIconSvg() { return this.iconSvg !== ""; }, isValidSubname() { return this.subname?.trim?.() !== ""; }, isSizeBigEnough() { return this.avatarSize >= 26; }, cssVars() { const margin2 = this.noMargin ? 0 : this.margin; return { "--height": this.avatarSize + 2 * margin2 + "px", "--margin": this.margin + "px" }; }, /** * Seperates the search property into two parts, the first one is the search part on the name, the second on the subname. * @return {[string, string]} */ searchParts() { const EMAIL_NOTATION = /^([^<]*)<([^>]+)>?$/; const match = this.search.match(EMAIL_NOTATION); if (this.isNoUser || !match) { return [this.search, this.search]; } return [match[1].trim(), match[2]]; } }, beforeMount() { if (!this.isNoUser && !this.subname) { this.fetchUserStatus(this.user); } } }; var _sfc_render = function render() { var _vm = this, _c = _vm._self._c; return _c("span", _vm._g({ staticClass: "option", class: { "option--compact": _vm.avatarSize < _vm.defaultSize }, style: _vm.cssVars, attrs: { "id": _vm.id } }, _vm.$listeners), [_c("NcAvatar", _vm._b({ staticClass: "option__avatar", attrs: { "disable-menu": true, "disable-tooltip": true, "display-name": _vm.displayName || _vm.name, "is-no-user": _vm.isNoUser, "size": _vm.avatarSize } }, "NcAvatar", _vm.$attrs, false)), _c("div", { staticClass: "option__details" }, [_c("NcHighlight", { staticClass: "option__lineone", attrs: { "text": _vm.name, "search": _vm.searchParts[0] } }), _vm.isValidSubname && _vm.isSizeBigEnough ? _c("NcHighlight", { staticClass: "option__linetwo", attrs: { "text": _vm.subname, "search": _vm.searchParts[1] } }) : _vm.hasStatus ? _c("span", [_c("span", [_vm._v(_vm._s(_vm.userStatus.icon))]), _c("span", [_vm._v(_vm._s(_vm.userStatus.message))])]) : _vm._e()], 1), _vm._t("default", function() { return [_vm.hasIconSvg ? _c("NcIconSvgWrapper", { staticClass: "option__icon", attrs: { "svg": _vm.iconSvg, "name": _vm.iconName } }) : _vm.hasIcon ? _c("span", { staticClass: "icon option__icon", class: _vm.icon, attrs: { "aria-label": _vm.iconName } }) : _vm._e()]; })], 2); }; var _sfc_staticRenderFns = []; var __component__ = /* @__PURE__ */ normalizeComponent( _sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "a0f4d73a" ); const NcListItemIcon = __component__.exports; export { NcListItemIcon as N };