@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.
Files changed (73) hide show
  1. package/dist/components/AddressCard/AddressCard.d.ts +5 -0
  2. package/dist/components/AddressCard/AddressCard.js +45 -46
  3. package/dist/components/AddressForm/AddressForm.d.ts +14 -2
  4. package/dist/components/AddressForm/AddressForm.js +216 -212
  5. package/dist/components/AddressList/AddressList.d.ts +7 -2
  6. package/dist/components/AddressList/AddressList.js +41 -37
  7. package/dist/hooks/index.d.ts +10 -0
  8. package/dist/hooks/useAddressForm.d.ts +76 -0
  9. package/dist/hooks/useAddressForm.js +174 -0
  10. package/dist/hooks/useAddressFormRHF.d.ts +8 -0
  11. package/dist/hooks/useAddressFormRHF.js +174 -0
  12. package/dist/i18n/defaultLabels.d.ts +2 -0
  13. package/dist/i18n/defaultLabels.js +66 -0
  14. package/dist/i18n/index.d.ts +14 -0
  15. package/dist/i18n/index.js +45 -0
  16. package/dist/i18n/labelResolver.d.ts +24 -0
  17. package/dist/i18n/labelResolver.js +98 -0
  18. package/dist/i18n/locales/ar-sa.json.d.ts +159 -0
  19. package/dist/i18n/locales/ar-sa.json.js +163 -0
  20. package/dist/i18n/locales/ca-es.json.d.ts +159 -0
  21. package/dist/i18n/locales/ca-es.json.js +163 -0
  22. package/dist/i18n/locales/cs-cz.json.d.ts +159 -0
  23. package/dist/i18n/locales/cs-cz.json.js +163 -0
  24. package/dist/i18n/locales/da-dk.json.d.ts +159 -0
  25. package/dist/i18n/locales/da-dk.json.js +163 -0
  26. package/dist/i18n/locales/de-at.json.d.ts +159 -0
  27. package/dist/i18n/locales/de-at.json.js +163 -0
  28. package/dist/i18n/locales/de-ch.json.d.ts +159 -0
  29. package/dist/i18n/locales/de-ch.json.js +163 -0
  30. package/dist/i18n/locales/de-de.json.d.ts +159 -0
  31. package/dist/i18n/locales/de-de.json.js +163 -0
  32. package/dist/i18n/locales/en-au.json.d.ts +159 -0
  33. package/dist/i18n/locales/en-au.json.js +163 -0
  34. package/dist/i18n/locales/en-ca.json.d.ts +159 -0
  35. package/dist/i18n/locales/en-ca.json.js +163 -0
  36. package/dist/i18n/locales/en-gb.json.d.ts +159 -0
  37. package/dist/i18n/locales/en-gb.json.js +163 -0
  38. package/dist/i18n/locales/en-nz.json.d.ts +159 -0
  39. package/dist/i18n/locales/en-nz.json.js +163 -0
  40. package/dist/i18n/locales/en-us.json.d.ts +159 -0
  41. package/dist/i18n/locales/en-us.json.js +163 -0
  42. package/dist/i18n/locales/es-es.json.d.ts +159 -0
  43. package/dist/i18n/locales/es-es.json.js +163 -0
  44. package/dist/i18n/locales/es-mx.json.d.ts +159 -0
  45. package/dist/i18n/locales/es-mx.json.js +163 -0
  46. package/dist/i18n/locales/fi-fi.json.d.ts +159 -0
  47. package/dist/i18n/locales/fi-fi.json.js +163 -0
  48. package/dist/i18n/locales/fr-be.json.d.ts +159 -0
  49. package/dist/i18n/locales/fr-be.json.js +163 -0
  50. package/dist/i18n/locales/fr-ca.json.d.ts +159 -0
  51. package/dist/i18n/locales/fr-ca.json.js +163 -0
  52. package/dist/i18n/locales/fr-ch.json.d.ts +159 -0
  53. package/dist/i18n/locales/fr-ch.json.js +163 -0
  54. package/dist/i18n/locales/fr-fr.json.d.ts +159 -0
  55. package/dist/i18n/locales/fr-fr.json.js +163 -0
  56. package/dist/i18n/locales/it-ch.json.d.ts +159 -0
  57. package/dist/i18n/locales/it-ch.json.js +163 -0
  58. package/dist/i18n/locales/ja-jp.json.d.ts +159 -0
  59. package/dist/i18n/locales/ja-jp.json.js +163 -0
  60. package/dist/i18n/locales/nl-be.json.d.ts +159 -0
  61. package/dist/i18n/locales/nl-be.json.js +163 -0
  62. package/dist/i18n/locales/nl-nl.json.d.ts +159 -0
  63. package/dist/i18n/locales/nl-nl.json.js +163 -0
  64. package/dist/i18n/locales/no-no.json.d.ts +159 -0
  65. package/dist/i18n/locales/no-no.json.js +163 -0
  66. package/dist/i18n/locales/pl-pl.json.d.ts +159 -0
  67. package/dist/i18n/locales/pl-pl.json.js +163 -0
  68. package/dist/i18n/locales/sv-se.json.d.ts +159 -0
  69. package/dist/i18n/locales/sv-se.json.js +163 -0
  70. package/dist/i18n/types.d.ts +67 -0
  71. package/dist/index.d.ts +4 -0
  72. package/dist/index.js +50 -38
  73. package/package.json +2 -1
@@ -1,34 +1,36 @@
1
- import { jsxs as s, jsx as a } from "react/jsx-runtime";
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 A } from "../../data/countryData.js";
6
- import { FIELD_CONSTRAINTS as x } from "../../validation/constants.js";
7
- import { PhoneField as te } from "../PhoneField/PhoneField.js";
8
- import { validateTextField as S } from "../../validation/validateTextField.js";
9
- import { validatePostalCode as ae } from "../../validation/validatePostalCode.js";
10
- import { validateState as de } from "../../validation/validateState.js";
11
- import { validatePhoneNumber as se } from "../../validation/validatePhoneNumber.js";
12
- import { validateForm as ne } from "../../validation/validateForm.js";
13
- const le = c.form`
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
- `, ie = c.h2`
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
- `, _ = c.div`
24
+ `, H = u.div`
23
25
  display: grid;
24
26
  grid-template-columns: 1fr;
25
27
  gap: ${e.space4};
26
- ${re("grid-template-columns: 1fr 1fr;")}
27
- `, p = c.div`
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
- `, y = c.label`
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
- `, C = c.input`
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 = c.select`
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
- `, v = c.p`
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
- `, ce = c.div`
111
+ `, ye = u.div`
110
112
  display: flex;
111
113
  align-items: center;
112
114
  gap: ${e.space2};
113
- `, ue = c.input`
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
- `, pe = c.label`
124
+ `, ge = u.label`
123
125
  font-size: ${e.fontSizeBody};
124
126
  color: ${e.colorTextPrimary};
125
127
  cursor: pointer;
126
- `, me = c.div`
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
- `, fe = c.button`
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
- `, he = c.button`
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
- `, be = c.div`
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
- `, ye = c.span`
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 $e(r) {
210
- const m = {};
211
- for (const N of r)
212
- m[N.field] || (m[N.field] = N.message);
213
- return m;
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 ge(r) {
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 Te = ({
231
+ const _e = ({
230
232
  mode: r,
231
- initialValues: m,
232
- countryWhitelist: N,
233
- showPhoneNumber: F = !1,
234
- screenReaderErrorPrefix: f,
235
- addressLabel: L,
236
- isLoading: P = !1,
237
- disabled: j = !1,
238
- serverErrors: E = [],
239
- onCancel: G,
240
- onSubmit: H
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 M;
243
- const [d, W] = z(() => ge(m)), [K, I] = z({}), [D, R] = z(""), U = V(null), $ = q(d.country), Y = oe(d.country), J = $.stateCodes.length > 0 || $.stateRequired, Q = N ? A.filter((t) => N.includes(t.code)) : A;
244
- ee(() => {
245
- if (E.length === 0) return;
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
- E.forEach((i) => {
252
+ w.forEach((i) => {
249
253
  i.field ? t[i.field] = i.message : n = i.message;
250
- }), I((i) => ({ ...i, ...t })), R(n);
251
- }, [E]);
252
- const X = T((t) => {
254
+ }), E((i) => ({ ...i, ...t })), M(n);
255
+ }, [w]);
256
+ const te = L((t) => {
253
257
  const n = t.target.value;
254
- W((i) => ({ ...i, country: n, state: "" })), I((i) => {
255
- const { country: l, state: g, ...B } = i;
256
- return B;
258
+ P((i) => ({ ...i, country: n, state: "" })), E((i) => {
259
+ const { country: l, state: v, ...x } = i;
260
+ return x;
257
261
  });
258
- }, []), h = T(
262
+ }, []), b = L(
259
263
  (t) => (n) => {
260
264
  const i = n.target.type === "checkbox" ? n.target.checked : n.target.value;
261
- W((l) => ({ ...l, [t]: i })), I((l) => {
262
- const { [t]: g, ...B } = l;
263
- return B;
265
+ P((l) => ({ ...l, [t]: i })), E((l) => {
266
+ const { [t]: v, ...x } = l;
267
+ return x;
264
268
  });
265
269
  },
266
270
  []
267
- ), b = T(
271
+ ), y = L(
268
272
  (t) => () => {
269
- const n = d[t];
273
+ const n = a[t];
270
274
  if (typeof n != "string") return;
271
- const i = q(d.country);
275
+ const i = D(a.country);
272
276
  let l = null;
273
- t === "firstName" ? l = S("firstName", n, x.firstName) : t === "lastName" ? l = S("lastName", n, x.lastName) : t === "address1" ? l = S("address1", n, x.address1) : t === "address2" && n !== "" ? l = S("address2", n, x.address2) : t === "city" ? l = S("city", n, x.city) : t === "postal" && n !== "" ? l = ae(n, x.postal, i) : t === "state" ? l = de(n || void 0, i) : t === "phoneNumber" && n !== "" && F ? l = se(n, i) : t === "country" && n === "" && (l = { message: "Please select your country" }), I((g) => {
274
- if (l) return { ...g, [t]: l.message };
275
- const { [t]: B, ...k } = g;
276
- return k;
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
- [d, F]
280
- ), Z = (t) => {
281
- var g;
282
- t.preventDefault(), R("");
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" && (m == null ? void 0 : m.addressId) !== void 0 ? { addressId: m.addressId } : {},
286
- defaultAddress: d.defaultAddress,
287
- firstName: d.firstName.trim(),
288
- lastName: d.lastName.trim(),
289
- address1: d.address1.trim(),
290
- ...d.address2.trim() ? { address2: d.address2.trim() } : {},
291
- city: d.city.trim(),
292
- postal: d.postal.trim(),
293
- country: d.country,
294
- ...d.state ? { state: d.state } : {},
295
- ...F && d.phoneNumber ? { phoneNumber: d.phoneNumber.trim() } : {}
296
- }, i = q(d.country), l = ne(n, i, { showPhoneNumber: F });
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 B = $e(l.errors);
299
- I(B);
300
- const k = (g = l.errors[0]) == null ? void 0 : g.field;
301
- if (k) {
302
- const w = document.getElementById(`field-${k}`);
303
- w && (w.focus(), U.current = w);
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
- H(n);
308
- }, u = j || P, o = (t) => K[t] ?? "";
309
- return /* @__PURE__ */ s(le, { onSubmit: Z, noValidate: !0, "aria-label": L, children: [
310
- /* @__PURE__ */ a(ie, { children: L }),
311
- D && /* @__PURE__ */ s(be, { role: "alert", children: [
312
- f,
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
- D
318
+ _
315
319
  ] }),
316
- /* @__PURE__ */ s(_, { children: [
317
- /* @__PURE__ */ s(p, { children: [
318
- /* @__PURE__ */ a(y, { htmlFor: "field-firstName", $required: !0, children: "First Name" }),
319
- /* @__PURE__ */ a(
320
- C,
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: d.firstName,
326
- onChange: h("firstName"),
327
- onBlur: b("firstName"),
329
+ value: a.firstName,
330
+ onChange: b("firstName"),
331
+ onBlur: y("firstName"),
328
332
  maxLength: 30,
329
- disabled: u,
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(v, { id: "err-firstName", role: "alert", children: [
337
- /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
338
- f,
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(p, { children: [
344
- /* @__PURE__ */ a(y, { htmlFor: "field-lastName", $required: !0, children: "Last Name" }),
345
- /* @__PURE__ */ a(
346
- C,
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: d.lastName,
352
- onChange: h("lastName"),
353
- onBlur: b("lastName"),
355
+ value: a.lastName,
356
+ onChange: b("lastName"),
357
+ onBlur: y("lastName"),
354
358
  maxLength: 40,
355
- disabled: u,
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(v, { id: "err-lastName", role: "alert", children: [
363
- /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
364
- f,
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(p, { children: [
371
- /* @__PURE__ */ a(y, { htmlFor: "field-country", $required: !0, children: "Country" }),
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: d.country,
377
- onChange: X,
378
- onBlur: b("country"),
379
- disabled: u,
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__ */ a("option", { value: "", children: "Please select" }),
387
- Q.map((t) => /* @__PURE__ */ s("option", { value: t.code, children: [
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(v, { id: "err-country", role: "alert", children: [
396
- /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
397
- f,
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(p, { children: [
403
- /* @__PURE__ */ a(y, { htmlFor: "field-address1", $required: !0, children: "Address Line 1" }),
404
- /* @__PURE__ */ a(
405
- C,
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: d.address1,
411
- onChange: h("address1"),
412
- onBlur: b("address1"),
414
+ value: a.address1,
415
+ onChange: b("address1"),
416
+ onBlur: y("address1"),
413
417
  maxLength: 50,
414
- disabled: u,
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(v, { id: "err-address1", role: "alert", children: [
422
- /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
423
- f,
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(p, { children: [
429
- /* @__PURE__ */ a(y, { htmlFor: "field-address2", children: "Address Line 2 (Optional)" }),
430
- /* @__PURE__ */ a(
431
- C,
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: d.address2,
437
- onChange: h("address2"),
438
- onBlur: b("address2"),
440
+ value: a.address2,
441
+ onChange: b("address2"),
442
+ onBlur: y("address2"),
439
443
  maxLength: 50,
440
- disabled: u,
444
+ disabled: p,
441
445
  $hasError: !1
442
446
  }
443
447
  )
444
448
  ] }),
445
- /* @__PURE__ */ s(_, { children: [
446
- /* @__PURE__ */ s(p, { children: [
447
- /* @__PURE__ */ a(y, { htmlFor: "field-city", $required: !0, children: "City" }),
448
- /* @__PURE__ */ a(
449
- C,
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: d.city,
455
- onChange: h("city"),
456
- onBlur: b("city"),
458
+ value: a.city,
459
+ onChange: b("city"),
460
+ onBlur: y("city"),
457
461
  maxLength: 30,
458
- disabled: u,
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(v, { id: "err-city", role: "alert", children: [
466
- /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
467
- f,
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(p, { children: [
473
- /* @__PURE__ */ a(y, { htmlFor: "field-postal", $required: !0, children: "Postal Code" }),
474
- /* @__PURE__ */ a(
475
- C,
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: $.postalInputMode,
481
- placeholder: $.postalExamples,
482
- value: d.postal,
483
- onChange: h("postal"),
484
- onBlur: b("postal"),
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: u,
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(v, { id: "err-postal", role: "alert", children: [
494
- /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
495
- f,
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
- J && /* @__PURE__ */ s(p, { children: [
502
- /* @__PURE__ */ a(y, { htmlFor: "field-state", $required: $.stateRequired, children: "State / Province" }),
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: d.state,
508
- onChange: h("state"),
509
- onBlur: b("state"),
510
- disabled: u,
511
+ value: a.state,
512
+ onChange: b("state"),
513
+ onBlur: y("state"),
514
+ disabled: p,
511
515
  $hasError: !!o("state"),
512
- "aria-required": $.stateRequired,
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__ */ a("option", { value: "", children: "Please select" }),
518
- Y.map((t) => /* @__PURE__ */ a("option", { value: t.code, children: t.name }, t.code))
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(v, { id: "err-state", role: "alert", children: [
523
- /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "⚠" }),
524
- f,
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
- F && /* @__PURE__ */ s(p, { children: [
530
- /* @__PURE__ */ a(y, { htmlFor: "field-phoneNumber", children: "Phone Number" }),
531
- /* @__PURE__ */ a(
532
- te,
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: d.phoneNumber,
536
- dialCode: $.dialCode,
537
- flagEmoji: ((M = A.find((t) => t.code === d.country)) == null ? void 0 : M.flag) ?? "",
538
- countryCode: d.country,
539
- onChange: h("phoneNumber"),
540
- onBlur: b("phoneNumber"),
541
- disabled: u,
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: f
548
+ screenReaderErrorPrefix: h
545
549
  }
546
550
  )
547
551
  ] }),
548
- /* @__PURE__ */ a(p, { children: /* @__PURE__ */ s(ce, { children: [
549
- /* @__PURE__ */ a(
550
- ue,
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: d.defaultAddress,
555
- onChange: h("defaultAddress"),
556
- disabled: u
558
+ checked: a.defaultAddress,
559
+ onChange: b("defaultAddress"),
560
+ disabled: p
557
561
  }
558
562
  ),
559
- /* @__PURE__ */ a(pe, { htmlFor: "field-defaultAddress", children: "Make this my default address." })
563
+ /* @__PURE__ */ d(ge, { htmlFor: "field-defaultAddress", children: c.makeDefault })
560
564
  ] }) }),
561
- /* @__PURE__ */ s(me, { children: [
562
- /* @__PURE__ */ a(fe, { type: "button", disabled: u, onClick: G, children: "Cancel" }),
563
- /* @__PURE__ */ s(he, { type: "submit", disabled: u, children: [
564
- P && /* @__PURE__ */ a(ye, { "aria-hidden": "true" }),
565
- "Confirm Address"
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
- Te as AddressForm
575
+ _e as AddressForm
572
576
  };