Skip to content

Commit 1843970

Browse files
committed
fixes checkbox error tooltip alignment
1 parent e774b76 commit 1843970

4 files changed

Lines changed: 14 additions & 8 deletions

File tree

packages/ui/src/elements/Tooltip/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474
.tooltip--caret-left {
7575
&::after {
76-
left: 0;
76+
left: var(--spacer-3);
7777
}
7878
}
7979

packages/ui/src/fields/Checkbox/Input.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type CheckboxInputProps = {
1313
readonly BeforeInput?: React.ReactNode
1414
readonly checked?: boolean
1515
readonly className?: string
16+
readonly Error?: React.ReactNode
1617
readonly id?: string
1718
readonly inputRef?: React.RefObject<HTMLInputElement | null>
1819
readonly Label?: React.ReactNode
@@ -34,6 +35,7 @@ export const CheckboxInput: React.FC<CheckboxInputProps> = ({
3435
BeforeInput,
3536
checked,
3637
className,
38+
Error,
3739
inputRef,
3840
Label,
3941
label,
@@ -88,6 +90,7 @@ export const CheckboxInput: React.FC<CheckboxInputProps> = ({
8890
{!checked && partialChecked && <LineIcon />}
8991
</span>
9092
{AfterInput}
93+
{Error}
9194
</div>
9295
<RenderCustomComponent
9396
CustomComponent={Label}

packages/ui/src/fields/Checkbox/index.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
.tooltip:not([aria-hidden='true']) {
66
right: auto;
7-
position: static;
7+
left: calc(-1 * var(--spacer-2));
8+
position: absolute;
89
transform: translateY(calc(var(--caret-size) * -1));
910
margin-bottom: 0.2em;
1011
max-width: fit-content;

packages/ui/src/fields/Checkbox/index.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,18 @@ const CheckboxFieldComponent: CheckboxFieldClientComponent = (props) => {
106106
.join(' ')}
107107
style={styles}
108108
>
109-
<RenderCustomComponent
110-
CustomComponent={Error}
111-
Fallback={
112-
<FieldError alignCaret={isRTL ? 'right' : 'left'} path={path} showError={showError} />
113-
}
114-
/>
115109
<CheckboxInput
116110
AfterInput={AfterInput}
117111
BeforeInput={BeforeInput}
118112
checked={checked}
113+
Error={
114+
<RenderCustomComponent
115+
CustomComponent={Error}
116+
Fallback={
117+
<FieldError alignCaret={isRTL ? 'right' : 'left'} path={path} showError={showError} />
118+
}
119+
/>
120+
}
119121
id={fieldID}
120122
inputRef={null}
121123
Label={Label}

0 commit comments

Comments
 (0)