@ticketmaster/tm-global-address 0.6.0 → 0.8.0
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/components/AddressCard/AddressCard.d.ts +5 -0
- package/dist/components/AddressCard/AddressCard.js +45 -46
- package/dist/components/AddressForm/AddressForm.d.ts +14 -2
- package/dist/components/AddressForm/AddressForm.js +216 -212
- package/dist/components/AddressList/AddressList.d.ts +7 -2
- package/dist/components/AddressList/AddressList.js +41 -37
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/useAddressForm.d.ts +76 -0
- package/dist/hooks/useAddressForm.js +174 -0
- package/dist/hooks/useAddressFormRHF.d.ts +8 -0
- package/dist/hooks/useAddressFormRHF.js +174 -0
- package/dist/i18n/defaultLabels.d.ts +2 -0
- package/dist/i18n/defaultLabels.js +66 -0
- package/dist/i18n/index.d.ts +14 -0
- package/dist/i18n/index.js +45 -0
- package/dist/i18n/labelResolver.d.ts +24 -0
- package/dist/i18n/labelResolver.js +98 -0
- package/dist/i18n/locales/ar-sa.json.d.ts +159 -0
- package/dist/i18n/locales/ar-sa.json.js +163 -0
- package/dist/i18n/locales/ca-es.json.d.ts +159 -0
- package/dist/i18n/locales/ca-es.json.js +163 -0
- package/dist/i18n/locales/cs-cz.json.d.ts +159 -0
- package/dist/i18n/locales/cs-cz.json.js +163 -0
- package/dist/i18n/locales/da-dk.json.d.ts +159 -0
- package/dist/i18n/locales/da-dk.json.js +163 -0
- package/dist/i18n/locales/de-at.json.d.ts +159 -0
- package/dist/i18n/locales/de-at.json.js +163 -0
- package/dist/i18n/locales/de-ch.json.d.ts +159 -0
- package/dist/i18n/locales/de-ch.json.js +163 -0
- package/dist/i18n/locales/de-de.json.d.ts +159 -0
- package/dist/i18n/locales/de-de.json.js +163 -0
- package/dist/i18n/locales/en-au.json.d.ts +159 -0
- package/dist/i18n/locales/en-au.json.js +163 -0
- package/dist/i18n/locales/en-ca.json.d.ts +159 -0
- package/dist/i18n/locales/en-ca.json.js +163 -0
- package/dist/i18n/locales/en-gb.json.d.ts +159 -0
- package/dist/i18n/locales/en-gb.json.js +163 -0
- package/dist/i18n/locales/en-nz.json.d.ts +159 -0
- package/dist/i18n/locales/en-nz.json.js +163 -0
- package/dist/i18n/locales/en-us.json.d.ts +159 -0
- package/dist/i18n/locales/en-us.json.js +163 -0
- package/dist/i18n/locales/es-es.json.d.ts +159 -0
- package/dist/i18n/locales/es-es.json.js +163 -0
- package/dist/i18n/locales/es-mx.json.d.ts +159 -0
- package/dist/i18n/locales/es-mx.json.js +163 -0
- package/dist/i18n/locales/fi-fi.json.d.ts +159 -0
- package/dist/i18n/locales/fi-fi.json.js +163 -0
- package/dist/i18n/locales/fr-be.json.d.ts +159 -0
- package/dist/i18n/locales/fr-be.json.js +163 -0
- package/dist/i18n/locales/fr-ca.json.d.ts +159 -0
- package/dist/i18n/locales/fr-ca.json.js +163 -0
- package/dist/i18n/locales/fr-ch.json.d.ts +159 -0
- package/dist/i18n/locales/fr-ch.json.js +163 -0
- package/dist/i18n/locales/fr-fr.json.d.ts +159 -0
- package/dist/i18n/locales/fr-fr.json.js +163 -0
- package/dist/i18n/locales/it-ch.json.d.ts +159 -0
- package/dist/i18n/locales/it-ch.json.js +163 -0
- package/dist/i18n/locales/ja-jp.json.d.ts +159 -0
- package/dist/i18n/locales/ja-jp.json.js +163 -0
- package/dist/i18n/locales/nl-be.json.d.ts +159 -0
- package/dist/i18n/locales/nl-be.json.js +163 -0
- package/dist/i18n/locales/nl-nl.json.d.ts +159 -0
- package/dist/i18n/locales/nl-nl.json.js +163 -0
- package/dist/i18n/locales/no-no.json.d.ts +159 -0
- package/dist/i18n/locales/no-no.json.js +163 -0
- package/dist/i18n/locales/pl-pl.json.d.ts +159 -0
- package/dist/i18n/locales/pl-pl.json.js +163 -0
- package/dist/i18n/locales/sv-se.json.d.ts +159 -0
- package/dist/i18n/locales/sv-se.json.js +163 -0
- package/dist/i18n/types.d.ts +67 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +50 -38
- package/package.json +2 -1
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import { jsxs as s, jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { tokens as e, atDesktop as
|
|
5
|
-
import { getCountryConfig as
|
|
6
|
-
import { FIELD_CONSTRAINTS as
|
|
7
|
-
import { PhoneField as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
1
|
+
import { jsxs as s, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useState as q, useRef as de, useEffect as se, useCallback as L } from "react";
|
|
3
|
+
import u from "styled-components";
|
|
4
|
+
import { tokens as e, atDesktop as ne } from "../../styles/tokens.js";
|
|
5
|
+
import { getCountryConfig as D, getSubdivisions as le, COUNTRY_OPTIONS as R } from "../../data/countryData.js";
|
|
6
|
+
import { FIELD_CONSTRAINTS as F } from "../../validation/constants.js";
|
|
7
|
+
import { PhoneField as ie } from "../PhoneField/PhoneField.js";
|
|
8
|
+
import { useLabels as ce } from "../../i18n/index.js";
|
|
9
|
+
import { validateTextField as k } from "../../validation/validateTextField.js";
|
|
10
|
+
import { validatePostalCode as ue } from "../../validation/validatePostalCode.js";
|
|
11
|
+
import { validateState as pe } from "../../validation/validateState.js";
|
|
12
|
+
import { validatePhoneNumber as me } from "../../validation/validatePhoneNumber.js";
|
|
13
|
+
import { validateForm as fe } from "../../validation/validateForm.js";
|
|
14
|
+
const he = u.form`
|
|
14
15
|
display: flex;
|
|
15
16
|
flex-direction: column;
|
|
16
17
|
gap: ${e.space4};
|
|
17
|
-
|
|
18
|
+
direction: ${(r) => r.$rtl ? "rtl" : "ltr"};
|
|
19
|
+
`, be = u.h2`
|
|
18
20
|
margin: 0 0 ${e.space2};
|
|
19
21
|
font-size: ${e.fontSizeHeading};
|
|
20
22
|
font-weight: ${e.fontWeightBold};
|
|
21
23
|
color: ${e.colorTextPrimary};
|
|
22
|
-
`,
|
|
24
|
+
`, H = u.div`
|
|
23
25
|
display: grid;
|
|
24
26
|
grid-template-columns: 1fr;
|
|
25
27
|
gap: ${e.space4};
|
|
26
|
-
${
|
|
27
|
-
`,
|
|
28
|
+
${ne("grid-template-columns: 1fr 1fr;")}
|
|
29
|
+
`, m = u.div`
|
|
28
30
|
display: flex;
|
|
29
31
|
flex-direction: column;
|
|
30
32
|
gap: ${e.space1};
|
|
31
|
-
`,
|
|
33
|
+
`, $ = u.label`
|
|
32
34
|
font-size: ${e.fontSizeLabel};
|
|
33
35
|
font-weight: ${e.fontWeightNormal};
|
|
34
36
|
color: ${e.colorTextPrimary};
|
|
@@ -40,7 +42,7 @@ const le = c.form`
|
|
|
40
42
|
aria-hidden: true;
|
|
41
43
|
}
|
|
42
44
|
`}
|
|
43
|
-
`,
|
|
45
|
+
`, I = u.input`
|
|
44
46
|
width: 100%;
|
|
45
47
|
padding: ${e.space2} ${e.space3};
|
|
46
48
|
font-size: ${e.fontSizeInput};
|
|
@@ -73,7 +75,7 @@ const le = c.form`
|
|
|
73
75
|
border-color: ${e.colorBorderInputDisabled};
|
|
74
76
|
cursor: not-allowed;
|
|
75
77
|
}
|
|
76
|
-
`, O =
|
|
78
|
+
`, O = u.select`
|
|
77
79
|
width: 100%;
|
|
78
80
|
padding: ${e.space2} ${e.space3};
|
|
79
81
|
font-size: ${e.fontSizeInput};
|
|
@@ -99,18 +101,18 @@ const le = c.form`
|
|
|
99
101
|
border-color: ${e.colorBorderInputDisabled};
|
|
100
102
|
cursor: not-allowed;
|
|
101
103
|
}
|
|
102
|
-
`,
|
|
104
|
+
`, N = u.p`
|
|
103
105
|
margin: 0;
|
|
104
106
|
font-size: ${e.fontSizeError};
|
|
105
107
|
color: ${e.colorTextError};
|
|
106
108
|
display: flex;
|
|
107
109
|
align-items: center;
|
|
108
110
|
gap: ${e.space1};
|
|
109
|
-
`,
|
|
111
|
+
`, ye = u.div`
|
|
110
112
|
display: flex;
|
|
111
113
|
align-items: center;
|
|
112
114
|
gap: ${e.space2};
|
|
113
|
-
`,
|
|
115
|
+
`, $e = u.input`
|
|
114
116
|
width: 18px;
|
|
115
117
|
height: 18px;
|
|
116
118
|
cursor: pointer;
|
|
@@ -119,17 +121,17 @@ const le = c.form`
|
|
|
119
121
|
&:disabled {
|
|
120
122
|
cursor: not-allowed;
|
|
121
123
|
}
|
|
122
|
-
`,
|
|
124
|
+
`, ge = u.label`
|
|
123
125
|
font-size: ${e.fontSizeBody};
|
|
124
126
|
color: ${e.colorTextPrimary};
|
|
125
127
|
cursor: pointer;
|
|
126
|
-
`,
|
|
128
|
+
`, ve = u.div`
|
|
127
129
|
display: flex;
|
|
128
130
|
justify-content: flex-end;
|
|
129
131
|
gap: ${e.space3};
|
|
130
132
|
flex-wrap: wrap;
|
|
131
133
|
margin-block-start: ${e.space2};
|
|
132
|
-
`,
|
|
134
|
+
`, Ne = u.button`
|
|
133
135
|
appearance: none;
|
|
134
136
|
padding: ${e.space2} ${e.space6};
|
|
135
137
|
font-size: ${e.fontSizeBody};
|
|
@@ -155,7 +157,7 @@ const le = c.form`
|
|
|
155
157
|
opacity: 0.6;
|
|
156
158
|
cursor: not-allowed;
|
|
157
159
|
}
|
|
158
|
-
`,
|
|
160
|
+
`, Be = u.button`
|
|
159
161
|
appearance: none;
|
|
160
162
|
padding: ${e.space2} ${e.space6};
|
|
161
163
|
font-size: ${e.fontSizeBody};
|
|
@@ -184,14 +186,14 @@ const le = c.form`
|
|
|
184
186
|
opacity: 0.6;
|
|
185
187
|
cursor: not-allowed;
|
|
186
188
|
}
|
|
187
|
-
`,
|
|
189
|
+
`, xe = u.div`
|
|
188
190
|
padding: ${e.space3} ${e.space4};
|
|
189
191
|
background: ${e.colorFeedbackErrorSurface};
|
|
190
192
|
border: ${e.borderWidthInput} solid ${e.colorFeedbackErrorBorder};
|
|
191
193
|
border-radius: ${e.borderRadiusInput};
|
|
192
194
|
font-size: ${e.fontSizeBody};
|
|
193
195
|
color: ${e.colorTextError};
|
|
194
|
-
`,
|
|
196
|
+
`, Fe = u.span`
|
|
195
197
|
display: inline-block;
|
|
196
198
|
width: 16px;
|
|
197
199
|
height: 16px;
|
|
@@ -206,13 +208,13 @@ const le = c.form`
|
|
|
206
208
|
}
|
|
207
209
|
}
|
|
208
210
|
`;
|
|
209
|
-
function
|
|
210
|
-
const
|
|
211
|
-
for (const
|
|
212
|
-
|
|
213
|
-
return
|
|
211
|
+
function Ie(r) {
|
|
212
|
+
const f = {};
|
|
213
|
+
for (const B of r)
|
|
214
|
+
f[B.field] || (f[B.field] = B.message);
|
|
215
|
+
return f;
|
|
214
216
|
}
|
|
215
|
-
function
|
|
217
|
+
function Ce(r) {
|
|
216
218
|
return {
|
|
217
219
|
firstName: (r == null ? void 0 : r.firstName) ?? "",
|
|
218
220
|
lastName: (r == null ? void 0 : r.lastName) ?? "",
|
|
@@ -226,165 +228,167 @@ function ge(r) {
|
|
|
226
228
|
defaultAddress: (r == null ? void 0 : r.defaultAddress) ?? !1
|
|
227
229
|
};
|
|
228
230
|
}
|
|
229
|
-
const
|
|
231
|
+
const _e = ({
|
|
230
232
|
mode: r,
|
|
231
|
-
initialValues:
|
|
232
|
-
countryWhitelist:
|
|
233
|
-
showPhoneNumber:
|
|
234
|
-
screenReaderErrorPrefix:
|
|
235
|
-
addressLabel:
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
233
|
+
initialValues: f,
|
|
234
|
+
countryWhitelist: B,
|
|
235
|
+
showPhoneNumber: C = !1,
|
|
236
|
+
screenReaderErrorPrefix: h,
|
|
237
|
+
addressLabel: U,
|
|
238
|
+
locale: Q = "en-us",
|
|
239
|
+
labels: W,
|
|
240
|
+
isLoading: A = !1,
|
|
241
|
+
disabled: K = !1,
|
|
242
|
+
serverErrors: w = [],
|
|
243
|
+
onCancel: Y,
|
|
244
|
+
onSubmit: J
|
|
241
245
|
}) => {
|
|
242
|
-
var
|
|
243
|
-
const [
|
|
244
|
-
|
|
245
|
-
if (
|
|
246
|
+
var G;
|
|
247
|
+
const [a, P] = q(() => Ce(f)), [X, E] = q({}), [_, M] = q(""), Z = de(null), g = D(a.country), S = ce(Q, a.country), c = W ? { ...S.form, ...W } : S.form, V = S.isRTL, j = U ?? c.addressHeading, ee = le(a.country), re = g.stateCodes.length > 0 || g.stateRequired, oe = B ? R.filter((t) => B.includes(t.code)) : R;
|
|
248
|
+
se(() => {
|
|
249
|
+
if (w.length === 0) return;
|
|
246
250
|
const t = {};
|
|
247
251
|
let n = "";
|
|
248
|
-
|
|
252
|
+
w.forEach((i) => {
|
|
249
253
|
i.field ? t[i.field] = i.message : n = i.message;
|
|
250
|
-
}),
|
|
251
|
-
}, [
|
|
252
|
-
const
|
|
254
|
+
}), E((i) => ({ ...i, ...t })), M(n);
|
|
255
|
+
}, [w]);
|
|
256
|
+
const te = L((t) => {
|
|
253
257
|
const n = t.target.value;
|
|
254
|
-
|
|
255
|
-
const { country: l, state:
|
|
256
|
-
return
|
|
258
|
+
P((i) => ({ ...i, country: n, state: "" })), E((i) => {
|
|
259
|
+
const { country: l, state: v, ...x } = i;
|
|
260
|
+
return x;
|
|
257
261
|
});
|
|
258
|
-
}, []),
|
|
262
|
+
}, []), b = L(
|
|
259
263
|
(t) => (n) => {
|
|
260
264
|
const i = n.target.type === "checkbox" ? n.target.checked : n.target.value;
|
|
261
|
-
|
|
262
|
-
const { [t]:
|
|
263
|
-
return
|
|
265
|
+
P((l) => ({ ...l, [t]: i })), E((l) => {
|
|
266
|
+
const { [t]: v, ...x } = l;
|
|
267
|
+
return x;
|
|
264
268
|
});
|
|
265
269
|
},
|
|
266
270
|
[]
|
|
267
|
-
),
|
|
271
|
+
), y = L(
|
|
268
272
|
(t) => () => {
|
|
269
|
-
const n =
|
|
273
|
+
const n = a[t];
|
|
270
274
|
if (typeof n != "string") return;
|
|
271
|
-
const i =
|
|
275
|
+
const i = D(a.country);
|
|
272
276
|
let l = null;
|
|
273
|
-
t === "firstName" ? l =
|
|
274
|
-
if (l) return { ...
|
|
275
|
-
const { [t]:
|
|
276
|
-
return
|
|
277
|
+
t === "firstName" ? l = k("firstName", n, F.firstName) : t === "lastName" ? l = k("lastName", n, F.lastName) : t === "address1" ? l = k("address1", n, F.address1) : t === "address2" && n !== "" ? l = k("address2", n, F.address2) : t === "city" ? l = k("city", n, F.city) : t === "postal" && n !== "" ? l = ue(n, F.postal, i) : t === "state" ? l = pe(n || void 0, i) : t === "phoneNumber" && n !== "" && C ? l = me(n, i) : t === "country" && n === "" && (l = { message: S.validation.FIELD_REQUIRED.replace("{{field}}", c.country) }), E((v) => {
|
|
278
|
+
if (l) return { ...v, [t]: l.message };
|
|
279
|
+
const { [t]: x, ...T } = v;
|
|
280
|
+
return T;
|
|
277
281
|
});
|
|
278
282
|
},
|
|
279
|
-
[
|
|
280
|
-
),
|
|
281
|
-
var
|
|
282
|
-
t.preventDefault(),
|
|
283
|
+
[a, C, c.country, S.validation.FIELD_REQUIRED]
|
|
284
|
+
), ae = (t) => {
|
|
285
|
+
var v;
|
|
286
|
+
t.preventDefault(), M("");
|
|
283
287
|
const n = {
|
|
284
288
|
mode: r,
|
|
285
|
-
...r === "edit" && (
|
|
286
|
-
defaultAddress:
|
|
287
|
-
firstName:
|
|
288
|
-
lastName:
|
|
289
|
-
address1:
|
|
290
|
-
...
|
|
291
|
-
city:
|
|
292
|
-
postal:
|
|
293
|
-
country:
|
|
294
|
-
...
|
|
295
|
-
...
|
|
296
|
-
}, i =
|
|
289
|
+
...r === "edit" && (f == null ? void 0 : f.addressId) !== void 0 ? { addressId: f.addressId } : {},
|
|
290
|
+
defaultAddress: a.defaultAddress,
|
|
291
|
+
firstName: a.firstName.trim(),
|
|
292
|
+
lastName: a.lastName.trim(),
|
|
293
|
+
address1: a.address1.trim(),
|
|
294
|
+
...a.address2.trim() ? { address2: a.address2.trim() } : {},
|
|
295
|
+
city: a.city.trim(),
|
|
296
|
+
postal: a.postal.trim(),
|
|
297
|
+
country: a.country,
|
|
298
|
+
...a.state ? { state: a.state } : {},
|
|
299
|
+
...C && a.phoneNumber ? { phoneNumber: a.phoneNumber.trim() } : {}
|
|
300
|
+
}, i = D(a.country), l = fe(n, i, { showPhoneNumber: C });
|
|
297
301
|
if (!l.valid) {
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
const
|
|
301
|
-
if (
|
|
302
|
-
const
|
|
303
|
-
|
|
302
|
+
const x = Ie(l.errors);
|
|
303
|
+
E(x);
|
|
304
|
+
const T = (v = l.errors[0]) == null ? void 0 : v.field;
|
|
305
|
+
if (T) {
|
|
306
|
+
const z = document.getElementById(`field-${T}`);
|
|
307
|
+
z && (z.focus(), Z.current = z);
|
|
304
308
|
}
|
|
305
309
|
return;
|
|
306
310
|
}
|
|
307
|
-
|
|
308
|
-
},
|
|
309
|
-
return /* @__PURE__ */ s(
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
J(n);
|
|
312
|
+
}, p = K || A, o = (t) => X[t] ?? "";
|
|
313
|
+
return /* @__PURE__ */ s(he, { onSubmit: ae, noValidate: !0, "aria-label": j, $rtl: V, children: [
|
|
314
|
+
/* @__PURE__ */ d(be, { children: j }),
|
|
315
|
+
_ && /* @__PURE__ */ s(xe, { role: "alert", children: [
|
|
316
|
+
h,
|
|
313
317
|
" ",
|
|
314
|
-
|
|
318
|
+
_
|
|
315
319
|
] }),
|
|
316
|
-
/* @__PURE__ */ s(
|
|
317
|
-
/* @__PURE__ */ s(
|
|
318
|
-
/* @__PURE__ */
|
|
319
|
-
/* @__PURE__ */
|
|
320
|
-
|
|
320
|
+
/* @__PURE__ */ s(H, { children: [
|
|
321
|
+
/* @__PURE__ */ s(m, { children: [
|
|
322
|
+
/* @__PURE__ */ d($, { htmlFor: "field-firstName", $required: !0, children: c.firstName }),
|
|
323
|
+
/* @__PURE__ */ d(
|
|
324
|
+
I,
|
|
321
325
|
{
|
|
322
326
|
id: "field-firstName",
|
|
323
327
|
type: "text",
|
|
324
328
|
autoComplete: "given-name",
|
|
325
|
-
value:
|
|
326
|
-
onChange:
|
|
327
|
-
onBlur:
|
|
329
|
+
value: a.firstName,
|
|
330
|
+
onChange: b("firstName"),
|
|
331
|
+
onBlur: y("firstName"),
|
|
328
332
|
maxLength: 30,
|
|
329
|
-
disabled:
|
|
333
|
+
disabled: p,
|
|
330
334
|
$hasError: !!o("firstName"),
|
|
331
335
|
"aria-required": "true",
|
|
332
336
|
"aria-invalid": !!o("firstName"),
|
|
333
337
|
"aria-describedby": o("firstName") ? "err-firstName" : void 0
|
|
334
338
|
}
|
|
335
339
|
),
|
|
336
|
-
o("firstName") && /* @__PURE__ */ s(
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
-
|
|
340
|
+
o("firstName") && /* @__PURE__ */ s(N, { id: "err-firstName", role: "alert", children: [
|
|
341
|
+
/* @__PURE__ */ d("span", { "aria-hidden": "true", children: "⚠" }),
|
|
342
|
+
h,
|
|
339
343
|
" ",
|
|
340
344
|
o("firstName")
|
|
341
345
|
] })
|
|
342
346
|
] }),
|
|
343
|
-
/* @__PURE__ */ s(
|
|
344
|
-
/* @__PURE__ */
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
|
|
347
|
+
/* @__PURE__ */ s(m, { children: [
|
|
348
|
+
/* @__PURE__ */ d($, { htmlFor: "field-lastName", $required: !0, children: c.lastName }),
|
|
349
|
+
/* @__PURE__ */ d(
|
|
350
|
+
I,
|
|
347
351
|
{
|
|
348
352
|
id: "field-lastName",
|
|
349
353
|
type: "text",
|
|
350
354
|
autoComplete: "family-name",
|
|
351
|
-
value:
|
|
352
|
-
onChange:
|
|
353
|
-
onBlur:
|
|
355
|
+
value: a.lastName,
|
|
356
|
+
onChange: b("lastName"),
|
|
357
|
+
onBlur: y("lastName"),
|
|
354
358
|
maxLength: 40,
|
|
355
|
-
disabled:
|
|
359
|
+
disabled: p,
|
|
356
360
|
$hasError: !!o("lastName"),
|
|
357
361
|
"aria-required": "true",
|
|
358
362
|
"aria-invalid": !!o("lastName"),
|
|
359
363
|
"aria-describedby": o("lastName") ? "err-lastName" : void 0
|
|
360
364
|
}
|
|
361
365
|
),
|
|
362
|
-
o("lastName") && /* @__PURE__ */ s(
|
|
363
|
-
/* @__PURE__ */
|
|
364
|
-
|
|
366
|
+
o("lastName") && /* @__PURE__ */ s(N, { id: "err-lastName", role: "alert", children: [
|
|
367
|
+
/* @__PURE__ */ d("span", { "aria-hidden": "true", children: "⚠" }),
|
|
368
|
+
h,
|
|
365
369
|
" ",
|
|
366
370
|
o("lastName")
|
|
367
371
|
] })
|
|
368
372
|
] })
|
|
369
373
|
] }),
|
|
370
|
-
/* @__PURE__ */ s(
|
|
371
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ s(m, { children: [
|
|
375
|
+
/* @__PURE__ */ d($, { htmlFor: "field-country", $required: !0, children: c.country }),
|
|
372
376
|
/* @__PURE__ */ s(
|
|
373
377
|
O,
|
|
374
378
|
{
|
|
375
379
|
id: "field-country",
|
|
376
|
-
value:
|
|
377
|
-
onChange:
|
|
378
|
-
onBlur:
|
|
379
|
-
disabled:
|
|
380
|
+
value: a.country,
|
|
381
|
+
onChange: te,
|
|
382
|
+
onBlur: y("country"),
|
|
383
|
+
disabled: p,
|
|
380
384
|
$hasError: !!o("country"),
|
|
381
385
|
"aria-required": "true",
|
|
382
386
|
"aria-invalid": !!o("country"),
|
|
383
387
|
"aria-describedby": o("country") ? "err-country" : void 0,
|
|
384
388
|
autoComplete: "country",
|
|
385
389
|
children: [
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
-
|
|
390
|
+
/* @__PURE__ */ d("option", { value: "", children: c.countryPlaceholder }),
|
|
391
|
+
oe.map((t) => /* @__PURE__ */ s("option", { value: t.code, children: [
|
|
388
392
|
t.flag,
|
|
389
393
|
" ",
|
|
390
394
|
t.name
|
|
@@ -392,181 +396,181 @@ const Te = ({
|
|
|
392
396
|
]
|
|
393
397
|
}
|
|
394
398
|
),
|
|
395
|
-
o("country") && /* @__PURE__ */ s(
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
|
|
399
|
+
o("country") && /* @__PURE__ */ s(N, { id: "err-country", role: "alert", children: [
|
|
400
|
+
/* @__PURE__ */ d("span", { "aria-hidden": "true", children: "⚠" }),
|
|
401
|
+
h,
|
|
398
402
|
" ",
|
|
399
403
|
o("country")
|
|
400
404
|
] })
|
|
401
405
|
] }),
|
|
402
|
-
/* @__PURE__ */ s(
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
/* @__PURE__ */
|
|
405
|
-
|
|
406
|
+
/* @__PURE__ */ s(m, { children: [
|
|
407
|
+
/* @__PURE__ */ d($, { htmlFor: "field-address1", $required: !0, children: c.address1 }),
|
|
408
|
+
/* @__PURE__ */ d(
|
|
409
|
+
I,
|
|
406
410
|
{
|
|
407
411
|
id: "field-address1",
|
|
408
412
|
type: "text",
|
|
409
413
|
autoComplete: "address-line1",
|
|
410
|
-
value:
|
|
411
|
-
onChange:
|
|
412
|
-
onBlur:
|
|
414
|
+
value: a.address1,
|
|
415
|
+
onChange: b("address1"),
|
|
416
|
+
onBlur: y("address1"),
|
|
413
417
|
maxLength: 50,
|
|
414
|
-
disabled:
|
|
418
|
+
disabled: p,
|
|
415
419
|
$hasError: !!o("address1"),
|
|
416
420
|
"aria-required": "true",
|
|
417
421
|
"aria-invalid": !!o("address1"),
|
|
418
422
|
"aria-describedby": o("address1") ? "err-address1" : void 0
|
|
419
423
|
}
|
|
420
424
|
),
|
|
421
|
-
o("address1") && /* @__PURE__ */ s(
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
|
|
425
|
+
o("address1") && /* @__PURE__ */ s(N, { id: "err-address1", role: "alert", children: [
|
|
426
|
+
/* @__PURE__ */ d("span", { "aria-hidden": "true", children: "⚠" }),
|
|
427
|
+
h,
|
|
424
428
|
" ",
|
|
425
429
|
o("address1")
|
|
426
430
|
] })
|
|
427
431
|
] }),
|
|
428
|
-
/* @__PURE__ */ s(
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
/* @__PURE__ */
|
|
431
|
-
|
|
432
|
+
/* @__PURE__ */ s(m, { children: [
|
|
433
|
+
/* @__PURE__ */ d($, { htmlFor: "field-address2", children: c.address2 }),
|
|
434
|
+
/* @__PURE__ */ d(
|
|
435
|
+
I,
|
|
432
436
|
{
|
|
433
437
|
id: "field-address2",
|
|
434
438
|
type: "text",
|
|
435
439
|
autoComplete: "address-line2",
|
|
436
|
-
value:
|
|
437
|
-
onChange:
|
|
438
|
-
onBlur:
|
|
440
|
+
value: a.address2,
|
|
441
|
+
onChange: b("address2"),
|
|
442
|
+
onBlur: y("address2"),
|
|
439
443
|
maxLength: 50,
|
|
440
|
-
disabled:
|
|
444
|
+
disabled: p,
|
|
441
445
|
$hasError: !1
|
|
442
446
|
}
|
|
443
447
|
)
|
|
444
448
|
] }),
|
|
445
|
-
/* @__PURE__ */ s(
|
|
446
|
-
/* @__PURE__ */ s(
|
|
447
|
-
/* @__PURE__ */
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
-
|
|
449
|
+
/* @__PURE__ */ s(H, { children: [
|
|
450
|
+
/* @__PURE__ */ s(m, { children: [
|
|
451
|
+
/* @__PURE__ */ d($, { htmlFor: "field-city", $required: !0, children: c.city }),
|
|
452
|
+
/* @__PURE__ */ d(
|
|
453
|
+
I,
|
|
450
454
|
{
|
|
451
455
|
id: "field-city",
|
|
452
456
|
type: "text",
|
|
453
457
|
autoComplete: "address-level2",
|
|
454
|
-
value:
|
|
455
|
-
onChange:
|
|
456
|
-
onBlur:
|
|
458
|
+
value: a.city,
|
|
459
|
+
onChange: b("city"),
|
|
460
|
+
onBlur: y("city"),
|
|
457
461
|
maxLength: 30,
|
|
458
|
-
disabled:
|
|
462
|
+
disabled: p,
|
|
459
463
|
$hasError: !!o("city"),
|
|
460
464
|
"aria-required": "true",
|
|
461
465
|
"aria-invalid": !!o("city"),
|
|
462
466
|
"aria-describedby": o("city") ? "err-city" : void 0
|
|
463
467
|
}
|
|
464
468
|
),
|
|
465
|
-
o("city") && /* @__PURE__ */ s(
|
|
466
|
-
/* @__PURE__ */
|
|
467
|
-
|
|
469
|
+
o("city") && /* @__PURE__ */ s(N, { id: "err-city", role: "alert", children: [
|
|
470
|
+
/* @__PURE__ */ d("span", { "aria-hidden": "true", children: "⚠" }),
|
|
471
|
+
h,
|
|
468
472
|
" ",
|
|
469
473
|
o("city")
|
|
470
474
|
] })
|
|
471
475
|
] }),
|
|
472
|
-
/* @__PURE__ */ s(
|
|
473
|
-
/* @__PURE__ */
|
|
474
|
-
/* @__PURE__ */
|
|
475
|
-
|
|
476
|
+
/* @__PURE__ */ s(m, { children: [
|
|
477
|
+
/* @__PURE__ */ d($, { htmlFor: "field-postal", $required: !0, children: c.postal }),
|
|
478
|
+
/* @__PURE__ */ d(
|
|
479
|
+
I,
|
|
476
480
|
{
|
|
477
481
|
id: "field-postal",
|
|
478
482
|
type: "text",
|
|
479
483
|
autoComplete: "postal-code",
|
|
480
|
-
inputMode:
|
|
481
|
-
placeholder:
|
|
482
|
-
value:
|
|
483
|
-
onChange:
|
|
484
|
-
onBlur:
|
|
484
|
+
inputMode: g.postalInputMode,
|
|
485
|
+
placeholder: g.postalExamples,
|
|
486
|
+
value: a.postal,
|
|
487
|
+
onChange: b("postal"),
|
|
488
|
+
onBlur: y("postal"),
|
|
485
489
|
maxLength: 10,
|
|
486
|
-
disabled:
|
|
490
|
+
disabled: p,
|
|
487
491
|
$hasError: !!o("postal"),
|
|
488
492
|
"aria-required": "true",
|
|
489
493
|
"aria-invalid": !!o("postal"),
|
|
490
494
|
"aria-describedby": o("postal") ? "err-postal" : void 0
|
|
491
495
|
}
|
|
492
496
|
),
|
|
493
|
-
o("postal") && /* @__PURE__ */ s(
|
|
494
|
-
/* @__PURE__ */
|
|
495
|
-
|
|
497
|
+
o("postal") && /* @__PURE__ */ s(N, { id: "err-postal", role: "alert", children: [
|
|
498
|
+
/* @__PURE__ */ d("span", { "aria-hidden": "true", children: "⚠" }),
|
|
499
|
+
h,
|
|
496
500
|
" ",
|
|
497
501
|
o("postal")
|
|
498
502
|
] })
|
|
499
503
|
] })
|
|
500
504
|
] }),
|
|
501
|
-
|
|
502
|
-
/* @__PURE__ */
|
|
505
|
+
re && /* @__PURE__ */ s(m, { children: [
|
|
506
|
+
/* @__PURE__ */ d($, { htmlFor: "field-state", $required: g.stateRequired, children: c.stateCode }),
|
|
503
507
|
/* @__PURE__ */ s(
|
|
504
508
|
O,
|
|
505
509
|
{
|
|
506
510
|
id: "field-state",
|
|
507
|
-
value:
|
|
508
|
-
onChange:
|
|
509
|
-
onBlur:
|
|
510
|
-
disabled:
|
|
511
|
+
value: a.state,
|
|
512
|
+
onChange: b("state"),
|
|
513
|
+
onBlur: y("state"),
|
|
514
|
+
disabled: p,
|
|
511
515
|
$hasError: !!o("state"),
|
|
512
|
-
"aria-required":
|
|
516
|
+
"aria-required": g.stateRequired,
|
|
513
517
|
"aria-invalid": !!o("state"),
|
|
514
518
|
"aria-describedby": o("state") ? "err-state" : void 0,
|
|
515
519
|
autoComplete: "address-level1",
|
|
516
520
|
children: [
|
|
517
|
-
/* @__PURE__ */
|
|
518
|
-
|
|
521
|
+
/* @__PURE__ */ d("option", { value: "", children: c.stateCodePlaceholder }),
|
|
522
|
+
ee.map((t) => /* @__PURE__ */ d("option", { value: t.code, children: t.name }, t.code))
|
|
519
523
|
]
|
|
520
524
|
}
|
|
521
525
|
),
|
|
522
|
-
o("state") && /* @__PURE__ */ s(
|
|
523
|
-
/* @__PURE__ */
|
|
524
|
-
|
|
526
|
+
o("state") && /* @__PURE__ */ s(N, { id: "err-state", role: "alert", children: [
|
|
527
|
+
/* @__PURE__ */ d("span", { "aria-hidden": "true", children: "⚠" }),
|
|
528
|
+
h,
|
|
525
529
|
" ",
|
|
526
530
|
o("state")
|
|
527
531
|
] })
|
|
528
532
|
] }),
|
|
529
|
-
|
|
530
|
-
/* @__PURE__ */
|
|
531
|
-
/* @__PURE__ */
|
|
532
|
-
|
|
533
|
+
C && /* @__PURE__ */ s(m, { children: [
|
|
534
|
+
/* @__PURE__ */ d($, { htmlFor: "field-phoneNumber", children: c.phoneNumber }),
|
|
535
|
+
/* @__PURE__ */ d(
|
|
536
|
+
ie,
|
|
533
537
|
{
|
|
534
538
|
id: "field-phoneNumber",
|
|
535
|
-
value:
|
|
536
|
-
dialCode:
|
|
537
|
-
flagEmoji: ((
|
|
538
|
-
countryCode:
|
|
539
|
-
onChange:
|
|
540
|
-
onBlur:
|
|
541
|
-
disabled:
|
|
539
|
+
value: a.phoneNumber,
|
|
540
|
+
dialCode: g.dialCode,
|
|
541
|
+
flagEmoji: ((G = R.find((t) => t.code === a.country)) == null ? void 0 : G.flag) ?? "",
|
|
542
|
+
countryCode: a.country,
|
|
543
|
+
onChange: b("phoneNumber"),
|
|
544
|
+
onBlur: y("phoneNumber"),
|
|
545
|
+
disabled: p,
|
|
542
546
|
hasError: !!o("phoneNumber"),
|
|
543
547
|
errorMessage: o("phoneNumber") || void 0,
|
|
544
|
-
screenReaderErrorPrefix:
|
|
548
|
+
screenReaderErrorPrefix: h
|
|
545
549
|
}
|
|
546
550
|
)
|
|
547
551
|
] }),
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
|
|
552
|
+
/* @__PURE__ */ d(m, { children: /* @__PURE__ */ s(ye, { children: [
|
|
553
|
+
/* @__PURE__ */ d(
|
|
554
|
+
$e,
|
|
551
555
|
{
|
|
552
556
|
id: "field-defaultAddress",
|
|
553
557
|
type: "checkbox",
|
|
554
|
-
checked:
|
|
555
|
-
onChange:
|
|
556
|
-
disabled:
|
|
558
|
+
checked: a.defaultAddress,
|
|
559
|
+
onChange: b("defaultAddress"),
|
|
560
|
+
disabled: p
|
|
557
561
|
}
|
|
558
562
|
),
|
|
559
|
-
/* @__PURE__ */
|
|
563
|
+
/* @__PURE__ */ d(ge, { htmlFor: "field-defaultAddress", children: c.makeDefault })
|
|
560
564
|
] }) }),
|
|
561
|
-
/* @__PURE__ */ s(
|
|
562
|
-
/* @__PURE__ */
|
|
563
|
-
/* @__PURE__ */ s(
|
|
564
|
-
|
|
565
|
-
|
|
565
|
+
/* @__PURE__ */ s(ve, { children: [
|
|
566
|
+
/* @__PURE__ */ d(Ne, { type: "button", disabled: p, onClick: Y, children: c.cancel }),
|
|
567
|
+
/* @__PURE__ */ s(Be, { type: "submit", disabled: p, children: [
|
|
568
|
+
A && /* @__PURE__ */ d(Fe, { "aria-hidden": "true" }),
|
|
569
|
+
c.confirm
|
|
566
570
|
] })
|
|
567
571
|
] })
|
|
568
572
|
] });
|
|
569
573
|
};
|
|
570
574
|
export {
|
|
571
|
-
|
|
575
|
+
_e as AddressForm
|
|
572
576
|
};
|