@mxenabled/connect-widget 0.13.2 → 0.13.4

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
@@ -64864,6 +64864,21 @@ const RequestInstitution = React__default.forwardRef((props, requestInstitutionR
64864
64864
  const tokens = useTokens();
64865
64865
  const styles = getStyles$17(tokens);
64866
64866
  const getNextDelay = getDelay();
64867
+ const emailInputRef = useRef(null);
64868
+ const institutionNameInputRef = useRef(null);
64869
+ const institutionWebsiteInputRef = useRef(null);
64870
+ const institutionLoginInputRef = useRef(null);
64871
+ useEffect(() => {
64872
+ if (errors.email) {
64873
+ emailInputRef.current?.focus();
64874
+ } else if (errors.institutionName) {
64875
+ institutionNameInputRef.current?.focus();
64876
+ } else if (errors.institutionWebsite) {
64877
+ institutionWebsiteInputRef.current?.focus();
64878
+ } else if (errors.institutionLogin) {
64879
+ institutionLoginInputRef.current?.focus();
64880
+ }
64881
+ }, [errors]);
64867
64882
  useEffect(() => {
64868
64883
  if (submitting) {
64869
64884
  const ticket = {
@@ -64900,6 +64915,10 @@ const RequestInstitution = React__default.forwardRef((props, requestInstitutionR
64900
64915
  fullWidth: true,
64901
64916
  helperText: errors.email,
64902
64917
  id: "email",
64918
+ inputProps: {
64919
+ "aria-describedby": errors.email ? "email-error" : void 0
64920
+ },
64921
+ inputRef: emailInputRef,
64903
64922
  label: schema.email.label,
64904
64923
  name: "email",
64905
64924
  onChange: handleTextInputChange,
@@ -64916,6 +64935,10 @@ const RequestInstitution = React__default.forwardRef((props, requestInstitutionR
64916
64935
  fullWidth: true,
64917
64936
  helperText: errors.institutionName,
64918
64937
  id: "institutionName",
64938
+ inputProps: {
64939
+ "aria-describedby": errors.institutionName ? "institutionName-error" : void 0
64940
+ },
64941
+ inputRef: institutionNameInputRef,
64919
64942
  label: schema.institutionName.label,
64920
64943
  name: "institutionName",
64921
64944
  onChange: handleTextInputChange,
@@ -64931,6 +64954,10 @@ const RequestInstitution = React__default.forwardRef((props, requestInstitutionR
64931
64954
  fullWidth: true,
64932
64955
  helperText: errors.institutionWebsite,
64933
64956
  id: "institutionWebsite",
64957
+ inputProps: {
64958
+ "aria-describedby": errors.institutionWebsite ? "institutionWebsite-error" : void 0
64959
+ },
64960
+ inputRef: institutionWebsiteInputRef,
64934
64961
  label: schema.institutionWebsite.label,
64935
64962
  name: "institutionWebsite",
64936
64963
  onChange: handleTextInputChange,
@@ -64947,6 +64974,10 @@ const RequestInstitution = React__default.forwardRef((props, requestInstitutionR
64947
64974
  fullWidth: true,
64948
64975
  helperText: errors.institutionLogin,
64949
64976
  id: "institutionLogin",
64977
+ inputProps: {
64978
+ "aria-describedby": errors.institutionLogin ? "institutionLogin-error" : void 0
64979
+ },
64980
+ inputRef: institutionLoginInputRef,
64950
64981
  label: schema.institutionLogin.label,
64951
64982
  name: "institutionLogin",
64952
64983
  onChange: handleTextInputChange,
@@ -70187,6 +70218,15 @@ const Credentials = React__default.forwardRef(
70187
70218
  formSchema,
70188
70219
  initialValues
70189
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]);
70190
70230
  function attemptConnect() {
70191
70231
  const credentialsPayload = credentials.map((credential) => {
70192
70232
  return {
@@ -70362,7 +70402,11 @@ const Credentials = React__default.forwardRef(
70362
70402
  fullWidth: true,
70363
70403
  helperText: validations.isCapsLockOn && __("Caps lock is on") || validations.validateSpaceMessage || errors[field.field_name],
70364
70404
  id: field.field_name,
70365
- 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,
70366
70410
  label: field.label,
70367
70411
  name: field.field_name,
70368
70412
  onBlur: handleBlur,
@@ -70386,7 +70430,11 @@ const Credentials = React__default.forwardRef(
70386
70430
  fullWidth: true,
70387
70431
  helperText: errors[field.field_name],
70388
70432
  id: field.field_name,
70389
- 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,
70390
70438
  label: field.label,
70391
70439
  name: field.field_name,
70392
70440
  onChange: handleUserNameTextChange,