fix(striker-ui): add input IDs and input label for error messages in GateForm

main
Tsu-ba-me 2 years ago
parent 6832933d7f
commit c040026e73
  1. 18
      striker-ui/components/GateForm.tsx

@ -115,7 +115,7 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>(
inputIdentifierRef.current, inputIdentifierRef.current,
) ?? ) ??
buildPeacefulStringTestBatch( buildPeacefulStringTestBatch(
'Identifier', identifierLabel,
() => { () => {
setIdentifierInputErrorMessage(); setIdentifierInputErrorMessage();
}, },
@ -127,13 +127,17 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>(
}); });
}, },
), ),
[overwriteIdentifierInputTestBatch, setIdentifierInputErrorMessage], [
identifierLabel,
overwriteIdentifierInputTestBatch,
setIdentifierInputErrorMessage,
],
); );
const inputTests: InputTestBatches = useMemo( const inputTests: InputTestBatches = useMemo(
() => ({ () => ({
[IT_IDS.identifier]: identifierInputTestBatch, [IT_IDS.identifier]: identifierInputTestBatch,
[IT_IDS.passphrase]: buildPeacefulStringTestBatch( [IT_IDS.passphrase]: buildPeacefulStringTestBatch(
'Passphrase', passphraseLabel,
() => { () => {
setPassphraseInputErrorMessage(); setPassphraseInputErrorMessage();
}, },
@ -146,7 +150,11 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>(
}, },
), ),
}), }),
[identifierInputTestBatch, setPassphraseInputErrorMessage], [
identifierInputTestBatch,
passphraseLabel,
setPassphraseInputErrorMessage,
],
); );
const messageGroupSxDisplay = useMemo( const messageGroupSxDisplay = useMemo(
() => (isShowMessageGroup ? undefined : 'none'), () => (isShowMessageGroup ? undefined : 'none'),
@ -225,6 +233,7 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>(
...restIdentifierFormControlProps, ...restIdentifierFormControlProps,
sx: { ...INPUT_ROOT_SX, ...identifierSx }, sx: { ...INPUT_ROOT_SX, ...identifierSx },
}} }}
id="credential-identifier-input"
inputProps={{ inputProps={{
onBlur: (event) => { onBlur: (event) => {
const { const {
@ -259,6 +268,7 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>(
...restPassphraseFormControlProps, ...restPassphraseFormControlProps,
sx: { ...INPUT_ROOT_SX, ...passphraseSx }, sx: { ...INPUT_ROOT_SX, ...passphraseSx },
}} }}
id="credential-passphrase-input"
inputProps={{ inputProps={{
onBlur: ({ target: { value } }) => { onBlur: ({ target: { value } }) => {
testInput({ testInput({

Loading…
Cancel
Save