@mxenabled/connect-widget 0.13.3 → 0.13.5

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/index.es.js CHANGED
@@ -70218,6 +70218,15 @@ const Credentials = React__default.forwardRef(
70218
70218
  formSchema,
70219
70219
  initialValues
70220
70220
  );
70221
+ const inputRefs = useRef({});
70222
+ useEffect(() => {
70223
+ for (const field of credentials) {
70224
+ if (errors[field.field_name]) {
70225
+ inputRefs.current[field.field_name]?.focus();
70226
+ break;
70227
+ }
70228
+ }
70229
+ }, [errors]);
70221
70230
  function attemptConnect() {
70222
70231
  const credentialsPayload = credentials.map((credential) => {
70223
70232
  return {
@@ -70393,7 +70402,11 @@ const Credentials = React__default.forwardRef(
70393
70402
  fullWidth: true,
70394
70403
  helperText: validations.isCapsLockOn && __("Caps lock is on") || validations.validateSpaceMessage || errors[field.field_name],
70395
70404
  id: field.field_name,
70396
- inputProps: { "aria-label": field.label },
70405
+ inputProps: {
70406
+ "aria-label": field.label,
70407
+ "aria-describedby": errors[field.field_name] ? `${field.field_name}-error` : void 0
70408
+ },
70409
+ inputRef: (el) => inputRefs.current[field.field_name] = el,
70397
70410
  label: field.label,
70398
70411
  name: field.field_name,
70399
70412
  onBlur: handleBlur,
@@ -70417,7 +70430,11 @@ const Credentials = React__default.forwardRef(
70417
70430
  fullWidth: true,
70418
70431
  helperText: errors[field.field_name],
70419
70432
  id: field.field_name,
70420
- inputProps: { "aria-label": __("Enter your %1", field.label) },
70433
+ inputProps: {
70434
+ "aria-label": __("Enter your %1", field.label),
70435
+ "aria-describedby": errors[field.field_name] ? `${field.field_name}-error` : void 0
70436
+ },
70437
+ inputRef: (el) => inputRefs.current[field.field_name] = el,
70421
70438
  label: field.label,
70422
70439
  name: field.field_name,
70423
70440
  onChange: handleUserNameTextChange,
@@ -81153,6 +81170,7 @@ const ManualAccountForm = React__default.forwardRef(
81153
81170
  const getNextDelay = getDelay();
81154
81171
  const fields = getFormFields(props.accountType);
81155
81172
  const formRef = ref;
81173
+ const inputRefs = useRef({});
81156
81174
  const {
81157
81175
  handleTextInputChange,
81158
81176
  handleSubmit,
@@ -81226,6 +81244,14 @@ const ManualAccountForm = React__default.forwardRef(
81226
81244
  );
81227
81245
  return () => createManualAccount$.unsubscribe();
81228
81246
  }, [saving]);
81247
+ useEffect(() => {
81248
+ for (const field of fields) {
81249
+ if (errors[field.name]) {
81250
+ inputRefs.current[field.name]?.focus();
81251
+ break;
81252
+ }
81253
+ }
81254
+ }, [errors]);
81229
81255
  const shouldFocus = (field, returnField2, i) => returnField2 ? returnField2 === field : i === 0;
81230
81256
  if (props.showDayPicker) {
81231
81257
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -81304,7 +81330,11 @@ const ManualAccountForm = React__default.forwardRef(
81304
81330
  fullWidth: true,
81305
81331
  helperText: errors[field.name],
81306
81332
  id: field.name,
81307
- inputProps: { "data-test": "date-input" },
81333
+ inputProps: {
81334
+ "data-test": "date-input",
81335
+ "aria-describedby": errors[field.name] ? field.name + "-error" : void 0
81336
+ },
81337
+ inputRef: (el) => inputRefs.current[field.name] = el,
81308
81338
  label: field.label,
81309
81339
  name: field.name,
81310
81340
  onChange: () => {
@@ -81341,7 +81371,11 @@ const ManualAccountForm = React__default.forwardRef(
81341
81371
  fullWidth: true,
81342
81372
  helperText: errors[field.name],
81343
81373
  id: field.name,
81344
- inputProps: { "data-test": `text-input-${field.name}` },
81374
+ inputProps: {
81375
+ "data-test": `text-input-${field.name}`,
81376
+ "aria-describedby": errors[field.name] ? field.name + "-error" : void 0
81377
+ },
81378
+ inputRef: (el) => inputRefs.current[field.name] = el,
81345
81379
  label: field.label,
81346
81380
  name: field.name,
81347
81381
  onChange: handleTextInputChange,