@vue-interface/input-field 2.0.15 → 2.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/input-field.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ActivityIndicator as
|
|
3
|
-
import { useFormControl as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as S, mergeModels as V, useModel as D, useTemplateRef as d, createElementBlock as m, openBlock as i, normalizeClass as w, unref as t, renderSlot as l, createElementVNode as s, createCommentVNode as c, toDisplayString as f, normalizeProps as v, guardReactiveProps as y, withDirectives as E, mergeProps as I, vModelDynamic as P, createVNode as T, Transition as x, withCtx as h, createBlock as z, createTextVNode as R } from "vue";
|
|
2
|
+
import { ActivityIndicator as G } from "@vue-interface/activity-indicator";
|
|
3
|
+
import { useFormControl as U, FormControlErrors as j, FormControlFeedback as q } from "@vue-interface/form-control";
|
|
4
|
+
const H = ["for"], J = { class: "form-control-inner" }, K = { class: "form-control-activity-indicator" }, L = {
|
|
5
5
|
invalid: "",
|
|
6
6
|
class: "invalid-feedback"
|
|
7
|
-
},
|
|
7
|
+
}, O = {
|
|
8
8
|
valid: "",
|
|
9
9
|
class: "valid-feedback"
|
|
10
|
-
},
|
|
10
|
+
}, Y = /* @__PURE__ */ S({
|
|
11
11
|
inheritAttrs: !1,
|
|
12
12
|
__name: "InputField",
|
|
13
|
-
props: /* @__PURE__ */
|
|
13
|
+
props: /* @__PURE__ */ V({
|
|
14
14
|
activity: { type: Boolean },
|
|
15
15
|
disabled: { type: Boolean },
|
|
16
16
|
error: {},
|
|
@@ -36,93 +36,106 @@ const x = ["for"], G = { class: "form-control-inner" }, U = { class: "form-contr
|
|
|
36
36
|
modelValue: {},
|
|
37
37
|
modelModifiers: {}
|
|
38
38
|
}),
|
|
39
|
-
emits: /* @__PURE__ */
|
|
40
|
-
setup(e, { emit:
|
|
41
|
-
const
|
|
42
|
-
controlAttributes:
|
|
43
|
-
formGroupClasses:
|
|
44
|
-
listeners:
|
|
45
|
-
} =
|
|
46
|
-
return (
|
|
47
|
-
|
|
39
|
+
emits: /* @__PURE__ */ V(["blur", "focus", "focusin", "focusout", "click", "doubleclick", "contextmenu", "mousedown", "mouseup", "mouseover", "mouseout", "mouseenter", "mouseleave", "mousemove", "keydown", "keyup", "keypress", "select", "selectionchange", "invalid", "submit", "reset", "scroll", "wheel", "copy", "cut", "paste", "touchstart", "touchend", "touchmove", "touchcancel", "change", "input", "beforeinput"], ["update:modelValue"]),
|
|
40
|
+
setup(e, { expose: g, emit: F }) {
|
|
41
|
+
const A = e, b = D(e, "modelValue"), M = F, {
|
|
42
|
+
controlAttributes: k,
|
|
43
|
+
formGroupClasses: N,
|
|
44
|
+
listeners: C
|
|
45
|
+
} = U({ model: b, props: A, emit: M }), p = d("activity"), $ = d("help"), u = d("label"), n = d("field"), B = d("wrapper");
|
|
46
|
+
return g({
|
|
47
|
+
activity: p,
|
|
48
|
+
help: $,
|
|
49
|
+
field: n,
|
|
50
|
+
label: u,
|
|
51
|
+
wrapper: B,
|
|
52
|
+
focus: () => n.value?.focus(),
|
|
53
|
+
blur: () => n.value?.blur()
|
|
54
|
+
}), (o, r) => (i(), m("div", {
|
|
55
|
+
ref_key: "wrapper",
|
|
56
|
+
ref: B,
|
|
57
|
+
class: w(["input-field", t(N)])
|
|
48
58
|
}, [
|
|
49
59
|
l(o.$slots, "label", {}, () => [
|
|
50
|
-
|
|
60
|
+
u.value ? (i(), m("label", {
|
|
51
61
|
key: 0,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
ref_key: "label",
|
|
63
|
+
ref: u,
|
|
64
|
+
class: w(e.labelClass),
|
|
65
|
+
for: t(k).id
|
|
66
|
+
}, f(u.value), 11, H)) : c("", !0)
|
|
56
67
|
]),
|
|
57
|
-
|
|
58
|
-
l(o.$slots, "control",
|
|
59
|
-
o.$slots.icon ? (
|
|
68
|
+
s("div", J, [
|
|
69
|
+
l(o.$slots, "control", v(y({ controlAttributes: t(k), listeners: t(C) })), () => [
|
|
70
|
+
o.$slots.icon ? (i(), m("div", {
|
|
60
71
|
key: 0,
|
|
61
72
|
class: "form-control-inner-icon",
|
|
62
|
-
onClick: r[0] || (r[0] = (
|
|
73
|
+
onClick: r[0] || (r[0] = (a) => n.value?.focus())
|
|
63
74
|
}, [
|
|
64
75
|
l(o.$slots, "icon")
|
|
65
|
-
])) :
|
|
66
|
-
|
|
76
|
+
])) : c("", !0),
|
|
77
|
+
E(s("input", I({
|
|
67
78
|
ref_key: "field",
|
|
68
|
-
ref:
|
|
69
|
-
"onUpdate:modelValue": r[1] || (r[1] = (
|
|
70
|
-
}, { ...t(
|
|
71
|
-
[
|
|
79
|
+
ref: n,
|
|
80
|
+
"onUpdate:modelValue": r[1] || (r[1] = (a) => b.value = a)
|
|
81
|
+
}, { ...t(k), ...t(C) }), null, 16), [
|
|
82
|
+
[P, b.value]
|
|
72
83
|
])
|
|
73
84
|
]),
|
|
74
|
-
|
|
85
|
+
s("div", K, [
|
|
75
86
|
l(o.$slots, "activity", {}, () => [
|
|
76
|
-
|
|
77
|
-
default:
|
|
78
|
-
|
|
87
|
+
T(x, { name: "input-field-fade" }, {
|
|
88
|
+
default: h(() => [
|
|
89
|
+
p.value && e.indicator ? (i(), z(t(G), {
|
|
79
90
|
key: "activity",
|
|
80
|
-
|
|
91
|
+
ref_key: "activity",
|
|
92
|
+
ref: p,
|
|
81
93
|
type: e.indicator,
|
|
82
94
|
size: e.indicatorSize
|
|
83
|
-
}, null, 8, ["type", "size"])) :
|
|
95
|
+
}, null, 8, ["type", "size"])) : c("", !0)
|
|
84
96
|
]),
|
|
85
97
|
_: 1
|
|
86
98
|
})
|
|
87
99
|
])
|
|
88
100
|
])
|
|
89
101
|
]),
|
|
90
|
-
l(o.$slots, "errors",
|
|
91
|
-
e.error || e.errors ? (
|
|
102
|
+
l(o.$slots, "errors", v(y({ error: e.error, errors: e.errors, id: o.$attrs.id, name: o.$attrs.name })), () => [
|
|
103
|
+
e.error || e.errors ? (i(), z(t(j), {
|
|
92
104
|
key: 0,
|
|
93
105
|
id: e.id,
|
|
94
106
|
name: e.name,
|
|
95
107
|
error: e.error,
|
|
96
108
|
errors: e.errors
|
|
97
109
|
}, {
|
|
98
|
-
default:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
r[2] || (r[2] =
|
|
110
|
+
default: h(({ error: a }) => [
|
|
111
|
+
s("div", L, [
|
|
112
|
+
R(f(a), 1),
|
|
113
|
+
r[2] || (r[2] = s("br", null, null, -1))
|
|
102
114
|
])
|
|
103
115
|
]),
|
|
104
116
|
_: 1
|
|
105
|
-
}, 8, ["id", "name", "error", "errors"])) :
|
|
117
|
+
}, 8, ["id", "name", "error", "errors"])) : c("", !0)
|
|
106
118
|
]),
|
|
107
|
-
l(o.$slots, "feedback",
|
|
108
|
-
|
|
109
|
-
default:
|
|
110
|
-
|
|
119
|
+
l(o.$slots, "feedback", v(y({ feedback: e.feedback })), () => [
|
|
120
|
+
T(t(q), { feedback: e.feedback }, {
|
|
121
|
+
default: h(({ feedback: a }) => [
|
|
122
|
+
s("div", O, f(a), 1)
|
|
111
123
|
]),
|
|
112
124
|
_: 1
|
|
113
125
|
}, 8, ["feedback"])
|
|
114
126
|
]),
|
|
115
|
-
l(o.$slots, "help",
|
|
116
|
-
e.helpText ? (
|
|
127
|
+
l(o.$slots, "help", v(y({ helpText: e.helpText })), () => [
|
|
128
|
+
e.helpText ? (i(), m("small", {
|
|
117
129
|
key: 0,
|
|
118
|
-
|
|
130
|
+
ref_key: "help",
|
|
131
|
+
ref: $,
|
|
119
132
|
class: "form-help"
|
|
120
|
-
},
|
|
133
|
+
}, f(e.helpText), 513)) : c("", !0)
|
|
121
134
|
])
|
|
122
135
|
], 2));
|
|
123
136
|
}
|
|
124
137
|
});
|
|
125
138
|
export {
|
|
126
|
-
|
|
139
|
+
Y as InputField
|
|
127
140
|
};
|
|
128
141
|
//# sourceMappingURL=input-field.js.map
|
package/dist/input-field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-field.js","sources":["../src/InputField.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"ModelValue, Value\">\nimport { ActivityIndicator } from '@vue-interface/activity-indicator';\nimport type { FormControlEvents, FormControlProps, FormControlSlots } from '@vue-interface/form-control';\nimport { FormControlErrors, FormControlFeedback, useFormControl } from '@vue-interface/form-control';\nimport { InputHTMLAttributes, useTemplateRef } from 'vue';\n\nconst props = withDefaults(defineProps<InputFieldProps<ModelValue,Value>>(), {\n formControlClass: 'form-control',\n labelClass: 'form-label',\n size: 'form-control-md'\n});\n\ndefineOptions({\n inheritAttrs: false\n});\n\nconst model = defineModel<ModelValue>();\n\ndefineSlots<FormControlSlots<InputFieldControlSizePrefix,ModelValue>>();\n\nconst emit = defineEmits<FormControlEvents>();\n\nconst {\n controlAttributes,\n formGroupClasses,\n listeners\n} = useFormControl<InputHTMLAttributes, InputFieldControlSizePrefix, ModelValue|undefined, Value>({ model, props, emit });\n\nconst field = useTemplateRef<HTMLInputElement>('field');\n</script>\n\n<script lang=\"ts\">\nexport type InputFieldControlSizePrefix = 'form-control';\n\nexport type InputFieldProps<ModelValue, Value> = FormControlProps<\n InputHTMLAttributes, \n InputFieldControlSizePrefix, \n ModelValue, \n Value\n>;\n</script>\n\n<template>\n <div\n class=\"input-field\"\n :class=\"formGroupClasses\">\n <slot name=\"label\">\n <label\n v-if=\"label\"\n ref=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ label }}\n </label>\n </slot>\n \n <div class=\"form-control-inner\">\n <slot\n name=\"control\"\n v-bind=\"{ controlAttributes, listeners }\">\n <div\n v-if=\"$slots.icon\"\n class=\"form-control-inner-icon\"\n @click=\"field?.focus()\">\n <slot name=\"icon\" />\n </div>\n <input\n ref=\"field\"\n v-model=\"model\"\n v-bind=\"{...controlAttributes, ...listeners}\">\n </slot>\n \n <div class=\"form-control-activity-indicator\">\n <slot name=\"activity\">\n <Transition name=\"input-field-fade\">\n <ActivityIndicator\n v-if=\"activity && indicator\"\n key=\"activity\"\n ref=\"activity\"\n :type=\"indicator\"\n :size=\"indicatorSize\" />\n </Transition>\n </slot>\n </div>\n </div>\n\n <slot\n name=\"errors\"\n v-bind=\"{ error, errors, id: $attrs.id, name: $attrs.name }\"> \n <FormControlErrors\n v-if=\"!!(error || errors)\"\n :id=\"id\"\n v-slot=\"{ error }\"\n :name=\"name\"\n :error=\"error\"\n :errors=\"errors\">\n <div\n invalid\n class=\"invalid-feedback\">\n {{ error }}<br>\n </div>\n </FormControlErrors>\n </slot>\n \n <slot\n name=\"feedback\"\n v-bind=\"{ feedback }\">\n <FormControlFeedback\n v-slot=\"{ feedback }\"\n :feedback=\"feedback\">\n <div\n valid\n class=\"valid-feedback\">\n {{ feedback }}\n </div>\n </FormControlFeedback>\n </slot>\n\n <slot\n name=\"help\"\n v-bind=\"{ helpText }\">\n <small\n v-if=\"helpText\"\n ref=\"help\"\n class=\"form-help\">\n {{ helpText }}\n </small>\n </slot>\n </div>\n</template>"],"names":["props","__props","model","_useModel","emit","__emit","controlAttributes","formGroupClasses","listeners","useFormControl","
|
|
1
|
+
{"version":3,"file":"input-field.js","sources":["../src/InputField.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"ModelValue, Value\">\nimport { ActivityIndicator } from '@vue-interface/activity-indicator';\nimport type { FormControlEvents, FormControlProps, FormControlSlots } from '@vue-interface/form-control';\nimport { FormControlErrors, FormControlFeedback, useFormControl } from '@vue-interface/form-control';\nimport { InputHTMLAttributes, useTemplateRef } from 'vue';\n\nconst props = withDefaults(defineProps<InputFieldProps<ModelValue,Value>>(), {\n formControlClass: 'form-control',\n labelClass: 'form-label',\n size: 'form-control-md'\n});\n\ndefineOptions({\n inheritAttrs: false\n});\n\nconst model = defineModel<ModelValue>();\n\ndefineSlots<FormControlSlots<InputFieldControlSizePrefix,ModelValue>>();\n\nconst emit = defineEmits<FormControlEvents>();\n\nconst {\n controlAttributes,\n formGroupClasses,\n listeners\n} = useFormControl<InputHTMLAttributes, InputFieldControlSizePrefix, ModelValue|undefined, Value>({ model, props, emit });\n\nconst activity = useTemplateRef<InstanceType<typeof ActivityIndicator>>('activity');\nconst help = useTemplateRef<HTMLElement>('help');\nconst label = useTemplateRef<HTMLLabelElement>('label');\nconst field = useTemplateRef<HTMLInputElement>('field');\nconst wrapper = useTemplateRef<HTMLDivElement>('wrapper');\n\ndefineExpose({\n activity,\n help,\n field,\n label,\n wrapper,\n focus: () => field.value?.focus(),\n blur: () => field.value?.blur(),\n})\n</script>\n\n<script lang=\"ts\">\nexport type InputFieldControlSizePrefix = 'form-control';\n\nexport type InputFieldProps<ModelValue, Value> = FormControlProps<\n InputHTMLAttributes, \n InputFieldControlSizePrefix, \n ModelValue, \n Value\n>;\n</script>\n\n<template>\n <div\n ref=\"wrapper\"\n class=\"input-field\"\n :class=\"formGroupClasses\">\n <slot name=\"label\">\n <label\n v-if=\"label\"\n ref=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ label }}\n </label>\n </slot>\n \n <div class=\"form-control-inner\">\n <slot\n name=\"control\"\n v-bind=\"{ controlAttributes, listeners }\">\n <div\n v-if=\"$slots.icon\"\n class=\"form-control-inner-icon\"\n @click=\"field?.focus()\">\n <slot name=\"icon\" />\n </div>\n <input\n ref=\"field\"\n v-model=\"model\"\n v-bind=\"{...controlAttributes, ...listeners}\">\n </slot>\n \n <div class=\"form-control-activity-indicator\">\n <slot name=\"activity\">\n <Transition name=\"input-field-fade\">\n <ActivityIndicator\n v-if=\"activity && indicator\"\n key=\"activity\"\n ref=\"activity\"\n :type=\"indicator\"\n :size=\"indicatorSize\" />\n </Transition>\n </slot>\n </div>\n </div>\n\n <slot\n name=\"errors\"\n v-bind=\"{ error, errors, id: $attrs.id, name: $attrs.name }\"> \n <FormControlErrors\n v-if=\"!!(error || errors)\"\n :id=\"id\"\n v-slot=\"{ error }\"\n :name=\"name\"\n :error=\"error\"\n :errors=\"errors\">\n <div\n invalid\n class=\"invalid-feedback\">\n {{ error }}<br>\n </div>\n </FormControlErrors>\n </slot>\n \n <slot\n name=\"feedback\"\n v-bind=\"{ feedback }\">\n <FormControlFeedback\n v-slot=\"{ feedback }\"\n :feedback=\"feedback\">\n <div\n valid\n class=\"valid-feedback\">\n {{ feedback }}\n </div>\n </FormControlFeedback>\n </slot>\n\n <slot\n name=\"help\"\n v-bind=\"{ helpText }\">\n <small\n v-if=\"helpText\"\n ref=\"help\"\n class=\"form-help\">\n {{ helpText }}\n </small>\n </slot>\n </div>\n</template>"],"names":["props","__props","model","_useModel","emit","__emit","controlAttributes","formGroupClasses","listeners","useFormControl","activity","useTemplateRef","help","label","field","wrapper","__expose","_createElementBlock","_normalizeClass","_unref","_renderSlot","_ctx","_hoisted_1","_createElementVNode","_hoisted_2","_normalizeProps","_guardReactiveProps","$slots","_cache","$event","_withDirectives","_mergeProps","_hoisted_3","_createVNode","_Transition","_createBlock","ActivityIndicator","$attrs","FormControlErrors","_withCtx","error","_hoisted_4","FormControlFeedback","feedback","_hoisted_5","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,UAAMA,IAAQC,GAURC,IAAQC,EAAuBF,GAAA,YAAC,GAIhCG,IAAOC,GAEP;AAAA,MACF,mBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,WAAAC;AAAA,IAAA,IACAC,EAA8F,EAAE,OAAAP,GAAO,OAAAF,GAAO,MAAAI,GAAM,GAElHM,IAAWC,EAAuD,UAAU,GAC5EC,IAAOD,EAA4B,MAAM,GACzCE,IAAQF,EAAiC,OAAO,GAChDG,IAAQH,EAAiC,OAAO,GAChDI,IAAUJ,EAA+B,SAAS;AAExD,WAAAK,EAAa;AAAA,MACT,UAAAN;AAAA,MACA,MAAAE;AAAA,MACA,OAAAE;AAAA,MACA,OAAAD;AAAA,MACA,SAAA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,2 +1,2 @@
|
|
|
1
|
-
(function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@vue-interface/activity-indicator"),require("@vue-interface/form-control")):typeof define=="function"&&define.amd?define(["exports","vue","@vue-interface/activity-indicator","@vue-interface/form-control"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.InputField={},r.Vue,r.VueInterfaceActivityIndicator,r.VueInterfaceFormControl))})(this,(function(r,e,
|
|
1
|
+
(function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@vue-interface/activity-indicator"),require("@vue-interface/form-control")):typeof define=="function"&&define.amd?define(["exports","vue","@vue-interface/activity-indicator","@vue-interface/form-control"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.InputField={},r.Vue,r.VueInterfaceActivityIndicator,r.VueInterfaceFormControl))})(this,(function(r,e,u,s){"use strict";const k=["for"],b={class:"form-control-inner"},h={class:"form-control-activity-indicator"},V={invalid:"",class:"invalid-feedback"},C={valid:"",class:"valid-feedback"},B=e.defineComponent({inheritAttrs:!1,__name:"InputField",props:e.mergeModels({activity:{type:Boolean},disabled:{type:Boolean},error:{},errors:{},feedback:{},formControlClass:{default:"form-control"},helpText:{},id:{},indicator:{},indicatorSize:{},invalid:{type:Boolean},label:{},labelClass:{default:"form-label"},modelValue:{},name:{},plaintext:{type:Boolean},size:{default:"form-control-md"},color:{},readonly:{type:Boolean},valid:{type:Boolean},value:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["blur","focus","focusin","focusout","click","doubleclick","contextmenu","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","keydown","keyup","keypress","select","selectionchange","invalid","submit","reset","scroll","wheel","copy","cut","paste","touchstart","touchend","touchmove","touchcancel","change","input","beforeinput"],["update:modelValue"]),setup(t,{expose:S,emit:T}){const N=t,c=e.useModel(t,"modelValue"),g=T,{controlAttributes:d,formGroupClasses:z,listeners:m}=s.useFormControl({model:c,props:N,emit:g}),f=e.useTemplateRef("activity"),p=e.useTemplateRef("help"),a=e.useTemplateRef("label"),i=e.useTemplateRef("field"),y=e.useTemplateRef("wrapper");return S({activity:f,help:p,field:i,label:a,wrapper:y,focus:()=>i.value?.focus(),blur:()=>i.value?.blur()}),(o,l)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapper",ref:y,class:e.normalizeClass(["input-field",e.unref(z)])},[e.renderSlot(o.$slots,"label",{},()=>[a.value?(e.openBlock(),e.createElementBlock("label",{key:0,ref_key:"label",ref:a,class:e.normalizeClass(t.labelClass),for:e.unref(d).id},e.toDisplayString(a.value),11,k)):e.createCommentVNode("",!0)]),e.createElementVNode("div",b,[e.renderSlot(o.$slots,"control",e.normalizeProps(e.guardReactiveProps({controlAttributes:e.unref(d),listeners:e.unref(m)})),()=>[o.$slots.icon?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-control-inner-icon",onClick:l[0]||(l[0]=n=>i.value?.focus())},[e.renderSlot(o.$slots,"icon")])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({ref_key:"field",ref:i,"onUpdate:modelValue":l[1]||(l[1]=n=>c.value=n)},{...e.unref(d),...e.unref(m)}),null,16),[[e.vModelDynamic,c.value]])]),e.createElementVNode("div",h,[e.renderSlot(o.$slots,"activity",{},()=>[e.createVNode(e.Transition,{name:"input-field-fade"},{default:e.withCtx(()=>[f.value&&t.indicator?(e.openBlock(),e.createBlock(e.unref(u.ActivityIndicator),{key:"activity",ref_key:"activity",ref:f,type:t.indicator,size:t.indicatorSize},null,8,["type","size"])):e.createCommentVNode("",!0)]),_:1})])])]),e.renderSlot(o.$slots,"errors",e.normalizeProps(e.guardReactiveProps({error:t.error,errors:t.errors,id:o.$attrs.id,name:o.$attrs.name})),()=>[t.error||t.errors?(e.openBlock(),e.createBlock(e.unref(s.FormControlErrors),{key:0,id:t.id,name:t.name,error:t.error,errors:t.errors},{default:e.withCtx(({error:n})=>[e.createElementVNode("div",V,[e.createTextVNode(e.toDisplayString(n),1),l[2]||(l[2]=e.createElementVNode("br",null,null,-1))])]),_:1},8,["id","name","error","errors"])):e.createCommentVNode("",!0)]),e.renderSlot(o.$slots,"feedback",e.normalizeProps(e.guardReactiveProps({feedback:t.feedback})),()=>[e.createVNode(e.unref(s.FormControlFeedback),{feedback:t.feedback},{default:e.withCtx(({feedback:n})=>[e.createElementVNode("div",C,e.toDisplayString(n),1)]),_:1},8,["feedback"])]),e.renderSlot(o.$slots,"help",e.normalizeProps(e.guardReactiveProps({helpText:t.helpText})),()=>[t.helpText?(e.openBlock(),e.createElementBlock("small",{key:0,ref_key:"help",ref:p,class:"form-help"},e.toDisplayString(t.helpText),513)):e.createCommentVNode("",!0)])],2))}});r.InputField=B,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));
|
|
2
2
|
//# sourceMappingURL=input-field.umd.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-field.umd.cjs","sources":["../src/InputField.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"ModelValue, Value\">\nimport { ActivityIndicator } from '@vue-interface/activity-indicator';\nimport type { FormControlEvents, FormControlProps, FormControlSlots } from '@vue-interface/form-control';\nimport { FormControlErrors, FormControlFeedback, useFormControl } from '@vue-interface/form-control';\nimport { InputHTMLAttributes, useTemplateRef } from 'vue';\n\nconst props = withDefaults(defineProps<InputFieldProps<ModelValue,Value>>(), {\n formControlClass: 'form-control',\n labelClass: 'form-label',\n size: 'form-control-md'\n});\n\ndefineOptions({\n inheritAttrs: false\n});\n\nconst model = defineModel<ModelValue>();\n\ndefineSlots<FormControlSlots<InputFieldControlSizePrefix,ModelValue>>();\n\nconst emit = defineEmits<FormControlEvents>();\n\nconst {\n controlAttributes,\n formGroupClasses,\n listeners\n} = useFormControl<InputHTMLAttributes, InputFieldControlSizePrefix, ModelValue|undefined, Value>({ model, props, emit });\n\nconst field = useTemplateRef<HTMLInputElement>('field');\n</script>\n\n<script lang=\"ts\">\nexport type InputFieldControlSizePrefix = 'form-control';\n\nexport type InputFieldProps<ModelValue, Value> = FormControlProps<\n InputHTMLAttributes, \n InputFieldControlSizePrefix, \n ModelValue, \n Value\n>;\n</script>\n\n<template>\n <div\n class=\"input-field\"\n :class=\"formGroupClasses\">\n <slot name=\"label\">\n <label\n v-if=\"label\"\n ref=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ label }}\n </label>\n </slot>\n \n <div class=\"form-control-inner\">\n <slot\n name=\"control\"\n v-bind=\"{ controlAttributes, listeners }\">\n <div\n v-if=\"$slots.icon\"\n class=\"form-control-inner-icon\"\n @click=\"field?.focus()\">\n <slot name=\"icon\" />\n </div>\n <input\n ref=\"field\"\n v-model=\"model\"\n v-bind=\"{...controlAttributes, ...listeners}\">\n </slot>\n \n <div class=\"form-control-activity-indicator\">\n <slot name=\"activity\">\n <Transition name=\"input-field-fade\">\n <ActivityIndicator\n v-if=\"activity && indicator\"\n key=\"activity\"\n ref=\"activity\"\n :type=\"indicator\"\n :size=\"indicatorSize\" />\n </Transition>\n </slot>\n </div>\n </div>\n\n <slot\n name=\"errors\"\n v-bind=\"{ error, errors, id: $attrs.id, name: $attrs.name }\"> \n <FormControlErrors\n v-if=\"!!(error || errors)\"\n :id=\"id\"\n v-slot=\"{ error }\"\n :name=\"name\"\n :error=\"error\"\n :errors=\"errors\">\n <div\n invalid\n class=\"invalid-feedback\">\n {{ error }}<br>\n </div>\n </FormControlErrors>\n </slot>\n \n <slot\n name=\"feedback\"\n v-bind=\"{ feedback }\">\n <FormControlFeedback\n v-slot=\"{ feedback }\"\n :feedback=\"feedback\">\n <div\n valid\n class=\"valid-feedback\">\n {{ feedback }}\n </div>\n </FormControlFeedback>\n </slot>\n\n <slot\n name=\"help\"\n v-bind=\"{ helpText }\">\n <small\n v-if=\"helpText\"\n ref=\"help\"\n class=\"form-help\">\n {{ helpText }}\n </small>\n </slot>\n </div>\n</template>"],"names":["props","__props","model","_useModel","emit","__emit","controlAttributes","formGroupClasses","listeners","useFormControl","
|
|
1
|
+
{"version":3,"file":"input-field.umd.cjs","sources":["../src/InputField.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"ModelValue, Value\">\nimport { ActivityIndicator } from '@vue-interface/activity-indicator';\nimport type { FormControlEvents, FormControlProps, FormControlSlots } from '@vue-interface/form-control';\nimport { FormControlErrors, FormControlFeedback, useFormControl } from '@vue-interface/form-control';\nimport { InputHTMLAttributes, useTemplateRef } from 'vue';\n\nconst props = withDefaults(defineProps<InputFieldProps<ModelValue,Value>>(), {\n formControlClass: 'form-control',\n labelClass: 'form-label',\n size: 'form-control-md'\n});\n\ndefineOptions({\n inheritAttrs: false\n});\n\nconst model = defineModel<ModelValue>();\n\ndefineSlots<FormControlSlots<InputFieldControlSizePrefix,ModelValue>>();\n\nconst emit = defineEmits<FormControlEvents>();\n\nconst {\n controlAttributes,\n formGroupClasses,\n listeners\n} = useFormControl<InputHTMLAttributes, InputFieldControlSizePrefix, ModelValue|undefined, Value>({ model, props, emit });\n\nconst activity = useTemplateRef<InstanceType<typeof ActivityIndicator>>('activity');\nconst help = useTemplateRef<HTMLElement>('help');\nconst label = useTemplateRef<HTMLLabelElement>('label');\nconst field = useTemplateRef<HTMLInputElement>('field');\nconst wrapper = useTemplateRef<HTMLDivElement>('wrapper');\n\ndefineExpose({\n activity,\n help,\n field,\n label,\n wrapper,\n focus: () => field.value?.focus(),\n blur: () => field.value?.blur(),\n})\n</script>\n\n<script lang=\"ts\">\nexport type InputFieldControlSizePrefix = 'form-control';\n\nexport type InputFieldProps<ModelValue, Value> = FormControlProps<\n InputHTMLAttributes, \n InputFieldControlSizePrefix, \n ModelValue, \n Value\n>;\n</script>\n\n<template>\n <div\n ref=\"wrapper\"\n class=\"input-field\"\n :class=\"formGroupClasses\">\n <slot name=\"label\">\n <label\n v-if=\"label\"\n ref=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ label }}\n </label>\n </slot>\n \n <div class=\"form-control-inner\">\n <slot\n name=\"control\"\n v-bind=\"{ controlAttributes, listeners }\">\n <div\n v-if=\"$slots.icon\"\n class=\"form-control-inner-icon\"\n @click=\"field?.focus()\">\n <slot name=\"icon\" />\n </div>\n <input\n ref=\"field\"\n v-model=\"model\"\n v-bind=\"{...controlAttributes, ...listeners}\">\n </slot>\n \n <div class=\"form-control-activity-indicator\">\n <slot name=\"activity\">\n <Transition name=\"input-field-fade\">\n <ActivityIndicator\n v-if=\"activity && indicator\"\n key=\"activity\"\n ref=\"activity\"\n :type=\"indicator\"\n :size=\"indicatorSize\" />\n </Transition>\n </slot>\n </div>\n </div>\n\n <slot\n name=\"errors\"\n v-bind=\"{ error, errors, id: $attrs.id, name: $attrs.name }\"> \n <FormControlErrors\n v-if=\"!!(error || errors)\"\n :id=\"id\"\n v-slot=\"{ error }\"\n :name=\"name\"\n :error=\"error\"\n :errors=\"errors\">\n <div\n invalid\n class=\"invalid-feedback\">\n {{ error }}<br>\n </div>\n </FormControlErrors>\n </slot>\n \n <slot\n name=\"feedback\"\n v-bind=\"{ feedback }\">\n <FormControlFeedback\n v-slot=\"{ feedback }\"\n :feedback=\"feedback\">\n <div\n valid\n class=\"valid-feedback\">\n {{ feedback }}\n </div>\n </FormControlFeedback>\n </slot>\n\n <slot\n name=\"help\"\n v-bind=\"{ helpText }\">\n <small\n v-if=\"helpText\"\n ref=\"help\"\n class=\"form-help\">\n {{ helpText }}\n </small>\n </slot>\n </div>\n</template>"],"names":["props","__props","model","_useModel","emit","__emit","controlAttributes","formGroupClasses","listeners","useFormControl","activity","useTemplateRef","help","label","field","wrapper","__expose","_createElementBlock","_normalizeClass","_unref","_renderSlot","_ctx","_hoisted_1","_createElementVNode","_hoisted_2","_normalizeProps","_guardReactiveProps","$slots","_cache","$event","_withDirectives","_mergeProps","_hoisted_3","_createVNode","_Transition","_createBlock","ActivityIndicator","$attrs","FormControlErrors","_withCtx","error","_hoisted_4","FormControlFeedback","feedback","_hoisted_5","_toDisplayString"],"mappings":"ohDAMA,MA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AQ,CACnB,QAAAsC,EAAAA,QAAA,CAIM,CANI,SAAAI,KAAQ,CAElBpB,EAAAA,mBAIM,MAJNqB,EAIMC,EAAAA,gBADCF,CAAQ,EAAA,CAAA,CAAA,0BAKvBvB,EAAAA,WASOC,EAAA,OAAA,OAAAI,EAAAA,eAAAC,EAAAA,mBAAA,CAAA,SAPOzB,EAAA,QAAA,CAAQ,CAAA,EAFtB,IASO,CALOA,EAAA,wBADVgB,EAAAA,mBAKQ,QAAA,eAHA,OAAJ,IAAIL,EACJ,MAAM,WAAA,oBACHX,EAAA,QAAQ,EAAA,GAAA"}
|
|
@@ -63,8 +63,23 @@ declare const _default: <ModelValue, Value>(__VLS_props: NonNullable<Awaited<typ
|
|
|
63
63
|
readonly?: boolean;
|
|
64
64
|
valid?: boolean;
|
|
65
65
|
value?: Value | undefined;
|
|
66
|
-
} & InputHTMLAttributes) & Partial<{}>> & import('vue').PublicProps;
|
|
67
|
-
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
66
|
+
} & Omit<InputHTMLAttributes, "size">) & Partial<{}>> & import('vue').PublicProps;
|
|
67
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
68
|
+
activity: Readonly<import('vue').ShallowRef<import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('@vue-interface/activity-indicator').ActivityIndicatorProps> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
69
|
+
P: {};
|
|
70
|
+
B: {};
|
|
71
|
+
D: {};
|
|
72
|
+
C: {};
|
|
73
|
+
M: {};
|
|
74
|
+
Defaults: {};
|
|
75
|
+
}, Readonly<import('@vue-interface/activity-indicator').ActivityIndicatorProps> & Readonly<{}>, {}, {}, {}, {}, {}> | null>>;
|
|
76
|
+
help: Readonly<import('vue').ShallowRef<HTMLElement | null>>;
|
|
77
|
+
field: Readonly<import('vue').ShallowRef<HTMLInputElement | null>>;
|
|
78
|
+
label: Readonly<import('vue').ShallowRef<HTMLLabelElement | null>>;
|
|
79
|
+
wrapper: Readonly<import('vue').ShallowRef<HTMLDivElement | null>>;
|
|
80
|
+
focus: () => void | undefined;
|
|
81
|
+
blur: () => void | undefined;
|
|
82
|
+
}>): void;
|
|
68
83
|
attrs: any;
|
|
69
84
|
slots: Readonly<FormControlSlots<"form-control", ModelValue>> & FormControlSlots<"form-control", ModelValue>;
|
|
70
85
|
emit: (((evt: "input", event: Event) => void) & ((evt: "select", event: Event) => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "focusin", event: FocusEvent) => void) & ((evt: "focusout", event: FocusEvent) => void) & ((evt: "click", event: MouseEvent) => void) & ((evt: "doubleclick", event: MouseEvent) => void) & ((evt: "contextmenu", event: MouseEvent) => void) & ((evt: "mousedown", event: MouseEvent) => void) & ((evt: "mouseup", event: MouseEvent) => void) & ((evt: "mouseover", event: MouseEvent) => void) & ((evt: "mouseout", event: MouseEvent) => void) & ((evt: "mouseenter", event: MouseEvent) => void) & ((evt: "mouseleave", event: MouseEvent) => void) & ((evt: "mousemove", event: MouseEvent) => void) & ((evt: "keydown", event: KeyboardEvent) => void) & ((evt: "keyup", event: KeyboardEvent) => void) & ((evt: "keypress", event: KeyboardEvent) => void) & ((evt: "selectionchange", event: Event) => void) & ((evt: "invalid", event: Event) => void) & ((evt: "submit", event: Event) => void) & ((evt: "reset", event: Event) => void) & ((evt: "scroll", event: Event) => void) & ((evt: "wheel", event: WheelEvent) => void) & ((evt: "copy", event: ClipboardEvent) => void) & ((evt: "cut", event: ClipboardEvent) => void) & ((evt: "paste", event: ClipboardEvent) => void) & ((evt: "touchstart", event: TouchEvent) => void) & ((evt: "touchend", event: TouchEvent) => void) & ((evt: "touchmove", event: TouchEvent) => void) & ((evt: "touchcancel", event: TouchEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "beforeinput", event: Event) => void)) & ((evt: "update:modelValue", value: ModelValue) => void);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-interface/input-field",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"description": "A Vue input field component.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/input-field.umd.cjs",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"vue": "^3.3.4",
|
|
48
48
|
"@vue-interface/activity-indicator": "3.0.6",
|
|
49
|
-
"@vue-interface/form-control": "2.0.
|
|
49
|
+
"@vue-interface/form-control": "2.0.16"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"dev": "vite",
|
package/src/InputField.vue
CHANGED
|
@@ -26,7 +26,21 @@ const {
|
|
|
26
26
|
listeners
|
|
27
27
|
} = useFormControl<InputHTMLAttributes, InputFieldControlSizePrefix, ModelValue|undefined, Value>({ model, props, emit });
|
|
28
28
|
|
|
29
|
+
const activity = useTemplateRef<InstanceType<typeof ActivityIndicator>>('activity');
|
|
30
|
+
const help = useTemplateRef<HTMLElement>('help');
|
|
31
|
+
const label = useTemplateRef<HTMLLabelElement>('label');
|
|
29
32
|
const field = useTemplateRef<HTMLInputElement>('field');
|
|
33
|
+
const wrapper = useTemplateRef<HTMLDivElement>('wrapper');
|
|
34
|
+
|
|
35
|
+
defineExpose({
|
|
36
|
+
activity,
|
|
37
|
+
help,
|
|
38
|
+
field,
|
|
39
|
+
label,
|
|
40
|
+
wrapper,
|
|
41
|
+
focus: () => field.value?.focus(),
|
|
42
|
+
blur: () => field.value?.blur(),
|
|
43
|
+
})
|
|
30
44
|
</script>
|
|
31
45
|
|
|
32
46
|
<script lang="ts">
|
|
@@ -42,6 +56,7 @@ export type InputFieldProps<ModelValue, Value> = FormControlProps<
|
|
|
42
56
|
|
|
43
57
|
<template>
|
|
44
58
|
<div
|
|
59
|
+
ref="wrapper"
|
|
45
60
|
class="input-field"
|
|
46
61
|
:class="formGroupClasses">
|
|
47
62
|
<slot name="label">
|