UNPKG

@shopware-ag/meteor-component-library

Version:

The meteor component library is a Vue component library developed by Shopware. It is based on the [Meteor Design System](https://shopware.design/).

120 lines (119 loc) 4.89 kB
import '../mt-textarea.css'; "use strict"; const vue = require("vue"); const useId = require("../useId-31db4781.js"); const MtFieldLabel = require("./MtFieldLabel.js"); const MtFieldError = require("./MtFieldError.js"); const MtHelpText = require("./MtHelpText.js"); const _pluginVue_exportHelper = require("../_plugin-vue_export-helper-9c783a34.js"); require("../id-8e80f112.js"); require("./MtInheritanceSwitch.js"); require("../mt-icon.vue_vue_type_style_index_0_lang-0a28c7b6.js"); require("./MtTooltip.js"); require("../floating-ui.vue-48d5c774.js"); require("../floating-ui.dom-fe395b67.js"); require("../useIsInsideTooltip-f4674e27.js"); require("../index-ab705c2a.js"); require("vue-i18n"); require("./MtText.js"); const _hoisted_1 = { class: "mt-textarea" }; const _hoisted_2 = ["id", "required", "disabled", "name", "placeholder", "maxlength"]; const _hoisted_3 = { key: 3, class: "mt-textarea__hint" }; const _hoisted_4 = { key: 4, class: "mt-textarea__max-length" }; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ __name: "mt-textarea", props: /* @__PURE__ */ vue.mergeModels({ required: { type: Boolean }, disabled: { type: Boolean }, name: {}, label: {}, placeholder: {}, error: {}, helpText: {}, maxLength: {}, isInherited: { type: Boolean }, isInheritanceField: { type: Boolean } }, { "modelValue": { type: String }, "modelModifiers": {} }), emits: /* @__PURE__ */ vue.mergeModels(["change", "inheritance-remove", "inheritance-restore", "focus", "blur"], ["update:modelValue"]), setup(__props) { const model = vue.useModel(__props, "modelValue"); const id = useId.useId(); return (_ctx, _cache) => { var _a; return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ !!_ctx.label ? (vue.openBlock(), vue.createBlock(MtFieldLabel, { key: 0, for: vue.unref(id), required: _ctx.required, "has-error": !!_ctx.error && !!_ctx.error.detail, inheritance: !_ctx.isInheritanceField ? "none" : _ctx.isInherited ? "linked" : "unlinked", style: { gridArea: "label", marginBottom: "var(--scale-size-2)" }, "onUpdate:inheritance": _cache[0] || (_cache[0] = ($event) => { if (_ctx.isInherited) { _ctx.$emit("inheritance-remove"); } else { _ctx.$emit("inheritance-restore"); } }) }, { default: vue.withCtx(() => [ vue.createTextVNode(vue.toDisplayString(_ctx.label), 1) ]), _: 1 }, 8, ["for", "required", "has-error", "inheritance"])) : vue.createCommentVNode("", true), !!_ctx.helpText ? (vue.openBlock(), vue.createBlock(MtHelpText, { key: 1, text: _ctx.helpText, style: { gridArea: "help-text", justifySelf: "end" } }, null, 8, ["text"])) : vue.createCommentVNode("", true), vue.withDirectives(vue.createElementVNode("textarea", { "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => model.value = $event), class: vue.normalizeClass([ "mt-textarea__textarea", { "mt-textarea__textarea--error": !!_ctx.error && !!_ctx.error.detail } ]), onChange: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("change", model.value)), onFocus: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("focus")), onBlur: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("blur")), id: vue.unref(id), required: _ctx.required, disabled: _ctx.disabled || _ctx.isInherited, name: _ctx.name, placeholder: _ctx.placeholder, maxlength: _ctx.maxLength }, null, 42, _hoisted_2), [ [vue.vModelText, model.value] ]), !!_ctx.error && !!_ctx.error.detail ? (vue.openBlock(), vue.createBlock(MtFieldError, { key: 2, error: _ctx.error, style: { gridArea: "error" } }, null, 8, ["error"])) : vue.createCommentVNode("", true), !!_ctx.$slots.hint ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [ vue.renderSlot(_ctx.$slots, "hint", {}, void 0, true) ])) : vue.createCommentVNode("", true), !!_ctx.maxLength ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4, vue.toDisplayString(((_a = model.value) == null ? void 0 : _a.length) ?? 0) + "/" + vue.toDisplayString(_ctx.maxLength), 1)) : vue.createCommentVNode("", true) ]); }; } }); const mtTextarea_vue_vue_type_style_index_0_scoped_59f3eb48_lang = ""; const mtTextarea = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-59f3eb48"]]); module.exports = mtTextarea; //# sourceMappingURL=MtTextarea.js.map