@incodetech/web 0.0.0-dev-20260515-ec7243b → 0.0.0-dev-20260515-a07df20

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/base.css CHANGED
@@ -65,6 +65,7 @@
65
65
  margin: 0;
66
66
  padding: 0;
67
67
  position: relative;
68
+ overflow-y: auto;
68
69
  }
69
70
  .IncodeComponent *, .IncodeComponent :after, .IncodeComponent :before, .IncodeComponent ::backdrop {
70
71
  box-sizing: border-box;
@@ -1650,11 +1651,7 @@
1650
1651
  border-color: var(--color-dropdown-border-focused, var(--dropdown-border-focused));
1651
1652
  background-color: var(--color-dropdown-surface-focused, var(--dropdown-surface-focused));
1652
1653
  }
1653
- .IncodeDropdownComposedTrigger[data-error="true"] {
1654
- border-color: var(--color-dropdown-border-negative, var(--dropdown-border-negative));
1655
- background-color: var(--color-dropdown-surface-negative, var(--dropdown-surface-negative));
1656
- }
1657
- .IncodeDropdownComposedTrigger[data-error="true"][data-focused="true"] {
1654
+ .IncodeDropdownComposedTrigger[data-error="true"], .IncodeDropdownComposedTrigger[data-error="true"][data-focused="true"] {
1658
1655
  border-style: var(--tw-border-style);
1659
1656
  border-width: 2px;
1660
1657
  border-color: var(--color-dropdown-border-negative, var(--dropdown-border-negative));
@@ -4027,7 +4024,6 @@
4027
4024
  flex-direction: column;
4028
4025
  flex: 1;
4029
4026
  display: flex;
4030
- overflow-y: auto;
4031
4027
  }
4032
4028
  @media (min-width: 48rem) {
4033
4029
  .IncodePageContainer .IncodePageInner {
@@ -18,8 +18,8 @@ import { n as g, t as _ } from "../requiredLabelHint-BLwgqozE.js";
18
18
  import { t as v } from "../autoFocusTitle-QexamZ4i.js";
19
19
  import { GENERATE_CURP_FIELDS as y, createCurpValidationManager as b, mexicanStates as x } from "@incodetech/core/curp-validation";
20
20
  //#region src/modules/curp-validation/curpInput.tsx
21
- var S = ({ curp: t, isValid: n, onCurpChange: i, onVerify: a, onSwitchToGenerate: s, disabled: c = !1, placeholder: u, continueLabel: d, dontHaveLabel: p }) => {
22
- let { t: m } = e(), h = u ?? m("curp.placeholder.curp") ?? "CURP", g = d ?? m("curp.continue") ?? "Continue", _ = p ?? m("curp.dontHave") ?? "I don't have my CURP";
21
+ var S = ({ curp: t, errorKey: n, onCurpChange: i, onCurpBlur: a, onVerify: s, onSwitchToGenerate: c, disabled: u = !1, placeholder: d, continueLabel: p, dontHaveLabel: m }) => {
22
+ let { t: h } = e(), g = d ?? h("curp.placeholder.curp") ?? "CURP", _ = p ?? h("curp.continue") ?? "Continue", v = m ?? h("curp.dontHave") ?? "I don't have my CURP", y = n ? h(n) : void 0, b = t.length === 0 || !!y || u;
23
23
  return /* @__PURE__ */ r("div", {
24
24
  class: "IncodeCurpValidation IncodeCurpInput",
25
25
  children: [
@@ -30,146 +30,141 @@ var S = ({ curp: t, isValid: n, onCurpChange: i, onVerify: a, onSwitchToGenerate
30
30
  let t = e.target;
31
31
  i(t.value.toUpperCase());
32
32
  },
33
- placeholder: h,
34
- disabled: c,
33
+ onBlur: a,
34
+ placeholder: g,
35
+ disabled: u,
35
36
  required: !0,
36
37
  maxLength: 18,
37
- "aria-label": m("curp.placeholder.curp") ?? "CURP"
38
+ "aria-label": h("curp.placeholder.curp") ?? "CURP",
39
+ error: y,
40
+ showErrorIcon: !!y
38
41
  }),
39
42
  /* @__PURE__ */ r(o, {}),
40
43
  /* @__PURE__ */ r(l, {
41
44
  type: "button",
42
- onClick: a,
43
- disabled: !n || c,
45
+ onClick: s,
46
+ disabled: b,
44
47
  "data-testid": "curp-verify",
45
- children: g
48
+ children: _
46
49
  }),
47
50
  /* @__PURE__ */ r(l, {
48
51
  type: "button",
49
52
  variant: "secondary",
50
- onClick: s,
51
- disabled: c,
53
+ onClick: c,
54
+ disabled: u,
52
55
  "data-testid": "curp-switch-to-generate",
53
- children: _
56
+ children: v
54
57
  })
55
58
  ]
56
59
  });
57
- }, C = ({ form: t, isValid: i, onFormChange: a, onGenerate: s, disabled: c = !1, labels: u }) => {
58
- let { t: d } = e(), h = {
59
- firstName: d("curp.labels.firstName") ?? "Your First name",
60
- firstLast: d("curp.labels.firstLast") ?? "Your First last name",
61
- secondLast: d("curp.labels.secondLast") ?? "Your Second last name",
62
- gender: d("curp.labels.genderV2") ?? "Gender",
63
- genderPlaceholder: d("curp.placeholder.gender") ?? "Choose gender",
64
- male: d("curp.labels.maleV2") ?? "Male",
65
- female: d("curp.labels.femaleV2") ?? "Female",
66
- other: d("curp.labels.other") ?? "Other",
67
- dob: d("curp.labels.dob") ?? "Date of birth",
68
- birthState: d("curp.labels.birthState") ?? "State of birth",
69
- statePlaceholder: d("curp.placeholder.state") ?? "Select state",
70
- generate: d("curp.generateCta") ?? "Generate CURP",
71
- ...u
72
- }, v = n(() => g(y.map((e) => e.required)), []), b = n(() => Object.fromEntries(y.map((e) => [e.key, e.required])), []), S = (e) => {
73
- let t = _(v, b[e]);
74
- return t ? d(`forms.label.${t}`) : void 0;
75
- }, C = (e) => (t) => {
60
+ }, C = ({ form: t, validationErrors: i, onFormChange: a, onValidateField: s, onGenerate: c, disabled: u = !1, labels: d }) => {
61
+ let { t: h } = e(), v = {
62
+ firstName: h("curp.labels.firstName") ?? "Your First name",
63
+ firstLast: h("curp.labels.firstLast") ?? "Your First last name",
64
+ secondLast: h("curp.labels.secondLast") ?? "Your Second last name",
65
+ gender: h("curp.labels.genderV2") ?? "Gender",
66
+ genderPlaceholder: h("curp.placeholder.gender") ?? "Choose gender",
67
+ male: h("curp.labels.maleV2") ?? "Male",
68
+ female: h("curp.labels.femaleV2") ?? "Female",
69
+ other: h("curp.labels.other") ?? "Other",
70
+ dob: h("curp.labels.dob") ?? "Date of birth",
71
+ birthState: h("curp.labels.birthState") ?? "State of birth",
72
+ statePlaceholder: h("curp.placeholder.state") ?? "Select state",
73
+ generate: h("curp.generateCta") ?? "Generate CURP",
74
+ ...d
75
+ }, b = n(() => g(y.map((e) => e.required)), []), S = !!i && Object.keys(i).length > 0, C = (e) => (t) => {
76
76
  let n = t.target;
77
77
  a({ [e]: n.value });
78
- }, w = [
78
+ }, w = (e) => () => {
79
+ s(e);
80
+ }, T = [
79
81
  {
80
82
  value: "H",
81
- label: h.male
83
+ label: v.male
82
84
  },
83
85
  {
84
86
  value: "M",
85
- label: h.female
87
+ label: v.female
86
88
  },
87
89
  {
88
90
  value: "X",
89
- label: h.other
91
+ label: v.other
90
92
  }
91
- ], T = x.map((e) => ({
93
+ ], E = x.map((e) => ({
92
94
  value: e.value,
93
95
  label: e.label
94
- }));
96
+ })), D = (e) => {
97
+ switch (e) {
98
+ case "name": return v.firstName;
99
+ case "firstLastName": return v.firstLast;
100
+ case "secondLastName": return v.secondLast;
101
+ case "gender": return v.gender;
102
+ case "birthDate": return v.dob;
103
+ case "birthState": return v.birthState;
104
+ }
105
+ };
95
106
  return /* @__PURE__ */ r("div", {
96
107
  class: "IncodeCurpValidation IncodeGenerateCurpForm",
97
108
  children: [
98
- /* @__PURE__ */ r(f, {
99
- id: "curp-first-name",
100
- label: h.firstName,
101
- labelHint: S("name"),
102
- value: t.name,
103
- onInput: C("name"),
104
- placeholder: h.firstName,
105
- disabled: c,
106
- required: b.name,
107
- autoComplete: "given-name"
108
- }),
109
- /* @__PURE__ */ r(f, {
110
- id: "curp-first-last",
111
- label: h.firstLast,
112
- labelHint: S("firstLastName"),
113
- value: t.firstLastName,
114
- onInput: C("firstLastName"),
115
- placeholder: h.firstLast,
116
- disabled: c,
117
- required: b.firstLastName
118
- }),
119
- /* @__PURE__ */ r(f, {
120
- id: "curp-second-last",
121
- label: h.secondLast,
122
- labelHint: S("secondLastName"),
123
- value: t.secondLastName,
124
- onInput: C("secondLastName"),
125
- placeholder: h.secondLast,
126
- disabled: c,
127
- required: b.secondLastName
128
- }),
129
- /* @__PURE__ */ r(p, {
130
- id: "curp-gender",
131
- label: h.gender,
132
- labelHint: S("gender"),
133
- placeholder: h.genderPlaceholder,
134
- value: t.gender,
135
- options: w,
136
- disabled: c,
137
- required: b.gender,
138
- onChange: (e) => a({ gender: e }),
139
- "data-testid": "curp-gender"
140
- }),
141
- /* @__PURE__ */ r(m, {
142
- id: "curp-birth-date",
143
- label: h.dob,
144
- labelHint: S("birthDate"),
145
- value: t.birthDate,
146
- onInput: C("birthDate"),
147
- max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
148
- placeholder: d("curp.placeholder.dob") ?? "mm/dd/yyyy",
149
- disabled: c,
150
- required: b.birthDate,
151
- "data-testid": "curp-birth-date"
152
- }),
153
- /* @__PURE__ */ r(p, {
154
- id: "curp-birth-state",
155
- label: h.birthState,
156
- labelHint: S("birthState"),
157
- placeholder: h.statePlaceholder,
158
- value: t.birthState,
159
- options: T,
160
- disabled: c,
161
- required: b.birthState,
162
- onChange: (e) => a({ birthState: e }),
163
- "data-testid": "curp-birth-state",
164
- searchable: !0
109
+ y.map((e) => {
110
+ let n = _(b, e.required), o = n ? h(`forms.label.${n}`) ?? void 0 : void 0, s = i?.[e.key], c = s ? h(s) ?? void 0 : void 0, l = D(e.key);
111
+ if (e.type === "dropdown") {
112
+ let n = e.key === "gender" ? T : E, i = e.key === "gender" ? v.genderPlaceholder : v.statePlaceholder;
113
+ return /* @__PURE__ */ r(p, {
114
+ id: `curp-${e.key === "birthState" ? "birth-state" : "gender"}`,
115
+ label: l,
116
+ labelHint: o,
117
+ placeholder: i,
118
+ value: t[e.key],
119
+ options: n,
120
+ disabled: u,
121
+ required: e.required,
122
+ onChange: (t) => {
123
+ e.key === "gender" ? a({ gender: t }) : a({ [e.key]: t });
124
+ },
125
+ onBlur: w(e.key),
126
+ error: c,
127
+ showErrorIcon: !!c,
128
+ "data-testid": e.key === "gender" ? "curp-gender" : "curp-birth-state",
129
+ ...e.key === "birthState" ? { searchable: !0 } : {}
130
+ }, e.key);
131
+ }
132
+ return e.type === "date" ? /* @__PURE__ */ r(m, {
133
+ id: "curp-birth-date",
134
+ label: l,
135
+ labelHint: o,
136
+ value: t.birthDate,
137
+ onInput: C("birthDate"),
138
+ onBlur: w("birthDate"),
139
+ max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
140
+ placeholder: h("curp.placeholder.dob") ?? "mm/dd/yyyy",
141
+ disabled: u,
142
+ required: e.required,
143
+ error: c,
144
+ showErrorIcon: !!c,
145
+ "data-testid": "curp-birth-date"
146
+ }, e.key) : /* @__PURE__ */ r(f, {
147
+ id: e.key === "name" ? "curp-first-name" : e.key === "firstLastName" ? "curp-first-last" : "curp-second-last",
148
+ label: l,
149
+ labelHint: o,
150
+ value: t[e.key],
151
+ onInput: C(e.key),
152
+ onBlur: w(e.key),
153
+ placeholder: l,
154
+ disabled: u,
155
+ required: e.required,
156
+ error: c,
157
+ showErrorIcon: !!c,
158
+ ...e.autoComplete ? { autoComplete: e.autoComplete } : {}
159
+ }, e.key);
165
160
  }),
166
161
  /* @__PURE__ */ r(o, { size: 16 }),
167
162
  /* @__PURE__ */ r(l, {
168
163
  type: "button",
169
- onClick: s,
170
- disabled: !i || c,
164
+ onClick: c,
165
+ disabled: S || u,
171
166
  "data-testid": "curp-generate",
172
- children: h.generate
167
+ children: v.generate
173
168
  })
174
169
  ]
175
170
  });
@@ -184,8 +179,9 @@ var S = ({ curp: t, isValid: n, onCurpChange: i, onVerify: a, onSwitchToGenerate
184
179
  title: m("curp.enterCurp") ?? "Enter your CURP",
185
180
  children: /* @__PURE__ */ r(S, {
186
181
  curp: h.curp,
187
- isValid: h.isValid,
182
+ errorKey: h.validationErrors?.curp,
188
183
  onCurpChange: (e) => g.setCurp(e),
184
+ onCurpBlur: () => g.validateField("curp"),
189
185
  onVerify: () => g.verify(),
190
186
  onSwitchToGenerate: () => g.switchToGenerate(),
191
187
  placeholder: m("curp.placeholder.curp") ?? "CURP",
@@ -199,8 +195,9 @@ var S = ({ curp: t, isValid: n, onCurpChange: i, onVerify: a, onSwitchToGenerate
199
195
  hideFooterBranding: !0,
200
196
  children: /* @__PURE__ */ r(C, {
201
197
  form: h.form,
202
- isValid: h.isValid,
198
+ validationErrors: h.validationErrors,
203
199
  onFormChange: (e) => g.setGenerateForm(e),
200
+ onValidateField: (e) => g.validateField(e),
204
201
  onGenerate: () => g.generate()
205
202
  })
206
203
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260515-ec7243b",
3
+ "version": "0.0.0-dev-20260515-a07df20",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -239,7 +239,7 @@
239
239
  "qrcode": "^1.5.4",
240
240
  "signature_pad": "^5.1.3",
241
241
  "tailwindcss": "^4.1.17",
242
- "@incodetech/core": "0.0.0-dev-20260515-ec7243b"
242
+ "@incodetech/core": "0.0.0-dev-20260515-a07df20"
243
243
  },
244
244
  "devDependencies": {
245
245
  "@microsoft/api-extractor": "^7.53.3",