@featherk/ui 0.9.2 → 0.9.4
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/README.md +7 -1
- package/dist/address/USAddress.vue.d.ts +25 -6
- package/dist/featherk-ui.es.js +119 -99
- package/dist/featherk-ui.umd.js +1 -1
- package/dist/ui.css +1 -1
- package/docs/address/USAddress.md +33 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,10 +25,12 @@ import { USAddress } from "@featherk/ui";
|
|
|
25
25
|
import { useUSAddress } from "@featherk/composables/address";
|
|
26
26
|
|
|
27
27
|
const billingFieldsetRef = ref<HTMLFieldSetElement | null>(null);
|
|
28
|
+
const isAddressRequired = ref(true);
|
|
28
29
|
|
|
29
30
|
const billingAddress = useUSAddress({
|
|
30
31
|
fieldsetRef: toRef(() => billingFieldsetRef.value),
|
|
31
32
|
addressId: "billing-address",
|
|
33
|
+
required: toRef(() => isAddressRequired.value),
|
|
32
34
|
});
|
|
33
35
|
|
|
34
36
|
const onFieldsetFocusout = (event: FocusEvent) => {
|
|
@@ -50,7 +52,11 @@ async function onSubmit() {
|
|
|
50
52
|
<template>
|
|
51
53
|
<form @submit.prevent="onSubmit">
|
|
52
54
|
<fieldset ref="billingFieldsetRef" @focusout="onFieldsetFocusout">
|
|
53
|
-
<USAddress
|
|
55
|
+
<USAddress
|
|
56
|
+
id="billing-address"
|
|
57
|
+
:address="billingAddress"
|
|
58
|
+
:required="isAddressRequired"
|
|
59
|
+
/>
|
|
54
60
|
|
|
55
61
|
<label for="billing-attn">Attention</label>
|
|
56
62
|
<input id="billing-attn" type="text" />
|
|
@@ -3,7 +3,7 @@ interface USAddressViewModel {
|
|
|
3
3
|
address1: string;
|
|
4
4
|
address2: string;
|
|
5
5
|
city: string;
|
|
6
|
-
state
|
|
6
|
+
state: string | null;
|
|
7
7
|
zip: string;
|
|
8
8
|
};
|
|
9
9
|
addressValidate: {
|
|
@@ -24,6 +24,18 @@ interface USAddressViewModel {
|
|
|
24
24
|
addressValid: {
|
|
25
25
|
value: boolean;
|
|
26
26
|
};
|
|
27
|
+
optionalFeedbackActive?: {
|
|
28
|
+
value: boolean;
|
|
29
|
+
};
|
|
30
|
+
optionalPartialInvalid?: {
|
|
31
|
+
value: boolean;
|
|
32
|
+
};
|
|
33
|
+
optionalMissingRequiredFields?: {
|
|
34
|
+
value: boolean;
|
|
35
|
+
};
|
|
36
|
+
optionalZipInvalid?: {
|
|
37
|
+
value: boolean;
|
|
38
|
+
};
|
|
27
39
|
stateDefaultItem: {
|
|
28
40
|
label: string;
|
|
29
41
|
value: string | null;
|
|
@@ -36,22 +48,29 @@ interface USAddressViewModel {
|
|
|
36
48
|
value: string;
|
|
37
49
|
};
|
|
38
50
|
zipWrapperClass: string;
|
|
39
|
-
onAddress1Input: (
|
|
40
|
-
onAddress2Input: (
|
|
41
|
-
onCityInput: (
|
|
42
|
-
onStateChange: (event:
|
|
43
|
-
|
|
51
|
+
onAddress1Input: (...args: unknown[]) => void;
|
|
52
|
+
onAddress2Input: (...args: unknown[]) => void;
|
|
53
|
+
onCityInput: (...args: unknown[]) => void;
|
|
54
|
+
onStateChange: (event: {
|
|
55
|
+
value: string | null;
|
|
56
|
+
}) => void;
|
|
57
|
+
onZipInput: (...args: unknown[]) => void;
|
|
44
58
|
}
|
|
45
59
|
type __VLS_Props = {
|
|
46
60
|
id: string;
|
|
47
61
|
address: USAddressViewModel;
|
|
62
|
+
required?: boolean;
|
|
63
|
+
messageScope?: USAddressMessageScope;
|
|
48
64
|
showAddress2?: boolean;
|
|
49
65
|
address1Placeholder?: string;
|
|
50
66
|
address2Placeholder?: string;
|
|
51
67
|
cityPlaceholder?: string;
|
|
52
68
|
zipPlaceholder?: string;
|
|
53
69
|
};
|
|
70
|
+
type USAddressMessageScope = "field" | "fieldset";
|
|
54
71
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
72
|
+
required: boolean;
|
|
73
|
+
messageScope: USAddressMessageScope;
|
|
55
74
|
showAddress2: boolean;
|
|
56
75
|
address1Placeholder: string;
|
|
57
76
|
address2Placeholder: string;
|
package/dist/featherk-ui.es.js
CHANGED
|
@@ -1,87 +1,101 @@
|
|
|
1
1
|
import "./ui.css";
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { Error as
|
|
4
|
-
import { TextBox as
|
|
5
|
-
import { DropDownList as
|
|
6
|
-
const
|
|
2
|
+
import { defineComponent as B, computed as l, openBlock as d, createElementBlock as S, normalizeClass as L, createElementVNode as k, createVNode as V, unref as t, Fragment as R, createBlock as r, withCtx as i, createTextVNode as v, createCommentVNode as n, toDisplayString as c } from "vue";
|
|
3
|
+
import { Error as f, Hint as _ } from "@progress/kendo-vue-labels";
|
|
4
|
+
import { TextBox as A } from "@progress/kendo-vue-inputs";
|
|
5
|
+
import { DropDownList as $ } from "@progress/kendo-vue-dropdowns";
|
|
6
|
+
const N = { class: "address1" }, b = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "address2"
|
|
9
|
-
},
|
|
9
|
+
}, x = { class: "city" }, T = { class: "state" }, G = { class: "zip" }, M = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "messages"
|
|
12
|
+
}, E = "Enter a 5 or 9 digit zip code.", U = "Address is optional. Enter Address 1, City, State, and ZIP (Address Line 2 is optional), or clear the address.", H = /* @__PURE__ */ B({
|
|
10
13
|
__name: "USAddress",
|
|
11
14
|
props: {
|
|
12
15
|
id: {},
|
|
13
16
|
address: {},
|
|
17
|
+
required: { type: Boolean, default: !0 },
|
|
18
|
+
messageScope: { default: "fieldset" },
|
|
14
19
|
showAddress2: { type: Boolean, default: !0 },
|
|
15
|
-
address1Placeholder: { default: "
|
|
16
|
-
address2Placeholder: { default: "
|
|
17
|
-
cityPlaceholder: { default: "
|
|
20
|
+
address1Placeholder: { default: "Address Line 1" },
|
|
21
|
+
address2Placeholder: { default: "Address Line 2" },
|
|
22
|
+
cityPlaceholder: { default: "City" },
|
|
18
23
|
zipPlaceholder: { default: "00000-0000" }
|
|
19
24
|
},
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
22
|
-
address1: `${
|
|
23
|
-
address2: `${
|
|
24
|
-
city: `${
|
|
25
|
-
state: `${
|
|
26
|
-
zip: `${
|
|
27
|
-
})), e =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
setup(D) {
|
|
26
|
+
const s = D, o = l(() => s.messageScope === "field"), y = l(() => s.messageScope === "fieldset"), a = l(() => s.required), m = l(() => a.value), I = l(() => ({
|
|
27
|
+
address1: `${s.id}-address1`,
|
|
28
|
+
address2: `${s.id}-address2`,
|
|
29
|
+
city: `${s.id}-city`,
|
|
30
|
+
state: `${s.id}-state`,
|
|
31
|
+
zip: `${s.id}-zip`
|
|
32
|
+
})), e = l(() => s.address), C = l(() => e.value.address1Valid.value && e.value.cityValid.value && e.value.stateValid.value), g = l(() => e.value.formData.address1.trim() !== "" || e.value.formData.address2.trim() !== "" || e.value.formData.city.trim() !== "" || (e.value.formData.state ?? "").trim() !== "" || e.value.formData.zip.replace(/\D/g, "") !== ""), P = l(() => {
|
|
33
|
+
if (e.value.optionalZipInvalid)
|
|
34
|
+
return e.value.optionalZipInvalid.value;
|
|
35
|
+
const p = e.value.formData.zip.replace(/\D/g, "");
|
|
36
|
+
return !a.value && g.value && p.length !== 5 && p.length !== 9;
|
|
37
|
+
}), w = l(() => e.value.optionalPartialInvalid ? e.value.optionalPartialInvalid.value : !a.value && g.value && !e.value.addressValid.value), h = l(() => a.value || !w.value ? !1 : e.value.optionalFeedbackActive ? e.value.optionalFeedbackActive.value : !1), O = l(() => m.value && !e.value.address1Valid.value || h.value && e.value.formData.address1.trim() === ""), q = l(() => m.value && !e.value.cityValid.value || h.value && e.value.formData.city.trim() === ""), F = l(() => m.value && !e.value.stateValid.value || h.value && (e.value.formData.state ?? "").trim() === ""), z = l(() => m.value && !e.value.zipValid.value || h.value && P.value), Z = l(() => y.value && a.value ? `${s.address2Placeholder} (Optional)` : s.address2Placeholder);
|
|
38
|
+
return (p, u) => (d(), S("div", {
|
|
39
|
+
class: L(["fkui-us-address", { "fkui-us-address--fieldset-scope": y.value }])
|
|
40
|
+
}, [
|
|
41
|
+
k("div", N, [
|
|
42
|
+
V(t(A), {
|
|
43
|
+
id: I.value.address1,
|
|
44
|
+
placeholder: p.address1Placeholder,
|
|
33
45
|
value: e.value.formData.address1,
|
|
34
|
-
valid: e.value.address1Valid.value,
|
|
35
|
-
validate: e.value.addressValidate.value,
|
|
36
|
-
validityStyles: e.value.addressValidate.value,
|
|
46
|
+
valid: a.value ? e.value.address1Valid.value : !0,
|
|
47
|
+
validate: a.value ? e.value.addressValidate.value : !1,
|
|
48
|
+
validityStyles: a.value ? e.value.addressValidate.value : !1,
|
|
37
49
|
onInput: e.value.onAddress1Input
|
|
38
50
|
}, null, 8, ["id", "placeholder", "value", "valid", "validate", "validityStyles", "onInput"]),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
o.value ? (d(), S(R, { key: 0 }, [
|
|
52
|
+
O.value ? (d(), r(t(f), { key: 0 }, {
|
|
53
|
+
default: i(() => [...u[0] || (u[0] = [
|
|
54
|
+
v(" Required. ", -1)
|
|
55
|
+
])]),
|
|
56
|
+
_: 1
|
|
57
|
+
})) : (d(), r(t(_), { key: 1 }, {
|
|
58
|
+
default: i(() => [...u[1] || (u[1] = [
|
|
59
|
+
v("Enter address line 1.", -1)
|
|
60
|
+
])]),
|
|
61
|
+
_: 1
|
|
62
|
+
}))
|
|
63
|
+
], 64)) : n("", !0)
|
|
50
64
|
]),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
id:
|
|
54
|
-
placeholder:
|
|
65
|
+
p.showAddress2 ? (d(), S("div", b, [
|
|
66
|
+
V(t(A), {
|
|
67
|
+
id: I.value.address2,
|
|
68
|
+
placeholder: Z.value,
|
|
55
69
|
value: e.value.formData.address2,
|
|
56
70
|
onInput: e.value.onAddress2Input
|
|
57
71
|
}, null, 8, ["id", "placeholder", "value", "onInput"]),
|
|
58
|
-
|
|
59
|
-
default:
|
|
60
|
-
|
|
72
|
+
o.value ? (d(), r(t(_), { key: 0 }, {
|
|
73
|
+
default: i(() => [...u[2] || (u[2] = [
|
|
74
|
+
v("Optional.", -1)
|
|
61
75
|
])]),
|
|
62
76
|
_: 1
|
|
63
|
-
})
|
|
64
|
-
])) :
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
id:
|
|
68
|
-
placeholder:
|
|
77
|
+
})) : n("", !0)
|
|
78
|
+
])) : n("", !0),
|
|
79
|
+
k("div", x, [
|
|
80
|
+
V(t(A), {
|
|
81
|
+
id: I.value.city,
|
|
82
|
+
placeholder: p.cityPlaceholder,
|
|
69
83
|
value: e.value.formData.city,
|
|
70
|
-
valid: e.value.cityValid.value,
|
|
71
|
-
validate: e.value.addressValidate.value,
|
|
72
|
-
validityStyles: e.value.addressValidate.value,
|
|
84
|
+
valid: a.value ? e.value.cityValid.value : !0,
|
|
85
|
+
validate: a.value ? e.value.addressValidate.value : !1,
|
|
86
|
+
validityStyles: a.value ? e.value.addressValidate.value : !1,
|
|
73
87
|
onInput: e.value.onCityInput
|
|
74
88
|
}, null, 8, ["id", "placeholder", "value", "valid", "validate", "validityStyles", "onInput"]),
|
|
75
|
-
|
|
76
|
-
default:
|
|
77
|
-
|
|
89
|
+
o.value && q.value ? (d(), r(t(f), { key: 0 }, {
|
|
90
|
+
default: i(() => [...u[3] || (u[3] = [
|
|
91
|
+
v(" Required. ", -1)
|
|
78
92
|
])]),
|
|
79
93
|
_: 1
|
|
80
|
-
}))
|
|
94
|
+
})) : n("", !0)
|
|
81
95
|
]),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
id:
|
|
96
|
+
k("div", T, [
|
|
97
|
+
V(t($), {
|
|
98
|
+
id: I.value.state,
|
|
85
99
|
value: e.value.formData.state,
|
|
86
100
|
onChange: e.value.onStateChange,
|
|
87
101
|
defaultItem: e.value.stateDefaultItem,
|
|
@@ -90,62 +104,68 @@ const P = { class: "fkui-us-address" }, z = { class: "address1" }, S = {
|
|
|
90
104
|
valueField: "value",
|
|
91
105
|
dataItemKey: "value",
|
|
92
106
|
valuePrimitive: !0,
|
|
93
|
-
valid: e.value.stateValid.value,
|
|
94
|
-
validate: e.value.addressValidate.value,
|
|
95
|
-
validityStyles: e.value.addressValidate.value
|
|
107
|
+
valid: a.value ? e.value.stateValid.value : !0,
|
|
108
|
+
validate: a.value ? e.value.addressValidate.value : !1,
|
|
109
|
+
validityStyles: a.value ? e.value.addressValidate.value : !1
|
|
96
110
|
}, null, 8, ["id", "value", "onChange", "defaultItem", "dataItems", "valid", "validate", "validityStyles"]),
|
|
97
|
-
|
|
98
|
-
default:
|
|
99
|
-
|
|
111
|
+
o.value && F.value ? (d(), r(t(f), { key: 0 }, {
|
|
112
|
+
default: i(() => [...u[4] || (u[4] = [
|
|
113
|
+
v(" Required. ", -1)
|
|
100
114
|
])]),
|
|
101
115
|
_: 1
|
|
102
|
-
}))
|
|
116
|
+
})) : n("", !0)
|
|
103
117
|
]),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
id:
|
|
107
|
-
placeholder:
|
|
118
|
+
k("div", G, [
|
|
119
|
+
V(t(A), {
|
|
120
|
+
id: I.value.zip,
|
|
121
|
+
placeholder: p.zipPlaceholder,
|
|
108
122
|
wrapperClass: e.value.zipWrapperClass,
|
|
109
123
|
value: e.value.zipDisplay.value,
|
|
110
124
|
onInput: e.value.onZipInput,
|
|
111
|
-
valid: e.value.zipValid.value,
|
|
112
|
-
validate: e.value.addressValidate.value,
|
|
113
|
-
validityStyles: e.value.addressValidate.value,
|
|
125
|
+
valid: a.value ? e.value.zipValid.value : !0,
|
|
126
|
+
validate: a.value ? e.value.addressValidate.value : !1,
|
|
127
|
+
validityStyles: a.value ? e.value.addressValidate.value : !1,
|
|
114
128
|
style: { width: "100%" }
|
|
115
129
|
}, null, 8, ["id", "placeholder", "wrapperClass", "value", "onInput", "valid", "validate", "validityStyles"]),
|
|
116
|
-
|
|
117
|
-
default:
|
|
118
|
-
|
|
119
|
-
])
|
|
130
|
+
o.value && z.value ? (d(), r(t(f), { key: 0 }, {
|
|
131
|
+
default: i(() => [
|
|
132
|
+
v(c(E))
|
|
133
|
+
]),
|
|
120
134
|
_: 1
|
|
121
|
-
})) : (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
135
|
+
})) : n("", !0),
|
|
136
|
+
o.value && !z.value ? (d(), r(t(_), { key: 1 }, {
|
|
137
|
+
default: i(() => [
|
|
138
|
+
v(c(E))
|
|
139
|
+
]),
|
|
125
140
|
_: 1
|
|
126
|
-
}))
|
|
141
|
+
})) : n("", !0)
|
|
127
142
|
]),
|
|
128
|
-
|
|
129
|
-
e.value.addressValid.value ? (d(),
|
|
130
|
-
default:
|
|
131
|
-
|
|
132
|
-
])
|
|
143
|
+
y.value ? (d(), S("div", M, [
|
|
144
|
+
m.value && !e.value.addressValid.value ? (d(), r(t(f), { key: 0 }, {
|
|
145
|
+
default: i(() => [
|
|
146
|
+
v(c(C.value ? "" : "Required fields are missing.") + " " + c(e.value.zipValid.value ? "" : E), 1)
|
|
147
|
+
]),
|
|
148
|
+
_: 1
|
|
149
|
+
})) : h.value ? (d(), r(t(f), { key: 1 }, {
|
|
150
|
+
default: i(() => [
|
|
151
|
+
v(c(U) + " " + c(P.value ? E : ""), 1)
|
|
152
|
+
]),
|
|
133
153
|
_: 1
|
|
134
|
-
})) : (d(),
|
|
135
|
-
default:
|
|
136
|
-
|
|
154
|
+
})) : (d(), r(t(_), { key: 2 }, {
|
|
155
|
+
default: i(() => [...u[5] || (u[5] = [
|
|
156
|
+
v("Enter address information.", -1)
|
|
137
157
|
])]),
|
|
138
158
|
_: 1
|
|
139
159
|
}))
|
|
140
|
-
])
|
|
141
|
-
]));
|
|
160
|
+
])) : n("", !0)
|
|
161
|
+
], 2));
|
|
142
162
|
}
|
|
143
|
-
}),
|
|
144
|
-
const
|
|
145
|
-
for (const [
|
|
146
|
-
|
|
147
|
-
return
|
|
148
|
-
},
|
|
163
|
+
}), K = (D, s) => {
|
|
164
|
+
const o = D.__vccOpts || D;
|
|
165
|
+
for (const [y, a] of s)
|
|
166
|
+
o[y] = a;
|
|
167
|
+
return o;
|
|
168
|
+
}, X = /* @__PURE__ */ K(H, [["__scopeId", "data-v-95d578ff"]]);
|
|
149
169
|
export {
|
|
150
|
-
|
|
170
|
+
X as USAddress
|
|
151
171
|
};
|
package/dist/featherk-ui.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@progress/kendo-vue-labels"),require("@progress/kendo-vue-inputs"),require("@progress/kendo-vue-dropdowns")):typeof define=="function"&&define.amd?define(["exports","vue","@progress/kendo-vue-labels","@progress/kendo-vue-inputs","@progress/kendo-vue-dropdowns"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.FeatherKUi={},r.Vue,r.KendoVueLabels,r.KendoVueInputs,r.KendoVueDropdowns))})(this,(function(r,e,o,f,k){"use strict";const B={class:"address1"},S={key:0,class:"address2"},C={class:"city"},x={class:"state"},D={class:"zip"},E={key:1,class:"messages"},v="Enter a 5 or 9 digit zip code.",I="Address is optional. Enter Address 1, City, State, and ZIP (Address Line 2 is optional), or clear the address.",N=((m,l)=>{const s=m.__vccOpts||m;for(const[n,t]of l)s[n]=t;return s})(e.defineComponent({__name:"USAddress",props:{id:{},address:{},required:{type:Boolean,default:!0},messageScope:{default:"fieldset"},showAddress2:{type:Boolean,default:!0},address1Placeholder:{default:"Address Line 1"},address2Placeholder:{default:"Address Line 2"},cityPlaceholder:{default:"City"},zipPlaceholder:{default:"00000-0000"}},setup(m){const l=m,s=e.computed(()=>l.messageScope==="field"),n=e.computed(()=>l.messageScope==="fieldset"),t=e.computed(()=>l.required),u=e.computed(()=>t.value),c=e.computed(()=>({address1:`${l.id}-address1`,address2:`${l.id}-address2`,city:`${l.id}-city`,state:`${l.id}-state`,zip:`${l.id}-zip`})),a=e.computed(()=>l.address),g=e.computed(()=>a.value.address1Valid.value&&a.value.cityValid.value&&a.value.stateValid.value),y=e.computed(()=>a.value.formData.address1.trim()!==""||a.value.formData.address2.trim()!==""||a.value.formData.city.trim()!==""||(a.value.formData.state??"").trim()!==""||a.value.formData.zip.replace(/\D/g,"")!==""),h=e.computed(()=>{if(a.value.optionalZipInvalid)return a.value.optionalZipInvalid.value;const i=a.value.formData.zip.replace(/\D/g,"");return!t.value&&y.value&&i.length!==5&&i.length!==9}),_=e.computed(()=>a.value.optionalPartialInvalid?a.value.optionalPartialInvalid.value:!t.value&&y.value&&!a.value.addressValid.value),p=e.computed(()=>t.value||!_.value?!1:a.value.optionalFeedbackActive?a.value.optionalFeedbackActive.value:!1),w=e.computed(()=>u.value&&!a.value.address1Valid.value||p.value&&a.value.formData.address1.trim()===""),A=e.computed(()=>u.value&&!a.value.cityValid.value||p.value&&a.value.formData.city.trim()===""),P=e.computed(()=>u.value&&!a.value.stateValid.value||p.value&&(a.value.formData.state??"").trim()===""),V=e.computed(()=>u.value&&!a.value.zipValid.value||p.value&&h.value),T=e.computed(()=>n.value&&t.value?`${l.address2Placeholder} (Optional)`:l.address2Placeholder);return(i,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["fkui-us-address",{"fkui-us-address--fieldset-scope":n.value}])},[e.createElementVNode("div",B,[e.createVNode(e.unref(f.TextBox),{id:c.value.address1,placeholder:i.address1Placeholder,value:a.value.formData.address1,valid:t.value?a.value.address1Valid.value:!0,validate:t.value?a.value.addressValidate.value:!1,validityStyles:t.value?a.value.addressValidate.value:!1,onInput:a.value.onAddress1Input},null,8,["id","placeholder","value","valid","validate","validityStyles","onInput"]),s.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[w.value?(e.openBlock(),e.createBlock(e.unref(o.Error),{key:0},{default:e.withCtx(()=>[...d[0]||(d[0]=[e.createTextVNode(" Required. ",-1)])]),_:1})):(e.openBlock(),e.createBlock(e.unref(o.Hint),{key:1},{default:e.withCtx(()=>[...d[1]||(d[1]=[e.createTextVNode("Enter address line 1.",-1)])]),_:1}))],64)):e.createCommentVNode("",!0)]),i.showAddress2?(e.openBlock(),e.createElementBlock("div",S,[e.createVNode(e.unref(f.TextBox),{id:c.value.address2,placeholder:T.value,value:a.value.formData.address2,onInput:a.value.onAddress2Input},null,8,["id","placeholder","value","onInput"]),s.value?(e.openBlock(),e.createBlock(e.unref(o.Hint),{key:0},{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createTextVNode("Optional.",-1)])]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",C,[e.createVNode(e.unref(f.TextBox),{id:c.value.city,placeholder:i.cityPlaceholder,value:a.value.formData.city,valid:t.value?a.value.cityValid.value:!0,validate:t.value?a.value.addressValidate.value:!1,validityStyles:t.value?a.value.addressValidate.value:!1,onInput:a.value.onCityInput},null,8,["id","placeholder","value","valid","validate","validityStyles","onInput"]),s.value&&A.value?(e.openBlock(),e.createBlock(e.unref(o.Error),{key:0},{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode(" Required. ",-1)])]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",x,[e.createVNode(e.unref(k.DropDownList),{id:c.value.state,value:a.value.formData.state,onChange:a.value.onStateChange,defaultItem:a.value.stateDefaultItem,dataItems:a.value.stateOptions,textField:"label",valueField:"value",dataItemKey:"value",valuePrimitive:!0,valid:t.value?a.value.stateValid.value:!0,validate:t.value?a.value.addressValidate.value:!1,validityStyles:t.value?a.value.addressValidate.value:!1},null,8,["id","value","onChange","defaultItem","dataItems","valid","validate","validityStyles"]),s.value&&P.value?(e.openBlock(),e.createBlock(e.unref(o.Error),{key:0},{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode(" Required. ",-1)])]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",D,[e.createVNode(e.unref(f.TextBox),{id:c.value.zip,placeholder:i.zipPlaceholder,wrapperClass:a.value.zipWrapperClass,value:a.value.zipDisplay.value,onInput:a.value.onZipInput,valid:t.value?a.value.zipValid.value:!0,validate:t.value?a.value.addressValidate.value:!1,validityStyles:t.value?a.value.addressValidate.value:!1,style:{width:"100%"}},null,8,["id","placeholder","wrapperClass","value","onInput","valid","validate","validityStyles"]),s.value&&V.value?(e.openBlock(),e.createBlock(e.unref(o.Error),{key:0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v))]),_:1})):e.createCommentVNode("",!0),s.value&&!V.value?(e.openBlock(),e.createBlock(e.unref(o.Hint),{key:1},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v))]),_:1})):e.createCommentVNode("",!0)]),n.value?(e.openBlock(),e.createElementBlock("div",E,[u.value&&!a.value.addressValid.value?(e.openBlock(),e.createBlock(e.unref(o.Error),{key:0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.value?"":"Required fields are missing.")+" "+e.toDisplayString(a.value.zipValid.value?"":v),1)]),_:1})):p.value?(e.openBlock(),e.createBlock(e.unref(o.Error),{key:1},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(I)+" "+e.toDisplayString(h.value?v:""),1)]),_:1})):(e.openBlock(),e.createBlock(e.unref(o.Hint),{key:2},{default:e.withCtx(()=>[...d[5]||(d[5]=[e.createTextVNode("Enter address information.",-1)])]),_:1}))])):e.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-95d578ff"]]);r.USAddress=N,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/ui.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.fkui-us-address[data-v-
|
|
1
|
+
.fkui-us-address[data-v-95d578ff]{display:grid;grid-template-columns:2fr 1fr 1fr;grid-template-areas:"address1 address1 address1" "address2 address2 address2" "city state zip" "messages messages messages";gap:.75rem;margin-bottom:1rem}.fkui-us-address .address1[data-v-95d578ff]{grid-area:address1}.fkui-us-address .address2[data-v-95d578ff]{grid-area:address2}.fkui-us-address .city[data-v-95d578ff]{grid-area:city}.fkui-us-address .state[data-v-95d578ff]{grid-area:state}.fkui-us-address .zip[data-v-95d578ff]{grid-area:zip}.fkui-us-address .messages[data-v-95d578ff]{grid-area:messages}.fkui-us-address [data-v-95d578ff] .fk-zip-textbox{min-width:100%}.fkui-us-address--fieldset-scope[data-v-95d578ff]{row-gap:.5rem}.fkui-us-address--fieldset-scope .messages[data-v-95d578ff]{margin-top:-.375rem}
|
|
@@ -68,12 +68,45 @@ async function onSubmit() {
|
|
|
68
68
|
|
|
69
69
|
- `id: string` (required) - Used to generate unique field ids (`${id}-address1`, `${id}-zip`, etc.) for multi-instance pages
|
|
70
70
|
- `address` (required) - Result object returned by `useUSAddress(...)` from `@featherk/composables/address`
|
|
71
|
+
- `required?: boolean` (default: `true`)
|
|
72
|
+
- `messageScope?: "field" | "fieldset"` (default: `"fieldset"`)
|
|
71
73
|
- `showAddress2?: boolean` (default: `true`)
|
|
72
74
|
- `address1Placeholder?: string` (default: `"Enter street address"`)
|
|
73
75
|
- `address2Placeholder?: string` (default: `"Enter address line 2 (Optional)"`)
|
|
74
76
|
- `cityPlaceholder?: string` (default: `"Enter city"`)
|
|
75
77
|
- `zipPlaceholder?: string` (default: `"00000-0000"`)
|
|
76
78
|
|
|
79
|
+
When `showAddress2` is enabled, the component appends `" (Optional)"` to the
|
|
80
|
+
Address Line 2 placeholder only in `fieldset` scope while `required` is `true`.
|
|
81
|
+
When `required` is `false`, Address Line 2 uses the base placeholder text.
|
|
82
|
+
|
|
83
|
+
`messageScope` controls where validation and guidance content is rendered:
|
|
84
|
+
|
|
85
|
+
- `"field"`: Show hints/errors next to each field.
|
|
86
|
+
- `"fieldset"`: Hide field-level hints/errors and show only fieldset-level summary messaging.
|
|
87
|
+
|
|
88
|
+
`required` controls whether address validation is active:
|
|
89
|
+
|
|
90
|
+
- `true` (default): standard delayed validation behavior applies.
|
|
91
|
+
- `false`: address remains optional, but partial input is not allowed.
|
|
92
|
+
|
|
93
|
+
When `required` is `false`, the address follows a complete-or-empty rule:
|
|
94
|
+
|
|
95
|
+
- empty address is valid
|
|
96
|
+
- fully complete address is valid
|
|
97
|
+
- partial address is invalid (including missing ZIP when Address 1/City/State
|
|
98
|
+
are entered, or ZIP length that is not 5 or 9)
|
|
99
|
+
|
|
100
|
+
Optional partial-address feedback is shown after fieldset blur or failed submit
|
|
101
|
+
attempt, and still respects `messageScope` placement.
|
|
102
|
+
|
|
103
|
+
When using `required`, pass the same required source to both `USAddress` and
|
|
104
|
+
`useUSAddress` so submit behavior and rendering stay aligned.
|
|
105
|
+
|
|
106
|
+
If an address is optional, avoid wiring a separate `useFieldsetValidationKit` or
|
|
107
|
+
`useFieldsetTouchTracker` for the same address fieldset unless you intentionally
|
|
108
|
+
want an independent validation experience.
|
|
109
|
+
|
|
77
110
|
## Submission Ownership
|
|
78
111
|
|
|
79
112
|
- `USAddress` intentionally does not expose submit or reset methods.
|