require('../assets/NcChip-CIvAlds6.css'); "use strict"; const Vue = require("vue"); const _l10n = require("../chunks/_l10n-CjO_W5Dt.cjs"); const NcActions = require("../chunks/NcActions-DTICeoTz.cjs"); const NcActionButton = require("../chunks/NcActionButton-DcpUnqA7.cjs"); const NcIconSvgWrapper = require("../chunks/NcIconSvgWrapper-B_eOG2sZ.cjs"); const _pluginVue2_normalizer = require("../chunks/_plugin-vue2_normalizer-V0q-tHlQ.cjs"); var mdiClose = "M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"; _l10n.register(_l10n.t17); const _sfc_main = { __name: "NcChip", props: { /** * aria label to set on the close button * @default 'Close' */ ariaLabelClose: { type: String, default: _l10n.t("Close") }, /** * Main text of the chip */ text: { type: String, default: "" }, /** * Chip style * This sets the background style of the chip, similar to NcButton's `type` */ type: { type: String, default: "secondary", validator: (value) => ["primary", "secondary", "tertiary"].includes(value) }, /** * SVG path of the icon to use, this takes precedence over `iconSVG`. * For example icon paths from `@mdi/js` can be used. */ iconPath: { type: String, default: null }, /** * Inline SVG to use as the icon */ iconSvg: { type: String, default: null }, /** * Set to true to prevent the close button to be shown */ noClose: { type: Boolean, default: false } }, emits: ["close"], setup(__props, { emit }) { const props = __props; const slots = Vue.useSlots(); const canClose = Vue.computed(() => !props.noClose); const hasActions = () => Boolean(slots.actions?.()); const hasIcon = () => Boolean(props.iconPath || props.iconSvg || !!slots.icon?.()); const onClose = () => { emit("close"); }; return { __sfc: true, props, emit, slots, canClose, hasActions, hasIcon, onClose, mdiClose, NcActions: NcActions.NcActions, NcActionButton: NcActionButton.NcActionButton, NcIconSvgWrapper: NcIconSvgWrapper.NcIconSvgWrapper }; } }; var _sfc_render = function render() { var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy; return _c("div", { staticClass: "nc-chip", class: { [`nc-chip--${_vm.type}`]: true, "nc-chip--no-actions": _vm.noClose && !_setup.hasActions(), "nc-chip--no-icon": !_setup.hasIcon() } }, [_setup.hasIcon() ? _c("span", { staticClass: "nc-chip__icon" }, [_vm._t("icon", function() { return [_vm.iconPath || _vm.iconSvg ? _c(_setup.NcIconSvgWrapper, { attrs: { "inline": "", "path": _vm.iconPath, "svg": _vm.iconPath ? void 0 : _vm.iconSvg, "size": 18 } }) : _vm._e()]; })], 2) : _vm._e(), _c("span", { staticClass: "nc-chip__text" }, [_vm._t("default", function() { return [_vm._v(_vm._s(_vm.text))]; })], 2), _setup.canClose || _setup.hasActions() ? _c(_setup.NcActions, { staticClass: "nc-chip__actions", attrs: { "force-menu": !_setup.canClose, "type": "tertiary-no-background" } }, [_setup.canClose ? _c(_setup.NcActionButton, { attrs: { "close-after-click": "" }, on: { "click": _setup.onClose }, scopedSlots: _vm._u([{ key: "icon", fn: function() { return [_c(_setup.NcIconSvgWrapper, { attrs: { "path": _setup.mdiClose, "size": 20 } })]; }, proxy: true }], null, false, 2547223506) }, [_vm._v(" " + _vm._s(_vm.ariaLabelClose) + " ")]) : _vm._e(), _vm._t("actions")], 2) : _vm._e()], 1); }; var _sfc_staticRenderFns = []; var __component__ = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent( _sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "32e919e0" ); const NcChip = __component__.exports; module.exports = NcChip;