UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

188 lines (187 loc) 6.57 kB
import { DtIconLink2 as O } from "@dialpad/dialtone-icons/vue3"; import B from "./message-input-button.js"; import { resolveComponent as a, openBlock as c, createBlock as _, withCtx as s, createVNode as l, createElementBlock as x, toDisplayString as u, createCommentVNode as y, withModifiers as p, withKeys as b, createTextVNode as d } from "vue"; import { _ as I } from "../../_plugin-vue_export-helper-CHgC5LLL.js"; import L from "../popover/popover.js"; import T from "../input/input.js"; import w from "../button/button.js"; import C from "../stack/stack.js"; const V = { compatConfig: { MODE: 3 }, name: "MessageInputLink", components: { DtPopover: L, DtInput: T, DtButton: w, DtStack: C, DtIconLink2: O, DtRecipeMessageInputButton: B }, props: { open: { type: Boolean, default: !1 }, linkButtonOptions: { type: Object, required: !0 }, isSelectionActive: { type: Function, default: () => { } } }, emits: ["set-link", "remove-link", "opened"], data() { return { linkText: "", linkInput: "", isOpen: !1 }; }, watch: { open: { immediate: !0, handler(o) { this.isOpen = o; } } }, methods: { setInitialValues(o, t) { this.linkText = o, this.linkInput = t; } } }, D = { key: 0, class: "d-recipe-message-input__link-dialog-title" }; function q(o, t, e, z, n, M) { const f = a("dt-icon-link2"), g = a("dt-recipe-message-input-button"), m = a("dt-input"), r = a("dt-button"), k = a("dt-stack"), v = a("dt-popover"); return c(), _(v, { open: n.isOpen, placement: "bottom-start", "content-class": "d-recipe-message-input__link-popover", "visually-hidden-close": !0, "visually-hidden-close-label": e.linkButtonOptions.visuallyHiddenCloseText, "data-qa": "dt-message-input-link-popover", "show-close-button": !1, onOpened: t[12] || (t[12] = (i) => o.$emit("opened", i)) }, { anchor: s(() => [ l(g, { "aria-label": e.linkButtonOptions.ariaLabel, "tooltip-text": e.linkButtonOptions.tooltipText, "keyboard-shortcut-text": e.linkButtonOptions.keyboardShortcutText, "data-qa": "message-input-link-btn", "is-active": e.isSelectionActive("link"), onClick: t[0] || (t[0] = (i) => n.isOpen = !0) }, { icon: s(() => [ l(f, { class: "d-recipe-message-input__button-stack-icon", size: "200" }) ]), _: 1 }, 8, ["aria-label", "tooltip-text", "keyboard-shortcut-text", "is-active"]) ]), content: s(() => [ l(k, { gap: "500" }, { default: s(() => [ e.linkButtonOptions.dialogTitle.length > 0 ? (c(), x("div", D, u(e.linkButtonOptions.dialogTitle), 1)) : y("", !0), l(m, { modelValue: n.linkText, "onUpdate:modelValue": t[1] || (t[1] = (i) => n.linkText = i), "input-aria-label": e.linkButtonOptions.textLabel, size: "xs", "data-qa": "dt-message-input-link-text-input", label: e.linkButtonOptions.textLabel, "input-wrapper-class": "d-recipe-message-input__link-input", onClick: t[2] || (t[2] = p(() => { }, ["stop"])), onFocus: t[3] || (t[3] = p(() => { }, ["stop"])), onKeydown: t[4] || (t[4] = b((i) => o.$emit("set-link", n.linkText, n.linkInput), ["enter"])) }, null, 8, ["modelValue", "input-aria-label", "label"]), l(m, { modelValue: n.linkInput, "onUpdate:modelValue": t[5] || (t[5] = (i) => n.linkInput = i), "input-aria-label": e.linkButtonOptions.linkLabel, size: "xs", "data-qa": "dt-message-input-link-input", placeholder: e.linkButtonOptions.linkPlaceholder, label: e.linkButtonOptions.linkLabel, "input-wrapper-class": "d-recipe-message-input__link-input", onClick: t[6] || (t[6] = p(() => { }, ["stop"])), onFocus: t[7] || (t[7] = p(() => { }, ["stop"])), onKeydown: t[8] || (t[8] = b((i) => o.$emit("set-link", n.linkText, n.linkInput), ["enter"])) }, null, 8, ["modelValue", "input-aria-label", "placeholder", "label"]), l(k, { direction: "row", class: "d-recipe-message-input__link-dialog-buttons" }, { default: s(() => [ l(r, { "aria-label": e.linkButtonOptions.removeLabel, importance: "clear", kind: "danger", size: "md", "data-qa": "dt-message-input-link-remove-btn", onClick: t[9] || (t[9] = (i) => o.$emit("remove-link", n.linkText, n.linkInput)) }, { default: s(() => [ d(u(e.linkButtonOptions.removeLabel), 1) ]), _: 1 }, 8, ["aria-label"]), l(k, { direction: "row", gap: "400" }, { default: s(() => [ l(r, { "aria-label": e.linkButtonOptions.cancelLabel, importance: "clear", kind: "muted", size: "md", "data-qa": "dt-message-input-link-cancel-btn", onClick: t[10] || (t[10] = (i) => n.isOpen = !1) }, { default: s(() => [ d(u(e.linkButtonOptions.cancelLabel), 1) ]), _: 1 }, 8, ["aria-label"]), l(r, { size: "md", "aria-label": e.linkButtonOptions.confirmLabel, "data-qa": "dt-message-input-link-confirm-btn", onClick: t[11] || (t[11] = (i) => o.$emit("set-link", n.linkText, n.linkInput)) }, { default: s(() => [ d(u(e.linkButtonOptions.confirmLabel), 1) ]), _: 1 }, 8, ["aria-label"]) ]), _: 1 }) ]), _: 1 }) ]), _: 1 }) ]), _: 1 }, 8, ["open", "visually-hidden-close-label"]); } const U = /* @__PURE__ */ I(V, [["render", q]]); export { U as default }; //# sourceMappingURL=message-input-link.js.map