2024-02-06 04:57:31 +00:00
|
|
|
import React, { useEffect, useRef, useState } from 'react';
|
2024-04-05 09:49:05 +00:00
|
|
|
import { resolveWidgetFieldValue } from '@/_helpers/utils';
|
2024-02-06 04:57:31 +00:00
|
|
|
import * as Icons from '@tabler/icons-react';
|
|
|
|
|
import Loader from '@/ToolJetUI/Loader/Loader';
|
|
|
|
|
import SolidIcon from '@/_ui/Icon/SolidIcons';
|
2024-02-14 12:44:35 +00:00
|
|
|
import Label from '@/_ui/Label';
|
2024-07-01 03:16:22 +00:00
|
|
|
import { useEditorStore } from '@/_stores/editorStore';
|
2021-10-21 16:23:11 +00:00
|
|
|
|
2024-02-06 04:57:31 +00:00
|
|
|
export const PasswordInput = function PasswordInput({
|
2022-11-03 14:04:37 +00:00
|
|
|
height,
|
|
|
|
|
validate,
|
|
|
|
|
properties,
|
|
|
|
|
styles,
|
|
|
|
|
setExposedVariable,
|
|
|
|
|
fireEvent,
|
2024-02-06 04:57:31 +00:00
|
|
|
component,
|
|
|
|
|
darkMode,
|
2023-01-24 11:52:35 +00:00
|
|
|
dataCy,
|
2024-02-06 04:57:31 +00:00
|
|
|
isResizing,
|
2024-07-01 03:16:22 +00:00
|
|
|
id,
|
2024-02-06 04:57:31 +00:00
|
|
|
}) {
|
|
|
|
|
const textInputRef = useRef();
|
|
|
|
|
const labelRef = useRef();
|
2022-11-03 11:32:38 +00:00
|
|
|
|
2024-02-26 11:36:39 +00:00
|
|
|
const { loadingState, disabledState, label, placeholder } = properties;
|
2024-02-06 04:57:31 +00:00
|
|
|
const {
|
|
|
|
|
padding,
|
|
|
|
|
borderRadius,
|
|
|
|
|
borderColor,
|
|
|
|
|
backgroundColor,
|
|
|
|
|
textColor,
|
|
|
|
|
boxShadow,
|
|
|
|
|
width,
|
|
|
|
|
alignment,
|
|
|
|
|
direction,
|
|
|
|
|
color,
|
|
|
|
|
auto,
|
|
|
|
|
errTextColor,
|
|
|
|
|
iconColor,
|
2024-02-14 12:44:35 +00:00
|
|
|
accentColor,
|
2024-02-06 04:57:31 +00:00
|
|
|
} = styles;
|
2021-10-21 16:23:11 +00:00
|
|
|
|
2024-02-06 04:57:31 +00:00
|
|
|
const [disable, setDisable] = useState(disabledState || loadingState);
|
|
|
|
|
const [passwordValue, setPasswordValue] = useState(properties.value);
|
|
|
|
|
const [visibility, setVisibility] = useState(properties.visibility);
|
2022-09-12 07:04:27 +00:00
|
|
|
const { isValid, validationError } = validate(passwordValue);
|
2023-08-09 03:39:18 +00:00
|
|
|
const [showValidationError, setShowValidationError] = useState(false);
|
2024-04-05 09:49:05 +00:00
|
|
|
|
|
|
|
|
const isMandatory = resolveWidgetFieldValue(component?.definition?.validation?.mandatory?.value);
|
2024-02-14 12:44:35 +00:00
|
|
|
const [labelWidth, setLabelWidth] = useState(0);
|
2024-02-06 04:57:31 +00:00
|
|
|
const defaultAlignment = alignment === 'side' || alignment === 'top' ? alignment : 'side';
|
|
|
|
|
const [iconVisibility, setIconVisibility] = useState(false);
|
|
|
|
|
const [loading, setLoading] = useState(loadingState);
|
|
|
|
|
const [isFocused, setIsFocused] = useState(false);
|
2024-02-14 12:44:35 +00:00
|
|
|
const tinycolor = require('tinycolor2');
|
|
|
|
|
|
|
|
|
|
const _width = (width / 100) * 70; // Max width which label can go is 70% for better UX calculate width based on this value
|
2021-10-21 16:23:11 +00:00
|
|
|
|
2023-08-11 05:10:45 +00:00
|
|
|
const computedStyles = {
|
2024-02-26 11:36:39 +00:00
|
|
|
height: height == 36 ? (padding == 'default' ? '36px' : '40px') : padding == 'default' ? height : height + 4,
|
2023-08-11 05:10:45 +00:00
|
|
|
borderRadius: `${borderRadius}px`,
|
2024-04-19 07:33:23 +00:00
|
|
|
backgroundColor: !['#ffffff', '#fff'].includes(backgroundColor)
|
|
|
|
|
? backgroundColor
|
|
|
|
|
: disable || loading
|
2024-02-06 04:57:31 +00:00
|
|
|
? darkMode
|
2024-04-19 07:33:23 +00:00
|
|
|
? 'var(--surfaces-app-bg-default)'
|
|
|
|
|
: 'var(--surfaces-surface-03)'
|
|
|
|
|
: 'var(--surfaces-surface-01)',
|
2024-02-14 12:44:35 +00:00
|
|
|
boxShadow: boxShadow,
|
|
|
|
|
padding: styles.iconVisibility ? '8px 10px 8px 29px' : '8px 10px 8px 10px',
|
|
|
|
|
overflow: 'hidden',
|
|
|
|
|
textOverflow: 'ellipsis',
|
2024-04-19 07:33:23 +00:00
|
|
|
color: textColor !== '#1B1F24' ? textColor : disable || loading ? 'var(--text-disabled)' : 'var(--text-primary)',
|
|
|
|
|
borderColor: isFocused
|
|
|
|
|
? accentColor != '4368E3'
|
|
|
|
|
? accentColor
|
|
|
|
|
: 'var(--primary-accent-strong)'
|
|
|
|
|
: borderColor != '#CCD1D5'
|
|
|
|
|
? borderColor
|
|
|
|
|
: disable || loading
|
|
|
|
|
? '1px solid var(--borders-disabled-on-white)'
|
|
|
|
|
: 'var(--borders-default)',
|
|
|
|
|
'--tblr-input-border-color-darker': tinycolor(borderColor).darken(24).toString(),
|
2024-02-06 04:57:31 +00:00
|
|
|
};
|
2024-02-14 12:44:35 +00:00
|
|
|
|
2024-02-06 04:57:31 +00:00
|
|
|
const loaderStyle = {
|
|
|
|
|
right:
|
2024-02-14 12:44:35 +00:00
|
|
|
direction === 'right' &&
|
|
|
|
|
defaultAlignment === 'side' &&
|
|
|
|
|
((label?.length > 0 && width > 0) || (auto && width == 0 && label && label?.length != 0))
|
|
|
|
|
? `${labelWidth + 11}px`
|
|
|
|
|
: '11px',
|
|
|
|
|
top: `${
|
|
|
|
|
defaultAlignment === 'top'
|
|
|
|
|
? ((label?.length > 0 && width > 0) || (auto && width == 0 && label && label?.length != 0)) &&
|
|
|
|
|
'calc(50% + 10px)'
|
|
|
|
|
: ''
|
|
|
|
|
}`,
|
|
|
|
|
transform:
|
|
|
|
|
defaultAlignment === 'top' &&
|
|
|
|
|
((label?.length > 0 && width > 0) || (auto && width == 0 && label && label?.length != 0)) &&
|
|
|
|
|
' translateY(-50%)',
|
|
|
|
|
zIndex: 3,
|
2023-08-11 05:10:45 +00:00
|
|
|
};
|
|
|
|
|
|
2024-02-06 06:12:05 +00:00
|
|
|
useEffect(() => {
|
|
|
|
|
setExposedVariable('label', label);
|
2024-02-14 12:44:35 +00:00
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2024-02-06 06:12:05 +00:00
|
|
|
}, [label]);
|
|
|
|
|
|
2024-02-06 04:57:31 +00:00
|
|
|
useEffect(() => {
|
2024-02-14 12:44:35 +00:00
|
|
|
if (labelRef?.current) {
|
|
|
|
|
const absolutewidth = labelRef?.current?.getBoundingClientRect()?.width;
|
|
|
|
|
setLabelWidth(absolutewidth);
|
|
|
|
|
} else setLabelWidth(0);
|
2024-02-06 04:57:31 +00:00
|
|
|
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [
|
|
|
|
|
isResizing,
|
|
|
|
|
width,
|
|
|
|
|
auto,
|
|
|
|
|
defaultAlignment,
|
|
|
|
|
component?.definition?.styles?.iconVisibility?.value,
|
|
|
|
|
label?.length,
|
|
|
|
|
isMandatory,
|
|
|
|
|
padding,
|
|
|
|
|
direction,
|
|
|
|
|
alignment,
|
|
|
|
|
isMandatory,
|
2024-02-14 12:44:35 +00:00
|
|
|
labelRef?.current?.getBoundingClientRect()?.width,
|
2024-02-06 04:57:31 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
disable !== disabledState && setDisable(disabledState);
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [disabledState]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
visibility !== properties.visibility && setVisibility(properties.visibility);
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [properties.visibility]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
loading !== loadingState && setLoading(loadingState);
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [loadingState]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2021-12-14 11:18:25 +00:00
|
|
|
setExposedVariable('isValid', isValid);
|
2022-09-12 07:04:27 +00:00
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2024-02-06 04:57:31 +00:00
|
|
|
}, [isValid]);
|
2021-10-21 16:23:11 +00:00
|
|
|
|
2024-02-06 04:57:31 +00:00
|
|
|
useEffect(() => {
|
|
|
|
|
setPasswordValue(properties.value);
|
|
|
|
|
setExposedVariable('value', properties?.value ?? '');
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [properties.value]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setExposedVariable('setFocus', async function () {
|
|
|
|
|
textInputRef.current.focus();
|
|
|
|
|
});
|
|
|
|
|
setExposedVariable('setBlur', async function () {
|
|
|
|
|
textInputRef.current.blur();
|
|
|
|
|
});
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setExposedVariable('setText', async function (text) {
|
|
|
|
|
setPasswordValue(text);
|
2024-05-24 11:23:30 +00:00
|
|
|
setExposedVariable('value', text);
|
|
|
|
|
fireEvent('onChange');
|
2024-02-06 04:57:31 +00:00
|
|
|
});
|
|
|
|
|
setExposedVariable('clear', async function () {
|
|
|
|
|
setPasswordValue('');
|
2024-05-24 11:23:30 +00:00
|
|
|
setExposedVariable('value', '');
|
|
|
|
|
fireEvent('onChange');
|
2024-02-06 04:57:31 +00:00
|
|
|
});
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [setPasswordValue]);
|
|
|
|
|
|
|
|
|
|
const iconName = styles.icon; // Replace with the name of the icon you want
|
|
|
|
|
// eslint-disable-next-line import/namespace
|
|
|
|
|
const IconElement = Icons[iconName] == undefined ? Icons['IconHome2'] : Icons[iconName];
|
|
|
|
|
// eslint-disable-next-line import/namespace
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setExposedVariable('isMandatory', isMandatory);
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [isMandatory]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setExposedVariable('isLoading', loading);
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [loading]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setExposedVariable('setLoading', async function (loading) {
|
|
|
|
|
setLoading(loading);
|
|
|
|
|
setExposedVariable('isLoading', loading);
|
|
|
|
|
});
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [properties.loadingState]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setExposedVariable('isVisible', visibility);
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [visibility]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setExposedVariable('setVisibility', async function (state) {
|
|
|
|
|
setVisibility(state);
|
|
|
|
|
setExposedVariable('isVisible', state);
|
|
|
|
|
});
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [properties.visibility]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setExposedVariable('setDisable', async function (disable) {
|
|
|
|
|
setDisable(disable);
|
|
|
|
|
setExposedVariable('isDisabled', disable);
|
|
|
|
|
});
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [disabledState]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setExposedVariable('isDisabled', disable);
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [disable]);
|
|
|
|
|
|
2024-07-01 03:16:22 +00:00
|
|
|
const currentPageId = useEditorStore.getState().currentPageId;
|
|
|
|
|
const components = useEditorStore.getState().appDefinition?.pages?.[currentPageId]?.components || {};
|
|
|
|
|
|
|
|
|
|
const isChildOfForm = Object.keys(components).some((key) => {
|
|
|
|
|
if (key == id) {
|
|
|
|
|
const { parent } = components[key].component;
|
|
|
|
|
if (parent) {
|
|
|
|
|
const parentComponentTypes = {};
|
|
|
|
|
Object.keys(components).forEach((key) => {
|
|
|
|
|
const { component } = components[key];
|
|
|
|
|
parentComponentTypes[key] = component.component;
|
|
|
|
|
});
|
|
|
|
|
if (parentComponentTypes[parent] == 'Form') return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
});
|
2024-02-06 04:57:31 +00:00
|
|
|
const renderInput = () => (
|
|
|
|
|
<>
|
|
|
|
|
<div
|
2024-02-20 15:58:24 +00:00
|
|
|
data-cy={`label-${String(component.name).toLowerCase()}`}
|
2024-02-14 12:44:35 +00:00
|
|
|
className={`text-input d-flex ${
|
|
|
|
|
defaultAlignment === 'top' &&
|
|
|
|
|
((width != 0 && label && label?.length != 0) || (auto && width == 0 && label && label?.length != 0))
|
|
|
|
|
? 'flex-column'
|
|
|
|
|
: 'align-items-center '
|
|
|
|
|
} ${direction === 'right' && defaultAlignment === 'side' ? 'flex-row-reverse' : ''}
|
2024-02-06 04:57:31 +00:00
|
|
|
${direction === 'right' && defaultAlignment === 'top' ? 'text-right' : ''}
|
|
|
|
|
${visibility || 'invisible'}`}
|
|
|
|
|
style={{
|
|
|
|
|
position: 'relative',
|
2024-02-14 12:44:35 +00:00
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
|
width: '100%',
|
2021-10-21 16:23:11 +00:00
|
|
|
}}
|
2024-02-06 04:57:31 +00:00
|
|
|
>
|
2024-02-14 12:44:35 +00:00
|
|
|
<Label
|
|
|
|
|
label={label}
|
|
|
|
|
width={width}
|
|
|
|
|
labelRef={labelRef}
|
|
|
|
|
darkMode={darkMode}
|
|
|
|
|
color={color}
|
|
|
|
|
defaultAlignment={defaultAlignment}
|
|
|
|
|
direction={direction}
|
|
|
|
|
auto={auto}
|
|
|
|
|
isMandatory={isMandatory}
|
|
|
|
|
_width={_width}
|
|
|
|
|
labelWidth={labelWidth}
|
|
|
|
|
/>
|
2024-02-06 04:57:31 +00:00
|
|
|
{component?.definition?.styles?.iconVisibility?.value && !isResizing && (
|
|
|
|
|
<IconElement
|
2024-02-14 12:44:35 +00:00
|
|
|
data-cy={'text-input-icon'}
|
2024-02-06 04:57:31 +00:00
|
|
|
style={{
|
|
|
|
|
width: '16px',
|
|
|
|
|
height: '16px',
|
|
|
|
|
left:
|
|
|
|
|
direction === 'right'
|
2024-02-14 12:44:35 +00:00
|
|
|
? '11px'
|
2024-02-06 04:57:31 +00:00
|
|
|
: defaultAlignment === 'top'
|
2024-02-14 12:44:35 +00:00
|
|
|
? '11px'
|
|
|
|
|
: (label?.length > 0 && width > 0) || (auto && width == 0 && label && label?.length != 0)
|
|
|
|
|
? `${labelWidth + 11}px`
|
|
|
|
|
: '11px', //11 :: is 10 px inside the input + 1 px border + 12px margin right
|
2024-02-06 04:57:31 +00:00
|
|
|
position: 'absolute',
|
|
|
|
|
top: `${
|
2024-02-14 12:44:35 +00:00
|
|
|
defaultAlignment === 'side'
|
|
|
|
|
? '50%'
|
|
|
|
|
: (label?.length > 0 && width > 0) || (auto && width == 0 && label && label?.length != 0)
|
|
|
|
|
? 'calc(50% + 10px)'
|
|
|
|
|
: '50%'
|
2024-02-06 04:57:31 +00:00
|
|
|
}`,
|
|
|
|
|
transform: ' translateY(-50%)',
|
2024-04-19 07:33:23 +00:00
|
|
|
color: iconColor !== '#CFD3D859' ? iconColor : 'var(--icons-weak-disabled)',
|
2024-02-14 12:44:35 +00:00
|
|
|
zIndex: 3,
|
2024-02-06 04:57:31 +00:00
|
|
|
}}
|
|
|
|
|
stroke={1.5}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{!loading && !isResizing && (
|
|
|
|
|
<div
|
|
|
|
|
onClick={() => {
|
|
|
|
|
setIconVisibility(!iconVisibility);
|
|
|
|
|
}}
|
|
|
|
|
style={{
|
|
|
|
|
width: '16px',
|
|
|
|
|
height: '16px',
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
right:
|
2024-02-14 12:44:35 +00:00
|
|
|
direction === 'right' &&
|
|
|
|
|
defaultAlignment === 'side' &&
|
|
|
|
|
((label?.length > 0 && width > 0) || (auto && width == 0 && label && label?.length != 0))
|
|
|
|
|
? `${labelWidth + 11}px`
|
|
|
|
|
: '11px',
|
|
|
|
|
top: `${
|
|
|
|
|
defaultAlignment === 'top'
|
|
|
|
|
? ((label?.length > 0 && width > 0) || (auto && width == 0 && label && label?.length != 0)) &&
|
|
|
|
|
'calc(50% + 10px)'
|
|
|
|
|
: ''
|
|
|
|
|
}`,
|
|
|
|
|
transform:
|
|
|
|
|
defaultAlignment === 'top' &&
|
|
|
|
|
((label?.length > 0 && width > 0) || (auto && width == 0 && label && label?.length != 0)) &&
|
|
|
|
|
' translateY(-50%)',
|
2024-02-06 04:57:31 +00:00
|
|
|
display: 'flex',
|
2024-02-14 12:44:35 +00:00
|
|
|
zIndex: 3,
|
2024-02-06 04:57:31 +00:00
|
|
|
}}
|
|
|
|
|
stroke={1.5}
|
|
|
|
|
>
|
2024-04-19 07:33:23 +00:00
|
|
|
<SolidIcon
|
|
|
|
|
width={16}
|
|
|
|
|
fill={'var(--icons-weak-disabled)'}
|
|
|
|
|
className="password-component-eye"
|
|
|
|
|
name={!iconVisibility ? 'eye1' : 'eyedisable'}
|
|
|
|
|
/>
|
2024-02-06 04:57:31 +00:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
<input
|
2024-02-20 15:58:24 +00:00
|
|
|
data-cy={dataCy}
|
2024-02-06 04:57:31 +00:00
|
|
|
className={`tj-text-input-widget ${
|
|
|
|
|
!isValid && showValidationError ? 'is-invalid' : ''
|
2024-04-19 07:33:23 +00:00
|
|
|
} validation-without-icon `}
|
2024-02-06 04:57:31 +00:00
|
|
|
ref={textInputRef}
|
|
|
|
|
onKeyUp={(e) => {
|
|
|
|
|
if (e.key === 'Enter') {
|
|
|
|
|
setPasswordValue(e.target.value);
|
|
|
|
|
setExposedVariable('value', e.target.value);
|
|
|
|
|
fireEvent('onEnterPressed');
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
onChange={(e) => {
|
|
|
|
|
setPasswordValue(e.target.value);
|
|
|
|
|
setExposedVariable('value', e.target.value);
|
|
|
|
|
fireEvent('onChange');
|
|
|
|
|
}}
|
|
|
|
|
onBlur={(e) => {
|
|
|
|
|
setIsFocused(false);
|
|
|
|
|
setShowValidationError(true);
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
fireEvent('onBlur');
|
|
|
|
|
}}
|
|
|
|
|
onFocus={(e) => {
|
|
|
|
|
setIsFocused(true);
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
fireEvent('onFocus');
|
|
|
|
|
}, 0);
|
|
|
|
|
}}
|
|
|
|
|
type={!iconVisibility ? 'password' : 'text'}
|
|
|
|
|
placeholder={placeholder}
|
|
|
|
|
style={computedStyles}
|
|
|
|
|
value={passwordValue}
|
|
|
|
|
disabled={disable || loading}
|
|
|
|
|
/>
|
|
|
|
|
{loading && <Loader style={{ ...loaderStyle }} width="16" />}
|
2022-10-14 11:46:09 +00:00
|
|
|
</div>
|
2024-02-06 04:57:31 +00:00
|
|
|
{showValidationError && visibility && (
|
|
|
|
|
<div
|
|
|
|
|
data-cy={`${String(component.name).toLowerCase()}-invalid-feedback`}
|
2024-02-14 12:44:35 +00:00
|
|
|
style={{
|
2024-04-19 07:33:23 +00:00
|
|
|
color: errTextColor !== '#D72D39' ? errTextColor : 'var(--status-error-strong)',
|
|
|
|
|
textAlign: direction == 'left' && 'end',
|
|
|
|
|
fontSize: '11px',
|
|
|
|
|
fontWeight: '400',
|
|
|
|
|
lineHeight: '16px',
|
2024-02-14 12:44:35 +00:00
|
|
|
}}
|
2024-02-06 04:57:31 +00:00
|
|
|
>
|
|
|
|
|
{showValidationError && validationError}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
|
|
|
|
);
|
2024-07-01 03:16:22 +00:00
|
|
|
const renderContainer = (children) => {
|
|
|
|
|
return !isChildOfForm ? <form autoComplete="off">{children}</form> : <div>{children}</div>;
|
|
|
|
|
};
|
2024-02-06 04:57:31 +00:00
|
|
|
|
2024-07-01 03:16:22 +00:00
|
|
|
return renderContainer(renderInput());
|
2021-10-21 16:23:11 +00:00
|
|
|
};
|