|
|
@ -38,17 +38,19 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>( |
|
|
|
spacing: gridSpacing = '1em', |
|
|
|
spacing: gridSpacing = '1em', |
|
|
|
...restGridProps |
|
|
|
...restGridProps |
|
|
|
} = {}, |
|
|
|
} = {}, |
|
|
|
|
|
|
|
identifierId = INPUT_ID_GATE_ID, |
|
|
|
|
|
|
|
identifierInputTestBatchBuilder: |
|
|
|
|
|
|
|
buildIdentifierInputTestBatch = buildPeacefulStringTestBatch, |
|
|
|
identifierLabel, |
|
|
|
identifierLabel, |
|
|
|
identifierOutlinedInputWithLabelProps: { |
|
|
|
identifierOutlinedInputWithLabelProps: { |
|
|
|
formControlProps: identifierFormControlProps = {}, |
|
|
|
formControlProps: identifierFormControlProps = {}, |
|
|
|
inputProps: identifierInputProps, |
|
|
|
inputProps: identifierInputProps, |
|
|
|
...restIdentifierOutlinedInputWithLabelProps |
|
|
|
...restIdentifierOutlinedInputWithLabelProps |
|
|
|
} = {}, |
|
|
|
} = {}, |
|
|
|
identifierInputTestBatchBuilder: |
|
|
|
|
|
|
|
buildIdentifierInputTestBatch = buildPeacefulStringTestBatch, |
|
|
|
|
|
|
|
onIdentifierBlurAppend, |
|
|
|
onIdentifierBlurAppend, |
|
|
|
onSubmit, |
|
|
|
onSubmit, |
|
|
|
onSubmitAppend, |
|
|
|
onSubmitAppend, |
|
|
|
|
|
|
|
passphraseId = INPUT_ID_GATE_PASSPHRASE, |
|
|
|
passphraseLabel, |
|
|
|
passphraseLabel, |
|
|
|
passphraseOutlinedInputWithLabelProps: { |
|
|
|
passphraseOutlinedInputWithLabelProps: { |
|
|
|
formControlProps: passphraseFormControlProps = {}, |
|
|
|
formControlProps: passphraseFormControlProps = {}, |
|
|
@ -56,6 +58,8 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>( |
|
|
|
...restPassphraseOutlinedInputWithLabelProps |
|
|
|
...restPassphraseOutlinedInputWithLabelProps |
|
|
|
} = {}, |
|
|
|
} = {}, |
|
|
|
submitLabel, |
|
|
|
submitLabel, |
|
|
|
|
|
|
|
// Props that depend on others.
|
|
|
|
|
|
|
|
allowSubmit: isAllowSubmit = isFormContainer, |
|
|
|
}, |
|
|
|
}, |
|
|
|
ref, |
|
|
|
ref, |
|
|
|
) => { |
|
|
|
) => { |
|
|
@ -94,13 +98,10 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>( |
|
|
|
setIsSubmitting(true); |
|
|
|
setIsSubmitting(true); |
|
|
|
onSubmitAppend?.call( |
|
|
|
onSubmitAppend?.call( |
|
|
|
null, |
|
|
|
null, |
|
|
|
inputIdentifierRef.current, |
|
|
|
|
|
|
|
inputPassphraseRef.current, |
|
|
|
|
|
|
|
(message?) => { |
|
|
|
(message?) => { |
|
|
|
setMessage(MSG_ID_GATE_ACCESS, message); |
|
|
|
setMessage(MSG_ID_GATE_ACCESS, message); |
|
|
|
}, |
|
|
|
}, |
|
|
|
setIsSubmitting, |
|
|
|
setIsSubmitting, |
|
|
|
messageGroupRef.current, |
|
|
|
|
|
|
|
...args, |
|
|
|
...args, |
|
|
|
); |
|
|
|
); |
|
|
|
}), |
|
|
|
}), |
|
|
@ -124,7 +125,7 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>( |
|
|
|
const submitAreaGridLayout = useMemo(() => { |
|
|
|
const submitAreaGridLayout = useMemo(() => { |
|
|
|
const result: GridLayout = {}; |
|
|
|
const result: GridLayout = {}; |
|
|
|
|
|
|
|
|
|
|
|
if (isFormContainer) { |
|
|
|
if (isAllowSubmit) { |
|
|
|
result['gate-cell-message-group'] = { |
|
|
|
result['gate-cell-message-group'] = { |
|
|
|
children: <MessageGroup count={1} ref={messageGroupRef} />, |
|
|
|
children: <MessageGroup count={1} ref={messageGroupRef} />, |
|
|
|
sm: 2, |
|
|
|
sm: 2, |
|
|
@ -133,7 +134,7 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
}, [isFormContainer, submitElement]); |
|
|
|
}, [isAllowSubmit, submitElement]); |
|
|
|
|
|
|
|
|
|
|
|
const containerProps = useMemo(() => { |
|
|
|
const containerProps = useMemo(() => { |
|
|
|
const result: BoxProps = {}; |
|
|
|
const result: BoxProps = {}; |
|
|
@ -173,7 +174,7 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>( |
|
|
|
...restIdentifierFormControlProps, |
|
|
|
...restIdentifierFormControlProps, |
|
|
|
sx: { ...INPUT_ROOT_SX, ...identifierSx }, |
|
|
|
sx: { ...INPUT_ROOT_SX, ...identifierSx }, |
|
|
|
}} |
|
|
|
}} |
|
|
|
id={INPUT_ID_GATE_ID} |
|
|
|
id={identifierId} |
|
|
|
inputProps={identifierInputProps} |
|
|
|
inputProps={identifierInputProps} |
|
|
|
label={identifierLabel} |
|
|
|
label={identifierLabel} |
|
|
|
{...restIdentifierOutlinedInputWithLabelProps} |
|
|
|
{...restIdentifierOutlinedInputWithLabelProps} |
|
|
@ -182,23 +183,21 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>( |
|
|
|
inputTestBatch={buildIdentifierInputTestBatch( |
|
|
|
inputTestBatch={buildIdentifierInputTestBatch( |
|
|
|
identifierLabel, |
|
|
|
identifierLabel, |
|
|
|
() => { |
|
|
|
() => { |
|
|
|
setMessage(INPUT_ID_GATE_ID); |
|
|
|
setMessage(identifierId); |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
onFinishBatch: |
|
|
|
onFinishBatch: |
|
|
|
buildFinishInputTestBatchFunction(INPUT_ID_GATE_ID), |
|
|
|
buildFinishInputTestBatchFunction(identifierId), |
|
|
|
}, |
|
|
|
}, |
|
|
|
(message) => { |
|
|
|
(message) => { |
|
|
|
setMessage(INPUT_ID_GATE_ID, { children: message }); |
|
|
|
setMessage(identifierId, { children: message }); |
|
|
|
}, |
|
|
|
}, |
|
|
|
)} |
|
|
|
)} |
|
|
|
onBlurAppend={(...args) => { |
|
|
|
onBlurAppend={(...args) => { |
|
|
|
onIdentifierBlurAppend?.call(null, ...args); |
|
|
|
onIdentifierBlurAppend?.call(null, ...args); |
|
|
|
}} |
|
|
|
}} |
|
|
|
onFirstRender={buildInputFirstRenderFunction( |
|
|
|
onFirstRender={buildInputFirstRenderFunction(identifierId)} |
|
|
|
INPUT_ID_GATE_ID, |
|
|
|
onUnmount={buildInputUnmountFunction(identifierId)} |
|
|
|
)} |
|
|
|
|
|
|
|
onUnmount={buildInputUnmountFunction(INPUT_ID_GATE_ID)} |
|
|
|
|
|
|
|
ref={inputIdentifierRef} |
|
|
|
ref={inputIdentifierRef} |
|
|
|
required |
|
|
|
required |
|
|
|
/> |
|
|
|
/> |
|
|
@ -213,7 +212,7 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>( |
|
|
|
...restPassphraseFormControlProps, |
|
|
|
...restPassphraseFormControlProps, |
|
|
|
sx: { ...INPUT_ROOT_SX, ...passphraseSx }, |
|
|
|
sx: { ...INPUT_ROOT_SX, ...passphraseSx }, |
|
|
|
}} |
|
|
|
}} |
|
|
|
id={INPUT_ID_GATE_PASSPHRASE} |
|
|
|
id={passphraseId} |
|
|
|
inputProps={passphraseInputProps} |
|
|
|
inputProps={passphraseInputProps} |
|
|
|
label={passphraseLabel} |
|
|
|
label={passphraseLabel} |
|
|
|
type={INPUT_TYPES.password} |
|
|
|
type={INPUT_TYPES.password} |
|
|
@ -223,25 +222,20 @@ const GateForm = forwardRef<GateFormForwardedRefContent, GateFormProps>( |
|
|
|
inputTestBatch={buildPeacefulStringTestBatch( |
|
|
|
inputTestBatch={buildPeacefulStringTestBatch( |
|
|
|
passphraseLabel, |
|
|
|
passphraseLabel, |
|
|
|
() => { |
|
|
|
() => { |
|
|
|
setMessage(INPUT_ID_GATE_PASSPHRASE); |
|
|
|
setMessage(passphraseId); |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
onFinishBatch: buildFinishInputTestBatchFunction( |
|
|
|
onFinishBatch: |
|
|
|
INPUT_ID_GATE_PASSPHRASE, |
|
|
|
buildFinishInputTestBatchFunction(passphraseId), |
|
|
|
), |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
(message) => { |
|
|
|
(message) => { |
|
|
|
setMessage(INPUT_ID_GATE_PASSPHRASE, { |
|
|
|
setMessage(passphraseId, { |
|
|
|
children: message, |
|
|
|
children: message, |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
)} |
|
|
|
)} |
|
|
|
onFirstRender={buildInputFirstRenderFunction( |
|
|
|
onFirstRender={buildInputFirstRenderFunction(passphraseId)} |
|
|
|
INPUT_ID_GATE_PASSPHRASE, |
|
|
|
onUnmount={buildInputUnmountFunction(passphraseId)} |
|
|
|
)} |
|
|
|
|
|
|
|
onUnmount={buildInputUnmountFunction( |
|
|
|
|
|
|
|
INPUT_ID_GATE_PASSPHRASE, |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
ref={inputPassphraseRef} |
|
|
|
ref={inputPassphraseRef} |
|
|
|
required |
|
|
|
required |
|
|
|
/> |
|
|
|
/> |
|
|
|