fix(ui): tooltip positioning issues (#6439)
This commit is contained in:
@@ -84,14 +84,14 @@ const _RichText: React.FC<
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={`${baseClass}__wrap`}>
|
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
|
<div className={`${baseClass}__wrap`}>
|
||||||
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
<ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>
|
<ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>
|
||||||
<LexicalProvider
|
<LexicalProvider
|
||||||
editorConfig={editorConfig}
|
editorConfig={editorConfig}
|
||||||
|
|||||||
@@ -106,10 +106,6 @@
|
|||||||
line-height: unset;
|
line-height: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__error-wrap {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__rows {
|
&__rows {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
@import '../scss/styles.scss';
|
@import '../scss/styles.scss';
|
||||||
|
|
||||||
.rich-text-lexical {
|
.rich-text-lexical {
|
||||||
display: flex;
|
|
||||||
|
|
||||||
.errorBoundary {
|
.errorBoundary {
|
||||||
pre {
|
pre {
|
||||||
text-wrap: unset;
|
text-wrap: unset;
|
||||||
|
|||||||
@@ -315,14 +315,14 @@ const RichTextField: React.FC<
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={`${baseClass}__wrap`}>
|
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
|
<div className={`${baseClass}__wrap`}>
|
||||||
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
<Slate
|
<Slate
|
||||||
editor={editor}
|
editor={editor}
|
||||||
key={JSON.stringify({ initialValue, path })} // makes sure slate is completely re-rendered when initialValue changes, bypassing the slate-internal value memoization. That way, external changes to the form will update the editor
|
key={JSON.stringify({ initialValue, path })} // makes sure slate is completely re-rendered when initialValue changes, bypassing the slate-internal value memoization. That way, external changes to the form will update the editor
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
background-color: var(--theme-elevation-800);
|
background-color: var(--theme-elevation-800);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 2;
|
z-index: 3;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
padding: base(0.2) base(0.4);
|
padding: base(0.2) base(0.4);
|
||||||
color: var(--theme-elevation-0);
|
color: var(--theme-elevation-0);
|
||||||
@@ -52,8 +52,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
&--position-top {
|
&--position-top {
|
||||||
bottom: 100%;
|
top: calc(var(--base) * -0.6 - 13px);
|
||||||
transform: translate3d(-50%, calc(var(--caret-size) * -1), 0);
|
transform: translate3d(-50%, calc(var(--caret-size) * -1), 0);
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
@@ -62,8 +63,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
&--position-bottom {
|
&--position-bottom {
|
||||||
top: 100%;
|
bottom: calc(var(--base) * -0.6 - 13px);
|
||||||
transform: translate3d(-50%, var(--caret-size), 0);
|
transform: translate3d(-50%, var(--caret-size), 0);
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ export type Props = {
|
|||||||
className?: string
|
className?: string
|
||||||
delay?: number
|
delay?: number
|
||||||
show?: boolean
|
show?: boolean
|
||||||
|
/**
|
||||||
|
* If the tooltip position should not change depending on if the toolbar is outside the boundingRef. @default false
|
||||||
|
*/
|
||||||
|
staticPositioning?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Tooltip: React.FC<Props> = (props) => {
|
export const Tooltip: React.FC<Props> = (props) => {
|
||||||
@@ -21,6 +25,7 @@ export const Tooltip: React.FC<Props> = (props) => {
|
|||||||
className,
|
className,
|
||||||
delay = 350,
|
delay = 350,
|
||||||
show: showFromProps = true,
|
show: showFromProps = true,
|
||||||
|
staticPositioning = false,
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
const [show, setShow] = React.useState(showFromProps)
|
const [show, setShow] = React.useState(showFromProps)
|
||||||
@@ -28,11 +33,14 @@ export const Tooltip: React.FC<Props> = (props) => {
|
|||||||
|
|
||||||
const getTitleAttribute = (content) => (typeof content === 'string' ? content : '')
|
const getTitleAttribute = (content) => (typeof content === 'string' ? content : '')
|
||||||
|
|
||||||
const [ref, intersectionEntry] = useIntersect({
|
const [ref, intersectionEntry] = useIntersect(
|
||||||
|
{
|
||||||
root: boundingRef?.current || null,
|
root: boundingRef?.current || null,
|
||||||
rootMargin: '-145px 0px 0px 100px',
|
rootMargin: '-145px 0px 0px 100px',
|
||||||
threshold: 0,
|
threshold: 0,
|
||||||
})
|
},
|
||||||
|
staticPositioning,
|
||||||
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let timerId: NodeJS.Timeout
|
let timerId: NodeJS.Timeout
|
||||||
@@ -52,22 +60,25 @@ export const Tooltip: React.FC<Props> = (props) => {
|
|||||||
}, [showFromProps, delay])
|
}, [showFromProps, delay])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (staticPositioning) return
|
||||||
setPosition(intersectionEntry?.isIntersecting ? 'top' : 'bottom')
|
setPosition(intersectionEntry?.isIntersecting ? 'top' : 'bottom')
|
||||||
}, [intersectionEntry])
|
}, [intersectionEntry, staticPositioning])
|
||||||
|
|
||||||
|
// The first aside is always on top. The purpose of that is that it can reliably be used for the interaction observer (as it's not moving around), to calculate the position of the actual tooltip.
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
{!staticPositioning && (
|
||||||
<aside
|
<aside
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className={['tooltip', className, `tooltip--caret-${alignCaret}`, 'tooltip--position-top']
|
className={['tooltip', className, `tooltip--caret-${alignCaret}`, 'tooltip--position-top']
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join(' ')}
|
.join(' ')}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
title={getTitleAttribute(children)}
|
style={{ opacity: '0' }}
|
||||||
>
|
>
|
||||||
<div className="tooltip-content">{children}</div>
|
<div className="tooltip-content">{children}</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
)}
|
||||||
<aside
|
<aside
|
||||||
className={[
|
className={[
|
||||||
'tooltip',
|
'tooltip',
|
||||||
|
|||||||
@@ -54,10 +54,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__error-wrap {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__row-header {
|
&__row-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -202,11 +202,7 @@ export const _ArrayField: React.FC<ArrayFieldProps> = (props) => {
|
|||||||
.join(' ')}
|
.join(' ')}
|
||||||
id={`field-${path.replace(/\./g, '__')}`}
|
id={`field-${path.replace(/\./g, '__')}`}
|
||||||
>
|
>
|
||||||
{showError && (
|
{showError && <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />}
|
||||||
<div className={`${baseClass}__error-wrap`}>
|
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<header className={`${baseClass}__header`}>
|
<header className={`${baseClass}__header`}>
|
||||||
<div className={`${baseClass}__header-wrap`}>
|
<div className={`${baseClass}__header-wrap`}>
|
||||||
<div className={`${baseClass}__header-content`}>
|
<div className={`${baseClass}__header-content`}>
|
||||||
|
|||||||
@@ -75,10 +75,6 @@
|
|||||||
line-height: unset;
|
line-height: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__error-wrap {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__rows {
|
&__rows {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -215,11 +215,7 @@ const _BlocksField: React.FC<BlocksFieldProps> = (props) => {
|
|||||||
.join(' ')}
|
.join(' ')}
|
||||||
id={`field-${path.replace(/\./g, '__')}`}
|
id={`field-${path.replace(/\./g, '__')}`}
|
||||||
>
|
>
|
||||||
{showError && (
|
{showError && <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />}
|
||||||
<div className={`${baseClass}__error-wrap`}>
|
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<header className={`${baseClass}__header`}>
|
<header className={`${baseClass}__header`}>
|
||||||
<div className={`${baseClass}__header-wrap`}>
|
<div className={`${baseClass}__header-wrap`}>
|
||||||
<div className={`${baseClass}__heading-with-error`}>
|
<div className={`${baseClass}__heading-with-error`}>
|
||||||
|
|||||||
@@ -10,10 +10,6 @@
|
|||||||
margin-bottom: 0.2em;
|
margin-bottom: 0.2em;
|
||||||
max-width: fit-content;
|
max-width: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__error-wrap {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkbox-input {
|
.checkbox-input {
|
||||||
|
|||||||
@@ -97,9 +97,7 @@ const CheckboxField: React.FC<CheckboxFieldProps> = (props) => {
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={`${baseClass}__error-wrap`}>
|
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
</div>
|
|
||||||
<CheckboxInput
|
<CheckboxInput
|
||||||
AfterInput={AfterInput}
|
AfterInput={AfterInput}
|
||||||
BeforeInput={BeforeInput}
|
BeforeInput={BeforeInput}
|
||||||
|
|||||||
@@ -87,14 +87,14 @@ const CodeField: React.FC<CodeFieldProps> = (props) => {
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
<div>
|
<div className={`${fieldBaseClass}__wrap`}>
|
||||||
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
{BeforeInput}
|
{BeforeInput}
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
defaultLanguage={prismToMonacoLanguageMap[language] || language}
|
defaultLanguage={prismToMonacoLanguageMap[language] || language}
|
||||||
|
|||||||
@@ -50,12 +50,13 @@ export const ConfirmPassword: React.FC<ConfirmPasswordFieldProps> = (props) => {
|
|||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join(' ')}
|
.join(' ')}
|
||||||
>
|
>
|
||||||
<FieldError path={path} />
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
htmlFor="field-confirm-password"
|
htmlFor="field-confirm-password"
|
||||||
label={t('authentication:confirmPassword')}
|
label={t('authentication:confirmPassword')}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
<div className={`${fieldBaseClass}__wrap`}>
|
||||||
|
<FieldError path={path} />
|
||||||
<input
|
<input
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
disabled={!!disabled}
|
disabled={!!disabled}
|
||||||
@@ -66,5 +67,6 @@ export const ConfirmPassword: React.FC<ConfirmPasswordFieldProps> = (props) => {
|
|||||||
value={(value as string) || ''}
|
value={(value as string) || ''}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
@import '../../scss/styles.scss';
|
@import '../../scss/styles.scss';
|
||||||
|
|
||||||
.date-time-field {
|
|
||||||
&__error-wrap {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
html[data-theme='light'] {
|
html[data-theme='light'] {
|
||||||
.date-time-field {
|
.date-time-field {
|
||||||
&--has-error {
|
&--has-error {
|
||||||
|
|||||||
@@ -90,16 +90,14 @@ const DateTimeField: React.FC<DateFieldProps> = (props) => {
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={`${baseClass}__error-wrap`}>
|
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
</div>
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
<div className={`${baseClass}__input-wrapper`} id={`field-${path.replace(/\./g, '__')}`}>
|
<div className={`${fieldBaseClass}__wrap`} id={`field-${path.replace(/\./g, '__')}`}>
|
||||||
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
{BeforeInput}
|
{BeforeInput}
|
||||||
<DatePickerField
|
<DatePickerField
|
||||||
{...datePickerProps}
|
{...datePickerProps}
|
||||||
|
|||||||
@@ -77,14 +77,14 @@ const EmailField: React.FC<EmailFieldProps> = (props) => {
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
<div>
|
<div className={`${fieldBaseClass}__wrap`}>
|
||||||
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
{BeforeInput}
|
{BeforeInput}
|
||||||
<input
|
<input
|
||||||
autoComplete={autoComplete}
|
autoComplete={autoComplete}
|
||||||
|
|||||||
@@ -130,14 +130,15 @@ const JSONFieldComponent: React.FC<JSONFieldProps> = (props) => {
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
<div>
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
|
<div className={`${fieldBaseClass}__wrap`}>
|
||||||
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
{BeforeInput}
|
{BeforeInput}
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
defaultLanguage="json"
|
defaultLanguage="json"
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ const NumberFieldComponent: React.FC<NumberFieldProps> = (props) => {
|
|||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
|
<div className={`${fieldBaseClass}__wrap`}>
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
{hasMany ? (
|
{hasMany ? (
|
||||||
<ReactSelect
|
<ReactSelect
|
||||||
@@ -218,6 +219,7 @@ const NumberFieldComponent: React.FC<NumberFieldProps> = (props) => {
|
|||||||
<FieldDescription {...(descriptionProps || {})} />
|
<FieldDescription {...(descriptionProps || {})} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,13 +67,15 @@ const PasswordField: React.FC<PasswordFieldProps> = (props) => {
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
|
<div className={`${fieldBaseClass}__wrap`}>
|
||||||
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
|
|
||||||
<input
|
<input
|
||||||
autoComplete={autoComplete}
|
autoComplete={autoComplete}
|
||||||
disabled={formProcessing || disabled}
|
disabled={formProcessing || disabled}
|
||||||
@@ -84,6 +86,7 @@ const PasswordField: React.FC<PasswordFieldProps> = (props) => {
|
|||||||
value={(value as string) || ''}
|
value={(value as string) || ''}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
@import '../../scss/styles.scss';
|
@import '../../scss/styles.scss';
|
||||||
|
|
||||||
.radio-group {
|
.radio-group {
|
||||||
&__error-wrap {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--layout-horizontal {
|
&--layout-horizontal {
|
||||||
ul {
|
ul {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -99,15 +99,15 @@ const RadioGroupField: React.FC<RadioFieldProps> = (props) => {
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={`${baseClass}__error-wrap`}>
|
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
</div>
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
|
<div className={`${fieldBaseClass}__wrap`}>
|
||||||
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
|
|
||||||
<ul className={`${baseClass}--group`} id={`field-${path.replace(/\./g, '__')}`}>
|
<ul className={`${baseClass}--group`} id={`field-${path.replace(/\./g, '__')}`}>
|
||||||
{options.map((option) => {
|
{options.map((option) => {
|
||||||
let optionValue = ''
|
let optionValue = ''
|
||||||
@@ -151,6 +151,7 @@ const RadioGroupField: React.FC<RadioFieldProps> = (props) => {
|
|||||||
<FieldDescription {...(descriptionProps || {})} />
|
<FieldDescription {...(descriptionProps || {})} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -471,13 +471,15 @@ const RelationshipField: React.FC<RelationshipFieldProps> = (props) => {
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
|
<div className={`${fieldBaseClass}__wrap`}>
|
||||||
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
|
|
||||||
{!errorLoading && (
|
{!errorLoading && (
|
||||||
<div className={`${baseClass}__wrap`}>
|
<div className={`${baseClass}__wrap`}>
|
||||||
<ReactSelect
|
<ReactSelect
|
||||||
@@ -582,6 +584,7 @@ const RelationshipField: React.FC<RelationshipFieldProps> = (props) => {
|
|||||||
<FieldDescription {...(descriptionProps || {})} />
|
<FieldDescription {...(descriptionProps || {})} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,14 +149,15 @@ const SelectField: React.FC<SelectFieldProps> = (props) => {
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
<div>
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
|
<div className={`${fieldBaseClass}__wrap`}>
|
||||||
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
{BeforeInput}
|
{BeforeInput}
|
||||||
<ReactSelect
|
<ReactSelect
|
||||||
disabled={readOnly}
|
disabled={readOnly}
|
||||||
|
|||||||
@@ -60,13 +60,15 @@ export const TextInput: React.FC<TextInputProps> = (props) => {
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
|
<div className={`${fieldBaseClass}__wrap`}>
|
||||||
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
|
|
||||||
{hasMany ? (
|
{hasMany ? (
|
||||||
<ReactSelect
|
<ReactSelect
|
||||||
className={`field-${path.replace(/\./g, '__')}`}
|
className={`field-${path.replace(/\./g, '__')}`}
|
||||||
@@ -116,5 +118,6 @@ export const TextInput: React.FC<TextInputProps> = (props) => {
|
|||||||
<FieldDescription {...(descriptionProps || {})} />
|
<FieldDescription {...(descriptionProps || {})} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,13 +54,14 @@ export const TextareaInput: React.FC<TextAreaInputProps> = (props) => {
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
|
<div className={`${fieldBaseClass}__wrap`}>
|
||||||
|
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
|
||||||
{BeforeInput}
|
{BeforeInput}
|
||||||
<label className="textarea-outer" htmlFor={`field-${path.replace(/\./g, '__')}`}>
|
<label className="textarea-outer" htmlFor={`field-${path.replace(/\./g, '__')}`}>
|
||||||
<div className="textarea-inner">
|
<div className="textarea-inner">
|
||||||
@@ -85,5 +86,6 @@ export const TextareaInput: React.FC<TextAreaInputProps> = (props) => {
|
|||||||
<FieldDescription {...(descriptionProps || {})} />
|
<FieldDescription {...(descriptionProps || {})} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,13 +133,15 @@ export const UploadInput: React.FC<UploadInputProps> = (props) => {
|
|||||||
width,
|
width,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FieldError CustomError={CustomError} {...(errorProps || {})} />
|
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
CustomLabel={CustomLabel}
|
CustomLabel={CustomLabel}
|
||||||
label={label}
|
label={label}
|
||||||
required={required}
|
required={required}
|
||||||
{...(labelProps || {})}
|
{...(labelProps || {})}
|
||||||
/>
|
/>
|
||||||
|
<div className={`${fieldBaseClass}__wrap`}>
|
||||||
|
<FieldError CustomError={CustomError} {...(errorProps || {})} />
|
||||||
|
|
||||||
{collection?.upload && (
|
{collection?.upload && (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{fileDoc && !missingFile && (
|
{fileDoc && !missingFile && (
|
||||||
@@ -184,6 +186,7 @@ export const UploadInput: React.FC<UploadInputProps> = (props) => {
|
|||||||
{!readOnly && <DocumentDrawer onSave={onSave} />}
|
{!readOnly && <DocumentDrawer onSave={onSave} />}
|
||||||
{!readOnly && <ListDrawer onSelect={onSelect} />}
|
{!readOnly && <ListDrawer onSelect={onSelect} />}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
.field-error.tooltip {
|
.field-error.tooltip {
|
||||||
font-family: var(--font-body);
|
font-family: var(--font-body);
|
||||||
top: 0;
|
|
||||||
bottom: auto;
|
|
||||||
left: auto;
|
left: auto;
|
||||||
max-width: 75%;
|
max-width: 75%;
|
||||||
right: calc(var(--base) * 0.5);
|
right: calc(var(--base) * 0.5);
|
||||||
@@ -12,5 +10,6 @@
|
|||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
border-top-color: var(--theme-error-500);
|
border-top-color: var(--theme-error-500);
|
||||||
|
border-bottom-color: var(--theme-error-500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ const DefaultFieldError: React.FC<ErrorProps> = (props) => {
|
|||||||
const message = messageFromProps || errorMessage
|
const message = messageFromProps || errorMessage
|
||||||
const showMessage = showErrorFromProps || (hasSubmitted && valid === false)
|
const showMessage = showErrorFromProps || (hasSubmitted && valid === false)
|
||||||
|
|
||||||
if (showMessage) {
|
if (showMessage && message?.length) {
|
||||||
return (
|
return (
|
||||||
<Tooltip alignCaret={alignCaret} className={baseClass} delay={0}>
|
<Tooltip alignCaret={alignCaret} className={baseClass} delay={0} staticPositioning>
|
||||||
{message}
|
{message}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,8 +11,13 @@
|
|||||||
--spacing-field: 0;
|
--spacing-field: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.field-type__wrap {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
& > .field-type {
|
& > .field-type {
|
||||||
margin-bottom: var(--spacing-field);
|
margin-bottom: var(--spacing-field);
|
||||||
|
position: relative;
|
||||||
|
|
||||||
&[type='hidden'] {
|
&[type='hidden'] {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const useIntersect = (
|
|||||||
const [node, setNode] = useState(null)
|
const [node, setNode] = useState(null)
|
||||||
|
|
||||||
const observer = useRef(
|
const observer = useRef(
|
||||||
typeof window !== 'undefined' && 'IntersectionObserver' in window
|
typeof window !== 'undefined' && 'IntersectionObserver' in window && !disable
|
||||||
? new window.IntersectionObserver(([ent]) => updateEntry(ent), {
|
? new window.IntersectionObserver(([ent]) => updateEntry(ent), {
|
||||||
root,
|
root,
|
||||||
rootMargin,
|
rootMargin,
|
||||||
|
|||||||
Reference in New Issue
Block a user