@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
90 lines (89 loc) • 2.55 kB
JavaScript
import { InputGroupMixin as i } from "../../common/mixins/input-group.js";
import { hasSlotContent as p } from "../../common/utils/index.js";
import { resolveComponent as u, createElementBlock as t, openBlock as o, createCommentVNode as g, renderSlot as n, createVNode as m, mergeProps as r, createTextVNode as f, toDisplayString as h } from "vue";
import { _ as c } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
import v from "../validation-messages/validation-messages.js";
const C = {
compatConfig: { MODE: 3 },
name: "DtInputGroup",
components: { DtValidationMessages: v },
mixins: [i],
props: {
/**
* A data qa tag for the input group
*/
dataQaGroup: {
type: String,
default: "input-group"
},
/**
* A data qa tag for the input group legend
*/
dataQaGroupLegend: {
type: String,
default: "input-group-legend"
},
/**
* A data qa tag for the input group messages
*/
dataQaGroupMessages: {
type: String,
default: "input-group-messages"
}
},
data() {
return {
internalValue: this.value,
hasSlotContent: p
};
},
watch: {
value(e) {
this.internalValue = e;
},
/*
* watching value to support 2 way binding for slotted inputs.
* need this to pass value to slotted inputs if modified outside
* input group.
*/
internalValue: {
immediate: !0,
handler(e) {
this.provideObj.value = e;
}
}
},
methods: {
getMessageKey(e, s) {
return `input-group-message-${e}-${s}-${this.id}`;
}
}
}, G = ["data-qa"], M = ["data-qa"];
function _(e, s, a, S, d, V) {
const l = u("dt-validation-messages");
return o(), t("fieldset", {
class: "d-input-group__fieldset",
"data-qa": a.dataQaGroup
}, [
d.hasSlotContent(e.$slots.legend) || e.legend ? (o(), t("legend", r({
key: 0,
class: ["d-label", e.legendClass]
}, e.legendChildProps, { "data-qa": a.dataQaGroupLegend }), [
n(e.$slots, "legend", {}, () => [
f(h(e.legend), 1)
])
], 16, M)) : g("", !0),
n(e.$slots, "default"),
m(l, r({
"validation-messages": e.formattedMessages,
"show-messages": e.showMessages,
class: e.messagesClass,
"data-qa": a.dataQaGroupMessages
}, e.messagesChildProps), null, 16, ["validation-messages", "show-messages", "class", "data-qa"])
], 8, G);
}
const w = /* @__PURE__ */ c(C, [["render", _]]);
export {
w as default
};
//# sourceMappingURL=input-group.js.map