@ticketmaster/tm-global-address 0.3.0 → 0.5.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.
Files changed (70) hide show
  1. package/dist/components/AddressForm/AddressForm.js +174 -192
  2. package/dist/data/countries.d.ts +18 -0
  3. package/dist/data/countries.js +261 -0
  4. package/dist/data/countryConfig.d.ts +9 -0
  5. package/dist/data/countryConfig.js +87 -0
  6. package/dist/data/countryData.d.ts +7 -9
  7. package/dist/data/countryData.js +25 -542
  8. package/dist/data/index.d.ts +22 -0
  9. package/dist/data/postalPatterns.d.ts +22 -0
  10. package/dist/data/postalPatterns.js +183 -0
  11. package/dist/data/states.d.ts +15 -0
  12. package/dist/data/states.js +1405 -0
  13. package/dist/index.d.ts +12 -1
  14. package/dist/index.js +38 -15
  15. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/ParseError.js +89 -0
  16. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/PhoneNumber.js +188 -0
  17. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/constants.js +10 -0
  18. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/format.js +92 -0
  19. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/RFC3966.js +11 -0
  20. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +7 -0
  21. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +16 -0
  22. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +11 -0
  23. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js +18 -0
  24. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +47 -0
  25. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +22 -0
  26. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +23 -0
  27. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +39 -0
  28. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +31 -0
  29. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js +23 -0
  30. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +25 -0
  31. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +12 -0
  32. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +45 -0
  33. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js +12 -0
  34. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +51 -0
  35. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +14 -0
  36. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/isObject.js +7 -0
  37. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +20 -0
  38. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +6 -0
  39. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +79 -0
  40. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js +19 -0
  41. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/isPossible.js +38 -0
  42. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/isValid.js +12 -0
  43. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/metadata.js +473 -0
  44. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/normalizeArguments.js +108 -0
  45. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/parse.js +119 -0
  46. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js +40 -0
  47. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/parsePhoneNumber.js +9 -0
  48. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js +55 -0
  49. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js +62 -0
  50. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/es6/tools/semver-compare.js +14 -0
  51. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/max/exports/parsePhoneNumber.js +8 -0
  52. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/max/exports/withMetadataArgument.js +8 -0
  53. package/dist/node_modules/.pnpm/libphonenumber-js@1.12.41/node_modules/libphonenumber-js/metadata.max.json.js +4 -0
  54. package/dist/validation/constants.d.ts +2 -0
  55. package/dist/validation/constants.js +152 -0
  56. package/dist/validation/index.d.ts +15 -0
  57. package/dist/validation/sanitize.d.ts +13 -0
  58. package/dist/validation/sanitize.js +6 -0
  59. package/dist/validation/types.d.ts +46 -0
  60. package/dist/validation/validateForm.d.ts +7 -0
  61. package/dist/validation/validateForm.js +22 -0
  62. package/dist/validation/validatePhoneNumber.d.ts +3 -0
  63. package/dist/validation/validatePhoneNumber.js +17 -0
  64. package/dist/validation/validatePostalCode.d.ts +3 -0
  65. package/dist/validation/validatePostalCode.js +22 -0
  66. package/dist/validation/validateState.d.ts +3 -0
  67. package/dist/validation/validateState.js +23 -0
  68. package/dist/validation/validateTextField.d.ts +2 -0
  69. package/dist/validation/validateTextField.js +36 -0
  70. package/package.json +4 -1
@@ -1,27 +1,33 @@
1
1
  import { jsxs as s, jsx as a } from "react/jsx-runtime";
2
- import { useState as S, useRef as X, useEffect as Z, useCallback as w } from "react";
3
- import n from "styled-components";
4
- import { tokens as e, atDesktop as V } from "../../styles/tokens.js";
5
- import { getCountryConfig as q, getSubdivisions as ee, COUNTRY_OPTIONS as E } from "../../data/countryData.js";
6
- const re = n.form`
2
+ import { useState as z, useRef as V, useEffect as ee, useCallback as T } from "react";
3
+ import c from "styled-components";
4
+ import { tokens as e, atDesktop as re } from "../../styles/tokens.js";
5
+ import { getCountryConfig as q, getSubdivisions as oe, COUNTRY_OPTIONS as L } from "../../data/countryData.js";
6
+ import { FIELD_CONSTRAINTS as C } from "../../validation/constants.js";
7
+ import { validateTextField as S } from "../../validation/validateTextField.js";
8
+ import { validatePostalCode as te } from "../../validation/validatePostalCode.js";
9
+ import { validateState as ae } from "../../validation/validateState.js";
10
+ import { validatePhoneNumber as de } from "../../validation/validatePhoneNumber.js";
11
+ import { validateForm as se } from "../../validation/validateForm.js";
12
+ const ne = c.form`
7
13
  display: flex;
8
14
  flex-direction: column;
9
15
  gap: ${e.space4};
10
- `, oe = n.h2`
16
+ `, le = c.h2`
11
17
  margin: 0 0 ${e.space2};
12
18
  font-size: ${e.fontSizeHeading};
13
19
  font-weight: ${e.fontWeightBold};
14
20
  color: ${e.colorTextPrimary};
15
- `, W = n.div`
21
+ `, M = c.div`
16
22
  display: grid;
17
23
  grid-template-columns: 1fr;
18
24
  gap: ${e.space4};
19
- ${V("grid-template-columns: 1fr 1fr;")}
20
- `, h = n.div`
25
+ ${re("grid-template-columns: 1fr 1fr;")}
26
+ `, p = c.div`
21
27
  display: flex;
22
28
  flex-direction: column;
23
29
  gap: ${e.space1};
24
- `, g = n.label`
30
+ `, $ = c.label`
25
31
  font-size: ${e.fontSizeLabel};
26
32
  font-weight: ${e.fontWeightNormal};
27
33
  color: ${e.colorTextPrimary};
@@ -33,7 +39,7 @@ const re = n.form`
33
39
  aria-hidden: true;
34
40
  }
35
41
  `}
36
- `, x = n.input`
42
+ `, N = c.input`
37
43
  width: 100%;
38
44
  padding: ${e.space2} ${e.space3};
39
45
  font-size: ${e.fontSizeInput};
@@ -66,7 +72,7 @@ const re = n.form`
66
72
  border-color: ${e.colorBorderInputDisabled};
67
73
  cursor: not-allowed;
68
74
  }
69
- `, D = n.select`
75
+ `, O = c.select`
70
76
  width: 100%;
71
77
  padding: ${e.space2} ${e.space3};
72
78
  font-size: ${e.fontSizeInput};
@@ -92,18 +98,18 @@ const re = n.form`
92
98
  border-color: ${e.colorBorderInputDisabled};
93
99
  cursor: not-allowed;
94
100
  }
95
- `, N = n.p`
101
+ `, g = c.p`
96
102
  margin: 0;
97
103
  font-size: ${e.fontSizeError};
98
104
  color: ${e.colorTextError};
99
105
  display: flex;
100
106
  align-items: center;
101
107
  gap: ${e.space1};
102
- `, te = n.div`
108
+ `, ie = c.div`
103
109
  display: flex;
104
110
  align-items: center;
105
111
  gap: ${e.space2};
106
- `, ae = n.input`
112
+ `, ce = c.input`
107
113
  width: 18px;
108
114
  height: 18px;
109
115
  cursor: pointer;
@@ -112,17 +118,17 @@ const re = n.form`
112
118
  &:disabled {
113
119
  cursor: not-allowed;
114
120
  }
115
- `, de = n.label`
121
+ `, ue = c.label`
116
122
  font-size: ${e.fontSizeBody};
117
123
  color: ${e.colorTextPrimary};
118
124
  cursor: pointer;
119
- `, se = n.div`
125
+ `, pe = c.div`
120
126
  display: flex;
121
127
  justify-content: flex-end;
122
128
  gap: ${e.space3};
123
129
  flex-wrap: wrap;
124
130
  margin-block-start: ${e.space2};
125
- `, ne = n.button`
131
+ `, me = c.button`
126
132
  appearance: none;
127
133
  padding: ${e.space2} ${e.space6};
128
134
  font-size: ${e.fontSizeBody};
@@ -148,7 +154,7 @@ const re = n.form`
148
154
  opacity: 0.6;
149
155
  cursor: not-allowed;
150
156
  }
151
- `, le = n.button`
157
+ `, fe = c.button`
152
158
  appearance: none;
153
159
  padding: ${e.space2} ${e.space6};
154
160
  font-size: ${e.fontSizeBody};
@@ -177,10 +183,10 @@ const re = n.form`
177
183
  opacity: 0.6;
178
184
  cursor: not-allowed;
179
185
  }
180
- `, ie = n.div`
186
+ `, he = c.div`
181
187
  display: flex;
182
188
  gap: ${e.space2};
183
- `, ce = n.div`
189
+ `, be = c.div`
184
190
  display: flex;
185
191
  align-items: center;
186
192
  gap: ${e.space1};
@@ -192,14 +198,14 @@ const re = n.form`
192
198
  color: ${e.colorTextPrimary};
193
199
  white-space: nowrap;
194
200
  flex-shrink: 0;
195
- `, ue = n.div`
201
+ `, ye = c.div`
196
202
  padding: ${e.space3} ${e.space4};
197
203
  background: ${e.colorFeedbackErrorSurface};
198
204
  border: ${e.borderWidthInput} solid ${e.colorFeedbackErrorBorder};
199
205
  border-radius: ${e.borderRadiusInput};
200
206
  font-size: ${e.fontSizeBody};
201
207
  color: ${e.colorTextError};
202
- `, pe = n.span`
208
+ `, $e = c.span`
203
209
  display: inline-block;
204
210
  width: 16px;
205
211
  height: 16px;
@@ -209,17 +215,18 @@ const re = n.form`
209
215
  animation: spin 0.8s linear infinite;
210
216
 
211
217
  @keyframes spin {
212
- to { transform: rotate(360deg); }
218
+ to {
219
+ transform: rotate(360deg);
220
+ }
213
221
  }
214
222
  `;
215
- function m(r) {
216
- return !r || r.trim() === "";
217
- }
218
- function he(r, v) {
219
- const c = {};
220
- return m(r.firstName) && (c.firstName = "Please enter your first name"), m(r.lastName) && (c.lastName = "Please enter your last name"), m(r.country) && (c.country = "Please select your country"), m(r.address1) && (c.address1 = "Please enter your address"), m(r.city) && (c.city = "Please enter your city"), m(r.postal) && (c.postal = "Please enter your postal code"), q(r.country).stateRequired && m(r.state) && (c.state = "Please select your state / province"), v && !m(r.phoneNumber) && r.phoneNumber.trim().length < 5 && (c.phoneNumber = "Please enter a valid phone number"), c;
223
+ function ge(r) {
224
+ const m = {};
225
+ for (const x of r)
226
+ m[x.field] || (m[x.field] = x.message);
227
+ return m;
221
228
  }
222
- function me(r) {
229
+ function ve(r) {
223
230
  return {
224
231
  firstName: (r == null ? void 0 : r.firstName) ?? "",
225
232
  lastName: (r == null ? void 0 : r.lastName) ?? "",
@@ -233,83 +240,63 @@ function me(r) {
233
240
  defaultAddress: (r == null ? void 0 : r.defaultAddress) ?? !1
234
241
  };
235
242
  }
236
- const ve = ({
243
+ const Te = ({
237
244
  mode: r,
238
- initialValues: v,
239
- countryWhitelist: c,
240
- showPhoneNumber: I = !1,
245
+ initialValues: m,
246
+ countryWhitelist: x,
247
+ showPhoneNumber: F = !1,
241
248
  screenReaderErrorPrefix: f,
242
- addressLabel: z,
249
+ addressLabel: A,
243
250
  isLoading: P = !1,
244
- disabled: O = !1,
245
- serverErrors: k = [],
246
- onCancel: j,
247
- onSubmit: _
251
+ disabled: j = !1,
252
+ serverErrors: E = [],
253
+ onCancel: G,
254
+ onSubmit: H
248
255
  }) => {
249
- var R;
250
- const [d, T] = S(() => me(v)), [M, F] = S({}), [L, A] = S(""), G = X(null), b = q(d.country), H = ee(d.country), K = b.stateCodes.length > 0 || b.stateRequired, U = c ? E.filter((t) => c.includes(t.code)) : E;
251
- Z(() => {
252
- if (k.length === 0) return;
256
+ var _;
257
+ const [d, D] = z(() => ve(m)), [K, I] = z({}), [W, R] = z(""), U = V(null), h = q(d.country), Y = oe(d.country), J = h.stateCodes.length > 0 || h.stateRequired, Q = x ? L.filter((t) => x.includes(t.code)) : L;
258
+ ee(() => {
259
+ if (E.length === 0) return;
253
260
  const t = {};
254
- let l = "";
255
- k.forEach((i) => {
256
- i.field ? t[i.field] = i.message : l = i.message;
257
- }), F((i) => ({ ...i, ...t })), A(l);
258
- }, [k]);
259
- const Y = w(
260
- (t) => {
261
- const l = t.target.value;
262
- T((i) => ({ ...i, country: l, state: "" })), F((i) => {
263
- const { country: p, state: C, ...B } = i;
264
- return B;
265
- });
266
- },
267
- []
268
- ), y = w(
269
- (t) => (l) => {
270
- const i = l.target.type === "checkbox" ? l.target.checked : l.target.value;
271
- T((p) => ({ ...p, [t]: i })), F((p) => {
272
- const { [t]: C, ...B } = p;
261
+ let n = "";
262
+ E.forEach((i) => {
263
+ i.field ? t[i.field] = i.message : n = i.message;
264
+ }), I((i) => ({ ...i, ...t })), R(n);
265
+ }, [E]);
266
+ const X = T((t) => {
267
+ const n = t.target.value;
268
+ D((i) => ({ ...i, country: n, state: "" })), I((i) => {
269
+ const { country: l, state: v, ...B } = i;
270
+ return B;
271
+ });
272
+ }, []), b = T(
273
+ (t) => (n) => {
274
+ const i = n.target.type === "checkbox" ? n.target.checked : n.target.value;
275
+ D((l) => ({ ...l, [t]: i })), I((l) => {
276
+ const { [t]: v, ...B } = l;
273
277
  return B;
274
278
  });
275
279
  },
276
280
  []
277
- ), $ = w(
281
+ ), y = T(
278
282
  (t) => () => {
279
- const l = d[t];
280
- if (typeof l == "string") {
281
- const i = q(d.country);
282
- let p = "";
283
- (t === "firstName" || t === "lastName" || t === "country" || t === "address1" || t === "city" || t === "postal") && m(l) ? p = `Please enter your ${{
284
- firstName: "first name",
285
- lastName: "last name",
286
- country: "country",
287
- address1: "address",
288
- city: "city",
289
- postal: "postal code"
290
- }[t] ?? t}` : t === "state" && i.stateRequired && m(l) && (p = "Please select your state / province"), F((B) => {
291
- if (p) return { ...B, [t]: p };
292
- const { [t]: fe, ...Q } = B;
293
- return Q;
294
- });
295
- }
283
+ const n = d[t];
284
+ if (typeof n != "string") return;
285
+ const i = q(d.country);
286
+ let l = null;
287
+ t === "firstName" ? l = S("firstName", n, C.firstName) : t === "lastName" ? l = S("lastName", n, C.lastName) : t === "address1" ? l = S("address1", n, C.address1) : t === "address2" && n !== "" ? l = S("address2", n, C.address2) : t === "city" ? l = S("city", n, C.city) : t === "postal" && n !== "" ? l = te(n, C.postal, i) : t === "state" ? l = ae(n || void 0, i) : t === "phoneNumber" && n !== "" && F ? l = de(n, i) : t === "country" && n === "" && (l = { message: "Please select your country" }), I((v) => {
288
+ if (l) return { ...v, [t]: l.message };
289
+ const { [t]: B, ...k } = v;
290
+ return k;
291
+ });
296
292
  },
297
- [d]
298
- ), J = (t) => {
299
- t.preventDefault(), A("");
300
- const l = he(d, I);
301
- if (Object.keys(l).length > 0) {
302
- F(l);
303
- const p = Object.keys(l)[0];
304
- if (p) {
305
- const C = document.getElementById(`field-${p}`);
306
- C && (C.focus(), G.current = C);
307
- }
308
- return;
309
- }
310
- const i = {
293
+ [d, F]
294
+ ), Z = (t) => {
295
+ var v;
296
+ t.preventDefault(), R("");
297
+ const n = {
311
298
  mode: r,
312
- ...r === "edit" && (v == null ? void 0 : v.addressId) !== void 0 ? { addressId: v.addressId } : {},
299
+ ...r === "edit" && (m == null ? void 0 : m.addressId) !== void 0 ? { addressId: m.addressId } : {},
313
300
  defaultAddress: d.defaultAddress,
314
301
  firstName: d.firstName.trim(),
315
302
  lastName: d.lastName.trim(),
@@ -319,29 +306,39 @@ const ve = ({
319
306
  postal: d.postal.trim(),
320
307
  country: d.country,
321
308
  ...d.state ? { state: d.state } : {},
322
- ...I && d.phoneNumber ? { phoneNumber: d.phoneNumber.trim() } : {}
323
- };
324
- _(i);
325
- }, u = O || P, o = (t) => M[t] ?? "";
326
- return /* @__PURE__ */ s(re, { onSubmit: J, noValidate: !0, "aria-label": z, children: [
327
- /* @__PURE__ */ a(oe, { children: z }),
328
- L && /* @__PURE__ */ s(ue, { role: "alert", children: [
309
+ ...F && d.phoneNumber ? { phoneNumber: d.phoneNumber.trim() } : {}
310
+ }, i = q(d.country), l = se(n, i, { showPhoneNumber: F });
311
+ if (!l.valid) {
312
+ const B = ge(l.errors);
313
+ I(B);
314
+ const k = (v = l.errors[0]) == null ? void 0 : v.field;
315
+ if (k) {
316
+ const w = document.getElementById(`field-${k}`);
317
+ w && (w.focus(), U.current = w);
318
+ }
319
+ return;
320
+ }
321
+ H(n);
322
+ }, u = j || P, o = (t) => K[t] ?? "";
323
+ return /* @__PURE__ */ s(ne, { onSubmit: Z, noValidate: !0, "aria-label": A, children: [
324
+ /* @__PURE__ */ a(le, { children: A }),
325
+ W && /* @__PURE__ */ s(ye, { role: "alert", children: [
329
326
  f,
330
327
  " ",
331
- L
328
+ W
332
329
  ] }),
333
- /* @__PURE__ */ s(W, { children: [
334
- /* @__PURE__ */ s(h, { children: [
335
- /* @__PURE__ */ a(g, { htmlFor: "field-firstName", $required: !0, children: "First Name" }),
330
+ /* @__PURE__ */ s(M, { children: [
331
+ /* @__PURE__ */ s(p, { children: [
332
+ /* @__PURE__ */ a($, { htmlFor: "field-firstName", $required: !0, children: "First Name" }),
336
333
  /* @__PURE__ */ a(
337
- x,
334
+ N,
338
335
  {
339
336
  id: "field-firstName",
340
337
  type: "text",
341
338
  autoComplete: "given-name",
342
339
  value: d.firstName,
343
- onChange: y("firstName"),
344
- onBlur: $("firstName"),
340
+ onChange: b("firstName"),
341
+ onBlur: y("firstName"),
345
342
  maxLength: 30,
346
343
  disabled: u,
347
344
  $hasError: !!o("firstName"),
@@ -350,24 +347,24 @@ const ve = ({
350
347
  "aria-describedby": o("firstName") ? "err-firstName" : void 0
351
348
  }
352
349
  ),
353
- o("firstName") && /* @__PURE__ */ s(N, { id: "err-firstName", role: "alert", children: [
350
+ o("firstName") && /* @__PURE__ */ s(g, { id: "err-firstName", role: "alert", children: [
354
351
  /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
355
352
  f,
356
353
  " ",
357
354
  o("firstName")
358
355
  ] })
359
356
  ] }),
360
- /* @__PURE__ */ s(h, { children: [
361
- /* @__PURE__ */ a(g, { htmlFor: "field-lastName", $required: !0, children: "Last Name" }),
357
+ /* @__PURE__ */ s(p, { children: [
358
+ /* @__PURE__ */ a($, { htmlFor: "field-lastName", $required: !0, children: "Last Name" }),
362
359
  /* @__PURE__ */ a(
363
- x,
360
+ N,
364
361
  {
365
362
  id: "field-lastName",
366
363
  type: "text",
367
364
  autoComplete: "family-name",
368
365
  value: d.lastName,
369
- onChange: y("lastName"),
370
- onBlur: $("lastName"),
366
+ onChange: b("lastName"),
367
+ onBlur: y("lastName"),
371
368
  maxLength: 40,
372
369
  disabled: u,
373
370
  $hasError: !!o("lastName"),
@@ -376,7 +373,7 @@ const ve = ({
376
373
  "aria-describedby": o("lastName") ? "err-lastName" : void 0
377
374
  }
378
375
  ),
379
- o("lastName") && /* @__PURE__ */ s(N, { id: "err-lastName", role: "alert", children: [
376
+ o("lastName") && /* @__PURE__ */ s(g, { id: "err-lastName", role: "alert", children: [
380
377
  /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
381
378
  f,
382
379
  " ",
@@ -384,15 +381,15 @@ const ve = ({
384
381
  ] })
385
382
  ] })
386
383
  ] }),
387
- /* @__PURE__ */ s(h, { children: [
388
- /* @__PURE__ */ a(g, { htmlFor: "field-country", $required: !0, children: "Country" }),
384
+ /* @__PURE__ */ s(p, { children: [
385
+ /* @__PURE__ */ a($, { htmlFor: "field-country", $required: !0, children: "Country" }),
389
386
  /* @__PURE__ */ s(
390
- D,
387
+ O,
391
388
  {
392
389
  id: "field-country",
393
390
  value: d.country,
394
- onChange: Y,
395
- onBlur: $("country"),
391
+ onChange: X,
392
+ onBlur: y("country"),
396
393
  disabled: u,
397
394
  $hasError: !!o("country"),
398
395
  "aria-required": "true",
@@ -401,7 +398,7 @@ const ve = ({
401
398
  autoComplete: "country",
402
399
  children: [
403
400
  /* @__PURE__ */ a("option", { value: "", children: "Please select" }),
404
- U.map((t) => /* @__PURE__ */ s("option", { value: t.code, children: [
401
+ Q.map((t) => /* @__PURE__ */ s("option", { value: t.code, children: [
405
402
  t.flag,
406
403
  " ",
407
404
  t.name
@@ -409,24 +406,24 @@ const ve = ({
409
406
  ]
410
407
  }
411
408
  ),
412
- o("country") && /* @__PURE__ */ s(N, { id: "err-country", role: "alert", children: [
409
+ o("country") && /* @__PURE__ */ s(g, { id: "err-country", role: "alert", children: [
413
410
  /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
414
411
  f,
415
412
  " ",
416
413
  o("country")
417
414
  ] })
418
415
  ] }),
419
- /* @__PURE__ */ s(h, { children: [
420
- /* @__PURE__ */ a(g, { htmlFor: "field-address1", $required: !0, children: "Address Line 1" }),
416
+ /* @__PURE__ */ s(p, { children: [
417
+ /* @__PURE__ */ a($, { htmlFor: "field-address1", $required: !0, children: "Address Line 1" }),
421
418
  /* @__PURE__ */ a(
422
- x,
419
+ N,
423
420
  {
424
421
  id: "field-address1",
425
422
  type: "text",
426
423
  autoComplete: "address-line1",
427
424
  value: d.address1,
428
- onChange: y("address1"),
429
- onBlur: $("address1"),
425
+ onChange: b("address1"),
426
+ onBlur: y("address1"),
430
427
  maxLength: 50,
431
428
  disabled: u,
432
429
  $hasError: !!o("address1"),
@@ -435,42 +432,42 @@ const ve = ({
435
432
  "aria-describedby": o("address1") ? "err-address1" : void 0
436
433
  }
437
434
  ),
438
- o("address1") && /* @__PURE__ */ s(N, { id: "err-address1", role: "alert", children: [
435
+ o("address1") && /* @__PURE__ */ s(g, { id: "err-address1", role: "alert", children: [
439
436
  /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
440
437
  f,
441
438
  " ",
442
439
  o("address1")
443
440
  ] })
444
441
  ] }),
445
- /* @__PURE__ */ s(h, { children: [
446
- /* @__PURE__ */ a(g, { htmlFor: "field-address2", children: "Address Line 2 (Optional)" }),
442
+ /* @__PURE__ */ s(p, { children: [
443
+ /* @__PURE__ */ a($, { htmlFor: "field-address2", children: "Address Line 2 (Optional)" }),
447
444
  /* @__PURE__ */ a(
448
- x,
445
+ N,
449
446
  {
450
447
  id: "field-address2",
451
448
  type: "text",
452
449
  autoComplete: "address-line2",
453
450
  value: d.address2,
454
- onChange: y("address2"),
455
- onBlur: $("address2"),
451
+ onChange: b("address2"),
452
+ onBlur: y("address2"),
456
453
  maxLength: 50,
457
454
  disabled: u,
458
455
  $hasError: !1
459
456
  }
460
457
  )
461
458
  ] }),
462
- /* @__PURE__ */ s(W, { children: [
463
- /* @__PURE__ */ s(h, { children: [
464
- /* @__PURE__ */ a(g, { htmlFor: "field-city", $required: !0, children: "City" }),
459
+ /* @__PURE__ */ s(M, { children: [
460
+ /* @__PURE__ */ s(p, { children: [
461
+ /* @__PURE__ */ a($, { htmlFor: "field-city", $required: !0, children: "City" }),
465
462
  /* @__PURE__ */ a(
466
- x,
463
+ N,
467
464
  {
468
465
  id: "field-city",
469
466
  type: "text",
470
467
  autoComplete: "address-level2",
471
468
  value: d.city,
472
- onChange: y("city"),
473
- onBlur: $("city"),
469
+ onChange: b("city"),
470
+ onBlur: y("city"),
474
471
  maxLength: 30,
475
472
  disabled: u,
476
473
  $hasError: !!o("city"),
@@ -479,26 +476,26 @@ const ve = ({
479
476
  "aria-describedby": o("city") ? "err-city" : void 0
480
477
  }
481
478
  ),
482
- o("city") && /* @__PURE__ */ s(N, { id: "err-city", role: "alert", children: [
479
+ o("city") && /* @__PURE__ */ s(g, { id: "err-city", role: "alert", children: [
483
480
  /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
484
481
  f,
485
482
  " ",
486
483
  o("city")
487
484
  ] })
488
485
  ] }),
489
- /* @__PURE__ */ s(h, { children: [
490
- /* @__PURE__ */ a(g, { htmlFor: "field-postal", $required: !0, children: "Postal Code" }),
486
+ /* @__PURE__ */ s(p, { children: [
487
+ /* @__PURE__ */ a($, { htmlFor: "field-postal", $required: !0, children: "Postal Code" }),
491
488
  /* @__PURE__ */ a(
492
- x,
489
+ N,
493
490
  {
494
491
  id: "field-postal",
495
492
  type: "text",
496
493
  autoComplete: "postal-code",
497
- inputMode: b.postalInputMode,
498
- placeholder: b.postalExamples,
494
+ inputMode: h.postalInputMode,
495
+ placeholder: h.postalExamples,
499
496
  value: d.postal,
500
- onChange: y("postal"),
501
- onBlur: $("postal"),
497
+ onChange: b("postal"),
498
+ onBlur: y("postal"),
502
499
  maxLength: 10,
503
500
  disabled: u,
504
501
  $hasError: !!o("postal"),
@@ -507,7 +504,7 @@ const ve = ({
507
504
  "aria-describedby": o("postal") ? "err-postal" : void 0
508
505
  }
509
506
  ),
510
- o("postal") && /* @__PURE__ */ s(N, { id: "err-postal", role: "alert", children: [
507
+ o("postal") && /* @__PURE__ */ s(g, { id: "err-postal", role: "alert", children: [
511
508
  /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
512
509
  f,
513
510
  " ",
@@ -515,58 +512,51 @@ const ve = ({
515
512
  ] })
516
513
  ] })
517
514
  ] }),
518
- K && /* @__PURE__ */ s(h, { children: [
519
- /* @__PURE__ */ a(
520
- g,
521
- {
522
- htmlFor: "field-state",
523
- $required: b.stateRequired,
524
- children: "State / Province"
525
- }
526
- ),
515
+ J && /* @__PURE__ */ s(p, { children: [
516
+ /* @__PURE__ */ a($, { htmlFor: "field-state", $required: h.stateRequired, children: "State / Province" }),
527
517
  /* @__PURE__ */ s(
528
- D,
518
+ O,
529
519
  {
530
520
  id: "field-state",
531
521
  value: d.state,
532
- onChange: y("state"),
533
- onBlur: $("state"),
522
+ onChange: b("state"),
523
+ onBlur: y("state"),
534
524
  disabled: u,
535
525
  $hasError: !!o("state"),
536
- "aria-required": b.stateRequired,
526
+ "aria-required": h.stateRequired,
537
527
  "aria-invalid": !!o("state"),
538
528
  "aria-describedby": o("state") ? "err-state" : void 0,
539
529
  autoComplete: "address-level1",
540
530
  children: [
541
531
  /* @__PURE__ */ a("option", { value: "", children: "Please select" }),
542
- H.map((t) => /* @__PURE__ */ a("option", { value: t.code, children: t.name }, t.code))
532
+ Y.map((t) => /* @__PURE__ */ a("option", { value: t.code, children: t.name }, t.code))
543
533
  ]
544
534
  }
545
535
  ),
546
- o("state") && /* @__PURE__ */ s(N, { id: "err-state", role: "alert", children: [
536
+ o("state") && /* @__PURE__ */ s(g, { id: "err-state", role: "alert", children: [
547
537
  /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
548
538
  f,
549
539
  " ",
550
540
  o("state")
551
541
  ] })
552
542
  ] }),
553
- I && /* @__PURE__ */ s(h, { children: [
554
- /* @__PURE__ */ a(g, { htmlFor: "field-phoneNumber", children: "Phone Number" }),
555
- /* @__PURE__ */ s(ie, { children: [
556
- b.dialCode && /* @__PURE__ */ s(ce, { "aria-label": `Dial code ${b.dialCode}`, children: [
557
- ((R = E.find((t) => t.code === d.country)) == null ? void 0 : R.flag) ?? "",
543
+ F && /* @__PURE__ */ s(p, { children: [
544
+ /* @__PURE__ */ a($, { htmlFor: "field-phoneNumber", children: "Phone Number" }),
545
+ /* @__PURE__ */ s(he, { children: [
546
+ h.dialCode && /* @__PURE__ */ s(be, { "aria-label": `Dial code ${h.dialCode}`, children: [
547
+ ((_ = L.find((t) => t.code === d.country)) == null ? void 0 : _.flag) ?? "",
558
548
  " ",
559
- b.dialCode
549
+ h.dialCode
560
550
  ] }),
561
551
  /* @__PURE__ */ a(
562
- x,
552
+ N,
563
553
  {
564
554
  id: "field-phoneNumber",
565
555
  type: "tel",
566
556
  autoComplete: "tel",
567
557
  value: d.phoneNumber,
568
- onChange: y("phoneNumber"),
569
- onBlur: $("phoneNumber"),
558
+ onChange: b("phoneNumber"),
559
+ onBlur: y("phoneNumber"),
570
560
  maxLength: 20,
571
561
  disabled: u,
572
562
  $hasError: !!o("phoneNumber"),
@@ -575,43 +565,35 @@ const ve = ({
575
565
  }
576
566
  )
577
567
  ] }),
578
- o("phoneNumber") && /* @__PURE__ */ s(N, { id: "err-phoneNumber", role: "alert", children: [
568
+ o("phoneNumber") && /* @__PURE__ */ s(g, { id: "err-phoneNumber", role: "alert", children: [
579
569
  /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
580
570
  f,
581
571
  " ",
582
572
  o("phoneNumber")
583
573
  ] })
584
574
  ] }),
585
- /* @__PURE__ */ a(h, { children: /* @__PURE__ */ s(te, { children: [
575
+ /* @__PURE__ */ a(p, { children: /* @__PURE__ */ s(ie, { children: [
586
576
  /* @__PURE__ */ a(
587
- ae,
577
+ ce,
588
578
  {
589
579
  id: "field-defaultAddress",
590
580
  type: "checkbox",
591
581
  checked: d.defaultAddress,
592
- onChange: y("defaultAddress"),
582
+ onChange: b("defaultAddress"),
593
583
  disabled: u
594
584
  }
595
585
  ),
596
- /* @__PURE__ */ a(de, { htmlFor: "field-defaultAddress", children: "Make this my default address." })
586
+ /* @__PURE__ */ a(ue, { htmlFor: "field-defaultAddress", children: "Make this my default address." })
597
587
  ] }) }),
598
- /* @__PURE__ */ s(se, { children: [
599
- /* @__PURE__ */ a(
600
- ne,
601
- {
602
- type: "button",
603
- disabled: u,
604
- onClick: j,
605
- children: "Cancel"
606
- }
607
- ),
608
- /* @__PURE__ */ s(le, { type: "submit", disabled: u, children: [
609
- P && /* @__PURE__ */ a(pe, { "aria-hidden": "true" }),
588
+ /* @__PURE__ */ s(pe, { children: [
589
+ /* @__PURE__ */ a(me, { type: "button", disabled: u, onClick: G, children: "Cancel" }),
590
+ /* @__PURE__ */ s(fe, { type: "submit", disabled: u, children: [
591
+ P && /* @__PURE__ */ a($e, { "aria-hidden": "true" }),
610
592
  "Confirm Address"
611
593
  ] })
612
594
  ] })
613
595
  ] });
614
596
  };
615
597
  export {
616
- ve as AddressForm
598
+ Te as AddressForm
617
599
  };