@vue-interface/input-field 3.0.0 → 3.0.2

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/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  import { default as InputField } from './src/InputField.vue';
2
+ export * from './src/InputField.vue';
2
3
  export { InputField };
@@ -1,7 +1,7 @@
1
- import { openBlock as l, createElementBlock as c, createElementVNode as i, defineComponent as P, useModel as R, computed as x, useTemplateRef as u, normalizeClass as D, unref as t, renderSlot as a, toDisplayString as b, createCommentVNode as f, normalizeProps as m, guardReactiveProps as v, withDirectives as j, mergeProps as G, vModelDynamic as U, withModifiers as q, createVNode as I, createBlock as C, Transition as H, withCtx as w, createTextVNode as J, mergeModels as A } from "vue";
2
- import { ActivityIndicator as K } from "@vue-interface/activity-indicator";
3
- import { useFormControl as L, FormControlErrors as O, FormControlFeedback as Q } from "@vue-interface/form-control";
4
- function W(e, B) {
1
+ import { openBlock as l, createElementBlock as c, createElementVNode as i, defineComponent as P, ref as R, useModel as j, computed as F, useTemplateRef as f, normalizeClass as x, unref as o, renderSlot as a, toDisplayString as b, createCommentVNode as m, normalizeProps as v, guardReactiveProps as y, withDirectives as G, mergeProps as U, vModelDynamic as q, withModifiers as H, createVNode as I, createBlock as C, Transition as J, withCtx as w, createTextVNode as K, mergeModels as A } from "vue";
2
+ import { ActivityIndicator as L } from "@vue-interface/activity-indicator";
3
+ import { useFormControl as O, FormControlErrors as Q, FormControlFeedback as W } from "@vue-interface/form-control";
4
+ function X(e, B) {
5
5
  return l(), c("svg", {
6
6
  xmlns: "http://www.w3.org/2000/svg",
7
7
  fill: "none",
@@ -18,13 +18,13 @@ function W(e, B) {
18
18
  })
19
19
  ]);
20
20
  }
21
- const X = ["for"], Y = { class: "form-control-inner" }, Z = { class: "form-control-activity-indicator" }, _ = {
21
+ const Y = ["for"], Z = { class: "form-control-inner" }, _ = { class: "form-control-activity-indicator" }, ee = {
22
22
  invalid: "",
23
23
  class: "invalid-feedback"
24
- }, ee = {
24
+ }, te = {
25
25
  valid: "",
26
26
  class: "valid-feedback"
27
- }, re = /* @__PURE__ */ P({
27
+ }, ae = /* @__PURE__ */ P({
28
28
  inheritAttrs: !1,
29
29
  __name: "InputField",
30
30
  props: /* @__PURE__ */ A({
@@ -56,84 +56,83 @@ const X = ["for"], Y = { class: "form-control-inner" }, Z = { class: "form-contr
56
56
  }),
57
57
  emits: /* @__PURE__ */ A(["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"]),
58
58
  setup(e, { expose: B, emit: N }) {
59
- const r = e, y = R(e, "modelValue"), S = N, {
59
+ const r = e, S = R(), d = j(e, "modelValue"), D = N, {
60
60
  controlAttributes: k,
61
61
  formGroupClasses: E,
62
- isDirty: $,
63
- listeners: g
64
- } = L({ model: y, props: r, emit: S }), p = x(() => !r.disabled && !r.readonly), h = x(() => r.clearable && $.value && p.value);
65
- function V() {
66
- p.value && (y.value = void 0);
62
+ listeners: $
63
+ } = O({ model: d, props: r, emit: D }), p = F(() => !r.disabled && !r.readonly), h = F(() => r.clearable && (!!S.value || !!d.value) && p.value);
64
+ function g() {
65
+ p.value && (d.value = void 0);
67
66
  }
68
- const z = u("activity"), T = u("help"), M = u("label"), d = u("field"), F = u("wrapper");
67
+ const V = f("activity"), z = f("help"), T = f("label"), u = f("field"), M = f("wrapper");
69
68
  return B({
70
- activity: z,
71
- help: T,
72
- field: d,
73
- label: M,
74
- wrapper: F,
75
- focus: () => d.value?.focus(),
76
- blur: () => d.value?.blur()
77
- }), (o, n) => (l(), c("div", {
69
+ activity: V,
70
+ help: z,
71
+ field: u,
72
+ label: T,
73
+ wrapper: M,
74
+ focus: () => u.value?.focus(),
75
+ blur: () => u.value?.blur()
76
+ }), (t, n) => (l(), c("div", {
78
77
  ref_key: "wrapper",
79
- ref: F,
80
- class: D(["input-field", [t(E), { "has-clear-button": h.value }]])
78
+ ref: M,
79
+ class: x(["input-field", [o(E), { "has-clear-button": h.value }]])
81
80
  }, [
82
- a(o.$slots, "label", {}, () => [
81
+ a(t.$slots, "label", {}, () => [
83
82
  r.label ? (l(), c("label", {
84
83
  key: 0,
85
84
  ref_key: "label",
86
- ref: M,
87
- class: D(e.labelClass),
88
- for: t(k).id
89
- }, b(r.label), 11, X)) : f("", !0)
85
+ ref: T,
86
+ class: x(e.labelClass),
87
+ for: o(k).id
88
+ }, b(r.label), 11, Y)) : m("", !0)
90
89
  ]),
91
- i("div", Y, [
92
- a(o.$slots, "control", m(v({ controlAttributes: t(k), listeners: t(g) })), () => [
93
- o.$slots.icon ? (l(), c("div", {
90
+ i("div", Z, [
91
+ a(t.$slots, "control", v(y({ controlAttributes: o(k), listeners: o($) })), () => [
92
+ t.$slots.icon ? (l(), c("div", {
94
93
  key: 0,
95
94
  class: "form-control-inner-icon",
96
- onClick: n[0] || (n[0] = (s) => d.value?.focus())
95
+ onClick: n[0] || (n[0] = (s) => u.value?.focus())
97
96
  }, [
98
- a(o.$slots, "icon")
99
- ])) : f("", !0),
100
- j(i("input", G({
97
+ a(t.$slots, "icon")
98
+ ])) : m("", !0),
99
+ G(i("input", U({
101
100
  ref_key: "field",
102
- ref: d,
103
- "onUpdate:modelValue": n[1] || (n[1] = (s) => y.value = s)
104
- }, { ...t(k), ...t(g) }), null, 16), [
105
- [U, y.value]
101
+ ref: u,
102
+ "onUpdate:modelValue": n[1] || (n[1] = (s) => d.value = s)
103
+ }, { ...o(k), ...o($) }), null, 16), [
104
+ [q, d.value]
106
105
  ])
107
106
  ]),
108
- i("div", Z, [
109
- a(o.$slots, "activity", m(v({ canClear: h.value, clear: V, isDirty: t($), isInteractive: p.value })), () => [
107
+ i("div", _, [
108
+ a(t.$slots, "activity", v(y({ canClear: h.value, clear: g, isInteractive: p.value })), () => [
110
109
  h.value ? (l(), c("button", {
111
110
  key: 0,
112
111
  type: "button",
113
112
  class: "input-field-close-button",
114
- onClick: q(V, ["stop"])
113
+ onClick: H(g, ["stop"])
115
114
  }, [
116
- I(t(W), { class: "size-[1.25em]" })
117
- ])) : (l(), C(H, {
115
+ I(o(X), { class: "size-[1.25em]" })
116
+ ])) : (l(), C(J, {
118
117
  key: 1,
119
118
  name: "input-field-fade"
120
119
  }, {
121
120
  default: w(() => [
122
- r.activity && e.indicator ? (l(), C(t(K), {
121
+ r.activity && e.indicator ? (l(), C(o(L), {
123
122
  key: "activity",
124
123
  ref_key: "activity",
125
- ref: z,
124
+ ref: V,
126
125
  type: e.indicator,
127
126
  size: e.indicatorSize
128
- }, null, 8, ["type", "size"])) : f("", !0)
127
+ }, null, 8, ["type", "size"])) : m("", !0)
129
128
  ]),
130
129
  _: 1
131
130
  }))
132
131
  ])
133
132
  ])
134
133
  ]),
135
- a(o.$slots, "errors", m(v({ error: e.error, errors: e.errors, id: o.$attrs.id, name: o.$attrs.name })), () => [
136
- e.error || e.errors ? (l(), C(t(O), {
134
+ a(t.$slots, "errors", v(y({ error: e.error, errors: e.errors, id: t.$attrs.id, name: t.$attrs.name })), () => [
135
+ e.error || e.errors ? (l(), C(o(Q), {
137
136
  key: 0,
138
137
  id: e.id,
139
138
  name: e.name,
@@ -141,34 +140,34 @@ const X = ["for"], Y = { class: "form-control-inner" }, Z = { class: "form-contr
141
140
  errors: e.errors
142
141
  }, {
143
142
  default: w(({ error: s }) => [
144
- i("div", _, [
145
- J(b(s), 1),
143
+ i("div", ee, [
144
+ K(b(s), 1),
146
145
  n[2] || (n[2] = i("br", null, null, -1))
147
146
  ])
148
147
  ]),
149
148
  _: 1
150
- }, 8, ["id", "name", "error", "errors"])) : f("", !0)
149
+ }, 8, ["id", "name", "error", "errors"])) : m("", !0)
151
150
  ]),
152
- a(o.$slots, "feedback", m(v({ feedback: e.feedback })), () => [
153
- I(t(Q), { feedback: e.feedback }, {
151
+ a(t.$slots, "feedback", v(y({ feedback: e.feedback })), () => [
152
+ I(o(W), { feedback: e.feedback }, {
154
153
  default: w(({ feedback: s }) => [
155
- i("div", ee, b(s), 1)
154
+ i("div", te, b(s), 1)
156
155
  ]),
157
156
  _: 1
158
157
  }, 8, ["feedback"])
159
158
  ]),
160
- a(o.$slots, "help", m(v({ helpText: e.helpText })), () => [
159
+ a(t.$slots, "help", v(y({ helpText: e.helpText })), () => [
161
160
  e.helpText ? (l(), c("small", {
162
161
  key: 0,
163
162
  ref_key: "help",
164
- ref: T,
163
+ ref: z,
165
164
  class: "form-help"
166
- }, b(e.helpText), 513)) : f("", !0)
165
+ }, b(e.helpText), 513)) : m("", !0)
167
166
  ])
168
167
  ], 2));
169
168
  }
170
169
  });
171
170
  export {
172
- re as InputField
171
+ ae as InputField
173
172
  };
174
173
  //# sourceMappingURL=input-field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-field.js","sources":["../../../node_modules/.pnpm/@heroicons+vue@2.2.0_vue@3.5.27_typescript@5.9.3_/node_modules/@heroicons/vue/24/outline/esm/XMarkIcon.js","../src/InputField.vue"],"sourcesContent":["import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nexport default function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": \"1.5\",\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\"\n }, [\n _createElementVNode(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M6 18 18 6M6 6l12 12\"\n })\n ]))\n}","<script setup lang=\"ts\" generic=\"ModelValue, Value\">\nimport { XMarkIcon } from '@heroicons/vue/24/outline';\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, computed, 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 clearable: false\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 isDirty,\n listeners\n} = useFormControl<InputHTMLAttributes, InputFieldControlSizePrefix, ModelValue|undefined, Value>({ model, props, emit });\n\nconst isInteractive = computed(() => !props.disabled && !props.readonly);\n\nconst canClear = computed(() => {\n return props.clearable && isDirty.value && isInteractive.value;\n});\n\nfunction clear() {\n if (!isInteractive.value) return;\n model.value = undefined;\n}\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 clearable?: boolean;\n}\n</script>\n\n<template>\n <div\n ref=\"wrapper\"\n class=\"input-field\"\n :class=\"[formGroupClasses, { 'has-clear-button': canClear }]\">\n <slot name=\"label\">\n <label\n v-if=\"props.label\"\n ref=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ props.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\" v-bind=\"{ canClear, clear, isDirty, isInteractive }\">\n <button\n v-if=\"canClear\"\n type=\"button\"\n class=\"input-field-close-button\"\n @click.stop=\"clear\">\n <XMarkIcon class=\"size-[1.25em]\" />\n </button>\n <Transition name=\"input-field-fade\" v-else>\n <ActivityIndicator\n v-if=\"props.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":["render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode","props","__props","model","_useModel","emit","__emit","controlAttributes","formGroupClasses","isDirty","listeners","useFormControl","isInteractive","computed","canClear","clear","activity","useTemplateRef","help","label","field","wrapper","__expose","_normalizeClass","_unref","_renderSlot","_toDisplayString","_hoisted_1","_hoisted_2","_normalizeProps","_guardReactiveProps","$slots","$event","_withDirectives","_mergeProps","_hoisted_3","_createVNode","XMarkIcon","_createBlock","_Transition","ActivityIndicator","$attrs","FormControlErrors","_withCtx","error","_hoisted_4","FormControlFeedback","feedback","_hoisted_5"],"mappings":";;;AAEe,SAASA,EAAOC,GAAMC,GAAQ;AAC3C,SAAQC,EAAU,GAAIC,EAAoB,OAAO;AAAA,IAC/C,OAAO;AAAA,IACP,MAAM;AAAA,IACN,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,aAAa;AAAA,EACjB,GAAK;AAAA,IACDC,EAAoB,QAAQ;AAAA,MAC1B,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,MACnB,GAAG;AAAA,IACT,CAAK;AAAA,EACL,CAAG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACXA,UAAMC,IAAQC,GAWRC,IAAQC,EAAuBF,GAAA,YAAC,GAIhCG,IAAOC,GAEP;AAAA,MACF,mBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,SAAAC;AAAA,MACA,WAAAC;AAAA,IAAA,IACAC,EAA8F,EAAE,OAAAR,GAAO,OAAAF,GAAO,MAAAI,GAAM,GAElHO,IAAgBC,EAAS,MAAM,CAACZ,EAAM,YAAY,CAACA,EAAM,QAAQ,GAEjEa,IAAWD,EAAS,MACfZ,EAAM,aAAaQ,EAAQ,SAASG,EAAc,KAC5D;AAED,aAASG,IAAQ;AACb,MAAKH,EAAc,UACnBT,EAAM,QAAQ;AAAA,IAClB;AAEA,UAAMa,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;AA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;AAAA,QATHkC,EAQsBZ,EAAAsB,CAAA,GAAA,EANjB,UAAU5C,EAAA,YAAQ;AAAA,UACnB,SAAAyC,EAAA,CAIM,EANI,UAAAI,QAAQ;AAAA,YAElB/C,EAIM,OAJNgD,IAIMtB,EADCqB,CAAQ,GAAA,CAAA;AAAA,UAAA;;;;MAKvBtB,EASO7B,EAAA,QAAA,QAAAiC,EAAAC,EAAA,EAAA,UAPO5B,EAAA,SAAA,CAAQ,CAAA,GAFtB,MASO;AAAA,QALOA,EAAA,iBADVH,EAKQ,SAAA;AAAA;mBAHA;AAAA,UAAJ,KAAImB;AAAA,UACJ,OAAM;AAAA,QAAA,KACHhB,EAAA,QAAQ,GAAA,GAAA;;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"input-field.js","sources":["../../../node_modules/.pnpm/@heroicons+vue@2.2.0_vue@3.5.27_typescript@5.9.3_/node_modules/@heroicons/vue/24/outline/esm/XMarkIcon.js","../src/InputField.vue"],"sourcesContent":["import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nexport default function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": \"1.5\",\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\"\n }, [\n _createElementVNode(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M6 18 18 6M6 6l12 12\"\n })\n ]))\n}","<script setup lang=\"ts\" generic=\"ModelValue, Value\">\nimport { XMarkIcon } from '@heroicons/vue/24/outline';\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, computed, useTemplateRef, ref } from 'vue';\n\nconst props = withDefaults(defineProps<InputFieldProps<ModelValue,Value>>(), {\n formControlClass: 'form-control',\n labelClass: 'form-label',\n size: 'form-control-md',\n clearable: false\n});\n\ndefineOptions({\n inheritAttrs: false\n});\n\nconst input = ref<string>();\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 isInteractive = computed(() => !props.disabled && !props.readonly);\n\nconst canClear = computed(() => {\n return props.clearable && (!!input.value || !!model.value) && isInteractive.value;\n});\n\nfunction clear() {\n if (!isInteractive.value) return;\n model.value = undefined;\n}\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 clearable?: boolean;\n}\n</script>\n\n<template>\n <div\n ref=\"wrapper\"\n class=\"input-field\"\n :class=\"[formGroupClasses, { 'has-clear-button': canClear }]\">\n <slot name=\"label\">\n <label\n v-if=\"props.label\"\n ref=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ props.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\" v-bind=\"{ canClear, clear, isInteractive }\">\n <button\n v-if=\"canClear\"\n type=\"button\"\n class=\"input-field-close-button\"\n @click.stop=\"clear\">\n <XMarkIcon class=\"size-[1.25em]\" />\n </button>\n <Transition name=\"input-field-fade\" v-else>\n <ActivityIndicator\n v-if=\"props.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":["render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode","props","__props","input","ref","model","_useModel","emit","__emit","controlAttributes","formGroupClasses","listeners","useFormControl","isInteractive","computed","canClear","clear","activity","useTemplateRef","help","label","field","wrapper","__expose","_normalizeClass","_unref","_renderSlot","_toDisplayString","_hoisted_1","_hoisted_2","_normalizeProps","_guardReactiveProps","$slots","$event","_withDirectives","_mergeProps","_hoisted_3","_createVNode","XMarkIcon","_createBlock","_Transition","ActivityIndicator","$attrs","FormControlErrors","_withCtx","error","_hoisted_4","FormControlFeedback","feedback","_hoisted_5"],"mappings":";;;AAEe,SAASA,EAAOC,GAAMC,GAAQ;AAC3C,SAAQC,EAAU,GAAIC,EAAoB,OAAO;AAAA,IAC/C,OAAO;AAAA,IACP,MAAM;AAAA,IACN,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,aAAa;AAAA,EACjB,GAAK;AAAA,IACDC,EAAoB,QAAQ;AAAA,MAC1B,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,MACnB,GAAG;AAAA,IACT,CAAK;AAAA,EACL,CAAG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACXA,UAAMC,IAAQC,GAWRC,IAAQC,EAAA,GACRC,IAAQC,EAAuBJ,GAAA,YAAC,GAIhCK,IAAOC,GAEP;AAAA,MACF,mBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,WAAAC;AAAA,IAAA,IACAC,EAA8F,EAAE,OAAAP,GAAO,OAAAJ,GAAO,MAAAM,GAAM,GAElHM,IAAgBC,EAAS,MAAM,CAACb,EAAM,YAAY,CAACA,EAAM,QAAQ,GAEjEc,IAAWD,EAAS,MACfb,EAAM,cAAc,CAAC,CAACE,EAAM,SAAS,CAAC,CAACE,EAAM,UAAUQ,EAAc,KAC/E;AAED,aAASG,IAAQ;AACb,MAAKH,EAAc,UACnBR,EAAM,QAAQ;AAAA,IAClB;AAEA,UAAMY,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,SAAAE;AAAA,MACA,OAAO,MAAM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IMtB,EADCqB,CAAQ,GAAA,CAAA;AAAA,UAAA;;;;MAKvBtB,EASO9B,EAAA,QAAA,QAAAkC,EAAAC,EAAA,EAAA,UAPO7B,EAAA,SAAA,CAAQ,CAAA,GAFtB,MASO;AAAA,QALOA,EAAA,iBADVH,EAKQ,SAAA;AAAA;mBAHA;AAAA,UAAJ,KAAIoB;AAAA,UACJ,OAAM;AAAA,QAAA,KACHjB,EAAA,QAAQ,GAAA,GAAA;;;;;","x_google_ignoreList":[0]}
@@ -1,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,V,s){"use strict";function w(t,p){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18 18 6M6 6l12 12"})])}const g=["for"],N={class:"form-control-inner"},S={class:"form-control-activity-indicator"},T={invalid:"",class:"invalid-feedback"},E={valid:"",class:"valid-feedback"},z=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:{},clearable:{type:Boolean,default:!1}},{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:p,emit:P}){const l=t,c=e.useModel(t,"modelValue"),$=P,{controlAttributes:d,formGroupClasses:R,isDirty:u,listeners:k}=s.useFormControl({model:c,props:l,emit:$}),f=e.computed(()=>!l.disabled&&!l.readonly),m=e.computed(()=>l.clearable&&u.value&&f.value);function y(){f.value&&(c.value=void 0)}const b=e.useTemplateRef("activity"),h=e.useTemplateRef("help"),B=e.useTemplateRef("label"),i=e.useTemplateRef("field"),C=e.useTemplateRef("wrapper");return p({activity:b,help:h,field:i,label:B,wrapper:C,focus:()=>i.value?.focus(),blur:()=>i.value?.blur()}),(o,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapper",ref:C,class:e.normalizeClass(["input-field",[e.unref(R),{"has-clear-button":m.value}]])},[e.renderSlot(o.$slots,"label",{},()=>[l.label?(e.openBlock(),e.createElementBlock("label",{key:0,ref_key:"label",ref:B,class:e.normalizeClass(t.labelClass),for:e.unref(d).id},e.toDisplayString(l.label),11,g)):e.createCommentVNode("",!0)]),e.createElementVNode("div",N,[e.renderSlot(o.$slots,"control",e.normalizeProps(e.guardReactiveProps({controlAttributes:e.unref(d),listeners:e.unref(k)})),()=>[o.$slots.icon?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-control-inner-icon",onClick:n[0]||(n[0]=a=>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":n[1]||(n[1]=a=>c.value=a)},{...e.unref(d),...e.unref(k)}),null,16),[[e.vModelDynamic,c.value]])]),e.createElementVNode("div",S,[e.renderSlot(o.$slots,"activity",e.normalizeProps(e.guardReactiveProps({canClear:m.value,clear:y,isDirty:e.unref(u),isInteractive:f.value})),()=>[m.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"input-field-close-button",onClick:e.withModifiers(y,["stop"])},[e.createVNode(e.unref(w),{class:"size-[1.25em]"})])):(e.openBlock(),e.createBlock(e.Transition,{key:1,name:"input-field-fade"},{default:e.withCtx(()=>[l.activity&&t.indicator?(e.openBlock(),e.createBlock(e.unref(V.ActivityIndicator),{key:"activity",ref_key:"activity",ref:b,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:a})=>[e.createElementVNode("div",T,[e.createTextVNode(e.toDisplayString(a),1),n[2]||(n[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:a})=>[e.createElementVNode("div",E,e.toDisplayString(a),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:h,class:"form-help"},e.toDisplayString(t.helpText),513)):e.createCommentVNode("",!0)])],2))}});r.InputField=z,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));
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,C,s){"use strict";function V(t,p){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18 18 6M6 6l12 12"})])}const w=["for"],g={class:"form-control-inner"},N={class:"form-control-activity-indicator"},S={invalid:"",class:"invalid-feedback"},T={valid:"",class:"valid-feedback"},E=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:{},clearable:{type:Boolean,default:!1}},{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:p,emit:z}){const l=t,P=e.ref(),i=e.useModel(t,"modelValue"),$=z,{controlAttributes:d,formGroupClasses:R,listeners:u}=s.useFormControl({model:i,props:l,emit:$}),f=e.computed(()=>!l.disabled&&!l.readonly),m=e.computed(()=>l.clearable&&(!!P.value||!!i.value)&&f.value);function k(){f.value&&(i.value=void 0)}const y=e.useTemplateRef("activity"),b=e.useTemplateRef("help"),h=e.useTemplateRef("label"),c=e.useTemplateRef("field"),B=e.useTemplateRef("wrapper");return p({activity:y,help:b,field:c,label:h,wrapper:B,focus:()=>c.value?.focus(),blur:()=>c.value?.blur()}),(o,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapper",ref:B,class:e.normalizeClass(["input-field",[e.unref(R),{"has-clear-button":m.value}]])},[e.renderSlot(o.$slots,"label",{},()=>[l.label?(e.openBlock(),e.createElementBlock("label",{key:0,ref_key:"label",ref:h,class:e.normalizeClass(t.labelClass),for:e.unref(d).id},e.toDisplayString(l.label),11,w)):e.createCommentVNode("",!0)]),e.createElementVNode("div",g,[e.renderSlot(o.$slots,"control",e.normalizeProps(e.guardReactiveProps({controlAttributes:e.unref(d),listeners:e.unref(u)})),()=>[o.$slots.icon?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-control-inner-icon",onClick:n[0]||(n[0]=a=>c.value?.focus())},[e.renderSlot(o.$slots,"icon")])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({ref_key:"field",ref:c,"onUpdate:modelValue":n[1]||(n[1]=a=>i.value=a)},{...e.unref(d),...e.unref(u)}),null,16),[[e.vModelDynamic,i.value]])]),e.createElementVNode("div",N,[e.renderSlot(o.$slots,"activity",e.normalizeProps(e.guardReactiveProps({canClear:m.value,clear:k,isInteractive:f.value})),()=>[m.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"input-field-close-button",onClick:e.withModifiers(k,["stop"])},[e.createVNode(e.unref(V),{class:"size-[1.25em]"})])):(e.openBlock(),e.createBlock(e.Transition,{key:1,name:"input-field-fade"},{default:e.withCtx(()=>[l.activity&&t.indicator?(e.openBlock(),e.createBlock(e.unref(C.ActivityIndicator),{key:"activity",ref_key:"activity",ref:y,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:a})=>[e.createElementVNode("div",S,[e.createTextVNode(e.toDisplayString(a),1),n[2]||(n[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:a})=>[e.createElementVNode("div",T,e.toDisplayString(a),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:b,class:"form-help"},e.toDisplayString(t.helpText),513)):e.createCommentVNode("",!0)])],2))}});r.InputField=E,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":["../../../node_modules/.pnpm/@heroicons+vue@2.2.0_vue@3.5.27_typescript@5.9.3_/node_modules/@heroicons/vue/24/outline/esm/XMarkIcon.js","../src/InputField.vue"],"sourcesContent":["import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nexport default function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": \"1.5\",\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\"\n }, [\n _createElementVNode(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M6 18 18 6M6 6l12 12\"\n })\n ]))\n}","<script setup lang=\"ts\" generic=\"ModelValue, Value\">\nimport { XMarkIcon } from '@heroicons/vue/24/outline';\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, computed, 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 clearable: false\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 isDirty,\n listeners\n} = useFormControl<InputHTMLAttributes, InputFieldControlSizePrefix, ModelValue|undefined, Value>({ model, props, emit });\n\nconst isInteractive = computed(() => !props.disabled && !props.readonly);\n\nconst canClear = computed(() => {\n return props.clearable && isDirty.value && isInteractive.value;\n});\n\nfunction clear() {\n if (!isInteractive.value) return;\n model.value = undefined;\n}\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 clearable?: boolean;\n}\n</script>\n\n<template>\n <div\n ref=\"wrapper\"\n class=\"input-field\"\n :class=\"[formGroupClasses, { 'has-clear-button': canClear }]\">\n <slot name=\"label\">\n <label\n v-if=\"props.label\"\n ref=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ props.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\" v-bind=\"{ canClear, clear, isDirty, isInteractive }\">\n <button\n v-if=\"canClear\"\n type=\"button\"\n class=\"input-field-close-button\"\n @click.stop=\"clear\">\n <XMarkIcon class=\"size-[1.25em]\" />\n </button>\n <Transition name=\"input-field-fade\" v-else>\n <ActivityIndicator\n v-if=\"props.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":["render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode","props","__props","model","_useModel","emit","__emit","controlAttributes","formGroupClasses","isDirty","listeners","useFormControl","isInteractive","computed","canClear","clear","activity","useTemplateRef","help","label","field","wrapper","__expose","_normalizeClass","_unref","_renderSlot","_toDisplayString","_hoisted_1","_hoisted_2","_normalizeProps","_guardReactiveProps","$slots","$event","_withDirectives","_mergeProps","_hoisted_3","_createVNode","XMarkIcon","_createBlock","_Transition","ActivityIndicator","$attrs","FormControlErrors","_withCtx","error","_hoisted_4","FormControlFeedback","feedback","_hoisted_5"],"mappings":"odAEe,SAASA,EAAOC,EAAMC,EAAQ,CAC3C,OAAQC,EAAAA,UAAU,EAAIC,EAAAA,mBAAoB,MAAO,CAC/C,MAAO,6BACP,KAAM,OACN,QAAS,YACT,eAAgB,MAChB,OAAQ,eACR,cAAe,OACf,YAAa,MACjB,EAAK,CACDC,EAAAA,mBAAoB,OAAQ,CAC1B,iBAAkB,QAClB,kBAAmB,QACnB,EAAG,sBACT,CAAK,CACL,CAAG,CACH,qmCCXA,MAAMC,EAAQC,EAWRC,EAAQC,EAAAA,SAAuBF,EAAA,YAAC,EAIhCG,EAAOC,EAEP,CACF,kBAAAC,EACA,iBAAAC,EACA,QAAAC,EACA,UAAAC,CAAA,EACAC,EAAAA,eAA8F,CAAE,MAAAR,EAAO,MAAAF,EAAO,KAAAI,EAAM,EAElHO,EAAgBC,EAAAA,SAAS,IAAM,CAACZ,EAAM,UAAY,CAACA,EAAM,QAAQ,EAEjEa,EAAWD,EAAAA,SAAS,IACfZ,EAAM,WAAaQ,EAAQ,OAASG,EAAc,KAC5D,EAED,SAASG,GAAQ,CACRH,EAAc,QACnBT,EAAM,MAAQ,OAClB,CAEA,MAAMa,EAAWC,EAAAA,eAAuD,UAAU,EAC5EC,EAAOD,EAAAA,eAA4B,MAAM,EACzCE,EAAQF,EAAAA,eAAiC,OAAO,EAChDG,EAAQH,EAAAA,eAAiC,OAAO,EAChDI,EAAUJ,EAAAA,eAA+B,SAAS,EAExD,OAAAK,EAAa,CACT,SAAAN,EACA,KAAAE,EACA,MAAAE,EACA,MAAAD,EACA,QAAAE,EACA,MAAO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SAAAI,KAAQ,CAElB/C,EAAAA,mBAIM,MAJNgD,EAIMtB,EAAAA,gBADCqB,CAAQ,EAAA,CAAA,CAAA,0BAKvBtB,EAAAA,WASO7B,EAAA,OAAA,OAAAiC,EAAAA,eAAAC,EAAAA,mBAAA,CAAA,SAPO5B,EAAA,QAAA,CAAQ,CAAA,EAFtB,IASO,CALOA,EAAA,wBADVH,EAAAA,mBAKQ,QAAA,eAHA,OAAJ,IAAImB,EACJ,MAAM,WAAA,oBACHhB,EAAA,QAAQ,EAAA,GAAA","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"input-field.umd.cjs","sources":["../../../node_modules/.pnpm/@heroicons+vue@2.2.0_vue@3.5.27_typescript@5.9.3_/node_modules/@heroicons/vue/24/outline/esm/XMarkIcon.js","../src/InputField.vue"],"sourcesContent":["import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nexport default function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n \"stroke-width\": \"1.5\",\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\"\n }, [\n _createElementVNode(\"path\", {\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n d: \"M6 18 18 6M6 6l12 12\"\n })\n ]))\n}","<script setup lang=\"ts\" generic=\"ModelValue, Value\">\nimport { XMarkIcon } from '@heroicons/vue/24/outline';\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, computed, useTemplateRef, ref } from 'vue';\n\nconst props = withDefaults(defineProps<InputFieldProps<ModelValue,Value>>(), {\n formControlClass: 'form-control',\n labelClass: 'form-label',\n size: 'form-control-md',\n clearable: false\n});\n\ndefineOptions({\n inheritAttrs: false\n});\n\nconst input = ref<string>();\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 isInteractive = computed(() => !props.disabled && !props.readonly);\n\nconst canClear = computed(() => {\n return props.clearable && (!!input.value || !!model.value) && isInteractive.value;\n});\n\nfunction clear() {\n if (!isInteractive.value) return;\n model.value = undefined;\n}\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 clearable?: boolean;\n}\n</script>\n\n<template>\n <div\n ref=\"wrapper\"\n class=\"input-field\"\n :class=\"[formGroupClasses, { 'has-clear-button': canClear }]\">\n <slot name=\"label\">\n <label\n v-if=\"props.label\"\n ref=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ props.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\" v-bind=\"{ canClear, clear, isInteractive }\">\n <button\n v-if=\"canClear\"\n type=\"button\"\n class=\"input-field-close-button\"\n @click.stop=\"clear\">\n <XMarkIcon class=\"size-[1.25em]\" />\n </button>\n <Transition name=\"input-field-fade\" v-else>\n <ActivityIndicator\n v-if=\"props.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":["render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode","props","__props","input","ref","model","_useModel","emit","__emit","controlAttributes","formGroupClasses","listeners","useFormControl","isInteractive","computed","canClear","clear","activity","useTemplateRef","help","label","field","wrapper","__expose","_normalizeClass","_unref","_renderSlot","_toDisplayString","_hoisted_1","_hoisted_2","_normalizeProps","_guardReactiveProps","$slots","$event","_withDirectives","_mergeProps","_hoisted_3","_createVNode","XMarkIcon","_createBlock","_Transition","ActivityIndicator","$attrs","FormControlErrors","_withCtx","error","_hoisted_4","FormControlFeedback","feedback","_hoisted_5"],"mappings":"odAEe,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,MAAM,WAAA,oBACHjB,EAAA,QAAQ,EAAA,GAAA","x_google_ignoreList":[0]}
package/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import InputField from './src/InputField.vue';
2
2
 
3
+ export * from './src/InputField.vue';
4
+
3
5
  export {
4
6
  InputField
5
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-interface/input-field",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "A Vue input field component.",
5
5
  "type": "module",
6
6
  "main": "./dist/input-field.umd.cjs",
@@ -3,7 +3,7 @@ import { XMarkIcon } from '@heroicons/vue/24/outline';
3
3
  import { ActivityIndicator } from '@vue-interface/activity-indicator';
4
4
  import type { FormControlEvents, FormControlProps, FormControlSlots } from '@vue-interface/form-control';
5
5
  import { FormControlErrors, FormControlFeedback, useFormControl } from '@vue-interface/form-control';
6
- import { InputHTMLAttributes, computed, useTemplateRef } from 'vue';
6
+ import { InputHTMLAttributes, computed, useTemplateRef, ref } from 'vue';
7
7
 
8
8
  const props = withDefaults(defineProps<InputFieldProps<ModelValue,Value>>(), {
9
9
  formControlClass: 'form-control',
@@ -16,6 +16,7 @@ defineOptions({
16
16
  inheritAttrs: false
17
17
  });
18
18
 
19
+ const input = ref<string>();
19
20
  const model = defineModel<ModelValue>();
20
21
 
21
22
  defineSlots<FormControlSlots<InputFieldControlSizePrefix,ModelValue>>();
@@ -25,14 +26,13 @@ const emit = defineEmits<FormControlEvents>();
25
26
  const {
26
27
  controlAttributes,
27
28
  formGroupClasses,
28
- isDirty,
29
29
  listeners
30
30
  } = useFormControl<InputHTMLAttributes, InputFieldControlSizePrefix, ModelValue|undefined, Value>({ model, props, emit });
31
31
 
32
32
  const isInteractive = computed(() => !props.disabled && !props.readonly);
33
33
 
34
34
  const canClear = computed(() => {
35
- return props.clearable && isDirty.value && isInteractive.value;
35
+ return props.clearable && (!!input.value || !!model.value) && isInteractive.value;
36
36
  });
37
37
 
38
38
  function clear() {
@@ -102,7 +102,7 @@ export type InputFieldProps<ModelValue, Value> = FormControlProps<
102
102
  </slot>
103
103
 
104
104
  <div class="form-control-activity-indicator">
105
- <slot name="activity" v-bind="{ canClear, clear, isDirty, isInteractive }">
105
+ <slot name="activity" v-bind="{ canClear, clear, isInteractive }">
106
106
  <button
107
107
  v-if="canClear"
108
108
  type="button"