UNPKG

@nextcloud/vue

Version:
129 lines (128 loc) 4.08 kB
import '../assets/NcInputConfirmCancel-BEmwC87z.css'; import { I as IconArrowRight } from "./ArrowRight-B1ncAhus.mjs"; import { I as IconClose } from "./Close-CuhcJnX2.mjs"; import { r as register, k as t14, a as t } from "./_l10n-CG4CuN3H.mjs"; import { i as isLegacy34 } from "./legacy-BoqDmOCa.mjs"; import { N as NcButton } from "./NcButton-QbPBynlU.mjs"; import { resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, withKeys, withDirectives, vModelText, createVNode, withCtx } from "vue"; import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.mjs"; register(t14); const _sfc_main = { name: "NcInputConfirmCancel", components: { IconArrowRight, IconClose, NcButton }, setup() { return { isLegacy34 }; }, props: { /** * If this element is used on a primary element set to true for primary styling. */ primary: { default: false, type: Boolean }, /** * Placeholder of the edit field */ placeholder: { default: "", type: String }, /** * The current name (model value) */ modelValue: { default: "", type: String } }, emits: [ "cancel", "confirm", "update:modelValue" ], data() { return { labelConfirm: t("Confirm changes"), labelCancel: t("Cancel changes") }; }, computed: { valueModel: { get() { return this.modelValue; }, set(newValue) { this.$emit("update:modelValue", newValue); } } }, methods: { confirm() { this.$emit("confirm"); }, cancel() { this.$emit("cancel"); }, focusInput() { this.$refs.input.focus(); } } }; const _hoisted_1 = ["placeholder"]; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_IconArrowRight = resolveComponent("IconArrowRight"); const _component_NcButton = resolveComponent("NcButton"); const _component_IconClose = resolveComponent("IconClose"); return openBlock(), createElementBlock("div", { class: normalizeClass(["app-navigation-input-confirm", { "app-navigation-input-confirm--legacy": $setup.isLegacy34 }]) }, [ createElementVNode("form", { onSubmit: _cache[1] || (_cache[1] = withModifiers((...args) => $options.confirm && $options.confirm(...args), ["prevent"])), onKeydown: _cache[2] || (_cache[2] = withKeys(withModifiers((...args) => $options.cancel && $options.cancel(...args), ["exact", "stop", "prevent"]), ["esc"])), onClick: _cache[3] || (_cache[3] = withModifiers(() => { }, ["stop", "prevent"])) }, [ withDirectives(createElementVNode("input", { ref: "input", "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $options.valueModel = $event), type: "text", class: "app-navigation-input-confirm__input", placeholder: $props.placeholder }, null, 8, _hoisted_1), [ [vModelText, $options.valueModel] ]), createVNode(_component_NcButton, { "aria-label": $data.labelConfirm, type: "submit", variant: "primary", onClick: withModifiers($options.confirm, ["stop", "prevent"]) }, { icon: withCtx(() => [ createVNode(_component_IconArrowRight, { size: 20 }) ]), _: 1 }, 8, ["aria-label", "onClick"]), createVNode(_component_NcButton, { "aria-label": $data.labelCancel, type: "reset", variant: $props.primary ? "primary" : "tertiary", onClick: withModifiers($options.cancel, ["stop", "prevent"]) }, { icon: withCtx(() => [ createVNode(_component_IconClose, { size: 20 }) ]), _: 1 }, 8, ["aria-label", "variant", "onClick"]) ], 32) ], 2); } const NcInputConfirmCancel = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a8724c7f"]]); export { NcInputConfirmCancel as N }; //# sourceMappingURL=NcInputConfirmCancel-B6qC3s63.mjs.map