Skip to content

Commit 71140ba

Browse files
authored
fix(Field): complex tooltips (#938)
1 parent 1a16e60 commit 71140ba

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Fix FieldWrapper tooltip prop to properly support ReactNode values, not just strings. Previously, ReactNode tooltips (like JSX fragments) were incorrectly cast to strings, causing them to fail.

src/components/form/FieldWrapper/FieldWrapper.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ SideLabel.args = {
6363
export const SideLabelWithTooltip = Template.bind({});
6464
SideLabelWithTooltip.args = {
6565
labelPosition: 'side',
66-
tooltip: 'Long description',
66+
tooltip: <>Long description</>,
6767
};
6868

6969
export const SideLabelWithMessage = Template.bind({});

src/components/form/FieldWrapper/FieldWrapper.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { Item } from '../../content/Item';
77
import { Text } from '../../content/Text';
88
import { Flex } from '../../layout/Flex';
99
import { Space } from '../../layout/Space';
10-
import { TooltipProvider } from '../../overlays/Tooltip/TooltipProvider';
1110
import { Label } from '../Label';
1211

1312
import { CubeFieldWrapperProps } from './types';
@@ -142,7 +141,9 @@ export const FieldWrapper = forwardRef(function FieldWrapper(
142141
<Item
143142
icon={<InfoCircleIcon color="#purple-text" />}
144143
size="inline"
145-
tooltip={tooltip as string}
144+
tooltip={
145+
typeof tooltip === 'string' ? tooltip : { title: tooltip }
146+
}
146147
/>
147148
) : null}
148149

0 commit comments

Comments
 (0)